diff --git a/assets/DailyMotion-CZtOhfK_.js b/assets/DailyMotion-BcpEuM7C.js similarity index 97% rename from assets/DailyMotion-CZtOhfK_.js rename to assets/DailyMotion-BcpEuM7C.js index ebdec361f7..711e4da11f 100644 --- a/assets/DailyMotion-CZtOhfK_.js +++ b/assets/DailyMotion-BcpEuM7C.js @@ -1 +1 @@ -import{g as P,r as v,u as D,p as O}from"./index-Bf2N9lBY.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-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}; diff --git a/assets/Facebook-CKVngJGG.js b/assets/Facebook-BS5pGh_M.js similarity index 98% rename from assets/Facebook-CKVngJGG.js rename to assets/Facebook-BS5pGh_M.js index 54406a108e..3944e0917b 100644 --- a/assets/Facebook-CKVngJGG.js +++ b/assets/Facebook-BS5pGh_M.js @@ -1 +1 @@ -import{g as _,r as g,u as P,p as m}from"./index-Bf2N9lBY.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-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}; diff --git a/assets/FilePlayer-B7XqgIwc.js b/assets/FilePlayer-Bh28IGlb.js similarity index 99% rename from assets/FilePlayer-B7XqgIwc.js rename to assets/FilePlayer-Bh28IGlb.js index a15a1d7a8a..52f258fd1b 100644 --- a/assets/FilePlayer-B7XqgIwc.js +++ b/assets/FilePlayer-Bh28IGlb.js @@ -1 +1 @@ -import{g as b,r as _,u as O,p as A}from"./index-Bf2N9lBY.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-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}; diff --git a/assets/Kaltura-CYtm0IWA.js b/assets/Kaltura-CJOVHMDM.js similarity index 97% rename from assets/Kaltura-CYtm0IWA.js rename to assets/Kaltura-CJOVHMDM.js index 1593368e07..a535302106 100644 --- a/assets/Kaltura-CYtm0IWA.js +++ b/assets/Kaltura-CJOVHMDM.js @@ -1 +1 @@ -import{g as y,r as f,u as _,p as m}from"./index-Bf2N9lBY.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-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}; diff --git a/assets/Mixcloud-BUQUnZkn.js b/assets/Mixcloud-Dy1pFfJ_.js similarity index 97% rename from assets/Mixcloud-BUQUnZkn.js rename to assets/Mixcloud-Dy1pFfJ_.js index 6da68dc7bc..46d2219aff 100644 --- a/assets/Mixcloud-BUQUnZkn.js +++ b/assets/Mixcloud-Dy1pFfJ_.js @@ -1 +1 @@ -import{g as _,r as f,u as m,p as g}from"./index-Bf2N9lBY.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-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}; diff --git a/assets/Mux-59192Tm3.js b/assets/Mux-wTGJ9izo.js similarity index 98% rename from assets/Mux-59192Tm3.js rename to assets/Mux-wTGJ9izo.js index c8b4947260..f7f5891fa7 100644 --- a/assets/Mux-59192Tm3.js +++ b/assets/Mux-wTGJ9izo.js @@ -1 +1 @@ -import{g as P,_ as E,r as g,p as _}from"./index-Bf2N9lBY.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-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}; diff --git a/assets/Preview-BOylr8KG.js b/assets/Preview-Dqy6JN7A.js similarity index 97% rename from assets/Preview-BOylr8KG.js rename to assets/Preview-Dqy6JN7A.js index 2fa34b9b1e..01d03cdd44 100644 --- a/assets/Preview-BOylr8KG.js +++ b/assets/Preview-Dqy6JN7A.js @@ -1 +1 @@ -import{g as y,r as v}from"./index-Bf2N9lBY.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-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}; diff --git a/assets/SoundCloud-CW3rueaI.js b/assets/SoundCloud-CAYDm4MY.js similarity index 97% rename from assets/SoundCloud-CW3rueaI.js rename to assets/SoundCloud-CAYDm4MY.js index c951301b6a..0c04d61013 100644 --- a/assets/SoundCloud-CW3rueaI.js +++ b/assets/SoundCloud-CAYDm4MY.js @@ -1 +1 @@ -import{g as P,r as g,u as b,p as v}from"./index-Bf2N9lBY.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-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}; diff --git a/assets/Streamable-DEtvFbMk.js b/assets/Streamable-Dpc5YVG-.js similarity index 97% rename from assets/Streamable-DEtvFbMk.js rename to assets/Streamable-Dpc5YVG-.js index 181af719fb..744e17a009 100644 --- a/assets/Streamable-DEtvFbMk.js +++ b/assets/Streamable-Dpc5YVG-.js @@ -1 +1 @@ -import{g as m,r as f,u as _,p as b}from"./index-Bf2N9lBY.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-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}; diff --git a/assets/Twitch-hnmwH80q.js b/assets/Twitch-MLiqQ3u5.js similarity index 97% rename from assets/Twitch-hnmwH80q.js rename to assets/Twitch-MLiqQ3u5.js index 79ac7164c2..4d497f8ad3 100644 --- a/assets/Twitch-hnmwH80q.js +++ b/assets/Twitch-MLiqQ3u5.js @@ -1 +1 @@ -import{g as w,r as D,u as C,p as N}from"./index-Bf2N9lBY.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-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}; diff --git a/assets/Vidyard-DEs875ka.js b/assets/Vidyard-DLcBd-dE.js similarity index 97% rename from assets/Vidyard-DEs875ka.js rename to assets/Vidyard-DLcBd-dE.js index 7a0ec02337..4c5c4536ef 100644 --- a/assets/Vidyard-DEs875ka.js +++ b/assets/Vidyard-DLcBd-dE.js @@ -1 +1 @@ -import{g as m,r as v,u as b,p as O}from"./index-Bf2N9lBY.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-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}; diff --git a/assets/Vimeo-D65yvNpO.js b/assets/Vimeo-C1w4CmUB.js similarity index 98% rename from assets/Vimeo-D65yvNpO.js rename to assets/Vimeo-C1w4CmUB.js index 14dd2a6e57..1e4313b3eb 100644 --- a/assets/Vimeo-D65yvNpO.js +++ b/assets/Vimeo-C1w4CmUB.js @@ -1 +1 @@ -import{g as d,r as f,u as m,p as _}from"./index-Bf2N9lBY.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-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}; diff --git a/assets/Wistia-Qrs_QWdc.js b/assets/Wistia-Dh_p96TU.js similarity index 98% rename from assets/Wistia-Qrs_QWdc.js rename to assets/Wistia-Dh_p96TU.js index 61d0d31dc5..c79741193c 100644 --- a/assets/Wistia-Qrs_QWdc.js +++ b/assets/Wistia-Dh_p96TU.js @@ -1 +1 @@ -import{g,r as m,u as v,p as w}from"./index-Bf2N9lBY.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-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}; diff --git a/assets/YouTube-BumwYQ13.js b/assets/YouTube-CxgmswCk.js similarity index 98% rename from assets/YouTube-BumwYQ13.js rename to assets/YouTube-CxgmswCk.js index 94e0367500..ef51d9da15 100644 --- a/assets/YouTube-BumwYQ13.js +++ b/assets/YouTube-CxgmswCk.js @@ -1 +1 @@ -import{g as U,r as I,u as L,p as M}from"./index-Bf2N9lBY.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-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}; diff --git a/assets/index-Bf2N9lBY.js b/assets/index-Bf2N9lBY.js deleted file mode 100644 index 48f9698833..0000000000 --- a/assets/index-Bf2N9lBY.js +++ /dev/null @@ -1,590 +0,0 @@ -var lS=Object.defineProperty;var uS=(a,_,$)=>_ in a?lS(a,_,{enumerable:!0,configurable:!0,writable:!0,value:$}):a[_]=$;var Yr=(a,_,$)=>(uS(a,typeof _!="symbol"?_+"":_,$),$),cm=(a,_,$)=>{if(!_.has(a))throw TypeError("Cannot "+$)};var Br=(a,_,$)=>(cm(a,_,"read from private field"),$?$.call(a):_.get(a)),In=(a,_,$)=>{if(_.has(a))throw TypeError("Cannot add the same private member more than once");_ instanceof WeakSet?_.add(a):_.set(a,$)},kn=(a,_,$,j)=>(cm(a,_,"write to private field"),j?j.call(a,$):_.set(a,$),$);var r0=(a,_,$,j)=>({set _(et){kn(a,_,et,$)},get _(){return Br(a,_,j)}}),Zn=(a,_,$)=>(cm(a,_,"access private method"),$);function _mergeNamespaces(a,_){for(var $=0;$<_.length;$++){const j=_[$];if(typeof j!="string"&&!Array.isArray(j)){for(const et in j)if(et!=="default"&&!(et in a)){const tt=Object.getOwnPropertyDescriptor(j,et);tt&&Object.defineProperty(a,et,tt.get?tt:{enumerable:!0,get:()=>j[et]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}(function(){const _=document.createElement("link").relList;if(_&&_.supports&&_.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(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}function getAugmentedNamespace(a){if(a.__esModule)return a;var _=a.default;if(typeof _=="function"){var $=function j(){return this instanceof j?Reflect.construct(_,arguments,this.constructor):_.apply(this,arguments)};$.prototype=_.prototype}else $={};return Object.defineProperty($,"__esModule",{value:!0}),Object.keys(a).forEach(function(j){var et=Object.getOwnPropertyDescriptor(a,j);Object.defineProperty($,j,et.get?et:{enumerable:!0,get:function(){return a[j]}})}),$}var jsxRuntime={exports:{}},reactJsxRuntime_production_min={},react={exports:{}},react_production_min={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * 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(a){return a===null||typeof a!="object"?null:(a=z$3&&a[z$3]||a["@@iterator"],typeof a=="function"?a: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=a,this.context=_,this.refs=D$1,this.updater=$||B$1}E$1.prototype.isReactComponent={};E$1.prototype.setState=function(a,_){if(typeof a!="object"&&typeof a!="function"&&a!=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(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate")};function F(){}F.prototype=E$1.prototype;function G$1(a,_,$){this.props=a,this.context=_,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(_!=null)for(j in _.ref!==void 0&&(rt=_.ref),_.key!==void 0&&(tt=""+_.key),_)J.call(_,j)&&!L$1.hasOwnProperty(j)&&(et[j]=_[j]);var nt=arguments.length-2;if(nt===1)et.children=$;else if(1>>1,Et=At[Tt];if(0>>1;Ttet(ir,St))nret(Zt,ir)?(At[Tt]=Zt,At[nr]=St,Tt=nr):(At[Tt]=ir,At[tr]=St,Tt=tr);else if(nret(Zt,St))At[Tt]=Zt,At[nr]=St,Tt=nr;else break e}}return Rt}function et(At,Rt){var St=At.sortIndex-Rt.sortIndex;return St!==0?St:At.id-Rt.id}if(typeof performance=="object"&&typeof performance.now=="function"){var tt=performance;a.unstable_now=function(){return tt.now()}}else{var rt=Date,nt=rt.now();a.unstable_now=function(){return rt.now()-nt}}var it=[],st=[],ot=1,at=null,ut=3,ht=!1,yt=!1,wt=!1,Ct=typeof setTimeout=="function"?setTimeout:null,Pt=typeof clearTimeout=="function"?clearTimeout:null,$t=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function Mt(At){for(var Rt=$(st);Rt!==null;){if(Rt.callback===null)j(st);else if(Rt.startTime<=At)j(st),Rt.sortIndex=Rt.expirationTime,_(it,Rt);else break;Rt=$(st)}}function Lt(At){if(wt=!1,Mt(At),!yt)if($(it)!==null)yt=!0,mt(Dt);else{var Rt=$(st);Rt!==null&&xt(Lt,Rt.startTime-At)}}function Dt(At,Rt){yt=!1,wt&&(wt=!1,Pt(It),It=-1),ht=!0;var St=ut;try{for(Mt(Rt),at=$(it);at!==null&&(!(at.expirationTime>Rt)||At&&!jt());){var Tt=at.callback;if(typeof Tt=="function"){at.callback=null,ut=at.priorityLevel;var Et=Tt(at.expirationTime<=Rt);Rt=a.unstable_now(),typeof Et=="function"?at.callback=Et:at===$(it)&&j(it),Mt(Rt)}else j(it);at=$(it)}if(at!==null)var Nt=!0;else{var tr=$(st);tr!==null&&xt(Lt,tr.startTime-Rt),Nt=!1}return Nt}finally{at=null,ut=St,ht=!1}}var zt=!1,Ot=null,It=-1,Bt=5,Ft=-1;function jt(){return!(a.unstable_now()-FtAt||125Tt?(At.sortIndex=St,_(st,At),$(it)===null&&At===$(st)&&(wt?(Pt(It),It=-1):wt=!0,xt(Lt,St-Tt))):(At.sortIndex=Et,_(it,At),yt||ht||(yt=!0,mt(Dt))),At},a.unstable_shouldYield=jt,a.unstable_wrapCallback=function(At){var Rt=ut;return function(){var St=ut;ut=Rt;try{return At.apply(this,arguments)}finally{ut=St}}}})(scheduler_production_min);scheduler.exports=scheduler_production_min;var schedulerExports=scheduler.exports;/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * 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(a){for(var _="https://reactjs.org/docs/error-decoder.html?invariant="+a,$=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(a){return ja.call(ma,a)?!0:ja.call(la,a)?!1:ka.test(a)?ma[a]=!0:(la[a]=!0,!1)}function pa(a,_,$,j){if($!==null&&$.type===0)return!1;switch(typeof _){case"function":case"symbol":return!0;case"boolean":return j?!1:$!==null?!$.acceptsBooleans:(a=a.toLowerCase().slice(0,5),a!=="data-"&&a!=="aria-");default:return!1}}function qa(a,_,$,j){if(_===null||typeof _>"u"||pa(a,_,$,j))return!0;if(j)return!1;if($!==null)switch($.type){case 3:return!_;case 4:return _===!1;case 5:return isNaN(_);case 6:return isNaN(_)||1>_}return!1}function v$4(a,_,$,j,et,tt,rt){this.acceptsBooleans=_===2||_===3||_===4,this.attributeName=j,this.attributeNamespace=et,this.mustUseProperty=$,this.propertyName=a,this.type=_,this.sanitizeURL=tt,this.removeEmptyString=rt}var z$2={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(a){z$2[a]=new v$4(a,0,!1,a,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(a){var _=a[0];z$2[_]=new v$4(_,1,!1,a[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(a){z$2[a]=new v$4(a,2,!1,a.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(a){z$2[a]=new v$4(a,2,!1,a,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(a){z$2[a]=new v$4(a,3,!1,a.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(a){z$2[a]=new v$4(a,3,!0,a,null,!1,!1)});["capture","download"].forEach(function(a){z$2[a]=new v$4(a,4,!1,a,null,!1,!1)});["cols","rows","size","span"].forEach(function(a){z$2[a]=new v$4(a,6,!1,a,null,!1,!1)});["rowSpan","start"].forEach(function(a){z$2[a]=new v$4(a,5,!1,a.toLowerCase(),null,!1,!1)});var ra=/[\-:]([a-z])/g;function sa(a){return a[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(a){var _=a.replace(ra,sa);z$2[_]=new v$4(_,1,!1,a,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(a){var _=a.replace(ra,sa);z$2[_]=new v$4(_,1,!1,a,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(a){var _=a.replace(ra,sa);z$2[_]=new v$4(_,1,!1,a,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(a){z$2[a]=new v$4(a,1,!1,a.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(a){z$2[a]=new v$4(a,1,!1,a.toLowerCase(),null,!0,!0)});function ta(a,_,$,j){var et=z$2.hasOwnProperty(_)?z$2[_]:null;(et!==null?et.type!==0:j||!(2<_.length)||_[0]!=="o"&&_[0]!=="O"||_[1]!=="n"&&_[1]!=="N")&&(qa(_,$,et,j)&&($=null),j||et===null?oa(_)&&($===null?a.removeAttribute(_):a.setAttribute(_,""+$)):et.mustUseProperty?a[et.propertyName]=$===null?et.type===3?!1:"":$:(_=et.attributeName,j=et.attributeNamespace,$===null?a.removeAttribute(_):(et=et.type,$=et===3||et===4&&$===!0?"":""+$,j?a.setAttributeNS(j,_,$):a.setAttribute(_,$))))}var ua=aa.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,va=Symbol.for("react.element"),wa=Symbol.for("react.portal"),ya=Symbol.for("react.fragment"),za=Symbol.for("react.strict_mode"),Aa=Symbol.for("react.profiler"),Ba=Symbol.for("react.provider"),Ca=Symbol.for("react.context"),Da=Symbol.for("react.forward_ref"),Ea=Symbol.for("react.suspense"),Fa=Symbol.for("react.suspense_list"),Ga=Symbol.for("react.memo"),Ha=Symbol.for("react.lazy"),Ia=Symbol.for("react.offscreen"),Ja=Symbol.iterator;function Ka(a){return a===null||typeof a!="object"?null:(a=Ja&&a[Ja]||a["@@iterator"],typeof a=="function"?a:null)}var A$1=Object.assign,La;function Ma(a){if(La===void 0)try{throw Error()}catch($){var _=$.stack.trim().match(/\n( *(at )?)/);La=_&&_[1]||""}return` -`+La+a}var Na=!1;function Oa(a,_){if(!a||Na)return"";Na=!0;var $=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(_)if(_=function(){throw Error()},Object.defineProperty(_.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(_,[])}catch(st){var j=st}Reflect.construct(a,[],_)}else{try{_.call()}catch(st){j=st}a.call(_.prototype)}else{try{throw Error()}catch(st){j=st}a()}}catch(st){if(st&&j&&typeof st.stack=="string"){for(var et=st.stack.split(` -`),tt=j.stack.split(` -`),rt=et.length-1,nt=tt.length-1;1<=rt&&0<=nt&&et[rt]!==tt[nt];)nt--;for(;1<=rt&&0<=nt;rt--,nt--)if(et[rt]!==tt[nt]){if(rt!==1||nt!==1)do if(rt--,nt--,0>nt||et[rt]!==tt[nt]){var it=` -`+et[rt].replace(" at new "," at ");return a.displayName&&it.includes("")&&(it=it.replace("",a.displayName)),it}while(1<=rt&&0<=nt);break}}}finally{Na=!1,Error.prepareStackTrace=$}return(a=a?a.displayName||a.name:"")?Ma(a):""}function Pa(a){switch(a.tag){case 5:return Ma(a.type);case 16:return Ma("Lazy");case 13:return Ma("Suspense");case 19:return Ma("SuspenseList");case 0:case 2:case 15:return a=Oa(a.type,!1),a;case 11:return a=Oa(a.type.render,!1),a;case 1:return a=Oa(a.type,!0),a;default:return""}}function Qa(a){if(a==null)return null;if(typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){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 a=="object")switch(a.$$typeof){case Ca:return(a.displayName||"Context")+".Consumer";case Ba:return(a._context.displayName||"Context")+".Provider";case Da:var _=a.render;return a=a.displayName,a||(a=_.displayName||_.name||"",a=a!==""?"ForwardRef("+a+")":"ForwardRef"),a;case Ga:return _=a.displayName||null,_!==null?_:Qa(a.type)||"Memo";case Ha:_=a._payload,a=a._init;try{return Qa(a(_))}catch{}}return null}function Ra(a){var _=a.type;switch(a.tag){case 24:return"Cache";case 9:return(_.displayName||"Context")+".Consumer";case 10:return(_._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return a=_.render,a=a.displayName||a.name||"",_.displayName||(a!==""?"ForwardRef("+a+")":"ForwardRef");case 7:return"Fragment";case 5:return _;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Qa(_);case 8:return _===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 _=="function")return _.displayName||_.name||null;if(typeof _=="string")return _}return null}function Sa(a){switch(typeof a){case"boolean":case"number":case"string":case"undefined":return a;case"object":return a;default:return""}}function Ta(a){var _=a.type;return(a=a.nodeName)&&a.toLowerCase()==="input"&&(_==="checkbox"||_==="radio")}function Ua(a){var _=Ta(a)?"checked":"value",$=Object.getOwnPropertyDescriptor(a.constructor.prototype,_),j=""+a[_];if(!a.hasOwnProperty(_)&&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(){a._valueTracker=null,delete a[_]}}}}function Va(a){a._valueTracker||(a._valueTracker=Ua(a))}function Wa(a){if(!a)return!1;var _=a._valueTracker;if(!_)return!0;var $=_.getValue(),j="";return a&&(j=Ta(a)?a.checked?"true":"false":a.value),a=j,a!==$?(_.setValue(a),!0):!1}function Xa(a){if(a=a||(typeof document<"u"?document:void 0),typeof a>"u")return null;try{return a.activeElement||a.body}catch{return a.body}}function Ya(a,_){var $=_.checked;return A$1({},_,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:$??a._wrapperState.initialChecked})}function Za(a,_){var $=_.defaultValue==null?"":_.defaultValue,j=_.checked!=null?_.checked:_.defaultChecked;$=Sa(_.value!=null?_.value:$),a._wrapperState={initialChecked:j,initialValue:$,controlled:_.type==="checkbox"||_.type==="radio"?_.checked!=null:_.value!=null}}function ab(a,_){_=_.checked,_!=null&&ta(a,"checked",_,!1)}function bb(a,_){ab(a,_);var $=Sa(_.value),j=_.type;if($!=null)j==="number"?($===0&&a.value===""||a.value!=$)&&(a.value=""+$):a.value!==""+$&&(a.value=""+$);else if(j==="submit"||j==="reset"){a.removeAttribute("value");return}_.hasOwnProperty("value")?cb(a,_.type,$):_.hasOwnProperty("defaultValue")&&cb(a,_.type,Sa(_.defaultValue)),_.checked==null&&_.defaultChecked!=null&&(a.defaultChecked=!!_.defaultChecked)}function db(a,_,$){if(_.hasOwnProperty("value")||_.hasOwnProperty("defaultValue")){var j=_.type;if(!(j!=="submit"&&j!=="reset"||_.value!==void 0&&_.value!==null))return;_=""+a._wrapperState.initialValue,$||_===a.value||(a.value=_),a.defaultValue=_}$=a.name,$!==""&&(a.name=""),a.defaultChecked=!!a._wrapperState.initialChecked,$!==""&&(a.name=$)}function cb(a,_,$){(_!=="number"||Xa(a.ownerDocument)!==a)&&($==null?a.defaultValue=""+a._wrapperState.initialValue:a.defaultValue!==""+$&&(a.defaultValue=""+$))}var eb=Array.isArray;function fb(a,_,$,j){if(a=a.options,_){_={};for(var et=0;et<$.length;et++)_["$"+$[et]]=!0;for($=0;$"+_.valueOf().toString()+"",_=mb.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;_.firstChild;)a.appendChild(_.firstChild)}});function ob(a,_){if(_){var $=a.firstChild;if($&&$===a.lastChild&&$.nodeType===3){$.nodeValue=_;return}}a.textContent=_}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(a){qb.forEach(function(_){_=_+a.charAt(0).toUpperCase()+a.substring(1),pb[_]=pb[a]})});function rb(a,_,$){return _==null||typeof _=="boolean"||_===""?"":$||typeof _!="number"||_===0||pb.hasOwnProperty(a)&&pb[a]?(""+_).trim():_+"px"}function sb(a,_){a=a.style;for(var $ in _)if(_.hasOwnProperty($)){var j=$.indexOf("--")===0,et=rb($,_[$],j);$==="float"&&($="cssFloat"),j?a.setProperty($,et):a[$]=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(_){if(tb[a]&&(_.children!=null||_.dangerouslySetInnerHTML!=null))throw Error(p$2(137,a));if(_.dangerouslySetInnerHTML!=null){if(_.children!=null)throw Error(p$2(60));if(typeof _.dangerouslySetInnerHTML!="object"||!("__html"in _.dangerouslySetInnerHTML))throw Error(p$2(61))}if(_.style!=null&&typeof _.style!="object")throw Error(p$2(62))}}function vb(a,_){if(a.indexOf("-")===-1)return typeof _.is=="string";switch(a){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(a){return a=a.target||a.srcElement||window,a.correspondingUseElement&&(a=a.correspondingUseElement),a.nodeType===3?a.parentNode:a}var yb=null,zb=null,Ab=null;function Bb(a){if(a=Cb(a)){if(typeof yb!="function")throw Error(p$2(280));var _=a.stateNode;_&&(_=Db(_),yb(a.stateNode,a.type,_))}}function Eb(a){zb?Ab?Ab.push(a):Ab=[a]:zb=a}function Fb(){if(zb){var a=zb,_=Ab;if(Ab=zb=null,Bb(a),_)for(a=0;a<_.length;a++)Bb(_[a])}}function Gb(a,_){return a(_)}function Hb(){}var Ib=!1;function Jb(a,_,$){if(Ib)return a(_,$);Ib=!0;try{return Gb(a,_,$)}finally{Ib=!1,(zb!==null||Ab!==null)&&(Hb(),Fb())}}function Kb(a,_){var $=a.stateNode;if($===null)return null;var j=Db($);if(j===null)return null;$=j[_];e:switch(_){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(j=!j.disabled)||(a=a.type,j=!(a==="button"||a==="input"||a==="select"||a==="textarea")),a=!j;break e;default:a=!1}if(a)return null;if($&&typeof $!="function")throw Error(p$2(231,_,typeof $));return $}var Lb=!1;if(ia)try{var Mb={};Object.defineProperty(Mb,"passive",{get:function(){Lb=!0}}),window.addEventListener("test",Mb,Mb),window.removeEventListener("test",Mb,Mb)}catch{Lb=!1}function Nb(a,_,$,j,et,tt,rt,nt,it){var st=Array.prototype.slice.call(arguments,3);try{_.apply($,st)}catch(ot){this.onError(ot)}}var Ob=!1,Pb=null,Qb=!1,Rb=null,Sb={onError:function(a){Ob=!0,Pb=a}};function Tb(a,_,$,j,et,tt,rt,nt,it){Ob=!1,Pb=null,Nb.apply(Sb,arguments)}function Ub(a,_,$,j,et,tt,rt,nt,it){if(Tb.apply(this,arguments),Ob){if(Ob){var st=Pb;Ob=!1,Pb=null}else throw Error(p$2(198));Qb||(Qb=!0,Rb=st)}}function Vb(a){var _=a,$=a;if(a.alternate)for(;_.return;)_=_.return;else{a=_;do _=a,_.flags&4098&&($=_.return),a=_.return;while(a)}return _.tag===3?$:null}function Wb(a){if(a.tag===13){var _=a.memoizedState;if(_===null&&(a=a.alternate,a!==null&&(_=a.memoizedState)),_!==null)return _.dehydrated}return null}function Xb(a){if(Vb(a)!==a)throw Error(p$2(188))}function Yb(a){var _=a.alternate;if(!_){if(_=Vb(a),_===null)throw Error(p$2(188));return _!==a?null:a}for(var $=a,j=_;;){var et=$.return;if(et===null)break;var tt=et.alternate;if(tt===null){if(j=et.return,j!==null){$=j;continue}break}if(et.child===tt.child){for(tt=et.child;tt;){if(tt===$)return Xb(et),a;if(tt===j)return Xb(et),_;tt=tt.sibling}throw Error(p$2(188))}if($.return!==j.return)$=et,j=tt;else{for(var rt=!1,nt=et.child;nt;){if(nt===$){rt=!0,$=et,j=tt;break}if(nt===j){rt=!0,j=et,$=tt;break}nt=nt.sibling}if(!rt){for(nt=tt.child;nt;){if(nt===$){rt=!0,$=tt,j=et;break}if(nt===j){rt=!0,j=tt,$=et;break}nt=nt.sibling}if(!rt)throw Error(p$2(189))}}if($.alternate!==j)throw Error(p$2(190))}if($.tag!==3)throw Error(p$2(188));return $.stateNode.current===$?a:_}function Zb(a){return a=Yb(a),a!==null?$b(a):null}function $b(a){if(a.tag===5||a.tag===6)return a;for(a=a.child;a!==null;){var _=$b(a);if(_!==null)return _;a=a.sibling}return null}var ac=ca.unstable_scheduleCallback,bc=ca.unstable_cancelCallback,cc=ca.unstable_shouldYield,dc=ca.unstable_requestPaint,B=ca.unstable_now,ec$6=ca.unstable_getCurrentPriorityLevel,fc=ca.unstable_ImmediatePriority,gc=ca.unstable_UserBlockingPriority,hc=ca.unstable_NormalPriority,ic=ca.unstable_LowPriority,jc=ca.unstable_IdlePriority,kc=null,lc=null;function mc(a){if(lc&&typeof lc.onCommitFiberRoot=="function")try{lc.onCommitFiberRoot(kc,a,void 0,(a.current.flags&128)===128)}catch{}}var oc=Math.clz32?Math.clz32:nc,pc=Math.log,qc=Math.LN2;function nc(a){return a>>>=0,a===0?32:31-(pc(a)/qc|0)|0}var rc=64,sc=4194304;function tc(a){switch(a&-a){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 a&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return a&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return a}}function uc(a,_){var $=a.pendingLanes;if($===0)return 0;var j=0,et=a.suspendedLanes,tt=a.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(_!==0&&_!==j&&!(_&et)&&(et=j&-j,tt=_&-_,et>=tt||et===16&&(tt&4194240)!==0))return _;if(j&4&&(j|=$&16),_=a.entangledLanes,_!==0)for(a=a.entanglements,_&=j;0<_;)$=31-oc(_),et=1<<$,j|=a[$],_&=~et;return j}function vc(a,_){switch(a){case 1:case 2:case 4:return _+250;case 8:case 16:case 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 _+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function wc(a,_){for(var $=a.suspendedLanes,j=a.pingedLanes,et=a.expirationTimes,tt=a.pendingLanes;0$;$++)_.push(a);return _}function Ac(a,_,$){a.pendingLanes|=_,_!==536870912&&(a.suspendedLanes=0,a.pingedLanes=0),a=a.eventTimes,_=31-oc(_),a[_]=$}function Bc(a,_){var $=a.pendingLanes&~_;a.pendingLanes=_,a.suspendedLanes=0,a.pingedLanes=0,a.expiredLanes&=_,a.mutableReadLanes&=_,a.entangledLanes&=_,_=a.entanglements;var j=a.eventTimes;for(a=a.expirationTimes;0<$;){var et=31-oc($),tt=1<=be),ee=" ",fe=!1;function ge(a,_){switch(a){case"keyup":return $d.indexOf(_.keyCode)!==-1;case"keydown":return _.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function he(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var ie=!1;function je(a,_){switch(a){case"compositionend":return he(_);case"keypress":return _.which!==32?null:(fe=!0,ee);case"textInput":return a=_.data,a===ee&&fe?null:a;default:return null}}function ke(a,_){if(ie)return a==="compositionend"||!ae&&ge(a,_)?(a=nd(),md=ld=kd=null,ie=!1,a):null;switch(a){case"paste":return null;case"keypress":if(!(_.ctrlKey||_.altKey||_.metaKey)||_.ctrlKey&&_.altKey){if(_.char&&1<_.char.length)return _.char;if(_.which)return String.fromCharCode(_.which)}return null;case"compositionend":return de&&_.locale!=="ko"?null:_.data;default:return null}}var le={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function me(a){var _=a&&a.nodeName&&a.nodeName.toLowerCase();return _==="input"?!!le[a.type]:_==="textarea"}function ne(a,_,$,j){Eb(j),_=oe(_,"onChange"),0<_.length&&($=new td("onChange","change",null,$,j),a.push({event:$,listeners:_}))}var pe=null,qe=null;function re$4(a){se(a,0)}function te(a){var _=ue(a);if(Wa(_))return a}function ve(a,_){if(a==="change")return _}var we=!1;if(ia){var xe;if(ia){var ye="oninput"in document;if(!ye){var ze=document.createElement("div");ze.setAttribute("oninput","return;"),ye=typeof ze.oninput=="function"}xe=ye}else xe=!1;we=xe&&(!document.documentMode||9=_)return{node:$,offset:_-a};a=j}e:{for(;$;){if($.nextSibling){$=$.nextSibling;break e}$=$.parentNode}$=void 0}$=Je($)}}function Le(a,_){return a&&_?a===_?!0:a&&a.nodeType===3?!1:_&&_.nodeType===3?Le(a,_.parentNode):"contains"in a?a.contains(_):a.compareDocumentPosition?!!(a.compareDocumentPosition(_)&16):!1:!1}function Me(){for(var a=window,_=Xa();_ instanceof a.HTMLIFrameElement;){try{var $=typeof _.contentWindow.location.href=="string"}catch{$=!1}if($)a=_.contentWindow;else break;_=Xa(a.document)}return _}function Ne(a){var _=a&&a.nodeName&&a.nodeName.toLowerCase();return _&&(_==="input"&&(a.type==="text"||a.type==="search"||a.type==="tel"||a.type==="url"||a.type==="password")||_==="textarea"||a.contentEditable==="true")}function Oe(a){var _=Me(),$=a.focusedElem,j=a.selectionRange;if(_!==$&&$&&$.ownerDocument&&Le($.ownerDocument.documentElement,$)){if(j!==null&&Ne($)){if(_=j.start,a=j.end,a===void 0&&(a=_),"selectionStart"in $)$.selectionStart=_,$.selectionEnd=Math.min(a,$.value.length);else if(a=(_=$.ownerDocument||document)&&_.defaultView||window,a.getSelection){a=a.getSelection();var et=$.textContent.length,tt=Math.min(j.start,et);j=j.end===void 0?tt:Math.min(j.end,et),!a.extend&&tt>j&&(et=j,j=tt,tt=et),et=Ke($,tt);var rt=Ke($,j);et&&rt&&(a.rangeCount!==1||a.anchorNode!==et.node||a.anchorOffset!==et.offset||a.focusNode!==rt.node||a.focusOffset!==rt.offset)&&(_=_.createRange(),_.setStart(et.node,et.offset),a.removeAllRanges(),tt>j?(a.addRange(_),a.extend(rt.node,rt.offset)):(_.setEnd(rt.node,rt.offset),a.addRange(_)))}}for(_=[],a=$;a=a.parentNode;)a.nodeType===1&&_.push({element:a,left:a.scrollLeft,top:a.scrollTop});for(typeof $.focus=="function"&&$.focus(),$=0;$<_.length;$++)a=_[$],a.element.scrollLeft=a.left,a.element.scrollTop=a.top}}var Pe=ia&&"documentMode"in document&&11>=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||(a.current=Sf[Tf],Sf[Tf]=null,Tf--)}function G(a,_){Tf++,Sf[Tf]=a.current,a.current=_}var Vf={},H$1=Uf(Vf),Wf=Uf(!1),Xf=Vf;function Yf(a,_){var $=a.type.contextTypes;if(!$)return Vf;var j=a.stateNode;if(j&&j.__reactInternalMemoizedUnmaskedChildContext===_)return j.__reactInternalMemoizedMaskedChildContext;var et={},tt;for(tt in $)et[tt]=_[tt];return j&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=_,a.__reactInternalMemoizedMaskedChildContext=et),et}function Zf(a){return a=a.childContextTypes,a!=null}function $f(){E(Wf),E(H$1)}function ag(a,_,$){if(H$1.current!==Vf)throw Error(p$2(168));G(H$1,_),G(Wf,$)}function bg(a,_,$){var j=a.stateNode;if(_=_.childContextTypes,typeof j.getChildContext!="function")return $;j=j.getChildContext();for(var et in j)if(!(et in _))throw Error(p$2(108,Ra(a)||"Unknown",et));return A$1({},$,j)}function cg(a){return a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||Vf,Xf=H$1.current,G(H$1,a),G(Wf,Wf.current),!0}function dg(a,_,$){var j=a.stateNode;if(!j)throw Error(p$2(169));$?(a=bg(a,_,Xf),j.__reactInternalMemoizedMergedChildContext=a,E(Wf),E(H$1),G(H$1,a)):E(Wf),G(Wf,$)}var eg=null,fg=!1,gg=!1;function hg(a){eg===null?eg=[a]:eg.push(a)}function ig(a){fg=!0,hg(a)}function jg(){if(!gg&&eg!==null){gg=!0;var a=0,_=C;try{var $=eg;for(C=1;a<$.length;a++){var j=$[a];do j=j(!0);while(j!==null)}eg=null,fg=!1}catch(et){throw eg!==null&&(eg=eg.slice(a+1)),ac(fc,jg),et}finally{C=_,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=a,ng=_}function ug(a,_,$){og[pg++]=rg,og[pg++]=sg,og[pg++]=qg,qg=a;var j=rg;a=sg;var et=32-oc(j)-1;j&=~(1<>=rt,et-=rt,rg=1<<32-oc(_)+et|$<It?(Bt=Ot,Ot=null):Bt=Ot.sibling;var Ft=ut(Pt,Ot,Mt[It],Lt);if(Ft===null){Ot===null&&(Ot=Bt);break}a&&Ot&&Ft.alternate===null&&_(Pt,Ot),$t=tt(Ft,$t,It),zt===null?Dt=Ft:zt.sibling=Ft,zt=Ft,Ot=Bt}if(It===Mt.length)return $(Pt,Ot),I&&tg(Pt,It),Dt;if(Ot===null){for(;ItIt?(Bt=Ot,Ot=null):Bt=Ot.sibling;var jt=ut(Pt,Ot,Ft.value,Lt);if(jt===null){Ot===null&&(Ot=Bt);break}a&&Ot&&jt.alternate===null&&_(Pt,Ot),$t=tt(jt,$t,It),zt===null?Dt=jt:zt.sibling=jt,zt=jt,Ot=Bt}if(Ft.done)return $(Pt,Ot),I&&tg(Pt,It),Dt;if(Ot===null){for(;!Ft.done;It++,Ft=Mt.next())Ft=at(Pt,Ft.value,Lt),Ft!==null&&($t=tt(Ft,$t,It),zt===null?Dt=Ft:zt.sibling=Ft,zt=Ft);return I&&tg(Pt,It),Dt}for(Ot=j(Pt,Ot);!Ft.done;It++,Ft=Mt.next())Ft=ht(Ot,Pt,It,Ft.value,Lt),Ft!==null&&(a&&Ft.alternate!==null&&Ot.delete(Ft.key===null?It:Ft.key),$t=tt(Ft,$t,It),zt===null?Dt=Ft:zt.sibling=Ft,zt=Ft);return a&&Ot.forEach(function(bt){return _(Pt,bt)}),I&&tg(Pt,It),Dt}function Ct(Pt,$t,Mt,Lt){if(typeof Mt=="object"&&Mt!==null&&Mt.type===ya&&Mt.key===null&&(Mt=Mt.props.children),typeof Mt=="object"&&Mt!==null){switch(Mt.$$typeof){case va:e:{for(var Dt=Mt.key,zt=$t;zt!==null;){if(zt.key===Dt){if(Dt=Mt.type,Dt===ya){if(zt.tag===7){$(Pt,zt.sibling),$t=et(zt,Mt.props.children),$t.return=Pt,Pt=$t;break e}}else if(zt.elementType===Dt||typeof Dt=="object"&&Dt!==null&&Dt.$$typeof===Ha&&Ng(Dt)===zt.type){$(Pt,zt.sibling),$t=et(zt,Mt.props),$t.ref=Lg(Pt,zt,Mt),$t.return=Pt,Pt=$t;break e}$(Pt,zt);break}else _(Pt,zt);zt=zt.sibling}Mt.type===ya?($t=Tg(Mt.props.children,Pt.mode,Lt,Mt.key),$t.return=Pt,Pt=$t):(Lt=Rg(Mt.type,Mt.key,Mt.props,null,Pt.mode,Lt),Lt.ref=Lg(Pt,$t,Mt),Lt.return=Pt,Pt=Lt)}return rt(Pt);case wa:e:{for(zt=Mt.key;$t!==null;){if($t.key===zt)if($t.tag===4&&$t.stateNode.containerInfo===Mt.containerInfo&&$t.stateNode.implementation===Mt.implementation){$(Pt,$t.sibling),$t=et($t,Mt.children||[]),$t.return=Pt,Pt=$t;break e}else{$(Pt,$t);break}else _(Pt,$t);$t=$t.sibling}$t=Sg(Mt,Pt.mode,Lt),$t.return=Pt,Pt=$t}return rt(Pt);case Ha:return zt=Mt._init,Ct(Pt,$t,zt(Mt._payload),Lt)}if(eb(Mt))return yt(Pt,$t,Mt,Lt);if(Ka(Mt))return wt(Pt,$t,Mt,Lt);Mg(Pt,Mt)}return typeof Mt=="string"&&Mt!==""||typeof Mt=="number"?(Mt=""+Mt,$t!==null&&$t.tag===6?($(Pt,$t.sibling),$t=et($t,Mt),$t.return=Pt,Pt=$t):($(Pt,$t),$t=Qg(Mt,Pt.mode,Lt),$t.return=Pt,Pt=$t),rt(Pt)):$(Pt,$t)}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(a){var _=Wg.current;E(Wg),a._currentValue=_}function bh(a,_,$){for(;a!==null;){var j=a.alternate;if((a.childLanes&_)!==_?(a.childLanes|=_,j!==null&&(j.childLanes|=_)):j!==null&&(j.childLanes&_)!==_&&(j.childLanes|=_),a===$)break;a=a.return}}function ch$1(a,_){Xg=a,Zg=Yg=null,a=a.dependencies,a!==null&&a.firstContext!==null&&(a.lanes&_&&(dh$1=!0),a.firstContext=null)}function eh(a){var _=a._currentValue;if(Zg!==a)if(a={context:a,memoizedValue:_,next:null},Yg===null){if(Xg===null)throw Error(p$2(308));Yg=a,Xg.dependencies={lanes:0,firstContext:a}}else Yg=Yg.next=a;return _}var fh=null;function gh(a){fh===null?fh=[a]:fh.push(a)}function hh(a,_,$,j){var et=_.interleaved;return et===null?($.next=$,gh(_)):($.next=et.next,et.next=$),_.interleaved=$,ih(a,j)}function ih(a,_){a.lanes|=_;var $=a.alternate;for($!==null&&($.lanes|=_),$=a,a=a.return;a!==null;)a.childLanes|=_,$=a.alternate,$!==null&&($.childLanes|=_),$=a,a=a.return;return $.tag===3?$.stateNode:null}var jh=!1;function kh(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function lh(a,_){a=a.updateQueue,_.updateQueue===a&&(_.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,effects:a.effects})}function mh(a,_){return{eventTime:a,lane:_,tag:0,payload:null,callback:null,next:null}}function nh(a,_,$){var j=a.updateQueue;if(j===null)return null;if(j=j.shared,K$6&2){var et=j.pending;return et===null?_.next=_:(_.next=et.next,et.next=_),j.pending=_,ih(a,$)}return et=j.interleaved,et===null?(_.next=_,gh(j)):(_.next=et.next,et.next=_),j.interleaved=_,ih(a,$)}function oh(a,_,$){if(_=_.updateQueue,_!==null&&(_=_.shared,($&4194240)!==0)){var j=_.lanes;j&=a.pendingLanes,$|=j,_.lanes=$,Cc(a,$)}}function ph(a,_){var $=a.updateQueue,j=a.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=_:tt=tt.next=_}else et=tt=_;$={baseState:j.baseState,firstBaseUpdate:et,lastBaseUpdate:tt,shared:j.shared,effects:j.effects},a.updateQueue=$;return}a=$.lastBaseUpdate,a===null?$.firstBaseUpdate=_:a.next=_,$.lastBaseUpdate=_}function qh(a,_,$,j){var et=a.updateQueue;jh=!1;var tt=et.firstBaseUpdate,rt=et.lastBaseUpdate,nt=et.shared.pending;if(nt!==null){et.shared.pending=null;var it=nt,st=it.next;it.next=null,rt===null?tt=st:rt.next=st,rt=it;var ot=a.alternate;ot!==null&&(ot=ot.updateQueue,nt=ot.lastBaseUpdate,nt!==rt&&(nt===null?ot.firstBaseUpdate=st:nt.next=st,ot.lastBaseUpdate=it))}if(tt!==null){var at=et.baseState;rt=0,ot=st=it=null,nt=tt;do{var ut=nt.lane,ht=nt.eventTime;if((j&ut)===ut){ot!==null&&(ot=ot.next={eventTime:ht,lane:0,tag:nt.tag,payload:nt.payload,callback:nt.callback,next:null});e:{var yt=a,wt=nt;switch(ut=_,ht=$,wt.tag){case 1:if(yt=wt.payload,typeof yt=="function"){at=yt.call(ht,at,ut);break e}at=yt;break e;case 3:yt.flags=yt.flags&-65537|128;case 0:if(yt=wt.payload,ut=typeof yt=="function"?yt.call(ht,at,ut):yt,ut==null)break e;at=A$1({},at,ut);break e;case 2:jh=!0}}nt.callback!==null&&nt.lane!==0&&(a.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},ot===null?(st=ot=ht,it=at):ot=ot.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(ot===null&&(it=at),et.baseState=it,et.firstBaseUpdate=st,et.lastBaseUpdate=ot,_=et.shared.interleaved,_!==null){et=_;do rt|=et.lane,et=et.next;while(et!==_)}else tt===null&&(et.shared.lanes=0);rh$1|=rt,a.lanes=rt,a.memoizedState=at}}function sh$1(a,_,$){if(a=_.effects,_.effects=null,a!==null)for(_=0;_$?$:4,a(!0);var j=Gh.transition;Gh.transition={};try{a(!1),_()}finally{C=$,Gh.transition=j}}function wi(){return Uh().memoizedState}function xi(a,_,$){var j=yi(a);if($={lane:j,action:$,hasEagerState:!1,eagerState:null,next:null},zi(a))Ai(_,$);else if($=hh(a,_,$,j),$!==null){var et=R$1();gi($,a,j,et),Bi($,_,j)}}function ii(a,_,$){var j=yi(a),et={lane:j,action:$,hasEagerState:!1,eagerState:null,next:null};if(zi(a))Ai(_,et);else{var tt=a.alternate;if(a.lanes===0&&(tt===null||tt.lanes===0)&&(tt=_.lastRenderedReducer,tt!==null))try{var rt=_.lastRenderedState,nt=tt(rt,$);if(et.hasEagerState=!0,et.eagerState=nt,He(nt,rt)){var it=_.interleaved;it===null?(et.next=et,gh(_)):(et.next=it.next,it.next=et),_.interleaved=et;return}}catch{}finally{}$=hh(a,_,et,j),$!==null&&(et=R$1(),gi($,a,j,et),Bi($,_,j))}}function zi(a){var _=a.alternate;return a===M||_!==null&&_===M}function Ai(a,_){Jh=Ih=!0;var $=a.pending;$===null?_.next=_:(_.next=$.next,$.next=_),a.pending=_}function Bi(a,_,$){if($&4194240){var j=_.lanes;j&=a.pendingLanes,$|=j,_.lanes=$,Cc(a,$)}}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([a]):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 _=_===void 0?null:_,a=a(),$.memoizedState=[a,_],a},useReducer:function(a,_,$){var j=Th();return _=$!==void 0?$(_):_,j.memoizedState=j.baseState=_,a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:_},j.queue=a,a=a.dispatch=xi.bind(null,M,a),[j.memoizedState,a]},useRef:function(a){var _=Th();return a={current:a},_.memoizedState=a},useState:hi,useDebugValue:ri,useDeferredValue:function(a){return Th().memoizedState=a},useTransition:function(){var a=hi(!1),_=a[0];return a=vi.bind(null,a[1]),Th().memoizedState=a,[_,a]},useMutableSource:function(){},useSyncExternalStore:function(a,_,$){var j=M,et=Th();if(I){if($===void 0)throw Error(p$2(407));$=$()}else{if($=_(),Q===null)throw Error(p$2(349));Hh&30||di(j,_,$)}et.memoizedState=$;var tt={value:$,getSnapshot:_};return et.queue=tt,mi(ai.bind(null,j,tt,a),[a]),j.flags|=2048,bi(9,ci.bind(null,j,tt,$,_),void 0,null),$},useId:function(){var a=Th(),_=Q.identifierPrefix;if(I){var $=sg,j=rg;$=(j&~(1<<32-oc(j)-1)).toString(32)+$,_=":"+_+"R"+$,$=Kh$1++,0<$&&(_+="H"+$.toString(32)),_+=":"}else $=Lh++,_=":"+_+"r"+$.toString(32)+":";return a.memoizedState=_},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(a){var _=Uh();return ui(_,N.memoizedState,a)},useTransition:function(){var a=Wh(Vh)[0],_=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(a){var _=Uh();return N===null?_.memoizedState=a:ui(_,N.memoizedState,a)},useTransition:function(){var a=Xh(Vh)[0],_=Uh().memoizedState;return[a,_]},useMutableSource:Yh,useSyncExternalStore:Zh,useId:wi,unstable_isNewReconciler:!1};function Ci(a,_){if(a&&a.defaultProps){_=A$1({},_),a=a.defaultProps;for(var $ in a)_[$]===void 0&&(_[$]=a[$]);return _}return _}function Di(a,_,$,j){_=a.memoizedState,$=$(j,_),$=$==null?_:A$1({},_,$),a.memoizedState=$,a.lanes===0&&(a.updateQueue.baseState=$)}var Ei={isMounted:function(a){return(a=a._reactInternals)?Vb(a)===a:!1},enqueueSetState:function(a,_,$){a=a._reactInternals;var j=R$1(),et=yi(a),tt=mh(j,et);tt.payload=_,$!=null&&(tt.callback=$),_=nh(a,tt,et),_!==null&&(gi(_,a,et,j),oh(_,a,et))},enqueueReplaceState:function(a,_,$){a=a._reactInternals;var j=R$1(),et=yi(a),tt=mh(j,et);tt.tag=1,tt.payload=_,$!=null&&(tt.callback=$),_=nh(a,tt,et),_!==null&&(gi(_,a,et,j),oh(_,a,et))},enqueueForceUpdate:function(a,_){a=a._reactInternals;var $=R$1(),j=yi(a),et=mh($,j);et.tag=2,_!=null&&(et.callback=_),_=nh(a,et,j),_!==null&&(gi(_,a,j,$),oh(_,a,j))}};function Fi(a,_,$,j,et,tt,rt){return a=a.stateNode,typeof a.shouldComponentUpdate=="function"?a.shouldComponentUpdate(j,tt,rt):_.prototype&&_.prototype.isPureReactComponent?!Ie($,j)||!Ie(et,tt):!0}function Gi(a,_,$){var j=!1,et=Vf,tt=_.contextType;return typeof tt=="object"&&tt!==null?tt=eh(tt):(et=Zf(_)?Xf:H$1.current,j=_.contextTypes,tt=(j=j!=null)?Yf(a,et):Vf),_=new _($,tt),a.memoizedState=_.state!==null&&_.state!==void 0?_.state:null,_.updater=Ei,a.stateNode=_,_._reactInternals=a,j&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=et,a.__reactInternalMemoizedMaskedChildContext=tt),_}function Hi(a,_,$,j){a=_.state,typeof _.componentWillReceiveProps=="function"&&_.componentWillReceiveProps($,j),typeof _.UNSAFE_componentWillReceiveProps=="function"&&_.UNSAFE_componentWillReceiveProps($,j),_.state!==a&&Ei.enqueueReplaceState(_,_.state,null)}function Ii(a,_,$,j){var et=a.stateNode;et.props=$,et.state=a.memoizedState,et.refs={},kh(a);var tt=_.contextType;typeof tt=="object"&&tt!==null?et.context=eh(tt):(tt=Zf(_)?Xf:H$1.current,et.context=Yf(a,tt)),et.state=a.memoizedState,tt=_.getDerivedStateFromProps,typeof tt=="function"&&(Di(a,_,tt,$),et.state=a.memoizedState),typeof _.getDerivedStateFromProps=="function"||typeof et.getSnapshotBeforeUpdate=="function"||typeof et.UNSAFE_componentWillMount!="function"&&typeof et.componentWillMount!="function"||(_=et.state,typeof et.componentWillMount=="function"&&et.componentWillMount(),typeof et.UNSAFE_componentWillMount=="function"&&et.UNSAFE_componentWillMount(),_!==et.state&&Ei.enqueueReplaceState(et,et.state,null),qh(a,$,et,j),et.state=a.memoizedState),typeof et.componentDidMount=="function"&&(a.flags|=4194308)}function Ji(a,_){try{var $="",j=_;do $+=Pa(j),j=j.return;while(j);var et=$}catch(tt){et=` -Error generating stack: `+tt.message+` -`+tt.stack}return{value:a,source:_,stack:et,digest:null}}function Ki(a,_,$){return{value:a,source:null,stack:$??null,digest:_??null}}function Li(a,_){try{console.error(_.value)}catch($){setTimeout(function(){throw $})}}var Mi=typeof WeakMap=="function"?WeakMap:Map;function Ni(a,_,$){$=mh(-1,$),$.tag=3,$.payload={element:null};var j=_.value;return $.callback=function(){Oi||(Oi=!0,Pi=j),Li(a,_)},$}function Qi(a,_,$){$=mh(-1,$),$.tag=3;var j=a.type.getDerivedStateFromError;if(typeof j=="function"){var et=_.value;$.payload=function(){return j(et)},$.callback=function(){Li(a,_)}}var tt=a.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=_.stack;this.componentDidCatch(_.value,{componentStack:rt!==null?rt:""})}),$}function Si(a,_,$){var j=a.pingCache;if(j===null){j=a.pingCache=new Mi;var et=new Set;j.set(_,et)}else et=j.get(_),et===void 0&&(et=new Set,j.set(_,et));et.has($)||(et.add($),a=Ti.bind(null,a,_,$),_.then(a,a))}function Ui(a){do{var _;if((_=a.tag===13)&&(_=a.memoizedState,_=_!==null?_.dehydrated!==null:!0),_)return a;a=a.return}while(a!==null);return null}function Vi(a,_,$,j,et){return a.mode&1?(a.flags|=65536,a.lanes=et,a):(a===_?a.flags|=65536:(a.flags|=128,$.flags|=131072,$.flags&=-52805,$.tag===1&&($.alternate===null?$.tag=17:(_=mh(-1,1),_.tag=2,nh($,_,1))),$.lanes|=1),a)}var Wi=ua.ReactCurrentOwner,dh$1=!1;function Xi(a,_,$,j){_.child=a===null?Vg(_,null,$,j):Ug(_,a.child,$,j)}function Yi(a,_,$,j,et){$=$.render;var tt=_.ref;return ch$1(_,et),j=Nh(a,_,$,j,tt,et),$=Sh(),a!==null&&!dh$1?(_.updateQueue=a.updateQueue,_.flags&=-2053,a.lanes&=~et,Zi(a,_,et)):(I&&$&&vg(_),_.flags|=1,Xi(a,_,j,et),_.child)}function $i(a,_,$,j,et){if(a===null){var tt=$.type;return typeof tt=="function"&&!aj(tt)&&tt.defaultProps===void 0&&$.compare===null&&$.defaultProps===void 0?(_.tag=15,_.type=tt,bj(a,_,tt,j,et)):(a=Rg($.type,null,j,_,_.mode,et),a.ref=_.ref,a.return=_,_.child=a)}if(tt=a.child,!(a.lanes&et)){var rt=tt.memoizedProps;if($=$.compare,$=$!==null?$:Ie,$(rt,j)&&a.ref===_.ref)return Zi(a,_,et)}return _.flags|=1,a=Pg(tt,j),a.ref=_.ref,a.return=_,_.child=a}function bj(a,_,$,j,et){if(a!==null){var tt=a.memoizedProps;if(Ie(tt,j)&&a.ref===_.ref)if(dh$1=!1,_.pendingProps=j=tt,(a.lanes&et)!==0)a.flags&131072&&(dh$1=!0);else return _.lanes=a.lanes,Zi(a,_,et)}return cj(a,_,$,j,et)}function dj(a,_,$){var j=_.pendingProps,et=j.children,tt=a!==null?a.memoizedState:null;if(j.mode==="hidden")if(!(_.mode&1))_.memoizedState={baseLanes:0,cachePool:null,transitions:null},G(ej,fj),fj|=$;else{if(!($&1073741824))return a=tt!==null?tt.baseLanes|$:$,_.lanes=_.childLanes=1073741824,_.memoizedState={baseLanes:a,cachePool:null,transitions:null},_.updateQueue=null,G(ej,fj),fj|=a,null;_.memoizedState={baseLanes:0,cachePool:null,transitions:null},j=tt!==null?tt.baseLanes:$,G(ej,fj),fj|=j}else tt!==null?(j=tt.baseLanes|$,_.memoizedState=null):j=$,G(ej,fj),fj|=j;return Xi(a,_,et,$),_.child}function gj(a,_){var $=_.ref;(a===null&&$!==null||a!==null&&a.ref!==$)&&(_.flags|=512,_.flags|=2097152)}function cj(a,_,$,j,et){var tt=Zf($)?Xf:H$1.current;return tt=Yf(_,tt),ch$1(_,et),$=Nh(a,_,$,j,tt,et),j=Sh(),a!==null&&!dh$1?(_.updateQueue=a.updateQueue,_.flags&=-2053,a.lanes&=~et,Zi(a,_,et)):(I&&j&&vg(_),_.flags|=1,Xi(a,_,$,et),_.child)}function hj(a,_,$,j,et){if(Zf($)){var tt=!0;cg(_)}else tt=!1;if(ch$1(_,et),_.stateNode===null)ij(a,_),Gi(_,$,j),Ii(_,$,j,et),j=!0;else if(a===null){var rt=_.stateNode,nt=_.memoizedProps;rt.props=nt;var it=rt.context,st=$.contextType;typeof st=="object"&&st!==null?st=eh(st):(st=Zf($)?Xf:H$1.current,st=Yf(_,st));var ot=$.getDerivedStateFromProps,at=typeof ot=="function"||typeof rt.getSnapshotBeforeUpdate=="function";at||typeof rt.UNSAFE_componentWillReceiveProps!="function"&&typeof rt.componentWillReceiveProps!="function"||(nt!==j||it!==st)&&Hi(_,rt,j,st),jh=!1;var ut=_.memoizedState;rt.state=ut,qh(_,j,rt,et),it=_.memoizedState,nt!==j||ut!==it||Wf.current||jh?(typeof ot=="function"&&(Di(_,$,ot,j),it=_.memoizedState),(nt=jh||Fi(_,$,nt,j,ut,it,st))?(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"&&(_.flags|=4194308)):(typeof rt.componentDidMount=="function"&&(_.flags|=4194308),_.memoizedProps=j,_.memoizedState=it),rt.props=j,rt.state=it,rt.context=st,j=nt):(typeof rt.componentDidMount=="function"&&(_.flags|=4194308),j=!1)}else{rt=_.stateNode,lh(a,_),nt=_.memoizedProps,st=_.type===_.elementType?nt:Ci(_.type,nt),rt.props=st,at=_.pendingProps,ut=rt.context,it=$.contextType,typeof it=="object"&&it!==null?it=eh(it):(it=Zf($)?Xf:H$1.current,it=Yf(_,it));var ht=$.getDerivedStateFromProps;(ot=typeof ht=="function"||typeof rt.getSnapshotBeforeUpdate=="function")||typeof rt.UNSAFE_componentWillReceiveProps!="function"&&typeof rt.componentWillReceiveProps!="function"||(nt!==at||ut!==it)&&Hi(_,rt,j,it),jh=!1,ut=_.memoizedState,rt.state=ut,qh(_,j,rt,et);var yt=_.memoizedState;nt!==at||ut!==yt||Wf.current||jh?(typeof ht=="function"&&(Di(_,$,ht,j),yt=_.memoizedState),(st=jh||Fi(_,$,st,j,ut,yt,it)||!1)?(ot||typeof rt.UNSAFE_componentWillUpdate!="function"&&typeof rt.componentWillUpdate!="function"||(typeof rt.componentWillUpdate=="function"&&rt.componentWillUpdate(j,yt,it),typeof rt.UNSAFE_componentWillUpdate=="function"&&rt.UNSAFE_componentWillUpdate(j,yt,it)),typeof rt.componentDidUpdate=="function"&&(_.flags|=4),typeof rt.getSnapshotBeforeUpdate=="function"&&(_.flags|=1024)):(typeof rt.componentDidUpdate!="function"||nt===a.memoizedProps&&ut===a.memoizedState||(_.flags|=4),typeof rt.getSnapshotBeforeUpdate!="function"||nt===a.memoizedProps&&ut===a.memoizedState||(_.flags|=1024),_.memoizedProps=j,_.memoizedState=yt),rt.props=j,rt.state=yt,rt.context=it,j=st):(typeof rt.componentDidUpdate!="function"||nt===a.memoizedProps&&ut===a.memoizedState||(_.flags|=4),typeof rt.getSnapshotBeforeUpdate!="function"||nt===a.memoizedProps&&ut===a.memoizedState||(_.flags|=1024),j=!1)}return jj(a,_,$,j,tt,et)}function jj(a,_,$,j,et,tt){gj(a,_);var rt=(_.flags&128)!==0;if(!j&&!rt)return et&&dg(_,$,!1),Zi(a,_,tt);j=_.stateNode,Wi.current=_;var nt=rt&&typeof $.getDerivedStateFromError!="function"?null:j.render();return _.flags|=1,a!==null&&rt?(_.child=Ug(_,a.child,null,tt),_.child=Ug(_,null,nt,tt)):Xi(a,_,nt,tt),_.memoizedState=j.state,et&&dg(_,$,!0),_.child}function kj(a){var _=a.stateNode;_.pendingContext?ag(a,_.pendingContext,_.pendingContext!==_.context):_.context&&ag(a,_.context,!1),yh(a,_.containerInfo)}function lj(a,_,$,j,et){return Ig(),Jg(et),_.flags|=256,Xi(a,_,$,j),_.child}var mj={dehydrated:null,treeContext:null,retryLane:0};function nj(a){return{baseLanes:a,cachePool:null,transitions:null}}function oj(a,_,$){var j=_.pendingProps,et=L.current,tt=!1,rt=(_.flags&128)!==0,nt;if((nt=rt)||(nt=a!==null&&a.memoizedState===null?!1:(et&2)!==0),nt?(tt=!0,_.flags&=-129):(a===null||a.memoizedState!==null)&&(et|=1),G(L,et&1),a===null)return Eg(_),a=_.memoizedState,a!==null&&(a=a.dehydrated,a!==null)?(_.mode&1?a.data==="$!"?_.lanes=8:_.lanes=1073741824:_.lanes=1,null):(rt=j.children,a=j.fallback,tt?(j=_.mode,tt=_.child,rt={mode:"hidden",children:rt},!(j&1)&&tt!==null?(tt.childLanes=0,tt.pendingProps=rt):tt=pj(rt,j,0,null),a=Tg(a,j,$,null),tt.return=_,a.return=_,tt.sibling=a,_.child=tt,_.child.memoizedState=nj($),_.memoizedState=mj,a):qj(_,rt));if(et=a.memoizedState,et!==null&&(nt=et.dehydrated,nt!==null))return rj(a,_,rt,j,nt,et,$);if(tt){tt=j.fallback,rt=_.mode,et=a.child,nt=et.sibling;var it={mode:"hidden",children:j.children};return!(rt&1)&&_.child!==et?(j=_.child,j.childLanes=0,j.pendingProps=it,_.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=_,j.return=_,j.sibling=tt,_.child=j,j=tt,tt=_.child,rt=a.child.memoizedState,rt=rt===null?nj($):{baseLanes:rt.baseLanes|$,cachePool:null,transitions:rt.transitions},tt.memoizedState=rt,tt.childLanes=a.childLanes&~$,_.memoizedState=mj,j}return tt=a.child,a=tt.sibling,j=Pg(tt,{mode:"visible",children:j.children}),!(_.mode&1)&&(j.lanes=$),j.return=_,j.sibling=null,a!==null&&($=_.deletions,$===null?(_.deletions=[a],_.flags|=16):$.push(a)),_.child=j,_.memoizedState=null,j}function qj(a,_){return _=pj({mode:"visible",children:_},a.mode,0,null),_.return=a,a.child=_}function sj(a,_,$,j){return j!==null&&Jg(j),Ug(_,a.child,null,$),a=qj(_,_.pendingProps.children),a.flags|=2,_.memoizedState=null,a}function rj(a,_,$,j,et,tt,rt){if($)return _.flags&256?(_.flags&=-257,j=Ki(Error(p$2(422))),sj(a,_,rt,j)):_.memoizedState!==null?(_.child=a.child,_.flags|=128,null):(tt=j.fallback,et=_.mode,j=pj({mode:"visible",children:j.children},et,0,null),tt=Tg(tt,et,rt,null),tt.flags|=2,j.return=_,tt.return=_,j.sibling=tt,_.child=j,_.mode&1&&Ug(_,a.child,null,rt),_.child.memoizedState=nj(rt),_.memoizedState=mj,tt);if(!(_.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&a.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(a,et),gi(j,a,et,-1))}return tj(),j=Ki(Error(p$2(421))),sj(a,_,rt,j)}return et.data==="$?"?(_.flags|=128,_.child=a.child,_=uj.bind(null,a),et._reactRetry=_,null):(a=tt.treeContext,yg=Lf(et.nextSibling),xg=_,I=!0,zg=null,a!==null&&(og[pg++]=rg,og[pg++]=sg,og[pg++]=qg,rg=a.id,sg=a.overflow,qg=_),_=qj(_,j.children),_.flags|=4096,_)}function vj(a,_,$){a.lanes|=_;var j=a.alternate;j!==null&&(j.lanes|=_),bh(a.return,_,$)}function wj(a,_,$,j,et){var tt=a.memoizedState;tt===null?a.memoizedState={isBackwards:_,rendering:null,renderingStartTime:0,last:j,tail:$,tailMode:et}:(tt.isBackwards=_,tt.rendering=null,tt.renderingStartTime=0,tt.last=j,tt.tail=$,tt.tailMode=et)}function xj(a,_,$){var j=_.pendingProps,et=j.revealOrder,tt=j.tail;if(Xi(a,_,j.children,$),j=L.current,j&2)j=j&1|2,_.flags|=128;else{if(a!==null&&a.flags&128)e:for(a=_.child;a!==null;){if(a.tag===13)a.memoizedState!==null&&vj(a,$,_);else if(a.tag===19)vj(a,$,_);else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===_)break e;for(;a.sibling===null;){if(a.return===null||a.return===_)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}j&=1}if(G(L,j),!(_.mode&1))_.memoizedState=null;else switch(et){case"forwards":for($=_.child,et=null;$!==null;)a=$.alternate,a!==null&&Ch$1(a)===null&&(et=$),$=$.sibling;$=et,$===null?(et=_.child,_.child=null):(et=$.sibling,$.sibling=null),wj(_,!1,et,$,tt);break;case"backwards":for($=null,et=_.child,_.child=null;et!==null;){if(a=et.alternate,a!==null&&Ch$1(a)===null){_.child=et;break}a=et.sibling,et.sibling=$,$=et,et=a}wj(_,!0,$,null,tt);break;case"together":wj(_,!1,null,null,void 0);break;default:_.memoizedState=null}return _.child}function ij(a,_){!(_.mode&1)&&a!==null&&(a.alternate=null,_.alternate=null,_.flags|=2)}function Zi(a,_,$){if(a!==null&&(_.dependencies=a.dependencies),rh$1|=_.lanes,!($&_.childLanes))return null;if(a!==null&&_.child!==a.child)throw Error(p$2(153));if(_.child!==null){for(a=_.child,$=Pg(a,a.pendingProps),_.child=$,$.return=_;a.sibling!==null;)a=a.sibling,$=$.sibling=Pg(a,a.pendingProps),$.return=_;$.sibling=null}return _.child}function yj(a,_,$){switch(_.tag){case 3:kj(_),Ig();break;case 5:Ah(_);break;case 1:Zf(_.type)&&cg(_);break;case 4:yh(_,_.stateNode.containerInfo);break;case 10:var j=_.type._context,et=_.memoizedProps.value;G(Wg,j._currentValue),j._currentValue=et;break;case 13:if(j=_.memoizedState,j!==null)return j.dehydrated!==null?(G(L,L.current&1),_.flags|=128,null):$&_.child.childLanes?oj(a,_,$):(G(L,L.current&1),a=Zi(a,_,$),a!==null?a.sibling:null);G(L,L.current&1);break;case 19:if(j=($&_.childLanes)!==0,a.flags&128){if(j)return xj(a,_,$);_.flags|=128}if(et=_.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 _.lanes=0,dj(a,_,$)}return Zi(a,_,$)}var zj,Aj,Bj,Cj;zj=function(a,_){for(var $=_.child;$!==null;){if($.tag===5||$.tag===6)a.appendChild($.stateNode);else if($.tag!==4&&$.child!==null){$.child.return=$,$=$.child;continue}if($===_)break;for(;$.sibling===null;){if($.return===null||$.return===_)return;$=$.return}$.sibling.return=$.return,$=$.sibling}};Aj=function(){};Bj=function(a,_,$,j){var et=a.memoizedProps;if(et!==j){a=_.stateNode,xh(uh.current);var tt=null;switch($){case"input":et=Ya(a,et),j=Ya(a,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(a,et),j=gb(a,j),tt=[];break;default:typeof et.onClick!="function"&&typeof j.onClick=="function"&&(a.onclick=Bf)}ub($,j);var rt;$=null;for(st in et)if(!j.hasOwnProperty(st)&&et.hasOwnProperty(st)&&et[st]!=null)if(st==="style"){var nt=et[st];for(rt in nt)nt.hasOwnProperty(rt)&&($||($={}),$[rt]="")}else st!=="dangerouslySetInnerHTML"&&st!=="children"&&st!=="suppressContentEditableWarning"&&st!=="suppressHydrationWarning"&&st!=="autoFocus"&&(ea.hasOwnProperty(st)?tt||(tt=[]):(tt=tt||[]).push(st,null));for(st in j){var it=j[st];if(nt=et!=null?et[st]:void 0,j.hasOwnProperty(st)&&it!==nt&&(it!=null||nt!=null))if(st==="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(st,$)),$=it;else st==="dangerouslySetInnerHTML"?(it=it?it.__html:void 0,nt=nt?nt.__html:void 0,it!=null&&nt!==it&&(tt=tt||[]).push(st,it)):st==="children"?typeof it!="string"&&typeof it!="number"||(tt=tt||[]).push(st,""+it):st!=="suppressContentEditableWarning"&&st!=="suppressHydrationWarning"&&(ea.hasOwnProperty(st)?(it!=null&&st==="onScroll"&&D("scroll",a),tt||nt===it||(tt=[])):(tt=tt||[]).push(st,it))}$&&(tt=tt||[]).push("style",$);var st=tt;(_.updateQueue=st)&&(_.flags|=4)}};Cj=function(a,_,$,j){$!==j&&(_.flags|=4)};function Dj(a,_){if(!I)switch(a.tailMode){case"hidden":_=a.tail;for(var $=null;_!==null;)_.alternate!==null&&($=_),_=_.sibling;$===null?a.tail=null:$.sibling=null;break;case"collapsed":$=a.tail;for(var j=null;$!==null;)$.alternate!==null&&(j=$),$=$.sibling;j===null?_||a.tail===null?a.tail=null:a.tail.sibling=null:j.sibling=null}}function S(a){var _=a.alternate!==null&&a.alternate.child===a.child,$=0,j=0;if(_)for(var et=a.child;et!==null;)$|=et.lanes|et.childLanes,j|=et.subtreeFlags&14680064,j|=et.flags&14680064,et.return=a,et=et.sibling;else for(et=a.child;et!==null;)$|=et.lanes|et.childLanes,j|=et.subtreeFlags,j|=et.flags,et.return=a,et=et.sibling;return a.subtreeFlags|=j,a.childLanes=$,_}function Ej(a,_,$){var j=_.pendingProps;switch(wg(_),_.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return S(_),null;case 1:return Zf(_.type)&&$f(),S(_),null;case 3:return j=_.stateNode,zh(),E(Wf),E(H$1),Eh(),j.pendingContext&&(j.context=j.pendingContext,j.pendingContext=null),(a===null||a.child===null)&&(Gg(_)?_.flags|=4:a===null||a.memoizedState.isDehydrated&&!(_.flags&256)||(_.flags|=1024,zg!==null&&(Fj(zg),zg=null))),Aj(a,_),S(_),null;case 5:Bh(_);var et=xh(wh.current);if($=_.type,a!==null&&_.stateNode!=null)Bj(a,_,$,j,et),a.ref!==_.ref&&(_.flags|=512,_.flags|=2097152);else{if(!j){if(_.stateNode===null)throw Error(p$2(166));return S(_),null}if(a=xh(uh.current),Gg(_)){j=_.stateNode,$=_.type;var tt=_.memoizedProps;switch(j[Of]=_,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>",a=a.removeChild(a.firstChild)):typeof j.is=="string"?a=rt.createElement($,{is:j.is}):(a=rt.createElement($),$==="select"&&(rt=a,j.multiple?rt.multiple=!0:j.size&&(rt.size=j.size))):a=rt.createElementNS(a,$),a[Of]=_,a[Pf]=j,zj(a,_,!1,!1),_.stateNode=a;e:{switch(rt=vb($,j),$){case"dialog":D("cancel",a),D("close",a),et=j;break;case"iframe":case"object":case"embed":D("load",a),et=j;break;case"video":case"audio":for(et=0;etGj&&(_.flags|=128,j=!0,Dj(tt,!1),_.lanes=4194304)}else{if(!j)if(a=Ch$1(rt),a!==null){if(_.flags|=128,j=!0,$=a.updateQueue,$!==null&&(_.updateQueue=$,_.flags|=4),Dj(tt,!0),tt.tail===null&&tt.tailMode==="hidden"&&!rt.alternate&&!I)return S(_),null}else 2*B()-tt.renderingStartTime>Gj&&$!==1073741824&&(_.flags|=128,j=!0,Dj(tt,!1),_.lanes=4194304);tt.isBackwards?(rt.sibling=_.child,_.child=rt):($=tt.last,$!==null?$.sibling=rt:_.child=rt,tt.last=rt)}return tt.tail!==null?(_=tt.tail,tt.rendering=_,tt.tail=_.sibling,tt.renderingStartTime=B(),_.sibling=null,$=L.current,G(L,j?$&1|2:$&1),_):(S(_),null);case 22:case 23:return Hj(),j=_.memoizedState!==null,a!==null&&a.memoizedState!==null!==j&&(_.flags|=8192),j&&_.mode&1?fj&1073741824&&(S(_),_.subtreeFlags&6&&(_.flags|=8192)):S(_),null;case 24:return null;case 25:return null}throw Error(p$2(156,_.tag))}function Ij(a,_){switch(wg(_),_.tag){case 1:return Zf(_.type)&&$f(),a=_.flags,a&65536?(_.flags=a&-65537|128,_):null;case 3:return zh(),E(Wf),E(H$1),Eh(),a=_.flags,a&65536&&!(a&128)?(_.flags=a&-65537|128,_):null;case 5:return Bh(_),null;case 13:if(E(L),a=_.memoizedState,a!==null&&a.dehydrated!==null){if(_.alternate===null)throw Error(p$2(340));Ig()}return a=_.flags,a&65536?(_.flags=a&-65537|128,_):null;case 19:return E(L),null;case 4:return zh(),null;case 10:return ah(_.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 $=a.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,a=Me(),Ne(a)){if("selectionStart"in a)var $={start:a.selectionStart,end:a.selectionEnd};else e:{$=($=a.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,st=0,ot=0,at=a,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===a)break t;if(ut===$&&++st===et&&(nt=rt),ut===tt&&++ot===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:a,selectionRange:$},dd=!1,V=_;V!==null;)if(_=V,a=_.child,(_.subtreeFlags&1028)!==0&&a!==null)a.return=_,V=a;else for(;V!==null;){_=V;try{var yt=_.alternate;if(_.flags&1024)switch(_.tag){case 0:case 11:case 15:break;case 1:if(yt!==null){var wt=yt.memoizedProps,Ct=yt.memoizedState,Pt=_.stateNode,$t=Pt.getSnapshotBeforeUpdate(_.elementType===_.type?wt:Ci(_.type,wt),Ct);Pt.__reactInternalSnapshotBeforeUpdate=$t}break;case 3:var Mt=_.stateNode.containerInfo;Mt.nodeType===1?Mt.textContent="":Mt.nodeType===9&&Mt.documentElement&&Mt.removeChild(Mt.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(p$2(163))}}catch(Lt){W$6(_,_.return,Lt)}if(a=_.sibling,a!==null){a.return=_.return,V=a;break}V=_.return}return yt=Nj,Nj=!1,yt}function Pj(a,_,$){var j=_.updateQueue;if(j=j!==null?j.lastEffect:null,j!==null){var et=j=j.next;do{if((et.tag&a)===a){var tt=et.destroy;et.destroy=void 0,tt!==void 0&&Mj(_,$,tt)}et=et.next}while(et!==j)}}function Qj(a,_){if(_=_.updateQueue,_=_!==null?_.lastEffect:null,_!==null){var $=_=_.next;do{if(($.tag&a)===a){var j=$.create;$.destroy=j()}$=$.next}while($!==_)}}function Rj(a){var _=a.ref;if(_!==null){var $=a.stateNode;switch(a.tag){case 5:a=$;break;default:a=$}typeof _=="function"?_(a):_.current=a}}function Sj(a){var _=a.alternate;_!==null&&(a.alternate=null,Sj(_)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(_=a.stateNode,_!==null&&(delete _[Of],delete _[Pf],delete _[of$1],delete _[Qf],delete _[Rf])),a.stateNode=null,a.return=null,a.dependencies=null,a.memoizedProps=null,a.memoizedState=null,a.pendingProps=null,a.stateNode=null,a.updateQueue=null}function Tj(a){return a.tag===5||a.tag===3||a.tag===4}function Uj(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||Tj(a.return))return null;a=a.return}for(a.sibling.return=a.return,a=a.sibling;a.tag!==5&&a.tag!==6&&a.tag!==18;){if(a.flags&2||a.child===null||a.tag===4)continue e;a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}function Vj(a,_,$){var j=a.tag;if(j===5||j===6)a=a.stateNode,_?$.nodeType===8?$.parentNode.insertBefore(a,_):$.insertBefore(a,_):($.nodeType===8?(_=$.parentNode,_.insertBefore(a,$)):(_=$,_.appendChild(a)),$=$._reactRootContainer,$!=null||_.onclick!==null||(_.onclick=Bf));else if(j!==4&&(a=a.child,a!==null))for(Vj(a,_,$),a=a.sibling;a!==null;)Vj(a,_,$),a=a.sibling}function Wj(a,_,$){var j=a.tag;if(j===5||j===6)a=a.stateNode,_?$.insertBefore(a,_):$.appendChild(a);else if(j!==4&&(a=a.child,a!==null))for(Wj(a,_,$),a=a.sibling;a!==null;)Wj(a,_,$),a=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($,_);case 6:var j=X,et=Xj;X=null,Yj(a,_,$),X=j,Xj=et,X!==null&&(Xj?(a=X,$=$.stateNode,a.nodeType===8?a.parentNode.removeChild($):a.removeChild($)):X.removeChild($.stateNode));break;case 18:X!==null&&(Xj?(a=X,$=$.stateNode,a.nodeType===8?Kf(a.parentNode,$):a.nodeType===1&&Kf(a,$),bd(a)):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($,_,rt),et=et.next}while(et!==j)}Yj(a,_,$);break;case 1:if(!U&&(Lj($,_),j=$.stateNode,typeof j.componentWillUnmount=="function"))try{j.props=$.memoizedProps,j.state=$.memoizedState,j.componentWillUnmount()}catch(nt){W$6($,_,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(a){var _=a.updateQueue;if(_!==null){a.updateQueue=null;var $=a.stateNode;$===null&&($=a.stateNode=new Kj),_.forEach(function(j){var et=bk.bind(null,a,j);$.has(j)||($.add(j),j.then(et,et))})}}function ck(a,_){var $=_.deletions;if($!==null)for(var j=0;j<$.length;j++){var et=$[j];try{var tt=a,rt=_,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(st){W$6(et,_,st)}}if(_.subtreeFlags&12854)for(_=_.child;_!==null;)dk(_,a),_=_.sibling}function dk(a,_){var $=a.alternate,j=a.flags;switch(a.tag){case 0:case 11:case 14:case 15:if(ck(_,a),ek(a),j&4){try{Pj(3,a,a.return),Qj(3,a)}catch(wt){W$6(a,a.return,wt)}try{Pj(5,a,a.return)}catch(wt){W$6(a,a.return,wt)}}break;case 1:ck(_,a),ek(a),j&512&&$!==null&&Lj($,$.return);break;case 5:if(ck(_,a),ek(a),j&512&&$!==null&&Lj($,$.return),a.flags&32){var et=a.stateNode;try{ob(et,"")}catch(wt){W$6(a,a.return,wt)}}if(j&4&&(et=a.stateNode,et!=null)){var tt=a.memoizedProps,rt=$!==null?$.memoizedProps:tt,nt=a.type,it=a.updateQueue;if(a.updateQueue=null,it!==null)try{nt==="input"&&tt.type==="radio"&&tt.name!=null&&ab(et,tt),vb(nt,rt);var st=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,10a?16:a,wk===null)var j=!1;else{if(a=wk,wk=null,xk=0,K$6&6)throw Error(p$2(331));var et=K$6;for(K$6|=4,V=a.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(a,0):rk|=$),Dk(a,_)}function Yk(a,_){_===0&&(a.mode&1?(_=sc,sc<<=1,!(sc&130023424)&&(sc=4194304)):_=1);var $=R$1();a=ih(a,_),a!==null&&(Ac(a,_,$),Dk(a,$))}function uj(a){var _=a.memoizedState,$=0;_!==null&&($=_.retryLane),Yk(a,$)}function bk(a,_){var $=0;switch(a.tag){case 13:var j=a.stateNode,et=a.memoizedState;et!==null&&($=et.retryLane);break;case 19:j=a.stateNode;break;default:throw Error(p$2(314))}j!==null&&j.delete(_),Yk(a,$)}var Vk;Vk=function(a,_,$){if(a!==null)if(a.memoizedProps!==_.pendingProps||Wf.current)dh$1=!0;else{if(!(a.lanes&$)&&!(_.flags&128))return dh$1=!1,yj(a,_,$);dh$1=!!(a.flags&131072)}else dh$1=!1,I&&_.flags&1048576&&ug(_,ng,_.index);switch(_.lanes=0,_.tag){case 2:var j=_.type;ij(a,_),a=_.pendingProps;var et=Yf(_,H$1.current);ch$1(_,$),et=Nh(null,_,j,a,et,$);var tt=Sh();return _.flags|=1,typeof et=="object"&&et!==null&&typeof et.render=="function"&&et.$$typeof===void 0?(_.tag=1,_.memoizedState=null,_.updateQueue=null,Zf(j)?(tt=!0,cg(_)):tt=!1,_.memoizedState=et.state!==null&&et.state!==void 0?et.state:null,kh(_),et.updater=Ei,_.stateNode=et,et._reactInternals=_,Ii(_,j,a,$),_=jj(null,_,j,!0,tt,$)):(_.tag=0,I&&tt&&vg(_),Xi(null,_,et,$),_=_.child),_;case 16:j=_.elementType;e:{switch(ij(a,_),a=_.pendingProps,et=j._init,j=et(j._payload),_.type=j,et=_.tag=Zk(j),a=Ci(j,a),et){case 0:_=cj(null,_,j,a,$);break e;case 1:_=hj(null,_,j,a,$);break e;case 11:_=Yi(null,_,j,a,$);break e;case 14:_=$i(null,_,j,Ci(j.type,a),$);break e}throw Error(p$2(306,j,""))}return _;case 0:return j=_.type,et=_.pendingProps,et=_.elementType===j?et:Ci(j,et),cj(a,_,j,et,$);case 1:return j=_.type,et=_.pendingProps,et=_.elementType===j?et:Ci(j,et),hj(a,_,j,et,$);case 3:e:{if(kj(_),a===null)throw Error(p$2(387));j=_.pendingProps,tt=_.memoizedState,et=tt.element,lh(a,_),qh(_,j,null,$);var rt=_.memoizedState;if(j=rt.element,tt.isDehydrated)if(tt={element:j,isDehydrated:!1,cache:rt.cache,pendingSuspenseBoundaries:rt.pendingSuspenseBoundaries,transitions:rt.transitions},_.updateQueue.baseState=tt,_.memoizedState=tt,_.flags&256){et=Ji(Error(p$2(423)),_),_=lj(a,_,j,$,et);break e}else if(j!==et){et=Ji(Error(p$2(424)),_),_=lj(a,_,j,$,et);break e}else for(yg=Lf(_.stateNode.containerInfo.firstChild),xg=_,I=!0,zg=null,$=Vg(_,null,j,$),_.child=$;$;)$.flags=$.flags&-3|4096,$=$.sibling;else{if(Ig(),j===et){_=Zi(a,_,$);break e}Xi(a,_,j,$)}_=_.child}return _;case 5:return Ah(_),a===null&&Eg(_),j=_.type,et=_.pendingProps,tt=a!==null?a.memoizedProps:null,rt=et.children,Ef(j,et)?rt=null:tt!==null&&Ef(j,tt)&&(_.flags|=32),gj(a,_),Xi(a,_,rt,$),_.child;case 6:return a===null&&Eg(_),null;case 13:return oj(a,_,$);case 4:return yh(_,_.stateNode.containerInfo),j=_.pendingProps,a===null?_.child=Ug(_,null,j,$):Xi(a,_,j,$),_.child;case 11:return j=_.type,et=_.pendingProps,et=_.elementType===j?et:Ci(j,et),Yi(a,_,j,et,$);case 7:return Xi(a,_,_.pendingProps,$),_.child;case 8:return Xi(a,_,_.pendingProps.children,$),_.child;case 12:return Xi(a,_,_.pendingProps.children,$),_.child;case 10:e:{if(j=_.type._context,et=_.pendingProps,tt=_.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){_=Zi(a,_,$);break e}}else for(tt=_.child,tt!==null&&(tt.return=_);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 st=tt.updateQueue;if(st!==null){st=st.shared;var ot=st.pending;ot===null?it.next=it:(it.next=ot.next,ot.next=it),st.pending=it}}tt.lanes|=$,it=tt.alternate,it!==null&&(it.lanes|=$),bh(tt.return,$,_),nt.lanes|=$;break}it=it.next}}else if(tt.tag===10)rt=tt.type===_.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,$,_),rt=tt.sibling}else rt=tt.child;if(rt!==null)rt.return=tt;else for(rt=tt;rt!==null;){if(rt===_){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,$),_=_.child}return _;case 9:return et=_.type,j=_.pendingProps.children,ch$1(_,$),et=eh(et),j=j(et),_.flags|=1,Xi(a,_,j,$),_.child;case 14:return j=_.type,et=Ci(j,_.pendingProps),et=Ci(j.type,et),$i(a,_,j,et,$);case 15:return bj(a,_,_.type,_.pendingProps,$);case 17:return j=_.type,et=_.pendingProps,et=_.elementType===j?et:Ci(j,et),ij(a,_),_.tag=1,Zf(j)?(a=!0,cg(_)):a=!1,ch$1(_,$),Gi(_,j,et),Ii(_,j,et,$),jj(null,_,j,!0,a,$);case 19:return xj(a,_,$);case 22:return dj(a,_,$)}throw Error(p$2(156,_.tag))};function Fk(a,_){return ac(a,_)}function $k(a,_,$,j){this.tag=a,this.key=$,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=_,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(a){return a=a.prototype,!(!a||!a.isReactComponent)}function Zk(a){if(typeof a=="function")return aj(a)?1:0;if(a!=null){if(a=a.$$typeof,a===Da)return 11;if(a===Ga)return 14}return 2}function Pg(a,_){var $=a.alternate;return $===null?($=Bg(a.tag,_,a.key,a.mode),$.elementType=a.elementType,$.type=a.type,$.stateNode=a.stateNode,$.alternate=a,a.alternate=$):($.pendingProps=_,$.type=a.type,$.flags=0,$.subtreeFlags=0,$.deletions=null),$.flags=a.flags&14680064,$.childLanes=a.childLanes,$.lanes=a.lanes,$.child=a.child,$.memoizedProps=a.memoizedProps,$.memoizedState=a.memoizedState,$.updateQueue=a.updateQueue,_=a.dependencies,$.dependencies=_===null?null:{lanes:_.lanes,firstContext:_.firstContext},$.sibling=a.sibling,$.index=a.index,$.ref=a.ref,$}function Rg(a,_,$,j,et,tt){var rt=2;if(j=a,typeof a=="function")aj(a)&&(rt=1);else if(typeof a=="string")rt=5;else e:switch(a){case ya:return Tg($.children,et,tt,_);case za:rt=8,et|=8;break;case Aa:return a=Bg(12,$,_,et|2),a.elementType=Aa,a.lanes=tt,a;case Ea:return a=Bg(13,$,_,et),a.elementType=Ea,a.lanes=tt,a;case Fa:return a=Bg(19,$,_,et),a.elementType=Fa,a.lanes=tt,a;case Ia:return pj($,et,tt,_);default:if(typeof a=="object"&&a!==null)switch(a.$$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,a==null?a:typeof a,""))}return _=Bg(rt,$,_,et),_.elementType=a,_.type=j,_.lanes=tt,_}function Tg(a,_,$,j){return a=Bg(7,a,j,_),a.lanes=$,a}function pj(a,_,$,j){return a=Bg(22,a,j,_),a.elementType=Ia,a.lanes=$,a.stateNode={isHidden:!1},a}function Qg(a,_,$){return a=Bg(6,a,null,_),a.lanes=$,a}function Sg(a,_,$){return _=Bg(4,a.children!==null?a.children:[],a.key,_),_.lanes=$,_.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},_}function al(a,_,$,j,et){this.tag=_,this.containerInfo=a,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 a=new al(a,_,$,nt,it),_===1?(_=1,tt===!0&&(_|=8)):_=0,tt=Bg(3,null,null,_),a.current=tt,tt.stateNode=a,tt.memoizedState={element:j,isDehydrated:$,cache:null,transitions:null,pendingSuspenseBoundaries:null},kh(tt),a}function cl(a,_,$){var j=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE)}catch(a){console.error(a)}}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(_){super(_),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=initialState$c}static getDerivedStateFromError(_){return{didCatch:!0,error:_}}resetErrorBoundary(){const{error:_}=this.state;if(_!==null){for(var $,j,et=arguments.length,tt=new Array(et),rt=0;rt0&&arguments[0]!==void 0?arguments[0]:[],_=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return a.length!==_.length||a.some(($,j)=>!Object.is($,_[j]))}function _typeof$7(a){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(a)}function _classCallCheck$2(a,_){if(!(a instanceof _))throw new TypeError("Cannot call a class as a function")}function _defineProperties$2(a,_){for(var $=0;$<_.length;$++){var j=_[$];j.enumerable=j.enumerable||!1,j.configurable=!0,"value"in j&&(j.writable=!0),Object.defineProperty(a,j.key,j)}}function _createClass$2(a,_,$){return _&&_defineProperties$2(a.prototype,_),a}function _possibleConstructorReturn$2(a,_){return _&&(_typeof$7(_)==="object"||typeof _=="function")?_:_assertThisInitialized$2(a)}function _getPrototypeOf$2(a){return _getPrototypeOf$2=Object.setPrototypeOf?Object.getPrototypeOf:function($){return $.__proto__||Object.getPrototypeOf($)},_getPrototypeOf$2(a)}function _assertThisInitialized$2(a){if(a===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function _inherits$2(a,_){if(typeof _!="function"&&_!==null)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(_&&_.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),_&&_setPrototypeOf$3(a,_)}function _setPrototypeOf$3(a,_){return _setPrototypeOf$3=Object.setPrototypeOf||function(j,et){return j.__proto__=et,j},_setPrototypeOf$3(a,_)}function _defineProperty$9(a,_,$){return _ in a?Object.defineProperty(a,_,{value:$,enumerable:!0,configurable:!0,writable:!0}):a[_]=$,a}var PersistGate=function(a){_inherits$2(_,a);function _(){var $,j;_classCallCheck$2(this,_);for(var et=arguments.length,tt=new Array(et),rt=0;rt0?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(;--_&&next()&&!(character<48||character>102||character>57&&character<65||character>70&&character<97););return slice$3(a,caret()+(_<6&&peek$2()==32&&next()==32))}function delimiter(a){for(;next();)switch(character){case a:return position$1;case 34:case 39:a!==34&&a!==39&&delimiter(character);break;case 40:a===41&&delimiter(a);break;case 92:next();break}return position$1}function commenter(a,_){for(;next()&&a+character!==57;)if(a+character===84&&peek$2()===47)break;return"/*"+slice$3(_,position$1-1)+"*"+from$1(a===47?a:next())}function identifier(a){for(;!token(peek$2());)next();return slice$3(a,position$1)}function compile(a){return dealloc(parse$c("",null,null,null,[""],a=alloc(a),0,[0],a))}function parse$c(a,_,$,j,et,tt,rt,nt,it){for(var st=0,ot=0,at=rt,ut=0,ht=0,yt=0,wt=1,Ct=1,Pt=1,$t=0,Mt="",Lt=et,Dt=tt,zt=j,Ot=Mt;Ct;)switch(yt=$t,$t=next()){case 40:if(yt!=108&&charat(Ot,at-1)==58){indexof(Ot+=replace(delimit($t),"&","&\f"),"&\f")!=-1&&(Pt=-1);break}case 34:case 39:case 91:Ot+=delimit($t);break;case 9:case 10:case 13:case 32:Ot+=whitespace(yt);break;case 92:Ot+=escaping(caret()-1,7);continue;case 47:switch(peek$2()){case 42:case 47:append(comment(commenter(next(),caret()),_,$),it);break;default:Ot+="/"}break;case 123*wt:nt[st++]=strlen(Ot)*Pt;case 125*wt:case 59:case 0:switch($t){case 0:case 125:Ct=0;case 59+ot:Pt==-1&&(Ot=replace(Ot,/\f/g,"")),ht>0&&strlen(Ot)-at&&append(ht>32?declaration(Ot+";",j,$,at-1):declaration(replace(Ot," ","")+";",j,$,at-2),it);break;case 59:Ot+=";";default:if(append(zt=ruleset(Ot,_,$,st,ot,et,nt,Mt,Lt=[],Dt=[],at),tt),$t===123)if(ot===0)parse$c(Ot,_,zt,zt,Lt,tt,at,nt,Dt);else switch(ut===99&&charat(Ot,3)===110?100:ut){case 100:case 108:case 109:case 115:parse$c(a,zt,zt,j&&append(ruleset(a,zt,zt,0,0,et,nt,Mt,et,Lt=[],at),Dt),et,Dt,at,nt,j?Lt:Dt);break;default:parse$c(Ot,zt,zt,zt,[""],Dt,0,nt,Dt)}}st=ot=ht=0,wt=Pt=1,Mt=Ot="",at=rt;break;case 58:at=1+strlen(Ot),ht=yt;default:if(wt<1){if($t==123)--wt;else if($t==125&&wt++==0&&prev$1()==125)continue}switch(Ot+=from$1($t),$t*wt){case 38:Pt=ot>0?1:(Ot+="\f",-1);break;case 44:nt[st++]=(strlen(Ot)-1)*Pt,Pt=1;break;case 64:peek$2()===45&&(Ot+=delimit(next())),ut=peek$2(),ot=at=strlen(Mt=Ot+=identifier(caret())),$t++;break;case 45:yt===45&&strlen(Ot)==2&&(wt=0)}}return tt}function ruleset(a,_,$,j,et,tt,rt,nt,it,st,ot){for(var at=et-1,ut=et===0?tt:[""],ht=sizeof(ut),yt=0,wt=0,Ct=0;yt0?ut[Pt]+" "+$t:replace($t,/&\f/g,ut[Pt])))&&(it[Ct++]=Mt);return node$3(a,_,$,et===0?RULESET:nt,it,st,ot)}function comment(a,_,$){return node$3(a,_,$,COMMENT$1,from$1(char()),substr(a,2,-2),0)}function declaration(a,_,$,j){return node$3(a,_,$,DECLARATION,substr(a,0,j),substr(a,j+1,-1),j)}function serialize(a,_){for(var $="",j=sizeof(a),et=0;et6)switch(charat(a,_+1)){case 109:if(charat(a,_+4)!==45)break;case 102:return replace(a,/(.+:)(.+)-([^]+)/,"$1"+WEBKIT+"$2-$3$1"+MOZ+(charat(a,_+3)==108?"$3":"$2-$3"))+a;case 115:return~indexof(a,"stretch")?prefix$1(replace(a,"stretch","fill-available"),_)+a:a}break;case 4949:if(charat(a,_+1)!==115)break;case 6444:switch(charat(a,strlen(a)-3-(~indexof(a,"!important")&&10))){case 107:return replace(a,":",":"+WEBKIT)+a;case 101:return replace(a,/(.+:)([^;!]+)(;|!.+)?/,"$1"+WEBKIT+(charat(a,14)===45?"inline-":"")+"box$3$1"+WEBKIT+"$2$3$1"+MS+"$2box$3")+a}break;case 5936:switch(charat(a,_+11)){case 114:return WEBKIT+a+MS+replace(a,/[svh]\w+-[tblr]{2}/,"tb")+a;case 108:return WEBKIT+a+MS+replace(a,/[svh]\w+-[tblr]{2}/,"tb-rl")+a;case 45:return WEBKIT+a+MS+replace(a,/[svh]\w+-[tblr]{2}/,"lr")+a}return WEBKIT+a+MS+a+a}return a}var prefixer=function(_,$,j,et){if(_.length>-1&&!_.return)switch(_.type){case DECLARATION:_.return=prefix$1(_.value,_.length);break;case KEYFRAMES:return serialize([copy(_,{value:replace(_.value,"@","@"+WEBKIT)})],et);case RULESET:if(_.length)return combine(_.props,function(tt){switch(match$1(tt,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return serialize([copy(_,{props:[replace(tt,/:(read-\w+)/,":"+MOZ+"$1")]})],et);case"::placeholder":return serialize([copy(_,{props:[replace(tt,/:(plac\w+)/,":"+WEBKIT+"input-$1")]}),copy(_,{props:[replace(tt,/:(plac\w+)/,":"+MOZ+"$1")]}),copy(_,{props:[replace(tt,/:(plac\w+)/,MS+"input-$1")]})],et)}return""})}},defaultStylisPlugins=[prefixer],createCache=function(_){var $=_.key;if($==="css"){var j=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(j,function(wt){var Ct=wt.getAttribute("data-emotion");Ct.indexOf(" ")!==-1&&(document.head.appendChild(wt),wt.setAttribute("data-s",""))})}var et=_.stylisPlugins||defaultStylisPlugins,tt={},rt,nt=[];rt=_.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+$+' "]'),function(wt){for(var Ct=wt.getAttribute("data-emotion").split(" "),Pt=1;Pt=4;++j,et-=4)$=a.charCodeAt(j)&255|(a.charCodeAt(++j)&255)<<8|(a.charCodeAt(++j)&255)<<16|(a.charCodeAt(++j)&255)<<24,$=($&65535)*1540483477+(($>>>16)*59797<<16),$^=$>>>24,_=($&65535)*1540483477+(($>>>16)*59797<<16)^(_&65535)*1540483477+((_>>>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,_=(_&65535)*1540483477+((_>>>16)*59797<<16)}return _^=_>>>13,_=(_&65535)*1540483477+((_>>>16)*59797<<16),((_^_>>>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(_){return _.charCodeAt(1)===45},isProcessableValue$1=function(_){return _!=null&&typeof _!="boolean"},processStyleName$1=memoize$2(function(a){return isCustomProperty$1(a)?a:a.replace(hyphenateRegex$1,"-$&").toLowerCase()}),processStyleValue$1=function(_,$){switch(_){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[_]!==1&&!isCustomProperty$1(_)&&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(a!==void 0){var tt=cursor$1,rt=$(a);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"&&_==null)for(var nt=0;ntjsxRuntimeExports.jsx(Global,{styles:vhPolyfill}),CSSReset=({scope:a=""})=>jsxRuntimeExports.jsx(Global,{styles:css$1` - html { - line-height: 1.5; - -webkit-text-size-adjust: 100%; - font-family: system-ui, sans-serif; - -webkit-font-smoothing: antialiased; - text-rendering: optimizeLegibility; - -moz-osx-font-smoothing: grayscale; - touch-action: manipulation; - } - - body { - position: relative; - min-height: 100%; - margin: 0; - font-feature-settings: "kern"; - } - - ${a} :where(*, *::before, *::after) { - border-width: 0; - border-style: solid; - box-sizing: border-box; - word-wrap: break-word; - } - - main { - display: block; - } - - ${a} hr { - border-top-width: 1px; - box-sizing: content-box; - height: 0; - overflow: visible; - } - - ${a} :where(pre, code, kbd,samp) { - font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace; - font-size: 1em; - } - - ${a} a { - background-color: transparent; - color: inherit; - text-decoration: inherit; - } - - ${a} abbr[title] { - border-bottom: none; - text-decoration: underline; - -webkit-text-decoration: underline dotted; - text-decoration: underline dotted; - } - - ${a} :where(b, strong) { - font-weight: bold; - } - - ${a} small { - font-size: 80%; - } - - ${a} :where(sub,sup) { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; - } - - ${a} sub { - bottom: -0.25em; - } - - ${a} sup { - top: -0.5em; - } - - ${a} img { - border-style: none; - } - - ${a} :where(button, input, optgroup, select, textarea) { - font-family: inherit; - font-size: 100%; - line-height: 1.15; - margin: 0; - } - - ${a} :where(button, input) { - overflow: visible; - } - - ${a} :where(button, select) { - text-transform: none; - } - - ${a} :where( - button::-moz-focus-inner, - [type="button"]::-moz-focus-inner, - [type="reset"]::-moz-focus-inner, - [type="submit"]::-moz-focus-inner - ) { - border-style: none; - padding: 0; - } - - ${a} fieldset { - padding: 0.35em 0.75em 0.625em; - } - - ${a} legend { - box-sizing: border-box; - color: inherit; - display: table; - max-width: 100%; - padding: 0; - white-space: normal; - } - - ${a} progress { - vertical-align: baseline; - } - - ${a} textarea { - overflow: auto; - } - - ${a} :where([type="checkbox"], [type="radio"]) { - box-sizing: border-box; - padding: 0; - } - - ${a} input[type="number"]::-webkit-inner-spin-button, - ${a} input[type="number"]::-webkit-outer-spin-button { - -webkit-appearance: none !important; - } - - ${a} input[type="number"] { - -moz-appearance: textfield; - } - - ${a} input[type="search"] { - -webkit-appearance: textfield; - outline-offset: -2px; - } - - ${a} input[type="search"]::-webkit-search-decoration { - -webkit-appearance: none !important; - } - - ${a} ::-webkit-file-upload-button { - -webkit-appearance: button; - font: inherit; - } - - ${a} details { - display: block; - } - - ${a} summary { - display: list-item; - } - - template { - display: none; - } - - [hidden] { - display: none !important; - } - - ${a} :where( - blockquote, - dl, - dd, - h1, - h2, - h3, - h4, - h5, - h6, - hr, - figure, - p, - pre - ) { - margin: 0; - } - - ${a} button { - background: transparent; - padding: 0; - } - - ${a} fieldset { - margin: 0; - padding: 0; - } - - ${a} :where(ol, ul) { - margin: 0; - padding: 0; - } - - ${a} textarea { - resize: vertical; - } - - ${a} :where(button, [role="button"]) { - cursor: pointer; - } - - ${a} button::-moz-focus-inner { - border: 0 !important; - } - - ${a} table { - border-collapse: collapse; - } - - ${a} :where(h1, h2, h3, h4, h5, h6) { - font-size: inherit; - font-weight: inherit; - } - - ${a} :where(button, input, optgroup, select, textarea) { - padding: 0; - line-height: inherit; - color: inherit; - } - - ${a} :where(img, svg, video, canvas, audio, iframe, embed, object) { - display: block; - } - - ${a} :where(img, video) { - max-width: 100%; - height: auto; - } - - [data-js-focus-visible] - :focus:not([data-focus-visible-added]):not( - [data-focus-visible-disabled] - ) { - outline: none; - box-shadow: none; - } - - ${a} select::-ms-expand { - display: none; - } - - ${vhPolyfill} - `});function getErrorMessage(a,_){return`${a} returned \`undefined\`. Seems you forgot to wrap component within ${_}`}function createContext$1(a={}){const{name:_,strict:$=!0,hookName:j="useContext",providerName:et="Provider",errorMessage:tt,defaultValue:rt}=a,nt=reactExports.createContext(rt);nt.displayName=_;function it(){var st;const ot=reactExports.useContext(nt);if(!ot&&$){const at=new Error(tt??getErrorMessage(j,et));throw at.name="ContextError",(st=Error.captureStackTrace)==null||st.call(Error,at,it),at}return ot}return[nt.Provider,it,nt]}var[PortalManagerContextProvider,usePortalManager]=createContext$1({strict:!1,name:"PortalManagerContext"});function PortalManager(a){const{children:_,zIndex:$}=a;return jsxRuntimeExports.jsx(PortalManagerContextProvider,{value:{zIndex:$},children:_})}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=a=>jsxRuntimeExports.jsx("div",{className:"chakra-portal-zIndex",style:{position:"absolute",zIndex:a.zIndex,top:0,left:0,right:0},children:a.children}),DefaultPortal=a=>{const{appendToParentPortal:_,children:$}=a,[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 ot=j.ownerDocument,at=_?nt??ot.body:ot.body;if(!at)return;tt.current=ot.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 st=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:st}),tt.current):jsxRuntimeExports.jsx("span",{ref:ot=>{ot&&et(ot)}})},ContainerPortal=a=>{const{children:_,containerRef:$,appendToParentPortal:j}=a,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:_}),rt):null};function Portal(a){const _={appendToParentPortal:!0,...a},{containerRef:$,...j}=_;return $?jsxRuntimeExports.jsx(ContainerPortal,{containerRef:$,...j}):jsxRuntimeExports.jsx(DefaultPortal,{...j})}Portal.className=PORTAL_CLASSNAME;Portal.selector=PORTAL_SELECTOR;Portal.displayName="Portal";function useTheme(){const a=reactExports.useContext(ThemeContext);if(!a)throw Error("useTheme: `theme` is undefined. Seems you forgot to wrap your app in `` or ``");return a}var ColorModeContext=reactExports.createContext({});ColorModeContext.displayName="ColorModeContext";function useColorMode(){const a=reactExports.useContext(ColorModeContext);if(a===void 0)throw new Error("useColorMode must be used within a ColorModeProvider");return a}var classNames={light:"chakra-ui-light",dark:"chakra-ui-dark"};function getColorModeUtils(a={}){const{preventTransition:_=!0}=a,$={setDataset:j=>{const et=_?$.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(a){return{ssr:!1,type:"localStorage",get(_){if(!(globalThis!=null&&globalThis.document))return _;let $;try{$=localStorage.getItem(a)||_}catch{}return $||_},set(_){try{localStorage.setItem(a,_)}catch{}}}}var localStorageManager=createLocalStorageManager(STORAGE_KEY),noop$c=()=>{};function getTheme(a,_){return a.type==="cookie"&&a.ssr?a.get(_):_}function ColorModeProvider(a){const{value:_,children:$,options:{useSystemColorMode:j,initialColorMode:et,disableTransitionOnChange:tt}={},colorModeManager:rt=localStorageManager}=a,nt=et==="dark"?"dark":"light",[it,st]=reactExports.useState(()=>getTheme(rt,nt)),[ot,at]=reactExports.useState(()=>getTheme(rt)),{getSystemTheme:ut,setClassName:ht,setDataset:yt,addListener:wt}=reactExports.useMemo(()=>getColorModeUtils({preventTransition:tt}),[tt]),Ct=et==="system"&&!it?ot:it,Pt=reactExports.useCallback(Lt=>{const Dt=Lt==="system"?ut():Lt;st(Dt),ht(Dt==="dark"),yt(Dt),rt.set(Dt)},[rt,ut,ht,yt]);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 $t=reactExports.useCallback(()=>{Pt(Ct==="dark"?"light":"dark")},[Ct,Pt]);reactExports.useEffect(()=>{if(j)return wt(Pt)},[j,wt,Pt]);const Mt=reactExports.useMemo(()=>({colorMode:_??Ct,toggleColorMode:_?noop$c:$t,setColorMode:_?noop$c:Pt,forced:_!==void 0}),[Ct,$t,Pt,_]);return jsxRuntimeExports.jsx(ColorModeContext.Provider,{value:Mt,children:$})}ColorModeProvider.displayName="ColorModeProvider";var VALID_VALUES=new Set(["dark","light","system"]);function normalize$2(a){let _=a;return VALID_VALUES.has(_)||(_="light"),_}function getScriptSrc(a={}){const{initialColorMode:_="light",type:$="localStorage",storageKey:j="chakra-ui-color-mode"}=a,et=normalize$2(_),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(a={}){const{nonce:_}=a;return jsxRuntimeExports.jsx("script",{id:"chakra-script",nonce:_,dangerouslySetInnerHTML:{__html:getScriptSrc(a)}})}function useChakra(){const a=useColorMode(),_=useTheme();return{...a,theme:_}}function getTokenValue(a,_,$){var j,et;if(_==null)return _;const tt=rt=>{var nt,it;return(it=(nt=a.__cssMap)==null?void 0:nt[rt])==null?void 0:it.value};return(et=(j=tt(_))!=null?j:tt($))!=null?et:$}function getToken(a,_,$){const j=Array.isArray(_)?_:[_],et=Array.isArray($)?$:[$];return tt=>{const rt=et.filter(Boolean),nt=j.map((it,st)=>{var ot;const at=`${a}.${it}`;return getTokenValue(tt,at,(ot=rt[st])!=null?ot:it)});return Array.isArray(_)?nt:nt[0]}}var cx=(...a)=>a.filter(Boolean).join(" ");function isDev(){return!1}function isObject$5(a){const _=typeof a;return a!=null&&(_==="object"||_==="function")&&!Array.isArray(a)}var warn=a=>{const{condition:_,message:$}=a;_&&isDev()&&console.warn($)};function runIfFn$2(a,..._){return isFunction$8(a)?a(..._):a}var isFunction$8=a=>typeof a=="function",dataAttr=a=>a?"":void 0,ariaAttr=a=>a?!0:void 0;function callAllHandlers$1(...a){return function($){a.some(j=>(j==null||j($),$==null?void 0:$.defaultPrevented))}}function callAll(...a){return function($){a.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]",st="[object AsyncFunction]",ot="[object Boolean]",at="[object Date]",ut="[object Error]",ht="[object Function]",yt="[object GeneratorFunction]",wt="[object Map]",Ct="[object Number]",Pt="[object Null]",$t="[object Object]",Mt="[object Proxy]",Lt="[object RegExp]",Dt="[object Set]",zt="[object String]",Ot="[object Undefined]",It="[object WeakMap]",Bt="[object ArrayBuffer]",Ft="[object DataView]",jt="[object Float32Array]",bt="[object Float64Array]",vt="[object Int8Array]",ct="[object Int16Array]",dt="[object Int32Array]",mt="[object Uint8Array]",xt="[object Uint8ClampedArray]",At="[object Uint16Array]",Rt="[object Uint32Array]",St=/[\\^$.*+?()[\]{}|]/g,Tt=/^\[object .+?Constructor\]$/,Et=/^(?:0|[1-9]\d*)$/,Nt={};Nt[jt]=Nt[bt]=Nt[vt]=Nt[ct]=Nt[dt]=Nt[mt]=Nt[xt]=Nt[At]=Nt[Rt]=!0,Nt[nt]=Nt[it]=Nt[Bt]=Nt[ot]=Nt[Ft]=Nt[at]=Nt[ut]=Nt[ht]=Nt[wt]=Nt[Ct]=Nt[$t]=Nt[Lt]=Nt[Dt]=Nt[zt]=Nt[It]=!1;var tr=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,ir=typeof self=="object"&&self&&self.Object===Object&&self,nr=tr||ir||Function("return this")(),Zt=_&&!_.nodeType&&_,Kt=Zt&&!0&&a&&!a.nodeType&&a,Qt=Kt&&Kt.exports===Zt,Ht=Qt&&tr.process,qt=function(){try{var Xt=Kt&&Kt.require&&Kt.require("util").types;return Xt||Ht&&Ht.binding&&Ht.binding("util")}catch{}}(),Jt=qt&&qt.isTypedArray;function ur(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=Rn,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,Tn=rn>2?gr[2]:void 0;for(xn=Xt.length>3&&typeof xn=="function"?(rn--,xn):void 0,Tn&&Yl(gr[0],gr[1],Tn)&&(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 $l(Xt){if(Xt!=null){try{return kr.call(Xt)}catch{}try{return Xt+""}catch{}}return""}function Xs(Xt,cr){return Xt===cr||Xt!==Xt&&cr!==cr}var Ao=es(function(){return arguments}())?es:function(Xt){return Is(Xt)&&Ar.call(Xt,"callee")&&!ar.call(Xt,"callee")},Ls=Array.isArray;function uo(Xt){return Xt!=null&&To(Xt.length)&&!$o(Xt)}function Tl(Xt){return Is(Xt)&&uo(Xt)}var fo=Wr||wr;function $o(Xt){if(!Ps(Xt))return!1;var cr=Qn(Xt);return cr==ht||cr==yt||cr==st||cr==Mt}function To(Xt){return typeof Xt=="number"&&Xt>-1&&Xt%1==0&&Xt<=rt}function Ps(Xt){var cr=typeof Xt;return Xt!=null&&(cr=="object"||cr=="function")}function Is(Xt){return Xt!=null&&typeof Xt=="object"}function Pl(Xt){if(!Is(Xt)||Qn(Xt)!=$t)return!1;var cr=Vt(Xt);if(cr===null)return!0;var gr=Ar.call(cr,"constructor")&&cr.constructor;return typeof gr=="function"&&gr instanceof gr&&kr.call(gr)==Lr}var No=Jt?pr(Jt):us;function Po(Xt){return wo(Xt,Bo(Xt))}function Bo(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 wr(){return!1}a.exports=Xl})(lodash_mergewith,lodash_mergewith.exports);var lodash_mergewithExports=lodash_mergewith.exports;const mergeWith=getDefaultExportFromCjs$1(lodash_mergewithExports);var isImportant=a=>/!(important)?$/.test(a),withoutImportant=a=>typeof a=="string"?a.replace(/!(important)?$/,"").trim():a,tokenToCSSVar=(a,_)=>$=>{const j=String(_),et=isImportant(j),tt=withoutImportant(j),rt=a?`${a}.${tt}`:tt;let nt=isObject$5($.__cssMap)&&rt in $.__cssMap?$.__cssMap[rt].varRef:_;return nt=withoutImportant(nt),et?`${nt} !important`:nt};function createTransform(a){const{scale:_,transform:$,compose:j}=a;return(tt,rt)=>{var nt;const it=tokenToCSSVar(_,tt)(rt);let st=(nt=$==null?void 0:$(it,rt))!=null?nt:it;return j&&(st=j(st,rt)),st}}var pipe$3=(...a)=>_=>a.reduce(($,j)=>j($),_);function toConfig(a,_){return $=>{const j={property:$,scale:a};return j.transform=createTransform({scale:a,transform:_}),j}}var getRtl=({rtl:a,ltr:_})=>$=>$.direction==="rtl"?a:_;function logical(a){const{property:_,scale:$,transform:j}=a;return{scale:$,property:getRtl(_),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(a){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":a,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=a=>a.trim();function parseGradient(a,_){if(a==null||globalSet.has(a))return a;if(!(isCSSFunction(a)||globalSet.has(a)))return`url('${a}')`;const et=/(^[a-z-A-Z]+)\((.*)\)/g.exec(a),tt=et==null?void 0:et[1],rt=et==null?void 0:et[2];if(!tt||!rt)return a;const nt=tt.includes("-gradient")?tt:`${tt}-gradient`,[it,...st]=rt.split(",").map(trimSpace).filter(Boolean);if((st==null?void 0:st.length)===0)return a;const ot=it in directionMap?directionMap[it]:it;st.unshift(ot);const at=st.map(ut=>{if(valueSet.has(ut))return ut;const ht=ut.indexOf(" "),[yt,wt]=ht!==-1?[ut.substr(0,ht),ut.substr(ht+1)]:[ut],Ct=isCSSFunction(wt)?wt:wt&&wt.split(" "),Pt=`colors.${yt}`,$t=Pt in _.__cssMap?_.__cssMap[Pt].varRef:yt;return Ct?[$t,...Array.isArray(Ct)?Ct:[Ct]].join(" "):$t});return`${nt}(${at.join(", ")})`}var isCSSFunction=a=>typeof a=="string"&&a.includes("(")&&a.includes(")"),gradientTransform=(a,_)=>parseGradient(a,_??{});function isCssVar(a){return/^var\(--.+\)$/.test(a)}var analyzeCSSValue=a=>{const _=parseFloat(a.toString()),$=a.toString().replace(String(_),"");return{unitless:!$,value:_,unit:$}},wrap=a=>_=>`${a}(${_})`,transformFunctions={filter(a){return a!=="auto"?a:filterTemplate},backdropFilter(a){return a!=="auto"?a:backdropFilterTemplate},ring(a){return getRingTemplate(transformFunctions.px(a))},bgClip(a){return a==="text"?{color:"transparent",backgroundClip:"text"}:{backgroundClip:a}},transform(a){return a==="auto"?getTransformTemplate():a==="auto-gpu"?getTransformGpuTemplate():a},vh(a){return a==="$100vh"?"var(--chakra-vh)":a},px(a){if(a==null)return a;const{unitless:_}=analyzeCSSValue(a);return _||typeof a=="number"?`${a}px`:a},fraction(a){return typeof a!="number"||a>1?a:`${a*100}%`},float(a,_){const $={left:"right",right:"left"};return _.direction==="rtl"?$[a]:a},degree(a){if(isCssVar(a)||a==null)return a;const _=typeof a=="string"&&!a.endsWith("deg");return typeof a=="number"||_?`${a}deg`:a},gradient:gradientTransform,blur:wrap("blur"),opacity:wrap("opacity"),brightness:wrap("brightness"),contrast:wrap("contrast"),dropShadow:wrap("drop-shadow"),grayscale:wrap("grayscale"),hueRotate:a=>wrap("hue-rotate")(transformFunctions.degree(a)),invert:wrap("invert"),saturate:wrap("saturate"),sepia:wrap("sepia"),bgImage(a){return a==null||isCSSFunction(a)||globalSet.has(a)?a:`url(${a})`},outline(a){const _=String(a)==="0"||String(a)==="none";return a!==null&&_?{outline:"2px solid transparent",outlineOffset:"2px"}:{outline:a}},flexDirection(a){var _;const{space:$,divide:j}=(_=flexDirectionTemplate[a])!=null?_:{},et={flexDirection:a};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(a){return{property:a,transform:transformFunctions.degree}},prop(a,_,$){return{property:a,scale:_,..._&&{transform:createTransform({scale:_,transform:$})}}},propT(a,_){return{property:a,transform:_}},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=($=_.__breakpoints)==null?void 0:$.get(a))==null?void 0:j.minW)!=null?et:a})`]:{display:"none"}}}},hideBelow:{scale:"breakpoints",transform:(a,_)=>{var $,j,et;return{[`@media screen and (max-width: ${(et=(j=($=_.__breakpoints)==null?void 0:$.get(a))==null?void 0:j._minW)!=null?et:a})`]:{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$4(a,_,$,j){const et=typeof _=="string"?_.split("."):[_];for(j=0;j{const _=new WeakMap;return(j,et,tt,rt)=>{if(typeof j>"u")return a(j,et,tt);_.has(j)||_.set(j,new Map);const nt=_.get(j);if(nt.has(et))return nt.get(et);const it=a(j,et,tt,rt);return nt.set(et,it),it}},memoizedGet$1=memoize$1(get$4),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(a){return a===!0?srOnly:a==="focusable"?srFocusable:{}}},layerStyle:{processResult:!0,transform:(a,_,$)=>getWithPriority(_,`layerStyles.${a}`,$)},textStyle:{processResult:!0,transform:(a,_,$)=>getWithPriority(_,`textStyles.${a}`,$)},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(a){if(a===!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(a){return isObject$5(a)&&a.reference?a.reference:String(a)}var toExpression=(a,..._)=>_.map(resolveReference).join(` ${a} `).replace(/calc/g,""),add$1=(...a)=>`calc(${toExpression("+",...a)})`,subtract$1=(...a)=>`calc(${toExpression("-",...a)})`,multiply$1=(...a)=>`calc(${toExpression("*",...a)})`,divide$1=(...a)=>`calc(${toExpression("/",...a)})`,negate$1=a=>{const _=resolveReference(a);return _!=null&&!Number.isNaN(parseFloat(_))?String(_).startsWith("-")?String(_).slice(1):`-${_}`:multiply$1(_,-1)},calc$1=Object.assign(a=>({add:(..._)=>calc$1(add$1(a,..._)),subtract:(..._)=>calc$1(subtract$1(a,..._)),multiply:(..._)=>calc$1(multiply$1(a,..._)),divide:(..._)=>calc$1(divide$1(a,..._)),negate:()=>calc$1(negate$1(a)),toString:()=>a.toString()}),{add:add$1,subtract:subtract$1,multiply:multiply$1,divide:divide$1,negate:negate$1});function replaceWhiteSpace$1(a,_="-"){return a.replace(/\s+/g,_)}function escape$2(a){const _=replaceWhiteSpace$1(a.toString());return escapeSymbol(escapeDot(_))}function escapeDot(a){return a.includes("\\.")?a:!Number.isInteger(parseFloat(a.toString()))?a.replace(".","\\."):a}function escapeSymbol(a){return a.replace(/[!-,/:-@[-^`{-~]/g,"\\$&")}function addPrefix$1(a,_=""){return[_,a].filter(Boolean).join("-")}function toVarReference(a,_){return`var(${a}${_?`, ${_}`:""})`}function toVarDefinition(a,_=""){return escape$2(`--${addPrefix$1(a,_)}`)}function cssVar$1(a,_,$){const j=toVarDefinition(a,$);return{variable:j,reference:toVarReference(j,_)}}function defineCssVars(a,_){const $={};for(const j of _){if(Array.isArray(j)){const[et,tt]=j;$[et]=cssVar$1(`${a}-${et}`,tt);continue}$[j]=cssVar$1(`${a}-${j}`)}return $}function getLastItem(a){const _=a==null?0:a.length;return _?a[_-1]:void 0}function analyzeCSSValue2(a){const _=parseFloat(a.toString()),$=a.toString().replace(String(_),"");return{unitless:!$,value:_,unit:$}}function px$1(a){if(a==null)return a;const{unitless:_}=analyzeCSSValue2(a);return _||typeof a=="number"?`${a}px`:a}var sortByBreakpointValue=(a,_)=>parseInt(a[1],10)>parseInt(_[1],10)?1:-1,sortBps=a=>Object.fromEntries(Object.entries(a).sort(sortByBreakpointValue));function normalize$1(a){const _=sortBps(a);return Object.assign(Object.values(_),_)}function keys$1(a){const _=Object.keys(sortBps(a));return new Set(_)}function subtract2(a){var _;if(!a)return a;a=(_=px$1(a))!=null?_:a;const $=-.02;return typeof a=="number"?`${a+$}`:a.replace(/(\d+\.?\d*)/u,j=>`${parseFloat(j)+$}`)}function toMediaQueryString(a,_){const $=["@media screen"];return a&&$.push("and",`(min-width: ${px$1(a)})`),_&&$.push("and",`(max-width: ${px$1(_)})`),$.join(" ")}function analyzeBreakpoints(a){var _;if(!a)return null;a.base=(_=a.base)!=null?_:"0px";const $=normalize$1(a),j=Object.entries(a).sort(sortByBreakpointValue).map(([rt,nt],it,st)=>{var ot;let[,at]=(ot=st[it+1])!=null?ot:[];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(a),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(a),asArray:normalize$1(a),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 st;return(st=rt[it])!=null?st: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,st)=>{const ot=tt[st];return ot!=null&&it!=null&&(nt[ot]=it),nt},{})}}}var state$1={hover:(a,_)=>`${a}:hover ${_}, ${a}[data-hover] ${_}`,focus:(a,_)=>`${a}:focus ${_}, ${a}[data-focus] ${_}`,focusVisible:(a,_)=>`${a}:focus-visible ${_}`,focusWithin:(a,_)=>`${a}:focus-within ${_}`,active:(a,_)=>`${a}:active ${_}, ${a}[data-active] ${_}`,disabled:(a,_)=>`${a}:disabled ${_}, ${a}[data-disabled] ${_}`,invalid:(a,_)=>`${a}:invalid ${_}, ${a}[data-invalid] ${_}`,checked:(a,_)=>`${a}:checked ${_}, ${a}[data-checked] ${_}`,indeterminate:(a,_)=>`${a}:indeterminate ${_}, ${a}[aria-checked=mixed] ${_}, ${a}[data-indeterminate] ${_}`,readOnly:(a,_)=>`${a}:read-only ${_}, ${a}[readonly] ${_}, ${a}[data-read-only] ${_}`,expanded:(a,_)=>`${a}:read-only ${_}, ${a}[aria-expanded=true] ${_}, ${a}[data-expanded] ${_}`,placeholderShown:(a,_)=>`${a}:placeholder-shown ${_}`},toGroup=a=>merge$2(_=>a(_,"&"),"[role=group]","[data-group]",".group"),toPeer=a=>merge$2(_=>a(_,"~ &"),"[data-peer]",".peer"),merge$2=(a,..._)=>_.map(a).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(a).replace(/\./g,"-"),void 0,_)}function createThemeVars(a,_){let $={};const j={};for(const[et,tt]of Object.entries(a)){const{isSemantic:rt,value:nt}=tt,{variable:it,reference:st}=tokenToCssVar(et,_==null?void 0:_.cssVarPrefix);if(!rt){if(et.startsWith("space")){const ut=et.split("."),[ht,...yt]=ut,wt=`${ht}.-${yt.join(".")}`,Ct=calc$1.negate(nt),Pt=calc$1.negate(st);j[wt]={value:Ct,var:it,varRef:Pt}}$[it]=nt,j[et]={value:nt,var:it,varRef:st};continue}const ot=ut=>{const yt=[String(et).split(".")[0],ut].join(".");if(!a[yt])return ut;const{reference:Ct}=tokenToCssVar(yt,_==null?void 0:_.cssVarPrefix);return Ct},at=isObject$5(nt)?nt:{default:nt};$=mergeWith($,Object.entries(at).reduce((ut,[ht,yt])=>{var wt,Ct;if(!yt)return ut;const Pt=ot(`${yt}`);if(ht==="default")return ut[it]=Pt,ut;const $t=(Ct=(wt=pseudoSelectors)==null?void 0:wt[ht])!=null?Ct:ht;return ut[$t]={[it]:Pt},ut},{})),j[et]={value:st,var:it,varRef:st}}return{cssVars:$,cssMap:j}}function omit$6(a,_=[]){const $=Object.assign({},a);for(const j of _)j in $&&delete $[j];return $}function pick$2(a,_){const $={};for(const j of _)j in a&&($[j]=a[j]);return $}function isObject5(a){return typeof a=="object"&&a!=null&&!Array.isArray(a)}function walkObject(a,_,$={}){const{stop:j,getKey:et}=$;function tt(rt,nt=[]){var it;if(isObject5(rt)||Array.isArray(rt)){const st={};for(const[ot,at]of Object.entries(rt)){const ut=(it=et==null?void 0:et(ot))!=null?it:ot,ht=[...nt,ut];if(j!=null&&j(rt,ht))return _(rt,nt);st[ut]=tt(at,ht)}return st}return _(rt,nt)}return tt(a)}var tokens$1=["colors","borders","borderWidths","borderStyles","fonts","fontSizes","fontWeights","gradients","letterSpacings","lineHeights","radii","space","shadows","sizes","zIndices","transition","blur","breakpoints"];function extractTokens(a){return pick$2(a,tokens$1)}function extractSemanticTokens(a){return a.semanticTokens}function omitVars(a){const{__cssMap:_,__cssVars:$,__breakpoints:j,...et}=a;return et}var isSemanticCondition=a=>pseudoPropNames.includes(a)||a==="default";function flattenTokens({tokens:a,semanticTokens:_}){const $={};return walkObject(a,(j,et)=>{j!=null&&($[et.join(".")]={isSemantic:!1,value:j})}),walkObject(_,(j,et)=>{j!=null&&($[et.join(".")]={isSemantic:!0,value:j})},{stop:j=>Object.keys(j).every(isSemanticCondition)}),$}function toCSSVar(a){var _;const $=omitVars(a),j=extractTokens($),et=extractSemanticTokens($),tt=flattenTokens({tokens:j,semanticTokens:et}),rt=(_=$.config)==null?void 0:_.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=a=>a in styleProps,expandResponsive=a=>_=>{if(!_.__breakpoints)return a;const{isResponsive:$,toArrayValue:j,media:et}=_.__breakpoints,tt={};for(const rt in a){let nt=runIfFn$2(a[rt],_);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 st=0;sta.startsWith("--")&&typeof _=="string"&&!isCssVar2(_),resolveTokenValue=(a,_)=>{var $,j;if(_==null)return _;const et=it=>{var st,ot;return(ot=(st=a.__cssMap)==null?void 0:st[it])==null?void 0:ot.varRef},tt=it=>{var st;return(st=et(it))!=null?st:it},[rt,nt]=splitByComma(_);return _=(j=($=et(rt))!=null?$:tt(nt))!=null?j:tt(_),_};function getCss(a){const{configs:_={},pseudos:$={},theme:j}=a,et=(tt,rt=!1)=>{var nt,it,st;const ot=runIfFn$2(tt,j),at=expandResponsive(ot)(j);let ut={};for(let ht in at){const yt=at[ht];let wt=runIfFn$2(yt,j);ht in $&&(ht=$[ht]),isCSSVariableTokenValue(ht,wt)&&(wt=resolveTokenValue(j,wt));let Ct=_[ht];if(Ct===!0&&(Ct={property:ht}),isObject$5(wt)){ut[ht]=(nt=ut[ht])!=null?nt:{},ut[ht]=mergeWith({},ut[ht],et(wt,!0));continue}let Pt=(st=(it=Ct==null?void 0:Ct.transform)==null?void 0:it.call(Ct,wt,j,ot))!=null?st:wt;Pt=Ct!=null&&Ct.processResult?et(Pt,!0):Pt;const $t=runIfFn$2(Ct==null?void 0:Ct.property,j);if(!rt&&(Ct!=null&&Ct.static)){const Mt=runIfFn$2(Ct.static,j);ut=mergeWith({},ut,Mt)}if($t&&Array.isArray($t)){for(const Mt of $t)ut[Mt]=Pt;continue}if($t){$t==="&"&&isObject$5(Pt)?ut=mergeWith({},ut,Pt):ut[$t]=Pt;continue}if(isObject$5(Pt)){ut=mergeWith({},ut,Pt);continue}ut[ht]=Pt}return ut};return et}var css=a=>_=>getCss({theme:_,pseudos:pseudoSelectors,configs:systemProps})(a);function defineStyle(a){return a}function defineStyleConfig(a){return a}function createMultiStyleConfigHelpers(a){return{definePartsStyle(_){return _},defineMultiStyleConfig(_){return{parts:a,..._}}}}function normalize2(a,_){if(Array.isArray(a))return a;if(isObject$5(a))return _(a);if(a!=null)return[a]}function getNextIndex$1(a,_){for(let $=_+1;${mergeWith(st,{[Mt]:ut?$t[Mt]:{[Pt]:$t[Mt]}})});continue}if(!ht){ut?mergeWith(st,$t):st[Pt]=$t;continue}st[Pt]=$t}}return st}}function resolveStyleConfig(a){return _=>{var $;const{variant:j,size:et,theme:tt}=_,rt=createResolver(tt);return mergeWith({},runIfFn$2(($=a.baseStyle)!=null?$:{},_),rt(a,"sizes",et,_),rt(a,"variants",j,_))}}function getCSSVar(a,_,$){var j,et,tt;return(tt=(et=(j=a.__cssMap)==null?void 0:j[`${_}.${$}`])==null?void 0:et.varRef)!=null?tt:$}function omitThemingProps(a){return omit$6(a,["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(a){return isObject$5(a)?requiredChakraThemeKeys.every(_=>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:a})=>({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.${a}.500`,_dark:{[$accentColor.variable]:`colors.${a}.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(...ot){j();for(const at of ot)_[at]=it(at);return anatomy(a,_)}function tt(...ot){for(const at of ot)at in _||(_[at]=it(at));return anatomy(a,_)}function rt(){return Object.fromEntries(Object.entries(_).map(([at,ut])=>[at,ut.selector]))}function nt(){return Object.fromEntries(Object.entries(_).map(([at,ut])=>[at,ut.className]))}function it(ot){const ht=`chakra-${(["container","root"].includes(ot??"")?[a]:[a,ot]).filter(Boolean).join("__")}`;return{className:ht,selector:`.${ht}`,toString:()=>ot}}return{parts:et,toPart:it,extend:tt,selectors:rt,classnames:nt,get keys(){return Object.keys(_)},__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(_){super(`Failed to parse color: "${_}"`)}}var ColorError$1=ColorError;function parseToRgba(a){if(typeof a!="string")throw new ColorError$1(a);if(a.trim().toLowerCase()==="transparent")return[0,0,0,0];let _=a.trim();_=namedColorRegex.test(a)?nameToHex(a):a;const $=reducedHexRegex.exec(_);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(_);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(_);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(_);if(tt){const[rt,nt,it,st]=Array.from(tt).slice(1).map(parseFloat);if(guard(0,100,nt)!==nt)throw new ColorError$1(a);if(guard(0,100,it)!==it)throw new ColorError$1(a);return[...hslToRgb(rt,nt,it),Number.isNaN(st)?1:st]}throw new ColorError$1(a)}function hash$8(a){let _=5381,$=a.length;for(;$;)_=_*33^a.charCodeAt(--$);return(_>>>0)%2341}const colorToInt=a=>parseInt(a.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(_.substring(0,3)),j=colorToInt(_.substring(3)).toString(16);let et="";for(let tt=0;tt<6-j.length;tt++)et+="0";return a[$]=`${et}${j}`,a},{});function nameToHex(a){const _=a.toLowerCase().trim(),$=compressedColorMap[hash$8(_)];if(!$)throw new ColorError$1(a);return`#${$}`}const r$3=(a,_)=>Array.from(Array(_)).map(()=>a).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=a=>Math.round(a*255),hslToRgb=(a,_,$)=>{let j=$/100;if(_===0)return[j,j,j].map(roundColor);const et=(a%360+360)%360/60,tt=(1-Math.abs(2*j-1))*(_/100),rt=tt*(1-Math.abs(et%2-1));let nt=0,it=0,st=0;et>=0&&et<1?(nt=tt,it=rt):et>=1&&et<2?(nt=rt,it=tt):et>=2&&et<3?(it=tt,st=rt):et>=3&&et<4?(it=rt,st=tt):et>=4&&et<5?(nt=rt,st=tt):et>=5&&et<6&&(nt=tt,st=rt);const ot=j-tt/2,at=nt+ot,ut=it+ot,ht=st+ot;return[at,ut,ht].map(roundColor)};function rgba$1(a,_,$,j){return`rgba(${guard(0,255,a).toFixed()}, ${guard(0,255,_).toFixed()}, ${guard(0,255,$).toFixed()}, ${parseFloat(guard(0,1,j).toFixed(3))})`}function transparentize$1(a,_){const[$,j,et,tt]=parseToRgba(a);return rgba$1($,j,et,tt-_)}function toHex$3(a){const[_,$,j,et]=parseToRgba(a);let tt=rt=>{const nt=guard(0,255,rt).toString(16);return nt.length===1?`0${nt}`:nt};return`#${tt(_)}${tt($)}${tt(j)}${et<1?tt(Math.round(et*255)):""}`}function dlv_es_default(a,_,$,j,et){for(_=_.split?_.split("."):_,j=0;j<_.length;j++)a=a?a[_[j]]:et;return a===et?$:a}var isEmptyObject$1=a=>Object.keys(a).length===0,getColor=(a,_,$)=>{const j=dlv_es_default(a,`colors.${_}`,_);try{return toHex$3(j),j}catch{return $??"#000000"}},getBrightness=a=>{const[_,$,j]=parseToRgba(a);return(_*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($,a);return transparentize$1(j,1-_)};function generateStripe(a="1rem",_="rgba(255, 255, 255, 0.15)"){return{backgroundImage:`linear-gradient( - 45deg, - ${_} 25%, - transparent 25%, - transparent 50%, - ${_} 50%, - ${_} 75%, - transparent 75%, - transparent - )`,backgroundSize:`${a} ${a}`}}var randomHex=()=>`#${Math.floor(Math.random()*16777215).toString(16).padEnd(6,"0")}`;function randomColor(a){const _=randomHex();return!a||isEmptyObject$1(a)?_:a.string&&a.colors?randomColorFromList(a.string,a.colors):a.string&&!a.colors?randomColorFromString(a.string):a.colors&&!a.string?randomFromList(a.colors):_}function randomColorFromString(a){let _=0;if(a.length===0)return _.toString();for(let j=0;j>j*8&255;$+=`00${et.toString(16)}`.substr(-2)}return $}function randomColorFromList(a,_){let $=0;if(a.length===0)return _[0];for(let j=0;j$.colorMode==="dark"?_:a}function orient(a){const{orientation:_,vertical:$,horizontal:j}=a;return _?_==="vertical"?$:j:{}}function toRef(a){return isObject$5(a)&&a.reference?a.reference:String(a)}var toExpr=(a,..._)=>_.map(toRef).join(` ${a} `).replace(/calc/g,""),add=(...a)=>`calc(${toExpr("+",...a)})`,subtract=(...a)=>`calc(${toExpr("-",...a)})`,multiply=(...a)=>`calc(${toExpr("*",...a)})`,divide=(...a)=>`calc(${toExpr("/",...a)})`,negate=a=>{const _=toRef(a);return _!=null&&!Number.isNaN(parseFloat(_))?String(_).startsWith("-")?String(_).slice(1):`-${_}`:multiply(_,-1)},calc=Object.assign(a=>({add:(..._)=>calc(add(a,..._)),subtract:(..._)=>calc(subtract(a,..._)),multiply:(..._)=>calc(multiply(a,..._)),divide:(..._)=>calc(divide(a,..._)),negate:()=>calc(negate(a)),toString:()=>a.toString()}),{add,subtract,multiply,divide,negate});function isDecimal$1(a){return!Number.isInteger(parseFloat(a.toString()))}function replaceWhiteSpace(a,_="-"){return a.replace(/\s+/g,_)}function escape$1(a){const _=replaceWhiteSpace(a.toString());return _.includes("\\.")?a:isDecimal$1(a)?_.replace(".","\\."):a}function addPrefix(a,_=""){return[_,escape$1(a)].filter(Boolean).join("-")}function toVarRef(a,_){return`var(${escape$1(a)}${_?`, ${_}`:""})`}function toVar$1(a,_=""){return`--${addPrefix(a,_)}`}function cssVar(a,_){const $=toVar$1(a,void 0);return{variable:$,reference:toVarRef($,getFallback(void 0))}}function getFallback(a){return typeof a=="string"?a:a==null?void 0:a.reference}var{defineMultiStyleConfig:defineMultiStyleConfig$v,definePartsStyle:definePartsStyle$v}=createMultiStyleConfigHelpers(switchAnatomy.keys),$width=cssVar("switch-track-width"),$height$1=cssVar("switch-track-height"),$diff=cssVar("switch-track-diff"),diffValue=calc.subtract($width,$height$1),$translateX=cssVar("switch-thumb-x"),$bg$f=cssVar("switch-bg"),baseStyleTrack$2=a=>{const{colorScheme:_}=a;return{borderRadius:"full",p:"0.5",width:[$width.reference],height:[$height$1.reference],transitionProperty:"common",transitionDuration:"fast",[$bg$f.variable]:"colors.gray.300",_dark:{[$bg$f.variable]:"colors.whiteAlpha.400"},_focusVisible:{boxShadow:"outline"},_disabled:{opacity:.4,cursor:"not-allowed"},_checked:{[$bg$f.variable]:`colors.${_}.500`,_dark:{[$bg$f.variable]:`colors.${_}.200`}},bg:$bg$f.reference}},baseStyleThumb$1={bg:"white",transitionProperty:"transform",transitionDuration:"normal",borderRadius:"inherit",width:[$height$1.reference],height:[$height$1.reference],_checked:{transform:`translateX(${$translateX.reference})`}},baseStyle$I=definePartsStyle$v(a=>({container:{[$diff.variable]:diffValue,[$translateX.variable]:$diff.reference,_rtl:{[$translateX.variable]:calc($diff).negate().toString()}},track:baseStyleTrack$2(a),thumb:baseStyleThumb$1})),sizes$n={sm:definePartsStyle$v({container:{[$width.variable]:"1.375rem",[$height$1.variable]:"sizes.3"}}),md:definePartsStyle$v({container:{[$width.variable]:"1.875rem",[$height$1.variable]:"sizes.4"}}),lg:definePartsStyle$v({container:{[$width.variable]:"2.875rem",[$height$1.variable]:"sizes.6"}})},switchTheme$1=defineMultiStyleConfig$v({baseStyle:baseStyle$I,sizes:sizes$n,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:defineMultiStyleConfig$u,definePartsStyle:definePartsStyle$u}=createMultiStyleConfigHelpers(tableAnatomy.keys),baseStyle$H=definePartsStyle$u({table:{fontVariantNumeric:"lining-nums tabular-nums",borderCollapse:"collapse",width:"full"},th:{fontFamily:"heading",fontWeight:"bold",textTransform:"uppercase",letterSpacing:"wider",textAlign:"start"},td:{textAlign:"start"},caption:{mt:4,fontFamily:"heading",textAlign:"center",fontWeight:"medium"}}),numericStyles={"&[data-is-numeric=true]":{textAlign:"end"}},variantSimple=definePartsStyle$u(a=>{const{colorScheme:_}=a;return{th:{color:mode("gray.600","gray.400")(a),borderBottom:"1px",borderColor:mode(`${_}.100`,`${_}.700`)(a),...numericStyles},td:{borderBottom:"1px",borderColor:mode(`${_}.100`,`${_}.700`)(a),...numericStyles},caption:{color:mode("gray.600","gray.100")(a)},tfoot:{tr:{"&:last-of-type":{th:{borderBottomWidth:0}}}}}}),variantStripe=definePartsStyle$u(a=>{const{colorScheme:_}=a;return{th:{color:mode("gray.600","gray.400")(a),borderBottom:"1px",borderColor:mode(`${_}.100`,`${_}.700`)(a),...numericStyles},td:{borderBottom:"1px",borderColor:mode(`${_}.100`,`${_}.700`)(a),...numericStyles},caption:{color:mode("gray.600","gray.100")(a)},tbody:{tr:{"&:nth-of-type(odd)":{"th, td":{borderBottomWidth:"1px",borderColor:mode(`${_}.100`,`${_}.700`)(a)},td:{background:mode(`${_}.100`,`${_}.700`)(a)}}}},tfoot:{tr:{"&:last-of-type":{th:{borderBottomWidth:0}}}}}}),variants$g={simple:variantSimple,striped:variantStripe,unstyled:{}},sizes$m={sm:definePartsStyle$u({th:{px:"4",py:"1",lineHeight:"4",fontSize:"xs"},td:{px:"4",py:"2",fontSize:"sm",lineHeight:"4"},caption:{px:"4",py:"2",fontSize:"xs"}}),md:definePartsStyle$u({th:{px:"6",py:"3",lineHeight:"4",fontSize:"xs"},td:{px:"6",py:"4",lineHeight:"5"},caption:{px:"6",py:"2",fontSize:"sm"}}),lg:definePartsStyle$u({th:{px:"8",py:"4",lineHeight:"5",fontSize:"sm"},td:{px:"8",py:"5",lineHeight:"6"},caption:{px:"6",py:"2",fontSize:"md"}})},tableTheme=defineMultiStyleConfig$u({baseStyle:baseStyle$H,variants:variants$g,sizes:sizes$m,defaultProps:{variant:"simple",size:"md",colorScheme:"gray"}}),$fg$5=cssVar$1("tabs-color"),$bg$e=cssVar$1("tabs-bg"),$border$3=cssVar$1("tabs-border-color"),{defineMultiStyleConfig:defineMultiStyleConfig$t,definePartsStyle:definePartsStyle$t}=createMultiStyleConfigHelpers(tabsAnatomy.keys),baseStyleRoot$1=a=>{const{orientation:_}=a;return{display:_==="vertical"?"flex":"block"}},baseStyleTab=a=>{const{isFitted:_}=a;return{flex:_?1:void 0,transitionProperty:"common",transitionDuration:"normal",_focusVisible:{zIndex:1,boxShadow:"outline"},_disabled:{cursor:"not-allowed",opacity:.4}}},baseStyleTablist=a=>{const{align:_="start",orientation:$}=a;return{justifyContent:{end:"flex-end",center:"center",start:"flex-start"}[_],flexDirection:$==="vertical"?"column":"row"}},baseStyleTabpanel={p:4},baseStyle$G=definePartsStyle$t(a=>({root:baseStyleRoot$1(a),tab:baseStyleTab(a),tablist:baseStyleTablist(a),tabpanel:baseStyleTabpanel})),sizes$l={sm:definePartsStyle$t({tab:{py:1,px:4,fontSize:"sm"}}),md:definePartsStyle$t({tab:{fontSize:"md",py:2,px:4}}),lg:definePartsStyle$t({tab:{fontSize:"lg",py:3,px:4}})},variantLine=definePartsStyle$t(a=>{const{colorScheme:_,orientation:$}=a,j=$==="vertical",et=j?"borderStart":"borderBottom",tt=j?"marginStart":"marginBottom";return{tablist:{[et]:"2px solid",borderColor:"inherit"},tab:{[et]:"2px solid",borderColor:"transparent",[tt]:"-2px",_selected:{[$fg$5.variable]:`colors.${_}.600`,_dark:{[$fg$5.variable]:`colors.${_}.300`},borderColor:"currentColor"},_active:{[$bg$e.variable]:"colors.gray.200",_dark:{[$bg$e.variable]:"colors.whiteAlpha.300"}},_disabled:{_active:{bg:"none"}},color:$fg$5.reference,bg:$bg$e.reference}}}),variantEnclosed=definePartsStyle$t(a=>{const{colorScheme:_}=a;return{tab:{borderTopRadius:"md",border:"1px solid",borderColor:"transparent",mb:"-1px",[$border$3.variable]:"transparent",_selected:{[$fg$5.variable]:`colors.${_}.600`,[$border$3.variable]:"colors.white",_dark:{[$fg$5.variable]:`colors.${_}.300`,[$border$3.variable]:"colors.gray.800"},borderColor:"inherit",borderBottomColor:$border$3.reference},color:$fg$5.reference},tablist:{mb:"-1px",borderBottom:"1px solid",borderColor:"inherit"}}}),variantEnclosedColored=definePartsStyle$t(a=>{const{colorScheme:_}=a;return{tab:{border:"1px solid",borderColor:"inherit",[$bg$e.variable]:"colors.gray.50",_dark:{[$bg$e.variable]:"colors.whiteAlpha.50"},mb:"-1px",_notLast:{marginEnd:"-1px"},_selected:{[$bg$e.variable]:"colors.white",[$fg$5.variable]:`colors.${_}.600`,_dark:{[$bg$e.variable]:"colors.gray.800",[$fg$5.variable]:`colors.${_}.300`},borderColor:"inherit",borderTopColor:"currentColor",borderBottomColor:"transparent"},color:$fg$5.reference,bg:$bg$e.reference},tablist:{mb:"-1px",borderBottom:"1px solid",borderColor:"inherit"}}}),variantSoftRounded=definePartsStyle$t(a=>{const{colorScheme:_,theme:$}=a;return{tab:{borderRadius:"full",fontWeight:"semibold",color:"gray.600",_selected:{color:getColor($,`${_}.700`),bg:getColor($,`${_}.100`)}}}}),variantSolidRounded=definePartsStyle$t(a=>{const{colorScheme:_}=a;return{tab:{borderRadius:"full",fontWeight:"semibold",[$fg$5.variable]:"colors.gray.600",_dark:{[$fg$5.variable]:"inherit"},_selected:{[$fg$5.variable]:"colors.white",[$bg$e.variable]:`colors.${_}.600`,_dark:{[$fg$5.variable]:"colors.gray.800",[$bg$e.variable]:`colors.${_}.300`}},color:$fg$5.reference,bg:$bg$e.reference}}}),variantUnstyled$2=definePartsStyle$t({}),variants$f={line:variantLine,enclosed:variantEnclosed,"enclosed-colored":variantEnclosedColored,"soft-rounded":variantSoftRounded,"solid-rounded":variantSolidRounded,unstyled:variantUnstyled$2},tabsTheme$1=defineMultiStyleConfig$t({baseStyle:baseStyle$G,sizes:sizes$l,variants:variants$f,defaultProps:{size:"md",variant:"line",colorScheme:"blue"}}),vars=defineCssVars("badge",["bg","color","shadow"]),baseStyle$F={px:1,textTransform:"uppercase",fontSize:"xs",borderRadius:"sm",fontWeight:"bold",bg:vars.bg.reference,color:vars.color.reference,boxShadow:vars.shadow.reference},variantSolid$3=a=>{const{colorScheme:_,theme:$}=a,j=transparentize(`${_}.500`,.6)($);return{[vars.bg.variable]:`colors.${_}.500`,[vars.color.variable]:"colors.white",_dark:{[vars.bg.variable]:j,[vars.color.variable]:"colors.whiteAlpha.800"}}},variantSubtle$1=a=>{const{colorScheme:_,theme:$}=a,j=transparentize(`${_}.200`,.16)($);return{[vars.bg.variable]:`colors.${_}.100`,[vars.color.variable]:`colors.${_}.800`,_dark:{[vars.bg.variable]:j,[vars.color.variable]:`colors.${_}.200`}}},variantOutline$2=a=>{const{colorScheme:_,theme:$}=a,j=transparentize(`${_}.200`,.8)($);return{[vars.color.variable]:`colors.${_}.500`,_dark:{[vars.color.variable]:j},[vars.shadow.variable]:`inset 0 0 0px 1px ${vars.color.reference}`}},variants$e={solid:variantSolid$3,subtle:variantSubtle$1,outline:variantOutline$2},badgeTheme={baseStyle:baseStyle$F,variants:variants$e,defaultProps:{variant:"subtle",colorScheme:"gray"}},{defineMultiStyleConfig:defineMultiStyleConfig$s,definePartsStyle:definePartsStyle$s}=createMultiStyleConfigHelpers(tagAnatomy.keys),$bg$d=cssVar$1("tag-bg"),$color=cssVar$1("tag-color"),$shadow$3=cssVar$1("tag-shadow"),$minH=cssVar$1("tag-min-height"),$minW=cssVar$1("tag-min-width"),$fontSize$1=cssVar$1("tag-font-size"),$paddingX=cssVar$1("tag-padding-inline"),baseStyleContainer$4={fontWeight:"medium",lineHeight:1.2,outline:0,[$color.variable]:vars.color.reference,[$bg$d.variable]:vars.bg.reference,[$shadow$3.variable]:vars.shadow.reference,color:$color.reference,bg:$bg$d.reference,boxShadow:$shadow$3.reference,borderRadius:"md",minH:$minH.reference,minW:$minW.reference,fontSize:$fontSize$1.reference,px:$paddingX.reference,_focusVisible:{[$shadow$3.variable]:"shadows.outline"}},baseStyleLabel$4={lineHeight:1.2,overflow:"visible"},baseStyleCloseButton$3={fontSize:"lg",w:"5",h:"5",transitionProperty:"common",transitionDuration:"normal",borderRadius:"full",marginStart:"1.5",marginEnd:"-1",opacity:.5,_disabled:{opacity:.4},_focusVisible:{boxShadow:"outline",bg:"rgba(0, 0, 0, 0.14)"},_hover:{opacity:.8},_active:{opacity:1}},baseStyle$E=definePartsStyle$s({container:baseStyleContainer$4,label:baseStyleLabel$4,closeButton:baseStyleCloseButton$3}),sizes$k={sm:definePartsStyle$s({container:{[$minH.variable]:"sizes.5",[$minW.variable]:"sizes.5",[$fontSize$1.variable]:"fontSizes.xs",[$paddingX.variable]:"space.2"},closeButton:{marginEnd:"-2px",marginStart:"0.35rem"}}),md:definePartsStyle$s({container:{[$minH.variable]:"sizes.6",[$minW.variable]:"sizes.6",[$fontSize$1.variable]:"fontSizes.sm",[$paddingX.variable]:"space.2"}}),lg:definePartsStyle$s({container:{[$minH.variable]:"sizes.8",[$minW.variable]:"sizes.8",[$fontSize$1.variable]:"fontSizes.md",[$paddingX.variable]:"space.3"}})},variants$d={subtle:definePartsStyle$s(a=>{var _;return{container:(_=badgeTheme.variants)==null?void 0:_.subtle(a)}}),solid:definePartsStyle$s(a=>{var _;return{container:(_=badgeTheme.variants)==null?void 0:_.solid(a)}}),outline:definePartsStyle$s(a=>{var _;return{container:(_=badgeTheme.variants)==null?void 0:_.outline(a)}})},tagTheme=defineMultiStyleConfig$s({variants:variants$d,baseStyle:baseStyle$E,sizes:sizes$k,defaultProps:{size:"md",variant:"subtle",colorScheme:"gray"}}),{definePartsStyle:definePartsStyle$r,defineMultiStyleConfig:defineMultiStyleConfig$r}=createMultiStyleConfigHelpers(inputAnatomy.keys),$height=cssVar$1("input-height"),$fontSize=cssVar$1("input-font-size"),$padding$1=cssVar$1("input-padding"),$borderRadius=cssVar$1("input-border-radius"),baseStyle$D=definePartsStyle$r({addon:{height:$height.reference,fontSize:$fontSize.reference,px:$padding$1.reference,borderRadius:$borderRadius.reference},field:{width:"100%",height:$height.reference,fontSize:$fontSize.reference,px:$padding$1.reference,borderRadius:$borderRadius.reference,minWidth:0,outline:0,position:"relative",appearance:"none",transitionProperty:"common",transitionDuration:"normal",_disabled:{opacity:.4,cursor:"not-allowed"}}}),size={lg:{[$fontSize.variable]:"fontSizes.lg",[$padding$1.variable]:"space.4",[$borderRadius.variable]:"radii.md",[$height.variable]:"sizes.12"},md:{[$fontSize.variable]:"fontSizes.md",[$padding$1.variable]:"space.4",[$borderRadius.variable]:"radii.md",[$height.variable]:"sizes.10"},sm:{[$fontSize.variable]:"fontSizes.sm",[$padding$1.variable]:"space.3",[$borderRadius.variable]:"radii.sm",[$height.variable]:"sizes.8"},xs:{[$fontSize.variable]:"fontSizes.xs",[$padding$1.variable]:"space.2",[$borderRadius.variable]:"radii.sm",[$height.variable]:"sizes.6"}},sizes$j={lg:definePartsStyle$r({field:size.lg,group:size.lg}),md:definePartsStyle$r({field:size.md,group:size.md}),sm:definePartsStyle$r({field:size.sm,group:size.sm}),xs:definePartsStyle$r({field:size.xs,group:size.xs})};function getDefaults(a){const{focusBorderColor:_,errorBorderColor:$}=a;return{focusBorderColor:_||mode("blue.500","blue.300")(a),errorBorderColor:$||mode("red.500","red.300")(a)}}var variantOutline$1=definePartsStyle$r(a=>{const{theme:_}=a,{focusBorderColor:$,errorBorderColor:j}=getDefaults(a);return{field:{border:"1px solid",borderColor:"inherit",bg:"inherit",_hover:{borderColor:mode("gray.300","whiteAlpha.400")(a)},_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:getColor(_,j),boxShadow:`0 0 0 1px ${getColor(_,j)}`},_focusVisible:{zIndex:1,borderColor:getColor(_,$),boxShadow:`0 0 0 1px ${getColor(_,$)}`}},addon:{border:"1px solid",borderColor:mode("inherit","whiteAlpha.50")(a),bg:mode("gray.100","whiteAlpha.300")(a)}}}),variantFilled=definePartsStyle$r(a=>{const{theme:_}=a,{focusBorderColor:$,errorBorderColor:j}=getDefaults(a);return{field:{border:"2px solid",borderColor:"transparent",bg:mode("gray.100","whiteAlpha.50")(a),_hover:{bg:mode("gray.200","whiteAlpha.100")(a)},_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:getColor(_,j)},_focusVisible:{bg:"transparent",borderColor:getColor(_,$)}},addon:{border:"2px solid",borderColor:"transparent",bg:mode("gray.100","whiteAlpha.50")(a)}}}),variantFlushed=definePartsStyle$r(a=>{const{theme:_}=a,{focusBorderColor:$,errorBorderColor:j}=getDefaults(a);return{field:{borderBottom:"1px solid",borderColor:"inherit",borderRadius:"0",px:"0",bg:"transparent",_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:getColor(_,j),boxShadow:`0px 1px 0px 0px ${getColor(_,j)}`},_focusVisible:{borderColor:getColor(_,$),boxShadow:`0px 1px 0px 0px ${getColor(_,$)}`}},addon:{borderBottom:"2px solid",borderColor:"inherit",borderRadius:"0",px:"0",bg:"transparent"}}}),variantUnstyled$1=definePartsStyle$r({field:{bg:"transparent",px:"0",height:"auto"},addon:{bg:"transparent",px:"0",height:"auto"}}),variants$c={outline:variantOutline$1,filled:variantFilled,flushed:variantFlushed,unstyled:variantUnstyled$1},inputTheme=defineMultiStyleConfig$r({baseStyle:baseStyle$D,sizes:sizes$j,variants:variants$c,defaultProps:{size:"md",variant:"outline"}}),_a$7,baseStyle$C={...(_a$7=inputTheme.baseStyle)==null?void 0:_a$7.field,paddingY:"2",minHeight:"20",lineHeight:"short",verticalAlign:"top"},_a2$2,_b$2,variants$b={outline:a=>{var _,$;return($=(_=inputTheme.variants)==null?void 0:_.outline(a).field)!=null?$:{}},flushed:a=>{var _,$;return($=(_=inputTheme.variants)==null?void 0:_.flushed(a).field)!=null?$:{}},filled:a=>{var _,$;return($=(_=inputTheme.variants)==null?void 0:_.filled(a).field)!=null?$:{}},unstyled:(_b$2=(_a2$2=inputTheme.variants)==null?void 0:_a2$2.unstyled.field)!=null?_b$2:{}},_a3,_b2,_c$1,_d$1,_e$1,_f$1,_g$1,_h$1,sizes$i={xs:(_b2=(_a3=inputTheme.sizes)==null?void 0:_a3.xs.field)!=null?_b2:{},sm:(_d$1=(_c$1=inputTheme.sizes)==null?void 0:_c$1.sm.field)!=null?_d$1:{},md:(_f$1=(_e$1=inputTheme.sizes)==null?void 0:_e$1.md.field)!=null?_f$1:{},lg:(_h$1=(_g$1=inputTheme.sizes)==null?void 0:_g$1.lg.field)!=null?_h$1:{}},textareaTheme={baseStyle:baseStyle$C,sizes:sizes$i,variants:variants$b,defaultProps:{size:"md",variant:"outline"}},$bg$c=cssVar("tooltip-bg"),$fg$4=cssVar("tooltip-fg"),$arrowBg$1=cssVar("popper-arrow-bg"),baseStyle$B={bg:$bg$c.reference,color:$fg$4.reference,[$bg$c.variable]:"colors.gray.700",[$fg$4.variable]:"colors.whiteAlpha.900",_dark:{[$bg$c.variable]:"colors.gray.300",[$fg$4.variable]:"colors.gray.900"},[$arrowBg$1.variable]:$bg$c.reference,px:"2",py:"0.5",borderRadius:"sm",fontWeight:"medium",fontSize:"sm",boxShadow:"md",maxW:"xs",zIndex:"tooltip"},tooltipTheme={baseStyle:baseStyle$B},{defineMultiStyleConfig:defineMultiStyleConfig$q,definePartsStyle:definePartsStyle$q}=createMultiStyleConfigHelpers(progressAnatomy.keys),filledStyle=a=>{const{colorScheme:_,theme:$,isIndeterminate:j,hasStripe:et}=a,tt=mode(generateStripe(),generateStripe("1rem","rgba(0,0,0,0.1)"))(a),rt=mode(`${_}.500`,`${_}.200`)(a),nt=`linear-gradient( - to right, - 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=a=>({bg:mode("gray.100","whiteAlpha.300")(a)}),baseStyleFilledTrack$1=a=>({transitionProperty:"common",transitionDuration:"slow",...filledStyle(a)}),baseStyle$A=definePartsStyle$q(a=>({label:baseStyleLabel$3,filledTrack:baseStyleFilledTrack$1(a),track:baseStyleTrack$1(a)})),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=a=>typeof a=="function";function runIfFn$1(a,..._){return isFunction$7(a)?a(..._):a}var{definePartsStyle:definePartsStyle$p,defineMultiStyleConfig:defineMultiStyleConfig$p}=createMultiStyleConfigHelpers(checkboxAnatomy.keys),$size$3=cssVar$1("checkbox-size"),baseStyleControl$1=a=>{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(`${_}.500`,`${_}.200`)(a),borderColor:mode(`${_}.500`,`${_}.200`)(a),color:mode("white","gray.900")(a),_hover:{bg:mode(`${_}.600`,`${_}.300`)(a),borderColor:mode(`${_}.600`,`${_}.300`)(a)},_disabled:{borderColor:mode("gray.200","transparent")(a),bg:mode("gray.200","whiteAlpha.300")(a),color:mode("gray.500","whiteAlpha.500")(a)}},_indeterminate:{bg:mode(`${_}.500`,`${_}.200`)(a),borderColor:mode(`${_}.500`,`${_}.200`)(a),color:mode("white","gray.900")(a)},_disabled:{bg:mode("gray.100","whiteAlpha.100")(a),borderColor:mode("gray.100","transparent")(a)},_focusVisible:{boxShadow:"outline"},_invalid:{borderColor:mode("red.500","red.300")(a)}}},baseStyleContainer$3={_disabled:{cursor:"not-allowed"}},baseStyleLabel$2={userSelect:"none",_disabled:{opacity:.4}},baseStyleIcon$6={transitionProperty:"transform",transitionDuration:"normal"},baseStyle$z=definePartsStyle$p(a=>({icon:baseStyleIcon$6,container:baseStyleContainer$3,control:runIfFn$1(baseStyleControl$1,a),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=a=>{var _;const $=(_=runIfFn$1(checkboxTheme$1.baseStyle,a))==null?void 0:_.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(a=>{var _,$,j,et;return{label:($=(_=checkboxTheme$1).baseStyle)==null?void 0:$.call(_,a).label,container:(et=(j=checkboxTheme$1).baseStyle)==null?void 0:et.call(j,a).container,control:baseStyleControl(a)}}),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=a=>{const{orientation:_}=a;return{display:"inline-block",position:"relative",cursor:"pointer",_disabled:{opacity:.6,cursor:"default",pointerEvents:"none"},...orient({orientation:_,vertical:{h:"100%"},horizontal:{w:"100%"}})}},baseStyleTrack=a=>({...orient({orientation:a.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=a=>{const{orientation:_}=a;return{...orient({orientation:_,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=a=>{const{colorScheme:_}=a;return{width:"inherit",height:"inherit",[$bg$9.variable]:`colors.${_}.500`,_dark:{[$bg$9.variable]:`colors.${_}.200`},bg:$bg$9.reference}},baseStyle$u=definePartsStyle$m(a=>({container:baseStyleContainer$2(a),track:baseStyleTrack(a),thumb:baseStyleThumb(a),filledTrack:baseStyleFilledTrack(a)})),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=a=>{const{isCentered:_,scrollBehavior:$}=a;return{display:"flex",zIndex:"modal",justifyContent:"center",alignItems:_?"center":"flex-start",overflow:$==="inside"?"hidden":"auto",overscrollBehaviorY:"none"}},baseStyleDialog$1=a=>{const{isCentered:_,scrollBehavior:$}=a;return{borderRadius:"md",color:"inherit",my:_?"auto":"16",mx:_?"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=a=>{const{scrollBehavior:_}=a;return{px:"6",py:"2",flex:"1",overflow:_==="inside"?"auto":void 0}},baseStyleFooter$2={px:"6",py:"4"},baseStyle$n=definePartsStyle$i(a=>({overlay:baseStyleOverlay$1,dialogContainer:runIfFn$1(baseStyleDialogContainer$1,a),dialog:runIfFn$1(baseStyleDialog$1,a),header:baseStyleHeader$2,closeButton:baseStyleCloseButton$2,body:runIfFn$1(baseStyleBody$2,a),footer:baseStyleFooter$2}));function getSize$3(a){return definePartsStyle$i(a==="full"?{dialog:{maxW:"100vw",minH:"$100vh",my:"0",borderRadius:"0"}}:{dialog:{maxW:a}})}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=a=>{var _,$;return($=(_=runIfFn$1(inputTheme.baseStyle,a))==null?void 0:_.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(a=>{var _;return{root:baseStyleRoot,field:(_=runIfFn$1(baseStyleField,a))!=null?_:{},stepperGroup:baseStyleStepperGroup,stepper:baseStyleStepper}});function getSize$2(a){var _,$,j;const et=(_=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[a]},_last:{borderBottomEndRadius:tt[a],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:a=>{var _,$,j;return(j=($=runIfFn$1((_=inputTheme.variants)==null?void 0:_.outline,a))==null?void 0:$.field)!=null?j:{}},flushed:a=>{var _,$,j;return(j=($=runIfFn$1((_=inputTheme.variants)==null?void 0:_.flushed,a))==null?void 0:$.field)!=null?j:{}},filled:a=>{var _,$,j;return(j=($=runIfFn$1((_=inputTheme.variants)==null?void 0:_.filled,a))==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(a){return definePartsStyle$f(a==="full"?{dialog:{maxW:"100vw",h:"100vh"}}:{dialog:{maxW:a}})}var baseStyleOverlay={bg:"blackAlpha.600",zIndex:"modal"},baseStyleDialogContainer={display:"flex",zIndex:"modal",justifyContent:"center"},baseStyleDialog=a=>{const{isFullHeight:_}=a;return{..._&&{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(a=>({overlay:baseStyleOverlay,dialogContainer:baseStyleDialogContainer,dialog:runIfFn$1(baseStyleDialog,a),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=a=>{const{colorScheme:_,theme:$}=a;if(_==="gray")return{color:mode("gray.800","whiteAlpha.900")(a),_hover:{bg:mode("gray.100","whiteAlpha.200")(a)},_active:{bg:mode("gray.200","whiteAlpha.300")(a)}};const j=transparentize(`${_}.200`,.12)($),et=transparentize(`${_}.200`,.24)($);return{color:mode(`${_}.600`,`${_}.200`)(a),bg:"transparent",_hover:{bg:mode(`${_}.50`,j)(a)},_active:{bg:mode(`${_}.100`,et)(a)}}},variantOutline=a=>{const{colorScheme:_}=a,$=mode("gray.200","whiteAlpha.300")(a);return{border:"1px solid",borderColor:_==="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,a)}},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=a=>{var _;const{colorScheme:$}=a;if($==="gray"){const it=mode("gray.100","whiteAlpha.200")(a);return{bg:it,color:mode("gray.800","whiteAlpha.900")(a),_hover:{bg:mode("gray.200","whiteAlpha.300")(a),_disabled:{bg:it}},_active:{bg:mode("gray.300","whiteAlpha.400")(a)}}}const{bg:j=`${$}.500`,color:et="white",hoverBg:tt=`${$}.600`,activeBg:rt=`${$}.700`}=(_=accessibleColorMap[$])!=null?_:{},nt=mode(j,`${$}.200`)(a);return{bg:nt,color:mode(et,"gray.800")(a),_hover:{bg:mode(tt,`${$}.300`)(a),_disabled:{bg:nt}},_active:{bg:mode(rt,`${$}.400`)(a)}}},variantLink=a=>{const{colorScheme:_}=a;return{padding:0,height:"auto",lineHeight:"normal",verticalAlign:"baseline",color:mode(`${_}.500`,`${_}.200`)(a),_hover:{textDecoration:"underline",_disabled:{textDecoration:"none"}},_active:{color:mode(`${_}.700`,`${_}.500`)(a)}}},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(a){const{theme:_,colorScheme:$}=a,j=transparentize(`${$}.200`,.16)(_);return{light:`colors.${$}.100`,dark:j}}var variantSubtle=definePartsStyle$8(a=>{const{colorScheme:_}=a,$=getBg(a);return{container:{[$fg.variable]:`colors.${_}.600`,[$bg$1.variable]:$.light,_dark:{[$fg.variable]:`colors.${_}.200`,[$bg$1.variable]:$.dark}}}}),variantLeftAccent=definePartsStyle$8(a=>{const{colorScheme:_}=a,$=getBg(a);return{container:{[$fg.variable]:`colors.${_}.600`,[$bg$1.variable]:$.light,_dark:{[$fg.variable]:`colors.${_}.200`,[$bg$1.variable]:$.dark},paddingStart:"3",borderStartWidth:"4px",borderStartColor:$fg.reference}}}),variantTopAccent=definePartsStyle$8(a=>{const{colorScheme:_}=a,$=getBg(a);return{container:{[$fg.variable]:`colors.${_}.600`,[$bg$1.variable]:$.light,_dark:{[$fg.variable]:`colors.${_}.200`,[$bg$1.variable]:$.dark},pt:"2",borderTopWidth:"4px",borderTopColor:$fg.reference}}}),variantSolid=definePartsStyle$8(a=>{const{colorScheme:_}=a;return{container:{[$fg.variable]:"colors.white",[$bg$1.variable]:`colors.${_}.600`,_dark:{[$fg.variable]:"colors.gray.900",[$bg$1.variable]:`colors.${_}.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=a=>{const{name:_,theme:$}=a,j=_?randomColor({string:_}):"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(a=>({badge:runIfFn$1(baseStyleBadge,a),excessLabel:runIfFn$1(baseStyleExcessLabel,a),container:runIfFn$1(baseStyleContainer,a),label:baseStyleLabel}));function getSize(a){const _=a!=="100%"?sizes_default[a]: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(a){return typeof a=="function"}function pipe$2(...a){return _=>a.reduce(($,j)=>j($),_)}var createExtendTheme=a=>function(...$){let j=[...$],et=$[$.length-1];return isChakraTheme(et)&&j.length>1?j=j.slice(0,j.length-1):et=a,pipe$2(...j.map(tt=>rt=>isFunction$6(tt)?tt(rt):mergeThemeOverride(rt,tt)))(et)},extendTheme=createExtendTheme(theme$1);function mergeThemeOverride(...a){return mergeWith({},...a,mergeThemeCustomizer)}function mergeThemeCustomizer(a,_,$,j){if((isFunction$6(a)||isFunction$6(_))&&Object.prototype.hasOwnProperty.call(j,$))return(...et)=>{const tt=isFunction$6(a)?a(...et):a,rt=isFunction$6(_)?_(...et):_;return mergeWith({},tt,rt,mergeThemeCustomizer)}}function isElement$4(a){return a!=null&&typeof a=="object"&&"nodeType"in a&&a.nodeType===Node.ELEMENT_NODE}function getOwnerDocument$3(a){var _;return isElement$4(a)&&(_=a.ownerDocument)!=null?_: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(a).forEach(j=>{_.includes(j)||($[j]=a[j])}),$}function get$3(a,_,$,j){const et=typeof _=="string"?_.split("."):[_];for(j=0;j{const _=new WeakMap;return(j,et,tt,rt)=>{if(typeof j>"u")return a(j,et,tt);_.has(j)||_.set(j,new Map);const nt=_.get(j);if(nt.has(et))return nt.get(et);const it=a(j,et,tt,rt);return nt.set(et,it),it}},memoizedGet=memoize(get$3);function objectFilter(a,_){const $={};return Object.keys(a).forEach(j=>{const et=a[j];_(et,j,a)&&($[j]=et)}),$}var filterUndefined=a=>objectFilter(a,_=>_!=null);function isFunction$5(a){return typeof a=="function"}function runIfFn(a,..._){return isFunction$5(a)?a(..._):a}function callAllHandlers(...a){return function($){a.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 a=="object"&&typeof _=="object"){if(a.constructor!==_.constructor)return!1;var $,j,et;if(Array.isArray(a)){if($=a.length,$!=_.length)return!1;for(j=$;j--!==0;)if(!equal$1(a[j],_[j]))return!1;return!0}var tt;if(hasMap&&a instanceof Map&&_ instanceof Map){if(a.size!==_.size)return!1;for(tt=a.entries();!(j=tt.next()).done;)if(!_.has(j.value[0]))return!1;for(tt=a.entries();!(j=tt.next()).done;)if(!equal$1(j.value[1],_.get(j.value[0])))return!1;return!0}if(hasSet&&a instanceof Set&&_ instanceof Set){if(a.size!==_.size)return!1;for(tt=a.entries();!(j=tt.next()).done;)if(!_.has(j.value[0]))return!1;return!0}if(hasArrayBuffer&&ArrayBuffer.isView(a)&&ArrayBuffer.isView(_)){if($=a.length,$!=_.length)return!1;for(j=$;j--!==0;)if(a[j]!==_[j])return!1;return!0}if(a.constructor===RegExp)return a.source===_.source&&a.flags===_.flags;if(a.valueOf!==Object.prototype.valueOf&&typeof a.valueOf=="function"&&typeof _.valueOf=="function")return a.valueOf()===_.valueOf();if(a.toString!==Object.prototype.toString&&typeof a.toString=="function"&&typeof _.toString=="function")return a.toString()===_.toString();if(et=Object.keys(a),$=et.length,$!==Object.keys(_).length)return!1;for(j=$;j--!==0;)if(!Object.prototype.hasOwnProperty.call(_,et[j]))return!1;if(hasElementType&&a instanceof Element)return!1;for(j=$;j--!==0;)if(!((et[j]==="_owner"||et[j]==="__v"||et[j]==="__o")&&a.$$typeof)&&!equal$1(a[et[j]],_[et[j]]))return!1;return!0}return a!==a&&_!==_}var reactFastCompare=function(_,$){try{return equal$1(_,$)}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}=_,{theme:tt,colorMode:rt}=useChakra(),nt=a?memoizedGet(tt,`components.${a}`):void 0,it=j||nt,st=mergeWith({theme:tt,colorMode:rt},($=it==null?void 0:it.defaultProps)!=null?$:{},filterUndefined(omit$5(et,["children"]))),ot=reactExports.useRef({});if(it){const ut=resolveStyleConfig(it)(st);isEqual$2(ot.current,ut)||(ot.current=ut)}return ot.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(a){return validHTMLProps.has(a)||!allPropNames.has(a)}function assignAfter(a,..._){if(a==null)throw new TypeError("Cannot convert undefined or null to object");const $={...a};for(const j of _)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(a){const _=Object.assign({},a);for(let $ in _)_[$]===void 0&&delete _[$];return _}function _extends$6(){return _extends$6=Object.assign?Object.assign.bind():function(a){for(var _=1;_96?testOmitPropsOnStringTag:testOmitPropsOnComponent},composeShouldForwardProps=function(_,$,j){var et;if($){var tt=$.shouldForwardProp;et=_.__emotion_forwardProp&&tt?function(rt){return _.__emotion_forwardProp(rt)&&tt(rt)}:tt}return typeof et!="function"&&j&&(et=_.__emotion_forwardProp),et},Insertion=function(_){var $=_.cache,j=_.serialized,et=_.isStringTag;return registerStyles($,j,et),useInsertionEffectAlwaysWithSyncFallback(function(){return insertStyles($,j,et)}),null},createStyled=function a(_,$){var j=_.__emotion_real===_,et=j&&_.__emotion_base||_,tt,rt;$!==void 0&&(tt=$.label,rt=$.target);var nt=composeShouldForwardProps(_,$,j),it=nt||getDefaultShouldForwardProp(et),st=!it("as");return function(){var ot=arguments,at=j&&_.__emotion_styles!==void 0?_.__emotion_styles.slice(0):[];if(tt!==void 0&&at.push("label:"+tt+";"),ot[0]==null||ot[0].raw===void 0)at.push.apply(at,ot);else{at.push(ot[0][0]);for(var ut=ot.length,ht=1;ht_=>{const{theme:$,css:j,__css:et,sx:tt,...rt}=_,nt=objectFilter(rt,(at,ut)=>isStyleProp(ut)),it=runIfFn(a,_),st=assignAfter({},et,it,filterUndefined(nt),tt),ot=css(st)(_.theme);return j?[ot,j]:ot};function styled(a,_){const{baseStyle:$,...j}=_??{};j.shouldForwardProp||(j.shouldForwardProp=shouldForwardProp);const et=toCSSObject({baseStyle:$}),tt=emotion_styled(a,j)(et);return React$2.forwardRef(function(it,st){const{colorMode:ot,forced:at}=useColorMode();return React$2.createElement(tt,{ref:st,"data-theme":at?ot:void 0,...it})})}function factory(){const a=new Map;return new Proxy(styled,{apply(_,$,j){return styled(...j)},get(_,$){return a.has($)||a.set($,styled($)),a.get($)}})}var chakra=factory();function forwardRef(a){return reactExports.forwardRef(a)}function createContext(a={}){const{strict:_=!0,errorMessage:$="useContext: `context` is undefined. Seems you forgot to wrap component within the Provider",name:j}=a,et=reactExports.createContext(void 0);et.displayName=j;function tt(){var rt;const nt=reactExports.useContext(et);if(!nt&&_){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(a){const{cssVarsRoot:_,theme:$,children:j}=a,et=reactExports.useMemo(()=>toCSSVar($),[$]);return jsxRuntimeExports.jsxs(ThemeProvider$1,{theme:et,children:[jsxRuntimeExports.jsx(CSSVars,{root:_}),j]})}function CSSVars({root:a=":host, :root"}){const _=[a,"[data-theme]"].join(",");return jsxRuntimeExports.jsx(Global,{styles:$=>({[_]:$.__cssVars})})}createContext({name:"StylesContext",errorMessage:"useStyles: `styles` is undefined. Seems you forgot to wrap the components in `` "});function createStylesContext(a){return createContext({name:`${a}StylesContext`,errorMessage:`useStyles: "styles" is undefined. Seems you forgot to wrap the components in "<${a} />" `})}function GlobalStyle(){const{colorMode:a}=useColorMode();return jsxRuntimeExports.jsx(Global,{styles:_=>{const $=memoizedGet(_,"styles.global"),j=runIfFn($,{theme:_,colorMode:a});return j?css(j)(_):void 0}})}var EnvironmentContext=reactExports.createContext({getDocument(){return document},getWindow(){return window}});EnvironmentContext.displayName="EnvironmentContext";function useEnvironment({defer:a}={}){const[,_]=reactExports.useReducer($=>$+1,0);return useSafeLayoutEffect$2(()=>{a&&_()},[a]),reactExports.useContext(EnvironmentContext)}function EnvironmentProvider(a){const{children:_,environment:$,disabled:j}=a,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:[_,rt&&jsxRuntimeExports.jsx("span",{id:"__chakra_env",hidden:!0,ref:et})]})}EnvironmentProvider.displayName="EnvironmentProvider";var ChakraProvider$1=a=>{const{children:_,colorModeManager:$,portalZIndex:j,resetScope:et,resetCSS:tt=!0,theme:rt={},environment:nt,cssVarsRoot:it,disableEnvironment:st,disableGlobalStyle:ot}=a,at=jsxRuntimeExports.jsx(EnvironmentProvider,{environment:nt,disabled:st,children:_});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,{}),!ot&&jsxRuntimeExports.jsx(GlobalStyle,{}),j?jsxRuntimeExports.jsx(PortalManager,{zIndex:j,children:at}):at]})})},findById=(a,_)=>a.find($=>$.id===_);function findToast(a,_){const $=getToastPosition(a,_),j=$?a[$].findIndex(et=>et.id===_):-1;return{position:$,index:j}}function getToastPosition(a,_){for(const[$,j]of Object.entries(a))if(findById(j,_))return $}function getToastStyle(a){const _=a.includes("right"),$=a.includes("left");let j="center";return _&&(j="flex-end"),$&&(j="flex-start"),{display:"flex",flexDirection:"column",alignItems:j}}function getToastListStyle(a){const $=a==="top"||a==="bottom"?"0 auto":void 0,j=a.includes("top")?"env(safe-area-inset-top, 0px)":void 0,et=a.includes("bottom")?"env(safe-area-inset-bottom, 0px)":void 0,tt=a.includes("left")?void 0:"env(safe-area-inset-right, 0px)",rt=a.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(a);return reactExports.useEffect(()=>{$.current=a}),reactExports.useCallback((...j)=>{var et;return(et=$.current)==null?void 0:et.call($,...j)},_)}function useTimeout(a,_){const $=useCallbackRef$2(a);reactExports.useEffect(()=>{if(_==null)return;let j=null;return j=window.setTimeout(()=>{$()},_),()=>{j&&window.clearTimeout(j)}},[_,$])}function useUpdateEffect(a,_){const $=reactExports.useRef(!1),j=reactExports.useRef(!1);reactExports.useEffect(()=>{if($.current&&j.current)return a();j.current=!0},_),reactExports.useEffect(()=>($.current=!0,()=>{$.current=!1}),[])}const MotionConfigContext=reactExports.createContext({transformPagePoint:a=>a,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=a=>a.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(_){if(!this.scheduled.has(_))return this.scheduled.add(_),this.order.push(_),!0}remove(_){const $=this.order.indexOf(_);$!==-1&&(this.order.splice($,1),this.scheduled.delete(_))}clear(){this.order.length=0,this.scheduled.clear()}}function createRenderStep(a){let _=new Queue,$=new Queue,j=0,et=!1,tt=!1;const rt=new WeakSet,nt={schedule:(it,st=!1,ot=!1)=>{const at=ot&&et,ut=at?_:$;return st&&rt.add(it),ut.add(it)&&at&&et&&(j=_.order.length),it},cancel:it=>{$.remove(it),rt.delete(it)},process:it=>{if(et){tt=!0;return}if(et=!0,[_,$]=[$,_],$.clear(),j=_.order.length,j)for(let st=0;st(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,$&&_&&(j=!1,a(nt))},it=()=>{$=!0,j=!0,et.isProcessing||a(nt)};return{schedule:stepsOrder.reduce((at,ut)=>{const ht=tt[ut];return at[ut]=(yt,wt=!1,Ct=!1)=>($||it(),ht.schedule(yt,wt,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(a,{visualState:_,parent:et,props:$,presenceContext:rt,blockInitialAnimation:rt?rt.initial===!1:!1,reducedMotionConfig:nt}));const st=it.current;reactExports.useInsertionEffect(()=>{st&&st.update($,rt)});const ot=reactExports.useRef(!!($[optimizedAppearDataAttribute]&&!window.HandoffComplete));return useIsomorphicLayoutEffect$2(()=>{st&&(microtask.render(st.render),ot.current&&st.animationState&&st.animationState.animateChanges())}),reactExports.useEffect(()=>{st&&(st.updateFeatures(),!ot.current&&st.animationState&&st.animationState.animateChanges(),ot.current&&(ot.current=!1,window.HandoffComplete=!0))}),st}function isRefObject$2(a){return a&&typeof a=="object"&&Object.prototype.hasOwnProperty.call(a,"current")}function useMotionRef(a,_,$){return reactExports.useCallback(j=>{j&&a.mount&&a.mount(j),_&&(j?_.mount(j):_.unmount()),$&&(typeof $=="function"?$(j):isRefObject$2($)&&($.current=j))},[_])}function isVariantLabel(a){return typeof a=="string"||Array.isArray(a)}function isAnimationControls(a){return a!==null&&typeof a=="object"&&typeof a.start=="function"}const variantPriorityOrder=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],variantProps=["initial",...variantPriorityOrder];function isControllingVariants(a){return isAnimationControls(a.animate)||variantProps.some(_=>isVariantLabel(a[_]))}function isVariantNode(a){return!!(isControllingVariants(a)||a.variants)}function getCurrentTreeVariants(a,_){if(isControllingVariants(a)){const{initial:$,animate:j}=a;return{initial:$===!1||isVariantLabel($)?$:void 0,animate:isVariantLabel(j)?j:void 0}}return a.inherit!==!1?_:{}}function useCreateMotionContext(a){const{initial:_,animate:$}=getCurrentTreeVariants(a,reactExports.useContext(MotionContext));return reactExports.useMemo(()=>({initial:_,animate:$}),[variantLabelsAsDependency(_),variantLabelsAsDependency($)])}function variantLabelsAsDependency(a){return Array.isArray(a)?a.join(" "):a}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 a in featureProps)featureDefinitions[a]={isEnabled:_=>featureProps[a].some($=>!!_[$])};function loadFeatures(a){for(const _ in a)featureDefinitions[_]={...featureDefinitions[_],...a[_]}}const LayoutGroupContext=reactExports.createContext({}),SwitchLayoutGroupContext=reactExports.createContext({}),motionComponentSymbol=Symbol.for("motionComponentSymbol");function createMotionComponent({preloadedFeatures:a,createVisualElement:_,useRender:$,useVisualState:j,Component:et}){a&&loadFeatures(a);function tt(nt,it){let st;const ot={...reactExports.useContext(MotionConfigContext),...nt,layoutId:useLayoutId(nt)},{isStatic:at}=ot,ut=useCreateMotionContext(nt),ht=j(nt,at);if(!at&&isBrowser$1){ut.visualElement=useVisualElement(et,ht,ot,_);const yt=reactExports.useContext(SwitchLayoutGroupContext),wt=reactExports.useContext(LazyContext).strict;ut.visualElement&&(st=ut.visualElement.loadFeatures(ot,wt,a,yt))}return jsxRuntimeExports.jsxs(MotionContext.Provider,{value:ut,children:[st&&ut.visualElement?jsxRuntimeExports.jsx(st,{visualElement:ut.visualElement,...ot}):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:a}){const _=reactExports.useContext(LayoutGroupContext).id;return _&&a!==void 0?_+"-"+a:a}function createMotionProxy(a){function _(j,et={}){return createMotionComponent(a(j,et))}if(typeof Proxy>"u")return _;const $=new Map;return new Proxy(_,{get:(j,et)=>($.has(et)||$.set(et,_(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(a){return typeof a!="string"||a.includes("-")?!1:!!(lowercaseSVGElements.indexOf(a)>-1||/[A-Z]/u.test(a))}const scaleCorrectors={};function addScaleCorrector(a){Object.assign(scaleCorrectors,a)}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(a,{layout:_,layoutId:$}){return transformProps.has(a)||a.startsWith("origin")||(_||$!==void 0)&&(!!scaleCorrectors[a]||a==="opacity")}const isMotionValue=a=>!!(a&&a.getVelocity),translateAlias={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},numTransforms=transformPropOrder.length;function buildTransform(a,{enableHardwareAcceleration:_=!0,allowTransformNone:$=!0},j,et){let tt="";for(let rt=0;rt_=>typeof _=="string"&&_.startsWith(a),isCSSVariableName=checkStringStartsWith("--"),startsAsVariableToken=checkStringStartsWith("var(--"),isCSSVariableToken=a=>startsAsVariableToken(a)?singleCssVariableRegex.test(a.split("/*")[0].trim()):!1,singleCssVariableRegex=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,getValueAsType=(a,_)=>_&&typeof a=="number"?_.transform(a):a,clamp=(a,_,$)=>$>_?_:$typeof a=="number",parse:parseFloat,transform:a=>a},alpha={...number$2,transform:a=>clamp(0,1,a)},scale$1={...number$2,default:1},sanitize=a=>Math.round(a*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(a){return typeof a=="string"}const createUnitType=a=>({test:_=>isString$4(_)&&_.endsWith(a)&&_.split(" ").length===1,parse:parseFloat,transform:_=>`${_}${a}`}),degrees=createUnitType("deg"),percent=createUnitType("%"),px=createUnitType("px"),vh=createUnitType("vh"),vw=createUnitType("vw"),progressPercentage={...percent,parse:a=>percent.parse(a)/100,transform:a=>percent.transform(a*100)},int$1={...number$2,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}=a;let it=!1,st=!1,ot=!0;for(const at in _){const ut=_[at];if(isCSSVariableName(at)){tt[at]=ut;continue}const ht=numberValueTypes[at],yt=getValueAsType(ut,ht);if(transformProps.has(at)){if(it=!0,rt[at]=yt,!ot)continue;ut!==(ht.default||0)&&(ot=!1)}else at.startsWith("origin")?(st=!0,nt[at]=yt):et[at]=yt}if(_.transform||(it||j?et.transform=buildTransform(a.transform,$,ot,j):et.transform&&(et.transform="none")),st){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 _)!isMotionValue(_[j])&&!isForcedMotionValue(j,$)&&(a[j]=_[j])}function useInitialMotionValues({transformTemplate:a},_,$){return reactExports.useMemo(()=>{const j=createHtmlRenderState();return buildHTMLStyles(j,_,{enableHardwareAcceleration:!$},a),Object.assign({},j.vars,j.style)},[_])}function useStyle(a,_,$){const j=a.style||{},et={};return copyRawValuesOnly(et,j,a),Object.assign(et,useInitialMotionValues(a,_,$)),et}function useHTMLProps(a,_,$){const j={},et=useStyle(a,_,$);return a.drag&&a.dragListener!==!1&&(j.draggable=!1,et.userSelect=et.WebkitUserSelect=et.WebkitTouchCallout="none",et.touchAction=a.drag===!0?"none":`pan-${a.drag==="x"?"y":"x"}`),a.tabIndex===void 0&&(a.onTap||a.onTapStart||a.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(a){return a.startsWith("while")||a.startsWith("drag")&&a!=="draggable"||a.startsWith("layout")||a.startsWith("onTap")||a.startsWith("onPan")||a.startsWith("onLayout")||validMotionProps.has(a)}let shouldForward=a=>!isValidMotionProp(a);function loadExternalIsValidProp(a){a&&(shouldForward=_=>_.startsWith("on")?!isValidMotionProp(_):a(_))}try{loadExternalIsValidProp(require("@emotion/is-prop-valid").default)}catch{}function filterProps(a,_,$){const j={};for(const et in a)et==="values"&&typeof a.values=="object"||(shouldForward(et)||$===!0&&isValidMotionProp(et)||!_&&!isValidMotionProp(et)||a.draggable&&et.startsWith("onDrag"))&&(j[et]=a[et]);return j}function calcOrigin$1(a,_,$){return typeof a=="string"?a:px.transform(_+$*a)}function calcSVGTransformOrigin(a,_,$){const j=calcOrigin$1(_,a.x,a.width),et=calcOrigin$1($,a.y,a.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){a.pathLength=1;const tt=et?dashKeys:camelKeys;a[tt.offset]=px.transform(-j);const rt=px.transform(_),nt=px.transform($);a[tt.array]=`${rt} ${nt}`}function buildSVGAttrs(a,{attrX:_,attrY:$,attrScale:j,originX:et,originY:tt,pathLength:rt,pathSpacing:nt=1,pathOffset:it=0,...st},ot,at,ut){if(buildHTMLStyles(a,st,ot,ut),at){a.style.viewBox&&(a.attrs.viewBox=a.style.viewBox);return}a.attrs=a.style,a.style={};const{attrs:ht,style:yt,dimensions:wt}=a;ht.transform&&(wt&&(yt.transform=ht.transform),delete ht.transform),wt&&(et!==void 0||tt!==void 0||yt.transform)&&(yt.transformOrigin=calcSVGTransformOrigin(wt,et!==void 0?et:.5,tt!==void 0?tt:.5)),_!==void 0&&(ht.x=_),$!==void 0&&(ht.y=$),j!==void 0&&(ht.scale=j),rt!==void 0&&buildSVGPath(ht,rt,nt,it,!1)}const createSvgRenderState=()=>({...createHtmlRenderState(),attrs:{}}),isSVGTag=a=>typeof a=="string"&&a.toLowerCase()==="svg";function useSVGProps(a,_,$,j){const et=reactExports.useMemo(()=>{const tt=createSvgRenderState();return buildSVGAttrs(tt,_,{enableHardwareAcceleration:!1},isSVGTag(j),a.transformTemplate),{...tt.attrs,style:{...tt.style}}},[_]);if(a.style){const tt={};copyRawValuesOnly(tt,a.style,a),et.style={...tt,...et.style}}return et}function createUseRender(a=!1){return($,j,et,{latestValues:tt},rt)=>{const it=(isSVGComponent($)?useSVGProps:useHTMLProps)(j,tt,rt,$),st=filterProps(j,typeof $=="string",a),ot=$!==reactExports.Fragment?{...st,...it,ref:et}:{},{children:at}=j,ut=reactExports.useMemo(()=>isMotionValue(at)?at.get():at,[at]);return reactExports.createElement($,{...ot,children:ut})}}function renderHTML(a,{style:_,vars:$},j,et){Object.assign(a.style,_,et&&et.getProjectionStyles(j));for(const tt in $)a.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 _.attrs)a.setAttribute(camelCaseAttributes.has(et)?et:camelToDash(et),_.attrs[et])}function scrapeMotionValuesFromProps$1(a,_,$){var j;const{style:et}=a,tt={};for(const rt in et)(isMotionValue(et[rt])||_.style&&isMotionValue(_.style[rt])||isForcedMotionValue(rt,a)||((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 a)if(isMotionValue(a[et])||isMotionValue(_[et])){const tt=transformPropOrder.indexOf(et)!==-1?"attr"+et.charAt(0).toUpperCase()+et.substring(1):et;j[tt]=a[et]}return j}function getValueState(a){const _=[{},{}];return a==null||a.values.forEach(($,j)=>{_[0][j]=$.get(),_[1][j]=$.getVelocity()}),_}function resolveVariantFromProps(a,_,$,j){if(typeof _=="function"){const[et,tt]=getValueState(j);_=_($!==void 0?$:a.custom,et,tt)}if(typeof _=="string"&&(_=a.variants&&a.variants[_]),typeof _=="function"){const[et,tt]=getValueState(j);_=_($!==void 0?$:a.custom,et,tt)}return _}function useConstant(a){const _=reactExports.useRef(null);return _.current===null&&(_.current=a()),_.current}const isKeyframesTarget=a=>Array.isArray(a),isCustomValue=a=>!!(a&&typeof a=="object"&&a.mix&&a.toValue),resolveFinalValueInKeyframes=a=>isKeyframesTarget(a)?a[a.length-1]||0:a;function resolveMotionValue(a){const _=isMotionValue(a)?a.get():a;return isCustomValue(_)?_.toValue():_}function makeState({scrapeMotionValuesFromProps:a,createRenderState:_,onMount:$},j,et,tt){const rt={latestValues:makeLatestValues(j,et,tt,a),renderState:_()};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(a,{});for(const ut in tt)et[ut]=resolveMotionValue(tt[ut]);let{initial:rt,animate:nt}=a;const it=isControllingVariants(a),st=isVariantNode(a);_&&st&&!it&&a.inherit!==!1&&(rt===void 0&&(rt=_.initial),nt===void 0&&(nt=_.animate));let ot=$?$.initial===!1:!1;ot=ot||rt===!1;const at=ot?nt:rt;return at&&typeof at!="boolean"&&!isAnimationControls(at)&&(Array.isArray(at)?at:[at]).forEach(ht=>{const yt=resolveVariantFromProps(a,ht);if(!yt)return;const{transitionEnd:wt,transition:Ct,...Pt}=yt;for(const $t in Pt){let Mt=Pt[$t];if(Array.isArray(Mt)){const Lt=ot?Mt.length-1:0;Mt=Mt[Lt]}Mt!==null&&(et[$t]=Mt)}for(const $t in wt)et[$t]=wt[$t]}),et}const noop$b=a=>a,{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 _.getBBox=="function"?_.getBBox():_.getBoundingClientRect()}catch{$.dimensions={x:0,y:0,width:0,height:0}}}),frame.render(()=>{buildSVGAttrs($,j,{enableHardwareAcceleration:!1},isSVGTag(_.tagName),a.transformTemplate),renderSVG(_,$)})}})},htmlMotionConfig={useVisualState:makeUseVisualState({scrapeMotionValuesFromProps:scrapeMotionValuesFromProps$1,createRenderState:createHtmlRenderState})};function createDomMotionConfig(a,{forwardMotionProps:_=!1},$,j){return{...isSVGComponent(a)?svgMotionConfig:htmlMotionConfig,preloadedFeatures:$,useRender:createUseRender(_),createVisualElement:j,Component:a}}function addDomEvent(a,_,$,j={passive:!0}){return a.addEventListener(_,$,j),()=>a.removeEventListener(_,$)}const isPrimaryPointer=a=>a.pointerType==="mouse"?typeof a.button!="number"||a.button<=0:a.isPrimary!==!1;function extractEventInfo(a,_="page"){return{point:{x:a[`${_}X`],y:a[`${_}Y`]}}}const addPointerInfo=a=>_=>isPrimaryPointer(_)&&a(_,extractEventInfo(_));function addPointerEvent(a,_,$,j){return addDomEvent(a,_,addPointerInfo($),j)}const combineFunctions=(a,_)=>$=>_(a($)),pipe$1=(...a)=>a.reduce(combineFunctions);function createLock(a){let _=null;return()=>{const $=()=>{_=null};return _===null?(_=a,$):!1}}const globalHorizontalLock=createLock("dragHorizontal"),globalVerticalLock=createLock("dragVertical");function getGlobalLock(a){let _=!1;if(a==="y")_=globalVerticalLock();else if(a==="x")_=globalHorizontalLock();else{const $=globalHorizontalLock(),j=globalVerticalLock();$&&j?_=()=>{$(),j()}:($&&$(),j&&j())}return _}function isDragActive(){const a=getGlobalLock(!0);return a?(a(),!1):!0}class Feature{constructor(_){this.isMounted=!1,this.node=_}update(){}}function addHoverEvent(a,_){const $=_?"pointerenter":"pointerleave",j=_?"onHoverStart":"onHoverEnd",et=(tt,rt)=>{if(tt.pointerType==="touch"||isDragActive())return;const nt=a.getProps();a.animationState&&nt.whileHover&&a.animationState.setActive("whileHover",_);const it=nt[j];it&&frame.postRender(()=>it(tt,rt))};return addPointerEvent(a.current,$,et,{passive:!a.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 _=!1;try{_=this.node.current.matches(":focus-visible")}catch{_=!0}!_||!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===_?!0:isNodeOrChild(a,_.parentElement):!1;function fireSyntheticPointerEvent(a,_){if(!_)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=(_,$)=>{if(this.isPressing)return;this.removeEndListeners();const j=this.node.getProps(),tt=addPointerEvent(window,"pointerup",(nt,it)=>{if(!this.checkPressEnd())return;const{onTap:st,onTapCancel:ot,globalTapTarget:at}=this.node.getProps(),ut=!at&&!isNodeOrChild(this.node.current,nt.target)?ot:st;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(_,$)},this.startAccessiblePress=()=>{const _=tt=>{if(tt.key!=="Enter"||this.isPressing)return;const rt=nt=>{nt.key!=="Enter"||!this.checkPressEnd()||fireSyntheticPointerEvent("up",(it,st)=>{const{onTap:ot}=this.node.getProps();ot&&frame.postRender(()=>ot(it,st))})};this.removeEndListeners(),this.removeEndListeners=addDomEvent(this.node.current,"keyup",rt),fireSyntheticPointerEvent("down",(nt,it)=>{this.startPress(nt,it)})},$=addDomEvent(this.node.current,"keydown",_),j=()=>{this.isPressing&&fireSyntheticPointerEvent("cancel",(tt,rt)=>this.cancelPress(tt,rt))},et=addDomEvent(this.node.current,"blur",j);this.removeAccessibleListeners=pipe$1($,et)}}startPress(_,$){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(_,$))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!isDragActive()}cancelPress(_,$){if(!this.checkPressEnd())return;const{onTapCancel:j}=this.node.getProps();j&&frame.postRender(()=>j(_,$))}mount(){const _=this.node.getProps(),$=addPointerEvent(_.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(_.onTapStart||_.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=a=>{const _=observerCallbacks.get(a.target);_&&_(a)},fireAllObserverCallbacks=a=>{a.forEach(fireObserverCallback)};function initIntersectionObserver({root:a,..._}){const $=a||document;observers.has($)||observers.set($,{});const j=observers.get($),et=JSON.stringify(_);return j[et]||(j[et]=new IntersectionObserver(fireAllObserverCallbacks,{root:a,..._})),j[et]}function observeIntersection(a,_,$){const j=initIntersectionObserver(_);return observerCallbacks.set(a,$),j.observe(a),()=>{observerCallbacks.delete(a),j.unobserve(a)}}const thresholdNames={some:0,all:1};class InViewFeature extends Feature{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:_={}}=this.node.getProps(),{root:$,margin:j,amount:et="some",once:tt}=_,rt={root:$?$.current:void 0,rootMargin:j,threshold:typeof et=="number"?et:thresholdNames[et]},nt=it=>{const{isIntersecting:st}=it;if(this.isInView===st||(this.isInView=st,tt&&!st&&this.hasEnteredView))return;st&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",st);const{onViewportEnter:ot,onViewportLeave:at}=this.node.getProps(),ut=st?ot:at;ut&&ut(it)};return observeIntersection(this.node.current,rt,nt)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:_,prevProps:$}=this.node;["amount","margin","root"].some(hasViewportOptionChanged(_,$))&&this.startObserver()}unmount(){}}function hasViewportOptionChanged({viewport:a={}},{viewport:_={}}={}){return $=>a[$]!==_[$]}const gestureAnimations={inView:{Feature:InViewFeature},tap:{Feature:PressGesture},focus:{Feature:FocusGesture},hover:{Feature:HoverGesture}};function shallowCompare(a,_){if(!Array.isArray(_))return!1;const $=_.length;if($!==a.length)return!1;for(let j=0;j<$;j++)if(_[j]!==a[j])return!1;return!0}function resolveVariant(a,_,$){const j=a.getProps();return resolveVariantFromProps(j,_,$!==void 0?$:j.custom,a)}const secondsToMilliseconds$1=a=>a*1e3,millisecondsToSeconds=a=>a/1e3,underDampedSpring={type:"spring",stiffness:500,damping:25,restSpeed:10},criticallyDampedSpring=a=>({type:"spring",stiffness:550,damping:a===0?2*Math.sqrt(550):30,restSpeed:10}),keyframesTransition={type:"keyframes",duration:.8},ease={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},getDefaultTransition=(a,{keyframes:_})=>_.length>2?keyframesTransition:transformProps.has(a)?a.startsWith("scale")?criticallyDampedSpring(_[1]):underDampedSpring:ease;function isTransitionDefined({when:a,delay:_,delayChildren:$,staggerChildren:j,staggerDirection:et,repeat:tt,repeatType:rt,repeatDelay:nt,from:it,elapsed:st,...ot}){return!!Object.keys(ot).length}function getValueTransition(a,_){return a[_]||a.default||a}const isNotNull=a=>a!==null;function getFinalKeyframe(a,{repeat:_,repeatType:$="loop"},j){const et=a.filter(isNotNull),tt=_&&$!=="loop"&&_%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:a=>{now$1=a,queueMicrotask(clearTime)}},isZeroValueString=a=>/^0[^.\s]+$/u.test(a);function isNone(a){return typeof a=="number"?a===0:a!==null?a==="none"||a==="0"||isZeroValueString(a):!0}let invariant$1=noop$b;const isNumericalString=a=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(a),splitCSSVariableRegex=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function parseCSSVariable(a){const _=splitCSSVariableRegex.exec(a);if(!_)return[,];const[,$,j,et]=_;return[`--${$??j}`,et]}function getVariableValue(a,_,$=1){const[j,et]=parseCSSVariable(a);if(!j)return;const tt=window.getComputedStyle(_).getPropertyValue(j);if(tt){const rt=tt.trim();return isNumericalString(rt)?parseFloat(rt):rt}return isCSSVariableToken(et)?getVariableValue(et,_,$+1):et}const positionalKeys=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),isNumOrPxType=a=>a===number$2||a===px,getPosFromMatrix=(a,_)=>parseFloat(a.split(", ")[_]),getTranslateFromMatrix=(a,_)=>($,{transform:j})=>{if(j==="none"||!j)return 0;const et=j.match(/^matrix3d\((.+)\)$/u);if(et)return getPosFromMatrix(et[1],_);{const tt=j.match(/^matrix\((.+)\)$/u);return tt?getPosFromMatrix(tt[1],a):0}},transformKeys=new Set(["x","y","z"]),nonTranslationalTransformKeys=transformPropOrder.filter(a=>!transformKeys.has(a));function removeNonTranslationalTransform(a){const _=[];return nonTranslationalTransformKeys.forEach($=>{const j=a.getValue($);j!==void 0&&(_.push([$,j.get()]),j.set($.startsWith("scale")?1:0))}),_}const positionalValues={width:({x:a},{paddingLeft:_="0",paddingRight:$="0"})=>a.max-a.min-parseFloat(_)-parseFloat($),height:({y:a},{paddingTop:_="0",paddingBottom:$="0"})=>a.max-a.min-parseFloat(_)-parseFloat($),top:(a,{top:_})=>parseFloat(_),left:(a,{left:_})=>parseFloat(_),bottom:({y:a},{top:_})=>parseFloat(_)+(a.max-a.min),right:({x:a},{left:_})=>parseFloat(_)+(a.max-a.min),x:getTranslateFromMatrix(4,13),y:getTranslateFromMatrix(5,14)};positionalValues.translateX=positionalValues.x;positionalValues.translateY=positionalValues.y;const testValueType=a=>_=>_.test(a),auto$1={test:a=>a==="auto",parse:a=>a},dimensionValueTypes=[number$2,px,percent,degrees,vw,vh,auto$1],findDimensionValueType=a=>dimensionValueTypes.find(testValueType(a)),toResolve=new Set;let isScheduled=!1,anyNeedsMeasurement=!1;function measureAllKeyframes(){if(anyNeedsMeasurement){const a=Array.from(toResolve).filter(j=>j.needsMeasurement),_=new Set(a.map(j=>j.element)),$=new Map;_.forEach(j=>{const et=removeNonTranslationalTransform(j);et.length&&($.set(j,et),j.render())}),a.forEach(j=>j.measureInitialState()),_.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)})}),a.forEach(j=>j.measureEndState()),a.forEach(j=>{j.suspendedScrollY!==void 0&&window.scrollTo(0,j.suspendedScrollY)})}anyNeedsMeasurement=!1,isScheduled=!1,toResolve.forEach(a=>a.complete()),toResolve.clear()}function readAllKeyframes(){toResolve.forEach(a=>{a.readKeyframes(),a.needsMeasurement&&(anyNeedsMeasurement=!0)})}function flushKeyframeResolvers(){readAllKeyframes(),measureAllKeyframes()}class KeyframeResolver{constructor(_,$,j,et,tt,rt=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[..._],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:_,name:$,element:j,motionValue:et}=this;for(let tt=0;tt<_.length;tt++)if(_[tt]===null)if(tt===0){const rt=et==null?void 0:et.get(),nt=_[_.length-1];if(rt!==void 0)_[0]=rt;else if(j&&$){const it=j.readValue($,nt);it!=null&&(_[0]=it)}_[0]===void 0&&(_[0]=nt),et&&rt===void 0&&et.set(_[0])}else _[tt]=_[tt-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),toResolve.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,toResolve.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const isColorString=(a,_)=>$=>!!(isString$4($)&&singleColorRegex.test($)&&$.startsWith(a)||_&&Object.prototype.hasOwnProperty.call($,_)),splitColor=(a,_,$)=>j=>{if(!isString$4(j))return j;const[et,tt,rt,nt]=j.match(floatRegex);return{[a]:parseFloat(et),[_]:parseFloat(tt),[$]:parseFloat(rt),alpha:nt!==void 0?parseFloat(nt):1}},clampRgbUnit=a=>clamp(0,255,a),rgbUnit={...number$2,transform:a=>Math.round(clampRgbUnit(a))},rgba={test:isColorString("rgb","red"),parse:splitColor("red","green","blue"),transform:({red:a,green:_,blue:$,alpha:j=1})=>"rgba("+rgbUnit.transform(a)+", "+rgbUnit.transform(_)+", "+rgbUnit.transform($)+", "+sanitize(alpha.transform(j))+")"};function parseHex$1(a){let _="",$="",j="",et="";return a.length>5?(_=a.substring(1,3),$=a.substring(3,5),j=a.substring(5,7),et=a.substring(7,9)):(_=a.substring(1,2),$=a.substring(2,3),j=a.substring(3,4),et=a.substring(4,5),_+=_,$+=$,j+=j,et+=et),{red:parseInt(_,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:a,saturation:_,lightness:$,alpha:j=1})=>"hsla("+Math.round(a)+", "+percent.transform(sanitize(_))+", "+percent.transform(sanitize($))+", "+sanitize(alpha.transform(j))+")"},color$1={test:a=>rgba.test(a)||hex.test(a)||hsla.test(a),parse:a=>rgba.test(a)?rgba.parse(a):hsla.test(a)?hsla.parse(a):hex.parse(a),transform:a=>isString$4(a)?a:a.hasOwnProperty("red")?rgba.transform(a):hsla.transform(a)};function test$1(a){var _,$;return isNaN(a)&&isString$4(a)&&(((_=a.match(floatRegex))===null||_===void 0?void 0:_.length)||0)+((($=a.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(a){const _=a.toString(),$=[],j={color:[],number:[],var:[]},et=[];let tt=0;const nt=_.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(a){return analyseComplexValue(a).values}function createTransformer(a){const{split:_,types:$}=analyseComplexValue(a),j=_.length;return et=>{let tt="";for(let rt=0;rttypeof a=="number"?0:a;function getAnimatableNone$1(a){const _=parseComplexValue(a);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(a){const[_,$]=a.slice(0,-1).split("(");if(_==="drop-shadow")return a;const[j]=$.match(floatRegex)||[];if(!j)return a;const et=$.replace(j,"");let tt=maxDefaults.has(_)?1:0;return j!==$&&(tt*=100),_+"("+tt+et+")"}const functionRegex=/\b([a-z-]*)\(.*?\)/gu,filter$1={...complex,getAnimatableNone:a=>{const _=a.match(functionRegex);return _?_.map(applyDefaultFilter).join(" "):a}},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=a=>defaultValueTypes[a];function getAnimatableNone(a,_){let $=getDefaultValueType(a);return $!==filter$1&&($=complex),$.getAnimatableNone?$.getAnimatableNone(_):void 0}const invalidTemplates=new Set(["auto","none","0"]);function makeNoneKeyframesAnimatable(a,_,$){let j=0,et;for(;j{$.getValue(it).set(st)}),this.resolveNoneKeyframes()}}function memo(a){let _;return()=>(_===void 0&&(_=a()),_)}const isAnimatable=(a,_)=>_==="zIndex"?!1:!!(typeof a=="number"||Array.isArray(a)||typeof a=="string"&&(complex.test(a)||a==="0")&&!a.startsWith("url("));function hasKeyframesChanged(a){const _=a[0];if(a.length===1)return!0;for(let $=0;${this.resolveFinishedPromise=_})}}function velocityPerSecond(a,_){return _?a*(1e3/_):0}const velocitySampleDuration=5;function calcGeneratorVelocity(a,_,$){const j=Math.max(_-velocitySampleDuration,0);return velocityPerSecond($-a(j),_-j)}const safeMin=.001,minDuration=.01,maxDuration$1=10,minDamping=.05,maxDamping=1;function findSpring({duration:a=800,bounce:_=.25,velocity:$=0,mass:j=1}){let et,tt,rt=1-_;rt=clamp(minDamping,maxDamping,rt),a=clamp(minDuration,maxDuration$1,millisecondsToSeconds(a)),rt<1?(et=st=>{const ot=st*rt,at=ot*a,ut=ot-$,ht=calcAngularFreq(st,rt),yt=Math.exp(-at);return safeMin-ut/ht*yt},tt=st=>{const at=st*rt*a,ut=at*$+$,ht=Math.pow(rt,2)*Math.pow(st,2)*a,yt=Math.exp(-at),wt=calcAngularFreq(Math.pow(st,2),rt);return(-et(st)+safeMin>0?-1:1)*((ut-ht)*yt)/wt}):(et=st=>{const ot=Math.exp(-st*a),at=(st-$)*a+1;return-safeMin+ot*at},tt=st=>{const ot=Math.exp(-st*a),at=($-st)*(a*a);return ot*at});const nt=5/a,it=approximateRoot(et,tt,nt);if(a=secondsToMilliseconds$1(a),isNaN(it))return{stiffness:100,damping:10,duration:a};{const st=Math.pow(it,2)*j;return{stiffness:st,damping:rt*2*Math.sqrt(j*st),duration:a}}}const rootIterations=12;function approximateRoot(a,_,$){let j=$;for(let et=1;eta[$]!==void 0)}function getSpringOptions(a){let _={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...a};if(!isSpringType(a,physicsKeys)&&isSpringType(a,durationKeys)){const $=findSpring(a);_={..._,...$,mass:1},_.isResolvedFromDuration=!0}return _}function spring({keyframes:a,restDelta:_,restSpeed:$,...j}){const et=a[0],tt=a[a.length-1],rt={done:!1,value:et},{stiffness:nt,damping:it,mass:st,duration:ot,velocity:at,isResolvedFromDuration:ut}=getSpringOptions({...j,velocity:-millisecondsToSeconds(j.velocity||0)}),ht=at||0,yt=it/(2*Math.sqrt(nt*st)),wt=tt-et,Ct=millisecondsToSeconds(Math.sqrt(nt/st)),Pt=Math.abs(wt)<5;$||($=Pt?.01:2),_||(_=Pt?.005:.5);let $t;if(yt<1){const Mt=calcAngularFreq(Ct,yt);$t=Lt=>{const Dt=Math.exp(-yt*Ct*Lt);return tt-Dt*((ht+yt*Ct*wt)/Mt*Math.sin(Mt*Lt)+wt*Math.cos(Mt*Lt))}}else if(yt===1)$t=Mt=>tt-Math.exp(-Ct*Mt)*(wt+(ht+Ct*wt)*Mt);else{const Mt=Ct*Math.sqrt(yt*yt-1);$t=Lt=>{const Dt=Math.exp(-yt*Ct*Lt),zt=Math.min(Mt*Lt,300);return tt-Dt*((ht+yt*Ct*wt)*Math.sinh(zt)+Mt*wt*Math.cosh(zt))/Mt}}return{calculatedDuration:ut&&ot||null,next:Mt=>{const Lt=$t(Mt);if(ut)rt.done=Mt>=ot;else{let Dt=ht;Mt!==0&&(yt<1?Dt=calcGeneratorVelocity($t,Mt,Lt):Dt=0);const zt=Math.abs(Dt)<=$,Ot=Math.abs(tt-Lt)<=_;rt.done=zt&&Ot}return rt.value=rt.done?tt:Lt,rt}}}function inertia({keyframes:a,velocity:_=0,power:$=.8,timeConstant:j=325,bounceDamping:et=10,bounceStiffness:tt=500,modifyTarget:rt,min:nt,max:it,restDelta:st=.5,restSpeed:ot}){const at=a[0],ut={done:!1,value:at},ht=It=>nt!==void 0&&Itit,yt=It=>nt===void 0?it:it===void 0||Math.abs(nt-It)-wt*Math.exp(-It/j),Mt=It=>Pt+$t(It),Lt=It=>{const Bt=$t(It),Ft=Mt(It);ut.done=Math.abs(Bt)<=st,ut.value=ut.done?Pt:Ft};let Dt,zt;const Ot=It=>{ht(ut.value)&&(Dt=It,zt=spring({keyframes:[ut.value,yt(ut.value)],velocity:calcGeneratorVelocity(Mt,It,ut.value),damping:et,stiffness:tt,restDelta:st,restSpeed:ot}))};return Ot(0),{calculatedDuration:null,next:It=>{let Bt=!1;return!zt&&Dt===void 0&&(Bt=!0,Lt(It),Ot(It)),Dt!==void 0&&It>=Dt?zt.next(It-Dt):(!Bt&&Lt(It),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=_+($-_)/2,tt=calcBezier(rt,j,et)-a,tt>0?$=rt:_=rt;while(Math.abs(tt)>subdivisionPrecision&&++ntbinarySubdivide(tt,0,1,a,$);return tt=>tt===0||tt===1?tt:calcBezier(et(tt),_,j)}const easeIn=cubicBezier(.42,0,1,1),easeOut=cubicBezier(0,0,.58,1),easeInOut=cubicBezier(.42,0,.58,1),isEasingArray=a=>Array.isArray(a)&&typeof a[0]!="number",mirrorEasing=a=>_=>_<=.5?a(2*_)/2:(2-a(2*(1-_)))/2,reverseEasing=a=>_=>1-a(1-_),circIn=a=>1-Math.sin(Math.acos(a)),circOut=reverseEasing(circIn),circInOut=mirrorEasing(circIn),backOut=cubicBezier(.33,1.53,.69,.99),backIn=reverseEasing(backOut),backInOut=mirrorEasing(backIn),anticipate=a=>(a*=2)<1?.5*backIn(a):.5*(2-Math.pow(2,-10*(a-1))),easingLookup={linear:noop$b,easeIn,easeInOut,easeOut,circIn,circInOut,circOut,backIn,backInOut,backOut,anticipate},easingDefinitionToFunction=a=>{if(Array.isArray(a)){invariant$1(a.length===4);const[_,$,j,et]=a;return cubicBezier(_,$,j,et)}else if(typeof a=="string")return invariant$1(easingLookup[a]!==void 0),easingLookup[a];return a},progress=(a,_,$)=>{const j=_-a;return j===0?1:($-a)/j},mixNumber$1=(a,_,$)=>a+(_-a)*$;function hueToRgb(a,_,$){return $<0&&($+=1),$>1&&($-=1),$<1/6?a+(_-a)*6*$:$<1/2?_:$<2/3?a+(_-a)*(2/3-$)*6:a}function hslaToRgba({hue:a,saturation:_,lightness:$,alpha:j}){a/=360,_/=100,$/=100;let et=0,tt=0,rt=0;if(!_)et=tt=rt=$;else{const nt=$<.5?$*(1+_):$+_-$*_,it=2*$-nt;et=hueToRgb(it,nt,a+1/3),tt=hueToRgb(it,nt,a),rt=hueToRgb(it,nt,a-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=a*a,et=$*(_*_-j)+j;return et<0?0:Math.sqrt(et)},colorTypes=[hex,rgba,hsla],getColorType=a=>colorTypes.find(_=>_.test(a));function asRGBA(a){const _=getColorType(a);let $=_.parse(a);return _===hsla&&($=hslaToRgba($)),$}const mixColor=(a,_)=>{const $=asRGBA(a),j=asRGBA(_),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(a)?$=>$<=0?a:_:$=>$>=1?_:a}function mixImmediate(a,_){return $=>$>0?_:a}function mixNumber(a,_){return $=>mixNumber$1(a,_,$)}function getMixer(a){return typeof a=="number"?mixNumber:typeof a=="string"?isCSSVariableToken(a)?mixImmediate:color$1.test(a)?mixColor:mixComplex:Array.isArray(a)?mixArray:typeof a=="object"?color$1.test(a)?mixColor:mixObject:mixImmediate}function mixArray(a,_){const $=[...a],j=$.length,et=a.map((tt,rt)=>getMixer(tt)(tt,_[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<_.values.length;tt++){const rt=_.types[tt],nt=a.indexes[rt][et[rt]],it=($=a.values[nt])!==null&&$!==void 0?$:0;j[tt]=it,et[rt]++}return j}const mixComplex=(a,_)=>{const $=complex.createTransformer(_),j=analyseComplexValue(a),et=analyseComplexValue(_);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(a)&&!et.values.length||invisibleValues.has(_)&&!j.values.length?mixVisibility(a,_):pipe$1(mixArray(matchOrder(j,et),et.values),$):mixImmediate(a,_)};function mix(a,_,$){return typeof a=="number"&&typeof _=="number"&&typeof $=="number"?mixNumber$1(a,_,$):getMixer(a)(a,_)}function createMixers(a,_,$){const j=[],et=$||mix,tt=a.length-1;for(let rt=0;rt_[0];if(tt===2&&a[0]===a[1])return()=>_[1];a[0]>a[tt-1]&&(a=[...a].reverse(),_=[..._].reverse());const rt=createMixers(_,j,et),nt=rt.length,it=st=>{let ot=0;if(nt>1)for(;otit(clamp(a[0],a[tt-1],st)):it}function fillOffset(a,_){const $=a[a.length-1];for(let j=1;j<=_;j++){const et=progress(0,_,j);a.push(mixNumber$1($,1,et))}}function defaultOffset(a){const _=[0];return fillOffset(_,a.length-1),_}function convertOffsetToTimes(a,_){return a.map($=>$*_)}function defaultEasing(a,_){return a.map(()=>_||easeInOut).splice(0,a.length-1)}function keyframes({duration:a=300,keyframes:_,times:$,ease:j="easeInOut"}){const et=isEasingArray(j)?j.map(easingDefinitionToFunction):easingDefinitionToFunction(j),tt={done:!1,value:_[0]},rt=convertOffsetToTimes($&&$.length===_.length?$:defaultOffset(_),a),nt=interpolate(rt,_,{ease:Array.isArray(et)?et:defaultEasing(_,et)});return{calculatedDuration:a,next:it=>(tt.value=nt(it),tt.done=it>=a,tt)}}const maxGeneratorDuration=2e4;function calcGeneratorDuration(a){let _=0;const $=50;let j=a.next(_);for(;!j.done&&_=maxGeneratorDuration?1/0:_}const frameloopDriver=a=>{const _=({timestamp:$})=>a($);return{start:()=>frame.update(_,!0),stop:()=>cancelFrame(_),now:()=>frameData.isProcessing?frameData.timestamp:time.now()}},generators={decay:inertia,inertia,tween:keyframes,keyframes,spring},percentToProgress=a=>a/100;class MainThreadAnimation extends BaseAnimation{constructor({KeyframeResolver:_=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 _(tt,rt,j,et),this.resolver.scheduleResolve()}initPlayback(_){const{type:$="keyframes",repeat:j=0,repeatDelay:et=0,repeatType:tt,velocity:rt=0}=this.options,nt=generators[$]||keyframes;let it,st;nt!==keyframes&&typeof _[0]!="number"&&(it=pipe$1(percentToProgress,mix(_[0],_[1])),_=[0,100]);const ot=nt({...this.options,keyframes:_});tt==="mirror"&&(st=nt({...this.options,keyframes:[..._].reverse(),velocity:-rt})),ot.calculatedDuration===null&&(ot.calculatedDuration=calcGeneratorDuration(ot));const{calculatedDuration:at}=ot,ut=at+et,ht=ut*(j+1)-et;return{generator:ot,mirroredGenerator:st,mapPercentToKeyframes:it,calculatedDuration:at,resolvedDuration:ut,totalDuration:ht}}onPostResolved(){const{autoplay:_=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!_?this.pause():this.state=this.pendingPlayState}tick(_,$=!1){const{resolved:j}=this;if(!j){const{keyframes:It}=this.options;return{done:!0,value:It[It.length-1]}}const{finalKeyframe:et,generator:tt,mirroredGenerator:rt,mapPercentToKeyframes:nt,keyframes:it,calculatedDuration:st,totalDuration:ot,resolvedDuration:at}=j;if(this.startTime===null)return tt.next(0);const{delay:ut,repeat:ht,repeatType:yt,repeatDelay:wt,onUpdate:Ct}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,_):this.speed<0&&(this.startTime=Math.min(_-ot/this.speed,this.startTime)),$?this.currentTime=_:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(_-this.startTime)*this.speed;const Pt=this.currentTime-ut*(this.speed>=0?1:-1),$t=this.speed>=0?Pt<0:Pt>ot;this.currentTime=Math.max(Pt,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=ot);let Mt=this.currentTime,Lt=tt;if(ht){const It=Math.min(this.currentTime,ot)/at;let Bt=Math.floor(It),Ft=It%1;!Ft&&It>=1&&(Ft=1),Ft===1&&Bt--,Bt=Math.min(Bt,ht+1),!!(Bt%2)&&(yt==="reverse"?(Ft=1-Ft,wt&&(Ft-=wt/at)):yt==="mirror"&&(Lt=rt)),Mt=clamp(0,1,Ft)*at}const Dt=$t?{done:!1,value:it[0]}:Lt.next(Mt);nt&&(Dt.value=nt(Dt.value));let{done:zt}=Dt;!$t&&st!==null&&(zt=this.speed>=0?this.currentTime>=ot:this.currentTime<=0);const Ot=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&zt);return Ot&&et!==void 0&&(Dt.value=getFinalKeyframe(it,this.options,et)),Ct&&Ct(Dt.value),Ot&&this.finish(),Dt}get duration(){const{resolved:_}=this;return _?millisecondsToSeconds(_.calculatedDuration):0}get time(){return millisecondsToSeconds(this.currentTime)}set time(_){_=secondsToMilliseconds$1(_),this.currentTime=_,this.holdTime!==null||this.speed===0?this.holdTime=_:this.driver&&(this.startTime=this.driver.now()-_/this.speed)}get speed(){return this.playbackSpeed}set speed(_){const $=this.playbackSpeed!==_;this.playbackSpeed=_,$&&(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:_=frameloopDriver,onPlay:$}=this.options;this.driver||(this.driver=_(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 _;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(_=this.currentTime)!==null&&_!==void 0?_:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:_}=this.options;_&&_()}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(_){return this.startTime=0,this.tick(_,!0)}}const isBezierDefinition=a=>Array.isArray(a)&&typeof a[0]=="number";function isWaapiSupportedEasing(a){return!!(!a||typeof a=="string"&&a in supportedWaapiEasing||isBezierDefinition(a)||Array.isArray(a)&&a.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(a){return mapEasingToNativeEasing(a)||supportedWaapiEasing.easeOut}function mapEasingToNativeEasing(a){if(a)return isBezierDefinition(a)?cubicBezierAsString(a):Array.isArray(a)?a.map(mapEasingToNativeEasingWithDefault):supportedWaapiEasing[a]}function animateStyle(a,_,$,{delay:j=0,duration:et=300,repeat:tt=0,repeatType:rt="loop",ease:nt,times:it}={}){const st={[_]:$};it&&(st.offset=it);const ot=mapEasingToNativeEasing(nt);return Array.isArray(ot)&&(st.easing=ot),a.animate(st,{delay:j,duration:et,easing:Array.isArray(ot)?"linear":ot,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(a){return a.type==="spring"||a.name==="backgroundColor"||!isWaapiSupportedEasing(a.ease)}function pregenerateKeyframes(a,_){const $=new MainThreadAnimation({..._,keyframes:a,repeat:0,delay:0,isGenerator:!0});let j={done:!1,value:a[0]};const et=[];let tt=0;for(;!j.done&&ttthis.onKeyframesResolved(tt,rt),$,j),this.resolver.scheduleResolve()}initPlayback(_,$){var j;let{duration:et=300,times:tt,ease:rt,type:nt,motionValue:it,name:st}=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,...yt}=this.options,wt=pregenerateKeyframes(_,yt);_=wt.keyframes,_.length===1&&(_[1]=_[0]),et=wt.duration,tt=wt.times,rt=wt.ease,nt="keyframes"}const ot=animateStyle(it.owner.current,st,_,{...this.options,duration:et,times:tt,ease:rt});return ot.startTime=time.now(),this.pendingTimeline?(ot.timeline=this.pendingTimeline,this.pendingTimeline=void 0):ot.onfinish=()=>{const{onComplete:at}=this.options;it.set(getFinalKeyframe(_,this.options,$)),at&&at(),this.cancel(),this.resolveFinishedPromise()},{animation:ot,duration:et,times:tt,type:nt,ease:rt,keyframes:_}}get duration(){const{resolved:_}=this;if(!_)return 0;const{duration:$}=_;return millisecondsToSeconds($)}get time(){const{resolved:_}=this;if(!_)return 0;const{animation:$}=_;return millisecondsToSeconds($.currentTime||0)}set time(_){const{resolved:$}=this;if(!$)return;const{animation:j}=$;j.currentTime=secondsToMilliseconds$1(_)}get speed(){const{resolved:_}=this;if(!_)return 1;const{animation:$}=_;return $.playbackRate}set speed(_){const{resolved:$}=this;if(!$)return;const{animation:j}=$;j.playbackRate=_}get state(){const{resolved:_}=this;if(!_)return"idle";const{animation:$}=_;return $.playState}attachTimeline(_){if(!this._resolved)this.pendingTimeline=_;else{const{resolved:$}=this;if(!$)return noop$b;const{animation:j}=$;j.timeline=_,j.onfinish=null}return noop$b}play(){if(this.isStopped)return;const{resolved:_}=this;if(!_)return;const{animation:$}=_;$.playState==="finished"&&this.updateFinishedPromise(),$.play()}pause(){const{resolved:_}=this;if(!_)return;const{animation:$}=_;$.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;const{resolved:_}=this;if(!_)return;const{animation:$,keyframes:j,duration:et,type:tt,ease:rt,times:nt}=_;if(!($.playState==="idle"||$.playState==="finished")){if(this.time){const{motionValue:it,onUpdate:st,onComplete:ot,...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:_}=this;_&&_.animation.finish()}cancel(){const{resolved:_}=this;_&&_.animation.cancel()}static supports(_){const{motionValue:$,name:j,repeatDelay:et,repeatType:tt,damping:rt,type:nt}=_;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,a)||{},it=nt.delay||j.delay||0;let{elapsed:st=0}=j;st=st-secondsToMilliseconds$1(it);let ot={keyframes:Array.isArray($)?$:[null,$],ease:"easeOut",velocity:_.getVelocity(),...nt,delay:-st,onUpdate:ut=>{_.set(ut),nt.onUpdate&&nt.onUpdate(ut)},onComplete:()=>{rt(),nt.onComplete&&nt.onComplete()},name:a,motionValue:_,element:tt?void 0:et};isTransitionDefined(nt)||(ot={...ot,...getDefaultTransition(a,ot)}),ot.duration&&(ot.duration=secondsToMilliseconds$1(ot.duration)),ot.repeatDelay&&(ot.repeatDelay=secondsToMilliseconds$1(ot.repeatDelay)),ot.from!==void 0&&(ot.keyframes[0]=ot.from);let at=!1;if((ot.type===!1||ot.duration===0&&!ot.repeatDelay)&&(ot.duration=0,ot.delay===0&&(at=!0)),at&&!tt&&_.get()!==void 0){const ut=getFinalKeyframe(ot.keyframes,nt);if(ut!==void 0){frame.update(()=>{ot.onUpdate(ut),ot.onComplete()});return}}return!tt&&AcceleratedAnimation.supports(ot)?new AcceleratedAnimation(ot):new MainThreadAnimation(ot)};function isWillChangeMotionValue(a){return!!(isMotionValue(a)&&a.add)}function addUniqueItem(a,_){a.indexOf(_)===-1&&a.push(_)}function removeItem(a,_){const $=a.indexOf(_);$>-1&&a.splice($,1)}class SubscriptionManager{constructor(){this.subscriptions=[]}add(_){return addUniqueItem(this.subscriptions,_),()=>removeItem(this.subscriptions,_)}notify(_,$,j){const et=this.subscriptions.length;if(et)if(et===1)this.subscriptions[0](_,$,j);else for(let tt=0;tt!isNaN(parseFloat(a));class MotionValue{constructor(_,$={}){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(_),this.owner=$.owner}setCurrent(_){this.current=_,this.updatedAt=time.now(),this.canTrackVelocity===null&&_!==void 0&&(this.canTrackVelocity=isFloat(this.current))}setPrevFrameValue(_=this.current){this.prevFrameValue=_,this.prevUpdatedAt=this.updatedAt}onChange(_){return this.on("change",_)}on(_,$){this.events[_]||(this.events[_]=new SubscriptionManager);const j=this.events[_].add($);return _==="change"?()=>{j(),frame.read(()=>{this.events.change.getSize()||this.stop()})}:j}clearListeners(){for(const _ in this.events)this.events[_].clear()}attach(_,$){this.passiveEffect=_,this.stopPassiveEffect=$}set(_,$=!0){!$||!this.passiveEffect?this.updateAndNotify(_,$):this.passiveEffect(_,this.updateAndNotify)}setWithVelocity(_,$,j){this.set($),this.prev=void 0,this.prevFrameValue=_,this.prevUpdatedAt=this.updatedAt-j}jump(_,$=!0){this.updateAndNotify(_),this.prev=_,this.prevUpdatedAt=this.prevFrameValue=void 0,$&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const _=time.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||_-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(_){return this.stop(),new Promise($=>{this.hasAnimated=!0,this.animation=_($),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,_,$){a.hasValue(_)?a.getValue(_).set($):a.addValue(_,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(a,rt,nt)}}function shouldBlockAnimation({protectedKeys:a,needsAnimating:_},$){const j=a.hasOwnProperty($)&&_[$]!==!0;return _[$]=!1,j}function animateTarget(a,_,{delay:$=0,transitionOverride:j,type:et}={}){var tt;let{transition:rt=a.getDefaultTransition(),transitionEnd:nt,...it}=_;const st=a.getValue("willChange");j&&(rt=j);const ot=[],at=et&&a.animationState&&a.animationState.getState()[et];for(const ut in it){const ht=a.getValue(ut,(tt=a.latestValues[ut])!==null&&tt!==void 0?tt:null),yt=it[ut];if(yt===void 0||at&&shouldBlockAnimation(at,ut))continue;const wt={delay:$,elapsed:0,...getValueTransition(rt||{},ut)};let Ct=!1;if(window.HandoffAppearAnimations){const Mt=a.getProps()[optimizedAppearDataAttribute];if(Mt){const Lt=window.HandoffAppearAnimations(Mt,ut,ht,frame);Lt!==null&&(wt.elapsed=Lt,Ct=!0)}}ht.start(animateMotionValue(ut,ht,yt,a.shouldReduceMotion&&transformProps.has(ut)?{type:!1}:wt,a,Ct));const Pt=ht.animation;Pt&&(isWillChangeMotionValue(st)&&(st.add(ut),Pt.then(()=>st.remove(ut))),ot.push(Pt))}return nt&&Promise.all(ot).then(()=>{frame.update(()=>{nt&&setTarget(a,nt)})}),ot}function animateVariant(a,_,$={}){var j;const et=resolveVariant(a,_,$.type==="exit"?(j=a.presenceContext)===null||j===void 0?void 0:j.custom:void 0);let{transition:tt=a.getDefaultTransition()||{}}=et||{};$.transitionOverride&&(tt=$.transitionOverride);const rt=et?()=>Promise.all(animateTarget(a,et,$)):()=>Promise.resolve(),nt=a.variantChildren&&a.variantChildren.size?(st=0)=>{const{delayChildren:ot=0,staggerChildren:at,staggerDirection:ut}=tt;return animateChildren(a,_,ot+st,at,ut,$)}:()=>Promise.resolve(),{when:it}=tt;if(it){const[st,ot]=it==="beforeChildren"?[rt,nt]:[nt,rt];return st().then(()=>ot())}else return Promise.all([rt(),nt($.delay)])}function animateChildren(a,_,$=0,j=0,et=1,tt){const rt=[],nt=(a.variantChildren.size-1)*j,it=et===1?(st=0)=>st*j:(st=0)=>nt-st*j;return Array.from(a.variantChildren).sort(sortByTreeOrder).forEach((st,ot)=>{st.notify("AnimationStart",_),rt.push(animateVariant(st,_,{...tt,delay:$+it(ot)}).then(()=>st.notify("AnimationComplete",_)))}),Promise.all(rt)}function sortByTreeOrder(a,_){return a.sortNodePosition(_)}function animateVisualElement(a,_,$={}){a.notify("AnimationStart",_);let j;if(Array.isArray(_)){const et=_.map(tt=>animateVariant(a,tt,$));j=Promise.all(et)}else if(typeof _=="string")j=animateVariant(a,_,$);else{const et=typeof _=="function"?resolveVariant(a,_,$.custom):_;j=Promise.all(animateTarget(a,et,$))}return j.then(()=>{frame.postRender(()=>{a.notify("AnimationComplete",_)})})}const reversePriorityOrder=[...variantPriorityOrder].reverse(),numAnimationTypes=variantPriorityOrder.length;function animateList(a){return _=>Promise.all(_.map(({animation:$,options:j})=>animateVisualElement(a,$,j)))}function createAnimationState(a){let _=animateList(a);const $=createState();let j=!0;const et=it=>(st,ot)=>{var at;const ut=resolveVariant(a,ot,it==="exit"?(at=a.presenceContext)===null||at===void 0?void 0:at.custom:void 0);if(ut){const{transition:ht,transitionEnd:yt,...wt}=ut;st={...st,...wt,...yt}}return st};function tt(it){_=it(a)}function rt(it){const st=a.getProps(),ot=a.getVariantContext(!0)||{},at=[],ut=new Set;let ht={},yt=1/0;for(let Ct=0;Ctyt&&Lt,Bt=!1;const Ft=Array.isArray(Mt)?Mt:[Mt];let jt=Ft.reduce(et(Pt),{});Dt===!1&&(jt={});const{prevResolvedValues:bt={}}=$t,vt={...bt,...jt},ct=dt=>{It=!0,ut.has(dt)&&(Bt=!0,ut.delete(dt)),$t.needsAnimating[dt]=!0;const mt=a.getValue(dt);mt&&(mt.liveStyle=!1)};for(const dt in vt){const mt=jt[dt],xt=bt[dt];if(ht.hasOwnProperty(dt))continue;let At=!1;isKeyframesTarget(mt)&&isKeyframesTarget(xt)?At=!shallowCompare(mt,xt):At=mt!==xt,At?mt!=null?ct(dt):ut.add(dt):mt!==void 0&&ut.has(dt)?ct(dt):$t.protectedKeys[dt]=!0}$t.prevProp=Mt,$t.prevResolvedValues=jt,$t.isActive&&(ht={...ht,...jt}),j&&a.blockInitialAnimation&&(It=!1),It&&(!zt||Bt)&&at.push(...Ft.map(dt=>({animation:dt,options:{type:Pt}})))}if(ut.size){const Ct={};ut.forEach(Pt=>{const $t=a.getBaseTarget(Pt),Mt=a.getValue(Pt);Mt&&(Mt.liveStyle=!0),Ct[Pt]=$t??null}),at.push({animation:Ct})}let wt=!!at.length;return j&&(st.initial===!1||st.initial===st.animate)&&!a.manuallyAnimateOnMount&&(wt=!1),j=!1,wt?_(at):Promise.resolve()}function nt(it,st){var ot;if($[it].isActive===st)return Promise.resolve();(ot=a.variantChildren)===null||ot===void 0||ot.forEach(ut=>{var ht;return(ht=ut.animationState)===null||ht===void 0?void 0:ht.setActive(it,st)}),$[it].isActive=st;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 _=="string"?_!==a:Array.isArray(_)?!shallowCompare(_,a):!1}function createTypeState(a=!1){return{isActive:a,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(_){super(_),_.animationState||(_.animationState=createAnimationState(_))}updateAnimationControlsSubscription(){const{animate:_}=this.node.getProps();this.unmount(),isAnimationControls(_)&&(this.unmount=_.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:_}=this.node.getProps(),{animate:$}=this.node.prevProps||{};_!==$&&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:_,onExitComplete:$}=this.node.presenceContext,{isPresent:j}=this.node.prevPresenceContext||{};if(!this.node.animationState||_===j)return;const et=this.node.animationState.setActive("exit",!_);$&&!_&&et.then(()=>$(this.id))}mount(){const{register:_}=this.node.presenceContext||{};_&&(this.unmount=_(this.id))}unmount(){}}const animations$1={animation:{Feature:AnimationFeature},exit:{Feature:ExitAnimationFeature}},distance=(a,_)=>Math.abs(a-_);function distance2D(a,_){const $=distance(a.x,_.x),j=distance(a.y,_.y);return Math.sqrt($**2+j**2)}class PanSession{constructor(_,$,{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:yt}=at,{timestamp:wt}=frameData;this.history.push({...yt,timestamp:wt});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:yt,resumeAnimation:wt}=this.handlers;if(this.dragSnapToOrigin&&wt&&wt(),!(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),yt&&yt(at,Ct)},!isPrimaryPointer(_))return;this.dragSnapToOrigin=tt,this.handlers=$,this.transformPagePoint=j,this.contextWindow=et||window;const rt=extractEventInfo(_),nt=transformPoint(rt,this.transformPagePoint),{point:it}=nt,{timestamp:st}=frameData;this.history=[{...it,timestamp:st}];const{onSessionStart:ot}=$;ot&&ot(_,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(_){this.handlers=_}end(){this.removeListeners&&this.removeListeners(),cancelFrame(this.updatePoint)}}function transformPoint(a,_){return _?{point:_(a.point)}:a}function subtractPoint(a,_){return{x:a.x-_.x,y:a.y-_.y}}function getPanInfo({point:a},_){return{point:a,delta:subtractPoint(a,lastDevicePoint(_)),offset:subtractPoint(a,startDevicePoint(_)),velocity:getVelocity(_,.1)}}function startDevicePoint(a){return a[0]}function lastDevicePoint(a){return a[a.length-1]}function getVelocity(a,_){if(a.length<2)return{x:0,y:0};let $=a.length-1,j=null;const et=lastDevicePoint(a);for(;$>=0&&(j=a[$],!(et.timestamp-j.timestamp>secondsToMilliseconds$1(_)));)$--;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(a){return a.max-a.min}function isNear(a,_=0,$=.01){return Math.abs(a-_)<=$}function calcAxisDelta(a,_,$,j=.5){a.origin=j,a.originPoint=mixNumber$1(_.min,_.max,a.origin),a.scale=calcLength($)/calcLength(_),(isNear(a.scale,1,1e-4)||isNaN(a.scale))&&(a.scale=1),a.translate=mixNumber$1($.min,$.max,a.origin)-a.originPoint,(isNear(a.translate)||isNaN(a.translate))&&(a.translate=0)}function calcBoxDelta(a,_,$,j){calcAxisDelta(a.x,_.x,$.x,j?j.originX:void 0),calcAxisDelta(a.y,_.y,$.y,j?j.originY:void 0)}function calcRelativeAxis(a,_,$){a.min=$.min+_.min,a.max=a.min+calcLength(_)}function calcRelativeBox(a,_,$){calcRelativeAxis(a.x,_.x,$.x),calcRelativeAxis(a.y,_.y,$.y)}function calcRelativeAxisPosition(a,_,$){a.min=_.min-$.min,a.max=a.min+calcLength(_)}function calcRelativePosition(a,_,$){calcRelativeAxisPosition(a.x,_.x,$.x),calcRelativeAxisPosition(a.y,_.y,$.y)}function applyConstraints(a,{min:_,max:$},j){return _!==void 0&&a<_?a=j?mixNumber$1(_,a,j.min):Math.max(a,_):$!==void 0&&a>$&&(a=j?mixNumber$1($,a,j.max):Math.min(a,$)),a}function calcRelativeAxisConstraints(a,_,$){return{min:_!==void 0?a.min+_:void 0,max:$!==void 0?a.max+$-(a.max-a.min):void 0}}function calcRelativeConstraints(a,{top:_,left:$,bottom:j,right:et}){return{x:calcRelativeAxisConstraints(a.x,$,et),y:calcRelativeAxisConstraints(a.y,_,j)}}function calcViewportAxisConstraints(a,_){let $=_.min-a.min,j=_.max-a.max;return _.max-_.minj?$=progress(_.min,_.max-j,a.min):j>et&&($=progress(a.min,a.max-et,_.min)),clamp(0,1,$)}function rebaseAxisConstraints(a,_){const $={};return _.min!==void 0&&($.min=_.min-a.min),_.max!==void 0&&($.max=_.max-a.min),$}const defaultElastic=.35;function resolveDragElastic(a=defaultElastic){return a===!1?a=0:a===!0&&(a=defaultElastic),{x:resolveAxisElastic(a,"left","right"),y:resolveAxisElastic(a,"top","bottom")}}function resolveAxisElastic(a,_,$){return{min:resolvePointElastic(a,_),max:resolvePointElastic(a,$)}}function resolvePointElastic(a,_){return typeof a=="number"?a: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(a){return[a("x"),a("y")]}function convertBoundingBoxToBox({top:a,left:_,right:$,bottom:j}){return{x:{min:_,max:$},y:{min:a,max:j}}}function convertBoxToBoundingBox({x:a,y:_}){return{top:_.min,right:a.max,bottom:_.max,left:a.min}}function transformBoxPoints(a,_){if(!_)return a;const $=_({x:a.left,y:a.top}),j=_({x:a.right,y:a.bottom});return{top:$.y,left:$.x,bottom:j.y,right:j.x}}function isIdentityScale(a){return a===void 0||a===1}function hasScale({scale:a,scaleX:_,scaleY:$}){return!isIdentityScale(a)||!isIdentityScale(_)||!isIdentityScale($)}function hasTransform(a){return hasScale(a)||has2DTranslate(a)||a.z||a.rotate||a.rotateX||a.rotateY||a.skewX||a.skewY}function has2DTranslate(a){return is2DTranslate(a.x)||is2DTranslate(a.y)}function is2DTranslate(a){return a&&a!=="0%"}function scalePoint(a,_,$){const j=a-$,et=_*j;return $+et}function applyPointDelta(a,_,$,j,et){return et!==void 0&&(a=scalePoint(a,et,j)),scalePoint(a,$,j)+_}function applyAxisDelta(a,_=0,$=1,j,et){a.min=applyPointDelta(a.min,_,$,j,et),a.max=applyPointDelta(a.max,_,$,j,et)}function applyBoxDelta(a,{x:_,y:$}){applyAxisDelta(a.x,_.translate,_.scale,_.originPoint),applyAxisDelta(a.y,$.translate,$.scale,$.originPoint)}function applyTreeDeltas(a,_,$,j=!1){const et=$.length;if(!et)return;_.x=_.y=1;let tt,rt;for(let nt=0;nt1.0000000000001||a<.999999999999?a:1}function translateAxis(a,_){a.min=a.min+_,a.max=a.max+_}function transformAxis(a,_,[$,j,et]){const tt=_[et]!==void 0?_[et]:.5,rt=mixNumber$1(a.min,a.max,tt);applyAxisDelta(a,_[$],_[j],rt,_.scale)}const xKeys$1=["x","scaleX","originX"],yKeys$1=["y","scaleY","originY"];function transformBox(a,_){transformAxis(a.x,_,xKeys$1),transformAxis(a.y,_,yKeys$1)}function measureViewportBox(a,_){return convertBoundingBoxToBox(transformBoxPoints(a.getBoundingClientRect(),_))}function measurePageBox(a,_,$){const j=measureViewportBox(a,$),{scroll:et}=_;return et&&(translateAxis(j.x,et.offset.x),translateAxis(j.y,et.offset.y)),j}const getContextWindow=({current:a})=>a?a.ownerDocument.defaultView:null,elementDragControls=new WeakMap;class VisualElementDragControls{constructor(_){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=_}start(_,{snapToCursor:$=!1}={}){const{presenceContext:j}=this.visualElement;if(j&&j.isPresent===!1)return;const et=ot=>{const{dragSnapToOrigin:at}=this.getProps();at?this.pauseAnimation():this.stopAnimation(),$&&this.snapToCursor(extractEventInfo(ot,"page").point)},tt=(ot,at)=>{const{drag:ut,dragPropagation:ht,onDragStart:yt}=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:$t}=this.visualElement;if($t&&$t.layout){const Mt=$t.layout.layoutBox[Ct];Mt&&(Pt=calcLength(Mt)*(parseFloat(Pt)/100))}}this.originPoint[Ct]=Pt}),yt&&frame.postRender(()=>yt(ot,at));const{animationState:wt}=this.visualElement;wt&&wt.setActive("whileDrag",!0)},rt=(ot,at)=>{const{dragPropagation:ut,dragDirectionLock:ht,onDirectionLock:yt,onDrag:wt}=this.getProps();if(!ut&&!this.openGlobalLock)return;const{offset:Ct}=at;if(ht&&this.currentDirection===null){this.currentDirection=getCurrentDirection(Ct),this.currentDirection!==null&&yt&&yt(this.currentDirection);return}this.updateAxis("x",at.point,Ct),this.updateAxis("y",at.point,Ct),this.visualElement.render(),wt&&wt(ot,at)},nt=(ot,at)=>this.stop(ot,at),it=()=>eachAxis(ot=>{var at;return this.getAnimationState(ot)==="paused"&&((at=this.getAxisMotionValue(ot).animation)===null||at===void 0?void 0:at.play())}),{dragSnapToOrigin:st}=this.getProps();this.panSession=new PanSession(_,{onSessionStart:et,onStart:tt,onMove:rt,onSessionEnd:nt,resumeAnimation:it},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:st,contextWindow:getContextWindow(this.visualElement)})}stop(_,$){const j=this.isDragging;if(this.cancel(),!j)return;const{velocity:et}=$;this.startAnimation(et);const{onDragEnd:tt}=this.getProps();tt&&frame.postRender(()=>tt(_,$))}cancel(){this.isDragging=!1;const{projection:_,animationState:$}=this.visualElement;_&&(_.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(_,$,j){const{drag:et}=this.getProps();if(!j||!shouldDrag(_,et,this.currentDirection))return;const tt=this.getAxisMotionValue(_);let rt=this.originPoint[_]+j[_];this.constraints&&this.constraints[_]&&(rt=applyConstraints(rt,this.constraints[_],this.elastic[_])),tt.set(rt)}resolveConstraints(){var _;const{dragConstraints:$,dragElastic:j}=this.getProps(),et=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(_=this.visualElement.projection)===null||_===void 0?void 0:_.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:_,onMeasureDragConstraints:$}=this.getProps();if(!_||!isRefObject$2(_))return!1;const j=_.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(_){const{drag:$,dragMomentum:j,dragElastic:et,dragTransition:tt,dragSnapToOrigin:rt,onDragTransitionEnd:nt}=this.getProps(),it=this.constraints||{},st=eachAxis(ot=>{if(!shouldDrag(ot,$,this.currentDirection))return;let at=it&&it[ot]||{};rt&&(at={min:0,max:0});const ut=et?200:1e6,ht=et?40:1e7,yt={type:"inertia",velocity:j?_[ot]:0,bounceStiffness:ut,bounceDamping:ht,timeConstant:750,restDelta:1,restSpeed:10,...tt,...at};return this.startAxisValueAnimation(ot,yt)});return Promise.all(st).then(nt)}startAxisValueAnimation(_,$){const j=this.getAxisMotionValue(_);return j.start(animateMotionValue(_,j,0,$,this.visualElement))}stopAnimation(){eachAxis(_=>this.getAxisMotionValue(_).stop())}pauseAnimation(){eachAxis(_=>{var $;return($=this.getAxisMotionValue(_).animation)===null||$===void 0?void 0:$.pause()})}getAnimationState(_){var $;return($=this.getAxisMotionValue(_).animation)===null||$===void 0?void 0:$.state}getAxisMotionValue(_){const $=`_drag${_.toUpperCase()}`,j=this.visualElement.getProps(),et=j[$];return et||this.visualElement.getValue(_,(j.initial?j.initial[_]:void 0)||0)}snapToCursor(_){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(_[$]-mixNumber$1(rt,nt,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:_,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,_,null))return;const nt=this.getAxisMotionValue(rt),{min:it,max:st}=this.constraints[rt];nt.set(mixNumber$1(it,st,et[rt]))})}addListeners(){if(!this.visualElement.current)return;elementDragControls.set(this.visualElement,this);const _=this.visualElement.current,$=addPointerEvent(_,"pointerdown",it=>{const{drag:st,dragListener:ot=!0}=this.getProps();st&&ot&&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:st})=>{this.isDragging&&st&&(eachAxis(ot=>{const at=this.getAxisMotionValue(ot);at&&(this.originPoint[ot]+=it[ot].translate,at.set(at.get()+it[ot].translate))}),this.visualElement.render())});return()=>{rt(),$(),tt(),nt&&nt()}}getProps(){const _=this.visualElement.getProps(),{drag:$=!1,dragDirectionLock:j=!1,dragPropagation:et=!1,dragConstraints:tt=!1,dragElastic:rt=defaultElastic,dragMomentum:nt=!0}=_;return{..._,drag:$,dragDirectionLock:j,dragPropagation:et,dragConstraints:tt,dragElastic:rt,dragMomentum:nt}}}function shouldDrag(a,_,$){return(_===!0||_===a)&&($===null||$===a)}function getCurrentDirection(a,_=10){let $=null;return Math.abs(a.y)>_?$="y":Math.abs(a.x)>_&&($="x"),$}class DragGesture extends Feature{constructor(_){super(_),this.removeGroupControls=noop$b,this.removeListeners=noop$b,this.controls=new VisualElementDragControls(_)}mount(){const{dragControls:_}=this.node.getProps();_&&(this.removeGroupControls=_.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||noop$b}unmount(){this.removeGroupControls(),this.removeListeners()}}const asyncHandler=a=>(_,$)=>{a&&frame.postRender(()=>a(_,$))};class PanGesture extends Feature{constructor(){super(...arguments),this.removePointerDownListener=noop$b}onPointerDown(_){this.session=new PanSession(_,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:getContextWindow(this.node)})}createPanHandlers(){const{onPanSessionStart:_,onPanStart:$,onPan:j,onPanEnd:et}=this.node.getProps();return{onSessionStart:asyncHandler(_),onStart:asyncHandler($),onMove:j,onEnd:(tt,rt)=>{delete this.session,et&&frame.postRender(()=>et(tt,rt))}}}mount(){this.removePointerDownListener=addPointerEvent(this.node.current,"pointerdown",_=>this.onPointerDown(_))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function usePresence(){const a=reactExports.useContext(PresenceContext);if(a===null)return[!0,null];const{isPresent:_,onExitComplete:$,register:j}=a,et=reactExports.useId();return reactExports.useEffect(()=>j(et),[]),!_&&$?[!1,()=>$&&$(et)]:[!0]}function useIsPresent(){return isPresent(reactExports.useContext(PresenceContext))}function isPresent(a){return a===null?!0:a.isPresent}const globalProjectionState={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function pixelsToPercent(a,_){return _.max===_.min?0:a/(_.max-_.min)*100}const correctBorderRadius={correct:(a,_)=>{if(!_.target)return a;if(typeof a=="string")if(px.test(a))a=parseFloat(a);else return a;const $=pixelsToPercent(a,_.target.x),j=pixelsToPercent(a,_.target.y);return`${$}% ${j}%`}},correctBoxShadow={correct:(a,{treeScale:_,projectionDelta:$})=>{const j=a,et=complex.parse(a);if(et.length>5)return j;const tt=complex.createTransformer(a),rt=typeof et[0]!="number"?1:0,nt=$.x.scale*_.x,it=$.y.scale*_.y;et[0+rt]/=nt,et[1+rt]/=it;const st=mixNumber$1(nt,it,.5);return typeof et[2+rt]=="number"&&(et[2+rt]/=st),typeof et[3+rt]=="number"&&(et[3+rt]/=st),tt(et)}};class MeasureLayoutWithContext extends reactExports.Component{componentDidMount(){const{visualElement:_,layoutGroup:$,switchLayoutGroup:j,layoutId:et}=this.props,{projection:tt}=_;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(_){const{layoutDependency:$,visualElement:j,drag:et,isPresent:tt}=this.props,rt=j.projection;return rt&&(rt.isPresent=tt,et||_.layoutDependency!==$||$===void 0?rt.willUpdate():this.safeToRemove(),_.isPresent!==tt&&(tt?rt.promote():rt.relegate()||frame.postRender(()=>{const nt=rt.getStack();(!nt||!nt.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:_}=this.props.visualElement;_&&(_.root.didUpdate(),microtask.postRender(()=>{!_.currentAnimation&&_.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:_,layoutGroup:$,switchLayoutGroup:j}=this.props,{projection:et}=_;et&&(et.scheduleCheckAfterUnmount(),$&&$.group&&$.group.remove(et),j&&j.deregister&&j.deregister(et))}safeToRemove(){const{safeToRemove:_}=this.props;_&&_()}render(){return null}}function MeasureLayout(a){const[_,$]=usePresence(),j=reactExports.useContext(LayoutGroupContext);return jsxRuntimeExports.jsx(MeasureLayoutWithContext,{...a,layoutGroup:j,switchLayoutGroup:reactExports.useContext(SwitchLayoutGroupContext),isPresent:_,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=a=>typeof a=="string"?parseFloat(a):a,isPx=a=>typeof a=="number"||px.test(a);function mixValues(a,_,$,j,et,tt){et?(a.opacity=mixNumber$1(0,$.opacity!==void 0?$.opacity:1,easeCrossfadeIn(j)),a.opacityExit=mixNumber$1(_.opacity!==void 0?_.opacity:1,0,easeCrossfadeOut(j))):tt&&(a.opacity=mixNumber$1(_.opacity!==void 0?_.opacity:1,$.opacity!==void 0?$.opacity:1,j));for(let rt=0;rtj_?1:$(progress(a,_,j))}function copyAxisInto(a,_){a.min=_.min,a.max=_.max}function copyBoxInto(a,_){copyAxisInto(a.x,_.x),copyAxisInto(a.y,_.y)}function removePointDelta(a,_,$,j,et){return a-=_,a=scalePoint(a,1/$,j),et!==void 0&&(a=scalePoint(a,1/et,j)),a}function removeAxisDelta(a,_=0,$=1,j=.5,et,tt=a,rt=a){if(percent.test(_)&&(_=parseFloat(_),_=mixNumber$1(rt.min,rt.max,_/100)-rt.min),typeof _!="number")return;let nt=mixNumber$1(tt.min,tt.max,j);a===tt&&(nt-=_),a.min=removePointDelta(a.min,_,$,nt,et),a.max=removePointDelta(a.max,_,$,nt,et)}function removeAxisTransforms(a,_,[$,j,et],tt,rt){removeAxisDelta(a,_[$],_[j],_[et],_.scale,tt,rt)}const xKeys=["x","scaleX","originX"],yKeys=["y","scaleY","originY"];function removeBoxTransforms(a,_,$,j){removeAxisTransforms(a.x,_,xKeys,$?$.x:void 0,j?j.x:void 0),removeAxisTransforms(a.y,_,yKeys,$?$.y:void 0,j?j.y:void 0)}function isAxisDeltaZero(a){return a.translate===0&&a.scale===1}function isDeltaZero(a){return isAxisDeltaZero(a.x)&&isAxisDeltaZero(a.y)}function boxEquals(a,_){return a.x.min===_.x.min&&a.x.max===_.x.max&&a.y.min===_.y.min&&a.y.max===_.y.max}function boxEqualsRounded(a,_){return Math.round(a.x.min)===Math.round(_.x.min)&&Math.round(a.x.max)===Math.round(_.x.max)&&Math.round(a.y.min)===Math.round(_.y.min)&&Math.round(a.y.max)===Math.round(_.y.max)}function aspectRatio(a){return calcLength(a.x)/calcLength(a.y)}class NodeStack{constructor(){this.members=[]}add(_){addUniqueItem(this.members,_),_.scheduleRender()}remove(_){if(removeItem(this.members,_),_===this.prevLead&&(this.prevLead=void 0),_===this.lead){const $=this.members[this.members.length-1];$&&this.promote($)}}relegate(_){const $=this.members.findIndex(et=>_===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(_,$){const j=this.lead;if(_!==j&&(this.prevLead=j,this.lead=_,_.show(),j)){j.instance&&j.scheduleRender(),_.scheduleRender(),_.resumeFrom=j,$&&(_.resumeFrom.preserveOpacity=!0),j.snapshot&&(_.snapshot=j.snapshot,_.snapshot.latestValues=j.animationValues||j.latestValues),_.root&&_.root.isUpdating&&(_.isLayoutDirty=!0);const{crossfade:et}=_.options;et===!1&&j.hide()}}exitAnimationComplete(){this.members.forEach(_=>{const{options:$,resumingFrom:j}=_;$.onExitComplete&&$.onExitComplete(),j&&j.options.onExitComplete&&j.options.onExitComplete()})}scheduleRender(){this.members.forEach(_=>{_.instance&&_.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function buildProjectionTransform(a,_,$){let j="";const et=a.x.translate/_.x,tt=a.y.translate/_.y,rt=($==null?void 0:$.z)||0;if((et||tt||rt)&&(j=`translate3d(${et}px, ${tt}px, ${rt}px) `),(_.x!==1||_.y!==1)&&(j+=`scale(${1/_.x}, ${1/_.y}) `),$){const{transformPerspective:st,rotate:ot,rotateX:at,rotateY:ut,skewX:ht,skewY:yt}=$;st&&(j=`perspective(${st}px) ${j}`),ot&&(j+=`rotate(${ot}deg) `),at&&(j+=`rotateX(${at}deg) `),ut&&(j+=`rotateY(${ut}deg) `),ht&&(j+=`skewX(${ht}deg) `),yt&&(j+=`skewY(${yt}deg) `)}const nt=a.x.scale*_.x,it=a.y.scale*_.y;return(nt!==1||it!==1)&&(j+=`scale(${nt}, ${it})`),j||"none"}const compareByDepth=(a,_)=>a.depth-_.depth;class FlatTree{constructor(){this.children=[],this.isDirty=!1}add(_){addUniqueItem(this.children,_),this.isDirty=!0}remove(_){removeItem(this.children,_),this.isDirty=!0}forEach(_){this.isDirty&&this.children.sort(compareByDepth),this.isDirty=!1,this.children.forEach(_)}}function delay(a,_){const $=time.now(),j=({timestamp:et})=>{const tt=et-$;tt>=_&&(cancelFrame(j),a(tt-_))};return frame.read(j,!0),()=>cancelFrame(j)}function record(a){window.MotionDebug&&window.MotionDebug.record(a)}function isSVGElement(a){return a instanceof SVGElement&&a.tagName!=="svg"}function animateSingleValue(a,_,$){const j=isMotionValue(a)?a:motionValue(a);return j.start(animateMotionValue("",j,_,$)),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}=_;et[a]&&($[a]=et[a],_.setStaticValue(a,0),j&&(j[a]=0))}function createProjectionNode({attachResizeListener:a,defaultParent:_,measureScroll:$,checkIsScrollRoot:j,resetTransform:et}){return class{constructor(rt={},nt=_==null?void 0:_()){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;a(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&&ot&&(it||st)&&this.addEventListener("didUpdate",({delta:at,hasLayoutChanged:ut,hasRelativeTargetChanged:ht,layout:yt})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const wt=this.options.transition||ot.getDefaultTransition()||defaultLayoutTransition,{onLayoutAnimationStart:Ct,onLayoutAnimationComplete:Pt}=ot.getProps(),$t=!this.targetLayout||!boxEqualsRounded(this.targetLayout,yt)||ht,Mt=!ut&&ht;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||Mt||ut&&($t||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(at,Mt);const Lt={...getValueTransition(wt,"layout"),onPlay:Ct,onComplete:Pt};(ot.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=yt})}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 ot=0;otthis.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 Dt=Lt/1e3;mixAxisDelta(at.x,rt.x,Dt),mixAxisDelta(at.y,rt.y,Dt),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,Dt),Mt&&boxEquals(this.relativeTarget,Mt)&&(this.isProjectionDirty=!1),Mt||(Mt=createBox()),copyBoxInto(Mt,this.relativeTarget)),wt&&(this.animationValues=ot,mixValues(ot,st,this.latestValues,Dt,$t,Pt)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=Dt},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:st,latestValues:ot}=rt;if(!(!nt||!it||!st)){if(this!==rt&&this.layout&&st&&shouldAnimatePositionOnly(this.options.animationType,this.layout.layoutBox,st.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,ot),calcBoxDelta(this.projectionDeltaWithTransform,this.layoutCorrected,nt,ot)}}registerSharedNode(rt,nt){this.sharedNodes.has(rt)||this.sharedNodes.set(rt,new NodeStack),this.sharedNodes.get(rt).add(nt);const st=nt.options.initialPromotionConfig;nt.promote({transition:st?st.transition:void 0,preserveFollowOpacity:st&&st.shouldPreserveFollowOpacity?st.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 st=this.getStack();st&&st.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 st={};it.z&&resetDistortingTransform("z",rt,st,this.animationValues);for(let ot=0;ot{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(a){a.updateLayout()}function notifyLayoutUpdate(a){var _;const $=((_=a.resumeFrom)===null||_===void 0?void 0:_.snapshot)||a.snapshot;if(a.isLead()&&a.layout&&$&&a.hasListeners("didUpdate")){const{layoutBox:j,measuredBox:et}=a.layout,{animationType:tt}=a.options,rt=$.source!==a.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,a.relativeTarget&&!a.currentAnimation&&(a.isProjectionDirty=!0,a.relativeTarget[at].max=a.relativeTarget[at].min+ht)});const nt=createDelta();calcBoxDelta(nt,j,$.layoutBox);const it=createDelta();rt?calcBoxDelta(it,a.applyTransform(et,!0),$.measuredBox):calcBoxDelta(it,j,$.layoutBox);const st=!isDeltaZero(nt);let ot=!1;if(!a.resumeFrom){const at=a.getClosestProjectingParent();if(at&&!at.resumeFrom){const{snapshot:ut,layout:ht}=at;if(ut&&ht){const yt=createBox();calcRelativePosition(yt,$.layoutBox,ut.layoutBox);const wt=createBox();calcRelativePosition(wt,j,ht.layoutBox),boxEqualsRounded(yt,wt)||(ot=!0),at.options.layoutRoot&&(a.relativeTarget=wt,a.relativeTargetOrigin=yt,a.relativeParent=at)}}}a.notifyListeners("didUpdate",{layout:j,snapshot:$,delta:it,layoutDelta:nt,hasLayoutChanged:st,hasRelativeTargetChanged:ot})}else if(a.isLead()){const{onExitComplete:j}=a.options;j&&j()}a.options.transition=void 0}function propagateDirtyNodes(a){projectionFrameData.totalNodes++,a.parent&&(a.isProjecting()||(a.isProjectionDirty=a.parent.isProjectionDirty),a.isSharedProjectionDirty||(a.isSharedProjectionDirty=!!(a.isProjectionDirty||a.parent.isProjectionDirty||a.parent.isSharedProjectionDirty)),a.isTransformDirty||(a.isTransformDirty=a.parent.isTransformDirty))}function cleanDirtyNodes(a){a.isProjectionDirty=a.isSharedProjectionDirty=a.isTransformDirty=!1}function clearSnapshot(a){a.clearSnapshot()}function clearMeasurements(a){a.clearMeasurements()}function clearIsLayoutDirty(a){a.isLayoutDirty=!1}function resetTransformStyle(a){const{visualElement:_}=a.options;_&&_.getProps().onBeforeLayoutMeasure&&_.notify("BeforeLayoutMeasure"),a.resetTransform()}function finishAnimation(a){a.finishAnimation(),a.targetDelta=a.relativeTarget=a.target=void 0,a.isProjectionDirty=!0}function resolveTargetDelta(a){a.resolveTargetDelta()}function calcProjection(a){a.calcProjection()}function resetSkewAndRotation(a){a.resetSkewAndRotation()}function removeLeadSnapshots(a){a.removeLeadSnapshot()}function mixAxisDelta(a,_,$){a.translate=mixNumber$1(_.translate,0,$),a.scale=mixNumber$1(_.scale,1,$),a.origin=_.origin,a.originPoint=_.originPoint}function mixAxis(a,_,$,j){a.min=mixNumber$1(_.min,$.min,j),a.max=mixNumber$1(_.max,$.max,j)}function mixBox(a,_,$,j){mixAxis(a.x,_.x,$.x,j),mixAxis(a.y,_.y,$.y,j)}function hasOpacityCrossfade(a){return a.animationValues&&a.animationValues.opacityExit!==void 0}const defaultLayoutTransition={duration:.45,ease:[.4,0,.1,1]},userAgentContains=a=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(a),roundPoint=userAgentContains("applewebkit/")&&!userAgentContains("chrome/")?Math.round:noop$b;function roundAxis(a){a.min=roundPoint(a.min),a.max=roundPoint(a.max)}function roundBox(a){roundAxis(a.x),roundAxis(a.y)}function shouldAnimatePositionOnly(a,_,$){return a==="position"||a==="preserve-aspect"&&!isNear(aspectRatio(_),aspectRatio($),.2)}const DocumentProjectionNode=createProjectionNode({attachResizeListener:(a,_)=>addDomEvent(a,"resize",_),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),rootProjectionNode={current:void 0},HTMLProjectionNode=createProjectionNode({measureScroll:a=>({x:a.scrollLeft,y:a.scrollTop}),defaultParent:()=>{if(!rootProjectionNode.current){const a=new DocumentProjectionNode({});a.mount(window),a.setOptions({layoutScroll:!0}),rootProjectionNode.current=a}return rootProjectionNode.current},resetTransform:(a,_)=>{a.style.transform=_!==void 0?_:"none"},checkIsScrollRoot:a=>window.getComputedStyle(a).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 a=window.matchMedia("(prefers-reduced-motion)"),_=()=>prefersReducedMotion.current=a.matches;a.addListener(_),_()}else prefersReducedMotion.current=!1}function updateMotionValuesFromProps(a,_,$){const{willChange:j}=_;for(const et in _){const tt=_[et],rt=$[et];if(isMotionValue(tt))a.addValue(et,tt),isWillChangeMotionValue(j)&&j.add(et);else if(isMotionValue(rt))a.addValue(et,motionValue(tt,{owner:a})),isWillChangeMotionValue(j)&&j.remove(et);else if(rt!==tt)if(a.hasValue(et)){const nt=a.getValue(et);nt.liveStyle===!0?nt.jump(tt):nt.hasAnimated||nt.set(tt)}else{const nt=a.getStaticValue(et);a.addValue(et,motionValue(nt!==void 0?nt:tt,{owner:a}))}}for(const et in $)_[et]===void 0&&a.removeValue(et);return _}const visualElementStore=new WeakMap,valueTypes=[...dimensionValueTypes,color$1,complex],findValueType=a=>valueTypes.find(testValueType(a)),featureNames=Object.keys(featureDefinitions),numFeatures=featureNames.length,propEventHandlers=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],numVariantProps=variantProps.length;function getClosestProjectingNode(a){if(a)return a.options.allowProjection!==!1?a.projection:getClosestProjectingNode(a.parent)}class VisualElement{scrapeMotionValuesFromProps(_,$,j){return{}}constructor({parent:_,props:$,presenceContext:j,reducedMotionConfig:et,blockInitialAnimation:tt,visualState:rt},nt={}){this.resolveKeyframes=(ut,ht,yt,wt)=>new this.KeyframeResolver(ut,ht,yt,wt,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:st}=rt;this.latestValues=it,this.baseTarget={...it},this.initialValues=$.initial?{...it}:{},this.renderState=st,this.parent=_,this.props=$,this.presenceContext=j,this.depth=_?_.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=!!(_&&_.current);const{willChange:ot,...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(ot)&&ot.add(ut))}}mount(_){this.current=_,visualElementStore.set(_,this),this.projection&&!this.projection.instance&&this.projection.mount(_),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 _;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)(_=this.features[$])===null||_===void 0||_.unmount();this.current=null}bindToMotionValue(_,$){const j=transformProps.has(_),et=$.on("change",rt=>{this.latestValues[_]=rt,this.props.onUpdate&&frame.preRender(this.notifyUpdate),j&&this.projection&&(this.projection.isTransformDirty=!0)}),tt=$.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(_,()=>{et(),tt(),$.owner&&$.stop()})}sortNodePosition(_){return!this.current||!this.sortInstanceNodePosition||this.type!==_.type?0:this.sortInstanceNodePosition(this.current,_.current)}loadFeatures({children:_,...$},j,et,tt){let rt,nt;for(let it=0;itthis.scheduleRender(),animationType:typeof st=="string"?st:"both",initialPromotionConfig:tt,layoutScroll:ut,layoutRoot:ht})}return nt}updateFeatures(){for(const _ in this.features){const $=this.features[_];$.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(_){return this.latestValues[_]}setStaticValue(_,$){this.latestValues[_]=$}update(_,$){(_.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=_,this.prevPresenceContext=this.presenceContext,this.presenceContext=$;for(let j=0;j$.variantChildren.delete(_)}addValue(_,$){const j=this.values.get(_);$!==j&&(j&&this.removeValue(_),this.bindToMotionValue(_,$),this.values.set(_,$),this.latestValues[_]=$.get())}removeValue(_){this.values.delete(_);const $=this.valueSubscriptions.get(_);$&&($(),this.valueSubscriptions.delete(_)),delete this.latestValues[_],this.removeValueFromRenderState(_,this.renderState)}hasValue(_){return this.values.has(_)}getValue(_,$){if(this.props.values&&this.props.values[_])return this.props.values[_];let j=this.values.get(_);return j===void 0&&$!==void 0&&(j=motionValue($===null?void 0:$,{owner:this}),this.addValue(_,j)),j}readValue(_,$){var j;let et=this.latestValues[_]!==void 0||!this.current?this.latestValues[_]:(j=this.getBaseTargetFromProps(this.props,_))!==null&&j!==void 0?j:this.readValueFromInstance(this.current,_,this.options);return et!=null&&(typeof et=="string"&&(isNumericalString(et)||isZeroValueString(et))?et=parseFloat(et):!findValueType(et)&&complex.test($)&&(et=getAnimatableNone(_,$)),this.setBaseTarget(_,isMotionValue(et)?et.get():et)),isMotionValue(et)?et.get():et}setBaseTarget(_,$){this.baseTarget[_]=$}getBaseTarget(_){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[_])}if(j&&et!==void 0)return et;const tt=this.getBaseTargetFromProps(this.props,_);return tt!==void 0&&!isMotionValue(tt)?tt:this.initialValues[_]!==void 0&&et===void 0?void 0:this.baseTarget[_]}on(_,$){return this.events[_]||(this.events[_]=new SubscriptionManager),this.events[_].add($)}notify(_,...$){this.events[_]&&this.events[_].notify(...$)}}class DOMVisualElement extends VisualElement{constructor(){super(...arguments),this.KeyframeResolver=DOMKeyframesResolver}sortInstanceNodePosition(_,$){return _.compareDocumentPosition($)&2?1:-1}getBaseTargetFromProps(_,$){return _.style?_.style[$]:void 0}removeValueFromRenderState(_,{vars:$,style:j}){delete $[_],delete j[_]}}function getComputedStyle$2(a){return window.getComputedStyle(a)}class HTMLVisualElement extends DOMVisualElement{constructor(){super(...arguments),this.type="html"}readValueFromInstance(_,$){if(transformProps.has($)){const j=getDefaultValueType($);return j&&j.default||0}else{const j=getComputedStyle$2(_),et=(isCSSVariableName($)?j.getPropertyValue($):j[$])||0;return typeof et=="string"?et.trim():et}}measureInstanceViewportBox(_,{transformPagePoint:$}){return measureViewportBox(_,$)}build(_,$,j,et){buildHTMLStyles(_,$,j,et.transformTemplate)}scrapeMotionValuesFromProps(_,$,j){return scrapeMotionValuesFromProps$1(_,$,j)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:_}=this.props;isMotionValue(_)&&(this.childSubscription=_.on("change",$=>{this.current&&(this.current.textContent=`${$}`)}))}renderInstance(_,$,j,et){renderHTML(_,$,j,et)}}class SVGVisualElement extends DOMVisualElement{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1}getBaseTargetFromProps(_,$){return _[$]}readValueFromInstance(_,$){if(transformProps.has($)){const j=getDefaultValueType($);return j&&j.default||0}return $=camelCaseAttributes.has($)?$:camelToDash($),_.getAttribute($)}measureInstanceViewportBox(){return createBox()}scrapeMotionValuesFromProps(_,$,j){return scrapeMotionValuesFromProps(_,$,j)}build(_,$,j,et){buildSVGAttrs(_,$,j,this.isSVGTag,et.transformTemplate)}renderInstance(_,$,j,et){renderSVG(_,$,j,et)}mount(_){this.isSVGTag=isSVGTag(_.tagName),super.mount(_)}}const createDomVisualElement=(a,_)=>isSVGComponent(a)?new SVGVisualElement(_,{enableHardwareAcceleration:!1}):new HTMLVisualElement(_,{allowProjection:a!==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 a=reactExports.useRef(!1);return useIsomorphicLayoutEffect$2(()=>(a.current=!0,()=>{a.current=!1}),[]),a}function useForceUpdate(){const a=useIsMounted(),[_,$]=reactExports.useState(0),j=reactExports.useCallback(()=>{a.current&&$(_+1)},[_]);return[reactExports.useCallback(()=>frame.postRender(j),[j]),_]}class PopChildMeasure extends reactExports.Component{getSnapshotBeforeUpdate(_){const $=this.props.childRef.current;if($&&_.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:a,isPresent:_}){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:st}=et.current;if(_||!j.current||!rt||!nt)return;j.current.dataset.motionPopId=$;const ot=document.createElement("style");return tt&&(ot.nonce=tt),document.head.appendChild(ot),ot.sheet&&ot.sheet.insertRule(` - [data-motion-pop-id="${$}"] { - position: absolute !important; - width: ${rt}px !important; - height: ${nt}px !important; - top: ${it}px !important; - left: ${st}px !important; - } - `),()=>{document.head.removeChild(ot)}},[_]),jsxRuntimeExports.jsx(PopChildMeasure,{isPresent:_,childRef:j,sizeRef:et,children:reactExports.cloneElement(a,{ref:j})})}const PresenceChild=({children:a,initial:_,isPresent:$,onExitComplete:j,custom:et,presenceAffectsLayout:tt,mode:rt})=>{const nt=useConstant(newChildrenMap),it=reactExports.useId(),st=reactExports.useMemo(()=>({id:it,initial:_,isPresent:$,custom:et,onExitComplete:ot=>{nt.set(ot,!0);for(const at of nt.values())if(!at)return;j&&j()},register:ot=>(nt.set(ot,!1),()=>nt.delete(ot))}),tt?[Math.random()]:[$]);return reactExports.useMemo(()=>{nt.forEach((ot,at)=>nt.set(at,!1))},[$]),reactExports.useEffect(()=>{!$&&!nt.size&&j&&j()},[$]),rt==="popLayout"&&(a=jsxRuntimeExports.jsx(PopChild,{isPresent:$,children:a})),jsxRuntimeExports.jsx(PresenceContext.Provider,{value:st,children:a})};function newChildrenMap(){return new Map}function useUnmountEffect(a){return reactExports.useEffect(()=>()=>a(),[])}const getChildKey=a=>a.key||"";function updateChildLookup(a,_){a.forEach($=>{const j=getChildKey($);_.set(j,$)})}function onlyElements(a){const _=[];return reactExports.Children.forEach(a,$=>{reactExports.isValidElement($)&&_.push($)}),_}const AnimatePresence=({children:a,custom:_,initial:$=!0,onExitComplete:j,exitBeforeEnter:et,presenceAffectsLayout:tt=!0,mode:rt="sync"})=>{const nt=reactExports.useContext(LayoutGroupContext).forceRender||useForceUpdate()[0],it=useIsMounted(),st=onlyElements(a);let ot=st;const at=reactExports.useRef(new Map).current,ut=reactExports.useRef(ot),ht=reactExports.useRef(new Map).current,yt=reactExports.useRef(!0);if(useIsomorphicLayoutEffect$2(()=>{yt.current=!1,updateChildLookup(st,ht),ut.current=ot}),useUnmountEffect(()=>{yt.current=!0,ht.clear(),at.clear()}),yt.current)return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:ot.map($t=>jsxRuntimeExports.jsx(PresenceChild,{isPresent:!0,initial:$?void 0:!1,presenceAffectsLayout:tt,mode:rt,children:$t},getChildKey($t)))});ot=[...ot];const wt=ut.current.map(getChildKey),Ct=st.map(getChildKey),Pt=wt.length;for(let $t=0;$t{if(Ct.indexOf(Mt)!==-1)return;const Lt=ht.get(Mt);if(!Lt)return;const Dt=wt.indexOf(Mt);let zt=$t;if(!zt){const Ot=()=>{at.delete(Mt);const It=Array.from(ht.keys()).filter(Bt=>!Ct.includes(Bt));if(It.forEach(Bt=>ht.delete(Bt)),ut.current=st.filter(Bt=>{const Ft=getChildKey(Bt);return Ft===Mt||It.includes(Ft)}),!at.size){if(it.current===!1)return;nt(),j&&j()}};zt=jsxRuntimeExports.jsx(PresenceChild,{isPresent:!1,onExitComplete:Ot,custom:_,presenceAffectsLayout:tt,mode:rt,children:Lt},getChildKey(Lt)),at.set(Mt,zt)}ot.splice(Dt,0,zt)}),ot=ot.map($t=>{const Mt=$t.key;return at.has(Mt)?$t:jsxRuntimeExports.jsx(PresenceChild,{isPresent:!0,presenceAffectsLayout:tt,mode:rt,children:$t},getChildKey($t))}),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:at.size?ot:ot.map($t=>reactExports.cloneElement($t))})};var toastMotionVariants={initial:a=>{const{position:_}=a,$=["top","bottom"].includes(_)?"y":"x";let j=["top-right","bottom-right"].includes(_)?1:-1;return _==="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(a=>{const{id:_,message:$,onCloseComplete:j,onRequestRemove:et,requestClose:tt=!1,position:rt="bottom",duration:nt=5e3,containerStyle:it,motionVariants:st=toastMotionVariants,toastSpacing:ot="0.5rem"}=a,[at,ut]=reactExports.useState(nt),ht=useIsPresent();useUpdateEffect(()=>{ht||j==null||j()},[ht]),useUpdateEffect(()=>{ut(nt)},[nt]);const yt=()=>ut(null),wt=()=>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:ot,...it}),[it,ot]),$t=reactExports.useMemo(()=>getToastStyle(rt),[rt]);return jsxRuntimeExports.jsx(motion.div,{layout:!0,className:"chakra-toast",variants:st,initial:"initial",animate:"animate",exit:"exit",onHoverStart:yt,onHoverEnd:wt,custom:{position:rt},style:$t,children:jsxRuntimeExports.jsx(chakra.div,{role:"status","aria-atomic":"true",className:"chakra-toast__inner",__css:Pt,children:runIfFn$2($,{id:_,onClose:Ct})})})});ToastComponent.displayName="ToastComponent";function getToastPlacement(a,_){var $;const j=a??"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[_])!=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,...st}=a,ot=cx("chakra-icon",nt),at=useStyleConfig("Icon",a),ut={w:"1em",h:"1em",display:"inline-block",lineHeight:"1em",flexShrink:0,color:et,...it,...at},ht={ref:_,focusable:tt,className:ot,__css:ut},yt=j??fallbackIcon.viewBox;if($&&typeof $!="string")return jsxRuntimeExports.jsx(chakra.svg,{as:$,...ht,...st});const wt=rt??fallbackIcon.path;return jsxRuntimeExports.jsx(chakra.svg,{verticalAlign:"middle",viewBox:yt,...ht,...st,children:wt})});Icon.displayName="Icon";function createIcon(a){const{viewBox:_="0 0 24 24",d:$,displayName:j,defaultProps:et={}}=a,tt=reactExports.Children.toArray(a.path),rt=forwardRef((nt,it)=>jsxRuntimeExports.jsx(Icon,{ref:it,viewBox:_,...et,...nt,children:tt.length?tt:jsxRuntimeExports.jsx("path",{fill:"currentColor",d:$})}));return rt.displayName=j,rt}function CheckIcon$3(a){return jsxRuntimeExports.jsx(Icon,{viewBox:"0 0 24 24",...a,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(a){return jsxRuntimeExports.jsx(Icon,{viewBox:"0 0 24 24",...a,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(a){return jsxRuntimeExports.jsx(Icon,{viewBox:"0 0 24 24",...a,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",a),{label:j="Loading...",thickness:et="2px",speed:tt="0.45s",emptyColor:rt="transparent",className:nt,...it}=omitThemingProps(a),st=cx("chakra-spinner",nt),ot={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:_,__css:ot,className:st,...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(a){return STATUSES[a].colorScheme}function getStatusIcon(a){return STATUSES[a].icon}var AlertDescription=forwardRef(function(_,$){const j=useAlertStyles(),{status:et}=useAlertContext(),tt={display:"inline",...j.description};return jsxRuntimeExports.jsx(chakra.div,{ref:$,"data-status":et,..._,className:cx("chakra-alert__desc",_.className),__css:tt})});AlertDescription.displayName="AlertDescription";function AlertIcon(a){const{status:_}=useAlertContext(),$=getStatusIcon(_),j=useAlertStyles(),et=_==="loading"?j.spinner:j.icon;return jsxRuntimeExports.jsx(chakra.span,{display:"inherit","data-status":_,...a,className:cx("chakra-alert__icon",a.className),__css:et,children:a.children||jsxRuntimeExports.jsx($,{h:"100%",w:"100%"})})}AlertIcon.displayName="AlertIcon";var AlertTitle=forwardRef(function(_,$){const j=useAlertStyles(),{status:et}=useAlertContext();return jsxRuntimeExports.jsx(chakra.div,{ref:$,"data-status":et,..._,className:cx("chakra-alert__title",_.className),__css:j.title})});AlertTitle.displayName="AlertTitle";var Alert=forwardRef(function(_,$){var j;const{status:et="info",addRole:tt=!0,...rt}=omitThemingProps(_),nt=(j=_.colorScheme)!=null?j:getStatusColorScheme(et),it=useMultiStyleConfig("Alert",{..._,colorScheme:nt}),st={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",_.className),__css:st})})})});Alert.displayName="Alert";function CloseIcon(a){return jsxRuntimeExports.jsx(Icon,{focusable:"false","aria-hidden":!0,...a,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(_,$){const j=useStyleConfig("CloseButton",_),{children:et,isDisabled:tt,__css:rt,...nt}=omitThemingProps(_),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(a){let _=a;const $=new Set,j=et=>{_=et(_),$.forEach(tt=>tt())};return{getState:()=>_,subscribe:et=>($.add(et),()=>{j(()=>a),$.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(st=>{var ot,at;const ht=nt.includes("top")?[rt,...(ot=st[nt])!=null?ot:[]]:[...(at=st[nt])!=null?at:[],rt];return{...st,[nt]:ht}}),it},update:(et,tt)=>{et&&j(rt=>{const nt={...rt},{position:it,index:st}=findToast(nt,et);return it&&st!==-1&&(nt[it][st]={...nt[it][st],...tt,message:createRenderToast(tt)}),nt})},closeAll:({positions:et}={})=>{j(tt=>(et??["bottom","bottom-right","bottom-left","top","top-left","top-right"]).reduce((it,st)=>(it[st]=tt[st].map(ot=>({...ot,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=($=_.id)!=null?$:counter,tt=(j=_.position)!=null?j:"bottom";return{id:et,message:a,position:tt,duration:_.duration,onCloseComplete:_.onCloseComplete,onRequestRemove:()=>toastStore.removeToast(String(et),tt),status:_.status,requestClose:!1,containerStyle:_.containerStyle}}var Toast=a=>{const{status:_,variant:$="solid",id:j,title:et,isClosable:tt,onClose:rt,description:nt,colorScheme:it,icon:st}=a,ot=j?{root:`toast-${j}`,title:`toast-${j}-title`,description:`toast-${j}-description`}:void 0;return jsxRuntimeExports.jsxs(Alert,{addRole:!1,status:_,variant:$,id:ot==null?void 0:ot.root,alignItems:"start",borderRadius:"md",boxShadow:"lg",paddingEnd:8,textAlign:"start",width:"auto",colorScheme:it,children:[jsxRuntimeExports.jsx(AlertIcon,{children:st}),jsxRuntimeExports.jsxs(chakra.div,{flex:"1",maxWidth:"100%",children:[et&&jsxRuntimeExports.jsx(AlertTitle,{id:ot==null?void 0:ot.title,children:et}),nt&&jsxRuntimeExports.jsx(AlertDescription,{id:ot==null?void 0:ot.description,display:"block",children:nt})]}),tt&&jsxRuntimeExports.jsx(CloseButton,{size:"sm",onClick:rt,position:"absolute",insetEnd:1,top:1})]})};function createRenderToast(a={}){const{render:_,toastComponent:$=Toast}=a;return et=>typeof _=="function"?_({...et,...a}):jsxRuntimeExports.jsx($,{...et,...a})}function createToastFn(a,_){const $=et=>{var tt;return{..._,...et,position:getToastPlacement((tt=et==null?void 0:et.position)!=null?tt:_==null?void 0:_.position,a)}},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=a=>{const _=reactExports.useSyncExternalStore(toastStore.subscribe,toastStore.getState,toastStore.getState),{motionVariants:$,component:j=ToastComponent,portalProps:et}=a,rt=Object.keys(_).map(nt=>{const it=_[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(st=>jsxRuntimeExports.jsx(j,{motionVariants:$,...st},st.id))})},nt)});return jsxRuntimeExports.jsx(Portal,{...et,children:rt})};function useToast(a){const{theme:_}=useChakra(),$=useToastOptionContext();return reactExports.useMemo(()=>createToastFn(_.direction,{...$,...a}),[a,_.direction,$])}var createChakraProvider=a=>function({children:$,theme:j=a,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,_,$)=>_ in a?__defProp$8(a,_,{enumerable:!0,configurable:!0,writable:!0,value:$}):a[_]=$,__publicField$3=(a,_,$)=>(__defNormalProp$3(a,typeof _!="symbol"?_+"":_,$),$);function sortNodes(a){return a.sort((_,$)=>{const j=_.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=a=>typeof a=="object"&&"nodeType"in a&&a.nodeType===Node.ELEMENT_NODE;function getNextIndex(a,_,$){let j=a+1;return $&&j>=_&&(j=0),j}function getPrevIndex(a,_,$){let j=a-1;return $&&j<0&&(j=_),j}var useSafeLayoutEffect$1=typeof window<"u"?reactExports.useLayoutEffect:reactExports.useEffect,cast=a=>a,DescendantsManager=class{constructor(){__publicField$3(this,"descendants",new Map),__publicField$3(this,"register",a=>{if(a!=null)return isElement$3(a)?this.registerNode(a):_=>{this.registerNode(_,a)}}),__publicField$3(this,"unregister",a=>{this.descendants.delete(a);const _=sortNodes(Array.from(this.descendants.keys()));this.assignIndex(_)}),__publicField$3(this,"destroy",()=>{this.descendants.clear()}),__publicField$3(this,"assignIndex",a=>{this.descendants.forEach(_=>{const $=a.indexOf(_.node);_.index=$,_.node.dataset.index=_.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((_,$)=>_.index-$.index)),__publicField$3(this,"enabledValues",()=>this.values().filter(a=>!a.disabled)),__publicField$3(this,"item",a=>{if(this.count()!==0)return this.values()[a]}),__publicField$3(this,"enabledItem",a=>{if(this.enabledCount()!==0)return this.enabledValues()[a]}),__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 a=this.enabledValues().length-1;return this.enabledItem(a)}),__publicField$3(this,"indexOf",a=>{var _,$;return a&&($=(_=this.descendants.get(a))==null?void 0:_.index)!=null?$:-1}),__publicField$3(this,"enabledIndexOf",a=>a==null?-1:this.enabledValues().findIndex(_=>_.node.isSameNode(a))),__publicField$3(this,"next",(a,_=!0)=>{const $=getNextIndex(a,this.count(),_);return this.item($)}),__publicField$3(this,"nextEnabled",(a,_=!0)=>{const $=this.item(a);if(!$)return;const j=this.enabledIndexOf($.node),et=getNextIndex(j,this.enabledCount(),_);return this.enabledItem(et)}),__publicField$3(this,"prev",(a,_=!0)=>{const $=getPrevIndex(a,this.count()-1,_);return this.item($)}),__publicField$3(this,"prevEnabled",(a,_=!0)=>{const $=this.item(a);if(!$)return;const j=this.enabledIndexOf($.node),et=getPrevIndex(j,this.enabledCount()-1,_);return this.enabledItem(et)}),__publicField$3(this,"registerNode",(a,_)=>{if(!a||this.descendants.has(a))return;const $=Array.from(this.descendants.keys()).concat(a),j=sortNodes($);_!=null&&_.disabled&&(_.disabled=!!_.disabled);const et={node:a,index:-1,..._};this.descendants.set(a,et),this.assignIndex(j)})}};function assignRef$1(a,_){if(a!=null){if(typeof a=="function"){a(_);return}try{a.current=_}catch{throw new Error(`Cannot assign value '${_}' to ref '${a}'`)}}}function mergeRefs(...a){return _=>{a.forEach($=>{assignRef$1($,_)})}}function useMergeRefs$1(...a){return reactExports.useMemo(()=>mergeRefs(...a),a)}function useDescendants(){const a=reactExports.useRef(new DescendantsManager);return useSafeLayoutEffect$1(()=>()=>a.current.destroy()),a.current}var[DescendantsContextProvider,useDescendantsContext]=createContext$1({name:"DescendantsProvider",errorMessage:"useDescendantsContext must be used within DescendantsProvider"});function useDescendant(a){const _=useDescendantsContext(),[$,j]=reactExports.useState(-1),et=reactExports.useRef(null);useSafeLayoutEffect$1(()=>()=>{et.current&&_.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:_,index:$,enabledIndex:_.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(_,$){const{getButtonProps:j}=useAccordionItemContext(),et=j(_,$),rt={display:"flex",alignItems:"center",width:"100%",outline:0,...useAccordionStyles().button};return jsxRuntimeExports.jsx(chakra.button,{...et,className:cx("chakra-accordion__button",_.className),__css:rt})});AccordionButton.displayName="AccordionButton";function useControllableState(a){const{value:_,defaultValue:$,onChange:j,shouldUpdate:et=(ut,ht)=>ut!==ht}=a,tt=useCallbackRef$2(j),rt=useCallbackRef$2(et),[nt,it]=reactExports.useState($),st=_!==void 0,ot=st?_:nt,at=useCallbackRef$2(ut=>{const yt=typeof ut=="function"?ut(ot):ut;rt(ot,yt)&&(st||it(yt),tt(yt))},[st,tt,ot,rt]);return[ot,at]}function useAccordion(a){const{onChange:_,defaultIndex:$,index:j,allowMultiple:et,allowToggle:tt,...rt}=a;allowMultipleWarning(a),allowMultipleAndAllowToggleWarning(a);const nt=useAccordionDescendants(),[it,st]=reactExports.useState(-1);reactExports.useEffect(()=>()=>{st(-1)},[]);const[ot,at]=useControllableState({value:j,defaultValue(){return et?$??[]:$??-1},onChange:_});return{index:ot,setIndex:at,htmlProps:rt,getAccordionItemProps:ht=>{let yt=!1;return ht!==null&&(yt=Array.isArray(ot)?ot.includes(ht):ot===ht),{isOpen:yt,onChange:Ct=>{if(ht!==null)if(et&&Array.isArray(ot)){const Pt=Ct?ot.concat(ht):ot.filter($t=>$t!==ht);at(Pt)}else Ct?at(ht):tt&&at(-1)}}},focusedIndex:it,setFocusedIndex:st,descendants:nt}}var[AccordionProvider,useAccordionContext]=createContext$1({name:"AccordionContext",hookName:"useAccordionContext",providerName:"Accordion"});function useAccordionItem(a){const{isDisabled:_,isFocusable:$,id:j,...et}=a,{getAccordionItemProps:tt,setFocusedIndex:rt}=useAccordionContext(),nt=reactExports.useRef(null),it=reactExports.useId(),st=j??it,ot=`accordion-button-${st}`,at=`accordion-panel-${st}`;focusableNotDisabledWarning(a);const{register:ut,index:ht,descendants:yt}=useAccordionDescendant({disabled:_&&!$}),{isOpen:wt,onChange:Ct}=tt(ht===-1?null:ht);warnIfOpenAndDisabled({isOpen:wt,isDisabled:_});const Pt=()=>{Ct==null||Ct(!0)},$t=()=>{Ct==null||Ct(!1)},Mt=reactExports.useCallback(()=>{Ct==null||Ct(!wt),rt(ht)},[ht,rt,wt,Ct]),Lt=reactExports.useCallback(It=>{const Ft={ArrowDown:()=>{const jt=yt.nextEnabled(ht);jt==null||jt.node.focus()},ArrowUp:()=>{const jt=yt.prevEnabled(ht);jt==null||jt.node.focus()},Home:()=>{const jt=yt.firstEnabled();jt==null||jt.node.focus()},End:()=>{const jt=yt.lastEnabled();jt==null||jt.node.focus()}}[It.key];Ft&&(It.preventDefault(),Ft(It))},[yt,ht]),Dt=reactExports.useCallback(()=>{rt(ht)},[rt,ht]),zt=reactExports.useCallback(function(Bt={},Ft=null){return{...Bt,type:"button",ref:mergeRefs(ut,nt,Ft),id:ot,disabled:!!_,"aria-expanded":!!wt,"aria-controls":at,onClick:callAllHandlers$1(Bt.onClick,Mt),onFocus:callAllHandlers$1(Bt.onFocus,Dt),onKeyDown:callAllHandlers$1(Bt.onKeyDown,Lt)}},[ot,_,wt,Mt,Dt,Lt,at,ut]),Ot=reactExports.useCallback(function(Bt={},Ft=null){return{...Bt,ref:Ft,role:"region",id:at,"aria-labelledby":ot,hidden:!wt}},[ot,wt,at]);return{isOpen:wt,isDisabled:_,isFocusable:$,onOpen:Pt,onClose:$t,getButtonProps:zt,getPanelProps:Ot,htmlProps:et}}function allowMultipleWarning(a){const _=a.index||a.defaultIndex,$=_!=null&&!Array.isArray(_)&&a.allowMultiple;warn({condition:!!$,message:`If 'allowMultiple' is passed, then 'index' or 'defaultIndex' must be an array. You passed: ${typeof _},`})}function allowMultipleAndAllowToggleWarning(a){warn({condition:!!(a.allowMultiple&&a.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(a){warn({condition:!!(a.isFocusable&&!a.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(a){warn({condition:a.isOpen&&!!a.isDisabled,message:"Cannot open a disabled accordion item"})}function AccordionIcon(a){const{isOpen:_,isDisabled:$}=useAccordionItemContext(),{reduceMotion:j}=useAccordionContext(),et=cx("chakra-accordion__icon",a.className),tt=useAccordionStyles(),rt={opacity:$?.4:1,transform:_?"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,...a,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(_,$){const{children:j,className:et}=_,{htmlProps:tt,...rt}=useAccordionItem(_),it={...useAccordionStyles().container,overflowAnchor:"none"},st=reactExports.useMemo(()=>rt,[rt]);return jsxRuntimeExports.jsx(AccordionItemProvider,{value:st,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(a){var _;switch((_=a==null?void 0:a.direction)!=null?_:"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,_)=>({...a,delay:typeof _=="number"?_:_==null?void 0:_.enter}),exit:(a,_)=>({...a,delay:typeof _=="number"?_:_==null?void 0:_.exit})},isNumeric$1=a=>a!=null&&parseInt(a.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:a,startingHeight:_,transition:$,transitionEnd:j,delay:et})=>{var tt;return{...a&&{opacity:isNumeric$1(_)?1:0},height:_,transitionEnd:j==null?void 0:j.exit,transition:(tt=$==null?void 0:$.exit)!=null?tt:withDelay.exit(defaultTransitions.exit,et)}},enter:({animateOpacity:a,endingHeight:_,transition:$,transitionEnd:j,delay:et})=>{var tt;return{...a&&{opacity:1},height:_,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:st,transitionEnd:ot,...at}=a,[ut,ht]=reactExports.useState(!1);reactExports.useEffect(()=>{const $t=setTimeout(()=>{ht(!0)});return()=>clearTimeout($t)},[]),warn({condition:Number(tt)>0&&!!j,message:"startingHeight and unmountOnExit are mutually exclusive. You can't use them together"});const yt=parseFloat(tt.toString())>0,wt={startingHeight:tt,endingHeight:rt,animateOpacity:et,transition:ut?st:{enter:{duration:0}},transitionEnd:{enter:ot==null?void 0:ot.enter,exit:j?ot==null?void 0:ot.exit:{...ot==null?void 0:ot.exit,display:yt?"block":"none"}}},Ct=j?$:!0,Pt=$||j?"enter":"exit";return jsxRuntimeExports.jsx(AnimatePresence,{initial:!1,custom:wt,children:Ct&&jsxRuntimeExports.jsx(motion.div,{ref:_,...at,className:cx("chakra-collapse",it),style:{overflow:"hidden",display:"block",...nt},custom:wt,variants:variants$4,initial:j?"exit":!1,animate:Pt,exit:"exit"})})});Collapse.displayName="Collapse";var variants$3={enter:({transition:a,transitionEnd:_,delay:$}={})=>{var j;return{opacity:1,transition:(j=a==null?void 0:a.enter)!=null?j:withDelay.enter(TRANSITION_DEFAULTS.enter,$),transitionEnd:_==null?void 0:_.enter}},exit:({transition:a,transitionEnd:_,delay:$}={})=>{var j;return{opacity:0,transition:(j=a==null?void 0:a.exit)!=null?j:withDelay.exit(TRANSITION_DEFAULTS.exit,$),transitionEnd:_==null?void 0:_.exit}}},fadeConfig={initial:"exit",animate:"enter",exit:"exit",variants:variants$3},Fade=reactExports.forwardRef(function(_,$){const{unmountOnExit:j,in:et,className:tt,transition:rt,transitionEnd:nt,delay:it,...st}=_,ot=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:ot,...st})})});Fade.displayName="Fade";var variants$2={exit:({reverse:a,initialScale:_,transition:$,transitionEnd:j,delay:et})=>{var tt;return{opacity:0,...a?{scale:_,transitionEnd:j==null?void 0:j.exit}:{transitionEnd:{scale:_,...j==null?void 0:j.exit}},transition:(tt=$==null?void 0:$.exit)!=null?tt:withDelay.exit(TRANSITION_DEFAULTS.exit,et)}},enter:({transitionEnd:a,transition:_,delay:$})=>{var j;return{opacity:1,scale:1,transition:(j=_==null?void 0:_.enter)!=null?j:withDelay.enter(TRANSITION_DEFAULTS.enter,$),transitionEnd:a==null?void 0:a.enter}}},scaleFadeConfig={initial:"exit",animate:"enter",exit:"exit",variants:variants$2},ScaleFade=reactExports.forwardRef(function(_,$){const{unmountOnExit:j,in:et,reverse:tt=!0,initialScale:rt=.95,className:nt,transition:it,transitionEnd:st,delay:ot,...at}=_,ut=j?et&&j:!0,ht=et||j?"enter":"exit",yt={initialScale:rt,reverse:tt,transition:it,transitionEnd:st,delay:ot};return jsxRuntimeExports.jsx(AnimatePresence,{custom:yt,children:ut&&jsxRuntimeExports.jsx(motion.div,{ref:$,className:cx("chakra-offset-slide",nt),...scaleFadeConfig,animate:ht,custom:yt,...at})})});ScaleFade.displayName="ScaleFade";var variants$1={initial:({offsetX:a,offsetY:_,transition:$,transitionEnd:j,delay:et})=>{var tt;return{opacity:0,x:a,y:_,transition:(tt=$==null?void 0:$.exit)!=null?tt:withDelay.exit(TRANSITION_DEFAULTS.exit,et),transitionEnd:j==null?void 0:j.exit}},enter:({transition:a,transitionEnd:_,delay:$})=>{var j;return{opacity:1,x:0,y:0,transition:(j=a==null?void 0:a.enter)!=null?j:withDelay.enter(TRANSITION_DEFAULTS.enter,$),transitionEnd:_==null?void 0:_.enter}},exit:({offsetY:a,offsetX:_,transition:$,transitionEnd:j,reverse:et,delay:tt})=>{var rt;const nt={x:_,y:a};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(_,$){const{unmountOnExit:j,in:et,reverse:tt=!0,className:rt,offsetX:nt=0,offsetY:it=8,transition:st,transitionEnd:ot,delay:at,...ut}=_,ht=j?et&&j:!0,yt=et||j?"enter":"exit",wt={offsetX:nt,offsetY:it,reverse:tt,transition:st,transitionEnd:ot,delay:at};return jsxRuntimeExports.jsx(AnimatePresence,{custom:wt,children:ht&&jsxRuntimeExports.jsx(motion.div,{ref:$,className:cx("chakra-offset-slide",rt),custom:wt,...slideFadeConfig,animate:yt,...ut})})});SlideFade.displayName="SlideFade";var defaultTransition={exit:{duration:.15,ease:TRANSITION_EASINGS.easeInOut},enter:{type:"spring",damping:25,stiffness:180}},variants={exit:({direction:a,transition:_,transitionEnd:$,delay:j})=>{var et;const{exit:tt}=getSlideTransition({direction:a});return{...tt,transition:(et=_==null?void 0:_.exit)!=null?et:withDelay.exit(defaultTransition.exit,j),transitionEnd:$==null?void 0:$.exit}},enter:({direction:a,transitionEnd:_,transition:$,delay:j})=>{var et;const{enter:tt}=getSlideTransition({direction:a});return{...tt,transition:(et=$==null?void 0:$.enter)!=null?et:withDelay.enter(defaultTransition.enter,j),transitionEnd:_==null?void 0:_.enter}}},Slide=reactExports.forwardRef(function(_,$){const{direction:j="right",style:et,unmountOnExit:tt,in:rt,className:nt,transition:it,transitionEnd:st,delay:ot,motionProps:at,...ut}=_,ht=getSlideTransition({direction:j}),yt=Object.assign({position:"fixed"},ht.position,et),wt=tt?rt&&tt:!0,Ct=rt||tt?"enter":"exit",Pt={transitionEnd:st,transition:it,direction:j,delay:ot};return jsxRuntimeExports.jsx(AnimatePresence,{custom:Pt,children:wt&&jsxRuntimeExports.jsx(motion.div,{...ut,ref:$,initial:"exit",className:cx("chakra-slide",nt),animate:Ct,exit:"exit",custom:Pt,variants,style:yt,...at})})});Slide.displayName="Slide";var AccordionPanel=forwardRef(function(_,$){const{className:j,motionProps:et,...tt}=_,{reduceMotion:rt}=useAccordionContext(),{getPanelProps:nt,isOpen:it}=useAccordionItemContext(),st=nt(tt,$),ot=cx("chakra-accordion__panel",j),at=useAccordionStyles();rt||delete st.hidden;const ut=jsxRuntimeExports.jsx(chakra.div,{...st,__css:at.panel,className:ot});return rt?ut:jsxRuntimeExports.jsx(Collapse,{in:it,...et,children:ut})});AccordionPanel.displayName="AccordionPanel";var Accordion=forwardRef(function({children:_,reduceMotion:$,...j},et){const tt=useMultiStyleConfig("Accordion",j),rt=omitThemingProps(j),{htmlProps:nt,descendants:it,...st}=useAccordion(rt),ot=reactExports.useMemo(()=>({...st,reduceMotion:!!$}),[st,$]);return jsxRuntimeExports.jsx(AccordionDescendantsProvider,{value:it,children:jsxRuntimeExports.jsx(AccordionProvider,{value:ot,children:jsxRuntimeExports.jsx(AccordionStylesProvider,{value:tt,children:jsxRuntimeExports.jsx(chakra.div,{ref:et,...nt,className:cx("chakra-accordion",j.className),__css:tt.root,children:_})})})})});Accordion.displayName="Accordion";var NativeImage=forwardRef(function(_,$){const{htmlWidth:j,htmlHeight:et,alt:tt,...rt}=_;return jsxRuntimeExports.jsx("img",{width:j,height:et,ref:$,alt:tt,...rt})});NativeImage.displayName="NativeImage";function useImage(a){const{loading:_,src:$,srcSet:j,onLoad:et,onError:tt,crossOrigin:rt,sizes:nt,ignoreFallback:it}=a,[st,ot]=reactExports.useState("pending");reactExports.useEffect(()=>{ot($?"loading":"pending")},[$]);const at=reactExports.useRef(),ut=reactExports.useCallback(()=>{if(!$)return;ht();const yt=new Image;yt.src=$,rt&&(yt.crossOrigin=rt),j&&(yt.srcset=j),nt&&(yt.sizes=nt),_&&(yt.loading=_),yt.onload=wt=>{ht(),ot("loaded"),et==null||et(wt)},yt.onerror=wt=>{ht(),ot("failed"),tt==null||tt(wt)},at.current=yt},[$,rt,j,nt,et,tt,_]),ht=()=>{at.current&&(at.current.onload=null,at.current.onerror=null,at.current=null)};return useSafeLayoutEffect$2(()=>{if(!it)return st==="loading"&&ut(),()=>{ht()}},[st,ut,it]),it?"loaded":st}var shouldShowFallbackImage=(a,_)=>a!=="loaded"&&_==="beforeLoadOrError"||a==="failed"&&_==="onError";function omit$4(a,_=[]){const $=Object.assign({},a);for(const j of _)j in $&&delete $[j];return $}var Image$1=forwardRef(function(_,$){const{fallbackSrc:j,fallback:et,src:tt,srcSet:rt,align:nt,fit:it,loading:st,ignoreFallback:ot,crossOrigin:at,fallbackStrategy:ut="beforeLoadOrError",referrerPolicy:ht,...yt}=_,wt=j!==void 0||et!==void 0,Ct=st!=null||ot||!wt,Pt=useImage({..._,crossOrigin:at,ignoreFallback:Ct}),$t=shouldShowFallbackImage(Pt,ut),Mt={ref:$,objectFit:it,objectPosition:nt,...Ct?yt:omit$4(yt,["onError","onLoad"])};return $t?et||jsxRuntimeExports.jsx(chakra.img,{as:NativeImage,className:"chakra-image__placeholder",src:j,...Mt}):jsxRuntimeExports.jsx(chakra.img,{as:NativeImage,src:tt,srcSet:rt,crossOrigin:at,loading:st,referrerPolicy:ht,className:"chakra-image",...Mt})});Image$1.displayName="Image";function getValidChildren(a){return reactExports.Children.toArray(a).filter(_=>reactExports.isValidElement(_))}var[ButtonGroupProvider,useButtonGroup]=createContext$1({strict:!1,name:"ButtonGroupContext"});function useButtonType(a){const[_,$]=reactExports.useState(!a);return{ref:reactExports.useCallback(tt=>{tt&&$(tt.tagName==="BUTTON")},[]),type:_?"button":void 0}}function ButtonIcon(a){const{children:_,className:$,...j}=a,et=reactExports.isValidElement(_)?reactExports.cloneElement(_,{"aria-hidden":!0,focusable:!1}):_,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(a){const{label:_,placement:$,spacing:j="0.5rem",children:et=jsxRuntimeExports.jsx(Spinner,{color:"currentColor",width:"1em",height:"1em"}),className:tt,__css:rt,...nt}=a,it=cx("chakra-button__spinner",tt),st=$==="start"?"marginEnd":"marginStart",ot=reactExports.useMemo(()=>({display:"flex",alignItems:"center",position:_?"relative":"absolute",[st]:_?j:0,fontSize:"1em",lineHeight:"normal",...rt}),[rt,_,st,j]);return jsxRuntimeExports.jsx(chakra.div,{className:it,...nt,__css:ot,children:et})}ButtonSpinner.displayName="ButtonSpinner";var Button=forwardRef((a,_)=>{const $=useButtonGroup(),j=useStyleConfig("Button",{...$,...a}),{isDisabled:et=$==null?void 0:$.isDisabled,isLoading:tt,isActive:rt,children:nt,leftIcon:it,rightIcon:st,loadingText:ot,iconSpacing:at="0.5rem",type:ut,spinner:ht,spinnerPlacement:yt="start",className:wt,as:Ct,...Pt}=omitThemingProps(a),$t=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:Mt,type:Lt}=useButtonType(Ct),Dt={rightIcon:st,leftIcon:it,iconSpacing:at,children:nt};return jsxRuntimeExports.jsxs(chakra.button,{ref:useMergeRefs$1(_,Mt),as:Ct,type:ut??Lt,"data-active":dataAttr(rt),"data-loading":dataAttr(tt),__css:$t,className:cx("chakra-button",wt),...Pt,disabled:et||tt,children:[tt&&yt==="start"&&jsxRuntimeExports.jsx(ButtonSpinner,{className:"chakra-button__spinner--start",label:ot,placement:"start",spacing:at,children:ht}),tt?ot||jsxRuntimeExports.jsx(chakra.span,{opacity:0,children:jsxRuntimeExports.jsx(ButtonContent,{...Dt})}):jsxRuntimeExports.jsx(ButtonContent,{...Dt}),tt&&yt==="end"&&jsxRuntimeExports.jsx(ButtonSpinner,{className:"chakra-button__spinner--end",label:ot,placement:"end",spacing:at,children:ht})]})});Button.displayName="Button";function ButtonContent(a){const{leftIcon:_,rightIcon:$,children:j,iconSpacing:et}=a;return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[_&&jsxRuntimeExports.jsx(ButtonIcon,{marginEnd:et,children:_}),j,$&&jsxRuntimeExports.jsx(ButtonIcon,{marginStart:et,children:$})]})}var IconButton=forwardRef((a,_)=>{const{icon:$,children:j,isRound:et,"aria-label":tt,...rt}=a,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:_,"aria-label":tt,...rt,children:it})});IconButton.displayName="IconButton";var[CardStylesProvider,useCardStyles]=createStylesContext("Card"),CardBody=forwardRef(function(_,$){const{className:j,...et}=_,tt=useCardStyles();return jsxRuntimeExports.jsx(chakra.div,{ref:$,className:cx("chakra-card__body",j),__css:tt.body,...et})}),Card=forwardRef(function(_,$){const{className:j,children:et,direction:tt="column",justify:rt,align:nt,...it}=omitThemingProps(_),st=useMultiStyleConfig("Card",_);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",...st.container},...it,children:jsxRuntimeExports.jsx(CardStylesProvider,{value:st,children:et})})}),[CheckboxGroupProvider,useCheckboxGroupContext]=createContext$1({name:"CheckboxGroupContext",strict:!1});function useInitialAnimationState(a){const[_,$]=reactExports.useState(a),[j,et]=reactExports.useState(!1);return a!==_&&(et(!0),$(a)),j}function CheckIcon$2(a){return jsxRuntimeExports.jsx(chakra.svg,{width:"1.2em",viewBox:"0 0 12 10",style:{fill:"none",strokeWidth:2,stroke:"currentColor",strokeDasharray:16},...a,children:jsxRuntimeExports.jsx("polyline",{points:"1.5 6 4.5 9 10.5 1"})})}function IndeterminateIcon(a){return jsxRuntimeExports.jsx(chakra.svg,{width:"1.2em",viewBox:"0 0 24 24",style:{stroke:"currentColor",strokeWidth:4},...a,children:jsxRuntimeExports.jsx("line",{x1:"21",x2:"3",y1:"12",y2:"12"})})}function CheckboxIcon(a){const{isIndeterminate:_,isChecked:$,...j}=a,et=_?IndeterminateIcon:CheckIcon$2;return $||_?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(a){const{id:_,isRequired:$,isInvalid:j,isDisabled:et,isReadOnly:tt,...rt}=a,nt=reactExports.useId(),it=_||`field-${nt}`,st=`${it}-label`,ot=`${it}-feedback`,at=`${it}-helptext`,[ut,ht]=reactExports.useState(!1),[yt,wt]=reactExports.useState(!1),[Ct,Pt]=reactExports.useState(!1),$t=reactExports.useCallback((Ot={},It=null)=>({id:at,...Ot,ref:mergeRefs(It,Bt=>{Bt&&wt(!0)})}),[at]),Mt=reactExports.useCallback((Ot={},It=null)=>({...Ot,ref:It,"data-focus":dataAttr(Ct),"data-disabled":dataAttr(et),"data-invalid":dataAttr(j),"data-readonly":dataAttr(tt),id:Ot.id!==void 0?Ot.id:st,htmlFor:Ot.htmlFor!==void 0?Ot.htmlFor:it}),[it,et,Ct,j,tt,st]),Lt=reactExports.useCallback((Ot={},It=null)=>({id:ot,...Ot,ref:mergeRefs(It,Bt=>{Bt&&ht(!0)}),"aria-live":"polite"}),[ot]),Dt=reactExports.useCallback((Ot={},It=null)=>({...Ot,...rt,ref:It,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((Ot={},It=null)=>({...Ot,ref:It,role:"presentation","aria-hidden":!0,children:Ot.children||"*"}),[]);return{isRequired:!!$,isInvalid:!!j,isReadOnly:!!tt,isDisabled:!!et,isFocused:!!Ct,onFocus:()=>Pt(!0),onBlur:()=>Pt(!1),hasFeedbackText:ut,setHasFeedbackText:ht,hasHelpText:yt,setHasHelpText:wt,id:it,labelId:st,feedbackId:ot,helpTextId:at,htmlProps:rt,getHelpTextProps:$t,getErrorMessageProps:Lt,getRootProps:Dt,getLabelProps:Mt,getRequiredIndicatorProps:zt}}var FormControl=forwardRef(function(_,$){const j=useMultiStyleConfig("Form",_),et=omitThemingProps(_),{getRootProps:tt,htmlProps:rt,...nt}=useFormControlProvider(et),it=cx("chakra-form-control",_.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(_,$){const j=useFormControlContext(),et=useFormControlStyles(),tt=cx("chakra-form__helper-text",_.className);return jsxRuntimeExports.jsx(chakra.div,{...j==null?void 0:j.getHelpTextProps(_,$),__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",a),j=omitThemingProps(a),et=useFormControlContext();return et!=null&&et.isInvalid?jsxRuntimeExports.jsx(FormErrorStylesProvider,{value:$,children:jsxRuntimeExports.jsx(chakra.div,{...et==null?void 0:et.getErrorMessageProps(j,_),className:cx("chakra-form__error-message",a.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",a.className);return jsxRuntimeExports.jsx(Icon,{ref:_,"aria-hidden":!0,...a,__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(_,$){var j;const et=useStyleConfig("FormLabel",_),tt=omitThemingProps(_),{className:rt,children:nt,requiredIndicator:it=jsxRuntimeExports.jsx(RequiredIndicator,{}),optionalIndicator:st=null,...ot}=tt,at=useFormControlContext(),ut=(j=at==null?void 0:at.getLabelProps(ot,$))!=null?j:{ref:$,...ot};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:st]})});FormLabel.displayName="FormLabel";var RequiredIndicator=forwardRef(function(_,$){const j=useFormControlContext(),et=useFormControlStyles();if(!(j!=null&&j.isRequired))return null;const tt=cx("chakra-form__required-indicator",_.className);return jsxRuntimeExports.jsx(chakra.span,{...j==null?void 0:j.getRequiredIndicatorProps(_,$),__css:et.requiredIndicator,className:tt})});RequiredIndicator.displayName="RequiredIndicator";function useFormControl(a){const{isDisabled:_,isInvalid:$,isReadOnly:j,isRequired:et,...tt}=useFormControlProps(a);return{...tt,disabled:_,readOnly:j,required:et,"aria-invalid":ariaAttr($),"aria-required":ariaAttr(et),"aria-readonly":ariaAttr(j)}}function useFormControlProps(a){var _,$,j;const et=useFormControlContext(),{id:tt,disabled:rt,readOnly:nt,required:it,isRequired:st,isInvalid:ot,isReadOnly:at,isDisabled:ut,onFocus:ht,onBlur:yt,...wt}=a,Ct=a["aria-describedby"]?[a["aria-describedby"]]:[];return et!=null&&et.hasFeedbackText&&(et!=null&&et.isInvalid)&&Ct.push(et.feedbackId),et!=null&&et.hasHelpText&&Ct.push(et.helpTextId),{...wt,"aria-describedby":Ct.join(" ")||void 0,id:tt??(et==null?void 0:et.id),isDisabled:(_=rt??ut)!=null?_:et==null?void 0:et.isDisabled,isReadOnly:($=nt??at)!=null?$:et==null?void 0:et.isReadOnly,isRequired:(j=it??st)!=null?j:et==null?void 0:et.isRequired,isInvalid:ot??(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,yt)}}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(a){return!(a.metaKey||!isMac&&a.altKey||a.ctrlKey||a.key==="Control"||a.key==="Shift"||a.key==="Meta")}function onKeyboardEvent(a){hasEventBeforeFocus=!0,isValidKey(a)&&(modality="keyboard",trigger("keyboard",a))}function onPointerEvent(a){if(modality="pointer",a.type==="mousedown"||a.type==="pointerdown"){hasEventBeforeFocus=!0;const _=a.composedPath?a.composedPath()[0]:a.target;let $=!1;try{$=_.matches(":focus-visible")}catch{}if($)return;trigger("pointer",a)}}function isVirtualClick(a){return a.mozInputSource===0&&a.isTrusted?!0:a.detail===0&&!a.pointerType}function onClickEvent(a){isVirtualClick(a)&&(hasEventBeforeFocus=!0,modality="virtual")}function onWindowFocus(a){a.target===window||a.target===document||(!hasEventBeforeFocus&&!hasBlurredWindowRecently&&(modality="virtual",trigger("virtual",a)),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:a}=HTMLElement.prototype;HTMLElement.prototype.focus=function(...$){hasEventBeforeFocus=!0,a.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(a){setupGlobalFocusEvents(),a(isFocusVisible());const _=()=>a(isFocusVisible());return handlers.add(_),()=>{handlers.delete(_)}}function omit$3(a,_=[]){const $=Object.assign({},a);for(const j of _)j in $&&delete $[j];return $}function useCheckbox(a={}){const _=useFormControlProps(a),{isDisabled:$,isReadOnly:j,isRequired:et,isInvalid:tt,id:rt,onBlur:nt,onFocus:it,"aria-describedby":st}=_,{defaultChecked:ot,isChecked:at,isFocusable:ut,onChange:ht,isIndeterminate:yt,name:wt,value:Ct,tabIndex:Pt=void 0,"aria-label":$t,"aria-labelledby":Mt,"aria-invalid":Lt,...Dt}=a,zt=omit$3(Dt,["isDisabled","isReadOnly","isRequired","isInvalid","id","onBlur","onFocus","aria-describedby"]),Ot=useCallbackRef$2(ht),It=useCallbackRef$2(nt),Bt=useCallbackRef$2(it),[Ft,jt]=reactExports.useState(!1),[bt,vt]=reactExports.useState(!1),[ct,dt]=reactExports.useState(!1),[mt,xt]=reactExports.useState(!1);reactExports.useEffect(()=>trackFocusVisible(jt),[]);const At=reactExports.useRef(null),[Rt,St]=reactExports.useState(!0),[Tt,Et]=reactExports.useState(!!ot),Nt=at!==void 0,tr=Nt?at:Tt,ir=reactExports.useCallback(pr=>{if(j||$){pr.preventDefault();return}Nt||Et(tr?pr.target.checked:yt?!0:pr.target.checked),Ot==null||Ot(pr)},[j,$,tr,Nt,yt,Ot]);useSafeLayoutEffect$2(()=>{At.current&&(At.current.indeterminate=!!yt)},[yt]),useUpdateEffect(()=>{$&&vt(!1)},[$,vt]),useSafeLayoutEffect$2(()=>{const pr=At.current;if(!(pr!=null&&pr.form))return;const Cr=()=>{Et(!!ot)};return pr.form.addEventListener("reset",Cr),()=>{var Mr;return(Mr=pr.form)==null?void 0:Mr.removeEventListener("reset",Cr)}},[]);const nr=$&&!ut,Zt=reactExports.useCallback(pr=>{pr.key===" "&&xt(!0)},[xt]),Kt=reactExports.useCallback(pr=>{pr.key===" "&&xt(!1)},[xt]);useSafeLayoutEffect$2(()=>{if(!At.current)return;At.current.checked!==tr&&Et(At.current.checked)},[At.current]);const Qt=reactExports.useCallback((pr={},Cr=null)=>{const Mr=lr=>{bt&&lr.preventDefault(),xt(!0)};return{...pr,ref:Cr,"data-active":dataAttr(mt),"data-hover":dataAttr(ct),"data-checked":dataAttr(tr),"data-focus":dataAttr(bt),"data-focus-visible":dataAttr(bt&&Ft),"data-indeterminate":dataAttr(yt),"data-disabled":dataAttr($),"data-invalid":dataAttr(tt),"data-readonly":dataAttr(j),"aria-hidden":!0,onMouseDown:callAllHandlers$1(pr.onMouseDown,Mr),onMouseUp:callAllHandlers$1(pr.onMouseUp,()=>xt(!1)),onMouseEnter:callAllHandlers$1(pr.onMouseEnter,()=>dt(!0)),onMouseLeave:callAllHandlers$1(pr.onMouseLeave,()=>dt(!1))}},[mt,tr,$,bt,Ft,ct,yt,tt,j]),Ht=reactExports.useCallback((pr={},Cr=null)=>({...pr,ref:Cr,"data-active":dataAttr(mt),"data-hover":dataAttr(ct),"data-checked":dataAttr(tr),"data-focus":dataAttr(bt),"data-focus-visible":dataAttr(bt&&Ft),"data-indeterminate":dataAttr(yt),"data-disabled":dataAttr($),"data-invalid":dataAttr(tt),"data-readonly":dataAttr(j)}),[mt,tr,$,bt,Ft,ct,yt,tt,j]),qt=reactExports.useCallback((pr={},Cr=null)=>({...zt,...pr,ref:mergeRefs(Cr,Mr=>{Mr&&St(Mr.tagName==="LABEL")}),onClick:callAllHandlers$1(pr.onClick,()=>{var Mr;Rt||((Mr=At.current)==null||Mr.click(),requestAnimationFrame(()=>{var lr;(lr=At.current)==null||lr.focus({preventScroll:!0})}))}),"data-disabled":dataAttr($),"data-checked":dataAttr(tr),"data-invalid":dataAttr(tt)}),[zt,$,tr,tt,Rt]),Jt=reactExports.useCallback((pr={},Cr=null)=>({...pr,ref:mergeRefs(At,Cr),type:"checkbox",name:wt,value:Ct,id:rt,tabIndex:Pt,onChange:callAllHandlers$1(pr.onChange,ir),onBlur:callAllHandlers$1(pr.onBlur,It,()=>vt(!1)),onFocus:callAllHandlers$1(pr.onFocus,Bt,()=>vt(!0)),onKeyDown:callAllHandlers$1(pr.onKeyDown,Zt),onKeyUp:callAllHandlers$1(pr.onKeyUp,Kt),required:et,checked:tr,disabled:nr,readOnly:j,"aria-label":$t,"aria-labelledby":Mt,"aria-invalid":Lt?!!Lt:tt,"aria-describedby":st,"aria-disabled":$,style:visuallyHiddenStyle$1}),[wt,Ct,rt,ir,It,Bt,Zt,Kt,et,tr,nr,j,$t,Mt,Lt,tt,st,$,Pt]),ur=reactExports.useCallback((pr={},Cr=null)=>({...pr,ref:Cr,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:bt,isChecked:tr,isActive:mt,isHovered:ct,isIndeterminate:yt,isDisabled:$,isReadOnly:j,isRequired:et},getRootProps:qt,getCheckboxProps:Qt,getIndicatorProps:Ht,getInputProps:Jt,getLabelProps:ur,htmlProps:zt}}function stopEvent$1(a){a.preventDefault(),a.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(_,$){const j=useCheckboxGroupContext(),et={...j,..._},tt=useMultiStyleConfig("Checkbox",et),rt=omitThemingProps(_),{spacing:nt="0.5rem",className:it,children:st,iconColor:ot,iconSize:at,icon:ut=jsxRuntimeExports.jsx(CheckboxIcon,{}),isChecked:ht,isDisabled:yt=j==null?void 0:j.isDisabled,onChange:wt,inputProps:Ct,...Pt}=rt;let $t=ht;j!=null&&j.value&&rt.value&&($t=j.value.includes(rt.value));let Mt=wt;j!=null&&j.onChange&&rt.value&&(Mt=callAll(j.onChange,wt));const{state:Lt,getInputProps:Dt,getCheckboxProps:zt,getLabelProps:Ot,getRootProps:It}=useCheckbox({...Pt,isDisabled:yt,isChecked:$t,onChange:Mt}),Bt=useInitialAnimationState(Lt.isChecked),Ft=reactExports.useMemo(()=>({animation:Bt?Lt.isIndeterminate?`${indeterminateOpacityAnim} 20ms linear, ${indeterminateScaleAnim} 200ms linear`:`${checkAnim} 200ms linear`:void 0,fontSize:at,color:ot,...tt.icon}),[ot,at,Bt,Lt.isIndeterminate,tt.icon]),jt=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),...It(),children:[jsxRuntimeExports.jsx("input",{className:"chakra-checkbox__input",...Dt(Ct,$)}),jsxRuntimeExports.jsx(chakra.span,{__css:{...controlStyles,...tt.control},className:"chakra-checkbox__control",...zt(),children:jt}),st&&jsxRuntimeExports.jsx(chakra.span,{className:"chakra-checkbox__label",...Ot(),__css:{marginStart:nt,...tt.label},children:st})]})});Checkbox.displayName="Checkbox";function useEventListener(a,_,$,j){const et=useCallbackRef$2($);return reactExports.useEffect(()=>{const tt=typeof a=="function"?a():a??document;if(!(!$||!tt))return tt.addEventListener(_,et,j),()=>{tt.removeEventListener(_,et,j)}},[_,a,j,et,$]),()=>{const tt=typeof a=="function"?a():a??document;tt==null||tt.removeEventListener(_,et,j)}}function isRefObject$1(a){return"current"in a}var isDom=()=>typeof window<"u";function getPlatform(){var a;const _=navigator.userAgentData;return(a=_==null?void 0:_.platform)!=null?a:navigator.platform}var vn=a=>isDom()&&a.test(navigator.vendor),pt=a=>isDom()&&a.test(getPlatform()),isApple=()=>pt(/mac|iphone|ipad|ipod/i),isSafari=()=>isApple()&&vn(/apple/i);function useFocusOnPointerDown(a){const{ref:_,elements:$,enabled:j}=a,et=()=>{var tt,rt;return(rt=(tt=_.current)==null?void 0:tt.ownerDocument)!=null?rt:document};useEventListener(et,"pointerdown",tt=>{if(!isSafari()||!j)return;const rt=tt.target,it=($??[_]).some(st=>{const ot=isRefObject$1(st)?st.current:st;return(ot==null?void 0:ot.contains(rt))||ot===rt});et().activeElement!==rt&&it&&(tt.preventDefault(),rt.focus())})}function _objectWithoutPropertiesLoose$3(a,_){if(a==null)return{};var $={},j=Object.keys(a),et,tt;for(tt=0;tt=0)&&($[et]=a[et]);return $}function _extends$5(){return _extends$5=Object.assign?Object.assign.bind():function(a){for(var _=1;_0&&tt[tt.length-1])&&(st[0]===6||st[0]===2)){$=0;continue}if(st[0]===3&&(!tt||st[1]>tt[0]&&st[1]=a.length&&(a=void 0),{value:a&&a[j++],done:!a}}};throw new TypeError(_?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(a,_){var $=typeof Symbol=="function"&&a[Symbol.iterator];if(!$)return a;var j=$.call(a),et,tt=[],rt;try{for(;(_===void 0||_-- >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=_.length,tt;j1||nt(ut,ht)})})}function nt(ut,ht){try{it(j[ut](ht))}catch(yt){at(tt[0][3],yt)}}function it(ut){ut.value instanceof __await?Promise.resolve(ut.value.v).then(st,ot):at(tt[0][2],ut)}function st(ut){nt("next",ut)}function ot(ut){nt("throw",ut)}function at(ut,ht){ut(ht),tt.shift(),tt.length&&nt(tt[0][0],tt[0][1])}}function __asyncValues(a){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var _=a[Symbol.asyncIterator],$;return _?_.call(a):(a=typeof __values=="function"?__values(a):a[Symbol.iterator](),$={},j("next"),j("throw"),j("return"),$[Symbol.asyncIterator]=function(){return this},$);function j(tt){$[tt]=a[tt]&&function(rt){return new Promise(function(nt,it){rt=a[tt](rt),et(nt,it,rt.done,rt.value)})}}function et(tt,rt,nt,it){Promise.resolve(it).then(function(st){tt({value:st,done:nt})},rt)}}typeof SuppressedError=="function"&&SuppressedError;function ItoI(a){return a}function innerCreateMedium(a,_){_===void 0&&(_=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]:a},useMedium:function(tt){var rt=_(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 ot=rt;rt=[],ot.forEach(tt)},st=function(){return Promise.resolve().then(it)};st(),$={push:function(ot){rt.push(ot),st()},filter:function(ot){return rt=rt.filter(ot),$}}}};return et}function createMedium(a,_){return _===void 0&&(_=ItoI),innerCreateMedium(a,_)}function createSidecarMedium(a){a===void 0&&(a={});var _=innerCreateMedium(null);return _.options=__assign({async:!0,ssr:!1},a),_}var SideCar$2=function(a){var _=a.sideCar,$=__rest$3(a,["sideCar"]);if(!_)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var j=_.read();if(!j)throw new Error("Sidecar medium not found");return reactExports.createElement(j,__assign({},$))};SideCar$2.isSideCarExport=!0;function exportSidecar(a,_){return a.useMedium(_),SideCar$2}var mediumFocus=createMedium({},function(a){var _=a.target,$=a.currentTarget;return{target:_,currentTarget:$}}),mediumBlur=createMedium(),mediumEffect=createMedium(),mediumSidecar=createSidecarMedium({async:!0}),emptyArray=[],FocusLock$1=reactExports.forwardRef(function(_,$){var j,et=reactExports.useState(),tt=et[0],rt=et[1],nt=reactExports.useRef(),it=reactExports.useRef(!1),st=reactExports.useRef(null),ot=_.children,at=_.disabled,ut=_.noFocusGuards,ht=_.persistentFocus,yt=_.crossFrame,wt=_.autoFocus;_.allowTextSelection;var Ct=_.group,Pt=_.className,$t=_.whiteList,Mt=_.hasPositiveIndices,Lt=_.shards,Dt=Lt===void 0?emptyArray:Lt,zt=_.as,Ot=zt===void 0?"div":zt,It=_.lockProps,Bt=It===void 0?{}:It,Ft=_.sideCar,jt=_.returnFocus,bt=_.focusOptions,vt=_.onActivation,ct=_.onDeactivation,dt=reactExports.useState({}),mt=dt[0],xt=reactExports.useCallback(function(){st.current=st.current||document&&document.activeElement,nt.current&&vt&&vt(nt.current),it.current=!0},[vt]),At=reactExports.useCallback(function(){it.current=!1,ct&&ct(nt.current)},[ct]);reactExports.useEffect(function(){at||(st.current=null)},[]);var Rt=reactExports.useCallback(function(Zt){var Kt=st.current;if(Kt&&Kt.focus){var Qt=typeof jt=="function"?jt(Kt):jt;if(Qt){var Ht=typeof Qt=="object"?Qt:void 0;st.current=null,Zt?Promise.resolve().then(function(){return Kt.focus(Ht)}):Kt.focus(Ht)}}},[jt]),St=reactExports.useCallback(function(Zt){it.current&&mediumFocus.useMedium(Zt)},[]),Tt=mediumBlur.useMedium,Et=reactExports.useCallback(function(Zt){nt.current!==Zt&&(nt.current=Zt,rt(Zt))},[]),Nt=_extends$5((j={},j[FOCUS_DISABLED]=at&&"disabled",j[FOCUS_GROUP]=Ct,j),Bt),tr=ut!==!0,ir=tr&&ut!=="tail",nr=useMergeRefs([$,Et]);return reactExports.createElement(reactExports.Fragment,null,tr&&[reactExports.createElement("div",{key:"guard-first","data-focus-guard":!0,tabIndex:at?-1:0,style:hiddenGuard}),Mt?reactExports.createElement("div",{key:"guard-nearest","data-focus-guard":!0,tabIndex:at?-1:1,style:hiddenGuard}):null],!at&&reactExports.createElement(Ft,{id:mt,sideCar:mediumSidecar,observed:tt,disabled:at,persistentFocus:ht,crossFrame:yt,autoFocus:wt,whiteList:$t,shards:Dt,onActivation:xt,onDeactivation:At,returnFocus:Rt,focusOptions:bt}),reactExports.createElement(Ot,_extends$5({ref:nr},Nt,{className:Pt,onBlur:Tt,onFocus:St}),ot),ir&&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,_){a.prototype=Object.create(_.prototype),a.prototype.constructor=a,_setPrototypeOf$2(a,_)}function _typeof$6(a){"@babel/helpers - typeof";return _typeof$6=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(_){return typeof _}:function(_){return _&&typeof Symbol=="function"&&_.constructor===Symbol&&_!==Symbol.prototype?"symbol":typeof _},_typeof$6(a)}function _toPrimitive(a,_){if(_typeof$6(a)!=="object"||a===null)return a;var $=a[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(_==="string"?String:Number)(a)}function _toPropertyKey(a){var _=_toPrimitive(a,"string");return _typeof$6(_)==="symbol"?_:String(_)}function _defineProperty$8(a,_,$){return _=_toPropertyKey(_),_ in a?Object.defineProperty(a,_,{value:$,enumerable:!0,configurable:!0,writable:!0}):a[_]=$,a}function withSideEffect(a,_){function $(j){return j.displayName||j.name||"Component"}return function(et){var tt=[],rt;function nt(){rt=a(tt.map(function(st){return st.props})),_(rt)}var it=function(st){_inheritsLoose$1(ot,st);function ot(){return st.apply(this,arguments)||this}ot.peek=function(){return rt};var at=ot.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)},ot}(reactExports.PureComponent);return _defineProperty$8(it,"displayName","SideEffect("+$(et)+")"),it}}var toArray$4=function(a){for(var _=Array(a.length),$=0;$=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((a.shadowRoot||a).children).reduce(function($,j){return $.concat(j.matches(_?queryGuardTabbables:queryTabbables)?[j]:[],getFocusablesWithShadowDom(j))},[])},getFocusablesWithIFrame=function(a,_){var $;return a instanceof HTMLIFrameElement&&(!(($=a.contentDocument)===null||$===void 0)&&$.body)?getFocusables([a.contentDocument.body],_):[a]},getFocusables=function(a,_){return a.reduce(function($,j){var et,tt=getFocusablesWithShadowDom(j,_),rt=(et=[]).concat.apply(et,tt.map(function(nt){return getFocusablesWithIFrame(nt,_)}));return $.concat(rt,j.parentNode?toArray$4(j.parentNode.querySelectorAll(queryTabbables)).filter(function(nt){return nt===j}):[])},[])},getParentAutofocusables=function(a){var _=a.querySelectorAll("[".concat(FOCUS_AUTO,"]"));return toArray$4(_).map(function($){return getFocusables([$])}).reduce(function($,j){return $.concat(j)},[])},filterFocusable=function(a,_){return toArray$4(a).filter(function($){return isVisibleCached(_,$)}).filter(function($){return notHiddenInput($)})},filterAutoFocusable=function(a,_){return _===void 0&&(_=new Map),toArray$4(a).filter(function($){return isAutoFocusAllowedCached(_,$)})},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 a.shadowRoot?contains$2(a.shadowRoot,_):Object.getPrototypeOf(a).contains!==void 0&&Object.getPrototypeOf(a).contains.call(a,_)?!0:toArray$4(a.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,_):!1}return contains$2($,_)})},filterNested=function(a){for(var _=new Set,$=a.length,j=0;j<$;j+=1)for(var et=j+1;et<$;et+=1){var tt=a[j].compareDocumentPosition(a[et]);(tt&Node.DOCUMENT_POSITION_CONTAINED_BY)>0&&_.add(et),(tt&Node.DOCUMENT_POSITION_CONTAINS)>0&&_.add(j)}return a.filter(function(rt,nt){return!_.has(nt)})},getTopParent=function(a){return a.parentNode?getTopParent(a.parentNode):a},getAllAffectedNodes=function(a){var _=asArray(a);return _.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(a){try{return a()}catch{return}},getActiveElement$1=function(a){if(a===void 0&&(a=document),!(!a||!a.activeElement)){var _=a.activeElement;return _.shadowRoot?getActiveElement$1(_.shadowRoot):_ instanceof HTMLIFrameElement&&safeProbe(function(){return _.contentWindow.document})?getActiveElement$1(_.contentWindow.document):_}},focusInFrame=function(a,_){return a===_},focusInsideIframe=function(a,_){return!!toArray$4(a.querySelectorAll("iframe")).some(function($){return focusInFrame($,_)})},focusInside=function(a,_){return _===void 0&&(_=getActiveElement$1(getFirst(a).ownerDocument)),!_||_.dataset&&_.dataset.focusGuard?!1:getAllAffectedNodes(a).some(function($){return contains$2($,_)||focusInsideIframe($,_)})},focusIsHidden=function(a){a===void 0&&(a=document);var _=getActiveElement$1(a);return _?toArray$4(a.querySelectorAll("[".concat(FOCUS_ALLOW,"]"))).some(function($){return contains$2($,_)}):!1},findSelectedRadio=function(a,_){return _.filter(isRadioElement).filter(function($){return $.name===a.name}).filter(function($){return $.checked})[0]||a},correctNode=function(a,_){return isRadioElement(a)&&a.name?findSelectedRadio(a,_):a},correctNodes=function(a){var _=new Set;return a.forEach(function($){return _.add(correctNode($,a))}),a.filter(function($){return _.has($)})},pickFirstFocus=function(a){return a[0]&&a.length>1?correctNode(a[0],a):a[0]},pickFocusable=function(a,_){return a.length>1?a.indexOf(correctNode(a[_],a)):_},NEW_FOCUS="NEW_FOCUS",newFocus=function(a,_,$,j){var et=a.length,tt=a[0],rt=a[et-1],nt=isGuard($);if(!($&&a.indexOf($)>=0)){var it=$!==void 0?_.indexOf($):-1,st=j?_.indexOf(j):it,ot=j?a.indexOf(j):-1,at=it-st,ut=_.indexOf(tt),ht=_.indexOf(rt),yt=correctNodes(_),wt=$!==void 0?yt.indexOf($):-1,Ct=wt-(j?yt.indexOf(j):it),Pt=pickFocusable(a,0),$t=pickFocusable(a,et-1);if(it===-1||ot===-1)return NEW_FOCUS;if(!at&&ot>=0)return ot;if(it<=ut&&nt&&Math.abs(at)>1)return $t;if(it>=ht&&nt&&Math.abs(at)>1)return Pt;if(at&&Math.abs(Ct)>1)return ot;if(it<=ut)return $t;if(it>ht)return Pt;if(at)return Math.abs(at)>1?ot:(et+ot+at)%et}},findAutoFocused=function(a){return function(_){var $,j=($=getDataset(_))===null||$===void 0?void 0:$.autofocus;return _.autofocus||j!==void 0&&j!=="false"||a.indexOf(_)>=0}},pickAutofocus=function(a,_,$){var j=a.map(function(tt){var rt=tt.node;return rt}),et=filterAutoFocusable(j.filter(findAutoFocused($)));return et&&et.length?pickFirstFocus(et):pickFirstFocus(filterAutoFocusable(_))},getParents=function(a,_){return _===void 0&&(_=[]),_.push(a),a.parentNode&&getParents(a.parentNode.host||a.parentNode,_),_},getCommonParent=function(a,_){for(var $=getParents(a),j=getParents(_),et=0;et<$.length;et+=1){var tt=$[et];if(j.indexOf(tt)>=0)return tt}return!1},getTopCommonParent=function(a,_,$){var j=asArray(a),et=asArray(_),tt=j[0],rt=!1;return et.filter(Boolean).forEach(function(nt){rt=getCommonParent(rt||nt,nt)||rt,$.filter(Boolean).forEach(function(it){var st=getCommonParent(tt,it);st&&(!rt||contains$2(st,rt)?rt=st:rt=getCommonParent(st,rt))})}),rt},allParentAutofocusables=function(a,_){return a.reduce(function($,j){return $.concat(parentAutofocusables(j,_))},[])},reorderNodes=function(a,_){var $=new Map;return _.forEach(function(j){return $.set(j.node,j)}),a.map(function(j){return $.get(j)}).filter(isDefined)},focusSolver=function(a,_){var $=getActiveElement$1(asArray(a).length>0?document:getFirst(a).ownerDocument),j=getAllAffectedNodes(a).filter(isNotAGuard),et=getTopCommonParent($||a,a,j),tt=new Map,rt=getFocusableNodes(j,tt),nt=getTabbableNodes(j,tt).filter(function(ht){var yt=ht.node;return isNotAGuard(yt)});if(!(!nt[0]&&(nt=rt,!nt[0]))){var it=getFocusableNodes([et],tt).map(function(ht){var yt=ht.node;return yt}),st=reorderNodes(it,nt),ot=st.map(function(ht){var yt=ht.node;return yt}),at=newFocus(ot,it,$,_);if(at===NEW_FOCUS){var ut=pickAutofocus(rt,ot,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:st[at]}},expandFocusableNodes=function(a){var _=getAllAffectedNodes(a).filter(isNotAGuard),$=getTopCommonParent(a,a,_),j=new Map,et=getTabbableNodes([$],j,!0),tt=getTabbableNodes(_,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 a&&a.focus(_),"contentWindow"in a&&a.contentWindow&&a.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(a){setTimeout(a,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(_){return(lastActiveTrap.whiteList||defaultWhitelist)(_)},recordPortal=function(_,$){lastPortaledElement={observerNode:_,portaledElement:$}},focusIsPortaledPair=function(_){return lastPortaledElement&&lastPortaledElement.portaledElement===_};function autoGuard(a,_,$,j){var et=null,tt=a;do{var rt=j[tt];if(rt.guard)rt.node.dataset.focusAutoGuard&&(et=rt);else if(rt.lockItem){if(tt!==a)return;et=null}else break}while((tt+=$)!==_);et&&(et.node.tabIndex=0)}var extractRef$2=function(_){return _&&"current"in _?_.current:_},focusWasOutside=function(_){return _?!!focusWasOutsideWindow:focusWasOutsideWindow==="meanwhile"},checkInHost=function a(_,$,j){return $&&($.host===_&&(!$.activeElement||j.contains($.activeElement))||$.parentNode&&a(_,$.parentNode,j))},withinHost=function(_,$){return $.some(function(j){return checkInHost(_,j,j)})},activateTrap=function(){var _=!1;if(lastActiveTrap){var $=lastActiveTrap,j=$.observed,et=$.persistentFocus,tt=$.autoFocus,rt=$.shards,nt=$.crossFrame,it=$.focusOptions,st=j||lastPortaledElement&&lastPortaledElement.portaledElement,ot=document&&document.activeElement;if(st){var at=[st].concat(rt.map(extractRef$2).filter(Boolean));if((!ot||focusWhitelisted(ot))&&(et||focusWasOutside(nt)||!isFreeFocus()||!lastActiveFocus&&tt)&&(st&&!(focusInside(at)||ot&&withinHost(ot,at)||focusIsPortaledPair(ot))&&(document&&!lastActiveFocus&&ot&&!tt?(ot.blur&&ot.blur(),document.body.focus()):(_=moveFocusInside(at,lastActiveFocus,{focusOptions:it}),lastPortaledElement={})),focusWasOutsideWindow=!1,lastActiveFocus=document&&document.activeElement),document){var ut=document&&document.activeElement,ht=expandFocusableNodes(at),yt=ht.map(function(wt){var Ct=wt.node;return Ct}).indexOf(ut);yt>-1&&(ht.filter(function(wt){var Ct=wt.guard,Pt=wt.node;return Ct&&Pt.dataset.focusAutoGuard}).forEach(function(wt){var Ct=wt.node;return Ct.removeAttribute("tabIndex")}),autoGuard(yt,ht.length,1,ht),autoGuard(yt,-1,-1,ht))}}}return _},onTrap=function(_){activateTrap()&&_&&(_.stopPropagation(),_.preventDefault())},onBlur=function(){return deferAction(activateTrap)},onFocus=function(_){var $=_.target,j=_.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(a){return a.filter(function(_){var $=_.disabled;return!$})}function handleStateChangeOnClient(a){var _=a.slice(-1)[0];_&&!lastActiveTrap&&attachHandler();var $=lastActiveTrap,j=$&&_&&_.id===$.id;lastActiveTrap=_,$&&!j&&($.onDeactivation(),a.filter(function(et){var tt=et.id;return tt===$.id}).length||$.returnFocus(!_)),_?(lastActiveFocus=null,(!j||$.observed!==_.observed)&&_.onActivation(),activateTrap(),deferAction(activateTrap)):(detachHandler(),lastActiveFocus=null)}mediumFocus.assignSyncMedium(onFocus);mediumBlur.assignMedium(onBlur);mediumEffect.assignMedium(function(a){return a({moveFocusInside,focusInside})});const FocusTrap$1=withSideEffect(reducePropsToState,handleStateChangeOnClient)(FocusWatcher);var FocusLockCombination=reactExports.forwardRef(function(_,$){return reactExports.createElement(FocusLock$1,_extends$5({sideCar:FocusTrap$1,ref:$},_))}),_ref=FocusLock$1.propTypes||{};_ref.sideCar;_objectWithoutPropertiesLoose$3(_ref,["sideCar"]);FocusLockCombination.propTypes={};function isElement$2(a){return a!=null&&typeof a=="object"&&"nodeType"in a&&a.nodeType===Node.ELEMENT_NODE}function isHTMLElement$3(a){var _;if(!isElement$2(a))return!1;const $=(_=a.ownerDocument.defaultView)!=null?_:window;return a instanceof $.HTMLElement}function getOwnerWindow(a){var _,$;return($=(_=getOwnerDocument$2(a))==null?void 0:_.defaultView)!=null?$:window}function getOwnerDocument$2(a){return isElement$2(a)?a.ownerDocument:document}function getActiveElement(a){return getOwnerDocument$2(a).activeElement}function isScrollParent$1(a){const _=a.ownerDocument.defaultView||window,{overflow:$,overflowX:j,overflowY:et}=_.getComputedStyle(a);return/auto|scroll|overlay|hidden/.test($+et+j)}function getParent(a){return a.localName==="html"?a:a.assignedSlot||a.parentElement||a.ownerDocument.documentElement}function getScrollParent$1(a){return["html","body","#document"].includes(a.localName)?a.ownerDocument.body:isHTMLElement$3(a)&&isScrollParent$1(a)?a:getScrollParent$1(getParent(a))}var hasTabIndex=a=>a.hasAttribute("tabindex"),hasNegativeTabIndex=a=>hasTabIndex(a)&&a.tabIndex===-1;function isDisabled(a){return!!a.getAttribute("disabled")||!!a.getAttribute("aria-disabled")}function isHidden(a){return a.parentElement&&isHidden(a.parentElement)?!0:a.hidden}function isContentEditable(a){const _=a.getAttribute("contenteditable");return _!=="false"&&_!=null}function isFocusable(a){if(!isHTMLElement$3(a)||isHidden(a)||isDisabled(a))return!1;const{localName:_}=a;if(["input","select","textarea","button"].indexOf(_)>=0)return!0;const j={a:()=>a.hasAttribute("href"),audio:()=>a.hasAttribute("controls"),video:()=>a.hasAttribute("controls")};return _ in j?j[_]():isContentEditable(a)?!0:hasTabIndex(a)}function isTabbable(a){return a?isHTMLElement$3(a)&&isFocusable(a)&&!hasNegativeTabIndex(a):!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=a=>a.offsetWidth>0&&a.offsetHeight>0;function getAllFocusable(a){const _=Array.from(a.querySelectorAll(focusableElSelector));return _.unshift(a),_.filter($=>isFocusable($)&&isVisible($))}var _a$3,FocusTrap=(_a$3=FocusLockCombination.default)!=null?_a$3:FocusLockCombination,FocusLock=a=>{const{initialFocusRef:_,finalFocusRef:$,contentRef:j,restoreFocus:et,children:tt,isDisabled:rt,autoFocus:nt,persistentFocus:it,lockFocusAcrossFrames:st}=a,ot=reactExports.useCallback(()=>{_!=null&&_.current?_.current.focus():j!=null&&j.current&&getAllFocusable(j.current).length===0&&requestAnimationFrame(()=>{var yt;(yt=j.current)==null||yt.focus()})},[_,j]),at=reactExports.useCallback(()=>{var ht;(ht=$==null?void 0:$.current)==null||ht.focus()},[$]),ut=et&&!$;return jsxRuntimeExports.jsx(FocusTrap,{crossFrame:st,persistentFocus:it,autoFocus:nt,disabled:rt,onActivation:ot,onDeactivation:at,returnFocus:ut,children:tt})};FocusLock.displayName="FocusLock";var useSafeLayoutEffect=isBrowser$2?reactExports.useLayoutEffect:reactExports.useEffect;function useCallbackRef(a,_=[]){const $=reactExports.useRef(a);return useSafeLayoutEffect(()=>{$.current=a}),reactExports.useCallback((...j)=>{var et;return(et=$.current)==null?void 0:et.call($,...j)},_)}function useOutsideClick$1(a){const{ref:_,handler:$,enabled:j=!0}=a,et=useCallbackRef($),rt=reactExports.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;reactExports.useEffect(()=>{if(!j)return;const nt=at=>{isValidEvent$1(at,_)&&(rt.isPointerDown=!0)},it=at=>{if(rt.ignoreEmulatedMouseEvents){rt.ignoreEmulatedMouseEvents=!1;return}rt.isPointerDown&&$&&isValidEvent$1(at,_)&&(rt.isPointerDown=!1,et(at))},st=at=>{rt.ignoreEmulatedMouseEvents=!0,$&&rt.isPointerDown&&isValidEvent$1(at,_)&&(rt.isPointerDown=!1,et(at))},ot=getOwnerDocument$3(_.current);return ot.addEventListener("mousedown",nt,!0),ot.addEventListener("mouseup",it,!0),ot.addEventListener("touchstart",nt,!0),ot.addEventListener("touchend",st,!0),()=>{ot.removeEventListener("mousedown",nt,!0),ot.removeEventListener("mouseup",it,!0),ot.removeEventListener("touchstart",nt,!0),ot.removeEventListener("touchend",st,!0)}},[$,_,et,rt,j])}function isValidEvent$1(a,_){var $;const j=a.target;return j&&!getOwnerDocument$3(j).contains(j)?!1:!(($=_.current)!=null&&$.contains(j))}function useId(a,_){const $=reactExports.useId();return reactExports.useMemo(()=>a||[_,$].filter(Boolean).join("-"),[a,_,$])}function useControllableProp(a,_){const $=a!==void 0;return[$,$&&typeof a<"u"?a:_]}function useDisclosure$1(a={}){const{onClose:_,onOpen:$,isOpen:j,id:et}=a,tt=useCallbackRef($),rt=useCallbackRef(_),[nt,it]=reactExports.useState(a.defaultIsOpen||!1),[st,ot]=useControllableProp(j,nt),at=useId(et,"disclosure"),ut=reactExports.useCallback(()=>{st||it(!1),rt==null||rt()},[st,rt]),ht=reactExports.useCallback(()=>{st||it(!0),tt==null||tt()},[st,tt]),yt=reactExports.useCallback(()=>{(ot?ut:ht)()},[ot,ht,ut]);return{isOpen:!!ot,onOpen:ht,onClose:ut,onToggle:yt,isControlled:st,getButtonProps:(wt={})=>({...wt,"aria-expanded":ot,"aria-controls":at,onClick:callAllHandlers(wt.onClick,yt)}),getDisclosureProps:(wt={})=>({...wt,hidden:!ot,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(_,$){const j=useMultiStyleConfig("Input",_),{children:et,className:tt,...rt}=omitThemingProps(_),nt=cx("chakra-input__group",tt),it={},st=getValidChildren(et),ot=j.field;st.forEach(ut=>{var ht,yt;j&&(ot&&ut.type.id==="InputLeftElement"&&(it.paddingStart=(ht=ot.height)!=null?ht:ot.h),ot&&ut.type.id==="InputRightElement"&&(it.paddingEnd=(yt=ot.height)!=null?yt:ot.h),ut.type.id==="InputRightAddon"&&(it.borderEndRadius=0),ut.type.id==="InputLeftAddon"&&(it.borderStartRadius=0))});const at=st.map(ut=>{var ht,yt;const wt=compact$1({size:((ht=ut.props)==null?void 0:ht.size)||_.size,variant:((yt=ut.props)==null?void 0:yt.variant)||_.variant});return ut.type.id!=="Input"?reactExports.cloneElement(ut,wt):reactExports.cloneElement(ut,Object.assign(wt,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(_,$){var j,et;const{placement:tt="left",...rt}=_,nt=useInputGroupStyles(),it=nt.field,ot={[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:ot,...rt})});InputElement.id="InputElement";InputElement.displayName="InputElement";var InputLeftElement=forwardRef(function(_,$){const{className:j,...et}=_,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(_,$){const{className:j,...et}=_,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(_,$){const{htmlSize:j,...et}=_,tt=useMultiStyleConfig("Input",et),rt=omitThemingProps(et),nt=useFormControl(rt),it=cx("chakra-input",_.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(_,$){const j=useStyleConfig("Link",_),{className:et,isExternal:tt,...rt}=omitThemingProps(_);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(_,$){const j=useMultiStyleConfig("List",_),{children:et,styleType:tt="none",stylePosition:rt,spacing:nt,...it}=omitThemingProps(_),st=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:st})})});List.displayName="List";var OrderedList=forwardRef((a,_)=>{const{as:$,...j}=a;return jsxRuntimeExports.jsx(List,{ref:_,as:"ol",styleType:"decimal",marginStart:"1em",...j})});OrderedList.displayName="OrderedList";var UnorderedList=forwardRef(function(_,$){const{as:j,...et}=_;return jsxRuntimeExports.jsx(List,{ref:$,as:"ul",styleType:"initial",marginStart:"1em",...et})});UnorderedList.displayName="UnorderedList";var ListItem=forwardRef(function(_,$){const j=useListStyles();return jsxRuntimeExports.jsx(chakra.li,{ref:$,..._,__css:j.item})});ListItem.displayName="ListItem";var ListIcon=forwardRef(function(_,$){const j=useListStyles();return jsxRuntimeExports.jsx(Icon,{ref:$,role:"presentation",..._,__css:j.icon})});ListIcon.displayName="ListIcon";var Grid=forwardRef(function(_,$){const{templateAreas:j,gap:et,rowGap:tt,columnGap:rt,column:nt,row:it,autoFlow:st,autoRows:ot,templateRows:at,autoColumns:ut,templateColumns:ht,...yt}=_,wt={display:"grid",gridTemplateAreas:j,gridGap:et,gridRowGap:tt,gridColumnGap:rt,gridAutoColumns:ut,gridColumn:nt,gridRow:it,gridAutoFlow:st,gridAutoRows:ot,gridTemplateRows:at,gridTemplateColumns:ht};return jsxRuntimeExports.jsx(chakra.div,{ref:$,__css:wt,...yt})});Grid.displayName="Grid";function mapResponsive(a,_){return Array.isArray(a)?a.map($=>$===null?null:_($)):isObject$5(a)?Object.keys(a).reduce(($,j)=>($[j]=_(a[j]),$),{}):a!=null?_(a):null}var SimpleGrid=forwardRef(function(_,$){const{columns:j,spacingX:et,spacingY:tt,spacing:rt,minChildWidth:nt,...it}=_,st=useTheme(),ot=nt?widthToColumns(nt,st):countToColumns(j);return jsxRuntimeExports.jsx(Grid,{ref:$,gap:rt,columnGap:et,rowGap:tt,templateColumns:ot,...it})});SimpleGrid.displayName="SimpleGrid";function toPx(a){return typeof a=="number"?`${a}px`:a}function widthToColumns(a,_){return mapResponsive(a,$=>{const j=getToken("sizes",$,toPx($))(_);return $===null?null:`repeat(auto-fit, minmax(${j}, 1fr))`})}function countToColumns(a){return mapResponsive(a,_=>_===null?null:`repeat(${_}, minmax(0, 1fr))`)}var Text=forwardRef(function(_,$){const j=useStyleConfig("Text",_),{className:et,align:tt,decoration:rt,casing:nt,...it}=omitThemingProps(_),st=compact$1({textAlign:_.align,textDecoration:_.decoration,textTransform:_.casing});return jsxRuntimeExports.jsx(chakra.p,{ref:$,className:cx("chakra-text",_.className),...st,...it,__css:j})});Text.displayName="Text";var Wrap=forwardRef(function(_,$){const{spacing:j="0.5rem",spacingX:et,spacingY:tt,children:rt,justify:nt,direction:it,align:st,className:ot,shouldWrapChildren:at,...ut}=_,ht=reactExports.useMemo(()=>at?reactExports.Children.map(rt,(yt,wt)=>jsxRuntimeExports.jsx(WrapItem,{children:yt},wt)):rt,[rt,at]);return jsxRuntimeExports.jsx(chakra.div,{ref:$,className:cx("chakra-wrap",ot),...ut,children:jsxRuntimeExports.jsx(chakra.ul,{className:"chakra-wrap__list",__css:{display:"flex",flexWrap:"wrap",justifyContent:nt,alignItems:st,flexDirection:it,listStyleType:"none",gap:j,columnGap:et,rowGap:tt,padding:"0"},children:ht})})});Wrap.displayName="Wrap";var WrapItem=forwardRef(function(_,$){const{className:j,...et}=_;return jsxRuntimeExports.jsx(chakra.li,{ref:$,__css:{display:"flex",alignItems:"flex-start"},className:cx("chakra-wrap__listitem",j),...et})});WrapItem.displayName="WrapItem";var StackItem=a=>jsxRuntimeExports.jsx(chakra.div,{className:"chakra-stack__item",...a,__css:{display:"inline-block",flex:"0 0 auto",minWidth:0,...a.__css}});StackItem.displayName="StackItem";function getDividerStyles(a){const{spacing:_,direction:$}=a,j={column:{my:_,mx:0,borderLeftWidth:0,borderBottomWidth:"1px"},"column-reverse":{my:_,mx:0,borderLeftWidth:0,borderBottomWidth:"1px"},row:{mx:_,my:0,borderLeftWidth:"1px",borderBottomWidth:0},"row-reverse":{mx:_,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:st,className:ot,shouldWrapChildren:at,...ut}=a,ht=$?"row":j??"column",yt=reactExports.useMemo(()=>getDividerStyles({spacing:rt,direction:ht}),[rt,ht]),wt=!!st,Ct=!at&&!wt,Pt=reactExports.useMemo(()=>{const Mt=getValidChildren(it);return Ct?Mt:Mt.map((Lt,Dt)=>{const zt=typeof Lt.key<"u"?Lt.key:Dt,Ot=Dt+1===Mt.length,Bt=at?jsxRuntimeExports.jsx(StackItem,{children:Lt},zt):Lt;if(!wt)return Bt;const Ft=reactExports.cloneElement(st,{__css:yt}),jt=Ot?null:Ft;return jsxRuntimeExports.jsxs(reactExports.Fragment,{children:[Bt,jt]},zt)})},[st,yt,wt,Ct,at,it]),$t=cx("chakra-stack",ot);return jsxRuntimeExports.jsx(chakra.div,{ref:_,display:"flex",alignItems:et,justifyContent:tt,flexDirection:ht,flexWrap:nt,gap:wt?void 0:rt,className:$t,...ut,children:Pt})});Stack.displayName="Stack";var VStack=forwardRef((a,_)=>jsxRuntimeExports.jsx(Stack,{align:"center",...a,direction:"column",ref:_}));VStack.displayName="VStack";function spanFn(a){return mapResponsive(a,_=>_==="auto"?"auto":`span ${_}/span ${_}`)}var GridItem=forwardRef(function(_,$){const{area:j,colSpan:et,colStart:tt,colEnd:rt,rowEnd:nt,rowSpan:it,rowStart:st,...ot}=_,at=compact$1({gridArea:j,gridColumn:spanFn(et),gridRow:spanFn(it),gridColumnStart:tt,gridColumnEnd:rt,gridRowStart:st,gridRowEnd:nt});return jsxRuntimeExports.jsx(chakra.div,{ref:$,__css:at,...ot})});GridItem.displayName="GridItem";var Heading=forwardRef(function(_,$){const j=useStyleConfig("Heading",_),{className:et,...tt}=omitThemingProps(_);return jsxRuntimeExports.jsx(chakra.h2,{ref:$,className:cx("chakra-heading",_.className),...tt,__css:j})});Heading.displayName="Heading";var Box=chakra("div");Box.displayName="Box";var Square=forwardRef(function(_,$){const{size:j,centerContent:et=!0,...tt}=_,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(_,$){const{size:j,...et}=_;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}=a,rt=reactExports.Children.only(j),nt=cx("chakra-aspect-ratio",et);return jsxRuntimeExports.jsx(chakra.div,{ref:_,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(_,$){const{axis:j="both",...et}=_;return jsxRuntimeExports.jsx(chakra.div,{ref:$,__css:centerStyles[j],...et,position:"absolute"})});var Divider=forwardRef(function(_,$){const{borderLeftWidth:j,borderBottomWidth:et,borderTopWidth:tt,borderRightWidth:rt,borderWidth:nt,borderStyle:it,borderColor:st,...ot}=useStyleConfig("Divider",_),{className:at,orientation:ut="horizontal",__css:ht,...yt}=omitThemingProps(_),wt={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,...yt,__css:{...ot,border:"0",borderColor:st,borderStyle:it,...wt[ut],...ht},className:cx("chakra-divider",at)})});Divider.displayName="Divider";var Flex=forwardRef(function(_,$){const{direction:j,align:et,justify:tt,wrap:rt,basis:nt,grow:it,shrink:st,...ot}=_,at={display:"flex",flexDirection:j,alignItems:et,justifyContent:tt,flexWrap:rt,flexBasis:nt,flexGrow:it,flexShrink:st};return jsxRuntimeExports.jsx(chakra.div,{ref:$,__css:at,...ot})});Flex.displayName="Flex";function useMediaQuery(a,_={}){const{ssr:$=!0,fallback:j}=_,{getWindow:et}=useEnvironment(),tt=Array.isArray(a)?a:[a];let rt=Array.isArray(j)?j:[j];rt=rt.filter(st=>st!=null);const[nt,it]=reactExports.useState(()=>tt.map((st,ot)=>({media:st,matches:$?!!rt[ot]:et().matchMedia(st).matches})));return reactExports.useEffect(()=>{const st=et();it(tt.map(ut=>({media:ut,matches:st.matchMedia(ut).matches})));const ot=tt.map(ut=>st.matchMedia(ut)),at=ut=>{it(ht=>ht.slice().map(yt=>yt.media===ut.media?{...yt,matches:ut.matches}:yt))};return ot.forEach(ut=>{typeof ut.addListener=="function"?ut.addListener(at):ut.addEventListener("change",at)}),()=>{ot.forEach(ut=>{typeof ut.removeListener=="function"?ut.removeListener(at):ut.removeEventListener("change",at)})}},[et]),nt.map(st=>st.matches)}function isPrintableCharacter(a){const{key:_}=a;return _.length===1||_.length>1&&/[^a-zA-Z0-9]/.test(_)}function useShortcut(a={}){const{timeout:_=300,preventDefault:$=()=>!0}=a,[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},_)};reactExports.useEffect(()=>rt,[]);function it(st){return ot=>{if(ot.key==="Backspace"){const at=[...j];at.pop(),et(at);return}if(isPrintableCharacter(ot)){const at=j.concat(ot.key);$(ot)&&(ot.preventDefault(),ot.stopPropagation()),et(at),st(at.join("")),nt()}}}return it}function getNextItemFromSearch(a,_,$,j){if(_==null)return j;if(!j)return a.find(rt=>$(rt).toLowerCase().startsWith(_.toLowerCase()));const et=a.filter(tt=>$(tt).toLowerCase().startsWith(_.toLowerCase()));if(et.length>0){let tt;return et.includes(j)?(tt=et.indexOf(j)+1,tt===et.length&&(tt=0),et[tt]):(tt=a.indexOf(et[0]),a[tt])}return j}function useEventListeners(){const a=reactExports.useRef(new Map),_=a.current,$=reactExports.useCallback((et,tt,rt,nt)=>{a.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),a.current.delete(rt)},[]);return reactExports.useEffect(()=>()=>{_.forEach((et,tt)=>{j(et.el,et.type,tt,et.options)})},[j,_]),{add:$,remove:j}}function isValidElement(a){const _=a.target,{tagName:$,isContentEditable:j}=_;return $!=="INPUT"&&$!=="TEXTAREA"&&j!==!0}function useClickable(a={}){const{ref:_,isDisabled:$,isFocusable:j,clickOnEnter:et=!0,clickOnSpace:tt=!0,onMouseDown:rt,onMouseUp:nt,onClick:it,onKeyDown:st,onKeyUp:ot,tabIndex:at,onMouseOver:ut,onMouseLeave:ht,...yt}=a,[wt,Ct]=reactExports.useState(!0),[Pt,$t]=reactExports.useState(!1),Mt=useEventListeners(),Lt=xt=>{xt&&xt.tagName!=="BUTTON"&&Ct(!1)},Dt=wt?at:at||0,zt=$&&!j,Ot=reactExports.useCallback(xt=>{if($){xt.stopPropagation(),xt.preventDefault();return}xt.currentTarget.focus(),it==null||it(xt)},[$,it]),It=reactExports.useCallback(xt=>{Pt&&isValidElement(xt)&&(xt.preventDefault(),xt.stopPropagation(),$t(!1),Mt.remove(document,"keyup",It,!1))},[Pt,Mt]),Bt=reactExports.useCallback(xt=>{if(st==null||st(xt),$||xt.defaultPrevented||xt.metaKey||!isValidElement(xt.nativeEvent)||wt)return;const At=et&&xt.key==="Enter";tt&&xt.key===" "&&(xt.preventDefault(),$t(!0)),At&&(xt.preventDefault(),xt.currentTarget.click()),Mt.add(document,"keyup",It,!1)},[$,wt,st,et,tt,Mt,It]),Ft=reactExports.useCallback(xt=>{if(ot==null||ot(xt),$||xt.defaultPrevented||xt.metaKey||!isValidElement(xt.nativeEvent)||wt)return;tt&&xt.key===" "&&(xt.preventDefault(),$t(!1),xt.currentTarget.click())},[tt,wt,$,ot]),jt=reactExports.useCallback(xt=>{xt.button===0&&($t(!1),Mt.remove(document,"mouseup",jt,!1))},[Mt]),bt=reactExports.useCallback(xt=>{if(xt.button!==0)return;if($){xt.stopPropagation(),xt.preventDefault();return}wt||$t(!0),xt.currentTarget.focus({preventScroll:!0}),Mt.add(document,"mouseup",jt,!1),rt==null||rt(xt)},[$,wt,rt,Mt,jt]),vt=reactExports.useCallback(xt=>{xt.button===0&&(wt||$t(!1),nt==null||nt(xt))},[nt,wt]),ct=reactExports.useCallback(xt=>{if($){xt.preventDefault();return}ut==null||ut(xt)},[$,ut]),dt=reactExports.useCallback(xt=>{Pt&&(xt.preventDefault(),$t(!1)),ht==null||ht(xt)},[Pt,ht]),mt=mergeRefs(_,Lt);return wt?{...yt,ref:mt,type:"button","aria-disabled":zt?void 0:$,disabled:zt,onClick:Ot,onMouseDown:rt,onMouseUp:nt,onKeyUp:ot,onKeyDown:st,onMouseOver:ut,onMouseLeave:ht}:{...yt,ref:mt,role:"button","data-active":dataAttr(Pt),"aria-disabled":$?"true":void 0,tabIndex:zt?void 0:Dt,onClick:Ot,onMouseDown:bt,onMouseUp:vt,onKeyUp:Ft,onKeyDown:Bt,onMouseOver:ct,onMouseLeave:dt}}function preventReturnFocus(a){const _=a.current;if(!_)return!1;const $=getActiveElement(_);return!$||_.contains($)?!1:!!isTabbable($)}function useFocusOnHide(a,_){const{shouldFocus:$,visible:j,focusRef:et}=_,tt=$&&!j;useUpdateEffect(()=>{if(!tt||preventReturnFocus(a))return;const rt=(et==null?void 0:et.current)||a.current;let nt;if(rt)return nt=requestAnimationFrame(()=>{rt.focus({preventScroll:!0})}),()=>{cancelAnimationFrame(nt)}},[tt,a,et])}var defaultOptions$2={preventScroll:!0,shouldFocus:!1};function useFocusOnShow(a,_=defaultOptions$2){const{focusRef:$,preventScroll:j,shouldFocus:et,visible:tt}=_,rt=isRefObject(a)?a.current:a,nt=et&&tt,it=reactExports.useRef(nt),st=reactExports.useRef(tt);useSafeLayoutEffect$2(()=>{!st.current&&tt&&(it.current=nt),st.current=tt},[tt,nt]);const ot=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(()=>{ot()},[ot]),useEventListener(rt,"transitionend",ot)}function isRefObject(a){return"current"in a}var toVar=(a,_)=>({var:a,varRef:_?`var(${a}, ${_})`:`var(${a})`}),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(a){if(a.includes("top"))return"1px 1px 0px 0 var(--popper-arrow-shadow-color)";if(a.includes("bottom"))return"-1px -1px 0px 0 var(--popper-arrow-shadow-color)";if(a.includes("right"))return"-1px 1px 0px 0 var(--popper-arrow-shadow-color)";if(a.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=a=>transforms[a],defaultEventListeners={scroll:!0,resize:!0};function getEventListenerOptions(a){let _;return typeof a=="object"?_={enabled:!0,options:{...defaultEventListeners,...a}}:_={enabled:a,options:defaultEventListeners},_}var matchWidth={name:"matchWidth",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:({state:a})=>{a.styles.popper.width=`${a.rects.reference.width}px`},effect:({state:a})=>()=>{const _=a.elements.reference;a.elements.popper.style.width=`${_.offsetWidth}px`}},transformOrigin={name:"transformOrigin",enabled:!0,phase:"write",fn:({state:a})=>{setTransformOrigin(a)},effect:({state:a})=>()=>{setTransformOrigin(a)}},setTransformOrigin=a=>{a.elements.popper.style.setProperty(cssVars.transformOrigin.var,toTransformOrigin(a.placement))},positionArrow={name:"positionArrow",enabled:!0,phase:"afterWrite",fn:({state:a})=>{setArrowStyles(a)}},setArrowStyles=a=>{var _;if(!a.placement)return;const $=getArrowStyle$1(a.placement);if((_=a.elements)!=null&&_.arrow&&$){Object.assign(a.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)a.elements.arrow.style.setProperty(et,j[et])}},getArrowStyle$1=a=>{if(a.startsWith("top"))return{property:"bottom",value:cssVars.arrowOffset.varRef};if(a.startsWith("bottom"))return{property:"top",value:cssVars.arrowOffset.varRef};if(a.startsWith("left"))return{property:"right",value:cssVars.arrowOffset.varRef};if(a.startsWith("right"))return{property:"left",value:cssVars.arrowOffset.varRef}},innerArrow={name:"innerArrow",enabled:!0,phase:"main",requires:["arrow"],fn:({state:a})=>{setInnerArrowStyles(a)},effect:({state:a})=>()=>{setInnerArrowStyles(a)}},setInnerArrowStyles=a=>{if(!a.elements.arrow)return;const _=a.elements.arrow.querySelector("[data-popper-arrow-inner]");if(!_)return;const $=getBoxShadow(a.placement);$&&_.style.setProperty("--popper-arrow-default-shadow",$),Object.assign(_.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[a])==null?void 0:$[_])||a;return _==="ltr"?et:(j=opposites[a])!=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 a.concat([_+"-"+start,_+"-"+end])},[]),placements=[].concat(basePlacements,[auto]).reduce(function(a,_){return a.concat([_,_+"-"+start,_+"-"+end])},[]),beforeRead="beforeRead",read="read",afterRead="afterRead",beforeMain="beforeMain",main$4="main",afterMain="afterMain",beforeWrite="beforeWrite",write="write",afterWrite="afterWrite",modifierPhases=[beforeRead,read,afterRead,beforeMain,main$4,afterMain,beforeWrite,write,afterWrite];function getNodeName(a){return a?(a.nodeName||"").toLowerCase():null}function getWindow(a){if(a==null)return window;if(a.toString()!=="[object Window]"){var _=a.ownerDocument;return _&&_.defaultView||window}return a}function isElement$1(a){var _=getWindow(a).Element;return a instanceof _||a instanceof Element}function isHTMLElement$2(a){var _=getWindow(a).HTMLElement;return a instanceof _||a instanceof HTMLElement}function isShadowRoot(a){if(typeof ShadowRoot>"u")return!1;var _=getWindow(a).ShadowRoot;return a instanceof _||a instanceof ShadowRoot}function applyStyles(a){var _=a.state;Object.keys(_.elements).forEach(function($){var j=_.styles[$]||{},et=_.attributes[$]||{},tt=_.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(a){var _=a.state,$={popper:{position:_.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(_.elements.popper.style,$.popper),_.styles=$,_.elements.arrow&&Object.assign(_.elements.arrow.style,$.arrow),function(){Object.keys(_.elements).forEach(function(j){var et=_.elements[j],tt=_.attributes[j]||{},rt=Object.keys(_.styles.hasOwnProperty(j)?_.styles[j]:$[j]),nt=rt.reduce(function(it,st){return it[st]="",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(a){return a.split("-")[0]}var max=Math.max,min=Math.min,round=Math.round;function getUAString(){var a=navigator.userAgentData;return a!=null&&a.brands&&Array.isArray(a.brands)?a.brands.map(function(_){return _.brand+"/"+_.version}).join(" "):navigator.userAgent}function isLayoutViewport(){return!/^((?!chrome|android).)*safari/i.test(getUAString())}function getBoundingClientRect(a,_,$){_===void 0&&(_=!1),$===void 0&&($=!1);var j=a.getBoundingClientRect(),et=1,tt=1;_&&isHTMLElement$2(a)&&(et=a.offsetWidth>0&&round(j.width)/a.offsetWidth||1,tt=a.offsetHeight>0&&round(j.height)/a.offsetHeight||1);var rt=isElement$1(a)?getWindow(a):window,nt=rt.visualViewport,it=!isLayoutViewport()&&$,st=(j.left+(it&&nt?nt.offsetLeft:0))/et,ot=(j.top+(it&&nt?nt.offsetTop:0))/tt,at=j.width/et,ut=j.height/tt;return{width:at,height:ut,top:ot,right:st+at,bottom:ot+ut,left:st,x:st,y:ot}}function getLayoutRect(a){var _=getBoundingClientRect(a),$=a.offsetWidth,j=a.offsetHeight;return Math.abs(_.width-$)<=1&&($=_.width),Math.abs(_.height-j)<=1&&(j=_.height),{x:a.offsetLeft,y:a.offsetTop,width:$,height:j}}function contains$1(a,_){var $=_.getRootNode&&_.getRootNode();if(a.contains(_))return!0;if($&&isShadowRoot($)){var j=_;do{if(j&&a.isSameNode(j))return!0;j=j.parentNode||j.host}while(j)}return!1}function getComputedStyle$1(a){return getWindow(a).getComputedStyle(a)}function isTableElement(a){return["table","td","th"].indexOf(getNodeName(a))>=0}function getDocumentElement(a){return((isElement$1(a)?a.ownerDocument:a.document)||window.document).documentElement}function getParentNode(a){return getNodeName(a)==="html"?a:a.assignedSlot||a.parentNode||(isShadowRoot(a)?a.host:null)||getDocumentElement(a)}function getTrueOffsetParent(a){return!isHTMLElement$2(a)||getComputedStyle$1(a).position==="fixed"?null:a.offsetParent}function getContainingBlock(a){var _=/firefox/i.test(getUAString()),$=/Trident/i.test(getUAString());if($&&isHTMLElement$2(a)){var j=getComputedStyle$1(a);if(j.position==="fixed")return null}var et=getParentNode(a);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||_&&tt.willChange==="filter"||_&&tt.filter&&tt.filter!=="none")return et;et=et.parentNode}return null}function getOffsetParent(a){for(var _=getWindow(a),$=getTrueOffsetParent(a);$&&isTableElement($)&&getComputedStyle$1($).position==="static";)$=getTrueOffsetParent($);return $&&(getNodeName($)==="html"||getNodeName($)==="body"&&getComputedStyle$1($).position==="static")?_:$||getContainingBlock(a)||_}function getMainAxisFromPlacement(a){return["top","bottom"].indexOf(a)>=0?"x":"y"}function within(a,_,$){return max(a,min(_,$))}function withinMaxClamp(a,_,$){var j=within(a,_,$);return j>$?$:j}function getFreshSideObject(){return{top:0,right:0,bottom:0,left:0}}function mergePaddingObject(a){return Object.assign({},getFreshSideObject(),a)}function expandToHashMap(a,_){return _.reduce(function($,j){return $[j]=a,$},{})}var toPaddingObject=function(_,$){return _=typeof _=="function"?_(Object.assign({},$.rects,{placement:$.placement})):_,mergePaddingObject(typeof _!="number"?_:expandToHashMap(_,basePlacements))};function arrow(a){var _,$=a.state,j=a.name,et=a.options,tt=$.elements.arrow,rt=$.modifiersData.popperOffsets,nt=getBasePlacement($.placement),it=getMainAxisFromPlacement(nt),st=[left,right].indexOf(nt)>=0,ot=st?"height":"width";if(!(!tt||!rt)){var at=toPaddingObject(et.padding,$),ut=getLayoutRect(tt),ht=it==="y"?top:left,yt=it==="y"?bottom:right,wt=$.rects.reference[ot]+$.rects.reference[it]-rt[it]-$.rects.popper[ot],Ct=rt[it]-$.rects.reference[it],Pt=getOffsetParent(tt),$t=Pt?it==="y"?Pt.clientHeight||0:Pt.clientWidth||0:0,Mt=wt/2-Ct/2,Lt=at[ht],Dt=$t-ut[ot]-at[yt],zt=$t/2-ut[ot]/2+Mt,Ot=within(Lt,zt,Dt),It=it;$.modifiersData[j]=(_={},_[It]=Ot,_.centerOffset=Ot-zt,_)}}function effect$1(a){var _=a.state,$=a.options,j=$.element,et=j===void 0?"[data-popper-arrow]":j;et!=null&&(typeof et=="string"&&(et=_.elements.popper.querySelector(et),!et)||contains$1(_.elements.popper,et)&&(_.elements.arrow=et))}const arrow$1={name:"arrow",enabled:!0,phase:"main",fn:arrow,effect:effect$1,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function getVariation(a){return a.split("-")[1]}var unsetSides={top:"auto",right:"auto",bottom:"auto",left:"auto"};function roundOffsetsByDPR(a,_){var $=a.x,j=a.y,et=_.devicePixelRatio||1;return{x:round($*et)/et||0,y:round(j*et)/et||0}}function mapToStyles(a){var _,$=a.popper,j=a.popperRect,et=a.placement,tt=a.variation,rt=a.offsets,nt=a.position,it=a.gpuAcceleration,st=a.adaptive,ot=a.roundOffsets,at=a.isFixed,ut=rt.x,ht=ut===void 0?0:ut,yt=rt.y,wt=yt===void 0?0:yt,Ct=typeof ot=="function"?ot({x:ht,y:wt}):{x:ht,y:wt};ht=Ct.x,wt=Ct.y;var Pt=rt.hasOwnProperty("x"),$t=rt.hasOwnProperty("y"),Mt=left,Lt=top,Dt=window;if(st){var zt=getOffsetParent($),Ot="clientHeight",It="clientWidth";if(zt===getWindow($)&&(zt=getDocumentElement($),getComputedStyle$1(zt).position!=="static"&&nt==="absolute"&&(Ot="scrollHeight",It="scrollWidth")),zt=zt,et===top||(et===left||et===right)&&tt===end){Lt=bottom;var Bt=at&&zt===Dt&&Dt.visualViewport?Dt.visualViewport.height:zt[Ot];wt-=Bt-j.height,wt*=it?1:-1}if(et===left||(et===top||et===bottom)&&tt===end){Mt=right;var Ft=at&&zt===Dt&&Dt.visualViewport?Dt.visualViewport.width:zt[It];ht-=Ft-j.width,ht*=it?1:-1}}var jt=Object.assign({position:nt},st&&unsetSides),bt=ot===!0?roundOffsetsByDPR({x:ht,y:wt},getWindow($)):{x:ht,y:wt};if(ht=bt.x,wt=bt.y,it){var vt;return Object.assign({},jt,(vt={},vt[Lt]=$t?"0":"",vt[Mt]=Pt?"0":"",vt.transform=(Dt.devicePixelRatio||1)<=1?"translate("+ht+"px, "+wt+"px)":"translate3d("+ht+"px, "+wt+"px, 0)",vt))}return Object.assign({},jt,(_={},_[Lt]=$t?wt+"px":"",_[Mt]=Pt?ht+"px":"",_.transform="",_))}function computeStyles(a){var _=a.state,$=a.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,st={placement:getBasePlacement(_.placement),variation:getVariation(_.placement),popper:_.elements.popper,popperRect:_.rects.popper,gpuAcceleration:et,isFixed:_.options.strategy==="fixed"};_.modifiersData.popperOffsets!=null&&(_.styles.popper=Object.assign({},_.styles.popper,mapToStyles(Object.assign({},st,{offsets:_.modifiersData.popperOffsets,position:_.options.strategy,adaptive:rt,roundOffsets:it})))),_.modifiersData.arrow!=null&&(_.styles.arrow=Object.assign({},_.styles.arrow,mapToStyles(Object.assign({},st,{offsets:_.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:it})))),_.attributes.popper=Object.assign({},_.attributes.popper,{"data-popper-placement":_.placement})}const computeStyles$1={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:computeStyles,data:{}};var passive={passive:!0};function effect(a){var _=a.state,$=a.instance,j=a.options,et=j.scroll,tt=et===void 0?!0:et,rt=j.resize,nt=rt===void 0?!0:rt,it=getWindow(_.elements.popper),st=[].concat(_.scrollParents.reference,_.scrollParents.popper);return tt&&st.forEach(function(ot){ot.addEventListener("scroll",$.update,passive)}),nt&&it.addEventListener("resize",$.update,passive),function(){tt&&st.forEach(function(ot){ot.removeEventListener("scroll",$.update,passive)}),nt&&it.removeEventListener("resize",$.update,passive)}}const eventListeners={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect,data:{}};var hash$7={left:"right",right:"left",bottom:"top",top:"bottom"};function getOppositePlacement(a){return a.replace(/left|right|bottom|top/g,function(_){return hash$7[_]})}var hash$6={start:"end",end:"start"};function getOppositeVariationPlacement(a){return a.replace(/start|end/g,function(_){return hash$6[_]})}function getWindowScroll(a){var _=getWindow(a),$=_.pageXOffset,j=_.pageYOffset;return{scrollLeft:$,scrollTop:j}}function getWindowScrollBarX(a){return getBoundingClientRect(getDocumentElement(a)).left+getWindowScroll(a).scrollLeft}function getViewportRect(a,_){var $=getWindow(a),j=getDocumentElement(a),et=$.visualViewport,tt=j.clientWidth,rt=j.clientHeight,nt=0,it=0;if(et){tt=et.width,rt=et.height;var st=isLayoutViewport();(st||!st&&_==="fixed")&&(nt=et.offsetLeft,it=et.offsetTop)}return{width:tt,height:rt,x:nt+getWindowScrollBarX(a),y:it}}function getDocumentRect(a){var _,$=getDocumentElement(a),j=getWindowScroll(a),et=(_=a.ownerDocument)==null?void 0:_.body,tt=max($.scrollWidth,$.clientWidth,et?et.scrollWidth:0,et?et.clientWidth:0),rt=max($.scrollHeight,$.clientHeight,et?et.scrollHeight:0,et?et.clientHeight:0),nt=-j.scrollLeft+getWindowScrollBarX(a),it=-j.scrollTop;return getComputedStyle$1(et||$).direction==="rtl"&&(nt+=max($.clientWidth,et?et.clientWidth:0)-tt),{width:tt,height:rt,x:nt,y:it}}function isScrollParent(a){var _=getComputedStyle$1(a),$=_.overflow,j=_.overflowX,et=_.overflowY;return/auto|scroll|overlay|hidden/.test($+et+j)}function getScrollParent(a){return["html","body","#document"].indexOf(getNodeName(a))>=0?a.ownerDocument.body:isHTMLElement$2(a)&&isScrollParent(a)?a:getScrollParent(getParentNode(a))}function listScrollParents(a,_){var $;_===void 0&&(_=[]);var j=getScrollParent(a),et=j===(($=a.ownerDocument)==null?void 0:$.body),tt=getWindow(j),rt=et?[tt].concat(tt.visualViewport||[],isScrollParent(j)?j:[]):j,nt=_.concat(rt);return et?nt:nt.concat(listScrollParents(getParentNode(rt)))}function rectToClientRect(a){return Object.assign({},a,{left:a.x,top:a.y,right:a.x+a.width,bottom:a.y+a.height})}function getInnerBoundingClientRect(a,_){var $=getBoundingClientRect(a,!1,_==="fixed");return $.top=$.top+a.clientTop,$.left=$.left+a.clientLeft,$.bottom=$.top+a.clientHeight,$.right=$.left+a.clientWidth,$.width=a.clientWidth,$.height=a.clientHeight,$.x=$.left,$.y=$.top,$}function getClientRectFromMixedType(a,_,$){return _===viewport?rectToClientRect(getViewportRect(a,$)):isElement$1(_)?getInnerBoundingClientRect(_,$):rectToClientRect(getDocumentRect(getDocumentElement(a)))}function getClippingParents(a){var _=listScrollParents(getParentNode(a)),$=["absolute","fixed"].indexOf(getComputedStyle$1(a).position)>=0,j=$&&isHTMLElement$2(a)?getOffsetParent(a):a;return isElement$1(j)?_.filter(function(et){return isElement$1(et)&&contains$1(et,j)&&getNodeName(et)!=="body"}):[]}function getClippingRect(a,_,$,j){var et=_==="clippingParents"?getClippingParents(a):[].concat(_),tt=[].concat(et,[$]),rt=tt[0],nt=tt.reduce(function(it,st){var ot=getClientRectFromMixedType(a,st,j);return it.top=max(ot.top,it.top),it.right=min(ot.right,it.right),it.bottom=min(ot.bottom,it.bottom),it.left=max(ot.left,it.left),it},getClientRectFromMixedType(a,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(a){var _=a.reference,$=a.element,j=a.placement,et=j?getBasePlacement(j):null,tt=j?getVariation(j):null,rt=_.x+_.width/2-$.width/2,nt=_.y+_.height/2-$.height/2,it;switch(et){case top:it={x:rt,y:_.y-$.height};break;case bottom:it={x:rt,y:_.y+_.height};break;case right:it={x:_.x+_.width,y:nt};break;case left:it={x:_.x-$.width,y:nt};break;default:it={x:_.x,y:_.y}}var st=et?getMainAxisFromPlacement(et):null;if(st!=null){var ot=st==="y"?"height":"width";switch(tt){case start:it[st]=it[st]-(_[ot]/2-$[ot]/2);break;case end:it[st]=it[st]+(_[ot]/2-$[ot]/2);break}}return it}function detectOverflow(a,_){_===void 0&&(_={});var $=_,j=$.placement,et=j===void 0?a.placement:j,tt=$.strategy,rt=tt===void 0?a.strategy:tt,nt=$.boundary,it=nt===void 0?clippingParents:nt,st=$.rootBoundary,ot=st===void 0?viewport:st,at=$.elementContext,ut=at===void 0?popper:at,ht=$.altBoundary,yt=ht===void 0?!1:ht,wt=$.padding,Ct=wt===void 0?0:wt,Pt=mergePaddingObject(typeof Ct!="number"?Ct:expandToHashMap(Ct,basePlacements)),$t=ut===popper?reference:popper,Mt=a.rects.popper,Lt=a.elements[yt?$t:ut],Dt=getClippingRect(isElement$1(Lt)?Lt:Lt.contextElement||getDocumentElement(a.elements.popper),it,ot,rt),zt=getBoundingClientRect(a.elements.reference),Ot=computeOffsets({reference:zt,element:Mt,strategy:"absolute",placement:et}),It=rectToClientRect(Object.assign({},Mt,Ot)),Bt=ut===popper?It:zt,Ft={top:Dt.top-Bt.top+Pt.top,bottom:Bt.bottom-Dt.bottom+Pt.bottom,left:Dt.left-Bt.left+Pt.left,right:Bt.right-Dt.right+Pt.right},jt=a.modifiersData.offset;if(ut===popper&&jt){var bt=jt[et];Object.keys(Ft).forEach(function(vt){var ct=[right,bottom].indexOf(vt)>=0?1:-1,dt=[top,bottom].indexOf(vt)>=0?"y":"x";Ft[vt]+=bt[dt]*ct})}return Ft}function computeAutoPlacement(a,_){_===void 0&&(_={});var $=_,j=$.placement,et=$.boundary,tt=$.rootBoundary,rt=$.padding,nt=$.flipVariations,it=$.allowedAutoPlacements,st=it===void 0?placements:it,ot=getVariation(j),at=ot?nt?variationPlacements:variationPlacements.filter(function(yt){return getVariation(yt)===ot}):basePlacements,ut=at.filter(function(yt){return st.indexOf(yt)>=0});ut.length===0&&(ut=at);var ht=ut.reduce(function(yt,wt){return yt[wt]=detectOverflow(a,{placement:wt,boundary:et,rootBoundary:tt,padding:rt})[getBasePlacement(wt)],yt},{});return Object.keys(ht).sort(function(yt,wt){return ht[yt]-ht[wt]})}function getExpandedFallbackPlacements(a){if(getBasePlacement(a)===auto)return[];var _=getOppositePlacement(a);return[getOppositeVariationPlacement(a),_,getOppositeVariationPlacement(_)]}function flip(a){var _=a.state,$=a.options,j=a.name;if(!_.modifiersData[j]._skip){for(var et=$.mainAxis,tt=et===void 0?!0:et,rt=$.altAxis,nt=rt===void 0?!0:rt,it=$.fallbackPlacements,st=$.padding,ot=$.boundary,at=$.rootBoundary,ut=$.altBoundary,ht=$.flipVariations,yt=ht===void 0?!0:ht,wt=$.allowedAutoPlacements,Ct=_.options.placement,Pt=getBasePlacement(Ct),$t=Pt===Ct,Mt=it||($t||!yt?[getOppositePlacement(Ct)]:getExpandedFallbackPlacements(Ct)),Lt=[Ct].concat(Mt).reduce(function(tr,ir){return tr.concat(getBasePlacement(ir)===auto?computeAutoPlacement(_,{placement:ir,boundary:ot,rootBoundary:at,padding:st,flipVariations:yt,allowedAutoPlacements:wt}):ir)},[]),Dt=_.rects.reference,zt=_.rects.popper,Ot=new Map,It=!0,Bt=Lt[0],Ft=0;Ft=0,dt=ct?"width":"height",mt=detectOverflow(_,{placement:jt,boundary:ot,rootBoundary:at,altBoundary:ut,padding:st}),xt=ct?vt?right:left:vt?bottom:top;Dt[dt]>zt[dt]&&(xt=getOppositePlacement(xt));var At=getOppositePlacement(xt),Rt=[];if(tt&&Rt.push(mt[bt]<=0),nt&&Rt.push(mt[xt]<=0,mt[At]<=0),Rt.every(function(tr){return tr})){Bt=jt,It=!1;break}Ot.set(jt,Rt)}if(It)for(var St=yt?3:1,Tt=function(ir){var nr=Lt.find(function(Zt){var Kt=Ot.get(Zt);if(Kt)return Kt.slice(0,ir).every(function(Qt){return Qt})});if(nr)return Bt=nr,"break"},Et=St;Et>0;Et--){var Nt=Tt(Et);if(Nt==="break")break}_.placement!==Bt&&(_.modifiersData[j]._skip=!0,_.placement=Bt,_.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:a.top-_.height-$.y,right:a.right-_.width+$.x,bottom:a.bottom-_.height+$.y,left:a.left-_.width-$.x}}function isAnySideFullyClipped(a){return[top,right,bottom,left].some(function(_){return a[_]>=0})}function hide(a){var _=a.state,$=a.name,j=_.rects.reference,et=_.rects.popper,tt=_.modifiersData.preventOverflow,rt=detectOverflow(_,{elementContext:"reference"}),nt=detectOverflow(_,{altBoundary:!0}),it=getSideOffsets(rt,j),st=getSideOffsets(nt,et,tt),ot=isAnySideFullyClipped(it),at=isAnySideFullyClipped(st);_.modifiersData[$]={referenceClippingOffsets:it,popperEscapeOffsets:st,isReferenceHidden:ot,hasPopperEscaped:at},_.attributes.popper=Object.assign({},_.attributes.popper,{"data-popper-reference-hidden":ot,"data-popper-escaped":at})}const hide$1={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:hide};function distanceAndSkiddingToXY(a,_,$){var j=getBasePlacement(a),et=[left,top].indexOf(j)>=0?-1:1,tt=typeof $=="function"?$(Object.assign({},_,{placement:a})):$,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(a){var _=a.state,$=a.options,j=a.name,et=$.offset,tt=et===void 0?[0,0]:et,rt=placements.reduce(function(ot,at){return ot[at]=distanceAndSkiddingToXY(at,_.rects,tt),ot},{}),nt=rt[_.placement],it=nt.x,st=nt.y;_.modifiersData.popperOffsets!=null&&(_.modifiersData.popperOffsets.x+=it,_.modifiersData.popperOffsets.y+=st),_.modifiersData[j]=rt}const offset$1={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:offset};function popperOffsets(a){var _=a.state,$=a.name;_.modifiersData[$]=computeOffsets({reference:_.rects.reference,element:_.rects.popper,strategy:"absolute",placement:_.placement})}const popperOffsets$1={name:"popperOffsets",enabled:!0,phase:"read",fn:popperOffsets,data:{}};function getAltAxis(a){return a==="x"?"y":"x"}function preventOverflow(a){var _=a.state,$=a.options,j=a.name,et=$.mainAxis,tt=et===void 0?!0:et,rt=$.altAxis,nt=rt===void 0?!1:rt,it=$.boundary,st=$.rootBoundary,ot=$.altBoundary,at=$.padding,ut=$.tether,ht=ut===void 0?!0:ut,yt=$.tetherOffset,wt=yt===void 0?0:yt,Ct=detectOverflow(_,{boundary:it,rootBoundary:st,padding:at,altBoundary:ot}),Pt=getBasePlacement(_.placement),$t=getVariation(_.placement),Mt=!$t,Lt=getMainAxisFromPlacement(Pt),Dt=getAltAxis(Lt),zt=_.modifiersData.popperOffsets,Ot=_.rects.reference,It=_.rects.popper,Bt=typeof wt=="function"?wt(Object.assign({},_.rects,{placement:_.placement})):wt,Ft=typeof Bt=="number"?{mainAxis:Bt,altAxis:Bt}:Object.assign({mainAxis:0,altAxis:0},Bt),jt=_.modifiersData.offset?_.modifiersData.offset[_.placement]:null,bt={x:0,y:0};if(zt){if(tt){var vt,ct=Lt==="y"?top:left,dt=Lt==="y"?bottom:right,mt=Lt==="y"?"height":"width",xt=zt[Lt],At=xt+Ct[ct],Rt=xt-Ct[dt],St=ht?-It[mt]/2:0,Tt=$t===start?Ot[mt]:It[mt],Et=$t===start?-It[mt]:-Ot[mt],Nt=_.elements.arrow,tr=ht&&Nt?getLayoutRect(Nt):{width:0,height:0},ir=_.modifiersData["arrow#persistent"]?_.modifiersData["arrow#persistent"].padding:getFreshSideObject(),nr=ir[ct],Zt=ir[dt],Kt=within(0,Ot[mt],tr[mt]),Qt=Mt?Ot[mt]/2-St-Kt-nr-Ft.mainAxis:Tt-Kt-nr-Ft.mainAxis,Ht=Mt?-Ot[mt]/2+St+Kt+Zt+Ft.mainAxis:Et+Kt+Zt+Ft.mainAxis,qt=_.elements.arrow&&getOffsetParent(_.elements.arrow),Jt=qt?Lt==="y"?qt.clientTop||0:qt.clientLeft||0:0,ur=(vt=jt==null?void 0:jt[Lt])!=null?vt:0,xr=xt+Qt-ur-Jt,pr=xt+Ht-ur,Cr=within(ht?min(At,xr):At,xt,ht?max(Rt,pr):Rt);zt[Lt]=Cr,bt[Lt]=Cr-xt}if(nt){var Mr,lr=Lt==="x"?top:left,fr=Lt==="x"?bottom:right,_r=zt[Dt],Sr=Dt==="y"?"height":"width",kr=_r+Ct[lr],Ar=_r-Ct[fr],$r=[top,left].indexOf(Pt)!==-1,Or=(Mr=jt==null?void 0:jt[Dt])!=null?Mr:0,Lr=$r?kr:_r-Ot[Sr]-It[Sr]-Or+Ft.altAxis,or=$r?_r+Ot[Sr]+It[Sr]-Or-Ft.altAxis:Ar,Yt=ht&&$r?withinMaxClamp(Lr,_r,or):within(ht?Lr:kr,_r,ht?or:Ar);zt[Dt]=Yt,bt[Dt]=Yt-_r}_.modifiersData[j]=bt}}const preventOverflow$1={name:"preventOverflow",enabled:!0,phase:"main",fn:preventOverflow,requiresIfExists:["offset"]};function getHTMLElementScroll(a){return{scrollLeft:a.scrollLeft,scrollTop:a.scrollTop}}function getNodeScroll(a){return a===getWindow(a)||!isHTMLElement$2(a)?getWindowScroll(a):getHTMLElementScroll(a)}function isElementScaled(a){var _=a.getBoundingClientRect(),$=round(_.width)/a.offsetWidth||1,j=round(_.height)/a.offsetHeight||1;return $!==1||j!==1}function getCompositeRect(a,_,$){$===void 0&&($=!1);var j=isHTMLElement$2(_),et=isHTMLElement$2(_)&&isElementScaled(_),tt=getDocumentElement(_),rt=getBoundingClientRect(a,et,$),nt={scrollLeft:0,scrollTop:0},it={x:0,y:0};return(j||!j&&!$)&&((getNodeName(_)!=="body"||isScrollParent(tt))&&(nt=getNodeScroll(_)),isHTMLElement$2(_)?(it=getBoundingClientRect(_,!0),it.x+=_.clientLeft,it.y+=_.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(a){var _=new Map,$=new Set,j=[];a.forEach(function(tt){_.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=_.get(nt);it&&et(it)}}),j.push(tt)}return a.forEach(function(tt){$.has(tt.name)||et(tt)}),j}function orderModifiers(a){var _=order(a);return modifierPhases.reduce(function($,j){return $.concat(_.filter(function(et){return et.phase===j}))},[])}function debounce(a){var _;return function(){return _||(_=new Promise(function($){Promise.resolve().then(function(){_=void 0,$(a())})})),_}}function mergeByName(a){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(_).map(function($){return _[$]})}var DEFAULT_OPTIONS={placement:"bottom",modifiers:[],strategy:"absolute"};function areValidElements(){for(var a=arguments.length,_=new Array(a),$=0;${}),Mt=reactExports.useCallback(()=>{var Ft;!_||!yt.current||!wt.current||((Ft=$t.current)==null||Ft.call($t),Ct.current=createPopper(yt.current,wt.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:!!st,options:{padding:8}},{name:"preventOverflow",enabled:!!at,options:{boundary:ot}},...$??[]],strategy:et}),Ct.current.forceUpdate(),$t.current=Ct.current.destroy)},[Pt,_,$,ut,rt,tt,nt,it,st,at,ot,et]);reactExports.useEffect(()=>()=>{var Ft;!yt.current&&!wt.current&&((Ft=Ct.current)==null||Ft.destroy(),Ct.current=null)},[]);const Lt=reactExports.useCallback(Ft=>{yt.current=Ft,Mt()},[Mt]),Dt=reactExports.useCallback((Ft={},jt=null)=>({...Ft,ref:mergeRefs(Lt,jt)}),[Lt]),zt=reactExports.useCallback(Ft=>{wt.current=Ft,Mt()},[Mt]),Ot=reactExports.useCallback((Ft={},jt=null)=>({...Ft,ref:mergeRefs(zt,jt),style:{...Ft.style,position:et,minWidth:ut?void 0:"max-content",inset:"0 auto auto 0"}}),[et,zt,ut]),It=reactExports.useCallback((Ft={},jt=null)=>{const{size:bt,shadowColor:vt,bg:ct,style:dt,...mt}=Ft;return{...mt,ref:jt,"data-popper-arrow":"",style:getArrowStyle(Ft)}},[]),Bt=reactExports.useCallback((Ft={},jt=null)=>({...Ft,ref:jt,"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:Ot,getArrowProps:It,getArrowInnerProps:Bt,getReferenceProps:Dt}}function getArrowStyle(a){const{size:_,shadowColor:$,bg:j,style:et}=a,tt={...et,position:"absolute"};return _&&(tt["--popper-arrow-size"]=_),$&&(tt["--popper-arrow-shadow-color"]=$),j&&(tt["--popper-arrow-bg"]=j),tt}function useDisclosure(a={}){const{onClose:_,onOpen:$,isOpen:j,id:et}=a,tt=useCallbackRef$2($),rt=useCallbackRef$2(_),[nt,it]=reactExports.useState(a.defaultIsOpen||!1),st=j!==void 0?j:nt,ot=j!==void 0,at=reactExports.useId(),ut=et??`disclosure-${at}`,ht=reactExports.useCallback(()=>{ot||it(!1),rt==null||rt()},[ot,rt]),yt=reactExports.useCallback(()=>{ot||it(!0),tt==null||tt()},[ot,tt]),wt=reactExports.useCallback(()=>{st?ht():yt()},[st,yt,ht]);function Ct($t={}){return{...$t,"aria-expanded":st,"aria-controls":ut,onClick(Mt){var Lt;(Lt=$t.onClick)==null||Lt.call($t,Mt),wt()}}}function Pt($t={}){return{...$t,hidden:!st,id:ut}}return{isOpen:st,onOpen:yt,onClose:ht,onToggle:wt,isControlled:ot,getButtonProps:Ct,getDisclosureProps:Pt}}function useOutsideClick(a){const{ref:_,handler:$,enabled:j=!0}=a,et=useCallbackRef$2($),rt=reactExports.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;reactExports.useEffect(()=>{if(!j)return;const nt=at=>{isValidEvent(at,_)&&(rt.isPointerDown=!0)},it=at=>{if(rt.ignoreEmulatedMouseEvents){rt.ignoreEmulatedMouseEvents=!1;return}rt.isPointerDown&&$&&isValidEvent(at,_)&&(rt.isPointerDown=!1,et(at))},st=at=>{rt.ignoreEmulatedMouseEvents=!0,$&&rt.isPointerDown&&isValidEvent(at,_)&&(rt.isPointerDown=!1,et(at))},ot=getOwnerDocument$1(_.current);return ot.addEventListener("mousedown",nt,!0),ot.addEventListener("mouseup",it,!0),ot.addEventListener("touchstart",nt,!0),ot.addEventListener("touchend",st,!0),()=>{ot.removeEventListener("mousedown",nt,!0),ot.removeEventListener("mouseup",it,!0),ot.removeEventListener("touchstart",nt,!0),ot.removeEventListener("touchend",st,!0)}},[$,_,et,rt,j])}function isValidEvent(a,_){var $;const j=a.target;return j&&!getOwnerDocument$1(j).contains(j)?!1:!(($=_.current)!=null&&$.contains(j))}function getOwnerDocument$1(a){var _;return(_=a==null?void 0:a.ownerDocument)!=null?_:document}function useAnimationState(a){const{isOpen:_,ref:$}=a,[j,et]=reactExports.useState(_),[tt,rt]=reactExports.useState(!1);return reactExports.useEffect(()=>{tt||(et(_),rt(!0))},[_,tt,j]),useEventListener(()=>$.current,"animationend",()=>{et(_)}),{present:!(_?!1:!j),onComplete(){var it;const st=getOwnerWindow($.current),ot=new st.CustomEvent("animationend",{bubbles:!0});(it=$.current)==null||it.dispatchEvent(ot)}}}function lazyDisclosure(a){const{wasSelected:_,enabled:$,isSelected:j,mode:et="unmount"}=a;return!!(!$||j||et==="keepMounted"&&_)}var[MenuDescendantsProvider,useMenuDescendantsContext,useMenuDescendants,useMenuDescendant]=createDescendantContext(),[MenuProvider,useMenuContext]=createContext$1({strict:!1,name:"MenuContext"});function useIds$1(a,..._){const $=reactExports.useId(),j=a||$;return reactExports.useMemo(()=>_.map(et=>`${et}-${j}`),[j,_])}function getOwnerDocument(a){var _;return(_=a==null?void 0:a.ownerDocument)!=null?_:document}function isActiveElement(a){return getOwnerDocument(a).activeElement===a}function useMenu(a={}){const{id:_,closeOnSelect:$=!0,closeOnBlur:j=!0,initialFocusRef:et,autoSelect:tt=!0,isLazy:rt,isOpen:nt,defaultIsOpen:it,onClose:st,onOpen:ot,placement:at="bottom-start",lazyBehavior:ut="unmount",direction:ht,computePositionOnMount:yt=!1,...wt}=a,Ct=reactExports.useRef(null),Pt=reactExports.useRef(null),$t=useMenuDescendants(),Mt=reactExports.useCallback(()=>{requestAnimationFrame(()=>{var Nt;(Nt=Ct.current)==null||Nt.focus({preventScroll:!1})})},[]),Lt=reactExports.useCallback(()=>{const Nt=setTimeout(()=>{var tr;if(et)(tr=et.current)==null||tr.focus();else{const ir=$t.firstEnabled();ir&&vt(ir.index)}});At.current.add(Nt)},[$t,et]),Dt=reactExports.useCallback(()=>{const Nt=setTimeout(()=>{const tr=$t.lastEnabled();tr&&vt(tr.index)});At.current.add(Nt)},[$t]),zt=reactExports.useCallback(()=>{ot==null||ot(),tt?Lt():Mt()},[tt,Lt,Mt,ot]),{isOpen:Ot,onOpen:It,onClose:Bt,onToggle:Ft}=useDisclosure({isOpen:nt,defaultIsOpen:it,onClose:st,onOpen:zt});useOutsideClick({enabled:Ot&&j,ref:Ct,handler:Nt=>{var tr;(tr=Pt.current)!=null&&tr.contains(Nt.target)||Bt()}});const jt=usePopper({...wt,enabled:Ot||yt,placement:at,direction:ht}),[bt,vt]=reactExports.useState(-1);useUpdateEffect(()=>{Ot||vt(-1)},[Ot]),useFocusOnHide(Ct,{focusRef:Pt,visible:Ot,shouldFocus:!0});const ct=useAnimationState({isOpen:Ot,ref:Ct}),[dt,mt]=useIds$1(_,"menu-button","menu-list"),xt=reactExports.useCallback(()=>{It(),Mt()},[It,Mt]),At=reactExports.useRef(new Set([]));reactExports.useEffect(()=>{const Nt=At.current;return()=>{Nt.forEach(tr=>clearTimeout(tr)),Nt.clear()}},[]);const Rt=reactExports.useCallback(()=>{It(),Lt()},[Lt,It]),St=reactExports.useCallback(()=>{It(),Dt()},[It,Dt]),Tt=reactExports.useCallback(()=>{var Nt,tr;const ir=getOwnerDocument(Ct.current),nr=(Nt=Ct.current)==null?void 0:Nt.contains(ir.activeElement);if(!(Ot&&!nr))return;const Kt=(tr=$t.item(bt))==null?void 0:tr.node;Kt==null||Kt.focus({preventScroll:!0})},[Ot,bt,$t]),Et=reactExports.useRef(null);return{openAndFocusMenu:xt,openAndFocusFirstItem:Rt,openAndFocusLastItem:St,onTransitionEnd:Tt,unstable__animationState:ct,descendants:$t,popper:jt,buttonId:dt,menuId:mt,forceUpdate:jt.forceUpdate,orientation:"vertical",isOpen:Ot,onToggle:Ft,onOpen:It,onClose:Bt,menuRef:Ct,buttonRef:Pt,focusedIndex:bt,closeOnSelect:$,closeOnBlur:j,autoSelect:tt,setFocusedIndex:vt,isLazy:rt,lazyBehavior:ut,initialFocusRef:et,rafId:Et}}function useMenuButton(a={},_=null){const $=useMenuContext(),{onToggle:j,popper:et,openAndFocusFirstItem:tt,openAndFocusLastItem:rt}=$,nt=reactExports.useCallback(it=>{const st=it.key,at={Enter:tt,ArrowDown:tt,ArrowUp:rt}[st];at&&(it.preventDefault(),it.stopPropagation(),at(it))},[tt,rt]);return{...a,ref:mergeRefs($.buttonRef,_,et.referenceRef),id:$.buttonId,"data-active":dataAttr($.isOpen),"aria-expanded":$.isOpen,"aria-haspopup":"menu","aria-controls":$.menuId,onClick:callAllHandlers$1(a.onClick,j),onKeyDown:callAllHandlers$1(a.onKeyDown,nt)}}function isTargetMenuItem(a){var _;return isHTMLElement$1(a)&&!!((_=a==null?void 0:a.getAttribute("role"))!=null&&_.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:st,lazyBehavior:ot,unstable__animationState:at}=$,ut=useMenuDescendantsContext(),ht=useShortcut({preventDefault:Pt=>Pt.key!==" "&&isTargetMenuItem(Pt.target)}),yt=reactExports.useCallback(Pt=>{if(!Pt.currentTarget.contains(Pt.target))return;const $t=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)}}[$t];if(Lt){Pt.preventDefault(),Lt(Pt);return}const Dt=ht(zt=>{const Ot=getNextItemFromSearch(ut.values(),zt,It=>{var Bt,Ft;return(Ft=(Bt=It==null?void 0:It.node)==null?void 0:Bt.textContent)!=null?Ft:""},ut.item(j));if(Ot){const It=ut.indexOf(Ot.node);et(It)}});isTargetMenuItem(Pt.target)&&Dt(Pt)},[ut,j,ht,nt,et]),wt=reactExports.useRef(!1);rt&&(wt.current=!0);const Ct=lazyDisclosure({wasSelected:wt.current,enabled:st,mode:ot,isSelected:at.present});return{...a,ref:mergeRefs(tt,_),children:Ct?a.children:null,tabIndex:-1,role:"menu",id:it,style:{...a.style,transformOrigin:"var(--popper-transform-origin)"},"aria-orientation":"vertical",onKeyDown:callAllHandlers$1(a.onKeyDown,yt)}}function useMenuPositioner(a={}){const{popper:_,isOpen:$}=useMenuContext();return _.getPopperProps({...a,style:{visibility:$?"visible":"hidden",...a.style}})}function useMenuItem(a={},_=null){const{onMouseEnter:$,onMouseMove:j,onMouseLeave:et,onClick:tt,onFocus:rt,isDisabled:nt,isFocusable:it,closeOnSelect:st,type:ot,...at}=a,ut=useMenuContext(),{setFocusedIndex:ht,focusedIndex:yt,closeOnSelect:wt,onClose:Ct,menuRef:Pt,isOpen:$t,menuId:Mt,rafId:Lt}=ut,Dt=reactExports.useRef(null),zt=`${Mt}-menuitem-${reactExports.useId()}`,{index:Ot,register:It}=useMenuDescendant({disabled:nt&&!it}),Bt=reactExports.useCallback(xt=>{$==null||$(xt),!nt&&ht(Ot)},[ht,Ot,nt,$]),Ft=reactExports.useCallback(xt=>{j==null||j(xt),Dt.current&&!isActiveElement(Dt.current)&&Bt(xt)},[Bt,j]),jt=reactExports.useCallback(xt=>{et==null||et(xt),!nt&&ht(-1)},[ht,nt,et]),bt=reactExports.useCallback(xt=>{tt==null||tt(xt),isTargetMenuItem(xt.currentTarget)&&(st??wt)&&Ct()},[Ct,tt,wt,st]),vt=reactExports.useCallback(xt=>{rt==null||rt(xt),ht(Ot)},[ht,rt,Ot]),ct=Ot===yt,dt=nt&&!it;useUpdateEffect(()=>{if($t)return ct&&!dt&&Dt.current?(Lt.current&&cancelAnimationFrame(Lt.current),Lt.current=requestAnimationFrame(()=>{var xt;(xt=Dt.current)==null||xt.focus({preventScroll:!0}),Lt.current=null})):Pt.current&&!isActiveElement(Pt.current)&&Pt.current.focus({preventScroll:!0}),()=>{Lt.current&&cancelAnimationFrame(Lt.current)}},[ct,dt,Pt,$t]);const mt=useClickable({onClick:bt,onFocus:vt,onMouseEnter:Bt,onMouseMove:Ft,onMouseLeave:jt,ref:mergeRefs(It,Dt,_),isDisabled:nt,isFocusable:it});return{...at,...mt,type:ot??mt.type,id:zt,role:"menuitem",tabIndex:ct?0:-1}}function isHTMLElement$1(a){var _;if(!isElement(a))return!1;const $=(_=a.ownerDocument.defaultView)!=null?_:window;return a instanceof $.HTMLElement}function isElement(a){return a!=null&&typeof a=="object"&&"nodeType"in a&&a.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=a=>{const{children:_}=a,$=useMultiStyleConfig("Menu",a),j=omitThemingProps(a),{direction:et}=useTheme(),{descendants:tt,...rt}=useMenu({...j,direction:et}),nt=reactExports.useMemo(()=>rt,[rt]),{isOpen:it,onClose:st,forceUpdate:ot}=nt;return jsxRuntimeExports.jsx(MenuDescendantsProvider,{value:tt,children:jsxRuntimeExports.jsx(MenuProvider,{value:nt,children:jsxRuntimeExports.jsx(MenuStylesProvider,{value:$,children:runIfFn$2(_,{isOpen:it,onClose:st,forceUpdate:ot})})})})};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}=a,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:_,type:tt,...j,__css:rt})}),MenuIcon=a=>{const{className:_,children:$,...j}=a,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",_);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}=a,it=useMenuItem(nt,_),ot=$||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:$}),ot,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(_,$){var j,et;const{rootProps:tt,motionProps:rt,...nt}=_,{isOpen:it,onTransitionEnd:st,unstable__animationState:ot}=useMenuContext(),at=useMenuList(nt,$),ut=useMenuPositioner(tt),ht=useMenuStyles();return jsxRuntimeExports.jsx(chakra.div,{...ut,__css:{zIndex:(et=_.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:st,onAnimationComplete:callAll(ot.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}=a,tt=useMenuButton(et,_),rt=j||StyledMenuButton;return jsxRuntimeExports.jsx(rt,{...tt,className:cx("chakra-menu__menu-button",a.className),children:jsxRuntimeExports.jsx(chakra.span,{__css:{pointerEvents:"none",flex:"1 1 auto",minW:0},children:a.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=a=>transitions[a||"none"],ModalTransition=reactExports.forwardRef((a,_)=>{const{preset:$,motionProps:j=getMotionProps($),...et}=a;return jsxRuntimeExports.jsx(MotionSection$1,{ref:_,...j,...et})});ModalTransition.displayName="ModalTransition";var __defProp$7=Object.defineProperty,__defNormalProp$2=(a,_,$)=>_ in a?__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(a){return this.modals.set(a,this.modals.size+1),this.modals.size}remove(a){this.modals.delete(a)}isTopModal(a){return a?this.modals.get(a)===this.modals.size:!1}},modalManager=new ModalManager;function useModalManager(a,_){const[$,j]=reactExports.useState(0);return reactExports.useEffect(()=>{const et=a.current;if(et){if(_){const tt=modalManager.add(et);j(tt)}return()=>{modalManager.remove(et),j(0)}}},[_,a]),$}var getDefaultParent=function(a){if(typeof document>"u")return null;var _=Array.isArray(a)?a[0]:a;return _.ownerDocument.body},counterMap=new WeakMap,uncontrolledNodes=new WeakMap,markerMap={},lockCount=0,unwrapHost=function(a){return a&&(a.host||unwrapHost(a.parentNode))},correctTargets=function(a,_){return _.map(function($){if(a.contains($))return $;var j=unwrapHost($);return j&&a.contains(j)?j:(console.error("aria-hidden",$,"in not contained inside",a,". Doing nothing"),null)}).filter(function($){return!!$})},applyAttributeToOthers=function(a,_,$,j){var et=correctTargets(_,Array.isArray(a)?a:[a]);markerMap[$]||(markerMap[$]=new WeakMap);var tt=markerMap[$],rt=[],nt=new Set,it=new Set(et),st=function(at){!at||nt.has(at)||(nt.add(at),st(at.parentNode))};et.forEach(st);var ot=function(at){!at||it.has(at)||Array.prototype.forEach.call(at.children,function(ut){if(nt.has(ut))ot(ut);else{var ht=ut.getAttribute(j),yt=ht!==null&&ht!=="false",wt=(counterMap.get(ut)||0)+1,Ct=(tt.get(ut)||0)+1;counterMap.set(ut,wt),tt.set(ut,Ct),rt.push(ut),wt===1&&yt&&uncontrolledNodes.set(ut,!0),Ct===1&&ut.setAttribute($,"true"),yt||ut.setAttribute(j,"true")}})};return ot(_),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(a)?a:[a]),et=getDefaultParent(a);return et?(j.push.apply(j,Array.from(et.querySelectorAll("[aria-live]"))),applyAttributeToOthers(j,et,$,"aria-hidden")):function(){return null}};function useModal(a){const{isOpen:_,onClose:$,id:j,closeOnOverlayClick:et=!0,closeOnEsc:tt=!0,useInert:rt=!0,onOverlayClick:nt,onEsc:it}=a,st=reactExports.useRef(null),ot=reactExports.useRef(null),[at,ut,ht]=useIds(j,"chakra-modal","chakra-modal--header","chakra-modal--body");useAriaHidden(st,_&&rt);const yt=useModalManager(st,_),wt=reactExports.useRef(null),Ct=reactExports.useCallback(Bt=>{wt.current=Bt.target},[]),Pt=reactExports.useCallback(Bt=>{Bt.key==="Escape"&&(Bt.stopPropagation(),tt&&($==null||$()),it==null||it())},[tt,$,it]),[$t,Mt]=reactExports.useState(!1),[Lt,Dt]=reactExports.useState(!1),zt=reactExports.useCallback((Bt={},Ft=null)=>({role:"dialog",...Bt,ref:mergeRefs(Ft,st),id:at,tabIndex:-1,"aria-modal":!0,"aria-labelledby":$t?ut:void 0,"aria-describedby":Lt?ht:void 0,onClick:callAllHandlers$1(Bt.onClick,jt=>jt.stopPropagation())}),[ht,Lt,at,ut,$t]),Ot=reactExports.useCallback(Bt=>{Bt.stopPropagation(),wt.current===Bt.target&&modalManager.isTopModal(st.current)&&(et&&($==null||$()),nt==null||nt())},[$,et,nt]),It=reactExports.useCallback((Bt={},Ft=null)=>({...Bt,ref:mergeRefs(Ft,ot),onClick:callAllHandlers$1(Bt.onClick,Ot),onKeyDown:callAllHandlers$1(Bt.onKeyDown,Pt),onMouseDown:callAllHandlers$1(Bt.onMouseDown,Ct)}),[Pt,Ct,Ot]);return{isOpen:_,onClose:$,headerId:ut,bodyId:ht,setBodyMounted:Dt,setHeaderMounted:Mt,dialogRef:st,overlayRef:ot,getDialogProps:zt,getDialogContainerProps:It,index:yt}}function useAriaHidden(a,_){const $=a.current;reactExports.useEffect(()=>{if(!(!a.current||!_))return hideOthers(a.current)},[_,a,$])}function useIds(a,..._){const $=reactExports.useId(),j=a||$;return reactExports.useMemo(()=>_.map(et=>`${et}-${j}`),[j,_])}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=a=>{const _={scrollBehavior:"outside",autoFocus:!0,trapFocus:!0,returnFocusOnClose:!0,blockScrollOnMount:!0,allowPinchZoom:!1,motionPreset:"scale",lockFocusAcrossFrames:!0,...a},{portalProps:$,children:j,autoFocus:et,trapFocus:tt,initialFocusRef:rt,finalFocusRef:nt,returnFocusOnClose:it,blockScrollOnMount:st,allowPinchZoom:ot,preserveScrollBarGap:at,motionPreset:ut,lockFocusAcrossFrames:ht,onCloseComplete:yt}=_,wt=useMultiStyleConfig("Modal",_),Pt={...useModal(_),autoFocus:et,trapFocus:tt,initialFocusRef:rt,finalFocusRef:nt,returnFocusOnClose:it,blockScrollOnMount:st,allowPinchZoom:ot,preserveScrollBarGap:at,motionPreset:ut,lockFocusAcrossFrames:ht};return jsxRuntimeExports.jsx(ModalContextProvider,{value:Pt,children:jsxRuntimeExports.jsx(ModalStylesProvider,{value:wt,children:jsxRuntimeExports.jsx(AnimatePresence,{onExitComplete:yt,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=a.forwardProps,nt=a.children,it=a.className,st=a.removeScrollBar,ot=a.enabled,at=a.shards,ut=a.sideCar,ht=a.noIsolation,yt=a.inert,wt=a.allowPinchZoom,Ct=a.as,Pt=Ct===void 0?"div":Ct,$t=a.gapMode,Mt=__rest$3(a,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),Lt=ut,Dt=useMergeRefs([$,_]),zt=__assign(__assign({},Mt),et);return reactExports.createElement(reactExports.Fragment,null,ot&&reactExports.createElement(Lt,{sideCar:effectCar$1,removeScrollBar:st,shards:at,noIsolation:ht,inert:yt,setCallbacks:tt,allowPinchZoom:!!wt,lockRef:$,gapMode:$t}),rt?reactExports.cloneElement(reactExports.Children.only(nt),__assign(__assign({},zt),{ref:Dt})):reactExports.createElement(Pt,__assign({},zt,{className:it,ref:Dt}),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 a=document.createElement("style");a.type="text/css";var _=getNonce$1();return _&&a.setAttribute("nonce",_),a}function injectStyles(a,_){a.styleSheet?a.styleSheet.cssText=_:a.appendChild(document.createTextNode(_))}function insertStyleTag(a){var _=document.head||document.getElementsByTagName("head")[0];_.appendChild(a)}var stylesheetSingleton=function(){var a=0,_=null;return{add:function($){a==0&&(_=makeStyleTag())&&(injectStyles(_,$),insertStyleTag(_)),a++},remove:function(){a--,!a&&_&&(_.parentNode&&_.parentNode.removeChild(_),_=null)}}},styleHookSingleton=function(){var a=stylesheetSingleton();return function(_,$){reactExports.useEffect(function(){return a.add(_),function(){a.remove()}},[_&&$])}},styleSingleton=function(){var a=styleHookSingleton(),_=function($){var j=$.styles,et=$.dynamic;return a(j,et),null};return _},zeroGap$1={left:0,top:0,right:0,gap:0},parse$b=function(a){return parseInt(a||"",10)||0},getOffset$1=function(a){var _=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(a){if(a===void 0&&(a="margin"),typeof window>"u")return zeroGap$1;var _=getOffset$1(a),$=document.documentElement.clientWidth,j=window.innerWidth;return{left:_[0],top:_[1],right:_[2],gap:Math.max(0,j-$+_[2]-_[0])}},Style$1=styleSingleton(),getStyles$1=function(a,_,$,j){var et=a.left,tt=a.top,rt=a.right,nt=a.gap;return $===void 0&&($="margin"),` - .`.concat(noScrollbarsClassName$1,` { - overflow: hidden `).concat(j,`; - padding-right: `).concat(nt,"px ").concat(j,`; - } - body { - overflow: hidden `).concat(j,`; - overscroll-behavior: contain; - `).concat([_&&"position: relative ".concat(j,";"),$==="margin"&&` - padding-left: `.concat(et,`px; - padding-top: `).concat(tt,`px; - padding-right: `).concat(rt,`px; - margin-left:0; - margin-top:0; - margin-right: `).concat(nt,"px ").concat(j,`; - `),$==="padding"&&"padding-right: ".concat(nt,"px ").concat(j,";")].filter(Boolean).join(""),` - } - - .`).concat(zeroRightClassName$1,` { - right: `).concat(nt,"px ").concat(j,`; - } - - .`).concat(fullWidthClassName$1,` { - margin-right: `).concat(nt,"px ").concat(j,`; - } - - .`).concat(zeroRightClassName$1," .").concat(zeroRightClassName$1,` { - right: 0 `).concat(j,`; - } - - .`).concat(fullWidthClassName$1," .").concat(fullWidthClassName$1,` { - margin-right: 0 `).concat(j,`; - } - - body { - `).concat(removedBarSizeVariable$1,": ").concat(nt,`px; - } -`)},RemoveScrollBar$1=function(a){var _=a.noRelative,$=a.noImportant,j=a.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,!_,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(a){return a.tagName==="TEXTAREA"},elementCanBeScrolled$1=function(a,_){var $=window.getComputedStyle(a);return $[_]!=="hidden"&&!($.overflowY===$.overflowX&&!alwaysContainsScroll$1(a)&&$[_]==="visible")},elementCouldBeVScrolled$1=function(a){return elementCanBeScrolled$1(a,"overflowY")},elementCouldBeHScrolled$1=function(a){return elementCanBeScrolled$1(a,"overflowX")},locationCouldBeScrolled$1=function(a,_){var $=_.ownerDocument,j=_;do{typeof ShadowRoot<"u"&&j instanceof ShadowRoot&&(j=j.host);var et=elementCouldBeScrolled$1(a,j);if(et){var tt=getScrollVariables$1(a,j),rt=tt[1],nt=tt[2];if(rt>nt)return!0}j=j.parentNode}while(j&&j!==$.body);return!1},getVScrollVariables$1=function(a){var _=a.scrollTop,$=a.scrollHeight,j=a.clientHeight;return[_,$,j]},getHScrollVariables$1=function(a){var _=a.scrollLeft,$=a.scrollWidth,j=a.clientWidth;return[_,$,j]},elementCouldBeScrolled$1=function(a,_){return a==="v"?elementCouldBeVScrolled$1(_):elementCouldBeHScrolled$1(_)},getScrollVariables$1=function(a,_){return a==="v"?getVScrollVariables$1(_):getHScrollVariables$1(_)},getDirectionFactor$1=function(a,_){return a==="h"&&_==="rtl"?-1:1},handleScroll$1=function(a,_,$,j,et){var tt=getDirectionFactor$1(a,window.getComputedStyle(_).direction),rt=tt*j,nt=$.target,it=_.contains(nt),st=!1,ot=rt>0,at=0,ut=0;do{var ht=getScrollVariables$1(a,nt),yt=ht[0],wt=ht[1],Ct=ht[2],Pt=wt-Ct-tt*yt;(yt||Pt)&&elementCouldBeScrolled$1(a,nt)&&(at+=Pt,ut+=yt),nt instanceof ShadowRoot?nt=nt.host:nt=nt.parentNode}while(!it&&nt!==document.body||it&&(_.contains(nt)||_===nt));return(ot&&(Math.abs(at)<1||!et)||!ot&&(Math.abs(ut)<1||!et))&&(st=!0),st},getTouchXY$1=function(a){return"changedTouches"in a?[a.changedTouches[0].clientX,a.changedTouches[0].clientY]:[0,0]},getDeltaXY$1=function(a){return[a.deltaX,a.deltaY]},extractRef$1=function(a){return a&&"current"in a?a.current:a},deltaCompare$1=function(a,_){return a[0]===_[0]&&a[1]===_[1]},generateStyle$1=function(a){return` - .block-interactivity-`.concat(a,` {pointer-events: none;} - .allow-interactivity-`).concat(a,` {pointer-events: all;} -`)},idCounter$1=0,lockStack$1=[];function RemoveScrollSideCar$1(a){var _=reactExports.useRef([]),$=reactExports.useRef([0,0]),j=reactExports.useRef(),et=reactExports.useState(idCounter$1++)[0],tt=reactExports.useState(styleSingleton)[0],rt=reactExports.useRef(a);reactExports.useEffect(function(){rt.current=a},[a]),reactExports.useEffect(function(){if(a.inert){document.body.classList.add("block-interactivity-".concat(et));var wt=__spreadArray([a.lockRef.current],(a.shards||[]).map(extractRef$1),!0).filter(Boolean);return wt.forEach(function(Ct){return Ct.classList.add("allow-interactivity-".concat(et))}),function(){document.body.classList.remove("block-interactivity-".concat(et)),wt.forEach(function(Ct){return Ct.classList.remove("allow-interactivity-".concat(et))})}}},[a.inert,a.lockRef.current,a.shards]);var nt=reactExports.useCallback(function(wt,Ct){if("touches"in wt&&wt.touches.length===2)return!rt.current.allowPinchZoom;var Pt=getTouchXY$1(wt),$t=$.current,Mt="deltaX"in wt?wt.deltaX:$t[0]-Pt[0],Lt="deltaY"in wt?wt.deltaY:$t[1]-Pt[1],Dt,zt=wt.target,Ot=Math.abs(Mt)>Math.abs(Lt)?"h":"v";if("touches"in wt&&Ot==="h"&&zt.type==="range")return!1;var It=locationCouldBeScrolled$1(Ot,zt);if(!It)return!0;if(It?Dt=Ot:(Dt=Ot==="v"?"h":"v",It=locationCouldBeScrolled$1(Ot,zt)),!It)return!1;if(!j.current&&"changedTouches"in wt&&(Mt||Lt)&&(j.current=Dt),!Dt)return!0;var Bt=j.current||Dt;return handleScroll$1(Bt,Ct,wt,Bt==="h"?Mt:Lt,!0)},[]),it=reactExports.useCallback(function(wt){var Ct=wt;if(!(!lockStack$1.length||lockStack$1[lockStack$1.length-1]!==tt)){var Pt="deltaY"in Ct?getDeltaXY$1(Ct):getTouchXY$1(Ct),$t=_.current.filter(function(Dt){return Dt.name===Ct.type&&(Dt.target===Ct.target||Ct.target===Dt.shadowParent)&&deltaCompare$1(Dt.delta,Pt)})[0];if($t&&$t.should){Ct.cancelable&&Ct.preventDefault();return}if(!$t){var Mt=(rt.current.shards||[]).map(extractRef$1).filter(Boolean).filter(function(Dt){return Dt.contains(Ct.target)}),Lt=Mt.length>0?nt(Ct,Mt[0]):!rt.current.noIsolation;Lt&&Ct.cancelable&&Ct.preventDefault()}}},[]),st=reactExports.useCallback(function(wt,Ct,Pt,$t){var Mt={name:wt,delta:Ct,target:Pt,should:$t,shadowParent:getOutermostShadowParent$1(Pt)};_.current.push(Mt),setTimeout(function(){_.current=_.current.filter(function(Lt){return Lt!==Mt})},1)},[]),ot=reactExports.useCallback(function(wt){$.current=getTouchXY$1(wt),j.current=void 0},[]),at=reactExports.useCallback(function(wt){st(wt.type,getDeltaXY$1(wt),wt.target,nt(wt,a.lockRef.current))},[]),ut=reactExports.useCallback(function(wt){st(wt.type,getTouchXY$1(wt),wt.target,nt(wt,a.lockRef.current))},[]);reactExports.useEffect(function(){return lockStack$1.push(tt),a.setCallbacks({onScrollCapture:at,onWheelCapture:at,onTouchMoveCapture:ut}),document.addEventListener("wheel",it,nonPassive$1),document.addEventListener("touchmove",it,nonPassive$1),document.addEventListener("touchstart",ot,nonPassive$1),function(){lockStack$1=lockStack$1.filter(function(wt){return wt!==tt}),document.removeEventListener("wheel",it,nonPassive$1),document.removeEventListener("touchmove",it,nonPassive$1),document.removeEventListener("touchstart",ot,nonPassive$1)}},[]);var ht=a.removeScrollBar,yt=a.inert;return reactExports.createElement(reactExports.Fragment,null,yt?reactExports.createElement(tt,{styles:generateStyle$1(et)}):null,ht?reactExports.createElement(RemoveScrollBar$1,{gapMode:a.gapMode}):null)}function getOutermostShadowParent$1(a){for(var _=null;a!==null;)a instanceof ShadowRoot&&(_=a.host,a=a.host),a=a.parentNode;return _}const SideCar$1=exportSidecar(effectCar$1,RemoveScrollSideCar$1);var ReactRemoveScroll$1=reactExports.forwardRef(function(a,_){return reactExports.createElement(RemoveScroll$1,__assign({},a,{ref:_,sideCar:SideCar$1}))});ReactRemoveScroll$1.classNames=RemoveScroll$1.classNames;function ModalFocusScope(a){const{autoFocus:_,trapFocus:$,dialogRef:j,initialFocusRef:et,blockScrollOnMount:tt,allowPinchZoom:rt,finalFocusRef:nt,returnFocusOnClose:it,preserveScrollBarGap:st,lockFocusAcrossFrames:ot,isOpen:at}=useModalContext(),[ut,ht]=usePresence();reactExports.useEffect(()=>{!ut&&ht&&setTimeout(ht)},[ut,ht]);const yt=useModalManager(j,at);return jsxRuntimeExports.jsx(FocusLock,{autoFocus:_,isDisabled:!$,initialFocusRef:et,finalFocusRef:nt,restoreFocus:it,contentRef:j,lockFocusAcrossFrames:ot,children:jsxRuntimeExports.jsx(ReactRemoveScroll$1,{removeScrollBar:!st,allowPinchZoom:rt,enabled:yt===1&&tt,forwardProps:!0,children:a.children})})}var ModalContent=forwardRef((a,_)=>{const{className:$,children:j,containerProps:et,motionProps:tt,...rt}=a,{getDialogProps:nt,getDialogContainerProps:it}=useModalContext(),st=nt(rt,_),ot=it(et),at=cx("chakra-modal__content",$),ut=useModalStyles(),ht={display:"flex",flexDirection:"column",position:"relative",width:"100%",outline:0,...ut.dialog},yt={display:"flex",width:"100vw",height:"$100vh",position:"fixed",left:0,top:0,...ut.dialogContainer},{motionPreset:wt}=useModalContext();return jsxRuntimeExports.jsx(ModalFocusScope,{children:jsxRuntimeExports.jsx(chakra.div,{...ot,className:"chakra-modal__content-container",tabIndex:-1,__css:yt,children:jsxRuntimeExports.jsx(ModalTransition,{preset:wt,motionProps:tt,className:at,...st,__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(a)return(j=($=placementMap[a])==null?void 0:$[_])!=null?j:a}function Drawer(a){var _;const{isOpen:$,onClose:j,placement:et="right",children:tt,...rt}=a,nt=useTheme(),it=(_=nt.components)==null?void 0:_.Drawer,st=getDrawerPlacement(et,nt.direction);return jsxRuntimeExports.jsx(DrawerContextProvider,{value:{placement:st},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}=a,{getDialogProps:nt,getDialogContainerProps:it,isOpen:st}=useModalContext(),ot=nt(rt,_),at=it(tt),ut=cx("chakra-modal__content",$),ht=useModalStyles(),yt={display:"flex",flexDirection:"column",position:"relative",width:"100%",outline:0,...ht.dialog},wt={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:wt,children:jsxRuntimeExports.jsx(MotionDiv$2,{motionProps:et,direction:Ct,in:st,className:ut,...ot,__css:yt,children:j})})})});DrawerContent.displayName="DrawerContent";var ModalFooter=forwardRef((a,_)=>{const{className:$,...j}=a,et=cx("chakra-modal__footer",$),rt={display:"flex",alignItems:"center",justifyContent:"flex-end",...useModalStyles().footer};return jsxRuntimeExports.jsx(chakra.footer,{ref:_,...j,__css:rt,className:et})});ModalFooter.displayName="ModalFooter";var ModalHeader=forwardRef((a,_)=>{const{className:$,...j}=a,{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:_,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}=a,rt=cx("chakra-modal__overlay",$),it={pos:"fixed",left:"0",top:"0",w:"100vw",h:"100vh",...useModalStyles().overlay},{motionPreset:st}=useModalContext(),at=et||(st==="none"?{}:fadeConfig);return jsxRuntimeExports.jsx(MotionDiv$1,{...at,__css:it,ref:_,className:rt,...tt})});ModalOverlay.displayName="ModalOverlay";var ModalBody=forwardRef((a,_)=>{const{className:$,...j}=a,{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:_,className:rt,id:et,...j,__css:nt.body})});ModalBody.displayName="ModalBody";var ModalCloseButton=forwardRef((a,_)=>{const{onClick:$,className:j,...et}=a,{onClose:tt}=useModalContext(),rt=cx("chakra-modal__close-btn",j),nt=useModalStyles();return jsxRuntimeExports.jsx(CloseButton,{ref:_,__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(a){const _=reactExports.Children.only(a.children),{getTriggerProps:$}=usePopoverContext();return reactExports.cloneElement(_,$(_.props,_.ref))}PopoverTrigger.displayName="PopoverTrigger";var TRIGGER={click:"click",hover:"hover"};function usePopover(a={}){const{closeOnBlur:_=!0,closeOnEsc:$=!0,initialFocusRef:j,id:et,returnFocusOnClose:tt=!0,autoFocus:rt=!0,arrowSize:nt,arrowShadowColor:it,trigger:st=TRIGGER.click,openDelay:ot=200,closeDelay:at=200,isLazy:ut,lazyBehavior:ht="unmount",computePositionOnMount:yt,...wt}=a,{isOpen:Ct,onClose:Pt,onOpen:$t,onToggle:Mt}=useDisclosure(a),Lt=reactExports.useRef(null),Dt=reactExports.useRef(null),zt=reactExports.useRef(null),Ot=reactExports.useRef(!1),It=reactExports.useRef(!1);Ct&&(It.current=!0);const[Bt,Ft]=reactExports.useState(!1),[jt,bt]=reactExports.useState(!1),vt=reactExports.useId(),ct=et??vt,[dt,mt,xt,At]=["popover-trigger","popover-content","popover-header","popover-body"].map(pr=>`${pr}-${ct}`),{referenceRef:Rt,getArrowProps:St,getPopperProps:Tt,getArrowInnerProps:Et,forceUpdate:Nt}=usePopper({...wt,enabled:Ct||!!yt}),tr=useAnimationState({isOpen:Ct,ref:zt});useFocusOnPointerDown({enabled:Ct,ref:Dt}),useFocusOnHide(zt,{focusRef:Dt,visible:Ct,shouldFocus:tt&&st===TRIGGER.click}),useFocusOnShow(zt,{focusRef:j,visible:Ct,shouldFocus:rt&&st===TRIGGER.click});const ir=lazyDisclosure({wasSelected:It.current,enabled:ut,mode:ht,isSelected:tr.present}),nr=reactExports.useCallback((pr={},Cr=null)=>{const Mr={...pr,style:{...pr.style,transformOrigin:cssVars.transformOrigin.varRef,[cssVars.arrowSize.var]:nt?`${nt}px`:void 0,[cssVars.arrowShadowColor.var]:it},ref:mergeRefs(zt,Cr),children:ir?pr.children:null,id:mt,tabIndex:-1,role:"dialog",onKeyDown:callAllHandlers$1(pr.onKeyDown,lr=>{$&&lr.key==="Escape"&&Pt()}),onBlur:callAllHandlers$1(pr.onBlur,lr=>{const fr=getRelatedTarget(lr),_r=contains(zt.current,fr),Sr=contains(Dt.current,fr);Ct&&_&&(!_r&&!Sr)&&Pt()}),"aria-labelledby":Bt?xt:void 0,"aria-describedby":jt?At:void 0};return st===TRIGGER.hover&&(Mr.role="tooltip",Mr.onMouseEnter=callAllHandlers$1(pr.onMouseEnter,()=>{Ot.current=!0}),Mr.onMouseLeave=callAllHandlers$1(pr.onMouseLeave,lr=>{lr.nativeEvent.relatedTarget!==null&&(Ot.current=!1,setTimeout(()=>Pt(),at))})),Mr},[ir,mt,Bt,xt,jt,At,st,$,Pt,Ct,_,at,it,nt]),Zt=reactExports.useCallback((pr={},Cr=null)=>Tt({...pr,style:{visibility:Ct?"visible":"hidden",...pr.style}},Cr),[Ct,Tt]),Kt=reactExports.useCallback((pr,Cr=null)=>({...pr,ref:mergeRefs(Cr,Lt,Rt)}),[Lt,Rt]),Qt=reactExports.useRef(),Ht=reactExports.useRef(),qt=reactExports.useCallback(pr=>{Lt.current==null&&Rt(pr)},[Rt]),Jt=reactExports.useCallback((pr={},Cr=null)=>{const Mr={...pr,ref:mergeRefs(Dt,Cr,qt),id:dt,"aria-haspopup":"dialog","aria-expanded":Ct,"aria-controls":mt};return st===TRIGGER.click&&(Mr.onClick=callAllHandlers$1(pr.onClick,Mt)),st===TRIGGER.hover&&(Mr.onFocus=callAllHandlers$1(pr.onFocus,()=>{Qt.current===void 0&&$t()}),Mr.onBlur=callAllHandlers$1(pr.onBlur,lr=>{const fr=getRelatedTarget(lr),_r=!contains(zt.current,fr);Ct&&_&&_r&&Pt()}),Mr.onKeyDown=callAllHandlers$1(pr.onKeyDown,lr=>{lr.key==="Escape"&&Pt()}),Mr.onMouseEnter=callAllHandlers$1(pr.onMouseEnter,()=>{Ot.current=!0,Qt.current=window.setTimeout(()=>$t(),ot)}),Mr.onMouseLeave=callAllHandlers$1(pr.onMouseLeave,()=>{Ot.current=!1,Qt.current&&(clearTimeout(Qt.current),Qt.current=void 0),Ht.current=window.setTimeout(()=>{Ot.current===!1&&Pt()},at)})),Mr},[dt,Ct,mt,st,qt,Mt,$t,_,Pt,ot,at]);reactExports.useEffect(()=>()=>{Qt.current&&clearTimeout(Qt.current),Ht.current&&clearTimeout(Ht.current)},[]);const ur=reactExports.useCallback((pr={},Cr=null)=>({...pr,id:xt,ref:mergeRefs(Cr,Mr=>{Ft(!!Mr)})}),[xt]),xr=reactExports.useCallback((pr={},Cr=null)=>({...pr,id:At,ref:mergeRefs(Cr,Mr=>{bt(!!Mr)})}),[At]);return{forceUpdate:Nt,isOpen:Ct,onAnimationComplete:tr.onComplete,onClose:Pt,getAnchorProps:Kt,getArrowProps:St,getArrowInnerProps:Et,getPopoverPositionerProps:Zt,getPopoverProps:nr,getTriggerProps:Jt,getHeaderProps:ur,getBodyProps:xr}}function contains(a,_){return a===_||(a==null?void 0:a.contains(_))}function getRelatedTarget(a){var _;const $=a.currentTarget.ownerDocument.activeElement;return(_=a.relatedTarget)!=null?_:$}function Popover(a){const _=useMultiStyleConfig("Popover",a),{children:$,...j}=omitThemingProps(a),et=useTheme(),tt=usePopover({...j,direction:et.direction});return jsxRuntimeExports.jsx(PopoverProvider,{value:tt,children:jsxRuntimeExports.jsx(PopoverStylesProvider,{value:_,children:runIfFn$2($,{isOpen:tt.isOpen,onClose:tt.onClose,forceUpdate:tt.forceUpdate})})})}Popover.displayName="Popover";var resolveVar=(a,_)=>_?`${a}.${_}, ${_}`:void 0;function PopoverArrow(a){var _;const{bg:$,bgColor:j,backgroundColor:et,shadow:tt,boxShadow:rt,shadowColor:nt}=a,{getArrowProps:it,getArrowInnerProps:st}=usePopoverContext(),ot=usePopoverStyles(),at=(_=$??j)!=null?_: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",a.className),...st(a),__css:{"--popper-arrow-shadow-color":resolveVar("colors",nt),"--popper-arrow-bg":resolveVar("colors",at),"--popper-arrow-shadow":resolveVar("shadows",ut),...ot.arrow}})})}PopoverArrow.displayName="PopoverArrow";var PopoverBody=forwardRef(function(_,$){const{getBodyProps:j}=usePopoverContext(),et=usePopoverStyles();return jsxRuntimeExports.jsx(chakra.div,{...j(_,$),className:cx("chakra-popover__body",_.className),__css:et.body})});PopoverBody.displayName="PopoverBody";function mergeVariants(a){if(a)return{enter:{...a.enter,visibility:"visible"},exit:{...a.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(_,$){const{variants:j=scaleFade,...et}=_,{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(_,$){const{rootProps:j,motionProps:et,...tt}=_,{getPopoverProps:rt,getPopoverPositionerProps:nt,onAnimationComplete:it}=usePopoverContext(),st=usePopoverStyles(),ot={position:"relative",display:"flex",flexDirection:"column",...st.content};return jsxRuntimeExports.jsx(chakra.div,{...nt(j),__css:st.popper,className:"chakra-popover__popper",children:jsxRuntimeExports.jsx(PopoverTransition,{...et,...rt(tt,$),onAnimationComplete:callAll(it,tt.onAnimationComplete),className:cx("chakra-popover__content",_.className),__css:ot})})});PopoverContent.displayName="PopoverContent";function isInputEvent(a){return a&&isObject$5(a)&&isObject$5(a.target)}function useRadioGroup(a={}){const{onChange:_,value:$,defaultValue:j,name:et,isDisabled:tt,isFocusable:rt,isNative:nt,...it}=a,[st,ot]=reactExports.useState(j||""),at=typeof $<"u",ut=at?$:st,ht=reactExports.useRef(null),yt=reactExports.useCallback(()=>{const Dt=ht.current;if(!Dt)return;let zt="input:not(:disabled):checked";const Ot=Dt.querySelector(zt);if(Ot){Ot.focus();return}zt="input:not(:disabled)";const It=Dt.querySelector(zt);It==null||It.focus()},[]),Ct=`radio-${reactExports.useId()}`,Pt=et||Ct,$t=reactExports.useCallback(Dt=>{const zt=isInputEvent(Dt)?Dt.target.value:Dt;at||ot(zt),_==null||_(String(zt))},[_,at]),Mt=reactExports.useCallback((Dt={},zt=null)=>({...Dt,ref:mergeRefs(zt,ht),role:"radiogroup"}),[]),Lt=reactExports.useCallback((Dt={},zt=null)=>({...Dt,ref:zt,name:Pt,[nt?"checked":"isChecked"]:ut!=null?Dt.value===ut:void 0,onChange(It){$t(It)},"data-radiogroup":!0}),[nt,Pt,$t,ut]);return{getRootProps:Mt,getRadioProps:Lt,name:Pt,ref:ht,focus:yt,setValue:ot,value:ut,onChange:$t,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,...st}=a,{value:ot,onChange:at,getRootProps:ut,name:ht,htmlProps:yt}=useRadioGroup(st),wt=reactExports.useMemo(()=>({name:ht,size:j,onChange:at,colorScheme:$,value:ot,variant:et,isDisabled:nt,isFocusable:it}),[ht,j,at,$,ot,et,nt,it]);return jsxRuntimeExports.jsx(RadioGroupProvider,{value:wt,children:jsxRuntimeExports.jsx(chakra.div,{...ut(yt,_),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(a={}){const{defaultChecked:_,isChecked:$,isFocusable:j,isDisabled:et,isReadOnly:tt,isRequired:rt,onChange:nt,isInvalid:it,name:st,value:ot,id:at,"data-radiogroup":ut,"aria-describedby":ht,...yt}=a,wt=`radio-${reactExports.useId()}`,Ct=useFormControlContext(),$t=!!useRadioGroupContext()||!!ut;let Lt=!!Ct&&!$t?Ct.id:wt;Lt=at??Lt;const Dt=et??(Ct==null?void 0:Ct.isDisabled),zt=tt??(Ct==null?void 0:Ct.isReadOnly),Ot=rt??(Ct==null?void 0:Ct.isRequired),It=it??(Ct==null?void 0:Ct.isInvalid),[Bt,Ft]=reactExports.useState(!1),[jt,bt]=reactExports.useState(!1),[vt,ct]=reactExports.useState(!1),[dt,mt]=reactExports.useState(!1),[xt,At]=reactExports.useState(!!_),Rt=typeof $<"u",St=Rt?$:xt;reactExports.useEffect(()=>trackFocusVisible(Ft),[]);const Tt=reactExports.useCallback(qt=>{if(zt||Dt){qt.preventDefault();return}Rt||At(qt.target.checked),nt==null||nt(qt)},[Rt,Dt,zt,nt]),Et=reactExports.useCallback(qt=>{qt.key===" "&&mt(!0)},[mt]),Nt=reactExports.useCallback(qt=>{qt.key===" "&&mt(!1)},[mt]),tr=reactExports.useCallback((qt={},Jt=null)=>({...qt,ref:Jt,"data-active":dataAttr(dt),"data-hover":dataAttr(vt),"data-disabled":dataAttr(Dt),"data-invalid":dataAttr(It),"data-checked":dataAttr(St),"data-focus":dataAttr(jt),"data-focus-visible":dataAttr(jt&&Bt),"data-readonly":dataAttr(zt),"aria-hidden":!0,onMouseDown:callAllHandlers$1(qt.onMouseDown,()=>mt(!0)),onMouseUp:callAllHandlers$1(qt.onMouseUp,()=>mt(!1)),onMouseEnter:callAllHandlers$1(qt.onMouseEnter,()=>ct(!0)),onMouseLeave:callAllHandlers$1(qt.onMouseLeave,()=>ct(!1))}),[dt,vt,Dt,It,St,jt,zt,Bt]),{onFocus:ir,onBlur:nr}=Ct??{},Zt=reactExports.useCallback((qt={},Jt=null)=>{const ur=Dt&&!j;return{...qt,id:Lt,ref:Jt,type:"radio",name:st,value:ot,onChange:callAllHandlers$1(qt.onChange,Tt),onBlur:callAllHandlers$1(nr,qt.onBlur,()=>bt(!1)),onFocus:callAllHandlers$1(ir,qt.onFocus,()=>bt(!0)),onKeyDown:callAllHandlers$1(qt.onKeyDown,Et),onKeyUp:callAllHandlers$1(qt.onKeyUp,Nt),checked:St,disabled:ur,readOnly:zt,required:Ot,"aria-invalid":ariaAttr(It),"aria-disabled":ariaAttr(ur),"aria-required":ariaAttr(Ot),"data-readonly":dataAttr(zt),"aria-describedby":ht,style:visuallyHiddenStyle}},[Dt,j,Lt,st,ot,Tt,nr,ir,Et,Nt,St,zt,Ot,It,ht]);return{state:{isInvalid:It,isFocused:jt,isChecked:St,isActive:dt,isHovered:vt,isDisabled:Dt,isReadOnly:zt,isRequired:Ot},getCheckboxProps:tr,getRadioProps:tr,getInputProps:Zt,getLabelProps:(qt={},Jt=null)=>({...qt,ref:Jt,onMouseDown:callAllHandlers$1(qt.onMouseDown,stopEvent),"data-disabled":dataAttr(Dt),"data-checked":dataAttr(St),"data-invalid":dataAttr(It)}),getRootProps:(qt,Jt=null)=>({...qt,ref:Jt,"data-disabled":dataAttr(Dt),"data-checked":dataAttr(St),"data-invalid":dataAttr(It)}),htmlProps:yt}}function stopEvent(a){a.preventDefault(),a.stopPropagation()}function split$1(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}=a,rt=useMultiStyleConfig("Radio",{...j,...a}),nt=omitThemingProps(a),{spacing:it="0.5rem",children:st,isDisabled:ot=j==null?void 0:j.isDisabled,isFocusable:at=j==null?void 0:j.isFocusable,inputProps:ut,...ht}=nt;let yt=a.isChecked;(j==null?void 0:j.value)!=null&&tt!=null&&(yt=j.value===tt);let wt=et;j!=null&&j.onChange&&tt!=null&&(wt=callAll(j.onChange,et));const Ct=($=a==null?void 0:a.name)!=null?$:j==null?void 0:j.name,{getInputProps:Pt,getCheckboxProps:$t,getLabelProps:Mt,getRootProps:Lt,htmlProps:Dt}=useRadio({...ht,isChecked:yt,isFocusable:at,isDisabled:ot,onChange:wt,name:Ct}),[zt,Ot]=split$1(Dt,layoutPropNames),It=$t(Ot),Bt=Pt(ut,_),Ft=Mt(),jt=Object.assign({},zt,Lt()),bt={display:"inline-flex",alignItems:"center",verticalAlign:"top",cursor:"pointer",position:"relative",...rt.container},vt={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",...jt,__css:bt,children:[jsxRuntimeExports.jsx("input",{className:"chakra-radio__input",...Bt}),jsxRuntimeExports.jsx(chakra.span,{className:"chakra-radio__control",...It,__css:vt}),st&&jsxRuntimeExports.jsx(chakra.span,{className:"chakra-radio__label",...Ft,__css:ct,children:st})]})});Radio.displayName="Radio";var SelectField=forwardRef(function(_,$){const{children:j,placeholder:et,className:tt,...rt}=_;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(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",a),{rootProps:et,placeholder:tt,icon:rt,color:nt,height:it,h:st,minH:ot,minHeight:at,iconColor:ut,iconSize:ht,...yt}=omitThemingProps(a),[wt,Ct]=split(yt,layoutPropNames),Pt=useFormControl(Ct),$t={width:"100%",height:"fit-content",position:"relative",color:nt},Mt={paddingEnd:"2rem",...j.field,_focus:{zIndex:"unset",...($=j.field)==null?void 0:$._focus}};return jsxRuntimeExports.jsxs(chakra.div,{className:"chakra-select__wrapper",__css:$t,...wt,...et,children:[jsxRuntimeExports.jsx(SelectField,{ref:_,height:st??it,minH:ot??at,placeholder:tt,...Pt,__css:Mt,children:a.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=a=>jsxRuntimeExports.jsx("svg",{viewBox:"0 0 24 24",...a,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=a=>{const{children:_=jsxRuntimeExports.jsx(DefaultIcon,{}),...$}=a,j=reactExports.cloneElement(_,{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(_)?j:null})};SelectIcon.displayName="SelectIcon";var Switch=forwardRef(function(_,$){const j=useMultiStyleConfig("Switch",_),{spacing:et="0.5rem",children:tt,...rt}=omitThemingProps(_),{getIndicatorProps:nt,getInputProps:it,getCheckboxProps:st,getRootProps:ot,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]),yt=reactExports.useMemo(()=>({userSelect:"none",marginStart:et,...j.label}),[et,j.label]);return jsxRuntimeExports.jsxs(chakra.label,{...ot(),className:cx("chakra-switch",_.className),__css:ut,children:[jsxRuntimeExports.jsx("input",{className:"chakra-switch__input",...it({},$)}),jsxRuntimeExports.jsx(chakra.span,{...st(),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:yt,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",a),{className:j,layout:et,...tt}=omitThemingProps(a);return jsxRuntimeExports.jsx(TableStylesProvider,{value:$,children:jsxRuntimeExports.jsx(chakra.table,{ref:_,__css:{tableLayout:et,...$.table},className:cx("chakra-table",j),...tt})})});Table.displayName="Table";var Tr=forwardRef((a,_)=>{const $=useTableStyles();return jsxRuntimeExports.jsx(chakra.tr,{...a,ref:_,__css:$.tr})}),TableContainer=forwardRef((a,_)=>{var $;const{overflow:j,overflowX:et,className:tt,...rt}=a;return jsxRuntimeExports.jsx(chakra.div,{ref:_,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,{...a,ref:_,__css:$.tbody})}),Td=forwardRef(({isNumeric:a,..._},$)=>{const j=useTableStyles();return jsxRuntimeExports.jsx(chakra.td,{..._,ref:$,__css:j.td,"data-is-numeric":a})}),[TabsDescendantsProvider,useTabsDescendantsContext,useTabsDescendants,useTabsDescendant]=createDescendantContext();function useTabs(a){var _;const{defaultIndex:$,onChange:j,index:et,isManual:tt,isLazy:rt,lazyBehavior:nt="unmount",orientation:it="horizontal",direction:st="ltr",...ot}=a,[at,ut]=reactExports.useState($??0),[ht,yt]=useControllableState({defaultValue:$??0,value:et,onChange:j});reactExports.useEffect(()=>{et!=null&&ut(et)},[et]);const wt=useTabsDescendants(),Ct=reactExports.useId();return{id:`tabs-${(_=a.id)!=null?_:Ct}`,selectedIndex:ht,focusedIndex:at,setSelectedIndex:yt,setFocusedIndex:ut,isManual:tt,isLazy:rt,lazyBehavior:nt,orientation:it,descendants:wt,direction:st,htmlProps:ot}}var[TabsProvider,useTabsContext]=createContext$1({name:"TabsContext",errorMessage:"useTabsContext: `context` is undefined. Seems you forgot to wrap all tabs components within "});function useTabList(a){const{focusedIndex:_,orientation:$,direction:j}=useTabsContext(),et=useTabsDescendantsContext(),tt=reactExports.useCallback(rt=>{const nt=()=>{var $t;const Mt=et.nextEnabled(_);Mt&&(($t=Mt.node)==null||$t.focus())},it=()=>{var $t;const Mt=et.prevEnabled(_);Mt&&(($t=Mt.node)==null||$t.focus())},st=()=>{var $t;const Mt=et.firstEnabled();Mt&&(($t=Mt.node)==null||$t.focus())},ot=()=>{var $t;const Mt=et.lastEnabled();Mt&&(($t=Mt.node)==null||$t.focus())},at=$==="horizontal",ut=$==="vertical",ht=rt.key,yt=j==="ltr"?"ArrowLeft":"ArrowRight",wt=j==="ltr"?"ArrowRight":"ArrowLeft",Pt={[yt]:()=>at&&it(),[wt]:()=>at&&nt(),ArrowDown:()=>ut&&nt(),ArrowUp:()=>ut&&it(),Home:st,End:ot}[ht];Pt&&(rt.preventDefault(),Pt(rt))},[et,_,$,j]);return{...a,role:"tablist","aria-orientation":$,onKeyDown:callAllHandlers$1(a.onKeyDown,tt)}}function useTab(a){const{isDisabled:_=!1,isFocusable:$=!1,...j}=a,{setSelectedIndex:et,isManual:tt,id:rt,setFocusedIndex:nt,selectedIndex:it}=useTabsContext(),{index:st,register:ot}=useTabsDescendant({disabled:_&&!$}),at=st===it,ut=()=>{et(st)},ht=()=>{nt(st),!tt&&!(_&&$)&&et(st)};return{...useClickable({...j,ref:mergeRefs(ot,a.ref),isDisabled:_,isFocusable:$,onClick:callAllHandlers$1(a.onClick,ut)}),id:makeTabId(rt,st),role:"tab",tabIndex:at?0:-1,type:"button","aria-selected":at,"aria-controls":makeTabPanelId(rt,st),onFocus:_?void 0:callAllHandlers$1(a.onFocus,ht)}}var[TabPanelProvider,useTabPanelContext]=createContext$1({});function useTabPanels(a){const _=useTabsContext(),{id:$,selectedIndex:j}=_,tt=getValidChildren(a.children).map((rt,nt)=>reactExports.createElement(TabPanelProvider,{key:nt,value:{isSelected:nt===j,id:makeTabPanelId($,nt),tabId:makeTabId($,nt),selectedIndex:j}},rt));return{...a,children:tt}}function useTabPanel(a){const{children:_,...$}=a,{isLazy:j,lazyBehavior:et}=useTabsContext(),{isSelected:tt,id:rt,tabId:nt}=useTabPanelContext(),it=reactExports.useRef(!1);tt&&(it.current=!0);const st=lazyDisclosure({wasSelected:it.current,isSelected:tt,enabled:j,mode:et});return{tabIndex:0,...$,children:st?_:null,role:"tabpanel","aria-labelledby":nt,hidden:!tt,id:rt}}function makeTabId(a,_){return`${a}--tab-${_}`}function makeTabPanelId(a,_){return`${a}--tabpanel-${_}`}var[TabsStylesProvider,useTabsStyles]=createContext$1({name:"TabsStylesContext",errorMessage:`useTabsStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),Tabs=forwardRef(function(_,$){const j=useMultiStyleConfig("Tabs",_),{children:et,className:tt,...rt}=omitThemingProps(_),{htmlProps:nt,descendants:it,...st}=useTabs(rt),ot=reactExports.useMemo(()=>st,[st]),{isFitted:at,...ut}=nt,ht={position:"relative",...j.root};return jsxRuntimeExports.jsx(TabsDescendantsProvider,{value:it,children:jsxRuntimeExports.jsx(TabsProvider,{value:ot,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(_,$){const j=useTabList({..._,ref:$}),tt={display:"flex",...useTabsStyles().tablist};return jsxRuntimeExports.jsx(chakra.div,{...j,className:cx("chakra-tabs__tablist",_.className),__css:tt})});TabList.displayName="TabList";var TabPanel=forwardRef(function(_,$){const j=useTabPanel({..._,ref:$}),et=useTabsStyles();return jsxRuntimeExports.jsx(chakra.div,{outline:"0",...j,className:cx("chakra-tabs__tab-panel",_.className),__css:et.tabpanel})});TabPanel.displayName="TabPanel";var TabPanels=forwardRef(function(_,$){const j=useTabPanels(_),et=useTabsStyles();return jsxRuntimeExports.jsx(chakra.div,{...j,width:"100%",ref:$,className:cx("chakra-tabs__tab-panels",_.className),__css:et.tabpanels})});TabPanels.displayName="TabPanels";var Tab=forwardRef(function(_,$){const j=useTabsStyles(),et=useTab({..._,ref:$}),tt={outline:"0",display:"flex",alignItems:"center",justifyContent:"center",...j.tab};return jsxRuntimeExports.jsx(chakra.button,{...et,className:cx("chakra-tabs__tab",_.className),__css:tt})});Tab.displayName="Tab";function omit$2(a,_=[]){const $=Object.assign({},a);for(const j of _)j in $&&delete $[j];return $}var omitted=["h","minH","height","minHeight"],Textarea=forwardRef((a,_)=>{const $=useStyleConfig("Textarea",a),{className:j,rows:et,...tt}=omitThemingProps(a),rt=useFormControl(tt),nt=et?omit$2($,omitted):$;return jsxRuntimeExports.jsx(chakra.textarea,{ref:_,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=a=>{var _;return((_=a.current)==null?void 0:_.ownerDocument)||document},getWin=a=>{var _,$;return(($=(_=a.current)==null?void 0:_.ownerDocument)==null?void 0:$.defaultView)||window};function useTooltip(a={}){const{openDelay:_=0,closeDelay:$=0,closeOnClick:j=!0,closeOnMouseDown:et,closeOnScroll:tt,closeOnPointerDown:rt=et,closeOnEsc:nt=!0,onOpen:it,onClose:st,placement:ot,id:at,isOpen:ut,defaultIsOpen:ht,arrowSize:yt=10,arrowShadowColor:wt,arrowPadding:Ct,modifiers:Pt,isDisabled:$t,gutter:Mt,offset:Lt,direction:Dt,...zt}=a,{isOpen:Ot,onOpen:It,onClose:Bt}=useDisclosure({isOpen:ut,defaultIsOpen:ht,onOpen:it,onClose:st}),{referenceRef:Ft,getPopperProps:jt,getArrowInnerProps:bt,getArrowProps:vt}=usePopper({enabled:Ot,placement:ot,arrowPadding:Ct,modifiers:Pt,gutter:Mt,offset:Lt,direction:Dt}),ct=reactExports.useId(),mt=`tooltip-${at??ct}`,xt=reactExports.useRef(null),At=reactExports.useRef(),Rt=reactExports.useCallback(()=>{At.current&&(clearTimeout(At.current),At.current=void 0)},[]),St=reactExports.useRef(),Tt=reactExports.useCallback(()=>{St.current&&(clearTimeout(St.current),St.current=void 0)},[]),Et=reactExports.useCallback(()=>{Tt(),Bt()},[Bt,Tt]),Nt=useCloseEvent(xt,Et),tr=reactExports.useCallback(()=>{if(!$t&&!At.current){Ot&&Nt();const Jt=getWin(xt);At.current=Jt.setTimeout(It,_)}},[Nt,$t,Ot,It,_]),ir=reactExports.useCallback(()=>{Rt();const Jt=getWin(xt);St.current=Jt.setTimeout(Et,$)},[$,Et,Rt]),nr=reactExports.useCallback(()=>{Ot&&j&&ir()},[j,ir,Ot]),Zt=reactExports.useCallback(()=>{Ot&&rt&&ir()},[rt,ir,Ot]),Kt=reactExports.useCallback(Jt=>{Ot&&Jt.key==="Escape"&&ir()},[Ot,ir]);useEventListener(()=>getDoc(xt),"keydown",nt?Kt:void 0),useEventListener(()=>{if(!tt)return null;const Jt=xt.current;if(!Jt)return null;const ur=getScrollParent$1(Jt);return ur.localName==="body"?getWin(xt):ur},"scroll",()=>{Ot&&tt&&Et()},{passive:!0,capture:!0}),reactExports.useEffect(()=>{$t&&(Rt(),Ot&&Bt())},[$t,Ot,Bt,Rt]),reactExports.useEffect(()=>()=>{Rt(),Tt()},[Rt,Tt]),useEventListener(()=>xt.current,"pointerleave",ir);const Qt=reactExports.useCallback((Jt={},ur=null)=>({...Jt,ref:mergeRefs(xt,ur,Ft),onPointerEnter:callAllHandlers$1(Jt.onPointerEnter,pr=>{pr.pointerType!=="touch"&&tr()}),onClick:callAllHandlers$1(Jt.onClick,nr),onPointerDown:callAllHandlers$1(Jt.onPointerDown,Zt),onFocus:callAllHandlers$1(Jt.onFocus,tr),onBlur:callAllHandlers$1(Jt.onBlur,ir),"aria-describedby":Ot?mt:void 0}),[tr,ir,Zt,Ot,mt,nr,Ft]),Ht=reactExports.useCallback((Jt={},ur=null)=>jt({...Jt,style:{...Jt.style,[cssVars.arrowSize.var]:yt?`${yt}px`:void 0,[cssVars.arrowShadowColor.var]:wt}},ur),[jt,yt,wt]),qt=reactExports.useCallback((Jt={},ur=null)=>{const xr={...Jt.style,position:"relative",transformOrigin:cssVars.transformOrigin.varRef};return{ref:ur,...zt,...Jt,id:mt,role:"tooltip",style:xr}},[zt,mt]);return{isOpen:Ot,show:tr,hide:ir,getTriggerProps:Qt,getTooltipProps:qt,getTooltipPositionerProps:Ht,getArrowProps:vt,getArrowInnerProps:bt}}var closeEventName="chakra-ui:close-tooltip";function useCloseEvent(a,_){return reactExports.useEffect(()=>{const $=getDoc(a);return $.addEventListener(closeEventName,_),()=>$.removeEventListener(closeEventName,_)},[_,a]),()=>{const $=getDoc(a),j=getWin(a);$.dispatchEvent(new j.CustomEvent(closeEventName))}}function omit$1(a,_=[]){const $=Object.assign({},a);for(const j of _)j in $&&delete $[j];return $}function pick$1(a,_){const $={};for(const j of _)j in a&&($[j]=a[j]);return $}var MotionDiv=chakra(motion.div),Tooltip=forwardRef((a,_)=>{var $,j;const et=useStyleConfig("Tooltip",a),tt=omitThemingProps(a),rt=useTheme(),{children:nt,label:it,shouldWrapChildren:st,"aria-label":ot,hasArrow:at,bg:ut,portalProps:ht,background:yt,backgroundColor:wt,bgColor:Ct,motionProps:Pt,...$t}=tt,Mt=(j=($=yt??wt)!=null?$:ut)!=null?j:Ct;if(Mt){et.bg=Mt;const jt=getCSSVar(rt,"colors",Mt);et[cssVars.arrowBg.var]=jt}const Lt=useTooltip({...$t,direction:rt.direction}),Dt=typeof nt=="string"||st;let zt;if(Dt)zt=jsxRuntimeExports.jsx(chakra.span,{display:"inline-block",tabIndex:0,...Lt.getTriggerProps(),children:nt});else{const jt=reactExports.Children.only(nt);zt=reactExports.cloneElement(jt,Lt.getTriggerProps(jt.props,jt.ref))}const Ot=!!ot,It=Lt.getTooltipProps({},_),Bt=Ot?omit$1(It,["role","id"]):It,Ft=pick$1(It,["role","id"]);return it?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[zt,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,...Bt,__css:et,children:[it,Ot&&jsxRuntimeExports.jsx(chakra.span,{srOnly:!0,...Ft,children:ot}),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:{}};/** - * @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__",st=500,ot="__lodash_placeholder__",at=1,ut=2,ht=4,yt=1,wt=2,Ct=1,Pt=2,$t=4,Mt=8,Lt=16,Dt=32,zt=64,Ot=128,It=256,Bt=512,Ft=30,jt="...",bt=800,vt=16,ct=1,dt=2,mt=3,xt=1/0,At=9007199254740991,Rt=17976931348623157e292,St=NaN,Tt=4294967295,Et=Tt-1,Nt=Tt>>>1,tr=[["ary",Ot],["bind",Ct],["bindKey",Pt],["curry",Mt],["curryRight",Lt],["flip",Bt],["partial",Dt],["partialRight",zt],["rearg",It]],ir="[object Arguments]",nr="[object Array]",Zt="[object AsyncFunction]",Kt="[object Boolean]",Qt="[object Date]",Ht="[object DOMException]",qt="[object Error]",Jt="[object Function]",ur="[object GeneratorFunction]",xr="[object Map]",pr="[object Number]",Cr="[object Null]",Mr="[object Object]",lr="[object Promise]",fr="[object Proxy]",_r="[object RegExp]",Sr="[object Set]",kr="[object String]",Ar="[object Symbol]",$r="[object Undefined]",Or="[object WeakMap]",Lr="[object WeakSet]",or="[object ArrayBuffer]",Yt="[object DataView]",er="[object Float32Array]",Gt="[object Float64Array]",Vt="[object Int8Array]",Wt="[object Int16Array]",ar="[object Int32Array]",yr="[object Uint8Array]",Er="[object Uint8ClampedArray]",Rr="[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,En=/<%([\s\S]+?)%>/g,un=/<%=([\s\S]+?)%>/g,Vr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,hn=/^\w*$/,fn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Kr=/[\\^$.*+?()[\]{}|]/g,Rn=RegExp(Kr.source),dn=/^\s+/,Gr=/\s/,gn=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,an=/\{\n\/\* \[wrapped with (.+)\] \*/,Zr=/,? & /,An=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Sn=/[()=,{}\[\]\/\s]/,nn=/\\(\\)?/g,Pn=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,yn=/\w*$/,_n=/^[-+]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",Ts=" \\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",$s="A-Z\\xc0-\\xd6\\xd8-\\xde",yl="\\ufe0e\\ufe0f",Eo=as+gs+vs+Ts,Wo="['’]",wo="["+Yn+"]",Go="["+Eo+"]",So="["+ls+"]",Zs="\\d+",Ro="["+us+"]",xl="["+Wn+"]",_l="[^"+Yn+Eo+Zs+us+Wn+$s+"]",lo="\\ud83c[\\udffb-\\udfff]",Yl="(?:"+So+"|"+lo+")",El="[^"+Yn+"]",jo="(?:\\ud83c[\\udde6-\\uddff]){2}",Ys="[\\ud800-\\udbff][\\udc00-\\udfff]",Bs="["+$s+"]",wl="\\u200d",Sl="(?:"+xl+"|"+_l+")",Ms="(?:"+Bs+"|"+_l+")",Rl="(?:"+Wo+"(?:d|ll|m|re|s|t|ve))?",Al="(?:"+Wo+"(?:D|LL|M|RE|S|T|VE))?",$l=Yl+"?",Xs="["+yl+"]?",Ao="(?:"+wl+"(?:"+[El,jo,Ys].join("|")+")"+Xs+$l+")*",Ls="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",uo="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Tl=Xs+$l+Ao,fo="(?:"+[Ro,jo,Ys].join("|")+")"+Tl,$o="(?:"+[El+So+"?",So,jo,Ys,wo].join("|")+")",To=RegExp(Wo,"g"),Ps=RegExp(So,"g"),Is=RegExp(lo+"(?="+lo+")|"+$o+Tl,"g"),Pl=RegExp([Bs+"?"+xl+"+"+Rl+"(?="+[Go,Bs,"$"].join("|")+")",Ms+"+"+Al+"(?="+[Go,Bs+Sl,"$"].join("|")+")",Bs+"?"+Sl+"+"+Rl,Bs+"+"+Al,uo,Ls,Zs,fo].join("|"),"g"),No=RegExp("["+wl+Yn+ls+yl+"]"),Po=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Bo=["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[Gt]=rs[Vt]=rs[Wt]=rs[ar]=rs[yr]=rs[Er]=rs[Rr]=rs[Wr]=!0,rs[ir]=rs[nr]=rs[or]=rs[Kt]=rs[Yt]=rs[Qt]=rs[qt]=rs[Jt]=rs[xr]=rs[pr]=rs[Mr]=rs[_r]=rs[Sr]=rs[kr]=rs[Or]=!1;var Xn={};Xn[ir]=Xn[nr]=Xn[or]=Xn[Yt]=Xn[Kt]=Xn[Qt]=Xn[er]=Xn[Gt]=Xn[Vt]=Xn[Wt]=Xn[ar]=Xn[xr]=Xn[pr]=Xn[Mr]=Xn[_r]=Xn[Sr]=Xn[kr]=Xn[Ar]=Xn[yr]=Xn[Er]=Xn[Rr]=Xn[Wr]=!0,Xn[qt]=Xn[Jt]=Xn[Or]=!1;var wr={À:"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,Tn=typeof self=="object"&&self&&self.Object===Object&&self,cn=xn||Tn||Function("return this")(),wn=_&&!_.nodeType&&_,Bn=wn&&!0&&a&&!a.nodeType&&a,Fn=Bn&&Bn.exports===wn,ts=Fn&&xn.process,_i=function(){try{var jr=Bn&&Bn.require&&Bn.require("util").types;return jr||ts&&ts.binding&&ts.binding("util")}catch{}}(),_s=_i&&_i.isArrayBuffer,Ds=_i&&_i.isDate,ho=_i&&_i.isMap,Lo=_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 Tv(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 Bv(jr,Xr){for(var Ur=jr.length,Cn=0;Ur--;)jr[Ur]===Xr&&++Cn;return Cn}var Lv=l0(wr),Dv=l0(Xt);function Fv(jr){return"\\"+gr[jr]}function zv(jr,Xr){return jr==null?$:jr[Xr]}function gu(jr){return No.test(jr)}function Uv(jr){return Po.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 Rm(jr,Xr){return function(Ur){return jr(Xr(Ur))}}function Il(jr,Xr){for(var Ur=-1,Cn=jr.length,Ln=0,ns=[];++Ur-1}function Cy(_t,kt){var Ut=this.__data__,rr=Op(Ut,_t);return rr<0?(++this.size,Ut.push([_t,kt])):Ut[rr][1]=kt,this}Zo.prototype.clear=Ay,Zo.prototype.delete=$y,Zo.prototype.get=Ty,Zo.prototype.has=Py,Zo.prototype.set=Cy;function Yo(_t){var kt=-1,Ut=_t==null?0:_t.length;for(this.clear();++kt=kt?_t:kt)),_t}function vo(_t,kt,Ut,rr,dr,br){var Pr,Ir=kt&at,Nr=kt&ut,en=kt&ht;if(Ut&&(Pr=dr?Ut(_t,rr,dr,br):Ut(_t)),Pr!==$)return Pr;if(!Es(_t))return _t;var tn=Dn(_t);if(tn){if(Pr=Nx(_t),!Ir)return Js(_t,Pr)}else{var sn=Us(_t),$n=sn==Jt||sn==ur;if(Fl(_t))return a1(_t,Ir);if(sn==Mr||sn==ir||$n&&!dr){if(Pr=Nr||$n?{}:$1(_t),!Ir)return Nr?Rx(_t,Ky(Pr,_t)):Sx(_t,Bm(Pr,_t))}else{if(!Xn[sn])return dr?_t:{};Pr=Bx(_t,sn,Ir)}}br||(br=new ko);var Mn=br.get(_t);if(Mn)return Mn;br.set(_t,Pr),rv(_t)?_t.forEach(function(Nn){Pr.add(vo(Nn,kt,Ut,Nn,_t,br))}):ev(_t)&&_t.forEach(function(Nn,qn){Pr.set(qn,vo(Nn,kt,Ut,qn,_t,br))});var jn=en?Nr?D0:L0:Nr?eo:Ns,Un=tn?$:jn(_t);return po(Un||_t,function(Nn,qn){Un&&(qn=Nn,Nn=_t[qn]),Zu(Pr,qn,vo(Nn,kt,Ut,qn,_t,br))}),Pr}function Wy(_t){var kt=Ns(_t);return function(Ut){return Lm(Ut,_t,kt)}}function Lm(_t,kt,Ut){var rr=Ut.length;if(_t==null)return!rr;for(_t=ys(_t);rr--;){var dr=Ut[rr],br=kt[dr],Pr=_t[dr];if(Pr===$&&!(dr in _t)||!br(Pr))return!1}return!0}function Dm(_t,kt,Ut){if(typeof _t!="function")throw new mo(rt);return rp(function(){_t.apply($,Ut)},kt)}function Yu(_t,kt,Ut,rr){var dr=-1,br=vp,Pr=!0,Ir=_t.length,Nr=[],en=kt.length;if(!Ir)return Nr;Ut&&(kt=xs(kt,no(Ut))),rr?(br=s0,Pr=!1):kt.length>=et&&(br=Hu,Pr=!1,kt=new tu(kt));e:for(;++drdr?0:dr+Ut),rr=rr===$||rr>dr?dr:zn(rr),rr<0&&(rr+=dr),rr=Ut>rr?0:iv(rr);Ut0&&Ut(Ir)?kt>1?Fs(Ir,kt-1,Ut,rr,dr):Ml(dr,Ir):rr||(dr[dr.length]=Ir)}return dr}var x0=h1(),Um=h1(!0);function Do(_t,kt){return _t&&x0(_t,kt,Ns)}function _0(_t,kt){return _t&&Um(_t,kt,Ns)}function Np(_t,kt){return Cl(kt,function(Ut){return ga(_t[Ut])})}function nu(_t,kt){kt=Ll(kt,_t);for(var Ut=0,rr=kt.length;_t!=null&&Utkt}function Yy(_t,kt){return _t!=null&&cs.call(_t,kt)}function Xy(_t,kt){return _t!=null&&kt in ys(_t)}function Jy(_t,kt,Ut){return _t>=zs(kt,Ut)&&_t=120&&tn.length>=120)?new tu(Pr&&tn):$}tn=_t[0];var sn=-1,$n=Ir[0];e:for(;++sn-1;)Ir!==_t&&$p.call(Ir,Nr,1),$p.call(_t,Nr,1);return _t}function Qm(_t,kt){for(var Ut=_t?kt.length:0,rr=Ut-1;Ut--;){var dr=kt[Ut];if(Ut==rr||dr!==br){var br=dr;na(dr)?$p.call(_t,dr,1):k0(_t,dr)}}return _t}function T0(_t,kt){return _t+Cp(Im()*(kt-_t+1))}function fx(_t,kt,Ut,rr){for(var dr=-1,br=ks(Pp((kt-_t)/(Ut||1)),0),Pr=Ur(br);br--;)Pr[rr?br:++dr]=_t,_t+=Ut;return Pr}function P0(_t,kt){var Ut="";if(!_t||kt<1||kt>At)return Ut;do kt%2&&(Ut+=_t),kt=Cp(kt/2),kt&&(_t+=_t);while(kt);return Ut}function Hn(_t,kt){return K0(C1(_t,kt,to),_t+"")}function hx(_t){return Nm($u(_t))}function mx(_t,kt){var Ut=$u(_t);return Wp(Ut,ru(kt,0,Ut.length))}function Qu(_t,kt,Ut,rr){if(!Es(_t))return _t;kt=Ll(kt,_t);for(var dr=-1,br=kt.length,Pr=br-1,Ir=_t;Ir!=null&&++drdr?0:dr+kt),Ut=Ut>dr?dr:Ut,Ut<0&&(Ut+=dr),dr=kt>Ut?0:Ut-kt>>>0,kt>>>=0;for(var br=Ur(dr);++rr>>1,Pr=_t[br];Pr!==null&&!so(Pr)&&(Ut?Pr<=kt:Pr=et){var en=kt?null:Px(_t);if(en)return bp(en);Pr=!1,dr=Hu,Nr=new tu}else Nr=kt?[]:Ir;e:for(;++rr=rr?_t:yo(_t,kt,Ut)}var o1=iy||function(_t){return cn.clearTimeout(_t)};function a1(_t,kt){if(kt)return _t.slice();var Ut=_t.length,rr=Tm?Tm(Ut):new _t.constructor(Ut);return _t.copy(rr),rr}function j0(_t){var kt=new _t.constructor(_t.byteLength);return new Rp(kt).set(new Rp(_t)),kt}function xx(_t,kt){var Ut=kt?j0(_t.buffer):_t.buffer;return new _t.constructor(Ut,_t.byteOffset,_t.byteLength)}function _x(_t){var kt=new _t.constructor(_t.source,yn.exec(_t));return kt.lastIndex=_t.lastIndex,kt}function Ex(_t){return Gu?ys(Gu.call(_t)):{}}function c1(_t,kt){var Ut=kt?j0(_t.buffer):_t.buffer;return new _t.constructor(Ut,_t.byteOffset,_t.length)}function l1(_t,kt){if(_t!==kt){var Ut=_t!==$,rr=_t===null,dr=_t===_t,br=so(_t),Pr=kt!==$,Ir=kt===null,Nr=kt===kt,en=so(kt);if(!Ir&&!en&&!br&&_t>kt||br&&Pr&&Nr&&!Ir&&!en||rr&&Pr&&Nr||!Ut&&Nr||!dr)return 1;if(!rr&&!br&&!en&&_t=Ir)return Nr;var en=Ut[rr];return Nr*(en=="desc"?-1:1)}}return _t.index-kt.index}function u1(_t,kt,Ut,rr){for(var dr=-1,br=_t.length,Pr=Ut.length,Ir=-1,Nr=kt.length,en=ks(br-Pr,0),tn=Ur(Nr+en),sn=!rr;++Ir1?Ut[dr-1]:$,Pr=dr>2?Ut[2]:$;for(br=_t.length>3&&typeof br=="function"?(dr--,br):$,Pr&&Vs(Ut[0],Ut[1],Pr)&&(br=dr<3?$:br,dr=1),kt=ys(kt);++rr-1?dr[br?kt[Pr]:Pr]:$}}function g1(_t){return Qo(function(kt){var Ut=kt.length,rr=Ut,dr=go.prototype.thru;for(_t&&kt.reverse();rr--;){var br=kt[rr];if(typeof br!="function")throw new mo(rt);if(dr&&!Pr&&qp(br)=="wrapper")var Pr=new go([],!0)}for(rr=Pr?rr:Ut;++rr1&&Gn.reverse(),tn&&NrIr))return!1;var en=br.get(_t),tn=br.get(kt);if(en&&tn)return en==kt&&tn==_t;var sn=-1,$n=!0,Mn=Ut&wt?new tu:$;for(br.set(_t,kt),br.set(kt,_t);++sn1?"& ":"")+kt[rr],kt=kt.join(Ut>2?", ":" "),_t.replace(gn,`{ -/* [wrapped with `+kt+`] */ -`)}function Dx(_t){return Dn(_t)||ou(_t)||!!(km&&_t&&_t[km])}function na(_t,kt){var Ut=typeof _t;return kt=kt??At,!!kt&&(Ut=="number"||Ut!="symbol"&&ps.test(_t))&&_t>-1&&_t%1==0&&_t0){if(++kt>=bt)return arguments[0]}else kt=0;return _t.apply($,arguments)}}function Wp(_t,kt){var Ut=-1,rr=_t.length,dr=rr-1;for(kt=kt===$?rr:kt;++Ut1?_t[kt-1]:$;return Ut=typeof Ut=="function"?(_t.pop(),Ut):$,U1(_t,Ut)});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,Ut=kt?_t[0]:0,rr=this.__wrapped__,dr=function(br){return b0(br,_t)};return kt>1||this.__actions__.length||!(rr instanceof Kn)||!na(Ut)?this.thru(dr):(rr=rr.slice(Ut,+Ut+(kt?1:0)),rr.__actions__.push({func:Gp,args:[dr],thisArg:$}),new go(rr,this.__chain__).thru(function(br){return kt&&!br.length&&br.push($),br}))});function J2(){return H1(this)}function Q2(){return new go(this.value(),this.__chain__)}function e_(){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 t_(){return this}function r_(_t){for(var kt,Ut=this;Ut instanceof Ip;){var rr=N1(Ut);rr.__index__=0,rr.__values__=$,kt?dr.__wrapped__=rr:kt=rr;var dr=rr;Ut=Ut.__wrapped__}return dr.__wrapped__=_t,kt}function n_(){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 i_(){return i1(this.__wrapped__,this.__actions__)}var s_=Fp(function(_t,kt,Ut){cs.call(_t,Ut)?++_t[Ut]:Xo(_t,Ut,1)});function o_(_t,kt,Ut){var rr=Dn(_t)?vm:Gy;return Ut&&Vs(_t,kt,Ut)&&(kt=$),rr(_t,On(kt,3))}function a_(_t,kt){var Ut=Dn(_t)?Cl:zm;return Ut(_t,On(kt,3))}var c_=m1(B1),l_=m1(L1);function u_(_t,kt){return Fs(Zp(_t,kt),1)}function d_(_t,kt){return Fs(Zp(_t,kt),xt)}function f_(_t,kt,Ut){return Ut=Ut===$?1:zn(Ut),Fs(Zp(_t,kt),Ut)}function V1(_t,kt){var Ut=Dn(_t)?po:Nl;return Ut(_t,On(kt,3))}function q1(_t,kt){var Ut=Dn(_t)?Pv:Fm;return Ut(_t,On(kt,3))}var h_=Fp(function(_t,kt,Ut){cs.call(_t,Ut)?_t[Ut].push(kt):Xo(_t,Ut,[kt])});function p_(_t,kt,Ut,rr){_t=Qs(_t)?_t:$u(_t),Ut=Ut&&!rr?zn(Ut):0;var dr=_t.length;return Ut<0&&(Ut=ks(dr+Ut,0)),e0(_t)?Ut<=dr&&_t.indexOf(kt,Ut)>-1:!!dr&&mu(_t,kt,Ut)>-1}var m_=Hn(function(_t,kt,Ut){var rr=-1,dr=typeof kt=="function",br=Qs(_t)?Ur(_t.length):[];return Nl(_t,function(Pr){br[++rr]=dr?Os(kt,Pr,Ut):Xu(Pr,kt,Ut)}),br}),g_=Fp(function(_t,kt,Ut){Xo(_t,Ut,kt)});function Zp(_t,kt){var Ut=Dn(_t)?xs:Wm;return Ut(_t,On(kt,3))}function v_(_t,kt,Ut,rr){return _t==null?[]:(Dn(kt)||(kt=kt==null?[]:[kt]),Ut=rr?$:Ut,Dn(Ut)||(Ut=Ut==null?[]:[Ut]),Xm(_t,kt,Ut))}var y_=Fp(function(_t,kt,Ut){_t[Ut?0:1].push(kt)},function(){return[[],[]]});function b_(_t,kt,Ut){var rr=Dn(_t)?o0:_m,dr=arguments.length<3;return rr(_t,On(kt,4),Ut,dr,Nl)}function x_(_t,kt,Ut){var rr=Dn(_t)?Cv:_m,dr=arguments.length<3;return rr(_t,On(kt,4),Ut,dr,Fm)}function __(_t,kt){var Ut=Dn(_t)?Cl:zm;return Ut(_t,Jp(On(kt,3)))}function E_(_t){var kt=Dn(_t)?Nm:hx;return kt(_t)}function w_(_t,kt,Ut){(Ut?Vs(_t,kt,Ut):kt===$)?kt=1:kt=zn(kt);var rr=Dn(_t)?Hy:mx;return rr(_t,kt)}function S_(_t){var kt=Dn(_t)?Vy:vx;return kt(_t)}function R_(_t){if(_t==null)return 0;if(Qs(_t))return e0(_t)?vu(_t):_t.length;var kt=Us(_t);return kt==xr||kt==Sr?_t.size:R0(_t).length}function A_(_t,kt,Ut){var rr=Dn(_t)?a0:yx;return Ut&&Vs(_t,kt,Ut)&&(kt=$),rr(_t,On(kt,3))}var $_=Hn(function(_t,kt){if(_t==null)return[];var Ut=kt.length;return Ut>1&&Vs(_t,kt[0],kt[1])?kt=[]:Ut>2&&Vs(kt[0],kt[1],kt[2])&&(kt=[kt[0]]),Xm(_t,Fs(kt,1),[])}),Yp=sy||function(){return cn.Date.now()};function T_(_t,kt){if(typeof kt!="function")throw new mo(rt);return _t=zn(_t),function(){if(--_t<1)return kt.apply(this,arguments)}}function K1(_t,kt,Ut){return kt=Ut?$:kt,kt=_t&&kt==null?_t.length:kt,Jo(_t,Ot,$,$,$,$,kt)}function W1(_t,kt){var Ut;if(typeof kt!="function")throw new mo(rt);return _t=zn(_t),function(){return--_t>0&&(Ut=kt.apply(this,arguments)),_t<=1&&(kt=$),Ut}}var Z0=Hn(function(_t,kt,Ut){var rr=Ct;if(Ut.length){var dr=Il(Ut,Ru(Z0));rr|=Dt}return Jo(_t,rr,kt,Ut,dr)}),G1=Hn(function(_t,kt,Ut){var rr=Ct|Pt;if(Ut.length){var dr=Il(Ut,Ru(G1));rr|=Dt}return Jo(kt,rr,_t,Ut,dr)});function Z1(_t,kt,Ut){kt=Ut?$:kt;var rr=Jo(_t,Mt,$,$,$,$,$,kt);return rr.placeholder=Z1.placeholder,rr}function Y1(_t,kt,Ut){kt=Ut?$:kt;var rr=Jo(_t,Lt,$,$,$,$,$,kt);return rr.placeholder=Y1.placeholder,rr}function X1(_t,kt,Ut){var rr,dr,br,Pr,Ir,Nr,en=0,tn=!1,sn=!1,$n=!0;if(typeof _t!="function")throw new mo(rt);kt=xo(kt)||0,Es(Ut)&&(tn=!!Ut.leading,sn="maxWait"in Ut,br=sn?ks(xo(Ut.maxWait)||0,kt):br,$n="trailing"in Ut?!!Ut.trailing:$n);function Mn(As){var Io=rr,xa=dr;return rr=dr=$,en=As,Pr=_t.apply(xa,Io),Pr}function jn(As){return en=As,Ir=rp(qn,kt),tn?Mn(As):Pr}function Un(As){var Io=As-Nr,xa=As-en,gv=kt-Io;return sn?zs(gv,br-xa):gv}function Nn(As){var Io=As-Nr,xa=As-en;return Nr===$||Io>=kt||Io<0||sn&&xa>=br}function qn(){var As=Yp();if(Nn(As))return Gn(As);Ir=rp(qn,Un(As))}function Gn(As){return Ir=$,$n&&rr?Mn(As):(rr=dr=$,Pr)}function oo(){Ir!==$&&o1(Ir),en=0,rr=Nr=dr=Ir=$}function qs(){return Ir===$?Pr:Gn(Yp())}function ao(){var As=Yp(),Io=Nn(As);if(rr=arguments,dr=this,Nr=As,Io){if(Ir===$)return jn(Nr);if(sn)return o1(Ir),Ir=rp(qn,kt),Mn(Nr)}return Ir===$&&(Ir=rp(qn,kt)),Pr}return ao.cancel=oo,ao.flush=qs,ao}var P_=Hn(function(_t,kt){return Dm(_t,1,kt)}),C_=Hn(function(_t,kt,Ut){return Dm(_t,xo(kt)||0,Ut)});function k_(_t){return Jo(_t,Bt)}function Xp(_t,kt){if(typeof _t!="function"||kt!=null&&typeof kt!="function")throw new mo(rt);var Ut=function(){var rr=arguments,dr=kt?kt.apply(this,rr):rr[0],br=Ut.cache;if(br.has(dr))return br.get(dr);var Pr=_t.apply(this,rr);return Ut.cache=br.set(dr,Pr)||br,Pr};return Ut.cache=new(Xp.Cache||Yo),Ut}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 M_(_t){return W1(2,_t)}var I_=bx(function(_t,kt){kt=kt.length==1&&Dn(kt[0])?xs(kt[0],no(On())):xs(Fs(kt,1),no(On()));var Ut=kt.length;return Hn(function(rr){for(var dr=-1,br=zs(rr.length,Ut);++dr=kt}),ou=Vm(function(){return arguments}())?Vm:function(_t){return ws(_t)&&cs.call(_t,"callee")&&!Cm.call(_t,"callee")},Dn=Ur.isArray,G_=_s?no(_s):ex;function Qs(_t){return _t!=null&&Qp(_t.length)&&!ga(_t)}function Rs(_t){return ws(_t)&&Qs(_t)}function Z_(_t){return _t===!0||_t===!1||ws(_t)&&Hs(_t)==Kt}var Fl=ay||am,Y_=Ds?no(Ds):tx;function X_(_t){return ws(_t)&&_t.nodeType===1&&!np(_t)}function J_(_t){if(_t==null)return!0;if(Qs(_t)&&(Dn(_t)||typeof _t=="string"||typeof _t.splice=="function"||Fl(_t)||Au(_t)||ou(_t)))return!_t.length;var kt=Us(_t);if(kt==xr||kt==Sr)return!_t.size;if(tp(_t))return!R0(_t).length;for(var Ut in _t)if(cs.call(_t,Ut))return!1;return!0}function Q_(_t,kt){return Ju(_t,kt)}function eE(_t,kt,Ut){Ut=typeof Ut=="function"?Ut:$;var rr=Ut?Ut(_t,kt):$;return rr===$?Ju(_t,kt,$,Ut):!!rr}function X0(_t){if(!ws(_t))return!1;var kt=Hs(_t);return kt==qt||kt==Ht||typeof _t.message=="string"&&typeof _t.name=="string"&&!np(_t)}function tE(_t){return typeof _t=="number"&&Mm(_t)}function ga(_t){if(!Es(_t))return!1;var kt=Hs(_t);return kt==Jt||kt==ur||kt==Zt||kt==fr}function Q1(_t){return typeof _t=="number"&&_t==zn(_t)}function Qp(_t){return typeof _t=="number"&&_t>-1&&_t%1==0&&_t<=At}function Es(_t){var kt=typeof _t;return _t!=null&&(kt=="object"||kt=="function")}function ws(_t){return _t!=null&&typeof _t=="object"}var ev=ho?no(ho):nx;function rE(_t,kt){return _t===kt||S0(_t,kt,z0(kt))}function nE(_t,kt,Ut){return Ut=typeof Ut=="function"?Ut:$,S0(_t,kt,z0(kt),Ut)}function iE(_t){return tv(_t)&&_t!=+_t}function sE(_t){if(Ux(_t))throw new Ln(tt);return qm(_t)}function oE(_t){return _t===null}function aE(_t){return _t==null}function tv(_t){return typeof _t=="number"||ws(_t)&&Hs(_t)==pr}function np(_t){if(!ws(_t)||Hs(_t)!=Mr)return!1;var kt=Ap(_t);if(kt===null)return!0;var Ut=cs.call(kt,"constructor")&&kt.constructor;return typeof Ut=="function"&&Ut instanceof Ut&&Ep.call(Ut)==ty}var J0=Lo?no(Lo):ix;function cE(_t){return Q1(_t)&&_t>=-At&&_t<=At}var rv=Uu?no(Uu):sx;function e0(_t){return typeof _t=="string"||!Dn(_t)&&ws(_t)&&Hs(_t)==kr}function so(_t){return typeof _t=="symbol"||ws(_t)&&Hs(_t)==Ar}var Au=Jl?no(Jl):ox;function lE(_t){return _t===$}function uE(_t){return ws(_t)&&Us(_t)==Or}function dE(_t){return ws(_t)&&Hs(_t)==Lr}var fE=Vp(A0),hE=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=Us(_t),Ut=kt==xr?h0:kt==Sr?bp:$u;return Ut(_t)}function ba(_t){if(!_t)return _t===0?_t:0;if(_t=xo(_t),_t===xt||_t===-xt){var kt=_t<0?-1:1;return kt*Rt}return _t===_t?_t:0}function zn(_t){var kt=ba(_t),Ut=kt%1;return kt===kt?Ut?kt-Ut:kt:0}function iv(_t){return _t?ru(zn(_t),0,Tt):0}function xo(_t){if(typeof _t=="number")return _t;if(so(_t))return St;if(Es(_t)){var kt=typeof _t.valueOf=="function"?_t.valueOf():_t;_t=Es(kt)?kt+"":kt}if(typeof _t!="string")return _t===0?_t:+_t;_t=Em(_t);var Ut=ds.test(_t);return Ut||hs.test(_t)?rn(_t.slice(2),Ut?2:8):_n.test(_t)?St:+_t}function sv(_t){return Fo(_t,eo(_t))}function pE(_t){return _t?ru(zn(_t),-At,At):_t===0?_t:0}function os(_t){return _t==null?"":io(_t)}var mE=wu(function(_t,kt){if(tp(kt)||Qs(kt)){Fo(kt,Ns(kt),_t);return}for(var Ut in kt)cs.call(kt,Ut)&&Zu(_t,Ut,kt[Ut])}),ov=wu(function(_t,kt){Fo(kt,eo(kt),_t)}),t0=wu(function(_t,kt,Ut,rr){Fo(kt,eo(kt),_t,rr)}),gE=wu(function(_t,kt,Ut,rr){Fo(kt,Ns(kt),_t,rr)}),vE=Qo(b0);function yE(_t,kt){var Ut=Eu(_t);return kt==null?Ut:Bm(Ut,kt)}var bE=Hn(function(_t,kt){_t=ys(_t);var Ut=-1,rr=kt.length,dr=rr>2?kt[2]:$;for(dr&&Vs(kt[0],kt[1],dr)&&(rr=1);++Ut1),br}),Fo(_t,D0(_t),Ut),rr&&(Ut=vo(Ut,at|ut|ht,Cx));for(var dr=kt.length;dr--;)k0(Ut,kt[dr]);return Ut});function LE(_t,kt){return cv(_t,Jp(On(kt)))}var DE=Qo(function(_t,kt){return _t==null?{}:ux(_t,kt)});function cv(_t,kt){if(_t==null)return{};var Ut=xs(D0(_t),function(rr){return[rr]});return kt=On(kt),Jm(_t,Ut,function(rr,dr){return kt(rr,dr[0])})}function FE(_t,kt,Ut){kt=Ll(kt,_t);var rr=-1,dr=kt.length;for(dr||(dr=1,_t=$);++rrkt){var rr=_t;_t=kt,kt=rr}if(Ut||_t%1||kt%1){var dr=Im();return zs(_t+dr*(kt-_t+Dr("1e-"+((dr+"").length-1))),kt)}return T0(_t,kt)}var XE=Su(function(_t,kt,Ut){return kt=kt.toLowerCase(),_t+(Ut?dv(kt):kt)});function dv(_t){return tm(os(_t).toLowerCase())}function fv(_t){return _t=os(_t),_t&&_t.replace(Vn,Lv).replace(Ps,"")}function JE(_t,kt,Ut){_t=os(_t),kt=io(kt);var rr=_t.length;Ut=Ut===$?rr:ru(zn(Ut),0,rr);var dr=Ut;return Ut-=kt.length,Ut>=0&&_t.slice(Ut,dr)==kt}function QE(_t){return _t=os(_t),_t&&ln.test(_t)?_t.replace(Qr,Dv):_t}function ew(_t){return _t=os(_t),_t&&Rn.test(_t)?_t.replace(Kr,"\\$&"):_t}var tw=Su(function(_t,kt,Ut){return _t+(Ut?"-":"")+kt.toLowerCase()}),rw=Su(function(_t,kt,Ut){return _t+(Ut?" ":"")+kt.toLowerCase()}),nw=p1("toLowerCase");function iw(_t,kt,Ut){_t=os(_t),kt=zn(kt);var rr=kt?vu(_t):0;if(!kt||rr>=kt)return _t;var dr=(kt-rr)/2;return Hp(Cp(dr),Ut)+_t+Hp(Pp(dr),Ut)}function sw(_t,kt,Ut){_t=os(_t),kt=zn(kt);var rr=kt?vu(_t):0;return kt&&rr>>0,Ut?(_t=os(_t),_t&&(typeof kt=="string"||kt!=null&&!J0(kt))&&(kt=io(kt),!kt&&gu(_t))?Dl(Co(_t),0,Ut):_t.split(kt,Ut)):[]}var fw=Su(function(_t,kt,Ut){return _t+(Ut?" ":"")+tm(kt)});function hw(_t,kt,Ut){return _t=os(_t),Ut=Ut==null?0:ru(zn(Ut),0,_t.length),kt=io(kt),_t.slice(Ut,Ut+kt.length)==kt}function pw(_t,kt,Ut){var rr=vr.templateSettings;Ut&&Vs(_t,kt,Ut)&&(kt=$),_t=os(_t),kt=t0({},kt,rr,E1);var dr=t0({},kt.imports,rr.imports,E1),br=Ns(dr),Pr=f0(dr,br),Ir,Nr,en=0,tn=kt.interpolate||ss,sn="__p += '",$n=p0((kt.escape||ss).source+"|"+tn.source+"|"+(tn===un?Pn:ss).source+"|"+(kt.evaluate||ss).source+"|$","g"),Mn="//# sourceURL="+(cs.call(kt,"sourceURL")?(kt.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Xl+"]")+` -`;_t.replace($n,function(Nn,qn,Gn,oo,qs,ao){return Gn||(Gn=oo),sn+=_t.slice(en,ao).replace(Jn,Fv),qn&&(Ir=!0,sn+=`' + -__e(`+qn+`) + -'`),qs&&(Nr=!0,sn+=`'; -`+qs+`; -__p += '`),Gn&&(sn+=`' + -((__t = (`+Gn+`)) == null ? '' : __t) + -'`),en=ao+Nn.length,Nn}),sn+=`'; -`;var jn=cs.call(kt,"variable")&&kt.variable;if(!jn)sn=`with (obj) { -`+sn+` -} -`;else if(Sn.test(jn))throw new Ln(nt);sn=(Nr?sn.replace(Hr,""):sn).replace(Fr,"$1").replace(pn,"$1;"),sn="function("+(jn||"obj")+`) { -`+(jn?"":`obj || (obj = {}); -`)+"var __t, __p = ''"+(Ir?", __e = _.escape":"")+(Nr?`, __j = Array.prototype.join; -function print() { __p += __j.call(arguments, '') } -`:`; -`)+sn+`return __p -}`;var Un=pv(function(){return ns(br,Mn+"return "+sn).apply($,Pr)});if(Un.source=sn,X0(Un))throw Un;return Un}function mw(_t){return os(_t).toLowerCase()}function gw(_t){return os(_t).toUpperCase()}function yw(_t,kt,Ut){if(_t=os(_t),_t&&(Ut||kt===$))return Em(_t);if(!_t||!(kt=io(kt)))return _t;var rr=Co(_t),dr=Co(kt),br=wm(rr,dr),Pr=Sm(rr,dr)+1;return Dl(rr,br,Pr).join("")}function bw(_t,kt,Ut){if(_t=os(_t),_t&&(Ut||kt===$))return _t.slice(0,Am(_t)+1);if(!_t||!(kt=io(kt)))return _t;var rr=Co(_t),dr=Sm(rr,Co(kt))+1;return Dl(rr,0,dr).join("")}function xw(_t,kt,Ut){if(_t=os(_t),_t&&(Ut||kt===$))return _t.replace(dn,"");if(!_t||!(kt=io(kt)))return _t;var rr=Co(_t),dr=wm(rr,Co(kt));return Dl(rr,dr).join("")}function _w(_t,kt){var Ut=Ft,rr=jt;if(Es(kt)){var dr="separator"in kt?kt.separator:dr;Ut="length"in kt?zn(kt.length):Ut,rr="omission"in kt?io(kt.omission):rr}_t=os(_t);var br=_t.length;if(gu(_t)){var Pr=Co(_t);br=Pr.length}if(Ut>=br)return _t;var Ir=Ut-vu(rr);if(Ir<1)return rr;var Nr=Pr?Dl(Pr,0,Ir).join(""):_t.slice(0,Ir);if(dr===$)return Nr+rr;if(Pr&&(Ir+=Nr.length-Ir),J0(dr)){if(_t.slice(Ir).search(dr)){var en,tn=Nr;for(dr.global||(dr=p0(dr.source,os(yn.exec(dr))+"g")),dr.lastIndex=0;en=dr.exec(tn);)var sn=en.index;Nr=Nr.slice(0,sn===$?Ir:sn)}}else if(_t.indexOf(io(dr),Ir)!=Ir){var $n=Nr.lastIndexOf(dr);$n>-1&&(Nr=Nr.slice(0,$n))}return Nr+rr}function Ew(_t){return _t=os(_t),_t&&mn.test(_t)?_t.replace(Jr,Wv):_t}var ww=Su(function(_t,kt,Ut){return _t+(Ut?" ":"")+kt.toUpperCase()}),tm=p1("toUpperCase");function hv(_t,kt,Ut){return _t=os(_t),kt=Ut?$:kt,kt===$?Uv(_t)?Yv(_t):Iv(_t):_t.match(kt)||[]}var pv=Hn(function(_t,kt){try{return Os(_t,$,kt)}catch(Ut){return X0(Ut)?Ut:new Ln(Ut)}}),Sw=Qo(function(_t,kt){return po(kt,function(Ut){Ut=zo(Ut),Xo(_t,Ut,Z0(_t[Ut],_t))}),_t});function Rw(_t){var kt=_t==null?0:_t.length,Ut=On();return _t=kt?xs(_t,function(rr){if(typeof rr[1]!="function")throw new mo(rt);return[Ut(rr[0]),rr[1]]}):[],Hn(function(rr){for(var dr=-1;++drAt)return[];var Ut=Tt,rr=zs(_t,Tt);kt=On(kt),_t-=Tt;for(var dr=d0(rr,kt);++Ut<_t;)kt(Ut);return dr}function Kw(_t){return Dn(_t)?xs(_t,zo):so(_t)?[_t]:Js(j1(os(_t)))}function Ww(_t){var kt=++ey;return os(_t)+kt}var Gw=Up(function(_t,kt){return _t+kt},0),Zw=B0("ceil"),Yw=Up(function(_t,kt){return _t/kt},1),Xw=B0("floor");function Jw(_t){return _t&&_t.length?jp(_t,to,E0):$}function Qw(_t,kt){return _t&&_t.length?jp(_t,On(kt,2),E0):$}function eS(_t){return xm(_t,to)}function tS(_t,kt){return xm(_t,On(kt,2))}function rS(_t){return _t&&_t.length?jp(_t,to,A0):$}function nS(_t,kt){return _t&&_t.length?jp(_t,On(kt,2),A0):$}var iS=Up(function(_t,kt){return _t*kt},1),sS=B0("round"),oS=Up(function(_t,kt){return _t-kt},0);function aS(_t){return _t&&_t.length?u0(_t,to):0}function cS(_t,kt){return _t&&_t.length?u0(_t,On(kt,2)):0}return vr.after=T_,vr.ary=K1,vr.assign=mE,vr.assignIn=ov,vr.assignInWith=t0,vr.assignWith=gE,vr.at=vE,vr.before=W1,vr.bind=Z0,vr.bindAll=Sw,vr.bindKey=G1,vr.castArray=F_,vr.chain=H1,vr.chunk=Zx,vr.compact=Yx,vr.concat=Xx,vr.cond=Rw,vr.conforms=Aw,vr.constant=rm,vr.countBy=s_,vr.create=yE,vr.curry=Z1,vr.curryRight=Y1,vr.debounce=X1,vr.defaults=bE,vr.defaultsDeep=xE,vr.defer=P_,vr.delay=C_,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=a_,vr.flatMap=u_,vr.flatMapDeep=d_,vr.flatMapDepth=f_,vr.flatten=D1,vr.flattenDeep=o2,vr.flattenDepth=a2,vr.flip=k_,vr.flow=Tw,vr.flowRight=Pw,vr.fromPairs=c2,vr.functions=TE,vr.functionsIn=PE,vr.groupBy=h_,vr.initial=u2,vr.intersection=d2,vr.intersectionBy=f2,vr.intersectionWith=h2,vr.invert=kE,vr.invertBy=ME,vr.invokeMap=m_,vr.iteratee=nm,vr.keyBy=g_,vr.keys=Ns,vr.keysIn=eo,vr.map=Zp,vr.mapKeys=OE,vr.mapValues=jE,vr.matches=Cw,vr.matchesProperty=kw,vr.memoize=Xp,vr.merge=NE,vr.mergeWith=av,vr.method=Mw,vr.methodOf=Iw,vr.mixin=im,vr.negate=Jp,vr.nthArg=jw,vr.omit=BE,vr.omitBy=LE,vr.once=M_,vr.orderBy=v_,vr.over=Nw,vr.overArgs=I_,vr.overEvery=Bw,vr.overSome=Lw,vr.partial=Y0,vr.partialRight=J1,vr.partition=y_,vr.pick=DE,vr.pickBy=cv,vr.property=mv,vr.propertyOf=Dw,vr.pull=v2,vr.pullAll=z1,vr.pullAllBy=y2,vr.pullAllWith=b2,vr.pullAt=x2,vr.range=Fw,vr.rangeRight=zw,vr.rearg=O_,vr.reject=__,vr.remove=_2,vr.rest=j_,vr.reverse=W0,vr.sampleSize=w_,vr.set=zE,vr.setWith=UE,vr.shuffle=S_,vr.slice=E2,vr.sortBy=$_,vr.sortedUniq=P2,vr.sortedUniqBy=C2,vr.split=dw,vr.spread=N_,vr.tail=k2,vr.take=M2,vr.takeRight=I2,vr.takeRightWhile=O2,vr.takeWhile=j2,vr.tap=Y2,vr.throttle=B_,vr.thru=Gp,vr.toArray=nv,vr.toPairs=lv,vr.toPairsIn=uv,vr.toPath=Kw,vr.toPlainObject=sv,vr.transform=HE,vr.unary=L_,vr.union=N2,vr.unionBy=B2,vr.unionWith=L2,vr.uniq=D2,vr.uniqBy=F2,vr.uniqWith=z2,vr.unset=VE,vr.unzip=G0,vr.unzipWith=U1,vr.update=qE,vr.updateWith=KE,vr.values=$u,vr.valuesIn=WE,vr.without=U2,vr.words=hv,vr.wrap=D_,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=Gw,vr.attempt=pv,vr.camelCase=XE,vr.capitalize=dv,vr.ceil=Zw,vr.clamp=GE,vr.clone=z_,vr.cloneDeep=H_,vr.cloneDeepWith=V_,vr.cloneWith=U_,vr.conformsTo=q_,vr.deburr=fv,vr.defaultTo=$w,vr.divide=Yw,vr.endsWith=JE,vr.eq=Mo,vr.escape=QE,vr.escapeRegExp=ew,vr.every=o_,vr.find=c_,vr.findIndex=B1,vr.findKey=_E,vr.findLast=l_,vr.findLastIndex=L1,vr.findLastKey=wE,vr.floor=Xw,vr.forEach=V1,vr.forEachRight=q1,vr.forIn=SE,vr.forInRight=RE,vr.forOwn=AE,vr.forOwnRight=$E,vr.get=Q0,vr.gt=K_,vr.gte=W_,vr.has=CE,vr.hasIn=em,vr.head=F1,vr.identity=to,vr.includes=p_,vr.indexOf=l2,vr.inRange=ZE,vr.invoke=IE,vr.isArguments=ou,vr.isArray=Dn,vr.isArrayBuffer=G_,vr.isArrayLike=Qs,vr.isArrayLikeObject=Rs,vr.isBoolean=Z_,vr.isBuffer=Fl,vr.isDate=Y_,vr.isElement=X_,vr.isEmpty=J_,vr.isEqual=Q_,vr.isEqualWith=eE,vr.isError=X0,vr.isFinite=tE,vr.isFunction=ga,vr.isInteger=Q1,vr.isLength=Qp,vr.isMap=ev,vr.isMatch=rE,vr.isMatchWith=nE,vr.isNaN=iE,vr.isNative=sE,vr.isNil=aE,vr.isNull=oE,vr.isNumber=tv,vr.isObject=Es,vr.isObjectLike=ws,vr.isPlainObject=np,vr.isRegExp=J0,vr.isSafeInteger=cE,vr.isSet=rv,vr.isString=e0,vr.isSymbol=so,vr.isTypedArray=Au,vr.isUndefined=lE,vr.isWeakMap=uE,vr.isWeakSet=dE,vr.join=p2,vr.kebabCase=tw,vr.last=bo,vr.lastIndexOf=m2,vr.lowerCase=rw,vr.lowerFirst=nw,vr.lt=fE,vr.lte=hE,vr.max=Jw,vr.maxBy=Qw,vr.mean=eS,vr.meanBy=tS,vr.min=rS,vr.minBy=nS,vr.stubArray=om,vr.stubFalse=am,vr.stubObject=Uw,vr.stubString=Hw,vr.stubTrue=Vw,vr.multiply=iS,vr.nth=g2,vr.noConflict=Ow,vr.noop=sm,vr.now=Yp,vr.pad=iw,vr.padEnd=sw,vr.padStart=ow,vr.parseInt=aw,vr.random=YE,vr.reduce=b_,vr.reduceRight=x_,vr.repeat=cw,vr.replace=lw,vr.result=FE,vr.round=sS,vr.runInContext=jr,vr.sample=E_,vr.size=R_,vr.snakeCase=uw,vr.some=A_,vr.sortedIndex=w2,vr.sortedIndexBy=S2,vr.sortedIndexOf=R2,vr.sortedLastIndex=A2,vr.sortedLastIndexBy=$2,vr.sortedLastIndexOf=T2,vr.startCase=fw,vr.startsWith=hw,vr.subtract=oS,vr.sum=aS,vr.sumBy=cS,vr.template=pw,vr.times=qw,vr.toFinite=ba,vr.toInteger=zn,vr.toLength=iv,vr.toLower=mw,vr.toNumber=xo,vr.toSafeInteger=pE,vr.toString=os,vr.toUpper=gw,vr.trim=yw,vr.trimEnd=bw,vr.trimStart=xw,vr.truncate=_w,vr.unescape=Ew,vr.uniqueId=Ww,vr.upperCase=ww,vr.upperFirst=tm,vr.each=V1,vr.eachRight=q1,vr.first=F1,im(vr,function(){var _t={};return Do(vr,function(kt,Ut){cs.call(vr.prototype,Ut)||(_t[Ut]=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(Ut){Ut=Ut===$?1:ks(zn(Ut),0);var rr=this.__filtered__&&!kt?new Kn(this):this.clone();return rr.__filtered__?rr.__takeCount__=zs(Ut,rr.__takeCount__):rr.__views__.push({size:zs(Ut,Tt),type:_t+(rr.__dir__<0?"Right":"")}),rr},Kn.prototype[_t+"Right"]=function(Ut){return this.reverse()[_t](Ut).reverse()}}),po(["filter","map","takeWhile"],function(_t,kt){var Ut=kt+1,rr=Ut==ct||Ut==mt;Kn.prototype[_t]=function(dr){var br=this.clone();return br.__iteratees__.push({iteratee:On(dr,3),type:Ut}),br.__filtered__=br.__filtered__||rr,br}}),po(["head","last"],function(_t,kt){var Ut="take"+(kt?"Right":"");Kn.prototype[_t]=function(){return this[Ut](1).value()[0]}}),po(["initial","tail"],function(_t,kt){var Ut="drop"+(kt?"":"Right");Kn.prototype[_t]=function(){return this.__filtered__?new Kn(this):this[Ut](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(Ut){return Xu(Ut,_t,kt)})}),Kn.prototype.reject=function(_t){return this.filter(Jp(On(_t)))},Kn.prototype.slice=function(_t,kt){_t=zn(_t);var Ut=this;return Ut.__filtered__&&(_t>0||kt<0)?new Kn(Ut):(_t<0?Ut=Ut.takeRight(-_t):_t&&(Ut=Ut.drop(_t)),kt!==$&&(kt=zn(kt),Ut=kt<0?Ut.dropRight(-kt):Ut.take(kt-_t)),Ut)},Kn.prototype.takeRightWhile=function(_t){return this.reverse().takeWhile(_t).reverse()},Kn.prototype.toArray=function(){return this.take(Tt)},Do(Kn.prototype,function(_t,kt){var Ut=/^(?:filter|find|map|reject)|While$/.test(kt),rr=/^(?:head|last)$/.test(kt),dr=vr[rr?"take"+(kt=="last"?"Right":""):kt],br=rr||/^find/.test(kt);dr&&(vr.prototype[kt]=function(){var Pr=this.__wrapped__,Ir=rr?[1]:arguments,Nr=Pr instanceof Kn,en=Ir[0],tn=Nr||Dn(Pr),sn=function(qn){var Gn=dr.apply(vr,Ml([qn],Ir));return rr&&$n?Gn[0]:Gn};tn&&Ut&&typeof en=="function"&&en.length!=1&&(Nr=tn=!1);var $n=this.__chain__,Mn=!!this.__actions__.length,jn=br&&!$n,Un=Nr&&!Mn;if(!br&&tn){Pr=Un?Pr:new Kn(this);var Nn=_t.apply(Pr,Ir);return Nn.__actions__.push({func:Gp,args:[sn],thisArg:$}),new go(Nn,$n)}return jn&&Un?_t.apply(this,Ir):(Nn=this.thru(sn),jn?rr?Nn.value()[0]:Nn.value():Nn)})}),po(["pop","push","shift","sort","splice","unshift"],function(_t){var kt=xp[_t],Ut=/^(?:push|sort|unshift)$/.test(_t)?"tap":"thru",rr=/^(?:pop|shift)$/.test(_t);vr.prototype[_t]=function(){var dr=arguments;if(rr&&!this.__chain__){var br=this.value();return kt.apply(Dn(br)?br:[],dr)}return this[Ut](function(Pr){return kt.apply(Dn(Pr)?Pr:[],dr)})}}),Do(Kn.prototype,function(_t,kt){var Ut=vr[kt];if(Ut){var rr=Ut.name+"";cs.call(_u,rr)||(_u[rr]=[]),_u[rr].push({name:kt,func:Ut})}}),_u[zp($,Pt).name]=[{name:"wrapper",func:$}],Kn.prototype.clone=yy,Kn.prototype.reverse=by,Kn.prototype.value=xy,vr.prototype.at=X2,vr.prototype.chain=J2,vr.prototype.commit=Q2,vr.prototype.next=e_,vr.prototype.plant=r_,vr.prototype.reverse=n_,vr.prototype.toJSON=vr.prototype.valueOf=vr.prototype.value=i_,vr.prototype.first=vr.prototype.head,Vu&&(vr.prototype[Vu]=t_),vr},yu=Xv();Bn?((Bn.exports=yu)._=yu,wn._=yu):cn._=yu}).call(commonjsGlobal)})(lodash,lodash.exports);var lodashExports=lodash.exports,isCheckBoxInput=a=>a.type==="checkbox",isDateObject=a=>a instanceof Date,isNullOrUndefined=a=>a==null;const isObjectType=a=>typeof a=="object";var isObject$4=a=>!isNullOrUndefined(a)&&!Array.isArray(a)&&isObjectType(a)&&!isDateObject(a),getEventValue=a=>isObject$4(a)&&a.target?isCheckBoxInput(a.target)?a.target.checked:a.target.value:a,getNodeParentName=a=>a.substring(0,a.search(/\.\d+(\.|$)/))||a,isNameInFieldArray=(a,_)=>a.has(getNodeParentName(_)),isPlainObject$6=a=>{const _=a.constructor&&a.constructor.prototype;return isObject$4(_)&&_.hasOwnProperty("isPrototypeOf")},isWeb=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function cloneObject(a){let _;const $=Array.isArray(a);if(a instanceof Date)_=new Date(a);else if(a instanceof Set)_=new Set(a);else if(!(isWeb&&(a instanceof Blob||a instanceof FileList))&&($||isObject$4(a)))if(_=$?[]:{},!$&&!isPlainObject$6(a))_=a;else for(const j in a)a.hasOwnProperty(j)&&(_[j]=cloneObject(a[j]));else return a;return _}var compact=a=>Array.isArray(a)?a.filter(Boolean):[],isUndefined$2=a=>a===void 0,get$2=(a,_,$)=>{if(!_||!isObject$4(a))return $;const j=compact(_.split(/[,[\].]+?/)).reduce((et,tt)=>isNullOrUndefined(et)?et:et[tt],a);return isUndefined$2(j)||j===a?isUndefined$2(a[_])?$:a[_]:j},isBoolean$3=a=>typeof a=="boolean",isKey=a=>/^\w*$/.test(a),stringToPath$2=a=>compact(a.replace(/["|']|\]/g,"").split(/\.|\[/)),set$2=(a,_,$)=>{let j=-1;const et=isKey(_)?[_]:stringToPath$2(_),tt=et.length,rt=tt-1;for(;++jReact$2.useContext(HookFormContext),FormProvider=a=>{const{children:_,...$}=a;return React$2.createElement(HookFormContext.Provider,{value:$},_)};var getProxyFormState=(a,_,$,j=!0)=>{const et={defaultValues:_._defaultValues};for(const tt in a)Object.defineProperty(et,tt,{get:()=>{const rt=tt;return _._proxyFormState[rt]!==VALIDATION_MODE.all&&(_._proxyFormState[rt]=!j||VALIDATION_MODE.all),a[rt]}});return et},isEmptyObject=a=>isObject$4(a)&&!Object.keys(a).length,shouldRenderFormState=(a,_,$,j)=>{$(a);const{name:et,...tt}=a;return isEmptyObject(tt)||Object.keys(tt).length>=Object.keys(_).length||Object.keys(tt).find(rt=>_[rt]===VALIDATION_MODE.all)},convertToArrayPayload=a=>Array.isArray(a)?a:[a];function useSubscribe(a){const _=React$2.useRef(a);_.current=a,React$2.useEffect(()=>{const $=!a.disabled&&_.current.subject&&_.current.subject.subscribe({next:_.current.next});return()=>{$&&$.unsubscribe()}},[a.disabled])}var isString$3=a=>typeof a=="string",generateWatchOutput=(a,_,$,j,et)=>isString$3(a)?(j&&_.watch.add(a),get$2($,a,et)):Array.isArray(a)?a.map(tt=>(j&&_.watch.add(tt),get$2($,tt))):(j&&(_.watchAll=!0),$),appendErrors=(a,_,$,j,et)=>_?{...$[a],types:{...$[a]&&$[a].types?$[a].types:{},[j]:et||!0}}:{},generateId=()=>{const a=typeof performance>"u"?Date.now():performance.now()*1e3;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,_=>{const $=(Math.random()*16+a)%16|0;return(_=="x"?$:$&3|8).toString(16)})},getFocusFieldName=(a,_,$={})=>$.shouldFocus||isUndefined$2($.shouldFocus)?$.focusName||`${a}.${isUndefined$2($.focusIndex)?_:$.focusIndex}.`:"",getValidationModes=a=>({isOnSubmit:!a||a===VALIDATION_MODE.onSubmit,isOnBlur:a===VALIDATION_MODE.onBlur,isOnChange:a===VALIDATION_MODE.onChange,isOnAll:a===VALIDATION_MODE.all,isOnTouch:a===VALIDATION_MODE.onTouched}),isWatched=(a,_,$)=>!$&&(_.watchAll||_.watch.has(a)||[..._.watch].some(j=>a.startsWith(j)&&/^\.\w+/.test(a.slice(j.length))));const iterateFieldsByAction=(a,_,$,j)=>{for(const et of $||Object.keys(a)){const tt=get$2(a,et);if(tt){const{_f:rt,...nt}=tt;if(rt){if(rt.refs&&rt.refs[0]&&_(rt.refs[0],et)&&!j)break;if(rt.ref&&_(rt.ref,rt.name)&&!j)break;iterateFieldsByAction(nt,_)}else isObject$4(nt)&&iterateFieldsByAction(nt,_)}}};var updateFieldArrayRootError=(a,_,$)=>{const j=compact(get$2(a,$));return set$2(j,"root",_[$]),set$2(a,$,j),a},isFileInput=a=>a.type==="file",isFunction$4=a=>typeof a=="function",isHTMLElement=a=>{if(!isWeb)return!1;const _=a?a.ownerDocument:0;return a instanceof(_&&_.defaultView?_.defaultView.HTMLElement:HTMLElement)},isMessage=a=>isString$3(a),isRadioInput=a=>a.type==="radio",isRegex=a=>a instanceof RegExp;const defaultResult={value:!1,isValid:!1},validResult={value:!0,isValid:!0};var getCheckboxValue=a=>{if(Array.isArray(a)){if(a.length>1){const _=a.filter($=>$&&$.checked&&!$.disabled).map($=>$.value);return{value:_,isValid:!!_.length}}return a[0].checked&&!a[0].disabled?a[0].attributes&&!isUndefined$2(a[0].attributes.value)?isUndefined$2(a[0].value)||a[0].value===""?validResult:{value:a[0].value,isValid:!0}:validResult:defaultResult}return defaultResult};const defaultReturn={isValid:!1,value:null};var getRadioValue=a=>Array.isArray(a)?a.reduce((_,$)=>$&&$.checked&&!$.disabled?{isValid:!0,value:$.value}:_,defaultReturn):defaultReturn;function getValidateError(a,_,$="validate"){if(isMessage(a)||Array.isArray(a)&&a.every(isMessage)||isBoolean$3(a)&&!a)return{type:$,message:isMessage(a)?a:"",ref:_}}var getValueAndMessage=a=>isObject$4(a)&&!isRegex(a)?a:{value:a,message:""},validateField=async(a,_,$,j,et)=>{const{ref:tt,refs:rt,required:nt,maxLength:it,minLength:st,min:ot,max:at,pattern:ut,validate:ht,name:yt,valueAsNumber:wt,mount:Ct,disabled:Pt}=a._f,$t=get$2(_,yt);if(!Ct||Pt)return{};const Mt=rt?rt[0]:tt,Lt=bt=>{j&&Mt.reportValidity&&(Mt.setCustomValidity(isBoolean$3(bt)?"":bt||""),Mt.reportValidity())},Dt={},zt=isRadioInput(tt),Ot=isCheckBoxInput(tt),It=zt||Ot,Bt=(wt||isFileInput(tt))&&isUndefined$2(tt.value)&&isUndefined$2($t)||isHTMLElement(tt)&&tt.value===""||$t===""||Array.isArray($t)&&!$t.length,Ft=appendErrors.bind(null,yt,$,Dt),jt=(bt,vt,ct,dt=INPUT_VALIDATION_RULES.maxLength,mt=INPUT_VALIDATION_RULES.minLength)=>{const xt=bt?vt:ct;Dt[yt]={type:bt?dt:mt,message:xt,ref:tt,...Ft(bt?dt:mt,xt)}};if(et?!Array.isArray($t)||!$t.length:nt&&(!It&&(Bt||isNullOrUndefined($t))||isBoolean$3($t)&&!$t||Ot&&!getCheckboxValue(rt).isValid||zt&&!getRadioValue(rt).isValid)){const{value:bt,message:vt}=isMessage(nt)?{value:!!nt,message:nt}:getValueAndMessage(nt);if(bt&&(Dt[yt]={type:INPUT_VALIDATION_RULES.required,message:vt,ref:Mt,...Ft(INPUT_VALIDATION_RULES.required,vt)},!$))return Lt(vt),Dt}if(!Bt&&(!isNullOrUndefined(ot)||!isNullOrUndefined(at))){let bt,vt;const ct=getValueAndMessage(at),dt=getValueAndMessage(ot);if(!isNullOrUndefined($t)&&!isNaN($t)){const mt=tt.valueAsNumber||$t&&+$t;isNullOrUndefined(ct.value)||(bt=mt>ct.value),isNullOrUndefined(dt.value)||(vt=mtnew Date(new Date().toDateString()+" "+St),At=tt.type=="time",Rt=tt.type=="week";isString$3(ct.value)&&$t&&(bt=At?xt($t)>xt(ct.value):Rt?$t>ct.value:mt>new Date(ct.value)),isString$3(dt.value)&&$t&&(vt=At?xt($t)+bt.value,dt=!isNullOrUndefined(vt.value)&&$t.length<+vt.value;if((ct||dt)&&(jt(ct,bt.message,vt.message),!$))return Lt(Dt[yt].message),Dt}if(ut&&!Bt&&isString$3($t)){const{value:bt,message:vt}=getValueAndMessage(ut);if(isRegex(bt)&&!$t.match(bt)&&(Dt[yt]={type:INPUT_VALIDATION_RULES.pattern,message:vt,ref:tt,...Ft(INPUT_VALIDATION_RULES.pattern,vt)},!$))return Lt(vt),Dt}if(ht){if(isFunction$4(ht)){const bt=await ht($t,_),vt=getValidateError(bt,Mt);if(vt&&(Dt[yt]={...vt,...Ft(INPUT_VALIDATION_RULES.validate,vt.message)},!$))return Lt(vt.message),Dt}else if(isObject$4(ht)){let bt={};for(const vt in ht){if(!isEmptyObject(bt)&&!$)break;const ct=getValidateError(await ht[vt]($t,_),Mt,vt);ct&&(bt={...ct,...Ft(vt,ct.message)},Lt(ct.message),$&&(Dt[yt]=bt))}if(!isEmptyObject(bt)&&(Dt[yt]={ref:Mt,...bt},!$))return Dt}}return Lt(!0),Dt},appendAt=(a,_)=>[...a,...convertToArrayPayload(_)],fillEmptyArray=a=>Array.isArray(a)?a.map(()=>{}):void 0;function insert$1(a,_,$){return[...a.slice(0,_),...convertToArrayPayload($),...a.slice(_)]}var moveArrayAt=(a,_,$)=>Array.isArray(a)?(isUndefined$2(a[$])&&(a[$]=void 0),a.splice($,0,a.splice(_,1)[0]),a):[],prependAt=(a,_)=>[...convertToArrayPayload(_),...convertToArrayPayload(a)];function removeAtIndexes(a,_){let $=0;const j=[...a];for(const et of _)j.splice(et-$,1),$++;return compact(j).length?j:[]}var removeArrayAt=(a,_)=>isUndefined$2(_)?[]:removeAtIndexes(a,convertToArrayPayload(_).sort(($,j)=>$-j)),swapArrayAt=(a,_,$)=>{[a[_],a[$]]=[a[$],a[_]]};function baseGet(a,_){const $=_.slice(0,-1).length;let j=0;for(;j<$;)a=isUndefined$2(a)?j++:a[_[j++]];return a}function isEmptyArray(a){for(const _ in a)if(a.hasOwnProperty(_)&&!isUndefined$2(a[_]))return!1;return!0}function unset(a,_){const $=Array.isArray(_)?_:isKey(_)?[_]:stringToPath$2(_),j=$.length===1?a:baseGet(a,$),et=$.length-1,tt=$[et];return j&&delete j[tt],et!==0&&(isObject$4(j)&&isEmptyObject(j)||Array.isArray(j)&&isEmptyArray(j))&&unset(a,$.slice(0,-1)),a}var updateAt=(a,_,$)=>(a[_]=$,a);function useFieldArray(a){const _=useFormContext(),{control:$=_.control,name:j,keyName:et="id",shouldUnregister:tt}=a,[rt,nt]=React$2.useState($._getFieldArray(j)),it=React$2.useRef($._getFieldArray(j).map(generateId)),st=React$2.useRef(rt),ot=React$2.useRef(j),at=React$2.useRef(!1);ot.current=j,st.current=rt,$._names.array.add(j),a.rules&&$.register(j,a.rules),useSubscribe({next:({values:Dt,name:zt})=>{if(zt===ot.current||!zt){const Ot=get$2(Dt,ot.current);Array.isArray(Ot)&&(nt(Ot),it.current=Ot.map(generateId))}},subject:$._subjects.array});const ut=React$2.useCallback(Dt=>{at.current=!0,$._updateFieldArray(j,Dt)},[$,j]),ht=(Dt,zt)=>{const Ot=convertToArrayPayload(cloneObject(Dt)),It=appendAt($._getFieldArray(j),Ot);$._names.focus=getFocusFieldName(j,It.length-1,zt),it.current=appendAt(it.current,Ot.map(generateId)),ut(It),nt(It),$._updateFieldArray(j,It,appendAt,{argA:fillEmptyArray(Dt)})},yt=(Dt,zt)=>{const Ot=convertToArrayPayload(cloneObject(Dt)),It=prependAt($._getFieldArray(j),Ot);$._names.focus=getFocusFieldName(j,0,zt),it.current=prependAt(it.current,Ot.map(generateId)),ut(It),nt(It),$._updateFieldArray(j,It,prependAt,{argA:fillEmptyArray(Dt)})},wt=Dt=>{const zt=removeArrayAt($._getFieldArray(j),Dt);it.current=removeArrayAt(it.current,Dt),ut(zt),nt(zt),$._updateFieldArray(j,zt,removeArrayAt,{argA:Dt})},Ct=(Dt,zt,Ot)=>{const It=convertToArrayPayload(cloneObject(zt)),Bt=insert$1($._getFieldArray(j),Dt,It);$._names.focus=getFocusFieldName(j,Dt,Ot),it.current=insert$1(it.current,Dt,It.map(generateId)),ut(Bt),nt(Bt),$._updateFieldArray(j,Bt,insert$1,{argA:Dt,argB:fillEmptyArray(zt)})},Pt=(Dt,zt)=>{const Ot=$._getFieldArray(j);swapArrayAt(Ot,Dt,zt),swapArrayAt(it.current,Dt,zt),ut(Ot),nt(Ot),$._updateFieldArray(j,Ot,swapArrayAt,{argA:Dt,argB:zt},!1)},$t=(Dt,zt)=>{const Ot=$._getFieldArray(j);moveArrayAt(Ot,Dt,zt),moveArrayAt(it.current,Dt,zt),ut(Ot),nt(Ot),$._updateFieldArray(j,Ot,moveArrayAt,{argA:Dt,argB:zt},!1)},Mt=(Dt,zt)=>{const Ot=cloneObject(zt),It=updateAt($._getFieldArray(j),Dt,Ot);it.current=[...It].map((Bt,Ft)=>!Bt||Ft===Dt?generateId():it.current[Ft]),ut(It),nt([...It]),$._updateFieldArray(j,It,updateAt,{argA:Dt,argB:Ot},!0,!1)},Lt=Dt=>{const zt=convertToArrayPayload(cloneObject(Dt));it.current=zt.map(generateId),ut([...zt]),nt([...zt]),$._updateFieldArray(j,[...zt],Ot=>Ot,{},!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(Dt=>{const zt=get$2(Dt.errors,j),Ot=get$2($._formState.errors,j);(Ot?!zt&&Ot.type||zt&&(Ot.type!==zt.type||Ot.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 Dt=get$2($._fields,j);Dt&&Dt._f&&!(getValidationModes($._options.reValidateMode).isOnSubmit&&getValidationModes($._options.mode).isOnSubmit)&&validateField(Dt,$._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,(Dt,zt)=>{if($._names.focus&&zt.startsWith($._names.focus)&&Dt.focus)return Dt.focus(),1}),$._names.focus="",$._updateValid(),at.current=!1},[rt,j,$]),React$2.useEffect(()=>(!get$2($._formValues,j)&&$._updateFieldArray(j),()=>{($._options.shouldUnregister||tt)&&$.unregister(j)}),[j,$,et,tt]),{swap:React$2.useCallback(Pt,[ut,j,$]),move:React$2.useCallback($t,[ut,j,$]),prepend:React$2.useCallback(yt,[ut,j,$]),append:React$2.useCallback(ht,[ut,j,$]),remove:React$2.useCallback(wt,[ut,j,$]),insert:React$2.useCallback(Ct,[ut,j,$]),update:React$2.useCallback(Mt,[ut,j,$]),replace:React$2.useCallback(Lt,[ut,j,$]),fields:React$2.useMemo(()=>rt.map((Dt,zt)=>({...Dt,[et]:it.current[zt]||generateId()})),[rt,et])}}var createSubject=()=>{let a=[];return{get observers(){return a},next:et=>{for(const tt of a)tt.next&&tt.next(et)},subscribe:et=>(a.push(et),{unsubscribe:()=>{a=a.filter(tt=>tt!==et)}}),unsubscribe:()=>{a=[]}}},isPrimitive=a=>isNullOrUndefined(a)||!isObjectType(a);function deepEqual$1(a,_){if(isPrimitive(a)||isPrimitive(_))return a===_;if(isDateObject(a)&&isDateObject(_))return a.getTime()===_.getTime();const $=Object.keys(a),j=Object.keys(_);if($.length!==j.length)return!1;for(const et of $){const tt=a[et];if(!j.includes(et))return!1;if(et!=="ref"){const rt=_[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=a=>a.type==="select-multiple",isRadioOrCheckbox=a=>isRadioInput(a)||isCheckBoxInput(a),live=a=>isHTMLElement(a)&&a.isConnected,objectHasFunction=a=>{for(const _ in a)if(isFunction$4(a[_]))return!0;return!1};function markFieldsDirty(a,_={}){const $=Array.isArray(a);if(isObject$4(a)||$)for(const j in a)Array.isArray(a[j])||isObject$4(a[j])&&!objectHasFunction(a[j])?(_[j]=Array.isArray(a[j])?[]:{},markFieldsDirty(a[j],_[j])):isNullOrUndefined(a[j])||(_[j]=!0);return _}function getDirtyFieldsFromDefaultValues(a,_,$){const j=Array.isArray(a);if(isObject$4(a)||j)for(const et in a)Array.isArray(a[et])||isObject$4(a[et])&&!objectHasFunction(a[et])?isUndefined$2(_)||isPrimitive($[et])?$[et]=Array.isArray(a[et])?markFieldsDirty(a[et],[]):{...markFieldsDirty(a[et])}:getDirtyFieldsFromDefaultValues(a[et],isNullOrUndefined(_)?{}:_[et],$[et]):$[et]=!deepEqual$1(a[et],_[et]);return $}var getDirtyFields=(a,_)=>getDirtyFieldsFromDefaultValues(a,_,markFieldsDirty(_)),getFieldValueAs=(a,{valueAsNumber:_,valueAsDate:$,setValueAs:j})=>isUndefined$2(a)?a:_?a===""?NaN:a&&+a:$&&isString$3(a)?new Date(a):j?j(a):a;function getFieldValue(a){const _=a.ref;if(!(a.refs?a.refs.every($=>$.disabled):_.disabled))return isFileInput(_)?_.files:isRadioInput(_)?getRadioValue(a.refs).value:isMultipleSelect(_)?[..._.selectedOptions].map(({value:$})=>$):isCheckBoxInput(_)?getCheckboxValue(a.refs).value:getFieldValueAs(isUndefined$2(_.value)?a.ref.value:_.value,a)}var getResolverOptions=(a,_,$,j)=>{const et={};for(const tt of a){const rt=get$2(_,tt);rt&&set$2(et,tt,rt._f)}return{criteriaMode:$,names:[...a],fields:et,shouldUseNativeValidation:j}},getRuleValue=a=>isUndefined$2(a)?a:isRegex(a)?a.source:isObject$4(a)?isRegex(a.value)?a.value.source:a.value:a,hasValidation=a=>a.mount&&(a.required||a.min||a.max||a.maxLength||a.minLength||a.pattern||a.validate);function schemaErrorLookup(a,_,$){const j=get$2(a,$);if(j||isKey($))return{error:j,name:$};const et=$.split(".");for(;et.length;){const tt=et.join("."),rt=get$2(_,tt),nt=get$2(a,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)?!a:($?j.isOnChange:et.isOnChange)?a:!0,unsetEmptyArray=(a,_)=>!compact(get$2(a,_)).length&&unset(a,_);const defaultOptions$1={mode:VALIDATION_MODE.onSubmit,reValidateMode:VALIDATION_MODE.onChange,shouldFocusError:!0};function createFormControl(a={}){let _={...defaultOptions$1,...a},$={submitCount:0,isDirty:!1,isLoading:isFunction$4(_.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:_.errors||{},disabled:_.disabled||!1},j={},et=isObject$4(_.defaultValues)||isObject$4(_.values)?cloneObject(_.defaultValues||_.values)||{}:{},tt=_.shouldUnregister?{}:cloneObject(et),rt={action:!1,mount:!1,watch:!1},nt={mount:new Set,unMount:new Set,array:new Set,watch:new Set},it,st=0;const ot={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},at={values:createSubject(),array:createSubject(),state:createSubject()},ut=getValidationModes(_.mode),ht=getValidationModes(_.reValidateMode),yt=_.criteriaMode===VALIDATION_MODE.all,wt=lr=>fr=>{clearTimeout(st),st=setTimeout(lr,fr)},Ct=async lr=>{if(ot.isValid||lr){const fr=_.resolver?isEmptyObject((await It()).errors):await Ft(j,!0);fr!==$.isValid&&at.state.next({isValid:fr})}},Pt=(lr,fr)=>{(ot.isValidating||ot.validatingFields)&&((lr||Array.from(nt.mount)).forEach(_r=>{_r&&(fr?set$2($.validatingFields,_r,fr):unset($.validatingFields,_r))}),at.state.next({validatingFields:$.validatingFields,isValidating:!isEmptyObject($.validatingFields)}))},$t=(lr,fr=[],_r,Sr,kr=!0,Ar=!0)=>{if(Sr&&_r){if(rt.action=!0,Ar&&Array.isArray(get$2(j,lr))){const $r=_r(get$2(j,lr),Sr.argA,Sr.argB);kr&&set$2(j,lr,$r)}if(Ar&&Array.isArray(get$2($.errors,lr))){const $r=_r(get$2($.errors,lr),Sr.argA,Sr.argB);kr&&set$2($.errors,lr,$r),unsetEmptyArray($.errors,lr)}if(ot.touchedFields&&Ar&&Array.isArray(get$2($.touchedFields,lr))){const $r=_r(get$2($.touchedFields,lr),Sr.argA,Sr.argB);kr&&set$2($.touchedFields,lr,$r)}ot.dirtyFields&&($.dirtyFields=getDirtyFields(et,tt)),at.state.next({name:lr,isDirty:bt(lr,fr),dirtyFields:$.dirtyFields,errors:$.errors,isValid:$.isValid})}else set$2(tt,lr,fr)},Mt=(lr,fr)=>{set$2($.errors,lr,fr),at.state.next({errors:$.errors})},Lt=lr=>{$.errors=lr,at.state.next({errors:$.errors,isValid:!1})},Dt=(lr,fr,_r,Sr)=>{const kr=get$2(j,lr);if(kr){const Ar=get$2(tt,lr,isUndefined$2(_r)?get$2(et,lr):_r);isUndefined$2(Ar)||Sr&&Sr.defaultChecked||fr?set$2(tt,lr,fr?Ar:getFieldValue(kr._f)):dt(lr,Ar),rt.mount&&Ct()}},zt=(lr,fr,_r,Sr,kr)=>{let Ar=!1,$r=!1;const Or={name:lr},Lr=!!(get$2(j,lr)&&get$2(j,lr)._f.disabled);if(!_r||Sr){ot.isDirty&&($r=$.isDirty,$.isDirty=Or.isDirty=bt(),Ar=$r!==Or.isDirty);const or=Lr||deepEqual$1(get$2(et,lr),fr);$r=!!(!Lr&&get$2($.dirtyFields,lr)),or||Lr?unset($.dirtyFields,lr):set$2($.dirtyFields,lr,!0),Or.dirtyFields=$.dirtyFields,Ar=Ar||ot.dirtyFields&&$r!==!or}if(_r){const or=get$2($.touchedFields,lr);or||(set$2($.touchedFields,lr,_r),Or.touchedFields=$.touchedFields,Ar=Ar||ot.touchedFields&&or!==_r)}return Ar&&kr&&at.state.next(Or),Ar?Or:{}},Ot=(lr,fr,_r,Sr)=>{const kr=get$2($.errors,lr),Ar=ot.isValid&&isBoolean$3(fr)&&$.isValid!==fr;if(a.delayError&&_r?(it=wt(()=>Mt(lr,_r)),it(a.delayError)):(clearTimeout(st),it=null,_r?set$2($.errors,lr,_r):unset($.errors,lr)),(_r?!deepEqual$1(kr,_r):kr)||!isEmptyObject(Sr)||Ar){const $r={...Sr,...Ar&&isBoolean$3(fr)?{isValid:fr}:{},errors:$.errors,name:lr};$={...$,...$r},at.state.next($r)}},It=async lr=>{Pt(lr,!0);const fr=await _.resolver(tt,_.context,getResolverOptions(lr||nt.mount,j,_.criteriaMode,_.shouldUseNativeValidation));return Pt(lr),fr},Bt=async lr=>{const{errors:fr}=await It(lr);if(lr)for(const _r of lr){const Sr=get$2(fr,_r);Sr?set$2($.errors,_r,Sr):unset($.errors,_r)}else $.errors=fr;return fr},Ft=async(lr,fr,_r={valid:!0})=>{for(const Sr in lr){const kr=lr[Sr];if(kr){const{_f:Ar,...$r}=kr;if(Ar){const Or=nt.array.has(Ar.name);Pt([Sr],!0);const Lr=await validateField(kr,tt,yt,_.shouldUseNativeValidation&&!fr,Or);if(Pt([Sr]),Lr[Ar.name]&&(_r.valid=!1,fr))break;!fr&&(get$2(Lr,Ar.name)?Or?updateFieldArrayRootError($.errors,Lr,Ar.name):set$2($.errors,Ar.name,Lr[Ar.name]):unset($.errors,Ar.name))}$r&&await Ft($r,fr,_r)}}return _r.valid},jt=()=>{for(const lr of nt.unMount){const fr=get$2(j,lr);fr&&(fr._f.refs?fr._f.refs.every(_r=>!live(_r)):!live(fr._f.ref))&&nr(lr)}nt.unMount=new Set},bt=(lr,fr)=>(lr&&fr&&set$2(tt,lr,fr),!deepEqual$1(Tt(),et)),vt=(lr,fr,_r)=>generateWatchOutput(lr,nt,{...rt.mount?tt:isUndefined$2(fr)?et:isString$3(lr)?{[lr]:fr}:fr},_r,fr),ct=lr=>compact(get$2(rt.mount?tt:et,lr,a.shouldUnregister?get$2(et,lr,[]):[])),dt=(lr,fr,_r={})=>{const Sr=get$2(j,lr);let kr=fr;if(Sr){const Ar=Sr._f;Ar&&(!Ar.disabled&&set$2(tt,lr,getFieldValueAs(fr,Ar)),kr=isHTMLElement(Ar.ref)&&isNullOrUndefined(fr)?"":fr,isMultipleSelect(Ar.ref)?[...Ar.ref.options].forEach($r=>$r.selected=kr.includes($r.value)):Ar.refs?isCheckBoxInput(Ar.ref)?Ar.refs.length>1?Ar.refs.forEach($r=>(!$r.defaultChecked||!$r.disabled)&&($r.checked=Array.isArray(kr)?!!kr.find(Or=>Or===$r.value):kr===$r.value)):Ar.refs[0]&&(Ar.refs[0].checked=!!kr):Ar.refs.forEach($r=>$r.checked=$r.value===kr):isFileInput(Ar.ref)?Ar.ref.value="":(Ar.ref.value=kr,Ar.ref.type||at.values.next({name:lr,values:{...tt}})))}(_r.shouldDirty||_r.shouldTouch)&&zt(lr,kr,_r.shouldTouch,_r.shouldDirty,!0),_r.shouldValidate&&St(lr)},mt=(lr,fr,_r)=>{for(const Sr in fr){const kr=fr[Sr],Ar=`${lr}.${Sr}`,$r=get$2(j,Ar);(nt.array.has(lr)||!isPrimitive(kr)||$r&&!$r._f)&&!isDateObject(kr)?mt(Ar,kr,_r):dt(Ar,kr,_r)}},xt=(lr,fr,_r={})=>{const Sr=get$2(j,lr),kr=nt.array.has(lr),Ar=cloneObject(fr);set$2(tt,lr,Ar),kr?(at.array.next({name:lr,values:{...tt}}),(ot.isDirty||ot.dirtyFields)&&_r.shouldDirty&&at.state.next({name:lr,dirtyFields:getDirtyFields(et,tt),isDirty:bt(lr,Ar)})):Sr&&!Sr._f&&!isNullOrUndefined(Ar)?mt(lr,Ar,_r):dt(lr,Ar,_r),isWatched(lr,nt)&&at.state.next({...$}),at.values.next({name:rt.mount?lr:void 0,values:{...tt}})},At=async lr=>{rt.mount=!0;const fr=lr.target;let _r=fr.name,Sr=!0;const kr=get$2(j,_r),Ar=()=>fr.type?getFieldValue(kr._f):getEventValue(lr),$r=Or=>{Sr=Number.isNaN(Or)||Or===get$2(tt,_r,Or)};if(kr){let Or,Lr;const or=Ar(),Yt=lr.type===EVENTS.BLUR||lr.type===EVENTS.FOCUS_OUT,er=!hasValidation(kr._f)&&!_.resolver&&!get$2($.errors,_r)&&!kr._f.deps||skipValidation(Yt,get$2($.touchedFields,_r),$.isSubmitted,ht,ut),Gt=isWatched(_r,nt,Yt);set$2(tt,_r,or),Yt?(kr._f.onBlur&&kr._f.onBlur(lr),it&&it(0)):kr._f.onChange&&kr._f.onChange(lr);const Vt=zt(_r,or,Yt,!1),Wt=!isEmptyObject(Vt)||Gt;if(!Yt&&at.values.next({name:_r,type:lr.type,values:{...tt}}),er)return ot.isValid&&Ct(),Wt&&at.state.next({name:_r,...Gt?{}:Vt});if(!Yt&&Gt&&at.state.next({...$}),_.resolver){const{errors:ar}=await It([_r]);if($r(or),Sr){const yr=schemaErrorLookup($.errors,j,_r),Er=schemaErrorLookup(ar,j,yr.name||_r);Or=Er.error,_r=Er.name,Lr=isEmptyObject(ar)}}else Pt([_r],!0),Or=(await validateField(kr,tt,yt,_.shouldUseNativeValidation))[_r],Pt([_r]),$r(or),Sr&&(Or?Lr=!1:ot.isValid&&(Lr=await Ft(j,!0)));Sr&&(kr._f.deps&&St(kr._f.deps),Ot(_r,Lr,Or,Vt))}},Rt=(lr,fr)=>{if(get$2($.errors,fr)&&lr.focus)return lr.focus(),1},St=async(lr,fr={})=>{let _r,Sr;const kr=convertToArrayPayload(lr);if(_.resolver){const Ar=await Bt(isUndefined$2(lr)?lr:kr);_r=isEmptyObject(Ar),Sr=lr?!kr.some($r=>get$2(Ar,$r)):_r}else lr?(Sr=(await Promise.all(kr.map(async Ar=>{const $r=get$2(j,Ar);return await Ft($r&&$r._f?{[Ar]:$r}:$r)}))).every(Boolean),!(!Sr&&!$.isValid)&&Ct()):Sr=_r=await Ft(j);return at.state.next({...!isString$3(lr)||ot.isValid&&_r!==$.isValid?{}:{name:lr},..._.resolver||!lr?{isValid:_r}:{},errors:$.errors}),fr.shouldFocus&&!Sr&&iterateFieldsByAction(j,Rt,lr?kr:nt.mount),Sr},Tt=lr=>{const fr={...rt.mount?tt:et};return isUndefined$2(lr)?fr:isString$3(lr)?get$2(fr,lr):lr.map(_r=>get$2(fr,_r))},Et=(lr,fr)=>({invalid:!!get$2((fr||$).errors,lr),isDirty:!!get$2((fr||$).dirtyFields,lr),isTouched:!!get$2((fr||$).touchedFields,lr),isValidating:!!get$2((fr||$).validatingFields,lr),error:get$2((fr||$).errors,lr)}),Nt=lr=>{lr&&convertToArrayPayload(lr).forEach(fr=>unset($.errors,fr)),at.state.next({errors:lr?$.errors:{}})},tr=(lr,fr,_r)=>{const Sr=(get$2(j,lr,{_f:{}})._f||{}).ref,kr=get$2($.errors,lr)||{},{ref:Ar,message:$r,type:Or,...Lr}=kr;set$2($.errors,lr,{...Lr,...fr,ref:Sr}),at.state.next({name:lr,errors:$.errors,isValid:!1}),_r&&_r.shouldFocus&&Sr&&Sr.focus&&Sr.focus()},ir=(lr,fr)=>isFunction$4(lr)?at.values.subscribe({next:_r=>lr(vt(void 0,fr),_r)}):vt(lr,fr,!0),nr=(lr,fr={})=>{for(const _r of lr?convertToArrayPayload(lr):nt.mount)nt.mount.delete(_r),nt.array.delete(_r),fr.keepValue||(unset(j,_r),unset(tt,_r)),!fr.keepError&&unset($.errors,_r),!fr.keepDirty&&unset($.dirtyFields,_r),!fr.keepTouched&&unset($.touchedFields,_r),!fr.keepIsValidating&&unset($.validatingFields,_r),!_.shouldUnregister&&!fr.keepDefaultValue&&unset(et,_r);at.values.next({values:{...tt}}),at.state.next({...$,...fr.keepDirty?{isDirty:bt()}:{}}),!fr.keepIsValid&&Ct()},Zt=({disabled:lr,name:fr,field:_r,fields:Sr,value:kr})=>{if(isBoolean$3(lr)&&rt.mount||lr){const Ar=lr?void 0:isUndefined$2(kr)?getFieldValue(_r?_r._f:get$2(Sr,fr)._f):kr;set$2(tt,fr,Ar),zt(fr,Ar,!1,!1,!0)}},Kt=(lr,fr={})=>{let _r=get$2(j,lr);const Sr=isBoolean$3(fr.disabled);return set$2(j,lr,{..._r||{},_f:{..._r&&_r._f?_r._f:{ref:{name:lr}},name:lr,mount:!0,...fr}}),nt.mount.add(lr),_r?Zt({field:_r,disabled:fr.disabled,name:lr,value:fr.value}):Dt(lr,!0,fr.value),{...Sr?{disabled:fr.disabled}:{},..._.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:At,onBlur:At,ref:kr=>{if(kr){Kt(lr,fr),_r=get$2(j,lr);const Ar=isUndefined$2(kr.value)&&kr.querySelectorAll&&kr.querySelectorAll("input,select,textarea")[0]||kr,$r=isRadioOrCheckbox(Ar),Or=_r._f.refs||[];if($r?Or.find(Lr=>Lr===Ar):Ar===_r._f.ref)return;set$2(j,lr,{_f:{..._r._f,...$r?{refs:[...Or.filter(live),Ar,...Array.isArray(get$2(et,lr))?[{}]:[]],ref:{type:Ar.type,name:lr}}:{ref:Ar}}}),Dt(lr,!1,void 0,Ar)}else _r=get$2(j,lr,{}),_r._f&&(_r._f.mount=!1),(_.shouldUnregister||fr.shouldUnregister)&&!(isNameInFieldArray(nt.array,lr)&&rt.action)&&nt.unMount.add(lr)}}},Qt=()=>_.shouldFocusError&&iterateFieldsByAction(j,Rt,nt.mount),Ht=lr=>{isBoolean$3(lr)&&(at.state.next({disabled:lr}),iterateFieldsByAction(j,(fr,_r)=>{const Sr=get$2(j,_r);Sr&&(fr.disabled=Sr._f.disabled||lr,Array.isArray(Sr._f.refs)&&Sr._f.refs.forEach(kr=>{kr.disabled=Sr._f.disabled||lr}))},0,!1))},qt=(lr,fr)=>async _r=>{let Sr;_r&&(_r.preventDefault&&_r.preventDefault(),_r.persist&&_r.persist());let kr=cloneObject(tt);if(at.state.next({isSubmitting:!0}),_.resolver){const{errors:Ar,values:$r}=await It();$.errors=Ar,kr=$r}else await Ft(j);if(unset($.errors,"root"),isEmptyObject($.errors)){at.state.next({errors:{}});try{await lr(kr,_r)}catch(Ar){Sr=Ar}}else fr&&await fr({...$.errors},_r),Qt(),setTimeout(Qt);if(at.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:isEmptyObject($.errors)&&!Sr,submitCount:$.submitCount+1,errors:$.errors}),Sr)throw Sr},Jt=(lr,fr={})=>{get$2(j,lr)&&(isUndefined$2(fr.defaultValue)?xt(lr,cloneObject(get$2(et,lr))):(xt(lr,fr.defaultValue),set$2(et,lr,cloneObject(fr.defaultValue))),fr.keepTouched||unset($.touchedFields,lr),fr.keepDirty||(unset($.dirtyFields,lr),$.isDirty=fr.defaultValue?bt(lr,cloneObject(get$2(et,lr))):bt()),fr.keepError||(unset($.errors,lr),ot.isValid&&Ct()),at.state.next({...$}))},ur=(lr,fr={})=>{const _r=lr?cloneObject(lr):et,Sr=cloneObject(_r),kr=isEmptyObject(lr),Ar=kr?et:Sr;if(fr.keepDefaultValues||(et=_r),!fr.keepValues){if(fr.keepDirtyValues)for(const $r of nt.mount)get$2($.dirtyFields,$r)?set$2(Ar,$r,get$2(tt,$r)):xt($r,get$2(Ar,$r));else{if(isWeb&&isUndefined$2(lr))for(const $r of nt.mount){const Or=get$2(j,$r);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=a.shouldUnregister?fr.keepDefaultValues?cloneObject(et):{}:cloneObject(Ar),at.array.next({values:{...Ar}}),at.values.next({values:{...Ar}})}nt={mount:fr.keepDirtyValues?nt.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},rt.mount=!ot.isValid||!!fr.keepIsValid||!!fr.keepDirtyValues,rt.watch=!!a.shouldUnregister,at.state.next({submitCount:fr.keepSubmitCount?$.submitCount:0,isDirty:kr?!1:fr.keepDirty?$.isDirty:!!(fr.keepDefaultValues&&!deepEqual$1(lr,et)),isSubmitted:fr.keepIsSubmitted?$.isSubmitted:!1,dirtyFields:kr?[]: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)=>ur(isFunction$4(lr)?lr(tt):lr,fr);return{control:{register:Kt,unregister:nr,getFieldState:Et,handleSubmit:qt,setError:tr,_executeSchema:It,_getWatch:vt,_getDirty:bt,_updateValid:Ct,_removeUnmounted:jt,_updateFieldArray:$t,_updateDisabledField:Zt,_getFieldArray:ct,_reset:ur,_resetDefaultValues:()=>isFunction$4(_.defaultValues)&&_.defaultValues().then(lr=>{xr(lr,_.resetOptions),at.state.next({isLoading:!1})}),_updateFormState:lr=>{$={...$,...lr}},_disableForm:Ht,_subjects:at,_proxyFormState:ot,_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 _},set _options(lr){_={..._,...lr}}},trigger:St,register:Kt,handleSubmit:qt,watch:ir,setValue:xt,getValues:Tt,reset:xr,resetField:Jt,clearErrors:Nt,unregister:nr,setError:tr,setFocus:(lr,fr={})=>{const _r=get$2(j,lr),Sr=_r&&_r._f;if(Sr){const kr=Sr.refs?Sr.refs[0]:Sr.ref;kr.focus&&(kr.focus(),fr.shouldSelect&&kr.select())}},getFieldState:Et}}function useForm(a={}){const _=React$2.useRef(),$=React$2.useRef(),[j,et]=React$2.useState({isDirty:!1,isValidating:!1,isLoading:isFunction$4(a.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:a.errors||{},disabled:a.disabled||!1,defaultValues:isFunction$4(a.defaultValues)?void 0:a.defaultValues});_.current||(_.current={...createFormControl(a),formState:j});const tt=_.current.control;return tt._options=a,useSubscribe({subject:tt._subjects.state,next:rt=>{shouldRenderFormState(rt,tt._proxyFormState,tt._updateFormState)&&et({...tt._formState})}}),React$2.useEffect(()=>tt._disableForm(a.disabled),[tt,a.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(()=>{a.values&&!deepEqual$1(a.values,$.current)?(tt._reset(a.values,tt._options.resetOptions),$.current=a.values,et(rt=>({...rt}))):tt._resetDefaultValues()},[a.values,tt]),React$2.useEffect(()=>{a.errors&&tt._setErrors(a.errors)},[a.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(()=>{a.shouldUnregister&&tt._subjects.values.next({values:tt._getWatch()})},[a.shouldUnregister,tt]),_.current.formState=getProxyFormState(j,tt),_.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=a=>jsxRuntimeExports.jsxs(Icon,{width:"24px",height:"24px",fill:"none",textAlign:"center",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...a,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=a=>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",...a,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=a=>jsxRuntimeExports.jsx(Icon,{fill:"none",viewBox:"0 0 13 17",xmlns:"http://www.w3.org/2000/svg",...a,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=a=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...a,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=a=>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",...a,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=a=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",strokeWidth:"1.2",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...a,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=a=>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",...a,children:jsxRuntimeExports.jsx("path",{d:"M4 6H20M4 12H20M4 18H20",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),CheckmarkIcon=a=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",...a,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=a=>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",...a,children:jsxRuntimeExports.jsx("path",{d:"M4.5 6.75L9 11.25L13.5 6.75",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),ChevronRightIcon=a=>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",...a,children:jsxRuntimeExports.jsx("path",{d:"M7 14L11.5 9.5L7 5",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),ChevronUpIcon=a=>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",...a,children:jsxRuntimeExports.jsx("path",{d:"M4.5 11.25L9 6.75L13.5 11.25",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),CoinIcon=a=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...a,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=a=>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",...a,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=a=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",...a,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=a=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",...a,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=a=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...a,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=a=>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",...a,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=a=>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",...a,children:jsxRuntimeExports.jsx("path",{d:"M4 14L9 19L20 8M6 8.88889L9.07692 12L16 5",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),DownloadIcon=a=>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",...a,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=a=>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",...a,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"})}),ExclamationIcon=a=>jsxRuntimeExports.jsx(Icon,{width:"12px",height:"12px",fill:"none",stroke:colors.orange,viewBox:"0 0 12 12",xmlns:"http://www.w3.org/2000/svg",...a,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=a=>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",...a,children:jsxRuntimeExports.jsx("path",{d:"M15 3V15M3 9H12M12 9L9 6M12 9L9 12",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),ExternalLinkIcon=a=>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",...a,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=a=>jsxRuntimeExports.jsxs(Icon,{width:"16px",height:"12px",fill:"none",viewBox:"0 0 16 12",xmlns:"http://www.w3.org/2000/svg",...a,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=a=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",...a,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=a=>jsxRuntimeExports.jsx(Icon,{width:"30px",height:"15px",fill:colors.gray[450],viewBox:"1 1 30 15",xmlns:"http://www.w3.org/2000/svg",...a,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=a=>jsxRuntimeExports.jsx(Icon,{width:"23px",height:"18px",fill:colors.gray[450],viewBox:"0 0 23 18",xmlns:"http://www.w3.org/2000/svg",...a,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"})}),FetchingIcon=a=>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",...a,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=a=>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",...a,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=a=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",...a,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=a=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",stroke:"black",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",...a,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=a=>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",...a,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=a=>jsxRuntimeExports.jsxs(Icon,{width:"24px",height:"24px",fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...a,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=a=>jsxRuntimeExports.jsxs(Icon,{width:"24px",height:"24px",fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...a,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=a=>jsxRuntimeExports.jsx(Icon,{width:"24px",height:"24px",fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...a,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=a=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",...a,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=a=>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",...a,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=a=>jsxRuntimeExports.jsx(OutgoingArrow,{css:{rotate:"180deg"},...a}),KeyIcon=a=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none","data-testid":"key-icon",strokeWidth:"1.2",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",...a,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=a=>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",...a,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=a=>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",...a,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=a=>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",...a,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=a=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",stroke:"black",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",...a,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",..._,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:a}),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:a}),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:a}),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:a}),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:a})]}),NoticeIcon=a=>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",...a,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=a=>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",...a,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=a=>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",...a,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=a=>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",...a,children:jsxRuntimeExports.jsx("path",{d:"M4 12H20M12 4V20",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),RefreshClockIcon=a=>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",...a,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=a=>jsxRuntimeExports.jsx(Icon,{width:"22px",height:"22px",strokeWidth:"0",viewBox:"0 0 22 22",xmlns:"http://www.w3.org/2000/svg",...a,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=a=>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",...a,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=a=>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",...a,children:jsxRuntimeExports.jsx("path",{d:"M16 3L8 21",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),SlidersIcon=a=>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",...a,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"})}),SocialIcon=a=>jsxRuntimeExports.jsx(Icon,{width:"28px",height:"28px",fill:"none",stroke:"transparent","data-testid":"social-icon",viewBox:"0 0 28 28",...a,children:jsxRuntimeExports.jsx("g",{id:"Group 40429",children:jsxRuntimeExports.jsx("g",{id:"Group 40428",children:jsxRuntimeExports.jsxs("g",{id:"Group 39769",children:[jsxRuntimeExports.jsx("path",{d:"M27.4398 14.3177C27.4398 13.325 27.3507 12.3705 27.1852 11.4541H14V16.8695H21.5344C21.2099 18.6194 20.2235 20.1021 18.7408 21.0949V24.6075H23.2653C25.9125 22.1703 27.4398 18.5813 27.4398 14.3177Z",fill:"#4285F4",clipRule:"evenodd",fillRule:"evenodd",id:"Shape"}),jsxRuntimeExports.jsx("path",{d:"M14.0009 28C17.7809 28 20.9499 26.7464 23.2663 24.6082L18.7418 21.0955C17.4882 21.9355 15.8846 22.4319 14.0009 22.4319C10.3546 22.4319 7.26832 19.9692 6.16743 16.6602H1.49023V20.2874C3.79383 24.8628 8.5283 28 14.0009 28Z",fill:"#34A853",clipRule:"evenodd",fillRule:"evenodd",id:"Shape_2"}),jsxRuntimeExports.jsx("path",{d:"M6.16627 16.66C5.88627 15.82 5.72718 14.9228 5.72718 14.0001C5.72718 13.0774 5.88627 12.1801 6.16627 11.3401V7.71289H1.48907C0.5409 9.60286 0 11.741 0 14.0001C0 16.2591 0.5409 18.3973 1.48907 20.2872L6.16627 16.66Z",fill:"#FBBC05",clipRule:"evenodd",fillRule:"evenodd",id:"Shape_3"}),jsxRuntimeExports.jsx("path",{d:"M14.0009 5.56809C16.0564 5.56809 17.9018 6.27445 19.3527 7.6617L23.3681 3.64631C20.9436 1.38725 17.7745 0 14.0009 0C8.5283 0 3.79383 3.13722 1.49023 7.7126L6.16743 11.3398C7.26832 8.03078 10.3546 5.56809 14.0009 5.56809Z",fill:"#EA4335",clipRule:"evenodd",fillRule:"evenodd",id:"Shape_4"})]})})})}),TezIcon=a=>jsxRuntimeExports.jsxs(Icon,{width:"30px",height:"30px",fill:"none","data-testid":"tez-icon",viewBox:"0 0 30 30",...a,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=a=>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",...a,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/${a}`;return jsxRuntimeExports.jsx(Image$1,{fallbackSrc:"./static/media/coin-front.svg",src:$,..._})},TrashIcon=a=>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",...a,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"})}),UnknownContactIcon=a=>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",...a,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=a=>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",...a,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=a=>jsxRuntimeExports.jsx(Icon,{width:"14px",height:"14px",fill:colors.gray[450],viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg",...a,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=a=>jsxRuntimeExports.jsx(Icon,{width:"7px",height:"5px",fill:"none",stroke:"white",viewBox:"0 0 7 5",xmlns:"http://www.w3.org/2000/svg",...a,children:jsxRuntimeExports.jsx("path",{d:"M1.66699 2.19314L3.0281 3.55425L5.75033 0.832031",strokeLinecap:"square",strokeLinejoin:"round"})}),WalletPlusIcon=a=>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",...a,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=a=>jsxRuntimeExports.jsx(Icon,{width:"36px",height:"32px",fill:"none",stroke:colors.orangeL,viewBox:"0 0 36 32",xmlns:"http://www.w3.org/2000/svg",...a,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=a=>jsxRuntimeExports.jsx(Icon,{width:"18px",height:"18px",fill:"none",viewBox:"0 0 18 18",xmlns:"http://www.w3.org/2000/svg",...a,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(a){return Object.keys(a)}var ExposedPromiseStatus;(function(a){a.PENDING="pending",a.RESOLVED="resolved",a.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((_,$)=>{this._resolve=j=>{this.isSettled()||(this._promiseResult=j,_(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(_){const $=new ExposedPromise;return $.resolve(_),$}static reject(_){const $=new ExposedPromise;return $.reject(_),$}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 $=a.indexOf("=");$===-1&&($=_);var j=$===_?0:4-$%4;return[$,j]}function byteLength$2(a){var _=getLens$1(a),$=_[0],j=_[1];return($+j)*3/4-j}function _byteLength$1(a,_,$){return(_+$)*3/4-$}function toByteArray$1(a){var _,$=getLens$1(a),j=$[0],et=$[1],tt=new Arr$1(_byteLength$1(a,j,et)),rt=0,nt=et>0?j-4:j,it;for(it=0;it>16&255,tt[rt++]=_>>8&255,tt[rt++]=_&255;return et===2&&(_=revLookup$1[a.charCodeAt(it)]<<2|revLookup$1[a.charCodeAt(it+1)]>>4,tt[rt++]=_&255),et===1&&(_=revLookup$1[a.charCodeAt(it)]<<10|revLookup$1[a.charCodeAt(it+1)]<<4|revLookup$1[a.charCodeAt(it+2)]>>2,tt[rt++]=_>>8&255,tt[rt++]=_&255),tt}function tripletToBase64$1(a){return lookup$3[a>>18&63]+lookup$3[a>>12&63]+lookup$3[a>>6&63]+lookup$3[a&63]}function encodeChunk$1(a,_,$){for(var j,et=[],tt=_;tt<$;tt+=3)j=(a[tt]<<16&16711680)+(a[tt+1]<<8&65280)+(a[tt+2]&255),et.push(tripletToBase64$1(j));return et.join("")}function fromByteArray$1(a){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[_>>2]+lookup$3[_<<4&63]+"==")):j===2&&(_=(a[$-2]<<8)+a[$-1],et.push(lookup$3[_>>10]+lookup$3[_>>4&63]+lookup$3[_<<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,ot=-7,at=$?et-1:0,ut=$?-1:1,ht=a[_+at];for(at+=ut,tt=ht&(1<<-ot)-1,ht>>=-ot,ot+=nt;ot>0;tt=tt*256+a[_+at],at+=ut,ot-=8);for(rt=tt&(1<<-ot)-1,tt>>=-ot,ot+=j;ot>0;rt=rt*256+a[_+at],at+=ut,ot-=8);if(tt===0)tt=1-st;else{if(tt===it)return rt?NaN:(ht?-1:1)*(1/0);rt=rt+Math.pow(2,j),tt=tt-st}return(ht?-1:1)*rt*Math.pow(2,tt-j)};ieee754$1.write=function(a,_,$,j,et,tt){var rt,nt,it,st=tt*8-et-1,ot=(1<>1,ut=et===23?Math.pow(2,-24)-Math.pow(2,-77):0,ht=j?0:tt-1,yt=j?1:-1,wt=_<0||_===0&&1/_<0?1:0;for(_=Math.abs(_),isNaN(_)||_===1/0?(nt=isNaN(_)?1:0,rt=ot):(rt=Math.floor(Math.log(_)/Math.LN2),_*(it=Math.pow(2,-rt))<1&&(rt--,it*=2),rt+at>=1?_+=ut/it:_+=ut*Math.pow(2,1-at),_*it>=2&&(rt++,it/=2),rt+at>=ot?(nt=0,rt=ot):rt+at>=1?(nt=(_*it-1)*Math.pow(2,et),rt=rt+at):(nt=_*Math.pow(2,at-1)*Math.pow(2,et),rt=0));et>=8;a[$+ht]=nt&255,ht+=yt,nt/=256,et-=8);for(rt=rt<0;a[$+ht]=rt&255,ht+=yt,rt/=256,st-=8);a[$+ht-yt]|=wt*128};/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */(function(a){const _=base64Js$1,$=ieee754$1,j=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;a.Buffer=ot,a.SlowBuffer=Dt,a.INSPECT_MAX_BYTES=50;const et=2147483647;a.kMaxLength=et;const{Uint8Array:tt,ArrayBuffer:rt,SharedArrayBuffer:nt}=globalThis;ot.TYPED_ARRAY_SUPPORT=it(),!ot.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 Gt=new tt(1),Vt={foo:function(){return 42}};return Object.setPrototypeOf(Vt,tt.prototype),Object.setPrototypeOf(Gt,Vt),Gt.foo()===42}catch{return!1}}Object.defineProperty(ot.prototype,"parent",{enumerable:!0,get:function(){if(ot.isBuffer(this))return this.buffer}}),Object.defineProperty(ot.prototype,"offset",{enumerable:!0,get:function(){if(ot.isBuffer(this))return this.byteOffset}});function st(Gt){if(Gt>et)throw new RangeError('The value "'+Gt+'" is invalid for option "size"');const Vt=new tt(Gt);return Object.setPrototypeOf(Vt,ot.prototype),Vt}function ot(Gt,Vt,Wt){if(typeof Gt=="number"){if(typeof Vt=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return yt(Gt)}return at(Gt,Vt,Wt)}ot.poolSize=8192;function at(Gt,Vt,Wt){if(typeof Gt=="string")return wt(Gt,Vt);if(rt.isView(Gt))return Pt(Gt);if(Gt==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Gt);if(Or(Gt,rt)||Gt&&Or(Gt.buffer,rt)||typeof nt<"u"&&(Or(Gt,nt)||Gt&&Or(Gt.buffer,nt)))return $t(Gt,Vt,Wt);if(typeof Gt=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const ar=Gt.valueOf&&Gt.valueOf();if(ar!=null&&ar!==Gt)return ot.from(ar,Vt,Wt);const yr=Mt(Gt);if(yr)return yr;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof Gt[Symbol.toPrimitive]=="function")return ot.from(Gt[Symbol.toPrimitive]("string"),Vt,Wt);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Gt)}ot.from=function(Gt,Vt,Wt){return at(Gt,Vt,Wt)},Object.setPrototypeOf(ot.prototype,tt.prototype),Object.setPrototypeOf(ot,tt);function ut(Gt){if(typeof Gt!="number")throw new TypeError('"size" argument must be of type number');if(Gt<0)throw new RangeError('The value "'+Gt+'" is invalid for option "size"')}function ht(Gt,Vt,Wt){return ut(Gt),Gt<=0?st(Gt):Vt!==void 0?typeof Wt=="string"?st(Gt).fill(Vt,Wt):st(Gt).fill(Vt):st(Gt)}ot.alloc=function(Gt,Vt,Wt){return ht(Gt,Vt,Wt)};function yt(Gt){return ut(Gt),st(Gt<0?0:Lt(Gt)|0)}ot.allocUnsafe=function(Gt){return yt(Gt)},ot.allocUnsafeSlow=function(Gt){return yt(Gt)};function wt(Gt,Vt){if((typeof Vt!="string"||Vt==="")&&(Vt="utf8"),!ot.isEncoding(Vt))throw new TypeError("Unknown encoding: "+Vt);const Wt=zt(Gt,Vt)|0;let ar=st(Wt);const yr=ar.write(Gt,Vt);return yr!==Wt&&(ar=ar.slice(0,yr)),ar}function Ct(Gt){const Vt=Gt.length<0?0:Lt(Gt.length)|0,Wt=st(Vt);for(let ar=0;ar=et)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+et.toString(16)+" bytes");return Gt|0}function Dt(Gt){return+Gt!=Gt&&(Gt=0),ot.alloc(+Gt)}ot.isBuffer=function(Vt){return Vt!=null&&Vt._isBuffer===!0&&Vt!==ot.prototype},ot.compare=function(Vt,Wt){if(Or(Vt,tt)&&(Vt=ot.from(Vt,Vt.offset,Vt.byteLength)),Or(Wt,tt)&&(Wt=ot.from(Wt,Wt.offset,Wt.byteLength)),!ot.isBuffer(Vt)||!ot.isBuffer(Wt))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(Vt===Wt)return 0;let ar=Vt.length,yr=Wt.length;for(let Er=0,Rr=Math.min(ar,yr);Eryr.length?(ot.isBuffer(Rr)||(Rr=ot.from(Rr)),Rr.copy(yr,Er)):tt.prototype.set.call(yr,Rr,Er);else if(ot.isBuffer(Rr))Rr.copy(yr,Er);else throw new TypeError('"list" argument must be an Array of Buffers');Er+=Rr.length}return yr};function zt(Gt,Vt){if(ot.isBuffer(Gt))return Gt.length;if(rt.isView(Gt)||Or(Gt,rt))return Gt.byteLength;if(typeof Gt!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof Gt);const Wt=Gt.length,ar=arguments.length>2&&arguments[2]===!0;if(!ar&&Wt===0)return 0;let yr=!1;for(;;)switch(Vt){case"ascii":case"latin1":case"binary":return Wt;case"utf8":case"utf-8":return _r(Gt).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Wt*2;case"hex":return Wt>>>1;case"base64":return Ar(Gt).length;default:if(yr)return ar?-1:_r(Gt).length;Vt=(""+Vt).toLowerCase(),yr=!0}}ot.byteLength=zt;function Ot(Gt,Vt,Wt){let ar=!1;if((Vt===void 0||Vt<0)&&(Vt=0),Vt>this.length||((Wt===void 0||Wt>this.length)&&(Wt=this.length),Wt<=0)||(Wt>>>=0,Vt>>>=0,Wt<=Vt))return"";for(Gt||(Gt="utf8");;)switch(Gt){case"hex":return Et(this,Vt,Wt);case"utf8":case"utf-8":return xt(this,Vt,Wt);case"ascii":return St(this,Vt,Wt);case"latin1":case"binary":return Tt(this,Vt,Wt);case"base64":return mt(this,Vt,Wt);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Nt(this,Vt,Wt);default:if(ar)throw new TypeError("Unknown encoding: "+Gt);Gt=(Gt+"").toLowerCase(),ar=!0}}ot.prototype._isBuffer=!0;function It(Gt,Vt,Wt){const ar=Gt[Vt];Gt[Vt]=Gt[Wt],Gt[Wt]=ar}ot.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 Wt=0;WtWt&&(Vt+=" ... "),""},j&&(ot.prototype[j]=ot.prototype.inspect),ot.prototype.compare=function(Vt,Wt,ar,yr,Er){if(Or(Vt,tt)&&(Vt=ot.from(Vt,Vt.offset,Vt.byteLength)),!ot.isBuffer(Vt))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof Vt);if(Wt===void 0&&(Wt=0),ar===void 0&&(ar=Vt?Vt.length:0),yr===void 0&&(yr=0),Er===void 0&&(Er=this.length),Wt<0||ar>Vt.length||yr<0||Er>this.length)throw new RangeError("out of range index");if(yr>=Er&&Wt>=ar)return 0;if(yr>=Er)return-1;if(Wt>=ar)return 1;if(Wt>>>=0,ar>>>=0,yr>>>=0,Er>>>=0,this===Vt)return 0;let Rr=Er-yr,Wr=ar-Wt;const Hr=Math.min(Rr,Wr),Fr=this.slice(yr,Er),pn=Vt.slice(Wt,ar);for(let Jr=0;Jr2147483647?Wt=2147483647:Wt<-2147483648&&(Wt=-2147483648),Wt=+Wt,Lr(Wt)&&(Wt=yr?0:Gt.length-1),Wt<0&&(Wt=Gt.length+Wt),Wt>=Gt.length){if(yr)return-1;Wt=Gt.length-1}else if(Wt<0)if(yr)Wt=0;else return-1;if(typeof Vt=="string"&&(Vt=ot.from(Vt,ar)),ot.isBuffer(Vt))return Vt.length===0?-1:Ft(Gt,Vt,Wt,ar,yr);if(typeof Vt=="number")return Vt=Vt&255,typeof tt.prototype.indexOf=="function"?yr?tt.prototype.indexOf.call(Gt,Vt,Wt):tt.prototype.lastIndexOf.call(Gt,Vt,Wt):Ft(Gt,[Vt],Wt,ar,yr);throw new TypeError("val must be string, number or Buffer")}function Ft(Gt,Vt,Wt,ar,yr){let Er=1,Rr=Gt.length,Wr=Vt.length;if(ar!==void 0&&(ar=String(ar).toLowerCase(),ar==="ucs2"||ar==="ucs-2"||ar==="utf16le"||ar==="utf-16le")){if(Gt.length<2||Vt.length<2)return-1;Er=2,Rr/=2,Wr/=2,Wt/=2}function Hr(pn,Jr){return Er===1?pn[Jr]:pn.readUInt16BE(Jr*Er)}let Fr;if(yr){let pn=-1;for(Fr=Wt;FrRr&&(Wt=Rr-Wr),Fr=Wt;Fr>=0;Fr--){let pn=!0;for(let Jr=0;Jryr&&(ar=yr)):ar=yr;const Er=Vt.length;ar>Er/2&&(ar=Er/2);let Rr;for(Rr=0;Rr>>0,isFinite(ar)?(ar=ar>>>0,yr===void 0&&(yr="utf8")):(yr=ar,ar=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const Er=this.length-Wt;if((ar===void 0||ar>Er)&&(ar=Er),Vt.length>0&&(ar<0||Wt<0)||Wt>this.length)throw new RangeError("Attempt to write outside buffer bounds");yr||(yr="utf8");let Rr=!1;for(;;)switch(yr){case"hex":return jt(this,Vt,Wt,ar);case"utf8":case"utf-8":return bt(this,Vt,Wt,ar);case"ascii":case"latin1":case"binary":return vt(this,Vt,Wt,ar);case"base64":return ct(this,Vt,Wt,ar);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return dt(this,Vt,Wt,ar);default:if(Rr)throw new TypeError("Unknown encoding: "+yr);yr=(""+yr).toLowerCase(),Rr=!0}},ot.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function mt(Gt,Vt,Wt){return Vt===0&&Wt===Gt.length?_.fromByteArray(Gt):_.fromByteArray(Gt.slice(Vt,Wt))}function xt(Gt,Vt,Wt){Wt=Math.min(Gt.length,Wt);const ar=[];let yr=Vt;for(;yr239?4:Er>223?3:Er>191?2:1;if(yr+Wr<=Wt){let Hr,Fr,pn,Jr;switch(Wr){case 1:Er<128&&(Rr=Er);break;case 2:Hr=Gt[yr+1],(Hr&192)===128&&(Jr=(Er&31)<<6|Hr&63,Jr>127&&(Rr=Jr));break;case 3:Hr=Gt[yr+1],Fr=Gt[yr+2],(Hr&192)===128&&(Fr&192)===128&&(Jr=(Er&15)<<12|(Hr&63)<<6|Fr&63,Jr>2047&&(Jr<55296||Jr>57343)&&(Rr=Jr));break;case 4:Hr=Gt[yr+1],Fr=Gt[yr+2],pn=Gt[yr+3],(Hr&192)===128&&(Fr&192)===128&&(pn&192)===128&&(Jr=(Er&15)<<18|(Hr&63)<<12|(Fr&63)<<6|pn&63,Jr>65535&&Jr<1114112&&(Rr=Jr))}}Rr===null?(Rr=65533,Wr=1):Rr>65535&&(Rr-=65536,ar.push(Rr>>>10&1023|55296),Rr=56320|Rr&1023),ar.push(Rr),yr+=Wr}return Rt(ar)}const At=4096;function Rt(Gt){const Vt=Gt.length;if(Vt<=At)return String.fromCharCode.apply(String,Gt);let Wt="",ar=0;for(;arar)&&(Wt=ar);let yr="";for(let Er=Vt;Erar&&(Vt=ar),Wt<0?(Wt+=ar,Wt<0&&(Wt=0)):Wt>ar&&(Wt=ar),WtWt)throw new RangeError("Trying to access beyond buffer length")}ot.prototype.readUintLE=ot.prototype.readUIntLE=function(Vt,Wt,ar){Vt=Vt>>>0,Wt=Wt>>>0,ar||tr(Vt,Wt,this.length);let yr=this[Vt],Er=1,Rr=0;for(;++Rr>>0,Wt=Wt>>>0,ar||tr(Vt,Wt,this.length);let yr=this[Vt+--Wt],Er=1;for(;Wt>0&&(Er*=256);)yr+=this[Vt+--Wt]*Er;return yr},ot.prototype.readUint8=ot.prototype.readUInt8=function(Vt,Wt){return Vt=Vt>>>0,Wt||tr(Vt,1,this.length),this[Vt]},ot.prototype.readUint16LE=ot.prototype.readUInt16LE=function(Vt,Wt){return Vt=Vt>>>0,Wt||tr(Vt,2,this.length),this[Vt]|this[Vt+1]<<8},ot.prototype.readUint16BE=ot.prototype.readUInt16BE=function(Vt,Wt){return Vt=Vt>>>0,Wt||tr(Vt,2,this.length),this[Vt]<<8|this[Vt+1]},ot.prototype.readUint32LE=ot.prototype.readUInt32LE=function(Vt,Wt){return Vt=Vt>>>0,Wt||tr(Vt,4,this.length),(this[Vt]|this[Vt+1]<<8|this[Vt+2]<<16)+this[Vt+3]*16777216},ot.prototype.readUint32BE=ot.prototype.readUInt32BE=function(Vt,Wt){return Vt=Vt>>>0,Wt||tr(Vt,4,this.length),this[Vt]*16777216+(this[Vt+1]<<16|this[Vt+2]<<8|this[Vt+3])},ot.prototype.readBigUInt64LE=Yt(function(Vt){Vt=Vt>>>0,Cr(Vt,"offset");const Wt=this[Vt],ar=this[Vt+7];(Wt===void 0||ar===void 0)&&Mr(Vt,this.length-8);const yr=Wt+this[++Vt]*2**8+this[++Vt]*2**16+this[++Vt]*2**24,Er=this[++Vt]+this[++Vt]*2**8+this[++Vt]*2**16+ar*2**24;return BigInt(yr)+(BigInt(Er)<>>0,Cr(Vt,"offset");const Wt=this[Vt],ar=this[Vt+7];(Wt===void 0||ar===void 0)&&Mr(Vt,this.length-8);const yr=Wt*2**24+this[++Vt]*2**16+this[++Vt]*2**8+this[++Vt],Er=this[++Vt]*2**24+this[++Vt]*2**16+this[++Vt]*2**8+ar;return(BigInt(yr)<>>0,Wt=Wt>>>0,ar||tr(Vt,Wt,this.length);let yr=this[Vt],Er=1,Rr=0;for(;++Rr=Er&&(yr-=Math.pow(2,8*Wt)),yr},ot.prototype.readIntBE=function(Vt,Wt,ar){Vt=Vt>>>0,Wt=Wt>>>0,ar||tr(Vt,Wt,this.length);let yr=Wt,Er=1,Rr=this[Vt+--yr];for(;yr>0&&(Er*=256);)Rr+=this[Vt+--yr]*Er;return Er*=128,Rr>=Er&&(Rr-=Math.pow(2,8*Wt)),Rr},ot.prototype.readInt8=function(Vt,Wt){return Vt=Vt>>>0,Wt||tr(Vt,1,this.length),this[Vt]&128?(255-this[Vt]+1)*-1:this[Vt]},ot.prototype.readInt16LE=function(Vt,Wt){Vt=Vt>>>0,Wt||tr(Vt,2,this.length);const ar=this[Vt]|this[Vt+1]<<8;return ar&32768?ar|4294901760:ar},ot.prototype.readInt16BE=function(Vt,Wt){Vt=Vt>>>0,Wt||tr(Vt,2,this.length);const ar=this[Vt+1]|this[Vt]<<8;return ar&32768?ar|4294901760:ar},ot.prototype.readInt32LE=function(Vt,Wt){return Vt=Vt>>>0,Wt||tr(Vt,4,this.length),this[Vt]|this[Vt+1]<<8|this[Vt+2]<<16|this[Vt+3]<<24},ot.prototype.readInt32BE=function(Vt,Wt){return Vt=Vt>>>0,Wt||tr(Vt,4,this.length),this[Vt]<<24|this[Vt+1]<<16|this[Vt+2]<<8|this[Vt+3]},ot.prototype.readBigInt64LE=Yt(function(Vt){Vt=Vt>>>0,Cr(Vt,"offset");const Wt=this[Vt],ar=this[Vt+7];(Wt===void 0||ar===void 0)&&Mr(Vt,this.length-8);const yr=this[Vt+4]+this[Vt+5]*2**8+this[Vt+6]*2**16+(ar<<24);return(BigInt(yr)<>>0,Cr(Vt,"offset");const Wt=this[Vt],ar=this[Vt+7];(Wt===void 0||ar===void 0)&&Mr(Vt,this.length-8);const yr=(Wt<<24)+this[++Vt]*2**16+this[++Vt]*2**8+this[++Vt];return(BigInt(yr)<>>0,Wt||tr(Vt,4,this.length),$.read(this,Vt,!0,23,4)},ot.prototype.readFloatBE=function(Vt,Wt){return Vt=Vt>>>0,Wt||tr(Vt,4,this.length),$.read(this,Vt,!1,23,4)},ot.prototype.readDoubleLE=function(Vt,Wt){return Vt=Vt>>>0,Wt||tr(Vt,8,this.length),$.read(this,Vt,!0,52,8)},ot.prototype.readDoubleBE=function(Vt,Wt){return Vt=Vt>>>0,Wt||tr(Vt,8,this.length),$.read(this,Vt,!1,52,8)};function ir(Gt,Vt,Wt,ar,yr,Er){if(!ot.isBuffer(Gt))throw new TypeError('"buffer" argument must be a Buffer instance');if(Vt>yr||VtGt.length)throw new RangeError("Index out of range")}ot.prototype.writeUintLE=ot.prototype.writeUIntLE=function(Vt,Wt,ar,yr){if(Vt=+Vt,Wt=Wt>>>0,ar=ar>>>0,!yr){const Wr=Math.pow(2,8*ar)-1;ir(this,Vt,Wt,ar,Wr,0)}let Er=1,Rr=0;for(this[Wt]=Vt&255;++Rr>>0,ar=ar>>>0,!yr){const Wr=Math.pow(2,8*ar)-1;ir(this,Vt,Wt,ar,Wr,0)}let Er=ar-1,Rr=1;for(this[Wt+Er]=Vt&255;--Er>=0&&(Rr*=256);)this[Wt+Er]=Vt/Rr&255;return Wt+ar},ot.prototype.writeUint8=ot.prototype.writeUInt8=function(Vt,Wt,ar){return Vt=+Vt,Wt=Wt>>>0,ar||ir(this,Vt,Wt,1,255,0),this[Wt]=Vt&255,Wt+1},ot.prototype.writeUint16LE=ot.prototype.writeUInt16LE=function(Vt,Wt,ar){return Vt=+Vt,Wt=Wt>>>0,ar||ir(this,Vt,Wt,2,65535,0),this[Wt]=Vt&255,this[Wt+1]=Vt>>>8,Wt+2},ot.prototype.writeUint16BE=ot.prototype.writeUInt16BE=function(Vt,Wt,ar){return Vt=+Vt,Wt=Wt>>>0,ar||ir(this,Vt,Wt,2,65535,0),this[Wt]=Vt>>>8,this[Wt+1]=Vt&255,Wt+2},ot.prototype.writeUint32LE=ot.prototype.writeUInt32LE=function(Vt,Wt,ar){return Vt=+Vt,Wt=Wt>>>0,ar||ir(this,Vt,Wt,4,4294967295,0),this[Wt+3]=Vt>>>24,this[Wt+2]=Vt>>>16,this[Wt+1]=Vt>>>8,this[Wt]=Vt&255,Wt+4},ot.prototype.writeUint32BE=ot.prototype.writeUInt32BE=function(Vt,Wt,ar){return Vt=+Vt,Wt=Wt>>>0,ar||ir(this,Vt,Wt,4,4294967295,0),this[Wt]=Vt>>>24,this[Wt+1]=Vt>>>16,this[Wt+2]=Vt>>>8,this[Wt+3]=Vt&255,Wt+4};function nr(Gt,Vt,Wt,ar,yr){pr(Vt,ar,yr,Gt,Wt,7);let Er=Number(Vt&BigInt(4294967295));Gt[Wt++]=Er,Er=Er>>8,Gt[Wt++]=Er,Er=Er>>8,Gt[Wt++]=Er,Er=Er>>8,Gt[Wt++]=Er;let Rr=Number(Vt>>BigInt(32)&BigInt(4294967295));return Gt[Wt++]=Rr,Rr=Rr>>8,Gt[Wt++]=Rr,Rr=Rr>>8,Gt[Wt++]=Rr,Rr=Rr>>8,Gt[Wt++]=Rr,Wt}function Zt(Gt,Vt,Wt,ar,yr){pr(Vt,ar,yr,Gt,Wt,7);let Er=Number(Vt&BigInt(4294967295));Gt[Wt+7]=Er,Er=Er>>8,Gt[Wt+6]=Er,Er=Er>>8,Gt[Wt+5]=Er,Er=Er>>8,Gt[Wt+4]=Er;let Rr=Number(Vt>>BigInt(32)&BigInt(4294967295));return Gt[Wt+3]=Rr,Rr=Rr>>8,Gt[Wt+2]=Rr,Rr=Rr>>8,Gt[Wt+1]=Rr,Rr=Rr>>8,Gt[Wt]=Rr,Wt+8}ot.prototype.writeBigUInt64LE=Yt(function(Vt,Wt=0){return nr(this,Vt,Wt,BigInt(0),BigInt("0xffffffffffffffff"))}),ot.prototype.writeBigUInt64BE=Yt(function(Vt,Wt=0){return Zt(this,Vt,Wt,BigInt(0),BigInt("0xffffffffffffffff"))}),ot.prototype.writeIntLE=function(Vt,Wt,ar,yr){if(Vt=+Vt,Wt=Wt>>>0,!yr){const Hr=Math.pow(2,8*ar-1);ir(this,Vt,Wt,ar,Hr-1,-Hr)}let Er=0,Rr=1,Wr=0;for(this[Wt]=Vt&255;++Er>0)-Wr&255;return Wt+ar},ot.prototype.writeIntBE=function(Vt,Wt,ar,yr){if(Vt=+Vt,Wt=Wt>>>0,!yr){const Hr=Math.pow(2,8*ar-1);ir(this,Vt,Wt,ar,Hr-1,-Hr)}let Er=ar-1,Rr=1,Wr=0;for(this[Wt+Er]=Vt&255;--Er>=0&&(Rr*=256);)Vt<0&&Wr===0&&this[Wt+Er+1]!==0&&(Wr=1),this[Wt+Er]=(Vt/Rr>>0)-Wr&255;return Wt+ar},ot.prototype.writeInt8=function(Vt,Wt,ar){return Vt=+Vt,Wt=Wt>>>0,ar||ir(this,Vt,Wt,1,127,-128),Vt<0&&(Vt=255+Vt+1),this[Wt]=Vt&255,Wt+1},ot.prototype.writeInt16LE=function(Vt,Wt,ar){return Vt=+Vt,Wt=Wt>>>0,ar||ir(this,Vt,Wt,2,32767,-32768),this[Wt]=Vt&255,this[Wt+1]=Vt>>>8,Wt+2},ot.prototype.writeInt16BE=function(Vt,Wt,ar){return Vt=+Vt,Wt=Wt>>>0,ar||ir(this,Vt,Wt,2,32767,-32768),this[Wt]=Vt>>>8,this[Wt+1]=Vt&255,Wt+2},ot.prototype.writeInt32LE=function(Vt,Wt,ar){return Vt=+Vt,Wt=Wt>>>0,ar||ir(this,Vt,Wt,4,2147483647,-2147483648),this[Wt]=Vt&255,this[Wt+1]=Vt>>>8,this[Wt+2]=Vt>>>16,this[Wt+3]=Vt>>>24,Wt+4},ot.prototype.writeInt32BE=function(Vt,Wt,ar){return Vt=+Vt,Wt=Wt>>>0,ar||ir(this,Vt,Wt,4,2147483647,-2147483648),Vt<0&&(Vt=4294967295+Vt+1),this[Wt]=Vt>>>24,this[Wt+1]=Vt>>>16,this[Wt+2]=Vt>>>8,this[Wt+3]=Vt&255,Wt+4},ot.prototype.writeBigInt64LE=Yt(function(Vt,Wt=0){return nr(this,Vt,Wt,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),ot.prototype.writeBigInt64BE=Yt(function(Vt,Wt=0){return Zt(this,Vt,Wt,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Kt(Gt,Vt,Wt,ar,yr,Er){if(Wt+ar>Gt.length)throw new RangeError("Index out of range");if(Wt<0)throw new RangeError("Index out of range")}function Qt(Gt,Vt,Wt,ar,yr){return Vt=+Vt,Wt=Wt>>>0,yr||Kt(Gt,Vt,Wt,4),$.write(Gt,Vt,Wt,ar,23,4),Wt+4}ot.prototype.writeFloatLE=function(Vt,Wt,ar){return Qt(this,Vt,Wt,!0,ar)},ot.prototype.writeFloatBE=function(Vt,Wt,ar){return Qt(this,Vt,Wt,!1,ar)};function Ht(Gt,Vt,Wt,ar,yr){return Vt=+Vt,Wt=Wt>>>0,yr||Kt(Gt,Vt,Wt,8),$.write(Gt,Vt,Wt,ar,52,8),Wt+8}ot.prototype.writeDoubleLE=function(Vt,Wt,ar){return Ht(this,Vt,Wt,!0,ar)},ot.prototype.writeDoubleBE=function(Vt,Wt,ar){return Ht(this,Vt,Wt,!1,ar)},ot.prototype.copy=function(Vt,Wt,ar,yr){if(!ot.isBuffer(Vt))throw new TypeError("argument should be a Buffer");if(ar||(ar=0),!yr&&yr!==0&&(yr=this.length),Wt>=Vt.length&&(Wt=Vt.length),Wt||(Wt=0),yr>0&&yr=this.length)throw new RangeError("Index out of range");if(yr<0)throw new RangeError("sourceEnd out of bounds");yr>this.length&&(yr=this.length),Vt.length-Wt>>0,ar=ar===void 0?this.length:ar>>>0,Vt||(Vt=0);let Er;if(typeof Vt=="number")for(Er=Wt;Er2**32?yr=ur(String(Wt)):typeof Wt=="bigint"&&(yr=String(Wt),(Wt>BigInt(2)**BigInt(32)||Wt<-(BigInt(2)**BigInt(32)))&&(yr=ur(yr)),yr+="n"),ar+=` It must be ${Vt}. Received ${yr}`,ar},RangeError);function ur(Gt){let Vt="",Wt=Gt.length;const ar=Gt[0]==="-"?1:0;for(;Wt>=ar+4;Wt-=3)Vt=`_${Gt.slice(Wt-3,Wt)}${Vt}`;return`${Gt.slice(0,Wt)}${Vt}`}function xr(Gt,Vt,Wt){Cr(Vt,"offset"),(Gt[Vt]===void 0||Gt[Vt+Wt]===void 0)&&Mr(Vt,Gt.length-(Wt+1))}function pr(Gt,Vt,Wt,ar,yr,Er){if(Gt>Wt||Gt= 0${Rr} and < 2${Rr} ** ${(Er+1)*8}${Rr}`:Wr=`>= -(2${Rr} ** ${(Er+1)*8-1}${Rr}) and < 2 ** ${(Er+1)*8-1}${Rr}`,new qt.ERR_OUT_OF_RANGE("value",Wr,Gt)}xr(ar,yr,Er)}function Cr(Gt,Vt){if(typeof Gt!="number")throw new qt.ERR_INVALID_ARG_TYPE(Vt,"number",Gt)}function Mr(Gt,Vt,Wt){throw Math.floor(Gt)!==Gt?(Cr(Gt,Wt),new qt.ERR_OUT_OF_RANGE("offset","an integer",Gt)):Vt<0?new qt.ERR_BUFFER_OUT_OF_BOUNDS:new qt.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${Vt}`,Gt)}const lr=/[^+/0-9A-Za-z-_]/g;function fr(Gt){if(Gt=Gt.split("=")[0],Gt=Gt.trim().replace(lr,""),Gt.length<2)return"";for(;Gt.length%4!==0;)Gt=Gt+"=";return Gt}function _r(Gt,Vt){Vt=Vt||1/0;let Wt;const ar=Gt.length;let yr=null;const Er=[];for(let Rr=0;Rr55295&&Wt<57344){if(!yr){if(Wt>56319){(Vt-=3)>-1&&Er.push(239,191,189);continue}else if(Rr+1===ar){(Vt-=3)>-1&&Er.push(239,191,189);continue}yr=Wt;continue}if(Wt<56320){(Vt-=3)>-1&&Er.push(239,191,189),yr=Wt;continue}Wt=(yr-55296<<10|Wt-56320)+65536}else yr&&(Vt-=3)>-1&&Er.push(239,191,189);if(yr=null,Wt<128){if((Vt-=1)<0)break;Er.push(Wt)}else if(Wt<2048){if((Vt-=2)<0)break;Er.push(Wt>>6|192,Wt&63|128)}else if(Wt<65536){if((Vt-=3)<0)break;Er.push(Wt>>12|224,Wt>>6&63|128,Wt&63|128)}else if(Wt<1114112){if((Vt-=4)<0)break;Er.push(Wt>>18|240,Wt>>12&63|128,Wt>>6&63|128,Wt&63|128)}else throw new Error("Invalid code point")}return Er}function Sr(Gt){const Vt=[];for(let Wt=0;Wt>8,yr=Wt%256,Er.push(yr),Er.push(ar);return Er}function Ar(Gt){return _.toByteArray(fr(Gt))}function $r(Gt,Vt,Wt,ar){let yr;for(yr=0;yr=Vt.length||yr>=Gt.length);++yr)Vt[yr+Wt]=Gt[yr];return yr}function Or(Gt,Vt){return Gt instanceof Vt||Gt!=null&&Gt.constructor!=null&&Gt.constructor.name!=null&&Gt.constructor.name===Vt.name}function Lr(Gt){return Gt!==Gt}const or=function(){const Gt="0123456789abcdef",Vt=new Array(256);for(let Wt=0;Wt<16;++Wt){const ar=Wt*16;for(let yr=0;yr<16;++yr)Vt[ar+yr]=Gt[Wt]+Gt[yr]}return Vt}();function Yt(Gt){return typeof BigInt>"u"?er:Gt}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(_,$){$&&(_.super_=$,_.prototype=Object.create($.prototype,{constructor:{value:_,enumerable:!1,writable:!0,configurable:!0}}))}:inherits_browser.exports=function(_,$){if($){_.super_=$;var j=function(){};j.prototype=$.prototype,_.prototype=new j,_.prototype.constructor=_}};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 $=a.indexOf("=");$===-1&&($=_);var j=$===_?0:4-$%4;return[$,j]}function byteLength$1(a){var _=getLens(a),$=_[0],j=_[1];return($+j)*3/4-j}function _byteLength(a,_,$){return(_+$)*3/4-$}function toByteArray(a){var _,$=getLens(a),j=$[0],et=$[1],tt=new Arr(_byteLength(a,j,et)),rt=0,nt=et>0?j-4:j,it;for(it=0;it>16&255,tt[rt++]=_>>8&255,tt[rt++]=_&255;return et===2&&(_=revLookup[a.charCodeAt(it)]<<2|revLookup[a.charCodeAt(it+1)]>>4,tt[rt++]=_&255),et===1&&(_=revLookup[a.charCodeAt(it)]<<10|revLookup[a.charCodeAt(it+1)]<<4|revLookup[a.charCodeAt(it+2)]>>2,tt[rt++]=_>>8&255,tt[rt++]=_&255),tt}function tripletToBase64(a){return lookup$2[a>>18&63]+lookup$2[a>>12&63]+lookup$2[a>>6&63]+lookup$2[a&63]}function encodeChunk(a,_,$){for(var j,et=[],tt=_;tt<$;tt+=3)j=(a[tt]<<16&16711680)+(a[tt+1]<<8&65280)+(a[tt+2]&255),et.push(tripletToBase64(j));return et.join("")}function fromByteArray(a){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[_>>2]+lookup$2[_<<4&63]+"==")):j===2&&(_=(a[$-2]<<8)+a[$-1],et.push(lookup$2[_>>10]+lookup$2[_>>4&63]+lookup$2[_<<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,ot=-7,at=$?et-1:0,ut=$?-1:1,ht=a[_+at];for(at+=ut,tt=ht&(1<<-ot)-1,ht>>=-ot,ot+=nt;ot>0;tt=tt*256+a[_+at],at+=ut,ot-=8);for(rt=tt&(1<<-ot)-1,tt>>=-ot,ot+=j;ot>0;rt=rt*256+a[_+at],at+=ut,ot-=8);if(tt===0)tt=1-st;else{if(tt===it)return rt?NaN:(ht?-1:1)*(1/0);rt=rt+Math.pow(2,j),tt=tt-st}return(ht?-1:1)*rt*Math.pow(2,tt-j)};ieee754.write=function(a,_,$,j,et,tt){var rt,nt,it,st=tt*8-et-1,ot=(1<>1,ut=et===23?Math.pow(2,-24)-Math.pow(2,-77):0,ht=j?0:tt-1,yt=j?1:-1,wt=_<0||_===0&&1/_<0?1:0;for(_=Math.abs(_),isNaN(_)||_===1/0?(nt=isNaN(_)?1:0,rt=ot):(rt=Math.floor(Math.log(_)/Math.LN2),_*(it=Math.pow(2,-rt))<1&&(rt--,it*=2),rt+at>=1?_+=ut/it:_+=ut*Math.pow(2,1-at),_*it>=2&&(rt++,it/=2),rt+at>=ot?(nt=0,rt=ot):rt+at>=1?(nt=(_*it-1)*Math.pow(2,et),rt=rt+at):(nt=_*Math.pow(2,at-1)*Math.pow(2,et),rt=0));et>=8;a[$+ht]=nt&255,ht+=yt,nt/=256,et-=8);for(rt=rt<0;a[$+ht]=rt&255,ht+=yt,rt/=256,st-=8);a[$+ht-yt]|=wt*128};/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */(function(a){const _=base64Js,$=ieee754,j=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;a.Buffer=nt,a.SlowBuffer=$t,a.INSPECT_MAX_BYTES=50;const et=2147483647;a.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 yt(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(kr(or,ArrayBuffer)||or&&kr(or.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(kr(or,SharedArrayBuffer)||or&&kr(or.buffer,SharedArrayBuffer)))return wt(or,Yt,er);if(typeof or=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const Gt=or.valueOf&&or.valueOf();if(Gt!=null&&Gt!==or)return nt.from(Gt,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 st(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 ot(or,Yt,er){return st(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 ot(or,Yt,er)};function at(or){return st(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=Mt(or,Yt)|0;let Gt=rt(er);const Vt=Gt.write(or,Yt);return Vt!==er&&(Gt=Gt.slice(0,Vt)),Gt}function ht(or){const Yt=or.length<0?0:Pt(or.length)|0,er=rt(Yt);for(let Gt=0;Gt=et)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+et.toString(16)+" bytes");return or|0}function $t(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(kr(Yt,Uint8Array)&&(Yt=nt.from(Yt,Yt.offset,Yt.byteLength)),kr(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 Gt=Yt.length,Vt=er.length;for(let Wt=0,ar=Math.min(Gt,Vt);WtVt.length?(nt.isBuffer(ar)||(ar=nt.from(ar)),ar.copy(Vt,Wt)):Uint8Array.prototype.set.call(Vt,ar,Wt);else if(nt.isBuffer(ar))ar.copy(Vt,Wt);else throw new TypeError('"list" argument must be an Array of Buffers');Wt+=ar.length}return Vt};function Mt(or,Yt){if(nt.isBuffer(or))return or.length;if(ArrayBuffer.isView(or)||kr(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,Gt=arguments.length>2&&arguments[2]===!0;if(!Gt&&er===0)return 0;let Vt=!1;for(;;)switch(Yt){case"ascii":case"latin1":case"binary":return er;case"utf8":case"utf-8":return Mr(or).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return er*2;case"hex":return er>>>1;case"base64":return _r(or).length;default:if(Vt)return Gt?-1:Mr(or).length;Yt=(""+Yt).toLowerCase(),Vt=!0}}nt.byteLength=Mt;function Lt(or,Yt,er){let Gt=!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 Rt(this,Yt,er);case"utf8":case"utf-8":return ct(this,Yt,er);case"ascii":return xt(this,Yt,er);case"latin1":case"binary":return At(this,Yt,er);case"base64":return vt(this,Yt,er);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return St(this,Yt,er);default:if(Gt)throw new TypeError("Unknown encoding: "+or);or=(or+"").toLowerCase(),Gt=!0}}nt.prototype._isBuffer=!0;function Dt(or,Yt,er){const Gt=or[Yt];or[Yt]=or[er],or[er]=Gt}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,Gt,Vt,Wt){if(kr(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),Gt===void 0&&(Gt=Yt?Yt.length:0),Vt===void 0&&(Vt=0),Wt===void 0&&(Wt=this.length),er<0||Gt>Yt.length||Vt<0||Wt>this.length)throw new RangeError("out of range index");if(Vt>=Wt&&er>=Gt)return 0;if(Vt>=Wt)return-1;if(er>=Gt)return 1;if(er>>>=0,Gt>>>=0,Vt>>>=0,Wt>>>=0,this===Yt)return 0;let ar=Wt-Vt,yr=Gt-er;const Er=Math.min(ar,yr),Rr=this.slice(Vt,Wt),Wr=Yt.slice(er,Gt);for(let Hr=0;Hr2147483647?er=2147483647:er<-2147483648&&(er=-2147483648),er=+er,Ar(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,Gt)),nt.isBuffer(Yt))return Yt.length===0?-1:Ot(or,Yt,er,Gt,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):Ot(or,[Yt],er,Gt,Vt);throw new TypeError("val must be string, number or Buffer")}function Ot(or,Yt,er,Gt,Vt){let Wt=1,ar=or.length,yr=Yt.length;if(Gt!==void 0&&(Gt=String(Gt).toLowerCase(),Gt==="ucs2"||Gt==="ucs-2"||Gt==="utf16le"||Gt==="utf-16le")){if(or.length<2||Yt.length<2)return-1;Wt=2,ar/=2,yr/=2,er/=2}function Er(Wr,Hr){return Wt===1?Wr[Hr]:Wr.readUInt16BE(Hr*Wt)}let Rr;if(Vt){let Wr=-1;for(Rr=er;Rrar&&(er=ar-yr),Rr=er;Rr>=0;Rr--){let Wr=!0;for(let Hr=0;HrVt&&(Gt=Vt)):Gt=Vt;const Wt=Yt.length;Gt>Wt/2&&(Gt=Wt/2);let ar;for(ar=0;ar>>0,isFinite(Gt)?(Gt=Gt>>>0,Vt===void 0&&(Vt="utf8")):(Vt=Gt,Gt=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const Wt=this.length-er;if((Gt===void 0||Gt>Wt)&&(Gt=Wt),Yt.length>0&&(Gt<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 It(this,Yt,er,Gt);case"utf8":case"utf-8":return Bt(this,Yt,er,Gt);case"ascii":case"latin1":case"binary":return Ft(this,Yt,er,Gt);case"base64":return jt(this,Yt,er,Gt);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return bt(this,Yt,er,Gt);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 vt(or,Yt,er){return Yt===0&&er===or.length?_.fromByteArray(or):_.fromByteArray(or.slice(Yt,er))}function ct(or,Yt,er){er=Math.min(or.length,er);const Gt=[];let Vt=Yt;for(;Vt239?4:Wt>223?3:Wt>191?2:1;if(Vt+yr<=er){let Er,Rr,Wr,Hr;switch(yr){case 1:Wt<128&&(ar=Wt);break;case 2:Er=or[Vt+1],(Er&192)===128&&(Hr=(Wt&31)<<6|Er&63,Hr>127&&(ar=Hr));break;case 3:Er=or[Vt+1],Rr=or[Vt+2],(Er&192)===128&&(Rr&192)===128&&(Hr=(Wt&15)<<12|(Er&63)<<6|Rr&63,Hr>2047&&(Hr<55296||Hr>57343)&&(ar=Hr));break;case 4:Er=or[Vt+1],Rr=or[Vt+2],Wr=or[Vt+3],(Er&192)===128&&(Rr&192)===128&&(Wr&192)===128&&(Hr=(Wt&15)<<18|(Er&63)<<12|(Rr&63)<<6|Wr&63,Hr>65535&&Hr<1114112&&(ar=Hr))}}ar===null?(ar=65533,yr=1):ar>65535&&(ar-=65536,Gt.push(ar>>>10&1023|55296),ar=56320|ar&1023),Gt.push(ar),Vt+=yr}return mt(Gt)}const dt=4096;function mt(or){const Yt=or.length;if(Yt<=dt)return String.fromCharCode.apply(String,or);let er="",Gt=0;for(;GtGt)&&(er=Gt);let Vt="";for(let Wt=Yt;WtGt&&(Yt=Gt),er<0?(er+=Gt,er<0&&(er=0)):er>Gt&&(er=Gt),erer)throw new RangeError("Trying to access beyond buffer length")}nt.prototype.readUintLE=nt.prototype.readUIntLE=function(Yt,er,Gt){Yt=Yt>>>0,er=er>>>0,Gt||Tt(Yt,er,this.length);let Vt=this[Yt],Wt=1,ar=0;for(;++ar>>0,er=er>>>0,Gt||Tt(Yt,er,this.length);let Vt=this[Yt+--er],Wt=1;for(;er>0&&(Wt*=256);)Vt+=this[Yt+--er]*Wt;return Vt},nt.prototype.readUint8=nt.prototype.readUInt8=function(Yt,er){return Yt=Yt>>>0,er||Tt(Yt,1,this.length),this[Yt]},nt.prototype.readUint16LE=nt.prototype.readUInt16LE=function(Yt,er){return Yt=Yt>>>0,er||Tt(Yt,2,this.length),this[Yt]|this[Yt+1]<<8},nt.prototype.readUint16BE=nt.prototype.readUInt16BE=function(Yt,er){return Yt=Yt>>>0,er||Tt(Yt,2,this.length),this[Yt]<<8|this[Yt+1]},nt.prototype.readUint32LE=nt.prototype.readUInt32LE=function(Yt,er){return Yt=Yt>>>0,er||Tt(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||Tt(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,ur(Yt,"offset");const er=this[Yt],Gt=this[Yt+7];(er===void 0||Gt===void 0)&&xr(Yt,this.length-8);const Vt=er+this[++Yt]*2**8+this[++Yt]*2**16+this[++Yt]*2**24,Wt=this[++Yt]+this[++Yt]*2**8+this[++Yt]*2**16+Gt*2**24;return BigInt(Vt)+(BigInt(Wt)<>>0,ur(Yt,"offset");const er=this[Yt],Gt=this[Yt+7];(er===void 0||Gt===void 0)&&xr(Yt,this.length-8);const Vt=er*2**24+this[++Yt]*2**16+this[++Yt]*2**8+this[++Yt],Wt=this[++Yt]*2**24+this[++Yt]*2**16+this[++Yt]*2**8+Gt;return(BigInt(Vt)<>>0,er=er>>>0,Gt||Tt(Yt,er,this.length);let Vt=this[Yt],Wt=1,ar=0;for(;++ar=Wt&&(Vt-=Math.pow(2,8*er)),Vt},nt.prototype.readIntBE=function(Yt,er,Gt){Yt=Yt>>>0,er=er>>>0,Gt||Tt(Yt,er,this.length);let Vt=er,Wt=1,ar=this[Yt+--Vt];for(;Vt>0&&(Wt*=256);)ar+=this[Yt+--Vt]*Wt;return Wt*=128,ar>=Wt&&(ar-=Math.pow(2,8*er)),ar},nt.prototype.readInt8=function(Yt,er){return Yt=Yt>>>0,er||Tt(Yt,1,this.length),this[Yt]&128?(255-this[Yt]+1)*-1:this[Yt]},nt.prototype.readInt16LE=function(Yt,er){Yt=Yt>>>0,er||Tt(Yt,2,this.length);const Gt=this[Yt]|this[Yt+1]<<8;return Gt&32768?Gt|4294901760:Gt},nt.prototype.readInt16BE=function(Yt,er){Yt=Yt>>>0,er||Tt(Yt,2,this.length);const Gt=this[Yt+1]|this[Yt]<<8;return Gt&32768?Gt|4294901760:Gt},nt.prototype.readInt32LE=function(Yt,er){return Yt=Yt>>>0,er||Tt(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||Tt(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,ur(Yt,"offset");const er=this[Yt],Gt=this[Yt+7];(er===void 0||Gt===void 0)&&xr(Yt,this.length-8);const Vt=this[Yt+4]+this[Yt+5]*2**8+this[Yt+6]*2**16+(Gt<<24);return(BigInt(Vt)<>>0,ur(Yt,"offset");const er=this[Yt],Gt=this[Yt+7];(er===void 0||Gt===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||Tt(Yt,4,this.length),$.read(this,Yt,!0,23,4)},nt.prototype.readFloatBE=function(Yt,er){return Yt=Yt>>>0,er||Tt(Yt,4,this.length),$.read(this,Yt,!1,23,4)},nt.prototype.readDoubleLE=function(Yt,er){return Yt=Yt>>>0,er||Tt(Yt,8,this.length),$.read(this,Yt,!0,52,8)},nt.prototype.readDoubleBE=function(Yt,er){return Yt=Yt>>>0,er||Tt(Yt,8,this.length),$.read(this,Yt,!1,52,8)};function Et(or,Yt,er,Gt,Vt,Wt){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,Gt,Vt){if(Yt=+Yt,er=er>>>0,Gt=Gt>>>0,!Vt){const yr=Math.pow(2,8*Gt)-1;Et(this,Yt,er,Gt,yr,0)}let Wt=1,ar=0;for(this[er]=Yt&255;++ar>>0,Gt=Gt>>>0,!Vt){const yr=Math.pow(2,8*Gt)-1;Et(this,Yt,er,Gt,yr,0)}let Wt=Gt-1,ar=1;for(this[er+Wt]=Yt&255;--Wt>=0&&(ar*=256);)this[er+Wt]=Yt/ar&255;return er+Gt},nt.prototype.writeUint8=nt.prototype.writeUInt8=function(Yt,er,Gt){return Yt=+Yt,er=er>>>0,Gt||Et(this,Yt,er,1,255,0),this[er]=Yt&255,er+1},nt.prototype.writeUint16LE=nt.prototype.writeUInt16LE=function(Yt,er,Gt){return Yt=+Yt,er=er>>>0,Gt||Et(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,Gt){return Yt=+Yt,er=er>>>0,Gt||Et(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,Gt){return Yt=+Yt,er=er>>>0,Gt||Et(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,Gt){return Yt=+Yt,er=er>>>0,Gt||Et(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 Nt(or,Yt,er,Gt,Vt){Jt(Yt,Gt,Vt,or,er,7);let Wt=Number(Yt&BigInt(4294967295));or[er++]=Wt,Wt=Wt>>8,or[er++]=Wt,Wt=Wt>>8,or[er++]=Wt,Wt=Wt>>8,or[er++]=Wt;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,Gt,Vt){Jt(Yt,Gt,Vt,or,er,7);let Wt=Number(Yt&BigInt(4294967295));or[er+7]=Wt,Wt=Wt>>8,or[er+6]=Wt,Wt=Wt>>8,or[er+5]=Wt,Wt=Wt>>8,or[er+4]=Wt;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 Nt(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,Gt,Vt){if(Yt=+Yt,er=er>>>0,!Vt){const Er=Math.pow(2,8*Gt-1);Et(this,Yt,er,Gt,Er-1,-Er)}let Wt=0,ar=1,yr=0;for(this[er]=Yt&255;++Wt>0)-yr&255;return er+Gt},nt.prototype.writeIntBE=function(Yt,er,Gt,Vt){if(Yt=+Yt,er=er>>>0,!Vt){const Er=Math.pow(2,8*Gt-1);Et(this,Yt,er,Gt,Er-1,-Er)}let Wt=Gt-1,ar=1,yr=0;for(this[er+Wt]=Yt&255;--Wt>=0&&(ar*=256);)Yt<0&&yr===0&&this[er+Wt+1]!==0&&(yr=1),this[er+Wt]=(Yt/ar>>0)-yr&255;return er+Gt},nt.prototype.writeInt8=function(Yt,er,Gt){return Yt=+Yt,er=er>>>0,Gt||Et(this,Yt,er,1,127,-128),Yt<0&&(Yt=255+Yt+1),this[er]=Yt&255,er+1},nt.prototype.writeInt16LE=function(Yt,er,Gt){return Yt=+Yt,er=er>>>0,Gt||Et(this,Yt,er,2,32767,-32768),this[er]=Yt&255,this[er+1]=Yt>>>8,er+2},nt.prototype.writeInt16BE=function(Yt,er,Gt){return Yt=+Yt,er=er>>>0,Gt||Et(this,Yt,er,2,32767,-32768),this[er]=Yt>>>8,this[er+1]=Yt&255,er+2},nt.prototype.writeInt32LE=function(Yt,er,Gt){return Yt=+Yt,er=er>>>0,Gt||Et(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,Gt){return Yt=+Yt,er=er>>>0,Gt||Et(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 Nt(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 ir(or,Yt,er,Gt,Vt,Wt){if(er+Gt>or.length)throw new RangeError("Index out of range");if(er<0)throw new RangeError("Index out of range")}function nr(or,Yt,er,Gt,Vt){return Yt=+Yt,er=er>>>0,Vt||ir(or,Yt,er,4),$.write(or,Yt,er,Gt,23,4),er+4}nt.prototype.writeFloatLE=function(Yt,er,Gt){return nr(this,Yt,er,!0,Gt)},nt.prototype.writeFloatBE=function(Yt,er,Gt){return nr(this,Yt,er,!1,Gt)};function Zt(or,Yt,er,Gt,Vt){return Yt=+Yt,er=er>>>0,Vt||ir(or,Yt,er,8),$.write(or,Yt,er,Gt,52,8),er+8}nt.prototype.writeDoubleLE=function(Yt,er,Gt){return Zt(this,Yt,er,!0,Gt)},nt.prototype.writeDoubleBE=function(Yt,er,Gt){return Zt(this,Yt,er,!1,Gt)},nt.prototype.copy=function(Yt,er,Gt,Vt){if(!nt.isBuffer(Yt))throw new TypeError("argument should be a Buffer");if(Gt||(Gt=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,Gt=Gt===void 0?this.length:Gt>>>0,Yt||(Yt=0);let Wt;if(typeof Yt=="number")for(Wt=er;Wt2**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"),Gt+=` It must be ${Yt}. Received ${Vt}`,Gt},RangeError);function Ht(or){let Yt="",er=or.length;const Gt=or[0]==="-"?1:0;for(;er>=Gt+4;er-=3)Yt=`_${or.slice(er-3,er)}${Yt}`;return`${or.slice(0,er)}${Yt}`}function qt(or,Yt,er){ur(Yt,"offset"),(or[Yt]===void 0||or[Yt+er]===void 0)&&xr(Yt,or.length-(er+1))}function Jt(or,Yt,er,Gt,Vt,Wt){if(or>er||or= 0${ar} and < 2${ar} ** ${(Wt+1)*8}${ar}`:yr=`>= -(2${ar} ** ${(Wt+1)*8-1}${ar}) and < 2 ** ${(Wt+1)*8-1}${ar}`,new Kt.ERR_OUT_OF_RANGE("value",yr,or)}qt(Gt,Vt,Wt)}function ur(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?(ur(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 Cr(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 Mr(or,Yt){Yt=Yt||1/0;let er;const Gt=or.length;let Vt=null;const Wt=[];for(let ar=0;ar55295&&er<57344){if(!Vt){if(er>56319){(Yt-=3)>-1&&Wt.push(239,191,189);continue}else if(ar+1===Gt){(Yt-=3)>-1&&Wt.push(239,191,189);continue}Vt=er;continue}if(er<56320){(Yt-=3)>-1&&Wt.push(239,191,189),Vt=er;continue}er=(Vt-55296<<10|er-56320)+65536}else Vt&&(Yt-=3)>-1&&Wt.push(239,191,189);if(Vt=null,er<128){if((Yt-=1)<0)break;Wt.push(er)}else if(er<2048){if((Yt-=2)<0)break;Wt.push(er>>6|192,er&63|128)}else if(er<65536){if((Yt-=3)<0)break;Wt.push(er>>12|224,er>>6&63|128,er&63|128)}else if(er<1114112){if((Yt-=4)<0)break;Wt.push(er>>18|240,er>>12&63|128,er>>6&63|128,er&63|128)}else throw new Error("Invalid code point")}return Wt}function lr(or){const Yt=[];for(let er=0;er>8,Vt=er%256,Wt.push(Vt),Wt.push(Gt);return Wt}function _r(or){return _.toByteArray(Cr(or))}function Sr(or,Yt,er,Gt){let Vt;for(Vt=0;Vt=Yt.length||Vt>=or.length);++Vt)Yt[Vt+er]=or[Vt];return Vt}function kr(or,Yt){return or instanceof Yt||or!=null&&or.constructor!=null&&or.constructor.name!=null&&or.constructor.name===Yt.name}function Ar(or){return or!==or}const $r=function(){const or="0123456789abcdef",Yt=new Array(256);for(let er=0;er<16;++er){const Gt=er*16;for(let Vt=0;Vt<16;++Vt)Yt[Gt+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?a.exports=$:(et($,_),_.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 st=j(rt);return nt!==void 0?typeof it=="string"?st.fill(nt,it):st.fill(nt):st.fill(0),st},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(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}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(a){if(cachedSetTimeout===setTimeout)return setTimeout(a,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(a,0);try{return cachedSetTimeout(a,0)}catch{try{return cachedSetTimeout.call(null,a,0)}catch{return cachedSetTimeout.call(this,a,0)}}}function runClearTimeout(a){if(cachedClearTimeout===clearTimeout)return clearTimeout(a);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(a);try{return cachedClearTimeout(a)}catch{try{return cachedClearTimeout.call(null,a)}catch{return cachedClearTimeout.call(this,a)}}}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 a=runTimeout(cleanUpNextTick);draining=!0;for(var _=queue.length;_;){for(currentQueue=queue,queue=[];++queueIndex<_;)currentQueue&¤tQueue[queueIndex].run();queueIndex=-1,_=queue.length}currentQueue=null,draining=!1,runClearTimeout(a)}}process$1.nextTick=function(a){var _=new Array(arguments.length-1);if(arguments.length>1)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[_];if(it===void 0)return!1;if(typeof it=="function")ReflectApply(it,this,$);else for(var st=it.length,ot=arrayClone(it,st),j=0;j0&&rt.length>et&&!rt.warned){rt.warned=!0;var nt=new Error("Possible EventEmitter memory leak detected. "+rt.length+" "+String(_)+" listeners added. Use emitter.setMaxListeners() to increase limit");nt.name="MaxListenersExceededWarning",nt.emitter=a,nt.type=_,nt.count=rt.length,ProcessEmitWarning(nt)}return a}EventEmitter$1.prototype.addListener=function(_,$){return _addListener(this,_,$,!1)};EventEmitter$1.prototype.on=EventEmitter$1.prototype.addListener;EventEmitter$1.prototype.prependListener=function(_,$){return _addListener(this,_,$,!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:a,type:_,listener:$},et=onceWrapper.bind(j);return et.listener=$,j.wrapFn=et,et}EventEmitter$1.prototype.once=function(_,$){return checkListener($),this.on(_,_onceWrap(this,_,$)),this};EventEmitter$1.prototype.prependOnceListener=function(_,$){return checkListener($),this.prependListener(_,_onceWrap(this,_,$)),this};EventEmitter$1.prototype.removeListener=function(_,$){var j,et,tt,rt,nt;if(checkListener($),et=this._events,et===void 0)return this;if(j=et[_],j===void 0)return this;if(j===$||j.listener===$)--this._eventsCount===0?this._events=Object.create(null):(delete et[_],et.removeListener&&this.emit("removeListener",_,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[_]=j[0]),et.removeListener!==void 0&&this.emit("removeListener",_,nt||$)}return this};EventEmitter$1.prototype.off=EventEmitter$1.prototype.removeListener;EventEmitter$1.prototype.removeAllListeners=function(_){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[_]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete j[_]),this;if(arguments.length===0){var tt=Object.keys(j),rt;for(et=0;et=0;et--)this.removeListener(_,$[et]);return this};function _listeners(a,_,$){var j=a._events;if(j===void 0)return[];var et=j[_];return et===void 0?[]:typeof et=="function"?$?[et.listener||et]:[et]:$?unwrapListeners(et):arrayClone(et,et.length)}EventEmitter$1.prototype.listeners=function(_){return _listeners(this,_,!0)};EventEmitter$1.prototype.rawListeners=function(_){return _listeners(this,_,!1)};EventEmitter$1.listenerCount=function(a,_){return typeof a.listenerCount=="function"?a.listenerCount(_):listenerCount.call(a,_)};EventEmitter$1.prototype.listenerCount=listenerCount;function listenerCount(a){var _=this._events;if(_!==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(_),j=0;j<_;++j)$[j]=a[j];return $}function spliceOne(a,_){for(;_+1"u"||!getProto$2?undefined$2:getProto$2(Uint8Array),INTRINSICS$1={"%AggregateError%":typeof AggregateError>"u"?undefined$2:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?undefined$2:ArrayBuffer,"%ArrayIteratorPrototype%":hasSymbols$1&&getProto$2?getProto$2([][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$2?getProto$2(getProto$2([][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$2?undefined$2:getProto$2(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$2?undefined$2:getProto$2(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?undefined$2:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":hasSymbols$1&&getProto$2?getProto$2(""[Symbol.iterator]()):undefined$2,"%Symbol%":hasSymbols$1?Symbol:undefined$2,"%SyntaxError%":$SyntaxError$1,"%ThrowTypeError%":ThrowTypeError$1,"%TypedArray%":TypedArray$1,"%TypeError%":$TypeError$1,"%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$2)try{null.error}catch(a){var errorProto$1=getProto$2(getProto$2(a));INTRINSICS$1["%Error.prototype%"]=errorProto$1}var doEval$1=function a(_){var $;if(_==="%AsyncFunction%")$=getEvalledConstructor$1("async function () {}");else if(_==="%GeneratorFunction%")$=getEvalledConstructor$1("function* () {}");else if(_==="%AsyncGeneratorFunction%")$=getEvalledConstructor$1("async function* () {}");else if(_==="%AsyncGenerator%"){var j=a("%AsyncGeneratorFunction%");j&&($=j.prototype)}else if(_==="%AsyncIteratorPrototype%"){var et=a("%AsyncGenerator%");et&&getProto$2&&($=getProto$2(et.prototype))}return INTRINSICS$1[_]=$,$},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$4=functionBind$2,hasOwn$2=src$3,$concat$1=bind$4.call(Function.call,Array.prototype.concat),$spliceApply$1=bind$4.call(Function.apply,Array.prototype.splice),$replace$1=bind$4.call(Function.call,String.prototype.replace),$strSlice$1=bind$4.call(Function.call,String.prototype.slice),$exec$1=bind$4.call(Function.call,RegExp.prototype.exec),rePropName$1=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,reEscapeChar$1=/\\(\\)?/g,stringToPath$1=function(_){var $=$strSlice$1(_,0,1),j=$strSlice$1(_,-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$1(_,rePropName$1,function(tt,rt,nt,it){et[et.length]=nt?$replace$1(it,reEscapeChar$1,"$1"):rt||tt}),et},getBaseIntrinsic$1=function(_,$){var j=_,et;if(hasOwn$2(LEGACY_ALIASES$1,j)&&(et=LEGACY_ALIASES$1[j],j="%"+et[0]+"%"),hasOwn$2(INTRINSICS$1,j)){var tt=INTRINSICS$1[j];if(tt===needsEval$1&&(tt=doEval$1(j)),typeof tt>"u"&&!$)throw new $TypeError$1("intrinsic "+_+" exists, but is not available. Please file an issue!");return{alias:et,name:j,value:tt}}throw new $SyntaxError$1("intrinsic "+_+" does not exist!")},getIntrinsic$1=function(_,$){if(typeof _!="string"||_.length===0)throw new $TypeError$1("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof $!="boolean")throw new $TypeError$1('"allowMissing" argument must be a boolean');if($exec$1(/^%?[^%]*%?$/,_)===null)throw new $SyntaxError$1("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var j=stringToPath$1(_),et=j.length>0?j[0]:"",tt=getBaseIntrinsic$1("%"+et+"%",$),rt=tt.name,nt=tt.value,it=!1,st=tt.alias;st&&(et=st[0],$spliceApply$1(j,$concat$1([0,1],st)));for(var ot=1,at=!0;ot=j.length){var wt=$gOPD$2(nt,ut);at=!!wt,at&&"get"in wt&&!("originalValue"in wt.get)?nt=wt.get:nt=nt[ut]}else at=hasOwn$2(nt,ut),nt=nt[ut];at&&!it&&(INTRINSICS$1[rt]=nt)}}return nt},callBind$1={exports:{}};(function(a){var _=functionBind$2,$=getIntrinsic$1,j=$("%Function.prototype.apply%"),et=$("%Function.prototype.call%"),tt=$("%Reflect.apply%",!0)||_.call(et,j),rt=$("%Object.getOwnPropertyDescriptor%",!0),nt=$("%Object.defineProperty%",!0),it=$("%Math.max%");if(nt)try{nt({},"a",{value:1})}catch{nt=null}a.exports=function(at){var ut=tt(_,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 st=function(){return tt(_,j,arguments)};nt?nt(a.exports,"apply",{value:st}):a.exports.apply=st})(callBind$1);var callBindExports=callBind$1.exports,GetIntrinsic$1=getIntrinsic$1,callBind=callBindExports,$indexOf$1=callBind(GetIntrinsic$1("String.prototype.indexOf")),callBound$3=function(_,$){var j=GetIntrinsic$1(_,!!$);return typeof j=="function"&&$indexOf$1(_,".prototype.")>-1?callBind(j):j},hasToStringTag$4=shams(),callBound$2=callBound$3,$toString$2=callBound$2("Object.prototype.toString"),isStandardArguments=function(_){return hasToStringTag$4&&_&&typeof _=="object"&&Symbol.toStringTag in _?!1:$toString$2(_)==="[object Arguments]"},isLegacyArguments=function(_){return isStandardArguments(_)?!0:_!==null&&typeof _=="object"&&typeof _.length=="number"&&_.length>=0&&$toString$2(_)!=="[object Array]"&&$toString$2(_.callee)==="[object Function]"},supportsStandardArguments=function(){return isStandardArguments(arguments)}();isStandardArguments.isLegacyArguments=isLegacyArguments;var isArguments=supportsStandardArguments?isStandardArguments:isLegacyArguments,toStr$3=Object.prototype.toString,fnToStr$1=Function.prototype.toString,isFnRegex=/^\s*(?:function)?\*/,hasToStringTag$3=shams(),getProto$1=Object.getPrototypeOf,getGeneratorFunc=function(){if(!hasToStringTag$3)return!1;try{return Function("return function*() {}")()}catch{}},GeneratorFunction,isGeneratorFunction=function(_){if(typeof _!="function")return!1;if(isFnRegex.test(fnToStr$1.call(_)))return!0;if(!hasToStringTag$3){var $=toStr$3.call(_);return $==="[object GeneratorFunction]"}if(!getProto$1)return!1;if(typeof GeneratorFunction>"u"){var j=getGeneratorFunc();GeneratorFunction=j?getProto$1(j):!1}return getProto$1(_)===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(a){a!==isCallableMarker&&(reflectApply=null)}else reflectApply=null;var constructorRegex=/^\s*class\b/,isES6ClassFn=function(_){try{var $=fnToStr.call(_);return constructorRegex.test($)}catch{return!1}},tryFunctionObject=function(_){try{return isES6ClassFn(_)?!1:(fnToStr.call(_),!0)}catch{return!1}},toStr$2=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$2.call(all)===toStr$2.call(document.all)&&(isDDA=function(_){if((isIE68||!_)&&(typeof _>"u"||typeof _=="object"))try{var $=toStr$2.call(_);return($===ddaClass||$===ddaClass2||$===ddaClass3||$===objectClass)&&_("")==null}catch{}return!1})}var isCallable$1=reflectApply?function(_){if(isDDA(_))return!0;if(!_||typeof _!="function"&&typeof _!="object")return!1;try{reflectApply(_,null,badArrayLike)}catch($){if($!==isCallableMarker)return!1}return!isES6ClassFn(_)&&tryFunctionObject(_)}:function(_){if(isDDA(_))return!0;if(!_||typeof _!="function"&&typeof _!="object")return!1;if(hasToStringTag$2)return tryFunctionObject(_);if(isES6ClassFn(_))return!1;var $=toStr$2.call(_);return $!==fnClass&&$!==genClass&&!/^\[object HTML/.test($)?!1:tryFunctionObject(_)},isCallable=isCallable$1,toStr$1=Object.prototype.toString,hasOwnProperty$2=Object.prototype.hasOwnProperty,forEachArray=function(_,$,j){for(var et=0,tt=_.length;et=3&&(et=j),toStr$1.call(_)==="[object Array]"?forEachArray(_,$,et):typeof _=="string"?forEachString(_,$,et):forEachObject(_,$,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 _=[],$=0;$"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,"%ThrowTypeError%":ThrowTypeError,"%TypedArray%":TypedArray,"%TypeError%":$TypeError,"%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(a){var errorProto=getProto(getProto(a));INTRINSICS["%Error.prototype%"]=errorProto}var doEval=function a(_){var $;if(_==="%AsyncFunction%")$=getEvalledConstructor("async function () {}");else if(_==="%GeneratorFunction%")$=getEvalledConstructor("function* () {}");else if(_==="%AsyncGeneratorFunction%")$=getEvalledConstructor("async function* () {}");else if(_==="%AsyncGenerator%"){var j=a("%AsyncGeneratorFunction%");j&&($=j.prototype)}else if(_==="%AsyncIteratorPrototype%"){var et=a("%AsyncGenerator%");et&&getProto&&($=getProto(et.prototype))}return INTRINSICS[_]=$,$},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$3=functionBind,hasOwn$1=src$3,$concat=bind$3.call(Function.call,Array.prototype.concat),$spliceApply=bind$3.call(Function.apply,Array.prototype.splice),$replace=bind$3.call(Function.call,String.prototype.replace),$strSlice=bind$3.call(Function.call,String.prototype.slice),$exec=bind$3.call(Function.call,RegExp.prototype.exec),rePropName=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=function(_){var $=$strSlice(_,0,1),j=$strSlice(_,-1);if($==="%"&&j!=="%")throw new $SyntaxError("invalid intrinsic syntax, expected closing `%`");if(j==="%"&&$!=="%")throw new $SyntaxError("invalid intrinsic syntax, expected opening `%`");var et=[];return $replace(_,rePropName,function(tt,rt,nt,it){et[et.length]=nt?$replace(it,reEscapeChar,"$1"):rt||tt}),et},getBaseIntrinsic=function(_,$){var j=_,et;if(hasOwn$1(LEGACY_ALIASES,j)&&(et=LEGACY_ALIASES[j],j="%"+et[0]+"%"),hasOwn$1(INTRINSICS,j)){var tt=INTRINSICS[j];if(tt===needsEval&&(tt=doEval(j)),typeof tt>"u"&&!$)throw new $TypeError("intrinsic "+_+" exists, but is not available. Please file an issue!");return{alias:et,name:j,value:tt}}throw new $SyntaxError("intrinsic "+_+" does not exist!")},getIntrinsic=function(_,$){if(typeof _!="string"||_.length===0)throw new $TypeError("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof $!="boolean")throw new $TypeError('"allowMissing" argument must be a boolean');if($exec(/^%?[^%]*%?$/,_)===null)throw new $SyntaxError("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var j=stringToPath(_),et=j.length>0?j[0]:"",tt=getBaseIntrinsic("%"+et+"%",$),rt=tt.name,nt=tt.value,it=!1,st=tt.alias;st&&(et=st[0],$spliceApply(j,$concat([0,1],st)));for(var ot=1,at=!0;ot=j.length){var wt=$gOPD$1(nt,ut);at=!!wt,at&&"get"in wt&&!("originalValue"in wt.get)?nt=wt.get:nt=nt[ut]}else at=hasOwn$1(nt,ut),nt=nt[ut];at&&!it&&(INTRINSICS[rt]=nt)}}return nt},GetIntrinsic=getIntrinsic,$gOPD=GetIntrinsic("%Object.getOwnPropertyDescriptor%",!0);if($gOPD)try{$gOPD([],"length")}catch{$gOPD=null}var gopd=$gOPD,forEach$3=forEach_1,availableTypedArrays$1=availableTypedArrays$2,callBound$1=callBound$3,$toString$1=callBound$1("Object.prototype.toString"),hasToStringTag$1=shams(),gOPD$1=gopd,g$2=typeof globalThis>"u"?commonjsGlobal:globalThis,typedArrays$1=availableTypedArrays$1(),$indexOf=callBound$1("Array.prototype.indexOf",!0)||function(_,$){for(var j=0;j<_.length;j+=1)if(_[j]===$)return j;return-1},$slice$1=callBound$1("String.prototype.slice"),toStrTags$1={},getPrototypeOf$6=Object.getPrototypeOf;hasToStringTag$1&&gOPD$1&&getPrototypeOf$6&&forEach$3(typedArrays$1,function(a){var _=new g$2[a];if(Symbol.toStringTag in _){var $=getPrototypeOf$6(_),j=gOPD$1($,Symbol.toStringTag);if(!j){var et=getPrototypeOf$6($);j=gOPD$1(et,Symbol.toStringTag)}toStrTags$1[a]=j.get}});var tryTypedArrays$1=function(_){var $=!1;return forEach$3(toStrTags$1,function(j,et){if(!$)try{$=j.call(_)===et}catch{}}),$},isTypedArray$3=function(_){if(!_||typeof _!="object")return!1;if(!hasToStringTag$1||!(Symbol.toStringTag in _)){var $=$slice$1($toString$1(_),8,-1);return $indexOf(typedArrays$1,$)>-1}return gOPD$1?tryTypedArrays$1(_):!1},forEach$2=forEach_1,availableTypedArrays=availableTypedArrays$2,callBound=callBound$3,gOPD=gopd,$toString=callBound("Object.prototype.toString"),hasToStringTag=shams(),g$1=typeof globalThis>"u"?commonjsGlobal:globalThis,typedArrays=availableTypedArrays(),$slice=callBound("String.prototype.slice"),toStrTags={},getPrototypeOf$5=Object.getPrototypeOf;hasToStringTag&&gOPD&&getPrototypeOf$5&&forEach$2(typedArrays,function(a){if(typeof g$1[a]=="function"){var _=new g$1[a];if(Symbol.toStringTag in _){var $=getPrototypeOf$5(_),j=gOPD($,Symbol.toStringTag);if(!j){var et=getPrototypeOf$5($);j=gOPD(et,Symbol.toStringTag)}toStrTags[a]=j.get}}});var tryTypedArrays=function(_){var $=!1;return forEach$2(toStrTags,function(j,et){if(!$)try{var tt=j.call(_);tt===et&&($=tt)}catch{}}),$},isTypedArray$2=isTypedArray$3,whichTypedArray=function(_){return isTypedArray$2(_)?!hasToStringTag||!(Symbol.toStringTag in _)?$slice($toString(_),8,-1):tryTypedArrays(_):!1};(function(a){var _=isArguments,$=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),st=tt(Number.prototype.valueOf),ot=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 yt(fr,_r){if(typeof fr!="object")return!1;try{return _r(fr),!0}catch{return!1}}a.isArgumentsObject=_,a.isGeneratorFunction=$,a.isTypedArray=et;function wt(fr){return typeof Promise<"u"&&fr instanceof Promise||fr!==null&&typeof fr=="object"&&typeof fr.then=="function"&&typeof fr.catch=="function"}a.isPromise=wt;function Ct(fr){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(fr):et(fr)||Nt(fr)}a.isArrayBufferView=Ct;function Pt(fr){return j(fr)==="Uint8Array"}a.isUint8Array=Pt;function $t(fr){return j(fr)==="Uint8ClampedArray"}a.isUint8ClampedArray=$t;function Mt(fr){return j(fr)==="Uint16Array"}a.isUint16Array=Mt;function Lt(fr){return j(fr)==="Uint32Array"}a.isUint32Array=Lt;function Dt(fr){return j(fr)==="Int8Array"}a.isInt8Array=Dt;function zt(fr){return j(fr)==="Int16Array"}a.isInt16Array=zt;function Ot(fr){return j(fr)==="Int32Array"}a.isInt32Array=Ot;function It(fr){return j(fr)==="Float32Array"}a.isFloat32Array=It;function Bt(fr){return j(fr)==="Float64Array"}a.isFloat64Array=Bt;function Ft(fr){return j(fr)==="BigInt64Array"}a.isBigInt64Array=Ft;function jt(fr){return j(fr)==="BigUint64Array"}a.isBigUint64Array=jt;function bt(fr){return it(fr)==="[object Map]"}bt.working=typeof Map<"u"&&bt(new Map);function vt(fr){return typeof Map>"u"?!1:bt.working?bt(fr):fr instanceof Map}a.isMap=vt;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}a.isSet=dt;function mt(fr){return it(fr)==="[object WeakMap]"}mt.working=typeof WeakMap<"u"&&mt(new WeakMap);function xt(fr){return typeof WeakMap>"u"?!1:mt.working?mt(fr):fr instanceof WeakMap}a.isWeakMap=xt;function At(fr){return it(fr)==="[object WeakSet]"}At.working=typeof WeakSet<"u"&&At(new WeakSet);function Rt(fr){return At(fr)}a.isWeakSet=Rt;function St(fr){return it(fr)==="[object ArrayBuffer]"}St.working=typeof ArrayBuffer<"u"&&St(new ArrayBuffer);function Tt(fr){return typeof ArrayBuffer>"u"?!1:St.working?St(fr):fr instanceof ArrayBuffer}a.isArrayBuffer=Tt;function Et(fr){return it(fr)==="[object DataView]"}Et.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&Et(new DataView(new ArrayBuffer(1),0,1));function Nt(fr){return typeof DataView>"u"?!1:Et.working?Et(fr):fr instanceof DataView}a.isDataView=Nt;var tr=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function ir(fr){return it(fr)==="[object SharedArrayBuffer]"}function nr(fr){return typeof tr>"u"?!1:(typeof ir.working>"u"&&(ir.working=ir(new tr)),ir.working?ir(fr):fr instanceof tr)}a.isSharedArrayBuffer=nr;function Zt(fr){return it(fr)==="[object AsyncFunction]"}a.isAsyncFunction=Zt;function Kt(fr){return it(fr)==="[object Map Iterator]"}a.isMapIterator=Kt;function Qt(fr){return it(fr)==="[object Set Iterator]"}a.isSetIterator=Qt;function Ht(fr){return it(fr)==="[object Generator]"}a.isGeneratorObject=Ht;function qt(fr){return it(fr)==="[object WebAssembly.Module]"}a.isWebAssemblyCompiledModule=qt;function Jt(fr){return yt(fr,st)}a.isNumberObject=Jt;function ur(fr){return yt(fr,ot)}a.isStringObject=ur;function xr(fr){return yt(fr,at)}a.isBooleanObject=xr;function pr(fr){return rt&&yt(fr,ut)}a.isBigIntObject=pr;function Cr(fr){return nt&&yt(fr,ht)}a.isSymbolObject=Cr;function Mr(fr){return Jt(fr)||ur(fr)||xr(fr)||pr(fr)||Cr(fr)}a.isBoxedPrimitive=Mr;function lr(fr){return typeof Uint8Array<"u"&&(Tt(fr)||nr(fr))}a.isAnyArrayBuffer=lr,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(fr){Object.defineProperty(a,fr,{enumerable:!1,value:function(){throw new Error(fr+" is not supported in userland")}})})})(types$1);var isBufferBrowser=function(_){return _&&typeof _=="object"&&typeof _.copy=="function"&&typeof _.fill=="function"&&typeof _.readUInt8=="function"};(function(a){var _={},$=Object.getOwnPropertyDescriptors||function(tr){for(var ir=Object.keys(tr),nr={},Zt=0;Zt=Zt)return Ht;switch(Ht){case"%s":return String(nr[ir++]);case"%d":return Number(nr[ir++]);case"%j":try{return JSON.stringify(nr[ir++])}catch{return"[Circular]"}default:return Ht}}),Qt=nr[ir];ir"u")return function(){return a.deprecate(Nt,tr).apply(this,arguments)};var ir=!1;function nr(){if(!ir){if(process$1$1.throwDeprecation)throw new Error(tr);process$1$1.traceDeprecation?console.trace(tr):console.error(tr),ir=!0}return Nt.apply(this,arguments)}return nr};var et={},tt=/^$/;if(_.NODE_DEBUG){var rt=_.NODE_DEBUG;rt=rt.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),tt=new RegExp("^"+rt+"$","i")}a.debuglog=function(Nt){if(Nt=Nt.toUpperCase(),!et[Nt])if(tt.test(Nt)){var tr=process$1$1.pid;et[Nt]=function(){var ir=a.format.apply(a,arguments);console.error("%s %d: %s",Nt,tr,ir)}}else et[Nt]=function(){};return et[Nt]};function nt(Nt,tr){var ir={seen:[],stylize:st};return arguments.length>=3&&(ir.depth=arguments[2]),arguments.length>=4&&(ir.colors=arguments[3]),$t(tr)?ir.showHidden=tr:tr&&a._extend(ir,tr),It(ir.showHidden)&&(ir.showHidden=!1),It(ir.depth)&&(ir.depth=2),It(ir.colors)&&(ir.colors=!1),It(ir.customInspect)&&(ir.customInspect=!0),ir.colors&&(ir.stylize=it),at(ir,Nt,ir.depth)}a.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(Nt,tr){var ir=nt.styles[tr];return ir?"\x1B["+nt.colors[ir][0]+"m"+Nt+"\x1B["+nt.colors[ir][1]+"m":Nt}function st(Nt,tr){return Nt}function ot(Nt){var tr={};return Nt.forEach(function(ir,nr){tr[ir]=!0}),tr}function at(Nt,tr,ir){if(Nt.customInspect&&tr&&vt(tr.inspect)&&tr.inspect!==a.inspect&&!(tr.constructor&&tr.constructor.prototype===tr)){var nr=tr.inspect(ir,Nt);return zt(nr)||(nr=at(Nt,nr,ir)),nr}var Zt=ut(Nt,tr);if(Zt)return Zt;var Kt=Object.keys(tr),Qt=ot(Kt);if(Nt.showHidden&&(Kt=Object.getOwnPropertyNames(tr)),bt(tr)&&(Kt.indexOf("message")>=0||Kt.indexOf("description")>=0))return ht(tr);if(Kt.length===0){if(vt(tr)){var Ht=tr.name?": "+tr.name:"";return Nt.stylize("[Function"+Ht+"]","special")}if(Bt(tr))return Nt.stylize(RegExp.prototype.toString.call(tr),"regexp");if(jt(tr))return Nt.stylize(Date.prototype.toString.call(tr),"date");if(bt(tr))return ht(tr)}var qt="",Jt=!1,ur=["{","}"];if(Pt(tr)&&(Jt=!0,ur=["[","]"]),vt(tr)){var xr=tr.name?": "+tr.name:"";qt=" [Function"+xr+"]"}if(Bt(tr)&&(qt=" "+RegExp.prototype.toString.call(tr)),jt(tr)&&(qt=" "+Date.prototype.toUTCString.call(tr)),bt(tr)&&(qt=" "+ht(tr)),Kt.length===0&&(!Jt||tr.length==0))return ur[0]+qt+ur[1];if(ir<0)return Bt(tr)?Nt.stylize(RegExp.prototype.toString.call(tr),"regexp"):Nt.stylize("[Object]","special");Nt.seen.push(tr);var pr;return Jt?pr=yt(Nt,tr,ir,Qt,Kt):pr=Kt.map(function(Cr){return wt(Nt,tr,ir,Qt,Cr,Jt)}),Nt.seen.pop(),Ct(pr,qt,ur)}function ut(Nt,tr){if(It(tr))return Nt.stylize("undefined","undefined");if(zt(tr)){var ir="'"+JSON.stringify(tr).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return Nt.stylize(ir,"string")}if(Dt(tr))return Nt.stylize(""+tr,"number");if($t(tr))return Nt.stylize(""+tr,"boolean");if(Mt(tr))return Nt.stylize("null","null")}function ht(Nt){return"["+Error.prototype.toString.call(Nt)+"]"}function yt(Nt,tr,ir,nr,Zt){for(var Kt=[],Qt=0,Ht=tr.length;Qt-1&&(Kt?Ht=Ht.split(` -`).map(function(Jt){return" "+Jt}).join(` -`).slice(2):Ht=` -`+Ht.split(` -`).map(function(Jt){return" "+Jt}).join(` -`))):Ht=Nt.stylize("[Circular]","special")),It(Qt)){if(Kt&&Zt.match(/^\d+$/))return Ht;Qt=JSON.stringify(""+Zt),Qt.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(Qt=Qt.slice(1,-1),Qt=Nt.stylize(Qt,"name")):(Qt=Qt.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),Qt=Nt.stylize(Qt,"string"))}return Qt+": "+Ht}function Ct(Nt,tr,ir){var nr=Nt.reduce(function(Zt,Kt){return Kt.indexOf(` -`)>=0,Zt+Kt.replace(/\u001b\[\d\d?m/g,"").length+1},0);return nr>60?ir[0]+(tr===""?"":tr+` - `)+" "+Nt.join(`, - `)+" "+ir[1]:ir[0]+tr+" "+Nt.join(", ")+" "+ir[1]}a.types=types$1;function Pt(Nt){return Array.isArray(Nt)}a.isArray=Pt;function $t(Nt){return typeof Nt=="boolean"}a.isBoolean=$t;function Mt(Nt){return Nt===null}a.isNull=Mt;function Lt(Nt){return Nt==null}a.isNullOrUndefined=Lt;function Dt(Nt){return typeof Nt=="number"}a.isNumber=Dt;function zt(Nt){return typeof Nt=="string"}a.isString=zt;function Ot(Nt){return typeof Nt=="symbol"}a.isSymbol=Ot;function It(Nt){return Nt===void 0}a.isUndefined=It;function Bt(Nt){return Ft(Nt)&&dt(Nt)==="[object RegExp]"}a.isRegExp=Bt,a.types.isRegExp=Bt;function Ft(Nt){return typeof Nt=="object"&&Nt!==null}a.isObject=Ft;function jt(Nt){return Ft(Nt)&&dt(Nt)==="[object Date]"}a.isDate=jt,a.types.isDate=jt;function bt(Nt){return Ft(Nt)&&(dt(Nt)==="[object Error]"||Nt instanceof Error)}a.isError=bt,a.types.isNativeError=bt;function vt(Nt){return typeof Nt=="function"}a.isFunction=vt;function ct(Nt){return Nt===null||typeof Nt=="boolean"||typeof Nt=="number"||typeof Nt=="string"||typeof Nt=="symbol"||typeof Nt>"u"}a.isPrimitive=ct,a.isBuffer=isBufferBrowser;function dt(Nt){return Object.prototype.toString.call(Nt)}function mt(Nt){return Nt<10?"0"+Nt.toString(10):Nt.toString(10)}var xt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function At(){var Nt=new Date,tr=[mt(Nt.getHours()),mt(Nt.getMinutes()),mt(Nt.getSeconds())].join(":");return[Nt.getDate(),xt[Nt.getMonth()],tr].join(" ")}a.log=function(){console.log("%s - %s",At(),a.format.apply(a,arguments))},a.inherits=inherits_browserExports,a._extend=function(Nt,tr){if(!tr||!Ft(tr))return Nt;for(var ir=Object.keys(tr),nr=ir.length;nr--;)Nt[ir[nr]]=tr[ir[nr]];return Nt};function Rt(Nt,tr){return Object.prototype.hasOwnProperty.call(Nt,tr)}var St=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;a.promisify=function(tr){if(typeof tr!="function")throw new TypeError('The "original" argument must be of type Function');if(St&&tr[St]){var ir=tr[St];if(typeof ir!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(ir,St,{value:ir,enumerable:!1,writable:!1,configurable:!0}),ir}function ir(){for(var nr,Zt,Kt=new Promise(function(qt,Jt){nr=qt,Zt=Jt}),Qt=[],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,$t=""+Pt.data;Pt=Pt.next;)$t+=Ct+Pt.data;return $t}},{key:"concat",value:function(Ct){if(this.length===0)return st.alloc(0);for(var Pt=st.allocUnsafe(Ct>>>0),$t=this.head,Mt=0;$t;)ht($t.data,Pt,Mt),Mt+=$t.data.length,$t=$t.next;return Pt}},{key:"consume",value:function(Ct,Pt){var $t;return CtLt.length?Lt.length:Ct;if(Dt===Lt.length?Mt+=Lt:Mt+=Lt.slice(0,Ct),Ct-=Dt,Ct===0){Dt===Lt.length?(++$t,Pt.next?this.head=Pt.next:this.head=this.tail=null):(this.head=Pt,Pt.data=Lt.slice(Dt));break}++$t}return this.length-=$t,Mt}},{key:"_getBuffer",value:function(Ct){var Pt=st.allocUnsafe(Ct),$t=this.head,Mt=1;for($t.data.copy(Pt),Ct-=$t.data.length;$t=$t.next;){var Lt=$t.data,Dt=Ct>Lt.length?Lt.length:Ct;if(Lt.copy(Pt,Pt.length-Ct,0,Dt),Ct-=Dt,Ct===0){Dt===Lt.length?(++Mt,$t.next?this.head=$t.next:this.head=this.tail=null):(this.head=$t,$t.data=Lt.slice(Dt));break}++Mt}return this.length-=Mt,Pt}},{key:ut,value:function(Ct,Pt){return at(this,_(_({},Pt),{},{depth:0,customInspect:!1}))}}]),yt}(),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,a)):process$1$1.nextTick(emitErrorNT,this,a)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(a||null,function(tt){!_&&tt?$._writableState?$._writableState.errorEmitted?process$1$1.nextTick(emitCloseNT,$):($._writableState.errorEmitted=!0,process$1$1.nextTick(emitErrorAndCloseNT,$,tt)):process$1$1.nextTick(emitErrorAndCloseNT,$,tt):_?(process$1$1.nextTick(emitCloseNT,$),_(tt)):process$1$1.nextTick(emitCloseNT,$)}),this)}function emitErrorAndCloseNT(a,_){emitErrorNT(a,_),emitCloseNT(a)}function emitCloseNT(a){a._writableState&&!a._writableState.emitClose||a._readableState&&!a._readableState.emitClose||a.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,_){a.emit("error",_)}function errorOrDestroy(a,_){var $=a._readableState,j=a._writableState;$&&$.autoDestroy||j&&j.autoDestroy?a.destroy(_):a.emit("error",_)}var destroy_1$1={destroy,undestroy,errorOrDestroy},errorsBrowser={};function _inheritsLoose(a,_){a.prototype=Object.create(_.prototype),a.prototype.constructor=a,a.__proto__=_}var codes={};function createErrorType(a,_,$){$||($=Error);function j(tt,rt,nt){return typeof _=="string"?_:_(tt,rt,nt)}var et=function(tt){_inheritsLoose(rt,tt);function rt(nt,it,st){return tt.call(this,j(nt,it,st))||this}return rt}($);et.prototype.name=$.name,et.prototype.code=a,codes[a]=et}function oneOf(a,_){if(Array.isArray(a)){var $=a.length;return a=a.map(function(j){return String(j)}),$>2?"one of ".concat(_," ").concat(a.slice(0,$-1).join(", "),", or ")+a[$-1]:$===2?"one of ".concat(_," ").concat(a[0]," or ").concat(a[1]):"of ".concat(_," ").concat(a[0])}else return"of ".concat(_," ").concat(String(a))}function startsWith(a,_,$){return a.substr(0,_.length)===_}function endsWith$2(a,_,$){return($===void 0||$>a.length)&&($=a.length),a.substring($-_.length,$)===_}function includes(a,_,$){return typeof $!="number"&&($=0),$+_.length>a.length?!1:a.indexOf(_,$)!==-1}createErrorType("ERR_INVALID_OPT_VALUE",function(a,_){return'The value "'+_+'" is invalid for option "'+a+'"'},TypeError);createErrorType("ERR_INVALID_ARG_TYPE",function(a,_,$){var j;typeof _=="string"&&startsWith(_,"not ")?(j="must not be",_=_.replace(/^not /,"")):j="must be";var et;if(endsWith$2(a," argument"))et="The ".concat(a," ").concat(j," ").concat(oneOf(_,"type"));else{var tt=includes(a,".")?"property":"argument";et='The "'.concat(a,'" ').concat(tt," ").concat(j," ").concat(oneOf(_,"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(a){return"The "+a+" method is not implemented"});createErrorType("ERR_STREAM_PREMATURE_CLOSE","Premature close");createErrorType("ERR_STREAM_DESTROYED",function(a){return"Cannot call "+a+" 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(a){return"Unknown encoding: "+a},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 a.highWaterMark!=null?a.highWaterMark:_?a[$]:null}function getHighWaterMark(a,_,$,j){var et=highWaterMarkFrom(_,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 a.objectMode?16:16*1024}var state={getHighWaterMark},browser$c=deprecate;function deprecate(a,_){if(config$3("noDeprecation"))return a;var $=!1;function j(){if(!$){if(config$3("throwDeprecation"))throw new Error(_);config$3("traceDeprecation")?console.trace(_):console.warn(_),$=!0}return a.apply(this,arguments)}return j}function config$3(a){try{if(!commonjsGlobal.localStorage)return!1}catch{return!1}var _=commonjsGlobal.localStorage[a];return _==null?!1:String(_).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=It;function a(nr){var Zt=this;this.next=null,this.entry=null,this.finish=function(){ir(Zt,nr)}}var _;It.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(nr){return et.from(nr)}function nt(nr){return et.isBuffer(nr)||nr instanceof tt}var it=destroy_1$1,st=state,ot=st.getHighWaterMark,at=errorsBrowser.codes,ut=at.ERR_INVALID_ARG_TYPE,ht=at.ERR_METHOD_NOT_IMPLEMENTED,yt=at.ERR_MULTIPLE_CALLBACK,wt=at.ERR_STREAM_CANNOT_PIPE,Ct=at.ERR_STREAM_DESTROYED,Pt=at.ERR_STREAM_NULL_VALUES,$t=at.ERR_STREAM_WRITE_AFTER_END,Mt=at.ERR_UNKNOWN_ENCODING,Lt=it.errorOrDestroy;inherits_browserExports(It,j);function Dt(){}function zt(nr,Zt,Kt){_=_||require_stream_duplex$1(),nr=nr||{},typeof Kt!="boolean"&&(Kt=Zt instanceof _),this.objectMode=!!nr.objectMode,Kt&&(this.objectMode=this.objectMode||!!nr.writableObjectMode),this.highWaterMark=ot(this,nr,"writableHighWaterMark",Kt),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var Qt=nr.decodeStrings===!1;this.decodeStrings=!Qt,this.defaultEncoding=nr.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(Ht){mt(Zt,Ht)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=nr.emitClose!==!1,this.autoDestroy=!!nr.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new a(this)}zt.prototype.getBuffer=function(){for(var Zt=this.bufferedRequest,Kt=[];Zt;)Kt.push(Zt),Zt=Zt.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 Ot;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(Ot=Function.prototype[Symbol.hasInstance],Object.defineProperty(It,Symbol.hasInstance,{value:function(Zt){return Ot.call(this,Zt)?!0:this!==It?!1:Zt&&Zt._writableState instanceof zt}})):Ot=function(Zt){return Zt instanceof this};function It(nr){_=_||require_stream_duplex$1();var Zt=this instanceof _;if(!Zt&&!Ot.call(It,this))return new It(nr);this._writableState=new zt(nr,this,Zt),this.writable=!0,nr&&(typeof nr.write=="function"&&(this._write=nr.write),typeof nr.writev=="function"&&(this._writev=nr.writev),typeof nr.destroy=="function"&&(this._destroy=nr.destroy),typeof nr.final=="function"&&(this._final=nr.final)),j.call(this)}It.prototype.pipe=function(){Lt(this,new wt)};function Bt(nr,Zt){var Kt=new $t;Lt(nr,Kt),process$1$1.nextTick(Zt,Kt)}function Ft(nr,Zt,Kt,Qt){var Ht;return Kt===null?Ht=new Pt:typeof Kt!="string"&&!Zt.objectMode&&(Ht=new ut("chunk",["string","Buffer"],Kt)),Ht?(Lt(nr,Ht),process$1$1.nextTick(Qt,Ht),!1):!0}It.prototype.write=function(nr,Zt,Kt){var Qt=this._writableState,Ht=!1,qt=!Qt.objectMode&&nt(nr);return qt&&!et.isBuffer(nr)&&(nr=rt(nr)),typeof Zt=="function"&&(Kt=Zt,Zt=null),qt?Zt="buffer":Zt||(Zt=Qt.defaultEncoding),typeof Kt!="function"&&(Kt=Dt),Qt.ending?Bt(this,Kt):(qt||Ft(this,Qt,nr,Kt))&&(Qt.pendingcb++,Ht=bt(this,Qt,qt,nr,Zt,Kt)),Ht},It.prototype.cork=function(){this._writableState.corked++},It.prototype.uncork=function(){var nr=this._writableState;nr.corked&&(nr.corked--,!nr.writing&&!nr.corked&&!nr.bufferProcessing&&nr.bufferedRequest&&Rt(this,nr))},It.prototype.setDefaultEncoding=function(Zt){if(typeof Zt=="string"&&(Zt=Zt.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((Zt+"").toLowerCase())>-1))throw new Mt(Zt);return this._writableState.defaultEncoding=Zt,this},Object.defineProperty(It.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function jt(nr,Zt,Kt){return!nr.objectMode&&nr.decodeStrings!==!1&&typeof Zt=="string"&&(Zt=et.from(Zt,Kt)),Zt}Object.defineProperty(It.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function bt(nr,Zt,Kt,Qt,Ht,qt){if(!Kt){var Jt=jt(Zt,Qt,Ht);Qt!==Jt&&(Kt=!0,Ht="buffer",Qt=Jt)}var ur=Zt.objectMode?1:Qt.length;Zt.length+=ur;var xr=Zt.length>5===6?2:a>>4===14?3:a>>3===30?4:a>>6===2?-1:-2}function utf8CheckIncomplete(a,_,$){var j=_.length-1;if(j<$)return 0;var et=utf8CheckByte(_[j]);return et>=0?(et>0&&(a.lastNeed=et-1),et):--j<$||et===-2?0:(et=utf8CheckByte(_[j]),et>=0?(et>0&&(a.lastNeed=et-2),et):--j<$||et===-2?0:(et=utf8CheckByte(_[j]),et>=0?(et>0&&(et===2?et=0:a.lastNeed=et-3),et):0))}function utf8CheckExtraBytes(a,_,$){if((_[0]&192)!==128)return a.lastNeed=0,"�";if(a.lastNeed>1&&_.length>1){if((_[1]&192)!==128)return a.lastNeed=1,"�";if(a.lastNeed>2&&_.length>2&&(_[2]&192)!==128)return a.lastNeed=2,"�"}}function utf8FillLast(a){var _=this.lastTotal-this.lastNeed,$=utf8CheckExtraBytes(this,a);if($!==void 0)return $;if(this.lastNeed<=a.length)return a.copy(this.lastChar,_,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);a.copy(this.lastChar,_,0,a.length),this.lastNeed-=a.length}function utf8Text(a,_){var $=utf8CheckIncomplete(this,a,_);if(!this.lastNeed)return a.toString("utf8",_);this.lastTotal=$;var j=a.length-($-this.lastNeed);return a.copy(this.lastChar,0,j),a.toString("utf8",_,j)}function utf8End(a){var _=a&&a.length?this.write(a):"";return this.lastNeed?_+"�":_}function utf16Text(a,_){if((a.length-_)%2===0){var $=a.toString("utf16le",_);if($){var j=$.charCodeAt($.length-1);if(j>=55296&&j<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=a[a.length-2],this.lastChar[1]=a[a.length-1],$.slice(0,-1)}return $}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=a[a.length-1],a.toString("utf16le",_,a.length-1)}function utf16End(a){var _=a&&a.length?this.write(a):"";if(this.lastNeed){var $=this.lastTotal-this.lastNeed;return _+this.lastChar.toString("utf16le",0,$)}return _}function base64Text(a,_){var $=(a.length-_)%3;return $===0?a.toString("base64",_):(this.lastNeed=3-$,this.lastTotal=3,$===1?this.lastChar[0]=a[a.length-1]:(this.lastChar[0]=a[a.length-2],this.lastChar[1]=a[a.length-1]),a.toString("base64",_,a.length-$))}function base64End(a){var _=a&&a.length?this.write(a):"";return this.lastNeed?_+this.lastChar.toString("base64",0,3-this.lastNeed):_}function simpleWrite(a){return a.toString(this.encoding)}function simpleEnd(a){return a&&a.length?this.write(a):""}var ERR_STREAM_PREMATURE_CLOSE=errorsBrowser.codes.ERR_STREAM_PREMATURE_CLOSE;function once$1(a){var _=!1;return function(){if(!_){_=!0;for(var $=arguments.length,j=new Array($),et=0;et<$;et++)j[et]=arguments[et];a.apply(this,j)}}}function noop$9(){}function isRequest$2(a){return a.setHeader&&typeof a.abort=="function"}function eos$1(a,_,$){if(typeof _=="function")return eos$1(a,null,_);_||(_={}),$=once$1($||noop$9);var j=_.readable||_.readable!==!1&&a.readable,et=_.writable||_.writable!==!1&&a.writable,tt=function(){a.writable||nt()},rt=a._writableState&&a._writableState.finished,nt=function(){et=!1,rt=!0,j||$.call(a)},it=a._readableState&&a._readableState.endEmitted,st=function(){j=!1,it=!0,et||$.call(a)},ot=function(yt){$.call(a,yt)},at=function(){var yt;if(j&&!it)return(!a._readableState||!a._readableState.ended)&&(yt=new ERR_STREAM_PREMATURE_CLOSE),$.call(a,yt);if(et&&!rt)return(!a._writableState||!a._writableState.ended)&&(yt=new ERR_STREAM_PREMATURE_CLOSE),$.call(a,yt)},ut=function(){a.req.on("finish",nt)};return isRequest$2(a)?(a.on("complete",nt),a.on("abort",at),a.req?ut():a.on("request",ut)):et&&!a._writableState&&(a.on("end",tt),a.on("close",tt)),a.on("end",st),a.on("finish",nt),_.error!==!1&&a.on("error",ot),a.on("close",at),function(){a.removeListener("complete",nt),a.removeListener("abort",at),a.removeListener("request",ut),a.req&&a.req.removeListener("finish",nt),a.removeListener("end",tt),a.removeListener("close",tt),a.removeListener("finish",nt),a.removeListener("end",st),a.removeListener("error",ot),a.removeListener("close",at)}}var endOfStream=eos$1,async_iterator,hasRequiredAsync_iterator;function requireAsync_iterator(){if(hasRequiredAsync_iterator)return async_iterator;hasRequiredAsync_iterator=1;var a;function _(Mt,Lt,Dt){return Lt=$(Lt),Lt in Mt?Object.defineProperty(Mt,Lt,{value:Dt,enumerable:!0,configurable:!0,writable:!0}):Mt[Lt]=Dt,Mt}function $(Mt){var Lt=j(Mt,"string");return typeof Lt=="symbol"?Lt:String(Lt)}function j(Mt,Lt){if(typeof Mt!="object"||Mt===null)return Mt;var Dt=Mt[Symbol.toPrimitive];if(Dt!==void 0){var zt=Dt.call(Mt,Lt||"default");if(typeof zt!="object")return zt;throw new TypeError("@@toPrimitive must return a primitive value.")}return(Lt==="string"?String:Number)(Mt)}var et=endOfStream,tt=Symbol("lastResolve"),rt=Symbol("lastReject"),nt=Symbol("error"),it=Symbol("ended"),st=Symbol("lastPromise"),ot=Symbol("handlePromise"),at=Symbol("stream");function ut(Mt,Lt){return{value:Mt,done:Lt}}function ht(Mt){var Lt=Mt[tt];if(Lt!==null){var Dt=Mt[at].read();Dt!==null&&(Mt[st]=null,Mt[tt]=null,Mt[rt]=null,Lt(ut(Dt,!1)))}}function yt(Mt){process$1$1.nextTick(ht,Mt)}function wt(Mt,Lt){return function(Dt,zt){Mt.then(function(){if(Lt[it]){Dt(ut(void 0,!0));return}Lt[ot](Dt,zt)},zt)}}var Ct=Object.getPrototypeOf(function(){}),Pt=Object.setPrototypeOf((a={get stream(){return this[at]},next:function(){var Lt=this,Dt=this[nt];if(Dt!==null)return Promise.reject(Dt);if(this[it])return Promise.resolve(ut(void 0,!0));if(this[at].destroyed)return new Promise(function(Bt,Ft){process$1$1.nextTick(function(){Lt[nt]?Ft(Lt[nt]):Bt(ut(void 0,!0))})});var zt=this[st],Ot;if(zt)Ot=new Promise(wt(zt,this));else{var It=this[at].read();if(It!==null)return Promise.resolve(ut(It,!1));Ot=new Promise(this[ot])}return this[st]=Ot,Ot}},_(a,Symbol.asyncIterator,function(){return this}),_(a,"return",function(){var Lt=this;return new Promise(function(Dt,zt){Lt[at].destroy(null,function(Ot){if(Ot){zt(Ot);return}Dt(ut(void 0,!0))})})}),a),Ct),$t=function(Lt){var Dt,zt=Object.create(Pt,(Dt={},_(Dt,at,{value:Lt,writable:!0}),_(Dt,tt,{value:null,writable:!0}),_(Dt,rt,{value:null,writable:!0}),_(Dt,nt,{value:null,writable:!0}),_(Dt,it,{value:Lt._readableState.endEmitted,writable:!0}),_(Dt,ot,{value:function(It,Bt){var Ft=zt[at].read();Ft?(zt[st]=null,zt[tt]=null,zt[rt]=null,It(ut(Ft,!1))):(zt[tt]=It,zt[rt]=Bt)},writable:!0}),Dt));return zt[st]=null,et(Lt,function(Ot){if(Ot&&Ot.code!=="ERR_STREAM_PREMATURE_CLOSE"){var It=zt[rt];It!==null&&(zt[st]=null,zt[tt]=null,zt[rt]=null,It(Ot)),zt[nt]=Ot;return}var Bt=zt[tt];Bt!==null&&(zt[st]=null,zt[tt]=null,zt[rt]=null,Bt(ut(void 0,!0))),zt[it]=!0}),Lt.on("readable",yt.bind(null,zt)),zt};return async_iterator=$t,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=Bt;var a;Bt.ReadableState=It,eventsExports.EventEmitter;var _=function(Jt,ur){return Jt.listeners(ur).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 st=requireBuffer_list(),ot=destroy_1$1,at=state,ut=at.getHighWaterMark,ht=errorsBrowser.codes,yt=ht.ERR_INVALID_ARG_TYPE,wt=ht.ERR_STREAM_PUSH_AFTER_EOF,Ct=ht.ERR_METHOD_NOT_IMPLEMENTED,Pt=ht.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,$t,Mt,Lt;inherits_browserExports(Bt,$);var Dt=ot.errorOrDestroy,zt=["error","close","destroy","pause","resume"];function Ot(qt,Jt,ur){if(typeof qt.prependListener=="function")return qt.prependListener(Jt,ur);!qt._events||!qt._events[Jt]?qt.on(Jt,ur):Array.isArray(qt._events[Jt])?qt._events[Jt].unshift(ur):qt._events[Jt]=[ur,qt._events[Jt]]}function It(qt,Jt,ur){a=a||require_stream_duplex$1(),qt=qt||{},typeof ur!="boolean"&&(ur=Jt instanceof a),this.objectMode=!!qt.objectMode,ur&&(this.objectMode=this.objectMode||!!qt.readableObjectMode),this.highWaterMark=ut(this,qt,"readableHighWaterMark",ur),this.buffer=new st,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&&($t||($t=string_decoder$1.StringDecoder),this.decoder=new $t(qt.encoding),this.encoding=qt.encoding)}function Bt(qt){if(a=a||require_stream_duplex$1(),!(this instanceof Bt))return new Bt(qt);var Jt=this instanceof a;this._readableState=new It(qt,this,Jt),this.readable=!0,qt&&(typeof qt.read=="function"&&(this._read=qt.read),typeof qt.destroy=="function"&&(this._destroy=qt.destroy)),$.call(this)}Object.defineProperty(Bt.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(Jt){this._readableState&&(this._readableState.destroyed=Jt)}}),Bt.prototype.destroy=ot.destroy,Bt.prototype._undestroy=ot.undestroy,Bt.prototype._destroy=function(qt,Jt){Jt(qt)},Bt.prototype.push=function(qt,Jt){var ur=this._readableState,xr;return ur.objectMode?xr=!0:typeof qt=="string"&&(Jt=Jt||ur.defaultEncoding,Jt!==ur.encoding&&(qt=j.from(qt,Jt),Jt=""),xr=!0),Ft(this,qt,Jt,!1,xr)},Bt.prototype.unshift=function(qt){return Ft(this,qt,null,!0,!1)};function Ft(qt,Jt,ur,xr,pr){it("readableAddChunk",Jt);var Cr=qt._readableState;if(Jt===null)Cr.reading=!1,mt(qt,Cr);else{var Mr;if(pr||(Mr=bt(Cr,Jt)),Mr)Dt(qt,Mr);else if(Cr.objectMode||Jt&&Jt.length>0)if(typeof Jt!="string"&&!Cr.objectMode&&Object.getPrototypeOf(Jt)!==j.prototype&&(Jt=tt(Jt)),xr)Cr.endEmitted?Dt(qt,new Pt):jt(qt,Cr,Jt,!0);else if(Cr.ended)Dt(qt,new wt);else{if(Cr.destroyed)return!1;Cr.reading=!1,Cr.decoder&&!ur?(Jt=Cr.decoder.write(Jt),Cr.objectMode||Jt.length!==0?jt(qt,Cr,Jt,!1):Rt(qt,Cr)):jt(qt,Cr,Jt,!1)}else xr||(Cr.reading=!1,Rt(qt,Cr))}return!Cr.ended&&(Cr.length=vt?qt=vt:(qt--,qt|=qt>>>1,qt|=qt>>>2,qt|=qt>>>4,qt|=qt>>>8,qt|=qt>>>16,qt++),qt}function dt(qt,Jt){return qt<=0||Jt.length===0&&Jt.ended?0:Jt.objectMode?1:qt!==qt?Jt.flowing&&Jt.length?Jt.buffer.head.data.length:Jt.length:(qt>Jt.highWaterMark&&(Jt.highWaterMark=ct(qt)),qt<=Jt.length?qt:Jt.ended?Jt.length:(Jt.needReadable=!0,0))}Bt.prototype.read=function(qt){it("read",qt),qt=parseInt(qt,10);var Jt=this._readableState,ur=qt;if(qt!==0&&(Jt.emittedReadable=!1),qt===0&&Jt.needReadable&&((Jt.highWaterMark!==0?Jt.length>=Jt.highWaterMark:Jt.length>0)||Jt.ended))return it("read: emitReadable",Jt.length,Jt.ended),Jt.length===0&&Jt.ended?Kt(this):xt(this),null;if(qt=dt(qt,Jt),qt===0&&Jt.ended)return Jt.length===0&&Kt(this),null;var xr=Jt.needReadable;it("need readable",xr),(Jt.length===0||Jt.length-qt0?pr=Zt(qt,Jt):pr=null,pr===null?(Jt.needReadable=Jt.length<=Jt.highWaterMark,qt=0):(Jt.length-=qt,Jt.awaitDrain=0),Jt.length===0&&(Jt.ended||(Jt.needReadable=!0),ur!==qt&&Jt.ended&&Kt(this)),pr!==null&&this.emit("data",pr),pr};function mt(qt,Jt){if(it("onEofChunk"),!Jt.ended){if(Jt.decoder){var ur=Jt.decoder.end();ur&&ur.length&&(Jt.buffer.push(ur),Jt.length+=Jt.objectMode?1:ur.length)}Jt.ended=!0,Jt.sync?xt(qt):(Jt.needReadable=!1,Jt.emittedReadable||(Jt.emittedReadable=!0,At(qt)))}}function xt(qt){var Jt=qt._readableState;it("emitReadable",Jt.needReadable,Jt.emittedReadable),Jt.needReadable=!1,Jt.emittedReadable||(it("emitReadable",Jt.flowing),Jt.emittedReadable=!0,process$1$1.nextTick(At,qt))}function At(qt){var Jt=qt._readableState;it("emitReadable_",Jt.destroyed,Jt.length,Jt.ended),!Jt.destroyed&&(Jt.length||Jt.ended)&&(qt.emit("readable"),Jt.emittedReadable=!1),Jt.needReadable=!Jt.flowing&&!Jt.ended&&Jt.length<=Jt.highWaterMark,nr(qt)}function Rt(qt,Jt){Jt.readingMore||(Jt.readingMore=!0,process$1$1.nextTick(St,qt,Jt))}function St(qt,Jt){for(;!Jt.reading&&!Jt.ended&&(Jt.length1&&Ht(xr.pipes,qt)!==-1)&&!_r&&(it("false write response, pause",xr.awaitDrain),xr.awaitDrain++),ur.pause())}function Ar(or){it("onerror",or),Lr(),qt.removeListener("error",Ar),_(qt,"error")===0&&Dt(qt,or)}Ot(qt,"error",Ar);function $r(){qt.removeListener("finish",Or),Lr()}qt.once("close",$r);function Or(){it("onfinish"),qt.removeListener("close",$r),Lr()}qt.once("finish",Or);function Lr(){it("unpipe"),ur.unpipe(qt)}return qt.emit("pipe",ur),xr.flowing||(it("pipe resume"),ur.resume()),qt};function Tt(qt){return function(){var ur=qt._readableState;it("pipeOnDrain",ur.awaitDrain),ur.awaitDrain&&ur.awaitDrain--,ur.awaitDrain===0&&_(qt,"data")&&(ur.flowing=!0,nr(qt))}}Bt.prototype.unpipe=function(qt){var Jt=this._readableState,ur={hasUnpiped:!1};if(Jt.pipesCount===0)return this;if(Jt.pipesCount===1)return qt&&qt!==Jt.pipes?this:(qt||(qt=Jt.pipes),Jt.pipes=null,Jt.pipesCount=0,Jt.flowing=!1,qt&&qt.emit("unpipe",this,ur),this);if(!qt){var xr=Jt.pipes,pr=Jt.pipesCount;Jt.pipes=null,Jt.pipesCount=0,Jt.flowing=!1;for(var Cr=0;Cr0,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?xt(this):xr.reading||process$1$1.nextTick(Nt,this)),ur},Bt.prototype.addListener=Bt.prototype.on,Bt.prototype.removeListener=function(qt,Jt){var ur=$.prototype.removeListener.call(this,qt,Jt);return qt==="readable"&&process$1$1.nextTick(Et,this),ur},Bt.prototype.removeAllListeners=function(qt){var Jt=$.prototype.removeAllListeners.apply(this,arguments);return(qt==="readable"||qt===void 0)&&process$1$1.nextTick(Et,this),Jt};function Et(qt){var Jt=qt._readableState;Jt.readableListening=qt.listenerCount("readable")>0,Jt.resumeScheduled&&!Jt.paused?Jt.flowing=!0:qt.listenerCount("data")>0&&qt.resume()}function Nt(qt){it("readable nexttick read 0"),qt.read(0)}Bt.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,Jt){Jt.resumeScheduled||(Jt.resumeScheduled=!0,process$1$1.nextTick(ir,qt,Jt))}function ir(qt,Jt){it("resume",Jt.reading),Jt.reading||qt.read(0),Jt.resumeScheduled=!1,qt.emit("resume"),nr(qt),Jt.flowing&&!Jt.reading&&qt.read(0)}Bt.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 nr(qt){var Jt=qt._readableState;for(it("flow",Jt.flowing);Jt.flowing&&qt.read()!==null;);}Bt.prototype.wrap=function(qt){var Jt=this,ur=this._readableState,xr=!1;qt.on("end",function(){if(it("wrapped end"),ur.decoder&&!ur.ended){var Mr=ur.decoder.end();Mr&&Mr.length&&Jt.push(Mr)}Jt.push(null)}),qt.on("data",function(Mr){if(it("wrapped data"),ur.decoder&&(Mr=ur.decoder.write(Mr)),!(ur.objectMode&&Mr==null)&&!(!ur.objectMode&&(!Mr||!Mr.length))){var lr=Jt.push(Mr);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 Cr=0;Cr=Jt.length?(Jt.decoder?ur=Jt.buffer.join(""):Jt.buffer.length===1?ur=Jt.buffer.first():ur=Jt.buffer.concat(Jt.length),Jt.buffer.clear()):ur=Jt.buffer.consume(qt,Jt.decoder),ur}function Kt(qt){var Jt=qt._readableState;it("endReadable",Jt.endEmitted),Jt.endEmitted||(Jt.ended=!0,process$1$1.nextTick(Qt,Jt,qt))}function Qt(qt,Jt){if(it("endReadableNT",qt.endEmitted,qt.length),!qt.endEmitted&&qt.length===0&&(qt.endEmitted=!0,Jt.readable=!1,Jt.emit("end"),qt.autoDestroy)){var ur=Jt._writableState;(!ur||ur.autoDestroy&&ur.finished)&&Jt.destroy()}}typeof Symbol=="function"&&(Bt.from=function(qt,Jt){return Lt===void 0&&(Lt=requireFromBrowser()),Lt(Bt,qt,Jt)});function Ht(qt,Jt){for(var ur=0,xr=qt.length;ur0;return destroyer(rt,it,st,function(ot){et||(et=ot),ot&&tt.forEach(call),!it&&(tt.forEach(call),j(et))})});return _.reduce(pipe)}var pipeline_1=pipeline;(function(a,_){_=a.exports=require_stream_readable$1(),_.Stream=_,_.Readable=_,_.Writable=require_stream_writable$1(),_.Duplex=require_stream_duplex$1(),_.Transform=_stream_transform$1,_.PassThrough=_stream_passthrough$1,_.finished=endOfStream,_.pipeline=pipeline_1})(readableBrowser$1,readableBrowser$1.exports);var readableBrowserExports=readableBrowser$1.exports,Buffer$e=safeBufferExports.Buffer,Transform$1=readableBrowserExports.Transform,inherits$h=inherits_browserExports;function throwIfNotStringOrBuffer(a,_){if(!Buffer$e.isBuffer(a)&&typeof a!="string")throw new TypeError(_+" must be a string or a buffer")}function HashBase$2(a){Transform$1.call(this),this._block=Buffer$e.allocUnsafe(a),this._blockSize=a,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}inherits$h(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(a){var _=null;try{this.push(this.digest())}catch($){_=$}a(_)};HashBase$2.prototype.update=function(a,_){if(throwIfNotStringOrBuffer(a,"Data"),this._finalized)throw new Error("Digest already called");Buffer$e.isBuffer(a)||(a=Buffer$e.from(a,_));for(var $=this._block,j=0;this._blockOffset+a.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(a){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var _=this._digest();a!==void 0&&(_=_.toString(a)),this._block.fill(0),this._blockOffset=0;for(var $=0;$<4;++$)this._length[$]=0;return _};HashBase$2.prototype._digest=function(){throw new Error("_digest is not implemented")};var hashBase=HashBase$2,inherits$g=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$g(MD5$2,HashBase$1);MD5$2.prototype._update=function(){for(var a=ARRAY16$1,_=0;_<16;++_)a[_]=this._block.readInt32LE(_*4);var $=this._a,j=this._b,et=this._c,tt=this._d;$=fnF($,j,et,tt,a[0],3614090360,7),tt=fnF(tt,$,j,et,a[1],3905402710,12),et=fnF(et,tt,$,j,a[2],606105819,17),j=fnF(j,et,tt,$,a[3],3250441966,22),$=fnF($,j,et,tt,a[4],4118548399,7),tt=fnF(tt,$,j,et,a[5],1200080426,12),et=fnF(et,tt,$,j,a[6],2821735955,17),j=fnF(j,et,tt,$,a[7],4249261313,22),$=fnF($,j,et,tt,a[8],1770035416,7),tt=fnF(tt,$,j,et,a[9],2336552879,12),et=fnF(et,tt,$,j,a[10],4294925233,17),j=fnF(j,et,tt,$,a[11],2304563134,22),$=fnF($,j,et,tt,a[12],1804603682,7),tt=fnF(tt,$,j,et,a[13],4254626195,12),et=fnF(et,tt,$,j,a[14],2792965006,17),j=fnF(j,et,tt,$,a[15],1236535329,22),$=fnG($,j,et,tt,a[1],4129170786,5),tt=fnG(tt,$,j,et,a[6],3225465664,9),et=fnG(et,tt,$,j,a[11],643717713,14),j=fnG(j,et,tt,$,a[0],3921069994,20),$=fnG($,j,et,tt,a[5],3593408605,5),tt=fnG(tt,$,j,et,a[10],38016083,9),et=fnG(et,tt,$,j,a[15],3634488961,14),j=fnG(j,et,tt,$,a[4],3889429448,20),$=fnG($,j,et,tt,a[9],568446438,5),tt=fnG(tt,$,j,et,a[14],3275163606,9),et=fnG(et,tt,$,j,a[3],4107603335,14),j=fnG(j,et,tt,$,a[8],1163531501,20),$=fnG($,j,et,tt,a[13],2850285829,5),tt=fnG(tt,$,j,et,a[2],4243563512,9),et=fnG(et,tt,$,j,a[7],1735328473,14),j=fnG(j,et,tt,$,a[12],2368359562,20),$=fnH($,j,et,tt,a[5],4294588738,4),tt=fnH(tt,$,j,et,a[8],2272392833,11),et=fnH(et,tt,$,j,a[11],1839030562,16),j=fnH(j,et,tt,$,a[14],4259657740,23),$=fnH($,j,et,tt,a[1],2763975236,4),tt=fnH(tt,$,j,et,a[4],1272893353,11),et=fnH(et,tt,$,j,a[7],4139469664,16),j=fnH(j,et,tt,$,a[10],3200236656,23),$=fnH($,j,et,tt,a[13],681279174,4),tt=fnH(tt,$,j,et,a[0],3936430074,11),et=fnH(et,tt,$,j,a[3],3572445317,16),j=fnH(j,et,tt,$,a[6],76029189,23),$=fnH($,j,et,tt,a[9],3654602809,4),tt=fnH(tt,$,j,et,a[12],3873151461,11),et=fnH(et,tt,$,j,a[15],530742520,16),j=fnH(j,et,tt,$,a[2],3299628645,23),$=fnI($,j,et,tt,a[0],4096336452,6),tt=fnI(tt,$,j,et,a[7],1126891415,10),et=fnI(et,tt,$,j,a[14],2878612391,15),j=fnI(j,et,tt,$,a[5],4237533241,21),$=fnI($,j,et,tt,a[12],1700485571,6),tt=fnI(tt,$,j,et,a[3],2399980690,10),et=fnI(et,tt,$,j,a[10],4293915773,15),j=fnI(j,et,tt,$,a[1],2240044497,21),$=fnI($,j,et,tt,a[8],1873313359,6),tt=fnI(tt,$,j,et,a[15],4264355552,10),et=fnI(et,tt,$,j,a[6],2734768916,15),j=fnI(j,et,tt,$,a[13],1309151649,21),$=fnI($,j,et,tt,a[4],4149444226,6),tt=fnI(tt,$,j,et,a[11],3174756917,10),et=fnI(et,tt,$,j,a[2],718787259,15),j=fnI(j,et,tt,$,a[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 a=Buffer$d.allocUnsafe(16);return a.writeInt32LE(this._a,0),a.writeInt32LE(this._b,4),a.writeInt32LE(this._c,8),a.writeInt32LE(this._d,12),a};function rotl$1(a,_){return a<<_|a>>>32-_}function fnF(a,_,$,j,et,tt,rt){return rotl$1(a+(_&$|~_&j)+et+tt|0,rt)+_|0}function fnG(a,_,$,j,et,tt,rt){return rotl$1(a+(_&j|$&~j)+et+tt|0,rt)+_|0}function fnH(a,_,$,j,et,tt,rt){return rotl$1(a+(_^$^j)+et+tt|0,rt)+_|0}function fnI(a,_,$,j,et,tt,rt){return rotl$1(a+($^(_|~j))+et+tt|0,rt)+_|0}var md5_js=MD5$2,Buffer$c=buffer$1.Buffer,inherits$f=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$f(RIPEMD160$3,HashBase);RIPEMD160$3.prototype._update=function(){for(var a=ARRAY16,_=0;_<16;++_)a[_]=this._block.readInt32LE(_*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,st=this._c|0,ot=this._d|0,at=this._e|0,ut=0;ut<80;ut+=1){var ht,yt;ut<16?(ht=fn1($,j,et,tt,rt,a[zl[ut]],hl[0],sl[ut]),yt=fn5(nt,it,st,ot,at,a[zr[ut]],hr[0],sr[ut])):ut<32?(ht=fn2($,j,et,tt,rt,a[zl[ut]],hl[1],sl[ut]),yt=fn4(nt,it,st,ot,at,a[zr[ut]],hr[1],sr[ut])):ut<48?(ht=fn3($,j,et,tt,rt,a[zl[ut]],hl[2],sl[ut]),yt=fn3(nt,it,st,ot,at,a[zr[ut]],hr[2],sr[ut])):ut<64?(ht=fn4($,j,et,tt,rt,a[zl[ut]],hl[3],sl[ut]),yt=fn2(nt,it,st,ot,at,a[zr[ut]],hr[3],sr[ut])):(ht=fn5($,j,et,tt,rt,a[zl[ut]],hl[4],sl[ut]),yt=fn1(nt,it,st,ot,at,a[zr[ut]],hr[4],sr[ut])),$=rt,rt=tt,tt=rotl(et,10),et=j,j=ht,nt=at,at=ot,ot=rotl(st,10),st=it,it=yt}var wt=this._b+et+ot|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+st|0,this._a=wt};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 a=Buffer$c.alloc?Buffer$c.alloc(20):new Buffer$c(20);return a.writeInt32LE(this._a,0),a.writeInt32LE(this._b,4),a.writeInt32LE(this._c,8),a.writeInt32LE(this._d,12),a.writeInt32LE(this._e,16),a};function rotl(a,_){return a<<_|a>>>32-_}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+(_&$|~_&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$7(a,_){this._block=Buffer$b.alloc(a),this._finalSize=_,this._blockSize=a,this._len=0}Hash$7.prototype.update=function(a,_){typeof a=="string"&&(_=_||"utf8",a=Buffer$b.from(a,_));for(var $=this._block,j=this._blockSize,et=a.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 a?tt.toString(a):tt};Hash$7.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var hash$5=Hash$7,inherits$e=inherits_browserExports,Hash$6=hash$5,Buffer$a=safeBufferExports.Buffer,K$5=[1518500249,1859775393,-1894007588,-899497514],W$5=new Array(80);function Sha(){this.init(),this._w=W$5,Hash$6.call(this,64,56)}inherits$e(Sha,Hash$6);Sha.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function rotl5$1(a){return a<<5|a>>>27}function rotl30$1(a){return a<<30|a>>>2}function ft$1(a,_,$,j){return a===0?_&$|~_&j:a===2?_&$|_&j|$&j:_^$^j}Sha.prototype._update=function(a){for(var _=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)_[nt]=a.readInt32BE(nt*4);for(;nt<80;++nt)_[nt]=_[nt-3]^_[nt-8]^_[nt-14]^_[nt-16];for(var it=0;it<80;++it){var st=~~(it/20),ot=rotl5$1($)+ft$1(st,j,et,tt)+rt+_[it]+K$5[st]|0;rt=tt,tt=et,et=rotl30$1(j),j=$,$=ot}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 a=Buffer$a.allocUnsafe(20);return a.writeInt32BE(this._a|0,0),a.writeInt32BE(this._b|0,4),a.writeInt32BE(this._c|0,8),a.writeInt32BE(this._d|0,12),a.writeInt32BE(this._e|0,16),a};var sha$3=Sha,inherits$d=inherits_browserExports,Hash$5=hash$5,Buffer$9=safeBufferExports.Buffer,K$4=[1518500249,1859775393,-1894007588,-899497514],W$4=new Array(80);function Sha1(){this.init(),this._w=W$4,Hash$5.call(this,64,56)}inherits$d(Sha1,Hash$5);Sha1.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function rotl1(a){return a<<1|a>>>31}function rotl5(a){return a<<5|a>>>27}function rotl30(a){return a<<30|a>>>2}function ft(a,_,$,j){return a===0?_&$|~_&j:a===2?_&$|_&j|$&j:_^$^j}Sha1.prototype._update=function(a){for(var _=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)_[nt]=a.readInt32BE(nt*4);for(;nt<80;++nt)_[nt]=rotl1(_[nt-3]^_[nt-8]^_[nt-14]^_[nt-16]);for(var it=0;it<80;++it){var st=~~(it/20),ot=rotl5($)+ft(st,j,et,tt)+rt+_[it]+K$4[st]|0;rt=tt,tt=et,et=rotl30(j),j=$,$=ot}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 a=Buffer$9.allocUnsafe(20);return a.writeInt32BE(this._a|0,0),a.writeInt32BE(this._b|0,4),a.writeInt32BE(this._c|0,8),a.writeInt32BE(this._d|0,12),a.writeInt32BE(this._e|0,16),a};var sha1=Sha1,inherits$c=inherits_browserExports,Hash$4=hash$5,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$4.call(this,64,56)}inherits$c(Sha256$1,Hash$4);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(a){return(a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10)}function sigma1$1(a){return(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7)}function gamma0(a){return(a>>>7|a<<25)^(a>>>18|a<<14)^a>>>3}function gamma1(a){return(a>>>17|a<<15)^(a>>>19|a<<13)^a>>>10}Sha256$1.prototype._update=function(a){for(var _=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,st=this._h|0,ot=0;ot<16;++ot)_[ot]=a.readInt32BE(ot*4);for(;ot<64;++ot)_[ot]=gamma1(_[ot-2])+_[ot-7]+gamma0(_[ot-15])+_[ot-16]|0;for(var at=0;at<64;++at){var ut=st+sigma1$1(rt)+ch(rt,nt,it)+K$3[at]+_[at]|0,ht=sigma0$1($)+maj$1($,j,et)|0;st=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=st+this._h|0};Sha256$1.prototype._hash=function(){var a=Buffer$8.allocUnsafe(32);return a.writeInt32BE(this._a,0),a.writeInt32BE(this._b,4),a.writeInt32BE(this._c,8),a.writeInt32BE(this._d,12),a.writeInt32BE(this._e,16),a.writeInt32BE(this._f,20),a.writeInt32BE(this._g,24),a.writeInt32BE(this._h,28),a};var sha256$4=Sha256$1,inherits$b=inherits_browserExports,Sha256=sha256$4,Hash$3=hash$5,Buffer$7=safeBufferExports.Buffer,W$2=new Array(64);function Sha224(){this.init(),this._w=W$2,Hash$3.call(this,64,56)}inherits$b(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 a=Buffer$7.allocUnsafe(28);return a.writeInt32BE(this._a,0),a.writeInt32BE(this._b,4),a.writeInt32BE(this._c,8),a.writeInt32BE(this._d,12),a.writeInt32BE(this._e,16),a.writeInt32BE(this._f,20),a.writeInt32BE(this._g,24),a};var sha224$1=Sha224,inherits$a=inherits_browserExports,Hash$2=hash$5,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$2.call(this,128,112)}inherits$a(Sha512,Hash$2);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(a>>>28|_<<4)^(_>>>2|a<<30)^(_>>>7|a<<25)}function sigma1(a,_){return(a>>>14|_<<18)^(a>>>18|_<<14)^(_>>>9|a<<23)}function Gamma0(a,_){return(a>>>1|_<<31)^(a>>>8|_<<24)^a>>>7}function Gamma0l(a,_){return(a>>>1|_<<31)^(a>>>8|_<<24)^(a>>>7|_<<25)}function Gamma1(a,_){return(a>>>19|_<<13)^(_>>>29|a<<3)^a>>>6}function Gamma1l(a,_){return(a>>>19|_<<13)^(_>>>29|a<<3)^(a>>>6|_<<26)}function getCarry(a,_){return a>>>0<_>>>0?1:0}Sha512.prototype._update=function(a){for(var _=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,st=this._hh|0,ot=this._al|0,at=this._bl|0,ut=this._cl|0,ht=this._dl|0,yt=this._el|0,wt=this._fl|0,Ct=this._gl|0,Pt=this._hl|0,$t=0;$t<32;$t+=2)_[$t]=a.readInt32BE($t*4),_[$t+1]=a.readInt32BE($t*4+4);for(;$t<160;$t+=2){var Mt=_[$t-30],Lt=_[$t-15*2+1],Dt=Gamma0(Mt,Lt),zt=Gamma0l(Lt,Mt);Mt=_[$t-2*2],Lt=_[$t-2*2+1];var Ot=Gamma1(Mt,Lt),It=Gamma1l(Lt,Mt),Bt=_[$t-7*2],Ft=_[$t-7*2+1],jt=_[$t-16*2],bt=_[$t-16*2+1],vt=zt+Ft|0,ct=Dt+Bt+getCarry(vt,zt)|0;vt=vt+It|0,ct=ct+Ot+getCarry(vt,It)|0,vt=vt+bt|0,ct=ct+jt+getCarry(vt,bt)|0,_[$t]=ct,_[$t+1]=vt}for(var dt=0;dt<160;dt+=2){ct=_[dt],vt=_[dt+1];var mt=maj($,j,et),xt=maj(ot,at,ut),At=sigma0($,ot),Rt=sigma0(ot,$),St=sigma1(rt,yt),Tt=sigma1(yt,rt),Et=K$2[dt],Nt=K$2[dt+1],tr=Ch(rt,nt,it),ir=Ch(yt,wt,Ct),nr=Pt+Tt|0,Zt=st+St+getCarry(nr,Pt)|0;nr=nr+ir|0,Zt=Zt+tr+getCarry(nr,ir)|0,nr=nr+Nt|0,Zt=Zt+Et+getCarry(nr,Nt)|0,nr=nr+vt|0,Zt=Zt+ct+getCarry(nr,vt)|0;var Kt=Rt+xt|0,Qt=At+mt+getCarry(Kt,Rt)|0;st=it,Pt=Ct,it=nt,Ct=wt,nt=rt,wt=yt,yt=ht+nr|0,rt=tt+Zt+getCarry(yt,ht)|0,tt=et,ht=ut,et=j,ut=at,j=$,at=ot,ot=nr+Kt|0,$=Zt+Qt+getCarry(ot,nr)|0}this._al=this._al+ot|0,this._bl=this._bl+at|0,this._cl=this._cl+ut|0,this._dl=this._dl+ht|0,this._el=this._el+yt|0,this._fl=this._fl+wt|0,this._gl=this._gl+Ct|0,this._hl=this._hl+Pt|0,this._ah=this._ah+$+getCarry(this._al,ot)|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,yt)|0,this._fh=this._fh+nt+getCarry(this._fl,wt)|0,this._gh=this._gh+it+getCarry(this._gl,Ct)|0,this._hh=this._hh+st+getCarry(this._hl,Pt)|0};Sha512.prototype._hash=function(){var a=Buffer$6.allocUnsafe(64);function _($,j,et){a.writeInt32BE($,et),a.writeInt32BE(j,et+4)}return _(this._ah,this._al,0),_(this._bh,this._bl,8),_(this._ch,this._cl,16),_(this._dh,this._dl,24),_(this._eh,this._el,32),_(this._fh,this._fl,40),_(this._gh,this._gl,48),_(this._hh,this._hl,56),a};var sha512$4=Sha512,inherits$9=inherits_browserExports,SHA512$3=sha512$4,Hash$1=hash$5,Buffer$5=safeBufferExports.Buffer,W=new Array(160);function Sha384(){this.init(),this._w=W,Hash$1.call(this,128,112)}inherits$9(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 a=Buffer$5.allocUnsafe(48);function _($,j,et){a.writeInt32BE($,et),a.writeInt32BE(j,et+4)}return _(this._ah,this._al,0),_(this._bh,this._bl,8),_(this._ch,this._cl,16),_(this._dh,this._dl,24),_(this._eh,this._el,32),_(this._fh,this._fl,40),a};var sha384$1=Sha384,exports=sha_js.exports=function(_){_=_.toLowerCase();var $=exports[_];if(!$)throw new Error(_+" is not supported (we accept pull requests)");return new $};exports.sha=sha$3;exports.sha1=sha1;exports.sha224=sha224$1;exports.sha256=sha256$4;exports.sha384=sha384$1;exports.sha512=sha512$4;var sha_jsExports=sha_js.exports,streamBrowserify=Stream,EE=eventsExports.EventEmitter,inherits$8=inherits_browserExports;inherits$8(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(ot){a.writable&&a.write(ot)===!1&&$.pause&&$.pause()}$.on("data",j);function et(){$.readable&&$.resume&&$.resume()}a.on("drain",et),!a._isStdio&&(!_||_.end!==!1)&&($.on("end",rt),$.on("close",nt));var tt=!1;function rt(){tt||(tt=!0,a.end())}function nt(){tt||(tt=!0,typeof a.destroy=="function"&&a.destroy())}function it(ot){if(st(),EE.listenerCount(this,"error")===0)throw ot}$.on("error",it),a.on("error",it);function st(){$.removeListener("data",j),a.removeListener("drain",et),$.removeListener("end",rt),$.removeListener("close",nt),$.removeListener("error",it),a.removeListener("error",it),$.removeListener("end",st),$.removeListener("close",st),a.removeListener("close",st)}return $.on("end",st),$.on("close",st),a.on("close",st),a.emit("pipe",$),a};var Buffer$4=safeBufferExports.Buffer,Transform=streamBrowserify.Transform,StringDecoder=string_decoder$1.StringDecoder,inherits$7=inherits_browserExports;function CipherBase(a){Transform.call(this),this.hashMode=typeof a=="string",this.hashMode?this[a]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}inherits$7(CipherBase,Transform);CipherBase.prototype.update=function(a,_,$){typeof a=="string"&&(a=Buffer$4.from(a,_));var j=this._update(a);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(a):this.push(this._update(a))}catch(et){j=et}finally{$(j)}};CipherBase.prototype._flush=function(a){var _;try{this.push(this.__final())}catch($){_=$}a(_)};CipherBase.prototype._finalOrDigest=function(a){var _=this.__final()||Buffer$4.alloc(0);return a&&(_=this._toString(_,a,!0)),_};CipherBase.prototype._toString=function(a,_,$){if(this._decoder||(this._decoder=new StringDecoder(_),this._encoding=_),this._encoding!==_)throw new Error("can't switch encodings");var j=this._decoder.write(a);return $&&(j+=this._decoder.end()),j};var cipherBase=CipherBase,inherits$6=inherits_browserExports,MD5$1=md5_js,RIPEMD160$2=ripemd160,sha$2=sha_jsExports,Base$3=cipherBase;function Hash(a){Base$3.call(this,"digest"),this._hash=a}inherits$6(Hash,Base$3);Hash.prototype._update=function(a){this._hash.update(a)};Hash.prototype._final=function(){return this._hash.digest()};var browser$b=function(_){return _=_.toLowerCase(),_==="md5"?new MD5$1:_==="rmd160"||_==="ripemd160"?new RIPEMD160$2:new Hash(sha$2(_))},_Buffer=safeBufferExports.Buffer;function base$7(a){if(a.length>=255)throw new TypeError("Alphabet too long");for(var _=new Uint8Array(256),$=0;$<_.length;$++)_[$]=255;for(var j=0;j>>0,Mt=new Uint8Array($t);Ct!==Pt;){for(var Lt=ht[Ct],Dt=0,zt=$t-1;(Lt!==0||Dt>>0,Mt[zt]=Lt%rt>>>0,Lt=Lt/rt>>>0;if(Lt!==0)throw new Error("Non-zero carry");wt=Dt,Ct++}for(var Ot=$t-wt;Ot!==$t&&Mt[Ot]===0;)Ot++;for(var It=nt.repeat(yt);Ot<$t;++Ot)It+=a.charAt(Mt[Ot]);return It}function at(ht){if(typeof ht!="string")throw new TypeError("Expected String");if(ht.length===0)return _Buffer.alloc(0);for(var yt=0,wt=0,Ct=0;ht[yt]===nt;)wt++,yt++;for(var Pt=(ht.length-yt)*it+1>>>0,$t=new Uint8Array(Pt);ht[yt];){var Mt=_[ht.charCodeAt(yt)];if(Mt===255)return;for(var Lt=0,Dt=Pt-1;(Mt!==0||Lt>>0,$t[Dt]=Mt%256>>>0,Mt=Mt/256>>>0;if(Mt!==0)throw new Error("Non-zero carry");Ct=Lt,yt++}for(var zt=Pt-Ct;zt!==Pt&&$t[zt]===0;)zt++;var Ot=_Buffer.allocUnsafe(wt+(Pt-zt));Ot.fill(0,0,wt);for(var It=wt;zt!==Pt;)Ot[It++]=$t[zt++];return Ot}function ut(ht){var yt=at(ht);if(yt)return yt;throw new Error("Non-base"+rt+" character")}return{encode:ot,decodeUnsafe:at,decode:ut}}var src$2=base$7,basex$1=src$2,ALPHABET$3="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",bs58$1=basex$1(ALPHABET$3),base58$1=bs58$1,Buffer$3=safeBufferExports.Buffer,base$6=function(a){function _(tt){var rt=a(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=a(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:_,decode:et,decodeUnsafe:j}},createHash=browser$b,bs58checkBase$1=base$6;function sha256x2$1(a){var _=createHash("sha256").update(a).digest();return createHash("sha256").update(_).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 _=typeof self<"u"?self.crypto||self.msCrypto:null;_&&_.getRandomValues!==void 0&&(this._crypto=_,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(_){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const $=new Uint8Array(_);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(a){throw new Error('Could not dynamically require "'+a+'". 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(a){for(var _=0;__)throw new RangeError("requested too many random bytes");var it=j.allocUnsafe(rt);if(rt>0)if(rt>a)for(var st=0;stet?nt=rt(nt):nt.lengthat){var ut=st==="rmd160"?new tt:rt(st);ot=ut.update(ot).digest()}else ot.lengthMAX_ALLOC||_!==_)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$3=function(a,_,$){if(Buffer$2.isBuffer(a))return a;if(typeof a=="string")return Buffer$2.from(a,_);if(ArrayBuffer.isView(a))return Buffer$2.from(a.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$2=toBuffer$3,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(a),et=a==="sha512"||a==="sha384"?128:64;_.length>et?_=j(_):_.length>>0},utils$x.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$x.ip=function(et,tt,rt,nt){for(var it=0,st=0,ot=6;ot>=0;ot-=2){for(var at=0;at<=24;at+=8)it<<=1,it|=tt>>>at+ot&1;for(var at=0;at<=24;at+=8)it<<=1,it|=et>>>at+ot&1}for(var ot=6;ot>=0;ot-=2){for(var at=1;at<=25;at+=8)st<<=1,st|=tt>>>at+ot&1;for(var at=1;at<=25;at+=8)st<<=1,st|=et>>>at+ot&1}rt[nt+0]=it>>>0,rt[nt+1]=st>>>0},utils$x.rip=function(et,tt,rt,nt){for(var it=0,st=0,ot=0;ot<4;ot++)for(var at=24;at>=0;at-=8)it<<=1,it|=tt>>>at+ot&1,it<<=1,it|=et>>>at+ot&1;for(var ot=4;ot<8;ot++)for(var at=24;at>=0;at-=8)st<<=1,st|=tt>>>at+ot&1,st<<=1,st|=et>>>at+ot&1;rt[nt+0]=it>>>0,rt[nt+1]=st>>>0},utils$x.pc1=function(et,tt,rt,nt){for(var it=0,st=0,ot=7;ot>=5;ot--){for(var at=0;at<=24;at+=8)it<<=1,it|=tt>>at+ot&1;for(var at=0;at<=24;at+=8)it<<=1,it|=et>>at+ot&1}for(var at=0;at<=24;at+=8)it<<=1,it|=tt>>at+ot&1;for(var ot=1;ot<=3;ot++){for(var at=0;at<=24;at+=8)st<<=1,st|=tt>>at+ot&1;for(var at=0;at<=24;at+=8)st<<=1,st|=et>>at+ot&1}for(var at=0;at<=24;at+=8)st<<=1,st|=et>>at+ot&1;rt[nt+0]=it>>>0,rt[nt+1]=st>>>0},utils$x.r28shl=function(et,tt){return et<>>28-tt};var a=[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$x.pc2=function(et,tt,rt,nt){for(var it=0,st=0,ot=a.length>>>1,at=0;at>>a[at]&1;for(var at=ot;at>>a[at]&1;rt[nt+0]=it>>>0,rt[nt+1]=st>>>0},utils$x.expand=function(et,tt,rt){var nt=0,it=0;nt=(et&1)<<5|et>>>27;for(var st=23;st>=15;st-=4)nt<<=6,nt|=et>>>st&63;for(var st=11;st>=3;st-=4)it|=et>>>st&63,it<<=6;it|=(et&31)<<1|et>>>31,tt[rt+0]=nt>>>0,tt[rt+1]=it>>>0};var _=[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$x.substitute=function(et,tt){for(var rt=0,nt=0;nt<4;nt++){var it=et>>>18-nt*6&63,st=_[nt*64+it];rt<<=4,rt|=st}for(var nt=0;nt<4;nt++){var it=tt>>>18-nt*6&63,st=_[4*64+nt*64+it];rt<<=4,rt|=st}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$x.permute=function(et){for(var tt=0,rt=0;rt<$.length;rt++)tt<<=1,tt|=et>>>$[rt]&1;return tt>>>0},utils$x.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},_.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},_.prototype._pad=function(j,et){if(et===0)return!1;for(;et>>1];ot=$.r28shl(ot,ht),at=$.r28shl(at,ht),$.pc2(ot,at,it.keys,ut)}},tt.prototype._update=function(it,st,ot,at){var ut=this._desState,ht=$.readUInt32BE(it,st),yt=$.readUInt32BE(it,st+4);$.ip(ht,yt,ut.tmp,0),ht=ut.tmp[0],yt=ut.tmp[1],this.type==="encrypt"?this._encrypt(ut,ht,yt,ut.tmp,0):this._decrypt(ut,ht,yt,ut.tmp,0),ht=ut.tmp[0],yt=ut.tmp[1],$.writeUInt32BE(ot,ht,at),$.writeUInt32BE(ot,yt,at+4)},tt.prototype._pad=function(it,st){if(this.padding===!1)return!1;for(var ot=it.length-st,at=st;at>>0,ht=Lt}$.rip(yt,ht,at,ut)},tt.prototype._decrypt=function(it,st,ot,at,ut){for(var ht=ot,yt=st,wt=it.keys.length-2;wt>=0;wt-=2){var Ct=it.keys[wt],Pt=it.keys[wt+1];$.expand(ht,it.tmp,0),Ct^=it.tmp[0],Pt^=it.tmp[1];var $t=$.substitute(Ct,Pt),Mt=$.permute($t),Lt=ht;ht=(yt^Mt)>>>0,yt=Lt}$.rip(ht,yt,at,ut)},des}var cbc$1={},hasRequiredCbc$1;function requireCbc$1(){if(hasRequiredCbc$1)return cbc$1;hasRequiredCbc$1=1;var a=minimalisticAssert,_=inherits_browserExports,$={};function j(tt){a.equal(tt.length,8,"Invalid IV length"),this.iv=new Array(8);for(var rt=0;rt>nt%8,j._prev=$(j._prev,tt?ot:at);return st}function $(j,et){var tt=j.length,rt=-1,nt=a.allocUnsafe(j.length);for(j=a.concat([j,a.from([et])]);++rt>7;return nt}return cfb1.encrypt=function(j,et,tt){for(var rt=et.length,nt=a.allocUnsafe(rt),it=-1;++it>>24]^ht[Pt>>>16&255]^yt[$t>>>8&255]^wt[Mt&255]^it[It++],Dt=ut[Pt>>>24]^ht[$t>>>16&255]^yt[Mt>>>8&255]^wt[Ct&255]^it[It++],zt=ut[$t>>>24]^ht[Mt>>>16&255]^yt[Ct>>>8&255]^wt[Pt&255]^it[It++],Ot=ut[Mt>>>24]^ht[Ct>>>16&255]^yt[Pt>>>8&255]^wt[$t&255]^it[It++],Ct=Lt,Pt=Dt,$t=zt,Mt=Ot;return Lt=(ot[Ct>>>24]<<24|ot[Pt>>>16&255]<<16|ot[$t>>>8&255]<<8|ot[Mt&255])^it[It++],Dt=(ot[Pt>>>24]<<24|ot[$t>>>16&255]<<16|ot[Mt>>>8&255]<<8|ot[Ct&255])^it[It++],zt=(ot[$t>>>24]<<24|ot[Mt>>>16&255]<<16|ot[Ct>>>8&255]<<8|ot[Pt&255])^it[It++],Ot=(ot[Mt>>>24]<<24|ot[Ct>>>16&255]<<16|ot[Pt>>>8&255]<<8|ot[$t&255])^it[It++],Lt=Lt>>>0,Dt=Dt>>>0,zt=zt>>>0,Ot=Ot>>>0,[Lt,Dt,zt,Ot]}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 st=[],ot=[],at=[[],[],[],[]],ut=[[],[],[],[]],ht=0,yt=0,wt=0;wt<256;++wt){var Ct=yt^yt<<1^yt<<2^yt<<3^yt<<4;Ct=Ct>>>8^Ct&255^99,st[ht]=Ct,ot[Ct]=ht;var Pt=nt[ht],$t=nt[Pt],Mt=nt[$t],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=Mt*16843009^$t*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=yt=1:(ht=Pt^nt[nt[nt[Mt^Pt]]],yt^=nt[nt[yt]])}return{SBOX:st,INV_SBOX:ot,SUB_MIX:at,INV_SUB_MIX:ut}}();function rt(nt){this._key=_(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,st=it+6,ot=(st+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 yt=[],wt=0;wt>>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=st,this._keySchedule=at,this._invKeySchedule=yt},rt.prototype.encryptBlockRaw=function(nt){return nt=_(nt),j(nt,this._keySchedule,tt.SUB_MIX,tt.SBOX,this._nRounds)},rt.prototype.encryptBlock=function(nt){var it=this.encryptBlockRaw(nt),st=a.allocUnsafe(16);return st.writeUInt32BE(it[0],0),st.writeUInt32BE(it[1],4),st.writeUInt32BE(it[2],8),st.writeUInt32BE(it[3],12),st},rt.prototype.decryptBlock=function(nt){nt=_(nt);var it=nt[1];nt[1]=nt[3],nt[3]=it;var st=j(nt,this._invKeySchedule,tt.INV_SUB_MIX,tt.INV_SBOX,this._nRounds),ot=a.allocUnsafe(16);return ot.writeUInt32BE(st[0],0),ot.writeUInt32BE(st[3],4),ot.writeUInt32BE(st[2],8),ot.writeUInt32BE(st[1],12),ot},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 a=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=a.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=a.alloc(16,0),this.cache=a.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,st&&(tt[0]=tt[0]^225<<24)}this.state=j(rt)},et.prototype.update=function(tt){this.cache=a.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(a.concat([this.cache,_],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 a=requireAes(),_=safeBufferExports.Buffer,$=cipherBase,j=inherits_browserExports,et=requireGhash(),tt=requireBufferXor(),rt=requireIncr32();function nt(ot,at){var ut=0;ot.length!==at.length&&ut++;for(var ht=Math.min(ot.length,at.length),yt=0;yt0||rt>0;){var at=new _;at.update(ot),at.update(j),et&&at.update(et),ot=at.digest();var ut=0;if(nt>0){var ht=it.length-nt;ut=Math.min(nt,ot.length),ot.copy(it,ht,0,ut),nt-=ut}if(ut0){var yt=st.length-rt,wt=Math.min(rt,ot.length-ut);ot.copy(st,yt,ut,ut+wt),rt-=wt}}return ot.fill(0),{key:it,iv:st}}return evp_bytestokey=$,evp_bytestokey}var hasRequiredEncrypter;function requireEncrypter(){if(hasRequiredEncrypter)return encrypter;hasRequiredEncrypter=1;var a=requireModes$1(),_=requireAuthCipher(),$=safeBufferExports.Buffer,j=requireStreamCipher(),et=cipherBase,tt=requireAes(),rt=requireEvp_bytestokey(),nt=inherits_browserExports;function it(ht,yt,wt){et.call(this),this._cache=new ot,this._cipher=new tt.AES(yt),this._prev=$.from(wt),this._mode=ht,this._autopadding=!0}nt(it,et),it.prototype._update=function(ht){this._cache.add(ht);for(var yt,wt,Ct=[];yt=this._cache.get();)wt=this._mode.encrypt(this,yt),Ct.push(wt);return $.concat(Ct)};var st=$.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(st))throw this._cipher.scrub(),new Error("data not multiple of block length")},it.prototype.setAutoPadding=function(ht){return this._autopadding=!!ht,this};function ot(){this.cache=$.allocUnsafe(0)}ot.prototype.add=function(ht){this.cache=$.concat([this.cache,ht])},ot.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},ot.prototype.flush=function(){for(var ht=16-this.cache.length,yt=$.allocUnsafe(ht),wt=-1;++wt16)return yt=this.cache.slice(0,16),this.cache=this.cache.slice(16),yt}else if(this.cache.length>=16)return yt=this.cache.slice(0,16),this.cache=this.cache.slice(16),yt;return null},st.prototype.flush=function(){if(this.cache.length)return this.cache};function ot(ht){var yt=ht[15];if(yt<1||yt>16)throw new Error("unable to decrypt data");for(var wt=-1;++wt0?bt:vt},tt.min=function(bt,vt){return bt.cmp(vt)<0?bt:vt},tt.prototype._init=function(bt,vt,ct){if(typeof bt=="number")return this._initNumber(bt,vt,ct);if(typeof bt=="object")return this._initArray(bt,vt,ct);vt==="hex"&&(vt=16),j(vt===(vt|0)&&vt>=2&&vt<=36),bt=bt.toString().replace(/\s+/g,"");var dt=0;bt[0]==="-"&&(dt++,this.negative=1),dt=0;dt-=3)xt=bt[dt]|bt[dt-1]<<8|bt[dt-2]<<16,this.words[mt]|=xt<>>26-At&67108863,At+=24,At>=26&&(At-=26,mt++);else if(ct==="le")for(dt=0,mt=0;dt>>26-At&67108863,At+=24,At>=26&&(At-=26,mt++);return this.strip()};function nt(jt,bt){var vt=jt.charCodeAt(bt);return vt>=65&&vt<=70?vt-55:vt>=97&&vt<=102?vt-87:vt-48&15}function it(jt,bt,vt){var ct=nt(jt,vt);return vt-1>=bt&&(ct|=nt(jt,vt-1)<<4),ct}tt.prototype._parseHex=function(bt,vt,ct){this.length=Math.ceil((bt.length-vt)/6),this.words=new Array(this.length);for(var dt=0;dt=vt;dt-=2)At=it(bt,vt,dt)<=18?(mt-=18,xt+=1,this.words[xt]|=At>>>26):mt+=8;else{var Rt=bt.length-vt;for(dt=Rt%2===0?vt+1:vt;dt=18?(mt-=18,xt+=1,this.words[xt]|=At>>>26):mt+=8}this.strip()};function st(jt,bt,vt,ct){for(var dt=0,mt=Math.min(jt.length,vt),xt=bt;xt=49?dt+=At-49+10:At>=17?dt+=At-17+10:dt+=At}return dt}tt.prototype._parseBase=function(bt,vt,ct){this.words=[0],this.length=1;for(var dt=0,mt=1;mt<=67108863;mt*=vt)dt++;dt--,mt=mt/vt|0;for(var xt=bt.length-ct,At=xt%dt,Rt=Math.min(xt,xt-At)+ct,St=0,Tt=ct;Tt1&&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 ot=["","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(bt,vt){bt=bt||10,vt=vt|0||1;var ct;if(bt===16||bt==="hex"){ct="";for(var dt=0,mt=0,xt=0;xt>>24-dt&16777215,mt!==0||xt!==this.length-1?ct=ot[6-Rt.length]+Rt+ct:ct=Rt+ct,dt+=2,dt>=26&&(dt-=26,xt--)}for(mt!==0&&(ct=mt.toString(16)+ct);ct.length%vt!==0;)ct="0"+ct;return this.negative!==0&&(ct="-"+ct),ct}if(bt===(bt|0)&&bt>=2&&bt<=36){var St=at[bt],Tt=ut[bt];ct="";var Et=this.clone();for(Et.negative=0;!Et.isZero();){var Nt=Et.modn(Tt).toString(bt);Et=Et.idivn(Tt),Et.isZero()?ct=Nt+ct:ct=ot[St-Nt.length]+Nt+ct}for(this.isZero()&&(ct="0"+ct);ct.length%vt!==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 bt=this.words[0];return this.length===2?bt+=this.words[1]*67108864:this.length===3&&this.words[2]===1?bt+=4503599627370496+this.words[1]*67108864:this.length>2&&j(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-bt:bt},tt.prototype.toJSON=function(){return this.toString(16)},tt.prototype.toBuffer=function(bt,vt){return j(typeof rt<"u"),this.toArrayLike(rt,bt,vt)},tt.prototype.toArray=function(bt,vt){return this.toArrayLike(Array,bt,vt)},tt.prototype.toArrayLike=function(bt,vt,ct){var dt=this.byteLength(),mt=ct||Math.max(1,dt);j(dt<=mt,"byte array longer than desired length"),j(mt>0,"Requested array length <= 0"),this.strip();var xt=vt==="le",At=new bt(mt),Rt,St,Tt=this.clone();if(xt){for(St=0;!Tt.isZero();St++)Rt=Tt.andln(255),Tt.iushrn(8),At[St]=Rt;for(;St=4096&&(ct+=13,vt>>>=13),vt>=64&&(ct+=7,vt>>>=7),vt>=8&&(ct+=4,vt>>>=4),vt>=2&&(ct+=2,vt>>>=2),ct+vt},tt.prototype._zeroBits=function(bt){if(bt===0)return 26;var vt=bt,ct=0;return vt&8191||(ct+=13,vt>>>=13),vt&127||(ct+=7,vt>>>=7),vt&15||(ct+=4,vt>>>=4),vt&3||(ct+=2,vt>>>=2),vt&1||ct++,ct},tt.prototype.bitLength=function(){var bt=this.words[this.length-1],vt=this._countBits(bt);return(this.length-1)*26+vt};function ht(jt){for(var bt=new Array(jt.bitLength()),vt=0;vt>>dt}return bt}tt.prototype.zeroBits=function(){if(this.isZero())return 0;for(var bt=0,vt=0;vtbt.length?this.clone().ior(bt):bt.clone().ior(this)},tt.prototype.uor=function(bt){return this.length>bt.length?this.clone().iuor(bt):bt.clone().iuor(this)},tt.prototype.iuand=function(bt){var vt;this.length>bt.length?vt=bt:vt=this;for(var ct=0;ctbt.length?this.clone().iand(bt):bt.clone().iand(this)},tt.prototype.uand=function(bt){return this.length>bt.length?this.clone().iuand(bt):bt.clone().iuand(this)},tt.prototype.iuxor=function(bt){var vt,ct;this.length>bt.length?(vt=this,ct=bt):(vt=bt,ct=this);for(var dt=0;dtbt.length?this.clone().ixor(bt):bt.clone().ixor(this)},tt.prototype.uxor=function(bt){return this.length>bt.length?this.clone().iuxor(bt):bt.clone().iuxor(this)},tt.prototype.inotn=function(bt){j(typeof bt=="number"&&bt>=0);var vt=Math.ceil(bt/26)|0,ct=bt%26;this._expand(vt),ct>0&&vt--;for(var dt=0;dt0&&(this.words[dt]=~this.words[dt]&67108863>>26-ct),this.strip()},tt.prototype.notn=function(bt){return this.clone().inotn(bt)},tt.prototype.setn=function(bt,vt){j(typeof bt=="number"&&bt>=0);var ct=bt/26|0,dt=bt%26;return this._expand(ct+1),vt?this.words[ct]=this.words[ct]|1<bt.length?(ct=this,dt=bt):(ct=bt,dt=this);for(var mt=0,xt=0;xt>>26;for(;mt!==0&&xt>>26;if(this.length=ct.length,mt!==0)this.words[this.length]=mt,this.length++;else if(ct!==this)for(;xtbt.length?this.clone().iadd(bt):bt.clone().iadd(this)},tt.prototype.isub=function(bt){if(bt.negative!==0){bt.negative=0;var vt=this.iadd(bt);return bt.negative=1,vt._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(bt),this.negative=1,this._normSign();var ct=this.cmp(bt);if(ct===0)return this.negative=0,this.length=1,this.words[0]=0,this;var dt,mt;ct>0?(dt=this,mt=bt):(dt=bt,mt=this);for(var xt=0,At=0;At>26,this.words[At]=vt&67108863;for(;xt!==0&&At>26,this.words[At]=vt&67108863;if(xt===0&&At>>26,Et=Rt&67108863,Nt=Math.min(St,bt.length-1),tr=Math.max(0,St-jt.length+1);tr<=Nt;tr++){var ir=St-tr|0;dt=jt.words[ir]|0,mt=bt.words[tr]|0,xt=dt*mt+Et,Tt+=xt/67108864|0,Et=xt&67108863}vt.words[St]=Et|0,Rt=Tt|0}return Rt!==0?vt.words[St]=Rt|0:vt.length--,vt.strip()}var wt=function(bt,vt,ct){var dt=bt.words,mt=vt.words,xt=ct.words,At=0,Rt,St,Tt,Et=dt[0]|0,Nt=Et&8191,tr=Et>>>13,ir=dt[1]|0,nr=ir&8191,Zt=ir>>>13,Kt=dt[2]|0,Qt=Kt&8191,Ht=Kt>>>13,qt=dt[3]|0,Jt=qt&8191,ur=qt>>>13,xr=dt[4]|0,pr=xr&8191,Cr=xr>>>13,Mr=dt[5]|0,lr=Mr&8191,fr=Mr>>>13,_r=dt[6]|0,Sr=_r&8191,kr=_r>>>13,Ar=dt[7]|0,$r=Ar&8191,Or=Ar>>>13,Lr=dt[8]|0,or=Lr&8191,Yt=Lr>>>13,er=dt[9]|0,Gt=er&8191,Vt=er>>>13,Wt=mt[0]|0,ar=Wt&8191,yr=Wt>>>13,Er=mt[1]|0,Rr=Er&8191,Wr=Er>>>13,Hr=mt[2]|0,Fr=Hr&8191,pn=Hr>>>13,Jr=mt[3]|0,Qr=Jr&8191,mn=Jr>>>13,ln=mt[4]|0,qr=ln&8191,En=ln>>>13,un=mt[5]|0,Vr=un&8191,hn=un>>>13,fn=mt[6]|0,Kr=fn&8191,Rn=fn>>>13,dn=mt[7]|0,Gr=dn&8191,gn=dn>>>13,an=mt[8]|0,Zr=an&8191,An=an>>>13,Sn=mt[9]|0,nn=Sn&8191,Pn=Sn>>>13;ct.negative=bt.negative^vt.negative,ct.length=19,Rt=Math.imul(Nt,ar),St=Math.imul(Nt,yr),St=St+Math.imul(tr,ar)|0,Tt=Math.imul(tr,yr);var yn=(At+Rt|0)+((St&8191)<<13)|0;At=(Tt+(St>>>13)|0)+(yn>>>26)|0,yn&=67108863,Rt=Math.imul(nr,ar),St=Math.imul(nr,yr),St=St+Math.imul(Zt,ar)|0,Tt=Math.imul(Zt,yr),Rt=Rt+Math.imul(Nt,Rr)|0,St=St+Math.imul(Nt,Wr)|0,St=St+Math.imul(tr,Rr)|0,Tt=Tt+Math.imul(tr,Wr)|0;var _n=(At+Rt|0)+((St&8191)<<13)|0;At=(Tt+(St>>>13)|0)+(_n>>>26)|0,_n&=67108863,Rt=Math.imul(Qt,ar),St=Math.imul(Qt,yr),St=St+Math.imul(Ht,ar)|0,Tt=Math.imul(Ht,yr),Rt=Rt+Math.imul(nr,Rr)|0,St=St+Math.imul(nr,Wr)|0,St=St+Math.imul(Zt,Rr)|0,Tt=Tt+Math.imul(Zt,Wr)|0,Rt=Rt+Math.imul(Nt,Fr)|0,St=St+Math.imul(Nt,pn)|0,St=St+Math.imul(tr,Fr)|0,Tt=Tt+Math.imul(tr,pn)|0;var ds=(At+Rt|0)+((St&8191)<<13)|0;At=(Tt+(St>>>13)|0)+(ds>>>26)|0,ds&=67108863,Rt=Math.imul(Jt,ar),St=Math.imul(Jt,yr),St=St+Math.imul(ur,ar)|0,Tt=Math.imul(ur,yr),Rt=Rt+Math.imul(Qt,Rr)|0,St=St+Math.imul(Qt,Wr)|0,St=St+Math.imul(Ht,Rr)|0,Tt=Tt+Math.imul(Ht,Wr)|0,Rt=Rt+Math.imul(nr,Fr)|0,St=St+Math.imul(nr,pn)|0,St=St+Math.imul(Zt,Fr)|0,Tt=Tt+Math.imul(Zt,pn)|0,Rt=Rt+Math.imul(Nt,Qr)|0,St=St+Math.imul(Nt,mn)|0,St=St+Math.imul(tr,Qr)|0,Tt=Tt+Math.imul(tr,mn)|0;var fs=(At+Rt|0)+((St&8191)<<13)|0;At=(Tt+(St>>>13)|0)+(fs>>>26)|0,fs&=67108863,Rt=Math.imul(pr,ar),St=Math.imul(pr,yr),St=St+Math.imul(Cr,ar)|0,Tt=Math.imul(Cr,yr),Rt=Rt+Math.imul(Jt,Rr)|0,St=St+Math.imul(Jt,Wr)|0,St=St+Math.imul(ur,Rr)|0,Tt=Tt+Math.imul(ur,Wr)|0,Rt=Rt+Math.imul(Qt,Fr)|0,St=St+Math.imul(Qt,pn)|0,St=St+Math.imul(Ht,Fr)|0,Tt=Tt+Math.imul(Ht,pn)|0,Rt=Rt+Math.imul(nr,Qr)|0,St=St+Math.imul(nr,mn)|0,St=St+Math.imul(Zt,Qr)|0,Tt=Tt+Math.imul(Zt,mn)|0,Rt=Rt+Math.imul(Nt,qr)|0,St=St+Math.imul(Nt,En)|0,St=St+Math.imul(tr,qr)|0,Tt=Tt+Math.imul(tr,En)|0;var hs=(At+Rt|0)+((St&8191)<<13)|0;At=(Tt+(St>>>13)|0)+(hs>>>26)|0,hs&=67108863,Rt=Math.imul(lr,ar),St=Math.imul(lr,yr),St=St+Math.imul(fr,ar)|0,Tt=Math.imul(fr,yr),Rt=Rt+Math.imul(pr,Rr)|0,St=St+Math.imul(pr,Wr)|0,St=St+Math.imul(Cr,Rr)|0,Tt=Tt+Math.imul(Cr,Wr)|0,Rt=Rt+Math.imul(Jt,Fr)|0,St=St+Math.imul(Jt,pn)|0,St=St+Math.imul(ur,Fr)|0,Tt=Tt+Math.imul(ur,pn)|0,Rt=Rt+Math.imul(Qt,Qr)|0,St=St+Math.imul(Qt,mn)|0,St=St+Math.imul(Ht,Qr)|0,Tt=Tt+Math.imul(Ht,mn)|0,Rt=Rt+Math.imul(nr,qr)|0,St=St+Math.imul(nr,En)|0,St=St+Math.imul(Zt,qr)|0,Tt=Tt+Math.imul(Zt,En)|0,Rt=Rt+Math.imul(Nt,Vr)|0,St=St+Math.imul(Nt,hn)|0,St=St+Math.imul(tr,Vr)|0,Tt=Tt+Math.imul(tr,hn)|0;var ps=(At+Rt|0)+((St&8191)<<13)|0;At=(Tt+(St>>>13)|0)+(ps>>>26)|0,ps&=67108863,Rt=Math.imul(Sr,ar),St=Math.imul(Sr,yr),St=St+Math.imul(kr,ar)|0,Tt=Math.imul(kr,yr),Rt=Rt+Math.imul(lr,Rr)|0,St=St+Math.imul(lr,Wr)|0,St=St+Math.imul(fr,Rr)|0,Tt=Tt+Math.imul(fr,Wr)|0,Rt=Rt+Math.imul(pr,Fr)|0,St=St+Math.imul(pr,pn)|0,St=St+Math.imul(Cr,Fr)|0,Tt=Tt+Math.imul(Cr,pn)|0,Rt=Rt+Math.imul(Jt,Qr)|0,St=St+Math.imul(Jt,mn)|0,St=St+Math.imul(ur,Qr)|0,Tt=Tt+Math.imul(ur,mn)|0,Rt=Rt+Math.imul(Qt,qr)|0,St=St+Math.imul(Qt,En)|0,St=St+Math.imul(Ht,qr)|0,Tt=Tt+Math.imul(Ht,En)|0,Rt=Rt+Math.imul(nr,Vr)|0,St=St+Math.imul(nr,hn)|0,St=St+Math.imul(Zt,Vr)|0,Tt=Tt+Math.imul(Zt,hn)|0,Rt=Rt+Math.imul(Nt,Kr)|0,St=St+Math.imul(Nt,Rn)|0,St=St+Math.imul(tr,Kr)|0,Tt=Tt+Math.imul(tr,Rn)|0;var Vn=(At+Rt|0)+((St&8191)<<13)|0;At=(Tt+(St>>>13)|0)+(Vn>>>26)|0,Vn&=67108863,Rt=Math.imul($r,ar),St=Math.imul($r,yr),St=St+Math.imul(Or,ar)|0,Tt=Math.imul(Or,yr),Rt=Rt+Math.imul(Sr,Rr)|0,St=St+Math.imul(Sr,Wr)|0,St=St+Math.imul(kr,Rr)|0,Tt=Tt+Math.imul(kr,Wr)|0,Rt=Rt+Math.imul(lr,Fr)|0,St=St+Math.imul(lr,pn)|0,St=St+Math.imul(fr,Fr)|0,Tt=Tt+Math.imul(fr,pn)|0,Rt=Rt+Math.imul(pr,Qr)|0,St=St+Math.imul(pr,mn)|0,St=St+Math.imul(Cr,Qr)|0,Tt=Tt+Math.imul(Cr,mn)|0,Rt=Rt+Math.imul(Jt,qr)|0,St=St+Math.imul(Jt,En)|0,St=St+Math.imul(ur,qr)|0,Tt=Tt+Math.imul(ur,En)|0,Rt=Rt+Math.imul(Qt,Vr)|0,St=St+Math.imul(Qt,hn)|0,St=St+Math.imul(Ht,Vr)|0,Tt=Tt+Math.imul(Ht,hn)|0,Rt=Rt+Math.imul(nr,Kr)|0,St=St+Math.imul(nr,Rn)|0,St=St+Math.imul(Zt,Kr)|0,Tt=Tt+Math.imul(Zt,Rn)|0,Rt=Rt+Math.imul(Nt,Gr)|0,St=St+Math.imul(Nt,gn)|0,St=St+Math.imul(tr,Gr)|0,Tt=Tt+Math.imul(tr,gn)|0;var ss=(At+Rt|0)+((St&8191)<<13)|0;At=(Tt+(St>>>13)|0)+(ss>>>26)|0,ss&=67108863,Rt=Math.imul(or,ar),St=Math.imul(or,yr),St=St+Math.imul(Yt,ar)|0,Tt=Math.imul(Yt,yr),Rt=Rt+Math.imul($r,Rr)|0,St=St+Math.imul($r,Wr)|0,St=St+Math.imul(Or,Rr)|0,Tt=Tt+Math.imul(Or,Wr)|0,Rt=Rt+Math.imul(Sr,Fr)|0,St=St+Math.imul(Sr,pn)|0,St=St+Math.imul(kr,Fr)|0,Tt=Tt+Math.imul(kr,pn)|0,Rt=Rt+Math.imul(lr,Qr)|0,St=St+Math.imul(lr,mn)|0,St=St+Math.imul(fr,Qr)|0,Tt=Tt+Math.imul(fr,mn)|0,Rt=Rt+Math.imul(pr,qr)|0,St=St+Math.imul(pr,En)|0,St=St+Math.imul(Cr,qr)|0,Tt=Tt+Math.imul(Cr,En)|0,Rt=Rt+Math.imul(Jt,Vr)|0,St=St+Math.imul(Jt,hn)|0,St=St+Math.imul(ur,Vr)|0,Tt=Tt+Math.imul(ur,hn)|0,Rt=Rt+Math.imul(Qt,Kr)|0,St=St+Math.imul(Qt,Rn)|0,St=St+Math.imul(Ht,Kr)|0,Tt=Tt+Math.imul(Ht,Rn)|0,Rt=Rt+Math.imul(nr,Gr)|0,St=St+Math.imul(nr,gn)|0,St=St+Math.imul(Zt,Gr)|0,Tt=Tt+Math.imul(Zt,gn)|0,Rt=Rt+Math.imul(Nt,Zr)|0,St=St+Math.imul(Nt,An)|0,St=St+Math.imul(tr,Zr)|0,Tt=Tt+Math.imul(tr,An)|0;var Jn=(At+Rt|0)+((St&8191)<<13)|0;At=(Tt+(St>>>13)|0)+(Jn>>>26)|0,Jn&=67108863,Rt=Math.imul(Gt,ar),St=Math.imul(Gt,yr),St=St+Math.imul(Vt,ar)|0,Tt=Math.imul(Vt,yr),Rt=Rt+Math.imul(or,Rr)|0,St=St+Math.imul(or,Wr)|0,St=St+Math.imul(Yt,Rr)|0,Tt=Tt+Math.imul(Yt,Wr)|0,Rt=Rt+Math.imul($r,Fr)|0,St=St+Math.imul($r,pn)|0,St=St+Math.imul(Or,Fr)|0,Tt=Tt+Math.imul(Or,pn)|0,Rt=Rt+Math.imul(Sr,Qr)|0,St=St+Math.imul(Sr,mn)|0,St=St+Math.imul(kr,Qr)|0,Tt=Tt+Math.imul(kr,mn)|0,Rt=Rt+Math.imul(lr,qr)|0,St=St+Math.imul(lr,En)|0,St=St+Math.imul(fr,qr)|0,Tt=Tt+Math.imul(fr,En)|0,Rt=Rt+Math.imul(pr,Vr)|0,St=St+Math.imul(pr,hn)|0,St=St+Math.imul(Cr,Vr)|0,Tt=Tt+Math.imul(Cr,hn)|0,Rt=Rt+Math.imul(Jt,Kr)|0,St=St+Math.imul(Jt,Rn)|0,St=St+Math.imul(ur,Kr)|0,Tt=Tt+Math.imul(ur,Rn)|0,Rt=Rt+Math.imul(Qt,Gr)|0,St=St+Math.imul(Qt,gn)|0,St=St+Math.imul(Ht,Gr)|0,Tt=Tt+Math.imul(Ht,gn)|0,Rt=Rt+Math.imul(nr,Zr)|0,St=St+Math.imul(nr,An)|0,St=St+Math.imul(Zt,Zr)|0,Tt=Tt+Math.imul(Zt,An)|0,Rt=Rt+Math.imul(Nt,nn)|0,St=St+Math.imul(Nt,Pn)|0,St=St+Math.imul(tr,nn)|0,Tt=Tt+Math.imul(tr,Pn)|0;var Yn=(At+Rt|0)+((St&8191)<<13)|0;At=(Tt+(St>>>13)|0)+(Yn>>>26)|0,Yn&=67108863,Rt=Math.imul(Gt,Rr),St=Math.imul(Gt,Wr),St=St+Math.imul(Vt,Rr)|0,Tt=Math.imul(Vt,Wr),Rt=Rt+Math.imul(or,Fr)|0,St=St+Math.imul(or,pn)|0,St=St+Math.imul(Yt,Fr)|0,Tt=Tt+Math.imul(Yt,pn)|0,Rt=Rt+Math.imul($r,Qr)|0,St=St+Math.imul($r,mn)|0,St=St+Math.imul(Or,Qr)|0,Tt=Tt+Math.imul(Or,mn)|0,Rt=Rt+Math.imul(Sr,qr)|0,St=St+Math.imul(Sr,En)|0,St=St+Math.imul(kr,qr)|0,Tt=Tt+Math.imul(kr,En)|0,Rt=Rt+Math.imul(lr,Vr)|0,St=St+Math.imul(lr,hn)|0,St=St+Math.imul(fr,Vr)|0,Tt=Tt+Math.imul(fr,hn)|0,Rt=Rt+Math.imul(pr,Kr)|0,St=St+Math.imul(pr,Rn)|0,St=St+Math.imul(Cr,Kr)|0,Tt=Tt+Math.imul(Cr,Rn)|0,Rt=Rt+Math.imul(Jt,Gr)|0,St=St+Math.imul(Jt,gn)|0,St=St+Math.imul(ur,Gr)|0,Tt=Tt+Math.imul(ur,gn)|0,Rt=Rt+Math.imul(Qt,Zr)|0,St=St+Math.imul(Qt,An)|0,St=St+Math.imul(Ht,Zr)|0,Tt=Tt+Math.imul(Ht,An)|0,Rt=Rt+Math.imul(nr,nn)|0,St=St+Math.imul(nr,Pn)|0,St=St+Math.imul(Zt,nn)|0,Tt=Tt+Math.imul(Zt,Pn)|0;var ms=(At+Rt|0)+((St&8191)<<13)|0;At=(Tt+(St>>>13)|0)+(ms>>>26)|0,ms&=67108863,Rt=Math.imul(Gt,Fr),St=Math.imul(Gt,pn),St=St+Math.imul(Vt,Fr)|0,Tt=Math.imul(Vt,pn),Rt=Rt+Math.imul(or,Qr)|0,St=St+Math.imul(or,mn)|0,St=St+Math.imul(Yt,Qr)|0,Tt=Tt+Math.imul(Yt,mn)|0,Rt=Rt+Math.imul($r,qr)|0,St=St+Math.imul($r,En)|0,St=St+Math.imul(Or,qr)|0,Tt=Tt+Math.imul(Or,En)|0,Rt=Rt+Math.imul(Sr,Vr)|0,St=St+Math.imul(Sr,hn)|0,St=St+Math.imul(kr,Vr)|0,Tt=Tt+Math.imul(kr,hn)|0,Rt=Rt+Math.imul(lr,Kr)|0,St=St+Math.imul(lr,Rn)|0,St=St+Math.imul(fr,Kr)|0,Tt=Tt+Math.imul(fr,Rn)|0,Rt=Rt+Math.imul(pr,Gr)|0,St=St+Math.imul(pr,gn)|0,St=St+Math.imul(Cr,Gr)|0,Tt=Tt+Math.imul(Cr,gn)|0,Rt=Rt+Math.imul(Jt,Zr)|0,St=St+Math.imul(Jt,An)|0,St=St+Math.imul(ur,Zr)|0,Tt=Tt+Math.imul(ur,An)|0,Rt=Rt+Math.imul(Qt,nn)|0,St=St+Math.imul(Qt,Pn)|0,St=St+Math.imul(Ht,nn)|0,Tt=Tt+Math.imul(Ht,Pn)|0;var Qn=(At+Rt|0)+((St&8191)<<13)|0;At=(Tt+(St>>>13)|0)+(Qn>>>26)|0,Qn&=67108863,Rt=Math.imul(Gt,Qr),St=Math.imul(Gt,mn),St=St+Math.imul(Vt,Qr)|0,Tt=Math.imul(Vt,mn),Rt=Rt+Math.imul(or,qr)|0,St=St+Math.imul(or,En)|0,St=St+Math.imul(Yt,qr)|0,Tt=Tt+Math.imul(Yt,En)|0,Rt=Rt+Math.imul($r,Vr)|0,St=St+Math.imul($r,hn)|0,St=St+Math.imul(Or,Vr)|0,Tt=Tt+Math.imul(Or,hn)|0,Rt=Rt+Math.imul(Sr,Kr)|0,St=St+Math.imul(Sr,Rn)|0,St=St+Math.imul(kr,Kr)|0,Tt=Tt+Math.imul(kr,Rn)|0,Rt=Rt+Math.imul(lr,Gr)|0,St=St+Math.imul(lr,gn)|0,St=St+Math.imul(fr,Gr)|0,Tt=Tt+Math.imul(fr,gn)|0,Rt=Rt+Math.imul(pr,Zr)|0,St=St+Math.imul(pr,An)|0,St=St+Math.imul(Cr,Zr)|0,Tt=Tt+Math.imul(Cr,An)|0,Rt=Rt+Math.imul(Jt,nn)|0,St=St+Math.imul(Jt,Pn)|0,St=St+Math.imul(ur,nn)|0,Tt=Tt+Math.imul(ur,Pn)|0;var es=(At+Rt|0)+((St&8191)<<13)|0;At=(Tt+(St>>>13)|0)+(es>>>26)|0,es&=67108863,Rt=Math.imul(Gt,qr),St=Math.imul(Gt,En),St=St+Math.imul(Vt,qr)|0,Tt=Math.imul(Vt,En),Rt=Rt+Math.imul(or,Vr)|0,St=St+Math.imul(or,hn)|0,St=St+Math.imul(Yt,Vr)|0,Tt=Tt+Math.imul(Yt,hn)|0,Rt=Rt+Math.imul($r,Kr)|0,St=St+Math.imul($r,Rn)|0,St=St+Math.imul(Or,Kr)|0,Tt=Tt+Math.imul(Or,Rn)|0,Rt=Rt+Math.imul(Sr,Gr)|0,St=St+Math.imul(Sr,gn)|0,St=St+Math.imul(kr,Gr)|0,Tt=Tt+Math.imul(kr,gn)|0,Rt=Rt+Math.imul(lr,Zr)|0,St=St+Math.imul(lr,An)|0,St=St+Math.imul(fr,Zr)|0,Tt=Tt+Math.imul(fr,An)|0,Rt=Rt+Math.imul(pr,nn)|0,St=St+Math.imul(pr,Pn)|0,St=St+Math.imul(Cr,nn)|0,Tt=Tt+Math.imul(Cr,Pn)|0;var ls=(At+Rt|0)+((St&8191)<<13)|0;At=(Tt+(St>>>13)|0)+(ls>>>26)|0,ls&=67108863,Rt=Math.imul(Gt,Vr),St=Math.imul(Gt,hn),St=St+Math.imul(Vt,Vr)|0,Tt=Math.imul(Vt,hn),Rt=Rt+Math.imul(or,Kr)|0,St=St+Math.imul(or,Rn)|0,St=St+Math.imul(Yt,Kr)|0,Tt=Tt+Math.imul(Yt,Rn)|0,Rt=Rt+Math.imul($r,Gr)|0,St=St+Math.imul($r,gn)|0,St=St+Math.imul(Or,Gr)|0,Tt=Tt+Math.imul(Or,gn)|0,Rt=Rt+Math.imul(Sr,Zr)|0,St=St+Math.imul(Sr,An)|0,St=St+Math.imul(kr,Zr)|0,Tt=Tt+Math.imul(kr,An)|0,Rt=Rt+Math.imul(lr,nn)|0,St=St+Math.imul(lr,Pn)|0,St=St+Math.imul(fr,nn)|0,Tt=Tt+Math.imul(fr,Pn)|0;var us=(At+Rt|0)+((St&8191)<<13)|0;At=(Tt+(St>>>13)|0)+(us>>>26)|0,us&=67108863,Rt=Math.imul(Gt,Kr),St=Math.imul(Gt,Rn),St=St+Math.imul(Vt,Kr)|0,Tt=Math.imul(Vt,Rn),Rt=Rt+Math.imul(or,Gr)|0,St=St+Math.imul(or,gn)|0,St=St+Math.imul(Yt,Gr)|0,Tt=Tt+Math.imul(Yt,gn)|0,Rt=Rt+Math.imul($r,Zr)|0,St=St+Math.imul($r,An)|0,St=St+Math.imul(Or,Zr)|0,Tt=Tt+Math.imul(Or,An)|0,Rt=Rt+Math.imul(Sr,nn)|0,St=St+Math.imul(Sr,Pn)|0,St=St+Math.imul(kr,nn)|0,Tt=Tt+Math.imul(kr,Pn)|0;var Wn=(At+Rt|0)+((St&8191)<<13)|0;At=(Tt+(St>>>13)|0)+(Wn>>>26)|0,Wn&=67108863,Rt=Math.imul(Gt,Gr),St=Math.imul(Gt,gn),St=St+Math.imul(Vt,Gr)|0,Tt=Math.imul(Vt,gn),Rt=Rt+Math.imul(or,Zr)|0,St=St+Math.imul(or,An)|0,St=St+Math.imul(Yt,Zr)|0,Tt=Tt+Math.imul(Yt,An)|0,Rt=Rt+Math.imul($r,nn)|0,St=St+Math.imul($r,Pn)|0,St=St+Math.imul(Or,nn)|0,Tt=Tt+Math.imul(Or,Pn)|0;var as=(At+Rt|0)+((St&8191)<<13)|0;At=(Tt+(St>>>13)|0)+(as>>>26)|0,as&=67108863,Rt=Math.imul(Gt,Zr),St=Math.imul(Gt,An),St=St+Math.imul(Vt,Zr)|0,Tt=Math.imul(Vt,An),Rt=Rt+Math.imul(or,nn)|0,St=St+Math.imul(or,Pn)|0,St=St+Math.imul(Yt,nn)|0,Tt=Tt+Math.imul(Yt,Pn)|0;var gs=(At+Rt|0)+((St&8191)<<13)|0;At=(Tt+(St>>>13)|0)+(gs>>>26)|0,gs&=67108863,Rt=Math.imul(Gt,nn),St=Math.imul(Gt,Pn),St=St+Math.imul(Vt,nn)|0,Tt=Math.imul(Vt,Pn);var vs=(At+Rt|0)+((St&8191)<<13)|0;return At=(Tt+(St>>>13)|0)+(vs>>>26)|0,vs&=67108863,xt[0]=yn,xt[1]=_n,xt[2]=ds,xt[3]=fs,xt[4]=hs,xt[5]=ps,xt[6]=Vn,xt[7]=ss,xt[8]=Jn,xt[9]=Yn,xt[10]=ms,xt[11]=Qn,xt[12]=es,xt[13]=ls,xt[14]=us,xt[15]=Wn,xt[16]=as,xt[17]=gs,xt[18]=vs,At!==0&&(xt[19]=At,ct.length++),ct};Math.imul||(wt=yt);function Ct(jt,bt,vt){vt.negative=bt.negative^jt.negative,vt.length=jt.length+bt.length;for(var ct=0,dt=0,mt=0;mt>>26)|0,dt+=xt>>>26,xt&=67108863}vt.words[mt]=At,ct=xt,xt=dt}return ct!==0?vt.words[mt]=ct:vt.length--,vt.strip()}function Pt(jt,bt,vt){var ct=new $t;return ct.mulp(jt,bt,vt)}tt.prototype.mulTo=function(bt,vt){var ct,dt=this.length+bt.length;return this.length===10&&bt.length===10?ct=wt(this,bt,vt):dt<63?ct=yt(this,bt,vt):dt<1024?ct=Ct(this,bt,vt):ct=Pt(this,bt,vt),ct};function $t(jt,bt){this.x=jt,this.y=bt}$t.prototype.makeRBT=function(bt){for(var vt=new Array(bt),ct=tt.prototype._countBits(bt)-1,dt=0;dt>=1;return dt},$t.prototype.permute=function(bt,vt,ct,dt,mt,xt){for(var At=0;At>>1)mt++;return 1<>>13,ct[2*xt+1]=mt&8191,mt=mt>>>13;for(xt=2*vt;xt>=26,vt+=dt/67108864|0,vt+=mt>>>26,this.words[ct]=mt&67108863}return vt!==0&&(this.words[ct]=vt,this.length++),this},tt.prototype.muln=function(bt){return this.clone().imuln(bt)},tt.prototype.sqr=function(){return this.mul(this)},tt.prototype.isqr=function(){return this.imul(this.clone())},tt.prototype.pow=function(bt){var vt=ht(bt);if(vt.length===0)return new tt(1);for(var ct=this,dt=0;dt=0);var vt=bt%26,ct=(bt-vt)/26,dt=67108863>>>26-vt<<26-vt,mt;if(vt!==0){var xt=0;for(mt=0;mt>>26-vt}xt&&(this.words[mt]=xt,this.length++)}if(ct!==0){for(mt=this.length-1;mt>=0;mt--)this.words[mt+ct]=this.words[mt];for(mt=0;mt=0);var dt;vt?dt=(vt-vt%26)/26:dt=0;var mt=bt%26,xt=Math.min((bt-mt)/26,this.length),At=67108863^67108863>>>mt<xt)for(this.length-=xt,St=0;St=0&&(Tt!==0||St>=dt);St--){var Et=this.words[St]|0;this.words[St]=Tt<<26-mt|Et>>>mt,Tt=Et&At}return Rt&&Tt!==0&&(Rt.words[Rt.length++]=Tt),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},tt.prototype.ishrn=function(bt,vt,ct){return j(this.negative===0),this.iushrn(bt,vt,ct)},tt.prototype.shln=function(bt){return this.clone().ishln(bt)},tt.prototype.ushln=function(bt){return this.clone().iushln(bt)},tt.prototype.shrn=function(bt){return this.clone().ishrn(bt)},tt.prototype.ushrn=function(bt){return this.clone().iushrn(bt)},tt.prototype.testn=function(bt){j(typeof bt=="number"&&bt>=0);var vt=bt%26,ct=(bt-vt)/26,dt=1<=0);var vt=bt%26,ct=(bt-vt)/26;if(j(this.negative===0,"imaskn works only with positive numbers"),this.length<=ct)return this;if(vt!==0&&ct++,this.length=Math.min(ct,this.length),vt!==0){var dt=67108863^67108863>>>vt<=67108864;vt++)this.words[vt]-=67108864,vt===this.length-1?this.words[vt+1]=1:this.words[vt+1]++;return this.length=Math.max(this.length,vt+1),this},tt.prototype.isubn=function(bt){if(j(typeof bt=="number"),j(bt<67108864),bt<0)return this.iaddn(-bt);if(this.negative!==0)return this.negative=0,this.iaddn(bt),this.negative=1,this;if(this.words[0]-=bt,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var vt=0;vt>26)-(Rt/67108864|0),this.words[mt+ct]=xt&67108863}for(;mt>26,this.words[mt+ct]=xt&67108863;if(At===0)return this.strip();for(j(At===-1),At=0,mt=0;mt>26,this.words[mt]=xt&67108863;return this.negative=1,this.strip()},tt.prototype._wordDiv=function(bt,vt){var ct=this.length-bt.length,dt=this.clone(),mt=bt,xt=mt.words[mt.length-1]|0,At=this._countBits(xt);ct=26-At,ct!==0&&(mt=mt.ushln(ct),dt.iushln(ct),xt=mt.words[mt.length-1]|0);var Rt=dt.length-mt.length,St;if(vt!=="mod"){St=new tt(null),St.length=Rt+1,St.words=new Array(St.length);for(var Tt=0;Tt=0;Nt--){var tr=(dt.words[mt.length+Nt]|0)*67108864+(dt.words[mt.length+Nt-1]|0);for(tr=Math.min(tr/xt|0,67108863),dt._ishlnsubmul(mt,tr,Nt);dt.negative!==0;)tr--,dt.negative=0,dt._ishlnsubmul(mt,1,Nt),dt.isZero()||(dt.negative^=1);St&&(St.words[Nt]=tr)}return St&&St.strip(),dt.strip(),vt!=="div"&&ct!==0&&dt.iushrn(ct),{div:St||null,mod:dt}},tt.prototype.divmod=function(bt,vt,ct){if(j(!bt.isZero()),this.isZero())return{div:new tt(0),mod:new tt(0)};var dt,mt,xt;return this.negative!==0&&bt.negative===0?(xt=this.neg().divmod(bt,vt),vt!=="mod"&&(dt=xt.div.neg()),vt!=="div"&&(mt=xt.mod.neg(),ct&&mt.negative!==0&&mt.iadd(bt)),{div:dt,mod:mt}):this.negative===0&&bt.negative!==0?(xt=this.divmod(bt.neg(),vt),vt!=="mod"&&(dt=xt.div.neg()),{div:dt,mod:xt.mod}):this.negative&bt.negative?(xt=this.neg().divmod(bt.neg(),vt),vt!=="div"&&(mt=xt.mod.neg(),ct&&mt.negative!==0&&mt.isub(bt)),{div:xt.div,mod:mt}):bt.length>this.length||this.cmp(bt)<0?{div:new tt(0),mod:this}:bt.length===1?vt==="div"?{div:this.divn(bt.words[0]),mod:null}:vt==="mod"?{div:null,mod:new tt(this.modn(bt.words[0]))}:{div:this.divn(bt.words[0]),mod:new tt(this.modn(bt.words[0]))}:this._wordDiv(bt,vt)},tt.prototype.div=function(bt){return this.divmod(bt,"div",!1).div},tt.prototype.mod=function(bt){return this.divmod(bt,"mod",!1).mod},tt.prototype.umod=function(bt){return this.divmod(bt,"mod",!0).mod},tt.prototype.divRound=function(bt){var vt=this.divmod(bt);if(vt.mod.isZero())return vt.div;var ct=vt.div.negative!==0?vt.mod.isub(bt):vt.mod,dt=bt.ushrn(1),mt=bt.andln(1),xt=ct.cmp(dt);return xt<0||mt===1&&xt===0?vt.div:vt.div.negative!==0?vt.div.isubn(1):vt.div.iaddn(1)},tt.prototype.modn=function(bt){j(bt<=67108863);for(var vt=(1<<26)%bt,ct=0,dt=this.length-1;dt>=0;dt--)ct=(vt*ct+(this.words[dt]|0))%bt;return ct},tt.prototype.idivn=function(bt){j(bt<=67108863);for(var vt=0,ct=this.length-1;ct>=0;ct--){var dt=(this.words[ct]|0)+vt*67108864;this.words[ct]=dt/bt|0,vt=dt%bt}return this.strip()},tt.prototype.divn=function(bt){return this.clone().idivn(bt)},tt.prototype.egcd=function(bt){j(bt.negative===0),j(!bt.isZero());var vt=this,ct=bt.clone();vt.negative!==0?vt=vt.umod(bt):vt=vt.clone();for(var dt=new tt(1),mt=new tt(0),xt=new tt(0),At=new tt(1),Rt=0;vt.isEven()&&ct.isEven();)vt.iushrn(1),ct.iushrn(1),++Rt;for(var St=ct.clone(),Tt=vt.clone();!vt.isZero();){for(var Et=0,Nt=1;!(vt.words[0]&Nt)&&Et<26;++Et,Nt<<=1);if(Et>0)for(vt.iushrn(Et);Et-- >0;)(dt.isOdd()||mt.isOdd())&&(dt.iadd(St),mt.isub(Tt)),dt.iushrn(1),mt.iushrn(1);for(var tr=0,ir=1;!(ct.words[0]&ir)&&tr<26;++tr,ir<<=1);if(tr>0)for(ct.iushrn(tr);tr-- >0;)(xt.isOdd()||At.isOdd())&&(xt.iadd(St),At.isub(Tt)),xt.iushrn(1),At.iushrn(1);vt.cmp(ct)>=0?(vt.isub(ct),dt.isub(xt),mt.isub(At)):(ct.isub(vt),xt.isub(dt),At.isub(mt))}return{a:xt,b:At,gcd:ct.iushln(Rt)}},tt.prototype._invmp=function(bt){j(bt.negative===0),j(!bt.isZero());var vt=this,ct=bt.clone();vt.negative!==0?vt=vt.umod(bt):vt=vt.clone();for(var dt=new tt(1),mt=new tt(0),xt=ct.clone();vt.cmpn(1)>0&&ct.cmpn(1)>0;){for(var At=0,Rt=1;!(vt.words[0]&Rt)&&At<26;++At,Rt<<=1);if(At>0)for(vt.iushrn(At);At-- >0;)dt.isOdd()&&dt.iadd(xt),dt.iushrn(1);for(var St=0,Tt=1;!(ct.words[0]&Tt)&&St<26;++St,Tt<<=1);if(St>0)for(ct.iushrn(St);St-- >0;)mt.isOdd()&&mt.iadd(xt),mt.iushrn(1);vt.cmp(ct)>=0?(vt.isub(ct),dt.isub(mt)):(ct.isub(vt),mt.isub(dt))}var Et;return vt.cmpn(1)===0?Et=dt:Et=mt,Et.cmpn(0)<0&&Et.iadd(bt),Et},tt.prototype.gcd=function(bt){if(this.isZero())return bt.abs();if(bt.isZero())return this.abs();var vt=this.clone(),ct=bt.clone();vt.negative=0,ct.negative=0;for(var dt=0;vt.isEven()&&ct.isEven();dt++)vt.iushrn(1),ct.iushrn(1);do{for(;vt.isEven();)vt.iushrn(1);for(;ct.isEven();)ct.iushrn(1);var mt=vt.cmp(ct);if(mt<0){var xt=vt;vt=ct,ct=xt}else if(mt===0||ct.cmpn(1)===0)break;vt.isub(ct)}while(!0);return ct.iushln(dt)},tt.prototype.invm=function(bt){return this.egcd(bt).a.umod(bt)},tt.prototype.isEven=function(){return(this.words[0]&1)===0},tt.prototype.isOdd=function(){return(this.words[0]&1)===1},tt.prototype.andln=function(bt){return this.words[0]&bt},tt.prototype.bincn=function(bt){j(typeof bt=="number");var vt=bt%26,ct=(bt-vt)/26,dt=1<>>26,At&=67108863,this.words[xt]=At}return mt!==0&&(this.words[xt]=mt,this.length++),this},tt.prototype.isZero=function(){return this.length===1&&this.words[0]===0},tt.prototype.cmpn=function(bt){var vt=bt<0;if(this.negative!==0&&!vt)return-1;if(this.negative===0&&vt)return 1;this.strip();var ct;if(this.length>1)ct=1;else{vt&&(bt=-bt),j(bt<=67108863,"Number is too big");var dt=this.words[0]|0;ct=dt===bt?0:dtbt.length)return 1;if(this.length=0;ct--){var dt=this.words[ct]|0,mt=bt.words[ct]|0;if(dt!==mt){dtmt&&(vt=1);break}}return vt},tt.prototype.gtn=function(bt){return this.cmpn(bt)===1},tt.prototype.gt=function(bt){return this.cmp(bt)===1},tt.prototype.gten=function(bt){return this.cmpn(bt)>=0},tt.prototype.gte=function(bt){return this.cmp(bt)>=0},tt.prototype.ltn=function(bt){return this.cmpn(bt)===-1},tt.prototype.lt=function(bt){return this.cmp(bt)===-1},tt.prototype.lten=function(bt){return this.cmpn(bt)<=0},tt.prototype.lte=function(bt){return this.cmp(bt)<=0},tt.prototype.eqn=function(bt){return this.cmpn(bt)===0},tt.prototype.eq=function(bt){return this.cmp(bt)===0},tt.red=function(bt){return new Bt(bt)},tt.prototype.toRed=function(bt){return j(!this.red,"Already a number in reduction context"),j(this.negative===0,"red works only with positives"),bt.convertTo(this)._forceRed(bt)},tt.prototype.fromRed=function(){return j(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},tt.prototype._forceRed=function(bt){return this.red=bt,this},tt.prototype.forceRed=function(bt){return j(!this.red,"Already a number in reduction context"),this._forceRed(bt)},tt.prototype.redAdd=function(bt){return j(this.red,"redAdd works only with red numbers"),this.red.add(this,bt)},tt.prototype.redIAdd=function(bt){return j(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,bt)},tt.prototype.redSub=function(bt){return j(this.red,"redSub works only with red numbers"),this.red.sub(this,bt)},tt.prototype.redISub=function(bt){return j(this.red,"redISub works only with red numbers"),this.red.isub(this,bt)},tt.prototype.redShl=function(bt){return j(this.red,"redShl works only with red numbers"),this.red.shl(this,bt)},tt.prototype.redMul=function(bt){return j(this.red,"redMul works only with red numbers"),this.red._verify2(this,bt),this.red.mul(this,bt)},tt.prototype.redIMul=function(bt){return j(this.red,"redMul works only with red numbers"),this.red._verify2(this,bt),this.red.imul(this,bt)},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(bt){return j(this.red&&!bt.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,bt)};var Mt={k256:null,p224:null,p192:null,p25519:null};function Lt(jt,bt){this.name=jt,this.p=new tt(bt,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 bt=new tt(null);return bt.words=new Array(Math.ceil(this.n/13)),bt},Lt.prototype.ireduce=function(bt){var vt=bt,ct;do this.split(vt,this.tmp),vt=this.imulK(vt),vt=vt.iadd(this.tmp),ct=vt.bitLength();while(ct>this.n);var dt=ct0?vt.isub(this.p):vt.strip!==void 0?vt.strip():vt._strip(),vt},Lt.prototype.split=function(bt,vt){bt.iushrn(this.n,0,vt)},Lt.prototype.imulK=function(bt){return bt.imul(this.k)};function Dt(){Lt.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}et(Dt,Lt),Dt.prototype.split=function(bt,vt){for(var ct=4194303,dt=Math.min(bt.length,9),mt=0;mt>>22,xt=At}xt>>>=22,bt.words[mt-10]=xt,xt===0&&bt.length>10?bt.length-=10:bt.length-=9},Dt.prototype.imulK=function(bt){bt.words[bt.length]=0,bt.words[bt.length+1]=0,bt.length+=2;for(var vt=0,ct=0;ct>>=26,bt.words[ct]=mt,vt=dt}return vt!==0&&(bt.words[bt.length++]=vt),bt},tt._prime=function(bt){if(Mt[bt])return Mt[bt];var vt;if(bt==="k256")vt=new Dt;else if(bt==="p224")vt=new zt;else if(bt==="p192")vt=new Ot;else if(bt==="p25519")vt=new It;else throw new Error("Unknown prime "+bt);return Mt[bt]=vt,vt};function Bt(jt){if(typeof jt=="string"){var bt=tt._prime(jt);this.m=bt.p,this.prime=bt}else j(jt.gtn(1),"modulus must be greater than 1"),this.m=jt,this.prime=null}Bt.prototype._verify1=function(bt){j(bt.negative===0,"red works only with positives"),j(bt.red,"red works only with red numbers")},Bt.prototype._verify2=function(bt,vt){j((bt.negative|vt.negative)===0,"red works only with positives"),j(bt.red&&bt.red===vt.red,"red works only with red numbers")},Bt.prototype.imod=function(bt){return this.prime?this.prime.ireduce(bt)._forceRed(this):bt.umod(this.m)._forceRed(this)},Bt.prototype.neg=function(bt){return bt.isZero()?bt.clone():this.m.sub(bt)._forceRed(this)},Bt.prototype.add=function(bt,vt){this._verify2(bt,vt);var ct=bt.add(vt);return ct.cmp(this.m)>=0&&ct.isub(this.m),ct._forceRed(this)},Bt.prototype.iadd=function(bt,vt){this._verify2(bt,vt);var ct=bt.iadd(vt);return ct.cmp(this.m)>=0&&ct.isub(this.m),ct},Bt.prototype.sub=function(bt,vt){this._verify2(bt,vt);var ct=bt.sub(vt);return ct.cmpn(0)<0&&ct.iadd(this.m),ct._forceRed(this)},Bt.prototype.isub=function(bt,vt){this._verify2(bt,vt);var ct=bt.isub(vt);return ct.cmpn(0)<0&&ct.iadd(this.m),ct},Bt.prototype.shl=function(bt,vt){return this._verify1(bt),this.imod(bt.ushln(vt))},Bt.prototype.imul=function(bt,vt){return this._verify2(bt,vt),this.imod(bt.imul(vt))},Bt.prototype.mul=function(bt,vt){return this._verify2(bt,vt),this.imod(bt.mul(vt))},Bt.prototype.isqr=function(bt){return this.imul(bt,bt.clone())},Bt.prototype.sqr=function(bt){return this.mul(bt,bt)},Bt.prototype.sqrt=function(bt){if(bt.isZero())return bt.clone();var vt=this.m.andln(3);if(j(vt%2===1),vt===3){var ct=this.m.add(new tt(1)).iushrn(2);return this.pow(bt,ct)}for(var dt=this.m.subn(1),mt=0;!dt.isZero()&&dt.andln(1)===0;)mt++,dt.iushrn(1);j(!dt.isZero());var xt=new tt(1).toRed(this),At=xt.redNeg(),Rt=this.m.subn(1).iushrn(1),St=this.m.bitLength();for(St=new tt(2*St*St).toRed(this);this.pow(St,Rt).cmp(At)!==0;)St.redIAdd(At);for(var Tt=this.pow(St,dt),Et=this.pow(bt,dt.addn(1).iushrn(1)),Nt=this.pow(bt,dt),tr=mt;Nt.cmp(xt)!==0;){for(var ir=Nt,nr=0;ir.cmp(xt)!==0;nr++)ir=ir.redSqr();j(nr=0;mt--){for(var Tt=vt.words[mt],Et=St-1;Et>=0;Et--){var Nt=Tt>>Et&1;if(xt!==dt[0]&&(xt=this.sqr(xt)),Nt===0&&At===0){Rt=0;continue}At<<=1,At|=Nt,Rt++,!(Rt!==ct&&(mt!==0||Et!==0))&&(xt=this.mul(xt,dt[At]),Rt=0,At=0)}St=26}return xt},Bt.prototype.convertTo=function(bt){var vt=bt.umod(this.m);return vt===bt?vt.clone():vt},Bt.prototype.convertFrom=function(bt){var vt=bt.clone();return vt.red=null,vt},tt.mont=function(bt){return new Ft(bt)};function Ft(jt){Bt.call(this,jt),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,Bt),Ft.prototype.convertTo=function(bt){return this.imod(bt.ushln(this.shift))},Ft.prototype.convertFrom=function(bt){var vt=this.imod(bt.mul(this.rinv));return vt.red=null,vt},Ft.prototype.imul=function(bt,vt){if(bt.isZero()||vt.isZero())return bt.words[0]=0,bt.length=1,bt;var ct=bt.imul(vt),dt=ct.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),mt=ct.isub(dt).iushrn(this.shift),xt=mt;return mt.cmp(this.m)>=0?xt=mt.isub(this.m):mt.cmpn(0)<0&&(xt=mt.iadd(this.m)),xt._forceRed(this)},Ft.prototype.mul=function(bt,vt){if(bt.isZero()||vt.isZero())return new tt(0)._forceRed(this);var ct=bt.mul(vt),dt=ct.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),mt=ct.isub(dt).iushrn(this.shift),xt=mt;return mt.cmp(this.m)>=0?xt=mt.isub(this.m):mt.cmpn(0)<0&&(xt=mt.iadd(this.m)),xt._forceRed(this)},Ft.prototype.invm=function(bt){var vt=this.imod(bt._invmp(this.m).mul(this.r2));return vt._forceRed(this)}})(a,commonjsGlobal)})(bn$4);var bnExports$1=bn$4.exports;const BN$9=getDefaultExportFromCjs$1(bnExports$1);var brorand={exports:{}},hasRequiredBrorand;function requireBrorand(){if(hasRequiredBrorand)return brorand.exports;hasRequiredBrorand=1;var a;brorand.exports=function(et){return a||(a=new _(null)),a.generate(et)};function _(j){this.rand=j}if(brorand.exports.Rand=_,_.prototype.generate=function(et){return this._rand(et)},_.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=a.mont(et),st=new a(1).toRed(it);tt||(tt=Math.max(1,nt/48|0));for(var ot=et.subn(1),at=0;!ot.testn(at);at++);for(var ut=et.shrn(at),ht=ot.toRed(it),yt=!0;tt>0;tt--){var wt=this._randrange(new a(2),ot);rt&&rt(wt);var Ct=wt.toRed(it).redPow(ut);if(!(Ct.cmp(st)===0||Ct.cmp(ht)===0)){for(var Pt=1;Pt0;tt--){var ht=this._randrange(new a(2),st),yt=et.gcd(ht);if(yt.cmpn(1)!==0)return yt;var wt=ht.toRed(nt).redPow(at);if(!(wt.cmp(it)===0||wt.cmp(ut)===0)){for(var Ct=1;CtPt;)Mt.ishrn(1);if(Mt.isEven()&&Mt.iadd(tt),Mt.testn(1)||Mt.iadd(rt),$t.cmp(rt)){if(!$t.cmp(nt))for(;Mt.mod(it).cmp(st);)Mt.iadd(at)}else for(;Mt.mod($).cmp(ot);)Mt.iadd(at);if(Lt=Mt.shrn(1),yt(Lt)&&yt(Mt)&&wt(Lt)&&wt(Mt)&&et.test(Lt)&&et.test(Mt))return Mt}}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 a=bnExports$1,_=requireMr(),$=new _,j=new a(24),et=new a(11),tt=new a(10),rt=new a(3),nt=new a(7),it=requireGeneratePrime(),st=requireBrowser$8();dh=yt;function ot(Ct,Pt){return Pt=Pt||"utf8",Buffer$g.isBuffer(Ct)||(Ct=new Buffer$g(Ct,Pt)),this._pub=new a(Ct),this}function at(Ct,Pt){return Pt=Pt||"utf8",Buffer$g.isBuffer(Ct)||(Ct=new Buffer$g(Ct,Pt)),this._priv=new a(Ct),this}var ut={};function ht(Ct,Pt){var $t=Pt.toString("hex"),Mt=[$t,Ct.toString(16)].join("_");if(Mt in ut)return ut[Mt];var Lt=0;if(Ct.isEven()||!it.simpleSieve||!it.fermatTest(Ct)||!$.test(Ct))return Lt+=1,$t==="02"||$t==="05"?Lt+=8:Lt+=4,ut[Mt]=Lt,Lt;$.test(Ct.shrn(1))||(Lt+=2);var Dt;switch($t){case"02":Ct.mod(j).cmp(et)&&(Lt+=8);break;case"05":Dt=Ct.mod(tt),Dt.cmp(rt)&&Dt.cmp(nt)&&(Lt+=8);break;default:Lt+=4}return ut[Mt]=Lt,Lt}function yt(Ct,Pt,$t){this.setGenerator(Pt),this.__prime=new a(Ct),this._prime=a.mont(this.__prime),this._primeLen=Ct.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,$t?(this.setPublicKey=ot,this.setPrivateKey=at):this._primeCode=8}Object.defineProperty(yt.prototype,"verifyError",{enumerable:!0,get:function(){return typeof this._primeCode!="number"&&(this._primeCode=ht(this.__prime,this.__gen)),this._primeCode}}),yt.prototype.generateKeys=function(){return this._priv||(this._priv=new a(st(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},yt.prototype.computeSecret=function(Ct){Ct=new a(Ct),Ct=Ct.toRed(this._prime);var Pt=Ct.redPow(this._priv).fromRed(),$t=new Buffer$g(Pt.toArray()),Mt=this.getPrime();if($t.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:a}:processNextickArgs.exports=process$1$1;function a(_,$,j,et){if(typeof _!="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(_);case 2:return process$1$1.nextTick(function(){_.call(null,$)});case 3:return process$1$1.nextTick(function(){_.call(null,$,j)});case 4:return process$1$1.nextTick(function(){_.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 yt(wt){return Object.prototype.toString.call(wt)}return util$4}var BufferList={exports:{}},hasRequiredBufferList;function requireBufferList(){return hasRequiredBufferList||(hasRequiredBufferList=1,function(a){function _(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)}a.exports=function(){function tt(){_(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,st=""+it.data;it=it.next;)st+=nt+it.data;return st},tt.prototype.concat=function(nt){if(this.length===0)return $.alloc(0);for(var it=$.allocUnsafe(nt>>>0),st=this.head,ot=0;st;)et(st.data,it,ot),ot+=st.data.length,st=st.next;return it},tt}(),j&&j.inspect&&j.inspect.custom&&(a.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 a=requireProcessNextickArgs();function _(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,a.nextTick(j,this,et)):a.nextTick(j,this,et)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(et||null,function(st){!tt&&st?rt._writableState?rt._writableState.errorEmitted||(rt._writableState.errorEmitted=!0,a.nextTick(j,rt,st)):a.nextTick(j,rt,st):tt&&tt(st)}),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:_,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 a=requireProcessNextickArgs();_stream_writable=wt;function _(xt){var At=this;this.next=null,this.entry=null,this.finish=function(){mt(At,xt)}}var $=!process$1$1.browser&&["v0.10","v0.9."].indexOf(process$1$1.version.slice(0,5))>-1?setImmediate:a.nextTick,j;wt.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 st(xt){return nt.from(xt)}function ot(xt){return nt.isBuffer(xt)||xt instanceof it}var at=requireDestroy();et.inherits(wt,rt);function ut(){}function ht(xt,At){j=j||require_stream_duplex(),xt=xt||{};var Rt=At instanceof j;this.objectMode=!!xt.objectMode,Rt&&(this.objectMode=this.objectMode||!!xt.writableObjectMode);var St=xt.highWaterMark,Tt=xt.writableHighWaterMark,Et=this.objectMode?16:16*1024;St||St===0?this.highWaterMark=St:Rt&&(Tt||Tt===0)?this.highWaterMark=Tt:this.highWaterMark=Et,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 Nt=xt.decodeStrings===!1;this.decodeStrings=!Nt,this.defaultEncoding=xt.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(tr){Ot(At,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 _(this)}ht.prototype.getBuffer=function(){for(var At=this.bufferedRequest,Rt=[];At;)Rt.push(At),At=At.next;return Rt},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 yt;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(yt=Function.prototype[Symbol.hasInstance],Object.defineProperty(wt,Symbol.hasInstance,{value:function(xt){return yt.call(this,xt)?!0:this!==wt?!1:xt&&xt._writableState instanceof ht}})):yt=function(xt){return xt instanceof this};function wt(xt){if(j=j||require_stream_duplex(),!yt.call(wt,this)&&!(this instanceof j))return new wt(xt);this._writableState=new ht(xt,this),this.writable=!0,xt&&(typeof xt.write=="function"&&(this._write=xt.write),typeof xt.writev=="function"&&(this._writev=xt.writev),typeof xt.destroy=="function"&&(this._destroy=xt.destroy),typeof xt.final=="function"&&(this._final=xt.final)),rt.call(this)}wt.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function Ct(xt,At){var Rt=new Error("write after end");xt.emit("error",Rt),a.nextTick(At,Rt)}function Pt(xt,At,Rt,St){var Tt=!0,Et=!1;return Rt===null?Et=new TypeError("May not write null values to stream"):typeof Rt!="string"&&Rt!==void 0&&!At.objectMode&&(Et=new TypeError("Invalid non-string/buffer chunk")),Et&&(xt.emit("error",Et),a.nextTick(St,Et),Tt=!1),Tt}wt.prototype.write=function(xt,At,Rt){var St=this._writableState,Tt=!1,Et=!St.objectMode&&ot(xt);return Et&&!nt.isBuffer(xt)&&(xt=st(xt)),typeof At=="function"&&(Rt=At,At=null),Et?At="buffer":At||(At=St.defaultEncoding),typeof Rt!="function"&&(Rt=ut),St.ended?Ct(this,Rt):(Et||Pt(this,St,xt,Rt))&&(St.pendingcb++,Tt=Mt(this,St,Et,xt,At,Rt)),Tt},wt.prototype.cork=function(){var xt=this._writableState;xt.corked++},wt.prototype.uncork=function(){var xt=this._writableState;xt.corked&&(xt.corked--,!xt.writing&&!xt.corked&&!xt.bufferProcessing&&xt.bufferedRequest&&Ft(this,xt))},wt.prototype.setDefaultEncoding=function(At){if(typeof At=="string"&&(At=At.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((At+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+At);return this._writableState.defaultEncoding=At,this};function $t(xt,At,Rt){return!xt.objectMode&&xt.decodeStrings!==!1&&typeof At=="string"&&(At=nt.from(At,Rt)),At}Object.defineProperty(wt.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Mt(xt,At,Rt,St,Tt,Et){if(!Rt){var Nt=$t(At,St,Tt);St!==Nt&&(Rt=!0,Tt="buffer",St=Nt)}var tr=At.objectMode?1:St.length;At.length+=tr;var ir=At.length>5===6?2:Pt>>4===14?3:Pt>>3===30?4:Pt>>6===2?-1:-2}function rt(Pt,$t,Mt){var Lt=$t.length-1;if(Lt=0?(Dt>0&&(Pt.lastNeed=Dt-1),Dt):--Lt=0?(Dt>0&&(Pt.lastNeed=Dt-2),Dt):--Lt=0?(Dt>0&&(Dt===2?Dt=0:Pt.lastNeed=Dt-3),Dt):0))}function nt(Pt,$t,Mt){if(($t[0]&192)!==128)return Pt.lastNeed=0,"�";if(Pt.lastNeed>1&&$t.length>1){if(($t[1]&192)!==128)return Pt.lastNeed=1,"�";if(Pt.lastNeed>2&&$t.length>2&&($t[2]&192)!==128)return Pt.lastNeed=2,"�"}}function it(Pt){var $t=this.lastTotal-this.lastNeed,Mt=nt(this,Pt);if(Mt!==void 0)return Mt;if(this.lastNeed<=Pt.length)return Pt.copy(this.lastChar,$t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);Pt.copy(this.lastChar,$t,0,Pt.length),this.lastNeed-=Pt.length}function st(Pt,$t){var Mt=rt(this,Pt,$t);if(!this.lastNeed)return Pt.toString("utf8",$t);this.lastTotal=Mt;var Lt=Pt.length-(Mt-this.lastNeed);return Pt.copy(this.lastChar,0,Lt),Pt.toString("utf8",$t,Lt)}function ot(Pt){var $t=Pt&&Pt.length?this.write(Pt):"";return this.lastNeed?$t+"�":$t}function at(Pt,$t){if((Pt.length-$t)%2===0){var Mt=Pt.toString("utf16le",$t);if(Mt){var Lt=Mt.charCodeAt(Mt.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],Mt.slice(0,-1)}return Mt}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=Pt[Pt.length-1],Pt.toString("utf16le",$t,Pt.length-1)}function ut(Pt){var $t=Pt&&Pt.length?this.write(Pt):"";if(this.lastNeed){var Mt=this.lastTotal-this.lastNeed;return $t+this.lastChar.toString("utf16le",0,Mt)}return $t}function ht(Pt,$t){var Mt=(Pt.length-$t)%3;return Mt===0?Pt.toString("base64",$t):(this.lastNeed=3-Mt,this.lastTotal=3,Mt===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",$t,Pt.length-Mt))}function yt(Pt){var $t=Pt&&Pt.length?this.write(Pt):"";return this.lastNeed?$t+this.lastChar.toString("base64",0,3-this.lastNeed):$t}function wt(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 a=requireProcessNextickArgs();_stream_readable=$t;var _=requireIsarray(),$;$t.ReadableState=Pt,eventsExports.EventEmitter;var j=function(Zt,Kt){return Zt.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(Zt){return tt.from(Zt)}function it(Zt){return tt.isBuffer(Zt)||Zt instanceof rt}var st=Object.create(requireUtil());st.inherits=inherits_browserExports;var ot=util$5,at=void 0;ot&&ot.debuglog?at=ot.debuglog("stream"):at=function(){};var ut=requireBufferList(),ht=requireDestroy(),yt;st.inherits($t,et);var wt=["error","close","destroy","pause","resume"];function Ct(Zt,Kt,Qt){if(typeof Zt.prependListener=="function")return Zt.prependListener(Kt,Qt);!Zt._events||!Zt._events[Kt]?Zt.on(Kt,Qt):_(Zt._events[Kt])?Zt._events[Kt].unshift(Qt):Zt._events[Kt]=[Qt,Zt._events[Kt]]}function Pt(Zt,Kt){$=$||require_stream_duplex(),Zt=Zt||{};var Qt=Kt instanceof $;this.objectMode=!!Zt.objectMode,Qt&&(this.objectMode=this.objectMode||!!Zt.readableObjectMode);var Ht=Zt.highWaterMark,qt=Zt.readableHighWaterMark,Jt=this.objectMode?16:16*1024;Ht||Ht===0?this.highWaterMark=Ht:Qt&&(qt||qt===0)?this.highWaterMark=qt:this.highWaterMark=Jt,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=Zt.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,Zt.encoding&&(yt||(yt=requireString_decoder().StringDecoder),this.decoder=new yt(Zt.encoding),this.encoding=Zt.encoding)}function $t(Zt){if($=$||require_stream_duplex(),!(this instanceof $t))return new $t(Zt);this._readableState=new Pt(Zt,this),this.readable=!0,Zt&&(typeof Zt.read=="function"&&(this._read=Zt.read),typeof Zt.destroy=="function"&&(this._destroy=Zt.destroy)),et.call(this)}Object.defineProperty($t.prototype,"destroyed",{get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(Zt){this._readableState&&(this._readableState.destroyed=Zt)}}),$t.prototype.destroy=ht.destroy,$t.prototype._undestroy=ht.undestroy,$t.prototype._destroy=function(Zt,Kt){this.push(null),Kt(Zt)},$t.prototype.push=function(Zt,Kt){var Qt=this._readableState,Ht;return Qt.objectMode?Ht=!0:typeof Zt=="string"&&(Kt=Kt||Qt.defaultEncoding,Kt!==Qt.encoding&&(Zt=tt.from(Zt,Kt),Kt=""),Ht=!0),Mt(this,Zt,Kt,!1,Ht)},$t.prototype.unshift=function(Zt){return Mt(this,Zt,null,!0,!1)};function Mt(Zt,Kt,Qt,Ht,qt){var Jt=Zt._readableState;if(Kt===null)Jt.reading=!1,Ft(Zt,Jt);else{var ur;qt||(ur=Dt(Jt,Kt)),ur?Zt.emit("error",ur):Jt.objectMode||Kt&&Kt.length>0?(typeof Kt!="string"&&!Jt.objectMode&&Object.getPrototypeOf(Kt)!==tt.prototype&&(Kt=nt(Kt)),Ht?Jt.endEmitted?Zt.emit("error",new Error("stream.unshift() after end event")):Lt(Zt,Jt,Kt,!0):Jt.ended?Zt.emit("error",new Error("stream.push() after EOF")):(Jt.reading=!1,Jt.decoder&&!Qt?(Kt=Jt.decoder.write(Kt),Jt.objectMode||Kt.length!==0?Lt(Zt,Jt,Kt,!1):vt(Zt,Jt)):Lt(Zt,Jt,Kt,!1))):Ht||(Jt.reading=!1)}return zt(Jt)}function Lt(Zt,Kt,Qt,Ht){Kt.flowing&&Kt.length===0&&!Kt.sync?(Zt.emit("data",Qt),Zt.read(0)):(Kt.length+=Kt.objectMode?1:Qt.length,Ht?Kt.buffer.unshift(Qt):Kt.buffer.push(Qt),Kt.needReadable&&jt(Zt)),vt(Zt,Kt)}function Dt(Zt,Kt){var Qt;return!it(Kt)&&typeof Kt!="string"&&Kt!==void 0&&!Zt.objectMode&&(Qt=new TypeError("Invalid non-string/buffer chunk")),Qt}function zt(Zt){return!Zt.ended&&(Zt.needReadable||Zt.length=Ot?Zt=Ot:(Zt--,Zt|=Zt>>>1,Zt|=Zt>>>2,Zt|=Zt>>>4,Zt|=Zt>>>8,Zt|=Zt>>>16,Zt++),Zt}function Bt(Zt,Kt){return Zt<=0||Kt.length===0&&Kt.ended?0:Kt.objectMode?1:Zt!==Zt?Kt.flowing&&Kt.length?Kt.buffer.head.data.length:Kt.length:(Zt>Kt.highWaterMark&&(Kt.highWaterMark=It(Zt)),Zt<=Kt.length?Zt:Kt.ended?Kt.length:(Kt.needReadable=!0,0))}$t.prototype.read=function(Zt){at("read",Zt),Zt=parseInt(Zt,10);var Kt=this._readableState,Qt=Zt;if(Zt!==0&&(Kt.emittedReadable=!1),Zt===0&&Kt.needReadable&&(Kt.length>=Kt.highWaterMark||Kt.ended))return at("read: emitReadable",Kt.length,Kt.ended),Kt.length===0&&Kt.ended?tr(this):jt(this),null;if(Zt=Bt(Zt,Kt),Zt===0&&Kt.ended)return Kt.length===0&&tr(this),null;var Ht=Kt.needReadable;at("need readable",Ht),(Kt.length===0||Kt.length-Zt0?qt=St(Zt,Kt):qt=null,qt===null?(Kt.needReadable=!0,Zt=0):Kt.length-=Zt,Kt.length===0&&(Kt.ended||(Kt.needReadable=!0),Qt!==Zt&&Kt.ended&&tr(this)),qt!==null&&this.emit("data",qt),qt};function Ft(Zt,Kt){if(!Kt.ended){if(Kt.decoder){var Qt=Kt.decoder.end();Qt&&Qt.length&&(Kt.buffer.push(Qt),Kt.length+=Kt.objectMode?1:Qt.length)}Kt.ended=!0,jt(Zt)}}function jt(Zt){var Kt=Zt._readableState;Kt.needReadable=!1,Kt.emittedReadable||(at("emitReadable",Kt.flowing),Kt.emittedReadable=!0,Kt.sync?a.nextTick(bt,Zt):bt(Zt))}function bt(Zt){at("emit readable"),Zt.emit("readable"),Rt(Zt)}function vt(Zt,Kt){Kt.readingMore||(Kt.readingMore=!0,a.nextTick(ct,Zt,Kt))}function ct(Zt,Kt){for(var Qt=Kt.length;!Kt.reading&&!Kt.flowing&&!Kt.ended&&Kt.length1&&nr(Ht.pipes,Zt)!==-1)&&!Cr&&(at("false write response, pause",Ht.awaitDrain),Ht.awaitDrain++,lr=!0),Qt.pause())}function _r($r){at("onerror",$r),Ar(),Zt.removeListener("error",_r),j(Zt,"error")===0&&Zt.emit("error",$r)}Ct(Zt,"error",_r);function Sr(){Zt.removeListener("finish",kr),Ar()}Zt.once("close",Sr);function kr(){at("onfinish"),Zt.removeListener("close",Sr),Ar()}Zt.once("finish",kr);function Ar(){at("unpipe"),Qt.unpipe(Zt)}return Zt.emit("pipe",Qt),Ht.flowing||(at("pipe resume"),Qt.resume()),Zt};function dt(Zt){return function(){var Kt=Zt._readableState;at("pipeOnDrain",Kt.awaitDrain),Kt.awaitDrain&&Kt.awaitDrain--,Kt.awaitDrain===0&&j(Zt,"data")&&(Kt.flowing=!0,Rt(Zt))}}$t.prototype.unpipe=function(Zt){var Kt=this._readableState,Qt={hasUnpiped:!1};if(Kt.pipesCount===0)return this;if(Kt.pipesCount===1)return Zt&&Zt!==Kt.pipes?this:(Zt||(Zt=Kt.pipes),Kt.pipes=null,Kt.pipesCount=0,Kt.flowing=!1,Zt&&Zt.emit("unpipe",this,Qt),this);if(!Zt){var Ht=Kt.pipes,qt=Kt.pipesCount;Kt.pipes=null,Kt.pipesCount=0,Kt.flowing=!1;for(var Jt=0;Jt=Kt.length?(Kt.decoder?Qt=Kt.buffer.join(""):Kt.buffer.length===1?Qt=Kt.buffer.head.data:Qt=Kt.buffer.concat(Kt.length),Kt.buffer.clear()):Qt=Tt(Zt,Kt.buffer,Kt.decoder),Qt}function Tt(Zt,Kt,Qt){var Ht;return ZtJt.length?Jt.length:Zt;if(ur===Jt.length?qt+=Jt:qt+=Jt.slice(0,Zt),Zt-=ur,Zt===0){ur===Jt.length?(++Ht,Qt.next?Kt.head=Qt.next:Kt.head=Kt.tail=null):(Kt.head=Qt,Qt.data=Jt.slice(ur));break}++Ht}return Kt.length-=Ht,qt}function Nt(Zt,Kt){var Qt=tt.allocUnsafe(Zt),Ht=Kt.head,qt=1;for(Ht.data.copy(Qt),Zt-=Ht.data.length;Ht=Ht.next;){var Jt=Ht.data,ur=Zt>Jt.length?Jt.length:Zt;if(Jt.copy(Qt,Qt.length-Zt,0,ur),Zt-=ur,Zt===0){ur===Jt.length?(++qt,Ht.next?Kt.head=Ht.next:Kt.head=Kt.tail=null):(Kt.head=Ht,Ht.data=Jt.slice(ur));break}++qt}return Kt.length-=qt,Qt}function tr(Zt){var Kt=Zt._readableState;if(Kt.length>0)throw new Error('"endReadable()" called on non-empty stream');Kt.endEmitted||(Kt.ended=!0,a.nextTick(ir,Kt,Zt))}function ir(Zt,Kt){!Zt.endEmitted&&Zt.length===0&&(Zt.endEmitted=!0,Kt.readable=!1,Kt.emit("end"))}function nr(Zt,Kt){for(var Qt=0,Ht=Zt.length;Qt0?ct:dt},tt.min=function(ct,dt){return ct.cmp(dt)<0?ct:dt},tt.prototype._init=function(ct,dt,mt){if(typeof ct=="number")return this._initNumber(ct,dt,mt);if(typeof ct=="object")return this._initArray(ct,dt,mt);dt==="hex"&&(dt=16),j(dt===(dt|0)&&dt>=2&&dt<=36),ct=ct.toString().replace(/\s+/g,"");var xt=0;ct[0]==="-"&&(xt++,this.negative=1),xt=0;xt-=3)Rt=ct[xt]|ct[xt-1]<<8|ct[xt-2]<<16,this.words[At]|=Rt<>>26-St&67108863,St+=24,St>=26&&(St-=26,At++);else if(mt==="le")for(xt=0,At=0;xt>>26-St&67108863,St+=24,St>=26&&(St-=26,At++);return this._strip()};function nt(vt,ct){var dt=vt.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 "+vt)}function it(vt,ct,dt){var mt=nt(vt,dt);return dt-1>=ct&&(mt|=nt(vt,dt-1)<<4),mt}tt.prototype._parseHex=function(ct,dt,mt){this.length=Math.ceil((ct.length-dt)/6),this.words=new Array(this.length);for(var xt=0;xt=dt;xt-=2)St=it(ct,dt,xt)<=18?(At-=18,Rt+=1,this.words[Rt]|=St>>>26):At+=8;else{var Tt=ct.length-dt;for(xt=Tt%2===0?dt+1:dt;xt=18?(At-=18,Rt+=1,this.words[Rt]|=St>>>26):At+=8}this._strip()};function st(vt,ct,dt,mt){for(var xt=0,At=0,Rt=Math.min(vt.length,dt),St=ct;St=49?At=Tt-49+10:Tt>=17?At=Tt-17+10:At=Tt,j(Tt>=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},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],yt=[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 mt;if(ct===16||ct==="hex"){mt="";for(var xt=0,At=0,Rt=0;Rt>>24-xt&16777215,xt+=2,xt>=26&&(xt-=26,Rt--),At!==0||Rt!==this.length-1?mt=ut[6-Tt.length]+Tt+mt:mt=Tt+mt}for(At!==0&&(mt=At.toString(16)+mt);mt.length%dt!==0;)mt="0"+mt;return this.negative!==0&&(mt="-"+mt),mt}if(ct===(ct|0)&&ct>=2&&ct<=36){var Et=ht[ct],Nt=yt[ct];mt="";var tr=this.clone();for(tr.negative=0;!tr.isZero();){var ir=tr.modrn(Nt).toString(ct);tr=tr.idivn(Nt),tr.isZero()?mt=ir+mt:mt=ut[Et-ir.length]+ir+mt}for(this.isZero()&&(mt="0"+mt);mt.length%dt!==0;)mt="0"+mt;return this.negative!==0&&(mt="-"+mt),mt}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 wt=function(ct,dt){return ct.allocUnsafe?ct.allocUnsafe(dt):new ct(dt)};tt.prototype.toArrayLike=function(ct,dt,mt){this._strip();var xt=this.byteLength(),At=mt||Math.max(1,xt);j(xt<=At,"byte array longer than desired length"),j(At>0,"Requested array length <= 0");var Rt=wt(ct,At),St=dt==="le"?"LE":"BE";return this["_toArrayLike"+St](Rt,xt),Rt},tt.prototype._toArrayLikeLE=function(ct,dt){for(var mt=0,xt=0,At=0,Rt=0;At>8&255),mt>16&255),Rt===6?(mt>24&255),xt=0,Rt=0):(xt=St>>>24,Rt+=2)}if(mt=0&&(ct[mt--]=St>>8&255),mt>=0&&(ct[mt--]=St>>16&255),Rt===6?(mt>=0&&(ct[mt--]=St>>24&255),xt=0,Rt=0):(xt=St>>>24,Rt+=2)}if(mt>=0)for(ct[mt--]=xt;mt>=0;)ct[mt--]=0},Math.clz32?tt.prototype._countBits=function(ct){return 32-Math.clz32(ct)}:tt.prototype._countBits=function(ct){var dt=ct,mt=0;return dt>=4096&&(mt+=13,dt>>>=13),dt>=64&&(mt+=7,dt>>>=7),dt>=8&&(mt+=4,dt>>>=4),dt>=2&&(mt+=2,dt>>>=2),mt+dt},tt.prototype._zeroBits=function(ct){if(ct===0)return 26;var dt=ct,mt=0;return dt&8191||(mt+=13,dt>>>=13),dt&127||(mt+=7,dt>>>=7),dt&15||(mt+=4,dt>>>=4),dt&3||(mt+=2,dt>>>=2),dt&1||mt++,mt},tt.prototype.bitLength=function(){var ct=this.words[this.length-1],dt=this._countBits(ct);return(this.length-1)*26+dt};function Ct(vt){for(var ct=new Array(vt.bitLength()),dt=0;dt>>xt&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 mt=0;mtct.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,mt;this.length>ct.length?(dt=this,mt=ct):(dt=ct,mt=this);for(var xt=0;xtct.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,mt=ct%26;this._expand(dt),mt>0&&dt--;for(var xt=0;xt0&&(this.words[xt]=~this.words[xt]&67108863>>26-mt),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 mt=ct/26|0,xt=ct%26;return this._expand(mt+1),dt?this.words[mt]=this.words[mt]|1<ct.length?(mt=this,xt=ct):(mt=ct,xt=this);for(var At=0,Rt=0;Rt>>26;for(;At!==0&&Rt>>26;if(this.length=mt.length,At!==0)this.words[this.length]=At,this.length++;else if(mt!==this)for(;Rtct.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 mt=this.cmp(ct);if(mt===0)return this.negative=0,this.length=1,this.words[0]=0,this;var xt,At;mt>0?(xt=this,At=ct):(xt=ct,At=this);for(var Rt=0,St=0;St>26,this.words[St]=dt&67108863;for(;Rt!==0&&St>26,this.words[St]=dt&67108863;if(Rt===0&&St>>26,tr=Tt&67108863,ir=Math.min(Et,ct.length-1),nr=Math.max(0,Et-vt.length+1);nr<=ir;nr++){var Zt=Et-nr|0;xt=vt.words[Zt]|0,At=ct.words[nr]|0,Rt=xt*At+tr,Nt+=Rt/67108864|0,tr=Rt&67108863}dt.words[Et]=tr|0,Tt=Nt|0}return Tt!==0?dt.words[Et]=Tt|0:dt.length--,dt._strip()}var $t=function(ct,dt,mt){var xt=ct.words,At=dt.words,Rt=mt.words,St=0,Tt,Et,Nt,tr=xt[0]|0,ir=tr&8191,nr=tr>>>13,Zt=xt[1]|0,Kt=Zt&8191,Qt=Zt>>>13,Ht=xt[2]|0,qt=Ht&8191,Jt=Ht>>>13,ur=xt[3]|0,xr=ur&8191,pr=ur>>>13,Cr=xt[4]|0,Mr=Cr&8191,lr=Cr>>>13,fr=xt[5]|0,_r=fr&8191,Sr=fr>>>13,kr=xt[6]|0,Ar=kr&8191,$r=kr>>>13,Or=xt[7]|0,Lr=Or&8191,or=Or>>>13,Yt=xt[8]|0,er=Yt&8191,Gt=Yt>>>13,Vt=xt[9]|0,Wt=Vt&8191,ar=Vt>>>13,yr=At[0]|0,Er=yr&8191,Rr=yr>>>13,Wr=At[1]|0,Hr=Wr&8191,Fr=Wr>>>13,pn=At[2]|0,Jr=pn&8191,Qr=pn>>>13,mn=At[3]|0,ln=mn&8191,qr=mn>>>13,En=At[4]|0,un=En&8191,Vr=En>>>13,hn=At[5]|0,fn=hn&8191,Kr=hn>>>13,Rn=At[6]|0,dn=Rn&8191,Gr=Rn>>>13,gn=At[7]|0,an=gn&8191,Zr=gn>>>13,An=At[8]|0,Sn=An&8191,nn=An>>>13,Pn=At[9]|0,yn=Pn&8191,_n=Pn>>>13;mt.negative=ct.negative^dt.negative,mt.length=19,Tt=Math.imul(ir,Er),Et=Math.imul(ir,Rr),Et=Et+Math.imul(nr,Er)|0,Nt=Math.imul(nr,Rr);var ds=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(ds>>>26)|0,ds&=67108863,Tt=Math.imul(Kt,Er),Et=Math.imul(Kt,Rr),Et=Et+Math.imul(Qt,Er)|0,Nt=Math.imul(Qt,Rr),Tt=Tt+Math.imul(ir,Hr)|0,Et=Et+Math.imul(ir,Fr)|0,Et=Et+Math.imul(nr,Hr)|0,Nt=Nt+Math.imul(nr,Fr)|0;var fs=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(fs>>>26)|0,fs&=67108863,Tt=Math.imul(qt,Er),Et=Math.imul(qt,Rr),Et=Et+Math.imul(Jt,Er)|0,Nt=Math.imul(Jt,Rr),Tt=Tt+Math.imul(Kt,Hr)|0,Et=Et+Math.imul(Kt,Fr)|0,Et=Et+Math.imul(Qt,Hr)|0,Nt=Nt+Math.imul(Qt,Fr)|0,Tt=Tt+Math.imul(ir,Jr)|0,Et=Et+Math.imul(ir,Qr)|0,Et=Et+Math.imul(nr,Jr)|0,Nt=Nt+Math.imul(nr,Qr)|0;var hs=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(hs>>>26)|0,hs&=67108863,Tt=Math.imul(xr,Er),Et=Math.imul(xr,Rr),Et=Et+Math.imul(pr,Er)|0,Nt=Math.imul(pr,Rr),Tt=Tt+Math.imul(qt,Hr)|0,Et=Et+Math.imul(qt,Fr)|0,Et=Et+Math.imul(Jt,Hr)|0,Nt=Nt+Math.imul(Jt,Fr)|0,Tt=Tt+Math.imul(Kt,Jr)|0,Et=Et+Math.imul(Kt,Qr)|0,Et=Et+Math.imul(Qt,Jr)|0,Nt=Nt+Math.imul(Qt,Qr)|0,Tt=Tt+Math.imul(ir,ln)|0,Et=Et+Math.imul(ir,qr)|0,Et=Et+Math.imul(nr,ln)|0,Nt=Nt+Math.imul(nr,qr)|0;var ps=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(ps>>>26)|0,ps&=67108863,Tt=Math.imul(Mr,Er),Et=Math.imul(Mr,Rr),Et=Et+Math.imul(lr,Er)|0,Nt=Math.imul(lr,Rr),Tt=Tt+Math.imul(xr,Hr)|0,Et=Et+Math.imul(xr,Fr)|0,Et=Et+Math.imul(pr,Hr)|0,Nt=Nt+Math.imul(pr,Fr)|0,Tt=Tt+Math.imul(qt,Jr)|0,Et=Et+Math.imul(qt,Qr)|0,Et=Et+Math.imul(Jt,Jr)|0,Nt=Nt+Math.imul(Jt,Qr)|0,Tt=Tt+Math.imul(Kt,ln)|0,Et=Et+Math.imul(Kt,qr)|0,Et=Et+Math.imul(Qt,ln)|0,Nt=Nt+Math.imul(Qt,qr)|0,Tt=Tt+Math.imul(ir,un)|0,Et=Et+Math.imul(ir,Vr)|0,Et=Et+Math.imul(nr,un)|0,Nt=Nt+Math.imul(nr,Vr)|0;var Vn=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(Vn>>>26)|0,Vn&=67108863,Tt=Math.imul(_r,Er),Et=Math.imul(_r,Rr),Et=Et+Math.imul(Sr,Er)|0,Nt=Math.imul(Sr,Rr),Tt=Tt+Math.imul(Mr,Hr)|0,Et=Et+Math.imul(Mr,Fr)|0,Et=Et+Math.imul(lr,Hr)|0,Nt=Nt+Math.imul(lr,Fr)|0,Tt=Tt+Math.imul(xr,Jr)|0,Et=Et+Math.imul(xr,Qr)|0,Et=Et+Math.imul(pr,Jr)|0,Nt=Nt+Math.imul(pr,Qr)|0,Tt=Tt+Math.imul(qt,ln)|0,Et=Et+Math.imul(qt,qr)|0,Et=Et+Math.imul(Jt,ln)|0,Nt=Nt+Math.imul(Jt,qr)|0,Tt=Tt+Math.imul(Kt,un)|0,Et=Et+Math.imul(Kt,Vr)|0,Et=Et+Math.imul(Qt,un)|0,Nt=Nt+Math.imul(Qt,Vr)|0,Tt=Tt+Math.imul(ir,fn)|0,Et=Et+Math.imul(ir,Kr)|0,Et=Et+Math.imul(nr,fn)|0,Nt=Nt+Math.imul(nr,Kr)|0;var ss=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(ss>>>26)|0,ss&=67108863,Tt=Math.imul(Ar,Er),Et=Math.imul(Ar,Rr),Et=Et+Math.imul($r,Er)|0,Nt=Math.imul($r,Rr),Tt=Tt+Math.imul(_r,Hr)|0,Et=Et+Math.imul(_r,Fr)|0,Et=Et+Math.imul(Sr,Hr)|0,Nt=Nt+Math.imul(Sr,Fr)|0,Tt=Tt+Math.imul(Mr,Jr)|0,Et=Et+Math.imul(Mr,Qr)|0,Et=Et+Math.imul(lr,Jr)|0,Nt=Nt+Math.imul(lr,Qr)|0,Tt=Tt+Math.imul(xr,ln)|0,Et=Et+Math.imul(xr,qr)|0,Et=Et+Math.imul(pr,ln)|0,Nt=Nt+Math.imul(pr,qr)|0,Tt=Tt+Math.imul(qt,un)|0,Et=Et+Math.imul(qt,Vr)|0,Et=Et+Math.imul(Jt,un)|0,Nt=Nt+Math.imul(Jt,Vr)|0,Tt=Tt+Math.imul(Kt,fn)|0,Et=Et+Math.imul(Kt,Kr)|0,Et=Et+Math.imul(Qt,fn)|0,Nt=Nt+Math.imul(Qt,Kr)|0,Tt=Tt+Math.imul(ir,dn)|0,Et=Et+Math.imul(ir,Gr)|0,Et=Et+Math.imul(nr,dn)|0,Nt=Nt+Math.imul(nr,Gr)|0;var Jn=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(Jn>>>26)|0,Jn&=67108863,Tt=Math.imul(Lr,Er),Et=Math.imul(Lr,Rr),Et=Et+Math.imul(or,Er)|0,Nt=Math.imul(or,Rr),Tt=Tt+Math.imul(Ar,Hr)|0,Et=Et+Math.imul(Ar,Fr)|0,Et=Et+Math.imul($r,Hr)|0,Nt=Nt+Math.imul($r,Fr)|0,Tt=Tt+Math.imul(_r,Jr)|0,Et=Et+Math.imul(_r,Qr)|0,Et=Et+Math.imul(Sr,Jr)|0,Nt=Nt+Math.imul(Sr,Qr)|0,Tt=Tt+Math.imul(Mr,ln)|0,Et=Et+Math.imul(Mr,qr)|0,Et=Et+Math.imul(lr,ln)|0,Nt=Nt+Math.imul(lr,qr)|0,Tt=Tt+Math.imul(xr,un)|0,Et=Et+Math.imul(xr,Vr)|0,Et=Et+Math.imul(pr,un)|0,Nt=Nt+Math.imul(pr,Vr)|0,Tt=Tt+Math.imul(qt,fn)|0,Et=Et+Math.imul(qt,Kr)|0,Et=Et+Math.imul(Jt,fn)|0,Nt=Nt+Math.imul(Jt,Kr)|0,Tt=Tt+Math.imul(Kt,dn)|0,Et=Et+Math.imul(Kt,Gr)|0,Et=Et+Math.imul(Qt,dn)|0,Nt=Nt+Math.imul(Qt,Gr)|0,Tt=Tt+Math.imul(ir,an)|0,Et=Et+Math.imul(ir,Zr)|0,Et=Et+Math.imul(nr,an)|0,Nt=Nt+Math.imul(nr,Zr)|0;var Yn=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(Yn>>>26)|0,Yn&=67108863,Tt=Math.imul(er,Er),Et=Math.imul(er,Rr),Et=Et+Math.imul(Gt,Er)|0,Nt=Math.imul(Gt,Rr),Tt=Tt+Math.imul(Lr,Hr)|0,Et=Et+Math.imul(Lr,Fr)|0,Et=Et+Math.imul(or,Hr)|0,Nt=Nt+Math.imul(or,Fr)|0,Tt=Tt+Math.imul(Ar,Jr)|0,Et=Et+Math.imul(Ar,Qr)|0,Et=Et+Math.imul($r,Jr)|0,Nt=Nt+Math.imul($r,Qr)|0,Tt=Tt+Math.imul(_r,ln)|0,Et=Et+Math.imul(_r,qr)|0,Et=Et+Math.imul(Sr,ln)|0,Nt=Nt+Math.imul(Sr,qr)|0,Tt=Tt+Math.imul(Mr,un)|0,Et=Et+Math.imul(Mr,Vr)|0,Et=Et+Math.imul(lr,un)|0,Nt=Nt+Math.imul(lr,Vr)|0,Tt=Tt+Math.imul(xr,fn)|0,Et=Et+Math.imul(xr,Kr)|0,Et=Et+Math.imul(pr,fn)|0,Nt=Nt+Math.imul(pr,Kr)|0,Tt=Tt+Math.imul(qt,dn)|0,Et=Et+Math.imul(qt,Gr)|0,Et=Et+Math.imul(Jt,dn)|0,Nt=Nt+Math.imul(Jt,Gr)|0,Tt=Tt+Math.imul(Kt,an)|0,Et=Et+Math.imul(Kt,Zr)|0,Et=Et+Math.imul(Qt,an)|0,Nt=Nt+Math.imul(Qt,Zr)|0,Tt=Tt+Math.imul(ir,Sn)|0,Et=Et+Math.imul(ir,nn)|0,Et=Et+Math.imul(nr,Sn)|0,Nt=Nt+Math.imul(nr,nn)|0;var ms=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(ms>>>26)|0,ms&=67108863,Tt=Math.imul(Wt,Er),Et=Math.imul(Wt,Rr),Et=Et+Math.imul(ar,Er)|0,Nt=Math.imul(ar,Rr),Tt=Tt+Math.imul(er,Hr)|0,Et=Et+Math.imul(er,Fr)|0,Et=Et+Math.imul(Gt,Hr)|0,Nt=Nt+Math.imul(Gt,Fr)|0,Tt=Tt+Math.imul(Lr,Jr)|0,Et=Et+Math.imul(Lr,Qr)|0,Et=Et+Math.imul(or,Jr)|0,Nt=Nt+Math.imul(or,Qr)|0,Tt=Tt+Math.imul(Ar,ln)|0,Et=Et+Math.imul(Ar,qr)|0,Et=Et+Math.imul($r,ln)|0,Nt=Nt+Math.imul($r,qr)|0,Tt=Tt+Math.imul(_r,un)|0,Et=Et+Math.imul(_r,Vr)|0,Et=Et+Math.imul(Sr,un)|0,Nt=Nt+Math.imul(Sr,Vr)|0,Tt=Tt+Math.imul(Mr,fn)|0,Et=Et+Math.imul(Mr,Kr)|0,Et=Et+Math.imul(lr,fn)|0,Nt=Nt+Math.imul(lr,Kr)|0,Tt=Tt+Math.imul(xr,dn)|0,Et=Et+Math.imul(xr,Gr)|0,Et=Et+Math.imul(pr,dn)|0,Nt=Nt+Math.imul(pr,Gr)|0,Tt=Tt+Math.imul(qt,an)|0,Et=Et+Math.imul(qt,Zr)|0,Et=Et+Math.imul(Jt,an)|0,Nt=Nt+Math.imul(Jt,Zr)|0,Tt=Tt+Math.imul(Kt,Sn)|0,Et=Et+Math.imul(Kt,nn)|0,Et=Et+Math.imul(Qt,Sn)|0,Nt=Nt+Math.imul(Qt,nn)|0,Tt=Tt+Math.imul(ir,yn)|0,Et=Et+Math.imul(ir,_n)|0,Et=Et+Math.imul(nr,yn)|0,Nt=Nt+Math.imul(nr,_n)|0;var Qn=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(Qn>>>26)|0,Qn&=67108863,Tt=Math.imul(Wt,Hr),Et=Math.imul(Wt,Fr),Et=Et+Math.imul(ar,Hr)|0,Nt=Math.imul(ar,Fr),Tt=Tt+Math.imul(er,Jr)|0,Et=Et+Math.imul(er,Qr)|0,Et=Et+Math.imul(Gt,Jr)|0,Nt=Nt+Math.imul(Gt,Qr)|0,Tt=Tt+Math.imul(Lr,ln)|0,Et=Et+Math.imul(Lr,qr)|0,Et=Et+Math.imul(or,ln)|0,Nt=Nt+Math.imul(or,qr)|0,Tt=Tt+Math.imul(Ar,un)|0,Et=Et+Math.imul(Ar,Vr)|0,Et=Et+Math.imul($r,un)|0,Nt=Nt+Math.imul($r,Vr)|0,Tt=Tt+Math.imul(_r,fn)|0,Et=Et+Math.imul(_r,Kr)|0,Et=Et+Math.imul(Sr,fn)|0,Nt=Nt+Math.imul(Sr,Kr)|0,Tt=Tt+Math.imul(Mr,dn)|0,Et=Et+Math.imul(Mr,Gr)|0,Et=Et+Math.imul(lr,dn)|0,Nt=Nt+Math.imul(lr,Gr)|0,Tt=Tt+Math.imul(xr,an)|0,Et=Et+Math.imul(xr,Zr)|0,Et=Et+Math.imul(pr,an)|0,Nt=Nt+Math.imul(pr,Zr)|0,Tt=Tt+Math.imul(qt,Sn)|0,Et=Et+Math.imul(qt,nn)|0,Et=Et+Math.imul(Jt,Sn)|0,Nt=Nt+Math.imul(Jt,nn)|0,Tt=Tt+Math.imul(Kt,yn)|0,Et=Et+Math.imul(Kt,_n)|0,Et=Et+Math.imul(Qt,yn)|0,Nt=Nt+Math.imul(Qt,_n)|0;var es=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(es>>>26)|0,es&=67108863,Tt=Math.imul(Wt,Jr),Et=Math.imul(Wt,Qr),Et=Et+Math.imul(ar,Jr)|0,Nt=Math.imul(ar,Qr),Tt=Tt+Math.imul(er,ln)|0,Et=Et+Math.imul(er,qr)|0,Et=Et+Math.imul(Gt,ln)|0,Nt=Nt+Math.imul(Gt,qr)|0,Tt=Tt+Math.imul(Lr,un)|0,Et=Et+Math.imul(Lr,Vr)|0,Et=Et+Math.imul(or,un)|0,Nt=Nt+Math.imul(or,Vr)|0,Tt=Tt+Math.imul(Ar,fn)|0,Et=Et+Math.imul(Ar,Kr)|0,Et=Et+Math.imul($r,fn)|0,Nt=Nt+Math.imul($r,Kr)|0,Tt=Tt+Math.imul(_r,dn)|0,Et=Et+Math.imul(_r,Gr)|0,Et=Et+Math.imul(Sr,dn)|0,Nt=Nt+Math.imul(Sr,Gr)|0,Tt=Tt+Math.imul(Mr,an)|0,Et=Et+Math.imul(Mr,Zr)|0,Et=Et+Math.imul(lr,an)|0,Nt=Nt+Math.imul(lr,Zr)|0,Tt=Tt+Math.imul(xr,Sn)|0,Et=Et+Math.imul(xr,nn)|0,Et=Et+Math.imul(pr,Sn)|0,Nt=Nt+Math.imul(pr,nn)|0,Tt=Tt+Math.imul(qt,yn)|0,Et=Et+Math.imul(qt,_n)|0,Et=Et+Math.imul(Jt,yn)|0,Nt=Nt+Math.imul(Jt,_n)|0;var ls=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(ls>>>26)|0,ls&=67108863,Tt=Math.imul(Wt,ln),Et=Math.imul(Wt,qr),Et=Et+Math.imul(ar,ln)|0,Nt=Math.imul(ar,qr),Tt=Tt+Math.imul(er,un)|0,Et=Et+Math.imul(er,Vr)|0,Et=Et+Math.imul(Gt,un)|0,Nt=Nt+Math.imul(Gt,Vr)|0,Tt=Tt+Math.imul(Lr,fn)|0,Et=Et+Math.imul(Lr,Kr)|0,Et=Et+Math.imul(or,fn)|0,Nt=Nt+Math.imul(or,Kr)|0,Tt=Tt+Math.imul(Ar,dn)|0,Et=Et+Math.imul(Ar,Gr)|0,Et=Et+Math.imul($r,dn)|0,Nt=Nt+Math.imul($r,Gr)|0,Tt=Tt+Math.imul(_r,an)|0,Et=Et+Math.imul(_r,Zr)|0,Et=Et+Math.imul(Sr,an)|0,Nt=Nt+Math.imul(Sr,Zr)|0,Tt=Tt+Math.imul(Mr,Sn)|0,Et=Et+Math.imul(Mr,nn)|0,Et=Et+Math.imul(lr,Sn)|0,Nt=Nt+Math.imul(lr,nn)|0,Tt=Tt+Math.imul(xr,yn)|0,Et=Et+Math.imul(xr,_n)|0,Et=Et+Math.imul(pr,yn)|0,Nt=Nt+Math.imul(pr,_n)|0;var us=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(us>>>26)|0,us&=67108863,Tt=Math.imul(Wt,un),Et=Math.imul(Wt,Vr),Et=Et+Math.imul(ar,un)|0,Nt=Math.imul(ar,Vr),Tt=Tt+Math.imul(er,fn)|0,Et=Et+Math.imul(er,Kr)|0,Et=Et+Math.imul(Gt,fn)|0,Nt=Nt+Math.imul(Gt,Kr)|0,Tt=Tt+Math.imul(Lr,dn)|0,Et=Et+Math.imul(Lr,Gr)|0,Et=Et+Math.imul(or,dn)|0,Nt=Nt+Math.imul(or,Gr)|0,Tt=Tt+Math.imul(Ar,an)|0,Et=Et+Math.imul(Ar,Zr)|0,Et=Et+Math.imul($r,an)|0,Nt=Nt+Math.imul($r,Zr)|0,Tt=Tt+Math.imul(_r,Sn)|0,Et=Et+Math.imul(_r,nn)|0,Et=Et+Math.imul(Sr,Sn)|0,Nt=Nt+Math.imul(Sr,nn)|0,Tt=Tt+Math.imul(Mr,yn)|0,Et=Et+Math.imul(Mr,_n)|0,Et=Et+Math.imul(lr,yn)|0,Nt=Nt+Math.imul(lr,_n)|0;var Wn=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(Wn>>>26)|0,Wn&=67108863,Tt=Math.imul(Wt,fn),Et=Math.imul(Wt,Kr),Et=Et+Math.imul(ar,fn)|0,Nt=Math.imul(ar,Kr),Tt=Tt+Math.imul(er,dn)|0,Et=Et+Math.imul(er,Gr)|0,Et=Et+Math.imul(Gt,dn)|0,Nt=Nt+Math.imul(Gt,Gr)|0,Tt=Tt+Math.imul(Lr,an)|0,Et=Et+Math.imul(Lr,Zr)|0,Et=Et+Math.imul(or,an)|0,Nt=Nt+Math.imul(or,Zr)|0,Tt=Tt+Math.imul(Ar,Sn)|0,Et=Et+Math.imul(Ar,nn)|0,Et=Et+Math.imul($r,Sn)|0,Nt=Nt+Math.imul($r,nn)|0,Tt=Tt+Math.imul(_r,yn)|0,Et=Et+Math.imul(_r,_n)|0,Et=Et+Math.imul(Sr,yn)|0,Nt=Nt+Math.imul(Sr,_n)|0;var as=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(as>>>26)|0,as&=67108863,Tt=Math.imul(Wt,dn),Et=Math.imul(Wt,Gr),Et=Et+Math.imul(ar,dn)|0,Nt=Math.imul(ar,Gr),Tt=Tt+Math.imul(er,an)|0,Et=Et+Math.imul(er,Zr)|0,Et=Et+Math.imul(Gt,an)|0,Nt=Nt+Math.imul(Gt,Zr)|0,Tt=Tt+Math.imul(Lr,Sn)|0,Et=Et+Math.imul(Lr,nn)|0,Et=Et+Math.imul(or,Sn)|0,Nt=Nt+Math.imul(or,nn)|0,Tt=Tt+Math.imul(Ar,yn)|0,Et=Et+Math.imul(Ar,_n)|0,Et=Et+Math.imul($r,yn)|0,Nt=Nt+Math.imul($r,_n)|0;var gs=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(gs>>>26)|0,gs&=67108863,Tt=Math.imul(Wt,an),Et=Math.imul(Wt,Zr),Et=Et+Math.imul(ar,an)|0,Nt=Math.imul(ar,Zr),Tt=Tt+Math.imul(er,Sn)|0,Et=Et+Math.imul(er,nn)|0,Et=Et+Math.imul(Gt,Sn)|0,Nt=Nt+Math.imul(Gt,nn)|0,Tt=Tt+Math.imul(Lr,yn)|0,Et=Et+Math.imul(Lr,_n)|0,Et=Et+Math.imul(or,yn)|0,Nt=Nt+Math.imul(or,_n)|0;var vs=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(vs>>>26)|0,vs&=67108863,Tt=Math.imul(Wt,Sn),Et=Math.imul(Wt,nn),Et=Et+Math.imul(ar,Sn)|0,Nt=Math.imul(ar,nn),Tt=Tt+Math.imul(er,yn)|0,Et=Et+Math.imul(er,_n)|0,Et=Et+Math.imul(Gt,yn)|0,Nt=Nt+Math.imul(Gt,_n)|0;var Ts=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(Ts>>>26)|0,Ts&=67108863,Tt=Math.imul(Wt,yn),Et=Math.imul(Wt,_n),Et=Et+Math.imul(ar,yn)|0,Nt=Math.imul(ar,_n);var $s=(St+Tt|0)+((Et&8191)<<13)|0;return St=(Nt+(Et>>>13)|0)+($s>>>26)|0,$s&=67108863,Rt[0]=ds,Rt[1]=fs,Rt[2]=hs,Rt[3]=ps,Rt[4]=Vn,Rt[5]=ss,Rt[6]=Jn,Rt[7]=Yn,Rt[8]=ms,Rt[9]=Qn,Rt[10]=es,Rt[11]=ls,Rt[12]=us,Rt[13]=Wn,Rt[14]=as,Rt[15]=gs,Rt[16]=vs,Rt[17]=Ts,Rt[18]=$s,St!==0&&(Rt[19]=St,mt.length++),mt};Math.imul||($t=Pt);function Mt(vt,ct,dt){dt.negative=ct.negative^vt.negative,dt.length=vt.length+ct.length;for(var mt=0,xt=0,At=0;At>>26)|0,xt+=Rt>>>26,Rt&=67108863}dt.words[At]=St,mt=Rt,Rt=xt}return mt!==0?dt.words[At]=mt:dt.length--,dt._strip()}function Lt(vt,ct,dt){return Mt(vt,ct,dt)}tt.prototype.mulTo=function(ct,dt){var mt,xt=this.length+ct.length;return this.length===10&&ct.length===10?mt=$t(this,ct,dt):xt<63?mt=Pt(this,ct,dt):xt<1024?mt=Mt(this,ct,dt):mt=Lt(this,ct,dt),mt},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 mt=0,xt=0;xt>=26,mt+=At/67108864|0,mt+=Rt>>>26,this.words[xt]=Rt&67108863}return mt!==0&&(this.words[xt]=mt,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 mt=this,xt=0;xt=0);var dt=ct%26,mt=(ct-dt)/26,xt=67108863>>>26-dt<<26-dt,At;if(dt!==0){var Rt=0;for(At=0;At>>26-dt}Rt&&(this.words[At]=Rt,this.length++)}if(mt!==0){for(At=this.length-1;At>=0;At--)this.words[At+mt]=this.words[At];for(At=0;At=0);var xt;dt?xt=(dt-dt%26)/26:xt=0;var At=ct%26,Rt=Math.min((ct-At)/26,this.length),St=67108863^67108863>>>At<Rt)for(this.length-=Rt,Et=0;Et=0&&(Nt!==0||Et>=xt);Et--){var tr=this.words[Et]|0;this.words[Et]=Nt<<26-At|tr>>>At,Nt=tr&St}return Tt&&Nt!==0&&(Tt.words[Tt.length++]=Nt),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},tt.prototype.ishrn=function(ct,dt,mt){return j(this.negative===0),this.iushrn(ct,dt,mt)},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,mt=(ct-dt)/26,xt=1<=0);var dt=ct%26,mt=(ct-dt)/26;if(j(this.negative===0,"imaskn works only with positive numbers"),this.length<=mt)return this;if(dt!==0&&mt++,this.length=Math.min(mt,this.length),dt!==0){var xt=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)-(Tt/67108864|0),this.words[At+mt]=Rt&67108863}for(;At>26,this.words[At+mt]=Rt&67108863;if(St===0)return this._strip();for(j(St===-1),St=0,At=0;At>26,this.words[At]=Rt&67108863;return this.negative=1,this._strip()},tt.prototype._wordDiv=function(ct,dt){var mt=this.length-ct.length,xt=this.clone(),At=ct,Rt=At.words[At.length-1]|0,St=this._countBits(Rt);mt=26-St,mt!==0&&(At=At.ushln(mt),xt.iushln(mt),Rt=At.words[At.length-1]|0);var Tt=xt.length-At.length,Et;if(dt!=="mod"){Et=new tt(null),Et.length=Tt+1,Et.words=new Array(Et.length);for(var Nt=0;Nt=0;ir--){var nr=(xt.words[At.length+ir]|0)*67108864+(xt.words[At.length+ir-1]|0);for(nr=Math.min(nr/Rt|0,67108863),xt._ishlnsubmul(At,nr,ir);xt.negative!==0;)nr--,xt.negative=0,xt._ishlnsubmul(At,1,ir),xt.isZero()||(xt.negative^=1);Et&&(Et.words[ir]=nr)}return Et&&Et._strip(),xt._strip(),dt!=="div"&&mt!==0&&xt.iushrn(mt),{div:Et||null,mod:xt}},tt.prototype.divmod=function(ct,dt,mt){if(j(!ct.isZero()),this.isZero())return{div:new tt(0),mod:new tt(0)};var xt,At,Rt;return this.negative!==0&&ct.negative===0?(Rt=this.neg().divmod(ct,dt),dt!=="mod"&&(xt=Rt.div.neg()),dt!=="div"&&(At=Rt.mod.neg(),mt&&At.negative!==0&&At.iadd(ct)),{div:xt,mod:At}):this.negative===0&&ct.negative!==0?(Rt=this.divmod(ct.neg(),dt),dt!=="mod"&&(xt=Rt.div.neg()),{div:xt,mod:Rt.mod}):this.negative&ct.negative?(Rt=this.neg().divmod(ct.neg(),dt),dt!=="div"&&(At=Rt.mod.neg(),mt&&At.negative!==0&&At.isub(ct)),{div:Rt.div,mod:At}):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 mt=dt.div.negative!==0?dt.mod.isub(ct):dt.mod,xt=ct.ushrn(1),At=ct.andln(1),Rt=mt.cmp(xt);return Rt<0||At===1&&Rt===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 mt=(1<<26)%ct,xt=0,At=this.length-1;At>=0;At--)xt=(mt*xt+(this.words[At]|0))%ct;return dt?-xt:xt},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 mt=0,xt=this.length-1;xt>=0;xt--){var At=(this.words[xt]|0)+mt*67108864;this.words[xt]=At/ct|0,mt=At%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,mt=ct.clone();dt.negative!==0?dt=dt.umod(ct):dt=dt.clone();for(var xt=new tt(1),At=new tt(0),Rt=new tt(0),St=new tt(1),Tt=0;dt.isEven()&&mt.isEven();)dt.iushrn(1),mt.iushrn(1),++Tt;for(var Et=mt.clone(),Nt=dt.clone();!dt.isZero();){for(var tr=0,ir=1;!(dt.words[0]&ir)&&tr<26;++tr,ir<<=1);if(tr>0)for(dt.iushrn(tr);tr-- >0;)(xt.isOdd()||At.isOdd())&&(xt.iadd(Et),At.isub(Nt)),xt.iushrn(1),At.iushrn(1);for(var nr=0,Zt=1;!(mt.words[0]&Zt)&&nr<26;++nr,Zt<<=1);if(nr>0)for(mt.iushrn(nr);nr-- >0;)(Rt.isOdd()||St.isOdd())&&(Rt.iadd(Et),St.isub(Nt)),Rt.iushrn(1),St.iushrn(1);dt.cmp(mt)>=0?(dt.isub(mt),xt.isub(Rt),At.isub(St)):(mt.isub(dt),Rt.isub(xt),St.isub(At))}return{a:Rt,b:St,gcd:mt.iushln(Tt)}},tt.prototype._invmp=function(ct){j(ct.negative===0),j(!ct.isZero());var dt=this,mt=ct.clone();dt.negative!==0?dt=dt.umod(ct):dt=dt.clone();for(var xt=new tt(1),At=new tt(0),Rt=mt.clone();dt.cmpn(1)>0&&mt.cmpn(1)>0;){for(var St=0,Tt=1;!(dt.words[0]&Tt)&&St<26;++St,Tt<<=1);if(St>0)for(dt.iushrn(St);St-- >0;)xt.isOdd()&&xt.iadd(Rt),xt.iushrn(1);for(var Et=0,Nt=1;!(mt.words[0]&Nt)&&Et<26;++Et,Nt<<=1);if(Et>0)for(mt.iushrn(Et);Et-- >0;)At.isOdd()&&At.iadd(Rt),At.iushrn(1);dt.cmp(mt)>=0?(dt.isub(mt),xt.isub(At)):(mt.isub(dt),At.isub(xt))}var tr;return dt.cmpn(1)===0?tr=xt:tr=At,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(),mt=ct.clone();dt.negative=0,mt.negative=0;for(var xt=0;dt.isEven()&&mt.isEven();xt++)dt.iushrn(1),mt.iushrn(1);do{for(;dt.isEven();)dt.iushrn(1);for(;mt.isEven();)mt.iushrn(1);var At=dt.cmp(mt);if(At<0){var Rt=dt;dt=mt,mt=Rt}else if(At===0||mt.cmpn(1)===0)break;dt.isub(mt)}while(!0);return mt.iushln(xt)},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,mt=(ct-dt)/26,xt=1<>>26,St&=67108863,this.words[Rt]=St}return At!==0&&(this.words[Rt]=At,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 mt;if(this.length>1)mt=1;else{dt&&(ct=-ct),j(ct<=67108863,"Number is too big");var xt=this.words[0]|0;mt=xt===ct?0:xtct.length)return 1;if(this.length=0;mt--){var xt=this.words[mt]|0,At=ct.words[mt]|0;if(xt!==At){xtAt&&(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 jt(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 Dt={k256:null,p224:null,p192:null,p25519:null};function zt(vt,ct){this.name=vt,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 dt=ct,mt;do this.split(dt,this.tmp),dt=this.imulK(dt),dt=dt.iadd(this.tmp),mt=dt.bitLength();while(mt>this.n);var xt=mt0?dt.isub(this.p):dt.strip!==void 0?dt.strip():dt._strip(),dt},zt.prototype.split=function(ct,dt){ct.iushrn(this.n,0,dt)},zt.prototype.imulK=function(ct){return ct.imul(this.k)};function Ot(){zt.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}et(Ot,zt),Ot.prototype.split=function(ct,dt){for(var mt=4194303,xt=Math.min(ct.length,9),At=0;At>>22,Rt=St}Rt>>>=22,ct.words[At-10]=Rt,Rt===0&&ct.length>10?ct.length-=10:ct.length-=9},Ot.prototype.imulK=function(ct){ct.words[ct.length]=0,ct.words[ct.length+1]=0,ct.length+=2;for(var dt=0,mt=0;mt>>=26,ct.words[mt]=At,dt=xt}return dt!==0&&(ct.words[ct.length++]=dt),ct},tt._prime=function(ct){if(Dt[ct])return Dt[ct];var dt;if(ct==="k256")dt=new Ot;else if(ct==="p224")dt=new It;else if(ct==="p192")dt=new Bt;else if(ct==="p25519")dt=new Ft;else throw new Error("Unknown prime "+ct);return Dt[ct]=dt,dt};function jt(vt){if(typeof vt=="string"){var ct=tt._prime(vt);this.m=ct.p,this.prime=ct}else j(vt.gtn(1),"modulus must be greater than 1"),this.m=vt,this.prime=null}jt.prototype._verify1=function(ct){j(ct.negative===0,"red works only with positives"),j(ct.red,"red works only with red numbers")},jt.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")},jt.prototype.imod=function(ct){return this.prime?this.prime.ireduce(ct)._forceRed(this):(ot(ct,ct.umod(this.m)._forceRed(this)),ct)},jt.prototype.neg=function(ct){return ct.isZero()?ct.clone():this.m.sub(ct)._forceRed(this)},jt.prototype.add=function(ct,dt){this._verify2(ct,dt);var mt=ct.add(dt);return mt.cmp(this.m)>=0&&mt.isub(this.m),mt._forceRed(this)},jt.prototype.iadd=function(ct,dt){this._verify2(ct,dt);var mt=ct.iadd(dt);return mt.cmp(this.m)>=0&&mt.isub(this.m),mt},jt.prototype.sub=function(ct,dt){this._verify2(ct,dt);var mt=ct.sub(dt);return mt.cmpn(0)<0&&mt.iadd(this.m),mt._forceRed(this)},jt.prototype.isub=function(ct,dt){this._verify2(ct,dt);var mt=ct.isub(dt);return mt.cmpn(0)<0&&mt.iadd(this.m),mt},jt.prototype.shl=function(ct,dt){return this._verify1(ct),this.imod(ct.ushln(dt))},jt.prototype.imul=function(ct,dt){return this._verify2(ct,dt),this.imod(ct.imul(dt))},jt.prototype.mul=function(ct,dt){return this._verify2(ct,dt),this.imod(ct.mul(dt))},jt.prototype.isqr=function(ct){return this.imul(ct,ct.clone())},jt.prototype.sqr=function(ct){return this.mul(ct,ct)},jt.prototype.sqrt=function(ct){if(ct.isZero())return ct.clone();var dt=this.m.andln(3);if(j(dt%2===1),dt===3){var mt=this.m.add(new tt(1)).iushrn(2);return this.pow(ct,mt)}for(var xt=this.m.subn(1),At=0;!xt.isZero()&&xt.andln(1)===0;)At++,xt.iushrn(1);j(!xt.isZero());var Rt=new tt(1).toRed(this),St=Rt.redNeg(),Tt=this.m.subn(1).iushrn(1),Et=this.m.bitLength();for(Et=new tt(2*Et*Et).toRed(this);this.pow(Et,Tt).cmp(St)!==0;)Et.redIAdd(St);for(var Nt=this.pow(Et,xt),tr=this.pow(ct,xt.addn(1).iushrn(1)),ir=this.pow(ct,xt),nr=At;ir.cmp(Rt)!==0;){for(var Zt=ir,Kt=0;Zt.cmp(Rt)!==0;Kt++)Zt=Zt.redSqr();j(Kt=0;At--){for(var Nt=dt.words[At],tr=Et-1;tr>=0;tr--){var ir=Nt>>tr&1;if(Rt!==xt[0]&&(Rt=this.sqr(Rt)),ir===0&&St===0){Tt=0;continue}St<<=1,St|=ir,Tt++,!(Tt!==mt&&(At!==0||tr!==0))&&(Rt=this.mul(Rt,xt[St]),Tt=0,St=0)}Et=26}return Rt},jt.prototype.convertTo=function(ct){var dt=ct.umod(this.m);return dt===ct?dt.clone():dt},jt.prototype.convertFrom=function(ct){var dt=ct.clone();return dt.red=null,dt},tt.mont=function(ct){return new bt(ct)};function bt(vt){jt.call(this,vt),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(bt,jt),bt.prototype.convertTo=function(ct){return this.imod(ct.ushln(this.shift))},bt.prototype.convertFrom=function(ct){var dt=this.imod(ct.mul(this.rinv));return dt.red=null,dt},bt.prototype.imul=function(ct,dt){if(ct.isZero()||dt.isZero())return ct.words[0]=0,ct.length=1,ct;var mt=ct.imul(dt),xt=mt.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),At=mt.isub(xt).iushrn(this.shift),Rt=At;return At.cmp(this.m)>=0?Rt=At.isub(this.m):At.cmpn(0)<0&&(Rt=At.iadd(this.m)),Rt._forceRed(this)},bt.prototype.mul=function(ct,dt){if(ct.isZero()||dt.isZero())return new tt(0)._forceRed(this);var mt=ct.mul(dt),xt=mt.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),At=mt.isub(xt).iushrn(this.shift),Rt=At;return At.cmp(this.m)>=0?Rt=At.isub(this.m):At.cmpn(0)<0&&(Rt=At.iadd(this.m)),Rt._forceRed(this)},bt.prototype.invm=function(ct){var dt=this.imod(ct._invmp(this.m).mul(this.r2));return dt._forceRed(this)}})(a,commonjsGlobal)}(bn$3)),bn$3.exports}var browserifyRsa,hasRequiredBrowserifyRsa;function requireBrowserifyRsa(){if(hasRequiredBrowserifyRsa)return browserifyRsa;hasRequiredBrowserifyRsa=1;var a=requireBn$2(),_=requireBrowser$8();function $(tt){var rt=j(tt),nt=rt.toRed(a.mont(tt.modulus)).redPow(new a(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(),st=new a(tt).mul(nt.blinder).umod(rt.modulus),ot=st.toRed(a.mont(rt.prime1)),at=st.toRed(a.mont(rt.prime2)),ut=rt.coefficient,ht=rt.prime1,yt=rt.prime2,wt=ot.redPow(rt.exponent1).fromRed(),Ct=at.redPow(rt.exponent2).fromRed(),Pt=wt.isub(Ct).imul(ut).umod(ht).imul(yt);return Ct.iadd(Pt).imul(nt.unblinder).umod(rt.modulus).toArrayLike(Buffer$g,"be",it)}return et.getr=j,browserifyRsa=et,browserifyRsa}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$w={},bn$2={exports:{}};bn$2.exports;var hasRequiredBn$1;function requireBn$1(){return hasRequiredBn$1||(hasRequiredBn$1=1,function(a){(function(_,$){function j(jt,bt){if(!jt)throw new Error(bt||"Assertion failed")}function et(jt,bt){jt.super_=bt;var vt=function(){};vt.prototype=bt.prototype,jt.prototype=new vt,jt.prototype.constructor=jt}function tt(jt,bt,vt){if(tt.isBN(jt))return jt;this.negative=0,this.words=null,this.length=0,this.red=null,jt!==null&&((bt==="le"||bt==="be")&&(vt=bt,bt=10),this._init(jt||0,bt||10,vt||"be"))}typeof _=="object"?_.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$4.Buffer}catch{}tt.isBN=function(bt){return bt instanceof tt?!0:bt!==null&&typeof bt=="object"&&bt.constructor.wordSize===tt.wordSize&&Array.isArray(bt.words)},tt.max=function(bt,vt){return bt.cmp(vt)>0?bt:vt},tt.min=function(bt,vt){return bt.cmp(vt)<0?bt:vt},tt.prototype._init=function(bt,vt,ct){if(typeof bt=="number")return this._initNumber(bt,vt,ct);if(typeof bt=="object")return this._initArray(bt,vt,ct);vt==="hex"&&(vt=16),j(vt===(vt|0)&&vt>=2&&vt<=36),bt=bt.toString().replace(/\s+/g,"");var dt=0;bt[0]==="-"&&(dt++,this.negative=1),dt=0;dt-=3)xt=bt[dt]|bt[dt-1]<<8|bt[dt-2]<<16,this.words[mt]|=xt<>>26-At&67108863,At+=24,At>=26&&(At-=26,mt++);else if(ct==="le")for(dt=0,mt=0;dt>>26-At&67108863,At+=24,At>=26&&(At-=26,mt++);return this.strip()};function nt(jt,bt){var vt=jt.charCodeAt(bt);return vt>=65&&vt<=70?vt-55:vt>=97&&vt<=102?vt-87:vt-48&15}function it(jt,bt,vt){var ct=nt(jt,vt);return vt-1>=bt&&(ct|=nt(jt,vt-1)<<4),ct}tt.prototype._parseHex=function(bt,vt,ct){this.length=Math.ceil((bt.length-vt)/6),this.words=new Array(this.length);for(var dt=0;dt=vt;dt-=2)At=it(bt,vt,dt)<=18?(mt-=18,xt+=1,this.words[xt]|=At>>>26):mt+=8;else{var Rt=bt.length-vt;for(dt=Rt%2===0?vt+1:vt;dt=18?(mt-=18,xt+=1,this.words[xt]|=At>>>26):mt+=8}this.strip()};function st(jt,bt,vt,ct){for(var dt=0,mt=Math.min(jt.length,vt),xt=bt;xt=49?dt+=At-49+10:At>=17?dt+=At-17+10:dt+=At}return dt}tt.prototype._parseBase=function(bt,vt,ct){this.words=[0],this.length=1;for(var dt=0,mt=1;mt<=67108863;mt*=vt)dt++;dt--,mt=mt/vt|0;for(var xt=bt.length-ct,At=xt%dt,Rt=Math.min(xt,xt-At)+ct,St=0,Tt=ct;Tt1&&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 ot=["","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(bt,vt){bt=bt||10,vt=vt|0||1;var ct;if(bt===16||bt==="hex"){ct="";for(var dt=0,mt=0,xt=0;xt>>24-dt&16777215,mt!==0||xt!==this.length-1?ct=ot[6-Rt.length]+Rt+ct:ct=Rt+ct,dt+=2,dt>=26&&(dt-=26,xt--)}for(mt!==0&&(ct=mt.toString(16)+ct);ct.length%vt!==0;)ct="0"+ct;return this.negative!==0&&(ct="-"+ct),ct}if(bt===(bt|0)&&bt>=2&&bt<=36){var St=at[bt],Tt=ut[bt];ct="";var Et=this.clone();for(Et.negative=0;!Et.isZero();){var Nt=Et.modn(Tt).toString(bt);Et=Et.idivn(Tt),Et.isZero()?ct=Nt+ct:ct=ot[St-Nt.length]+Nt+ct}for(this.isZero()&&(ct="0"+ct);ct.length%vt!==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 bt=this.words[0];return this.length===2?bt+=this.words[1]*67108864:this.length===3&&this.words[2]===1?bt+=4503599627370496+this.words[1]*67108864:this.length>2&&j(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-bt:bt},tt.prototype.toJSON=function(){return this.toString(16)},tt.prototype.toBuffer=function(bt,vt){return j(typeof rt<"u"),this.toArrayLike(rt,bt,vt)},tt.prototype.toArray=function(bt,vt){return this.toArrayLike(Array,bt,vt)},tt.prototype.toArrayLike=function(bt,vt,ct){var dt=this.byteLength(),mt=ct||Math.max(1,dt);j(dt<=mt,"byte array longer than desired length"),j(mt>0,"Requested array length <= 0"),this.strip();var xt=vt==="le",At=new bt(mt),Rt,St,Tt=this.clone();if(xt){for(St=0;!Tt.isZero();St++)Rt=Tt.andln(255),Tt.iushrn(8),At[St]=Rt;for(;St=4096&&(ct+=13,vt>>>=13),vt>=64&&(ct+=7,vt>>>=7),vt>=8&&(ct+=4,vt>>>=4),vt>=2&&(ct+=2,vt>>>=2),ct+vt},tt.prototype._zeroBits=function(bt){if(bt===0)return 26;var vt=bt,ct=0;return vt&8191||(ct+=13,vt>>>=13),vt&127||(ct+=7,vt>>>=7),vt&15||(ct+=4,vt>>>=4),vt&3||(ct+=2,vt>>>=2),vt&1||ct++,ct},tt.prototype.bitLength=function(){var bt=this.words[this.length-1],vt=this._countBits(bt);return(this.length-1)*26+vt};function ht(jt){for(var bt=new Array(jt.bitLength()),vt=0;vt>>dt}return bt}tt.prototype.zeroBits=function(){if(this.isZero())return 0;for(var bt=0,vt=0;vtbt.length?this.clone().ior(bt):bt.clone().ior(this)},tt.prototype.uor=function(bt){return this.length>bt.length?this.clone().iuor(bt):bt.clone().iuor(this)},tt.prototype.iuand=function(bt){var vt;this.length>bt.length?vt=bt:vt=this;for(var ct=0;ctbt.length?this.clone().iand(bt):bt.clone().iand(this)},tt.prototype.uand=function(bt){return this.length>bt.length?this.clone().iuand(bt):bt.clone().iuand(this)},tt.prototype.iuxor=function(bt){var vt,ct;this.length>bt.length?(vt=this,ct=bt):(vt=bt,ct=this);for(var dt=0;dtbt.length?this.clone().ixor(bt):bt.clone().ixor(this)},tt.prototype.uxor=function(bt){return this.length>bt.length?this.clone().iuxor(bt):bt.clone().iuxor(this)},tt.prototype.inotn=function(bt){j(typeof bt=="number"&&bt>=0);var vt=Math.ceil(bt/26)|0,ct=bt%26;this._expand(vt),ct>0&&vt--;for(var dt=0;dt0&&(this.words[dt]=~this.words[dt]&67108863>>26-ct),this.strip()},tt.prototype.notn=function(bt){return this.clone().inotn(bt)},tt.prototype.setn=function(bt,vt){j(typeof bt=="number"&&bt>=0);var ct=bt/26|0,dt=bt%26;return this._expand(ct+1),vt?this.words[ct]=this.words[ct]|1<bt.length?(ct=this,dt=bt):(ct=bt,dt=this);for(var mt=0,xt=0;xt>>26;for(;mt!==0&&xt>>26;if(this.length=ct.length,mt!==0)this.words[this.length]=mt,this.length++;else if(ct!==this)for(;xtbt.length?this.clone().iadd(bt):bt.clone().iadd(this)},tt.prototype.isub=function(bt){if(bt.negative!==0){bt.negative=0;var vt=this.iadd(bt);return bt.negative=1,vt._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(bt),this.negative=1,this._normSign();var ct=this.cmp(bt);if(ct===0)return this.negative=0,this.length=1,this.words[0]=0,this;var dt,mt;ct>0?(dt=this,mt=bt):(dt=bt,mt=this);for(var xt=0,At=0;At>26,this.words[At]=vt&67108863;for(;xt!==0&&At>26,this.words[At]=vt&67108863;if(xt===0&&At>>26,Et=Rt&67108863,Nt=Math.min(St,bt.length-1),tr=Math.max(0,St-jt.length+1);tr<=Nt;tr++){var ir=St-tr|0;dt=jt.words[ir]|0,mt=bt.words[tr]|0,xt=dt*mt+Et,Tt+=xt/67108864|0,Et=xt&67108863}vt.words[St]=Et|0,Rt=Tt|0}return Rt!==0?vt.words[St]=Rt|0:vt.length--,vt.strip()}var wt=function(bt,vt,ct){var dt=bt.words,mt=vt.words,xt=ct.words,At=0,Rt,St,Tt,Et=dt[0]|0,Nt=Et&8191,tr=Et>>>13,ir=dt[1]|0,nr=ir&8191,Zt=ir>>>13,Kt=dt[2]|0,Qt=Kt&8191,Ht=Kt>>>13,qt=dt[3]|0,Jt=qt&8191,ur=qt>>>13,xr=dt[4]|0,pr=xr&8191,Cr=xr>>>13,Mr=dt[5]|0,lr=Mr&8191,fr=Mr>>>13,_r=dt[6]|0,Sr=_r&8191,kr=_r>>>13,Ar=dt[7]|0,$r=Ar&8191,Or=Ar>>>13,Lr=dt[8]|0,or=Lr&8191,Yt=Lr>>>13,er=dt[9]|0,Gt=er&8191,Vt=er>>>13,Wt=mt[0]|0,ar=Wt&8191,yr=Wt>>>13,Er=mt[1]|0,Rr=Er&8191,Wr=Er>>>13,Hr=mt[2]|0,Fr=Hr&8191,pn=Hr>>>13,Jr=mt[3]|0,Qr=Jr&8191,mn=Jr>>>13,ln=mt[4]|0,qr=ln&8191,En=ln>>>13,un=mt[5]|0,Vr=un&8191,hn=un>>>13,fn=mt[6]|0,Kr=fn&8191,Rn=fn>>>13,dn=mt[7]|0,Gr=dn&8191,gn=dn>>>13,an=mt[8]|0,Zr=an&8191,An=an>>>13,Sn=mt[9]|0,nn=Sn&8191,Pn=Sn>>>13;ct.negative=bt.negative^vt.negative,ct.length=19,Rt=Math.imul(Nt,ar),St=Math.imul(Nt,yr),St=St+Math.imul(tr,ar)|0,Tt=Math.imul(tr,yr);var yn=(At+Rt|0)+((St&8191)<<13)|0;At=(Tt+(St>>>13)|0)+(yn>>>26)|0,yn&=67108863,Rt=Math.imul(nr,ar),St=Math.imul(nr,yr),St=St+Math.imul(Zt,ar)|0,Tt=Math.imul(Zt,yr),Rt=Rt+Math.imul(Nt,Rr)|0,St=St+Math.imul(Nt,Wr)|0,St=St+Math.imul(tr,Rr)|0,Tt=Tt+Math.imul(tr,Wr)|0;var _n=(At+Rt|0)+((St&8191)<<13)|0;At=(Tt+(St>>>13)|0)+(_n>>>26)|0,_n&=67108863,Rt=Math.imul(Qt,ar),St=Math.imul(Qt,yr),St=St+Math.imul(Ht,ar)|0,Tt=Math.imul(Ht,yr),Rt=Rt+Math.imul(nr,Rr)|0,St=St+Math.imul(nr,Wr)|0,St=St+Math.imul(Zt,Rr)|0,Tt=Tt+Math.imul(Zt,Wr)|0,Rt=Rt+Math.imul(Nt,Fr)|0,St=St+Math.imul(Nt,pn)|0,St=St+Math.imul(tr,Fr)|0,Tt=Tt+Math.imul(tr,pn)|0;var ds=(At+Rt|0)+((St&8191)<<13)|0;At=(Tt+(St>>>13)|0)+(ds>>>26)|0,ds&=67108863,Rt=Math.imul(Jt,ar),St=Math.imul(Jt,yr),St=St+Math.imul(ur,ar)|0,Tt=Math.imul(ur,yr),Rt=Rt+Math.imul(Qt,Rr)|0,St=St+Math.imul(Qt,Wr)|0,St=St+Math.imul(Ht,Rr)|0,Tt=Tt+Math.imul(Ht,Wr)|0,Rt=Rt+Math.imul(nr,Fr)|0,St=St+Math.imul(nr,pn)|0,St=St+Math.imul(Zt,Fr)|0,Tt=Tt+Math.imul(Zt,pn)|0,Rt=Rt+Math.imul(Nt,Qr)|0,St=St+Math.imul(Nt,mn)|0,St=St+Math.imul(tr,Qr)|0,Tt=Tt+Math.imul(tr,mn)|0;var fs=(At+Rt|0)+((St&8191)<<13)|0;At=(Tt+(St>>>13)|0)+(fs>>>26)|0,fs&=67108863,Rt=Math.imul(pr,ar),St=Math.imul(pr,yr),St=St+Math.imul(Cr,ar)|0,Tt=Math.imul(Cr,yr),Rt=Rt+Math.imul(Jt,Rr)|0,St=St+Math.imul(Jt,Wr)|0,St=St+Math.imul(ur,Rr)|0,Tt=Tt+Math.imul(ur,Wr)|0,Rt=Rt+Math.imul(Qt,Fr)|0,St=St+Math.imul(Qt,pn)|0,St=St+Math.imul(Ht,Fr)|0,Tt=Tt+Math.imul(Ht,pn)|0,Rt=Rt+Math.imul(nr,Qr)|0,St=St+Math.imul(nr,mn)|0,St=St+Math.imul(Zt,Qr)|0,Tt=Tt+Math.imul(Zt,mn)|0,Rt=Rt+Math.imul(Nt,qr)|0,St=St+Math.imul(Nt,En)|0,St=St+Math.imul(tr,qr)|0,Tt=Tt+Math.imul(tr,En)|0;var hs=(At+Rt|0)+((St&8191)<<13)|0;At=(Tt+(St>>>13)|0)+(hs>>>26)|0,hs&=67108863,Rt=Math.imul(lr,ar),St=Math.imul(lr,yr),St=St+Math.imul(fr,ar)|0,Tt=Math.imul(fr,yr),Rt=Rt+Math.imul(pr,Rr)|0,St=St+Math.imul(pr,Wr)|0,St=St+Math.imul(Cr,Rr)|0,Tt=Tt+Math.imul(Cr,Wr)|0,Rt=Rt+Math.imul(Jt,Fr)|0,St=St+Math.imul(Jt,pn)|0,St=St+Math.imul(ur,Fr)|0,Tt=Tt+Math.imul(ur,pn)|0,Rt=Rt+Math.imul(Qt,Qr)|0,St=St+Math.imul(Qt,mn)|0,St=St+Math.imul(Ht,Qr)|0,Tt=Tt+Math.imul(Ht,mn)|0,Rt=Rt+Math.imul(nr,qr)|0,St=St+Math.imul(nr,En)|0,St=St+Math.imul(Zt,qr)|0,Tt=Tt+Math.imul(Zt,En)|0,Rt=Rt+Math.imul(Nt,Vr)|0,St=St+Math.imul(Nt,hn)|0,St=St+Math.imul(tr,Vr)|0,Tt=Tt+Math.imul(tr,hn)|0;var ps=(At+Rt|0)+((St&8191)<<13)|0;At=(Tt+(St>>>13)|0)+(ps>>>26)|0,ps&=67108863,Rt=Math.imul(Sr,ar),St=Math.imul(Sr,yr),St=St+Math.imul(kr,ar)|0,Tt=Math.imul(kr,yr),Rt=Rt+Math.imul(lr,Rr)|0,St=St+Math.imul(lr,Wr)|0,St=St+Math.imul(fr,Rr)|0,Tt=Tt+Math.imul(fr,Wr)|0,Rt=Rt+Math.imul(pr,Fr)|0,St=St+Math.imul(pr,pn)|0,St=St+Math.imul(Cr,Fr)|0,Tt=Tt+Math.imul(Cr,pn)|0,Rt=Rt+Math.imul(Jt,Qr)|0,St=St+Math.imul(Jt,mn)|0,St=St+Math.imul(ur,Qr)|0,Tt=Tt+Math.imul(ur,mn)|0,Rt=Rt+Math.imul(Qt,qr)|0,St=St+Math.imul(Qt,En)|0,St=St+Math.imul(Ht,qr)|0,Tt=Tt+Math.imul(Ht,En)|0,Rt=Rt+Math.imul(nr,Vr)|0,St=St+Math.imul(nr,hn)|0,St=St+Math.imul(Zt,Vr)|0,Tt=Tt+Math.imul(Zt,hn)|0,Rt=Rt+Math.imul(Nt,Kr)|0,St=St+Math.imul(Nt,Rn)|0,St=St+Math.imul(tr,Kr)|0,Tt=Tt+Math.imul(tr,Rn)|0;var Vn=(At+Rt|0)+((St&8191)<<13)|0;At=(Tt+(St>>>13)|0)+(Vn>>>26)|0,Vn&=67108863,Rt=Math.imul($r,ar),St=Math.imul($r,yr),St=St+Math.imul(Or,ar)|0,Tt=Math.imul(Or,yr),Rt=Rt+Math.imul(Sr,Rr)|0,St=St+Math.imul(Sr,Wr)|0,St=St+Math.imul(kr,Rr)|0,Tt=Tt+Math.imul(kr,Wr)|0,Rt=Rt+Math.imul(lr,Fr)|0,St=St+Math.imul(lr,pn)|0,St=St+Math.imul(fr,Fr)|0,Tt=Tt+Math.imul(fr,pn)|0,Rt=Rt+Math.imul(pr,Qr)|0,St=St+Math.imul(pr,mn)|0,St=St+Math.imul(Cr,Qr)|0,Tt=Tt+Math.imul(Cr,mn)|0,Rt=Rt+Math.imul(Jt,qr)|0,St=St+Math.imul(Jt,En)|0,St=St+Math.imul(ur,qr)|0,Tt=Tt+Math.imul(ur,En)|0,Rt=Rt+Math.imul(Qt,Vr)|0,St=St+Math.imul(Qt,hn)|0,St=St+Math.imul(Ht,Vr)|0,Tt=Tt+Math.imul(Ht,hn)|0,Rt=Rt+Math.imul(nr,Kr)|0,St=St+Math.imul(nr,Rn)|0,St=St+Math.imul(Zt,Kr)|0,Tt=Tt+Math.imul(Zt,Rn)|0,Rt=Rt+Math.imul(Nt,Gr)|0,St=St+Math.imul(Nt,gn)|0,St=St+Math.imul(tr,Gr)|0,Tt=Tt+Math.imul(tr,gn)|0;var ss=(At+Rt|0)+((St&8191)<<13)|0;At=(Tt+(St>>>13)|0)+(ss>>>26)|0,ss&=67108863,Rt=Math.imul(or,ar),St=Math.imul(or,yr),St=St+Math.imul(Yt,ar)|0,Tt=Math.imul(Yt,yr),Rt=Rt+Math.imul($r,Rr)|0,St=St+Math.imul($r,Wr)|0,St=St+Math.imul(Or,Rr)|0,Tt=Tt+Math.imul(Or,Wr)|0,Rt=Rt+Math.imul(Sr,Fr)|0,St=St+Math.imul(Sr,pn)|0,St=St+Math.imul(kr,Fr)|0,Tt=Tt+Math.imul(kr,pn)|0,Rt=Rt+Math.imul(lr,Qr)|0,St=St+Math.imul(lr,mn)|0,St=St+Math.imul(fr,Qr)|0,Tt=Tt+Math.imul(fr,mn)|0,Rt=Rt+Math.imul(pr,qr)|0,St=St+Math.imul(pr,En)|0,St=St+Math.imul(Cr,qr)|0,Tt=Tt+Math.imul(Cr,En)|0,Rt=Rt+Math.imul(Jt,Vr)|0,St=St+Math.imul(Jt,hn)|0,St=St+Math.imul(ur,Vr)|0,Tt=Tt+Math.imul(ur,hn)|0,Rt=Rt+Math.imul(Qt,Kr)|0,St=St+Math.imul(Qt,Rn)|0,St=St+Math.imul(Ht,Kr)|0,Tt=Tt+Math.imul(Ht,Rn)|0,Rt=Rt+Math.imul(nr,Gr)|0,St=St+Math.imul(nr,gn)|0,St=St+Math.imul(Zt,Gr)|0,Tt=Tt+Math.imul(Zt,gn)|0,Rt=Rt+Math.imul(Nt,Zr)|0,St=St+Math.imul(Nt,An)|0,St=St+Math.imul(tr,Zr)|0,Tt=Tt+Math.imul(tr,An)|0;var Jn=(At+Rt|0)+((St&8191)<<13)|0;At=(Tt+(St>>>13)|0)+(Jn>>>26)|0,Jn&=67108863,Rt=Math.imul(Gt,ar),St=Math.imul(Gt,yr),St=St+Math.imul(Vt,ar)|0,Tt=Math.imul(Vt,yr),Rt=Rt+Math.imul(or,Rr)|0,St=St+Math.imul(or,Wr)|0,St=St+Math.imul(Yt,Rr)|0,Tt=Tt+Math.imul(Yt,Wr)|0,Rt=Rt+Math.imul($r,Fr)|0,St=St+Math.imul($r,pn)|0,St=St+Math.imul(Or,Fr)|0,Tt=Tt+Math.imul(Or,pn)|0,Rt=Rt+Math.imul(Sr,Qr)|0,St=St+Math.imul(Sr,mn)|0,St=St+Math.imul(kr,Qr)|0,Tt=Tt+Math.imul(kr,mn)|0,Rt=Rt+Math.imul(lr,qr)|0,St=St+Math.imul(lr,En)|0,St=St+Math.imul(fr,qr)|0,Tt=Tt+Math.imul(fr,En)|0,Rt=Rt+Math.imul(pr,Vr)|0,St=St+Math.imul(pr,hn)|0,St=St+Math.imul(Cr,Vr)|0,Tt=Tt+Math.imul(Cr,hn)|0,Rt=Rt+Math.imul(Jt,Kr)|0,St=St+Math.imul(Jt,Rn)|0,St=St+Math.imul(ur,Kr)|0,Tt=Tt+Math.imul(ur,Rn)|0,Rt=Rt+Math.imul(Qt,Gr)|0,St=St+Math.imul(Qt,gn)|0,St=St+Math.imul(Ht,Gr)|0,Tt=Tt+Math.imul(Ht,gn)|0,Rt=Rt+Math.imul(nr,Zr)|0,St=St+Math.imul(nr,An)|0,St=St+Math.imul(Zt,Zr)|0,Tt=Tt+Math.imul(Zt,An)|0,Rt=Rt+Math.imul(Nt,nn)|0,St=St+Math.imul(Nt,Pn)|0,St=St+Math.imul(tr,nn)|0,Tt=Tt+Math.imul(tr,Pn)|0;var Yn=(At+Rt|0)+((St&8191)<<13)|0;At=(Tt+(St>>>13)|0)+(Yn>>>26)|0,Yn&=67108863,Rt=Math.imul(Gt,Rr),St=Math.imul(Gt,Wr),St=St+Math.imul(Vt,Rr)|0,Tt=Math.imul(Vt,Wr),Rt=Rt+Math.imul(or,Fr)|0,St=St+Math.imul(or,pn)|0,St=St+Math.imul(Yt,Fr)|0,Tt=Tt+Math.imul(Yt,pn)|0,Rt=Rt+Math.imul($r,Qr)|0,St=St+Math.imul($r,mn)|0,St=St+Math.imul(Or,Qr)|0,Tt=Tt+Math.imul(Or,mn)|0,Rt=Rt+Math.imul(Sr,qr)|0,St=St+Math.imul(Sr,En)|0,St=St+Math.imul(kr,qr)|0,Tt=Tt+Math.imul(kr,En)|0,Rt=Rt+Math.imul(lr,Vr)|0,St=St+Math.imul(lr,hn)|0,St=St+Math.imul(fr,Vr)|0,Tt=Tt+Math.imul(fr,hn)|0,Rt=Rt+Math.imul(pr,Kr)|0,St=St+Math.imul(pr,Rn)|0,St=St+Math.imul(Cr,Kr)|0,Tt=Tt+Math.imul(Cr,Rn)|0,Rt=Rt+Math.imul(Jt,Gr)|0,St=St+Math.imul(Jt,gn)|0,St=St+Math.imul(ur,Gr)|0,Tt=Tt+Math.imul(ur,gn)|0,Rt=Rt+Math.imul(Qt,Zr)|0,St=St+Math.imul(Qt,An)|0,St=St+Math.imul(Ht,Zr)|0,Tt=Tt+Math.imul(Ht,An)|0,Rt=Rt+Math.imul(nr,nn)|0,St=St+Math.imul(nr,Pn)|0,St=St+Math.imul(Zt,nn)|0,Tt=Tt+Math.imul(Zt,Pn)|0;var ms=(At+Rt|0)+((St&8191)<<13)|0;At=(Tt+(St>>>13)|0)+(ms>>>26)|0,ms&=67108863,Rt=Math.imul(Gt,Fr),St=Math.imul(Gt,pn),St=St+Math.imul(Vt,Fr)|0,Tt=Math.imul(Vt,pn),Rt=Rt+Math.imul(or,Qr)|0,St=St+Math.imul(or,mn)|0,St=St+Math.imul(Yt,Qr)|0,Tt=Tt+Math.imul(Yt,mn)|0,Rt=Rt+Math.imul($r,qr)|0,St=St+Math.imul($r,En)|0,St=St+Math.imul(Or,qr)|0,Tt=Tt+Math.imul(Or,En)|0,Rt=Rt+Math.imul(Sr,Vr)|0,St=St+Math.imul(Sr,hn)|0,St=St+Math.imul(kr,Vr)|0,Tt=Tt+Math.imul(kr,hn)|0,Rt=Rt+Math.imul(lr,Kr)|0,St=St+Math.imul(lr,Rn)|0,St=St+Math.imul(fr,Kr)|0,Tt=Tt+Math.imul(fr,Rn)|0,Rt=Rt+Math.imul(pr,Gr)|0,St=St+Math.imul(pr,gn)|0,St=St+Math.imul(Cr,Gr)|0,Tt=Tt+Math.imul(Cr,gn)|0,Rt=Rt+Math.imul(Jt,Zr)|0,St=St+Math.imul(Jt,An)|0,St=St+Math.imul(ur,Zr)|0,Tt=Tt+Math.imul(ur,An)|0,Rt=Rt+Math.imul(Qt,nn)|0,St=St+Math.imul(Qt,Pn)|0,St=St+Math.imul(Ht,nn)|0,Tt=Tt+Math.imul(Ht,Pn)|0;var Qn=(At+Rt|0)+((St&8191)<<13)|0;At=(Tt+(St>>>13)|0)+(Qn>>>26)|0,Qn&=67108863,Rt=Math.imul(Gt,Qr),St=Math.imul(Gt,mn),St=St+Math.imul(Vt,Qr)|0,Tt=Math.imul(Vt,mn),Rt=Rt+Math.imul(or,qr)|0,St=St+Math.imul(or,En)|0,St=St+Math.imul(Yt,qr)|0,Tt=Tt+Math.imul(Yt,En)|0,Rt=Rt+Math.imul($r,Vr)|0,St=St+Math.imul($r,hn)|0,St=St+Math.imul(Or,Vr)|0,Tt=Tt+Math.imul(Or,hn)|0,Rt=Rt+Math.imul(Sr,Kr)|0,St=St+Math.imul(Sr,Rn)|0,St=St+Math.imul(kr,Kr)|0,Tt=Tt+Math.imul(kr,Rn)|0,Rt=Rt+Math.imul(lr,Gr)|0,St=St+Math.imul(lr,gn)|0,St=St+Math.imul(fr,Gr)|0,Tt=Tt+Math.imul(fr,gn)|0,Rt=Rt+Math.imul(pr,Zr)|0,St=St+Math.imul(pr,An)|0,St=St+Math.imul(Cr,Zr)|0,Tt=Tt+Math.imul(Cr,An)|0,Rt=Rt+Math.imul(Jt,nn)|0,St=St+Math.imul(Jt,Pn)|0,St=St+Math.imul(ur,nn)|0,Tt=Tt+Math.imul(ur,Pn)|0;var es=(At+Rt|0)+((St&8191)<<13)|0;At=(Tt+(St>>>13)|0)+(es>>>26)|0,es&=67108863,Rt=Math.imul(Gt,qr),St=Math.imul(Gt,En),St=St+Math.imul(Vt,qr)|0,Tt=Math.imul(Vt,En),Rt=Rt+Math.imul(or,Vr)|0,St=St+Math.imul(or,hn)|0,St=St+Math.imul(Yt,Vr)|0,Tt=Tt+Math.imul(Yt,hn)|0,Rt=Rt+Math.imul($r,Kr)|0,St=St+Math.imul($r,Rn)|0,St=St+Math.imul(Or,Kr)|0,Tt=Tt+Math.imul(Or,Rn)|0,Rt=Rt+Math.imul(Sr,Gr)|0,St=St+Math.imul(Sr,gn)|0,St=St+Math.imul(kr,Gr)|0,Tt=Tt+Math.imul(kr,gn)|0,Rt=Rt+Math.imul(lr,Zr)|0,St=St+Math.imul(lr,An)|0,St=St+Math.imul(fr,Zr)|0,Tt=Tt+Math.imul(fr,An)|0,Rt=Rt+Math.imul(pr,nn)|0,St=St+Math.imul(pr,Pn)|0,St=St+Math.imul(Cr,nn)|0,Tt=Tt+Math.imul(Cr,Pn)|0;var ls=(At+Rt|0)+((St&8191)<<13)|0;At=(Tt+(St>>>13)|0)+(ls>>>26)|0,ls&=67108863,Rt=Math.imul(Gt,Vr),St=Math.imul(Gt,hn),St=St+Math.imul(Vt,Vr)|0,Tt=Math.imul(Vt,hn),Rt=Rt+Math.imul(or,Kr)|0,St=St+Math.imul(or,Rn)|0,St=St+Math.imul(Yt,Kr)|0,Tt=Tt+Math.imul(Yt,Rn)|0,Rt=Rt+Math.imul($r,Gr)|0,St=St+Math.imul($r,gn)|0,St=St+Math.imul(Or,Gr)|0,Tt=Tt+Math.imul(Or,gn)|0,Rt=Rt+Math.imul(Sr,Zr)|0,St=St+Math.imul(Sr,An)|0,St=St+Math.imul(kr,Zr)|0,Tt=Tt+Math.imul(kr,An)|0,Rt=Rt+Math.imul(lr,nn)|0,St=St+Math.imul(lr,Pn)|0,St=St+Math.imul(fr,nn)|0,Tt=Tt+Math.imul(fr,Pn)|0;var us=(At+Rt|0)+((St&8191)<<13)|0;At=(Tt+(St>>>13)|0)+(us>>>26)|0,us&=67108863,Rt=Math.imul(Gt,Kr),St=Math.imul(Gt,Rn),St=St+Math.imul(Vt,Kr)|0,Tt=Math.imul(Vt,Rn),Rt=Rt+Math.imul(or,Gr)|0,St=St+Math.imul(or,gn)|0,St=St+Math.imul(Yt,Gr)|0,Tt=Tt+Math.imul(Yt,gn)|0,Rt=Rt+Math.imul($r,Zr)|0,St=St+Math.imul($r,An)|0,St=St+Math.imul(Or,Zr)|0,Tt=Tt+Math.imul(Or,An)|0,Rt=Rt+Math.imul(Sr,nn)|0,St=St+Math.imul(Sr,Pn)|0,St=St+Math.imul(kr,nn)|0,Tt=Tt+Math.imul(kr,Pn)|0;var Wn=(At+Rt|0)+((St&8191)<<13)|0;At=(Tt+(St>>>13)|0)+(Wn>>>26)|0,Wn&=67108863,Rt=Math.imul(Gt,Gr),St=Math.imul(Gt,gn),St=St+Math.imul(Vt,Gr)|0,Tt=Math.imul(Vt,gn),Rt=Rt+Math.imul(or,Zr)|0,St=St+Math.imul(or,An)|0,St=St+Math.imul(Yt,Zr)|0,Tt=Tt+Math.imul(Yt,An)|0,Rt=Rt+Math.imul($r,nn)|0,St=St+Math.imul($r,Pn)|0,St=St+Math.imul(Or,nn)|0,Tt=Tt+Math.imul(Or,Pn)|0;var as=(At+Rt|0)+((St&8191)<<13)|0;At=(Tt+(St>>>13)|0)+(as>>>26)|0,as&=67108863,Rt=Math.imul(Gt,Zr),St=Math.imul(Gt,An),St=St+Math.imul(Vt,Zr)|0,Tt=Math.imul(Vt,An),Rt=Rt+Math.imul(or,nn)|0,St=St+Math.imul(or,Pn)|0,St=St+Math.imul(Yt,nn)|0,Tt=Tt+Math.imul(Yt,Pn)|0;var gs=(At+Rt|0)+((St&8191)<<13)|0;At=(Tt+(St>>>13)|0)+(gs>>>26)|0,gs&=67108863,Rt=Math.imul(Gt,nn),St=Math.imul(Gt,Pn),St=St+Math.imul(Vt,nn)|0,Tt=Math.imul(Vt,Pn);var vs=(At+Rt|0)+((St&8191)<<13)|0;return At=(Tt+(St>>>13)|0)+(vs>>>26)|0,vs&=67108863,xt[0]=yn,xt[1]=_n,xt[2]=ds,xt[3]=fs,xt[4]=hs,xt[5]=ps,xt[6]=Vn,xt[7]=ss,xt[8]=Jn,xt[9]=Yn,xt[10]=ms,xt[11]=Qn,xt[12]=es,xt[13]=ls,xt[14]=us,xt[15]=Wn,xt[16]=as,xt[17]=gs,xt[18]=vs,At!==0&&(xt[19]=At,ct.length++),ct};Math.imul||(wt=yt);function Ct(jt,bt,vt){vt.negative=bt.negative^jt.negative,vt.length=jt.length+bt.length;for(var ct=0,dt=0,mt=0;mt>>26)|0,dt+=xt>>>26,xt&=67108863}vt.words[mt]=At,ct=xt,xt=dt}return ct!==0?vt.words[mt]=ct:vt.length--,vt.strip()}function Pt(jt,bt,vt){var ct=new $t;return ct.mulp(jt,bt,vt)}tt.prototype.mulTo=function(bt,vt){var ct,dt=this.length+bt.length;return this.length===10&&bt.length===10?ct=wt(this,bt,vt):dt<63?ct=yt(this,bt,vt):dt<1024?ct=Ct(this,bt,vt):ct=Pt(this,bt,vt),ct};function $t(jt,bt){this.x=jt,this.y=bt}$t.prototype.makeRBT=function(bt){for(var vt=new Array(bt),ct=tt.prototype._countBits(bt)-1,dt=0;dt>=1;return dt},$t.prototype.permute=function(bt,vt,ct,dt,mt,xt){for(var At=0;At>>1)mt++;return 1<>>13,ct[2*xt+1]=mt&8191,mt=mt>>>13;for(xt=2*vt;xt>=26,vt+=dt/67108864|0,vt+=mt>>>26,this.words[ct]=mt&67108863}return vt!==0&&(this.words[ct]=vt,this.length++),this},tt.prototype.muln=function(bt){return this.clone().imuln(bt)},tt.prototype.sqr=function(){return this.mul(this)},tt.prototype.isqr=function(){return this.imul(this.clone())},tt.prototype.pow=function(bt){var vt=ht(bt);if(vt.length===0)return new tt(1);for(var ct=this,dt=0;dt=0);var vt=bt%26,ct=(bt-vt)/26,dt=67108863>>>26-vt<<26-vt,mt;if(vt!==0){var xt=0;for(mt=0;mt>>26-vt}xt&&(this.words[mt]=xt,this.length++)}if(ct!==0){for(mt=this.length-1;mt>=0;mt--)this.words[mt+ct]=this.words[mt];for(mt=0;mt=0);var dt;vt?dt=(vt-vt%26)/26:dt=0;var mt=bt%26,xt=Math.min((bt-mt)/26,this.length),At=67108863^67108863>>>mt<xt)for(this.length-=xt,St=0;St=0&&(Tt!==0||St>=dt);St--){var Et=this.words[St]|0;this.words[St]=Tt<<26-mt|Et>>>mt,Tt=Et&At}return Rt&&Tt!==0&&(Rt.words[Rt.length++]=Tt),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},tt.prototype.ishrn=function(bt,vt,ct){return j(this.negative===0),this.iushrn(bt,vt,ct)},tt.prototype.shln=function(bt){return this.clone().ishln(bt)},tt.prototype.ushln=function(bt){return this.clone().iushln(bt)},tt.prototype.shrn=function(bt){return this.clone().ishrn(bt)},tt.prototype.ushrn=function(bt){return this.clone().iushrn(bt)},tt.prototype.testn=function(bt){j(typeof bt=="number"&&bt>=0);var vt=bt%26,ct=(bt-vt)/26,dt=1<=0);var vt=bt%26,ct=(bt-vt)/26;if(j(this.negative===0,"imaskn works only with positive numbers"),this.length<=ct)return this;if(vt!==0&&ct++,this.length=Math.min(ct,this.length),vt!==0){var dt=67108863^67108863>>>vt<=67108864;vt++)this.words[vt]-=67108864,vt===this.length-1?this.words[vt+1]=1:this.words[vt+1]++;return this.length=Math.max(this.length,vt+1),this},tt.prototype.isubn=function(bt){if(j(typeof bt=="number"),j(bt<67108864),bt<0)return this.iaddn(-bt);if(this.negative!==0)return this.negative=0,this.iaddn(bt),this.negative=1,this;if(this.words[0]-=bt,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var vt=0;vt>26)-(Rt/67108864|0),this.words[mt+ct]=xt&67108863}for(;mt>26,this.words[mt+ct]=xt&67108863;if(At===0)return this.strip();for(j(At===-1),At=0,mt=0;mt>26,this.words[mt]=xt&67108863;return this.negative=1,this.strip()},tt.prototype._wordDiv=function(bt,vt){var ct=this.length-bt.length,dt=this.clone(),mt=bt,xt=mt.words[mt.length-1]|0,At=this._countBits(xt);ct=26-At,ct!==0&&(mt=mt.ushln(ct),dt.iushln(ct),xt=mt.words[mt.length-1]|0);var Rt=dt.length-mt.length,St;if(vt!=="mod"){St=new tt(null),St.length=Rt+1,St.words=new Array(St.length);for(var Tt=0;Tt=0;Nt--){var tr=(dt.words[mt.length+Nt]|0)*67108864+(dt.words[mt.length+Nt-1]|0);for(tr=Math.min(tr/xt|0,67108863),dt._ishlnsubmul(mt,tr,Nt);dt.negative!==0;)tr--,dt.negative=0,dt._ishlnsubmul(mt,1,Nt),dt.isZero()||(dt.negative^=1);St&&(St.words[Nt]=tr)}return St&&St.strip(),dt.strip(),vt!=="div"&&ct!==0&&dt.iushrn(ct),{div:St||null,mod:dt}},tt.prototype.divmod=function(bt,vt,ct){if(j(!bt.isZero()),this.isZero())return{div:new tt(0),mod:new tt(0)};var dt,mt,xt;return this.negative!==0&&bt.negative===0?(xt=this.neg().divmod(bt,vt),vt!=="mod"&&(dt=xt.div.neg()),vt!=="div"&&(mt=xt.mod.neg(),ct&&mt.negative!==0&&mt.iadd(bt)),{div:dt,mod:mt}):this.negative===0&&bt.negative!==0?(xt=this.divmod(bt.neg(),vt),vt!=="mod"&&(dt=xt.div.neg()),{div:dt,mod:xt.mod}):this.negative&bt.negative?(xt=this.neg().divmod(bt.neg(),vt),vt!=="div"&&(mt=xt.mod.neg(),ct&&mt.negative!==0&&mt.isub(bt)),{div:xt.div,mod:mt}):bt.length>this.length||this.cmp(bt)<0?{div:new tt(0),mod:this}:bt.length===1?vt==="div"?{div:this.divn(bt.words[0]),mod:null}:vt==="mod"?{div:null,mod:new tt(this.modn(bt.words[0]))}:{div:this.divn(bt.words[0]),mod:new tt(this.modn(bt.words[0]))}:this._wordDiv(bt,vt)},tt.prototype.div=function(bt){return this.divmod(bt,"div",!1).div},tt.prototype.mod=function(bt){return this.divmod(bt,"mod",!1).mod},tt.prototype.umod=function(bt){return this.divmod(bt,"mod",!0).mod},tt.prototype.divRound=function(bt){var vt=this.divmod(bt);if(vt.mod.isZero())return vt.div;var ct=vt.div.negative!==0?vt.mod.isub(bt):vt.mod,dt=bt.ushrn(1),mt=bt.andln(1),xt=ct.cmp(dt);return xt<0||mt===1&&xt===0?vt.div:vt.div.negative!==0?vt.div.isubn(1):vt.div.iaddn(1)},tt.prototype.modn=function(bt){j(bt<=67108863);for(var vt=(1<<26)%bt,ct=0,dt=this.length-1;dt>=0;dt--)ct=(vt*ct+(this.words[dt]|0))%bt;return ct},tt.prototype.idivn=function(bt){j(bt<=67108863);for(var vt=0,ct=this.length-1;ct>=0;ct--){var dt=(this.words[ct]|0)+vt*67108864;this.words[ct]=dt/bt|0,vt=dt%bt}return this.strip()},tt.prototype.divn=function(bt){return this.clone().idivn(bt)},tt.prototype.egcd=function(bt){j(bt.negative===0),j(!bt.isZero());var vt=this,ct=bt.clone();vt.negative!==0?vt=vt.umod(bt):vt=vt.clone();for(var dt=new tt(1),mt=new tt(0),xt=new tt(0),At=new tt(1),Rt=0;vt.isEven()&&ct.isEven();)vt.iushrn(1),ct.iushrn(1),++Rt;for(var St=ct.clone(),Tt=vt.clone();!vt.isZero();){for(var Et=0,Nt=1;!(vt.words[0]&Nt)&&Et<26;++Et,Nt<<=1);if(Et>0)for(vt.iushrn(Et);Et-- >0;)(dt.isOdd()||mt.isOdd())&&(dt.iadd(St),mt.isub(Tt)),dt.iushrn(1),mt.iushrn(1);for(var tr=0,ir=1;!(ct.words[0]&ir)&&tr<26;++tr,ir<<=1);if(tr>0)for(ct.iushrn(tr);tr-- >0;)(xt.isOdd()||At.isOdd())&&(xt.iadd(St),At.isub(Tt)),xt.iushrn(1),At.iushrn(1);vt.cmp(ct)>=0?(vt.isub(ct),dt.isub(xt),mt.isub(At)):(ct.isub(vt),xt.isub(dt),At.isub(mt))}return{a:xt,b:At,gcd:ct.iushln(Rt)}},tt.prototype._invmp=function(bt){j(bt.negative===0),j(!bt.isZero());var vt=this,ct=bt.clone();vt.negative!==0?vt=vt.umod(bt):vt=vt.clone();for(var dt=new tt(1),mt=new tt(0),xt=ct.clone();vt.cmpn(1)>0&&ct.cmpn(1)>0;){for(var At=0,Rt=1;!(vt.words[0]&Rt)&&At<26;++At,Rt<<=1);if(At>0)for(vt.iushrn(At);At-- >0;)dt.isOdd()&&dt.iadd(xt),dt.iushrn(1);for(var St=0,Tt=1;!(ct.words[0]&Tt)&&St<26;++St,Tt<<=1);if(St>0)for(ct.iushrn(St);St-- >0;)mt.isOdd()&&mt.iadd(xt),mt.iushrn(1);vt.cmp(ct)>=0?(vt.isub(ct),dt.isub(mt)):(ct.isub(vt),mt.isub(dt))}var Et;return vt.cmpn(1)===0?Et=dt:Et=mt,Et.cmpn(0)<0&&Et.iadd(bt),Et},tt.prototype.gcd=function(bt){if(this.isZero())return bt.abs();if(bt.isZero())return this.abs();var vt=this.clone(),ct=bt.clone();vt.negative=0,ct.negative=0;for(var dt=0;vt.isEven()&&ct.isEven();dt++)vt.iushrn(1),ct.iushrn(1);do{for(;vt.isEven();)vt.iushrn(1);for(;ct.isEven();)ct.iushrn(1);var mt=vt.cmp(ct);if(mt<0){var xt=vt;vt=ct,ct=xt}else if(mt===0||ct.cmpn(1)===0)break;vt.isub(ct)}while(!0);return ct.iushln(dt)},tt.prototype.invm=function(bt){return this.egcd(bt).a.umod(bt)},tt.prototype.isEven=function(){return(this.words[0]&1)===0},tt.prototype.isOdd=function(){return(this.words[0]&1)===1},tt.prototype.andln=function(bt){return this.words[0]&bt},tt.prototype.bincn=function(bt){j(typeof bt=="number");var vt=bt%26,ct=(bt-vt)/26,dt=1<>>26,At&=67108863,this.words[xt]=At}return mt!==0&&(this.words[xt]=mt,this.length++),this},tt.prototype.isZero=function(){return this.length===1&&this.words[0]===0},tt.prototype.cmpn=function(bt){var vt=bt<0;if(this.negative!==0&&!vt)return-1;if(this.negative===0&&vt)return 1;this.strip();var ct;if(this.length>1)ct=1;else{vt&&(bt=-bt),j(bt<=67108863,"Number is too big");var dt=this.words[0]|0;ct=dt===bt?0:dtbt.length)return 1;if(this.length=0;ct--){var dt=this.words[ct]|0,mt=bt.words[ct]|0;if(dt!==mt){dtmt&&(vt=1);break}}return vt},tt.prototype.gtn=function(bt){return this.cmpn(bt)===1},tt.prototype.gt=function(bt){return this.cmp(bt)===1},tt.prototype.gten=function(bt){return this.cmpn(bt)>=0},tt.prototype.gte=function(bt){return this.cmp(bt)>=0},tt.prototype.ltn=function(bt){return this.cmpn(bt)===-1},tt.prototype.lt=function(bt){return this.cmp(bt)===-1},tt.prototype.lten=function(bt){return this.cmpn(bt)<=0},tt.prototype.lte=function(bt){return this.cmp(bt)<=0},tt.prototype.eqn=function(bt){return this.cmpn(bt)===0},tt.prototype.eq=function(bt){return this.cmp(bt)===0},tt.red=function(bt){return new Bt(bt)},tt.prototype.toRed=function(bt){return j(!this.red,"Already a number in reduction context"),j(this.negative===0,"red works only with positives"),bt.convertTo(this)._forceRed(bt)},tt.prototype.fromRed=function(){return j(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},tt.prototype._forceRed=function(bt){return this.red=bt,this},tt.prototype.forceRed=function(bt){return j(!this.red,"Already a number in reduction context"),this._forceRed(bt)},tt.prototype.redAdd=function(bt){return j(this.red,"redAdd works only with red numbers"),this.red.add(this,bt)},tt.prototype.redIAdd=function(bt){return j(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,bt)},tt.prototype.redSub=function(bt){return j(this.red,"redSub works only with red numbers"),this.red.sub(this,bt)},tt.prototype.redISub=function(bt){return j(this.red,"redISub works only with red numbers"),this.red.isub(this,bt)},tt.prototype.redShl=function(bt){return j(this.red,"redShl works only with red numbers"),this.red.shl(this,bt)},tt.prototype.redMul=function(bt){return j(this.red,"redMul works only with red numbers"),this.red._verify2(this,bt),this.red.mul(this,bt)},tt.prototype.redIMul=function(bt){return j(this.red,"redMul works only with red numbers"),this.red._verify2(this,bt),this.red.imul(this,bt)},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(bt){return j(this.red&&!bt.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,bt)};var Mt={k256:null,p224:null,p192:null,p25519:null};function Lt(jt,bt){this.name=jt,this.p=new tt(bt,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 bt=new tt(null);return bt.words=new Array(Math.ceil(this.n/13)),bt},Lt.prototype.ireduce=function(bt){var vt=bt,ct;do this.split(vt,this.tmp),vt=this.imulK(vt),vt=vt.iadd(this.tmp),ct=vt.bitLength();while(ct>this.n);var dt=ct0?vt.isub(this.p):vt.strip!==void 0?vt.strip():vt._strip(),vt},Lt.prototype.split=function(bt,vt){bt.iushrn(this.n,0,vt)},Lt.prototype.imulK=function(bt){return bt.imul(this.k)};function Dt(){Lt.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}et(Dt,Lt),Dt.prototype.split=function(bt,vt){for(var ct=4194303,dt=Math.min(bt.length,9),mt=0;mt>>22,xt=At}xt>>>=22,bt.words[mt-10]=xt,xt===0&&bt.length>10?bt.length-=10:bt.length-=9},Dt.prototype.imulK=function(bt){bt.words[bt.length]=0,bt.words[bt.length+1]=0,bt.length+=2;for(var vt=0,ct=0;ct>>=26,bt.words[ct]=mt,vt=dt}return vt!==0&&(bt.words[bt.length++]=vt),bt},tt._prime=function(bt){if(Mt[bt])return Mt[bt];var vt;if(bt==="k256")vt=new Dt;else if(bt==="p224")vt=new zt;else if(bt==="p192")vt=new Ot;else if(bt==="p25519")vt=new It;else throw new Error("Unknown prime "+bt);return Mt[bt]=vt,vt};function Bt(jt){if(typeof jt=="string"){var bt=tt._prime(jt);this.m=bt.p,this.prime=bt}else j(jt.gtn(1),"modulus must be greater than 1"),this.m=jt,this.prime=null}Bt.prototype._verify1=function(bt){j(bt.negative===0,"red works only with positives"),j(bt.red,"red works only with red numbers")},Bt.prototype._verify2=function(bt,vt){j((bt.negative|vt.negative)===0,"red works only with positives"),j(bt.red&&bt.red===vt.red,"red works only with red numbers")},Bt.prototype.imod=function(bt){return this.prime?this.prime.ireduce(bt)._forceRed(this):bt.umod(this.m)._forceRed(this)},Bt.prototype.neg=function(bt){return bt.isZero()?bt.clone():this.m.sub(bt)._forceRed(this)},Bt.prototype.add=function(bt,vt){this._verify2(bt,vt);var ct=bt.add(vt);return ct.cmp(this.m)>=0&&ct.isub(this.m),ct._forceRed(this)},Bt.prototype.iadd=function(bt,vt){this._verify2(bt,vt);var ct=bt.iadd(vt);return ct.cmp(this.m)>=0&&ct.isub(this.m),ct},Bt.prototype.sub=function(bt,vt){this._verify2(bt,vt);var ct=bt.sub(vt);return ct.cmpn(0)<0&&ct.iadd(this.m),ct._forceRed(this)},Bt.prototype.isub=function(bt,vt){this._verify2(bt,vt);var ct=bt.isub(vt);return ct.cmpn(0)<0&&ct.iadd(this.m),ct},Bt.prototype.shl=function(bt,vt){return this._verify1(bt),this.imod(bt.ushln(vt))},Bt.prototype.imul=function(bt,vt){return this._verify2(bt,vt),this.imod(bt.imul(vt))},Bt.prototype.mul=function(bt,vt){return this._verify2(bt,vt),this.imod(bt.mul(vt))},Bt.prototype.isqr=function(bt){return this.imul(bt,bt.clone())},Bt.prototype.sqr=function(bt){return this.mul(bt,bt)},Bt.prototype.sqrt=function(bt){if(bt.isZero())return bt.clone();var vt=this.m.andln(3);if(j(vt%2===1),vt===3){var ct=this.m.add(new tt(1)).iushrn(2);return this.pow(bt,ct)}for(var dt=this.m.subn(1),mt=0;!dt.isZero()&&dt.andln(1)===0;)mt++,dt.iushrn(1);j(!dt.isZero());var xt=new tt(1).toRed(this),At=xt.redNeg(),Rt=this.m.subn(1).iushrn(1),St=this.m.bitLength();for(St=new tt(2*St*St).toRed(this);this.pow(St,Rt).cmp(At)!==0;)St.redIAdd(At);for(var Tt=this.pow(St,dt),Et=this.pow(bt,dt.addn(1).iushrn(1)),Nt=this.pow(bt,dt),tr=mt;Nt.cmp(xt)!==0;){for(var ir=Nt,nr=0;ir.cmp(xt)!==0;nr++)ir=ir.redSqr();j(nr=0;mt--){for(var Tt=vt.words[mt],Et=St-1;Et>=0;Et--){var Nt=Tt>>Et&1;if(xt!==dt[0]&&(xt=this.sqr(xt)),Nt===0&&At===0){Rt=0;continue}At<<=1,At|=Nt,Rt++,!(Rt!==ct&&(mt!==0||Et!==0))&&(xt=this.mul(xt,dt[At]),Rt=0,At=0)}St=26}return xt},Bt.prototype.convertTo=function(bt){var vt=bt.umod(this.m);return vt===bt?vt.clone():vt},Bt.prototype.convertFrom=function(bt){var vt=bt.clone();return vt.red=null,vt},tt.mont=function(bt){return new Ft(bt)};function Ft(jt){Bt.call(this,jt),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,Bt),Ft.prototype.convertTo=function(bt){return this.imod(bt.ushln(this.shift))},Ft.prototype.convertFrom=function(bt){var vt=this.imod(bt.mul(this.rinv));return vt.red=null,vt},Ft.prototype.imul=function(bt,vt){if(bt.isZero()||vt.isZero())return bt.words[0]=0,bt.length=1,bt;var ct=bt.imul(vt),dt=ct.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),mt=ct.isub(dt).iushrn(this.shift),xt=mt;return mt.cmp(this.m)>=0?xt=mt.isub(this.m):mt.cmpn(0)<0&&(xt=mt.iadd(this.m)),xt._forceRed(this)},Ft.prototype.mul=function(bt,vt){if(bt.isZero()||vt.isZero())return new tt(0)._forceRed(this);var ct=bt.mul(vt),dt=ct.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),mt=ct.isub(dt).iushrn(this.shift),xt=mt;return mt.cmp(this.m)>=0?xt=mt.isub(this.m):mt.cmpn(0)<0&&(xt=mt.iadd(this.m)),xt._forceRed(this)},Ft.prototype.invm=function(bt){var vt=this.imod(bt._invmp(this.m).mul(this.r2));return vt._forceRed(this)}})(a,commonjsGlobal)}(bn$2)),bn$2.exports}var utils$v={};(function(a){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=st&255;ot?nt.push(ot,at):nt.push(at)}return nt}_.toArray=$;function j(tt){return tt.length===1?"0"+tt:tt}_.zero2=j;function et(tt){for(var rt="",nt=0;nt(wt>>1)-1?Pt=(wt>>1)-$t:Pt=$t,Ct.isubn(Pt)):Pt=0,ht[yt]=Pt,Ct.iushrn(1)}return ht}_.getNAF=tt;function rt(ot,at){var ut=[[],[]];ot=ot.clone(),at=at.clone();for(var ht=0,yt=0,wt;ot.cmpn(-ht)>0||at.cmpn(-yt)>0;){var Ct=ot.andln(3)+ht&3,Pt=at.andln(3)+yt&3;Ct===3&&(Ct=-1),Pt===3&&(Pt=-1);var $t;Ct&1?(wt=ot.andln(7)+ht&7,(wt===3||wt===5)&&Pt===2?$t=-Ct:$t=Ct):$t=0,ut[0].push($t);var Mt;Pt&1?(wt=at.andln(7)+yt&7,(wt===3||wt===5)&&Ct===2?Mt=-Pt:Mt=Pt):Mt=0,ut[1].push(Mt),2*ht===$t+1&&(ht=1-ht),2*yt===Mt+1&&(yt=1-yt),ot.iushrn(1),at.iushrn(1)}return ut}_.getJSF=rt;function nt(ot,at,ut){var ht="_"+at;ot.prototype[at]=function(){return this[ht]!==void 0?this[ht]:this[ht]=ut.call(this)}}_.cachedProperty=nt;function it(ot){return typeof ot=="string"?_.toArray(ot,"hex"):ot}_.parseBytes=it;function st(ot){return new $(ot,"hex","le")}_.intFromLE=st}(utils$w)),utils$w}var curve$2={},base$5,hasRequiredBase$2;function requireBase$2(){if(hasRequiredBase$2)return base$5;hasRequiredBase$2=1;var a=requireBn$1(),_=requireUtils$1(),$=_.getNAF,j=_.getJSF,et=_.assert;function tt(nt,it){this.type=nt,this.p=new a(it.p,16),this.red=it.prime?a.red(it.prime):a.mont(this.p),this.zero=new a(0).toRed(this.red),this.one=new a(1).toRed(this.red),this.two=new a(2).toRed(this.red),this.n=it.n&&new a(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 st=this.n&&this.p.div(this.n);!st||st.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,st){et(it.precomputed);var ot=it._getDoubles(),at=$(st,1,this._bitLength),ut=(1<=yt;Ct--)wt=(wt<<1)+at[Ct];ht.push(wt)}for(var Pt=this.jpoint(null,null,null),$t=this.jpoint(null,null,null),Mt=ut;Mt>0;Mt--){for(yt=0;yt=0;wt--){for(var Ct=0;wt>=0&&ht[wt]===0;wt--)Ct++;if(wt>=0&&Ct++,yt=yt.dblp(Ct),wt<0)break;var Pt=ht[wt];et(Pt!==0),it.type==="affine"?Pt>0?yt=yt.mixedAdd(ut[Pt-1>>1]):yt=yt.mixedAdd(ut[-Pt-1>>1].neg()):Pt>0?yt=yt.add(ut[Pt-1>>1]):yt=yt.add(ut[-Pt-1>>1].neg())}return it.type==="affine"?yt.toP():yt},tt.prototype._wnafMulAdd=function(it,st,ot,at,ut){var ht=this._wnafT1,yt=this._wnafT2,wt=this._wnafT3,Ct=0,Pt,$t,Mt;for(Pt=0;Pt=1;Pt-=2){var Dt=Pt-1,zt=Pt;if(ht[Dt]!==1||ht[zt]!==1){wt[Dt]=$(ot[Dt],ht[Dt],this._bitLength),wt[zt]=$(ot[zt],ht[zt],this._bitLength),Ct=Math.max(wt[Dt].length,Ct),Ct=Math.max(wt[zt].length,Ct);continue}var Ot=[st[Dt],null,null,st[zt]];st[Dt].y.cmp(st[zt].y)===0?(Ot[1]=st[Dt].add(st[zt]),Ot[2]=st[Dt].toJ().mixedAdd(st[zt].neg())):st[Dt].y.cmp(st[zt].y.redNeg())===0?(Ot[1]=st[Dt].toJ().mixedAdd(st[zt]),Ot[2]=st[Dt].add(st[zt].neg())):(Ot[1]=st[Dt].toJ().mixedAdd(st[zt]),Ot[2]=st[Dt].toJ().mixedAdd(st[zt].neg()));var It=[-3,-1,-5,-7,0,7,5,1,3],Bt=j(ot[Dt],ot[zt]);for(Ct=Math.max(Bt[0].length,Ct),wt[Dt]=new Array(Ct),wt[zt]=new Array(Ct),$t=0;$t=0;Pt--){for(var ct=0;Pt>=0;){var dt=!0;for($t=0;$t=0&&ct++,bt=bt.dblp(ct),Pt<0)break;for($t=0;$t0?Mt=yt[$t][mt-1>>1]:mt<0&&(Mt=yt[$t][-mt-1>>1].neg()),Mt.type==="affine"?bt=bt.mixedAdd(Mt):bt=bt.add(Mt))}}for(Pt=0;Pt=Math.ceil((it.bitLength()+1)/st.step):!1},rt.prototype._getDoubles=function(it,st){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var ot=[this],at=this,ut=0;ut=0&&(Dt=Pt,zt=$t),Mt.negative&&(Mt=Mt.neg(),Lt=Lt.neg()),Dt.negative&&(Dt=Dt.neg(),zt=zt.neg()),[{a:Mt,b:Lt},{a:Dt,b:zt}]},tt.prototype._endoSplit=function(st){var ot=this.endo.basis,at=ot[0],ut=ot[1],ht=ut.b.mul(st).divRound(this.n),yt=at.b.neg().mul(st).divRound(this.n),wt=ht.mul(at.a),Ct=yt.mul(ut.a),Pt=ht.mul(at.b),$t=yt.mul(ut.b),Mt=st.sub(wt).sub(Ct),Lt=Pt.add($t).neg();return{k1:Mt,k2:Lt}},tt.prototype.pointFromX=function(st,ot){st=new _(st,16),st.red||(st=st.toRed(this.red));var at=st.redSqr().redMul(st).redIAdd(st.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(ot&&!ht||!ot&&ht)&&(ut=ut.redNeg()),this.point(st,ut)},tt.prototype.validate=function(st){if(st.inf)return!0;var ot=st.x,at=st.y,ut=this.a.redMul(ot),ht=ot.redSqr().redMul(ot).redIAdd(ut).redIAdd(this.b);return at.redSqr().redISub(ht).cmpn(0)===0},tt.prototype._endoWnafMulAdd=function(st,ot,at){for(var ut=this._endoWnafT1,ht=this._endoWnafT2,yt=0;yt":""},rt.prototype.isInfinity=function(){return this.inf},rt.prototype.add=function(st){if(this.inf)return st;if(st.inf)return this;if(this.eq(st))return this.dbl();if(this.neg().eq(st))return this.curve.point(null,null);if(this.x.cmp(st.x)===0)return this.curve.point(null,null);var ot=this.y.redSub(st.y);ot.cmpn(0)!==0&&(ot=ot.redMul(this.x.redSub(st.x).redInvm()));var at=ot.redSqr().redISub(this.x).redISub(st.x),ut=ot.redMul(this.x.redSub(at)).redISub(this.y);return this.curve.point(at,ut)},rt.prototype.dbl=function(){if(this.inf)return this;var st=this.y.redAdd(this.y);if(st.cmpn(0)===0)return this.curve.point(null,null);var ot=this.curve.a,at=this.x.redSqr(),ut=st.redInvm(),ht=at.redAdd(at).redIAdd(at).redIAdd(ot).redMul(ut),yt=ht.redSqr().redISub(this.x.redAdd(this.x)),wt=ht.redMul(this.x.redSub(yt)).redISub(this.y);return this.curve.point(yt,wt)},rt.prototype.getX=function(){return this.x.fromRed()},rt.prototype.getY=function(){return this.y.fromRed()},rt.prototype.mul=function(st){return st=new _(st,16),this.isInfinity()?this:this._hasDoubles(st)?this.curve._fixedNafMul(this,st):this.curve.endo?this.curve._endoWnafMulAdd([this],[st]):this.curve._wnafMul(this,st)},rt.prototype.mulAdd=function(st,ot,at){var ut=[this,ot],ht=[st,at];return this.curve.endo?this.curve._endoWnafMulAdd(ut,ht):this.curve._wnafMulAdd(1,ut,ht,2)},rt.prototype.jmulAdd=function(st,ot,at){var ut=[this,ot],ht=[st,at];return this.curve.endo?this.curve._endoWnafMulAdd(ut,ht,!0):this.curve._wnafMulAdd(1,ut,ht,2,!0)},rt.prototype.eq=function(st){return this===st||this.inf===st.inf&&(this.inf||this.x.cmp(st.x)===0&&this.y.cmp(st.y)===0)},rt.prototype.neg=function(st){if(this.inf)return this;var ot=this.curve.point(this.x,this.y.redNeg());if(st&&this.precomputed){var at=this.precomputed,ut=function(ht){return ht.neg()};ot.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 ot},rt.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var st=this.curve.jpoint(this.x,this.y,this.curve.one);return st};function nt(it,st,ot,at){j.BasePoint.call(this,it,"jacobian"),st===null&&ot===null&&at===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new _(0)):(this.x=new _(st,16),this.y=new _(ot,16),this.z=new _(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(st,ot,at){return new nt(this,st,ot,at)},nt.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var st=this.z.redInvm(),ot=st.redSqr(),at=this.x.redMul(ot),ut=this.y.redMul(ot).redMul(st);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(st){if(this.isInfinity())return st;if(st.isInfinity())return this;var ot=st.z.redSqr(),at=this.z.redSqr(),ut=this.x.redMul(ot),ht=st.x.redMul(at),yt=this.y.redMul(ot.redMul(st.z)),wt=st.y.redMul(at.redMul(this.z)),Ct=ut.redSub(ht),Pt=yt.redSub(wt);if(Ct.cmpn(0)===0)return Pt.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var $t=Ct.redSqr(),Mt=$t.redMul(Ct),Lt=ut.redMul($t),Dt=Pt.redSqr().redIAdd(Mt).redISub(Lt).redISub(Lt),zt=Pt.redMul(Lt.redISub(Dt)).redISub(yt.redMul(Mt)),Ot=this.z.redMul(st.z).redMul(Ct);return this.curve.jpoint(Dt,zt,Ot)},nt.prototype.mixedAdd=function(st){if(this.isInfinity())return st.toJ();if(st.isInfinity())return this;var ot=this.z.redSqr(),at=this.x,ut=st.x.redMul(ot),ht=this.y,yt=st.y.redMul(ot).redMul(this.z),wt=at.redSub(ut),Ct=ht.redSub(yt);if(wt.cmpn(0)===0)return Ct.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var Pt=wt.redSqr(),$t=Pt.redMul(wt),Mt=at.redMul(Pt),Lt=Ct.redSqr().redIAdd($t).redISub(Mt).redISub(Mt),Dt=Ct.redMul(Mt.redISub(Lt)).redISub(ht.redMul($t)),zt=this.z.redMul(wt);return this.curve.jpoint(Lt,Dt,zt)},nt.prototype.dblp=function(st){if(st===0)return this;if(this.isInfinity())return this;if(!st)return this.dbl();var ot;if(this.curve.zeroA||this.curve.threeA){var at=this;for(ot=0;ot=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$1;function requireMont$1(){if(hasRequiredMont$1)return mont$2;hasRequiredMont$1=1;var a=requireBn$1(),_=inherits_browserExports,$=requireBase$2(),j=requireUtils$1();function et(rt){$.call(this,"mont",rt),this.a=new a(rt.a,16).toRed(this.red),this.b=new a(rt.b,16).toRed(this.red),this.i4=new a(4).toRed(this.red).redInvm(),this.two=new a(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}_(et,$),mont$2=et,et.prototype.validate=function(nt){var it=nt.normalize().x,st=it.redSqr(),ot=st.redMul(it).redAdd(st.redMul(this.a)).redAdd(it),at=ot.redSqrt();return at.redSqr().cmp(ot)===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 a(nt,16),this.z=new a(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 _(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(),st=this.x.redSub(this.z),ot=st.redSqr(),at=it.redSub(ot),ut=it.redMul(ot),ht=at.redMul(ot.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 st=this.x.redAdd(this.z),ot=this.x.redSub(this.z),at=nt.x.redAdd(nt.z),ut=nt.x.redSub(nt.z),ht=ut.redMul(st),yt=at.redMul(ot),wt=it.z.redMul(ht.redAdd(yt).redSqr()),Ct=it.x.redMul(ht.redISub(yt).redSqr());return this.curve.point(wt,Ct)},tt.prototype.mul=function(nt){for(var it=nt.clone(),st=this,ot=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?(st=st.diffAdd(ot,at),ot=ot.dbl()):(ot=st.diffAdd(ot,at),st=st.dbl());return ot},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$1;function requireEdwards$1(){if(hasRequiredEdwards$1)return edwards$2;hasRequiredEdwards$1=1;var a=requireUtils$1(),_=requireBn$1(),$=inherits_browserExports,j=requireBase$2(),et=a.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 _(nt.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new _(nt.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new _(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,st,ot,at){return this.point(it,st,ot,at)},tt.prototype.pointFromX=function(it,st){it=new _(it,16),it.red||(it=it.toRed(this.red));var ot=it.redSqr(),at=this.c2.redSub(this.a.redMul(ot)),ut=this.one.redSub(this.c2.redMul(this.d).redMul(ot)),ht=at.redMul(ut.redInvm()),yt=ht.redSqrt();if(yt.redSqr().redSub(ht).cmp(this.zero)!==0)throw new Error("invalid point");var wt=yt.fromRed().isOdd();return(st&&!wt||!st&&wt)&&(yt=yt.redNeg()),this.point(it,yt)},tt.prototype.pointFromY=function(it,st){it=new _(it,16),it.red||(it=it.toRed(this.red));var ot=it.redSqr(),at=ot.redSub(this.c2),ut=ot.redMul(this.d).redMul(this.c2).redSub(this.a),ht=at.redMul(ut.redInvm());if(ht.cmp(this.zero)===0){if(st)throw new Error("invalid point");return this.point(this.zero,it)}var yt=ht.redSqrt();if(yt.redSqr().redSub(ht).cmp(this.zero)!==0)throw new Error("invalid point");return yt.fromRed().isOdd()!==st&&(yt=yt.redNeg()),this.point(yt,it)},tt.prototype.validate=function(it){if(it.isInfinity())return!0;it.normalize();var st=it.x.redSqr(),ot=it.y.redSqr(),at=st.redMul(this.a).redAdd(ot),ut=this.c2.redMul(this.one.redAdd(this.d.redMul(st).redMul(ot)));return at.cmp(ut)===0};function rt(nt,it,st,ot,at){j.BasePoint.call(this,nt,"projective"),it===null&&st===null&&ot===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 _(it,16),this.y=new _(st,16),this.z=ot?new _(ot,16):this.curve.one,this.t=at&&new _(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,st,ot,at){return new rt(this,it,st,ot,at)},rt.fromJSON=function(it,st){return new rt(it,st[0],st[1],st[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(),st=this.y.redSqr(),ot=this.z.redSqr();ot=ot.redIAdd(ot);var at=this.curve._mulA(it),ut=this.x.redAdd(this.y).redSqr().redISub(it).redISub(st),ht=at.redAdd(st),yt=ht.redSub(ot),wt=at.redSub(st),Ct=ut.redMul(yt),Pt=ht.redMul(wt),$t=ut.redMul(wt),Mt=yt.redMul(ht);return this.curve.point(Ct,Pt,Mt,$t)},rt.prototype._projDbl=function(){var it=this.x.redAdd(this.y).redSqr(),st=this.x.redSqr(),ot=this.y.redSqr(),at,ut,ht,yt,wt,Ct;if(this.curve.twisted){yt=this.curve._mulA(st);var Pt=yt.redAdd(ot);this.zOne?(at=it.redSub(st).redSub(ot).redMul(Pt.redSub(this.curve.two)),ut=Pt.redMul(yt.redSub(ot)),ht=Pt.redSqr().redSub(Pt).redSub(Pt)):(wt=this.z.redSqr(),Ct=Pt.redSub(wt).redISub(wt),at=it.redSub(st).redISub(ot).redMul(Ct),ut=Pt.redMul(yt.redSub(ot)),ht=Pt.redMul(Ct))}else yt=st.redAdd(ot),wt=this.curve._mulC(this.z).redSqr(),Ct=yt.redSub(wt).redSub(wt),at=this.curve._mulC(it.redISub(yt)).redMul(Ct),ut=this.curve._mulC(yt).redMul(st.redISub(ot)),ht=yt.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 st=this.y.redSub(this.x).redMul(it.y.redSub(it.x)),ot=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=ot.redSub(st),yt=ut.redSub(at),wt=ut.redAdd(at),Ct=ot.redAdd(st),Pt=ht.redMul(yt),$t=wt.redMul(Ct),Mt=ht.redMul(Ct),Lt=yt.redMul(wt);return this.curve.point(Pt,$t,Lt,Mt)},rt.prototype._projAdd=function(it){var st=this.z.redMul(it.z),ot=st.redSqr(),at=this.x.redMul(it.x),ut=this.y.redMul(it.y),ht=this.curve.d.redMul(at).redMul(ut),yt=ot.redSub(ht),wt=ot.redAdd(ht),Ct=this.x.redAdd(this.y).redMul(it.x.redAdd(it.y)).redISub(at).redISub(ut),Pt=st.redMul(yt).redMul(Ct),$t,Mt;return this.curve.twisted?($t=st.redMul(wt).redMul(ut.redSub(this.curve._mulA(at))),Mt=yt.redMul(wt)):($t=st.redMul(wt).redMul(ut.redSub(at)),Mt=this.curve._mulC(yt).redMul(wt)),this.curve.point(Pt,$t,Mt)},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,st,ot){return this.curve._wnafMulAdd(1,[this,st],[it,ot],2,!1)},rt.prototype.jmulAdd=function(it,st,ot){return this.curve._wnafMulAdd(1,[this,st],[it,ot],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 st=it.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(st)===0)return!0;for(var ot=it.clone(),at=this.curve.redN.redMul(this.z);;){if(ot.iadd(this.curve.n),ot.cmp(this.curve.p)>=0)return!1;if(st.redIAdd(at),this.x.cmp(st)===0)return!0}},rt.prototype.toP=rt.prototype.normalize,rt.prototype.mixedAdd=rt.prototype.add,edwards$2}var hasRequiredCurve$1;function requireCurve$1(){return hasRequiredCurve$1||(hasRequiredCurve$1=1,function(a){var _=a;_.base=requireBase$2(),_.short=requireShort$1(),_.mont=requireMont$1(),_.edwards=requireEdwards$1()}(curve$2)),curve$2}var curves$4={},hash$4={},utils$u={},assert$g=minimalisticAssert,inherits$5=inherits_browserExports;utils$u.inherits=inherits$5;function isSurrogatePair(a,_){return(a.charCodeAt(_)&64512)!==55296||_<0||_+1>=a.length?!1:(a.charCodeAt(_+1)&64512)===56320}function toArray$3(a,_){if(Array.isArray(a))return a.slice();if(!a)return[];var $=[];if(typeof a=="string")if(_){if(_==="hex")for(a=a.replace(/[^a-z0-9]+/ig,""),a.length%2!==0&&(a="0"+a),et=0;et>6|192,$[j++]=tt&63|128):isSurrogatePair(a,et)?(tt=65536+((tt&1023)<<10)+(a.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>>24|a>>>8&65280|a<<8&16711680|(a&255)<<24;return _>>>0}utils$u.htonl=htonl;function toHex32(a,_){for(var $="",j=0;j>>0}return tt}utils$u.join32=join32;function split32(a,_){for(var $=new Array(a.length*4),j=0,et=0;j>>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$u.split32=split32;function rotr32$1(a,_){return a>>>_|a<<32-_}utils$u.rotr32=rotr32$1;function rotl32$2(a,_){return a<<_|a>>>32-_}utils$u.rotl32=rotl32$2;function sum32$3(a,_){return a+_>>>0}utils$u.sum32=sum32$3;function sum32_3$1(a,_,$){return a+_+$>>>0}utils$u.sum32_3=sum32_3$1;function sum32_4$2(a,_,$,j){return a+_+$+j>>>0}utils$u.sum32_4=sum32_4$2;function sum32_5$2(a,_,$,j,et){return a+_+$+j+et>>>0}utils$u.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$u.sum64=sum64$1;function sum64_hi$1(a,_,$,j){var et=_+j>>>0,tt=(et<_?1:0)+a+$;return tt>>>0}utils$u.sum64_hi=sum64_hi$1;function sum64_lo$1(a,_,$,j){var et=_+j;return et>>>0}utils$u.sum64_lo=sum64_lo$1;function sum64_4_hi$1(a,_,$,j,et,tt,rt,nt){var it=0,st=_;st=st+j>>>0,it+=st<_?1:0,st=st+tt>>>0,it+=st>>0,it+=st>>0}utils$u.sum64_4_hi=sum64_4_hi$1;function sum64_4_lo$1(a,_,$,j,et,tt,rt,nt){var it=_+j+tt+nt;return it>>>0}utils$u.sum64_4_lo=sum64_4_lo$1;function sum64_5_hi$1(a,_,$,j,et,tt,rt,nt,it,st){var ot=0,at=_;at=at+j>>>0,ot+=at<_?1:0,at=at+tt>>>0,ot+=at>>0,ot+=at>>0,ot+=at>>0}utils$u.sum64_5_hi=sum64_5_hi$1;function sum64_5_lo$1(a,_,$,j,et,tt,rt,nt,it,st){var ot=_+j+tt+nt+st;return ot>>>0}utils$u.sum64_5_lo=sum64_5_lo$1;function rotr64_hi$1(a,_,$){var j=_<<32-$|a>>>$;return j>>>0}utils$u.rotr64_hi=rotr64_hi$1;function rotr64_lo$1(a,_,$){var j=a<<32-$|_>>>$;return j>>>0}utils$u.rotr64_lo=rotr64_lo$1;function shr64_hi$1(a,_,$){return a>>>$}utils$u.shr64_hi=shr64_hi$1;function shr64_lo$1(a,_,$){var j=a<<32-$|_>>>$;return j>>>0}utils$u.shr64_lo=shr64_lo$1;var common$6={},utils$t=utils$u,assert$f=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$6.BlockHash=BlockHash$4;BlockHash$4.prototype.update=function(_,$){if(_=utils$t.toArray(_,$),this.pending?this.pending=this.pending.concat(_):this.pending=_,this.pendingTotal+=_.length,this.pending.length>=this._delta8){_=this.pending;var j=_.length%this._delta8;this.pending=_.slice(_.length-j,_.length),this.pending.length===0&&(this.pending=null),_=utils$t.join32(_,0,_.length-j,this.endian);for(var et=0;et<_.length;et+=this._delta32)this._update(_,et,et+this._delta32)}return this};BlockHash$4.prototype.digest=function(_){return this.update(this._pad()),assert$f(this.pending===null),this._digest(_)};BlockHash$4.prototype._pad=function(){var _=this.pendingTotal,$=this._delta8,j=$-(_+this.padLength)%$,et=new Array(j+this.padLength);et[0]=128;for(var tt=1;tt>>24&255,et[tt++]=_>>>16&255,et[tt++]=_>>>8&255,et[tt++]=_&255}else for(et[tt++]=_&255,et[tt++]=_>>>8&255,et[tt++]=_>>>16&255,et[tt++]=_>>>24&255,et[tt++]=0,et[tt++]=0,et[tt++]=0,et[tt++]=0,rt=8;rt>>3}common$5.g0_256=g0_256$1;function g1_256$1(a){return rotr32(a,17)^rotr32(a,19)^a>>>10}common$5.g1_256=g1_256$1;var utils$r=utils$u,common$4=common$6,shaCommon$1=common$5,rotl32$1=utils$r.rotl32,sum32$2=utils$r.sum32,sum32_5$1=utils$r.sum32_5,ft_1=shaCommon$1.ft_1,BlockHash$3=common$4.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$r.inherits(SHA1,BlockHash$3);var _1=SHA1;SHA1.blockSize=512;SHA1.outSize=160;SHA1.hmacStrength=80;SHA1.padLength=64;SHA1.prototype._update=function(_,$){for(var j=this.W,et=0;et<16;et++)j[et]=_[$+et];for(;etthis.blockSize&&(_=new this.Hash().update(_).digest()),assert$c(_.length<=this.blockSize);for(var $=_.length;$=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(_,$,j)}var hmacDrbg=HmacDRBG$1;HmacDRBG$1.prototype._init=function(_,$,j){var et=_.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(_.concat(j||[])),this._reseed=1};HmacDRBG$1.prototype.generate=function(_,$,j,et){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof $!="string"&&(et=j,j=$,$=null),j&&(j=utils$k.toArray(j,et||"hex"),this._update(j));for(var tt=[];tt.length<_;)this.V=this._hmac().update(this.V).digest(),tt=tt.concat(this.V);var rt=tt.slice(0,_);return this._update(j),this._reseed++,utils$k.encode(rt,$)};var key$5,hasRequiredKey$3;function requireKey$3(){if(hasRequiredKey$3)return key$5;hasRequiredKey$3=1;var a=requireBn$1(),_=requireUtils$1(),$=_.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 a(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$3;function requireSignature$3(){if(hasRequiredSignature$3)return signature$5;hasRequiredSignature$3=1;var a=requireBn$1(),_=requireUtils$1(),$=_.assert;function j(it,st){if(it instanceof j)return it;this._importDER(it,st)||($(it.r&&it.s,"Signature without r or s"),this.r=new a(it.r,16),this.s=new a(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,st){var ot=it[st.place++];if(!(ot&128))return ot;var at=ot&15;if(at===0||at>4)return!1;for(var ut=0,ht=0,yt=st.place;ht>>=0;return ut<=127?!1:(st.place=yt,ut)}function rt(it){for(var st=0,ot=it.length-1;!it[st]&&!(it[st+1]&128)&&st>>3);for(it.push(ot|128);--ot;)it.push(st>>>(ot<<3)&255);it.push(st)}return j.prototype.toDER=function(st){var ot=this.r.toArray(),at=this.s.toArray();for(ot[0]&128&&(ot=[0].concat(ot)),at[0]&128&&(at=[0].concat(at)),ot=rt(ot),at=rt(at);!at[0]&&!(at[1]&128);)at=at.slice(1);var ut=[2];nt(ut,ot.length),ut=ut.concat(ot),ut.push(2),nt(ut,at.length);var ht=ut.concat(at),yt=[48];return nt(yt,ht.length),yt=yt.concat(ht),_.encode(yt,st)},signature$5}var ec$5,hasRequiredEc$1;function requireEc$1(){if(hasRequiredEc$1)return ec$5;hasRequiredEc$1=1;var a=requireBn$1(),_=hmacDrbg,$=requireUtils$1(),j=requireCurves$1(),et=requireBrorand(),tt=$.assert,rt=requireKey$3(),nt=requireSignature$3();function it(st){if(!(this instanceof it))return new it(st);typeof st=="string"&&(tt(Object.prototype.hasOwnProperty.call(j,st),"Unknown curve "+st),st=j[st]),st instanceof j.PresetCurve&&(st={curve:st}),this.curve=st.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=st.curve.g,this.g.precompute(st.curve.n.bitLength()+1),this.hash=st.hash||st.curve.hash}return ec$5=it,it.prototype.keyPair=function(ot){return new rt(this,ot)},it.prototype.keyFromPrivate=function(ot,at){return rt.fromPrivate(this,ot,at)},it.prototype.keyFromPublic=function(ot,at){return rt.fromPublic(this,ot,at)},it.prototype.genKeyPair=function(ot){ot||(ot={});for(var at=new _({hash:this.hash,pers:ot.pers,persEnc:ot.persEnc||"utf8",entropy:ot.entropy||et(this.hash.hmacStrength),entropyEnc:ot.entropy&&ot.entropyEnc||"utf8",nonce:this.n.toArray()}),ut=this.n.byteLength(),ht=this.n.sub(new a(2));;){var yt=new a(at.generate(ut));if(!(yt.cmp(ht)>0))return yt.iaddn(1),this.keyFromPrivate(yt)}},it.prototype._truncateToN=function(ot,at){var ut=ot.byteLength()*8-this.n.bitLength();return ut>0&&(ot=ot.ushrn(ut)),!at&&ot.cmp(this.n)>=0?ot.sub(this.n):ot},it.prototype.sign=function(ot,at,ut,ht){typeof ut=="object"&&(ht=ut,ut=null),ht||(ht={}),at=this.keyFromPrivate(at,ut),ot=this._truncateToN(new a(ot,16));for(var yt=this.n.byteLength(),wt=at.getPrivate().toArray("be",yt),Ct=ot.toArray("be",yt),Pt=new _({hash:this.hash,entropy:wt,nonce:Ct,pers:ht.pers,persEnc:ht.persEnc||"utf8"}),$t=this.n.sub(new a(1)),Mt=0;;Mt++){var Lt=ht.k?ht.k(Mt):new a(Pt.generate(this.n.byteLength()));if(Lt=this._truncateToN(Lt,!0),!(Lt.cmpn(1)<=0||Lt.cmp($t)>=0)){var Dt=this.g.mul(Lt);if(!Dt.isInfinity()){var zt=Dt.getX(),Ot=zt.umod(this.n);if(Ot.cmpn(0)!==0){var It=Lt.invm(this.n).mul(Ot.mul(at.getPrivate()).iadd(ot));if(It=It.umod(this.n),It.cmpn(0)!==0){var Bt=(Dt.getY().isOdd()?1:0)|(zt.cmp(Ot)!==0?2:0);return ht.canonical&&It.cmp(this.nh)>0&&(It=this.n.sub(It),Bt^=1),new nt({r:Ot,s:It,recoveryParam:Bt})}}}}}},it.prototype.verify=function(ot,at,ut,ht){ot=this._truncateToN(new a(ot,16)),ut=this.keyFromPublic(ut,ht),at=new nt(at,"hex");var yt=at.r,wt=at.s;if(yt.cmpn(1)<0||yt.cmp(this.n)>=0||wt.cmpn(1)<0||wt.cmp(this.n)>=0)return!1;var Ct=wt.invm(this.n),Pt=Ct.mul(ot).umod(this.n),$t=Ct.mul(yt).umod(this.n),Mt;return this.curve._maxwellTrick?(Mt=this.g.jmulAdd(Pt,ut.getPublic(),$t),Mt.isInfinity()?!1:Mt.eqXToP(yt)):(Mt=this.g.mulAdd(Pt,ut.getPublic(),$t),Mt.isInfinity()?!1:Mt.getX().umod(this.n).cmp(yt)===0)},it.prototype.recoverPubKey=function(st,ot,at,ut){tt((3&at)===at,"The recovery param is more than two bits"),ot=new nt(ot,ut);var ht=this.n,yt=new a(st),wt=ot.r,Ct=ot.s,Pt=at&1,$t=at>>1;if(wt.cmp(this.curve.p.umod(this.curve.n))>=0&&$t)throw new Error("Unable to find sencond key candinate");$t?wt=this.curve.pointFromX(wt.add(this.curve.n),Pt):wt=this.curve.pointFromX(wt,Pt);var Mt=ot.r.invm(ht),Lt=ht.sub(yt).mul(Mt).umod(ht),Dt=Ct.mul(Mt).umod(ht);return this.g.mulAdd(Lt,wt,Dt)},it.prototype.getKeyRecoveryParam=function(st,ot,at,ut){if(ot=new nt(ot,ut),ot.recoveryParam!==null)return ot.recoveryParam;for(var ht=0;ht<4;ht++){var yt;try{yt=this.recoverPubKey(st,ot,ht)}catch{continue}if(yt.eq(at))return ht}throw new Error("Unable to find valid recovery factor")},ec$5}var key$4,hasRequiredKey$2;function requireKey$2(){if(hasRequiredKey$2)return key$4;hasRequiredKey$2=1;var a=requireUtils$1(),_=a.assert,$=a.parseBytes,j=a.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,st=nt.slice(0,rt.encodingLength);return st[0]&=248,st[it]&=127,st[it]|=64,st}),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 _(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 _(this._secret,"KeyPair is public only"),a.encode(this.secret(),rt)},et.prototype.getPublic=function(rt){return a.encode(this.pubBytes(),rt)},key$4=et,key$4}var signature$4,hasRequiredSignature$2;function requireSignature$2(){if(hasRequiredSignature$2)return signature$4;hasRequiredSignature$2=1;var a=requireBn$1(),_=requireUtils$1(),$=_.assert,j=_.cachedProperty,et=_.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 a&&(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 _.encode(this.toBytes(),"hex").toUpperCase()},signature$4=tt,signature$4}var eddsa$2,hasRequiredEddsa$1;function requireEddsa$1(){if(hasRequiredEddsa$1)return eddsa$2;hasRequiredEddsa$1=1;var a=hash$4,_=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=_[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=a.sha512}return eddsa$2=nt,nt.prototype.sign=function(st,ot){st=et(st);var at=this.keyFromSecret(ot),ut=this.hashInt(at.messagePrefix(),st),ht=this.g.mul(ut),yt=this.encodePoint(ht),wt=this.hashInt(yt,at.pubBytes(),st).mul(at.priv()),Ct=ut.add(wt).umod(this.curve.n);return this.makeSignature({R:ht,S:Ct,Rencoded:yt})},nt.prototype.verify=function(st,ot,at){st=et(st),ot=this.makeSignature(ot);var ut=this.keyFromPublic(at),ht=this.hashInt(ot.Rencoded(),ut.pubBytes(),st),yt=this.g.mul(ot.S()),wt=ot.R().add(ut.pub().mul(ht));return wt.eq(yt)},nt.prototype.hashInt=function(){for(var st=this.hash(),ot=0;ot0?ct:dt},tt.min=function(ct,dt){return ct.cmp(dt)<0?ct:dt},tt.prototype._init=function(ct,dt,mt){if(typeof ct=="number")return this._initNumber(ct,dt,mt);if(typeof ct=="object")return this._initArray(ct,dt,mt);dt==="hex"&&(dt=16),j(dt===(dt|0)&&dt>=2&&dt<=36),ct=ct.toString().replace(/\s+/g,"");var xt=0;ct[0]==="-"&&(xt++,this.negative=1),xt=0;xt-=3)Rt=ct[xt]|ct[xt-1]<<8|ct[xt-2]<<16,this.words[At]|=Rt<>>26-St&67108863,St+=24,St>=26&&(St-=26,At++);else if(mt==="le")for(xt=0,At=0;xt>>26-St&67108863,St+=24,St>=26&&(St-=26,At++);return this._strip()};function nt(vt,ct){var dt=vt.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 "+vt)}function it(vt,ct,dt){var mt=nt(vt,dt);return dt-1>=ct&&(mt|=nt(vt,dt-1)<<4),mt}tt.prototype._parseHex=function(ct,dt,mt){this.length=Math.ceil((ct.length-dt)/6),this.words=new Array(this.length);for(var xt=0;xt=dt;xt-=2)St=it(ct,dt,xt)<=18?(At-=18,Rt+=1,this.words[Rt]|=St>>>26):At+=8;else{var Tt=ct.length-dt;for(xt=Tt%2===0?dt+1:dt;xt=18?(At-=18,Rt+=1,this.words[Rt]|=St>>>26):At+=8}this._strip()};function st(vt,ct,dt,mt){for(var xt=0,At=0,Rt=Math.min(vt.length,dt),St=ct;St=49?At=Tt-49+10:Tt>=17?At=Tt-17+10:At=Tt,j(Tt>=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},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],yt=[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 mt;if(ct===16||ct==="hex"){mt="";for(var xt=0,At=0,Rt=0;Rt>>24-xt&16777215,xt+=2,xt>=26&&(xt-=26,Rt--),At!==0||Rt!==this.length-1?mt=ut[6-Tt.length]+Tt+mt:mt=Tt+mt}for(At!==0&&(mt=At.toString(16)+mt);mt.length%dt!==0;)mt="0"+mt;return this.negative!==0&&(mt="-"+mt),mt}if(ct===(ct|0)&&ct>=2&&ct<=36){var Et=ht[ct],Nt=yt[ct];mt="";var tr=this.clone();for(tr.negative=0;!tr.isZero();){var ir=tr.modrn(Nt).toString(ct);tr=tr.idivn(Nt),tr.isZero()?mt=ir+mt:mt=ut[Et-ir.length]+ir+mt}for(this.isZero()&&(mt="0"+mt);mt.length%dt!==0;)mt="0"+mt;return this.negative!==0&&(mt="-"+mt),mt}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 wt=function(ct,dt){return ct.allocUnsafe?ct.allocUnsafe(dt):new ct(dt)};tt.prototype.toArrayLike=function(ct,dt,mt){this._strip();var xt=this.byteLength(),At=mt||Math.max(1,xt);j(xt<=At,"byte array longer than desired length"),j(At>0,"Requested array length <= 0");var Rt=wt(ct,At),St=dt==="le"?"LE":"BE";return this["_toArrayLike"+St](Rt,xt),Rt},tt.prototype._toArrayLikeLE=function(ct,dt){for(var mt=0,xt=0,At=0,Rt=0;At>8&255),mt>16&255),Rt===6?(mt>24&255),xt=0,Rt=0):(xt=St>>>24,Rt+=2)}if(mt=0&&(ct[mt--]=St>>8&255),mt>=0&&(ct[mt--]=St>>16&255),Rt===6?(mt>=0&&(ct[mt--]=St>>24&255),xt=0,Rt=0):(xt=St>>>24,Rt+=2)}if(mt>=0)for(ct[mt--]=xt;mt>=0;)ct[mt--]=0},Math.clz32?tt.prototype._countBits=function(ct){return 32-Math.clz32(ct)}:tt.prototype._countBits=function(ct){var dt=ct,mt=0;return dt>=4096&&(mt+=13,dt>>>=13),dt>=64&&(mt+=7,dt>>>=7),dt>=8&&(mt+=4,dt>>>=4),dt>=2&&(mt+=2,dt>>>=2),mt+dt},tt.prototype._zeroBits=function(ct){if(ct===0)return 26;var dt=ct,mt=0;return dt&8191||(mt+=13,dt>>>=13),dt&127||(mt+=7,dt>>>=7),dt&15||(mt+=4,dt>>>=4),dt&3||(mt+=2,dt>>>=2),dt&1||mt++,mt},tt.prototype.bitLength=function(){var ct=this.words[this.length-1],dt=this._countBits(ct);return(this.length-1)*26+dt};function Ct(vt){for(var ct=new Array(vt.bitLength()),dt=0;dt>>xt&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 mt=0;mtct.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,mt;this.length>ct.length?(dt=this,mt=ct):(dt=ct,mt=this);for(var xt=0;xtct.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,mt=ct%26;this._expand(dt),mt>0&&dt--;for(var xt=0;xt0&&(this.words[xt]=~this.words[xt]&67108863>>26-mt),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 mt=ct/26|0,xt=ct%26;return this._expand(mt+1),dt?this.words[mt]=this.words[mt]|1<ct.length?(mt=this,xt=ct):(mt=ct,xt=this);for(var At=0,Rt=0;Rt>>26;for(;At!==0&&Rt>>26;if(this.length=mt.length,At!==0)this.words[this.length]=At,this.length++;else if(mt!==this)for(;Rtct.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 mt=this.cmp(ct);if(mt===0)return this.negative=0,this.length=1,this.words[0]=0,this;var xt,At;mt>0?(xt=this,At=ct):(xt=ct,At=this);for(var Rt=0,St=0;St>26,this.words[St]=dt&67108863;for(;Rt!==0&&St>26,this.words[St]=dt&67108863;if(Rt===0&&St>>26,tr=Tt&67108863,ir=Math.min(Et,ct.length-1),nr=Math.max(0,Et-vt.length+1);nr<=ir;nr++){var Zt=Et-nr|0;xt=vt.words[Zt]|0,At=ct.words[nr]|0,Rt=xt*At+tr,Nt+=Rt/67108864|0,tr=Rt&67108863}dt.words[Et]=tr|0,Tt=Nt|0}return Tt!==0?dt.words[Et]=Tt|0:dt.length--,dt._strip()}var $t=function(ct,dt,mt){var xt=ct.words,At=dt.words,Rt=mt.words,St=0,Tt,Et,Nt,tr=xt[0]|0,ir=tr&8191,nr=tr>>>13,Zt=xt[1]|0,Kt=Zt&8191,Qt=Zt>>>13,Ht=xt[2]|0,qt=Ht&8191,Jt=Ht>>>13,ur=xt[3]|0,xr=ur&8191,pr=ur>>>13,Cr=xt[4]|0,Mr=Cr&8191,lr=Cr>>>13,fr=xt[5]|0,_r=fr&8191,Sr=fr>>>13,kr=xt[6]|0,Ar=kr&8191,$r=kr>>>13,Or=xt[7]|0,Lr=Or&8191,or=Or>>>13,Yt=xt[8]|0,er=Yt&8191,Gt=Yt>>>13,Vt=xt[9]|0,Wt=Vt&8191,ar=Vt>>>13,yr=At[0]|0,Er=yr&8191,Rr=yr>>>13,Wr=At[1]|0,Hr=Wr&8191,Fr=Wr>>>13,pn=At[2]|0,Jr=pn&8191,Qr=pn>>>13,mn=At[3]|0,ln=mn&8191,qr=mn>>>13,En=At[4]|0,un=En&8191,Vr=En>>>13,hn=At[5]|0,fn=hn&8191,Kr=hn>>>13,Rn=At[6]|0,dn=Rn&8191,Gr=Rn>>>13,gn=At[7]|0,an=gn&8191,Zr=gn>>>13,An=At[8]|0,Sn=An&8191,nn=An>>>13,Pn=At[9]|0,yn=Pn&8191,_n=Pn>>>13;mt.negative=ct.negative^dt.negative,mt.length=19,Tt=Math.imul(ir,Er),Et=Math.imul(ir,Rr),Et=Et+Math.imul(nr,Er)|0,Nt=Math.imul(nr,Rr);var ds=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(ds>>>26)|0,ds&=67108863,Tt=Math.imul(Kt,Er),Et=Math.imul(Kt,Rr),Et=Et+Math.imul(Qt,Er)|0,Nt=Math.imul(Qt,Rr),Tt=Tt+Math.imul(ir,Hr)|0,Et=Et+Math.imul(ir,Fr)|0,Et=Et+Math.imul(nr,Hr)|0,Nt=Nt+Math.imul(nr,Fr)|0;var fs=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(fs>>>26)|0,fs&=67108863,Tt=Math.imul(qt,Er),Et=Math.imul(qt,Rr),Et=Et+Math.imul(Jt,Er)|0,Nt=Math.imul(Jt,Rr),Tt=Tt+Math.imul(Kt,Hr)|0,Et=Et+Math.imul(Kt,Fr)|0,Et=Et+Math.imul(Qt,Hr)|0,Nt=Nt+Math.imul(Qt,Fr)|0,Tt=Tt+Math.imul(ir,Jr)|0,Et=Et+Math.imul(ir,Qr)|0,Et=Et+Math.imul(nr,Jr)|0,Nt=Nt+Math.imul(nr,Qr)|0;var hs=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(hs>>>26)|0,hs&=67108863,Tt=Math.imul(xr,Er),Et=Math.imul(xr,Rr),Et=Et+Math.imul(pr,Er)|0,Nt=Math.imul(pr,Rr),Tt=Tt+Math.imul(qt,Hr)|0,Et=Et+Math.imul(qt,Fr)|0,Et=Et+Math.imul(Jt,Hr)|0,Nt=Nt+Math.imul(Jt,Fr)|0,Tt=Tt+Math.imul(Kt,Jr)|0,Et=Et+Math.imul(Kt,Qr)|0,Et=Et+Math.imul(Qt,Jr)|0,Nt=Nt+Math.imul(Qt,Qr)|0,Tt=Tt+Math.imul(ir,ln)|0,Et=Et+Math.imul(ir,qr)|0,Et=Et+Math.imul(nr,ln)|0,Nt=Nt+Math.imul(nr,qr)|0;var ps=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(ps>>>26)|0,ps&=67108863,Tt=Math.imul(Mr,Er),Et=Math.imul(Mr,Rr),Et=Et+Math.imul(lr,Er)|0,Nt=Math.imul(lr,Rr),Tt=Tt+Math.imul(xr,Hr)|0,Et=Et+Math.imul(xr,Fr)|0,Et=Et+Math.imul(pr,Hr)|0,Nt=Nt+Math.imul(pr,Fr)|0,Tt=Tt+Math.imul(qt,Jr)|0,Et=Et+Math.imul(qt,Qr)|0,Et=Et+Math.imul(Jt,Jr)|0,Nt=Nt+Math.imul(Jt,Qr)|0,Tt=Tt+Math.imul(Kt,ln)|0,Et=Et+Math.imul(Kt,qr)|0,Et=Et+Math.imul(Qt,ln)|0,Nt=Nt+Math.imul(Qt,qr)|0,Tt=Tt+Math.imul(ir,un)|0,Et=Et+Math.imul(ir,Vr)|0,Et=Et+Math.imul(nr,un)|0,Nt=Nt+Math.imul(nr,Vr)|0;var Vn=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(Vn>>>26)|0,Vn&=67108863,Tt=Math.imul(_r,Er),Et=Math.imul(_r,Rr),Et=Et+Math.imul(Sr,Er)|0,Nt=Math.imul(Sr,Rr),Tt=Tt+Math.imul(Mr,Hr)|0,Et=Et+Math.imul(Mr,Fr)|0,Et=Et+Math.imul(lr,Hr)|0,Nt=Nt+Math.imul(lr,Fr)|0,Tt=Tt+Math.imul(xr,Jr)|0,Et=Et+Math.imul(xr,Qr)|0,Et=Et+Math.imul(pr,Jr)|0,Nt=Nt+Math.imul(pr,Qr)|0,Tt=Tt+Math.imul(qt,ln)|0,Et=Et+Math.imul(qt,qr)|0,Et=Et+Math.imul(Jt,ln)|0,Nt=Nt+Math.imul(Jt,qr)|0,Tt=Tt+Math.imul(Kt,un)|0,Et=Et+Math.imul(Kt,Vr)|0,Et=Et+Math.imul(Qt,un)|0,Nt=Nt+Math.imul(Qt,Vr)|0,Tt=Tt+Math.imul(ir,fn)|0,Et=Et+Math.imul(ir,Kr)|0,Et=Et+Math.imul(nr,fn)|0,Nt=Nt+Math.imul(nr,Kr)|0;var ss=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(ss>>>26)|0,ss&=67108863,Tt=Math.imul(Ar,Er),Et=Math.imul(Ar,Rr),Et=Et+Math.imul($r,Er)|0,Nt=Math.imul($r,Rr),Tt=Tt+Math.imul(_r,Hr)|0,Et=Et+Math.imul(_r,Fr)|0,Et=Et+Math.imul(Sr,Hr)|0,Nt=Nt+Math.imul(Sr,Fr)|0,Tt=Tt+Math.imul(Mr,Jr)|0,Et=Et+Math.imul(Mr,Qr)|0,Et=Et+Math.imul(lr,Jr)|0,Nt=Nt+Math.imul(lr,Qr)|0,Tt=Tt+Math.imul(xr,ln)|0,Et=Et+Math.imul(xr,qr)|0,Et=Et+Math.imul(pr,ln)|0,Nt=Nt+Math.imul(pr,qr)|0,Tt=Tt+Math.imul(qt,un)|0,Et=Et+Math.imul(qt,Vr)|0,Et=Et+Math.imul(Jt,un)|0,Nt=Nt+Math.imul(Jt,Vr)|0,Tt=Tt+Math.imul(Kt,fn)|0,Et=Et+Math.imul(Kt,Kr)|0,Et=Et+Math.imul(Qt,fn)|0,Nt=Nt+Math.imul(Qt,Kr)|0,Tt=Tt+Math.imul(ir,dn)|0,Et=Et+Math.imul(ir,Gr)|0,Et=Et+Math.imul(nr,dn)|0,Nt=Nt+Math.imul(nr,Gr)|0;var Jn=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(Jn>>>26)|0,Jn&=67108863,Tt=Math.imul(Lr,Er),Et=Math.imul(Lr,Rr),Et=Et+Math.imul(or,Er)|0,Nt=Math.imul(or,Rr),Tt=Tt+Math.imul(Ar,Hr)|0,Et=Et+Math.imul(Ar,Fr)|0,Et=Et+Math.imul($r,Hr)|0,Nt=Nt+Math.imul($r,Fr)|0,Tt=Tt+Math.imul(_r,Jr)|0,Et=Et+Math.imul(_r,Qr)|0,Et=Et+Math.imul(Sr,Jr)|0,Nt=Nt+Math.imul(Sr,Qr)|0,Tt=Tt+Math.imul(Mr,ln)|0,Et=Et+Math.imul(Mr,qr)|0,Et=Et+Math.imul(lr,ln)|0,Nt=Nt+Math.imul(lr,qr)|0,Tt=Tt+Math.imul(xr,un)|0,Et=Et+Math.imul(xr,Vr)|0,Et=Et+Math.imul(pr,un)|0,Nt=Nt+Math.imul(pr,Vr)|0,Tt=Tt+Math.imul(qt,fn)|0,Et=Et+Math.imul(qt,Kr)|0,Et=Et+Math.imul(Jt,fn)|0,Nt=Nt+Math.imul(Jt,Kr)|0,Tt=Tt+Math.imul(Kt,dn)|0,Et=Et+Math.imul(Kt,Gr)|0,Et=Et+Math.imul(Qt,dn)|0,Nt=Nt+Math.imul(Qt,Gr)|0,Tt=Tt+Math.imul(ir,an)|0,Et=Et+Math.imul(ir,Zr)|0,Et=Et+Math.imul(nr,an)|0,Nt=Nt+Math.imul(nr,Zr)|0;var Yn=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(Yn>>>26)|0,Yn&=67108863,Tt=Math.imul(er,Er),Et=Math.imul(er,Rr),Et=Et+Math.imul(Gt,Er)|0,Nt=Math.imul(Gt,Rr),Tt=Tt+Math.imul(Lr,Hr)|0,Et=Et+Math.imul(Lr,Fr)|0,Et=Et+Math.imul(or,Hr)|0,Nt=Nt+Math.imul(or,Fr)|0,Tt=Tt+Math.imul(Ar,Jr)|0,Et=Et+Math.imul(Ar,Qr)|0,Et=Et+Math.imul($r,Jr)|0,Nt=Nt+Math.imul($r,Qr)|0,Tt=Tt+Math.imul(_r,ln)|0,Et=Et+Math.imul(_r,qr)|0,Et=Et+Math.imul(Sr,ln)|0,Nt=Nt+Math.imul(Sr,qr)|0,Tt=Tt+Math.imul(Mr,un)|0,Et=Et+Math.imul(Mr,Vr)|0,Et=Et+Math.imul(lr,un)|0,Nt=Nt+Math.imul(lr,Vr)|0,Tt=Tt+Math.imul(xr,fn)|0,Et=Et+Math.imul(xr,Kr)|0,Et=Et+Math.imul(pr,fn)|0,Nt=Nt+Math.imul(pr,Kr)|0,Tt=Tt+Math.imul(qt,dn)|0,Et=Et+Math.imul(qt,Gr)|0,Et=Et+Math.imul(Jt,dn)|0,Nt=Nt+Math.imul(Jt,Gr)|0,Tt=Tt+Math.imul(Kt,an)|0,Et=Et+Math.imul(Kt,Zr)|0,Et=Et+Math.imul(Qt,an)|0,Nt=Nt+Math.imul(Qt,Zr)|0,Tt=Tt+Math.imul(ir,Sn)|0,Et=Et+Math.imul(ir,nn)|0,Et=Et+Math.imul(nr,Sn)|0,Nt=Nt+Math.imul(nr,nn)|0;var ms=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(ms>>>26)|0,ms&=67108863,Tt=Math.imul(Wt,Er),Et=Math.imul(Wt,Rr),Et=Et+Math.imul(ar,Er)|0,Nt=Math.imul(ar,Rr),Tt=Tt+Math.imul(er,Hr)|0,Et=Et+Math.imul(er,Fr)|0,Et=Et+Math.imul(Gt,Hr)|0,Nt=Nt+Math.imul(Gt,Fr)|0,Tt=Tt+Math.imul(Lr,Jr)|0,Et=Et+Math.imul(Lr,Qr)|0,Et=Et+Math.imul(or,Jr)|0,Nt=Nt+Math.imul(or,Qr)|0,Tt=Tt+Math.imul(Ar,ln)|0,Et=Et+Math.imul(Ar,qr)|0,Et=Et+Math.imul($r,ln)|0,Nt=Nt+Math.imul($r,qr)|0,Tt=Tt+Math.imul(_r,un)|0,Et=Et+Math.imul(_r,Vr)|0,Et=Et+Math.imul(Sr,un)|0,Nt=Nt+Math.imul(Sr,Vr)|0,Tt=Tt+Math.imul(Mr,fn)|0,Et=Et+Math.imul(Mr,Kr)|0,Et=Et+Math.imul(lr,fn)|0,Nt=Nt+Math.imul(lr,Kr)|0,Tt=Tt+Math.imul(xr,dn)|0,Et=Et+Math.imul(xr,Gr)|0,Et=Et+Math.imul(pr,dn)|0,Nt=Nt+Math.imul(pr,Gr)|0,Tt=Tt+Math.imul(qt,an)|0,Et=Et+Math.imul(qt,Zr)|0,Et=Et+Math.imul(Jt,an)|0,Nt=Nt+Math.imul(Jt,Zr)|0,Tt=Tt+Math.imul(Kt,Sn)|0,Et=Et+Math.imul(Kt,nn)|0,Et=Et+Math.imul(Qt,Sn)|0,Nt=Nt+Math.imul(Qt,nn)|0,Tt=Tt+Math.imul(ir,yn)|0,Et=Et+Math.imul(ir,_n)|0,Et=Et+Math.imul(nr,yn)|0,Nt=Nt+Math.imul(nr,_n)|0;var Qn=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(Qn>>>26)|0,Qn&=67108863,Tt=Math.imul(Wt,Hr),Et=Math.imul(Wt,Fr),Et=Et+Math.imul(ar,Hr)|0,Nt=Math.imul(ar,Fr),Tt=Tt+Math.imul(er,Jr)|0,Et=Et+Math.imul(er,Qr)|0,Et=Et+Math.imul(Gt,Jr)|0,Nt=Nt+Math.imul(Gt,Qr)|0,Tt=Tt+Math.imul(Lr,ln)|0,Et=Et+Math.imul(Lr,qr)|0,Et=Et+Math.imul(or,ln)|0,Nt=Nt+Math.imul(or,qr)|0,Tt=Tt+Math.imul(Ar,un)|0,Et=Et+Math.imul(Ar,Vr)|0,Et=Et+Math.imul($r,un)|0,Nt=Nt+Math.imul($r,Vr)|0,Tt=Tt+Math.imul(_r,fn)|0,Et=Et+Math.imul(_r,Kr)|0,Et=Et+Math.imul(Sr,fn)|0,Nt=Nt+Math.imul(Sr,Kr)|0,Tt=Tt+Math.imul(Mr,dn)|0,Et=Et+Math.imul(Mr,Gr)|0,Et=Et+Math.imul(lr,dn)|0,Nt=Nt+Math.imul(lr,Gr)|0,Tt=Tt+Math.imul(xr,an)|0,Et=Et+Math.imul(xr,Zr)|0,Et=Et+Math.imul(pr,an)|0,Nt=Nt+Math.imul(pr,Zr)|0,Tt=Tt+Math.imul(qt,Sn)|0,Et=Et+Math.imul(qt,nn)|0,Et=Et+Math.imul(Jt,Sn)|0,Nt=Nt+Math.imul(Jt,nn)|0,Tt=Tt+Math.imul(Kt,yn)|0,Et=Et+Math.imul(Kt,_n)|0,Et=Et+Math.imul(Qt,yn)|0,Nt=Nt+Math.imul(Qt,_n)|0;var es=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(es>>>26)|0,es&=67108863,Tt=Math.imul(Wt,Jr),Et=Math.imul(Wt,Qr),Et=Et+Math.imul(ar,Jr)|0,Nt=Math.imul(ar,Qr),Tt=Tt+Math.imul(er,ln)|0,Et=Et+Math.imul(er,qr)|0,Et=Et+Math.imul(Gt,ln)|0,Nt=Nt+Math.imul(Gt,qr)|0,Tt=Tt+Math.imul(Lr,un)|0,Et=Et+Math.imul(Lr,Vr)|0,Et=Et+Math.imul(or,un)|0,Nt=Nt+Math.imul(or,Vr)|0,Tt=Tt+Math.imul(Ar,fn)|0,Et=Et+Math.imul(Ar,Kr)|0,Et=Et+Math.imul($r,fn)|0,Nt=Nt+Math.imul($r,Kr)|0,Tt=Tt+Math.imul(_r,dn)|0,Et=Et+Math.imul(_r,Gr)|0,Et=Et+Math.imul(Sr,dn)|0,Nt=Nt+Math.imul(Sr,Gr)|0,Tt=Tt+Math.imul(Mr,an)|0,Et=Et+Math.imul(Mr,Zr)|0,Et=Et+Math.imul(lr,an)|0,Nt=Nt+Math.imul(lr,Zr)|0,Tt=Tt+Math.imul(xr,Sn)|0,Et=Et+Math.imul(xr,nn)|0,Et=Et+Math.imul(pr,Sn)|0,Nt=Nt+Math.imul(pr,nn)|0,Tt=Tt+Math.imul(qt,yn)|0,Et=Et+Math.imul(qt,_n)|0,Et=Et+Math.imul(Jt,yn)|0,Nt=Nt+Math.imul(Jt,_n)|0;var ls=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(ls>>>26)|0,ls&=67108863,Tt=Math.imul(Wt,ln),Et=Math.imul(Wt,qr),Et=Et+Math.imul(ar,ln)|0,Nt=Math.imul(ar,qr),Tt=Tt+Math.imul(er,un)|0,Et=Et+Math.imul(er,Vr)|0,Et=Et+Math.imul(Gt,un)|0,Nt=Nt+Math.imul(Gt,Vr)|0,Tt=Tt+Math.imul(Lr,fn)|0,Et=Et+Math.imul(Lr,Kr)|0,Et=Et+Math.imul(or,fn)|0,Nt=Nt+Math.imul(or,Kr)|0,Tt=Tt+Math.imul(Ar,dn)|0,Et=Et+Math.imul(Ar,Gr)|0,Et=Et+Math.imul($r,dn)|0,Nt=Nt+Math.imul($r,Gr)|0,Tt=Tt+Math.imul(_r,an)|0,Et=Et+Math.imul(_r,Zr)|0,Et=Et+Math.imul(Sr,an)|0,Nt=Nt+Math.imul(Sr,Zr)|0,Tt=Tt+Math.imul(Mr,Sn)|0,Et=Et+Math.imul(Mr,nn)|0,Et=Et+Math.imul(lr,Sn)|0,Nt=Nt+Math.imul(lr,nn)|0,Tt=Tt+Math.imul(xr,yn)|0,Et=Et+Math.imul(xr,_n)|0,Et=Et+Math.imul(pr,yn)|0,Nt=Nt+Math.imul(pr,_n)|0;var us=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(us>>>26)|0,us&=67108863,Tt=Math.imul(Wt,un),Et=Math.imul(Wt,Vr),Et=Et+Math.imul(ar,un)|0,Nt=Math.imul(ar,Vr),Tt=Tt+Math.imul(er,fn)|0,Et=Et+Math.imul(er,Kr)|0,Et=Et+Math.imul(Gt,fn)|0,Nt=Nt+Math.imul(Gt,Kr)|0,Tt=Tt+Math.imul(Lr,dn)|0,Et=Et+Math.imul(Lr,Gr)|0,Et=Et+Math.imul(or,dn)|0,Nt=Nt+Math.imul(or,Gr)|0,Tt=Tt+Math.imul(Ar,an)|0,Et=Et+Math.imul(Ar,Zr)|0,Et=Et+Math.imul($r,an)|0,Nt=Nt+Math.imul($r,Zr)|0,Tt=Tt+Math.imul(_r,Sn)|0,Et=Et+Math.imul(_r,nn)|0,Et=Et+Math.imul(Sr,Sn)|0,Nt=Nt+Math.imul(Sr,nn)|0,Tt=Tt+Math.imul(Mr,yn)|0,Et=Et+Math.imul(Mr,_n)|0,Et=Et+Math.imul(lr,yn)|0,Nt=Nt+Math.imul(lr,_n)|0;var Wn=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(Wn>>>26)|0,Wn&=67108863,Tt=Math.imul(Wt,fn),Et=Math.imul(Wt,Kr),Et=Et+Math.imul(ar,fn)|0,Nt=Math.imul(ar,Kr),Tt=Tt+Math.imul(er,dn)|0,Et=Et+Math.imul(er,Gr)|0,Et=Et+Math.imul(Gt,dn)|0,Nt=Nt+Math.imul(Gt,Gr)|0,Tt=Tt+Math.imul(Lr,an)|0,Et=Et+Math.imul(Lr,Zr)|0,Et=Et+Math.imul(or,an)|0,Nt=Nt+Math.imul(or,Zr)|0,Tt=Tt+Math.imul(Ar,Sn)|0,Et=Et+Math.imul(Ar,nn)|0,Et=Et+Math.imul($r,Sn)|0,Nt=Nt+Math.imul($r,nn)|0,Tt=Tt+Math.imul(_r,yn)|0,Et=Et+Math.imul(_r,_n)|0,Et=Et+Math.imul(Sr,yn)|0,Nt=Nt+Math.imul(Sr,_n)|0;var as=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(as>>>26)|0,as&=67108863,Tt=Math.imul(Wt,dn),Et=Math.imul(Wt,Gr),Et=Et+Math.imul(ar,dn)|0,Nt=Math.imul(ar,Gr),Tt=Tt+Math.imul(er,an)|0,Et=Et+Math.imul(er,Zr)|0,Et=Et+Math.imul(Gt,an)|0,Nt=Nt+Math.imul(Gt,Zr)|0,Tt=Tt+Math.imul(Lr,Sn)|0,Et=Et+Math.imul(Lr,nn)|0,Et=Et+Math.imul(or,Sn)|0,Nt=Nt+Math.imul(or,nn)|0,Tt=Tt+Math.imul(Ar,yn)|0,Et=Et+Math.imul(Ar,_n)|0,Et=Et+Math.imul($r,yn)|0,Nt=Nt+Math.imul($r,_n)|0;var gs=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(gs>>>26)|0,gs&=67108863,Tt=Math.imul(Wt,an),Et=Math.imul(Wt,Zr),Et=Et+Math.imul(ar,an)|0,Nt=Math.imul(ar,Zr),Tt=Tt+Math.imul(er,Sn)|0,Et=Et+Math.imul(er,nn)|0,Et=Et+Math.imul(Gt,Sn)|0,Nt=Nt+Math.imul(Gt,nn)|0,Tt=Tt+Math.imul(Lr,yn)|0,Et=Et+Math.imul(Lr,_n)|0,Et=Et+Math.imul(or,yn)|0,Nt=Nt+Math.imul(or,_n)|0;var vs=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(vs>>>26)|0,vs&=67108863,Tt=Math.imul(Wt,Sn),Et=Math.imul(Wt,nn),Et=Et+Math.imul(ar,Sn)|0,Nt=Math.imul(ar,nn),Tt=Tt+Math.imul(er,yn)|0,Et=Et+Math.imul(er,_n)|0,Et=Et+Math.imul(Gt,yn)|0,Nt=Nt+Math.imul(Gt,_n)|0;var Ts=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(Ts>>>26)|0,Ts&=67108863,Tt=Math.imul(Wt,yn),Et=Math.imul(Wt,_n),Et=Et+Math.imul(ar,yn)|0,Nt=Math.imul(ar,_n);var $s=(St+Tt|0)+((Et&8191)<<13)|0;return St=(Nt+(Et>>>13)|0)+($s>>>26)|0,$s&=67108863,Rt[0]=ds,Rt[1]=fs,Rt[2]=hs,Rt[3]=ps,Rt[4]=Vn,Rt[5]=ss,Rt[6]=Jn,Rt[7]=Yn,Rt[8]=ms,Rt[9]=Qn,Rt[10]=es,Rt[11]=ls,Rt[12]=us,Rt[13]=Wn,Rt[14]=as,Rt[15]=gs,Rt[16]=vs,Rt[17]=Ts,Rt[18]=$s,St!==0&&(Rt[19]=St,mt.length++),mt};Math.imul||($t=Pt);function Mt(vt,ct,dt){dt.negative=ct.negative^vt.negative,dt.length=vt.length+ct.length;for(var mt=0,xt=0,At=0;At>>26)|0,xt+=Rt>>>26,Rt&=67108863}dt.words[At]=St,mt=Rt,Rt=xt}return mt!==0?dt.words[At]=mt:dt.length--,dt._strip()}function Lt(vt,ct,dt){return Mt(vt,ct,dt)}tt.prototype.mulTo=function(ct,dt){var mt,xt=this.length+ct.length;return this.length===10&&ct.length===10?mt=$t(this,ct,dt):xt<63?mt=Pt(this,ct,dt):xt<1024?mt=Mt(this,ct,dt):mt=Lt(this,ct,dt),mt},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 mt=0,xt=0;xt>=26,mt+=At/67108864|0,mt+=Rt>>>26,this.words[xt]=Rt&67108863}return mt!==0&&(this.words[xt]=mt,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 mt=this,xt=0;xt=0);var dt=ct%26,mt=(ct-dt)/26,xt=67108863>>>26-dt<<26-dt,At;if(dt!==0){var Rt=0;for(At=0;At>>26-dt}Rt&&(this.words[At]=Rt,this.length++)}if(mt!==0){for(At=this.length-1;At>=0;At--)this.words[At+mt]=this.words[At];for(At=0;At=0);var xt;dt?xt=(dt-dt%26)/26:xt=0;var At=ct%26,Rt=Math.min((ct-At)/26,this.length),St=67108863^67108863>>>At<Rt)for(this.length-=Rt,Et=0;Et=0&&(Nt!==0||Et>=xt);Et--){var tr=this.words[Et]|0;this.words[Et]=Nt<<26-At|tr>>>At,Nt=tr&St}return Tt&&Nt!==0&&(Tt.words[Tt.length++]=Nt),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},tt.prototype.ishrn=function(ct,dt,mt){return j(this.negative===0),this.iushrn(ct,dt,mt)},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,mt=(ct-dt)/26,xt=1<=0);var dt=ct%26,mt=(ct-dt)/26;if(j(this.negative===0,"imaskn works only with positive numbers"),this.length<=mt)return this;if(dt!==0&&mt++,this.length=Math.min(mt,this.length),dt!==0){var xt=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)-(Tt/67108864|0),this.words[At+mt]=Rt&67108863}for(;At>26,this.words[At+mt]=Rt&67108863;if(St===0)return this._strip();for(j(St===-1),St=0,At=0;At>26,this.words[At]=Rt&67108863;return this.negative=1,this._strip()},tt.prototype._wordDiv=function(ct,dt){var mt=this.length-ct.length,xt=this.clone(),At=ct,Rt=At.words[At.length-1]|0,St=this._countBits(Rt);mt=26-St,mt!==0&&(At=At.ushln(mt),xt.iushln(mt),Rt=At.words[At.length-1]|0);var Tt=xt.length-At.length,Et;if(dt!=="mod"){Et=new tt(null),Et.length=Tt+1,Et.words=new Array(Et.length);for(var Nt=0;Nt=0;ir--){var nr=(xt.words[At.length+ir]|0)*67108864+(xt.words[At.length+ir-1]|0);for(nr=Math.min(nr/Rt|0,67108863),xt._ishlnsubmul(At,nr,ir);xt.negative!==0;)nr--,xt.negative=0,xt._ishlnsubmul(At,1,ir),xt.isZero()||(xt.negative^=1);Et&&(Et.words[ir]=nr)}return Et&&Et._strip(),xt._strip(),dt!=="div"&&mt!==0&&xt.iushrn(mt),{div:Et||null,mod:xt}},tt.prototype.divmod=function(ct,dt,mt){if(j(!ct.isZero()),this.isZero())return{div:new tt(0),mod:new tt(0)};var xt,At,Rt;return this.negative!==0&&ct.negative===0?(Rt=this.neg().divmod(ct,dt),dt!=="mod"&&(xt=Rt.div.neg()),dt!=="div"&&(At=Rt.mod.neg(),mt&&At.negative!==0&&At.iadd(ct)),{div:xt,mod:At}):this.negative===0&&ct.negative!==0?(Rt=this.divmod(ct.neg(),dt),dt!=="mod"&&(xt=Rt.div.neg()),{div:xt,mod:Rt.mod}):this.negative&ct.negative?(Rt=this.neg().divmod(ct.neg(),dt),dt!=="div"&&(At=Rt.mod.neg(),mt&&At.negative!==0&&At.isub(ct)),{div:Rt.div,mod:At}):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 mt=dt.div.negative!==0?dt.mod.isub(ct):dt.mod,xt=ct.ushrn(1),At=ct.andln(1),Rt=mt.cmp(xt);return Rt<0||At===1&&Rt===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 mt=(1<<26)%ct,xt=0,At=this.length-1;At>=0;At--)xt=(mt*xt+(this.words[At]|0))%ct;return dt?-xt:xt},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 mt=0,xt=this.length-1;xt>=0;xt--){var At=(this.words[xt]|0)+mt*67108864;this.words[xt]=At/ct|0,mt=At%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,mt=ct.clone();dt.negative!==0?dt=dt.umod(ct):dt=dt.clone();for(var xt=new tt(1),At=new tt(0),Rt=new tt(0),St=new tt(1),Tt=0;dt.isEven()&&mt.isEven();)dt.iushrn(1),mt.iushrn(1),++Tt;for(var Et=mt.clone(),Nt=dt.clone();!dt.isZero();){for(var tr=0,ir=1;!(dt.words[0]&ir)&&tr<26;++tr,ir<<=1);if(tr>0)for(dt.iushrn(tr);tr-- >0;)(xt.isOdd()||At.isOdd())&&(xt.iadd(Et),At.isub(Nt)),xt.iushrn(1),At.iushrn(1);for(var nr=0,Zt=1;!(mt.words[0]&Zt)&&nr<26;++nr,Zt<<=1);if(nr>0)for(mt.iushrn(nr);nr-- >0;)(Rt.isOdd()||St.isOdd())&&(Rt.iadd(Et),St.isub(Nt)),Rt.iushrn(1),St.iushrn(1);dt.cmp(mt)>=0?(dt.isub(mt),xt.isub(Rt),At.isub(St)):(mt.isub(dt),Rt.isub(xt),St.isub(At))}return{a:Rt,b:St,gcd:mt.iushln(Tt)}},tt.prototype._invmp=function(ct){j(ct.negative===0),j(!ct.isZero());var dt=this,mt=ct.clone();dt.negative!==0?dt=dt.umod(ct):dt=dt.clone();for(var xt=new tt(1),At=new tt(0),Rt=mt.clone();dt.cmpn(1)>0&&mt.cmpn(1)>0;){for(var St=0,Tt=1;!(dt.words[0]&Tt)&&St<26;++St,Tt<<=1);if(St>0)for(dt.iushrn(St);St-- >0;)xt.isOdd()&&xt.iadd(Rt),xt.iushrn(1);for(var Et=0,Nt=1;!(mt.words[0]&Nt)&&Et<26;++Et,Nt<<=1);if(Et>0)for(mt.iushrn(Et);Et-- >0;)At.isOdd()&&At.iadd(Rt),At.iushrn(1);dt.cmp(mt)>=0?(dt.isub(mt),xt.isub(At)):(mt.isub(dt),At.isub(xt))}var tr;return dt.cmpn(1)===0?tr=xt:tr=At,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(),mt=ct.clone();dt.negative=0,mt.negative=0;for(var xt=0;dt.isEven()&&mt.isEven();xt++)dt.iushrn(1),mt.iushrn(1);do{for(;dt.isEven();)dt.iushrn(1);for(;mt.isEven();)mt.iushrn(1);var At=dt.cmp(mt);if(At<0){var Rt=dt;dt=mt,mt=Rt}else if(At===0||mt.cmpn(1)===0)break;dt.isub(mt)}while(!0);return mt.iushln(xt)},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,mt=(ct-dt)/26,xt=1<>>26,St&=67108863,this.words[Rt]=St}return At!==0&&(this.words[Rt]=At,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 mt;if(this.length>1)mt=1;else{dt&&(ct=-ct),j(ct<=67108863,"Number is too big");var xt=this.words[0]|0;mt=xt===ct?0:xtct.length)return 1;if(this.length=0;mt--){var xt=this.words[mt]|0,At=ct.words[mt]|0;if(xt!==At){xtAt&&(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 jt(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 Dt={k256:null,p224:null,p192:null,p25519:null};function zt(vt,ct){this.name=vt,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 dt=ct,mt;do this.split(dt,this.tmp),dt=this.imulK(dt),dt=dt.iadd(this.tmp),mt=dt.bitLength();while(mt>this.n);var xt=mt0?dt.isub(this.p):dt.strip!==void 0?dt.strip():dt._strip(),dt},zt.prototype.split=function(ct,dt){ct.iushrn(this.n,0,dt)},zt.prototype.imulK=function(ct){return ct.imul(this.k)};function Ot(){zt.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}et(Ot,zt),Ot.prototype.split=function(ct,dt){for(var mt=4194303,xt=Math.min(ct.length,9),At=0;At>>22,Rt=St}Rt>>>=22,ct.words[At-10]=Rt,Rt===0&&ct.length>10?ct.length-=10:ct.length-=9},Ot.prototype.imulK=function(ct){ct.words[ct.length]=0,ct.words[ct.length+1]=0,ct.length+=2;for(var dt=0,mt=0;mt>>=26,ct.words[mt]=At,dt=xt}return dt!==0&&(ct.words[ct.length++]=dt),ct},tt._prime=function(ct){if(Dt[ct])return Dt[ct];var dt;if(ct==="k256")dt=new Ot;else if(ct==="p224")dt=new It;else if(ct==="p192")dt=new Bt;else if(ct==="p25519")dt=new Ft;else throw new Error("Unknown prime "+ct);return Dt[ct]=dt,dt};function jt(vt){if(typeof vt=="string"){var ct=tt._prime(vt);this.m=ct.p,this.prime=ct}else j(vt.gtn(1),"modulus must be greater than 1"),this.m=vt,this.prime=null}jt.prototype._verify1=function(ct){j(ct.negative===0,"red works only with positives"),j(ct.red,"red works only with red numbers")},jt.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")},jt.prototype.imod=function(ct){return this.prime?this.prime.ireduce(ct)._forceRed(this):(ot(ct,ct.umod(this.m)._forceRed(this)),ct)},jt.prototype.neg=function(ct){return ct.isZero()?ct.clone():this.m.sub(ct)._forceRed(this)},jt.prototype.add=function(ct,dt){this._verify2(ct,dt);var mt=ct.add(dt);return mt.cmp(this.m)>=0&&mt.isub(this.m),mt._forceRed(this)},jt.prototype.iadd=function(ct,dt){this._verify2(ct,dt);var mt=ct.iadd(dt);return mt.cmp(this.m)>=0&&mt.isub(this.m),mt},jt.prototype.sub=function(ct,dt){this._verify2(ct,dt);var mt=ct.sub(dt);return mt.cmpn(0)<0&&mt.iadd(this.m),mt._forceRed(this)},jt.prototype.isub=function(ct,dt){this._verify2(ct,dt);var mt=ct.isub(dt);return mt.cmpn(0)<0&&mt.iadd(this.m),mt},jt.prototype.shl=function(ct,dt){return this._verify1(ct),this.imod(ct.ushln(dt))},jt.prototype.imul=function(ct,dt){return this._verify2(ct,dt),this.imod(ct.imul(dt))},jt.prototype.mul=function(ct,dt){return this._verify2(ct,dt),this.imod(ct.mul(dt))},jt.prototype.isqr=function(ct){return this.imul(ct,ct.clone())},jt.prototype.sqr=function(ct){return this.mul(ct,ct)},jt.prototype.sqrt=function(ct){if(ct.isZero())return ct.clone();var dt=this.m.andln(3);if(j(dt%2===1),dt===3){var mt=this.m.add(new tt(1)).iushrn(2);return this.pow(ct,mt)}for(var xt=this.m.subn(1),At=0;!xt.isZero()&&xt.andln(1)===0;)At++,xt.iushrn(1);j(!xt.isZero());var Rt=new tt(1).toRed(this),St=Rt.redNeg(),Tt=this.m.subn(1).iushrn(1),Et=this.m.bitLength();for(Et=new tt(2*Et*Et).toRed(this);this.pow(Et,Tt).cmp(St)!==0;)Et.redIAdd(St);for(var Nt=this.pow(Et,xt),tr=this.pow(ct,xt.addn(1).iushrn(1)),ir=this.pow(ct,xt),nr=At;ir.cmp(Rt)!==0;){for(var Zt=ir,Kt=0;Zt.cmp(Rt)!==0;Kt++)Zt=Zt.redSqr();j(Kt=0;At--){for(var Nt=dt.words[At],tr=Et-1;tr>=0;tr--){var ir=Nt>>tr&1;if(Rt!==xt[0]&&(Rt=this.sqr(Rt)),ir===0&&St===0){Tt=0;continue}St<<=1,St|=ir,Tt++,!(Tt!==mt&&(At!==0||tr!==0))&&(Rt=this.mul(Rt,xt[St]),Tt=0,St=0)}Et=26}return Rt},jt.prototype.convertTo=function(ct){var dt=ct.umod(this.m);return dt===ct?dt.clone():dt},jt.prototype.convertFrom=function(ct){var dt=ct.clone();return dt.red=null,dt},tt.mont=function(ct){return new bt(ct)};function bt(vt){jt.call(this,vt),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(bt,jt),bt.prototype.convertTo=function(ct){return this.imod(ct.ushln(this.shift))},bt.prototype.convertFrom=function(ct){var dt=this.imod(ct.mul(this.rinv));return dt.red=null,dt},bt.prototype.imul=function(ct,dt){if(ct.isZero()||dt.isZero())return ct.words[0]=0,ct.length=1,ct;var mt=ct.imul(dt),xt=mt.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),At=mt.isub(xt).iushrn(this.shift),Rt=At;return At.cmp(this.m)>=0?Rt=At.isub(this.m):At.cmpn(0)<0&&(Rt=At.iadd(this.m)),Rt._forceRed(this)},bt.prototype.mul=function(ct,dt){if(ct.isZero()||dt.isZero())return new tt(0)._forceRed(this);var mt=ct.mul(dt),xt=mt.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),At=mt.isub(xt).iushrn(this.shift),Rt=At;return At.cmp(this.m)>=0?Rt=At.isub(this.m):At.cmpn(0)<0&&(Rt=At.iadd(this.m)),Rt._forceRed(this)},bt.prototype.invm=function(ct){var dt=this.imod(ct._invmp(this.m).mul(this.r2));return dt._forceRed(this)}})(a,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(a.indexOf)return a.indexOf(_);for(var $=0;$>6],ht=(at&32)===0;if((at&31)===31){var yt=at;for(at=0;(yt&128)===128;){if(yt=st.readUInt8(ot),st.isError(yt))return yt;at<<=7,at|=yt&127}}else at&=31;var wt=et.tag[at];return{cls:ut,primitive:ht,tag:at,tagStr:wt}}function it(st,ot,at){var ut=st.readUInt8(at);if(st.isError(ut))return ut;if(!ot&&ut===128)return null;if(!(ut&128))return ut;var ht=ut&127;if(ht>4)return st.error("length octect is too long");ut=0;for(var yt=0;yt=256;Ct>>=8)wt++;var Pt=new _(2+wt);Pt[0]=yt,Pt[1]=128|wt;for(var Ct=1+wt,$t=ht.length;$t>0;Ct--,$t>>=8)Pt[Ct]=$t&255;return this._createEncoderBuffer([Pt,ht])},rt.prototype._encodeStr=function(ot,at){if(at==="bitstr")return this._createEncoderBuffer([ot.unused|0,ot.data]);if(at==="bmpstr"){for(var ut=new _(ot.length*2),ht=0;ht=40)return this.reporter.error("Second objid identifier OOB");ot.splice(0,2,ot[0]*40+ot[1])}for(var yt=0,ht=0;ht=128;wt>>=7)yt++}for(var Ct=new _(yt),Pt=Ct.length-1,ht=ot.length-1;ht>=0;ht--){var wt=ot[ht];for(Ct[Pt--]=wt&127;(wt>>=7)>0;)Ct[Pt--]=128|wt&127}return this._createEncoderBuffer(Ct)};function nt(st){return st<10?"0"+st:st}rt.prototype._encodeTime=function(ot,at){var ut,ht=new Date(ot);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(ot,at){if(typeof ot=="string"){if(!at)return this.reporter.error("String int or enum given, but no values map");if(!at.hasOwnProperty(ot))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(ot));ot=at[ot]}if(typeof ot!="number"&&!_.isBuffer(ot)){var ut=ot.toArray();!ot.sign&&ut[0]&128&&ut.unshift(0),ot=new _(ut)}if(_.isBuffer(ot)){var ht=ot.length;ot.length===0&&ht++;var wt=new _(ht);return ot.copy(wt),ot.length===0&&(wt[0]=0),this._createEncoderBuffer(wt)}if(ot<128)return this._createEncoderBuffer(ot);if(ot<256)return this._createEncoderBuffer([0,ot]);for(var ht=1,yt=ot;yt>=256;yt>>=8)ht++;for(var wt=new Array(ht),yt=wt.length-1;yt>=0;yt--)wt[yt]=ot&255,ot>>=8;return wt[0]&128&&wt.unshift(0),this._createEncoderBuffer(new _(wt))},rt.prototype._encodeBool=function(ot){return this._createEncoderBuffer(ot?255:0)},rt.prototype._use=function(ot,at){return typeof ot=="function"&&(ot=ot(at)),ot._getEncoder("der").tree},rt.prototype._skipDefault=function(ot,at,ut){var ht=this._baseState,yt;if(ht.default===null)return!1;var wt=ot.join();if(ht.defaultBuffer===void 0&&(ht.defaultBuffer=this._encodeValue(ht.default,at,ut).join()),wt.length!==ht.defaultBuffer.length)return!1;for(yt=0;yt=31?ut.error("Multi-octet tag encoding unsupported"):(ot||(ht|=32),ht|=et.tagClassByName[at||"universal"]<<6,ht)}return der_1}var pem,hasRequiredPem;function requirePem(){if(hasRequiredPem)return pem;hasRequiredPem=1;var a=inherits_browserExports,_=requireDer();function $(j){_.call(this,j),this.enc="pem"}return a($,_),pem=$,$.prototype.encode=function(et,tt){for(var rt=_.prototype.encode.call(this,et),nt=rt.toString("base64"),it=["-----BEGIN "+tt.label+"-----"],st=0;st0&&Mt.ishrn(Lt),Mt}function yt(Pt,$t){Pt=ht(Pt,$t),Pt=Pt.mod($t);var Mt=a.from(Pt.toArray());if(Mt.length<$t.byteLength()){var Lt=a.alloc($t.byteLength()-Mt.length);Mt=a.concat([Lt,Mt])}return Mt}function wt(Pt,$t,Mt){var Lt,Dt;do{for(Lt=a.alloc(0);Lt.length*8=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 a=safeBufferExports.Buffer,_=browser$b,$=requireReadableBrowser(),j=inherits_browserExports,et=requireSign(),tt=requireVerify(),rt=require$$6$1;Object.keys(rt).forEach(function(at){rt[at].id=a.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=_(ut.hash),this._tag=ut.id,this._signType=ut.sign}j(nt,$.Writable),nt.prototype._write=function(ut,ht,yt){this._hash.update(ut),yt()},nt.prototype.update=function(ut,ht){return this._hash.update(typeof ut=="string"?a.from(ut,ht):ut),this},nt.prototype.sign=function(ut,ht){this.end();var yt=this._hash.digest(),wt=et(yt,ut,this._hashType,this._signType,this._tag);return ht?wt.toString(ht):wt};function it(at){$.Writable.call(this);var ut=rt[at];if(!ut)throw new Error("Unknown message digest");this._hash=_(ut.hash),this._tag=ut.id,this._signType=ut.sign}j(it,$.Writable),it.prototype._write=function(ut,ht,yt){this._hash.update(ut),yt()},it.prototype.update=function(ut,ht){return this._hash.update(typeof ut=="string"?a.from(ut,ht):ut),this},it.prototype.verify=function(ut,ht,yt){var wt=typeof ht=="string"?a.from(ht,yt):ht;this.end();var Ct=this._hash.digest();return tt(wt,Ct,ut,this._signType,this._tag)};function st(at){return new nt(at)}function ot(at){return new it(at)}return browser$3={Sign:st,Verify:ot,createSign:st,createVerify:ot},browser$3}var elliptic$2={};const name$2="elliptic",version$2="6.5.5",description$2="EC cryptography",main$2="lib/elliptic.js",files$1=["lib"],scripts$2={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$2={type:"git",url:"git@github.com:indutny/elliptic"},keywords$1=["EC","Elliptic","curve","Cryptography"],author$2="Fedor Indutny ",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$j={},hasRequiredUtils;function requireUtils(){return hasRequiredUtils||(hasRequiredUtils=1,function(a){var _=a,$=bnExports$1,j=minimalisticAssert,et=utils$v;_.assert=j,_.toArray=et.toArray,_.zero2=et.zero2,_.toHex=et.toHex,_.encode=et.encode;function tt(ot,at,ut){var ht=new Array(Math.max(ot.bitLength(),ut)+1),yt;for(yt=0;yt(wt>>1)-1?Pt=(wt>>1)-$t:Pt=$t,Ct.isubn(Pt)):Pt=0,ht[yt]=Pt,Ct.iushrn(1)}return ht}_.getNAF=tt;function rt(ot,at){var ut=[[],[]];ot=ot.clone(),at=at.clone();for(var ht=0,yt=0,wt;ot.cmpn(-ht)>0||at.cmpn(-yt)>0;){var Ct=ot.andln(3)+ht&3,Pt=at.andln(3)+yt&3;Ct===3&&(Ct=-1),Pt===3&&(Pt=-1);var $t;Ct&1?(wt=ot.andln(7)+ht&7,(wt===3||wt===5)&&Pt===2?$t=-Ct:$t=Ct):$t=0,ut[0].push($t);var Mt;Pt&1?(wt=at.andln(7)+yt&7,(wt===3||wt===5)&&Ct===2?Mt=-Pt:Mt=Pt):Mt=0,ut[1].push(Mt),2*ht===$t+1&&(ht=1-ht),2*yt===Mt+1&&(yt=1-yt),ot.iushrn(1),at.iushrn(1)}return ut}_.getJSF=rt;function nt(ot,at,ut){var ht="_"+at;ot.prototype[at]=function(){return this[ht]!==void 0?this[ht]:this[ht]=ut.call(this)}}_.cachedProperty=nt;function it(ot){return typeof ot=="string"?_.toArray(ot,"hex"):ot}_.parseBytes=it;function st(ot){return new $(ot,"hex","le")}_.intFromLE=st}(utils$j)),utils$j}var curve$1={},base$3,hasRequiredBase;function requireBase(){if(hasRequiredBase)return base$3;hasRequiredBase=1;var a=bnExports$1,_=requireUtils(),$=_.getNAF,j=_.getJSF,et=_.assert;function tt(nt,it){this.type=nt,this.p=new a(it.p,16),this.red=it.prime?a.red(it.prime):a.mont(this.p),this.zero=new a(0).toRed(this.red),this.one=new a(1).toRed(this.red),this.two=new a(2).toRed(this.red),this.n=it.n&&new a(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 st=this.n&&this.p.div(this.n);!st||st.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}base$3=tt,tt.prototype.point=function(){throw new Error("Not implemented")},tt.prototype.validate=function(){throw new Error("Not implemented")},tt.prototype._fixedNafMul=function(it,st){et(it.precomputed);var ot=it._getDoubles(),at=$(st,1,this._bitLength),ut=(1<=yt;Ct--)wt=(wt<<1)+at[Ct];ht.push(wt)}for(var Pt=this.jpoint(null,null,null),$t=this.jpoint(null,null,null),Mt=ut;Mt>0;Mt--){for(yt=0;yt=0;wt--){for(var Ct=0;wt>=0&&ht[wt]===0;wt--)Ct++;if(wt>=0&&Ct++,yt=yt.dblp(Ct),wt<0)break;var Pt=ht[wt];et(Pt!==0),it.type==="affine"?Pt>0?yt=yt.mixedAdd(ut[Pt-1>>1]):yt=yt.mixedAdd(ut[-Pt-1>>1].neg()):Pt>0?yt=yt.add(ut[Pt-1>>1]):yt=yt.add(ut[-Pt-1>>1].neg())}return it.type==="affine"?yt.toP():yt},tt.prototype._wnafMulAdd=function(it,st,ot,at,ut){var ht=this._wnafT1,yt=this._wnafT2,wt=this._wnafT3,Ct=0,Pt,$t,Mt;for(Pt=0;Pt=1;Pt-=2){var Dt=Pt-1,zt=Pt;if(ht[Dt]!==1||ht[zt]!==1){wt[Dt]=$(ot[Dt],ht[Dt],this._bitLength),wt[zt]=$(ot[zt],ht[zt],this._bitLength),Ct=Math.max(wt[Dt].length,Ct),Ct=Math.max(wt[zt].length,Ct);continue}var Ot=[st[Dt],null,null,st[zt]];st[Dt].y.cmp(st[zt].y)===0?(Ot[1]=st[Dt].add(st[zt]),Ot[2]=st[Dt].toJ().mixedAdd(st[zt].neg())):st[Dt].y.cmp(st[zt].y.redNeg())===0?(Ot[1]=st[Dt].toJ().mixedAdd(st[zt]),Ot[2]=st[Dt].add(st[zt].neg())):(Ot[1]=st[Dt].toJ().mixedAdd(st[zt]),Ot[2]=st[Dt].toJ().mixedAdd(st[zt].neg()));var It=[-3,-1,-5,-7,0,7,5,1,3],Bt=j(ot[Dt],ot[zt]);for(Ct=Math.max(Bt[0].length,Ct),wt[Dt]=new Array(Ct),wt[zt]=new Array(Ct),$t=0;$t=0;Pt--){for(var ct=0;Pt>=0;){var dt=!0;for($t=0;$t=0&&ct++,bt=bt.dblp(ct),Pt<0)break;for($t=0;$t0?Mt=yt[$t][mt-1>>1]:mt<0&&(Mt=yt[$t][-mt-1>>1].neg()),Mt.type==="affine"?bt=bt.mixedAdd(Mt):bt=bt.add(Mt))}}for(Pt=0;Pt=Math.ceil((it.bitLength()+1)/st.step):!1},rt.prototype._getDoubles=function(it,st){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var ot=[this],at=this,ut=0;ut=0&&(Dt=Pt,zt=$t),Mt.negative&&(Mt=Mt.neg(),Lt=Lt.neg()),Dt.negative&&(Dt=Dt.neg(),zt=zt.neg()),[{a:Mt,b:Lt},{a:Dt,b:zt}]},tt.prototype._endoSplit=function(st){var ot=this.endo.basis,at=ot[0],ut=ot[1],ht=ut.b.mul(st).divRound(this.n),yt=at.b.neg().mul(st).divRound(this.n),wt=ht.mul(at.a),Ct=yt.mul(ut.a),Pt=ht.mul(at.b),$t=yt.mul(ut.b),Mt=st.sub(wt).sub(Ct),Lt=Pt.add($t).neg();return{k1:Mt,k2:Lt}},tt.prototype.pointFromX=function(st,ot){st=new _(st,16),st.red||(st=st.toRed(this.red));var at=st.redSqr().redMul(st).redIAdd(st.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(ot&&!ht||!ot&&ht)&&(ut=ut.redNeg()),this.point(st,ut)},tt.prototype.validate=function(st){if(st.inf)return!0;var ot=st.x,at=st.y,ut=this.a.redMul(ot),ht=ot.redSqr().redMul(ot).redIAdd(ut).redIAdd(this.b);return at.redSqr().redISub(ht).cmpn(0)===0},tt.prototype._endoWnafMulAdd=function(st,ot,at){for(var ut=this._endoWnafT1,ht=this._endoWnafT2,yt=0;yt":""},rt.prototype.isInfinity=function(){return this.inf},rt.prototype.add=function(st){if(this.inf)return st;if(st.inf)return this;if(this.eq(st))return this.dbl();if(this.neg().eq(st))return this.curve.point(null,null);if(this.x.cmp(st.x)===0)return this.curve.point(null,null);var ot=this.y.redSub(st.y);ot.cmpn(0)!==0&&(ot=ot.redMul(this.x.redSub(st.x).redInvm()));var at=ot.redSqr().redISub(this.x).redISub(st.x),ut=ot.redMul(this.x.redSub(at)).redISub(this.y);return this.curve.point(at,ut)},rt.prototype.dbl=function(){if(this.inf)return this;var st=this.y.redAdd(this.y);if(st.cmpn(0)===0)return this.curve.point(null,null);var ot=this.curve.a,at=this.x.redSqr(),ut=st.redInvm(),ht=at.redAdd(at).redIAdd(at).redIAdd(ot).redMul(ut),yt=ht.redSqr().redISub(this.x.redAdd(this.x)),wt=ht.redMul(this.x.redSub(yt)).redISub(this.y);return this.curve.point(yt,wt)},rt.prototype.getX=function(){return this.x.fromRed()},rt.prototype.getY=function(){return this.y.fromRed()},rt.prototype.mul=function(st){return st=new _(st,16),this.isInfinity()?this:this._hasDoubles(st)?this.curve._fixedNafMul(this,st):this.curve.endo?this.curve._endoWnafMulAdd([this],[st]):this.curve._wnafMul(this,st)},rt.prototype.mulAdd=function(st,ot,at){var ut=[this,ot],ht=[st,at];return this.curve.endo?this.curve._endoWnafMulAdd(ut,ht):this.curve._wnafMulAdd(1,ut,ht,2)},rt.prototype.jmulAdd=function(st,ot,at){var ut=[this,ot],ht=[st,at];return this.curve.endo?this.curve._endoWnafMulAdd(ut,ht,!0):this.curve._wnafMulAdd(1,ut,ht,2,!0)},rt.prototype.eq=function(st){return this===st||this.inf===st.inf&&(this.inf||this.x.cmp(st.x)===0&&this.y.cmp(st.y)===0)},rt.prototype.neg=function(st){if(this.inf)return this;var ot=this.curve.point(this.x,this.y.redNeg());if(st&&this.precomputed){var at=this.precomputed,ut=function(ht){return ht.neg()};ot.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 ot},rt.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var st=this.curve.jpoint(this.x,this.y,this.curve.one);return st};function nt(it,st,ot,at){j.BasePoint.call(this,it,"jacobian"),st===null&&ot===null&&at===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new _(0)):(this.x=new _(st,16),this.y=new _(ot,16),this.z=new _(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(st,ot,at){return new nt(this,st,ot,at)},nt.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var st=this.z.redInvm(),ot=st.redSqr(),at=this.x.redMul(ot),ut=this.y.redMul(ot).redMul(st);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(st){if(this.isInfinity())return st;if(st.isInfinity())return this;var ot=st.z.redSqr(),at=this.z.redSqr(),ut=this.x.redMul(ot),ht=st.x.redMul(at),yt=this.y.redMul(ot.redMul(st.z)),wt=st.y.redMul(at.redMul(this.z)),Ct=ut.redSub(ht),Pt=yt.redSub(wt);if(Ct.cmpn(0)===0)return Pt.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var $t=Ct.redSqr(),Mt=$t.redMul(Ct),Lt=ut.redMul($t),Dt=Pt.redSqr().redIAdd(Mt).redISub(Lt).redISub(Lt),zt=Pt.redMul(Lt.redISub(Dt)).redISub(yt.redMul(Mt)),Ot=this.z.redMul(st.z).redMul(Ct);return this.curve.jpoint(Dt,zt,Ot)},nt.prototype.mixedAdd=function(st){if(this.isInfinity())return st.toJ();if(st.isInfinity())return this;var ot=this.z.redSqr(),at=this.x,ut=st.x.redMul(ot),ht=this.y,yt=st.y.redMul(ot).redMul(this.z),wt=at.redSub(ut),Ct=ht.redSub(yt);if(wt.cmpn(0)===0)return Ct.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var Pt=wt.redSqr(),$t=Pt.redMul(wt),Mt=at.redMul(Pt),Lt=Ct.redSqr().redIAdd($t).redISub(Mt).redISub(Mt),Dt=Ct.redMul(Mt.redISub(Lt)).redISub(ht.redMul($t)),zt=this.z.redMul(wt);return this.curve.jpoint(Lt,Dt,zt)},nt.prototype.dblp=function(st){if(st===0)return this;if(this.isInfinity())return this;if(!st)return this.dbl();var ot;if(this.curve.zeroA||this.curve.threeA){var at=this;for(ot=0;ot=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$1}var mont$1,hasRequiredMont;function requireMont(){if(hasRequiredMont)return mont$1;hasRequiredMont=1;var a=bnExports$1,_=inherits_browserExports,$=requireBase(),j=requireUtils();function et(rt){$.call(this,"mont",rt),this.a=new a(rt.a,16).toRed(this.red),this.b=new a(rt.b,16).toRed(this.red),this.i4=new a(4).toRed(this.red).redInvm(),this.two=new a(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}_(et,$),mont$1=et,et.prototype.validate=function(nt){var it=nt.normalize().x,st=it.redSqr(),ot=st.redMul(it).redAdd(st.redMul(this.a)).redAdd(it),at=ot.redSqrt();return at.redSqr().cmp(ot)===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 a(nt,16),this.z=new a(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 _(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(),st=this.x.redSub(this.z),ot=st.redSqr(),at=it.redSub(ot),ut=it.redMul(ot),ht=at.redMul(ot.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 st=this.x.redAdd(this.z),ot=this.x.redSub(this.z),at=nt.x.redAdd(nt.z),ut=nt.x.redSub(nt.z),ht=ut.redMul(st),yt=at.redMul(ot),wt=it.z.redMul(ht.redAdd(yt).redSqr()),Ct=it.x.redMul(ht.redISub(yt).redSqr());return this.curve.point(wt,Ct)},tt.prototype.mul=function(nt){for(var it=nt.clone(),st=this,ot=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?(st=st.diffAdd(ot,at),ot=ot.dbl()):(ot=st.diffAdd(ot,at),st=st.dbl());return ot},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$1}var edwards$1,hasRequiredEdwards;function requireEdwards(){if(hasRequiredEdwards)return edwards$1;hasRequiredEdwards=1;var a=requireUtils(),_=bnExports$1,$=inherits_browserExports,j=requireBase(),et=a.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 _(nt.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new _(nt.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new _(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$1=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,st,ot,at){return this.point(it,st,ot,at)},tt.prototype.pointFromX=function(it,st){it=new _(it,16),it.red||(it=it.toRed(this.red));var ot=it.redSqr(),at=this.c2.redSub(this.a.redMul(ot)),ut=this.one.redSub(this.c2.redMul(this.d).redMul(ot)),ht=at.redMul(ut.redInvm()),yt=ht.redSqrt();if(yt.redSqr().redSub(ht).cmp(this.zero)!==0)throw new Error("invalid point");var wt=yt.fromRed().isOdd();return(st&&!wt||!st&&wt)&&(yt=yt.redNeg()),this.point(it,yt)},tt.prototype.pointFromY=function(it,st){it=new _(it,16),it.red||(it=it.toRed(this.red));var ot=it.redSqr(),at=ot.redSub(this.c2),ut=ot.redMul(this.d).redMul(this.c2).redSub(this.a),ht=at.redMul(ut.redInvm());if(ht.cmp(this.zero)===0){if(st)throw new Error("invalid point");return this.point(this.zero,it)}var yt=ht.redSqrt();if(yt.redSqr().redSub(ht).cmp(this.zero)!==0)throw new Error("invalid point");return yt.fromRed().isOdd()!==st&&(yt=yt.redNeg()),this.point(yt,it)},tt.prototype.validate=function(it){if(it.isInfinity())return!0;it.normalize();var st=it.x.redSqr(),ot=it.y.redSqr(),at=st.redMul(this.a).redAdd(ot),ut=this.c2.redMul(this.one.redAdd(this.d.redMul(st).redMul(ot)));return at.cmp(ut)===0};function rt(nt,it,st,ot,at){j.BasePoint.call(this,nt,"projective"),it===null&&st===null&&ot===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 _(it,16),this.y=new _(st,16),this.z=ot?new _(ot,16):this.curve.one,this.t=at&&new _(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,st,ot,at){return new rt(this,it,st,ot,at)},rt.fromJSON=function(it,st){return new rt(it,st[0],st[1],st[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(),st=this.y.redSqr(),ot=this.z.redSqr();ot=ot.redIAdd(ot);var at=this.curve._mulA(it),ut=this.x.redAdd(this.y).redSqr().redISub(it).redISub(st),ht=at.redAdd(st),yt=ht.redSub(ot),wt=at.redSub(st),Ct=ut.redMul(yt),Pt=ht.redMul(wt),$t=ut.redMul(wt),Mt=yt.redMul(ht);return this.curve.point(Ct,Pt,Mt,$t)},rt.prototype._projDbl=function(){var it=this.x.redAdd(this.y).redSqr(),st=this.x.redSqr(),ot=this.y.redSqr(),at,ut,ht,yt,wt,Ct;if(this.curve.twisted){yt=this.curve._mulA(st);var Pt=yt.redAdd(ot);this.zOne?(at=it.redSub(st).redSub(ot).redMul(Pt.redSub(this.curve.two)),ut=Pt.redMul(yt.redSub(ot)),ht=Pt.redSqr().redSub(Pt).redSub(Pt)):(wt=this.z.redSqr(),Ct=Pt.redSub(wt).redISub(wt),at=it.redSub(st).redISub(ot).redMul(Ct),ut=Pt.redMul(yt.redSub(ot)),ht=Pt.redMul(Ct))}else yt=st.redAdd(ot),wt=this.curve._mulC(this.z).redSqr(),Ct=yt.redSub(wt).redSub(wt),at=this.curve._mulC(it.redISub(yt)).redMul(Ct),ut=this.curve._mulC(yt).redMul(st.redISub(ot)),ht=yt.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 st=this.y.redSub(this.x).redMul(it.y.redSub(it.x)),ot=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=ot.redSub(st),yt=ut.redSub(at),wt=ut.redAdd(at),Ct=ot.redAdd(st),Pt=ht.redMul(yt),$t=wt.redMul(Ct),Mt=ht.redMul(Ct),Lt=yt.redMul(wt);return this.curve.point(Pt,$t,Lt,Mt)},rt.prototype._projAdd=function(it){var st=this.z.redMul(it.z),ot=st.redSqr(),at=this.x.redMul(it.x),ut=this.y.redMul(it.y),ht=this.curve.d.redMul(at).redMul(ut),yt=ot.redSub(ht),wt=ot.redAdd(ht),Ct=this.x.redAdd(this.y).redMul(it.x.redAdd(it.y)).redISub(at).redISub(ut),Pt=st.redMul(yt).redMul(Ct),$t,Mt;return this.curve.twisted?($t=st.redMul(wt).redMul(ut.redSub(this.curve._mulA(at))),Mt=yt.redMul(wt)):($t=st.redMul(wt).redMul(ut.redSub(at)),Mt=this.curve._mulC(yt).redMul(wt)),this.curve.point(Pt,$t,Mt)},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,st,ot){return this.curve._wnafMulAdd(1,[this,st],[it,ot],2,!1)},rt.prototype.jmulAdd=function(it,st,ot){return this.curve._wnafMulAdd(1,[this,st],[it,ot],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 st=it.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(st)===0)return!0;for(var ot=it.clone(),at=this.curve.redN.redMul(this.z);;){if(ot.iadd(this.curve.n),ot.cmp(this.curve.p)>=0)return!1;if(st.redIAdd(at),this.x.cmp(st)===0)return!0}},rt.prototype.toP=rt.prototype.normalize,rt.prototype.mixedAdd=rt.prototype.add,edwards$1}var hasRequiredCurve;function requireCurve(){return hasRequiredCurve||(hasRequiredCurve=1,function(a){var _=a;_.base=requireBase(),_.short=requireShort(),_.mont=requireMont(),_.edwards=requireEdwards()}(curve$1)),curve$1}var curves$3={},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}var hasRequiredCurves;function requireCurves(){return hasRequiredCurves||(hasRequiredCurves=1,function(a){var _=a,$=hash$4,j=requireCurve(),et=requireUtils(),tt=et.assert;function rt(st){st.type==="short"?this.curve=new j.short(st):st.type==="edwards"?this.curve=new j.edwards(st):this.curve=new j.mont(st),this.g=this.curve.g,this.n=this.curve.n,this.hash=st.hash,tt(this.g.validate(),"Invalid curve"),tt(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}_.PresetCurve=rt;function nt(st,ot){Object.defineProperty(_,st,{configurable:!0,enumerable:!0,get:function(){var at=new rt(ot);return Object.defineProperty(_,st,{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$3)),curves$3}var key$3,hasRequiredKey$1;function requireKey$1(){if(hasRequiredKey$1)return key$3;hasRequiredKey$1=1;var a=bnExports$1,_=requireUtils(),$=_.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$3=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 a(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$3}var signature$3,hasRequiredSignature$1;function requireSignature$1(){if(hasRequiredSignature$1)return signature$3;hasRequiredSignature$1=1;var a=bnExports$1,_=requireUtils(),$=_.assert;function j(it,st){if(it instanceof j)return it;this._importDER(it,st)||($(it.r&&it.s,"Signature without r or s"),this.r=new a(it.r,16),this.s=new a(it.s,16),it.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=it.recoveryParam)}signature$3=j;function et(){this.place=0}function tt(it,st){var ot=it[st.place++];if(!(ot&128))return ot;var at=ot&15;if(at===0||at>4)return!1;for(var ut=0,ht=0,yt=st.place;ht>>=0;return ut<=127?!1:(st.place=yt,ut)}function rt(it){for(var st=0,ot=it.length-1;!it[st]&&!(it[st+1]&128)&&st>>3);for(it.push(ot|128);--ot;)it.push(st>>>(ot<<3)&255);it.push(st)}return j.prototype.toDER=function(st){var ot=this.r.toArray(),at=this.s.toArray();for(ot[0]&128&&(ot=[0].concat(ot)),at[0]&128&&(at=[0].concat(at)),ot=rt(ot),at=rt(at);!at[0]&&!(at[1]&128);)at=at.slice(1);var ut=[2];nt(ut,ot.length),ut=ut.concat(ot),ut.push(2),nt(ut,at.length);var ht=ut.concat(at),yt=[48];return nt(yt,ht.length),yt=yt.concat(ht),_.encode(yt,st)},signature$3}var ec$4,hasRequiredEc;function requireEc(){if(hasRequiredEc)return ec$4;hasRequiredEc=1;var a=bnExports$1,_=hmacDrbg,$=requireUtils(),j=requireCurves(),et=requireBrorand(),tt=$.assert,rt=requireKey$1(),nt=requireSignature$1();function it(st){if(!(this instanceof it))return new it(st);typeof st=="string"&&(tt(Object.prototype.hasOwnProperty.call(j,st),"Unknown curve "+st),st=j[st]),st instanceof j.PresetCurve&&(st={curve:st}),this.curve=st.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=st.curve.g,this.g.precompute(st.curve.n.bitLength()+1),this.hash=st.hash||st.curve.hash}return ec$4=it,it.prototype.keyPair=function(ot){return new rt(this,ot)},it.prototype.keyFromPrivate=function(ot,at){return rt.fromPrivate(this,ot,at)},it.prototype.keyFromPublic=function(ot,at){return rt.fromPublic(this,ot,at)},it.prototype.genKeyPair=function(ot){ot||(ot={});for(var at=new _({hash:this.hash,pers:ot.pers,persEnc:ot.persEnc||"utf8",entropy:ot.entropy||et(this.hash.hmacStrength),entropyEnc:ot.entropy&&ot.entropyEnc||"utf8",nonce:this.n.toArray()}),ut=this.n.byteLength(),ht=this.n.sub(new a(2));;){var yt=new a(at.generate(ut));if(!(yt.cmp(ht)>0))return yt.iaddn(1),this.keyFromPrivate(yt)}},it.prototype._truncateToN=function(ot,at){var ut=ot.byteLength()*8-this.n.bitLength();return ut>0&&(ot=ot.ushrn(ut)),!at&&ot.cmp(this.n)>=0?ot.sub(this.n):ot},it.prototype.sign=function(ot,at,ut,ht){typeof ut=="object"&&(ht=ut,ut=null),ht||(ht={}),at=this.keyFromPrivate(at,ut),ot=this._truncateToN(new a(ot,16));for(var yt=this.n.byteLength(),wt=at.getPrivate().toArray("be",yt),Ct=ot.toArray("be",yt),Pt=new _({hash:this.hash,entropy:wt,nonce:Ct,pers:ht.pers,persEnc:ht.persEnc||"utf8"}),$t=this.n.sub(new a(1)),Mt=0;;Mt++){var Lt=ht.k?ht.k(Mt):new a(Pt.generate(this.n.byteLength()));if(Lt=this._truncateToN(Lt,!0),!(Lt.cmpn(1)<=0||Lt.cmp($t)>=0)){var Dt=this.g.mul(Lt);if(!Dt.isInfinity()){var zt=Dt.getX(),Ot=zt.umod(this.n);if(Ot.cmpn(0)!==0){var It=Lt.invm(this.n).mul(Ot.mul(at.getPrivate()).iadd(ot));if(It=It.umod(this.n),It.cmpn(0)!==0){var Bt=(Dt.getY().isOdd()?1:0)|(zt.cmp(Ot)!==0?2:0);return ht.canonical&&It.cmp(this.nh)>0&&(It=this.n.sub(It),Bt^=1),new nt({r:Ot,s:It,recoveryParam:Bt})}}}}}},it.prototype.verify=function(ot,at,ut,ht){ot=this._truncateToN(new a(ot,16)),ut=this.keyFromPublic(ut,ht),at=new nt(at,"hex");var yt=at.r,wt=at.s;if(yt.cmpn(1)<0||yt.cmp(this.n)>=0||wt.cmpn(1)<0||wt.cmp(this.n)>=0)return!1;var Ct=wt.invm(this.n),Pt=Ct.mul(ot).umod(this.n),$t=Ct.mul(yt).umod(this.n),Mt;return this.curve._maxwellTrick?(Mt=this.g.jmulAdd(Pt,ut.getPublic(),$t),Mt.isInfinity()?!1:Mt.eqXToP(yt)):(Mt=this.g.mulAdd(Pt,ut.getPublic(),$t),Mt.isInfinity()?!1:Mt.getX().umod(this.n).cmp(yt)===0)},it.prototype.recoverPubKey=function(st,ot,at,ut){tt((3&at)===at,"The recovery param is more than two bits"),ot=new nt(ot,ut);var ht=this.n,yt=new a(st),wt=ot.r,Ct=ot.s,Pt=at&1,$t=at>>1;if(wt.cmp(this.curve.p.umod(this.curve.n))>=0&&$t)throw new Error("Unable to find sencond key candinate");$t?wt=this.curve.pointFromX(wt.add(this.curve.n),Pt):wt=this.curve.pointFromX(wt,Pt);var Mt=ot.r.invm(ht),Lt=ht.sub(yt).mul(Mt).umod(ht),Dt=Ct.mul(Mt).umod(ht);return this.g.mulAdd(Lt,wt,Dt)},it.prototype.getKeyRecoveryParam=function(st,ot,at,ut){if(ot=new nt(ot,ut),ot.recoveryParam!==null)return ot.recoveryParam;for(var ht=0;ht<4;ht++){var yt;try{yt=this.recoverPubKey(st,ot,ht)}catch{continue}if(yt.eq(at))return ht}throw new Error("Unable to find valid recovery factor")},ec$4}var key$2,hasRequiredKey;function requireKey(){if(hasRequiredKey)return key$2;hasRequiredKey=1;var a=requireUtils(),_=a.assert,$=a.parseBytes,j=a.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,st=nt.slice(0,rt.encodingLength);return st[0]&=248,st[it]&=127,st[it]|=64,st}),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 _(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 _(this._secret,"KeyPair is public only"),a.encode(this.secret(),rt)},et.prototype.getPublic=function(rt){return a.encode(this.pubBytes(),rt)},key$2=et,key$2}var signature$2,hasRequiredSignature;function requireSignature(){if(hasRequiredSignature)return signature$2;hasRequiredSignature=1;var a=bnExports$1,_=requireUtils(),$=_.assert,j=_.cachedProperty,et=_.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 a&&(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 _.encode(this.toBytes(),"hex").toUpperCase()},signature$2=tt,signature$2}var eddsa$1,hasRequiredEddsa;function requireEddsa(){if(hasRequiredEddsa)return eddsa$1;hasRequiredEddsa=1;var a=hash$4,_=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=_[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=a.sha512}return eddsa$1=nt,nt.prototype.sign=function(st,ot){st=et(st);var at=this.keyFromSecret(ot),ut=this.hashInt(at.messagePrefix(),st),ht=this.g.mul(ut),yt=this.encodePoint(ht),wt=this.hashInt(yt,at.pubBytes(),st).mul(at.priv()),Ct=ut.add(wt).umod(this.curve.n);return this.makeSignature({R:ht,S:Ct,Rencoded:yt})},nt.prototype.verify=function(st,ot,at){st=et(st),ot=this.makeSignature(ot);var ut=this.keyFromPublic(at),ht=this.hashInt(ot.Rencoded(),ut.pubBytes(),st),yt=this.g.mul(ot.S()),wt=ot.R().add(ut.pub().mul(ht));return wt.eq(yt)},nt.prototype.hashInt=function(){for(var st=this.hash(),ot=0;ot=0)throw new Error("data too long for modulus")}else throw new Error("unknown padding");return wt?nt($t,Pt):rt($t,Pt)};function st(ut,ht){var yt=ut.modulus.byteLength(),wt=ht.length,Ct=$("sha1").update(it.alloc(0)).digest(),Pt=Ct.length,$t=2*Pt;if(wt>yt-$t-2)throw new Error("message too long");var Mt=it.alloc(yt-wt-$t-2),Lt=yt-Pt-1,Dt=_(Pt),zt=et(it.concat([Ct,Mt,it.alloc(1,1),ht],Lt),j(Dt,Lt)),Ot=et(Dt,j(zt,Pt));return new tt(it.concat([it.alloc(1),Ot,zt],yt))}function ot(ut,ht,yt){var wt=ht.length,Ct=ut.modulus.byteLength();if(wt>Ct-11)throw new Error("message too long");var Pt;return yt?Pt=it.alloc(Ct-wt-3,255):Pt=at(Ct-wt-3),new tt(it.concat([it.from([0,yt?1:2]),Pt,it.alloc(1),ht],Ct))}function at(ut){for(var ht=it.allocUnsafe(ut),yt=0,wt=_(ut*2),Ct=0,Pt;ytPt||new j(ht).cmp(Ct.modulus)>=0)throw new Error("decryption error");var $t;yt?$t=rt(new j(ht),Ct):$t=et(ht,Ct);var Mt=nt.alloc(Pt-$t.length);if($t=nt.concat([Mt,$t],Pt),wt===4)return it(Ct,$t);if(wt===1)return st(Ct,$t,yt);if(wt===3)return $t;throw new Error("unknown padding")};function it(at,ut){var ht=at.modulus.byteLength(),yt=tt("sha1").update(nt.alloc(0)).digest(),wt=yt.length;if(ut[0]!==0)throw new Error("decryption error");var Ct=ut.slice(1,wt+1),Pt=ut.slice(wt+1),$t=$(Ct,_(Pt,wt)),Mt=$(Pt,_($t,ht-wt-1));if(ot(yt,Mt.slice(0,wt)))throw new Error("decryption error");for(var Lt=wt;Mt[Lt]===0;)Lt++;if(Mt[Lt++]!==1)throw new Error("decryption error");return Mt.slice(Lt)}function st(at,ut,ht){for(var yt=ut.slice(0,2),wt=2,Ct=0;ut[wt++]!==0;)if(wt>=ut.length){Ct++;break}var Pt=ut.slice(2,wt-1);if((yt.toString("hex")!=="0002"&&!ht||yt.toString("hex")!=="0001"&&ht)&&Ct++,Pt.length<8&&Ct++,Ct)throw new Error("decryption error");return ut.slice(wt)}function ot(at,ut){at=nt.from(at),ut=nt.from(ut);var ht=0,yt=at.length;at.length!==ut.length&&(ht++,yt=Math.min(at.length,ut.length));for(var wt=-1;++wtrt||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,yt){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>yt||ut>et)throw new RangeError("buffer too small")}tt&&tt.getRandomValues||!process$1$1.browser?(browser.randomFill=st,browser.randomFillSync=at):(browser.randomFill=a,browser.randomFillSync=a);function st(ut,ht,yt,wt){if(!j.isBuffer(ut)&&!(ut instanceof commonjsGlobal.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if(typeof ht=="function")wt=ht,ht=0,yt=ut.length;else if(typeof yt=="function")wt=yt,yt=ut.length-ht;else if(typeof wt!="function")throw new TypeError('"cb" argument must be a function');return nt(ht,ut.length),it(yt,ht,ut.length),ot(ut,ht,yt,wt)}function ot(ut,ht,yt,wt){if(process$1$1.browser){var Ct=ut.buffer,Pt=new Uint8Array(Ct,ht,yt);if(tt.getRandomValues(Pt),wt){process$1$1.nextTick(function(){wt(null,ut)});return}return ut}if(wt){$(yt,function(Mt,Lt){if(Mt)return wt(Mt);Lt.copy(ut,ht),wt(null,ut)});return}var $t=$(yt);return $t.copy(ut,ht),ut}function at(ut,ht,yt){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),yt===void 0&&(yt=ut.length-ht),it(yt,ht,ut.length),ot(ut,ht,yt)}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 a=requireAlgos(),_=Object.keys(a),$=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(_);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 _=requireCryptoBrowserify();_&&_.randomBytes&&(this._crypto=_,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(_){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let $=this._crypto.randomBytes(_);if($.length!==_)throw new Error("NodeRandomSource: got fewer bytes than requested");const j=new Uint8Array(_);for(let et=0;et>>16&65535,ot=nt&65535,at=it>>>16&65535,ut=it&65535;return ot*ut+(st*ut+ot*at<<16>>>0)|0}a.mul=Math.imul||_;function $(nt,it){return nt+it|0}a.add=$;function j(nt,it){return nt-it|0}a.sub=j;function et(nt,it){return nt<>>32-it}a.rotl=et;function tt(nt,it){return nt<<32-it|nt>>>it}a.rotr=tt;function rt(nt){return typeof nt=="number"&&isFinite(nt)&&Math.floor(nt)===nt}a.isInteger=Number.isInteger||rt,a.MAX_SAFE_INTEGER=9007199254740991,a.isSafeInteger=function(nt){return a.isInteger(nt)&&nt>=-a.MAX_SAFE_INTEGER&&nt<=a.MAX_SAFE_INTEGER}})(int);Object.defineProperty(binary,"__esModule",{value:!0});var int_1=int;function readInt16BE(a,_){return _===void 0&&(_=0),(a[_+0]<<8|a[_+1])<<16>>16}binary.readInt16BE=readInt16BE;function readUint16BE(a,_){return _===void 0&&(_=0),(a[_+0]<<8|a[_+1])>>>0}binary.readUint16BE=readUint16BE;function readInt16LE(a,_){return _===void 0&&(_=0),(a[_+1]<<8|a[_])<<16>>16}binary.readInt16LE=readInt16LE;function readUint16LE(a,_){return _===void 0&&(_=0),(a[_+1]<<8|a[_])>>>0}binary.readUint16LE=readUint16LE;function writeUint16BE(a,_,$){return _===void 0&&(_=new Uint8Array(2)),$===void 0&&($=0),_[$+0]=a>>>8,_[$+1]=a>>>0,_}binary.writeUint16BE=writeUint16BE;binary.writeInt16BE=writeUint16BE;function writeUint16LE(a,_,$){return _===void 0&&(_=new Uint8Array(2)),$===void 0&&($=0),_[$+0]=a>>>0,_[$+1]=a>>>8,_}binary.writeUint16LE=writeUint16LE;binary.writeInt16LE=writeUint16LE;function readInt32BE(a,_){return _===void 0&&(_=0),a[_]<<24|a[_+1]<<16|a[_+2]<<8|a[_+3]}binary.readInt32BE=readInt32BE;function readUint32BE(a,_){return _===void 0&&(_=0),(a[_]<<24|a[_+1]<<16|a[_+2]<<8|a[_+3])>>>0}binary.readUint32BE=readUint32BE;function readInt32LE(a,_){return _===void 0&&(_=0),a[_+3]<<24|a[_+2]<<16|a[_+1]<<8|a[_]}binary.readInt32LE=readInt32LE;function readUint32LE(a,_){return _===void 0&&(_=0),(a[_+3]<<24|a[_+2]<<16|a[_+1]<<8|a[_])>>>0}binary.readUint32LE=readUint32LE;function writeUint32BE(a,_,$){return _===void 0&&(_=new Uint8Array(4)),$===void 0&&($=0),_[$+0]=a>>>24,_[$+1]=a>>>16,_[$+2]=a>>>8,_[$+3]=a>>>0,_}binary.writeUint32BE=writeUint32BE;binary.writeInt32BE=writeUint32BE;function writeUint32LE(a,_,$){return _===void 0&&(_=new Uint8Array(4)),$===void 0&&($=0),_[$+0]=a>>>0,_[$+1]=a>>>8,_[$+2]=a>>>16,_[$+3]=a>>>24,_}binary.writeUint32LE=writeUint32LE;binary.writeInt32LE=writeUint32LE;function readInt64BE(a,_){_===void 0&&(_=0);var $=readInt32BE(a,_),j=readInt32BE(a,_+4);return $*4294967296+j-(j>>31)*4294967296}binary.readInt64BE=readInt64BE;function readUint64BE(a,_){_===void 0&&(_=0);var $=readUint32BE(a,_),j=readUint32BE(a,_+4);return $*4294967296+j}binary.readUint64BE=readUint64BE;function readInt64LE(a,_){_===void 0&&(_=0);var $=readInt32LE(a,_),j=readInt32LE(a,_+4);return j*4294967296+$-($>>31)*4294967296}binary.readInt64LE=readInt64LE;function readUint64LE(a,_){_===void 0&&(_=0);var $=readUint32LE(a,_),j=readUint32LE(a,_+4);return j*4294967296+$}binary.readUint64LE=readUint64LE;function writeUint64BE(a,_,$){return _===void 0&&(_=new Uint8Array(8)),$===void 0&&($=0),writeUint32BE(a/4294967296>>>0,_,$),writeUint32BE(a>>>0,_,$+4),_}binary.writeUint64BE=writeUint64BE;binary.writeInt64BE=writeUint64BE;function writeUint64LE(a,_,$){return _===void 0&&(_=new Uint8Array(8)),$===void 0&&($=0),writeUint32LE(a>>>0,_,$),writeUint32LE(a/4294967296>>>0,_,$+4),_}binary.writeUint64LE=writeUint64LE;binary.writeInt64LE=writeUint64LE;function readUintBE(a,_,$){if($===void 0&&($=0),a%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(a/8>_.length-$)throw new Error("readUintBE: array is too short for the given bitLength");for(var j=0,et=1,tt=a/8+$-1;tt>=$;tt--)j+=_[tt]*et,et*=256;return j}binary.readUintBE=readUintBE;function readUintLE(a,_,$){if($===void 0&&($=0),a%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(a/8>_.length-$)throw new Error("readUintLE: array is too short for the given bitLength");for(var j=0,et=1,tt=$;tt<$+a/8;tt++)j+=_[tt]*et,et*=256;return j}binary.readUintLE=readUintLE;function writeUintBE(a,_,$,j){if($===void 0&&($=new Uint8Array(a/8)),j===void 0&&(j=0),a%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!int_1.isSafeInteger(_))throw new Error("writeUintBE value must be an integer");for(var et=1,tt=a/8+j-1;tt>=j;tt--)$[tt]=_/et&255,et*=256;return $}binary.writeUintBE=writeUintBE;function writeUintLE(a,_,$,j){if($===void 0&&($=new Uint8Array(a/8)),j===void 0&&(j=0),a%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!int_1.isSafeInteger(_))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=ot.length,yt=256-256%ht;for(;st>0;){const wt=et(Math.ceil(st*256/yt),at);for(let Ct=0;Ct0;Ct++){const Pt=wt[Ct];Pt>16&1),zt[Ft-1]&=65535;zt[15]=Ot[15]-32767-(zt[14]>>16&1);const Bt=zt[15]>>16&1;zt[14]&=65535,nt(Ot,zt,1-Bt)}for(let It=0;It<16;It++)Lt[2*It]=Ot[It]&255,Lt[2*It+1]=Ot[It]>>8}function st(Lt,Dt){for(let zt=0;zt<16;zt++)Lt[zt]=Dt[2*zt]+(Dt[2*zt+1]<<8);Lt[15]&=32767}function ot(Lt,Dt,zt){for(let Ot=0;Ot<16;Ot++)Lt[Ot]=Dt[Ot]+zt[Ot]}function at(Lt,Dt,zt){for(let Ot=0;Ot<16;Ot++)Lt[Ot]=Dt[Ot]-zt[Ot]}function ut(Lt,Dt,zt){let Ot,It,Bt=0,Ft=0,jt=0,bt=0,vt=0,ct=0,dt=0,mt=0,xt=0,At=0,Rt=0,St=0,Tt=0,Et=0,Nt=0,tr=0,ir=0,nr=0,Zt=0,Kt=0,Qt=0,Ht=0,qt=0,Jt=0,ur=0,xr=0,pr=0,Cr=0,Mr=0,lr=0,fr=0,_r=zt[0],Sr=zt[1],kr=zt[2],Ar=zt[3],$r=zt[4],Or=zt[5],Lr=zt[6],or=zt[7],Yt=zt[8],er=zt[9],Gt=zt[10],Vt=zt[11],Wt=zt[12],ar=zt[13],yr=zt[14],Er=zt[15];Ot=Dt[0],Bt+=Ot*_r,Ft+=Ot*Sr,jt+=Ot*kr,bt+=Ot*Ar,vt+=Ot*$r,ct+=Ot*Or,dt+=Ot*Lr,mt+=Ot*or,xt+=Ot*Yt,At+=Ot*er,Rt+=Ot*Gt,St+=Ot*Vt,Tt+=Ot*Wt,Et+=Ot*ar,Nt+=Ot*yr,tr+=Ot*Er,Ot=Dt[1],Ft+=Ot*_r,jt+=Ot*Sr,bt+=Ot*kr,vt+=Ot*Ar,ct+=Ot*$r,dt+=Ot*Or,mt+=Ot*Lr,xt+=Ot*or,At+=Ot*Yt,Rt+=Ot*er,St+=Ot*Gt,Tt+=Ot*Vt,Et+=Ot*Wt,Nt+=Ot*ar,tr+=Ot*yr,ir+=Ot*Er,Ot=Dt[2],jt+=Ot*_r,bt+=Ot*Sr,vt+=Ot*kr,ct+=Ot*Ar,dt+=Ot*$r,mt+=Ot*Or,xt+=Ot*Lr,At+=Ot*or,Rt+=Ot*Yt,St+=Ot*er,Tt+=Ot*Gt,Et+=Ot*Vt,Nt+=Ot*Wt,tr+=Ot*ar,ir+=Ot*yr,nr+=Ot*Er,Ot=Dt[3],bt+=Ot*_r,vt+=Ot*Sr,ct+=Ot*kr,dt+=Ot*Ar,mt+=Ot*$r,xt+=Ot*Or,At+=Ot*Lr,Rt+=Ot*or,St+=Ot*Yt,Tt+=Ot*er,Et+=Ot*Gt,Nt+=Ot*Vt,tr+=Ot*Wt,ir+=Ot*ar,nr+=Ot*yr,Zt+=Ot*Er,Ot=Dt[4],vt+=Ot*_r,ct+=Ot*Sr,dt+=Ot*kr,mt+=Ot*Ar,xt+=Ot*$r,At+=Ot*Or,Rt+=Ot*Lr,St+=Ot*or,Tt+=Ot*Yt,Et+=Ot*er,Nt+=Ot*Gt,tr+=Ot*Vt,ir+=Ot*Wt,nr+=Ot*ar,Zt+=Ot*yr,Kt+=Ot*Er,Ot=Dt[5],ct+=Ot*_r,dt+=Ot*Sr,mt+=Ot*kr,xt+=Ot*Ar,At+=Ot*$r,Rt+=Ot*Or,St+=Ot*Lr,Tt+=Ot*or,Et+=Ot*Yt,Nt+=Ot*er,tr+=Ot*Gt,ir+=Ot*Vt,nr+=Ot*Wt,Zt+=Ot*ar,Kt+=Ot*yr,Qt+=Ot*Er,Ot=Dt[6],dt+=Ot*_r,mt+=Ot*Sr,xt+=Ot*kr,At+=Ot*Ar,Rt+=Ot*$r,St+=Ot*Or,Tt+=Ot*Lr,Et+=Ot*or,Nt+=Ot*Yt,tr+=Ot*er,ir+=Ot*Gt,nr+=Ot*Vt,Zt+=Ot*Wt,Kt+=Ot*ar,Qt+=Ot*yr,Ht+=Ot*Er,Ot=Dt[7],mt+=Ot*_r,xt+=Ot*Sr,At+=Ot*kr,Rt+=Ot*Ar,St+=Ot*$r,Tt+=Ot*Or,Et+=Ot*Lr,Nt+=Ot*or,tr+=Ot*Yt,ir+=Ot*er,nr+=Ot*Gt,Zt+=Ot*Vt,Kt+=Ot*Wt,Qt+=Ot*ar,Ht+=Ot*yr,qt+=Ot*Er,Ot=Dt[8],xt+=Ot*_r,At+=Ot*Sr,Rt+=Ot*kr,St+=Ot*Ar,Tt+=Ot*$r,Et+=Ot*Or,Nt+=Ot*Lr,tr+=Ot*or,ir+=Ot*Yt,nr+=Ot*er,Zt+=Ot*Gt,Kt+=Ot*Vt,Qt+=Ot*Wt,Ht+=Ot*ar,qt+=Ot*yr,Jt+=Ot*Er,Ot=Dt[9],At+=Ot*_r,Rt+=Ot*Sr,St+=Ot*kr,Tt+=Ot*Ar,Et+=Ot*$r,Nt+=Ot*Or,tr+=Ot*Lr,ir+=Ot*or,nr+=Ot*Yt,Zt+=Ot*er,Kt+=Ot*Gt,Qt+=Ot*Vt,Ht+=Ot*Wt,qt+=Ot*ar,Jt+=Ot*yr,ur+=Ot*Er,Ot=Dt[10],Rt+=Ot*_r,St+=Ot*Sr,Tt+=Ot*kr,Et+=Ot*Ar,Nt+=Ot*$r,tr+=Ot*Or,ir+=Ot*Lr,nr+=Ot*or,Zt+=Ot*Yt,Kt+=Ot*er,Qt+=Ot*Gt,Ht+=Ot*Vt,qt+=Ot*Wt,Jt+=Ot*ar,ur+=Ot*yr,xr+=Ot*Er,Ot=Dt[11],St+=Ot*_r,Tt+=Ot*Sr,Et+=Ot*kr,Nt+=Ot*Ar,tr+=Ot*$r,ir+=Ot*Or,nr+=Ot*Lr,Zt+=Ot*or,Kt+=Ot*Yt,Qt+=Ot*er,Ht+=Ot*Gt,qt+=Ot*Vt,Jt+=Ot*Wt,ur+=Ot*ar,xr+=Ot*yr,pr+=Ot*Er,Ot=Dt[12],Tt+=Ot*_r,Et+=Ot*Sr,Nt+=Ot*kr,tr+=Ot*Ar,ir+=Ot*$r,nr+=Ot*Or,Zt+=Ot*Lr,Kt+=Ot*or,Qt+=Ot*Yt,Ht+=Ot*er,qt+=Ot*Gt,Jt+=Ot*Vt,ur+=Ot*Wt,xr+=Ot*ar,pr+=Ot*yr,Cr+=Ot*Er,Ot=Dt[13],Et+=Ot*_r,Nt+=Ot*Sr,tr+=Ot*kr,ir+=Ot*Ar,nr+=Ot*$r,Zt+=Ot*Or,Kt+=Ot*Lr,Qt+=Ot*or,Ht+=Ot*Yt,qt+=Ot*er,Jt+=Ot*Gt,ur+=Ot*Vt,xr+=Ot*Wt,pr+=Ot*ar,Cr+=Ot*yr,Mr+=Ot*Er,Ot=Dt[14],Nt+=Ot*_r,tr+=Ot*Sr,ir+=Ot*kr,nr+=Ot*Ar,Zt+=Ot*$r,Kt+=Ot*Or,Qt+=Ot*Lr,Ht+=Ot*or,qt+=Ot*Yt,Jt+=Ot*er,ur+=Ot*Gt,xr+=Ot*Vt,pr+=Ot*Wt,Cr+=Ot*ar,Mr+=Ot*yr,lr+=Ot*Er,Ot=Dt[15],tr+=Ot*_r,ir+=Ot*Sr,nr+=Ot*kr,Zt+=Ot*Ar,Kt+=Ot*$r,Qt+=Ot*Or,Ht+=Ot*Lr,qt+=Ot*or,Jt+=Ot*Yt,ur+=Ot*er,xr+=Ot*Gt,pr+=Ot*Vt,Cr+=Ot*Wt,Mr+=Ot*ar,lr+=Ot*yr,fr+=Ot*Er,Bt+=38*ir,Ft+=38*nr,jt+=38*Zt,bt+=38*Kt,vt+=38*Qt,ct+=38*Ht,dt+=38*qt,mt+=38*Jt,xt+=38*ur,At+=38*xr,Rt+=38*pr,St+=38*Cr,Tt+=38*Mr,Et+=38*lr,Nt+=38*fr,It=1,Ot=Bt+It+65535,It=Math.floor(Ot/65536),Bt=Ot-It*65536,Ot=Ft+It+65535,It=Math.floor(Ot/65536),Ft=Ot-It*65536,Ot=jt+It+65535,It=Math.floor(Ot/65536),jt=Ot-It*65536,Ot=bt+It+65535,It=Math.floor(Ot/65536),bt=Ot-It*65536,Ot=vt+It+65535,It=Math.floor(Ot/65536),vt=Ot-It*65536,Ot=ct+It+65535,It=Math.floor(Ot/65536),ct=Ot-It*65536,Ot=dt+It+65535,It=Math.floor(Ot/65536),dt=Ot-It*65536,Ot=mt+It+65535,It=Math.floor(Ot/65536),mt=Ot-It*65536,Ot=xt+It+65535,It=Math.floor(Ot/65536),xt=Ot-It*65536,Ot=At+It+65535,It=Math.floor(Ot/65536),At=Ot-It*65536,Ot=Rt+It+65535,It=Math.floor(Ot/65536),Rt=Ot-It*65536,Ot=St+It+65535,It=Math.floor(Ot/65536),St=Ot-It*65536,Ot=Tt+It+65535,It=Math.floor(Ot/65536),Tt=Ot-It*65536,Ot=Et+It+65535,It=Math.floor(Ot/65536),Et=Ot-It*65536,Ot=Nt+It+65535,It=Math.floor(Ot/65536),Nt=Ot-It*65536,Ot=tr+It+65535,It=Math.floor(Ot/65536),tr=Ot-It*65536,Bt+=It-1+37*(It-1),It=1,Ot=Bt+It+65535,It=Math.floor(Ot/65536),Bt=Ot-It*65536,Ot=Ft+It+65535,It=Math.floor(Ot/65536),Ft=Ot-It*65536,Ot=jt+It+65535,It=Math.floor(Ot/65536),jt=Ot-It*65536,Ot=bt+It+65535,It=Math.floor(Ot/65536),bt=Ot-It*65536,Ot=vt+It+65535,It=Math.floor(Ot/65536),vt=Ot-It*65536,Ot=ct+It+65535,It=Math.floor(Ot/65536),ct=Ot-It*65536,Ot=dt+It+65535,It=Math.floor(Ot/65536),dt=Ot-It*65536,Ot=mt+It+65535,It=Math.floor(Ot/65536),mt=Ot-It*65536,Ot=xt+It+65535,It=Math.floor(Ot/65536),xt=Ot-It*65536,Ot=At+It+65535,It=Math.floor(Ot/65536),At=Ot-It*65536,Ot=Rt+It+65535,It=Math.floor(Ot/65536),Rt=Ot-It*65536,Ot=St+It+65535,It=Math.floor(Ot/65536),St=Ot-It*65536,Ot=Tt+It+65535,It=Math.floor(Ot/65536),Tt=Ot-It*65536,Ot=Et+It+65535,It=Math.floor(Ot/65536),Et=Ot-It*65536,Ot=Nt+It+65535,It=Math.floor(Ot/65536),Nt=Ot-It*65536,Ot=tr+It+65535,It=Math.floor(Ot/65536),tr=Ot-It*65536,Bt+=It-1+37*(It-1),Lt[0]=Bt,Lt[1]=Ft,Lt[2]=jt,Lt[3]=bt,Lt[4]=vt,Lt[5]=ct,Lt[6]=dt,Lt[7]=mt,Lt[8]=xt,Lt[9]=At,Lt[10]=Rt,Lt[11]=St,Lt[12]=Tt,Lt[13]=Et,Lt[14]=Nt,Lt[15]=tr}function ht(Lt,Dt){ut(Lt,Dt,Dt)}function yt(Lt,Dt){const zt=j();for(let Ot=0;Ot<16;Ot++)zt[Ot]=Dt[Ot];for(let Ot=253;Ot>=0;Ot--)ht(zt,zt),Ot!==2&&Ot!==4&&ut(zt,zt,Dt);for(let Ot=0;Ot<16;Ot++)Lt[Ot]=zt[Ot]}function wt(Lt,Dt){const zt=new Uint8Array(32),Ot=new Float64Array(80),It=j(),Bt=j(),Ft=j(),jt=j(),bt=j(),vt=j();for(let xt=0;xt<31;xt++)zt[xt]=Lt[xt];zt[31]=Lt[31]&127|64,zt[0]&=248,st(Ot,Dt);for(let xt=0;xt<16;xt++)Bt[xt]=Ot[xt];It[0]=jt[0]=1;for(let xt=254;xt>=0;--xt){const At=zt[xt>>>3]>>>(xt&7)&1;nt(It,Bt,At),nt(Ft,jt,At),ot(bt,It,Ft),at(It,It,Ft),ot(Ft,Bt,jt),at(Bt,Bt,jt),ht(jt,bt),ht(vt,It),ut(It,Ft,It),ut(Ft,Bt,bt),ot(bt,It,Ft),at(It,It,Ft),ht(Bt,It),at(Ft,jt,vt),ut(It,Ft,tt),ot(It,It,jt),ut(Ft,Ft,It),ut(It,jt,vt),ut(jt,Bt,Ot),ht(Bt,bt),nt(It,Bt,At),nt(Ft,jt,At)}for(let xt=0;xt<16;xt++)Ot[xt+16]=It[xt],Ot[xt+32]=Ft[xt],Ot[xt+48]=Bt[xt],Ot[xt+64]=jt[xt];const ct=Ot.subarray(32),dt=Ot.subarray(16);yt(ct,ct),ut(dt,dt,ct);const mt=new Uint8Array(32);return it(mt,dt),mt}a.scalarMult=wt;function Ct(Lt){return wt(Lt,et)}a.scalarMultBase=Ct;function Pt(Lt){if(Lt.length!==a.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${a.SECRET_KEY_LENGTH} bytes`);const Dt=new Uint8Array(Lt);return{publicKey:Ct(Dt),secretKey:Dt}}a.generateKeyPairFromSeed=Pt;function $t(Lt){const Dt=(0,_.randomBytes)(32,Lt),zt=Pt(Dt);return(0,$.wipe)(Dt),zt}a.generateKeyPair=$t;function Mt(Lt,Dt,zt=!1){if(Lt.length!==a.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(Dt.length!==a.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const Ot=wt(Lt,Dt);if(zt){let It=0;for(let Bt=0;Bt>>25,Rt=Ot+Mt|0,jt^=Rt<<9|Rt>>>23,Rt=jt+Ot|0,dt^=Rt<<13|Rt>>>19,Rt=dt+jt|0,Mt^=Rt<<18|Rt>>>14,Rt=It+Lt|0,bt^=Rt<<7|Rt>>>25,Rt=bt+It|0,mt^=Rt<<9|Rt>>>23,Rt=mt+bt|0,Lt^=Rt<<13|Rt>>>19,Rt=Lt+mt|0,It^=Rt<<18|Rt>>>14,Rt=vt+Bt|0,xt^=Rt<<7|Rt>>>25,Rt=xt+vt|0,Dt^=Rt<<9|Rt>>>23,Rt=Dt+xt|0,Bt^=Rt<<13|Rt>>>19,Rt=Bt+Dt|0,vt^=Rt<<18|Rt>>>14,Rt=At+ct|0,zt^=Rt<<7|Rt>>>25,Rt=zt+At|0,Ft^=Rt<<9|Rt>>>23,Rt=Ft+zt|0,ct^=Rt<<13|Rt>>>19,Rt=ct+Ft|0,At^=Rt<<18|Rt>>>14,Rt=Mt+zt|0,Lt^=Rt<<7|Rt>>>25,Rt=Lt+Mt|0,Dt^=Rt<<9|Rt>>>23,Rt=Dt+Lt|0,zt^=Rt<<13|Rt>>>19,Rt=zt+Dt|0,Mt^=Rt<<18|Rt>>>14,Rt=It+Ot|0,Bt^=Rt<<7|Rt>>>25,Rt=Bt+It|0,Ft^=Rt<<9|Rt>>>23,Rt=Ft+Bt|0,Ot^=Rt<<13|Rt>>>19,Rt=Ot+Ft|0,It^=Rt<<18|Rt>>>14,Rt=vt+bt|0,ct^=Rt<<7|Rt>>>25,Rt=ct+vt|0,jt^=Rt<<9|Rt>>>23,Rt=jt+ct|0,bt^=Rt<<13|Rt>>>19,Rt=bt+jt|0,vt^=Rt<<18|Rt>>>14,Rt=At+xt|0,dt^=Rt<<7|Rt>>>25,Rt=dt+At|0,mt^=Rt<<9|Rt>>>23,Rt=mt+dt|0,xt^=Rt<<13|Rt>>>19,Rt=xt+mt|0,At^=Rt<<18|Rt>>>14;binary_1$1.writeUint32LE(Mt+j|0,a,0),binary_1$1.writeUint32LE(Lt+et|0,a,4),binary_1$1.writeUint32LE(Dt+tt|0,a,8),binary_1$1.writeUint32LE(zt+rt|0,a,12),binary_1$1.writeUint32LE(Ot+nt|0,a,16),binary_1$1.writeUint32LE(It+it|0,a,20),binary_1$1.writeUint32LE(Bt+st|0,a,24),binary_1$1.writeUint32LE(Ft+ot|0,a,28),binary_1$1.writeUint32LE(jt+at|0,a,32),binary_1$1.writeUint32LE(bt+ut|0,a,36),binary_1$1.writeUint32LE(vt+ht|0,a,40),binary_1$1.writeUint32LE(ct+yt|0,a,44),binary_1$1.writeUint32LE(dt+wt|0,a,48),binary_1$1.writeUint32LE(mt+Ct|0,a,52),binary_1$1.writeUint32LE(xt+Pt|0,a,56),binary_1$1.writeUint32LE(At+$t|0,a,60)}function streamXOR$1(a,_,$,j,et){if(et===void 0&&(et=0),a.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(_.length!==8)throw new Error("Salsa20 nonce must be 8 bytes");tt=new Uint8Array(16),tt.set(_),rt=_.length}else{if(_.length!==16)throw new Error("Salsa20 nonce with counter must be 16 bytes");tt=_,rt=16-et}for(var nt=new Uint8Array(64),it=0;it<$.length;it+=64){core(nt,tt,a);for(var st=it;st>>=8,_++;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(_.length!==24)throw new Error("XSalsa20 nonce must be 24 bytes")}else if(_.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,_.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=a[3]<<24|a[2]<<16|a[1]<<8|a[0],tt=a[7]<<24|a[6]<<16|a[5]<<8|a[4],rt=a[11]<<24|a[10]<<16|a[9]<<8|a[8],nt=a[15]<<24|a[14]<<16|a[13]<<8|a[12],it=857760878,st=_[3]<<24|_[2]<<16|_[1]<<8|_[0],ot=_[7]<<24|_[6]<<16|_[5]<<8|_[4],at=_[11]<<24|_[10]<<16|_[9]<<8|_[8],ut=_[15]<<24|_[14]<<16|_[13]<<8|_[12],ht=2036477234,yt=a[19]<<24|a[18]<<16|a[17]<<8|a[16],wt=a[23]<<24|a[22]<<16|a[21]<<8|a[20],Ct=a[27]<<24|a[26]<<16|a[25]<<8|a[24],Pt=a[31]<<24|a[30]<<16|a[29]<<8|a[28],$t=1797285236,Mt,Lt=0;Lt>>25,Mt=nt+j|0,at^=Mt<<9|Mt>>>23,Mt=at+nt|0,wt^=Mt<<13|Mt>>>19,Mt=wt+at|0,j^=Mt<<18|Mt>>>14,Mt=it+et|0,ut^=Mt<<7|Mt>>>25,Mt=ut+it|0,Ct^=Mt<<9|Mt>>>23,Mt=Ct+ut|0,et^=Mt<<13|Mt>>>19,Mt=et+Ct|0,it^=Mt<<18|Mt>>>14,Mt=ht+st|0,Pt^=Mt<<7|Mt>>>25,Mt=Pt+ht|0,tt^=Mt<<9|Mt>>>23,Mt=tt+Pt|0,st^=Mt<<13|Mt>>>19,Mt=st+tt|0,ht^=Mt<<18|Mt>>>14,Mt=$t+yt|0,rt^=Mt<<7|Mt>>>25,Mt=rt+$t|0,ot^=Mt<<9|Mt>>>23,Mt=ot+rt|0,yt^=Mt<<13|Mt>>>19,Mt=yt+ot|0,$t^=Mt<<18|Mt>>>14,Mt=j+rt|0,et^=Mt<<7|Mt>>>25,Mt=et+j|0,tt^=Mt<<9|Mt>>>23,Mt=tt+et|0,rt^=Mt<<13|Mt>>>19,Mt=rt+tt|0,j^=Mt<<18|Mt>>>14,Mt=it+nt|0,st^=Mt<<7|Mt>>>25,Mt=st+it|0,ot^=Mt<<9|Mt>>>23,Mt=ot+st|0,nt^=Mt<<13|Mt>>>19,Mt=nt+ot|0,it^=Mt<<18|Mt>>>14,Mt=ht+ut|0,yt^=Mt<<7|Mt>>>25,Mt=yt+ht|0,at^=Mt<<9|Mt>>>23,Mt=at+yt|0,ut^=Mt<<13|Mt>>>19,Mt=ut+at|0,ht^=Mt<<18|Mt>>>14,Mt=$t+Pt|0,wt^=Mt<<7|Mt>>>25,Mt=wt+$t|0,Ct^=Mt<<9|Mt>>>23,Mt=Ct+wt|0,Pt^=Mt<<13|Mt>>>19,Mt=Pt+Ct|0,$t^=Mt<<18|Mt>>>14;return binary_1.writeUint32LE(j,$,0),binary_1.writeUint32LE(it,$,4),binary_1.writeUint32LE(ht,$,8),binary_1.writeUint32LE($t,$,12),binary_1.writeUint32LE(st,$,16),binary_1.writeUint32LE(ot,$,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~(a-1)&_|a-1&$}constantTime.select=select;function lessOrEqual(a,_){return(a|0)-(_|0)-1>>>31&1}constantTime.lessOrEqual=lessOrEqual;function compare$d(a,_){if(a.length!==_.length)return 0;for(var $=0,j=0;j>>8}constantTime.compare=compare$d;function equal(a,_){return a.length===0||_.length===0?!1:compare$d(a,_)!==0}constantTime.equal=equal;(function(a){Object.defineProperty(a,"__esModule",{value:!0});var _=constantTime,$=wipe$1;a.DIGEST_LENGTH=16;var j=function(){function rt(nt){this.digestLength=a.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 st=nt[2]|nt[3]<<8;this._r[1]=(it>>>13|st<<3)&8191;var ot=nt[4]|nt[5]<<8;this._r[2]=(st>>>10|ot<<6)&7939;var at=nt[6]|nt[7]<<8;this._r[3]=(ot>>>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 yt=nt[12]|nt[13]<<8;this._r[7]=(ht>>>11|yt<<5)&8065;var wt=nt[14]|nt[15]<<8;this._r[8]=(yt>>>8|wt<<8)&8191,this._r[9]=wt>>>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,st){for(var ot=this._fin?0:2048,at=this._h[0],ut=this._h[1],ht=this._h[2],yt=this._h[3],wt=this._h[4],Ct=this._h[5],Pt=this._h[6],$t=this._h[7],Mt=this._h[8],Lt=this._h[9],Dt=this._r[0],zt=this._r[1],Ot=this._r[2],It=this._r[3],Bt=this._r[4],Ft=this._r[5],jt=this._r[6],bt=this._r[7],vt=this._r[8],ct=this._r[9];st>=16;){var dt=nt[it+0]|nt[it+1]<<8;at+=dt&8191;var mt=nt[it+2]|nt[it+3]<<8;ut+=(dt>>>13|mt<<3)&8191;var xt=nt[it+4]|nt[it+5]<<8;ht+=(mt>>>10|xt<<6)&8191;var At=nt[it+6]|nt[it+7]<<8;yt+=(xt>>>7|At<<9)&8191;var Rt=nt[it+8]|nt[it+9]<<8;wt+=(At>>>4|Rt<<12)&8191,Ct+=Rt>>>1&8191;var St=nt[it+10]|nt[it+11]<<8;Pt+=(Rt>>>14|St<<2)&8191;var Tt=nt[it+12]|nt[it+13]<<8;$t+=(St>>>11|Tt<<5)&8191;var Et=nt[it+14]|nt[it+15]<<8;Mt+=(Tt>>>8|Et<<8)&8191,Lt+=Et>>>5|ot;var Nt=0,tr=Nt;tr+=at*Dt,tr+=ut*(5*ct),tr+=ht*(5*vt),tr+=yt*(5*bt),tr+=wt*(5*jt),Nt=tr>>>13,tr&=8191,tr+=Ct*(5*Ft),tr+=Pt*(5*Bt),tr+=$t*(5*It),tr+=Mt*(5*Ot),tr+=Lt*(5*zt),Nt+=tr>>>13,tr&=8191;var ir=Nt;ir+=at*zt,ir+=ut*Dt,ir+=ht*(5*ct),ir+=yt*(5*vt),ir+=wt*(5*bt),Nt=ir>>>13,ir&=8191,ir+=Ct*(5*jt),ir+=Pt*(5*Ft),ir+=$t*(5*Bt),ir+=Mt*(5*It),ir+=Lt*(5*Ot),Nt+=ir>>>13,ir&=8191;var nr=Nt;nr+=at*Ot,nr+=ut*zt,nr+=ht*Dt,nr+=yt*(5*ct),nr+=wt*(5*vt),Nt=nr>>>13,nr&=8191,nr+=Ct*(5*bt),nr+=Pt*(5*jt),nr+=$t*(5*Ft),nr+=Mt*(5*Bt),nr+=Lt*(5*It),Nt+=nr>>>13,nr&=8191;var Zt=Nt;Zt+=at*It,Zt+=ut*Ot,Zt+=ht*zt,Zt+=yt*Dt,Zt+=wt*(5*ct),Nt=Zt>>>13,Zt&=8191,Zt+=Ct*(5*vt),Zt+=Pt*(5*bt),Zt+=$t*(5*jt),Zt+=Mt*(5*Ft),Zt+=Lt*(5*Bt),Nt+=Zt>>>13,Zt&=8191;var Kt=Nt;Kt+=at*Bt,Kt+=ut*It,Kt+=ht*Ot,Kt+=yt*zt,Kt+=wt*Dt,Nt=Kt>>>13,Kt&=8191,Kt+=Ct*(5*ct),Kt+=Pt*(5*vt),Kt+=$t*(5*bt),Kt+=Mt*(5*jt),Kt+=Lt*(5*Ft),Nt+=Kt>>>13,Kt&=8191;var Qt=Nt;Qt+=at*Ft,Qt+=ut*Bt,Qt+=ht*It,Qt+=yt*Ot,Qt+=wt*zt,Nt=Qt>>>13,Qt&=8191,Qt+=Ct*Dt,Qt+=Pt*(5*ct),Qt+=$t*(5*vt),Qt+=Mt*(5*bt),Qt+=Lt*(5*jt),Nt+=Qt>>>13,Qt&=8191;var Ht=Nt;Ht+=at*jt,Ht+=ut*Ft,Ht+=ht*Bt,Ht+=yt*It,Ht+=wt*Ot,Nt=Ht>>>13,Ht&=8191,Ht+=Ct*zt,Ht+=Pt*Dt,Ht+=$t*(5*ct),Ht+=Mt*(5*vt),Ht+=Lt*(5*bt),Nt+=Ht>>>13,Ht&=8191;var qt=Nt;qt+=at*bt,qt+=ut*jt,qt+=ht*Ft,qt+=yt*Bt,qt+=wt*It,Nt=qt>>>13,qt&=8191,qt+=Ct*Ot,qt+=Pt*zt,qt+=$t*Dt,qt+=Mt*(5*ct),qt+=Lt*(5*vt),Nt+=qt>>>13,qt&=8191;var Jt=Nt;Jt+=at*vt,Jt+=ut*bt,Jt+=ht*jt,Jt+=yt*Ft,Jt+=wt*Bt,Nt=Jt>>>13,Jt&=8191,Jt+=Ct*It,Jt+=Pt*Ot,Jt+=$t*zt,Jt+=Mt*Dt,Jt+=Lt*(5*ct),Nt+=Jt>>>13,Jt&=8191;var ur=Nt;ur+=at*ct,ur+=ut*vt,ur+=ht*bt,ur+=yt*jt,ur+=wt*Ft,Nt=ur>>>13,ur&=8191,ur+=Ct*Bt,ur+=Pt*It,ur+=$t*Ot,ur+=Mt*zt,ur+=Lt*Dt,Nt+=ur>>>13,ur&=8191,Nt=(Nt<<2)+Nt|0,Nt=Nt+tr|0,tr=Nt&8191,Nt=Nt>>>13,ir+=Nt,at=tr,ut=ir,ht=nr,yt=Zt,wt=Kt,Ct=Qt,Pt=Ht,$t=qt,Mt=Jt,Lt=ur,it+=16,st-=16}this._h[0]=at,this._h[1]=ut,this._h[2]=ht,this._h[3]=yt,this._h[4]=wt,this._h[5]=Ct,this._h[6]=Pt,this._h[7]=$t,this._h[8]=Mt,this._h[9]=Lt},rt.prototype.finish=function(nt,it){it===void 0&&(it=0);var st=new Uint16Array(10),ot,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(ot=this._h[1]>>>13,this._h[1]&=8191,ht=2;ht<10;ht++)this._h[ht]+=ot,ot=this._h[ht]>>>13,this._h[ht]&=8191;for(this._h[0]+=ot*5,ot=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=ot,ot=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=ot,st[0]=this._h[0]+5,ot=st[0]>>>13,st[0]&=8191,ht=1;ht<10;ht++)st[ht]=this._h[ht]+ot,ot=st[ht]>>>13,st[ht]&=8191;for(st[9]-=8192,at=(ot^1)-1,ht=0;ht<10;ht++)st[ht]&=at;for(at=~at,ht=0;ht<10;ht++)this._h[ht]=this._h[ht]&at|st[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,st=nt.length,ot;if(this._leftover){ot=16-this._leftover,ot>st&&(ot=st);for(var at=0;at=16&&(ot=st-st%16,this._blocks(nt,it,ot),it+=ot,st-=ot),st){for(var at=0;at32&&(0,xsalsa20_1.streamXOR)(a,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)(a,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(a){return(0,random_1.randomBytes)(32,a)}secretbox.generateKey=generateKey;(function(a){Object.defineProperty(a,"__esModule",{value:!0}),a.openBox=a.box=a.precomputeSharedKey=a.generateKeyPair=void 0;const _=x25519,$=xsalsa20,j=secretbox,et=wipe$1;var tt=x25519;Object.defineProperty(a,"generateKeyPair",{enumerable:!0,get:function(){return tt.generateKeyPair}});const rt=new Uint8Array(16);function nt(ot,at){const ut=(0,_.scalarMult)(at,ot);return(0,$.hsalsa)(ut,rt,ut),ut}a.precomputeSharedKey=nt;function it(ot,at,ut,ht){const yt=nt(ot,at),wt=(0,j.secretBox)(yt,ut,ht);return(0,et.wipe)(yt),wt}a.box=it;function st(ot,at,ut,ht){const yt=nt(ot,at),wt=(0,j.openSecretBox)(yt,ut,ht);return(0,et.wipe)(yt),wt}a.openBox=st})(box);(function(a){var _=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)&&_(et,j,tt)};Object.defineProperty(a,"__esModule",{value:!0}),$(box,a),$(secretbox,a)})(nacl);var utf8={};Object.defineProperty(utf8,"__esModule",{value:!0});var INVALID_UTF16="utf8: invalid string",INVALID_UTF8="utf8: invalid source encoding";function encode$7(a){for(var _=new Uint8Array(encodedLength(a)),$=0,j=0;j>6,_[$++]=128|et&63):et<55296?(_[$++]=224|et>>12,_[$++]=128|et>>6&63,_[$++]=128|et&63):(j++,et=(et&1023)<<10,et|=a.charCodeAt(j)&1023,et+=65536,_[$++]=240|et>>18,_[$++]=128|et>>12&63,_[$++]=128|et>>6&63,_[$++]=128|et&63)}return _}var encode_1=utf8.encode=encode$7;function encodedLength(a){for(var _=0,$=0;$=a.length-1)throw new Error(INVALID_UTF16);$++,_+=4}else throw new Error(INVALID_UTF16)}return _}utf8.encodedLength=encodedLength;function decode$3(a){for(var _=[],$=0;$=a.length)throw new Error(INVALID_UTF8);var tt=a[++$];if((tt&192)!==128)throw new Error(INVALID_UTF8);j=(j&31)<<6|tt&63,et=128}else if(j<240){if($>=a.length-1)throw new Error(INVALID_UTF8);var tt=a[++$],rt=a[++$];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($>=a.length-2)throw new Error(INVALID_UTF8);var tt=a[++$],rt=a[++$],nt=a[++$];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,_.push(String.fromCharCode(55296|j>>10)),j=56320|j&1023}}_.push(String.fromCharCode(j))}return _.join("")}utf8.decode=decode$3;var blake2b$1={};(function(a){Object.defineProperty(a,"__esModule",{value:!0});var _=binary,$=wipe$1;a.BLOCK_SIZE=128,a.DIGEST_LENGTH=64,a.KEY_LENGTH=64,a.PERSONALIZATION_LENGTH=16,a.SALT_LENGTH=16,a.MAX_LEAF_SIZE=Math.pow(2,32)-1,a.MAX_FANOUT=255,a.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,st){if(it===void 0&&(it=64),this.digestLength=it,this.blockSize=a.BLOCK_SIZE,this._state=new Int32Array(j),this._buffer=new Uint8Array(a.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>a.DIGEST_LENGTH)throw new Error("blake2b: wrong digest length");st&&this.validateConfig(st);var ot=0;st&&st.key&&(ot=st.key.length);var at=1,ut=1;st&&st.tree&&(at=st.tree.fanout,ut=st.tree.maxDepth),this._state[0]^=it|ot<<8|at<<16|ut<<24,st&&st.tree&&(this._state[1]^=st.tree.leafSize,this._state[2]^=st.tree.nodeOffsetLowBits,this._state[3]^=st.tree.nodeOffsetHighBits,this._state[4]^=st.tree.nodeDepth|st.tree.innerDigestLength<<8,this._lastNode=st.tree.lastNode),st&&st.salt&&(this._state[8]^=_.readUint32LE(st.salt,0),this._state[9]^=_.readUint32LE(st.salt,4),this._state[10]^=_.readUint32LE(st.salt,8),this._state[11]^=_.readUint32LE(st.salt,12)),st&&st.personalization&&(this._state[12]^=_.readUint32LE(st.personalization,0),this._state[13]^=_.readUint32LE(st.personalization,4),this._state[14]^=_.readUint32LE(st.personalization,8),this._state[15]^=_.readUint32LE(st.personalization,12)),this._initialState=new Uint32Array(this._state),st&&st.key&&ot>0&&(this._paddedKey=new Uint8Array(a.BLOCK_SIZE),this._paddedKey.set(st.key),this._buffer.set(this._paddedKey),this._bufferLength=a.BLOCK_SIZE)}return nt.prototype.reset=function(){return this._state.set(this._initialState),this._paddedKey?(this._buffer.set(this._paddedKey),this._bufferLength=a.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>a.KEY_LENGTH)throw new Error("blake2b: wrong key length");if(it.salt&&it.salt.length!==a.SALT_LENGTH)throw new Error("blake2b: wrong salt length");if(it.personalization&&it.personalization.length!==a.PERSONALIZATION_LENGTH)throw new Error("blake2b: wrong personalization length");if(it.tree){if(it.tree.fanout<0||it.tree.fanout>a.MAX_FANOUT)throw new Error("blake2b: wrong tree fanout");if(it.tree.maxDepth<0||it.tree.maxDepth>a.MAX_MAX_DEPTH)throw new Error("blake2b: wrong tree depth");if(it.tree.leafSize<0||it.tree.leafSize>a.MAX_LEAF_SIZE)throw new Error("blake2b: wrong leaf size");if(it.tree.innerDigestLength<0||it.tree.innerDigestLength>a.DIGEST_LENGTH)throw new Error("blake2b: wrong tree inner digest length")}},nt.prototype.update=function(it,st){if(st===void 0&&(st=it.length),this._finished)throw new Error("blake2b: can't update because hash was finished.");var ot=a.BLOCK_SIZE-this._bufferLength,at=0;if(st===0)return this;if(st>ot){for(var ut=0;uta.BLOCK_SIZE;){for(var ut=0;ut>>16,dt=zt&65535,mt=zt>>>16;vt+=Ot&65535,ct+=Ot>>>16,dt+=It&65535,mt+=It>>>16,ct+=vt>>>16,dt+=ct>>>16,mt+=dt>>>16,zt=dt&65535|mt<<16,Dt=vt&65535|ct<<16,vt=Dt&65535,ct=Dt>>>16,dt=zt&65535,mt=zt>>>16,vt+=Pt&65535,ct+=Pt>>>16,dt+=$t&65535,mt+=$t>>>16,ct+=vt>>>16,dt+=ct>>>16,mt+=dt>>>16,zt=dt&65535|mt<<16,Dt=vt&65535|ct<<16,jt^=Dt,bt^=zt,vt=bt,bt=jt,jt=vt,vt=Bt&65535,ct=Bt>>>16,dt=Ft&65535,mt=Ft>>>16,vt+=jt&65535,ct+=jt>>>16,dt+=bt&65535,mt+=bt>>>16,ct+=vt>>>16,dt+=ct>>>16,mt+=dt>>>16,Ft=dt&65535|mt<<16,Bt=vt&65535|ct<<16,Ot^=Bt,It^=Ft,vt=Ot<<8|It>>>24,Ot=It<<8|Ot>>>24,It=vt,vt=Dt&65535,ct=Dt>>>16,dt=zt&65535,mt=zt>>>16,vt+=Ot&65535,ct+=Ot>>>16,dt+=It&65535,mt+=It>>>16,ct+=vt>>>16,dt+=ct>>>16,mt+=dt>>>16,zt=dt&65535|mt<<16,Dt=vt&65535|ct<<16,vt=Dt&65535,ct=Dt>>>16,dt=zt&65535,mt=zt>>>16,vt+=Mt&65535,ct+=Mt>>>16,dt+=Lt&65535,mt+=Lt>>>16,ct+=vt>>>16,dt+=ct>>>16,mt+=dt>>>16,zt=dt&65535|mt<<16,Dt=vt&65535|ct<<16,jt^=Dt,bt^=zt,vt=jt<<16|bt>>>16,jt=bt<<16|jt>>>16,bt=vt,vt=Bt&65535,ct=Bt>>>16,dt=Ft&65535,mt=Ft>>>16,vt+=jt&65535,ct+=jt>>>16,dt+=bt&65535,mt+=bt>>>16,ct+=vt>>>16,dt+=ct>>>16,mt+=dt>>>16,Ft=dt&65535|mt<<16,Bt=vt&65535|ct<<16,Ot^=Bt,It^=Ft,vt=It<<1|Ot>>>31,Ot=Ot<<1|It>>>31,It=vt,it[st]=Dt,it[ht]=zt,it[ot]=Ot,it[yt]=It,it[at]=Bt,it[wt]=Ft,it[ut]=jt,it[Ct]=bt},nt.prototype._incrementCounter=function(it){for(var st=0;st<3;st++){var ot=this._ctr[st]+it;if(this._ctr[st]=ot>>>0,this._ctr[st]===ot)return;it=1}},nt.prototype._processBlock=function(it){this._incrementCounter(it);var st=this._vtmp;st.set(this._state),st.set(j,16),st[12*2+0]^=this._ctr[0],st[12*2+1]^=this._ctr[1],st[13*2+0]^=this._ctr[2],st[13*2+1]^=this._ctr[3],st[14*2+0]^=this._flag[0],st[14*2+1]^=this._flag[1],st[15*2+0]^=this._flag[2],st[15*2+1]^=this._flag[3];for(var ot=this._mtmp,at=0;at<32;at++)ot[at]=_.readUint32LE(this._buffer,at*4);for(var ut=0;ut<12;ut++)this._G(st,0,8,16,24,1,9,17,25,ot[et[ut][0]],ot[et[ut][0]+1],ot[et[ut][1]],ot[et[ut][1]+1]),this._G(st,2,10,18,26,3,11,19,27,ot[et[ut][2]],ot[et[ut][2]+1],ot[et[ut][3]],ot[et[ut][3]+1]),this._G(st,4,12,20,28,5,13,21,29,ot[et[ut][4]],ot[et[ut][4]+1],ot[et[ut][5]],ot[et[ut][5]+1]),this._G(st,6,14,22,30,7,15,23,31,ot[et[ut][6]],ot[et[ut][6]+1],ot[et[ut][7]],ot[et[ut][7]+1]),this._G(st,0,10,20,30,1,11,21,31,ot[et[ut][8]],ot[et[ut][8]+1],ot[et[ut][9]],ot[et[ut][9]+1]),this._G(st,2,12,22,24,3,13,23,25,ot[et[ut][10]],ot[et[ut][10]+1],ot[et[ut][11]],ot[et[ut][11]+1]),this._G(st,4,14,16,26,5,15,17,27,ot[et[ut][12]],ot[et[ut][12]+1],ot[et[ut][13]],ot[et[ut][13]+1]),this._G(st,6,8,18,28,7,9,19,29,ot[et[ut][14]],ot[et[ut][14]+1],ot[et[ut][15]],ot[et[ut][15]+1]);for(var at=0;at<16;at++)this._state[at]^=st[at]^st[at+16]},nt}();a.BLAKE2b=tt;function rt(nt,it,st){it===void 0&&(it=a.DIGEST_LENGTH);var ot=new tt(it,st);ot.update(nt);var at=ot.digest();return ot.clean(),at}a.hash=rt})(blake2b$1);var ed25519={},sha512$2={};(function(a){Object.defineProperty(a,"__esModule",{value:!0});var _=binary,$=wipe$1;a.DIGEST_LENGTH=64,a.BLOCK_SIZE=128;var j=function(){function nt(){this.digestLength=a.DIGEST_LENGTH,this.blockSize=a.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,st){if(st===void 0&&(st=it.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var ot=0;if(this._bytesHashed+=st,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=it[ot++],st--;this._bufferLength===this.blockSize&&(tt(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(st>=this.blockSize&&(ot=tt(this._tempHi,this._tempLo,this._stateHi,this._stateLo,it,ot,st),st%=this.blockSize);st>0;)this._buffer[this._bufferLength++]=it[ot++],st--;return this},nt.prototype.finish=function(it){if(!this._finished){var st=this._bytesHashed,ot=this._bufferLength,at=st/536870912|0,ut=st<<3,ht=st%128<112?128:256;this._buffer[ot]=128;for(var yt=ot+1;yt0?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}();a.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,st,ot,at,ut,ht){for(var yt=st[0],wt=st[1],Ct=st[2],Pt=st[3],$t=st[4],Mt=st[5],Lt=st[6],Dt=st[7],zt=ot[0],Ot=ot[1],It=ot[2],Bt=ot[3],Ft=ot[4],jt=ot[5],bt=ot[6],vt=ot[7],ct,dt,mt,xt,At,Rt,St,Tt;ht>=128;){for(var Et=0;Et<16;Et++){var Nt=8*Et+ut;nt[Et]=_.readUint32BE(at,Nt),it[Et]=_.readUint32BE(at,Nt+4)}for(var Et=0;Et<80;Et++){var tr=yt,ir=wt,nr=Ct,Zt=Pt,Kt=$t,Qt=Mt,Ht=Lt,qt=Dt,Jt=zt,ur=Ot,xr=It,pr=Bt,Cr=Ft,Mr=jt,lr=bt,fr=vt;if(ct=Dt,dt=vt,At=dt&65535,Rt=dt>>>16,St=ct&65535,Tt=ct>>>16,ct=($t>>>14|Ft<<18)^($t>>>18|Ft<<14)^(Ft>>>9|$t<<23),dt=(Ft>>>14|$t<<18)^(Ft>>>18|$t<<14)^($t>>>9|Ft<<23),At+=dt&65535,Rt+=dt>>>16,St+=ct&65535,Tt+=ct>>>16,ct=$t&Mt^~$t&Lt,dt=Ft&jt^~Ft&bt,At+=dt&65535,Rt+=dt>>>16,St+=ct&65535,Tt+=ct>>>16,ct=et[Et*2],dt=et[Et*2+1],At+=dt&65535,Rt+=dt>>>16,St+=ct&65535,Tt+=ct>>>16,ct=nt[Et%16],dt=it[Et%16],At+=dt&65535,Rt+=dt>>>16,St+=ct&65535,Tt+=ct>>>16,Rt+=At>>>16,St+=Rt>>>16,Tt+=St>>>16,mt=St&65535|Tt<<16,xt=At&65535|Rt<<16,ct=mt,dt=xt,At=dt&65535,Rt=dt>>>16,St=ct&65535,Tt=ct>>>16,ct=(yt>>>28|zt<<4)^(zt>>>2|yt<<30)^(zt>>>7|yt<<25),dt=(zt>>>28|yt<<4)^(yt>>>2|zt<<30)^(yt>>>7|zt<<25),At+=dt&65535,Rt+=dt>>>16,St+=ct&65535,Tt+=ct>>>16,ct=yt&wt^yt&Ct^wt&Ct,dt=zt&Ot^zt&It^Ot&It,At+=dt&65535,Rt+=dt>>>16,St+=ct&65535,Tt+=ct>>>16,Rt+=At>>>16,St+=Rt>>>16,Tt+=St>>>16,qt=St&65535|Tt<<16,fr=At&65535|Rt<<16,ct=Zt,dt=pr,At=dt&65535,Rt=dt>>>16,St=ct&65535,Tt=ct>>>16,ct=mt,dt=xt,At+=dt&65535,Rt+=dt>>>16,St+=ct&65535,Tt+=ct>>>16,Rt+=At>>>16,St+=Rt>>>16,Tt+=St>>>16,Zt=St&65535|Tt<<16,pr=At&65535|Rt<<16,wt=tr,Ct=ir,Pt=nr,$t=Zt,Mt=Kt,Lt=Qt,Dt=Ht,yt=qt,Ot=Jt,It=ur,Bt=xr,Ft=pr,jt=Cr,bt=Mr,vt=lr,zt=fr,Et%16===15)for(var Nt=0;Nt<16;Nt++)ct=nt[Nt],dt=it[Nt],At=dt&65535,Rt=dt>>>16,St=ct&65535,Tt=ct>>>16,ct=nt[(Nt+9)%16],dt=it[(Nt+9)%16],At+=dt&65535,Rt+=dt>>>16,St+=ct&65535,Tt+=ct>>>16,mt=nt[(Nt+1)%16],xt=it[(Nt+1)%16],ct=(mt>>>1|xt<<31)^(mt>>>8|xt<<24)^mt>>>7,dt=(xt>>>1|mt<<31)^(xt>>>8|mt<<24)^(xt>>>7|mt<<25),At+=dt&65535,Rt+=dt>>>16,St+=ct&65535,Tt+=ct>>>16,mt=nt[(Nt+14)%16],xt=it[(Nt+14)%16],ct=(mt>>>19|xt<<13)^(xt>>>29|mt<<3)^mt>>>6,dt=(xt>>>19|mt<<13)^(mt>>>29|xt<<3)^(xt>>>6|mt<<26),At+=dt&65535,Rt+=dt>>>16,St+=ct&65535,Tt+=ct>>>16,Rt+=At>>>16,St+=Rt>>>16,Tt+=St>>>16,nt[Nt]=St&65535|Tt<<16,it[Nt]=At&65535|Rt<<16}ct=yt,dt=zt,At=dt&65535,Rt=dt>>>16,St=ct&65535,Tt=ct>>>16,ct=st[0],dt=ot[0],At+=dt&65535,Rt+=dt>>>16,St+=ct&65535,Tt+=ct>>>16,Rt+=At>>>16,St+=Rt>>>16,Tt+=St>>>16,st[0]=yt=St&65535|Tt<<16,ot[0]=zt=At&65535|Rt<<16,ct=wt,dt=Ot,At=dt&65535,Rt=dt>>>16,St=ct&65535,Tt=ct>>>16,ct=st[1],dt=ot[1],At+=dt&65535,Rt+=dt>>>16,St+=ct&65535,Tt+=ct>>>16,Rt+=At>>>16,St+=Rt>>>16,Tt+=St>>>16,st[1]=wt=St&65535|Tt<<16,ot[1]=Ot=At&65535|Rt<<16,ct=Ct,dt=It,At=dt&65535,Rt=dt>>>16,St=ct&65535,Tt=ct>>>16,ct=st[2],dt=ot[2],At+=dt&65535,Rt+=dt>>>16,St+=ct&65535,Tt+=ct>>>16,Rt+=At>>>16,St+=Rt>>>16,Tt+=St>>>16,st[2]=Ct=St&65535|Tt<<16,ot[2]=It=At&65535|Rt<<16,ct=Pt,dt=Bt,At=dt&65535,Rt=dt>>>16,St=ct&65535,Tt=ct>>>16,ct=st[3],dt=ot[3],At+=dt&65535,Rt+=dt>>>16,St+=ct&65535,Tt+=ct>>>16,Rt+=At>>>16,St+=Rt>>>16,Tt+=St>>>16,st[3]=Pt=St&65535|Tt<<16,ot[3]=Bt=At&65535|Rt<<16,ct=$t,dt=Ft,At=dt&65535,Rt=dt>>>16,St=ct&65535,Tt=ct>>>16,ct=st[4],dt=ot[4],At+=dt&65535,Rt+=dt>>>16,St+=ct&65535,Tt+=ct>>>16,Rt+=At>>>16,St+=Rt>>>16,Tt+=St>>>16,st[4]=$t=St&65535|Tt<<16,ot[4]=Ft=At&65535|Rt<<16,ct=Mt,dt=jt,At=dt&65535,Rt=dt>>>16,St=ct&65535,Tt=ct>>>16,ct=st[5],dt=ot[5],At+=dt&65535,Rt+=dt>>>16,St+=ct&65535,Tt+=ct>>>16,Rt+=At>>>16,St+=Rt>>>16,Tt+=St>>>16,st[5]=Mt=St&65535|Tt<<16,ot[5]=jt=At&65535|Rt<<16,ct=Lt,dt=bt,At=dt&65535,Rt=dt>>>16,St=ct&65535,Tt=ct>>>16,ct=st[6],dt=ot[6],At+=dt&65535,Rt+=dt>>>16,St+=ct&65535,Tt+=ct>>>16,Rt+=At>>>16,St+=Rt>>>16,Tt+=St>>>16,st[6]=Lt=St&65535|Tt<<16,ot[6]=bt=At&65535|Rt<<16,ct=Dt,dt=vt,At=dt&65535,Rt=dt>>>16,St=ct&65535,Tt=ct>>>16,ct=st[7],dt=ot[7],At+=dt&65535,Rt+=dt>>>16,St+=ct&65535,Tt+=ct>>>16,Rt+=At>>>16,St+=Rt>>>16,Tt+=St>>>16,st[7]=Dt=St&65535|Tt<<16,ot[7]=vt=At&65535|Rt<<16,ut+=128,ht-=128}return ut}function rt(nt){var it=new j;it.update(nt);var st=it.digest();return it.clean(),st}a.hash=rt})(sha512$2);(function(a){Object.defineProperty(a,"__esModule",{value:!0}),a.convertSecretKeyToX25519=a.convertPublicKeyToX25519=a.verify=a.sign=a.extractPublicKeyFromSecretKey=a.generateKeyPair=a.generateKeyPairFromSeed=a.SEED_LENGTH=a.SECRET_KEY_LENGTH=a.PUBLIC_KEY_LENGTH=a.SIGNATURE_LENGTH=void 0;const _=random,$=sha512$2,j=wipe$1;a.SIGNATURE_LENGTH=64,a.PUBLIC_KEY_LENGTH=32,a.SECRET_KEY_LENGTH=64,a.SEED_LENGTH=32;function et(Zt){const Kt=new Float64Array(16);if(Zt)for(let Qt=0;Qt>16&1),Qt[ur-1]&=65535;Qt[15]=Ht[15]-32767-(Qt[14]>>16&1);const Jt=Qt[15]>>16&1;Qt[14]&=65535,wt(Ht,Qt,1-Jt)}for(let qt=0;qt<16;qt++)Zt[2*qt]=Ht[qt]&255,Zt[2*qt+1]=Ht[qt]>>8}function Pt(Zt,Kt){let Qt=0;for(let Ht=0;Ht<32;Ht++)Qt|=Zt[Ht]^Kt[Ht];return(1&Qt-1>>>8)-1}function $t(Zt,Kt){const Qt=new Uint8Array(32),Ht=new Uint8Array(32);return Ct(Qt,Zt),Ct(Ht,Kt),Pt(Qt,Ht)}function Mt(Zt){const Kt=new Uint8Array(32);return Ct(Kt,Zt),Kt[0]&1}function Lt(Zt,Kt){for(let Qt=0;Qt<16;Qt++)Zt[Qt]=Kt[2*Qt]+(Kt[2*Qt+1]<<8);Zt[15]&=32767}function Dt(Zt,Kt,Qt){for(let Ht=0;Ht<16;Ht++)Zt[Ht]=Kt[Ht]+Qt[Ht]}function zt(Zt,Kt,Qt){for(let Ht=0;Ht<16;Ht++)Zt[Ht]=Kt[Ht]-Qt[Ht]}function Ot(Zt,Kt,Qt){let Ht,qt,Jt=0,ur=0,xr=0,pr=0,Cr=0,Mr=0,lr=0,fr=0,_r=0,Sr=0,kr=0,Ar=0,$r=0,Or=0,Lr=0,or=0,Yt=0,er=0,Gt=0,Vt=0,Wt=0,ar=0,yr=0,Er=0,Rr=0,Wr=0,Hr=0,Fr=0,pn=0,Jr=0,Qr=0,mn=Qt[0],ln=Qt[1],qr=Qt[2],En=Qt[3],un=Qt[4],Vr=Qt[5],hn=Qt[6],fn=Qt[7],Kr=Qt[8],Rn=Qt[9],dn=Qt[10],Gr=Qt[11],gn=Qt[12],an=Qt[13],Zr=Qt[14],An=Qt[15];Ht=Kt[0],Jt+=Ht*mn,ur+=Ht*ln,xr+=Ht*qr,pr+=Ht*En,Cr+=Ht*un,Mr+=Ht*Vr,lr+=Ht*hn,fr+=Ht*fn,_r+=Ht*Kr,Sr+=Ht*Rn,kr+=Ht*dn,Ar+=Ht*Gr,$r+=Ht*gn,Or+=Ht*an,Lr+=Ht*Zr,or+=Ht*An,Ht=Kt[1],ur+=Ht*mn,xr+=Ht*ln,pr+=Ht*qr,Cr+=Ht*En,Mr+=Ht*un,lr+=Ht*Vr,fr+=Ht*hn,_r+=Ht*fn,Sr+=Ht*Kr,kr+=Ht*Rn,Ar+=Ht*dn,$r+=Ht*Gr,Or+=Ht*gn,Lr+=Ht*an,or+=Ht*Zr,Yt+=Ht*An,Ht=Kt[2],xr+=Ht*mn,pr+=Ht*ln,Cr+=Ht*qr,Mr+=Ht*En,lr+=Ht*un,fr+=Ht*Vr,_r+=Ht*hn,Sr+=Ht*fn,kr+=Ht*Kr,Ar+=Ht*Rn,$r+=Ht*dn,Or+=Ht*Gr,Lr+=Ht*gn,or+=Ht*an,Yt+=Ht*Zr,er+=Ht*An,Ht=Kt[3],pr+=Ht*mn,Cr+=Ht*ln,Mr+=Ht*qr,lr+=Ht*En,fr+=Ht*un,_r+=Ht*Vr,Sr+=Ht*hn,kr+=Ht*fn,Ar+=Ht*Kr,$r+=Ht*Rn,Or+=Ht*dn,Lr+=Ht*Gr,or+=Ht*gn,Yt+=Ht*an,er+=Ht*Zr,Gt+=Ht*An,Ht=Kt[4],Cr+=Ht*mn,Mr+=Ht*ln,lr+=Ht*qr,fr+=Ht*En,_r+=Ht*un,Sr+=Ht*Vr,kr+=Ht*hn,Ar+=Ht*fn,$r+=Ht*Kr,Or+=Ht*Rn,Lr+=Ht*dn,or+=Ht*Gr,Yt+=Ht*gn,er+=Ht*an,Gt+=Ht*Zr,Vt+=Ht*An,Ht=Kt[5],Mr+=Ht*mn,lr+=Ht*ln,fr+=Ht*qr,_r+=Ht*En,Sr+=Ht*un,kr+=Ht*Vr,Ar+=Ht*hn,$r+=Ht*fn,Or+=Ht*Kr,Lr+=Ht*Rn,or+=Ht*dn,Yt+=Ht*Gr,er+=Ht*gn,Gt+=Ht*an,Vt+=Ht*Zr,Wt+=Ht*An,Ht=Kt[6],lr+=Ht*mn,fr+=Ht*ln,_r+=Ht*qr,Sr+=Ht*En,kr+=Ht*un,Ar+=Ht*Vr,$r+=Ht*hn,Or+=Ht*fn,Lr+=Ht*Kr,or+=Ht*Rn,Yt+=Ht*dn,er+=Ht*Gr,Gt+=Ht*gn,Vt+=Ht*an,Wt+=Ht*Zr,ar+=Ht*An,Ht=Kt[7],fr+=Ht*mn,_r+=Ht*ln,Sr+=Ht*qr,kr+=Ht*En,Ar+=Ht*un,$r+=Ht*Vr,Or+=Ht*hn,Lr+=Ht*fn,or+=Ht*Kr,Yt+=Ht*Rn,er+=Ht*dn,Gt+=Ht*Gr,Vt+=Ht*gn,Wt+=Ht*an,ar+=Ht*Zr,yr+=Ht*An,Ht=Kt[8],_r+=Ht*mn,Sr+=Ht*ln,kr+=Ht*qr,Ar+=Ht*En,$r+=Ht*un,Or+=Ht*Vr,Lr+=Ht*hn,or+=Ht*fn,Yt+=Ht*Kr,er+=Ht*Rn,Gt+=Ht*dn,Vt+=Ht*Gr,Wt+=Ht*gn,ar+=Ht*an,yr+=Ht*Zr,Er+=Ht*An,Ht=Kt[9],Sr+=Ht*mn,kr+=Ht*ln,Ar+=Ht*qr,$r+=Ht*En,Or+=Ht*un,Lr+=Ht*Vr,or+=Ht*hn,Yt+=Ht*fn,er+=Ht*Kr,Gt+=Ht*Rn,Vt+=Ht*dn,Wt+=Ht*Gr,ar+=Ht*gn,yr+=Ht*an,Er+=Ht*Zr,Rr+=Ht*An,Ht=Kt[10],kr+=Ht*mn,Ar+=Ht*ln,$r+=Ht*qr,Or+=Ht*En,Lr+=Ht*un,or+=Ht*Vr,Yt+=Ht*hn,er+=Ht*fn,Gt+=Ht*Kr,Vt+=Ht*Rn,Wt+=Ht*dn,ar+=Ht*Gr,yr+=Ht*gn,Er+=Ht*an,Rr+=Ht*Zr,Wr+=Ht*An,Ht=Kt[11],Ar+=Ht*mn,$r+=Ht*ln,Or+=Ht*qr,Lr+=Ht*En,or+=Ht*un,Yt+=Ht*Vr,er+=Ht*hn,Gt+=Ht*fn,Vt+=Ht*Kr,Wt+=Ht*Rn,ar+=Ht*dn,yr+=Ht*Gr,Er+=Ht*gn,Rr+=Ht*an,Wr+=Ht*Zr,Hr+=Ht*An,Ht=Kt[12],$r+=Ht*mn,Or+=Ht*ln,Lr+=Ht*qr,or+=Ht*En,Yt+=Ht*un,er+=Ht*Vr,Gt+=Ht*hn,Vt+=Ht*fn,Wt+=Ht*Kr,ar+=Ht*Rn,yr+=Ht*dn,Er+=Ht*Gr,Rr+=Ht*gn,Wr+=Ht*an,Hr+=Ht*Zr,Fr+=Ht*An,Ht=Kt[13],Or+=Ht*mn,Lr+=Ht*ln,or+=Ht*qr,Yt+=Ht*En,er+=Ht*un,Gt+=Ht*Vr,Vt+=Ht*hn,Wt+=Ht*fn,ar+=Ht*Kr,yr+=Ht*Rn,Er+=Ht*dn,Rr+=Ht*Gr,Wr+=Ht*gn,Hr+=Ht*an,Fr+=Ht*Zr,pn+=Ht*An,Ht=Kt[14],Lr+=Ht*mn,or+=Ht*ln,Yt+=Ht*qr,er+=Ht*En,Gt+=Ht*un,Vt+=Ht*Vr,Wt+=Ht*hn,ar+=Ht*fn,yr+=Ht*Kr,Er+=Ht*Rn,Rr+=Ht*dn,Wr+=Ht*Gr,Hr+=Ht*gn,Fr+=Ht*an,pn+=Ht*Zr,Jr+=Ht*An,Ht=Kt[15],or+=Ht*mn,Yt+=Ht*ln,er+=Ht*qr,Gt+=Ht*En,Vt+=Ht*un,Wt+=Ht*Vr,ar+=Ht*hn,yr+=Ht*fn,Er+=Ht*Kr,Rr+=Ht*Rn,Wr+=Ht*dn,Hr+=Ht*Gr,Fr+=Ht*gn,pn+=Ht*an,Jr+=Ht*Zr,Qr+=Ht*An,Jt+=38*Yt,ur+=38*er,xr+=38*Gt,pr+=38*Vt,Cr+=38*Wt,Mr+=38*ar,lr+=38*yr,fr+=38*Er,_r+=38*Rr,Sr+=38*Wr,kr+=38*Hr,Ar+=38*Fr,$r+=38*pn,Or+=38*Jr,Lr+=38*Qr,qt=1,Ht=Jt+qt+65535,qt=Math.floor(Ht/65536),Jt=Ht-qt*65536,Ht=ur+qt+65535,qt=Math.floor(Ht/65536),ur=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=Cr+qt+65535,qt=Math.floor(Ht/65536),Cr=Ht-qt*65536,Ht=Mr+qt+65535,qt=Math.floor(Ht/65536),Mr=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=_r+qt+65535,qt=Math.floor(Ht/65536),_r=Ht-qt*65536,Ht=Sr+qt+65535,qt=Math.floor(Ht/65536),Sr=Ht-qt*65536,Ht=kr+qt+65535,qt=Math.floor(Ht/65536),kr=Ht-qt*65536,Ht=Ar+qt+65535,qt=Math.floor(Ht/65536),Ar=Ht-qt*65536,Ht=$r+qt+65535,qt=Math.floor(Ht/65536),$r=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,Jt+=qt-1+37*(qt-1),qt=1,Ht=Jt+qt+65535,qt=Math.floor(Ht/65536),Jt=Ht-qt*65536,Ht=ur+qt+65535,qt=Math.floor(Ht/65536),ur=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=Cr+qt+65535,qt=Math.floor(Ht/65536),Cr=Ht-qt*65536,Ht=Mr+qt+65535,qt=Math.floor(Ht/65536),Mr=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=_r+qt+65535,qt=Math.floor(Ht/65536),_r=Ht-qt*65536,Ht=Sr+qt+65535,qt=Math.floor(Ht/65536),Sr=Ht-qt*65536,Ht=kr+qt+65535,qt=Math.floor(Ht/65536),kr=Ht-qt*65536,Ht=Ar+qt+65535,qt=Math.floor(Ht/65536),Ar=Ht-qt*65536,Ht=$r+qt+65535,qt=Math.floor(Ht/65536),$r=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,Jt+=qt-1+37*(qt-1),Zt[0]=Jt,Zt[1]=ur,Zt[2]=xr,Zt[3]=pr,Zt[4]=Cr,Zt[5]=Mr,Zt[6]=lr,Zt[7]=fr,Zt[8]=_r,Zt[9]=Sr,Zt[10]=kr,Zt[11]=Ar,Zt[12]=$r,Zt[13]=Or,Zt[14]=Lr,Zt[15]=or}function It(Zt,Kt){Ot(Zt,Kt,Kt)}function Bt(Zt,Kt){const Qt=et();let Ht;for(Ht=0;Ht<16;Ht++)Qt[Ht]=Kt[Ht];for(Ht=253;Ht>=0;Ht--)It(Qt,Qt),Ht!==2&&Ht!==4&&Ot(Qt,Qt,Kt);for(Ht=0;Ht<16;Ht++)Zt[Ht]=Qt[Ht]}function Ft(Zt,Kt){const Qt=et();let Ht;for(Ht=0;Ht<16;Ht++)Qt[Ht]=Kt[Ht];for(Ht=250;Ht>=0;Ht--)It(Qt,Qt),Ht!==1&&Ot(Qt,Qt,Kt);for(Ht=0;Ht<16;Ht++)Zt[Ht]=Qt[Ht]}function jt(Zt,Kt){const Qt=et(),Ht=et(),qt=et(),Jt=et(),ur=et(),xr=et(),pr=et(),Cr=et(),Mr=et();zt(Qt,Zt[1],Zt[0]),zt(Mr,Kt[1],Kt[0]),Ot(Qt,Qt,Mr),Dt(Ht,Zt[0],Zt[1]),Dt(Mr,Kt[0],Kt[1]),Ot(Ht,Ht,Mr),Ot(qt,Zt[3],Kt[3]),Ot(qt,qt,st),Ot(Jt,Zt[2],Kt[2]),Dt(Jt,Jt,Jt),zt(ur,Ht,Qt),zt(xr,Jt,qt),Dt(pr,Jt,qt),Dt(Cr,Ht,Qt),Ot(Zt[0],ur,xr),Ot(Zt[1],Cr,pr),Ot(Zt[2],pr,xr),Ot(Zt[3],ur,Cr)}function bt(Zt,Kt,Qt){for(let Ht=0;Ht<4;Ht++)wt(Zt[Ht],Kt[Ht],Qt)}function vt(Zt,Kt){const Qt=et(),Ht=et(),qt=et();Bt(qt,Kt[2]),Ot(Qt,Kt[0],qt),Ot(Ht,Kt[1],qt),Ct(Zt,Ht),Zt[31]^=Mt(Qt)<<7}function ct(Zt,Kt,Qt){ht(Zt[0],rt),ht(Zt[1],nt),ht(Zt[2],nt),ht(Zt[3],rt);for(let Ht=255;Ht>=0;--Ht){const qt=Qt[Ht/8|0]>>(Ht&7)&1;bt(Zt,Kt,qt),jt(Kt,Zt),jt(Zt,Zt),bt(Zt,Kt,qt)}}function dt(Zt,Kt){const Qt=[et(),et(),et(),et()];ht(Qt[0],ot),ht(Qt[1],at),ht(Qt[2],nt),Ot(Qt[3],ot,at),ct(Zt,Qt,Kt)}function mt(Zt){if(Zt.length!==a.SEED_LENGTH)throw new Error(`ed25519: seed must be ${a.SEED_LENGTH} bytes`);const Kt=(0,$.hash)(Zt);Kt[0]&=248,Kt[31]&=127,Kt[31]|=64;const Qt=new Uint8Array(32),Ht=[et(),et(),et(),et()];dt(Ht,Kt),vt(Qt,Ht);const qt=new Uint8Array(64);return qt.set(Zt),qt.set(Qt,32),{publicKey:Qt,secretKey:qt}}a.generateKeyPairFromSeed=mt;function xt(Zt){const Kt=(0,_.randomBytes)(32,Zt),Qt=mt(Kt);return(0,j.wipe)(Kt),Qt}a.generateKeyPair=xt;function At(Zt){if(Zt.length!==a.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${a.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(Zt.subarray(32))}a.extractPublicKeyFromSecretKey=At;const Rt=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 St(Zt,Kt){let Qt,Ht,qt,Jt;for(Ht=63;Ht>=32;--Ht){for(Qt=0,qt=Ht-32,Jt=Ht-12;qt>4)*Rt[qt],Qt=Kt[qt]>>8,Kt[qt]&=255;for(qt=0;qt<32;qt++)Kt[qt]-=Qt*Rt[qt];for(Ht=0;Ht<32;Ht++)Kt[Ht+1]+=Kt[Ht]>>8,Zt[Ht]=Kt[Ht]&255}function Tt(Zt){const Kt=new Float64Array(64);for(let Qt=0;Qt<64;Qt++)Kt[Qt]=Zt[Qt];for(let Qt=0;Qt<64;Qt++)Zt[Qt]=0;St(Zt,Kt)}function Et(Zt,Kt){const Qt=new Float64Array(64),Ht=[et(),et(),et(),et()],qt=(0,$.hash)(Zt.subarray(0,32));qt[0]&=248,qt[31]&=127,qt[31]|=64;const Jt=new Uint8Array(64);Jt.set(qt.subarray(32),32);const ur=new $.SHA512;ur.update(Jt.subarray(32)),ur.update(Kt);const xr=ur.digest();ur.clean(),Tt(xr),dt(Ht,xr),vt(Jt,Ht),ur.reset(),ur.update(Jt.subarray(0,32)),ur.update(Zt.subarray(32)),ur.update(Kt);const pr=ur.digest();Tt(pr);for(let Cr=0;Cr<32;Cr++)Qt[Cr]=xr[Cr];for(let Cr=0;Cr<32;Cr++)for(let Mr=0;Mr<32;Mr++)Qt[Cr+Mr]+=pr[Cr]*qt[Mr];return St(Jt.subarray(32),Qt),Jt}a.sign=Et;function Nt(Zt,Kt){const Qt=et(),Ht=et(),qt=et(),Jt=et(),ur=et(),xr=et(),pr=et();return ht(Zt[2],nt),Lt(Zt[1],Kt),It(qt,Zt[1]),Ot(Jt,qt,it),zt(qt,qt,Zt[2]),Dt(Jt,Zt[2],Jt),It(ur,Jt),It(xr,ur),Ot(pr,xr,ur),Ot(Qt,pr,qt),Ot(Qt,Qt,Jt),Ft(Qt,Qt),Ot(Qt,Qt,qt),Ot(Qt,Qt,Jt),Ot(Qt,Qt,Jt),Ot(Zt[0],Qt,Jt),It(Ht,Zt[0]),Ot(Ht,Ht,Jt),$t(Ht,qt)&&Ot(Zt[0],Zt[0],ut),It(Ht,Zt[0]),Ot(Ht,Ht,Jt),$t(Ht,qt)?-1:(Mt(Zt[0])===Kt[31]>>7&&zt(Zt[0],rt,Zt[0]),Ot(Zt[3],Zt[0],Zt[1]),0)}function tr(Zt,Kt,Qt){const Ht=new Uint8Array(32),qt=[et(),et(),et(),et()],Jt=[et(),et(),et(),et()];if(Qt.length!==a.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${a.SIGNATURE_LENGTH} bytes`);if(Nt(Jt,Zt))return!1;const ur=new $.SHA512;ur.update(Qt.subarray(0,32)),ur.update(Zt),ur.update(Kt);const xr=ur.digest();return Tt(xr),ct(qt,Jt,xr),dt(Jt,Qt.subarray(32)),jt(qt,Jt),vt(Ht,qt),!Pt(Qt,Ht)}a.verify=tr;function ir(Zt){let Kt=[et(),et(),et(),et()];if(Nt(Kt,Zt))throw new Error("Ed25519: invalid public key");let Qt=et(),Ht=et(),qt=Kt[1];Dt(Qt,nt,qt),zt(Ht,nt,qt),Bt(Ht,Ht),Ot(Qt,Qt,Ht);let Jt=new Uint8Array(32);return Ct(Jt,Qt),Jt}a.convertPublicKeyToX25519=ir;function nr(Zt){const Kt=(0,$.hash)(Zt.subarray(0,32));Kt[0]&=248,Kt[31]&=127,Kt[31]|=64;const Qt=new Uint8Array(Kt.subarray(0,32));return(0,j.wipe)(Kt),Qt}a.convertSecretKeyToX25519=nr})(ed25519);var bytes$1={};Object.defineProperty(bytes$1,"__esModule",{value:!0});function concat$1(){for(var a=0,_=0;_{if(!["tz1","tz2","tz3","tz4","KT1","txr1","sr1"].some($=>a.toLowerCase().startsWith($.toLowerCase())))return!1;try{bs58check$2.decode(a)}catch{return!1}return!0};async function generateGUID(){const a=random.randomBytes(16);return[a.slice(0,4),a.slice(4,6),a.slice(6,8),a.slice(8,10),a.slice(10,16)].map(function(_){return Buffer$g.from(_).toString("hex")}).join("-")}const CONTRACT_PREFIX="KT1",secretbox_NONCEBYTES=24,secretbox_MACBYTES=16;var BeaconMessageType;(function(a){a.BlockchainRequest="blockchain_request",a.PermissionRequest="permission_request",a.SignPayloadRequest="sign_payload_request",a.OperationRequest="operation_request",a.BroadcastRequest="broadcast_request",a.ChangeAccountRequest="change_account_request",a.BlockchainResponse="blockchain_response",a.PermissionResponse="permission_response",a.SignPayloadResponse="sign_payload_response",a.ProofOfEventChallengeRequest="proof_of_event_challenge_request",a.ProofOfEventChallengeResponse="proof_of_event_challenge_response",a.SimulatedProofOfEventChallengeRequest="simulated_proof_of_event_challenge_request",a.SimulatedProofOfEventChallengeResponse="simulated_proof_of_event_challenge_response",a.OperationResponse="operation_response",a.BroadcastResponse="broadcast_response",a.Acknowledge="acknowledge",a.Disconnect="disconnect",a.Error="error"})(BeaconMessageType||(BeaconMessageType={}));var PermissionScope;(function(a){a.SIGN="sign",a.OPERATION_REQUEST="operation_request",a.ENCRYPT="encrypt",a.NOTIFICATION="notification",a.THRESHOLD="threshold"})(PermissionScope||(PermissionScope={}));var NetworkType;(function(a){a.MAINNET="mainnet",a.GHOSTNET="ghostnet",a.WEEKLYNET="weeklynet",a.DAILYNET="dailynet",a.DELPHINET="delphinet",a.EDONET="edonet",a.FLORENCENET="florencenet",a.GRANADANET="granadanet",a.HANGZHOUNET="hangzhounet",a.ITHACANET="ithacanet",a.JAKARTANET="jakartanet",a.KATHMANDUNET="kathmandunet",a.LIMANET="limanet",a.MUMBAINET="mumbainet",a.NAIROBINET="nairobinet",a.OXFORDNET="oxfordnet",a.PARISNET="parisnet",a.CUSTOM="custom"})(NetworkType||(NetworkType={}));var TezosOperationType;(function(a){a.ORIGINATION="origination",a.DELEGATION="delegation",a.REVEAL="reveal",a.TRANSACTION="transaction",a.ACTIVATE_ACCOUNT="activate_account",a.ENDORSEMENT="endorsement",a.SEED_NONCE_REVELATION="seed_nonce_revelation",a.DOUBLE_ENDORSEMENT_EVIDENCE="double_endorsement_evidence",a.DOUBLE_BAKING_EVIDENCE="double_baking_evidence",a.PROPOSALS="proposals",a.BALLOT="ballot",a.ATTESTATION="attestation",a.PREATTESTATION="preattestation",a.PREENDORSEMENT="preendorsement",a.SET_DEPOSITS_LIMIT="set_deposits_limit",a.DOUBLE_PREATTESTATION_EVIDENCE="double_preattestation_evidence",a.DOUBLE_PREENDORSEMENT_EVIDENCE="double_preendorsement_evidence",a.ATTESTATION_WITH_SLOT="attestation_with_slot",a.ENDORSEMENT_WITH_SLOT="endorsement_with_slot",a.DOUBLE_ATTESTATION_EVIDENCE="double_attestation_evidence",a.FAILING_NOOP="failing_noop",a.REGISTER_GLOBAL_CONSTANT="register_global_constant",a.TRANSFER_TICKET="transfer_ticket",a.INCREASE_PAID_STORAGE="increase_paid_storage",a.UPDATE_CONSENSUS_KEY="update_consensus_key",a.DRAIN_DELEGATE="drain_delegate",a.VDF_REVELATION="vdf_revelation",a.EVENT="event",a.TICKET_UPDATES="ticket_updates",a.SMART_ROLLUP_ORIGINATE="smart_rollup_originate",a.SMART_ROLLUP_ADD_MESSAGES="smart_rollup_add_messages",a.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE="smart_rollup_execute_outbox_message",a.SMART_ROLLUP_PUBLISH="smart_rollup_publish",a.SMART_ROLLUP_CEMENT="smart_rollup_cement",a.SMART_ROLLUP_RECOVER_BOND="smart_rollup_recover_bond",a.SMART_ROLLUP_REFUTE="smart_rollup_refute",a.SMART_ROLLUP_TIMEOUT="smart_rollup_timeout",a.DAL_PUBLISH_COMMITMENT="dal_publish_commitment"})(TezosOperationType||(TezosOperationType={}));var Origin;(function(a){a.WEBSITE="website",a.EXTENSION="extension",a.P2P="p2p",a.WALLETCONNECT="walletconnect"})(Origin||(Origin={}));var ExtensionMessageTarget;(function(a){a.BACKGROUND="toBackground",a.PAGE="toPage",a.EXTENSION="toExtension"})(ExtensionMessageTarget||(ExtensionMessageTarget={}));var BeaconErrorType;(function(a){a.BROADCAST_ERROR="BROADCAST_ERROR",a.NETWORK_NOT_SUPPORTED="NETWORK_NOT_SUPPORTED",a.NO_ADDRESS_ERROR="NO_ADDRESS_ERROR",a.NO_PRIVATE_KEY_FOUND_ERROR="NO_PRIVATE_KEY_FOUND_ERROR",a.NOT_GRANTED_ERROR="NOT_GRANTED_ERROR",a.PARAMETERS_INVALID_ERROR="PARAMETERS_INVALID_ERROR",a.TOO_MANY_OPERATIONS="TOO_MANY_OPERATIONS",a.TRANSACTION_INVALID_ERROR="TRANSACTION_INVALID_ERROR",a.SIGNATURE_TYPE_NOT_SUPPORTED="SIGNATURE_TYPE_NOT_SUPPORTED",a.ABORTED_ERROR="ABORTED_ERROR",a.UNKNOWN_ERROR="UNKNOWN_ERROR"})(BeaconErrorType||(BeaconErrorType={}));var TransportStatus;(function(a){a.NOT_CONNECTED="NOT_CONNECTED",a.CONNECTING="CONNECTING",a.CONNECTED="CONNECTED"})(TransportStatus||(TransportStatus={}));var TransportType;(function(a){a.CHROME_MESSAGE="chrome_message",a.WALLETCONNECT="walletconnect",a.POST_MESSAGE="post_message",a.LEDGER="ledger",a.P2P="p2p"})(TransportType||(TransportType={}));class Storage{static isSupported(){return Promise.resolve(!1)}}var StorageKey;(function(a){a.TRANSPORT_P2P_PEERS_DAPP="beacon:communication-peers-dapp",a.TRANSPORT_P2P_PEERS_WALLET="beacon:communication-peers-wallet",a.TRANSPORT_POSTMESSAGE_PEERS_DAPP="beacon:postmessage-peers-dapp",a.TRANSPORT_POSTMESSAGE_PEERS_WALLET="beacon:postmessage-peers-wallet",a.TRANSPORT_WALLETCONNECT_PEERS_DAPP="beacon:walletconnect-peers-dapp",a.LAST_SELECTED_WALLET="beacon:last-selected-wallet",a.ACCOUNTS="beacon:accounts",a.ACTIVE_ACCOUNT="beacon:active-account",a.PUSH_TOKENS="beacon:push-tokens",a.BEACON_SDK_SECRET_SEED="beacon:sdk-secret-seed",a.APP_METADATA_LIST="beacon:app-metadata-list",a.PERMISSION_LIST="beacon:permissions",a.ONGOING_PROOF_OF_EVENT_CHALLENGES="beacon:ongoing-proof-of-event-challenges",a.BEACON_SDK_VERSION="beacon:sdk_version",a.MATRIX_PRESERVED_STATE="beacon:sdk-matrix-preserved-state",a.MATRIX_PEER_ROOM_IDS="beacon:matrix-peer-rooms",a.MATRIX_SELECTED_NODE="beacon:matrix-selected-node",a.MULTI_NODE_SETUP_DONE="beacon:multi-node-setup",a.USER_ID="beacon:user-id",a.ENABLE_METRICS="beacon:enable_metrics",a.WC_2_CORE_PAIRING="wc@2:core:0.3:pairing",a.WC_2_CLIENT_SESSION="wc@2:client:0.3:session",a.WC_2_CORE_KEYCHAIN="wc@2:core:0.3:keychain",a.WC_2_CORE_MESSAGES="wc@2:core:0.3:messages",a.WC_2_CLIENT_PROPOSAL="wc@2:client:0.3:proposal",a.WC_2_CORE_SUBSCRIPTION="wc@2:core:0.3:subscription",a.WC_2_CORE_HISTORY="wc@2:core:0.3:history",a.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(_,$,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=_,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,st){super($,j,et,tt,rt,it,st);Yr(this,"senderId");this.senderId=nt}}var SigningType;(function(a){a.RAW="raw",a.OPERATION="operation",a.MICHELINE="micheline"})(SigningType||(SigningType={}));class P2PPairingResponse{constructor(_,$,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=_,this.name=$,this.icon=rt,this.appUrl=nt,this.publicKey=j,this.version=et,this.relayServer=tt}}class PostMessagePairingRequest{constructor(_,$,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=_,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(_,$,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=_,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,st){super($,j,et,tt,nt,it,st);Yr(this,"senderId");this.senderId=rt}}var ColorMode;(function(a){a.LIGHT="light",a.DARK="dark"})(ColorMode||(ColorMode={}));var Regions;(function(a){a.EUROPE_EAST="europe-east",a.EUROPE_WEST="europe-west",a.NORTH_AMERICA_EAST="north-america-east",a.NORTH_AMERICA_WEST="north-america-west",a.CENTRAL_AMERICA="central-america",a.SOUTH_AMERICA="south-america",a.ASIA_EAST="asia-east",a.ASIA_WEST="asia-west",a.AFRICA="africa",a.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=[a=>{}];let windowRef={postMessage:(a,_)=>{console.log("GOT MOCK POST MESSAGE",a),cbs.forEach($=>{$({data:a})})},addEventListener:(a,_)=>{cbs.push(_)},removeEventListener:(a,_)=>{cbs.splice(cbs.indexOf($=>$===_),1)},location:{origin:"*"}};try{typeof window<"u"&&(windowRef=window)}catch(a){console.log(`not defined: ${a}`)}class MockAnalytics{track(_,$,j,et){}}class BeaconClient{constructor(_){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(!_.name)throw new Error("Name not set");if(!_.storage)throw new Error("Storage not set");this.name=_.name,this.iconUrl=_.iconUrl,this.appUrl=_.appUrl??windowRef.location.origin,this.storage=_.storage,this.analytics=_.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(_=>{this._beaconId.resolve(toHex$1(_.publicKey))})}async removeBeaconEntriesFromStorage(){const _=Object.values(StorageKey);await Promise.all(_.map($=>this.storage.delete($)))}async loadOrCreateBeaconSecret(){const _=await this.storage.get(StorageKey.BEACON_SDK_SECRET_SEED);if(_&&typeof _=="string")this._keyPair.resolve(await getKeypairFromSeed(_));else{const $=await generateGUID();await this.storage.set(StorageKey.BEACON_SDK_SECRET_SEED,$),this._keyPair.resolve(await getKeypairFromSeed($))}}}function fixArrayType(a){return a}class StorageManager{constructor(_,$){Yr(this,"storage");Yr(this,"storageKey");this.storage=_,this.storageKey=$}async getAll(){return await this.storage.get(this.storageKey)??[]}async getOne(_){const $=await this.storage.get(this.storageKey);return $.find(_)}async addOne(_,$,j=!0){const et=await this.storage.get(this.storageKey);if(!et.some($))et.push(_);else if(j)for(let tt=0;tt!_(et));return this.storage.set(this.storageKey,j)}async removeAll(){return this.storage.delete(this.storageKey)}}const getAccountIdentifier=async(a,_)=>{const $=[a,_.type];_.name&&$.push(`name:${_.name}`),_.rpcUrl&&$.push(`rpc:${_.rpcUrl}`);const j=Buffer$g.from(blake2b$1.hash(encode_1($.join("-")),10));return bs58check$2.encode(j)};class PermissionValidator{static async hasPermission(_,$,j){switch(_.type){case BeaconMessageType.PermissionRequest:case BeaconMessageType.BroadcastRequest:return!0;case BeaconMessageType.OperationRequest:{const et=await getAccountIdentifier(_.sourceAddress,_.network),tt=await $(et);return tt?tt.scopes.includes(PermissionScope.OPERATION_REQUEST):!1}case BeaconMessageType.SignPayloadRequest:{const tt=(await j()).filter(rt=>rt.address===_.sourceAddress);return tt.length===0?!1:tt.some(rt=>rt.scopes.includes(PermissionScope.SIGN))}default:throw new Error("Message not handled")}}}class AccountManager{constructor(_){Yr(this,"storageManager");this.storageManager=new StorageManager(_,StorageKey.ACCOUNTS)}async getAccounts(){return await this.storageManager.getAll()??[]}async getAccount(_){return this.storageManager.getOne($=>$.accountIdentifier===_)}async addAccount(_){return this.storageManager.addOne(_,$=>$.accountIdentifier===_.accountIdentifier)}async updateAccount(_,$){const j=await this.getAccount(_);if(!j)return;const et={...j,...$};return await this.storageManager.addOne(et,tt=>tt.accountIdentifier===_,!0),et}async removeAccount(_){return this.storageManager.remove($=>$.accountIdentifier===_)}async removeAccounts(_){return this.storageManager.remove($=>_.includes($.accountIdentifier))}async removeAllAccounts(){return this.storageManager.removeAll()}async hasPermission(_){return PermissionValidator.hasPermission(_,this.getAccount.bind(this),this.getAccounts.bind(this))}}const isHex$1=a=>/^[A-F0-9]+$/i.test(a),getSenderId=async a=>{isHex$1(a)||console.error("PublicKey needs to be in hex format!");const _=Buffer$g.from(blake2b$1.hash(Buffer$g.from(a,"hex"),5));return bs58check$2.encode(_)};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(_,$,...j){this._log("debug",_,$,j)}log(_,$,...j){this._log("log",_,$,j)}warn(_,$,...j){this._log("warn",_,$,j)}error(_,$,...j){this._log("error",_,$,j)}time(_,$){_?console.time($):console.timeEnd($)}timeLog(_,$,...j){this._log("timeLog",_,$,j)}_log(_,$,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)),_){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(_){Yr(this,"name");this.name=_}debug(_,...$){logger$9.debug(this.name,_,$)}log(_,...$){logger$9.log(this.name,_,$)}warn(_,...$){logger$9.warn(this.name,_,$)}error(_,...$){logger$9.error(this.name,_,$)}time(_,$){logger$9.time(_,$)}timeLog(_,...$){logger$9.timeLog(_,$)}}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(_,$,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=_,this.client=$,this.peerManager=j}setEventHandler(_,$){this.client.eventHandlers.set(_,$)}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(_,$){if($)return this.client.sendMessage(_,$);{const et=(await this.getPeers()).map(tt=>this.client.sendMessage(_,tt));return(await Promise.all(et))[0]}}async addListener(_){logger$7.debug("addListener"),this.listeners.push(_)}async removeListener(_){logger$7.log("removeListener"),this.listeners=this.listeners.filter($=>$!==_)}async getPeers(){return this.peerManager.getPeers()}async addPeer(_,$=!0){logger$7.log("addPeer","adding peer",_),await this.peerManager.addPeer(_),await this.listen(_.publicKey)}async removePeer(_){logger$7.log("removePeer","removing peer",_),await this.peerManager.removePeer(_.publicKey),this.client&&await this.client.unsubscribeFromEncryptedMessage(_.publicKey)}async removeAllPeers(){logger$7.log("removeAllPeers"),await this.peerManager.removeAllPeers(),this.client&&await this.client.unsubscribeFromEncryptedMessages()}async notifyListeners(_,$){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(_,$)})}};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(_){const $=JSON.stringify(_);return bs58check$2.encode(Buffer$g.from($))}async deserialize(_){if(typeof _!="string")throw new Error("Encoded payload needs to be a string");return JSON.parse(bs58check$2.decode(_).toString())}}class AppMetadataManager{constructor(_){Yr(this,"storageManager");this.storageManager=new StorageManager(_,StorageKey.APP_METADATA_LIST)}async getAppMetadataList(){return await this.storageManager.getAll()??[]}async getAppMetadata(_){return this.storageManager.getOne($=>$.senderId===_)}async addAppMetadata(_){return this.storageManager.addOne(_,$=>$.senderId===_.senderId)}async removeAppMetadata(_){return this.storageManager.remove($=>$.senderId===_)}async removeAppMetadatas(_){return this.storageManager.remove($=>_.includes($.senderId))}async removeAllAppMetadata(){return this.storageManager.removeAll()}}class PermissionManager{constructor(_){Yr(this,"storageManager");this.storageManager=new StorageManager(_,StorageKey.PERMISSION_LIST)}async getPermissions(){return await this.storageManager.getAll()??[]}async getPermission(_){return this.storageManager.getOne($=>$.accountIdentifier===_)}async addPermission(_){return this.storageManager.addOne(_,$=>$.accountIdentifier===_.accountIdentifier&&$.senderId===_.senderId)}async removePermission(_){return this.storageManager.remove($=>$.accountIdentifier===_)}async removePermissions(_){return this.storageManager.remove($=>_.includes($.accountIdentifier))}async removeAllPermissions(){return this.storageManager.removeAll()}async hasPermission(_){return PermissionValidator.hasPermission(_,this.getPermission.bind(this),this.getPermissions.bind(this))}}class PeerManager{constructor(_,$){Yr(this,"storageManager");this.storageManager=new StorageManager(_,$)}async hasPeer(_){return!!await this.getPeer(_)}async getPeers(){return await this.storageManager.getAll()??[]}async getPeer(_){return this.storageManager.getOne($=>$.publicKey===_)}async addPeer(_){return this.storageManager.addOne(_,$=>$.publicKey===_.publicKey)}async removePeer(_){return this.storageManager.remove($=>$.publicKey===_)}async removePeers(_){return this.storageManager.remove($=>_.includes($.publicKey))}async removeAllPeers(){return this.storageManager.removeAll()}}var x25519Session={},keyagreement={},hasRequiredKeyagreement;function requireKeyagreement(){return hasRequiredKeyagreement||(hasRequiredKeyagreement=1,function(a){Object.defineProperty(a,"__esModule",{value:!0}),a.X25519Session=a.SECRET_SEED_LENGTH=a.SAVED_STATE_LENGTH=a.ACCEPT_MESSAGE_LENGTH=a.OFFER_MESSAGE_LENGTH=void 0;const _=random,$=wipe$1,j=x25519,et=requireX25519Session();a.OFFER_MESSAGE_LENGTH=j.PUBLIC_KEY_LENGTH,a.ACCEPT_MESSAGE_LENGTH=j.PUBLIC_KEY_LENGTH,a.SAVED_STATE_LENGTH=j.SECRET_KEY_LENGTH,a.SECRET_SEED_LENGTH=j.SECRET_KEY_LENGTH;class tt{constructor(nt,it){this.offerMessageLength=a.OFFER_MESSAGE_LENGTH,this.acceptMessageLength=a.ACCEPT_MESSAGE_LENGTH,this.sharedKeyLength=j.SHARED_KEY_LENGTH,this.savedStateLength=a.SAVED_STATE_LENGTH,this._seed=nt||(0,_.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)}}}a.X25519Session=tt}(keyagreement)),keyagreement}var hasRequiredX25519Session;function requireX25519Session(){return hasRequiredX25519Session||(hasRequiredX25519Session=1,function(a){Object.defineProperty(a,"__esModule",{value:!0}),a.clientSessionKeys=a.serverSessionKeys=a.clientSessionKeysFromSharedKey=a.serverSessionKeysFromSharedKey=a.X25519Session=void 0;const _=blake2b$1,$=x25519;var j=requireKeyagreement();Object.defineProperty(a,"X25519Session",{enumerable:!0,get:function(){return j.X25519Session}});const et=32;function tt(st,ot,at,ut=_.BLAKE2b){const ht=new ut;if(ht.digestLength!==et*2)throw new Error("X25519: incorrect digest length");const yt=ht.update(st).update(at).update(ot).digest();return{send:yt.subarray(0,et),receive:yt.subarray(et)}}a.serverSessionKeysFromSharedKey=tt;function rt(st,ot,at,ut=_.BLAKE2b){const ht=new ut;if(ht.digestLength!==et*2)throw new Error("X25519: incorrect digest length");const yt=ht.update(st).update(ot).update(at).digest();return{receive:yt.subarray(0,et),send:yt.subarray(et)}}a.clientSessionKeysFromSharedKey=rt;function nt(st,ot,at=_.BLAKE2b){const ut=(0,$.sharedKey)(st.secretKey,ot);return tt(ut,st.publicKey,ot,at)}a.serverSessionKeys=nt;function it(st,ot,at=_.BLAKE2b){const ut=(0,$.sharedKey)(st.secretKey,ot);return rt(ut,st.publicKey,ot,at)}a.clientSessionKeys=it}(x25519Session)),x25519Session}var x25519SessionExports=requireX25519Session();class CommunicationClient{constructor(_){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=_}async getPublicKey(){var _;return toHex$1((_=this.keyPair)==null?void 0:_.publicKey)}async getPublicKeyHash(){return getHexHash(this.keyPair.publicKey)}async createCryptoBoxServer(_,$){return x25519SessionExports.serverSessionKeys({publicKey:ed25519.convertPublicKeyToX25519($.publicKey),secretKey:ed25519.convertSecretKeyToX25519($.secretKey)},ed25519.convertPublicKeyToX25519(Buffer$g.from(_,"hex")))}async createCryptoBoxClient(_,$){return x25519SessionExports.clientSessionKeys({publicKey:ed25519.convertPublicKeyToX25519($.publicKey),secretKey:ed25519.convertSecretKeyToX25519($.secretKey)},ed25519.convertPublicKeyToX25519(Buffer$g.from(_,"hex")))}async encryptMessageAsymmetric(_,$){return sealCryptobox($,Buffer$g.from(_,"hex"))}}function bind$2(a,_){return function(){return a.apply(_,arguments)}}const{toString:toString$4}=Object.prototype,{getPrototypeOf:getPrototypeOf$4}=Object,kindOf$1=(a=>_=>{const $=toString$4.call(_);return a[$]||(a[$]=$.slice(8,-1).toLowerCase())})(Object.create(null)),kindOfTest$1=a=>(a=a.toLowerCase(),_=>kindOf$1(_)===a),typeOfTest$1=a=>_=>typeof _===a,{isArray:isArray$4}=Array,isUndefined$1=typeOfTest$1("undefined");function isBuffer$2(a){return a!==null&&!isUndefined$1(a)&&a.constructor!==null&&!isUndefined$1(a.constructor)&&isFunction$3(a.constructor.isBuffer)&&a.constructor.isBuffer(a)}const isArrayBuffer$1=kindOfTest$1("ArrayBuffer");function isArrayBufferView$1(a){let _;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?_=ArrayBuffer.isView(a):_=a&&a.buffer&&isArrayBuffer$1(a.buffer),_}const isString$2=typeOfTest$1("string"),isFunction$3=typeOfTest$1("function"),isNumber$1=typeOfTest$1("number"),isObject$3=a=>a!==null&&typeof a=="object",isBoolean$2=a=>a===!0||a===!1,isPlainObject$5=a=>{if(kindOf$1(a)!=="object")return!1;const _=getPrototypeOf$4(a);return(_===null||_===Object.prototype||Object.getPrototypeOf(_)===null)&&!(Symbol.toStringTag in a)&&!(Symbol.iterator in a)},isDate$2=kindOfTest$1("Date"),isFile$1=kindOfTest$1("File"),isBlob$1=kindOfTest$1("Blob"),isFileList$1=kindOfTest$1("FileList"),isStream$1=a=>isObject$3(a)&&isFunction$3(a.pipe),isFormData$1=a=>{let _;return a&&(typeof FormData=="function"&&a instanceof FormData||isFunction$3(a.append)&&((_=kindOf$1(a))==="formdata"||_==="object"&&isFunction$3(a.toString)&&a.toString()==="[object FormData]"))},isURLSearchParams$1=kindOfTest$1("URLSearchParams"),trim$2=a=>a.trim?a.trim():a.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function forEach$1(a,_,{allOwnKeys:$=!1}={}){if(a===null||typeof a>"u")return;let j,et;if(typeof a!="object"&&(a=[a]),isArray$4(a))for(j=0,et=a.length;j0;)if(et=$[j],_===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=a=>!isUndefined$1(a)&&a!==_global$1;function merge$1(){const{caseless:a}=isContextDefined$1(this)&&this||{},_={},$=(j,et)=>{const tt=a&&findKey$2(_,et)||et;isPlainObject$5(_[tt])&&isPlainObject$5(j)?_[tt]=merge$1(_[tt],j):isPlainObject$5(j)?_[tt]=merge$1({},j):isArray$4(j)?_[tt]=j.slice():_[tt]=j};for(let j=0,et=arguments.length;j(forEach$1(_,(et,tt)=>{$&&isFunction$3(et)?a[tt]=bind$2(et,$):a[tt]=et},{allOwnKeys:j}),a),stripBOM$1=a=>(a.charCodeAt(0)===65279&&(a=a.slice(1)),a),inherits$4=(a,_,$,j)=>{a.prototype=Object.create(_.prototype,j),a.prototype.constructor=a,Object.defineProperty(a,"super",{value:_.prototype}),$&&Object.assign(a.prototype,$)},toFlatObject$1=(a,_,$,j)=>{let et,tt,rt;const nt={};if(_=_||{},a==null)return _;do{for(et=Object.getOwnPropertyNames(a),tt=et.length;tt-- >0;)rt=et[tt],(!j||j(rt,a,_))&&!nt[rt]&&(_[rt]=a[rt],nt[rt]=!0);a=$!==!1&&getPrototypeOf$4(a)}while(a&&(!$||$(a,_))&&a!==Object.prototype);return _},endsWith$1=(a,_,$)=>{a=String(a),($===void 0||$>a.length)&&($=a.length),$-=_.length;const j=a.indexOf(_,$);return j!==-1&&j===$},toArray$2=a=>{if(!a)return null;if(isArray$4(a))return a;let _=a.length;if(!isNumber$1(_))return null;const $=new Array(_);for(;_-- >0;)$[_]=a[_];return $},isTypedArray$1=(a=>_=>a&&_ instanceof a)(typeof Uint8Array<"u"&&getPrototypeOf$4(Uint8Array)),forEachEntry$1=(a,_)=>{const j=(a&&a[Symbol.iterator]).call(a);let et;for(;(et=j.next())&&!et.done;){const tt=et.value;_.call(a,tt[0],tt[1])}},matchAll$1=(a,_)=>{let $;const j=[];for(;($=a.exec(_))!==null;)j.push($);return j},isHTMLForm$1=kindOfTest$1("HTMLFormElement"),toCamelCase$1=a=>a.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function($,j,et){return j.toUpperCase()+et}),hasOwnProperty$1=(({hasOwnProperty:a})=>(_,$)=>a.call(_,$))(Object.prototype),isRegExp$1=kindOfTest$1("RegExp"),reduceDescriptors$1=(a,_)=>{const $=Object.getOwnPropertyDescriptors(a),j={};forEach$1($,(et,tt)=>{let rt;(rt=_(et,tt,a))!==!1&&(j[tt]=rt||et)}),Object.defineProperties(a,j)},freezeMethods$1=a=>{reduceDescriptors$1(a,(_,$)=>{if(isFunction$3(a)&&["arguments","caller","callee"].indexOf($)!==-1)return!1;const j=a[$];if(isFunction$3(j)){if(_.enumerable=!1,"writable"in _){_.writable=!1;return}_.set||(_.set=()=>{throw Error("Can not rewrite read-only method '"+$+"'")})}})},toObjectSet$1=(a,_)=>{const $={},j=et=>{et.forEach(tt=>{$[tt]=!0})};return isArray$4(a)?j(a):j(String(a).split(_)),$},noop$7=()=>{},toFiniteNumber$1=(a,_)=>(a=+a,Number.isFinite(a)?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=(a=16,_=ALPHABET$2.ALPHA_DIGIT)=>{let $="";const{length:j}=_;for(;a--;)$+=_[Math.random()*j|0];return $};function isSpecCompliantForm$1(a){return!!(a&&isFunction$3(a.append)&&a[Symbol.toStringTag]==="FormData"&&a[Symbol.iterator])}const toJSONObject$1=a=>{const _=new Array(10),$=(j,et)=>{if(isObject$3(j)){if(_.indexOf(j)>=0)return;if(!("toJSON"in j)){_[et]=j;const tt=isArray$4(j)?[]:{};return forEach$1(j,(rt,nt)=>{const it=$(rt,et+1);!isUndefined$1(it)&&(tt[nt]=it)}),_[et]=void 0,tt}}return j};return $(a,0)},isAsyncFn$1=kindOfTest$1("AsyncFunction"),isThenable$2=a=>a&&(isObject$3(a)||isFunction$3(a))&&isFunction$3(a.then)&&isFunction$3(a.catch),utils$i={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$4,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=a,this.name="AxiosError",_&&(this.code=_),$&&(this.config=$),j&&(this.request=j),et&&(this.response=et)}utils$i.inherits(AxiosError$1,Error,{toJSON:function a(){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$i.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(a=>{descriptors$1[a]={value:a}});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$i.toFlatObject(a,rt,function(it){return it!==Error.prototype},nt=>nt!=="isAxiosError"),AxiosError$1.call(rt,a.message,_,$,j,et),rt.cause=a,rt.name=a.name,tt&&Object.assign(rt,tt),rt};const httpAdapter$1=null;function isVisitable$1(a){return utils$i.isPlainObject(a)||utils$i.isArray(a)}function removeBrackets$1(a){return utils$i.endsWith(a,"[]")?a.slice(0,-2):a}function renderKey$1(a,_,$){return a?a.concat(_).map(function(et,tt){return et=removeBrackets$1(et),!$&&tt?"["+et+"]":et}).join($?".":""):_}function isFlatArray$1(a){return utils$i.isArray(a)&&!a.some(isVisitable$1)}const predicates$1=utils$i.toFlatObject(utils$i,{},null,function a(_){return/^is[A-Z]/.test(_)});function toFormData$1(a,_,$){if(!utils$i.isObject(a))throw new TypeError("target must be an object");_=_||new FormData,$=utils$i.toFlatObject($,{metaTokens:!0,dots:!1,indexes:!1},!1,function(wt,Ct){return!utils$i.isUndefined(Ct[wt])});const j=$.metaTokens,et=$.visitor||ot,tt=$.dots,rt=$.indexes,it=($.Blob||typeof Blob<"u"&&Blob)&&utils$i.isSpecCompliantForm(_);if(!utils$i.isFunction(et))throw new TypeError("visitor must be a function");function st(yt){if(yt===null)return"";if(utils$i.isDate(yt))return yt.toISOString();if(!it&&utils$i.isBlob(yt))throw new AxiosError$1("Blob is not supported. Use a Buffer instead.");return utils$i.isArrayBuffer(yt)||utils$i.isTypedArray(yt)?it&&typeof Blob=="function"?new Blob([yt]):Buffer$g.from(yt):yt}function ot(yt,wt,Ct){let Pt=yt;if(yt&&!Ct&&typeof yt=="object"){if(utils$i.endsWith(wt,"{}"))wt=j?wt:wt.slice(0,-2),yt=JSON.stringify(yt);else if(utils$i.isArray(yt)&&isFlatArray$1(yt)||(utils$i.isFileList(yt)||utils$i.endsWith(wt,"[]"))&&(Pt=utils$i.toArray(yt)))return wt=removeBrackets$1(wt),Pt.forEach(function(Mt,Lt){!(utils$i.isUndefined(Mt)||Mt===null)&&_.append(rt===!0?renderKey$1([wt],Lt,tt):rt===null?wt:wt+"[]",st(Mt))}),!1}return isVisitable$1(yt)?!0:(_.append(renderKey$1(Ct,wt,tt),st(yt)),!1)}const at=[],ut=Object.assign(predicates$1,{defaultVisitor:ot,convertValue:st,isVisitable:isVisitable$1});function ht(yt,wt){if(!utils$i.isUndefined(yt)){if(at.indexOf(yt)!==-1)throw Error("Circular reference detected in "+wt.join("."));at.push(yt),utils$i.forEach(yt,function(Pt,$t){(!(utils$i.isUndefined(Pt)||Pt===null)&&et.call(_,Pt,utils$i.isString($t)?$t.trim():$t,wt,ut))===!0&&ht(Pt,wt?wt.concat($t):[$t])}),at.pop()}}if(!utils$i.isObject(a))throw new TypeError("data must be an object");return ht(a),_}function encode$6(a){const _={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(a).replace(/[!'()~]|%20|%00/g,function(j){return _[j]})}function AxiosURLSearchParams$1(a,_){this._pairs=[],a&&toFormData$1(a,this,_)}const prototype$2=AxiosURLSearchParams$1.prototype;prototype$2.append=function a(_,$){this._pairs.push([_,$])};prototype$2.toString=function a(_){const $=_?function(j){return _.call(this,j,encode$6)}:encode$6;return this._pairs.map(function(et){return $(et[0])+"="+$(et[1])},"").join("&")};function encode$5(a){return encodeURIComponent(a).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function buildURL$1(a,_,$){if(!_)return a;const j=$&&$.encode||encode$5,et=$&&$.serialize;let tt;if(et?tt=et(_,$):tt=utils$i.isURLSearchParams(_)?_.toString():new AxiosURLSearchParams$1(_,$).toString(j),tt){const rt=a.indexOf("#");rt!==-1&&(a=a.slice(0,rt)),a+=(a.indexOf("?")===-1?"?":"&")+tt}return a}let InterceptorManager$1=class{constructor(){this.handlers=[]}use(_,$,j){return this.handlers.push({fulfilled:_,rejected:$,synchronous:j?j.synchronous:!1,runWhen:j?j.runWhen:null}),this.handlers.length-1}eject(_){this.handlers[_]&&(this.handlers[_]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(_){utils$i.forEach(this.handlers,function(j){j!==null&&_(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=(a=>hasBrowserEnv$1&&["ReactNative","NativeScript","NS"].indexOf(a)<0)(typeof navigator<"u"&&navigator.product),hasStandardBrowserWebWorkerEnv$1=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",utils$h=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:hasBrowserEnv$1,hasStandardBrowserEnv:hasStandardBrowserEnv$1,hasStandardBrowserWebWorkerEnv:hasStandardBrowserWebWorkerEnv$1},Symbol.toStringTag,{value:"Module"})),platform$2={...utils$h,...platform$3};function toURLEncodedForm$1(a,_){return toFormData$1(a,new platform$2.classes.URLSearchParams,Object.assign({visitor:function($,j,et,tt){return platform$2.isNode&&utils$i.isBuffer($)?(this.append(j,$.toString("base64")),!1):tt.defaultVisitor.apply(this,arguments)}},_))}function parsePropPath$1(a){return utils$i.matchAll(/\w+|\[(\w*)]/g,a).map(_=>_[0]==="[]"?"":_[1]||_[0])}function arrayToObject$1(a){const _={},$=Object.keys(a);let j;const et=$.length;let tt;for(j=0;j=$.length;return rt=!rt&&utils$i.isArray(et)?et.length:rt,it?(utils$i.hasOwnProp(et,rt)?et[rt]=[et[rt],j]:et[rt]=j,!nt):((!et[rt]||!utils$i.isObject(et[rt]))&&(et[rt]=[]),_($,j,et[rt],tt)&&utils$i.isArray(et[rt])&&(et[rt]=arrayToObject$1(et[rt])),!nt)}if(utils$i.isFormData(a)&&utils$i.isFunction(a.entries)){const $={};return utils$i.forEachEntry(a,(j,et)=>{_(parsePropPath$1(j),et,$,0)}),$}return null}function stringifySafely$1(a,_,$){if(utils$i.isString(a))try{return(_||JSON.parse)(a),utils$i.trim(a)}catch(j){if(j.name!=="SyntaxError")throw j}return($||JSON.stringify)(a)}const defaults$2={transitional:transitionalDefaults$1,adapter:["xhr","http"],transformRequest:[function a(_,$){const j=$.getContentType()||"",et=j.indexOf("application/json")>-1,tt=utils$i.isObject(_);if(tt&&utils$i.isHTMLForm(_)&&(_=new FormData(_)),utils$i.isFormData(_))return et&&et?JSON.stringify(formDataToJSON$1(_)):_;if(utils$i.isArrayBuffer(_)||utils$i.isBuffer(_)||utils$i.isStream(_)||utils$i.isFile(_)||utils$i.isBlob(_))return _;if(utils$i.isArrayBufferView(_))return _.buffer;if(utils$i.isURLSearchParams(_))return $.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),_.toString();let nt;if(tt){if(j.indexOf("application/x-www-form-urlencoded")>-1)return toURLEncodedForm$1(_,this.formSerializer).toString();if((nt=utils$i.isFileList(_))||j.indexOf("multipart/form-data")>-1){const it=this.env&&this.env.FormData;return toFormData$1(nt?{"files[]":_}:_,it&&new it,this.formSerializer)}}return tt||et?($.setContentType("application/json",!1),stringifySafely$1(_)):_}],transformResponse:[function a(_){const $=this.transitional||defaults$2.transitional,j=$&&$.forcedJSONParsing,et=this.responseType==="json";if(_&&utils$i.isString(_)&&(j&&!this.responseType||et)){const rt=!($&&$.silentJSONParsing)&&et;try{return JSON.parse(_)}catch(nt){if(rt)throw nt.name==="SyntaxError"?AxiosError$1.from(nt,AxiosError$1.ERR_BAD_RESPONSE,this,null,this.response):nt}}return _}],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 _>=200&&_<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};utils$i.forEach(["delete","get","head","post","put","patch"],a=>{defaults$2.headers[a]={}});const ignoreDuplicateOf$1=utils$i.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=a=>{const _={};let $,j,et;return a&&a.split(` -`).forEach(function(rt){et=rt.indexOf(":"),$=rt.substring(0,et).trim().toLowerCase(),j=rt.substring(et+1).trim(),!(!$||_[$]&&ignoreDuplicateOf$1[$])&&($==="set-cookie"?_[$]?_[$].push(j):_[$]=[j]:_[$]=_[$]?_[$]+", "+j:j)}),_},$internals$1=Symbol("internals");function normalizeHeader$1(a){return a&&String(a).trim().toLowerCase()}function normalizeValue$1(a){return a===!1||a==null?a:utils$i.isArray(a)?a.map(normalizeValue$1):String(a)}function parseTokens$1(a){const _=Object.create(null),$=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let j;for(;j=$.exec(a);)_[j[1]]=j[2];return _}const isValidHeaderName$1=a=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(a.trim());function matchHeaderValue$1(a,_,$,j,et){if(utils$i.isFunction(j))return j.call(this,_,$);if(et&&(_=$),!!utils$i.isString(_)){if(utils$i.isString(j))return _.indexOf(j)!==-1;if(utils$i.isRegExp(j))return j.test(_)}}function formatHeader$1(a){return a.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(_,$,j)=>$.toUpperCase()+j)}function buildAccessors$1(a,_){const $=utils$i.toCamelCase(" "+_);["get","set","has"].forEach(j=>{Object.defineProperty(a,j+$,{value:function(et,tt,rt){return this[j].call(this,_,et,tt,rt)},configurable:!0})})}let AxiosHeaders$1=class{constructor(_){_&&this.set(_)}set(_,$,j){const et=this;function tt(nt,it,st){const ot=normalizeHeader$1(it);if(!ot)throw new Error("header name must be a non-empty string");const at=utils$i.findKey(et,ot);(!at||et[at]===void 0||st===!0||st===void 0&&et[at]!==!1)&&(et[at||it]=normalizeValue$1(nt))}const rt=(nt,it)=>utils$i.forEach(nt,(st,ot)=>tt(st,ot,it));return utils$i.isPlainObject(_)||_ instanceof this.constructor?rt(_,$):utils$i.isString(_)&&(_=_.trim())&&!isValidHeaderName$1(_)?rt(parseHeaders$1(_),$):_!=null&&tt($,_,j),this}get(_,$){if(_=normalizeHeader$1(_),_){const j=utils$i.findKey(this,_);if(j){const et=this[j];if(!$)return et;if($===!0)return parseTokens$1(et);if(utils$i.isFunction($))return $.call(this,et,j);if(utils$i.isRegExp($))return $.exec(et);throw new TypeError("parser must be boolean|regexp|function")}}}has(_,$){if(_=normalizeHeader$1(_),_){const j=utils$i.findKey(this,_);return!!(j&&this[j]!==void 0&&(!$||matchHeaderValue$1(this,this[j],j,$)))}return!1}delete(_,$){const j=this;let et=!1;function tt(rt){if(rt=normalizeHeader$1(rt),rt){const nt=utils$i.findKey(j,rt);nt&&(!$||matchHeaderValue$1(j,j[nt],nt,$))&&(delete j[nt],et=!0)}}return utils$i.isArray(_)?_.forEach(tt):tt(_),et}clear(_){const $=Object.keys(this);let j=$.length,et=!1;for(;j--;){const tt=$[j];(!_||matchHeaderValue$1(this,this[tt],tt,_,!0))&&(delete this[tt],et=!0)}return et}normalize(_){const $=this,j={};return utils$i.forEach(this,(et,tt)=>{const rt=utils$i.findKey(j,tt);if(rt){$[rt]=normalizeValue$1(et),delete $[tt];return}const nt=_?formatHeader$1(tt):String(tt).trim();nt!==tt&&delete $[tt],$[nt]=normalizeValue$1(et),j[nt]=!0}),this}concat(..._){return this.constructor.concat(this,..._)}toJSON(_){const $=Object.create(null);return utils$i.forEach(this,(j,et)=>{j!=null&&j!==!1&&($[et]=_&&utils$i.isArray(j)?j.join(", "):j)}),$}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([_,$])=>_+": "+$).join(` -`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(_){return _ instanceof this?_:new this(_)}static concat(_,...$){const j=new this(_);return $.forEach(et=>j.set(et)),j}static accessor(_){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$i.isArray(_)?_.forEach(tt):tt(_),this}};AxiosHeaders$1.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);utils$i.reduceDescriptors(AxiosHeaders$1.prototype,({value:a},_)=>{let $=_[0].toUpperCase()+_.slice(1);return{get:()=>a,set(j){this[$]=j}}});utils$i.freezeMethods(AxiosHeaders$1);function transformData$1(a,_){const $=this||defaults$2,j=_||$,et=AxiosHeaders$1.from(j.headers);let tt=j.data;return utils$i.forEach(a,function(nt){tt=nt.call($,tt,et.normalize(),_?_.status:void 0)}),et.normalize(),tt}function isCancel$1(a){return!!(a&&a.__CANCEL__)}function CanceledError$1(a,_,$){AxiosError$1.call(this,a??"canceled",AxiosError$1.ERR_CANCELED,_,$),this.name="CanceledError"}utils$i.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=[a+"="+encodeURIComponent(_)];utils$i.isNumber($)&&rt.push("expires="+new Date($).toGMTString()),utils$i.isString(j)&&rt.push("path="+j),utils$i.isString(et)&&rt.push("domain="+et),tt===!0&&rt.push("secure"),document.cookie=rt.join("; ")},read(a){const _=document.cookie.match(new RegExp("(^|;\\s*)("+a+")=([^;]*)"));return _?decodeURIComponent(_[3]):null},remove(a){this.write(a,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function isAbsoluteURL$1(a){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(a)}function combineURLs$1(a,_){return _?a.replace(/\/?\/$/,"")+"/"+_.replace(/^\/+/,""):a}function buildFullPath$1(a,_){return a&&!isAbsoluteURL$1(_)?combineURLs$1(a,_):_}const isURLSameOrigin$1=platform$2.hasStandardBrowserEnv?function a(){const _=/(msie|trident)/i.test(navigator.userAgent),$=document.createElement("a");let j;function et(tt){let rt=tt;return _&&($.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$i.isString(rt)?et(rt):rt;return nt.protocol===j.protocol&&nt.host===j.host}}():function a(){return function(){return!0}}();function parseProtocol$1(a){const _=/^([-+\w]{1,25})(:?\/\/|:)/.exec(a);return _&&_[1]||""}function speedometer$1(a,_){a=a||10;const $=new Array(a),j=new Array(a);let et=0,tt=0,rt;return _=_!==void 0?_:1e3,function(it){const st=Date.now(),ot=j[tt];rt||(rt=st),$[et]=it,j[et]=st;let at=tt,ut=0;for(;at!==et;)ut+=$[at++],at=at%a;if(et=(et+1)%a,et===tt&&(tt=(tt+1)%a),st-rt<_)return;const ht=ot&&st-ot;return ht?Math.round(ut*1e3/ht):void 0}}function progressEventReducer$1(a,_){let $=0;const j=speedometer$1(50,250);return et=>{const tt=et.loaded,rt=et.lengthComputable?et.total:void 0,nt=tt-$,it=j(nt),st=tt<=rt;$=tt;const ot={loaded:tt,total:rt,progress:rt?tt/rt:void 0,bytes:nt,rate:it||void 0,estimated:it&&rt&&st?(rt-tt)/it:void 0,event:et};ot[_?"download":"upload"]=!0,a(ot)}}const isXHRAdapterSupported$1=typeof XMLHttpRequest<"u",xhrAdapter$1=isXHRAdapterSupported$1&&function(a){return new Promise(function($,j){let et=a.data;const tt=AxiosHeaders$1.from(a.headers).normalize();let{responseType:rt,withXSRFToken:nt}=a,it;function st(){a.cancelToken&&a.cancelToken.unsubscribe(it),a.signal&&a.signal.removeEventListener("abort",it)}let ot;if(utils$i.isFormData(et)){if(platform$2.hasStandardBrowserEnv||platform$2.hasStandardBrowserWebWorkerEnv)tt.setContentType(!1);else if((ot=tt.getContentType())!==!1){const[wt,...Ct]=ot?ot.split(";").map(Pt=>Pt.trim()).filter(Boolean):[];tt.setContentType([wt||"multipart/form-data",...Ct].join("; "))}}let at=new XMLHttpRequest;if(a.auth){const wt=a.auth.username||"",Ct=a.auth.password?unescape(encodeURIComponent(a.auth.password)):"";tt.set("Authorization","Basic "+btoa(wt+":"+Ct))}const ut=buildFullPath$1(a.baseURL,a.url);at.open(a.method.toUpperCase(),buildURL$1(ut,a.params,a.paramsSerializer),!0),at.timeout=a.timeout;function ht(){if(!at)return;const wt=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:wt,config:a,request:at};settle$1(function(Mt){$(Mt),st()},function(Mt){j(Mt),st()},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,a,at)),at=null)},at.onerror=function(){j(new AxiosError$1("Network Error",AxiosError$1.ERR_NETWORK,a,at)),at=null},at.ontimeout=function(){let Ct=a.timeout?"timeout of "+a.timeout+"ms exceeded":"timeout exceeded";const Pt=a.transitional||transitionalDefaults$1;a.timeoutErrorMessage&&(Ct=a.timeoutErrorMessage),j(new AxiosError$1(Ct,Pt.clarifyTimeoutError?AxiosError$1.ETIMEDOUT:AxiosError$1.ECONNABORTED,a,at)),at=null},platform$2.hasStandardBrowserEnv&&(nt&&utils$i.isFunction(nt)&&(nt=nt(a)),nt||nt!==!1&&isURLSameOrigin$1(ut))){const wt=a.xsrfHeaderName&&a.xsrfCookieName&&cookies$1.read(a.xsrfCookieName);wt&&tt.set(a.xsrfHeaderName,wt)}et===void 0&&tt.setContentType(null),"setRequestHeader"in at&&utils$i.forEach(tt.toJSON(),function(Ct,Pt){at.setRequestHeader(Pt,Ct)}),utils$i.isUndefined(a.withCredentials)||(at.withCredentials=!!a.withCredentials),rt&&rt!=="json"&&(at.responseType=a.responseType),typeof a.onDownloadProgress=="function"&&at.addEventListener("progress",progressEventReducer$1(a.onDownloadProgress,!0)),typeof a.onUploadProgress=="function"&&at.upload&&at.upload.addEventListener("progress",progressEventReducer$1(a.onUploadProgress)),(a.cancelToken||a.signal)&&(it=wt=>{at&&(j(!wt||wt.type?new CanceledError$1(null,a,at):wt),at.abort(),at=null)},a.cancelToken&&a.cancelToken.subscribe(it),a.signal&&(a.signal.aborted?it():a.signal.addEventListener("abort",it)));const yt=parseProtocol$1(ut);if(yt&&platform$2.protocols.indexOf(yt)===-1){j(new AxiosError$1("Unsupported protocol "+yt+":",AxiosError$1.ERR_BAD_REQUEST,a));return}at.send(et||null)})},knownAdapters$1={http:httpAdapter$1,xhr:xhrAdapter$1};utils$i.forEach(knownAdapters$1,(a,_)=>{if(a){try{Object.defineProperty(a,"name",{value:_})}catch{}Object.defineProperty(a,"adapterName",{value:_})}});const renderReason$1=a=>`- ${a}`,isResolvedHandle$1=a=>utils$i.isFunction(a)||a===null||a===!1,adapters$1={getAdapter:a=>{a=utils$i.isArray(a)?a:[a];const{length:_}=a;let $,j;const et={};for(let tt=0;tt<_;tt++){$=a[tt];let rt;if(j=$,!isResolvedHandle$1($)&&(j=knownAdapters$1[(rt=String($)).toLowerCase()],j===void 0))throw new AxiosError$1(`Unknown adapter '${rt}'`);if(j)break;et[rt||"#"+tt]=j}if(!j){const tt=Object.entries(et).map(([nt,it])=>`adapter ${nt} `+(it===!1?"is not supported by the environment":"is not available in the build"));let rt=_?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(a){if(a.cancelToken&&a.cancelToken.throwIfRequested(),a.signal&&a.signal.aborted)throw new CanceledError$1(null,a)}function dispatchRequest$1(a){return throwIfCancellationRequested$1(a),a.headers=AxiosHeaders$1.from(a.headers),a.data=transformData$1.call(a,a.transformRequest),["post","put","patch"].indexOf(a.method)!==-1&&a.headers.setContentType("application/x-www-form-urlencoded",!1),adapters$1.getAdapter(a.adapter||defaults$2.adapter)(a).then(function(j){return throwIfCancellationRequested$1(a),j.data=transformData$1.call(a,a.transformResponse,j),j.headers=AxiosHeaders$1.from(j.headers),j},function(j){return isCancel$1(j)||(throwIfCancellationRequested$1(a),j&&j.response&&(j.response.data=transformData$1.call(a,a.transformResponse,j.response),j.response.headers=AxiosHeaders$1.from(j.response.headers))),Promise.reject(j)})}const headersToObject$1=a=>a instanceof AxiosHeaders$1?a.toJSON():a;function mergeConfig$1(a,_){_=_||{};const $={};function j(st,ot,at){return utils$i.isPlainObject(st)&&utils$i.isPlainObject(ot)?utils$i.merge.call({caseless:at},st,ot):utils$i.isPlainObject(ot)?utils$i.merge({},ot):utils$i.isArray(ot)?ot.slice():ot}function et(st,ot,at){if(utils$i.isUndefined(ot)){if(!utils$i.isUndefined(st))return j(void 0,st,at)}else return j(st,ot,at)}function tt(st,ot){if(!utils$i.isUndefined(ot))return j(void 0,ot)}function rt(st,ot){if(utils$i.isUndefined(ot)){if(!utils$i.isUndefined(st))return j(void 0,st)}else return j(void 0,ot)}function nt(st,ot,at){if(at in _)return j(st,ot);if(at in a)return j(void 0,st)}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:(st,ot)=>et(headersToObject$1(st),headersToObject$1(ot),!0)};return utils$i.forEach(Object.keys(Object.assign({},a,_)),function(ot){const at=it[ot]||et,ut=at(a[ot],_[ot],ot);utils$i.isUndefined(ut)&&at!==nt||($[ot]=ut)}),$}const VERSION$3="1.6.5",validators$3={};["object","boolean","number","function","string","symbol"].forEach((a,_)=>{validators$3[a]=function(j){return typeof j===a||"a"+(_<1?"n ":" ")+a}});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(_===!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"))),_?_(tt,rt,nt):!0}};function assertOptions$1(a,_,$){if(typeof a!="object")throw new AxiosError$1("options must be an object",AxiosError$1.ERR_BAD_OPTION_VALUE);const j=Object.keys(a);let et=j.length;for(;et-- >0;){const tt=j[et],rt=_[tt];if(rt){const nt=a[tt],it=nt===void 0||rt(nt,tt,a);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(_){this.defaults=_,this.interceptors={request:new InterceptorManager$1,response:new InterceptorManager$1}}request(_,$){typeof _=="string"?($=$||{},$.url=_):$=_||{},$=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$i.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$i.merge(tt.common,tt[$.method]);tt&&utils$i.forEach(["delete","get","head","post","put","patch","common"],yt=>{delete tt[yt]}),$.headers=AxiosHeaders$1.concat(rt,tt);const nt=[];let it=!0;this.interceptors.request.forEach(function(wt){typeof wt.runWhen=="function"&&wt.runWhen($)===!1||(it=it&&wt.synchronous,nt.unshift(wt.fulfilled,wt.rejected))});const st=[];this.interceptors.response.forEach(function(wt){st.push(wt.fulfilled,wt.rejected)});let ot,at=0,ut;if(!it){const yt=[dispatchRequest$1.bind(this),void 0];for(yt.unshift.apply(yt,nt),yt.push.apply(yt,st),ut=yt.length,ot=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},_(function(tt,rt,nt){j.reason||(j.reason=new CanceledError$1(tt,rt,nt),$(j.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(_){if(this.reason){_(this.reason);return}this._listeners?this._listeners.push(_):this._listeners=[_]}unsubscribe(_){if(!this._listeners)return;const $=this._listeners.indexOf(_);$!==-1&&this._listeners.splice($,1)}static source(){let _;return{token:new Av(function(et){_=et}),cancel:_}}};function spread$1(a){return function($){return a.apply(null,$)}}function isAxiosError$1(a){return utils$i.isObject(a)&&a.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(a){const _=new Axios$1(a),$=bind$2(Axios$1.prototype.request,_);return utils$i.extend($,Axios$1.prototype,_,{allOwnKeys:!0}),utils$i.extend($,_,null,{allOwnKeys:!0}),$.create=function(et){return createInstance$1(mergeConfig$1(a,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(_)};axios$1.spread=spread$1;axios$1.isAxiosError=isAxiosError$1;axios$1.mergeConfig=mergeConfig$1;axios$1.AxiosHeaders=AxiosHeaders$1;axios$1.formToJSON=a=>formDataToJSON$1(utils$i.isHTMLForm(a)?new FormData(a):a);axios$1.getAdapter=adapters$1.getAdapter;axios$1.HttpStatusCode=HttpStatusCode$1;axios$1.default=axios$1;var MatrixMessageType;(function(a){a.TEXT="m.text"})(MatrixMessageType||(MatrixMessageType={}));class MatrixMessage{constructor(_,$,j,et){Yr(this,"type");Yr(this,"sender");Yr(this,"content");Yr(this,"timestamp");this.type=_,this.sender=$,this.content=j,this.timestamp=et}static from(_){if(isTextMessageEvent(_))return new MatrixMessage(_.content.msgtype,_.sender,_.content.body,_.origin_server_ts)}}const isCreateEvent=a=>a.type==="m.room.create"&&a.content instanceof Object&&"creator"in a.content,isJoinEvent=a=>a.type==="m.room.member"&&a.content instanceof Object&&"membership"in a.content&&a.content.membership==="join",isMessageEvent=a=>a.type==="m.room.message",isTextMessageEvent=a=>isMessageEvent(a)&&a.content instanceof Object&&"msgtype"in a.content&&a.content.msgtype===MatrixMessageType.TEXT;var MatrixRoomStatus;(function(a){a[a.UNKNOWN=0]="UNKNOWN",a[a.JOINED=1]="JOINED",a[a.INVITED=2]="INVITED",a[a.LEFT=3]="LEFT"})(MatrixRoomStatus||(MatrixRoomStatus={}));class MatrixRoom{constructor(_,$=MatrixRoomStatus.UNKNOWN,j=[],et=[]){Yr(this,"id");Yr(this,"status");Yr(this,"members");Yr(this,"messages");this.id=_,this.status=$,this.members=j,this.messages=et}static fromSync(_){if(!_)return[];function $(j,et){return Object.entries(j).map(([tt,rt])=>et(tt,rt))}return[...$(_.join??{},MatrixRoom.fromJoined),...$(_.invite??{},MatrixRoom.fromInvited),...$(_.leave??{},MatrixRoom.fromLeft)]}static from(_,$){return typeof _=="string"?new MatrixRoom(_,$||MatrixRoomStatus.UNKNOWN):$!==void 0?new MatrixRoom(_.id,$,_.members,_.messages):_}static merge(_,$){return!$||$.id!==_.id?MatrixRoom.from(_):new MatrixRoom(_.id,_.status,[...$.members,..._.members].filter((j,et,tt)=>tt.indexOf(j)===et),[...$.messages,..._.messages])}static fromJoined(_,$){const j=[...$.state.events,...$.timeline.events],et=MatrixRoom.getMembersFromEvents(j),tt=MatrixRoom.getMessagesFromEvents(j);return new MatrixRoom(_,MatrixRoomStatus.JOINED,et,tt)}static fromInvited(_,$){const j=MatrixRoom.getMembersFromEvents($.invite_state.events);return new MatrixRoom(_,MatrixRoomStatus.INVITED,j)}static fromLeft(_,$){const j=[...$.state.events,...$.timeline.events],et=MatrixRoom.getMembersFromEvents(j),tt=MatrixRoom.getMessagesFromEvents(j);return new MatrixRoom(_,MatrixRoomStatus.LEFT,et,tt)}static getMembersFromEvents(_){return MatrixRoom.getUniqueEvents(_.filter($=>isCreateEvent($)||isJoinEvent($))).map($=>$.sender).filter(($,j,et)=>et.indexOf($)===j)}static getMessagesFromEvents(_){return MatrixRoom.getUniqueEvents(_.filter(isMessageEvent)).map($=>MatrixMessage.from($)).filter(Boolean)}static getUniqueEvents(_){const $={},j=[];return _.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(_){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=_,this.waitReadyPromise=new Promise(async($,j)=>{try{await this.initFromStorage(),$()}catch(et){j(et)}})}get(_){return this.state[_]}getRoom(_){const $=MatrixRoom.from(_,MatrixRoomStatus.UNKNOWN);return this.state.rooms[$.id]||$}async update(_){await this.waitReady();const $=Object.assign({},this.state);this.setState(_),this.updateStorage(_),this.notifyListeners($,this.state,_)}onStateChanged(_,...$){$.length>0?$.forEach(j=>{this.onStateChangedListeners.set(j,_)}):this.onStateChangedListeners.set("all",_)}async waitReady(){return this.waitReadyPromise}async initFromStorage(){const _=await this.storage.get(StorageKey.MATRIX_PRESERVED_STATE);this.setState(_)}prepareData(_){const j=["rooms"].some(et=>_[et]!==void 0)?JSON.parse(JSON.stringify(_)):_;return Object.values(j.rooms||{}).forEach(et=>{et.messages=[]}),j}updateStorage(_){if(Object.entries(_).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(_){this.state={isRunning:_.isRunning||this.state.isRunning,userId:_.userId||this.state.userId,deviceId:_.deviceId||this.state.deviceId,txnNo:_.txnNo||this.state.txnNo,accessToken:_.accessToken||this.state.accessToken,syncToken:_.syncToken||this.state.syncToken,pollingTimeout:_.pollingTimeout||this.state.pollingTimeout,pollingRetries:_.pollingRetries||this.state.pollingRetries,rooms:this.mergeRooms(this.state.rooms,_.rooms)}}mergeRooms(_,$){if(!$)return _;const j=Array.isArray($)?$:Object.values($),et=Object.assign({},_);return j.forEach(tt=>{et[tt.id]=MatrixRoom.merge(tt,_[tt.id])}),et}notifyListeners(_,$,j){const et=this.onStateChangedListeners.get("all");et&&et(_,$,j),keys(j).filter(tt=>j[tt]!==void 0).forEach(tt=>{const rt=this.onStateChangedListeners.get(tt);rt&&rt(_,$,j)})}}const logger$6=new Logger("MatrixHttpClient"),CLIENT_API_R0="/_matrix/client/r0";class MatrixHttpClient{constructor(_){Yr(this,"baseUrl");Yr(this,"cancelTokenSource");this.baseUrl=_,this.cancelTokenSource=axios$1.CancelToken.source()}async get(_,$,j){return this.send("GET",_,j,$)}async post(_,$,j,et){return this.send("POST",_,j,et,$)}async put(_,$,j,et){return this.send("PUT",_,j,et,$)}async cancelAllRequests(){return this.cancelTokenSource.cancel("Manually cancelled")}async send(_,$,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:_,url:$,baseURL:this.apiUrl(CLIENT_API_R0),headers:rt,data:tt,params:nt,cancelToken:this.cancelTokenSource.token})}catch(st){const ot=st;throw logger$6.error("send",ot.code,ot.message,ot.response.data),st.response.data}return it.data}getHeaders(_){const $={},j=[];if(_.accessToken&&j.push(["Authorization",`Bearer ${_.accessToken}`]),j.length!==0){for(const[et,tt]of j)$[et]=tt;return $}}getParams(_){if(!_)return;const $=Object.assign(_,{});return keys($).forEach(j=>$[j]===void 0&&delete $[j]),$}apiUrl(..._){const $=this.baseUrl.endsWith("/")?this.baseUrl.substr(0,this.baseUrl.length-1):this.baseUrl,j=_.map(et=>et.startsWith("/")?et.substr(1):et);return[$,...j].join("/")}}class MatrixRoomService{constructor(_){Yr(this,"httpClient");this.httpClient=_}async createRoom(_,$={}){return this.httpClient.post("/createRoom",$,{accessToken:_})}async inviteToRoom(_,$,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:_})}async joinRoom(_,$){return $.status===MatrixRoomStatus.JOINED?Promise.resolve({room_id:$.id}):this.httpClient.post(`/rooms/${encodeURIComponent($.id)}/join`,{},{accessToken:_})}async getJoinedRooms(_){return this.httpClient.get("/joined_rooms",void 0,{accessToken:_})}}class MatrixUserService{constructor(_){Yr(this,"httpClient");this.httpClient=_}async login(_,$,j){return this.httpClient.post("/login",{type:"m.login.password",identifier:{type:"m.id.user",user:_},password:$,device_id:j})}}class MatrixEventService{constructor(_){Yr(this,"httpClient");Yr(this,"cachedPromises",new Map);this.httpClient=_}async sync(_,$){return this.withCache("sync",()=>this.httpClient.get("/sync",{timeout:$?$.pollingTimeout:void 0,since:$?$.syncToken:void 0},{accessToken:_}))}async sendMessage(_,$,j,et){return new Promise((tt,rt)=>this.scheduleEvent({accessToken:_,roomId:$,type:"m.room.message",content:j,txnId:et,onSuccess:tt,onError:rt}))}scheduleEvent(_){this.sendEvent(_)}async sendEvent(_){const{roomId:$,type:j,txnId:et,content:tt,accessToken:rt}=_;try{const nt=await this.httpClient.put(`/rooms/${encodeURIComponent($)}/send/${j}/${encodeURIComponent(et)}`,tt,{accessToken:rt});_.onSuccess(nt)}catch(nt){_.onError(nt)}}withCache(_,$){let j=this.cachedPromises.get(_);return j||(j=$().finally(()=>{this.cachedPromises.delete(_)}),this.cachedPromises.set(_,j)),j}}class EventEmitter{constructor(){Yr(this,"events",{})}on(_,$){return typeof this.events[_]!="object"&&(this.events[_]=[]),this.events[_].push($),()=>this.removeListener(_,$)}removeListener(_,$){if(typeof this.events[_]!="object")return;if(!$){this.events[_]=[];return}const j=this.events[_].indexOf($);j>-1&&this.events[_].splice(j,1)}removeAllListeners(){Object.keys(this.events).forEach(_=>this.events[_].splice(0,this.events[_].length))}emit(_,...$){typeof this.events[_]=="object"&&[...this.events[_]].forEach(j=>j.apply(this,$))}once(_,$){const j=this.on(_,(...et)=>{j(),$.apply(this,et)});return j}}var MatrixClientEventType;(function(a){a.INVITE="invite",a.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(_,$,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=_,this.eventEmitter=$,this.userService=j,this.roomService=et,this.eventService=tt,this.httpClient=rt,this.store.onStateChanged((nt,it,st)=>{this.eventEmitter.onStateChanged(nt,it,st)},"rooms")}static create(_){const $=new MatrixClientStore(_.storage),j=new MatrixClientEventEmitter,et=new MatrixHttpClient(_.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 _=>{await this.isConnected(),_(Object.values(this.store.get("rooms")).filter($=>$.status===MatrixRoomStatus.JOINED))})}get invitedRooms(){return new Promise(async _=>{await this.isConnected(),_(Object.values(this.store.get("rooms")).filter($=>$.status===MatrixRoomStatus.INVITED))})}get leftRooms(){return new Promise(async _=>{await this.isConnected(),_(Object.values(this.store.get("rooms")).filter($=>$.status===MatrixRoomStatus.LEFT))})}async start(_){const $=await this.userService.login(_.id,_.password,_.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(_,$){this.eventEmitter.on(_,$)}unsubscribe(_,$){$&&this.eventEmitter.removeListener(_,$)}unsubscribeAll(_){this.eventEmitter.removeListener(_)}async getRoomById(_){return await this.isConnected(),this.store.getRoom(_)}async createTrustedPrivateRoom(..._){return await this.isConnected(),this.requiresAuthorization("createRoom",async $=>(await this.roomService.createRoom($,{room_version:"5",invite:_,preset:"public_chat",is_direct:!0})).room_id)}async inviteToRooms(_,...$){await this.isConnected(),await this.requiresAuthorization("invite",j=>Promise.all($.map(et=>{const tt=this.store.getRoom(et);this.roomService.inviteToRoom(j,_,tt).catch(rt=>logger$5.warn("inviteToRooms",rt))})))}async joinRooms(..._){await this.isConnected(),await this.requiresAuthorization("join",$=>Promise.all(_.map(j=>{const et=this.store.getRoom(j);return this.roomService.joinRoom($,et)})))}async sendTextMessage(_,$){await this.isConnected(),await this.requiresAuthorization("send",async j=>{const et=await this.createTxnId();return this.eventService.sendMessage(j,_,{msgtype:"m.text",body:$},et)})}async poll(_,$,j){const et=this.store,tt=this.sync.bind(this),rt=async(nt,it)=>{let st=0;try{const ot=await tt();$(ot)}catch(ot){j(ot),st=et.get("pollingRetries"),this.isActive&&logger$5.log(`Retry syncing... ${st} retries so far`)}finally{this.isActive?setTimeout(async()=>{await rt(nt,it)},st>IMMEDIATE_POLLING_RETRIES?RETRY_INTERVAL+_:_):it(new Error("Syncing stopped manually."))}};return new Promise(rt)}async sync(){return this.requiresAuthorization("sync",async _=>this.eventService.sync(_,{pollingTimeout:this.store.get("pollingTimeout"),syncToken:this.store.get("syncToken")}))}async requiresAuthorization(_,$){const j=this.store.get("accessToken");return j?$(j):Promise.reject(`${_} requires authorization but no access token has been provided.`)}async createTxnId(){const _=new Date().getTime(),$=this.store.get("txnNo");return await this.store.update({txnNo:$+1}),`m${_}.${$}`}}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=a=>new Promise(_=>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 st;if(this.selectedRegion)return(st=this.relayServer)==null?void 0:st.promiseResult;const $=Object.keys(this.ENABLED_RELAY_SERVERS),j=[],et=new ExposedPromise;let tt=0;const rt=new ExposedPromise;$.forEach(ot=>{const at=this.ENABLED_RELAY_SERVERS[ot]??[];if(at.length===0)return;tt+=2;const ut=(wt=!0)=>{const Ct=Date.now();Promise.race([this.getBeaconInfo(yt),rt.promise]).then(Pt=>{typeof Pt!="boolean"&&(j.push({time:Date.now()-Ct,server:yt,region:ot,result:Pt}),j.length>=tt&&et.resolve(void 0),wt||ut(!0))})},ht=Math.floor(Math.random()*at.length),yt=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((ot,at)=>ot.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 st=>{this.initialEvent&&this.initialEvent.timestamp&&st&&st.timestamp?this.initialEvent.timestamp{let ot;st.content.members.length===1&&(ot=st.content.members[0]),await this.tryJoinRooms(st.content.roomId),ot&&(await this.updateRelayServer(ot),await this.updatePeerRoom(ot,st.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 st;await this.updateRelayServer(it.content.message.sender),await this.updatePeerRoom(it.content.message.sender,it.content.roomId);try{st=Buffer$g.from(it.content.message.content,"hex")}catch{}if(st&&st.length>=secretbox_NONCEBYTES+secretbox_MACBYTES)try{const ot=await decryptCryptoboxPayload(st,et.receive);logger$4.log("listenForEncryptedMessage",`received a message from ${$}`,ot),j(ot)}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 st=>{if(st.errcode==="M_FORBIDDEN"){logger$4.log("sendMessage","M_FORBIDDEN",nt,st),await this.deleteRoomIdFromRooms(nt);const ot=await this.getRelevantRoom(rt);logger$4.log("sendMessage","Old room deleted, new room created",ot),(await this.client.promise).sendTextMessage(ot,it).catch(async at=>{logger$4.log("sendMessage","inner error",ot,at)})}else logger$4.log("sendMessage","unexpected error",st)})}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 st=>{if(st.errcode==="M_FORBIDDEN"){logger$4.log("sendPairingResponse","M_FORBIDDEN",tt,st),await this.deleteRoomIdFromRooms(tt);const ot=await this.getRelevantRoom(et);logger$4.log("sendPairingResponse","Old room deleted, new room created",ot),(await this.client.promise).sendTextMessage(ot,it).catch(async at=>{logger$4.log("sendPairingResponse","inner error",ot,at)})}else logger$4.log("sendPairingResponse","unexpected error",st)})}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 st=>{`@${await getHexHash(Buffer$g.from(st.publicKey,"hex"))}`===et&&st.relayServer!==tt&&(st.relayServer=tt,await rt.addPeer(st))});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$1(a,_){return function(){return a.apply(_,arguments)}}const{toString:toString$3}=Object.prototype,{getPrototypeOf:getPrototypeOf$3}=Object,kindOf=(a=>_=>{const $=toString$3.call(_);return a[$]||(a[$]=$.slice(8,-1).toLowerCase())})(Object.create(null)),kindOfTest=a=>(a=a.toLowerCase(),_=>kindOf(_)===a),typeOfTest=a=>_=>typeof _===a,{isArray:isArray$3}=Array,isUndefined=typeOfTest("undefined");function isBuffer$1(a){return a!==null&&!isUndefined(a)&&a.constructor!==null&&!isUndefined(a.constructor)&&isFunction$2(a.constructor.isBuffer)&&a.constructor.isBuffer(a)}const isArrayBuffer=kindOfTest("ArrayBuffer");function isArrayBufferView(a){let _;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?_=ArrayBuffer.isView(a):_=a&&a.buffer&&isArrayBuffer(a.buffer),_}const isString$1=typeOfTest("string"),isFunction$2=typeOfTest("function"),isNumber=typeOfTest("number"),isObject$2=a=>a!==null&&typeof a=="object",isBoolean$1=a=>a===!0||a===!1,isPlainObject$4=a=>{if(kindOf(a)!=="object")return!1;const _=getPrototypeOf$3(a);return(_===null||_===Object.prototype||Object.getPrototypeOf(_)===null)&&!(Symbol.toStringTag in a)&&!(Symbol.iterator in a)},isDate$1=kindOfTest("Date"),isFile=kindOfTest("File"),isBlob=kindOfTest("Blob"),isFileList=kindOfTest("FileList"),isStream=a=>isObject$2(a)&&isFunction$2(a.pipe),isFormData=a=>{let _;return a&&(typeof FormData=="function"&&a instanceof FormData||isFunction$2(a.append)&&((_=kindOf(a))==="formdata"||_==="object"&&isFunction$2(a.toString)&&a.toString()==="[object FormData]"))},isURLSearchParams=kindOfTest("URLSearchParams"),[isReadableStream,isRequest,isResponse,isHeaders]=["ReadableStream","Request","Response","Headers"].map(kindOfTest),trim$1=a=>a.trim?a.trim():a.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function forEach(a,_,{allOwnKeys:$=!1}={}){if(a===null||typeof a>"u")return;let j,et;if(typeof a!="object"&&(a=[a]),isArray$3(a))for(j=0,et=a.length;j0;)if(et=$[j],_===et.toLowerCase())return et;return null}const _global=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global$1,isContextDefined=a=>!isUndefined(a)&&a!==_global;function merge(){const{caseless:a}=isContextDefined(this)&&this||{},_={},$=(j,et)=>{const tt=a&&findKey$1(_,et)||et;isPlainObject$4(_[tt])&&isPlainObject$4(j)?_[tt]=merge(_[tt],j):isPlainObject$4(j)?_[tt]=merge({},j):isArray$3(j)?_[tt]=j.slice():_[tt]=j};for(let j=0,et=arguments.length;j(forEach(_,(et,tt)=>{$&&isFunction$2(et)?a[tt]=bind$1(et,$):a[tt]=et},{allOwnKeys:j}),a),stripBOM=a=>(a.charCodeAt(0)===65279&&(a=a.slice(1)),a),inherits$3=(a,_,$,j)=>{a.prototype=Object.create(_.prototype,j),a.prototype.constructor=a,Object.defineProperty(a,"super",{value:_.prototype}),$&&Object.assign(a.prototype,$)},toFlatObject=(a,_,$,j)=>{let et,tt,rt;const nt={};if(_=_||{},a==null)return _;do{for(et=Object.getOwnPropertyNames(a),tt=et.length;tt-- >0;)rt=et[tt],(!j||j(rt,a,_))&&!nt[rt]&&(_[rt]=a[rt],nt[rt]=!0);a=$!==!1&&getPrototypeOf$3(a)}while(a&&(!$||$(a,_))&&a!==Object.prototype);return _},endsWith=(a,_,$)=>{a=String(a),($===void 0||$>a.length)&&($=a.length),$-=_.length;const j=a.indexOf(_,$);return j!==-1&&j===$},toArray$1=a=>{if(!a)return null;if(isArray$3(a))return a;let _=a.length;if(!isNumber(_))return null;const $=new Array(_);for(;_-- >0;)$[_]=a[_];return $},isTypedArray=(a=>_=>a&&_ instanceof a)(typeof Uint8Array<"u"&&getPrototypeOf$3(Uint8Array)),forEachEntry=(a,_)=>{const j=(a&&a[Symbol.iterator]).call(a);let et;for(;(et=j.next())&&!et.done;){const tt=et.value;_.call(a,tt[0],tt[1])}},matchAll=(a,_)=>{let $;const j=[];for(;($=a.exec(_))!==null;)j.push($);return j},isHTMLForm=kindOfTest("HTMLFormElement"),toCamelCase=a=>a.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function($,j,et){return j.toUpperCase()+et}),hasOwnProperty=(({hasOwnProperty:a})=>(_,$)=>a.call(_,$))(Object.prototype),isRegExp=kindOfTest("RegExp"),reduceDescriptors=(a,_)=>{const $=Object.getOwnPropertyDescriptors(a),j={};forEach($,(et,tt)=>{let rt;(rt=_(et,tt,a))!==!1&&(j[tt]=rt||et)}),Object.defineProperties(a,j)},freezeMethods=a=>{reduceDescriptors(a,(_,$)=>{if(isFunction$2(a)&&["arguments","caller","callee"].indexOf($)!==-1)return!1;const j=a[$];if(isFunction$2(j)){if(_.enumerable=!1,"writable"in _){_.writable=!1;return}_.set||(_.set=()=>{throw Error("Can not rewrite read-only method '"+$+"'")})}})},toObjectSet=(a,_)=>{const $={},j=et=>{et.forEach(tt=>{$[tt]=!0})};return isArray$3(a)?j(a):j(String(a).split(_)),$},noop$6=()=>{},toFiniteNumber=(a,_)=>a!=null&&Number.isFinite(a=+a)?a:_,ALPHA="abcdefghijklmnopqrstuvwxyz",DIGIT="0123456789",ALPHABET$1={DIGIT,ALPHA,ALPHA_DIGIT:ALPHA+ALPHA.toUpperCase()+DIGIT},generateString=(a=16,_=ALPHABET$1.ALPHA_DIGIT)=>{let $="";const{length:j}=_;for(;a--;)$+=_[Math.random()*j|0];return $};function isSpecCompliantForm(a){return!!(a&&isFunction$2(a.append)&&a[Symbol.toStringTag]==="FormData"&&a[Symbol.iterator])}const toJSONObject=a=>{const _=new Array(10),$=(j,et)=>{if(isObject$2(j)){if(_.indexOf(j)>=0)return;if(!("toJSON"in j)){_[et]=j;const tt=isArray$3(j)?[]:{};return forEach(j,(rt,nt)=>{const it=$(rt,et+1);!isUndefined(it)&&(tt[nt]=it)}),_[et]=void 0,tt}}return j};return $(a,0)},isAsyncFn=kindOfTest("AsyncFunction"),isThenable$1=a=>a&&(isObject$2(a)||isFunction$2(a))&&isFunction$2(a.then)&&isFunction$2(a.catch),utils$g={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$3,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=a,this.name="AxiosError",_&&(this.code=_),$&&(this.config=$),j&&(this.request=j),et&&(this.response=et)}utils$g.inherits(AxiosError,Error,{toJSON:function a(){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$g.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(a=>{descriptors[a]={value:a}});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$g.toFlatObject(a,rt,function(it){return it!==Error.prototype},nt=>nt!=="isAxiosError"),AxiosError.call(rt,a.message,_,$,j,et),rt.cause=a,rt.name=a.name,tt&&Object.assign(rt,tt),rt};const httpAdapter=null;function isVisitable(a){return utils$g.isPlainObject(a)||utils$g.isArray(a)}function removeBrackets(a){return utils$g.endsWith(a,"[]")?a.slice(0,-2):a}function renderKey(a,_,$){return a?a.concat(_).map(function(et,tt){return et=removeBrackets(et),!$&&tt?"["+et+"]":et}).join($?".":""):_}function isFlatArray(a){return utils$g.isArray(a)&&!a.some(isVisitable)}const predicates=utils$g.toFlatObject(utils$g,{},null,function a(_){return/^is[A-Z]/.test(_)});function toFormData(a,_,$){if(!utils$g.isObject(a))throw new TypeError("target must be an object");_=_||new FormData,$=utils$g.toFlatObject($,{metaTokens:!0,dots:!1,indexes:!1},!1,function(wt,Ct){return!utils$g.isUndefined(Ct[wt])});const j=$.metaTokens,et=$.visitor||ot,tt=$.dots,rt=$.indexes,it=($.Blob||typeof Blob<"u"&&Blob)&&utils$g.isSpecCompliantForm(_);if(!utils$g.isFunction(et))throw new TypeError("visitor must be a function");function st(yt){if(yt===null)return"";if(utils$g.isDate(yt))return yt.toISOString();if(!it&&utils$g.isBlob(yt))throw new AxiosError("Blob is not supported. Use a Buffer instead.");return utils$g.isArrayBuffer(yt)||utils$g.isTypedArray(yt)?it&&typeof Blob=="function"?new Blob([yt]):Buffer$g.from(yt):yt}function ot(yt,wt,Ct){let Pt=yt;if(yt&&!Ct&&typeof yt=="object"){if(utils$g.endsWith(wt,"{}"))wt=j?wt:wt.slice(0,-2),yt=JSON.stringify(yt);else if(utils$g.isArray(yt)&&isFlatArray(yt)||(utils$g.isFileList(yt)||utils$g.endsWith(wt,"[]"))&&(Pt=utils$g.toArray(yt)))return wt=removeBrackets(wt),Pt.forEach(function(Mt,Lt){!(utils$g.isUndefined(Mt)||Mt===null)&&_.append(rt===!0?renderKey([wt],Lt,tt):rt===null?wt:wt+"[]",st(Mt))}),!1}return isVisitable(yt)?!0:(_.append(renderKey(Ct,wt,tt),st(yt)),!1)}const at=[],ut=Object.assign(predicates,{defaultVisitor:ot,convertValue:st,isVisitable});function ht(yt,wt){if(!utils$g.isUndefined(yt)){if(at.indexOf(yt)!==-1)throw Error("Circular reference detected in "+wt.join("."));at.push(yt),utils$g.forEach(yt,function(Pt,$t){(!(utils$g.isUndefined(Pt)||Pt===null)&&et.call(_,Pt,utils$g.isString($t)?$t.trim():$t,wt,ut))===!0&&ht(Pt,wt?wt.concat($t):[$t])}),at.pop()}}if(!utils$g.isObject(a))throw new TypeError("data must be an object");return ht(a),_}function encode$4(a){const _={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(a).replace(/[!'()~]|%20|%00/g,function(j){return _[j]})}function AxiosURLSearchParams(a,_){this._pairs=[],a&&toFormData(a,this,_)}const prototype=AxiosURLSearchParams.prototype;prototype.append=function a(_,$){this._pairs.push([_,$])};prototype.toString=function a(_){const $=_?function(j){return _.call(this,j,encode$4)}:encode$4;return this._pairs.map(function(et){return $(et[0])+"="+$(et[1])},"").join("&")};function encode$3(a){return encodeURIComponent(a).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function buildURL(a,_,$){if(!_)return a;const j=$&&$.encode||encode$3,et=$&&$.serialize;let tt;if(et?tt=et(_,$):tt=utils$g.isURLSearchParams(_)?_.toString():new AxiosURLSearchParams(_,$).toString(j),tt){const rt=a.indexOf("#");rt!==-1&&(a=a.slice(0,rt)),a+=(a.indexOf("?")===-1?"?":"&")+tt}return a}class InterceptorManager{constructor(){this.handlers=[]}use(_,$,j){return this.handlers.push({fulfilled:_,rejected:$,synchronous:j?j.synchronous:!1,runWhen:j?j.runWhen:null}),this.handlers.length-1}eject(_){this.handlers[_]&&(this.handlers[_]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(_){utils$g.forEach(this.handlers,function(j){j!==null&&_(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=(a=>hasBrowserEnv&&["ReactNative","NativeScript","NS"].indexOf(a)<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$f=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv,hasStandardBrowserEnv,hasStandardBrowserWebWorkerEnv,origin},Symbol.toStringTag,{value:"Module"})),platform={...utils$f,...platform$1};function toURLEncodedForm(a,_){return toFormData(a,new platform.classes.URLSearchParams,Object.assign({visitor:function($,j,et,tt){return platform.isNode&&utils$g.isBuffer($)?(this.append(j,$.toString("base64")),!1):tt.defaultVisitor.apply(this,arguments)}},_))}function parsePropPath(a){return utils$g.matchAll(/\w+|\[(\w*)]/g,a).map(_=>_[0]==="[]"?"":_[1]||_[0])}function arrayToObject(a){const _={},$=Object.keys(a);let j;const et=$.length;let tt;for(j=0;j=$.length;return rt=!rt&&utils$g.isArray(et)?et.length:rt,it?(utils$g.hasOwnProp(et,rt)?et[rt]=[et[rt],j]:et[rt]=j,!nt):((!et[rt]||!utils$g.isObject(et[rt]))&&(et[rt]=[]),_($,j,et[rt],tt)&&utils$g.isArray(et[rt])&&(et[rt]=arrayToObject(et[rt])),!nt)}if(utils$g.isFormData(a)&&utils$g.isFunction(a.entries)){const $={};return utils$g.forEachEntry(a,(j,et)=>{_(parsePropPath(j),et,$,0)}),$}return null}function stringifySafely(a,_,$){if(utils$g.isString(a))try{return(_||JSON.parse)(a),utils$g.trim(a)}catch(j){if(j.name!=="SyntaxError")throw j}return($||JSON.stringify)(a)}const defaults$1={transitional:transitionalDefaults,adapter:["xhr","http","fetch"],transformRequest:[function a(_,$){const j=$.getContentType()||"",et=j.indexOf("application/json")>-1,tt=utils$g.isObject(_);if(tt&&utils$g.isHTMLForm(_)&&(_=new FormData(_)),utils$g.isFormData(_))return et?JSON.stringify(formDataToJSON(_)):_;if(utils$g.isArrayBuffer(_)||utils$g.isBuffer(_)||utils$g.isStream(_)||utils$g.isFile(_)||utils$g.isBlob(_)||utils$g.isReadableStream(_))return _;if(utils$g.isArrayBufferView(_))return _.buffer;if(utils$g.isURLSearchParams(_))return $.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),_.toString();let nt;if(tt){if(j.indexOf("application/x-www-form-urlencoded")>-1)return toURLEncodedForm(_,this.formSerializer).toString();if((nt=utils$g.isFileList(_))||j.indexOf("multipart/form-data")>-1){const it=this.env&&this.env.FormData;return toFormData(nt?{"files[]":_}:_,it&&new it,this.formSerializer)}}return tt||et?($.setContentType("application/json",!1),stringifySafely(_)):_}],transformResponse:[function a(_){const $=this.transitional||defaults$1.transitional,j=$&&$.forcedJSONParsing,et=this.responseType==="json";if(utils$g.isResponse(_)||utils$g.isReadableStream(_))return _;if(_&&utils$g.isString(_)&&(j&&!this.responseType||et)){const rt=!($&&$.silentJSONParsing)&&et;try{return JSON.parse(_)}catch(nt){if(rt)throw nt.name==="SyntaxError"?AxiosError.from(nt,AxiosError.ERR_BAD_RESPONSE,this,null,this.response):nt}}return _}],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 _>=200&&_<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};utils$g.forEach(["delete","get","head","post","put","patch"],a=>{defaults$1.headers[a]={}});const ignoreDuplicateOf=utils$g.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=a=>{const _={};let $,j,et;return a&&a.split(` -`).forEach(function(rt){et=rt.indexOf(":"),$=rt.substring(0,et).trim().toLowerCase(),j=rt.substring(et+1).trim(),!(!$||_[$]&&ignoreDuplicateOf[$])&&($==="set-cookie"?_[$]?_[$].push(j):_[$]=[j]:_[$]=_[$]?_[$]+", "+j:j)}),_},$internals=Symbol("internals");function normalizeHeader(a){return a&&String(a).trim().toLowerCase()}function normalizeValue(a){return a===!1||a==null?a:utils$g.isArray(a)?a.map(normalizeValue):String(a)}function parseTokens(a){const _=Object.create(null),$=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let j;for(;j=$.exec(a);)_[j[1]]=j[2];return _}const isValidHeaderName=a=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(a.trim());function matchHeaderValue(a,_,$,j,et){if(utils$g.isFunction(j))return j.call(this,_,$);if(et&&(_=$),!!utils$g.isString(_)){if(utils$g.isString(j))return _.indexOf(j)!==-1;if(utils$g.isRegExp(j))return j.test(_)}}function formatHeader(a){return a.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(_,$,j)=>$.toUpperCase()+j)}function buildAccessors(a,_){const $=utils$g.toCamelCase(" "+_);["get","set","has"].forEach(j=>{Object.defineProperty(a,j+$,{value:function(et,tt,rt){return this[j].call(this,_,et,tt,rt)},configurable:!0})})}class AxiosHeaders{constructor(_){_&&this.set(_)}set(_,$,j){const et=this;function tt(nt,it,st){const ot=normalizeHeader(it);if(!ot)throw new Error("header name must be a non-empty string");const at=utils$g.findKey(et,ot);(!at||et[at]===void 0||st===!0||st===void 0&&et[at]!==!1)&&(et[at||it]=normalizeValue(nt))}const rt=(nt,it)=>utils$g.forEach(nt,(st,ot)=>tt(st,ot,it));if(utils$g.isPlainObject(_)||_ instanceof this.constructor)rt(_,$);else if(utils$g.isString(_)&&(_=_.trim())&&!isValidHeaderName(_))rt(parseHeaders(_),$);else if(utils$g.isHeaders(_))for(const[nt,it]of _.entries())tt(it,nt,j);else _!=null&&tt($,_,j);return this}get(_,$){if(_=normalizeHeader(_),_){const j=utils$g.findKey(this,_);if(j){const et=this[j];if(!$)return et;if($===!0)return parseTokens(et);if(utils$g.isFunction($))return $.call(this,et,j);if(utils$g.isRegExp($))return $.exec(et);throw new TypeError("parser must be boolean|regexp|function")}}}has(_,$){if(_=normalizeHeader(_),_){const j=utils$g.findKey(this,_);return!!(j&&this[j]!==void 0&&(!$||matchHeaderValue(this,this[j],j,$)))}return!1}delete(_,$){const j=this;let et=!1;function tt(rt){if(rt=normalizeHeader(rt),rt){const nt=utils$g.findKey(j,rt);nt&&(!$||matchHeaderValue(j,j[nt],nt,$))&&(delete j[nt],et=!0)}}return utils$g.isArray(_)?_.forEach(tt):tt(_),et}clear(_){const $=Object.keys(this);let j=$.length,et=!1;for(;j--;){const tt=$[j];(!_||matchHeaderValue(this,this[tt],tt,_,!0))&&(delete this[tt],et=!0)}return et}normalize(_){const $=this,j={};return utils$g.forEach(this,(et,tt)=>{const rt=utils$g.findKey(j,tt);if(rt){$[rt]=normalizeValue(et),delete $[tt];return}const nt=_?formatHeader(tt):String(tt).trim();nt!==tt&&delete $[tt],$[nt]=normalizeValue(et),j[nt]=!0}),this}concat(..._){return this.constructor.concat(this,..._)}toJSON(_){const $=Object.create(null);return utils$g.forEach(this,(j,et)=>{j!=null&&j!==!1&&($[et]=_&&utils$g.isArray(j)?j.join(", "):j)}),$}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([_,$])=>_+": "+$).join(` -`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(_){return _ instanceof this?_:new this(_)}static concat(_,...$){const j=new this(_);return $.forEach(et=>j.set(et)),j}static accessor(_){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$g.isArray(_)?_.forEach(tt):tt(_),this}}AxiosHeaders.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);utils$g.reduceDescriptors(AxiosHeaders.prototype,({value:a},_)=>{let $=_[0].toUpperCase()+_.slice(1);return{get:()=>a,set(j){this[$]=j}}});utils$g.freezeMethods(AxiosHeaders);function transformData(a,_){const $=this||defaults$1,j=_||$,et=AxiosHeaders.from(j.headers);let tt=j.data;return utils$g.forEach(a,function(nt){tt=nt.call($,tt,et.normalize(),_?_.status:void 0)}),et.normalize(),tt}function isCancel(a){return!!(a&&a.__CANCEL__)}function CanceledError(a,_,$){AxiosError.call(this,a??"canceled",AxiosError.ERR_CANCELED,_,$),this.name="CanceledError"}utils$g.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(a){const _=/^([-+\w]{1,25})(:?\/\/|:)/.exec(a);return _&&_[1]||""}function speedometer(a,_){a=a||10;const $=new Array(a),j=new Array(a);let et=0,tt=0,rt;return _=_!==void 0?_:1e3,function(it){const st=Date.now(),ot=j[tt];rt||(rt=st),$[et]=it,j[et]=st;let at=tt,ut=0;for(;at!==et;)ut+=$[at++],at=at%a;if(et=(et+1)%a,et===tt&&(tt=(tt+1)%a),st-rt<_)return;const ht=ot&&st-ot;return ht?Math.round(ut*1e3/ht):void 0}}function throttle(a,_){let $=0;const j=1e3/_;let et=null;return function(){const rt=this===!0,nt=Date.now();if(rt||nt-$>j)return et&&(clearTimeout(et),et=null),$=nt,a.apply(null,arguments);et||(et=setTimeout(()=>(et=null,$=Date.now(),a.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,st=et(it),ot=rt<=nt;j=rt;const at={loaded:rt,total:nt,progress:nt?rt/nt:void 0,bytes:it,rate:st||void 0,estimated:st&&nt&&ot?(nt-rt)/st:void 0,event:tt,lengthComputable:nt!=null};at[_?"download":"upload"]=!0,a(at)},$)},isURLSameOrigin=platform.hasStandardBrowserEnv?function a(){const _=/(msie|trident)/i.test(navigator.userAgent),$=document.createElement("a");let j;function et(tt){let rt=tt;return _&&($.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$g.isString(rt)?et(rt):rt;return nt.protocol===j.protocol&&nt.host===j.host}}():function a(){return function(){return!0}}(),cookies=platform.hasStandardBrowserEnv?{write(a,_,$,j,et,tt){const rt=[a+"="+encodeURIComponent(_)];utils$g.isNumber($)&&rt.push("expires="+new Date($).toGMTString()),utils$g.isString(j)&&rt.push("path="+j),utils$g.isString(et)&&rt.push("domain="+et),tt===!0&&rt.push("secure"),document.cookie=rt.join("; ")},read(a){const _=document.cookie.match(new RegExp("(^|;\\s*)("+a+")=([^;]*)"));return _?decodeURIComponent(_[3]):null},remove(a){this.write(a,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function isAbsoluteURL(a){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(a)}function combineURLs(a,_){return _?a.replace(/\/?\/$/,"")+"/"+_.replace(/^\/+/,""):a}function buildFullPath(a,_){return a&&!isAbsoluteURL(_)?combineURLs(a,_):_}const headersToObject=a=>a instanceof AxiosHeaders?{...a}:a;function mergeConfig(a,_){_=_||{};const $={};function j(st,ot,at){return utils$g.isPlainObject(st)&&utils$g.isPlainObject(ot)?utils$g.merge.call({caseless:at},st,ot):utils$g.isPlainObject(ot)?utils$g.merge({},ot):utils$g.isArray(ot)?ot.slice():ot}function et(st,ot,at){if(utils$g.isUndefined(ot)){if(!utils$g.isUndefined(st))return j(void 0,st,at)}else return j(st,ot,at)}function tt(st,ot){if(!utils$g.isUndefined(ot))return j(void 0,ot)}function rt(st,ot){if(utils$g.isUndefined(ot)){if(!utils$g.isUndefined(st))return j(void 0,st)}else return j(void 0,ot)}function nt(st,ot,at){if(at in _)return j(st,ot);if(at in a)return j(void 0,st)}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:(st,ot)=>et(headersToObject(st),headersToObject(ot),!0)};return utils$g.forEach(Object.keys(Object.assign({},a,_)),function(ot){const at=it[ot]||et,ut=at(a[ot],_[ot],ot);utils$g.isUndefined(ut)&&at!==nt||($[ot]=ut)}),$}const resolveConfig=a=>{const _=mergeConfig({},a);let{data:$,withXSRFToken:j,xsrfHeaderName:et,xsrfCookieName:tt,headers:rt,auth:nt}=_;_.headers=rt=AxiosHeaders.from(rt),_.url=buildURL(buildFullPath(_.baseURL,_.url),a.params,a.paramsSerializer),nt&&rt.set("Authorization","Basic "+btoa((nt.username||"")+":"+(nt.password?unescape(encodeURIComponent(nt.password)):"")));let it;if(utils$g.isFormData($)){if(platform.hasStandardBrowserEnv||platform.hasStandardBrowserWebWorkerEnv)rt.setContentType(void 0);else if((it=rt.getContentType())!==!1){const[st,...ot]=it?it.split(";").map(at=>at.trim()).filter(Boolean):[];rt.setContentType([st||"multipart/form-data",...ot].join("; "))}}if(platform.hasStandardBrowserEnv&&(j&&utils$g.isFunction(j)&&(j=j(_)),j||j!==!1&&isURLSameOrigin(_.url))){const st=et&&tt&&cookies.read(tt);st&&rt.set(et,st)}return _},isXHRAdapterSupported=typeof XMLHttpRequest<"u",xhrAdapter=isXHRAdapterSupported&&function(a){return new Promise(function($,j){const et=resolveConfig(a);let tt=et.data;const rt=AxiosHeaders.from(et.headers).normalize();let{responseType:nt}=et,it;function st(){et.cancelToken&&et.cancelToken.unsubscribe(it),et.signal&&et.signal.removeEventListener("abort",it)}let ot=new XMLHttpRequest;ot.open(et.method.toUpperCase(),et.url,!0),ot.timeout=et.timeout;function at(){if(!ot)return;const ht=AxiosHeaders.from("getAllResponseHeaders"in ot&&ot.getAllResponseHeaders()),wt={data:!nt||nt==="text"||nt==="json"?ot.responseText:ot.response,status:ot.status,statusText:ot.statusText,headers:ht,config:a,request:ot};settle(function(Pt){$(Pt),st()},function(Pt){j(Pt),st()},wt),ot=null}"onloadend"in ot?ot.onloadend=at:ot.onreadystatechange=function(){!ot||ot.readyState!==4||ot.status===0&&!(ot.responseURL&&ot.responseURL.indexOf("file:")===0)||setTimeout(at)},ot.onabort=function(){ot&&(j(new AxiosError("Request aborted",AxiosError.ECONNABORTED,et,ot)),ot=null)},ot.onerror=function(){j(new AxiosError("Network Error",AxiosError.ERR_NETWORK,et,ot)),ot=null},ot.ontimeout=function(){let yt=et.timeout?"timeout of "+et.timeout+"ms exceeded":"timeout exceeded";const wt=et.transitional||transitionalDefaults;et.timeoutErrorMessage&&(yt=et.timeoutErrorMessage),j(new AxiosError(yt,wt.clarifyTimeoutError?AxiosError.ETIMEDOUT:AxiosError.ECONNABORTED,et,ot)),ot=null},tt===void 0&&rt.setContentType(null),"setRequestHeader"in ot&&utils$g.forEach(rt.toJSON(),function(yt,wt){ot.setRequestHeader(wt,yt)}),utils$g.isUndefined(et.withCredentials)||(ot.withCredentials=!!et.withCredentials),nt&&nt!=="json"&&(ot.responseType=et.responseType),typeof et.onDownloadProgress=="function"&&ot.addEventListener("progress",progressEventReducer(et.onDownloadProgress,!0)),typeof et.onUploadProgress=="function"&&ot.upload&&ot.upload.addEventListener("progress",progressEventReducer(et.onUploadProgress)),(et.cancelToken||et.signal)&&(it=ht=>{ot&&(j(!ht||ht.type?new CanceledError(null,a,ot):ht),ot.abort(),ot=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,a));return}ot.send(tt||null)})},composeSignals=(a,_)=>{let $=new AbortController,j;const et=function(it){if(!j){j=!0,rt();const st=it instanceof Error?it:this.reason;$.abort(st instanceof AxiosError?st:new CanceledError(st instanceof Error?st.message:st))}};let tt=_&&setTimeout(()=>{et(new AxiosError(`timeout ${_} of ms exceeded`,AxiosError.ETIMEDOUT))},_);const rt=()=>{a&&(tt&&clearTimeout(tt),tt=null,a.forEach(it=>{it&&(it.removeEventListener?it.removeEventListener("abort",et):it.unsubscribe(et))}),a=null)};a.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 $=a.byteLength;if(!_||$<_){yield a;return}let j=0,et;for(;j<$;)et=j+_,yield a.slice(j,et),j=et},readBytes=async function*(a,_,$){for await(const j of a)yield*streamChunk(ArrayBuffer.isView(j)?j:await $(String(j)),_)},trackStream=(a,_,$,j,et)=>{const tt=readBytes(a,_,et);let rt=0;return new ReadableStream({type:"bytes",async pull(nt){const{done:it,value:st}=await tt.next();if(it){nt.close(),j();return}let ot=st.byteLength;$&&$(rt+=ot),nt.enqueue(new Uint8Array(st))},cancel(nt){return j(nt),tt.return()}},{highWaterMark:2})},fetchProgressDecorator=(a,_)=>{const $=a!=null;return j=>setTimeout(()=>_({lengthComputable:$,total:a,loaded:j}))},isFetchSupported=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",isReadableStreamSupported=isFetchSupported&&typeof ReadableStream=="function",encodeText=isFetchSupported&&(typeof TextEncoder=="function"?(a=>_=>a.encode(_))(new TextEncoder):async a=>new Uint8Array(await new Response(a).arrayBuffer())),supportsRequestStream=isReadableStreamSupported&&(()=>{let a=!1;const _=new Request(platform.origin,{body:new ReadableStream,method:"POST",get duplex(){return a=!0,"half"}}).headers.has("Content-Type");return a&&!_})(),DEFAULT_CHUNK_SIZE=64*1024,supportsResponseStream=isReadableStreamSupported&&!!(()=>{try{return utils$g.isReadableStream(new Response("").body)}catch{}})(),resolvers={stream:supportsResponseStream&&(a=>a.body)};isFetchSupported&&(a=>{["text","arrayBuffer","blob","formData","stream"].forEach(_=>{!resolvers[_]&&(resolvers[_]=utils$g.isFunction(a[_])?$=>$[_]():($,j)=>{throw new AxiosError(`Response type '${_}' is not supported`,AxiosError.ERR_NOT_SUPPORT,j)})})})(new Response);const getBodyLength=async a=>{if(a==null)return 0;if(utils$g.isBlob(a))return a.size;if(utils$g.isSpecCompliantForm(a))return(await new Request(a).arrayBuffer()).byteLength;if(utils$g.isArrayBufferView(a))return a.byteLength;if(utils$g.isURLSearchParams(a)&&(a=a+""),utils$g.isString(a))return(await encodeText(a)).byteLength},resolveBodyLength=async(a,_)=>{const $=utils$g.toFiniteNumber(a.getContentLength());return $??getBodyLength(_)},fetchAdapter=isFetchSupported&&(async a=>{let{url:_,method:$,data:j,signal:et,cancelToken:tt,timeout:rt,onDownloadProgress:nt,onUploadProgress:it,responseType:st,headers:ot,withCredentials:at="same-origin",fetchOptions:ut}=resolveConfig(a);st=st?(st+"").toLowerCase():"text";let[ht,yt]=et||tt||rt?composeSignals([et,tt],rt):[],wt,Ct;const Pt=()=>{!wt&&setTimeout(()=>{ht&&ht.unsubscribe()}),wt=!0};let $t;try{if(it&&supportsRequestStream&&$!=="get"&&$!=="head"&&($t=await resolveBodyLength(ot,j))!==0){let zt=new Request(_,{method:"POST",body:j,duplex:"half"}),Ot;utils$g.isFormData(j)&&(Ot=zt.headers.get("content-type"))&&ot.setContentType(Ot),zt.body&&(j=trackStream(zt.body,DEFAULT_CHUNK_SIZE,fetchProgressDecorator($t,progressEventReducer(it)),null,encodeText))}utils$g.isString(at)||(at=at?"cors":"omit"),Ct=new Request(_,{...ut,signal:ht,method:$.toUpperCase(),headers:ot.normalize().toJSON(),body:j,duplex:"half",withCredentials:at});let Mt=await fetch(Ct);const Lt=supportsResponseStream&&(st==="stream"||st==="response");if(supportsResponseStream&&(nt||Lt)){const zt={};["status","statusText","headers"].forEach(It=>{zt[It]=Mt[It]});const Ot=utils$g.toFiniteNumber(Mt.headers.get("content-length"));Mt=new Response(trackStream(Mt.body,DEFAULT_CHUNK_SIZE,nt&&fetchProgressDecorator(Ot,progressEventReducer(nt,!0)),Lt&&Pt,encodeText),zt)}st=st||"text";let Dt=await resolvers[utils$g.findKey(resolvers,st)||"text"](Mt,a);return!Lt&&Pt(),yt&&yt(),await new Promise((zt,Ot)=>{settle(zt,Ot,{data:Dt,headers:AxiosHeaders.from(Mt.headers),status:Mt.status,statusText:Mt.statusText,config:a,request:Ct})})}catch(Mt){throw Pt(),Mt&&Mt.name==="TypeError"&&/fetch/i.test(Mt.message)?Object.assign(new AxiosError("Network Error",AxiosError.ERR_NETWORK,a,Ct),{cause:Mt.cause||Mt}):AxiosError.from(Mt,Mt&&Mt.code,a,Ct)}}),knownAdapters={http:httpAdapter,xhr:xhrAdapter,fetch:fetchAdapter};utils$g.forEach(knownAdapters,(a,_)=>{if(a){try{Object.defineProperty(a,"name",{value:_})}catch{}Object.defineProperty(a,"adapterName",{value:_})}});const renderReason=a=>`- ${a}`,isResolvedHandle=a=>utils$g.isFunction(a)||a===null||a===!1,adapters={getAdapter:a=>{a=utils$g.isArray(a)?a:[a];const{length:_}=a;let $,j;const et={};for(let tt=0;tt<_;tt++){$=a[tt];let rt;if(j=$,!isResolvedHandle($)&&(j=knownAdapters[(rt=String($)).toLowerCase()],j===void 0))throw new AxiosError(`Unknown adapter '${rt}'`);if(j)break;et[rt||"#"+tt]=j}if(!j){const tt=Object.entries(et).map(([nt,it])=>`adapter ${nt} `+(it===!1?"is not supported by the environment":"is not available in the build"));let rt=_?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(a){if(a.cancelToken&&a.cancelToken.throwIfRequested(),a.signal&&a.signal.aborted)throw new CanceledError(null,a)}function dispatchRequest(a){return throwIfCancellationRequested(a),a.headers=AxiosHeaders.from(a.headers),a.data=transformData.call(a,a.transformRequest),["post","put","patch"].indexOf(a.method)!==-1&&a.headers.setContentType("application/x-www-form-urlencoded",!1),adapters.getAdapter(a.adapter||defaults$1.adapter)(a).then(function(j){return throwIfCancellationRequested(a),j.data=transformData.call(a,a.transformResponse,j),j.headers=AxiosHeaders.from(j.headers),j},function(j){return isCancel(j)||(throwIfCancellationRequested(a),j&&j.response&&(j.response.data=transformData.call(a,a.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[a]=function(j){return typeof j===a||"a"+(_<1?"n ":" ")+a}});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(_===!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"))),_?_(tt,rt,nt):!0}};function assertOptions(a,_,$){if(typeof a!="object")throw new AxiosError("options must be an object",AxiosError.ERR_BAD_OPTION_VALUE);const j=Object.keys(a);let et=j.length;for(;et-- >0;){const tt=j[et],rt=_[tt];if(rt){const nt=a[tt],it=nt===void 0||rt(nt,tt,a);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(_){this.defaults=_,this.interceptors={request:new InterceptorManager,response:new InterceptorManager}}async request(_,$){try{return await this._request(_,$)}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(_,$){typeof _=="string"?($=$||{},$.url=_):$=_||{},$=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$g.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$g.merge(tt.common,tt[$.method]);tt&&utils$g.forEach(["delete","get","head","post","put","patch","common"],yt=>{delete tt[yt]}),$.headers=AxiosHeaders.concat(rt,tt);const nt=[];let it=!0;this.interceptors.request.forEach(function(wt){typeof wt.runWhen=="function"&&wt.runWhen($)===!1||(it=it&&wt.synchronous,nt.unshift(wt.fulfilled,wt.rejected))});const st=[];this.interceptors.response.forEach(function(wt){st.push(wt.fulfilled,wt.rejected)});let ot,at=0,ut;if(!it){const yt=[dispatchRequest.bind(this),void 0];for(yt.unshift.apply(yt,nt),yt.push.apply(yt,st),ut=yt.length,ot=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},_(function(tt,rt,nt){j.reason||(j.reason=new CanceledError(tt,rt,nt),$(j.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(_){if(this.reason){_(this.reason);return}this._listeners?this._listeners.push(_):this._listeners=[_]}unsubscribe(_){if(!this._listeners)return;const $=this._listeners.indexOf(_);$!==-1&&this._listeners.splice($,1)}static source(){let _;return{token:new CancelToken(function(et){_=et}),cancel:_}}}function spread(a){return function($){return a.apply(null,$)}}function isAxiosError(a){return utils$g.isObject(a)&&a.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(a){const _=new Axios(a),$=bind$1(Axios.prototype.request,_);return utils$g.extend($,Axios.prototype,_,{allOwnKeys:!0}),utils$g.extend($,_,null,{allOwnKeys:!0}),$.create=function(et){return createInstance(mergeConfig(a,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(_)};axios.spread=spread;axios.isAxiosError=isAxiosError;axios.mergeConfig=mergeConfig;axios.AxiosHeaders=AxiosHeaders;axios.formToJSON=a=>formDataToJSON(utils$g.isHTMLForm(a)?new FormData(a):a);axios.getAdapter=adapters.getAdapter;axios.HttpStatusCode=HttpStatusCode;axios.default=axios;class WalletP2PTransport extends P2PTransport{constructor(_,$,j,et,tt,rt){super(_,$,j,et,StorageKey.TRANSPORT_P2P_PEERS_WALLET,tt,rt)}async addPeer(_,$=!0){await super.addPeer(_),$&&await this.client.sendPairingResponse(_)}}const logger$2=new Logger("IncomingRequestInterceptor");class IncomingRequestInterceptor{static async intercept(_){logger$2.log("INTERCEPTING REQUEST",_.message),_.message.version==="2"?IncomingRequestInterceptor.handleV2Message(_):_.message.version==="3"&&IncomingRequestInterceptor.handleV3Message(_)}static async getAppMetadata(_,$){const j=await _.getAppMetadata($);if(!j)throw new Error("AppMetadata not found");return j}static async handleV2Message(_){const{message:$,connectionInfo:j,appMetadataManager:et,interceptorCallback:tt}=_;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(_){const{message:$,connectionInfo:j,appMetadataManager:et,interceptorCallback:tt}=_,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(a){throw new Error("Function not implemented.")}const logger$1=new Logger("OutgoingResponseInterceptor");class OutgoingResponseInterceptor{static async intercept(_){_.request.version==="2"?OutgoingResponseInterceptor.handleV2Message(_):_.request.version==="3"&&OutgoingResponseInterceptor.handleV3Message(_)}static async handleV3Message(_){const{message:$,appMetadataManager:j,interceptorCallback:et}=_,rt=$.message;logger$1.log("LOGGING OUTGOING V3",rt,j),et($)}static async handleV2Message(_){const{senderId:$,request:j,message:et,ownAppMetadata:tt,permissionManager:rt,appMetadataManager:nt,interceptorCallback:it}=_;switch(et.type){case BeaconMessageType.Error:{const st={type:et.type,version:"2",senderId:$,id:et.id,errorType:et.errorType};if(et.errorType===BeaconErrorType.TRANSACTION_INVALID_ERROR&&et.errorData){const ot=et.errorData;Array.isArray(ot)&&ot.every(at=>!!at.kind&&!!at.id)?st.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(st);break}case BeaconMessageType.Acknowledge:{const st={type:et.type,version:"2",senderId:$,id:et.id};it(st);break}case BeaconMessageType.PermissionResponse:{const st={senderId:$,version:"2",appMetadata:tt,...et};if(!st.address&&!st.publicKey)throw new Error("Address or PublicKey must be defined");const ot=st.publicKey,at=st.address??await getAddressFromPublicKey(ot);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,st.network),senderId:j.senderId,appMetadata:ut,website:"",address:at,publicKey:ot,network:st.network,scopes:st.scopes,connectedAt:new Date().getTime()};rt.addPermission(ht).catch(console.error),it(st);break}case BeaconMessageType.OperationResponse:{const st={senderId:$,version:"2",...et};it(st)}break;case BeaconMessageType.SignPayloadResponse:{const st={senderId:$,version:"2",...et};it(st)}break;case BeaconMessageType.BroadcastResponse:{const st={senderId:$,version:"2",...et};it(st)}break;case BeaconMessageType.ProofOfEventChallengeResponse:{const st={senderId:$,version:"2",...et};it(st)}break;case BeaconMessageType.SimulatedProofOfEventChallengeResponse:{const st={senderId:$,version:"2",...et};it(st)}break;default:logger$1.log("intercept","Message not handled"),assertNever()}}}function assertNever(a){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 st=await this.storage.get(StorageKey.PUSH_TOKENS),ot=st.find(ht=>ht.publicKey===tt&&ht.backendUrl===et);if(ot)return ot;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 st.push(ut),await this.storage.set(StorageKey.PUSH_TOKENS,st),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(a){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(a)}function ownKeys$8(a,_){var $=Object.keys(a);if(Object.getOwnPropertySymbols){var j=Object.getOwnPropertySymbols(a);_&&(j=j.filter(function(et){return Object.getOwnPropertyDescriptor(a,et).enumerable})),$.push.apply($,j)}return $}function _objectSpread$8(a){for(var _=1;_=0)&&Object.prototype.propertyIsEnumerable.call(a,j)&&($[j]=a[j])}return $}function _objectWithoutPropertiesLoose$2(a,_){if(a==null)return{};var $={},j=Object.keys(a),et,tt;for(tt=0;tt=0)&&($[et]=a[et]);return $}var DEFAULT_TIMEOUT=5e3;function persistReducer(a,_){var $=a.version!==void 0?a.version:DEFAULT_VERSION;a.debug;var j=a.stateReconciler===void 0?autoMergeLevel1:a.stateReconciler,et=a.getStoredState||getStoredState,tt=a.timeout!==void 0?a.timeout:DEFAULT_TIMEOUT,rt=null,nt=!1,it=!0,st=function(at){return at._persist.rehydrated&&rt&&!it&&rt.update(at),at};return function(ot,at){var ut=ot||{},ht=ut._persist,yt=_objectWithoutProperties$1(ut,["_persist"]),wt=yt;if(at.type===PERSIST){var Ct=!1,Pt=function(It,Bt){Ct||(at.rehydrate(a.key,It,Bt),Ct=!0)};if(tt&&setTimeout(function(){!Ct&&Pt(void 0,new Error('redux-persist: persist timed out for persist key "'.concat(a.key,'"')))},tt),it=!1,rt||(rt=createPersistoid(a)),ht)return _objectSpread$7({},_(wt,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(a.key),et(a).then(function(Ot){var It=a.migrate||function(Bt,Ft){return Promise.resolve(Bt)};It(Ot,$).then(function(Bt){Pt(Bt)},function(Bt){Pt(void 0,Bt)})},function(Ot){Pt(void 0,Ot)}),_objectSpread$7({},_(wt,at),{_persist:{version:$,rehydrated:!1}})}else{if(at.type===PURGE)return nt=!0,at.result(purgeStoredState(a)),_objectSpread$7({},_(wt,at),{_persist:ht});if(at.type===FLUSH)return at.result(rt&&rt.flush()),_objectSpread$7({},_(wt,at),{_persist:ht});if(at.type===PAUSE)it=!0;else if(at.type===REHYDRATE){if(nt)return _objectSpread$7({},wt,{_persist:_objectSpread$7({},ht,{rehydrated:!0})});if(at.key===a.key){var $t=_(wt,at),Mt=at.payload,Lt=j!==!1&&Mt!==void 0?j(Mt,ot,$t,a):$t,Dt=_objectSpread$7({},Lt,{_persist:_objectSpread$7({},ht,{rehydrated:!0})});return st(Dt)}}}if(!ht)return _(ot,at);var zt=_(wt,at);return zt===wt?ot:st(_objectSpread$7({},zt,{_persist:ht}))}}function formatProdErrorMessage$1(a){return`Minified Redux error #${a}; visit https://redux.js.org/Errors?code=${a} 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(a){if(typeof a!="object"||a===null)return!1;let _=a;for(;Object.getPrototypeOf(_)!==null;)_=Object.getPrototypeOf(_);return Object.getPrototypeOf(a)===_||Object.getPrototypeOf(a)===null}function createStore(a,_,$){if(typeof a!="function")throw new Error(formatProdErrorMessage$1(2));if(typeof _=="function"&&typeof $=="function"||typeof $=="function"&&typeof arguments[3]=="function")throw new Error(formatProdErrorMessage$1(0));if(typeof _=="function"&&typeof $>"u"&&($=_,_=void 0),typeof $<"u"){if(typeof $!="function")throw new Error(formatProdErrorMessage$1(1));return $(createStore)(a,_)}let j=a,et=_,tt=new Map,rt=tt,nt=0,it=!1;function st(){rt===tt&&(rt=new Map,tt.forEach((Ct,Pt)=>{rt.set(Pt,Ct)}))}function ot(){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;st();const $t=nt++;return rt.set($t,Ct),function(){if(Pt){if(it)throw new Error(formatProdErrorMessage$1(6));Pt=!1,st(),rt.delete($t),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($t=>{$t()}),Ct}function ht(Ct){if(typeof Ct!="function")throw new Error(formatProdErrorMessage$1(10));j=Ct,ut({type:actionTypes_default.REPLACE})}function yt(){const Ct=at;return{subscribe(Pt){if(typeof Pt!="object"||Pt===null)throw new Error(formatProdErrorMessage$1(11));function $t(){const Lt=Pt;Lt.next&&Lt.next(ot())}return $t(),{unsubscribe:Ct($t)}},[symbol_observable_default](){return this}}}return ut({type:actionTypes_default.INIT}),{dispatch:ut,subscribe:at,getState:ot,replaceReducer:ht,[symbol_observable_default]:yt}}function assertReducerShape(a){Object.keys(a).forEach(_=>{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(a){const _=Object.keys(a),$={};for(let tt=0;tt<_.length;tt++){const rt=_[tt];typeof a[rt]=="function"&&($[rt]=a[rt])}const j=Object.keys($);let et;try{assertReducerShape($)}catch(tt){et=tt}return function(rt={},nt){if(et)throw et;let it=!1;const st={};for(let ot=0;ot"u")throw nt&&nt.type,new Error(formatProdErrorMessage$1(14));st[at]=yt,it=it||yt!==ht}return it=it||j.length!==Object.keys(rt).length,it?st:rt}}function compose(...a){return a.length===0?_=>_:a.length===1?a[0]:a.reduce((_,$)=>(...j)=>_($(...j)))}function applyMiddleware(...a){return _=>($,j)=>{const et=_($,j);let tt=()=>{throw new Error(formatProdErrorMessage$1(15))};const rt={getState:et.getState,dispatch:(it,...st)=>tt(it,...st)},nt=a.map(it=>it(rt));return tt=compose(...nt)(et.dispatch),{...et,dispatch:tt}}}function isAction(a){return isPlainObject$3(a)&&"type"in a&&typeof a.type=="string"}function _toConsumableArray(a){return _arrayWithoutHoles(a)||_iterableToArray(a)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function _iterableToArray(a){if(Symbol.iterator in Object(a)||Object.prototype.toString.call(a)==="[object Arguments]")return Array.from(a)}function _arrayWithoutHoles(a){if(Array.isArray(a)){for(var _=0,$=new Array(a.length);_0&&arguments[0]!==void 0?arguments[0]:initialState$a,$=arguments.length>1?arguments[1]:void 0;switch($.type){case REGISTER:return _objectSpread$6({},_,{registry:[].concat(_toConsumableArray(_.registry),[$.key])});case REHYDRATE:var j=_.registry.indexOf($.key),et=_toConsumableArray(_.registry);return et.splice(j,1),_objectSpread$6({},_,{registry:et,bootstrapped:et.length===0});default:return _}};function persistStore(a,_,$){var j=createStore(persistorReducer,initialState$a,void 0),et=function(it){j.dispatch({type:REGISTER,key:it})},tt=function(it,st,ot){var at={type:REHYDRATE,payload:st,err:ot,key:it};a.dispatch(at),j.dispatch(at)},rt=_objectSpread$6({},j,{purge:function(){var it=[];return a.dispatch({type:PURGE,result:function(ot){it.push(ot)}}),Promise.all(it)},flush:function(){var it=[];return a.dispatch({type:FLUSH,result:function(ot){it.push(ot)}}),Promise.all(it)},pause:function(){a.dispatch({type:PAUSE})},persist:function(){a.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: ${a}. Full error at: https://bit.ly/3cXEKWf`)}var getPrototypeOf$2=Object.getPrototypeOf;function isDraft$1(a){return!!a&&!!a[DRAFT_STATE$1]}function isDraftable$1(a){var _;return a?isPlainObject$2(a)||Array.isArray(a)||!!a[DRAFTABLE$1]||!!((_=a.constructor)!=null&&_[DRAFTABLE$1])||isMap$1(a)||isSet$1(a):!1}var objectCtorString$1=Object.prototype.constructor.toString();function isPlainObject$2(a){if(!a||typeof a!="object")return!1;const _=getPrototypeOf$2(a);if(_===null)return!0;const $=Object.hasOwnProperty.call(_,"constructor")&&_.constructor;return $===Object?!0:typeof $=="function"&&Function.toString.call($)===objectCtorString$1}function each$1(a,_){getArchtype$1(a)===0?Reflect.ownKeys(a).forEach($=>{_($,a[$],a)}):a.forEach(($,j)=>_(j,$,a))}function getArchtype$1(a){const _=a[DRAFT_STATE$1];return _?_.type_:Array.isArray(a)?1:isMap$1(a)?2:isSet$1(a)?3:0}function has$1(a,_){return getArchtype$1(a)===2?a.has(_):Object.prototype.hasOwnProperty.call(a,_)}function set$1(a,_,$){const j=getArchtype$1(a);j===2?a.set(_,$):j===3?a.add($):a[_]=$}function is$1(a,_){return a===_?a!==0||1/a===1/_:a!==a&&_!==_}function isMap$1(a){return a instanceof Map}function isSet$1(a){return a instanceof Set}function latest$1(a){return a.copy_||a.base_}function shallowCopy$1(a,_){if(isMap$1(a))return new Map(a);if(isSet$1(a))return new Set(a);if(Array.isArray(a))return Array.prototype.slice.call(a);if(!_&&isPlainObject$2(a))return getPrototypeOf$2(a)?{...a}:Object.assign(Object.create(null),a);const $=Object.getOwnPropertyDescriptors(a);delete $[DRAFT_STATE$1];let j=Reflect.ownKeys($);for(let et=0;et1&&(a.set=a.add=a.clear=a.delete=dontMutateFrozenCollections$1),Object.freeze(a),_&&Object.entries(a).forEach(([$,j])=>freeze$1(j,!0))),a}function dontMutateFrozenCollections$1(){die$1(2)}function isFrozen$1(a){return Object.isFrozen(a)}var plugins$1={};function getPlugin$1(a){const _=plugins$1[a];return _||die$1(0,a),_}var currentScope$1;function getCurrentScope$1(){return currentScope$1}function createScope$1(a,_){return{drafts_:[],parent_:a,immer_:_,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function usePatchesInScope$1(a,_){_&&(getPlugin$1("Patches"),a.patches_=[],a.inversePatches_=[],a.patchListener_=_)}function revokeScope$1(a){leaveScope$1(a),a.drafts_.forEach(revokeDraft$1),a.drafts_=null}function leaveScope$1(a){a===currentScope$1&&(currentScope$1=a.parent_)}function enterScope$1(a){return currentScope$1=createScope$1(currentScope$1,a)}function revokeDraft$1(a){const _=a[DRAFT_STATE$1];_.type_===0||_.type_===1?_.revoke_():_.revoked_=!0}function processResult$1(a,_){_.unfinalizedDrafts_=_.drafts_.length;const $=_.drafts_[0];return a!==void 0&&a!==$?($[DRAFT_STATE$1].modified_&&(revokeScope$1(_),die$1(4)),isDraftable$1(a)&&(a=finalize$1(_,a),_.parent_||maybeFreeze$1(_,a)),_.patches_&&getPlugin$1("Patches").generateReplacementPatches_($[DRAFT_STATE$1].base_,a,_.patches_,_.inversePatches_)):a=finalize$1(_,$,[]),revokeScope$1(_),_.patches_&&_.patchListener_(_.patches_,_.inversePatches_),a!==NOTHING$1?a:void 0}function finalize$1(a,_,$){if(isFrozen$1(_))return _;const j=_[DRAFT_STATE$1];if(!j)return each$1(_,(et,tt)=>finalizeProperty$1(a,j,_,et,tt,$)),_;if(j.scope_!==a)return _;if(!j.modified_)return maybeFreeze$1(a,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(a,j,et,nt,it,$,rt)),maybeFreeze$1(a,et,!1),$&&a.patches_&&getPlugin$1("Patches").generatePatches_(j,$,a.patches_,a.inversePatches_)}return j.copy_}function finalizeProperty$1(a,_,$,j,et,tt,rt){if(isDraft$1(et)){const nt=tt&&_&&_.type_!==3&&!has$1(_.assigned_,j)?tt.concat(j):void 0,it=finalize$1(a,et,nt);if(set$1($,j,it),isDraft$1(it))a.canAutoFreeze_=!1;else return}else rt&&$.add(et);if(isDraftable$1(et)&&!isFrozen$1(et)){if(!a.immer_.autoFreeze_&&a.unfinalizedDrafts_<1)return;finalize$1(a,et),(!_||!_.scope_.parent_)&&typeof j!="symbol"&&Object.prototype.propertyIsEnumerable.call($,j)&&maybeFreeze$1(a,et)}}function maybeFreeze$1(a,_,$=!1){!a.parent_&&a.immer_.autoFreeze_&&a.canAutoFreeze_&&freeze$1(_,$)}function createProxyProxy$1(a,_){const $=Array.isArray(a),j={type_:$?1:0,scope_:_?_.scope_:getCurrentScope$1(),modified_:!1,finalized_:!1,assigned_:{},parent_:_,base_:a,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(_===DRAFT_STATE$1)return a;const $=latest$1(a);if(!has$1($,_))return readPropFromProto$1(a,$,_);const j=$[_];return a.finalized_||!isDraftable$1(j)?j:j===peek$1(a.base_,_)?(prepareCopy$1(a),a.copy_[_]=createProxy$1(j,a)):j},has(a,_){return _ in latest$1(a)},ownKeys(a){return Reflect.ownKeys(latest$1(a))},set(a,_,$){const j=getDescriptorFromProto$1(latest$1(a),_);if(j!=null&&j.set)return j.set.call(a.draft_,$),!0;if(!a.modified_){const et=peek$1(latest$1(a),_),tt=et==null?void 0:et[DRAFT_STATE$1];if(tt&&tt.base_===$)return a.copy_[_]=$,a.assigned_[_]=!1,!0;if(is$1($,et)&&($!==void 0||has$1(a.base_,_)))return!0;prepareCopy$1(a),markChanged$1(a)}return a.copy_[_]===$&&($!==void 0||_ in a.copy_)||Number.isNaN($)&&Number.isNaN(a.copy_[_])||(a.copy_[_]=$,a.assigned_[_]=!0),!0},deleteProperty(a,_){return peek$1(a.base_,_)!==void 0||_ in a.base_?(a.assigned_[_]=!1,prepareCopy$1(a),markChanged$1(a)):delete a.assigned_[_],a.copy_&&delete a.copy_[_],!0},getOwnPropertyDescriptor(a,_){const $=latest$1(a),j=Reflect.getOwnPropertyDescriptor($,_);return j&&{writable:!0,configurable:a.type_!==1||_!=="length",enumerable:j.enumerable,value:$[_]}},defineProperty(){die$1(11)},getPrototypeOf(a){return getPrototypeOf$2(a.base_)},setPrototypeOf(){die$1(12)}},arrayTraps$1={};each$1(objectTraps$1,(a,_)=>{arrayTraps$1[a]=function(){return arguments[0]=arguments[0][0],_.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,a[0],_,$,a[0])};function peek$1(a,_){const $=a[DRAFT_STATE$1];return($?latest$1($):a)[_]}function readPropFromProto$1(a,_,$){var et;const j=getDescriptorFromProto$1(_,$);return j?"value"in j?j.value:(et=j.get)==null?void 0:et.call(a.draft_):void 0}function getDescriptorFromProto$1(a,_){if(!(_ in a))return;let $=getPrototypeOf$2(a);for(;$;){const j=Object.getOwnPropertyDescriptor($,_);if(j)return j;$=getPrototypeOf$2($)}}function markChanged$1(a){a.modified_||(a.modified_=!0,a.parent_&&markChanged$1(a.parent_))}function prepareCopy$1(a){a.copy_||(a.copy_=shallowCopy$1(a.base_,a.scope_.immer_.useStrictShallowCopy_))}var Immer2$1=class{constructor(_){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(st=rt,...ot){return nt.produce(st,at=>j.call(this,at,...ot))}}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,st=>$(st,...it));let et,tt;return[this.produce($,j,(nt,it)=>{et=nt,tt=it}),et,tt]},typeof(_==null?void 0:_.autoFreeze)=="boolean"&&this.setAutoFreeze(_.autoFreeze),typeof(_==null?void 0:_.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(_.useStrictShallowCopy)}createDraft(_){isDraftable$1(_)||die$1(8),isDraft$1(_)&&(_=current$1(_));const $=enterScope$1(this),j=createProxy$1(_,void 0);return j[DRAFT_STATE$1].isManual_=!0,leaveScope$1($),j}finishDraft(_,$){const j=_&&_[DRAFT_STATE$1];(!j||!j.isManual_)&&die$1(9);const{scope_:et}=j;return usePatchesInScope$1(et,$),processResult$1(void 0,et)}setAutoFreeze(_){this.autoFreeze_=_}setUseStrictShallowCopy(_){this.useStrictShallowCopy_=_}applyPatches(_,$){let j;for(j=$.length-1;j>=0;j--){const tt=$[j];if(tt.path.length===0&&tt.op==="replace"){_=tt.value;break}}j>-1&&($=$.slice(j+1));const et=getPlugin$1("Patches").applyPatches_;return isDraft$1(_)?et(_,$):this.produce(_,tt=>et(tt,$))}};function createProxy$1(a,_){const $=isMap$1(a)?getPlugin$1("MapSet").proxyMap_(a,_):isSet$1(a)?getPlugin$1("MapSet").proxySet_(a,_):createProxyProxy$1(a,_);return(_?_.scope_:getCurrentScope$1()).drafts_.push($),$}function current$1(a){return isDraft$1(a)||die$1(10,a),currentImpl$1(a)}function currentImpl$1(a){if(!isDraftable$1(a)||isFrozen$1(a))return a;const _=a[DRAFT_STATE$1];let $;if(_){if(!_.modified_)return _.base_;_.finalized_=!0,$=shallowCopy$1(a,_.scope_.immer_.useStrictShallowCopy_)}else $=shallowCopy$1(a,!0);return each$1($,(j,et)=>{set$1($,j,currentImpl$1(et))}),_&&(_.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 a}`){if(typeof a!="function")throw new TypeError(_)}function assertIsObject(a,_=`expected an object, instead received ${typeof a}`){if(typeof a!="object")throw new TypeError(_)}function assertIsArrayOfFunctions(a,_="expected all items to be functions, instead received the following types: "){if(!a.every($=>typeof $=="function")){const $=a.map(j=>typeof j=="function"?`function ${j.name||"unnamed"}()`:typeof j).join(", ");throw new TypeError(`${_}[${$}]`)}}var ensureIsArray=a=>Array.isArray(a)?a:[a];function getDependencies(a){const _=Array.isArray(a[0])?a[0]:a;return assertIsArrayOfFunctions(_,"createSelector expects all input-selectors to be functions, but received the following types: "),_}function collectInputSelectorResults(a,_){const $=[],{length:j}=a;for(let et=0;et{$=createCacheNode(),rt.resetResultsCount()},rt.resultsCount=()=>tt,rt.resetResultsCount=()=>{tt=0},rt}function createSelectorCreator(a,..._){const $=typeof a=="function"?{memoize:a,memoizeOptions:_}:a,j=(...et)=>{let tt=0,rt=0,nt,it={},st=et.pop();typeof st=="object"&&(it=st,st=et.pop()),assertIsFunction(st,`createSelector expects an output function after the inputs, but received: [${typeof st}]`);const ot={...$,...it},{memoize:at,memoizeOptions:ut=[],argsMemoize:ht=weakMapMemoize,argsMemoizeOptions:yt=[],devModeChecks:wt={}}=ot,Ct=ensureIsArray(ut),Pt=ensureIsArray(yt),$t=getDependencies(et),Mt=at(function(){return tt++,st.apply(null,arguments)},...Ct),Lt=ht(function(){rt++;const zt=collectInputSelectorResults($t,arguments);return nt=Mt.apply(null,zt),nt},...Pt);return Object.assign(Lt,{resultFunc:st,memoizedResultFunc:Mt,dependencies:$t,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(a,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof a}`);const $=Object.keys(a),j=$.map(tt=>a[tt]);return _(j,(...tt)=>tt.reduce((rt,nt,it)=>(rt[$[it]]=nt,rt),{}))},{withTypes:()=>createStructuredSelector});function createThunkMiddleware(a){return({dispatch:$,getState:j})=>et=>tt=>typeof tt=="function"?tt($,j,a):et(tt)}var thunk=createThunkMiddleware(),withExtraArgument=createThunkMiddleware,createDraftSafeSelectorCreator=(...a)=>{const _=createSelectorCreator(...a),$=Object.assign((...j)=>{const et=_(...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=a=>a&&typeof a.match=="function";function createAction(a,_){function $(...j){if(_){let et=_(...j);if(!et)throw new Error(formatProdErrorMessage(0));return{type:a,payload:et.payload,..."meta"in et&&{meta:et.meta},..."error"in et&&{error:et.error}}}return{type:a,payload:j[0]}}return $.toString=()=>`${a}`,$.type=a,$.match=j=>isAction(j)&&j.type===a,$}var Tuple=class ip extends Array{constructor(..._){super(..._),Object.setPrototypeOf(this,ip.prototype)}static get[Symbol.species](){return ip}concat(..._){return super.concat.apply(this,_)}prepend(..._){return _.length===1&&Array.isArray(_[0])?new ip(..._[0].concat(this)):new ip(..._.concat(this))}};function freezeDraftable(a){return isDraftable$1(a)?produce$1(a,()=>{}):a}function emplace(a,_,$){if(a.has(_)){let et=a.get(_);return $.update&&(et=$.update(et,_,a),a.set(_,et)),et}if(!$.insert)throw new Error(formatProdErrorMessage(10));const j=$.insert(_,a);return a.set(_,j),j}function isBoolean(a){return typeof a=="boolean"}var buildGetDefaultMiddleware=()=>function(_){const{thunk:$=!0,immutableCheck:j=!0,serializableCheck:et=!0,actionCreatorCheck:tt=!0}=_??{};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=(a={type:"raf"})=>_=>(...$)=>{const j=_(...$);let et=!0,tt=!1,rt=!1;const nt=new Set,it=a.type==="tick"?queueMicrotask:a.type==="raf"?rAF:a.type==="callback"?a.queueNotification:createQueueWithTimer(a.timeout),st=()=>{rt=!1,tt&&(tt=!1,nt.forEach(ot=>ot()))};return Object.assign({},j,{subscribe(ot){const at=()=>et&&ot(),ut=j.subscribe(at);return nt.add(ot),()=>{ut(),nt.delete(ot)}},dispatch(ot){var at;try{return et=!((at=ot==null?void 0:ot.meta)!=null&&at[SHOULD_AUTOBATCH]),tt=!et,tt&&(rt||(rt=!0,it(st))),j.dispatch(ot)}finally{et=!0}}})},buildGetDefaultEnhancers=a=>function($){const{autoBatch:j=!0}=$??{};let et=new Tuple(a);return j&&et.push(autoBatchEnhancer(typeof j=="object"?j:void 0)),et},IS_PRODUCTION=!0;function configureStore(a){const _=buildGetDefaultMiddleware(),{reducer:$=void 0,middleware:j,devTools:et=!0,preloadedState:tt=void 0,enhancers:rt=void 0}=a||{};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(_):it=_();let st=compose;et&&(st=composeWithDevTools({trace:!IS_PRODUCTION,...typeof et=="object"&&et}));const ot=applyMiddleware(...it),at=buildGetDefaultEnhancers(ot);let ut=typeof rt=="function"?rt(at):at();const ht=st(...ut);return createStore(nt,tt,ht)}function executeReducerBuilderCallback(a){const _={},$=[];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 _)throw new Error(formatProdErrorMessage(29));return _[nt]=rt,et},addMatcher(tt,rt){return $.push({matcher:tt,reducer:rt}),et},addDefaultCase(tt){return j=tt,et}};return a(et),[_,$,j]}function isStateFunction(a){return typeof a=="function"}function createReducer(a,_){let[$,j,et]=executeReducerBuilderCallback(_),tt;if(isStateFunction(a))tt=()=>freezeDraftable(a());else{const nt=freezeDraftable(a);tt=()=>nt}function rt(nt=tt(),it){let st=[$[it.type],...j.filter(({matcher:ot})=>ot(it)).map(({reducer:ot})=>ot)];return st.filter(ot=>!!ot).length===0&&(st=[et]),st.reduce((ot,at)=>{if(at)if(isDraft$1(ot)){const ht=at(ot,it);return ht===void 0?ot:ht}else{if(isDraftable$1(ot))return produce$1(ot,ut=>at(ut,it));{const ut=at(ot,it);if(ut===void 0){if(ot===null)return ot;throw new Error(formatProdErrorMessage(9))}return ut}}return ot},nt)}return rt.getInitialState=tt,rt}var urlAlphabet="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",nanoid=(a=21)=>{let _="",$=a;for(;$--;)_+=urlAlphabet[Math.random()*64|0];return _},matches=(a,_)=>hasMatchFunction(a)?a.match(_):a(_);function isAnyOf(...a){return _=>a.some($=>matches($,_))}var commonProperties=["name","message","stack","code"],RejectWithValue=class{constructor(a,_){Yr(this,"_type");this.payload=a,this.meta=_}},FulfillWithMeta=class{constructor(a,_){Yr(this,"_type");this.payload=a,this.meta=_}},miniSerializeError=a=>{if(typeof a=="object"&&a!==null){const _={};for(const $ of commonProperties)typeof a[$]=="string"&&(_[$]=a[$]);return _}return{message:String(a)}},createAsyncThunk=(()=>{function a(_,$,j){const et=createAction(_+"/fulfilled",(it,st,ot,at)=>({payload:it,meta:{...at||{},arg:ot,requestId:st,requestStatus:"fulfilled"}})),tt=createAction(_+"/pending",(it,st,ot)=>({payload:void 0,meta:{...ot||{},arg:st,requestId:it,requestStatus:"pending"}})),rt=createAction(_+"/rejected",(it,st,ot,at,ut)=>({payload:at,error:(j&&j.serializeError||miniSerializeError)(it||"Rejected"),meta:{...ut||{},arg:ot,requestId:st,rejectedWithValue:!!at,requestStatus:"rejected",aborted:(it==null?void 0:it.name)==="AbortError",condition:(it==null?void 0:it.name)==="ConditionError"}}));function nt(it){return(st,ot,at)=>{const ut=j!=null&&j.idGenerator?j.idGenerator(it):nanoid(),ht=new AbortController;let yt,wt;function Ct($t){wt=$t,ht.abort()}const Pt=async function(){var Lt,Dt;let $t;try{let zt=(Lt=j==null?void 0:j.condition)==null?void 0:Lt.call(j,it,{getState:ot,extra:at});if(isThenable(zt)&&(zt=await zt),zt===!1||ht.signal.aborted)throw{name:"ConditionError",message:"Aborted due to condition callback returning false."};const Ot=new Promise((It,Bt)=>{yt=()=>{Bt({name:"AbortError",message:wt||"Aborted"})},ht.signal.addEventListener("abort",yt)});st(tt(ut,it,(Dt=j==null?void 0:j.getPendingMeta)==null?void 0:Dt.call(j,{requestId:ut,arg:it},{getState:ot,extra:at}))),$t=await Promise.race([Ot,Promise.resolve($(it,{dispatch:st,getState:ot,extra:at,requestId:ut,signal:ht.signal,abort:Ct,rejectWithValue:(It,Bt)=>new RejectWithValue(It,Bt),fulfillWithValue:(It,Bt)=>new FulfillWithMeta(It,Bt)})).then(It=>{if(It instanceof RejectWithValue)throw It;return It instanceof FulfillWithMeta?et(It.payload,ut,it,It.meta):et(It,ut,it)})])}catch(zt){$t=zt instanceof RejectWithValue?rt(null,ut,it,zt.payload,zt.meta):rt(zt,ut,it)}finally{yt&&ht.signal.removeEventListener("abort",yt)}return j&&!j.dispatchConditionRejection&&rt.match($t)&&$t.meta.condition||st($t),$t}();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:_})}return a.withTypes=()=>a,a})();function unwrapResult(a){if(a.meta&&a.meta.rejectedWithValue)throw a.payload;if(a.error)throw a.error;return a.payload}function isThenable(a){return a!==null&&typeof a=="object"&&typeof a.then=="function"}var asyncThunkSymbol=Symbol.for("rtk-slice-createasyncthunk");function getType(a,_){return`${a}/${_}`}function buildCreateSlice({creators:a}={}){var $;const _=($=a==null?void 0:a.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),st={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},ot={addCase(Mt,Lt){const Dt=typeof Mt=="string"?Mt:Mt.type;if(!Dt)throw new Error(formatProdErrorMessage(12));if(Dt in st.sliceCaseReducersByType)throw new Error(formatProdErrorMessage(13));return st.sliceCaseReducersByType[Dt]=Lt,ot},addMatcher(Mt,Lt){return st.sliceMatchers.push({matcher:Mt,reducer:Lt}),ot},exposeAction(Mt,Lt){return st.actionCreators[Mt]=Lt,ot},exposeCaseReducer(Mt,Lt){return st.sliceCaseReducersByName[Mt]=Lt,ot}};it.forEach(Mt=>{const Lt=nt[Mt],Dt={reducerName:Mt,type:getType(tt,Mt),createNotation:typeof et.reducers=="function"};isAsyncThunkSliceReducerDefinition(Lt)?handleThunkCaseReducerDefinition(Dt,Lt,ot,_):handleNormalReducerDefinition(Dt,Lt,ot)});function at(){const[Mt={},Lt=[],Dt=void 0]=typeof et.extraReducers=="function"?executeReducerBuilderCallback(et.extraReducers):[et.extraReducers],zt={...Mt,...st.sliceCaseReducersByType};return createReducer(et.initialState,Ot=>{for(let It in zt)Ot.addCase(It,zt[It]);for(let It of st.sliceMatchers)Ot.addMatcher(It.matcher,It.reducer);for(let It of Lt)Ot.addMatcher(It.matcher,It.reducer);Dt&&Ot.addDefaultCase(Dt)})}const ut=Mt=>Mt,ht=new Map;let yt;function wt(Mt,Lt){return yt||(yt=at()),yt(Mt,Lt)}function Ct(){return yt||(yt=at()),yt.getInitialState()}function Pt(Mt,Lt=!1){function Dt(Ot){let It=Ot[Mt];return typeof It>"u"&&Lt&&(It=Ct()),It}function zt(Ot=ut){const It=emplace(ht,Lt,{insert:()=>new WeakMap});return emplace(It,Ot,{insert:()=>{const Bt={};for(const[Ft,jt]of Object.entries(et.selectors??{}))Bt[Ft]=wrapSelector(jt,Ot,Ct,Lt);return Bt}})}return{reducerPath:Mt,getSelectors:zt,get selectors(){return zt(Dt)},selectSlice:Dt}}const $t={name:tt,reducer:wt,actions:st.actionCreators,caseReducers:st.sliceCaseReducersByName,getInitialState:Ct,...Pt(rt),injectInto(Mt,{reducerPath:Lt,...Dt}={}){const zt=Lt??rt;return Mt.inject({reducerPath:zt,reducer:wt},Dt),{...$t,...Pt(zt,!0)}}};return $t}}function wrapSelector(a,_,$,j){function et(tt,...rt){let nt=_(tt);return typeof nt>"u"&&j&&(nt=$()),a(nt,...rt)}return et.unwrapped=a,et}var createSlice=buildCreateSlice();function buildReducerCreators(){function a(_,$){return{_reducerDefinitionType:"asyncThunk",payloadCreator:_,...$}}return a.withTypes=()=>a,{reducer(_){return Object.assign({[_.name](...$){return _(...$)}}[_.name],{_reducerDefinitionType:"reducer"})},preparedReducer(_,$){return{_reducerDefinitionType:"reducerWithPrepare",prepare:_,reducer:$}},asyncThunk:a}}function handleNormalReducerDefinition({type:a,reducerName:_,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(a,tt).exposeCaseReducer(_,tt).exposeAction(_,rt?createAction(a,rt):createAction(a))}function isAsyncThunkSliceReducerDefinition(a){return a._reducerDefinitionType==="asyncThunk"}function isCaseReducerWithPrepareDefinition(a){return a._reducerDefinitionType==="reducerWithPrepare"}function handleThunkCaseReducerDefinition({type:a,reducerName:_},$,j,et){if(!et)throw new Error(formatProdErrorMessage(18));const{payloadCreator:tt,fulfilled:rt,pending:nt,rejected:it,settled:st,options:ot}=$,at=et(a,tt,ot);j.exposeAction(_,at),rt&&j.addCase(at.fulfilled,rt),nt&&j.addCase(at.pending,nt),it&&j.addCase(at.rejected,it),st&&j.addMatcher(at.settled,st),j.exposeCaseReducer(_,{fulfilled:rt||noop$5,pending:nt||noop$5,rejected:it||noop$5,settled:st||noop$5})}function noop$5(){}var assertFunction=(a,_)=>{if(typeof a!="function")throw new Error(formatProdErrorMessage(32))},alm="listenerMiddleware",getListenerEntryPropsFrom=a=>{let{type:_,actionCreator:$,matcher:j,predicate:et,effect:tt}=a;if(_)et=createAction(_).match;else if($)_=$.type,et=$.match;else if(j)et=j;else if(!et)throw new Error(formatProdErrorMessage(21));return assertFunction(tt),{predicate:et,type:_,effect:tt}},createListenerEntry=Object.assign(a=>{const{type:_,predicate:$,effect:j}=getListenerEntryPropsFrom(a);return{id:nanoid(),effect:j,type:_,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(a){return`Minified Redux Toolkit error #${a}; visit https://redux-toolkit.js.org/Errors?code=${a} 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(a){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(a)}function noop$4(){}var noopStorage={getItem:noop$4,setItem:noop$4,removeItem:noop$4};function hasStorage(a){if((typeof self>"u"?"undefined":_typeof$4(self))!=="object"||!(a in self))return!1;try{var _=self[a],$="redux-persist ".concat(a," test");_.setItem($,"test"),_.getItem($),_.removeItem($)}catch{return!1}return!0}function getStorage(a){var _="".concat(a,"Storage");return hasStorage(_)?self[_]:noopStorage}createWebStorage$1.__esModule=!0;createWebStorage$1.default=createWebStorage;var _getStorage=_interopRequireDefault$6(getStorage$1);function _interopRequireDefault$6(a){return a&&a.__esModule?a:{default:a}}function createWebStorage(a){var _=(0,_getStorage.default)(a);return{getItem:function(j){return new Promise(function(et,tt){et(_.getItem(j))})},setItem:function(j,et){return new Promise(function(tt,rt){tt(_.setItem(j,et))})},removeItem:function(j){return new Promise(function(et,tt){et(_.removeItem(j))})}}}var default_1=void 0,_createWebStorage=_interopRequireDefault$5(createWebStorage$1);function _interopRequireDefault$5(a){return a&&a.__esModule?a:{default:a}}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(a).map(nt=>parseInt(nt)).filter(nt=>j>=nt&&nt>et).sort((nt,it)=>nt-it);let rt=$;for(const nt of tt)rt=await a[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: ${a}. Full error at: https://bit.ly/3cXEKWf`)}var getPrototypeOf$1=Object.getPrototypeOf;function isDraft(a){return!!a&&!!a[DRAFT_STATE]}function isDraftable(a){var _;return a?isPlainObject$1(a)||Array.isArray(a)||!!a[DRAFTABLE]||!!((_=a.constructor)!=null&&_[DRAFTABLE])||isMap(a)||isSet(a):!1}var objectCtorString=Object.prototype.constructor.toString();function isPlainObject$1(a){if(!a||typeof a!="object")return!1;const _=getPrototypeOf$1(a);if(_===null)return!0;const $=Object.hasOwnProperty.call(_,"constructor")&&_.constructor;return $===Object?!0:typeof $=="function"&&Function.toString.call($)===objectCtorString}function each(a,_){getArchtype(a)===0?Reflect.ownKeys(a).forEach($=>{_($,a[$],a)}):a.forEach(($,j)=>_(j,$,a))}function getArchtype(a){const _=a[DRAFT_STATE];return _?_.type_:Array.isArray(a)?1:isMap(a)?2:isSet(a)?3:0}function has(a,_){return getArchtype(a)===2?a.has(_):Object.prototype.hasOwnProperty.call(a,_)}function set(a,_,$){const j=getArchtype(a);j===2?a.set(_,$):j===3?a.add($):a[_]=$}function is(a,_){return a===_?a!==0||1/a===1/_:a!==a&&_!==_}function isMap(a){return a instanceof Map}function isSet(a){return a instanceof Set}function latest(a){return a.copy_||a.base_}function shallowCopy(a,_){if(isMap(a))return new Map(a);if(isSet(a))return new Set(a);if(Array.isArray(a))return Array.prototype.slice.call(a);const $=isPlainObject$1(a);if(_===!0||_==="class_only"&&!$){const j=Object.getOwnPropertyDescriptors(a);delete j[DRAFT_STATE];let et=Reflect.ownKeys(j);for(let tt=0;tt1&&(a.set=a.add=a.clear=a.delete=dontMutateFrozenCollections),Object.freeze(a),_&&Object.entries(a).forEach(([$,j])=>freeze(j,!0))),a}function dontMutateFrozenCollections(){die(2)}function isFrozen(a){return Object.isFrozen(a)}var plugins={};function getPlugin(a){const _=plugins[a];return _||die(0,a),_}var currentScope;function getCurrentScope(){return currentScope}function createScope(a,_){return{drafts_:[],parent_:a,immer_:_,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function usePatchesInScope(a,_){_&&(getPlugin("Patches"),a.patches_=[],a.inversePatches_=[],a.patchListener_=_)}function revokeScope(a){leaveScope(a),a.drafts_.forEach(revokeDraft),a.drafts_=null}function leaveScope(a){a===currentScope&&(currentScope=a.parent_)}function enterScope(a){return currentScope=createScope(currentScope,a)}function revokeDraft(a){const _=a[DRAFT_STATE];_.type_===0||_.type_===1?_.revoke_():_.revoked_=!0}function processResult(a,_){_.unfinalizedDrafts_=_.drafts_.length;const $=_.drafts_[0];return a!==void 0&&a!==$?($[DRAFT_STATE].modified_&&(revokeScope(_),die(4)),isDraftable(a)&&(a=finalize(_,a),_.parent_||maybeFreeze(_,a)),_.patches_&&getPlugin("Patches").generateReplacementPatches_($[DRAFT_STATE].base_,a,_.patches_,_.inversePatches_)):a=finalize(_,$,[]),revokeScope(_),_.patches_&&_.patchListener_(_.patches_,_.inversePatches_),a!==NOTHING?a:void 0}function finalize(a,_,$){if(isFrozen(_))return _;const j=_[DRAFT_STATE];if(!j)return each(_,(et,tt)=>finalizeProperty(a,j,_,et,tt,$)),_;if(j.scope_!==a)return _;if(!j.modified_)return maybeFreeze(a,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(a,j,et,nt,it,$,rt)),maybeFreeze(a,et,!1),$&&a.patches_&&getPlugin("Patches").generatePatches_(j,$,a.patches_,a.inversePatches_)}return j.copy_}function finalizeProperty(a,_,$,j,et,tt,rt){if(isDraft(et)){const nt=tt&&_&&_.type_!==3&&!has(_.assigned_,j)?tt.concat(j):void 0,it=finalize(a,et,nt);if(set($,j,it),isDraft(it))a.canAutoFreeze_=!1;else return}else rt&&$.add(et);if(isDraftable(et)&&!isFrozen(et)){if(!a.immer_.autoFreeze_&&a.unfinalizedDrafts_<1)return;finalize(a,et),(!_||!_.scope_.parent_)&&typeof j!="symbol"&&Object.prototype.propertyIsEnumerable.call($,j)&&maybeFreeze(a,et)}}function maybeFreeze(a,_,$=!1){!a.parent_&&a.immer_.autoFreeze_&&a.canAutoFreeze_&&freeze(_,$)}function createProxyProxy(a,_){const $=Array.isArray(a),j={type_:$?1:0,scope_:_?_.scope_:getCurrentScope(),modified_:!1,finalized_:!1,assigned_:{},parent_:_,base_:a,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(_===DRAFT_STATE)return a;const $=latest(a);if(!has($,_))return readPropFromProto(a,$,_);const j=$[_];return a.finalized_||!isDraftable(j)?j:j===peek(a.base_,_)?(prepareCopy(a),a.copy_[_]=createProxy(j,a)):j},has(a,_){return _ in latest(a)},ownKeys(a){return Reflect.ownKeys(latest(a))},set(a,_,$){const j=getDescriptorFromProto(latest(a),_);if(j!=null&&j.set)return j.set.call(a.draft_,$),!0;if(!a.modified_){const et=peek(latest(a),_),tt=et==null?void 0:et[DRAFT_STATE];if(tt&&tt.base_===$)return a.copy_[_]=$,a.assigned_[_]=!1,!0;if(is($,et)&&($!==void 0||has(a.base_,_)))return!0;prepareCopy(a),markChanged(a)}return a.copy_[_]===$&&($!==void 0||_ in a.copy_)||Number.isNaN($)&&Number.isNaN(a.copy_[_])||(a.copy_[_]=$,a.assigned_[_]=!0),!0},deleteProperty(a,_){return peek(a.base_,_)!==void 0||_ in a.base_?(a.assigned_[_]=!1,prepareCopy(a),markChanged(a)):delete a.assigned_[_],a.copy_&&delete a.copy_[_],!0},getOwnPropertyDescriptor(a,_){const $=latest(a),j=Reflect.getOwnPropertyDescriptor($,_);return j&&{writable:!0,configurable:a.type_!==1||_!=="length",enumerable:j.enumerable,value:$[_]}},defineProperty(){die(11)},getPrototypeOf(a){return getPrototypeOf$1(a.base_)},setPrototypeOf(){die(12)}},arrayTraps={};each(objectTraps,(a,_)=>{arrayTraps[a]=function(){return arguments[0]=arguments[0][0],_.apply(this,arguments)}});arrayTraps.deleteProperty=function(a,_){return arrayTraps.set.call(this,a,_,void 0)};arrayTraps.set=function(a,_,$){return objectTraps.set.call(this,a[0],_,$,a[0])};function peek(a,_){const $=a[DRAFT_STATE];return($?latest($):a)[_]}function readPropFromProto(a,_,$){var et;const j=getDescriptorFromProto(_,$);return j?"value"in j?j.value:(et=j.get)==null?void 0:et.call(a.draft_):void 0}function getDescriptorFromProto(a,_){if(!(_ in a))return;let $=getPrototypeOf$1(a);for(;$;){const j=Object.getOwnPropertyDescriptor($,_);if(j)return j;$=getPrototypeOf$1($)}}function markChanged(a){a.modified_||(a.modified_=!0,a.parent_&&markChanged(a.parent_))}function prepareCopy(a){a.copy_||(a.copy_=shallowCopy(a.base_,a.scope_.immer_.useStrictShallowCopy_))}var Immer2=class{constructor(a){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(_,$,j)=>{if(typeof _=="function"&&typeof $!="function"){const tt=$;$=_;const rt=this;return function(it=tt,...st){return rt.produce(it,ot=>$.call(this,ot,...st))}}typeof $!="function"&&die(6),j!==void 0&&typeof j!="function"&&die(7);let et;if(isDraftable(_)){const tt=enterScope(this),rt=createProxy(_,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(!_||typeof _!="object"){if(et=$(_),et===void 0&&(et=_),et===NOTHING&&(et=void 0),this.autoFreeze_&&freeze(et,!0),j){const tt=[],rt=[];getPlugin("Patches").generateReplacementPatches_(_,et,tt,rt),j(tt,rt)}return et}else die(1,_)},this.produceWithPatches=(_,$)=>{if(typeof _=="function")return(rt,...nt)=>this.produceWithPatches(rt,it=>_(it,...nt));let j,et;return[this.produce(_,$,(rt,nt)=>{j=rt,et=nt}),j,et]},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(a)||die(8),isDraft(a)&&(a=current(a));const _=enterScope(this),$=createProxy(a,void 0);return $[DRAFT_STATE].isManual_=!0,leaveScope(_),$}finishDraft(a,_){const $=a&&a[DRAFT_STATE];(!$||!$.isManual_)&&die(9);const{scope_:j}=$;return usePatchesInScope(j,_),processResult(void 0,j)}setAutoFreeze(a){this.autoFreeze_=a}setUseStrictShallowCopy(a){this.useStrictShallowCopy_=a}applyPatches(a,_){let $;for($=_.length-1;$>=0;$--){const et=_[$];if(et.path.length===0&&et.op==="replace"){a=et.value;break}}$>-1&&(_=_.slice($+1));const j=getPlugin("Patches").applyPatches_;return isDraft(a)?j(a,_):this.produce(a,et=>j(et,_))}};function createProxy(a,_){const $=isMap(a)?getPlugin("MapSet").proxyMap_(a,_):isSet(a)?getPlugin("MapSet").proxySet_(a,_):createProxyProxy(a,_);return(_?_.scope_:getCurrentScope()).drafts_.push($),$}function current(a){return isDraft(a)||die(10,a),currentImpl(a)}function currentImpl(a){if(!isDraftable(a)||isFrozen(a))return a;const _=a[DRAFT_STATE];let $;if(_){if(!_.modified_)return _.base_;_.finalized_=!0,$=shallowCopy(a,_.scope_.immer_.useStrictShallowCopy_)}else $=shallowCopy(a,!0);return each($,(j,et)=>{set($,j,currentImpl(et))}),_&&(_.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:(a,{payload:_})=>{_!==a.html&&(a.seen=!1),a.html=_},setSeen:a=>{a.seen=!0}}}),ERROR_MSG_INPUT="Input must be an string, Buffer or Uint8Array";function normalizeInput(a){let _;if(a instanceof Uint8Array)_=a;else if(typeof a=="string")_=new TextEncoder().encode(a);else throw new Error(ERROR_MSG_INPUT);return _}function toHex(a){return Array.prototype.map.call(a,function(_){return(_<16?"0":"")+_.toString(16)}).join("")}function uint32ToHex(a){return(4294967296+a).toString(16).substring(1)}function debugPrint(a,_,$){let j=` -`+a+" = ";for(let et=0;et<_.length;et+=2){if($===32)j+=uint32ToHex(_[et]).toUpperCase(),j+=" ",j+=uint32ToHex(_[et+1]).toUpperCase();else if($===64)j+=uint32ToHex(_[et+1]).toUpperCase(),j+=uint32ToHex(_[et]).toUpperCase();else throw new Error("Invalid size "+$);et%6===4?j+=` -`+new Array(a.length+4).join(" "):et<_.length-2&&(j+=" ")}console.log(j)}function testSpeed(a,_,$){let j=new Date().getTime();const et=new Uint8Array(_);for(let rt=0;rt<_;rt++)et[rt]=rt%256;const tt=new Date().getTime();console.log("Generated random input in "+(tt-j)+"ms"),j=tt;for(let rt=0;rt<$;rt++){const nt=a(et),it=new Date().getTime(),st=it-j;j=it,console.log("Hashed in "+st+"ms: "+nt.substring(0,20)+"..."),console.log(Math.round(_/(1<<20)/(st/1e3)*100)/100+" MB PER SECOND")}}var util$3={normalizeInput,toHex,debugPrint,testSpeed};const util$2=util$3;function ADD64AA(a,_,$){const j=a[_]+a[$];let et=a[_+1]+a[$+1];j>=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],st=m$1[tt+1];ADD64AA(v$2,a,_),ADD64AC(v$2,a,rt,nt);let ot=v$2[j]^v$2[a],at=v$2[j+1]^v$2[a+1];v$2[j]=at,v$2[j+1]=ot,ADD64AA(v$2,$,j),ot=v$2[_]^v$2[$],at=v$2[_+1]^v$2[$+1],v$2[_]=ot>>>24^at<<8,v$2[_+1]=at>>>24^ot<<8,ADD64AA(v$2,a,_),ADD64AC(v$2,a,it,st),ot=v$2[j]^v$2[a],at=v$2[j+1]^v$2[a+1],v$2[j]=ot>>>16^at<<16,v$2[j+1]=at>>>16^ot<<16,ADD64AA(v$2,$,j),ot=v$2[_]^v$2[$],at=v$2[_+1]^v$2[$+1],v$2[_]=at>>>31^ot<<1,v$2[_+1]=ot>>>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(a){return a*2})),v$2=new Uint32Array(32),m$1=new Uint32Array(32);function blake2bCompress(a,_){let $=0;for($=0;$<16;$++)v$2[$]=a.h[$],v$2[$+16]=BLAKE2B_IV32[$];for(v$2[24]=v$2[24]^a.t,v$2[25]=v$2[25]^a.t/4294967296,_&&(v$2[28]=~v$2[28],v$2[29]=~v$2[29]),$=0;$<32;$++)m$1[$]=B2B_GET32(a.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;$++)a.h[$]=a.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(a===0||a>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(_&&_.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:a};parameterBlock.fill(0),parameterBlock[0]=a,_&&(parameterBlock[1]=_.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 _&&(blake2bUpdate(et,_),et.c=128),et}function blake2bUpdate(a,_){for(let $=0;$<_.length;$++)a.c===128&&(a.t+=a.c,blake2bCompress(a,!1),a.c=0),a.b[a.c++]=_[$]}function blake2bFinal(a){for(a.t+=a.c;a.c<128;)a.b[a.c++]=0;blake2bCompress(a,!0);const _=new Uint8Array(a.outlen);for(let $=0;$>2]>>8*($&3);return _}function blake2b(a,_,$,j,et){$=$||64,a=util$2.normalizeInput(a),j&&(j=util$2.normalizeInput(j)),et&&(et=util$2.normalizeInput(et));const tt=blake2bInit($,_,j,et);return blake2bUpdate(tt,a),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[a]=v$1[a]+v$1[_]+et,v$1[j]=ROTR32(v$1[j]^v$1[a],16),v$1[$]=v$1[$]+v$1[j],v$1[_]=ROTR32(v$1[_]^v$1[$],12),v$1[a]=v$1[a]+v$1[_]+tt,v$1[j]=ROTR32(v$1[j]^v$1[a],8),v$1[$]=v$1[$]+v$1[j],v$1[_]=ROTR32(v$1[_]^v$1[$],7)}function ROTR32(a,_){return a>>>_^a<<32-_}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[$]=a.h[$],v$1[$+8]=BLAKE2S_IV[$];for(v$1[12]^=a.t,v$1[13]^=a.t/4294967296,_&&(v$1[14]=~v$1[14]),$=0;$<16;$++)m[$]=B2S_GET32(a.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;$++)a.h[$]^=v$1[$]^v$1[$+8]}function blake2sInit(a,_){if(!(a>0&&a<=32))throw new Error("Incorrect output length, should be in [1, 32]");const $=_?_.length:0;if(_&&!($>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:a};return j.h[0]^=16842752^$<<8^a,$>0&&(blake2sUpdate(j,_),j.c=64),j}function blake2sUpdate(a,_){for(let $=0;$<_.length;$++)a.c===64&&(a.t+=a.c,blake2sCompress(a,!1),a.c=0),a.b[a.c++]=_[$]}function blake2sFinal(a){for(a.t+=a.c;a.c<64;)a.b[a.c++]=0;blake2sCompress(a,!0);const _=new Uint8Array(a.outlen);for(let $=0;$>2]>>8*($&3)&255;return _}function blake2s(a,_,$){$=$||32,a=util$1.normalizeInput(a);const j=blake2sInit($,_);return blake2sUpdate(j,a),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$2={},_sha2={},_assert={};Object.defineProperty(_assert,"__esModule",{value:!0});_assert.output=_assert.exists=_assert.hash=_assert.bytes=_assert.bool=_assert.number=void 0;function number$1(a){if(!Number.isSafeInteger(a)||a<0)throw new Error(`Wrong positive integer: ${a}`)}_assert.number=number$1;function bool$1(a){if(typeof a!="boolean")throw new Error(`Expected boolean, not ${a}`)}_assert.bool=bool$1;function bytes(a,..._){if(!(a instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(_.length>0&&!_.includes(a.length))throw new TypeError(`Expected Uint8Array of length ${_}, not of length=${a.length}`)}_assert.bytes=bytes;function hash$2(a){if(typeof a!="function"||typeof a.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");number$1(a.outputLen),number$1(a.blockLen)}_assert.hash=hash$2;function exists(a,_=!0){if(a.destroyed)throw new Error("Hash instance has been destroyed");if(_&&a.finished)throw new Error("Hash#digest() has already been called")}_assert.exists=exists;function output(a,_){bytes(a);const $=_.outputLen;if(a.length<$)throw new Error(`digestInto() expects output buffer of length at least ${$}`)}_assert.output=output;const assert$a={number:number$1,bool:bool$1,bytes,hash:hash$2,exists,output};_assert.default=assert$a;var utils$e={},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(a){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(a,"__esModule",{value:!0}),a.randomBytes=a.wrapConstructorWithOpts=a.wrapConstructor=a.checkOpts=a.Hash=a.concatBytes=a.toBytes=a.utf8ToBytes=a.asyncLoop=a.nextTick=a.hexToBytes=a.bytesToHex=a.isLE=a.rotr=a.createView=a.u32=a.u8=void 0;const _=crypto$1,$=Lt=>new Uint8Array(Lt.buffer,Lt.byteOffset,Lt.byteLength);a.u8=$;const j=Lt=>new Uint32Array(Lt.buffer,Lt.byteOffset,Math.floor(Lt.byteLength/4));a.u32=j;const et=Lt=>new DataView(Lt.buffer,Lt.byteOffset,Lt.byteLength);a.createView=et;const tt=(Lt,Dt)=>Lt<<32-Dt|Lt>>>Dt;if(a.rotr=tt,a.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,!a.isLE)throw new Error("Non little-endian hardware is not supported");const rt=Array.from({length:256},(Lt,Dt)=>Dt.toString(16).padStart(2,"0"));function nt(Lt){if(!(Lt instanceof Uint8Array))throw new Error("Uint8Array expected");let Dt="";for(let zt=0;zt{};a.nextTick=st;async function ot(Lt,Dt,zt){let Ot=Date.now();for(let It=0;It=0&&BtOt instanceof Uint8Array))throw new Error("Uint8Array list expected");if(Lt.length===1)return Lt[0];const Dt=Lt.reduce((Ot,It)=>Ot+It.length,0),zt=new Uint8Array(Dt);for(let Ot=0,It=0;OtObject.prototype.toString.call(Lt)==="[object Object]"&&Lt.constructor===Object;function Ct(Lt,Dt){if(Dt!==void 0&&(typeof Dt!="object"||!wt(Dt)))throw new TypeError("Options should be object or undefined");return Object.assign(Lt,Dt)}a.checkOpts=Ct;function Pt(Lt){const Dt=Ot=>Lt().update(ut(Ot)).digest(),zt=Lt();return Dt.outputLen=zt.outputLen,Dt.blockLen=zt.blockLen,Dt.create=()=>Lt(),Dt}a.wrapConstructor=Pt;function $t(Lt){const Dt=(Ot,It)=>Lt(It).update(ut(Ot)).digest(),zt=Lt({});return Dt.outputLen=zt.outputLen,Dt.blockLen=zt.blockLen,Dt.create=Ot=>Lt(Ot),Dt}a.wrapConstructorWithOpts=$t;function Mt(Lt=32){if(_.crypto&&typeof _.crypto.getRandomValues=="function")return _.crypto.getRandomValues(new Uint8Array(Lt));throw new Error("crypto.getRandomValues must be defined")}a.randomBytes=Mt})(utils$e);Object.defineProperty(_sha2,"__esModule",{value:!0});_sha2.SHA2=void 0;const _assert_js_1$2=_assert,utils_js_1$4=utils$e;function setBigUint64(a,_,$,j){if(typeof a.setBigUint64=="function")return a.setBigUint64(_,$,j);const et=BigInt(32),tt=BigInt(4294967295),rt=Number($>>et&tt),nt=Number($&tt),it=j?4:0,st=j?0:4;a.setUint32(_+it,rt,j),a.setUint32(_+st,nt,j)}class SHA2 extends utils_js_1$4.Hash{constructor(_,$,j,et){super(),this.blockLen=_,this.outputLen=$,this.padOffset=j,this.isLE=et,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(_),this.view=(0,utils_js_1$4.createView)(this.buffer)}update(_){_assert_js_1$2.default.exists(this);const{view:$,buffer:j,blockLen:et}=this;_=(0,utils_js_1$4.toBytes)(_);const tt=_.length;for(let rt=0;rtet-rt&&(this.process(j,0),rt=0);for(let at=rt;atot.length)throw new Error("_sha2: outputLen bigger than state");for(let at=0;ata&_^~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:_,B:$,C:j,D:et,E:tt,F:rt,G:nt,H:it}=this;return[_,$,j,et,tt,rt,nt,it]}set(_,$,j,et,tt,rt,nt,it){this.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(_,$){for(let at=0;at<16;at++,$+=4)SHA256_W[at]=_.getUint32($,!1);for(let at=16;at<64;at++){const ut=SHA256_W[at-15],ht=SHA256_W[at-2],yt=(0,utils_js_1$3.rotr)(ut,7)^(0,utils_js_1$3.rotr)(ut,18)^ut>>>3,wt=(0,utils_js_1$3.rotr)(ht,17)^(0,utils_js_1$3.rotr)(ht,19)^ht>>>10;SHA256_W[at]=wt+SHA256_W[at-7]+yt+SHA256_W[at-16]|0}let{A:j,B:et,C:tt,D:rt,E:nt,F:it,G:st,H:ot}=this;for(let at=0;at<64;at++){const ut=(0,utils_js_1$3.rotr)(nt,6)^(0,utils_js_1$3.rotr)(nt,11)^(0,utils_js_1$3.rotr)(nt,25),ht=ot+ut+Chi(nt,it,st)+SHA256_K[at]+SHA256_W[at]|0,wt=((0,utils_js_1$3.rotr)(j,2)^(0,utils_js_1$3.rotr)(j,13)^(0,utils_js_1$3.rotr)(j,22))+Maj(j,et,tt)|0;ot=st,st=it,it=nt,nt=rt+ht|0,rt=tt,tt=et,et=j,j=ht+wt|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,st=st+this.G|0,ot=ot+this.H|0,this.set(j,et,tt,rt,nt,it,st,ot)}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$2.sha256=(0,utils_js_1$3.wrapConstructor)(()=>new SHA256);sha256$2.sha224=(0,utils_js_1$3.wrapConstructor)(()=>new SHA224);function base$2(a){if(a.length>=255)throw new TypeError("Alphabet too long");for(var _=new Uint8Array(256),$=0;$<_.length;$++)_[$]=255;for(var j=0;j>>0,Mt=new Uint8Array($t);Ct!==Pt;){for(var Lt=ht[Ct],Dt=0,zt=$t-1;(Lt!==0||Dt>>0,Mt[zt]=Lt%rt>>>0,Lt=Lt/rt>>>0;if(Lt!==0)throw new Error("Non-zero carry");wt=Dt,Ct++}for(var Ot=$t-wt;Ot!==$t&&Mt[Ot]===0;)Ot++;for(var It=nt.repeat(yt);Ot<$t;++Ot)It+=a.charAt(Mt[Ot]);return It}function at(ht){if(typeof ht!="string")throw new TypeError("Expected String");if(ht.length===0)return new Uint8Array;for(var yt=0,wt=0,Ct=0;ht[yt]===nt;)wt++,yt++;for(var Pt=(ht.length-yt)*it+1>>>0,$t=new Uint8Array(Pt);ht[yt];){var Mt=_[ht.charCodeAt(yt)];if(Mt===255)return;for(var Lt=0,Dt=Pt-1;(Mt!==0||Lt>>0,$t[Dt]=Mt%256>>>0,Mt=Mt/256>>>0;if(Mt!==0)throw new Error("Non-zero carry");Ct=Lt,yt++}for(var zt=Pt-Ct;zt!==Pt&&$t[zt]===0;)zt++;for(var Ot=new Uint8Array(wt+(Pt-zt)),It=wt;zt!==Pt;)Ot[It++]=$t[zt++];return Ot}function ut(ht){var yt=at(ht);if(yt)return yt;throw new Error("Non-base"+rt+" character")}return{encode:ot,decodeUnsafe:at,decode:ut}}var src$1=base$2;const basex=src$1,ALPHABET="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var bs58=basex(ALPHABET),base58=bs58,base$1=function(a){function _(tt){var rt=Uint8Array.from(tt),nt=a(rt),it=rt.length+4,st=new Uint8Array(it);return st.set(rt,0),st.set(nt.subarray(0,4),rt.length),base58.encode(st,it)}function $(tt){var rt=tt.slice(0,-4),nt=tt.slice(-4),it=a(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:_,decode:et,decodeUnsafe:j}},{sha256:sha256$1}=sha256$2,bs58checkBase=base$1;function sha256x2(a){return sha256$1(sha256$1(a))}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(_,$){super(),this.address=_,this.errorDetail=$,this.name="InvalidAddressError",this.message=`Invalid address "${_}"`,this.message+=$?` ${$}.`:"."}}class InvalidBlockHashError extends ParameterValidationError{constructor(_,$){super(),this.blockHash=_,this.errorDetail=$,this.name="InvalidBlockHashError",this.message=`Invalid block hash "${_}"`,this.message+=$?` ${$}.`:"."}}class InvalidAmountError extends ParameterValidationError{constructor(_){super(),this.amount=_,this.name="InvalidAmountError",this.message=`Invalid amount "${_}"`}}class InvalidDerivationPathError extends ParameterValidationError{constructor(_,$){super(),this.derivationPath=_,this.errorDetail=$,this.name="InvalidDerivationPathError",this.message=`Invalid derivation path "${_}"`,this.message+=$?` ${$}.`:"."}}class InvalidHexStringError extends ParameterValidationError{constructor(_,$){super(),this.hexString=_,this.errorDetail=$,this.name="InvalidHexStringError",this.message=`Invalid hex string "${_}"`,this.message+=$?` ${$}.`:"."}}class InvalidMessageError extends ParameterValidationError{constructor(_,$){super(),this.msg=_,this.errorDetail=$,this.name="InvalidMessageError",this.message=`Invalid message "${_}"`,this.message+=$?` ${$}.`:"."}}class InvalidViewParameterError extends ParameterValidationError{constructor(_,$,j,et){super(),this.viewName=_,this.sigs=$,this.args=j,this.cause=et,this.name="InvalidViewParameterError",this.message=`Invalid view arguments ${JSON.stringify(j)} received for name "${_}" expecting one of the following signatures ${JSON.stringify($)}.`}}class InvalidKeyError extends ParameterValidationError{constructor(_){super(),this.errorDetail=_,this.name="InvalidKeyError",this.message="Invalid private key",this.message+=_?` ${_}.`:"."}}class InvalidPublicKeyError extends ParameterValidationError{constructor(_,$){super(),this.publicKey=_,this.errorDetail=$,this.name="InvalidPublicKeyError",this.message=`Invalid public key "${_}"`,this.message+=$?` ${$}.`:"."}}class InvalidContractAddressError extends ParameterValidationError{constructor(_,$){super(),this.contractAddress=_,this.errorDetail=$,this.name="InvalidContractAddressError",this.message=`Invalid contract address "${_}"`,this.message+=$?` ${$}.`:"."}}class InvalidChainIdError extends ParameterValidationError{constructor(_,$){super(),this.chainId=_,this.errorDetail=$,this.name="InvalidChainIdError",this.message=`Invalid chain id "${_}"`,this.message+=$?` ${$}.`:"."}}class InvalidKeyHashError extends ParameterValidationError{constructor(_,$){super(),this.keyHash=_,this.errorDetail=$,this.name="InvalidKeyHashError",this.message=`Invalid public key hash "${_}"`,this.message+=$?` ${$}.`:"."}}class InvalidOperationHashError extends ParameterValidationError{constructor(_,$){super(),this.operationHash=_,this.errorDetail=$,this.name="InvalidOperationHashError",this.message=`Invalid operation hash "${_}"`,this.message+=$?` ${$}.`:"."}}class InvalidOperationKindError extends ParameterValidationError{constructor(_,$){super(),this.operationKind=_,this.errorDetail=$,this.name="InvalidOperationKindError",this.message=`Invalid operation kind "${_}"`,this.message+=$?` ${$}.`:"."}}class DeprecationError extends UnsupportedActionError{constructor(_){super(),this.message=_,this.name="DeprecationError"}}class ProhibitedActionError extends UnsupportedActionError{constructor(_){super(),this.message=_,this.name="ProhibitedActionError"}}class PublicKeyNotFoundError extends TaquitoError{constructor(_,$){super(),this.pkh=_,this.cause=$,this.name="PublicKeyNotFoundError",this.message=`Public key not found of this address "${_}" 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(a){var _,$,j,et=$t.prototype={constructor:$t,toString:null,valueOf:null},tt=new $t(1),rt=20,nt=4,it=-7,st=21,ot=-1e7,at=1e7,ut=!1,ht=1,yt=0,wt={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},Ct="0123456789abcdefghijklmnopqrstuvwxyz",Pt=!0;function $t(It,Bt){var Ft,jt,bt,vt,ct,dt,mt,xt,At=this;if(!(At instanceof $t))return new $t(It,Bt);if(Bt==null){if(It&&It._isBigNumber===!0){At.s=It.s,!It.c||It.e>at?At.c=At.e=null:It.e=10;ct/=10,vt++);vt>at?At.c=At.e=null:(At.e=vt,At.c=[It]);return}xt=String(It)}else{if(!isNumeric.test(xt=String(It)))return j(At,xt,dt);At.s=xt.charCodeAt(0)==45?(xt=xt.slice(1),-1):1}(vt=xt.indexOf("."))>-1&&(xt=xt.replace(".","")),(ct=xt.search(/e/i))>0?(vt<0&&(vt=ct),vt+=+xt.slice(ct+1),xt=xt.substring(0,ct)):vt<0&&(vt=xt.length)}else{if(intCheck(Bt,2,Ct.length,"Base"),Bt==10&&Pt)return At=new $t(It),zt(At,rt+At.e+1,nt);if(xt=String(It),dt=typeof It=="number"){if(It*0!=0)return j(At,xt,dt,Bt);if(At.s=1/It<0?(xt=xt.slice(1),-1):1,$t.DEBUG&&xt.replace(/^0\.0*|\./,"").length>15)throw Error(tooManyDigits+It)}else At.s=xt.charCodeAt(0)===45?(xt=xt.slice(1),-1):1;for(Ft=Ct.slice(0,Bt),vt=ct=0,mt=xt.length;ctvt){vt=mt;continue}}else if(!bt&&(xt==xt.toUpperCase()&&(xt=xt.toLowerCase())||xt==xt.toLowerCase()&&(xt=xt.toUpperCase()))){bt=!0,ct=-1,vt=0;continue}return j(At,String(It),dt,Bt)}dt=!1,xt=$(xt,Bt,10,At.s),(vt=xt.indexOf("."))>-1?xt=xt.replace(".",""):vt=xt.length}for(ct=0;xt.charCodeAt(ct)===48;ct++);for(mt=xt.length;xt.charCodeAt(--mt)===48;);if(xt=xt.slice(ct,++mt)){if(mt-=ct,dt&&$t.DEBUG&&mt>15&&(It>MAX_SAFE_INTEGER$2||It!==mathfloor(It)))throw Error(tooManyDigits+At.s*It);if((vt=vt-ct-1)>at)At.c=At.e=null;else if(vt=-MAX$1&&bt<=MAX$1&&bt===mathfloor(bt)){if(jt[0]===0){if(bt===0&&jt.length===1)return!0;break e}if(Bt=(bt+1)%LOG_BASE,Bt<1&&(Bt+=LOG_BASE),String(jt[0]).length==Bt){for(Bt=0;Bt=BASE||Ft!==mathfloor(Ft))break e;if(Ft!==0)return!0}}}else if(jt===null&&bt===null&&(vt===null||vt===1||vt===-1))return!0;throw Error(bignumberError+"Invalid BigNumber: "+It)},$t.maximum=$t.max=function(){return Lt(arguments,-1)},$t.minimum=$t.min=function(){return Lt(arguments,1)},$t.random=function(){var It=9007199254740992,Bt=Math.random()*It&2097151?function(){return mathfloor(Math.random()*It)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(Ft){var jt,bt,vt,ct,dt,mt=0,xt=[],At=new $t(tt);if(Ft==null?Ft=rt:intCheck(Ft,0,MAX$1),ct=mathceil(Ft/LOG_BASE),ut)if(crypto.getRandomValues){for(jt=crypto.getRandomValues(new Uint32Array(ct*=2));mt>>11),dt>=9e15?(bt=crypto.getRandomValues(new Uint32Array(2)),jt[mt]=bt[0],jt[mt+1]=bt[1]):(xt.push(dt%1e14),mt+=2);mt=ct/2}else if(crypto.randomBytes){for(jt=crypto.randomBytes(ct*=7);mt=9e15?crypto.randomBytes(7).copy(jt,mt):(xt.push(dt%1e14),mt+=7);mt=ct/7}else throw ut=!1,Error(bignumberError+"crypto unavailable");if(!ut)for(;mt=10;dt/=10,mt++);mtbt-1&&(dt[ct+1]==null&&(dt[ct+1]=0),dt[ct+1]+=dt[ct]/bt|0,dt[ct]%=bt)}return dt.reverse()}return function(Ft,jt,bt,vt,ct){var dt,mt,xt,At,Rt,St,Tt,Et,Nt=Ft.indexOf("."),tr=rt,ir=nt;for(Nt>=0&&(At=yt,yt=0,Ft=Ft.replace(".",""),Et=new $t(jt),St=Et.pow(Ft.length-Nt),yt=At,Et.c=Bt(toFixedPoint(coeffToString(St.c),St.e,"0"),10,bt,It),Et.e=Et.c.length),Tt=Bt(Ft,jt,bt,ct?(dt=Ct,It):(dt=It,Ct)),xt=At=Tt.length;Tt[--At]==0;Tt.pop());if(!Tt[0])return dt.charAt(0);if(Nt<0?--xt:(St.c=Tt,St.e=xt,St.s=vt,St=_(St,Et,tr,ir,bt),Tt=St.c,Rt=St.r,xt=St.e),mt=xt+tr+1,Nt=Tt[mt],At=bt/2,Rt=Rt||mt<0||Tt[mt+1]!=null,Rt=ir<4?(Nt!=null||Rt)&&(ir==0||ir==(St.s<0?3:2)):Nt>At||Nt==At&&(ir==4||Rt||ir==6&&Tt[mt-1]&1||ir==(St.s<0?8:7)),mt<1||!Tt[0])Ft=Rt?toFixedPoint(dt.charAt(1),-tr,dt.charAt(0)):dt.charAt(0);else{if(Tt.length=mt,Rt)for(--bt;++Tt[--mt]>bt;)Tt[mt]=0,mt||(++xt,Tt=[1].concat(Tt));for(At=Tt.length;!Tt[--At];);for(Nt=0,Ft="";Nt<=At;Ft+=dt.charAt(Tt[Nt++]));Ft=toFixedPoint(Ft,xt,dt.charAt(0))}return Ft}}(),_=function(){function It(jt,bt,vt){var ct,dt,mt,xt,At=0,Rt=jt.length,St=bt%SQRT_BASE,Tt=bt/SQRT_BASE|0;for(jt=jt.slice();Rt--;)mt=jt[Rt]%SQRT_BASE,xt=jt[Rt]/SQRT_BASE|0,ct=Tt*mt+xt*St,dt=St*mt+ct%SQRT_BASE*SQRT_BASE+At,At=(dt/vt|0)+(ct/SQRT_BASE|0)+Tt*xt,jt[Rt]=dt%vt;return At&&(jt=[At].concat(jt)),jt}function Bt(jt,bt,vt,ct){var dt,mt;if(vt!=ct)mt=vt>ct?1:-1;else for(dt=mt=0;dtbt[dt]?1:-1;break}return mt}function Ft(jt,bt,vt,ct){for(var dt=0;vt--;)jt[vt]-=dt,dt=jt[vt]1;jt.splice(0,1));}return function(jt,bt,vt,ct,dt){var mt,xt,At,Rt,St,Tt,Et,Nt,tr,ir,nr,Zt,Kt,Qt,Ht,qt,Jt,ur=jt.s==bt.s?1:-1,xr=jt.c,pr=bt.c;if(!xr||!xr[0]||!pr||!pr[0])return new $t(!jt.s||!bt.s||(xr?pr&&xr[0]==pr[0]:!pr)?NaN:xr&&xr[0]==0||!pr?ur*0:ur/0);for(Nt=new $t(ur),tr=Nt.c=[],xt=jt.e-bt.e,ur=vt+xt+1,dt||(dt=BASE,xt=bitFloor(jt.e/LOG_BASE)-bitFloor(bt.e/LOG_BASE),ur=ur/LOG_BASE|0),At=0;pr[At]==(xr[At]||0);At++);if(pr[At]>(xr[At]||0)&&xt--,ur<0)tr.push(1),Rt=!0;else{for(Qt=xr.length,qt=pr.length,At=0,ur+=2,St=mathfloor(dt/(pr[0]+1)),St>1&&(pr=It(pr,St,dt),xr=It(xr,St,dt),qt=pr.length,Qt=xr.length),Kt=qt,ir=xr.slice(0,qt),nr=ir.length;nr=dt/2&&Ht++;do{if(St=0,mt=Bt(pr,ir,qt,nr),mt<0){if(Zt=ir[0],qt!=nr&&(Zt=Zt*dt+(ir[1]||0)),St=mathfloor(Zt/Ht),St>1)for(St>=dt&&(St=dt-1),Tt=It(pr,St,dt),Et=Tt.length,nr=ir.length;Bt(Tt,ir,Et,nr)==1;)St--,Ft(Tt,qt=10;ur/=10,At++);zt(Nt,vt+(Nt.e=At+xt*LOG_BASE-1)+1,ct,Rt)}else Nt.e=xt,Nt.r=+Rt;return Nt}}();function Mt(It,Bt,Ft,jt){var bt,vt,ct,dt,mt;if(Ft==null?Ft=nt:intCheck(Ft,0,8),!It.c)return It.toString();if(bt=It.c[0],ct=It.e,Bt==null)mt=coeffToString(It.c),mt=jt==1||jt==2&&(ct<=it||ct>=st)?toExponential(mt,ct):toFixedPoint(mt,ct,"0");else if(It=zt(new $t(It),Bt,Ft),vt=It.e,mt=coeffToString(It.c),dt=mt.length,jt==1||jt==2&&(Bt<=vt||vt<=it)){for(;dtdt){if(--Bt>0)for(mt+=".";Bt--;mt+="0");}else if(Bt+=vt-dt,Bt>0)for(vt+1==dt&&(mt+=".");Bt--;mt+="0");return It.s<0&&bt?"-"+mt:mt}function Lt(It,Bt){for(var Ft,jt,bt=1,vt=new $t(It[0]);bt=10;bt/=10,jt++);return(Ft=jt+Ft*LOG_BASE-1)>at?It.c=It.e=null:Ft=10;dt/=10,bt++);if(vt=Bt-bt,vt<0)vt+=LOG_BASE,ct=Bt,mt=Rt[xt=0],At=mathfloor(mt/St[bt-ct-1]%10);else if(xt=mathceil((vt+1)/LOG_BASE),xt>=Rt.length)if(jt){for(;Rt.length<=xt;Rt.push(0));mt=At=0,bt=1,vt%=LOG_BASE,ct=vt-LOG_BASE+1}else break e;else{for(mt=dt=Rt[xt],bt=1;dt>=10;dt/=10,bt++);vt%=LOG_BASE,ct=vt-LOG_BASE+bt,At=ct<0?0:mathfloor(mt/St[bt-ct-1]%10)}if(jt=jt||Bt<0||Rt[xt+1]!=null||(ct<0?mt:mt%St[bt-ct-1]),jt=Ft<4?(At||jt)&&(Ft==0||Ft==(It.s<0?3:2)):At>5||At==5&&(Ft==4||jt||Ft==6&&(vt>0?ct>0?mt/St[bt-ct]:0:Rt[xt-1])%10&1||Ft==(It.s<0?8:7)),Bt<1||!Rt[0])return Rt.length=0,jt?(Bt-=It.e+1,Rt[0]=St[(LOG_BASE-Bt%LOG_BASE)%LOG_BASE],It.e=-Bt||0):Rt[0]=It.e=0,It;if(vt==0?(Rt.length=xt,dt=1,xt--):(Rt.length=xt+1,dt=St[LOG_BASE-vt],Rt[xt]=ct>0?mathfloor(mt/St[bt-ct]%St[ct])*dt:0),jt)for(;;)if(xt==0){for(vt=1,ct=Rt[0];ct>=10;ct/=10,vt++);for(ct=Rt[0]+=dt,dt=1;ct>=10;ct/=10,dt++);vt!=dt&&(It.e++,Rt[0]==BASE&&(Rt[0]=1));break}else{if(Rt[xt]+=dt,Rt[xt]!=BASE)break;Rt[xt--]=0,dt=1}for(vt=Rt.length;Rt[--vt]===0;Rt.pop());}It.e>at?It.c=It.e=null:It.e=st?toExponential(Bt,Ft):toFixedPoint(Bt,Ft,"0"),It.s<0?"-"+Bt:Bt)}return et.absoluteValue=et.abs=function(){var It=new $t(this);return It.s<0&&(It.s=1),It},et.comparedTo=function(It,Bt){return compare$c(this,new $t(It,Bt))},et.decimalPlaces=et.dp=function(It,Bt){var Ft,jt,bt,vt=this;if(It!=null)return intCheck(It,0,MAX$1),Bt==null?Bt=nt:intCheck(Bt,0,8),zt(new $t(vt),It+vt.e+1,Bt);if(!(Ft=vt.c))return null;if(jt=((bt=Ft.length-1)-bitFloor(this.e/LOG_BASE))*LOG_BASE,bt=Ft[bt])for(;bt%10==0;bt/=10,jt--);return jt<0&&(jt=0),jt},et.dividedBy=et.div=function(It,Bt){return _(this,new $t(It,Bt),rt,nt)},et.dividedToIntegerBy=et.idiv=function(It,Bt){return _(this,new $t(It,Bt),0,1)},et.exponentiatedBy=et.pow=function(It,Bt){var Ft,jt,bt,vt,ct,dt,mt,xt,At,Rt=this;if(It=new $t(It),It.c&&!It.isInteger())throw Error(bignumberError+"Exponent not an integer: "+Ot(It));if(Bt!=null&&(Bt=new $t(Bt)),dt=It.e>14,!Rt.c||!Rt.c[0]||Rt.c[0]==1&&!Rt.e&&Rt.c.length==1||!It.c||!It.c[0])return At=new $t(Math.pow(+Ot(Rt),dt?It.s*(2-isOdd(It)):+Ot(It))),Bt?At.mod(Bt):At;if(mt=It.s<0,Bt){if(Bt.c?!Bt.c[0]:!Bt.s)return new $t(NaN);jt=!mt&&Rt.isInteger()&&Bt.isInteger(),jt&&(Rt=Rt.mod(Bt))}else{if(It.e>9&&(Rt.e>0||Rt.e<-1||(Rt.e==0?Rt.c[0]>1||dt&&Rt.c[1]>=24e7:Rt.c[0]<8e13||dt&&Rt.c[0]<=9999975e7)))return vt=Rt.s<0&&isOdd(It)?-0:0,Rt.e>-1&&(vt=1/vt),new $t(mt?1/vt:vt);yt&&(vt=mathceil(yt/LOG_BASE+2))}for(dt?(Ft=new $t(.5),mt&&(It.s=1),xt=isOdd(It)):(bt=Math.abs(+Ot(It)),xt=bt%2),At=new $t(tt);;){if(xt){if(At=At.times(Rt),!At.c)break;vt?At.c.length>vt&&(At.c.length=vt):jt&&(At=At.mod(Bt))}if(bt){if(bt=mathfloor(bt/2),bt===0)break;xt=bt%2}else if(It=It.times(Ft),zt(It,It.e+1,1),It.e>14)xt=isOdd(It);else{if(bt=+Ot(It),bt===0)break;xt=bt%2}Rt=Rt.times(Rt),vt?Rt.c&&Rt.c.length>vt&&(Rt.c.length=vt):jt&&(Rt=Rt.mod(Bt))}return jt?At:(mt&&(At=tt.div(At)),Bt?At.mod(Bt):vt?zt(At,yt,nt,ct):At)},et.integerValue=function(It){var Bt=new $t(this);return It==null?It=nt:intCheck(It,0,8),zt(Bt,Bt.e+1,It)},et.isEqualTo=et.eq=function(It,Bt){return compare$c(this,new $t(It,Bt))===0},et.isFinite=function(){return!!this.c},et.isGreaterThan=et.gt=function(It,Bt){return compare$c(this,new $t(It,Bt))>0},et.isGreaterThanOrEqualTo=et.gte=function(It,Bt){return(Bt=compare$c(this,new $t(It,Bt)))===1||Bt===0},et.isInteger=function(){return!!this.c&&bitFloor(this.e/LOG_BASE)>this.c.length-2},et.isLessThan=et.lt=function(It,Bt){return compare$c(this,new $t(It,Bt))<0},et.isLessThanOrEqualTo=et.lte=function(It,Bt){return(Bt=compare$c(this,new $t(It,Bt)))===-1||Bt===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(It,Bt){var Ft,jt,bt,vt,ct=this,dt=ct.s;if(It=new $t(It,Bt),Bt=It.s,!dt||!Bt)return new $t(NaN);if(dt!=Bt)return It.s=-Bt,ct.plus(It);var mt=ct.e/LOG_BASE,xt=It.e/LOG_BASE,At=ct.c,Rt=It.c;if(!mt||!xt){if(!At||!Rt)return At?(It.s=-Bt,It):new $t(Rt?ct:NaN);if(!At[0]||!Rt[0])return Rt[0]?(It.s=-Bt,It):new $t(At[0]?ct:nt==3?-0:0)}if(mt=bitFloor(mt),xt=bitFloor(xt),At=At.slice(),dt=mt-xt){for((vt=dt<0)?(dt=-dt,bt=At):(xt=mt,bt=Rt),bt.reverse(),Bt=dt;Bt--;bt.push(0));bt.reverse()}else for(jt=(vt=(dt=At.length)<(Bt=Rt.length))?dt:Bt,dt=Bt=0;Bt0)for(;Bt--;At[Ft++]=0);for(Bt=BASE-1;jt>dt;){if(At[--jt]=0;){for(Ft=0,St=Zt[bt]%tr,Tt=Zt[bt]/tr|0,ct=mt,vt=bt+ct;vt>bt;)xt=nr[--ct]%tr,At=nr[ct]/tr|0,dt=Tt*xt+At*St,xt=St*xt+dt%tr*tr+Et[vt]+Ft,Ft=(xt/Nt|0)+(dt/tr|0)+Tt*At,Et[vt--]=xt%Nt;Et[vt]=Ft}return Ft?++jt:Et.splice(0,1),Dt(It,Et,jt)},et.negated=function(){var It=new $t(this);return It.s=-It.s||null,It},et.plus=function(It,Bt){var Ft,jt=this,bt=jt.s;if(It=new $t(It,Bt),Bt=It.s,!bt||!Bt)return new $t(NaN);if(bt!=Bt)return It.s=-Bt,jt.minus(It);var vt=jt.e/LOG_BASE,ct=It.e/LOG_BASE,dt=jt.c,mt=It.c;if(!vt||!ct){if(!dt||!mt)return new $t(bt/0);if(!dt[0]||!mt[0])return mt[0]?It:new $t(dt[0]?jt:bt*0)}if(vt=bitFloor(vt),ct=bitFloor(ct),dt=dt.slice(),bt=vt-ct){for(bt>0?(ct=vt,Ft=mt):(bt=-bt,Ft=dt),Ft.reverse();bt--;Ft.push(0));Ft.reverse()}for(bt=dt.length,Bt=mt.length,bt-Bt<0&&(Ft=mt,mt=dt,dt=Ft,Bt=bt),bt=0;Bt;)bt=(dt[--Bt]=dt[Bt]+mt[Bt]+bt)/BASE|0,dt[Bt]=BASE===dt[Bt]?0:dt[Bt]%BASE;return bt&&(dt=[bt].concat(dt),++ct),Dt(It,dt,ct)},et.precision=et.sd=function(It,Bt){var Ft,jt,bt,vt=this;if(It!=null&&It!==!!It)return intCheck(It,1,MAX$1),Bt==null?Bt=nt:intCheck(Bt,0,8),zt(new $t(vt),It,Bt);if(!(Ft=vt.c))return null;if(bt=Ft.length-1,jt=bt*LOG_BASE+1,bt=Ft[bt]){for(;bt%10==0;bt/=10,jt--);for(bt=Ft[0];bt>=10;bt/=10,jt++);}return It&&vt.e+1>jt&&(jt=vt.e+1),jt},et.shiftedBy=function(It){return intCheck(It,-MAX_SAFE_INTEGER$2,MAX_SAFE_INTEGER$2),this.times("1e"+It)},et.squareRoot=et.sqrt=function(){var It,Bt,Ft,jt,bt,vt=this,ct=vt.c,dt=vt.s,mt=vt.e,xt=rt+4,At=new $t("0.5");if(dt!==1||!ct||!ct[0])return new $t(!dt||dt<0&&(!ct||ct[0])?NaN:ct?vt:1/0);if(dt=Math.sqrt(+Ot(vt)),dt==0||dt==1/0?(Bt=coeffToString(ct),(Bt.length+mt)%2==0&&(Bt+="0"),dt=Math.sqrt(+Bt),mt=bitFloor((mt+1)/2)-(mt<0||mt%2),dt==1/0?Bt="5e"+mt:(Bt=dt.toExponential(),Bt=Bt.slice(0,Bt.indexOf("e")+1)+mt),Ft=new $t(Bt)):Ft=new $t(dt+""),Ft.c[0]){for(mt=Ft.e,dt=mt+xt,dt<3&&(dt=0);;)if(bt=Ft,Ft=At.times(bt.plus(_(vt,bt,xt,1))),coeffToString(bt.c).slice(0,dt)===(Bt=coeffToString(Ft.c)).slice(0,dt))if(Ft.e0&&Et>0){for(vt=Et%dt||dt,At=Tt.substr(0,vt);vt0&&(At+=xt+Tt.slice(vt)),St&&(At="-"+At)}jt=Rt?At+(Ft.decimalSeparator||"")+((mt=+Ft.fractionGroupSize)?Rt.replace(new RegExp("\\d{"+mt+"}\\B","g"),"$&"+(Ft.fractionGroupSeparator||"")):Rt):At}return(Ft.prefix||"")+jt+(Ft.suffix||"")},et.toFraction=function(It){var Bt,Ft,jt,bt,vt,ct,dt,mt,xt,At,Rt,St,Tt=this,Et=Tt.c;if(It!=null&&(dt=new $t(It),!dt.isInteger()&&(dt.c||dt.s!==1)||dt.lt(tt)))throw Error(bignumberError+"Argument "+(dt.isInteger()?"out of range: ":"not an integer: ")+Ot(dt));if(!Et)return new $t(Tt);for(Bt=new $t(tt),xt=Ft=new $t(tt),jt=mt=new $t(tt),St=coeffToString(Et),vt=Bt.e=St.length-Tt.e-1,Bt.c[0]=POWS_TEN[(ct=vt%LOG_BASE)<0?LOG_BASE+ct:ct],It=!It||dt.comparedTo(Bt)>0?vt>0?Bt:xt:dt,ct=at,at=1/0,dt=new $t(St),mt.c[0]=0;At=_(dt,Bt,0,1),bt=Ft.plus(At.times(jt)),bt.comparedTo(It)!=1;)Ft=jt,jt=bt,xt=mt.plus(At.times(bt=xt)),mt=bt,Bt=dt.minus(At.times(bt=Bt)),dt=bt;return bt=_(It.minus(Ft),jt,0,1),mt=mt.plus(bt.times(xt)),Ft=Ft.plus(bt.times(jt)),mt.s=xt.s=Tt.s,vt=vt*2,Rt=_(xt,jt,vt,nt).minus(Tt).abs().comparedTo(_(mt,Ft,vt,nt).minus(Tt).abs())<1?[xt,jt]:[mt,Ft],at=ct,Rt},et.toNumber=function(){return+Ot(this)},et.toPrecision=function(It,Bt){return It!=null&&intCheck(It,1,MAX$1),Mt(this,It,Bt,2)},et.toString=function(It){var Bt,Ft=this,jt=Ft.s,bt=Ft.e;return bt===null?jt?(Bt="Infinity",jt<0&&(Bt="-"+Bt)):Bt="NaN":(It==null?Bt=bt<=it||bt>=st?toExponential(coeffToString(Ft.c),bt):toFixedPoint(coeffToString(Ft.c),bt,"0"):It===10&&Pt?(Ft=zt(new $t(Ft),rt+bt+1,nt),Bt=toFixedPoint(coeffToString(Ft.c),Ft.e,"0")):(intCheck(It,2,Ct.length,"Base"),Bt=$(toFixedPoint(coeffToString(Ft.c),bt,"0"),10,It,jt,!0)),jt<0&&Ft.c[0]&&(Bt="-"+Bt)),Bt},et.valueOf=et.toJSON=function(){return Ot(this)},et._isBigNumber=!0,et[Symbol.toStringTag]="BigNumber",et[Symbol.for("nodejs.util.inspect.custom")]=et.valueOf,a!=null&&$t.set(a),$t}function bitFloor(a){var _=a|0;return a>0||a===_?_:_-1}function coeffToString(a){for(var _,$,j=1,et=a.length,tt=a[0]+"";jst^$?1:-1;for(nt=(it=et.length)<(st=tt.length)?it:st,rt=0;rttt[rt]^$?1:-1;return it==st?0:it>st^$?1:-1}function intCheck(a,_,$,j){if(a<_||a>$||a!==mathfloor(a))throw Error(bignumberError+(j||"Argument")+(typeof a=="number"?a<_||a>$?" out of range: ":" not an integer: ":" not a primitive number: ")+String(a))}function isOdd(a){var _=a.c.length-1;return bitFloor(a.e/LOG_BASE)==_&&a.c[_]%2!=0}function toExponential(a,_){return(a.length>1?a.charAt(0)+"."+a.slice(1):a)+(_<0?"e":"e+")+_}function toFixedPoint(a,_,$){var j,et;if(_<0){for(et=$+".";++_;et+=$);a=et+a}else if(j=a.length,++_>j){for(et=$,_-=j;--_;et+=$);a+=et}else _",license$1="MIT",bugs={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,scripts:scripts$1,repository:repository$1,keywords,author:author$1,license:license$1,bugs,homepage:homepage$1,devDependencies:devDependencies$1,dependencies:dependencies$1};var utils$d={};(function(a){var _=a,$=bnExports$1,j=minimalisticAssert,et=utils$v;_.assert=j,_.toArray=et.toArray,_.zero2=et.zero2,_.toHex=et.toHex,_.encode=et.encode;function tt(ot,at,ut){var ht=new Array(Math.max(ot.bitLength(),ut)+1);ht.fill(0);for(var yt=1<(yt>>1)-1?Pt=(yt>>1)-$t:Pt=$t,wt.isubn(Pt)):Pt=0,ht[Ct]=Pt,wt.iushrn(1)}return ht}_.getNAF=tt;function rt(ot,at){var ut=[[],[]];ot=ot.clone(),at=at.clone();for(var ht=0,yt=0,wt;ot.cmpn(-ht)>0||at.cmpn(-yt)>0;){var Ct=ot.andln(3)+ht&3,Pt=at.andln(3)+yt&3;Ct===3&&(Ct=-1),Pt===3&&(Pt=-1);var $t;Ct&1?(wt=ot.andln(7)+ht&7,(wt===3||wt===5)&&Pt===2?$t=-Ct:$t=Ct):$t=0,ut[0].push($t);var Mt;Pt&1?(wt=at.andln(7)+yt&7,(wt===3||wt===5)&&Ct===2?Mt=-Pt:Mt=Pt):Mt=0,ut[1].push(Mt),2*ht===$t+1&&(ht=1-ht),2*yt===Mt+1&&(yt=1-yt),ot.iushrn(1),at.iushrn(1)}return ut}_.getJSF=rt;function nt(ot,at,ut){var ht="_"+at;ot.prototype[at]=function(){return this[ht]!==void 0?this[ht]:this[ht]=ut.call(this)}}_.cachedProperty=nt;function it(ot){return typeof ot=="string"?_.toArray(ot,"hex"):ot}_.parseBytes=it;function st(ot){return new $(ot,"hex","le")}_.intFromLE=st})(utils$d);var curve={},BN$8=bnExports$1,utils$c=utils$d,getNAF=utils$c.getNAF,getJSF=utils$c.getJSF,assert$9=utils$c.assert;function BaseCurve(a,_){this.type=a,this.p=new BN$8(_.p,16),this.red=_.prime?BN$8.red(_.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=_.n&&new BN$8(_.n,16),this.g=_.g&&this.pointFromJSON(_.g,_.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 a(){throw new Error("Not implemented")};BaseCurve.prototype.validate=function a(){throw new Error("Not implemented")};BaseCurve.prototype._fixedNafMul=function a(_,$){assert$9(_.precomputed);var j=_._getDoubles(),et=getNAF($,1,this._bitLength),tt=(1<=nt;st--)it=(it<<1)+et[st];rt.push(it)}for(var ot=this.jpoint(null,null,null),at=this.jpoint(null,null,null),ut=tt;ut>0;ut--){for(nt=0;nt=0;it--){for(var st=0;it>=0&&rt[it]===0;it--)st++;if(it>=0&&st++,nt=nt.dblp(st),it<0)break;var ot=rt[it];assert$9(ot!==0),_.type==="affine"?ot>0?nt=nt.mixedAdd(tt[ot-1>>1]):nt=nt.mixedAdd(tt[-ot-1>>1].neg()):ot>0?nt=nt.add(tt[ot-1>>1]):nt=nt.add(tt[-ot-1>>1].neg())}return _.type==="affine"?nt.toP():nt};BaseCurve.prototype._wnafMulAdd=function a(_,$,j,et,tt){var rt=this._wnafT1,nt=this._wnafT2,it=this._wnafT3,st=0,ot,at,ut;for(ot=0;ot=1;ot-=2){var yt=ot-1,wt=ot;if(rt[yt]!==1||rt[wt]!==1){it[yt]=getNAF(j[yt],rt[yt],this._bitLength),it[wt]=getNAF(j[wt],rt[wt],this._bitLength),st=Math.max(it[yt].length,st),st=Math.max(it[wt].length,st);continue}var Ct=[$[yt],null,null,$[wt]];$[yt].y.cmp($[wt].y)===0?(Ct[1]=$[yt].add($[wt]),Ct[2]=$[yt].toJ().mixedAdd($[wt].neg())):$[yt].y.cmp($[wt].y.redNeg())===0?(Ct[1]=$[yt].toJ().mixedAdd($[wt]),Ct[2]=$[yt].add($[wt].neg())):(Ct[1]=$[yt].toJ().mixedAdd($[wt]),Ct[2]=$[yt].toJ().mixedAdd($[wt].neg()));var Pt=[-3,-1,-5,-7,0,7,5,1,3],$t=getJSF(j[yt],j[wt]);for(st=Math.max($t[0].length,st),it[yt]=new Array(st),it[wt]=new Array(st),at=0;at=0;ot--){for(var Ot=0;ot>=0;){var It=!0;for(at=0;at=0&&Ot++,Dt=Dt.dblp(Ot),ot<0)break;for(at=0;at0?ut=nt[at][Bt-1>>1]:Bt<0&&(ut=nt[at][-Bt-1>>1].neg()),ut.type==="affine"?Dt=Dt.mixedAdd(ut):Dt=Dt.add(ut))}}for(ot=0;ot=Math.ceil((_.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+=_){for(var rt=0;rt<_;rt++)et=et.dbl();j.push(et)}return{step:_,points:j}};BasePoint.prototype._getNAFPoints=function a(_){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var $=[this],j=(1<<_)-1,et=j===1?null:this.dbl(),tt=1;tt=0&&(ht=st,yt=ot),at.negative&&(at=at.neg(),ut=ut.neg()),ht.negative&&(ht=ht.neg(),yt=yt.neg()),[{a:at,b:ut},{a:ht,b:yt}]};ShortCurve.prototype._endoSplit=function a(_){var $=this.endo.basis,j=$[0],et=$[1],tt=et.b.mul(_).divRound(this.n),rt=j.b.neg().mul(_).divRound(this.n),nt=tt.mul(j.a),it=rt.mul(et.a),st=tt.mul(j.b),ot=rt.mul(et.b),at=_.sub(nt).sub(it),ut=st.add(ot).neg();return{k1:at,k2:ut}};ShortCurve.prototype.pointFromX=function a(_,$){_=new BN$7(_,16),_.red||(_=_.toRed(this.red));var j=_.redSqr().redMul(_).redIAdd(_.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(_,et)};ShortCurve.prototype.validate=function a(_){if(_.inf)return!0;var $=_.x,j=_.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<_.length;rt++){var nt=this._endoSplit($[rt]),it=_[rt],st=it._getBeta();nt.k1.negative&&(nt.k1.ineg(),it=it.neg(!0)),nt.k2.negative&&(nt.k2.ineg(),st=st.neg(!0)),et[rt*2]=it,et[rt*2+1]=st,tt[rt*2]=nt.k1,tt[rt*2+1]=nt.k2}for(var ot=this._wnafMulAdd(1,et,tt,rt*2,j),at=0;at":""};Point$2.prototype.isInfinity=function a(){return this.inf};Point$2.prototype.add=function a(_){if(this.inf)return _;if(_.inf)return this;if(this.eq(_))return this.dbl();if(this.neg().eq(_))return this.curve.point(null,null);if(this.x.cmp(_.x)===0)return this.curve.point(null,null);var $=this.y.redSub(_.y);$.cmpn(0)!==0&&($=$.redMul(this.x.redSub(_.x).redInvm()));var j=$.redSqr().redISub(this.x).redISub(_.x),et=$.redMul(this.x.redSub(j)).redISub(this.y);return this.curve.point(j,et)};Point$2.prototype.dbl=function a(){if(this.inf)return this;var _=this.y.redAdd(this.y);if(_.cmpn(0)===0)return this.curve.point(null,null);var $=this.curve.a,j=this.x.redSqr(),et=_.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 a(){return this.x.fromRed()};Point$2.prototype.getY=function a(){return this.y.fromRed()};Point$2.prototype.mul=function a(_){return _=new BN$7(_,16),this.isInfinity()?this:this._hasDoubles(_)?this.curve._fixedNafMul(this,_):this.curve.endo?this.curve._endoWnafMulAdd([this],[_]):this.curve._wnafMul(this,_)};Point$2.prototype.mulAdd=function a(_,$,j){var et=[this,$],tt=[_,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=[_,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===_||this.inf===_.inf&&(this.inf||this.x.cmp(_.x)===0&&this.y.cmp(_.y)===0)};Point$2.prototype.neg=function a(_){if(this.inf)return this;var $=this.curve.point(this.x,this.y.redNeg());if(_&&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 a(){if(this.inf)return this.curve.jpoint(null,null,null);var _=this.curve.jpoint(this.x,this.y,this.curve.one);return _};function JPoint(a,_,$,j){Base$2.BasePoint.call(this,a,"jacobian"),_===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(_,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,_,$,j)};JPoint.prototype.toP=function a(){if(this.isInfinity())return this.curve.point(null,null);var _=this.z.redInvm(),$=_.redSqr(),j=this.x.redMul($),et=this.y.redMul($).redMul(_);return this.curve.point(j,et)};JPoint.prototype.neg=function a(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};JPoint.prototype.add=function a(_){if(this.isInfinity())return _;if(_.isInfinity())return this;var $=_.z.redSqr(),j=this.z.redSqr(),et=this.x.redMul($),tt=_.x.redMul(j),rt=this.y.redMul($.redMul(_.z)),nt=_.y.redMul(j.redMul(this.z)),it=et.redSub(tt),st=rt.redSub(nt);if(it.cmpn(0)===0)return st.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var ot=it.redSqr(),at=ot.redMul(it),ut=et.redMul(ot),ht=st.redSqr().redIAdd(at).redISub(ut).redISub(ut),yt=st.redMul(ut.redISub(ht)).redISub(rt.redMul(at)),wt=this.z.redMul(_.z).redMul(it);return this.curve.jpoint(ht,yt,wt)};JPoint.prototype.mixedAdd=function a(_){if(this.isInfinity())return _.toJ();if(_.isInfinity())return this;var $=this.z.redSqr(),j=this.x,et=_.x.redMul($),tt=this.y,rt=_.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 st=nt.redSqr(),ot=st.redMul(nt),at=j.redMul(st),ut=it.redSqr().redIAdd(ot).redISub(at).redISub(at),ht=it.redMul(at.redISub(ut)).redISub(tt.redMul(ot)),yt=this.z.redMul(nt);return this.curve.jpoint(ut,ht,yt)};JPoint.prototype.dblp=function a(_){if(_===0)return this;if(this.isInfinity())return this;if(!_)return this.dbl();var $;if(this.curve.zeroA||this.curve.threeA){var j=this;for($=0;$<_;$++)j=j.dbl();return j}var et=this.curve.a,tt=this.curve.tinv,rt=this.x,nt=this.y,it=this.z,st=it.redSqr().redSqr(),ot=nt.redAdd(nt);for($=0;$<_;$++){var at=rt.redSqr(),ut=ot.redSqr(),ht=ut.redSqr(),yt=at.redAdd(at).redIAdd(at).redIAdd(et.redMul(st)),wt=rt.redMul(ut),Ct=yt.redSqr().redISub(wt.redAdd(wt)),Pt=wt.redISub(Ct),$t=yt.redMul(Pt);$t=$t.redIAdd($t).redISub(ht);var Mt=ot.redMul(it);$+1<_&&(st=st.redMul(ht)),rt=Ct,it=Mt,ot=$t}return this.curve.jpoint(rt,ot.redMul(tt),it)};JPoint.prototype.dbl=function a(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()};JPoint.prototype._zeroDbl=function a(){var _,$,j;if(this.zOne){var et=this.x.redSqr(),tt=this.y.redSqr(),rt=tt.redSqr(),nt=this.x.redAdd(tt).redSqr().redISub(et).redISub(rt);nt=nt.redIAdd(nt);var it=et.redAdd(et).redIAdd(et),st=it.redSqr().redISub(nt).redISub(nt),ot=rt.redIAdd(rt);ot=ot.redIAdd(ot),ot=ot.redIAdd(ot),_=st,$=it.redMul(nt.redISub(st)).redISub(ot),j=this.y.redAdd(this.y)}else{var at=this.x.redSqr(),ut=this.y.redSqr(),ht=ut.redSqr(),yt=this.x.redAdd(ut).redSqr().redISub(at).redISub(ht);yt=yt.redIAdd(yt);var wt=at.redAdd(at).redIAdd(at),Ct=wt.redSqr(),Pt=ht.redIAdd(ht);Pt=Pt.redIAdd(Pt),Pt=Pt.redIAdd(Pt),_=Ct.redISub(yt).redISub(yt),$=wt.redMul(yt.redISub(_)).redISub(Pt),j=this.y.redMul(this.z),j=j.redIAdd(j)}return this.curve.jpoint(_,$,j)};JPoint.prototype._threeDbl=function a(){var _,$,j;if(this.zOne){var et=this.x.redSqr(),tt=this.y.redSqr(),rt=tt.redSqr(),nt=this.x.redAdd(tt).redSqr().redISub(et).redISub(rt);nt=nt.redIAdd(nt);var it=et.redAdd(et).redIAdd(et).redIAdd(this.curve.a),st=it.redSqr().redISub(nt).redISub(nt);_=st;var ot=rt.redIAdd(rt);ot=ot.redIAdd(ot),ot=ot.redIAdd(ot),$=it.redMul(nt.redISub(st)).redISub(ot),j=this.y.redAdd(this.y)}else{var at=this.z.redSqr(),ut=this.y.redSqr(),ht=this.x.redMul(ut),yt=this.x.redSub(at).redMul(this.x.redAdd(at));yt=yt.redAdd(yt).redIAdd(yt);var wt=ht.redIAdd(ht);wt=wt.redIAdd(wt);var Ct=wt.redAdd(wt);_=yt.redSqr().redISub(Ct),j=this.y.redAdd(this.z).redSqr().redISub(ut).redISub(at);var Pt=ut.redSqr();Pt=Pt.redIAdd(Pt),Pt=Pt.redIAdd(Pt),Pt=Pt.redIAdd(Pt),$=yt.redMul(wt.redISub(_)).redISub(Pt)}return this.curve.jpoint(_,$,j)};JPoint.prototype._dbl=function a(){var _=this.curve.a,$=this.x,j=this.y,et=this.z,tt=et.redSqr().redSqr(),rt=$.redSqr(),nt=j.redSqr(),it=rt.redAdd(rt).redIAdd(rt).redIAdd(_.redMul(tt)),st=$.redAdd($);st=st.redIAdd(st);var ot=st.redMul(nt),at=it.redSqr().redISub(ot.redAdd(ot)),ut=ot.redISub(at),ht=nt.redSqr();ht=ht.redIAdd(ht),ht=ht.redIAdd(ht),ht=ht.redIAdd(ht);var yt=it.redMul(ut).redISub(ht),wt=j.redAdd(j).redMul(et);return this.curve.jpoint(at,yt,wt)};JPoint.prototype.trpl=function a(){if(!this.curve.zeroA)return this.dbl().add(this);var _=this.x.redSqr(),$=this.y.redSqr(),j=this.z.redSqr(),et=$.redSqr(),tt=_.redAdd(_).redIAdd(_),rt=tt.redSqr(),nt=this.x.redAdd($).redSqr().redISub(_).redISub(et);nt=nt.redIAdd(nt),nt=nt.redAdd(nt).redIAdd(nt),nt=nt.redISub(rt);var it=nt.redSqr(),st=et.redIAdd(et);st=st.redIAdd(st),st=st.redIAdd(st),st=st.redIAdd(st);var ot=tt.redIAdd(nt).redSqr().redISub(rt).redISub(it).redISub(st),at=$.redMul(ot);at=at.redIAdd(at),at=at.redIAdd(at);var ut=this.x.redMul(it).redISub(at);ut=ut.redIAdd(ut),ut=ut.redIAdd(ut);var ht=this.y.redMul(ot.redMul(st.redISub(ot)).redISub(nt.redMul(it)));ht=ht.redIAdd(ht),ht=ht.redIAdd(ht),ht=ht.redIAdd(ht);var yt=this.z.redAdd(nt).redSqr().redISub(j).redISub(it);return this.curve.jpoint(ut,ht,yt)};JPoint.prototype.mul=function a(_,$){return _=new BN$7(_,$),this.curve._wnafMul(this,_)};JPoint.prototype.eq=function a(_){if(_.type==="affine")return this.eq(_.toJ());if(this===_)return!0;var $=this.z.redSqr(),j=_.z.redSqr();if(this.x.redMul(j).redISub(_.x.redMul($)).cmpn(0)!==0)return!1;var et=$.redMul(this.z),tt=j.redMul(_.z);return this.y.redMul(tt).redISub(_.y.redMul(et)).cmpn(0)===0};JPoint.prototype.eqXToP=function a(_){var $=this.z.redSqr(),j=_.toRed(this.curve.red).redMul($);if(this.x.cmp(j)===0)return!0;for(var et=_.clone(),tt=this.curve.redN.redMul($);;){if(et.iadd(this.curve.n),et.cmp(this.curve.p)>=0)return!1;if(j.redIAdd(tt),this.x.cmp(j)===0)return!0}};JPoint.prototype.inspect=function a(){return this.isInfinity()?"":""};JPoint.prototype.isInfinity=function a(){return this.z.cmpn(0)===0};var BN$6=bnExports$1,inherits$1=inherits_browserExports,Base$1=base,utils$a=utils$d;function MontCurve(a){Base$1.call(this,"mont",a),this.a=new BN$6(a.a,16).toRed(this.red),this.b=new BN$6(a.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 $=_.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,a,"projective"),_===null&&$===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new BN$6(_,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$a.toArray(_,$),1)};MontCurve.prototype.point=function a(_,$){return new Point$1(this,_,$)};MontCurve.prototype.pointFromJSON=function a(_){return Point$1.fromJSON(this,_)};Point$1.prototype.precompute=function a(){};Point$1.prototype._encode=function a(){return this.getX().toArray("be",this.curve.p.byteLength())};Point$1.fromJSON=function a(_,$){return new Point$1(_,$[0],$[1]||_.one)};Point$1.prototype.inspect=function a(){return this.isInfinity()?"":""};Point$1.prototype.isInfinity=function a(){return this.z.cmpn(0)===0};Point$1.prototype.dbl=function a(){var _=this.x.redAdd(this.z),$=_.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 a(){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=_.x.redAdd(_.z),rt=_.x.redSub(_.z),nt=rt.redMul(j),it=tt.redMul(et),st=$.z.redMul(nt.redAdd(it).redSqr()),ot=$.x.redMul(nt.redISub(it).redSqr());return this.curve.point(st,ot)};Point$1.prototype.mul=function a(_){for(var $=_.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 a(){throw new Error("Not supported on Montgomery curve")};Point$1.prototype.jumlAdd=function a(){throw new Error("Not supported on Montgomery curve")};Point$1.prototype.eq=function a(_){return this.getX().cmp(_.getX())===0};Point$1.prototype.normalize=function a(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};Point$1.prototype.getX=function a(){return this.normalize(),this.x.fromRed()};var utils$9=utils$d,BN$5=bnExports$1,inherits=inherits_browserExports,Base=base,assert$7=utils$9.assert;function EdwardsCurve(a){this.twisted=(a.a|0)!==1,this.mOneA=this.twisted&&(a.a|0)===-1,this.extended=this.mOneA,Base.call(this,"edwards",a),this.a=new BN$5(a.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new BN$5(a.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new BN$5(a.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),assert$7(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(a.c|0)===1}inherits(EdwardsCurve,Base);var edwards=EdwardsCurve;EdwardsCurve.prototype._mulA=function a(_){return this.mOneA?_.redNeg():this.a.redMul(_)};EdwardsCurve.prototype._mulC=function a(_){return this.oneC?_:this.c.redMul(_)};EdwardsCurve.prototype.jpoint=function a(_,$,j,et){return this.point(_,$,j,et)};EdwardsCurve.prototype.pointFromX=function a(_,$){_=new BN$5(_,16),_.red||(_=_.toRed(this.red));var j=_.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(_,nt)};EdwardsCurve.prototype.pointFromY=function a(_,$){_=new BN$5(_,16),_.red||(_=_.toRed(this.red));var j=_.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,_)}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,_)};EdwardsCurve.prototype.validate=function a(_){if(_.isInfinity())return!0;_.normalize();var $=_.x.redSqr(),j=_.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,a,"projective"),_===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(_,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,_)};EdwardsCurve.prototype.point=function a(_,$,j,et){return new Point(this,_,$,j,et)};Point.fromJSON=function a(_,$){return new Point(_,$[0],$[1],$[2])};Point.prototype.inspect=function a(){return this.isInfinity()?"":""};Point.prototype.isInfinity=function a(){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 a(){var _=this.x.redSqr(),$=this.y.redSqr(),j=this.z.redSqr();j=j.redIAdd(j);var et=this.curve._mulA(_),tt=this.x.redAdd(this.y).redSqr().redISub(_).redISub($),rt=et.redAdd($),nt=rt.redSub(j),it=et.redSub($),st=tt.redMul(nt),ot=rt.redMul(it),at=tt.redMul(it),ut=nt.redMul(rt);return this.curve.point(st,ot,ut,at)};Point.prototype._projDbl=function a(){var _=this.x.redAdd(this.y).redSqr(),$=this.x.redSqr(),j=this.y.redSqr(),et,tt,rt,nt,it,st;if(this.curve.twisted){nt=this.curve._mulA($);var ot=nt.redAdd(j);this.zOne?(et=_.redSub($).redSub(j).redMul(ot.redSub(this.curve.two)),tt=ot.redMul(nt.redSub(j)),rt=ot.redSqr().redSub(ot).redSub(ot)):(it=this.z.redSqr(),st=ot.redSub(it).redISub(it),et=_.redSub($).redISub(j).redMul(st),tt=ot.redMul(nt.redSub(j)),rt=ot.redMul(st))}else nt=$.redAdd(j),it=this.curve._mulC(this.z).redSqr(),st=nt.redSub(it).redSub(it),et=this.curve._mulC(_.redISub(nt)).redMul(st),tt=this.curve._mulC(nt).redMul($.redISub(j)),rt=nt.redMul(st);return this.curve.point(et,tt,rt)};Point.prototype.dbl=function a(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};Point.prototype._extAdd=function a(_){var $=this.y.redSub(this.x).redMul(_.y.redSub(_.x)),j=this.y.redAdd(this.x).redMul(_.y.redAdd(_.x)),et=this.t.redMul(this.curve.dd).redMul(_.t),tt=this.z.redMul(_.z.redAdd(_.z)),rt=j.redSub($),nt=tt.redSub(et),it=tt.redAdd(et),st=j.redAdd($),ot=rt.redMul(nt),at=it.redMul(st),ut=rt.redMul(st),ht=nt.redMul(it);return this.curve.point(ot,at,ht,ut)};Point.prototype._projAdd=function a(_){var $=this.z.redMul(_.z),j=$.redSqr(),et=this.x.redMul(_.x),tt=this.y.redMul(_.y),rt=this.curve.d.redMul(et).redMul(tt),nt=j.redSub(rt),it=j.redAdd(rt),st=this.x.redAdd(this.y).redMul(_.x.redAdd(_.y)).redISub(et).redISub(tt),ot=$.redMul(nt).redMul(st),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(ot,at,ut)};Point.prototype.add=function a(_){return this.isInfinity()?_:_.isInfinity()?this:this.curve.extended?this._extAdd(_):this._projAdd(_)};Point.prototype.mul=function a(_){return this._hasDoubles(_)?this.curve._fixedNafMul(this,_):this.curve._wnafMul(this,_)};Point.prototype.mulAdd=function a(_,$,j){return this.curve._wnafMulAdd(1,[this,$],[_,j],2,!1)};Point.prototype.jmulAdd=function a(_,$,j){return this.curve._wnafMulAdd(1,[this,$],[_,j],2,!0)};Point.prototype.normalize=function a(){if(this.zOne)return this;var _=this.z.redInvm();return this.x=this.x.redMul(_),this.y=this.y.redMul(_),this.t&&(this.t=this.t.redMul(_)),this.z=this.curve.one,this.zOne=!0,this};Point.prototype.neg=function a(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};Point.prototype.getX=function a(){return this.normalize(),this.x.fromRed()};Point.prototype.getY=function a(){return this.normalize(),this.y.fromRed()};Point.prototype.eq=function a(_){return this===_||this.getX().cmp(_.getX())===0&&this.getY().cmp(_.getY())===0};Point.prototype.eqXToP=function a(_){var $=_.toRed(this.curve.red).redMul(this.z);if(this.x.cmp($)===0)return!0;for(var j=_.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(a){var _=a;_.base=base,_.short=short,_.mont=mont,_.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(a){var _=a,$=hash$4,j=curve,et=utils$d,tt=et.assert;function rt(st){st.type==="short"?this.curve=new j.short(st):st.type==="edwards"?this.curve=new j.edwards(st):this.curve=new j.mont(st),this.g=this.curve.g,this.n=this.curve.n,this.hash=st.hash,tt(this.g.validate(),"Invalid curve"),tt(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}_.PresetCurve=rt;function nt(st,ot){Object.defineProperty(_,st,{configurable:!0,enumerable:!0,get:function(){var at=new rt(ot);return Object.defineProperty(_,st,{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$8=utils$d,assert$6=utils$8.assert;function KeyPair$3(a,_){this.ec=a,this.priv=null,this.pub=null,_.priv&&this._importPrivate(_.priv,_.privEnc),_.pub&&this._importPublic(_.pub,_.pubEnc)}var key$1=KeyPair$3;KeyPair$3.fromPublic=function a(_,$,j){return $ instanceof KeyPair$3?$:new KeyPair$3(_,{pub:$,pubEnc:j})};KeyPair$3.fromPrivate=function a(_,$,j){return $ instanceof KeyPair$3?$:new KeyPair$3(_,{priv:$,privEnc:j})};KeyPair$3.prototype.validate=function a(){var _=this.getPublic();return _.isInfinity()?{result:!1,reason:"Invalid public key"}:_.validate()?_.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 _=="string"&&($=_,_=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),$?this.pub.encode($,_):this.pub};KeyPair$3.prototype.getPrivate=function a(_){return _==="hex"?this.priv.toString(16,2):this.priv};KeyPair$3.prototype._importPrivate=function a(_,$){this.priv=new BN$4(_,$||16),this.priv=this.priv.umod(this.ec.curve.n)};KeyPair$3.prototype._importPublic=function a(_,$){if(_.x||_.y){this.ec.curve.type==="mont"?assert$6(_.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&assert$6(_.x&&_.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(_.x,_.y);return}this.pub=this.ec.curve.decodePoint(_,$)};KeyPair$3.prototype.derive=function a(_){return _.validate()||assert$6(_.validate(),"public point not validated"),_.mul(this.priv).getX()};KeyPair$3.prototype.sign=function a(_,$,j){return this.ec.sign(_,this,$,j)};KeyPair$3.prototype.verify=function a(_,$){return this.ec.verify(_,$,this)};KeyPair$3.prototype.inspect=function a(){return""};var BN$3=bnExports$1,utils$7=utils$d,assert$5=utils$7.assert;function Signature$3(a,_){if(a instanceof Signature$3)return a;this._importDER(a,_)||(assert$5(a.r&&a.s,"Signature without r or s"),this.r=new BN$3(a.r,16),this.s=new BN$3(a.s,16),a.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=a.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=_.place;tt>>=0;return et<=127?!1:(_.place=rt,et)}function rmPadding(a){for(var _=0,$=a.length-1;!a[_]&&!(a[_+1]&128)&&_<$;)_++;return _===0?a:a.slice(_)}Signature$3.prototype._importDER=function a(_,$){_=utils$7.toArray(_,$);var j=new Position;if(_[j.place++]!==48)return!1;var et=getLength(_,j);if(et===!1||et+j.place!==_.length||_[j.place++]!==2)return!1;var tt=getLength(_,j);if(tt===!1)return!1;var rt=_.slice(j.place,tt+j.place);if(j.place+=tt,_[j.place++]!==2)return!1;var nt=getLength(_,j);if(nt===!1||_.length!==nt+j.place)return!1;var it=_.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(_<128){a.push(_);return}var $=1+(Math.log(_)/Math.LN2>>>3);for(a.push($|128);--$;)a.push(_>>>($<<3)&255);a.push(_)}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$7.encode(rt,_)};var BN$2=bnExports$1,HmacDRBG=hmacDrbg,utils$6=utils$d,curves$1=curves$2,rand=requireBrorand(),assert$4=utils$6.assert,KeyPair$2=key$1,Signature$2=signature$1;function EC(a){if(!(this instanceof EC))return new EC(a);typeof a=="string"&&(assert$4(Object.prototype.hasOwnProperty.call(curves$1,a),"Unknown curve "+a),a=curves$1[a]),a instanceof curves$1.PresetCurve&&(a={curve:a}),this.curve=a.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=a.curve.g,this.g.precompute(a.curve.n.bitLength()+1),this.hash=a.hash||a.curve.hash}var ec$3=EC;EC.prototype.keyPair=function a(_){return new KeyPair$2(this,_)};EC.prototype.keyFromPrivate=function a(_,$){return KeyPair$2.fromPrivate(this,_,$)};EC.prototype.keyFromPublic=function a(_,$){return KeyPair$2.fromPublic(this,_,$)};EC.prototype.genKeyPair=function a(_){_||(_={});for(var $=new HmacDRBG({hash:this.hash,pers:_.pers,persEnc:_.persEnc||"utf8",entropy:_.entropy||rand(this.hash.hmacStrength),entropyEnc:_.entropy&&_.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=_.byteLength()*8-this.n.bitLength();return j>0&&(_=_.ushrn(j)),!$&&_.cmp(this.n)>=0?_.sub(this.n):_};EC.prototype.sign=function a(_,$,j,et){typeof j=="object"&&(et=j,j=null),et||(et={}),$=this.keyFromPrivate($,j),_=this._truncateToN(new BN$2(_,16));for(var tt=this.n.byteLength(),rt=$.getPrivate().toArray("be",tt),nt=_.toArray("be",tt),it=new HmacDRBG({hash:this.hash,entropy:rt,nonce:nt,pers:et.pers,persEnc:et.persEnc||"utf8"}),st=this.n.sub(new BN$2(1)),ot=0;;ot++){var at=et.k?et.k(ot):new BN$2(it.generate(this.n.byteLength()));if(at=this._truncateToN(at,!0),!(at.cmpn(1)<=0||at.cmp(st)>=0)){var ut=this.g.mul(at);if(!ut.isInfinity()){var ht=ut.getX(),yt=ht.umod(this.n);if(yt.cmpn(0)!==0){var wt=at.invm(this.n).mul(yt.mul($.getPrivate()).iadd(_));if(wt=wt.umod(this.n),wt.cmpn(0)!==0){var Ct=(ut.getY().isOdd()?1:0)|(ht.cmp(yt)!==0?2:0);return et.canonical&&wt.cmp(this.nh)>0&&(wt=this.n.sub(wt),Ct^=1),new Signature$2({r:yt,s:wt,recoveryParam:Ct})}}}}}};EC.prototype.verify=function a(_,$,j,et){_=this._truncateToN(new BN$2(_,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(_).umod(this.n),st=nt.mul(tt).umod(this.n),ot;return this.curve._maxwellTrick?(ot=this.g.jmulAdd(it,j.getPublic(),st),ot.isInfinity()?!1:ot.eqXToP(tt)):(ot=this.g.mulAdd(it,j.getPublic(),st),ot.isInfinity()?!1:ot.getX().umod(this.n).cmp(tt)===0)};EC.prototype.recoverPubKey=function(a,_,$,j){assert$4((3&$)===$,"The recovery param is more than two bits"),_=new Signature$2(_,j);var et=this.n,tt=new BN$2(a),rt=_.r,nt=_.s,it=$&1,st=$>>1;if(rt.cmp(this.curve.p.umod(this.curve.n))>=0&&st)throw new Error("Unable to find sencond key candinate");st?rt=this.curve.pointFromX(rt.add(this.curve.n),it):rt=this.curve.pointFromX(rt,it);var ot=_.r.invm(et),at=et.sub(tt).mul(ot).umod(et),ut=nt.mul(ot).umod(et);return this.g.mulAdd(at,rt,ut)};EC.prototype.getKeyRecoveryParam=function(a,_,$,j){if(_=new Signature$2(_,j),_.recoveryParam!==null)return _.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$5=utils$d,assert$3=utils$5.assert,parseBytes$3=utils$5.parseBytes,cachedProperty$1=utils$5.cachedProperty;function KeyPair$1(a,_){this.eddsa=a,this._secret=parseBytes$3(_.secret),a.isPoint(_.pub)?this._pub=_.pub:this._pubBytes=parseBytes$3(_.pub)}KeyPair$1.fromPublic=function a(_,$){return $ instanceof KeyPair$1?$:new KeyPair$1(_,{pub:$})};KeyPair$1.fromSecret=function a(_,$){return $ instanceof KeyPair$1?$:new KeyPair$1(_,{secret:$})};KeyPair$1.prototype.secret=function a(){return this._secret};cachedProperty$1(KeyPair$1,"pubBytes",function a(){return this.eddsa.encodePoint(this.pub())});cachedProperty$1(KeyPair$1,"pub",function a(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});cachedProperty$1(KeyPair$1,"privBytes",function a(){var _=this.eddsa,$=this.hash(),j=_.encodingLength-1,et=$.slice(0,_.encodingLength);return et[0]&=248,et[j]&=127,et[j]|=64,et});cachedProperty$1(KeyPair$1,"priv",function a(){return this.eddsa.decodeInt(this.privBytes())});cachedProperty$1(KeyPair$1,"hash",function a(){return this.eddsa.hash().update(this.secret()).digest()});cachedProperty$1(KeyPair$1,"messagePrefix",function a(){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(_,this)};KeyPair$1.prototype.verify=function a(_,$){return this.eddsa.verify(_,$,this)};KeyPair$1.prototype.getSecret=function a(_){return assert$3(this._secret,"KeyPair is public only"),utils$5.encode(this.secret(),_)};KeyPair$1.prototype.getPublic=function a(_){return utils$5.encode(this.pubBytes(),_)};var key=KeyPair$1,BN$1=bnExports$1,utils$4=utils$d,assert$2=utils$4.assert,cachedProperty=utils$4.cachedProperty,parseBytes$2=utils$4.parseBytes;function Signature$1(a,_){this.eddsa=a,typeof _!="object"&&(_=parseBytes$2(_)),Array.isArray(_)&&(_={R:_.slice(0,a.encodingLength),S:_.slice(a.encodingLength)}),assert$2(_.R&&_.S,"Signature without R or S"),a.isPoint(_.R)&&(this._R=_.R),_.S instanceof BN$1&&(this._S=_.S),this._Rencoded=Array.isArray(_.R)?_.R:_.Rencoded,this._Sencoded=Array.isArray(_.S)?_.S:_.Sencoded}cachedProperty(Signature$1,"S",function a(){return this.eddsa.decodeInt(this.Sencoded())});cachedProperty(Signature$1,"R",function a(){return this.eddsa.decodePoint(this.Rencoded())});cachedProperty(Signature$1,"Rencoded",function a(){return this.eddsa.encodePoint(this.R())});cachedProperty(Signature$1,"Sencoded",function a(){return this.eddsa.encodeInt(this.S())});Signature$1.prototype.toBytes=function a(){return this.Rencoded().concat(this.Sencoded())};Signature$1.prototype.toHex=function a(){return utils$4.encode(this.toBytes(),"hex").toUpperCase()};var signature=Signature$1,hash$1=hash$4,curves=curves$2,utils$3=utils$d,assert$1=utils$3.assert,parseBytes$1=utils$3.parseBytes,KeyPair=key,Signature=signature;function EDDSA(a){if(assert$1(a==="ed25519","only tested with ed25519 so far"),!(this instanceof EDDSA))return new EDDSA(a);a=curves[a].curve,this.curve=a,this.g=a.g,this.g.precompute(a.n.bitLength()+1),this.pointClass=a.point().constructor,this.encodingLength=Math.ceil(a.n.bitLength()/8),this.hash=hash$1.sha512}var eddsa=EDDSA;EDDSA.prototype.sign=function a(_,$){_=parseBytes$1(_);var j=this.keyFromSecret($),et=this.hashInt(j.messagePrefix(),_),tt=this.g.mul(et),rt=this.encodePoint(tt),nt=this.hashInt(rt,j.pubBytes(),_).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){_=parseBytes$1(_),$=this.makeSignature($);var et=this.keyFromPublic(j),tt=this.hashInt($.Rencoded(),et.pubBytes(),_),rt=this.g.mul($.S()),nt=$.R().add(et.pub().mul(tt));return nt.eq(rt)};EDDSA.prototype.hashInt=function a(){for(var _=this.hash(),$=0;$bs58check$1.decode(a).slice(_.length);function b58decode(a){const _=bs58check$1.decode(a),j={[prefix.tz1.toString()]:"0000",[prefix.tz2.toString()]:"0001",[prefix.tz3.toString()]:"0002"}[new Uint8Array(_.slice(0,3)).toString()];if(j){const et=buf2hex(_.slice(3));return j+et}else return"01"+buf2hex(_.slice(3,42))+"00"}function encodeAddress(a){if(a.substring(0,2)==="0x"&&(a=a.slice(2)),a.substring(0,2)==="00"){const _={"0000":prefix.tz1,"0001":prefix.tz2,"0002":prefix.tz3};return b58cencode(a.substring(4),_[a.substring(0,4)])}return b58cencode(a.substring(2,42),prefix.KT)}function encodeKey(a){if(a[0]==="0"){const _={"00":new Uint8Array([13,15,37,217]),"01":new Uint8Array([3,254,226,86]),"02":new Uint8Array([3,178,139,127])};return b58cencode(a.substring(2),_[a.substring(0,2)])}}function encodeKeyHash(a){if(a[0]==="0"){const _={"00":new Uint8Array([6,161,159]),"01":new Uint8Array([6,161,161]),"02":new Uint8Array([6,161,164])};return b58cencode(a.substring(2),_[a.substring(0,2)])}}const hex2buf=a=>{if(a.length%2!==0)throw new InvalidHexStringError(a,": Expecting even number of characters");const _=stripHexPrefix$1(a);if(!_.match(/^([\da-f]{2})*$/gi))throw new InvalidHexStringError(a,": Only characters 0-9, a-f and A-F are expected. Optionally, it can be prefixed with '0x'");const $=new Uint8Array(_.length/2);let j=0;for(let et=0;et<_.length;et+=2){const tt=parseInt(_.slice(et,et+2),16);if(Number.isNaN(tt))throw new ValueConversionError(a,"Uint8Array");$[j++]=tt}return $},mergebuf=(a,_)=>{const $=new Uint8Array(a.length+_.length);return $.set(a),$.set(_,a.length),$},buf2hex=a=>{const _=[];return a.forEach($=>{const et=`00${$.toString(16)}`.slice(-2);_.push(et)}),_.join("")};function hex2Bytes(a){const _=stripHexPrefix$1(a);if(!_.match(/^(0x)?([\da-f]{2})*$/gi))throw new InvalidHexStringError(a,": Expecting even number of characters: 0-9, a-z, A-Z, optionally prefixed with 0x");return buffer$1.Buffer.from(_,"hex")}function stripHexPrefix$1(a){return a.startsWith("0x")?a.slice(2):a}var util;(function(a){a.assertEqual=et=>et;function _(et){}a.assertIs=_;function $(et){throw new Error}a.assertNever=$,a.arrayToEnum=et=>{const tt={};for(const rt of et)tt[rt]=rt;return tt},a.getValidEnumValues=et=>{const tt=a.objectKeys(et).filter(nt=>typeof et[et[nt]]!="number"),rt={};for(const nt of tt)rt[nt]=et[nt];return a.objectValues(rt)},a.objectValues=et=>a.objectKeys(et).map(function(tt){return et[tt]}),a.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},a.find=(et,tt)=>{for(const rt of et)if(tt(rt))return rt},a.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)}a.joinValues=j,a.jsonStringifyReplacer=(et,tt)=>typeof tt=="bigint"?tt.toString():tt})(util||(util={}));var objectUtil;(function(a){a.mergeShapes=(_,$)=>({..._,...$})})(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=a=>{switch(typeof a){case"undefined":return ZodParsedType.undefined;case"string":return ZodParsedType.string;case"number":return isNaN(a)?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(a)?ZodParsedType.array:a===null?ZodParsedType.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?ZodParsedType.promise:typeof Map<"u"&&a instanceof Map?ZodParsedType.map:typeof Set<"u"&&a instanceof Set?ZodParsedType.set:typeof Date<"u"&&a 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=a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:");class ZodError extends Error{constructor(_){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=_}get errors(){return this.issues}format(_){const $=_||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(_(et))):j.push(_(et));return{formErrors:j,fieldErrors:$}}get formErrors(){return this.flatten()}}ZodError.create=a=>new ZodError(a);const errorMap=(a,_)=>{let $;switch(a.code){case ZodIssueCode.invalid_type:a.received===ZodParsedType.undefined?$="Required":$=`Expected ${a.expected}, received ${a.received}`;break;case ZodIssueCode.invalid_literal:$=`Invalid literal value, expected ${JSON.stringify(a.expected,util.jsonStringifyReplacer)}`;break;case ZodIssueCode.unrecognized_keys:$=`Unrecognized key(s) in object: ${util.joinValues(a.keys,", ")}`;break;case ZodIssueCode.invalid_union:$="Invalid input";break;case ZodIssueCode.invalid_union_discriminator:$=`Invalid discriminator value. Expected ${util.joinValues(a.options)}`;break;case ZodIssueCode.invalid_enum_value:$=`Invalid enum value. Expected ${util.joinValues(a.options)}, received '${a.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 a.validation=="object"?"includes"in a.validation?($=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&($=`${$} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?$=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?$=`Invalid input: must end with "${a.validation.endsWith}"`:util.assertNever(a.validation):a.validation!=="regex"?$=`Invalid ${a.validation}`:$="Invalid";break;case ZodIssueCode.too_small:a.type==="array"?$=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?$=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?$=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?$=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:$="Invalid input";break;case ZodIssueCode.too_big:a.type==="array"?$=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?$=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?$=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?$=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?$=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.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 ${a.multipleOf}`;break;case ZodIssueCode.not_finite:$="Number must be finite";break;default:$=_.defaultError,util.assertNever(a)}return{message:$}};let overrideErrorMap=errorMap;function setErrorMap(a){overrideErrorMap=a}function getErrorMap(){return overrideErrorMap}const makeIssue=a=>{const{data:_,path:$,errorMaps:j,issueData:et}=a,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(st=>!!st).slice().reverse();for(const st of it)nt=st(rt,{data:_,defaultError:nt}).message;return{...et,path:tt,message:nt}},EMPTY_PATH=[];function addIssueToContext(a,_){const $=getErrorMap(),j=makeIssue({issueData:_,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,$,$===errorMap?void 0:errorMap].filter(et=>!!et)});a.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(_,$){const j=[];for(const et of $){if(et.status==="aborted")return INVALID;et.status==="dirty"&&_.dirty(),j.push(et.value)}return{status:_.value,value:j}}static async mergeObjectAsync(_,$){const j=[];for(const et of $){const tt=await et.key,rt=await et.value;j.push({key:tt,value:rt})}return ParseStatus.mergeObjectSync(_,j)}static mergeObjectSync(_,$){const j={};for(const et of $){const{key:tt,value:rt}=et;if(tt.status==="aborted"||rt.status==="aborted")return INVALID;tt.status==="dirty"&&_.dirty(),rt.status==="dirty"&&_.dirty(),tt.value!=="__proto__"&&(typeof rt.value<"u"||et.alwaysSet)&&(j[tt.value]=rt.value)}return{status:_.value,value:j}}}const INVALID=Object.freeze({status:"aborted"}),DIRTY=a=>({status:"dirty",value:a}),OK=a=>({status:"valid",value:a}),isAborted=a=>a.status==="aborted",isDirty=a=>a.status==="dirty",isValid$1=a=>a.status==="valid",isAsync=a=>typeof Promise<"u"&&a instanceof Promise;function __classPrivateFieldGet$1(a,_,$,j){if(typeof _=="function"?a!==_||!j:!_.has(a))throw new TypeError("Cannot read private member from an object whose class did not declare it");return _.get(a)}function __classPrivateFieldSet$1(a,_,$,j,et){if(typeof _=="function"?a!==_||!et:!_.has(a))throw new TypeError("Cannot write private member to an object whose class did not declare it");return _.set(a,$),$}typeof SuppressedError=="function"&&SuppressedError;var errorUtil;(function(a){a.errToObj=_=>typeof _=="string"?{message:_}:_||{},a.toString=_=>typeof _=="string"?_:_==null?void 0:_.message})(errorUtil||(errorUtil={}));var _ZodEnum_cache,_ZodNativeEnum_cache;class ParseInputLazyPath{constructor(_,$,j,et){this._cachedPath=[],this.parent=_,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(_))return{success:!0,data:_.value};if(!a.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(a.common.issues);return this._error=$,this._error}}};function processCreateParams(a){if(!a)return{};const{errorMap:_,invalid_type_error:$,required_error:j,description:et}=a;if(_&&($||j))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return _?{errorMap:_,description:et}:{errorMap:(rt,nt)=>{var it,st;const{message:ot}=a;return rt.code==="invalid_enum_value"?{message:ot??nt.defaultError}:typeof nt.data>"u"?{message:(it=ot??j)!==null&&it!==void 0?it:nt.defaultError}:rt.code!=="invalid_type"?{message:nt.defaultError}:{message:(st=ot??$)!==null&&st!==void 0?st:nt.defaultError}},description:et}}class ZodType{constructor(_){this.spa=this.safeParseAsync,this._def=_,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(_){return getParsedType(_.data)}_getOrReturnCtx(_,$){return $||{common:_.parent.common,data:_.data,parsedType:getParsedType(_.data),schemaErrorMap:this._def.errorMap,path:_.path,parent:_.parent}}_processInputParams(_){return{status:new ParseStatus,ctx:{common:_.parent.common,data:_.data,parsedType:getParsedType(_.data),schemaErrorMap:this._def.errorMap,path:_.path,parent:_.parent}}}_parseSync(_){const $=this._parse(_);if(isAsync($))throw new Error("Synchronous parse encountered promise.");return $}_parseAsync(_){const $=this._parse(_);return Promise.resolve($)}parse(_,$){const j=this.safeParse(_,$);if(j.success)return j.data;throw j.error}safeParse(_,$){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:_,parsedType:getParsedType(_)},tt=this._parseSync({data:_,path:et.path,parent:et});return handleResult(et,tt)}async parseAsync(_,$){const j=await this.safeParseAsync(_,$);if(j.success)return j.data;throw j.error}async safeParseAsync(_,$){const j={common:{issues:[],contextualErrorMap:$==null?void 0:$.errorMap,async:!0},path:($==null?void 0:$.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:_,parsedType:getParsedType(_)},et=this._parse({data:_,path:j.path,parent:j}),tt=await(isAsync(et)?et:Promise.resolve(et));return handleResult(j,tt)}refine(_,$){const j=et=>typeof $=="string"||typeof $>"u"?{message:$}:typeof $=="function"?$(et):$;return this._refinement((et,tt)=>{const rt=_(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(_,$){return this._refinement((j,et)=>_(j)?!0:(et.addIssue(typeof $=="function"?$(j,et):$),!1))}_refinement(_){return new ZodEffects({schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"refinement",refinement:_}})}superRefine(_){return this._refinement(_)}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(_){return ZodUnion.create([this,_],this._def)}and(_){return ZodIntersection.create(this,_,this._def)}transform(_){return new ZodEffects({...processCreateParams(this._def),schema:this,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:{type:"transform",transform:_}})}default(_){const $=typeof _=="function"?_:()=>_;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(_){const $=typeof _=="function"?_:()=>_;return new ZodCatch({...processCreateParams(this._def),innerType:this,catchValue:$,typeName:ZodFirstPartyTypeKind.ZodCatch})}describe(_){const $=this.constructor;return new $({...this._def,description:_})}pipe(_){return ZodPipeline.create(this,_)}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(a){let _="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return a.precision?_=`${_}\\.\\d{${a.precision}}`:a.precision==null&&(_=`${_}(\\.\\d+)?`),_}function timeRegex(a){return new RegExp(`^${timeRegexSource(a)}$`)}function datetimeRegex(a){let _=`${dateRegexSource}T${timeRegexSource(a)}`;const $=[];return $.push(a.local?"Z?":"Z"),a.offset&&$.push("([+-]\\d{2}:?\\d{2})"),_=`${_}(${$.join("|")})`,new RegExp(`^${_}$`)}function isValidIP(a,_){return!!((_==="v4"||!_)&&ipv4Regex.test(a)||(_==="v6"||!_)&&ipv6Regex.test(a))}class ZodString extends ZodType{_parse(_){if(this._def.coerce&&(_.data=String(_.data)),this._getType(_)!==ZodParsedType.string){const tt=this._getOrReturnCtx(_);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")_.data.lengthtt.value&&(et=this._getOrReturnCtx(_,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=_.data.length>tt.value,nt=_.data.length_.test(et),{validation:$,code:ZodIssueCode.invalid_string,...errorUtil.errToObj(j)})}_addCheck(_){return new ZodString({...this._def,checks:[...this._def.checks,_]})}email(_){return this._addCheck({kind:"email",...errorUtil.errToObj(_)})}url(_){return this._addCheck({kind:"url",...errorUtil.errToObj(_)})}emoji(_){return this._addCheck({kind:"emoji",...errorUtil.errToObj(_)})}uuid(_){return this._addCheck({kind:"uuid",...errorUtil.errToObj(_)})}nanoid(_){return this._addCheck({kind:"nanoid",...errorUtil.errToObj(_)})}cuid(_){return this._addCheck({kind:"cuid",...errorUtil.errToObj(_)})}cuid2(_){return this._addCheck({kind:"cuid2",...errorUtil.errToObj(_)})}ulid(_){return this._addCheck({kind:"ulid",...errorUtil.errToObj(_)})}base64(_){return this._addCheck({kind:"base64",...errorUtil.errToObj(_)})}ip(_){return this._addCheck({kind:"ip",...errorUtil.errToObj(_)})}datetime(_){var $,j;return typeof _=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:_}):this._addCheck({kind:"datetime",precision:typeof(_==null?void 0:_.precision)>"u"?null:_==null?void 0:_.precision,offset:($=_==null?void 0:_.offset)!==null&&$!==void 0?$:!1,local:(j=_==null?void 0:_.local)!==null&&j!==void 0?j:!1,...errorUtil.errToObj(_==null?void 0:_.message)})}date(_){return this._addCheck({kind:"date",message:_})}time(_){return typeof _=="string"?this._addCheck({kind:"time",precision:null,message:_}):this._addCheck({kind:"time",precision:typeof(_==null?void 0:_.precision)>"u"?null:_==null?void 0:_.precision,...errorUtil.errToObj(_==null?void 0:_.message)})}duration(_){return this._addCheck({kind:"duration",...errorUtil.errToObj(_)})}regex(_,$){return this._addCheck({kind:"regex",regex:_,...errorUtil.errToObj($)})}includes(_,$){return this._addCheck({kind:"includes",value:_,position:$==null?void 0:$.position,...errorUtil.errToObj($==null?void 0:$.message)})}startsWith(_,$){return this._addCheck({kind:"startsWith",value:_,...errorUtil.errToObj($)})}endsWith(_,$){return this._addCheck({kind:"endsWith",value:_,...errorUtil.errToObj($)})}min(_,$){return this._addCheck({kind:"min",value:_,...errorUtil.errToObj($)})}max(_,$){return this._addCheck({kind:"max",value:_,...errorUtil.errToObj($)})}length(_,$){return this._addCheck({kind:"length",value:_,...errorUtil.errToObj($)})}nonempty(_){return this.min(1,errorUtil.errToObj(_))}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(_=>_.kind==="datetime")}get isDate(){return!!this._def.checks.find(_=>_.kind==="date")}get isTime(){return!!this._def.checks.find(_=>_.kind==="time")}get isDuration(){return!!this._def.checks.find(_=>_.kind==="duration")}get isEmail(){return!!this._def.checks.find(_=>_.kind==="email")}get isURL(){return!!this._def.checks.find(_=>_.kind==="url")}get isEmoji(){return!!this._def.checks.find(_=>_.kind==="emoji")}get isUUID(){return!!this._def.checks.find(_=>_.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(_=>_.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(_=>_.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(_=>_.kind==="cuid2")}get isULID(){return!!this._def.checks.find(_=>_.kind==="ulid")}get isIP(){return!!this._def.checks.find(_=>_.kind==="ip")}get isBase64(){return!!this._def.checks.find(_=>_.kind==="base64")}get minLength(){let _=null;for(const $ of this._def.checks)$.kind==="min"&&(_===null||$.value>_)&&(_=$.value);return _}get maxLength(){let _=null;for(const $ of this._def.checks)$.kind==="max"&&(_===null||$.value<_)&&(_=$.value);return _}}ZodString.create=a=>{var _;return new ZodString({checks:[],typeName:ZodFirstPartyTypeKind.ZodString,coerce:(_=a==null?void 0:a.coerce)!==null&&_!==void 0?_:!1,...processCreateParams(a)})};function floatSafeRemainder(a,_){const $=(a.toString().split(".")[1]||"").length,j=(_.toString().split(".")[1]||"").length,et=$>j?$:j,tt=parseInt(a.toFixed(et).replace(".","")),rt=parseInt(_.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(_){if(this._def.coerce&&(_.data=Number(_.data)),this._getType(_)!==ZodParsedType.number){const tt=this._getOrReturnCtx(_);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(_.data)||(j=this._getOrReturnCtx(_,j),addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:"integer",received:"float",message:tt.message}),et.dirty()):tt.kind==="min"?(tt.inclusive?_.datatt.value:_.data>=tt.value)&&(j=this._getOrReturnCtx(_,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(_.data,tt.value)!==0&&(j=this._getOrReturnCtx(_,j),addIssueToContext(j,{code:ZodIssueCode.not_multiple_of,multipleOf:tt.value,message:tt.message}),et.dirty()):tt.kind==="finite"?Number.isFinite(_.data)||(j=this._getOrReturnCtx(_,j),addIssueToContext(j,{code:ZodIssueCode.not_finite,message:tt.message}),et.dirty()):util.assertNever(tt);return{status:et.value,value:_.data}}gte(_,$){return this.setLimit("min",_,!0,errorUtil.toString($))}gt(_,$){return this.setLimit("min",_,!1,errorUtil.toString($))}lte(_,$){return this.setLimit("max",_,!0,errorUtil.toString($))}lt(_,$){return this.setLimit("max",_,!1,errorUtil.toString($))}setLimit(_,$,j,et){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:_,value:$,inclusive:j,message:errorUtil.toString(et)}]})}_addCheck(_){return new ZodNumber({...this._def,checks:[...this._def.checks,_]})}int(_){return this._addCheck({kind:"int",message:errorUtil.toString(_)})}positive(_){return this._addCheck({kind:"min",value:0,inclusive:!1,message:errorUtil.toString(_)})}negative(_){return this._addCheck({kind:"max",value:0,inclusive:!1,message:errorUtil.toString(_)})}nonpositive(_){return this._addCheck({kind:"max",value:0,inclusive:!0,message:errorUtil.toString(_)})}nonnegative(_){return this._addCheck({kind:"min",value:0,inclusive:!0,message:errorUtil.toString(_)})}multipleOf(_,$){return this._addCheck({kind:"multipleOf",value:_,message:errorUtil.toString($)})}finite(_){return this._addCheck({kind:"finite",message:errorUtil.toString(_)})}safe(_){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:errorUtil.toString(_)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:errorUtil.toString(_)})}get minValue(){let _=null;for(const $ of this._def.checks)$.kind==="min"&&(_===null||$.value>_)&&(_=$.value);return _}get maxValue(){let _=null;for(const $ of this._def.checks)$.kind==="max"&&(_===null||$.value<_)&&(_=$.value);return _}get isInt(){return!!this._def.checks.find(_=>_.kind==="int"||_.kind==="multipleOf"&&util.isInteger(_.value))}get isFinite(){let _=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"&&(_===null||j.value<_)&&(_=j.value)}return Number.isFinite($)&&Number.isFinite(_)}}ZodNumber.create=a=>new ZodNumber({checks:[],typeName:ZodFirstPartyTypeKind.ZodNumber,coerce:(a==null?void 0:a.coerce)||!1,...processCreateParams(a)});class ZodBigInt extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(_){if(this._def.coerce&&(_.data=BigInt(_.data)),this._getType(_)!==ZodParsedType.bigint){const tt=this._getOrReturnCtx(_);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?_.datatt.value:_.data>=tt.value)&&(j=this._getOrReturnCtx(_,j),addIssueToContext(j,{code:ZodIssueCode.too_big,type:"bigint",maximum:tt.value,inclusive:tt.inclusive,message:tt.message}),et.dirty()):tt.kind==="multipleOf"?_.data%tt.value!==BigInt(0)&&(j=this._getOrReturnCtx(_,j),addIssueToContext(j,{code:ZodIssueCode.not_multiple_of,multipleOf:tt.value,message:tt.message}),et.dirty()):util.assertNever(tt);return{status:et.value,value:_.data}}gte(_,$){return this.setLimit("min",_,!0,errorUtil.toString($))}gt(_,$){return this.setLimit("min",_,!1,errorUtil.toString($))}lte(_,$){return this.setLimit("max",_,!0,errorUtil.toString($))}lt(_,$){return this.setLimit("max",_,!1,errorUtil.toString($))}setLimit(_,$,j,et){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:_,value:$,inclusive:j,message:errorUtil.toString(et)}]})}_addCheck(_){return new ZodBigInt({...this._def,checks:[...this._def.checks,_]})}positive(_){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:errorUtil.toString(_)})}negative(_){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:errorUtil.toString(_)})}nonpositive(_){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:errorUtil.toString(_)})}nonnegative(_){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:errorUtil.toString(_)})}multipleOf(_,$){return this._addCheck({kind:"multipleOf",value:_,message:errorUtil.toString($)})}get minValue(){let _=null;for(const $ of this._def.checks)$.kind==="min"&&(_===null||$.value>_)&&(_=$.value);return _}get maxValue(){let _=null;for(const $ of this._def.checks)$.kind==="max"&&(_===null||$.value<_)&&(_=$.value);return _}}ZodBigInt.create=a=>{var _;return new ZodBigInt({checks:[],typeName:ZodFirstPartyTypeKind.ZodBigInt,coerce:(_=a==null?void 0:a.coerce)!==null&&_!==void 0?_:!1,...processCreateParams(a)})};class ZodBoolean extends ZodType{_parse(_){if(this._def.coerce&&(_.data=!!_.data),this._getType(_)!==ZodParsedType.boolean){const j=this._getOrReturnCtx(_);return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.boolean,received:j.parsedType}),INVALID}return OK(_.data)}}ZodBoolean.create=a=>new ZodBoolean({typeName:ZodFirstPartyTypeKind.ZodBoolean,coerce:(a==null?void 0:a.coerce)||!1,...processCreateParams(a)});class ZodDate extends ZodType{_parse(_){if(this._def.coerce&&(_.data=new Date(_.data)),this._getType(_)!==ZodParsedType.date){const tt=this._getOrReturnCtx(_);return addIssueToContext(tt,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.date,received:tt.parsedType}),INVALID}if(isNaN(_.data.getTime())){const tt=this._getOrReturnCtx(_);return addIssueToContext(tt,{code:ZodIssueCode.invalid_date}),INVALID}const j=new ParseStatus;let et;for(const tt of this._def.checks)tt.kind==="min"?_.data.getTime()tt.value&&(et=this._getOrReturnCtx(_,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(_.data.getTime())}}_addCheck(_){return new ZodDate({...this._def,checks:[...this._def.checks,_]})}min(_,$){return this._addCheck({kind:"min",value:_.getTime(),message:errorUtil.toString($)})}max(_,$){return this._addCheck({kind:"max",value:_.getTime(),message:errorUtil.toString($)})}get minDate(){let _=null;for(const $ of this._def.checks)$.kind==="min"&&(_===null||$.value>_)&&(_=$.value);return _!=null?new Date(_):null}get maxDate(){let _=null;for(const $ of this._def.checks)$.kind==="max"&&(_===null||$.value<_)&&(_=$.value);return _!=null?new Date(_):null}}ZodDate.create=a=>new ZodDate({checks:[],coerce:(a==null?void 0:a.coerce)||!1,typeName:ZodFirstPartyTypeKind.ZodDate,...processCreateParams(a)});class ZodSymbol extends ZodType{_parse(_){if(this._getType(_)!==ZodParsedType.symbol){const j=this._getOrReturnCtx(_);return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.symbol,received:j.parsedType}),INVALID}return OK(_.data)}}ZodSymbol.create=a=>new ZodSymbol({typeName:ZodFirstPartyTypeKind.ZodSymbol,...processCreateParams(a)});class ZodUndefined extends ZodType{_parse(_){if(this._getType(_)!==ZodParsedType.undefined){const j=this._getOrReturnCtx(_);return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.undefined,received:j.parsedType}),INVALID}return OK(_.data)}}ZodUndefined.create=a=>new ZodUndefined({typeName:ZodFirstPartyTypeKind.ZodUndefined,...processCreateParams(a)});class ZodNull extends ZodType{_parse(_){if(this._getType(_)!==ZodParsedType.null){const j=this._getOrReturnCtx(_);return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.null,received:j.parsedType}),INVALID}return OK(_.data)}}ZodNull.create=a=>new ZodNull({typeName:ZodFirstPartyTypeKind.ZodNull,...processCreateParams(a)});class ZodAny extends ZodType{constructor(){super(...arguments),this._any=!0}_parse(_){return OK(_.data)}}ZodAny.create=a=>new ZodAny({typeName:ZodFirstPartyTypeKind.ZodAny,...processCreateParams(a)});class ZodUnknown extends ZodType{constructor(){super(...arguments),this._unknown=!0}_parse(_){return OK(_.data)}}ZodUnknown.create=a=>new ZodUnknown({typeName:ZodFirstPartyTypeKind.ZodUnknown,...processCreateParams(a)});class ZodNever extends ZodType{_parse(_){const $=this._getOrReturnCtx(_);return addIssueToContext($,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.never,received:$.parsedType}),INVALID}}ZodNever.create=a=>new ZodNever({typeName:ZodFirstPartyTypeKind.ZodNever,...processCreateParams(a)});class ZodVoid extends ZodType{_parse(_){if(this._getType(_)!==ZodParsedType.undefined){const j=this._getOrReturnCtx(_);return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.void,received:j.parsedType}),INVALID}return OK(_.data)}}ZodVoid.create=a=>new ZodVoid({typeName:ZodFirstPartyTypeKind.ZodVoid,...processCreateParams(a)});class ZodArray extends ZodType{_parse(_){const{ctx:$,status:j}=this._processInputParams(_),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(_,$){return new ZodArray({...this._def,minLength:{value:_,message:errorUtil.toString($)}})}max(_,$){return new ZodArray({...this._def,maxLength:{value:_,message:errorUtil.toString($)}})}length(_,$){return new ZodArray({...this._def,exactLength:{value:_,message:errorUtil.toString($)}})}nonempty(_){return this.min(1,_)}}ZodArray.create=(a,_)=>new ZodArray({type:a,minLength:null,maxLength:null,exactLength:null,typeName:ZodFirstPartyTypeKind.ZodArray,...processCreateParams(_)});function deepPartialify(a){if(a instanceof ZodObject){const _={};for(const $ in a.shape){const j=a.shape[$];_[$]=ZodOptional.create(deepPartialify(j))}return new ZodObject({...a._def,shape:()=>_})}else return a instanceof ZodArray?new ZodArray({...a._def,type:deepPartialify(a.element)}):a instanceof ZodOptional?ZodOptional.create(deepPartialify(a.unwrap())):a instanceof ZodNullable?ZodNullable.create(deepPartialify(a.unwrap())):a instanceof ZodTuple?ZodTuple.create(a.items.map(_=>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 _=this._def.shape(),$=util.objectKeys(_);return this._cached={shape:_,keys:$}}_parse(_){if(this._getType(_)!==ZodParsedType.object){const st=this._getOrReturnCtx(_);return addIssueToContext(st,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.object,received:st.parsedType}),INVALID}const{status:j,ctx:et}=this._processInputParams(_),{shape:tt,keys:rt}=this._getCached(),nt=[];if(!(this._def.catchall instanceof ZodNever&&this._def.unknownKeys==="strip"))for(const st in et.data)rt.includes(st)||nt.push(st);const it=[];for(const st of rt){const ot=tt[st],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})}if(this._def.catchall instanceof ZodNever){const st=this._def.unknownKeys;if(st==="passthrough")for(const ot of nt)it.push({key:{status:"valid",value:ot},value:{status:"valid",value:et.data[ot]}});else if(st==="strict")nt.length>0&&(addIssueToContext(et,{code:ZodIssueCode.unrecognized_keys,keys:nt}),j.dirty());else if(st!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const st=this._def.catchall;for(const ot of nt){const 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})}}return et.common.async?Promise.resolve().then(async()=>{const st=[];for(const ot of it){const at=await ot.key,ut=await ot.value;st.push({key:at,value:ut,alwaysSet:ot.alwaysSet})}return st}).then(st=>ParseStatus.mergeObjectSync(j,st)):ParseStatus.mergeObjectSync(j,it)}get shape(){return this._def.shape()}strict(_){return errorUtil.errToObj,new ZodObject({...this._def,unknownKeys:"strict",..._!==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(_).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(_){return new ZodObject({...this._def,shape:()=>({...this._def.shape(),..._})})}merge(_){return new ZodObject({unknownKeys:_._def.unknownKeys,catchall:_._def.catchall,shape:()=>({...this._def.shape(),..._._def.shape()}),typeName:ZodFirstPartyTypeKind.ZodObject})}setKey(_,$){return this.augment({[_]:$})}catchall(_){return new ZodObject({...this._def,catchall:_})}pick(_){const $={};return util.objectKeys(_).forEach(j=>{_[j]&&this.shape[j]&&($[j]=this.shape[j])}),new ZodObject({...this._def,shape:()=>$})}omit(_){const $={};return util.objectKeys(this.shape).forEach(j=>{_[j]||($[j]=this.shape[j])}),new ZodObject({...this._def,shape:()=>$})}deepPartial(){return deepPartialify(this)}partial(_){const $={};return util.objectKeys(this.shape).forEach(j=>{const et=this.shape[j];_&&!_[j]?$[j]=et:$[j]=et.optional()}),new ZodObject({...this._def,shape:()=>$})}required(_){const $={};return util.objectKeys(this.shape).forEach(j=>{if(_&&!_[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:()=>a,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(_)});ZodObject.strictCreate=(a,_)=>new ZodObject({shape:()=>a,unknownKeys:"strict",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(_)});ZodObject.lazycreate=(a,_)=>new ZodObject({shape:a,unknownKeys:"strip",catchall:ZodNever.create(),typeName:ZodFirstPartyTypeKind.ZodObject,...processCreateParams(_)});class ZodUnion extends ZodType{_parse(_){const{ctx:$}=this._processInputParams(_),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 st={...$,common:{...$.common,issues:[]},parent:null},ot=it._parseSync({data:$.data,path:$.path,parent:st});if(ot.status==="valid")return ot;ot.status==="dirty"&&!tt&&(tt={result:ot,ctx:st}),st.common.issues.length&&rt.push(st.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:a,typeName:ZodFirstPartyTypeKind.ZodUnion,...processCreateParams(_)});const getDiscriminator=a=>a instanceof ZodLazy?getDiscriminator(a.schema):a instanceof ZodEffects?getDiscriminator(a.innerType()):a instanceof ZodLiteral?[a.value]:a instanceof ZodEnum?a.options:a instanceof ZodNativeEnum?util.objectValues(a.enum):a instanceof ZodDefault?getDiscriminator(a._def.innerType):a instanceof ZodUndefined?[void 0]:a instanceof ZodNull?[null]:a instanceof ZodOptional?[void 0,...getDiscriminator(a.unwrap())]:a instanceof ZodNullable?[null,...getDiscriminator(a.unwrap())]:a instanceof ZodBranded||a instanceof ZodReadonly?getDiscriminator(a.unwrap()):a instanceof ZodCatch?getDiscriminator(a._def.innerType):[];class ZodDiscriminatedUnion extends ZodType{_parse(_){const{ctx:$}=this._processInputParams(_);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(_,$,j){const et=new Map;for(const tt of $){const rt=getDiscriminator(tt.shape[_]);if(!rt.length)throw new Error(`A discriminator value for key \`${_}\` could not be extracted from all schema options`);for(const nt of rt){if(et.has(nt))throw new Error(`Discriminator property ${String(_)} has duplicate value ${String(nt)}`);et.set(nt,tt)}}return new ZodDiscriminatedUnion({typeName:ZodFirstPartyTypeKind.ZodDiscriminatedUnion,discriminator:_,options:$,optionsMap:et,...processCreateParams(j)})}}function mergeValues(a,_){const $=getParsedType(a),j=getParsedType(_);if(a===_)return{valid:!0,data:a};if($===ZodParsedType.object&&j===ZodParsedType.object){const et=util.objectKeys(_),tt=util.objectKeys(a).filter(nt=>et.indexOf(nt)!==-1),rt={...a,..._};for(const nt of tt){const it=mergeValues(a[nt],_[nt]);if(!it.valid)return{valid:!1};rt[nt]=it.data}return{valid:!0,data:rt}}else if($===ZodParsedType.array&&j===ZodParsedType.array){if(a.length!==_.length)return{valid:!1};const et=[];for(let tt=0;tt{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:a,right:_,typeName:ZodFirstPartyTypeKind.ZodIntersection,...processCreateParams($)});class ZodTuple extends ZodType{_parse(_){const{status:$,ctx:j}=this._processInputParams(_);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(_){return new ZodTuple({...this._def,rest:_})}}ZodTuple.create=(a,_)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ZodTuple({items:a,typeName:ZodFirstPartyTypeKind.ZodTuple,rest:null,...processCreateParams(_)})};class ZodRecord extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(_){const{status:$,ctx:j}=this._processInputParams(_);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(_,$,j){return $ instanceof ZodType?new ZodRecord({keyType:_,valueType:$,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams(j)}):new ZodRecord({keyType:ZodString.create(),valueType:_,typeName:ZodFirstPartyTypeKind.ZodRecord,...processCreateParams($)})}}class ZodMap extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(_){const{status:$,ctx:j}=this._processInputParams(_);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],st)=>({key:et._parse(new ParseInputLazyPath(j,nt,j.path,[st,"key"])),value:tt._parse(new ParseInputLazyPath(j,it,j.path,[st,"value"]))}));if(j.common.async){const nt=new Map;return Promise.resolve().then(async()=>{for(const it of rt){const st=await it.key,ot=await it.value;if(st.status==="aborted"||ot.status==="aborted")return INVALID;(st.status==="dirty"||ot.status==="dirty")&&$.dirty(),nt.set(st.value,ot.value)}return{status:$.value,value:nt}})}else{const nt=new Map;for(const it of rt){const st=it.key,ot=it.value;if(st.status==="aborted"||ot.status==="aborted")return INVALID;(st.status==="dirty"||ot.status==="dirty")&&$.dirty(),nt.set(st.value,ot.value)}return{status:$.value,value:nt}}}}ZodMap.create=(a,_,$)=>new ZodMap({valueType:_,keyType:a,typeName:ZodFirstPartyTypeKind.ZodMap,...processCreateParams($)});class ZodSet extends ZodType{_parse(_){const{status:$,ctx:j}=this._processInputParams(_);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 st=new Set;for(const ot of it){if(ot.status==="aborted")return INVALID;ot.status==="dirty"&&$.dirty(),st.add(ot.value)}return{status:$.value,value:st}}const nt=[...j.data.values()].map((it,st)=>tt._parse(new ParseInputLazyPath(j,it,j.path,st)));return j.common.async?Promise.all(nt).then(it=>rt(it)):rt(nt)}min(_,$){return new ZodSet({...this._def,minSize:{value:_,message:errorUtil.toString($)}})}max(_,$){return new ZodSet({...this._def,maxSize:{value:_,message:errorUtil.toString($)}})}size(_,$){return this.min(_,$).max(_,$)}nonempty(_){return this.min(1,_)}}ZodSet.create=(a,_)=>new ZodSet({valueType:a,minSize:null,maxSize:null,typeName:ZodFirstPartyTypeKind.ZodSet,...processCreateParams(_)});class ZodFunction extends ZodType{constructor(){super(...arguments),this.validate=this.implement}_parse(_){const{ctx:$}=this._processInputParams(_);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(st=>!!st),issueData:{code:ZodIssueCode.invalid_arguments,argumentsError:it}})}function et(nt,it){return makeIssue({data:nt,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,getErrorMap(),errorMap].filter(st=>!!st),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 st=new ZodError([]),ot=await nt._def.args.parseAsync(it,tt).catch(ht=>{throw st.addIssue(j(it,ht)),st}),at=await Reflect.apply(rt,this,ot);return await nt._def.returns._def.type.parseAsync(at,tt).catch(ht=>{throw st.addIssue(et(at,ht)),st})})}else{const nt=this;return OK(function(...it){const st=nt._def.args.safeParse(it,tt);if(!st.success)throw new ZodError([j(it,st.error)]);const ot=Reflect.apply(rt,this,st.data),at=nt._def.returns.safeParse(ot,tt);if(!at.success)throw new ZodError([et(ot,at.error)]);return at.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(..._){return new ZodFunction({...this._def,args:ZodTuple.create(_).rest(ZodUnknown.create())})}returns(_){return new ZodFunction({...this._def,returns:_})}implement(_){return this.parse(_)}strictImplement(_){return this.parse(_)}static create(_,$,j){return new ZodFunction({args:_||ZodTuple.create([]).rest(ZodUnknown.create()),returns:$||ZodUnknown.create(),typeName:ZodFirstPartyTypeKind.ZodFunction,...processCreateParams(j)})}}class ZodLazy extends ZodType{get schema(){return this._def.getter()}_parse(_){const{ctx:$}=this._processInputParams(_);return this._def.getter()._parse({data:$.data,path:$.path,parent:$})}}ZodLazy.create=(a,_)=>new ZodLazy({getter:a,typeName:ZodFirstPartyTypeKind.ZodLazy,...processCreateParams(_)});class ZodLiteral extends ZodType{_parse(_){if(_.data!==this._def.value){const $=this._getOrReturnCtx(_);return addIssueToContext($,{received:$.data,code:ZodIssueCode.invalid_literal,expected:this._def.value}),INVALID}return{status:"valid",value:_.data}}get value(){return this._def.value}}ZodLiteral.create=(a,_)=>new ZodLiteral({value:a,typeName:ZodFirstPartyTypeKind.ZodLiteral,...processCreateParams(_)});function createZodEnum(a,_){return new ZodEnum({values:a,typeName:ZodFirstPartyTypeKind.ZodEnum,...processCreateParams(_)})}class ZodEnum extends ZodType{constructor(){super(...arguments),_ZodEnum_cache.set(this,void 0)}_parse(_){if(typeof _.data!="string"){const $=this._getOrReturnCtx(_),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(_.data)){const $=this._getOrReturnCtx(_),j=this._def.values;return addIssueToContext($,{received:$.data,code:ZodIssueCode.invalid_enum_value,options:j}),INVALID}return OK(_.data)}get options(){return this._def.values}get enum(){const _={};for(const $ of this._def.values)_[$]=$;return _}get Values(){const _={};for(const $ of this._def.values)_[$]=$;return _}get Enum(){const _={};for(const $ of this._def.values)_[$]=$;return _}extract(_,$=this._def){return ZodEnum.create(_,{...this._def,...$})}exclude(_,$=this._def){return ZodEnum.create(this.options.filter(j=>!_.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(_){const $=util.getValidEnumValues(this._def.values),j=this._getOrReturnCtx(_);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(_.data)){const et=util.objectValues($);return addIssueToContext(j,{received:j.data,code:ZodIssueCode.invalid_enum_value,options:et}),INVALID}return OK(_.data)}get enum(){return this._def.values}}_ZodNativeEnum_cache=new WeakMap;ZodNativeEnum.create=(a,_)=>new ZodNativeEnum({values:a,typeName:ZodFirstPartyTypeKind.ZodNativeEnum,...processCreateParams(_)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(_){const{ctx:$}=this._processInputParams(_);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:a,typeName:ZodFirstPartyTypeKind.ZodPromise,...processCreateParams(_)});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(_){const{status:$,ctx:j}=this._processInputParams(_),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:a,typeName:ZodFirstPartyTypeKind.ZodEffects,effect:_,...processCreateParams($)});ZodEffects.createWithPreprocess=(a,_,$)=>new ZodEffects({schema:_,effect:{type:"preprocess",transform:a},typeName:ZodFirstPartyTypeKind.ZodEffects,...processCreateParams($)});class ZodOptional extends ZodType{_parse(_){return this._getType(_)===ZodParsedType.undefined?OK(void 0):this._def.innerType._parse(_)}unwrap(){return this._def.innerType}}ZodOptional.create=(a,_)=>new ZodOptional({innerType:a,typeName:ZodFirstPartyTypeKind.ZodOptional,...processCreateParams(_)});class ZodNullable extends ZodType{_parse(_){return this._getType(_)===ZodParsedType.null?OK(null):this._def.innerType._parse(_)}unwrap(){return this._def.innerType}}ZodNullable.create=(a,_)=>new ZodNullable({innerType:a,typeName:ZodFirstPartyTypeKind.ZodNullable,...processCreateParams(_)});class ZodDefault extends ZodType{_parse(_){const{ctx:$}=this._processInputParams(_);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:a,typeName:ZodFirstPartyTypeKind.ZodDefault,defaultValue:typeof _.default=="function"?_.default:()=>_.default,...processCreateParams(_)});class ZodCatch extends ZodType{_parse(_){const{ctx:$}=this._processInputParams(_),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:a,typeName:ZodFirstPartyTypeKind.ZodCatch,catchValue:typeof _.catch=="function"?_.catch:()=>_.catch,...processCreateParams(_)});class ZodNaN extends ZodType{_parse(_){if(this._getType(_)!==ZodParsedType.nan){const j=this._getOrReturnCtx(_);return addIssueToContext(j,{code:ZodIssueCode.invalid_type,expected:ZodParsedType.nan,received:j.parsedType}),INVALID}return{status:"valid",value:_.data}}}ZodNaN.create=a=>new ZodNaN({typeName:ZodFirstPartyTypeKind.ZodNaN,...processCreateParams(a)});const BRAND=Symbol("zod_brand");class ZodBranded extends ZodType{_parse(_){const{ctx:$}=this._processInputParams(_),j=$.data;return this._def.type._parse({data:j,path:$.path,parent:$})}unwrap(){return this._def.type}}class ZodPipeline extends ZodType{_parse(_){const{status:$,ctx:j}=this._processInputParams(_);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(_,$){return new ZodPipeline({in:_,out:$,typeName:ZodFirstPartyTypeKind.ZodPipeline})}}class ZodReadonly extends ZodType{_parse(_){const $=this._def.innerType._parse(_),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:a,typeName:ZodFirstPartyTypeKind.ZodReadonly,...processCreateParams(_)});function custom(a,_={},$){return a?ZodAny.create().superRefine((j,et)=>{var tt,rt;if(!a(j)){const nt=typeof _=="function"?_(j):typeof _=="string"?{message:_}:_,it=(rt=(tt=nt.fatal)!==null&&tt!==void 0?tt:$)!==null&&rt!==void 0?rt:!0,st=typeof nt=="string"?{message:nt}:nt;et.addIssue({code:"custom",...st,fatal:it})}}):ZodAny.create()}const late={object:ZodObject.lazycreate};var ZodFirstPartyTypeKind;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(ZodFirstPartyTypeKind||(ZodFirstPartyTypeKind={}));const instanceOfType=(a,_={message:`Input not instance of ${a.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:a=>ZodString.create({...a,coerce:!0}),number:a=>ZodNumber.create({...a,coerce:!0}),boolean:a=>ZodBoolean.create({...a,coerce:!0}),bigint:a=>ZodBigInt.create({...a,coerce:!0}),date:a=>ZodDate.create({...a,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=a=>{if(isValidContractPkh(a))return parseContractPkh(a);if(isValidImplicitPkh(a))return parseImplicitPkh(a);throw new Error(`Cannot parse address type: ${a}`)},isAddressValid=a=>validateAddress(a)===ValidationResult.VALID,isValidContractPkh=a=>isAddressValid(a)&&a.match(/^KT1\w+/),isValidImplicitPkh=a=>isAddressValid(a)&&a.match(/^tz[1234]\w+/),parseContractPkh=a=>{if(isValidContractPkh(a))return{type:"contract",pkh:a};throw new Error(`Invalid contract address: ${a}`)},parseImplicitPkh=a=>{if(isValidImplicitPkh(a))return{type:"implicit",pkh:a};throw new Error(`Invalid implicit address: ${a}`)},encodeReserved=[encodeURIComponent,encodeURIComponent];function encode$2(a,_=","){const $=(j,et)=>{const tt=a[et%a.length];return typeof j>"u"?"":typeof j=="object"?Array.isArray(j)?j.map(tt).join(_):Object.entries(j).reduce((nt,it)=>[...nt,...it],[]).map(tt).join(_):tt(String(j))};return(j,...et)=>j.reduce((tt,rt,nt)=>`${tt}${rt}${$(et[nt],nt)}`,"")}function delimited(a=","){return(_,$=encodeReserved)=>Object.entries(_).filter(([,j])=>j!==void 0).map(([j,et])=>encode$2($,a)`${j}=${et}`).join("&")}function stripUndefined(a){return a&&JSON.parse(JSON.stringify(a))}function joinUrl(...a){return a.filter(Boolean).map((_,$)=>$===0?_:_.replace(/^\/+/,"")).map((_,$,j)=>$===j.length-1?_:_.replace(/\/+$/,"")).join("/")}function query(...a){const _=a.filter(Boolean).join("&");return _&&`?${_}`}function explode(a,_=encodeReserved){const $=encode$2(_);return Object.entries(a).filter(([,j])=>j!==void 0).map(([j,et])=>Array.isArray(et)?et.map(tt=>$`${j}=${tt}`).join("&"):typeof et=="object"?explode(et,_):$`${j}=${et}`).join("&")}const form=delimited(),SUCCESS_CODES=[200,201,202,204];async function ok(a){const _=await a;if(SUCCESS_CODES.some($=>$==_.status))return _.data;throw new HttpError(_.status,_.data)}class HttpError extends Error{constructor($,j){super(`Error: ${$}`);Yr(this,"status");Yr(this,"data");this.status=$,this.data=j}}function runtime$1(a){async function _(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:st,data:ot}=await _(tt,{...rt,headers:{Accept:"application/json",...rt.headers}});return(st?st.includes("json"):!1)?{status:nt,headers:it,data:ot?JSON.parse(ot):null}:{status:nt,headers:it,data:ot}}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:st,...ot}={...a,...rt},at=joinUrl(nt,tt);return await(st||fetch)(at,{...ot,headers:stripUndefined({...a.headers,...it})})}return{ok,fetchText:_,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(a.formDataConstructor||rt.formDataConstructor||FormData);return Object.entries(tt).forEach(([it,st])=>{nt.append(it,st)}),{...rt,body:nt}}}}const jsonParameter=(a,_)=>{if(!_)return{};const $={};return Object.entries(_).forEach(([j,et])=>{if(!(et instanceof Object))throw new Error(`Expected ${a} value to be object, received ${typeof et}`);const{jsonPath:tt,jsonValue:rt}=et;if(rt==null)throw new Error(`Expected jsonValue in ${a} -> ${j}, found: ${rt}`);const it=[a,tt,j].filter(st=>st!==void 0).join(".");$[it]=rt}),$},anyofParameter=(a,_)=>{if(!_)return{};const{fields:$}=_;(rt=>{if(!Array.isArray(rt))throw new Error(`Expected ${a} fields to be Array. Received ${typeof rt}.`);return rt.forEach(nt=>{if(typeof nt!="string")throw new Error(`Expected ${a} fields to be strings. Received ${typeof nt}`)}),!0})($);const et={},tt=$.join(".");if(_.value){const rt=`${a}.${tt}`;et[rt]=_.value}for(const rt of["in","eq","null"])if(_[rt]){const nt=`${a}.${tt}.${rt}`;return et[nt]=Array.isArray(_[rt])?_[rt].join(","):_[rt],et}return et},queryParameter=(a,_)=>{if(!_)return{};const $={};return Object.entries(_).forEach(([j,et])=>{const tt=`${a}.${j}`;$[tt]=et}),$},parsers={jsonParameter,queryParameter,anyofParameter},defaults={baseUrl:"https://api.tzkt.io"},oazapfts=runtime$1(defaults);function accountsGet({id:a,address:_,$type:$,kind:j,delegate:et,balance:tt,staked:rt,lastActivity:nt,select:it,sort:st,offset:ot,limit:at}={},ut){return oazapfts.ok(oazapfts.fetchJson(`/v1/accounts${query(explode({limit:at,...parsers.queryParameter("id",a),...parsers.queryParameter("address",_),...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",st),...parsers.queryParameter("offset",ot)}))}`,{...ut}))}function blocksGetCount(a){return oazapfts.ok(oazapfts.fetchJson("/v1/blocks/count",{...a}))}function contractsGet({address:a,kind:_,tzips:$,creator:j,manager:et,delegate:tt,balance:rt,lastActivity:nt,typeHash:it,codeHash:st,select:ot,sort:at,offset:ut,limit:ht,includeStorage:yt}={},wt){return oazapfts.ok(oazapfts.fetchJson(`/v1/contracts${query(explode({limit:ht,includeStorage:yt,...parsers.queryParameter("address",a),...parsers.queryParameter("kind",_),...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",st),...parsers.queryParameter("select",ot),...parsers.queryParameter("sort",at),...parsers.queryParameter("offset",ut)}))}`,{...wt}))}function delegatesGet({active:a,lastActivity:_,select:$,sort:j,offset:et,limit:tt}={},rt){return oazapfts.ok(oazapfts.fetchJson(`/v1/delegates${query(explode({limit:tt,...parsers.queryParameter("active",a),...parsers.queryParameter("lastActivity",_),...parsers.queryParameter("select",$),...parsers.queryParameter("sort",j),...parsers.queryParameter("offset",et)}))}`,{...rt}))}function operationsGetDelegations({anyof:a,initiator:_,sender:$,prevDelegate:j,newDelegate:et,level:tt,timestamp:rt,senderCodeHash:nt,status:it,select:st,sort:ot,offset:at,limit:ut,quote:ht}={},yt){return oazapfts.ok(oazapfts.fetchJson(`/v1/operations/delegations${query(explode({limit:ut,quote:ht,...parsers.anyofParameter("anyof",a),...parsers.queryParameter("initiator",_),...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",st),...parsers.queryParameter("sort",ot),...parsers.queryParameter("offset",at)}))}`,{...yt}))}function operationsGetOriginations({anyof:a,initiator:_,sender:$,contractManager:j,contractDelegate:et,originatedContract:tt,id:rt,typeHash:nt,codeHash:it,level:st,timestamp:ot,senderCodeHash:at,anyCodeHash:ut,status:ht,select:yt,sort:wt,offset:Ct,limit:Pt,micheline:$t,quote:Mt}={},Lt){return oazapfts.ok(oazapfts.fetchJson(`/v1/operations/originations${query(explode({limit:Pt,micheline:$t,quote:Mt,...parsers.anyofParameter("anyof",a),...parsers.queryParameter("initiator",_),...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",st),...parsers.queryParameter("timestamp",ot),...parsers.queryParameter("senderCodeHash",at),...parsers.queryParameter("anyCodeHash",ut),...parsers.queryParameter("status",ht),...parsers.queryParameter("select",yt),...parsers.queryParameter("sort",wt),...parsers.queryParameter("offset",Ct)}))}`,{...Lt}))}function operationsGetTransactions({anyof:a,initiator:_,sender:$,target:j,amount:et,id:tt,level:rt,timestamp:nt,senderCodeHash:it,targetCodeHash:st,codeHash:ot,entrypoint:at,parameter:ut,hasInternals:ht,status:yt,select:wt,sort:Ct,offset:Pt,limit:$t,micheline:Mt,quote:Lt}={},Dt){return oazapfts.ok(oazapfts.fetchJson(`/v1/operations/transactions${query(explode({limit:$t,micheline:Mt,quote:Lt,...parsers.anyofParameter("anyof",a),...parsers.queryParameter("initiator",_),...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",st),...parsers.queryParameter("codeHash",ot),...parsers.queryParameter("entrypoint",at),...parsers.jsonParameter("parameter",ut),...parsers.queryParameter("hasInternals",ht),...parsers.queryParameter("status",yt),...parsers.queryParameter("select",wt),...parsers.queryParameter("sort",Ct),...parsers.queryParameter("offset",Pt)}))}`,{...Dt}))}function quotesGetLast(a){return oazapfts.ok(oazapfts.fetchJson("/v1/quotes/last",{...a}))}function tokensGetTokenBalances({id:a,account:_,tokenId:$,tokenContract:j,tokenTokenId:et,tokenStandard:tt,tokenMetadata:rt,tokenHasFilters:nt,balance:it,firstLevel:st,firstTime:ot,lastLevel:at,lastTime:ut,indexedAt:ht,sort:yt,offset:wt,limit:Ct,select:Pt}={},$t){return oazapfts.ok(oazapfts.fetchJson(`/v1/tokens/balances${query(explode({"token.HasFilters":nt,limit:Ct,...parsers.queryParameter("id",a),...parsers.queryParameter("account",_),...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",st),...parsers.queryParameter("firstTime",ot),...parsers.queryParameter("lastLevel",at),...parsers.queryParameter("lastTime",ut),...parsers.queryParameter("indexedAt",ht),...parsers.queryParameter("sort",yt),...parsers.queryParameter("offset",wt),...parsers.queryParameter("select",Pt)}))}`,{...$t}))}function tokensGetTokenTransfers({id:a,level:_,timestamp:$,tokenId:j,tokenContract:et,tokenTokenId:tt,tokenStandard:rt,tokenMetadata:nt,tokenHasFilters:it,anyof:st,$from:ot,to:at,amount:ut,transactionId:ht,originationId:yt,migrationId:wt,indexedAt:Ct,sort:Pt,offset:$t,limit:Mt,select:Lt}={},Dt){return oazapfts.ok(oazapfts.fetchJson(`/v1/tokens/transfers${query(explode({"token.HasFilters":it,limit:Mt,...parsers.queryParameter("id",a),...parsers.queryParameter("level",_),...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",st),...parsers.queryParameter("from",ot),...parsers.queryParameter("to",at),...parsers.queryParameter("amount",ut),...parsers.queryParameter("transactionId",ht),...parsers.queryParameter("originationId",yt),...parsers.queryParameter("migrationId",wt),...parsers.queryParameter("indexedAt",Ct),...parsers.queryParameter("sort",Pt),...parsers.queryParameter("offset",$t),...parsers.queryParameter("select",Lt)}))}`,{...Dt}))}let e$1=class{constructor(_){this.queue=void 0,this.maxConcurrent=void 0,this.count=void 0,this.queue=[],this.maxConcurrent=_,this.count=0}get canAcquire(){return this.countthis.queue.push(_))}release(){const _=this.queue.shift();_?setTimeout(_,0):this.count--}};const t$4="_default";class s{constructor(_=1){this.semaphoreInstances=void 0,this.maxConcurrent=void 0,this.semaphoreInstances={},this.maxConcurrent=_}hasSemaphoreInstance(_=t$4){return!!this.semaphoreInstances[_]}getSemaphoreInstance(_=t$4){return this.hasSemaphoreInstance(_)||(this.semaphoreInstances[_]=new e$1(this.maxConcurrent)),this.semaphoreInstances[_]}tidy(_=t$4){this.hasSemaphoreInstance(_)&&this.getSemaphoreInstance(_).count===0&&delete this.semaphoreInstances[_]}canAcquire(_=t$4){return this.getSemaphoreInstance(_).canAcquire}acquire(_=t$4){return this.getSemaphoreInstance(_).acquire()}release(_=t$4){this.getSemaphoreInstance(_).release(),this.tidy(_)}count(_=t$4){return this.hasSemaphoreInstance(_)?this.getSemaphoreInstance(_).count:0}hasTasks(_=t$4){return this.count(_)>0}async request(_,$=t$4){try{return await this.acquire($),await _()}finally{this.release($)}}async requestIfAvailable(_,$=t$4){return this.canAcquire($)?this.request(_,$):null}}function assign$1(a,_){for(const $ in _)Object.defineProperty(a,$,{value:_[$],enumerable:!0,configurable:!0});return a}function createError(a,_,$){if(!a||typeof a=="string")throw new TypeError("Please pass an Error to err-code");$||($={}),typeof _=="object"&&($=_,_=void 0),_!=null&&($.code=_);try{return assign$1(a,$)}catch{$.message=a.message,$.stack=a.stack;const et=function(){};return et.prototype=Object.create(Object.getPrototypeOf(a)),assign$1(new et,$)}}var errCode=createError,retry$3={};function RetryOperation(a,_){typeof _=="boolean"&&(_={forever:_}),this._originalTimeouts=JSON.parse(JSON.stringify(a)),this._timeouts=a,this._options=_||{},this._maxRetryTime=_&&_.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(a){if(this._timeout&&clearTimeout(this._timeout),!a)return!1;var _=new Date().getTime();if(a&&_-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(a);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,_&&(_.timeout&&(this._operationTimeout=_.timeout),_.cb&&(this._operationTimeoutCb=_.cb));var $=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){$._operationTimeoutCb()},$._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};RetryOperation.prototype.try=function(a){console.log("Using RetryOperation.try() is deprecated"),this.attempt(a)};RetryOperation.prototype.start=function(a){console.log("Using RetryOperation.start() is deprecated"),this.attempt(a)};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=$&&(_=et,$=rt)}return _};(function(a){var _=retry_operation;a.operation=function($){var j=a.timeouts($);return new _(j,{forever:$&&$.forever,unref:$&&$.unref,maxRetryTime:$&&$.maxRetryTime})},a.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(_),{retries:3,minTimeout:100})).catch(_=>{throw"status"in _&&"data"in _?new Error(`Fetching data from tzkt failed with: ${_.status}, ${_.data}`):_}).finally(()=>tzktRateLimiter.release()),MULTISIG_FETCH_LIMIT=1e4,TYPE_HASH=1963879877,CODE_HASH=-1890025422,getAllMultiSigContracts=async a=>withRateLimit(async()=>{try{const _=`${a.tzktApiUrl}/v1/contracts?typeHash=${TYPE_HASH}&codeHash=${CODE_HASH}&includeStorage=true&limit=${MULTISIG_FETCH_LIMIT}`,{data:$}=await axios.get(_);return $}catch(_){throw new Error(`Error fetching same contracts from tzkt: ${_.message}`)}}),getExistingContracts=(a,_)=>withRateLimit(()=>contractsGet({address:{in:[a.join(",")]},select:{fields:["address"]},limit:Math.min(1e4,a.length)},{baseUrl:_.tzktApiUrl})),getPendingOperations=async(a,_)=>withRateLimit(async()=>{if(a.length===0)return Promise.resolve([]);const $=`${_.tzktApiUrl}/v1/bigmaps/keys?active=true&bigmap.in=${a.join(",")}&limit=${MULTISIG_FETCH_LIMIT}`,{data:j}=await axios.get($);return j}),parseMultisig=a=>({address:parseContractPkh(a.address),threshold:Number(a.storage.threshold),signers:a.storage.signers.map(parseImplicitPkh),pendingOperationsBigmapId:a.storage.pending_ops}),getRelevantMultisigContracts=async(a,_)=>(await getAllMultiSigContracts(_)).filter(({storage:{signers:j}})=>lodashExports.every(j,isValidImplicitPkh)?j.filter(tt=>a.has(tt)).length>0:!1).map(parseMultisig),getNetworksForContracts=async(a,_)=>{const $=new Map;return _.length===0||(await Promise.all(a.map(async et=>(await getExistingContracts(_,et)).map(tt=>[tt,et.name])))).flat().forEach(([et,tt])=>$.set(et,tt)),$},parseMultisigOperation=a=>{const{bigmap:_,key:$,value:j}=a;if($===null||j===null)throw new Error("parseMultisigOperation failed");return{id:$,bigmapId:_,rawActions:j.actions,approvals:j.approvals.map(parseImplicitPkh)}},getPendingOperationsForMultisigs=async(a,_)=>{if(a.length===0)return[];const $=a.map(et=>et.pendingOperationsBigmapId),j=await getPendingOperations($,_);return lodashExports.compact(j.map(parseMultisigOperation))},VERSION$1=6,mainStoreMigrations={0:a=>produce(a,_=>{_.multisigs.labelsMap={}}),1:a=>produce(a,_=>{_.announcement=initialState$9}),2:lodashExports.identity,3:a=>produce(a,_=>{_.networks.current.name==="ghostnet"&&(_.networks.current.buyTezUrl="https://faucet.ghostnet.teztnets.com/");for(const $ of _.networks.available)if($.name==="ghostnet"){$.buyTezUrl="https://faucet.ghostnet.teztnets.com/";break}}),4:lodashExports.identity,5:a=>produce(a,_=>{delete _.assets.transfers.tez}),6:async a=>{const _=Object.values(a.contacts).filter(tt=>isValidImplicitPkh(tt.pkh)).map(tt=>[tt.pkh,{...tt,network:void 0}]),$=Object.values(a.contacts).filter(tt=>isValidContractPkh(tt.pkh)).map(tt=>tt.pkh),et=[...(await getNetworksForContracts(a.networks.available,$)).entries()].map(([tt,rt])=>[tt,{...a.contacts[tt],network:rt}]);return produce(a,tt=>{tt.contacts=lodashExports.fromPairs([..._,...et])})}},accountsMigrations={0:lodashExports.identity,1:lodashExports.identity,2:a=>produce(a,_=>{_.items.forEach($=>{$.type==="secret_key"&&($.curve="ed25519")})}),3:lodashExports.identity,4:a=>produce(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,a,"utf-8"),_,NUM_ITERATIONS_V1),derivePasswordBasedKeyV2=async(a,_)=>derivePasswordBasedKey(Buffer$g.from(a,"utf-8"),_,NUM_ITERATIONS_V2),derivePasswordBasedKey=async(a,_,$)=>{const j={name:"PBKDF2",salt:_,iterations:$,hash:"SHA-256"},et=await crypto.subtle.importKey("raw",a,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(_,$),et=crypto.getRandomValues(new Uint8Array(IV_SIZE)),tt=await crypto.subtle.encrypt({name:AES_MODE,iv:et},j,Buffer$g.from(a,"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}=a;try{const rt=$==="V2"?await derivePasswordBasedKeyV2(_,hex2Bytes(et)):await derivePasswordBasedKeyV1(_,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:a,newPassword:_},{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,a),st=await encrypt$1(it,_);return[rt,st]}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:a=>{a.addCase(changeMnemonicPassword.fulfilled,(_,$)=>{const{newEncryptedMnemonics:j}=$.payload;_.seedPhrases=j})},reducers:{reset:()=>initialState$8,removeMnemonicAndAccounts:(a,{payload:_})=>{const{fingerPrint:$}=_,j=a.items.filter(et=>!(et.type==="mnemonic"&&et.seedFingerPrint===$));a.items=j,delete a.seedPhrases[$]},removeNonMnemonicAccounts:(a,{payload:_})=>{a.items=lodashExports.remove(a.items,$=>$.type==="mnemonic"||$.type!==_.accountType),_.accountType==="secret_key"&&(a.secretKeys={})},removeAccount:(a,{payload:_})=>{lodashExports.remove(a.items,$=>$.address.pkh===_.address.pkh),_.type==="secret_key"&&delete a.secretKeys[_.address.pkh]},renameAccount:(a,{payload:_})=>{const{account:$,newName:j}=_;if(j.length===0)throw new Error("Cannot rename account to an empty name.");if(a.items.find(tt=>tt.label===j))throw new Error(`Cannot rename account ${$.address.pkh} to ${j} since the name already exists.`);const et=a.items.find(tt=>tt.address.pkh===$.address.pkh&&tt.label===$.label);et&&(et.label=j)},addAccount:(a,{payload:_})=>{a.items=concatUnique(a.items,[_])},addMnemonicAccounts:(a,{payload:{encryptedMnemonic:_,accounts:$,seedFingerprint:j}})=>{a.items=concatUnique(a.items,$),a.seedPhrases[j]=_},addSecretKey:(a,{payload:{pkh:_,encryptedSecretKey:$}})=>{a.secretKeys[_]=$}}}),concatUnique=(a,_)=>(_.forEach($=>{if(a.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=a=>{const _=a.metadata;if(a.standard==="fa1.2"){const et=FA12TokenSchema.safeParse(a);return et.success?{type:"fa1.2",metadata:_,contract:et.data.contract.address,tokenId:"0"}:(console.warn("Invalid FA1 token: "+JSON.stringify(a)),null)}const $=NFTSchema.safeParse(a);if($.success)return{metadata:_,type:"nft",id:$.data.id,contract:$.data.contract.address,tokenId:$.data.tokenId,displayUri:$.data.metadata.displayUri,totalSupply:$.data.totalSupply};const j=FA2TokenSchema.safeParse(a);return j.success?{type:"fa2",metadata:_,contract:j.data.contract.address,tokenId:j.data.tokenId}:(console.warn("Invalid FA2 token: "+JSON.stringify(a)),null)},fullId=a=>`${a.contract}:${a.tokenId}`,defaultTokenName=a=>{switch(a.type){case"fa1.2":return DEFAULT_FA1_NAME;case"fa2":return DEFAULT_FA2_NAME;case"nft":return DEFAULT_NFT_NAME}},tokenNameSafe=a=>tokenName(a)||defaultTokenName(a),tokenName=a=>{var _;return(_=a.metadata)==null?void 0:_.name},defaultTokenSymbol=a=>{switch(a.type){case"fa1.2":return DEFAULT_FA1_SYMBOL;case"fa2":return DEFAULT_FA2_SYMBOL;case"nft":return DEFAULT_NFT_SYMBOL}},tokenSymbolSafe=a=>tokenSymbol(a)||defaultTokenSymbol(a),tokenSymbol=a=>{var _;return(_=a.metadata)==null?void 0:_.symbol},tokenDecimals=a=>{var _;return((_=a.metadata)==null?void 0:_.decimals)??DEFAULT_TOKEN_DECIMALS},getRealAmount=(a,_)=>{const $=new BigNumber(_),j=tokenDecimals(a);return $.multipliedBy(new BigNumber(10).exponentiatedBy(j)).toFixed()},formatTokenAmount=(a,_=DEFAULT_TOKEN_DECIMALS)=>{const $=BigNumber(a).dividedBy(BigNumber(10).pow(_));try{return new Intl.NumberFormat("en-US",{minimumFractionDigits:Number(_),maximumFractionDigits:Number(_)}).format($.toNumber())}catch{return console.warn(`Can't format token amount with decimals = ${_}`),formatTokenAmount(a,"0")}},tokenPrettyAmount=(a,_,$)=>{var nt;if(_.type==="nft")return a;const j=tokenSymbolSafe(_),et=(nt=_.metadata)==null?void 0:nt.decimals,tt=$!=null&&$.showSymbol?` ${j}`:"";return`${formatTokenAmount(a,et)}${tt}`},artifactUri=a=>a.metadata.artifactUri||a.displayUri,thumbnailUri=a=>a.metadata.thumbnailUri||a.displayUri,mimeType=a=>{var _,$;return($=(_=a.metadata.formats)==null?void 0:_.find(j=>j.uri===artifactUri(a)))==null?void 0:$.mimeType},royalties=a=>{const _=a.metadata.royalties;if(!_)return[];const $=Math.pow(10,Number(_.decimals)),j=Object.entries(_.shares).map(([et,tt])=>({address:et,share:Number(tt)*100/$}));return j.sort((et,tt)=>et.share`${tokenUri(a,_)}/metadata`,tokenUri=({contract:a,tokenId:_},$)=>`${$.tzktExplorerUrl}/${a}/tokens/${_}`,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=a=>{const _=fromRaw$1(a.token);return!_||!a.balance?null:{balance:a.balance,lastLevel:a.lastLevel,..._}},keepNFTs=a=>a.filter(_=>_.type==="nft"),keepFA1s=a=>a.filter(_=>_.type==="fa1.2"),keepFA2s=a=>a.filter(_=>_.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:a=>a.addCase(accountsSlice.actions.reset,()=>initialState$7),reducers:{reset:()=>initialState$7,updateBlockLevel:(a,{payload:_})=>{a.blockLevel=_},updateTokenTransfers:(a,{payload:_})=>{_.forEach($=>{a.transfers.tokens[$.transactionId]=$})},updateTezBalance:(a,{payload:_})=>{a.balances.mutez=_.reduce(($,j)=>({...$,[j.address]:String(j.balance)}),{}),a.delegationLevels=_.reduce(($,j)=>({...$,[j.address]:j.delegationLevel}),{})},updateTokenBalance:(a,{payload:_})=>{const $=lodashExports.groupBy(_,j=>j.account.address);a.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:(a,{payload:_})=>{_.forEach($=>{delete a.balances.mutez[$],delete a.balances.tokens[$],delete a.delegationLevels[$]})},updateBakers:(a,{payload:_})=>{a.bakers=_},updateConversionRate:(a,{payload:_})=>{a.conversionRate=_},refetch:a=>{a.refetchTrigger+=1},setIsLoading:(a,{payload:_})=>{a.isLoading=_},setLastTimeUpdated:(a,{payload:_})=>{a.lastTimeUpdated=_}}}),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=a=>DefaultNetworks.map(_=>_.name).includes(a.name),DefaultNetworks=[MAINNET,GHOSTNET],initialState$6=lodashExports.fromPairs(DefaultNetworks.map(a=>[a.name,[]])),batchesSlice=createSlice({name:"batches",initialState:initialState$6,reducers:{reset:()=>initialState$6,add:(a,{payload:{operations:_,network:$}})=>{$.name in a||(a[$.name]=[]);const j=a[$.name],et=j.find(tt=>tt.sender.address.pkh===_.sender.address.pkh);if(et){et.operations.push(..._.operations);return}j.push(_)},clear:(a,{payload:{pkh:_,network:$}})=>{const j=a[$.name]||[],et=lodashExports.findIndex(j,tt=>tt.sender.address.pkh===_);et!==-1&&j.splice(et,1)},removeItem:(a,{payload:{pkh:_,index:$,network:j}})=>{const et=a[j.name]||[],tt=lodashExports.findIndex(et,nt=>nt.sender.address.pkh===_);if(tt===-1)return;const rt=et[tt];$lodashExports.fromPairs(Object.entries(a).map(([$,j])=>{const et=(j||[]).filter(tt=>!_.includes(tt.sender.address.pkh));return[$,et]}))}}),batchesActions=batchesSlice.actions,initialState$5={},beaconSlice=createSlice({name:"beacon",initialState:initialState$5,reducers:{reset:()=>initialState$5,addConnection:(a,{payload:_})=>{a[_.dAppId]={accountPkh:_.accountPkh,networkType:_.networkType}},removeConnection:(a,{payload:_})=>{delete a[_]},removeConnections:(a,{payload:_})=>lodashExports.fromPairs(Object.entries(a).filter(([$,j])=>!_.includes(j.accountPkh)))}});beaconSlice.actions;const initialState$4={},contactsSlice=createSlice({name:"contacts",initialState:initialState$4,reducers:{reset:()=>initialState$4,upsert:(a,{payload:_})=>{a[_.pkh]=_},remove:(a,{payload:_})=>{delete a[_]}}}),contactsActions=contactsSlice.actions,MAX_ERRORS_LEN=100,initialState$3=[],errorsSlice=createSlice({name:"errors",initialState:initialState$3,reducers:{reset:()=>initialState$3,add(a,{payload:_}){a.length===MAX_ERRORS_LEN&&a.shift(),a.push(_)}}}),initialState$2={items:[],pendingOperations:{},labelsMap:{}},multisigsSlice=createSlice({name:"multisigs",initialState:initialState$2,reducers:{reset:()=>initialState$2,mockAddAccount:(a,{payload:_})=>{a.items.push({label:`Multisig Account ${a.items.length}`,type:"multisig",..._})},setMultisigs:(a,{payload:_})=>{const $=lodashExports.fromPairs(a.items.map(j=>[j.address.pkh,j.label]));a.items=_.map((j,et)=>({...j,label:$[j.address.pkh]||a.labelsMap[j.address.pkh]||`Multisig Account ${et}`,type:"multisig"}))},addMultisigLabel:(a,{payload:{pkh:_,label:$}})=>{a.labelsMap[_]=$},setPendingOperations:(a,{payload:_})=>{a.pendingOperations=lodashExports.groupBy(_,$=>$.bigmapId)},setName:(a,{payload:_})=>{const{account:{address:{pkh:$}},newName:j}=_,et=a.items.find(tt=>tt.address.pkh===$);et&&(et.label=j)},removeMultisigsData:(a,{payload:_})=>{const $=a.items.filter(j=>_.includes(j.address.pkh)).map(j=>String(j.pendingOperationsBigmapId));a.pendingOperations=lodashExports.omit(a.pendingOperations,$),a.labelsMap=lodashExports.omit(a.labelsMap,_)}}}),multisigActions=multisigsSlice.actions,initialState$1={available:DefaultNetworks,current:MAINNET},networksSlice=createSlice({name:"networks",initialState:initialState$1,reducers:{reset:()=>initialState$1,setCurrent:(a,{payload:_})=>{a.current=_},upsertNetwork:(a,{payload:_})=>{if(isDefault(_))return;const $=a.available.findIndex(j=>j.name===_.name);if(a.current.name===_.name&&(a.current=_),$!==-1){a.available[$]=_;return}a.available.push(_)},removeNetwork:(a,{payload:_})=>{isDefault(_)||lodashExports.remove(a.available,$=>$.name===_.name)}}}),networksActions=networksSlice.actions,initialState=lodashExports.fromPairs(DefaultNetworks.map(a=>[a.name,{}])),tokensSlice=createSlice({name:"tokens",initialState,reducers:{reset:()=>initialState,addTokens:(a,{payload:{network:_,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:a=>a({serializableCheck:{ignoredActions:[FLUSH,REHYDRATE,PAUSE,PERSIST,PURGE,REGISTER]}})}),persistor=persistStore(store),FormErrorMessage=({children:a,..._})=>jsxRuntimeExports.jsxs(FormErrorMessage$1,{color:colors.orange,fontSize:"12px",..._,children:[jsxRuntimeExports.jsx(Icon,{as:ExclamationIcon,marginRight:"6px"}),a]}),CONFIRMATION_CODE="wasabi",reset=()=>WalletClient.destroy().catch(lodashExports.noop).finally(()=>{persistor.pause(),localStorage.clear(),window.location.reload()}),OffboardingForm=()=>{const a=useForm({mode:"onBlur"}),{register:_,handleSubmit:$,formState:{isValid:j,errors:et},getValues:tt}=a,rt=()=>{if(!(!tt("check")||tt("confirmationCode")!==CONFIRMATION_CODE))return reset()};return jsxRuntimeExports.jsx(FormProvider,{...a,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,{..._("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",..._("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:a,onOpen:_,onClose:$}=useDisclosure$1();return{modalElement:jsxRuntimeExports.jsxs(Modal,{isCentered:!0,isOpen:a,onClose:$,children:[jsxRuntimeExports.jsx(ModalOverlay,{}),jsxRuntimeExports.jsx(ModalContent,{background:colors.gray[900],children:jsxRuntimeExports.jsx(OffboardingForm,{})})]}),onOpen:_}},CircleIcon=({icon:a,size:_,onClick:$=()=>{}})=>jsxRuntimeExports.jsx(Box,{width:_,height:_,margin:"auto",background:colors.gray[700],borderRadius:"full",onClick:$,children:jsxRuntimeExports.jsx(Center,{height:"100%",children:a})}),ModalContentWrapper=({children:a,icon:_,title:$,subtitle:j})=>jsxRuntimeExports.jsxs(VStack,{maxHeight:"83vh",spacing:0,children:[jsxRuntimeExports.jsx(Box,{marginBottom:"16px",children:jsxRuntimeExports.jsx(CircleIcon,{icon:_,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})]}),a]}),name="umami",productName="umami",version="2.1.0",author="Trilitech ",description="Tezos Wallet",homepage="https://umamiwallet.com",repository="https://github.com/trilitech/umami-v2",license="MIT",engines={node:">=20 <21.0.0"},type$5="commonjs",main="build/electron.js",scripts={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":"yarn electron:package:mac -c electron-builder.dev.yml","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":"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={"@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":"^15.0.5","@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={"electron-updater":"^6.2.1"},resolutions={jsdom:"^23.0.1","@types/jsdom":"^21.1.6"},packageInfo={name,productName,version,author,description,homepage,repository,license,engines,type:type$5,main,scripts,devDependencies,packageManager,dependencies,resolutions};var withSelector={exports:{}},useSyncExternalStoreWithSelector_production_min={};/** - * @license React - * use-sync-external-store-with-selector.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * 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===_&&(a!==0||1/a===1/_)||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(!st){if(st=!0,ot=ht,ht=j(ht),et!==void 0&&rt.hasValue){var yt=rt.value;if(et(yt,ht))return at=yt}return at=ht}if(yt=at,p(ot,ht))return yt;var wt=j(ht);return et!==void 0&&et(yt,wt)?yt:(ot=ht,at=wt)}var st=!1,ot,at,ut=$===void 0?null:$;return[function(){return it(_())},ut===null?void 0:function(){return it(ut())}]},[_,$,j,et]);var nt=q(a,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 a=gT[ContextKey]??(gT[ContextKey]=new Map);let _=a.get(React$1.createContext);return _||(_=React$1.createContext(null),a.set(React$1.createContext,_)),_}var ReactReduxContext=getContext(),notInitialized=()=>{throw new Error("uSES not initialized!")};function createReduxContextHook(a=ReactReduxContext){return function(){return React$1.useContext(a)}}var useReduxContext=createReduxContextHook(),useSyncExternalStoreWithSelector=notInitialized,initializeUseSelector=a=>{useSyncExternalStoreWithSelector=a},refEquality=(a,_)=>a===_;function createSelectorHook(a=ReactReduxContext){const _=a===ReactReduxContext?useReduxContext:createReduxContextHook(a),$=(j,et={})=>{const{equalityFn:tt=refEquality,devModeChecks:rt={}}=typeof et=="function"?{equalityFn:et}:et,{store:nt,subscription:it,getServerState:st,stabilityCheck:ot,identityFunctionCheck:at}=_();React$1.useRef(!0);const ut=React$1.useCallback({[j.name](yt){return j(yt)}}[j.name],[j,ot,rt.stabilityCheck]),ht=useSyncExternalStoreWithSelector(it.addNestedSub,nt.getState,st||nt.getState,ut,tt);return React$1.useDebugValue(ht),ht};return Object.assign($,{withTypes:()=>$}),$}var useSelector=createSelectorHook();function defaultNoopBatch(a){a()}function createListenerCollection(){let a=null,_=null;return{clear(){a=null,_=null},notify(){defaultNoopBatch(()=>{let $=a;for(;$;)$.callback(),$=$.next})},get(){const $=[];let j=a;for(;j;)$.push(j),j=j.next;return $},subscribe($){let j=!0;const et=_={callback:$,next:null,prev:_};return et.prev?et.prev.next=et:a=et,function(){!j||a===null||(j=!1,et.next?et.next.prev=et.prev:_=et.prev,et.prev?et.prev.next=et.next:a=et.next)}}}}var nullListeners={notify(){},get:()=>[]};function createSubscription(a,_){let $,j=nullListeners,et=0,tt=!1;function rt(wt){ot();const Ct=j.subscribe(wt);let Pt=!1;return()=>{Pt||(Pt=!0,Ct(),at())}}function nt(){j.notify()}function it(){yt.onStateChange&&yt.onStateChange()}function st(){return tt}function ot(){et++,$||($=a.subscribe(it),j=createListenerCollection())}function at(){et--,$&&et===0&&($(),$=void 0,j.clear(),j=nullListeners)}function ut(){tt||(tt=!0,ot())}function ht(){tt&&(tt=!1,at())}const yt={addNestedSub:rt,notifyNestedSubs:nt,handleChangeWrapper:it,isSubscribed:st,trySubscribe:ut,tryUnsubscribe:ht,getListeners:()=>j};return yt}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:a,context:_,children:$,serverState:j,stabilityCheck:et="once",identityFunctionCheck:tt="once"}){const rt=React$1.useMemo(()=>{const st=createSubscription(a);return{store:a,subscription:st,getServerState:j?()=>j:void 0,stabilityCheck:et,identityFunctionCheck:tt}},[a,j,et,tt]),nt=React$1.useMemo(()=>a.getState(),[a]);useIsomorphicLayoutEffect$1(()=>{const{subscription:st}=rt;return st.onStateChange=st.notifyNestedSubs,st.trySubscribe(),nt!==a.getState()&&st.notifyNestedSubs(),()=>{st.tryUnsubscribe(),st.onStateChange=void 0}},[rt,nt]);const it=_||ReactReduxContext;return React$1.createElement(it.Provider,{value:rt},$)}var Provider_default=Provider$1;function createStoreHook(a=ReactReduxContext){const _=a===ReactReduxContext?useReduxContext:createReduxContextHook(a),$=()=>{const{store:j}=_();return j};return Object.assign($,{withTypes:()=>$}),$}var useStore=createStoreHook();function createDispatchHook(a=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(a=>a.networks.current),useAvailableNetworks=()=>useAppSelector(a=>a.networks.available),useFindNetwork=()=>{const a=useAvailableNetworks();return _=>a.find($=>$.name.toLowerCase()===_.toLowerCase())},useSelectNetwork=()=>{const a=useAvailableNetworks(),_=useDispatch();return $=>{const j=a.find(et=>et.name===$);j&&_(networksActions.setCurrent(j))}},useGetToken=()=>{const a=useSelectedNetwork(),_=useAppSelector($=>$.tokens[a.name]);return($,j)=>lodashExports.get(_,[$,j])},useGetTokenType=a=>{const _=useAppSelector($=>$.tokens[a.name]);return $=>{if(!(_&&$ in _))return;const j=_[$],et=Object.keys(j)[0];if(et)return j[et].type}},errorClasses={},deserializers={},addCustomErrorDeserializer=(a,_)=>{deserializers[a]=_},createCustomErrorClass=a=>{class _ extends Error{constructor(j,et,tt){if(super(j||a,tt),Object.setPrototypeOf(this,_.prototype),this.name=a,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]=_,_};function isObject$1(a){return typeof a=="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(a){a.Unknown="Unknown",a.LocationServicesDisabled="LocationServicesDisabled",a.LocationServicesUnauthorized="LocationServicesUnauthorized",a.BluetoothScanStartFailed="BluetoothScanStartFailed"})(HwTransportErrorType||(HwTransportErrorType={}));let TransportError$1=class extends Error{constructor(_,$){const j="TransportError";super(_||j),this.name=j,this.message=_,this.stack=new Error(_).stack,this.id=$}};addCustomErrorDeserializer("TransportError",a=>new TransportError$1(a.message,a.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(a){switch(a){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<=a&&a<=28671)return"Internal error, please report"}class TransportStatusError extends Error{constructor(_,{canBeMappedToChildError:$=!0}={}){const j=Object.keys(StatusCodes).find(nt=>StatusCodes[nt]===_)||"UNKNOWN_ERROR",et=getAltStatusMessage(_)||j,tt=_.toString(16),rt=`Ledger device: ${et} (0x${tt})`;if(super(rt),this.name="TransportStatusError",this.statusCode=_,this.statusText=j,Object.setPrototypeOf(this,TransportStatusError.prototype),$&&_===StatusCodes.LOCKED_DEVICE)return new LockedDeviceError(rt)}}class LockedDeviceError extends TransportStatusError{constructor(_){super(StatusCodes.LOCKED_DEVICE,{canBeMappedToChildError:!1}),_&&(this.message=_),this.name="LockedDeviceError",Object.setPrototypeOf(this,LockedDeviceError.prototype)}}addCustomErrorDeserializer("TransportStatusError",a=>new TransportStatusError(a.statusCode));let id=0;const subscribers=[],log$6=(a,_,$)=>{const j={type:a,id:String(++id),date:new Date};_&&(j.message=_),dispatch(j)},trace=({type:a,message:_,data:$,context:j})=>{const et={type:a,id:String(++id),date:new Date};_&&(et.message=_),$&&(et.data=$),j&&(et.context=j),dispatch(et)};class LocalTracer{constructor(_,$){this.type=_,this.context=$}trace(_,$){trace({type:this.type,message:_,data:$,context:this.context})}getContext(){return this.context}setContext(_){this.context=_}updateContext(_){this.context=Object.assign(Object.assign({},this.context),_)}getType(){return this.type}setType(_){this.type=_}withType(_){return new LocalTracer(_,this.context)}withContext(_){return new LocalTracer(this.type,_)}withUpdatedContext(_){return new LocalTracer(this.type,Object.assign(Object.assign({},this.context),_))}}const listen=a=>(subscribers.push(a),()=>{const _=subscribers.indexOf(a);_!==-1&&(subscribers[_]=subscribers[subscribers.length-1],subscribers.pop())});function dispatch(a){for(let _=0;___awaiter$7(this,void 0,void 0,function*(){const ot=this.tracer.withUpdatedContext({function:"send"});if(nt.length>=256)throw ot.trace("data.length exceeded 256 bytes limit",{dataLength:nt.length}),new TransportError$1("data.length exceed 256 bytes limit. Got: "+nt.length,"DataLengthTooBig");ot.trace("Starting an exchange",{abortTimeoutMs:st});const at=yield this.exchange(Buffer$g.concat([Buffer$g.from([j,et,tt,rt]),Buffer$g.from([nt.length]),nt]),{abortTimeoutMs:st});ot.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,_)}exchange(_,{abortTimeoutMs:$}={}){throw new Error("exchange not implemented")}exchangeBulk(_,$){let j=!1;const et=()=>{j=!0};return __awaiter$7(this,void 0,void 0,function*(){if(!j)for(const rt of _){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(_){}close(){return Promise.resolve()}on(_,$){this._events.on(_,$)}off(_,$){this._events.removeListener(_,$)}emit(_,...$){this._events.emit(_,...$)}setDebugMode(){console.warn("setDebugMode is deprecated. use @ledgerhq/logs instead. No logs are emitted in this anymore.")}setExchangeTimeout(_){this.exchangeTimeout=_}setExchangeUnresponsiveTimeout(_){this.unresponsiveTimeout=_}static create(_=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,_).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(_){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 _();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(_,$,j){for(const et of $)_[et]=this.decorateAppAPIMethod(et,_[et],_,j)}decorateAppAPIMethod(_,$,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=_,this.setScrambleKey(et),yield $.apply(j,tt)}finally{this._appAPIlock=null}})}setTraceContext(_){this.tracer=this.tracer.withContext(_)}updateTraceContext(_){this.tracer.updateContext(_)}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(a){const _=Buffer$g.alloc(2);return _.writeUInt16BE(a,0),_}const initialAcc={data:Buffer$g.alloc(0),dataLength:0,sequence:0},createHIDframing=(a,_)=>({makeBlocks($){let j=Buffer$g.concat([asUInt16BE($.length),$]);const et=_-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$3={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)?(...a)=>console.error("SEMVER",...a):()=>{};var debug_1=debug$1;(function(a,_){const{MAX_SAFE_COMPONENT_LENGTH:$,MAX_SAFE_BUILD_LENGTH:j,MAX_LENGTH:et}=constants$3,tt=debug_1;_=a.exports={};const rt=_.re=[],nt=_.safeRe=[],it=_.src=[],st=_.t={};let ot=0;const at="[a-zA-Z0-9-]",ut=[["\\s",1],["\\d",et],[at,j]],ht=wt=>{for(const[Ct,Pt]of ut)wt=wt.split(`${Ct}*`).join(`${Ct}{0,${Pt}}`).split(`${Ct}+`).join(`${Ct}{1,${Pt}}`);return wt},yt=(wt,Ct,Pt)=>{const $t=ht(Ct),Mt=ot++;tt(wt,Mt,Ct),st[wt]=Mt,it[Mt]=Ct,rt[Mt]=new RegExp(Ct,Pt?"g":void 0),nt[Mt]=new RegExp($t,Pt?"g":void 0)};yt("NUMERICIDENTIFIER","0|[1-9]\\d*"),yt("NUMERICIDENTIFIERLOOSE","\\d+"),yt("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${at}*`),yt("MAINVERSION",`(${it[st.NUMERICIDENTIFIER]})\\.(${it[st.NUMERICIDENTIFIER]})\\.(${it[st.NUMERICIDENTIFIER]})`),yt("MAINVERSIONLOOSE",`(${it[st.NUMERICIDENTIFIERLOOSE]})\\.(${it[st.NUMERICIDENTIFIERLOOSE]})\\.(${it[st.NUMERICIDENTIFIERLOOSE]})`),yt("PRERELEASEIDENTIFIER",`(?:${it[st.NUMERICIDENTIFIER]}|${it[st.NONNUMERICIDENTIFIER]})`),yt("PRERELEASEIDENTIFIERLOOSE",`(?:${it[st.NUMERICIDENTIFIERLOOSE]}|${it[st.NONNUMERICIDENTIFIER]})`),yt("PRERELEASE",`(?:-(${it[st.PRERELEASEIDENTIFIER]}(?:\\.${it[st.PRERELEASEIDENTIFIER]})*))`),yt("PRERELEASELOOSE",`(?:-?(${it[st.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${it[st.PRERELEASEIDENTIFIERLOOSE]})*))`),yt("BUILDIDENTIFIER",`${at}+`),yt("BUILD",`(?:\\+(${it[st.BUILDIDENTIFIER]}(?:\\.${it[st.BUILDIDENTIFIER]})*))`),yt("FULLPLAIN",`v?${it[st.MAINVERSION]}${it[st.PRERELEASE]}?${it[st.BUILD]}?`),yt("FULL",`^${it[st.FULLPLAIN]}$`),yt("LOOSEPLAIN",`[v=\\s]*${it[st.MAINVERSIONLOOSE]}${it[st.PRERELEASELOOSE]}?${it[st.BUILD]}?`),yt("LOOSE",`^${it[st.LOOSEPLAIN]}$`),yt("GTLT","((?:<|>)?=?)"),yt("XRANGEIDENTIFIERLOOSE",`${it[st.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),yt("XRANGEIDENTIFIER",`${it[st.NUMERICIDENTIFIER]}|x|X|\\*`),yt("XRANGEPLAIN",`[v=\\s]*(${it[st.XRANGEIDENTIFIER]})(?:\\.(${it[st.XRANGEIDENTIFIER]})(?:\\.(${it[st.XRANGEIDENTIFIER]})(?:${it[st.PRERELEASE]})?${it[st.BUILD]}?)?)?`),yt("XRANGEPLAINLOOSE",`[v=\\s]*(${it[st.XRANGEIDENTIFIERLOOSE]})(?:\\.(${it[st.XRANGEIDENTIFIERLOOSE]})(?:\\.(${it[st.XRANGEIDENTIFIERLOOSE]})(?:${it[st.PRERELEASELOOSE]})?${it[st.BUILD]}?)?)?`),yt("XRANGE",`^${it[st.GTLT]}\\s*${it[st.XRANGEPLAIN]}$`),yt("XRANGELOOSE",`^${it[st.GTLT]}\\s*${it[st.XRANGEPLAINLOOSE]}$`),yt("COERCE",`(^|[^\\d])(\\d{1,${$}})(?:\\.(\\d{1,${$}}))?(?:\\.(\\d{1,${$}}))?(?:$|[^\\d])`),yt("COERCERTL",it[st.COERCE],!0),yt("LONETILDE","(?:~>?)"),yt("TILDETRIM",`(\\s*)${it[st.LONETILDE]}\\s+`,!0),_.tildeTrimReplace="$1~",yt("TILDE",`^${it[st.LONETILDE]}${it[st.XRANGEPLAIN]}$`),yt("TILDELOOSE",`^${it[st.LONETILDE]}${it[st.XRANGEPLAINLOOSE]}$`),yt("LONECARET","(?:\\^)"),yt("CARETTRIM",`(\\s*)${it[st.LONECARET]}\\s+`,!0),_.caretTrimReplace="$1^",yt("CARET",`^${it[st.LONECARET]}${it[st.XRANGEPLAIN]}$`),yt("CARETLOOSE",`^${it[st.LONECARET]}${it[st.XRANGEPLAINLOOSE]}$`),yt("COMPARATORLOOSE",`^${it[st.GTLT]}\\s*(${it[st.LOOSEPLAIN]})$|^$`),yt("COMPARATOR",`^${it[st.GTLT]}\\s*(${it[st.FULLPLAIN]})$|^$`),yt("COMPARATORTRIM",`(\\s*)${it[st.GTLT]}\\s*(${it[st.LOOSEPLAIN]}|${it[st.XRANGEPLAIN]})`,!0),_.comparatorTrimReplace="$1$2$3",yt("HYPHENRANGE",`^\\s*(${it[st.XRANGEPLAIN]})\\s+-\\s+(${it[st.XRANGEPLAIN]})\\s*$`),yt("HYPHENRANGELOOSE",`^\\s*(${it[st.XRANGEPLAINLOOSE]})\\s+-\\s+(${it[st.XRANGEPLAINLOOSE]})\\s*$`),yt("STAR","(<|>)?=?\\s*\\*"),yt("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),yt("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=a=>a?typeof a!="object"?looseOption:a:emptyOpts;var parseOptions_1=parseOptions$1;const numeric=/^[0-9]+$/,compareIdentifiers$1=(a,_)=>{const $=numeric.test(a),j=numeric.test(_);return $&&j&&(a=+a,_=+_),a===_?0:$&&!j?-1:j&&!$?1:a<_?-1:1},rcompareIdentifiers=(a,_)=>compareIdentifiers$1(_,a);var identifiers$1={compareIdentifiers:compareIdentifiers$1,rcompareIdentifiers};const debug=debug_1,{MAX_LENGTH,MAX_SAFE_INTEGER}=constants$3,{safeRe:re$2,t:t$2}=reExports,parseOptions=parseOptions_1,{compareIdentifiers}=identifiers$1;let SemVer$d=class Uo{constructor(_,$){if($=parseOptions($),_ instanceof Uo){if(_.loose===!!$.loose&&_.includePrerelease===!!$.includePrerelease)return _;_=_.version}else if(typeof _!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof _}".`);if(_.length>MAX_LENGTH)throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);debug("SemVer",_,$),this.options=$,this.loose=!!$.loose,this.includePrerelease=!!$.includePrerelease;const j=_.trim().match($.loose?re$2[t$2.LOOSE]:re$2[t$2.FULL]);if(!j)throw new TypeError(`Invalid Version: ${_}`);if(this.raw=_,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: ${_}`)}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(a instanceof SemVer$c)return a;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(a.trim().replace(/^[=v]+/,""),_);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(a instanceof SemVer$b?a.version:a,$).inc(_,j,et).version}catch{return null}};var inc_1=inc$1;const parse$7=parse_1,diff$1=(a,_)=>{const $=parse$7(a,null,!0),j=parse$7(_,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 ot=it?"pre":"";return $.major!==j.major?ot+"major":$.minor!==j.minor?ot+"minor":$.patch!==j.patch?ot+"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(a,$).compare(new SemVer$7(_,$));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(a,$),et=new SemVer$6(_,$);return j.compare(et)||j.compareBuild(et)};var compareBuild_1=compareBuild$3;const compareBuild$2=compareBuild_1,sort$1=(a,_)=>a.sort(($,j)=>compareBuild$2($,j,_));var sort_1=sort$1;const compareBuild$1=compareBuild_1,rsort$1=(a,_)=>a.sort(($,j)=>compareBuild$1(j,$,_));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(_){case"===":return typeof a=="object"&&(a=a.version),typeof $=="object"&&($=$.version),a===$;case"!==":return typeof a=="object"&&(a=a.version),typeof $=="object"&&($=$.version),a!==$;case"":case"=":case"==":return eq$1(a,$,j);case"!=":return neq$1(a,$,j);case">":return gt$3(a,$,j);case">=":return gte$2(a,$,j);case"<":return lt$2(a,$,j);case"<=":return lte$2(a,$,j);default:throw new TypeError(`Invalid operator: ${_}`)}};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(a instanceof SemVer$5)return a;if(typeof a=="number"&&(a=String(a)),typeof a!="string")return null;_=_||{};let $=null;if(!_.rtl)$=a.match(re$1[t$1.COERCE]);else{let j;for(;(j=re$1[t$1.COERCERTL].exec(a))&&(!$||$.index+$[0].length!==a.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"}`,_)};var coerce_1=coerce$1,iterator$1,hasRequiredIterator;function requireIterator(){return hasRequiredIterator||(hasRequiredIterator=1,iterator$1=function(a){a.prototype[Symbol.iterator]=function*(){for(let _=this.head;_;_=_.next)yield _.value}}),iterator$1}var yallist=Yallist$1;Yallist$1.Node=Node$1;Yallist$1.create=Yallist$1;function Yallist$1(a){var _=this;if(_ instanceof Yallist$1||(_=new Yallist$1),_.tail=null,_.head=null,_.length=0,a&&typeof a.forEach=="function")a.forEach(function(et){_.push(et)});else if(arguments.length>0)for(var $=0,j=arguments.length;$1)$=_;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++)$=a($,j.value,et),j=j.next;return $};Yallist$1.prototype.reduceReverse=function(a,_){var $,j=this.tail;if(arguments.length>1)$=_;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--)$=a($,j.value,et),j=j.prev;return $};Yallist$1.prototype.toArray=function(){for(var a=new Array(this.length),_=0,$=this.head;$!==null;_++)a[_]=$.value,$=$.next;return a};Yallist$1.prototype.toArrayReverse=function(){for(var a=new Array(this.length),_=0,$=this.tail;$!==null;_++)a[_]=$.value,$=$.prev;return a};Yallist$1.prototype.slice=function(a,_){_=_||this.length,_<0&&(_+=this.length),a=a||0,a<0&&(a+=this.length);var $=new Yallist$1;if(_this.length&&(_=this.length);for(var j=0,et=this.head;et!==null&&jthis.length&&(_=this.length);for(var j=this.length,et=this.tail;et!==null&&j>_;j--)et=et.prev;for(;et!==null&&j>a;j--,et=et.prev)$.push(et.value);return $};Yallist$1.prototype.splice=function(a,_,...$){a>this.length&&(a=this.length-1),a<0&&(a=this.length+a);for(var j=0,et=this.head;et!==null&&j1;class LRUCache{constructor(_){if(typeof _=="number"&&(_={max:_}),_||(_={}),_.max&&(typeof _.max!="number"||_.max<0))throw new TypeError("max must be a non-negative number");this[MAX]=_.max||1/0;const $=_.length||naiveLength;if(this[LENGTH_CALCULATOR]=typeof $!="function"?naiveLength:$,this[ALLOW_STALE]=_.stale||!1,_.maxAge&&typeof _.maxAge!="number")throw new TypeError("maxAge must be a number");this[MAX_AGE]=_.maxAge||0,this[DISPOSE]=_.dispose,this[NO_DISPOSE_ON_SET]=_.noDisposeOnSet||!1,this[UPDATE_AGE_ON_GET]=_.updateAgeOnGet||!1,this.reset()}set max(_){if(typeof _!="number"||_<0)throw new TypeError("max must be a non-negative number");this[MAX]=_||1/0,trim(this)}get max(){return this[MAX]}set allowStale(_){this[ALLOW_STALE]=!!_}get allowStale(){return this[ALLOW_STALE]}set maxAge(_){if(typeof _!="number")throw new TypeError("maxAge must be a non-negative number");this[MAX_AGE]=_,trim(this)}get maxAge(){return this[MAX_AGE]}set lengthCalculator(_){typeof _!="function"&&(_=naiveLength),_!==this[LENGTH_CALCULATOR]&&(this[LENGTH_CALCULATOR]=_,this[LENGTH$1]=0,this[LRU_LIST].forEach($=>{$.length=this[LENGTH_CALCULATOR]($.value,$.key),this[LENGTH$1]+=$.length})),trim(this)}get lengthCalculator(){return this[LENGTH_CALCULATOR]}get length(){return this[LENGTH$1]}get itemCount(){return this[LRU_LIST].length}rforEach(_,$){$=$||this;for(let j=this[LRU_LIST].tail;j!==null;){const et=j.prev;forEachStep(this,_,j,$),j=et}}forEach(_,$){$=$||this;for(let j=this[LRU_LIST].head;j!==null;){const et=j.next;forEachStep(this,_,j,$),j=et}}keys(){return this[LRU_LIST].toArray().map(_=>_.key)}values(){return this[LRU_LIST].toArray().map(_=>_.value)}reset(){this[DISPOSE]&&this[LRU_LIST]&&this[LRU_LIST].length&&this[LRU_LIST].forEach(_=>this[DISPOSE](_.key,_.value)),this[CACHE]=new Map,this[LRU_LIST]=new Yallist,this[LENGTH$1]=0}dump(){return this[LRU_LIST].map(_=>isStale$1(this,_)?!1:{k:_.key,v:_.value,e:_.now+(_.maxAge||0)}).toArray().filter(_=>_)}dumpLru(){return this[LRU_LIST]}set(_,$,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]($,_);if(this[CACHE].has(_)){if(tt>this[MAX])return del(this,this[CACHE].get(_)),!1;const it=this[CACHE].get(_).value;return this[DISPOSE]&&(this[NO_DISPOSE_ON_SET]||this[DISPOSE](_,it.value)),it.now=et,it.maxAge=j,it.value=$,this[LENGTH$1]+=tt-it.length,it.length=tt,this.get(_),trim(this),!0}const rt=new Entry(_,$,tt,et,j);return rt.length>this[MAX]?(this[DISPOSE]&&this[DISPOSE](_,$),!1):(this[LENGTH$1]+=rt.length,this[LRU_LIST].unshift(rt),this[CACHE].set(_,this[LRU_LIST].head),trim(this),!0)}has(_){if(!this[CACHE].has(_))return!1;const $=this[CACHE].get(_).value;return!isStale$1(this,$)}get(_){return get$1(this,_,!0)}peek(_){return get$1(this,_,!1)}pop(){const _=this[LRU_LIST].tail;return _?(del(this,_),_.value):null}del(_){del(this,this[CACHE].get(_))}load(_){this.reset();const $=Date.now();for(let j=_.length-1;j>=0;j--){const et=_[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((_,$)=>get$1(this,$,!1))}}const get$1=(a,_,$)=>{const j=a[CACHE].get(_);if(j){const et=j.value;if(isStale$1(a,et)){if(del(a,j),!a[ALLOW_STALE])return}else $&&(a[UPDATE_AGE_ON_GET]&&(j.value.now=Date.now()),a[LRU_LIST].unshiftNode(j));return et.value}},isStale$1=(a,_)=>{if(!_||!_.maxAge&&!a[MAX_AGE])return!1;const $=Date.now()-_.now;return _.maxAge?$>_.maxAge:a[MAX_AGE]&&$>a[MAX_AGE]},trim=a=>{if(a[LENGTH$1]>a[MAX])for(let _=a[LRU_LIST].tail;a[LENGTH$1]>a[MAX]&&_!==null;){const $=_.prev;del(a,_),_=$}},del=(a,_)=>{if(_){const $=_.value;a[DISPOSE]&&a[DISPOSE]($.key,$.value),a[LENGTH$1]-=$.length,a[CACHE].delete($.key),a[LRU_LIST].removeNode(_)}};class Entry{constructor(_,$,j,et,tt){this.key=_,this.value=$,this.length=j,this.now=et,this.maxAge=tt||0}}const forEachStep=(a,_,$,j)=>{let et=$.value;isStale$1(a,et)&&(del(a,$),a[ALLOW_STALE]||(et=void 0)),et&&_.call(j,et.value,et.key,a)};var lruCache=LRUCache,range$1,hasRequiredRange;function requireRange(){if(hasRequiredRange)return range$1;hasRequiredRange=1;class a{constructor(ct,dt){if(dt=j(dt),ct instanceof a)return ct.loose===!!dt.loose&&ct.includePrerelease===!!dt.includePrerelease?ct:new a(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(mt=>this.parseRange(mt.trim())).filter(mt=>mt.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const mt=this.set[0];if(this.set=this.set.filter(xt=>!yt(xt[0])),this.set.length===0)this.set=[mt];else if(this.set.length>1){for(const xt of this.set)if(xt.length===1&&wt(xt[0])){this.set=[xt];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 mt=((this.options.includePrerelease&&ut)|(this.options.loose&&ht))+":"+ct,xt=$.get(mt);if(xt)return xt;const At=this.options.loose,Rt=At?nt[it.HYPHENRANGELOOSE]:nt[it.HYPHENRANGE];ct=ct.replace(Rt,jt(this.options.includePrerelease)),tt("hyphen replace",ct),ct=ct.replace(nt[it.COMPARATORTRIM],st),tt("comparator trim",ct),ct=ct.replace(nt[it.TILDETRIM],ot),tt("tilde trim",ct),ct=ct.replace(nt[it.CARETTRIM],at),tt("caret trim",ct);let St=ct.split(" ").map(tr=>Pt(tr,this.options)).join(" ").split(/\s+/).map(tr=>Ft(tr,this.options));At&&(St=St.filter(tr=>(tt("loose invalid filter",tr,this.options),!!tr.match(nt[it.COMPARATORLOOSE])))),tt("range list",St);const Tt=new Map,Et=St.map(tr=>new et(tr,this.options));for(const tr of Et){if(yt(tr))return[tr];Tt.set(tr.value,tr)}Tt.size>1&&Tt.has("")&&Tt.delete("");const Nt=[...Tt.values()];return $.set(mt,Nt),Nt}intersects(ct,dt){if(!(ct instanceof a))throw new TypeError("a Range is required");return this.set.some(mt=>Ct(mt,dt)&&ct.set.some(xt=>Ct(xt,dt)&&mt.every(At=>xt.every(Rt=>At.intersects(Rt,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;dtvt.value==="<0.0.0-0",wt=vt=>vt.value==="",Ct=(vt,ct)=>{let dt=!0;const mt=vt.slice();let xt=mt.pop();for(;dt&&mt.length;)dt=mt.every(At=>xt.intersects(At,ct)),xt=mt.pop();return dt},Pt=(vt,ct)=>(tt("comp",vt,ct),vt=Dt(vt,ct),tt("caret",vt),vt=Mt(vt,ct),tt("tildes",vt),vt=Ot(vt,ct),tt("xrange",vt),vt=Bt(vt,ct),tt("stars",vt),vt),$t=vt=>!vt||vt.toLowerCase()==="x"||vt==="*",Mt=(vt,ct)=>vt.trim().split(/\s+/).map(dt=>Lt(dt,ct)).join(" "),Lt=(vt,ct)=>{const dt=ct.loose?nt[it.TILDELOOSE]:nt[it.TILDE];return vt.replace(dt,(mt,xt,At,Rt,St)=>{tt("tilde",vt,mt,xt,At,Rt,St);let Tt;return $t(xt)?Tt="":$t(At)?Tt=`>=${xt}.0.0 <${+xt+1}.0.0-0`:$t(Rt)?Tt=`>=${xt}.${At}.0 <${xt}.${+At+1}.0-0`:St?(tt("replaceTilde pr",St),Tt=`>=${xt}.${At}.${Rt}-${St} <${xt}.${+At+1}.0-0`):Tt=`>=${xt}.${At}.${Rt} <${xt}.${+At+1}.0-0`,tt("tilde return",Tt),Tt})},Dt=(vt,ct)=>vt.trim().split(/\s+/).map(dt=>zt(dt,ct)).join(" "),zt=(vt,ct)=>{tt("caret",vt,ct);const dt=ct.loose?nt[it.CARETLOOSE]:nt[it.CARET],mt=ct.includePrerelease?"-0":"";return vt.replace(dt,(xt,At,Rt,St,Tt)=>{tt("caret",vt,xt,At,Rt,St,Tt);let Et;return $t(At)?Et="":$t(Rt)?Et=`>=${At}.0.0${mt} <${+At+1}.0.0-0`:$t(St)?At==="0"?Et=`>=${At}.${Rt}.0${mt} <${At}.${+Rt+1}.0-0`:Et=`>=${At}.${Rt}.0${mt} <${+At+1}.0.0-0`:Tt?(tt("replaceCaret pr",Tt),At==="0"?Rt==="0"?Et=`>=${At}.${Rt}.${St}-${Tt} <${At}.${Rt}.${+St+1}-0`:Et=`>=${At}.${Rt}.${St}-${Tt} <${At}.${+Rt+1}.0-0`:Et=`>=${At}.${Rt}.${St}-${Tt} <${+At+1}.0.0-0`):(tt("no pr"),At==="0"?Rt==="0"?Et=`>=${At}.${Rt}.${St}${mt} <${At}.${Rt}.${+St+1}-0`:Et=`>=${At}.${Rt}.${St}${mt} <${At}.${+Rt+1}.0-0`:Et=`>=${At}.${Rt}.${St} <${+At+1}.0.0-0`),tt("caret return",Et),Et})},Ot=(vt,ct)=>(tt("replaceXRanges",vt,ct),vt.split(/\s+/).map(dt=>It(dt,ct)).join(" ")),It=(vt,ct)=>{vt=vt.trim();const dt=ct.loose?nt[it.XRANGELOOSE]:nt[it.XRANGE];return vt.replace(dt,(mt,xt,At,Rt,St,Tt)=>{tt("xRange",vt,mt,xt,At,Rt,St,Tt);const Et=$t(At),Nt=Et||$t(Rt),tr=Nt||$t(St),ir=tr;return xt==="="&&ir&&(xt=""),Tt=ct.includePrerelease?"-0":"",Et?xt===">"||xt==="<"?mt="<0.0.0-0":mt="*":xt&&ir?(Nt&&(Rt=0),St=0,xt===">"?(xt=">=",Nt?(At=+At+1,Rt=0,St=0):(Rt=+Rt+1,St=0)):xt==="<="&&(xt="<",Nt?At=+At+1:Rt=+Rt+1),xt==="<"&&(Tt="-0"),mt=`${xt+At}.${Rt}.${St}${Tt}`):Nt?mt=`>=${At}.0.0${Tt} <${+At+1}.0.0-0`:tr&&(mt=`>=${At}.${Rt}.0${Tt} <${At}.${+Rt+1}.0-0`),tt("xRange return",mt),mt})},Bt=(vt,ct)=>(tt("replaceStars",vt,ct),vt.trim().replace(nt[it.STAR],"")),Ft=(vt,ct)=>(tt("replaceGTE0",vt,ct),vt.trim().replace(nt[ct.includePrerelease?it.GTE0PRE:it.GTE0],"")),jt=vt=>(ct,dt,mt,xt,At,Rt,St,Tt,Et,Nt,tr,ir,nr)=>($t(mt)?dt="":$t(xt)?dt=`>=${mt}.0.0${vt?"-0":""}`:$t(At)?dt=`>=${mt}.${xt}.0${vt?"-0":""}`:Rt?dt=`>=${dt}`:dt=`>=${dt}${vt?"-0":""}`,$t(Et)?Tt="":$t(Nt)?Tt=`<${+Et+1}.0.0-0`:$t(tr)?Tt=`<${Et}.${+Nt+1}.0-0`:ir?Tt=`<=${Et}.${Nt}.${tr}-${ir}`:vt?Tt=`<${Et}.${Nt}.${+tr+1}-0`:Tt=`<=${Tt}`,`${dt} ${Tt}`.trim()),bt=(vt,ct,dt)=>{for(let mt=0;mt0){const xt=vt[mt].semver;if(xt.major===ct.major&&xt.minor===ct.minor&&xt.patch===ct.patch)return!0}return!1}return!0};return range$1}var comparator,hasRequiredComparator;function requireComparator(){if(hasRequiredComparator)return comparator;hasRequiredComparator=1;const a=Symbol("SemVer ANY");class _{static get ANY(){return a}constructor(ot,at){if(at=$(at),ot instanceof _){if(ot.loose===!!at.loose)return ot;ot=ot.value}ot=ot.trim().split(/\s+/).join(" "),rt("comparator",ot,at),this.options=at,this.loose=!!at.loose,this.parse(ot),this.semver===a?this.value="":this.value=this.operator+this.semver.version,rt("comp",this)}parse(ot){const at=this.options.loose?j[et.COMPARATORLOOSE]:j[et.COMPARATOR],ut=ot.match(at);if(!ut)throw new TypeError(`Invalid comparator: ${ot}`);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=a}toString(){return this.value}test(ot){if(rt("Comparator.test",ot,this.options.loose),this.semver===a||ot===a)return!0;if(typeof ot=="string")try{ot=new nt(ot,this.options)}catch{return!1}return tt(ot,this.operator,this.semver,this.options)}intersects(ot,at){if(!(ot instanceof _))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new it(ot.value,at).test(this.value):ot.operator===""?ot.value===""?!0:new it(this.value,at).test(ot.semver):(at=$(at),at.includePrerelease&&(this.value==="<0.0.0-0"||ot.value==="<0.0.0-0")||!at.includePrerelease&&(this.value.startsWith("<0.0.0")||ot.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&ot.operator.startsWith(">")||this.operator.startsWith("<")&&ot.operator.startsWith("<")||this.semver.version===ot.semver.version&&this.operator.includes("=")&&ot.operator.includes("=")||tt(this.semver,"<",ot.semver,at)&&this.operator.startsWith(">")&&ot.operator.startsWith("<")||tt(this.semver,">",ot.semver,at)&&this.operator.startsWith("<")&&ot.operator.startsWith(">")))}}comparator=_;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{_=new Range$9(_,$)}catch{return!1}return _.test(a)};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(_,$)}catch{return null}return a.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(_,$)}catch{return null}return a.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,_)=>{a=new Range$5(a,_);let $=new SemVer$2("0.0.0");if(a.test($)||($=new SemVer$2("0.0.0-0"),a.test($)))return $;$=null;for(let j=0;j{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 $&&a.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)=>{a=new SemVer$1(a,j),_=new Range$3(_,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 st=0;st<_.set.length;++st){const ot=_.set[st];let at=null,ut=null;if(ot.forEach(ht=>{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(a,ut.semver))return!1;if(ut.operator===it&&rt(a,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,_,$)=>(a=new Range$2(a,$),_=new Range$2(_,$),a.intersects(_,$));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=a.sort((ot,at)=>compare$2(ot,at,$));for(const ot of rt)satisfies$2(ot,_,$)?(tt=ot,et||(et=ot)):(tt&&j.push([et,tt]),tt=null,et=null);et&&j.push([et,null]);const nt=[];for(const[ot,at]of j)ot===at?nt.push(ot):!at&&ot===rt[0]?nt.push("*"):at?ot===rt[0]?nt.push(`<=${at}`):nt.push(`${ot} - ${at}`):nt.push(`>=${ot}`);const it=nt.join(" || "),st=typeof _.raw=="string"?_.raw:String(_);return it.length{if(a===_)return!0;a=new Range$1(a,$),_=new Range$1(_,$);let j=!1;e:for(const et of a.set){for(const tt of _.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(a.length===1&&a[0].semver===ANY){if(_.length===1&&_[0].semver===ANY)return!0;$.includePrerelease?a=minimumVersionWithPreRelease:a=minimumVersion}if(_.length===1&&_[0].semver===ANY){if($.includePrerelease)return!0;_=minimumVersion}const j=new Set;let et,tt;for(const ht of a)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 yt of _)if(!satisfies$1(ht,String(yt),$))return!1;return!0}let nt,it,st,ot,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 _){if(ot=ot||ht.operator===">"||ht.operator===">=",st=st||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&&st&&!tt&&rt!==0||tt&&ot&&!et&&rt!==0||ut||at)},higherGT=(a,_,$)=>{if(!a)return _;const j=compare$1(a.semver,_.semver,$);return j>0?a:j<0||_.operator===">"&&a.operator===">="?_:a},lowerLT=(a,_,$)=>{if(!a)return _;const j=compare$1(a.semver,_.semver,$);return j<0?a:j>0||_.operator==="<"&&a.operator==="<="?_:a};var subset_1=subset$1;const internalRe=reExports,constants$1=constants$3,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$1.SEMVER_SPEC_VERSION,RELEASE_TYPES:constants$1.RELEASE_TYPES,compareIdentifiers:identifiers.compareIdentifiers,rcompareIdentifiers:identifiers.rcompareIdentifiers};const semver$1=getDefaultExportFromCjs$1(semver);var DeviceModelId;(function(a){a.blue="blue",a.nanoS="nanoS",a.nanoSP="nanoSP",a.nanoX="nanoX",a.stax="stax",a.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:a=>4*1024},[DeviceModelId.nanoS]:{id:DeviceModelId.nanoS,productName:"Ledger Nano S",productIdMM:16,legacyUsbProductId:1,usbOnly:!0,memorySize:320*1024,masks:[823132160],getBlockSize:a=>{var _;return semver$1.lt((_=semver$1.coerce(a))!==null&&_!==void 0?_:"","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:a=>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:a=>32},[DeviceModelId.stax]:{id:DeviceModelId.stax,productName:"Ledger Stax",productIdMM:96,legacyUsbProductId:6,usbOnly:!1,memorySize:1533*1024,masks:[857735168],getBlockSize:a=>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:a=>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=a=>{const _=devicesList.find(et=>et.legacyUsbProductId===a);if(_)return _;const $=a>>8;return devicesList.find(et=>et.productIdMM===$)},bluetoothServices=[],serviceUuidToInfos={};for(const a in devices){const _=devices[a],{bluetoothSpec:$}=_;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:_},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(ot){try{st(j.next(ot))}catch(at){rt(at)}}function it(ot){try{st(j.throw(ot))}catch(at){rt(at)}}function st(ot){ot.done?tt(ot.value):et(ot.value).then(nt,it)}st((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(_=>_.vendorId===ledgerUSBVendorId)})}function getFirstLedgerDevice(){return __awaiter$6(this,void 0,void 0,function*(){const a=yield getLedgerDevices();return a.length>0?a[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(ot){try{st(j.next(ot))}catch(at){rt(at)}}function it(ot){try{st(j.throw(ot))}catch(at){rt(at)}}function st(ot){ot.done?tt(ot.value):et(ot.value).then(nt,it)}st((j=j.apply(a,_||[])).next())})};const configurationValue=1,endpointNumber=3;class TransportWebUSB extends Transport$1{constructor(_,$){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=_,this.interfaceNumber=$,this.deviceModel=identifyUSBProductId(_.productId)}static request(){return __awaiter$5(this,void 0,void 0,function*(){const _=yield requestLedgerDevice();return TransportWebUSB.open(_)})}static openConnected(){return __awaiter$5(this,void 0,void 0,function*(){const _=yield getLedgerDevices();return _.length===0?null:TransportWebUSB.open(_[0])})}static open(_){return __awaiter$5(this,void 0,void 0,function*(){yield _.open(),_.configuration===null&&(yield _.selectConfiguration(configurationValue)),yield gracefullyResetDevice(_);const $=_.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 _.claimInterface(j)}catch(rt){throw yield _.close(),new TransportInterfaceNotAvailable(rt.message)}const et=new TransportWebUSB(_,j),tt=rt=>{_===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(_){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$6("apdu","=> "+_.toString("hex"));const tt=createHIDframing(j,et),rt=tt.makeBlocks(_);for(let st=0;st{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=a=>{let _=!1;getFirstLedgerDevice().then(j=>{if(!_){const et=identifyUSBProductId(j.productId);a.next({type:"add",descriptor:j,deviceModel:et}),a.complete()}},j=>{window.DOMException&&j instanceof window.DOMException&&j.code===18?a.error(new TransportWebUSBGestureRequired(j.message)):a.error(new TransportOpenUserCancelled(j.message))});function $(){_=!0}return{unsubscribe:$}};function gracefullyResetDevice(a){return __awaiter$5(this,void 0,void 0,function*(){try{yield a.reset()}catch(_){console.warn(_)}})}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(ot){try{st(j.next(ot))}catch(at){rt(at)}}function it(ot){try{st(j.throw(ot))}catch(at){rt(at)}}function st(ot){ot.done?tt(ot.value):et(ot.value).then(nt,it)}st((j=j.apply(a,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;const MAX_CHUNK_SIZE=230;function transformPathToBuffer(a){const _=[];a.split("/").forEach(et=>{let tt=parseInt(et,10);Number.isNaN(tt)||(et.length>1&&et[et.length-1]==="'"&&(tt+=2147483648),_.push(tt))});const j=Buffer$g.alloc(1+_.length*4);return j[0]=_.length,_.forEach((et,tt)=>{j.writeUInt32BE(et,1+4*tt)}),j}function compressPublicKey(a,_){return _===0||_===3?a=a.slice(1):(a[0]=2+(a[64]&1),a=a.slice(0,33)),a}function appendWatermark(a,_){let $=a;return typeof _<"u"&&($=Buffer$g.from(_).toString("hex").concat(a)),$}function chunkOperation(a,_){let $=0;for(;$!==_.length;){const j=$+MAX_CHUNK_SIZE>=_.length?_.length-$:MAX_CHUNK_SIZE,et=Buffer$g.alloc(j);_.copy(et,0,$,$+j),a.push(et),$+=j}return a}function validateResponse(a){let _=!0;a[0]!==49&&a[0]!==48&&(_=!1),a[1]+4!==a.length&&(_=!1),a[2]!==2&&(_=!1);const $=a[3];a[4+$]!==2&&(_=!1);const j=5+$,et=a[j];return j+1+et+2!==a.length&&(_=!1),_}function extractValue(a,_){const $=Buffer$g.alloc(32);$.fill(0);let j=_[a],et=a+1;return j>32&&(et+=j-32,j=32),_.copy($,32-j,et,et+j),{buffer:$,idxValueStart:et,length:j}}class InvalidLedgerResponseError extends TaquitoError{constructor(_){super(),this.message=_,this.name="InvalidLedgerResponseError"}}class PublicKeyRetrievalError extends TaquitoError{constructor(_){super(),this.cause=_,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(_){super(),this.derivationType=_,this.name="InvalidDerivationTypeError",this.message=`Invalid derivation type ${_} expecting one of the following: DerivationType.ED25519, DerivationType.SECP256K1, DerivationType.P256 or DerivationType.BIP32_ED25519`}}var DerivationType;(function(a){a[a.ED25519=0]="ED25519",a[a.SECP256K1=1]="SECP256K1",a[a.P256=2]="P256",a[a.BIP32_ED25519=3]="BIP32_ED25519"})(DerivationType||(DerivationType={}));class LedgerSigner{constructor(_,$="44'/1729'/0'/0'",j=!0,et=DerivationType.ED25519){if(this.transport=_,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 _=yield this.getLedgerPublicKey(),$=_[0],j=_.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 _=this.INS_PROMPT_PUBLIC_KEY;return this.prompt===!1&&(_=this.INS_GET_PUBLIC_KEY),yield this.transport.send(this.CLA,_,this.FIRST_MESSAGE_SEQUENCE,this.derivationType,transformPathToBuffer(this.path))}catch(_){throw new PublicKeyRetrievalError(_)}})}secretKey(){return __awaiter$4(this,void 0,void 0,function*(){throw new ProhibitedActionError("Secret key cannot be exposed")})}sign(_,$){return __awaiter$4(this,void 0,void 0,function*(){const j=appendWatermark(_,$),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 st=extractValue(3,rt),ot=st.idxValueStart+st.length+1,at=extractValue(ot,rt);nt=Buffer$g.concat([st.buffer,at.buffer]).toString("hex")}return{bytes:_,sig:b58cencode(nt,prefix[Prefix.SIG]),prefixSig:b58cencode(nt,this.getPrefixes().prefSig),sbytes:_+nt}})}signWithLedger(_){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,_[0]);for(let j=1;j<_.length;j++){const et=j===_.length-1?this.LAST_MESSAGE_SEQUENCE:this.OTHER_MESSAGE_SEQUENCE;$=yield this.transport.send(this.CLA,this.INS_SIGN,et,this.derivationType,_[j])}return $})}getPrefixes(){return this.derivationType===DerivationType.ED25519||this.derivationType===DerivationType.BIP32_ED25519?{prefPk:prefix[Prefix.EDPK],prefPkh:prefix[Prefix.TZ1],prefSig:prefix[Prefix.EDSIG]}:this.derivationType===DerivationType.SECP256K1?{prefPk:prefix[Prefix.SPPK],prefPkh:prefix[Prefix.TZ2],prefSig:prefix[Prefix.SPSIG]}:{prefPk:prefix[Prefix.P2PK],prefPkh:prefix[Prefix.TZ3],prefSig:prefix[Prefix.P2SIG]}}}function __awaiter$3(a,_,$,j){function et(tt){return tt instanceof $?tt:new $(function(rt){rt(tt)})}return new($||($=Promise))(function(tt,rt){function nt(ot){try{st(j.next(ot))}catch(at){rt(at)}}function it(ot){try{st(j.throw(ot))}catch(at){rt(at)}}function st(ot){ot.done?tt(ot.value):et(ot.value).then(nt,it)}st((j=j.apply(a,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;class HttpRequestFailed extends NetworkError{constructor(_,$,j){super(),this.method=_,this.url=$,this.cause=j,this.name="HttpRequestFailed",this.message=`${_} ${$} ${String(j)}`}}class HttpResponseError extends NetworkError{constructor(_,$,j,et,tt){super(),this.message=_,this.status=$,this.statusText=j,this.body=et,this.url=tt,this.name="HttpResponseError"}}class HttpTimeoutError extends NetworkError{constructor(_,$){super(),this.timeout=_,this.url=$,this.name="HttpTimeoutError",this.message=`HTTP request timeout of ${_}ms exceeded`}}var STATUS_CODE;(function(a){a[a.CONTINUE=100]="CONTINUE",a[a.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",a[a.PROCESSING=102]="PROCESSING",a[a.OK=200]="OK",a[a.CREATED=201]="CREATED",a[a.ACCEPTED=202]="ACCEPTED",a[a.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",a[a.NO_CONTENT=204]="NO_CONTENT",a[a.RESET_CONTENT=205]="RESET_CONTENT",a[a.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",a[a.MULTI_STATUS=207]="MULTI_STATUS",a[a.ALREADY_REPORTED=208]="ALREADY_REPORTED",a[a.IM_USED=226]="IM_USED",a[a.MULTIPLE_CHOICES=300]="MULTIPLE_CHOICES",a[a.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",a[a.FOUND=302]="FOUND",a[a.SEE_OTHER=303]="SEE_OTHER",a[a.NOT_MODIFIED=304]="NOT_MODIFIED",a[a.USE_PROXY=305]="USE_PROXY",a[a.SWITCH_PROXY=306]="SWITCH_PROXY",a[a.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",a[a.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",a[a.BAD_REQUEST=400]="BAD_REQUEST",a[a.UNAUTHORIZED=401]="UNAUTHORIZED",a[a.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",a[a.FORBIDDEN=403]="FORBIDDEN",a[a.NOT_FOUND=404]="NOT_FOUND",a[a.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",a[a.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",a[a.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",a[a.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",a[a.CONFLICT=409]="CONFLICT",a[a.GONE=410]="GONE",a[a.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",a[a.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",a[a.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",a[a.URI_TOO_LONG=414]="URI_TOO_LONG",a[a.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",a[a.RANGE_NOT_SATISFIABLE=416]="RANGE_NOT_SATISFIABLE",a[a.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",a[a.I_AM_A_TEAPOT=418]="I_AM_A_TEAPOT",a[a.MISDIRECTED_REQUEST=421]="MISDIRECTED_REQUEST",a[a.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",a[a.LOCKED=423]="LOCKED",a[a.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",a[a.UPGRADE_REQUIRED=426]="UPGRADE_REQUIRED",a[a.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",a[a.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",a[a.REQUEST_HEADER_FIELDS_TOO_LARGE=431]="REQUEST_HEADER_FIELDS_TOO_LARGE",a[a.UNAVAILABLE_FOR_LEGAL_REASONS=451]="UNAVAILABLE_FOR_LEGAL_REASONS",a[a.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",a[a.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",a[a.BAD_GATEWAY=502]="BAD_GATEWAY",a[a.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",a[a.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",a[a.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",a[a.VARIANT_ALSO_NEGOTIATES=506]="VARIANT_ALSO_NEGOTIATES",a[a.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",a[a.LOOP_DETECTED=508]="LOOP_DETECTED",a[a.NOT_EXTENDED=510]="NOT_EXTENDED",a[a.NETWORK_AUTHENTICATION_REQUIRED=511]="NETWORK_AUTHENTICATION_REQUIRED"})(STATUS_CODE||(STATUS_CODE={}));var _a$2;let fetch$1=globalThis==null?void 0:globalThis.fetch;const isNode=typeof process$1$1<"u"&&!!(!((_a$2=process$1$1==null?void 0:process$1$1.versions)===null||_a$2===void 0)&&_a$2.node);isNode&&(fetch$1=require("node-fetch"));class HttpBackend{constructor(_=3e4){this.timeout=_}serialize(_){if(!_)return"";const $=[];for(const et in _)if(_.hasOwnProperty(et)&&typeof _[et]<"u"){const tt=typeof _[et].toJSON=="function"?_[et].toJSON():_[et];if(tt===null){$.push(encodeURIComponent(et));continue}if(Array.isArray(tt)){tt.forEach(rt=>{$.push(encodeURIComponent(et)+"="+encodeURIComponent(rt))});continue}$.push(encodeURIComponent(et)+"="+encodeURIComponent(tt))}const j=$.join("&");return j?`?${j}`:""}createRequest({url:_,method:$,timeout:j=this.timeout,query:et,headers:tt={},json:rt=!0},nt){return __awaiter$3(this,void 0,void 0,function*(){const it=_+this.serialize(et);tt["Content-Type"]||(tt["Content-Type"]="application/json");const st=new AbortController,ot=setTimeout(()=>st.abort(),j);try{const at=yield fetch$1(it,{method:$,headers:tt,body:JSON.stringify(nt),signal:st.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(ot)}})}}function __rest$2(a,_){var $={};for(var j in a)Object.prototype.hasOwnProperty.call(a,j)&&_.indexOf(j)<0&&($[j]=a[j]);if(a!=null&&typeof Object.getOwnPropertySymbols=="function")for(var et=0,j=Object.getOwnPropertySymbols(a);et"u"&&(_=Object.keys(a));const j=$?[]:{};return _.forEach(et=>{const tt=a[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(a){a.TOO_LARGE="too large"})(OPERATION_METADATA||(OPERATION_METADATA={}));var METADATA_BALANCE_UPDATES_CATEGORY;(function(a){a.BAKING_BONUSES="baking bonuses",a.BAKING_REWARDS="baking rewards",a.BLOCK_FEES="block fees",a.BONDS="bonds",a.BOOTSTRAP="bootstrap",a.BURNED="burned",a.COMMITMENT="commitment",a.DELEGATE_DENOMINATOR="delegate_denominator",a.DELEGATOR_NUMERATOR="delegator_numerator",a.DEPOSITS="deposits",a.ENDORSING_REWARDS="endorsing rewards",a.INVOICE="invoice",a.LOST_ENDORSING_REWARDS="lost endorsing rewards",a.MINTED="minted",a.NONCE_REVELATION_REWARDS="nonce revelation rewards",a.PUNISHMENTS="punishments",a.SMART_ROLLUP_REFUTATION_PUNISHMENTS="smart_rollup_refutation_punishments",a.SMART_ROLLUP_REFUTATION_REWARDS="smart_rollup_refutation_rewards",a.STORAGE_FEES="storage fees",a.SUBSIDY="subsidy",a.UNSTAKED_DEPOSITS="unstaked_deposits"})(METADATA_BALANCE_UPDATES_CATEGORY||(METADATA_BALANCE_UPDATES_CATEGORY={}));var PvmKind;(function(a){a.WASM2="wasm_2_0_0",a.ARITH="arith",a.RISCV="riscv"})(PvmKind||(PvmKind={}));var SmartRollupRefutationOptions;(function(a){a.START="start",a.MOVE="move"})(SmartRollupRefutationOptions||(SmartRollupRefutationOptions={}));var SmartRollupInputProofKind;(function(a){a.INBOX_PROOF="inbox_proof",a.REVEAL_PROOF="reveal_proof",a.FIRST_INPUT="first_input"})(SmartRollupInputProofKind||(SmartRollupInputProofKind={}));var SmartRollupRefuteRevealProofKind;(function(a){a.RAW_DATA_PROOF="raw_data_proof",a.METADATA_PROOF="metadata_proof",a.DAL_PAGE_PROOF="dal_page_proof"})(SmartRollupRefuteRevealProofKind||(SmartRollupRefuteRevealProofKind={}));var SmartRollupRefuteGameStatusOptions;(function(a){a.ONGOING="ongoing",a.ENDED="ended"})(SmartRollupRefuteGameStatusOptions||(SmartRollupRefuteGameStatusOptions={}));var SmartRollupRefuteGameEndedPlayerOutcomes;(function(a){a.LOSER="loser",a.DRAW="draw"})(SmartRollupRefuteGameEndedPlayerOutcomes||(SmartRollupRefuteGameEndedPlayerOutcomes={}));var SmartRollupRefuteGameEndedReason;(function(a){a.CONFLICT_RESOLVED="conflict_resolved",a.TIMEOUT="timeout"})(SmartRollupRefuteGameEndedReason||(SmartRollupRefuteGameEndedReason={}));var OpKind;(function(a){a.ORIGINATION="origination",a.DELEGATION="delegation",a.REVEAL="reveal",a.TRANSACTION="transaction",a.ACTIVATION="activate_account",a.ATTESTATION="attestation",a.ENDORSEMENT="endorsement",a.PREATTESTATION="preattestation",a.PREENDORSEMENT="preendorsement",a.SET_DEPOSITS_LIMIT="set_deposits_limit",a.DOUBLE_PREATTESTATION_EVIDENCE="double_preattestation_evidence",a.DOUBLE_PREENDORSEMENT_EVIDENCE="double_preendorsement_evidence",a.ATTESTATION_WITH_SLOT="attestation_with_slot",a.ENDORSEMENT_WITH_SLOT="endorsement_with_slot",a.SEED_NONCE_REVELATION="seed_nonce_revelation",a.DOUBLE_ATTESTATION_EVIDENCE="double_attestation_evidence",a.DOUBLE_ENDORSEMENT_EVIDENCE="double_endorsement_evidence",a.DOUBLE_BAKING_EVIDENCE="double_baking_evidence",a.PROPOSALS="proposals",a.BALLOT="ballot",a.FAILING_NOOP="failing_noop",a.REGISTER_GLOBAL_CONSTANT="register_global_constant",a.TRANSFER_TICKET="transfer_ticket",a.INCREASE_PAID_STORAGE="increase_paid_storage",a.UPDATE_CONSENSUS_KEY="update_consensus_key",a.DRAIN_DELEGATE="drain_delegate",a.VDF_REVELATION="vdf_revelation",a.EVENT="event",a.TICKET_UPDATES="ticket_updates",a.SMART_ROLLUP_ORIGINATE="smart_rollup_originate",a.SMART_ROLLUP_ADD_MESSAGES="smart_rollup_add_messages",a.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE="smart_rollup_execute_outbox_message",a.SMART_ROLLUP_PUBLISH="smart_rollup_publish",a.SMART_ROLLUP_CEMENT="smart_rollup_cement",a.SMART_ROLLUP_RECOVER_BOND="smart_rollup_recover_bond",a.SMART_ROLLUP_REFUTE="smart_rollup_refute",a.SMART_ROLLUP_TIMEOUT="smart_rollup_timeout"})(OpKind||(OpKind={}));class RpcClient{constructor(_,$=defaultChain,j=new HttpBackend){this.url=_,this.chain=$,this.httpBackend=j}createURL(_){let $=this.url;for(;$.endsWith("/");)$=$.slice(0,-1);return`${$}${_}`}validateAddress(_){const $=validateAddress(_);if($!==ValidationResult.VALID)throw new InvalidAddressError(_,invalidDetail($))}validateContract(_){const $=validateContractAddress(_);if($!==ValidationResult.VALID)throw new InvalidContractAddressError(_,invalidDetail($))}getBlockHash({block:_}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${_}/hash`),method:"GET"})})}getLiveBlocks({block:_}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${_}/live_blocks`),method:"GET"})})}getBalance(_,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){this.validateAddress(_);const j=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/contracts/${_}/balance`),method:"GET"});return new BigNumber(j)})}getStorage(_,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.validateContract(_),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/contracts/${_}/storage`),method:"GET"})})}getScript(_,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.validateContract(_),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/contracts/${_}/script`),method:"GET"})})}getNormalizedScript(_,$={unparsing_mode:"Readable"},{block:j}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.validateContract(_),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${j}/context/contracts/${_}/script/normalized`),method:"POST"},$)})}getContract(_,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){this.validateAddress(_);const j=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/contracts/${_}`),method:"GET"});return Object.assign(Object.assign({},j),{balance:new BigNumber(j.balance)})})}getManagerKey(_,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.validateAddress(_),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/contracts/${_}/manager_key`),method:"GET"})})}getDelegate(_,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){this.validateAddress(_);let j;try{j=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/contracts/${_}/delegate`),method:"GET"})}catch(et){if(et instanceof HttpResponseError&&et.status===STATUS_CODE.NOT_FOUND)j=null;else throw et}return j})}getBigMapKey(_,$,{block:j}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.validateAddress(_),this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${j}/context/contracts/${_}/big_map_get`),method:"POST"},$)})}getBigMapExpr(_,$,{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/${_}/${$}`),method:"GET"})})}getDelegates(_,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){this.validateAddress(_);const j=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/delegates/${_}`),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:st}=tt,ot=__rest$2(tt,["deposit","deposits","fees","rewards"]);const at=castToBigNumber({deposit:rt,deposits:nt,fees:it,rewards:st},["deposit","deposits","fees","rewards"]);return Object.assign(Object.assign({},ot),{deposit:at.deposit,deposits:at.deposits,fees:at.fees,rewards:at.rewards})}):void 0})})}getVotingInfo(_,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.validateAddress(_),yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/delegates/${_}/voting_info`),method:"GET"})})}getConstants({block:_}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){const $=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${_}/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:_,version:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){const j={url:this.createURL(`/chains/${this.chain}/blocks/${_}`),method:"GET"};return $!==void 0&&(j.query={version:$}),yield this.httpBackend.createRequest(j)})}getBlockHeader({block:_}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${_}/header`),method:"GET"})})}getBlockMetadata({block:_,version:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){const j={url:this.createURL(`/chains/${this.chain}/blocks/${_}/metadata`),method:"GET"};return $!==void 0&&(j.query={version:$}),yield this.httpBackend.createRequest(j)})}getBakingRights(_={},{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:_})})}getAttestationRights(_={},{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:_})})}getEndorsingRights(_={},{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:_})})}getBallotList({block:_}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${_}/votes/ballot_list`),method:"GET"})})}getBallots({block:_}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){const $=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${_}/votes/ballots`),method:"GET"});return castToBigNumber($,["yay","nay","pass"])})}getCurrentProposal({block:_}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${_}/votes/current_proposal`),method:"GET"})})}getCurrentQuorum({block:_}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${_}/votes/current_quorum`),method:"GET"})})}getVotesListings({block:_}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){const $=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${_}/votes/listings`),method:"GET"});return $.map(j=>(j.voting_power&&(j.voting_power=new BigNumber(j.voting_power)),j)),$})}getProposals({block:_}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){const $=yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${_}/votes/proposals`),method:"GET"});return $.map(j=>j[1]=new BigNumber(j[1])),$})}forgeOperations(_,{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"},_)})}injectOperation(_){return __awaiter$2(this,void 0,void 0,function*(){return this.httpBackend.createRequest({url:this.createURL("/injection/operation"),method:"POST"},_)})}preapplyOperations(_,{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,_)})}getEntrypoints(_,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.validateContract(_),yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/contracts/${_}/entrypoints`),method:"GET"})})}runOperation(_,{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,_)})}simulateOperation(_,{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,_)})}runCode(_,{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"},_)})}runScriptView(_,$){var{unparsing_mode:j="Readable"}=_,et=__rest$2(_,["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(_,$){var{unparsing_mode:j="Readable"}=_,et=__rest$2(_,["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(_,{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"},_),{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:_}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${_}/votes/current_period`),method:"GET"})})}getSuccessorPeriod({block:_}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return yield this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${_}/votes/successor_period`),method:"GET"})})}getSaplingDiffById(_,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/sapling/${_}/get_diff`),method:"GET"})})}getSaplingDiffByContract(_,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/contracts/${_}/single_sapling_get_diff`),method:"GET"})})}getProtocols({block:_}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${_}/protocols`),method:"GET"})})}getStorageUsedSpace(_,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/contracts/${_}/storage/used_space`),method:"GET"})})}getStoragePaidSpace(_,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/contracts/${_}/storage/paid_space`),method:"GET"})})}getTicketBalance(_,$,{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/${_}/ticket_balance`),method:"POST"},$)})}getAllTicketBalances(_,{block:$}=defaultRPCOptions){return __awaiter$2(this,void 0,void 0,function*(){return this.httpBackend.createRequest({url:this.createURL(`/chains/${this.chain}/blocks/${$}/context/contracts/${_}/all_ticket_balances`),method:"GET"})})}getPendingOperations(_={}){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:_})})}}var src={},sha512$1={},_u64={};(function(a){Object.defineProperty(a,"__esModule",{value:!0}),a.add=a.toBig=a.split=a.fromBig=void 0;const _=BigInt(2**32-1),$=BigInt(32);function j(Ft,jt=!1){return jt?{h:Number(Ft&_),l:Number(Ft>>$&_)}:{h:Number(Ft>>$&_)|0,l:Number(Ft&_)|0}}a.fromBig=j;function et(Ft,jt=!1){let bt=new Uint32Array(Ft.length),vt=new Uint32Array(Ft.length);for(let ct=0;ctBigInt(Ft>>>0)<<$|BigInt(jt>>>0);a.toBig=tt;const rt=(Ft,jt,bt)=>Ft>>>bt,nt=(Ft,jt,bt)=>Ft<<32-bt|jt>>>bt,it=(Ft,jt,bt)=>Ft>>>bt|jt<<32-bt,st=(Ft,jt,bt)=>Ft<<32-bt|jt>>>bt,ot=(Ft,jt,bt)=>Ft<<64-bt|jt>>>bt-32,at=(Ft,jt,bt)=>Ft>>>bt-32|jt<<64-bt,ut=(Ft,jt)=>jt,ht=(Ft,jt)=>Ft,yt=(Ft,jt,bt)=>Ft<>>32-bt,wt=(Ft,jt,bt)=>jt<>>32-bt,Ct=(Ft,jt,bt)=>jt<>>64-bt,Pt=(Ft,jt,bt)=>Ft<>>64-bt;function $t(Ft,jt,bt,vt){const ct=(jt>>>0)+(vt>>>0);return{h:Ft+bt+(ct/2**32|0)|0,l:ct|0}}a.add=$t;const Mt=(Ft,jt,bt)=>(Ft>>>0)+(jt>>>0)+(bt>>>0),Lt=(Ft,jt,bt,vt)=>jt+bt+vt+(Ft/2**32|0)|0,Dt=(Ft,jt,bt,vt)=>(Ft>>>0)+(jt>>>0)+(bt>>>0)+(vt>>>0),zt=(Ft,jt,bt,vt,ct)=>jt+bt+vt+ct+(Ft/2**32|0)|0,Ot=(Ft,jt,bt,vt,ct)=>(Ft>>>0)+(jt>>>0)+(bt>>>0)+(vt>>>0)+(ct>>>0),It=(Ft,jt,bt,vt,ct,dt)=>jt+bt+vt+ct+dt+(Ft/2**32|0)|0,Bt={fromBig:j,split:et,toBig:a.toBig,shrSH:rt,shrSL:nt,rotrSH:it,rotrSL:st,rotrBH:ot,rotrBL:at,rotr32H:ut,rotr32L:ht,rotlSH:yt,rotlSL:wt,rotlBH:Ct,rotlBL:Pt,add:$t,add3L:Mt,add3H:Lt,add4L:Dt,add4H:zt,add5H:It,add5L:Ot};a.default=Bt})(_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$1=_u64,utils_js_1$2=utils$e,[SHA512_Kh,SHA512_Kl]=_u64_js_1$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(a=>BigInt(a))),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:_,Al:$,Bh:j,Bl:et,Ch:tt,Cl:rt,Dh:nt,Dl:it,Eh:st,El:ot,Fh:at,Fl:ut,Gh:ht,Gl:yt,Hh:wt,Hl:Ct}=this;return[_,$,j,et,tt,rt,nt,it,st,ot,at,ut,ht,yt,wt,Ct]}set(_,$,j,et,tt,rt,nt,it,st,ot,at,ut,ht,yt,wt,Ct){this.Ah=_|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=st|0,this.El=ot|0,this.Fh=at|0,this.Fl=ut|0,this.Gh=ht|0,this.Gl=yt|0,this.Hh=wt|0,this.Hl=Ct|0}process(_,$){for(let Mt=0;Mt<16;Mt++,$+=4)SHA512_W_H[Mt]=_.getUint32($),SHA512_W_L[Mt]=_.getUint32($+=4);for(let Mt=16;Mt<80;Mt++){const Lt=SHA512_W_H[Mt-15]|0,Dt=SHA512_W_L[Mt-15]|0,zt=_u64_js_1$1.default.rotrSH(Lt,Dt,1)^_u64_js_1$1.default.rotrSH(Lt,Dt,8)^_u64_js_1$1.default.shrSH(Lt,Dt,7),Ot=_u64_js_1$1.default.rotrSL(Lt,Dt,1)^_u64_js_1$1.default.rotrSL(Lt,Dt,8)^_u64_js_1$1.default.shrSL(Lt,Dt,7),It=SHA512_W_H[Mt-2]|0,Bt=SHA512_W_L[Mt-2]|0,Ft=_u64_js_1$1.default.rotrSH(It,Bt,19)^_u64_js_1$1.default.rotrBH(It,Bt,61)^_u64_js_1$1.default.shrSH(It,Bt,6),jt=_u64_js_1$1.default.rotrSL(It,Bt,19)^_u64_js_1$1.default.rotrBL(It,Bt,61)^_u64_js_1$1.default.shrSL(It,Bt,6),bt=_u64_js_1$1.default.add4L(Ot,jt,SHA512_W_L[Mt-7],SHA512_W_L[Mt-16]),vt=_u64_js_1$1.default.add4H(bt,zt,Ft,SHA512_W_H[Mt-7],SHA512_W_H[Mt-16]);SHA512_W_H[Mt]=vt|0,SHA512_W_L[Mt]=bt|0}let{Ah:j,Al:et,Bh:tt,Bl:rt,Ch:nt,Cl:it,Dh:st,Dl:ot,Eh:at,El:ut,Fh:ht,Fl:yt,Gh:wt,Gl:Ct,Hh:Pt,Hl:$t}=this;for(let Mt=0;Mt<80;Mt++){const Lt=_u64_js_1$1.default.rotrSH(at,ut,14)^_u64_js_1$1.default.rotrSH(at,ut,18)^_u64_js_1$1.default.rotrBH(at,ut,41),Dt=_u64_js_1$1.default.rotrSL(at,ut,14)^_u64_js_1$1.default.rotrSL(at,ut,18)^_u64_js_1$1.default.rotrBL(at,ut,41),zt=at&ht^~at&wt,Ot=ut&yt^~ut&Ct,It=_u64_js_1$1.default.add5L($t,Dt,Ot,SHA512_Kl[Mt],SHA512_W_L[Mt]),Bt=_u64_js_1$1.default.add5H(It,Pt,Lt,zt,SHA512_Kh[Mt],SHA512_W_H[Mt]),Ft=It|0,jt=_u64_js_1$1.default.rotrSH(j,et,28)^_u64_js_1$1.default.rotrBH(j,et,34)^_u64_js_1$1.default.rotrBH(j,et,39),bt=_u64_js_1$1.default.rotrSL(j,et,28)^_u64_js_1$1.default.rotrBL(j,et,34)^_u64_js_1$1.default.rotrBL(j,et,39),vt=j&tt^j&nt^tt&nt,ct=et&rt^et&it^rt⁢Pt=wt|0,$t=Ct|0,wt=ht|0,Ct=yt|0,ht=at|0,yt=ut|0,{h:at,l:ut}=_u64_js_1$1.default.add(st|0,ot|0,Bt|0,Ft|0),st=nt|0,ot=it|0,nt=tt|0,it=rt|0,tt=j|0,rt=et|0;const dt=_u64_js_1$1.default.add3L(Ft,bt,ct);j=_u64_js_1$1.default.add3H(dt,Bt,jt,vt),et=dt|0}({h:j,l:et}=_u64_js_1$1.default.add(this.Ah|0,this.Al|0,j|0,et|0)),{h:tt,l:rt}=_u64_js_1$1.default.add(this.Bh|0,this.Bl|0,tt|0,rt|0),{h:nt,l:it}=_u64_js_1$1.default.add(this.Ch|0,this.Cl|0,nt|0,it|0),{h:st,l:ot}=_u64_js_1$1.default.add(this.Dh|0,this.Dl|0,st|0,ot|0),{h:at,l:ut}=_u64_js_1$1.default.add(this.Eh|0,this.El|0,at|0,ut|0),{h:ht,l:yt}=_u64_js_1$1.default.add(this.Fh|0,this.Fl|0,ht|0,yt|0),{h:wt,l:Ct}=_u64_js_1$1.default.add(this.Gh|0,this.Gl|0,wt|0,Ct|0),{h:Pt,l:$t}=_u64_js_1$1.default.add(this.Hh|0,this.Hl|0,Pt|0,$t|0),this.set(j,et,tt,rt,nt,it,st,ot,at,ut,ht,yt,wt,Ct,Pt,$t)}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$2.wrapConstructor)(()=>new SHA512);sha512$1.sha512_224=(0,utils_js_1$2.wrapConstructor)(()=>new SHA512_224);sha512$1.sha512_256=(0,utils_js_1$2.wrapConstructor)(()=>new SHA512_256);sha512$1.sha384=(0,utils_js_1$2.wrapConstructor)(()=>new SHA384);var pbkdf2$1={},hmac$2={};(function(a){Object.defineProperty(a,"__esModule",{value:!0}),a.hmac=void 0;const _=_assert,$=utils$e;class j extends $.Hash{constructor(rt,nt){super(),this.finished=!1,this.destroyed=!1,_.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 st=this.blockLen,ot=new Uint8Array(st);ot.set(it.length>st?rt.create().update(it).digest():it);for(let at=0;atnew j(tt,rt).update(nt).digest();a.hmac=et,a.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$1=_assert,hmac_js_1=hmac$2,utils_js_1$1=utils$e;function pbkdf2Init(a,_,$,j){_assert_js_1$1.default.hash(a);const et=(0,utils_js_1$1.checkOpts)({dkLen:32,asyncTick:10},j),{c:tt,dkLen:rt,asyncTick:nt}=et;if(_assert_js_1$1.default.number(tt),_assert_js_1$1.default.number(rt),_assert_js_1$1.default.number(nt),tt<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const it=(0,utils_js_1$1.toBytes)(_),st=(0,utils_js_1$1.toBytes)($),ot=new Uint8Array(rt),at=hmac_js_1.hmac.create(a,it),ut=at._cloneInto().update(st);return{c:tt,dkLen:rt,asyncTick:nt,DK:ot,PRF:at,PRFSalt:ut}}function pbkdf2Output(a,_,$,j,et){return a.destroy(),_.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 st;const ot=new Uint8Array(4),at=(0,utils_js_1$1.createView)(ot),ut=new Uint8Array(nt.outputLen);for(let ht=1,yt=0;yt{it._cloneInto(ot).update(ht).digestInto(ht);for(let $t=0;$tlpad(_.toString(2),"0",8)).join("")}function deriveChecksumBits(a){const $=a.length*8/32,j=sha256_1.sha256(Uint8Array.from(a));return bytesToBinary(Array.from(j)).slice(0,$)}function salt(a){return"mnemonic"+(a||"")}function mnemonicToSeedSync(a,_){const $=Uint8Array.from(Buffer$g.from(normalize(a),"utf8")),j=Uint8Array.from(Buffer$g.from(salt(normalize(_)),"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(a),"utf8")),j=Uint8Array.from(Buffer$g.from(salt(normalize(_)),"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(_=_||DEFAULT_WORDLIST,!_)throw new Error(WORDLIST_REQUIRED);const $=normalize(a).split(" ");if($.length%3!==0)throw new Error(INVALID_MNEMONIC);const j=$.map(ot=>{const at=_.indexOf(ot);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(a)||(a=Buffer$g.from(a,"hex")),_=_||DEFAULT_WORDLIST,!_)throw new Error(WORDLIST_REQUIRED);if(a.length<16)throw new TypeError(INVALID_ENTROPY);if(a.length>32)throw new TypeError(INVALID_ENTROPY);if(a.length%4!==0)throw new TypeError(INVALID_ENTROPY);const $=bytesToBinary(Array.from(a)),j=deriveChecksumBits(a),rt=($+j).match(/(.{1,11})/g).map(nt=>{const it=binaryToByte(nt);return _[it]});return _[0]==="あいこくしん"?rt.join(" "):rt.join(" ")}src.entropyToMnemonic=entropyToMnemonic;function generateMnemonic(a,_,$){if(a=a||128,a%32!==0)throw new TypeError(INVALID_ENTROPY);return _=_||(j=>Buffer$g.from(utils_1$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(a){const _=_wordlists_1.wordlists[a];if(_)DEFAULT_WORDLIST=_;else throw new Error('Could not find wordlist for language "'+a+'"')}src.setDefaultWordlist=setDefaultWordlist;function getDefaultWordlist(){if(!DEFAULT_WORDLIST)throw new Error("No Default Wordlist set");return Object.keys(_wordlists_1.wordlists).filter(a=>a==="JA"||a==="EN"?!1:_wordlists_1.wordlists[a].every((_,$)=>_===DEFAULT_WORDLIST[$]))[0]}src.getDefaultWordlist=getDefaultWordlist;var _wordlists_2=_wordlists,wordlists=src.wordlists=_wordlists_2.wordlists,hmac$1={},hash={};Object.defineProperty(hash,"__esModule",{value:!0});function isSerializableHash(a){return typeof a.saveState<"u"&&typeof a.restoreState<"u"&&typeof a.cleanSavedState<"u"}hash.isSerializableHash=isSerializableHash;Object.defineProperty(hmac$1,"__esModule",{value:!0});var hash_1=hash,constant_time_1=constantTime,wipe_1=wipe$1,HMAC=function(){function a(_,$){this._finished=!1,this._inner=new _,this._outer=new _,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$1.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,st=new Uint8Array,ot=0;for(;ot===0;){const ut=new HMAC_1(sha512$2.SHA512,nt).update(tt).digest();it=new BN$9(ut.subarray(0,32)),st=ut.subarray(32),it.isZero()||it.cmp(rt.n)>=0?tt=ut:ot++}const at=rt.keyPair({});return at.priv=it,new lm(at,st)}derive(_){const $=new Uint8Array(37);_&Hard?$.set(this.keyPair.getPrivate().toArray(),1):$.set(this.keyPair.getPublic().encodeCompressed(),0),new DataView($.buffer).setUint32(33,_);let j=new BN$9(0),et=new Uint8Array,tt=0;for(;tt===0;){const nt=new HMAC_1(sha512$2.SHA512,this.chainCode).update($).digest();j=new BN$9(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(_){let $=this;for(const j of _)$=$.derive(j);return $}bytes(){if(!this.keyPair.priv)throw new InvalidKeyError("missing private key");const _=this.keyPair.priv.toArray(),$=new Uint8Array(32);return $.set(_,$.length-_.length),$}};const Hard=2147483648;class Path extends Array{static from(_){return super.from(_).map($=>$>>>0)}static fromString(_){if(_.length===0)return new Path;let $=_.split("/");const j=[];$[0]==="m"&&($=$.slice(1));for(let et of $){if(et.length===0)throw new InvalidDerivationPathError(_,": 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(_,$){this.priv=_,this.chainCode=$}static fromSeed(_){const $=typeof _=="string"?parseHex(_):_;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(_){if(!(_&Hard))throw new InvalidDerivationPathError(_.toString(),": Non-hardened derivation path.");const $=new Uint8Array(37);$.set(this.seed(),1),new DataView($.buffer).setUint32(33,_);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(_){let $=this;for(const j of _)$=$.derive(j);return $}}const generateSecretKey=(a,_,$)=>{const j=Path.fromString(_);let et;switch($){case"ed25519":return et=PrivateKey.fromSeed(a).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(a,$);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(_,$,j){if(!validateMnemonic_1(j))throw new InvalidMnemonicError(j);const et=mnemonicToSeedSync_1(j,`${_}${$}`),tt=b58cencode(et.slice(0,32),prefix.edsk2);return new InMemorySigner(tt)}static fromSecretKey(_,$){return __awaiter$1(this,void 0,void 0,function*(){return new InMemorySigner(_,$)})}static fromMnemonic({mnemonic:_,password:$="",derivationPath:j="44'/1729'/0'/0'",curve:et="ed25519"}){if(!validateMnemonic_1(_))throw new InvalidMnemonicError(_);const tt=mnemonicToSeedSync_1(_,$),rt=generateSecretKey(tt,j,et);return new InMemorySigner(rt)}constructor(_,$){const j=_.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(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(_.substring(0,4)){case"edes":case"edsk":this._key=new Tz1(_,j,et);break;case"spsk":case"spes":this._key=new Tz2(_,j,et);break;case"p2sk":case"p2es":this._key=new Tz3(_,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(_,$){return __awaiter$1(this,void 0,void 0,function*(){let j=hex2buf(_);typeof $<"u"&&(j=mergebuf($,j));const et=blake2b$1.hash(j,32);return this._key.sign(_,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(a){return typeof a=="function"}function createErrorClass(a){var _=function(j){Error.call(j),j.stack=new Error().stack},$=a(_);return $.prototype=Object.create(Error.prototype),$.prototype.constructor=$,$}var UnsubscriptionError=createErrorClass(function(a){return function($){a(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(a){var $=a.indexOf(_);0<=$&&a.splice($,1)}}var Subscription=function(){function a(_){this.initialTeardown=_,this.closed=!1,this._parentage=null,this._finalizers=null}return a.prototype.unsubscribe=function(){var _,$,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 st=it.value;st.remove(this)}}catch(wt){_={error:wt}}finally{try{it&&!it.done&&($=nt.return)&&$.call(nt)}finally{if(_)throw _.error}}else rt.remove(this);var ot=this.initialTeardown;if(isFunction$1(ot))try{ot()}catch(wt){tt=wt instanceof UnsubscriptionError?wt.errors:[wt]}var at=this._finalizers;if(at){this._finalizers=null;try{for(var ut=__values(at),ht=ut.next();!ht.done;ht=ut.next()){var yt=ht.value;try{execFinalizer(yt)}catch(wt){tt=tt??[],wt instanceof UnsubscriptionError?tt=__spreadArray(__spreadArray([],__read(tt)),__read(wt.errors)):tt.push(wt)}}}catch(wt){j={error:wt}}finally{try{ht&&!ht.done&&(et=ut.return)&&et.call(ut)}finally{if(j)throw j.error}}}if(tt)throw new UnsubscriptionError(tt)}},a.prototype.add=function(_){var $;if(_&&_!==this)if(this.closed)execFinalizer(_);else{if(_ instanceof a){if(_.closed||_._hasParent(this))return;_._addParent(this)}(this._finalizers=($=this._finalizers)!==null&&$!==void 0?$:[]).push(_)}},a.prototype._hasParent=function(_){var $=this._parentage;return $===_||Array.isArray($)&&$.includes(_)},a.prototype._addParent=function(_){var $=this._parentage;this._parentage=Array.isArray($)?($.push(_),$):$?[$,_]:_},a.prototype._removeParent=function(_){var $=this._parentage;$===_?this._parentage=null:Array.isArray($)&&arrRemove($,_)},a.prototype.remove=function(_){var $=this._finalizers;$&&arrRemove($,_),_ instanceof a&&_._removeParent(this)},a.EMPTY=function(){var _=new a;return _.closed=!0,_}(),a}(),EMPTY_SUBSCRIPTION=Subscription.EMPTY;function isSubscription(a){return a instanceof Subscription||a&&"closed"in a&&isFunction$1(a.remove)&&isFunction$1(a.add)&&isFunction$1(a.unsubscribe)}function execFinalizer(a){isFunction$1(a)?a():a.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}),_.prototype._trySubscribe=function($){return this._throwIfClosed(),a.prototype._trySubscribe.call(this,$)},_.prototype._subscribe=function($){return this._throwIfClosed(),this._checkFinalizedStatuses($),this._innerSubscribe($)},_.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,$)}))},_.prototype._checkFinalizedStatuses=function($){var j=this,et=j.hasError,tt=j.thrownError,rt=j.isStopped;et?$.error(tt):rt&&$.complete()},_.prototype.asObservable=function(){var $=new Observable;return $.source=this,$},_.create=function($,j){return new AnonymousSubject($,j)},_}(Observable),AnonymousSubject=function(a){__extends$1(_,a);function _($,j){var et=a.call(this)||this;return et.destination=$,et.source=j,et}return _.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,$)},_.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,$)},_.prototype.complete=function(){var $,j;(j=($=this.destination)===null||$===void 0?void 0:$.complete)===null||j===void 0||j.call($)},_.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},_}(Subject),BehaviorSubject=function(a){__extends$1(_,a);function _($){var j=a.call(this)||this;return j._value=$,j}return Object.defineProperty(_.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),_.prototype._subscribe=function($){var j=a.prototype._subscribe.call(this,$);return!j.closed&&$.next(this._value),j},_.prototype.getValue=function(){var $=this,j=$.hasError,et=$.thrownError,tt=$._value;if(j)throw et;return this._throwIfClosed(),tt},_.prototype.next=function($){a.prototype.next.call(this,this._value=$)},_}(Subject),dateTimestampProvider={now:function(){return(dateTimestampProvider.delegate||Date).now()},delegate:void 0},ReplaySubject=function(a){__extends$1(_,a);function _($,j,et){$===void 0&&($=1/0),j===void 0&&(j=1/0),et===void 0&&(et=dateTimestampProvider);var tt=a.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 _.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(),a.prototype.next.call(this,$)},_.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(){yt!=null&&yt.closed||yt==null||yt.unsubscribe(),wt=null})),!Ct&&Pt(j!=null?typeof j=="number"?j:+j-it.now():et)})}function timeoutErrorFactory(a){throw new TimeoutError(a)}function map$1(a,_){return operate(function($,j){var et=0;$.subscribe(createOperatorSubscriber(j,function(tt){j.next(a.call(_,tt,et++))}))})}var isArray$2=Array.isArray;function callOrApply(a,_){return isArray$2(_)?a.apply(void 0,__spreadArray([],__read(_))):a(_)}function mapOneOrManyArgs(a){return map$1(function(_){return callOrApply(a,_)})}var isArray$1=Array.isArray,getPrototypeOf=Object.getPrototypeOf,objectProto=Object.prototype,getKeys$1=Object.keys;function argsArgArrayOrObject(a){if(a.length===1){var _=a[0];if(isArray$1(_))return{args:_,keys:null};if(isPOJO(_)){var $=getKeys$1(_);return{args:$.map(function(j){return _[j]}),keys:$}}}return{args:a,keys:null}}function isPOJO(a){return a&&typeof a=="object"&&getPrototypeOf(a)===objectProto}function createObject(a,_){return a.reduce(function($,j,et){return $[j]=_[et],$},{})}function combineLatest(){for(var a=[],_=0;_=2;return function(j){return j.pipe(identity,take(1),$?defaultIfEmpty(_):throwIfEmpty(function(){return new EmptyError}))}}function multicast(a,_){var $=isFunction$1(a)?a:function(){return a};return isFunction$1(_)?connect(_,{connector:$}):function(j){return new ConnectableObservable(j,$)}}function pluck(){for(var a=[],_=0;_0&&(ot=new SafeSubscriber({next:function(zt){return Dt.next(zt)},error:function(zt){wt=!0,Ct(),at=handleReset(Pt,et,zt),Dt.error(zt)},complete:function(){yt=!0,Ct(),at=handleReset(Pt,rt),Dt.complete()}}),innerFrom(Mt).subscribe(ot))})(st)}}function handleReset(a,_){for(var $=[],j=2;j{j.set(et,_[et])}),j}typecheckKey(_){this.keySchema&&this.keySchema.Typecheck(_)}typecheckValue(_){this.valueSchema&&this.valueSchema.Typecheck(_)}assertTypecheckValue(_){try{this.typecheckValue(_)}catch($){throw new MapTypecheckError(_,this.valueSchema,"value",$)}}assertTypecheckKey(_){try{this.typecheckKey(_)}catch($){throw new MapTypecheckError(_,this.keySchema,"key",$)}}serializeDeterministically(_){return stringify$2(_)}*keys(){for(const[_]of this.entries())yield _}*values(){for(const[,_]of this.entries())yield _}*entries(){for(const _ of this.valueMap.keys())yield[this.keyMap.get(_),this.valueMap.get(_)]}get(_){this.assertTypecheckKey(_);const $=this.serializeDeterministically(_);return this.valueMap.get($)}set(_,$){this.assertTypecheckKey(_),this.assertTypecheckValue($);const j=this.serializeDeterministically(_);this.keyMap.set(j,_),this.valueMap.set(j,$)}delete(_){this.assertTypecheckKey(_),this.keyMap.delete(this.serializeDeterministically(_)),this.valueMap.delete(this.serializeDeterministically(_))}has(_){this.assertTypecheckKey(_);const $=this.serializeDeterministically(_);return this.keyMap.has($)&&this.valueMap.has($)}clear(){this.keyMap.clear(),this.valueMap.clear()}get size(){return this.keyMap.size}forEach(_){for(const[$,j]of this.entries())_(j,$,this)}}_a$1=michelsonMapTypeSymbol;class TokenValidationError extends TaquitoError{constructor(_,$,j){super(),this.value=_,this.token=$,this.name="TokenValidationError";const et=this.token.annot(),tt=et?`[${et}] `:"";this.message=`${tt}${j}`}}class Token{constructor(_,$,j){this.val=_,this.idx=$,this.fac=j,this.createToken=this.fac}typeWithoutAnnotations(){const _=j=>{if(typeof j=="object"){if(Array.isArray(j))return j.map(rt=>_(rt));const et=j;return et.args?{prim:et.prim,args:et.args.map(tt=>_(tt))}:{prim:et.prim}}return j};return(j=>j.args?{prim:j.prim,args:j.args.map(et=>_(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(_,$){return _===$?0:_<$?-1:1}}class BigMapValidationError extends TokenValidationError{constructor(_,$,j){super(_,$,j),this.value=_,this.token=$,this.name="BigMapValidationError"}}class BigMapToken extends Token{constructor(_,$,j){super(_,$,j),this.val=_,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(_){if(!MichelsonMap.isMichelsonMap(_))throw new BigMapValidationError(_,this,`Value ${JSON.stringify(_)} is not a MichelsonMap`)}objLitToMichelsonMap(_){return _ instanceof MichelsonMap?_:typeof _=="object"?Object.keys(_).length===0?new MichelsonMap:MichelsonMap.fromLiteral(_):_}Encode(_){const $=this.objLitToMichelsonMap(_.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(_,$){const j=this.objLitToMichelsonMap(_);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(_,$){if($&&$[BigMapToken.prim])return $[BigMapToken.prim](_,this.val);if(Array.isArray(_)){const j=new MichelsonMap(this.val);return _.forEach(et=>{j.set(this.KeySchema.ToKey(et.args[0]),this.ValueSchema.Execute(et.args[1]))}),j}else{if("int"in _)return _.int;throw new BigMapValidationError(_,this,`Big map is expecting either an array (Athens) or an object with an int property (Babylon). Got ${JSON.stringify(_)}`)}}findAndReturnTokens(_,$){return BigMapToken.prim===_&&$.push(this),this.KeySchema.findAndReturnTokens(_,$),this.ValueSchema.findAndReturnTokens(_,$),$}}BigMapToken.prim="big_map";class OrValidationError extends TokenValidationError{constructor(_,$,j){super(_,$,j),this.value=_,this.token=$,this.name="OrValidationError"}}class OrToken extends ComparableToken{constructor(_,$,j){super(_,$,j),this.val=_,this.idx=$,this.fac=j}Encode(_){const $=_[_.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 _.pop(),{prim:"Left",args:[j.Encode(_)]};if(String(tt.annot())===String($)&&!(tt instanceof OrToken))return _.pop(),{prim:"Right",args:[tt.Encode(_)]};if(j instanceof OrToken){const rt=j.Encode(_);if(rt)return{prim:"Left",args:[rt]}}if(tt instanceof OrToken){const rt=tt.Encode(_);if(rt)return{prim:"Right",args:[rt]}}return null}ExtractSignature(){const _=this.createToken(this.val.args[0],this.idx);let $=1;_ instanceof OrToken&&($=Object.keys(_.ExtractSchema()).length);const j=this.createToken(this.val.args[1],this.idx+$),et=[];if(_ instanceof OrToken)et.push(..._.ExtractSignature());else for(const tt of _.ExtractSignature())et.push([_.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(_,$){this.validateJavascriptObject(_);const j=Object.keys(_)[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(_[j],$)]};if(String(rt.annot())===String(j)&&!(rt instanceof OrToken))return{prim:"Right",args:[rt.EncodeObject(_[j],$)]};if(et instanceof OrToken){const nt=et.EncodeObject(_,$);if(nt)return{prim:"Left",args:[nt]}}if(rt instanceof OrToken){const nt=rt.EncodeObject(_,$);if(nt)return{prim:"Right",args:[nt]}}return null}validateJavascriptObject(_){if(typeof _!="object"||Array.isArray(_)||_===null||Object.keys(_).length!==1)throw new OrValidationError(_,this,`EncodeObject expects an object with a single key but got: ${JSON.stringify(_)}`)}Execute(_,$){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(_.prim==="Right")return tt instanceof OrToken?tt.Execute(_.args[0],$):{[tt.annot()]:tt.Execute(_.args[0],$)};if(_.prim==="Left")return j instanceof OrToken?j.Execute(_.args[0],$):{[j.annot()]:j.Execute(_.args[0],$)};throw new OrValidationError(_,this,`Was expecting Left or Right prim but got: ${JSON.stringify(_.prim)}`)}traversal(_,$,j){const et=this.createToken(this.val.args[0],this.idx);let tt=1,rt;et instanceof OrToken?(rt=_(et),tt=Object.keys(et.ExtractSchema()).length):rt={[et.annot()]:_(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(_=>_.ExtractSchema(),_=>_.ExtractSchema(),(_,$)=>Object.assign(Object.assign({},_),$))}generateSchema(){return{__michelsonType:OrToken.prim,schema:this.traversal(_=>_ instanceof OrToken?_.generateSchema().schema:_.generateSchema(),_=>_ instanceof OrToken?_.generateSchema().schema:_.generateSchema(),(_,$)=>Object.assign(Object.assign({},_),$))}}findToken(_){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(_)&&!($ instanceof OrToken)&&$ instanceof ComparableToken)return $;if(String(et.annot())===String(_)&&!(et instanceof OrToken)&&et instanceof ComparableToken)return et;if($ instanceof OrToken){const tt=$.findToken(_);if(tt)return tt}if(et instanceof OrToken){const tt=et.findToken(_);if(tt)return tt}return null}compare(_,$){const j=Object.keys(_)[0],et=Object.keys($)[0];if(j===et){const tt=this.findToken(j);if(tt instanceof ComparableToken)return tt.compare(_[j],$[j])}else{const tt=JSON.stringify(this.EncodeObject(_)),rt=JSON.stringify(this.EncodeObject($));return ttj.findAndReturnTokens(_,$),j=>j.findAndReturnTokens(_,$),(j,et)=>Object.assign(Object.assign({},j),et)),$}}OrToken.prim="or";class TokenArgumentValidationError extends TaquitoError{constructor(_){super(_),this.message=_,this.name="TokenArgumentValidationError"}}class TokenComparisonError extends TaquitoError{constructor(_,$){super(),this.val1=_,this.val2=$,this.name="TokenComparisonError",this.message=`Tokens ${JSON.stringify(_)} and ${JSON.stringify($)} are not comparable`}}function collapse$1(a,_=PairToken.prim){if(Array.isArray(a))return collapse$1({prim:_,args:a},_);if(a.args===void 0)throw new TokenArgumentValidationError(`The value ${JSON.stringify(a)} is an invalid PairToken with no arguments, a pair must have two or more arguments.`);return a.args.length>2?[a.args[0],{prim:_,args:a.args.slice(1)}]:[a.args[0],a.args[1]]}class PairToken extends ComparableToken{constructor(_,$,j){super(Array.isArray(_)?{prim:PairToken.prim,args:_}:_.prim?_:{prim:PairToken.prim,args:_},$,j)}args(){return collapse$1(this.val)}tokens(){let _=0;return this.args().map($=>{const j=this.createToken($,this.idx+_);return j instanceof PairToken?_+=Object.keys(j.ExtractSchema()).length:_++,j})}Encode(_){return{prim:"Pair",args:this.tokens().map($=>$.Encode(_))}}ExtractSignature(){const _=this.args(),$=this.createToken(_[0],this.idx);let j=1;$ instanceof OrToken&&(j=Object.keys($.ExtractSchema()).length);const et=this.createToken(_[1],this.idx+j),tt=[];for(const rt of $.ExtractSignature())for(const nt of et.ExtractSignature())tt.push([...rt,...nt]);return tt}ToBigMapKey(_){return{key:this.EncodeObject(_),type:this.typeWithoutAnnotations()}}ToKey(_){return this.Execute(_)}EncodeObject(_,$){const[j,et]=this.tokens();let tt;j instanceof PairToken&&!j.hasAnnotations()?tt=_:tt=_[j.annot()];let rt;return et instanceof PairToken&&!et.hasAnnotations()?rt=_:rt=_[et.annot()],{prim:"Pair",args:[j.EncodeObject(tt,$),et.EncodeObject(rt,$)]}}traversal(_,$){const j=this.args(),et=this.createToken(j[0],this.idx);let tt=1,rt;et instanceof PairToken&&!et.hasAnnotations()?(rt=_(et),et instanceof PairToken&&(tt=Object.keys(et.ExtractSchema()).length)):rt={[et.annot()]:_(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(_,$){const j=collapse$1(_,"Pair");return this.traversal(et=>et.Execute(j[0],$),et=>et.Execute(j[1],$))}ExtractSchema(){return this.traversal(_=>_.ExtractSchema(),_=>_.ExtractSchema())}generateSchema(){return{__michelsonType:PairToken.prim,schema:this.traversal(_=>_ instanceof PairToken&&!_.hasAnnotations()?_.generateSchema().schema:_.generateSchema(),_=>_ instanceof PairToken&&!_.hasAnnotations()?_.generateSchema().schema:_.generateSchema())}}compare(_,$){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,_),tt(j,$));return rt===0?et.compare(tt(et,_),tt(et,$)):rt}throw new TokenComparisonError(_,$)}findAndReturnTokens(_,$){return PairToken.prim===_&&$.push(this),this.tokens().map(j=>j.findAndReturnTokens(_,$)),$}}PairToken.prim="pair";class NatValidationError extends TokenValidationError{constructor(_,$,j){super(_,$,j),this.value=_,this.token=$,this.name="NatValidationError"}}class NatToken extends ComparableToken{constructor(_,$,j){super(_,$,j),this.val=_,this.idx=$,this.fac=j}Execute(_){return new BigNumber(_[Object.keys(_)[0]])}Encode(_){const $=_.pop();return this.validate($),{int:new BigNumber($).toFixed()}}validate(_){const $=new BigNumber(_);if($.isNaN())throw new NatValidationError(_,this,`Value is not a number: ${JSON.stringify(_)}`);if($.isNegative())throw new NatValidationError(_,this,`Value cannot be negative: ${JSON.stringify(_)}`)}EncodeObject(_,$){return this.validate(_),$&&$[NatToken.prim]?$[NatToken.prim](_):{int:new BigNumber(_).toFixed()}}ExtractSchema(){return NatToken.prim}generateSchema(){return{__michelsonType:NatToken.prim,schema:NatToken.prim}}ToBigMapKey(_){return{key:{int:String(_)},type:{prim:NatToken.prim}}}ToKey({int:_}){return new BigNumber(_)}compare(_,$){const j=Number(_),et=Number($);return j===et?0:jrt.startsWith("tz"),et=j(_),tt=j($);return et&&!tt?-1:tt&&!et?1:super.compare(_,$)}findAndReturnTokens(_,$){return AddressToken.prim===_&&$.push(this),$}}AddressToken.prim="address";class MapValidationError extends TokenValidationError{constructor(_,$,j){super(_,$,j),this.value=_,this.token=$,this.name="MapValidationError"}}class MapToken extends Token{constructor(_,$,j){super(_,$,j),this.val=_,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(_){if(!MichelsonMap.isMichelsonMap(_))throw new MapValidationError(_,this,`Value ${JSON.stringify(_)} is not a valid MichelsonMap`)}Execute(_,$){const j=new MichelsonMap(this.val);return _.forEach(et=>{j.set(this.KeySchema.ToKey(et.args[0]),this.ValueSchema.Execute(et.args[1],$))}),j}objLitToMichelsonMap(_){return _ instanceof MichelsonMap?_:typeof _=="object"?Object.keys(_).length===0?new MichelsonMap:MichelsonMap.fromLiteral(_):_}Encode(_){const $=this.objLitToMichelsonMap(_.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(_,$){const j=this.objLitToMichelsonMap(_);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(_,$){return MapToken.prim===_&&$.push(this),this.KeySchema.findAndReturnTokens(_,$),this.ValueSchema.findAndReturnTokens(_,$),$}}MapToken.prim="map";class BoolToken extends ComparableToken{constructor(_,$,j){super(_,$,j),this.val=_,this.idx=$,this.fac=j}Execute(_){return String(_.prim).toLowerCase()==="true"}Encode(_){return{prim:_.pop()?"True":"False"}}EncodeObject(_,$){return $&&$[BoolToken.prim]?$[BoolToken.prim](_):{prim:_?"True":"False"}}ExtractSchema(){return BoolToken.prim}generateSchema(){return{__michelsonType:BoolToken.prim,schema:BoolToken.prim}}ToBigMapKey(_){return{key:this.EncodeObject(_),type:{prim:BoolToken.prim}}}ToKey(_){return this.EncodeObject(_)}compare(_,$){return _&&$||!_&&!$?0:_?1:-1}findAndReturnTokens(_,$){return BoolToken.prim===_&&$.push(this),$}}BoolToken.prim="bool";class ContractValidationError extends TokenValidationError{constructor(_,$,j){super(_,$,j),this.value=_,this.token=$,this.name="ContractValidationError"}}class ContractToken extends Token{constructor(_,$,j){super(_,$,j),this.val=_,this.idx=$,this.fac=j}validate(_){if(validateAddress(_)!==ValidationResult.VALID)throw new ContractValidationError(_,this,`Value ${JSON.stringify(_)} is not a valid contract address.`);return null}Execute(_){if(_.string)return _.string;if(!_.bytes)throw new ContractValidationError(_,this,`Value ${JSON.stringify(_)} is not a valid contract address. must contain bytes or string.`);return encodeAddress(_.bytes)}Encode(_){const $=_.pop();return this.validate($),{string:$}}EncodeObject(_,$){return this.validate(_),$&&$[ContractToken.prim]?$[ContractToken.prim](_):{string:_}}ExtractSchema(){return ContractToken.prim}generateSchema(){const _=this.createToken(this.val.args[0],0);return{__michelsonType:ContractToken.prim,schema:{parameter:this.val.args[0]?_.generateSchema():{}}}}findAndReturnTokens(_,$){return ContractToken.prim===_&&$.push(this),$}}ContractToken.prim="contract";class ListValidationError extends TokenValidationError{constructor(_,$,j){super(_,$,j),this.value=_,this.token=$,this.name="ListValidationError"}}class ListToken extends Token{constructor(_,$,j){super(_,$,j),this.val=_,this.idx=$,this.fac=j}get valueSchema(){return this.createToken(this.val.args[0],this.idx)}validate(_){if(!Array.isArray(_))throw new ListValidationError(_,this,`Value ${JSON.stringify(_)} is not a valid array`)}Encode(_){const $=_.pop();this.validate($);const j=this.createToken(this.val.args[0],0);return $.reduce((et,tt)=>[...et,j.EncodeObject(tt)],[])}Execute(_,$){const j=this.createToken(this.val.args[0],0);return this.validate(_),_.reduce((et,tt)=>[...et,j.Execute(tt,$)],[])}EncodeObject(_,$){const j=this.createToken(this.val.args[0],0);return this.validate(_),$&&$[ListToken.prim]?$[ListToken.prim](_):_.reduce((et,tt)=>[...et,j.EncodeObject(tt)],[])}ExtractSchema(){return{[ListToken.prim]:this.valueSchema.ExtractSchema()}}generateSchema(){return{__michelsonType:ListToken.prim,schema:this.valueSchema.generateSchema()}}findAndReturnTokens(_,$){return ListToken.prim===_&&$.push(this),this.createToken(this.val.args[0],this.idx).findAndReturnTokens(_,$),$}}ListToken.prim="list";class MutezValidationError extends TokenValidationError{constructor(_,$,j){super(_,$,j),this.value=_,this.token=$,this.name="MutezValidationError"}}class MutezToken extends ComparableToken{constructor(_,$,j){super(_,$,j),this.val=_,this.idx=$,this.fac=j}Execute(_){return new BigNumber(_[Object.keys(_)[0]])}ExtractSchema(){return MutezToken.prim}generateSchema(){return{__michelsonType:MutezToken.prim,schema:MutezToken.prim}}validate(_){if(new BigNumber(_).isNaN())throw new MutezValidationError(_,this,`Value is not a number: ${_}`)}Encode(_){const $=_.pop();return this.validate($),{int:String($).toString()}}EncodeObject(_,$){return this.validate(_),$&&$[MutezToken.prim]?$[MutezToken.prim](_):{int:String(_).toString()}}ToBigMapKey(_){return{key:{int:String(_)},type:{prim:MutezToken.prim}}}ToKey({int:_}){return _}compare(_,$){const j=Number(_),et=Number($);return j===et?0:jthis.KeySchema.compare(j,et)).reduce((j,et)=>[...j,this.KeySchema.EncodeObject(et)],[])}Execute(_,$){return _.reduce((j,et)=>[...j,this.KeySchema.Execute(et,$)],[])}EncodeObject(_,$){return this.validate(_),$&&$[SetToken.prim]?$[SetToken.prim](_):_.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(_,$){return SetToken.prim===_&&$.push(this),this.KeySchema.findAndReturnTokens(_,$),$}}SetToken.prim="set";class ChainIDValidationError extends TokenValidationError{constructor(_,$,j){super(_,$,j),this.value=_,this.token=$,this.name="ChainIDValidationError"}}class ChainIDToken extends ComparableToken{constructor(_,$,j){super(_,$,j),this.val=_,this.idx=$,this.fac=j}validate(_){if(validateChain(_)!==ValidationResult.VALID)throw new ChainIDValidationError(_,this,`Value ${JSON.stringify(_)} is not a valid ChainID`)}Execute(_){return _[Object.keys(_)[0]]}ExtractSchema(){return ChainIDToken.prim}generateSchema(){return{__michelsonType:ChainIDToken.prim,schema:ChainIDToken.prim}}Encode(_){const $=_.pop();return this.validate($),{string:$}}EncodeObject(_,$){return this.validate(_),$&&$[ChainIDToken.prim]?$[ChainIDToken.prim](_):{string:_}}ToKey({string:_}){return _}ToBigMapKey(_){return{key:{string:_},type:{prim:ChainIDToken.prim}}}findAndReturnTokens(_,$){return ChainIDToken.prim===_&&$.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(_,$,j){super(_,$,j),this.val=_,this.idx=$,this.fac=j}get valueToken(){return this.createToken(this.val.args[0],this.idx)}Encode(_){throw new EncodeTicketError}EncodeObject(_,$){if($&&$[TicketToken.prim])return $[TicketToken.prim](_,this.val);throw new EncodeTicketError}Execute(_,$){if($&&$[TicketToken.prim])return $[TicketToken.prim](_,this.val);const j=this.createToken(ticketerType$1,this.idx),et=this.valueToken,tt=this.createToken(amountType$1,this.idx);return _.args[2]===void 0&&_.args[1].args!==void 0?{ticketer:j.Execute(_.args[0],$),value:et.Execute(_.args[1].args[0],$),amount:tt.Execute(_.args[1].args[1],$)}:{ticketer:j.Execute(_.args[0],$),value:et.Execute(_.args[1],$),amount:tt.Execute(_.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(_,$){return TicketToken.prim===_&&$.push(this),this.valueToken.findAndReturnTokens(_,$),$}}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(_,$,j){super(_,$,j),this.val=_,this.idx=$,this.fac=j}get valueToken(){return this.createToken(this.val.args[0],this.idx)}Encode(_){throw new EncodeTicketDeprecatedError}EncodeObject(_,$){if($&&$[TicketDeprecatedToken.prim])return $[TicketDeprecatedToken.prim](_,this.val);throw new EncodeTicketDeprecatedError}Execute(_,$){if($&&$[TicketDeprecatedToken.prim])return $[TicketDeprecatedToken.prim](_,this.val);const j=this.createToken(ticketerType,this.idx),et=this.valueToken,tt=this.createToken(amountType,this.idx);return _.args[2]===void 0&&_.args[1].args!==void 0?{ticketer:j.Execute(_.args[0],$),value:et.Execute(_.args[1].args[0],$),amount:tt.Execute(_.args[1].args[1],$)}:{ticketer:j.Execute(_.args[0],$),value:et.Execute(_.args[1],$),amount:tt.Execute(_.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(_,$){return TicketDeprecatedToken.prim===_&&$.push(this),this.valueToken.findAndReturnTokens(_,$),$}}TicketDeprecatedToken.prim="ticket_deprecated";class NeverTokenError extends TokenValidationError{constructor(_,$,j){super(_,$,j),this.value=_,this.token=$,this.name="NeverTokenError"}}class NeverToken extends Token{constructor(_,$,j){super(_,$,j),this.val=_,this.idx=$,this.fac=j}Encode(_){const $=_.pop();throw new NeverTokenError($,this,`Assigning a value to the type never is forbidden. Trying to assign ${JSON.stringify($)}.`)}EncodeObject(_,$){if($&&$[NeverToken.prim])return $[NeverToken.prim](_);throw new NeverTokenError(_,this,`Assigning a value to the type never is forbidden. Trying to assign ${JSON.stringify(_)}.`)}Execute(_){throw new NeverTokenError(_,this,`There is no literal value for the type never. Trying to execute ${JSON.stringify(_)}.`)}ExtractSchema(){return NeverToken.prim}generateSchema(){return{__michelsonType:NeverToken.prim,schema:NeverToken.prim}}findAndReturnTokens(_,$){return NeverToken.prim===_&&$.push(this),$}}NeverToken.prim="never";class SaplingStateValidationError extends TokenValidationError{constructor(_,$,j){super(_,$,j),this.value=_,this.token=$,this.name="SaplingStateValidationError"}}class SaplingStateToken extends Token{constructor(_,$,j){super(_,$,j),this.val=_,this.idx=$,this.fac=j}isValid(_){return typeof _=="object"&&Object.keys(_).length===0}Execute(_,$){if($&&$[SaplingStateToken.prim])return $[SaplingStateToken.prim](_,this.val);if("int"in _)return _.int;throw new SaplingStateValidationError(_,this,`Sapling state is expecting an object with an int property. Got ${JSON.stringify(_)}`)}Encode(_){const $=_.pop();if(this.isValid($))return[];throw new SaplingStateValidationError($,this,`Invalid sapling_state. Received: ${JSON.stringify($)} while expecting: {}`)}EncodeObject(_,$){if($&&$[SaplingStateToken.prim])return $[SaplingStateToken.prim](_);if(this.isValid(_))return[];throw new SaplingStateValidationError(_,this,`Invalid sapling_state. Received: ${JSON.stringify(_)} 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(_,$){return SaplingStateToken.prim===_&&$.push(this),$}}SaplingStateToken.prim="sapling_state";class SaplingTransactionValidationError extends TokenValidationError{constructor(_,$,j){super(_,$,j),this.value=_,this.token=$,this.name="SaplingTransactionValidationError"}}class SaplingTransactionToken extends Token{constructor(_,$,j){super(_,$,j),this.val=_,this.idx=$,this.fac=j}Execute(_){throw new SaplingTransactionValidationError(_,this,`There is no literal value for the sapling_transaction type. Got: ${JSON.stringify(_)}.`)}validateBytes(_){const $=/^(0x|0X)?([0-9a-fA-F]*$)/.exec(_);if($&&$[2].length%2===0)return $[2];throw new SaplingTransactionValidationError(_,this,`Invalid bytes: ${JSON.stringify(_)}`)}convertUint8ArrayToHexString(_){return _.constructor===Uint8Array?Buffer$g.from(_).toString("hex"):_}Encode(_){let $=_.pop();return $=this.validateBytes(this.convertUint8ArrayToHexString($)),{bytes:String($).toString()}}EncodeObject(_,$){return _=this.validateBytes(this.convertUint8ArrayToHexString(_)),$&&$[SaplingTransactionToken.prim]?$[SaplingTransactionToken.prim](_):{bytes:String(_).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(_,$){return SaplingTransactionToken.prim===_&&$.push(this),$}}SaplingTransactionToken.prim="sapling_transaction";class SaplingTransactionDeprecatedValidationError extends TokenValidationError{constructor(_,$,j){super(_,$,j),this.value=_,this.token=$,this.name="SaplingTransactionDeprecatedValidationError"}}class SaplingTransactionDeprecatedToken extends Token{constructor(_,$,j){super(_,$,j),this.val=_,this.idx=$,this.fac=j}Execute(_){throw new SaplingTransactionDeprecatedValidationError(_,this,`There is no literal value for the sapling_transaction_deprecated type. Got: ${JSON.stringify(_)}.`)}validateBytes(_){const $=/^(0x|0X)?([0-9a-fA-F]*$)/.exec(_);if($&&$[2].length%2===0)return $[2];throw new SaplingTransactionDeprecatedValidationError(_,this,`Invalid bytes: ${JSON.stringify(_)}`)}convertUint8ArrayToHexString(_){return _.constructor===Uint8Array?Buffer$g.from(_).toString("hex"):_}Encode(_){let $=_.pop();return $=this.validateBytes(this.convertUint8ArrayToHexString($)),{bytes:String($).toString()}}EncodeObject(_,$){return _=this.validateBytes(this.convertUint8ArrayToHexString(_)),$&&$[SaplingTransactionDeprecatedToken.prim]?$[SaplingTransactionDeprecatedToken.prim](_):{bytes:String(_).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(_,$){return SaplingTransactionDeprecatedToken.prim===_&&$.push(this),$}}SaplingTransactionDeprecatedToken.prim="sapling_transaction_deprecated";class Bls12381frValidationError extends TokenValidationError{constructor(_,$,j){super(_,$,j),this.value=_,this.token=$,this.name="Bls12381frValidationError"}}class Bls12381frToken extends Token{constructor(_,$,j){super(_,$,j),this.val=_,this.idx=$,this.fac=j}validate(_){if(!(/^[0-9a-fA-F]*$/.test(_)&&_.length%2===0))throw new Bls12381frValidationError(_,this,`Invalid bytes: ${JSON.stringify(_)}`)}convertUint8ArrayToHexString(_){return _.constructor===Uint8Array?Buffer$g.from(_).toString("hex"):_}Encode(_){let $=_.pop();return typeof $=="number"?{int:$.toString()}:($=this.convertUint8ArrayToHexString($),this.validate($),{bytes:$})}EncodeObject(_,$){return $&&$[Bls12381frToken.prim]?$[Bls12381frToken.prim](_):typeof _=="number"?{int:_.toString()}:(_=this.convertUint8ArrayToHexString(_),this.validate(_),{bytes:_})}Execute(_){return _.bytes}ExtractSchema(){return Bls12381frToken.prim}generateSchema(){return{__michelsonType:Bls12381frToken.prim,schema:Bls12381frToken.prim}}findAndReturnTokens(_,$){return Bls12381frToken.prim===_&&$.push(this),$}}Bls12381frToken.prim="bls12_381_fr";class Bls12381g1ValidationError extends TokenValidationError{constructor(_,$,j){super(_,$,j),this.value=_,this.token=$,this.name="Bls12381g1ValidationError"}}class Bls12381g1Token extends Token{constructor(_,$,j){super(_,$,j),this.val=_,this.idx=$,this.fac=j}validate(_){if(!(/^[0-9a-fA-F]*$/.test(_)&&_.length%2===0))throw new Bls12381g1ValidationError(_,this,`Invalid bytes: ${JSON.stringify(_)}`)}convertUint8ArrayToHexString(_){return _.constructor===Uint8Array?Buffer$g.from(_).toString("hex"):_}Encode(_){let $=_.pop();return $=this.convertUint8ArrayToHexString($),this.validate($),{bytes:$}}EncodeObject(_,$){return _=this.convertUint8ArrayToHexString(_),this.validate(_),$&&$[Bls12381g1Token.prim]?$[Bls12381g1Token.prim](_):{bytes:_}}Execute(_){return _.bytes}ExtractSchema(){return Bls12381g1Token.prim}generateSchema(){return{__michelsonType:Bls12381g1Token.prim,schema:Bls12381g1Token.prim}}findAndReturnTokens(_,$){return Bls12381g1Token.prim===_&&$.push(this),$}}Bls12381g1Token.prim="bls12_381_g1";class Bls12381g2ValidationError extends TokenValidationError{constructor(_,$,j){super(_,$,j),this.value=_,this.token=$,this.name="Bls12381g2ValidationError"}}class Bls12381g2Token extends Token{constructor(_,$,j){super(_,$,j),this.val=_,this.idx=$,this.fac=j}validate(_){if(!(/^[0-9a-fA-F]*$/.test(_)&&_.length%2===0))throw new Bls12381g2ValidationError(_,this,`Invalid bytes: ${JSON.stringify(_)}`)}convertUint8ArrayToHexString(_){return _.constructor===Uint8Array?Buffer$g.from(_).toString("hex"):_}Encode(_){let $=_.pop();return $=this.convertUint8ArrayToHexString($),this.validate($),{bytes:$}}EncodeObject(_,$){return _=this.convertUint8ArrayToHexString(_),this.validate(_),$&&$[Bls12381g2Token.prim]?$[Bls12381g2Token.prim](_):{bytes:_}}Execute(_){return _.bytes}ExtractSchema(){return Bls12381g2Token.prim}generateSchema(){return{__michelsonType:Bls12381g2Token.prim,schema:Bls12381g2Token.prim}}findAndReturnTokens(_,$){return Bls12381g2Token.prim===_&&$.push(this),$}}Bls12381g2Token.prim="bls12_381_g2";class ChestValidationError extends TokenValidationError{constructor(_,$,j){super(_,$,j),this.value=_,this.token=$,this.name="ChestValidationError"}}class ChestToken extends Token{constructor(_,$,j){super(_,$,j),this.val=_,this.idx=$,this.fac=j}validate(_){if(!(/^[0-9a-fA-F]*$/.test(_)&&_.length%2==0))throw new ChestValidationError(_,this,`Invalid bytes: ${JSON.stringify(_)}`)}convertUint8ArrayToHexString(_){return _.constructor===Uint8Array?Buffer$g.from(_).toString("hex"):_}Encode(_){let $=_.pop();return $=this.convertUint8ArrayToHexString($),this.validate($),{bytes:$}}EncodeObject(_,$){return _=this.convertUint8ArrayToHexString(_),this.validate(_),$&&$[ChestToken.prim]?$[ChestToken.prim](_):{bytes:_}}Execute(_){return _.bytes}ExtractSchema(){return ChestToken.prim}generateSchema(){return{__michelsonType:ChestToken.prim,schema:ChestToken.prim}}findAndReturnTokens(_,$){return ChestToken.prim===_&&$.push(this),$}}ChestToken.prim="chest";class ChestKeyValidationError extends TokenValidationError{constructor(_,$,j){super(_,$,j),this.value=_,this.token=$,this.name="ChestKeyValidationError"}}class ChestKeyToken extends Token{constructor(_,$,j){super(_,$,j),this.val=_,this.idx=$,this.fac=j}validate(_){if(!(/^[0-9a-fA-F]*$/.test(_)&&_.length%2===0))throw new ChestKeyValidationError(_,this,`Invalid bytes: ${JSON.stringify(_)}`)}convertUint8ArrayToHexString(_){return _.constructor===Uint8Array?Buffer$g.from(_).toString("hex"):_}Encode(_){let $=_.pop();return $=this.convertUint8ArrayToHexString($),this.validate($),{bytes:$}}EncodeObject(_,$){return _=this.convertUint8ArrayToHexString(_),this.validate(_),$&&$[ChestKeyToken.prim]?$[ChestKeyToken.prim](_):{bytes:_}}Execute(_){return _.bytes}ExtractSchema(){return ChestKeyToken.prim}generateSchema(){return{__michelsonType:ChestKeyToken.prim,schema:ChestKeyToken.prim}}findAndReturnTokens(_,$){return ChestKeyToken.prim===_&&$.push(this),$}}ChestKeyToken.prim="chest_key";class GlobalConstantEncodingError extends TokenValidationError{constructor(_,$,j){super(_,$,j),this.value=_,this.token=$,this.name="GlobalConstantEncodingError"}}class GlobalConstantDecodingError extends TokenValidationError{constructor(_,$,j){super(_,$,j),this.value=_,this.token=$,this.name="GlobalConstantDecodingError"}}class GlobalConstantToken extends Token{constructor(_,$,j){super(_,$,j),this.val=_,this.idx=$,this.fac=j}Execute(_,$){if($&&$[GlobalConstantToken.prim])return $[GlobalConstantToken.prim](_,this.val);throw new GlobalConstantDecodingError(_,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(_){throw new GlobalConstantEncodingError(_,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(_,$){if($&&$[GlobalConstantToken.prim])return $[GlobalConstantToken.prim](_);throw new GlobalConstantEncodingError(_,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(_,$){return GlobalConstantToken.prim===_&&$.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(_,$){super(_),this.message=_,this.data=$,this.name="Invalid token error"}}function createToken(a,_){if(Array.isArray(a))return new PairToken(a,_,createToken);const $=tokens.find(j=>j.prim===a.prim);if(!$)throw new InvalidTokenError(`Malformed data: ${JSON.stringify(a)}. Expected a value with a valid prim property`,a);return new $(a,_,createToken)}class ParameterEncodingError extends InvalidViewParameterError{constructor(_,$,j,et){super(_,$,j,et),this.viewName=_,this.sigs=$,this.args=j,this.cause=et,this.name="ParameterEncodingError",this.message=`Could not encode parameter ${JSON.stringify(j)} received for name "${_}" expecting one of the following signatures ${JSON.stringify($)}`}}class InvalidScriptError extends TaquitoError{constructor(_,$){super(),this.script=_,this.reason=$,this.name="InvalidScriptError";let j="Invalid on-chain view found in the following script.";$&&(j+=` Reason: ${$}.`),j+=`Script: ${JSON.stringify(_)}`,this.message=j}}class InvalidRpcResponseError extends TaquitoError{constructor(_,$){super(),this.script=_,this.reason=$,this.name="InvalidRpcResponseError";let j="Invalid RPC response passed as argument(s).";$&&(j+=` Reason: ${$}.`),j+=` Received: ${JSON.stringify(_)}`,this.message=j}}class InvalidBigMapSchemaError extends TaquitoError{constructor(_){super(_),this.message=_,this.name="InvalidBigMapSchemaError"}}class InvalidBigMapDiffError extends TaquitoError{constructor(_,$){super(_),this.message=_,this.value=$,this.name="InvalidBigMapDiffError"}}class BigMapEncodingError extends TaquitoError{constructor(_,$,j,et){super(),this.details=$,this.schema=j,this.value=et,this.name="BigMapEncodingError",this.message=`Unable to encode the big map ${_}. Schema is: ${JSON.stringify(j)}. The ${_} is: ${JSON.stringify(et)}. Error details: ${$}`}}class StorageEncodingError extends TaquitoError{constructor(_,$,j,et,tt){super(),this.details=$,this.schema=j,this.value=et,this.semantics=tt,this.name="StorageEncodingError",this.message=`Unable to encode ${_}. 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(_){super(_),this.message=_,this.name="MissingArgumentError"}}var _a;const schemaTypeSymbol=Symbol.for("taquito-schema-type-symbol");function collapse(a,_=PairToken.prim){var $,j;if(Array.isArray(a))return collapse({prim:_,args:a},_);const et=a;return et.prim===_&&et.args&&et.args.length>2?Object.assign(Object.assign({},et),{args:[($=et.args)===null||$===void 0?void 0:$[0],{prim:_,args:(j=et.args)===null||j===void 0?void 0:j.slice(1)}]}):et}function deepEqual(a,_){if(a===void 0||_===void 0)return a===_;const $=collapse(a),j=collapse(_);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(_){return _&&_[schemaTypeSymbol]===!0}static fromRPCResponse(_){if(!_)throw new InvalidRpcResponseError(_,"the RPC response is empty");if(!_.script)throw new InvalidRpcResponseError(_,"the RPC response has no script");if(!Array.isArray(_.script.code))throw new InvalidRpcResponseError(_,"The response.script.code should be an array");let $=_.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(_,'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(_){return"prim"in _&&Array.isArray(_.args)}constructor(_){if(this.val=_,this[_a]=!0,this.root=createToken(_,0),this.root instanceof BigMapToken)this.bigMap=this.root;else if(this.isExpressionExtended(_)&&_.prim==="pair"){const $=_.args[0];this.isExpressionExtended($)&&$.prim==="big_map"&&(this.bigMap=new BigMapToken($,0,createToken))}}removeTopLevelAnnotation(_){return(this.root instanceof PairToken||this.root instanceof OrToken)&&this.root.hasAnnotations()&&typeof _=="object"&&Object.keys(_).length===1?_[Object.keys(_)[0]]:_}Execute(_,$){const j=this.root.Execute(_,$);return this.removeTopLevelAnnotation(j)}Typecheck(_){this.root instanceof BigMapToken&&Number.isInteger(Number(_))||this.root instanceof TicketToken&&_.ticketer&&_.value&&_.amount||this.root instanceof TicketDeprecatedToken&&_.ticketer&&_.value&&_.amount||this.root instanceof MapToken&&this.root.ValueSchema instanceof BigMapToken||this.root.EncodeObject(_)}ExecuteOnBigMapDiff(_,$){if(!this.bigMap)throw new InvalidBigMapSchemaError("Big map schema is undefined");if(!Array.isArray(_))throw new InvalidBigMapDiffError(`Big map diff must be an array, got: ${JSON.stringify(_)}`,_);const j=_.map(({key:et,value:tt})=>({args:[et,tt]}));return this.bigMap.Execute(j,$)}ExecuteOnBigMapValue(_,$){if(!this.bigMap)throw new InvalidBigMapSchemaError("Big map schema is undefined");return this.bigMap.ValueSchema.Execute(_,$)}EncodeBigMapKey(_){if(!this.bigMap)throw new InvalidBigMapSchemaError("Big map schema is undefined");try{return this.bigMap.KeySchema.ToBigMapKey(_)}catch($){throw new BigMapEncodingError("key",$,this.bigMap.KeySchema,_)}}Encode(_,$){try{return this.root.EncodeObject(_,$)}catch(j){throw j instanceof TokenValidationError?j:new StorageEncodingError("storage object",j,this.root,_,$)}}ExtractSchema(){return this.removeTopLevelAnnotation(this.root.ExtractSchema())}generateSchema(){return this.removeTopLevelAnnotation(this.root.generateSchema())}ComputeState(_,$){if(!this.bigMap)throw new InvalidBigMapSchemaError("Big map schema is undefined");const j=_.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(_,$){return this.findValue(this.root.val,_,$)}findValue(_,$,j){if(deepEqual(j,_))return $;if(Array.isArray(_)||_.prim==="pair"){const et=collapse(_),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(_){const $=[];return this.root.findAndReturnTokens(_,$)}}_a=schemaTypeSymbol;class ParameterSchema{static fromRPCResponse(_){if(!_)throw new InvalidRpcResponseError(_,"the RPC response is empty");if(!_.script)throw new InvalidRpcResponseError(_,"the RPC response has no script");if(!Array.isArray(_.script.code))throw new InvalidRpcResponseError(_,"The response.script.code should be an array");const $=_.script.code.find(j=>"prim"in j&&j.prim==="parameter");if(!$)throw new InvalidRpcResponseError(_,'The response.script.code should have an element of type {prim: "parameter"}');if(!Array.isArray($.args))throw new InvalidRpcResponseError(_,'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(_){this.root=createToken(_,0)}Execute(_,$){return this.root.Execute(_,$)}Encode(..._){try{return this.root.Encode(_.reverse())}catch($){throw $ instanceof TokenValidationError?$:new ParameterEncodingError("Unable to encode parameter",this.root,_,$)}}EncodeObject(_,$){try{return this.root.EncodeObject(_,$)}catch(j){throw j instanceof TokenValidationError?j:new ParameterEncodingError("Unable to encode parameter object",this.root,_,j)}}ExtractSchema(){return this.root.ExtractSchema()}generateSchema(){return this.root.generateSchema()}ExtractSignatures(){return this.root.ExtractSignature()}}class ViewSchema{static fromRPCResponse(_){const $=[],j=_&&_.script&&Array.isArray(_.script.code)&&_.script.code.filter(et=>et.prim==="view");return j&&j.forEach(et=>{$.push(new ViewSchema(et.args))}),$}constructor(_){if(!_)throw new InvalidScriptError(_,"the args are not defined");if(_.length!==4)throw new InvalidScriptError(_,"there should be exactly 4 arguments");if(!("string"in _[0])||!_[0].string)throw new InvalidScriptError(_,"The first argument should be a string, representing the view name. It should be in the form: { string: 'viewName' }");this.viewName=_[0].string,this.viewArgsType=_[1],this.viewReturnType=_[2],this.instructions=_[3],this.rootArgsType=createToken(this.viewArgsType,0),this.rootReturnType=createToken(this.viewReturnType,0)}encodeViewArgs(_){try{return this.rootArgsType.EncodeObject(_)}catch($){throw new ParameterEncodingError(this.viewName,void 0,_,$)}}decodeViewResult(_,$){return this.rootReturnType.Execute(_,$)}extractArgsSchema(){return this.rootArgsType.ExtractSchema()}extractResultSchema(){return this.rootReturnType.ExtractSchema()}}class EventSchema{constructor(_,$){this.tag=_,this.type=$}static fromMichelineValue(_){var $,j;return new EventSchema(($=_.annots)===null||$===void 0?void 0:$[0],(j=_.args)===null||j===void 0?void 0:j[0])}static fromRPCResponse(_){const $=[];return _.script.code.forEach(j=>{!("prim"in j)||j.prim!=="code"||!("args"in j)||!j.args||$.push(...EventSchema.extractEventsRecursively(j.args))}),EventSchema.removeDuplicates($)}static removeDuplicates(_){const $=[];return _.forEach(j=>{$.findIndex(tt=>tt.tag===j.tag&&deepEqual(tt.type,j.type))===-1&&$.push(j)}),$}static extractEventsRecursively(_){return Array.isArray(_)?_.flatMap($=>EventSchema.extractEventsRecursively($)):"prim"in _?_.prim==="EMIT"?[EventSchema.fromMichelineValue(_)]:!("args"in _)||!_.args?[]:_.args.flatMap($=>EventSchema.extractEventsRecursively($)):[]}}const UnitValue=Symbol(),sourceReference=Symbol("source_reference");class ScanError extends TaquitoError{constructor(_,$,j){super(),this.src=_,this.idx=$,this.message=j,this.name="ScanError"}}var Literal;(function(a){a[a.Comment=0]="Comment",a[a.Number=1]="Number",a[a.String=2]="String",a[a.Bytes=3]="Bytes",a[a.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(;$1&&a.substring($,$+2)==="0x"){for($+=2;$1&&a.substring($,$+2)==="/*"){for($+=2;$1&&a.substring($,$+2)==="*/");)$++;if($===a.length)throw new ScanError(a,$,"Unterminated C style comment");$+=2,_&&(yield{t:Literal.Comment,v:a.slice(et,$),first:et,last:$})}else if(j==="("||j===")"||j==="{"||j==="}"||j===";")$++,yield{t:j,v:j,first:et,last:$};else throw new ScanError(a,$,`Invalid character at offset ${$}: \`${j}'`)}}const refContract=Symbol("ref_contract");var Protocol;(function(a){a.Ps9mPmXa="Ps9mPmXaRzmzk35gbAYNCAw6UXdE2qoABTHbN2oEEc1qM7CwT9P",a.PtCJ7pwo="PtCJ7pwoxe8JasnHY8YonnLYjcVHmhiARPJvqcC6VfHT5s8k8sY",a.PsYLVpVv="PsYLVpVvgbLhAhoqAkMFUo6gudkJ9weNXhUYCiLDzcUpFpkk8Wt",a.PsddFKi3="PsddFKi32cMJ2qPjf43Qv5GDWLDPZb3T3bF6fLKiF5HtvHNU7aP",a.Pt24m4xi="Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd",a.PsBABY5H="PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU",a.PsBabyM1="PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS",a.PsCARTHA="PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb",a.PsDELPH1="PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo",a.PtEdoTez="PtEdoTezd3RHSC31mpxxo1npxFjoWWcFgQtxapi51Z8TLu6v6Uq",a.PtEdo2Zk="PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA",a.PsFLorena="PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i",a.PtGRANADs="PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV",a.PtHangzH="PtHangzHogokSuiMHemCuowEavgYTP8J5qQ9fQS793MHYFpCY3r",a.PtHangz2="PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx",a.PsiThaCa="PsiThaCaT47Zboaw71QWScM8sXeMM7bbQFncK9FLqYc6EKdpjVP",a.Psithaca2="Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A",a.PtJakarta="PtJakartaiDz69SfDDLXJSiuZqTSeSKRDbKVZC8MNzJnvRjvnGw",a.PtJakart2="PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY",a.PtKathman="PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg",a.PtLimaPtL="PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW",a.PtMumbaii="PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc",a.PtMumbai2="PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1",a.PtNairobi="PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf",a.ProxfordY="ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH",a.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[a][ht+1,yt]),et+=at,tt+=ut;break}case"I":tt!==$.length&&(rt[1]=$[tt++]);break;default:throw new MacroError(a,`${a.prim}: unexpected character: ${it}`)}return{r:j(nt,st,[0,rt]),n:et,an:tt}}function parseSetMapCadr(a,_,$,j){const et=_[0];switch(et){case"A":return _.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 _.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(a,`${a.prim}: unexpected character: ${et}`)}}function trimLast(a,_){let $=a.length;for(;$>0&&a[$-1]===_;)$--;return a.slice(0,$)}function filterAnnotations(a){const _=[],$=[];if(a!==void 0)for(const j of a)(j.length!==0&&j[0]==="%"?_:$).push(j);return{fields:_,rest:$}}function mkPrim({prim:a,annots:_,args:$}){return Object.assign(Object.assign({prim:a},_&&{annots:_}),$&&{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 $=(_==null?void 0:_.protocol)||DefaultProtocol;function j(et){return et!==void 0?[{prim:"RENAME",annots:et}]:[]}switch(a.prim){case"CMPEQ":case"CMPNEQ":case"CMPLT":case"CMPGT":case"CMPLE":case"CMPGE":if(assertArgs$1(a,0))return[{prim:"COMPARE"},mkPrim({prim:a.prim.slice(3),annots:a.annots})];break;case"IFEQ":case"IFNEQ":case"IFLT":case"IFGT":case"IFLE":case"IFGE":if(assertArgs$1(a,2))return[{prim:a.prim.slice(2)},mkPrim({prim:"IF",annots:a.annots,args:a.args})];break;case"IFCMPEQ":case"IFCMPNEQ":case"IFCMPLT":case"IFCMPGT":case"IFCMPLE":case"IFCMPGE":if(assertArgs$1(a,2))return[{prim:"COMPARE"},{prim:a.prim.slice(5)},mkPrim({prim:"IF",annots:a.annots,args:a.args})];break;case"FAIL":if(assertArgs$1(a,0)&&assertNoAnnots(a))return[{prim:"UNIT"},{prim:"FAILWITH"}];break;case"ASSERT":if(assertArgs$1(a,0)&&assertNoAnnots(a))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(a,0)&&assertNoAnnots(a))return[{prim:a.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(a,0)&&assertNoAnnots(a))return[[{prim:"COMPARE"},{prim:a.prim.slice(10)}],{prim:"IF",args:[[],[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_NONE":if(assertArgs$1(a,0)&&assertNoAnnots(a))return[{prim:"IF_NONE",args:[[],[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_SOME":if(assertArgs$1(a,0))return[{prim:"IF_NONE",args:[[[{prim:"UNIT"},{prim:"FAILWITH"}]],j(a.annots)]}];break;case"ASSERT_LEFT":if(assertArgs$1(a,0))return[{prim:"IF_LEFT",args:[j(a.annots),[[{prim:"UNIT"},{prim:"FAILWITH"}]]]}];break;case"ASSERT_RIGHT":if(assertArgs$1(a,0))return[{prim:"IF_LEFT",args:[[[{prim:"UNIT"},{prim:"FAILWITH"}]],j(a.annots)]}];break;case"IF_SOME":if(assertArgs$1(a,2))return[mkPrim({prim:"IF_NONE",annots:a.annots,args:[a.args[1],a.args[0]]})];break;case"IF_RIGHT":if(assertArgs$1(a,2))return[mkPrim({prim:"IF_LEFT",annots:a.annots,args:[a.args[1],a.args[0]]})];break;case"CAR":case"CDR":if(a.args!==void 0){if(assertArgs$1(a,1)&&assertIntArg(a,a.args[0])){const et=parseInt(a.args[0].int,10);return mkPrim({prim:"GET",args:[{int:a.prim==="CAR"?String(et*2+1):String(et*2)}],annots:a.annots})}}else return a}if(pairRe.test(a.prim)&&assertArgs$1(a,0)){const{fields:et,rest:tt}=filterAnnotations(a.annots),{r:rt}=parsePairUnpairExpr(a,a.prim.slice(1),et,(nt,it,st)=>[...nt||[],...it||[],st]);return rt.map(([nt,it],st)=>{const ot=[...trimLast(it,null).map(ut=>ut===null?"%":ut),...nt===0&&st===rt.length-1?tt:[]],at=mkPrim({prim:"PAIR",annots:ot.length!==0?ot:void 0});return nt===0?at:{prim:"DIP",args:nt===1?[[at]]:[{int:String(nt)},[at]]}})}if(unpairRe.test(a.prim))if(ProtoInferiorTo($,Protocol.PtEdo2Zk)&&assertArgs$1(a,0)){const{r:et}=parsePairUnpairExpr(a,a.prim.slice(3),a.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(a.prim==="UNPAIR")return a;if(assertArgs$1(a,0)){const{r:et}=parsePairUnpairExpr(a,a.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(a.prim)&&assertArgs$1(a,0)){const et=[...a.prim.slice(1,a.prim.length-1)];return et.map((tt,rt)=>{const nt=rt===et.length-1?a.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(a,`unexpected character: ${tt}`)}})}if(setCadrRe.test(a.prim)&&assertArgs$1(a,0)){const{fields:et,rest:tt}=filterAnnotations(a.annots);if(et.length>1)throw new MacroError(a,`unexpected annotation on macro ${a.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(a,a.prim.slice(5,a.prim.length-1),tt,rt)}if(mapCadrRe.test(a.prim)&&assertArgs$1(a,1)){const{fields:et}=filterAnnotations(a.annots);if(et.length>1)throw new MacroError(a,`unexpected annotation on macro ${a.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}),a.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}),a.args[0],{prim:"SWAP"},{prim:"CAR",annots:["@%%"]},{prim:"PAIR",annots:["%@",et.length!==0?et[0]:"%"]}]};return parseSetMapCadr(a,a.prim.slice(5,a.prim.length-1),[],tt)}if(diipRe.test(a.prim)&&assertArgs$1(a,1)){let et=0;for(;a.prim[1+et]==="I";)et++;return mkPrim({prim:"DIP",args:[{int:String(et)},a.args[0]]})}if(duupRe.test(a.prim)){let et=0;for(;a.prim[1+et]==="U";)et++;if(ProtoInferiorTo($,Protocol.PtEdo2Zk)){if(et===1){if(a.args===void 0)return a;assertArgs$1(a,1)&&assertIntArg(a,a.args[0])&&(et=parseInt(a.args[0].int,10))}else assertArgs$1(a,0);return et===1?[mkPrim({prim:"DUP",annots:a.annots})]:et===2?[{prim:"DIP",args:[[mkPrim({prim:"DUP",annots:a.annots})]]},{prim:"SWAP"}]:[{prim:"DIP",args:[{int:String(et-1)},[mkPrim({prim:"DUP",annots:a.annots})]]},{prim:"DIG",args:[{int:String(et)}]}]}else{if(et===1)return a;if(assertArgs$1(a,0))return mkPrim({prim:"DUP",args:[{int:String(et)}],annots:a.annots})}}return a}function expandGlobalConstants(a,_){return a.args!==void 0&&a.args.length===1&&"string"in a.args[0]&&a.args[0].string in _?_[a.args[0].string]:a}class MichelineParseError extends TaquitoError{constructor(_,$){super(),this.token=_,this.message=$,this.name="MichelineParseError"}}class JSONParseError extends TaquitoError{constructor(_,$){super(),this.node=_,this.message=$,this.name="JSONParseError"}}const errEOF=new MichelineParseError(null,"Unexpected EOF");function isAnnotation(a){return a.t===Literal.Ident&&(a.v[0]==="@"||a.v[0]==="%"||a.v[0]===":")}const intRe=new RegExp("^-?[0-9]+$"),bytesRe=new RegExp("^([0-9a-fA-F]{2})*$");let Parser$1=class{constructor(_){this.opt=_}expand(_){var $,j,et;if((($=this.opt)===null||$===void 0?void 0:$.expandGlobalConstant)!==void 0&&_.prim==="constant"){const tt=expandGlobalConstants(_,this.opt.expandGlobalConstant);return tt!==_&&(tt[sourceReference]=Object.assign(Object.assign({},_[sourceReference]||{first:0,last:0}),{globalConstant:_})),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(_,this.opt);return tt!==_&&(tt[sourceReference]=Object.assign(Object.assign({},_[sourceReference]||{first:0,last:0}),{macro:_})),tt}else return _}parseListExpr(_,$){var j;const et={first:$.first,last:$.last},tt=$.t==="(";let rt;if(tt){if(rt=_.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=_.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 st=this.parseExpr(_,it.value);et.last=((j=st[sourceReference])===null||j===void 0?void 0:j.last)||et.last,nt.args.push(st)}}return this.expand(nt)}parseArgs(_,$){var j;const et={first:$.first,last:$.last},tt={prim:$.v,[sourceReference]:et};for(;;){const rt=_.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(_,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(_,$){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=_.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[st,ot]=this.parseArgs(_,it.value);tt.last=((j=st[sourceReference])===null||j===void 0?void 0:j.last)||tt.last,rt.push(this.expand(st)),it=ot}else{const st=this.parseExpr(_,it.value);tt.last=((et=st[sourceReference])===null||et===void 0?void 0:et.last)||tt.last,rt.push(st),it=null}it===null&&(it=_.next(),it.done||(tt.last=it.value.last)),!it.done&&it.value.t===";"&&(it=null)}}parseExpr(_,$){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(_,$);default:return this.parseListExpr(_,$)}}parseSequence(_){if(typeof _!="string")throw new TypeError(`string type was expected, got ${typeof _} instead`);const $=scan(_),j=$.next();return j.done?null:this.parseSequenceExpr($,j.value)}parseList(_){if(typeof _!="string")throw new TypeError(`string type was expected, got ${typeof _} instead`);const $=scan(_),j=$.next();return j.done?null:this.parseListExpr($,j.value)}parseMichelineExpression(_){if(typeof _!="string")throw new TypeError(`string type was expected, got ${typeof _} instead`);const $=scan(_),j=$.next();return j.done?null:this.parseExpr($,j.value)}parseScript(_){return this.parseSequence(_)}parseData(_){return this.parseList(_)}parseJSON(_){if(typeof _!="object")throw new TypeError(`object type was expected, got ${typeof _} instead`);if(Array.isArray(_)){const $=[];for(const j of _){if(j===null||typeof j!="object")throw new JSONParseError(j,`unexpected sequence element: ${j}`);$.push(this.parseJSON(j))}return $}else if("prim"in _){const $=_;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(_,`malformed prim expression: ${_}`)}else if("string"in _){if(typeof _.string=="string")return{string:_.string};throw new JSONParseError(_,`malformed string literal: ${_}`)}else if("int"in _){if(typeof _.int=="string"&&intRe.test(_.int))return{int:_.int};throw new JSONParseError(_,`malformed int literal: ${_}`)}else if("bytes"in _){if(typeof _.bytes=="string"&&bytesRe.test(_.bytes))return{bytes:_.bytes};throw new JSONParseError(_,`malformed bytes literal: ${_}`)}else throw new JSONParseError(_,`unexpected object: ${_}`)}};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(_){super(),this.message=_,this.name="Base58DecodingError"}}function sha256(a){const _=(a.length+9)%64,$=_===0?0:64-_;if(a.length>268435455)throw new InvalidMessageError("",`: Invalid length ${a.length} is too big -- SHA-256.`);const j=a.length<<3,et=[...a,128,...new Array($).fill(0),0,0,0,0,j>>24&255,j>>16&255,j>>8&255,j&255];function tt(ot,at){return ot>>>at|ot<<32-at}const rt=[...H],nt=new Array(64),it=new Array(8);for(let ot=0;ot>>3,yt=tt(nt[ut-2],17)^tt(nt[ut-2],19)^nt[ut-2]>>>10;nt[ut]=(yt|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 yt=tt(it[0],2)^tt(it[0],13)^tt(it[0],22),wt=tt(it[4],6)^tt(it[4],11)^tt(it[4],25),Ct=it[7]+wt+(it[4]&it[5]^~it[4]&it[6])+K[ht]+nt[ht]|0,Pt=yt+(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 st=[];for(const ot of rt)st.push(ot>>24&255),st.push(ot>>16&255),st.push(ot>>8&255),st.push(ot&255);return st}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 $=a.charCodeAt(_)-49;if($>=base58alphabetFwd.length||base58alphabetFwd[$]===-1)throw new Base58DecodingError(`Unexpected character at position ${_}: ${a[_]}`);return base58alphabetFwd[$]}function decodeBase58(a){const _=[];let $=0;for(;$0;)_.push(0);return _.reverse()}function decodeBase58Check(a){const _=decodeBase58(a);if(_.length<4)throw new Base58DecodingError(`Data is too short ${_.length}`);const $=_.slice(0,_.length-4),j=_.slice(_.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(_){super(),this.message=_,this.name="InvalidMichelsonError"}}class InvalidTypeExpressionError extends ParameterValidationError{constructor(_){super(),this.message=_,this.name="InvalidTypeExpressionError"}}class InvalidDataExpressionError extends ParameterValidationError{constructor(_){super(),this.message=_,this.name="InvalidDataExpressionError"}}class InvalidEntrypointError extends ParameterValidationError{constructor(_){super(),this.entrypoint=_,this.name="InvalidEntrypointError",this.message=`Contract has no entrypoint named: "${_}"`}}class LongIntegerError extends TaquitoError{constructor(_){super(),this.message=_,this.name="LongIntegerError"}}class MichelsonError extends TaquitoError{constructor(_,$){super(),this.val=_,this.message=$,this.name="MichelsonError"}}class MichelsonTypeError extends MichelsonError{constructor(_,$,j){super(_,$),this.val=_,this.message=$,this.name="MichelsonTypeError",j!==void 0&&(this.data=j)}}class LongInteger{append(_){let $=0;for(;_!==0||$57)throw new LongIntegerError(`unexpected character in integer constant "${_[$]}"`);this.append(j-48)}}else _<0?(this.neg=!0,this.append(-_)):this.append(_)}cmp(_){if(this.neg!==_.neg)return(_.neg?1:0)-(this.neg?1:0);{let $=0;if(this.buf.length!==_.buf.length)$=this.buf.length<_.buf.length?-1:1;else if(this.buf.length!==0){let j=_.buf.length-1;for(;j>=0&&this.buf[j]===_.buf[j];)j--;$=j<0?0:this.buf[j]<_.buf[j]?-1:1}return this.neg?$===0?0:-$:$}}get sign(){return this.buf.length===0?0:this.neg?-1:1}}function parseBytes(a){const _=[];for(let $=0;$=0}catch{return!1}}const annRe=/^(@%|@%%|%@|[@:%]([_0-9a-zA-Z][_0-9a-zA-Z.%@]*)?)$/;function unpackAnnotations(a,_){if(Array.isArray(a))return{};let $,j,et;if(a.annots!==void 0){for(const tt of a.annots)if(tt.length!==0){if(!annRe.test(tt)||!(_!=null&&_.specialVar)&&(tt==="@%"||tt==="@%%")||!(_!=null&&_.specialFields)&&tt==="%@")throw new MichelsonError(a,`${a.prim}: unexpected annotation: ${tt}`);switch(tt[0]){case"%":(_!=null&&_.emptyFields||tt.length>1)&&($=$||[],$.push(tt));break;case":":tt.length>1&&(j=j||[],j.push(tt));break;case"@":(_!=null&&_.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(a);for(const j of _){const[et,tt]=tezosPrefix[j];if($.length===et+tt.length){let rt=0;for(;rt0?assertArgs(a,1):assertArgs(a,0);break;default:throw new MichelsonValidationError(a,"instruction expected")}}return!0}function assertMichelsonComparableType(a){if(assertPrimOrSeq(a)){if(Array.isArray(a)||a.prim==="pair"||a.prim==="or"||a.prim==="option")traverseType(a,_=>assertMichelsonComparableType(_));else if(!Object.prototype.hasOwnProperty.call(simpleComparableTypeIDs,a.prim))throw new MichelsonValidationError(a,`${a.prim}: type is not comparable`)}return!0}function assertMichelsonPackableType(a){if(assertPrimOrSeq(a)&&isPrim$1(a)){if(!Object.prototype.hasOwnProperty.call(typeIDs,a.prim)||a.prim==="big_map"||a.prim==="operation"||a.prim==="sapling_state"||a.prim==="ticket")throw new MichelsonValidationError(a,`${a.prim}: type can't be used inside PACK/UNPACK instructions`);traverseType(a,_=>assertMichelsonPackableType(_))}return!0}function assertMichelsonPushableType(a){if(assertPrimOrSeq(a)&&isPrim$1(a)){if(!Object.prototype.hasOwnProperty.call(typeIDs,a.prim)||a.prim==="big_map"||a.prim==="operation"||a.prim==="sapling_state"||a.prim==="ticket"||a.prim==="contract")throw new MichelsonValidationError(a,`${a.prim}: type can't be pushed`);traverseType(a,_=>assertMichelsonPushableType(_))}return!0}function assertMichelsonStorableType(a){if(assertPrimOrSeq(a)&&isPrim$1(a)){if(!Object.prototype.hasOwnProperty.call(typeIDs,a.prim)||a.prim==="operation"||a.prim==="contract")throw new MichelsonValidationError(a,`${a.prim}: type can't be used as part of a storage`);traverseType(a,_=>assertMichelsonStorableType(_))}return!0}function assertMichelsonPassableType(a){if(assertPrimOrSeq(a)&&isPrim$1(a)){if(!Object.prototype.hasOwnProperty.call(typeIDs,a.prim)||a.prim==="operation")throw new MichelsonValidationError(a,`${a.prim}: type can't be used as part of a parameter`);traverseType(a,_=>assertMichelsonPassableType(_))}return!0}function assertMichelsonBigMapStorableType(a){if(assertPrimOrSeq(a)&&isPrim$1(a)){if(!Object.prototype.hasOwnProperty.call(typeIDs,a.prim)||a.prim==="big_map"||a.prim==="operation"||a.prim==="sapling_state")throw new MichelsonValidationError(a,`${a.prim}: type can't be used inside a big_map`);traverseType(a,_=>assertMichelsonBigMapStorableType(_))}return!0}const viewRe=new RegExp("^[a-zA-Z0-9_.%@]*$");function assertViewNameValid(a){if(a.string.length>maxViewNameLength)throw new MichelsonValidationError(a,`view name too long: ${a.string}`);if(!viewRe.test(a.string))throw new MichelsonValidationError(a,`invalid character(s) in view name: ${a.string}`)}function assertMichelsonType(a){if(assertPrimOrSeq(a)&&isPrim$1(a)){if(!Object.prototype.hasOwnProperty.call(typeIDs,a.prim))throw new MichelsonValidationError(a,"type expected");traverseType(a,_=>assertMichelsonType(_))}return!0}function traverseType(a,_){if(Array.isArray(a)||a.prim==="pair"){const $=Array.isArray(a)?a:a.args;if($===void 0||$.length<2)throw new MichelsonValidationError(a,"at least 2 arguments expected");return $.forEach(j=>{assertPrimOrSeq(j)&&_(j)}),!0}switch(a.prim){case"option":case"list":assertArgs(a,1)&&assertPrimOrSeq(a.args[0])&&_(a.args[0]);break;case"contract":assertArgs(a,1)&&assertMichelsonPassableType(a.args[0]);break;case"or":assertArgs(a,2)&&assertPrimOrSeq(a.args[0])&&assertPrimOrSeq(a.args[1])&&(_(a.args[0]),_(a.args[1]));break;case"lambda":assertArgs(a,2)&&(assertMichelsonType(a.args[0]),assertMichelsonType(a.args[1]));break;case"set":assertArgs(a,1)&&assertMichelsonComparableType(a.args[0]);break;case"map":assertArgs(a,2)&&assertPrimOrSeq(a.args[0])&&assertPrimOrSeq(a.args[1])&&(assertMichelsonComparableType(a.args[0]),_(a.args[1]));break;case"big_map":assertArgs(a,2)&&assertPrimOrSeq(a.args[0])&&assertPrimOrSeq(a.args[1])&&(assertMichelsonComparableType(a.args[0]),assertMichelsonBigMapStorableType(a.args[1]),_(a.args[1]));break;case"ticket":assertArgs(a,1)&&assertPrimOrSeq(a.args[0])&&assertMichelsonComparableType(a.args[0]);break;case"sapling_state":case"sapling_transaction":assertArgs(a,1)&&assertIntLiteral(a.args[0]);break;default:assertArgs(a,0)}return!0}function assertMichelsonData(a){if("int"in a||"string"in a||"bytes"in a)return!0;if(Array.isArray(a)){let _=0;for(const $ of a)isPrim$1($)&&$.prim==="Elt"?(assertArgs($,2)&&(assertMichelsonData($.args[0]),assertMichelsonData($.args[1])),_++):assertMichelsonData($);if(_!==0&&_!==a.length)throw new MichelsonValidationError(a,"data entries and map elements can't be intermixed");return!0}if(isPrim$1(a))switch(a.prim){case"Unit":case"True":case"False":case"None":assertArgs(a,0);break;case"Pair":if(a.args===void 0||a.args.length<2)throw new MichelsonValidationError(a,"at least 2 arguments expected");for(const _ of a.args)assertMichelsonData(_);break;case"Left":case"Right":case"Some":assertArgs(a,1)&&assertMichelsonData(a.args[0]);break;case"Lambda_rec":a.args&&assertMichelsonInstruction(a.args);break;default:if(Object.prototype.hasOwnProperty.call(instructionIDs,a.prim))assertMichelsonInstruction(a);else throw new MichelsonValidationError(a,"data entry or instruction expected")}else throw new MichelsonValidationError(a,"data entry expected");return!0}function assertMichelsonContract(a){if(assertSeq(a)){const _={},$={};for(const j of a)if(assertPrim(j)){if(j.prim!=="view"){if(j.prim in _)throw new MichelsonValidationError(a,`duplicate contract section: ${j.prim}`);_[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(a,`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(a,`unexpected contract section: ${j.prim}`)}}}return!0}function isInstruction(a){return Object.prototype.hasOwnProperty.call(instructionIDs,a.prim)}function assertDataListIfAny(a){if(!Array.isArray(a))return!1;for(const _ of a)if("prim"in _){if(isInstruction(_))throw new MichelsonError(a,`Instruction outside of a lambda: ${JSON.stringify(a)}`);if(_.prim==="Elt")throw new MichelsonError(a,`Elt item outside of a map literal: ${JSON.stringify(a)}`)}return!0}function __rest$1(a,_){var $={};for(var j in a)Object.prototype.hasOwnProperty.call(a,j)&&_.indexOf(j)<0&&($[j]=a[j]);if(a!=null&&typeof Object.getOwnPropertySymbols=="function")for(var et=0,j=Object.getOwnPropertySymbols(a);et({[a]:_})));var Tag;(function(a){a[a.Int=0]="Int",a[a.String=1]="String",a[a.Sequence=2]="Sequence",a[a.Prim0=3]="Prim0",a[a.Prim0Annot=4]="Prim0Annot",a[a.Prim1=5]="Prim1",a[a.Prim1Annot=6]="Prim1Annot",a[a.Prim2=7]="Prim2",a[a.Prim2Annot=8]="Prim2Annot",a[a.Prim=9]="Prim",a[a.Bytes=10]="Bytes"})(Tag||(Tag={}));const boundsErr=new Error("bounds out of range");class Reader{constructor(_,$=0,j=_.length){this.buffer=_,this.idx=$,this.cap=j}get length(){return this.cap-this.idx}readBytes(_){if(this.cap-this.idx<_)throw boundsErr;const $=this.buffer.slice(this.idx,this.idx+_);return this.idx+=_,$}reader(_){if(this.cap-this.idx<_)throw boundsErr;const $=new Reader(this.buffer,this.idx,this.idx+_);return this.idx+=_,$}copy(){return new Reader(this.buffer,this.idx,this.cap)}readUint8(){if(this.cap-this.idx<1)throw boundsErr;return this.buffer[this.idx++]>>>0}readUint16(){if(this.cap-this.idx<2)throw boundsErr;const _=this.buffer[this.idx++],$=this.buffer[this.idx++];return(_<<8|$)>>>0}readUint32(){if(this.cap-this.idx<4)throw boundsErr;const _=this.buffer[this.idx++],$=this.buffer[this.idx++],j=this.buffer[this.idx++],et=this.buffer[this.idx++];return(_<<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 _=this.buffer[this.idx++],$=this.buffer[this.idx++];return(_<<8|$)<<16>>16}readInt32(){if(this.cap-this.idx<4)throw boundsErr;const _=this.buffer[this.idx++],$=this.buffer[this.idx++],j=this.buffer[this.idx++],et=this.buffer[this.idx++];return _<<24|$<<16|j<<8|et}}var ContractID;(function(a){a[a.Implicit=0]="Implicit",a[a.Originated=1]="Originated"})(ContractID||(ContractID={}));var PublicKeyHashID;(function(a){a[a.ED25519=0]="ED25519",a[a.SECP256K1=1]="SECP256K1",a[a.P256=2]="P256"})(PublicKeyHashID||(PublicKeyHashID={}));function readPublicKeyHash(a){let _;const $=a.readUint8();switch($){case PublicKeyHashID.ED25519:_="ED25519PublicKeyHash";break;case PublicKeyHashID.SECP256K1:_="SECP256K1PublicKeyHash";break;case PublicKeyHashID.P256:_="P256PublicKeyHash";break;default:throw new Error(`unknown public key hash tag: ${$}`)}return{type:_,hash:a.readBytes(20)}}function readAddress(a){let _;const $=a.readUint8();switch($){case ContractID.Implicit:_=readPublicKeyHash(a);break;case ContractID.Originated:_={type:"ContractHash",hash:a.readBytes(20)},a.readBytes(1);break;default:throw new Error(`unknown address tag: ${$}`)}if(a.length!==0){const j=new TextDecoder;_.entryPoint=j.decode(new Uint8Array(a.readBytes(a.length)))}return _}var PublicKeyID;(function(a){a[a.ED25519=0]="ED25519",a[a.SECP256K1=1]="SECP256K1",a[a.P256=2]="P256"})(PublicKeyID||(PublicKeyID={}));function readPublicKey(a){let _,$;const j=a.readUint8();switch(j){case PublicKeyID.ED25519:$="ED25519PublicKey",_=32;break;case PublicKeyID.SECP256K1:$="SECP256K1PublicKey",_=33;break;case PublicKeyID.P256:$="P256PublicKey",_=33;break;default:throw new Error(`unknown public key tag: ${j}`)}return{type:$,publicKey:a.readBytes(_)}}function decodeAddressBytes(a){const _=parseBytes(a.bytes);if(_===null)throw new Error(`can't parse bytes: "${a.bytes}"`);const $=new Reader(new Uint8Array(_));return readAddress($)}function decodePublicKeyHashBytes(a){const _=parseBytes(a.bytes);if(_===null)throw new Error(`can't parse bytes: "${a.bytes}"`);const $=new Reader(new Uint8Array(_));return readPublicKeyHash($)}function decodePublicKeyBytes(a){const _=parseBytes(a.bytes);if(_===null)throw new Error(`can't parse bytes: "${a.bytes}"`);const $=new Reader(new Uint8Array(_));return readPublicKey($)}class MichelsonInstructionError extends MichelsonError{constructor(_,$,j){super(_,j),this.val=_,this.stackState=$,this.message=j,this.name="MichelsonInstructionError"}}function typeID(a){return Array.isArray(a)?"pair":a.prim}function typeArgs(a){return"prim"in a?a.args:a}function assertScalarTypesEqual(a,_,$=!1){if(typeID(a)!==typeID(_))throw new MichelsonTypeError(a,`types mismatch: ${typeID(a)} != ${typeID(_)}`,void 0);const j=[unpackAnnotations(a),unpackAnnotations(_)];if(j[0].t&&j[1].t&&j[0].t[0]!==j[1].t[0])throw new MichelsonTypeError(a,`${typeID(a)}: 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(a,`${typeID(a)}: field names mismatch: ${j[0].f[0]} != ${j[1].f}`,void 0);if(isPairType(a)){const et=unpackComb("pair",a),tt=unpackComb("pair",_);assertScalarTypesEqual(et.args[0],tt.args[0],!0),assertScalarTypesEqual(et.args[1],tt.args[1],!0);return}switch(a.prim){case"option":case"list":case"contract":case"set":case"ticket":assertScalarTypesEqual(a.args[0],_.args[0]);break;case"or":assertScalarTypesEqual(a.args[0],_.args[0],!0),assertScalarTypesEqual(a.args[1],_.args[1],!0);break;case"lambda":case"map":case"big_map":assertScalarTypesEqual(a.args[0],_.args[0]),assertScalarTypesEqual(a.args[1],_.args[1]);break;case"sapling_state":case"sapling_transaction":if(parseInt(a.args[0].int,10)!==parseInt(_.args[0].int,10))throw new MichelsonTypeError(a,`${typeID(a)}: type argument mismatch: ${a.args[0].int} != ${_.args[0].int}`,void 0)}}function assertStacksEqual(a,_){if(a.length!==_.length)throw new MichelsonTypeError(a,`stack length mismatch: ${a.length} != ${_.length}`,void 0);for(let $=0;$1)throw new MichelsonTypeError(a,`${a.prim}: at most one type annotation allowed: ${a.annots}`,void 0);if(_){if((((j=tt.f)===null||j===void 0?void 0:j.length)||0)>1)throw new MichelsonTypeError(a,`${a.prim}: at most one field annotation allowed: ${a.annots}`,void 0)}else if((((et=tt.f)===null||et===void 0?void 0:et.length)||0)>0)throw new MichelsonTypeError(a,`${a.prim}: field annotations aren't allowed: ${a.annots}`,void 0)}if(isPairType(a)){const tt=typeArgs(a);for(const rt of tt)assertTypeAnnotationsValid(rt,!0);return}switch(a.prim){case"option":case"list":case"contract":case"set":assertTypeAnnotationsValid(a.args[0]);break;case"or":for(const tt of a.args)assertTypeAnnotationsValid(tt,!0);break;case"lambda":case"map":case"big_map":assertTypeAnnotationsValid(a.args[0]),assertTypeAnnotationsValid(a.args[1])}}function isFunction(a){if(!Array.isArray(a))return!1;for(const _ of a)if(!(Array.isArray(_)&&isFunction(_)||"prim"in _&&isInstruction(_)))return!1;return!0}function assertDataValidInternal(a,_,$){if(isPairType(_)){if(isPairData(a)){assertDataListIfAny(a);const j=unpackComb("Pair",a),et=unpackComb("pair",_);assertDataValidInternal(j.args[0],et.args[0],$),assertDataValidInternal(j.args[1],et.args[1],$);return}throw new MichelsonTypeError(_,`pair expected: ${JSON.stringify(a)}`,a)}switch(_.prim){case"int":if("int"in a&&isDecimal(a.int))return;throw new MichelsonTypeError(_,`integer value expected: ${JSON.stringify(a)}`,a);case"nat":case"mutez":if("int"in a&&isNatural(a.int))return;throw new MichelsonTypeError(_,`natural value expected: ${JSON.stringify(a)}`,a);case"string":if("string"in a)return;throw new MichelsonTypeError(_,`string value expected: ${JSON.stringify(a)}`,a);case"bytes":case"bls12_381_g1":case"bls12_381_g2":if("bytes"in a&&parseBytes(a.bytes)!==null)return;throw new MichelsonTypeError(_,`bytes value expected: ${JSON.stringify(a)}`,a);case"bool":if("prim"in a&&(a.prim==="True"||a.prim==="False"))return;throw new MichelsonTypeError(_,`boolean value expected: ${JSON.stringify(a)}`,a);case"key_hash":if("string"in a&&checkDecodeTezosID(a.string,"ED25519PublicKeyHash","SECP256K1PublicKeyHash","P256PublicKeyHash")!==null)return;if("bytes"in a)try{decodePublicKeyHashBytes(a);return}catch{}throw new MichelsonTypeError(_,`key hash expected: ${JSON.stringify(a)}`,a);case"timestamp":if(("string"in a||"int"in a)&&parseDate(a)!==null)return;throw new MichelsonTypeError(_,`timestamp expected: ${JSON.stringify(a)}`,a);case"address":if("string"in a){let j=a.string;const et=a.string.indexOf("%");if(et>=0&&(j=a.string.slice(0,et)),checkDecodeTezosID(j,"ED25519PublicKeyHash","SECP256K1PublicKeyHash","P256PublicKeyHash","ContractHash","RollupAddress")!==null)return}else if("bytes"in a)try{decodeAddressBytes(a);return}catch{}throw new MichelsonTypeError(_,`address expected: ${JSON.stringify(a)}`,a);case"key":if("string"in a&&checkDecodeTezosID(a.string,"ED25519PublicKey","SECP256K1PublicKey","P256PublicKey")!==null)return;if("bytes"in a)try{decodePublicKeyBytes(a);return}catch{}throw new MichelsonTypeError(_,`public key expected: ${JSON.stringify(a)}`,a);case"unit":if("prim"in a&&a.prim==="Unit")return;throw new MichelsonTypeError(_,`unit value expected: ${JSON.stringify(a)}`,a);case"signature":if("bytes"in a||"string"in a&&checkDecodeTezosID(a.string,"ED25519Signature","SECP256K1Signature","P256Signature","GenericSignature")!==null)return;throw new MichelsonTypeError(_,`signature expected: ${JSON.stringify(a)}`,a);case"chain_id":if(("bytes"in a||"string"in a)&&("string"in a?decodeBase58Check(a.string):parseBytes(a.bytes))!==null)return;throw new MichelsonTypeError(_,`chain id expected: ${JSON.stringify(a)}`,a);case"option":if("prim"in a){if(a.prim==="None")return;if(a.prim==="Some"){assertDataValidInternal(a.args[0],_.args[0],$);return}}throw new MichelsonTypeError(_,`option expected: ${JSON.stringify(a)}`,a);case"list":case"set":if(assertDataListIfAny(a)){for(const j of a)assertDataValidInternal(j,_.args[0],$);return}throw new MichelsonTypeError(_,`${_.prim} expected: ${JSON.stringify(a)}`,a);case"or":if("prim"in a){if(a.prim==="Left"){assertDataValidInternal(a.args[0],_.args[0],$);return}else if(a.prim==="Right"){assertDataValidInternal(a.args[0],_.args[1],$);return}}throw new MichelsonTypeError(_,`union (or) expected: ${JSON.stringify(a)}`,a);case"lambda":if(isFunction(a)){const j=functionTypeInternal(a,[_.args[0]],$);if("failed"in j)throw new MichelsonTypeError(_,`function is failed with error type: ${j.failed}`,a);if(j.length!==1)throw new MichelsonTypeError(_,"function must return a value",a);assertScalarTypesEqual(_.args[1],j[0]);return}throw new MichelsonTypeError(_,`function expected: ${JSON.stringify(a)}`,a);case"map":case"big_map":if(Array.isArray(a)){for(const j of a){if(!("prim"in j)||j.prim!=="Elt")throw new MichelsonTypeError(_,`map elements expected: ${JSON.stringify(a)}`,a);assertDataValidInternal(j.args[0],_.args[0],$),assertDataValidInternal(j.args[1],_.args[1],$)}return}throw new MichelsonTypeError(_,`${_.prim} expected: ${JSON.stringify(a)}`,a);case"bls12_381_fr":if("int"in a&&isDecimal(a.int)||"bytes"in a&&parseBytes(a.bytes)!==null)return;throw new MichelsonTypeError(_,`BLS12-381 element expected: ${JSON.stringify(a)}`,a);case"sapling_state":if(Array.isArray(a))return;throw new MichelsonTypeError(_,`sapling state expected: ${JSON.stringify(a)}`,a);case"ticket":assertDataValidInternal(a,{prim:"pair",args:[{prim:"address"},_.args[0],{prim:"nat"}]},$);return;default:throw new MichelsonTypeError(_,`type ${typeID(_)} don't have Michelson literal representation`,a)}}function instructionListType(a,_,$){let j=_,et=_,tt=0;for(const rt of a){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!==a.length-1)throw new MichelsonInstructionError(a,j,"FAIL must appear in a tail position");if(($==null?void 0:$.traceCallback)!==void 0){const rt={op:a,in:_,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(a))return instructionListType(a,_,$);const et=a;function tt(Ft,...jt){if(_.length{try{return Ft(...jt)}catch(bt){throw bt instanceof MichelsonError?new MichelsonInstructionError(et,_,bt.message):bt}}}function nt(Ft){return jt=>{try{return Ft(jt)}catch(bt){throw bt instanceof MichelsonError?new MichelsonInstructionError(et,_,bt.message):bt}}}const it=rt(unpackAnnotations),st=rt(assertStacksEqual),ot=rt(assertScalarTypesEqual),at=nt(assertMichelsonComparableType),ut=nt(assertMichelsonPackableType),ht=nt(assertMichelsonStorableType),yt=nt(assertMichelsonPushableType),wt=nt(assertMichelsonBigMapStorableType);function Ct(Ft,jt){const bt=it(et,Object.assign(Object.assign({},jt),{emptyFields:Ft.f!==void 0&&Ft.f>1,emptyVar:Ft.v!==void 0&&Ft.v>1})),vt=(ct,dt,mt)=>{if(ct&&ct.length>(dt||0))throw new MichelsonInstructionError(et,_,`${et.prim}: at most ${dt||0} ${mt} annotations allowed`)};return vt(bt.f,Ft.f,"field"),vt(bt.t,Ft.t,"type"),vt(bt.v,Ft.v,"variable"),bt}function Pt(Ft,jt){const bt=Ft,vt=Array.isArray(bt)?{prim:"pair",args:bt}:bt,ct=it(vt),dt=jt.v!==void 0||jt.t!==void 0||jt.f!==void 0?[...(jt.v===null?ct.v:jt.v)||[],...(jt.t===null?ct.t:jt.t)||[],...(jt.f===null?ct.f:jt.f)||[]]:void 0,mt=__rest$1(vt,["annots"]);return Object.assign(Object.assign({},mt),dt&&dt.length!==0&&{annots:dt})}function $t(Ft,jt){const bt=Ct({v:1});return Pt(Ft,{v:bt.v!==void 0?bt.v:jt!==void 0?[jt]:null,t:null})}function Mt(Ft,jt,bt,vt,ct){var dt,mt,xt,At;const Rt=(dt=it(jt).f)===null||dt===void 0?void 0:dt[0],St=(mt=bt.f)===null||mt===void 0?void 0:mt[vt];if(St!==void 0&&St!=="%"&&Rt!==void 0&&St!==Rt)throw new MichelsonInstructionError(et,_,`${et.prim}: field names doesn't match: ${St} !== ${Rt}`);const Tt=(xt=bt.v)===null||xt===void 0?void 0:xt[vt],Et=(At=it(Ft).v)===null||At===void 0?void 0:At[0];return Pt(jt,{t:null,v:Tt?Tt==="@%"?Rt?["@"+Rt.slice(1)]:void 0:Tt==="@%%"?Et?["@"+Et.slice(1)+"."+(Rt?Rt.slice(1):ct)]:Rt?["@"+Rt.slice(1)]:void 0:[Tt]:null})}function Lt(Ft,jt,bt=jt){const vt=unpackComb("pair",Ft);if(bt===1)return[vt.args[0]];if(bt===2)return vt.args;const ct=vt.args[1];if(isPairType(ct))return[vt.args[0],...Lt(ct,jt,bt-1)];throw new MichelsonInstructionError(et,_,`${et.prim}: at least ${jt} fields are expected`)}function Dt(Ft,jt,bt=jt){if(bt===0)return Ft;const vt=unpackComb("pair",Ft);if(bt===1)return vt.args[0];const ct=vt.args[1];if(isPairType(ct))return Dt(ct,jt,bt-2);if(bt===2)return ct;throw new MichelsonInstructionError(et,_,`${et.prim}: at least ${jt+1} fields are expected`)}function zt(Ft,jt,bt,vt=bt){if(vt===0)return jt;const ct=unpackComb("pair",Ft);if(vt===1)return Object.assign(Object.assign({},ct),{args:[jt,ct.args[1]]});const dt=ct.args[1];if(isPairType(dt))return Object.assign(Object.assign({},ct),{args:[ct.args[0],zt(dt,jt,bt,vt-2)]});if(vt===2)return Object.assign(Object.assign({},ct),{args:[ct.args[0],jt]});throw new MichelsonInstructionError(et,_,`${et.prim}: at least ${bt+1} fields are expected`)}const Ot=(Ft,jt)=>["@"+(Ft.v?Ft.v[0].slice(1)+".":"")+jt];function It(Ft,jt){return"failed"in Ft||"failed"in jt?"failed"in Ft?jt:Ft:(st(Ft,jt),Ft)}const Bt=(Ft=>{var jt,bt,vt,ct,dt;switch(Ft.prim){case"DUP":{const mt=Ft.args?parseInt(Ft.args[0].int,10):1;if(mt===0)throw new MichelsonInstructionError(Ft,_,"DUP 0 is forbidden");const xt=tt(mt-1,null)[0];if(typeID(xt)==="ticket")throw new MichelsonInstructionError(Ft,_,"ticket can't be DUPed");return[xt,..._]}case"SWAP":{const mt=tt(0,null,null);return Ct({}),[mt[1],mt[0],..._.slice(2)]}case"SOME":return[Pt({prim:"option",args:[tt(0,null)[0]]},Ct({t:1,v:1})),..._.slice(1)];case"UNIT":return[Pt({prim:"unit"},Ct({v:1,t:1})),..._];case"PAIR":{const mt=Ft.args?parseInt(Ft.args[0].int,10):2;if(mt<2)throw new MichelsonInstructionError(Ft,_,`PAIR ${mt} is forbidden`);const xt=tt(0,...new Array(mt).fill(null)),At=Ct({f:mt,t:1,v:1},{specialFields:!0}),Rt=Tt=>{const Et=Tt.lastIndexOf(".");return Tt.slice(Et>0?Et+1:1)},St=xt.map((Tt,Et)=>{var Nt;const tr=it(Tt),ir=At.f&&At.f.length>Et&&At.f[Et]!=="%"?At.f[Et]==="%@"?tr.v?["%"+Rt(((Nt=tr.v)===null||Nt===void 0?void 0:Nt[0])||"")]:void 0:[At.f[Et]]:void 0;return Pt(Tt,{v:null,t:null,f:ir})});return[Pt({prim:"pair",args:St},{t:At.t,v:At.v}),..._.slice(mt)]}case"UNPAIR":{const mt=Ft.args?parseInt(Ft.args[0].int,10):2;if(mt<2)throw new MichelsonInstructionError(Ft,_,`UNPAIR ${mt} is forbidden`);const xt=tt(0,["pair"])[0],At=Ct({f:2,v:2},{specialVar:!0});return[...Lt(xt,mt).map((St,Tt)=>Mt(xt,St,At,Tt,Tt===0?"car":"cdr")),..._.slice(1)]}case"CAR":case"CDR":{const mt=unpackComb("pair",tt(0,["pair"])[0]),xt=mt.args[Ft.prim==="CAR"?0:1],At=Ct({f:1,v:1},{specialVar:!0});return[Mt(mt,xt,At,0,Ft.prim.toLocaleLowerCase()),..._.slice(1)]}case"CONS":{const mt=tt(0,null,["list"]);return ot(mt[0],mt[1].args[0]),[$t({prim:"list",args:[mt[1].args[0]]}),..._.slice(2)]}case"SIZE":return tt(0,["string","list","set","map","bytes"]),[$t({prim:"nat"}),..._.slice(1)];case"MEM":{const mt=tt(0,null,["set","map","big_map"]);return at(mt[0]),ot(mt[0],mt[1].args[0]),[$t({prim:"bool"}),..._.slice(2)]}case"GET":if(Ft.args){const mt=parseInt(Ft.args[0].int,10),xt=tt(0,["pair"])[0];return[$t(Dt(xt,mt)),..._.slice(1)]}else{const mt=tt(0,null,["map","big_map"]);return at(mt[0]),ot(mt[0],mt[1].args[0]),[$t({prim:"option",args:[mt[1].args[1]]}),..._.slice(2)]}case"UPDATE":if(Ft.args){const mt=parseInt(Ft.args[0].int,10),xt=tt(0,null,["pair"]);return[$t(zt(xt[1],xt[0],mt)),..._.slice(2)]}else{const mt=tt(0,null,["bool","option"]);if(at(mt[0]),mt[1].prim==="bool"){const At=tt(2,["set"]);return ot(mt[0],At[0].args[0]),[$t({prim:"set",args:[Pt(mt[0],{t:null})]}),..._.slice(3)]}const xt=tt(2,["map","big_map"]);return ot(mt[0],xt[0].args[0]),xt[0].prim==="map"?[$t({prim:"map",args:[Pt(mt[0],{t:null}),Pt(mt[1].args[0],{t:null})]}),..._.slice(3)]:(wt(mt[1].args[0]),[$t({prim:"big_map",args:[Pt(mt[0],{t:null}),Pt(mt[1].args[0],{t:null})]}),..._.slice(3)])}case"GET_AND_UPDATE":{const mt=Ct({v:2}),xt=tt(0,null,["option"],["map","big_map"]);at(xt[0]),ot(xt[0],xt[2].args[0]),ot(xt[1].args[0],xt[2].args[1]);const At=(jt=mt.v)===null||jt===void 0?void 0:jt.map(Rt=>Rt!=="@"?[Rt]:void 0);return xt[2].prim==="map"?[Pt({prim:"option",args:[xt[2].args[1]]},{v:At==null?void 0:At[0]}),Pt({prim:"map",args:[Pt(xt[0],{t:null}),Pt(xt[1].args[0],{t:null})]},{v:At==null?void 0:At[1]}),..._.slice(3)]:(wt(xt[1].args[0]),[Pt({prim:"option",args:[xt[2].args[1]]},{v:At==null?void 0:At[0]}),Pt({prim:"big_map",args:[Pt(xt[0],{t:null}),Pt(xt[1].args[0],{t:null})]},{v:At==null?void 0:At[1]}),..._.slice(3)])}case"EXEC":{const mt=tt(0,null,["lambda"]);return ot(mt[0],mt[1].args[0]),[$t(mt[1].args[1]),..._.slice(2)]}case"APPLY":{const mt=tt(0,null,["lambda"]);if(ht(mt[0]),yt(mt[0]),!isPairType(mt[1].args[0]))throw new MichelsonInstructionError(Ft,_,`${Ft.prim}: function's argument must be a pair: ${typeID(mt[1].args[0])}`);const xt=mt[1].args[0];return ot(mt[0],typeArgs(xt)[0]),[$t({prim:"lambda",args:[typeArgs(xt)[1],mt[1].args[1]]}),..._.slice(2)]}case"FAILWITH":{const mt=tt(0,null)[0];return ProtoInferiorTo(j,Protocol.PtEdo2Zk)||ut(mt),{failed:mt,level:0}}case"NEVER":return tt(0,["never"]),{failed:{prim:"never"},level:0};case"RENAME":return[$t(tt(0,null)[0]),..._.slice(1)];case"CONCAT":{const mt=tt(0,["string","list","bytes"]);if(mt[0].prim==="list"){if(typeID(mt[0].args[0])!=="string"&&typeID(mt[0].args[0])!=="bytes")throw new MichelsonInstructionError(Ft,_,`${Ft.prim}: can't concatenate list of ${typeID(mt[0].args[0])}'s`);return[$t(mt[0].args[0]),..._.slice(1)]}const xt=tt(1,["string","bytes"]);if(mt[0].prim!==xt[0].prim)throw new MichelsonInstructionError(Ft,_,`${Ft.prim}: can't concatenate ${mt[0].prim} with ${xt[0].prim}`);return[$t(xt[0]),..._.slice(2)]}case"SLICE":return[$t({prim:"option",args:[tt(0,["nat"],["nat"],["string","bytes"])[2]]},"@slice"),..._.slice(3)];case"PACK":{const mt=tt(0,null)[0];return ut(mt),[$t({prim:"bytes"},"@packed"),..._.slice(1)]}case"ADD":{const mt=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(mt[0].prim==="nat"&&mt[1].prim==="int"||mt[0].prim==="int"&&mt[1].prim==="nat")return[$t({prim:"int"}),..._.slice(2)];if(mt[0].prim==="int"&&mt[1].prim==="timestamp"||mt[0].prim==="timestamp"&&mt[1].prim==="int")return[$t({prim:"timestamp"}),..._.slice(2)];if((mt[0].prim==="int"||mt[0].prim==="nat"||mt[0].prim==="mutez"||mt[0].prim==="bls12_381_g1"||mt[0].prim==="bls12_381_g2"||mt[0].prim==="bls12_381_fr")&&mt[0].prim===mt[1].prim)return[$t(mt[0]),..._.slice(2)];throw new MichelsonInstructionError(Ft,_,`${Ft.prim}: can't add ${mt[0].prim} to ${mt[1].prim}`)}case"SUB":{const mt=ProtoInferiorTo(j,Protocol.PsiThaCa)?tt(0,["nat","int","timestamp","mutez"],["nat","int","timestamp","mutez"]):tt(0,["nat","int","timestamp"],["nat","int","timestamp"]);if((mt[0].prim==="nat"||mt[0].prim==="int")&&(mt[1].prim==="nat"||mt[1].prim==="int")||mt[0].prim==="timestamp"&&mt[1].prim==="timestamp")return[$t({prim:"int"}),..._.slice(2)];if(mt[0].prim==="timestamp"&&mt[1].prim==="int")return[$t({prim:"timestamp"}),..._.slice(2)];if(mt[0].prim==="mutez"&&mt[1].prim==="mutez")return[$t({prim:"mutez"}),..._.slice(2)];throw new MichelsonInstructionError(Ft,_,`${Ft.prim}: can't subtract ${mt[0].prim} from ${mt[1].prim}`)}case"SUB_MUTEZ":return tt(0,["mutez"],["mutez"]),[$t({prim:"option",args:[{prim:"mutez"}]}),..._.slice(2)];case"MUL":{const mt=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(mt[0].prim==="nat"&&mt[1].prim==="int"||mt[0].prim==="int"&&mt[1].prim==="nat")return[$t({prim:"int"}),..._.slice(2)];if(mt[0].prim==="nat"&&mt[1].prim==="mutez"||mt[0].prim==="mutez"&&mt[1].prim==="nat")return[$t({prim:"mutez"}),..._.slice(2)];if((mt[0].prim==="bls12_381_g1"||mt[0].prim==="bls12_381_g2"||mt[0].prim==="bls12_381_fr")&&mt[1].prim==="bls12_381_fr"||(mt[0].prim==="nat"||mt[0].prim==="int")&&mt[0].prim===mt[1].prim)return[$t(mt[0]),..._.slice(2)];if((mt[0].prim==="nat"||mt[0].prim==="int")&&mt[1].prim==="bls12_381_fr"||(mt[1].prim==="nat"||mt[1].prim==="int")&&mt[0].prim==="bls12_381_fr")return[$t({prim:"bls12_381_fr"}),..._.slice(2)];throw new MichelsonInstructionError(Ft,_,`${Ft.prim}: can't multiply ${mt[0].prim} by ${mt[1].prim}`)}case"EDIV":{const mt=(At,Rt)=>({prim:"option",args:[{prim:"pair",args:[{prim:At},{prim:Rt}]}]}),xt=tt(0,["nat","int","mutez"],["nat","int","mutez"]);if(xt[0].prim==="nat"&&xt[1].prim==="nat")return[$t(mt("nat","nat")),..._.slice(2)];if((xt[0].prim==="nat"||xt[0].prim==="int")&&(xt[1].prim==="nat"||xt[1].prim==="int"))return[$t(mt("int","nat")),..._.slice(2)];if(xt[0].prim==="mutez"&&xt[1].prim==="nat")return[$t(mt("mutez","mutez")),..._.slice(2)];if(xt[0].prim==="mutez"&&xt[1].prim==="mutez")return[$t(mt("nat","mutez")),..._.slice(2)];throw new MichelsonInstructionError(Ft,_,`${Ft.prim}: can't euclideally divide ${xt[0].prim} by ${xt[1].prim}`)}case"ABS":return tt(0,["int"]),[$t({prim:"nat"}),..._.slice(1)];case"ISNAT":return tt(0,["int"]),[$t({prim:"option",args:[{prim:"nat"}]}),..._.slice(1)];case"INT":return tt(0,["nat","bls12_381_fr","bytes"]),[$t({prim:"int"}),..._.slice(1)];case"BYTES":return tt(0,["nat","int"]),[$t({prim:"bytes"}),..._.slice(1)];case"NAT":return tt(0,["bytes"]),[$t({prim:"nat"}),..._.slice(1)];case"NEG":{const mt=tt(0,["nat","int","bls12_381_g1","bls12_381_g2","bls12_381_fr"])[0];return mt.prim==="nat"||mt.prim==="int"?[$t({prim:"int"}),..._.slice(1)]:[$t(mt),..._.slice(1)]}case"LSL":case"LSR":return tt(0,["nat","bytes"],["nat","bytes"]),[$t({prim:"nat"}),..._.slice(2)];case"OR":case"XOR":{const mt=tt(0,["nat","bytes","bool"],["nat","bytes","bool"]);if(mt[0].prim!==mt[1].prim)throw new MichelsonInstructionError(Ft,_,`${Ft.prim}: both arguments must be of the same type: ${mt[0].prim}, ${mt[1].prim}`);return[$t(mt[1]),..._.slice(2)]}case"AND":{const mt=tt(0,["nat","bytes","bool","int"],["nat","bytes","bool"]);if((mt[0].prim!=="int"||mt[1].prim!=="nat")&&mt[0].prim!==mt[1].prim)throw new MichelsonInstructionError(Ft,_,`${Ft.prim}: both arguments must be of the same type: ${mt[0].prim}, ${mt[1].prim}`);return[$t(mt[1]),..._.slice(2)]}case"NOT":return tt(0,["nat","bytes","bool","int"])[0].prim==="bool"?[$t({prim:"bool"}),..._.slice(1)]:[$t({prim:"int"}),..._.slice(1)];case"COMPARE":{const mt=tt(0,null,null);return at(mt[0]),at(mt[1]),[$t({prim:"int"}),..._.slice(2)]}case"EQ":case"NEQ":case"LT":case"GT":case"LE":case"GE":return tt(0,["int"]),[$t({prim:"bool"}),..._.slice(1)];case"SELF":{if(($==null?void 0:$.contract)===void 0)throw new MichelsonInstructionError(Ft,_,`${Ft.prim}: contract required`);const mt=Ct({f:1,v:1}),xt=contractEntryPoint($.contract,(bt=mt.f)===null||bt===void 0?void 0:bt[0]);if(xt===null)throw new MichelsonInstructionError(Ft,_,`${Ft.prim}: contract has no entrypoint ${xt}`);return[Pt({prim:"contract",args:[xt]},{v:mt.v?mt.v:["@self"]}),..._]}case"TRANSFER_TOKENS":{const mt=tt(0,null,["mutez"],["contract"]);return ot(mt[0],mt[2].args[0]),[$t({prim:"operation"}),..._.slice(3)]}case"SET_DELEGATE":{const mt=tt(0,["option"])[0];if(typeID(mt.args[0])!=="key_hash")throw new MichelsonInstructionError(Ft,_,`${Ft.prim}: key hash expected: ${typeID(mt.args[0])}`);return[$t({prim:"operation"}),..._.slice(1)]}case"IMPLICIT_ACCOUNT":return tt(0,["key_hash"]),[$t({prim:"contract",args:[{prim:"unit"}]}),..._.slice(1)];case"NOW":return[$t({prim:"timestamp"},"@now"),..._];case"AMOUNT":return[$t({prim:"mutez"},"@amount"),..._];case"BALANCE":return[$t({prim:"mutez"},"@balance"),..._];case"CHECK_SIGNATURE":return tt(0,["key"],["signature"],["bytes"]),[$t({prim:"bool"}),..._.slice(3)];case"BLAKE2B":case"SHA256":case"SHA512":case"KECCAK":case"SHA3":return tt(0,["bytes"]),[$t({prim:"bytes"}),..._.slice(1)];case"HASH_KEY":return tt(0,["key"]),[$t({prim:"key_hash"}),..._.slice(1)];case"SOURCE":return[$t({prim:"address"},"@source"),..._];case"SENDER":return[$t({prim:"address"},"@sender"),..._];case"ADDRESS":{const mt=tt(0,["contract"])[0],xt=Ct({v:1});return[Pt({prim:"address",[refContract]:mt},{v:xt.v?xt.v:Ot(it(mt),"address")}),..._.slice(1)]}case"SELF_ADDRESS":{const mt={prim:"address"};return($==null?void 0:$.contract)!==void 0&&(mt[refContract]={prim:"contract",args:[contractSection($.contract,"parameter").args[0]]}),[$t(mt,"@address"),..._]}case"CHAIN_ID":return[$t({prim:"chain_id"}),..._];case"DROP":{Ct({});const mt=Ft.args!==void 0?parseInt(Ft.args[0].int,10):1;return tt(mt-1,null),_.slice(mt)}case"DIG":{Ct({});const mt=parseInt(Ft.args[0].int,10);return[tt(mt,null)[0],..._.slice(0,mt),..._.slice(mt+1)]}case"DUG":{Ct({});const mt=parseInt(Ft.args[0].int,10);return[..._.slice(1,mt+1),tt(0,null)[0],..._.slice(mt+1)]}case"NONE":return assertTypeAnnotationsValid(Ft.args[0]),[Pt({prim:"option",args:[Ft.args[0]]},Ct({t:1,v:1})),..._];case"LEFT":case"RIGHT":{const mt=tt(0,null)[0],xt=Ct({f:2,t:1,v:1},{specialFields:!0}),At=it(mt),Rt=[Pt(mt,{t:null,v:null,f:xt.f&&xt.f.length>0&&xt.f[0]!=="%"?xt.f[0]==="%@"?At.v?["%"+At.v[0].slice(1)]:void 0:xt.f:void 0}),Pt(Ft.args[0],{t:null,f:xt.f&&xt.f.length>1&&xt.f[1]!=="%"?xt.f:void 0})];return[Pt({prim:"or",args:Ft.prim==="LEFT"?Rt:[Rt[1],Rt[0]]},{t:xt.t,v:xt.v}),..._.slice(1)]}case"NIL":return assertTypeAnnotationsValid(Ft.args[0]),[Pt({prim:"list",args:[Ft.args[0]]},Ct({t:1,v:1})),..._];case"UNPACK":return tt(0,["bytes"]),assertTypeAnnotationsValid(Ft.args[0]),[$t({prim:"option",args:[Ft.args[0]]},"@unpacked"),..._.slice(1)];case"CONTRACT":{const mt=tt(0,["address"])[0];assertTypeAnnotationsValid(Ft.args[0]);const xt=Ct({v:1,f:1}),At=mt[refContract];if(At!==void 0){const Rt=contractEntryPoint(At,(vt=xt.f)===null||vt===void 0?void 0:vt[0]);if(Rt===null)throw new MichelsonInstructionError(Ft,_,`${Ft.prim}: contract has no entrypoint ${Rt}`);ot(Rt,Ft.args[0])}return[Pt({prim:"option",args:[{prim:"contract",args:[Ft.args[0]]}]},{v:xt.v?xt.v:Ot(it(mt),"contract")}),..._.slice(1)]}case"CAST":{Ct({});const mt=tt(0,null)[0];return assertTypeAnnotationsValid(Ft.args[0]),ot(Ft.args[0],mt),[Ft.args[0],..._.slice(1)]}case"IF_NONE":{Ct({});const mt=tt(0,["option"])[0],xt=_.slice(1),At=functionTypeInternal(Ft.args[0],xt,$),Rt=functionTypeInternal(Ft.args[1],[Pt(mt.args[0],{t:null,v:Ot(it(mt),"some")}),...xt],$);return It(At,Rt)}case"IF_LEFT":{Ct({});const mt=tt(0,["or"])[0],xt=it(mt),At=it(mt.args[0]),Rt=it(mt.args[1]),St=_.slice(1),Tt=functionTypeInternal(Ft.args[0],[Pt(mt.args[0],{t:null,v:Ot(xt,At.f?At.f[0].slice(1):"left")}),...St],$),Et=functionTypeInternal(Ft.args[1],[Pt(mt.args[1],{t:null,v:Ot(xt,Rt.f?Rt.f[0].slice(1):"right")}),...St],$);return It(Tt,Et)}case"IF_CONS":{Ct({});const mt=tt(0,["list"])[0],xt=it(mt),At=_.slice(1),Rt=functionTypeInternal(Ft.args[0],[Pt(mt.args[0],{t:null,v:Ot(xt,"hd")}),Pt(mt,{t:null,v:Ot(xt,"tl")}),...At],$),St=functionTypeInternal(Ft.args[1],At,$);return It(Rt,St)}case"IF":{Ct({}),tt(0,["bool"]);const mt=_.slice(1),xt=functionTypeInternal(Ft.args[0],mt,$),At=functionTypeInternal(Ft.args[1],mt,$);return It(xt,At)}case"MAP":{const mt=tt(0,["list","map","option"])[0],xt=_.slice(1),At=mt.prim==="map"?{prim:"pair",args:mt.args}:mt.args[0],Rt=functionTypeInternal(Ft.args[0],[Pt(At,{t:null,v:Ot(it(mt),"elt")}),...xt],$);if("failed"in Rt){if(!("prim"in Rt.failed)||Rt.failed.prim!=="never")throw new MichelsonInstructionError(Ft,_,`${Ft.prim}: FAIL is not allowed in MAP`);return{failed:Rt.failed,level:Rt.level+1}}if(Rt.length<1)throw new MichelsonInstructionError(Ft,_,`${Ft.prim}: function must return a value`);return st(Rt.slice(1),xt),mt.prim==="list"?[$t({prim:"list",args:[Rt[0]]}),...xt]:mt.prim==="map"?[$t({prim:"map",args:[mt.args[0],Rt[0]]}),...xt]:[$t({prim:"option",args:[Rt[0]]}),...xt]}case"ITER":{Ct({});const mt=tt(0,["set","list","map"])[0],xt=_.slice(1),At=mt.prim==="map"?{prim:"pair",args:mt.args}:mt.args[0],Rt=functionTypeInternal(Ft.args[0],[Pt(At,{t:null,v:Ot(it(mt),"elt")}),...xt],$);return"failed"in Rt?{failed:Rt.failed,level:Rt.level+1}:(st(Rt,xt),xt)}case"LOOP":{Ct({}),tt(0,["bool"]);const mt=_.slice(1),xt=functionTypeInternal(Ft.args[0],mt,$);return"failed"in xt?{failed:xt.failed,level:xt.level+1}:(st(xt,[{prim:"bool"},...mt]),mt)}case"LOOP_LEFT":{Ct({});const mt=tt(0,["or"])[0],xt=_.slice(1),At=functionTypeInternal(Ft.args[0],[Pt(mt.args[0],{t:null,v:Ot(it(mt),"left")}),...xt],$);return"failed"in At?{failed:At.failed,level:At.level+1}:(st(At,[mt,...xt]),[Pt(mt.args[1],{t:null,v:Ct({v:1}).v}),...xt])}case"DIP":{Ct({});const mt=Ft.args.length===2?parseInt(Ft.args[0].int,10):1;tt(mt-1,null);const xt=_.slice(0,mt),At=_.slice(mt),Rt=Ft.args.length===2?functionTypeInternal(Ft.args[1],At,$):functionTypeInternal(Ft.args[0],At,$);return"failed"in Rt?{failed:Rt.failed,level:Rt.level+1}:[...xt,...Rt]}case"CREATE_CONTRACT":{const mt=Ct({v:2}),xt=tt(0,["option"],["mutez"],null);if(typeID(xt[0].args[0])!=="key_hash")throw new MichelsonInstructionError(Ft,_,`${Ft.prim}: key hash expected: ${typeID(xt[0].args[0])}`);ht(xt[2])&&(assertContractValid(Ft.args[0]),assertScalarTypesEqual(contractSection(Ft.args[0],"storage").args[0],xt[2]));const At=(ct=mt.v)===null||ct===void 0?void 0:ct.map(Rt=>Rt!=="@"?[Rt]:void 0);return[Pt({prim:"operation"},{v:At==null?void 0:At[0]}),Pt({prim:"address",[refContract]:{prim:"contract",args:[contractSection(Ft.args[0],"parameter").args[0]]}},{v:At==null?void 0:At[1]}),..._.slice(3)]}case"PUSH":return assertTypeAnnotationsValid(Ft.args[0]),assertDataValidInternal(Ft.args[1],Ft.args[0],Object.assign(Object.assign({},$),{contract:void 0})),[$t(Ft.args[0]),..._];case"EMPTY_SET":return assertTypeAnnotationsValid(Ft.args[0]),at(Ft.args[0]),[Pt({prim:"set",args:Ft.args},Ct({t:1,v:1})),..._];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})),..._];case"EMPTY_BIG_MAP":return assertTypeAnnotationsValid(Ft.args[0]),at(Ft.args[0]),assertTypeAnnotationsValid(Ft.args[1]),wt(Ft.args[0]),[Pt({prim:"big_map",args:Ft.args},Ct({t:1,v:1})),..._];case"LAMBDA_REC":case"LAMBDA":{assertTypeAnnotationsValid(Ft.args[0]),assertTypeAnnotationsValid(Ft.args[1]);const mt=[Ft.args[0]];Ft.prim==="LAMBDA_REC"&&mt.push({prim:"lambda",args:[Ft.args[0],Ft.args[1]]});const xt=functionTypeInternal(Ft.args[2],mt,Object.assign(Object.assign({},$),{contract:void 0}));if("failed"in xt)return{failed:xt.failed,level:xt.level+1};if(xt.length!==1)throw new MichelsonInstructionError(Ft,_,`${Ft.prim}: function must return a value`);return ot(Ft.args[1],xt[0]),[$t({prim:"lambda",args:[Ft.args[0],Ft.args[1]]}),..._]}case"LEVEL":return[$t({prim:"nat"},"@level"),..._];case"TOTAL_VOTING_POWER":return[$t({prim:"nat"}),..._];case"VOTING_POWER":return tt(0,["key_hash"]),[$t({prim:"nat"}),..._.slice(1)];case"TICKET":{const mt=tt(0,null,["nat"])[0];return at(mt),ProtoInferiorTo(j,Protocol.PtLimaPtL)?[Pt({prim:"ticket",args:[mt]},Ct({t:1,v:1})),..._.slice(2)]:[$t({prim:"option",args:[Pt({prim:"ticket",args:[mt]},Ct({t:1,v:1}))]}),..._.slice(2)]}case"JOIN_TICKETS":{const mt=unpackComb("pair",tt(0,["pair"])[0]);if(typeID(mt.args[0])!=="ticket")throw new MichelsonInstructionError(Ft,_,`${Ft.prim}: ticket expected: ${typeID(mt.args[0])}`);return ot(mt.args[0],mt.args[1]),[$t({prim:"option",args:[Pt(mt.args[0],{t:null})]}),..._.slice(1)]}case"SPLIT_TICKET":{const mt=tt(0,["ticket"],["pair"]),xt=unpackComb("pair",mt[1]);if(typeID(xt.args[0])!=="nat")throw new MichelsonInstructionError(Ft,_,`${Ft.prim}: nat expected: ${typeID(xt.args[0])}`);return ot(xt.args[0],xt.args[1]),[$t({prim:"option",args:[{prim:"pair",args:[Pt(mt[0],{t:null}),Pt(mt[0],{t:null})]}]}),..._.slice(2)]}case"READ_TICKET":{const mt=Ct({v:2}),xt=tt(0,["ticket"])[0],At=(dt=mt.v)===null||dt===void 0?void 0:dt.map(Rt=>Rt!=="@"?[Rt]:void 0);return[Pt({prim:"pair",args:[{prim:"address"},Pt(xt.args[0],{t:null}),{prim:"nat"}]},{v:At==null?void 0:At[0]}),Pt(xt,{v:At==null?void 0:At[1],t:null}),..._.slice(1)]}case"PAIRING_CHECK":{const mt=tt(0,["list"])[0].args[0];if(!isPairType(mt))throw new MichelsonInstructionError(Ft,_,`${Ft.prim}: pair expected: ${typeID(mt)}`);const xt=unpackComb("pair",mt);if(typeID(xt.args[0])!=="bls12_381_g1")throw new MichelsonInstructionError(Ft,_,`${Ft.prim}: bls12_381_g1 expected: ${typeID(xt.args[0])}`);if(typeID(xt.args[1])!=="bls12_381_g2")throw new MichelsonInstructionError(Ft,_,`${Ft.prim}: bls12_381_g2 expected: ${typeID(xt.args[1])}`);return[$t({prim:"bool"}),..._.slice(1)]}case"SAPLING_EMPTY_STATE":return[Pt({prim:"sapling_state",args:[Ft.args[0]]},Ct({v:1,t:1})),..._];case"SAPLING_VERIFY_UPDATE":{const mt=tt(0,["sapling_transaction"],["sapling_state"]);if(parseInt(mt[0].args[0].int,10)!==parseInt(mt[1].args[0].int,10))throw new MichelsonInstructionError(Ft,_,`${Ft.prim}: sapling memo size mismatch: ${mt[0].args[0].int} != ${mt[1].args[0].int}`);return ProtoInferiorTo(j,Protocol.PtJakarta)?[$t({prim:"option",args:[{prim:"pair",args:[{prim:"int"},Pt(mt[1],{t:null})]}]}),..._.slice(2)]:[$t({prim:"option",args:[{prim:"pair",args:[{prim:"bytes"},{prim:"pair",args:[{prim:"int"},Pt(mt[1],{t:null})]}]}]}),..._.slice(2)]}case"OPEN_CHEST":return tt(0,["chest_key"],["chest"],["nat"]),[$t({prim:"or",args:[{prim:"bytes"},{prim:"bool"}]}),..._.slice(3)];case"VIEW":{const mt=tt(0,null,["address"]);return yt(mt[0]),[$t({prim:"option",args:[Ft.args[1]]}),..._.slice(2)]}case"MIN_BLOCK_TIME":return[$t({prim:"nat"}),..._];case"EMIT":{const mt=Ct({f:1,t:1});if(Ft.args){const xt=tt(0,null);return ot(xt[0],Ft.args[0]),[Pt({prim:"operation"},mt),..._.slice(1)]}return[Pt({prim:"operation"},mt),..._.slice(1)]}default:throw new MichelsonError(Ft,`unexpected instruction: ${Ft.prim}`)}})(et);if(($==null?void 0:$.traceCallback)!==void 0){const Ft={op:et,in:_,out:Bt};$.traceCallback(Ft)}return Bt}function contractSection(a,_){for(const $ of a)if($.prim===_)return $;throw new MichelsonError(a,`missing contract section: ${_}`)}function contractViews(a){const _={};for(const $ of a)$.prim==="view"&&(_[$.args[0].string]=$);return _}function isContract(a){if(Array.isArray(a)){for(const _ of a)if("prim"in _&&(_.prim==="parameter"||_.prim==="storage"||_.prim==="code"))return!0}return!1}function contractEntryPoint(a,_){_=_||"%default";const $=contractEntryPoints(a).find(j=>j[0]===_);return $!==void 0?$[1]:_==="%default"?isContract(a)?contractSection(a,"parameter").args[0]:a:null}function isOrType(a){return Array.isArray(a)||a.prim==="or"}function contractEntryPoints(a){if(isContract(a)){const _=contractSection(a,"parameter"),$=contractEntryPoints(_.args[0]),j=unpackAnnotations(_);return j.f?[[j.f[0],_.args[0]],...$]:$}if(isOrType(a)){const _=typeArgs(a),$=j=>{const et=unpackAnnotations(_[j]);if(typeID(_[j])==="or"){const tt=contractEntryPoints(_[j]);return et.f?[[et.f[0],_[j]],...tt]:tt}return et.f?[[et.f[0],_[j]]]:[]};return[...$(0),...$(1)]}return[]}function assertContractValid(a,_){const $=(it,st,ot,at)=>{assertTypeAnnotationsValid(it,!0),assertTypeAnnotationsValid(st);const ut={prim:"pair",args:[Object.assign(Object.assign({},it),{annots:["@parameter"]}),Object.assign(Object.assign({},st),{annots:["@storage"]})]},ht=functionTypeInternal(at,[ut],Object.assign(Object.assign({},_),{contract:a}));if("failed"in ht)return ht;try{assertStacksEqual(ht,[ot])}catch(yt){throw yt instanceof MichelsonError?new MichelsonInstructionError(at,ht,yt.message):yt}return ht},j=contractSection(a,"parameter").args[0],et=contractSection(a,"storage").args[0],tt=contractSection(a,"code").args[0],nt=$(j,et,{prim:"pair",args:[{prim:"list",args:[{prim:"operation"}]},et]},tt);for(const it of Object.values(contractViews(a)))$(it.args[1],et,it.args[2],it.args[3]);return nt}function assertDataValid(a,_,$){assertTypeAnnotationsValid(_),assertDataValidInternal(a,_,$||null)}function functionType(a,_,$){for(const j of _)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(_,$){this.contract=_,this.ctx=Object.assign({contract:_},$),this.output=assertContractValid(_,this.ctx)}static parse(_,$){const j=new Parser$1($),et=typeof _=="string"?j.parseScript(_):j.parseJSON(_);if(et===null)throw new InvalidMichelsonError("empty Michelson");if(assertMichelsonContract(et))return new Contract(et,$)}static parseTypeExpression(_,$){const j=new Parser$1($),et=typeof _=="string"?j.parseScript(_):j.parseJSON(_);if(et===null)throw new InvalidTypeExpressionError("empty type expression");if(assertMichelsonType(et))return assertTypeAnnotationsValid(et),et}static parseDataExpression(_,$){const j=new Parser$1($),et=typeof _=="string"?j.parseScript(_):j.parseJSON(_);if(et===null)throw new InvalidDataExpressionError("empty data expression");if(assertMichelsonData(et))return et;throw void 0}section(_){return contractSection(this.contract,_)}entryPoints(){return contractEntryPoints(this.contract)}entryPoint(_){return contractEntryPoint(this.contract,_)}assertDataValid(_,$){assertDataValid(_,$,this.ctx)}isDataValid(_,$){return isDataValid(_,$,this.ctx)}assertParameterValid(_,$){const j=this.entryPoint(_||void 0);if(j===null)throw new InvalidEntrypointError(_==null?void 0:_.toString());this.assertDataValid($,j)}isParameterValid(_,$){try{return this.assertParameterValid(_,$),!0}catch{return!1}}functionType(_,$){return functionType(_,$,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=a=>a.reduce((_,$)=>_+$.toString(16).padStart(2,"0"),""),pad=(a,_=8)=>a.toString(16).padStart(_,"0"),ENTRYPOINT_MAX_LENGTH=31;var CODEC;(function(a){a.SECRET="secret",a.RAW="raw",a.TZ1="tz1",a.BRANCH="branch",a.ZARITH="zarith",a.PUBLIC_KEY="public_key",a.PKH="pkh",a.PKH_ARR="pkhArr",a.DELEGATE="delegate",a.SCRIPT="script",a.BALLOT_STATEMENT="ballotStmt",a.PROPOSAL="proposal",a.PROPOSAL_ARR="proposalArr",a.INT32="int32",a.INT16="int16",a.PARAMETERS="parameters",a.ADDRESS="address",a.SMART_CONTRACT_ADDRESS="smart_contract_address",a.SMART_ROLLUP_ADDRESS="smart_rollup_address",a.SMART_ROLLUP_COMMITMENT_HASH="smart_rollup_commitment_hash",a.VALUE="value",a.PADDED_BYTES="padded_bytes",a.SMART_ROLLUP_MESSAGE="smart_rollup_message",a.MANAGER="manager",a.BLOCK_PAYLOAD_HASH="blockPayloadHash",a.ENTRYPOINT="entrypoint",a.OPERATION="operation",a.OP_ACTIVATE_ACCOUNT="activate_account",a.OP_DELEGATION="delegation",a.OP_TRANSACTION="transaction",a.OP_ORIGINATION="origination",a.OP_BALLOT="ballot",a.OP_FAILING_NOOP="failing_noop",a.OP_ATTESTATION="attestation",a.OP_ENDORSEMENT="endorsement",a.OP_SEED_NONCE_REVELATION="seed_nonce_revelation",a.OP_REVEAL="reveal",a.OP_PROPOSALS="proposals",a.OP_REGISTER_GLOBAL_CONSTANT="register_global_constant",a.OP_TRANSFER_TICKET="transfer_ticket",a.BURN_LIMIT="burn_limit",a.OP_INCREASE_PAID_STORAGE="increase_paid_storage",a.OP_UPDATE_CONSENSUS_KEY="update_consensus_key",a.OP_DRAIN_DELEGATE="drain_delegate",a.DEPOSITS_LIMIT="deposits_limit",a.OP_SET_DEPOSITS_LIMIT="set_deposits_limit",a.OP_SMART_ROLLUP_ORIGINATE="smart_rollup_originate",a.PVM_KIND="pvm_kind",a.OP_SMART_ROLLUP_ADD_MESSAGES="smart_rollup_add_messages",a.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 a={};return Object.keys(opMapping).forEach(_=>{a[opMapping[_]]=_}),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 a={};return Object.keys(kindMapping).forEach(_=>{const $=typeof _=="string"?parseInt(_,10):_;a[kindMapping[$]]=pad($,2)}),a})(),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 a={};return Object.keys(entrypointMapping).forEach(_=>{a[entrypointMapping[_]]=_}),a})();class InvalidOperationSchemaError extends ParameterValidationError{constructor(_,$){super(),this.operation=_,this.errorDetail=$,this.name="InvalidOperationSchemaError",this.message="Invalid operation content recevied",$&&(this.message+=` ${$}.`)}}class OversizedEntryPointError extends ParameterValidationError{constructor(_){super(),this.entrypoint=_,this.name="OversizedEntryPointError",this.message=`Invalid entrypoint length "${_.length}", maximum length is "${ENTRYPOINT_MAX_LENGTH}".`}}class InvalidBallotValueError extends ParameterValidationError{constructor(_){super(),this.ballotValue=_,this.name="InvalidBallotValueError",this.message=`Invalid ballot value "${_}" expecting one of the following: "yay", "nay", "pass".`}}class DecodeBallotValueError extends ParameterValidationError{constructor(_){super(),this.ballotValue=_,this.name="DecodeBallotValueError",this.message=`Invalid ballot value "${_}", cannot be decoded.`}}class UnexpectedMichelsonValueError extends ParameterValidationError{constructor(_){super(),this.value=_,this.name="UnexpectedMichelsonValueError",this.message=`Invalid Michelson value "${_}", unalbe to encode.`}}class OperationDecodingError extends ParameterValidationError{constructor(_){super(),this.message=_,this.name="OperationDecodingError"}}class OperationEncodingError extends ParameterValidationError{constructor(_){super(),this.message=_,this.name="OperationEncodingError"}}class UnsupportedOperationError extends ParameterValidationError{constructor(_){super(),this.op=_,this.name="UnsupportedOperationError",this.message=`Unsupported operation "${_}", can submit an issue on our github for feature request.`}}class UnsupportedPvmKindError extends ParameterValidationError{constructor(_){super(),this.pvm=_,this.name="UnsupportedPvmKindError",this.message=`Invalid Pvm kind "${_}" expecting either "arith" or "wasm_2_0_0".`}}class DecodePvmKindError extends ParameterValidationError{constructor(_){super(),this.pvm=_,this.name="DecodePvmKindError",this.message=`Invalid Pvm kind "${_}", cannot be decoded.`}}class InvalidSmartRollupAddressError extends ParameterValidationError{constructor(_,$){super(),this.address=_,this.errorDetail=$,this.name="InvalidSmartRollupAddress",this.message=`Invalid smart rollup address "${_}"`,$&&(this.message+=` ${$}.`)}}class InvalidSmartRollupCommitmentHashError extends ParameterValidationError{constructor(_,$){super(),this.hash=_,this.errorDetail=$,this.name="InvalidSmartRollupCommitmentHashError",this.message=`Invalid smart rollup commitment hash "${_}"`,$&&(this.message+=` ${$}.`)}}class Uint8ArrayConsumer{static fromHexString(_){const $=_.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(_,$=0){this.arr=_,this.offset=$}consume(_){const $=this.arr.subarray(this.offset,this.offset+_);return this.offset+=_,$}get(_){return this.arr[this.offset+_]}length(){return this.arr.length-this.offset}slice(_,$){return new Uint8ArrayConsumer(this.arr.slice(_,$))}}const isPrim=a=>"prim"in a,isBytes=a=>"bytes"in a&&typeof a.bytes=="string",isString=a=>"string"in a&&typeof a.string=="string",isInt=a=>"int"in a&&typeof a.int=="string",scriptEncoder=a=>{const _=valueEncoder(a.code),$=valueEncoder(a.storage);return`${pad(_.length/2,8)}${_}${pad($.length/2,8)}${$}`},scriptDecoder=a=>{const _=extractRequiredLen(a),$=extractRequiredLen(a);return{code:valueDecoder(new Uint8ArrayConsumer(_)),storage:valueDecoder(new Uint8ArrayConsumer($))}},valueEncoder=a=>{if(Array.isArray(a)){const _=a.map(j=>valueEncoder(j)).join(""),$=_.length/2;return`02${pad($)}${_}`}else{if(isPrim(a))return primEncoder(a);if(isBytes(a))return bytesEncoder(a);if(isString(a))return stringEncoder(a);if(isInt(a))return intEncoder(a)}throw new UnexpectedMichelsonValueError(JSON.stringify(a))},valueDecoder=a=>{const _=a.consume(1);switch(_[0]){case 10:return bytesDecoder(a);case 1:return stringDecoder(a);case 0:return intDecoder(a);case 2:{const $=new Uint8ArrayConsumer(extractRequiredLen(a)),j=[];for(;$.length()>0;)j.push(valueDecoder($));return j}default:return primDecoder(a,_)}},extractRequiredLen=(a,_=4)=>{const $=a.consume(_),j=parseInt(Buffer$g.from($).toString("hex"),16);return a.consume(j)},stripLengthPrefixFromBytes=(a,_=4)=>{const $=[];let j=a;for(;j.length();){const et=j.consume(_),tt=parseInt(Buffer$g.from(et).toString("hex"),16);$.push(j.consume(tt)),j=j.slice(tt+_)}return $},bytesEncoder=a=>{if(!/^([A-Fa-f0-9]{2})*$/.test(a.bytes))throw new InvalidHexStringError(a.bytes);const _=a.bytes.length/2;return`0a${pad(_)}${a.bytes}`},bytesDecoder=a=>{const _=extractRequiredLen(a);return{bytes:Buffer$g.from(_).toString("hex")}},stringEncoder=a=>{const _=Buffer$g.from(a.string,"utf8").toString("hex"),$=_.length/2;return`01${pad($)}${_}`},stringDecoder=a=>{const _=extractRequiredLen(a);return{string:Buffer$g.from(_).toString("utf8")}},intEncoder=({int:a})=>{const _=new BigNumber(a,10),$=_.toString(2)[0]==="-"?"1":"0",j=_.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,st)=>parseInt((st===rt.length-1?"0":"1")+it,2).toString(16).padStart(2,"0")).join("")}`},intDecoder=a=>{let _=a.consume(1)[0];const $=[],j=128;for(;_&j;)$.push(_),_=a.consume(1)[0];$.push(_);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=a=>{const _=+Array.isArray(a.annots),$=Array.isArray(a.args)?a.args.length:0,j=pad(Math.min(2*$+_+3,9),2),et=opMappingReverse[a.prim];let tt=(a.args||[]).map(nt=>valueEncoder(nt)).join("");const rt=Array.isArray(a.annots)?encodeAnnots(a.annots):"";return(a.prim==="LAMBDA"||a.prim==="LAMBDA_REC")&&$&&(tt=pad(tt.length/2)+tt+pad(0)),(a.prim==="pair"||a.prim==="Pair")&&$>2&&(tt=rt===""?pad(tt.length/2)+tt+pad(0):pad(tt.length/2)+tt),a.prim==="view"&&a.args&&(tt=pad(tt.length/2)+tt+pad(0)),`${j}${et}${tt}${rt}`},primDecoder=(a,_)=>{const $=(_[0]-3)%2===1;let j=Math.floor((_[0]-3)/2);const et=a.consume(1)[0].toString(16).padStart(2,"0"),tt={prim:opMapping[et]};if((opMapping[et]==="LAMBDA"||opMapping[et]==="LAMBDA_REC")&&a.consume(4),opMapping[et]==="view")return j!=0?primViewDecoder(a,tt):tt;let rt,nt;(opMapping[et]==="pair"||opMapping[et]==="Pair")&&j>2&&(rt=decodeCombPair(a),j=0,nt=decodeAnnots(a));const it=new Array(j).fill(0).map(()=>valueDecoder(a));return(opMapping[et]==="LAMBDA"||opMapping[et]==="LAMBDA_REC")&&a.consume(4),rt?tt.args=rt:it.length&&(tt.args=it),nt&&nt[0]!==""?tt.annots=nt:$&&(tt.annots=decodeAnnots(a)),tt},primViewDecoder=(a,_)=>(a.consume(4),_.args=new Array(4).fill(0).map(()=>valueDecoder(a)),a.consume(4),_),decodeCombPair=a=>{const _=new Uint8ArrayConsumer(extractRequiredLen(a)),$=[];for(;_.length()>0;)$.push(valueDecoder(_));return $},encodeAnnots=a=>{const _=a.map(j=>Buffer$g.from(j,"utf8").toString("hex")).join("20"),$=_.length/2;return`${pad($)}${_}`},decodeAnnots=a=>{const _=a.consume(4),$=parseInt(Buffer$g.from(_).toString("hex"),16),j=a.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(_,prefix[a]))),prefixDecoder=a=>_=>{const $=_.consume(prefixLength[a]);return b58cencode($,prefix[a])},tz1Decoder=prefixDecoder(Prefix.TZ1),branchDecoder=prefixDecoder(Prefix.B),publicKeyHashDecoder=a=>{const _=a.consume(1);if(_[0]===0)return prefixDecoder(Prefix.TZ1)(a);if(_[0]===1)return prefixDecoder(Prefix.TZ2)(a);if(_[0]===2)return prefixDecoder(Prefix.TZ3)(a)},publicKeyHashesDecoder=a=>{if(!boolDecoder(a))return;const _=[];for(a.consume(4);a.length()>0;)_.push(publicKeyHashDecoder(a));return _},branchEncoder=prefixEncoder(Prefix.B),tz1Encoder=prefixEncoder(Prefix.TZ1),boolEncoder=a=>a?"ff":"00",proposalEncoder=a=>prefixEncoder(Prefix.P)(a),proposalDecoder=a=>prefixDecoder(Prefix.P)(a),proposalsDecoder=a=>{const _=[];for(a.consume(4);a.length()>0;)_.push(proposalDecoder(a));return _},proposalsEncoder=a=>pad(32*a.length)+a.map(_=>proposalEncoder(_)).join(""),ballotEncoder=a=>{switch(a){case"yay":return"00";case"nay":return"01";case"pass":return"02";default:throw new InvalidBallotValueError(a)}},ballotDecoder=a=>{const _=a.consume(1);switch(_[0]){case 0:return"yay";case 1:return"nay";case 2:return"pass";default:throw new DecodeBallotValueError(_[0].toString())}},pvmKindEncoder=a=>{switch(a){case"arith":return"00";case"wasm_2_0_0":return"01";case"riscv":return"02";default:throw new UnsupportedPvmKindError(a)}},pvmKindDecoder=a=>{const _=a.consume(1);switch(_[0]){case 0:return"arith";case 1:return"wasm_2_0_0";case 2:return"riscv";default:throw new DecodePvmKindError(_[0].toString())}},delegateEncoder=a=>a?boolEncoder(!0)+publicKeyHashEncoder(a):boolEncoder(!1),int32Encoder=a=>{const _=parseInt(String(a),10),$=[];for(let j=0;j<4;j++){const et=(4-(j+1))*8;$.push((_&255<>et)}return Buffer$g.from($).toString("hex")},int32Decoder=a=>{const _=a.consume(4);let $=0;for(let j=0;j<_.length;j++)$=$|_[j]<<(_.length-(j+1))*8;return $},int16Encoder=a=>{const _=parseInt(String(a),10),$=[];for(let j=0;j<2;j++){const et=(2-(j+1))*8;$.push((_&255<>et)}return Buffer$g.from($).toString("hex")},int16Decoder=a=>{const _=a.consume(2);let $=0;for(let j=0;j<_.length;j++)$=$|_[j]<<(_.length-(j+1))*8;return $},boolDecoder=a=>a.consume(1)[0]===255,delegateDecoder=a=>{if(boolDecoder(a))return publicKeyHashDecoder(a)},publicKeyHashEncoder=a=>{switch(a.substring(0,3)){case Prefix.TZ1:return"00"+prefixEncoder(Prefix.TZ1)(a);case Prefix.TZ2:return"01"+prefixEncoder(Prefix.TZ2)(a);case Prefix.TZ3:return"02"+prefixEncoder(Prefix.TZ3)(a);case Prefix.TZ4:return"03"+prefixEncoder(Prefix.TZ4)(a);default:throw new InvalidKeyHashError(a,invalidDetail(ValidationResult.NO_PREFIX_MATCHED)+` expecting one for the following "${Prefix.TZ1}", "${Prefix.TZ2}", "${Prefix.TZ3}" or "${Prefix.TZ4}".`)}},publicKeyHashesEncoder=a=>{if(!a)return boolEncoder(!1);if(a.length===0)return boolEncoder(!0)+pad(0);const _=a.reduce(($,j)=>$+publicKeyHashEncoder(j),"");return boolEncoder(!0)+pad(_.length/2)+_},publicKeyEncoder=a=>{switch(a.substring(0,4)){case Prefix.EDPK:return"00"+prefixEncoder(Prefix.EDPK)(a);case Prefix.SPPK:return"01"+prefixEncoder(Prefix.SPPK)(a);case Prefix.P2PK:return"02"+prefixEncoder(Prefix.P2PK)(a);default:throw new InvalidPublicKeyError(a,invalidDetail(ValidationResult.NO_PREFIX_MATCHED)+` expecting one of the following '${Prefix.EDPK}', '${Prefix.SPPK}', '${Prefix.P2PK}' or '${Prefix.BLPK}'.`)}},addressEncoder=a=>{switch(a.substring(0,3)){case Prefix.TZ1:case Prefix.TZ2:case Prefix.TZ3:case Prefix.TZ4:return"00"+publicKeyHashEncoder(a);case Prefix.KT1:return"01"+prefixEncoder(Prefix.KT1)(a)+"00";default:throw new InvalidAddressError(a,invalidDetail(ValidationResult.NO_PREFIX_MATCHED)+` expecting one of the following prefix '${Prefix.TZ1}', ${Prefix.TZ2}', '${Prefix.TZ3}', '${Prefix.TZ4}' or '${Prefix.KT1}'.`)}},smartRollupAddressEncoder=a=>{if(a.substring(0,3)!==Prefix.SR1)throw new InvalidSmartRollupAddressError(a,invalidDetail(ValidationResult.NO_PREFIX_MATCHED)+` expecting prefix '${Prefix.SR1}'.`);return prefixEncoder(Prefix.SR1)(a)},smartContractAddressEncoder=a=>{if(a.substring(0,3)===Prefix.KT1)return"01"+prefixEncoder(Prefix.KT1)(a)+"00";throw new InvalidContractAddressError(a,invalidDetail(ValidationResult.NO_PREFIX_MATCHED)+` expecting prefix '${Prefix.KT1}'.`)},publicKeyDecoder=a=>{switch(a.consume(1)[0]){case 0:return prefixDecoder(Prefix.EDPK)(a);case 1:return prefixDecoder(Prefix.SPPK)(a);case 2:return prefixDecoder(Prefix.P2PK)(a);default:throw new InvalidPublicKeyError(a.toString(),invalidDetail(ValidationResult.NO_PREFIX_MATCHED))}},smartRollupCommitmentHashEncoder=a=>{if(a.substring(0,4)===Prefix.SRC1)return prefixEncoder(Prefix.SRC1)(a);throw new InvalidSmartRollupCommitmentHashError(a,invalidDetail(ValidationResult.NO_PREFIX_MATCHED)+` expecting prefix '${Prefix.SRC1}'`)},addressDecoder=a=>{switch(a.consume(1)[0]){case 0:return publicKeyHashDecoder(a);case 1:{const $=prefixDecoder(Prefix.KT1)(a);return a.consume(1),$}default:throw new InvalidAddressError(a.toString(),": Unable to decode.")}},smartRollupAddressDecoder=a=>{const _=prefixDecoder(Prefix.SR1)(a);if(_.substring(0,3)!==Prefix.SR1)throw new InvalidSmartRollupAddressError(_,invalidDetail(ValidationResult.NO_PREFIX_MATCHED)+` expecting prefix '${Prefix.SR1}'.`);return _},smartContractAddressDecoder=a=>{if(a.consume(1)[0]===1){const $=prefixDecoder(Prefix.KT1)(a);return a.consume(1),$}throw new InvalidContractAddressError(a.toString(),invalidDetail(ValidationResult.NO_PREFIX_MATCHED))},smartRollupCommitmentHashDecoder=a=>{const _=prefixDecoder(Prefix.SRC1)(a);if(_.substring(0,4)!==Prefix.SRC1)throw new InvalidSmartRollupCommitmentHashError(_,invalidDetail(ValidationResult.NO_PREFIX_MATCHED)+` expecting prefix '${Prefix.SRC1}'`);return _},zarithEncoder=a=>{const _=[];let $=new BigNumber(a,10);if($.isNaN())throw new TypeError(`Invalid zarith number ${a}`);for(;;)if($.lt(128)){$.lt(16)&&_.push("0"),_.push($.toString(16));break}else{let j=$.mod(128);$=$.minus(j),$=$.dividedBy(128),j=j.plus(128),_.push(j.toString(16))}return _.join("")},zarithDecoder=a=>{let _=0;for(;_=0;j-=1){const et=a.get(j)&127;$=$.multipliedBy(128),$=$.plus(et)}return a.consume(_+1),new BigNumber($).toString()},entrypointDecoder=a=>{const _=pad(a.consume(1)[0],2);if(_ in entrypointMapping)return entrypointMapping[_];{const $=extractRequiredLen(a,1),j=Buffer$g.from($).toString("utf8");if(j.length>ENTRYPOINT_MAX_LENGTH)throw new OversizedEntryPointError(j);return j}},parametersDecoder=a=>{if(a.consume(1)[0]!==0){const $=entrypointDecoder(a),j=extractRequiredLen(a),et=valueDecoder(new Uint8ArrayConsumer(j));return{entrypoint:$,value:et}}},entrypointEncoder=a=>{if(a in entrypointMappingReverse)return`${entrypointMappingReverse[a]}`;if(a.length>ENTRYPOINT_MAX_LENGTH)throw new OversizedEntryPointError(a);return`ff${valueEncoder({string:a}).slice(8)}`},parametersEncoder=a=>{if(!a||a.entrypoint==="default"&&"prim"in a.value&&a.value.prim==="Unit")return"00";const _=entrypointEncoder(a.entrypoint),$=valueEncoder(a.value),j=($.length/2).toString(16).padStart(8,"0");return`ff${_}${j}${$}`},valueParameterEncoder=a=>{const _=valueEncoder(a);return`${pad(_.length/2)}${_}`},valueParameterDecoder=a=>{const _=extractRequiredLen(a);return valueDecoder(new Uint8ArrayConsumer(_))},blockPayloadHashEncoder=prefixEncoder(Prefix.VH),blockPayloadHashDecoder=prefixDecoder(Prefix.VH),entrypointNameEncoder=a=>`${valueEncoder({string:a}).slice(2)}`,entrypointNameDecoder=a=>{const _=extractRequiredLen(a);return Buffer$g.from(_).toString("utf8")},burnLimitEncoder=a=>a?`ff${zarithEncoder(a)}`:"00",burnLimitDecoder=a=>{const _=a.consume(1);if(Buffer$g.from(_).toString("hex")!=="00")return zarithDecoder(a)},depositsLimitEncoder=a=>a?`ff${zarithEncoder(a)}`:"00",depositsLimitDecoder=a=>{const _=a.consume(1);if(Buffer$g.from(_).toString("hex")!=="00")return zarithDecoder(a)},paddedBytesEncoder=(a,_=8)=>`${pad(a.length/2,_)}${a}`,paddedBytesDecoder=a=>{const _=extractRequiredLen(a);return Buffer$g.from(_).toString("hex")},smartRollupMessageEncoder=a=>{const _=a.reduce(($,j)=>$+`${pad(j.length/2)}${j}`,"");return`${pad(_.length/2)}${_}`},smartRollupMessageDecoder=a=>{const _=extractRequiredLen(a);return stripLengthPrefixFromBytes(new Uint8ArrayConsumer(_)).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(!(_.kind in a)||!(_.kind in kindMappingReverse))throw new InvalidOperationKindError(_.kind);return kindMappingReverse[_.kind]+a[_.kind](_)},operationDecoder=a=>_=>{const $=_.consume(1),j=kindMapping[$[0]];if(j===void 0)throw new UnsupportedOperationError($[0].toString());const et=a[j](_);if(typeof et!="object")throw new OperationDecodingError("Invalid operation, cannot be decoded.");return Object.assign({kind:j},et)},schemaEncoder=a=>_=>$=>Object.keys(_).reduce((et,tt)=>{const rt=_[tt];if($&&Array.isArray(rt)){const nt=a[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((st,ot)=>st+nt(ot),"")}else{const nt=a[rt];return et+nt($[tt])}},""),schemaDecoder=a=>_=>$=>Object.keys(_).reduce((et,tt)=>{const rt=_[tt];if(Array.isArray(rt)){const nt=a[rt[0]],it=[],st=$.length();for(;$.length()>0;)if(it.push(nt($)),st===$.length())throw new OperationDecodingError("Unable to decode value");return Object.assign(Object.assign({},et),{[tt]:it})}else{const nt=a[rt],it=nt($);return typeof it<"u"?Object.assign(Object.assign({},et),{[tt]:it}):Object.assign({},et)}},{}),decoders={[CODEC.SECRET]:a=>toHexString(a.consume(20)),[CODEC.RAW]:a=>toHexString(a.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]=a=>schemaDecoder(decoders)(ActivationSchema)(a);decoders[CODEC.OP_FAILING_NOOP]=a=>schemaDecoder(decoders)(FailingNoopSchema)(a);decoders[CODEC.OP_DELEGATION]=a=>schemaDecoder(decoders)(DelegationSchema)(a);decoders[CODEC.OP_TRANSACTION]=a=>schemaDecoder(decoders)(TransactionSchema)(a);decoders[CODEC.OP_ORIGINATION]=a=>schemaDecoder(decoders)(OriginationSchema)(a);decoders[CODEC.OP_BALLOT]=a=>schemaDecoder(decoders)(BallotSchema)(a);decoders[CODEC.OP_ATTESTATION]=a=>schemaDecoder(decoders)(AttestationSchema)(a);decoders[CODEC.OP_ENDORSEMENT]=a=>schemaDecoder(decoders)(EndorsementSchema)(a);decoders[CODEC.OP_SEED_NONCE_REVELATION]=a=>schemaDecoder(decoders)(SeedNonceRevelationSchema)(a);decoders[CODEC.OP_PROPOSALS]=a=>schemaDecoder(decoders)(ProposalsSchema)(a);decoders[CODEC.OP_REVEAL]=a=>schemaDecoder(decoders)(RevealSchema)(a);decoders[CODEC.OP_REGISTER_GLOBAL_CONSTANT]=a=>schemaDecoder(decoders)(RegisterGlobalConstantSchema)(a);decoders[CODEC.OP_TRANSFER_TICKET]=a=>schemaDecoder(decoders)(TransferTicketSchema)(a);decoders[CODEC.OP_INCREASE_PAID_STORAGE]=a=>schemaDecoder(decoders)(IncreasePaidStorageSchema)(a);decoders[CODEC.OP_UPDATE_CONSENSUS_KEY]=a=>schemaDecoder(decoders)(UpdateConsensusKeySchema)(a);decoders[CODEC.OP_DRAIN_DELEGATE]=a=>schemaDecoder(decoders)(DrainDelegateSchema)(a);decoders[CODEC.OP_SMART_ROLLUP_ORIGINATE]=a=>schemaDecoder(decoders)(SmartRollupOriginateSchema)(a);decoders[CODEC.OP_SMART_ROLLUP_ADD_MESSAGES]=a=>schemaDecoder(decoders)(SmartRollupAddMessagesSchema)(a);decoders[CODEC.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE]=a=>schemaDecoder(decoders)(SmartRollupExecuteOutboxMessageSchema)(a);decoders[CODEC.MANAGER]=schemaDecoder(decoders)(ManagerOperationSchema);decoders[CODEC.OP_SET_DEPOSITS_LIMIT]=a=>schemaDecoder(decoders)(SetDepositsLimitSchema)(a);const encoders={[CODEC.SECRET]:a=>a,[CODEC.RAW]:a=>a,[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]=a=>schemaEncoder(encoders)(ActivationSchema)(a);encoders[CODEC.OP_DELEGATION]=a=>schemaEncoder(encoders)(DelegationSchema)(a);encoders[CODEC.OP_TRANSACTION]=a=>schemaEncoder(encoders)(TransactionSchema)(a);encoders[CODEC.OP_ORIGINATION]=a=>schemaEncoder(encoders)(OriginationSchema)(a);encoders[CODEC.OP_BALLOT]=a=>schemaEncoder(encoders)(BallotSchema)(a);encoders[CODEC.OP_ATTESTATION]=a=>schemaEncoder(encoders)(AttestationSchema)(a);encoders[CODEC.OP_ENDORSEMENT]=a=>schemaEncoder(encoders)(EndorsementSchema)(a);encoders[CODEC.OP_SEED_NONCE_REVELATION]=a=>schemaEncoder(encoders)(SeedNonceRevelationSchema)(a);encoders[CODEC.OP_PROPOSALS]=a=>schemaEncoder(encoders)(ProposalsSchema)(a);encoders[CODEC.OP_REVEAL]=a=>schemaEncoder(encoders)(RevealSchema)(a);encoders[CODEC.OP_REGISTER_GLOBAL_CONSTANT]=a=>schemaEncoder(encoders)(RegisterGlobalConstantSchema)(a);encoders[CODEC.OP_TRANSFER_TICKET]=a=>schemaEncoder(encoders)(TransferTicketSchema)(a);encoders[CODEC.OP_INCREASE_PAID_STORAGE]=a=>schemaEncoder(encoders)(IncreasePaidStorageSchema)(a);encoders[CODEC.OP_UPDATE_CONSENSUS_KEY]=a=>schemaEncoder(encoders)(UpdateConsensusKeySchema)(a);encoders[CODEC.OP_DRAIN_DELEGATE]=a=>schemaEncoder(encoders)(DrainDelegateSchema)(a);encoders[CODEC.OP_SMART_ROLLUP_ORIGINATE]=a=>schemaEncoder(encoders)(SmartRollupOriginateSchema)(a);encoders[CODEC.OP_SMART_ROLLUP_ADD_MESSAGES]=a=>schemaEncoder(encoders)(SmartRollupAddMessagesSchema)(a);encoders[CODEC.OP_SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE]=a=>schemaEncoder(encoders)(SmartRollupExecuteOutboxMessageSchema)(a);encoders[CODEC.MANAGER]=schemaEncoder(encoders)(ManagerOperationSchema);encoders[CODEC.OP_SET_DEPOSITS_LIMIT]=a=>schemaEncoder(encoders)(SetDepositsLimitSchema)(a);encoders[CODEC.OP_FAILING_NOOP]=a=>schemaEncoder(encoders)(FailingNoopSchema)(a);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,_)=>_.filter($=>!a.includes($)),deleteArrayElementByValue=(a,_)=>a.filter($=>$!==_),validateOperationKind=a=>Object.keys(OperationKindMapping).includes(a),validateMissingProperty=a=>{const _=a.kind,$=Object.keys(a),j=deleteArrayElementByValue($,"kind"),et=Object.keys(OperationKindMapping[_]);return getArrayDifference(j,et)};var ProtocolsHash;(function(a){a.Pt24m4xi="Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd",a.PsBABY5H="PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU",a.PsBabyM1="PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS",a.PsCARTHA="PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb",a.PsDELPH1="PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo",a.PtEdo2Zk="PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA",a.PsFLorena="PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i",a.PtGRANADs="PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV",a.PtHangz2="PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx",a.Psithaca2="Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A",a.PtJakart2="PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY",a.PtKathman="PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg",a.PtLimaPtL="PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW",a.PtMumbaii="PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc",a.PtMumbai2="PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1",a.PtNairobi="PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf",a.ProxfordY="ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH",a.ProtoALpha="ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK"})(ProtocolsHash||(ProtocolsHash={}));const PROTOCOL_CURRENT=ProtocolsHash.ProxfordY;function getCodec(a,_){return{encoder:encoders[a],decoder:$=>{const j=Uint8ArrayConsumer.fromHexString($);return decoders[a](j)}}}class LocalForger{constructor(_=PROTOCOL_CURRENT){this.protocolHash=_,this.codec=getCodec(CODEC.MANAGER,this.protocolHash)}forge(_){const $=validateBlock(_.branch);if($!==ValidationResult.VALID)throw new InvalidBlockHashError(_.branch,invalidDetail($));for(const et of _.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(_).toLowerCase();return Promise.resolve(j)}parse(_){return Promise.resolve(this.codec.decoder(_))}}new LocalForger;function __rest(a,_){var $={};for(var j in a)Object.prototype.hasOwnProperty.call(a,j)&&_.indexOf(j)<0&&($[j]=a[j]);if(a!=null&&typeof Object.getOwnPropertySymbols=="function")for(var et=0,j=Object.getOwnPropertySymbols(a);et(a.on("data",$=>{_.next($)}),a.on("error",$=>{_.error($)}),a.on("close",()=>{_.complete()}),()=>{a.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(a){a.Pt24m4xi="Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd",a.PsBABY5H="PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU",a.PsBabyM1="PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS",a.PsCARTHA="PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb",a.PsDELPH1="PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo",a.PtEdo2Zk="PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA",a.PsFLorena="PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i",a.PtGRANADs="PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV",a.PtHangz2="PtHangz2aRngywmSRGGvrcTyMbbdpWdpFKuS4uMWxg2RaH9i1qx",a.PsiThaCa="PsiThaCaT47Zboaw71QWScM8sXeMM7bbQFncK9FLqYc6EKdpjVP",a.Psithaca2="Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A",a.PtJakart2="PtJakart2xVj7pYXJBXrqHgd82rdkLey5ZeeGwDgPp9rhQUbSqY",a.PtKathman="PtKathmankSpLLDALzWw7CGD2j2MtyveTwboEYokqUCP4a1LxMg",a.PtLimaPtL="PtLimaPtLMwfNinJi9rCfDPWea8dFgTZ1MeJ9f1m2SRic6ayiwW",a.PtMumbaii="PtMumbaiiFFEGbew1rRjzSPyzRbA51Tm3RVZL5suHPxSZYDhCEc",a.PtMumbai2="PtMumbai2TmsJHNGRkD8v8YDbtao7BLUC3wjASn1inAKLFCjaH1",a.PtNairobi="PtNairobiyssHuh87hEhfVBGCVrK3WnS8Z2FT4ymB5tAa4r1nQf",a.ProxfordY="ProxfordYmVfjWnRcgjWH36fW6PArwqykTFzotUxRs6gmTcZDuH",a.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(a){a.MAINNET="NetXdQprcVkpaWU",a.CARTHAGENET="NetXjD3HPJJjmcd",a.DELPHINET="NetXm8tYqnMWky1",a.EDONET="NetXSgo1ZT2DRUG",a.FLORENCENET="NetXxkAx4woPLyu",a.GRANADANET="NetXz969SFaFn8k",a.HANGZHOUNET="NetXZSsxBpMQeAT",a.ITHACANET="NetXbhmtAbMukLc",a.ITHACANET2="NetXnHfVqm9iesp",a.JAKARTANET2="NetXLH1uAxK7CCh",a.KATHMANDUNET="NetXazhm4yetmff",a.LIMANET="NetXizpkH94bocH",a.MUMBAINET="NetXQw6nWSnrJ5t",a.MUMBAINET2="NetXgbcrNtXD2yA",a.NAIROBINET="NetXyuzvDo2Ugzb",a.OXFORDNET2="NetXxWsskGahzQB"})(ChainIds||(ChainIds={}));const getRevealGasLimit=a=>Math.round(getRevealGasLimitInternal(a)*37/10),getRevealGasLimitInternal=a=>{switch(a.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 ${a}`)}},getRevealFee=a=>Math.round(getRevealFeeInternal(a)*12/10),getRevealFeeInternal=a=>{switch(a.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 ${a}`)}};class InvalidParameterError extends ParameterValidationError{constructor(_,$,j){super(),this.smartContractMethodName=_,this.sigs=$,this.invalidParams=j,this.name="InvalidParameterError",this.message=`${_} Received ${j.length} arguments while expecting one of the following signatures (${JSON.stringify($)})`}}class InvalidDelegationSource extends ParameterValidationError{constructor(_){super(),this.source=_,this.name="InvalidDelegationSource",this.message=`Since Babylon delegation source can no longer be a contract address ${_}. Please use the smart contract abstraction to set your delegate.`}}class InvalidCodeParameter extends ParameterValidationError{constructor(_,$){super(),this.message=_,this.data=$,this.name="InvalidCodeParameter"}}class InvalidInitParameter extends ParameterValidationError{constructor(_,$){super(),this.message=_,this.data=$,this.name="InvalidInitParameter"}}class ViewSimulationError extends RpcError{constructor(_,$,j,et){super(),this.message=_,this.viewName=$,this.failWith=j,this.cause=et,this.name="ViewSimulationError"}}const validateAndExtractFailwith=a=>{if(isJsonString(a.body)){const _=JSON.parse(a.body);if(Array.isArray(_)&&"with"in _[_.length-1])return _[_.length-1].with}},isJsonString=a=>{try{JSON.parse(a)}catch{return!1}return!0};class InvalidViewSimulationContext extends ParameterValidationError{constructor(_){super(),this.info=_,this.name="InvalidViewSimulationContext",this.message=`${_} Please configure the context of the view execution in the executeView method.`}}class RevealOperationError extends RpcError{constructor(_){super(),this.message=_,this.name="RevealOperationError"}}class OriginationParameterError extends ParameterValidationError{constructor(_){super(),this.message=_,this.name}}class InvalidBalanceError extends ParameterValidationError{constructor(_){super(),this.message=_,this.name="InvalidBalanceError"}}const createActivationOperation=({pkh:a,secret:_})=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.ACTIVATION,pkh:a,secret:_}}),createOriginationOperation=({code:a,init:_,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&&_!==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(a))throw new InvalidCodeParameter("Wrong code parameter type, expected an array",a);let st;if(et!==void 0){const ut=a.find(yt=>"prim"in yt&&yt.prim==="storage");if((ut==null?void 0:ut.args)===void 0)throw new InvalidCodeParameter("The storage section is missing from the script",a);st=new Schema(ut.args[0]).Encode(et)}else if(_!==void 0&&typeof _=="object")st=_;else throw new InvalidInitParameter("Wrong init parameter type, expected JSON Michelson",_);const ot={code:a,storage:st};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:ot};return j&&(at.delegate=j),at}),createTransferOperation=({to:a,amount:_,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?_.toString():format$1("tz","mutez",_).toString(),destination:a,parameters:$}}),createSetDelegateOperation=({delegate:a,source:_,fee:$,gasLimit:j,storageLimit:et})=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.DELEGATION,source:_,fee:$,gas_limit:j,storage_limit:et,delegate:a}}),createRegisterDelegateOperation=({fee:a,gasLimit:_,storageLimit:$},j)=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.DELEGATION,fee:a,gas_limit:_,storage_limit:$,delegate:j}}),createRevealOperation=({fee:a,gasLimit:_,storageLimit:$},j,et)=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.REVEAL,fee:a,public_key:et,source:j,gas_limit:_??getRevealGasLimit(j),storage_limit:$}}),createRegisterGlobalConstantOperation=({value:a,source:_,fee:$,gasLimit:j,storageLimit:et})=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.REGISTER_GLOBAL_CONSTANT,value:a,fee:$,gas_limit:j,storage_limit:et,source:_}}),createTransferTicketOperation=({ticketContents:a,ticketTy:_,ticketTicketer:$,ticketAmount:j,destination:et,entrypoint:tt,source:rt,fee:nt,gasLimit:it,storageLimit:st})=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.TRANSFER_TICKET,fee:nt,gas_limit:it,storage_limit:st,source:rt,ticket_contents:a,ticket_ty:_,ticket_ticketer:$,ticket_amount:j,destination:et,entrypoint:tt}}),createIncreasePaidStorageOperation=({source:a,fee:_,gasLimit:$,storageLimit:j,amount:et,destination:tt})=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.INCREASE_PAID_STORAGE,source:a,fee:_,gas_limit:$,storage_limit:j,amount:et,destination:tt}}),createDrainDelegateOperation=({consensus_key:a,delegate:_,destination:$})=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.DRAIN_DELEGATE,consensus_key:a,delegate:_,destination:$}}),createBallotOperation=({source:a,proposal:_,ballot:$})=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.BALLOT,source:a,proposal:_,ballot:$}}),createProposalsOperation=({source:a,proposals:_})=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.PROPOSALS,source:a,proposals:_}}),createUpdateConsensusKeyOperation=({source:a,fee:_,gasLimit:$,storageLimit:j,pk:et})=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.UPDATE_CONSENSUS_KEY,source:a,fee:_,gas_limit:$,storage_limit:j,pk:et}}),createSmartRollupAddMessagesOperation=({source:a,fee:_,gasLimit:$,storageLimit:j,message:et})=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.SMART_ROLLUP_ADD_MESSAGES,source:a,fee:_,gas_limit:$,storage_limit:j,message:et}}),createSmartRollupOriginateOperation=({source:a,fee:_,gasLimit:$,storageLimit:j,pvmKind:et,kernel:tt,parametersType:rt})=>__awaiter(void 0,void 0,void 0,function*(){return{kind:OpKind.SMART_ROLLUP_ORIGINATE,source:a,fee:_,gas_limit:$,storage_limit:j,pvm_kind:et,kernel:tt,parameters_ty:rt}}),createSmartRollupExecuteOutboxMessageOperation=({source:a,fee:_,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:a,fee:_,gas_limit:$,storage_limit:j,rollup:et,cemented_commitment:tt,output_proof:rt}}),attachKind=(a,_)=>Object.assign(Object.assign({},a),{kind:_}),findWithKind=(a,_)=>{if(Array.isArray(a)){const $=a.find(j=>j.kind===_);if($&&isKind($,_))return $}},isKind=(a,_)=>a.kind===_,isOpWithGasBuffer=a=>a.kind===OpKind.TRANSACTION&&a.parameters?!0:["origination","register_global_constant","transfer_ticket","update_consensus_key","smart_rollup_add_messages","smart_rollup_originate"].indexOf(a.kind)!==-1,isOpWithFee=a=>["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(a.kind)!==-1,isOpRequireReveal=a=>["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(a.kind)!==-1,hasMetadata=a=>"metadata"in a,hasMetadataWithResult=a=>hasMetadata(a)&&"operation_result"in a.metadata,hasMetadataWithInternalOperationResult=a=>hasMetadata(a)&&"internal_operation_results"in a.metadata,isErrorWithMessage=a=>"with"in a;class TezosOperationError extends RpcError{constructor(_,$,j){super(),this.errors=_,this.errorDetails=$,this.operationsWithResults=j,this.name="TezosOperationError",this.lastError=_[_.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(_){super(),this.result=_,this.name="TezosPreapplyFailureError",this.message="Preapply returned an unexpected result"}}const flattenOperationResult=a=>{const _=Array.isArray(a)?a:[a],$=[];for(let j=0;j<_.length;j++)for(let et=0;et<_[j].contents.length;et++){const tt=_[j].contents[et];hasMetadataWithResult(tt)&&"fee"in tt&&($.push(Object.assign({fee:tt.fee},tt.metadata.operation_result)),Array.isArray(tt.metadata.internal_operation_results)&&tt.metadata.internal_operation_results.forEach(rt=>$.push(rt.result)))}return $},flattenErrors=(a,_="failed")=>{const $=Array.isArray(a)?a:[a];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===_&&(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===_&&(j=j.concat(nt.result.errors||[]))}return j};class OriginationOperationError extends TaquitoError{constructor(_){super(),this.message=_,this.name="OriginationOperationError"}}class InvalidEstimateValueError extends ParameterValidationError{constructor(_){super(),this.message=_,this.name="InvalidEstimateValueError"}}class InvalidConfirmationCountError extends ParameterValidationError{constructor(_){super(),this.invalidConfirmations=_,this.name="InvalidConfirmationCountError",this.message=`Invalid confirmation count ${_} expecting at least 1`}}class ConfirmationTimeoutError extends NetworkError{constructor(_){super(),this.message=_,this.name="ConfirmationTimeoutError"}}class RPCResponseError extends RpcError{constructor(_,$){super(),this.message=_,this.cause=$,this.name="RPCResponseError"}}class Operation{get includedInBlock(){return this._foundAt}constructor(_,$,j,et){if(this.hash=_,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(st=>this.context.readProvider.getBlock(st)),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(_=>_.kind==="reveal")}get revealStatus(){return this.revealOperation?this.revealOperation.metadata.operation_result.status:"unknown"}get status(){return this.results.map(_=>hasMetadataWithResult(_)?_.metadata.operation_result.status:"unknown")[0]||"unknown"}confirmation(_,$){return __awaiter(this,void 0,void 0,function*(){if(typeof _<"u"&&_<1)throw new InvalidConfirmationCountError(_);const{defaultConfirmationCount:j,confirmationPollingTimeoutSecond:et}=this.context.config;this._pollingConfig$.next({timeout:$||et});const tt=_!==void 0?_: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(_,$,j,et,tt,rt){super(_,et,tt,rt),this.params=$,this.source=j}sumProp(_,$){return _.reduce((j,et)=>$ in et?Number(et[$])+j:j,0)}getOriginatedContractAddresses(){const _=this.results.filter(j=>j.kind==="origination");let $=[];for(const j of _)j.metadata.operation_result.originated_contracts&&($=[...$,...j.metadata.operation_result.originated_contracts]);return $}get status(){return this.results.filter(_=>BATCH_KINDS.indexOf(_.kind)!==-1).map(_=>hasMetadataWithResult(_)?_.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(_){this.context=_}forge({opOb:{branch:_,contents:$,protocol:j},counter:et}){return __awaiter(this,void 0,void 0,function*(){return{opbytes:yield this.context.forger.forge({branch:_,contents:$}),opOb:{branch:_,contents:$,protocol:j},counter:et}})}estimate(_,$){var{fee:j,gasLimit:et,storageLimit:tt}=_,rt=__rest(_,["fee","gasLimit","storageLimit"]);return __awaiter(this,void 0,void 0,function*(){let nt=j,it=et,st=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(st&&st%1!==0)throw new InvalidEstimateValueError(`Storage Limit value must not be a decimal: ${st}`);if(j===void 0||et===void 0||tt===void 0){const ot=yield $(Object.assign({fee:j,gasLimit:et,storageLimit:tt},rt));nt??(nt=ot.suggestedFeeMutez),it??(it=ot.gasLimit),st??(st=ot.storageLimit)}return{fee:nt,gasLimit:it,storageLimit:st}})}getRPCOp(_){return __awaiter(this,void 0,void 0,function*(){switch(_.kind){case OpKind.TRANSACTION:return createTransferOperation(Object.assign({},_));case OpKind.ORIGINATION:return createOriginationOperation(yield this.context.parser.prepareCodeOrigination(Object.assign({},_)));case OpKind.DELEGATION:return createSetDelegateOperation(Object.assign({},_));case OpKind.REGISTER_GLOBAL_CONSTANT:return createRegisterGlobalConstantOperation(Object.assign({},_));case OpKind.INCREASE_PAID_STORAGE:return createIncreasePaidStorageOperation(Object.assign({},_));case OpKind.TRANSFER_TICKET:return createTransferTicketOperation(Object.assign({},_));case OpKind.SMART_ROLLUP_ADD_MESSAGES:return createSmartRollupAddMessagesOperation(Object.assign({},_));case OpKind.SMART_ROLLUP_ORIGINATE:return createSmartRollupOriginateOperation(Object.assign({},_));case OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE:return createSmartRollupExecuteOutboxMessageOperation(Object.assign({},_));default:throw new InvalidOperationKindError(_.kind)}})}runOperation(_){return __awaiter(this,void 0,void 0,function*(){return{opResponse:yield this.rpc.runOperation(_),op:_,context:this.context.clone()}})}simulate(_){return __awaiter(this,void 0,void 0,function*(){return{opResponse:yield this.rpc.simulateOperation(_),op:_,context:this.context.clone()}})}isRevealOpNeeded(_,$){return __awaiter(this,void 0,void 0,function*(){return!(!(yield this.isAccountRevealRequired($))||!this.isRevealRequiredForOpType(_))})}isAccountRevealRequired(_){return __awaiter(this,void 0,void 0,function*(){return!(yield this.context.readProvider.isAccountRevealed(_,"head"))})}isRevealRequiredForOpType(_){let $=!1;for(const j of _)isOpRequireReveal(j)&&($=!0);return $}signAndInject(_){return __awaiter(this,void 0,void 0,function*(){const $=yield this.signer.sign(_.opbytes,new Uint8Array([3]));_.opbytes=$.sbytes,_.opOb.signature=$.prefixSig;const j=[],et=yield this.rpc.preapplyOperations([_.opOb]);if(!Array.isArray(et))throw new TezosPreapplyFailureError(et);for(let rt=0;rt__awaiter(this,void 0,void 0,function*(){return _}));case OpKind.ORIGINATION:return this.walletProvider.mapOriginateParamsToWalletParams(()=>__awaiter(this,void 0,void 0,function*(){return this.context.parser.prepareCodeOrigination(Object.assign({},_))}));case OpKind.DELEGATION:return this.walletProvider.mapDelegateParamsToWalletParams(()=>__awaiter(this,void 0,void 0,function*(){return _}));case OpKind.INCREASE_PAID_STORAGE:return this.walletProvider.mapIncreasePaidStorageWalletParams(()=>__awaiter(this,void 0,void 0,function*(){return _}));default:throw new InvalidOperationKindError(JSON.stringify(_.kind))}})}with(_){for(const $ of _)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 _=[];for(const j of this.operations)_.push(yield this.mapOperation(j));const $=yield this.walletProvider.sendOperations(_);return this.context.operationFactory.createBatchOperation($)})}}class Wallet{constructor(_){this.context=_,this.walletCommand=$=>({send:$})}get walletProvider(){return this.context.walletProvider}pkh({forceRefetch:_}={}){return __awaiter(this,void 0,void 0,function*(){return(!this._pkh||_)&&(this._pkh=yield this.walletProvider.getPKH()),this._pkh})}pk({forceRefetch:_}={}){return __awaiter(this,void 0,void 0,function*(){return(!this._pk||_)&&(this._pk=yield this.walletProvider.getPK()),this._pk})}originate(_){return this.walletCommand(()=>__awaiter(this,void 0,void 0,function*(){const $=yield this.walletProvider.mapOriginateParamsToWalletParams(()=>this.context.parser.prepareCodeOrigination(Object.assign({},_))),j=yield this.walletProvider.sendOperations([$]);return this.context.operationFactory.createOriginationOperation(j)}))}setDelegate(_){var $;const j=validateAddress(($=_.delegate)!==null&&$!==void 0?$:"");if(_.delegate&&j!==ValidationResult.VALID)throw new InvalidAddressError(_.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 _})),tt=yield this.walletProvider.sendOperations([et]);return this.context.operationFactory.createDelegationOperation(tt)}))}signFailingNoop(_){return __awaiter(this,void 0,void 0,function*(){const $={kind:OpKind.FAILING_NOOP,arbitrary:_.arbitrary},j=yield this.context.readProvider.getBlockHash(_.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:_.arbitrary}]}}})}registerDelegate(){return this.walletCommand(()=>__awaiter(this,void 0,void 0,function*(){const _=yield this.walletProvider.mapDelegateParamsToWalletParams(()=>__awaiter(this,void 0,void 0,function*(){return{delegate:yield this.pkh()}})),$=yield this.walletProvider.sendOperations([_]);return this.context.operationFactory.createDelegationOperation($)}))}transfer(_){const $=validateAddress(_.to);if($!==ValidationResult.VALID)throw new InvalidAddressError(_.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 _})),et=yield this.walletProvider.sendOperations([j]);return this.context.operationFactory.createTransactionOperation(et)}))}increasePaidStorage(_){const $=validateAddress(_.destination);if($!==ValidationResult.VALID)throw new InvalidAddressError(_.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 _})),et=yield this.walletProvider.sendOperations([j]);return this.context.operationFactory.createIncreasePaidStorageOperation(et)}))}batch(_){const $=new WalletOperationBatch(this.walletProvider,this.context);return Array.isArray(_)&&$.with(_),$}at(_,$=j=>j){return __awaiter(this,void 0,void 0,function*(){const j=validateContractAddress(_);if(j!==ValidationResult.VALID)throw new InvalidContractAddressError(_,invalidDetail(j));const et=this.context.withExtensions().rpc,tt=this.context.withExtensions().readProvider,rt=yield tt.getScript(_,"head"),nt=yield tt.getEntrypoints(_),it=new ContractAbstraction(_,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=(a,{ALLOCATION_BURN:_,ORIGINATION_BURN:$}={ALLOCATION_BURN:257,ORIGINATION_BURN:257})=>{BigNumber.config({DECIMAL_PLACES:0,ROUNDING_MODE:BigNumber.ROUND_UP});const j=flattenOperationResult({contents:a});let et=new BigNumber(0),tt=new BigNumber(0),rt=new BigNumber(0),nt=new BigNumber(0),it=new BigNumber(0),st=new BigNumber(0);return j.forEach(ot=>{rt=rt.plus(ot.fee||0),nt=nt.plus(Array.isArray(ot.originated_contracts)?ot.originated_contracts.length*$:0),it=it.plus("allocated_destination_contract"in ot?_:0),et=et.plus(ot.consumed_milligas||0),st=st.plus("paid_storage_size_diff"in ot&&Number(ot.paid_storage_size_diff)||0)}),tt=tt.plus(it).plus(nt).plus(st),{totalFee:rt,totalMilliGas:et,totalGas:et.dividedBy(1e3),totalStorage:tt,totalAllocationBurn:it,totalOriginationBurn:nt,totalPaidStorageDiff:st,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(_){super(),this.message=_,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 _=yield this.operationResults();if(!_)throw new ObservableError("Unable to get operation results");return receiptFromOperation(_)})}constructor(_,$,j){if(this.opHash=_,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(([_,$])=>$.header.level-_.header.level+1),first()).toPromise():0})}isInCurrentBranch(_="head"){return __awaiter(this,void 0,void 0,function*(){if(!this._included)return!0;const $=yield this.context.readProvider.getBlockLevel(_),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(_){if(typeof _<"u"&&_<1)throw new InvalidConfirmationCountError(_);const{defaultConfirmationCount:$}=this.context.config,j=_!==void 0?_:$;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(_){return this.confirmationObservable(_).toPromise()}}class TransactionWalletOperation extends WalletOperation{constructor(_,$,j){super(_,$,j),this.opHash=_,this.context=$}revealOperation(){return __awaiter(this,void 0,void 0,function*(){const _=yield this.operationResults();if(!_)throw new ObservableError("operationResult returned undefined");return _.find($=>$.kind===OpKind.REVEAL)})}transactionOperation(){return __awaiter(this,void 0,void 0,function*(){const _=yield this.operationResults();if(!_)throw new ObservableError("operationResult returned undefined");return _.find($=>$.kind===OpKind.TRANSACTION)})}status(){return __awaiter(this,void 0,void 0,function*(){if(!this._included)return"pending";const _=yield this.transactionOperation();return _?_.metadata.operation_result.status:"unknown"})}}class OriginationWalletOperation extends WalletOperation{constructor(_,$,j){super(_,$,j),this.opHash=_,this.context=$}originationOperation(){return __awaiter(this,void 0,void 0,function*(){const _=yield this.operationResults();if(_)return findWithKind(_,OpKind.ORIGINATION);throw new ObservableError("Unable to fetch operation result")})}revealOperation(){return __awaiter(this,void 0,void 0,function*(){const _=yield this.operationResults();if(_)return findWithKind(_,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 _=yield this.originationOperation();return _?_.metadata.operation_result.status:"unknown"})}contract(){return __awaiter(this,void 0,void 0,function*(){const _=yield this.originationOperation(),$=((_==null?void 0:_.metadata.operation_result.originated_contracts)||[])[0];return this.context.wallet.at($)})}}class DelegationWalletOperation extends WalletOperation{constructor(_,$,j){super(_,$,j),this.opHash=_,this.context=$}revealOperation(){return __awaiter(this,void 0,void 0,function*(){const _=yield this.operationResults();if(_)return _.find($=>$.kind===OpKind.REVEAL);throw new ObservableError("Unable to fetch operation result")})}delegationOperation(){return __awaiter(this,void 0,void 0,function*(){const _=yield this.operationResults();if(_)return _.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 _=yield this.delegationOperation();return _?_.metadata.operation_result.status:"unknown"})}}class LegacyWalletProvider{constructor(_){this.context=_}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(_){return __awaiter(this,void 0,void 0,function*(){return attachKind(yield _(),OpKind.TRANSACTION)})}mapOriginateParamsToWalletParams(_){return __awaiter(this,void 0,void 0,function*(){return attachKind(yield _(),OpKind.ORIGINATION)})}mapDelegateParamsToWalletParams(_){return __awaiter(this,void 0,void 0,function*(){return attachKind(yield _(),OpKind.DELEGATION)})}mapIncreasePaidStorageWalletParams(_){return __awaiter(this,void 0,void 0,function*(){return attachKind(yield _(),OpKind.INCREASE_PAID_STORAGE)})}sendOperations(_){return __awaiter(this,void 0,void 0,function*(){return(yield this.context.batch.batch(_).send()).hash})}sign(_,$){return __awaiter(this,void 0,void 0,function*(){const{prefixSig:j}=yield this.context.signer.sign(_,$);return j})}}class ContractMethodObject{constructor(_,$,j,et,tt="unit",rt=!0,nt=!1){this.provider=_,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(_={}){return this.provider instanceof Wallet?this.provider.transfer(this.toTransferParams(_)).send():this.provider.transfer(this.toTransferParams(_))}toTransferParams({fee:_,gasLimit:$,storageLimit:j,source:et,amount:tt=0,mutez:rt=!1}={}){return{to:this.address,amount:tt,fee:_,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(_,$,j,et,tt,rt=!0,nt=!1){this.provider=_,this.address=$,this.parameterSchema=j,this.name=et,this.args=tt,this.isMultipleEntrypoint=rt,this.isAnonymous=nt}validateArgs(_,$,j){const et=$.ExtractSignatures();if(!et.find(tt=>tt.length===_.length))throw new InvalidParameterError(j,et,_)}get schema(){return this.isAnonymous?this.parameterSchema.ExtractSchema()[this.name]:this.parameterSchema.ExtractSchema()}getSignature(){if(this.isAnonymous){const _=this.parameterSchema.ExtractSignatures().find($=>$[0]===this.name);if(_)return _.shift(),_}else{const _=this.parameterSchema.ExtractSignatures();return _.length==1?_[0]:_}}send(_={}){return this.provider instanceof Wallet?this.provider.transfer(this.toTransferParams(_)).send():this.provider.transfer(this.toTransferParams(_))}toTransferParams({fee:_,gasLimit:$,storageLimit:j,source:et,amount:tt=0,mutez:rt=!1}={}){return{to:this.address,amount:tt,fee:_,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(_,$,j,et,tt,rt="Unit"){this._rpc=_,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(_){return __awaiter(this,void 0,void 0,function*(){this.verifyContextExecution(_);const $=yield this._readProvider.getChainId(),j=this.transformArgsToMichelson(),et={contract:this._contractAddress,view:this._smartContractViewSchema.viewName,input:j,chain_id:$,source:_.viewCaller};return _.source&&(et.payer=_.source),this.executeViewAndDecodeResult(et)})}verifyContextExecution(_){if(_.source&&validateAddress(_.source)!==ValidationResult.VALID)throw new InvalidViewSimulationContext(`The source account who initialized the view execution is invalid: ${_.source}.`);if(!_.viewCaller||validateAddress(_.viewCaller)!==ValidationResult.VALID)throw new InvalidViewSimulationContext(`The contract which is the caller of view is invalid: ${_.viewCaller}.`)}transformArgsToMichelson(){try{return this._smartContractViewSchema.encodeViewArgs(this._args)}catch(_){throw new InvalidViewParameterError(this._smartContractViewSchema.viewName,this.getSignature(),this._args,_)}}adaptViewCodeToContext(_,$,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 _.forEach((tt,rt)=>{tt.prim in et&&(_[rt]=Object(et)[tt.prim]),tt.args&&tt.args.length!==0?this.adaptViewCodeToContext(tt.args,$,j):Array.isArray(tt)&&this.adaptViewCodeToContext(tt,$,j)}),_}executeViewAndDecodeResult(_){return __awaiter(this,void 0,void 0,function*(){let $;try{$=(yield this._rpc.runScriptView(_)).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(_,$){this.provider=_,this.contractAddress=$}createContractMethodFlatParams(_,$,j,et=!0,tt=!1){return new ContractMethod(this.provider,this.contractAddress,_,$,j,et,tt)}createContractMethodObjectParam(_,$,j,et=!0,tt=!1){return new ContractMethodObject(this.provider,this.contractAddress,_,$,j,et,tt)}createContractViewObjectParam(_,$,j,et,tt){return new OnChainView(_,$,this.contractAddress,j,et,tt)}}const DEFAULT_SMART_CONTRACT_METHOD_NAME="default";class ContractView{constructor(_,$,j,et,tt,rt,nt){this.currentContract=_,this.name=$,this.callbackParametersSchema=j,this.parameterSchema=et,this.args=tt,this.rpc=rt,this.readProvider=nt}read(_){return __awaiter(this,void 0,void 0,function*(){const $=validateChain(_??"");if(validateContractAddress(_??"")==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(_&&$!==ValidationResult.VALID)throw new InvalidChainIdError(_,invalidDetail($));const j=this.parameterSchema.Encode(...this.args),et=yield this.rpc.runView({contract:this.currentContract.address,entrypoint:this.name,input:j,chain_id:_||(yield this.readProvider.getChainId())});return this.callbackParametersSchema.Execute(et.data)})}}const validateArgs=(a,_,$)=>{const j=_.ExtractSignatures();if(!j.find(et=>et.length===a.length))throw new InvalidParameterError($,j,a)},isView$2=a=>{let _=!1;if("prim"in a&&a.prim==="pair"&&a.args){const $=a.args[a.args.length-1];"prim"in $&&$.prim==="contract"&&(_=!0)}return _};class ContractAbstraction{constructor(_,$,j,et,tt,rt,nt){this.address=_,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,_),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(_,$,j,et){const tt=this.parameterSchema,rt=Object.keys($);if(tt.isMultipleEntryPoint)rt.forEach(it=>{const st=new ParameterSchema($[it]);if(this.methods[it]=function(...ot){return _.contractMethodFactory.createContractMethodFlatParams(st,it,ot)},this.methodsObject[it]=function(ot){return _.contractMethodFactory.createContractMethodObjectParam(st,it,ot)},isView$2($[it])){const ot=function(...at){const ut=$[it].args[0],ht=new ParameterSchema(ut),yt=$[it].args[1].args[0],wt=new ParameterSchema(yt);return validateArgs(at,ht,it),new ContractView(_,it,wt,ht,at,j,et)};this.views[it]=ot}}),Object.keys(tt.ExtractSchema()).filter(it=>Object.keys($).indexOf(it)===-1).forEach(it=>{this.methods[it]=function(...st){return _.contractMethodFactory.createContractMethodFlatParams(tt,it,st,!1,!0)},this.methodsObject[it]=function(st){return _.contractMethodFactory.createContractMethodObjectParam(tt,it,st,!1,!0)}});else{const nt=this.parameterSchema;this.methods[DEFAULT_SMART_CONTRACT_METHOD_NAME]=function(...it){return _.contractMethodFactory.createContractMethodFlatParams(nt,DEFAULT_SMART_CONTRACT_METHOD_NAME,it,!1)},this.methodsObject[DEFAULT_SMART_CONTRACT_METHOD_NAME]=function(it){return _.contractMethodFactory.createContractMethodObjectParam(nt,DEFAULT_SMART_CONTRACT_METHOD_NAME,it,!1)}}}_initializeOnChainViews(_,$,j,et){const tt=this.schema.val;et.forEach(rt=>{this.contractViews[rt.viewName]=function(nt){return _.contractMethodFactory.createContractViewObjectParam($,j,rt,tt,nt)}})}storage(){return this.storageProvider.getStorage(this.address,this.schema)}bigMap(_){return this.storageProvider.getBigMapKey(this.address,_,this.schema)}}const setDelegate=a=>[{prim:"DROP"},{prim:"NIL",args:[{prim:"operation"}]},{prim:"PUSH",args:[{prim:"key_hash"},{string:a}]},{prim:"SOME"},{prim:"SET_DELEGATE"},{prim:"CONS"}],transferImplicit=(a,_)=>[{prim:"DROP"},{prim:"NIL",args:[{prim:"operation"}]},{prim:"PUSH",args:[{prim:"key_hash"},{string:a}]},{prim:"IMPLICIT_ACCOUNT"},{prim:"PUSH",args:[{prim:"mutez"},{int:`${_}`}]},{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:a}]},{prim:"CONTRACT",args:[{prim:"unit"}]},{prim:"IF_NONE",args:[[{prim:"UNIT"},{prim:"FAILWITH"}],[]]},{prim:"PUSH",args:[{prim:"mutez"},{int:`${_}`}]},{prim:"UNIT"},{prim:"TRANSFER_TOKENS"},{prim:"CONS"}],MANAGER_LAMBDA={setDelegate,removeDelegate,transferImplicit,transferToContract};class SaplingStateAbstraction{constructor(_,$){this.id=_,this.provider=$}getSaplingDiff(_){return __awaiter(this,void 0,void 0,function*(){return this.provider.getSaplingDiffByID(this.id.toString(),_)})}getId(){return this.id.toString()}}class BigMapAbstraction{constructor(_,$,j){this.id=_,this.schema=$,this.provider=j}get(_,$){return __awaiter(this,void 0,void 0,function*(){try{return yield this.provider.getBigMapKeyByID(this.id.toString(),_,this.schema,$)}catch(j){if(j instanceof HttpResponseError&&j.status===STATUS_CODE.NOT_FOUND)return;throw j}})}getMultipleValues(_,$,j=5){return __awaiter(this,void 0,void 0,function*(){return this.provider.getBigMapKeysByID(this.id.toString(),_,this.schema,$,j)})}toJSON(){return this.id.toString()}toString(){return this.id.toString()}}const smartContractAbstractionSemantic=a=>({big_map:(_,$)=>{if(!_||!("int"in _)||_.int===void 0)return{};{const j=new Schema($);return new BigMapAbstraction(new BigNumber(_.int),j,a)}},sapling_state:_=>!_||!("int"in _)||_.int===void 0?{}:new SaplingStateAbstraction(new BigNumber(_.int),a)});var _PrepareProvider_counters;const mergeLimits=(a,_)=>{var $,j,et;return{fee:($=a.fee)!==null&&$!==void 0?$:_.fee,gasLimit:(j=a.gasLimit)!==null&&j!==void 0?j:_.gasLimit,storageLimit:(et=a.storageLimit)!==null&&et!==void 0?et:_.storageLimit}};class PrepareProvider extends Provider{constructor(_){super(_),this.context=_,_PrepareProvider_counters.set(this,void 0),__classPrivateFieldSet(this,_PrepareProvider_counters,{})}getBlockHash(_){return __awaiter(this,void 0,void 0,function*(){return this.context.readProvider.getBlockHash(_??"head~2")})}getProtocolHash(){return __awaiter(this,void 0,void 0,function*(){return this.context.readProvider.getNextProtocol("head")})}getHeadCounter(_){var $;return __awaiter(this,void 0,void 0,function*(){return($=this.context.readProvider.getCounter(_,"head"))!==null&&$!==void 0?$:"0"})}adjustGasForBatchOperation(_,$,j){return BigNumber.min($,_.div(j+1))}getOperationLimits(_,$){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}=_;return{fee:0,gasLimit:$?Math.floor(this.adjustGasForBatchOperation(et,j,$).toNumber()):j.toNumber(),storageLimit:tt.toNumber()}})}getFee(_,$,j){return(!__classPrivateFieldGet(this,_PrepareProvider_counters,"f")[$]||__classPrivateFieldGet(this,_PrepareProvider_counters,"f")[$]"u"?"0":`${_.fee}`,gas_limit:typeof _.gas_limit>"u"?"0":`${_.gas_limit}`,storage_limit:typeof _.storage_limit>"u"?"0":`${_.storage_limit}`}}getSource(_,$,j){return{source:typeof _.source>"u"?j||$:_.source}}addRevealOperationIfNeeded(_,$){return __awaiter(this,void 0,void 0,function*(){if(isOpRequireReveal(_)){const j=[_],{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 _})}getKeys(){return __awaiter(this,void 0,void 0,function*(){const _=this.context.isAnySignerConfigured();return{pkh:_?yield this.signer.publicKeyHash():yield this.context.walletProvider.getPKH(),publicKey:_?yield this.signer.publicKey():void 0}})}convertIntoArray(_){return Array.isArray(_)?[..._]:[_]}constructOpContents(_,$,j,et,tt){return _.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:_,secret:$}){return __awaiter(this,void 0,void 0,function*(){const j=yield createActivationOperation({pkh:_,secret:$}),et=this.convertIntoArray(j),tt=yield this.getBlockHash(),rt=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const nt=parseInt(yield this.getHeadCounter(_),10),it=this.constructOpContents(et,nt,_);return{opOb:{branch:tt,contents:it,protocol:rt},counter:nt}})}reveal({fee:_,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:_,storageLimit:j,gasLimit:$},nt),st=yield createRevealOperation({fee:it.fee,gasLimit:it.gasLimit,storageLimit:it.storageLimit},et,tt),ot=this.convertIntoArray(st),at=yield this.getBlockHash(),ut=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const ht=parseInt(yield this.getHeadCounter(et),10),yt=this.constructOpContents(ot,ht,et);return{opOb:{branch:at,contents:yt,protocol:ut},counter:ht}})}originate(_,$){var{fee:j,storageLimit:et,gasLimit:tt}=_,rt=__rest(_,["fee","storageLimit","gasLimit"]);return __awaiter(this,void 0,void 0,function*(){const{pkh:nt}=yield this.getKeys(),it=yield this.context.readProvider.getProtocolConstants("head"),st=yield this.getOperationLimits(it),ot=yield createOriginationOperation(yield this.context.parser.prepareCodeOrigination(Object.assign(Object.assign({},rt),mergeLimits({fee:j,storageLimit:et,gasLimit:tt},st)))),at=yield this.addRevealOperationIfNeeded(ot,nt),ut=this.convertIntoArray(at),ht=yield this.getBlockHash(),yt=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const wt=parseInt(yield this.getHeadCounter(nt),10),Ct=this.constructOpContents(ut,wt,nt,$);return{opOb:{branch:ht,contents:Ct,protocol:yt},counter:wt}})}transaction(_){var{fee:$,storageLimit:j,gasLimit:et}=_,tt=__rest(_,["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),st=yield createTransferOperation(Object.assign(Object.assign({},tt),mergeLimits({fee:$,storageLimit:j,gasLimit:et},it))),ot=yield this.addRevealOperationIfNeeded(st,rt),at=this.convertIntoArray(ot),ut=yield this.getBlockHash(),ht=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const yt=parseInt(yield this.getHeadCounter(rt),10),wt=this.constructOpContents(at,yt,rt,tt.source);return{opOb:{branch:ut,contents:wt,protocol:ht},counter:yt}})}delegation(_){var{fee:$,storageLimit:j,gasLimit:et}=_,tt=__rest(_,["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),st=yield createSetDelegateOperation(Object.assign(Object.assign({},tt),mergeLimits({fee:$,storageLimit:j,gasLimit:et},it))),ot=yield this.addRevealOperationIfNeeded(st,rt),at=this.convertIntoArray(ot),ut=yield this.getBlockHash(),ht=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const yt=parseInt(yield this.getHeadCounter(rt),10),wt=this.constructOpContents(at,yt,rt,tt.source);return{opOb:{branch:ut,contents:wt,protocol:ht},counter:yt}})}registerDelegate({fee:_,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:_,storageLimit:$,gasLimit:j},nt),st=yield createRegisterDelegateOperation({fee:it.fee,storageLimit:it.storageLimit,gasLimit:it.gasLimit},tt),ot=yield this.addRevealOperationIfNeeded(st,tt),at=this.convertIntoArray(ot),ut=yield this.getBlockHash(),ht=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const yt=parseInt(yield this.getHeadCounter(tt),10),wt=this.constructOpContents(at,yt,tt,et);return{opOb:{branch:ut,contents:wt,protocol:ht},counter:yt}})}registerGlobalConstant(_){var{fee:$,storageLimit:j,gasLimit:et}=_,tt=__rest(_,["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),st=yield createRegisterGlobalConstantOperation(Object.assign(Object.assign({},tt),mergeLimits({fee:$,storageLimit:j,gasLimit:et},it))),ot=yield this.addRevealOperationIfNeeded(st,rt),at=this.convertIntoArray(ot),ut=yield this.getBlockHash(),ht=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const yt=parseInt(yield this.getHeadCounter(rt),10),wt=this.constructOpContents(at,yt,rt,tt.source);return{opOb:{branch:ut,contents:wt,protocol:ht},counter:yt}})}updateConsensusKey(_,$){var{fee:j,storageLimit:et,gasLimit:tt}=_,rt=__rest(_,["fee","storageLimit","gasLimit"]);return __awaiter(this,void 0,void 0,function*(){const{pkh:nt}=yield this.getKeys(),it=yield this.context.readProvider.getProtocolConstants("head"),st=yield this.getOperationLimits(it),ot=yield createUpdateConsensusKeyOperation(Object.assign(Object.assign({},rt),mergeLimits({fee:j,storageLimit:et,gasLimit:tt},st))),at=yield this.addRevealOperationIfNeeded(ot,nt),ut=this.convertIntoArray(at),ht=yield this.getBlockHash(),yt=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const wt=parseInt(yield this.getHeadCounter(nt),10),Ct=this.constructOpContents(ut,wt,nt,$);return{opOb:{branch:ht,contents:Ct,protocol:yt},counter:wt}})}increasePaidStorage(_){var{fee:$,storageLimit:j,gasLimit:et}=_,tt=__rest(_,["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),st=yield createIncreasePaidStorageOperation(Object.assign(Object.assign({},tt),mergeLimits({fee:$,storageLimit:j,gasLimit:et},it))),ot=yield this.addRevealOperationIfNeeded(st,rt),at=this.convertIntoArray(ot),ut=yield this.getBlockHash(),ht=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const yt=parseInt(yield this.getHeadCounter(rt),10),wt=this.constructOpContents(at,yt,rt,tt.source);return{opOb:{branch:ut,contents:wt,protocol:ht},counter:yt}})}ballot(_){return __awaiter(this,void 0,void 0,function*(){const{pkh:$}=yield this.getKeys(),j=yield createBallotOperation(Object.assign({},_)),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 st=this.constructOpContents(et,nt,$,void 0,it);return{opOb:{branch:tt,contents:st,protocol:rt},counter:nt}})}proposals(_){return __awaiter(this,void 0,void 0,function*(){const{pkh:$}=yield this.getKeys(),j=yield createProposalsOperation(Object.assign({},_)),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 st=this.constructOpContents(et,nt,$,void 0,it);return{opOb:{branch:tt,contents:st,protocol:rt},counter:nt}})}drainDelegate(_,$){return __awaiter(this,void 0,void 0,function*(){const{pkh:j}=yield this.getKeys(),et=yield createDrainDelegateOperation(Object.assign({},_)),tt=this.convertIntoArray(et),rt=yield this.getBlockHash(),nt=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const it=parseInt(yield this.getHeadCounter(j),10),st=this.constructOpContents(tt,it,j,$);return{opOb:{branch:rt,contents:st,protocol:nt},counter:it}})}transferTicket(_){var{fee:$,storageLimit:j,gasLimit:et}=_,tt=__rest(_,["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),st=yield createTransferTicketOperation(Object.assign(Object.assign({},tt),mergeLimits({fee:$,storageLimit:j,gasLimit:et},it))),ot=yield this.addRevealOperationIfNeeded(st,rt),at=this.convertIntoArray(ot),ut=yield this.getBlockHash(),ht=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const yt=parseInt(yield this.getHeadCounter(rt),10),wt=this.constructOpContents(at,yt,rt,tt.source);return{opOb:{branch:ut,contents:wt,protocol:ht},counter:yt}})}smartRollupAddMessages(_){var{fee:$,storageLimit:j,gasLimit:et}=_,tt=__rest(_,["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),st=yield createSmartRollupAddMessagesOperation(Object.assign(Object.assign({},tt),mergeLimits({fee:$,storageLimit:j,gasLimit:et},it))),ot=yield this.addRevealOperationIfNeeded(st,rt),at=this.convertIntoArray(ot),ut=yield this.getBlockHash(),ht=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const yt=parseInt(yield this.getHeadCounter(rt),10),wt=this.constructOpContents(at,yt,rt,tt.source);return{opOb:{branch:ut,contents:wt,protocol:ht},counter:yt}})}smartRollupOriginate(_){var{fee:$,storageLimit:j,gasLimit:et}=_,tt=__rest(_,["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),st=yield createSmartRollupOriginateOperation(Object.assign(Object.assign({},mergeLimits({fee:$,storageLimit:j,gasLimit:et},it)),tt)),ot=yield this.addRevealOperationIfNeeded(st,rt),at=this.convertIntoArray(ot),ut=yield this.getBlockHash(),ht=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const yt=parseInt(yield this.getHeadCounter(rt),10),wt=this.constructOpContents(at,yt,rt,tt.source);return{opOb:{branch:ut,contents:wt,protocol:ht},counter:yt}})}smartRollupExecuteOutboxMessage(_){var{fee:$,storageLimit:j,gasLimit:et}=_,tt=__rest(_,["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),st=yield createSmartRollupExecuteOutboxMessageOperation(Object.assign(Object.assign({},tt),mergeLimits({fee:$,storageLimit:j,gasLimit:et},it))),ot=yield this.addRevealOperationIfNeeded(st,rt),at=this.convertIntoArray(ot),ut=yield this.getBlockHash(),ht=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const yt=parseInt(yield this.getHeadCounter(rt),10),wt=this.constructOpContents(at,yt,rt,tt.source);return{opOb:{branch:ut,contents:wt,protocol:ht},counter:yt}})}batch(_,$){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,_.length),nt=yield this.isRevealOpNeeded(_,j),it=[];if($)for(const ht of _)if(isOpWithFee(ht)){const yt=$.shift(),wt=mergeLimits(ht,{fee:yt.suggestedFeeMutez,storageLimit:yt.storageLimit,gasLimit:yt.gasLimit});it.push(yield this.getRPCOp(Object.assign(Object.assign({},ht),wt)))}else it.push(Object.assign({},ht));else for(const ht of _)if(isOpWithFee(ht)){const yt=mergeLimits(ht,rt);it.push(yield this.getRPCOp(Object.assign(Object.assign({},ht),yt)))}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 st=yield this.getBlockHash(),ot=yield this.getProtocolHash();__classPrivateFieldSet(this,_PrepareProvider_counters,{});const at=parseInt(yield this.getHeadCounter(j),10),ut=this.constructOpContents(it,at,j);return{opOb:{branch:st,contents:ut,protocol:ot},counter:at}})}contractCall(_){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),st=_.toTransferParams(),ot=yield this.context.readProvider.getProtocolConstants("head"),at=yield this.getOperationLimits(ot),ut=mergeLimits({fee:st.fee,storageLimit:st.storageLimit,gasLimit:st.gasLimit},at),ht={kind:OpKind.TRANSACTION,fee:($=st.fee)!==null&&$!==void 0?$:ut.fee,gas_limit:(j=st.gasLimit)!==null&&j!==void 0?j:ut.gasLimit,storage_limit:(et=st.storageLimit)!==null&&et!==void 0?et:ut.storageLimit,amount:String(st.amount),destination:st.to,parameters:st.parameter},yt=yield this.addRevealOperationIfNeeded(ht,nt),wt=this.convertIntoArray(yt),Ct=this.constructOpContents(wt,it,nt);return{opOb:{branch:tt,contents:Ct,protocol:rt},counter:it}})}toPreapply(_){return __awaiter(this,void 0,void 0,function*(){const{opOb:{contents:$,branch:j,protocol:et}}=_,tt=this.toForge(_),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:_,branch:$}}){return{branch:$,contents:_}}}_PrepareProvider_counters=new WeakMap;const BATCH_KINDS=[OpKind.ACTIVATION,OpKind.ORIGINATION,OpKind.TRANSACTION,OpKind.DELEGATION];class OperationBatch extends Provider{constructor(_,$){super(_),this.estimator=$,this.operations=[],this.prepare=new PrepareProvider(this.context)}withTransfer(_){const $=validateAddress(_.to);if(_.amount<0)throw new InvalidAmountError(_.amount.toString());if($!==ValidationResult.VALID)throw new InvalidAddressError(_.to,invalidDetail($));return this.operations.push(Object.assign({kind:OpKind.TRANSACTION},_)),this}withTransferTicket(_){const $=validateAddress(_.destination);if($!==ValidationResult.VALID)throw new InvalidAddressError(_.destination,invalidDetail($));return this.operations.push(Object.assign({kind:OpKind.TRANSFER_TICKET},_)),this}withContractCall(_,$={}){return this.withTransfer(_.toTransferParams($))}withDelegation(_){var $;const j=validateAddress(_.source);if(_.source&&j!==ValidationResult.VALID)throw new InvalidAddressError(_.source,invalidDetail(j));const et=validateAddress(($=_.delegate)!==null&&$!==void 0?$:"");if(_.delegate&&et!==ValidationResult.VALID)throw new InvalidAddressError(_.delegate,invalidDetail(et));return this.operations.push(Object.assign({kind:OpKind.DELEGATION},_)),this}withActivation({pkh:_,secret:$}){const j=validateKeyHash(_);if(j!==ValidationResult.VALID)throw new InvalidKeyHashError(_,invalidDetail(j));return this.operations.push({kind:OpKind.ACTIVATION,pkh:_,secret:$}),this}withOrigination(_){return this.operations.push(Object.assign({kind:OpKind.ORIGINATION},_)),this}withRegisterGlobalConstant(_){return this.operations.push(Object.assign({kind:OpKind.REGISTER_GLOBAL_CONSTANT},_)),this}withIncreasePaidStorage(_){return this.operations.push(Object.assign({kind:OpKind.INCREASE_PAID_STORAGE},_)),this}withSmartRollupAddMessages(_){return this.operations.push(Object.assign({kind:OpKind.SMART_ROLLUP_ADD_MESSAGES},_)),this}withSmartRollupOriginate(_){return this.operations.push(Object.assign({kind:OpKind.SMART_ROLLUP_ORIGINATE},_)),this}withSmartRollupExecuteOutboxMessage(_){return this.operations.push(Object.assign({kind:OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE},_)),this}getRPCOp(_){return __awaiter(this,void 0,void 0,function*(){switch(_.kind){case OpKind.TRANSACTION:return createTransferOperation(Object.assign({},_));case OpKind.ORIGINATION:return createOriginationOperation(yield this.context.parser.prepareCodeOrigination(Object.assign({},_)));case OpKind.DELEGATION:return createSetDelegateOperation(Object.assign({},_));case OpKind.REGISTER_GLOBAL_CONSTANT:return createRegisterGlobalConstantOperation(Object.assign({},_));case OpKind.INCREASE_PAID_STORAGE:return createIncreasePaidStorageOperation(Object.assign({},_));case OpKind.TRANSFER_TICKET:return createTransferTicketOperation(Object.assign({},_));case OpKind.SMART_ROLLUP_ADD_MESSAGES:return createSmartRollupAddMessagesOperation(Object.assign({},_));case OpKind.SMART_ROLLUP_ORIGINATE:return createSmartRollupOriginateOperation(Object.assign({},_));case OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE:return createSmartRollupExecuteOutboxMessageOperation(Object.assign({},_));default:throw new InvalidOperationKindError(JSON.stringify(_.kind))}})}with(_){for(const $ of _)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(_){return __awaiter(this,void 0,void 0,function*(){const $=yield this.signer.publicKeyHash(),j=_&&_.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:st,opResponse:ot}=yield this.signAndInject(rt);return new BatchOperation(nt,tt.opOb.contents,j,st,ot,it)})}}class RPCBatchProvider{constructor(_,$){this.context=_,this.estimator=$}batch(_){const $=new OperationBatch(this.context,this.estimator);return Array.isArray(_)&&$.with(_),$}}class BatchWalletOperation extends WalletOperation{constructor(_,$,j){super(_,$,j),this.opHash=_,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 _=yield this.operationResults();if(_)return _.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 _=yield this.operationResults();if(_)return _.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(_,$,j){super(_,$,j),this.opHash=_,this.context=$}revealOperation(){return __awaiter(this,void 0,void 0,function*(){const _=yield this.operationResults();if(_)return _.find($=>$.kind===OpKind.REVEAL);throw new ObservableError("Unable to fetch operation result")})}increasePaidStorageOperation(){return __awaiter(this,void 0,void 0,function*(){const _=yield this.operationResults();if(_)return _.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 _=yield this.increasePaidStorageOperation();return _?_.metadata.operation_result.status:"unknown"})}}function timeoutAfter(a){return function($){return new BehaviorSubject(null).pipe(timeout({each:a,with:()=>throwError(()=>new ConfirmationTimeoutError("Confirmation polling timed out"))}),mergeMap(()=>$))}}const createNewPollingBasedHeadObservable=(a,_,$)=>a.pipe(timeoutAfter(_.config.confirmationPollingTimeoutSecond*1e3),share({connector:()=>new ReplaySubject(1),resetOnError:!1,resetOnComplete:!1,resetOnRefCountZero:!1}));class OperationFactory{constructor(_){this.context=_,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(_,$=1){return from(this.context.readProvider.getBlock(_)).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:_}){return __awaiter(this,void 0,void 0,function*(){const $=[];return _&&$.push(this.createPastBlockWalker(_)),$.push(yield this.createNewHeadObservable()),concat(...$)})}createOperation(_,$={}){return __awaiter(this,void 0,void 0,function*(){return new WalletOperation(_,this.context.clone(),yield this.createHeadObservableFromConfig($))})}createBatchOperation(_,$={}){return __awaiter(this,void 0,void 0,function*(){return new BatchWalletOperation(_,this.context.clone(),yield this.createHeadObservableFromConfig($))})}createTransactionOperation(_,$={}){return __awaiter(this,void 0,void 0,function*(){return new TransactionWalletOperation(_,this.context.clone(),yield this.createHeadObservableFromConfig($))})}createDelegationOperation(_,$={}){return __awaiter(this,void 0,void 0,function*(){return new DelegationWalletOperation(_,this.context.clone(),yield this.createHeadObservableFromConfig($))})}createOriginationOperation(_,$={}){return __awaiter(this,void 0,void 0,function*(){return new OriginationWalletOperation(_,this.context.clone(),yield this.createHeadObservableFromConfig($))})}createIncreasePaidStorageOperation(_,$={}){return __awaiter(this,void 0,void 0,function*(){return new IncreasePaidStorageWalletOperation(_,this.context.clone(),yield this.createHeadObservableFromConfig($))})}}class RpcTzProvider extends Provider{constructor(_){super(_),this.prepare=new PrepareProvider(this.context)}getBalance(_){return __awaiter(this,void 0,void 0,function*(){const $=validateAddress(_);if($!==ValidationResult.VALID)throw new InvalidAddressError(_,invalidDetail($));return this.context.readProvider.getBalance(_,"head")})}getDelegate(_){return __awaiter(this,void 0,void 0,function*(){const $=validateAddress(_);if($!==ValidationResult.VALID)throw new InvalidAddressError(_,invalidDetail($));return this.context.readProvider.getDelegate(_,"head")})}activate(_,$){return __awaiter(this,void 0,void 0,function*(){const j=validateKeyHash(_);if(j!==ValidationResult.VALID)throw new InvalidKeyHashError(_,invalidDetail(j));const et=yield this.prepare.activate({pkh:_,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(_,$,j,et,tt=MINIMAL_FEE_MUTEZ){this._milligasLimit=_,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(_){return Math.ceil(Number(_))}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(_){let $=0,j=0,et=0,tt=0,rt;return _.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(_){return _.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 _=this.context.isAnySignerConfigured();return{publicKeyHash:_?yield this.signer.publicKeyHash():yield this.context.walletProvider.getPKH(),publicKey:_?yield this.signer.publicKey():void 0}})}getEstimationPropertiesFromOperationContent(_,$,j,et){const tt=flattenOperationResult({contents:[_]});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(_)?{milligasLimit:isOpWithGasBuffer(_)?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(_,$){return __awaiter(this,void 0,void 0,function*(){const{opbytes:j,opOb:{branch:et,contents:tt}}=yield this.forge(_),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:st}=$,ot=[...flattenErrors(nt,"backtracked"),...flattenErrors(nt)];if(ot.length)throw new TezosOperationError(ot,"Error occurred during estimation",nt.contents);let at=1;return Array.isArray(_.opOb.contents)&&_.opOb.contents.length>1&&(at=nt.contents[0].kind==="reveal"?_.opOb.contents.length-1:_.opOb.contents.length),nt.contents.map(ut=>this.getEstimationPropertiesFromOperationContent(ut,ut.kind==="reveal"?this.OP_SIZE_REVEAL/2:(j.length+130)/2/at,it,st??257))})}originate(_){return __awaiter(this,void 0,void 0,function*(){const $=yield this.prepare.originate(_),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(_){var $,{fee:j,storageLimit:et,gasLimit:tt}=_,rt=__rest(_,["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 st=yield this.prepare.transaction(Object.assign({fee:j,storageLimit:et,gasLimit:tt},rt)),ot=yield this.context.readProvider.getProtocolConstants("head"),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)})}transferTicket(_){var $,{fee:j,storageLimit:et,gasLimit:tt}=_,rt=__rest(_,["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 st=yield this.context.readProvider.getProtocolConstants("head"),ot=yield this.prepare.transferTicket(Object.assign({fee:j,storageLimit:et,gasLimit:tt},rt)),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)})}setDelegate(_){var $,{fee:j,gasLimit:et,storageLimit:tt}=_,rt=__rest(_,["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 st=yield this.prepare.delegation(Object.assign({fee:j,storageLimit:tt,gasLimit:et},rt)),ot=yield this.context.readProvider.getProtocolConstants("head"),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)})}batch(_){return __awaiter(this,void 0,void 0,function*(){const $=yield this.context.readProvider.getProtocolConstants("head"),j=yield this.prepare.batch(_),et=yield this.calculateEstimates(j,$);return Estimate.createArrayEstimateInstancesFromProperties(et)})}registerDelegate(_,$){var{fee:j,storageLimit:et,gasLimit:tt}=_,rt=__rest(_,["fee","storageLimit","gasLimit"]);return __awaiter(this,void 0,void 0,function*(){const nt=(yield this.getKeys()).publicKeyHash,it=yield this.context.readProvider.getProtocolConstants("head"),st=$||nt,ot=yield this.prepare.registerDelegate(Object.assign({fee:j,storageLimit:et,gasLimit:tt},rt),st),at=yield this.calculateEstimates(ot,it);return ot.opOb.contents[0].kind==="reveal"&&(at.shift(),at[0].opSize-=this.OP_SIZE_REVEAL/2),Estimate.createEstimateInstanceFromProperties(at)})}reveal(_){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=_?yield this.prepare.reveal(_):yield this.prepare.reveal({}),rt=yield this.calculateEstimates(tt,et);return Estimate.createEstimateInstanceFromProperties(rt)}})}registerGlobalConstant(_){var{fee:$,storageLimit:j,gasLimit:et}=_,tt=__rest(_,["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(_){var{fee:$,storageLimit:j,gasLimit:et}=_,tt=__rest(_,["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(_){return __awaiter(this,void 0,void 0,function*(){const $=yield this.context.readProvider.getProtocolConstants("head"),j=yield this.prepare.updateConsensusKey(_),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(_){return __awaiter(this,void 0,void 0,function*(){const $=yield this.context.readProvider.getProtocolConstants("head"),j=yield this.prepare.smartRollupAddMessages(_),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(_){return __awaiter(this,void 0,void 0,function*(){const $=yield this.context.readProvider.getProtocolConstants("head"),j=yield this.prepare.smartRollupOriginate(_),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(_){return __awaiter(this,void 0,void 0,function*(){const $=yield this.context.readProvider.getProtocolConstants("head"),j=yield this.prepare.smartRollupExecuteOutboxMessage(_),et=yield this.calculateEstimates(j,$);return j.opOb.contents[0].kind==="reveal"&&et.shift(),Estimate.createEstimateInstanceFromProperties(et)})}contractCall(_){return __awaiter(this,void 0,void 0,function*(){const $=yield this.context.readProvider.getProtocolConstants("head"),j=yield this.prepare.contractCall(_),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(_,$,j,et,tt,rt){super(_,et,tt,rt),this.params=$,this.source=j}get operationResults(){const _=Array.isArray(this.results)&&this.results.find(j=>j.kind==="delegation"),$=_&&_.metadata&&_.metadata.operation_result;return $||void 0}get status(){var _,$;return($=(_=this.operationResults)===null||_===void 0?void 0:_.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 _;return(_=this.operationResults)===null||_===void 0?void 0:_.consumed_milligas}get errors(){var _;return(_=this.operationResults)===null||_===void 0?void 0:_.errors}}class OriginationOperation extends Operation{constructor(_,$,j,et,tt,rt){super(_,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 _,$;return($=(_=this.operationResults)===null||_===void 0?void 0:_.status)!==null&&$!==void 0?$:"unknown"}get operationResults(){const _=Array.isArray(this.results)&&this.results.find(j=>j.kind==="origination"),$=_&&hasMetadataWithResult(_)&&_.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 _;return(_=this.operationResults)===null||_===void 0?void 0:_.consumed_milligas}get storageDiff(){const _=this.operationResults&&this.operationResults.paid_storage_size_diff;return _||void 0}get storageSize(){const _=this.operationResults&&this.operationResults.storage_size;return _||void 0}get errors(){var _;return(_=this.operationResults)===null||_===void 0?void 0:_.errors}contract(_,$){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(_,$),this.contractProvider.at(this.contractAddress)})}}class RegisterGlobalConstantOperation extends Operation{constructor(_,$,j,et,tt,rt){super(_,et,tt,rt),this.params=$,this.source=j,this.globalConstantHash=this.operationResults&&this.operationResults.global_address}get operationResults(){const _=Array.isArray(this.results)&&this.results.find(j=>j.kind==="register_global_constant"),$=_&&_.metadata&&_.metadata.operation_result;return $||void 0}get status(){var _,$;return($=(_=this.operationResults)===null||_===void 0?void 0:_.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 _;return(_=this.operationResults)===null||_===void 0?void 0:_.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 _;return(_=this.operationResults)===null||_===void 0?void 0:_.consumed_milligas}}class RevealOperation extends Operation{constructor(_,$,j,et,tt,rt){super(_,et,tt,rt),this.params=$,this.source=j}get operationResults(){const _=Array.isArray(this.results)&&this.results.find($=>$.kind==="reveal");return _?[_]:[]}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(_,$){return _.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(_,$,j,et,tt,rt){super(_,et,tt,rt),this.params=$,this.source=j}get operationResults(){const _=Array.isArray(this.results)&&this.results.find($=>$.kind==="transaction");return _?[_]:[]}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(_,$){return _.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(_,$,j,et,tt,rt){super(_,et,tt,rt),this.params=$,this.source=j}get operationResults(){const _=Array.isArray(this.results)&&this.results.find(j=>j.kind==="increase_paid_storage"),$=_&&_.metadata&&_.metadata.operation_result;return $||void 0}get status(){var _,$;return($=(_=this.operationResults)===null||_===void 0?void 0:_.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 _;return(_=this.operationResults)===null||_===void 0?void 0:_.errors}get consumedMilliGas(){var _;return(_=this.operationResults)===null||_===void 0?void 0:_.consumed_milligas}get amount(){return this.params.amount}get destination(){return this.params.destination}}class UpdateConsensusKeyOperation extends Operation{constructor(_,$,j,et,tt,rt){super(_,et,tt,rt),this.params=$,this.source=j}get operationResults(){const _=Array.isArray(this.results)&&this.results.find(j=>j.kind==="update_consensus_key"),$=_&&_.metadata&&_.metadata.operation_result;return $||void 0}get status(){var _,$;return($=(_=this.operationResults)===null||_===void 0?void 0:_.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 _;return(_=this.operationResults)===null||_===void 0?void 0:_.consumed_milligas}get errors(){var _;return(_=this.operationResults)===null||_===void 0?void 0:_.errors}}class SmartRollupAddMessagesOperation extends Operation{constructor(_,$,j,et,tt,rt){super(_,et,tt,rt),this.params=$,this.source=j}get operationResults(){const _=Array.isArray(this.results)&&this.results.find(j=>j.kind==="smart_rollup_add_messages"),$=_&&_.metadata&&_.metadata.operation_result;return $||void 0}get status(){var _,$;return($=(_=this.operationResults)===null||_===void 0?void 0:_.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 _;return(_=this.operationResults)===null||_===void 0?void 0:_.consumed_milligas}get errors(){var _;return(_=this.operationResults)===null||_===void 0?void 0:_.errors}}class SmartRollupOriginateOperation extends Operation{constructor(_,$,j,et,tt,rt){super(_,et,tt,rt),this.params=$,this.source=j}get operationResults(){const _=Array.isArray(this.results)&&this.results.find(j=>j.kind===OpKind.SMART_ROLLUP_ORIGINATE),$=_&&_.metadata&&_.metadata.operation_result;return $||void 0}get status(){var _,$;return($=(_=this.operationResults)===null||_===void 0?void 0:_.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 _;return(_=this.operationResults)===null||_===void 0?void 0:_.consumed_milligas}get pvmKind(){return this.params.pvm_kind}get kernel(){return this.params.kernel}get errors(){var _;return(_=this.operationResults)===null||_===void 0?void 0:_.errors}}class BallotOperation extends Operation{constructor(_,$,j,et,tt,rt){super(_,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 _;return(_=this.operationResults)===null||_===void 0?void 0:_.period}get proposal(){return this.params.proposal}get ballot(){return this.params.ballot}}class DrainDelegateOperation extends Operation{constructor(_,$,j,et,tt){super(_,j,et,tt),this.params=$}get operationResults(){const _=Array.isArray(this.results)&&this.results.find(j=>j.kind==="drain_delegate"),$=_&&_.metadata&&_.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(_,$,j,et,tt,rt){super(_,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 _;return(_=this.operationResults)===null||_===void 0?void 0:_.period}}class TransferTicketOperation extends Operation{constructor(_,$,j,et,tt,rt){super(_,et,tt,rt),this.params=$,this.source=j}get operationResults(){const _=Array.isArray(this.results)&&this.results.find(j=>j.kind===OpKind.TRANSFER_TICKET),$=_&&_.metadata&&_.metadata.operation_result;return $||void 0}get status(){var _,$;return($=(_=this.operationResults)===null||_===void 0?void 0:_.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 _;return(_=this.operationResults)===null||_===void 0?void 0:_.consumed_milligas}}class SmartRollupExecuteOutboxMessageOperation extends Operation{constructor(_,$,j,et,tt,rt){super(_,et,tt,rt),this.params=$,this.source=j}get operationResults(){const _=Array.isArray(this.results)&&this.results.find(j=>j.kind===OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE),$=_&&_.metadata&&_.metadata.operation_result;return $||void 0}get status(){var _,$;return($=(_=this.operationResults)===null||_===void 0?void 0:_.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 _;return(_=this.operationResults)===null||_===void 0?void 0:_.consumed_milligas}get errors(){var _;return(_=this.operationResults)===null||_===void 0?void 0:_.errors}}class RpcContractProvider extends Provider{constructor(_,$){super(_),this.estimator=$,this.contractProviderTypeSymbol=Symbol.for("taquito-contract-provider-type-symbol"),this.prepare=new PrepareProvider(this.context)}getStorage(_,$){return __awaiter(this,void 0,void 0,function*(){const j=validateContractAddress(_);if(j!==ValidationResult.VALID)throw new InvalidContractAddressError(_,invalidDetail(j));const et=yield this.context.readProvider.getScript(_,"head");$||($=et);let tt;return Schema.isSchema($)?tt=$:tt=Schema.fromRPCResponse({script:$}),tt.Execute(et.storage,smartContractAbstractionSemantic(this))})}getBigMapKey(_,$,j){return __awaiter(this,void 0,void 0,function*(){const et=validateContractAddress(_);if(et!==ValidationResult.VALID)throw new InvalidContractAddressError(_,invalidDetail(et));j||(j=(yield this.rpc.getContract(_)).script);let tt;Schema.isSchema(j)?tt=j:tt=Schema.fromRPCResponse({script:j});const rt=tt.EncodeBigMapKey($),nt=yield this.rpc.getBigMapKey(_,rt);return tt.ExecuteOnBigMapValue(nt)})}getBigMapKeyByID(_,$,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),st=et?yield this.context.readProvider.getBigMapValue({id:_.toString(),expr:it},et):yield this.context.readProvider.getBigMapValue({id:_.toString(),expr:it},"head");return j.ExecuteOnBigMapValue(st,smartContractAbstractionSemantic(this))})}getBigMapKeysByID(_,$,j,et,tt=5){return __awaiter(this,void 0,void 0,function*(){const rt=yield this.getBlockForRequest($,et),nt=new MichelsonMap;let it=0,st=[];for(;it<$.length;){const at=$.slice(it,it+tt).map(ut=>this.getBigMapValueOrUndefined(ut,_,j,rt));st=[...st,...yield Promise.all(at)],it+=tt}for(let ot=0;otot.kind===OpKind.ORIGINATION),tt=yield this.forge(j),{hash:rt,context:nt,forgedBytes:it,opResponse:st}=yield this.signAndInject(tt);return new OriginationOperation(rt,et,it,st,nt,this)})}setDelegate(_){var $;return __awaiter(this,void 0,void 0,function*(){const j=validateAddress(_.source);if(_.source&&j!==ValidationResult.VALID)throw new InvalidAddressError(_.source,invalidDetail(j));const et=validateAddress(($=_.delegate)!==null&&$!==void 0?$:"");if(_.delegate&&et!==ValidationResult.VALID)throw new InvalidAddressError(_.delegate,invalidDetail(et));if(/kt1/i.test(_.source))throw new InvalidDelegationSource(_.source);const tt=yield this.signer.publicKeyHash(),rt=_.source||tt,nt=yield this.estimate(_,this.estimator.setDelegate.bind(this.estimator)),it=yield this.prepare.delegation(Object.assign(Object.assign({},_),nt)),st=it.opOb.contents.find(wt=>wt.kind===OpKind.DELEGATION),ot=yield this.forge(it),{hash:at,context:ut,forgedBytes:ht,opResponse:yt}=yield this.signAndInject(ot);return new DelegateOperation(at,st,rt,ht,yt,ut)})}registerDelegate(_){return __awaiter(this,void 0,void 0,function*(){const $=yield this.estimate(_,this.estimator.registerDelegate.bind(this.estimator)),j=yield this.signer.publicKeyHash(),et=yield this.prepare.registerDelegate(Object.assign(Object.assign({},_),$)),tt=et.opOb.contents.find(at=>at.kind===OpKind.DELEGATION),rt=yield this.forge(et),{hash:nt,context:it,forgedBytes:st,opResponse:ot}=yield this.signAndInject(rt);return new DelegateOperation(nt,tt,j,st,ot,it)})}transfer(_){var $;return __awaiter(this,void 0,void 0,function*(){const j=validateAddress(_.to);if(j!==ValidationResult.VALID)throw new InvalidAddressError(_.to,invalidDetail(j));const et=validateAddress(($=_.source)!==null&&$!==void 0?$:"");if(_.source&&et!==ValidationResult.VALID)throw new InvalidAddressError(_.source,invalidDetail(et));if(_.amount<0)throw new InvalidAmountError(_.amount.toString());const tt=yield this.signer.publicKeyHash(),rt=yield this.estimate(_,this.estimator.transfer.bind(this.estimator)),nt=_.source||tt,it=yield this.prepare.transaction(Object.assign(Object.assign({},_),rt)),st=it.opOb.contents.find(wt=>wt.kind===OpKind.TRANSACTION),ot=yield this.forge(it),{hash:at,context:ut,forgedBytes:ht,opResponse:yt}=yield this.signAndInject(ot);return new TransactionOperation(at,st,nt,ht,yt,ut)})}transferTicket(_){var $,j;return __awaiter(this,void 0,void 0,function*(){const et=validateAddress(_.destination);if(et!==ValidationResult.VALID)throw new InvalidAddressError(_.destination,invalidDetail(et));const tt=validateAddress(($=_.source)!==null&&$!==void 0?$:"");if(_.source&&tt!==ValidationResult.VALID)throw new InvalidAddressError(_.source,invalidDetail(tt));const rt=yield this.signer.publicKeyHash(),nt=(j=_.source)!==null&&j!==void 0?j:rt,it=yield this.estimate(_,this.estimator.transferTicket.bind(this.estimator)),st=yield this.prepare.transferTicket(Object.assign(Object.assign({},_),it)),ot=st.opOb.contents.find(Ct=>Ct.kind===OpKind.TRANSFER_TICKET),at=yield this.forge(st),{hash:ut,context:ht,forgedBytes:yt,opResponse:wt}=yield this.signAndInject(at);return new TransferTicketOperation(ut,ot,nt,yt,wt,ht)})}reveal(_){return __awaiter(this,void 0,void 0,function*(){const $=yield this.signer.publicKeyHash(),j=yield this.estimator.reveal(_);if(j){const et=yield this.estimate(_,()=>__awaiter(this,void 0,void 0,function*(){return j})),tt=yield this.prepare.reveal(Object.assign(Object.assign({},_),et)),rt=tt.opOb.contents.find(ut=>ut.kind===OpKind.REVEAL),nt=yield this.forge(tt),{hash:it,context:st,forgedBytes:ot,opResponse:at}=yield this.signAndInject(nt);return new RevealOperation(it,rt,$,ot,at,st)}else throw new RevealOperationError(`The publicKeyHash '${$}' has already been revealed.`)})}registerGlobalConstant(_){return __awaiter(this,void 0,void 0,function*(){const $=yield this.signer.publicKeyHash(),j=yield this.estimate(_,this.estimator.registerGlobalConstant.bind(this.estimator)),et=yield this.prepare.registerGlobalConstant(Object.assign(Object.assign({},_),j)),tt=et.opOb.contents.find(at=>at.kind===OpKind.REGISTER_GLOBAL_CONSTANT),rt=yield this.forge(et),{hash:nt,context:it,forgedBytes:st,opResponse:ot}=yield this.signAndInject(rt);return new RegisterGlobalConstantOperation(nt,tt,$,st,ot,it)})}increasePaidStorage(_){return __awaiter(this,void 0,void 0,function*(){if(_.amount<0)throw new InvalidAmountError(_.amount.toString());const $=yield this.signer.publicKeyHash(),j=yield this.estimate(_,this.estimator.increasePaidStorage.bind(this.estimator)),et=yield this.prepare.increasePaidStorage(Object.assign(Object.assign({},_),j)),tt=et.opOb.contents.find(at=>at.kind===OpKind.INCREASE_PAID_STORAGE),rt=yield this.forge(et),{hash:nt,context:it,forgedBytes:st,opResponse:ot}=yield this.signAndInject(rt);return new IncreasePaidStorageOperation(nt,tt,$,st,ot,it)})}drainDelegate(_){return __awaiter(this,void 0,void 0,function*(){const $=yield this.prepare.drainDelegate(_),j=$.opOb.contents.find(st=>st.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(_){var $,j;return __awaiter(this,void 0,void 0,function*(){const et=yield this.signer.publicKeyHash(),tt=validateAddress(($=_.source)!==null&&$!==void 0?$:"");if(_.source&&tt!==ValidationResult.VALID)throw new InvalidAddressError(_.source,invalidDetail(tt));const rt=(j=_.source)!==null&&j!==void 0?j:et,nt=yield this.prepare.ballot(Object.assign(Object.assign({},_),{source:rt})),it=nt.opOb.contents.find(yt=>yt.kind===OpKind.BALLOT),st=yield this.forge(nt),{hash:ot,context:at,forgedBytes:ut,opResponse:ht}=yield this.signAndInject(st);return new BallotOperation(ot,it,et,ut,ht,at)})}proposals(_){var $,j;return __awaiter(this,void 0,void 0,function*(){const et=yield this.signer.publicKeyHash(),tt=validateAddress(($=_.source)!==null&&$!==void 0?$:"");if(_.source&&tt!==ValidationResult.VALID)throw new InvalidAddressError(_.source,invalidDetail(tt));const rt=(j=_.source)!==null&&j!==void 0?j:et,nt=yield this.prepare.proposals(Object.assign(Object.assign({},_),{source:rt})),it=nt.opOb.contents.find(yt=>yt.kind===OpKind.PROPOSALS),st=yield this.forge(nt),{hash:ot,context:at,forgedBytes:ut,opResponse:ht}=yield this.signAndInject(st);return new ProposalsOperation(ot,it,et,ut,ht,at)})}updateConsensusKey(_){return __awaiter(this,void 0,void 0,function*(){const $=yield this.signer.publicKeyHash(),j=yield this.estimate(_,this.estimator.updateConsensusKey.bind(this.estimator)),et=yield this.prepare.updateConsensusKey(Object.assign(Object.assign({},_),j)),tt=et.opOb.contents.find(at=>at.kind===OpKind.UPDATE_CONSENSUS_KEY),rt=yield this.forge(et),{hash:nt,context:it,forgedBytes:st,opResponse:ot}=yield this.signAndInject(rt);return new UpdateConsensusKeyOperation(nt,tt,$,st,ot,it)})}smartRollupAddMessages(_){return __awaiter(this,void 0,void 0,function*(){const $=yield this.signer.publicKeyHash(),j=yield this.estimate(_,this.estimator.smartRollupAddMessages.bind(this.estimator)),et=yield this.prepare.smartRollupAddMessages(Object.assign(Object.assign({},_),j)),tt=et.opOb.contents.find(at=>at.kind===OpKind.SMART_ROLLUP_ADD_MESSAGES),rt=yield this.forge(et),{hash:nt,context:it,forgedBytes:st,opResponse:ot}=yield this.signAndInject(rt);return new SmartRollupAddMessagesOperation(nt,tt,$,st,ot,it)})}smartRollupOriginate(_){return __awaiter(this,void 0,void 0,function*(){const $=yield this.signer.publicKeyHash(),j=yield this.estimate(_,this.estimator.smartRollupOriginate.bind(this.estimator)),et=yield this.prepare.smartRollupOriginate(Object.assign(Object.assign({},_),j)),tt=et.opOb.contents.find(at=>at.kind===OpKind.SMART_ROLLUP_ORIGINATE),rt=yield this.forge(et),{hash:nt,context:it,forgedBytes:st,opResponse:ot}=yield this.signAndInject(rt);return new SmartRollupOriginateOperation(nt,tt,$,st,ot,it)})}smartRollupExecuteOutboxMessage(_){return __awaiter(this,void 0,void 0,function*(){const $=yield this.signer.publicKeyHash(),j=yield this.estimate(_,this.estimator.smartRollupExecuteOutboxMessage.bind(this.estimator)),et=yield this.prepare.smartRollupExecuteOutboxMessage(Object.assign(Object.assign({},_),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:st,opResponse:ot}=yield this.signAndInject(rt);return new SmartRollupExecuteOutboxMessageOperation(nt,tt,$,st,ot,it)})}failingNoop(_){return __awaiter(this,void 0,void 0,function*(){const $={kind:OpKind.FAILING_NOOP,arbitrary:_.arbitrary},j=yield this.context.readProvider.getBlockHash(_.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:_.arbitrary}]}}})}at(_,$=j=>j){return __awaiter(this,void 0,void 0,function*(){const j=validateContractAddress(_);if(j!==ValidationResult.VALID)throw new InvalidContractAddressError(_,invalidDetail(j));const et=this.context.withExtensions().rpc,tt=this.context.withExtensions().readProvider,rt=yield tt.getScript(_,"head"),nt=yield tt.getEntrypoints(_),it=new ContractAbstraction(_,rt,this,this,nt,et,tt);return $(it,this.context)})}batch(_){const $=new OperationBatch(this.context,this.estimator);return Array.isArray(_)&&$.with(_),$}}class MichelCodecParser{constructor(_){this.context=_}getNextProto(){return __awaiter(this,void 0,void 0,function*(){if(!this.context.proto){const _=yield this.context.readProvider.getNextProtocol("head");this.context.proto=_}return this.context.proto})}parseScript(_){return __awaiter(this,void 0,void 0,function*(){return new Parser$1({protocol:yield this.getNextProto()}).parseScript(_)})}parseMichelineExpression(_){return __awaiter(this,void 0,void 0,function*(){return new Parser$1({protocol:yield this.getNextProto()}).parseMichelineExpression(_)})}parseJSON(_){return __awaiter(this,void 0,void 0,function*(){return new Parser$1({protocol:yield this.getNextProto()}).parseJSON(_)})}prepareCodeOrigination(_){return __awaiter(this,void 0,void 0,function*(){const $=_;if($.code=yield this.formatCodeParam(_.code),_.init)$.init=yield this.formatInitParam(_.init);else if(_.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",_.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(_.storage)}else $.init=et.Encode(_.storage);delete $.storage}return $})}formatCodeParam(_){return __awaiter(this,void 0,void 0,function*(){let $;if(typeof _=="string"){const j=yield this.parseScript(_);if(j===null)throw new InvalidCodeParameter("Unable to parse",_);$=j}else{const j=yield this.parseJSON(_),et=["parameter","storage","code"];$=j.sort((tt,rt)=>et.indexOf(tt.prim)-et.indexOf(rt.prim))}return $})}formatInitParam(_){return __awaiter(this,void 0,void 0,function*(){let $;if(typeof _=="string"){const j=yield this.parseMichelineExpression(_);if(j===null)throw new InvalidInitParameter("Invalid init parameter",_);$=j}else $=yield this.parseJSON(_);return $})}findGlobalConstantsHashAndValue(_){return __awaiter(this,void 0,void 0,function*(){const $=_.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(_){this.context=_}packData(_){return __awaiter(this,void 0,void 0,function*(){return this.context.rpc.packData(_)})}}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(_){return __awaiter(this,void 0,void 0,function*(){throw new UnconfiguredGlobalConstantsProviderError})}}class RpcReadAdapter{constructor(_){this.rpc=_}getBalance(_,$){return __awaiter(this,void 0,void 0,function*(){return this.rpc.getBalance(_,{block:String($)})})}getDelegate(_,$){return __awaiter(this,void 0,void 0,function*(){return this.rpc.getDelegate(_,{block:String($)})})}getNextProtocol(_){return __awaiter(this,void 0,void 0,function*(){return(yield this.rpc.getProtocols({block:String(_)})).next_protocol})}getProtocolConstants(_){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(_)});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(_,$){return __awaiter(this,void 0,void 0,function*(){const{script:j}=yield this.rpc.getContract(_,{block:String($)});return j})}getStorage(_,$){return __awaiter(this,void 0,void 0,function*(){return this.rpc.getStorage(_,{block:String($)})})}getBlockHash(_){return __awaiter(this,void 0,void 0,function*(){const{hash:$}=yield this.rpc.getBlockHeader({block:String(_)});return $})}getBlockLevel(_){return __awaiter(this,void 0,void 0,function*(){const{level:$}=yield this.rpc.getBlockHeader({block:String(_)});return $})}getCounter(_,$){return __awaiter(this,void 0,void 0,function*(){const{counter:j}=yield this.rpc.getContract(_,{block:String($)});return j||"0"})}getBlockTimestamp(_){return __awaiter(this,void 0,void 0,function*(){const{timestamp:$}=yield this.rpc.getBlockHeader({block:String(_)});return $})}getBigMapValue(_,$){return __awaiter(this,void 0,void 0,function*(){return this.rpc.getBigMapExpr(_.id,_.expr,{block:String($)})})}getSaplingDiffById(_,$){return __awaiter(this,void 0,void 0,function*(){return this.rpc.getSaplingDiffById(_.id,{block:String($)})})}getSaplingDiffByContract(_,$){return __awaiter(this,void 0,void 0,function*(){return this.rpc.getSaplingDiffByContract(_,{block:String($)})})}getEntrypoints(_){return __awaiter(this,void 0,void 0,function*(){return this.rpc.getEntrypoints(_)})}getChainId(){return __awaiter(this,void 0,void 0,function*(){return this.rpc.getChainId()})}isAccountRevealed(_,$){return __awaiter(this,void 0,void 0,function*(){const j=yield this.rpc.getManagerKey(_,{block:String($)});return j&&typeof j=="object"?!!j.key:!!j})}getBlock(_){return __awaiter(this,void 0,void 0,function*(){return this.rpc.getBlock({block:String(_)})})}getLiveBlocks(_){return this.rpc.getLiveBlocks({block:String(_)})}}class UnsupportedEventError extends ParameterValidationError{constructor(_){super(),this.type=_,this.name="UnsupportedEventError",this.message=`Unsupported event type "${_}" expecting one of the "data", "error", or "close".`}}class InvalidFilterExpressionError extends ParameterValidationError{constructor(_){super(),this.invalidExpression=_,this.name="InvalidFilterExpressionError",this.message="Invalid filter expression expecting the object to contain either and/or property"}}const opHashFilter=(a,_)=>a.hash===_.opHash,sourceFilter=(a,_)=>{switch(a.kind){case"attestation":return"metadata"in a&&a.metadata.delegate===_.source;case"endorsement":return"metadata"in a&&a.metadata.delegate===_.source;case"activate_account":return"metadata"in a&&a.pkh===_.source;default:return"source"in a&&a.source===_.source}},kindFilter=(a,_)=>"kind"in a&&a.kind===_.kind,destinationFilter=(a,_)=>{switch(a.kind){case"delegation":return a.delegate===_.destination;case"origination":if("metadata"in a&&"operation_result"in a.metadata&&"originated_contracts"in a.metadata.operation_result&&Array.isArray(a.metadata.operation_result.originated_contracts))return a.metadata.operation_result.originated_contracts.some($=>$===_.destination);break;case"transaction":return a.destination===_.destination;default:return!1}},eventFilter=(a,_,$,j)=>!(a.kind!=="event"||$&&a.tag!==$||_&&a.source!==_||j&&a.result.status!=="applied"),evaluateOpFilter=(a,_)=>"opHash"in _?opHashFilter(a,_):"source"in _?sourceFilter(a,_):"kind"in _?kindFilter(a,_):"destination"in _?destinationFilter(a,_):!1,evaluateExpression=(a,_)=>{if(Array.isArray(_.and))return _.and.every($=>evaluateFilter(a,$));if(Array.isArray(_.or))return _.or.some($=>evaluateFilter(a,$));throw new InvalidFilterExpressionError(_)},evaluateFilter=(a,_)=>{const $=[];return Array.isArray(_)?$.push(..._):$.push(_),$.every(j=>"and"in j||"or"in j?evaluateExpression(a,j):evaluateOpFilter(a,j))};class ObservableSubscription{constructor(_,$=!1,j=retry()){this.shouldRetry=$,this.operatorFunction=j,this.errorListeners=[],this.messageListeners=[],this.closeListeners=[],this.completed$=new Subject,_.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(_,$){for(const j of _)try{j($)}catch(et){console.error(et)}}remove(_,$){const j=_.indexOf($);j!==-1&&_.splice(j,1)}on(_,$){switch(_){case"data":this.messageListeners.push($);break;case"error":this.errorListeners.push($);break;case"close":this.closeListeners.push($);break;default:throw new UnsupportedEventError(_)}}off(_,$){switch(_){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(_)}}close(){this.completed$.next()}}const defaultConfigStreamer={shouldObservableSubscriptionRetry:!1,observableSubscriptionRetryFunction:retry()},getLastBlock=a=>from(a.rpc.getBlock()).pipe(first()),applyFilter=a=>concatMap(_=>new Observable($=>{for(const j of _.operations)for(const et of j)for(const tt of et.contents)evaluateFilter(Object.assign({hash:et.hash},tt),a)&&$.next(Object.assign({hash:et.hash},tt));$.complete()})),applyEventFilter=a=>concatMap(_=>new Observable($=>{for(const j of _.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,a==null?void 0:a.address,a==null?void 0:a.tag,a==null?void 0:a.excludeFailedOperations)&&$.next(Object.assign({opHash:et.hash,blockHash:_.hash,level:_.header.level},it))}$.complete()}));class PollingSubscribeProvider{constructor(_,$={}){this.context=_,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(_){return new ObservableSubscription(this.newBlock$,this.config.shouldObservableSubscriptionRetry,this.config.observableSubscriptionRetryFunction)}subscribe(_){return new ObservableSubscription(this.newBlock$.pipe(pluck("hash")),this.config.shouldObservableSubscriptionRetry,this.config.observableSubscriptionRetryFunction)}subscribeOperation(_){return new ObservableSubscription(this.newBlock$.pipe(applyFilter(_)),this.config.shouldObservableSubscriptionRetry,this.config.observableSubscriptionRetryFunction)}subscribeEvent(_){return new ObservableSubscription(this.newBlock$.pipe(applyEventFilter(_)),this.config.shouldObservableSubscriptionRetry,this.config.observableSubscriptionRetryFunction)}}class TaquitoLocalForger{constructor(_){this.context=_}getNextProto(){return __awaiter(this,void 0,void 0,function*(){if(!this.context.proto){const _=yield this.context.readProvider.getNextProtocol("head");this.context.proto=_}return this.context.proto})}forge({branch:_,contents:$}){return __awaiter(this,void 0,void 0,function*(){return new LocalForger(yield this.getNextProto()).forge({branch:_,contents:$})})}}const defaultConfigConfirmation={defaultConfirmationCount:1,confirmationPollingTimeoutSecond:180};class Context{constructor(_,$=new NoopSigner,j,et=new BehaviorSubject(Object.assign({},defaultConfigConfirmation)),tt,rt,nt,it,st,ot,at,ut){this._rpc=_,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(yt=>{ht=yt(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=st||new MichelCodecParser(this),this._packer=nt||new RpcPacker(this),this._globalConstantsProvider=ot||new NoopGlobalConstantsProvider,this._readProvider=at||new RpcReadAdapter(this._rpcClient),this._stream=ut||new PollingSubscribeProvider(this)}get config(){return this._config.getValue()}set config(_){this._config.next(Object.assign({},_))}setPartialConfig(_){this._config.next(Object.assign(Object.assign({},this._config.getValue()),_))}get rpc(){return this._rpcClient}set rpc(_){this._rpcClient=_}get injector(){return this._injector}set injector(_){this._injector=_}get forger(){return this._forger}set forger(_){this._forger=_}get signer(){return this._signer}set signer(_){this._signer=_}get walletProvider(){return this._walletProvider}set walletProvider(_){this._walletProvider=_}set proto(_){this._proto=_}get proto(){return this._proto}get parser(){return this._parser}set parser(_){this._parser=_}get packer(){return this._packer}set packer(_){this._packer=_}get globalConstantsProvider(){return this._globalConstantsProvider}set globalConstantsProvider(_){this._globalConstantsProvider=_}get readProvider(){return this._readProvider}set readProvider(_){this._readProvider=_}get stream(){return this._stream}set stream(_){this._stream=_}isAnyProtocolActive(_=[]){return __awaiter(this,void 0,void 0,function*(){if(this._proto)return _.includes(this._proto);{const $=yield this.readProvider.getNextProtocol("head");return _.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(_){this.providerDecorator.push(_)}}const VERSION={commitHash:"2e05f6f865be17a1b367b284542b24ffa9823271",version:"19.2.1"};class TezosToolkit{constructor(_){this._rpc=_,this._options={},this.format=format$1,typeof this._rpc=="string"?this._rpcClient=new RpcClient(this._rpc):this._rpcClient=this._rpc,this._context=new Context(_),this._wallet=new Wallet(this._context),this.setProvider({rpc:this._rpcClient}),this.batch=this._context.batch.batch.bind(this._context.batch)}setProvider({rpc:_,stream:$,signer:j,protocol:et,config:tt,forger:rt,wallet:nt,packer:it,globalConstantsProvider:st,readProvider:ot,parserProvider:at,injectorProvider:ut}){this.setRpcProvider(_),this.setStreamProvider($),this.setSignerProvider(j),this.setForgerProvider(rt),this.setWalletProvider(nt),this.setPackerProvider(it),this.setGlobalConstantsProvider(st),this.setReadProvider(ot),this.setParserProvider(at),this.setInjectorProvider(ut),this._context.proto=et,tt&&this._context.setPartialConfig(tt)}setSignerProvider(_){!this._options.signer&&typeof _>"u"?(this._context.signer=new NoopSigner,this._options.signer=_):typeof _<"u"&&(this._context.signer=_,this._options.signer=_)}setRpcProvider(_){typeof _=="string"?this._rpcClient=new RpcClient(_):_===void 0||(this._rpcClient=_),this._options.rpc=this._rpcClient,this._context.rpc=this._rpcClient}setForgerProvider(_){if(typeof _<"u")this._options.forger=_,this._context.forger=_;else if(this._options.forger===void 0){const $=this.getFactory(TaquitoLocalForger)();this._options.forger=$,this._context.forger=$}}setStreamProvider(_){if(typeof _=="string"){const $=new PollingSubscribeProvider(new Context(new RpcClient(_)));this._options.stream=$,this._context.stream=$}else if(typeof _<"u")this._options.stream=_,this._context.stream=_;else if(this._options.stream===void 0){const $=this.getFactory(PollingSubscribeProvider)();this._options.stream=$,this._context.stream=$}}setWalletProvider(_){if(!this._options.wallet&&typeof _>"u"){const $=this.getFactory(LegacyWalletProvider)();this._options.wallet=$,this._context.walletProvider=$}else typeof _<"u"&&(this._options.wallet=_,this._context.walletProvider=_)}setPackerProvider(_){if(!this._options.packer&&typeof _>"u"){const $=this.getFactory(RpcPacker)();this._context.packer=$,this._options.packer=$}else typeof _<"u"&&(this._context.packer=_,this._options.packer=_)}setGlobalConstantsProvider(_){if(!this._options.globalConstantsProvider&&typeof _>"u"){const $=new NoopGlobalConstantsProvider;this._context.globalConstantsProvider=$,this._options.globalConstantsProvider=$}else typeof _<"u"&&(this._context.globalConstantsProvider=_,this._options.globalConstantsProvider=_)}setReadProvider(_){const $=_||new RpcReadAdapter(this._context.rpc);this._options.readProvider=$,this._context.readProvider=$}setParserProvider(_){if(!this._options.parserProvider&&typeof _>"u"){const $=new MichelCodecParser(this._context);this._context.parser=$,this._options.parserProvider=$}else typeof _<"u"&&(this._context.parser=_,this._options.parserProvider=_)}setInjectorProvider(_){if(!this._options.injectorProvider&&typeof _>"u"){const $=new RpcInjector(this._context);this._context.injector=$,this._options.injectorProvider=$}else typeof _<"u"&&(this._context.injector=_,this._options.injectorProvider=_)}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(_){Array.isArray(_)?_.forEach($=>$.configureContext(this._context)):_.configureContext(this._context)}getFactory(_){return(...$)=>new _(this._context,...$)}getVersionInfo(){return VERSION}}class FakeSigner{constructor(_,$){this.pk=_,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(_);return makeContractCallOperation(a,"propose",$)},makeContractCallOperation=(a,_,$,j="0")=>({type:"contract_call",contract:a,entrypoint:_,args:$,amount:j}),headlessLambda=a=>lodashExports.isEqual(a.slice(0,2),LAMBDA_HEADER)?a.slice(2):a,toLambda=a=>{switch(a.type){case"tez":switch(a.recipient.type){case"implicit":return MANAGER_LAMBDA.transferImplicit(a.recipient.pkh,Number(a.amount));case"contract":return MANAGER_LAMBDA.transferToContract(a.recipient.pkh,Number(a.amount))}case"fa1.2":return contractLambda(a,FA12_TRANSFER_ARG_TYPES,makeFA12TransactionParameter(a));case"fa2":return contractLambda(a,FA2_TRANSFER_ARG_TYPES,makeFA2TransactionParameter(a));case"delegation":return MANAGER_LAMBDA.setDelegate(a.recipient.pkh);case"undelegation":return MANAGER_LAMBDA.removeDelegate();case"contract_origination":case"contract_call":throw new Error(`${a.type} is not supported yet`)}},toBatchLambda=a=>{const _=a.map($=>toLambda($)).flatMap(headlessLambda);return[...LAMBDA_HEADER,..._]},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:a.contract.pkh+"%"+$.entrypoint}]},{prim:"CONTRACT",args:[_]},[{prim:"IF_NONE",args:[[{prim:"UNIT"},{prim:"FAILWITH"}],[]]}],{prim:"PUSH",args:[{prim:"mutez"},{int:"0"}]},{prim:"PUSH",args:[_,$.value]},{prim:"TRANSFER_TOKENS"},{prim:"CONS"}],makeFA12TransactionParameter=({sender:a,recipient:_,amount:$})=>({entrypoint:"transfer",value:{prim:"Pair",args:[{string:a.pkh},{prim:"Pair",args:[{string:_.pkh},{int:$}]}]}}),makeFA2TransactionParameter=({sender:a,recipient:_,tokenId:$,amount:j})=>({entrypoint:"transfer",value:[{prim:"Pair",args:[{string:a.pkh},[{prim:"Pair",args:[{string:_.pkh},{prim:"Pair",args:[{int:$},{int:j}]}]}]]}]}),addressExists=async(a,_)=>{try{const $=`${_.tzktApiUrl}/v1/accounts/${a}`,{data:{type:j}}=await axios.get($);return j!=="empty"}catch($){throw new Error(`Error fetching account from tzkt ${$.message}`)}},getFingerPrint=async a=>{const _=new TextEncoder().encode(a),$=await crypto.subtle.digest("SHA-256",_);return Array.from(new Uint8Array($)).map(tt=>tt.toString(16).padStart(2,"0")).join("").slice(0,8)},curvesToDerivationPath=a=>{switch(a){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 a=>{switch(a.type){case"social":case"mnemonic":case"secret_key":return new InMemorySigner(a.secretKey);case"ledger":{const _=await TransportWebUSB.list();for(let et=0;et<_.length;et++)_[et].close();const $=await TransportWebUSB.create();return new LedgerSigner($,a.account.derivationPath,!1,curvesToDerivationPath(a.account.curve))}case"fake":return new FakeSigner(a.signer.pk,a.signer.address.pkh)}},makeToolkit=async a=>{const _=new TezosToolkit(a.network.rpcUrl),$=await makeSigner(a);return _.setSignerProvider($),_},getPublicKeyPairFromSk=async a=>{const _=new InMemorySigner(a);return{pk:await _.publicKey(),pkh:await _.publicKeyHash()}},derivePublicKeyPair=async(a,_,$="ed25519")=>deriveSecretKey(a,_,$).then(getPublicKeyPairFromSk),deriveSecretKey=(a,_,$)=>InMemorySigner.fromMnemonic({mnemonic:a,derivationPath:_,curve:$}).secretKey(),selectRandomElements=(a,_)=>lodashExports.shuffle(a.map(($,j)=>({value:$,index:j}))).slice(0,_).sort(($,j)=>$.index-j.index),sumTez=a=>a.reduce((_,$)=>_.plus($),new BigNumber(0)),operationToTaquitoOperation=a=>{switch(a.type){case"tez":return{kind:OpKind.TRANSACTION,to:a.recipient.pkh,amount:parseInt(a.amount),mutez:!0};case"contract_call":return{kind:OpKind.TRANSACTION,to:a.contract.pkh,amount:parseInt(a.amount),mutez:!0,parameter:{entrypoint:a.entrypoint,value:a.args}};case"delegation":return{kind:OpKind.DELEGATION,source:a.sender.pkh,delegate:a.recipient.pkh};case"undelegation":return{kind:OpKind.DELEGATION,source:a.sender.pkh,delegate:void 0};case"fa1.2":return{kind:OpKind.TRANSACTION,amount:0,to:a.contract.pkh,parameter:makeFA12TransactionParameter(a)};case"fa2":return{kind:OpKind.TRANSACTION,amount:0,to:a.contract.pkh,parameter:makeFA2TransactionParameter(a)};case"contract_origination":return{kind:OpKind.ORIGINATION,...a}}},operationsToBatchParams=({type:a,operations:_,sender:$})=>(a==="implicit"?_:[makeMultisigProposeOperation($.address,_)]).map(operationToTaquitoOperation),operationsToWalletParams=operationsToBatchParams,estimate=async(a,_)=>{const $=await makeToolkit({type:"fake",signer:a.signer,network:_});try{const j=await $.estimate.batch(operationsToBatchParams(a));return sumTez(j.map(et=>Math.max(et.suggestedFeeMutez,et.totalCost).toString()))}catch(j){throw await addressExists(a.signer.address.pkh,_)?(j instanceof Error&&(j.message=handleTezError(j)),j):new Error(`Signer address is not revealed on the ${_.name}.`)}},handleTezError=a=>a.message.includes("subtraction_underflow")?"Insufficient balance, please make sure you have enough funds.":a.message.includes("contract.non_existing_contract")?"Contract does not exist, please check if the correct network is selected.":a.message,getAccounts=async(a,_)=>withRateLimit(()=>accountsGet({address:{in:[a.join(",")]},select:{fields:["address,balance,delegationLevel"]}},{baseUrl:_.tzktApiUrl})),getTokenBalances=async(a,_)=>withRateLimit(()=>tokensGetTokenBalances({account:{in:[a.join(",")]},balance:{gt:"0"},limit:1e4},{baseUrl:_.tzktApiUrl})),getDelegations=async(a,_,$)=>withRateLimit(()=>operationsGetDelegations({sender:{in:[a.join(",")]},...$},{baseUrl:_.tzktApiUrl})),getTransactions=async(a,_,$)=>withRateLimit(()=>operationsGetTransactions({anyof:{fields:["sender","target","initiator"],in:[a.join(",")]},...$},{baseUrl:_.tzktApiUrl})),getOriginations=async(a,_,$)=>withRateLimit(()=>operationsGetOriginations({sender:{in:[a.join(",")]},...$},{baseUrl:_.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,_)=>a.length===0?[]:withRateLimit(()=>tokensGetTokenTransfers({transactionId:{in:[a.join(",")]}},{baseUrl:_.tzktApiUrl})),getTokenTransfers=async(a,_,$)=>withRateLimit(async()=>(await tokensGetTokenTransfers({anyof:{fields:["from","to"],in:[a.join(",")]},...$},{baseUrl:_.tzktApiUrl})).map(et=>({...et,type:"token_transfer"}))),getLastDelegation=(a,_)=>getDelegations([a],_,{limit:1,sort:{desc:"id"}}).then(lodashExports.first),getTezosPriceInUSD=()=>withRateLimit(()=>quotesGetLast().then(a=>a.usd)),getLatestBlockLevel=async a=>withRateLimit(async()=>await blocksGetCount({baseUrl:a.tzktApiUrl})),getBakers=async a=>withRateLimit(()=>delegatesGet({sort:{desc:"stakingBalance"},active:{eq:!0},limit:1e4,select:{fields:["address,alias,stakingBalance"]}},{baseUrl:a.tzktApiUrl}).then(_=>_.map($=>({name:$.alias||"Unknown baker",address:$.address,stakingBalance:$.stakingBalance})))),executeOperations=async(a,_)=>{const $=operationsToWalletParams(a);return _.wallet.batch($).send()},TEZ="ꜩ",TEZ_DECIMALS=6,truncate=(a,_)=>a.length>_?a.slice(0,_-3)+"...":a,tezToMutez=a=>format$1("tz","mutez",a),mutezToTez=a=>format$1("mutez","tz",a),prettyTezAmount=a=>{const _=BigNumber(mutezToTez(a)).toNumber();return`${new Intl.NumberFormat("en-US",{minimumFractionDigits:TEZ_DECIMALS,maximumFractionDigits:TEZ_DECIMALS}).format(_)} ${TEZ}`},formatPkh=a=>`${a.slice(0,5)}...${a.slice(-5)}`,useBlockLevel=()=>useAppSelector(a=>a.assets.blockLevel),useIsBlockFinalised=a=>{const _=useBlockLevel();return _!==null?_-a>=2:null},useAllNfts=()=>{const a=useGetAccountNFTs(),_=useAppSelector(j=>j.assets.balances.tokens),$=Object.keys(_);return lodashExports.fromPairs($.map(j=>[j,a(j)]))},useGetAccountAssets=()=>{const a=useGetToken(),_=useAppSelector($=>$.assets.balances.tokens);return $=>{const j=_[$]||[];return lodashExports.compact(j.map(({contract:et,tokenId:tt,...rt})=>{const nt=a(et,tt);return nt&&{...nt,...rt}}))}},useGetAccountFA2Tokens=()=>{const a=useGetAccountAssets();return _=>keepFA2s(a(_))},useGetAccountFA1Tokens=()=>{const a=useGetAccountAssets();return _=>keepFA1s(a(_))},useGetAccountAllTokens=()=>{const a=useGetAccountFA1Tokens(),_=useGetAccountFA2Tokens();return $=>[...a($),..._($)]},useGetAccountNFTs=()=>{const a=useGetAccountAssets();return _=>keepNFTs(a(_))},useGetTokenTransfer=()=>{const a=useAppSelector(_=>_.assets.transfers.tokens);return _=>{const $=a[_];return $&&{...$,type:"token_transfer"}}},useConversionRate=()=>useAppSelector(a=>a.assets.conversionRate),useTezToDollar=()=>{const a=useConversionRate();return a?_=>BigNumber(_).multipliedBy(a).decimalPlaces(2,BigNumber.ROUND_UP):()=>{}},useGetDollarBalance=()=>{const a=useTezToDollar(),_=useGetAccountBalance();return $=>{const j=_($);return j===void 0?void 0:a(mutezToTez(j))}},useTotalBalance=()=>{const a=useAppSelector(tt=>tt.assets.balances.mutez),_=useTezToDollar(),$=Object.values(a);if($.length===0)return null;const j=$.reduce((tt,rt)=>tt.plus(rt),BigNumber(0)),et=_(mutezToTez(j));return{mutez:j.toFixed(),usd:et}},useGetAccountBalance=()=>{const a=useAppSelector(_=>_.assets.balances.mutez);return _=>a[_]},useBakerList=()=>useAppSelector(a=>a.assets.bakers),useGetBaker=()=>{const a=useBakerList();return _=>a.find($=>$.address===_)},useRefetchTrigger=()=>useAppSelector(a=>a.assets.refetchTrigger),useIsLoading=()=>useAppSelector(a=>a.assets.isLoading),useLastTimeUpdated=()=>useAppSelector(a=>a.assets.lastTimeUpdated),useMultisigAccounts=()=>useAppSelector(a=>a.multisigs.items),useGetPendingMultisigOperations=()=>{const a=useAppSelector(_=>_.multisigs.pendingOperations);return _=>[...a[_.pendingOperationsBigmapId]??[]].sort((j,et)=>Number(et.id)-Number(j.id))},useSeedPhrases=()=>useAppSelector(a=>a.accounts.seedPhrases),useSecretKeys=()=>useAppSelector(a=>a.accounts.secretKeys),useImplicitAccounts=()=>useAppSelector(a=>a.accounts.items),useGetImplicitAccountSafe=()=>{const a=useImplicitAccounts();return _=>a.find($=>$.address.pkh===_)},useGetImplicitAccount=()=>{const a=useGetImplicitAccountSafe();return _=>{const $=a(_);if(!$)throw new Error(`Unknown account: ${_}`);return $}},useGetAccountsByType=()=>{const a=useImplicitAccounts();return _=>a.filter($=>$.type===_)},useGetAccountsByFingerPrint=()=>{const a=useGetAccountsByType();return _=>a("mnemonic").filter($=>$.seedFingerPrint===_)},useAllAccounts=()=>{const a=useImplicitAccounts(),_=useMultisigAccounts();return[...a,..._]},useGetOwnedAccountSafe=()=>{const a=useAllAccounts();return _=>a.find($=>$.address.pkh===_)},useGetOwnedAccount=()=>{const a=useGetOwnedAccountSafe();return _=>{const $=a(_);if(!$)throw new Error(`Unknown account: ${_}`);return $}},useValidateMasterPassword=()=>{const a=useSeedPhrases(),_=useSecretKeys(),$=Object.values({..._,...a})[0];return $?async j=>{await decrypt$1($,j)}:null},useIsOwnedAddress=()=>{const a=useAllAccounts(),_=new Set(a.map($=>$.address.pkh));return $=>!!$&&_.has($)},useGetMultisigSigners=()=>{const a=useImplicitAccounts();return _=>{const $=a.filter(j=>_.signers.some(et=>et.pkh===j.address.pkh));return $.length===0&&console.warn("Wallet doesn't own any signers for multisig contract "+_.address.pkh),$}},useGetOwnedSignersForAccount=()=>{const a=useGetMultisigSigners();return _=>{switch(_.type){case"ledger":case"mnemonic":case"social":case"secret_key":return[_];case"multisig":return a(_)}}},useGetBestSignerForAccount=()=>{const a=useGetOwnedSignersForAccount(),_=useGetMostFundedImplicitAccount();return $=>_(a($))},useGetMostFundedImplicitAccount=()=>{const a=useGetAccountBalance();return _=>lodashExports.maxBy(_,$=>Number(a($.address.pkh)||"0"))},useGetSecretKey=()=>{const a=useSeedPhrases(),_=useSecretKeys();return async($,j)=>{if($.type==="secret_key"){const et=_[$.address.pkh];if(!et)throw new Error(`Missing secret key for account ${$.address.pkh}`);return decrypt$1(et,j)}else{const et=a[$.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(a=>a.contacts),useContactsForSelectedNetwork=()=>{const a=useSelectedNetwork(),_=useAllContacts();return Object.values(_).filter($=>isValidImplicitPkh($.pkh)||$.network===a.name).map($=>$)},useSortedContacts=()=>useContactsForSelectedNetwork().sort((_,$)=>_.name.localeCompare($.name)).map(_=>_),useAddressExistsInContacts=()=>{const a=useAllContacts();return _=>_ in a},useGetContactName=()=>{const a=useAllContacts();return _=>_ in a?a[_].name:void 0},useValidateNewContactPkh=()=>{const a=useAddressExistsInContacts(),_=useGetOwnedAccountSafe();return $=>isAddressValid($)?_($)?"Address is already used in accounts":!a($)||"Address is already registered":"Invalid address"},useValidateName=a=>{const _=useIsUniqueLabel();return $=>{const j=$.trim();return j.length===0?"Name should not be empty":a!==void 0&&j===a?"Name was not changed":_(j)?!0:"Name must be unique across all accounts and contacts"}},useGetNextAvailableAccountLabels=()=>{const a=useIsUniqueLabel();return(_,$=1)=>{const j=[];for(let et=1;j.length<$;et++){const tt=et===1?_:`${_} ${et}`;a(tt)&&j.push(tt)}return j}},useIsUniqueLabel=()=>{const a=useAllAccounts().map($=>$.label),_=Object.values(useAllContacts()).map($=>$.name);return $=>![...a,..._].includes($)};var Subscribable=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(a){return this.listeners.add(a),this.onSubscribe(),()=>{this.listeners.delete(a),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 a=="function"?a(_):a}function isValidTimeout(a){return typeof a=="number"&&a>=0&&a!==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}=a;if(rt){if(j){if(_.queryHash!==hashQueryKeyByOptions(rt,_.options))return!1}else if(!partialMatchKey(_.queryKey,rt))return!1}if($!=="all"){const it=_.isActive();if($==="active"&&!it||$==="inactive"&&it)return!1}return!(typeof nt=="boolean"&&_.isStale()!==nt||et&&et!==_.state.fetchStatus||tt&&!tt(_))}function matchMutation(a,_){const{exact:$,status:j,predicate:et,mutationKey:tt}=a;if(tt){if(!_.options.mutationKey)return!1;if($){if(hashKey(_.options.mutationKey)!==hashKey(tt))return!1}else if(!partialMatchKey(_.options.mutationKey,tt))return!1}return!(j&&_.state.status!==j||et&&!et(_))}function hashQueryKeyByOptions(a,_){return((_==null?void 0:_.queryKeyHashFn)||hashKey)(a)}function hashKey(a){return JSON.stringify(a,(_,$)=>isPlainObject($)?Object.keys($).sort().reduce((j,et)=>(j[et]=$[et],j),{}):$)}function partialMatchKey(a,_){return a===_?!0:typeof a!=typeof _?!1:a&&_&&typeof a=="object"&&typeof _=="object"?!Object.keys(_).some($=>!partialMatchKey(a[$],_[$])):!1}function replaceEqualDeep(a,_){if(a===_)return a;const $=isPlainArray(a)&&isPlainArray(_);if($||isPlainObject(a)&&isPlainObject(_)){const j=$?a:Object.keys(a),et=j.length,tt=$?_:Object.keys(_),rt=tt.length,nt=$?[]:{};let it=0;for(let st=0;st{setTimeout(_,a)})}function replaceData(a,_,$){return typeof $.structuralSharing=="function"?$.structuralSharing(a,_):$.structuralSharing!==!1?replaceEqualDeep(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,Pu,vv,FocusManager=(vv=class extends Subscribable{constructor(){super();In(this,au,void 0);In(this,Hl,void 0);In(this,Pu,void 0);kn(this,Pu,_=>{if(!isServer&&window.addEventListener){const $=()=>_();return window.addEventListener("visibilitychange",$,!1),()=>{window.removeEventListener("visibilitychange",$)}}})}onSubscribe(){Br(this,Hl)||this.setEventListener(Br(this,Pu))}onUnsubscribe(){var _;this.hasListeners()||((_=Br(this,Hl))==null||_.call(this),kn(this,Hl,void 0))}setEventListener(_){var $;kn(this,Pu,_),($=Br(this,Hl))==null||$.call(this),kn(this,Hl,_(j=>{typeof j=="boolean"?this.setFocused(j):this.onFocus()}))}setFocused(_){Br(this,au)!==_&&(kn(this,au,_),this.onFocus())}onFocus(){const _=this.isFocused();this.listeners.forEach($=>{$(_)})}isFocused(){var _;return typeof Br(this,au)=="boolean"?Br(this,au):((_=globalThis.document)==null?void 0:_.visibilityState)!=="hidden"}},au=new WeakMap,Hl=new WeakMap,Pu=new WeakMap,vv),focusManager=new FocusManager,Cu,Vl,ku,yv,OnlineManager=(yv=class extends Subscribable{constructor(){super();In(this,Cu,!0);In(this,Vl,void 0);In(this,ku,void 0);kn(this,ku,_=>{if(!isServer&&window.addEventListener){const $=()=>_(!0),j=()=>_(!1);return window.addEventListener("online",$,!1),window.addEventListener("offline",j,!1),()=>{window.removeEventListener("online",$),window.removeEventListener("offline",j)}}})}onSubscribe(){Br(this,Vl)||this.setEventListener(Br(this,ku))}onUnsubscribe(){var _;this.hasListeners()||((_=Br(this,Vl))==null||_.call(this),kn(this,Vl,void 0))}setEventListener(_){var $;kn(this,ku,_),($=Br(this,Vl))==null||$.call(this),kn(this,Vl,_(this.setOnline.bind(this)))}setOnline(_){Br(this,Cu)!==_&&(kn(this,Cu,_),this.listeners.forEach(j=>{j(_)}))}isOnline(){return Br(this,Cu)}},Cu=new WeakMap,Vl=new WeakMap,ku=new WeakMap,yv),onlineManager=new OnlineManager;function defaultRetryDelay(a){return Math.min(1e3*2**a,3e4)}function canFetch(a){return(a??"online")==="online"?onlineManager.isOnline():!0}var CancelledError=class{constructor(a){this.revert=a==null?void 0:a.revert,this.silent=a==null?void 0:a.silent}};function isCancelledError(a){return a instanceof CancelledError}function createRetryer(a){let _=!1,$=0,j=!1,et,tt,rt;const nt=new Promise((Pt,$t)=>{tt=Pt,rt=$t}),it=Pt=>{var $t;j||(yt(new CancelledError(Pt)),($t=a.abort)==null||$t.call(a))},st=()=>{_=!0},ot=()=>{_=!1},at=()=>focusManager.isFocused()&&(a.networkMode==="always"||onlineManager.isOnline())&&a.canRun(),ut=()=>canFetch(a.networkMode)&&a.canRun(),ht=Pt=>{var $t;j||(j=!0,($t=a.onSuccess)==null||$t.call(a,Pt),et==null||et(),tt(Pt))},yt=Pt=>{var $t;j||(j=!0,($t=a.onError)==null||$t.call(a,Pt),et==null||et(),rt(Pt))},wt=()=>new Promise(Pt=>{var $t;et=Mt=>{(j||at())&&Pt(Mt)},($t=a.onPause)==null||$t.call(a)}).then(()=>{var Pt;et=void 0,j||(Pt=a.onContinue)==null||Pt.call(a)}),Ct=()=>{if(j)return;let Pt;try{Pt=a.fn()}catch($t){Pt=Promise.reject($t)}Promise.resolve(Pt).then(ht).catch($t=>{var Ot;if(j)return;const Mt=a.retry??(isServer?0:3),Lt=a.retryDelay??defaultRetryDelay,Dt=typeof Lt=="function"?Lt($,$t):Lt,zt=Mt===!0||typeof Mt=="number"&&$at()?void 0:wt()).then(()=>{_?yt($t):Ct()})})};return{promise:nt,cancel:it,continue:()=>(et==null||et(),nt),cancelRetry:st,continueRetry:ot,canStart:ut,start:()=>(ut()?Ct():wt().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;_++;try{ht=ut()}finally{_--,_||st()}return ht},nt=ut=>{_?a.push(ut):et(()=>{$(ut)})},it=ut=>(...ht)=>{nt(()=>{ut(...ht)})},st=()=>{const ut=a;a=[],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,bv,Removable=(bv=class{constructor(){In(this,cu,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),isValidTimeout(this.gcTime)&&kn(this,cu,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(a){this.gcTime=Math.max(this.gcTime||0,a??(isServer?1/0:5*60*1e3))}clearGcTimeout(){Br(this,cu)&&(clearTimeout(Br(this,cu)),kn(this,cu,void 0))}},cu=new WeakMap,bv),Mu,Iu,_o,Ks,op,lu,Oo,$a,xv,Query=(xv=class extends Removable{constructor(_){super();In(this,Oo);In(this,Mu,void 0);In(this,Iu,void 0);In(this,_o,void 0);In(this,Ks,void 0);In(this,op,void 0);In(this,lu,void 0);kn(this,lu,!1),kn(this,op,_.defaultOptions),this.setOptions(_.options),this.observers=[],kn(this,_o,_.cache),this.queryKey=_.queryKey,this.queryHash=_.queryHash,kn(this,Mu,_.state||getDefaultState$1(this.options)),this.state=Br(this,Mu),this.scheduleGc()}get meta(){return this.options.meta}setOptions(_){this.options={...Br(this,op),..._},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&Br(this,_o).remove(this)}setData(_,$){const j=replaceData(this.state.data,_,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(_,$){Zn(this,Oo,$a).call(this,{type:"setState",state:_,setStateOptions:$})}cancel(_){var j,et;const $=(j=Br(this,Ks))==null?void 0:j.promise;return(et=Br(this,Ks))==null||et.cancel(_),$?$.then(noop$2).catch(noop$2):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(Br(this,Mu))}isActive(){return this.observers.some(_=>_.options.enabled!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(_=>_.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(_=0){return this.state.isInvalidated||this.state.data===void 0||!timeUntilStale(this.state.dataUpdatedAt,_)}onFocus(){var $;const _=this.observers.find(j=>j.shouldFetchOnWindowFocus());_==null||_.refetch({cancelRefetch:!1}),($=Br(this,Ks))==null||$.continue()}onOnline(){var $;const _=this.observers.find(j=>j.shouldFetchOnReconnect());_==null||_.refetch({cancelRefetch:!1}),($=Br(this,Ks))==null||$.continue()}addObserver(_){this.observers.includes(_)||(this.observers.push(_),this.clearGcTimeout(),Br(this,_o).notify({type:"observerAdded",query:this,observer:_}))}removeObserver(_){this.observers.includes(_)&&(this.observers=this.observers.filter($=>$!==_),this.observers.length||(Br(this,Ks)&&(Br(this,lu)?Br(this,Ks).cancel({revert:!0}):Br(this,Ks).cancelRetry()),this.scheduleGc()),Br(this,_o).notify({type:"observerRemoved",query:this,observer:_}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Zn(this,Oo,$a).call(this,{type:"invalidate"})}fetch(_,$){var st,ot,at;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&($!=null&&$.cancelRefetch))this.cancel({silent:!0});else if(Br(this,Ks))return Br(this,Ks).continueRetry(),Br(this,Ks).promise}if(_&&this.setOptions(_),!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),(st=this.options.behavior)==null||st.onFetch(nt,this),kn(this,Iu,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((ot=nt.fetchOptions)==null?void 0:ot.meta))&&Zn(this,Oo,$a).call(this,{type:"fetch",meta:(at=nt.fetchOptions)==null?void 0:at.meta});const it=ut=>{var ht,yt,wt,Ct;isCancelledError(ut)&&ut.silent||Zn(this,Oo,$a).call(this,{type:"error",error:ut}),isCancelledError(ut)||((yt=(ht=Br(this,_o).config).onError)==null||yt.call(ht,ut,this),(Ct=(wt=Br(this,_o).config).onSettled)==null||Ct.call(wt,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,yt,wt,Ct;if(ut===void 0){it(new Error(`${this.queryHash} data is undefined`));return}this.setData(ut),(yt=(ht=Br(this,_o).config).onSuccess)==null||yt.call(ht,ut,this),(Ct=(wt=Br(this,_o).config).onSettled)==null||Ct.call(wt,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})),Br(this,Ks).start()}},Mu=new WeakMap,Iu=new WeakMap,_o=new WeakMap,Ks=new WeakMap,op=new WeakMap,lu=new WeakMap,Oo=new WeakSet,$a=function(_){const $=j=>{switch(_.type){case"failed":return{...j,fetchFailureCount:_.failureCount,fetchFailureReason:_.error};case"pause":return{...j,fetchStatus:"paused"};case"continue":return{...j,fetchStatus:"fetching"};case"fetch":return{...j,...fetchState(j.data,this.options),fetchMeta:_.meta??null};case"success":return{...j,data:_.data,dataUpdateCount:j.dataUpdateCount+1,dataUpdatedAt:_.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!_.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const et=_.error;return isCancelledError(et)&&et.revert&&Br(this,Iu)?{...Br(this,Iu),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,..._.state}}};this.state=$(this.state),notifyManager.batch(()=>{this.observers.forEach(j=>{j.onQueryUpdate()}),Br(this,_o).notify({query:this,type:"updated",action:_})})},xv);function fetchState(a,_){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:canFetch(_.networkMode)?"fetching":"paused",...a===void 0&&{error:null,status:"pending"}}}function getDefaultState$1(a){const _=typeof a.initialData=="function"?a.initialData():a.initialData,$=_!==void 0,j=$?typeof a.initialDataUpdatedAt=="function"?a.initialDataUpdatedAt():a.initialDataUpdatedAt:0;return{data:_,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,_v,QueryCache=(_v=class extends Subscribable{constructor(_={}){super();In(this,Ho,void 0);this.config=_,kn(this,Ho,new Map)}build(_,$,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:_.defaultQueryOptions($),state:j,defaultOptions:_.getQueryDefaults(et)}),this.add(rt)),rt}add(_){Br(this,Ho).has(_.queryHash)||(Br(this,Ho).set(_.queryHash,_),this.notify({type:"added",query:_}))}remove(_){const $=Br(this,Ho).get(_.queryHash);$&&(_.destroy(),$===_&&Br(this,Ho).delete(_.queryHash),this.notify({type:"removed",query:_}))}clear(){notifyManager.batch(()=>{this.getAll().forEach(_=>{this.remove(_)})})}get(_){return Br(this,Ho).get(_)}getAll(){return[...Br(this,Ho).values()]}find(_){const $={exact:!0,..._};return this.getAll().find(j=>matchQuery($,j))}findAll(_={}){const $=this.getAll();return Object.keys(_).length>0?$.filter(j=>matchQuery(_,j)):$}notify(_){notifyManager.batch(()=>{this.listeners.forEach($=>{$(_)})})}onFocus(){notifyManager.batch(()=>{this.getAll().forEach(_=>{_.onFocus()})})}onOnline(){notifyManager.batch(()=>{this.getAll().forEach(_=>{_.onOnline()})})}},Ho=new WeakMap,_v),Vo,Ws,uu,qo,Ul,Ev,Mutation=(Ev=class extends Removable{constructor(_){super();In(this,qo);In(this,Vo,void 0);In(this,Ws,void 0);In(this,uu,void 0);this.mutationId=_.mutationId,kn(this,Ws,_.mutationCache),kn(this,Vo,[]),this.state=_.state||getDefaultState(),this.setOptions(_.options),this.scheduleGc()}setOptions(_){this.options=_,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(_){Br(this,Vo).includes(_)||(Br(this,Vo).push(_),this.clearGcTimeout(),Br(this,Ws).notify({type:"observerAdded",mutation:this,observer:_}))}removeObserver(_){kn(this,Vo,Br(this,Vo).filter($=>$!==_)),this.scheduleGc(),Br(this,Ws).notify({type:"observerRemoved",mutation:this,observer:_})}optionalRemove(){Br(this,Vo).length||(this.state.status==="pending"?this.scheduleGc():Br(this,Ws).remove(this))}continue(){var _;return((_=Br(this,uu))==null?void 0:_.continue())??this.execute(this.state.variables)}async execute(_){var et,tt,rt,nt,it,st,ot,at,ut,ht,yt,wt,Ct,Pt,$t,Mt,Lt,Dt,zt,Ot;kn(this,uu,createRetryer({fn:()=>this.options.mutationFn?this.options.mutationFn(_):Promise.reject(new Error("No mutationFn found")),onFail:(It,Bt)=>{Zn(this,qo,Ul).call(this,{type:"failed",failureCount:It,error:Bt})},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:()=>Br(this,Ws).canRun(this)}));const $=this.state.status==="pending",j=!Br(this,uu).canStart();try{if(!$){Zn(this,qo,Ul).call(this,{type:"pending",variables:_,isPaused:j}),await((tt=(et=Br(this,Ws).config).onMutate)==null?void 0:tt.call(et,_,this));const Bt=await((nt=(rt=this.options).onMutate)==null?void 0:nt.call(rt,_));Bt!==this.state.context&&Zn(this,qo,Ul).call(this,{type:"pending",context:Bt,variables:_,isPaused:j})}const It=await Br(this,uu).start();return await((st=(it=Br(this,Ws).config).onSuccess)==null?void 0:st.call(it,It,_,this.state.context,this)),await((at=(ot=this.options).onSuccess)==null?void 0:at.call(ot,It,_,this.state.context)),await((ht=(ut=Br(this,Ws).config).onSettled)==null?void 0:ht.call(ut,It,null,this.state.variables,this.state.context,this)),await((wt=(yt=this.options).onSettled)==null?void 0:wt.call(yt,It,null,_,this.state.context)),Zn(this,qo,Ul).call(this,{type:"success",data:It}),It}catch(It){try{throw await((Pt=(Ct=Br(this,Ws).config).onError)==null?void 0:Pt.call(Ct,It,_,this.state.context,this)),await((Mt=($t=this.options).onError)==null?void 0:Mt.call($t,It,_,this.state.context)),await((Dt=(Lt=Br(this,Ws).config).onSettled)==null?void 0:Dt.call(Lt,void 0,It,this.state.variables,this.state.context,this)),await((Ot=(zt=this.options).onSettled)==null?void 0:Ot.call(zt,void 0,It,_,this.state.context)),It}finally{Zn(this,qo,Ul).call(this,{type:"error",error:It})}}finally{Br(this,Ws).runNext(this)}}},Vo=new WeakMap,Ws=new WeakMap,uu=new WeakMap,qo=new WeakSet,Ul=function(_){const $=j=>{switch(_.type){case"failed":return{...j,failureCount:_.failureCount,failureReason:_.error};case"pause":return{...j,isPaused:!0};case"continue":return{...j,isPaused:!1};case"pending":return{...j,context:_.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:_.isPaused,status:"pending",variables:_.variables,submittedAt:Date.now()};case"success":return{...j,data:_.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...j,data:void 0,error:_.error,failureCount:j.failureCount+1,failureReason:_.error,isPaused:!1,status:"error"}}};this.state=$(this.state),notifyManager.batch(()=>{Br(this,Vo).forEach(j=>{j.onMutationUpdate(_)}),Br(this,Ws).notify({mutation:this,type:"updated",action:_})})},Ev);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,wv,MutationCache=(wv=class extends Subscribable{constructor(_={}){super();In(this,co,void 0);In(this,ap,void 0);this.config=_,kn(this,co,new Map),kn(this,ap,Date.now())}build(_,$,j){const et=new Mutation({mutationCache:this,mutationId:++r0(this,ap)._,options:_.defaultMutationOptions($),state:j});return this.add(et),et}add(_){const $=scopeFor(_),j=Br(this,co).get($)??[];j.push(_),Br(this,co).set($,j),this.notify({type:"added",mutation:_})}remove(_){var j;const $=scopeFor(_);if(Br(this,co).has($)){const et=(j=Br(this,co).get($))==null?void 0:j.filter(tt=>tt!==_);et&&(et.length===0?Br(this,co).delete($):Br(this,co).set($,et))}this.notify({type:"removed",mutation:_})}canRun(_){var j;const $=(j=Br(this,co).get(scopeFor(_)))==null?void 0:j.find(et=>et.state.status==="pending");return!$||$===_}runNext(_){var j;const $=(j=Br(this,co).get(scopeFor(_)))==null?void 0:j.find(et=>et!==_&&et.state.isPaused);return($==null?void 0:$.continue())??Promise.resolve()}clear(){notifyManager.batch(()=>{this.getAll().forEach(_=>{this.remove(_)})})}getAll(){return[...Br(this,co).values()].flat()}find(_){const $={exact:!0,..._};return this.getAll().find(j=>matchMutation($,j))}findAll(_={}){return this.getAll().filter($=>matchMutation(_,$))}notify(_){notifyManager.batch(()=>{this.listeners.forEach($=>{$(_)})})}resumePausedMutations(){const _=this.getAll().filter($=>$.state.isPaused);return notifyManager.batch(()=>Promise.all(_.map($=>$.continue().catch(noop$2))))}},co=new WeakMap,ap=new WeakMap,wv);function scopeFor(a){var _;return((_=a.options.scope)==null?void 0:_.id)??String(a.mutationId)}function infiniteQueryBehavior(a){return{onFetch:(_,$)=>{const j=async()=>{var yt,wt,Ct,Pt,$t;const et=_.options,tt=(Ct=(wt=(yt=_.fetchOptions)==null?void 0:yt.meta)==null?void 0:wt.fetchMore)==null?void 0:Ct.direction,rt=((Pt=_.state.data)==null?void 0:Pt.pages)||[],nt=(($t=_.state.data)==null?void 0:$t.pageParams)||[],it={pages:[],pageParams:[]};let st=!1;const ot=Mt=>{Object.defineProperty(Mt,"signal",{enumerable:!0,get:()=>(_.signal.aborted?st=!0:_.signal.addEventListener("abort",()=>{st=!0}),_.signal)})},at=_.options.queryFn&&_.options.queryFn!==skipToken?_.options.queryFn:()=>Promise.reject(new Error(`Missing queryFn: '${_.options.queryHash}'`)),ut=async(Mt,Lt,Dt)=>{if(st)return Promise.reject();if(Lt==null&&Mt.pages.length)return Promise.resolve(Mt);const zt={queryKey:_.queryKey,pageParam:Lt,direction:Dt?"backward":"forward",meta:_.options.meta};ot(zt);const Ot=await at(zt),{maxPages:It}=_.options,Bt=Dt?addToStart:addToEnd;return{pages:Bt(Mt.pages,Ot,It),pageParams:Bt(Mt.pageParams,Lt,It)}};let ht;if(tt&&rt.length){const Mt=tt==="backward",Lt=Mt?getPreviousPageParam:getNextPageParam,Dt={pages:rt,pageParams:nt},zt=Lt(et,Dt);ht=await ut(Dt,zt,Mt)}else{ht=await ut(it,nt[0]??et.initialPageParam);const Mt=a??rt.length;for(let Lt=1;Lt{var et,tt;return(tt=(et=_.options).persister)==null?void 0:tt.call(et,j,{queryKey:_.queryKey,meta:_.options.meta,signal:_.signal},$)}:_.fetchFn=j}}}function getNextPageParam(a,{pages:_,pageParams:$}){const j=_.length-1;return a.getNextPageParam(_[j],_,$[j],$)}function getPreviousPageParam(a,{pages:_,pageParams:$}){var j;return(j=a.getPreviousPageParam)==null?void 0:j.call(a,_[0],_,$[0],$)}function hasNextPage(a,_){return _?getNextPageParam(a,_)!=null:!1}function hasPreviousPage(a,_){return!_||!a.getPreviousPageParam?!1:getPreviousPageParam(a,_)!=null}var Ss,Kl,Wl,Ou,ju,Gl,Nu,Bu,Sv,QueryClient=(Sv=class{constructor(a={}){In(this,Ss,void 0);In(this,Kl,void 0);In(this,Wl,void 0);In(this,Ou,void 0);In(this,ju,void 0);In(this,Gl,void 0);In(this,Nu,void 0);In(this,Bu,void 0);kn(this,Ss,a.queryCache||new QueryCache),kn(this,Kl,a.mutationCache||new MutationCache),kn(this,Wl,a.defaultOptions||{}),kn(this,Ou,new Map),kn(this,ju,new Map),kn(this,Gl,0)}mount(){r0(this,Gl)._++,Br(this,Gl)===1&&(kn(this,Nu,focusManager.subscribe(async a=>{a&&(await this.resumePausedMutations(),Br(this,Ss).onFocus())})),kn(this,Bu,onlineManager.subscribe(async a=>{a&&(await this.resumePausedMutations(),Br(this,Ss).onOnline())})))}unmount(){var a,_;r0(this,Gl)._--,Br(this,Gl)===0&&((a=Br(this,Nu))==null||a.call(this),kn(this,Nu,void 0),(_=Br(this,Bu))==null||_.call(this),kn(this,Bu,void 0))}isFetching(a){return Br(this,Ss).findAll({...a,fetchStatus:"fetching"}).length}isMutating(a){return Br(this,Kl).findAll({...a,status:"pending"}).length}getQueryData(a){var $;const _=this.defaultQueryOptions({queryKey:a});return($=Br(this,Ss).get(_.queryHash))==null?void 0:$.state.data}ensureQueryData(a){const _=this.getQueryData(a.queryKey);if(_===void 0)return this.fetchQuery(a);{const $=this.defaultQueryOptions(a),j=Br(this,Ss).build(this,$);return a.revalidateIfStale&&j.isStaleByTime($.staleTime)&&this.prefetchQuery($),Promise.resolve(_)}}getQueriesData(a){return Br(this,Ss).findAll(a).map(({queryKey:_,state:$})=>{const j=$.data;return[_,j]})}setQueryData(a,_,$){const j=this.defaultQueryOptions({queryKey:a}),et=Br(this,Ss).get(j.queryHash),tt=et==null?void 0:et.state.data,rt=functionalUpdate(_,tt);if(rt!==void 0)return Br(this,Ss).build(this,j).setData(rt,{...$,manual:!0})}setQueriesData(a,_,$){return notifyManager.batch(()=>Br(this,Ss).findAll(a).map(({queryKey:j})=>[j,this.setQueryData(j,_,$)]))}getQueryState(a){var $;const _=this.defaultQueryOptions({queryKey:a});return($=Br(this,Ss).get(_.queryHash))==null?void 0:$.state}removeQueries(a){const _=Br(this,Ss);notifyManager.batch(()=>{_.findAll(a).forEach($=>{_.remove($)})})}resetQueries(a,_){const $=Br(this,Ss),j={type:"active",...a};return notifyManager.batch(()=>($.findAll(a).forEach(et=>{et.reset()}),this.refetchQueries(j,_)))}cancelQueries(a={},_={}){const $={revert:!0,..._},j=notifyManager.batch(()=>Br(this,Ss).findAll(a).map(et=>et.cancel($)));return Promise.all(j).then(noop$2).catch(noop$2)}invalidateQueries(a={},_={}){return notifyManager.batch(()=>{if(Br(this,Ss).findAll(a).forEach(j=>{j.invalidate()}),a.refetchType==="none")return Promise.resolve();const $={...a,type:a.refetchType??a.type??"active"};return this.refetchQueries($,_)})}refetchQueries(a={},_){const $={..._,cancelRefetch:(_==null?void 0:_.cancelRefetch)??!0},j=notifyManager.batch(()=>Br(this,Ss).findAll(a).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(a){const _=this.defaultQueryOptions(a);_.retry===void 0&&(_.retry=!1);const $=Br(this,Ss).build(this,_);return $.isStaleByTime(_.staleTime)?$.fetch(_):Promise.resolve($.state.data)}prefetchQuery(a){return this.fetchQuery(a).then(noop$2).catch(noop$2)}fetchInfiniteQuery(a){return a.behavior=infiniteQueryBehavior(a.pages),this.fetchQuery(a)}prefetchInfiniteQuery(a){return this.fetchInfiniteQuery(a).then(noop$2).catch(noop$2)}resumePausedMutations(){return onlineManager.isOnline()?Br(this,Kl).resumePausedMutations():Promise.resolve()}getQueryCache(){return Br(this,Ss)}getMutationCache(){return Br(this,Kl)}getDefaultOptions(){return Br(this,Wl)}setDefaultOptions(a){kn(this,Wl,a)}setQueryDefaults(a,_){Br(this,Ou).set(hashKey(a),{queryKey:a,defaultOptions:_})}getQueryDefaults(a){const _=[...Br(this,Ou).values()];let $={};return _.forEach(j=>{partialMatchKey(a,j.queryKey)&&($={...$,...j.defaultOptions})}),$}setMutationDefaults(a,_){Br(this,ju).set(hashKey(a),{mutationKey:a,defaultOptions:_})}getMutationDefaults(a){const _=[...Br(this,ju).values()];let $={};return _.forEach(j=>{partialMatchKey(a,j.mutationKey)&&($={...$,...j.defaultOptions})}),$}defaultQueryOptions(a){if(a._defaulted)return a;const _={...Br(this,Wl).queries,...this.getQueryDefaults(a.queryKey),...a,_defaulted:!0};return _.queryHash||(_.queryHash=hashQueryKeyByOptions(_.queryKey,_)),_.refetchOnReconnect===void 0&&(_.refetchOnReconnect=_.networkMode!=="always"),_.throwOnError===void 0&&(_.throwOnError=!!_.suspense),!_.networkMode&&_.persister&&(_.networkMode="offlineFirst"),_.enabled!==!0&&_.queryFn===skipToken&&(_.enabled=!1),_}defaultMutationOptions(a){return a!=null&&a._defaulted?a:{...Br(this,Wl).mutations,...(a==null?void 0:a.mutationKey)&&this.getMutationDefaults(a.mutationKey),...a,_defaulted:!0}}clear(){Br(this,Ss).clear(),Br(this,Kl).clear()}},Ss=new WeakMap,Kl=new WeakMap,Wl=new WeakMap,Ou=new WeakMap,ju=new WeakMap,Gl=new WeakMap,Nu=new WeakMap,Bu=new WeakMap,Sv),ro,bs,cp,Gs,du,Lu,Ko,lp,Du,Fu,fu,hu,Zl,zu,pu,sp,up,um,dp,dm,fp,fm,hp,hm,pp,pm,mp,mm,gp,gm,i0,$v,Rv,QueryObserver=(Rv=class extends Subscribable{constructor(_,$){super();In(this,pu);In(this,up);In(this,dp);In(this,fp);In(this,hp);In(this,pp);In(this,mp);In(this,gp);In(this,i0);In(this,ro,void 0);In(this,bs,void 0);In(this,cp,void 0);In(this,Gs,void 0);In(this,du,void 0);In(this,Lu,void 0);In(this,Ko,void 0);In(this,lp,void 0);In(this,Du,void 0);In(this,Fu,void 0);In(this,fu,void 0);In(this,hu,void 0);In(this,Zl,void 0);In(this,zu,new Set);this.options=$,kn(this,ro,_),kn(this,Ko,null),this.bindMethods(),this.setOptions($)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(Br(this,bs).addObserver(this),shouldFetchOnMount(Br(this,bs),this.options)?Zn(this,pu,sp).call(this):this.updateResult(),Zn(this,hp,hm).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return shouldFetchOn(Br(this,bs),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return shouldFetchOn(Br(this,bs),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Zn(this,pp,pm).call(this),Zn(this,mp,mm).call(this),Br(this,bs).removeObserver(this)}setOptions(_,$){const j=this.options,et=Br(this,bs);if(this.options=Br(this,ro).defaultQueryOptions(_),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),Br(this,bs).setOptions(this.options),j._defaulted&&!shallowEqualObjects(this.options,j)&&Br(this,ro).getQueryCache().notify({type:"observerOptionsUpdated",query:Br(this,bs),observer:this});const tt=this.hasListeners();tt&&shouldFetchOptionally(Br(this,bs),et,this.options,j)&&Zn(this,pu,sp).call(this),this.updateResult($),tt&&(Br(this,bs)!==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&&(Br(this,bs)!==et||this.options.enabled!==j.enabled||rt!==Br(this,Zl))&&Zn(this,fp,fm).call(this,rt)}getOptimisticResult(_){const $=Br(this,ro).getQueryCache().build(Br(this,ro),_),j=this.createResult($,_);return shouldAssignObserverCurrentProperties(this,j)&&(kn(this,Gs,j),kn(this,Lu,this.options),kn(this,du,Br(this,bs).state)),j}getCurrentResult(){return Br(this,Gs)}trackResult(_,$){const j={};return Object.keys(_).forEach(et=>{Object.defineProperty(j,et,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(et),$==null||$(et),_[et])})}),j}trackProp(_){Br(this,zu).add(_)}getCurrentQuery(){return Br(this,bs)}refetch({..._}={}){return this.fetch({..._})}fetchOptimistic(_){const $=Br(this,ro).defaultQueryOptions(_),j=Br(this,ro).getQueryCache().build(Br(this,ro),$);return j.isFetchingOptimistic=!0,j.fetch().then(()=>this.createResult(j,$))}fetch(_){return Zn(this,pu,sp).call(this,{..._,cancelRefetch:_.cancelRefetch??!0}).then(()=>(this.updateResult(),Br(this,Gs)))}createResult(_,$){var Ot;const j=Br(this,bs),et=this.options,tt=Br(this,Gs),rt=Br(this,du),nt=Br(this,Lu),st=_!==j?_.state:Br(this,cp),{state:ot}=_;let at={...ot},ut=!1,ht;if($._optimisticResults){const It=this.hasListeners(),Bt=!It&&shouldFetchOnMount(_,$),Ft=It&&shouldFetchOptionally(_,j,$,et);(Bt||Ft)&&(at={...at,...fetchState(ot.data,_.options)}),$._optimisticResults==="isRestoring"&&(at.fetchStatus="idle")}let{error:yt,errorUpdatedAt:wt,status:Ct}=at;if($.select&&at.data!==void 0)if(tt&&at.data===(rt==null?void 0:rt.data)&&$.select===Br(this,lp))ht=Br(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(It){kn(this,Ko,It)}else ht=at.data;if($.placeholderData!==void 0&&ht===void 0&&Ct==="pending"){let It;if(tt!=null&&tt.isPlaceholderData&&$.placeholderData===(nt==null?void 0:nt.placeholderData))It=tt.data;else if(It=typeof $.placeholderData=="function"?$.placeholderData((Ot=Br(this,Fu))==null?void 0:Ot.state.data,Br(this,Fu)):$.placeholderData,$.select&&It!==void 0)try{It=$.select(It),kn(this,Ko,null)}catch(Bt){kn(this,Ko,Bt)}It!==void 0&&(Ct="success",ht=replaceData(tt==null?void 0:tt.data,It,$),ut=!0)}Br(this,Ko)&&(yt=Br(this,Ko),ht=Br(this,Du),wt=Date.now(),Ct="error");const Pt=at.fetchStatus==="fetching",$t=Ct==="pending",Mt=Ct==="error",Lt=$t&&Pt,Dt=ht!==void 0;return{status:Ct,fetchStatus:at.fetchStatus,isPending:$t,isSuccess:Ct==="success",isError:Mt,isInitialLoading:Lt,isLoading:Lt,data:ht,dataUpdatedAt:at.dataUpdatedAt,error:yt,errorUpdatedAt:wt,failureCount:at.fetchFailureCount,failureReason:at.fetchFailureReason,errorUpdateCount:at.errorUpdateCount,isFetched:at.dataUpdateCount>0||at.errorUpdateCount>0,isFetchedAfterMount:at.dataUpdateCount>st.dataUpdateCount||at.errorUpdateCount>st.errorUpdateCount,isFetching:Pt,isRefetching:Pt&&!$t,isLoadingError:Mt&&!Dt,isPaused:at.fetchStatus==="paused",isPlaceholderData:ut,isRefetchError:Mt&&Dt,isStale:isStale(_,$),refetch:this.refetch}}updateResult(_){const $=Br(this,Gs),j=this.createResult(Br(this,bs),this.options);if(kn(this,du,Br(this,bs).state),kn(this,Lu,this.options),Br(this,du).data!==void 0&&kn(this,Fu,Br(this,bs)),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&&!Br(this,zu).size)return!0;const it=new Set(nt??Br(this,zu));return this.options.throwOnError&&it.add("error"),Object.keys(Br(this,Gs)).some(st=>{const ot=st;return Br(this,Gs)[ot]!==$[ot]&&it.has(ot)})};(_==null?void 0:_.listeners)!==!1&&tt()&&(et.listeners=!0),Zn(this,i0,$v).call(this,{...et,..._})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Zn(this,hp,hm).call(this)}},ro=new WeakMap,bs=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,zu=new WeakMap,pu=new WeakSet,sp=function(_){Zn(this,gp,gm).call(this);let $=Br(this,bs).fetch(this.options,_);return _!=null&&_.throwOnError||($=$.catch(noop$2)),$},up=new WeakSet,um=function(){if(Zn(this,pp,pm).call(this),isServer||Br(this,Gs).isStale||!isValidTimeout(this.options.staleTime))return;const $=timeUntilStale(Br(this,Gs).dataUpdatedAt,this.options.staleTime)+1;kn(this,fu,setTimeout(()=>{Br(this,Gs).isStale||this.updateResult()},$))},dp=new WeakSet,dm=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(Br(this,bs)):this.options.refetchInterval)??!1},fp=new WeakSet,fm=function(_){Zn(this,mp,mm).call(this),kn(this,Zl,_),!(isServer||this.options.enabled===!1||!isValidTimeout(Br(this,Zl))||Br(this,Zl)===0)&&kn(this,hu,setInterval(()=>{(this.options.refetchIntervalInBackground||focusManager.isFocused())&&Zn(this,pu,sp).call(this)},Br(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(){Br(this,fu)&&(clearTimeout(Br(this,fu)),kn(this,fu,void 0))},mp=new WeakSet,mm=function(){Br(this,hu)&&(clearInterval(Br(this,hu)),kn(this,hu,void 0))},gp=new WeakSet,gm=function(){const _=Br(this,ro).getQueryCache().build(Br(this,ro),this.options);if(_===Br(this,bs))return;const $=Br(this,bs);kn(this,bs,_),kn(this,cp,_.state),this.hasListeners()&&($==null||$.removeObserver(this),_.addObserver(this))},i0=new WeakSet,$v=function(_){notifyManager.batch(()=>{_.listeners&&this.listeners.forEach($=>{$(Br(this,Gs))}),Br(this,ro).getQueryCache().notify({query:Br(this,bs),type:"observerResultsUpdated"})})},Rv);function shouldLoadOnMount(a,_){return _.enabled!==!1&&a.state.data===void 0&&!(a.state.status==="error"&&_.retryOnMount===!1)}function shouldFetchOnMount(a,_){return shouldLoadOnMount(a,_)||a.state.data!==void 0&&shouldFetchOn(a,_,_.refetchOnMount)}function shouldFetchOn(a,_,$){if(_.enabled!==!1){const j=typeof $=="function"?$(a):$;return j==="always"||j!==!1&&isStale(a,_)}return!1}function shouldFetchOptionally(a,_,$,j){return(a!==_||j.enabled===!1)&&(!$.suspense||a.state.status!=="error")&&isStale(a,$)}function isStale(a,_){return _.enabled!==!1&&a.isStaleByTime(_.staleTime)}function shouldAssignObserverCurrentProperties(a,_){return!shallowEqualObjects(a.getCurrentResult(),_)}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({...a,behavior:infiniteQueryBehavior()},_)}getOptimisticResult(a){return a.behavior=infiniteQueryBehavior(),super.getOptimisticResult(a)}fetchNextPage(a){return this.fetch({...a,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(a){return this.fetch({...a,meta:{fetchMore:{direction:"backward"}}})}createResult(a,_){var yt,wt;const{state:$}=a,j=super.createResult(a,_),{isFetching:et,isRefetching:tt,isError:rt,isRefetchError:nt}=j,it=(wt=(yt=$.fetchMeta)==null?void 0:yt.fetchMore)==null?void 0:wt.direction,st=rt&&it==="forward",ot=et&&it==="forward",at=rt&&it==="backward",ut=et&&it==="backward";return{...j,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:hasNextPage(_,$.data),hasPreviousPage:hasPreviousPage(_,$.data),isFetchNextPageError:st,isFetchingNextPage:ot,isFetchPreviousPageError:at,isFetchingPreviousPage:ut,isRefetchError:nt&&!st&&!at,isRefetching:tt&&!ot&&!ut}}},QueryClientContext=reactExports.createContext(void 0),useQueryClient=a=>{const _=reactExports.useContext(QueryClientContext);if(!_)throw new Error("No QueryClient set, use QueryClientProvider to set one");return _},QueryClientProvider=({client:a,children:_})=>(reactExports.useEffect(()=>(a.mount(),()=>{a.unmount()}),[a]),jsxRuntimeExports.jsx(QueryClientContext.Provider,{value:a,children:_})),IsRestoringContext=reactExports.createContext(!1),useIsRestoring=()=>reactExports.useContext(IsRestoringContext);IsRestoringContext.Provider;function createValue(){let a=!1;return{clearReset:()=>{a=!1},reset:()=>{a=!0},isReset:()=>a}}var QueryErrorResetBoundaryContext=reactExports.createContext(createValue()),useQueryErrorResetBoundary=()=>reactExports.useContext(QueryErrorResetBoundaryContext);function shouldThrowError(a,_){return typeof a=="function"?a(..._):!!a}var ensurePreventErrorBoundaryRetry=(a,_)=>{(a.suspense||a.throwOnError)&&(_.isReset()||(a.retryOnMount=!1))},useClearResetErrorBoundary=a=>{reactExports.useEffect(()=>{a.clearReset()},[a])},getHasError=({result:a,errorResetBoundary:_,throwOnError:$,query:j})=>a.isError&&!_.isReset()&&!a.isFetching&&j&&shouldThrowError($,[a.error,j]),ensureStaleTime=a=>{a.suspense&&typeof a.staleTime!="number"&&(a.staleTime=1e3)},shouldSuspend=(a,_)=>(a==null?void 0:a.suspense)&&_.isPending,fetchOptimistic=(a,_,$)=>_.fetchOptimistic(a).catch(()=>{$.clearReset()});function useBaseQuery(a,_,$){const j=useQueryClient(),et=useIsRestoring(),tt=useQueryErrorResetBoundary(),rt=j.defaultQueryOptions(a);rt._optimisticResults=et?"isRestoring":"optimistic",ensureStaleTime(rt),ensurePreventErrorBoundaryRetry(rt,tt),useClearResetErrorBoundary(tt);const[nt]=reactExports.useState(()=>new _(j,rt)),it=nt.getOptimisticResult(rt);if(reactExports.useSyncExternalStore(reactExports.useCallback(st=>{const ot=et?()=>{}:nt.subscribe(notifyManager.batchCalls(st));return nt.updateResult(),ot},[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(a,QueryObserver)}function useInfiniteQuery(a,_){return useBaseQuery(a,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=a=>useAppSelector($=>$.beacon)[a],useGetPeersForAccounts=()=>{const a=useAppSelector(_=>_.beacon);return _=>lodashExports.uniq(Object.entries(a).filter(([$,j])=>_.includes(j.accountPkh)).map(([$,j])=>$))},useResetConnections=()=>{const a=useDispatch();return()=>a(beaconSlice.actions.reset())},useAddConnection=()=>{const a=useDispatch();return(_,$,j)=>a(beaconSlice.actions.addConnection({dAppId:_,accountPkh:$,networkType:j}))},useRemoveConnection=()=>{const a=useDispatch();return _=>a(beaconSlice.actions.removeConnection(_))},PEERS_QUERY_KEY="beaconPeers",useRefreshPeers=()=>{const a=useQueryClient();return()=>a.refetchQueries({queryKey:[PEERS_QUERY_KEY]})},usePeers=()=>useQuery({queryKey:[PEERS_QUERY_KEY],queryFn:()=>WalletClient.getPeers(),initialData:[]}).data,useRemovePeer=()=>{const a=useRefreshPeers(),_=useRemoveConnection();return $=>WalletClient.removePeer($,!0).then(()=>_($.senderId)).finally(()=>void a())},useRemovePeerBySenderId=()=>{const a=usePeers(),_=useRemovePeer();return $=>Promise.all(a.filter(j=>$===j.senderId).map(_))},useRemovePeersByAccounts=()=>{const a=useGetPeersForAccounts(),_=useRemovePeerBySenderId();return $=>Promise.all(a($).map(_))},useAddPeer=()=>{const a=useRefreshPeers(),_=useToast();return $=>new Serializer().deserialize($).then(makePeerInfo).then(j=>WalletClient.addPeer(j)).then(a).catch(j=>{_({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 a=useAppDispatch(),_=useGetMultisigsToRemove(),$=useRemoveAccountsDependencies();return j=>{const et=_(j);$([...j,...et]),a(multisigsSlice.actions.removeMultisigsData(et.map(tt=>tt.address.pkh)))}},useRemoveAccountsDependencies=()=>{const a=useAppDispatch(),_=useRemovePeersByAccounts();return $=>{const j=$.map(et=>et.address.pkh);a(batchesSlice.actions.removeByAccounts(j)),_(j),a(beaconSlice.actions.removeConnections(j)),a(assetsSlice.actions.removeAccountsData(j))}},useGetMultisigsToRemove=()=>{const a=useImplicitAccounts(),_=useMultisigAccounts();return $=>{const j=$.map(tt=>tt.address.pkh),et=a.map(tt=>tt.address.pkh).filter(tt=>!j.includes(tt));return _.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=a=>makeDerivationPath(defaultDerivationPathTemplate,a),makeDerivationPath=(a,_)=>a.replace("?",_.toString()),makeMnemonicAccount=(a,_,$,j,et,tt)=>({curve:"ed25519",derivationPath:$,derivationPathTemplate:j,pk:a,address:parseImplicitPkh(_),seedFingerPrint:et,label:tt,type:"mnemonic"}),generate24WordMnemonic=()=>generateMnemonic_1(256),restoreRevealedPublicKeyPairs=async(a,_,$)=>{const j=[];let et=0,tt=await derivePublicKeyPair(a,makeDerivationPath(_,et));do j.push(tt),et+=1,tt=await derivePublicKeyPair(a,makeDerivationPath(_,et));while(await addressExists(tt.pkh,$));return j},useRestoreRevealedMnemonicAccounts=()=>{const a=useGetNextAvailableAccountLabels();return async(_,$,j,et)=>{const tt=await restoreRevealedPublicKeyPairs(_,j,$),rt=await getFingerPrint(_),nt=a(et,tt.length);return tt.map(({pk:it,pkh:st},ot)=>makeMnemonicAccount(it,st,makeDerivationPath(j,ot),j,rt,nt[ot]))}},getCurve=a=>{if(a.startsWith(Prefix.EDESK)||a.startsWith(Prefix.EDSK))return"ed25519";if(a.startsWith(Prefix.SPESK)||a.startsWith(Prefix.SPSK))return"secp256k1";if(a.startsWith(Prefix.P2ESK)||a.startsWith(Prefix.P2SK))return"p256";throw new Error("Invalid secret key")},isEncryptedSecretKeyPrefix=a=>a.substring(2,3)==="e",makeSecretKeyAccount=async({secretKey:a,label:_,password:$})=>{const{pk:j,pkh:et}=await getPublicKeyPairFromSk(a),tt=await encrypt$1(a,$);return{account:{type:"secret_key",pk:j,label:_,curve:getCurve(a),address:parseImplicitPkh(et)},encryptedSecretKey:tt}},restore=({secretKey:a,label:_,password:$})=>async j=>{const{account:et,encryptedSecretKey:tt}=await makeSecretKeyAccount({secretKey:a,label:_,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 a=useSelectedNetwork(),_=useRestoreRevealedMnemonicAccounts(),$=useDispatch();return async({mnemonic:j,password:et,derivationPathTemplate:tt,label:rt})=>{const nt=await getFingerPrint(j),it=await _(j,a,tt,rt),st=await encrypt$1(j,et);$(accountsSlice.actions.addMnemonicAccounts({seedFingerprint:nt,accounts:it,encryptedMnemonic:st}))}},useDeriveMnemonicAccount=()=>{const a=useSeedPhrases(),_=useImplicitAccounts(),$=useGetNextAvailableAccountLabels(),j=useDispatch();return async({fingerPrint:et,password:tt,label:rt})=>{const nt=a[et];if(!nt)throw new Error(`No seedphrase found with fingerprint: ${et}`);const it=await decrypt$1(nt,tt),st=_.filter(Pt=>Pt.type==="mnemonic"&&Pt.seedFingerPrint===et),ot=st.length,at=st[0].derivationPathTemplate,ut=makeDerivationPath(at,ot),{pk:ht,pkh:yt}=await derivePublicKeyPair(it,ut),wt=$(rt,1)[0],Ct=makeMnemonicAccount(ht,yt,ut,at,et,wt);j(accountsSlice.actions.addAccount(Ct))}},useRestoreFromSecretKey=()=>{const a=useAppDispatch();return(_,$,j)=>a(restore({secretKey:_,password:$,label:j}))},useRestoreLedger=()=>{const a=useAppDispatch();return(_,$,j,et,tt)=>{a(addAccount({derivationPathTemplate:_,derivationPath:$,curve:"ed25519",type:"ledger",pk:j,address:{type:"implicit",pkh:et},label:tt}))}},useRestoreSocial=()=>{const a=useAppDispatch();return(_,$,j)=>{a(addAccount({type:"social",pk:_,address:{type:"implicit",pkh:$},idp:"google",label:j}))}},useRemoveMnemonic=()=>{const a=useAppDispatch(),_=useGetAccountsByFingerPrint(),$=useRemoveDependenciesAndMultisigs();return j=>{$(_(j)),a(removeMnemonicAndAccounts({fingerPrint:j}))}},useRemoveNonMnemonic=()=>{const a=useAppDispatch(),_=useGetAccountsByType(),$=useRemoveDependenciesAndMultisigs();return j=>{$(_(j)),a(removeNonMnemonicAccounts({accountType:j}))}},useRemoveAccount=()=>{const a=useAppDispatch(),_=useRemoveDependenciesAndMultisigs();return $=>{_([$]),a(accountsSlice.actions.removeAccount($))}},DEFAULT_TITLE="Name Your Account",NameAccountDisplay=({onSubmit:a,title:_=DEFAULT_TITLE,subtitle:$})=>{const{register:j,handleSubmit:et}=useForm({mode:"onChange"});return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(EditAccountIcon,{}),subtitle:$,title:_,children:jsxRuntimeExports.jsxs("form",{onSubmit:et(a),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:a,account:_})=>{const $=useGetNextAvailableAccountLabels(),j=et=>{const tt=et.accountName.trim()||DEFAULT_ACCOUNT_LABEL,rt=$(tt)[0];switch(_.type){case"secret_key":return a({type:"masterPassword",account:{..._,label:rt}});case"ledger":return a({type:"derivationPath",account:{..._,label:rt}});case"mnemonic":return a({type:"derivationPath",account:{..._,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 a=useRestoreFromMnemonic();return async(_,$)=>{const j=_.recoveryPhrases,et=_.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 a({mnemonic:nt,password:$,label:DEFAULT_ACCOUNT_LABEL,derivationPathTemplate:et[rt]})}},restoreV2BackupFile=async(a,_)=>{const $=a["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,_,"V2")}catch{throw new Error("Invalid password.")}persistor.pause(),localStorage.clear(),localStorage.setItem("persist:accounts",$),localStorage.setItem("persist:root",a["persist:root"])},downloadBackupFile=()=>{const a={version:packageInfo.version,"persist:accounts":localStorage.getItem("persist:accounts"),"persist:root":localStorage.getItem("persist:root")},_=`data:text/json;chatset=utf-8,${encodeURIComponent(JSON.stringify(a))}`,$=document.createElement("a");$.href=_,$.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:a,onOpen:_}=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:_,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"})]})})]})})}),a]})},queryClient=new QueryClient,ReactQueryProvider=({children:a})=>jsxRuntimeExports.jsx(QueryClientProvider,{client:queryClient,children:a}),ReduxStore=a=>jsxRuntimeExports.jsx(Provider_default,{store,children:a.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}}},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(a=>({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=a=>jsxRuntimeExports.jsxs(ChakraProvider,{theme,children:[jsxRuntimeExports.jsx(ColorModeScript,{initialColorMode:theme.config.initialColorMode}),a.children]});/** - * @remix-run/router v1.16.1 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * 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(a){for(var _=1;_"u")throw new Error(_)}function warning(a,_){if(!a){typeof console<"u"&&console.warn(_);try{throw new Error(_)}catch{}}}function createKey(){return Math.random().toString(36).substr(2,8)}function getHistoryState(a,_){return{usr:a.state,key:a.key,idx:_}}function createLocation(a,_,$,j){return $===void 0&&($=null),_extends$4({pathname:typeof a=="string"?a:a.pathname,search:"",hash:""},typeof _=="string"?parsePath(_):_,{state:$,key:_&&_.key||j||createKey()})}function createPath(a){let{pathname:_="/",search:$="",hash:j=""}=a;return $&&$!=="?"&&(_+=$.charAt(0)==="?"?$:"?"+$),j&&j!=="#"&&(_+=j.charAt(0)==="#"?j:"#"+j),_}function parsePath(a){let _={};if(a){let $=a.indexOf("#");$>=0&&(_.hash=a.substr($),a=a.substr(0,$));let j=a.indexOf("?");j>=0&&(_.search=a.substr(j),a=a.substr(0,j)),a&&(_.pathname=a)}return _}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,st=ot();st==null&&(st=0,rt.replaceState(_extends$4({},rt.state,{idx:st}),""));function ot(){return(rt.state||{idx:null}).idx}function at(){nt=Action.Pop;let Ct=ot(),Pt=Ct==null?null:Ct-st;st=Ct,it&&it({action:nt,location:wt.location,delta:Pt})}function ut(Ct,Pt){nt=Action.Push;let $t=createLocation(wt.location,Ct,Pt);$&&$($t,Ct),st=ot()+1;let Mt=getHistoryState($t,st),Lt=wt.createHref($t);try{rt.pushState(Mt,"",Lt)}catch(Dt){if(Dt instanceof DOMException&&Dt.name==="DataCloneError")throw Dt;et.location.assign(Lt)}tt&&it&&it({action:nt,location:wt.location,delta:1})}function ht(Ct,Pt){nt=Action.Replace;let $t=createLocation(wt.location,Ct,Pt);$&&$($t,Ct),st=ot();let Mt=getHistoryState($t,st),Lt=wt.createHref($t);rt.replaceState(Mt,"",Lt),tt&&it&&it({action:nt,location:wt.location,delta:0})}function yt(Ct){let Pt=et.location.origin!=="null"?et.location.origin:et.location.href,$t=typeof Ct=="string"?Ct:createPath(Ct);return $t=$t.replace(/ $/,"%20"),invariant(Pt,"No window.location.(origin|href) available to create URL for href: "+$t),new URL($t,Pt)}let wt={get action(){return nt},get location(){return a(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 _(et,Ct)},createURL:yt,encodeLocation(Ct){let Pt=yt(Ct);return{pathname:Pt.pathname,search:Pt.search,hash:Pt.hash}},push:ut,replace:ht,go(Ct){return rt.go(Ct)}};return wt}var ResultType;(function(a){a.data="data",a.deferred="deferred",a.redirect="redirect",a.error="error"})(ResultType||(ResultType={}));function matchRoutes(a,_,$){$===void 0&&($="/");let j=typeof _=="string"?parsePath(_):_,et=stripBasename(j.pathname||"/",$);if(et==null)return null;let tt=flattenRoutes(a);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 st=joinPaths([j,it.relativePath]),ot=$.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 "'+st+'".')),flattenRoutes(tt.children,_,ot,st)),!(tt.path==null&&!tt.index)&&_.push({path:st,score:computeScore(st,tt.index),routesMeta:ot})};return a.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)}),_}function explodeOptionalSegments(a){let _=a.split("/");if(_.length===0)return[];let[$,...j]=_,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=>a.startsWith("/")&&it===""?"/":it)}function rankRouteBranches(a){a.sort((_,$)=>_.score!==$.score?$.score-_.score:compareIndexes(_.routesMeta.map(j=>j.childrenIndex),$.routesMeta.map(j=>j.childrenIndex)))}const paramRe=/^:[\w-]+$/,dynamicSegmentValue=3,indexRouteValue=2,emptySegmentValue=1,staticSegmentValue=10,splatPenalty=-2,isSplat=a=>a==="*";function computeScore(a,_){let $=a.split("/"),j=$.length;return $.some(isSplat)&&(j+=splatPenalty),_&&(j+=indexRouteValue),$.filter(et=>!isSplat(et)).reduce((et,tt)=>et+(paramRe.test(tt)?dynamicSegmentValue:tt===""?emptySegmentValue:staticSegmentValue),j)}function compareIndexes(a,_){return a.length===_.length&&a.slice(0,-1).every((j,et)=>j===_[et])?a[a.length-1]-_[_.length-1]:0}function matchRouteBranch(a,_){let{routesMeta:$}=a,j={},et="/",tt=[];for(let rt=0;rt<$.length;++rt){let nt=$[rt],it=rt===$.length-1,st=et==="/"?_:_.slice(et.length)||"/",ot=matchPath({path:nt.relativePath,caseSensitive:nt.caseSensitive,end:it},st);if(!ot)return null;Object.assign(j,ot.params);let at=nt.route;tt.push({params:j,pathname:joinPaths([et,ot.pathname]),pathnameBase:normalizePathname(joinPaths([et,ot.pathnameBase])),route:at}),ot.pathnameBase!=="/"&&(et=joinPaths([et,ot.pathnameBase]))}return tt}function matchPath(a,_){typeof a=="string"&&(a={path:a,caseSensitive:!1,end:!0});let[$,j]=compilePath(a.path,a.caseSensitive,a.end),et=_.match($);if(!et)return null;let tt=et[0],rt=tt.replace(/(.)\/+$/,"$1"),nt=et.slice(1);return{params:j.reduce((st,ot,at)=>{let{paramName:ut,isOptional:ht}=ot;if(ut==="*"){let wt=nt[at]||"";rt=tt.slice(0,tt.length-wt.length).replace(/(.)\/+$/,"$1")}const yt=nt[at];return ht&&!yt?st[ut]=void 0:st[ut]=(yt||"").replace(/%2F/g,"/"),st},{}),pathname:tt,pathnameBase:rt,pattern:a}}function compilePath(a,_,$){_===void 0&&(_=!1),$===void 0&&($=!0),warning(a==="*"||!a.endsWith("*")||a.endsWith("/*"),'Route path "'+a+'" will be treated as if it were '+('"'+a.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+a.replace(/\*$/,"/*")+'".'));let j=[],et="^"+a.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(rt,nt,it)=>(j.push({paramName:nt,isOptional:it!=null}),it?"/?([^\\/]+)?":"/([^\\/]+)"));return a.endsWith("*")?(j.push({paramName:"*"}),et+=a==="*"||a==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):$?et+="\\/*$":a!==""&&a!=="/"&&(et+="(?:(?=\\/|$))"),[new RegExp(et,_?void 0:"i"),j]}function decodePath(a){try{return a.split("/").map(_=>decodeURIComponent(_).replace(/\//g,"%2F")).join("/")}catch(_){return warning(!1,'The URL path "'+a+'" 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(_==="/")return a;if(!a.toLowerCase().startsWith(_.toLowerCase()))return null;let $=_.endsWith("/")?_.length-1:_.length,j=a.charAt($);return j&&j!=="/"?null:a.slice($)||"/"}function resolvePath(a,_){_===void 0&&(_="/");let{pathname:$,search:j="",hash:et=""}=typeof a=="string"?parsePath(a):a;return{pathname:$?$.startsWith("/")?$:resolvePathname($,_):_,search:normalizeSearch(j),hash:normalizeHash(et)}}function resolvePathname(a,_){let $=_.replace(/\/+$/,"").split("/");return a.split("/").forEach(et=>{et===".."?$.length>1&&$.pop():et!=="."&&$.push(et)}),$.length>1?$.join("/"):"/"}function getInvalidPathError(a,_,$,j){return"Cannot include a '"+a+"' character in a manually specified "+("`to."+_+"` 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(a){return a.filter((_,$)=>$===0||_.route.path&&_.route.path.length>0)}function getResolveToMatches(a,_){let $=getPathContributingMatches(a);return _?$.map((j,et)=>et===a.length-1?j.pathname:j.pathnameBase):$.map(j=>j.pathnameBase)}function resolveTo(a,_,$,j){j===void 0&&(j=!1);let et;typeof a=="string"?et=parsePath(a):(et=_extends$4({},a),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=a===""||et.pathname==="",rt=tt?"/":et.pathname,nt;if(rt==null)nt=$;else{let at=_.length-1;if(!j&&rt.startsWith("..")){let ut=rt.split("/");for(;ut[0]==="..";)ut.shift(),at-=1;et.pathname=ut.join("/")}nt=at>=0?_[at]:"/"}let it=resolvePath(et,nt),st=rt&&rt!=="/"&&rt.endsWith("/"),ot=(tt||rt===".")&&$.endsWith("/");return!it.pathname.endsWith("/")&&(st||ot)&&(it.pathname+="/"),it}const joinPaths=a=>a.join("/").replace(/\/\/+/g,"/"),normalizePathname=a=>a.replace(/\/+$/,"").replace(/^\/*/,"/"),normalizeSearch=a=>!a||a==="?"?"":a.startsWith("?")?a:"?"+a,normalizeHash=a=>!a||a==="#"?"":a.startsWith("#")?a:"#"+a;function isRouteErrorResponse(a){return a!=null&&typeof a.status=="number"&&typeof a.statusText=="string"&&typeof a.internal=="boolean"&&"data"in a}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. - * - * This source code is licensed under the MIT license found in the - * 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(a){for(var _=1;_{nt.current=!0}),reactExports.useCallback(function(st,ot){if(ot===void 0&&(ot={}),!nt.current)return;if(typeof st=="number"){j.go(st);return}let at=resolveTo(st,JSON.parse(rt),tt,ot.relative==="path");a==null&&_!=="/"&&(at.pathname=at.pathname==="/"?_:joinPaths([_,at.pathname])),(ot.replace?j.replace:j.push)(at,ot.state,ot)},[_,j,rt,tt,a])}function useParams(){let{matches:a}=reactExports.useContext(RouteContext),_=a[a.length-1];return _?_.params:{}}function useResolvedPath(a,_){let{relative:$}=_===void 0?{}:_,{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(a,JSON.parse(rt),tt,$==="path"),[a,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 st=useLocation(),ot;if(_){var at;let Ct=typeof _=="string"?parsePath(_):_;it==="/"||(at=Ct.pathname)!=null&&at.startsWith(it)||invariant(!1),ot=Ct}else ot=st;let ut=ot.pathname||"/",ht=ut;if(it!=="/"){let Ct=it.replace(/^\//,"").split("/");ht="/"+ut.replace(/^\//,"").split("/").slice(Ct.length).join("/")}let yt=matchRoutes(a,{pathname:ht}),wt=_renderMatches(yt&&yt.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 _&&wt?reactExports.createElement(LocationContext.Provider,{value:{location:_extends$3({pathname:"/",search:"",hash:"",state:null,key:"default"},ot),navigationType:Action.Pop}},wt):wt}function DefaultErrorComponent(){let a=useRouteError(),_=isRouteErrorResponse(a)?a.status+" "+a.statusText:a instanceof Error?a.message:JSON.stringify(a),$=a instanceof Error?a.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"}},_),$?reactExports.createElement("pre",{style:et},$):null,null)}const defaultErrorElement=reactExports.createElement(DefaultErrorComponent,null);class RenderErrorBoundary extends reactExports.Component{constructor(_){super(_),this.state={location:_.location,revalidation:_.revalidation,error:_.error}}static getDerivedStateFromError(_){return{error:_}}static getDerivedStateFromProps(_,$){return $.location!==_.location||$.revalidation!=="idle"&&_.revalidation==="idle"?{error:_.error,location:_.location,revalidation:_.revalidation}:{error:_.error!==void 0?_.error:$.error,location:$.location,revalidation:_.revalidation||$.revalidation}}componentDidCatch(_,$){console.error("React Router caught the following error during render",_,$)}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(a){let{routeContext:_,match:$,children:j}=a,et=reactExports.useContext(DataRouterContext);return et&&et.static&&et.staticContext&&($.route.errorElement||$.route.ErrorBoundary)&&(et.staticContext._deepestRenderedBoundaryId=$.route.id),reactExports.createElement(RouteContext.Provider,{value:_},j)}function _renderMatches(a,_,$,j){var et;if(_===void 0&&(_=[]),$===void 0&&($=null),j===void 0&&(j=null),a==null){var tt;if((tt=$)!=null&&tt.errors)a=$.matches;else return null}let rt=a,nt=(et=$)==null?void 0:et.errors;if(nt!=null){let ot=rt.findIndex(at=>at.route.id&&(nt==null?void 0:nt[at.route.id])!==void 0);ot>=0||invariant(!1),rt=rt.slice(0,Math.min(rt.length,ot+1))}let it=!1,st=-1;if($&&j&&j.v7_partialHydration)for(let ot=0;ot=0?rt=rt.slice(0,st+1):rt=[rt[0]];break}}}return rt.reduceRight((ot,at,ut)=>{let ht,yt=!1,wt=null,Ct=null;$&&(ht=nt&&at.route.id?nt[at.route.id]:void 0,wt=at.route.errorElement||defaultErrorElement,it&&(st<0&&ut===0?(yt=!0,Ct=null):st===ut&&(yt=!0,Ct=at.route.hydrateFallbackElement||null)));let Pt=_.concat(rt.slice(0,ut+1)),$t=()=>{let Mt;return ht?Mt=wt:yt?Mt=Ct:at.route.Component?Mt=reactExports.createElement(at.route.Component,null):at.route.element?Mt=at.route.element:Mt=ot,reactExports.createElement(RenderedRoute,{match:at,routeContext:{outlet:ot,matches:Pt,isDataRoute:$!=null},children:Mt})};return $&&(at.route.ErrorBoundary||at.route.errorElement||ut===0)?reactExports.createElement(RenderErrorBoundary,{location:$.location,revalidation:$.revalidation,component:wt,error:ht,children:$t(),routeContext:{outlet:null,matches:Pt,isDataRoute:!0}}):$t()},null)}var DataRouterHook$1=function(a){return a.UseBlocker="useBlocker",a.UseRevalidator="useRevalidator",a.UseNavigateStable="useNavigate",a}(DataRouterHook$1||{}),DataRouterStateHook$1=function(a){return a.UseBlocker="useBlocker",a.UseLoaderData="useLoaderData",a.UseActionData="useActionData",a.UseRouteError="useRouteError",a.UseNavigation="useNavigation",a.UseRouteLoaderData="useRouteLoaderData",a.UseMatches="useMatches",a.UseRevalidator="useRevalidator",a.UseNavigateStable="useNavigate",a.UseRouteId="useRouteId",a}(DataRouterStateHook$1||{});function useDataRouterContext(a){let _=reactExports.useContext(DataRouterContext);return _||invariant(!1),_}function useDataRouterState(a){let _=reactExports.useContext(DataRouterStateContext);return _||invariant(!1),_}function useRouteContext(a){let _=reactExports.useContext(RouteContext);return _||invariant(!1),_}function useCurrentRouteId(a){let _=useRouteContext(),$=_.matches[_.matches.length-1];return $.route.id||invariant(!1),$.route.id}function useRouteError(){var a;let _=reactExports.useContext(RouteErrorContext),$=useDataRouterState(DataRouterStateHook$1.UseRouteError),j=useCurrentRouteId(DataRouterStateHook$1.UseRouteError);return _!==void 0?_:(a=$.errors)==null?void 0:a[j]}function useNavigateStable(){let{router:a}=useDataRouterContext(DataRouterHook$1.UseNavigateStable),_=useCurrentRouteId(DataRouterStateHook$1.UseNavigateStable),$=reactExports.useRef(!1);return useIsomorphicLayoutEffect(()=>{$.current=!0}),reactExports.useCallback(function(et,tt){tt===void 0&&(tt={}),$.current&&(typeof et=="number"?a.navigate(et):a.navigate(et,_extends$3({fromRouteId:_},tt)))},[a,_])}function Navigate(a){let{to:_,replace:$,state:j,relative:et}=a;useInRouterContext()||invariant(!1);let{future:tt,static:rt}=reactExports.useContext(NavigationContext),{matches:nt}=reactExports.useContext(RouteContext),{pathname:it}=useLocation(),st=useNavigate(),ot=resolveTo(_,getResolveToMatches(nt,tt.v7_relativeSplatPath),it,et==="path"),at=JSON.stringify(ot);return reactExports.useEffect(()=>st(JSON.parse(at),{replace:$,state:j,relative:et}),[st,at,et,$,j]),null}function Route(a){invariant(!1)}function Router$1(a){let{basename:_="/",children:$=null,location:j,navigationType:et=Action.Pop,navigator:tt,static:rt=!1,future:nt}=a;useInRouterContext()&&invariant(!1);let it=_.replace(/^\/*/,"/"),st=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:ot="/",search:at="",hash:ut="",state:ht=null,key:yt="default"}=j,wt=reactExports.useMemo(()=>{let Ct=stripBasename(ot,it);return Ct==null?null:{location:{pathname:Ct,search:at,hash:ut,state:ht,key:yt},navigationType:et}},[it,ot,at,ut,ht,yt,et]);return wt==null?null:reactExports.createElement(NavigationContext.Provider,{value:st},reactExports.createElement(LocationContext.Provider,{children:$,value:wt}))}function Routes(a){let{children:_,location:$}=a;return useRoutes(createRoutesFromChildren(_),$)}new Promise(()=>{});function createRoutesFromChildren(a,_){_===void 0&&(_=[]);let $=[];return reactExports.Children.forEach(a,(j,et)=>{if(!reactExports.isValidElement(j))return;let tt=[..._,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. - * - * This source code is licensed under the MIT license found in the - * 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(a){for(var _=1;_=0)&&($[et]=a[et]);return $}function isModifiedEvent(a){return!!(a.metaKey||a.altKey||a.ctrlKey||a.shiftKey)}function shouldProcessLinkClick(a,_){return a.button===0&&(!_||_==="_self")&&!isModifiedEvent(a)}function createSearchParams(a){return a===void 0&&(a=""),new URLSearchParams(typeof a=="string"||Array.isArray(a)||a instanceof URLSearchParams?a:Object.keys(a).reduce((_,$)=>{let j=a[$];return _.concat(Array.isArray(j)?j.map(et=>[$,et]):[[$,j]])},[]))}function getSearchParamsForLocation(a,_){let $=createSearchParams(a);return _&&_.forEach((j,et)=>{$.has(et)||_.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(a){}const START_TRANSITION="startTransition",startTransitionImpl=React$3[START_TRANSITION];function HashRouter(a){let{basename:_,children:$,future:j,window:et}=a,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:st}=j||{},ot=reactExports.useCallback(at=>{st&&startTransitionImpl?startTransitionImpl(()=>it(at)):it(at)},[it,st]);return reactExports.useLayoutEffect(()=>rt.listen(ot),[rt,ot]),reactExports.createElement(Router$1,{basename:_,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:st,preventScrollReset:ot,unstable_viewTransition:at}=_,ut=_objectWithoutPropertiesLoose$1(_,_excluded$3),{basename:ht}=reactExports.useContext(NavigationContext),yt,wt=!1;if(typeof st=="string"&&ABSOLUTE_URL_REGEX.test(st)&&(yt=st,isBrowser))try{let Mt=new URL(window.location.href),Lt=st.startsWith("//")?new URL(Mt.protocol+st):new URL(st),Dt=stripBasename(Lt.pathname,ht);Lt.origin===Mt.origin&&Dt!=null?st=Dt+Lt.search+Lt.hash:wt=!0}catch{}let Ct=useHref(st,{relative:et}),Pt=useLinkClickHandler(st,{replace:rt,state:nt,target:it,preventScrollReset:ot,relative:et,unstable_viewTransition:at});function $t(Mt){j&&j(Mt),Mt.defaultPrevented||Pt(Mt)}return reactExports.createElement("a",_extends$2({},ut,{href:yt||Ct,onClick:wt||tt?j:$t,ref:$,target:it}))});var DataRouterHook;(function(a){a.UseScrollRestoration="useScrollRestoration",a.UseSubmit="useSubmit",a.UseSubmitFetcher="useSubmitFetcher",a.UseFetcher="useFetcher",a.useViewTransitionState="useViewTransitionState"})(DataRouterHook||(DataRouterHook={}));var DataRouterStateHook;(function(a){a.UseFetcher="useFetcher",a.UseFetchers="useFetchers",a.UseScrollRestoration="useScrollRestoration"})(DataRouterStateHook||(DataRouterStateHook={}));function useLinkClickHandler(a,_){let{target:$,replace:j,state:et,preventScrollReset:tt,relative:rt,unstable_viewTransition:nt}=_===void 0?{}:_,it=useNavigate(),st=useLocation(),ot=useResolvedPath(a,{relative:rt});return reactExports.useCallback(at=>{if(shouldProcessLinkClick(at,$)){at.preventDefault();let ut=j!==void 0?j:createPath(st)===createPath(ot);it(a,{replace:ut,state:et,preventScrollReset:tt,relative:rt,unstable_viewTransition:nt})}},[st,it,ot,j,et,$,a,tt,rt,nt])}function useSearchParams(a){let _=reactExports.useRef(createSearchParams(a)),$=reactExports.useRef(!1),j=useLocation(),et=reactExports.useMemo(()=>getSearchParamsForLocation(j.search,$.current?null:_.current),[j.search]),tt=useNavigate(),rt=reactExports.useCallback((nt,it)=>{const st=createSearchParams(typeof nt=="function"?nt(et):nt);$.current=!0,tt("?"+st,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:a,seen:_}=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:a}})]}),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=a.forwardProps,nt=a.children,it=a.className,st=a.removeScrollBar,ot=a.enabled,at=a.shards,ut=a.sideCar,ht=a.noIsolation,yt=a.inert,wt=a.allowPinchZoom,Ct=a.as,Pt=Ct===void 0?"div":Ct,$t=a.gapMode,Mt=__rest$3(a,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),Lt=ut,Dt=useMergeRefs([$,_]),zt=__assign(__assign({},Mt),et);return reactExports.createElement(reactExports.Fragment,null,ot&&reactExports.createElement(Lt,{sideCar:effectCar,removeScrollBar:st,shards:at,noIsolation:ht,inert:yt,setCallbacks:tt,allowPinchZoom:!!wt,lockRef:$,gapMode:$t}),rt?reactExports.cloneElement(reactExports.Children.only(nt),__assign(__assign({},zt),{ref:Dt})):reactExports.createElement(Pt,__assign({},zt,{className:it,ref:Dt}),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(a){return parseInt(a||"",10)||0},getOffset=function(a){var _=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(a){if(a===void 0&&(a="margin"),typeof window>"u")return zeroGap;var _=getOffset(a),$=document.documentElement.clientWidth,j=window.innerWidth;return{left:_[0],top:_[1],right:_[2],gap:Math.max(0,j-$+_[2]-_[0])}},Style=styleSingleton(),lockAttribute="data-scroll-locked",getStyles=function(a,_,$,j){var et=a.left,tt=a.top,rt=a.right,nt=a.gap;return $===void 0&&($="margin"),` - .`.concat(noScrollbarsClassName,` { - overflow: hidden `).concat(j,`; - padding-right: `).concat(nt,"px ").concat(j,`; - } - body[`).concat(lockAttribute,`] { - overflow: hidden `).concat(j,`; - overscroll-behavior: contain; - `).concat([_&&"position: relative ".concat(j,";"),$==="margin"&&` - padding-left: `.concat(et,`px; - padding-top: `).concat(tt,`px; - padding-right: `).concat(rt,`px; - margin-left:0; - margin-top:0; - margin-right: `).concat(nt,"px ").concat(j,`; - `),$==="padding"&&"padding-right: ".concat(nt,"px ").concat(j,";")].filter(Boolean).join(""),` - } - - .`).concat(zeroRightClassName,` { - right: `).concat(nt,"px ").concat(j,`; - } - - .`).concat(fullWidthClassName,` { - margin-right: `).concat(nt,"px ").concat(j,`; - } - - .`).concat(zeroRightClassName," .").concat(zeroRightClassName,` { - right: 0 `).concat(j,`; - } - - .`).concat(fullWidthClassName," .").concat(fullWidthClassName,` { - margin-right: 0 `).concat(j,`; - } - - body[`).concat(lockAttribute,`] { - `).concat(removedBarSizeVariable,": ").concat(nt,`px; - } -`)},getCurrentUseCounter=function(){var a=parseInt(document.body.getAttribute(lockAttribute)||"0",10);return isFinite(a)?a:0},useLockAttribute=function(){reactExports.useEffect(function(){return document.body.setAttribute(lockAttribute,(getCurrentUseCounter()+1).toString()),function(){var a=getCurrentUseCounter()-1;a<=0?document.body.removeAttribute(lockAttribute):document.body.setAttribute(lockAttribute,a.toString())}},[])},RemoveScrollBar=function(a){var _=a.noRelative,$=a.noImportant,j=a.gapMode,et=j===void 0?"margin":j;useLockAttribute();var tt=reactExports.useMemo(function(){return getGapWidth(et)},[et]);return reactExports.createElement(Style,{styles:getStyles(tt,!_,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(a){return a.tagName==="TEXTAREA"},elementCanBeScrolled=function(a,_){if(!(a instanceof Element))return!1;var $=window.getComputedStyle(a);return $[_]!=="hidden"&&!($.overflowY===$.overflowX&&!alwaysContainsScroll(a)&&$[_]==="visible")},elementCouldBeVScrolled=function(a){return elementCanBeScrolled(a,"overflowY")},elementCouldBeHScrolled=function(a){return elementCanBeScrolled(a,"overflowX")},locationCouldBeScrolled=function(a,_){var $=_.ownerDocument,j=_;do{typeof ShadowRoot<"u"&&j instanceof ShadowRoot&&(j=j.host);var et=elementCouldBeScrolled(a,j);if(et){var tt=getScrollVariables(a,j),rt=tt[1],nt=tt[2];if(rt>nt)return!0}j=j.parentNode}while(j&&j!==$.body);return!1},getVScrollVariables=function(a){var _=a.scrollTop,$=a.scrollHeight,j=a.clientHeight;return[_,$,j]},getHScrollVariables=function(a){var _=a.scrollLeft,$=a.scrollWidth,j=a.clientWidth;return[_,$,j]},elementCouldBeScrolled=function(a,_){return a==="v"?elementCouldBeVScrolled(_):elementCouldBeHScrolled(_)},getScrollVariables=function(a,_){return a==="v"?getVScrollVariables(_):getHScrollVariables(_)},getDirectionFactor=function(a,_){return a==="h"&&_==="rtl"?-1:1},handleScroll=function(a,_,$,j,et){var tt=getDirectionFactor(a,window.getComputedStyle(_).direction),rt=tt*j,nt=$.target,it=_.contains(nt),st=!1,ot=rt>0,at=0,ut=0;do{var ht=getScrollVariables(a,nt),yt=ht[0],wt=ht[1],Ct=ht[2],Pt=wt-Ct-tt*yt;(yt||Pt)&&elementCouldBeScrolled(a,nt)&&(at+=Pt,ut+=yt),nt instanceof ShadowRoot?nt=nt.host:nt=nt.parentNode}while(!it&&nt!==document.body||it&&(_.contains(nt)||_===nt));return(ot&&(Math.abs(at)<1||!et)||!ot&&(Math.abs(ut)<1||!et))&&(st=!0),st},getTouchXY=function(a){return"changedTouches"in a?[a.changedTouches[0].clientX,a.changedTouches[0].clientY]:[0,0]},getDeltaXY=function(a){return[a.deltaX,a.deltaY]},extractRef=function(a){return a&&"current"in a?a.current:a},deltaCompare=function(a,_){return a[0]===_[0]&&a[1]===_[1]},generateStyle=function(a){return` - .block-interactivity-`.concat(a,` {pointer-events: none;} - .allow-interactivity-`).concat(a,` {pointer-events: all;} -`)},idCounter=0,lockStack=[];function RemoveScrollSideCar(a){var _=reactExports.useRef([]),$=reactExports.useRef([0,0]),j=reactExports.useRef(),et=reactExports.useState(idCounter++)[0],tt=reactExports.useState(styleSingleton)[0],rt=reactExports.useRef(a);reactExports.useEffect(function(){rt.current=a},[a]),reactExports.useEffect(function(){if(a.inert){document.body.classList.add("block-interactivity-".concat(et));var wt=__spreadArray([a.lockRef.current],(a.shards||[]).map(extractRef),!0).filter(Boolean);return wt.forEach(function(Ct){return Ct.classList.add("allow-interactivity-".concat(et))}),function(){document.body.classList.remove("block-interactivity-".concat(et)),wt.forEach(function(Ct){return Ct.classList.remove("allow-interactivity-".concat(et))})}}},[a.inert,a.lockRef.current,a.shards]);var nt=reactExports.useCallback(function(wt,Ct){if("touches"in wt&&wt.touches.length===2)return!rt.current.allowPinchZoom;var Pt=getTouchXY(wt),$t=$.current,Mt="deltaX"in wt?wt.deltaX:$t[0]-Pt[0],Lt="deltaY"in wt?wt.deltaY:$t[1]-Pt[1],Dt,zt=wt.target,Ot=Math.abs(Mt)>Math.abs(Lt)?"h":"v";if("touches"in wt&&Ot==="h"&&zt.type==="range")return!1;var It=locationCouldBeScrolled(Ot,zt);if(!It)return!0;if(It?Dt=Ot:(Dt=Ot==="v"?"h":"v",It=locationCouldBeScrolled(Ot,zt)),!It)return!1;if(!j.current&&"changedTouches"in wt&&(Mt||Lt)&&(j.current=Dt),!Dt)return!0;var Bt=j.current||Dt;return handleScroll(Bt,Ct,wt,Bt==="h"?Mt:Lt,!0)},[]),it=reactExports.useCallback(function(wt){var Ct=wt;if(!(!lockStack.length||lockStack[lockStack.length-1]!==tt)){var Pt="deltaY"in Ct?getDeltaXY(Ct):getTouchXY(Ct),$t=_.current.filter(function(Dt){return Dt.name===Ct.type&&(Dt.target===Ct.target||Ct.target===Dt.shadowParent)&&deltaCompare(Dt.delta,Pt)})[0];if($t&&$t.should){Ct.cancelable&&Ct.preventDefault();return}if(!$t){var Mt=(rt.current.shards||[]).map(extractRef).filter(Boolean).filter(function(Dt){return Dt.contains(Ct.target)}),Lt=Mt.length>0?nt(Ct,Mt[0]):!rt.current.noIsolation;Lt&&Ct.cancelable&&Ct.preventDefault()}}},[]),st=reactExports.useCallback(function(wt,Ct,Pt,$t){var Mt={name:wt,delta:Ct,target:Pt,should:$t,shadowParent:getOutermostShadowParent(Pt)};_.current.push(Mt),setTimeout(function(){_.current=_.current.filter(function(Lt){return Lt!==Mt})},1)},[]),ot=reactExports.useCallback(function(wt){$.current=getTouchXY(wt),j.current=void 0},[]),at=reactExports.useCallback(function(wt){st(wt.type,getDeltaXY(wt),wt.target,nt(wt,a.lockRef.current))},[]),ut=reactExports.useCallback(function(wt){st(wt.type,getTouchXY(wt),wt.target,nt(wt,a.lockRef.current))},[]);reactExports.useEffect(function(){return lockStack.push(tt),a.setCallbacks({onScrollCapture:at,onWheelCapture:at,onTouchMoveCapture:ut}),document.addEventListener("wheel",it,nonPassive),document.addEventListener("touchmove",it,nonPassive),document.addEventListener("touchstart",ot,nonPassive),function(){lockStack=lockStack.filter(function(wt){return wt!==tt}),document.removeEventListener("wheel",it,nonPassive),document.removeEventListener("touchmove",it,nonPassive),document.removeEventListener("touchstart",ot,nonPassive)}},[]);var ht=a.removeScrollBar,yt=a.inert;return reactExports.createElement(reactExports.Fragment,null,yt?reactExports.createElement(tt,{styles:generateStyle(et)}):null,ht?reactExports.createElement(RemoveScrollBar,{gapMode:a.gapMode}):null)}function getOutermostShadowParent(a){for(var _=null;a!==null;)a instanceof ShadowRoot&&(_=a.host,a=a.host),a=a.parentNode;return _}const SideCar=exportSidecar(effectCar,RemoveScrollSideCar);var ReactRemoveScroll=reactExports.forwardRef(function(a,_){return reactExports.createElement(RemoveScroll,__assign({},a,{ref:_,sideCar:SideCar}))});ReactRemoveScroll.classNames=RemoveScroll.classNames;const DynamicModalContext=reactExports.createContext({openWith:a=>Promise.resolve(),onClose:()=>{},isOpen:!1}),useDynamicModal=()=>{const{isOpen:a,onClose:_,onOpen:$}=useDisclosure$1(),[j,et]=reactExports.useState(null),[tt,rt]=reactExports.useState("md");return{isOpen:a,onClose:_,openWith:async(it,st="md")=>(rt(st),et(it),$(),Promise.resolve()),content:jsxRuntimeExports.jsxs(Modal,{autoFocus:!1,blockScrollOnMount:!1,closeOnOverlayClick:!1,isCentered:!0,isOpen:a,motionPreset:localStorage.getItem("chakra-modal-motion-preset")||void 0,onClose:_,size:tt,children:[jsxRuntimeExports.jsx(ModalOverlay,{}),jsxRuntimeExports.jsx(ReactRemoveScroll,{enabled:a,children:j})]})}},JsValueWrap=({value:a,space:_=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(a,null,_)})})});var md5$1={exports:{}},crypt={exports:{}};(function(){var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_={rotl:function($,j){return $<>>32-j},rotr:function($,j){return $<<32-j|$>>>j},endian:function($){if($.constructor==Number)return _.rotl($,8)&16711935|_.rotl($,24)&4278255360;for(var j=0;j<$.length;j++)$[j]=_.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(a.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((a.indexOf($.charAt(et-1))&Math.pow(2,-2*tt+8)-1)<>>6-tt*2);return j}};crypt.exports=_})();var cryptExports=crypt.exports,charenc={utf8:{stringToBytes:function(a){return charenc.bin.stringToBytes(unescape(encodeURIComponent(a)))},bytesToString:function(a){return decodeURIComponent(escape(charenc.bin.bytesToString(a)))}},bin:{stringToBytes:function(a){for(var _=[],$=0;$ - * @license MIT - */var isBuffer_1=function(a){return a!=null&&(isBuffer(a)||isSlowBuffer(a)||!!a._isBuffer)};function isBuffer(a){return!!a.constructor&&typeof a.constructor.isBuffer=="function"&&a.constructor.isBuffer(a)}function isSlowBuffer(a){return typeof a.readFloatLE=="function"&&typeof a.slice=="function"&&isBuffer(a.slice(0,0))}(function(){var a=cryptExports,_=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=_.stringToBytes(tt):$(tt)?tt=Array.prototype.slice.call(tt,0):!Array.isArray(tt)&&tt.constructor!==Uint8Array&&(tt=tt.toString());for(var nt=a.bytesToWords(tt),it=tt.length*8,st=1732584193,ot=-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 yt=et._ff,wt=et._gg,Ct=et._hh,Pt=et._ii,ht=0;ht>>0,ot=ot+Mt>>>0,at=at+Lt>>>0,ut=ut+Dt>>>0}return a.endian([st,ot,at,ut])};et._ff=function(tt,rt,nt,it,st,ot,at){var ut=tt+(rt&nt|~rt&it)+(st>>>0)+at;return(ut<>>32-ot)+rt},et._gg=function(tt,rt,nt,it,st,ot,at){var ut=tt+(rt&it|nt&~it)+(st>>>0)+at;return(ut<>>32-ot)+rt},et._hh=function(tt,rt,nt,it,st,ot,at){var ut=tt+(rt^nt^it)+(st>>>0)+at;return(ut<>>32-ot)+rt},et._ii=function(tt,rt,nt,it,st,ot,at){var ut=tt+(nt^(rt|~it))+(st>>>0)+at;return(ut<>>32-ot)+rt},et._blocksize=16,et._digestsize=16,md5$1.exports=function(tt,rt){if(tt==null)throw new Error("Illegal argument "+tt);var nt=a.wordsToBytes(et(tt,rt));return rt&&rt.asBytes?nt:rt&&rt.asString?j.bytesToString(nt):a.bytesToHex(nt)}})();var md5Exports=md5$1.exports;const md5=getDefaultExportFromCjs$1(md5Exports),ReactIdenticon=React$2.memo(({count:a=5,background:_,string:$,size:j})=>{const et=reactExports.useRef(null);reactExports.useEffect(()=>{tt()});const tt=()=>{const rt=md5($),nt=Math.floor(j/a),it=rt.slice(0,6),st=et.current;st.width=nt*a,st.height=nt*a;const ot=rt.split("").map(ht=>parseInt(ht,16)).map(ht=>ht<8?0:1),at=[];at[0]=at[4]=ot.slice(0,5),at[1]=at[3]=ot.slice(5,10),at[2]=ot.slice(10,15);const ut=st.getContext("2d");ut.imageSmoothingEnabled=!1,ut.clearRect(0,0,st.width,st.height),at.forEach((ht,yt)=>{ht.forEach((wt,Ct)=>{wt?(ut.fillStyle="#"+it,ut.fillRect(nt*yt,nt*Ct,nt,nt)):(ut.fillStyle=_,ut.fillRect(nt*yt,nt*Ct,nt,nt))})})};return jsxRuntimeExports.jsx("canvas",{ref:et,style:{width:j,height:j}})}),color=a=>`#${md5(a).slice(0,6)}`,Identicon=({address:a,identiconSize:_,...$})=>jsxRuntimeExports.jsx(Box,{sx:{canvas:{borderRadius:"4px"}},zIndex:10,background:"white",borderRadius:"4px","data-testid":"identicon",...$,children:jsxRuntimeExports.jsx(ReactIdenticon,{background:"white",size:_,string:a,style:{borderRadius:4}})}),baseIconProps={stroke:colors.gray[400],borderRadius:"4px",padding:"5px",background:colors.gray[500]},AddressTileIcon=({addressKind:a,size:_="sm",identiconSize:$=20})=>{let j;switch(_){case"sm":j="30px";break;case"md":j="38.5px";break;case"lg":j="45.5px";break}switch(a.type){case"secret_key":case"mnemonic":return jsxRuntimeExports.jsx(Identicon,{width:j,height:j,padding:"5px",address:a.pkh,identiconSize:$});case"social":return jsxRuntimeExports.jsx(SocialIcon,{width:j,height:j,...baseIconProps,stroke:"transparent",background:"white"});case"ledger":return jsxRuntimeExports.jsx(LedgerIcon,{width:j,height:j,...baseIconProps});case"multisig":return jsxRuntimeExports.jsx(KeyIcon,{width:j,height:j,...baseIconProps});case"contact":return jsxRuntimeExports.jsx(ContactIcon,{width:j,height:j,...baseIconProps});case"unknown":return jsxRuntimeExports.jsx(UnknownContactIcon,{width:j,height:j,...baseIconProps});case"baker":{const et=`https://services.tzkt.io/v1/avatars/${a.pkh}`;return jsxRuntimeExports.jsx(AspectRatio,{width:"30px",height:"30px",marginRight:"8px","data-testid":"baker-icon",ratio:1,children:jsxRuntimeExports.jsx(Image$1,{src:et})})}}},useAddressKind$1=a=>{const _=useOwnedAccountAddressKind$1(a),$=useBakerAddressKind(a),j=useContactAddressKind(a);return _||$||j||{pkh:a.pkh,type:"unknown",label:null}},useOwnedAccountAddressKind$1=({pkh:a})=>{const $=useGetOwnedAccountSafe()(a);return $?{type:$.type,pkh:a,label:$.label}:null},useBakerAddressKind=({pkh:a})=>{const $=useGetBaker()(a);return $?{pkh:a,type:"baker",label:$.name}:null},useContactAddressKind=({pkh:a})=>{const $=useGetContactName()(a);return $?{pkh:a,type:"contact",label:$}:null},splitNumber=a=>{const[_,$]=a.split(".");return{integer:_,decimal:$}},PrettyNumber=({number:a,size:_="md",...$})=>{const j=_==="md"?"md":"lg",et=_==="md"?"sm":"md",{integer:tt,decimal:rt}=splitNumber(a);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:a,size:_,numberProps:$,...j})=>{const tt=useGetAccountBalance()(a);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:_,...$})})},AddressTile=({address:a,hideBalance:_=!1,...$})=>{const j=useAddressKind$1(a);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:_?"100%":"calc(100% - 95px)",children:[jsxRuntimeExports.jsx(AddressTileIcon,{addressKind:j}),j.type==="unknown"?jsxRuntimeExports.jsx(Text,{marginLeft:"10px",color:colors.gray[300],size:"sm",children:a.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)})]})]}),!_&&jsxRuntimeExports.jsx(AccountBalance,{overflow:"hidden",marginLeft:"10px",textAlign:"right",address:a.pkh,numberProps:{maxWidth:"85px"}})]})})},Suggestions=({contacts:a,hideBalance:_,onChange:$})=>a.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:a.map((j,et)=>jsxRuntimeExports.jsx(Box,{children:jsxRuntimeExports.jsx(ListItem,{marginBottom:et===a.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:_})})},j.pkh))}),getSuggestions=(a,_)=>_.filter($=>!a.trim()||$.name.toLowerCase().includes(a.trim().toLowerCase())),AddressAutocomplete=({contacts:a,isDisabled:_,isLoading:$=!1,allowUnknown:j,inputName:et,onUpdate:tt,validate:rt,label:nt,keepValid:it,style:st,size:ot,hideBalance:at=!1})=>{const{register:ut,setValue:ht,formState:{defaultValues:yt},getValues:wt}=useFormContext(),Ct=ht,Pt=reactExports.useId(),[$t,Mt]=reactExports.useState(()=>{var vt;if(it||!yt)return"";const bt=lodashExports.get(yt,et);return bt?((vt=a.find(ct=>ct.pkh===bt))==null?void 0:vt.name)||bt:""}),[Lt,Dt]=reactExports.useState(!0),[zt,Ot]=reactExports.useState(getSuggestions("",a)),It=wt(et),Bt=bt=>{Mt(bt),Ot(getSuggestions(bt,a));const vt=a.find(dt=>dt.name===bt||dt.pkh===bt);let ct;if(vt!==void 0)ct=vt.pkh,Dt(!0);else if(j&&isAddressValid(bt))ct=bt;else{if(it)return;ct=""}Ct(et,ct,{shouldValidate:!0}),tt&&tt(ct)};let Ft="raw_input";$?Ft="selected_tile":_?Ft="disabled_tile":It&&(Ft="selected_tile");const jt=()=>{Bt(""),Dt(!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(It)}),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-${It}`,onClick:jt,paddingY:0,children:jsxRuntimeExports.jsxs(Center,{justifyContent:"space-between",cursor:"pointer","data-testid":"clear-selected-button",children:[jsxRuntimeExports.jsx(AddressTile,{width:ot==="short"?"338px":"365px",paddingTop:"8px",background:"transparent",address:parsePkh(It)}),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,{...st,"aria-label":et,autoComplete:"off",id:Pt,onBlur:bt=>{if(bt.preventDefault(),Dt(!0),it&&It!==bt.target.value)return Bt(It);Bt(bt.target.value)},onChange:bt=>Bt(bt.target.value),onFocus:()=>Dt(!1),placeholder:"Enter address or contact name",value:$t}),jsxRuntimeExports.jsx(InputRightElement,{children:$t?jsxRuntimeExports.jsx(CrossButton,{marginRight:"0px",onClick:jt}):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:at,onChange:Bt})]})},CrossButton=a=>jsxRuntimeExports.jsx(XMark,{marginRight:"16px",stroke:colors.gray[450],cursor:"pointer","data-testid":"clear-input-button",...a}),KnownAccountsAutocomplete=a=>{const _=useContactsForSelectedNetwork(),$=useAllAccounts().map(j=>({name:j.label,pkh:j.address.pkh}));return jsxRuntimeExports.jsx(AddressAutocomplete,{...a,contacts:_.concat($)})},OwnedImplicitAccountsAutocomplete=a=>{const _=useImplicitAccounts().map($=>({name:$.label,pkh:$.address.pkh}));return jsxRuntimeExports.jsx(AddressAutocomplete,{...a,contacts:_})},OwnedAccountsAutocomplete=a=>{const _=useAllAccounts().map($=>({name:$.label,pkh:$.address.pkh}));return jsxRuntimeExports.jsx(AddressAutocomplete,{...a,contacts:_})},BakersAutocomplete=a=>{const _=useBakerList().map($=>({name:$.name,pkh:$.address}));return jsxRuntimeExports.jsx(AddressAutocomplete,{...a,contacts:_,hideBalance:!0})},AvailableSignersAutocomplete=a=>{const $=useGetOwnedSignersForAccount()(a.account).map(j=>({name:j.label,pkh:j.address.pkh}));return jsxRuntimeExports.jsx(AddressAutocomplete,{allowUnknown:!1,contacts:$,isDisabled:$.length===1,...a})},getErrorContext=a=>{let _="Something went wrong";typeof a=="object"&&"message"in a?_=a.message:typeof a=="string"&&(_=a);let $="";return typeof a=="object"&&"stack"in a&&($=a.stack),{timestamp:new Date().toISOString(),description:_,stacktrace:$}},useAsyncActionHandler=()=>{const[a,_]=reactExports.useState(!1),$=reactExports.useRef(a),j=useToast(),et=useAppDispatch(),tt=reactExports.useCallback(async(nt,it)=>{if(!$.current){$.current=!0,_(!0);try{return await nt()}catch(st){const ot=getErrorContext(st);throw j({description:ot.description,status:"error",...typeof it=="function"?it(st):it}),et(errorsSlice.actions.add(ot)),st}finally{$.current=!1,_(!1)}}},[et,j]),rt=reactExports.useCallback(async(nt,it)=>tt(nt,it).catch(()=>{}),[tt]);return{isLoading:a,handleAsyncAction:rt,handleAsyncActionUnsafe:tt}},PermissionRequestModal=({request:a})=>{const _=useAddConnection(),$=useGetImplicitAccount(),{onClose:j}=reactExports.useContext(DynamicModalContext),{handleAsyncAction:et}=useAsyncActionHandler(),tt=useForm({mode:"onBlur"}),{getValues:rt,formState:{errors:nt,isValid:it}}=tt,st=useRemovePeerBySenderId(),ot=()=>{st(a.senderId),WalletClient.respond({id:a.id,type:BeaconMessageType.Error,errorType:BeaconErrorType.NOT_GRANTED_ERROR})},at=()=>et(async()=>{const ut=$(rt().address),ht={type:BeaconMessageType.PermissionResponse,network:a.network,scopes:a.scopes,id:a.id,publicKey:ut.pk,walletType:"implicit"};await WalletClient.respond(ht),_(a.senderId,ut.address.pkh,a.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:[a.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(a.network.type)})]})]}),jsxRuntimeExports.jsx(ModalCloseButton,{onClick:ot}),jsxRuntimeExports.jsxs(ModalBody,{"data-testid":"beacon-request-body",children:[jsxRuntimeExports.jsxs(Flex,{alignItems:"center",marginTop:"16px",padding:"15px",borderRadius:"4px",backgroundColor:colors.gray[800],children:[jsxRuntimeExports.jsx(AspectRatio,{width:"60px",marginRight:"12px",ratio:1,children:jsxRuntimeExports.jsx(Image$1,{borderRadius:"4px",src:a.appMetadata.icon})}),jsxRuntimeExports.jsx(Heading,{size:"sm",children:a.appMetadata.name})]}),jsxRuntimeExports.jsx(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:a})})]})}),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=a=>{let _=0;if(a.startsWith(PAYLOAD_PADDING)){for(_=4;_tt)throw new Error("Invalid payload length");_+=1}}return a.slice(_)},decodePayload$1=a=>{try{return new TextDecoder("utf-8").decode(hex2buf(getPayloadHexBytes(a)))||a}catch{return a}};function _typeof$3(a){"@babel/helpers - typeof";return _typeof$3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(_){return typeof _}:function(_){return _&&typeof Symbol=="function"&&_.constructor===Symbol&&_!==Symbol.prototype?"symbol":typeof _},_typeof$3(a)}function toPrimitive(a,_){if(_typeof$3(a)!="object"||!a)return a;var $=a[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(_==="string"?String:Number)(a)}function toPropertyKey(a){var _=toPrimitive(a,"string");return _typeof$3(_)=="symbol"?_:_+""}function _defineProperty$4(a,_,$){return _=toPropertyKey(_),_ in a?Object.defineProperty(a,_,{value:$,enumerable:!0,configurable:!0,writable:!0}):a[_]=$,a}var lodash_merge={exports:{}};lodash_merge.exports;(function(a,_){var $=200,j="__lodash_hash_undefined__",et=800,tt=16,rt=9007199254740991,nt="[object Arguments]",it="[object Array]",st="[object AsyncFunction]",ot="[object Boolean]",at="[object Date]",ut="[object Error]",ht="[object Function]",yt="[object GeneratorFunction]",wt="[object Map]",Ct="[object Number]",Pt="[object Null]",$t="[object Object]",Mt="[object Proxy]",Lt="[object RegExp]",Dt="[object Set]",zt="[object String]",Ot="[object Undefined]",It="[object WeakMap]",Bt="[object ArrayBuffer]",Ft="[object DataView]",jt="[object Float32Array]",bt="[object Float64Array]",vt="[object Int8Array]",ct="[object Int16Array]",dt="[object Int32Array]",mt="[object Uint8Array]",xt="[object Uint8ClampedArray]",At="[object Uint16Array]",Rt="[object Uint32Array]",St=/[\\^$.*+?()[\]{}|]/g,Tt=/^\[object .+?Constructor\]$/,Et=/^(?:0|[1-9]\d*)$/,Nt={};Nt[jt]=Nt[bt]=Nt[vt]=Nt[ct]=Nt[dt]=Nt[mt]=Nt[xt]=Nt[At]=Nt[Rt]=!0,Nt[nt]=Nt[it]=Nt[Bt]=Nt[ot]=Nt[Ft]=Nt[at]=Nt[ut]=Nt[ht]=Nt[wt]=Nt[Ct]=Nt[$t]=Nt[Lt]=Nt[Dt]=Nt[zt]=Nt[It]=!1;var tr=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,ir=typeof self=="object"&&self&&self.Object===Object&&self,nr=tr||ir||Function("return this")(),Zt=_&&!_.nodeType&&_,Kt=Zt&&!0&&a&&!a.nodeType&&a,Qt=Kt&&Kt.exports===Zt,Ht=Qt&&tr.process,qt=function(){try{var Xt=Kt&&Kt.require&&Kt.require("util").types;return Xt||Ht&&Ht.binding&&Ht.binding("util")}catch{}}(),Jt=qt&&qt.isTypedArray;function ur(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=Rn,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,Tn=rn>2?gr[2]:void 0;for(xn=Xt.length>3&&typeof xn=="function"?(rn--,xn):void 0,Tn&&Yl(gr[0],gr[1],Tn)&&(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 $l(Xt){if(Xt!=null){try{return kr.call(Xt)}catch{}try{return Xt+""}catch{}}return""}function Xs(Xt,cr){return Xt===cr||Xt!==Xt&&cr!==cr}var Ao=es(function(){return arguments}())?es:function(Xt){return Is(Xt)&&Ar.call(Xt,"callee")&&!ar.call(Xt,"callee")},Ls=Array.isArray;function uo(Xt){return Xt!=null&&To(Xt.length)&&!$o(Xt)}function Tl(Xt){return Is(Xt)&&uo(Xt)}var fo=Wr||wr;function $o(Xt){if(!Ps(Xt))return!1;var cr=Qn(Xt);return cr==ht||cr==yt||cr==st||cr==Mt}function To(Xt){return typeof Xt=="number"&&Xt>-1&&Xt%1==0&&Xt<=rt}function Ps(Xt){var cr=typeof Xt;return Xt!=null&&(cr=="object"||cr=="function")}function Is(Xt){return Xt!=null&&typeof Xt=="object"}function Pl(Xt){if(!Is(Xt)||Qn(Xt)!=$t)return!1;var cr=Vt(Xt);if(cr===null)return!0;var gr=Ar.call(cr,"constructor")&&cr.constructor;return typeof gr=="function"&&gr instanceof gr&&kr.call(gr)==Lr}var No=Jt?pr(Jt):us;function Po(Xt){return wo(Xt,Bo(Xt))}function Bo(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 wr(){return!1}a.exports=Xl})(lodash_merge,lodash_merge.exports);var lodash_mergeExports=lodash_merge.exports;const deepmerge$1=getDefaultExportFromCjs$1(lodash_mergeExports);var loglevel={exports:{}};(function(a){(function(_,$){a.exports?a.exports=$():_.log=$()})(commonjsGlobal,function(){var _=function(){},$="undefined",j=typeof window!==$&&typeof window.navigator!==$&&/Trident\/|MSIE /.test(window.navigator.userAgent),et=["trace","debug","info","warn","error"];function tt(wt,Ct){var Pt=wt[Ct];if(typeof Pt.bind=="function")return Pt.bind(wt);try{return Function.prototype.bind.call(Pt,wt)}catch{return function(){return Function.prototype.apply.apply(Pt,[wt,arguments])}}}function rt(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function nt(wt){return wt==="debug"&&(wt="log"),typeof console===$?!1:wt==="trace"&&j?rt:console[wt]!==void 0?tt(console,wt):console.log!==void 0?tt(console,"log"):_}function it(wt,Ct){for(var Pt=0;Pt=0&&Bt<=$t.levels.SILENT){if(Mt=Bt,Ft!==!1&&Dt(Bt),it.call($t,Bt,wt),typeof console===$&&Bt<$t.levels.SILENT)return"No console available for logging"}else throw"log.setLevel() called with invalid level: "+Bt},$t.setDefaultLevel=function(Bt){Ct=Bt,zt()||$t.setLevel(Bt,!1)},$t.resetLevel=function(){$t.setLevel(Ct,!1),Ot()},$t.enableAll=function(Bt){$t.setLevel($t.levels.TRACE,Bt)},$t.disableAll=function(Bt){$t.setLevel($t.levels.SILENT,Bt)};var It=zt();It==null&&(It=Ct),$t.setLevel(It,!1)}var ut=new at,ht={};ut.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=ht[Ct];return Pt||(Pt=ht[Ct]=new at(Ct,ut.getLevel(),ut.methodFactory)),Pt};var yt=typeof window!==$?window.log:void 0;return ut.noConflict=function(){return typeof window!==$&&window.log===ut&&(window.log=yt),ut},ut.getLoggers=function(){return ht},ut.default=ut,ut})})(loglevel);var loglevelExports=loglevel.exports;const log$1$1=getDefaultExportFromCjs$1(loglevelExports);function ownKeys$5(a,_){var $=Object.keys(a);if(Object.getOwnPropertySymbols){var j=Object.getOwnPropertySymbols(a);_&&(j=j.filter(function(et){return Object.getOwnPropertyDescriptor(a,et).enumerable})),$.push.apply($,j)}return $}function _objectSpread$5(a){for(var _=1;_{const $=new Promise((j,et)=>{const tt=setTimeout(()=>{clearTimeout(tt),et(new Error(`Timed out in ${a}ms`))},a)});return Promise.race([_,$])},get=async function(a){let _=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=_objectSpread$5(_objectSpread$5({},j.headers),getApiKeyHeaders()));const et=deepmerge$1(j,_,{method:"GET"}),tt=await fetchAndTrace(a,et);if(tt.ok)return tt.json();throw debugLogResponse(tt),tt},post=function(a){let _=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=_objectSpread$5(_objectSpread$5({},et.headers),getApiKeyHeaders()));const tt=deepmerge$1(et,$,{method:"POST"});return j.isUrlEncodedData?(tt.body=_,tt.headers["Content-Type"]==="application/json; charset=utf-8"&&delete tt.headers["Content-Type"]):tt.body=JSON.stringify(_),promiseTimeout(j.timeout||6e4,fetchAndTrace(a,tt).then(rt=>{if(j.logTracingHeader&&logTracingHeader(rt),rt.ok)return rt.json();throw debugLogResponse(rt),rt}))},generateJsonRPCObject=(a,_)=>({jsonrpc:"2.0",method:a,id:10,params:_});function _objectWithoutPropertiesLoose(a,_){if(a==null)return{};var $={};for(var j in a)if(Object.prototype.hasOwnProperty.call(a,j)){if(_.indexOf(j)>=0)continue;$[j]=a[j]}return $}function _objectWithoutProperties(a,_){if(a==null)return{};var $=_objectWithoutPropertiesLoose(a,_),j,et;if(Object.getOwnPropertySymbols){var tt=Object.getOwnPropertySymbols(a);for(et=0;et=0)&&Object.prototype.propertyIsEnumerable.call(a,j)&&($[j]=a[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(_,$){const j=$.match(_);return j&&j.length>0&&j[1]||""}static getSecondMatch(_,$){const j=$.match(_);return j&&j.length>1&&j[2]||""}static matchAndReturnConst(_,$,j){if(_.test($))return j}static getWindowsVersionName(_){switch(_){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(_){const $=_.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(_){const $=_.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(_){return _.split(".").length}static compareVersions(_,$,j=!1){const et=Utils.getVersionPrecision(_),tt=Utils.getVersionPrecision($);let rt=Math.max(et,tt),nt=0;const it=Utils.map([_,$],st=>{const ot=rt-Utils.getVersionPrecision(st),at=st+new Array(ot+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 _}static getBrowserAlias(_){return BROWSER_ALIASES_MAP[_]}static getBrowserTypeByAlias(_){return BROWSER_MAP[_]||""}}const commonVersionIdentifier=/version\/(\d+(\.?_?\d+)+)/i,browsersList=[{test:[/googlebot/i],describe(a){const _={name:"Googlebot"},$=Utils.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,a)||Utils.getFirstMatch(commonVersionIdentifier,a);return $&&(_.version=$),_}},{test:[/opera/i],describe(a){const _={name:"Opera"},$=Utils.getFirstMatch(commonVersionIdentifier,a)||Utils.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,a);return $&&(_.version=$),_}},{test:[/opr\/|opios/i],describe(a){const _={name:"Opera"},$=Utils.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,a)||Utils.getFirstMatch(commonVersionIdentifier,a);return $&&(_.version=$),_}},{test:[/SamsungBrowser/i],describe(a){const _={name:"Samsung Internet for Android"},$=Utils.getFirstMatch(commonVersionIdentifier,a)||Utils.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,a);return $&&(_.version=$),_}},{test:[/Whale/i],describe(a){const _={name:"NAVER Whale Browser"},$=Utils.getFirstMatch(commonVersionIdentifier,a)||Utils.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,a);return $&&(_.version=$),_}},{test:[/MZBrowser/i],describe(a){const _={name:"MZ Browser"},$=Utils.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,a)||Utils.getFirstMatch(commonVersionIdentifier,a);return $&&(_.version=$),_}},{test:[/focus/i],describe(a){const _={name:"Focus"},$=Utils.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,a)||Utils.getFirstMatch(commonVersionIdentifier,a);return $&&(_.version=$),_}},{test:[/swing/i],describe(a){const _={name:"Swing"},$=Utils.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,a)||Utils.getFirstMatch(commonVersionIdentifier,a);return $&&(_.version=$),_}},{test:[/coast/i],describe(a){const _={name:"Opera Coast"},$=Utils.getFirstMatch(commonVersionIdentifier,a)||Utils.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,a);return $&&(_.version=$),_}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(a){const _={name:"Opera Touch"},$=Utils.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,a)||Utils.getFirstMatch(commonVersionIdentifier,a);return $&&(_.version=$),_}},{test:[/yabrowser/i],describe(a){const _={name:"Yandex Browser"},$=Utils.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,a)||Utils.getFirstMatch(commonVersionIdentifier,a);return $&&(_.version=$),_}},{test:[/ucbrowser/i],describe(a){const _={name:"UC Browser"},$=Utils.getFirstMatch(commonVersionIdentifier,a)||Utils.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,a);return $&&(_.version=$),_}},{test:[/Maxthon|mxios/i],describe(a){const _={name:"Maxthon"},$=Utils.getFirstMatch(commonVersionIdentifier,a)||Utils.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,a);return $&&(_.version=$),_}},{test:[/epiphany/i],describe(a){const _={name:"Epiphany"},$=Utils.getFirstMatch(commonVersionIdentifier,a)||Utils.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,a);return $&&(_.version=$),_}},{test:[/puffin/i],describe(a){const _={name:"Puffin"},$=Utils.getFirstMatch(commonVersionIdentifier,a)||Utils.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,a);return $&&(_.version=$),_}},{test:[/sleipnir/i],describe(a){const _={name:"Sleipnir"},$=Utils.getFirstMatch(commonVersionIdentifier,a)||Utils.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,a);return $&&(_.version=$),_}},{test:[/k-meleon/i],describe(a){const _={name:"K-Meleon"},$=Utils.getFirstMatch(commonVersionIdentifier,a)||Utils.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,a);return $&&(_.version=$),_}},{test:[/micromessenger/i],describe(a){const _={name:"WeChat"},$=Utils.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,a)||Utils.getFirstMatch(commonVersionIdentifier,a);return $&&(_.version=$),_}},{test:[/qqbrowser/i],describe(a){const _={name:/qqbrowserlite/i.test(a)?"QQ Browser Lite":"QQ Browser"},$=Utils.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,a)||Utils.getFirstMatch(commonVersionIdentifier,a);return $&&(_.version=$),_}},{test:[/msie|trident/i],describe(a){const _={name:"Internet Explorer"},$=Utils.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,a);return $&&(_.version=$),_}},{test:[/\sedg\//i],describe(a){const _={name:"Microsoft Edge"},$=Utils.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,a);return $&&(_.version=$),_}},{test:[/edg([ea]|ios)/i],describe(a){const _={name:"Microsoft Edge"},$=Utils.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,a);return $&&(_.version=$),_}},{test:[/vivaldi/i],describe(a){const _={name:"Vivaldi"},$=Utils.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,a);return $&&(_.version=$),_}},{test:[/seamonkey/i],describe(a){const _={name:"SeaMonkey"},$=Utils.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,a);return $&&(_.version=$),_}},{test:[/sailfish/i],describe(a){const _={name:"Sailfish"},$=Utils.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,a);return $&&(_.version=$),_}},{test:[/silk/i],describe(a){const _={name:"Amazon Silk"},$=Utils.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,a);return $&&(_.version=$),_}},{test:[/phantom/i],describe(a){const _={name:"PhantomJS"},$=Utils.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,a);return $&&(_.version=$),_}},{test:[/slimerjs/i],describe(a){const _={name:"SlimerJS"},$=Utils.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,a);return $&&(_.version=$),_}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(a){const _={name:"BlackBerry"},$=Utils.getFirstMatch(commonVersionIdentifier,a)||Utils.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,a);return $&&(_.version=$),_}},{test:[/(web|hpw)[o0]s/i],describe(a){const _={name:"WebOS Browser"},$=Utils.getFirstMatch(commonVersionIdentifier,a)||Utils.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,a);return $&&(_.version=$),_}},{test:[/bada/i],describe(a){const _={name:"Bada"},$=Utils.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,a);return $&&(_.version=$),_}},{test:[/tizen/i],describe(a){const _={name:"Tizen"},$=Utils.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,a)||Utils.getFirstMatch(commonVersionIdentifier,a);return $&&(_.version=$),_}},{test:[/qupzilla/i],describe(a){const _={name:"QupZilla"},$=Utils.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,a)||Utils.getFirstMatch(commonVersionIdentifier,a);return $&&(_.version=$),_}},{test:[/firefox|iceweasel|fxios/i],describe(a){const _={name:"Firefox"},$=Utils.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,a);return $&&(_.version=$),_}},{test:[/electron/i],describe(a){const _={name:"Electron"},$=Utils.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,a);return $&&(_.version=$),_}},{test:[/MiuiBrowser/i],describe(a){const _={name:"Miui"},$=Utils.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,a);return $&&(_.version=$),_}},{test:[/chromium/i],describe(a){const _={name:"Chromium"},$=Utils.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,a)||Utils.getFirstMatch(commonVersionIdentifier,a);return $&&(_.version=$),_}},{test:[/chrome|crios|crmo/i],describe(a){const _={name:"Chrome"},$=Utils.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,a);return $&&(_.version=$),_}},{test:[/GSA/i],describe(a){const _={name:"Google Search"},$=Utils.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,a);return $&&(_.version=$),_}},{test(a){const _=!a.test(/like android/i),$=a.test(/android/i);return _&&$},describe(a){const _={name:"Android Browser"},$=Utils.getFirstMatch(commonVersionIdentifier,a);return $&&(_.version=$),_}},{test:[/playstation 4/i],describe(a){const _={name:"PlayStation 4"},$=Utils.getFirstMatch(commonVersionIdentifier,a);return $&&(_.version=$),_}},{test:[/safari|applewebkit/i],describe(a){const _={name:"Safari"},$=Utils.getFirstMatch(commonVersionIdentifier,a);return $&&(_.version=$),_}},{test:[/.*/i],describe(a){const _=/^(.*)\/(.*) /,$=/^(.*)\/(.*)[ \t]\((.*)/,et=a.search("\\(")!==-1?$:_;return{name:Utils.getFirstMatch(et,a),version:Utils.getSecondMatch(et,a)}}}],osParsersList=[{test:[/Roku\/DVP/],describe(a){const _=Utils.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,a);return{name:OS_MAP.Roku,version:_}}},{test:[/windows phone/i],describe(a){const _=Utils.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,a);return{name:OS_MAP.WindowsPhone,version:_}}},{test:[/windows /i],describe(a){const _=Utils.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,a),$=Utils.getWindowsVersionName(_);return{name:OS_MAP.Windows,version:_,versionName:$}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(a){const _={name:OS_MAP.iOS},$=Utils.getSecondMatch(/(Version\/)(\d[\d.]+)/,a);return $&&(_.version=$),_}},{test:[/macintosh/i],describe(a){const _=Utils.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,a).replace(/[_\s]/g,"."),$=Utils.getMacOSVersionName(_),j={name:OS_MAP.MacOS,version:_};return $&&(j.versionName=$),j}},{test:[/(ipod|iphone|ipad)/i],describe(a){const _=Utils.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,a).replace(/[_\s]/g,".");return{name:OS_MAP.iOS,version:_}}},{test(a){const _=!a.test(/like android/i),$=a.test(/android/i);return _&&$},describe(a){const _=Utils.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,a),$=Utils.getAndroidVersionName(_),j={name:OS_MAP.Android,version:_};return $&&(j.versionName=$),j}},{test:[/(web|hpw)[o0]s/i],describe(a){const _=Utils.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,a),$={name:OS_MAP.WebOS};return _&&_.length&&($.version=_),$}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(a){const _=Utils.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,a)||Utils.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,a)||Utils.getFirstMatch(/\bbb(\d+)/i,a);return{name:OS_MAP.BlackBerry,version:_}}},{test:[/bada/i],describe(a){const _=Utils.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,a);return{name:OS_MAP.Bada,version:_}}},{test:[/tizen/i],describe(a){const _=Utils.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,a);return{name:OS_MAP.Tizen,version:_}}},{test:[/linux/i],describe(){return{name:OS_MAP.Linux}}},{test:[/CrOS/],describe(){return{name:OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe(a){const _=Utils.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,a);return{name:OS_MAP.PlayStation4,version:_}}}],platformParsersList=[{test:[/googlebot/i],describe(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe(a){const _=Utils.getFirstMatch(/(can-l01)/i,a)&&"Nova",$={type:PLATFORMS_MAP.mobile,vendor:"Huawei"};return _&&($.model=_),$}},{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(a){const _=a.test(/ipod|iphone/i),$=a.test(/like (ipod|iphone)/i);return _&&!$},describe(a){const _=Utils.getFirstMatch(/(ipod|iphone)/i,a);return{type:PLATFORMS_MAP.mobile,vendor:"Apple",model:_}}},{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(a){return a.getBrowserName(!0)==="blackberry"},describe(){return{type:PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test(a){return a.getBrowserName(!0)==="bada"},describe(){return{type:PLATFORMS_MAP.mobile}}},{test(a){return a.getBrowserName()==="windows phone"},describe(){return{type:PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test(a){const _=Number(String(a.getOSVersion()).split(".")[0]);return a.getOSName(!0)==="android"&&_>=3},describe(){return{type:PLATFORMS_MAP.tablet}}},{test(a){return a.getOSName(!0)==="android"},describe(){return{type:PLATFORMS_MAP.mobile}}},{test(a){return a.getOSName(!0)==="macos"},describe(){return{type:PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test(a){return a.getOSName(!0)==="windows"},describe(){return{type:PLATFORMS_MAP.desktop}}},{test(a){return a.getOSName(!0)==="linux"},describe(){return{type:PLATFORMS_MAP.desktop}}},{test(a){return a.getOSName(!0)==="playstation 4"},describe(){return{type:PLATFORMS_MAP.tv}}},{test(a){return a.getOSName(!0)==="roku"},describe(){return{type:PLATFORMS_MAP.tv}}}],enginesParsersList=[{test(a){return a.getBrowserName(!0)==="microsoft edge"},describe(a){if(/\sedg\//i.test(a))return{name:ENGINE_MAP.Blink};const $=Utils.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,a);return{name:ENGINE_MAP.EdgeHTML,version:$}}},{test:[/trident/i],describe(a){const _={name:ENGINE_MAP.Trident},$=Utils.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,a);return $&&(_.version=$),_}},{test(a){return a.test(/presto/i)},describe(a){const _={name:ENGINE_MAP.Presto},$=Utils.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,a);return $&&(_.version=$),_}},{test(a){const _=a.test(/gecko/i),$=a.test(/like gecko/i);return _&&!$},describe(a){const _={name:ENGINE_MAP.Gecko},$=Utils.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,a);return $&&(_.version=$),_}},{test:[/(apple)?webkit\/537\.36/i],describe(){return{name:ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe(a){const _={name:ENGINE_MAP.WebKit},$=Utils.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,a);return $&&(_.version=$),_}}];class Parser{constructor(_,$=!1){if(_==null||_==="")throw new Error("UserAgent parameter can't be empty");this._ua=_,this.parsedResult={},$!==!0&&this.parse()}getUA(){return this._ua}test(_){return _.test(this._ua)}parseBrowser(){this.parsedResult.browser={};const _=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 _&&(this.parsedResult.browser=_.describe(this.getUA())),this.parsedResult.browser}getBrowser(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()}getBrowserName(_){return _?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 _=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 _&&(this.parsedResult.os=_.describe(this.getUA())),this.parsedResult.os}getOSName(_){const{name:$}=this.getOS();return _?String($).toLowerCase()||"":$||""}getOSVersion(){return this.getOS().version}getPlatform(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()}getPlatformType(_=!1){const{type:$}=this.getPlatform();return _?String($).toLowerCase()||"":$||""}parsePlatform(){this.parsedResult.platform={};const _=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 _&&(this.parsedResult.platform=_.describe(this.getUA())),this.parsedResult.platform}getEngine(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()}getEngineName(_){return _?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""}parseEngine(){this.parsedResult.engine={};const _=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 _&&(this.parsedResult.engine=_.describe(this.getUA())),this.parsedResult.engine}parse(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this}getResult(){return Utils.assign({},this.parsedResult)}satisfies(_){const $={};let j=0;const et={};let tt=0;if(Object.keys(_).forEach(nt=>{const it=_[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,ot=>this.isOS(ot));if(it){const ot=this.satisfies($[it]);if(ot!==void 0)return ot}const st=Utils.find(nt,ot=>this.isPlatform(ot));if(st){const ot=this.satisfies($[st]);if(ot!==void 0)return ot}}if(tt>0){const nt=Object.keys(et),it=Utils.find(nt,st=>this.isBrowser(st,!0));if(it!==void 0)return this.compareVersion(et[it])}}isBrowser(_,$=!1){const j=this.getBrowserName().toLowerCase();let et=_.toLowerCase();const tt=Utils.getBrowserTypeByAlias(et);return $&&tt&&(et=tt.toLowerCase()),et===j}compareVersion(_){let $=[0],j=_,et=!1;const tt=this.getBrowserVersion();if(typeof tt=="string")return _[0]===">"||_[0]==="<"?(j=_.substr(1),_[1]==="="?(et=!0,j=_.substr(2)):$=[],_[0]===">"?$.push(1):$.push(-1)):_[0]==="="?j=_.substr(1):_[0]==="~"&&(et=!0,j=_.substr(1)),$.indexOf(Utils.compareVersions(tt,j,et))>-1}isOS(_){return this.getOSName(!0)===String(_).toLowerCase()}isPlatform(_){return this.getPlatformType(!0)===String(_).toLowerCase()}isEngine(_){return this.getEngineName(!0)===String(_).toLowerCase()}is(_,$=!1){return this.isBrowser(_,$)||this.isOS(_)||this.isPlatform(_)}some(_=[]){return _.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(_,$=!1){if(typeof _!="string")throw new Error("UserAgent should be a string");return new Parser(_,$)}static parse(_){return new Parser(_).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(a){return!!(a&&typeof a.then=="function")}Promise.resolve(!1);Promise.resolve(!0);var PROMISE_RESOLVED_VOID=Promise.resolve();function sleep(a,_){return a||(a=0),new Promise(function($){return setTimeout(function(){return $(_)},a)})}function randomInt(a,_){return Math.floor(Math.random()*(_-a+1)+a)}function randomToken(){return Math.random().toString(36).substring(2)}var lastMs=0,additional=0;function microSeconds$5(){var a=new Date().getTime();return a===lastMs?(additional++,a*1e3+additional):(lastMs=a,additional=0,a*1e3)}function are3PCSupported$1(){if(typeof navigator>"u")return!1;var a=Bowser.parse(navigator.userAgent);log$4.info(JSON.stringify(a),"current browser info");var _=!0;return navigator.brave&&(_=!1),(a.engine.name===Bowser.ENGINE_MAP.WebKit||a.engine.name===Bowser.ENGINE_MAP.Gecko)&&(_=!1),_}var log$4=log$1$1.getLogger("broadcast-channel");log$4.setLevel("error");var microSeconds$4=microSeconds$5,type$4="native";function create$4(a){var _={messagesCallback:null,bc:new BroadcastChannel(a),subFns:[]};return _.bc.onmessage=function($){_.messagesCallback&&_.messagesCallback($.data)},_}function close$4(a){a.bc.close(),a.subFns=[]}function postMessage$4(a,_){try{return a.bc.postMessage(_,!1),PROMISE_RESOLVED_VOID}catch($){return Promise.reject($)}}function onMessage$4(a,_){a.messagesCallback=_}function canBeUsed$4(a){if(typeof window>"u"||!a.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=_,this.map=new Map,this._to=!1}return a.prototype.has=function(_){return this.map.has(_)},a.prototype.add=function(_){var $=this;this.map.set(_,now()),this._to||(this._to=!0,setTimeout(function(){$._to=!1,removeTooOldValues($)},0))},a.prototype.clear=function(){this.map.clear()},a}();function removeTooOldValues(a){for(var _=now()-a.ttl,$=a.map[Symbol.iterator]();;){var j=$.next().value;if(!j)return;var et=j[0],tt=j[1];if(tt<_)a.map.delete(et);else return}}function now(){return new Date().getTime()}function fillOptionsWithDefaults(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},_=JSON.parse(JSON.stringify(a));return typeof _.support3PC>"u"&&(_.support3PC=are3PCSupported$1()),typeof _.webWorkerSupport>"u"&&(_.webWorkerSupport=!0),_.idb||(_.idb={}),_.idb.ttl||(_.idb.ttl=1e3*45),_.idb.fallbackInterval||(_.idb.fallbackInterval=150),a.idb&&typeof a.idb.onclose=="function"&&(_.idb.onclose=a.idb.onclose),_.localstorage||(_.localstorage={}),_.localstorage.removeTimeout||(_.localstorage.removeTimeout=1e3*60),_.server||(_.server={}),_.server.url||(_.server.url="https://broadcast-server.tor.us"),_.server.removeTimeout||(_.server.removeTimeout=1e3*60*5),a.methods&&(_.methods=a.methods),_}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(a){a.commit&&a.commit()}function createDatabase(a){var _=getIdb(),$=DB_PREFIX+a,j=_.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:_,time:j,data:$},tt=a.transaction([OBJECT_STORE_ID],"readwrite",TRANSACTION_SETTINGS);return new Promise(function(rt,nt){tt.oncomplete=function(){return rt()},tt.onerror=function(st){return nt(st)};var it=tt.objectStore(OBJECT_STORE_ID);it.add(et),commitIndexedDBTransaction(tt)})}function getMessagesHigherThan(a,_){var $=a.transaction(OBJECT_STORE_ID,"readonly",TRANSACTION_SETTINGS),j=$.objectStore(OBJECT_STORE_ID),et=[],tt=IDBKeyRange.bound(_+1,1/0);if(j.getAll){var rt=j.getAll(tt);return new Promise(function(it,st){rt.onerror=function(ot){return st(ot)},rt.onsuccess=function(ot){it(ot.target.result)}})}function nt(){try{return tt=IDBKeyRange.bound(_+1,1/0),j.openCursor(tt)}catch{return j.openCursor()}}return new Promise(function(it,st){var ot=nt();ot.onerror=function(at){return st(at)},ot.onsuccess=function(at){var ut=at.target.result;ut?ut.value.id<_+1?ut.continue(_+1):(et.push(ut.value),ut.continue()):(commitIndexedDBTransaction($),it(et))}})}function removeMessagesById(a,_){var $=a.transaction([OBJECT_STORE_ID],"readwrite",TRANSACTION_SETTINGS),j=$.objectStore(OBJECT_STORE_ID);return Promise.all(_.map(function(et){var tt=j.delete(et);return new Promise(function(rt){tt.onsuccess=function(){return rt()}})}))}function getOldMessages(a,_){var $=new Date().getTime()-_,j=a.transaction(OBJECT_STORE_ID,"readonly",TRANSACTION_SETTINGS),et=j.objectStore(OBJECT_STORE_ID),tt=[];return new Promise(function(rt){et.openCursor().onsuccess=function(nt){var it=nt.target.result;if(it){var st=it.value;if(st.time<$)tt.push(st),it.continue();else{commitIndexedDBTransaction(j),rt(tt);return}}else rt(tt)}})}function cleanOldMessages(a,_){return getOldMessages(a,_).then(function($){return removeMessagesById(a,$.map(function(j){return j.id}))})}function create$3(a,_){return _=fillOptionsWithDefaults(_),createDatabase(a).then(function($){var j={closed:!1,lastCursorId:0,channelName:a,options:_,uuid:randomToken(),eMIs:new ObliviousSet(_.idb.ttl*2),writeBlockPromise:PROMISE_RESOLVED_VOID,messagesCallback:null,readQueuePromises:[],db:$};return $.onclose=function(){j.closed=!0,_.idb.onclose&&_.idb.onclose()},_readLoop(j),j})}function _readLoop(a){a.closed||readNewMessages(a).then(function(){return sleep(a.options.idb.fallbackInterval)}).then(function(){return _readLoop(a)})}function _filterMessage(a,_){return!(a.uuid===_.uuid||_.eMIs.has(a.id)||a.data.time<_.messagesCallbackTime)}function readNewMessages(a){return a.closed||!a.messagesCallback?PROMISE_RESOLVED_VOID:getMessagesHigherThan(a.db,a.lastCursorId).then(function(_){var $=_.filter(function(j){return!!j}).map(function(j){return j.id>a.lastCursorId&&(a.lastCursorId=j.id),j}).filter(function(j){return _filterMessage(j,a)}).sort(function(j,et){return j.time-et.time});return $.forEach(function(j){a.messagesCallback&&(a.eMIs.add(j.id),a.messagesCallback(j.data))}),PROMISE_RESOLVED_VOID})}function close$3(a){a.closed=!0,a.db.close()}function postMessage$3(a,_){return a.writeBlockPromise=a.writeBlockPromise.then(function(){return writeMessage(a.db,a.uuid,_)}).then(function(){randomInt(0,10)===0&&cleanOldMessages(a.db,a.options.idb.ttl)}),a.writeBlockPromise}function onMessage$3(a,_,$){a.messagesCallbackTime=$,a.messagesCallback=_,readNewMessages(a)}function canBeUsed$3(a){if(!a.support3PC)return!1;var _=getIdb();return!!_}function averageResponseTime$3(a){return a.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 a;if(typeof window>"u")return null;try{a=window.localStorage,a=window["ie8-eventlistener/storage"]||window.localStorage}catch{}return a}function storageKey$1(a){return KEY_PREFIX$1+a}function postMessage$2(a,_){return new Promise(function($){sleep().then(function(){var j=storageKey$1(a.channelName),et={token:randomToken(),time:new Date().getTime(),data:_,uuid:a.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(a),j=function(tt){tt.key===$&&_(JSON.parse(tt.newValue))};return window.addEventListener("storage",j),j}function removeStorageEventListener(a){window.removeEventListener("storage",a)}function create$2(a,_){if(_=fillOptionsWithDefaults(_),!canBeUsed$2(_))throw new Error("BroadcastChannel: localstorage cannot be used");var $=randomToken(),j=new ObliviousSet(_.localstorage.removeTimeout),et={channelName:a,uuid:$,eMIs:j};return et.listener=addStorageEventListener(a,function(tt){et.messagesCallback&&tt.uuid!==$&&(!tt.token||j.has(tt.token)||tt.data.time&&tt.data.time=0;--At){var Rt=this.tryEntries[At],St=Rt.completion;if(Rt.tryLoc==="root")return xt("end");if(Rt.tryLoc<=this.prev){var Tt=tt.call(Rt,"catchLoc"),Et=tt.call(Rt,"finallyLoc");if(Tt&&Et){if(this.prev=0;--xt){var At=this.tryEntries[xt];if(At.tryLoc<=this.prev&&tt.call(At,"finallyLoc")&&this.prev=0;--mt){var xt=this.tryEntries[mt];if(xt.finallyLoc===dt)return this.complete(xt.completion,xt.afterLoc),jt(xt),yt}},catch:function(dt){for(var mt=this.tryEntries.length-1;mt>=0;--mt){var xt=this.tryEntries[mt];if(xt.tryLoc===dt){var At=xt.completion;if(At.type==="throw"){var Rt=At.arg;jt(xt)}return Rt}}throw new Error("illegal catch attempt")},delegateYield:function(dt,mt,xt){return this.delegate={iterator:vt(dt),resultName:mt,nextLoc:xt},this.method==="next"&&(this.arg=void 0),yt}},j}a.exports=$,a.exports.__esModule=!0,a.exports.default=a.exports})(regeneratorRuntime$1);var regeneratorRuntimeExports=regeneratorRuntime$1.exports,runtime=regeneratorRuntimeExports(),regenerator=runtime;try{regeneratorRuntime=runtime}catch(a){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(a=>{PACKET_TYPES_REVERSE[PACKET_TYPES[a]]=a});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=a=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(a):a&&a.buffer instanceof ArrayBuffer,encodePacket=({type:a,data:_},$,j)=>withNativeBlob$1&&_ instanceof Blob?$?j(_):encodeBlobAsBase64(_,j):withNativeArrayBuffer$2&&(_ instanceof ArrayBuffer||isView$1(_))?$?j(_):encodeBlobAsBase64(new Blob([_]),j):j(PACKET_TYPES[a]+(_||"")),encodeBlobAsBase64=(a,_)=>{const $=new FileReader;return $.onload=function(){const j=$.result.split(",")[1];_("b"+(j||""))},$.readAsDataURL(a)};function toArray(a){return a instanceof Uint8Array?a:a instanceof ArrayBuffer?new Uint8Array(a):new Uint8Array(a.buffer,a.byteOffset,a.byteLength)}let TEXT_ENCODER;function encodePacketToBinary(a,_){if(withNativeBlob$1&&a.data instanceof Blob)return a.data.arrayBuffer().then(toArray).then(_);if(withNativeArrayBuffer$2&&(a.data instanceof ArrayBuffer||isView$1(a.data)))return _(toArray(a.data));encodePacket(a,!1,$=>{TEXT_ENCODER||(TEXT_ENCODER=new TextEncoder),_(TEXT_ENCODER.encode($))})}const chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",lookup$1=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let a=0;a{let _=a.length*.75,$=a.length,j,et=0,tt,rt,nt,it;a[a.length-1]==="="&&(_--,a[a.length-2]==="="&&_--);const st=new ArrayBuffer(_),ot=new Uint8Array(st);for(j=0;j<$;j+=4)tt=lookup$1[a.charCodeAt(j)],rt=lookup$1[a.charCodeAt(j+1)],nt=lookup$1[a.charCodeAt(j+2)],it=lookup$1[a.charCodeAt(j+3)],ot[et++]=tt<<2|rt>>4,ot[et++]=(rt&15)<<4|nt>>2,ot[et++]=(nt&3)<<6|it&63;return st},withNativeArrayBuffer$1=typeof ArrayBuffer=="function",decodePacket=(a,_)=>{if(typeof a!="string")return{type:"message",data:mapBinary(a,_)};const $=a.charAt(0);return $==="b"?{type:"message",data:decodeBase64Packet(a.substring(1),_)}:PACKET_TYPES_REVERSE[$]?a.length>1?{type:PACKET_TYPES_REVERSE[$],data:a.substring(1)}:{type:PACKET_TYPES_REVERSE[$]}:ERROR_PACKET},decodeBase64Packet=(a,_)=>{if(withNativeArrayBuffer$1){const $=decode$2(a);return mapBinary($,_)}else return{base64:!0,data:a}},mapBinary=(a,_)=>{switch(_){case"blob":return a instanceof Blob?a:new Blob([a]);case"arraybuffer":default:return a instanceof ArrayBuffer?a:a.buffer}},SEPARATOR="",encodePayload=(a,_)=>{const $=a.length,j=new Array($);let et=0;a.forEach((tt,rt)=>{encodePacket(tt,!1,nt=>{j[rt]=nt,++et===$&&_(j.join(SEPARATOR))})})},decodePayload=(a,_)=>{const $=a.split(SEPARATOR),j=[];for(let et=0;et<$.length;et++){const tt=decodePacket($[et],_);if(j.push(tt),tt.type==="error")break}return j};let TEXT_DECODER;function decodePacketFromBinary(a,_,$){TEXT_DECODER||(TEXT_DECODER=new TextDecoder);const j=_||a[0]<48||a[0]>54;return decodePacket(j?a:TEXT_DECODER.decode(a),$)}const protocol$1=4;function Emitter(a){if(a)return mixin(a)}function mixin(a){for(var _ in Emitter.prototype)a[_]=Emitter.prototype[_];return a}Emitter.prototype.on=Emitter.prototype.addEventListener=function(a,_){return this._callbacks=this._callbacks||{},(this._callbacks["$"+a]=this._callbacks["$"+a]||[]).push(_),this};Emitter.prototype.once=function(a,_){function $(){this.off(a,$),_.apply(this,arguments)}return $.fn=_,this.on(a,$),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["$"+a];if(!$)return this;if(arguments.length==1)return delete this._callbacks["$"+a],this;for(var j,et=0;et<$.length;et++)if(j=$[et],j===_||j.fn===_){$.splice(et,1);break}return $.length===0&&delete this._callbacks["$"+a],this};Emitter.prototype.emit=function(a){this._callbacks=this._callbacks||{};for(var _=new Array(arguments.length-1),$=this._callbacks["$"+a],j=1;j(a.hasOwnProperty(j)&&($[j]=a[j]),$),{})}const NATIVE_SET_TIMEOUT=globalThisShim.setTimeout,NATIVE_CLEAR_TIMEOUT=globalThisShim.clearTimeout;function installTimerFunctions(a,_){_.useNativeTimers?(a.setTimeoutFn=NATIVE_SET_TIMEOUT.bind(globalThisShim),a.clearTimeoutFn=NATIVE_CLEAR_TIMEOUT.bind(globalThisShim)):(a.setTimeoutFn=globalThisShim.setTimeout.bind(globalThisShim),a.clearTimeoutFn=globalThisShim.clearTimeout.bind(globalThisShim))}const BASE64_OVERHEAD=1.33;function byteLength(a){return typeof a=="string"?utf8Length(a):Math.ceil((a.byteLength||a.size)*BASE64_OVERHEAD)}function utf8Length(a){let _=0,$=0;for(let j=0,et=a.length;j=57344?$+=3:(j++,$+=4);return $}function encode$1(a){let _="";for(let $ in a)a.hasOwnProperty($)&&(_.length&&(_+="&"),_+=encodeURIComponent($)+"="+encodeURIComponent(a[$]));return _}function decode$1(a){let _={},$=a.split("&");for(let j=0,et=$.length;j0);return _}function yeast(){const a=encode(+new Date);return a!==prev?(seed=0,prev=a):a+"."+encode(seed++)}for(;i{this.readyState="paused",_()};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(_){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(_,this.socket.binaryType).forEach($),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const _=()=>{this.write([{type:"close"}])};this.readyState==="open"?_():this.once("open",_)}write(_){this.writable=!1,encodePayload(_,$=>{this.doWrite($,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const _=this.opts.secure?"https":"http",$=this.query||{};return this.opts.timestampRequests!==!1&&($[this.opts.timestampParam]=yeast()),!this.supportsBinary&&!$.sid&&($.b64=1),this.createUri(_,$)}request(_={}){return Object.assign(_,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Request$1(this.uri(),_)}doWrite(_,$){const j=this.request({method:"POST",data:_});j.on("success",$),j.on("error",(et,tt)=>{this.onError("xhr post error",et,tt)})}doPoll(){const _=this.request();_.on("data",this.onData.bind(this)),_.on("error",($,j)=>{this.onError("xhr poll error",$,j)}),this.pollXhr=_}}let Request$1=class n0 extends Emitter{constructor(_,$){super(),installTimerFunctions(this,$),this.opts=$,this.method=$.method||"GET",this.uri=_,this.data=$.data!==void 0?$.data:null,this.create()}create(){var _;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{}(_=this.opts.cookieJar)===null||_===void 0||_.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(_){this.emitReserved("error",_,this.xhr),this.cleanup(!0)}cleanup(_){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=empty,_)try{this.xhr.abort()}catch{}typeof document<"u"&&delete n0.requests[this.index],this.xhr=null}}onLoad(){const _=this.xhr.responseText;_!==null&&(this.emitReserved("data",_),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 a="onpagehide"in globalThisShim?"pagehide":"unload";addEventListener(a,unloadHandler,!1)}}function unloadHandler(){for(let a in Request$1.requests)Request$1.requests.hasOwnProperty(a)&&Request$1.requests[a].abort()}const nextTick=typeof Promise=="function"&&typeof Promise.resolve=="function"?_=>Promise.resolve().then(_):(_,$)=>$(_,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(_){super(_),this.supportsBinary=!_.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const _=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(_,$):new WebSocket(_):new WebSocket(_,$,j)}catch(et){return this.emitReserved("error",et)}this.ws.binaryType=this.socket.binaryType||defaultBinaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=_=>this.onClose({description:"websocket connection closed",context:_}),this.ws.onmessage=_=>this.onData(_.data),this.ws.onerror=_=>this.onError("websocket error",_)}write(_){this.writable=!1;for(let $=0;$<_.length;$++){const j=_[$],et=$===_.length-1;encodePacket(j,this.supportsBinary,tt=>{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 _=this.opts.secure?"wss":"ws",$=this.query||{};return this.opts.timestampRequests&&($[this.opts.timestampParam]=yeast()),this.supportsBinary||($.b64=1),this.createUri(_,$)}check(){return!!WebSocket}}function shouldIncludeBinaryHeader(a,_){return a.type==="message"&&typeof a.data!="string"&&_[0]>=48&&_[0]<=54}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(_=>{this.onError("webtransport error",_)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(_=>{const $=_.readable.getReader();this.writer=_.writable.getWriter();let j;const et=()=>{$.read().then(({done:rt,value:nt})=>{rt||(!j&&nt.byteLength===1&&nt[0]===54?j=!0:(this.onPacket(decodePacketFromBinary(nt,j,"arraybuffer")),j=!1),et())}).catch(rt=>{})};et();const tt=this.query.sid?`0{"sid":"${this.query.sid}"}`:"0";this.writer.write(new TextEncoder().encode(tt)).then(()=>this.onOpen())})}))}write(_){this.writable=!1;for(let $=0;$<_.length;$++){const j=_[$],et=$===_.length-1;encodePacketToBinary(j,tt=>{shouldIncludeBinaryHeader(j,tt)&&this.writer.write(Uint8Array.of(54)),this.writer.write(tt).then(()=>{et&&nextTick(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})})}}doClose(){var _;(_=this.transport)===null||_===void 0||_.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(a){const _=a,$=a.indexOf("["),j=a.indexOf("]");$!=-1&&j!=-1&&(a=a.substring(0,$)+a.substring($,j).replace(/:/g,";")+a.substring(j,a.length));let et=re.exec(a||""),tt={},rt=14;for(;rt--;)tt[parts[rt]]=et[rt]||"";return $!=-1&&j!=-1&&(tt.source=_,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=_.replace($,"/").split("/");return(_.slice(0,1)=="/"||_.length===0)&&j.splice(0,1),_.slice(-1)=="/"&&j.splice(j.length-1,1),j}function queryKey(a,_){const $={};return _.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(j,et,tt){et&&($[et]=tt)}),$}let Socket$1=class Tu extends Emitter{constructor(_,$={}){super(),this.writeBuffer=[],_&&typeof _=="object"&&($=_,_=null),_?(_=parse$2(_),$.hostname=_.host,$.secure=_.protocol==="https"||_.protocol==="wss",$.port=_.port,_.query&&($.query=_.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$1(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(_){const $=Object.assign({},this.opts.query);$.EIO=protocol$1,$.transport=_,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[_]);return new transports[_](j)}open(){let _;if(this.opts.rememberUpgrade&&Tu.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)_="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else _=this.transports[0];this.readyState="opening";try{_=this.createTransport(_)}catch{this.transports.shift(),this.open();return}_.open(),this.setTransport(_)}setTransport(_){this.transport&&this.transport.removeAllListeners(),this.transport=_,_.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(_){let $=this.createTransport(_),j=!1;Tu.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;Tu.priorWebsocketSuccess=$.name==="websocket",this.transport.pause(()=>{j||this.readyState!=="closed"&&(ot(),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,ot(),$.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 st(at){$&&at.name!==$.name&&tt()}const ot=()=>{$.removeListener("open",et),$.removeListener("error",rt),$.removeListener("close",nt),this.off("close",it),this.off("upgrading",st)};$.once("open",et),$.once("error",rt),$.once("close",nt),this.once("close",it),this.once("upgrading",st),this.upgrades.indexOf("webtransport")!==-1&&_!=="webtransport"?this.setTimeoutFn(()=>{j||$.open()},200):$.open()}onOpen(){if(this.readyState="open",Tu.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let _=0;const $=this.upgrades.length;for(;_<$;_++)this.probe(this.upgrades[_])}}onPacket(_){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",_),this.emitReserved("heartbeat"),_.type){case"open":this.onHandshake(JSON.parse(_.data));break;case"ping":this.resetPingTimeout(),this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const $=new Error("server error");$.code=_.data,this.onError($);break;case"message":this.emitReserved("data",_.data),this.emitReserved("message",_.data);break}}onHandshake(_){this.emitReserved("handshake",_),this.id=_.sid,this.transport.query.sid=_.sid,this.upgrades=this.filterUpgrades(_.upgrades),this.pingInterval=_.pingInterval,this.pingTimeout=_.pingTimeout,this.maxPayload=_.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 _=this.getWritablePackets();this.transport.send(_),this.prevBufferLen=_.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(_,$,j){return this.sendPacket("message",_,$,j),this}send(_,$,j){return this.sendPacket("message",_,$,j),this}sendPacket(_,$,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:_,data:$,options:j};this.emitReserved("packetCreate",tt),this.writeBuffer.push(tt),et&&this.once("flush",et),this.flush()}close(){const _=()=>{this.onClose("forced close"),this.transport.close()},$=()=>{this.off("upgrade",$),this.off("upgradeError",$),_()},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():_()}):this.upgrading?j():_()),this}onError(_){Tu.priorWebsocketSuccess=!1,this.emitReserved("error",_),this.onClose("transport error",_)}onClose(_,$){(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",_,$),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(_){const $=[];let j=0;const et=_.length;for(;jtypeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(a):a.buffer instanceof ArrayBuffer,toString$2=Object.prototype.toString,withNativeBlob=typeof Blob=="function"||typeof Blob<"u"&&toString$2.call(Blob)==="[object BlobConstructor]",withNativeFile=typeof File=="function"||typeof File<"u"&&toString$2.call(File)==="[object FileConstructor]";function isBinary(a){return withNativeArrayBuffer&&(a instanceof ArrayBuffer||isView(a))||withNativeBlob&&a instanceof Blob||withNativeFile&&a instanceof File}function hasBinary(a,_){if(!a||typeof a!="object")return!1;if(Array.isArray(a)){for(let $=0,j=a.length;$=0&&a.num<_.length)return _[a.num];throw new Error("illegal attachments")}else if(Array.isArray(a))for(let $=0;${delete this.acks[_];for(let rt=0;rt{this.io.clearTimeoutFn(tt),$.apply(this,[null,...rt])}}emitWithAck(_,...$){const j=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((et,tt)=>{$.push((rt,nt)=>j?rt?tt(rt):et(nt):et(rt)),this.emit(_,...$)})}_addToQueue(_){let $;typeof _[_.length-1]=="function"&&($=_.pop());const j={id:this._queueSeq++,tryCount:0,pending:!1,args:_,flags:Object.assign({fromQueue:!0},this.flags)};_.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(_=!1){if(!this.connected||this._queue.length===0)return;const $=this._queue[0];$.pending&&!_||($.pending=!0,$.tryCount++,this.flags=$.flags,this.emit.apply(this,$.args))}packet(_){_.nsp=this.nsp,this.io._packet(_)}onopen(){typeof this.auth=="function"?this.auth(_=>{this._sendConnectPacket(_)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(_){this.packet({type:PacketType.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},_):_})}onerror(_){this.connected||this.emitReserved("connect_error",_)}onclose(_,$){this.connected=!1,delete this.id,this.emitReserved("disconnect",_,$)}onpacket(_){if(_.nsp===this.nsp)switch(_.type){case PacketType.CONNECT:_.data&&_.data.sid?this.onconnect(_.data.sid,_.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(_);break;case PacketType.ACK:case PacketType.BINARY_ACK:this.onack(_);break;case PacketType.DISCONNECT:this.ondisconnect();break;case PacketType.CONNECT_ERROR:this.destroy();const j=new Error(_.data.message);j.data=_.data.data,this.emitReserved("connect_error",j);break}}onevent(_){const $=_.data||[];_.id!=null&&$.push(this.ack(_.id)),this.connected?this.emitEvent($):this.receiveBuffer.push(Object.freeze($))}emitEvent(_){if(this._anyListeners&&this._anyListeners.length){const $=this._anyListeners.slice();for(const j of $)j.apply(this,_)}super.emit.apply(this,_),this._pid&&_.length&&typeof _[_.length-1]=="string"&&(this._lastOffset=_[_.length-1])}ack(_){const $=this;let j=!1;return function(...et){j||(j=!0,$.packet({type:PacketType.ACK,id:_,data:et}))}}onack(_){const $=this.acks[_.id];typeof $=="function"&&($.apply(this,_.data),delete this.acks[_.id])}onconnect(_,$){this.id=_,this.recovered=$&&this._pid===$,this._pid=$,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(_=>this.emitEvent(_)),this.receiveBuffer=[],this.sendBuffer.forEach(_=>{this.notifyOutgoingListeners(_),this.packet(_)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(_=>_()),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(_){return this.flags.compress=_,this}get volatile(){return this.flags.volatile=!0,this}timeout(_){return this.flags.timeout=_,this}onAny(_){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(_),this}prependAny(_){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(_),this}offAny(_){if(!this._anyListeners)return this;if(_){const $=this._anyListeners;for(let j=0;j<$.length;j++)if(_===$[j])return $.splice(j,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(_){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(_),this}prependAnyOutgoing(_){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(_),this}offAnyOutgoing(_){if(!this._anyOutgoingListeners)return this;if(_){const $=this._anyOutgoingListeners;for(let j=0;j<$.length;j++)if(_===$[j])return $.splice(j,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(_){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const $=this._anyOutgoingListeners.slice();for(const j of $)j.apply(this,_.data)}}}function Backoff(a){a=a||{},this.ms=a.min||100,this.max=a.max||1e4,this.factor=a.factor||2,this.jitter=a.jitter>0&&a.jitter<=1?a.jitter:0,this.attempts=0}Backoff.prototype.duration=function(){var a=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var _=Math.random(),$=Math.floor(_*this.jitter*a);a=Math.floor(_*10)&1?a+$:a-$}return Math.min(a,this.max)|0};Backoff.prototype.reset=function(){this.attempts=0};Backoff.prototype.setMin=function(a){this.ms=a};Backoff.prototype.setMax=function(a){this.max=a};Backoff.prototype.setJitter=function(a){this.jitter=a};class Manager extends Emitter{constructor(_,$){var j;super(),this.nsps={},this.subs=[],_&&typeof _=="object"&&($=_,_=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=_;const et=$.parser||parser;this.encoder=new et.Encoder,this.decoder=new et.Decoder,this._autoConnect=$.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(_){return arguments.length?(this._reconnection=!!_,this):this._reconnection}reconnectionAttempts(_){return _===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=_,this)}reconnectionDelay(_){var $;return _===void 0?this._reconnectionDelay:(this._reconnectionDelay=_,($=this.backoff)===null||$===void 0||$.setMin(_),this)}randomizationFactor(_){var $;return _===void 0?this._randomizationFactor:(this._randomizationFactor=_,($=this.backoff)===null||$===void 0||$.setJitter(_),this)}reconnectionDelayMax(_){var $;return _===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=_,($=this.backoff)===null||$===void 0||$.setMax(_),this)}timeout(_){return arguments.length?(this._timeout=_,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(_){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(),_&&_()}),tt=nt=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",nt),_?_(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(_){return this.open(_)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const _=this.engine;this.subs.push(on(_,"ping",this.onping.bind(this)),on(_,"data",this.ondata.bind(this)),on(_,"error",this.onerror.bind(this)),on(_,"close",this.onclose.bind(this)),on(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(_){try{this.decoder.add(_)}catch($){this.onclose("parse error",$)}}ondecoded(_){nextTick(()=>{this.emitReserved("packet",_)},this.setTimeoutFn)}onerror(_){this.emitReserved("error",_)}socket(_,$){let j=this.nsps[_];return j?this._autoConnect&&!j.active&&j.connect():(j=new Socket(this,_,$),this.nsps[_]=j),j}_destroy(_){const $=Object.keys(this.nsps);for(const j of $)if(this.nsps[j].active)return;this._close()}_packet(_){const $=this.encoder.encode(_);for(let j=0;j<$.length;j++)this.engine.write($[j],_.options)}cleanup(){this.subs.forEach(_=>_()),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(_,$){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",_,$),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const _=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(()=>{_.skipReconnect||(this.emitReserved("reconnect_attempt",_.backoff.attempts),!_.skipReconnect&&_.open(et=>{et?(_._reconnecting=!1,_.reconnect(),this.emitReserved("reconnect_error",et)):_.onreconnect()}))},$);this.opts.autoUnref&&j.unref(),this.subs.push(()=>{this.clearTimeoutFn(j)})}}onreconnect(){const _=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",_)}}const cache={};function lookup(a,_){typeof a=="object"&&(_=a,a=void 0),_=_||{};const $=url(a,_.path||"/socket.io"),j=$.source,et=$.id,tt=$.path,rt=cache[et]&&tt in cache[et].nsps,nt=_.forceNew||_["force new connection"]||_.multiplex===!1||rt;let it;return nt?it=new Manager(j,_):(cache[et]||(cache[et]=new Manager(j,_)),it=cache[et]),$.query&&!_.query&&(_.query=$.queryKey),it.socket($.path,_)}Object.assign(lookup,{Manager,Socket,io:lookup,connect:lookup});var cryptoBrowserifyExports=requireCryptoBrowserify();const nodeCrypto=getDefaultExportFromCjs$1(cryptoBrowserifyExports),ec$2=new elliptic$1.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,_){if(!a)throw new Error(_||"Assertion failed")}function isScalar(a){return Buffer$g.isBuffer(a)&&a.length===32}function isValidPrivateKey(a){return isScalar(a)?a.compare(ZERO32)>0&&a.compare(EC_GROUP_ORDER)<0:!1}function equalConstTime(a,_){if(a.length!==_.length)return!1;let $=0;for(let j=0;j"u"?Buffer$g.from(nodeCrypto.randomBytes(a)):(browserCrypto.getRandomValues(_),Buffer$g.from(_))}async function sha512(a){if(subtle){const j=await subtle.digest("SHA-512",a);return new Uint8Array(j)}const $=nodeCrypto.createHash("sha512").update(a).digest();return new Uint8Array($)}function getAes(a){return async function(_,$,j){if(subtle){const et={name:"AES-CBC"},tt=await subtle.importKey("raw",$,et,!1,[a]),rt={name:"AES-CBC",iv:_},nt=await subtle[a](rt,tt,j);return Buffer$g.from(new Uint8Array(nt))}else if(a==="encrypt"){const et=nodeCrypto.createCipheriv("aes-256-cbc",$,_),tt=et.update(j),rt=et.final();return Buffer$g.concat([tt,rt])}else if(a==="decrypt"){const et=nodeCrypto.createDecipheriv("aes-256-cbc",$,_),tt=et.update(j),rt=et.final();return Buffer$g.concat([tt,rt])}throw new Error(`Unsupported operation: ${a}`)}}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(a),et,!1,["sign","verify"]),rt=await subtle.sign("HMAC",tt,_);return Buffer$g.from(new Uint8Array(rt))}const $=nodeCrypto.createHmac("sha256",Buffer$g.from(a));return $.update(_),$.digest()}async function hmacSha256Verify(a,_,$){const j=await hmacSha256Sign(a,_);return equalConstTime(j,$)}const generatePrivate=function(){let a=randomBytes(32);for(;!isValidPrivateKey(a);)a=randomBytes(32);return a},getPublic=function(a){return assert(a.length===32,"Bad private key"),assert(isValidPrivateKey(a),"Bad private key"),Buffer$g.from(ec$2.keyFromPrivate(a).getPublic("array"))},sign=async function(a,_){return assert(a.length===32,"Bad private key"),assert(isValidPrivateKey(a),"Bad private key"),assert(_.length>0,"Message should not be empty"),assert(_.length<=32,"Message is too long"),Buffer$g.from(ec$2.sign(_,a,{canonical:!0}).toDER())},derive=async function(a,_){assert(Buffer$g.isBuffer(a),"Bad private key"),assert(Buffer$g.isBuffer(_),"Bad public key"),assert(a.length===32,"Bad private key"),assert(isValidPrivateKey(a),"Bad private key"),assert(_.length===65||_.length===33,"Bad public key"),_.length===65&&assert(_[0]===4,"Bad public key"),_.length===33&&assert(_[0]===2||_[0]===3,"Bad public key");const $=ec$2.keyFromPrivate(a),j=ec$2.keyFromPublic(_),et=$.derive(j.getPublic());return Buffer$g.from(et.toArray())},deriveUnpadded=derive,derivePadded=async function(a,_){assert(Buffer$g.isBuffer(a),"Bad private key"),assert(Buffer$g.isBuffer(_),"Bad public key"),assert(a.length===32,"Bad private key"),assert(isValidPrivateKey(a),"Bad private key"),assert(_.length===65||_.length===33,"Bad public key"),_.length===65&&assert(_[0]===4,"Bad public key"),_.length===33&&assert(_[0]===2||_[0]===3,"Bad public key");const $=ec$2.keyFromPrivate(a),j=ec$2.keyFromPublic(_),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,a),rt=await sha512(tt),nt=$.iv||randomBytes(16),it=rt.slice(0,32),st=rt.slice(32),at=await aesCbcEncrypt(nt,Buffer$g.from(it),_),ut=Buffer$g.concat([nt,et,at]),ht=await hmacSha256Sign(Buffer$g.from(st),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),st=Buffer$g.concat([_.iv,_.ephemPublicKey,_.ciphertext]),ot=await hmacSha256Verify(it,st,_.mac);if(!ot&&j===!1)return decrypt(a,_,!0);if(!ot&&j===!0)throw new Error("bad MAC after trying padded");const at=await aesCbcDecrypt(_.iv,Buffer$g.from(nt),_.ciphertext);return Buffer$g.from(new Uint8Array(at))},log$3=log$1$1.getLogger("http-helpers");log$3.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(ht){throw{name:"SyntaxError",message:ht,at:a,text:j}}function tt(ht){return ht&&ht!==_&&et("Expected '"+ht+"' instead of '"+_+"'"),_=j.charAt(a),a+=1,_}function rt(){var ht,yt="";for(_==="-"&&(yt="-",tt("-"));_>="0"&&_<="9";)yt+=_,tt();if(_===".")for(yt+=".";tt()&&_>="0"&&_<="9";)yt+=_;if(_==="e"||_==="E")for(yt+=_,tt(),(_==="-"||_==="+")&&(yt+=_,tt());_>="0"&&_<="9";)yt+=_,tt();return ht=Number(yt),isFinite(ht)||et("Bad number"),ht}function nt(){var ht,yt,wt="",Ct;if(_==='"')for(;tt();){if(_==='"')return tt(),wt;if(_==="\\")if(tt(),_==="u"){for(Ct=0,yt=0;yt<4&&(ht=parseInt(tt(),16),!!isFinite(ht));yt+=1)Ct=Ct*16+ht;wt+=String.fromCharCode(Ct)}else if(typeof $[_]=="string")wt+=$[_];else break;else wt+=_}et("Bad string")}function it(){for(;_&&_<=" ";)tt()}function st(){switch(_){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 '"+_+"'")}}function ot(){var ht=[];if(_==="["){if(tt("["),it(),_==="]")return tt("]"),ht;for(;_;){if(ht.push(ut()),it(),_==="]")return tt("]"),ht;tt(","),it()}}et("Bad array")}function at(){var ht,yt={};if(_==="{"){if(tt("{"),it(),_==="}")return tt("}"),yt;for(;_;){if(ht=nt(),it(),tt(":"),Object.prototype.hasOwnProperty.call(yt,ht)&&et('Duplicate key "'+ht+'"'),yt[ht]=ut(),it(),_==="}")return tt("}"),yt;tt(","),it()}}et("Bad object")}function ut(){switch(it(),_){case"{":return at();case"[":return ot();case'"':return nt();case"-":return rt();default:return _>="0"&&_<="9"?rt():st()}}return parse$1=function(ht,yt){var wt;return j=ht,a=0,_=" ",wt=ut(),it(),_&&et("Syntax error"),typeof yt=="function"?function Ct(Pt,$t){var Mt,Lt,Dt=Pt[$t];if(Dt&&typeof Dt=="object")for(Mt in ut)Object.prototype.hasOwnProperty.call(Dt,Mt)&&(Lt=Ct(Dt,Mt),typeof Lt>"u"?delete Dt[Mt]:Dt[Mt]=Lt);return yt.call(Pt,$t,Dt)}({"":wt},""):wt},parse$1}var stringify$1,hasRequiredStringify;function requireStringify(){if(hasRequiredStringify)return stringify$1;hasRequiredStringify=1;var a=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,_,$,j={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},et;function tt(nt){return a.lastIndex=0,a.test(nt)?'"'+nt.replace(a,function(it){var st=j[it];return typeof st=="string"?st:"\\u"+("0000"+it.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+nt+'"'}function rt(nt,it){var st,ot,at,ut,ht=_,yt,wt=it[nt];switch(wt&&typeof wt=="object"&&typeof wt.toJSON=="function"&&(wt=wt.toJSON(nt)),typeof et=="function"&&(wt=et.call(it,nt,wt)),typeof wt){case"string":return tt(wt);case"number":return isFinite(wt)?String(wt):"null";case"boolean":case"null":return String(wt);case"object":if(!wt)return"null";if(_+=$,yt=[],Object.prototype.toString.apply(wt)==="[object Array]"){for(ut=wt.length,st=0;st>_7n)*_0x71n)%_256n,_&_2n&&(et^=_1n<<(_1n<$>32?_u64_js_1.default.rotlBH(a,_,$):_u64_js_1.default.rotlSH(a,_,$),rotlL=(a,_,$)=>$>32?_u64_js_1.default.rotlBL(a,_,$):_u64_js_1.default.rotlSL(a,_,$);function keccakP(a,_=24){const $=new Uint32Array(10);for(let j=24-_;j<24;j++){for(let rt=0;rt<10;rt++)$[rt]=a[rt]^a[rt+10]^a[rt+20]^a[rt+30]^a[rt+40];for(let rt=0;rt<10;rt+=2){const nt=(rt+8)%10,it=(rt+2)%10,st=$[it],ot=$[it+1],at=rotlH(st,ot,1)^$[nt],ut=rotlL(st,ot,1)^$[nt+1];for(let ht=0;ht<50;ht+=10)a[rt+ht]^=at,a[rt+ht+1]^=ut}let et=a[2],tt=a[3];for(let rt=0;rt<24;rt++){const nt=SHA3_ROTL[rt],it=rotlH(et,tt,nt),st=rotlL(et,tt,nt),ot=SHA3_PI[rt];et=a[ot],tt=a[ot+1],a[ot]=it,a[ot+1]=st}for(let rt=0;rt<50;rt+=10){for(let nt=0;nt<10;nt++)$[nt]=a[rt+nt];for(let nt=0;nt<10;nt++)a[rt+nt]^=~$[(nt+2)%10]&$[(nt+4)%10]}a[0]^=SHA3_IOTA_H[j],a[1]^=SHA3_IOTA_L[j]}$.fill(0)}sha3.keccakP=keccakP;class Keccak extends utils_js_1.Hash{constructor(_,$,j,et=!1,tt=24){if(super(),this.blockLen=_,this.suffix=$,this.outputLen=j,this.enableXOF=et,this.rounds=tt,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,_assert_js_1.default.number(j),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,utils_js_1.u32)(this.state)}keccak(){keccakP(this.state32,this.rounds),this.posOut=0,this.pos=0}update(_){_assert_js_1.default.exists(this);const{blockLen:$,state:j}=this;_=(0,utils_js_1.toBytes)(_);const et=_.length;for(let tt=0;tt=j&&this.keccak();const rt=Math.min(j-this.posOut,tt-et);_.set($.subarray(this.posOut,this.posOut+rt),et),this.posOut+=rt,et+=rt}return _}xofInto(_){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(_)}xof(_){return _assert_js_1.default.number(_),this.xofInto(new Uint8Array(_))}digestInto(_){if(_assert_js_1.default.output(_,this),this.finished)throw new Error("digest() was already called");return this.writeInto(_),this.destroy(),_}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(_){const{blockLen:$,suffix:j,outputLen:et,rounds:tt,enableXOF:rt}=this;return _||(_=new Keccak($,j,et,rt,tt)),_.state32.set(this.state32),_.pos=this.pos,_.posOut=this.posOut,_.finished=this.finished,_.rounds=tt,_.suffix=j,_.outputLen=et,_.enableXOF=rt,_.destroyed=this.destroyed,_}}sha3.Keccak=Keccak;const gen=(a,_,$)=>(0,utils_js_1.wrapConstructor)(()=>new Keccak(_,a,$));sha3.sha3_224=gen(6,144,224/8);sha3.sha3_256=gen(6,136,256/8);sha3.sha3_384=gen(6,104,384/8);sha3.sha3_512=gen(6,72,512/8);sha3.keccak_224=gen(1,144,224/8);sha3.keccak_256=gen(1,136,256/8);sha3.keccak_384=gen(1,104,384/8);sha3.keccak_512=gen(1,72,512/8);const genShake=(a,_,$)=>(0,utils_js_1.wrapConstructorWithOpts)((j={})=>new Keccak(_,a,j.dkLen===void 0?$:j.dkLen,!0));sha3.shake128=genShake(31,168,128/8);sha3.shake256=genShake(31,136,256/8);var utils$2={exports:{}};utils$2.exports;(function(a,_){var $=commonjsGlobal&&commonjsGlobal.__importDefault||function(ut){return ut&&ut.__esModule?ut:{default:ut}};Object.defineProperty(_,"__esModule",{value:!0}),_.crypto=_.wrapHash=_.equalsBytes=_.hexToBytes=_.bytesToUtf8=_.utf8ToBytes=_.createView=_.concatBytes=_.toHex=_.bytesToHex=_.assertBytes=_.assertBool=void 0;const j=$(_assert),et=utils$e,tt=j.default.bool;_.assertBool=tt;const rt=j.default.bytes;_.assertBytes=rt;var nt=utils$e;Object.defineProperty(_,"bytesToHex",{enumerable:!0,get:function(){return nt.bytesToHex}}),Object.defineProperty(_,"toHex",{enumerable:!0,get:function(){return nt.bytesToHex}}),Object.defineProperty(_,"concatBytes",{enumerable:!0,get:function(){return nt.concatBytes}}),Object.defineProperty(_,"createView",{enumerable:!0,get:function(){return nt.createView}}),Object.defineProperty(_,"utf8ToBytes",{enumerable:!0,get:function(){return nt.utf8ToBytes}});function it(ut){if(!(ut instanceof Uint8Array))throw new TypeError(`bytesToUtf8 expected Uint8Array, got ${typeof ut}`);return new TextDecoder().decode(ut)}_.bytesToUtf8=it;function st(ut){const ht=ut.startsWith("0x")?ut.substring(2):ut;return(0,et.hexToBytes)(ht)}_.hexToBytes=st;function ot(ut,ht){if(ut.length!==ht.length)return!1;for(let yt=0;yt(j.default.bytes(ht),ut(ht))}_.wrapHash=at,_.crypto=(()=>{const ut=typeof self=="object"&&"crypto"in self?self.crypto:void 0,ht=typeof commonjsRequire=="function"&&commonjsRequire.bind(a);return{node:ht&&!ut?ht("crypto"):void 0,web:ut}})()})(utils$2,utils$2.exports);var utilsExports=utils$2.exports;Object.defineProperty(keccak,"__esModule",{value:!0});keccak.keccak512=keccak.keccak384=keccak256$3=keccak.keccak256=keccak.keccak224=void 0;const sha3_1=sha3,utils_1=utilsExports;keccak.keccak224=(0,utils_1.wrapHash)(sha3_1.keccak_224);var keccak256$3=keccak.keccak256=(()=>{const a=(0,utils_1.wrapHash)(sha3_1.keccak_256);return a.create=sha3_1.keccak_256.create,a})();keccak.keccak384=(0,utils_1.wrapHash)(sha3_1.keccak_384);keccak.keccak512=(0,utils_1.wrapHash)(sha3_1.keccak_512);function keccak256$2(a){return Buffer$g.from(keccak256$3(a))}const ec$1=new elliptic$1.ec("secp256k1");function encParamsHexToBuf$2(a){return{iv:Buffer$g.from(a.iv,"hex"),ephemPublicKey:Buffer$g.from(a.ephemPublicKey,"hex"),ciphertext:Buffer$g.from(a.ciphertext,"hex"),mac:Buffer$g.from(a.mac,"hex")}}function encParamsBufToHex$2(a){return{iv:Buffer$g.from(a.iv).toString("hex"),ephemPublicKey:Buffer$g.from(a.ephemPublicKey).toString("hex"),ciphertext:Buffer$g.from(a.ciphertext).toString("hex"),mac:Buffer$g.from(a.mac).toString("hex")}}async function encryptData$1(a,_){const $=JSON.stringify(_),j=Buffer$g.from($,"utf-8"),et=await encrypt(getPublic(Buffer$g.from(a,"hex")),j),tt=encParamsBufToHex$2(et);return JSON.stringify(tt)}async function decryptData$1(a,_){const $=JSON.parse(_),j=encParamsHexToBuf$2($),et=ec$1.keyFromPrivate(a),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(a){return KEY_PREFIX+a}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(ot){for(;;)switch(ot.prev=ot.next){case 0:return tt=storageKey(a.channelName),rt=keccak256$2(Buffer$g.from(tt,"utf8")),ot.next=4,encryptData$1(rt.toString("hex"),{token:randomToken(),time:new Date().getTime(),data:_,uuid:a.uuid});case 4:return nt=ot.sent,ot.t0=getPublic(rt).toString("hex"),ot.t1=nt,ot.next=9,sign(rt,keccak256$2(Buffer$g.from(nt,"utf8")));case 9:return ot.t2=ot.sent.toString("hex"),it={key:ot.t0,data:ot.t1,signature:ot.t2},a.timeout&&(it.timeout=a.timeout),ot.abrupt("return",fetch(a.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 ot.stop()}},et)})))})}function getSocketInstance(a){if(SOCKET_CONN_INSTANCE)return SOCKET_CONN_INSTANCE;var _=lookup(a,{transports:["websocket","polling"],withCredentials:!0,reconnectionDelayMax:1e4,reconnectionAttempts:10});return _.on("connect_error",function($){_.io.opts.transports=["polling","websocket"],log$4.error("connect error",$)}),_.on("connect",_asyncToGenerator(_regeneratorRuntime.mark(function $(){var j;return _regeneratorRuntime.wrap(function(tt){for(;;)switch(tt.prev=tt.next){case 0:j=_.io.engine,log$4.debug("initially connected to",j.transport.name),j.once("upgrade",function(){log$4.debug("upgraded",j.transport.name)}),j.once("close",function(rt){log$4.debug("connection closed",rt)});case 4:case"end":return tt.stop()}},$)}))),_.on("error",function($){log$4.error("socket errored",$),_.disconnect()}),SOCKET_CONN_INSTANCE=_,_}function setupSocketConnection(a,_,$){var j=getSocketInstance(a),et=storageKey(_),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$4.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 ot(){if(!j){document.removeEventListener("visibilitychange",ot);return}!j.connected&&document.visibilityState==="visible"&&nt()},st=function(){var ot=_asyncToGenerator(_regeneratorRuntime.mark(function at(ut){var ht;return _regeneratorRuntime.wrap(function(wt){for(;;)switch(wt.prev=wt.next){case 0:return wt.prev=0,wt.next=3,decryptData$1(tt.toString("hex"),ut);case 3:ht=wt.sent,log$4.info(ht),$(ht),wt.next=11;break;case 8:wt.prev=8,wt.t0=wt.catch(0),log$4.error(wt.t0);case 11:case"end":return wt.stop()}},at,null,[[0,8]])}));return function(ut){return ot.apply(this,arguments)}}();return j.on("disconnect",function(){log$4.debug("socket disconnected"),runningChannels.has(_)&&(log$4.error("socket disconnected unexpectedly, reconnecting socket"),nt())}),j.on(rt+"_success",st),typeof document<"u"&&document.addEventListener("visibilitychange",it),j}function create$1(a,_){_=fillOptionsWithDefaults(_);var $=randomToken(),j=new ObliviousSet(_.server.removeTimeout),et={channelName:a,uuid:$,eMIs:j,serverUrl:_.server.url};return _.server.timeout&&(et.timeout=_.server.timeout),setupSocketConnection(_.server.url,a,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(a),et}function close$1(a){runningChannels.delete(a.channelName)}function onMessage$1(a,_,$){a.messagesCallbackTime=$,a.messagesCallback=_}function canBeUsed$1(){return!0}function averageResponseTime$1(){var a=500;return a}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(a){var _={name:a,messagesCallback:null};return SIMULATE_CHANNELS.add(_),_}function close(a){SIMULATE_CHANNELS.delete(a)}function postMessage(a,_){return new Promise(function($){return setTimeout(function(){var j=Array.from(SIMULATE_CHANNELS);j.filter(function(et){return et.name===a.name}).filter(function(et){return et!==a}).filter(function(et){return!!et.messagesCallback}).forEach(function(et){return et.messagesCallback(_)}),$()},5)})}function onMessage(a,_){a.messagesCallback=_}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(a){var _=[].concat(a.methods,METHODS).filter(Boolean);if(a.type){if(a.type==="simulate")return SimulateMethod;var $=_.find(function(et){return et.type===a.type});if($)return $;throw new Error("method-type "+a.type+" not found")}a.webWorkerSupport||(_=_.filter(function(et){return et.type!=="idb"}));var j=_.find(function(et){return et.canBeUsed(a)});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=_,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(_));return _post(this,"message",_)},postInternal:function a(_){return _post(this,"internal",_)},set onmessage(a){var _=this.method.microSeconds(),$={time:_,fn:a};_removeListenerObject(this,"message",this._onML),a&&typeof a=="function"?(this._onML=$,_addListenerObject(this,"message",$)):this._onML=null},addEventListener:function a(_,$){var j=this.method.microSeconds(),et={time:j,fn:$};_addListenerObject(this,_,et)},removeEventListener:function a(_,$){var j=this._addEL[_].find(function(et){return et.fn===$});_removeListenerObject(this,_,j)},close:function a(){var _=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(_._uMP))}).then(function(){return Promise.all(_._befC.map(function(j){return j()}))}).then(function(){return _.method.close(_._state)})}},get type(){return this.method.type},get isClosed(){return this.closed}};function _post(a,_,$){var j=a.method.microSeconds(),et={time:j,type:_,data:$},tt=a._prepP?a._prepP:PROMISE_RESOLVED_VOID;return tt.then(function(){var rt=a.method.postMessage(a._state,et);return a._uMP.add(rt),rt.catch().then(function(){return a._uMP.delete(rt)}),rt})}function _prepareChannel(a){var _=a.method.create(a.name,a.options);isPromise(_)?(a._prepP=_,_.then(function($){a._state=$})):a._state=_}function _hasMessageListeners(a){return a._addEL.message.length>0||a._addEL.internal.length>0}function _addListenerObject(a,_,$){a._addEL[_].push($),_startListening(a)}function _removeListenerObject(a,_,$){a._addEL[_]=a._addEL[_].filter(function(j){return j!==$}),_stopListening(a)}function _startListening(a){if(!a._iL&&_hasMessageListeners(a)){var _=function(et){a._addEL[et.type].forEach(function(tt){var rt=1e5,nt=tt.time-rt;(et.time>=nt||a.method.type==="server")&&tt.fn(et.data)})},$=a.method.microSeconds();a._prepP?a._prepP.then(function(){a._iL=!0,a.method.onMessage(a._state,_,$)}):(a._iL=!0,a.method.onMessage(a._state,_,$))}}function _stopListening(a){if(a._iL&&!_hasMessageListeners(a)){a._iL=!1;var _=a.method.microSeconds();a.method.onMessage(a._state,null,_)}}function e(a){this.message=a}e.prototype=new Error,e.prototype.name="InvalidCharacterError";var r=typeof window<"u"&&window.atob&&window.atob.bind(window)||function(a){var _=String(a).replace(/=+$/,"");if(_.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=_.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(a){var _=a.replace(/-/g,"+").replace(/_/g,"/");switch(_.length%4){case 0:break;case 2:_+="==";break;case 3:_+="=";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}))}(_)}catch{return r(_)}}function n(a){this.message=a}function o(a,_){if(typeof a!="string")throw new n("Invalid token specified");var $=(_=_||{}).header===!0?0:1;try{return JSON.parse(t(a.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_TESTNET:"sapphire_testnet",SAPPHIRE_MAINNET:"sapphire_mainnet"},MULTI_CLUSTER_NETWORKS=[TORUS_LEGACY_NETWORK.AQUA,TORUS_LEGACY_NETWORK.CELESTE,TORUS_LEGACY_NETWORK.CYAN],LEGACY_NETWORKS_ROUTE_MAP={[TORUS_LEGACY_NETWORK.AQUA]:{migrationCompleted:!1,networkIdentifier:"aqua",networkMigratedTo:TORUS_SAPPHIRE_NETWORK.SAPPHIRE_MAINNET},[TORUS_LEGACY_NETWORK.CELESTE]:{migrationCompleted:!1,networkIdentifier:"celeste",networkMigratedTo:TORUS_SAPPHIRE_NETWORK.SAPPHIRE_MAINNET},[TORUS_LEGACY_NETWORK.CYAN]:{migrationCompleted:!1,networkIdentifier:"cyan",networkMigratedTo:TORUS_SAPPHIRE_NETWORK.SAPPHIRE_MAINNET},[TORUS_LEGACY_NETWORK.MAINNET]:{migrationCompleted:!1,networkIdentifier:"mainnet",networkMigratedTo:TORUS_SAPPHIRE_NETWORK.SAPPHIRE_MAINNET},[TORUS_LEGACY_NETWORK.TESTNET]:{migrationCompleted:!0,networkIdentifier:"teal",networkMigratedTo:TORUS_SAPPHIRE_NETWORK.SAPPHIRE_TESTNET}},SIGNER_MAP={[TORUS_LEGACY_NETWORK.MAINNET]:"https://signer.tor.us",[TORUS_LEGACY_NETWORK.TESTNET]:"https://signer.tor.us",[TORUS_LEGACY_NETWORK.CYAN]:"https://signer-polygon.tor.us",[TORUS_LEGACY_NETWORK.AQUA]:"https://signer-polygon.tor.us",[TORUS_LEGACY_NETWORK.CELESTE]:"https://signer-polygon.tor.us"},SAPPHIRE_NETWORK_URLS={[TORUS_SAPPHIRE_NETWORK.SAPPHIRE_DEVNET]:["https://sapphire-dev-2-1.authnetwork.dev","https://sapphire-dev-2-2.authnetwork.dev","https://sapphire-dev-2-3.authnetwork.dev","https://sapphire-dev-2-4.authnetwork.dev","https://sapphire-dev-2-5.authnetwork.dev"],[TORUS_SAPPHIRE_NETWORK.SAPPHIRE_TESTNET]:["https://sapphire-dev-2-1.authnetwork.dev","https://sapphire-dev-2-2.authnetwork.dev","https://sapphire-dev-2-3.authnetwork.dev","https://sapphire-dev-2-4.authnetwork.dev","https://sapphire-dev-2-5.authnetwork.dev"],[TORUS_SAPPHIRE_NETWORK.SAPPHIRE_MAINNET]:["https://sapphire-1.auth.network","https://sapphire-2.auth.network","https://sapphire-3.auth.network","https://sapphire-4.auth.network","https://sapphire-5.auth.network"]},getSSSEndpoints=(a,_)=>{const $=SAPPHIRE_NETWORK_URLS[a];if(!$||$.length===0)throw new Error(`Unsupported network: ${a}`);const j=LEGACY_NETWORKS_ROUTE_MAP[_];return $.map(et=>j&&j.networkIdentifier?`${et}/sss/${j.networkIdentifier}/jrpc`:`${et}/sss/jrpc`)},getRSSEndpoints=(a,_)=>{const $=SAPPHIRE_NETWORK_URLS[a];if(!$||$.length===0)throw new Error(`Unsupported network: ${a}`);const j=LEGACY_NETWORKS_ROUTE_MAP[_];return $.map(et=>j&&j.networkIdentifier?`${et}/rss/${j.networkIdentifier}`:`${et}/rss`)},getTSSEndpoints=(a,_)=>{const $=SAPPHIRE_NETWORK_URLS[a];if(!$||$.length===0)throw new Error(`Unsupported network: ${a}`);const j=LEGACY_NETWORKS_ROUTE_MAP[_];return $.map(et=>j&&j.networkIdentifier?`${et}/tss/${j.networkIdentifier}`:`${et}/tss`)},NODE_DETAILS_MAINNET={currentEpoch:"19",torusNodeEndpoints:["https://torus-19.torusnode.com/jrpc","https://torus-node.ens.domains/jrpc","https://torus-node.matic.network/jrpc","https://torus.zilliqa.network/jrpc","https://torus-mainnet.cosmos.network/jrpc","https://torus2.etherscan.com/jrpc","https://torus-node-v2.skalelabs.com/jrpc","https://torus-node.binancex.dev/jrpc","https://torusnode.ont.io/jrpc"],torusIndexes:[1,2,3,4,5,6,7,8,9],torusNodePub:[{X:"bbe83c64177c3775550e6ba6ac2bc059f6847d644c9e4894e42c60d7974d8c2b",Y:"82b49a7caf70def38cdad2740af45c1e4f969650105c5019a29bb18b21a9acb5"},{X:"c208cac4ef9a47d386097a9c915b28e9cb89213abee8d26a17198ee261201b0d",Y:"c7db2fe4631109f40833de9dc78d07e35706549ee48fa557b33e4e75e1047873"},{X:"ca1766bb426d4ca5582818a0c5439d560ea64f5baa060793ab29dd3d0ceacfe",Y:"d46c1d08c40e1306e1bca328c2287b8268166b11a1ba4b8442ea2ad0c5e32152"},{X:"c3934dd2f6f4b3d2e1e398cc501e143c1e1a381b52feb6d1525af34d16253768",Y:"71f5141a5035799099f5ea3e241e66946bc55dc857ac3bd7d6fcdb8dcd3eeeef"},{X:"22e66f1929631d00bf026227581597f085fd94fd952fc0dca9f0833398b5c064",Y:"6088b3912e10a1e9d50355a609c10db7d188f16a2e2fd7357e51bf4f6a74f0a1"},{X:"9dc9fa410f3ce9eb70df70cdea00a49f2c4cc7a31c08c0dab5f863ed35ff5139",Y:"627a291cb87a75c61da3f65d6818e1e05e360217179817ed27e8c73bca7ec122"},{X:"118b9fc07e97b096d899b9f6658463ce6a8caa64038e37fc969df4e6023dd8c6",Y:"baf9fa4e51770f4796ea165dd03a769b8606681a38954a0a92c4cbffd6609ce9"},{X:"8a6d8b925da15a273dec3d8f8395ec35cd6878f274b2b180e4e106999db64043",Y:"96f67f870c157743da0b1eb84d89bf30500d74dc84c11f501ee1cb013acc8c46"},{X:"39cecb62e863729f572f7dfc46c24867981bf04bb405fed0df39e33984bfade5",Y:"61c2364434012e68a2be2e9952805037e52629d7762fafc8e10e9fb5bad8f790"}]},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_TESTNET]:[{X:"f74389b0a4c8d10d2a687ae575f69b20f412d41ab7f1fe6b358aa14871327247",Y:"54e3a73098ed9bced3ef8821736e9794f9264a1420c0c7ad15d2fa617ba35ef7"},{X:"bc38813a6873e526087918507c78fc3a61624670ee851ecfb4f3bef55d027b5a",Y:"ac4b21229f662a0aefdfdac21cf17c3261a392c74a8790db218b34e3e4c1d56a"},{X:"b56541684ea5fa40c8337b7688d502f0e9e092098962ad344c34e94f06d293fb",Y:"759a998cef79d389082f9a75061a29190eec0cac99b8c25ddcf6b58569dad55c"},{X:"7bcb058d4c6ffc6ba4bfdfd93d141af35a66338a62c7c27cdad2ae3f8289b767",Y:"336ab1935e41ed4719e162587f0ab55518db4207a1eb36cc72303f1b86689d2b"},{X:"bf12a136ef94399ea098f926f04e26a4ec4ac70f69cce274e8893704c4951773",Y:"bdd44828020f52ce510e026338216ada184a6867eb4e19fb4c2d495d4a7e15e4"}],[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[a]});function fetchLocalConfig(a){if(Object.values(TORUS_SAPPHIRE_NETWORK).includes(a))return getSapphireNodeDetails(a);if(Object.values(TORUS_LEGACY_NETWORK).includes(a)){const _=LEGACY_NETWORKS_ROUTE_MAP[a];if(_.migrationCompleted)return getSapphireNodeDetails(_.networkMigratedTo,a);if(a===TORUS_LEGACY_NETWORK.MAINNET)return NODE_DETAILS_MAINNET}}const log$2=log$1$1.getLogger("fnd");class NodeDetailManager{constructor(){let{network:_=TORUS_SAPPHIRE_NETWORK.SAPPHIRE_MAINNET,fndServerEndpoint:$,enableLogging:j=!1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};_defineProperty$4(this,"fndServerEndpoint","https://fnd.tor.us/node-details"),_defineProperty$4(this,"_currentEpoch","1"),_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=_,this.updated=!1,$&&(this.fndServerEndpoint=$),j?log$2.enableAll():log$2.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(_){let{verifier:$,verifierId:j}=_;try{if(this.updated&&!MULTI_CLUSTER_NETWORKS.includes(this.network))return this._nodeDetails;try{const{nodeDetails:tt}=await get(`${this.fndServerEndpoint}?network=${this.network}&verifier=${$}&verifierId=${j}`);return this.setNodeDetails(tt),this._nodeDetails}catch(tt){log$2.error("Failed to fetch node details from server, using local.",tt)}const et=fetchLocalConfig(this.network);if(!et)throw new Error("Failed to fetch node details");return this.setNodeDetails(et),this._nodeDetails}catch(et){throw log$2.error("Failed to fetch node details",et),et}}setNodeDetails(_){const{currentEpoch:$,torusNodeEndpoints:j,torusNodeSSSEndpoints:et,torusNodeRSSEndpoints:tt,torusNodeTSSEndpoints:rt,torusNodePub:nt,torusIndexes:it}=_;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(a){(function(_,$){function j(vt,ct){if(!vt)throw new Error(ct||"Assertion failed")}function et(vt,ct){vt.super_=ct;var dt=function(){};dt.prototype=ct.prototype,vt.prototype=new dt,vt.prototype.constructor=vt}function tt(vt,ct,dt){if(tt.isBN(vt))return vt;this.negative=0,this.words=null,this.length=0,this.red=null,vt!==null&&((ct==="le"||ct==="be")&&(dt=ct,ct=10),this._init(vt||0,ct||10,dt||"be"))}typeof _=="object"?_.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$4.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,mt){if(typeof ct=="number")return this._initNumber(ct,dt,mt);if(typeof ct=="object")return this._initArray(ct,dt,mt);dt==="hex"&&(dt=16),j(dt===(dt|0)&&dt>=2&&dt<=36),ct=ct.toString().replace(/\s+/g,"");var xt=0;ct[0]==="-"&&(xt++,this.negative=1),xt=0;xt-=3)Rt=ct[xt]|ct[xt-1]<<8|ct[xt-2]<<16,this.words[At]|=Rt<>>26-St&67108863,St+=24,St>=26&&(St-=26,At++);else if(mt==="le")for(xt=0,At=0;xt>>26-St&67108863,St+=24,St>=26&&(St-=26,At++);return this._strip()};function nt(vt,ct){var dt=vt.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 "+vt)}function it(vt,ct,dt){var mt=nt(vt,dt);return dt-1>=ct&&(mt|=nt(vt,dt-1)<<4),mt}tt.prototype._parseHex=function(ct,dt,mt){this.length=Math.ceil((ct.length-dt)/6),this.words=new Array(this.length);for(var xt=0;xt=dt;xt-=2)St=it(ct,dt,xt)<=18?(At-=18,Rt+=1,this.words[Rt]|=St>>>26):At+=8;else{var Tt=ct.length-dt;for(xt=Tt%2===0?dt+1:dt;xt=18?(At-=18,Rt+=1,this.words[Rt]|=St>>>26):At+=8}this._strip()};function st(vt,ct,dt,mt){for(var xt=0,At=0,Rt=Math.min(vt.length,dt),St=ct;St=49?At=Tt-49+10:Tt>=17?At=Tt-17+10:At=Tt,j(Tt>=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},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],yt=[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 mt;if(ct===16||ct==="hex"){mt="";for(var xt=0,At=0,Rt=0;Rt>>24-xt&16777215,xt+=2,xt>=26&&(xt-=26,Rt--),At!==0||Rt!==this.length-1?mt=ut[6-Tt.length]+Tt+mt:mt=Tt+mt}for(At!==0&&(mt=At.toString(16)+mt);mt.length%dt!==0;)mt="0"+mt;return this.negative!==0&&(mt="-"+mt),mt}if(ct===(ct|0)&&ct>=2&&ct<=36){var Et=ht[ct],Nt=yt[ct];mt="";var tr=this.clone();for(tr.negative=0;!tr.isZero();){var ir=tr.modrn(Nt).toString(ct);tr=tr.idivn(Nt),tr.isZero()?mt=ir+mt:mt=ut[Et-ir.length]+ir+mt}for(this.isZero()&&(mt="0"+mt);mt.length%dt!==0;)mt="0"+mt;return this.negative!==0&&(mt="-"+mt),mt}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 wt=function(ct,dt){return ct.allocUnsafe?ct.allocUnsafe(dt):new ct(dt)};tt.prototype.toArrayLike=function(ct,dt,mt){this._strip();var xt=this.byteLength(),At=mt||Math.max(1,xt);j(xt<=At,"byte array longer than desired length"),j(At>0,"Requested array length <= 0");var Rt=wt(ct,At),St=dt==="le"?"LE":"BE";return this["_toArrayLike"+St](Rt,xt),Rt},tt.prototype._toArrayLikeLE=function(ct,dt){for(var mt=0,xt=0,At=0,Rt=0;At>8&255),mt>16&255),Rt===6?(mt>24&255),xt=0,Rt=0):(xt=St>>>24,Rt+=2)}if(mt=0&&(ct[mt--]=St>>8&255),mt>=0&&(ct[mt--]=St>>16&255),Rt===6?(mt>=0&&(ct[mt--]=St>>24&255),xt=0,Rt=0):(xt=St>>>24,Rt+=2)}if(mt>=0)for(ct[mt--]=xt;mt>=0;)ct[mt--]=0},Math.clz32?tt.prototype._countBits=function(ct){return 32-Math.clz32(ct)}:tt.prototype._countBits=function(ct){var dt=ct,mt=0;return dt>=4096&&(mt+=13,dt>>>=13),dt>=64&&(mt+=7,dt>>>=7),dt>=8&&(mt+=4,dt>>>=4),dt>=2&&(mt+=2,dt>>>=2),mt+dt},tt.prototype._zeroBits=function(ct){if(ct===0)return 26;var dt=ct,mt=0;return dt&8191||(mt+=13,dt>>>=13),dt&127||(mt+=7,dt>>>=7),dt&15||(mt+=4,dt>>>=4),dt&3||(mt+=2,dt>>>=2),dt&1||mt++,mt},tt.prototype.bitLength=function(){var ct=this.words[this.length-1],dt=this._countBits(ct);return(this.length-1)*26+dt};function Ct(vt){for(var ct=new Array(vt.bitLength()),dt=0;dt>>xt&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 mt=0;mtct.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,mt;this.length>ct.length?(dt=this,mt=ct):(dt=ct,mt=this);for(var xt=0;xtct.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,mt=ct%26;this._expand(dt),mt>0&&dt--;for(var xt=0;xt0&&(this.words[xt]=~this.words[xt]&67108863>>26-mt),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 mt=ct/26|0,xt=ct%26;return this._expand(mt+1),dt?this.words[mt]=this.words[mt]|1<ct.length?(mt=this,xt=ct):(mt=ct,xt=this);for(var At=0,Rt=0;Rt>>26;for(;At!==0&&Rt>>26;if(this.length=mt.length,At!==0)this.words[this.length]=At,this.length++;else if(mt!==this)for(;Rtct.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 mt=this.cmp(ct);if(mt===0)return this.negative=0,this.length=1,this.words[0]=0,this;var xt,At;mt>0?(xt=this,At=ct):(xt=ct,At=this);for(var Rt=0,St=0;St>26,this.words[St]=dt&67108863;for(;Rt!==0&&St>26,this.words[St]=dt&67108863;if(Rt===0&&St>>26,tr=Tt&67108863,ir=Math.min(Et,ct.length-1),nr=Math.max(0,Et-vt.length+1);nr<=ir;nr++){var Zt=Et-nr|0;xt=vt.words[Zt]|0,At=ct.words[nr]|0,Rt=xt*At+tr,Nt+=Rt/67108864|0,tr=Rt&67108863}dt.words[Et]=tr|0,Tt=Nt|0}return Tt!==0?dt.words[Et]=Tt|0:dt.length--,dt._strip()}var $t=function(ct,dt,mt){var xt=ct.words,At=dt.words,Rt=mt.words,St=0,Tt,Et,Nt,tr=xt[0]|0,ir=tr&8191,nr=tr>>>13,Zt=xt[1]|0,Kt=Zt&8191,Qt=Zt>>>13,Ht=xt[2]|0,qt=Ht&8191,Jt=Ht>>>13,ur=xt[3]|0,xr=ur&8191,pr=ur>>>13,Cr=xt[4]|0,Mr=Cr&8191,lr=Cr>>>13,fr=xt[5]|0,_r=fr&8191,Sr=fr>>>13,kr=xt[6]|0,Ar=kr&8191,$r=kr>>>13,Or=xt[7]|0,Lr=Or&8191,or=Or>>>13,Yt=xt[8]|0,er=Yt&8191,Gt=Yt>>>13,Vt=xt[9]|0,Wt=Vt&8191,ar=Vt>>>13,yr=At[0]|0,Er=yr&8191,Rr=yr>>>13,Wr=At[1]|0,Hr=Wr&8191,Fr=Wr>>>13,pn=At[2]|0,Jr=pn&8191,Qr=pn>>>13,mn=At[3]|0,ln=mn&8191,qr=mn>>>13,En=At[4]|0,un=En&8191,Vr=En>>>13,hn=At[5]|0,fn=hn&8191,Kr=hn>>>13,Rn=At[6]|0,dn=Rn&8191,Gr=Rn>>>13,gn=At[7]|0,an=gn&8191,Zr=gn>>>13,An=At[8]|0,Sn=An&8191,nn=An>>>13,Pn=At[9]|0,yn=Pn&8191,_n=Pn>>>13;mt.negative=ct.negative^dt.negative,mt.length=19,Tt=Math.imul(ir,Er),Et=Math.imul(ir,Rr),Et=Et+Math.imul(nr,Er)|0,Nt=Math.imul(nr,Rr);var ds=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(ds>>>26)|0,ds&=67108863,Tt=Math.imul(Kt,Er),Et=Math.imul(Kt,Rr),Et=Et+Math.imul(Qt,Er)|0,Nt=Math.imul(Qt,Rr),Tt=Tt+Math.imul(ir,Hr)|0,Et=Et+Math.imul(ir,Fr)|0,Et=Et+Math.imul(nr,Hr)|0,Nt=Nt+Math.imul(nr,Fr)|0;var fs=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(fs>>>26)|0,fs&=67108863,Tt=Math.imul(qt,Er),Et=Math.imul(qt,Rr),Et=Et+Math.imul(Jt,Er)|0,Nt=Math.imul(Jt,Rr),Tt=Tt+Math.imul(Kt,Hr)|0,Et=Et+Math.imul(Kt,Fr)|0,Et=Et+Math.imul(Qt,Hr)|0,Nt=Nt+Math.imul(Qt,Fr)|0,Tt=Tt+Math.imul(ir,Jr)|0,Et=Et+Math.imul(ir,Qr)|0,Et=Et+Math.imul(nr,Jr)|0,Nt=Nt+Math.imul(nr,Qr)|0;var hs=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(hs>>>26)|0,hs&=67108863,Tt=Math.imul(xr,Er),Et=Math.imul(xr,Rr),Et=Et+Math.imul(pr,Er)|0,Nt=Math.imul(pr,Rr),Tt=Tt+Math.imul(qt,Hr)|0,Et=Et+Math.imul(qt,Fr)|0,Et=Et+Math.imul(Jt,Hr)|0,Nt=Nt+Math.imul(Jt,Fr)|0,Tt=Tt+Math.imul(Kt,Jr)|0,Et=Et+Math.imul(Kt,Qr)|0,Et=Et+Math.imul(Qt,Jr)|0,Nt=Nt+Math.imul(Qt,Qr)|0,Tt=Tt+Math.imul(ir,ln)|0,Et=Et+Math.imul(ir,qr)|0,Et=Et+Math.imul(nr,ln)|0,Nt=Nt+Math.imul(nr,qr)|0;var ps=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(ps>>>26)|0,ps&=67108863,Tt=Math.imul(Mr,Er),Et=Math.imul(Mr,Rr),Et=Et+Math.imul(lr,Er)|0,Nt=Math.imul(lr,Rr),Tt=Tt+Math.imul(xr,Hr)|0,Et=Et+Math.imul(xr,Fr)|0,Et=Et+Math.imul(pr,Hr)|0,Nt=Nt+Math.imul(pr,Fr)|0,Tt=Tt+Math.imul(qt,Jr)|0,Et=Et+Math.imul(qt,Qr)|0,Et=Et+Math.imul(Jt,Jr)|0,Nt=Nt+Math.imul(Jt,Qr)|0,Tt=Tt+Math.imul(Kt,ln)|0,Et=Et+Math.imul(Kt,qr)|0,Et=Et+Math.imul(Qt,ln)|0,Nt=Nt+Math.imul(Qt,qr)|0,Tt=Tt+Math.imul(ir,un)|0,Et=Et+Math.imul(ir,Vr)|0,Et=Et+Math.imul(nr,un)|0,Nt=Nt+Math.imul(nr,Vr)|0;var Vn=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(Vn>>>26)|0,Vn&=67108863,Tt=Math.imul(_r,Er),Et=Math.imul(_r,Rr),Et=Et+Math.imul(Sr,Er)|0,Nt=Math.imul(Sr,Rr),Tt=Tt+Math.imul(Mr,Hr)|0,Et=Et+Math.imul(Mr,Fr)|0,Et=Et+Math.imul(lr,Hr)|0,Nt=Nt+Math.imul(lr,Fr)|0,Tt=Tt+Math.imul(xr,Jr)|0,Et=Et+Math.imul(xr,Qr)|0,Et=Et+Math.imul(pr,Jr)|0,Nt=Nt+Math.imul(pr,Qr)|0,Tt=Tt+Math.imul(qt,ln)|0,Et=Et+Math.imul(qt,qr)|0,Et=Et+Math.imul(Jt,ln)|0,Nt=Nt+Math.imul(Jt,qr)|0,Tt=Tt+Math.imul(Kt,un)|0,Et=Et+Math.imul(Kt,Vr)|0,Et=Et+Math.imul(Qt,un)|0,Nt=Nt+Math.imul(Qt,Vr)|0,Tt=Tt+Math.imul(ir,fn)|0,Et=Et+Math.imul(ir,Kr)|0,Et=Et+Math.imul(nr,fn)|0,Nt=Nt+Math.imul(nr,Kr)|0;var ss=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(ss>>>26)|0,ss&=67108863,Tt=Math.imul(Ar,Er),Et=Math.imul(Ar,Rr),Et=Et+Math.imul($r,Er)|0,Nt=Math.imul($r,Rr),Tt=Tt+Math.imul(_r,Hr)|0,Et=Et+Math.imul(_r,Fr)|0,Et=Et+Math.imul(Sr,Hr)|0,Nt=Nt+Math.imul(Sr,Fr)|0,Tt=Tt+Math.imul(Mr,Jr)|0,Et=Et+Math.imul(Mr,Qr)|0,Et=Et+Math.imul(lr,Jr)|0,Nt=Nt+Math.imul(lr,Qr)|0,Tt=Tt+Math.imul(xr,ln)|0,Et=Et+Math.imul(xr,qr)|0,Et=Et+Math.imul(pr,ln)|0,Nt=Nt+Math.imul(pr,qr)|0,Tt=Tt+Math.imul(qt,un)|0,Et=Et+Math.imul(qt,Vr)|0,Et=Et+Math.imul(Jt,un)|0,Nt=Nt+Math.imul(Jt,Vr)|0,Tt=Tt+Math.imul(Kt,fn)|0,Et=Et+Math.imul(Kt,Kr)|0,Et=Et+Math.imul(Qt,fn)|0,Nt=Nt+Math.imul(Qt,Kr)|0,Tt=Tt+Math.imul(ir,dn)|0,Et=Et+Math.imul(ir,Gr)|0,Et=Et+Math.imul(nr,dn)|0,Nt=Nt+Math.imul(nr,Gr)|0;var Jn=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(Jn>>>26)|0,Jn&=67108863,Tt=Math.imul(Lr,Er),Et=Math.imul(Lr,Rr),Et=Et+Math.imul(or,Er)|0,Nt=Math.imul(or,Rr),Tt=Tt+Math.imul(Ar,Hr)|0,Et=Et+Math.imul(Ar,Fr)|0,Et=Et+Math.imul($r,Hr)|0,Nt=Nt+Math.imul($r,Fr)|0,Tt=Tt+Math.imul(_r,Jr)|0,Et=Et+Math.imul(_r,Qr)|0,Et=Et+Math.imul(Sr,Jr)|0,Nt=Nt+Math.imul(Sr,Qr)|0,Tt=Tt+Math.imul(Mr,ln)|0,Et=Et+Math.imul(Mr,qr)|0,Et=Et+Math.imul(lr,ln)|0,Nt=Nt+Math.imul(lr,qr)|0,Tt=Tt+Math.imul(xr,un)|0,Et=Et+Math.imul(xr,Vr)|0,Et=Et+Math.imul(pr,un)|0,Nt=Nt+Math.imul(pr,Vr)|0,Tt=Tt+Math.imul(qt,fn)|0,Et=Et+Math.imul(qt,Kr)|0,Et=Et+Math.imul(Jt,fn)|0,Nt=Nt+Math.imul(Jt,Kr)|0,Tt=Tt+Math.imul(Kt,dn)|0,Et=Et+Math.imul(Kt,Gr)|0,Et=Et+Math.imul(Qt,dn)|0,Nt=Nt+Math.imul(Qt,Gr)|0,Tt=Tt+Math.imul(ir,an)|0,Et=Et+Math.imul(ir,Zr)|0,Et=Et+Math.imul(nr,an)|0,Nt=Nt+Math.imul(nr,Zr)|0;var Yn=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(Yn>>>26)|0,Yn&=67108863,Tt=Math.imul(er,Er),Et=Math.imul(er,Rr),Et=Et+Math.imul(Gt,Er)|0,Nt=Math.imul(Gt,Rr),Tt=Tt+Math.imul(Lr,Hr)|0,Et=Et+Math.imul(Lr,Fr)|0,Et=Et+Math.imul(or,Hr)|0,Nt=Nt+Math.imul(or,Fr)|0,Tt=Tt+Math.imul(Ar,Jr)|0,Et=Et+Math.imul(Ar,Qr)|0,Et=Et+Math.imul($r,Jr)|0,Nt=Nt+Math.imul($r,Qr)|0,Tt=Tt+Math.imul(_r,ln)|0,Et=Et+Math.imul(_r,qr)|0,Et=Et+Math.imul(Sr,ln)|0,Nt=Nt+Math.imul(Sr,qr)|0,Tt=Tt+Math.imul(Mr,un)|0,Et=Et+Math.imul(Mr,Vr)|0,Et=Et+Math.imul(lr,un)|0,Nt=Nt+Math.imul(lr,Vr)|0,Tt=Tt+Math.imul(xr,fn)|0,Et=Et+Math.imul(xr,Kr)|0,Et=Et+Math.imul(pr,fn)|0,Nt=Nt+Math.imul(pr,Kr)|0,Tt=Tt+Math.imul(qt,dn)|0,Et=Et+Math.imul(qt,Gr)|0,Et=Et+Math.imul(Jt,dn)|0,Nt=Nt+Math.imul(Jt,Gr)|0,Tt=Tt+Math.imul(Kt,an)|0,Et=Et+Math.imul(Kt,Zr)|0,Et=Et+Math.imul(Qt,an)|0,Nt=Nt+Math.imul(Qt,Zr)|0,Tt=Tt+Math.imul(ir,Sn)|0,Et=Et+Math.imul(ir,nn)|0,Et=Et+Math.imul(nr,Sn)|0,Nt=Nt+Math.imul(nr,nn)|0;var ms=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(ms>>>26)|0,ms&=67108863,Tt=Math.imul(Wt,Er),Et=Math.imul(Wt,Rr),Et=Et+Math.imul(ar,Er)|0,Nt=Math.imul(ar,Rr),Tt=Tt+Math.imul(er,Hr)|0,Et=Et+Math.imul(er,Fr)|0,Et=Et+Math.imul(Gt,Hr)|0,Nt=Nt+Math.imul(Gt,Fr)|0,Tt=Tt+Math.imul(Lr,Jr)|0,Et=Et+Math.imul(Lr,Qr)|0,Et=Et+Math.imul(or,Jr)|0,Nt=Nt+Math.imul(or,Qr)|0,Tt=Tt+Math.imul(Ar,ln)|0,Et=Et+Math.imul(Ar,qr)|0,Et=Et+Math.imul($r,ln)|0,Nt=Nt+Math.imul($r,qr)|0,Tt=Tt+Math.imul(_r,un)|0,Et=Et+Math.imul(_r,Vr)|0,Et=Et+Math.imul(Sr,un)|0,Nt=Nt+Math.imul(Sr,Vr)|0,Tt=Tt+Math.imul(Mr,fn)|0,Et=Et+Math.imul(Mr,Kr)|0,Et=Et+Math.imul(lr,fn)|0,Nt=Nt+Math.imul(lr,Kr)|0,Tt=Tt+Math.imul(xr,dn)|0,Et=Et+Math.imul(xr,Gr)|0,Et=Et+Math.imul(pr,dn)|0,Nt=Nt+Math.imul(pr,Gr)|0,Tt=Tt+Math.imul(qt,an)|0,Et=Et+Math.imul(qt,Zr)|0,Et=Et+Math.imul(Jt,an)|0,Nt=Nt+Math.imul(Jt,Zr)|0,Tt=Tt+Math.imul(Kt,Sn)|0,Et=Et+Math.imul(Kt,nn)|0,Et=Et+Math.imul(Qt,Sn)|0,Nt=Nt+Math.imul(Qt,nn)|0,Tt=Tt+Math.imul(ir,yn)|0,Et=Et+Math.imul(ir,_n)|0,Et=Et+Math.imul(nr,yn)|0,Nt=Nt+Math.imul(nr,_n)|0;var Qn=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(Qn>>>26)|0,Qn&=67108863,Tt=Math.imul(Wt,Hr),Et=Math.imul(Wt,Fr),Et=Et+Math.imul(ar,Hr)|0,Nt=Math.imul(ar,Fr),Tt=Tt+Math.imul(er,Jr)|0,Et=Et+Math.imul(er,Qr)|0,Et=Et+Math.imul(Gt,Jr)|0,Nt=Nt+Math.imul(Gt,Qr)|0,Tt=Tt+Math.imul(Lr,ln)|0,Et=Et+Math.imul(Lr,qr)|0,Et=Et+Math.imul(or,ln)|0,Nt=Nt+Math.imul(or,qr)|0,Tt=Tt+Math.imul(Ar,un)|0,Et=Et+Math.imul(Ar,Vr)|0,Et=Et+Math.imul($r,un)|0,Nt=Nt+Math.imul($r,Vr)|0,Tt=Tt+Math.imul(_r,fn)|0,Et=Et+Math.imul(_r,Kr)|0,Et=Et+Math.imul(Sr,fn)|0,Nt=Nt+Math.imul(Sr,Kr)|0,Tt=Tt+Math.imul(Mr,dn)|0,Et=Et+Math.imul(Mr,Gr)|0,Et=Et+Math.imul(lr,dn)|0,Nt=Nt+Math.imul(lr,Gr)|0,Tt=Tt+Math.imul(xr,an)|0,Et=Et+Math.imul(xr,Zr)|0,Et=Et+Math.imul(pr,an)|0,Nt=Nt+Math.imul(pr,Zr)|0,Tt=Tt+Math.imul(qt,Sn)|0,Et=Et+Math.imul(qt,nn)|0,Et=Et+Math.imul(Jt,Sn)|0,Nt=Nt+Math.imul(Jt,nn)|0,Tt=Tt+Math.imul(Kt,yn)|0,Et=Et+Math.imul(Kt,_n)|0,Et=Et+Math.imul(Qt,yn)|0,Nt=Nt+Math.imul(Qt,_n)|0;var es=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(es>>>26)|0,es&=67108863,Tt=Math.imul(Wt,Jr),Et=Math.imul(Wt,Qr),Et=Et+Math.imul(ar,Jr)|0,Nt=Math.imul(ar,Qr),Tt=Tt+Math.imul(er,ln)|0,Et=Et+Math.imul(er,qr)|0,Et=Et+Math.imul(Gt,ln)|0,Nt=Nt+Math.imul(Gt,qr)|0,Tt=Tt+Math.imul(Lr,un)|0,Et=Et+Math.imul(Lr,Vr)|0,Et=Et+Math.imul(or,un)|0,Nt=Nt+Math.imul(or,Vr)|0,Tt=Tt+Math.imul(Ar,fn)|0,Et=Et+Math.imul(Ar,Kr)|0,Et=Et+Math.imul($r,fn)|0,Nt=Nt+Math.imul($r,Kr)|0,Tt=Tt+Math.imul(_r,dn)|0,Et=Et+Math.imul(_r,Gr)|0,Et=Et+Math.imul(Sr,dn)|0,Nt=Nt+Math.imul(Sr,Gr)|0,Tt=Tt+Math.imul(Mr,an)|0,Et=Et+Math.imul(Mr,Zr)|0,Et=Et+Math.imul(lr,an)|0,Nt=Nt+Math.imul(lr,Zr)|0,Tt=Tt+Math.imul(xr,Sn)|0,Et=Et+Math.imul(xr,nn)|0,Et=Et+Math.imul(pr,Sn)|0,Nt=Nt+Math.imul(pr,nn)|0,Tt=Tt+Math.imul(qt,yn)|0,Et=Et+Math.imul(qt,_n)|0,Et=Et+Math.imul(Jt,yn)|0,Nt=Nt+Math.imul(Jt,_n)|0;var ls=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(ls>>>26)|0,ls&=67108863,Tt=Math.imul(Wt,ln),Et=Math.imul(Wt,qr),Et=Et+Math.imul(ar,ln)|0,Nt=Math.imul(ar,qr),Tt=Tt+Math.imul(er,un)|0,Et=Et+Math.imul(er,Vr)|0,Et=Et+Math.imul(Gt,un)|0,Nt=Nt+Math.imul(Gt,Vr)|0,Tt=Tt+Math.imul(Lr,fn)|0,Et=Et+Math.imul(Lr,Kr)|0,Et=Et+Math.imul(or,fn)|0,Nt=Nt+Math.imul(or,Kr)|0,Tt=Tt+Math.imul(Ar,dn)|0,Et=Et+Math.imul(Ar,Gr)|0,Et=Et+Math.imul($r,dn)|0,Nt=Nt+Math.imul($r,Gr)|0,Tt=Tt+Math.imul(_r,an)|0,Et=Et+Math.imul(_r,Zr)|0,Et=Et+Math.imul(Sr,an)|0,Nt=Nt+Math.imul(Sr,Zr)|0,Tt=Tt+Math.imul(Mr,Sn)|0,Et=Et+Math.imul(Mr,nn)|0,Et=Et+Math.imul(lr,Sn)|0,Nt=Nt+Math.imul(lr,nn)|0,Tt=Tt+Math.imul(xr,yn)|0,Et=Et+Math.imul(xr,_n)|0,Et=Et+Math.imul(pr,yn)|0,Nt=Nt+Math.imul(pr,_n)|0;var us=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(us>>>26)|0,us&=67108863,Tt=Math.imul(Wt,un),Et=Math.imul(Wt,Vr),Et=Et+Math.imul(ar,un)|0,Nt=Math.imul(ar,Vr),Tt=Tt+Math.imul(er,fn)|0,Et=Et+Math.imul(er,Kr)|0,Et=Et+Math.imul(Gt,fn)|0,Nt=Nt+Math.imul(Gt,Kr)|0,Tt=Tt+Math.imul(Lr,dn)|0,Et=Et+Math.imul(Lr,Gr)|0,Et=Et+Math.imul(or,dn)|0,Nt=Nt+Math.imul(or,Gr)|0,Tt=Tt+Math.imul(Ar,an)|0,Et=Et+Math.imul(Ar,Zr)|0,Et=Et+Math.imul($r,an)|0,Nt=Nt+Math.imul($r,Zr)|0,Tt=Tt+Math.imul(_r,Sn)|0,Et=Et+Math.imul(_r,nn)|0,Et=Et+Math.imul(Sr,Sn)|0,Nt=Nt+Math.imul(Sr,nn)|0,Tt=Tt+Math.imul(Mr,yn)|0,Et=Et+Math.imul(Mr,_n)|0,Et=Et+Math.imul(lr,yn)|0,Nt=Nt+Math.imul(lr,_n)|0;var Wn=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(Wn>>>26)|0,Wn&=67108863,Tt=Math.imul(Wt,fn),Et=Math.imul(Wt,Kr),Et=Et+Math.imul(ar,fn)|0,Nt=Math.imul(ar,Kr),Tt=Tt+Math.imul(er,dn)|0,Et=Et+Math.imul(er,Gr)|0,Et=Et+Math.imul(Gt,dn)|0,Nt=Nt+Math.imul(Gt,Gr)|0,Tt=Tt+Math.imul(Lr,an)|0,Et=Et+Math.imul(Lr,Zr)|0,Et=Et+Math.imul(or,an)|0,Nt=Nt+Math.imul(or,Zr)|0,Tt=Tt+Math.imul(Ar,Sn)|0,Et=Et+Math.imul(Ar,nn)|0,Et=Et+Math.imul($r,Sn)|0,Nt=Nt+Math.imul($r,nn)|0,Tt=Tt+Math.imul(_r,yn)|0,Et=Et+Math.imul(_r,_n)|0,Et=Et+Math.imul(Sr,yn)|0,Nt=Nt+Math.imul(Sr,_n)|0;var as=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(as>>>26)|0,as&=67108863,Tt=Math.imul(Wt,dn),Et=Math.imul(Wt,Gr),Et=Et+Math.imul(ar,dn)|0,Nt=Math.imul(ar,Gr),Tt=Tt+Math.imul(er,an)|0,Et=Et+Math.imul(er,Zr)|0,Et=Et+Math.imul(Gt,an)|0,Nt=Nt+Math.imul(Gt,Zr)|0,Tt=Tt+Math.imul(Lr,Sn)|0,Et=Et+Math.imul(Lr,nn)|0,Et=Et+Math.imul(or,Sn)|0,Nt=Nt+Math.imul(or,nn)|0,Tt=Tt+Math.imul(Ar,yn)|0,Et=Et+Math.imul(Ar,_n)|0,Et=Et+Math.imul($r,yn)|0,Nt=Nt+Math.imul($r,_n)|0;var gs=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(gs>>>26)|0,gs&=67108863,Tt=Math.imul(Wt,an),Et=Math.imul(Wt,Zr),Et=Et+Math.imul(ar,an)|0,Nt=Math.imul(ar,Zr),Tt=Tt+Math.imul(er,Sn)|0,Et=Et+Math.imul(er,nn)|0,Et=Et+Math.imul(Gt,Sn)|0,Nt=Nt+Math.imul(Gt,nn)|0,Tt=Tt+Math.imul(Lr,yn)|0,Et=Et+Math.imul(Lr,_n)|0,Et=Et+Math.imul(or,yn)|0,Nt=Nt+Math.imul(or,_n)|0;var vs=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(vs>>>26)|0,vs&=67108863,Tt=Math.imul(Wt,Sn),Et=Math.imul(Wt,nn),Et=Et+Math.imul(ar,Sn)|0,Nt=Math.imul(ar,nn),Tt=Tt+Math.imul(er,yn)|0,Et=Et+Math.imul(er,_n)|0,Et=Et+Math.imul(Gt,yn)|0,Nt=Nt+Math.imul(Gt,_n)|0;var Ts=(St+Tt|0)+((Et&8191)<<13)|0;St=(Nt+(Et>>>13)|0)+(Ts>>>26)|0,Ts&=67108863,Tt=Math.imul(Wt,yn),Et=Math.imul(Wt,_n),Et=Et+Math.imul(ar,yn)|0,Nt=Math.imul(ar,_n);var $s=(St+Tt|0)+((Et&8191)<<13)|0;return St=(Nt+(Et>>>13)|0)+($s>>>26)|0,$s&=67108863,Rt[0]=ds,Rt[1]=fs,Rt[2]=hs,Rt[3]=ps,Rt[4]=Vn,Rt[5]=ss,Rt[6]=Jn,Rt[7]=Yn,Rt[8]=ms,Rt[9]=Qn,Rt[10]=es,Rt[11]=ls,Rt[12]=us,Rt[13]=Wn,Rt[14]=as,Rt[15]=gs,Rt[16]=vs,Rt[17]=Ts,Rt[18]=$s,St!==0&&(Rt[19]=St,mt.length++),mt};Math.imul||($t=Pt);function Mt(vt,ct,dt){dt.negative=ct.negative^vt.negative,dt.length=vt.length+ct.length;for(var mt=0,xt=0,At=0;At>>26)|0,xt+=Rt>>>26,Rt&=67108863}dt.words[At]=St,mt=Rt,Rt=xt}return mt!==0?dt.words[At]=mt:dt.length--,dt._strip()}function Lt(vt,ct,dt){return Mt(vt,ct,dt)}tt.prototype.mulTo=function(ct,dt){var mt,xt=this.length+ct.length;return this.length===10&&ct.length===10?mt=$t(this,ct,dt):xt<63?mt=Pt(this,ct,dt):xt<1024?mt=Mt(this,ct,dt):mt=Lt(this,ct,dt),mt},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 mt=0,xt=0;xt>=26,mt+=At/67108864|0,mt+=Rt>>>26,this.words[xt]=Rt&67108863}return mt!==0&&(this.words[xt]=mt,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 mt=this,xt=0;xt=0);var dt=ct%26,mt=(ct-dt)/26,xt=67108863>>>26-dt<<26-dt,At;if(dt!==0){var Rt=0;for(At=0;At>>26-dt}Rt&&(this.words[At]=Rt,this.length++)}if(mt!==0){for(At=this.length-1;At>=0;At--)this.words[At+mt]=this.words[At];for(At=0;At=0);var xt;dt?xt=(dt-dt%26)/26:xt=0;var At=ct%26,Rt=Math.min((ct-At)/26,this.length),St=67108863^67108863>>>At<Rt)for(this.length-=Rt,Et=0;Et=0&&(Nt!==0||Et>=xt);Et--){var tr=this.words[Et]|0;this.words[Et]=Nt<<26-At|tr>>>At,Nt=tr&St}return Tt&&Nt!==0&&(Tt.words[Tt.length++]=Nt),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},tt.prototype.ishrn=function(ct,dt,mt){return j(this.negative===0),this.iushrn(ct,dt,mt)},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,mt=(ct-dt)/26,xt=1<=0);var dt=ct%26,mt=(ct-dt)/26;if(j(this.negative===0,"imaskn works only with positive numbers"),this.length<=mt)return this;if(dt!==0&&mt++,this.length=Math.min(mt,this.length),dt!==0){var xt=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)-(Tt/67108864|0),this.words[At+mt]=Rt&67108863}for(;At>26,this.words[At+mt]=Rt&67108863;if(St===0)return this._strip();for(j(St===-1),St=0,At=0;At>26,this.words[At]=Rt&67108863;return this.negative=1,this._strip()},tt.prototype._wordDiv=function(ct,dt){var mt=this.length-ct.length,xt=this.clone(),At=ct,Rt=At.words[At.length-1]|0,St=this._countBits(Rt);mt=26-St,mt!==0&&(At=At.ushln(mt),xt.iushln(mt),Rt=At.words[At.length-1]|0);var Tt=xt.length-At.length,Et;if(dt!=="mod"){Et=new tt(null),Et.length=Tt+1,Et.words=new Array(Et.length);for(var Nt=0;Nt=0;ir--){var nr=(xt.words[At.length+ir]|0)*67108864+(xt.words[At.length+ir-1]|0);for(nr=Math.min(nr/Rt|0,67108863),xt._ishlnsubmul(At,nr,ir);xt.negative!==0;)nr--,xt.negative=0,xt._ishlnsubmul(At,1,ir),xt.isZero()||(xt.negative^=1);Et&&(Et.words[ir]=nr)}return Et&&Et._strip(),xt._strip(),dt!=="div"&&mt!==0&&xt.iushrn(mt),{div:Et||null,mod:xt}},tt.prototype.divmod=function(ct,dt,mt){if(j(!ct.isZero()),this.isZero())return{div:new tt(0),mod:new tt(0)};var xt,At,Rt;return this.negative!==0&&ct.negative===0?(Rt=this.neg().divmod(ct,dt),dt!=="mod"&&(xt=Rt.div.neg()),dt!=="div"&&(At=Rt.mod.neg(),mt&&At.negative!==0&&At.iadd(ct)),{div:xt,mod:At}):this.negative===0&&ct.negative!==0?(Rt=this.divmod(ct.neg(),dt),dt!=="mod"&&(xt=Rt.div.neg()),{div:xt,mod:Rt.mod}):this.negative&ct.negative?(Rt=this.neg().divmod(ct.neg(),dt),dt!=="div"&&(At=Rt.mod.neg(),mt&&At.negative!==0&&At.isub(ct)),{div:Rt.div,mod:At}):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 mt=dt.div.negative!==0?dt.mod.isub(ct):dt.mod,xt=ct.ushrn(1),At=ct.andln(1),Rt=mt.cmp(xt);return Rt<0||At===1&&Rt===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 mt=(1<<26)%ct,xt=0,At=this.length-1;At>=0;At--)xt=(mt*xt+(this.words[At]|0))%ct;return dt?-xt:xt},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 mt=0,xt=this.length-1;xt>=0;xt--){var At=(this.words[xt]|0)+mt*67108864;this.words[xt]=At/ct|0,mt=At%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,mt=ct.clone();dt.negative!==0?dt=dt.umod(ct):dt=dt.clone();for(var xt=new tt(1),At=new tt(0),Rt=new tt(0),St=new tt(1),Tt=0;dt.isEven()&&mt.isEven();)dt.iushrn(1),mt.iushrn(1),++Tt;for(var Et=mt.clone(),Nt=dt.clone();!dt.isZero();){for(var tr=0,ir=1;!(dt.words[0]&ir)&&tr<26;++tr,ir<<=1);if(tr>0)for(dt.iushrn(tr);tr-- >0;)(xt.isOdd()||At.isOdd())&&(xt.iadd(Et),At.isub(Nt)),xt.iushrn(1),At.iushrn(1);for(var nr=0,Zt=1;!(mt.words[0]&Zt)&&nr<26;++nr,Zt<<=1);if(nr>0)for(mt.iushrn(nr);nr-- >0;)(Rt.isOdd()||St.isOdd())&&(Rt.iadd(Et),St.isub(Nt)),Rt.iushrn(1),St.iushrn(1);dt.cmp(mt)>=0?(dt.isub(mt),xt.isub(Rt),At.isub(St)):(mt.isub(dt),Rt.isub(xt),St.isub(At))}return{a:Rt,b:St,gcd:mt.iushln(Tt)}},tt.prototype._invmp=function(ct){j(ct.negative===0),j(!ct.isZero());var dt=this,mt=ct.clone();dt.negative!==0?dt=dt.umod(ct):dt=dt.clone();for(var xt=new tt(1),At=new tt(0),Rt=mt.clone();dt.cmpn(1)>0&&mt.cmpn(1)>0;){for(var St=0,Tt=1;!(dt.words[0]&Tt)&&St<26;++St,Tt<<=1);if(St>0)for(dt.iushrn(St);St-- >0;)xt.isOdd()&&xt.iadd(Rt),xt.iushrn(1);for(var Et=0,Nt=1;!(mt.words[0]&Nt)&&Et<26;++Et,Nt<<=1);if(Et>0)for(mt.iushrn(Et);Et-- >0;)At.isOdd()&&At.iadd(Rt),At.iushrn(1);dt.cmp(mt)>=0?(dt.isub(mt),xt.isub(At)):(mt.isub(dt),At.isub(xt))}var tr;return dt.cmpn(1)===0?tr=xt:tr=At,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(),mt=ct.clone();dt.negative=0,mt.negative=0;for(var xt=0;dt.isEven()&&mt.isEven();xt++)dt.iushrn(1),mt.iushrn(1);do{for(;dt.isEven();)dt.iushrn(1);for(;mt.isEven();)mt.iushrn(1);var At=dt.cmp(mt);if(At<0){var Rt=dt;dt=mt,mt=Rt}else if(At===0||mt.cmpn(1)===0)break;dt.isub(mt)}while(!0);return mt.iushln(xt)},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,mt=(ct-dt)/26,xt=1<>>26,St&=67108863,this.words[Rt]=St}return At!==0&&(this.words[Rt]=At,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 mt;if(this.length>1)mt=1;else{dt&&(ct=-ct),j(ct<=67108863,"Number is too big");var xt=this.words[0]|0;mt=xt===ct?0:xtct.length)return 1;if(this.length=0;mt--){var xt=this.words[mt]|0,At=ct.words[mt]|0;if(xt!==At){xtAt&&(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 jt(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 Dt={k256:null,p224:null,p192:null,p25519:null};function zt(vt,ct){this.name=vt,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 dt=ct,mt;do this.split(dt,this.tmp),dt=this.imulK(dt),dt=dt.iadd(this.tmp),mt=dt.bitLength();while(mt>this.n);var xt=mt0?dt.isub(this.p):dt.strip!==void 0?dt.strip():dt._strip(),dt},zt.prototype.split=function(ct,dt){ct.iushrn(this.n,0,dt)},zt.prototype.imulK=function(ct){return ct.imul(this.k)};function Ot(){zt.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}et(Ot,zt),Ot.prototype.split=function(ct,dt){for(var mt=4194303,xt=Math.min(ct.length,9),At=0;At>>22,Rt=St}Rt>>>=22,ct.words[At-10]=Rt,Rt===0&&ct.length>10?ct.length-=10:ct.length-=9},Ot.prototype.imulK=function(ct){ct.words[ct.length]=0,ct.words[ct.length+1]=0,ct.length+=2;for(var dt=0,mt=0;mt>>=26,ct.words[mt]=At,dt=xt}return dt!==0&&(ct.words[ct.length++]=dt),ct},tt._prime=function(ct){if(Dt[ct])return Dt[ct];var dt;if(ct==="k256")dt=new Ot;else if(ct==="p224")dt=new It;else if(ct==="p192")dt=new Bt;else if(ct==="p25519")dt=new Ft;else throw new Error("Unknown prime "+ct);return Dt[ct]=dt,dt};function jt(vt){if(typeof vt=="string"){var ct=tt._prime(vt);this.m=ct.p,this.prime=ct}else j(vt.gtn(1),"modulus must be greater than 1"),this.m=vt,this.prime=null}jt.prototype._verify1=function(ct){j(ct.negative===0,"red works only with positives"),j(ct.red,"red works only with red numbers")},jt.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")},jt.prototype.imod=function(ct){return this.prime?this.prime.ireduce(ct)._forceRed(this):(ot(ct,ct.umod(this.m)._forceRed(this)),ct)},jt.prototype.neg=function(ct){return ct.isZero()?ct.clone():this.m.sub(ct)._forceRed(this)},jt.prototype.add=function(ct,dt){this._verify2(ct,dt);var mt=ct.add(dt);return mt.cmp(this.m)>=0&&mt.isub(this.m),mt._forceRed(this)},jt.prototype.iadd=function(ct,dt){this._verify2(ct,dt);var mt=ct.iadd(dt);return mt.cmp(this.m)>=0&&mt.isub(this.m),mt},jt.prototype.sub=function(ct,dt){this._verify2(ct,dt);var mt=ct.sub(dt);return mt.cmpn(0)<0&&mt.iadd(this.m),mt._forceRed(this)},jt.prototype.isub=function(ct,dt){this._verify2(ct,dt);var mt=ct.isub(dt);return mt.cmpn(0)<0&&mt.iadd(this.m),mt},jt.prototype.shl=function(ct,dt){return this._verify1(ct),this.imod(ct.ushln(dt))},jt.prototype.imul=function(ct,dt){return this._verify2(ct,dt),this.imod(ct.imul(dt))},jt.prototype.mul=function(ct,dt){return this._verify2(ct,dt),this.imod(ct.mul(dt))},jt.prototype.isqr=function(ct){return this.imul(ct,ct.clone())},jt.prototype.sqr=function(ct){return this.mul(ct,ct)},jt.prototype.sqrt=function(ct){if(ct.isZero())return ct.clone();var dt=this.m.andln(3);if(j(dt%2===1),dt===3){var mt=this.m.add(new tt(1)).iushrn(2);return this.pow(ct,mt)}for(var xt=this.m.subn(1),At=0;!xt.isZero()&&xt.andln(1)===0;)At++,xt.iushrn(1);j(!xt.isZero());var Rt=new tt(1).toRed(this),St=Rt.redNeg(),Tt=this.m.subn(1).iushrn(1),Et=this.m.bitLength();for(Et=new tt(2*Et*Et).toRed(this);this.pow(Et,Tt).cmp(St)!==0;)Et.redIAdd(St);for(var Nt=this.pow(Et,xt),tr=this.pow(ct,xt.addn(1).iushrn(1)),ir=this.pow(ct,xt),nr=At;ir.cmp(Rt)!==0;){for(var Zt=ir,Kt=0;Zt.cmp(Rt)!==0;Kt++)Zt=Zt.redSqr();j(Kt=0;At--){for(var Nt=dt.words[At],tr=Et-1;tr>=0;tr--){var ir=Nt>>tr&1;if(Rt!==xt[0]&&(Rt=this.sqr(Rt)),ir===0&&St===0){Tt=0;continue}St<<=1,St|=ir,Tt++,!(Tt!==mt&&(At!==0||tr!==0))&&(Rt=this.mul(Rt,xt[St]),Tt=0,St=0)}Et=26}return Rt},jt.prototype.convertTo=function(ct){var dt=ct.umod(this.m);return dt===ct?dt.clone():dt},jt.prototype.convertFrom=function(ct){var dt=ct.clone();return dt.red=null,dt},tt.mont=function(ct){return new bt(ct)};function bt(vt){jt.call(this,vt),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(bt,jt),bt.prototype.convertTo=function(ct){return this.imod(ct.ushln(this.shift))},bt.prototype.convertFrom=function(ct){var dt=this.imod(ct.mul(this.rinv));return dt.red=null,dt},bt.prototype.imul=function(ct,dt){if(ct.isZero()||dt.isZero())return ct.words[0]=0,ct.length=1,ct;var mt=ct.imul(dt),xt=mt.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),At=mt.isub(xt).iushrn(this.shift),Rt=At;return At.cmp(this.m)>=0?Rt=At.isub(this.m):At.cmpn(0)<0&&(Rt=At.iadd(this.m)),Rt._forceRed(this)},bt.prototype.mul=function(ct,dt){if(ct.isZero()||dt.isZero())return new tt(0)._forceRed(this);var mt=ct.mul(dt),xt=mt.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),At=mt.isub(xt).iushrn(this.shift),Rt=At;return At.cmp(this.m)>=0?Rt=At.isub(this.m):At.cmpn(0)<0&&(Rt=At.iadd(this.m)),Rt._forceRed(this)},bt.prototype.invm=function(ct){var dt=this.imod(ct._invmp(this.m).mul(this.r2));return dt._forceRed(this)}})(a,commonjsGlobal)})(bn);var bnExports=bn.exports;const BN=getDefaultExportFromCjs$1(bnExports),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=a=>{const _={keys:[],is_new_key:a.is_new_key};return a&&a.keys&&a.keys.length>0&&(_.keys=a.keys.map($=>({pub_key_X:$.pub_key_X,pub_key_Y:$.pub_key_Y,address:$.address}))),_},kCombinations=(a,_)=>{let $=a;if(typeof $=="number"&&($=Array.from({length:$},(tt,rt)=>rt)),_>$.length||_<=0)return[];if(_===$.length)return[$];if(_===1)return $.reduce((tt,rt)=>[...tt,[rt]],[]);const j=[];let et=[];for(let tt=0;tt<=$.length-_+1;tt+=1){et=kCombinations($.slice(tt+1),_-1);for(let rt=0;rt{const $={};for(let j=0;j=8?et+=_[tt].toUpperCase():et+=_[tt];return et}function generateAddressFromPrivKey(a,_){const j=a.keyFromPrivate(_.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=a.keyFromPublic({x:_.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(_,$){_defineProperty$4(this,"share",void 0),_defineProperty$4(this,"shareIndex",void 0),this.share=new BN($,"hex"),this.shareIndex=new BN(_,"hex")}static fromJSON(_){const{share:$,shareIndex:j}=_;return new Share(j,$)}toJSON(){return{share:this.share.toString("hex"),shareIndex:this.shareIndex.toString("hex")}}}class Polynomial{constructor(_,$){_defineProperty$4(this,"polynomial",void 0),_defineProperty$4(this,"ecCurve",void 0),this.polynomial=_,this.ecCurve=$}getThreshold(){return this.polynomial.length}polyEval(_){const $=new BN(_,"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(a){const _=new BN(generatePrivate());return a.find($=>$.eq(_))?generatePrivateExcludingIndexes(a):_}function lagrangeInterpolation(a,_,$){if(_.length!==$.length)throw new Error("shares not equal to nodeIndex length in lagrangeInterpolation");let j=new BN(0);for(let et=0;et<_.length;et+=1){let tt=new BN(1),rt=new BN(1);for(let it=0;it<_.length;it+=1)if(et!==it){tt=tt.mul($[it].neg()),tt=tt.umod(a.curve.n);let st=$[et].sub($[it]);st=st.umod(a.curve.n),rt=rt.mul(st).umod(a.curve.n)}let nt=tt.mul(rt.invm(a.curve.n)).umod(a.curve.n);nt=nt.mul(_[et]).umod(a.curve.n),j=j.add(nt)}return j.umod(a.curve.n)}function generateRandomPolynomial(a,_,$,j){let et=$;$||(et=generatePrivateExcludingIndexes([new BN(0)]));{const tt=[et];for(let rt=0;rt<_;rt+=1){const nt=generatePrivateExcludingIndexes(tt);tt.push(nt)}return new Polynomial(tt,a)}}function ownKeys$2$1(a,_){var $=Object.keys(a);if(Object.getOwnPropertySymbols){var j=Object.getOwnPropertySymbols(a);_&&(j=j.filter(function(et){return Object.getOwnPropertyDescriptor(a,et).enumerable})),$.push.apply($,j)}return $}function _objectSpread$2$1(a){for(var _=1;_2&&arguments[2]!==void 0?arguments[2]:{};try{const j=await post(`${a}/get`,_,$,{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(_,$,it,tt):nt={pub_key_X:j,pub_key_Y:et,set_data:{data:it}},post(`${a}/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(a){return a.charAt(0).toUpperCase()+a.slice(1)}class SomeError extends Error{constructor(_){let{errors:$,responses:j,predicate:et}=_;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(_=>_.message||_).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(a.length).fill(void 0),nt=new Array(a.length).fill(void 0);let it;return a.forEach((st,ot)=>st.then(at=>{nt[ot]=at}).catch(at=>{rt[ot]=at}).finally(()=>{if(!tt.resolved)return _(nt.slice(0),tt).then(at=>{tt.resolved=!0,$(at)}).catch(at=>{it=at}).finally(()=>{if(et+=1,et===a.length){const ut=Object.values(nt.reduce((ht,yt)=>{if(yt){var wt;const{id:Ct,error:Pt}=yt;(Pt==null||(wt=Pt.data)===null||wt===void 0?void 0:wt.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(yt=>`• ${yt}`).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}))}}})}))});function ownKeys$1$2(a,_){var $=Object.keys(a);if(Object.getOwnPropertySymbols){var j=Object.getOwnPropertySymbols(a);_&&(j=j.filter(function(et){return Object.getOwnPropertyDescriptor(a,et).enumerable})),$.push.apply($,j)}return $}function _objectSpread$1$2(a){for(var _=1;_{const{endpoints:_,network:$,verifier:j,verifierId:et,extendedVerifierId:tt}=a,rt=_.map(ot=>post(ot,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,ot=>{const at=ot.filter(yt=>{if(yt&&!yt.error){if(!nt){var wt,Ct,Pt;((wt=yt.result)===null||wt===void 0||(Ct=wt.keys[0].nonce_data)===null||Ct===void 0||(Pt=Ct.pubNonce)===null||Pt===void 0?void 0:Pt.x)&&(nt=yt.result.keys[0].nonce_data)}return yt}return!1}),ut=thresholdSame(at.map(yt=>yt&&yt.error),~~(_.length/2)+1),ht=thresholdSame(at.map(yt=>yt&&normalizeKeysResult(yt.result)),~~(_.length/2)+1);return ht&&(nt||tt||LEGACY_NETWORKS_ROUTE_MAP[$])||ut?(ht&&ot.forEach(yt=>{if(yt&&yt.result){const wt=parseInt(yt.result.node_index);wt&&it.push(wt)}}),Promise.resolve({keyResult:ht,nodeIndexes:it,errorResult:ut,nonceResult:nt})):Promise.reject(new Error(`invalid public key result: ${JSON.stringify(ot)} and nonce result:${JSON.stringify(nt||{})} for verifier: ${j}, verifierId: ${et} and extendedVerifierId: ${tt} `))})};async function retrieveOrImportShare(a){const{legacyMetadataHost:_,serverTimeOffset:$,enableOneKey:j,ecCurve:et,allowHost:tt,network:rt,clientId:nt,endpoints:it,verifier:st,verifierParams:ot,idToken:at,importedShares:ut,extraParams:ht}=a;await get(tt,{headers:{verifier:st,verifierId:ot.verifier_id,network:rt,clientId:nt}},{useAPIKey:!0});const yt=[],wt=generatePrivate(),Ct=getPublic(wt).toString("hex"),Pt=Ct.slice(2,66),$t=Ct.slice(66),Mt=keccak256$1(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 Dt=0;Dt{log$1.error("commitment error",Ot)});yt.push(zt)}return Some(yt,Dt=>{const zt=Dt.filter(Ot=>!(!Ot||typeof Ot!="object"||Ot.error));return ut.length>0&&zt.length===it.length||ut.length===0&&zt.length>=~~(it.length*3/4)+1&&zt.find(It=>{var Bt;return!!(It&&((Bt=It.result)===null||Bt===void 0?void 0:Bt.nodeindex)==="1")})?Promise.resolve(Dt):Promise.reject(new Error(`invalid ${JSON.stringify(Dt)}`))}).then(Dt=>{const zt=[],Ot=[];for(let Bt=0;Btlog$1.error("share req",vt));zt.push(bt)}else{const jt=post(it[Bt],generateJsonRPCObject(JRPC_METHODS.GET_SHARE_OR_KEY_ASSIGN,{encrypted:"yes",use_temp:!0,item:[_objectSpread$1$2(_objectSpread$1$2({},ot),{},{idtoken:at,nodesignatures:Ot,verifieridentifier:st},ht)],one_key_flow:!0}),null,{logTracingHeader:config.logRequestTracing}).catch(bt=>log$1.error("share req",bt));zt.push(jt)}}let It;return Some(zt,async(Bt,Ft)=>{const jt=Bt.filter(xt=>!(!xt||typeof xt!="object"||xt.error)),bt=Bt.map(xt=>{if(xt&&xt.result&&xt.result.keys[0].public_key){if(!It&&!ot.extended_verifier_id){var At,Rt;((At=xt.result.keys[0].nonce_data)===null||At===void 0||(Rt=At.pubNonce)===null||Rt===void 0?void 0:Rt.x)&&(It=xt.result.keys[0].nonce_data)}return xt.result.keys[0].public_key}}),vt=thresholdSame(bt,~~(it.length/2)+1);if(!vt)throw new Error("invalid result from nodes, threshold number of public key results are not matching");if(!It&&!ot.extended_verifier_id&&!LEGACY_NETWORKS_ROUTE_MAP[rt])throw new Error(`invalid metadata result from nodes, nonce metadata is empty for verifier: ${st} and verifierId: ${ot.verifier_id}`);const ct=ut.length>0?it.length:~~(it.length/2)+1;if(jt.length>=ct&&vt&&(It||ot.extended_verifier_id||LEGACY_NETWORKS_ROUTE_MAP[rt])){const xt=[],At=[],Rt=[],St=[],Tt=[];for(let Jt=0;Jt0){var dt;Mr&&(dt=Mr[0])!==null&&dt!==void 0&&dt.ephemPublicKey?At.push(decryptNodeData(Mr[0],Cr[0],wt).catch(fr=>log$1.debug("session sig decryption",fr))):At.push(Promise.resolve(Buffer$g.from(Cr[0],"hex")))}else At.push(Promise.resolve(void 0));if((xr==null?void 0:xr.length)>0){var mt;pr&&(mt=pr[0])!==null&&mt!==void 0&&mt.ephemPublicKey?Rt.push(decryptNodeData(pr[0],xr[0],wt).catch(fr=>log$1.debug("session token sig decryption",fr))):Rt.push(Promise.resolve(Buffer$g.from(xr[0],"base64")))}else Rt.push(Promise.resolve(void 0));if((lr==null?void 0:lr.length)>0){const fr=ur.result.keys[0];St.push(new BN(fr.node_index)),fr.share_metadata&&xt.push(decryptNodeData(fr.share_metadata,Buffer$g.from(fr.share,"base64").toString("binary").padStart(64,"0"),wt).catch(_r=>log$1.debug("share decryption",_r)))}else St.push(void 0),xt.push(Promise.resolve(void 0))}const Et=await Promise.all(xt.concat(At).concat(Rt)),Nt=Et.slice(0,xt.length),tr=Et.slice(xt.length,xt.length+At.length),ir=Et.slice(xt.length+At.length,Et.length),nr=tr.filter(Jt=>!!Jt),Zt=~~(it.length/2)+1;if(!ot.extended_verifier_id&&nr.length!!Jt);if(!ot.extended_verifier_id&&Kt.length{Jt?Tt.push({token:Jt.toString("base64"),signature:tr[ur].toString("hex"),node_pubx:jt[ur].result.node_pubx,node_puby:jt[ur].result.node_puby}):Tt.push(void 0)}),Ft.resolved)return;const Qt=Nt.reduce((Jt,ur,xr)=>(ur&&Jt.push({index:St[xr],value:new BN(ur)}),Jt),[]),Ht=kCombinations(Qt.length,~~(it.length/2)+1);let qt=null;for(let Jt=0;Jtur.includes(kr)),pr=xr.map(Sr=>Sr.value),Cr=xr.map(Sr=>Sr.index),Mr=lagrangeInterpolation(et,pr,Cr);if(!Mr)continue;const lr=getPublic(Buffer$g.from(Mr.toString(16,64),"hex")).toString("hex"),fr=lr.slice(2,66),_r=lr.slice(66);if(new BN(fr,16).cmp(new BN(vt.X,16))===0&&new BN(_r,16).cmp(new BN(vt.Y,16))===0){qt=Mr;break}}if(qt==null)throw new Error("could not derive private key");return{privateKey:qt,sessionTokenData:Tt,thresholdNonceData:It,nodeIndexes:St}}throw new Error("Invalid")})}).then(async Dt=>{var zt;const{privateKey:Ot,sessionTokenData:It,thresholdNonceData:Bt,nodeIndexes:Ft}=Dt;let jt=Bt;if(!Ot)throw new Error("Invalid private key returned");const bt=Ot,vt=getPublic(Buffer$g.from(bt.toString(16,64),"hex")).toString("hex"),ct=vt.slice(2,66),dt=vt.slice(66);let mt=new BN((zt=jt)!==null&&zt!==void 0&&zt.nonce?jt.nonce.padStart(64,"0"):"0","hex"),xt,At,Rt="v1";if(ot.extended_verifier_id)Rt="v2",xt=et.keyFromPublic({x:ct,y:dt}).getPublic();else if(LEGACY_NETWORKS_ROUTE_MAP[rt])if(j)jt=await getNonce(_,et,$,ct,dt,bt),mt=new BN(jt.nonce||"0",16),At={X:jt.pubNonce.x,Y:jt.pubNonce.y},Rt=jt.typeOfUser,Rt==="v2"&&(xt=et.keyFromPublic({x:ct,y:dt}).getPublic().add(et.keyFromPublic({x:jt.pubNonce.x,y:jt.pubNonce.y}).getPublic()));else{Rt="v1",mt=await getMetadata(_,{pub_key_X:ct,pub_key_Y:dt});const tr=bt.add(mt).umod(et.curve.n);xt=et.keyFromPrivate(tr.toString(16,64),"hex").getPublic()}else Rt="v2",xt=et.keyFromPublic({x:ct,y:dt}).getPublic().add(et.keyFromPublic({x:jt.pubNonce.x,y:jt.pubNonce.y}).getPublic()),At={X:jt.pubNonce.x,Y:jt.pubNonce.y};const St=generateAddressFromPrivKey(et,bt),Tt=generateAddressFromPubKey(et,xt.getX(),xt.getY());log$1.debug("> torus.js/retrieveShares",{finalEvmAddress:Tt});let Et="";(Rt==="v1"||Rt==="v2"&&mt.gt(new BN(0)))&&(Et=bt.add(mt).umod(et.curve.n).toString("hex",64));let Nt=!1;return Rt==="v1"?Nt=null:Rt==="v2"&&(Nt=mt.eq(new BN("0"))),{finalKeyData:{evmAddress:Tt,X:xt.getX().toString(16,64),Y:xt.getY().toString(16,64),privKey:Et},oAuthKeyData:{evmAddress:St,X:ct,Y:dt,privKey:bt.toString("hex",64).padStart(64,"0")},sessionData:{sessionTokenData:It,sessionAuthKey:wt.toString("hex").padStart(64,"0")},metadata:{pubNonce:At,nonce:mt,typeOfUser:Rt,upgraded:Nt},nodesData:{nodeIndexes:Ft.map(tr=>tr.toNumber())}}})}const legacyKeyLookup=async(a,_,$)=>{const j=a.map(et=>post(et,generateJsonRPCObject("VerifierLookupRequest",{verifier:_,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),~~(a.length/2)+1),nt=thresholdSame(tt.map(it=>it&&it.result),~~(a.length/2)+1);return nt||rt?Promise.resolve({keyResult:nt,errorResult:rt}):Promise.reject(new Error(`invalid results ${JSON.stringify(et)}`))})},legacyKeyAssign=async a=>{let{endpoints:_,torusNodePubs:$,lastPoint:j,firstPoint:et,verifier:tt,verifierId:rt,signerHost:nt,network:it,clientId:st}=a,ot,at;if(j===void 0?(ot=Math.floor(Math.random()*_.length),log$1.info("keyassign",ot,_[ot]),at=ot):ot=j%_.length,ot===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:$[ot].X,pubKeyY:$[ot].Y,network:it,clientId:st}},{useAPIKey:!0});return await post(_[ot],_objectSpread$1$2(_objectSpread$1$2({},ut),ht),{headers:{"Content-Type":"application/json; charset=utf-8"}})}catch(ht){log$1.error(ht.status,ht.message,ht,"key assign error");const yt=["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((ht==null?void 0:ht.status)===502||(ht==null?void 0:ht.status)===504||(ht==null?void 0:ht.status)===401||yt.includes(ht.message)||yt.some(wt=>ht.message.includes(wt))||ht.message&&ht.message.includes("reason: getaddrinfo EAI_AGAIN"))return legacyKeyAssign({endpoints:_,torusNodePubs:$,lastPoint:ot+1,firstPoint:at,verifier:tt,verifierId:rt,signerHost:nt,network:it,clientId:st});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. - - ${ht.message||""}`)}},legacyWaitKeyLookup=(a,_,$,j)=>new Promise((et,tt)=>{setTimeout(()=>{legacyKeyLookup(a,_,$).then(et).catch(tt)},j)});function ownKeys$4(a,_){var $=Object.keys(a);if(Object.getOwnPropertySymbols){var j=Object.getOwnPropertySymbols(a);_&&(j=j.filter(function(et){return Object.getOwnPropertyDescriptor(a,et).enumerable})),$.push.apply($,j)}return $}function _objectSpread$4(a){for(var _=1;_0&&arguments[0]!==void 0?arguments[0]:!0)?(log$1.enableAll(),config.logRequestTracing=!0):log$1.disableAll()}static setAPIKey(_){setAPIKey(_)}static setEmbedHost(_){setEmbedHost(_)}static isGetOrSetNonceError(_){return _ instanceof GetOrSetNonceError}static getPostboxKey(_){return _.metadata.typeOfUser==="v1"&&_.finalKeyData.privKey||_.oAuthKeyData.privKey}async retrieveShares(_,$,j,et,tt){let rt=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{};return this.isLegacyNetwork?this.legacyRetrieveShares(_,$,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:_,verifier:j,verifierParams:et,idToken:tt,importedShares:[],extraParams:rt})}async getPublicAddress(_,$,j){let{verifier:et,verifierId:tt,extendedVerifierId:rt}=j;return this.isLegacyNetwork?this.getLegacyPublicAddress(_,$,{verifier:et,verifierId:tt},this.enableOneKey):this.getNewPublicAddress(_,{verifier:et,verifierId:tt,extendedVerifierId:rt},this.enableOneKey)}async importPrivateKey(_,$,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(_.length!==$.length)throw new Error("length of endpoints array must be same as length of nodeIndexes array");const ot=~~(_.length/2)+1-1,at=[],ut=this.ec.keyFromPrivate(nt.padStart(64,"0"),"hex");for(const It of $)at.push(new BN(It));const ht=ut.getPrivate(),yt=new BN(generatePrivate()),wt=ht.sub(yt).umod(this.ec.curve.n),Ct=this.ec.keyFromPrivate(wt.toString("hex").padStart(64,"0")).getPublic(),$t=generateRandomPolynomial(this.ec,ot,wt).generateShares(at),Mt=this.generateNonceMetadataParams("getOrSetNonce",wt,yt),Lt=Buffer$g.from(stringify(Mt.set_data),"utf8").toString("base64"),Dt=[],zt=[];for(let It=0;It5&&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(),st=getPublic(it).toString("hex"),ot=st.slice(2,66),at=st.slice(66),ut=keccak256$1(Buffer$g.from(tt,"utf8"));for(let ht=0;ht<_.length;ht+=1){const yt=post(_[ht],generateJsonRPCObject("CommitmentRequest",{messageprefix:"mug00",tokencommitment:ut.slice(2),temppubx:ot,temppuby:at,verifieridentifier:j})).catch(wt=>{log$1.error("commitment",wt)});nt.push(yt)}return Some(nt,ht=>ht.filter(wt=>!(!wt||typeof wt!="object"||wt.error)).length>=~~(_.length/4)*3+1?Promise.resolve(ht):Promise.reject(new Error(`invalid ${JSON.stringify(ht)}`))).then(ht=>{const yt=[],wt=[];for(let Ct=0;Ctlog$1.error("share req",$t));yt.push(Pt)}return Some(yt,async(Ct,Pt)=>{const $t=Ct.filter(zt=>zt),Mt=thresholdSame(Ct.map(zt=>zt&&zt.result&&zt.result.keys[0].PublicKey),~~(_.length/2)+1);if($t.length>=~~(_.length/2)+1&&Mt){const zt=[],Ot=[];for(let bt=0;bt0){vt.result.keys.sort((dt,mt)=>new BN(dt.Index,16).cmp(new BN(mt.Index,16)));const ct=vt.result.keys[0];if(ct.Metadata){const dt={ephemPublicKey:Buffer$g.from(ct.Metadata.ephemPublicKey,"hex"),iv:Buffer$g.from(ct.Metadata.iv,"hex"),mac:Buffer$g.from(ct.Metadata.mac,"hex")};zt.push(decrypt(it,_objectSpread$4(_objectSpread$4({},dt),{},{ciphertext:Buffer$g.from(Buffer$g.from(ct.Share,"base64").toString("binary").padStart(64,"0"),"hex")})).catch(mt=>log$1.debug("share decryption",mt)))}else zt.push(Promise.resolve(Buffer$g.from(ct.Share.padStart(64,"0"),"hex")))}else zt.push(Promise.resolve(void 0));Ot.push(new BN($[bt],16))}const It=await Promise.all(zt);if(Pt.resolved)return;const Bt=It.reduce((bt,vt,ct)=>(vt&&bt.push({index:Ot[ct],value:new BN(vt)}),bt),[]),Ft=kCombinations(Bt.length,~~(_.length/2)+1);let jt=null;for(let bt=0;btvt.includes(Et)),dt=ct.map(Tt=>Tt.value),mt=ct.map(Tt=>Tt.index),xt=lagrangeInterpolation(this.ec,dt,mt);if(!xt)continue;const At=getPublic(Buffer$g.from(xt.toString(16,64),"hex")).toString("hex"),Rt=At.slice(2,66),St=At.slice(66);if(new BN(Rt,16).cmp(new BN(Mt.X,16))===0&&new BN(St,16).cmp(new BN(Mt.Y,16))===0){jt=xt;break}}if(jt==null)throw new Error("could not derive private key");return jt}throw new Error("invalid")})}).then(async ht=>{const yt=ht;if(!yt)throw new Error("Invalid private key returned");const wt=getPublic(Buffer$g.from(yt.toString(16,64),"hex")).toString("hex"),Ct=wt.slice(2,66),Pt=wt.slice(66);let $t,Mt,Lt="v1",Dt;if(this.enableOneKey){const Ft=await getNonce(this.legacyMetadataHost,this.ec,this.serverTimeOffset,Ct,Pt,yt);$t=new BN(Ft.nonce||"0",16),Lt=Ft.typeOfUser,Ft.typeOfUser==="v2"&&(Mt=this.ec.keyFromPublic({x:Ct,y:Pt}).getPublic().add(this.ec.keyFromPublic({x:Ft.pubNonce.x,y:Ft.pubNonce.y}).getPublic()),Dt={X:Ft.pubNonce.x,Y:Ft.pubNonce.y})}else{$t=await getMetadata(this.legacyMetadataHost,{pub_key_X:Ct,pub_key_Y:Pt});const Ft=yt.add($t).umod(this.ec.curve.n);Mt=this.ec.keyFromPrivate(Ft.toString("hex"),"hex").getPublic()}const zt=generateAddressFromPrivKey(this.ec,yt),Ot=generateAddressFromPubKey(this.ec,Mt.getX(),Mt.getY());log$1.debug("> torus.js/retrieveShares",{finalEvmAddress:Ot});let It="";(Lt==="v1"||Lt==="v2"&&$t.gt(new BN(0)))&&(It=yt.add($t).umod(this.ec.curve.n).toString("hex",64).padStart(64,"0"));let Bt=!1;return Lt==="v1"?Bt=null:Lt==="v2"&&(Bt=$t.eq(new BN("0"))),{finalKeyData:{evmAddress:Ot,X:Mt?Mt.getX().toString(16,64):"",Y:Mt?Mt.getY().toString(16,64):"",privKey:It},oAuthKeyData:{evmAddress:zt,X:Ct,Y:Pt,privKey:yt.toString("hex",64).padStart(64,"0")},sessionData:{sessionTokenData:[],sessionAuthKey:""},metadata:{pubNonce:Dt,nonce:$t,typeOfUser:Lt,upgraded:Bt},nodesData:{nodeIndexes:[]}}})}async getLegacyPublicAddress(_,$,j,et){let{verifier:tt,verifierId:rt}=j;log$1.debug("> torus.js/getPublicAddress",{endpoints:_,torusNodePubs:$,verifier:tt,verifierId:rt});let nt,it=!1;const{keyResult:st,errorResult:ot}=await legacyKeyLookup(_,tt,rt)||{};if(ot&&JSON.stringify(ot).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(ot&&JSON.stringify(ot).includes("Verifier + VerifierID has not yet been assigned")){await legacyKeyAssign({endpoints:_,torusNodePubs:$,lastPoint:void 0,firstPoint:void 0,verifier:tt,verifierId:rt,signerHost:this.signerHost,network:this.network,clientId:this.clientId});const at=await legacyWaitKeyLookup(_,tt,rt,1e3);nt=at==null?void 0:at.keyResult,it=!0}else if(st)nt=st;else throw new Error(`node results do not match at first lookup ${JSON.stringify(st||{})}, ${JSON.stringify(ot||{})}`);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(st||{})}, ${JSON.stringify(ot||{})}`)}generateNonceMetadataParams(_,$,j){const et=this.ec.keyFromPrivate($.toString("hex",64)),tt={operation:_,timestamp:new BN(~~(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("").toString(16,2),"hex").toString("base64")}}async getNewPublicAddress(_,$,j){let{verifier:et,verifierId:tt,extendedVerifierId:rt}=$;log$1.debug("> torus.js/getPublicAddress",{endpoints:_,verifier:et,verifierId:tt});const nt=await GetPubKeyOrKeyAssign({endpoints:_,network:this.network,verifier:et,verifierId:tt,extendedVerifierId:rt}),{errorResult:it,keyResult:st,nodeIndexes:ot=[]}=nt,{nonceResult:at}=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(st||{})}, ${JSON.stringify(it||{})}`);if(log$1.debug("> torus.js/getPublicAddress",{keyResult:st}),!(st!=null&&st.keys))throw new Error(`node results do not match at final lookup ${JSON.stringify(st||{})}, ${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}=st.keys[0];let yt;const wt=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:st.is_new_key,enableOneKey:j,finalKeyResult:{keys:st.keys}});{const It=at;Ct=this.ec.keyFromPublic({x:ut,y:ht}).getPublic(),Pt=this.ec.keyFromPublic({x:ut,y:ht}).getPublic().add(this.ec.keyFromPublic({x:It.pubNonce.x,y:It.pubNonce.y}).getPublic()),yt={X:It.pubNonce.x,Y:It.pubNonce.y}}}if(!Ct)throw new Error("Unable to derive oAuthPubKey");const $t=Ct.getX().toString(16,64),Mt=Ct.getY().toString(16,64),Lt=generateAddressFromPubKey(this.ec,Ct.getX(),Ct.getY());if(log$1.debug("> torus.js/getPublicAddress, oAuthKeyData",{X:$t,Y:Mt,oAuthAddress:Lt,nonce:wt==null?void 0:wt.toString(16),pubNonce:yt}),!Pt)throw new Error("Unable to derive finalPubKey");const Dt=Pt?Pt.getX().toString(16,64):"",zt=Pt?Pt.getY().toString(16,64):"",Ot=Pt?generateAddressFromPubKey(this.ec,Pt.getX(),Pt.getY()):"";return{oAuthKeyData:{evmAddress:Lt,X:$t,Y:Mt},finalKeyData:{evmAddress:Ot,X:Dt,Y:zt},metadata:{pubNonce:yt,nonce:wt,upgraded:(at==null?void 0:at.upgraded)||!1,typeOfUser:"v2"},nodesData:{nodeIndexes:ot}}}async formatLegacyPublicKeyData(_){var $,j;const{finalKeyResult:et,enableOneKey:tt,isNewKey:rt}=_,{pub_key_X:nt,pub_key_Y:it}=et.keys[0];let st,ot,at,ut,ht;const yt=this.ec.keyFromPublic({x:nt,y:it}).getPublic();if(tt){try{st=await getOrSetNonce(this.legacyMetadataHost,this.ec,this.serverTimeOffset,nt,it,void 0,!rt),ot=new BN(st.nonce||"0",16),ut=st.typeOfUser}catch{throw new GetOrSetNonceError}if(st.typeOfUser==="v1")at=this.ec.keyFromPublic({x:nt,y:it}).getPublic().add(this.ec.keyFromPrivate(ot.toString(16)).getPublic());else if(st.typeOfUser==="v2")at=this.ec.keyFromPublic({x:nt,y:it}).getPublic().add(this.ec.keyFromPublic({x:st.pubNonce.x,y:st.pubNonce.y}).getPublic()),ht={X:st.pubNonce.x,Y:st.pubNonce.y};else throw new Error("getOrSetNonce should always return typeOfUser.")}else ut="v1",ot=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(ot.toString(16)).getPublic());if(!yt)throw new Error("Unable to derive oAuthPubKey");const wt=yt.getX().toString(16,64),Ct=yt.getY().toString(16,64),Pt=generateAddressFromPubKey(this.ec,yt.getX(),yt.getY());if(log$1.debug("> torus.js/getPublicAddress, oAuthKeyData",{X:wt,Y:Ct,oAuthAddress:Pt,nonce:($=ot)===null||$===void 0?void 0:$.toString(16),pubNonce:ht}),ut==="v2"&&!at)throw new Error("Unable to derive finalPubKey");const $t=at?at.getX().toString(16,64):"",Mt=at?at.getY().toString(16,64):"",Lt=at?generateAddressFromPubKey(this.ec,at.getX(),at.getY()):"";return{oAuthKeyData:{evmAddress:Pt,X:wt,Y:Ct},finalKeyData:{evmAddress:Lt,X:$t,Y:Mt},metadata:{pubNonce:ht,nonce:ot,upgraded:((j=st)===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(a){return window.addEventListener("load",a)}):waitWindowLoad={then:function(a){return window.addEventListener("load",a)}});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(_,et,j),navigator.serviceWorker.ready.then(function(tt){et("ready",tt)})):(registerValidSW(_,et,j),navigator.serviceWorker.ready.then(function(tt){et("ready",tt)}))})};function handleError(a,_){navigator.onLine||a("offline"),a("error",_)}function registerValidSW(a,_,$){navigator.serviceWorker.register(a,$).then(function(j){if(_("registered",j),j.waiting){_("updated",j);return}j.onupdatefound=function(){_("updatefound",j);var et=j.installing;et.onstatechange=function(){et.state==="installed"&&(navigator.serviceWorker.controller?_("updated",j):_("cached",j))}}}).catch(function(j){return handleError(_,j)})}function checkValidServiceWorker(a,_,$){fetch(a).then(function(j){j.status===404?(_("error",new Error("Service worker not found at "+a)),unregister()):j.headers.get("content-type").indexOf("javascript")===-1?(_("error",new Error("Expected "+a+" to have javascript content-type, but received "+j.headers.get("content-type"))),unregister()):registerValidSW(a,_,$)}).catch(function(j){return handleError(_,j)})}function keccak256(a){return Buffer$g.from(keccak256$3(a))}const ec=new elliptic$1.ec("secp256k1");function encParamsHexToBuf(a){return{iv:Buffer$g.from(a.iv,"hex"),ephemPublicKey:Buffer$g.from(a.ephemPublicKey,"hex"),ciphertext:Buffer$g.from(a.ciphertext,"hex"),mac:Buffer$g.from(a.mac,"hex")}}function encParamsBufToHex(a){return{iv:Buffer$g.from(a.iv).toString("hex"),ephemPublicKey:Buffer$g.from(a.ephemPublicKey).toString("hex"),ciphertext:Buffer$g.from(a.ciphertext).toString("hex"),mac:Buffer$g.from(a.mac).toString("hex")}}async function encryptData(a,_){const $=JSON.stringify(_),j=Buffer$g.from($,"utf-8"),et=await encrypt(getPublic(Buffer$g.from(a,"hex")),j),tt=encParamsBufToHex(et);return JSON.stringify(tt)}async function decryptData(a,_){const $=JSON.parse(_),j=encParamsHexToBuf($),et=ec.keyFromPrivate(a),rt=(await decrypt(Buffer$g.from(et.getPrivate().toString("hex",64),"hex"),j)).toString("utf-8");return JSON.parse(rt)}const LOGIN={GOOGLE:"google",FACEBOOK:"facebook",REDDIT:"reddit",DISCORD:"discord",TWITCH:"twitch",APPLE:"apple",GITHUB:"github",LINKEDIN:"linkedin",TWITTER:"twitter",WEIBO:"weibo",LINE:"line",EMAIL_PASSWORD:"email_password",PASSWORDLESS:"passwordless",JWT:"jwt",WEBAUTHN:"webauthn"},AGGREGATE_VERIFIER={SINGLE_VERIFIER_ID:"single_id_verifier"},UX_MODE={POPUP:"popup",REDIRECT:"redirect"},REDIRECT_PARAMS_STORAGE_METHOD={LOCAL_STORAGE:"localStorage",SESSION_STORAGE:"sessionStorage",SERVER:"server"},TORUS_METHOD={TRIGGER_LOGIN:"triggerLogin",TRIGGER_AGGREGATE_LOGIN:"triggerAggregateLogin",TRIGGER_AGGREGATE_HYBRID_LOGIN:"triggerHybridAggregateLogin"},SENTRY_TXNS={FETCH_NODE_DETAILS:"fetchNodeDetails",PUB_ADDRESS_LOOKUP:"pubAddressLookup",FETCH_SHARES:"fetchShares"};var log=log$1$1.getLogger("customauth");const loginToConnectionMap={[LOGIN.APPLE]:"apple",[LOGIN.GITHUB]:"github",[LOGIN.LINKEDIN]:"linkedin",[LOGIN.TWITTER]:"twitter",[LOGIN.WEIBO]:"weibo",[LOGIN.LINE]:"line",[LOGIN.EMAIL_PASSWORD]:"Username-Password-Authentication",[LOGIN.PASSWORDLESS]:"email"},padUrlString=a=>a.href.endsWith("/")?a.href:`${a.href}/`,randomId=()=>Math.random().toString(36).slice(2),broadcastChannelOptions={webWorkerSupport:!1};function caseSensitiveField(a,_){return _?a:a.toLowerCase()}const getVerifierId=function(a,_,$){let j=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0;const{name:et,sub:tt}=a;if($)return caseSensitiveField(a[$],j);switch(_){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 $=a.split("&").reduce((tt,rt)=>{const[nt,it]=rt.split("=");return tt[nt]=it,tt},{});log.info($,_);let j={},et="";return Object.keys($).length>0&&$.state?(j=JSON.parse(atob(decodeURIComponent(decodeURIComponent($.state))))||{},et=$.error_description||$.error||et):Object.keys(_).length>0&&_.state&&(j=JSON.parse(atob(decodeURIComponent(decodeURIComponent(_.state))))||{},_.error&&(et=_.error)),{error:et,instanceParameters:j,hashParameters:$}};function storageAvailable(a){let _;try{_=window[a];const $="__storage_test__";return _.setItem($,$),_.removeItem($),!0}catch($){return $&&($.code===22||$.code===1014||$.name==="QuotaExceededError"||$.name==="NS_ERROR_DOM_QUOTA_REACHED")&&_&&_.length!==0}}function getPopupFeatures(){const a=window.screenLeft!==void 0?window.screenLeft:window.screenX,_=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+a),it=Math.abs((tt-j)/2/rt+_);return`titlebar=0,toolbar=0,status=0,location=0,menubar=0,height=${j/rt},width=${$/rt},top=${it},left=${nt}`}const isFirefox=()=>{var a,_;return((a=window)===null||a===void 0||(_=a.navigator)===null||_===void 0?void 0:_.userAgent.toLowerCase().indexOf("firefox"))>-1||!1};function constructURL(a){const{baseURL:_,query:$,hash:j}=a,et=new URL(_);if($&&Object.keys($).forEach(tt=>{et.searchParams.append(tt,$[tt])}),j){const tt=new URL(constructURL({baseURL:_,query:j})).searchParams.toString();et.hash=tt}return et.toString()}function are3PCSupported(){var a;const _=Bowser.parse(navigator.userAgent);log.info(JSON.stringify(_),"current browser info");let $=!0;return(a=navigator)!==null&&a!==void 0&&a.brave&&($=!1),(_.engine.name===Bowser.ENGINE_MAP.WebKit||_.engine.name===Bowser.ENGINE_MAP.Gecko)&&($=!1),$}const validateAndConstructUrl=a=>{try{return new URL(decodeURIComponent(a))}catch(_){throw new Error(`${(_==null?void 0:_.message)||""}, Note: Your jwt domain: (i.e ${a}) must have http:// or https:// prefix`)}};function isMobileOrTablet(){const _=Bowser.getParser(navigator.userAgent).getPlatform();return _.type===Bowser.PLATFORMS_MAP.tablet||_.type===Bowser.PLATFORMS_MAP.mobile}function getTimeout(a){return(a===LOGIN.FACEBOOK||a===LOGIN.LINE)&&isMobileOrTablet()?1e3*60:1e3*10}class PopupHandler extends eventsExports.EventEmitter{constructor(_){let{url:$,target:j,features:et,timeout:tt=3e4}=_;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.window&&(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 _;return this.window=window.open(this.url.href,this.target,this.features),(_=this.window)!==null&&_!==void 0&&_.focus&&this.window.focus(),Promise.resolve()}close(){this.iClosedWindow=!0,this.window&&this.window.close()}redirect(_){_?window.location.replace(this.url.href):window.location.href=this.url.href}}const _excluded$2=["access_token","id_token"];function ownKeys$2(a,_){var $=Object.keys(a);if(Object.getOwnPropertySymbols){var j=Object.getOwnPropertySymbols(a);_&&(j=j.filter(function(et){return Object.getOwnPropertyDescriptor(a,et).enumerable})),$.push.apply($,j)}return $}function _objectSpread$2(a){for(var _=1;_{let tt;const rt=async nt=>{try{const{error:it,data:st}=nt,ot=st||{},{instanceParams:at,hashParams:{access_token:ut,id_token:ht}}=ot,yt=_objectWithoutProperties(ot.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(_objectSpread$2(_objectSpread$2({accessToken:ut,idToken:ht||""},yt),{},{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 st=it.data;st.channel===`redirect_channel_${this.nonce}`&&(window.removeEventListener("message",nt),rt(st),$.close())};window.addEventListener("message",nt)}$.open(),$.once("close",()=>{tt&&tt.close(),et(new Error("user closed popup"))})});return null}}class DiscordHandler extends AbstractLoginHandler{constructor(_,$,j,et,tt,rt,nt,it){super(_,$,j,et,tt,rt,nt,it),_defineProperty$4(this,"clientId",void 0),_defineProperty$4(this,"verifier",void 0),_defineProperty$4(this,"redirect_uri",void 0),_defineProperty$4(this,"typeOfLogin",void 0),_defineProperty$4(this,"uxMode",void 0),_defineProperty$4(this,"redirectToOpener",void 0),_defineProperty$4(this,"jwtParams",void 0),_defineProperty$4(this,"customState",void 0),_defineProperty$4(this,"RESPONSE_TYPE","token"),_defineProperty$4(this,"SCOPE","identify email"),this.clientId=_,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 _=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]&&_.searchParams.append(et,j[et])}),this.finalURL=_}async getUserInfo(_){const{accessToken:$}=_,j=await get("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(_,$,j,et,tt,rt,nt,it){super(_,$,j,et,tt,rt,nt,it),_defineProperty$4(this,"clientId",void 0),_defineProperty$4(this,"verifier",void 0),_defineProperty$4(this,"redirect_uri",void 0),_defineProperty$4(this,"typeOfLogin",void 0),_defineProperty$4(this,"uxMode",void 0),_defineProperty$4(this,"redirectToOpener",void 0),_defineProperty$4(this,"jwtParams",void 0),_defineProperty$4(this,"customState",void 0),_defineProperty$4(this,"RESPONSE_TYPE","token"),_defineProperty$4(this,"SCOPE","public_profile email"),this.clientId=_,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 _=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]&&_.searchParams.append(et,j[et])}),this.finalURL=_}async getUserInfo(_){const{accessToken:$}=_,j=await get("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(_,$,j,et,tt,rt,nt,it){super(_,$,j,et,tt,rt,nt,it),_defineProperty$4(this,"clientId",void 0),_defineProperty$4(this,"verifier",void 0),_defineProperty$4(this,"redirect_uri",void 0),_defineProperty$4(this,"typeOfLogin",void 0),_defineProperty$4(this,"uxMode",void 0),_defineProperty$4(this,"redirectToOpener",void 0),_defineProperty$4(this,"jwtParams",void 0),_defineProperty$4(this,"customState",void 0),_defineProperty$4(this,"RESPONSE_TYPE","token id_token"),_defineProperty$4(this,"SCOPE","profile email openid"),_defineProperty$4(this,"PROMPT","consent select_account"),this.clientId=_,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 _=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]&&_.searchParams.append(et,j[et])}),this.finalURL=_}async getUserInfo(_){const{accessToken:$}=_,j=await get("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(_,$,j,et,tt,rt,nt,it){super(_,$,j,et,tt,rt,nt,it),_defineProperty$4(this,"clientId",void 0),_defineProperty$4(this,"verifier",void 0),_defineProperty$4(this,"redirect_uri",void 0),_defineProperty$4(this,"typeOfLogin",void 0),_defineProperty$4(this,"uxMode",void 0),_defineProperty$4(this,"redirectToOpener",void 0),_defineProperty$4(this,"jwtParams",void 0),_defineProperty$4(this,"customState",void 0),_defineProperty$4(this,"SCOPE","openid profile email"),_defineProperty$4(this,"RESPONSE_TYPE","token id_token"),_defineProperty$4(this,"PROMPT","login"),this.clientId=_,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{domain:_}=this.jwtParams,$=validateAndConstructUrl(_);$.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(_){const{idToken:$,accessToken:j}=_,{domain:et,verifierIdField:tt,isVerifierIdCaseSensitive:rt,user_info_route:nt="userinfo"}=this.jwtParams;if(j)try{const it=new URL(et),st=await get(`${padUrlString(it)}${nt}`,{headers:{Authorization:`Bearer ${j}`}}),{picture:ot,name:at,email:ut}=st;return{email:ut,name:at,profileImage:ot,verifierId:getVerifierId(st,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:st,email:ot,picture:at}=it;return{profileImage:at,name:st,email:ot,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(_,$,j,et,tt,rt,nt,it){super(_,$,j,et,tt,rt,nt,it),_defineProperty$4(this,"clientId",void 0),_defineProperty$4(this,"verifier",void 0),_defineProperty$4(this,"redirect_uri",void 0),_defineProperty$4(this,"typeOfLogin",void 0),_defineProperty$4(this,"uxMode",void 0),_defineProperty$4(this,"redirectToOpener",void 0),_defineProperty$4(this,"jwtParams",void 0),_defineProperty$4(this,"customState",void 0),this.clientId=_,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 _=JSON.parse(JSON.stringify(this.jwtParams));delete _.domain;const $=deepmerge$1({state:this.state,client_id:this.clientId,nonce:this.nonce},_);this.finalURL=new URL(constructURL({baseURL:this.redirect_uri,query:null,hash:$}))}async getUserInfo(_){const{idToken:$,accessToken:j}=_,{domain:et,verifierIdField:tt,isVerifierIdCaseSensitive:rt,user_info_route:nt="userinfo"}=this.jwtParams;if(j)try{const it=new URL(et),st=await get(`${padUrlString(it)}${nt}`,{headers:{Authorization:`Bearer ${j}`}}),{picture:ot,name:at,email:ut}=st;return{email:ut,name:at,profileImage:ot,verifierId:getVerifierId(st,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:st,email:ot,picture:at}=it;return{profileImage:at,name:st,email:ot,verifierId:getVerifierId(it,this.typeOfLogin,tt,rt),verifier:this.verifier,typeOfLogin:this.typeOfLogin}}throw new Error("Access/id token not available")}handleLoginWindow(_){const{id_token:$,access_token:j}=this.jwtParams,et=new PopupHandler({url:this.finalURL,features:_.popupFeatures});if(this.uxMode===UX_MODE.REDIRECT)et.redirect(_.locationReplaceOnRedirect);else return Promise.resolve({state:{},idToken:$,accessToken:j});return null}}const _excluded$1=["access_token","id_token"];function ownKeys$1$1(a,_){var $=Object.keys(a);if(Object.getOwnPropertySymbols){var j=Object.getOwnPropertySymbols(a);_&&(j=j.filter(function(et){return Object.getOwnPropertyDescriptor(a,et).enumerable})),$.push.apply($,j)}return $}function _objectSpread$1$1(a){for(var _=1;_{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:st,hashParams:{access_token:ot,id_token:at}}=it,ut=_objectWithoutProperties(it.hashParams,_excluded$1);if(rt){log.error(tt.error),$(new Error(rt));return}tt.data&&st.verifier===this.verifier&&(log.info(tt.data),_(_objectSpread$1$1(_objectSpread$1$1({accessToken:ot,idToken:at||""},ut),{},{state:st})))}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(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(_,$,j,et,tt,rt,nt,it){super(_,$,j,et,tt,rt,nt,it),_defineProperty$4(this,"clientId",void 0),_defineProperty$4(this,"verifier",void 0),_defineProperty$4(this,"redirect_uri",void 0),_defineProperty$4(this,"typeOfLogin",void 0),_defineProperty$4(this,"uxMode",void 0),_defineProperty$4(this,"redirectToOpener",void 0),_defineProperty$4(this,"jwtParams",void 0),_defineProperty$4(this,"customState",void 0),_defineProperty$4(this,"RESPONSE_TYPE","token"),_defineProperty$4(this,"SCOPE","identity"),this.clientId=_,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 _=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]&&_.searchParams.append(et,j[et])}),this.finalURL=_}async getUserInfo(_){const{accessToken:$}=_,j=await get("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(_,$,j,et,tt,rt,nt,it){super(_,$,j,et,tt,rt,nt,it),_defineProperty$4(this,"clientId",void 0),_defineProperty$4(this,"verifier",void 0),_defineProperty$4(this,"redirect_uri",void 0),_defineProperty$4(this,"typeOfLogin",void 0),_defineProperty$4(this,"uxMode",void 0),_defineProperty$4(this,"redirectToOpener",void 0),_defineProperty$4(this,"jwtParams",void 0),_defineProperty$4(this,"customState",void 0),_defineProperty$4(this,"RESPONSE_TYPE","token"),_defineProperty$4(this,"SCOPE","user:read:email"),this.clientId=_,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 _=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]&&_.searchParams.append(et,j[et])}),this.finalURL=_}async getUserInfo(_){const{accessToken:$}=_,j=await get("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(_,$,j,et,tt,rt,nt,it,st){super(_,$,j,et,tt,rt,nt,it),_defineProperty$4(this,"clientId",void 0),_defineProperty$4(this,"verifier",void 0),_defineProperty$4(this,"redirect_uri",void 0),_defineProperty$4(this,"typeOfLogin",void 0),_defineProperty$4(this,"uxMode",void 0),_defineProperty$4(this,"redirectToOpener",void 0),_defineProperty$4(this,"jwtParams",void 0),_defineProperty$4(this,"customState",void 0),_defineProperty$4(this,"registerOnly",void 0),this.clientId=_,this.verifier=$,this.redirect_uri=j,this.typeOfLogin=et,this.uxMode=tt,this.redirectToOpener=rt,this.jwtParams=nt,this.customState=it,this.registerOnly=st,this.setFinalUrl()}setFinalUrl(){const{webauthnURL:_}=this.customState||{},$=_?new URL(_):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(_){const{idToken:$,ref:j,extraParamsPassed:et,extraParams:tt}=_;let rt,nt,it,st,ot,at,ut,ht,yt;if(et==="true"){log.debug("extraParamsPassed is true, using extraParams passed through hashParams");try{({verifier_id:rt,signature:nt,clientDataJSON:it,authenticatorData:st,publicKey:ot,challenge:at,rpOrigin:ut,credId:ht,transports:yt}=JSON.parse(atob(tt)))}catch(wt){log.warn("unable to parse extraParams",wt),{verifier_id:rt,signature:nt,clientDataJSON:it,authenticatorData:st,publicKey:ot,challenge:at,rpOrigin:ut,credId:ht,transports:yt}=await get(`${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:st,publicKey:ot,challenge:at,rpOrigin:ut,credId:ht,transports:yt}=await get(`${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:st,publicKey:ot,challenge:at,rpOrigin:ut,credId:ht,transports:yt}}}}const createHandler=a=>{let{clientId:_,redirect_uri:$,typeOfLogin:j,verifier:et,jwtParams:tt,redirectToOpener:rt,uxMode:nt,customState:it,registerOnly:st}=a;if(!et||!j||!_)throw new Error("Invalid params");const{domain:ot,login_hint:at,id_token:ut,access_token:ht}=tt||{};switch(j){case LOGIN.GOOGLE:return new GoogleHandler(_,et,$,j,nt,rt,tt,it);case LOGIN.FACEBOOK:return new FacebookHandler(_,et,$,j,nt,rt,tt,it);case LOGIN.TWITCH:return new TwitchHandler(_,et,$,j,nt,rt,tt,it);case LOGIN.REDDIT:return new RedditHandler(_,et,$,j,nt,rt,tt,it);case LOGIN.DISCORD:return new DiscordHandler(_,et,$,j,nt,rt,tt,it);case LOGIN.PASSWORDLESS:if(!ot||!at)throw new Error("Invalid params");return new JwtHandler(_,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(_,et,$,j,nt,rt,tt,it);if(!ot)throw new Error("Invalid params");return new JwtHandler$1(_,et,$,j,nt,rt,tt,it);case LOGIN.WEBAUTHN:return new WebAuthnHandler(_,et,$,j,nt,rt,tt,it,st);default:throw new Error("Invalid login type")}},registerServiceWorker=a=>new Promise((_,$)=>{const j=`${a}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`),_(void 0)},registered(){log.info("Service worker has been registered."),_(void 0)},cached(){log.info("Content has been cached for offline use."),_(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(_){_defineProperty$4(this,"sentry",null),this.sentry=_}startTransaction(_){if(this.sentry)return this.sentry.startTransaction(_)}finishTransaction(_){_&&_.finish()}}class StorageHelper{constructor(_){_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=_}init(){const _=are3PCSupported(),$=storageAvailable(REDIRECT_PARAMS_STORAGE_METHOD.LOCAL_STORAGE);_&&$?this.currentStorageMethod=REDIRECT_PARAMS_STORAGE_METHOD.LOCAL_STORAGE:this.currentStorageMethod=REDIRECT_PARAMS_STORAGE_METHOD.SERVER,this.isInitialized=!0}async storeLoginDetails(_,$){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,_),nt=(await sign(j,keccak256(Buffer$g.from(rt,"utf8")))).toString("hex");await post(`${this.storageServerUrl}/store/set`,{key:tt,data:rt,signature:nt})}else window.localStorage.setItem(`torus_login_${$}`,JSON.stringify(_))}async retrieveLoginDetails(_){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");try{const rt=await get(`${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_${_}`);return JSON.parse($||"{}")}clearLoginDetailsStorage(_){if(!this.isInitialized)throw new Error("StorageHelper is not initialized");this.currentStorageMethod===REDIRECT_PARAMS_STORAGE_METHOD.LOCAL_STORAGE&&window.localStorage.removeItem(`torus_login_${_}`)}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"];function ownKeys$3(a,_){var $=Object.keys(a);if(Object.getOwnPropertySymbols){var j=Object.getOwnPropertySymbols(a);_&&(j=j.filter(function(et){return Object.getOwnPropertyDescriptor(a,et).enumerable})),$.push.apply($,j)}return $}function _objectSpread$3(a){for(var _=1;_0&&arguments[0]!==void 0?arguments[0]:{};if(this.storageHelper.init(),$){this.isInitialized=!0;return}if(!_)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(_){const{verifier:$,typeOfLogin:j,clientId:et,jwtParams:tt,hash:rt,queryParameters:nt,customState:it,registerOnly:st}=_;if(log.info("Verifier: ",$),!this.isInitialized)throw new Error("Not initialized yet");if(st&&j!==LOGIN.WEBAUTHN)throw new Error("registerOnly flag can only be passed for webauthn");const ot=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:st});let at;if(rt&&nt){const{error:yt,hashParameters:wt,instanceParameters:Ct}=handleRedirectParameters(rt,nt);if(yt)throw new Error(yt);const{access_token:Pt,id_token:$t}=wt,Mt=_objectWithoutProperties(wt,_excluded);at=_objectSpread$3(_objectSpread$3({accessToken:Pt,idToken:$t},Mt),{},{state:Ct})}else if(this.storageHelper.clearOrphanedLoginDetails(),this.config.uxMode===UX_MODE.REDIRECT&&await this.storageHelper.storeLoginDetails({method:TORUS_METHOD.TRIGGER_LOGIN,args:_},ot.nonce),at=await ot.handleLoginWindow({locationReplaceOnRedirect:this.config.locationReplaceOnRedirect,popupFeatures:this.config.popupFeatures}),this.config.uxMode===UX_MODE.REDIRECT)return null;const ut=await ot.getUserInfo(at);if(st){const yt=this.sentryHandler.startTransaction({name:SENTRY_TXNS.FETCH_NODE_DETAILS}),wt=await this.nodeDetailManager.getNodeDetails({verifier:$,verifierId:ut.verifierId});this.sentryHandler.finishTransaction(yt);const Ct=this.sentryHandler.startTransaction({name:SENTRY_TXNS.PUB_ADDRESS_LOOKUP}),Pt=await this.torus.getPublicAddress(wt.torusNodeEndpoints,wt.torusNodePub,{verifier:$,verifierId:ut.verifierId});this.sentryHandler.finishTransaction(Ct);const $t={userInfo:_objectSpread$3(_objectSpread$3({},ut),at)};return _objectSpread$3(_objectSpread$3(_objectSpread$3({},$t),Pt),{},{finalKeyData:_objectSpread$3(_objectSpread$3({},Pt.finalKeyData),{},{privKey:void 0}),oAuthKeyData:_objectSpread$3(_objectSpread$3({},Pt.finalKeyData),{},{privKey:void 0}),metadata:_objectSpread$3(_objectSpread$3({},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 _objectSpread$3(_objectSpread$3({},ht),{},{userInfo:_objectSpread$3(_objectSpread$3({},ut),at)})}async triggerAggregateLogin(_){const{aggregateVerifierType:$,verifierIdentifier:j,subVerifierDetailsArray:et}=_;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 wt of et){const{clientId:Ct,typeOfLogin:Pt,verifier:$t,jwtParams:Mt,hash:Lt,queryParameters:Dt,customState:zt}=wt,Ot=createHandler({typeOfLogin:Pt,clientId:Ct,verifier:$t,redirect_uri:this.config.redirect_uri,redirectToOpener:this.config.redirectToOpener,jwtParams:Mt,uxMode:this.config.uxMode,customState:zt});let It;if(Lt&&Dt){const{error:Bt,hashParameters:Ft,instanceParameters:jt}=handleRedirectParameters(Lt,Dt);if(Bt)throw new Error(Bt);const{access_token:bt,id_token:vt}=Ft,ct=_objectWithoutProperties(Ft,_excluded2);It=_objectSpread$3(_objectSpread$3({accessToken:bt,idToken:vt},ct),{},{state:jt})}else if(this.storageHelper.clearOrphanedLoginDetails(),this.config.uxMode===UX_MODE.REDIRECT&&await this.storageHelper.storeLoginDetails({method:TORUS_METHOD.TRIGGER_AGGREGATE_LOGIN,args:_},Ot.nonce),It=await Ot.handleLoginWindow({locationReplaceOnRedirect:this.config.locationReplaceOnRedirect,popupFeatures:this.config.popupFeatures}),this.config.uxMode===UX_MODE.REDIRECT)return null;tt.push(Ot.getUserInfo(It)),rt.push(It)}const it=(await Promise.all(tt)).map(wt=>_objectSpread$3(_objectSpread$3({},wt),{},{aggregateVerifier:j})),st={verify_params:[],sub_verifier_ids:[],verifier_id:""},ot=[];let at="",ut={};for(let wt=0;wt_objectSpread$3(_objectSpread$3({},wt),rt[Ct]))})}async triggerHybridAggregateLogin(_){const{singleLogin:$,aggregateLoginParams:j}=_;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:st,customState:ot}=$,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:ot});let ut;if(it&&st){const{error:It,hashParameters:Bt,instanceParameters:Ft}=handleRedirectParameters(it,st);if(It)throw new Error(It);const{access_token:jt,id_token:bt}=Bt,vt=_objectWithoutProperties(Bt,_excluded3);ut=_objectSpread$3(_objectSpread$3({accessToken:jt,idToken:bt},vt),{},{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:_},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),yt=this.getTorusKey(rt,ht.verifierId,{verifier_id:ht.verifierId},ut.idToken||ut.accessToken,ht.extraVerifierParams),{verifierIdentifier:wt,subVerifierDetailsArray:Ct}=j,Pt={verify_params:[],sub_verifier_ids:[],verifier_id:""},$t=[];let Mt="";for(let It=0;It0&&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((wt,Ct)=>{tt[Ct]=wt}),_){const wt=window.location.origin+window.location.pathname;window.history.replaceState(_objectSpread$3(_objectSpread$3({},window.history.state),{},{as:wt,url:wt}),"",wt)}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:st}=nt;log.info(st,"instanceId");const ot=await this.storageHelper.retrieveLoginDetails(st),{args:at,method:ut}=ot,ht=_objectWithoutProperties(ot,_excluded4);if(log.info(at,ut),$&&this.storageHelper.clearLoginDetailsStorage(st),rt)return{error:rt,state:nt||{},method:ut,result:{},hashParameters:it,args:at};let yt;try{if(ut===TORUS_METHOD.TRIGGER_LOGIN){const wt=at;wt.hash=et,wt.queryParameters=tt,yt=await this.triggerLogin(wt)}else if(ut===TORUS_METHOD.TRIGGER_AGGREGATE_LOGIN){const wt=at;wt.subVerifierDetailsArray.forEach(Ct=>{Ct.hash=et,Ct.queryParameters=tt}),yt=await this.triggerAggregateLogin(wt)}else if(ut===TORUS_METHOD.TRIGGER_AGGREGATE_HYBRID_LOGIN){const wt=at;wt.singleLogin.hash=et,wt.singleLogin.queryParameters=tt,yt=await this.triggerHybridAggregateLogin(wt)}}catch(wt){return log.error(wt),_objectSpread$3({error:`Could not get result from torus nodes - ${(wt==null?void 0:wt.message)||""}`,state:nt||{},method:ut,result:{},hashParameters:it,args:at},ht)}return _objectSpread$3(yt?{method:ut,result:yt,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((_,$)=>{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,_()};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 withTimeout=(a,_,$)=>Promise.race([a(),new Promise((j,et)=>setTimeout(()=>{et(new Error("The operation has timed out"))},_))]),LOGIN_TIMEOUT=60*1e3,WEB3_AUTH_CLIENT_ID="BBQoFIabI50S1-0QsGHGTM4qID_FDjja0ZxIxKPyFqc0El--M-EG0c2giaBYVTVVE6RC9WCUzCJyW24aJrR_Lzc",SUB_VERIFIER_CLIENT_ID="1070572364808-d31nlkneam5ee6dr0tu28fjjbsdkfta5.apps.googleusercontent.com",getGoogleCredentials=async()=>withTimeout(async()=>{const a=new CustomAuth({web3AuthClientId:WEB3_AUTH_CLIENT_ID,baseUrl:"https://umamiwallet.com/auth/v2.0.1/",redirectPathName:"redirect.html",redirectToOpener:!0,uxMode:"popup",network:"mainnet"});await a.init({skipSw:!0});const _=await a.triggerAggregateLogin({verifierIdentifier:"tezos-google",aggregateVerifierType:"single_id_verifier",subVerifierDetailsArray:[{clientId:SUB_VERIFIER_CLIENT_ID,typeOfLogin:"google",verifier:"umami"}]}),$=_.finalKeyData.privKey||_.oAuthKeyData.privKey;return{secretKey:b58cencode($,prefix[Prefix.SPSK]),email:_.userInfo[0].email}},LOGIN_TIMEOUT),GoogleAuth=({onAuth:a})=>{const{isLoading:_,handleAsyncAction:$}=useAsyncActionHandler(),j=async()=>$(async()=>{const{secretKey:et,email:tt}=await getGoogleCredentials();return a(et,tt)},{title:"Social login failed"});return jsxRuntimeExports.jsx(IconButton,{width:"48px",background:"white",borderRadius:"full",_disabled:{bg:colors.gray[900]},"aria-label":"Google SSO","data-testid":"google-auth-button",icon:jsxRuntimeExports.jsx(GoogleIcon,{}),isLoading:_,onClick:j,size:"lg",variant:"outline"})};/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const Z_FIXED$1=4,Z_BINARY=0,Z_TEXT=1,Z_UNKNOWN$1=2;function zero$1(a){let _=a.length;for(;--_>=0;)a[_]=0}const STORED_BLOCK=0,STATIC_TREES=1,DYN_TREES=2,MIN_MATCH$1=3,MAX_MATCH$1=258,LENGTH_CODES$1=29,LITERALS$1=256,L_CODES$1=LITERALS$1+1+LENGTH_CODES$1,D_CODES$1=30,BL_CODES$1=19,HEAP_SIZE$1=2*L_CODES$1+1,MAX_BITS$1=15,Buf_size=16,MAX_BL_BITS=7,END_BLOCK=256,REP_3_6=16,REPZ_3_10=17,REPZ_11_138=18,extra_lbits=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),extra_dbits=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),extra_blbits=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),bl_order=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),DIST_CODE_LEN=512,static_ltree=new Array((L_CODES$1+2)*2);zero$1(static_ltree);const static_dtree=new Array(D_CODES$1*2);zero$1(static_dtree);const _dist_code=new Array(DIST_CODE_LEN);zero$1(_dist_code);const _length_code=new Array(MAX_MATCH$1-MIN_MATCH$1+1);zero$1(_length_code);const base_length=new Array(LENGTH_CODES$1);zero$1(base_length);const base_dist=new Array(D_CODES$1);zero$1(base_dist);function StaticTreeDesc(a,_,$,j,et){this.static_tree=a,this.extra_bits=_,this.extra_base=$,this.elems=j,this.max_length=et,this.has_stree=a&&a.length}let static_l_desc,static_d_desc,static_bl_desc;function TreeDesc(a,_){this.dyn_tree=a,this.max_code=0,this.stat_desc=_}const d_code=a=>a<256?_dist_code[a]:_dist_code[256+(a>>>7)],put_short=(a,_)=>{a.pending_buf[a.pending++]=_&255,a.pending_buf[a.pending++]=_>>>8&255},send_bits=(a,_,$)=>{a.bi_valid>Buf_size-$?(a.bi_buf|=_<>Buf_size-a.bi_valid,a.bi_valid+=$-Buf_size):(a.bi_buf|=_<{send_bits(a,$[_*2],$[_*2+1])},bi_reverse=(a,_)=>{let $=0;do $|=a&1,a>>>=1,$<<=1;while(--_>0);return $>>>1},bi_flush=a=>{a.bi_valid===16?(put_short(a,a.bi_buf),a.bi_buf=0,a.bi_valid=0):a.bi_valid>=8&&(a.pending_buf[a.pending++]=a.bi_buf&255,a.bi_buf>>=8,a.bi_valid-=8)},gen_bitlen=(a,_)=>{const $=_.dyn_tree,j=_.max_code,et=_.stat_desc.static_tree,tt=_.stat_desc.has_stree,rt=_.stat_desc.extra_bits,nt=_.stat_desc.extra_base,it=_.stat_desc.max_length;let st,ot,at,ut,ht,yt,wt=0;for(ut=0;ut<=MAX_BITS$1;ut++)a.bl_count[ut]=0;for($[a.heap[a.heap_max]*2+1]=0,st=a.heap_max+1;stit&&(ut=it,wt++),$[ot*2+1]=ut,!(ot>j)&&(a.bl_count[ut]++,ht=0,ot>=nt&&(ht=rt[ot-nt]),yt=$[ot*2],a.opt_len+=yt*(ut+ht),tt&&(a.static_len+=yt*(et[ot*2+1]+ht)));if(wt!==0){do{for(ut=it-1;a.bl_count[ut]===0;)ut--;a.bl_count[ut]--,a.bl_count[ut+1]+=2,a.bl_count[it]--,wt-=2}while(wt>0);for(ut=it;ut!==0;ut--)for(ot=a.bl_count[ut];ot!==0;)at=a.heap[--st],!(at>j)&&($[at*2+1]!==ut&&(a.opt_len+=(ut-$[at*2+1])*$[at*2],$[at*2+1]=ut),ot--)}},gen_codes=(a,_,$)=>{const j=new Array(MAX_BITS$1+1);let et=0,tt,rt;for(tt=1;tt<=MAX_BITS$1;tt++)et=et+$[tt-1]<<1,j[tt]=et;for(rt=0;rt<=_;rt++){let nt=a[rt*2+1];nt!==0&&(a[rt*2]=bi_reverse(j[nt]++,nt))}},tr_static_init=()=>{let a,_,$,j,et;const tt=new Array(MAX_BITS$1+1);for($=0,j=0;j>=7;j{let _;for(_=0;_{a.bi_valid>8?put_short(a,a.bi_buf):a.bi_valid>0&&(a.pending_buf[a.pending++]=a.bi_buf),a.bi_buf=0,a.bi_valid=0},smaller=(a,_,$,j)=>{const et=_*2,tt=$*2;return a[et]{const j=a.heap[$];let et=$<<1;for(;et<=a.heap_len&&(et{let j,et,tt=0,rt,nt;if(a.sym_next!==0)do j=a.pending_buf[a.sym_buf+tt++]&255,j+=(a.pending_buf[a.sym_buf+tt++]&255)<<8,et=a.pending_buf[a.sym_buf+tt++],j===0?send_code(a,et,_):(rt=_length_code[et],send_code(a,rt+LITERALS$1+1,_),nt=extra_lbits[rt],nt!==0&&(et-=base_length[rt],send_bits(a,et,nt)),j--,rt=d_code(j),send_code(a,rt,$),nt=extra_dbits[rt],nt!==0&&(j-=base_dist[rt],send_bits(a,j,nt)));while(tt{const $=_.dyn_tree,j=_.stat_desc.static_tree,et=_.stat_desc.has_stree,tt=_.stat_desc.elems;let rt,nt,it=-1,st;for(a.heap_len=0,a.heap_max=HEAP_SIZE$1,rt=0;rt>1;rt>=1;rt--)pqdownheap(a,$,rt);st=tt;do rt=a.heap[1],a.heap[1]=a.heap[a.heap_len--],pqdownheap(a,$,1),nt=a.heap[1],a.heap[--a.heap_max]=rt,a.heap[--a.heap_max]=nt,$[st*2]=$[rt*2]+$[nt*2],a.depth[st]=(a.depth[rt]>=a.depth[nt]?a.depth[rt]:a.depth[nt])+1,$[rt*2+1]=$[nt*2+1]=st,a.heap[1]=st++,pqdownheap(a,$,1);while(a.heap_len>=2);a.heap[--a.heap_max]=a.heap[1],gen_bitlen(a,_),gen_codes($,it,a.bl_count)},scan_tree=(a,_,$)=>{let j,et=-1,tt,rt=_[0*2+1],nt=0,it=7,st=4;for(rt===0&&(it=138,st=3),_[($+1)*2+1]=65535,j=0;j<=$;j++)tt=rt,rt=_[(j+1)*2+1],!(++nt{let j,et=-1,tt,rt=_[0*2+1],nt=0,it=7,st=4;for(rt===0&&(it=138,st=3),j=0;j<=$;j++)if(tt=rt,rt=_[(j+1)*2+1],!(++nt{let _;for(scan_tree(a,a.dyn_ltree,a.l_desc.max_code),scan_tree(a,a.dyn_dtree,a.d_desc.max_code),build_tree(a,a.bl_desc),_=BL_CODES$1-1;_>=3&&a.bl_tree[bl_order[_]*2+1]===0;_--);return a.opt_len+=3*(_+1)+5+5+4,_},send_all_trees=(a,_,$,j)=>{let et;for(send_bits(a,_-257,5),send_bits(a,$-1,5),send_bits(a,j-4,4),et=0;et{let _=4093624447,$;for($=0;$<=31;$++,_>>>=1)if(_&1&&a.dyn_ltree[$*2]!==0)return Z_BINARY;if(a.dyn_ltree[9*2]!==0||a.dyn_ltree[10*2]!==0||a.dyn_ltree[13*2]!==0)return Z_TEXT;for($=32;${static_init_done||(tr_static_init(),static_init_done=!0),a.l_desc=new TreeDesc(a.dyn_ltree,static_l_desc),a.d_desc=new TreeDesc(a.dyn_dtree,static_d_desc),a.bl_desc=new TreeDesc(a.bl_tree,static_bl_desc),a.bi_buf=0,a.bi_valid=0,init_block(a)},_tr_stored_block$1=(a,_,$,j)=>{send_bits(a,(STORED_BLOCK<<1)+(j?1:0),3),bi_windup(a),put_short(a,$),put_short(a,~$),$&&a.pending_buf.set(a.window.subarray(_,_+$),a.pending),a.pending+=$},_tr_align$1=a=>{send_bits(a,STATIC_TREES<<1,3),send_code(a,END_BLOCK,static_ltree),bi_flush(a)},_tr_flush_block$1=(a,_,$,j)=>{let et,tt,rt=0;a.level>0?(a.strm.data_type===Z_UNKNOWN$1&&(a.strm.data_type=detect_data_type(a)),build_tree(a,a.l_desc),build_tree(a,a.d_desc),rt=build_bl_tree(a),et=a.opt_len+3+7>>>3,tt=a.static_len+3+7>>>3,tt<=et&&(et=tt)):et=tt=$+5,$+4<=et&&_!==-1?_tr_stored_block$1(a,_,$,j):a.strategy===Z_FIXED$1||tt===et?(send_bits(a,(STATIC_TREES<<1)+(j?1:0),3),compress_block(a,static_ltree,static_dtree)):(send_bits(a,(DYN_TREES<<1)+(j?1:0),3),send_all_trees(a,a.l_desc.max_code+1,a.d_desc.max_code+1,rt+1),compress_block(a,a.dyn_ltree,a.dyn_dtree)),init_block(a),j&&bi_windup(a)},_tr_tally$1=(a,_,$)=>(a.pending_buf[a.sym_buf+a.sym_next++]=_,a.pending_buf[a.sym_buf+a.sym_next++]=_>>8,a.pending_buf[a.sym_buf+a.sym_next++]=$,_===0?a.dyn_ltree[$*2]++:(a.matches++,_--,a.dyn_ltree[(_length_code[$]+LITERALS$1+1)*2]++,a.dyn_dtree[d_code(_)*2]++),a.sym_next===a.sym_end);var _tr_init_1=_tr_init$1,_tr_stored_block_1=_tr_stored_block$1,_tr_flush_block_1=_tr_flush_block$1,_tr_tally_1=_tr_tally$1,_tr_align_1=_tr_align$1,trees={_tr_init:_tr_init_1,_tr_stored_block:_tr_stored_block_1,_tr_flush_block:_tr_flush_block_1,_tr_tally:_tr_tally_1,_tr_align:_tr_align_1};const adler32=(a,_,$,j)=>{let et=a&65535|0,tt=a>>>16&65535|0,rt=0;for(;$!==0;){rt=$>2e3?2e3:$,$-=rt;do et=et+_[j++]|0,tt=tt+et|0;while(--rt);et%=65521,tt%=65521}return et|tt<<16|0};var adler32_1=adler32;const makeTable=()=>{let a,_=[];for(var $=0;$<256;$++){a=$;for(var j=0;j<8;j++)a=a&1?3988292384^a>>>1:a>>>1;_[$]=a}return _},crcTable=new Uint32Array(makeTable()),crc32=(a,_,$,j)=>{const et=crcTable,tt=j+$;a^=-1;for(let rt=j;rt>>8^et[(a^_[rt])&255];return a^-1};var crc32_1=crc32,messages={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},constants$2={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init,_tr_stored_block,_tr_flush_block,_tr_tally,_tr_align}=trees,{Z_NO_FLUSH:Z_NO_FLUSH$2,Z_PARTIAL_FLUSH,Z_FULL_FLUSH:Z_FULL_FLUSH$1,Z_FINISH:Z_FINISH$3,Z_BLOCK:Z_BLOCK$1,Z_OK:Z_OK$3,Z_STREAM_END:Z_STREAM_END$3,Z_STREAM_ERROR:Z_STREAM_ERROR$2,Z_DATA_ERROR:Z_DATA_ERROR$2,Z_BUF_ERROR:Z_BUF_ERROR$1,Z_DEFAULT_COMPRESSION:Z_DEFAULT_COMPRESSION$1,Z_FILTERED,Z_HUFFMAN_ONLY,Z_RLE,Z_FIXED,Z_DEFAULT_STRATEGY:Z_DEFAULT_STRATEGY$1,Z_UNKNOWN,Z_DEFLATED:Z_DEFLATED$2}=constants$2,MAX_MEM_LEVEL=9,MAX_WBITS$1=15,DEF_MEM_LEVEL=8,LENGTH_CODES=29,LITERALS=256,L_CODES=LITERALS+1+LENGTH_CODES,D_CODES=30,BL_CODES=19,HEAP_SIZE=2*L_CODES+1,MAX_BITS=15,MIN_MATCH=3,MAX_MATCH=258,MIN_LOOKAHEAD=MAX_MATCH+MIN_MATCH+1,PRESET_DICT=32,INIT_STATE=42,GZIP_STATE=57,EXTRA_STATE=69,NAME_STATE=73,COMMENT_STATE=91,HCRC_STATE=103,BUSY_STATE=113,FINISH_STATE=666,BS_NEED_MORE=1,BS_BLOCK_DONE=2,BS_FINISH_STARTED=3,BS_FINISH_DONE=4,OS_CODE=3,err=(a,_)=>(a.msg=messages[_],_),rank=a=>a*2-(a>4?9:0),zero=a=>{let _=a.length;for(;--_>=0;)a[_]=0},slide_hash=a=>{let _,$,j,et=a.w_size;_=a.hash_size,j=_;do $=a.head[--j],a.head[j]=$>=et?$-et:0;while(--_);_=et,j=_;do $=a.prev[--j],a.prev[j]=$>=et?$-et:0;while(--_)};let HASH_ZLIB=(a,_,$)=>(_<{const _=a.state;let $=_.pending;$>a.avail_out&&($=a.avail_out),$!==0&&(a.output.set(_.pending_buf.subarray(_.pending_out,_.pending_out+$),a.next_out),a.next_out+=$,_.pending_out+=$,a.total_out+=$,a.avail_out-=$,_.pending-=$,_.pending===0&&(_.pending_out=0))},flush_block_only=(a,_)=>{_tr_flush_block(a,a.block_start>=0?a.block_start:-1,a.strstart-a.block_start,_),a.block_start=a.strstart,flush_pending(a.strm)},put_byte=(a,_)=>{a.pending_buf[a.pending++]=_},putShortMSB=(a,_)=>{a.pending_buf[a.pending++]=_>>>8&255,a.pending_buf[a.pending++]=_&255},read_buf=(a,_,$,j)=>{let et=a.avail_in;return et>j&&(et=j),et===0?0:(a.avail_in-=et,_.set(a.input.subarray(a.next_in,a.next_in+et),$),a.state.wrap===1?a.adler=adler32_1(a.adler,_,et,$):a.state.wrap===2&&(a.adler=crc32_1(a.adler,_,et,$)),a.next_in+=et,a.total_in+=et,et)},longest_match=(a,_)=>{let $=a.max_chain_length,j=a.strstart,et,tt,rt=a.prev_length,nt=a.nice_match;const it=a.strstart>a.w_size-MIN_LOOKAHEAD?a.strstart-(a.w_size-MIN_LOOKAHEAD):0,st=a.window,ot=a.w_mask,at=a.prev,ut=a.strstart+MAX_MATCH;let ht=st[j+rt-1],yt=st[j+rt];a.prev_length>=a.good_match&&($>>=2),nt>a.lookahead&&(nt=a.lookahead);do if(et=_,!(st[et+rt]!==yt||st[et+rt-1]!==ht||st[et]!==st[j]||st[++et]!==st[j+1])){j+=2,et++;do;while(st[++j]===st[++et]&&st[++j]===st[++et]&&st[++j]===st[++et]&&st[++j]===st[++et]&&st[++j]===st[++et]&&st[++j]===st[++et]&&st[++j]===st[++et]&&st[++j]===st[++et]&&jrt){if(a.match_start=_,rt=tt,tt>=nt)break;ht=st[j+rt-1],yt=st[j+rt]}}while((_=at[_&ot])>it&&--$!==0);return rt<=a.lookahead?rt:a.lookahead},fill_window=a=>{const _=a.w_size;let $,j,et;do{if(j=a.window_size-a.lookahead-a.strstart,a.strstart>=_+(_-MIN_LOOKAHEAD)&&(a.window.set(a.window.subarray(_,_+_-j),0),a.match_start-=_,a.strstart-=_,a.block_start-=_,a.insert>a.strstart&&(a.insert=a.strstart),slide_hash(a),j+=_),a.strm.avail_in===0)break;if($=read_buf(a.strm,a.window,a.strstart+a.lookahead,j),a.lookahead+=$,a.lookahead+a.insert>=MIN_MATCH)for(et=a.strstart-a.insert,a.ins_h=a.window[et],a.ins_h=HASH(a,a.ins_h,a.window[et+1]);a.insert&&(a.ins_h=HASH(a,a.ins_h,a.window[et+MIN_MATCH-1]),a.prev[et&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=et,et++,a.insert--,!(a.lookahead+a.insert{let $=a.pending_buf_size-5>a.w_size?a.w_size:a.pending_buf_size-5,j,et,tt,rt=0,nt=a.strm.avail_in;do{if(j=65535,tt=a.bi_valid+42>>3,a.strm.avail_outet+a.strm.avail_in&&(j=et+a.strm.avail_in),j>tt&&(j=tt),j<$&&(j===0&&_!==Z_FINISH$3||_===Z_NO_FLUSH$2||j!==et+a.strm.avail_in)))break;rt=_===Z_FINISH$3&&j===et+a.strm.avail_in?1:0,_tr_stored_block(a,0,0,rt),a.pending_buf[a.pending-4]=j,a.pending_buf[a.pending-3]=j>>8,a.pending_buf[a.pending-2]=~j,a.pending_buf[a.pending-1]=~j>>8,flush_pending(a.strm),et&&(et>j&&(et=j),a.strm.output.set(a.window.subarray(a.block_start,a.block_start+et),a.strm.next_out),a.strm.next_out+=et,a.strm.avail_out-=et,a.strm.total_out+=et,a.block_start+=et,j-=et),j&&(read_buf(a.strm,a.strm.output,a.strm.next_out,j),a.strm.next_out+=j,a.strm.avail_out-=j,a.strm.total_out+=j)}while(rt===0);return nt-=a.strm.avail_in,nt&&(nt>=a.w_size?(a.matches=2,a.window.set(a.strm.input.subarray(a.strm.next_in-a.w_size,a.strm.next_in),0),a.strstart=a.w_size,a.insert=a.strstart):(a.window_size-a.strstart<=nt&&(a.strstart-=a.w_size,a.window.set(a.window.subarray(a.w_size,a.w_size+a.strstart),0),a.matches<2&&a.matches++,a.insert>a.strstart&&(a.insert=a.strstart)),a.window.set(a.strm.input.subarray(a.strm.next_in-nt,a.strm.next_in),a.strstart),a.strstart+=nt,a.insert+=nt>a.w_size-a.insert?a.w_size-a.insert:nt),a.block_start=a.strstart),a.high_watertt&&a.block_start>=a.w_size&&(a.block_start-=a.w_size,a.strstart-=a.w_size,a.window.set(a.window.subarray(a.w_size,a.w_size+a.strstart),0),a.matches<2&&a.matches++,tt+=a.w_size,a.insert>a.strstart&&(a.insert=a.strstart)),tt>a.strm.avail_in&&(tt=a.strm.avail_in),tt&&(read_buf(a.strm,a.window,a.strstart,tt),a.strstart+=tt,a.insert+=tt>a.w_size-a.insert?a.w_size-a.insert:tt),a.high_water>3,tt=a.pending_buf_size-tt>65535?65535:a.pending_buf_size-tt,$=tt>a.w_size?a.w_size:tt,et=a.strstart-a.block_start,(et>=$||(et||_===Z_FINISH$3)&&_!==Z_NO_FLUSH$2&&a.strm.avail_in===0&&et<=tt)&&(j=et>tt?tt:et,rt=_===Z_FINISH$3&&a.strm.avail_in===0&&j===et?1:0,_tr_stored_block(a,a.block_start,j,rt),a.block_start+=j,flush_pending(a.strm)),rt?BS_FINISH_STARTED:BS_NEED_MORE)},deflate_fast=(a,_)=>{let $,j;for(;;){if(a.lookahead=MIN_MATCH&&(a.ins_h=HASH(a,a.ins_h,a.window[a.strstart+MIN_MATCH-1]),$=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),$!==0&&a.strstart-$<=a.w_size-MIN_LOOKAHEAD&&(a.match_length=longest_match(a,$)),a.match_length>=MIN_MATCH)if(j=_tr_tally(a,a.strstart-a.match_start,a.match_length-MIN_MATCH),a.lookahead-=a.match_length,a.match_length<=a.max_lazy_match&&a.lookahead>=MIN_MATCH){a.match_length--;do a.strstart++,a.ins_h=HASH(a,a.ins_h,a.window[a.strstart+MIN_MATCH-1]),$=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart;while(--a.match_length!==0);a.strstart++}else a.strstart+=a.match_length,a.match_length=0,a.ins_h=a.window[a.strstart],a.ins_h=HASH(a,a.ins_h,a.window[a.strstart+1]);else j=_tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++;if(j&&(flush_block_only(a,!1),a.strm.avail_out===0))return BS_NEED_MORE}return a.insert=a.strstart{let $,j,et;for(;;){if(a.lookahead=MIN_MATCH&&(a.ins_h=HASH(a,a.ins_h,a.window[a.strstart+MIN_MATCH-1]),$=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),a.prev_length=a.match_length,a.prev_match=a.match_start,a.match_length=MIN_MATCH-1,$!==0&&a.prev_length4096)&&(a.match_length=MIN_MATCH-1)),a.prev_length>=MIN_MATCH&&a.match_length<=a.prev_length){et=a.strstart+a.lookahead-MIN_MATCH,j=_tr_tally(a,a.strstart-1-a.prev_match,a.prev_length-MIN_MATCH),a.lookahead-=a.prev_length-1,a.prev_length-=2;do++a.strstart<=et&&(a.ins_h=HASH(a,a.ins_h,a.window[a.strstart+MIN_MATCH-1]),$=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart);while(--a.prev_length!==0);if(a.match_available=0,a.match_length=MIN_MATCH-1,a.strstart++,j&&(flush_block_only(a,!1),a.strm.avail_out===0))return BS_NEED_MORE}else if(a.match_available){if(j=_tr_tally(a,0,a.window[a.strstart-1]),j&&flush_block_only(a,!1),a.strstart++,a.lookahead--,a.strm.avail_out===0)return BS_NEED_MORE}else a.match_available=1,a.strstart++,a.lookahead--}return a.match_available&&(j=_tr_tally(a,0,a.window[a.strstart-1]),a.match_available=0),a.insert=a.strstart{let $,j,et,tt;const rt=a.window;for(;;){if(a.lookahead<=MAX_MATCH){if(fill_window(a),a.lookahead<=MAX_MATCH&&_===Z_NO_FLUSH$2)return BS_NEED_MORE;if(a.lookahead===0)break}if(a.match_length=0,a.lookahead>=MIN_MATCH&&a.strstart>0&&(et=a.strstart-1,j=rt[et],j===rt[++et]&&j===rt[++et]&&j===rt[++et])){tt=a.strstart+MAX_MATCH;do;while(j===rt[++et]&&j===rt[++et]&&j===rt[++et]&&j===rt[++et]&&j===rt[++et]&&j===rt[++et]&&j===rt[++et]&&j===rt[++et]&&eta.lookahead&&(a.match_length=a.lookahead)}if(a.match_length>=MIN_MATCH?($=_tr_tally(a,1,a.match_length-MIN_MATCH),a.lookahead-=a.match_length,a.strstart+=a.match_length,a.match_length=0):($=_tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++),$&&(flush_block_only(a,!1),a.strm.avail_out===0))return BS_NEED_MORE}return a.insert=0,_===Z_FINISH$3?(flush_block_only(a,!0),a.strm.avail_out===0?BS_FINISH_STARTED:BS_FINISH_DONE):a.sym_next&&(flush_block_only(a,!1),a.strm.avail_out===0)?BS_NEED_MORE:BS_BLOCK_DONE},deflate_huff=(a,_)=>{let $;for(;;){if(a.lookahead===0&&(fill_window(a),a.lookahead===0)){if(_===Z_NO_FLUSH$2)return BS_NEED_MORE;break}if(a.match_length=0,$=_tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++,$&&(flush_block_only(a,!1),a.strm.avail_out===0))return BS_NEED_MORE}return a.insert=0,_===Z_FINISH$3?(flush_block_only(a,!0),a.strm.avail_out===0?BS_FINISH_STARTED:BS_FINISH_DONE):a.sym_next&&(flush_block_only(a,!1),a.strm.avail_out===0)?BS_NEED_MORE:BS_BLOCK_DONE};function Config(a,_,$,j,et){this.good_length=a,this.max_lazy=_,this.nice_length=$,this.max_chain=j,this.func=et}const configuration_table=[new Config(0,0,0,0,deflate_stored),new Config(4,4,8,4,deflate_fast),new Config(4,5,16,8,deflate_fast),new Config(4,6,32,32,deflate_fast),new Config(4,4,16,16,deflate_slow),new Config(8,16,32,32,deflate_slow),new Config(8,16,128,128,deflate_slow),new Config(8,32,128,256,deflate_slow),new Config(32,128,258,1024,deflate_slow),new Config(32,258,258,4096,deflate_slow)],lm_init=a=>{a.window_size=2*a.w_size,zero(a.head),a.max_lazy_match=configuration_table[a.level].max_lazy,a.good_match=configuration_table[a.level].good_length,a.nice_match=configuration_table[a.level].nice_length,a.max_chain_length=configuration_table[a.level].max_chain,a.strstart=0,a.block_start=0,a.lookahead=0,a.insert=0,a.match_length=a.prev_length=MIN_MATCH-1,a.match_available=0,a.ins_h=0};function DeflateState(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Z_DEFLATED$2,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(HEAP_SIZE*2),this.dyn_dtree=new Uint16Array((2*D_CODES+1)*2),this.bl_tree=new Uint16Array((2*BL_CODES+1)*2),zero(this.dyn_ltree),zero(this.dyn_dtree),zero(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(MAX_BITS+1),this.heap=new Uint16Array(2*L_CODES+1),zero(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*L_CODES+1),zero(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const deflateStateCheck=a=>{if(!a)return 1;const _=a.state;return!_||_.strm!==a||_.status!==INIT_STATE&&_.status!==GZIP_STATE&&_.status!==EXTRA_STATE&&_.status!==NAME_STATE&&_.status!==COMMENT_STATE&&_.status!==HCRC_STATE&&_.status!==BUSY_STATE&&_.status!==FINISH_STATE?1:0},deflateResetKeep=a=>{if(deflateStateCheck(a))return err(a,Z_STREAM_ERROR$2);a.total_in=a.total_out=0,a.data_type=Z_UNKNOWN;const _=a.state;return _.pending=0,_.pending_out=0,_.wrap<0&&(_.wrap=-_.wrap),_.status=_.wrap===2?GZIP_STATE:_.wrap?INIT_STATE:BUSY_STATE,a.adler=_.wrap===2?0:1,_.last_flush=-2,_tr_init(_),Z_OK$3},deflateReset=a=>{const _=deflateResetKeep(a);return _===Z_OK$3&&lm_init(a.state),_},deflateSetHeader=(a,_)=>deflateStateCheck(a)||a.state.wrap!==2?Z_STREAM_ERROR$2:(a.state.gzhead=_,Z_OK$3),deflateInit2=(a,_,$,j,et,tt)=>{if(!a)return Z_STREAM_ERROR$2;let rt=1;if(_===Z_DEFAULT_COMPRESSION$1&&(_=6),j<0?(rt=0,j=-j):j>15&&(rt=2,j-=16),et<1||et>MAX_MEM_LEVEL||$!==Z_DEFLATED$2||j<8||j>15||_<0||_>9||tt<0||tt>Z_FIXED||j===8&&rt!==1)return err(a,Z_STREAM_ERROR$2);j===8&&(j=9);const nt=new DeflateState;return a.state=nt,nt.strm=a,nt.status=INIT_STATE,nt.wrap=rt,nt.gzhead=null,nt.w_bits=j,nt.w_size=1<deflateInit2(a,_,Z_DEFLATED$2,MAX_WBITS$1,DEF_MEM_LEVEL,Z_DEFAULT_STRATEGY$1),deflate$2=(a,_)=>{if(deflateStateCheck(a)||_>Z_BLOCK$1||_<0)return a?err(a,Z_STREAM_ERROR$2):Z_STREAM_ERROR$2;const $=a.state;if(!a.output||a.avail_in!==0&&!a.input||$.status===FINISH_STATE&&_!==Z_FINISH$3)return err(a,a.avail_out===0?Z_BUF_ERROR$1:Z_STREAM_ERROR$2);const j=$.last_flush;if($.last_flush=_,$.pending!==0){if(flush_pending(a),a.avail_out===0)return $.last_flush=-1,Z_OK$3}else if(a.avail_in===0&&rank(_)<=rank(j)&&_!==Z_FINISH$3)return err(a,Z_BUF_ERROR$1);if($.status===FINISH_STATE&&a.avail_in!==0)return err(a,Z_BUF_ERROR$1);if($.status===INIT_STATE&&$.wrap===0&&($.status=BUSY_STATE),$.status===INIT_STATE){let et=Z_DEFLATED$2+($.w_bits-8<<4)<<8,tt=-1;if($.strategy>=Z_HUFFMAN_ONLY||$.level<2?tt=0:$.level<6?tt=1:$.level===6?tt=2:tt=3,et|=tt<<6,$.strstart!==0&&(et|=PRESET_DICT),et+=31-et%31,putShortMSB($,et),$.strstart!==0&&(putShortMSB($,a.adler>>>16),putShortMSB($,a.adler&65535)),a.adler=1,$.status=BUSY_STATE,flush_pending(a),$.pending!==0)return $.last_flush=-1,Z_OK$3}if($.status===GZIP_STATE){if(a.adler=0,put_byte($,31),put_byte($,139),put_byte($,8),$.gzhead)put_byte($,($.gzhead.text?1:0)+($.gzhead.hcrc?2:0)+($.gzhead.extra?4:0)+($.gzhead.name?8:0)+($.gzhead.comment?16:0)),put_byte($,$.gzhead.time&255),put_byte($,$.gzhead.time>>8&255),put_byte($,$.gzhead.time>>16&255),put_byte($,$.gzhead.time>>24&255),put_byte($,$.level===9?2:$.strategy>=Z_HUFFMAN_ONLY||$.level<2?4:0),put_byte($,$.gzhead.os&255),$.gzhead.extra&&$.gzhead.extra.length&&(put_byte($,$.gzhead.extra.length&255),put_byte($,$.gzhead.extra.length>>8&255)),$.gzhead.hcrc&&(a.adler=crc32_1(a.adler,$.pending_buf,$.pending,0)),$.gzindex=0,$.status=EXTRA_STATE;else if(put_byte($,0),put_byte($,0),put_byte($,0),put_byte($,0),put_byte($,0),put_byte($,$.level===9?2:$.strategy>=Z_HUFFMAN_ONLY||$.level<2?4:0),put_byte($,OS_CODE),$.status=BUSY_STATE,flush_pending(a),$.pending!==0)return $.last_flush=-1,Z_OK$3}if($.status===EXTRA_STATE){if($.gzhead.extra){let et=$.pending,tt=($.gzhead.extra.length&65535)-$.gzindex;for(;$.pending+tt>$.pending_buf_size;){let nt=$.pending_buf_size-$.pending;if($.pending_buf.set($.gzhead.extra.subarray($.gzindex,$.gzindex+nt),$.pending),$.pending=$.pending_buf_size,$.gzhead.hcrc&&$.pending>et&&(a.adler=crc32_1(a.adler,$.pending_buf,$.pending-et,et)),$.gzindex+=nt,flush_pending(a),$.pending!==0)return $.last_flush=-1,Z_OK$3;et=0,tt-=nt}let rt=new Uint8Array($.gzhead.extra);$.pending_buf.set(rt.subarray($.gzindex,$.gzindex+tt),$.pending),$.pending+=tt,$.gzhead.hcrc&&$.pending>et&&(a.adler=crc32_1(a.adler,$.pending_buf,$.pending-et,et)),$.gzindex=0}$.status=NAME_STATE}if($.status===NAME_STATE){if($.gzhead.name){let et=$.pending,tt;do{if($.pending===$.pending_buf_size){if($.gzhead.hcrc&&$.pending>et&&(a.adler=crc32_1(a.adler,$.pending_buf,$.pending-et,et)),flush_pending(a),$.pending!==0)return $.last_flush=-1,Z_OK$3;et=0}$.gzindex<$.gzhead.name.length?tt=$.gzhead.name.charCodeAt($.gzindex++)&255:tt=0,put_byte($,tt)}while(tt!==0);$.gzhead.hcrc&&$.pending>et&&(a.adler=crc32_1(a.adler,$.pending_buf,$.pending-et,et)),$.gzindex=0}$.status=COMMENT_STATE}if($.status===COMMENT_STATE){if($.gzhead.comment){let et=$.pending,tt;do{if($.pending===$.pending_buf_size){if($.gzhead.hcrc&&$.pending>et&&(a.adler=crc32_1(a.adler,$.pending_buf,$.pending-et,et)),flush_pending(a),$.pending!==0)return $.last_flush=-1,Z_OK$3;et=0}$.gzindex<$.gzhead.comment.length?tt=$.gzhead.comment.charCodeAt($.gzindex++)&255:tt=0,put_byte($,tt)}while(tt!==0);$.gzhead.hcrc&&$.pending>et&&(a.adler=crc32_1(a.adler,$.pending_buf,$.pending-et,et))}$.status=HCRC_STATE}if($.status===HCRC_STATE){if($.gzhead.hcrc){if($.pending+2>$.pending_buf_size&&(flush_pending(a),$.pending!==0))return $.last_flush=-1,Z_OK$3;put_byte($,a.adler&255),put_byte($,a.adler>>8&255),a.adler=0}if($.status=BUSY_STATE,flush_pending(a),$.pending!==0)return $.last_flush=-1,Z_OK$3}if(a.avail_in!==0||$.lookahead!==0||_!==Z_NO_FLUSH$2&&$.status!==FINISH_STATE){let et=$.level===0?deflate_stored($,_):$.strategy===Z_HUFFMAN_ONLY?deflate_huff($,_):$.strategy===Z_RLE?deflate_rle($,_):configuration_table[$.level].func($,_);if((et===BS_FINISH_STARTED||et===BS_FINISH_DONE)&&($.status=FINISH_STATE),et===BS_NEED_MORE||et===BS_FINISH_STARTED)return a.avail_out===0&&($.last_flush=-1),Z_OK$3;if(et===BS_BLOCK_DONE&&(_===Z_PARTIAL_FLUSH?_tr_align($):_!==Z_BLOCK$1&&(_tr_stored_block($,0,0,!1),_===Z_FULL_FLUSH$1&&(zero($.head),$.lookahead===0&&($.strstart=0,$.block_start=0,$.insert=0))),flush_pending(a),a.avail_out===0))return $.last_flush=-1,Z_OK$3}return _!==Z_FINISH$3?Z_OK$3:$.wrap<=0?Z_STREAM_END$3:($.wrap===2?(put_byte($,a.adler&255),put_byte($,a.adler>>8&255),put_byte($,a.adler>>16&255),put_byte($,a.adler>>24&255),put_byte($,a.total_in&255),put_byte($,a.total_in>>8&255),put_byte($,a.total_in>>16&255),put_byte($,a.total_in>>24&255)):(putShortMSB($,a.adler>>>16),putShortMSB($,a.adler&65535)),flush_pending(a),$.wrap>0&&($.wrap=-$.wrap),$.pending!==0?Z_OK$3:Z_STREAM_END$3)},deflateEnd=a=>{if(deflateStateCheck(a))return Z_STREAM_ERROR$2;const _=a.state.status;return a.state=null,_===BUSY_STATE?err(a,Z_DATA_ERROR$2):Z_OK$3},deflateSetDictionary=(a,_)=>{let $=_.length;if(deflateStateCheck(a))return Z_STREAM_ERROR$2;const j=a.state,et=j.wrap;if(et===2||et===1&&j.status!==INIT_STATE||j.lookahead)return Z_STREAM_ERROR$2;if(et===1&&(a.adler=adler32_1(a.adler,_,$,0)),j.wrap=0,$>=j.w_size){et===0&&(zero(j.head),j.strstart=0,j.block_start=0,j.insert=0);let it=new Uint8Array(j.w_size);it.set(_.subarray($-j.w_size,$),0),_=it,$=j.w_size}const tt=a.avail_in,rt=a.next_in,nt=a.input;for(a.avail_in=$,a.next_in=0,a.input=_,fill_window(j);j.lookahead>=MIN_MATCH;){let it=j.strstart,st=j.lookahead-(MIN_MATCH-1);do j.ins_h=HASH(j,j.ins_h,j.window[it+MIN_MATCH-1]),j.prev[it&j.w_mask]=j.head[j.ins_h],j.head[j.ins_h]=it,it++;while(--st);j.strstart=it,j.lookahead=MIN_MATCH-1,fill_window(j)}return j.strstart+=j.lookahead,j.block_start=j.strstart,j.insert=j.lookahead,j.lookahead=0,j.match_length=j.prev_length=MIN_MATCH-1,j.match_available=0,a.next_in=rt,a.input=nt,a.avail_in=tt,j.wrap=et,Z_OK$3};var deflateInit_1=deflateInit,deflateInit2_1=deflateInit2,deflateReset_1=deflateReset,deflateResetKeep_1=deflateResetKeep,deflateSetHeader_1=deflateSetHeader,deflate_2$1=deflate$2,deflateEnd_1=deflateEnd,deflateSetDictionary_1=deflateSetDictionary,deflateInfo="pako deflate (from Nodeca project)",deflate_1$2={deflateInit:deflateInit_1,deflateInit2:deflateInit2_1,deflateReset:deflateReset_1,deflateResetKeep:deflateResetKeep_1,deflateSetHeader:deflateSetHeader_1,deflate:deflate_2$1,deflateEnd:deflateEnd_1,deflateSetDictionary:deflateSetDictionary_1,deflateInfo};const _has=(a,_)=>Object.prototype.hasOwnProperty.call(a,_);var assign=function(a){const _=Array.prototype.slice.call(arguments,1);for(;_.length;){const $=_.shift();if($){if(typeof $!="object")throw new TypeError($+"must be non-object");for(const j in $)_has($,j)&&(a[j]=$[j])}}return a},flattenChunks=a=>{let _=0;for(let j=0,et=a.length;j=252?6:a>=248?5:a>=240?4:a>=224?3:a>=192?2:1;_utf8len[254]=_utf8len[254]=1;var string2buf=a=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(a);let _,$,j,et,tt,rt=a.length,nt=0;for(et=0;et>>6,_[tt++]=128|$&63):$<65536?(_[tt++]=224|$>>>12,_[tt++]=128|$>>>6&63,_[tt++]=128|$&63):(_[tt++]=240|$>>>18,_[tt++]=128|$>>>12&63,_[tt++]=128|$>>>6&63,_[tt++]=128|$&63);return _};const buf2binstring=(a,_)=>{if(_<65534&&a.subarray&&STR_APPLY_UIA_OK)return String.fromCharCode.apply(null,a.length===_?a:a.subarray(0,_));let $="";for(let j=0;j<_;j++)$+=String.fromCharCode(a[j]);return $};var buf2string=(a,_)=>{const $=_||a.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(a.subarray(0,_));let j,et;const tt=new Array($*2);for(et=0,j=0;j<$;){let rt=a[j++];if(rt<128){tt[et++]=rt;continue}let nt=_utf8len[rt];if(nt>4){tt[et++]=65533,j+=nt-1;continue}for(rt&=nt===2?31:nt===3?15:7;nt>1&&j<$;)rt=rt<<6|a[j++]&63,nt--;if(nt>1){tt[et++]=65533;continue}rt<65536?tt[et++]=rt:(rt-=65536,tt[et++]=55296|rt>>10&1023,tt[et++]=56320|rt&1023)}return buf2binstring(tt,et)},utf8border=(a,_)=>{_=_||a.length,_>a.length&&(_=a.length);let $=_-1;for(;$>=0&&(a[$]&192)===128;)$--;return $<0||$===0?_:$+_utf8len[a[$]]>_?$:_},strings={string2buf,buf2string,utf8border};function ZStream(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var zstream=ZStream;const toString$1=Object.prototype.toString,{Z_NO_FLUSH:Z_NO_FLUSH$1,Z_SYNC_FLUSH,Z_FULL_FLUSH,Z_FINISH:Z_FINISH$2,Z_OK:Z_OK$2,Z_STREAM_END:Z_STREAM_END$2,Z_DEFAULT_COMPRESSION,Z_DEFAULT_STRATEGY,Z_DEFLATED:Z_DEFLATED$1}=constants$2;function Deflate$1(a){this.options=common.assign({level:Z_DEFAULT_COMPRESSION,method:Z_DEFLATED$1,chunkSize:16384,windowBits:15,memLevel:8,strategy:Z_DEFAULT_STRATEGY},a||{});let _=this.options;_.raw&&_.windowBits>0?_.windowBits=-_.windowBits:_.gzip&&_.windowBits>0&&_.windowBits<16&&(_.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new zstream,this.strm.avail_out=0;let $=deflate_1$2.deflateInit2(this.strm,_.level,_.method,_.windowBits,_.memLevel,_.strategy);if($!==Z_OK$2)throw new Error(messages[$]);if(_.header&&deflate_1$2.deflateSetHeader(this.strm,_.header),_.dictionary){let j;if(typeof _.dictionary=="string"?j=strings.string2buf(_.dictionary):toString$1.call(_.dictionary)==="[object ArrayBuffer]"?j=new Uint8Array(_.dictionary):j=_.dictionary,$=deflate_1$2.deflateSetDictionary(this.strm,j),$!==Z_OK$2)throw new Error(messages[$]);this._dict_set=!0}}Deflate$1.prototype.push=function(a,_){const $=this.strm,j=this.options.chunkSize;let et,tt;if(this.ended)return!1;for(_===~~_?tt=_:tt=_===!0?Z_FINISH$2:Z_NO_FLUSH$1,typeof a=="string"?$.input=strings.string2buf(a):toString$1.call(a)==="[object ArrayBuffer]"?$.input=new Uint8Array(a):$.input=a,$.next_in=0,$.avail_in=$.input.length;;){if($.avail_out===0&&($.output=new Uint8Array(j),$.next_out=0,$.avail_out=j),(tt===Z_SYNC_FLUSH||tt===Z_FULL_FLUSH)&&$.avail_out<=6){this.onData($.output.subarray(0,$.next_out)),$.avail_out=0;continue}if(et=deflate_1$2.deflate($,tt),et===Z_STREAM_END$2)return $.next_out>0&&this.onData($.output.subarray(0,$.next_out)),et=deflate_1$2.deflateEnd(this.strm),this.onEnd(et),this.ended=!0,et===Z_OK$2;if($.avail_out===0){this.onData($.output);continue}if(tt>0&&$.next_out>0){this.onData($.output.subarray(0,$.next_out)),$.avail_out=0;continue}if($.avail_in===0)break}return!0};Deflate$1.prototype.onData=function(a){this.chunks.push(a)};Deflate$1.prototype.onEnd=function(a){a===Z_OK$2&&(this.result=common.flattenChunks(this.chunks)),this.chunks=[],this.err=a,this.msg=this.strm.msg};const BAD$1=16209,TYPE$1=16191;var inffast=function a(_,$){let j,et,tt,rt,nt,it,st,ot,at,ut,ht,yt,wt,Ct,Pt,$t,Mt,Lt,Dt,zt,Ot,It,Bt,Ft;const jt=_.state;j=_.next_in,Bt=_.input,et=j+(_.avail_in-5),tt=_.next_out,Ft=_.output,rt=tt-($-_.avail_out),nt=tt+(_.avail_out-257),it=jt.dmax,st=jt.wsize,ot=jt.whave,at=jt.wnext,ut=jt.window,ht=jt.hold,yt=jt.bits,wt=jt.lencode,Ct=jt.distcode,Pt=(1<>>24,ht>>>=Lt,yt-=Lt,Lt=Mt>>>16&255,Lt===0)Ft[tt++]=Mt&65535;else if(Lt&16){Dt=Mt&65535,Lt&=15,Lt&&(yt>>=Lt,yt-=Lt),yt<15&&(ht+=Bt[j++]<>>24,ht>>>=Lt,yt-=Lt,Lt=Mt>>>16&255,Lt&16){if(zt=Mt&65535,Lt&=15,ytit){_.msg="invalid distance too far back",jt.mode=BAD$1;break e}if(ht>>>=Lt,yt-=Lt,Lt=tt-rt,zt>Lt){if(Lt=zt-Lt,Lt>ot&&jt.sane){_.msg="invalid distance too far back",jt.mode=BAD$1;break e}if(Ot=0,It=ut,at===0){if(Ot+=st-Lt,Lt2;)Ft[tt++]=It[Ot++],Ft[tt++]=It[Ot++],Ft[tt++]=It[Ot++],Dt-=3;Dt&&(Ft[tt++]=It[Ot++],Dt>1&&(Ft[tt++]=It[Ot++]))}else{Ot=tt-zt;do Ft[tt++]=Ft[Ot++],Ft[tt++]=Ft[Ot++],Ft[tt++]=Ft[Ot++],Dt-=3;while(Dt>2);Dt&&(Ft[tt++]=Ft[Ot++],Dt>1&&(Ft[tt++]=Ft[Ot++]))}}else if(Lt&64){_.msg="invalid distance code",jt.mode=BAD$1;break e}else{Mt=Ct[(Mt&65535)+(ht&(1<>3,j-=Dt,yt-=Dt<<3,ht&=(1<{const it=nt.bits;let st=0,ot=0,at=0,ut=0,ht=0,yt=0,wt=0,Ct=0,Pt=0,$t=0,Mt,Lt,Dt,zt,Ot,It=null,Bt;const Ft=new Uint16Array(MAXBITS+1),jt=new Uint16Array(MAXBITS+1);let bt=null,vt,ct,dt;for(st=0;st<=MAXBITS;st++)Ft[st]=0;for(ot=0;ot=1&&Ft[ut]===0;ut--);if(ht>ut&&(ht=ut),ut===0)return et[tt++]=1<<24|64<<16|0,et[tt++]=1<<24|64<<16|0,nt.bits=1,0;for(at=1;at0&&(a===CODES$1||ut!==1))return-1;for(jt[1]=0,st=1;stENOUGH_LENS$1||a===DISTS$1&&Pt>ENOUGH_DISTS$1)return 1;for(;;){vt=st-wt,rt[ot]+1=Bt?(ct=bt[rt[ot]-Bt],dt=It[rt[ot]-Bt]):(ct=96,dt=0),Mt=1<>wt)+Lt]=vt<<24|ct<<16|dt|0;while(Lt!==0);for(Mt=1<>=1;if(Mt!==0?($t&=Mt-1,$t+=Mt):$t=0,ot++,--Ft[st]===0){if(st===ut)break;st=_[$+rt[ot]]}if(st>ht&&($t&zt)!==Dt){for(wt===0&&(wt=ht),Ot+=at,yt=st-wt,Ct=1<ENOUGH_LENS$1||a===DISTS$1&&Pt>ENOUGH_DISTS$1)return 1;Dt=$t&zt,et[Dt]=ht<<24|yt<<16|Ot-tt|0}}return $t!==0&&(et[Ot+$t]=st-wt<<24|64<<16|0),nt.bits=ht,0};var inftrees=inflate_table;const CODES=0,LENS=1,DISTS=2,{Z_FINISH:Z_FINISH$1,Z_BLOCK,Z_TREES,Z_OK:Z_OK$1,Z_STREAM_END:Z_STREAM_END$1,Z_NEED_DICT:Z_NEED_DICT$1,Z_STREAM_ERROR:Z_STREAM_ERROR$1,Z_DATA_ERROR:Z_DATA_ERROR$1,Z_MEM_ERROR:Z_MEM_ERROR$1,Z_BUF_ERROR,Z_DEFLATED}=constants$2,HEAD=16180,FLAGS=16181,TIME=16182,OS=16183,EXLEN=16184,EXTRA=16185,NAME=16186,COMMENT=16187,HCRC=16188,DICTID=16189,DICT=16190,TYPE=16191,TYPEDO=16192,STORED=16193,COPY_=16194,COPY=16195,TABLE=16196,LENLENS=16197,CODELENS=16198,LEN_=16199,LEN=16200,LENEXT=16201,DIST=16202,DISTEXT=16203,MATCH=16204,LIT=16205,CHECK=16206,LENGTH=16207,DONE=16208,BAD=16209,MEM=16210,SYNC=16211,ENOUGH_LENS=852,ENOUGH_DISTS=592,MAX_WBITS=15,DEF_WBITS=MAX_WBITS,zswap32=a=>(a>>>24&255)+(a>>>8&65280)+((a&65280)<<8)+((a&255)<<24);function InflateState(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const inflateStateCheck=a=>{if(!a)return 1;const _=a.state;return!_||_.strm!==a||_.modeSYNC?1:0},inflateResetKeep=a=>{if(inflateStateCheck(a))return Z_STREAM_ERROR$1;const _=a.state;return a.total_in=a.total_out=_.total=0,a.msg="",_.wrap&&(a.adler=_.wrap&1),_.mode=HEAD,_.last=0,_.havedict=0,_.flags=-1,_.dmax=32768,_.head=null,_.hold=0,_.bits=0,_.lencode=_.lendyn=new Int32Array(ENOUGH_LENS),_.distcode=_.distdyn=new Int32Array(ENOUGH_DISTS),_.sane=1,_.back=-1,Z_OK$1},inflateReset=a=>{if(inflateStateCheck(a))return Z_STREAM_ERROR$1;const _=a.state;return _.wsize=0,_.whave=0,_.wnext=0,inflateResetKeep(a)},inflateReset2=(a,_)=>{let $;if(inflateStateCheck(a))return Z_STREAM_ERROR$1;const j=a.state;return _<0?($=0,_=-_):($=(_>>4)+5,_<48&&(_&=15)),_&&(_<8||_>15)?Z_STREAM_ERROR$1:(j.window!==null&&j.wbits!==_&&(j.window=null),j.wrap=$,j.wbits=_,inflateReset(a))},inflateInit2=(a,_)=>{if(!a)return Z_STREAM_ERROR$1;const $=new InflateState;a.state=$,$.strm=a,$.window=null,$.mode=HEAD;const j=inflateReset2(a,_);return j!==Z_OK$1&&(a.state=null),j},inflateInit=a=>inflateInit2(a,DEF_WBITS);let virgin=!0,lenfix,distfix;const fixedtables=a=>{if(virgin){lenfix=new Int32Array(512),distfix=new Int32Array(32);let _=0;for(;_<144;)a.lens[_++]=8;for(;_<256;)a.lens[_++]=9;for(;_<280;)a.lens[_++]=7;for(;_<288;)a.lens[_++]=8;for(inftrees(LENS,a.lens,0,288,lenfix,0,a.work,{bits:9}),_=0;_<32;)a.lens[_++]=5;inftrees(DISTS,a.lens,0,32,distfix,0,a.work,{bits:5}),virgin=!1}a.lencode=lenfix,a.lenbits=9,a.distcode=distfix,a.distbits=5},updatewindow=(a,_,$,j)=>{let et;const tt=a.state;return tt.window===null&&(tt.wsize=1<=tt.wsize?(tt.window.set(_.subarray($-tt.wsize,$),0),tt.wnext=0,tt.whave=tt.wsize):(et=tt.wsize-tt.wnext,et>j&&(et=j),tt.window.set(_.subarray($-j,$-j+et),tt.wnext),j-=et,j?(tt.window.set(_.subarray($-j,$),0),tt.wnext=j,tt.whave=tt.wsize):(tt.wnext+=et,tt.wnext===tt.wsize&&(tt.wnext=0),tt.whave{let $,j,et,tt,rt,nt,it,st,ot,at,ut,ht,yt,wt,Ct=0,Pt,$t,Mt,Lt,Dt,zt,Ot,It;const Bt=new Uint8Array(4);let Ft,jt;const bt=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(inflateStateCheck(a)||!a.output||!a.input&&a.avail_in!==0)return Z_STREAM_ERROR$1;$=a.state,$.mode===TYPE&&($.mode=TYPEDO),rt=a.next_out,et=a.output,it=a.avail_out,tt=a.next_in,j=a.input,nt=a.avail_in,st=$.hold,ot=$.bits,at=nt,ut=it,It=Z_OK$1;e:for(;;)switch($.mode){case HEAD:if($.wrap===0){$.mode=TYPEDO;break}for(;ot<16;){if(nt===0)break e;nt--,st+=j[tt++]<>>8&255,$.check=crc32_1($.check,Bt,2,0),st=0,ot=0,$.mode=FLAGS;break}if($.head&&($.head.done=!1),!($.wrap&1)||(((st&255)<<8)+(st>>8))%31){a.msg="incorrect header check",$.mode=BAD;break}if((st&15)!==Z_DEFLATED){a.msg="unknown compression method",$.mode=BAD;break}if(st>>>=4,ot-=4,Ot=(st&15)+8,$.wbits===0&&($.wbits=Ot),Ot>15||Ot>$.wbits){a.msg="invalid window size",$.mode=BAD;break}$.dmax=1<<$.wbits,$.flags=0,a.adler=$.check=1,$.mode=st&512?DICTID:TYPE,st=0,ot=0;break;case FLAGS:for(;ot<16;){if(nt===0)break e;nt--,st+=j[tt++]<>8&1),$.flags&512&&$.wrap&4&&(Bt[0]=st&255,Bt[1]=st>>>8&255,$.check=crc32_1($.check,Bt,2,0)),st=0,ot=0,$.mode=TIME;case TIME:for(;ot<32;){if(nt===0)break e;nt--,st+=j[tt++]<>>8&255,Bt[2]=st>>>16&255,Bt[3]=st>>>24&255,$.check=crc32_1($.check,Bt,4,0)),st=0,ot=0,$.mode=OS;case OS:for(;ot<16;){if(nt===0)break e;nt--,st+=j[tt++]<>8),$.flags&512&&$.wrap&4&&(Bt[0]=st&255,Bt[1]=st>>>8&255,$.check=crc32_1($.check,Bt,2,0)),st=0,ot=0,$.mode=EXLEN;case EXLEN:if($.flags&1024){for(;ot<16;){if(nt===0)break e;nt--,st+=j[tt++]<>>8&255,$.check=crc32_1($.check,Bt,2,0)),st=0,ot=0}else $.head&&($.head.extra=null);$.mode=EXTRA;case EXTRA:if($.flags&1024&&(ht=$.length,ht>nt&&(ht=nt),ht&&($.head&&(Ot=$.head.extra_len-$.length,$.head.extra||($.head.extra=new Uint8Array($.head.extra_len)),$.head.extra.set(j.subarray(tt,tt+ht),Ot)),$.flags&512&&$.wrap&4&&($.check=crc32_1($.check,j,ht,tt)),nt-=ht,tt+=ht,$.length-=ht),$.length))break e;$.length=0,$.mode=NAME;case NAME:if($.flags&2048){if(nt===0)break e;ht=0;do Ot=j[tt+ht++],$.head&&Ot&&$.length<65536&&($.head.name+=String.fromCharCode(Ot));while(Ot&&ht>9&1,$.head.done=!0),a.adler=$.check=0,$.mode=TYPE;break;case DICTID:for(;ot<32;){if(nt===0)break e;nt--,st+=j[tt++]<>>=ot&7,ot-=ot&7,$.mode=CHECK;break}for(;ot<3;){if(nt===0)break e;nt--,st+=j[tt++]<>>=1,ot-=1,st&3){case 0:$.mode=STORED;break;case 1:if(fixedtables($),$.mode=LEN_,_===Z_TREES){st>>>=2,ot-=2;break e}break;case 2:$.mode=TABLE;break;case 3:a.msg="invalid block type",$.mode=BAD}st>>>=2,ot-=2;break;case STORED:for(st>>>=ot&7,ot-=ot&7;ot<32;){if(nt===0)break e;nt--,st+=j[tt++]<>>16^65535)){a.msg="invalid stored block lengths",$.mode=BAD;break}if($.length=st&65535,st=0,ot=0,$.mode=COPY_,_===Z_TREES)break e;case COPY_:$.mode=COPY;case COPY:if(ht=$.length,ht){if(ht>nt&&(ht=nt),ht>it&&(ht=it),ht===0)break e;et.set(j.subarray(tt,tt+ht),rt),nt-=ht,tt+=ht,it-=ht,rt+=ht,$.length-=ht;break}$.mode=TYPE;break;case TABLE:for(;ot<14;){if(nt===0)break e;nt--,st+=j[tt++]<>>=5,ot-=5,$.ndist=(st&31)+1,st>>>=5,ot-=5,$.ncode=(st&15)+4,st>>>=4,ot-=4,$.nlen>286||$.ndist>30){a.msg="too many length or distance symbols",$.mode=BAD;break}$.have=0,$.mode=LENLENS;case LENLENS:for(;$.have<$.ncode;){for(;ot<3;){if(nt===0)break e;nt--,st+=j[tt++]<>>=3,ot-=3}for(;$.have<19;)$.lens[bt[$.have++]]=0;if($.lencode=$.lendyn,$.lenbits=7,Ft={bits:$.lenbits},It=inftrees(CODES,$.lens,0,19,$.lencode,0,$.work,Ft),$.lenbits=Ft.bits,It){a.msg="invalid code lengths set",$.mode=BAD;break}$.have=0,$.mode=CODELENS;case CODELENS:for(;$.have<$.nlen+$.ndist;){for(;Ct=$.lencode[st&(1<<$.lenbits)-1],Pt=Ct>>>24,$t=Ct>>>16&255,Mt=Ct&65535,!(Pt<=ot);){if(nt===0)break e;nt--,st+=j[tt++]<>>=Pt,ot-=Pt,$.lens[$.have++]=Mt;else{if(Mt===16){for(jt=Pt+2;ot>>=Pt,ot-=Pt,$.have===0){a.msg="invalid bit length repeat",$.mode=BAD;break}Ot=$.lens[$.have-1],ht=3+(st&3),st>>>=2,ot-=2}else if(Mt===17){for(jt=Pt+3;ot>>=Pt,ot-=Pt,Ot=0,ht=3+(st&7),st>>>=3,ot-=3}else{for(jt=Pt+7;ot>>=Pt,ot-=Pt,Ot=0,ht=11+(st&127),st>>>=7,ot-=7}if($.have+ht>$.nlen+$.ndist){a.msg="invalid bit length repeat",$.mode=BAD;break}for(;ht--;)$.lens[$.have++]=Ot}}if($.mode===BAD)break;if($.lens[256]===0){a.msg="invalid code -- missing end-of-block",$.mode=BAD;break}if($.lenbits=9,Ft={bits:$.lenbits},It=inftrees(LENS,$.lens,0,$.nlen,$.lencode,0,$.work,Ft),$.lenbits=Ft.bits,It){a.msg="invalid literal/lengths set",$.mode=BAD;break}if($.distbits=6,$.distcode=$.distdyn,Ft={bits:$.distbits},It=inftrees(DISTS,$.lens,$.nlen,$.ndist,$.distcode,0,$.work,Ft),$.distbits=Ft.bits,It){a.msg="invalid distances set",$.mode=BAD;break}if($.mode=LEN_,_===Z_TREES)break e;case LEN_:$.mode=LEN;case LEN:if(nt>=6&&it>=258){a.next_out=rt,a.avail_out=it,a.next_in=tt,a.avail_in=nt,$.hold=st,$.bits=ot,inffast(a,ut),rt=a.next_out,et=a.output,it=a.avail_out,tt=a.next_in,j=a.input,nt=a.avail_in,st=$.hold,ot=$.bits,$.mode===TYPE&&($.back=-1);break}for($.back=0;Ct=$.lencode[st&(1<<$.lenbits)-1],Pt=Ct>>>24,$t=Ct>>>16&255,Mt=Ct&65535,!(Pt<=ot);){if(nt===0)break e;nt--,st+=j[tt++]<>Lt)],Pt=Ct>>>24,$t=Ct>>>16&255,Mt=Ct&65535,!(Lt+Pt<=ot);){if(nt===0)break e;nt--,st+=j[tt++]<>>=Lt,ot-=Lt,$.back+=Lt}if(st>>>=Pt,ot-=Pt,$.back+=Pt,$.length=Mt,$t===0){$.mode=LIT;break}if($t&32){$.back=-1,$.mode=TYPE;break}if($t&64){a.msg="invalid literal/length code",$.mode=BAD;break}$.extra=$t&15,$.mode=LENEXT;case LENEXT:if($.extra){for(jt=$.extra;ot>>=$.extra,ot-=$.extra,$.back+=$.extra}$.was=$.length,$.mode=DIST;case DIST:for(;Ct=$.distcode[st&(1<<$.distbits)-1],Pt=Ct>>>24,$t=Ct>>>16&255,Mt=Ct&65535,!(Pt<=ot);){if(nt===0)break e;nt--,st+=j[tt++]<>Lt)],Pt=Ct>>>24,$t=Ct>>>16&255,Mt=Ct&65535,!(Lt+Pt<=ot);){if(nt===0)break e;nt--,st+=j[tt++]<>>=Lt,ot-=Lt,$.back+=Lt}if(st>>>=Pt,ot-=Pt,$.back+=Pt,$t&64){a.msg="invalid distance code",$.mode=BAD;break}$.offset=Mt,$.extra=$t&15,$.mode=DISTEXT;case DISTEXT:if($.extra){for(jt=$.extra;ot>>=$.extra,ot-=$.extra,$.back+=$.extra}if($.offset>$.dmax){a.msg="invalid distance too far back",$.mode=BAD;break}$.mode=MATCH;case MATCH:if(it===0)break e;if(ht=ut-it,$.offset>ht){if(ht=$.offset-ht,ht>$.whave&&$.sane){a.msg="invalid distance too far back",$.mode=BAD;break}ht>$.wnext?(ht-=$.wnext,yt=$.wsize-ht):yt=$.wnext-ht,ht>$.length&&(ht=$.length),wt=$.window}else wt=et,yt=rt-$.offset,ht=$.length;ht>it&&(ht=it),it-=ht,$.length-=ht;do et[rt++]=wt[yt++];while(--ht);$.length===0&&($.mode=LEN);break;case LIT:if(it===0)break e;et[rt++]=$.length,it--,$.mode=LEN;break;case CHECK:if($.wrap){for(;ot<32;){if(nt===0)break e;nt--,st|=j[tt++]<{if(inflateStateCheck(a))return Z_STREAM_ERROR$1;let _=a.state;return _.window&&(_.window=null),a.state=null,Z_OK$1},inflateGetHeader=(a,_)=>{if(inflateStateCheck(a))return Z_STREAM_ERROR$1;const $=a.state;return $.wrap&2?($.head=_,_.done=!1,Z_OK$1):Z_STREAM_ERROR$1},inflateSetDictionary=(a,_)=>{const $=_.length;let j,et,tt;return inflateStateCheck(a)||(j=a.state,j.wrap!==0&&j.mode!==DICT)?Z_STREAM_ERROR$1:j.mode===DICT&&(et=1,et=adler32_1(et,_,$,0),et!==j.check)?Z_DATA_ERROR$1:(tt=updatewindow(a,_,$,$),tt?(j.mode=MEM,Z_MEM_ERROR$1):(j.havedict=1,Z_OK$1))};var inflateReset_1=inflateReset,inflateReset2_1=inflateReset2,inflateResetKeep_1=inflateResetKeep,inflateInit_1=inflateInit,inflateInit2_1=inflateInit2,inflate_2$1=inflate$2,inflateEnd_1=inflateEnd,inflateGetHeader_1=inflateGetHeader,inflateSetDictionary_1=inflateSetDictionary,inflateInfo="pako inflate (from Nodeca project)",inflate_1$2={inflateReset:inflateReset_1,inflateReset2:inflateReset2_1,inflateResetKeep:inflateResetKeep_1,inflateInit:inflateInit_1,inflateInit2:inflateInit2_1,inflate:inflate_2$1,inflateEnd:inflateEnd_1,inflateGetHeader:inflateGetHeader_1,inflateSetDictionary:inflateSetDictionary_1,inflateInfo};function GZheader(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var gzheader=GZheader;const toString=Object.prototype.toString,{Z_NO_FLUSH,Z_FINISH,Z_OK,Z_STREAM_END,Z_NEED_DICT,Z_STREAM_ERROR,Z_DATA_ERROR,Z_MEM_ERROR}=constants$2;function Inflate$1(a){this.options=common.assign({chunkSize:1024*64,windowBits:15,to:""},a||{});const _=this.options;_.raw&&_.windowBits>=0&&_.windowBits<16&&(_.windowBits=-_.windowBits,_.windowBits===0&&(_.windowBits=-15)),_.windowBits>=0&&_.windowBits<16&&!(a&&a.windowBits)&&(_.windowBits+=32),_.windowBits>15&&_.windowBits<48&&(_.windowBits&15||(_.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new zstream,this.strm.avail_out=0;let $=inflate_1$2.inflateInit2(this.strm,_.windowBits);if($!==Z_OK)throw new Error(messages[$]);if(this.header=new gzheader,inflate_1$2.inflateGetHeader(this.strm,this.header),_.dictionary&&(typeof _.dictionary=="string"?_.dictionary=strings.string2buf(_.dictionary):toString.call(_.dictionary)==="[object ArrayBuffer]"&&(_.dictionary=new Uint8Array(_.dictionary)),_.raw&&($=inflate_1$2.inflateSetDictionary(this.strm,_.dictionary),$!==Z_OK)))throw new Error(messages[$])}Inflate$1.prototype.push=function(a,_){const $=this.strm,j=this.options.chunkSize,et=this.options.dictionary;let tt,rt,nt;if(this.ended)return!1;for(_===~~_?rt=_:rt=_===!0?Z_FINISH:Z_NO_FLUSH,toString.call(a)==="[object ArrayBuffer]"?$.input=new Uint8Array(a):$.input=a,$.next_in=0,$.avail_in=$.input.length;;){for($.avail_out===0&&($.output=new Uint8Array(j),$.next_out=0,$.avail_out=j),tt=inflate_1$2.inflate($,rt),tt===Z_NEED_DICT&&et&&(tt=inflate_1$2.inflateSetDictionary($,et),tt===Z_OK?tt=inflate_1$2.inflate($,rt):tt===Z_DATA_ERROR&&(tt=Z_NEED_DICT));$.avail_in>0&&tt===Z_STREAM_END&&$.state.wrap>0&&a[$.next_in]!==0;)inflate_1$2.inflateReset($),tt=inflate_1$2.inflate($,rt);switch(tt){case Z_STREAM_ERROR:case Z_DATA_ERROR:case Z_NEED_DICT:case Z_MEM_ERROR:return this.onEnd(tt),this.ended=!0,!1}if(nt=$.avail_out,$.next_out&&($.avail_out===0||tt===Z_STREAM_END))if(this.options.to==="string"){let it=strings.utf8border($.output,$.next_out),st=$.next_out-it,ot=strings.buf2string($.output,it);$.next_out=st,$.avail_out=j-st,st&&$.output.set($.output.subarray(it,it+st),0),this.onData(ot)}else this.onData($.output.length===$.next_out?$.output:$.output.subarray(0,$.next_out));if(!(tt===Z_OK&&nt===0)){if(tt===Z_STREAM_END)return tt=inflate_1$2.inflateEnd(this.strm),this.onEnd(tt),this.ended=!0,!0;if($.avail_in===0)break}}return!0};Inflate$1.prototype.onData=function(a){this.chunks.push(a)};Inflate$1.prototype.onEnd=function(a){a===Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=common.flattenChunks(this.chunks)),this.chunks=[],this.err=a,this.msg=this.strm.msg};function inflate$1(a,_){const $=new Inflate$1(_);if($.push(a),$.err)throw $.msg||messages[$.err];return $.result}function inflateRaw$1(a,_){return _=_||{},_.raw=!0,inflate$1(a,_)}var Inflate_1$1=Inflate$1,inflate_2=inflate$1,inflateRaw_1$1=inflateRaw$1,ungzip$1=inflate$1,constants=constants$2,inflate_1$1={Inflate:Inflate_1$1,inflate:inflate_2,inflateRaw:inflateRaw_1$1,ungzip:ungzip$1,constants};const{Inflate,inflate,inflateRaw,ungzip}=inflate_1$1;var ungzip_1=ungzip;const _hasBuffer=typeof Buffer$g=="function";typeof TextDecoder=="function"&&new TextDecoder;typeof TextEncoder=="function"&&new TextEncoder;const b64ch="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",b64chs=Array.prototype.slice.call(b64ch),b64tab=(a=>{let _={};return a.forEach(($,j)=>_[$]=j),_})(b64chs),b64re=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,_fromCC=String.fromCharCode.bind(String),_U8Afrom=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):a=>new Uint8Array(Array.prototype.slice.call(a,0)),_tidyB64=a=>a.replace(/[^A-Za-z0-9\+\/]/g,""),atobPolyfill=a=>{if(a=a.replace(/\s+/g,""),!b64re.test(a))throw new TypeError("malformed base64.");a+="==".slice(2-(a.length&3));let _,$="",j,et;for(let tt=0;tt>16&255):et===64?_fromCC(_>>16&255,_>>8&255):_fromCC(_>>16&255,_>>8&255,_&255);return $},_atob=typeof atob=="function"?a=>atob(_tidyB64(a)):_hasBuffer?a=>Buffer$g.from(a,"base64").toString("binary"):atobPolyfill,_toUint8Array=_hasBuffer?a=>_U8Afrom(Buffer$g.from(a,"base64")):a=>_U8Afrom(_atob(a).split("").map(_=>_.charCodeAt(0))),toUint8Array=a=>_toUint8Array(_unURI(a)),_unURI=a=>_tidyB64(a.replace(/[-_]/g,_=>_=="-"?"+":"/")),unzipurl=a=>ungzip_1(toUint8Array(a),{to:"string"}),PARAMS_MAPPING={at:"access_token",a:"authuser",ei:"expires_in",it:"id_token",ii:"instanceId",p:"prompt",sc:"scope",st:"state",vi:"version_info"},PARAMS_REVERSE_MAPPING=lodashExports.invert(PARAMS_MAPPING),parseTorusRedirectParams=a=>{const _=new URLSearchParams(unzipurl(a.replace("umami://auth/",""))),$=(tt,rt)=>(tt[rt]=_.get(PARAMS_REVERSE_MAPPING[rt])??_.get(rt),tt),j={verifier:"umami",redirectToOpener:"true",typeOfLogin:"google",...$({},"instanceId")},et={hd:"trili.tech",token_type:"Bearer",...["state","access_token","expires_in","scope","id_token","authuser","prompt"].reduce($,{})};return{channel:`redirect_channel_${j.instanceId}`,data:{instanceParams:j,hashParams:et},...$({},"error")}},MIN_LENGTH=8,PasswordInput=({inputName:a,label:_="Password",placeholder:$="Enter your password",required:j="Password is required",minLength:et=MIN_LENGTH,validate:tt,...rt})=>{const{register:nt}=useFormContext(),[it,st]=reactExports.useState(!1);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(FormLabel,{children:_}),jsxRuntimeExports.jsxs(InputGroup,{marginTop:"12px",children:[jsxRuntimeExports.jsx(Input,{"aria-label":_,autoComplete:"off",placeholder:$,type:it?"text":"password",...nt(a,{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:()=>st(ot=>!ot),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:a,onSubmit:_,isLoading:$,isDisabled:j,text:et,network:tt})=>{const rt=useForm({mode:"onBlur",defaultValues:{password:""}}),{handleSubmit:nt,formState:{errors:it,isValid:st}}=rt;let ot=useSelectedNetwork();tt&&(ot=tt);const at=useGetSecretKey(),ut=useToast(),{isLoading:ht,handleAsyncAction:yt}=useAsyncActionHandler(),wt=ht||$,Ct=async({password:Lt})=>yt(async()=>{const Dt=await at(a,Lt);return _(await makeToolkit({type:"mnemonic",secretKey:Dt,network:ot}))}),Pt=async({password:Lt})=>yt(async()=>{const Dt=await at(a,Lt);return _(await makeToolkit({type:"secret_key",secretKey:Dt,network:ot}))}),$t=async()=>yt(async()=>{const{secretKey:Lt}=await getGoogleCredentials();return _(await makeToolkit({type:"social",secretKey:Lt,network:ot}))}),Mt=async()=>yt(async()=>(ut({id:"ledger-sign-toast",description:"Please approve the operation on your Ledger",status:"info",duration:6e4,isClosable:!0}),_(await makeToolkit({type:"ledger",account:a,network:ot}))),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(a.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||!st,isLoading:wt,onClick:nt(a.type==="mnemonic"?Ct:Pt),size:"lg",type:"submit",children:et||"Submit Transaction"})]})});case"social":return jsxRuntimeExports.jsx(Button,{width:"100%",isDisabled:j,isLoading:wt,onClick:$t,size:"lg",children:et||"Sign with Google"});case"ledger":return jsxRuntimeExports.jsx(Button,{width:"100%",isDisabled:j,isLoading:wt,onClick:Mt,size:"lg",children:et||"Sign with Ledger"})}},SignPayloadRequestModal=({request:a})=>{const{onClose:_}=reactExports.useContext(DynamicModalContext),j=useGetImplicitAccount()(a.sourceAddress),et=useToast(),tt=useRemovePeerBySenderId(),rt=()=>{tt(a.senderId),WalletClient.respond({id:a.id,type:BeaconMessageType.Error,errorType:BeaconErrorType.ABORTED_ERROR})},nt=async it=>{const st=await it.signer.sign(a.payload),ot={type:BeaconMessageType.SignPayloadResponse,id:a.id,signingType:a.signingType,signature:st.prefixSig};await WalletClient.respond(ot),et({description:"Successfully submitted Beacon operation",status:"success"}),_()};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:`${a.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(a.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:a="Send",subTitle:_="Send one or insert into batch"})=>jsxRuntimeExports.jsxs(HeaderWrapper,{children:[jsxRuntimeExports.jsx(Heading,{size:"2xl",children:a}),jsxRuntimeExports.jsx(Text,{marginTop:"10px",color:colors.gray[400],textAlign:"center",size:"sm",children:_}),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:a})=>jsxRuntimeExports.jsx(IconButton,{...backButtonStyle,"aria-label":"Back","data-testid":"back-button",icon:jsxRuntimeExports.jsx(ArrowBackIcon,{width:"24px",height:"20px"}),onClick:a,size:"sm",variant:"ghost"}),headerText=(a,_)=>{let $;switch(a){case"implicit":$=_==="batch"?"Submit":"Confirm";break;case"proposal":$="Propose"}switch(_){case"single":return`${$} Transaction`;case"batch":return`${$} Batch`}},subTitle=a=>{switch(a.type){case"ledger":case"social":return;case"mnemonic":case"secret_key":return"Enter your password to confirm this transaction."}},SignPageHeader=({goBack:a,mode:_,operationsType:$,signer:j,title:et,description:tt,children:rt})=>jsxRuntimeExports.jsxs(HeaderWrapper,{children:[a&&jsxRuntimeExports.jsx(ModalBackButton,{onClick:a}),jsxRuntimeExports.jsx(Heading,{"data-testid":"sign-page-header",size:"2xl",children:et||headerText($,_)}),jsxRuntimeExports.jsx(Text,{marginTop:"10px",color:colors.gray[400],textAlign:"center",size:"sm",children:tt||subTitle(j)}),jsxRuntimeExports.jsx(ModalCloseButton,{}),rt]}),Header$1=({operation:a,message:_,mode:$})=>jsxRuntimeExports.jsxs(SignPageHeader,{mode:$,operationsType:a.type,signer:a.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(_.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:_.appMetadata.icon})}),jsxRuntimeExports.jsx(Heading,{size:"sm",children:_.appMetadata.name})]})]}),WindowLinkIcon=a=>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",...a,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:a})=>{const $=`${useSelectedNetwork().tzktExplorerUrl}/${a}`,{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(a,nt),st={type:BeaconMessageType.OperationResponse,id:_.id,transactionHash:it};return await WalletClient.respond(st),et(jsxRuntimeExports.jsx(SuccessStep,{hash:it}))},it=>({description:`Failed to confirm Beacon operation: ${it.message}`})),network:tt(_.network.type)}},SignPageFee=({fee:a})=>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(a)})]}),BatchSignPage=({operation:a,fee:_,message:$})=>{const{isSigning:j,onSign:et,network:tt}=useSignWithBeacon(a,$),{signer:rt}=a,nt=a.operations.length;return jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(Header$1,{message:$,mode:"batch",operation:a}),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:_})]})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isLoading:j,network:tt,onSubmit:et,signer:rt,text:headerText(a.type,"batch")})})]})})},TezTile=({mutezAmount:a})=>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(a)})})]}),ContractCallSignPage=({operation:a,fee:_,message:$})=>{const{amount:j,contract:et,entrypoint:tt,args:rt}=a.operations[0],{isSigning:nt,onSign:it,network:st}=useSignWithBeacon(a,$);return jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(Header$1,{message:$,mode:"single",operation:a}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(TezTile,{mutezAmount:j}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"end",marginTop:"12px",children:jsxRuntimeExports.jsx(SignPageFee,{fee:_})}),jsxRuntimeExports.jsx(FormLabel,{marginTop:"24px",children:"From "}),jsxRuntimeExports.jsx(AddressTile,{address:a.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:st,onSubmit:it,signer:a.signer,text:headerText(a.type,"single")})})]})})},DelegationSignPage=({operation:a,fee:_,message:$})=>{const{recipient:j}=a.operations[0],{isSigning:et,onSign:tt,network:rt}=useSignWithBeacon(a,$);return jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(Header$1,{message:$,mode:"single",operation:a}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(FormLabel,{children:"From"}),jsxRuntimeExports.jsx(AddressTile,{address:a.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:_})})}),jsxRuntimeExports.jsx(FormLabel,{children:"To"}),jsxRuntimeExports.jsx(AddressTile,{address:j})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isLoading:et,network:rt,onSubmit:tt,signer:a.signer,text:headerText(a.type,"single")})})]})})},OriginationOperationSignPage=({operation:a,fee:_,message:$})=>{const{isSigning:j,onSign:et,network:tt}=useSignWithBeacon(a,$),{code:rt,storage:nt}=a.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:_})}),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:a.signer,text:headerText(a.type,"single")})})]})},TezSignPage=({operation:a,fee:_,message:$})=>{const{amount:j,recipient:et}=a.operations[0],{isSigning:tt,onSign:rt,network:nt}=useSignWithBeacon(a,$);return jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(Header$1,{message:$,mode:"single",operation:a}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(TezTile,{mutezAmount:j}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"end",marginTop:"12px",children:jsxRuntimeExports.jsx(SignPageFee,{fee:_})}),jsxRuntimeExports.jsx(FormLabel,{marginTop:"24px",children:"From "}),jsxRuntimeExports.jsx(AddressTile,{address:a.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:a.signer,text:headerText(a.type,"single")})})]})})},UndelegationSignPage=({operation:a,fee:_,message:$})=>{const{isSigning:j,onSign:et,network:tt}=useSignWithBeacon(a,$);return jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(Header$1,{message:$,mode:"single",operation:a}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(FormLabel,{children:"From"}),jsxRuntimeExports.jsx(AddressTile,{address:a.signer.address}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"end",marginTop:"12px",paddingX:"4px",children:jsxRuntimeExports.jsx(SignPageFee,{fee:_})})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isLoading:j,network:tt,onSubmit:et,signer:a.signer,text:headerText(a.type,"single")})})]})})},BeaconSignPage=({operation:a,fee:_,message:$})=>{switch(a.operations[0].type){case"tez":return jsxRuntimeExports.jsx(TezSignPage,{fee:_,message:$,operation:a});case"contract_call":return jsxRuntimeExports.jsx(ContractCallSignPage,{fee:_,message:$,operation:a});case"delegation":return jsxRuntimeExports.jsx(DelegationSignPage,{fee:_,message:$,operation:a});case"undelegation":return jsxRuntimeExports.jsx(UndelegationSignPage,{fee:_,message:$,operation:a});case"contract_origination":return jsxRuntimeExports.jsx(OriginationOperationSignPage,{fee:_,message:$,operation:a});case"fa1.2":case"fa2":throw new Error("Unsupported operation type")}},useHandleBeaconMessage=()=>{const{openWith:a}=reactExports.useContext(DynamicModalContext),{handleAsyncAction:_}=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=>{_(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 st=toAccountOperations(tt.operationDetails,it),ot=await estimate(st,nt);st.operations.length===1?rt=jsxRuntimeExports.jsx(BeaconSignPage,{fee:ot,message:tt,operation:st}):rt=jsxRuntimeExports.jsx(BatchSignPage,{fee:ot,message:tt,operation:st});break}default:throw WalletClient.respond({id:tt.id,type:BeaconMessageType.Error,errorType:BeaconErrorType.UNKNOWN_ERROR}),new Error(`Unknown Beacon message type: ${tt.type}`)}return a(rt)},rt=>({description:`Error while processing Beacon request: ${rt.message}`}))}},toAccountOperations=(a,_)=>{if(a.length===0)throw new Error("Empty operation details!");const $=a.map(j=>partialOperationToOperation(j,_));return{type:"implicit",sender:_,operations:$,signer:_}},partialOperationToOperation=(a,_)=>{switch(a.kind){case TezosOperationType.TRANSACTION:{const{destination:$,amount:j,parameters:et}=a;return et?{type:"contract_call",amount:j,contract:parsePkh($),entrypoint:et.entrypoint,args:et.value}:{type:"tez",amount:j,recipient:parseImplicitPkh(a.destination)}}case TezosOperationType.DELEGATION:{const{delegate:$}=a;return $?{type:"delegation",sender:_.address,recipient:parseImplicitPkh($)}:{type:"undelegation",sender:_.address}}case TezosOperationType.ORIGINATION:{const{script:$}=a,{code:j,storage:et}=$;return{type:"contract_origination",sender:_.address,code:j,storage:et}}default:throw new Error(`Unsupported operation kind: ${a.kind}`)}},BeaconProvider=({children:a})=>{const _=useToast(),$=useHandleBeaconMessage();return reactExports.useEffect(()=>{WalletClient.init().then(()=>WalletClient.connect($)).catch(j=>{_({status:j,description:`Failed to connect to Beacon: ${j.message}`})})}),a};function toDate(a){const _=Object.prototype.toString.call(a);return a instanceof Date||typeof a=="object"&&_==="[object Date]"?new a.constructor(+a):typeof a=="number"||_==="[object Number]"||typeof a=="string"||_==="[object String]"?new Date(a):new Date(NaN)}function constructFrom(a,_){return a instanceof Date?new a.constructor(_):new Date(_)}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,st,ot;const $=getDefaultOptions(),j=(_==null?void 0:_.weekStartsOn)??((it=(nt=_==null?void 0:_.locale)==null?void 0:nt.options)==null?void 0:it.weekStartsOn)??$.weekStartsOn??((ot=(st=$.locale)==null?void 0:st.options)==null?void 0:ot.weekStartsOn)??0,et=toDate(a),tt=et.getDay(),rt=(tt=et.getTime()?$+1:_.getTime()>=rt.getTime()?$:$-1}function startOfDay(a){const _=toDate(a);return _.setHours(0,0,0,0),_}function getTimezoneOffsetInMilliseconds(a){const _=toDate(a),$=new Date(Date.UTC(_.getFullYear(),_.getMonth(),_.getDate(),_.getHours(),_.getMinutes(),_.getSeconds(),_.getMilliseconds()));return $.setUTCFullYear(_.getFullYear()),+a-+$}function differenceInCalendarDays(a,_){const $=startOfDay(a),j=startOfDay(_),et=+$-getTimezoneOffsetInMilliseconds($),tt=+j-getTimezoneOffsetInMilliseconds(j);return Math.round((et-tt)/millisecondsInDay)}function startOfISOWeekYear(a){const _=getISOWeekYear(a),$=constructFrom(a,0);return $.setFullYear(_,0,4),$.setHours(0,0,0,0),startOfISOWeek($)}function compareAsc(a,_){const $=toDate(a),j=toDate(_),et=$.getTime()-j.getTime();return et<0?-1:et>0?1:et}function isDate(a){return a instanceof Date||typeof a=="object"&&Object.prototype.toString.call(a)==="[object Date]"}function isValid(a){if(!isDate(a)&&typeof a!="number")return!1;const _=toDate(a);return!isNaN(Number(_))}function differenceInCalendarMonths(a,_){const $=toDate(a),j=toDate(_),et=$.getFullYear()-j.getFullYear(),tt=$.getMonth()-j.getMonth();return et*12+tt}function differenceInDays(a,_){const $=toDate(a),j=toDate(_),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 $=a.getFullYear()-_.getFullYear()||a.getMonth()-_.getMonth()||a.getDate()-_.getDate()||a.getHours()-_.getHours()||a.getMinutes()-_.getMinutes()||a.getSeconds()-_.getSeconds()||a.getMilliseconds()-_.getMilliseconds();return $<0?-1:$>0?1:$}function getRoundingMethod(a){return _=>{const j=(a?Math[a]:Math.trunc)(_);return j===0?0:j}}function differenceInMilliseconds(a,_){return+toDate(a)-+toDate(_)}function differenceInMinutes(a,_,$){const j=differenceInMilliseconds(a,_)/millisecondsInMinute;return getRoundingMethod($==null?void 0:$.roundingMethod)(j)}function endOfDay(a){const _=toDate(a);return _.setHours(23,59,59,999),_}function endOfMonth(a){const _=toDate(a),$=_.getMonth();return _.setFullYear(_.getFullYear(),$+1,0),_.setHours(23,59,59,999),_}function isLastDayOfMonth(a){const _=toDate(a);return+endOfDay(_)==+endOfMonth(_)}function differenceInMonths(a,_){const $=toDate(a),j=toDate(_),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(a))&&tt===1&&compareAsc(a,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(a){const _=toDate(a),$=constructFrom(a,0);return $.setFullYear(_.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[a];return typeof et=="string"?j=et:_===1?j=et.one:j=et.other.replace("{{count}}",_.toString()),$!=null&&$.addSuffix?$.comparison&&$.comparison>0?"in "+j:j+" ago":j};function buildFormatLongFn(a){return(_={})=>{const $=_.width?String(_.width):a.defaultWidth;return a.formats[$]||a.formats[a.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[a];function buildLocalizeFn(a){return(_,$)=>{const j=$!=null&&$.context?String($.context):"standalone";let et;if(j==="formatting"&&a.formattingValues){const rt=a.defaultFormattingWidth||a.defaultWidth,nt=$!=null&&$.width?String($.width):rt;et=a.formattingValues[nt]||a.formattingValues[rt]}else{const rt=a.defaultWidth,nt=$!=null&&$.width?String($.width):a.defaultWidth;et=a.values[nt]||a.values[rt]}const tt=a.argumentCallback?a.argumentCallback(_):_;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(a),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:a=>a-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(a){return(_,$={})=>{const j=$.width,et=j&&a.matchPatterns[j]||a.matchPatterns[a.defaultMatchWidth],tt=_.match(et);if(!tt)return null;const rt=tt[0],nt=j&&a.parsePatterns[j]||a.parsePatterns[a.defaultParseWidth],it=Array.isArray(nt)?findIndex(nt,at=>at.test(rt)):findKey(nt,at=>at.test(rt));let st;st=a.valueCallback?a.valueCallback(it):it,st=$.valueCallback?$.valueCallback(st):st;const ot=_.slice(rt.length);return{value:st,rest:ot}}}function findKey(a,_){for(const $ in a)if(Object.prototype.hasOwnProperty.call(a,$)&&_(a[$]))return $}function findIndex(a,_){for(let $=0;${const j=_.match(a.matchPattern);if(!j)return null;const et=j[0],tt=_.match(a.parsePattern);if(!tt)return null;let rt=a.valueCallback?a.valueCallback(tt[0]):tt[0];rt=$.valueCallback?$.valueCallback(rt):rt;const nt=_.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:a=>parseInt(a,10)}),era:buildMatchFn({matchPatterns:matchEraPatterns,defaultMatchWidth:"wide",parsePatterns:parseEraPatterns,defaultParseWidth:"any"}),quarter:buildMatchFn({matchPatterns:matchQuarterPatterns,defaultMatchWidth:"wide",parsePatterns:parseQuarterPatterns,defaultParseWidth:"any",valueCallback:a=>a+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(a){const _=toDate(a);return differenceInCalendarDays(_,startOfYear(_))+1}function getISOWeek(a){const _=toDate(a),$=+startOfISOWeek(_)-+startOfISOWeekYear(_);return Math.round($/millisecondsInWeek)+1}function getWeekYear(a,_){var ot,at,ut,ht;const $=toDate(a),j=$.getFullYear(),et=getDefaultOptions(),tt=(_==null?void 0:_.firstWeekContainsDate)??((at=(ot=_==null?void 0:_.locale)==null?void 0:ot.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(a,0);rt.setFullYear(j+1,0,tt),rt.setHours(0,0,0,0);const nt=startOfWeek(rt,_),it=constructFrom(a,0);it.setFullYear(j,0,tt),it.setHours(0,0,0,0);const st=startOfWeek(it,_);return $.getTime()>=nt.getTime()?j+1:$.getTime()>=st.getTime()?j:j-1}function startOfWeekYear(a,_){var nt,it,st,ot;const $=getDefaultOptions(),j=(_==null?void 0:_.firstWeekContainsDate)??((it=(nt=_==null?void 0:_.locale)==null?void 0:nt.options)==null?void 0:it.firstWeekContainsDate)??$.firstWeekContainsDate??((ot=(st=$.locale)==null?void 0:st.options)==null?void 0:ot.firstWeekContainsDate)??1,et=getWeekYear(a,_),tt=constructFrom(a,0);return tt.setFullYear(et,0,j),tt.setHours(0,0,0,0),startOfWeek(tt,_)}function getWeek(a,_){const $=toDate(a),j=+startOfWeek($,_)-+startOfWeekYear($,_);return Math.round(j/millisecondsInWeek)+1}function addLeadingZeros(a,_){const $=a<0?"-":"",j=Math.abs(a).toString().padStart(_,"0");return $+j}const lightFormatters={y(a,_){const $=a.getFullYear(),j=$>0?$:1-$;return addLeadingZeros(_==="yy"?j%100:j,_.length)},M(a,_){const $=a.getMonth();return _==="M"?String($+1):addLeadingZeros($+1,2)},d(a,_){return addLeadingZeros(a.getDate(),_.length)},a(a,_){const $=a.getHours()/12>=1?"pm":"am";switch(_){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(a.getHours()%12||12,_.length)},H(a,_){return addLeadingZeros(a.getHours(),_.length)},m(a,_){return addLeadingZeros(a.getMinutes(),_.length)},s(a,_){return addLeadingZeros(a.getSeconds(),_.length)},S(a,_){const $=_.length,j=a.getMilliseconds(),et=Math.trunc(j*Math.pow(10,$-3));return addLeadingZeros(et,_.length)}},dayPeriodEnum={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},formatters={G:function(a,_,$){const j=a.getFullYear()>0?1:0;switch(_){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(_==="yo"){const j=a.getFullYear(),et=j>0?j:1-j;return $.ordinalNumber(et,{unit:"year"})}return lightFormatters.y(a,_)},Y:function(a,_,$,j){const et=getWeekYear(a,j),tt=et>0?et:1-et;if(_==="YY"){const rt=tt%100;return addLeadingZeros(rt,2)}return _==="Yo"?$.ordinalNumber(tt,{unit:"year"}):addLeadingZeros(tt,_.length)},R:function(a,_){const $=getISOWeekYear(a);return addLeadingZeros($,_.length)},u:function(a,_){const $=a.getFullYear();return addLeadingZeros($,_.length)},Q:function(a,_,$){const j=Math.ceil((a.getMonth()+1)/3);switch(_){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((a.getMonth()+1)/3);switch(_){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=a.getMonth();switch(_){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=a.getMonth();switch(_){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(a,j);return _==="wo"?$.ordinalNumber(et,{unit:"week"}):addLeadingZeros(et,_.length)},I:function(a,_,$){const j=getISOWeek(a);return _==="Io"?$.ordinalNumber(j,{unit:"week"}):addLeadingZeros(j,_.length)},d:function(a,_,$){return _==="do"?$.ordinalNumber(a.getDate(),{unit:"date"}):lightFormatters.d(a,_)},D:function(a,_,$){const j=getDayOfYear(a);return _==="Do"?$.ordinalNumber(j,{unit:"dayOfYear"}):addLeadingZeros(j,_.length)},E:function(a,_,$){const j=a.getDay();switch(_){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=a.getDay(),tt=(et-j.weekStartsOn+8)%7||7;switch(_){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=a.getDay(),tt=(et-j.weekStartsOn+8)%7||7;switch(_){case"c":return String(tt);case"cc":return addLeadingZeros(tt,_.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=a.getDay(),et=j===0?7:j;switch(_){case"i":return String(et);case"ii":return addLeadingZeros(et,_.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=a.getHours()/12>=1?"pm":"am";switch(_){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=a.getHours();let et;switch(j===12?et=dayPeriodEnum.noon:j===0?et=dayPeriodEnum.midnight:et=j/12>=1?"pm":"am",_){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=a.getHours();let et;switch(j>=17?et=dayPeriodEnum.evening:j>=12?et=dayPeriodEnum.afternoon:j>=4?et=dayPeriodEnum.morning:et=dayPeriodEnum.night,_){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(_==="ho"){let j=a.getHours()%12;return j===0&&(j=12),$.ordinalNumber(j,{unit:"hour"})}return lightFormatters.h(a,_)},H:function(a,_,$){return _==="Ho"?$.ordinalNumber(a.getHours(),{unit:"hour"}):lightFormatters.H(a,_)},K:function(a,_,$){const j=a.getHours()%12;return _==="Ko"?$.ordinalNumber(j,{unit:"hour"}):addLeadingZeros(j,_.length)},k:function(a,_,$){let j=a.getHours();return j===0&&(j=24),_==="ko"?$.ordinalNumber(j,{unit:"hour"}):addLeadingZeros(j,_.length)},m:function(a,_,$){return _==="mo"?$.ordinalNumber(a.getMinutes(),{unit:"minute"}):lightFormatters.m(a,_)},s:function(a,_,$){return _==="so"?$.ordinalNumber(a.getSeconds(),{unit:"second"}):lightFormatters.s(a,_)},S:function(a,_){return lightFormatters.S(a,_)},X:function(a,_,$){const j=a.getTimezoneOffset();if(j===0)return"Z";switch(_){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=a.getTimezoneOffset();switch(_){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=a.getTimezoneOffset();switch(_){case"O":case"OO":case"OOO":return"GMT"+formatTimezoneShort(j,":");case"OOOO":default:return"GMT"+formatTimezone(j,":")}},z:function(a,_,$){const j=a.getTimezoneOffset();switch(_){case"z":case"zz":case"zzz":return"GMT"+formatTimezoneShort(j,":");case"zzzz":default:return"GMT"+formatTimezone(j,":")}},t:function(a,_,$){const j=Math.trunc(a.getTime()/1e3);return addLeadingZeros(j,_.length)},T:function(a,_,$){const j=a.getTime();return addLeadingZeros(j,_.length)}};function formatTimezoneShort(a,_=""){const $=a>0?"-":"+",j=Math.abs(a),et=Math.trunc(j/60),tt=j%60;return tt===0?$+String(et):$+String(et)+_+addLeadingZeros(tt,2)}function formatTimezoneWithOptionalMinutes(a,_){return a%60===0?(a>0?"-":"+")+addLeadingZeros(Math.abs(a)/60,2):formatTimezone(a,_)}function formatTimezone(a,_=""){const $=a>0?"-":"+",j=Math.abs(a),et=addLeadingZeros(Math.trunc(j/60),2),tt=addLeadingZeros(j%60,2);return $+et+_+tt}const dateLongFormatter=(a,_)=>{switch(a){case"P":return _.date({width:"short"});case"PP":return _.date({width:"medium"});case"PPP":return _.date({width:"long"});case"PPPP":default:return _.date({width:"full"})}},timeLongFormatter=(a,_)=>{switch(a){case"p":return _.time({width:"short"});case"pp":return _.time({width:"medium"});case"ppp":return _.time({width:"long"});case"pppp":default:return _.time({width:"full"})}},dateTimeLongFormatter=(a,_)=>{const $=a.match(/(P+)(p+)?/)||[],j=$[1],et=$[2];if(!et)return dateLongFormatter(a,_);let tt;switch(j){case"P":tt=_.dateTime({width:"short"});break;case"PP":tt=_.dateTime({width:"medium"});break;case"PPP":tt=_.dateTime({width:"long"});break;case"PPPP":default:tt=_.dateTime({width:"full"});break}return tt.replace("{{date}}",dateLongFormatter(j,_)).replace("{{time}}",timeLongFormatter(et,_))},longFormatters={p:timeLongFormatter,P:dateTimeLongFormatter},dayOfYearTokenRE=/^D+$/,weekYearTokenRE=/^Y+$/,throwTokens=["D","DD","YY","YYYY"];function isProtectedDayOfYearToken(a){return dayOfYearTokenRE.test(a)}function isProtectedWeekYearToken(a){return weekYearTokenRE.test(a)}function warnOrThrowProtectedError(a,_,$){const j=message(a,_,$);if(console.warn(j),throwTokens.includes(a))throw new RangeError(j)}function message(a,_,$){const j=a[0]==="Y"?"years":"days of the month";return`Use \`${a.toLowerCase()}\` instead of \`${a}\` (in \`${_}\`) 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 ot,at,ut,ht,yt,wt,Ct,Pt;const j=getDefaultOptions(),et=($==null?void 0:$.locale)??j.locale??enUS,tt=($==null?void 0:$.firstWeekContainsDate)??((at=(ot=$==null?void 0:$.locale)==null?void 0:ot.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)??((wt=(yt=$==null?void 0:$.locale)==null?void 0:yt.options)==null?void 0:wt.weekStartsOn)??j.weekStartsOn??((Pt=(Ct=j.locale)==null?void 0:Ct.options)==null?void 0:Pt.weekStartsOn)??0,nt=toDate(a);if(!isValid(nt))throw new RangeError("Invalid time value");let it=_.match(longFormattingTokensRegExp).map($t=>{const Mt=$t[0];if(Mt==="p"||Mt==="P"){const Lt=longFormatters[Mt];return Lt($t,et.formatLong)}return $t}).join("").match(formattingTokensRegExp).map($t=>{if($t==="''")return{isToken:!1,value:"'"};const Mt=$t[0];if(Mt==="'")return{isToken:!1,value:cleanEscapedString($t)};if(formatters[Mt])return{isToken:!0,value:$t};if(Mt.match(unescapedLatinCharacterRegExp))throw new RangeError("Format string contains an unescaped latin alphabet character `"+Mt+"`");return{isToken:!1,value:$t}});et.localize.preprocessor&&(it=et.localize.preprocessor(nt,it));const st={firstWeekContainsDate:tt,weekStartsOn:rt,locale:et};return it.map($t=>{if(!$t.isToken)return $t.value;const Mt=$t.value;(!($!=null&&$.useAdditionalWeekYearTokens)&&isProtectedWeekYearToken(Mt)||!($!=null&&$.useAdditionalDayOfYearTokens)&&isProtectedDayOfYearToken(Mt))&&warnOrThrowProtectedError(Mt,_,String(a));const Lt=formatters[Mt[0]];return Lt(nt,Mt,et.localize,st)}).join("")}function cleanEscapedString(a){const _=a.match(escapedStringRegExp);return _?_[1].replace(doubleQuoteRegExp,"'"):a}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,st;rt>0?(it=toDate(_),st=toDate(a)):(it=toDate(a),st=toDate(_));const ot=differenceInSeconds(st,it),at=(getTimezoneOffsetInMilliseconds(st)-getTimezoneOffsetInMilliseconds(it))/1e3,ut=Math.round((ot-at)/60);let ht;if(ut<2)return $!=null&&$.includeSeconds?ot<5?et.formatDistance("lessThanXSeconds",5,nt):ot<10?et.formatDistance("lessThanXSeconds",10,nt):ot<20?et.formatDistance("lessThanXSeconds",20,nt):ot<40?et.formatDistance("halfAMinute",0,nt):ot<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 a=useAppDispatch(),_=useToast();return reactExports.useCallback(j=>{j&&(a(errorsSlice.actions.add(getErrorContext(j))),_({description:`Data fetching error: ${j.message}`,status:"error",isClosable:!0}))},[a,_])},BAKERS_REFRESH_RATE=hoursToMilliseconds(2),usePollBakers=()=>{const a=useAppDispatch(),_=useReactQueryErrorHandler(),$=useSelectedNetwork(),j=useQuery({queryKey:["bakers",a,$],queryFn:()=>getBakers($),retry:!1,refetchInterval:BAKERS_REFRESH_RATE,refetchIntervalInBackground:!0,refetchOnWindowFocus:!1}),et=j.data;return reactExports.useEffect(()=>{et&&a(assetsActions.updateBakers(et))},[a,et]),_(j.error),j},BLOCK_TIME=secondsToMilliseconds(15),usePollBlockLevel=()=>{const a=useAppDispatch(),_=useReactQueryErrorHandler(),$=useSelectedNetwork(),j=useQuery({queryKey:["blockLevel",a,$],queryFn:()=>getLatestBlockLevel($),retry:!1,refetchInterval:BLOCK_TIME,refetchIntervalInBackground:!0,refetchOnWindowFocus:!1}),et=j.data;return reactExports.useEffect(()=>{et&&a(assetsActions.updateBlockLevel(et))},[a,et]),_(j.error),j},CONVERSION_RATE_REFRESH_RATE=minutesToMilliseconds(5),usePollConversionRate=()=>{const a=useAppDispatch(),_=useReactQueryErrorHandler(),$=useQuery({queryKey:["conversionRate",a],queryFn:getTezosPriceInUSD,refetchInterval:CONVERSION_RATE_REFRESH_RATE,refetchIntervalInBackground:!0,refetchOnWindowFocus:!1}),j=$.data;return reactExports.useEffect(()=>{a(assetsActions.updateConversionRate(j))},[a,j]),_($.error),$},usePollMultisigs=()=>{const a=useAppDispatch(),_=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&&a(multisigActions.setMultisigs(rt))},[rt,a]),_(tt.error),tt},usePollPendingOperations=()=>{const a=useAppDispatch(),_=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&&a(multisigActions.setPendingOperations(rt))},[a,rt]),_(tt.error),tt},usePollTezBalances=()=>{const a=useAppDispatch(),_=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&&a(assetsActions.updateTezBalance(rt))},[a,rt]),_(tt.error),tt},usePollTokenBalances=()=>{const a=useAppDispatch(),_=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:st})=>({...it,lastLevel:st}));a(tokensActions.addTokens({network:$,tokens:nt})),a(assetsActions.updateTokenBalance(rt))},[a,rt,$]),_(tt.error),tt},useDataPolling=()=>{const a=useAppDispatch(),{dataUpdatedAt:_,isFetching:$}=usePollMultisigs(),{dataUpdatedAt:j,isFetching:et}=usePollPendingOperations(),{dataUpdatedAt:tt,isFetching:rt}=usePollTezBalances(),{dataUpdatedAt:nt,isFetching:it}=usePollTokenBalances();usePollConversionRate(),usePollBlockLevel(),usePollBakers();const st=$||et||rt||it,ot=Math.max(_,j,tt,nt);reactExports.useEffect(()=>{a(assetsActions.setIsLoading(st)),!st&&ot&&a(assetsActions.setLastTimeUpdated(fromUnixTime(Math.round(ot/1e3)).toUTCString()))},[a,st,ot])},useDeeplinkHandler=()=>{const a=useToast(),_=useAddPeer(),$=reactExports.useRef(_),j=reactExports.useRef(a),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 st=new URL(nt).searchParams.get("data");st?$.current(st):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:a,formatAddress:_=!0,copyable:$=!0,iconColor:j=colors.gray[600],...et})=>jsxRuntimeExports.jsx(CopyableText,{copyValue:$?a:void 0,displayText:_?formatPkh(a):a,iconColor:j,toastMessage:"Address copied to clipboard",...et}),CopyableText=({displayText:a,copyValue:_,toastMessage:$,iconColor:j,...et})=>{const tt=useToast(),rt=async()=>{_&&(await navigator.clipboard.writeText(_),!(!$||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:a})=>{const{handleAsyncAction:_}=useAsyncActionHandler(),$=useAppDispatch(),{isOpen:j,onClose:et}=reactExports.useContext(DynamicModalContext),tt=useAvailableNetworks(),rt=!!(a!=null&&a.pkh&&a.name),nt=async Pt=>{isValidContractPkh(Pt.pkh)?await _(async()=>{const $t=await getNetworksForContracts(tt,[Pt.pkh]);if(!$t.has(Pt.pkh))throw new Error(`Network not found for contract ${Pt.pkh}`);$(contactsActions.upsert({...Pt,network:$t.get(Pt.pkh)}))}):$(contactsActions.upsert({...Pt,network:void 0})),et(),ut()},{handleSubmit:it,formState:{isValid:st,errors:ot},register:at,reset:ut}=useForm({mode:"onBlur",defaultValues:a}),ht=({name:Pt,pkh:$t})=>{nt({name:Pt.trim(),pkh:$t})},yt=reactExports.useRef(ut);reactExports.useEffect(()=>{j&&yt.current(a)},[j,a]);const wt=useValidateNewContactPkh(),Ct=useValidateName(a==null?void 0:a.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:!!ot.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"}),ot.name&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"name-error",children:ot.name.message})]}),jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!ot.pkh,marginY:5,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Address"}),jsxRuntimeExports.jsx(Input,{type:"text",...at("pkh",{required:"Address is required",validate:rt?()=>!0:wt}),disabled:rt,placeholder:"Enter contact's tz address",variant:rt?"filled":void 0}),ot.pkh&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"address-error",children:ot.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:!st,size:"lg",type:"submit",children:rt?"Update":"Add to Address Book"})})})]})})},DeleteContactModal=({contact:a})=>{const _=useAppDispatch(),{onClose:$}=reactExports.useContext(DynamicModalContext),j=()=>{_(contactsActions.remove(a.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:a.name}),jsxRuntimeExports.jsx(CopyableAddress,{pkh:a.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=a=>{const{onOpen:_,onClose:$,isOpen:j}=useDisclosure$1();return jsxRuntimeExports.jsxs(Popover,{isOpen:j,onClose:$,onOpen:_,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:a.children})})]})},RenameRemoveMenu=({onRename:a,onRemove:_})=>jsxRuntimeExports.jsx(Flex,{alignItems:"center",children:jsxRuntimeExports.jsx(PopoverMenu,{children:jsxRuntimeExports.jsxs(Box,{paddingY:"0",children:[jsxRuntimeExports.jsx(Button,{height:_?"24px":"28px",onClick:a,variant:"popover",children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",children:[jsxRuntimeExports.jsx(Text,{marginRight:"4px",children:"Rename"}),jsxRuntimeExports.jsx(PenIcon,{stroke:"inherit"})]})}),_&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Divider,{marginY:"4px"}),jsxRuntimeExports.jsx(Button,{"data-testid":"popover-remove",onClick:_,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:a,variant:"specialCTA",..._,children:[jsxRuntimeExports.jsx(OutgoingArrow,{stroke:"currentcolor"}),jsxRuntimeExports.jsx(Text,{marginLeft:"4px",children:"Send"})]}),OperationSignerSelector=({sender:a,operationType:_,isLoading:$,reEstimate:j})=>{switch(_){case"proposal":return jsxRuntimeExports.jsx(FormControl,{marginTop:"24px","data-testid":"signer-selector",children:jsxRuntimeExports.jsx(AvailableSignersAutocomplete,{account:a,inputName:"signer",isLoading:$,keepValid:!0,label:"Select Proposer",onUpdate:j})});case"implicit":return null}},makeAccountOperations=(a,_,$)=>{switch(a.type){case"ledger":case"mnemonic":case"social":case"secret_key":if(a.address.pkh!==_.address.pkh)throw new Error("Sender and Signer must be the same");return{type:"implicit",operations:$,signer:a,sender:a};case"multisig":return{type:"proposal",operations:$,sender:a,signer:_}}},useBatches=()=>{const a=useSelectedNetwork();return useAppSelector($=>$.batches[a.name])||[]},useClearBatch=()=>{const a=useAppDispatch(),_=useSelectedNetwork();return $=>a(batchesActions.clear({pkh:$.address.pkh,network:_}))},useRemoveBatchItem=()=>{const a=useAppDispatch(),_=useSelectedNetwork();return($,j)=>a(batchesActions.removeItem({pkh:$.address.pkh,index:j,network:_}))},FormSubmitButtons=({isLoading:a,isValid:_,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:!_,isLoading:a,onClick:$,size:"lg",type:"submit",children:"Preview"}),jsxRuntimeExports.jsx(Button,{width:"100%",isDisabled:!_,isLoading:a,onClick:j,size:"lg",type:"submit",variant:"tertiary",children:"Insert Into Batch"})]})}),formDefaultValues=({sender:a,form:_})=>_||(a?{sender:a.address.pkh}:{}),useSignPageHelpers=(a,_,$)=>{const[j,et]=reactExports.useState(!1),tt=useGetImplicitAccount(),[rt,nt]=reactExports.useState(a),[it,st]=reactExports.useState(_),ot=useSelectedNetwork(),at=useClearBatch(),{isLoading:ut,handleAsyncAction:ht,handleAsyncActionUnsafe:yt}=useAsyncActionHandler(),{openWith:wt}=reactExports.useContext(DynamicModalContext),Ct=useForm({mode:"onBlur",defaultValues:{signer:it.signer.address.pkh,sender:it.sender.address.pkh}}),Pt=Ct.watch("signer"),$t=async Lt=>yt(async()=>{const Dt={...it,signer:tt(Lt)};nt(await estimate(it,ot)),st(Dt),et(!1)},{isClosable:!0,duration:null}).catch(()=>et(!0)),Mt=async Lt=>ht(async()=>{const Dt=await executeOperations(it,Lt);return $==="batch"&&at(it.sender),await wt(jsxRuntimeExports.jsx(SuccessStep,{hash:Dt.opHash})),Dt});return{fee:rt,estimationFailed:j,operations:it,isLoading:ut,form:Ct,signer:tt(Pt),reEstimate:$t,onSign:Mt}},useMakeFormOperations=a=>{const _=useGetOwnedAccount(),$=useGetBestSignerForAccount();return j=>{const et=_(j.sender);return makeAccountOperations(et,$(et),[a(j)])}},getSmallestUnit=a=>(a<0&&(console.warn("Decimals cannot be negative"),a=0),`${a===0?"":"0."+lodashExports.repeat("0",a-1)}1`),makeValidateDecimals=a=>_=>_.includes(".")&&_.split(".")[1].length>a?`Please enter a value with up to ${a} decimal places`:!0,SignPage$6=a=>{const{mode:_,operations:$,fee:j}=a,{fee:et,operations:tt,estimationFailed:rt,isLoading:nt,form:it,signer:st,reEstimate:ot,onSign:at}=useSignPageHelpers(j,$,_),{amount:ut,recipient:ht}=tt.operations[0];return jsxRuntimeExports.jsx(FormProvider,{...it,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(SignPageHeader,{...a,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:ot,sender:tt.sender})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:rt,isLoading:nt,onSubmit:at,signer:st,text:headerText(tt.type,_)})})]})})})},estimateAndUpdateBatch=(a,_)=>async $=>{await estimate(a,_),$(batchesActions.add({operations:a,network:_}))},useOpenSignPageFormAction=({SignPage:a,signPageExtraData:_,FormPage:$,defaultFormPageProps:j,toOperation:et})=>{const{openWith:tt}=reactExports.useContext(DynamicModalContext),rt=useMakeFormOperations(et),nt=useSelectedNetwork();return async it=>{const st=rt(it);return tt(jsxRuntimeExports.jsx(a,{data:_,fee:await estimate(st,nt),goBack:()=>tt(jsxRuntimeExports.jsx($,{...j,form:it})),mode:"single",operations:st}))}},useAddToBatchFormAction=a=>{const{onClose:_}=reactExports.useContext(DynamicModalContext),$=useSelectedNetwork(),j=useMakeFormOperations(a),et=useAppDispatch(),tt=useToast();return async nt=>{const it=j(nt);await et(estimateAndUpdateBatch(it,$)),tt({description:"Transaction added to batch!",status:"success"}),_()}},useHandleOnSubmitFormActions=a=>{const{handleAsyncAction:_,isLoading:$}=useAsyncActionHandler();return{onFormSubmitActionHandlers:a.map(et=>async tt=>_(()=>et(tt))),isLoading:$}},FormPage$4=({showPreview:a=!0,..._})=>{const $=useOpenSignPageFormAction({SignPage:SignPage$6,signPageExtraData:void 0,FormPage:FormPage$4,defaultFormPageProps:_,toOperation:toOperation$5}),j=useAddToBatchFormAction(toOperation$5),{onFormSubmitActionHandlers:[et,tt],isLoading:rt}=useHandleOnSubmitFormActions([$,j]),nt=useForm({mode:"onBlur",defaultValues:formDefaultValues(_)}),{formState:{isValid:it,errors:st},register:ot,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:!!st.prettyAmount,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Amount"}),jsxRuntimeExports.jsxs(InputGroup,{children:[jsxRuntimeExports.jsx(Input,{isDisabled:rt,step:getSmallestUnit(TEZ_DECIMALS),type:"number",...ot("prettyAmount",{required:"Amount is required",validate:makeValidateDecimals(TEZ_DECIMALS)}),placeholder:"0.000000"}),jsxRuntimeExports.jsx(InputRightElement,{children:TEZ})]}),st.prettyAmount&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"amount-error",children:st.prettyAmount.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!st.sender,children:[jsxRuntimeExports.jsx(OwnedAccountsAutocomplete,{allowUnknown:!1,inputName:"sender",isDisabled:!!_.sender,label:"From"}),st.sender&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"from-error",children:st.sender.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!st.recipient,children:[jsxRuntimeExports.jsx(KnownAccountsAutocomplete,{allowUnknown:!0,inputName:"recipient",label:"To"}),st.recipient&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"recipient-error",children:st.recipient.message})]})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(FormSubmitButtons,{isLoading:rt,isValid:it,onAddToBatch:at(tt),onSingleSubmit:at(et),showPreview:a})})]})})})},toOperation$5=a=>({type:"tez",amount:tezToMutez(a.prettyAmount).toFixed(),recipient:parsePkh(a.recipient)}),ContactTable=({contacts:a})=>{const{openWith:_}=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:a.map(($,j)=>{const et=j===a.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:()=>_(jsxRuntimeExports.jsx(FormPage$4,{form:{sender:"",recipient:$.pkh,prettyAmount:""}}))}),jsxRuntimeExports.jsx(RenameRemoveMenu,{onRemove:()=>_(jsxRuntimeExports.jsx(DeleteContactModal,{contact:$})),onRename:()=>_(jsxRuntimeExports.jsx(UpsertContactModal,{contact:$}))})]})})]},$.pkh)})})})})})},ExternalLink=({href:a,children:_,...$})=>jsxRuntimeExports.jsx(Link$1,{alignItems:"center",display:"flex",_hover:{textDecoration:"none"},href:a,rel:"noopener noreferrer",role:"link",target:"_blank",...$,children:_}),SIZES={md:{heading:"xl",description:"md",button:"md"},lg:{heading:"3xl",description:"xl",button:"lg"}},NoItems=({title:a,description:_,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:a}),jsxRuntimeExports.jsx(Text,{marginBottom:"30px",color:colors.gray[400],textAlign:"center",size:SIZES[j].description,children:_}),jsxRuntimeExports.jsx(Center,{children:$})]})}),NoOperations=({size:a})=>jsxRuntimeExports.jsx(NoItems,{description:"Your operations history will appear here...",size:a,title:"No operations to show"}),NoNFTs=({size:a})=>jsxRuntimeExports.jsx(NoItems,{description:"Your NFT collection will appear here...",size:a,title:"No NFTs to show",children:jsxRuntimeExports.jsx(ExternalLink,{"data-testid":"buy-nft-button",href:"https://objkt.com",children:jsxRuntimeExports.jsx(Button,{size:SIZES[a].button,children:"Buy your first NFT"})})}),NoTokens=({size:a})=>jsxRuntimeExports.jsx(NoItems,{description:"All of your tokens will appear here...",size:a,title:"No tokens to show"}),NoDelegations=({size:a="lg",onDelegate:_})=>jsxRuntimeExports.jsx(NoItems,{description:"Your delegation history will appear here...",size:a,title:"No delegations to show",children:jsxRuntimeExports.jsx(Button,{"data-testid":"delegation-empty-state-button",onClick:_,size:SIZES[a].button,children:"Delegate"})}),BuyTezForm=({recipient:a=""})=>{const _=useSelectedNetwork(),$=_.name==="mainnet",j=$?"Buy Tez":"Request Tez from faucet",et=useForm({mode:"onBlur",defaultValues:{address:a}}),{formState:{isValid:tt,errors:rt}}=et;let nt=_.buyTezUrl;return _.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:!!a,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=a=>jsxRuntimeExports.jsx(Icon,{width:"15px",height:"11px",fill:"none",stroke:"white",viewBox:"0 0 15 11",xmlns:"http://www.w3.org/2000/svg",...a,children:jsxRuntimeExports.jsx("path",{d:"M1.16602 5.98371L5.06345 9.85408L13.8327 1.14575",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.2"})}),UpdateButton=()=>{const a=useAppDispatch(),_=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=()=>{a(assetsActions.refetch())},st=differenceInMinutes(new Date,new Date($))>=2,ot={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?ot:void 0,children:[tt&&"Updated just now",st&&`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:ot}):jsxRuntimeExports.jsx(FetchingIcon,{color:"white"}),isLoading:_,onClick:it,variant:"circle_without_hover_color"})]})},TopBar=({title:a,subtitle:_})=>{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:a}),jsxRuntimeExports.jsx(Text,{color:colors.gray[450],"data-testid":"nft-total-amount",size:"xs",children:_})]}),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:a}=reactExports.useContext(DynamicModalContext);return jsxRuntimeExports.jsxs(Button,{alignItems:"center",justifyContent:"end",marginTop:"16px",marginBottom:"16px",cursor:"pointer",onClick:()=>a(jsxRuntimeExports.jsx(UpsertContactModal,{})),variant:"CTAWithIcon",children:[jsxRuntimeExports.jsx(AddContactIcon,{stroke:"currentcolor"}),jsxRuntimeExports.jsx(Text,{marginLeft:"4px",size:"sm",children:"Add contact"})]})},AddressBookView=()=>{const a=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,{})}),a.length>0?jsxRuntimeExports.jsx(ContactTable,{contacts:a}):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"?a.exports=j():$.pluralize=j()})(commonjsGlobal,function(){var $=[],j=[],et={},tt={},rt={};function nt(wt){return typeof wt=="string"?new RegExp("^"+wt+"$","i"):wt}function it(wt,Ct){return wt===Ct?Ct:wt===wt.toLowerCase()?Ct.toLowerCase():wt===wt.toUpperCase()?Ct.toUpperCase():wt[0]===wt[0].toUpperCase()?Ct.charAt(0).toUpperCase()+Ct.substr(1).toLowerCase():Ct.toLowerCase()}function st(wt,Ct){return wt.replace(/\$(\d{1,2})/g,function(Pt,$t){return Ct[$t]||""})}function ot(wt,Ct){return wt.replace(Ct[0],function(Pt,$t){var Mt=st(Ct[1],arguments);return it(Pt===""?wt[$t-1]:Pt,Mt)})}function at(wt,Ct,Pt){if(!wt.length||et.hasOwnProperty(wt))return Ct;for(var $t=Pt.length;$t--;){var Mt=Pt[$t];if(Mt[0].test(Ct))return ot(Ct,Mt)}return Ct}function ut(wt,Ct,Pt){return function($t){var Mt=$t.toLowerCase();return Ct.hasOwnProperty(Mt)?it($t,Mt):wt.hasOwnProperty(Mt)?it($t,wt[Mt]):at(Mt,$t,Pt)}}function ht(wt,Ct,Pt,$t){return function(Mt){var Lt=Mt.toLowerCase();return Ct.hasOwnProperty(Lt)?!0:wt.hasOwnProperty(Lt)?!1:at(Lt,Lt,Pt)===Lt}}function yt(wt,Ct,Pt){var $t=Ct===1?yt.singular(wt):yt.plural(wt);return(Pt?Ct+" ":"")+$t}return yt.plural=ut(rt,tt,$),yt.isPlural=ht(rt,tt,$),yt.singular=ut(tt,rt,j),yt.isSingular=ht(tt,rt,j),yt.addPluralRule=function(wt,Ct){$.push([nt(wt),Ct])},yt.addSingularRule=function(wt,Ct){j.push([nt(wt),Ct])},yt.addUncountableRule=function(wt){if(typeof wt=="string"){et[wt.toLowerCase()]=!0;return}yt.addPluralRule(wt,"$0"),yt.addSingularRule(wt,"$0")},yt.addIrregularRule=function(wt,Ct){Ct=Ct.toLowerCase(),wt=wt.toLowerCase(),rt[wt]=Ct,tt[Ct]=wt},[["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(wt){return yt.addIrregularRule(wt[0],wt[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(wt){return yt.addPluralRule(wt[0],wt[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(wt){return yt.addSingularRule(wt[0],wt[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(yt.addUncountableRule),yt})})(pluralize$1);var pluralizeExports=pluralize$1.exports;const pluralize=getDefaultExportFromCjs$1(pluralizeExports),AccountSmallTile=({account:{address:a},..._})=>{const $=useAllAccounts().find(tt=>tt.address.pkh===a.pkh),j=useGetAccountBalance()(a.pkh),et=useAddressKind$1(a);return $?jsxRuntimeExports.jsxs(Flex,{alignItems:"space-between",cursor:"pointer","data-testid":"account-small-tile",..._,children:[jsxRuntimeExports.jsx(AddressTileIcon,{addressKind:et}),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(a.pkh)}),j&&jsxRuntimeExports.jsx(Heading,{"data-testid":"account-small-tile-balance",size:"sm",children:prettyTezAmount(j)})]})]}):null},OperationEstimationStatus=({estimationResult:a})=>{if(!a)return null;const _=lodashExports.get(a,"metadata.operation_result.status");if(!_)return null;let $,j,et;switch(_){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(a){case"multisig":return jsxRuntimeExports.jsx(KeyIcon,{"data-testid":`${a}-icon`,..._});case"fa1.2":return jsxRuntimeExports.jsx(FA12Icon,{"data-testid":`${a}-icon`,..._,fill:_.stroke,stroke:"none"});case"fa2":return jsxRuntimeExports.jsx(FA2Icon,{"data-testid":`${a}-icon`,..._,fill:_.stroke,stroke:"none"});case"baker":return jsxRuntimeExports.jsx(BakerIcon,{"data-testid":`${a}-icon`,..._});case"contact":return jsxRuntimeExports.jsx(ContactIcon,{"data-testid":`${a}-icon`,..._});case"unknown":case"implicit":return null}},RightIcon=({addressKind:{type:a,pkh:_},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(a)||et(_)?null:jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(AddContactIcon,{"data-testid":"add-contact-icon",onClick:()=>tt(jsxRuntimeExports.jsx(UpsertContactModal,{contact:{name:"",pkh:_}})),...j})})},AddressPillText=({addressKind:{pkh:a,label:_},showPkh:$,alias:j,...et})=>{const tt=useGetContactName(),rt=formatPkh(a),nt=tt(a)||_||j;return $?jsxRuntimeExports.jsx(Text,{...et,children:rt}):jsxRuntimeExports.jsx(Text,{...et,children:nt?truncate(nt,21):rt})},useAddressKind=a=>{const _=useOwnedAccountAddressKind(a),$=useTokenAddressKind(a),j=useBakerAddressKind(a),et=useContactAddressKind(a);return _||$||j||et||{pkh:a.pkh,type:"unknown",label:null}},useOwnedAccountAddressKind=a=>{const _=useOwnedAccountAddressKind$1(a);if(!_)return null;const{pkh:$,label:j}=_;return{type:_.type==="multisig"?"multisig":"implicit",pkh:$,label:j}},useTokenAddressKind=({pkh:a})=>{const _=useSelectedNetwork(),j=useGetTokenType(_)(a);if(!j)return null;switch(j){case"fa1.2":return{pkh:a,type:"fa1.2",label:null};case"fa2":case"nft":return{pkh:a,type:"fa2",label:null}}},AddressPill=({address:a,mode:_={type:"default"},...$})=>{const j=!("pkh"in a&&"type"in a),et=j?parsePkh(a.address):a,tt=useAddressKind(et),rt=_.type!=="no_icons",{onOpen:nt,onClose:it,isOpen:st}=useDisclosure$1(),[ot,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 yt,wt,Ct;return st?(yt=colors.green,wt=colors.gray[300],Ct="white"):ot?(yt=colors.gray[450],wt=colors.gray[400],Ct=colors.gray[200]):(yt=colors.gray[500],wt=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:yt,borderRadius:"full",onMouseEnter:()=>{at(!0)},onMouseLeave:()=>{at(!1)},paddingX:"4px",children:[rt&&jsxRuntimeExports.jsx(LeftIcon,{marginLeft:"4px",stroke:wt,addressKind:tt,"data-testid":"address-pill-left-icon"}),jsxRuntimeExports.jsxs(Popover,{autoFocus:!1,isOpen:st,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&&a.alias?a.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:_,"data-testid":"address-pill-right-icon"})]})})},OperationRecipient=({operation:a})=>{let _;switch(a.type){case"undelegation":case"contract_origination":_=void 0;break;case"tez":case"fa1.2":case"fa2":case"delegation":_=a.recipient;break;case"contract_call":_=a.contract;break}return _?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Text,{marginRight:"6px",color:colors.gray[450],children:"To:"}),jsxRuntimeExports.jsx(AddressPill,{address:_,"data-testid":"recipient"})]}):jsxRuntimeExports.jsx(Text,{color:colors.gray[500],"data-testid":"recipient",children:"N/A"})},tokenTitle=(a,_)=>{if(!a)return`${_} Unknown Token`;const $=tokenName(a),j=tokenPrettyAmount(_,a,{showSymbol:!1}),et=$?void 0:tokenSymbol(a);return lodashExports.compact([j,et,$]).join(" ")},getIPFSurl=a=>a==null?void 0:a.replace("ipfs://","https://ipfs.io/ipfs/"),sortedByLastUpdate=a=>lodashExports.orderBy(a,["lastLevel","id","owner"],["desc"]),OperationView=({operation:a})=>{const _=useGetToken(),$=useSelectedNetwork();switch(a.type){case"tez":return jsxRuntimeExports.jsxs(Flex,{children:[jsxRuntimeExports.jsx(OutgoingArrow,{marginRight:"8px"}),jsxRuntimeExports.jsx(Heading,{size:"sm",children:prettyTezAmount(a.amount)})]});case"fa1.2":case"fa2":{const j=_(a.contract.pkh,a.tokenId);return(j==null?void 0:j.type)==="nft"?jsxRuntimeExports.jsxs(Flex,{children:[jsxRuntimeExports.jsx(OutgoingArrow,{marginRight:"8px"}),Number(a.amount)>1&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs(Heading,{color:colors.gray[450],size:"sm",children:["x",a.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,a.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(`${a.type} is not supported yet`)}},AccountTileIcon=({addressKind:a})=>{switch(a.type){case"secret_key":case"mnemonic":return jsxRuntimeExports.jsx(Identicon,{width:"48px",height:"48px",padding:"8px",address:a.pkh,identiconSize:32});case"social":case"contact":case"ledger":case"multisig":case"unknown":case"baker":{const _=a.type==="social"?"white":colors.gray[500];return jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"center",padding:"4px",background:_,borderRadius:"4px",children:jsxRuntimeExports.jsx(AddressTileIcon,{addressKind:a,size:"md"})})}}},SelectedAccountContext=reactExports.createContext({selectedAccount:null,selectAccount:()=>{}}),AccountTileBase=({icon:a,leftElement:_,rightElement:$,...j})=>jsxRuntimeExports.jsxs(Flex,{alignItems:"center",height:90,marginBottom:4,padding:4,border:`1px solid ${colors.gray[800]}`,borderRadius:4,"data-testid":"account-tile-base",...j,children:[a,jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",flex:1,children:[_,$]})]}),LabelAndAddress=({label:a,pkh:_})=>jsxRuntimeExports.jsxs(Box,{margin:4,"data-testid":"account-identifier",children:[a&&jsxRuntimeExports.jsx(Heading,{size:"md",children:a}),jsxRuntimeExports.jsx(Flex,{alignItems:"center",children:jsxRuntimeExports.jsx(Text,{color:"text.dark","data-testid":"short-address",size:"sm",children:formatPkh(_)})})]}),MAX_NFT_COUNT=7,accountIconGradient=({account:a,radius:_,left:$="0px",top:j="0px",mainBackgroundColor:et=colors.gray[900],opacity:tt="60"})=>{let rt;switch(a.type){case"mnemonic":case"secret_key":rt=color(a.address.pkh);break;case"ledger":case"multisig":rt=colors.gray[450];break;case"social":rt="#EA4335"}return rt+=tt,`radial-gradient(circle farthest-side at ${$} ${j}, ${rt} 0%, ${rt} ${parseInt(_)/4}px, transparent ${_}), ${et}`},AccountTile=({account:a,balance:_})=>{const{selectedAccount:$,selectAccount:j}=reactExports.useContext(SelectedAccountContext),et=($==null?void 0:$.address.pkh)===a.address.pkh,tt=useAddressKind$1(a.address),{address:{pkh:rt}}=a,nt=!!useAppSelector(ot=>ot.assets.delegationLevels)[rt],it=useGetAccountNFTs(),st=sortedByLastUpdate(it(rt));return jsxRuntimeExports.jsxs(Box,{zIndex:2,background:accountIconGradient({left:"-10px",top:"-10px",account:a,radius:st.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(a),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,{addressKind:tt}),leftElement:jsxRuntimeExports.jsx(LabelAndAddress,{label:tt.label,pkh:rt}),rightElement:jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",children:[_&&jsxRuntimeExports.jsx(Heading,{alignSelf:"flex-end","data-testid":"balance",size:"md",children:prettyTezAmount(_)}),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:" "})})]})}),st.length>0&&jsxRuntimeExports.jsxs(Flex,{flexDirection:"column","data-testid":"nfts-list",children:[jsxRuntimeExports.jsx(Divider,{}),jsxRuntimeExports.jsx(Flex,{marginY:"21px",children:st.slice(0,MAX_NFT_COUNT).map((ot,at)=>{const ut=getIPFSurl(thumbnailUri(ot));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(ot)}`,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(ot))})})]})]})},ConfirmationModal=({title:a,description:_,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:a}),jsxRuntimeExports.jsx(ModalCloseButton,{})]}),_&&jsxRuntimeExports.jsx(ModalBody,{children:jsxRuntimeExports.jsx(Text,{align:"center",color:colors.gray[400],"data-testid":"description",children:_})}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(Button,{width:"100%",onClick:tt,size:"lg",variant:"warning",children:$})})]})},BatchModalBody=({title:a,fee:_,transactionCount:$,signer:j})=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(FormPageHeader,{subTitle:subTitle(j),title:a}),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:_})]})]})]}),SignPage$5=({initialOperations:a,initialFee:_})=>{const{fee:$,operations:j,estimationFailed:et,isLoading:tt,signer:rt,form:nt,reEstimate:it,onSign:st}=useSignPageHelpers(_,a,"batch"),ot=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:ot,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:st,signer:rt,text:ot})})]})})})},RightHeader=({operations:a,onSubmit:_,isLoading:$})=>{const{type:j,sender:et,operations:tt}=a,{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:_,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=a=>{switch(a.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(`${a.type} is not supported yet`)}},ClearBatchConfirmationModal=({sender:a})=>{const _=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:a})=>{const{operations:_,sender:$}=a,j=_.length>9,et=useRemoveBatchItem(),{openWith:tt}=reactExports.useContext(DynamicModalContext),rt=useSelectedNetwork(),[nt,it]=React$2.useState([]);reactExports.useEffect(()=>{it([])},[_.length]);const{isLoading:st,handleAsyncAction:ot}=useAsyncActionHandler(),at=()=>ot(async()=>{it([]);try{const ht=await estimate(a,rt);return it(_.map(yt=>SUCCESSFUL_ESTIMATION_RESULT)),tt(jsxRuntimeExports.jsx(SignPage$5,{initialFee:ht,initialOperations:a}))}catch(ht){if(ht instanceof TezosOperationError){const yt=ht.operationsWithResults;yt.length>_.length&&yt.shift(),it(yt)}throw ht}}),ut=jsxRuntimeExports.jsx(RightHeader,{isLoading:st,onSubmit:at,operations:a});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:_.map((ht,yt)=>{const wt=nt.at(yt);return jsxRuntimeExports.jsxs(Box,{"data-testid":"operation",children:[jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",height:wt?"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:wt})]}),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($,yt),size:"xs",variant:"circle"})]})]})]}),yt<_.length-1&&jsxRuntimeExports.jsx(Divider,{marginTop:wt?"10px":"20px",marginBottom:"20px"})]},nanoid())})}),j&&jsxRuntimeExports.jsx(Flex,{justifyContent:"end",verticalAlign:"middle",padding:"20px 23px 20px 30px",background:colors.gray[800],borderRadius:"0 0 8px 8px","data-testid":"footer",children:ut})]})};var papaparse_min={exports:{}};/* @license -Papa Parse -v5.4.1 -https://github.com/mholt/PapaParse -License: MIT -*/(function(a,_){(function($,j){a.exports=j()})(commonjsGlobal,function $(){var j=typeof self<"u"?self:typeof window<"u"?window:j!==void 0?j:{},et=!j.document&&!!j.postMessage,tt=j.IS_PAPA_WORKER||!1,rt={},nt=0,it={parse:function(It,Bt){var Ft=(Bt=Bt||{}).dynamicTyping||!1;if(Ot(Ft)&&(Bt.dynamicTypingFunction=Ft,Ft={}),Bt.dynamicTyping=Ft,Bt.transform=!!Ot(Bt.transform)&&Bt.transform,Bt.worker&&it.WORKERS_SUPPORTED){var jt=function(){if(!it.WORKERS_SUPPORTED)return!1;var vt=(dt=j.URL||j.webkitURL||null,mt=$.toString(),it.BLOB_URL||(it.BLOB_URL=dt.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",mt,")();"],{type:"text/javascript"})))),ct=new j.Worker(vt),dt,mt;return ct.onmessage=$t,ct.id=nt++,rt[ct.id]=ct}();return jt.userStep=Bt.step,jt.userChunk=Bt.chunk,jt.userComplete=Bt.complete,jt.userError=Bt.error,Bt.step=Ot(Bt.step),Bt.chunk=Ot(Bt.chunk),Bt.complete=Ot(Bt.complete),Bt.error=Ot(Bt.error),delete Bt.worker,void jt.postMessage({input:It,config:Bt,workerId:jt.id})}var bt=null;return it.NODE_STREAM_INPUT,typeof It=="string"?(It=function(vt){return vt.charCodeAt(0)===65279?vt.slice(1):vt}(It),bt=Bt.download?new at(Bt):new ht(Bt)):It.readable===!0&&Ot(It.read)&&Ot(It.on)?bt=new yt(Bt):(j.File&&It instanceof File||It instanceof Object)&&(bt=new ut(Bt)),bt.stream(It)},unparse:function(It,Bt){var Ft=!1,jt=!0,bt=",",vt=`\r -`,ct='"',dt=ct+ct,mt=!1,xt=null,At=!1;(function(){if(typeof Bt=="object"){if(typeof Bt.delimiter!="string"||it.BAD_DELIMITERS.filter(function(Et){return Bt.delimiter.indexOf(Et)!==-1}).length||(bt=Bt.delimiter),(typeof Bt.quotes=="boolean"||typeof Bt.quotes=="function"||Array.isArray(Bt.quotes))&&(Ft=Bt.quotes),typeof Bt.skipEmptyLines!="boolean"&&typeof Bt.skipEmptyLines!="string"||(mt=Bt.skipEmptyLines),typeof Bt.newline=="string"&&(vt=Bt.newline),typeof Bt.quoteChar=="string"&&(ct=Bt.quoteChar),typeof Bt.header=="boolean"&&(jt=Bt.header),Array.isArray(Bt.columns)){if(Bt.columns.length===0)throw new Error("Option columns is empty");xt=Bt.columns}Bt.escapeChar!==void 0&&(dt=Bt.escapeChar+ct),(typeof Bt.escapeFormulae=="boolean"||Bt.escapeFormulae instanceof RegExp)&&(At=Bt.escapeFormulae instanceof RegExp?Bt.escapeFormulae:/^[=+\-@\t\r].*$/)}})();var Rt=new RegExp(Ct(ct),"g");if(typeof It=="string"&&(It=JSON.parse(It)),Array.isArray(It)){if(!It.length||Array.isArray(It[0]))return St(null,It,mt);if(typeof It[0]=="object")return St(xt||Object.keys(It[0]),It,mt)}else if(typeof It=="object")return typeof It.data=="string"&&(It.data=JSON.parse(It.data)),Array.isArray(It.data)&&(It.fields||(It.fields=It.meta&&It.meta.fields||xt),It.fields||(It.fields=Array.isArray(It.data[0])?It.fields:typeof It.data[0]=="object"?Object.keys(It.data[0]):[]),Array.isArray(It.data[0])||typeof It.data[0]=="object"||(It.data=[It.data])),St(It.fields||[],It.data||[],mt);throw new Error("Unable to serialize unrecognized input");function St(Et,Nt,tr){var ir="";typeof Et=="string"&&(Et=JSON.parse(Et)),typeof Nt=="string"&&(Nt=JSON.parse(Nt));var nr=Array.isArray(Et)&&0=this._config.preview;if(tt)j.postMessage({results:vt,workerId:it.WORKER_ID,finished:dt});else if(Ot(this._config.chunk)&&!Ft){if(this._config.chunk(vt,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);vt=void 0,this._completeResults=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(vt.data),this._completeResults.errors=this._completeResults.errors.concat(vt.errors),this._completeResults.meta=vt.meta),this._completed||!dt||!Ot(this._config.complete)||vt&&vt.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),dt||vt&&vt.meta.paused||this._nextChunk(),vt}this._halted=!0},this._sendError=function(Bt){Ot(this._config.error)?this._config.error(Bt):tt&&this._config.error&&j.postMessage({workerId:it.WORKER_ID,error:Bt,finished:!1})}}function at(It){var Bt;(It=It||{}).chunkSize||(It.chunkSize=it.RemoteChunkSize),ot.call(this,It),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(Bt=new XMLHttpRequest,this._config.withCredentials&&(Bt.withCredentials=this._config.withCredentials),et||(Bt.onload=zt(this._chunkLoaded,this),Bt.onerror=zt(this._chunkError,this)),Bt.open(this._config.downloadRequestBody?"POST":"GET",this._input,!et),this._config.downloadRequestHeaders){var Ft=this._config.downloadRequestHeaders;for(var jt in Ft)Bt.setRequestHeader(jt,Ft[jt])}if(this._config.chunkSize){var bt=this._start+this._config.chunkSize-1;Bt.setRequestHeader("Range","bytes="+this._start+"-"+bt)}try{Bt.send(this._config.downloadRequestBody)}catch(vt){this._chunkError(vt.message)}et&&Bt.status===0&&this._chunkError()}},this._chunkLoaded=function(){Bt.readyState===4&&(Bt.status<200||400<=Bt.status?this._chunkError():(this._start+=this._config.chunkSize?this._config.chunkSize:Bt.responseText.length,this._finished=!this._config.chunkSize||this._start>=function(Ft){var jt=Ft.getResponseHeader("Content-Range");return jt===null?-1:parseInt(jt.substring(jt.lastIndexOf("/")+1))}(Bt),this.parseChunk(Bt.responseText)))},this._chunkError=function(Ft){var jt=Bt.statusText||Ft;this._sendError(new Error(jt))}}function ut(It){var Bt,Ft;(It=It||{}).chunkSize||(It.chunkSize=it.LocalChunkSize),ot.call(this,It);var jt=typeof FileReader<"u";this.stream=function(bt){this._input=bt,Ft=bt.slice||bt.webkitSlice||bt.mozSlice,jt?((Bt=new FileReader).onload=zt(this._chunkLoaded,this),Bt.onerror=zt(this._chunkError,this)):Bt=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount=this._input.size,this.parseChunk(bt.target.result)},this._chunkError=function(){this._sendError(Bt.error)}}function ht(It){var Bt;ot.call(this,It=It||{}),this.stream=function(Ft){return Bt=Ft,this._nextChunk()},this._nextChunk=function(){if(!this._finished){var Ft,jt=this._config.chunkSize;return jt?(Ft=Bt.substring(0,jt),Bt=Bt.substring(jt)):(Ft=Bt,Bt=""),this._finished=!Bt,this.parseChunk(Ft)}}}function yt(It){ot.call(this,It=It||{});var Bt=[],Ft=!0,jt=!1;this.pause=function(){ot.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){ot.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(bt){this._input=bt,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){jt&&Bt.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),Bt.length?this.parseChunk(Bt.shift()):Ft=!0},this._streamData=zt(function(bt){try{Bt.push(typeof bt=="string"?bt:bt.toString(this._config.encoding)),Ft&&(Ft=!1,this._checkIsFinished(),this.parseChunk(Bt.shift()))}catch(vt){this._streamError(vt)}},this),this._streamError=zt(function(bt){this._streamCleanUp(),this._sendError(bt)},this),this._streamEnd=zt(function(){this._streamCleanUp(),jt=!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 wt(It){var Bt,Ft,jt,bt=Math.pow(2,53),vt=-bt,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)))$/,mt=this,xt=0,At=0,Rt=!1,St=!1,Tt=[],Et={data:[],errors:[],meta:{}};if(Ot(It.step)){var Nt=It.step;It.step=function(Qt){if(Et=Qt,nr())ir();else{if(ir(),Et.data.length===0)return;xt+=Qt.data.length,It.preview&&xt>It.preview?Ft.abort():(Et.data=Et.data[0],Nt(Et,mt))}}}function tr(Qt){return It.skipEmptyLines==="greedy"?Qt.join("").trim()==="":Qt.length===1&&Qt[0].length===0}function ir(){return Et&&jt&&(Kt("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+it.DefaultDelimiter+"'"),jt=!1),It.skipEmptyLines&&(Et.data=Et.data.filter(function(Qt){return!tr(Qt)})),nr()&&function(){if(!Et)return;function Qt(qt,Jt){Ot(It.transformHeader)&&(qt=It.transformHeader(qt,Jt)),Tt.push(qt)}if(Array.isArray(Et.data[0])){for(var Ht=0;nr()&&Ht=Tt.length?"__parsed_extra":Tt[ur]),It.transform&&(Cr=It.transform(Cr,pr)),Cr=Zt(pr,Cr),pr==="__parsed_extra"?(xr[pr]=xr[pr]||[],xr[pr].push(Cr)):xr[pr]=Cr}return It.header&&(ur>Tt.length?Kt("FieldMismatch","TooManyFields","Too many fields: expected "+Tt.length+" fields but parsed "+ur,At+Jt):ur=lr.length/2?`\r -`:"\r"}(Qt,Jt)),jt=!1,It.delimiter)Ot(It.delimiter)&&(It.delimiter=It.delimiter(Qt),Et.meta.delimiter=It.delimiter);else{var ur=function(pr,Cr,Mr,lr,fr){var _r,Sr,kr,Ar;fr=fr||[","," ","|",";",it.RECORD_SEP,it.UNIT_SEP];for(var $r=0;$r=ct)return Wt(!0)}else for(Or=xt,xt++;;){if((Or=Rt.indexOf(Bt,Or+1))===-1)return Tt||Kt.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:Zt.length,index:xt}),Gt();if(Or===Et-1)return Gt(Rt.substring(xt,Or).replace($r,Bt));if(Bt!==mt||Rt[Or+1]!==mt){if(Bt===mt||Or===0||Rt[Or-1]!==mt){kr!==-1&&kr=ct)return Wt(!0);break}Kt.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:Zt.length,index:xt}),Or++}}else Or++}return Gt();function Yt(yr){Zt.push(yr),Ht=xt}function er(yr){var Er=0;if(yr!==-1){var Rr=Rt.substring(Or+1,yr);Rr&&Rr.trim()===""&&(Er=Rr.length)}return Er}function Gt(yr){return Tt||(yr===void 0&&(yr=Rt.substring(xt)),Qt.push(yr),xt=Et,Yt(Qt),nr&&ar()),Wt()}function Vt(yr){xt=yr,Yt(Qt),Qt=[],Ar=Rt.indexOf(jt,xt)}function Wt(yr){return{data:Zt,errors:Kt,meta:{delimiter:Ft,linebreak:jt,aborted:At,truncated:!!yr,cursor:Ht+(St||0)}}}function ar(){vt(Wt()),Zt=[],Kt=[]}},this.abort=function(){At=!0},this.getCharIndex=function(){return xt}}function $t(It){var Bt=It.data,Ft=rt[Bt.workerId],jt=!1;if(Bt.error)Ft.userError(Bt.error,Bt.file);else if(Bt.results&&Bt.results.data){var bt={abort:function(){jt=!0,Mt(Bt.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:Lt,resume:Lt};if(Ot(Ft.userStep)){for(var vt=0;vt{const j=_.filter(ht=>ht.length>0),et=j.length;if(et<2||4{const a=useSelectedNetwork(),_=useToast(),$=useGetToken(),j=useAppDispatch(),et=useGetOwnedAccount(),tt=useGetBestSignerForAccount(),{onClose:rt}=reactExports.useContext(DynamicModalContext),{isLoading:nt,handleAsyncAction:it}=useAsyncActionHandler(),st=useForm({mode:"onBlur"}),{handleSubmit:ot,formState:{isValid:at,errors:ut}}=st,ht=async({file:yt,sender:wt})=>it(async()=>{const Ct=et(wt),Pt=await new Promise(Mt=>{Papa.parse(yt[0],{skipEmptyLines:!0,complete:Mt})});if(Pt.errors.length>0)throw new Error("Error loading csv file: "+Pt.errors.map(Mt=>Mt.message).join(", "));const $t=[];for(let Mt=0;Mt{const{openWith:a}=reactExports.useContext(DynamicModalContext);return jsxRuntimeExports.jsxs(Button,{onClick:()=>a(jsxRuntimeExports.jsx(CSVFileUploadForm,{})),variant:"CTAWithIcon",children:[jsxRuntimeExports.jsx(Text,{marginRight:"4px",size:"sm",children:"Load CSV file"}),jsxRuntimeExports.jsx(FileArrowDownIcon,{stroke:"currentcolor"})]})},FilterController=({batchPending:a})=>jsxRuntimeExports.jsxs(Flex,{alignItems:"center",marginTop:"24px",marginBottom:"24px",children:[jsxRuntimeExports.jsxs(Heading,{flex:1,color:colors.orangeL,size:"sm",children:[a," 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 a=useBatches();return jsxRuntimeExports.jsxs(Flex,{flexDirection:"column",height:"100%",children:[jsxRuntimeExports.jsx(TopBar,{title:"Batch"}),jsxRuntimeExports.jsx(FilterController,{batchPending:a.length}),jsxRuntimeExports.jsx(Box,{overflowY:"auto",minHeight:"80%",children:a.length>0?a.map(_=>jsxRuntimeExports.jsx(BatchView,{operations:_},_.sender.address.pkh)):jsxRuntimeExports.jsx(NoItems,{description:"There are no batch transactions to show...",size:"lg",title:"No batches to show"})})]})},ClickableCard=({onClick:a,children:_,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:a?"pointer":void 0,backgroundColor:colors.gray[900],onClick:a,...j,children:jsxRuntimeExports.jsx(CardBody,{padding:0,children:_})}),SettingsCardWithDrawerIcon=({left:a,isSelected:_,onClick:$})=>jsxRuntimeExports.jsx(ClickableCard,{isSelected:_,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:a}),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:a,externalLink:_,linkDescription:$})=>jsxRuntimeExports.jsx(Link,{rel:"noopener noreferrer",target:"_blank",to:_,children:jsxRuntimeExports.jsx(ClickableCard,{cursor:"pointer",isSelected:!1,children:jsxRuntimeExports.jsxs(Flex,{alignItems:"center",justifyContent:"space-between",children:[jsxRuntimeExports.jsx(Heading,{size:"sm",children:a}),jsxRuntimeExports.jsxs(Flex,{alignItems:"center",children:[$&&jsxRuntimeExports.jsx(Text,{marginRight:"4px",color:colors.gray[400],size:"sm",children:$}),jsxRuntimeExports.jsx(ExternalLinkIcon,{})]})]})})}),HelpCard=({title:a,children:_})=>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:a})=>{const _=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:$=>a({type:"restoreMnemonic"}),size:"lg",children:"Import with Seed Phrase"}),jsxRuntimeExports.jsx(Button,{width:"100%",onClick:$=>a({type:"restoreSecretKey"}),size:"lg",variant:"tertiary",children:"Import with Secret Key"}),!_&&jsxRuntimeExports.jsx(Button,{width:"100%",onClick:$=>a({type:"restoreBackup"}),size:"lg",variant:"tertiary",children:"Restore from Backup"}),jsxRuntimeExports.jsx(Button,{width:"100%",onClick:$=>a({type:"nameAccount",account:{type:"ledger"}}),size:"lg",variant:"tertiary",children:"Connect ledger"})]})})},IS_DEV=!1,ConnectOrCreate=({goToStep:a,closeModal:_})=>{const{handleAsyncAction:$}=useAsyncActionHandler(),j=useRestoreSocial(),et=useToast(),tt=(rt,nt)=>$(async()=>{const{pk:it,pkh:st}=await getPublicKeyPairFromSk(rt);j(it,st,nt),et({description:`Successfully added ${nt} account`,status:"success"}),_()});return 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:rt=>a({type:"notice"}),size:"lg",children:"Create a new Account"}),jsxRuntimeExports.jsx(Button,{width:"100%",onClick:rt=>a({type:"connectOptions"}),size:"lg",variant:"tertiary",children:"I already have a wallet"}),IS_DEV,jsxRuntimeExports.jsxs(Flex,{width:"100%",paddingTop:"14px",paddingBottom:"6px",children:[jsxRuntimeExports.jsx(Divider,{marginTop:"11px"}),jsxRuntimeExports.jsx(Text,{minWidth:"160px",color:colors.gray[400],textAlign:"center",noOfLines:1,size:"sm",children:"Continue with Google"}),jsxRuntimeExports.jsx(Divider,{marginTop:"11px"})]}),jsxRuntimeExports.jsx(GoogleAuth,{onAuth:tt})]})})},Select=({selected:a,options:_,onChange:$})=>{const[j,et]=reactExports.useState(a),[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:_.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:a,account:_})=>{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)}}),st=async({derivationPathTemplate:ot,derivationPath:at})=>{switch(_.type){case"ledger":return a($?{type:"restoreLedger",account:{..._,derivationPath:normalizeDerivationPath(at)}}:{type:"restoreLedger",account:{..._,derivationPathTemplate:normalizeDerivationPath(ot)}});case"mnemonic":{if($){const ut=await deriveSecretKey(_.mnemonic,at,"ed25519");return a({type:"masterPassword",account:{type:"secret_key",secretKey:ut,label:_.label}})}return a({type:"masterPassword",account:{..._,derivationPathTemplate:ot}})}}};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(st),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(ot=>!ot),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:ot=>rt("derivationPathTemplate",ot),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=a=>a.trim().toLowerCase().replace("m/",""),validateDerivationPath=a=>{const _=normalizeDerivationPath(a);return _.length===0?"Derivation path is required":_.startsWith("44'/1729'/")?_.match(new RegExp("^44'/1729'/([0-9]+'/)*([0-9]+')$"))?!0:"Invalid derivation path":"Derivation path must start with `44'/1729'/`"},Eula=({goToStep:a})=>{const[_,$]=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:!_,onClick:()=>{a({type:"connectOrCreate"})},size:"lg",children:"Continue"})]})})},FakeAccount=({onClose:a})=>{const{register:_,handleSubmit:$,formState:{errors:j}}=useForm({mode:"onBlur"}),et=useRestoreLedger(),tt=async({pkh:rt,name:nt})=>{const st=await new RpcClient(MAINNET.rpcUrl).getManagerKey(rt),ot=typeof st=="string"?st:st.key;et(defaultDerivationPathTemplate,makeDerivationPath(defaultDerivationPathTemplate,0),ot,rt,nt),a()};return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(WalletPlusIcon,{}),title:"Add a Fake Account",children:jsxRuntimeExports.jsxs("form",{onSubmit:$(tt),style:{width:"100%"},children:[jsxRuntimeExports.jsx(Text,{children:"It will be restored as a ledger account"}),jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!j.pkh,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Address"}),jsxRuntimeExports.jsx(Input,{..._("pkh",{required:!0}),autoComplete:"off",placeholder:"Please enter the account address"})]}),jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!j.name,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Name"}),jsxRuntimeExports.jsx(Input,{..._("name",{required:!0}),autoComplete:"off",placeholder:"Please enter the account name"})]}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:2,size:"lg",type:"submit",children:"Add account"})]})})},EnterAndConfirmPassword=({onSubmit:a,isLoading:_})=>{const $=useForm({mode:"onBlur"}),{handleSubmit:j,formState:{errors:et,isValid:tt},getValues:rt}=$,nt=({confirm:it})=>a(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||_,isLoading:_,size:"lg",type:"submit",children:"Submit"})]})})})},EnterPassword=({onSubmit:a,isLoading:_})=>{const $=useForm({mode:"onBlur"}),{handleSubmit:j,formState:{errors:et,isValid:tt}}=$,rt=nt=>{a(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:_,size:"lg",type:"submit",children:"Submit"})]})})})},MasterPassword=({account:a,onClose:_})=>{const $=useRestoreFromMnemonic(),j=useRestoreFromSecretKey(),et=useValidateMasterPassword(),tt=et!==null,{isLoading:rt,handleAsyncAction:nt}=useAsyncActionHandler(),it=useToast(),st=ot=>nt(async()=>{switch(tt&&await et(ot),a.type){case"secret_key":await j(a.secretKey,ot,a.label);break;case"mnemonic":await $({...a,password:ot})}it({description:"Account successfully created!",status:"success"}),_()});return tt?jsxRuntimeExports.jsx(EnterPassword,{isLoading:rt,onSubmit:st}):jsxRuntimeExports.jsx(EnterAndConfirmPassword,{isLoading:rt,onSubmit:st})},Notice=({goToStep:a})=>{const _=[{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:_.map(($,j)=>jsxRuntimeExports.jsx(ListItem,{fontSize:"16px",fontWeight:600,children:$.content},j))}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"28px",onClick:()=>a({type:"showSeedphrase",account:{type:"mnemonic",mnemonic:generate24WordMnemonic()}}),size:"lg",children:"I understand"}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"16px",onClick:()=>a({type:"restoreMnemonic"}),size:"lg",variant:"tertiary",children:"I already have a Seed Phrase"})]})})},RestoreBackupFile=()=>{const a=useForm({mode:"onBlur"}),{handleSubmit:_,register:$,formState:{errors:j,isValid:et}}=a,{handleAsyncAction:tt}=useAsyncActionHandler(),rt=useRestoreV1BackupFile(),nt=({password:it,file:st})=>tt(async()=>{const ot=await st[0].text(),at=JSON.parse(ot);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,{...a,children:jsxRuntimeExports.jsx("form",{onSubmit:_(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 a=>{const _=await TransportWebUSB.create(),$=new LedgerSigner(_,a,!0),j=await $.publicKey(),et=await $.publicKeyHash();return await _.close(),{pk:j,pkh:et}},LEDGER_TIMEOUT=60*1e3,RestoreLedger=({closeModal:a,account:_})=>{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"}),st=_.derivationPathTemplate?makeDerivationPath(_.derivationPathTemplate,0):_.derivationPath,{pk:ot,pkh:at}=await getPk(st);$(_.derivationPathTemplate,st,ot,at,_.label),j.close(it),j({description:"Account successfully created!",status:"success"}),a()},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,st)=>jsxRuntimeExports.jsx(ListItem,{children:it.content},st))}),jsxRuntimeExports.jsx(Button,{width:"100%",isLoading:et,onClick:nt,size:"lg",children:"Export Public Key"})]})})},MnemonicAutocomplete=({inputName:a,validate:_,inputProps:$,listProps:j})=>{const[et,tt]=reactExports.useState(!0),{register:rt,setValue:nt,watch:it}=useFormContext(),st=it(a),ot=wordlists.EN.filter(ut=>st&&ut.startsWith(st)).sort(),at=!et&&ot.length>0&&(ot.length>1||ot[0]!==st);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Input,{zIndex:0,autoComplete:"off","data-testid":"mnemonic-input",onFocus:()=>tt(!1),placeholder:"Type here...",...rt(a,{required:"Required",validate:_,onChange:()=>tt(!1),onBlur:()=>tt(!0)}),...$}),at&&jsxRuntimeExports.jsx(UnorderedList,{"data-testid":"suggestions",variant:"suggestions",...j,children:ot.map(ut=>jsxRuntimeExports.jsx(ListItem,{paddingTop:"2px",fontSize:"14px",fontWeight:600,"data-testid":"suggestion",onMouseDown:()=>nt(a,ut),paddingX:"7px",children:ut},ut))})]})},mnemonicSizes=[12,15,18,24],RestoreMnemonic=({goToStep:a})=>{const _=useForm({mode:"onBlur"}),{handleSubmit:$,setValue:j,trigger:et,formState:{isValid:tt}}=_,{handleAsyncAction:rt}=useAsyncActionHandler(),[nt,it]=reactExports.useState(24),st=ut=>{const ht=Number(ut);if(mnemonicSizes.includes(ht))return it(yt=>(yt>ht&&lodashExports.range(ht,Math.max(...mnemonicSizes)).forEach(wt=>{j(`word${wt}`,void 0)}),ht)),et()},ot=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((yt,wt)=>{j(`word${wt}`,yt)}),et()}),at=ut=>rt(async()=>{const ht=Object.values(ut).join(" ").trim();if(!validateMnemonic_1(ht))throw new Error(`Invalid Mnemonic: "${ht}"`);return a({type:"nameAccount",account:{type:"mnemonic",mnemonic:ht}}),Promise.resolve()});return jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(KeyIcon,{width:"24px",height:"24px",stroke:colors.gray[450]}),subtitle:"Please fill in the Seed Phrase in sequence.",title:"Import Seed Phrase",children:jsxRuntimeExports.jsx(Box,{overflowX:"hidden",children:jsxRuntimeExports.jsx(FormProvider,{..._,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=>st(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 yt=>{yt.preventDefault();const wt=await navigator.clipboard.readText();return ot(wt)},border:"none",size:"xsmall"},listProps:{width:"126px",marginTop:"38px",marginLeft:"-5px"}})]},ut)})}),jsxRuntimeExports.jsx(Button,{width:"100%",isDisabled:!tt,size:"lg",type:"submit",children:"Continue"}),IS_DEV]})})})})})},RestoreSecretKey=({goToStep:a})=>{const[_,$]=reactExports.useState(!1),{handleAsyncAction:j}=useAsyncActionHandler(),et=useForm({mode:"onBlur",defaultValues:{password:""}}),{register:tt,handleSubmit:rt,formState:{errors:nt,isValid:it}}=et,st=async({secretKey:ot,password:at})=>j(async()=>{try{const ht=await(await InMemorySigner.fromSecretKey(ot.trim(),at)).secretKey();a({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",stroke:colors.gray[450]}),title:"Insert Secret Key",children:jsxRuntimeExports.jsx(FormProvider,{...et,children:jsxRuntimeExports.jsxs("form",{onSubmit:rt(st),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:ot=>$(isEncryptedSecretKeyPrefix(ot.target.value.trim()))}),placeholder:"Your secret key"}),nt.secretKey&&jsxRuntimeExports.jsx(FormErrorMessage$1,{children:nt.secretKey.message})]}),_&&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:a,account:_})=>jsxRuntimeExports.jsx(ModalContentWrapper,{icon:jsxRuntimeExports.jsx(KeyIcon,{width:"24px",height:"24px",stroke:colors.gray[450]}),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:_.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:$=>{a({type:"verifySeedphrase",account:_})},size:"lg",children:"OK, I've recorded it"})]})}),VerifySeedphrase=({goToStep:a,account:_})=>{const $=_.mnemonic.split(" "),j=useForm({mode:"onBlur"}),{handleSubmit:et,formState:{errors:tt,isValid:rt}}=j,[nt]=reactExports.useState(selectRandomElements($,5)),it=()=>a({type:"nameAccount",account:_});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((st,ot)=>{const at=`${st.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:st.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!==st.value)return"Word doesn't match"}})}),(ut==null?void 0:ut.message)&&jsxRuntimeExports.jsx(FormErrorMessage,{children:ut.message})]},ot)}),jsxRuntimeExports.jsx(Button,{width:"100%",marginTop:"20px",isDisabled:!rt,size:"lg",type:"submit",children:"Continue"}),IS_DEV]})})})})},useStepHistory=a=>{const[_,$]=reactExports.useState(a),[j,et]=reactExports.useState([_]),tt=j.length===1;return{reset:()=>{$(a),et([a])},goToStep:rt=>{$(rt),et([...j,rt])},currentStep:_,goBack:()=>{if(tt)return;j.pop();const rt=j[j.length-1];et(j),$(rt)},atInitialStep:tt,fullHistory:j}},useOnboardingModal=a=>{const{isOpen:_,onOpen:$,onClose:j}=useDisclosure$1(),et=useImplicitAccounts().length!==0,tt=useStepHistory({type:et?"connectOrCreate":"eula"}),{currentStep:rt,goToStep:nt}=tt,it=()=>{tt.reset(),a&&a(),j()},st=()=>{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:_,onClose:it,children:[et&&jsxRuntimeExports.jsx(ModalOverlay,{}),jsxRuntimeExports.jsxs(ModalContent,{children:[!tt.atInitialStep&&jsxRuntimeExports.jsx(ModalBackButton,{onClick:tt.goBack}),jsxRuntimeExports.jsx(ModalCloseButton,{onClick:it}),st()]})]}),onOpen:$}},AccountListHeader=()=>{const{onOpen:a,modalElement:_}=useOnboardingModal();return jsxRuntimeExports.jsxs(Flex,{flexDirection:"row-reverse",marginTop:"12px",marginBottom:"16px",children:[jsxRuntimeExports.jsxs(Button,{paddingRight:"0",onClick:a,variant:"CTAWithIcon",children:[jsxRuntimeExports.jsx(AddAccountIcon,{stroke:"currentcolor"}),jsxRuntimeExports.jsx(Text,{marginLeft:"4px",size:"sm",children:"Add Account"})]}),_]})},AccountGroupPopover=({onRemove:a,onCreate:_})=>jsxRuntimeExports.jsx(PopoverMenu,{children:jsxRuntimeExports.jsxs(Box,{paddingY:"0",children:[jsxRuntimeExports.jsx(Button,{height:_?"24px":"28px","data-testid":"popover-remove",onClick:a,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"})]})}),_&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Divider,{marginY:"4px"}),jsxRuntimeExports.jsx(Button,{onClick:_,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:a,fingerPrint:_})=>{const[$,j]=reactExports.useState(),{isLoading:et,handleAsyncAction:tt}=useAsyncActionHandler(),rt=useToast(),nt=useDeriveMnemonicAccount(),it=({name:st,password:ot})=>tt(async()=>{await nt({fingerPrint:_,password:ot,label:st.trim()||DEFAULT_ACCOUNT_LABEL}),a(),rt({description:`New account created! Successfully derived account from ${_}`})},{title:"Failed to derive new account"});return jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsx(ModalCloseButton,{}),$?jsxRuntimeExports.jsx(EnterPassword,{isLoading:et,onSubmit:st=>it({name:$,password:st})}):jsxRuntimeExports.jsx(NameAccountDisplay,{onSubmit:st=>j(st.accountName),subtitle:`Name the new account derived from ${_}`})]})},getAccountGroupLabel=a=>{switch(a.type){case"mnemonic":return`Seedphrase ${a.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:a,accounts:_,balances:$})=>{const j=_[0],et=j.type==="multisig",tt=j.type==="mnemonic",{openWith:rt,onClose:nt}=reactExports.useContext(DynamicModalContext),it=useRemoveMnemonic(),st=useRemoveNonMnemonic(),ot=useImplicitAccounts().length===_.length,at="Remove All Accounts";let ut,ht="Remove All";const yt=getAccountGroupLabel(j);ot?(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 ${yt}?`:ut=`Are you sure you want to remove all of your ${yt}?`;const wt=()=>rt(jsxRuntimeExports.jsx(ConfirmationModal,{buttonLabel:ht,description:ut,onSubmit:()=>{tt?it(j.seedFingerPrint):et||st(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-${a}`,children:[jsxRuntimeExports.jsxs(Center,{justifyContent:"space-between",marginTop:"24px",marginBottom:"16px",children:[jsxRuntimeExports.jsx(Heading,{"data-testid":"account-group-title",size:"md",children:a}),!et&&jsxRuntimeExports.jsx(AccountGroupPopover,{onCreate:tt?Ct:void 0,onRemove:wt})]}),_.map(Pt=>jsxRuntimeExports.jsx(Box,{marginBottom:"16px",children:jsxRuntimeExports.jsx(AccountTile,{account:Pt,balance:$[Pt.address.pkh]})},Pt.address.pkh))]})},NestedScroll=a=>jsxRuntimeExports.jsx(Box,{overflowY:"auto",height:"100%",children:a.children});var indicator$1=function a(_){_=Math.abs(_);var $=_%100;if($>=10&&$<=20)return"th";var j=_%10;return j===1?"st":j===2?"nd":j===3?"rd":"th"},indicator=indicator$1;function ordinal(a){if(typeof a!="number")throw new TypeError("Expected Number, got "+typeof a+" "+a);return Number.isFinite(a)?a+indicator(a):a}ordinal.indicator=indicator;var ordinal_1=ordinal;const ordinal$1=getDefaultExportFromCjs$1(ordinal_1),SignTransactionFormPage=a=>{const _=useAppDispatch(),{isLoading:$,handleAsyncAction:j}=useAsyncActionHandler(),{mode:et,operations:tt,fee:rt,data:{threshold:nt,signers:it,name:st}}=a,{fee:ot,operations:at,estimationFailed:ut,isLoading:ht,form:yt,reEstimate:wt,signer:Ct,onSign:Pt}=useSignPageHelpers(rt,tt,et),$t=$||ht,Mt=Lt=>j(async()=>{const Dt=await Pt(Lt);if(!Dt)throw new Error("An error occurred during contract origination");const zt=(await Dt.getOriginatedContractAddresses())[0];_(multisigActions.addMultisigLabel({pkh:zt,label:st}))});return jsxRuntimeExports.jsx(FormProvider,{...yt,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(SignPageHeader,{...a,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:st}),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:$t,keepValid:!0,label:"Creation Fee Payer",onUpdate:wt})}),jsxRuntimeExports.jsx(Flex,{justifyContent:"flex-end",children:jsxRuntimeExports.jsx(SignPageFee,{fee:ot})})]})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:ut,isLoading:$t,onSubmit:Mt,signer:Ct,text:"Submit Contract"})})]})})})},Threshold=({threshold:a,signersAmount:_})=>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:`${a} out of ${_}`})]}),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:a,signers:_,threshold:$,last_op_id:"0",pending_ops:[],metadata:[]}),toOperation$4=a=>({type:"contract_origination",sender:parsePkh(a.sender),code:contract,storage:makeStorageJSON(a.sender,a.signers.map(_=>_.val),String(a.threshold))}),SelectApproversFormPage=a=>{const{goBack:_,sender:$,...j}=a,et=useForm({mode:"onBlur",defaultValues:{sender:$.address.pkh,signers:[{val:""}],threshold:1,...formDefaultValues(j)}}),{formState:{errors:tt,isValid:rt},control:nt,register:it,handleSubmit:st,getValues:ot,watch:at}=et,ut=useFieldArray({control:nt,name:"signers",rules:{minLength:1}}),ht=at("signers").length,yt=useOpenSignPageFormAction({SignPage:SignTransactionFormPage,signPageExtraData:at(),FormPage:SelectApproversFormPage,defaultFormPageProps:a,toOperation:toOperation$4}),{onFormSubmitActionHandlers:[wt],isLoading:Ct}=useHandleOnSubmitFormActions([yt]);return jsxRuntimeExports.jsx(FormProvider,{...et,children:jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsx(ModalBackButton,{onClick:_}),jsxRuntimeExports.jsxs("form",{onSubmit:st(wt),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,$t)=>{var Ot;const Mt=tt.signers&&tt.signers[$t],Lt=`${$t===0?"Select ":""}${ordinal$1($t+1)} approver`,Dt=ht>1?"short":"default",zt=Dt==="short"?"368px":"100%";return jsxRuntimeExports.jsxs(FormControl,{display:"inline-block",width:zt,marginBottom:"8px","data-testid":`signer-input-${$t}`,isInvalid:!!Mt,children:[jsxRuntimeExports.jsx(OwnedImplicitAccountsAutocomplete,{allowUnknown:!0,inputName:`signers.${$t}.val`,label:Lt,size:Dt,style:{width:zt},validate:It=>{if(!isValidImplicitPkh(It))return"Signer must be valid TZ address";const Bt=ot("signers").map(Ft=>Ft.val);if(Bt.length>new Set(Bt).size)return"Duplicate approver"}}),ht>1&&jsxRuntimeExports.jsx(IconButton,{position:"absolute",height:"24px",marginTop:"-36px",marginLeft:"374px",background:colors.gray[500],"aria-label":"Remove","data-testid":`remove-signer-${$t}`,icon:jsxRuntimeExports.jsx(TrashIcon,{width:"12px",height:"14px",stroke:colors.gray[300]}),isRound:!0,onClick:()=>ut.remove($t),size:"xs",variant:"tertiary"}),Mt&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":`signer-${$t}-error`,children:(Ot=Mt.val)==null?void 0:Ot.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:a})=>{const _=useForm({mode:"onBlur",defaultValues:{name:a||""}}),{formState:{errors:$,isValid:j},register:et,handleSubmit:tt}=_,rt=useImplicitAccounts(),nt=useGetMostFundedImplicitAccount(),{openWith:it}=reactExports.useContext(DynamicModalContext),st=({name:at})=>it(jsxRuntimeExports.jsx(SelectApproversFormPage,{form:{name:at.trim()},goBack:()=>it(jsxRuntimeExports.jsx(NameMultisigFormPage,{name:at})),sender:nt(rt)})),ot=useValidateName();return jsxRuntimeExports.jsx(FormProvider,{..._,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{onSubmit:tt(st),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:ot}),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 a=useAllAccounts(),_=useAppSelector(tt=>tt.assets.balances.mutez),$=lodashExports.groupBy(a,getAccountGroupLabel),{openWith:j}=reactExports.useContext(DynamicModalContext),et=Object.entries($).map(([tt,rt])=>jsxRuntimeExports.jsx(AccountGroup,{accounts:rt,balances:_,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",stroke:colors.gray[450]}),"Create New Multisig"]})})]})})})},useGetDelegationPrettyDisplayValues=()=>{const a=useGetAccountBalance();return _=>{const $=a(_.sender),j=new Date,et=prettyTezAmount(_.amount),tt=$&&prettyTezAmount($),rt=`Since ${formatRelative(new Date(_.timestamp),j)}`;return{initialBalance:et,currentBalance:tt,duration:rt}}},SignPage$4=a=>{const{mode:_,operations:$,fee:j}=a,{fee:et,operations:tt,estimationFailed:rt,isLoading:nt,form:it,signer:st,reEstimate:ot,onSign:at}=useSignPageHelpers(j,$,_),ut=tt.operations[0].recipient;return jsxRuntimeExports.jsx(FormProvider,{...it,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(SignPageHeader,{...a,operationsType:tt.type,signer:tt.signer}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(FormLabel,{children:"From"}),jsxRuntimeExports.jsx(AddressTile,{address:st.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:ot,sender:tt.sender})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:rt,isLoading:nt,onSubmit:at,signer:st,text:headerText(tt.type,_)})})]})})})},FormPage$3=a=>{var at;const _=(at=a.form)==null?void 0:at.baker,$=useOpenSignPageFormAction({SignPage:SignPage$4,signPageExtraData:void 0,FormPage:FormPage$3,defaultFormPageProps:a,toOperation:toOperation$3}),j=useAddToBatchFormAction(toOperation$3),{onFormSubmitActionHandlers:[et,tt],isLoading:rt}=useHandleOnSubmitFormActions([$,j]),nt=useForm({mode:"onBlur",defaultValues:formDefaultValues(a)}),{formState:{isValid:it,errors:st},handleSubmit:ot}=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:_?"Change Baker":"Delegate"}),jsxRuntimeExports.jsx(ModalCloseButton,{})]}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsxs(FormControl,{isInvalid:!!st.sender,children:[jsxRuntimeExports.jsx(OwnedAccountsAutocomplete,{allowUnknown:!1,inputName:"sender",isDisabled:!!a.sender,label:"From"}),st.sender&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"from-error",children:st.sender.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px","data-testid":"baker",isInvalid:!!st.baker,children:[jsxRuntimeExports.jsx(BakersAutocomplete,{allowUnknown:!0,inputName:"baker",label:"Baker"}),st.baker&&jsxRuntimeExports.jsx(FormErrorMessage,{children:st.baker.message})]})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(FormSubmitButtons,{isLoading:rt,isValid:it,onAddToBatch:ot(tt),onSingleSubmit:ot(et)})})]})})})},toOperation$3=a=>({type:"delegation",sender:parsePkh(a.sender),recipient:parseImplicitPkh(a.baker)}),SignPage$3=a=>{const{mode:_,operations:$,fee:j}=a,{fee:et,operations:tt,estimationFailed:rt,isLoading:nt,form:it,signer:st,reEstimate:ot,onSign:at}=useSignPageHelpers(j,$,_);return jsxRuntimeExports.jsx(FormProvider,{...it,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(SignPageHeader,{...a,operationsType:tt.type,signer:tt.signer}),jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(FormLabel,{children:"From"}),jsxRuntimeExports.jsx(AddressTile,{address:st.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:ot,sender:tt.sender})]}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{isDisabled:rt,isLoading:nt,onSubmit:at,signer:st,text:headerText(tt.type,_)})})]})})})},FormPage$2=a=>{var ot;const{sender:_}=a,$=(ot=a.form)==null?void 0:ot.baker,j=useOpenSignPageFormAction({SignPage:SignPage$3,signPageExtraData:void 0,FormPage:FormPage$2,defaultFormPageProps:{sender:_},toOperation:toOperation$2}),et=useAddToBatchFormAction(toOperation$2),{onFormSubmitActionHandlers:[tt,rt],isLoading:nt}=useHandleOnSubmitFormActions([j,et]),it=useForm({mode:"onBlur",defaultValues:formDefaultValues({sender:_})}),{handleSubmit:st}=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:st(rt),onSingleSubmit:st(tt)})})]})})})},toOperation$2=a=>({type:"undelegation",sender:parsePkh(a.sender)}),Row=({label:a,value:_,...$})=>jsxRuntimeExports.jsxs(Flex,{alignItems:"center",height:"50px",padding:"16px","data-testid":a,...$,children:[jsxRuntimeExports.jsx(Box,{flex:1,children:jsxRuntimeExports.jsx(Heading,{color:colors.gray[400],size:"sm",children:a})}),jsxRuntimeExports.jsx(Box,{flex:1,children:typeof _=="string"?jsxRuntimeExports.jsx(Text,{size:"sm",children:_}):_})]}),DelegationDisplay=({delegation:a,account:_})=>{const{openWith:$}=reactExports.useContext(DynamicModalContext),j=useGetOwnedAccount(),et=useGetDelegationPrettyDisplayValues();if(!a)return jsxRuntimeExports.jsx(NoDelegations,{onDelegate:()=>$(jsxRuntimeExports.jsx(FormPage$3,{sender:_})),size:"md"});const{currentBalance:tt,duration:rt,initialBalance:nt}=et(a),{sender:it,delegate:{address:st}}=a,ot=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(a.delegate.address)})}),jsxRuntimeExports.jsxs(Flex,{marginTop:"24px",children:[jsxRuntimeExports.jsx(Button,{flex:1,marginRight:"16px",onClick:()=>$(jsxRuntimeExports.jsx(FormPage$2,{form:{sender:it,baker:st},sender:ot})),variant:"warning",children:"End Delegation"}),jsxRuntimeExports.jsx(Button,{flex:1,onClick:()=>$(jsxRuntimeExports.jsx(FormPage$3,{form:{sender:it,baker:st},sender:ot})),variant:"tertiary",children:"Change Baker"})]})]})},MultisigDecodedOperation=({operation:a})=>{switch(a.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:a.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:a}),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:a.recipient})]})]});case"contract_origination":case"contract_call":throw new Error(`${a.type} is not supported yet`)}},MultisigOperationAmount=({operation:a})=>{const _=useGetToken();switch(a.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(a.amount)]})]});case"fa1.2":case"fa2":{const $=_(a.contract.pkh,a.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:a.amount}),jsxRuntimeExports.jsx(Text,{display:"inline",color:"white",fontSize:"14px",fontWeight:600,children:j})]}):jsxRuntimeExports.jsxs(Text,{fontSize:"14px",fontWeight:600,children:["-",tokenPrettyAmount(a.amount,$,{showSymbol:!0})]})})]})}case"delegation":case"undelegation":case"contract_origination":case"contract_call":return null}},caseInsensitiveLiteral=a=>z.string().regex(new RegExp(`^${a}$`,"i")),prim=a=>z.object({prim:caseInsensitiveLiteral(a)}),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=a=>(a.length===42&&(a="00"+a),encodeAddress(a)),parseTez=a=>{const _=tezSchema.parse(a),$=_[0].args[1].bytes,j=_[2].args[1].int;return{type:"tez",recipient:parseImplicitPkh(convertToPkh($)),amount:j}},parseTezContract=a=>{const _=contractTezSchema.parse(a),$=_[0].args[1].bytes,j=_[3].args[1].int;return{type:"tez",recipient:parseContractPkh(convertToPkh($)),amount:j}},parseFa2=a=>{const _=fa2Schema.parse(a),$=parseContractPkh(convertToPkh(_[0].args[1].bytes));return _[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,st=rt.args[1].args[1].int;return{type:"fa2",contract:$,sender:parsePkh(convertToPkh(tt)),recipient:parsePkh(convertToPkh(nt)),tokenId:it,amount:st}})})},parseFa1=a=>{const _=fa1Schema.parse(a),$=_[0],j=_[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(a);return{type:"delegation",sender:_.address,recipient:parseImplicitPkh(convertToPkh($[0].args[1].bytes))}},parseRemoveDelegate=(a,_)=>({type:"undelegation",sender:_.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(a.length===0)return $;for(let j=0;j{batchHeadSchema.parse(a.slice(0,2))},decode=(a,_)=>(assertHead(a),parse(a.slice(2),_)),parseRawMichelson=(a,_)=>{const $=JSON.parse(a);return decode($,_)},MultisigDecodedOperations=({rawMichelson:a,sender:_})=>{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:a}):jsxRuntimeExports.jsxs(Box,{height:"50px",padding:"10px",background:colors.gray[900],borderRadius:"8px",children:["Invalid michelson code: ",$.message]})}},UnrecognizedOperation=({rawMichelson:a})=>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(a)})})]})}),MultisigActionButton=({approveOrExecute:a,isLoading:_,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:_,onClick:a,children:"Execute"});case"approvable":return jsxRuntimeExports.jsx(Button,{"data-testid":"multisig-signer-button",isLoading:_,onClick:a,children:"Approve"})}},SignPage$2=({signer:a,fee:_,operation:$,actionType:j,transactionCount:et})=>{const{handleAsyncAction:tt}=useAsyncActionHandler(),{openWith:rt}=reactExports.useContext(DynamicModalContext),nt=st=>tt(async()=>{const{opHash:ot}=await executeOperations($,st);return rt(jsxRuntimeExports.jsx(SuccessStep,{hash:ot}))},{title:`Failed ${j}`}),it=`${lodashExports.capitalize(j)} transaction`;return jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(BatchModalBody,{fee:_,signer:a,title:it,transactionCount:et}),jsxRuntimeExports.jsx(ModalFooter,{children:jsxRuntimeExports.jsx(SignButton,{onSubmit:nt,signer:a,text:it})})]})})},MultisigSignerTile=({pendingApprovals:a,sender:_,operation:$,signerAddress:j})=>{const et=useAddressKind$1(j),tt=useGetImplicitAccountSafe(),{isLoading:rt,handleAsyncAction:nt}=useAsyncActionHandler(),{openWith:it}=reactExports.useContext(DynamicModalContext),st=useSelectedNetwork(),ot=tt(j.pkh),at=a===0,ut=()=>nt(async()=>{if(!ot)throw new Error("Can't approve or execute with an account you don't own");const yt=at?"execute":"approve",wt=makeAccountOperations(ot,ot,[makeMultisigApproveOrExecuteOperation(_.address,yt,$.id)]),Ct=await estimate(wt,st);let Pt;try{Pt=parseRawMichelson($.rawActions,_).length}catch{Pt=1}return it(jsxRuntimeExports.jsx(SignPage$2,{actionType:yt,fee:Ct,operation:wt,signer:ot,transactionCount:Pt}))}),ht=getMultisigSignerState({approvals:$.approvals,signerAddress:j,operationIsExecutable:at,signerAccount:ot});return jsxRuntimeExports.jsx(AccountTileBase,{height:"80px",marginTop:"10px",marginBottom:"0",padding:"15px",borderRadius:"8px",backgroundColor:colors.gray[700],icon:jsxRuntimeExports.jsx(AccountTileIcon,{addressKind:et}),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:a,operationIsExecutable:_,approvals:$,signerAddress:j})=>{const et=!!$.find(tt=>tt.pkh===j.pkh);return a?et&&!_?"approved":_?"executable":"approvable":et?"approved":"awaitingApprovalByExternalSigner"},MultisigPendingOperation=({operation:a,sender:_})=>{const{signers:$,threshold:j}=_,et=Math.max(j-a.approvals.length,0);return jsxRuntimeExports.jsxs(Box,{marginBottom:"24px",background:colors.gray[800],border:"none",borderRadius:"8px","data-testid":"multisig-pending-operation-"+a.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 #",a.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:a.rawActions,sender:_}),$.map(tt=>jsxRuntimeExports.jsx(MultisigSignerTile,{operation:a,pendingApprovals:et,sender:_,signerAddress:tt},tt.pkh))]})]})},MultisigPendingOperations=({account:a})=>{const $=useGetPendingMultisigOperations()(a);return jsxRuntimeExports.jsx(Box,{margin:"0",padding:"0",children:$.map(j=>jsxRuntimeExports.jsx(MultisigPendingOperation,{operation:j,sender:a},j.id))})},ViewAllLink=({to:a,owner:_,...$})=>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:`${a}?accounts=${_}`,children:[jsxRuntimeExports.jsx(RefreshClockIcon,{display:"inline",stroke:"inherit"}),jsxRuntimeExports.jsx(Text,{display:"inline",size:"sm",children:" View All"})]})}),MAX_NFTS_SIZE=18,NFTsGrid=({owner:a,nfts:_,...$})=>{if(_.length===0)return jsxRuntimeExports.jsx(NoNFTs,{size:"md"});const j=sortedByLastUpdate(_).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/${a}/${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})]})})},`${a}:${fullId(et)}`)})}),_.length>MAX_NFTS_SIZE&&jsxRuntimeExports.jsx(ViewAllLink,{marginBottom:"40px",owner:a,to:"/nfts"})]})},OperationTileContext=React$2.createContext({mode:"page"}),FEE_FIELDS=["bakerFee","storageFee","allocationFee"],Fee=({operation:a})=>{const _=reactExports.useContext(OperationTileContext),j=useIsOwnedAddress()(a.sender.address);if(_.mode==="drawer"||!j)return null;const et=FEE_FIELDS.reduce((tt,rt)=>rt in a?tt.plus(lodashExports.get(a,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=$(a),et=$(_);return!j&&!et?"unrelated":j?"outgoing":"incoming"},operationSign=a=>{switch(a){case"incoming":return"+";case"outgoing":return"-";case"unrelated":return""}},operationColor=a=>{switch(a){case"incoming":return colors.green;case"outgoing":return colors.orange;case"unrelated":return"white"}},InternalPrefix=({operation:a})=>{var et,tt,rt;let _,$;switch(a.type){case"transaction":_=(et=a.target)==null?void 0:et.address,$=a.sender.address;break;case"origination":case"delegation":_=null,$=a.sender.address;break;case"token_transfer":_=(tt=a.to)==null?void 0:tt.address,$=(rt=a.from)==null?void 0:rt.address;break}return useGetOperationDestination($,_)!=="unrelated"?null:jsxRuntimeExports.jsx(Heading,{marginRight:"4px",color:colors.gray[450],"data-testid":"internal-prefix",size:"md",children:"Internal:"})},OperationStatus=({level:a,status:_})=>{const $=useIsBlockFinalised(a);return _===void 0||_==="applied"?$?jsxRuntimeExports.jsx(CheckmarkIcon,{"data-testid":"checkmark"}):jsxRuntimeExports.jsx(HourglassIcon,{"data-testid":"hourglass"}):jsxRuntimeExports.jsx(CrossedCircleIcon,{"data-testid":"crossed-circle"})},OperationTypeWrapper=({children:a})=>reactExports.useContext(OperationTileContext).mode==="drawer"?null:jsxRuntimeExports.jsx(Text,{marginRight:"4px",color:colors.gray[300],"data-testid":"operation-type",size:"sm",children:a}),Timestamp=({timestamp:a})=>a?jsxRuntimeExports.jsx(Text,{color:colors.gray[400],"data-testid":"timestamp",size:"sm",children:getDisplayTimestamp(a)}):null,getDisplayTimestamp=a=>{const _=new Date,$=new Date(a);return differenceInDays(_,$)<2?formatDistance($,_,{addSuffix:!0}):format($,"dd MMM yyyy")},TzktLink$1=({hash:a,counter:_,transactionId:$,originationId:j,migrationId:et,children:tt,...rt})=>{const{tzktExplorerUrl:nt}=useSelectedNetwork();let it=nt;return a?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:a})=>{var _;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:a}),jsxRuntimeExports.jsx(TzktLink$1,{marginRight:"8px",counter:a.counter,"data-testid":"title",hash:a.hash,children:jsxRuntimeExports.jsxs(Heading,{size:"md",children:["Contract Call: ",(_=a.parameter)==null?void 0:_.entrypoint]})}),jsxRuntimeExports.jsx(Fee,{operation:a})]}),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.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:a.target})]}),jsxRuntimeExports.jsxs(Flex,{"data-testid":"from",children:[jsxRuntimeExports.jsx(Text,{marginRight:"6px",color:colors.gray[450],children:"From:"}),jsxRuntimeExports.jsx(AddressPill,{address:a.sender})]})]}),jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(OperationTypeWrapper,{children:"Contract Call"}),jsxRuntimeExports.jsx(OperationStatus,{...a})]})]})})]})},DelegationTile=({operation:a})=>{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:a}),jsxRuntimeExports.jsx(TzktLink$1,{marginRight:"8px",counter:a.counter,"data-testid":"title",hash:a.hash,children:jsxRuntimeExports.jsx(Heading,{size:"md",children:_})}),jsxRuntimeExports.jsx(Fee,{operation:a})]}),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.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:a.newDelegate})]}),jsxRuntimeExports.jsxs(Flex,{"data-testid":"from",children:[jsxRuntimeExports.jsx(Text,{marginRight:"6px",color:colors.gray[450],children:"From:"}),jsxRuntimeExports.jsx(AddressPill,{address:a.sender})]})]}),jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(OperationTypeWrapper,{children:_}),jsxRuntimeExports.jsx(OperationStatus,{...a})]})]})})]})},OriginationTile=({operation:a})=>{var j;const $=((j=a.originatedContract)==null?void 0:j.codeHash)===CODE_HASH&&a.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:a}),jsxRuntimeExports.jsx(TzktLink$1,{marginRight:"8px",counter:a.counter,"data-testid":"title",hash:a.hash,children:jsxRuntimeExports.jsx(Heading,{size:"md",children:$})}),jsxRuntimeExports.jsx(Fee,{operation:a})]}),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,{"data-testid":"from",children:[jsxRuntimeExports.jsx(Text,{marginRight:"6px",color:colors.gray[450],children:"From:"}),jsxRuntimeExports.jsx(AddressPill,{address:a.sender})]}),jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(OperationTypeWrapper,{children:"Contract Origination"}),jsxRuntimeExports.jsx(OperationStatus,{...a})]})]})})]})},TransactionDirectionIcon=({destination:a,..._})=>a==="outgoing"?jsxRuntimeExports.jsx(OutgoingArrow,{"data-testid":"outgoing-arrow",..._}):a==="incoming"?jsxRuntimeExports.jsx(IncomingArrow,{"data-testid":"incoming-arrow",..._}):jsxRuntimeExports.jsx(ContractIcon,{"data-testid":"unrelated-operation-icon",..._}),TokenTransferTile=({operation:a,tokenTransfer:_,token:$})=>{var at,ut;const j=_.amount,et=useGetOperationDestination((at=_.from)==null?void 0:at.address,(ut=_.to)==null?void 0:ut.address),tt=$.type==="nft",rt=tokenPrettyAmount(j,$,{showSymbol:!0}),nt=operationColor(et),it=tt?"white":nt,st=operationSign(et),ot=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:_.migrationId,originationId:_.originationId,transactionId:_.transactionId,children:[jsxRuntimeExports.jsxs(Text,{display:"inline",color:nt,fontWeight:"600",children:[st,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:_.migrationId,originationId:_.originationId,transactionId:_.transactionId,children:jsxRuntimeExports.jsxs(Text,{display:"inline",color:nt,fontWeight:"600",children:[st,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}),ot,a&&jsxRuntimeExports.jsx(Fee,{operation:a})]}),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:[_.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:_.to})]}),_.from&&jsxRuntimeExports.jsxs(Flex,{"data-testid":"from",children:[jsxRuntimeExports.jsx(Text,{marginRight:"6px",color:colors.gray[450],children:"From:"}),jsxRuntimeExports.jsx(AddressPill,{address:_.from})]})]}),jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(OperationTypeWrapper,{children:"Token Transfer"}),jsxRuntimeExports.jsx(OperationStatus,{level:_.level})]})]})})]})},TransactionTile=({operation:a})=>{var tt;const _=useGetOperationDestination(a.sender.address,(tt=a.target)==null?void 0:tt.address),$=prettyTezAmount(String(a.amount)),j=operationColor(_),et=operationSign(_);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:_}),jsxRuntimeExports.jsx(InternalPrefix,{operation:a}),jsxRuntimeExports.jsx(TzktLink$1,{marginRight:"8px",color:j,counter:a.counter,"data-testid":"title",hash:a.hash,children:jsxRuntimeExports.jsxs(Text,{color:j,fontWeight:"600",children:[et," ",$]})}),jsxRuntimeExports.jsx(Fee,{operation:a})]}),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.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(a.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(a.sender.address)})]})]}),jsxRuntimeExports.jsxs(Center,{children:[jsxRuntimeExports.jsx(OperationTypeWrapper,{children:"Transaction"}),jsxRuntimeExports.jsx(OperationStatus,{...a})]})]})})]})},OperationTile=({operation:a})=>{const _=useGetTokenTransfer();switch(a.type){case"token_transfer":{const $=fromRaw$1(a.token);return $?jsxRuntimeExports.jsx(TokenTransferTile,{token:$,tokenTransfer:a}):(console.warn(`Could not parse token transfer ${a.id}`),null)}case"transaction":{const $=!!a.parameter,j=_(a.id);if(j){const et=fromRaw$1(j.token);return et?jsxRuntimeExports.jsx(TokenTransferTile,{operation:a,token:et,tokenTransfer:j}):jsxRuntimeExports.jsx(TransactionTile,{operation:a})}else return $?jsxRuntimeExports.jsx(ContractCallTile,{operation:a}):jsxRuntimeExports.jsx(TransactionTile,{operation:a})}case"delegation":return jsxRuntimeExports.jsx(DelegationTile,{operation:a});case"origination":return jsxRuntimeExports.jsx(OriginationTile,{operation:a})}},MAX_OPERATIONS_SIZE=20,OperationListDisplay=({owner:a,operations:_})=>{if(_.length===0)return jsxRuntimeExports.jsx(NoOperations,{size:"md"});const $=_.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)),_.length>MAX_OPERATIONS_SIZE&&jsxRuntimeExports.jsx(ViewAllLink,{owner:a,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(a.contract);return jsxRuntimeExports.jsxs(Flex,{alignItems:"center",children:[jsxRuntimeExports.jsx(Text,{..._,marginRight:"4px",children:tokenNameSafe(a)}),$&&jsxRuntimeExports.jsx(VerifiedIcon,{})]})},MAX_TOKENS_SIZE=20,TokenList=({owner:a,tokens:_})=>{if(_.length===0)return jsxRuntimeExports.jsx(NoTokens,{size:"md"});const $=_.slice(0,MAX_TOKENS_SIZE);return jsxRuntimeExports.jsxs(Box,{children:[$.map(j=>jsxRuntimeExports.jsx(TokenTile$1,{token:j},fullId(j))),_.length>MAX_TOKENS_SIZE&&jsxRuntimeExports.jsx(ViewAllLink,{owner:a,to:"/tokens"})]})},TokenTile$1=({token:a})=>{const _=tokenPrettyAmount(a.balance,a,{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:a.contract}),jsxRuntimeExports.jsx(Box,{marginLeft:"16px",children:jsxRuntimeExports.jsx(TokenNameWithIcon,{fontWeight:600,"data-testid":"token-name",token:a})})]}),jsxRuntimeExports.jsx(Heading,{"data-testid":"token-balance",size:"lg",children:_})]})},buildTzktAddressUrl=(a,_)=>`${a.tzktExplorerUrl}/${_}`,useGetOperations=a=>{const _=useSelectedNetwork(),$=useAppDispatch(),j=useRefetchTrigger(),et=useReactQueryErrorHandler(),{isFetching:tt,data:rt,hasNextPage:nt,isLoading:it,fetchNextPage:st,fetchPreviousPage:ot,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 wt;const yt=(wt=lodashExports.maxBy(ht.flat(),"id"))==null?void 0:wt.id;return yt?{lastId:yt,sort:"asc"}:{}},select:({pages:ut})=>filterDuplicatedTokenTransfers([[...ut[0]].sort((ht,yt)=>ht.id{const ut=setInterval(()=>void ot(),BLOCK_TIME);return()=>clearInterval(ut)},[ot]),reactExports.useEffect(()=>{ot()},[j,ot]),{operations:rt||[],isFirstLoad:it,isLoading:tt,hasMore:nt,loadMore:st}},fetchOperationsAndUpdateTokensInfo=async(a,_,$,j)=>{const et=await getCombinedOperations($.map(st=>st.address.pkh),_,j),tt=et.filter(st=>st.type==="transaction").map(st=>st.id),rt=await getRelatedTokenTransfers(tt,_),nt=et.filter(st=>st.type==="token_transfer"),it=[...rt,...nt];return a(assetsActions.updateTokenTransfers(it)),a(tokensActions.addTokens({network:_,tokens:it.map(st=>st.token)})),et},filterDuplicatedTokenTransfers=a=>{const _=new Set(a.filter($=>$.type!=="token_transfer").map($=>$.id));return a.filter($=>$.type!=="token_transfer"||!_.has($.transactionId))},SmallTab=({children:a,..._})=>jsxRuntimeExports.jsx(Tab,{..._,fontSize:"sm",paddingX:3,children:a}),AssetsPanel=({tokens:a,nfts:_,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:_,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:a})})]})]})},MultisigApprovers=({signers:a})=>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:a.map(_=>jsxRuntimeExports.jsx(AddressPill,{marginRight:"12px",address:_},_.pkh))})})]})})}),renameAccount=(a,_)=>($,j)=>{const{accounts:et,multisigs:tt,contacts:rt}=j(),nt=a.type==="multisig",it=et.items.map(at=>at.label),st=tt.items.map(at=>at.label),ot=Object.values(rt).map(at=>at.name);[it,st,ot].flat().includes(_)||$(nt?multisigsSlice.actions.setName({newName:_,account:a}):accountsSlice.actions.renameAccount({newName:_,account:a}))},RenameAccountModal=({account:a})=>{const _=useAppDispatch(),{onClose:$}=reactExports.useContext(DynamicModalContext),j=({name:at})=>{_(renameAccount(a,at)),$()},{handleSubmit:et,formState:{isValid:tt,errors:rt},register:nt,reset:it}=useForm({mode:"onBlur",defaultValues:{name:a.label}}),st=({name:at})=>{j({name:at.trim()}),it()},ot=useValidateName(a.label);return jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{onSubmit:et(st),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:ot}),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:a})=>{const{openWith:_,onClose:$}=reactExports.useContext(DynamicModalContext),j=useNavigate(),et=useImplicitAccounts().length===1,tt=useRemoveAccount();let rt;switch(a.type){case"secret_key":case"ledger":case"social":rt=()=>_(jsxRuntimeExports.jsx(ConfirmationModal,{buttonLabel:st,description:it,onSubmit:()=>{tt(a),$(),j("/")},title:nt}));break}const nt="Remove Account";let it="Are you sure you want to remove this account?",st="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.",st="Remove & Off-board"),jsxRuntimeExports.jsx(RenameRemoveMenu,{onRemove:rt,onRename:()=>_(jsxRuntimeExports.jsx(RenameAccountModal,{account:a}))})},makeDelegation=a=>a.newDelegate?{sender:a.sender.address,timestamp:a.timestamp,id:a.id,amount:new BigNumber(a.amount),delegate:{address:a.newDelegate.address,alias:a.newDelegate.alias??void 0}}:null,TezRecapDisplay=a=>jsxRuntimeExports.jsxs(Box,{textAlign:a.center?"center":"initial",children:[jsxRuntimeExports.jsx(Heading,{size:"md",children:prettyTezAmount(a.balance)}),a.dollarBalance!==void 0&&jsxRuntimeExports.jsxs(Text,{marginTop:"6px",color:colors.gray[400],size:"sm",children:["$",a.dollarBalance.toFixed(2)]})]}),RoundButton=({icon:a,label:_,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:a,size:"lg",variant:"circle_without_color"}),jsxRuntimeExports.jsx(Text,{cursor:"pointer",size:"sm",children:_})]}),AccountDrawerDisplay=({onSend:a,onReceive:_=()=>{},balance:$,dollarBalance:j,tokens:et,nfts:tt,account:rt})=>{const nt=rt.type==="multisig",{openWith:it}=reactExports.useContext(DynamicModalContext),st=useAddressKind$1(rt.address),ot=useSelectedNetwork(),[at,ut]=reactExports.useState(null),{handleAsyncAction:ht}=useAsyncActionHandler();return reactExports.useEffect(()=>{ht(async()=>{const yt=await getLastDelegation(rt.address.pkh,ot);yt&&ut(makeDelegation(yt))}).catch(lodashExports.noop)},[rt.address.pkh,ht,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,{addressKind:st}),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:a}),jsxRuntimeExports.jsx(RoundButton,{icon:jsxRuntimeExports.jsx(IncomingArrow,{width:"24px",height:"24px",stroke:"currentcolor"}),label:"Receive",onClick:_}),!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:at?{baker:at.delegate.address,sender:rt.address.pkh}:void 0,sender:rt}))})]}),nt&&jsxRuntimeExports.jsx(MultisigApprovers,{signers:rt.signers}),jsxRuntimeExports.jsx(AssetsPanel,{account:rt,delegation:at,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]",st="[object AsyncFunction]",ot="[object Boolean]",at="[object Date]",ut="[object Error]",ht="[object Function]",yt="[object GeneratorFunction]",wt="[object Map]",Ct="[object Number]",Pt="[object Null]",$t="[object Object]",Mt="[object Promise]",Lt="[object Proxy]",Dt="[object RegExp]",zt="[object Set]",Ot="[object String]",It="[object Symbol]",Bt="[object Undefined]",Ft="[object WeakMap]",jt="[object ArrayBuffer]",bt="[object DataView]",vt="[object Float32Array]",ct="[object Float64Array]",dt="[object Int8Array]",mt="[object Int16Array]",xt="[object Int32Array]",At="[object Uint8Array]",Rt="[object Uint8ClampedArray]",St="[object Uint16Array]",Tt="[object Uint32Array]",Et=/[\\^$.*+?()[\]{}|]/g,Nt=/^\[object .+?Constructor\]$/,tr=/^(?:0|[1-9]\d*)$/,ir={};ir[vt]=ir[ct]=ir[dt]=ir[mt]=ir[xt]=ir[At]=ir[Rt]=ir[St]=ir[Tt]=!0,ir[nt]=ir[it]=ir[jt]=ir[ot]=ir[bt]=ir[at]=ir[ut]=ir[ht]=ir[wt]=ir[Ct]=ir[$t]=ir[Dt]=ir[zt]=ir[Ot]=ir[Ft]=!1;var nr=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,Zt=typeof self=="object"&&self&&self.Object===Object&&self,Kt=nr||Zt||Function("return this")(),Qt=_&&!_.nodeType&&_,Ht=Qt&&!0&&a&&!a.nodeType&&a,qt=Ht&&Ht.exports===Qt,Jt=qt&&nr.process,ur=function(){try{return Jt&&Jt.binding&&Jt.binding("util")}catch{}}(),xr=ur&&ur.isTypedArray;function pr(wr,Xt){for(var cr=-1,gr=wr==null?0:wr.length,Dr=0,rn=[];++cr-1}function ps(wr,Xt){var cr=this.__data__,gr=Eo(cr,wr);return gr<0?(++this.size,cr.push([wr,Xt])):cr[gr][1]=Xt,this}yn.prototype.clear=_n,yn.prototype.delete=ds,yn.prototype.get=fs,yn.prototype.has=hs,yn.prototype.set=ps;function Vn(wr){var Xt=-1,cr=wr==null?0:wr.length;for(this.clear();++XtTn))return!1;var wn=rn.get(wr);if(wn&&rn.get(Xt))return wn==Xt;var Bn=-1,Fn=!0,ts=cr&tt?new es:void 0;for(rn.set(wr,Xt),rn.set(Xt,wr);++Bn-1&&wr%1==0&&wr-1&&wr%1==0&&wr<=rt}function No(wr){var Xt=typeof wr;return wr!=null&&(Xt=="object"||Xt=="function")}function Po(wr){return wr!=null&&typeof wr=="object"}var Bo=xr?fr(xr):xl;function Xl(wr){return $o(wr)?yl(wr):_l(wr)}function rs(){return[]}function Xn(){return!1}a.exports=Ps})(lodash_isequal,lodash_isequal.exports);var lodash_isequalExports=lodash_isequal.exports,qrcode={exports:{}};(function(a,_){var $=function(){var j=function(Dt,zt){var Ot=236,It=17,Bt=Dt,Ft=tt[zt],jt=null,bt=0,vt=null,ct=[],dt={},mt=function(Kt,Qt){bt=Bt*4+17,jt=function(Ht){for(var qt=new Array(Ht),Jt=0;Jt=7&&Tt(Kt),vt==null&&(vt=ir(Bt,Ft,ct)),Nt(vt,Qt)},xt=function(Kt,Qt){for(var Ht=-1;Ht<=7;Ht+=1)if(!(Kt+Ht<=-1||bt<=Kt+Ht))for(var qt=-1;qt<=7;qt+=1)Qt+qt<=-1||bt<=Qt+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?jt[Kt+Ht][Qt+qt]=!0:jt[Kt+Ht][Qt+qt]=!1)},At=function(){for(var Kt=0,Qt=0,Ht=0;Ht<8;Ht+=1){mt(!0,Ht);var qt=nt.getLostPoint(dt);(Ht==0||Kt>qt)&&(Kt=qt,Qt=Ht)}return Qt},Rt=function(){for(var Kt=8;Kt>Ht&1)==1;jt[Math.floor(Ht/3)][Ht%3+bt-8-3]=qt}for(var Ht=0;Ht<18;Ht+=1){var qt=!Kt&&(Qt>>Ht&1)==1;jt[Ht%3+bt-8-3][Math.floor(Ht/3)]=qt}},Et=function(Kt,Qt){for(var Ht=Ft<<3|Qt,qt=nt.getBCHTypeInfo(Ht),Jt=0;Jt<15;Jt+=1){var ur=!Kt&&(qt>>Jt&1)==1;Jt<6?jt[Jt][8]=ur:Jt<8?jt[Jt+1][8]=ur:jt[bt-15+Jt][8]=ur}for(var Jt=0;Jt<15;Jt+=1){var ur=!Kt&&(qt>>Jt&1)==1;Jt<8?jt[8][bt-Jt-1]=ur:Jt<9?jt[8][15-Jt-1+1]=ur:jt[8][15-Jt-1]=ur}jt[bt-8][8]=!Kt},Nt=function(Kt,Qt){for(var Ht=-1,qt=bt-1,Jt=7,ur=0,xr=nt.getMaskFunction(Qt),pr=bt-1;pr>0;pr-=2)for(pr==6&&(pr-=1);;){for(var Cr=0;Cr<2;Cr+=1)if(jt[qt][pr-Cr]==null){var Mr=!1;ur>>Jt&1)==1);var lr=xr(qt,pr-Cr);lr&&(Mr=!Mr),jt[qt][pr-Cr]=Mr,Jt-=1,Jt==-1&&(ur+=1,Jt=7)}if(qt+=Ht,qt<0||bt<=qt){qt-=Ht,Ht=-Ht;break}}},tr=function(Kt,Qt){for(var Ht=0,qt=0,Jt=0,ur=new Array(Qt.length),xr=new Array(Qt.length),pr=0;pr=0?Sr.getAt(kr):0}}for(var Ar=0,lr=0;lrpr*8)throw"code length overflow. ("+Jt.getLengthInBits()+">"+pr*8+")";for(Jt.getLengthInBits()+4<=pr*8&&Jt.put(0,4);Jt.getLengthInBits()%8!=0;)Jt.putBit(!1);for(;!(Jt.getLengthInBits()>=pr*8||(Jt.put(Ot,8),Jt.getLengthInBits()>=pr*8));)Jt.put(It,8);return tr(Jt,qt)};dt.addData=function(Kt,Qt){Qt=Qt||"Byte";var Ht=null;switch(Qt){case"Numeric":Ht=ut(Kt);break;case"Alphanumeric":Ht=ht(Kt);break;case"Byte":Ht=yt(Kt);break;case"Kanji":Ht=wt(Kt);break;default:throw"mode:"+Qt}ct.push(Ht),vt=null},dt.isDark=function(Kt,Qt){if(Kt<0||bt<=Kt||Qt<0||bt<=Qt)throw Kt+","+Qt;return jt[Kt][Qt]},dt.getModuleCount=function(){return bt},dt.make=function(){if(Bt<1){for(var Kt=1;Kt<40;Kt++){for(var Qt=ot.getRSBlocks(Kt,Ft),Ht=at(),qt=0;qt"u"?Kt*4:Qt;var Ht="";Ht+='
";for(var Jt=0;Jt';Ht+=""}return Ht+="",Ht+="
",Ht},dt.createSvgTag=function(Kt,Qt,Ht,qt){var Jt={};typeof arguments[0]=="object"&&(Jt=arguments[0],Kt=Jt.cellSize,Qt=Jt.margin,Ht=Jt.alt,qt=Jt.title),Kt=Kt||2,Qt=typeof Qt>"u"?Kt*4:Qt,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 ur=dt.getModuleCount()*Kt+Qt*2,xr,pr,Cr,Mr,lr="",fr;for(fr="l"+Kt+",0 0,"+Kt+" -"+Kt+",0 0,-"+Kt+"z ",lr+=''+nr(qt.text)+"":"",lr+=Ht.text?''+nr(Ht.text)+"":"",lr+='',lr+='"u"?Kt*4:Qt;var Ht=dt.getModuleCount()*Kt+Qt*2,qt=Qt,Jt=Ht-Qt;return Lt(Ht,Ht,function(ur,xr){if(qt<=ur&&ur"u"?Kt*4:Qt;var qt=dt.getModuleCount()*Kt+Qt*2,Jt="";return Jt+="",Jt};var nr=function(Kt){for(var Qt="",Ht=0;Ht":Qt+=">";break;case"&":Qt+="&";break;case'"':Qt+=""";break;default:Qt+=qt;break}}return Qt},Zt=function(Kt){var Qt=1;Kt=typeof Kt>"u"?Qt*2:Kt;var Ht=dt.getModuleCount()*Qt+Kt*2,qt=Kt,Jt=Ht-Kt,ur,xr,pr,Cr,Mr,lr={"██":"█","█ ":"▀"," █":"▄"," ":" "},fr={"██":"▀","█ ":"▀"," █":" "," ":" "},_r="";for(ur=0;ur=Jt?fr[Mr]:lr[Mr];_r+=` -`}return Ht%2&&Kt>0?_r.substring(0,_r.length-Ht-1)+Array(Ht+1).join("▀"):_r.substring(0,_r.length-1)};return dt.createASCII=function(Kt,Qt){if(Kt=Kt||1,Kt<2)return Zt(Qt);Kt-=1,Qt=typeof Qt>"u"?Kt*2:Qt;var Ht=dt.getModuleCount()*Kt+Qt*2,qt=Qt,Jt=Ht-Qt,ur,xr,pr,Cr,Mr=Array(Kt+1).join("██"),lr=Array(Kt+1).join(" "),fr="",_r="";for(ur=0;ur>>8),Ft.push(vt&255)):Ft.push(It)}}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 Dt=[[],[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,Ot=7973,It=21522,Bt={},Ft=function(jt){for(var bt=0;jt!=0;)bt+=1,jt>>>=1;return bt};return Bt.getBCHTypeInfo=function(jt){for(var bt=jt<<10;Ft(bt)-Ft(zt)>=0;)bt^=zt<=0;)bt^=Ot<5&&(vt+=3+mt-5)}for(var ct=0;ct=256;)Bt-=255;return Dt[Bt]},It}();function st(Dt,zt){if(typeof Dt.length>"u")throw Dt.length+"/"+zt;var Ot=function(){for(var Bt=0;Bt"u")throw"bad rs block @ typeNumber:"+Bt+"/errorCorrectionLevel:"+Ft;for(var bt=jt.length/3,vt=[],ct=0;ct>>7-It%8&1)==1},Ot.put=function(It,Bt){for(var Ft=0;Ft>>Bt-Ft-1&1)==1)},Ot.getLengthInBits=function(){return zt},Ot.putBit=function(It){var Bt=Math.floor(zt/8);Dt.length<=Bt&&Dt.push(0),It&&(Dt[Bt]|=128>>>zt%8),zt+=1},Ot},ut=function(Dt){var zt=et.MODE_NUMBER,Ot=Dt,It={};It.getMode=function(){return zt},It.getLength=function(jt){return Ot.length},It.write=function(jt){for(var bt=Ot,vt=0;vt+2>>8&255)*192+(vt&255),Ft.put(vt,13),bt+=2}if(bt>>8)},zt.writeBytes=function(Ot,It,Bt){It=It||0,Bt=Bt||Ot.length;for(var Ft=0;Ft0&&(Ot+=","),Ot+=Dt[It];return Ot+="]",Ot},zt},Pt=function(){var Dt=0,zt=0,Ot=0,It="",Bt={},Ft=function(bt){It+=String.fromCharCode(jt(bt&63))},jt=function(bt){if(!(bt<0)){if(bt<26)return 65+bt;if(bt<52)return 97+(bt-26);if(bt<62)return 48+(bt-52);if(bt==62)return 43;if(bt==63)return 47}throw"n:"+bt};return Bt.writeByte=function(bt){for(Dt=Dt<<8|bt&255,zt+=8,Ot+=1;zt>=6;)Ft(Dt>>>zt-6),zt-=6},Bt.flush=function(){if(zt>0&&(Ft(Dt<<6-zt),Dt=0,zt=0),Ot%3!=0)for(var bt=3-Ot%3,vt=0;vt=zt.length){if(Bt==0)return-1;throw"unexpected end of file./"+Bt}var bt=zt.charAt(Ot);if(Ot+=1,bt=="=")return Bt=0,-1;if(bt.match(/^\s$/))continue;It=It<<6|jt(bt.charCodeAt(0)),Bt+=6}var vt=It>>>Bt-8&255;return Bt-=8,vt};var jt=function(bt){if(65<=bt&&bt<=90)return bt-65;if(97<=bt&&bt<=122)return bt-97+26;if(48<=bt&&bt<=57)return bt-48+52;if(bt==43)return 62;if(bt==47)return 63;throw"c:"+bt};return Ft},Mt=function(Dt,zt){var Ot=Dt,It=zt,Bt=new Array(Dt*zt),Ft={};Ft.setPixel=function(ct,dt,mt){Bt[dt*Ot+ct]=mt},Ft.write=function(ct){ct.writeString("GIF87a"),ct.writeShort(Ot),ct.writeShort(It),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(Ot),ct.writeShort(It),ct.writeByte(0);var dt=2,mt=bt(dt);ct.writeByte(dt);for(var xt=0;mt.length-xt>255;)ct.writeByte(255),ct.writeBytes(mt,xt,255),xt+=255;ct.writeByte(mt.length-xt),ct.writeBytes(mt,xt,mt.length-xt),ct.writeByte(0),ct.writeString(";")};var jt=function(ct){var dt=ct,mt=0,xt=0,At={};return At.write=function(Rt,St){if(Rt>>>St)throw"length over";for(;mt+St>=8;)dt.writeByte(255&(Rt<>>=8-mt,xt=0,mt=0;xt=Rt<0&&dt.writeByte(xt)},At},bt=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){a.exports=j()}(function(){return $})})(qrcode);var qrcodeExports=qrcode.exports,__extends=commonjsGlobal&&commonjsGlobal.__extends||function(){var a=function(_,$){return a=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(_,$);function j(){this.constructor=_}_.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(a){__extends(_,a);function _($){var j=a.call(this,$)||this;return j.canvas=React.createRef(),j}return _.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},_.prototype.drawRoundedSquare=function($,j,et,tt,rt,nt,it,st){st.lineWidth=$,st.fillStyle=rt,st.strokeStyle=rt,et+=$/2,j+=$/2,tt-=$,Array.isArray(nt)||(nt=[nt,nt,nt,nt]),nt=nt.map(function(yt){return yt=Math.min(yt,tt/2),yt<0?0:yt});var ot=nt[0]||0,at=nt[1]||0,ut=nt[2]||0,ht=nt[3]||0;st.beginPath(),st.moveTo(j+ot,et),st.lineTo(j+tt-at,et),at&&st.quadraticCurveTo(j+tt,et,j+tt,et+at),st.lineTo(j+tt,et+tt-ut),ut&&st.quadraticCurveTo(j+tt,et+tt,j+tt-ut,et+tt),st.lineTo(j+ht,et+tt),ht&&st.quadraticCurveTo(j,et+tt,j,et+tt-ht),st.lineTo(j,et+ot),ot&&st.quadraticCurveTo(j,et,j+ot,et),st.closePath(),st.stroke(),it&&st.fill()},_.prototype.drawPositioningPattern=function($,j,et,tt,rt,nt,it){it===void 0&&(it=[0,0,0,0]);var st=Math.ceil(j),ot,at;typeof it!="number"&&!Array.isArray(it)?(ot=it.outer||0,at=it.inner||0):(ot=it,at=ot);var ut,ht;typeof nt!="string"?(ut=nt.outer,ht=nt.inner):(ut=nt,ht=nt);var yt=tt*j+et,wt=rt*j+et,Ct=j*7;this.drawRoundedSquare(st,wt,yt,Ct,ut,ot,!1,$),Ct=j*3,yt+=j*2,wt+=j*2,this.drawRoundedSquare(st,wt,yt,Ct,ht,at,!0,$)},_.prototype.isInPositioninZone=function($,j,et){return et.some(function(tt){return j>=tt.row&&j<=tt.row+7&&$>=tt.col&&$<=tt.col+7})},_.prototype.transformPixelLengthIntoNumberOfCells=function($,j){return $/j},_.prototype.isCoordinateInImage=function($,j,et,tt,rt,nt,it,st){if(st){var ot=2,at=this.transformPixelLengthIntoNumberOfCells(rt,it),ut=this.transformPixelLengthIntoNumberOfCells(nt,it),ht=this.transformPixelLengthIntoNumberOfCells(et,it)-1,yt=this.transformPixelLengthIntoNumberOfCells(tt,it)-1;return j>=at-ot&&j<=at+ht+ot&&$>=ut-ot&&$<=ut+yt+ot}else return!1},_.prototype.shouldComponentUpdate=function($){return!isEqual$1(this.props,$)},_.prototype.componentDidMount=function(){this.update()},_.prototype.componentDidUpdate=function(){this.update()},_.prototype.update=function(){var $=this.props,j=$.value,et=$.ecLevel,tt=$.enableCORS,rt=$.bgColor,nt=$.fgColor,it=$.logoImage,st=$.logoOpacity,ot=$.logoOnLoad,at=$.removeQrCodeBehindLogo,ut=$.qrStyle,ht=$.eyeRadius,yt=$.eyeColor,wt=$.logoPaddingStyle,Ct=+this.props.size,Pt=+this.props.quietZone,$t=this.props.logoWidth?+this.props.logoWidth:0,Mt=this.props.logoHeight?+this.props.logoHeight:0,Lt=this.props.logoPadding?+this.props.logoPadding:0,Dt=qrGenerator(0,et);Dt.addData(_.utf16to8(j)),Dt.make();var zt=ReactDOM.findDOMNode(this.canvas.current),Ot=zt.getContext("2d"),It=Ct+2*Pt,Bt=Dt.getModuleCount(),Ft=Ct/Bt,jt=window.devicePixelRatio||1;zt.height=zt.width=It*jt,Ot.scale(jt,jt),Ot.fillStyle=rt,Ot.fillRect(0,0,It,It);var bt=Pt,vt=[{row:0,col:0},{row:0,col:Bt-7},{row:Bt-7,col:0}];if(Ot.strokeStyle=nt,ut==="dots"){Ot.fillStyle=nt;for(var ct=Ft/2,dt=0;dt0&&!Dt.isDark(dt-1,mt)&&mt>0&&!Dt.isDark(dt,mt-1)&&(xt[0]=!0),dt>0&&!Dt.isDark(dt-1,mt)&&mt0&&!Dt.isDark(dt,mt-1)&&(xt[3]=!0);var At=Math.ceil((mt+1)*Ft)-Math.floor(mt*Ft),Rt=Math.ceil((dt+1)*Ft)-Math.floor(dt*Ft);Ot.fillStyle=nt,Ot.beginPath(),Ot.arc(Math.round(mt*Ft)+ct+bt,Math.round(dt*Ft)+ct+bt,ct,0,2*Math.PI,!1),Ot.closePath(),Ot.fill(),xt[0]||Ot.fillRect(Math.round(mt*Ft)+bt,Math.round(dt*Ft)+bt,At/2,Rt/2),xt[1]||Ot.fillRect(Math.round(mt*Ft)+bt+Math.floor(At/2),Math.round(dt*Ft)+bt,At/2,Rt/2),xt[2]||Ot.fillRect(Math.round(mt*Ft)+bt+Math.floor(At/2),Math.round(dt*Ft)+bt+Math.floor(Rt/2),At/2,Rt/2),xt[3]||Ot.fillRect(Math.round(mt*Ft)+bt,Math.round(dt*Ft)+bt+Math.floor(Rt/2),At/2,Rt/2)}}else for(var dt=0;dt{const $=useGetOwnedAccountSafe()(a);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:a})})})}),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(a),mode:{type:"no_icons"}})})]})})]})},AccountCard=({accountPkh:a})=>{const _=useGetOwnedAccount(),$=useGetAccountBalance(),j=useGetDollarBalance(),et=useGetAccountAllTokens(),tt=useGetAccountNFTs(),{openWith:rt}=reactExports.useContext(DynamicModalContext),nt=_(a),it=$(a),st=j(a),ot=et(a),at=sortedByLastUpdate(tt(a));return jsxRuntimeExports.jsx(AccountDrawerDisplay,{account:nt,balance:it,dollarBalance:st,nfts:at,onReceive:()=>rt(jsxRuntimeExports.jsx(ReceiveModal,{pkh:a})),onSend:()=>rt(jsxRuntimeExports.jsx(FormPage$4,{sender:nt})),tokens:ot})},InfoModal=({account:a})=>{const _=[{title:"Template",content:a.derivationPathTemplate},{title:"Path",content:a.derivationPath},{title:"Type (Curve)",content:a.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:_.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(a.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:a})),variant:"CTAWithIcon",..._,children:jsxRuntimeExports.jsx(FolderInfoIcon,{stroke:"currentcolor"})})}},CloseDrawerButton=({onClose:a})=>jsxRuntimeExports.jsx(Button,{minWidth:"24px",padding:"0",onClick:a,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 st=it.endsWith(".css"),ot=st?'[rel="stylesheet"]':"";if(!!j)for(let ht=tt.length-1;ht>=0;ht--){const yt=tt[ht];if(yt.href===it&&(!st||yt.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${it}"]${ot}`))return;const ut=document.createElement("link");if(ut.rel=st?"stylesheet":scriptRel,st||(ut.as="script",ut.crossOrigin=""),ut.href=it,nt&&ut.setAttribute("nonce",nt),document.head.appendChild(ut),st)return new Promise((ht,yt)=>{ut.addEventListener("load",ht),ut.addEventListener("error",()=>yt(new Error(`Unable to preload CSS for ${it}`)))})}))}return et.then(()=>_()).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=_,$.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($,_[$])}function stdOnEnd(a,_){a.onload=function(){this.onerror=this.onload=null,_(null,a)},a.onerror=function(){this.onerror=this.onload=null,_(new Error("Failed to load "+this.src),a)}}function ieOnEnd(a,_){a.onreadystatechange=function(){this.readyState!="complete"&&this.readyState!="loaded"||(this.onreadystatechange=null,_(null,a))}}var isMergeableObject=function a(_){return isNonNullObject(_)&&!isSpecial(_)};function isNonNullObject(a){return!!a&&typeof a=="object"}function isSpecial(a){var _=Object.prototype.toString.call(a);return _==="[object RegExp]"||_==="[object Date]"||isReactElement(a)}var canUseSymbol=typeof Symbol=="function"&&Symbol.for,REACT_ELEMENT_TYPE=canUseSymbol?Symbol.for("react.element"):60103;function isReactElement(a){return a.$$typeof===REACT_ELEMENT_TYPE}function emptyTarget(a){return Array.isArray(a)?[]:{}}function cloneUnlessOtherwiseSpecified(a,_){return _.clone!==!1&&_.isMergeableObject(a)?deepmerge(emptyTarget(a),a,_):a}function defaultArrayMerge(a,_,$){return a.concat(_).map(function(j){return cloneUnlessOtherwiseSpecified(j,$)})}function getMergeFunction(a,_){if(!_.customMerge)return deepmerge;var $=_.customMerge(a);return typeof $=="function"?$:deepmerge}function getEnumerableOwnPropertySymbols(a){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(a).filter(function(_){return Object.propertyIsEnumerable.call(a,_)}):[]}function getKeys(a){return Object.keys(a).concat(getEnumerableOwnPropertySymbols(a))}function propertyIsOnObject(a,_){try{return _ in a}catch{return!1}}function propertyIsUnsafe(a,_){return propertyIsOnObject(a,_)&&!(Object.hasOwnProperty.call(a,_)&&Object.propertyIsEnumerable.call(a,_))}function mergeObject(a,_,$){var j={};return $.isMergeableObject(a)&&getKeys(a).forEach(function(et){j[et]=cloneUnlessOtherwiseSpecified(a[et],$)}),getKeys(_).forEach(function(et){propertyIsUnsafe(a,et)||(propertyIsOnObject(a,et)&&$.isMergeableObject(_[et])?j[et]=getMergeFunction(et,$)(a[et],_[et],$):j[et]=cloneUnlessOtherwiseSpecified(_[et],$))}),j}function deepmerge(a,_,$){$=$||{},$.arrayMerge=$.arrayMerge||defaultArrayMerge,$.isMergeableObject=$.isMergeableObject||isMergeableObject,$.cloneUnlessOtherwiseSpecified=cloneUnlessOtherwiseSpecified;var j=Array.isArray(_),et=Array.isArray(a),tt=j===et;return tt?j?$.arrayMerge(a,_,$):mergeObject(a,_,$):cloneUnlessOtherwiseSpecified(_,$)}deepmerge.all=function a(_,$){if(!Array.isArray(_))throw new Error("first argument should be an array");return _.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 _)__defProp$6(a,$,{get:_[$],enumerable:!0})},__copyProps$6=(a,_,$,j)=>{if(_&&typeof _=="object"||typeof _=="function")for(let et of __getOwnPropNames$6(_))!__hasOwnProp$6.call(a,et)&&et!==$&&__defProp$6(a,et,{get:()=>_[et],enumerable:!(j=__getOwnPropDesc$6(_,et))||j.enumerable});return a},__toESM$4=(a,_,$)=>($=a!=null?__create$4(__getProtoOf$4(a)):{},__copyProps$6(!a||!a.__esModule?__defProp$6($,"default",{value:a,enumerable:!0}):$,a)),__toCommonJS$6=a=>__copyProps$6(__defProp$6({},"__esModule",{value:!0}),a),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=a=>import_react$2.default.lazy(async()=>{const _=await a();return typeof _.default=="function"?_:_.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(a instanceof Array)return;const $=a.match(_);if($){const j=$[1];if(j.match(MATCH_START_STAMP))return parseTimeString(j);if(MATCH_NUMERIC.test(j))return parseInt(j)}}function parseTimeString(a){let _=0,$=MATCH_START_STAMP.exec(a);for(;$!==null;){const[,j,et]=$;et==="h"&&(_+=parseInt(j,10)*60*60),et==="m"&&(_+=parseInt(j,10)*60),et==="s"&&(_+=parseInt(j,10)),$=MATCH_START_STAMP.exec(a)}return _}function parseStartTime(a){return parseTimeParam(a,MATCH_START_QUERY)}function parseEndTime(a){return parseTimeParam(a,MATCH_END_QUERY)}function randomString(){return Math.random().toString(36).substr(2,5)}function queryString(a){return Object.keys(a).map(_=>`${_}=${a[_]}`).join("&")}function getGlobal(a){return window[a]?window[a]:window.exports&&window.exports[a]?window.exports[a]:window.module&&window.module.exports&&window.module.exports[a]?window.module.exports[a]: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[_]){requests[_].push({resolve:nt,reject:it});return}requests[_]=[{resolve:nt,reject:it}];const st=ot=>{requests[_].forEach(at=>at.resolve(ot))};if(j){const ot=window[j];window[j]=function(){ot&&ot(),st(getGlobal($))}}tt(_,ot=>{ot?(requests[_].forEach(at=>at.reject(ot)),requests[_]=null):j||st(getGlobal($))})})};function getConfig(a,_){return(0,import_deepmerge$1.default)(_.config,a.config)}function omit(a,..._){const $=[].concat(..._),j={},et=Object.keys(a);for(const tt of et)$.indexOf(tt)===-1&&(j[tt]=a[tt]);return j}function callPlayer(a,..._){if(!this.player||!this.player[a]){let $=`ReactPlayer: ${this.constructor.displayName} player could not call %c${a}%c – `;return this.player?this.player[a]||($+="The method was not available"):$+="The player was not available",console.warn($,"font-weight: bold",""),null}return this.player[a](..._)}function isMediaStream(a){return typeof window<"u"&&typeof window.MediaStream<"u"&&a instanceof window.MediaStream}function isBlobUrl(a){return/^blob:/.test(a)}function supportsWebKitPresentationMode(a=document.createElement("video")){const _=/iPhone|iPod/.test(navigator.userAgent)===!1;return a.webkitSupportsPresentationMode&&typeof a.webkitSetPresentationMode=="function"&&_}function enableStubOn(a){return a}var __defProp$5=Object.defineProperty,__getOwnPropDesc$5=Object.getOwnPropertyDescriptor,__getOwnPropNames$5=Object.getOwnPropertyNames,__hasOwnProp$5=Object.prototype.hasOwnProperty,__export$5=(a,_)=>{for(var $ in _)__defProp$5(a,$,{get:_[$],enumerable:!0})},__copyProps$5=(a,_,$,j)=>{if(_&&typeof _=="object"||typeof _=="function")for(let et of __getOwnPropNames$5(_))!__hasOwnProp$5.call(a,et)&&et!==$&&__defProp$5(a,et,{get:()=>_[et],enumerable:!(j=__getOwnPropDesc$5(_,et))||j.enumerable});return a},__toCommonJS$5=a=>__copyProps$5(__defProp$5({},"__esModule",{value:!0}),a),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=a=>{if(a instanceof Array){for(const _ of a)if(typeof _=="string"&&canPlayFile(_)||canPlayFile(_.src))return!0;return!1}return(0,import_utils$3.isMediaStream)(a)||(0,import_utils$3.isBlobUrl)(a)?!0:AUDIO_EXTENSIONS.test(a)||VIDEO_EXTENSIONS.test(a)||HLS_EXTENSIONS.test(a)||DASH_EXTENSIONS.test(a)||FLV_EXTENSIONS.test(a)},canPlay={youtube:a=>a instanceof Array?a.every(_=>MATCH_URL_YOUTUBE.test(_)):MATCH_URL_YOUTUBE.test(a),soundcloud:a=>MATCH_URL_SOUNDCLOUD.test(a)&&!AUDIO_EXTENSIONS.test(a),vimeo:a=>MATCH_URL_VIMEO.test(a)&&!VIDEO_EXTENSIONS.test(a)&&!HLS_EXTENSIONS.test(a),mux:a=>MATCH_URL_MUX.test(a),facebook:a=>MATCH_URL_FACEBOOK.test(a)||MATCH_URL_FACEBOOK_WATCH.test(a),streamable:a=>MATCH_URL_STREAMABLE.test(a),wistia:a=>MATCH_URL_WISTIA.test(a),twitch:a=>MATCH_URL_TWITCH_VIDEO.test(a)||MATCH_URL_TWITCH_CHANNEL.test(a),dailymotion:a=>MATCH_URL_DAILYMOTION.test(a),mixcloud:a=>MATCH_URL_MIXCLOUD.test(a),vidyard:a=>MATCH_URL_VIDYARD.test(a),kaltura:a=>MATCH_URL_KALTURA.test(a),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 _)__defProp$4(a,$,{get:_[$],enumerable:!0})},__copyProps$4=(a,_,$,j)=>{if(_&&typeof _=="object"||typeof _=="function")for(let et of __getOwnPropNames$4(_))!__hasOwnProp$4.call(a,et)&&et!==$&&__defProp$4(a,et,{get:()=>_[et],enumerable:!(j=__getOwnPropDesc$4(_,et))||j.enumerable});return a},__toCommonJS$4=a=>__copyProps$4(__defProp$4({},"__esModule",{value:!0}),a),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-BumwYQ13.js").then(a=>a.Y),[],import.meta.url))},{key:"soundcloud",name:"SoundCloud",canPlay:import_patterns.canPlay.soundcloud,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./SoundCloud-CW3rueaI.js").then(a=>a.S),[],import.meta.url))},{key:"vimeo",name:"Vimeo",canPlay:import_patterns.canPlay.vimeo,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Vimeo-D65yvNpO.js").then(a=>a.V),[],import.meta.url))},{key:"mux",name:"Mux",canPlay:import_patterns.canPlay.mux,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Mux-59192Tm3.js").then(a=>a.M),[],import.meta.url))},{key:"facebook",name:"Facebook",canPlay:import_patterns.canPlay.facebook,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Facebook-CKVngJGG.js").then(a=>a.F),[],import.meta.url))},{key:"streamable",name:"Streamable",canPlay:import_patterns.canPlay.streamable,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Streamable-DEtvFbMk.js").then(a=>a.S),[],import.meta.url))},{key:"wistia",name:"Wistia",canPlay:import_patterns.canPlay.wistia,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Wistia-Qrs_QWdc.js").then(a=>a.W),[],import.meta.url))},{key:"twitch",name:"Twitch",canPlay:import_patterns.canPlay.twitch,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Twitch-hnmwH80q.js").then(a=>a.T),[],import.meta.url))},{key:"dailymotion",name:"DailyMotion",canPlay:import_patterns.canPlay.dailymotion,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./DailyMotion-CZtOhfK_.js").then(a=>a.D),[],import.meta.url))},{key:"mixcloud",name:"Mixcloud",canPlay:import_patterns.canPlay.mixcloud,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Mixcloud-BUQUnZkn.js").then(a=>a.M),[],import.meta.url))},{key:"vidyard",name:"Vidyard",canPlay:import_patterns.canPlay.vidyard,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Vidyard-DEs875ka.js").then(a=>a.V),[],import.meta.url))},{key:"kaltura",name:"Kaltura",canPlay:import_patterns.canPlay.kaltura,lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./Kaltura-CYtm0IWA.js").then(a=>a.K),[],import.meta.url))},{key:"file",name:"FilePlayer",canPlay:import_patterns.canPlay.file,canEnablePIP:a=>import_patterns.canPlay.file(a)&&(document.pictureInPictureEnabled||(0,import_utils$2.supportsWebKitPresentationMode)())&&!import_patterns.AUDIO_EXTENSIONS.test(a),lazyPlayer:(0,import_utils$2.lazy)(()=>__vitePreload(()=>import("./FilePlayer-B7XqgIwc.js").then(a=>a.F),[],import.meta.url))}],safeIsNaN=Number.isNaN||function a(_){return typeof _=="number"&&_!==_};function isEqual(a,_){return!!(a===_||safeIsNaN(a)&&safeIsNaN(_))}function areInputsEqual(a,_){if(a.length!==_.length)return!1;for(var $=0;${for(var $ in _)__defProp$3(a,$,{get:_[$],enumerable:!0})},__copyProps$3=(a,_,$,j)=>{if(_&&typeof _=="object"||typeof _=="function")for(let et of __getOwnPropNames$3(_))!__hasOwnProp$3.call(a,et)&&et!==$&&__defProp$3(a,et,{get:()=>_[et],enumerable:!(j=__getOwnPropDesc$3(_,et))||j.enumerable});return a},__toESM$3=(a,_,$)=>($=a!=null?__create$3(__getProtoOf$3(a)):{},__copyProps$3(!a||!a.__esModule?__defProp$3($,"default",{value:a,enumerable:!0}):$,a)),__toCommonJS$3=a=>__copyProps$3(__defProp$3({},"__esModule",{value:!0}),a),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,_,$)=>_ in a?__defProp$2(a,_,{enumerable:!0,configurable:!0,writable:!0,value:$}):a[_]=$,__export$2=(a,_)=>{for(var $ in _)__defProp$2(a,$,{get:_[$],enumerable:!0})},__copyProps$2=(a,_,$,j)=>{if(_&&typeof _=="object"||typeof _=="function")for(let et of __getOwnPropNames$2(_))!__hasOwnProp$2.call(a,et)&&et!==$&&__defProp$2(a,et,{get:()=>_[et],enumerable:!(j=__getOwnPropDesc$2(_,et))||j.enumerable});return a},__toESM$2=(a,_,$)=>($=a!=null?__create$2(__getProtoOf$2(a)):{},__copyProps$2(!a||!a.__esModule?__defProp$2($,"default",{value:a,enumerable:!0}):$,a)),__toCommonJS$2=a=>__copyProps$2(__defProp$2({},"__esModule",{value:!0}),a),__publicField$1=(a,_,$)=>(__defNormalProp$1(a,typeof _!="symbol"?_+"":_,$),$),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",_=>{if(this.player){this.progress();return}this.player=_,this.player.load(this.props.url),this.progress()}),__publicField$1(this,"getInternalPlayer",_=>this.player?this.player[_]:null),__publicField$1(this,"progress",()=>{if(this.props.url&&this.player&&this.isReady){const _=this.getCurrentTime()||0,$=this.getSecondsLoaded(),j=this.getDuration();if(j){const et={playedSeconds:_,played:_/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:_,playing:$,volume:j,muted:et}=this.props;_(),!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:_,onPlay:$,playbackRate:j}=this.props;this.startOnPlay&&(this.player.setPlaybackRate&&j!==1&&this.player.setPlaybackRate(j),_(),this.startOnPlay=!1),$(),this.seekOnPlay&&(this.seekTo(this.seekOnPlay),this.seekOnPlay=null),this.handleDurationCheck()}),__publicField$1(this,"handlePause",_=>{this.isPlaying=!1,this.isLoading||this.props.onPause(_)}),__publicField$1(this,"handleEnded",()=>{const{activePlayer:_,loop:$,onEnded:j}=this.props;_.loopOnEnded&&$&&this.seekTo(0),$||(this.isPlaying=!1,j())}),__publicField$1(this,"handleError",(..._)=>{this.isLoading=!1,this.props.onError(..._)}),__publicField$1(this,"handleDurationCheck",()=>{clearTimeout(this.durationCheckTimeout);const _=this.getDuration();_?this.onDurationCalled||(this.props.onDuration(_),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(_){if(!this.player)return;const{url:$,playing:j,volume:et,muted:tt,playbackRate:rt,pip:nt,loop:it,activePlayer:st,disableDeferredLoading:ot}=this.props;if(!(0,import_react_fast_compare$1.default)(_.url,$)){if(this.isLoading&&!st.forceLoad&&!ot&&!(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)}!_.playing&&j&&!this.isPlaying&&this.player.play(),_.playing&&!j&&this.isPlaying&&this.player.pause(),!_.pip&&nt&&this.player.enablePIP&&this.player.enablePIP(),_.pip&&!nt&&this.player.disablePIP&&this.player.disablePIP(),_.volume!==et&&et!==null&&this.player.setVolume(et),_.muted!==tt&&(tt?this.player.mute():(this.player.unmute(),et!==null&&setTimeout(()=>this.player.setVolume(et)))),_.playbackRate!==rt&&this.player.setPlaybackRate&&this.player.setPlaybackRate(rt),_.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(_,$,j){if(!this.isReady){_!==0&&(this.seekOnPlay=_,setTimeout(()=>{this.seekOnPlay=null},SEEK_ON_PLAY_EXPIRY));return}if($?$==="fraction":_>0&&_<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*_,j);return}this.player.seekTo(_,j)}render(){const _=this.props.activePlayer;return _?import_react$1.default.createElement(_,{...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,_,$)=>_ in a?__defProp$1(a,_,{enumerable:!0,configurable:!0,writable:!0,value:$}):a[_]=$,__export$1=(a,_)=>{for(var $ in _)__defProp$1(a,$,{get:_[$],enumerable:!0})},__copyProps$1=(a,_,$,j)=>{if(_&&typeof _=="object"||typeof _=="function")for(let et of __getOwnPropNames$1(_))!__hasOwnProp$1.call(a,et)&&et!==$&&__defProp$1(a,et,{get:()=>_[et],enumerable:!(j=__getOwnPropDesc$1(_,et))||j.enumerable});return a},__toESM$1=(a,_,$)=>($=a!=null?__create$1(__getProtoOf$1(a)):{},__copyProps$1(!a||!a.__esModule?__defProp$1($,"default",{value:a,enumerable:!0}):$,a)),__toCommonJS$1=a=>__copyProps$1(__defProp$1({},"__esModule",{value:!0}),a),__publicField=(a,_,$)=>(__defNormalProp(a,typeof _!="symbol"?_+"":_,$),$),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-BOylr8KG.js").then(a=>a.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,...a])if(et.canPlay(j))return et;return _||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:st}=this.state,ot=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},...ot},import_react.default.createElement(UniversalSuspense,{fallback:nt},st?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,...a])if(et.canPlay(j))return!0;return!1}),__publicField($,"canEnablePIP",j=>{for(const et of[...customPlayers,...a])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 _)__defProp(a,$,{get:_[$],enumerable:!0})},__copyProps=(a,_,$,j)=>{if(_&&typeof _=="object"||typeof _=="function")for(let et of __getOwnPropNames(_))!__hasOwnProp.call(a,et)&&et!==$&&__defProp(a,et,{get:()=>_[et],enumerable:!(j=__getOwnPropDesc(_,et))||j.enumerable});return a},__toESM=(a,_,$)=>($=a!=null?__create(__getProtoOf(a)):{},__copyProps(!a||!a.__esModule?__defProp($,"default",{value:a,enumerable:!0}):$,a)),__toCommonJS=a=>__copyProps(__defProp({},"__esModule",{value:!0}),a),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:a,style:_})=>{const $=a.metadata.attributes;return!$||$.length===0?null:jsxRuntimeExports.jsxs(AccordionItem,{background:colors.gray[800],"data-testid":"attributes-section",style:_,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:a,maxLength:_})=>a.length<=_?jsxRuntimeExports.jsx(Text,{"data-testid":"truncated-text",children:a}):jsxRuntimeExports.jsx(Tooltip,{label:a,children:jsxRuntimeExports.jsx(Text,{"data-testid":"truncated-text",children:truncate(a,_)})}),TzktLink=({url:a,..._})=>jsxRuntimeExports.jsx("a",{"data-testid":"tzkt-link",href:a,rel:"noopener noreferrer",target:"_blank",children:jsxRuntimeExports.jsx(WindowLinkIcon,{..._})}),CreatorElement=({nft:a})=>{if(!a.metadata.creators||a.metadata.creators.length===0)return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:"-"});const _=a.metadata.creators[0];return _.startsWith("tz")?jsxRuntimeExports.jsx(AddressPill,{marginRight:1,address:parsePkh(_)}):jsxRuntimeExports.jsx(TruncatedTextWithTooltip,{maxLength:15,text:_})},PropertiesAccordionItem=({nft:a,style:_})=>{const $=royalties(a),j=$.reduce((tt,rt)=>tt+rt.share,0).toFixed(2),et=useSelectedNetwork();return jsxRuntimeExports.jsxs(AccordionItem,{background:colors.gray[800],style:_,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:a.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:a.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(a)||"-"})]}),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(a.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(a,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:a})}),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:a.metadata.rights||"-"})})]})]})})})})]})},TagsSection=({nft:a})=>{const _=a.metadata.tags;return!_||_.length===0?null:jsxRuntimeExports.jsx(Wrap,{marginTop:"20px","data-testid":"tags-section",children:_.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:a})=>{const _=getIPFSurl(thumbnailUri(a)),$=getIPFSurl(a.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(a.metadata.name,45)})]})})},SignPage$1=a=>{const{mode:_,operations:$,fee:j,data:{nft:et}}=a,{fee:tt,operations:rt,estimationFailed:nt,isLoading:it,form:st,signer:ot,reEstimate:at,onSign:ut}=useSignPageHelpers(j,$,_),{recipient:ht}=rt.operations[0];return jsxRuntimeExports.jsx(FormProvider,{...st,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(SignPageHeader,{...a,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:ot,text:headerText(rt.type,_)})})]})})})},FormPage$1=a=>{const{nft:_}=a,$=useOpenSignPageFormAction({SignPage:SignPage$1,signPageExtraData:{nft:_},FormPage:FormPage$1,defaultFormPageProps:a,toOperation:toOperation$1(_)}),j=useAddToBatchFormAction(toOperation$1(_)),{onFormSubmitActionHandlers:[et,tt],isLoading:rt}=useHandleOnSubmitFormActions([$,j]),nt=useForm({mode:"onBlur",defaultValues:{quantity:1,...formDefaultValues(a)}}),{formState:{isValid:it,errors:st},register:ot,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:a.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:_.balance})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!st.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",...ot("quantity",{required:"Quantity is required",max:{value:_.balance,message:`Max quantity is ${_.balance}`},min:{value:1,message:"Min quantity is 1"}})})}),jsxRuntimeExports.jsxs(Text,{"data-testid":"out-of-nft",children:["out of ",_.balance]})]})]})}),st.quantity&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"quantity-error",children:st.quantity.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!st.sender,children:[jsxRuntimeExports.jsx(OwnedAccountsAutocomplete,{allowUnknown:!1,inputName:"sender",isDisabled:!0,label:"From"}),st.sender&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"from-error",children:st.sender.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!st.recipient,children:[jsxRuntimeExports.jsx(KnownAccountsAutocomplete,{allowUnknown:!0,inputName:"recipient",label:"To"}),st.recipient&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"recipient-error",children:st.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(_.sender),recipient:parsePkh(_.recipient),contract:parseContractPkh(a.contract),tokenId:a.tokenId,amount:_.quantity.toString()}),NFTDrawerCard=({nft:a})=>{var it;const _=getIPFSurl(artifactUri(a)),$=getIPFSurl(a.displayUri),j=useGetOwnedAccount(),{openWith:et}=reactExports.useContext(DynamicModalContext),tt=(it=mimeType(a))==null?void 0:it.startsWith("video/"),rt=tokenName(a),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:_})}),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:_}),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:_})]})}),Number(a.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"+a.balance})]})}),jsxRuntimeExports.jsx(TagsSection,{nft:a}),rt&&jsxRuntimeExports.jsx(Heading,{marginTop:"16px",marginBottom:"14px","data-testid":"nft-name",size:"lg",children:rt}),a.metadata.description&&jsxRuntimeExports.jsx(Text,{color:colors.gray[400],"data-testid":"nft-description",size:"sm",children:a.metadata.description}),jsxRuntimeExports.jsx(Button,{marginTop:"20px",onClick:()=>et(jsxRuntimeExports.jsx(FormPage$1,{nft:a,sender:j(a.owner)})),children:"Send"}),jsxRuntimeExports.jsxs(Accordion,{marginTop:"32px",allowMultiple:!0,children:[jsxRuntimeExports.jsx(AttributesAccordionItem,{nft:a,style:nt}),jsxRuntimeExports.jsx(PropertiesAccordionItem,{nft:a,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:a})})]})]})]})},NFTDrawerBody=({nft:a,onCloseDrawer:_})=>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(a.owner)}),jsxRuntimeExports.jsx(CloseDrawerButton,{onClose:_})]}),jsxRuntimeExports.jsx(NFTDrawerCard,{nft:a})]}),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:st}=useDisclosure$1({defaultIsOpen:rt}),ot=useNavigate(),at=reactExports.useCallback(()=>{_(null),st(),ot("/home")},[st,ot]);reactExports.useEffect(()=>{const ht=yt=>{yt.key==="Escape"&&at()};return document.addEventListener("keydown",ht),()=>document.removeEventListener("keydown",ht)},[at]);const ut=reactExports.useMemo(()=>({selectedAccount:a,selectAccount:ht=>{_(ht),it()}}),[a,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&&a&&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:a}),jsxRuntimeExports.jsx(CloseDrawerButton,{onClose:at})]}),jsxRuntimeExports.jsx(AccountCard,{accountPkh:a.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:a=>{}}),NFTCard=({nft:a})=>{const{selectedNFT:_,setSelectedNFT:$}=reactExports.useContext(SelectedNFTContext),j=getIPFSurl(thumbnailUri(a)),et=getIPFSurl(a.displayUri),tt=a.metadata.name,rt={width:"100%",minWidth:"242px",minHeight:"242px",objectFit:"contain",aspectRatio:"1",fallbackSrc:et,src:j},nt=_&&fullId(_)===fullId(a)&&_.owner===a.owner;return jsxRuntimeExports.jsx(Card,{minWidth:"274px",borderRadius:"8px",cursor:"pointer","data-testid":`nft-card${nt?"-selected":""}`,onClick:()=>$(a),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(a.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"+a.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(a.owner)})]})})},NFTGallery=({nftsByOwner:a})=>{const _=Object.entries(a).flatMap(([j,et])=>(et||[]).map(tt=>({owner:j,...tt})));let $="repeat(auto-fit, minmax(min(100%/2, max(274px, 100%/7)), 1fr))";return _.length<3&&($=`repeat(auto-fit, min(100% / ${_.length} - 16px, 450px))`),jsxRuntimeExports.jsx(SimpleGrid,{gridTemplateColumns:$,marginBottom:"16px",minChildWidth:"340px",spacing:"16px",children:sortedByLastUpdate(_).map(j=>jsxRuntimeExports.jsx(NFTCard,{nft:j},`${j.owner}:${fullId(j)}`))})},AccountListDisplay=({accounts:a,onSelect:_})=>jsxRuntimeExports.jsx(MenuList,{zIndex:"docked",overflowY:"scroll",maxHeight:"300px",padding:0,background:colors.gray[900],children:a.map($=>jsxRuntimeExports.jsx(MenuItem$1,{width:"100%",minHeight:"48px",padding:"5px",background:colors.gray[700],"aria-label":$.label,onClick:()=>{_($)},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 a=useAllAccounts(),[_]=reactExports.useState(a),[$,j]=useSearchParams(),et=$.getAll("accounts"),[tt,rt]=reactExports.useState(et.length===0),[nt,it]=reactExports.useState(a.filter(at=>et.includes(at.address.pkh))),st=lodashExports.differenceBy(a,nt,at=>at.address.pkh),ot=nt.length===a.length;return reactExports.useEffect(()=>{j(at=>({...at,accounts:nt.map(ut=>ut.address.pkh)}))},[nt,j]),{selectedAccounts:tt?_: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:ot,marginY:"16px",rightIcon:jsxRuntimeExports.jsx(ChevronDownIcon,{}),variant:"ghost",children:"Filter by Account"}),jsxRuntimeExports.jsx(AccountListDisplay,{accounts:st,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 a=useAllNfts(),{accountsFilter:_,selectedAccounts:$}=useAccountsFilter(),[j,et]=reactExports.useState(void 0);reactExports.useEffect(()=>{const it=st=>{st.key==="Escape"&&et(void 0)};return document.addEventListener("keydown",it),()=>document.removeEventListener("keydown",it)},[]);const tt=lodashExports.pick(a,$.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"}),_,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:a,selectedAccounts:_}=useAccountsFilter(),{operations:$,loadMore:j,hasMore:et,isLoading:tt,isFirstLoad:rt}=useGetOperations(_),nt=reactExports.useRef(!1),it=st=>{if(nt.current||!et||tt)return;const ot=st.target;if(ot.scrollHeight-ot.scrollTop-ot.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"}),a,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((st,ot)=>{const at=ot===$.length-1;return jsxRuntimeExports.jsxs(Box,{height:"90px",marginBottom:at?"10px":0,paddingY:"20px",children:[jsxRuntimeExports.jsx(OperationTile,{operation:st}),!at&&jsxRuntimeExports.jsx(Box,{children:jsxRuntimeExports.jsx(Divider,{marginTop:"20px"})})]},st.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",..._,children:jsxRuntimeExports.jsx(CloseDrawerButton,{onClose:a})}),BeaconPeers=()=>{const a=usePeers(),[_,$]=reactExports.useState([]);return reactExports.useEffect(()=>{const j=a.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:_})},PeersDisplay=({peerInfos:a})=>jsxRuntimeExports.jsx(Box,{children:a.map(_=>jsxRuntimeExports.jsxs(reactExports.Fragment,{children:[jsxRuntimeExports.jsx(Divider,{}),jsxRuntimeExports.jsx(PeerRow,{peerInfo:_})]},_.senderId))}),PeerRow=({peerInfo:a})=>{const _=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:a.icon})}),jsxRuntimeExports.jsxs(Center,{alignItems:"flex-start",flexDirection:"column",children:[jsxRuntimeExports.jsx(Heading,{marginBottom:"6px",size:"md",children:a.name}),jsxRuntimeExports.jsx(StoredPeerInfo,{peerInfo:a})]})]}),jsxRuntimeExports.jsx(Center,{children:jsxRuntimeExports.jsx(IconButton,{"aria-label":"Remove Peer",icon:jsxRuntimeExports.jsx(TrashIcon,{}),onClick:()=>_(a),size:"xs",variant:"circle"})})]})},StoredPeerInfo=({peerInfo:a})=>{const _=useGetConnectionInfo(a.senderId);return _?jsxRuntimeExports.jsxs(Flex,{children:[jsxRuntimeExports.jsx(AddressPill,{marginRight:"10px",address:parsePkh(_.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(_.networkType)})]}):null},DAppsDrawerCard=()=>{const{isOpen:a,onClose:_,onOpen:$}=useDisclosure$1(),j=useAddPeer();return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(SettingsCardWithDrawerIcon,{left:"dApps",isSelected:a,onClick:$}),jsxRuntimeExports.jsxs(Drawer,{autoFocus:!1,blockScrollOnMount:!1,isOpen:a,onClose:_,placement:"right",children:[jsxRuntimeExports.jsx(ModalOverlay,{}),jsxRuntimeExports.jsx(DrawerContent,{children:jsxRuntimeExports.jsxs(ModalBody,{"data-testid":"drawer-body",children:[jsxRuntimeExports.jsx(DrawerTopButtons,{onClose:_}),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:a,onClose:_,onOpen:$}=useDisclosure$1();return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(SettingsCardWithDrawerIcon,{left:"Error Logs",isSelected:a,onClick:$}),jsxRuntimeExports.jsxs(Drawer,{blockScrollOnMount:!1,isOpen:a,onClose:_,placement:"right",children:[jsxRuntimeExports.jsx(ModalOverlay,{}),jsxRuntimeExports.jsx(DrawerContent,{children:jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(DrawerTopButtons,{onClose:_}),jsxRuntimeExports.jsx(ErrorLogsDrawerBody,{})]})})]})]})},ErrorLogsDrawerBody=()=>{const a=[...useAppSelector(j=>j.errors)].reverse(),_=useDispatch(),$=()=>{_(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(a))}`,children:jsxRuntimeExports.jsx(Button,{variant:"tertiary",children:"Download error logs"})}),jsxRuntimeExports.jsx(Button,{marginLeft:"8px",onClick:$,variant:"warning",children:"Clear All"})]})]}),a.map(j=>jsxRuntimeExports.jsx(ErrorLogRow,{errorLog:j},nanoid()))]})},ErrorLogRow=({errorLog:a})=>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:a.description}),jsxRuntimeExports.jsx(Text,{color:colors.gray[400],size:"sm",children:a.timestamp})]})]})})]}),removeTrailingSlashes=a=>a.replace(/\/+$/g,""),UpsertNetworkModal=({network:a})=>{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:a}),st=ot=>{j(networksActions.upsertNetwork(ot)),$()};return jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{onSubmit:it(st),children:[jsxRuntimeExports.jsxs(ModalHeader,{textAlign:"center",children:[_==="edit"?"Edit":"Add"," Network",jsxRuntimeExports.jsx(ModalCloseButton,{})]}),jsxRuntimeExports.jsxs(ModalBody,{children:[_==="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:ot=>{if(et.find(at=>at.name===ot))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:_==="edit"?"Save changes":"Add network"})})]})]})})},NetworkSettingsDrawerBody=()=>{const{openWith:a}=reactExports.useContext(DynamicModalContext),_=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:()=>a(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:_.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:()=>a(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:a,onClose:_,onOpen:$}=useDisclosure$1();return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(SettingsCardWithDrawerIcon,{left:"Network Settings",isSelected:a,onClick:$}),jsxRuntimeExports.jsxs(Drawer,{blockScrollOnMount:!1,isOpen:a,onClose:_,placement:"right",children:[jsxRuntimeExports.jsx(ModalOverlay,{}),jsxRuntimeExports.jsx(DrawerContent,{children:jsxRuntimeExports.jsxs(ModalBody,{children:[jsxRuntimeExports.jsx(DrawerTopButtons,{onClose:_}),jsxRuntimeExports.jsx(NetworkSettingsDrawerBody,{})]})})]})]})},ChangePasswordForm=()=>{const{onClose:a}=reactExports.useContext(DynamicModalContext),_=useForm({mode:"onBlur"}),$=useToast(),j=useAppDispatch(),{handleAsyncAction:et,isLoading:tt}=useAsyncActionHandler(),{handleSubmit:rt,formState:{isValid:nt,errors:it},getValues:st}=_,ot=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"}),a()})};return jsxRuntimeExports.jsx(FormProvider,{..._,children:jsxRuntimeExports.jsx(ModalContent,{background:colors.gray[700],"data-testid":"change-password-modal",children:jsxRuntimeExports.jsxs("form",{onSubmit:rt(ot),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=>st("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=>st("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:a,onOpen:_}=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:_}),jsxRuntimeExports.jsx(SettingsCardWithDrawerIcon,{left:"Change Password",isSelected:!1,onClick:()=>$(jsxRuntimeExports.jsx(ChangePasswordForm,{}))}),a]})},SectionContainer=({title:a,children:_})=>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:a,amount:_,...$})=>{const{contract:j}=a,et=tokenPrettyAmount(_,a),tt=tokenSymbolSafe(a);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=a=>{const{mode:_,operations:$,fee:j,data:{token:et}}=a,{fee:tt,operations:rt,estimationFailed:nt,isLoading:it,form:st,signer:ot,reEstimate:at,onSign:ut}=useSignPageHelpers(j,$,_),{amount:ht,recipient:yt}=rt.operations[0];return jsxRuntimeExports.jsx(FormProvider,{...st,children:jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsxs("form",{children:[jsxRuntimeExports.jsx(SignPageHeader,{...a,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:yt}),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:ot,text:headerText(rt.type,_)})})]})})})},FormPage=a=>{const{token:_}=a,$=useOpenSignPageFormAction({SignPage,signPageExtraData:{token:_},FormPage,defaultFormPageProps:a,toOperation:toOperation(_)}),j=useAddToBatchFormAction(toOperation(_)),{onFormSubmitActionHandlers:[et,tt],isLoading:rt}=useHandleOnSubmitFormActions([$,j]),nt=useForm({mode:"onBlur",defaultValues:formDefaultValues(a)}),{formState:{isValid:it,errors:st},register:ot,handleSubmit:at}=nt,ut=tokenDecimals(_),ht=formatTokenAmount(_.balance,ut),yt=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:!!st.prettyAmount,children:[jsxRuntimeExports.jsx(FormLabel,{children:"Amount"}),jsxRuntimeExports.jsxs(InputGroup,{children:[jsxRuntimeExports.jsx(Input,{isDisabled:rt,step:yt,type:"number",...ot("prettyAmount",{required:"Amount is required",max:{value:ht.toString(),message:`Max amount is ${ht}`},validate:makeValidateDecimals(Number(ut))}),placeholder:yt}),jsxRuntimeExports.jsx(InputRightElement,{paddingRight:"12px","data-testid":"token-symbol",children:tokenSymbolSafe(_)})]}),st.prettyAmount&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"amount-error",children:st.prettyAmount.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!st.sender,children:[jsxRuntimeExports.jsx(OwnedAccountsAutocomplete,{allowUnknown:!1,inputName:"sender",isDisabled:!0,label:"From"}),st.sender&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"from-error",children:st.sender.message})]}),jsxRuntimeExports.jsxs(FormControl,{marginTop:"24px",isInvalid:!!st.recipient,children:[jsxRuntimeExports.jsx(KnownAccountsAutocomplete,{allowUnknown:!0,inputName:"recipient",label:"To"}),st.recipient&&jsxRuntimeExports.jsx(FormErrorMessage,{"data-testid":"recipient-error",children:st.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(_.sender),recipient:parsePkh(_.recipient),contract:parseContractPkh(a.contract),tokenId:a.tokenId,amount:getRealAmount(a,_.prettyAmount)};return a.type==="fa2"?$:{...$,type:"fa1.2",tokenId:"0"}},Header=({account:a})=>{const{address:_,label:$}=a,j=useAddressKind$1(_);return jsxRuntimeExports.jsxs(Flex,{alignItems:"center",height:"78px",background:accountIconGradient({left:"-10px",top:"-10px",account:a,radius:"100px",mainBackgroundColor:colors.gray[800]}),borderTopRadius:"8px","data-testid":"header",paddingX:"30px",children:[jsxRuntimeExports.jsx(AddressTileIcon,{addressKind:j,identiconSize:35,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(_.pkh)})]}),jsxRuntimeExports.jsx(Flex,{flexDirection:"column-reverse",children:jsxRuntimeExports.jsx(AccountBalance,{verticalAlign:"bottom",address:a.address.pkh})})]})]})},AccountTokens=({account:a,tokens:_})=>{const{openWith:$}=reactExports.useContext(DynamicModalContext);return jsxRuntimeExports.jsxs(Card,{overflowX:"auto",marginBottom:"16px",borderBottomRadius:"8px",backgroundColor:colors.gray[900],children:[jsxRuntimeExports.jsx(Header,{account:a}),jsxRuntimeExports.jsx(TableContainer,{paddingX:"30px",children:jsxRuntimeExports.jsx(Table,{children:jsxRuntimeExports.jsx(Tbody,{children:_.map((j,et)=>{const tt=et===_.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:a,token:j}))})})]},fullId(j))})})})})]})},TokensPage=()=>{const{accountsFilter:a,selectedAccounts:_}=useAccountsFilter(),$=useGetAccountAllTokens(),j=_.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"}),a,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 $=a?packageInfo.version:`Umami v${packageInfo.version}`;return jsxRuntimeExports.jsx(Text,{color:colors.gray[450],..._,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(()=>{_(j=>!j)},[]);return{isCollapsed:a,toggle:$}},ORANGE="#F74F18",MakiLogo=a=>{const _=useSelectedNetwork();return jsxRuntimeExports.jsx(MakiIcon,{background:"white",borderRadius:"8px","data-testid":"maki-logo",fishColor:_.name==="mainnet"?ORANGE:"black",...a})},NetworkSelector=()=>{const a=useSelectedNetwork(),_=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(a.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:_.map((rt,nt)=>jsxRuntimeExports.jsxs(reactExports.Fragment,{children:[jsxRuntimeExports.jsx(Button,{height:"34px",color:rt.name===a.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<_.length-1&&jsxRuntimeExports.jsx(Divider,{})]},rt.name))})})})]})},UpdateAppButton=()=>{const[a,_]=reactExports.useState(!1),$=window;reactExports.useEffect(()=>{$&&$.electronAPI&&$.electronAPI.onAppUpdateDownloaded(et=>_(!0))},[$]);const j=()=>{$&&$.electronAPI&&$.electronAPI.installAppUpdateAndQuit()};return a?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:a,toggle:_}=useCollapseMenu(),$=jsxRuntimeExports.jsx(CollapseMenuButton,{marginTop:a?0:"2px",marginRight:a?0:"-14px",toggle:_});return jsxRuntimeExports.jsxs(Flex,{alignItems:a?"center":"normal",flexDirection:"column",width:a?"80px":"236px",padding:a?"30px 20px":"30px",background:colors.gray[900],"data-testid":`side-navbar${a?"-collapsed":""}`,children:[jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(Flex,{alignItems:"center",justifyContent:"space-between",height:"30px",children:a?$: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:a?"center":"normal",justifyContent:a?"space-around":"normal",display:a?"flex":"block",height:"100%",children:[!a&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(UpdateAppButton,{}),jsxRuntimeExports.jsx(TotalBalance,{})]}),jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(MenuItem,{icon:jsxRuntimeExports.jsx(AccountsIcon,{}),isCollapsed:a,label:"Accounts",to:"/home"}),jsxRuntimeExports.jsx(MenuItem,{icon:jsxRuntimeExports.jsx(DiamondIcon,{}),isCollapsed:a,label:"NFTs",to:"/nfts"}),jsxRuntimeExports.jsx(MenuItem,{icon:jsxRuntimeExports.jsx(RefreshClockIcon,{width:"24px",height:"24px"}),isCollapsed:a,label:"Operations",to:"/operations"}),jsxRuntimeExports.jsx(MenuItem,{icon:jsxRuntimeExports.jsx(CoinIcon,{}),isCollapsed:a,label:"Tokens",to:"/tokens"}),jsxRuntimeExports.jsx(MenuItem,{icon:jsxRuntimeExports.jsx(BatchIcon,{}),isCollapsed:a,label:"Batch",to:"/batch"})]})]}),jsxRuntimeExports.jsxs(Box,{children:[jsxRuntimeExports.jsx(Divider,{}),jsxRuntimeExports.jsx(MenuItem,{marginTop:"22px",icon:jsxRuntimeExports.jsx(AddressBookIcon,{}),isCollapsed:a,label:"Address Book",to:"/address-book"}),jsxRuntimeExports.jsx(MenuItem,{icon:jsxRuntimeExports.jsx(GearIcon,{}),isCollapsed:a,label:"Settings",to:"/settings"}),jsxRuntimeExports.jsx(MenuItem,{icon:jsxRuntimeExports.jsx(HelpIcon,{}),isCollapsed:a,label:"Help",to:"/help"}),jsxRuntimeExports.jsx(AppVersion,{marginTop:"24px",fontSize:"14px",textAlign:a?"center":"left",isCollapsed:a})]})]})]})},MenuItem=({icon:a,label:_,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:[a,!j&&jsxRuntimeExports.jsx(Text,{marginLeft:"10px",size:"sm",children:_})]})})},TotalBalance=()=>{const a=useTotalBalance(),[_]=useMediaQuery("(max-height: 900px)");return jsxRuntimeExports.jsxs(Box,{marginTop:"24px",marginBottom:_?"30px":"100px","data-testid":"total-balance",children:[jsxRuntimeExports.jsx(Text,{marginBottom:"4px",size:"sm",children:"Balance"}),a&&jsxRuntimeExports.jsx(TezRecapDisplay,{balance:a.mutez,dollarBalance:a.usd})]})},withSideMenu=a=>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:a})]}),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(a){(function(_,$){$(a,reactExports,propTypesExports)})(commonjsGlobal,function(_,$,j){Object.defineProperty(_,"__esModule",{value:!0}),_.setHasSupportToCaptureOption=yt;var et=rt($),tt=rt(j);function rt($t){return $t&&$t.__esModule?$t:{default:$t}}var nt=Object.assign||function($t){for(var Mt=1;Mt=0||Object.prototype.hasOwnProperty.call($t,Dt)&&(Lt[Dt]=$t[Dt]);return Lt}function st($t,Mt){if(!($t instanceof Mt))throw new TypeError("Cannot call a class as a function")}var ot=function(){function $t(Mt,Lt){for(var Dt=0;Dt0&&arguments[0]!==void 0?arguments[0]:{capture:!0};return ht?$t:$t.capture}function Ct($t){if("touches"in $t){var Mt=$t.touches[0],Lt=Mt.pageX,Dt=Mt.pageY;return{x:Lt,y:Dt}}var zt=$t.screenX,Ot=$t.screenY;return{x:zt,y:Ot}}var Pt=function($t){ut(Mt,$t);function Mt(){var Lt;st(this,Mt);for(var Dt=arguments.length,zt=Array(Dt),Ot=0;Otzt&&this.props.onSwipeRight(1,Dt),this.movePosition.deltaY<-zt?this.props.onSwipeUp(1,Dt):this.movePosition.deltaY>zt&&this.props.onSwipeDown(1,Dt)),this.moveStart=null,this.moving=!1,this.movePosition=null}},{key:"_setSwiperRef",value:function(Dt){this.swiper=Dt,this.props.innerRef(Dt)}},{key:"render",value:function(){var Dt=this.props;Dt.tagName;var zt=Dt.className,Ot=Dt.style,It=Dt.children;Dt.allowMouseEvents,Dt.onSwipeUp,Dt.onSwipeDown,Dt.onSwipeLeft,Dt.onSwipeRight,Dt.onSwipeStart,Dt.onSwipeMove,Dt.onSwipeEnd,Dt.innerRef,Dt.tolerance;var Bt=it(Dt,["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:Ot},Bt),It)}}]),Mt}($.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},_.default=Pt})}(reactSwipe)),reactSwipe}(function(a){(function(_,$){$(a,requireReactSwipe())})(commonjsGlobal,function(_,$){Object.defineProperty(_,"__esModule",{value:!0});var j=et($);function et(tt){return tt&&tt.__esModule?tt:{default:tt}}_.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(a){(function(){var _={}.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(a){return _getPrototypeOf$1=Object.setPrototypeOf?Object.getPrototypeOf:function($){return $.__proto__||Object.getPrototypeOf($)},_getPrototypeOf$1(a)}function _defineProperty$2(a,_,$){return _ in a?Object.defineProperty(a,_,{value:$,enumerable:!0,configurable:!0,writable:!0}):a[_]=$,a}var isKeyboardEvent$1=function a(_){return _.hasOwnProperty("key")},Thumbs=function(a){_inherits$1($,a);var _=_createSuper$1($);function $(j){var et;return _classCallCheck$1(this,$),et=_.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),st=it0&&(rt=0),st===at&&rt<0&&(rt=0);var ut=et.itemsWrapperRef.clientWidth,ht=st+100/(ut/rt);return et.itemsListRef&&["WebkitTransform","MozTransform","MsTransform","OTransform","transform","msTransform"].forEach(function(yt){et.itemsListRef.style[yt]=(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?_.centerMode&&_.centerSlidePercentage&&_.axis==="horizontal"?j.itemListStyle=(0,_utils$1.setPosition)(-(rt+2)*_.centerSlidePercentage-(100-_.centerSlidePercentage)/2,_.axis):j.itemListStyle=(0,_utils$1.setPosition)(-(rt+2)*100,_.axis):tt>rt&&(j.itemListStyle=(0,_utils$1.setPosition)(0,_.axis)),j;var it=(0,_utils$1.getPosition)(et,_),st=(0,_CSSTranslate.default)(it,"%",_.axis),ot=_.transitionTime+"ms";return j.itemListStyle={WebkitTransform:st,msTransform:st,OTransform:st,transform:st},$.swiping||(j.itemListStyle=_objectSpread$1(_objectSpread$1({},j.itemListStyle),{},{WebkitTransitionDuration:ot,MozTransitionDuration:ot,OTransitionDuration:ot,transitionDuration:ot,msTransitionDuration:ot})),j};animations.slideAnimationHandler=slideAnimationHandler;var slideSwipeAnimationHandler=function a(_,$,j,et){var tt={},rt=$.axis==="horizontal",nt=_react$1.Children.count($.children),it=0,st=(0,_utils$1.getPosition)(j.selectedItem,$),ot=$.infiniteLoop?(0,_utils$1.getPosition)(nt-1,$)-100:(0,_utils$1.getPosition)(nt-1,$),at=rt?_.x:_.y,ut=at;st===it&&at>0&&(ut=0),st===ot&&at<0&&(ut=0);var ht=st+100/(j.itemSize/ut),yt=Math.abs(at)>$.swipeScrollTolerance;return $.infiniteLoop&&yt&&(j.selectedItem===0&&ht>-100?ht-=nt*100:j.selectedItem===nt-1&&ht<-nt*100&&(ht+=nt*100)),(!$.preventMovementUntilSwipeScrollTolerance||yt||j.swipeMovementStarted)&&(j.swipeMovementStarted||et({swipeMovementStarted:!0}),tt.itemListStyle=(0,_utils$1.setPosition)(ht,$.axis)),yt&&!j.cancelClick&&et({cancelClick:!0}),tt};animations.slideSwipeAnimationHandler=slideSwipeAnimationHandler;var slideStopSwipingHandler=function a(_,$){var j=(0,_utils$1.getPosition)($.selectedItem,_),et=(0,_utils$1.setPosition)(j,_.axis);return{itemListStyle:et}};animations.slideStopSwipingHandler=slideStopSwipingHandler;var fadeAnimationHandler=function a(_,$){var j=_.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(a){return a&&a.__esModule?a:{default:a}}function _getRequireWildcardCache(){if(typeof WeakMap!="function")return null;var a=new WeakMap;return _getRequireWildcardCache=function(){return a},a}function _interopRequireWildcard(a){if(a&&a.__esModule)return a;if(a===null||_typeof(a)!=="object"&&typeof a!="function")return{default:a};var _=_getRequireWildcardCache();if(_&&_.has(a))return _.get(a);var $={},j=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var et in a)if(Object.prototype.hasOwnProperty.call(a,et)){var tt=j?Object.getOwnPropertyDescriptor(a,et):null;tt&&(tt.get||tt.set)?Object.defineProperty($,et,tt):$[et]=a[et]}return $.default=a,_&&_.set(a,$),$}function _typeof(a){"@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(a)}function _extends(){return _extends=Object.assign||function(a){for(var _=1;_"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(a){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function($){return $.__proto__||Object.getPrototypeOf($)},_getPrototypeOf(a)}function _defineProperty(a,_,$){return _ in a?Object.defineProperty(a,_,{value:$,enumerable:!0,configurable:!0,writable:!0}):a[_]=$,a}var Carousel=function(a){_inherits($,a);var _=_createSuper($);function $(j){var et;_classCallCheck(this,$),et=_.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",st={ArrowUp:38,ArrowRight:39,ArrowDown:40,ArrowLeft:37},ot=it?st.ArrowRight:st.ArrowDown,at=it?st.ArrowLeft:st.ArrowUp;ot===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 st=it[0];if(!st.complete){var ot=function ht(){et.forceUpdate(),st.removeEventListener("load",ht)};st.addEventListener("load",ot)}}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,st=nt===tt.state.previousItem,ot=it&&tt.state.selectedStyle||st&&tt.state.prevStyle||tt.state.slideStyle||{};tt.props.centerMode&&tt.props.axis==="horizontal"&&(ot=_objectSpread(_objectSpread({},ot),{},{minWidth:tt.props.centerSlidePercentage+"%"})),tt.state.swiping&&tt.state.swipeMovementStarted&&(ot=_objectSpread(_objectSpread({},ot),{},{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:ot};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,st=tt.children;return rt?_react.default.createElement("ul",{className:"control-dots"},_react.Children.map(st,function(ot,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,st=nt&&(this.state.selectedItem<_react.Children.count(this.props.children)-1||this.props.infiniteLoop)||!1,ot=this.renderItems(!0),at=ot.shift(),ut=ot.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},yt={};if(rt){if(ht.onSwipeLeft=this.onSwipeForward,ht.onSwipeRight=this.onSwipeBackwards,this.props.dynamicHeight){var wt=this.getVariableItemHeight(this.state.selectedItem);yt.height=wt||"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}),yt.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:yt},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,st,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 a(){},onSwipeEnd:function a(){},onSwipeMove:function a(){return!1},preventMovementUntilSwipeScrollTolerance:!1,renderArrowPrev:function a(_,$,j){return _react.default.createElement("button",{type:"button","aria-label":j,className:_cssClasses.default.ARROW_PREV(!$),onClick:_})},renderArrowNext:function a(_,$,j){return _react.default.createElement("button",{type:"button","aria-label":j,className:_cssClasses.default.ARROW_NEXT(!$),onClick:_})},renderIndicator:function a(_,$,j,et){return _react.default.createElement("li",{className:_cssClasses.default.DOT($),onClick:_,onKeyDown:_,value:j,key:j,role:"button",tabIndex:0,"aria-label":"".concat(et," ").concat(j+1)})},renderItem:function a(_){return _},renderThumbs:function a(_){var $=_react.Children.map(_,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(a){Object.defineProperty(a,"__esModule",{value:!0}),Object.defineProperty(a,"Carousel",{enumerable:!0,get:function(){return _.default}}),Object.defineProperty(a,"CarouselProps",{enumerable:!0,get:function(){return $.CarouselProps}}),Object.defineProperty(a,"Thumbs",{enumerable:!0,get:function(){return j.default}});var _=et(Carousel$1),$=types,j=et(Thumbs$1);function et(tt){return tt&&tt.__esModule?tt:{default:tt}}})(js);const Slider=({children:a})=>{const _={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:{..._,background:"#00C39A",width:"24px"}}):jsxRuntimeExports.jsx("li",{onClick:$,onKeyDown:$,role:"button",style:_,tabIndex:0,value:et},et),showArrows:!1,showStatus:!1,showThumbs:!1,transitionTime:1e3,children:a})})},SlideItem=({item:a})=>jsxRuntimeExports.jsx(Box,{height:"730px",paddingTop:"500px",paddingBottom:"35px",backgroundImage:a.image,backgroundSize:"cover",backgroundRepeat:"no-repeat","data-testid":`slide-${a.id}`,children:jsxRuntimeExports.jsxs(Center,{flexDirection:"column",paddingBottom:"50px",children:[jsxRuntimeExports.jsx(CircleIcon,{icon:a.icon,size:"58px"}),jsxRuntimeExports.jsx(Text,{width:"400px",margin:"16px 50px 0 50px",children:a.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",stroke:colors.gray[450],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(()=>_(!0)),et=()=>{_(!1),$()};return jsxRuntimeExports.jsxs(Center,{height:"100vh",padding:"60px",backgroundImage:BackgroundImage,backgroundSize:"cover",children:[a&&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 a=useDynamicModal();return jsxRuntimeExports.jsx(HashRouter,{children:jsxRuntimeExports.jsx(DynamicModalContext.Provider,{value:a,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:"/*"})]}),a.content]})})})},LoggedOutRouter=()=>{const a=useResetConnections();return reactExports.useEffect(()=>{WalletClient.destroy().then(a).catch(lodashExports.noop)},[a]),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(a),stacktrace:String(_.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/assets/index-aPKr3KfN.js b/assets/index-aPKr3KfN.js new file mode 100644 index 0000000000..8eeca69243 --- /dev/null +++ b/assets/index-aPKr3KfN.js @@ -0,0 +1,593 @@ +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={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * 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(1>>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;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * 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=` +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=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(Global,{styles:vhPolyfill}),CSSReset=({scope:_=""})=>jsxRuntimeExports.jsx(Global,{styles:css$1` + html { + line-height: 1.5; + -webkit-text-size-adjust: 100%; + font-family: system-ui, sans-serif; + -webkit-font-smoothing: antialiased; + text-rendering: optimizeLegibility; + -moz-osx-font-smoothing: grayscale; + touch-action: manipulation; + } + + body { + position: relative; + min-height: 100%; + margin: 0; + font-feature-settings: "kern"; + } + + ${_} :where(*, *::before, *::after) { + border-width: 0; + border-style: solid; + box-sizing: border-box; + word-wrap: break-word; + } + + main { + display: block; + } + + ${_} hr { + border-top-width: 1px; + box-sizing: content-box; + height: 0; + overflow: visible; + } + + ${_} :where(pre, code, kbd,samp) { + font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace; + font-size: 1em; + } + + ${_} a { + background-color: transparent; + color: inherit; + text-decoration: inherit; + } + + ${_} abbr[title] { + border-bottom: none; + text-decoration: underline; + -webkit-text-decoration: underline dotted; + text-decoration: underline dotted; + } + + ${_} :where(b, strong) { + font-weight: bold; + } + + ${_} small { + font-size: 80%; + } + + ${_} :where(sub,sup) { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; + } + + ${_} sub { + bottom: -0.25em; + } + + ${_} sup { + top: -0.5em; + } + + ${_} img { + border-style: none; + } + + ${_} :where(button, input, optgroup, select, textarea) { + font-family: inherit; + font-size: 100%; + line-height: 1.15; + margin: 0; + } + + ${_} :where(button, input) { + overflow: visible; + } + + ${_} :where(button, select) { + text-transform: none; + } + + ${_} :where( + button::-moz-focus-inner, + [type="button"]::-moz-focus-inner, + [type="reset"]::-moz-focus-inner, + [type="submit"]::-moz-focus-inner + ) { + border-style: none; + padding: 0; + } + + ${_} fieldset { + padding: 0.35em 0.75em 0.625em; + } + + ${_} legend { + box-sizing: border-box; + color: inherit; + display: table; + max-width: 100%; + padding: 0; + white-space: normal; + } + + ${_} progress { + vertical-align: baseline; + } + + ${_} textarea { + overflow: auto; + } + + ${_} :where([type="checkbox"], [type="radio"]) { + box-sizing: border-box; + padding: 0; + } + + ${_} input[type="number"]::-webkit-inner-spin-button, + ${_} input[type="number"]::-webkit-outer-spin-button { + -webkit-appearance: none !important; + } + + ${_} input[type="number"] { + -moz-appearance: textfield; + } + + ${_} input[type="search"] { + -webkit-appearance: textfield; + outline-offset: -2px; + } + + ${_} input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none !important; + } + + ${_} ::-webkit-file-upload-button { + -webkit-appearance: button; + font: inherit; + } + + ${_} details { + display: block; + } + + ${_} summary { + display: list-item; + } + + template { + display: none; + } + + [hidden] { + display: none !important; + } + + ${_} :where( + blockquote, + dl, + dd, + h1, + h2, + h3, + h4, + h5, + h6, + hr, + figure, + p, + pre + ) { + margin: 0; + } + + ${_} button { + background: transparent; + padding: 0; + } + + ${_} fieldset { + margin: 0; + padding: 0; + } + + ${_} :where(ol, ul) { + margin: 0; + padding: 0; + } + + ${_} textarea { + resize: vertical; + } + + ${_} :where(button, [role="button"]) { + cursor: pointer; + } + + ${_} button::-moz-focus-inner { + border: 0 !important; + } + + ${_} table { + border-collapse: collapse; + } + + ${_} :where(h1, h2, h3, h4, h5, h6) { + font-size: inherit; + font-weight: inherit; + } + + ${_} :where(button, input, optgroup, select, textarea) { + padding: 0; + line-height: inherit; + color: inherit; + } + + ${_} :where(img, svg, video, canvas, audio, iframe, embed, object) { + display: block; + } + + ${_} :where(img, video) { + max-width: 100%; + height: auto; + } + + [data-js-focus-visible] + :focus:not([data-focus-visible-added]):not( + [data-focus-visible-disabled] + ) { + outline: none; + box-shadow: none; + } + + ${_} select::-ms-expand { + display: none; + } + + ${vhPolyfill} + `});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 ot;const st=reactExports.useContext(nt);if(!st&&$){const at=new Error(tt??getErrorMessage(j,et));throw at.name="ContextError",(ot=Error.captureStackTrace)==null||ot.call(Error,at,it),at}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,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){}})(); + `,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( + 45deg, + ${a} 25%, + transparent 25%, + transparent 50%, + ${a} 50%, + ${a} 75%, + transparent 75%, + transparent + )`,backgroundSize:`${_} ${_}`}}var randomHex=()=>`#${Math.floor(Math.random()*16777215).toString(16).padEnd(6,"0")}`;function randomColor(_){const a=randomHex();return!_||isEmptyObject$1(_)?a:_.string&&_.colors?randomColorFromList(_.string,_.colors):_.string&&!_.colors?randomColorFromString(_.string):_.colors&&!_.string?randomFromList(_.colors):a}function randomColorFromString(_){let a=0;if(_.length===0)return a.toString();for(let j=0;j<_.length;j+=1)a=_.charCodeAt(j)+((a<<5)-a),a=a&a;let $="#";for(let j=0;j<3;j+=1){const et=a>>j*8&255;$+=`00${et.toString(16)}`.substr(-2)}return $}function randomColorFromList(_,a){let $=0;if(_.length===0)return a[0];for(let j=0;j<_.length;j+=1)$=_.charCodeAt(j)+(($<<5)-$),$=$&$;return $=($%a.length+a.length)%a.length,a[$]}function randomFromList(_){return _[Math.floor(Math.random()*_.length)]}function mode(_,a){return $=>$.colorMode==="dark"?a:_}function orient(_){const{orientation:a,vertical:$,horizontal:j}=_;return a?a==="vertical"?$:j:{}}function toRef(_){return isObject$5(_)&&_.reference?_.reference:String(_)}var toExpr=(_,...a)=>a.map(toRef).join(` ${_} `).replace(/calc/g,""),add=(..._)=>`calc(${toExpr("+",..._)})`,subtract=(..._)=>`calc(${toExpr("-",..._)})`,multiply=(..._)=>`calc(${toExpr("*",..._)})`,divide=(..._)=>`calc(${toExpr("/",..._)})`,negate=_=>{const a=toRef(_);return a!=null&&!Number.isNaN(parseFloat(a))?String(a).startsWith("-")?String(a).slice(1):`-${a}`:multiply(a,-1)},calc=Object.assign(_=>({add:(...a)=>calc(add(_,...a)),subtract:(...a)=>calc(subtract(_,...a)),multiply:(...a)=>calc(multiply(_,...a)),divide:(...a)=>calc(divide(_,...a)),negate:()=>calc(negate(_)),toString:()=>_.toString()}),{add,subtract,multiply,divide,negate});function isDecimal$1(_){return!Number.isInteger(parseFloat(_.toString()))}function replaceWhiteSpace(_,a="-"){return _.replace(/\s+/g,a)}function escape$1(_){const a=replaceWhiteSpace(_.toString());return a.includes("\\.")?_:isDecimal$1(_)?a.replace(".","\\."):_}function addPrefix(_,a=""){return[a,escape$1(_)].filter(Boolean).join("-")}function toVarRef(_,a){return`var(${escape$1(_)}${a?`, ${a}`:""})`}function toVar$1(_,a=""){return`--${addPrefix(_,a)}`}function cssVar(_,a){const $=toVar$1(_,void 0);return{variable:$,reference:toVarRef($,getFallback(void 0))}}function getFallback(_){return typeof _=="string"?_:_==null?void 0:_.reference}var{defineMultiStyleConfig:defineMultiStyleConfig$v,definePartsStyle:definePartsStyle$v}=createMultiStyleConfigHelpers(switchAnatomy.keys),$width=cssVar("switch-track-width"),$height$1=cssVar("switch-track-height"),$diff=cssVar("switch-track-diff"),diffValue=calc.subtract($width,$height$1),$translateX=cssVar("switch-thumb-x"),$bg$f=cssVar("switch-bg"),baseStyleTrack$2=_=>{const{colorScheme:a}=_;return{borderRadius:"full",p:"0.5",width:[$width.reference],height:[$height$1.reference],transitionProperty:"common",transitionDuration:"fast",[$bg$f.variable]:"colors.gray.300",_dark:{[$bg$f.variable]:"colors.whiteAlpha.400"},_focusVisible:{boxShadow:"outline"},_disabled:{opacity:.4,cursor:"not-allowed"},_checked:{[$bg$f.variable]:`colors.${a}.500`,_dark:{[$bg$f.variable]:`colors.${a}.200`}},bg:$bg$f.reference}},baseStyleThumb$1={bg:"white",transitionProperty:"transform",transitionDuration:"normal",borderRadius:"inherit",width:[$height$1.reference],height:[$height$1.reference],_checked:{transform:`translateX(${$translateX.reference})`}},baseStyle$I=definePartsStyle$v(_=>({container:{[$diff.variable]:diffValue,[$translateX.variable]:$diff.reference,_rtl:{[$translateX.variable]:calc($diff).negate().toString()}},track:baseStyleTrack$2(_),thumb:baseStyleThumb$1})),sizes$n={sm:definePartsStyle$v({container:{[$width.variable]:"1.375rem",[$height$1.variable]:"sizes.3"}}),md:definePartsStyle$v({container:{[$width.variable]:"1.875rem",[$height$1.variable]:"sizes.4"}}),lg:definePartsStyle$v({container:{[$width.variable]:"2.875rem",[$height$1.variable]:"sizes.6"}})},switchTheme$1=defineMultiStyleConfig$v({baseStyle:baseStyle$I,sizes:sizes$n,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:defineMultiStyleConfig$u,definePartsStyle:definePartsStyle$u}=createMultiStyleConfigHelpers(tableAnatomy.keys),baseStyle$H=definePartsStyle$u({table:{fontVariantNumeric:"lining-nums tabular-nums",borderCollapse:"collapse",width:"full"},th:{fontFamily:"heading",fontWeight:"bold",textTransform:"uppercase",letterSpacing:"wider",textAlign:"start"},td:{textAlign:"start"},caption:{mt:4,fontFamily:"heading",textAlign:"center",fontWeight:"medium"}}),numericStyles={"&[data-is-numeric=true]":{textAlign:"end"}},variantSimple=definePartsStyle$u(_=>{const{colorScheme:a}=_;return{th:{color:mode("gray.600","gray.400")(_),borderBottom:"1px",borderColor:mode(`${a}.100`,`${a}.700`)(_),...numericStyles},td:{borderBottom:"1px",borderColor:mode(`${a}.100`,`${a}.700`)(_),...numericStyles},caption:{color:mode("gray.600","gray.100")(_)},tfoot:{tr:{"&:last-of-type":{th:{borderBottomWidth:0}}}}}}),variantStripe=definePartsStyle$u(_=>{const{colorScheme:a}=_;return{th:{color:mode("gray.600","gray.400")(_),borderBottom:"1px",borderColor:mode(`${a}.100`,`${a}.700`)(_),...numericStyles},td:{borderBottom:"1px",borderColor:mode(`${a}.100`,`${a}.700`)(_),...numericStyles},caption:{color:mode("gray.600","gray.100")(_)},tbody:{tr:{"&:nth-of-type(odd)":{"th, td":{borderBottomWidth:"1px",borderColor:mode(`${a}.100`,`${a}.700`)(_)},td:{background:mode(`${a}.100`,`${a}.700`)(_)}}}},tfoot:{tr:{"&:last-of-type":{th:{borderBottomWidth:0}}}}}}),variants$g={simple:variantSimple,striped:variantStripe,unstyled:{}},sizes$m={sm:definePartsStyle$u({th:{px:"4",py:"1",lineHeight:"4",fontSize:"xs"},td:{px:"4",py:"2",fontSize:"sm",lineHeight:"4"},caption:{px:"4",py:"2",fontSize:"xs"}}),md:definePartsStyle$u({th:{px:"6",py:"3",lineHeight:"4",fontSize:"xs"},td:{px:"6",py:"4",lineHeight:"5"},caption:{px:"6",py:"2",fontSize:"sm"}}),lg:definePartsStyle$u({th:{px:"8",py:"4",lineHeight:"5",fontSize:"sm"},td:{px:"8",py:"5",lineHeight:"6"},caption:{px:"6",py:"2",fontSize:"md"}})},tableTheme=defineMultiStyleConfig$u({baseStyle:baseStyle$H,variants:variants$g,sizes:sizes$m,defaultProps:{variant:"simple",size:"md",colorScheme:"gray"}}),$fg$5=cssVar$1("tabs-color"),$bg$e=cssVar$1("tabs-bg"),$border$3=cssVar$1("tabs-border-color"),{defineMultiStyleConfig:defineMultiStyleConfig$t,definePartsStyle:definePartsStyle$t}=createMultiStyleConfigHelpers(tabsAnatomy.keys),baseStyleRoot$1=_=>{const{orientation:a}=_;return{display:a==="vertical"?"flex":"block"}},baseStyleTab=_=>{const{isFitted:a}=_;return{flex:a?1:void 0,transitionProperty:"common",transitionDuration:"normal",_focusVisible:{zIndex:1,boxShadow:"outline"},_disabled:{cursor:"not-allowed",opacity:.4}}},baseStyleTablist=_=>{const{align:a="start",orientation:$}=_;return{justifyContent:{end:"flex-end",center:"center",start:"flex-start"}[a],flexDirection:$==="vertical"?"column":"row"}},baseStyleTabpanel={p:4},baseStyle$G=definePartsStyle$t(_=>({root:baseStyleRoot$1(_),tab:baseStyleTab(_),tablist:baseStyleTablist(_),tabpanel:baseStyleTabpanel})),sizes$l={sm:definePartsStyle$t({tab:{py:1,px:4,fontSize:"sm"}}),md:definePartsStyle$t({tab:{fontSize:"md",py:2,px:4}}),lg:definePartsStyle$t({tab:{fontSize:"lg",py:3,px:4}})},variantLine=definePartsStyle$t(_=>{const{colorScheme:a,orientation:$}=_,j=$==="vertical",et=j?"borderStart":"borderBottom",tt=j?"marginStart":"marginBottom";return{tablist:{[et]:"2px solid",borderColor:"inherit"},tab:{[et]:"2px solid",borderColor:"transparent",[tt]:"-2px",_selected:{[$fg$5.variable]:`colors.${a}.600`,_dark:{[$fg$5.variable]:`colors.${a}.300`},borderColor:"currentColor"},_active:{[$bg$e.variable]:"colors.gray.200",_dark:{[$bg$e.variable]:"colors.whiteAlpha.300"}},_disabled:{_active:{bg:"none"}},color:$fg$5.reference,bg:$bg$e.reference}}}),variantEnclosed=definePartsStyle$t(_=>{const{colorScheme:a}=_;return{tab:{borderTopRadius:"md",border:"1px solid",borderColor:"transparent",mb:"-1px",[$border$3.variable]:"transparent",_selected:{[$fg$5.variable]:`colors.${a}.600`,[$border$3.variable]:"colors.white",_dark:{[$fg$5.variable]:`colors.${a}.300`,[$border$3.variable]:"colors.gray.800"},borderColor:"inherit",borderBottomColor:$border$3.reference},color:$fg$5.reference},tablist:{mb:"-1px",borderBottom:"1px solid",borderColor:"inherit"}}}),variantEnclosedColored=definePartsStyle$t(_=>{const{colorScheme:a}=_;return{tab:{border:"1px solid",borderColor:"inherit",[$bg$e.variable]:"colors.gray.50",_dark:{[$bg$e.variable]:"colors.whiteAlpha.50"},mb:"-1px",_notLast:{marginEnd:"-1px"},_selected:{[$bg$e.variable]:"colors.white",[$fg$5.variable]:`colors.${a}.600`,_dark:{[$bg$e.variable]:"colors.gray.800",[$fg$5.variable]:`colors.${a}.300`},borderColor:"inherit",borderTopColor:"currentColor",borderBottomColor:"transparent"},color:$fg$5.reference,bg:$bg$e.reference},tablist:{mb:"-1px",borderBottom:"1px solid",borderColor:"inherit"}}}),variantSoftRounded=definePartsStyle$t(_=>{const{colorScheme:a,theme:$}=_;return{tab:{borderRadius:"full",fontWeight:"semibold",color:"gray.600",_selected:{color:getColor($,`${a}.700`),bg:getColor($,`${a}.100`)}}}}),variantSolidRounded=definePartsStyle$t(_=>{const{colorScheme:a}=_;return{tab:{borderRadius:"full",fontWeight:"semibold",[$fg$5.variable]:"colors.gray.600",_dark:{[$fg$5.variable]:"inherit"},_selected:{[$fg$5.variable]:"colors.white",[$bg$e.variable]:`colors.${a}.600`,_dark:{[$fg$5.variable]:"colors.gray.800",[$bg$e.variable]:`colors.${a}.300`}},color:$fg$5.reference,bg:$bg$e.reference}}}),variantUnstyled$2=definePartsStyle$t({}),variants$f={line:variantLine,enclosed:variantEnclosed,"enclosed-colored":variantEnclosedColored,"soft-rounded":variantSoftRounded,"solid-rounded":variantSolidRounded,unstyled:variantUnstyled$2},tabsTheme$1=defineMultiStyleConfig$t({baseStyle:baseStyle$G,sizes:sizes$l,variants:variants$f,defaultProps:{size:"md",variant:"line",colorScheme:"blue"}}),vars=defineCssVars("badge",["bg","color","shadow"]),baseStyle$F={px:1,textTransform:"uppercase",fontSize:"xs",borderRadius:"sm",fontWeight:"bold",bg:vars.bg.reference,color:vars.color.reference,boxShadow:vars.shadow.reference},variantSolid$3=_=>{const{colorScheme:a,theme:$}=_,j=transparentize(`${a}.500`,.6)($);return{[vars.bg.variable]:`colors.${a}.500`,[vars.color.variable]:"colors.white",_dark:{[vars.bg.variable]:j,[vars.color.variable]:"colors.whiteAlpha.800"}}},variantSubtle$1=_=>{const{colorScheme:a,theme:$}=_,j=transparentize(`${a}.200`,.16)($);return{[vars.bg.variable]:`colors.${a}.100`,[vars.color.variable]:`colors.${a}.800`,_dark:{[vars.bg.variable]:j,[vars.color.variable]:`colors.${a}.200`}}},variantOutline$2=_=>{const{colorScheme:a,theme:$}=_,j=transparentize(`${a}.200`,.8)($);return{[vars.color.variable]:`colors.${a}.500`,_dark:{[vars.color.variable]:j},[vars.shadow.variable]:`inset 0 0 0px 1px ${vars.color.reference}`}},variants$e={solid:variantSolid$3,subtle:variantSubtle$1,outline:variantOutline$2},badgeTheme={baseStyle:baseStyle$F,variants:variants$e,defaultProps:{variant:"subtle",colorScheme:"gray"}},{defineMultiStyleConfig:defineMultiStyleConfig$s,definePartsStyle:definePartsStyle$s}=createMultiStyleConfigHelpers(tagAnatomy.keys),$bg$d=cssVar$1("tag-bg"),$color=cssVar$1("tag-color"),$shadow$3=cssVar$1("tag-shadow"),$minH=cssVar$1("tag-min-height"),$minW=cssVar$1("tag-min-width"),$fontSize$1=cssVar$1("tag-font-size"),$paddingX=cssVar$1("tag-padding-inline"),baseStyleContainer$4={fontWeight:"medium",lineHeight:1.2,outline:0,[$color.variable]:vars.color.reference,[$bg$d.variable]:vars.bg.reference,[$shadow$3.variable]:vars.shadow.reference,color:$color.reference,bg:$bg$d.reference,boxShadow:$shadow$3.reference,borderRadius:"md",minH:$minH.reference,minW:$minW.reference,fontSize:$fontSize$1.reference,px:$paddingX.reference,_focusVisible:{[$shadow$3.variable]:"shadows.outline"}},baseStyleLabel$4={lineHeight:1.2,overflow:"visible"},baseStyleCloseButton$3={fontSize:"lg",w:"5",h:"5",transitionProperty:"common",transitionDuration:"normal",borderRadius:"full",marginStart:"1.5",marginEnd:"-1",opacity:.5,_disabled:{opacity:.4},_focusVisible:{boxShadow:"outline",bg:"rgba(0, 0, 0, 0.14)"},_hover:{opacity:.8},_active:{opacity:1}},baseStyle$E=definePartsStyle$s({container:baseStyleContainer$4,label:baseStyleLabel$4,closeButton:baseStyleCloseButton$3}),sizes$k={sm:definePartsStyle$s({container:{[$minH.variable]:"sizes.5",[$minW.variable]:"sizes.5",[$fontSize$1.variable]:"fontSizes.xs",[$paddingX.variable]:"space.2"},closeButton:{marginEnd:"-2px",marginStart:"0.35rem"}}),md:definePartsStyle$s({container:{[$minH.variable]:"sizes.6",[$minW.variable]:"sizes.6",[$fontSize$1.variable]:"fontSizes.sm",[$paddingX.variable]:"space.2"}}),lg:definePartsStyle$s({container:{[$minH.variable]:"sizes.8",[$minW.variable]:"sizes.8",[$fontSize$1.variable]:"fontSizes.md",[$paddingX.variable]:"space.3"}})},variants$d={subtle:definePartsStyle$s(_=>{var a;return{container:(a=badgeTheme.variants)==null?void 0:a.subtle(_)}}),solid:definePartsStyle$s(_=>{var a;return{container:(a=badgeTheme.variants)==null?void 0:a.solid(_)}}),outline:definePartsStyle$s(_=>{var a;return{container:(a=badgeTheme.variants)==null?void 0:a.outline(_)}})},tagTheme=defineMultiStyleConfig$s({variants:variants$d,baseStyle:baseStyle$E,sizes:sizes$k,defaultProps:{size:"md",variant:"subtle",colorScheme:"gray"}}),{definePartsStyle:definePartsStyle$r,defineMultiStyleConfig:defineMultiStyleConfig$r}=createMultiStyleConfigHelpers(inputAnatomy.keys),$height=cssVar$1("input-height"),$fontSize=cssVar$1("input-font-size"),$padding$1=cssVar$1("input-padding"),$borderRadius=cssVar$1("input-border-radius"),baseStyle$D=definePartsStyle$r({addon:{height:$height.reference,fontSize:$fontSize.reference,px:$padding$1.reference,borderRadius:$borderRadius.reference},field:{width:"100%",height:$height.reference,fontSize:$fontSize.reference,px:$padding$1.reference,borderRadius:$borderRadius.reference,minWidth:0,outline:0,position:"relative",appearance:"none",transitionProperty:"common",transitionDuration:"normal",_disabled:{opacity:.4,cursor:"not-allowed"}}}),size={lg:{[$fontSize.variable]:"fontSizes.lg",[$padding$1.variable]:"space.4",[$borderRadius.variable]:"radii.md",[$height.variable]:"sizes.12"},md:{[$fontSize.variable]:"fontSizes.md",[$padding$1.variable]:"space.4",[$borderRadius.variable]:"radii.md",[$height.variable]:"sizes.10"},sm:{[$fontSize.variable]:"fontSizes.sm",[$padding$1.variable]:"space.3",[$borderRadius.variable]:"radii.sm",[$height.variable]:"sizes.8"},xs:{[$fontSize.variable]:"fontSizes.xs",[$padding$1.variable]:"space.2",[$borderRadius.variable]:"radii.sm",[$height.variable]:"sizes.6"}},sizes$j={lg:definePartsStyle$r({field:size.lg,group:size.lg}),md:definePartsStyle$r({field:size.md,group:size.md}),sm:definePartsStyle$r({field:size.sm,group:size.sm}),xs:definePartsStyle$r({field:size.xs,group:size.xs})};function getDefaults(_){const{focusBorderColor:a,errorBorderColor:$}=_;return{focusBorderColor:a||mode("blue.500","blue.300")(_),errorBorderColor:$||mode("red.500","red.300")(_)}}var variantOutline$1=definePartsStyle$r(_=>{const{theme:a}=_,{focusBorderColor:$,errorBorderColor:j}=getDefaults(_);return{field:{border:"1px solid",borderColor:"inherit",bg:"inherit",_hover:{borderColor:mode("gray.300","whiteAlpha.400")(_)},_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:getColor(a,j),boxShadow:`0 0 0 1px ${getColor(a,j)}`},_focusVisible:{zIndex:1,borderColor:getColor(a,$),boxShadow:`0 0 0 1px ${getColor(a,$)}`}},addon:{border:"1px solid",borderColor:mode("inherit","whiteAlpha.50")(_),bg:mode("gray.100","whiteAlpha.300")(_)}}}),variantFilled=definePartsStyle$r(_=>{const{theme:a}=_,{focusBorderColor:$,errorBorderColor:j}=getDefaults(_);return{field:{border:"2px solid",borderColor:"transparent",bg:mode("gray.100","whiteAlpha.50")(_),_hover:{bg:mode("gray.200","whiteAlpha.100")(_)},_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:getColor(a,j)},_focusVisible:{bg:"transparent",borderColor:getColor(a,$)}},addon:{border:"2px solid",borderColor:"transparent",bg:mode("gray.100","whiteAlpha.50")(_)}}}),variantFlushed=definePartsStyle$r(_=>{const{theme:a}=_,{focusBorderColor:$,errorBorderColor:j}=getDefaults(_);return{field:{borderBottom:"1px solid",borderColor:"inherit",borderRadius:"0",px:"0",bg:"transparent",_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:getColor(a,j),boxShadow:`0px 1px 0px 0px ${getColor(a,j)}`},_focusVisible:{borderColor:getColor(a,$),boxShadow:`0px 1px 0px 0px ${getColor(a,$)}`}},addon:{borderBottom:"2px solid",borderColor:"inherit",borderRadius:"0",px:"0",bg:"transparent"}}}),variantUnstyled$1=definePartsStyle$r({field:{bg:"transparent",px:"0",height:"auto"},addon:{bg:"transparent",px:"0",height:"auto"}}),variants$c={outline:variantOutline$1,filled:variantFilled,flushed:variantFlushed,unstyled:variantUnstyled$1},inputTheme=defineMultiStyleConfig$r({baseStyle:baseStyle$D,sizes:sizes$j,variants:variants$c,defaultProps:{size:"md",variant:"outline"}}),_a$7,baseStyle$C={...(_a$7=inputTheme.baseStyle)==null?void 0:_a$7.field,paddingY:"2",minHeight:"20",lineHeight:"short",verticalAlign:"top"},_a2$2,_b$2,variants$b={outline:_=>{var a,$;return($=(a=inputTheme.variants)==null?void 0:a.outline(_).field)!=null?$:{}},flushed:_=>{var a,$;return($=(a=inputTheme.variants)==null?void 0:a.flushed(_).field)!=null?$:{}},filled:_=>{var a,$;return($=(a=inputTheme.variants)==null?void 0:a.filled(_).field)!=null?$:{}},unstyled:(_b$2=(_a2$2=inputTheme.variants)==null?void 0:_a2$2.unstyled.field)!=null?_b$2:{}},_a3,_b2,_c$1,_d$1,_e$1,_f$1,_g$1,_h$1,sizes$i={xs:(_b2=(_a3=inputTheme.sizes)==null?void 0:_a3.xs.field)!=null?_b2:{},sm:(_d$1=(_c$1=inputTheme.sizes)==null?void 0:_c$1.sm.field)!=null?_d$1:{},md:(_f$1=(_e$1=inputTheme.sizes)==null?void 0:_e$1.md.field)!=null?_f$1:{},lg:(_h$1=(_g$1=inputTheme.sizes)==null?void 0:_g$1.lg.field)!=null?_h$1:{}},textareaTheme={baseStyle:baseStyle$C,sizes:sizes$i,variants:variants$b,defaultProps:{size:"md",variant:"outline"}},$bg$c=cssVar("tooltip-bg"),$fg$4=cssVar("tooltip-fg"),$arrowBg$1=cssVar("popper-arrow-bg"),baseStyle$B={bg:$bg$c.reference,color:$fg$4.reference,[$bg$c.variable]:"colors.gray.700",[$fg$4.variable]:"colors.whiteAlpha.900",_dark:{[$bg$c.variable]:"colors.gray.300",[$fg$4.variable]:"colors.gray.900"},[$arrowBg$1.variable]:$bg$c.reference,px:"2",py:"0.5",borderRadius:"sm",fontWeight:"medium",fontSize:"sm",boxShadow:"md",maxW:"xs",zIndex:"tooltip"},tooltipTheme={baseStyle:baseStyle$B},{defineMultiStyleConfig:defineMultiStyleConfig$q,definePartsStyle:definePartsStyle$q}=createMultiStyleConfigHelpers(progressAnatomy.keys),filledStyle=_=>{const{colorScheme:a,theme:$,isIndeterminate:j,hasStripe:et}=_,tt=mode(generateStripe(),generateStripe("1rem","rgba(0,0,0,0.1)"))(_),rt=mode(`${a}.500`,`${a}.200`)(_),nt=`linear-gradient( + to right, + 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(` + [data-motion-pop-id="${$}"] { + position: absolute !important; + width: ${rt}px !important; + height: ${nt}px !important; + top: ${it}px !important; + left: ${ot}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"),` + .`.concat(noScrollbarsClassName$1,` { + overflow: hidden `).concat(j,`; + padding-right: `).concat(nt,"px ").concat(j,`; + } + body { + overflow: hidden `).concat(j,`; + overscroll-behavior: contain; + `).concat([a&&"position: relative ".concat(j,";"),$==="margin"&&` + padding-left: `.concat(et,`px; + padding-top: `).concat(tt,`px; + padding-right: `).concat(rt,`px; + margin-left:0; + margin-top:0; + margin-right: `).concat(nt,"px ").concat(j,`; + `),$==="padding"&&"padding-right: ".concat(nt,"px ").concat(j,";")].filter(Boolean).join(""),` + } + + .`).concat(zeroRightClassName$1,` { + right: `).concat(nt,"px ").concat(j,`; + } + + .`).concat(fullWidthClassName$1,` { + margin-right: `).concat(nt,"px ").concat(j,`; + } + + .`).concat(zeroRightClassName$1," .").concat(zeroRightClassName$1,` { + right: 0 `).concat(j,`; + } + + .`).concat(fullWidthClassName$1," .").concat(fullWidthClassName$1,` { + margin-right: 0 `).concat(j,`; + } + + 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` + .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:{}};/** + * @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+`; +__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) { +`+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")+`) { +`+(jn?"":`obj || (obj = {}); +`)+"var __t, __p = ''"+(Mr?", __e = _.escape":"")+(Br?`, __j = Array.prototype.join; +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 + 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};/*! + * 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};/*! + * 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;Jt-1&&(Kt?Ht=Ht.split(` +`).map(function(Qt){return" "+Qt}).join(` +`).slice(2):Ht=` +`+Ht.split(` +`).map(function(Qt){return" "+Qt}).join(` +`))):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) { + 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 : +`+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 : +`+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=` +`+_+" = ";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={};/** + * @license React + * use-sync-external-store-with-selector.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * 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: +`+$.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]});/** + * @remix-run/router v1.16.1 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * 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);/** + * React Router v6.23.1 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * 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)}),$}/** + * React Router DOM v6.23.1 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * 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"),` + .`.concat(noScrollbarsClassName,` { + overflow: hidden `).concat(j,`; + padding-right: `).concat(nt,"px ").concat(j,`; + } + body[`).concat(lockAttribute,`] { + overflow: hidden `).concat(j,`; + overscroll-behavior: contain; + `).concat([a&&"position: relative ".concat(j,";"),$==="margin"&&` + padding-left: `.concat(et,`px; + padding-top: `).concat(tt,`px; + padding-right: `).concat(rt,`px; + margin-left:0; + margin-top:0; + margin-right: `).concat(nt,"px ").concat(j,`; + `),$==="padding"&&"padding-right: ".concat(nt,"px ").concat(j,";")].filter(Boolean).join(""),` + } + + .`).concat(zeroRightClassName,` { + right: `).concat(nt,"px ").concat(j,`; + } + + .`).concat(fullWidthClassName,` { + margin-right: `).concat(nt,"px ").concat(j,`; + } + + .`).concat(zeroRightClassName," .").concat(zeroRightClassName,` { + right: 0 `).concat(j,`; + } + + .`).concat(fullWidthClassName," .").concat(fullWidthClassName,` { + margin-right: 0 `).concat(j,`; + } + + 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` + .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;/*! + * 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($))}}/*! + * 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=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. + 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: + + 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: + + 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=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=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:` + "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:{}};/*! + 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}; diff --git a/index.html b/index.html index 0e27a5729f..8674038043 100644 --- a/index.html +++ b/index.html @@ -20,7 +20,7 @@ --> Umami - +