@cetusprotocol/terminal 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cetus-swap.umd.js
CHANGED
|
@@ -106,7 +106,7 @@ body { background-color: var(--color-page-background); }
|
|
|
106
106
|
`)},sS=function(){var e=parseInt(document.body.getAttribute(Xa)||"0",10);return isFinite(e)?e:0},jq=function(){P.useEffect(function(){return document.body.setAttribute(Xa,(sS()+1).toString()),function(){var e=sS()-1;e<=0?document.body.removeAttribute(Xa):document.body.setAttribute(Xa,e.toString())}},[])},kq=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,i=n===void 0?"margin":n;jq();var s=P.useMemo(function(){return Iq(i)},[i]);return P.createElement(Mq,{styles:Oq(s,!t,i,r?"":"!important")})},Lm=!1;if(typeof window<"u")try{var ed=Object.defineProperty({},"passive",{get:function(){return Lm=!0,!0}});window.addEventListener("test",ed,ed),window.removeEventListener("test",ed,ed)}catch{Lm=!1}var Ja=Lm?{passive:!1}:!1,Pq=function(e){return e.tagName==="TEXTAREA"},oS=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!Pq(e)&&r[t]==="visible")},Rq=function(e){return oS(e,"overflowY")},Nq=function(e){return oS(e,"overflowX")},aS=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var i=cS(e,n);if(i){var s=uS(e,n),o=s[1],a=s[2];if(o>a)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},Dq=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},$q=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},cS=function(e,t){return e==="v"?Rq(t):Nq(t)},uS=function(e,t){return e==="v"?Dq(t):$q(t)},Lq=function(e,t){return e==="h"&&t==="rtl"?-1:1},Bq=function(e,t,r,n,i){var s=Lq(e,window.getComputedStyle(t).direction),o=s*n,a=r.target,c=t.contains(a),u=!1,l=o>0,f=0,p=0;do{var v=uS(e,a),w=v[0],y=v[1],S=v[2],A=y-S-s*w;(w||A)&&cS(e,a)&&(f+=A,p+=w),a instanceof ShadowRoot?a=a.host:a=a.parentNode}while(!c&&a!==document.body||c&&(t.contains(a)||t===a));return(l&&(i&&Math.abs(f)<1||!i&&o>f)||!l&&(i&&Math.abs(p)<1||!i&&-o>p))&&(u=!0),u},td=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},lS=function(e){return[e.deltaX,e.deltaY]},fS=function(e){return e&&"current"in e?e.current:e},Uq=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Fq=function(e){return`
|
|
107
107
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
108
108
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
109
|
-
`)},Vq=0,Za=[];function zq(e){var t=P.useRef([]),r=P.useRef([0,0]),n=P.useRef(),i=P.useState(Vq++)[0],s=P.useState(iS)[0],o=P.useRef(e);P.useEffect(function(){o.current=e},[e]),P.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var y=lq([e.lockRef.current],(e.shards||[]).map(fS),!0).filter(Boolean);return y.forEach(function(S){return S.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),y.forEach(function(S){return S.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=P.useCallback(function(y,S){if("touches"in y&&y.touches.length===2||y.type==="wheel"&&y.ctrlKey)return!o.current.allowPinchZoom;var A=td(y),O=r.current,j="deltaX"in y?y.deltaX:O[0]-A[0],V="deltaY"in y?y.deltaY:O[1]-A[1],B,H=y.target,q=Math.abs(j)>Math.abs(V)?"h":"v";if("touches"in y&&q==="h"&&H.type==="range")return!1;var ne=aS(q,H);if(!ne)return!0;if(ne?B=q:(B=q==="v"?"h":"v",ne=aS(q,H)),!ne)return!1;if(!n.current&&"changedTouches"in y&&(j||V)&&(n.current=B),!B)return!0;var ge=n.current||B;return Bq(ge,S,y,ge==="h"?j:V,!0)},[]),c=P.useCallback(function(y){var S=y;if(!(!Za.length||Za[Za.length-1]!==s)){var A="deltaY"in S?lS(S):td(S),O=t.current.filter(function(B){return B.name===S.type&&(B.target===S.target||S.target===B.shadowParent)&&Uq(B.delta,A)})[0];if(O&&O.should){S.cancelable&&S.preventDefault();return}if(!O){var j=(o.current.shards||[]).map(fS).filter(Boolean).filter(function(B){return B.contains(S.target)}),V=j.length>0?a(S,j[0]):!o.current.noIsolation;V&&S.cancelable&&S.preventDefault()}}},[]),u=P.useCallback(function(y,S,A,O){var j={name:y,delta:S,target:A,should:O,shadowParent:qq(A)};t.current.push(j),setTimeout(function(){t.current=t.current.filter(function(V){return V!==j})},1)},[]),l=P.useCallback(function(y){r.current=td(y),n.current=void 0},[]),f=P.useCallback(function(y){u(y.type,lS(y),y.target,a(y,e.lockRef.current))},[]),p=P.useCallback(function(y){u(y.type,td(y),y.target,a(y,e.lockRef.current))},[]);P.useEffect(function(){return Za.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",c,Ja),document.addEventListener("touchmove",c,Ja),document.addEventListener("touchstart",l,Ja),function(){Za=Za.filter(function(y){return y!==s}),document.removeEventListener("wheel",c,Ja),document.removeEventListener("touchmove",c,Ja),document.removeEventListener("touchstart",l,Ja)}},[]);var v=e.removeScrollBar,w=e.inert;return P.createElement(P.Fragment,null,w?P.createElement(s,{styles:Fq(i)}):null,v?P.createElement(kq,{gapMode:e.gapMode}):null)}function qq(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Wq=bq(rS,zq);var dS=P.forwardRef(function(e,t){return P.createElement(Qf,Fi({},e,{ref:t,sideCar:Wq}))});dS.classNames=Qf.classNames;const Gq=dS;function Hq(e,t){return P.useReducer((r,n)=>t[r][n]??r,e)}var Bm="ScrollArea",[hS,Ote]=bs(Bm),[Kq,Nn]=hS(Bm),pS=P.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:i,scrollHideDelay:s=600,...o}=e,[a,c]=P.useState(null),[u,l]=P.useState(null),[f,p]=P.useState(null),[v,w]=P.useState(null),[y,S]=P.useState(null),[A,O]=P.useState(0),[j,V]=P.useState(0),[B,H]=P.useState(!1),[q,ne]=P.useState(!1),ge=Jt(t,fe=>c(fe)),se=Tm(i);return _.jsx(Kq,{scope:r,type:n,dir:se,scrollHideDelay:s,scrollArea:a,viewport:u,onViewportChange:l,content:f,onContentChange:p,scrollbarX:v,onScrollbarXChange:w,scrollbarXEnabled:B,onScrollbarXEnabledChange:H,scrollbarY:y,onScrollbarYChange:S,scrollbarYEnabled:q,onScrollbarYEnabledChange:ne,onCornerWidthChange:O,onCornerHeightChange:V,children:_.jsx(Zt.div,{dir:se,...o,ref:ge,style:{position:"relative","--radix-scroll-area-corner-width":A+"px","--radix-scroll-area-corner-height":j+"px",...e.style}})})});pS.displayName=Bm;var mS="ScrollAreaViewport",gS=P.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:i,...s}=e,o=Nn(mS,r),a=P.useRef(null),c=Jt(t,a,o.onViewportChange);return _.jsxs(_.Fragment,{children:[_.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),_.jsx(Zt.div,{"data-radix-scroll-area-viewport":"",...s,ref:c,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...e.style},children:_.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});gS.displayName=mS;var Vi="ScrollAreaScrollbar",yS=P.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=Nn(Vi,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:o}=i,a=e.orientation==="horizontal";return P.useEffect(()=>(a?s(!0):o(!0),()=>{a?s(!1):o(!1)}),[a,s,o]),i.type==="hover"?_.jsx(Yq,{...n,ref:t,forceMount:r}):i.type==="scroll"?_.jsx(Xq,{...n,ref:t,forceMount:r}):i.type==="auto"?_.jsx(vS,{...n,ref:t,forceMount:r}):i.type==="always"?_.jsx(Um,{...n,ref:t}):null});yS.displayName=Vi;var Yq=P.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=Nn(Vi,e.__scopeScrollArea),[s,o]=P.useState(!1);return P.useEffect(()=>{const a=i.scrollArea;let c=0;if(a){const u=()=>{window.clearTimeout(c),o(!0)},l=()=>{c=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return a.addEventListener("pointerenter",u),a.addEventListener("pointerleave",l),()=>{window.clearTimeout(c),a.removeEventListener("pointerenter",u),a.removeEventListener("pointerleave",l)}}},[i.scrollArea,i.scrollHideDelay]),_.jsx(oi,{present:r||s,children:_.jsx(vS,{"data-state":s?"visible":"hidden",...n,ref:t})})}),Xq=P.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=Nn(Vi,e.__scopeScrollArea),s=e.orientation==="horizontal",o=sd(()=>c("SCROLL_END"),100),[a,c]=Hq("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return P.useEffect(()=>{if(a==="idle"){const u=window.setTimeout(()=>c("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(u)}},[a,i.scrollHideDelay,c]),P.useEffect(()=>{const u=i.viewport,l=s?"scrollLeft":"scrollTop";if(u){let f=u[l];const p=()=>{const v=u[l];f!==v&&(c("SCROLL"),o()),f=v};return u.addEventListener("scroll",p),()=>u.removeEventListener("scroll",p)}},[i.viewport,s,c,o]),_.jsx(oi,{present:r||a!=="hidden",children:_.jsx(Um,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:wt(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:wt(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),vS=P.forwardRef((e,t)=>{const r=Nn(Vi,e.__scopeScrollArea),{forceMount:n,...i}=e,[s,o]=P.useState(!1),a=e.orientation==="horizontal",c=sd(()=>{if(r.viewport){const u=r.viewport.offsetWidth<r.viewport.scrollWidth,l=r.viewport.offsetHeight<r.viewport.scrollHeight;o(a?u:l)}},10);return Qa(r.viewport,c),Qa(r.content,c),_.jsx(oi,{present:n||s,children:_.jsx(Um,{"data-state":s?"visible":"hidden",...i,ref:t})})}),Um=P.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,i=Nn(Vi,e.__scopeScrollArea),s=P.useRef(null),o=P.useRef(0),[a,c]=P.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=SS(a.viewport,a.content),l={...n,sizes:a,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:p=>s.current=p,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:p=>o.current=p};function f(p,v){return rW(p,o.current,a,v)}return r==="horizontal"?_.jsx(Jq,{...l,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const p=i.viewport.scrollLeft,v=ES(p,a,i.dir);s.current.style.transform=`translate3d(${v}px, 0, 0)`}},onWheelScroll:p=>{i.viewport&&(i.viewport.scrollLeft=p)},onDragScroll:p=>{i.viewport&&(i.viewport.scrollLeft=f(p,i.dir))}}):r==="vertical"?_.jsx(Zq,{...l,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const p=i.viewport.scrollTop,v=ES(p,a);s.current.style.transform=`translate3d(0, ${v}px, 0)`}},onWheelScroll:p=>{i.viewport&&(i.viewport.scrollTop=p)},onDragScroll:p=>{i.viewport&&(i.viewport.scrollTop=f(p))}}):null}),Jq=P.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,s=Nn(Vi,e.__scopeScrollArea),[o,a]=P.useState(),c=P.useRef(null),u=Jt(t,c,s.onScrollbarXChange);return P.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),_.jsx(wS,{"data-orientation":"horizontal",...i,ref:u,sizes:r,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":id(r)+"px",...e.style},onThumbPointerDown:l=>e.onThumbPointerDown(l.x),onDragScroll:l=>e.onDragScroll(l.x),onWheelScroll:(l,f)=>{if(s.viewport){const p=s.viewport.scrollLeft+l.deltaX;e.onWheelScroll(p),CS(p,f)&&l.preventDefault()}},onResize:()=>{c.current&&s.viewport&&o&&n({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:nd(o.paddingLeft),paddingEnd:nd(o.paddingRight)}})}})}),Zq=P.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,s=Nn(Vi,e.__scopeScrollArea),[o,a]=P.useState(),c=P.useRef(null),u=Jt(t,c,s.onScrollbarYChange);return P.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),_.jsx(wS,{"data-orientation":"vertical",...i,ref:u,sizes:r,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":id(r)+"px",...e.style},onThumbPointerDown:l=>e.onThumbPointerDown(l.y),onDragScroll:l=>e.onDragScroll(l.y),onWheelScroll:(l,f)=>{if(s.viewport){const p=s.viewport.scrollTop+l.deltaY;e.onWheelScroll(p),CS(p,f)&&l.preventDefault()}},onResize:()=>{c.current&&s.viewport&&o&&n({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:nd(o.paddingTop),paddingEnd:nd(o.paddingBottom)}})}})}),[Qq,bS]=hS(Vi),wS=P.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:i,onThumbChange:s,onThumbPointerUp:o,onThumbPointerDown:a,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:l,onResize:f,...p}=e,v=Nn(Vi,r),[w,y]=P.useState(null),S=Jt(t,ge=>y(ge)),A=P.useRef(null),O=P.useRef(""),j=v.viewport,V=n.content-n.viewport,B=Fr(l),H=Fr(c),q=sd(f,10);function ne(ge){if(A.current){const se=ge.clientX-A.current.left,fe=ge.clientY-A.current.top;u({x:se,y:fe})}}return P.useEffect(()=>{const ge=se=>{const fe=se.target;(w==null?void 0:w.contains(fe))&&B(se,V)};return document.addEventListener("wheel",ge,{passive:!1}),()=>document.removeEventListener("wheel",ge,{passive:!1})},[j,w,V,B]),P.useEffect(H,[n,H]),Qa(w,q),Qa(v.content,q),_.jsx(Qq,{scope:r,scrollbar:w,hasThumb:i,onThumbChange:Fr(s),onThumbPointerUp:Fr(o),onThumbPositionChange:H,onThumbPointerDown:Fr(a),children:_.jsx(Zt.div,{...p,ref:S,style:{position:"absolute",...p.style},onPointerDown:wt(e.onPointerDown,ge=>{ge.button===0&&(ge.target.setPointerCapture(ge.pointerId),A.current=w.getBoundingClientRect(),O.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",v.viewport&&(v.viewport.style.scrollBehavior="auto"),ne(ge))}),onPointerMove:wt(e.onPointerMove,ne),onPointerUp:wt(e.onPointerUp,ge=>{const se=ge.target;se.hasPointerCapture(ge.pointerId)&&se.releasePointerCapture(ge.pointerId),document.body.style.webkitUserSelect=O.current,v.viewport&&(v.viewport.style.scrollBehavior=""),A.current=null})})})}),rd="ScrollAreaThumb",_S=P.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=bS(rd,e.__scopeScrollArea);return _.jsx(oi,{present:r||i.hasThumb,children:_.jsx(eW,{ref:t,...n})})}),eW=P.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...i}=e,s=Nn(rd,r),o=bS(rd,r),{onThumbPositionChange:a}=o,c=Jt(t,f=>o.onThumbChange(f)),u=P.useRef(void 0),l=sd(()=>{u.current&&(u.current(),u.current=void 0)},100);return P.useEffect(()=>{const f=s.viewport;if(f){const p=()=>{if(l(),!u.current){const v=nW(f,a);u.current=v,a()}};return a(),f.addEventListener("scroll",p),()=>f.removeEventListener("scroll",p)}},[s.viewport,l,a]),_.jsx(Zt.div,{"data-state":o.hasThumb?"visible":"hidden",...i,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:wt(e.onPointerDownCapture,f=>{const v=f.target.getBoundingClientRect(),w=f.clientX-v.left,y=f.clientY-v.top;o.onThumbPointerDown({x:w,y})}),onPointerUp:wt(e.onPointerUp,o.onThumbPointerUp)})});_S.displayName=rd;var Fm="ScrollAreaCorner",xS=P.forwardRef((e,t)=>{const r=Nn(Fm,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?_.jsx(tW,{...e,ref:t}):null});xS.displayName=Fm;var tW=P.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,i=Nn(Fm,r),[s,o]=P.useState(0),[a,c]=P.useState(0),u=!!(s&&a);return Qa(i.scrollbarX,()=>{var f;const l=((f=i.scrollbarX)==null?void 0:f.offsetHeight)||0;i.onCornerHeightChange(l),c(l)}),Qa(i.scrollbarY,()=>{var f;const l=((f=i.scrollbarY)==null?void 0:f.offsetWidth)||0;i.onCornerWidthChange(l),o(l)}),u?_.jsx(Zt.div,{...n,ref:t,style:{width:s,height:a,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function nd(e){return e?parseInt(e,10):0}function SS(e,t){const r=e/t;return isNaN(r)?0:r}function id(e){const t=SS(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function rW(e,t,r,n="ltr"){const i=id(r),s=i/2,o=t||s,a=i-o,c=r.scrollbar.paddingStart+o,u=r.scrollbar.size-r.scrollbar.paddingEnd-a,l=r.content-r.viewport,f=n==="ltr"?[0,l]:[l*-1,0];return TS([c,u],f)(e)}function ES(e,t,r="ltr"){const n=id(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-i,o=t.content-t.viewport,a=s-n,c=r==="ltr"?[0,o]:[o*-1,0],u=Jz(e,c);return TS([0,o],[0,a])(u)}function TS(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function CS(e,t){return e>0&&e<t}var nW=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function i(){const s={left:e.scrollLeft,top:e.scrollTop},o=r.left!==s.left,a=r.top!==s.top;(o||a)&&t(),r=s,n=window.requestAnimationFrame(i)}(),()=>window.cancelAnimationFrame(n)};function sd(e,t){const r=Fr(e),n=P.useRef(0);return P.useEffect(()=>()=>window.clearTimeout(n.current),[]),P.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function Qa(e,t){const r=Fr(t);ws(()=>{let n=0;if(e){const i=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return i.observe(e),()=>{window.cancelAnimationFrame(n),i.unobserve(e)}}},[e,r])}var iW=pS,sW=gS,AS=yS,IS=_S,oW=xS,od="Switch",[aW,jte]=bs(od),[cW,uW]=aW(od),MS=P.forwardRef((e,t)=>{const{__scopeSwitch:r,name:n,checked:i,defaultChecked:s,required:o,disabled:a,value:c="on",onCheckedChange:u,form:l,...f}=e,[p,v]=P.useState(null),w=Jt(t,j=>v(j)),y=P.useRef(!1),S=p?l||!!p.closest("form"):!0,[A,O]=hu({prop:i,defaultProp:s??!1,onChange:u,caller:od});return _.jsxs(cW,{scope:r,checked:A,disabled:a,children:[_.jsx(Zt.button,{type:"button",role:"switch","aria-checked":A,"aria-required":o,"data-state":PS(A),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:w,onClick:wt(e.onClick,j=>{O(V=>!V),S&&(y.current=j.isPropagationStopped(),y.current||j.stopPropagation())})}),S&&_.jsx(kS,{control:p,bubbles:!y.current,name:n,value:c,checked:A,required:o,disabled:a,form:l,style:{transform:"translateX(-100%)"}})]})});MS.displayName=od;var OS="SwitchThumb",jS=P.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,i=uW(OS,r);return _.jsx(Zt.span,{"data-state":PS(i.checked),"data-disabled":i.disabled?"":void 0,...n,ref:t})});jS.displayName=OS;var lW="SwitchBubbleInput",kS=P.forwardRef(({__scopeSwitch:e,control:t,checked:r,bubbles:n=!0,...i},s)=>{const o=P.useRef(null),a=Jt(o,s),c=Ix(r),u=wm(t);return P.useEffect(()=>{const l=o.current;if(!l)return;const f=window.HTMLInputElement.prototype,v=Object.getOwnPropertyDescriptor(f,"checked").set;if(c!==r&&v){const w=new Event("click",{bubbles:n});v.call(l,r),l.dispatchEvent(w)}},[c,r,n]),_.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...i,tabIndex:-1,ref:a,style:{...i.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});kS.displayName=lW;function PS(e){return e?"checked":"unchecked"}var fW=MS,dW=jS;const vu={size:{type:"enum",values:["1","2","3"],default:"2",responsive:!0},variant:{type:"enum",values:["classic","surface","soft"],default:"surface"},color:pu,highContrast:qf,radius:Am},RS=P.forwardRef((e,t)=>{const{rest:r,...n}=mu(e),{className:i,style:s,size:o=vu.size.default,variant:a=vu.variant.default,color:c=vu.color.default,highContrast:u=vu.highContrast.default,radius:l=vu.radius.default,...f}=r;return P.createElement("span",{"data-radius":l,className:ur("rt-SwitchRoot",i,pn(o,"rt-r-size"),`rt-variant-${a}`,{"rt-high-contrast":u},gu(n)),style:s},P.createElement(fW,{"data-accent-color":c,...f,ref:t,className:ur("rt-reset","rt-SwitchButton",{"rt-high-contrast":u})},P.createElement(dW,{className:ur("rt-SwitchThumb",{"rt-high-contrast":u})})))});RS.displayName="Switch";var Vm=["Enter"," "],hW=["ArrowDown","PageUp","Home"],NS=["ArrowUp","PageDown","End"],pW=[...hW,...NS],mW={ltr:[...Vm,"ArrowRight"],rtl:[...Vm,"ArrowLeft"]},gW={ltr:["ArrowLeft"],rtl:["ArrowRight"]},bu="Menu",[wu,yW,vW]=Lx(bu),[Yo,DS]=bs(bu,[vW,Lf,Ux]),_u=Lf(),$S=Ux(),[LS,fo]=Yo(bu),[bW,xu]=Yo(bu),BS=e=>{const{__scopeMenu:t,open:r=!1,children:n,dir:i,onOpenChange:s,modal:o=!0}=e,a=_u(t),[c,u]=P.useState(null),l=P.useRef(!1),f=Fr(s),p=Tm(i);return P.useEffect(()=>{const v=()=>{l.current=!0,document.addEventListener("pointerdown",w,{capture:!0,once:!0}),document.addEventListener("pointermove",w,{capture:!0,once:!0})},w=()=>l.current=!1;return document.addEventListener("keydown",v,{capture:!0}),()=>{document.removeEventListener("keydown",v,{capture:!0}),document.removeEventListener("pointerdown",w,{capture:!0}),document.removeEventListener("pointermove",w,{capture:!0})}},[]),_.jsx(dx,{...a,children:_.jsx(LS,{scope:t,open:r,onOpenChange:f,content:c,onContentChange:u,children:_.jsx(bW,{scope:t,onClose:P.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:l,dir:p,modal:o,children:n})})})};BS.displayName=bu;var wW="MenuAnchor",zm=P.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=_u(r);return _.jsx(hx,{...i,...n,ref:t})});zm.displayName=wW;var qm="MenuPortal",[_W,US]=Yo(qm,{forceMount:void 0}),FS=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:i}=e,s=fo(qm,t);return _.jsx(_W,{scope:t,forceMount:r,children:_.jsx(oi,{present:r||s.open,children:_.jsx(gx,{asChild:!0,container:i,children:n})})})};FS.displayName=qm;var Dn="MenuContent",[xW,Wm]=Yo(Dn),VS=P.forwardRef((e,t)=>{const r=US(Dn,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,s=fo(Dn,e.__scopeMenu),o=xu(Dn,e.__scopeMenu);return _.jsx(wu.Provider,{scope:e.__scopeMenu,children:_.jsx(oi,{present:n||s.open,children:_.jsx(wu.Slot,{scope:e.__scopeMenu,children:o.modal?_.jsx(SW,{...i,ref:t}):_.jsx(EW,{...i,ref:t})})})})}),SW=P.forwardRef((e,t)=>{const r=fo(Dn,e.__scopeMenu),n=P.useRef(null),i=Jt(t,n);return P.useEffect(()=>{const s=n.current;if(s)return uq(s)},[]),_.jsx(Gm,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:wt(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),EW=P.forwardRef((e,t)=>{const r=fo(Dn,e.__scopeMenu);return _.jsx(Gm,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),TW=cu("MenuContent.ScrollLock"),Gm=P.forwardRef((e,t)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:l,onFocusOutside:f,onInteractOutside:p,onDismiss:v,disableOutsideScroll:w,...y}=e,S=fo(Dn,r),A=xu(Dn,r),O=_u(r),j=$S(r),V=yW(r),[B,H]=P.useState(null),q=P.useRef(null),ne=Jt(t,q,S.onContentChange),ge=P.useRef(0),se=P.useRef(""),fe=P.useRef(0),z=P.useRef(null),N=P.useRef("right"),h=P.useRef(0),d=w?Gq:P.Fragment,m=w?{as:TW,allowPinchZoom:!0}:void 0,x=C=>{var le,be;const k=se.current+C,M=V().filter(Ae=>!Ae.disabled),g=document.activeElement,b=(le=M.find(Ae=>Ae.ref.current===g))==null?void 0:le.textValue,R=M.map(Ae=>Ae.textValue),ue=$W(R,k,b),ie=(be=M.find(Ae=>Ae.textValue===ue))==null?void 0:be.ref.current;(function Ae(D){se.current=D,window.clearTimeout(ge.current),D!==""&&(ge.current=window.setTimeout(()=>Ae(""),1e3))})(k),ie&&setTimeout(()=>ie.focus())};P.useEffect(()=>()=>window.clearTimeout(ge.current),[]),Zz();const E=P.useCallback(C=>{var M,g;return N.current===((M=z.current)==null?void 0:M.side)&&BW(C,(g=z.current)==null?void 0:g.area)},[]);return _.jsx(xW,{scope:r,searchRef:se,onItemEnter:P.useCallback(C=>{E(C)&&C.preventDefault()},[E]),onItemLeave:P.useCallback(C=>{var k;E(C)||((k=q.current)==null||k.focus(),H(null))},[E]),onTriggerLeave:P.useCallback(C=>{E(C)&&C.preventDefault()},[E]),pointerGraceTimerRef:fe,onPointerGraceIntentChange:P.useCallback(C=>{z.current=C},[]),children:_.jsx(d,{...m,children:_.jsx(Hx,{asChild:!0,trapped:i,onMountAutoFocus:wt(s,C=>{var k;C.preventDefault(),(k=q.current)==null||k.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:_.jsx(am,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:l,onFocusOutside:f,onInteractOutside:p,onDismiss:v,children:_.jsx(Yz,{asChild:!0,...j,dir:A.dir,orientation:"vertical",loop:n,currentTabStopId:B,onCurrentTabStopIdChange:H,onEntryFocus:wt(c,C=>{A.isUsingKeyboardRef.current||C.preventDefault()}),preventScrollOnEntryFocus:!0,children:_.jsx(px,{role:"menu","aria-orientation":"vertical","data-state":o5(S.open),"data-radix-menu-content":"",dir:A.dir,...O,...y,ref:ne,style:{outline:"none",...y.style},onKeyDown:wt(y.onKeyDown,C=>{const M=C.target.closest("[data-radix-menu-content]")===C.currentTarget,g=C.ctrlKey||C.altKey||C.metaKey,b=C.key.length===1;M&&(C.key==="Tab"&&C.preventDefault(),!g&&b&&x(C.key));const R=q.current;if(C.target!==R||!pW.includes(C.key))return;C.preventDefault();const ie=V().filter(le=>!le.disabled).map(le=>le.ref.current);NS.includes(C.key)&&ie.reverse(),NW(ie)}),onBlur:wt(e.onBlur,C=>{C.currentTarget.contains(C.target)||(window.clearTimeout(ge.current),se.current="")}),onPointerMove:wt(e.onPointerMove,Eu(C=>{const k=C.target,M=h.current!==C.clientX;if(C.currentTarget.contains(k)&&M){const g=C.clientX>h.current?"right":"left";N.current=g,h.current=C.clientX}}))})})})})})})});VS.displayName=Dn;var CW="MenuGroup",Hm=P.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return _.jsx(Zt.div,{role:"group",...n,ref:t})});Hm.displayName=CW;var AW="MenuLabel",zS=P.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return _.jsx(Zt.div,{...n,ref:t})});zS.displayName=AW;var ad="MenuItem",qS="menu.itemSelect",cd=P.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...i}=e,s=P.useRef(null),o=xu(ad,e.__scopeMenu),a=Wm(ad,e.__scopeMenu),c=Jt(t,s),u=P.useRef(!1),l=()=>{const f=s.current;if(!r&&f){const p=new CustomEvent(qS,{bubbles:!0,cancelable:!0});f.addEventListener(qS,v=>n==null?void 0:n(v),{once:!0}),P_(f,p),p.defaultPrevented?u.current=!1:o.onClose()}};return _.jsx(WS,{...i,ref:c,disabled:r,onClick:wt(e.onClick,l),onPointerDown:f=>{var p;(p=e.onPointerDown)==null||p.call(e,f),u.current=!0},onPointerUp:wt(e.onPointerUp,f=>{var p;u.current||(p=f.currentTarget)==null||p.click()}),onKeyDown:wt(e.onKeyDown,f=>{const p=a.searchRef.current!=="";r||p&&f.key===" "||Vm.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});cd.displayName=ad;var WS=P.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:i,...s}=e,o=Wm(ad,r),a=$S(r),c=P.useRef(null),u=Jt(t,c),[l,f]=P.useState(!1),[p,v]=P.useState("");return P.useEffect(()=>{const w=c.current;w&&v((w.textContent??"").trim())},[s.children]),_.jsx(wu.ItemSlot,{scope:r,disabled:n,textValue:i??p,children:_.jsx(Xz,{asChild:!0,...a,focusable:!n,children:_.jsx(Zt.div,{role:"menuitem","data-highlighted":l?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...s,ref:u,onPointerMove:wt(e.onPointerMove,Eu(w=>{n?o.onItemLeave(w):(o.onItemEnter(w),w.defaultPrevented||w.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:wt(e.onPointerLeave,Eu(w=>o.onItemLeave(w))),onFocus:wt(e.onFocus,()=>f(!0)),onBlur:wt(e.onBlur,()=>f(!1))})})})}),IW="MenuCheckboxItem",GS=P.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:n,...i}=e;return _.jsx(JS,{scope:e.__scopeMenu,checked:r,children:_.jsx(cd,{role:"menuitemcheckbox","aria-checked":ud(r)?"mixed":r,...i,ref:t,"data-state":Xm(r),onSelect:wt(i.onSelect,()=>n==null?void 0:n(ud(r)?!0:!r),{checkForDefaultPrevented:!1})})})});GS.displayName=IW;var HS="MenuRadioGroup",[MW,OW]=Yo(HS,{value:void 0,onValueChange:()=>{}}),KS=P.forwardRef((e,t)=>{const{value:r,onValueChange:n,...i}=e,s=Fr(n);return _.jsx(MW,{scope:e.__scopeMenu,value:r,onValueChange:s,children:_.jsx(Hm,{...i,ref:t})})});KS.displayName=HS;var YS="MenuRadioItem",XS=P.forwardRef((e,t)=>{const{value:r,...n}=e,i=OW(YS,e.__scopeMenu),s=r===i.value;return _.jsx(JS,{scope:e.__scopeMenu,checked:s,children:_.jsx(cd,{role:"menuitemradio","aria-checked":s,...n,ref:t,"data-state":Xm(s),onSelect:wt(n.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,r)},{checkForDefaultPrevented:!1})})})});XS.displayName=YS;var Km="MenuItemIndicator",[JS,jW]=Yo(Km,{checked:!1}),ZS=P.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:n,...i}=e,s=jW(Km,r);return _.jsx(oi,{present:n||ud(s.checked)||s.checked===!0,children:_.jsx(Zt.span,{...i,ref:t,"data-state":Xm(s.checked)})})});ZS.displayName=Km;var kW="MenuSeparator",QS=P.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return _.jsx(Zt.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});QS.displayName=kW;var PW="MenuArrow",e5=P.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=_u(r);return _.jsx(mx,{...i,...n,ref:t})});e5.displayName=PW;var Ym="MenuSub",[RW,t5]=Yo(Ym),r5=e=>{const{__scopeMenu:t,children:r,open:n=!1,onOpenChange:i}=e,s=fo(Ym,t),o=_u(t),[a,c]=P.useState(null),[u,l]=P.useState(null),f=Fr(i);return P.useEffect(()=>(s.open===!1&&f(!1),()=>f(!1)),[s.open,f]),_.jsx(dx,{...o,children:_.jsx(LS,{scope:t,open:n,onOpenChange:f,content:u,onContentChange:l,children:_.jsx(RW,{scope:t,contentId:uu(),triggerId:uu(),trigger:a,onTriggerChange:c,children:r})})})};r5.displayName=Ym;var Su="MenuSubTrigger",n5=P.forwardRef((e,t)=>{const r=fo(Su,e.__scopeMenu),n=xu(Su,e.__scopeMenu),i=t5(Su,e.__scopeMenu),s=Wm(Su,e.__scopeMenu),o=P.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=s,u={__scopeMenu:e.__scopeMenu},l=P.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return P.useEffect(()=>l,[l]),P.useEffect(()=>{const f=a.current;return()=>{window.clearTimeout(f),c(null)}},[a,c]),_.jsx(zm,{asChild:!0,...u,children:_.jsx(WS,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":i.contentId,"data-state":o5(r.open),...e,ref:im(t,i.onTriggerChange),onClick:f=>{var p;(p=e.onClick)==null||p.call(e,f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:wt(e.onPointerMove,Eu(f=>{s.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!r.open&&!o.current&&(s.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{r.onOpenChange(!0),l()},100))})),onPointerLeave:wt(e.onPointerLeave,Eu(f=>{var v,w;l();const p=(v=r.content)==null?void 0:v.getBoundingClientRect();if(p){const y=(w=r.content)==null?void 0:w.dataset.side,S=y==="right",A=S?-5:5,O=p[S?"left":"right"],j=p[S?"right":"left"];s.onPointerGraceIntentChange({area:[{x:f.clientX+A,y:f.clientY},{x:O,y:p.top},{x:j,y:p.top},{x:j,y:p.bottom},{x:O,y:p.bottom}],side:y}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(f),f.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:wt(e.onKeyDown,f=>{var v;const p=s.searchRef.current!=="";e.disabled||p&&f.key===" "||mW[n.dir].includes(f.key)&&(r.onOpenChange(!0),(v=r.content)==null||v.focus(),f.preventDefault())})})})});n5.displayName=Su;var i5="MenuSubContent",s5=P.forwardRef((e,t)=>{const r=US(Dn,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,s=fo(Dn,e.__scopeMenu),o=xu(Dn,e.__scopeMenu),a=t5(i5,e.__scopeMenu),c=P.useRef(null),u=Jt(t,c);return _.jsx(wu.Provider,{scope:e.__scopeMenu,children:_.jsx(oi,{present:n||s.open,children:_.jsx(wu.Slot,{scope:e.__scopeMenu,children:_.jsx(Gm,{id:a.contentId,"aria-labelledby":a.triggerId,...i,ref:u,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:l=>{var f;o.isUsingKeyboardRef.current&&((f=c.current)==null||f.focus()),l.preventDefault()},onCloseAutoFocus:l=>l.preventDefault(),onFocusOutside:wt(e.onFocusOutside,l=>{l.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:wt(e.onEscapeKeyDown,l=>{o.onClose(),l.preventDefault()}),onKeyDown:wt(e.onKeyDown,l=>{var v;const f=l.currentTarget.contains(l.target),p=gW[o.dir].includes(l.key);f&&p&&(s.onOpenChange(!1),(v=a.trigger)==null||v.focus(),l.preventDefault())})})})})})});s5.displayName=i5;function o5(e){return e?"open":"closed"}function ud(e){return e==="indeterminate"}function Xm(e){return ud(e)?"indeterminate":e?"checked":"unchecked"}function NW(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function DW(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function $W(e,t,r){const i=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=r?e.indexOf(r):-1;let o=DW(e,Math.max(s,0));i.length===1&&(o=o.filter(u=>u!==r));const c=o.find(u=>u.toLowerCase().startsWith(i.toLowerCase()));return c!==r?c:void 0}function LW(e,t){const{x:r,y:n}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const a=t[s],c=t[o],u=a.x,l=a.y,f=c.x,p=c.y;l>n!=p>n&&r<(f-u)*(n-l)/(p-l)+u&&(i=!i)}return i}function BW(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return LW(r,t)}function Eu(e){return t=>t.pointerType==="mouse"?e(t):void 0}var UW=BS,FW=zm,VW=FS,zW=VS,qW=Hm,WW=zS,GW=cd,HW=GS,KW=KS,YW=XS,XW=ZS,JW=QS,ZW=e5,QW=r5,eG=n5,tG=s5,ld="DropdownMenu",[rG,Rte]=bs(ld,[DS]),Xr=DS(),[nG,a5]=rG(ld),c5=e=>{const{__scopeDropdownMenu:t,children:r,dir:n,open:i,defaultOpen:s,onOpenChange:o,modal:a=!0}=e,c=Xr(t),u=P.useRef(null),[l,f]=hu({prop:i,defaultProp:s??!1,onChange:o,caller:ld});return _.jsx(nG,{scope:t,triggerId:uu(),triggerRef:u,contentId:uu(),open:l,onOpenChange:f,onOpenToggle:P.useCallback(()=>f(p=>!p),[f]),modal:a,children:_.jsx(UW,{...c,open:l,onOpenChange:f,dir:n,modal:a,children:r})})};c5.displayName=ld;var u5="DropdownMenuTrigger",l5=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...i}=e,s=a5(u5,r),o=Xr(r);return _.jsx(FW,{asChild:!0,...o,children:_.jsx(Zt.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...i,ref:im(t,s.triggerRef),onPointerDown:wt(e.onPointerDown,a=>{!n&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:wt(e.onKeyDown,a=>{n||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});l5.displayName=u5;var iG="DropdownMenuPortal",f5=e=>{const{__scopeDropdownMenu:t,...r}=e,n=Xr(t);return _.jsx(VW,{...n,...r})};f5.displayName=iG;var d5="DropdownMenuContent",h5=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=a5(d5,r),s=Xr(r),o=P.useRef(!1);return _.jsx(zW,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...n,ref:t,onCloseAutoFocus:wt(e.onCloseAutoFocus,a=>{var c;o.current||(c=i.triggerRef.current)==null||c.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:wt(e.onInteractOutside,a=>{const c=a.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,l=c.button===2||u;(!i.modal||l)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});h5.displayName=d5;var sG="DropdownMenuGroup",p5=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Xr(r);return _.jsx(qW,{...i,...n,ref:t})});p5.displayName=sG;var oG="DropdownMenuLabel",m5=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Xr(r);return _.jsx(WW,{...i,...n,ref:t})});m5.displayName=oG;var aG="DropdownMenuItem",g5=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Xr(r);return _.jsx(GW,{...i,...n,ref:t})});g5.displayName=aG;var cG="DropdownMenuCheckboxItem",y5=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Xr(r);return _.jsx(HW,{...i,...n,ref:t})});y5.displayName=cG;var uG="DropdownMenuRadioGroup",v5=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Xr(r);return _.jsx(KW,{...i,...n,ref:t})});v5.displayName=uG;var lG="DropdownMenuRadioItem",b5=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Xr(r);return _.jsx(YW,{...i,...n,ref:t})});b5.displayName=lG;var fG="DropdownMenuItemIndicator",w5=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Xr(r);return _.jsx(XW,{...i,...n,ref:t})});w5.displayName=fG;var dG="DropdownMenuSeparator",_5=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Xr(r);return _.jsx(JW,{...i,...n,ref:t})});_5.displayName=dG;var hG="DropdownMenuArrow",pG=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Xr(r);return _.jsx(ZW,{...i,...n,ref:t})});pG.displayName=hG;var mG=e=>{const{__scopeDropdownMenu:t,children:r,open:n,onOpenChange:i,defaultOpen:s}=e,o=Xr(t),[a,c]=hu({prop:n,defaultProp:s??!1,onChange:i,caller:"DropdownMenuSub"});return _.jsx(QW,{...o,open:a,onOpenChange:c,children:r})},gG="DropdownMenuSubTrigger",x5=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Xr(r);return _.jsx(eG,{...i,...n,ref:t})});x5.displayName=gG;var yG="DropdownMenuSubContent",S5=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Xr(r);return _.jsx(tG,{...i,...n,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});S5.displayName=yG;var vG=c5,bG=l5,E5=f5,wG=h5,_G=p5,xG=m5,SG=g5,EG=y5,TG=v5,CG=b5,T5=w5,AG=_5,IG=mG,MG=x5,OG=S5;const Jm={size:{type:"enum",values:["1","2","3"],default:"1",responsive:!0},radius:Am,scrollbars:{type:"enum",values:["vertical","horizontal","both"],default:"both"}},Zm=P.forwardRef((e,t)=>{const{rest:r,...n}=mu(e),{className:i,style:s,type:o,scrollHideDelay:a=o!=="scroll"?0:void 0,dir:c,size:u=Jm.size.default,radius:l=Jm.radius.default,scrollbars:f=Jm.scrollbars.default,...p}=r;return P.createElement(iW,{type:o,scrollHideDelay:a,className:ur("rt-ScrollAreaRoot",i,gu(n)),style:s},P.createElement(sW,{...p,ref:t,className:"rt-ScrollAreaViewport"}),P.createElement("div",{className:"rt-ScrollAreaViewportFocusRing"}),f!=="vertical"?P.createElement(AS,{"data-radius":l,orientation:"horizontal",className:ur("rt-ScrollAreaScrollbar",pn(u,"rt-r-size"))},P.createElement(IS,{className:"rt-ScrollAreaThumb"})):null,f!=="horizontal"?P.createElement(AS,{"data-radius":l,orientation:"vertical",className:ur("rt-ScrollAreaScrollbar",pn(u,"rt-r-size"))},P.createElement(IS,{className:"rt-ScrollAreaThumb"})):null,f==="both"?P.createElement(oW,{className:"rt-ScrollAreaCorner"}):null)});Zm.displayName="ScrollArea";const Qm={size:{type:"enum",values:["1","2"],default:"2",responsive:!0},variant:{type:"enum",values:["solid","soft"],default:"solid"},color:pu,highContrast:qf},C5={color:pu,shortcut:{type:"string",default:void 0}},A5=e=>P.createElement(vG,{...e});A5.displayName="DropdownMenuRoot";const I5=P.forwardRef((e,t)=>P.createElement(bG,{...e,ref:t,asChild:!0}));I5.displayName="DropdownMenuTrigger";const M5=P.createContext({}),O5=P.forwardRef((e,t)=>{const r=jz(),{className:n,children:i,size:s=Qm.size.default,variant:o=Qm.variant.default,highContrast:a=Qm.highContrast.default,color:c=C5.color.default,container:u,forceMount:l,...f}=e,p=c??r.accentColor;return P.createElement(E5,{container:u,forceMount:l},P.createElement(zf,{asChild:!0},P.createElement(wG,{"data-accent-color":p,align:"start",sideOffset:4,collisionPadding:10,...f,ref:t,className:ur("rt-PopperContent","rt-BaseMenuContent","rt-DropdownMenuContent",n,pn(s,"rt-r-size"),`rt-variant-${o}`,{"rt-high-contrast":a})},P.createElement(Zm,{type:"auto"},P.createElement("div",{className:ur("rt-BaseMenuViewport","rt-DropdownMenuViewport")},P.createElement(M5.Provider,{value:P.useMemo(()=>({size:s,variant:o,color:p,highContrast:a}),[s,o,p,a])},i))))))});O5.displayName="DropdownMenuContent";const j5=P.forwardRef((e,t)=>P.createElement(xG,{...e,ref:t,className:ur("rt-BaseMenuLabel","rt-DropdownMenuLabel",e.className)}));j5.displayName="DropdownMenuLabel";const k5=P.forwardRef((e,t)=>{const{className:r,children:n,color:i=C5.color.default,shortcut:s,...o}=e;return P.createElement(SG,{"data-accent-color":i,...o,ref:t,className:ur("rt-reset","rt-BaseMenuItem","rt-DropdownMenuItem",r)},P.createElement(If,null,n),s&&P.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},s))});k5.displayName="DropdownMenuItem";const P5=P.forwardRef((e,t)=>P.createElement(_G,{...e,ref:t,className:ur("rt-BaseMenuGroup","rt-DropdownMenuGroup",e.className)}));P5.displayName="DropdownMenuGroup";const R5=P.forwardRef((e,t)=>P.createElement(TG,{...e,ref:t,className:ur("rt-BaseMenuRadioGroup","rt-DropdownMenuRadioGroup",e.className)}));R5.displayName="DropdownMenuRadioGroup";const N5=P.forwardRef((e,t)=>{const{children:r,className:n,...i}=e;return P.createElement(CG,{...i,ref:t,className:ur("rt-BaseMenuItem","rt-BaseMenuRadioItem","rt-DropdownMenuItem","rt-DropdownMenuRadioItem",n)},P.createElement(If,null,r),P.createElement(T5,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},P.createElement(Hf,{className:"rt-BaseMenuItemIndicatorIcon rt-DropdownMenuItemIndicatorIcon"})))});N5.displayName="DropdownMenuRadioItem";const D5=P.forwardRef((e,t)=>{const{children:r,className:n,shortcut:i,...s}=e;return P.createElement(EG,{...s,ref:t,className:ur("rt-BaseMenuItem","rt-BaseMenuCheckboxItem","rt-DropdownMenuItem","rt-DropdownMenuCheckboxItem",n)},P.createElement(If,null,r),P.createElement(T5,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},P.createElement(Hf,{className:"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon"})),i&&P.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},i))});D5.displayName="DropdownMenuCheckboxItem";const $5=e=>P.createElement(IG,{...e});$5.displayName="DropdownMenuSub";const L5=P.forwardRef((e,t)=>{const{className:r,children:n,...i}=e;return P.createElement(MG,{...i,ref:t,className:ur("rt-BaseMenuItem","rt-BaseMenuSubTrigger","rt-DropdownMenuItem","rt-DropdownMenuSubTrigger",r)},P.createElement(If,null,n),P.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},P.createElement($x,{className:"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon"})))});L5.displayName="DropdownMenuSubTrigger";const B5=P.forwardRef((e,t)=>{const{className:r,children:n,container:i,forceMount:s,...o}=e,{size:a,variant:c,color:u,highContrast:l}=P.useContext(M5);return P.createElement(E5,{container:i,forceMount:s},P.createElement(zf,{asChild:!0},P.createElement(OG,{"data-accent-color":u,alignOffset:-Number(a)*4,sideOffset:1,collisionPadding:10,...o,ref:t,className:ur("rt-PopperContent","rt-BaseMenuContent","rt-BaseMenuSubContent","rt-DropdownMenuContent","rt-DropdownMenuSubContent",r,pn(a,"rt-r-size"),`rt-variant-${c}`,{"rt-high-contrast":l})},P.createElement(Zm,{type:"auto"},P.createElement("div",{className:ur("rt-BaseMenuViewport","rt-DropdownMenuViewport")},n)))))});B5.displayName="DropdownMenuSubContent";const U5=P.forwardRef((e,t)=>P.createElement(AG,{...e,ref:t,className:ur("rt-BaseMenuSeparator","rt-DropdownMenuSeparator",e.className)}));U5.displayName="DropdownMenuSeparator";const Es=Object.assign({},{Root:A5,Trigger:I5,Content:O5,Label:j5,Item:k5,Group:P5,RadioGroup:R5,RadioItem:N5,CheckboxItem:D5,Sub:$5,SubTrigger:L5,SubContent:B5,Separator:U5}),Tu={size:{type:"enum",values:["1","2","3","4"],default:"2",responsive:!0},variant:{type:"enum",values:["classic","solid","soft","surface","outline","ghost"],default:"solid"},color:pu,highContrast:qf,radius:Am},F5=P.forwardRef((e,t)=>{const{rest:r,...n}=mu(e),{className:i,asChild:s=!1,size:o=Tu.size.default,variant:a=Tu.variant.default,color:c=Tu.color.default,highContrast:u=Tu.highContrast.default,radius:l=Tu.radius.default,...f}=r,p=s?sm:"button";return P.createElement(p,{"data-disabled":f.disabled||void 0,"data-accent-color":c,"data-radius":l,...f,ref:t,className:ur("rt-reset","rt-BaseButton",i,pn(o,"rt-r-size"),`rt-variant-${a}`,{"rt-high-contrast":u},gu(n))})});F5.displayName="BaseButton";const V5=P.forwardRef((e,t)=>P.createElement(F5,{...e,ref:t,className:ur("rt-Button",e.className)}));V5.displayName="Button";const jG={loading:{type:"boolean",default:!0}},Xo=P.forwardRef((e,t)=>{const{rest:r,...n}=mu(e),{className:i,children:s,loading:o=jG.loading.default,...a}=r;if(!o)return P.createElement(P.Fragment,null,s);const c=P.isValidElement(s)?sm:"span";return P.createElement(c,{ref:t,"aria-hidden":!0,className:ur("rt-Skeleton",i,gu(n)),"data-inline-skeleton":P.isValidElement(s)?void 0:!0,tabIndex:-1,inert:"",...a},s)});Xo.displayName="Skeleton";const Fte="";function eg(e){const{text:t,onClick:r,className:n,btnIsDisabled:i=!1}=e,s=()=>{r&&r()};return _.jsx(V5,{disabled:i,className:n?`cs-button ${n}`:"cs-button",onClick:s,children:t})}function Jo({content:e,children:t,position:r="top",marginTop:n="0px",borderRadius:i="8px",delay:s=0,backgroundColor:o="var(--cs-bg-primary)"}){const[a,c]=he.useState(!1),[u,l]=he.useState(!1),f=he.useRef(null),p=()=>{f.current&&(clearTimeout(f.current),f.current=null),c(!0)};he.useEffect(()=>()=>{a||f.current&&(clearTimeout(f.current),f.current=null)},[a]);const v=()=>{f.current=setTimeout(()=>{u||(c(!1),f.current&&(clearTimeout(f.current),f.current=null))},0)},w=()=>{switch(r){case"top":return{transform:"translateX(-50%)"};case"bottom":return{transform:"translateX(-50%)",marginTop:"0px"};case"left":return{transform:"translateY(-50%)",marginRight:"8px"};case"right":return{transform:"translateY(-50%)"};default:return{}}},y=he.useRef(null),[S,A]=he.useState({left:void 0,top:void 0});return he.useEffect(()=>{var O;if(a&&y.current){const j=(O=y.current)==null?void 0:O.getBoundingClientRect();let V,B;r==="top"?(V=`${window.scrollX+j.left+j.width/2}px`,B=`${window.scrollY+j.top-2*j.height-8}px`):r==="bottom"?(V=`${window.scrollX+j.left+j.width/2}px`,B=`${window.scrollY+j.bottom+4}px`):r==="left"?(V=`${window.scrollX+j.left-8}px`,B=`${window.scrollY+j.top+j.height/2}px`):r==="right"?(V=`${window.scrollX+j.right+8}px`,B=`${window.scrollY+j.top+j.height/2}px`):(V=`${window.scrollX+j.left+j.width/2}px`,B=`${window.scrollY+j.top+j.height/2}px`),A({left:V,top:B})}},[a]),_.jsxs("div",{ref:y,style:{position:"relative",display:"inline-block"},onMouseEnter:p,onMouseLeave:v,children:[t,a&&li.createPortal(_.jsx("div",{style:{transition:"opacity 0.3s ease",opacity:a?1:0,position:"absolute",zIndex:9e3,padding:"8px 12px",backgroundColor:o,color:"var(--cs-text-secondary)",borderRadius:i,fontSize:"12px",whiteSpace:"nowrap",border:"1px solid",borderColor:"var(--cs-border)",boxShadow:"0px 2px 10px rgba(0, 0, 0, 0.1)",...w(),...S,marginTop:n},onMouseEnter:()=>l(!0),onMouseLeave:()=>{f.current&&(clearTimeout(f.current),f.current=null),l(!1),c(!1)},children:e}),document.body)]})}const Vte="",tg=[{label:"Default"},{label:"Fast Mode",beforeIcon:{xlinkHref:"#icon-icon_flash",fontSize:"16px",activeColor:"var(--cs-primary)",activeHoverColor:"var(--cs-primary)"}}],kG=e=>{const{transactionMode:t,setTransactionMode:r,maxCapForGas:n,setMaxCapForGas:i,customGasPrice:s,setCustomGasPrice:o,suiBalance:a,themeType:c}=e,u=c=="Light"?Pt("/images/icon_shio_light@2x.png"):Pt("/images/icon_shio@2x.png"),l=he.useMemo(()=>{var O;return(O=tg.filter(j=>(j==null?void 0:j.label)===t))==null?void 0:O[0]},[t,tg]),f=O=>{const j=new RegExp("[^\\d-]*(\\d*(?:\\.\\d{0,9})?).*$");O.target.value=O.target.value.replace(j,"$1"),i(O.target.value)},p=O=>{const j=new RegExp("[^\\d-]*(\\d*(?:\\.\\d{0,9})?).*$");O.target.value=O.target.value.replace(j,"$1");const V=Fe(O.target.value).gt(0)?Fe(O.target.value).div(Math.pow(10,9)).toString():"0";Fe(V).gt(n)&&i(V),o(O.target.value)},v=he.useMemo(()=>!n||Number(n)==0?"Please enter a value higher than 0":n&&Number(n)>5?"Only allow up to 5 SUI":Fe(n).gt(a)?"Insufficient SUI balance ":Fe(n).lt(Fe(s).div(Math.pow(10,9)))?"Max cap cannot be less than custom gas.":"",[n]),w=he.useMemo(()=>n&&Number(n)>0&&Number(n)<2e-6?"Your current maximum fee is below the market rate. Please raise it to ensure your transactions are processed.":"",[n]),y=he.useMemo(()=>!s||Number(s)==0?"Please enter a value higher than 0":"",[s]),S=he.useMemo(()=>s&&Number(s)>0&&Fe(s).lt(750)?"Your current maximum fee is below the market rate. Please raise it to ensure your transactions are processed.":"",[s]),A=he.useMemo(()=>!s||s==="0"?"0":Fe(s).div(Math.pow(10,9)).toString(),[s]);return _.jsxs("div",{className:"transaction-mode-container",children:[_.jsxs("div",{className:"transaction-mode-header",children:[_.jsxs("div",{className:"transaction-mode-label",children:[_.jsx("svg",{children:_.jsx("use",{xlinkHref:"#icon-icon_mode"})}),_.jsx("span",{className:"caption-text",children:"Transaction Mode"})]}),_.jsx("div",{className:"slippage-tab-list",children:tg.map(O=>_.jsxs("div",{className:O.label===l.label?"active slippage-tab":"slippage-tab",children:[O.label!=="Default"&&_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-icon_flash"})}),_.jsx("span",{onClick:()=>{r(O.label)},children:O.label})]},O.label))})]}),_.jsx("p",{className:"transaction-description",children:t==="Default"?"Standard gas based on real-time network conditions":"Land your transaction earlier and avoid congestion with a higher gas price. MEV protection is on by default in Fast Mode."}),t==="Fast Mode"&&_.jsxs("div",{className:"fast-mode-section",children:[_.jsxs("div",{className:"input-card",children:[_.jsxs("div",{className:"input-label",children:[_.jsx("span",{children:"Custom Gas Price"}),_.jsx(Jo,{position:"bottom",content:_.jsx("div",{className:"tooltip-content",children:"The total gas depends on the gas price and actual gas units consumed."}),children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-tips"})})})]}),_.jsxs("div",{className:"input-right",children:[_.jsxs("div",{className:"input-field",children:[_.jsx("input",{value:s,onChange:p,placeholder:"0.0"}),_.jsx("span",{className:"caption-text",children:"MIST"})]}),_.jsxs("div",{className:"unit-text",children:[_.jsx("span",{children:A}),"SUI"]})]})]}),y&&_.jsx(fd,{text:y,type:"error"}),S&&_.jsx(fd,{text:S,type:"warn"}),_.jsxs("div",{className:"input-card",children:[_.jsxs("div",{className:"input-label",children:[_.jsx("span",{children:"Set Max Cap for Gas"}),_.jsx(Jo,{position:"bottom",content:_.jsx("div",{className:"tooltip-content",children:"Set a max cap for your gas to prevent overpaying"}),children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-tips"})})})]}),_.jsx("div",{className:"input-right",children:_.jsxs("div",{className:"input-field",children:[_.jsx("input",{value:n,onChange:f,placeholder:"0.0"}),_.jsx("span",{className:"caption-text",children:"SUI"})]})})]}),v&&_.jsx(fd,{text:v,type:"error"}),w&&_.jsx(fd,{text:w,type:"warn"}),_.jsxs("div",{className:"powered-by",children:[_.jsx("span",{children:"Powered by"}),_.jsx("img",{src:u,alt:"shio"})]})]})]})},fd=e=>{const{text:t,type:r}=e;return _.jsx("div",{style:{width:"100%",padding:"4px 16px",borderRadius:"8px",background:r==="warn"?"var(--cs-warning-10)":"var(--cs-error-10)",display:"flex",alignItems:"center",justifyContent:"center"},children:_.jsx("span",{style:{color:r==="warn"?"var(--cs-warning)":"var(--cs-error)",fontSize:"12px",lineHeight:"16px"},children:t})})},PG={id:"0x9258181f5ceac8dbffb7030890243caed69a9599d2886d957a9cb7656af3bdb3",coin_type:"0x2::sui::SUI",decimals:9,description:"",name:"Sui",symbol:"SUI",logo_url:"https://archive.cetus.zone/assets/image/sui/sui.png",is_verified:!0,extensions:{rank:"880"}};function RG({themeType:e}){const{setIsOpenSlippageDialog:t,isOpenSlippageDialog:r,slippage:n}=en();return _.jsxs(_.Fragment,{children:[_.jsxs("div",{className:"slippage-button",onClick:()=>t(!0),children:[_.jsxs("span",{children:[n,"%"]}),_.jsx("div",{className:"svg-box",children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-verticalslider"})})})]}),r&&_.jsx(NG,{themeType:e,onClose:()=>t(!1)})]})}function NG({onClose:e,themeType:t}){const{transactionMode:r,maxCapForGas:n,customGasPrice:i,setMaxCapForGas:s,setCustomGasPrice:o,setTransctionMode:a,mevProtect:c,setMevProtect:u}=en(),{balanceInfo:l}=au(PG),[f,p]=he.useState(r),[v,w]=he.useState(n),[y,S]=he.useState(i),[A,O]=he.useState(c),{slippage:j,setSlippage:V}=en(),[B,H]=he.useState(j),q=fe=>{H(fe.display)},ne=fe=>{const z=new RegExp("[^\\d-]*(\\d*(?:\\.\\d{0,2})?).*$");fe.target.value=fe.target.value.replace(z,"$1"),H(fe.target.value)},ge=()=>{B&&V(B),f==="Fast Mode"&&(s(v),o(y)),a(f),u(A),e()};he.useEffect(()=>{f==="Fast Mode"&&O(!0)},[f]);const se=he.useMemo(()=>f==="Fast Mode"&&(!v||Number(v)===0||Number(v)>5||!y||Number(y)===0||Fe(v).gt((l==null?void 0:l.totalBalanceFormat)||"0")||Fe(v).lt(Fe(y).div(Math.pow(10,9))))||!+B?!0:Number(B)>50||Number(B)<.01,[B,f,v,y,l]);return _.jsxs(_.Fragment,{children:[_.jsx("div",{className:"dialog-mask",style:{zIndex:"100"}}),_.jsx("div",{className:"slippage-settings-dialog",style:{zIndex:"100"},children:_.jsxs("div",{className:"slippage-settings",children:[_.jsxs("div",{className:"slippage-settings-header",children:[_.jsx("div",{className:"title",children:"Settings"}),_.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:e,children:_.jsx("use",{xlinkHref:"#icon-close"})})]}),_.jsxs("div",{className:"title",children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-verticalslider"})}),_.jsx("span",{children:"Slippage Tolerance"})]}),_.jsxs("div",{className:"form-box",children:[_.jsx("div",{className:"slippage-tab-list",children:aF.map(fe=>_.jsxs("span",{className:fe.display===B?"active":"",onClick:()=>q(fe),children:[fe.display," %"]},fe.display))}),_.jsxs("div",{className:"input-box",children:[_.jsx("span",{children:"Custom"}),_.jsx("input",{className:"cs-input",placeholder:"0.0",value:B,onChange:ne}),_.jsx("div",{style:{fontSize:"14px",color:"var(--cs-text-primary)"},children:"%"})]})]}),Number(B)<=.05&&_.jsx("div",{className:"tips warning",children:"Slippage is low. Your transaction may fail."}),Number(B)<=50&&Number(B)>1&&_.jsx("div",{className:"tips warning",children:"Your transaction may frontrun"}),Number(B)>50&&_.jsx("div",{className:"tips error",children:" Enter a valid slippage percentage"}),_.jsx(kG,{transactionMode:f,setTransactionMode:p,maxCapForGas:v,setMaxCapForGas:w,customGasPrice:y,setCustomGasPrice:S,suiBalance:(l==null?void 0:l.totalBalanceFormat)||"0",themeType:t}),_.jsx(DG,{mevProtect:A,setMevProtect:O,disabled:f==="Fast Mode"}),_.jsx(eg,{text:"Save",btnIsDisabled:se,className:"slippage-save-btn",onClick:ge})]})})]})}const DG=e=>{const{mevProtect:t,disabled:r,setMevProtect:n}=e;return _.jsxs("div",{className:"mev-settings-box",children:[_.jsx("div",{className:"mev-setting-title",children:_.jsxs("div",{className:"name",children:[_.jsx("svg",{"aria-hidden":"true",cursor:"pointer",fill:"var(--cs-icon-fill)",children:_.jsx("use",{xlinkHref:"#icon-icon_mev"})}),_.jsx("span",{children:"MEV Protect"})]})}),_.jsxs("div",{className:"mev-setting-Switch",children:[_.jsxs("div",{className:"label",children:[_.jsx("span",{children:"Enable MEV Protection"}),_.jsx(Jo,{position:"bottom",marginTop:"-118px",content:_.jsx("div",{className:"mev-tips",style:{width:"310px",whiteSpace:"wrap",color:"var(--cs-text-primary)"},children:"By enabling this, your txn will be submitted via 3rd party MEV service provider. MEV value retained will be redistributed to all users who successfully execute their trades with Shio through its point campaign."}),children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{cursor:"pointer"},children:_.jsx("use",{xlinkHref:"#icon-tips"})})})]}),_.jsx(RS,{checked:t,disabled:r,className:"cs-switch",onClick:()=>{n(!t)}})]})]})};function $G({handleRefresh:e,themeType:t}){return _.jsx(_.Fragment,{children:_.jsxs("div",{className:"swap-header",children:[_.jsx("h3",{className:"swap-title",children:"Swap"}),_.jsxs("div",{className:"right",children:[_.jsx(RG,{themeType:t}),_.jsx(SF,{onClick:e})]})]})})}const zte="",qte="";function LG(){const[e,t]=he.useState(!1);return _.jsxs(Es.Root,{open:e,onOpenChange:t,children:[_.jsx(Es.Trigger,{children:_.jsx("div",{className:"cs-settings-btn",children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-settings"})})})}),_.jsx(Es.Content,{variant:"soft",className:"cs-dropdown-content",style:{backgroundColor:"var(--cs-primary-10)"},side:"bottom",align:"end",children:_.jsxs("div",{className:"cs-settings-box",children:[_.jsx("h3",{children:"Settings"}),_.jsx(BG,{}),_.jsx(FG,{onClose:()=>{t(!1)}})]})})]})}function BG(){const{currentExplorer:e,setCurrentExplorer:t,currentRpc:r,setCurrentRpc:n}=en(),i=s=>{t(s)};return _.jsxs("div",{className:"settings-card",style:{marginTop:"12px"},children:[_.jsxs("h3",{className:"card-title",children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-plorer"})}),_.jsx("span",{children:"Preferred Explorer"})]}),_.jsx("div",{className:"explorer-checkbox-group",children:Ef.map(s=>_.jsxs("div",{className:"group-item",style:{justifyContent:"center"},onClick:()=>i(s.link),children:[_.jsx(Kf,{color:"indigo",checked:s.link===e,variant:"soft",className:"cs-checkbox cs-allow-change-checkbox"}),_.jsx("img",{src:s.img}),_.jsx("span",{children:s.name})]},s.link))})]})}const UG=e=>!/^(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(e);function FG({onClose:e}){const{addTxToast:t}=Fa(),{currentRpc:r,setCurrentRpc:n,customRpc:i,setCustomRpc:s,rpcList:o}=en(),[a,c]=he.useState(i),[u,l]=he.useState(r),f=y=>{t({id:0,status:"success",buildShowInfo:()=>({toastTitleText:"RPC update",toastDescriptionContent:`RPC is currently set to ${y}`})})},p=y=>{l(y),y.isCustom||(n(y),f(y.link),e())},v=y=>{c(y.target.value)},w=()=>{if(a){const y={name:"Custom RPC URL",link:a,isCustom:!0};s(a),n(y),f(a),e()}};return _.jsxs("div",{className:"settings-card rpc-settings-card",children:[_.jsxs("h3",{className:"card-title",children:[_.jsx("svg",{className:"cs-icon rpc-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-rpc"})}),_.jsx("span",{children:"RPC Node"})]}),_.jsxs("div",{className:"rpc-checkbox-group",children:[o.map(y=>_.jsxs("div",{className:"rpc-item",onClick:()=>p(y),children:[_.jsx(Kf,{color:"indigo",checked:u.name===y.name,variant:"soft",className:"cs-checkbox cs-allow-change-checkbox"}),_.jsx("span",{children:y.name})]},y.name)),u.isCustom&&_.jsxs("div",{className:"custom-rpc-input-box",children:[_.jsx("input",{className:"cs-input",placeholder:"Custom RPC URL",onChange:v,value:a}),_.jsx(eg,{btnIsDisabled:UG(a),text:"Save",onClick:w})]})]})]})}const Wte="";function z5(){const{suiClient:e}=oo(),{setAccountServiceNameObj:t,accountServiceNameObj:r}=rn(),n=async s=>{if(!((s==null?void 0:s.length)<1))try{const o=s.map(async u=>{var f;const l=await e.resolveNameServiceNames({address:u});return{address:u,name:((f=l==null?void 0:l.data)==null?void 0:f[0])||""}}),a=await Promise.all(o),c=Object.fromEntries(a==null?void 0:a.map(u=>[u.address,u.name]));t(c)}catch{}};return{fetchServiceNames:n,getServiceNames:async s=>{const o=[];s==null||s.forEach(a=>{const c=a==null?void 0:a.address;r!=null&&r[c]||o.push(c)}),(o==null?void 0:o.length)>0&&n(o)}}}var VG=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,r=[],n=0;n<e.rangeCount;n++)r.push(e.getRangeAt(n));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null;break}return e.removeAllRanges(),function(){e.type==="Caret"&&e.removeAllRanges(),e.rangeCount||r.forEach(function(i){e.addRange(i)}),t&&t.focus()}},zG=VG,q5={"text/plain":"Text","text/html":"Url",default:"Text"},qG="Copy to clipboard: #{key}, Enter";function WG(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function GG(e,t){var r,n,i,s,o,a,c=!1;t||(t={}),r=t.debug||!1;try{i=zG(),s=document.createRange(),o=document.getSelection(),a=document.createElement("span"),a.textContent=e,a.ariaHidden="true",a.style.all="unset",a.style.position="fixed",a.style.top=0,a.style.clip="rect(0, 0, 0, 0)",a.style.whiteSpace="pre",a.style.webkitUserSelect="text",a.style.MozUserSelect="text",a.style.msUserSelect="text",a.style.userSelect="text",a.addEventListener("copy",function(l){if(l.stopPropagation(),t.format)if(l.preventDefault(),typeof l.clipboardData>"u"){r&&console.warn("unable to use e.clipboardData"),r&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var f=q5[t.format]||q5.default;window.clipboardData.setData(f,e)}else l.clipboardData.clearData(),l.clipboardData.setData(t.format,e);t.onCopy&&(l.preventDefault(),t.onCopy(l.clipboardData))}),document.body.appendChild(a),s.selectNodeContents(a),o.addRange(s);var u=document.execCommand("copy");if(!u)throw new Error("copy command was unsuccessful");c=!0}catch(l){r&&console.error("unable to copy using execCommand: ",l),r&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),c=!0}catch(f){r&&console.error("unable to copy using clipboardData: ",f),r&&console.error("falling back to prompt"),n=WG("message"in t?t.message:qG),window.prompt(n,e)}}finally{o&&(typeof o.removeRange=="function"?o.removeRange(s):o.removeAllRanges()),a&&document.body.removeChild(a),i()}return c}var HG=GG;const W5=lc(HG);function KG({currentAccount:e}){const{mutate:t}=on.useSwitchAccount(),r=on.useAccounts(),{isOpenAccountList:n,setIsOpenAccountList:i,accountServiceNameObj:s}=rn(),{getServiceNames:o}=z5(),a=he.useCallback(()=>{n||o(r),i(!n)},[n,r]);he.useEffect(()=>()=>{i(!1)},[]);const c=he.useMemo(()=>r.filter(l=>l.address!==e),[r,e]);he.useEffect(()=>{},[c]);const u=l=>{t({account:l},{onSuccess:()=>{}})};return _.jsxs("div",{className:"cs-account-switch",children:[_.jsxs("div",{className:"account",onClick:a,children:[_.jsx("span",{children:e&&(s==null?void 0:s[e])||qo(e)}),(c==null?void 0:c.length)>0&&_.jsx("svg",{className:`cs-icon ${n?"open":"close"}`,"aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-unfold"})})]}),_.jsx("div",{className:`account-list ${n?"open":"close"}`,children:c.map(l=>{var f,p,v,w;return _.jsxs("div",{className:"account-item",children:[_.jsxs("div",{className:"left",children:[_.jsxs("div",{className:"label",children:[((f=l==null?void 0:l.label)==null?void 0:f.length)>16?((p=l==null?void 0:l.label)==null?void 0:p.substring(0,6))+"..."+((w=l==null?void 0:l.label)==null?void 0:w.substring(((v=l==null?void 0:l.label)==null?void 0:v.length)-10)):l==null?void 0:l.label," "]}),_.jsx("div",{className:"address",children:(s==null?void 0:s[l==null?void 0:l.address])||qo(l==null?void 0:l.address)})]}),_.jsx("button",{className:"cs-outline-btn",onClick:()=>u(l),children:"Switch"})]},l==null?void 0:l.address)})})]})}const YG=he.forwardRef(({connect:e,isSimulate:t=!1})=>{const r=on.useCurrentAccount();return _.jsx("div",{children:r?_.jsx(XG,{isSimulate:t}):_.jsx(eg,{text:"Connect",className:"cs-connect-button",onClick:()=>e(!0)})})});function XG({isSimulate:e}){const{mutate:t}=on.useDisconnectWallet(),r=on.useCurrentAccount(),{currentWallet:n}=on.useCurrentWallet(),{addCommonToast:i}=Fa(),{getExplorerUrl:s}=Ba(),{accountServiceNameObj:o}=rn(),a=()=>{r&&(W5(r.address||"",{debug:!1,message:"message"}),i("Copied"))},c=()=>{r&&window.open(s(r.address,"account"),"_blank")};return he.useEffect(()=>{},[n]),_.jsxs(Es.Root,{children:[_.jsx(Es.Trigger,{children:_.jsxs("div",{className:"cs-connected-button",children:[_.jsx("img",{src:n==null?void 0:n.icon,style:{width:"20px",height:"20px"}}),_.jsx("span",{style:{color:e?"#fff":"var(--cs-text-primary)"},children:(r==null?void 0:r.address)&&(o==null?void 0:o[r==null?void 0:r.address])||qo(r==null?void 0:r.address)})]})}),_.jsx(Es.Content,{variant:"soft",className:"cs-dropdown-content",style:{backgroundColor:"var(--cs-primary-10)"},side:"bottom",align:"end",children:_.jsxs("div",{className:"account-op-box",children:[_.jsx("span",{style:{fontSize:"14px",color:"var(--cs-text-secondary)",marginBottom:"6px"},children:r==null?void 0:r.label}),_.jsx(KG,{currentAccount:r==null?void 0:r.address}),_.jsxs("div",{className:"account-op-item",onClick:a,style:{marginTop:"12px"},children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-icon_copy"})}),_.jsx("span",{children:"Copy address"})]}),_.jsxs("div",{className:"account-op-item",onClick:c,children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-icon_link"})}),_.jsx("span",{children:"Open explorer"})]}),_.jsxs("div",{className:"account-op-item",onClick:()=>t(),children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-icon_disconnect"})}),_.jsx("span",{children:"Disconnect"})]})]})})]})}function JG({isSimulate:e=!1}){const{fetchServiceNames:t}=z5(),r=on.useCurrentAccount();on.useCurrentWallet();const{isOpenWalletModal:n,onWalletModal:i,saveCurrentAccount:s}=rn();return on.useWallets(),he.useEffect(()=>{r!=null&&r.address&&t([r==null?void 0:r.address])},[r==null?void 0:r.address]),_.jsx(_.Fragment,{children:_.jsx(on.ConnectModal,{trigger:_.jsx(YG,{connect:i,isSimulate:e}),open:n,onOpenChange:o=>i(o)})})}function ZG({independentWallet:e,customWallet:t,logo:r}){return _.jsxs(_.Fragment,{children:[_.jsxs("div",{className:"widget-header",children:[_.jsx("img",{src:r,className:"cetus-logo"}),_.jsxs("div",{className:"right",children:[e&&_.jsx(JG,{}),_.jsx(LG,{})]})]}),_.jsx("div",{style:{marginTop:"12px"}})]})}const Gte="",G5=()=>{const e=he.useRef(null);he.useEffect(()=>{if(e.current){const n=e.current.style;n.setProperty("--size-loader","50px"),n.setProperty("--size-orbe","10px")}},[]);const t=n=>({position:"absolute",width:"100%",height:"100%",animation:`webLoading ease-in-out 1.5s calc(${n} * 0.1s) infinite`,opacity:`calc(1 - calc(0.2 * ${n}))`}),r={position:"absolute",content:"''",top:0,left:0,width:"var(--size-orbe)",height:"var(--size-orbe)",backgroundColor:"var(--cs-primary)",boxShadow:"0px 0px 20px 2px var(--cs-primary)",borderRadius:"50%"};return _.jsx("div",{style:{width:"100%",height:"100%",position:"absolute",zIndex:100},children:_.jsx("div",{ref:e,style:{width:"var(--size-loader)",height:"var(--size-loader)",position:"absolute",top:"50%",left:"50%",marginTop:"-25px",marginLeft:"-25px",transform:"rotate(45deg)"},children:[...Array(5)].map((n,i)=>_.jsx("div",{style:t(i),children:_.jsx("div",{style:r})},i))})})};function QG({onClose:e,transactionData:t}){const{status:r,buildShowInfo:n,tx:i}=t,s=he.useMemo(()=>{if(n&&r)return n(r)},[r]);return _.jsxs("div",{className:"ts-status-dialog",children:[(r==="confirmation"||r==="submitted")&&_.jsx(eH,{info:s,status:r}),(r==="success"||r==="rejected")&&_.jsx(tH,{info:s,status:r,tx:i,onClose:e})]})}function eH({info:e,status:t}){return _.jsxs("div",{className:"progress-dialog",children:[_.jsx("div",{className:"title",children:t==="confirmation"?"Waiting for Confirmation":"Transaction in progress"}),_.jsx("div",{className:"loading-box",children:_.jsx(G5,{})}),_.jsxs("div",{className:"ts-content",children:[e==null?void 0:e.modalDescriptionText," "]}),_.jsxs("p",{className:"ts-desc",children:[" ",t==="confirmation"?"Confirm this transaction in your wallet.":"Confirmation is in progress."]})]})}function tH({info:e,status:t,tx:r,onClose:n}){const{getExplorerUrl:i}=Ba();return _.jsxs("div",{className:"finally-status-dialog",children:[_.jsxs("div",{className:"center-content",children:[_.jsxs("div",{className:t==="success"?"status-box is-success":"status-box is-error",children:[_.jsx("div",{className:"status-icon-box",children:_.jsx("div",{className:"status-icon",children:_.jsx("svg",{className:"icon","aria-hidden":"true",children:t==="success"?_.jsx("use",{xlinkHref:"#icon-sel"}):_.jsx("use",{xlinkHref:"#icon-caution"})})})}),t==="success"?_.jsx("span",{children:"Swap Success"}):_.jsx("span",{children:"Swap failed"})]}),_.jsx("div",{className:"ts-content",children:e==null?void 0:e.modalDescriptionText}),r&&_.jsxs("div",{className:"view-transaction",children:[_.jsx("span",{children:"View Transaction"}),Ef.map(s=>_.jsx("a",{href:i(r,"tx",s.link),target:"_blank",children:_.jsx("img",{src:s.img})},s.link))]})]}),_.jsx("button",{className:"cs-solid-btn swap-more-btn",onClick:n,children:t==="success"?"Swap More":"Retry"})]})}function rH(){const{fetchByApi:e}=Tf(),{setProviders:t}=en();return{fetchRouterConfig:async()=>{try{const n=await e("/router_v3/status","GET"),{providers:i}=n;i&&t(i)}catch{}}}}function nH({interval:e,callback:t}){const r=he.useRef(),n=he.useRef(null);he.useEffect(()=>{r.current=t},[t]);const i=he.useCallback(()=>{n.current&&clearInterval(n.current),e>0&&(n.current=setInterval(()=>{r.current&&r.current(Date.now())},e))},[e]),s=he.useCallback(()=>{n.current&&(clearInterval(n.current),n.current=null)},[]);return he.useEffect(()=>(i(),()=>s()),[]),{startTimer:i,stopTimer:s}}const H5=vs((e,t)=>({coinPriceObj:{},setPriceObj:r=>{const n=t().coinPriceObj;e({coinPriceObj:{...n,...r}})},clearPriceObj:r=>{const n=t().coinPriceObj;r.forEach(i=>{delete n[Sr(i).full_address]}),e({coinPriceObj:{...n}})}}));function iH(e,t){const r=[];for(let n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r}function Cu(){const{fetchByApi:e}=Tf(),{coinPriceObj:t,setPriceObj:r,clearPriceObj:n}=H5(),i=async a=>{const u=iH(a,10);try{const f=(await Promise.all(u.map(p=>e("/v3/sui/market_price","GET",{base_symbol_address:p.map(v=>ms(v,!1))})))).map(p=>p.prices).flat();if(f){const p={};f.forEach(v=>{p[Sr(v.base_symbol).full_address]=v}),r(p)}return f}catch{return n(a),null}},s=he.useCallback(a=>{if(!a)return;const c=t[Sr(a).full_address];if(c)return c},[t]),o=he.useCallback((a,c,u)=>{const l=Number(c)==0||!u?"0":u;if(c&&a&&+c){const f=s(a);if(f)return Fe(c).mul(f.price).toString()}return l},[t]);return{fetchTokenPrices:i,getTokenPrice:s,getTokenAmountValue:o}}function sH(){const{tokenBalanceObj:e}=rn(),{fetchTokenPrices:t}=Cu(),{isOpenTokensDialog:r}=tn(),n=he.useCallback(()=>{if(nF(e)){const i=Object.keys(e);t(i)}},[e]);return he.useEffect(()=>{r&&n()},[r]),{getMyAssetsPrice:n}}const oH={id:"0x9258181f5ceac8dbffb7030890243caed69a9599d2886d957a9cb7656af3bdb3",coin_type:"0x2::sui::SUI",decimals:9,description:"",name:"Sui",symbol:"SUI",logo_url:"https://imagedelivery.net/cBNDGgkrsEA-b_ixIp9SkQ/sui-coin.svg/public",is_trusted:!0,extensions:{rank:"880"}},K5={id:"0x69b7a7c3c200439c1b5f3b19d7d495d5966d5f08de66c69276152f8db3992ec6",coin_type:"0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",decimals:6,description:"",name:"USDC",symbol:"USDC",logo_url:"https://circle.com/usdc-icon",is_trusted:!0,extensions:{rank:"1000"}},Y5=oH;function aH(e,t){const{fetchTokenInfo:r}=Va(),{setFromCoin:n,setToCoin:i,setDefaultCoin:s,fromCoin:o,toCoin:a}=tn(),{setSlippage:c,setRpcList:u,setCurrentRpc:l}=en(),{tokenMapIsInit:f}=Ua(),p=he.useRef({}),v=async(y,S)=>{if(!S&&!y&&(o||a))return;const A=y?await r(y):K5,O=S?await r(S):Y5;n(A),i(O),s(A==null?void 0:A.coin_type,O==null?void 0:O.coin_type)},w=(y=[],S)=>{let A=[],O=su[0],j=su[0];y.forEach(V=>{const B={name:V,link:V,isCustom:!1};A.push(B),V===S&&(j=B)}),S&&y.includes(S)?A=[j,O,...A.filter(V=>V.link!==S)]:A.unshift(su[0]),u([...A,{name:"Custom RPC URL",link:"",isCustom:!0}]),l(j)};return he.useEffect(()=>{if(f&&!Q0(e,p.current)){const{defaultFromToken:y,defaultToToken:S,defaultSlippage:A,customRpcList:O,defaultRpc:j}=e;v(y,S),A&&c(A),w(O||[],j),p.current=e}},[e,f]),{handleSetDefaultPair:v}}function cH(e){const{currentRpc:t}=en(),{setSuiClient:r,setAggregatorSDK:n}=oo(),{currentAccount:i}=rn();he.useEffect(()=>{if(t){const o=new Lo({url:t.link});r(o)}},[t]);const s=()=>{const o={endpoint:La.aggregatorUrl,signer:(i==null?void 0:i.address)||"",client:new Lo({url:t.link}),env:W3.Mainnet,overlayFeeRate:(e==null?void 0:e.overlayFeeRate)||void 0,overlayFeeReceiver:(e==null?void 0:e.overlayFeeReceiver)||void 0},a=new q3(o);n(a)};he.useEffect(()=>{t&&s()},[t.link,i==null?void 0:i.address]),he.useEffect(()=>{e!=null&&e.overlayFeeRate&&(e!=null&&e.overlayFeeReceiver)&&s()},[e==null?void 0:e.overlayFeeRate,e==null?void 0:e.overlayFeeReceiver])}const rg=vs((e,t)=>({transactionData:void 0,setTransactionData:r=>{e(()=>({transactionData:r}))}})),Vr=[];for(let e=0;e<256;++e)Vr.push((e+256).toString(16).slice(1));function uH(e,t=0){return(Vr[e[t+0]]+Vr[e[t+1]]+Vr[e[t+2]]+Vr[e[t+3]]+"-"+Vr[e[t+4]]+Vr[e[t+5]]+"-"+Vr[e[t+6]]+Vr[e[t+7]]+"-"+Vr[e[t+8]]+Vr[e[t+9]]+"-"+Vr[e[t+10]]+Vr[e[t+11]]+Vr[e[t+12]]+Vr[e[t+13]]+Vr[e[t+14]]+Vr[e[t+15]]).toLowerCase()}let ng;const lH=new Uint8Array(16);function fH(){if(!ng){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ng=crypto.getRandomValues.bind(crypto)}return ng(lH)}const X5={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function J5(e,t,r){var i;if(X5.randomUUID&&!t&&!e)return X5.randomUUID();e=e||{};const n=e.random??((i=e.rng)==null?void 0:i.call(e))??fH();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let s=0;s<16;++s)t[r+s]=n[s];return t}return uH(n)}var Zo=(e=>(e[e.CalculateError=1e4]="CalculateError",e[e.NumberTooLarge=10001]="NumberTooLarge",e[e.NoRouter=10002]="NoRouter",e[e.InsufficientLiquidity=10003]="InsufficientLiquidity",e[e.HoneyPot=10004]="HoneyPot",e))(Zo||{});const dH=new Lo({url:y6("mainnet")}),hH=["0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC","0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD","0xf16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a::fdusd::FDUSD","0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb::usdy::USDY","0x294de7579d55c110a00a7c4946e09a1b5cbeca2592fbb83fd7bfacba3cfeaf0e::drf::DRF"],pH=["deny_list","DenyList","DenyCap","create_regulated_currency"],mH={showType:!0,showContent:!0,showOwner:!1,showPreviousTransaction:!1,showStorageRebate:!1,showDisplay:!1},gH=async e=>{let t=!1;if(hH.includes(e))return t;const r=e.split("::"),n=r[0]&&Vt(r[0]),i=r[1],s=await dH.getObject({id:n,options:mH}),o="disassembled"in s.data.content?s.data.content.disassembled[i]:null;return o&&typeof o=="string"&&new RegExp(pH.join("|"),"i").test(o)&&(t=!0),t},yH=e=>{var n;if(!e)return"";const t=e==null?void 0:e.split(",");return(n=t==null?void 0:t.map(i=>ms(i,!1)))==null?void 0:n.join(",")};function vH(){const{fetchByApi:e}=Tf(),t=async s=>{try{const o={...s},a=yH(s==null?void 0:s.coin_type);a&&(o.coin_type=a);const c=await e("/v2/sui/stats_pools","GET",o);if(c!=null&&c.lp_list)return{list:(c==null?void 0:c.lp_list)||[],total:c==null?void 0:c.total}}catch(o){return console.error("getPoolList ~ Error:",o),await r(s)}return{list:[],total:0}},r=async s=>{var o,a,c,u;try{const l=Pt("/data/pools.json"),f=await fetch(l).then(p=>p.json());if((o=f==null?void 0:f.data)!=null&&o.lp_list){const p=(a=f==null?void 0:f.data)==null?void 0:a.lp_list;let v=p;if(s!=null&&s.coin_type){const y=(u=(c=s==null?void 0:s.coin_type)==null?void 0:c.split(","))==null?void 0:u.map(S=>zo(S).source_address);v=p==null?void 0:p.filter(S=>{var j,V;const A=zo((j=S==null?void 0:S.coin_a)==null?void 0:j.address).source_address,O=zo((V=S==null?void 0:S.coin_b)==null?void 0:V.address).source_address;return(y==null?void 0:y.length)>1&&y.includes(A)&&y.includes(O)?!0:!!((y==null?void 0:y.length)===1&&(y.includes(A)||y.includes(O)))})}s!=null&&s.is_vaults&&(v=p==null?void 0:p.filter(y=>y==null?void 0:y.is_vaults)),s!=null&&s.has_farming&&!(s!=null&&s.is_vaults)&&!(s!=null&&s.has_mining)&&!(s!=null&&s.no_incentives)&&(v=p==null?void 0:p.filter(y=>y==null?void 0:y.has_farming));const w=v;return{list:w,total:(w==null?void 0:w.length)||0}}}catch(l){console.error("getLocalJsonPoolList Error:",l)}return{list:[],total:0}},n=s=>y_(s)==="0x2::sui::SUI"?"0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI":y_(s);return{getPoolList:t,getLocalJsonPoolList:r,getLocalJsonPoolAddress:async(s,o)=>{try{const a=n(s),c=n(o),u=await fetch("/data/all-pools.json").then(l=>l.json());if(u)return u[`${a.toLocaleLowerCase()}-${c.toLocaleLowerCase()}`]||u[`${c.toLocaleLowerCase()}-${a.toLocaleLowerCase()}`]}catch(a){console.error("getLocalJsonPoolAddress Error:",a)}return[]}}}function bH(e=!0){const{poolApiMap:t,setPoolApiMap:r}=en(),{getPoolList:n,getLocalJsonPoolList:i,getLocalJsonPoolAddress:s}=vH();return{getPoolListByCoinType:async(c,u)=>{if(c&&u){const l=[c,u].sort(),f=`${l[0]}_${l[1]}`,p=t[f];if(p)return p;const v={coin_type:`${c},${u}`,display_all_pools:!0,offset:0,limit:100,order_by:"-tvl",no_incentives:!0,has_farming:!0,has_mining:!0};let w=e?await i(v):void 0;(w===void 0||w.list.length===0)&&(w=await n(v));const y=w.list;if(y.length>0)return t[f]=y,r(f,y),y}return[]},getPoolAddressByCoinType:async(c,u)=>{if(c&&u){const l=[c,u].sort(),f=`${l[0]}_${l[1]}`;if(e){const w=await s(c,u);if(!w||w.length===0){const y=t[f];if(y)return y.map(S=>S.poolAddress)}else return w}const p={coin_type:`${c},${u}`,display_all_pools:!0,offset:0,limit:100,order_by:"-tvl",no_incentives:!0,has_farming:!0,has_mining:!0},v=await n(p);if(v){const w=v.list;if(w.length>0)return t[f]=w,r(f,w),w.map(y=>y.poolAddress)}}return[]}}}function wH(e){const{routerData:t}=tn();return{priceAcceptRouterData:he.useMemo(()=>{if(t&&e){if(e.byAmountIn){if(!Fe(e.toAmountUi).eq(t.toAmountUi||"0"))return t}else if(!Fe(e.fromAmountUi).eq(t.fromAmountUi||"0"))return t;return}},[t,e])}}function Z5(e,t){return{amountLimit:he.useMemo(()=>{if(t&&t.routerData){const{byAmountIn:n,fromAmountUi:i,toAmountUi:s}=t;return n?Fe(s).mul(Fe(1).sub(Fe(e).div(100))).toString():Fe(i).mul(Fe(1).add(Fe(e).div(100))).toString()}},[e,t])}}function _H(){const{fromCoin:e,toCoin:t}=tn(),{getPoolAddressByCoinType:r}=bH(!0);return{getSwapPoolAddress:async()=>e&&t?await r(e.coin_type,t.coin_type):[]}}function Q5(e,t,r){return he.useMemo(()=>t&&r&&+t&&+r?e?Fe(r).div(t).toString():Fe(t).div(r).toString():"0",[t,r,e])}function e7(e){const[t,r]=he.useState(),n=async i=>{if(i.is_trusted)return!1;try{return await gH(i.coin_type)}catch{}return!1};return he.useEffect(()=>{r(void 0),e&&n(e).then(i=>{r(i)})},[e==null?void 0:e.coin_type]),{isScamsCoin:t}}function xH(e,t){const{defaultFromCoinType:r,defaultToCoinCoinType:n}=tn(),{getTokenInfo:i}=Va(),{ignoreWarnTokenMap:s}=en(),o=i(e),a=i(t),c=he.useMemo(()=>!xf(r,K5.coin_type)||!xf(n,Y5.coin_type),[r,n]),u=he.useCallback(f=>f&&!s[ms(f.coin_type)]&&(xf(r,f.coin_type)||xf(n,f.coin_type))?!f.is_trusted:!1,[r,n,s]),l=he.useMemo(()=>{const f=[];return c&&(o&&u(o)&&f.push({...o}),a&&u(a)&&f.push({...a})),f},[o==null?void 0:o.coin_type,a==null?void 0:a.coin_type,c,s]);return{isCustomMode:c,customWarnTokenList:l}}function SH(){const{aggregatorSDK:e}=oo(),{getSwapPoolAddress:t}=_H(),r=s=>s&&s.error?s.error.code===Zo.InsufficientLiquidity||Zo.HoneyPot||Zo.NumberTooLarge:!1,n=async s=>{var p;const{fromToken:o,toToken:a,amount:c,providersKeys:u,by_amount_in:l,uuid:f}=s;try{const v={from:o.coin_type,target:a.coin_type,amount:new Y6(c),byAmountIn:l,depth:3,splitAlgorithm:void 0,splitFactor:void 0,splitCount:void 0,providers:u},w=await e.findRouters(v);if(w&&r(w))return i(!1,l,f,o,a,w);if(!w||!((p=w==null?void 0:w.paths)!=null&&p.length))throw Error("not find router");return i(!1,l,f,o,a,w)}catch{const w=await t(),y={from:o.coin_type,target:a.coin_type,amount:new Y6(c),byAmountIn:l,pools:w};try{const S=await e.swapInPools(y);return!S||!S.routeData?i(!0,l,f,o,a):i(!0,l,f,o,a,S.routeData)}catch{return{uuid:f,byAmountIn:l,isDegrade:!0}}}},i=(s,o,a,c,u,l)=>{var f;if(l){const p=l.error!==void 0,v=Z0(l.amountIn.toString(),c.decimals).toString(),w=Z0(l.amountOut.toString(),u.decimals).toString();return{routerData:p?void 0:l,fromAmountUi:p?o?v:"":v,toAmountUi:p&&o?"":w,uuid:a,byAmountIn:o,isDegrade:s,errorCode:(f=l.error)==null?void 0:f.code}}else return{uuid:a,byAmountIn:o,isDegrade:s}};return{findBestRouters:n}}function ec(e){const t=he.useRef(e);return he.useEffect(()=>{t.current=e},[e]),t}function EH(e){try{return e&&e.toString().includes("Rejected from user")}catch{return!1}}function TH(e){const t=String(e);return t.indexOf("withdraw_with_proof")>-1||t.indexOf("check_coin_threshold")>-1||t.indexOf('Identifier("balance")')>-1}function CH(e){return!!String(e).includes("Could not find the referenced transaction")}function AH(e){return!!String(e).includes("Max cap reached.")}function IH(e){return!!String(e).includes("Fast Mode service error")}function MH(e){return EH(e)?"User rejected the request":TH(e)?"Exceeded price slippage":CH(e)?"Oops. Failed to sync data from your txid. Please check your txn status from explorer or from your wallet.":AH(e)?"Max cap reached. This is to prevent your txn from overpaying. You can choose to edit your gas max cap in settings if needed.":IH(e)?"Fast Mode service error, please switch to the Default Transaction Mode or try again later.":"Transaction failed"}var ig={},OH=Rr&&Rr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ig,"__esModule",{value:!0});var jH=ig.executeAuction=t7;const kH=OH(P8),PH="https://rpc.getshio.com",RH=500,NH=300;function t7(e,t,r=RH){const n={jsonrpc:"2.0",method:"shio_executeAuction",params:[e,t],id:1};return new Promise((i,s)=>{setTimeout(i,r),kH.default.post(PH,n,{headers:{"Content-Type":"application/json"},timeout:r}).then(o=>{setTimeout(i,NH)}).catch(s)})}ig.default={executeAuction:t7};const DH="0x2::sui::SUI",$H="https://rpc.getshio.com/fast",LH="0x1889977f0fb56ae730e7bda8e8e32859ce78874458c74910d36121a81a615123",r7=[{objectId:"0xc32ce42eac951759666cbc993646b72387ec2708a2917c2c6fb7d21f00108c18",version:72869622},{objectId:"0x0289acae0edcdf1fe3aedc2e886bc23064d41c359e0179a18152a64d1c1c2b3e",version:327637282},{objectId:"0x03132160e8c2c45208abf3ccf165e82edcc42fee2e614afe54582f9740a808b8",version:327637282},{objectId:"0x072ae7307459e535379f422995a0d10132f12a3450298f8cf0cc07bd164f9999",version:327637282},{objectId:"0x1c1a96a2f4a34ea09ab15b8ff98f4b6b4338ce89f4158eb7d3eb2cd4dcbd6d86",version:327637282},{objectId:"0x20d76f37ad9f2421a9e6afaf3bb204250b1c2241c50e8a955e86a1a48767d06f",version:327637282},{objectId:"0x213ed368233cc7480fcb6336e70c5ae7ee106b2317ba02ccb5d0478e45bcc046",version:327637282},{objectId:"0x22ce1e80937354eba5549fed2937dc6e2b24026d03505bb51a3e4a64aa4142f6",version:327637282},{objectId:"0x26188cb7ce5ae633279f440f66081cb65cc585e428de18e194f8843e866f799f",version:327637282},{objectId:"0x38642f01422480128388d3e2948d3dc1b2680f9914077edb6bd3451ae1c5bcf0",version:327637282},{objectId:"0x3dd85b6424aea1cae9eff6e55456ca783e056226325f1362106eca8b3ed04ca0",version:327637282},{objectId:"0x42f8adc490542369d9c3b95e9f6eb70b2583102900feb7e103072ed49ba7fc3d",version:327637282},{objectId:"0x46b8158c82fa6bda7230d31a127d934c7295a0042083b4900f3096e9191f6f3f",version:327637282},{objectId:"0x6ebac88a8c3f7a4a9fb05ea49d188a1fe8520ae59ee736e0473004d3033512a4",version:327637282},{objectId:"0x6f55ad6cb40cfc124c11b11c19be0a80237b104acd955e7b52ccb7bf9046fe33",version:327637282},{objectId:"0x71aafb8bac986e82e5f78846bf3b36c2a82505585625207324140227a27ff279",version:327637282},{objectId:"0x7fe9b08680d4179de5672f213b863525b21f10604ca161538075e9338d1d2324",version:327637282},{objectId:"0x81538ef2909a3e0dd3d7f38bcbee191509bae4e8666272938ced295672e2ee8d",version:327637282},{objectId:"0x828eb6b3354ad68a23dd792313a16a0d888b7ea4fdb884bb22bd569f8e61319e",version:327637282},{objectId:"0x9705a332b8c1650dd7fe687ef9f9a9638afb51c30c0b34db150d60b920bc07eb",version:327637282},{objectId:"0x9918f73797a9390e9888b55454f2b31bc01de1a4634acab08f80641c4248e8a5",version:327637282},{objectId:"0x9cd4c08bdf2e132ec2cc77b0f03be60a94951e046d8e82ed5494f44e609edd2f",version:327637282},{objectId:"0xac8ce2033571140509788337c8a1f3aa8941a320ecd7047acda310d39cad9e03",version:327637282},{objectId:"0xbcd4527035265461a9a7b4f1e57c63ea7a6bdf0dc223c66033c218d880f928b1",version:327637282},{objectId:"0xbfdb691b8cc0b3c3a3b7a654f6682f3e53b164d9ee00b9582cdb4d0a353440a9",version:327637282},{objectId:"0xc2559d5c52ae04837ddf943a8c2cd53a5a0b512cee615d30d3abe25aa339465e",version:327637282},{objectId:"0xc56db634d02511e66d7ca1254312b71c60d64dc44bf67ea46b922c52d8aebba6",version:327637282},{objectId:"0xc84545cbff1b36b874ab2b69d11a3d108f23562e87550588c0bda335b27101e0",version:327637282},{objectId:"0xcc141659b5885043f9bfcfe470064819ab9ac667953bcedd1000e0652e90ee76",version:327637282},{objectId:"0xef6bf4952968d25d3e79f7e4db1dc38f2e9d99d61ad38f3829acb4100fe6383a",version:327637282},{objectId:"0xf2ed8d00ef829de5c4a3c5adf2d6b0f41f7fec005fb9c88e5616b98173b2fd66",version:327637282},{objectId:"0xfce73f3c32c3f56ddb924a04cabd44dd870b72954bbe7c3d7767c3b8c25c4326",version:327637282}];async function BH(e){const t=e.client,r=await e.transaction.build({client:t,onlyTransactionKind:!0});let n=e.sender??e.transaction.getData().sender;if(!n)throw new Error("Sender need to be either set in options or in transaction data");return await t.call("shio_estimateFastModeFee",[n,e.transaction.getData().gasData.price,Rl.from(r).toString("base64")])}function UH(){return r7[Math.floor(Math.random()*r7.length)]}async function FH(e,t,r){return await e.executeTransactionBlock({transactionBlock:t.bytes,signature:t.signature,options:r})}async function VH(e,t,r){let n=e.moveCall({package:"0x2",module:"coin",function:"into_balance",typeArguments:[DH],arguments:[t]});return zH(e,n,r)}async function zH(e,t,r){let n=UH();e.moveCall({package:LH,module:"auctioneer",function:"submit_bid",arguments:[e.sharedObjectRef({objectId:n.objectId,mutable:!0,initialSharedVersion:n.version}),e.pure.u64(r),t]})}const sg="CoinWithBalance",qH=$.object({type:$.string(),balance:$.bigint()});async function WH(e,t,r){var u,l;const n=new Set,i=new Map;if(!e.sender)throw new Error("Sender must be set to resolve CoinWithBalance");for(const f of e.commands)if(f.$kind==="$Intent"&&f.$Intent.name===sg){const{type:p,balance:v}=$.parse(qH,f.$Intent.data);p!=="gas"&&v>0n&&n.add(p),i.set(p,(i.get(p)??0n)+v)}const s=new Set;for(const f of e.inputs)(u=f.Object)!=null&&u.ImmOrOwnedObject&&s.add(f.Object.ImmOrOwnedObject.objectId),(l=f.UnresolvedObject)!=null&&l.objectId&&s.add(f.UnresolvedObject.objectId);const o=new Map,a=t.client;await Promise.all([...n].map(async f=>{o.set(f,await GH({coinType:f,balance:i.get(f),client:a,owner:e.sender,usedIds:s}))}));const c=new Map;c.set("gas",{$kind:"GasCoin",GasCoin:!0});for(const[f,p]of e.commands.entries()){if(p.$kind!=="$Intent"||p.$Intent.name!==sg)continue;const{type:v,balance:w}=p.$Intent.data;if(w===0n&&v!=="gas"){e.replaceCommand(f,Cn.Commands.MoveCall({target:"0x2::coin::zero",typeArguments:[v]}));continue}const y=[];if(!c.has(v)){const[S,...A]=o.get(v).map(O=>e.addInput("object",Cn.Inputs.ObjectRef({objectId:O.coinObjectId,digest:O.digest,version:O.version})));A.length>0&&y.push(Cn.Commands.MergeCoins(S,A)),c.set(v,S)}y.push(Cn.Commands.SplitCoins(c.get(v),[e.addInput("pure",Cn.Inputs.Pure(Vn.bcs.u64().serialize(w)))])),e.replaceCommand(f,y),e.mapArguments(S=>S.$kind==="Result"&&S.Result===f?{$kind:"NestedResult",NestedResult:[f+y.length-1,0]}:S)}return r()}async function GH({coinType:e,balance:t,client:r,owner:n,usedIds:i}){let s=t;const o=[];return a();async function a(c=null){const{data:u,hasNextPage:l,nextCursor:f}=await r.getCoins({owner:n,coinType:e,cursor:c}),p=u.sort((v,w)=>Number(BigInt(w.balance)-BigInt(v.balance)));for(const v of p){if(i.has(v.coinObjectId))continue;const w=BigInt(v.balance);if(o.push(v),s-=w,s<=0)return o}if(l)return a(f);throw new Error(`Not enough coins of type ${e} to satisfy requested balance`)}}function n7(){const{suiClient:e}=oo(),{currentAccount:t}=rn(),{mutateAsync:r}=on.useSignTransaction(),{mutate:n}=on.useSignAndExecuteTransaction({execute:async({bytes:c,signature:u})=>await s(c,u)}),i=he.useMemo(()=>"sui:mainnet",[t]),s=async(c,u,l=!1)=>{var p,v;if(l){const w=await e.devInspectTransactionBlock({transactionBlock:Cn.Transaction.from(br(c)),sender:t.address});if(!w||((p=w.effects)==null?void 0:p.status.status)==="failure")throw Error((v=w.effects)==null?void 0:v.status.error)}return await e.executeTransactionBlock({transactionBlock:c,signature:u,options:{showEvents:!0,showRawEffects:!0,showEffects:!0,showBalanceChanges:!0,showObjectChanges:!0,showInput:!0}})};return{signAndExecuteTransactionBlock:async(c,u=!1)=>{var f,p;let l;if(typeof c=="string"?l=Cn.Transaction.from(c):l=c,u){const v=await e.devInspectTransactionBlock({transactionBlock:c,sender:t.address});if(!v||((f=v.effects)==null?void 0:f.status.status)==="failure")throw Error((p=v.effects)==null?void 0:p.status.error)}return l.setGasBudget(1e8),new Promise((v,w)=>{n({transaction:l,chain:i},{onSuccess:y=>{v(y)},onError:y=>{console.error("signAndExecuteTransactionBlock transaction failed",y),w(y)}})})},signTransactionBlock:async c=>(c instanceof Uint8Array&&(c=Cn.Transaction.from(c)),typeof c=="string"&&(c=Cn.Transaction.from(br(c))),new Promise((u,l)=>{r({transaction:c,chain:i},{onSuccess:f=>{u(f)},onError:f=>{console.error("signTransactionBlock failed",f),l(f)},onSettled:(f,p,v,w)=>{console.error("signTransactionBlock onSettled",{data:f,error:p,variables:v})}})})),executeTransactionBlock:s}}function HH(){const{signTransactionBlock:e,executeTransactionBlock:t,signAndExecuteTransactionBlock:r}=n7(),{currentAccount:n}=rn();return{getFastModeTx:async(s,o,a)=>{let c,u,l;try{const f=new Lo({url:$H});s.setSender(n==null?void 0:n.address),s.setGasPrice(Number(a));const p=Cn.Transaction.from(s);p.addIntentResolver(sg,WH);const v=await BH({transaction:p,client:f}),w=Fe(o).mul(Math.pow(10,9)).toString();if(Fe(v.gasBudget).gt(w))throw Error("Max cap reached. This is to prevent your txn from overpaying. You can choose to edit your gas max cap in settings if needed.");s.setGasBudget(v.gasBudget);const y=s.splitCoins(s.gas,[v.tipAmount]);VH(s,y[0],v.tipAmount);const S=await s.build({client:f}),A=await e(S),{bytes:O,signature:j}=A;l=O,u=new Date().getTime(),c=await FH(f,A,{showEffects:!0,showEvents:!0})}catch(f){throw String(f).includes("Failed to fetch")?Error("Fast Mode service error"):f}return{result:c,startExecuteTime:u,transactionBlockBytes:l}}}}function KH(){const{signTransactionBlock:e,executeTransactionBlock:t,signAndExecuteTransactionBlock:r}=n7(),{currentAccount:n}=rn(),{suiClient:i}=oo(),{setTransactionData:s}=rg(),{addTxToast:o,removeToast:a}=Fa(),{getFastModeTx:c}=HH(),u=5,l=2e3;async function f(w,y=1){try{let S;try{S=await i.getTransactionBlock({digest:w,options:{showEvents:!0,showEffects:!0,showBalanceChanges:!0,showInput:!0,showRawInput:!0,showObjectChanges:!0}})}catch{S=await i.getTransactionBlock({digest:w,options:{showEvents:!0,showEffects:!0}})}if(S)return S;throw new Error("Empty response")}catch(S){if(console.error(`Attempt ${y} failed:`,S),y>=u)throw new Error("Failed to fetch transaction status after maximum retries.");return await m_(l),f(w,y+1)}}const p=async(w,y,S={useDevInspect:!1,useMev:!1,txAction:"signTransactionBlock",useFastMode:!1,maxCapForGas:"",customGasPrice:""})=>{var ge,se,fe;const{useDevInspect:A=!1,useMev:O,txAction:j="signTransactionBlock",useFastMode:V=!1,maxCapForGas:B="",customGasPrice:H=""}=S;let q;y.status="confirmation",s(y);let ne="";try{let z,N,h;typeof w=="function"?h=await w():h=w,h.setSender(n.address);let d;if(V&&B&&H){const x=await c(h,B,H);z=x.result,d=x.startExecuteTime,N=x.transactionBlockBytes}else if(j==="signTransactionBlock"){const x=await e(h),{bytes:E,signature:C}=x;if(O)try{const k=await jH(E,C,500)}catch{}z=await t(E,C,A)}else z=await r(h,A);y.status="submitted",s({...y}),y.tx=z.digest,q=o(y),await m_(l),ne=z==null?void 0:z.digest;let m;if(((ge=z==null?void 0:z.effects)==null?void 0:ge.status.status)==="success"?m=z:m=await f(ne,0),!m||((se=m.effects)==null?void 0:se.status.status)==="failure")v(y,(fe=m.effects)==null?void 0:fe.status.error);else{const x=rF(m,n==null?void 0:n.address,!1);if(y.buildShowInfo){const E=y.buildShowInfo("success",x);y.buildShowInfo=C=>E}a(q),y.status="success",s({...y})}return m}catch(z){v(y,z)}},v=(w,y)=>{const S=MH(y);if(w.buildShowInfo){const A=w.buildShowInfo("confirmation");w.buildShowInfo=O=>(A.toastDescriptionContent=S,A.modalDescriptionText=S,A),w.status="rejected",s({...w})}else w.buildShowInfo=A=>{const O={};return O.toastDescriptionContent=S,O.modalDescriptionText=S,O},w.status="rejected",s({...w})};return{signAndExecuteTransaction:p}}function og(e,t=1e3){const r=he.useRef(),n=he.useCallback((...i)=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{e(...i)},t)},[e,t]);return he.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]),n}function YH(){const{aggregatorSDK:e}=oo(),{findBestRouters:t}=SH(),{getTokenAmountValue:r,fetchTokenPrices:n}=Cu(),{providers:i,slippage:s,mevProtect:o,maxCapForGas:a,transactionMode:c,customGasPrice:u}=en(),{signAndExecuteTransaction:l}=KH(),{setTransactionData:f}=rg(),{addTxToast:p}=Fa(),{fromCoin:v,toCoin:w,setFromCoin:y,setToCoin:S,setToAmount:A,fromAmount:O,toAmount:j,setFromAmount:V,setFindRouterLoading:B,setRouterData:H,setByAmountIn:q,byAmountIn:ne}=tn(),[ge,se]=he.useState(""),fe=ec(ge),z=ec(ne),N=ec(O),h=ec(j),d=ec(v),m=ec(w),{balanceInfo:x,getOwnerCoinBalances:E}=au(v),{balanceInfo:C}=au(w),k=r(v==null?void 0:v.coin_type,O),M=r(w==null?void 0:w.coin_type,j),b=og(async(te,Q,G)=>{if(d.current&&m.current&&+te){(+N.current||+h.current)&&B(!0);const pe=eF(te,Q?d.current.decimals:m.current.decimals),X=await t({fromToken:d.current,toToken:m.current,amount:pe.toString(),providersKeys:i,by_amount_in:Q,uuid:G});B(!1),fe.current===G&&(Q?+N.current?(A(X.toAmountUi||""),H(X)):A(""):+h.current?(V(X.fromAmountUi||"ß"),H(X)):V(""))}else ie(!Q)},500),R=(te,Q,G=!1)=>{if(q(Q),Q?(V(te),G&&A("")):(A(te),G&&V("")),+te){const pe=J5();se(pe),b(te,Q,pe)}else B(!1),H(void 0),ie(!Q)},ue=(te,Q=!0)=>{ie(),Q?((te==null?void 0:te.coin_type)===(w==null?void 0:w.coin_type)&&S(v),y(te)):((te==null?void 0:te.coin_type)===(v==null?void 0:v.coin_type)&&y(w),S(te))},ie=te=>{te===void 0?(V(""),A("")):te?V(""):A(""),B(!1),H(void 0)},le=()=>{const te=z.current?N.current:h.current;if(+te){const Q=J5();se(Q),b(te,z.current,Q)}},be=async(te,Q)=>{const{routerData:G,byAmountIn:pe,fromAmountUi:X,toAmountUi:J}=te,U=new Cn.Transaction,oe={router:G,slippage:Number(s)/100,txb:U,partner:Q||cF};try{const ye={status:"confirmation",buildShowInfo:(je,Ve)=>{const Je=`Swap ${hn(X,v==null?void 0:v.decimals)} ${v==null?void 0:v.symbol} for ${hn(J,w==null?void 0:w.decimals)} ${w==null?void 0:w.symbol}`,$e={modalDescriptionText:Je,toastTitleText:Je};if(je==="success"){let Ge=X,nt=J;Ve&&(Ge=g_(Ve,v)||X,nt=g_(Ve,w)||J);const et=`Swapped ${hn(Ge,v==null?void 0:v.decimals)} ${v==null?void 0:v.symbol} for ${hn(nt,w==null?void 0:w.decimals)} ${w==null?void 0:w.symbol}`;$e.toastTitleText=et,$e.modalDescriptionText=et}return $e},id:0};f(ye),await l(async()=>(await e.fastRouterSwap(oe),U),ye,{useMev:o,useFastMode:c==="Fast Mode",maxCapForGas:a,customGasPrice:u})?(ie(),E()):le()}catch(ye){String(ye).includes("TypeError: Failed to fetch")&&p({id:0,status:"rejected",buildShowInfo(de,Ee){return{toastTitleText:"RPC loading failed",toastDescriptionContent:"Try resubmission. Or to check your network and switch an RPC in settings to try again."}}})}};he.useEffect(()=>{Ae(),ie()},[v==null?void 0:v.coin_type,w==null?void 0:w.coin_type]);const Ae=()=>{const te=[];v&&te.push(v.coin_type),w&&te.push(w.coin_type),te.length>0&&n(te)},{isScamsCoin:D}=e7(v),{isScamsCoin:F}=e7(w),K=he.useMemo(()=>{if(!(!D&&!F)){if(D&&F)return`${v==null?void 0:v.symbol} and ${w==null?void 0:w.symbol} are`;if(D)return`${v==null?void 0:v.symbol} token is `;if(F)return`${w==null?void 0:w.symbol} token is `}},[D,F]);return{handleAmountChange:R,handleSelectToken:ue,fromBalanceInfo:x,toBalanceInfo:C,fromAmountValue:k,toAmountValue:M,doSwapAction:be,reCalculateRouteData:le,refreshMarketPrice:Ae,scamsText:K}}function XH(e){const{fromCoin:t,toCoin:r,fromAmount:n,toAmount:i,routerData:s}=tn(),{currentAccount:o}=rn(),a=he.useMemo(()=>{const c={text:"Swap",disabled:!1};if(!(o!=null&&o.address))return c.text="Connect Wallet",c.disabled=!1,c;if(!t||!r)return c.text="Select a token",c.disabled=!0,c;if(!+n&&!+i)return c.text="Enter an amount",c.disabled=!0,c;if(s&&s.errorCode){if(s.errorCode===Zo.InsufficientLiquidity)return c.text="Insufficient liquidity for this trade",c.disabled=!0,c;if(s.errorCode===Zo.NoRouter||s.errorCode===Zo.HoneyPot)return c.text="No Available Route",c.disabled=!0,c}return+n&&Fe(n).gt(e||0)?(c.disabled=!0,c.text=`Insufficient ${Ur(t==null?void 0:t.symbol)} Balance`,c):((!+n||!+i)&&(c.disabled=!0),c)},[o==null?void 0:o.address,n,i,e,s==null?void 0:s.errorCode,t,r]);return{btnText:a.text,btnDisabled:a.disabled}}const i7=878,zi=176,dd=72,Qo=22,JH=8,Ts=16,ZH=24,QH=12,eK=16,tK=8,rK=22,zr=50,Er=55,tc=13,$n=5;function s7(e,t,r){const[n,i]=he.useState({}),[s,o]=he.useState([]),[a,c]=he.useState([]),[u,l]=he.useState(0),{fromCoin:f,toCoin:p}=tn(),[v,w]=he.useState([]),[y,S]=he.useState([]);function A(h,d,m,x=3){const E=new Set;h.forEach(ie=>{E.add(ie.from),E.add(ie.target)});const C=[],k=[],M=new Set;h.forEach(ie=>{var le;if(ie.from===d&&ie.target!==m){const be=ie.target,Ae=h.some(F=>F.target===be&&F.from!==d);let D=!1;if(Ae){const F=new Set((le=h.filter(Q=>Q.from===be))==null?void 0:le.map(Q=>Q==null?void 0:Q.target));Array.from(F).every(Q=>Q===m)&&(D=!0)}D||M.add(be)}}),M.forEach(ie=>{const le={};h.forEach(be=>{be.from===d&&be.target===ie&&(le[d]||(le[d]=[]),le[d].push(be))}),Object.keys(le).forEach(be=>{const Ae=new Map;le[be].forEach(D=>{const F=D.provider,K=D.feeRate,te=`${F}_${K}`;if(Ae.has(te)){const Q=Ae.get(te);Q.amountIn=Fe(Q.amountIn).plus(D.amountIn||"0").toString(),Q.amountOut=Fe(Q.amountOut).plus(D.amountOut||"0").toString()}else Ae.set(te,{...D,amountIn:D.amountIn||"0",amountOut:D.amountOut||"0"})}),le[be]=Array.from(Ae.values())}),k.push({target:`0-${ie}`,originalTarget:ie,list:le})}),k.length>0&&C.push(k);const g=[],b=new Set;h.forEach(ie=>{ie.from!==d&&ie.from!==m&&b.add(ie.from),ie.target!==d&&ie.target!==m&&b.add(ie.target)}),b.forEach(ie=>{const le={};h.forEach(be=>{be.target===ie&&(be.from===d?M.has(ie)||(le[be.from]||(le[be.from]=[]),le[be.from].push(be)):(le[be.from]||(le[be.from]=[]),le[be.from].push(be)))}),Object.keys(le).length>0&&(Object.keys(le).forEach(be=>{const Ae=new Map;le[be].forEach(D=>{const F=D.provider,K=D.feeRate,te=`${F}_${K}`;if(Ae.has(te)){const Q=Ae.get(te);Q.amountIn=Fe(Q.amountIn).plus(D.amountIn||"0").toString(),Q.amountOut=Fe(Q.amountOut).plus(D.amountOut||"0").toString()}else Ae.set(te,{...D,amountIn:D.amountIn||"0",amountOut:D.amountOut||"0"})}),le[be]=Array.from(Ae.values())}),g.push({target:`1-${ie}`,originalTarget:ie,list:le}))}),g.length>0&&C.push(g);const R=[],ue={};return h.forEach(ie=>{ie.target===m&&(ue[ie.from]||(ue[ie.from]=[]),ue[ie.from].push(ie))}),Object.keys(ue).length>0&&(Object.keys(ue).forEach(ie=>{const le=new Map;ue[ie].forEach(be=>{const Ae=be.provider,D=be.feeRate,F=`${Ae}_${D}`;if(le.has(F)){const K=le.get(F);K.amountIn=Fe(K.amountIn).plus(be.amountIn||"0").toString(),K.amountOut=Fe(K.amountOut).plus(be.amountOut||"0").toString()}else le.set(F,{...be,amountIn:be.amountIn||"0",amountOut:be.amountOut||"0"})}),ue[ie]=Array.from(le.values())}),R.push({target:`2-${m}`,originalTarget:m,list:ue})),R.length>0&&C.push(R),C}function O(h,d,m){var b,R,ue;const x=h.length,E=x*zi+(x-1)*dd,C=(i7-E)/2,k=new Map,M=[],g=new Map;if(h.forEach((ie,le)=>{ie.forEach(be=>{const Ae=`${le}-${be.target}`,D=N(be.list);g.set(Ae,D)})}),x===1){const ie=h[0];let le=zr;ie.forEach(be=>{const Ae=`0-${be.target}`,D=g.get(Ae)||0;k.set(Ae,{...be,id:Ae,top:le,left:C,height:D,width:zi,columnIndex:0}),le+=D+Ts}),M.push(ie)}else if(x===2){const ie=h[0],le=h[1],be=le.some(K=>K.list&&K.list[d]),Ae=ie.map(K=>{var Q;const te=((Q=K.list[d])==null?void 0:Q.reduce((G,pe)=>G+parseFloat(pe.amountIn||"0"),0))||0;return{block:K,totalAmountIn:te}}).sort((K,te)=>te.totalAmountIn-K.totalAmountIn).map(({block:K})=>K);let D=be?zr+Qo:zr;Ae.forEach(K=>{const te=`0-${K.target}`,Q=g.get(te)||0;k.set(te,{...K,id:te,top:D,left:C,height:Q,width:zi,columnIndex:0}),D+=Q+Ts});let F=zr;le.forEach(K=>{const te=`1-${K.target}`,Q=g.get(te)||0;k.set(te,{...K,id:te,top:F,left:C+zi+dd,height:Q,width:zi,columnIndex:1}),F+=Q+Ts}),M.push(Ae,le)}else{const ie=h[0],le=h[1],be=h[2],Ae=((b=be[0])==null?void 0:b.originalTarget)||((R=be[0])==null?void 0:R.target),D=ie.map(de=>{var At,Rt;const Ee=de.originalTarget||de.target,je=`0-${de.target}`,Ve=g.get(je)||0,Je=le.some(He=>He.originalTarget==de.originalTarget),$e=((Rt=(At=be==null?void 0:be[0])==null?void 0:At.list)==null?void 0:Rt[de==null?void 0:de.originalTarget])&&!Je,Ge=le.some(He=>{const pt=He.originalTarget||He.target;return m.some(lt=>lt.from===Ee&<.target===pt)}),nt=[];le.forEach(He=>{const pt=He.originalTarget||He.target;m.some(lt=>lt.from===Ee&<.target===pt)&&nt.push(pt)});let et=6;if($e&&!Ge)et=1;else if($e&&Ge)et=2;else if(!$e&&Ge)if(nt.length===1){const He=nt[0],pt=le.find(tt=>(tt.originalTarget||tt.target)===He);(pt?Object.keys(pt.list||{}).length:0)===1?et=3:et=5}else nt.every(pt=>{const lt=le.find(ot=>(ot.originalTarget||ot.target)===pt);return(lt?Object.keys(lt.list||{}).length:0)===1})?et=4:et=6;return{block:de,target:Ee,height:Ve,hasDirectToTarget:$e,hasConnectionToSecond:Ge,secondColTargets:nt,priority:et}});D.sort((de,Ee)=>{var Je,$e;if(de.priority!==Ee.priority)return de.priority-Ee.priority;const je=((Je=de.block.list[d])==null?void 0:Je.reduce((Ge,nt)=>Ge+parseFloat(nt.amountIn||"0"),0))||0;return((($e=Ee.block.list[d])==null?void 0:$e.reduce((Ge,nt)=>Ge+parseFloat(nt.amountIn||"0"),0))||0)-je});const F=be.some(de=>(de.originalTarget||de.target)===Ae&&de.list&&de.list[d]),K=le.some(de=>de.list&&de.list[d]);let te=F?zr+Qo:zr;if(K){const de=le.find(Ee=>Ee.list&&Ee.list[d]);if(de)if(Object.keys(de.list||{}).length===1){const je=`1-${de.target}`,Ve=g.get(je)||0;te+=Ve+Ts}else te+=Qo}K&&D.length>0&&(D[0].hasDirectToTarget&&te<=zr+Qo?te+=50:te+=Ts);let Q=te;D.forEach((de,Ee)=>{const je=`0-${de.block.target}`,Ve=g.get(je)||0;k.set(je,{...de.block,id:je,top:Q,left:C,height:Ve,width:zi,columnIndex:0}),Ee<D.length-1&&(Q+=Ve+Ts)});const G=[],pe=le.find(de=>de.list&&de.list[d]);pe&&G.push(pe),D.forEach(de=>{de.secondColTargets.forEach(Ee=>{const je=le.find(Ve=>(Ve.originalTarget||Ve.target)===Ee);je&&!G.some(Ve=>Ve.target===je.target)&&G.push(je)})}),le.forEach(de=>{const Ee=de.originalTarget||de.target;G.some(je=>(je.originalTarget||je.target)===Ee)||G.push(de)});let X=F?zr+Qo:zr;D.some(de=>de.hasDirectToTarget&&de.hasConnectionToSecond)&&(X+=Qo);const U=(ue=D.filter(de=>de.hasDirectToTarget&&!de.hasConnectionToSecond))==null?void 0:ue.length;let oe=X;G.forEach((de,Ee)=>{const je=`1-${de.target}`,Ve=g.get(je)||0;Ee===0&&U>0&&(K?oe+=Qo:oe+=U*120+U*Ts),k.set(je,{...de,id:je,top:oe,left:C+zi+dd,height:Ve,width:zi,columnIndex:1}),oe+=Ve+Ts});let ye=zr;be.forEach(de=>{const Ee=`2-${de.target}`,je=g.get(Ee)||0;k.set(Ee,{...de,id:Ee,top:ye,left:C+2*zi+2*dd,height:je,width:zi,columnIndex:2}),ye+=je+Ts}),M.push(D.map(de=>de.block),G,be)}return{nodesMap:k,orderedNodeColume:M}}function j(h,d,m){const x={},E=[];if(h.forEach((C,k)=>{C.forEach(M=>{const g=M.originalTarget||M.target;if(M.list&&M.list[m]){const b=M.list[m].reduce((R,ue)=>R+parseFloat(ue.amountIn||"0"),0);E.push({target:g,amountIn:b,colIndex:k})}})}),E.length>0){const C=E.reduce((g,b)=>g+b.amountIn,0),k=[];E.forEach(({amountIn:g})=>{const b=C>0?wf(Fe(g).div(C).mul(100).toString(),0):0;k.push(Number(b)||1)});const M=Sf(k);E.forEach(({target:g},b)=>{var ue;const R=((ue=M[b])==null?void 0:ue.toString())||"0";x[m]||(x[m]={}),x[m][g]={fromPercent:R}})}return h.length>0&&h[0].forEach(k=>{const M=k.originalTarget||k.target,g=`0-${M}`,b=[];let R=!1;if(h.length>1&&(R=h[1].some(ie=>(ie.originalTarget||ie.target)===M)),R)h[1].forEach(ie=>{const le=ie.originalTarget||ie.target;if(ie.list&&ie.list[M]){const be=ie.list[M].reduce((Ae,D)=>Ae+parseFloat(D.amountIn||"0"),0);b.push({target:le,amountIn:be})}});else for(let ue=1;ue<h.length;ue++)h[ue].forEach(le=>{const be=le.originalTarget||le.target;if(le.list&&le.list[M]){const Ae=le.list[M].reduce((D,F)=>D+parseFloat(F.amountIn||"0"),0);b.push({target:be,amountIn:Ae})}});if(b.length>0){const ue=b.reduce((be,Ae)=>be+Ae.amountIn,0),ie=[];b.forEach(({amountIn:be})=>{const Ae=ue>0?wf(Fe(be).div(ue).mul(100).toString(),0):0;ie.push(Number(Ae)||1)});const le=Sf(ie);b.forEach(({target:be},Ae)=>{const D=le[Ae];x[g]||(x[g]={}),x[g][be]={fromPercent:D.toString()}})}}),h.length>2&&h[1].forEach(k=>{const M=k.originalTarget||k.target,g=`1-${M}`,b=[];if(h[2].forEach(ue=>{const ie=ue.originalTarget||ue.target;if(ue.list&&ue.list[M]){const le=ue.list[M].reduce((be,Ae)=>be+parseFloat(Ae.amountIn||"0"),0);b.push({target:ie,amountIn:le})}}),b.length>0){const ue=b.reduce((be,Ae)=>be+Ae.amountIn,0),ie=[];b.forEach(({amountIn:be})=>{const Ae=ue>0?wf(Fe(be).div(ue).mul(100).toString(),0):0;ie.push(Number(Ae)||1)});const le=Sf(ie);b.forEach(({target:be},Ae)=>{const D=le[Ae];x[g]||(x[g]={}),x[g][be]={fromPercent:D.toString()}})}}),x}function V(h,d,m){for(const[x,E]of m.entries())if(x.startsWith(`${h}-`)&&(E.originalTarget===d||E.target===d))return E;return null}function B(h,d,m,x,E){var ue,ie,le,be,Ae,D;const C=[],k=((ie=(ue=x[x.length-1])==null?void 0:ue[0])==null?void 0:ie.originalTarget)||((be=(le=x[x.length-1])==null?void 0:le[0])==null?void 0:be.target);if(k){const F=V(x.length-1,k,d);if(F){const K=((D=(Ae=h[m])==null?void 0:Ae[k])==null?void 0:D.fromPercent)||"0";x.length>0&&x[x.length-1].some(Q=>(Q.originalTarget||Q.target)===k&&Q.list&&Q.list[m])&&(x.length===1&&x[0].length===1?C.push({from:m,to:F.id,fromX:tc,fromY:F.top+F.height/2,toX:F.left-$n,toY:F.top+F.height/2,fromPercent:K,isStart:!0}):C.push({from:m,to:F.id,fromX:tc,fromY:zr+10,toX:F.left-$n,toY:zr+10,fromPercent:K,isStart:!0}))}}for(let F=0;F<x.length;F++)x[F].forEach(te=>{var J,U;const Q=te.originalTarget||te.target,G=V(F,Q,d);if(!G||!(te.list&&te.list[m])||Q===k)return;const X=((U=(J=h[m])==null?void 0:J[Q])==null?void 0:U.fromPercent)||"0";x.length>2&&F===1?Object.keys(te.list||{}).length===1?C.push({from:m,to:G.id,fromX:tc,fromY:G.top+G.height/2,toX:G.left-$n,toY:G.top+G.height/2,fromPercent:X,isStart:!0}):C.push({from:m,to:G.id,fromX:tc,fromY:G.top+10,toX:G.left-$n,toY:G.top+10,fromPercent:X,isStart:!0}):C.push({from:m,to:G.id,fromX:tc,fromY:G.top+G.height/2,toX:G.left-$n,toY:G.top+G.height/2,fromPercent:X,isStart:!0})});const M=new Map,g=new Map;for(let F=0;F<x.length;F++)x[F].forEach(te=>{const Q=te.originalTarget||te.target;if(!V(F,Q,d))return;const pe=te.list||{};Object.entries(pe).forEach(([X,J])=>{if(X===m)return;let U=null;for(let de=F-1;de>=0&&(U=V(de,X,d),!U);de--);if(!U)return;const oe=U.id,ye=M.get(oe)||0;M.set(oe,ye+1)})});for(let F=0;F<x.length;F++)x[F].forEach(te=>{const Q=te.originalTarget||te.target,G=V(F,Q,d);if(!G)return;const pe=te.list||{};Object.entries(pe).forEach(([X,J])=>{var je,Ve,Je,$e,Ge,nt,et,At,Rt,He,pt,lt,tt,ot;if(X===m)return;let U=null;for(let gt=F-1;gt>=0&&(U=V(gt,X,d),!U);gt--);if(!U)return;const oe=U.id,ye=U.top+U.height/2;let de=!1;const Ee=g.get(oe)||0;if(g.set(oe,Ee+1),x.length===3&&U.columnIndex===0&&G.columnIndex===2){const gt=(je=x[0])==null?void 0:je[0];if(gt&&(U.originalTarget||U.target)===(gt.originalTarget||gt.target))if(x.length>1&&x[1].some(yt=>yt.list&&yt.list[m]))de=!0;else{de=!1;const yt=((Je=(Ve=h[`${U.columnIndex}-${U.originalTarget||U.target}`])==null?void 0:Ve[Q])==null?void 0:Je.fromPercent)||"0";C.push({from:U.id,to:G.id,fromX:U.left+U.width,fromY:U.top+10,toX:G.left,toY:U.top+10,fromPercent:yt})}else if(ye>=G.top&&ye<=G.top+G.height){const st=((Ge=($e=h[`${U.columnIndex}-${U.originalTarget||U.target}`])==null?void 0:$e[Q])==null?void 0:Ge.fromPercent)||"0";C.push({from:U.id,to:G.id,fromX:U.left+U.width,fromY:ye,toX:G.left-$n,toY:ye,fromPercent:st})}else{let st=!1;for(let yt=U.top;yt<=U.top+U.height;yt+=5)if(yt>=G.top&&yt<=G.top+G.height){const Nt=((et=(nt=h[`${U.columnIndex}-${U.originalTarget||U.target}`])==null?void 0:nt[Q])==null?void 0:et.fromPercent)||"0";C.push({from:U.id,to:G.id,fromX:U.left+U.width,fromY:yt,toX:G.left-$n,toY:yt,fromPercent:Nt}),st=!0;break}st||(de=!0)}}else if(ye>=G.top&&ye<=G.top+G.height){const gt=((Rt=(At=h[`${U.columnIndex}-${U.originalTarget||U.target}`])==null?void 0:At[Q])==null?void 0:Rt.fromPercent)||"0";C.push({from:U.id,to:G.id,fromX:U.left+U.width,fromY:ye,toX:G.left,toY:ye,fromPercent:gt})}else{let gt=!1;for(let st=U.top;st<=U.top+U.height;st+=5)if(st>G.top+10&&st<G.top+G.height-10){const yt=((pt=(He=h[`${U.columnIndex}-${U.originalTarget||U.target}`])==null?void 0:He[Q])==null?void 0:pt.fromPercent)||"0";C.push({from:U.id,to:G.id,fromX:U.left+U.width,fromY:st,toX:G.left,toY:st,fromPercent:yt}),gt=!0;break}gt||(de=!0)}if(de){const gt=((tt=(lt=h[`${U.columnIndex}-${U.originalTarget||U.target}`])==null?void 0:lt[Q])==null?void 0:tt.fromPercent)||"0",st=M.get(oe)||1,yt=g.get(oe)||0,Nt=50,mt=U.top+10,It=U.height-20,Bt=st>3?Math.min(Nt,It/Math.max(1,st-1)):Nt,Xe=mt+yt*Bt;if(x.length===3&&U.columnIndex===0&&G.columnIndex===2){const jt=(ot=x[0])==null?void 0:ot[0];if(jt&&(U.originalTarget||U.target)===(jt.originalTarget||jt.target)){const Ut=U.left+U.width/2,L=U.top;C.push({from:U.id,to:G.id,fromX:Ut,fromY:L,toX:G.left,toY:zr+10,fromPercent:gt,segments:[{x1:Ut,y1:L,x2:Ut,y2:zr+10},{x1:Ut,y1:zr+10,x2:G.left-$n,y2:zr+10}]})}else G.top>U.top+U.height?C.push({from:U.id,to:G.id,fromX:U.left+U.width,fromY:Xe,toX:U.left+U.width+Er,toY:Xe,fromPercent:gt,segments:[{x1:U.left+U.width,y1:Xe,x2:U.left+U.width+Er,y2:Xe},{x1:U.left+U.width+Er,y1:Xe,x2:U.left+U.width+Er,y2:G.top+20},{x1:U.left+U.width+Er,y1:G.top+20,x2:G.left,y2:G.top+20}]}):C.push({from:U.id,to:G.id,fromX:U.left+U.width,fromY:Xe,toX:U.left+U.width+Er,toY:Xe,fromPercent:gt,segments:[{x1:U.left+U.width,y1:Xe,x2:U.left+U.width+Er,y2:Xe},{x1:U.left+U.width+Er,y1:Xe,x2:U.left+U.width+Er,y2:G.top+G.height-20},{x1:U.left+U.width+Er,y1:G.top+G.height-20,x2:G.left-$n,y2:G.top+G.height-20}]})}else x.length===3&&U.columnIndex===1&&G.columnIndex===2&&G.top<U.top?C.push({from:U.id,to:G.id,fromX:U.left+U.width,fromY:Xe,toX:G.left+G.width/2,toY:Xe,fromPercent:gt,segments:[{x1:U.left+U.width,y1:Xe,x2:G.left+G.width/2,y2:Xe},{x1:G.left+G.width/2,y1:Xe,x2:G.left+G.width/2,y2:G.top+G.height+$n}]}):G.top>U.top+U.height?C.push({from:U.id,to:G.id,fromX:U.left+U.width,fromY:Xe,toX:U.left+U.width+Er,toY:Xe,fromPercent:gt,segments:[{x1:U.left+U.width,y1:Xe,x2:U.left+U.width+Er,y2:Xe},{x1:U.left+U.width+Er,y1:Xe,x2:U.left+U.width+Er,y2:G.top+20},{x1:U.left+U.width+Er,y1:G.top+20,x2:G.left-$n,y2:G.top+20}]}):C.push({from:U.id,to:G.id,fromX:U.left+U.width,fromY:Xe,toX:U.left+U.width+Er,toY:Xe,fromPercent:gt,segments:[{x1:U.left+U.width,y1:Xe,x2:U.left+U.width+Er,y2:Xe},{x1:U.left+U.width+Er,y1:Xe,x2:U.left+U.width+Er,y2:G.top+G.height-20},{x1:U.left+U.width+Er,y1:G.top+G.height-20,x2:G.left-$n,y2:G.top+G.height-20}]})}})});const b=Math.max(...Array.from(d.values()).map(F=>F.columnIndex)),R=Array.from(d.values()).filter(F=>F.columnIndex===b);if(R.length>0){const F=R[0],K=F.top+F.height/2;C.push({from:F.id,to:"final",fromX:F.left+F.width,fromY:K,toX:i7-tc,toY:K,fromPercent:"100",isFinal:!0})}return{edges:C}}function H(h){if(h.length===0)return 0;let d=1/0,m=-1/0;return h.forEach(x=>{d=Math.min(d,x.top),m=Math.max(m,x.top+x.height)}),m-d}const q=async()=>{var ue;const h=(ue=e==null?void 0:e.routerData)==null?void 0:ue.paths;if(!h||(h==null?void 0:h.length)===0)return;const d=v_((f==null?void 0:f.coin_type)||t||""),m=v_((p==null?void 0:p.coin_type)||r||""),x=A(h,d,m,3),{nodesMap:E,orderedNodeColume:C}=O(x,d,h);S(C);const k=j(C,h,d),{edges:M}=B(k,E,d,C),g=[...E.values()],b=H([...E.values()])+zr+32;l(b),o(g),c(M);const R=Array.from(new Set([...E.values()].map(ie=>ie.originalTarget||ie.target)));fe([...R,d])},{getTokenListInfo:ne}=Va(),[ge,se]=he.useState(new Map),fe=async h=>{const d=await ne(h);d&&(d==null?void 0:d.size)>0&&se(d)};he.useEffect(()=>{var h;q(),z(((h=e==null?void 0:e.routerData)==null?void 0:h.paths)||[])},[e]);function z(h){if(!Array.isArray(h))return[];const d=new Set;h.forEach(m=>{m.provider&&d.add(m.provider)}),w(Array.from(d))}function N(h){let d=JH*2+ZH;const m=Object.entries(h);return m.forEach(([x,E],C)=>{d+=QH*2,d+=eK,d+=10,E.forEach(k=>{d+=rK})}),d+((m==null?void 0:m.length)-1)*tK+10}return{newFormatSwapRouter:n,nodes:s,edges:a,tokenMap:ge,panelHeight:u,getAllProviders:z,allProviders:v,resultColumes:y}}function nK({themeType:e}){const t=e=="Light"?Pt("/images/logo_light@2x.png"):Pt("/images/logo@2x.png");return _.jsxs("div",{style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",marginTop:"16px"},children:[_.jsx("span",{style:{fontSize:"12px",color:"var(--cs-text-primary)",fontWeight:"500",marginRight:"8px"},children:"Powered by"}),_.jsx("img",{style:{height:"20px"},src:t})]})}function ag({baseToken:e,quoteToken:t,baseAmount:r,quoteAmount:n,loading:i,fontSize:s="14px"}){const[o,a]=he.useState(!0),c=Q5(o,r,n);return _.jsxs("div",{className:"current-price-block",style:{cursor:"pointer"},onClick:()=>{a(!o)},children:[_.jsx(Pr,{src:o?e==null?void 0:e.logo_url:t==null?void 0:t.logo_url,token:o?e:t,showWarnSize:"10px"}),_.jsxs("span",{style:{display:"flex",alignItems:"center",color:"var(--cs-text-primary)",fontSize:s,maxWidth:"80%"},children:["1"," ",Ur(o?e==null?void 0:e.symbol:t==null?void 0:t.symbol)," ","="," ",i?_.jsx(Xo,{className:"custom-skeleton",style:{height:"16px",width:"40px",marginLeft:"2px",marginRight:"2px"}}):hn(c,t==null?void 0:t.decimals)," ",Ur(o?t==null?void 0:t.symbol:e==null?void 0:e.symbol)]}),_.jsx(Pr,{src:o?t==null?void 0:t.logo_url:e==null?void 0:e.logo_url,token:o?t:e,showWarnSize:"8px"}),_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-swap"})})]})}function rc(){const[e,t]=he.useState(window.innerWidth),r=og(()=>{t(window.innerWidth)},300);he.useEffect(()=>(window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r)}),[]);const n=he.useMemo(()=>e<810,[e]);return{windowWidth:e,isApp:n}}function hd({content:e,children:t,position:r,autoSwitchTooltip:n=!1,borderRadius:i="8px"}){const{isApp:s}=rc();return s&&n?_.jsxs(Es.Root,{children:[_.jsx(Es.Trigger,{children:_.jsx("button",{style:{background:"none",border:"none",padding:"0",margin:"0",outline:"none",boxShadow:"none",color:"inherit",font:"inherit",textAlign:"inherit"},children:t})}),_.jsx(Es.Content,{variant:"soft",style:{transition:"opacity 0.3s ease",display:"block",zIndex:9e3,padding:"8px 12px",backgroundColor:"var(--cs-bg-primary)",color:"var(--cs-text-secondary)",borderRadius:i,fontSize:"12px",whiteSpace:"nowrap",border:"1px solid",borderColor:"var(--cs-border)",boxShadow:"0px 2px 10px rgba(0, 0, 0, 0.1)"},side:r,align:"center",children:e})]}):_.jsx(Jo,{content:e,position:r,borderRadius:i,children:t})}function iK({pr:e="8px",pl:t="8px",value:r,isLoading:n}){const{isApp:i}=rc();return _.jsxs("div",{className:"swap-info-between",style:{paddingLeft:t,paddingRight:e},children:[_.jsxs("div",{className:"left",children:[_.jsx("span",{children:"Overlay Fee"}),_.jsx(hd,{autoSwitchTooltip:!0,position:"top",content:_.jsx("div",{style:{color:"var(--cs-text-secondary)",fontSize:"12px",lineHeight:"18px",width:i?"200px":"280px",textAlign:"start",whiteSpace:"normal"},children:"Fees charged by the integrator, which has been deducted from the output."}),children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{cursor:"pointer",width:"20px",height:"20px"},children:_.jsx("use",{xlinkHref:"#icon-tips"})})})]}),n?_.jsx(Xo,{className:"custom-skeleton",style:{height:"18px",width:"80px"}}):_.jsx("div",{className:"right",children:r?`${Fe(r).mul(100).toString()}%`:""})]})}function o7(e,t,r,n){const{getTokenPrice:i}=Cu(),s=i(e==null?void 0:e.coin_type),o=i(t==null?void 0:t.coin_type),a=Q5(!0,r,n),c=he.useMemo(()=>{if(o&&s)return Fe(s.price).div(o.price).toString()},[s==null?void 0:s.price,o==null?void 0:o.price]),u=he.useMemo(()=>{if(c&&+a)return Fe(a).sub(c).div(a).mul(100).toFixed(10)},[c,a]),l=he.useMemo(()=>{const y=[];return s&&y.push(s.market),o&&!y.includes(o.market)&&y.push(o.market),y},[s==null?void 0:s.market,o==null?void 0:o.market]),f=he.useMemo(()=>!s||!o||s.market==="cetus"||o.market==="cetus",[s,o]),p=he.useMemo(()=>f?!1:u&&Fe(u).lt(0)?Fe(u).abs().gt(5):!1,[u,f]),v=he.useMemo(()=>f?!1:u&&Fe(u).lt(0)?Fe(u).abs().gt(10):!1,[u,f]),w=he.useMemo(()=>{let y,S="yellow";if(f)return{priceImpactText:void 0,textColor:"yellow"};if(u)if(Fe(u).gt(0))S="green",Fe(u).lt(.1)?y="< 0.1% cheaper than":y=`${hn(u,2,!0,Br.ROUND_UP)}% cheaper than`;else if(Fe(u).eq(0))y="0%",S="green";else{const A=Fe(u).abs();A.lte(5)?(S="green",y=`Within ${hn(A.toString(),2,!0,Br.ROUND_UP)}%`):A.lte(10)?(S="yellow",y=`${hn(A.toString(),2,!0,Br.ROUND_UP)}% more than`):A.lte(100)?(S="red",y=`${hn(A.toString(),2,!0,Br.ROUND_UP)}% more than`):(S="red",y="> 100% more than")}return{priceImpactText:y,textColor:S}},[u,f]);return{swapPrice:a,marketPrice:c,priceImpact:u,sources:l,showPriceImpactTips:p,showPriceImpactWarn:v,priceImpactTextInfo:w,showIncalculable:f}}function a7({isLoading:e,routerData:t,noTips:r}){const{fromCoin:n,toCoin:i,fromAmount:s,toAmount:o}=tn();rc();const{priceImpact:a,sources:c,marketPrice:u,priceImpactTextInfo:l,showIncalculable:f}=o7(n,i,t==null?void 0:t.fromAmountUi,t==null?void 0:t.toAmountUi);return _.jsxs(_.Fragment,{children:[!r&&Fe(a).lte(-30)&&!f&&_.jsx("div",{className:"price-impact-tips red",children:"High price difference. Be cautious before submitting your order."}),_.jsxs("div",{className:"price-impact-block",children:[_.jsxs("div",{className:"left",children:[_.jsx("span",{style:{color:"var(--cs-text-secondary)"},children:"Price Difference"}),_.jsx(hd,{autoSwitchTooltip:!0,position:"top",content:_.jsx(sK,{fromToken:n,toToken:i,sources:c,baseAmount:"1",quoteAmount:u,showIncalculable:f}),children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{cursor:"pointer",width:"20px",height:"20px"},children:_.jsx("use",{xlinkHref:"#icon-tips"})})})]}),_.jsxs("div",{children:[e&&_.jsx(Xo,{className:"custom-skeleton",style:{width:"80px",height:"20px"}}),!e&&_.jsxs("div",{className:"right",children:[_.jsx("span",{className:l==null?void 0:l.textColor,children:l.priceImpactText&&!f?l==null?void 0:l.priceImpactText:"Incalculable"}),l.priceImpactText&&!f&&_.jsx("div",{className:"platforms",children:c.map(p=>_.jsx(Jo,{content:_.jsx("span",{style:{fontSize:"12px",color:"var(--cs-text-primary)"},children:E_[p]}),position:"top",delay:300,children:_.jsx(Pr,{src:hF[p],haveBorder:!1,style:{width:"16px",height:"16px"}})},p))})]})]})]})]})}function sK({fromToken:e,toToken:t,baseAmount:r,quoteAmount:n,sources:i,showIncalculable:s}){const{isApp:o}=rc();return _.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[_.jsx("p",{style:{color:"var(--cs-text-secondary)",fontSize:"12px",lineHeight:"18px",width:o?"200px":"300px",textAlign:"start",whiteSpace:"normal"},children:"The difference between the market price and estimated price due to trade size."}),!s&&_.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start"},children:[_.jsx("p",{style:{fontSize:"12px",color:"var(--cs-text-primary)"},children:"Market price sources:"}),r&&n?_.jsx(ag,{baseToken:e,quoteToken:t,baseAmount:"1",quoteAmount:n,loading:!1,fontSize:"12px"}):_.jsx("p",{style:{color:"var(--cs-text-primary)",fontSize:"12px"},children:"Price is unknown"})]}),!s&&_.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[_.jsx("p",{style:{color:"var(--cs-text-secondary)",fontSize:"12px",whiteSpace:"pre"},children:"Market price sources:"}),_.jsx("p",{style:{color:"var(--cs-text-secondary)",fontSize:"12px",whiteSpace:"pre"},children:i.map(a=>E_[a]+" ").join("")})]})]})}function c7({pr:e="8px",pl:t="8px",amountLimit:r,isLoading:n}){const{fromCoin:i,toCoin:s,byAmountIn:o}=tn();return _.jsxs("div",{className:"swap-info-between",style:{paddingLeft:t,paddingRight:e},children:[_.jsx("div",{className:"left",children:o?"Minimum Received":"Maximum Sold"}),n?_.jsx(Xo,{className:"custom-skeleton",style:{height:"18px",width:"80px"}}):_.jsxs("div",{className:"right",children:[hn(r,o?s==null?void 0:s.decimals:i==null?void 0:i.decimals,!1,Br.ROUND_DOWN)," ",Ur(o?(s==null?void 0:s.symbol)||"":(i==null?void 0:i.symbol)||"")]})]})}function oK({scamsText:e}){return _.jsxs("div",{style:{marginTop:"16px",borderRadius:"8px",border:"1px solid var(--cs-border)",paddingTop:"12px",width:"100%",backgroundColor:"var(--cs-bg-secondary-common)"},children:[_.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"0 12px",justifyContent:"center",textAlign:"center"},children:[_.jsx("svg",{className:"cs-icon",style:{width:"20px",height:"20px",fill:"var(--cs-warning)"},"aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-alert"})}),_.jsx("span",{style:{color:"var(--cs-warning)",marginLeft:"4px"},children:"Alert"})]}),_.jsx("div",{style:{borderRadius:"8px",padding:"11px",margin:"-1px",marginTop:"14px",border:"1px solid var(--cs-border)",lineHeight:"1"},children:_.jsx(A_,{text:`${e} detected to have Deny List feature. It's an optional feature on Sui designed for regulated coins (learn more). However, it could be misused by HoneyPot scams, which may restrict users from selling the tokens after buying. Please be cautious.`,keywords:["learn more"],onKeywordClick:t=>{window.open("https://docs.sui.io/guides/developer/coin/regulated","_blank")}})})]})}function aK({onClick:e}){return _.jsxs("div",{className:"cs-icon-button cs-back-button",onClick:t=>{t.stopPropagation(),e()},children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-back"})}),_.jsx("span",{children:"Back"})]})}function cg({title:e,backClick:t}){return _.jsxs("div",{className:"cs-have-back-header",children:[_.jsx(aK,{onClick:t}),_.jsx("span",{className:"title",children:e})]})}const pd=globalThis||void 0||self;var cK=typeof pd=="object"&&pd&&pd.Object===Object&&pd;const u7=cK;var uK=typeof self=="object"&&self&&self.Object===Object&&self,lK=u7||uK||Function("return this")();const qi=lK;var fK=qi.Symbol;const Wi=fK;var l7=Object.prototype,dK=l7.hasOwnProperty,hK=l7.toString,Au=Wi?Wi.toStringTag:void 0;function pK(e){var t=dK.call(e,Au),r=e[Au];try{e[Au]=void 0;var n=!0}catch{}var i=hK.call(e);return n&&(t?e[Au]=r:delete e[Au]),i}var mK=Object.prototype,gK=mK.toString;function yK(e){return gK.call(e)}var vK="[object Null]",bK="[object Undefined]",f7=Wi?Wi.toStringTag:void 0;function nc(e){return e==null?e===void 0?bK:vK:f7&&f7 in Object(e)?pK(e):yK(e)}function ho(e){return e!=null&&typeof e=="object"}var wK="[object Symbol]";function Iu(e){return typeof e=="symbol"||ho(e)&&nc(e)==wK}function md(e,t){for(var r=-1,n=e==null?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}var _K=Array.isArray;const mn=_K;var xK=1/0,d7=Wi?Wi.prototype:void 0,h7=d7?d7.toString:void 0;function p7(e){if(typeof e=="string")return e;if(mn(e))return md(e,p7)+"";if(Iu(e))return h7?h7.call(e):"";var t=e+"";return t=="0"&&1/e==-xK?"-0":t}function ic(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function m7(e){return e}var SK="[object AsyncFunction]",EK="[object Function]",TK="[object GeneratorFunction]",CK="[object Proxy]";function g7(e){if(!ic(e))return!1;var t=nc(e);return t==EK||t==TK||t==SK||t==CK}var AK=qi["__core-js_shared__"];const ug=AK;var y7=function(){var e=/[^.]+$/.exec(ug&&ug.keys&&ug.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function IK(e){return!!y7&&y7 in e}var MK=Function.prototype,OK=MK.toString;function ea(e){if(e!=null){try{return OK.call(e)}catch{}try{return e+""}catch{}}return""}var jK=/[\\^$.*+?()[\]{}|]/g,kK=/^\[object .+?Constructor\]$/,PK=Function.prototype,RK=Object.prototype,NK=PK.toString,DK=RK.hasOwnProperty,$K=RegExp("^"+NK.call(DK).replace(jK,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function LK(e){if(!ic(e)||IK(e))return!1;var t=g7(e)?$K:kK;return t.test(ea(e))}function BK(e,t){return e==null?void 0:e[t]}function ta(e,t){var r=BK(e,t);return LK(r)?r:void 0}var UK=ta(qi,"WeakMap");const lg=UK;var v7=Object.create,FK=function(){function e(){}return function(t){if(!ic(t))return{};if(v7)return v7(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();const VK=FK;function zK(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var qK=function(){try{var e=ta(Object,"defineProperty");return e({},"",{}),e}catch{}}();const b7=qK;function WK(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}var GK=9007199254740991,HK=/^(?:0|[1-9]\d*)$/;function w7(e,t){var r=typeof e;return t=t??GK,!!t&&(r=="number"||r!="symbol"&&HK.test(e))&&e>-1&&e%1==0&&e<t}function _7(e,t,r){t=="__proto__"&&b7?b7(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function fg(e,t){return e===t||e!==e&&t!==t}var KK=Object.prototype,YK=KK.hasOwnProperty;function x7(e,t,r){var n=e[t];(!(YK.call(e,t)&&fg(n,r))||r===void 0&&!(t in e))&&_7(e,t,r)}function gd(e,t,r,n){var i=!r;r||(r={});for(var s=-1,o=t.length;++s<o;){var a=t[s],c=n?n(r[a],e[a],a,r,e):void 0;c===void 0&&(c=e[a]),i?_7(r,a,c):x7(r,a,c)}return r}var XK=9007199254740991;function dg(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=XK}function yd(e){return e!=null&&dg(e.length)&&!g7(e)}var JK=Object.prototype;function hg(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||JK;return e===r}function ZK(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var QK="[object Arguments]";function S7(e){return ho(e)&&nc(e)==QK}var E7=Object.prototype,eY=E7.hasOwnProperty,tY=E7.propertyIsEnumerable,rY=S7(function(){return arguments}())?S7:function(e){return ho(e)&&eY.call(e,"callee")&&!tY.call(e,"callee")};const T7=rY;function nY(){return!1}var C7=typeof Kt=="object"&&Kt&&!Kt.nodeType&&Kt,A7=C7&&typeof module=="object"&&module&&!module.nodeType&&module,iY=A7&&A7.exports===C7,I7=iY?qi.Buffer:void 0,sY=I7?I7.isBuffer:void 0,oY=sY||nY;const vd=oY;var aY="[object Arguments]",cY="[object Array]",uY="[object Boolean]",lY="[object Date]",fY="[object Error]",dY="[object Function]",hY="[object Map]",pY="[object Number]",mY="[object Object]",gY="[object RegExp]",yY="[object Set]",vY="[object String]",bY="[object WeakMap]",wY="[object ArrayBuffer]",_Y="[object DataView]",xY="[object Float32Array]",SY="[object Float64Array]",EY="[object Int8Array]",TY="[object Int16Array]",CY="[object Int32Array]",AY="[object Uint8Array]",IY="[object Uint8ClampedArray]",MY="[object Uint16Array]",OY="[object Uint32Array]",rr={};rr[xY]=rr[SY]=rr[EY]=rr[TY]=rr[CY]=rr[AY]=rr[IY]=rr[MY]=rr[OY]=!0,rr[aY]=rr[cY]=rr[wY]=rr[uY]=rr[_Y]=rr[lY]=rr[fY]=rr[dY]=rr[hY]=rr[pY]=rr[mY]=rr[gY]=rr[yY]=rr[vY]=rr[bY]=!1;function jY(e){return ho(e)&&dg(e.length)&&!!rr[nc(e)]}function bd(e){return function(t){return e(t)}}var M7=typeof Kt=="object"&&Kt&&!Kt.nodeType&&Kt,Mu=M7&&typeof module=="object"&&module&&!module.nodeType&&module,kY=Mu&&Mu.exports===M7,pg=kY&&u7.process,PY=function(){try{var e=Mu&&Mu.require&&Mu.require("util").types;return e||pg&&pg.binding&&pg.binding("util")}catch{}}();const sc=PY;var O7=sc&&sc.isTypedArray,RY=O7?bd(O7):jY;const j7=RY;var NY=Object.prototype,DY=NY.hasOwnProperty;function k7(e,t){var r=mn(e),n=!r&&T7(e),i=!r&&!n&&vd(e),s=!r&&!n&&!i&&j7(e),o=r||n||i||s,a=o?ZK(e.length,String):[],c=a.length;for(var u in e)(t||DY.call(e,u))&&!(o&&(u=="length"||i&&(u=="offset"||u=="parent")||s&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||w7(u,c)))&&a.push(u);return a}function P7(e,t){return function(r){return e(t(r))}}var $Y=P7(Object.keys,Object);const LY=$Y;var BY=Object.prototype,UY=BY.hasOwnProperty;function FY(e){if(!hg(e))return LY(e);var t=[];for(var r in Object(e))UY.call(e,r)&&r!="constructor"&&t.push(r);return t}function Ou(e){return yd(e)?k7(e):FY(e)}function VY(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var zY=Object.prototype,qY=zY.hasOwnProperty;function WY(e){if(!ic(e))return VY(e);var t=hg(e),r=[];for(var n in e)n=="constructor"&&(t||!qY.call(e,n))||r.push(n);return r}function mg(e){return yd(e)?k7(e,!0):WY(e)}var GY=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,HY=/^\w*$/;function gg(e,t){if(mn(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||Iu(e)?!0:HY.test(e)||!GY.test(e)||t!=null&&e in Object(t)}var KY=ta(Object,"create");const ju=KY;function YY(){this.__data__=ju?ju(null):{},this.size=0}function XY(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var JY="__lodash_hash_undefined__",ZY=Object.prototype,QY=ZY.hasOwnProperty;function eX(e){var t=this.__data__;if(ju){var r=t[e];return r===JY?void 0:r}return QY.call(t,e)?t[e]:void 0}var tX=Object.prototype,rX=tX.hasOwnProperty;function nX(e){var t=this.__data__;return ju?t[e]!==void 0:rX.call(t,e)}var iX="__lodash_hash_undefined__";function sX(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=ju&&t===void 0?iX:t,this}function ra(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}ra.prototype.clear=YY,ra.prototype.delete=XY,ra.prototype.get=eX,ra.prototype.has=nX,ra.prototype.set=sX;function oX(){this.__data__=[],this.size=0}function wd(e,t){for(var r=e.length;r--;)if(fg(e[r][0],t))return r;return-1}var aX=Array.prototype,cX=aX.splice;function uX(e){var t=this.__data__,r=wd(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():cX.call(t,r,1),--this.size,!0}function lX(e){var t=this.__data__,r=wd(t,e);return r<0?void 0:t[r][1]}function fX(e){return wd(this.__data__,e)>-1}function dX(e,t){var r=this.__data__,n=wd(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function Cs(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Cs.prototype.clear=oX,Cs.prototype.delete=uX,Cs.prototype.get=lX,Cs.prototype.has=fX,Cs.prototype.set=dX;var hX=ta(qi,"Map");const ku=hX;function pX(){this.size=0,this.__data__={hash:new ra,map:new(ku||Cs),string:new ra}}function mX(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function _d(e,t){var r=e.__data__;return mX(t)?r[typeof t=="string"?"string":"hash"]:r.map}function gX(e){var t=_d(this,e).delete(e);return this.size-=t?1:0,t}function yX(e){return _d(this,e).get(e)}function vX(e){return _d(this,e).has(e)}function bX(e,t){var r=_d(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function As(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}As.prototype.clear=pX,As.prototype.delete=gX,As.prototype.get=yX,As.prototype.has=vX,As.prototype.set=bX;var wX="Expected a function";function yg(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(wX);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var o=e.apply(this,n);return r.cache=s.set(i,o)||s,o};return r.cache=new(yg.Cache||As),r}yg.Cache=As;var _X=500;function xX(e){var t=yg(e,function(n){return r.size===_X&&r.clear(),n}),r=t.cache;return t}var SX=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,EX=/\\(\\)?/g,TX=xX(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(SX,function(r,n,i,s){t.push(i?s.replace(EX,"$1"):n||r)}),t});const CX=TX;function AX(e){return e==null?"":p7(e)}function R7(e,t){return mn(e)?e:gg(e,t)?[e]:CX(AX(e))}var IX=1/0;function xd(e){if(typeof e=="string"||Iu(e))return e;var t=e+"";return t=="0"&&1/e==-IX?"-0":t}function vg(e,t){t=R7(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[xd(t[r++])];return r&&r==n?e:void 0}function MX(e,t,r){var n=e==null?void 0:vg(e,t);return n===void 0?r:n}function N7(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var OX=P7(Object.getPrototypeOf,Object);const D7=OX;function jX(){this.__data__=new Cs,this.size=0}function kX(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function PX(e){return this.__data__.get(e)}function RX(e){return this.__data__.has(e)}var NX=200;function DX(e,t){var r=this.__data__;if(r instanceof Cs){var n=r.__data__;if(!ku||n.length<NX-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new As(n)}return r.set(e,t),this.size=r.size,this}function Gi(e){var t=this.__data__=new Cs(e);this.size=t.size}Gi.prototype.clear=jX,Gi.prototype.delete=kX,Gi.prototype.get=PX,Gi.prototype.has=RX,Gi.prototype.set=DX;function $X(e,t){return e&&gd(t,Ou(t),e)}function LX(e,t){return e&&gd(t,mg(t),e)}var $7=typeof Kt=="object"&&Kt&&!Kt.nodeType&&Kt,L7=$7&&typeof module=="object"&&module&&!module.nodeType&&module,BX=L7&&L7.exports===$7,B7=BX?qi.Buffer:void 0,U7=B7?B7.allocUnsafe:void 0;function UX(e,t){if(t)return e.slice();var r=e.length,n=U7?U7(r):new e.constructor(r);return e.copy(n),n}function F7(e,t){for(var r=-1,n=e==null?0:e.length,i=0,s=[];++r<n;){var o=e[r];t(o,r,e)&&(s[i++]=o)}return s}function V7(){return[]}var FX=Object.prototype,VX=FX.propertyIsEnumerable,z7=Object.getOwnPropertySymbols,zX=z7?function(e){return e==null?[]:(e=Object(e),F7(z7(e),function(t){return VX.call(e,t)}))}:V7;const bg=zX;function qX(e,t){return gd(e,bg(e),t)}var WX=Object.getOwnPropertySymbols,GX=WX?function(e){for(var t=[];e;)N7(t,bg(e)),e=D7(e);return t}:V7;const q7=GX;function HX(e,t){return gd(e,q7(e),t)}function W7(e,t,r){var n=t(e);return mn(e)?n:N7(n,r(e))}function wg(e){return W7(e,Ou,bg)}function KX(e){return W7(e,mg,q7)}var YX=ta(qi,"DataView");const _g=YX;var XX=ta(qi,"Promise");const xg=XX;var JX=ta(qi,"Set");const Sg=JX;var G7="[object Map]",ZX="[object Object]",H7="[object Promise]",K7="[object Set]",Y7="[object WeakMap]",X7="[object DataView]",QX=ea(_g),eJ=ea(ku),tJ=ea(xg),rJ=ea(Sg),nJ=ea(lg),na=nc;(_g&&na(new _g(new ArrayBuffer(1)))!=X7||ku&&na(new ku)!=G7||xg&&na(xg.resolve())!=H7||Sg&&na(new Sg)!=K7||lg&&na(new lg)!=Y7)&&(na=function(e){var t=nc(e),r=t==ZX?e.constructor:void 0,n=r?ea(r):"";if(n)switch(n){case QX:return X7;case eJ:return G7;case tJ:return H7;case rJ:return K7;case nJ:return Y7}return t});const Pu=na;var iJ=Object.prototype,sJ=iJ.hasOwnProperty;function oJ(e){var t=e.length,r=new e.constructor(t);return t&&typeof e[0]=="string"&&sJ.call(e,"index")&&(r.index=e.index,r.input=e.input),r}var aJ=qi.Uint8Array;const Sd=aJ;function Eg(e){var t=new e.constructor(e.byteLength);return new Sd(t).set(new Sd(e)),t}function cJ(e,t){var r=t?Eg(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}var uJ=/\w*$/;function lJ(e){var t=new e.constructor(e.source,uJ.exec(e));return t.lastIndex=e.lastIndex,t}var J7=Wi?Wi.prototype:void 0,Z7=J7?J7.valueOf:void 0;function fJ(e){return Z7?Object(Z7.call(e)):{}}function dJ(e,t){var r=t?Eg(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var hJ="[object Boolean]",pJ="[object Date]",mJ="[object Map]",gJ="[object Number]",yJ="[object RegExp]",vJ="[object Set]",bJ="[object String]",wJ="[object Symbol]",_J="[object ArrayBuffer]",xJ="[object DataView]",SJ="[object Float32Array]",EJ="[object Float64Array]",TJ="[object Int8Array]",CJ="[object Int16Array]",AJ="[object Int32Array]",IJ="[object Uint8Array]",MJ="[object Uint8ClampedArray]",OJ="[object Uint16Array]",jJ="[object Uint32Array]";function kJ(e,t,r){var n=e.constructor;switch(t){case _J:return Eg(e);case hJ:case pJ:return new n(+e);case xJ:return cJ(e,r);case SJ:case EJ:case TJ:case CJ:case AJ:case IJ:case MJ:case OJ:case jJ:return dJ(e,r);case mJ:return new n;case gJ:case bJ:return new n(e);case yJ:return lJ(e);case vJ:return new n;case wJ:return fJ(e)}}function PJ(e){return typeof e.constructor=="function"&&!hg(e)?VK(D7(e)):{}}var RJ="[object Map]";function NJ(e){return ho(e)&&Pu(e)==RJ}var Q7=sc&&sc.isMap,DJ=Q7?bd(Q7):NJ;const $J=DJ;var LJ="[object Set]";function BJ(e){return ho(e)&&Pu(e)==LJ}var eE=sc&&sc.isSet,UJ=eE?bd(eE):BJ;const FJ=UJ;var VJ=1,zJ=2,qJ=4,tE="[object Arguments]",WJ="[object Array]",GJ="[object Boolean]",HJ="[object Date]",KJ="[object Error]",rE="[object Function]",YJ="[object GeneratorFunction]",XJ="[object Map]",JJ="[object Number]",nE="[object Object]",ZJ="[object RegExp]",QJ="[object Set]",eZ="[object String]",tZ="[object Symbol]",rZ="[object WeakMap]",nZ="[object ArrayBuffer]",iZ="[object DataView]",sZ="[object Float32Array]",oZ="[object Float64Array]",aZ="[object Int8Array]",cZ="[object Int16Array]",uZ="[object Int32Array]",lZ="[object Uint8Array]",fZ="[object Uint8ClampedArray]",dZ="[object Uint16Array]",hZ="[object Uint32Array]",Qt={};Qt[tE]=Qt[WJ]=Qt[nZ]=Qt[iZ]=Qt[GJ]=Qt[HJ]=Qt[sZ]=Qt[oZ]=Qt[aZ]=Qt[cZ]=Qt[uZ]=Qt[XJ]=Qt[JJ]=Qt[nE]=Qt[ZJ]=Qt[QJ]=Qt[eZ]=Qt[tZ]=Qt[lZ]=Qt[fZ]=Qt[dZ]=Qt[hZ]=!0,Qt[KJ]=Qt[rE]=Qt[rZ]=!1;function Ed(e,t,r,n,i,s){var o,a=t&VJ,c=t&zJ,u=t&qJ;if(r&&(o=i?r(e,n,i,s):r(e)),o!==void 0)return o;if(!ic(e))return e;var l=mn(e);if(l){if(o=oJ(e),!a)return zK(e,o)}else{var f=Pu(e),p=f==rE||f==YJ;if(vd(e))return UX(e,a);if(f==nE||f==tE||p&&!i){if(o=c||p?{}:PJ(e),!a)return c?HX(e,LX(o,e)):qX(e,$X(o,e))}else{if(!Qt[f])return i?e:{};o=kJ(e,f,a)}}s||(s=new Gi);var v=s.get(e);if(v)return v;s.set(e,o),FJ(e)?e.forEach(function(S){o.add(Ed(S,t,r,S,e,s))}):$J(e)&&e.forEach(function(S,A){o.set(A,Ed(S,t,r,A,e,s))});var w=u?c?KX:wg:c?mg:Ou,y=l?void 0:w(e);return WK(y||e,function(S,A){y&&(A=S,S=e[A]),x7(o,A,Ed(S,t,r,A,e,s))}),o}var pZ=1,mZ=4;function gZ(e){return Ed(e,pZ|mZ)}var yZ="__lodash_hash_undefined__";function vZ(e){return this.__data__.set(e,yZ),this}function bZ(e){return this.__data__.has(e)}function Td(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new As;++t<r;)this.add(e[t])}Td.prototype.add=Td.prototype.push=vZ,Td.prototype.has=bZ;function wZ(e,t){for(var r=-1,n=e==null?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}function _Z(e,t){return e.has(t)}var xZ=1,SZ=2;function iE(e,t,r,n,i,s){var o=r&xZ,a=e.length,c=t.length;if(a!=c&&!(o&&c>a))return!1;var u=s.get(e),l=s.get(t);if(u&&l)return u==t&&l==e;var f=-1,p=!0,v=r&SZ?new Td:void 0;for(s.set(e,t),s.set(t,e);++f<a;){var w=e[f],y=t[f];if(n)var S=o?n(y,w,f,t,e,s):n(w,y,f,e,t,s);if(S!==void 0){if(S)continue;p=!1;break}if(v){if(!wZ(t,function(A,O){if(!_Z(v,O)&&(w===A||i(w,A,r,n,s)))return v.push(O)})){p=!1;break}}else if(!(w===y||i(w,y,r,n,s))){p=!1;break}}return s.delete(e),s.delete(t),p}function EZ(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}function TZ(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var CZ=1,AZ=2,IZ="[object Boolean]",MZ="[object Date]",OZ="[object Error]",jZ="[object Map]",kZ="[object Number]",PZ="[object RegExp]",RZ="[object Set]",NZ="[object String]",DZ="[object Symbol]",$Z="[object ArrayBuffer]",LZ="[object DataView]",sE=Wi?Wi.prototype:void 0,Tg=sE?sE.valueOf:void 0;function BZ(e,t,r,n,i,s,o){switch(r){case LZ:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case $Z:return!(e.byteLength!=t.byteLength||!s(new Sd(e),new Sd(t)));case IZ:case MZ:case kZ:return fg(+e,+t);case OZ:return e.name==t.name&&e.message==t.message;case PZ:case NZ:return e==t+"";case jZ:var a=EZ;case RZ:var c=n&CZ;if(a||(a=TZ),e.size!=t.size&&!c)return!1;var u=o.get(e);if(u)return u==t;n|=AZ,o.set(e,t);var l=iE(a(e),a(t),n,i,s,o);return o.delete(e),l;case DZ:if(Tg)return Tg.call(e)==Tg.call(t)}return!1}var UZ=1,FZ=Object.prototype,VZ=FZ.hasOwnProperty;function zZ(e,t,r,n,i,s){var o=r&UZ,a=wg(e),c=a.length,u=wg(t),l=u.length;if(c!=l&&!o)return!1;for(var f=c;f--;){var p=a[f];if(!(o?p in t:VZ.call(t,p)))return!1}var v=s.get(e),w=s.get(t);if(v&&w)return v==t&&w==e;var y=!0;s.set(e,t),s.set(t,e);for(var S=o;++f<c;){p=a[f];var A=e[p],O=t[p];if(n)var j=o?n(O,A,p,t,e,s):n(A,O,p,e,t,s);if(!(j===void 0?A===O||i(A,O,r,n,s):j)){y=!1;break}S||(S=p=="constructor")}if(y&&!S){var V=e.constructor,B=t.constructor;V!=B&&"constructor"in e&&"constructor"in t&&!(typeof V=="function"&&V instanceof V&&typeof B=="function"&&B instanceof B)&&(y=!1)}return s.delete(e),s.delete(t),y}var qZ=1,oE="[object Arguments]",aE="[object Array]",Cd="[object Object]",WZ=Object.prototype,cE=WZ.hasOwnProperty;function GZ(e,t,r,n,i,s){var o=mn(e),a=mn(t),c=o?aE:Pu(e),u=a?aE:Pu(t);c=c==oE?Cd:c,u=u==oE?Cd:u;var l=c==Cd,f=u==Cd,p=c==u;if(p&&vd(e)){if(!vd(t))return!1;o=!0,l=!1}if(p&&!l)return s||(s=new Gi),o||j7(e)?iE(e,t,r,n,i,s):BZ(e,t,c,r,n,i,s);if(!(r&qZ)){var v=l&&cE.call(e,"__wrapped__"),w=f&&cE.call(t,"__wrapped__");if(v||w){var y=v?e.value():e,S=w?t.value():t;return s||(s=new Gi),i(y,S,r,n,s)}}return p?(s||(s=new Gi),zZ(e,t,r,n,i,s)):!1}function Ad(e,t,r,n,i){return e===t?!0:e==null||t==null||!ho(e)&&!ho(t)?e!==e&&t!==t:GZ(e,t,r,n,Ad,i)}var HZ=1,KZ=2;function YZ(e,t,r,n){var i=r.length,s=i,o=!n;if(e==null)return!s;for(e=Object(e);i--;){var a=r[i];if(o&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++i<s;){a=r[i];var c=a[0],u=e[c],l=a[1];if(o&&a[2]){if(u===void 0&&!(c in e))return!1}else{var f=new Gi;if(n)var p=n(u,l,c,e,t,f);if(!(p===void 0?Ad(l,u,HZ|KZ,n,f):p))return!1}}return!0}function uE(e){return e===e&&!ic(e)}function XZ(e){for(var t=Ou(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,uE(i)]}return t}function lE(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}function JZ(e){var t=XZ(e);return t.length==1&&t[0][2]?lE(t[0][0],t[0][1]):function(r){return r===e||YZ(r,e,t)}}function ZZ(e,t){return e!=null&&t in Object(e)}function QZ(e,t,r){t=R7(t,e);for(var n=-1,i=t.length,s=!1;++n<i;){var o=xd(t[n]);if(!(s=e!=null&&r(e,o)))break;e=e[o]}return s||++n!=i?s:(i=e==null?0:e.length,!!i&&dg(i)&&w7(o,i)&&(mn(e)||T7(e)))}function eQ(e,t){return e!=null&&QZ(e,t,ZZ)}var tQ=1,rQ=2;function nQ(e,t){return gg(e)&&uE(t)?lE(xd(e),t):function(r){var n=MX(r,e);return n===void 0&&n===t?eQ(r,e):Ad(t,n,tQ|rQ)}}function iQ(e){return function(t){return t==null?void 0:t[e]}}function sQ(e){return function(t){return vg(t,e)}}function oQ(e){return gg(e)?iQ(xd(e)):sQ(e)}function fE(e){return typeof e=="function"?e:e==null?m7:typeof e=="object"?mn(e)?nQ(e[0],e[1]):JZ(e):oQ(e)}function aQ(e){return function(t,r,n){for(var i=-1,s=Object(t),o=n(t),a=o.length;a--;){var c=o[e?a:++i];if(r(s[c],c,s)===!1)break}return t}}var cQ=aQ();const uQ=cQ;function lQ(e,t){return e&&uQ(e,t,Ou)}function fQ(e,t){return function(r,n){if(r==null)return r;if(!yd(r))return e(r,n);for(var i=r.length,s=t?i:-1,o=Object(r);(t?s--:++s<i)&&n(o[s],s,o)!==!1;);return r}}var dQ=fQ(lQ);const dE=dQ;function hQ(e,t){var r=[];return dE(e,function(n,i,s){t(n,i,s)&&r.push(n)}),r}function pQ(e,t){var r=mn(e)?F7:hQ;return r(e,fE(t))}function mQ(e,t){var r=-1,n=yd(e)?Array(e.length):[];return dE(e,function(i,s,o){n[++r]=t(i,s,o)}),n}function gQ(e,t){return Ad(e,t)}function yQ(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}function vQ(e,t){if(e!==t){var r=e!==void 0,n=e===null,i=e===e,s=Iu(e),o=t!==void 0,a=t===null,c=t===t,u=Iu(t);if(!a&&!u&&!s&&e>t||s&&o&&c&&!a&&!u||n&&o&&c||!r&&c||!i)return 1;if(!n&&!s&&!u&&e<t||u&&r&&i&&!n&&!s||a&&r&&i||!o&&i||!c)return-1}return 0}function bQ(e,t,r){for(var n=-1,i=e.criteria,s=t.criteria,o=i.length,a=r.length;++n<o;){var c=vQ(i[n],s[n]);if(c){if(n>=a)return c;var u=r[n];return c*(u=="desc"?-1:1)}}return e.index-t.index}function wQ(e,t,r){t.length?t=md(t,function(s){return mn(s)?function(o){return vg(o,s.length===1?s[0]:s)}:s}):t=[m7];var n=-1;t=md(t,bd(fE));var i=mQ(e,function(s,o,a){var c=md(t,function(u){return u(s)});return{criteria:c,index:++n,value:s}});return yQ(i,function(s,o){return bQ(s,o,r)})}function _Q(e,t,r,n){return e==null?[]:(mn(t)||(t=t==null?[]:[t]),r=n?void 0:r,mn(r)||(r=r==null?[]:[r]),wQ(e,t,r))}function xQ({toBack:e,onSubmitClick:t,data:r}){const{fromCoin:n,toCoin:i}=tn(),s=he.useRef(!1),{slippage:o}=en(),[a,c]=he.useState(r),{fromAmountUi:u,toAmountUi:l,byAmountIn:f}=a,{amountLimit:p}=Z5(o,a),{showPriceImpactTips:v,showPriceImpactWarn:w}=o7(n,i,u,l),{priceAcceptRouterData:y}=wH(a),[S,A]=he.useState(!1),[O,j]=he.useState(!1);he.useMemo(()=>f?i:n,[f]);const V=he.useMemo(()=>y!==void 0,[y]),B=()=>{if(y){if(s.current)return;s.current=!0;const q=gZ(y);c(q),setTimeout(()=>{s.current=!1},300)}},H=he.useMemo(()=>S?!1:!!w,[S,w]);return _.jsxs("div",{className:"secondary-dialog",children:[_.jsx(cg,{title:"Review your order",backClick:e}),_.jsxs("div",{className:"secondary-content",children:[_.jsxs("div",{className:"trade-info",children:[_.jsxs("div",{className:"amount-info",children:[_.jsx("span",{className:"amount",children:so(u||"")}),_.jsx(Pr,{src:n==null?void 0:n.logo_url,token:n,style:{width:"28px",height:"28px"}}),_.jsx("span",{className:"symbol",children:Ur((n==null?void 0:n.symbol)||"")})]}),_.jsx("div",{className:"dividing-line",children:_.jsx("div",{className:"swap-icon",children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-trade"})})})}),_.jsxs("div",{className:"amount-info",children:[_.jsx("span",{className:"amount",children:so(l||"")}),_.jsx(Pr,{src:i==null?void 0:i.logo_url,token:i,style:{width:"28px",height:"28px"}}),_.jsx("span",{className:"symbol",children:Ur((i==null?void 0:i.symbol)||"")})]})]}),_.jsxs("div",{className:"current-price-tips-box yellow",style:{fontSize:"12px",marginTop:"8px",flexDirection:"column",justifyContent:"start",gap:"10px"},children:[_.jsx("div",{className:"current-price-box",style:{backgroundColor:"var(--cs-bg-primary)",marginTop:"-1px"},children:_.jsx(ag,{baseToken:n,quoteToken:i,baseAmount:u||"0",quoteAmount:l||"0",loading:!1})}),v&&_.jsx("div",{style:{paddingLeft:"8px",paddingBottom:"10px",color:"var(--cs-warning)"},children:"High price difference. Be cautious before submitting your order."})]}),_.jsxs("div",{className:"swap-info-between",style:{marginTop:"16px"},children:[_.jsx("div",{className:"left",children:"Slippage Tolerance"}),_.jsxs("div",{className:"right",children:[o,"%"]})]}),_.jsx(c7,{pl:"0px",pr:"0px",isLoading:!1,amountLimit:p}),_.jsx(a7,{isLoading:!1,routerData:a,noTips:!0}),w&&_.jsxs("div",{style:{width:"100%",marginTop:"8px",gap:"1px"},children:[_.jsx("div",{style:{width:"100%",gap:"8px",fontSize:"12px",backgroundColor:"var(--cs-error-10)",paddingLeft:"16px",paddingRight:"16px",paddingTop:"8px",paddingBottom:"8px",borderRadius:"12px",color:"var(--cs-error)"},children:"The exchange rate of this order deviates from the market price by a large percentage. Are you sure you want to continue the swap?"}),_.jsxs("div",{style:{width:"100%",gap:"16px",display:"flex",flexDirection:"row",marginTop:"-10px"},children:[_.jsx("button",{className:S?"swap-btn cs-outline-btn secondary-btn ignorePriceImpact-btn":"swap-btn cs-outline-btn secondary-btn",style:{fontSize:"14px",height:"42px",flex:1,color:S?"var(--cs-primary)":"var(--cs-btn-disabled-text)"},onClick:()=>{A(!0)},children:"Yes, please continue."}),_.jsx("button",{className:"swap-btn cs-outline-btn secondary-btn",style:{fontSize:"14px",height:"42px",color:"var(--cs-btn-disabled-text)",flex:1},onClick:()=>e(),children:"No,cancel it."})]})]})]}),!V&&_.jsx("button",{disabled:H||O,className:"swap-btn cs-solid-btn",style:{marginTop:"16px"},onClick:()=>{O||(j(!0),t(a))},children:O?_.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:_.jsx(nm,{})}):"Confirm Swap"}),V&&_.jsxs("div",{className:"price-update",children:[_.jsxs("div",{className:"left",children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-alert"})}),_.jsx("span",{children:"Price update"})]}),_.jsx("div",{className:"right",children:_.jsx("button",{className:"cs-solid-btn",onClick:B,children:"Accept"})})]})]})}function hE({allProviders:e}){const{isApp:t}=rc();return _.jsx(_.Fragment,{children:e==null?void 0:e.map(r=>{var n;return t?_.jsx(Pr,{src:Lt==null?void 0:Lt[r],style:{width:"16px",height:"16px"},haveBorder:!1},r):_.jsx(Jo,{content:_.jsx("div",{style:{color:"var(--cs-text-primary)"},children:((n=tm[r])==null?void 0:n.name)||r}),position:"top",delay:300,children:_.jsx(Pr,{src:Lt==null?void 0:Lt[r],style:{width:"16px",height:"16px"},haveBorder:!1})},r)})})}function Id(e){const{text:t,type:r,classType:n=""}=e,[i,s]=he.useState(!1),{addCommonToast:o}=Fa(),a=c=>{i||(_f(c),W5(t,{debug:!1,message:"message"}),o("Copied"),s(!i))};return he.useEffect(()=>{i&&setTimeout(()=>{s(!1)},2e3)},[i]),_.jsx(_.Fragment,{children:r==="btn"?_.jsxs("div",{className:n?`${n} copy-btn`:"copy-btn",onClick:a,children:[_.jsx("svg",{className:"cs-icon cs-copy-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:i?"#icon-sel":"#icon-icon_copy"})}),_.jsx("span",{children:"Copy"})]}):_.jsx("svg",{className:"cs-icon cs-copy-icon","aria-hidden":"true",onClick:a,children:_.jsx("use",{xlinkHref:i?"#icon-sel":"#icon-icon_copy"})})})}const oc=2;function SQ({data:e,config:t={},originFromCoinType:r,originToCoinType:n,isWidget:i}){const{nodes:s,edges:o,tokenMap:a,panelHeight:c,resultColumes:u}=s7(e,r,n),l=he.useRef(null),f={nodeWidth:176,searchStep:5,nodePadding:10,maxSearchDistance:50,arrowOffset:5,...t},p=he.useMemo(()=>s==null?void 0:s.map(v=>{var A;const w=v.originalTarget||v.target,y=a==null?void 0:a.get(w),S=Object.keys(v==null?void 0:v.list);return{...v,targetSymbol:y==null?void 0:y.symbol,targetImg:y==null?void 0:y.logo_url,targetIsTrusted:y==null?void 0:y.is_trusted,fromGroups:(A=Object.values(v==null?void 0:v.list))==null?void 0:A.map((O,j)=>{const V=a==null?void 0:a.get(S[j]),B=`${Ur((V==null?void 0:V.symbol)||"",8)} > ${Ur((y==null?void 0:y.symbol)||"",8)}`,H=O.reduce((se,fe)=>se+parseFloat(fe.amountOut||"0"),0),q=[];O.forEach(se=>{const fe=parseFloat(se.amountOut||"0"),z=H>0?wf(Fe(fe).div(H).mul(100).toString(),0):"0";q.push(Number(z)||1)});const ne=Sf(q);return{list:O.map((se,fe)=>{var h;const z=((h=ne[fe])==null?void 0:h.toString())||"0",N=a==null?void 0:a.get(se==null?void 0:se.from);return{...se,percent:z,fromLogo:N==null?void 0:N.logo_url,targetLogo:y==null?void 0:y.logo_url,fromSymbol:N==null?void 0:N.symbol,targetSymbol:y==null?void 0:y.symbol,fromIsTrusted:N==null?void 0:N.is_trusted,toIsTrusted:y==null?void 0:y.is_trusted,displayFee:ZU(JU(se==null?void 0:se.feeRate,4))}}).sort((se,fe)=>Number(fe==null?void 0:fe.percent)-Number(se==null?void 0:se.percent)),title:B}})}}),[s,a,u]);return _.jsxs("div",{style:{position:"relative",width:"878px",height:`${c?`${c}px`:"531px"}`},ref:l,children:[_.jsx(CQ,{edges:o,nodes:s,config:f}),_.jsx(AQ,{data:p,isWidget:i})]})}function EQ(e,t,r,n,i,s,o,a){const c=i+o,u=s+a,l=Math.min(e,r),f=Math.max(e,r),p=Math.min(t,n),v=Math.max(t,n);if(f<i||l>c||v<s||p>u)return!1;if(l>=i&&f<=c&&p>=s&&v<=u)return!0;if(Math.abs(t-n)<.001)return t>=s&&t<=u&&f>=i&&l<=c;if(Math.abs(e-r)<.001)return e>=i&&e<=c&&v>=s&&p<=u;const w=[{x1:i,y1:s,x2:c,y2:s},{x1:i,y1:u,x2:c,y2:u},{x1:i,y1:s,x2:i,y2:u},{x1:c,y1:s,x2:c,y2:u}];for(const y of w)if(TQ(e,t,r,n,y.x1,y.y1,y.x2,y.y2))return!0;return!1}function TQ(e,t,r,n,i,s,o,a){const c=(e-r)*(s-a)-(t-n)*(i-o);if(Math.abs(c)<.001)return!1;const u=((e-i)*(s-a)-(t-s)*(i-o))/c,l=-((e-r)*(t-s)-(t-n)*(e-i))/c;return u>=0&&u<=1&&l>=0&&l<=1}function Md(e,t,r,n,i,s=176,o,a,c=[],u=[],l={}){const f=l.searchStep||5,p=l.nodePadding||10;l.maxSearchDistance;const v=l.arrowOffset||5,w=(z,N,h,d)=>{for(const m of c)if(!(a.from===m.id||a.to===m.id)&&EQ(z,N,h,d,m.left,m.top,m.width,m.height))return!0;return!1},y=z=>{if(w(e,z,r-v,z))return!1;const N=S.top,h=S.top+S.height,d=A.top,m=A.top+A.height,x=Math.max(N,d),E=Math.min(h,m);return x<E?z>=x+p&&z<=E-p:!1},S=c.find(z=>z.id===a.from),A=c.find(z=>z.id===a.to);if(!S||!A)return`M${e},${t} L${r},${t==n?n:t}`;if(o){const z=A.top+A.height/2;return y(z)?`M${e},${t} L${r-v},${z}`:`M${e},${t} L${r-v},${t}`}const O=u.filter(z=>z.from===a.from);if(u.filter(z=>z.to===a.to),O.length===1){const z=S.top+S.height/2;if(y(z))return`M${e},${z} L${r-v},${z}`}const j=S.top,V=S.top+S.height,B=A.top,H=A.top+A.height,q=Math.max(j,B),ne=Math.min(V,H);if(q<ne){for(let z=q+p;z<=ne-p;z+=f)if(y(z))return`M${e},${z} L${r-v},${z}`}const ge=S.top+S.height/2,se=A.left+A.width/2,fe=A.top+A.height;if(V-10<B){const z=S.left+S.width/2,N=S.top+S.height,h=A.top+A.height/2;return!w(z,V,z,h)&&!w(z,h,r-v,h)?`M${z},${N} L${z},${V} L${z},${h} L${r-v},${h}`:`M${e},${N} L${se},${N} L${se},${fe}`}else if(j+10>=H)return`M${e},${ge} L${se},${ge} L${se},${fe}`;return`M${e},${ge} L${r},${ge}`}function CQ({edges:e,nodes:t,config:r}){var i,s,o,a;const n=he.useRef(null);return _.jsxs("svg",{ref:n,style:{position:"absolute",left:0,top:0,pointerEvents:"none",zIndex:1,width:"100%",height:"100%"},children:[_.jsxs("defs",{children:[_.jsxs("linearGradient",{id:"arrowGradient",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[_.jsx("stop",{offset:"0%",stopColor:"rgba(0, 255, 165, 1)"}),_.jsx("stop",{offset:"100%",stopColor:"rgba(0, 183, 255, 1)"})]}),_.jsx("marker",{id:"arrowhead",markerWidth:"5",markerHeight:"9",refX:"4",refY:"3.5",orient:"auto",children:_.jsx("path",{d:"M1 1 L4 3.5 L1 6",fill:"none",stroke:"url(#arrowGradient)",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})})]}),(()=>{const c=(e==null?void 0:e.filter(p=>p.isStart))||[],u=c.reduce((p,v)=>v.fromY>p.fromY?v:p,c[0]),l=(e==null?void 0:e.filter(p=>p.isFinal))||[],f=l.reduce((p,v)=>v.toY>p.toY?v:p,l[0]);if(u&&f){const S=`M 13 8 Q 13 ${u.fromY-10} ${u.fromX} ${u.fromY}`,A=`M 865 4 L 865 ${f.toY} L ${f.toX} ${f.toY}`;return _.jsxs("g",{children:[_.jsx("path",{d:S,stroke:"var(--cs-border)",strokeWidth:oc,fill:"none"}),_.jsx("path",{d:A,stroke:"var(--cs-border)",strokeWidth:oc,fill:"none"}),_.jsx("circle",{cx:13,cy:4,r:"4",fill:"#75C8FF"}),_.jsx("circle",{cx:865,cy:4,r:"4",fill:"#75C8FF"})]})}return null})(),(i=e==null?void 0:e.filter(c=>c.isCrossColumnConnection&&c.isStart))==null?void 0:i.map((c,u)=>{let l,f,p;if(c.segments&&c.segments.length>0){l=c.segments.map((H,q)=>q===0?`M${H.x1},${H.y1} L${H.x2},${H.y2}`:`L${H.x2},${H.y2}`).join(" ");const j=c.segments[0],V=j.x2-j.x1,B=j.y2-j.y1;Math.abs(V)>Math.abs(B)?(p=(j.y1+j.y2)/2,f=j.x1+30):B<0?(p=j.y1-16,f=(j.x1+j.x2)/2):(p=j.y1+30,f=(j.x1+j.x2)/2)}else{l=Md(c.fromX,c.fromY,c.toX,c.toY,c.toBlockHeight,r.nodeWidth,!!c.isStart,c,t,e,r);const j=l.split(" ");let V=c.fromX,B=c.fromY,H=!1;if(j.length>0&&j[0].startsWith("M")){const q=j[0].substring(1).split(",");q.length===2&&(V=parseFloat(q[0]),B=parseFloat(q[1]))}if(j.length>=3){const q=j[1],ne=j[2];if(q&&ne){const ge=q.substring(1).split(","),se=ne.substring(1).split(",");if(ge.length===2&&se.length===2){const fe=parseFloat(ge[1]),z=parseFloat(se[1]);fe<z&&(H=!0)}}}H?(c.fromPercent&&`${c.fromPercent}`,f=V,p=B+12):(f=V+30,p=B)}const v=c.fromPercent?`${c.fromPercent}%`:"",w=v.length*6,y=Math.max(42,w+10),S=16,A=f-y/2,O=p-S/2;return _.jsxs("g",{children:[_.jsx("path",{d:l,stroke:"var(--cs-border)",strokeWidth:oc,fill:"none",markerEnd:"url(#arrowhead)",strokeLinecap:"square",strokeLinejoin:"miter"}),_.jsx("rect",{x:A,y:O,width:y,height:S,rx:"4",ry:"4",fill:"var(--cs-router-percent-bg)"}),_.jsx("text",{x:f,y:O+S/2+.5,fontSize:"10",fill:"#00B7FF",textAnchor:"middle",dominantBaseline:"middle",pointerEvents:"auto",children:v})]},`cross-${u}`)}),(s=e==null?void 0:e.filter(c=>c.renderOnTop))==null?void 0:s.map((c,u)=>{let l,f,p;if(c.segments&&c.segments.length>0){l=c.segments.map((H,q)=>q===0?`M${H.x1},${H.y1} L${H.x2},${H.y2}`:`L${H.x2},${H.y2}`).join(" ");const j=c.segments[0],V=j.x2-j.x1,B=j.y2-j.y1;Math.abs(V)>Math.abs(B)?(p=(j.y1+j.y2)/2,f=j.x1+30):B<0?(p=j.y1-16,f=(j.x1+j.x2)/2):(p=j.y1+30,f=(j.x1+j.x2)/2)}else l=Md(c.fromX,c.fromY,c.toX,c.toY,c.toBlockHeight,r.nodeWidth,!!c.isStart,c,t,e,r),f=(c.fromX+c.toX)/2,p=(c.fromY+c.toY)/2;const v=c.fromPercent?`${c.fromPercent}%`:"",w=v.length*6,y=Math.max(42,w+10),S=16,A=f-y/2,O=p-S/2;return _.jsxs("g",{children:[_.jsx("path",{d:l,stroke:"var(--cs-border)",strokeWidth:oc,fill:"none",markerEnd:"url(#arrowhead)",strokeLinecap:"square",strokeLinejoin:"miter"}),_.jsx("rect",{x:A,y:O,width:y,height:S,rx:"4",ry:"4",fill:"var(--cs-router-percent-bg)"}),_.jsx("text",{x:f,y:O+S/2+.5,fontSize:"10",fill:"#00B7FF",textAnchor:"middle",dominantBaseline:"middle",pointerEvents:"auto",children:v})]},`cross-other-${u}`)}),(o=e==null?void 0:e.filter(c=>c.isCrossColumnConnection&&!c.isStart&&!c.renderOnTop))==null?void 0:o.map((c,u)=>{let l,f,p;if(c.segments&&c.segments.length>0){l=c.segments.map((H,q)=>q===0?`M${H.x1},${H.y1} L${H.x2},${H.y2}`:`L${H.x2},${H.y2}`).join(" ");const j=c.segments[0],V=j.x2-j.x1,B=j.y2-j.y1;Math.abs(V)>Math.abs(B)?(p=(j.y1+j.y2)/2,f=j.x1+30):B<0?(p=j.y1-16,f=(j.x1+j.x2)/2):(p=j.y1+30,f=(j.x1+j.x2)/2)}else l=Md(c.fromX,c.fromY,c.toX,c.toY,c.toBlockHeight,r.nodeWidth,!!c.isStart,c,t,e,r),f=(c.fromX+c.toX)/2,p=(c.fromY+c.toY)/2;const v=c.fromPercent?`${c.fromPercent}%`:"",w=v.length*6,y=Math.max(42,w+10),S=16,A=f-y/2,O=p-S/2;return _.jsxs("g",{children:[_.jsx("path",{d:l,stroke:"var(--cs-border)",strokeWidth:oc,fill:"none",markerEnd:"url(#arrowhead)",strokeLinecap:"square",strokeLinejoin:"miter"}),_.jsx("rect",{x:A,y:O,width:y,height:S,rx:"4",ry:"4",fill:"var(--cs-router-percent-bg)"}),_.jsx("text",{x:f,y:O+S/2+.5,fontSize:"10",fill:"#00B7FF",textAnchor:"middle",dominantBaseline:"middle",pointerEvents:"auto",children:v})]},`cross-other-${u}`)}),(a=e==null?void 0:e.filter(c=>!c.isCrossColumnConnection&&!c.renderOnTop))==null?void 0:a.map((c,u)=>{let l,f,p;if(c.segments&&c.segments.length>0){l=c.segments.map((H,q)=>q===0?`M${H.x1},${H.y1} L${H.x2},${H.y2}`:`L${H.x2},${H.y2}`).join(" ");const j=c.segments[0],V=j.x2-j.x1,B=j.y2-j.y1;Math.abs(V)>Math.abs(B)?(p=(j.y1+j.y2)/2,f=j.x1+30):B<0?(p=j.y1-16,f=(j.x1+j.x2)/2):(p=j.y1+30,f=(j.x1+j.x2)/2)}else{l=Md(c.fromX,c.fromY,c.toX,c.toY,c.toBlockHeight,r.nodeWidth,!!c.isStart,c,t,e,r);const j=l.split(" ");let V=c.fromX,B=c.fromY,H=!1;if(j.length>0&&j[0].startsWith("M")){const q=j[0].substring(1).split(",");q.length===2&&(V=parseFloat(q[0]),B=parseFloat(q[1]))}if(j.length>=3){const q=j[1],ne=j[2];if(q&&ne){const ge=q.substring(1).split(","),se=ne.substring(1).split(",");if(ge.length===2&&se.length===2){const fe=parseFloat(ge[1]),z=parseFloat(se[1]);fe<z&&(H=!0)}}}H?(c.fromPercent&&`${c.fromPercent}`,f=V,p=B+12):(f=V+30,p=B)}const v=c.fromPercent?`${c.fromPercent}%`:"",w=v.length*6,y=Math.max(42,w+10),S=16,A=f-y/2,O=p-S/2;return _.jsxs("g",{children:[_.jsx("path",{d:l,stroke:"var(--cs-border)",strokeWidth:oc,fill:"none",markerEnd:"url(#arrowhead)",strokeLinecap:"square",strokeLinejoin:"miter"}),_.jsx("rect",{x:A,y:O,width:y,height:S,rx:"4",ry:"4",fill:"var(--cs-router-percent-bg)"}),_.jsx("text",{x:f,y:O+S/2+.5,fontSize:"10",fill:"#00B7FF",textAnchor:"middle",dominantBaseline:"middle",pointerEvents:"auto",children:v})]},`normal-${u}`)})]})}function AQ({data:e,isWidget:t}){return _.jsx("div",{style:{width:"100%",position:"relative",height:"100%",zIndex:2},children:e==null?void 0:e.map(r=>_.jsx(IQ,{data:r,isWidget:t},r.target))})}function IQ({data:e,isWidget:t}){var r;return _.jsxs("div",{style:{width:"176px",padding:"8px",background:"--cs-bg-primary",borderRadius:"8px",border:"1px solid",borderColor:"var(--cs-border)",position:"absolute",left:`${e==null?void 0:e.left}px`,top:`${(e==null?void 0:e.top)+"px"}`},"data-node-id":e==null?void 0:e.target,children:[_.jsx(hd,{autoSwitchTooltip:!0,position:"bottom",borderRadius:"12px",content:_.jsx(jQ,{data:e}),children:_.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",height:"24px"},children:[_.jsx(Pr,{src:e==null?void 0:e.targetImg,haveBorder:!1,token:{coin_type:e==null?void 0:e.originalTarget,logo_url:e==null?void 0:e.targetImg,symbol:e==null?void 0:e.targetSymbol,is_trusted:e==null?void 0:e.targetIsTrusted},style:{width:"24px",height:"24px",borderRadius:"100%"}}),_.jsx("span",{style:{color:"var(--cs-text-primary)"},children:Ur((e==null?void 0:e.targetSymbol)||"",16)})]})}),_.jsx("div",{style:{width:"100%",marginTop:"-7.5px",padding:"0px"},children:(r=e==null?void 0:e.fromGroups)==null?void 0:r.map(n=>_.jsx(MQ,{data:n,isWidget:t},n.from))})]})}function MQ({data:e,isWidget:t}){var r;return _.jsxs("div",{style:{padding:"12px 8px",background:"var(--cs-primary-10)",borderRadius:"8px",width:"100%",marginTop:"8px"},children:[_.jsx("span",{style:{height:"16px",fontSize:"14px",color:"var(--cs-primary)",width:"100%"},children:e==null?void 0:e.title}),_.jsx("div",{style:{width:"100%",marginTop:"7px"},children:(r=e==null?void 0:e.list)==null?void 0:r.map(n=>{var i,s;return _.jsx(hd,{position:"bottom",content:_.jsx(OQ,{data:n},n==null?void 0:n.id),children:_.jsxs("div",{style:{display:"flex",height:"22px",width:"142px",cursor:"pointer",alignItems:"center"},children:[_.jsx(Pr,{src:(i=tm[n==null?void 0:n.provider])==null?void 0:i.logo,haveBorder:!1,style:{width:"16px",height:"16px",borderRadius:"100%"}}),_.jsx("span",{style:{fontSize:"12px",color:"#7F98A7",marginLeft:"4px",flex:1},children:(s=tm[n==null?void 0:n.provider])==null?void 0:s.name}),_.jsxs("span",{style:{fontSize:"12px",color:"#7F98A7",flex:"1",textAlign:"right"},children:[n==null?void 0:n.percent,"%"]})]},n.provider)})})})]})}function OQ({data:e}){const{getExplorerUrl:t}=Ba();return _.jsxs("div",{style:{width:"190px",display:"flex",flexDirection:"column",gap:"12px"},className:"no-close-widget-flag",children:[_.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0",gap:"0px"},children:[_.jsx(Pr,{src:e==null?void 0:e.fromLogo,showWarnSize:"12px",haveBorder:!1,token:{coin_type:e==null?void 0:e.from,logo_url:e==null?void 0:e.fromLogo,symbol:e==null?void 0:e.fromSymbol,is_trusted:e==null?void 0:e.fromIsTrusted},style:{width:"16px",height:"16px",borderRadius:"100%"}}),_.jsx(Pr,{src:e==null?void 0:e.targetLogo,showWarnSize:"12px",haveBorder:!1,token:{coin_type:e==null?void 0:e.target,logo_url:e==null?void 0:e.targetLogo,symbol:e==null?void 0:e.targetSymbol,is_trusted:e==null?void 0:e.toIsTrusted},style:{width:"16px",height:"16px",borderRadius:"100%"}}),_.jsxs("span",{style:{fontSize:"12px",color:"var(--cs-text-primary)",flex:1,textAlign:"left",marginLeft:"4px"},children:[Ur((e==null?void 0:e.fromSymbol)||"",8)," -"," ",Ur((e==null?void 0:e.targetSymbol)||"",8)]}),(e==null?void 0:e.feeRate)&&Number(e==null?void 0:e.feeRate)>0&&_.jsx("div",{style:{minWidth:"50px",height:"16px",border:"1px solid var(--cs-border)",borderRadius:"12px",padding:"0px 6px",display:"flex",alignItems:"center",justifyContent:"center"},children:_.jsx("span",{style:{fontSize:"12px",lineHeight:"12px",fontWeight:"400",color:"var(--cs-primary)"},children:e.displayFee})})]}),(e==null?void 0:e.id)&&_.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",height:"20px",padding:"0"},children:[_.jsx("div",{style:{display:"flex",alignItems:"center"},children:_.jsx("span",{style:{fontSize:"12px",color:"var(--cs-text-secondary)"},children:"Pool"})}),_.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[_.jsx("a",{onClick:_f,href:t(e==null?void 0:e.id,"poolAddress"),target:"_blank",style:{textDecoration:"none",color:"var(--cs-text-primary)",marginRight:"4px"},children:qo(e==null?void 0:e.id)}),_.jsx(Id,{text:(e==null?void 0:e.id)||""})]})]})]})}function jQ({data:e}){const{getExplorerUrl:t}=Ba();return _.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:"12px",padding:"0px",gap:"12px"},children:[_.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexShrink:0},children:[_.jsx(Pr,{src:e==null?void 0:e.targetImg,showWarnSize:"12px",haveBorder:!1,token:{coin_type:e==null?void 0:e.originalTarget,logo_url:e==null?void 0:e.targetImg,symbol:e==null?void 0:e.targetSymbol,is_trusted:e==null?void 0:e.targetIsTrusted},style:{width:"20px",height:"20px",borderRadius:"100%"}}),_.jsx("span",{style:{color:"var(--cs-text-primary)",fontSize:"12px"},children:Ur((e==null?void 0:e.targetSymbol)||"")})]}),_.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[_.jsx("a",{onClick:_f,href:t(e==null?void 0:e.originalTarget,"coin"),target:"_blank",style:{textDecoration:"none",color:"var(--cs-text-secondary)",marginRight:"4px"},children:qo(e==null?void 0:e.originalTarget)}),_.jsx(Id,{text:(e==null?void 0:e.originalTarget)||""})]})]})}function kQ({toBack:e,data:t,allProviders:r}){const{fromCoin:n,toCoin:i,fromAmount:s,toAmount:o}=tn();return _.jsxs("div",{className:"route-dialog",children:[_.jsx(cg,{title:"Route",backClick:e}),_.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0px 16px",marginTop:"20px"},children:[_.jsx("span",{style:{fontSize:"14px",color:"var(--cs-text-secondary)"},children:"Router"}),_.jsx("div",{style:{display:"flex",alignItems:"center",gap:"2px",flexWrap:"wrap",justifyContent:"flex-end",paddingLeft:"8px"},children:_.jsx(hE,{allProviders:r})})]}),_.jsx("div",{style:{width:"100%",overflow:"auto",padding:"16px",minHeight:"550px",background:"var(--cs-bg-primary)"},children:_.jsxs("div",{style:{width:"876px",marginTop:"16px"},children:[_.jsxs("div",{style:{width:"100%",height:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px"},children:[_.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[_.jsx(Pr,{src:n==null?void 0:n.logo_url,style:{width:"24px",height:"24px"}}),_.jsx("span",{style:{fontSize:"14px",fontWeight:"500",color:"var(--cs-text-primary)"},children:so(s||"0")}),_.jsx("span",{style:{fontSize:"14px",fontWeight:"500",color:"var(--cs-text-primary)"},children:n==null?void 0:n.symbol})]}),_.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[_.jsx("span",{style:{fontSize:"14px",fontWeight:"500",color:"var(--cs-text-primary)"},children:so(o||"0")}),_.jsx("span",{style:{fontSize:"14px",fontWeight:"500",color:"var(--cs-text-primary)"},children:i==null?void 0:i.symbol}),_.jsx(Pr,{src:i==null?void 0:i.logo_url,style:{width:"24px",height:"24px"}})]})]}),_.jsx(SQ,{data:t})]})})]})}function PQ({hasSubMenu:e,data:t,isLoading:r,allProviders:n}){const[i,s]=he.useState(!1);return rc(),_.jsxs("div",{className:"simple-router-block",style:{paddingLeft:e?"8px":"0px",paddingRight:e?"8px":"0px"},children:[_.jsx("div",{className:"left",style:{whiteSpace:"nowrap",color:e?"var(--cs-text-secondary)":"var(--cs-text-primary)",paddingRight:"8px"},children:e?"Auto Router":"Route"}),r?_.jsx(Xo,{className:"custom-skeleton",style:{width:"80px",height:"18px"}}):_.jsxs("div",{className:"right",onClick:()=>{s(!0)},children:[_.jsx(hE,{allProviders:n}),e&&_.jsx("svg",{className:"cs-icon spread-icon","aria-hidden":"true",style:{width:"16px",height:"16px",flexShrink:0},children:_.jsx("use",{xlinkHref:"#icon-spread"})})]}),i&&e&&_.jsx(kQ,{data:t,toBack:()=>s(!1),allProviders:n})]})}const Xte="";function pE(){const{setCollectTokenMap:e,collectTokenMap:t}=Wo(),r=i=>{const s=new Map(t);s.get(i.coin_type)?s.delete(i.coin_type):s.set(i.coin_type,i),e(s)},n=he.useCallback(i=>t.get(i.coin_type)!==void 0,[t]);return{handleCollectToken:r,isCollectToken:n,collectTokenMap:t}}function RQ(e){const{trustedTokenList:t}=Ua(),{tokenBalanceObj:r,currentAccount:n}=rn(),{coinPriceObj:i}=H5(),{getTokenAmountValue:s}=Cu(),{fetchTokenInfo:o}=Va(),{currentTypeTab:a,showTokenList:c,setShowTokenList:u,combineTokenList:l,importTokenList:f,setComBineTokenList:p,setImportToken:v,setCurrentImportTokenData:w,setImportTokenIsLoading:y,currentImportTokenData:S,searchInput:A,setSearchInput:O,importTokenIsLoading:j,showTokenListIsLoading:V,setCurrentTypeTab:B,setCurrentPlatformTab:H}=Wo(),[q,ne]=he.useState(!1);he.useEffect(()=>{t&&(t==null?void 0:t.length)>0&&ne(!0)},[t]);const[ge,se]=he.useState(!1);he.useEffect(()=>{h_(i)||se(!0)},[i]);const fe=he.useRef({}),[z,N]=he.useState(!1);he.useEffect(()=>{(!h_(r)||!Q0(fe.current,r))&&(fe.current=r,N(!0))},[r]);const h=he.useMemo(()=>(f==null?void 0:f.length)>1?f==null?void 0:f.map(ue=>{const ie=Af(r==null?void 0:r[ue==null?void 0:ue.coin_type],ue),le=ie==null?void 0:ie.totalBalanceFormat,be=Fe(le).gt("0")?s(ue==null?void 0:ue.coin_type,le):"0";return{...ue,balance:le,rate:be}}):f,[f,r,i]),d=(ue,ie)=>{const le=ie&&ie.toLocaleLowerCase().trim(),be=ue.map(D=>{let F=0,K=0;D.symbol.toLowerCase()===le||D.name.toLowerCase()===le||D.coin_type.toLowerCase()===le?(F=1e3,K=2):D.symbol.toLowerCase().indexOf(le)>-1?(F=100,K=0):D.name.toLowerCase().indexOf(le)>-1?(F=10,K=0):D.coin_type.toLowerCase().indexOf(le)>-1?(F=1,K=0):D.coin_type.toLowerCase()=="0x2::sui::sui"&&(K=1);let te=Array.isArray(D==null?void 0:D.coin_priority)?Number(D.coin_priority[0])||0:Number(D==null?void 0:D.coin_priority)||0;return e===D.coin_type&&!ie&&(K=12,F=1e3,te=1e4),{...D,mark:F,sort:K,coin_priority_sort:te,rateNumber:Number((D==null?void 0:D.rate)||"0"),balanceNumber:Number((D==null?void 0:D.balance)||"0")}});return _Q(be,[D=>!ie&&e===D.coin_type?1:0,"rateNumber","balanceNumber","sort","mark","coin_priority_sort"],["desc","desc","desc","desc","desc","desc"])},m=(ue,ie=!1)=>{const le=ie?ue.trim():ue.toLowerCase().trim(),be=["symbol","name","coin_type"];return pQ(le.length===0?l:[...l,...h],D=>be.some(F=>{const K=D[F];if(typeof K=="string"){const te=ie?K:K.toLowerCase();return F==="coin_type"?te.includes(le)||ms(te,!0).includes(ms(le,!0)):te.includes(le)}return!1}))},x=ue=>{ue||w(void 0);const ie=m(ue);if((ie==null?void 0:ie.length)===0){E(ue);return}else{const le=d(ie,ue);u(le)}},E=async ue=>{y(!0);try{if(p_(ue)){const ie=ue.trim(),le=Sr(ie).full_address,be=await o(le);if(!be){u([]);return}const Ae=Af(r==null?void 0:r[le],be),D=(Ae==null?void 0:Ae.totalBalanceFormat)||"0",F=Fe(D).gt("0")?s(ie,D):"0",K={...be,balance:D,rate:F};u([K]),w(K)}else{u([]);return}}catch{w(void 0),u([]);return}finally{y(!1)}},C=ue=>{if(ue==="Default")g("All"),H("All");else{const ie=d(h,A);u(ie)}},k=()=>{if(S){const ue=v(S,!0),ie=d(ue,A);u(ie),w(void 0),O("")}},M=ue=>{const ie=v(ue,!1),le=d(ie,A);u(le)},g=ue=>{const ie=ue==="All"?[...l]:l.filter(be=>ue=="Native"?!be.labels||be.labels.length==0||be.labels=="Native":be.labels&&be.labels.length>0&&be.labels[0].toLowerCase()==ue.toLowerCase()),le=d(ie,A);u(le)};he.useEffect(()=>{if(!q||!(t!=null&&t.length)){p([]);return}if(!(n!=null&&n.address))p(t);else if(n!=null&&n.address){const ue=[];for(const ie of t){const le=r==null?void 0:r[ie==null?void 0:ie.coin_type],be=Af(le,ie),Ae=(be==null?void 0:be.totalBalanceFormat)||"0",D=(be==null?void 0:be.displayBalance)||"0",F=Fe(Ae).gt("0")?s(ie==null?void 0:ie.coin_type,Ae):"0";ue.push({...ie,balance:D,rate:hn(F,4,!0)})}p(ue)}},[q,ge,z,n==null?void 0:n.address,i]);const b=he.useRef([]);he.useEffect(()=>{if((l==null?void 0:l.length)>0&&!gQ(b.current,l)){b.current=l;const ue=d(l);e?h.find(le=>le.coin_type===e)!==void 0||a!=="Default"?(B("Imported"),C("Imported")):u(S?[S]:ue):u(ue)}},[l,e]);const R=he.useMemo(()=>{if(a==="Default"){if(!V&&(c==null?void 0:c.length)===0)return!0}else if((c==null?void 0:c.length)===0&&!j)return!0;return!1},[A,c,S,j,V]);return{showTokenList:c,handleSearch:x,handleChangePlatform:g,currentImportTokenData:S,handleChangeType:C,handleImportClick:k,handleDeleteImportClick:M,isNoData:R}}function NQ({tokenList:e,onHandleTokenAction:t}){return _.jsx("div",{className:"token-collect-list",children:e.map(r=>_.jsx(DQ,{token:r,onHandleTokenAction:t},r.coin_type))})}function DQ({token:e,onHandleTokenAction:t}){return _.jsxs("div",{className:"token-collect-item",onClick:()=>{t(e,"select_token")},children:[_.jsx(Pr,{src:e==null?void 0:e.logo_url,token:e,style:{width:"20px",height:"20px"}}),_.jsx("span",{style:{marginLeft:"4px"},children:e.symbol}),_.jsx("i",{children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:r=>{r.stopPropagation(),t(e,"un_collect")},children:_.jsx("use",{xlinkHref:"#icon-close"})})})]})}function $Q(e){const{img:t="",text:r,width:n="100%",height:i="100%",padding:s="20px",subItem:o}=e;return _.jsxs("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",width:n,height:i,padding:s,boxSizing:"border-box",textAlign:"center"},children:[t&&_.jsx("img",{src:t,alt:"No Data",style:{width:"160px",height:"160px"}}),r&&_.jsx("div",{style:{color:"var(--cs-text-primary)",fontSize:"14px"},children:r}),o&&o]})}function LQ({tabList:e,currentTab:t,changeTab:r}){return _.jsx("div",{className:"platform-tabs",children:e.map(n=>_.jsx("div",{className:t===n?"platform-tab-item active":"platform-tab-item",onClick:()=>{r(n)},children:n},n))})}var mE=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function BQ(e,t){return!!(e===t||mE(e)&&mE(t))}function UQ(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!BQ(e[r],t[r]))return!1;return!0}function FQ(e,t){t===void 0&&(t=UQ);var r=null;function n(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];if(r&&r.lastThis===this&&t(i,r.lastArgs))return r.lastResult;var o=e.apply(this,i);return r={lastResult:o,lastArgs:i,lastThis:this},o}return n.clear=function(){r=null},n}function Cg(){return Cg=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Cg.apply(null,arguments)}function gE(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ag(e,t){return Ag=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Ag(e,t)}function VQ(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Ag(e,t)}var yE=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function zQ(e,t){return!!(e===t||yE(e)&&yE(t))}function qQ(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!zQ(e[r],t[r]))return!1;return!0}function Ig(e,t){t===void 0&&(t=qQ);var r,n=[],i,s=!1;function o(){for(var a=[],c=0;c<arguments.length;c++)a[c]=arguments[c];return s&&r===this&&t(a,n)||(i=e.apply(this,a),s=!0,r=this,n=a),i}return o}function vE(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var WQ=typeof performance=="object"&&typeof performance.now=="function",bE=WQ?function(){return performance.now()}:function(){return Date.now()};function wE(e){cancelAnimationFrame(e.id)}function GQ(e,t){var r=bE();function n(){bE()-r>=t?e.call(null):i.id=requestAnimationFrame(n)}var i={id:requestAnimationFrame(n)};return i}var Mg=-1;function _E(e){if(e===void 0&&(e=!1),Mg===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),Mg=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Mg}var ac=null;function xE(e){if(e===void 0&&(e=!1),ac===null||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",r.direction="rtl";var n=document.createElement("div"),i=n.style;return i.width="100px",i.height="100px",t.appendChild(n),document.body.appendChild(t),t.scrollLeft>0?ac="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?ac="negative":ac="positive-ascending"),document.body.removeChild(t),ac}return ac}Bn.env.NODE_ENV;var HQ=150,KQ=function(t,r){return t},Od=null,jd=null;Bn.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(Od=new WeakSet,jd=new WeakSet);function YQ(e){var t,r=e.getItemOffset,n=e.getEstimatedTotalSize,i=e.getItemSize,s=e.getOffsetForIndexAndAlignment,o=e.getStartIndexForOffset,a=e.getStopIndexForStartIndex,c=e.initInstanceProps,u=e.shouldResetStyleCacheOnItemSizeChange,l=e.validateProps;return t=function(f){VQ(p,f);function p(w){var y;return y=f.call(this,w)||this,y._instanceProps=c(y.props,gE(y)),y._outerRef=void 0,y._resetIsScrollingTimeoutId=null,y.state={instance:gE(y),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof y.props.initialScrollOffset=="number"?y.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},y._callOnItemsRendered=void 0,y._callOnItemsRendered=Ig(function(S,A,O,j){return y.props.onItemsRendered({overscanStartIndex:S,overscanStopIndex:A,visibleStartIndex:O,visibleStopIndex:j})}),y._callOnScroll=void 0,y._callOnScroll=Ig(function(S,A,O){return y.props.onScroll({scrollDirection:S,scrollOffset:A,scrollUpdateWasRequested:O})}),y._getItemStyle=void 0,y._getItemStyle=function(S){var A=y.props,O=A.direction,j=A.itemSize,V=A.layout,B=y._getItemStyleCache(u&&j,u&&V,u&&O),H;if(B.hasOwnProperty(S))H=B[S];else{var q=r(y.props,S,y._instanceProps),ne=i(y.props,S,y._instanceProps),ge=O==="horizontal"||V==="horizontal",se=O==="rtl",fe=ge?q:0;B[S]=H={position:"absolute",left:se?void 0:fe,right:se?fe:void 0,top:ge?0:q,height:ge?"100%":ne,width:ge?ne:"100%"}}return H},y._getItemStyleCache=void 0,y._getItemStyleCache=Ig(function(S,A,O){return{}}),y._onScrollHorizontal=function(S){var A=S.currentTarget,O=A.clientWidth,j=A.scrollLeft,V=A.scrollWidth;y.setState(function(B){if(B.scrollOffset===j)return null;var H=y.props.direction,q=j;if(H==="rtl")switch(xE()){case"negative":q=-j;break;case"positive-descending":q=V-O-j;break}return q=Math.max(0,Math.min(q,V-O)),{isScrolling:!0,scrollDirection:B.scrollOffset<q?"forward":"backward",scrollOffset:q,scrollUpdateWasRequested:!1}},y._resetIsScrollingDebounced)},y._onScrollVertical=function(S){var A=S.currentTarget,O=A.clientHeight,j=A.scrollHeight,V=A.scrollTop;y.setState(function(B){if(B.scrollOffset===V)return null;var H=Math.max(0,Math.min(V,j-O));return{isScrolling:!0,scrollDirection:B.scrollOffset<H?"forward":"backward",scrollOffset:H,scrollUpdateWasRequested:!1}},y._resetIsScrollingDebounced)},y._outerRefSetter=function(S){var A=y.props.outerRef;y._outerRef=S,typeof A=="function"?A(S):A!=null&&typeof A=="object"&&A.hasOwnProperty("current")&&(A.current=S)},y._resetIsScrollingDebounced=function(){y._resetIsScrollingTimeoutId!==null&&wE(y._resetIsScrollingTimeoutId),y._resetIsScrollingTimeoutId=GQ(y._resetIsScrolling,HQ)},y._resetIsScrolling=function(){y._resetIsScrollingTimeoutId=null,y.setState({isScrolling:!1},function(){y._getItemStyleCache(-1,null)})},y}p.getDerivedStateFromProps=function(y,S){return XQ(y,S),l(y),null};var v=p.prototype;return v.scrollTo=function(y){y=Math.max(0,y),this.setState(function(S){return S.scrollOffset===y?null:{scrollDirection:S.scrollOffset<y?"forward":"backward",scrollOffset:y,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},v.scrollToItem=function(y,S){S===void 0&&(S="auto");var A=this.props,O=A.itemCount,j=A.layout,V=this.state.scrollOffset;y=Math.max(0,Math.min(y,O-1));var B=0;if(this._outerRef){var H=this._outerRef;j==="vertical"?B=H.scrollWidth>H.clientWidth?_E():0:B=H.scrollHeight>H.clientHeight?_E():0}this.scrollTo(s(this.props,y,S,V,this._instanceProps,B))},v.componentDidMount=function(){var y=this.props,S=y.direction,A=y.initialScrollOffset,O=y.layout;if(typeof A=="number"&&this._outerRef!=null){var j=this._outerRef;S==="horizontal"||O==="horizontal"?j.scrollLeft=A:j.scrollTop=A}this._callPropsCallbacks()},v.componentDidUpdate=function(){var y=this.props,S=y.direction,A=y.layout,O=this.state,j=O.scrollOffset,V=O.scrollUpdateWasRequested;if(V&&this._outerRef!=null){var B=this._outerRef;if(S==="horizontal"||A==="horizontal")if(S==="rtl")switch(xE()){case"negative":B.scrollLeft=-j;break;case"positive-ascending":B.scrollLeft=j;break;default:var H=B.clientWidth,q=B.scrollWidth;B.scrollLeft=q-H-j;break}else B.scrollLeft=j;else B.scrollTop=j}this._callPropsCallbacks()},v.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&wE(this._resetIsScrollingTimeoutId)},v.render=function(){var y=this.props,S=y.children,A=y.className,O=y.direction,j=y.height,V=y.innerRef,B=y.innerElementType,H=y.innerTagName,q=y.itemCount,ne=y.itemData,ge=y.itemKey,se=ge===void 0?KQ:ge,fe=y.layout,z=y.outerElementType,N=y.outerTagName,h=y.style,d=y.useIsScrolling,m=y.width,x=this.state.isScrolling,E=O==="horizontal"||fe==="horizontal",C=E?this._onScrollHorizontal:this._onScrollVertical,k=this._getRangeToRender(),M=k[0],g=k[1],b=[];if(q>0)for(var R=M;R<=g;R++)b.push(he.createElement(S,{data:ne,key:se(R,ne),index:R,isScrolling:d?x:void 0,style:this._getItemStyle(R)}));var ue=n(this.props,this._instanceProps);return he.createElement(z||N||"div",{className:A,onScroll:C,ref:this._outerRefSetter,style:Cg({position:"relative",height:j,width:m,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:O},h)},he.createElement(B||H||"div",{children:b,ref:V,style:{height:E?"100%":ue,pointerEvents:x?"none":void 0,width:E?ue:"100%"}}))},v._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var y=this.props.itemCount;if(y>0){var S=this._getRangeToRender(),A=S[0],O=S[1],j=S[2],V=S[3];this._callOnItemsRendered(A,O,j,V)}}if(typeof this.props.onScroll=="function"){var B=this.state,H=B.scrollDirection,q=B.scrollOffset,ne=B.scrollUpdateWasRequested;this._callOnScroll(H,q,ne)}},v._getRangeToRender=function(){var y=this.props,S=y.itemCount,A=y.overscanCount,O=this.state,j=O.isScrolling,V=O.scrollDirection,B=O.scrollOffset;if(S===0)return[0,0,0,0];var H=o(this.props,B,this._instanceProps),q=a(this.props,H,B,this._instanceProps),ne=!j||V==="backward"?Math.max(1,A):1,ge=!j||V==="forward"?Math.max(1,A):1;return[Math.max(0,H-ne),Math.max(0,Math.min(S-1,q+ge)),H,q]},p}(he.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var XQ=function(t,r){var n=t.children,i=t.direction,s=t.height,o=t.layout,a=t.innerTagName,c=t.outerTagName,u=t.width,l=r.instance;if(Bn.env.NODE_ENV!=="production"){(a!=null||c!=null)&&jd&&!jd.has(l)&&(jd.add(l),console.warn("The innerTagName and outerTagName props have been deprecated. Please use the innerElementType and outerElementType props instead."));var f=i==="horizontal"||o==="horizontal";switch(i){case"horizontal":case"vertical":Od&&!Od.has(l)&&(Od.add(l),console.warn('The direction prop should be either "ltr" (default) or "rtl". Please use the layout prop to specify "vertical" (default) or "horizontal" orientation.'));break;case"ltr":case"rtl":break;default:throw Error('An invalid "direction" prop has been specified. Value should be either "ltr" or "rtl". '+('"'+i+'" was specified.'))}switch(o){case"horizontal":case"vertical":break;default:throw Error('An invalid "layout" prop has been specified. Value should be either "horizontal" or "vertical". '+('"'+o+'" was specified.'))}if(n==null)throw Error('An invalid "children" prop has been specified. Value should be a React component. '+('"'+(n===null?"null":typeof n)+'" was specified.'));if(f&&typeof u!="number")throw Error('An invalid "width" prop has been specified. Horizontal lists must specify a number for width. '+('"'+(u===null?"null":typeof u)+'" was specified.'));if(!f&&typeof s!="number")throw Error('An invalid "height" prop has been specified. Vertical lists must specify a number for height. '+('"'+(s===null?"null":typeof s)+'" was specified.'))}},JQ=YQ({getItemOffset:function(t,r){var n=t.itemSize;return r*n},getItemSize:function(t,r){var n=t.itemSize;return n},getEstimatedTotalSize:function(t){var r=t.itemCount,n=t.itemSize;return n*r},getOffsetForIndexAndAlignment:function(t,r,n,i,s,o){var a=t.direction,c=t.height,u=t.itemCount,l=t.itemSize,f=t.layout,p=t.width,v=a==="horizontal"||f==="horizontal",w=v?p:c,y=Math.max(0,u*l-w),S=Math.min(y,r*l),A=Math.max(0,r*l-w+l+o);switch(n==="smart"&&(i>=A-w&&i<=S+w?n="auto":n="center"),n){case"start":return S;case"end":return A;case"center":{var O=Math.round(A+(S-A)/2);return O<Math.ceil(w/2)?0:O>y+Math.floor(w/2)?y:O}case"auto":default:return i>=A&&i<=S?i:i<A?A:S}},getStartIndexForOffset:function(t,r){var n=t.itemCount,i=t.itemSize;return Math.max(0,Math.min(n-1,Math.floor(r/i)))},getStopIndexForStartIndex:function(t,r,n){var i=t.direction,s=t.height,o=t.itemCount,a=t.itemSize,c=t.layout,u=t.width,l=i==="horizontal"||c==="horizontal",f=r*a,p=l?u:s,v=Math.ceil((p+n-f)/a);return Math.max(0,Math.min(o-1,r+v-1))},initInstanceProps:function(t){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(t){var r=t.itemSize;if(Bn.env.NODE_ENV!=="production"&&typeof r!="number")throw Error('An invalid "itemSize" prop has been specified. Value should be a number. '+('"'+(r===null?"null":typeof r)+'" was specified.'))}});function SE(e,t){for(var r in e)if(!(r in t))return!0;for(var n in t)if(e[n]!==t[n])return!0;return!1}var ZQ=["style"],QQ=["style"];function eee(e,t){var r=e.style,n=vE(e,ZQ),i=t.style,s=vE(t,QQ);return!SE(r,i)&&!SE(n,s)}const tee=he.memo(({data:e,index:t,style:r})=>{const{items:n,onHandleTokenAction:i,showCollect:s,showDelete:o}=e,a=n[t];return _.jsx("div",{style:r,children:_.jsx(iee,{data:a,onHandleTokenAction:i,showCollect:s,showDelete:o})})},eee),ree=FQ((e,t,r,n)=>({items:e,onHandleTokenAction:t,showCollect:r,showDelete:n}));function nee({showTokenList:e,onHandleTokenAction:t,showCollect:r=!0,showDelete:n=!1}){const i=he.useRef(null);he.useEffect(()=>{i.current&&i.current.scrollTo(0)},[e.length]);const s=ree(e,t,r,n);return _.jsx("div",{className:"token-list",children:_.jsx(JQ,{ref:i,style:{overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none",padding:"8px"},height:360,itemCount:e.length,itemData:s,itemSize:72,width:"100%",children:tee})})}function iee({data:e,showCollect:t,showDelete:r,onHandleTokenAction:n}){const{isCollectToken:i}=pE(),{getExplorerUrl:s}=Ba();return Cu(),_.jsxs("div",{className:"token-list-item",onClick:o=>{t&&(o.stopPropagation(),n(e,"select_token"))},children:[_.jsx(Pr,{className:"token-img",src:e==null?void 0:e.logo_url,token:e,showWarnSize:"16px",showWarn:!t}),_.jsxs("div",{className:"token-info",children:[_.jsx("h4",{className:"token-symbol",children:_.jsx("span",{children:Ur(e.symbol)})}),_.jsx("p",{className:"token-name",children:Ur(e==null?void 0:e.name,20)}),_.jsxs("div",{className:"copy",children:[_.jsx("a",{onClick:_f,href:s(e==null?void 0:e.coin_type,"coin"),target:"_blank",style:{fontSize:"12px"},children:qo(e==null?void 0:e.coin_type)}),_.jsx(Id,{text:e==null?void 0:e.coin_type})]})]}),_.jsxs("div",{className:"token-balance",children:[_.jsxs("div",{className:"balance",children:[_.jsx("h4",{children:e==null?void 0:e.balance}),_.jsx("p",{children:e!=null&&e.rate?u_(e==null?void 0:e.rate,2):""})]}),r&&_.jsx("div",{className:"collect-button",onClick:o=>{o.stopPropagation(),n(e,"delete_import")},children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-icon_del1"})})}),t&&_.jsx("div",{className:"collect-button",onClick:o=>{o.stopPropagation(),n(e,"collect_token")},children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:i(e)?"#icon-star_sel":"#icon-star"})})})]})]},e==null?void 0:e.coin_type)}function see({currentType:e,changeTab:t}){const r=["Default","Imported"];return _.jsx("div",{className:"type-tabs",children:r.map(n=>_.jsx("div",{className:e===n?"type-tab-item active":"type-tab-item",onClick:()=>t(n),children:n},n))})}function oee({backClick:e,onSelectToken:t,currToken:r}){const{showTokenList:n,isNoData:i,handleSearch:s,handleChangePlatform:o,handleChangeType:a,handleImportClick:c,handleDeleteImportClick:u}=RQ(r==null?void 0:r.coin_type),{importTokenList:l,currentTypeTab:f,setCurrentTypeTab:p,currentPlatformTab:v,setCurrentPlatformTab:w,platformList:y,isOpenImportDialog:S,setIsOpenImportDialog:A,setSearchInput:O,searchInput:j,importTokenIsLoading:V,currentImportTokenData:B,setCurrentImportTokenData:H}=Wo();he.useEffect(()=>()=>{O(""),w("All"),p("Default"),H(void 0)},[]);const{handleCollectToken:q,collectTokenMap:ne}=pE(),ge=m=>{p(m),a(m)},se=m=>{w(m),o(m)},fe=()=>{c(),A(!1)},z=m=>{let x=m.replace(/[^a-zA-Z0-9\s]+$/g,"").trim();O(x),x?N(x):(N(""),ge("Default"))},N=og(m=>{p_(m)?s(ms(m,!0)):s(m)},300),h=(m,x)=>{if(x==="delete_import"){u(m);return}if(x==="collect_token"||x==="un_collect"){q(m);return}x==="select_token"&&(t(m),e())},d=he.useMemo(()=>Array.from(ne.values()),[ne]);return _.jsxs("div",{className:"token-select-modal",children:[_.jsx(cg,{backClick:e,title:"Select Token"}),_.jsxs("div",{className:"token-select-content",style:{position:"relative"},children:[_.jsxs("div",{className:"center-content",children:[_.jsxs("div",{className:"search-input",style:{position:"relative"},children:[_.jsx("input",{className:"token-search-input",placeholder:"Search by token or address",value:j,onChange:m=>z(m.target.value),style:{paddingRight:"40px"}}),j.length>0&&_.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{width:"20px",height:"20px",cursor:"pointer",position:"absolute",top:"50%",transform:"translateY(-50%)",right:"12px"},onClick:m=>{z("")},children:_.jsx("use",{xlinkHref:"#icon-close"})})]}),d.length>0&&_.jsx(NQ,{tokenList:d,onHandleTokenAction:h}),j.length===0&&_.jsx(see,{currentType:f,changeTab:ge}),j.length===0&&f==="Default"&&_.jsx(LQ,{tabList:y,currentTab:v,changeTab:se})]}),i&&_.jsx(aee,{showTooltip:j.length>0,text:j.length>0||B===void 0?"No tokens found":"No Imported Tokens"}),V&&_.jsx(G5,{}),B&&_.jsx("div",{style:{width:"93%",marginLeft:"16px",backgroundColor:"var(--cs-warning-10)",borderRadius:"12px",padding:"16px",fontSize:"12px",marginTop:"16px",color:" var(--cs-warning)"},children:"The token is not on the Frequently Traded List. Please note that anyone can create a token on Sui blockchain with any name, including creating fake versions of existing tokens or tokens that claim to represent projects that do not have a token. Always conduct your own research before trading."}),n.length>0&&_.jsxs("div",{style:{position:"relative"},children:[_.jsx(nee,{showTokenList:n,showCollect:!B,showDelete:!B&&f==="Imported",onHandleTokenAction:h}),B&&_.jsx("div",{className:"center",style:{position:"absolute",top:"100px",left:"50%",transform:"translateX(-50%)"},children:_.jsx("button",{className:"cs-solid-btn swap-btn",style:{height:"32px",width:"140px",fontSize:"14px",borderRadius:"8px",fontFamily:"Inter, Inter",fontWeight:500},onClick:()=>{fe(),h(B,"select_token")},children:"Import"})})]})]})]})}function aee({showTooltip:e,text:t}){return _.jsx("div",{style:{height:"360px"},children:_.jsx($Q,{text:t,subItem:e?_.jsx("div",{children:_.jsx(Jo,{position:"bottom",content:_.jsx("div",{style:{color:"var(--cs-text-primary)"},children:"The unique id of coin"}),children:_.jsxs("div",{style:{fontSize:"12px",color:"var(--cs-text-secondary)",display:"flex",flexDirection:"row"},children:["Or you can enter Coin Type",_.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{cursor:"pointer",width:"20px",height:"20px"},children:_.jsx("use",{xlinkHref:"#icon-tips"})})]})})}):void 0})})}function cee({onClose:e,tokenList:t,onSureClick:r}){const[n,i]=he.useState(!1),{setIgnoreWarnToken:s}=en();return _.jsxs(_.Fragment,{children:[_.jsx("div",{className:"dialog-mask",onClick:e}),_.jsxs("div",{className:"import-dialog",children:[_.jsxs("div",{className:"cs-dialog-header",children:[_.jsx("div",{className:"title",children:"Tips"}),_.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:e,children:_.jsx("use",{xlinkHref:"#icon-close"})})]}),_.jsxs("div",{className:"import-content",children:[_.jsx("div",{className:"tip-text-box",children:_.jsx("p",{className:"tips-text",children:"The default trading pair given in this swap widget contains a community imported token that is imported by the integrator. Please acknowledge the risk and conduct your own research before interacting."})}),t.map(o=>_.jsxs("div",{className:"import-token-info",children:[_.jsx(Pr,{style:{width:"30px",height:"30px",borderRadius:"36px"},token:o,showWarnSize:"16px",src:o.logo_url}),_.jsxs("div",{className:"info",children:[_.jsx("div",{className:"name",children:_.jsxs("span",{children:[" ",o.symbol," "]})}),_.jsxs("div",{className:"address",children:[_.jsx("span",{children:qo(o.coin_type)}),_.jsx(Id,{text:o.coin_type})]})]})]},o.coin_type)),_.jsxs("div",{className:"risk-checkbox ",children:[_.jsx(Kf,{color:"indigo",checked:n,variant:"soft",className:"cs-checkbox cs-allow-change-checkbox",onClick:()=>{i(!n)}}),_.jsx("span",{children:"I acknowledge the risk"})]}),_.jsxs("div",{className:"button-block",children:[_.jsx("button",{className:"cs-outline-btn",onClick:e,children:"Cancel"}),_.jsx("button",{className:"cs-solid-btn",disabled:!n,onClick:()=>{r(),t.forEach(o=>{s(o.coin_type)})},children:"Confirm"})]})]})]})]})}const Jte="";function EE(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}var Ru;(function(e){e.event="event",e.props="prop"})(Ru||(Ru={}));function po(){}function uee(e){var t,r=void 0;return function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];return t&&n.length===t.length&&n.every(function(s,o){return s===t[o]})||(t=n,r=e.apply(void 0,n)),r}}function Nu(e){return!!(e||"").match(/\d/)}function cc(e){return e==null}function lee(e){return typeof e=="number"&&isNaN(e)}function TE(e){return cc(e)||lee(e)||typeof e=="number"&&!isFinite(e)}function CE(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function fee(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;case"thousand":default:return/(\d)(?=(\d{3})+(?!\d))/g}}function dee(e,t,r){var n=fee(r),i=e.search(/[1-9]/);return i=i===-1?e.length:i,e.substring(0,i)+e.substring(i,e.length).replace(n,"$1"+t)}function hee(e){var t=he.useRef(e);t.current=e;var r=he.useRef(function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];return t.current.apply(t,n)});return r.current}function Og(e,t){t===void 0&&(t=!0);var r=e[0]==="-",n=r&&t;e=e.replace("-","");var i=e.split("."),s=i[0],o=i[1]||"";return{beforeDecimal:s,afterDecimal:o,hasNegation:r,addNegation:n}}function pee(e){if(!e)return e;var t=e[0]==="-";t&&(e=e.substring(1,e.length));var r=e.split("."),n=r[0].replace(/^0+/,"")||"0",i=r[1]||"";return(t?"-":"")+n+(i?"."+i:"")}function AE(e,t,r){for(var n="",i=r?"0":"",s=0;s<=t-1;s++)n+=e[s]||i;return n}function IE(e,t){return Array(t+1).join(e)}function ME(e){var t=e+"",r=t[0]==="-"?"-":"";r&&(t=t.substring(1));var n=t.split(/[eE]/g),i=n[0],s=n[1];if(s=Number(s),!s)return r+i;i=i.replace(".","");var o=1+s,a=i.length;return o<0?i="0."+IE("0",Math.abs(o))+i:o>=a?i=i+IE("0",o-a):i=(i.substring(0,o)||"0")+"."+i.substring(o),r+i}function OE(e,t,r){if(["","-"].indexOf(e)!==-1)return e;var n=(e.indexOf(".")!==-1||r)&&t,i=Og(e),s=i.beforeDecimal,o=i.afterDecimal,a=i.hasNegation,c=parseFloat("0."+(o||"0")),u=o.length<=t?"0."+o:c.toFixed(t),l=u.split("."),f=s;s&&Number(l[0])&&(f=s.split("").reverse().reduce(function(y,S,A){return y.length>A?(Number(y[0])+Number(S)).toString()+y.substring(1,y.length):S+y},l[0]));var p=AE(l[1]||"",t,r),v=a?"-":"",w=n?".":"";return""+v+f+w+p}function ia(e,t){if(e.value=e.value,e!==null){if(e.createTextRange){var r=e.createTextRange();return r.move("character",t),r.select(),!0}return e.selectionStart||e.selectionStart===0?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}var jE=uee(function(e,t){for(var r=0,n=0,i=e.length,s=t.length;e[r]===t[r]&&r<i;)r++;for(;e[i-1-n]===t[s-1-n]&&s-n>r&&i-n>r;)n++;return{from:{start:r,end:i-n},to:{start:r,end:s-n}}}),mee=function(e,t){var r=Math.min(e.selectionStart,t);return{from:{start:r,end:e.selectionEnd},to:{start:r,end:t}}};function gee(e,t,r){return Math.min(Math.max(e,t),r)}function jg(e){return Math.max(e.selectionStart,e.selectionEnd)}function yee(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function vee(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function bee(e){var t=e.currentValue,r=e.formattedValue,n=e.currentValueIndex,i=e.formattedValueIndex;return t[n]===r[i]}function wee(e,t,r,n,i,s,o){o===void 0&&(o=bee);var a=i.findIndex(function(V){return V}),c=e.slice(0,a);!t&&!r.startsWith(c)&&(t=c,r=c+r,n=n+c.length);for(var u=r.length,l=e.length,f={},p=new Array(u),v=0;v<u;v++){p[v]=-1;for(var w=0,y=l;w<y;w++){var S=o({currentValue:r,lastValue:t,formattedValue:e,currentValueIndex:v,formattedValueIndex:w});if(S&&f[w]!==!0){p[v]=w,f[w]=!0;break}}}for(var A=n;A<u&&(p[A]===-1||!s(r[A]));)A++;var O=A===u||p[A]===-1?l:p[A];for(A=n-1;A>0&&p[A]===-1;)A--;var j=A===-1||p[A]===-1?0:p[A]+1;return j>O?O:n-j<O-n?j:O}function kE(e,t,r,n){var i=e.length;if(t=gee(t,0,i),n==="left"){for(;t>=0&&!r[t];)t--;t===-1&&(t=r.indexOf(!0))}else{for(;t<=i&&!r[t];)t++;t>i&&(t=r.lastIndexOf(!0))}return t===-1&&(t=i),t}function _ee(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),r=0,n=t.length;r<n;r++)t[r]=!!(Nu(e[r])||Nu(e[r-1]));return t}function PE(e,t,r,n,i,s){s===void 0&&(s=po);var o=hee(function(w,y){var S,A;return TE(w)?(A="",S=""):typeof w=="number"||y?(A=typeof w=="number"?ME(w):w,S=n(A)):(A=i(w,void 0),S=n(A)),{formattedValue:S,numAsString:A}}),a=he.useState(function(){return o(cc(e)?t:e,r)}),c=a[0],u=a[1],l=function(w,y){w.formattedValue!==c.formattedValue&&u({formattedValue:w.formattedValue,numAsString:w.value}),s(w,y)},f=e,p=r;cc(e)&&(f=c.numAsString,p=!0);var v=o(f,p);return he.useMemo(function(){u(v)},[v.formattedValue]),[c,l]}function xee(e){return e.replace(/[^0-9]/g,"")}function See(e){return e}function Eee(e){var t=e.type;t===void 0&&(t="text");var r=e.displayType;r===void 0&&(r="input");var n=e.customInput,i=e.renderText,s=e.getInputRef,o=e.format;o===void 0&&(o=See);var a=e.removeFormatting;a===void 0&&(a=xee);var c=e.defaultValue,u=e.valueIsNumericString,l=e.onValueChange,f=e.isAllowed,p=e.onChange;p===void 0&&(p=po);var v=e.onKeyDown;v===void 0&&(v=po);var w=e.onMouseUp;w===void 0&&(w=po);var y=e.onFocus;y===void 0&&(y=po);var S=e.onBlur;S===void 0&&(S=po);var A=e.value,O=e.getCaretBoundary;O===void 0&&(O=_ee);var j=e.isValidInputCharacter;j===void 0&&(j=Nu);var V=e.isCharacterSame,B=EE(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),H=PE(A,c,!!u,o,a,l),q=H[0],ne=q.formattedValue,ge=q.numAsString,se=H[1],fe=he.useRef(),z=he.useRef({formattedValue:ne,numAsString:ge}),N=function(X,J){z.current={formattedValue:X.formattedValue,numAsString:X.value},se(X,J)},h=he.useState(!1),d=h[0],m=h[1],x=he.useRef(null),E=he.useRef({setCaretTimeout:null,focusTimeout:null});he.useEffect(function(){return m(!0),function(){clearTimeout(E.current.setCaretTimeout),clearTimeout(E.current.focusTimeout)}},[]);var C=o,k=function(X,J){var U=parseFloat(J);return{formattedValue:X,value:J,floatValue:isNaN(U)?void 0:U}},M=function(X,J,U){X.selectionStart===0&&X.selectionEnd===X.value.length||(ia(X,J),E.current.setCaretTimeout=setTimeout(function(){X.value===U&&X.selectionStart!==J&&ia(X,J)},0))},g=function(X,J,U){return kE(X,J,O(X),U)},b=function(X,J,U){var oe=O(J),ye=wee(J,ne,X,U,oe,j,V);return ye=kE(J,ye,oe),ye},R=function(X){var J=X.formattedValue;J===void 0&&(J="");var U=X.input,oe=X.source,ye=X.event,de=X.numAsString,Ee;if(U){var je=X.inputValue||U.value,Ve=jg(U);U.value=J,Ee=b(je,J,Ve),Ee!==void 0&&M(U,Ee,J)}J!==ne&&N(k(J,de),{event:ye,source:oe})};he.useEffect(function(){var X=z.current,J=X.formattedValue,U=X.numAsString;(ne!==J||ge!==U)&&N(k(ne,ge),{event:void 0,source:Ru.props})},[ne,ge]);var ue=x.current?jg(x.current):void 0,ie=typeof window<"u"?he.useLayoutEffect:he.useEffect;ie(function(){var X=x.current;if(ne!==z.current.formattedValue&&X){var J=b(z.current.formattedValue,ne,ue);X.value=ne,M(X,J,ne)}},[ne]);var le=function(X,J,U){var oe=J.target,ye=fe.current?mee(fe.current,oe.selectionEnd):jE(ne,X),de=Object.assign(Object.assign({},ye),{lastValue:ne}),Ee=a(X,de),je=C(Ee);if(Ee=a(je,void 0),f&&!f(k(je,Ee))){var Ve=J.target,Je=jg(Ve),$e=b(X,ne,Je);return Ve.value=ne,M(Ve,$e,ne),!1}return R({formattedValue:je,numAsString:Ee,inputValue:X,event:J,source:U,input:J.target}),!0},be=function(X,J){J===void 0&&(J=0);var U=X.selectionStart,oe=X.selectionEnd;fe.current={selectionStart:U,selectionEnd:oe+J}},Ae=function(X){var J=X.target,U=J.value,oe=le(U,X,Ru.event);oe&&p(X),fe.current=void 0},D=function(X){var J=X.target,U=X.key,oe=J.selectionStart,ye=J.selectionEnd,de=J.value;de===void 0&&(de="");var Ee;U==="ArrowLeft"||U==="Backspace"?Ee=Math.max(oe-1,0):U==="ArrowRight"?Ee=Math.min(oe+1,de.length):U==="Delete"&&(Ee=oe);var je=0;U==="Delete"&&oe===ye&&(je=1);var Ve=U==="ArrowLeft"||U==="ArrowRight";if(Ee===void 0||oe!==ye&&!Ve){v(X),be(J,je);return}var Je=Ee;if(Ve){var $e=U==="ArrowLeft"?"left":"right";Je=g(de,Ee,$e),Je!==Ee&&X.preventDefault()}else U==="Delete"&&!j(de[Ee])?Je=g(de,Ee,"right"):U==="Backspace"&&!j(de[Ee])&&(Je=g(de,Ee,"left"));Je!==Ee&&M(J,Je,de),v(X),be(J,je)},F=function(X){var J=X.target,U=function(){var oe=J.selectionStart,ye=J.selectionEnd,de=J.value;if(de===void 0&&(de=""),oe===ye){var Ee=g(de,oe);Ee!==oe&&M(J,Ee,de)}};U(),requestAnimationFrame(function(){U()}),w(X),be(J)},K=function(X){X.persist&&X.persist();var J=X.target,U=X.currentTarget;x.current=J,E.current.focusTimeout=setTimeout(function(){var oe=J.selectionStart,ye=J.selectionEnd,de=J.value;de===void 0&&(de="");var Ee=g(de,oe);Ee!==oe&&!(oe===0&&ye===de.length)&&M(J,Ee,de),y(Object.assign(Object.assign({},X),{currentTarget:U}))},0)},te=function(X){x.current=null,clearTimeout(E.current.focusTimeout),clearTimeout(E.current.setCaretTimeout),S(X)},Q=d&&yee()?"numeric":void 0,G=Object.assign({inputMode:Q},B,{type:t,value:ne,onChange:Ae,onKeyDown:D,onMouseUp:F,onFocus:K,onBlur:te});if(r==="text")return i?he.createElement(he.Fragment,null,i(ne,B)||null):he.createElement("span",Object.assign({},B,{ref:s}),ne);if(n){var pe=n;return he.createElement(pe,Object.assign({},G,{ref:s}))}return he.createElement("input",Object.assign({},G,{ref:s}))}function RE(e,t){var r=t.decimalScale,n=t.fixedDecimalScale,i=t.prefix;i===void 0&&(i="");var s=t.suffix;s===void 0&&(s="");var o=t.allowNegative,a=t.thousandsGroupStyle;if(a===void 0&&(a="thousand"),e===""||e==="-")return e;var c=kd(t),u=c.thousandSeparator,l=c.decimalSeparator,f=r!==0&&e.indexOf(".")!==-1||r&&n,p=Og(e,o),v=p.beforeDecimal,w=p.afterDecimal,y=p.addNegation;return r!==void 0&&(w=AE(w,r,!!n)),u&&(v=dee(v,u,a)),i&&(v=i+v),s&&(w=w+s),y&&(v="-"+v),e=v+(f&&l||"")+w,e}function kd(e){var t=e.decimalSeparator;t===void 0&&(t=".");var r=e.thousandSeparator,n=e.allowedDecimalSeparators;return r===!0&&(r=","),n||(n=[t,"."]),{decimalSeparator:t,thousandSeparator:r,allowedDecimalSeparators:n}}function Tee(e,t){e===void 0&&(e="");var r=new RegExp("(-)"),n=new RegExp("(-)(.)*(-)"),i=r.test(e),s=n.test(e);return e=e.replace(/-/g,""),i&&!s&&t&&(e="-"+e),e}function Cee(e,t){return new RegExp("(^-)|[0-9]|"+CE(e),t?"g":void 0)}function Aee(e,t,r){return e===""?!0:!(t!=null&&t.match(/\d/))&&!(r!=null&&r.match(/\d/))&&typeof e=="string"&&!isNaN(Number(e))}function Iee(e,t,r){var n;t===void 0&&(t=vee(e));var i=r.allowNegative,s=r.prefix;s===void 0&&(s="");var o=r.suffix;o===void 0&&(o="");var a=r.decimalScale,c=t.from,u=t.to,l=u.start,f=u.end,p=kd(r),v=p.allowedDecimalSeparators,w=p.decimalSeparator,y=e[f]===w;if(Nu(e)&&(e===s||e===o)&&t.lastValue==="")return e;if(f-l===1&&v.indexOf(e[l])!==-1){var S=a===0?"":w;e=e.substring(0,l)+S+e.substring(l+1,e.length)}var A=function(x,E,C){var k=!1,M=!1;s.startsWith("-")?k=!1:x.startsWith("--")?(k=!1,M=!0):o.startsWith("-")&&x.length===o.length?k=!1:x[0]==="-"&&(k=!0);var g=k?1:0;return M&&(g=2),g&&(x=x.substring(g),E-=g,C-=g),{value:x,start:E,end:C,hasNegation:k}},O=A(e,l,f),j=O.hasNegation;n=O,e=n.value,l=n.start,f=n.end;var V=A(t.lastValue,c.start,c.end),B=V.start,H=V.end,q=V.value,ne=e.substring(l,f);e.length&&q.length&&(B>q.length-o.length||H<s.length)&&!(ne&&o.startsWith(ne))&&(e=q);var ge=0;e.startsWith(s)?ge+=s.length:l<s.length&&(ge=l),e=e.substring(ge),f-=ge;var se=e.length,fe=e.length-o.length;e.endsWith(o)?se=fe:(f>fe||f>e.length-o.length)&&(se=f),e=e.substring(0,se),e=Tee(j?"-"+e:e,i),e=(e.match(Cee(w,!0))||[]).join("");var z=e.indexOf(w);e=e.replace(new RegExp(CE(w),"g"),function(x,E){return E===z?".":""});var N=Og(e,i),h=N.beforeDecimal,d=N.afterDecimal,m=N.addNegation;return u.end-u.start<c.end-c.start&&h===""&&y&&!parseFloat(d)&&(e=m?"-":""),e}function Mee(e,t){var r=t.prefix;r===void 0&&(r="");var n=t.suffix;n===void 0&&(n="");var i=Array.from({length:e.length+1}).map(function(){return!0}),s=e[0]==="-";i.fill(!1,0,r.length+(s?1:0));var o=e.length;return i.fill(!1,o-n.length+1,o+1),i}function Oee(e){var t=kd(e),r=t.thousandSeparator,n=t.decimalSeparator,i=e.prefix;i===void 0&&(i="");var s=e.allowNegative;if(s===void 0&&(s=!0),r===n)throw new Error(`
|
|
109
|
+
`)},Vq=0,Za=[];function zq(e){var t=P.useRef([]),r=P.useRef([0,0]),n=P.useRef(),i=P.useState(Vq++)[0],s=P.useState(iS)[0],o=P.useRef(e);P.useEffect(function(){o.current=e},[e]),P.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var y=lq([e.lockRef.current],(e.shards||[]).map(fS),!0).filter(Boolean);return y.forEach(function(S){return S.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),y.forEach(function(S){return S.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var a=P.useCallback(function(y,S){if("touches"in y&&y.touches.length===2||y.type==="wheel"&&y.ctrlKey)return!o.current.allowPinchZoom;var A=td(y),O=r.current,j="deltaX"in y?y.deltaX:O[0]-A[0],V="deltaY"in y?y.deltaY:O[1]-A[1],B,H=y.target,q=Math.abs(j)>Math.abs(V)?"h":"v";if("touches"in y&&q==="h"&&H.type==="range")return!1;var ne=aS(q,H);if(!ne)return!0;if(ne?B=q:(B=q==="v"?"h":"v",ne=aS(q,H)),!ne)return!1;if(!n.current&&"changedTouches"in y&&(j||V)&&(n.current=B),!B)return!0;var ge=n.current||B;return Bq(ge,S,y,ge==="h"?j:V,!0)},[]),c=P.useCallback(function(y){var S=y;if(!(!Za.length||Za[Za.length-1]!==s)){var A="deltaY"in S?lS(S):td(S),O=t.current.filter(function(B){return B.name===S.type&&(B.target===S.target||S.target===B.shadowParent)&&Uq(B.delta,A)})[0];if(O&&O.should){S.cancelable&&S.preventDefault();return}if(!O){var j=(o.current.shards||[]).map(fS).filter(Boolean).filter(function(B){return B.contains(S.target)}),V=j.length>0?a(S,j[0]):!o.current.noIsolation;V&&S.cancelable&&S.preventDefault()}}},[]),u=P.useCallback(function(y,S,A,O){var j={name:y,delta:S,target:A,should:O,shadowParent:qq(A)};t.current.push(j),setTimeout(function(){t.current=t.current.filter(function(V){return V!==j})},1)},[]),l=P.useCallback(function(y){r.current=td(y),n.current=void 0},[]),f=P.useCallback(function(y){u(y.type,lS(y),y.target,a(y,e.lockRef.current))},[]),p=P.useCallback(function(y){u(y.type,td(y),y.target,a(y,e.lockRef.current))},[]);P.useEffect(function(){return Za.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",c,Ja),document.addEventListener("touchmove",c,Ja),document.addEventListener("touchstart",l,Ja),function(){Za=Za.filter(function(y){return y!==s}),document.removeEventListener("wheel",c,Ja),document.removeEventListener("touchmove",c,Ja),document.removeEventListener("touchstart",l,Ja)}},[]);var v=e.removeScrollBar,w=e.inert;return P.createElement(P.Fragment,null,w?P.createElement(s,{styles:Fq(i)}):null,v?P.createElement(kq,{gapMode:e.gapMode}):null)}function qq(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Wq=bq(rS,zq);var dS=P.forwardRef(function(e,t){return P.createElement(Qf,Fi({},e,{ref:t,sideCar:Wq}))});dS.classNames=Qf.classNames;const Gq=dS;function Hq(e,t){return P.useReducer((r,n)=>t[r][n]??r,e)}var Bm="ScrollArea",[hS,Ote]=bs(Bm),[Kq,Nn]=hS(Bm),pS=P.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:i,scrollHideDelay:s=600,...o}=e,[a,c]=P.useState(null),[u,l]=P.useState(null),[f,p]=P.useState(null),[v,w]=P.useState(null),[y,S]=P.useState(null),[A,O]=P.useState(0),[j,V]=P.useState(0),[B,H]=P.useState(!1),[q,ne]=P.useState(!1),ge=Jt(t,fe=>c(fe)),se=Tm(i);return _.jsx(Kq,{scope:r,type:n,dir:se,scrollHideDelay:s,scrollArea:a,viewport:u,onViewportChange:l,content:f,onContentChange:p,scrollbarX:v,onScrollbarXChange:w,scrollbarXEnabled:B,onScrollbarXEnabledChange:H,scrollbarY:y,onScrollbarYChange:S,scrollbarYEnabled:q,onScrollbarYEnabledChange:ne,onCornerWidthChange:O,onCornerHeightChange:V,children:_.jsx(Zt.div,{dir:se,...o,ref:ge,style:{position:"relative","--radix-scroll-area-corner-width":A+"px","--radix-scroll-area-corner-height":j+"px",...e.style}})})});pS.displayName=Bm;var mS="ScrollAreaViewport",gS=P.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:i,...s}=e,o=Nn(mS,r),a=P.useRef(null),c=Jt(t,a,o.onViewportChange);return _.jsxs(_.Fragment,{children:[_.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),_.jsx(Zt.div,{"data-radix-scroll-area-viewport":"",...s,ref:c,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...e.style},children:_.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});gS.displayName=mS;var Vi="ScrollAreaScrollbar",yS=P.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=Nn(Vi,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:o}=i,a=e.orientation==="horizontal";return P.useEffect(()=>(a?s(!0):o(!0),()=>{a?s(!1):o(!1)}),[a,s,o]),i.type==="hover"?_.jsx(Yq,{...n,ref:t,forceMount:r}):i.type==="scroll"?_.jsx(Xq,{...n,ref:t,forceMount:r}):i.type==="auto"?_.jsx(vS,{...n,ref:t,forceMount:r}):i.type==="always"?_.jsx(Um,{...n,ref:t}):null});yS.displayName=Vi;var Yq=P.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=Nn(Vi,e.__scopeScrollArea),[s,o]=P.useState(!1);return P.useEffect(()=>{const a=i.scrollArea;let c=0;if(a){const u=()=>{window.clearTimeout(c),o(!0)},l=()=>{c=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return a.addEventListener("pointerenter",u),a.addEventListener("pointerleave",l),()=>{window.clearTimeout(c),a.removeEventListener("pointerenter",u),a.removeEventListener("pointerleave",l)}}},[i.scrollArea,i.scrollHideDelay]),_.jsx(oi,{present:r||s,children:_.jsx(vS,{"data-state":s?"visible":"hidden",...n,ref:t})})}),Xq=P.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=Nn(Vi,e.__scopeScrollArea),s=e.orientation==="horizontal",o=sd(()=>c("SCROLL_END"),100),[a,c]=Hq("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return P.useEffect(()=>{if(a==="idle"){const u=window.setTimeout(()=>c("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(u)}},[a,i.scrollHideDelay,c]),P.useEffect(()=>{const u=i.viewport,l=s?"scrollLeft":"scrollTop";if(u){let f=u[l];const p=()=>{const v=u[l];f!==v&&(c("SCROLL"),o()),f=v};return u.addEventListener("scroll",p),()=>u.removeEventListener("scroll",p)}},[i.viewport,s,c,o]),_.jsx(oi,{present:r||a!=="hidden",children:_.jsx(Um,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:wt(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:wt(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),vS=P.forwardRef((e,t)=>{const r=Nn(Vi,e.__scopeScrollArea),{forceMount:n,...i}=e,[s,o]=P.useState(!1),a=e.orientation==="horizontal",c=sd(()=>{if(r.viewport){const u=r.viewport.offsetWidth<r.viewport.scrollWidth,l=r.viewport.offsetHeight<r.viewport.scrollHeight;o(a?u:l)}},10);return Qa(r.viewport,c),Qa(r.content,c),_.jsx(oi,{present:n||s,children:_.jsx(Um,{"data-state":s?"visible":"hidden",...i,ref:t})})}),Um=P.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,i=Nn(Vi,e.__scopeScrollArea),s=P.useRef(null),o=P.useRef(0),[a,c]=P.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=SS(a.viewport,a.content),l={...n,sizes:a,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:p=>s.current=p,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:p=>o.current=p};function f(p,v){return rW(p,o.current,a,v)}return r==="horizontal"?_.jsx(Jq,{...l,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const p=i.viewport.scrollLeft,v=ES(p,a,i.dir);s.current.style.transform=`translate3d(${v}px, 0, 0)`}},onWheelScroll:p=>{i.viewport&&(i.viewport.scrollLeft=p)},onDragScroll:p=>{i.viewport&&(i.viewport.scrollLeft=f(p,i.dir))}}):r==="vertical"?_.jsx(Zq,{...l,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const p=i.viewport.scrollTop,v=ES(p,a);s.current.style.transform=`translate3d(0, ${v}px, 0)`}},onWheelScroll:p=>{i.viewport&&(i.viewport.scrollTop=p)},onDragScroll:p=>{i.viewport&&(i.viewport.scrollTop=f(p))}}):null}),Jq=P.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,s=Nn(Vi,e.__scopeScrollArea),[o,a]=P.useState(),c=P.useRef(null),u=Jt(t,c,s.onScrollbarXChange);return P.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),_.jsx(wS,{"data-orientation":"horizontal",...i,ref:u,sizes:r,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":id(r)+"px",...e.style},onThumbPointerDown:l=>e.onThumbPointerDown(l.x),onDragScroll:l=>e.onDragScroll(l.x),onWheelScroll:(l,f)=>{if(s.viewport){const p=s.viewport.scrollLeft+l.deltaX;e.onWheelScroll(p),CS(p,f)&&l.preventDefault()}},onResize:()=>{c.current&&s.viewport&&o&&n({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:nd(o.paddingLeft),paddingEnd:nd(o.paddingRight)}})}})}),Zq=P.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,s=Nn(Vi,e.__scopeScrollArea),[o,a]=P.useState(),c=P.useRef(null),u=Jt(t,c,s.onScrollbarYChange);return P.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),_.jsx(wS,{"data-orientation":"vertical",...i,ref:u,sizes:r,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":id(r)+"px",...e.style},onThumbPointerDown:l=>e.onThumbPointerDown(l.y),onDragScroll:l=>e.onDragScroll(l.y),onWheelScroll:(l,f)=>{if(s.viewport){const p=s.viewport.scrollTop+l.deltaY;e.onWheelScroll(p),CS(p,f)&&l.preventDefault()}},onResize:()=>{c.current&&s.viewport&&o&&n({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:nd(o.paddingTop),paddingEnd:nd(o.paddingBottom)}})}})}),[Qq,bS]=hS(Vi),wS=P.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:i,onThumbChange:s,onThumbPointerUp:o,onThumbPointerDown:a,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:l,onResize:f,...p}=e,v=Nn(Vi,r),[w,y]=P.useState(null),S=Jt(t,ge=>y(ge)),A=P.useRef(null),O=P.useRef(""),j=v.viewport,V=n.content-n.viewport,B=Fr(l),H=Fr(c),q=sd(f,10);function ne(ge){if(A.current){const se=ge.clientX-A.current.left,fe=ge.clientY-A.current.top;u({x:se,y:fe})}}return P.useEffect(()=>{const ge=se=>{const fe=se.target;(w==null?void 0:w.contains(fe))&&B(se,V)};return document.addEventListener("wheel",ge,{passive:!1}),()=>document.removeEventListener("wheel",ge,{passive:!1})},[j,w,V,B]),P.useEffect(H,[n,H]),Qa(w,q),Qa(v.content,q),_.jsx(Qq,{scope:r,scrollbar:w,hasThumb:i,onThumbChange:Fr(s),onThumbPointerUp:Fr(o),onThumbPositionChange:H,onThumbPointerDown:Fr(a),children:_.jsx(Zt.div,{...p,ref:S,style:{position:"absolute",...p.style},onPointerDown:wt(e.onPointerDown,ge=>{ge.button===0&&(ge.target.setPointerCapture(ge.pointerId),A.current=w.getBoundingClientRect(),O.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",v.viewport&&(v.viewport.style.scrollBehavior="auto"),ne(ge))}),onPointerMove:wt(e.onPointerMove,ne),onPointerUp:wt(e.onPointerUp,ge=>{const se=ge.target;se.hasPointerCapture(ge.pointerId)&&se.releasePointerCapture(ge.pointerId),document.body.style.webkitUserSelect=O.current,v.viewport&&(v.viewport.style.scrollBehavior=""),A.current=null})})})}),rd="ScrollAreaThumb",_S=P.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=bS(rd,e.__scopeScrollArea);return _.jsx(oi,{present:r||i.hasThumb,children:_.jsx(eW,{ref:t,...n})})}),eW=P.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...i}=e,s=Nn(rd,r),o=bS(rd,r),{onThumbPositionChange:a}=o,c=Jt(t,f=>o.onThumbChange(f)),u=P.useRef(void 0),l=sd(()=>{u.current&&(u.current(),u.current=void 0)},100);return P.useEffect(()=>{const f=s.viewport;if(f){const p=()=>{if(l(),!u.current){const v=nW(f,a);u.current=v,a()}};return a(),f.addEventListener("scroll",p),()=>f.removeEventListener("scroll",p)}},[s.viewport,l,a]),_.jsx(Zt.div,{"data-state":o.hasThumb?"visible":"hidden",...i,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:wt(e.onPointerDownCapture,f=>{const v=f.target.getBoundingClientRect(),w=f.clientX-v.left,y=f.clientY-v.top;o.onThumbPointerDown({x:w,y})}),onPointerUp:wt(e.onPointerUp,o.onThumbPointerUp)})});_S.displayName=rd;var Fm="ScrollAreaCorner",xS=P.forwardRef((e,t)=>{const r=Nn(Fm,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?_.jsx(tW,{...e,ref:t}):null});xS.displayName=Fm;var tW=P.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,i=Nn(Fm,r),[s,o]=P.useState(0),[a,c]=P.useState(0),u=!!(s&&a);return Qa(i.scrollbarX,()=>{var f;const l=((f=i.scrollbarX)==null?void 0:f.offsetHeight)||0;i.onCornerHeightChange(l),c(l)}),Qa(i.scrollbarY,()=>{var f;const l=((f=i.scrollbarY)==null?void 0:f.offsetWidth)||0;i.onCornerWidthChange(l),o(l)}),u?_.jsx(Zt.div,{...n,ref:t,style:{width:s,height:a,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function nd(e){return e?parseInt(e,10):0}function SS(e,t){const r=e/t;return isNaN(r)?0:r}function id(e){const t=SS(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function rW(e,t,r,n="ltr"){const i=id(r),s=i/2,o=t||s,a=i-o,c=r.scrollbar.paddingStart+o,u=r.scrollbar.size-r.scrollbar.paddingEnd-a,l=r.content-r.viewport,f=n==="ltr"?[0,l]:[l*-1,0];return TS([c,u],f)(e)}function ES(e,t,r="ltr"){const n=id(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-i,o=t.content-t.viewport,a=s-n,c=r==="ltr"?[0,o]:[o*-1,0],u=Jz(e,c);return TS([0,o],[0,a])(u)}function TS(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function CS(e,t){return e>0&&e<t}var nW=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return function i(){const s={left:e.scrollLeft,top:e.scrollTop},o=r.left!==s.left,a=r.top!==s.top;(o||a)&&t(),r=s,n=window.requestAnimationFrame(i)}(),()=>window.cancelAnimationFrame(n)};function sd(e,t){const r=Fr(e),n=P.useRef(0);return P.useEffect(()=>()=>window.clearTimeout(n.current),[]),P.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function Qa(e,t){const r=Fr(t);ws(()=>{let n=0;if(e){const i=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return i.observe(e),()=>{window.cancelAnimationFrame(n),i.unobserve(e)}}},[e,r])}var iW=pS,sW=gS,AS=yS,IS=_S,oW=xS,od="Switch",[aW,jte]=bs(od),[cW,uW]=aW(od),MS=P.forwardRef((e,t)=>{const{__scopeSwitch:r,name:n,checked:i,defaultChecked:s,required:o,disabled:a,value:c="on",onCheckedChange:u,form:l,...f}=e,[p,v]=P.useState(null),w=Jt(t,j=>v(j)),y=P.useRef(!1),S=p?l||!!p.closest("form"):!0,[A,O]=hu({prop:i,defaultProp:s??!1,onChange:u,caller:od});return _.jsxs(cW,{scope:r,checked:A,disabled:a,children:[_.jsx(Zt.button,{type:"button",role:"switch","aria-checked":A,"aria-required":o,"data-state":PS(A),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:w,onClick:wt(e.onClick,j=>{O(V=>!V),S&&(y.current=j.isPropagationStopped(),y.current||j.stopPropagation())})}),S&&_.jsx(kS,{control:p,bubbles:!y.current,name:n,value:c,checked:A,required:o,disabled:a,form:l,style:{transform:"translateX(-100%)"}})]})});MS.displayName=od;var OS="SwitchThumb",jS=P.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,i=uW(OS,r);return _.jsx(Zt.span,{"data-state":PS(i.checked),"data-disabled":i.disabled?"":void 0,...n,ref:t})});jS.displayName=OS;var lW="SwitchBubbleInput",kS=P.forwardRef(({__scopeSwitch:e,control:t,checked:r,bubbles:n=!0,...i},s)=>{const o=P.useRef(null),a=Jt(o,s),c=Ix(r),u=wm(t);return P.useEffect(()=>{const l=o.current;if(!l)return;const f=window.HTMLInputElement.prototype,v=Object.getOwnPropertyDescriptor(f,"checked").set;if(c!==r&&v){const w=new Event("click",{bubbles:n});v.call(l,r),l.dispatchEvent(w)}},[c,r,n]),_.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...i,tabIndex:-1,ref:a,style:{...i.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});kS.displayName=lW;function PS(e){return e?"checked":"unchecked"}var fW=MS,dW=jS;const vu={size:{type:"enum",values:["1","2","3"],default:"2",responsive:!0},variant:{type:"enum",values:["classic","surface","soft"],default:"surface"},color:pu,highContrast:qf,radius:Am},RS=P.forwardRef((e,t)=>{const{rest:r,...n}=mu(e),{className:i,style:s,size:o=vu.size.default,variant:a=vu.variant.default,color:c=vu.color.default,highContrast:u=vu.highContrast.default,radius:l=vu.radius.default,...f}=r;return P.createElement("span",{"data-radius":l,className:ur("rt-SwitchRoot",i,pn(o,"rt-r-size"),`rt-variant-${a}`,{"rt-high-contrast":u},gu(n)),style:s},P.createElement(fW,{"data-accent-color":c,...f,ref:t,className:ur("rt-reset","rt-SwitchButton",{"rt-high-contrast":u})},P.createElement(dW,{className:ur("rt-SwitchThumb",{"rt-high-contrast":u})})))});RS.displayName="Switch";var Vm=["Enter"," "],hW=["ArrowDown","PageUp","Home"],NS=["ArrowUp","PageDown","End"],pW=[...hW,...NS],mW={ltr:[...Vm,"ArrowRight"],rtl:[...Vm,"ArrowLeft"]},gW={ltr:["ArrowLeft"],rtl:["ArrowRight"]},bu="Menu",[wu,yW,vW]=Lx(bu),[Yo,DS]=bs(bu,[vW,Lf,Ux]),_u=Lf(),$S=Ux(),[LS,fo]=Yo(bu),[bW,xu]=Yo(bu),BS=e=>{const{__scopeMenu:t,open:r=!1,children:n,dir:i,onOpenChange:s,modal:o=!0}=e,a=_u(t),[c,u]=P.useState(null),l=P.useRef(!1),f=Fr(s),p=Tm(i);return P.useEffect(()=>{const v=()=>{l.current=!0,document.addEventListener("pointerdown",w,{capture:!0,once:!0}),document.addEventListener("pointermove",w,{capture:!0,once:!0})},w=()=>l.current=!1;return document.addEventListener("keydown",v,{capture:!0}),()=>{document.removeEventListener("keydown",v,{capture:!0}),document.removeEventListener("pointerdown",w,{capture:!0}),document.removeEventListener("pointermove",w,{capture:!0})}},[]),_.jsx(dx,{...a,children:_.jsx(LS,{scope:t,open:r,onOpenChange:f,content:c,onContentChange:u,children:_.jsx(bW,{scope:t,onClose:P.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:l,dir:p,modal:o,children:n})})})};BS.displayName=bu;var wW="MenuAnchor",zm=P.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=_u(r);return _.jsx(hx,{...i,...n,ref:t})});zm.displayName=wW;var qm="MenuPortal",[_W,US]=Yo(qm,{forceMount:void 0}),FS=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:i}=e,s=fo(qm,t);return _.jsx(_W,{scope:t,forceMount:r,children:_.jsx(oi,{present:r||s.open,children:_.jsx(gx,{asChild:!0,container:i,children:n})})})};FS.displayName=qm;var Dn="MenuContent",[xW,Wm]=Yo(Dn),VS=P.forwardRef((e,t)=>{const r=US(Dn,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,s=fo(Dn,e.__scopeMenu),o=xu(Dn,e.__scopeMenu);return _.jsx(wu.Provider,{scope:e.__scopeMenu,children:_.jsx(oi,{present:n||s.open,children:_.jsx(wu.Slot,{scope:e.__scopeMenu,children:o.modal?_.jsx(SW,{...i,ref:t}):_.jsx(EW,{...i,ref:t})})})})}),SW=P.forwardRef((e,t)=>{const r=fo(Dn,e.__scopeMenu),n=P.useRef(null),i=Jt(t,n);return P.useEffect(()=>{const s=n.current;if(s)return uq(s)},[]),_.jsx(Gm,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:wt(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),EW=P.forwardRef((e,t)=>{const r=fo(Dn,e.__scopeMenu);return _.jsx(Gm,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),TW=cu("MenuContent.ScrollLock"),Gm=P.forwardRef((e,t)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:l,onFocusOutside:f,onInteractOutside:p,onDismiss:v,disableOutsideScroll:w,...y}=e,S=fo(Dn,r),A=xu(Dn,r),O=_u(r),j=$S(r),V=yW(r),[B,H]=P.useState(null),q=P.useRef(null),ne=Jt(t,q,S.onContentChange),ge=P.useRef(0),se=P.useRef(""),fe=P.useRef(0),z=P.useRef(null),N=P.useRef("right"),h=P.useRef(0),d=w?Gq:P.Fragment,m=w?{as:TW,allowPinchZoom:!0}:void 0,x=C=>{var le,be;const k=se.current+C,M=V().filter(Ae=>!Ae.disabled),g=document.activeElement,b=(le=M.find(Ae=>Ae.ref.current===g))==null?void 0:le.textValue,R=M.map(Ae=>Ae.textValue),ue=$W(R,k,b),ie=(be=M.find(Ae=>Ae.textValue===ue))==null?void 0:be.ref.current;(function Ae(D){se.current=D,window.clearTimeout(ge.current),D!==""&&(ge.current=window.setTimeout(()=>Ae(""),1e3))})(k),ie&&setTimeout(()=>ie.focus())};P.useEffect(()=>()=>window.clearTimeout(ge.current),[]),Zz();const E=P.useCallback(C=>{var M,g;return N.current===((M=z.current)==null?void 0:M.side)&&BW(C,(g=z.current)==null?void 0:g.area)},[]);return _.jsx(xW,{scope:r,searchRef:se,onItemEnter:P.useCallback(C=>{E(C)&&C.preventDefault()},[E]),onItemLeave:P.useCallback(C=>{var k;E(C)||((k=q.current)==null||k.focus(),H(null))},[E]),onTriggerLeave:P.useCallback(C=>{E(C)&&C.preventDefault()},[E]),pointerGraceTimerRef:fe,onPointerGraceIntentChange:P.useCallback(C=>{z.current=C},[]),children:_.jsx(d,{...m,children:_.jsx(Hx,{asChild:!0,trapped:i,onMountAutoFocus:wt(s,C=>{var k;C.preventDefault(),(k=q.current)==null||k.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:_.jsx(am,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:l,onFocusOutside:f,onInteractOutside:p,onDismiss:v,children:_.jsx(Yz,{asChild:!0,...j,dir:A.dir,orientation:"vertical",loop:n,currentTabStopId:B,onCurrentTabStopIdChange:H,onEntryFocus:wt(c,C=>{A.isUsingKeyboardRef.current||C.preventDefault()}),preventScrollOnEntryFocus:!0,children:_.jsx(px,{role:"menu","aria-orientation":"vertical","data-state":o5(S.open),"data-radix-menu-content":"",dir:A.dir,...O,...y,ref:ne,style:{outline:"none",...y.style},onKeyDown:wt(y.onKeyDown,C=>{const M=C.target.closest("[data-radix-menu-content]")===C.currentTarget,g=C.ctrlKey||C.altKey||C.metaKey,b=C.key.length===1;M&&(C.key==="Tab"&&C.preventDefault(),!g&&b&&x(C.key));const R=q.current;if(C.target!==R||!pW.includes(C.key))return;C.preventDefault();const ie=V().filter(le=>!le.disabled).map(le=>le.ref.current);NS.includes(C.key)&&ie.reverse(),NW(ie)}),onBlur:wt(e.onBlur,C=>{C.currentTarget.contains(C.target)||(window.clearTimeout(ge.current),se.current="")}),onPointerMove:wt(e.onPointerMove,Eu(C=>{const k=C.target,M=h.current!==C.clientX;if(C.currentTarget.contains(k)&&M){const g=C.clientX>h.current?"right":"left";N.current=g,h.current=C.clientX}}))})})})})})})});VS.displayName=Dn;var CW="MenuGroup",Hm=P.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return _.jsx(Zt.div,{role:"group",...n,ref:t})});Hm.displayName=CW;var AW="MenuLabel",zS=P.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return _.jsx(Zt.div,{...n,ref:t})});zS.displayName=AW;var ad="MenuItem",qS="menu.itemSelect",cd=P.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...i}=e,s=P.useRef(null),o=xu(ad,e.__scopeMenu),a=Wm(ad,e.__scopeMenu),c=Jt(t,s),u=P.useRef(!1),l=()=>{const f=s.current;if(!r&&f){const p=new CustomEvent(qS,{bubbles:!0,cancelable:!0});f.addEventListener(qS,v=>n==null?void 0:n(v),{once:!0}),P_(f,p),p.defaultPrevented?u.current=!1:o.onClose()}};return _.jsx(WS,{...i,ref:c,disabled:r,onClick:wt(e.onClick,l),onPointerDown:f=>{var p;(p=e.onPointerDown)==null||p.call(e,f),u.current=!0},onPointerUp:wt(e.onPointerUp,f=>{var p;u.current||(p=f.currentTarget)==null||p.click()}),onKeyDown:wt(e.onKeyDown,f=>{const p=a.searchRef.current!=="";r||p&&f.key===" "||Vm.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});cd.displayName=ad;var WS=P.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:i,...s}=e,o=Wm(ad,r),a=$S(r),c=P.useRef(null),u=Jt(t,c),[l,f]=P.useState(!1),[p,v]=P.useState("");return P.useEffect(()=>{const w=c.current;w&&v((w.textContent??"").trim())},[s.children]),_.jsx(wu.ItemSlot,{scope:r,disabled:n,textValue:i??p,children:_.jsx(Xz,{asChild:!0,...a,focusable:!n,children:_.jsx(Zt.div,{role:"menuitem","data-highlighted":l?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...s,ref:u,onPointerMove:wt(e.onPointerMove,Eu(w=>{n?o.onItemLeave(w):(o.onItemEnter(w),w.defaultPrevented||w.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:wt(e.onPointerLeave,Eu(w=>o.onItemLeave(w))),onFocus:wt(e.onFocus,()=>f(!0)),onBlur:wt(e.onBlur,()=>f(!1))})})})}),IW="MenuCheckboxItem",GS=P.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:n,...i}=e;return _.jsx(JS,{scope:e.__scopeMenu,checked:r,children:_.jsx(cd,{role:"menuitemcheckbox","aria-checked":ud(r)?"mixed":r,...i,ref:t,"data-state":Xm(r),onSelect:wt(i.onSelect,()=>n==null?void 0:n(ud(r)?!0:!r),{checkForDefaultPrevented:!1})})})});GS.displayName=IW;var HS="MenuRadioGroup",[MW,OW]=Yo(HS,{value:void 0,onValueChange:()=>{}}),KS=P.forwardRef((e,t)=>{const{value:r,onValueChange:n,...i}=e,s=Fr(n);return _.jsx(MW,{scope:e.__scopeMenu,value:r,onValueChange:s,children:_.jsx(Hm,{...i,ref:t})})});KS.displayName=HS;var YS="MenuRadioItem",XS=P.forwardRef((e,t)=>{const{value:r,...n}=e,i=OW(YS,e.__scopeMenu),s=r===i.value;return _.jsx(JS,{scope:e.__scopeMenu,checked:s,children:_.jsx(cd,{role:"menuitemradio","aria-checked":s,...n,ref:t,"data-state":Xm(s),onSelect:wt(n.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,r)},{checkForDefaultPrevented:!1})})})});XS.displayName=YS;var Km="MenuItemIndicator",[JS,jW]=Yo(Km,{checked:!1}),ZS=P.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:n,...i}=e,s=jW(Km,r);return _.jsx(oi,{present:n||ud(s.checked)||s.checked===!0,children:_.jsx(Zt.span,{...i,ref:t,"data-state":Xm(s.checked)})})});ZS.displayName=Km;var kW="MenuSeparator",QS=P.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return _.jsx(Zt.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});QS.displayName=kW;var PW="MenuArrow",e5=P.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=_u(r);return _.jsx(mx,{...i,...n,ref:t})});e5.displayName=PW;var Ym="MenuSub",[RW,t5]=Yo(Ym),r5=e=>{const{__scopeMenu:t,children:r,open:n=!1,onOpenChange:i}=e,s=fo(Ym,t),o=_u(t),[a,c]=P.useState(null),[u,l]=P.useState(null),f=Fr(i);return P.useEffect(()=>(s.open===!1&&f(!1),()=>f(!1)),[s.open,f]),_.jsx(dx,{...o,children:_.jsx(LS,{scope:t,open:n,onOpenChange:f,content:u,onContentChange:l,children:_.jsx(RW,{scope:t,contentId:uu(),triggerId:uu(),trigger:a,onTriggerChange:c,children:r})})})};r5.displayName=Ym;var Su="MenuSubTrigger",n5=P.forwardRef((e,t)=>{const r=fo(Su,e.__scopeMenu),n=xu(Su,e.__scopeMenu),i=t5(Su,e.__scopeMenu),s=Wm(Su,e.__scopeMenu),o=P.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=s,u={__scopeMenu:e.__scopeMenu},l=P.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return P.useEffect(()=>l,[l]),P.useEffect(()=>{const f=a.current;return()=>{window.clearTimeout(f),c(null)}},[a,c]),_.jsx(zm,{asChild:!0,...u,children:_.jsx(WS,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":i.contentId,"data-state":o5(r.open),...e,ref:im(t,i.onTriggerChange),onClick:f=>{var p;(p=e.onClick)==null||p.call(e,f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:wt(e.onPointerMove,Eu(f=>{s.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!r.open&&!o.current&&(s.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{r.onOpenChange(!0),l()},100))})),onPointerLeave:wt(e.onPointerLeave,Eu(f=>{var v,w;l();const p=(v=r.content)==null?void 0:v.getBoundingClientRect();if(p){const y=(w=r.content)==null?void 0:w.dataset.side,S=y==="right",A=S?-5:5,O=p[S?"left":"right"],j=p[S?"right":"left"];s.onPointerGraceIntentChange({area:[{x:f.clientX+A,y:f.clientY},{x:O,y:p.top},{x:j,y:p.top},{x:j,y:p.bottom},{x:O,y:p.bottom}],side:y}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(f),f.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:wt(e.onKeyDown,f=>{var v;const p=s.searchRef.current!=="";e.disabled||p&&f.key===" "||mW[n.dir].includes(f.key)&&(r.onOpenChange(!0),(v=r.content)==null||v.focus(),f.preventDefault())})})})});n5.displayName=Su;var i5="MenuSubContent",s5=P.forwardRef((e,t)=>{const r=US(Dn,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,s=fo(Dn,e.__scopeMenu),o=xu(Dn,e.__scopeMenu),a=t5(i5,e.__scopeMenu),c=P.useRef(null),u=Jt(t,c);return _.jsx(wu.Provider,{scope:e.__scopeMenu,children:_.jsx(oi,{present:n||s.open,children:_.jsx(wu.Slot,{scope:e.__scopeMenu,children:_.jsx(Gm,{id:a.contentId,"aria-labelledby":a.triggerId,...i,ref:u,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:l=>{var f;o.isUsingKeyboardRef.current&&((f=c.current)==null||f.focus()),l.preventDefault()},onCloseAutoFocus:l=>l.preventDefault(),onFocusOutside:wt(e.onFocusOutside,l=>{l.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:wt(e.onEscapeKeyDown,l=>{o.onClose(),l.preventDefault()}),onKeyDown:wt(e.onKeyDown,l=>{var v;const f=l.currentTarget.contains(l.target),p=gW[o.dir].includes(l.key);f&&p&&(s.onOpenChange(!1),(v=a.trigger)==null||v.focus(),l.preventDefault())})})})})})});s5.displayName=i5;function o5(e){return e?"open":"closed"}function ud(e){return e==="indeterminate"}function Xm(e){return ud(e)?"indeterminate":e?"checked":"unchecked"}function NW(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function DW(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function $W(e,t,r){const i=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=r?e.indexOf(r):-1;let o=DW(e,Math.max(s,0));i.length===1&&(o=o.filter(u=>u!==r));const c=o.find(u=>u.toLowerCase().startsWith(i.toLowerCase()));return c!==r?c:void 0}function LW(e,t){const{x:r,y:n}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const a=t[s],c=t[o],u=a.x,l=a.y,f=c.x,p=c.y;l>n!=p>n&&r<(f-u)*(n-l)/(p-l)+u&&(i=!i)}return i}function BW(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return LW(r,t)}function Eu(e){return t=>t.pointerType==="mouse"?e(t):void 0}var UW=BS,FW=zm,VW=FS,zW=VS,qW=Hm,WW=zS,GW=cd,HW=GS,KW=KS,YW=XS,XW=ZS,JW=QS,ZW=e5,QW=r5,eG=n5,tG=s5,ld="DropdownMenu",[rG,Rte]=bs(ld,[DS]),Xr=DS(),[nG,a5]=rG(ld),c5=e=>{const{__scopeDropdownMenu:t,children:r,dir:n,open:i,defaultOpen:s,onOpenChange:o,modal:a=!0}=e,c=Xr(t),u=P.useRef(null),[l,f]=hu({prop:i,defaultProp:s??!1,onChange:o,caller:ld});return _.jsx(nG,{scope:t,triggerId:uu(),triggerRef:u,contentId:uu(),open:l,onOpenChange:f,onOpenToggle:P.useCallback(()=>f(p=>!p),[f]),modal:a,children:_.jsx(UW,{...c,open:l,onOpenChange:f,dir:n,modal:a,children:r})})};c5.displayName=ld;var u5="DropdownMenuTrigger",l5=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...i}=e,s=a5(u5,r),o=Xr(r);return _.jsx(FW,{asChild:!0,...o,children:_.jsx(Zt.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...i,ref:im(t,s.triggerRef),onPointerDown:wt(e.onPointerDown,a=>{!n&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:wt(e.onKeyDown,a=>{n||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});l5.displayName=u5;var iG="DropdownMenuPortal",f5=e=>{const{__scopeDropdownMenu:t,...r}=e,n=Xr(t);return _.jsx(VW,{...n,...r})};f5.displayName=iG;var d5="DropdownMenuContent",h5=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=a5(d5,r),s=Xr(r),o=P.useRef(!1);return _.jsx(zW,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...n,ref:t,onCloseAutoFocus:wt(e.onCloseAutoFocus,a=>{var c;o.current||(c=i.triggerRef.current)==null||c.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:wt(e.onInteractOutside,a=>{const c=a.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,l=c.button===2||u;(!i.modal||l)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});h5.displayName=d5;var sG="DropdownMenuGroup",p5=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Xr(r);return _.jsx(qW,{...i,...n,ref:t})});p5.displayName=sG;var oG="DropdownMenuLabel",m5=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Xr(r);return _.jsx(WW,{...i,...n,ref:t})});m5.displayName=oG;var aG="DropdownMenuItem",g5=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Xr(r);return _.jsx(GW,{...i,...n,ref:t})});g5.displayName=aG;var cG="DropdownMenuCheckboxItem",y5=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Xr(r);return _.jsx(HW,{...i,...n,ref:t})});y5.displayName=cG;var uG="DropdownMenuRadioGroup",v5=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Xr(r);return _.jsx(KW,{...i,...n,ref:t})});v5.displayName=uG;var lG="DropdownMenuRadioItem",b5=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Xr(r);return _.jsx(YW,{...i,...n,ref:t})});b5.displayName=lG;var fG="DropdownMenuItemIndicator",w5=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Xr(r);return _.jsx(XW,{...i,...n,ref:t})});w5.displayName=fG;var dG="DropdownMenuSeparator",_5=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Xr(r);return _.jsx(JW,{...i,...n,ref:t})});_5.displayName=dG;var hG="DropdownMenuArrow",pG=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Xr(r);return _.jsx(ZW,{...i,...n,ref:t})});pG.displayName=hG;var mG=e=>{const{__scopeDropdownMenu:t,children:r,open:n,onOpenChange:i,defaultOpen:s}=e,o=Xr(t),[a,c]=hu({prop:n,defaultProp:s??!1,onChange:i,caller:"DropdownMenuSub"});return _.jsx(QW,{...o,open:a,onOpenChange:c,children:r})},gG="DropdownMenuSubTrigger",x5=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Xr(r);return _.jsx(eG,{...i,...n,ref:t})});x5.displayName=gG;var yG="DropdownMenuSubContent",S5=P.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Xr(r);return _.jsx(tG,{...i,...n,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});S5.displayName=yG;var vG=c5,bG=l5,E5=f5,wG=h5,_G=p5,xG=m5,SG=g5,EG=y5,TG=v5,CG=b5,T5=w5,AG=_5,IG=mG,MG=x5,OG=S5;const Jm={size:{type:"enum",values:["1","2","3"],default:"1",responsive:!0},radius:Am,scrollbars:{type:"enum",values:["vertical","horizontal","both"],default:"both"}},Zm=P.forwardRef((e,t)=>{const{rest:r,...n}=mu(e),{className:i,style:s,type:o,scrollHideDelay:a=o!=="scroll"?0:void 0,dir:c,size:u=Jm.size.default,radius:l=Jm.radius.default,scrollbars:f=Jm.scrollbars.default,...p}=r;return P.createElement(iW,{type:o,scrollHideDelay:a,className:ur("rt-ScrollAreaRoot",i,gu(n)),style:s},P.createElement(sW,{...p,ref:t,className:"rt-ScrollAreaViewport"}),P.createElement("div",{className:"rt-ScrollAreaViewportFocusRing"}),f!=="vertical"?P.createElement(AS,{"data-radius":l,orientation:"horizontal",className:ur("rt-ScrollAreaScrollbar",pn(u,"rt-r-size"))},P.createElement(IS,{className:"rt-ScrollAreaThumb"})):null,f!=="horizontal"?P.createElement(AS,{"data-radius":l,orientation:"vertical",className:ur("rt-ScrollAreaScrollbar",pn(u,"rt-r-size"))},P.createElement(IS,{className:"rt-ScrollAreaThumb"})):null,f==="both"?P.createElement(oW,{className:"rt-ScrollAreaCorner"}):null)});Zm.displayName="ScrollArea";const Qm={size:{type:"enum",values:["1","2"],default:"2",responsive:!0},variant:{type:"enum",values:["solid","soft"],default:"solid"},color:pu,highContrast:qf},C5={color:pu,shortcut:{type:"string",default:void 0}},A5=e=>P.createElement(vG,{...e});A5.displayName="DropdownMenuRoot";const I5=P.forwardRef((e,t)=>P.createElement(bG,{...e,ref:t,asChild:!0}));I5.displayName="DropdownMenuTrigger";const M5=P.createContext({}),O5=P.forwardRef((e,t)=>{const r=jz(),{className:n,children:i,size:s=Qm.size.default,variant:o=Qm.variant.default,highContrast:a=Qm.highContrast.default,color:c=C5.color.default,container:u,forceMount:l,...f}=e,p=c??r.accentColor;return P.createElement(E5,{container:u,forceMount:l},P.createElement(zf,{asChild:!0},P.createElement(wG,{"data-accent-color":p,align:"start",sideOffset:4,collisionPadding:10,...f,ref:t,className:ur("rt-PopperContent","rt-BaseMenuContent","rt-DropdownMenuContent",n,pn(s,"rt-r-size"),`rt-variant-${o}`,{"rt-high-contrast":a})},P.createElement(Zm,{type:"auto"},P.createElement("div",{className:ur("rt-BaseMenuViewport","rt-DropdownMenuViewport")},P.createElement(M5.Provider,{value:P.useMemo(()=>({size:s,variant:o,color:p,highContrast:a}),[s,o,p,a])},i))))))});O5.displayName="DropdownMenuContent";const j5=P.forwardRef((e,t)=>P.createElement(xG,{...e,ref:t,className:ur("rt-BaseMenuLabel","rt-DropdownMenuLabel",e.className)}));j5.displayName="DropdownMenuLabel";const k5=P.forwardRef((e,t)=>{const{className:r,children:n,color:i=C5.color.default,shortcut:s,...o}=e;return P.createElement(SG,{"data-accent-color":i,...o,ref:t,className:ur("rt-reset","rt-BaseMenuItem","rt-DropdownMenuItem",r)},P.createElement(If,null,n),s&&P.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},s))});k5.displayName="DropdownMenuItem";const P5=P.forwardRef((e,t)=>P.createElement(_G,{...e,ref:t,className:ur("rt-BaseMenuGroup","rt-DropdownMenuGroup",e.className)}));P5.displayName="DropdownMenuGroup";const R5=P.forwardRef((e,t)=>P.createElement(TG,{...e,ref:t,className:ur("rt-BaseMenuRadioGroup","rt-DropdownMenuRadioGroup",e.className)}));R5.displayName="DropdownMenuRadioGroup";const N5=P.forwardRef((e,t)=>{const{children:r,className:n,...i}=e;return P.createElement(CG,{...i,ref:t,className:ur("rt-BaseMenuItem","rt-BaseMenuRadioItem","rt-DropdownMenuItem","rt-DropdownMenuRadioItem",n)},P.createElement(If,null,r),P.createElement(T5,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},P.createElement(Hf,{className:"rt-BaseMenuItemIndicatorIcon rt-DropdownMenuItemIndicatorIcon"})))});N5.displayName="DropdownMenuRadioItem";const D5=P.forwardRef((e,t)=>{const{children:r,className:n,shortcut:i,...s}=e;return P.createElement(EG,{...s,ref:t,className:ur("rt-BaseMenuItem","rt-BaseMenuCheckboxItem","rt-DropdownMenuItem","rt-DropdownMenuCheckboxItem",n)},P.createElement(If,null,r),P.createElement(T5,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},P.createElement(Hf,{className:"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon"})),i&&P.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},i))});D5.displayName="DropdownMenuCheckboxItem";const $5=e=>P.createElement(IG,{...e});$5.displayName="DropdownMenuSub";const L5=P.forwardRef((e,t)=>{const{className:r,children:n,...i}=e;return P.createElement(MG,{...i,ref:t,className:ur("rt-BaseMenuItem","rt-BaseMenuSubTrigger","rt-DropdownMenuItem","rt-DropdownMenuSubTrigger",r)},P.createElement(If,null,n),P.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},P.createElement($x,{className:"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon"})))});L5.displayName="DropdownMenuSubTrigger";const B5=P.forwardRef((e,t)=>{const{className:r,children:n,container:i,forceMount:s,...o}=e,{size:a,variant:c,color:u,highContrast:l}=P.useContext(M5);return P.createElement(E5,{container:i,forceMount:s},P.createElement(zf,{asChild:!0},P.createElement(OG,{"data-accent-color":u,alignOffset:-Number(a)*4,sideOffset:1,collisionPadding:10,...o,ref:t,className:ur("rt-PopperContent","rt-BaseMenuContent","rt-BaseMenuSubContent","rt-DropdownMenuContent","rt-DropdownMenuSubContent",r,pn(a,"rt-r-size"),`rt-variant-${c}`,{"rt-high-contrast":l})},P.createElement(Zm,{type:"auto"},P.createElement("div",{className:ur("rt-BaseMenuViewport","rt-DropdownMenuViewport")},n)))))});B5.displayName="DropdownMenuSubContent";const U5=P.forwardRef((e,t)=>P.createElement(AG,{...e,ref:t,className:ur("rt-BaseMenuSeparator","rt-DropdownMenuSeparator",e.className)}));U5.displayName="DropdownMenuSeparator";const Es=Object.assign({},{Root:A5,Trigger:I5,Content:O5,Label:j5,Item:k5,Group:P5,RadioGroup:R5,RadioItem:N5,CheckboxItem:D5,Sub:$5,SubTrigger:L5,SubContent:B5,Separator:U5}),Tu={size:{type:"enum",values:["1","2","3","4"],default:"2",responsive:!0},variant:{type:"enum",values:["classic","solid","soft","surface","outline","ghost"],default:"solid"},color:pu,highContrast:qf,radius:Am},F5=P.forwardRef((e,t)=>{const{rest:r,...n}=mu(e),{className:i,asChild:s=!1,size:o=Tu.size.default,variant:a=Tu.variant.default,color:c=Tu.color.default,highContrast:u=Tu.highContrast.default,radius:l=Tu.radius.default,...f}=r,p=s?sm:"button";return P.createElement(p,{"data-disabled":f.disabled||void 0,"data-accent-color":c,"data-radius":l,...f,ref:t,className:ur("rt-reset","rt-BaseButton",i,pn(o,"rt-r-size"),`rt-variant-${a}`,{"rt-high-contrast":u},gu(n))})});F5.displayName="BaseButton";const V5=P.forwardRef((e,t)=>P.createElement(F5,{...e,ref:t,className:ur("rt-Button",e.className)}));V5.displayName="Button";const jG={loading:{type:"boolean",default:!0}},Xo=P.forwardRef((e,t)=>{const{rest:r,...n}=mu(e),{className:i,children:s,loading:o=jG.loading.default,...a}=r;if(!o)return P.createElement(P.Fragment,null,s);const c=P.isValidElement(s)?sm:"span";return P.createElement(c,{ref:t,"aria-hidden":!0,className:ur("rt-Skeleton",i,gu(n)),"data-inline-skeleton":P.isValidElement(s)?void 0:!0,tabIndex:-1,inert:"",...a},s)});Xo.displayName="Skeleton";const Fte="";function eg(e){const{text:t,onClick:r,className:n,btnIsDisabled:i=!1}=e,s=()=>{r&&r()};return _.jsx(V5,{disabled:i,className:n?`cs-button ${n}`:"cs-button",onClick:s,children:t})}function Jo({content:e,children:t,position:r="top",marginTop:n="0px",borderRadius:i="8px",delay:s=0,backgroundColor:o="var(--cs-bg-primary)"}){const[a,c]=he.useState(!1),[u,l]=he.useState(!1),f=he.useRef(null),p=()=>{f.current&&(clearTimeout(f.current),f.current=null),c(!0)};he.useEffect(()=>()=>{a||f.current&&(clearTimeout(f.current),f.current=null)},[a]);const v=()=>{f.current=setTimeout(()=>{u||(c(!1),f.current&&(clearTimeout(f.current),f.current=null))},0)},w=()=>{switch(r){case"top":return{transform:"translateX(-50%)"};case"bottom":return{transform:"translateX(-50%)",marginTop:"0px"};case"left":return{transform:"translateY(-50%)",marginRight:"8px"};case"right":return{transform:"translateY(-50%)"};default:return{}}},y=he.useRef(null),[S,A]=he.useState({left:void 0,top:void 0});return he.useEffect(()=>{var O;if(a&&y.current){const j=(O=y.current)==null?void 0:O.getBoundingClientRect();let V,B;r==="top"?(V=`${window.scrollX+j.left+j.width/2}px`,B=`${window.scrollY+j.top-2*j.height-8}px`):r==="bottom"?(V=`${window.scrollX+j.left+j.width/2}px`,B=`${window.scrollY+j.bottom}px`):r==="left"?(V=`${window.scrollX+j.left-8}px`,B=`${window.scrollY+j.top+j.height/2}px`):r==="right"?(V=`${window.scrollX+j.right+8}px`,B=`${window.scrollY+j.top+j.height/2}px`):(V=`${window.scrollX+j.left+j.width/2}px`,B=`${window.scrollY+j.top+j.height/2}px`),A({left:V,top:B})}},[a]),_.jsxs("div",{ref:y,style:{position:"relative",display:"inline-block"},onMouseEnter:p,onMouseLeave:v,children:[t,a&&li.createPortal(_.jsx("div",{style:{transition:"opacity 0.3s ease",opacity:a?1:0,position:"absolute",zIndex:9e3,padding:"8px 12px",backgroundColor:o,color:"var(--cs-text-secondary)",borderRadius:i,fontSize:"12px",whiteSpace:"nowrap",border:"1px solid",borderColor:"var(--cs-border)",boxShadow:"0px 2px 10px rgba(0, 0, 0, 0.1)",...w(),...S,marginTop:n},onMouseEnter:()=>l(!0),onMouseLeave:()=>{f.current&&(clearTimeout(f.current),f.current=null),l(!1),c(!1)},children:e}),document.body)]})}const Vte="",tg=[{label:"Default"},{label:"Fast Mode",beforeIcon:{xlinkHref:"#icon-icon_flash",fontSize:"16px",activeColor:"var(--cs-primary)",activeHoverColor:"var(--cs-primary)"}}],kG=e=>{const{transactionMode:t,setTransactionMode:r,maxCapForGas:n,setMaxCapForGas:i,customGasPrice:s,setCustomGasPrice:o,suiBalance:a,themeType:c}=e,u=c=="Light"?Pt("/images/icon_shio_light@2x.png"):Pt("/images/icon_shio@2x.png"),l=he.useMemo(()=>{var O;return(O=tg.filter(j=>(j==null?void 0:j.label)===t))==null?void 0:O[0]},[t,tg]),f=O=>{const j=new RegExp("[^\\d-]*(\\d*(?:\\.\\d{0,9})?).*$");O.target.value=O.target.value.replace(j,"$1"),i(O.target.value)},p=O=>{const j=new RegExp("[^\\d-]*(\\d*(?:\\.\\d{0,9})?).*$");O.target.value=O.target.value.replace(j,"$1");const V=Fe(O.target.value).gt(0)?Fe(O.target.value).div(Math.pow(10,9)).toString():"0";Fe(V).gt(n)&&i(V),o(O.target.value)},v=he.useMemo(()=>!n||Number(n)==0?"Please enter a value higher than 0":n&&Number(n)>5?"Only allow up to 5 SUI":Fe(n).gt(a)?"Insufficient SUI balance ":Fe(n).lt(Fe(s).div(Math.pow(10,9)))?"Max cap cannot be less than custom gas.":"",[n]),w=he.useMemo(()=>n&&Number(n)>0&&Number(n)<2e-6?"Your current maximum fee is below the market rate. Please raise it to ensure your transactions are processed.":"",[n]),y=he.useMemo(()=>!s||Number(s)==0?"Please enter a value higher than 0":"",[s]),S=he.useMemo(()=>s&&Number(s)>0&&Fe(s).lt(750)?"Your current maximum fee is below the market rate. Please raise it to ensure your transactions are processed.":"",[s]),A=he.useMemo(()=>!s||s==="0"?"0":Fe(s).div(Math.pow(10,9)).toString(),[s]);return _.jsxs("div",{className:"transaction-mode-container",children:[_.jsxs("div",{className:"transaction-mode-header",children:[_.jsxs("div",{className:"transaction-mode-label",children:[_.jsx("svg",{children:_.jsx("use",{xlinkHref:"#icon-icon_mode"})}),_.jsx("span",{className:"caption-text",children:"Transaction Mode"})]}),_.jsx("div",{className:"slippage-tab-list",children:tg.map(O=>_.jsxs("div",{className:O.label===l.label?"active slippage-tab":"slippage-tab",children:[O.label!=="Default"&&_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-icon_flash"})}),_.jsx("span",{onClick:()=>{r(O.label)},children:O.label})]},O.label))})]}),_.jsx("p",{className:"transaction-description",children:t==="Default"?"Standard gas based on real-time network conditions":"Land your transaction earlier and avoid congestion with a higher gas price. MEV protection is on by default in Fast Mode."}),t==="Fast Mode"&&_.jsxs("div",{className:"fast-mode-section",children:[_.jsxs("div",{className:"input-card",children:[_.jsxs("div",{className:"input-label",children:[_.jsx("span",{children:"Custom Gas Price"}),_.jsx(Jo,{position:"bottom",content:_.jsx("div",{className:"tooltip-content",children:"The total gas depends on the gas price and actual gas units consumed."}),children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-tips"})})})]}),_.jsxs("div",{className:"input-right",children:[_.jsxs("div",{className:"input-field",children:[_.jsx("input",{value:s,onChange:p,placeholder:"0.0"}),_.jsx("span",{className:"caption-text",children:"MIST"})]}),_.jsxs("div",{className:"unit-text",children:[_.jsx("span",{children:A}),"SUI"]})]})]}),y&&_.jsx(fd,{text:y,type:"error"}),S&&_.jsx(fd,{text:S,type:"warn"}),_.jsxs("div",{className:"input-card",children:[_.jsxs("div",{className:"input-label",children:[_.jsx("span",{children:"Set Max Cap for Gas"}),_.jsx(Jo,{position:"bottom",content:_.jsx("div",{className:"tooltip-content",children:"Set a max cap for your gas to prevent overpaying"}),children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-tips"})})})]}),_.jsx("div",{className:"input-right",children:_.jsxs("div",{className:"input-field",children:[_.jsx("input",{value:n,onChange:f,placeholder:"0.0"}),_.jsx("span",{className:"caption-text",children:"SUI"})]})})]}),v&&_.jsx(fd,{text:v,type:"error"}),w&&_.jsx(fd,{text:w,type:"warn"}),_.jsxs("div",{className:"powered-by",children:[_.jsx("span",{children:"Powered by"}),_.jsx("img",{src:u,alt:"shio"})]})]})]})},fd=e=>{const{text:t,type:r}=e;return _.jsx("div",{style:{width:"100%",padding:"4px 16px",borderRadius:"8px",background:r==="warn"?"var(--cs-warning-10)":"var(--cs-error-10)",display:"flex",alignItems:"center",justifyContent:"center"},children:_.jsx("span",{style:{color:r==="warn"?"var(--cs-warning)":"var(--cs-error)",fontSize:"12px",lineHeight:"16px"},children:t})})},PG={id:"0x9258181f5ceac8dbffb7030890243caed69a9599d2886d957a9cb7656af3bdb3",coin_type:"0x2::sui::SUI",decimals:9,description:"",name:"Sui",symbol:"SUI",logo_url:"https://archive.cetus.zone/assets/image/sui/sui.png",is_verified:!0,extensions:{rank:"880"}};function RG({themeType:e}){const{setIsOpenSlippageDialog:t,isOpenSlippageDialog:r,slippage:n}=en();return _.jsxs(_.Fragment,{children:[_.jsxs("div",{className:"slippage-button",onClick:()=>t(!0),children:[_.jsxs("span",{children:[n,"%"]}),_.jsx("div",{className:"svg-box",children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-verticalslider"})})})]}),r&&_.jsx(NG,{themeType:e,onClose:()=>t(!1)})]})}function NG({onClose:e,themeType:t}){const{transactionMode:r,maxCapForGas:n,customGasPrice:i,setMaxCapForGas:s,setCustomGasPrice:o,setTransctionMode:a,mevProtect:c,setMevProtect:u}=en(),{balanceInfo:l}=au(PG),[f,p]=he.useState(r),[v,w]=he.useState(n),[y,S]=he.useState(i),[A,O]=he.useState(c),{slippage:j,setSlippage:V}=en(),[B,H]=he.useState(j),q=fe=>{H(fe.display)},ne=fe=>{const z=new RegExp("[^\\d-]*(\\d*(?:\\.\\d{0,2})?).*$");fe.target.value=fe.target.value.replace(z,"$1"),H(fe.target.value)},ge=()=>{B&&V(B),f==="Fast Mode"&&(s(v),o(y)),a(f),u(A),e()};he.useEffect(()=>{f==="Fast Mode"&&O(!0)},[f]);const se=he.useMemo(()=>f==="Fast Mode"&&(!v||Number(v)===0||Number(v)>5||!y||Number(y)===0||Fe(v).gt((l==null?void 0:l.totalBalanceFormat)||"0")||Fe(v).lt(Fe(y).div(Math.pow(10,9))))||!+B?!0:Number(B)>50||Number(B)<.01,[B,f,v,y,l]);return _.jsxs(_.Fragment,{children:[_.jsx("div",{className:"dialog-mask",style:{zIndex:"100"}}),_.jsx("div",{className:"slippage-settings-dialog",style:{zIndex:"100"},children:_.jsxs("div",{className:"slippage-settings",children:[_.jsxs("div",{className:"slippage-settings-header",children:[_.jsx("div",{className:"title",children:"Settings"}),_.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:e,children:_.jsx("use",{xlinkHref:"#icon-close"})})]}),_.jsxs("div",{className:"title",children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-verticalslider"})}),_.jsx("span",{children:"Slippage Tolerance"})]}),_.jsxs("div",{className:"form-box",children:[_.jsx("div",{className:"slippage-tab-list",children:aF.map(fe=>_.jsxs("span",{className:fe.display===B?"active":"",onClick:()=>q(fe),children:[fe.display," %"]},fe.display))}),_.jsxs("div",{className:"input-box",children:[_.jsx("span",{children:"Custom"}),_.jsx("input",{className:"cs-input",placeholder:"0.0",value:B,onChange:ne}),_.jsx("div",{style:{fontSize:"14px",color:"var(--cs-text-primary)"},children:"%"})]})]}),Number(B)<=.05&&_.jsx("div",{className:"tips warning",children:"Slippage is low. Your transaction may fail."}),Number(B)<=50&&Number(B)>1&&_.jsx("div",{className:"tips warning",children:"Your transaction may frontrun"}),Number(B)>50&&_.jsx("div",{className:"tips error",children:" Enter a valid slippage percentage"}),_.jsx(kG,{transactionMode:f,setTransactionMode:p,maxCapForGas:v,setMaxCapForGas:w,customGasPrice:y,setCustomGasPrice:S,suiBalance:(l==null?void 0:l.totalBalanceFormat)||"0",themeType:t}),_.jsx(DG,{mevProtect:A,setMevProtect:O,disabled:f==="Fast Mode"}),_.jsx(eg,{text:"Save",btnIsDisabled:se,className:"slippage-save-btn",onClick:ge})]})})]})}const DG=e=>{const{mevProtect:t,disabled:r,setMevProtect:n}=e;return _.jsxs("div",{className:"mev-settings-box",children:[_.jsx("div",{className:"mev-setting-title",children:_.jsxs("div",{className:"name",children:[_.jsx("svg",{"aria-hidden":"true",cursor:"pointer",fill:"var(--cs-icon-fill)",children:_.jsx("use",{xlinkHref:"#icon-icon_mev"})}),_.jsx("span",{children:"MEV Protect"})]})}),_.jsxs("div",{className:"mev-setting-Switch",children:[_.jsxs("div",{className:"label",children:[_.jsx("span",{children:"Enable MEV Protection"}),_.jsx(Jo,{position:"bottom",marginTop:"-118px",content:_.jsx("div",{className:"mev-tips",style:{width:"310px",whiteSpace:"wrap",color:"var(--cs-text-primary)"},children:"By enabling this, your txn will be submitted via 3rd party MEV service provider. MEV value retained will be redistributed to all users who successfully execute their trades with Shio through its point campaign."}),children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{cursor:"pointer"},children:_.jsx("use",{xlinkHref:"#icon-tips"})})})]}),_.jsx(RS,{checked:t,disabled:r,className:"cs-switch",onClick:()=>{n(!t)}})]})]})};function $G({handleRefresh:e,themeType:t}){return _.jsx(_.Fragment,{children:_.jsxs("div",{className:"swap-header",children:[_.jsx("h3",{className:"swap-title",children:"Swap"}),_.jsxs("div",{className:"right",children:[_.jsx(RG,{themeType:t}),_.jsx(SF,{onClick:e})]})]})})}const zte="",qte="";function LG(){const[e,t]=he.useState(!1);return _.jsxs(Es.Root,{open:e,onOpenChange:t,children:[_.jsx(Es.Trigger,{children:_.jsx("div",{className:"cs-settings-btn",children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-settings"})})})}),_.jsx(Es.Content,{variant:"soft",className:"cs-dropdown-content",style:{backgroundColor:"var(--cs-primary-10)"},side:"bottom",align:"end",children:_.jsxs("div",{className:"cs-settings-box",children:[_.jsx("h3",{children:"Settings"}),_.jsx(BG,{}),_.jsx(FG,{onClose:()=>{t(!1)}})]})})]})}function BG(){const{currentExplorer:e,setCurrentExplorer:t,currentRpc:r,setCurrentRpc:n}=en(),i=s=>{t(s)};return _.jsxs("div",{className:"settings-card",style:{marginTop:"12px"},children:[_.jsxs("h3",{className:"card-title",children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-plorer"})}),_.jsx("span",{children:"Preferred Explorer"})]}),_.jsx("div",{className:"explorer-checkbox-group",children:Ef.map(s=>_.jsxs("div",{className:"group-item",style:{justifyContent:"center"},onClick:()=>i(s.link),children:[_.jsx(Kf,{color:"indigo",checked:s.link===e,variant:"soft",className:"cs-checkbox cs-allow-change-checkbox"}),_.jsx("img",{src:s.img}),_.jsx("span",{children:s.name})]},s.link))})]})}const UG=e=>!/^(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(e);function FG({onClose:e}){const{addTxToast:t}=Fa(),{currentRpc:r,setCurrentRpc:n,customRpc:i,setCustomRpc:s,rpcList:o}=en(),[a,c]=he.useState(i),[u,l]=he.useState(r),f=y=>{t({id:0,status:"success",buildShowInfo:()=>({toastTitleText:"RPC update",toastDescriptionContent:`RPC is currently set to ${y}`})})},p=y=>{l(y),y.isCustom||(n(y),f(y.link),e())},v=y=>{c(y.target.value)},w=()=>{if(a){const y={name:"Custom RPC URL",link:a,isCustom:!0};s(a),n(y),f(a),e()}};return _.jsxs("div",{className:"settings-card rpc-settings-card",children:[_.jsxs("h3",{className:"card-title",children:[_.jsx("svg",{className:"cs-icon rpc-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-rpc"})}),_.jsx("span",{children:"RPC Node"})]}),_.jsxs("div",{className:"rpc-checkbox-group",children:[o.map(y=>_.jsxs("div",{className:"rpc-item",onClick:()=>p(y),children:[_.jsx(Kf,{color:"indigo",checked:u.name===y.name,variant:"soft",className:"cs-checkbox cs-allow-change-checkbox"}),_.jsx("span",{children:y.name})]},y.name)),u.isCustom&&_.jsxs("div",{className:"custom-rpc-input-box",children:[_.jsx("input",{className:"cs-input",placeholder:"Custom RPC URL",onChange:v,value:a}),_.jsx(eg,{btnIsDisabled:UG(a),text:"Save",onClick:w})]})]})]})}const Wte="";function z5(){const{suiClient:e}=oo(),{setAccountServiceNameObj:t,accountServiceNameObj:r}=rn(),n=async s=>{if(!((s==null?void 0:s.length)<1))try{const o=s.map(async u=>{var f;const l=await e.resolveNameServiceNames({address:u});return{address:u,name:((f=l==null?void 0:l.data)==null?void 0:f[0])||""}}),a=await Promise.all(o),c=Object.fromEntries(a==null?void 0:a.map(u=>[u.address,u.name]));t(c)}catch{}};return{fetchServiceNames:n,getServiceNames:async s=>{const o=[];s==null||s.forEach(a=>{const c=a==null?void 0:a.address;r!=null&&r[c]||o.push(c)}),(o==null?void 0:o.length)>0&&n(o)}}}var VG=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,r=[],n=0;n<e.rangeCount;n++)r.push(e.getRangeAt(n));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null;break}return e.removeAllRanges(),function(){e.type==="Caret"&&e.removeAllRanges(),e.rangeCount||r.forEach(function(i){e.addRange(i)}),t&&t.focus()}},zG=VG,q5={"text/plain":"Text","text/html":"Url",default:"Text"},qG="Copy to clipboard: #{key}, Enter";function WG(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function GG(e,t){var r,n,i,s,o,a,c=!1;t||(t={}),r=t.debug||!1;try{i=zG(),s=document.createRange(),o=document.getSelection(),a=document.createElement("span"),a.textContent=e,a.ariaHidden="true",a.style.all="unset",a.style.position="fixed",a.style.top=0,a.style.clip="rect(0, 0, 0, 0)",a.style.whiteSpace="pre",a.style.webkitUserSelect="text",a.style.MozUserSelect="text",a.style.msUserSelect="text",a.style.userSelect="text",a.addEventListener("copy",function(l){if(l.stopPropagation(),t.format)if(l.preventDefault(),typeof l.clipboardData>"u"){r&&console.warn("unable to use e.clipboardData"),r&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var f=q5[t.format]||q5.default;window.clipboardData.setData(f,e)}else l.clipboardData.clearData(),l.clipboardData.setData(t.format,e);t.onCopy&&(l.preventDefault(),t.onCopy(l.clipboardData))}),document.body.appendChild(a),s.selectNodeContents(a),o.addRange(s);var u=document.execCommand("copy");if(!u)throw new Error("copy command was unsuccessful");c=!0}catch(l){r&&console.error("unable to copy using execCommand: ",l),r&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),c=!0}catch(f){r&&console.error("unable to copy using clipboardData: ",f),r&&console.error("falling back to prompt"),n=WG("message"in t?t.message:qG),window.prompt(n,e)}}finally{o&&(typeof o.removeRange=="function"?o.removeRange(s):o.removeAllRanges()),a&&document.body.removeChild(a),i()}return c}var HG=GG;const W5=lc(HG);function KG({currentAccount:e}){const{mutate:t}=on.useSwitchAccount(),r=on.useAccounts(),{isOpenAccountList:n,setIsOpenAccountList:i,accountServiceNameObj:s}=rn(),{getServiceNames:o}=z5(),a=he.useCallback(()=>{n||o(r),i(!n)},[n,r]);he.useEffect(()=>()=>{i(!1)},[]);const c=he.useMemo(()=>r.filter(l=>l.address!==e),[r,e]);he.useEffect(()=>{},[c]);const u=l=>{t({account:l},{onSuccess:()=>{}})};return _.jsxs("div",{className:"cs-account-switch",children:[_.jsxs("div",{className:"account",onClick:a,children:[_.jsx("span",{children:e&&(s==null?void 0:s[e])||qo(e)}),(c==null?void 0:c.length)>0&&_.jsx("svg",{className:`cs-icon ${n?"open":"close"}`,"aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-unfold"})})]}),_.jsx("div",{className:`account-list ${n?"open":"close"}`,children:c.map(l=>{var f,p,v,w;return _.jsxs("div",{className:"account-item",children:[_.jsxs("div",{className:"left",children:[_.jsxs("div",{className:"label",children:[((f=l==null?void 0:l.label)==null?void 0:f.length)>16?((p=l==null?void 0:l.label)==null?void 0:p.substring(0,6))+"..."+((w=l==null?void 0:l.label)==null?void 0:w.substring(((v=l==null?void 0:l.label)==null?void 0:v.length)-10)):l==null?void 0:l.label," "]}),_.jsx("div",{className:"address",children:(s==null?void 0:s[l==null?void 0:l.address])||qo(l==null?void 0:l.address)})]}),_.jsx("button",{className:"cs-outline-btn",onClick:()=>u(l),children:"Switch"})]},l==null?void 0:l.address)})})]})}const YG=he.forwardRef(({connect:e,isSimulate:t=!1})=>{const r=on.useCurrentAccount();return _.jsx("div",{children:r?_.jsx(XG,{isSimulate:t}):_.jsx(eg,{text:"Connect",className:"cs-connect-button",onClick:()=>e(!0)})})});function XG({isSimulate:e}){const{mutate:t}=on.useDisconnectWallet(),r=on.useCurrentAccount(),{currentWallet:n}=on.useCurrentWallet(),{addCommonToast:i}=Fa(),{getExplorerUrl:s}=Ba(),{accountServiceNameObj:o}=rn(),a=()=>{r&&(W5(r.address||"",{debug:!1,message:"message"}),i("Copied"))},c=()=>{r&&window.open(s(r.address,"account"),"_blank")};return he.useEffect(()=>{},[n]),_.jsxs(Es.Root,{children:[_.jsx(Es.Trigger,{children:_.jsxs("div",{className:"cs-connected-button",children:[_.jsx("img",{src:n==null?void 0:n.icon,style:{width:"20px",height:"20px"}}),_.jsx("span",{style:{color:e?"#fff":"var(--cs-text-primary)"},children:(r==null?void 0:r.address)&&(o==null?void 0:o[r==null?void 0:r.address])||qo(r==null?void 0:r.address)})]})}),_.jsx(Es.Content,{variant:"soft",className:"cs-dropdown-content",style:{backgroundColor:"var(--cs-primary-10)"},side:"bottom",align:"end",children:_.jsxs("div",{className:"account-op-box",children:[_.jsx("span",{style:{fontSize:"14px",color:"var(--cs-text-secondary)",marginBottom:"6px"},children:r==null?void 0:r.label}),_.jsx(KG,{currentAccount:r==null?void 0:r.address}),_.jsxs("div",{className:"account-op-item",onClick:a,style:{marginTop:"12px"},children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-icon_copy"})}),_.jsx("span",{children:"Copy address"})]}),_.jsxs("div",{className:"account-op-item",onClick:c,children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-icon_link"})}),_.jsx("span",{children:"Open explorer"})]}),_.jsxs("div",{className:"account-op-item",onClick:()=>t(),children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-icon_disconnect"})}),_.jsx("span",{children:"Disconnect"})]})]})})]})}function JG({isSimulate:e=!1}){const{fetchServiceNames:t}=z5(),r=on.useCurrentAccount();on.useCurrentWallet();const{isOpenWalletModal:n,onWalletModal:i,saveCurrentAccount:s}=rn();return on.useWallets(),he.useEffect(()=>{r!=null&&r.address&&t([r==null?void 0:r.address])},[r==null?void 0:r.address]),_.jsx(_.Fragment,{children:_.jsx(on.ConnectModal,{trigger:_.jsx(YG,{connect:i,isSimulate:e}),open:n,onOpenChange:o=>i(o)})})}function ZG({independentWallet:e,customWallet:t,logo:r}){return _.jsxs(_.Fragment,{children:[_.jsxs("div",{className:"widget-header",children:[_.jsx("img",{src:r,className:"cetus-logo"}),_.jsxs("div",{className:"right",children:[e&&_.jsx(JG,{}),_.jsx(LG,{})]})]}),_.jsx("div",{style:{marginTop:"12px"}})]})}const Gte="",G5=()=>{const e=he.useRef(null);he.useEffect(()=>{if(e.current){const n=e.current.style;n.setProperty("--size-loader","50px"),n.setProperty("--size-orbe","10px")}},[]);const t=n=>({position:"absolute",width:"100%",height:"100%",animation:`webLoading ease-in-out 1.5s calc(${n} * 0.1s) infinite`,opacity:`calc(1 - calc(0.2 * ${n}))`}),r={position:"absolute",content:"''",top:0,left:0,width:"var(--size-orbe)",height:"var(--size-orbe)",backgroundColor:"var(--cs-primary)",boxShadow:"0px 0px 20px 2px var(--cs-primary)",borderRadius:"50%"};return _.jsx("div",{style:{width:"100%",height:"100%",position:"absolute",zIndex:100},children:_.jsx("div",{ref:e,style:{width:"var(--size-loader)",height:"var(--size-loader)",position:"absolute",top:"50%",left:"50%",marginTop:"-25px",marginLeft:"-25px",transform:"rotate(45deg)"},children:[...Array(5)].map((n,i)=>_.jsx("div",{style:t(i),children:_.jsx("div",{style:r})},i))})})};function QG({onClose:e,transactionData:t}){const{status:r,buildShowInfo:n,tx:i}=t,s=he.useMemo(()=>{if(n&&r)return n(r)},[r]);return _.jsxs("div",{className:"ts-status-dialog",children:[(r==="confirmation"||r==="submitted")&&_.jsx(eH,{info:s,status:r}),(r==="success"||r==="rejected")&&_.jsx(tH,{info:s,status:r,tx:i,onClose:e})]})}function eH({info:e,status:t}){return _.jsxs("div",{className:"progress-dialog",children:[_.jsx("div",{className:"title",children:t==="confirmation"?"Waiting for Confirmation":"Transaction in progress"}),_.jsx("div",{className:"loading-box",children:_.jsx(G5,{})}),_.jsxs("div",{className:"ts-content",children:[e==null?void 0:e.modalDescriptionText," "]}),_.jsxs("p",{className:"ts-desc",children:[" ",t==="confirmation"?"Confirm this transaction in your wallet.":"Confirmation is in progress."]})]})}function tH({info:e,status:t,tx:r,onClose:n}){const{getExplorerUrl:i}=Ba();return _.jsxs("div",{className:"finally-status-dialog",children:[_.jsxs("div",{className:"center-content",children:[_.jsxs("div",{className:t==="success"?"status-box is-success":"status-box is-error",children:[_.jsx("div",{className:"status-icon-box",children:_.jsx("div",{className:"status-icon",children:_.jsx("svg",{className:"icon","aria-hidden":"true",children:t==="success"?_.jsx("use",{xlinkHref:"#icon-sel"}):_.jsx("use",{xlinkHref:"#icon-caution"})})})}),t==="success"?_.jsx("span",{children:"Swap Success"}):_.jsx("span",{children:"Swap failed"})]}),_.jsx("div",{className:"ts-content",children:e==null?void 0:e.modalDescriptionText}),r&&_.jsxs("div",{className:"view-transaction",children:[_.jsx("span",{children:"View Transaction"}),Ef.map(s=>_.jsx("a",{href:i(r,"tx",s.link),target:"_blank",children:_.jsx("img",{src:s.img})},s.link))]})]}),_.jsx("button",{className:"cs-solid-btn swap-more-btn",onClick:n,children:t==="success"?"Swap More":"Retry"})]})}function rH(){const{fetchByApi:e}=Tf(),{setProviders:t}=en();return{fetchRouterConfig:async()=>{try{const n=await e("/router_v3/status","GET"),{providers:i}=n;i&&t(i)}catch{}}}}function nH({interval:e,callback:t}){const r=he.useRef(),n=he.useRef(null);he.useEffect(()=>{r.current=t},[t]);const i=he.useCallback(()=>{n.current&&clearInterval(n.current),e>0&&(n.current=setInterval(()=>{r.current&&r.current(Date.now())},e))},[e]),s=he.useCallback(()=>{n.current&&(clearInterval(n.current),n.current=null)},[]);return he.useEffect(()=>(i(),()=>s()),[]),{startTimer:i,stopTimer:s}}const H5=vs((e,t)=>({coinPriceObj:{},setPriceObj:r=>{const n=t().coinPriceObj;e({coinPriceObj:{...n,...r}})},clearPriceObj:r=>{const n=t().coinPriceObj;r.forEach(i=>{delete n[Sr(i).full_address]}),e({coinPriceObj:{...n}})}}));function iH(e,t){const r=[];for(let n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r}function Cu(){const{fetchByApi:e}=Tf(),{coinPriceObj:t,setPriceObj:r,clearPriceObj:n}=H5(),i=async a=>{const u=iH(a,10);try{const f=(await Promise.all(u.map(p=>e("/v3/sui/market_price","GET",{base_symbol_address:p.map(v=>ms(v,!1))})))).map(p=>p.prices).flat();if(f){const p={};f.forEach(v=>{p[Sr(v.base_symbol).full_address]=v}),r(p)}return f}catch{return n(a),null}},s=he.useCallback(a=>{if(!a)return;const c=t[Sr(a).full_address];if(c)return c},[t]),o=he.useCallback((a,c,u)=>{const l=Number(c)==0||!u?"0":u;if(c&&a&&+c){const f=s(a);if(f)return Fe(c).mul(f.price).toString()}return l},[t]);return{fetchTokenPrices:i,getTokenPrice:s,getTokenAmountValue:o}}function sH(){const{tokenBalanceObj:e}=rn(),{fetchTokenPrices:t}=Cu(),{isOpenTokensDialog:r}=tn(),n=he.useCallback(()=>{if(nF(e)){const i=Object.keys(e);t(i)}},[e]);return he.useEffect(()=>{r&&n()},[r]),{getMyAssetsPrice:n}}const oH={id:"0x9258181f5ceac8dbffb7030890243caed69a9599d2886d957a9cb7656af3bdb3",coin_type:"0x2::sui::SUI",decimals:9,description:"",name:"Sui",symbol:"SUI",logo_url:"https://imagedelivery.net/cBNDGgkrsEA-b_ixIp9SkQ/sui-coin.svg/public",is_trusted:!0,extensions:{rank:"880"}},K5={id:"0x69b7a7c3c200439c1b5f3b19d7d495d5966d5f08de66c69276152f8db3992ec6",coin_type:"0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",decimals:6,description:"",name:"USDC",symbol:"USDC",logo_url:"https://circle.com/usdc-icon",is_trusted:!0,extensions:{rank:"1000"}},Y5=oH;function aH(e,t){const{fetchTokenInfo:r}=Va(),{setFromCoin:n,setToCoin:i,setDefaultCoin:s,fromCoin:o,toCoin:a}=tn(),{setSlippage:c,setRpcList:u,setCurrentRpc:l}=en(),{tokenMapIsInit:f}=Ua(),p=he.useRef({}),v=async(y,S)=>{if(!S&&!y&&(o||a))return;const A=y?await r(y):K5,O=S?await r(S):Y5;n(A),i(O),s(A==null?void 0:A.coin_type,O==null?void 0:O.coin_type)},w=(y=[],S)=>{let A=[],O=su[0],j=su[0];y.forEach(V=>{const B={name:V,link:V,isCustom:!1};A.push(B),V===S&&(j=B)}),S&&y.includes(S)?A=[j,O,...A.filter(V=>V.link!==S)]:A.unshift(su[0]),u([...A,{name:"Custom RPC URL",link:"",isCustom:!0}]),l(j)};return he.useEffect(()=>{if(f&&!Q0(e,p.current)){const{defaultFromToken:y,defaultToToken:S,defaultSlippage:A,customRpcList:O,defaultRpc:j}=e;v(y,S),A&&c(A),w(O||[],j),p.current=e}},[e,f]),{handleSetDefaultPair:v}}function cH(e){const{currentRpc:t}=en(),{setSuiClient:r,setAggregatorSDK:n}=oo(),{currentAccount:i}=rn();he.useEffect(()=>{if(t){const o=new Lo({url:t.link});r(o)}},[t]);const s=()=>{const o={endpoint:La.aggregatorUrl,signer:(i==null?void 0:i.address)||"",client:new Lo({url:t.link}),env:W3.Mainnet,overlayFeeRate:(e==null?void 0:e.overlayFeeRate)||void 0,overlayFeeReceiver:(e==null?void 0:e.overlayFeeReceiver)||void 0},a=new q3(o);n(a)};he.useEffect(()=>{t&&s()},[t.link,i==null?void 0:i.address]),he.useEffect(()=>{e!=null&&e.overlayFeeRate&&(e!=null&&e.overlayFeeReceiver)&&s()},[e==null?void 0:e.overlayFeeRate,e==null?void 0:e.overlayFeeReceiver])}const rg=vs((e,t)=>({transactionData:void 0,setTransactionData:r=>{e(()=>({transactionData:r}))}})),Vr=[];for(let e=0;e<256;++e)Vr.push((e+256).toString(16).slice(1));function uH(e,t=0){return(Vr[e[t+0]]+Vr[e[t+1]]+Vr[e[t+2]]+Vr[e[t+3]]+"-"+Vr[e[t+4]]+Vr[e[t+5]]+"-"+Vr[e[t+6]]+Vr[e[t+7]]+"-"+Vr[e[t+8]]+Vr[e[t+9]]+"-"+Vr[e[t+10]]+Vr[e[t+11]]+Vr[e[t+12]]+Vr[e[t+13]]+Vr[e[t+14]]+Vr[e[t+15]]).toLowerCase()}let ng;const lH=new Uint8Array(16);function fH(){if(!ng){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ng=crypto.getRandomValues.bind(crypto)}return ng(lH)}const X5={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function J5(e,t,r){var i;if(X5.randomUUID&&!t&&!e)return X5.randomUUID();e=e||{};const n=e.random??((i=e.rng)==null?void 0:i.call(e))??fH();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){if(r=r||0,r<0||r+16>t.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let s=0;s<16;++s)t[r+s]=n[s];return t}return uH(n)}var Zo=(e=>(e[e.CalculateError=1e4]="CalculateError",e[e.NumberTooLarge=10001]="NumberTooLarge",e[e.NoRouter=10002]="NoRouter",e[e.InsufficientLiquidity=10003]="InsufficientLiquidity",e[e.HoneyPot=10004]="HoneyPot",e))(Zo||{});const dH=new Lo({url:y6("mainnet")}),hH=["0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC","0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD","0xf16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a::fdusd::FDUSD","0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb::usdy::USDY","0x294de7579d55c110a00a7c4946e09a1b5cbeca2592fbb83fd7bfacba3cfeaf0e::drf::DRF"],pH=["deny_list","DenyList","DenyCap","create_regulated_currency"],mH={showType:!0,showContent:!0,showOwner:!1,showPreviousTransaction:!1,showStorageRebate:!1,showDisplay:!1},gH=async e=>{let t=!1;if(hH.includes(e))return t;const r=e.split("::"),n=r[0]&&Vt(r[0]),i=r[1],s=await dH.getObject({id:n,options:mH}),o="disassembled"in s.data.content?s.data.content.disassembled[i]:null;return o&&typeof o=="string"&&new RegExp(pH.join("|"),"i").test(o)&&(t=!0),t},yH=e=>{var n;if(!e)return"";const t=e==null?void 0:e.split(",");return(n=t==null?void 0:t.map(i=>ms(i,!1)))==null?void 0:n.join(",")};function vH(){const{fetchByApi:e}=Tf(),t=async s=>{try{const o={...s},a=yH(s==null?void 0:s.coin_type);a&&(o.coin_type=a);const c=await e("/v2/sui/stats_pools","GET",o);if(c!=null&&c.lp_list)return{list:(c==null?void 0:c.lp_list)||[],total:c==null?void 0:c.total}}catch(o){return console.error("getPoolList ~ Error:",o),await r(s)}return{list:[],total:0}},r=async s=>{var o,a,c,u;try{const l=Pt("/data/pools.json"),f=await fetch(l).then(p=>p.json());if((o=f==null?void 0:f.data)!=null&&o.lp_list){const p=(a=f==null?void 0:f.data)==null?void 0:a.lp_list;let v=p;if(s!=null&&s.coin_type){const y=(u=(c=s==null?void 0:s.coin_type)==null?void 0:c.split(","))==null?void 0:u.map(S=>zo(S).source_address);v=p==null?void 0:p.filter(S=>{var j,V;const A=zo((j=S==null?void 0:S.coin_a)==null?void 0:j.address).source_address,O=zo((V=S==null?void 0:S.coin_b)==null?void 0:V.address).source_address;return(y==null?void 0:y.length)>1&&y.includes(A)&&y.includes(O)?!0:!!((y==null?void 0:y.length)===1&&(y.includes(A)||y.includes(O)))})}s!=null&&s.is_vaults&&(v=p==null?void 0:p.filter(y=>y==null?void 0:y.is_vaults)),s!=null&&s.has_farming&&!(s!=null&&s.is_vaults)&&!(s!=null&&s.has_mining)&&!(s!=null&&s.no_incentives)&&(v=p==null?void 0:p.filter(y=>y==null?void 0:y.has_farming));const w=v;return{list:w,total:(w==null?void 0:w.length)||0}}}catch(l){console.error("getLocalJsonPoolList Error:",l)}return{list:[],total:0}},n=s=>y_(s)==="0x2::sui::SUI"?"0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI":y_(s);return{getPoolList:t,getLocalJsonPoolList:r,getLocalJsonPoolAddress:async(s,o)=>{try{const a=n(s),c=n(o),u=await fetch("/data/all-pools.json").then(l=>l.json());if(u)return u[`${a.toLocaleLowerCase()}-${c.toLocaleLowerCase()}`]||u[`${c.toLocaleLowerCase()}-${a.toLocaleLowerCase()}`]}catch(a){console.error("getLocalJsonPoolAddress Error:",a)}return[]}}}function bH(e=!0){const{poolApiMap:t,setPoolApiMap:r}=en(),{getPoolList:n,getLocalJsonPoolList:i,getLocalJsonPoolAddress:s}=vH();return{getPoolListByCoinType:async(c,u)=>{if(c&&u){const l=[c,u].sort(),f=`${l[0]}_${l[1]}`,p=t[f];if(p)return p;const v={coin_type:`${c},${u}`,display_all_pools:!0,offset:0,limit:100,order_by:"-tvl",no_incentives:!0,has_farming:!0,has_mining:!0};let w=e?await i(v):void 0;(w===void 0||w.list.length===0)&&(w=await n(v));const y=w.list;if(y.length>0)return t[f]=y,r(f,y),y}return[]},getPoolAddressByCoinType:async(c,u)=>{if(c&&u){const l=[c,u].sort(),f=`${l[0]}_${l[1]}`;if(e){const w=await s(c,u);if(!w||w.length===0){const y=t[f];if(y)return y.map(S=>S.poolAddress)}else return w}const p={coin_type:`${c},${u}`,display_all_pools:!0,offset:0,limit:100,order_by:"-tvl",no_incentives:!0,has_farming:!0,has_mining:!0},v=await n(p);if(v){const w=v.list;if(w.length>0)return t[f]=w,r(f,w),w.map(y=>y.poolAddress)}}return[]}}}function wH(e){const{routerData:t}=tn();return{priceAcceptRouterData:he.useMemo(()=>{if(t&&e){if(e.byAmountIn){if(!Fe(e.toAmountUi).eq(t.toAmountUi||"0"))return t}else if(!Fe(e.fromAmountUi).eq(t.fromAmountUi||"0"))return t;return}},[t,e])}}function Z5(e,t){return{amountLimit:he.useMemo(()=>{if(t&&t.routerData){const{byAmountIn:n,fromAmountUi:i,toAmountUi:s}=t;return n?Fe(s).mul(Fe(1).sub(Fe(e).div(100))).toString():Fe(i).mul(Fe(1).add(Fe(e).div(100))).toString()}},[e,t])}}function _H(){const{fromCoin:e,toCoin:t}=tn(),{getPoolAddressByCoinType:r}=bH(!0);return{getSwapPoolAddress:async()=>e&&t?await r(e.coin_type,t.coin_type):[]}}function Q5(e,t,r){return he.useMemo(()=>t&&r&&+t&&+r?e?Fe(r).div(t).toString():Fe(t).div(r).toString():"0",[t,r,e])}function e7(e){const[t,r]=he.useState(),n=async i=>{if(i.is_trusted)return!1;try{return await gH(i.coin_type)}catch{}return!1};return he.useEffect(()=>{r(void 0),e&&n(e).then(i=>{r(i)})},[e==null?void 0:e.coin_type]),{isScamsCoin:t}}function xH(e,t){const{defaultFromCoinType:r,defaultToCoinCoinType:n}=tn(),{getTokenInfo:i}=Va(),{ignoreWarnTokenMap:s}=en(),o=i(e),a=i(t),c=he.useMemo(()=>!xf(r,K5.coin_type)||!xf(n,Y5.coin_type),[r,n]),u=he.useCallback(f=>f&&!s[ms(f.coin_type)]&&(xf(r,f.coin_type)||xf(n,f.coin_type))?!f.is_trusted:!1,[r,n,s]),l=he.useMemo(()=>{const f=[];return c&&(o&&u(o)&&f.push({...o}),a&&u(a)&&f.push({...a})),f},[o==null?void 0:o.coin_type,a==null?void 0:a.coin_type,c,s]);return{isCustomMode:c,customWarnTokenList:l}}function SH(){const{aggregatorSDK:e}=oo(),{getSwapPoolAddress:t}=_H(),r=s=>s&&s.error?s.error.code===Zo.InsufficientLiquidity||Zo.HoneyPot||Zo.NumberTooLarge:!1,n=async s=>{var p;const{fromToken:o,toToken:a,amount:c,providersKeys:u,by_amount_in:l,uuid:f}=s;try{const v={from:o.coin_type,target:a.coin_type,amount:new Y6(c),byAmountIn:l,depth:3,splitAlgorithm:void 0,splitFactor:void 0,splitCount:void 0,providers:u},w=await e.findRouters(v);if(w&&r(w))return i(!1,l,f,o,a,w);if(!w||!((p=w==null?void 0:w.paths)!=null&&p.length))throw Error("not find router");return i(!1,l,f,o,a,w)}catch{const w=await t(),y={from:o.coin_type,target:a.coin_type,amount:new Y6(c),byAmountIn:l,pools:w};try{const S=await e.swapInPools(y);return!S||!S.routeData?i(!0,l,f,o,a):i(!0,l,f,o,a,S.routeData)}catch{return{uuid:f,byAmountIn:l,isDegrade:!0}}}},i=(s,o,a,c,u,l)=>{var f;if(l){const p=l.error!==void 0,v=Z0(l.amountIn.toString(),c.decimals).toString(),w=Z0(l.amountOut.toString(),u.decimals).toString();return{routerData:p?void 0:l,fromAmountUi:p?o?v:"":v,toAmountUi:p&&o?"":w,uuid:a,byAmountIn:o,isDegrade:s,errorCode:(f=l.error)==null?void 0:f.code}}else return{uuid:a,byAmountIn:o,isDegrade:s}};return{findBestRouters:n}}function ec(e){const t=he.useRef(e);return he.useEffect(()=>{t.current=e},[e]),t}function EH(e){try{return e&&e.toString().includes("Rejected from user")}catch{return!1}}function TH(e){const t=String(e);return t.indexOf("withdraw_with_proof")>-1||t.indexOf("check_coin_threshold")>-1||t.indexOf('Identifier("balance")')>-1}function CH(e){return!!String(e).includes("Could not find the referenced transaction")}function AH(e){return!!String(e).includes("Max cap reached.")}function IH(e){return!!String(e).includes("Fast Mode service error")}function MH(e){return EH(e)?"User rejected the request":TH(e)?"Exceeded price slippage":CH(e)?"Oops. Failed to sync data from your txid. Please check your txn status from explorer or from your wallet.":AH(e)?"Max cap reached. This is to prevent your txn from overpaying. You can choose to edit your gas max cap in settings if needed.":IH(e)?"Fast Mode service error, please switch to the Default Transaction Mode or try again later.":"Transaction failed"}var ig={},OH=Rr&&Rr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ig,"__esModule",{value:!0});var jH=ig.executeAuction=t7;const kH=OH(P8),PH="https://rpc.getshio.com",RH=500,NH=300;function t7(e,t,r=RH){const n={jsonrpc:"2.0",method:"shio_executeAuction",params:[e,t],id:1};return new Promise((i,s)=>{setTimeout(i,r),kH.default.post(PH,n,{headers:{"Content-Type":"application/json"},timeout:r}).then(o=>{setTimeout(i,NH)}).catch(s)})}ig.default={executeAuction:t7};const DH="0x2::sui::SUI",$H="https://rpc.getshio.com/fast",LH="0x1889977f0fb56ae730e7bda8e8e32859ce78874458c74910d36121a81a615123",r7=[{objectId:"0xc32ce42eac951759666cbc993646b72387ec2708a2917c2c6fb7d21f00108c18",version:72869622},{objectId:"0x0289acae0edcdf1fe3aedc2e886bc23064d41c359e0179a18152a64d1c1c2b3e",version:327637282},{objectId:"0x03132160e8c2c45208abf3ccf165e82edcc42fee2e614afe54582f9740a808b8",version:327637282},{objectId:"0x072ae7307459e535379f422995a0d10132f12a3450298f8cf0cc07bd164f9999",version:327637282},{objectId:"0x1c1a96a2f4a34ea09ab15b8ff98f4b6b4338ce89f4158eb7d3eb2cd4dcbd6d86",version:327637282},{objectId:"0x20d76f37ad9f2421a9e6afaf3bb204250b1c2241c50e8a955e86a1a48767d06f",version:327637282},{objectId:"0x213ed368233cc7480fcb6336e70c5ae7ee106b2317ba02ccb5d0478e45bcc046",version:327637282},{objectId:"0x22ce1e80937354eba5549fed2937dc6e2b24026d03505bb51a3e4a64aa4142f6",version:327637282},{objectId:"0x26188cb7ce5ae633279f440f66081cb65cc585e428de18e194f8843e866f799f",version:327637282},{objectId:"0x38642f01422480128388d3e2948d3dc1b2680f9914077edb6bd3451ae1c5bcf0",version:327637282},{objectId:"0x3dd85b6424aea1cae9eff6e55456ca783e056226325f1362106eca8b3ed04ca0",version:327637282},{objectId:"0x42f8adc490542369d9c3b95e9f6eb70b2583102900feb7e103072ed49ba7fc3d",version:327637282},{objectId:"0x46b8158c82fa6bda7230d31a127d934c7295a0042083b4900f3096e9191f6f3f",version:327637282},{objectId:"0x6ebac88a8c3f7a4a9fb05ea49d188a1fe8520ae59ee736e0473004d3033512a4",version:327637282},{objectId:"0x6f55ad6cb40cfc124c11b11c19be0a80237b104acd955e7b52ccb7bf9046fe33",version:327637282},{objectId:"0x71aafb8bac986e82e5f78846bf3b36c2a82505585625207324140227a27ff279",version:327637282},{objectId:"0x7fe9b08680d4179de5672f213b863525b21f10604ca161538075e9338d1d2324",version:327637282},{objectId:"0x81538ef2909a3e0dd3d7f38bcbee191509bae4e8666272938ced295672e2ee8d",version:327637282},{objectId:"0x828eb6b3354ad68a23dd792313a16a0d888b7ea4fdb884bb22bd569f8e61319e",version:327637282},{objectId:"0x9705a332b8c1650dd7fe687ef9f9a9638afb51c30c0b34db150d60b920bc07eb",version:327637282},{objectId:"0x9918f73797a9390e9888b55454f2b31bc01de1a4634acab08f80641c4248e8a5",version:327637282},{objectId:"0x9cd4c08bdf2e132ec2cc77b0f03be60a94951e046d8e82ed5494f44e609edd2f",version:327637282},{objectId:"0xac8ce2033571140509788337c8a1f3aa8941a320ecd7047acda310d39cad9e03",version:327637282},{objectId:"0xbcd4527035265461a9a7b4f1e57c63ea7a6bdf0dc223c66033c218d880f928b1",version:327637282},{objectId:"0xbfdb691b8cc0b3c3a3b7a654f6682f3e53b164d9ee00b9582cdb4d0a353440a9",version:327637282},{objectId:"0xc2559d5c52ae04837ddf943a8c2cd53a5a0b512cee615d30d3abe25aa339465e",version:327637282},{objectId:"0xc56db634d02511e66d7ca1254312b71c60d64dc44bf67ea46b922c52d8aebba6",version:327637282},{objectId:"0xc84545cbff1b36b874ab2b69d11a3d108f23562e87550588c0bda335b27101e0",version:327637282},{objectId:"0xcc141659b5885043f9bfcfe470064819ab9ac667953bcedd1000e0652e90ee76",version:327637282},{objectId:"0xef6bf4952968d25d3e79f7e4db1dc38f2e9d99d61ad38f3829acb4100fe6383a",version:327637282},{objectId:"0xf2ed8d00ef829de5c4a3c5adf2d6b0f41f7fec005fb9c88e5616b98173b2fd66",version:327637282},{objectId:"0xfce73f3c32c3f56ddb924a04cabd44dd870b72954bbe7c3d7767c3b8c25c4326",version:327637282}];async function BH(e){const t=e.client,r=await e.transaction.build({client:t,onlyTransactionKind:!0});let n=e.sender??e.transaction.getData().sender;if(!n)throw new Error("Sender need to be either set in options or in transaction data");return await t.call("shio_estimateFastModeFee",[n,e.transaction.getData().gasData.price,Rl.from(r).toString("base64")])}function UH(){return r7[Math.floor(Math.random()*r7.length)]}async function FH(e,t,r){return await e.executeTransactionBlock({transactionBlock:t.bytes,signature:t.signature,options:r})}async function VH(e,t,r){let n=e.moveCall({package:"0x2",module:"coin",function:"into_balance",typeArguments:[DH],arguments:[t]});return zH(e,n,r)}async function zH(e,t,r){let n=UH();e.moveCall({package:LH,module:"auctioneer",function:"submit_bid",arguments:[e.sharedObjectRef({objectId:n.objectId,mutable:!0,initialSharedVersion:n.version}),e.pure.u64(r),t]})}const sg="CoinWithBalance",qH=$.object({type:$.string(),balance:$.bigint()});async function WH(e,t,r){var u,l;const n=new Set,i=new Map;if(!e.sender)throw new Error("Sender must be set to resolve CoinWithBalance");for(const f of e.commands)if(f.$kind==="$Intent"&&f.$Intent.name===sg){const{type:p,balance:v}=$.parse(qH,f.$Intent.data);p!=="gas"&&v>0n&&n.add(p),i.set(p,(i.get(p)??0n)+v)}const s=new Set;for(const f of e.inputs)(u=f.Object)!=null&&u.ImmOrOwnedObject&&s.add(f.Object.ImmOrOwnedObject.objectId),(l=f.UnresolvedObject)!=null&&l.objectId&&s.add(f.UnresolvedObject.objectId);const o=new Map,a=t.client;await Promise.all([...n].map(async f=>{o.set(f,await GH({coinType:f,balance:i.get(f),client:a,owner:e.sender,usedIds:s}))}));const c=new Map;c.set("gas",{$kind:"GasCoin",GasCoin:!0});for(const[f,p]of e.commands.entries()){if(p.$kind!=="$Intent"||p.$Intent.name!==sg)continue;const{type:v,balance:w}=p.$Intent.data;if(w===0n&&v!=="gas"){e.replaceCommand(f,Cn.Commands.MoveCall({target:"0x2::coin::zero",typeArguments:[v]}));continue}const y=[];if(!c.has(v)){const[S,...A]=o.get(v).map(O=>e.addInput("object",Cn.Inputs.ObjectRef({objectId:O.coinObjectId,digest:O.digest,version:O.version})));A.length>0&&y.push(Cn.Commands.MergeCoins(S,A)),c.set(v,S)}y.push(Cn.Commands.SplitCoins(c.get(v),[e.addInput("pure",Cn.Inputs.Pure(Vn.bcs.u64().serialize(w)))])),e.replaceCommand(f,y),e.mapArguments(S=>S.$kind==="Result"&&S.Result===f?{$kind:"NestedResult",NestedResult:[f+y.length-1,0]}:S)}return r()}async function GH({coinType:e,balance:t,client:r,owner:n,usedIds:i}){let s=t;const o=[];return a();async function a(c=null){const{data:u,hasNextPage:l,nextCursor:f}=await r.getCoins({owner:n,coinType:e,cursor:c}),p=u.sort((v,w)=>Number(BigInt(w.balance)-BigInt(v.balance)));for(const v of p){if(i.has(v.coinObjectId))continue;const w=BigInt(v.balance);if(o.push(v),s-=w,s<=0)return o}if(l)return a(f);throw new Error(`Not enough coins of type ${e} to satisfy requested balance`)}}function n7(){const{suiClient:e}=oo(),{currentAccount:t}=rn(),{mutateAsync:r}=on.useSignTransaction(),{mutate:n}=on.useSignAndExecuteTransaction({execute:async({bytes:c,signature:u})=>await s(c,u)}),i=he.useMemo(()=>"sui:mainnet",[t]),s=async(c,u,l=!1)=>{var p,v;if(l){const w=await e.devInspectTransactionBlock({transactionBlock:Cn.Transaction.from(br(c)),sender:t.address});if(!w||((p=w.effects)==null?void 0:p.status.status)==="failure")throw Error((v=w.effects)==null?void 0:v.status.error)}return await e.executeTransactionBlock({transactionBlock:c,signature:u,options:{showEvents:!0,showRawEffects:!0,showEffects:!0,showBalanceChanges:!0,showObjectChanges:!0,showInput:!0}})};return{signAndExecuteTransactionBlock:async(c,u=!1)=>{var f,p;let l;if(typeof c=="string"?l=Cn.Transaction.from(c):l=c,u){const v=await e.devInspectTransactionBlock({transactionBlock:c,sender:t.address});if(!v||((f=v.effects)==null?void 0:f.status.status)==="failure")throw Error((p=v.effects)==null?void 0:p.status.error)}return l.setGasBudget(1e8),new Promise((v,w)=>{n({transaction:l,chain:i},{onSuccess:y=>{v(y)},onError:y=>{console.error("signAndExecuteTransactionBlock transaction failed",y),w(y)}})})},signTransactionBlock:async c=>(c instanceof Uint8Array&&(c=Cn.Transaction.from(c)),typeof c=="string"&&(c=Cn.Transaction.from(br(c))),new Promise((u,l)=>{r({transaction:c,chain:i},{onSuccess:f=>{u(f)},onError:f=>{console.error("signTransactionBlock failed",f),l(f)},onSettled:(f,p,v,w)=>{console.error("signTransactionBlock onSettled",{data:f,error:p,variables:v})}})})),executeTransactionBlock:s}}function HH(){const{signTransactionBlock:e,executeTransactionBlock:t,signAndExecuteTransactionBlock:r}=n7(),{currentAccount:n}=rn();return{getFastModeTx:async(s,o,a)=>{let c,u,l;try{const f=new Lo({url:$H});s.setSender(n==null?void 0:n.address),s.setGasPrice(Number(a));const p=Cn.Transaction.from(s);p.addIntentResolver(sg,WH);const v=await BH({transaction:p,client:f}),w=Fe(o).mul(Math.pow(10,9)).toString();if(Fe(v.gasBudget).gt(w))throw Error("Max cap reached. This is to prevent your txn from overpaying. You can choose to edit your gas max cap in settings if needed.");s.setGasBudget(v.gasBudget);const y=s.splitCoins(s.gas,[v.tipAmount]);VH(s,y[0],v.tipAmount);const S=await s.build({client:f}),A=await e(S),{bytes:O,signature:j}=A;l=O,u=new Date().getTime(),c=await FH(f,A,{showEffects:!0,showEvents:!0})}catch(f){throw String(f).includes("Failed to fetch")?Error("Fast Mode service error"):f}return{result:c,startExecuteTime:u,transactionBlockBytes:l}}}}function KH(){const{signTransactionBlock:e,executeTransactionBlock:t,signAndExecuteTransactionBlock:r}=n7(),{currentAccount:n}=rn(),{suiClient:i}=oo(),{setTransactionData:s}=rg(),{addTxToast:o,removeToast:a}=Fa(),{getFastModeTx:c}=HH(),u=5,l=2e3;async function f(w,y=1){try{let S;try{S=await i.getTransactionBlock({digest:w,options:{showEvents:!0,showEffects:!0,showBalanceChanges:!0,showInput:!0,showRawInput:!0,showObjectChanges:!0}})}catch{S=await i.getTransactionBlock({digest:w,options:{showEvents:!0,showEffects:!0}})}if(S)return S;throw new Error("Empty response")}catch(S){if(console.error(`Attempt ${y} failed:`,S),y>=u)throw new Error("Failed to fetch transaction status after maximum retries.");return await m_(l),f(w,y+1)}}const p=async(w,y,S={useDevInspect:!1,useMev:!1,txAction:"signTransactionBlock",useFastMode:!1,maxCapForGas:"",customGasPrice:""})=>{var ge,se,fe;const{useDevInspect:A=!1,useMev:O,txAction:j="signTransactionBlock",useFastMode:V=!1,maxCapForGas:B="",customGasPrice:H=""}=S;let q;y.status="confirmation",s(y);let ne="";try{let z,N,h;typeof w=="function"?h=await w():h=w,h.setSender(n.address);let d;if(V&&B&&H){const x=await c(h,B,H);z=x.result,d=x.startExecuteTime,N=x.transactionBlockBytes}else if(j==="signTransactionBlock"){const x=await e(h),{bytes:E,signature:C}=x;if(O)try{const k=await jH(E,C,500)}catch{}z=await t(E,C,A)}else z=await r(h,A);y.status="submitted",s({...y}),y.tx=z.digest,q=o(y),await m_(l),ne=z==null?void 0:z.digest;let m;if(((ge=z==null?void 0:z.effects)==null?void 0:ge.status.status)==="success"?m=z:m=await f(ne,0),!m||((se=m.effects)==null?void 0:se.status.status)==="failure")v(y,(fe=m.effects)==null?void 0:fe.status.error);else{const x=rF(m,n==null?void 0:n.address,!1);if(y.buildShowInfo){const E=y.buildShowInfo("success",x);y.buildShowInfo=C=>E}a(q),y.status="success",s({...y})}return m}catch(z){v(y,z)}},v=(w,y)=>{const S=MH(y);if(w.buildShowInfo){const A=w.buildShowInfo("confirmation");w.buildShowInfo=O=>(A.toastDescriptionContent=S,A.modalDescriptionText=S,A),w.status="rejected",s({...w})}else w.buildShowInfo=A=>{const O={};return O.toastDescriptionContent=S,O.modalDescriptionText=S,O},w.status="rejected",s({...w})};return{signAndExecuteTransaction:p}}function og(e,t=1e3){const r=he.useRef(),n=he.useCallback((...i)=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{e(...i)},t)},[e,t]);return he.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]),n}function YH(){const{aggregatorSDK:e}=oo(),{findBestRouters:t}=SH(),{getTokenAmountValue:r,fetchTokenPrices:n}=Cu(),{providers:i,slippage:s,mevProtect:o,maxCapForGas:a,transactionMode:c,customGasPrice:u}=en(),{signAndExecuteTransaction:l}=KH(),{setTransactionData:f}=rg(),{addTxToast:p}=Fa(),{fromCoin:v,toCoin:w,setFromCoin:y,setToCoin:S,setToAmount:A,fromAmount:O,toAmount:j,setFromAmount:V,setFindRouterLoading:B,setRouterData:H,setByAmountIn:q,byAmountIn:ne}=tn(),[ge,se]=he.useState(""),fe=ec(ge),z=ec(ne),N=ec(O),h=ec(j),d=ec(v),m=ec(w),{balanceInfo:x,getOwnerCoinBalances:E}=au(v),{balanceInfo:C}=au(w),k=r(v==null?void 0:v.coin_type,O),M=r(w==null?void 0:w.coin_type,j),b=og(async(te,Q,G)=>{if(d.current&&m.current&&+te){(+N.current||+h.current)&&B(!0);const pe=eF(te,Q?d.current.decimals:m.current.decimals),X=await t({fromToken:d.current,toToken:m.current,amount:pe.toString(),providersKeys:i,by_amount_in:Q,uuid:G});B(!1),fe.current===G&&(Q?+N.current?(A(X.toAmountUi||""),H(X)):A(""):+h.current?(V(X.fromAmountUi||"ß"),H(X)):V(""))}else ie(!Q)},500),R=(te,Q,G=!1)=>{if(q(Q),Q?(V(te),G&&A("")):(A(te),G&&V("")),+te){const pe=J5();se(pe),b(te,Q,pe)}else B(!1),H(void 0),ie(!Q)},ue=(te,Q=!0)=>{ie(),Q?((te==null?void 0:te.coin_type)===(w==null?void 0:w.coin_type)&&S(v),y(te)):((te==null?void 0:te.coin_type)===(v==null?void 0:v.coin_type)&&y(w),S(te))},ie=te=>{te===void 0?(V(""),A("")):te?V(""):A(""),B(!1),H(void 0)},le=()=>{const te=z.current?N.current:h.current;if(+te){const Q=J5();se(Q),b(te,z.current,Q)}},be=async(te,Q)=>{const{routerData:G,byAmountIn:pe,fromAmountUi:X,toAmountUi:J}=te,U=new Cn.Transaction,oe={router:G,slippage:Number(s)/100,txb:U,partner:Q||cF};try{const ye={status:"confirmation",buildShowInfo:(je,Ve)=>{const Je=`Swap ${hn(X,v==null?void 0:v.decimals)} ${v==null?void 0:v.symbol} for ${hn(J,w==null?void 0:w.decimals)} ${w==null?void 0:w.symbol}`,$e={modalDescriptionText:Je,toastTitleText:Je};if(je==="success"){let Ge=X,nt=J;Ve&&(Ge=g_(Ve,v)||X,nt=g_(Ve,w)||J);const et=`Swapped ${hn(Ge,v==null?void 0:v.decimals)} ${v==null?void 0:v.symbol} for ${hn(nt,w==null?void 0:w.decimals)} ${w==null?void 0:w.symbol}`;$e.toastTitleText=et,$e.modalDescriptionText=et}return $e},id:0};f(ye),await l(async()=>(await e.fastRouterSwap(oe),U),ye,{useMev:o,useFastMode:c==="Fast Mode",maxCapForGas:a,customGasPrice:u})?(ie(),E()):le()}catch(ye){String(ye).includes("TypeError: Failed to fetch")&&p({id:0,status:"rejected",buildShowInfo(de,Ee){return{toastTitleText:"RPC loading failed",toastDescriptionContent:"Try resubmission. Or to check your network and switch an RPC in settings to try again."}}})}};he.useEffect(()=>{Ae(),ie()},[v==null?void 0:v.coin_type,w==null?void 0:w.coin_type]);const Ae=()=>{const te=[];v&&te.push(v.coin_type),w&&te.push(w.coin_type),te.length>0&&n(te)},{isScamsCoin:D}=e7(v),{isScamsCoin:F}=e7(w),K=he.useMemo(()=>{if(!(!D&&!F)){if(D&&F)return`${v==null?void 0:v.symbol} and ${w==null?void 0:w.symbol} are`;if(D)return`${v==null?void 0:v.symbol} token is `;if(F)return`${w==null?void 0:w.symbol} token is `}},[D,F]);return{handleAmountChange:R,handleSelectToken:ue,fromBalanceInfo:x,toBalanceInfo:C,fromAmountValue:k,toAmountValue:M,doSwapAction:be,reCalculateRouteData:le,refreshMarketPrice:Ae,scamsText:K}}function XH(e){const{fromCoin:t,toCoin:r,fromAmount:n,toAmount:i,routerData:s}=tn(),{currentAccount:o}=rn(),a=he.useMemo(()=>{const c={text:"Swap",disabled:!1};if(!(o!=null&&o.address))return c.text="Connect Wallet",c.disabled=!1,c;if(!t||!r)return c.text="Select a token",c.disabled=!0,c;if(!+n&&!+i)return c.text="Enter an amount",c.disabled=!0,c;if(s&&s.errorCode){if(s.errorCode===Zo.InsufficientLiquidity)return c.text="Insufficient liquidity for this trade",c.disabled=!0,c;if(s.errorCode===Zo.NoRouter||s.errorCode===Zo.HoneyPot)return c.text="No Available Route",c.disabled=!0,c}return+n&&Fe(n).gt(e||0)?(c.disabled=!0,c.text=`Insufficient ${Ur(t==null?void 0:t.symbol)} Balance`,c):((!+n||!+i)&&(c.disabled=!0),c)},[o==null?void 0:o.address,n,i,e,s==null?void 0:s.errorCode,t,r]);return{btnText:a.text,btnDisabled:a.disabled}}const i7=878,zi=176,dd=72,Qo=22,JH=8,Ts=16,ZH=24,QH=12,eK=16,tK=8,rK=22,zr=50,Er=55,tc=13,$n=5;function s7(e,t,r){const[n,i]=he.useState({}),[s,o]=he.useState([]),[a,c]=he.useState([]),[u,l]=he.useState(0),{fromCoin:f,toCoin:p}=tn(),[v,w]=he.useState([]),[y,S]=he.useState([]);function A(h,d,m,x=3){const E=new Set;h.forEach(ie=>{E.add(ie.from),E.add(ie.target)});const C=[],k=[],M=new Set;h.forEach(ie=>{var le;if(ie.from===d&&ie.target!==m){const be=ie.target,Ae=h.some(F=>F.target===be&&F.from!==d);let D=!1;if(Ae){const F=new Set((le=h.filter(Q=>Q.from===be))==null?void 0:le.map(Q=>Q==null?void 0:Q.target));Array.from(F).every(Q=>Q===m)&&(D=!0)}D||M.add(be)}}),M.forEach(ie=>{const le={};h.forEach(be=>{be.from===d&&be.target===ie&&(le[d]||(le[d]=[]),le[d].push(be))}),Object.keys(le).forEach(be=>{const Ae=new Map;le[be].forEach(D=>{const F=D.provider,K=D.feeRate,te=`${F}_${K}`;if(Ae.has(te)){const Q=Ae.get(te);Q.amountIn=Fe(Q.amountIn).plus(D.amountIn||"0").toString(),Q.amountOut=Fe(Q.amountOut).plus(D.amountOut||"0").toString()}else Ae.set(te,{...D,amountIn:D.amountIn||"0",amountOut:D.amountOut||"0"})}),le[be]=Array.from(Ae.values())}),k.push({target:`0-${ie}`,originalTarget:ie,list:le})}),k.length>0&&C.push(k);const g=[],b=new Set;h.forEach(ie=>{ie.from!==d&&ie.from!==m&&b.add(ie.from),ie.target!==d&&ie.target!==m&&b.add(ie.target)}),b.forEach(ie=>{const le={};h.forEach(be=>{be.target===ie&&(be.from===d?M.has(ie)||(le[be.from]||(le[be.from]=[]),le[be.from].push(be)):(le[be.from]||(le[be.from]=[]),le[be.from].push(be)))}),Object.keys(le).length>0&&(Object.keys(le).forEach(be=>{const Ae=new Map;le[be].forEach(D=>{const F=D.provider,K=D.feeRate,te=`${F}_${K}`;if(Ae.has(te)){const Q=Ae.get(te);Q.amountIn=Fe(Q.amountIn).plus(D.amountIn||"0").toString(),Q.amountOut=Fe(Q.amountOut).plus(D.amountOut||"0").toString()}else Ae.set(te,{...D,amountIn:D.amountIn||"0",amountOut:D.amountOut||"0"})}),le[be]=Array.from(Ae.values())}),g.push({target:`1-${ie}`,originalTarget:ie,list:le}))}),g.length>0&&C.push(g);const R=[],ue={};return h.forEach(ie=>{ie.target===m&&(ue[ie.from]||(ue[ie.from]=[]),ue[ie.from].push(ie))}),Object.keys(ue).length>0&&(Object.keys(ue).forEach(ie=>{const le=new Map;ue[ie].forEach(be=>{const Ae=be.provider,D=be.feeRate,F=`${Ae}_${D}`;if(le.has(F)){const K=le.get(F);K.amountIn=Fe(K.amountIn).plus(be.amountIn||"0").toString(),K.amountOut=Fe(K.amountOut).plus(be.amountOut||"0").toString()}else le.set(F,{...be,amountIn:be.amountIn||"0",amountOut:be.amountOut||"0"})}),ue[ie]=Array.from(le.values())}),R.push({target:`2-${m}`,originalTarget:m,list:ue})),R.length>0&&C.push(R),C}function O(h,d,m){var b,R,ue;const x=h.length,E=x*zi+(x-1)*dd,C=(i7-E)/2,k=new Map,M=[],g=new Map;if(h.forEach((ie,le)=>{ie.forEach(be=>{const Ae=`${le}-${be.target}`,D=N(be.list);g.set(Ae,D)})}),x===1){const ie=h[0];let le=zr;ie.forEach(be=>{const Ae=`0-${be.target}`,D=g.get(Ae)||0;k.set(Ae,{...be,id:Ae,top:le,left:C,height:D,width:zi,columnIndex:0}),le+=D+Ts}),M.push(ie)}else if(x===2){const ie=h[0],le=h[1],be=le.some(K=>K.list&&K.list[d]),Ae=ie.map(K=>{var Q;const te=((Q=K.list[d])==null?void 0:Q.reduce((G,pe)=>G+parseFloat(pe.amountIn||"0"),0))||0;return{block:K,totalAmountIn:te}}).sort((K,te)=>te.totalAmountIn-K.totalAmountIn).map(({block:K})=>K);let D=be?zr+Qo:zr;Ae.forEach(K=>{const te=`0-${K.target}`,Q=g.get(te)||0;k.set(te,{...K,id:te,top:D,left:C,height:Q,width:zi,columnIndex:0}),D+=Q+Ts});let F=zr;le.forEach(K=>{const te=`1-${K.target}`,Q=g.get(te)||0;k.set(te,{...K,id:te,top:F,left:C+zi+dd,height:Q,width:zi,columnIndex:1}),F+=Q+Ts}),M.push(Ae,le)}else{const ie=h[0],le=h[1],be=h[2],Ae=((b=be[0])==null?void 0:b.originalTarget)||((R=be[0])==null?void 0:R.target),D=ie.map(de=>{var At,Rt;const Ee=de.originalTarget||de.target,je=`0-${de.target}`,Ve=g.get(je)||0,Je=le.some(He=>He.originalTarget==de.originalTarget),$e=((Rt=(At=be==null?void 0:be[0])==null?void 0:At.list)==null?void 0:Rt[de==null?void 0:de.originalTarget])&&!Je,Ge=le.some(He=>{const pt=He.originalTarget||He.target;return m.some(lt=>lt.from===Ee&<.target===pt)}),nt=[];le.forEach(He=>{const pt=He.originalTarget||He.target;m.some(lt=>lt.from===Ee&<.target===pt)&&nt.push(pt)});let et=6;if($e&&!Ge)et=1;else if($e&&Ge)et=2;else if(!$e&&Ge)if(nt.length===1){const He=nt[0],pt=le.find(tt=>(tt.originalTarget||tt.target)===He);(pt?Object.keys(pt.list||{}).length:0)===1?et=3:et=5}else nt.every(pt=>{const lt=le.find(ot=>(ot.originalTarget||ot.target)===pt);return(lt?Object.keys(lt.list||{}).length:0)===1})?et=4:et=6;return{block:de,target:Ee,height:Ve,hasDirectToTarget:$e,hasConnectionToSecond:Ge,secondColTargets:nt,priority:et}});D.sort((de,Ee)=>{var Je,$e;if(de.priority!==Ee.priority)return de.priority-Ee.priority;const je=((Je=de.block.list[d])==null?void 0:Je.reduce((Ge,nt)=>Ge+parseFloat(nt.amountIn||"0"),0))||0;return((($e=Ee.block.list[d])==null?void 0:$e.reduce((Ge,nt)=>Ge+parseFloat(nt.amountIn||"0"),0))||0)-je});const F=be.some(de=>(de.originalTarget||de.target)===Ae&&de.list&&de.list[d]),K=le.some(de=>de.list&&de.list[d]);let te=F?zr+Qo:zr;if(K){const de=le.find(Ee=>Ee.list&&Ee.list[d]);if(de)if(Object.keys(de.list||{}).length===1){const je=`1-${de.target}`,Ve=g.get(je)||0;te+=Ve+Ts}else te+=Qo}K&&D.length>0&&(D[0].hasDirectToTarget&&te<=zr+Qo?te+=50:te+=Ts);let Q=te;D.forEach((de,Ee)=>{const je=`0-${de.block.target}`,Ve=g.get(je)||0;k.set(je,{...de.block,id:je,top:Q,left:C,height:Ve,width:zi,columnIndex:0}),Ee<D.length-1&&(Q+=Ve+Ts)});const G=[],pe=le.find(de=>de.list&&de.list[d]);pe&&G.push(pe),D.forEach(de=>{de.secondColTargets.forEach(Ee=>{const je=le.find(Ve=>(Ve.originalTarget||Ve.target)===Ee);je&&!G.some(Ve=>Ve.target===je.target)&&G.push(je)})}),le.forEach(de=>{const Ee=de.originalTarget||de.target;G.some(je=>(je.originalTarget||je.target)===Ee)||G.push(de)});let X=F?zr+Qo:zr;D.some(de=>de.hasDirectToTarget&&de.hasConnectionToSecond)&&(X+=Qo);const U=(ue=D.filter(de=>de.hasDirectToTarget&&!de.hasConnectionToSecond))==null?void 0:ue.length;let oe=X;G.forEach((de,Ee)=>{const je=`1-${de.target}`,Ve=g.get(je)||0;Ee===0&&U>0&&(K?oe+=Qo:oe+=U*120+U*Ts),k.set(je,{...de,id:je,top:oe,left:C+zi+dd,height:Ve,width:zi,columnIndex:1}),oe+=Ve+Ts});let ye=zr;be.forEach(de=>{const Ee=`2-${de.target}`,je=g.get(Ee)||0;k.set(Ee,{...de,id:Ee,top:ye,left:C+2*zi+2*dd,height:je,width:zi,columnIndex:2}),ye+=je+Ts}),M.push(D.map(de=>de.block),G,be)}return{nodesMap:k,orderedNodeColume:M}}function j(h,d,m){const x={},E=[];if(h.forEach((C,k)=>{C.forEach(M=>{const g=M.originalTarget||M.target;if(M.list&&M.list[m]){const b=M.list[m].reduce((R,ue)=>R+parseFloat(ue.amountIn||"0"),0);E.push({target:g,amountIn:b,colIndex:k})}})}),E.length>0){const C=E.reduce((g,b)=>g+b.amountIn,0),k=[];E.forEach(({amountIn:g})=>{const b=C>0?wf(Fe(g).div(C).mul(100).toString(),0):0;k.push(Number(b)||1)});const M=Sf(k);E.forEach(({target:g},b)=>{var ue;const R=((ue=M[b])==null?void 0:ue.toString())||"0";x[m]||(x[m]={}),x[m][g]={fromPercent:R}})}return h.length>0&&h[0].forEach(k=>{const M=k.originalTarget||k.target,g=`0-${M}`,b=[];let R=!1;if(h.length>1&&(R=h[1].some(ie=>(ie.originalTarget||ie.target)===M)),R)h[1].forEach(ie=>{const le=ie.originalTarget||ie.target;if(ie.list&&ie.list[M]){const be=ie.list[M].reduce((Ae,D)=>Ae+parseFloat(D.amountIn||"0"),0);b.push({target:le,amountIn:be})}});else for(let ue=1;ue<h.length;ue++)h[ue].forEach(le=>{const be=le.originalTarget||le.target;if(le.list&&le.list[M]){const Ae=le.list[M].reduce((D,F)=>D+parseFloat(F.amountIn||"0"),0);b.push({target:be,amountIn:Ae})}});if(b.length>0){const ue=b.reduce((be,Ae)=>be+Ae.amountIn,0),ie=[];b.forEach(({amountIn:be})=>{const Ae=ue>0?wf(Fe(be).div(ue).mul(100).toString(),0):0;ie.push(Number(Ae)||1)});const le=Sf(ie);b.forEach(({target:be},Ae)=>{const D=le[Ae];x[g]||(x[g]={}),x[g][be]={fromPercent:D.toString()}})}}),h.length>2&&h[1].forEach(k=>{const M=k.originalTarget||k.target,g=`1-${M}`,b=[];if(h[2].forEach(ue=>{const ie=ue.originalTarget||ue.target;if(ue.list&&ue.list[M]){const le=ue.list[M].reduce((be,Ae)=>be+parseFloat(Ae.amountIn||"0"),0);b.push({target:ie,amountIn:le})}}),b.length>0){const ue=b.reduce((be,Ae)=>be+Ae.amountIn,0),ie=[];b.forEach(({amountIn:be})=>{const Ae=ue>0?wf(Fe(be).div(ue).mul(100).toString(),0):0;ie.push(Number(Ae)||1)});const le=Sf(ie);b.forEach(({target:be},Ae)=>{const D=le[Ae];x[g]||(x[g]={}),x[g][be]={fromPercent:D.toString()}})}}),x}function V(h,d,m){for(const[x,E]of m.entries())if(x.startsWith(`${h}-`)&&(E.originalTarget===d||E.target===d))return E;return null}function B(h,d,m,x,E){var ue,ie,le,be,Ae,D;const C=[],k=((ie=(ue=x[x.length-1])==null?void 0:ue[0])==null?void 0:ie.originalTarget)||((be=(le=x[x.length-1])==null?void 0:le[0])==null?void 0:be.target);if(k){const F=V(x.length-1,k,d);if(F){const K=((D=(Ae=h[m])==null?void 0:Ae[k])==null?void 0:D.fromPercent)||"0";x.length>0&&x[x.length-1].some(Q=>(Q.originalTarget||Q.target)===k&&Q.list&&Q.list[m])&&(x.length===1&&x[0].length===1?C.push({from:m,to:F.id,fromX:tc,fromY:F.top+F.height/2,toX:F.left-$n,toY:F.top+F.height/2,fromPercent:K,isStart:!0}):C.push({from:m,to:F.id,fromX:tc,fromY:zr+10,toX:F.left-$n,toY:zr+10,fromPercent:K,isStart:!0}))}}for(let F=0;F<x.length;F++)x[F].forEach(te=>{var J,U;const Q=te.originalTarget||te.target,G=V(F,Q,d);if(!G||!(te.list&&te.list[m])||Q===k)return;const X=((U=(J=h[m])==null?void 0:J[Q])==null?void 0:U.fromPercent)||"0";x.length>2&&F===1?Object.keys(te.list||{}).length===1?C.push({from:m,to:G.id,fromX:tc,fromY:G.top+G.height/2,toX:G.left-$n,toY:G.top+G.height/2,fromPercent:X,isStart:!0}):C.push({from:m,to:G.id,fromX:tc,fromY:G.top+10,toX:G.left-$n,toY:G.top+10,fromPercent:X,isStart:!0}):C.push({from:m,to:G.id,fromX:tc,fromY:G.top+G.height/2,toX:G.left-$n,toY:G.top+G.height/2,fromPercent:X,isStart:!0})});const M=new Map,g=new Map;for(let F=0;F<x.length;F++)x[F].forEach(te=>{const Q=te.originalTarget||te.target;if(!V(F,Q,d))return;const pe=te.list||{};Object.entries(pe).forEach(([X,J])=>{if(X===m)return;let U=null;for(let de=F-1;de>=0&&(U=V(de,X,d),!U);de--);if(!U)return;const oe=U.id,ye=M.get(oe)||0;M.set(oe,ye+1)})});for(let F=0;F<x.length;F++)x[F].forEach(te=>{const Q=te.originalTarget||te.target,G=V(F,Q,d);if(!G)return;const pe=te.list||{};Object.entries(pe).forEach(([X,J])=>{var je,Ve,Je,$e,Ge,nt,et,At,Rt,He,pt,lt,tt,ot;if(X===m)return;let U=null;for(let gt=F-1;gt>=0&&(U=V(gt,X,d),!U);gt--);if(!U)return;const oe=U.id,ye=U.top+U.height/2;let de=!1;const Ee=g.get(oe)||0;if(g.set(oe,Ee+1),x.length===3&&U.columnIndex===0&&G.columnIndex===2){const gt=(je=x[0])==null?void 0:je[0];if(gt&&(U.originalTarget||U.target)===(gt.originalTarget||gt.target))if(x.length>1&&x[1].some(yt=>yt.list&&yt.list[m]))de=!0;else{de=!1;const yt=((Je=(Ve=h[`${U.columnIndex}-${U.originalTarget||U.target}`])==null?void 0:Ve[Q])==null?void 0:Je.fromPercent)||"0";C.push({from:U.id,to:G.id,fromX:U.left+U.width,fromY:U.top+10,toX:G.left,toY:U.top+10,fromPercent:yt})}else if(ye>=G.top&&ye<=G.top+G.height){const st=((Ge=($e=h[`${U.columnIndex}-${U.originalTarget||U.target}`])==null?void 0:$e[Q])==null?void 0:Ge.fromPercent)||"0";C.push({from:U.id,to:G.id,fromX:U.left+U.width,fromY:ye,toX:G.left-$n,toY:ye,fromPercent:st})}else{let st=!1;for(let yt=U.top;yt<=U.top+U.height;yt+=5)if(yt>=G.top&&yt<=G.top+G.height){const Nt=((et=(nt=h[`${U.columnIndex}-${U.originalTarget||U.target}`])==null?void 0:nt[Q])==null?void 0:et.fromPercent)||"0";C.push({from:U.id,to:G.id,fromX:U.left+U.width,fromY:yt,toX:G.left-$n,toY:yt,fromPercent:Nt}),st=!0;break}st||(de=!0)}}else if(ye>=G.top&&ye<=G.top+G.height){const gt=((Rt=(At=h[`${U.columnIndex}-${U.originalTarget||U.target}`])==null?void 0:At[Q])==null?void 0:Rt.fromPercent)||"0";C.push({from:U.id,to:G.id,fromX:U.left+U.width,fromY:ye,toX:G.left,toY:ye,fromPercent:gt})}else{let gt=!1;for(let st=U.top;st<=U.top+U.height;st+=5)if(st>G.top+10&&st<G.top+G.height-10){const yt=((pt=(He=h[`${U.columnIndex}-${U.originalTarget||U.target}`])==null?void 0:He[Q])==null?void 0:pt.fromPercent)||"0";C.push({from:U.id,to:G.id,fromX:U.left+U.width,fromY:st,toX:G.left,toY:st,fromPercent:yt}),gt=!0;break}gt||(de=!0)}if(de){const gt=((tt=(lt=h[`${U.columnIndex}-${U.originalTarget||U.target}`])==null?void 0:lt[Q])==null?void 0:tt.fromPercent)||"0",st=M.get(oe)||1,yt=g.get(oe)||0,Nt=50,mt=U.top+10,It=U.height-20,Bt=st>3?Math.min(Nt,It/Math.max(1,st-1)):Nt,Xe=mt+yt*Bt;if(x.length===3&&U.columnIndex===0&&G.columnIndex===2){const jt=(ot=x[0])==null?void 0:ot[0];if(jt&&(U.originalTarget||U.target)===(jt.originalTarget||jt.target)){const Ut=U.left+U.width/2,L=U.top;C.push({from:U.id,to:G.id,fromX:Ut,fromY:L,toX:G.left,toY:zr+10,fromPercent:gt,segments:[{x1:Ut,y1:L,x2:Ut,y2:zr+10},{x1:Ut,y1:zr+10,x2:G.left-$n,y2:zr+10}]})}else G.top>U.top+U.height?C.push({from:U.id,to:G.id,fromX:U.left+U.width,fromY:Xe,toX:U.left+U.width+Er,toY:Xe,fromPercent:gt,segments:[{x1:U.left+U.width,y1:Xe,x2:U.left+U.width+Er,y2:Xe},{x1:U.left+U.width+Er,y1:Xe,x2:U.left+U.width+Er,y2:G.top+20},{x1:U.left+U.width+Er,y1:G.top+20,x2:G.left,y2:G.top+20}]}):C.push({from:U.id,to:G.id,fromX:U.left+U.width,fromY:Xe,toX:U.left+U.width+Er,toY:Xe,fromPercent:gt,segments:[{x1:U.left+U.width,y1:Xe,x2:U.left+U.width+Er,y2:Xe},{x1:U.left+U.width+Er,y1:Xe,x2:U.left+U.width+Er,y2:G.top+G.height-20},{x1:U.left+U.width+Er,y1:G.top+G.height-20,x2:G.left-$n,y2:G.top+G.height-20}]})}else x.length===3&&U.columnIndex===1&&G.columnIndex===2&&G.top<U.top?C.push({from:U.id,to:G.id,fromX:U.left+U.width,fromY:Xe,toX:G.left+G.width/2,toY:Xe,fromPercent:gt,segments:[{x1:U.left+U.width,y1:Xe,x2:G.left+G.width/2,y2:Xe},{x1:G.left+G.width/2,y1:Xe,x2:G.left+G.width/2,y2:G.top+G.height+$n}]}):G.top>U.top+U.height?C.push({from:U.id,to:G.id,fromX:U.left+U.width,fromY:Xe,toX:U.left+U.width+Er,toY:Xe,fromPercent:gt,segments:[{x1:U.left+U.width,y1:Xe,x2:U.left+U.width+Er,y2:Xe},{x1:U.left+U.width+Er,y1:Xe,x2:U.left+U.width+Er,y2:G.top+20},{x1:U.left+U.width+Er,y1:G.top+20,x2:G.left-$n,y2:G.top+20}]}):C.push({from:U.id,to:G.id,fromX:U.left+U.width,fromY:Xe,toX:U.left+U.width+Er,toY:Xe,fromPercent:gt,segments:[{x1:U.left+U.width,y1:Xe,x2:U.left+U.width+Er,y2:Xe},{x1:U.left+U.width+Er,y1:Xe,x2:U.left+U.width+Er,y2:G.top+G.height-20},{x1:U.left+U.width+Er,y1:G.top+G.height-20,x2:G.left-$n,y2:G.top+G.height-20}]})}})});const b=Math.max(...Array.from(d.values()).map(F=>F.columnIndex)),R=Array.from(d.values()).filter(F=>F.columnIndex===b);if(R.length>0){const F=R[0],K=F.top+F.height/2;C.push({from:F.id,to:"final",fromX:F.left+F.width,fromY:K,toX:i7-tc,toY:K,fromPercent:"100",isFinal:!0})}return{edges:C}}function H(h){if(h.length===0)return 0;let d=1/0,m=-1/0;return h.forEach(x=>{d=Math.min(d,x.top),m=Math.max(m,x.top+x.height)}),m-d}const q=async()=>{var ue;const h=(ue=e==null?void 0:e.routerData)==null?void 0:ue.paths;if(!h||(h==null?void 0:h.length)===0)return;const d=v_((f==null?void 0:f.coin_type)||t||""),m=v_((p==null?void 0:p.coin_type)||r||""),x=A(h,d,m,3),{nodesMap:E,orderedNodeColume:C}=O(x,d,h);S(C);const k=j(C,h,d),{edges:M}=B(k,E,d,C),g=[...E.values()],b=H([...E.values()])+zr+32;l(b),o(g),c(M);const R=Array.from(new Set([...E.values()].map(ie=>ie.originalTarget||ie.target)));fe([...R,d])},{getTokenListInfo:ne}=Va(),[ge,se]=he.useState(new Map),fe=async h=>{const d=await ne(h);d&&(d==null?void 0:d.size)>0&&se(d)};he.useEffect(()=>{var h;q(),z(((h=e==null?void 0:e.routerData)==null?void 0:h.paths)||[])},[e]);function z(h){if(!Array.isArray(h))return[];const d=new Set;h.forEach(m=>{m.provider&&d.add(m.provider)}),w(Array.from(d))}function N(h){let d=JH*2+ZH;const m=Object.entries(h);return m.forEach(([x,E],C)=>{d+=QH*2,d+=eK,d+=10,E.forEach(k=>{d+=rK})}),d+((m==null?void 0:m.length)-1)*tK+10}return{newFormatSwapRouter:n,nodes:s,edges:a,tokenMap:ge,panelHeight:u,getAllProviders:z,allProviders:v,resultColumes:y}}function nK({themeType:e}){const t=e=="Light"?Pt("/images/logo_light@2x.png"):Pt("/images/logo@2x.png");return _.jsxs("div",{style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",marginTop:"16px"},children:[_.jsx("span",{style:{fontSize:"12px",color:"var(--cs-text-primary)",fontWeight:"500",marginRight:"8px"},children:"Powered by"}),_.jsx("img",{style:{height:"20px"},src:t})]})}function ag({baseToken:e,quoteToken:t,baseAmount:r,quoteAmount:n,loading:i,fontSize:s="14px"}){const[o,a]=he.useState(!0),c=Q5(o,r,n);return _.jsxs("div",{className:"current-price-block",style:{cursor:"pointer"},onClick:()=>{a(!o)},children:[_.jsx(Pr,{src:o?e==null?void 0:e.logo_url:t==null?void 0:t.logo_url,token:o?e:t,showWarnSize:"10px"}),_.jsxs("span",{style:{display:"flex",alignItems:"center",color:"var(--cs-text-primary)",fontSize:s,maxWidth:"80%"},children:["1"," ",Ur(o?e==null?void 0:e.symbol:t==null?void 0:t.symbol)," ","="," ",i?_.jsx(Xo,{className:"custom-skeleton",style:{height:"16px",width:"40px",marginLeft:"2px",marginRight:"2px"}}):hn(c,t==null?void 0:t.decimals)," ",Ur(o?t==null?void 0:t.symbol:e==null?void 0:e.symbol)]}),_.jsx(Pr,{src:o?t==null?void 0:t.logo_url:e==null?void 0:e.logo_url,token:o?t:e,showWarnSize:"8px"}),_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-swap"})})]})}function rc(){const[e,t]=he.useState(window.innerWidth),r=og(()=>{t(window.innerWidth)},300);he.useEffect(()=>(window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r)}),[]);const n=he.useMemo(()=>e<810,[e]);return{windowWidth:e,isApp:n}}function hd({content:e,children:t,position:r,autoSwitchTooltip:n=!1,borderRadius:i="8px"}){const{isApp:s}=rc();return s&&n?_.jsxs(Es.Root,{children:[_.jsx(Es.Trigger,{children:_.jsx("button",{style:{background:"none",border:"none",padding:"0",margin:"0",outline:"none",boxShadow:"none",color:"inherit",font:"inherit",textAlign:"inherit"},children:t})}),_.jsx(Es.Content,{variant:"soft",style:{transition:"opacity 0.3s ease",display:"block",zIndex:9e3,padding:"8px 12px",backgroundColor:"var(--cs-bg-primary)",color:"var(--cs-text-secondary)",borderRadius:i,fontSize:"12px",whiteSpace:"nowrap",border:"1px solid",borderColor:"var(--cs-border)",boxShadow:"0px 2px 10px rgba(0, 0, 0, 0.1)"},side:r,align:"center",children:e})]}):_.jsx(Jo,{content:e,position:r,borderRadius:i,children:t})}function iK({pr:e="8px",pl:t="8px",value:r,isLoading:n}){const{isApp:i}=rc();return _.jsxs("div",{className:"swap-info-between",style:{paddingLeft:t,paddingRight:e},children:[_.jsxs("div",{className:"left",children:[_.jsx("span",{children:"Overlay Fee"}),_.jsx(hd,{autoSwitchTooltip:!0,position:"top",content:_.jsx("div",{style:{color:"var(--cs-text-secondary)",fontSize:"12px",lineHeight:"18px",width:i?"200px":"280px",textAlign:"start",whiteSpace:"normal"},children:"Fees charged by the integrator, which has been deducted from the output."}),children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{cursor:"pointer",width:"20px",height:"20px"},children:_.jsx("use",{xlinkHref:"#icon-tips"})})})]}),n?_.jsx(Xo,{className:"custom-skeleton",style:{height:"18px",width:"80px"}}):_.jsx("div",{className:"right",children:r?`${Fe(r).mul(100).toString()}%`:""})]})}function o7(e,t,r,n){const{getTokenPrice:i}=Cu(),s=i(e==null?void 0:e.coin_type),o=i(t==null?void 0:t.coin_type),a=Q5(!0,r,n),c=he.useMemo(()=>{if(o&&s)return Fe(s.price).div(o.price).toString()},[s==null?void 0:s.price,o==null?void 0:o.price]),u=he.useMemo(()=>{if(c&&+a)return Fe(a).sub(c).div(a).mul(100).toFixed(10)},[c,a]),l=he.useMemo(()=>{const y=[];return s&&y.push(s.market),o&&!y.includes(o.market)&&y.push(o.market),y},[s==null?void 0:s.market,o==null?void 0:o.market]),f=he.useMemo(()=>!s||!o||s.market==="cetus"||o.market==="cetus",[s,o]),p=he.useMemo(()=>f?!1:u&&Fe(u).lt(0)?Fe(u).abs().gt(5):!1,[u,f]),v=he.useMemo(()=>f?!1:u&&Fe(u).lt(0)?Fe(u).abs().gt(10):!1,[u,f]),w=he.useMemo(()=>{let y,S="yellow";if(f)return{priceImpactText:void 0,textColor:"yellow"};if(u)if(Fe(u).gt(0))S="green",Fe(u).lt(.1)?y="< 0.1% cheaper than":y=`${hn(u,2,!0,Br.ROUND_UP)}% cheaper than`;else if(Fe(u).eq(0))y="0%",S="green";else{const A=Fe(u).abs();A.lte(5)?(S="green",y=`Within ${hn(A.toString(),2,!0,Br.ROUND_UP)}%`):A.lte(10)?(S="yellow",y=`${hn(A.toString(),2,!0,Br.ROUND_UP)}% more than`):A.lte(100)?(S="red",y=`${hn(A.toString(),2,!0,Br.ROUND_UP)}% more than`):(S="red",y="> 100% more than")}return{priceImpactText:y,textColor:S}},[u,f]);return{swapPrice:a,marketPrice:c,priceImpact:u,sources:l,showPriceImpactTips:p,showPriceImpactWarn:v,priceImpactTextInfo:w,showIncalculable:f}}function a7({isLoading:e,routerData:t,noTips:r}){const{fromCoin:n,toCoin:i,fromAmount:s,toAmount:o}=tn();rc();const{priceImpact:a,sources:c,marketPrice:u,priceImpactTextInfo:l,showIncalculable:f}=o7(n,i,t==null?void 0:t.fromAmountUi,t==null?void 0:t.toAmountUi);return _.jsxs(_.Fragment,{children:[!r&&Fe(a).lte(-30)&&!f&&_.jsx("div",{className:"price-impact-tips red",children:"High price difference. Be cautious before submitting your order."}),_.jsxs("div",{className:"price-impact-block",children:[_.jsxs("div",{className:"left",children:[_.jsx("span",{style:{color:"var(--cs-text-secondary)"},children:"Price Difference"}),_.jsx(hd,{autoSwitchTooltip:!0,position:"top",content:_.jsx(sK,{fromToken:n,toToken:i,sources:c,baseAmount:"1",quoteAmount:u,showIncalculable:f}),children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{cursor:"pointer",width:"20px",height:"20px"},children:_.jsx("use",{xlinkHref:"#icon-tips"})})})]}),_.jsxs("div",{children:[e&&_.jsx(Xo,{className:"custom-skeleton",style:{width:"80px",height:"20px"}}),!e&&_.jsxs("div",{className:"right",children:[_.jsx("span",{className:l==null?void 0:l.textColor,children:l.priceImpactText&&!f?l==null?void 0:l.priceImpactText:"Incalculable"}),l.priceImpactText&&!f&&_.jsx("div",{className:"platforms",children:c.map(p=>_.jsx(Jo,{content:_.jsx("span",{style:{fontSize:"12px",color:"var(--cs-text-primary)"},children:E_[p]}),position:"top",delay:300,children:_.jsx(Pr,{src:hF[p],haveBorder:!1,style:{width:"16px",height:"16px"}})},p))})]})]})]})]})}function sK({fromToken:e,toToken:t,baseAmount:r,quoteAmount:n,sources:i,showIncalculable:s}){const{isApp:o}=rc();return _.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"8px"},children:[_.jsx("p",{style:{color:"var(--cs-text-secondary)",fontSize:"12px",lineHeight:"18px",width:o?"200px":"300px",textAlign:"start",whiteSpace:"normal"},children:"The difference between the market price and estimated price due to trade size."}),!s&&_.jsxs("div",{style:{width:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start"},children:[_.jsx("p",{style:{fontSize:"12px",color:"var(--cs-text-primary)"},children:"Market price sources:"}),r&&n?_.jsx(ag,{baseToken:e,quoteToken:t,baseAmount:"1",quoteAmount:n,loading:!1,fontSize:"12px"}):_.jsx("p",{style:{color:"var(--cs-text-primary)",fontSize:"12px"},children:"Price is unknown"})]}),!s&&_.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[_.jsx("p",{style:{color:"var(--cs-text-secondary)",fontSize:"12px",whiteSpace:"pre"},children:"Market price sources:"}),_.jsx("p",{style:{color:"var(--cs-text-secondary)",fontSize:"12px",whiteSpace:"pre"},children:i.map(a=>E_[a]+" ").join("")})]})]})}function c7({pr:e="8px",pl:t="8px",amountLimit:r,isLoading:n}){const{fromCoin:i,toCoin:s,byAmountIn:o}=tn();return _.jsxs("div",{className:"swap-info-between",style:{paddingLeft:t,paddingRight:e},children:[_.jsx("div",{className:"left",children:o?"Minimum Received":"Maximum Sold"}),n?_.jsx(Xo,{className:"custom-skeleton",style:{height:"18px",width:"80px"}}):_.jsxs("div",{className:"right",children:[hn(r,o?s==null?void 0:s.decimals:i==null?void 0:i.decimals,!1,Br.ROUND_DOWN)," ",Ur(o?(s==null?void 0:s.symbol)||"":(i==null?void 0:i.symbol)||"")]})]})}function oK({scamsText:e}){return _.jsxs("div",{style:{marginTop:"16px",borderRadius:"8px",border:"1px solid var(--cs-border)",paddingTop:"12px",width:"100%",backgroundColor:"var(--cs-bg-secondary-common)"},children:[_.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"0 12px",justifyContent:"center",textAlign:"center"},children:[_.jsx("svg",{className:"cs-icon",style:{width:"20px",height:"20px",fill:"var(--cs-warning)"},"aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-alert"})}),_.jsx("span",{style:{color:"var(--cs-warning)",marginLeft:"4px"},children:"Alert"})]}),_.jsx("div",{style:{borderRadius:"8px",padding:"11px",margin:"-1px",marginTop:"14px",border:"1px solid var(--cs-border)",lineHeight:"1"},children:_.jsx(A_,{text:`${e} detected to have Deny List feature. It's an optional feature on Sui designed for regulated coins (learn more). However, it could be misused by HoneyPot scams, which may restrict users from selling the tokens after buying. Please be cautious.`,keywords:["learn more"],onKeywordClick:t=>{window.open("https://docs.sui.io/guides/developer/coin/regulated","_blank")}})})]})}function aK({onClick:e}){return _.jsxs("div",{className:"cs-icon-button cs-back-button",onClick:t=>{t.stopPropagation(),e()},children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-back"})}),_.jsx("span",{children:"Back"})]})}function cg({title:e,backClick:t}){return _.jsxs("div",{className:"cs-have-back-header",children:[_.jsx(aK,{onClick:t}),_.jsx("span",{className:"title",children:e})]})}const pd=globalThis||void 0||self;var cK=typeof pd=="object"&&pd&&pd.Object===Object&&pd;const u7=cK;var uK=typeof self=="object"&&self&&self.Object===Object&&self,lK=u7||uK||Function("return this")();const qi=lK;var fK=qi.Symbol;const Wi=fK;var l7=Object.prototype,dK=l7.hasOwnProperty,hK=l7.toString,Au=Wi?Wi.toStringTag:void 0;function pK(e){var t=dK.call(e,Au),r=e[Au];try{e[Au]=void 0;var n=!0}catch{}var i=hK.call(e);return n&&(t?e[Au]=r:delete e[Au]),i}var mK=Object.prototype,gK=mK.toString;function yK(e){return gK.call(e)}var vK="[object Null]",bK="[object Undefined]",f7=Wi?Wi.toStringTag:void 0;function nc(e){return e==null?e===void 0?bK:vK:f7&&f7 in Object(e)?pK(e):yK(e)}function ho(e){return e!=null&&typeof e=="object"}var wK="[object Symbol]";function Iu(e){return typeof e=="symbol"||ho(e)&&nc(e)==wK}function md(e,t){for(var r=-1,n=e==null?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}var _K=Array.isArray;const mn=_K;var xK=1/0,d7=Wi?Wi.prototype:void 0,h7=d7?d7.toString:void 0;function p7(e){if(typeof e=="string")return e;if(mn(e))return md(e,p7)+"";if(Iu(e))return h7?h7.call(e):"";var t=e+"";return t=="0"&&1/e==-xK?"-0":t}function ic(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function m7(e){return e}var SK="[object AsyncFunction]",EK="[object Function]",TK="[object GeneratorFunction]",CK="[object Proxy]";function g7(e){if(!ic(e))return!1;var t=nc(e);return t==EK||t==TK||t==SK||t==CK}var AK=qi["__core-js_shared__"];const ug=AK;var y7=function(){var e=/[^.]+$/.exec(ug&&ug.keys&&ug.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function IK(e){return!!y7&&y7 in e}var MK=Function.prototype,OK=MK.toString;function ea(e){if(e!=null){try{return OK.call(e)}catch{}try{return e+""}catch{}}return""}var jK=/[\\^$.*+?()[\]{}|]/g,kK=/^\[object .+?Constructor\]$/,PK=Function.prototype,RK=Object.prototype,NK=PK.toString,DK=RK.hasOwnProperty,$K=RegExp("^"+NK.call(DK).replace(jK,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function LK(e){if(!ic(e)||IK(e))return!1;var t=g7(e)?$K:kK;return t.test(ea(e))}function BK(e,t){return e==null?void 0:e[t]}function ta(e,t){var r=BK(e,t);return LK(r)?r:void 0}var UK=ta(qi,"WeakMap");const lg=UK;var v7=Object.create,FK=function(){function e(){}return function(t){if(!ic(t))return{};if(v7)return v7(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();const VK=FK;function zK(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var qK=function(){try{var e=ta(Object,"defineProperty");return e({},"",{}),e}catch{}}();const b7=qK;function WK(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}var GK=9007199254740991,HK=/^(?:0|[1-9]\d*)$/;function w7(e,t){var r=typeof e;return t=t??GK,!!t&&(r=="number"||r!="symbol"&&HK.test(e))&&e>-1&&e%1==0&&e<t}function _7(e,t,r){t=="__proto__"&&b7?b7(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function fg(e,t){return e===t||e!==e&&t!==t}var KK=Object.prototype,YK=KK.hasOwnProperty;function x7(e,t,r){var n=e[t];(!(YK.call(e,t)&&fg(n,r))||r===void 0&&!(t in e))&&_7(e,t,r)}function gd(e,t,r,n){var i=!r;r||(r={});for(var s=-1,o=t.length;++s<o;){var a=t[s],c=n?n(r[a],e[a],a,r,e):void 0;c===void 0&&(c=e[a]),i?_7(r,a,c):x7(r,a,c)}return r}var XK=9007199254740991;function dg(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=XK}function yd(e){return e!=null&&dg(e.length)&&!g7(e)}var JK=Object.prototype;function hg(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||JK;return e===r}function ZK(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var QK="[object Arguments]";function S7(e){return ho(e)&&nc(e)==QK}var E7=Object.prototype,eY=E7.hasOwnProperty,tY=E7.propertyIsEnumerable,rY=S7(function(){return arguments}())?S7:function(e){return ho(e)&&eY.call(e,"callee")&&!tY.call(e,"callee")};const T7=rY;function nY(){return!1}var C7=typeof Kt=="object"&&Kt&&!Kt.nodeType&&Kt,A7=C7&&typeof module=="object"&&module&&!module.nodeType&&module,iY=A7&&A7.exports===C7,I7=iY?qi.Buffer:void 0,sY=I7?I7.isBuffer:void 0,oY=sY||nY;const vd=oY;var aY="[object Arguments]",cY="[object Array]",uY="[object Boolean]",lY="[object Date]",fY="[object Error]",dY="[object Function]",hY="[object Map]",pY="[object Number]",mY="[object Object]",gY="[object RegExp]",yY="[object Set]",vY="[object String]",bY="[object WeakMap]",wY="[object ArrayBuffer]",_Y="[object DataView]",xY="[object Float32Array]",SY="[object Float64Array]",EY="[object Int8Array]",TY="[object Int16Array]",CY="[object Int32Array]",AY="[object Uint8Array]",IY="[object Uint8ClampedArray]",MY="[object Uint16Array]",OY="[object Uint32Array]",rr={};rr[xY]=rr[SY]=rr[EY]=rr[TY]=rr[CY]=rr[AY]=rr[IY]=rr[MY]=rr[OY]=!0,rr[aY]=rr[cY]=rr[wY]=rr[uY]=rr[_Y]=rr[lY]=rr[fY]=rr[dY]=rr[hY]=rr[pY]=rr[mY]=rr[gY]=rr[yY]=rr[vY]=rr[bY]=!1;function jY(e){return ho(e)&&dg(e.length)&&!!rr[nc(e)]}function bd(e){return function(t){return e(t)}}var M7=typeof Kt=="object"&&Kt&&!Kt.nodeType&&Kt,Mu=M7&&typeof module=="object"&&module&&!module.nodeType&&module,kY=Mu&&Mu.exports===M7,pg=kY&&u7.process,PY=function(){try{var e=Mu&&Mu.require&&Mu.require("util").types;return e||pg&&pg.binding&&pg.binding("util")}catch{}}();const sc=PY;var O7=sc&&sc.isTypedArray,RY=O7?bd(O7):jY;const j7=RY;var NY=Object.prototype,DY=NY.hasOwnProperty;function k7(e,t){var r=mn(e),n=!r&&T7(e),i=!r&&!n&&vd(e),s=!r&&!n&&!i&&j7(e),o=r||n||i||s,a=o?ZK(e.length,String):[],c=a.length;for(var u in e)(t||DY.call(e,u))&&!(o&&(u=="length"||i&&(u=="offset"||u=="parent")||s&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||w7(u,c)))&&a.push(u);return a}function P7(e,t){return function(r){return e(t(r))}}var $Y=P7(Object.keys,Object);const LY=$Y;var BY=Object.prototype,UY=BY.hasOwnProperty;function FY(e){if(!hg(e))return LY(e);var t=[];for(var r in Object(e))UY.call(e,r)&&r!="constructor"&&t.push(r);return t}function Ou(e){return yd(e)?k7(e):FY(e)}function VY(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var zY=Object.prototype,qY=zY.hasOwnProperty;function WY(e){if(!ic(e))return VY(e);var t=hg(e),r=[];for(var n in e)n=="constructor"&&(t||!qY.call(e,n))||r.push(n);return r}function mg(e){return yd(e)?k7(e,!0):WY(e)}var GY=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,HY=/^\w*$/;function gg(e,t){if(mn(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||Iu(e)?!0:HY.test(e)||!GY.test(e)||t!=null&&e in Object(t)}var KY=ta(Object,"create");const ju=KY;function YY(){this.__data__=ju?ju(null):{},this.size=0}function XY(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var JY="__lodash_hash_undefined__",ZY=Object.prototype,QY=ZY.hasOwnProperty;function eX(e){var t=this.__data__;if(ju){var r=t[e];return r===JY?void 0:r}return QY.call(t,e)?t[e]:void 0}var tX=Object.prototype,rX=tX.hasOwnProperty;function nX(e){var t=this.__data__;return ju?t[e]!==void 0:rX.call(t,e)}var iX="__lodash_hash_undefined__";function sX(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=ju&&t===void 0?iX:t,this}function ra(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}ra.prototype.clear=YY,ra.prototype.delete=XY,ra.prototype.get=eX,ra.prototype.has=nX,ra.prototype.set=sX;function oX(){this.__data__=[],this.size=0}function wd(e,t){for(var r=e.length;r--;)if(fg(e[r][0],t))return r;return-1}var aX=Array.prototype,cX=aX.splice;function uX(e){var t=this.__data__,r=wd(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():cX.call(t,r,1),--this.size,!0}function lX(e){var t=this.__data__,r=wd(t,e);return r<0?void 0:t[r][1]}function fX(e){return wd(this.__data__,e)>-1}function dX(e,t){var r=this.__data__,n=wd(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function Cs(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}Cs.prototype.clear=oX,Cs.prototype.delete=uX,Cs.prototype.get=lX,Cs.prototype.has=fX,Cs.prototype.set=dX;var hX=ta(qi,"Map");const ku=hX;function pX(){this.size=0,this.__data__={hash:new ra,map:new(ku||Cs),string:new ra}}function mX(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function _d(e,t){var r=e.__data__;return mX(t)?r[typeof t=="string"?"string":"hash"]:r.map}function gX(e){var t=_d(this,e).delete(e);return this.size-=t?1:0,t}function yX(e){return _d(this,e).get(e)}function vX(e){return _d(this,e).has(e)}function bX(e,t){var r=_d(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function As(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}As.prototype.clear=pX,As.prototype.delete=gX,As.prototype.get=yX,As.prototype.has=vX,As.prototype.set=bX;var wX="Expected a function";function yg(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(wX);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var o=e.apply(this,n);return r.cache=s.set(i,o)||s,o};return r.cache=new(yg.Cache||As),r}yg.Cache=As;var _X=500;function xX(e){var t=yg(e,function(n){return r.size===_X&&r.clear(),n}),r=t.cache;return t}var SX=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,EX=/\\(\\)?/g,TX=xX(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(SX,function(r,n,i,s){t.push(i?s.replace(EX,"$1"):n||r)}),t});const CX=TX;function AX(e){return e==null?"":p7(e)}function R7(e,t){return mn(e)?e:gg(e,t)?[e]:CX(AX(e))}var IX=1/0;function xd(e){if(typeof e=="string"||Iu(e))return e;var t=e+"";return t=="0"&&1/e==-IX?"-0":t}function vg(e,t){t=R7(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[xd(t[r++])];return r&&r==n?e:void 0}function MX(e,t,r){var n=e==null?void 0:vg(e,t);return n===void 0?r:n}function N7(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var OX=P7(Object.getPrototypeOf,Object);const D7=OX;function jX(){this.__data__=new Cs,this.size=0}function kX(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function PX(e){return this.__data__.get(e)}function RX(e){return this.__data__.has(e)}var NX=200;function DX(e,t){var r=this.__data__;if(r instanceof Cs){var n=r.__data__;if(!ku||n.length<NX-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new As(n)}return r.set(e,t),this.size=r.size,this}function Gi(e){var t=this.__data__=new Cs(e);this.size=t.size}Gi.prototype.clear=jX,Gi.prototype.delete=kX,Gi.prototype.get=PX,Gi.prototype.has=RX,Gi.prototype.set=DX;function $X(e,t){return e&&gd(t,Ou(t),e)}function LX(e,t){return e&&gd(t,mg(t),e)}var $7=typeof Kt=="object"&&Kt&&!Kt.nodeType&&Kt,L7=$7&&typeof module=="object"&&module&&!module.nodeType&&module,BX=L7&&L7.exports===$7,B7=BX?qi.Buffer:void 0,U7=B7?B7.allocUnsafe:void 0;function UX(e,t){if(t)return e.slice();var r=e.length,n=U7?U7(r):new e.constructor(r);return e.copy(n),n}function F7(e,t){for(var r=-1,n=e==null?0:e.length,i=0,s=[];++r<n;){var o=e[r];t(o,r,e)&&(s[i++]=o)}return s}function V7(){return[]}var FX=Object.prototype,VX=FX.propertyIsEnumerable,z7=Object.getOwnPropertySymbols,zX=z7?function(e){return e==null?[]:(e=Object(e),F7(z7(e),function(t){return VX.call(e,t)}))}:V7;const bg=zX;function qX(e,t){return gd(e,bg(e),t)}var WX=Object.getOwnPropertySymbols,GX=WX?function(e){for(var t=[];e;)N7(t,bg(e)),e=D7(e);return t}:V7;const q7=GX;function HX(e,t){return gd(e,q7(e),t)}function W7(e,t,r){var n=t(e);return mn(e)?n:N7(n,r(e))}function wg(e){return W7(e,Ou,bg)}function KX(e){return W7(e,mg,q7)}var YX=ta(qi,"DataView");const _g=YX;var XX=ta(qi,"Promise");const xg=XX;var JX=ta(qi,"Set");const Sg=JX;var G7="[object Map]",ZX="[object Object]",H7="[object Promise]",K7="[object Set]",Y7="[object WeakMap]",X7="[object DataView]",QX=ea(_g),eJ=ea(ku),tJ=ea(xg),rJ=ea(Sg),nJ=ea(lg),na=nc;(_g&&na(new _g(new ArrayBuffer(1)))!=X7||ku&&na(new ku)!=G7||xg&&na(xg.resolve())!=H7||Sg&&na(new Sg)!=K7||lg&&na(new lg)!=Y7)&&(na=function(e){var t=nc(e),r=t==ZX?e.constructor:void 0,n=r?ea(r):"";if(n)switch(n){case QX:return X7;case eJ:return G7;case tJ:return H7;case rJ:return K7;case nJ:return Y7}return t});const Pu=na;var iJ=Object.prototype,sJ=iJ.hasOwnProperty;function oJ(e){var t=e.length,r=new e.constructor(t);return t&&typeof e[0]=="string"&&sJ.call(e,"index")&&(r.index=e.index,r.input=e.input),r}var aJ=qi.Uint8Array;const Sd=aJ;function Eg(e){var t=new e.constructor(e.byteLength);return new Sd(t).set(new Sd(e)),t}function cJ(e,t){var r=t?Eg(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}var uJ=/\w*$/;function lJ(e){var t=new e.constructor(e.source,uJ.exec(e));return t.lastIndex=e.lastIndex,t}var J7=Wi?Wi.prototype:void 0,Z7=J7?J7.valueOf:void 0;function fJ(e){return Z7?Object(Z7.call(e)):{}}function dJ(e,t){var r=t?Eg(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var hJ="[object Boolean]",pJ="[object Date]",mJ="[object Map]",gJ="[object Number]",yJ="[object RegExp]",vJ="[object Set]",bJ="[object String]",wJ="[object Symbol]",_J="[object ArrayBuffer]",xJ="[object DataView]",SJ="[object Float32Array]",EJ="[object Float64Array]",TJ="[object Int8Array]",CJ="[object Int16Array]",AJ="[object Int32Array]",IJ="[object Uint8Array]",MJ="[object Uint8ClampedArray]",OJ="[object Uint16Array]",jJ="[object Uint32Array]";function kJ(e,t,r){var n=e.constructor;switch(t){case _J:return Eg(e);case hJ:case pJ:return new n(+e);case xJ:return cJ(e,r);case SJ:case EJ:case TJ:case CJ:case AJ:case IJ:case MJ:case OJ:case jJ:return dJ(e,r);case mJ:return new n;case gJ:case bJ:return new n(e);case yJ:return lJ(e);case vJ:return new n;case wJ:return fJ(e)}}function PJ(e){return typeof e.constructor=="function"&&!hg(e)?VK(D7(e)):{}}var RJ="[object Map]";function NJ(e){return ho(e)&&Pu(e)==RJ}var Q7=sc&&sc.isMap,DJ=Q7?bd(Q7):NJ;const $J=DJ;var LJ="[object Set]";function BJ(e){return ho(e)&&Pu(e)==LJ}var eE=sc&&sc.isSet,UJ=eE?bd(eE):BJ;const FJ=UJ;var VJ=1,zJ=2,qJ=4,tE="[object Arguments]",WJ="[object Array]",GJ="[object Boolean]",HJ="[object Date]",KJ="[object Error]",rE="[object Function]",YJ="[object GeneratorFunction]",XJ="[object Map]",JJ="[object Number]",nE="[object Object]",ZJ="[object RegExp]",QJ="[object Set]",eZ="[object String]",tZ="[object Symbol]",rZ="[object WeakMap]",nZ="[object ArrayBuffer]",iZ="[object DataView]",sZ="[object Float32Array]",oZ="[object Float64Array]",aZ="[object Int8Array]",cZ="[object Int16Array]",uZ="[object Int32Array]",lZ="[object Uint8Array]",fZ="[object Uint8ClampedArray]",dZ="[object Uint16Array]",hZ="[object Uint32Array]",Qt={};Qt[tE]=Qt[WJ]=Qt[nZ]=Qt[iZ]=Qt[GJ]=Qt[HJ]=Qt[sZ]=Qt[oZ]=Qt[aZ]=Qt[cZ]=Qt[uZ]=Qt[XJ]=Qt[JJ]=Qt[nE]=Qt[ZJ]=Qt[QJ]=Qt[eZ]=Qt[tZ]=Qt[lZ]=Qt[fZ]=Qt[dZ]=Qt[hZ]=!0,Qt[KJ]=Qt[rE]=Qt[rZ]=!1;function Ed(e,t,r,n,i,s){var o,a=t&VJ,c=t&zJ,u=t&qJ;if(r&&(o=i?r(e,n,i,s):r(e)),o!==void 0)return o;if(!ic(e))return e;var l=mn(e);if(l){if(o=oJ(e),!a)return zK(e,o)}else{var f=Pu(e),p=f==rE||f==YJ;if(vd(e))return UX(e,a);if(f==nE||f==tE||p&&!i){if(o=c||p?{}:PJ(e),!a)return c?HX(e,LX(o,e)):qX(e,$X(o,e))}else{if(!Qt[f])return i?e:{};o=kJ(e,f,a)}}s||(s=new Gi);var v=s.get(e);if(v)return v;s.set(e,o),FJ(e)?e.forEach(function(S){o.add(Ed(S,t,r,S,e,s))}):$J(e)&&e.forEach(function(S,A){o.set(A,Ed(S,t,r,A,e,s))});var w=u?c?KX:wg:c?mg:Ou,y=l?void 0:w(e);return WK(y||e,function(S,A){y&&(A=S,S=e[A]),x7(o,A,Ed(S,t,r,A,e,s))}),o}var pZ=1,mZ=4;function gZ(e){return Ed(e,pZ|mZ)}var yZ="__lodash_hash_undefined__";function vZ(e){return this.__data__.set(e,yZ),this}function bZ(e){return this.__data__.has(e)}function Td(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new As;++t<r;)this.add(e[t])}Td.prototype.add=Td.prototype.push=vZ,Td.prototype.has=bZ;function wZ(e,t){for(var r=-1,n=e==null?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}function _Z(e,t){return e.has(t)}var xZ=1,SZ=2;function iE(e,t,r,n,i,s){var o=r&xZ,a=e.length,c=t.length;if(a!=c&&!(o&&c>a))return!1;var u=s.get(e),l=s.get(t);if(u&&l)return u==t&&l==e;var f=-1,p=!0,v=r&SZ?new Td:void 0;for(s.set(e,t),s.set(t,e);++f<a;){var w=e[f],y=t[f];if(n)var S=o?n(y,w,f,t,e,s):n(w,y,f,e,t,s);if(S!==void 0){if(S)continue;p=!1;break}if(v){if(!wZ(t,function(A,O){if(!_Z(v,O)&&(w===A||i(w,A,r,n,s)))return v.push(O)})){p=!1;break}}else if(!(w===y||i(w,y,r,n,s))){p=!1;break}}return s.delete(e),s.delete(t),p}function EZ(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}function TZ(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var CZ=1,AZ=2,IZ="[object Boolean]",MZ="[object Date]",OZ="[object Error]",jZ="[object Map]",kZ="[object Number]",PZ="[object RegExp]",RZ="[object Set]",NZ="[object String]",DZ="[object Symbol]",$Z="[object ArrayBuffer]",LZ="[object DataView]",sE=Wi?Wi.prototype:void 0,Tg=sE?sE.valueOf:void 0;function BZ(e,t,r,n,i,s,o){switch(r){case LZ:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case $Z:return!(e.byteLength!=t.byteLength||!s(new Sd(e),new Sd(t)));case IZ:case MZ:case kZ:return fg(+e,+t);case OZ:return e.name==t.name&&e.message==t.message;case PZ:case NZ:return e==t+"";case jZ:var a=EZ;case RZ:var c=n&CZ;if(a||(a=TZ),e.size!=t.size&&!c)return!1;var u=o.get(e);if(u)return u==t;n|=AZ,o.set(e,t);var l=iE(a(e),a(t),n,i,s,o);return o.delete(e),l;case DZ:if(Tg)return Tg.call(e)==Tg.call(t)}return!1}var UZ=1,FZ=Object.prototype,VZ=FZ.hasOwnProperty;function zZ(e,t,r,n,i,s){var o=r&UZ,a=wg(e),c=a.length,u=wg(t),l=u.length;if(c!=l&&!o)return!1;for(var f=c;f--;){var p=a[f];if(!(o?p in t:VZ.call(t,p)))return!1}var v=s.get(e),w=s.get(t);if(v&&w)return v==t&&w==e;var y=!0;s.set(e,t),s.set(t,e);for(var S=o;++f<c;){p=a[f];var A=e[p],O=t[p];if(n)var j=o?n(O,A,p,t,e,s):n(A,O,p,e,t,s);if(!(j===void 0?A===O||i(A,O,r,n,s):j)){y=!1;break}S||(S=p=="constructor")}if(y&&!S){var V=e.constructor,B=t.constructor;V!=B&&"constructor"in e&&"constructor"in t&&!(typeof V=="function"&&V instanceof V&&typeof B=="function"&&B instanceof B)&&(y=!1)}return s.delete(e),s.delete(t),y}var qZ=1,oE="[object Arguments]",aE="[object Array]",Cd="[object Object]",WZ=Object.prototype,cE=WZ.hasOwnProperty;function GZ(e,t,r,n,i,s){var o=mn(e),a=mn(t),c=o?aE:Pu(e),u=a?aE:Pu(t);c=c==oE?Cd:c,u=u==oE?Cd:u;var l=c==Cd,f=u==Cd,p=c==u;if(p&&vd(e)){if(!vd(t))return!1;o=!0,l=!1}if(p&&!l)return s||(s=new Gi),o||j7(e)?iE(e,t,r,n,i,s):BZ(e,t,c,r,n,i,s);if(!(r&qZ)){var v=l&&cE.call(e,"__wrapped__"),w=f&&cE.call(t,"__wrapped__");if(v||w){var y=v?e.value():e,S=w?t.value():t;return s||(s=new Gi),i(y,S,r,n,s)}}return p?(s||(s=new Gi),zZ(e,t,r,n,i,s)):!1}function Ad(e,t,r,n,i){return e===t?!0:e==null||t==null||!ho(e)&&!ho(t)?e!==e&&t!==t:GZ(e,t,r,n,Ad,i)}var HZ=1,KZ=2;function YZ(e,t,r,n){var i=r.length,s=i,o=!n;if(e==null)return!s;for(e=Object(e);i--;){var a=r[i];if(o&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++i<s;){a=r[i];var c=a[0],u=e[c],l=a[1];if(o&&a[2]){if(u===void 0&&!(c in e))return!1}else{var f=new Gi;if(n)var p=n(u,l,c,e,t,f);if(!(p===void 0?Ad(l,u,HZ|KZ,n,f):p))return!1}}return!0}function uE(e){return e===e&&!ic(e)}function XZ(e){for(var t=Ou(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,uE(i)]}return t}function lE(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}function JZ(e){var t=XZ(e);return t.length==1&&t[0][2]?lE(t[0][0],t[0][1]):function(r){return r===e||YZ(r,e,t)}}function ZZ(e,t){return e!=null&&t in Object(e)}function QZ(e,t,r){t=R7(t,e);for(var n=-1,i=t.length,s=!1;++n<i;){var o=xd(t[n]);if(!(s=e!=null&&r(e,o)))break;e=e[o]}return s||++n!=i?s:(i=e==null?0:e.length,!!i&&dg(i)&&w7(o,i)&&(mn(e)||T7(e)))}function eQ(e,t){return e!=null&&QZ(e,t,ZZ)}var tQ=1,rQ=2;function nQ(e,t){return gg(e)&&uE(t)?lE(xd(e),t):function(r){var n=MX(r,e);return n===void 0&&n===t?eQ(r,e):Ad(t,n,tQ|rQ)}}function iQ(e){return function(t){return t==null?void 0:t[e]}}function sQ(e){return function(t){return vg(t,e)}}function oQ(e){return gg(e)?iQ(xd(e)):sQ(e)}function fE(e){return typeof e=="function"?e:e==null?m7:typeof e=="object"?mn(e)?nQ(e[0],e[1]):JZ(e):oQ(e)}function aQ(e){return function(t,r,n){for(var i=-1,s=Object(t),o=n(t),a=o.length;a--;){var c=o[e?a:++i];if(r(s[c],c,s)===!1)break}return t}}var cQ=aQ();const uQ=cQ;function lQ(e,t){return e&&uQ(e,t,Ou)}function fQ(e,t){return function(r,n){if(r==null)return r;if(!yd(r))return e(r,n);for(var i=r.length,s=t?i:-1,o=Object(r);(t?s--:++s<i)&&n(o[s],s,o)!==!1;);return r}}var dQ=fQ(lQ);const dE=dQ;function hQ(e,t){var r=[];return dE(e,function(n,i,s){t(n,i,s)&&r.push(n)}),r}function pQ(e,t){var r=mn(e)?F7:hQ;return r(e,fE(t))}function mQ(e,t){var r=-1,n=yd(e)?Array(e.length):[];return dE(e,function(i,s,o){n[++r]=t(i,s,o)}),n}function gQ(e,t){return Ad(e,t)}function yQ(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}function vQ(e,t){if(e!==t){var r=e!==void 0,n=e===null,i=e===e,s=Iu(e),o=t!==void 0,a=t===null,c=t===t,u=Iu(t);if(!a&&!u&&!s&&e>t||s&&o&&c&&!a&&!u||n&&o&&c||!r&&c||!i)return 1;if(!n&&!s&&!u&&e<t||u&&r&&i&&!n&&!s||a&&r&&i||!o&&i||!c)return-1}return 0}function bQ(e,t,r){for(var n=-1,i=e.criteria,s=t.criteria,o=i.length,a=r.length;++n<o;){var c=vQ(i[n],s[n]);if(c){if(n>=a)return c;var u=r[n];return c*(u=="desc"?-1:1)}}return e.index-t.index}function wQ(e,t,r){t.length?t=md(t,function(s){return mn(s)?function(o){return vg(o,s.length===1?s[0]:s)}:s}):t=[m7];var n=-1;t=md(t,bd(fE));var i=mQ(e,function(s,o,a){var c=md(t,function(u){return u(s)});return{criteria:c,index:++n,value:s}});return yQ(i,function(s,o){return bQ(s,o,r)})}function _Q(e,t,r,n){return e==null?[]:(mn(t)||(t=t==null?[]:[t]),r=n?void 0:r,mn(r)||(r=r==null?[]:[r]),wQ(e,t,r))}function xQ({toBack:e,onSubmitClick:t,data:r}){const{fromCoin:n,toCoin:i}=tn(),s=he.useRef(!1),{slippage:o}=en(),[a,c]=he.useState(r),{fromAmountUi:u,toAmountUi:l,byAmountIn:f}=a,{amountLimit:p}=Z5(o,a),{showPriceImpactTips:v,showPriceImpactWarn:w}=o7(n,i,u,l),{priceAcceptRouterData:y}=wH(a),[S,A]=he.useState(!1),[O,j]=he.useState(!1);he.useMemo(()=>f?i:n,[f]);const V=he.useMemo(()=>y!==void 0,[y]),B=()=>{if(y){if(s.current)return;s.current=!0;const q=gZ(y);c(q),setTimeout(()=>{s.current=!1},300)}},H=he.useMemo(()=>S?!1:!!w,[S,w]);return _.jsxs("div",{className:"secondary-dialog",children:[_.jsx(cg,{title:"Review your order",backClick:e}),_.jsxs("div",{className:"secondary-content",children:[_.jsxs("div",{className:"trade-info",children:[_.jsxs("div",{className:"amount-info",children:[_.jsx("span",{className:"amount",children:so(u||"")}),_.jsx(Pr,{src:n==null?void 0:n.logo_url,token:n,style:{width:"28px",height:"28px"}}),_.jsx("span",{className:"symbol",children:Ur((n==null?void 0:n.symbol)||"")})]}),_.jsx("div",{className:"dividing-line",children:_.jsx("div",{className:"swap-icon",children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-trade"})})})}),_.jsxs("div",{className:"amount-info",children:[_.jsx("span",{className:"amount",children:so(l||"")}),_.jsx(Pr,{src:i==null?void 0:i.logo_url,token:i,style:{width:"28px",height:"28px"}}),_.jsx("span",{className:"symbol",children:Ur((i==null?void 0:i.symbol)||"")})]})]}),_.jsxs("div",{className:"current-price-tips-box yellow",style:{fontSize:"12px",marginTop:"8px",flexDirection:"column",justifyContent:"start",gap:"10px"},children:[_.jsx("div",{className:"current-price-box",style:{backgroundColor:"var(--cs-bg-primary)",marginTop:"-1px"},children:_.jsx(ag,{baseToken:n,quoteToken:i,baseAmount:u||"0",quoteAmount:l||"0",loading:!1})}),v&&_.jsx("div",{style:{paddingLeft:"8px",paddingBottom:"10px",color:"var(--cs-warning)"},children:"High price difference. Be cautious before submitting your order."})]}),_.jsxs("div",{className:"swap-info-between",style:{marginTop:"16px"},children:[_.jsx("div",{className:"left",children:"Slippage Tolerance"}),_.jsxs("div",{className:"right",children:[o,"%"]})]}),_.jsx(c7,{pl:"0px",pr:"0px",isLoading:!1,amountLimit:p}),_.jsx(a7,{isLoading:!1,routerData:a,noTips:!0}),w&&_.jsxs("div",{style:{width:"100%",marginTop:"8px",gap:"1px"},children:[_.jsx("div",{style:{width:"100%",gap:"8px",fontSize:"12px",backgroundColor:"var(--cs-error-10)",paddingLeft:"16px",paddingRight:"16px",paddingTop:"8px",paddingBottom:"8px",borderRadius:"12px",color:"var(--cs-error)"},children:"The exchange rate of this order deviates from the market price by a large percentage. Are you sure you want to continue the swap?"}),_.jsxs("div",{style:{width:"100%",gap:"16px",display:"flex",flexDirection:"row",marginTop:"-10px"},children:[_.jsx("button",{className:S?"swap-btn cs-outline-btn secondary-btn ignorePriceImpact-btn":"swap-btn cs-outline-btn secondary-btn",style:{fontSize:"14px",height:"42px",flex:1,color:S?"var(--cs-primary)":"var(--cs-btn-disabled-text)"},onClick:()=>{A(!0)},children:"Yes, please continue."}),_.jsx("button",{className:"swap-btn cs-outline-btn secondary-btn",style:{fontSize:"14px",height:"42px",color:"var(--cs-btn-disabled-text)",flex:1},onClick:()=>e(),children:"No,cancel it."})]})]})]}),!V&&_.jsx("button",{disabled:H||O,className:"swap-btn cs-solid-btn",style:{marginTop:"16px"},onClick:()=>{O||(j(!0),t(a))},children:O?_.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:_.jsx(nm,{})}):"Confirm Swap"}),V&&_.jsxs("div",{className:"price-update",children:[_.jsxs("div",{className:"left",children:[_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-alert"})}),_.jsx("span",{children:"Price update"})]}),_.jsx("div",{className:"right",children:_.jsx("button",{className:"cs-solid-btn",onClick:B,children:"Accept"})})]})]})}function hE({allProviders:e}){const{isApp:t}=rc();return _.jsx(_.Fragment,{children:e==null?void 0:e.map(r=>{var n;return t?_.jsx(Pr,{src:Lt==null?void 0:Lt[r],style:{width:"16px",height:"16px"},haveBorder:!1},r):_.jsx(Jo,{content:_.jsx("div",{style:{color:"var(--cs-text-primary)"},children:((n=tm[r])==null?void 0:n.name)||r}),position:"top",delay:300,children:_.jsx(Pr,{src:Lt==null?void 0:Lt[r],style:{width:"16px",height:"16px"},haveBorder:!1})},r)})})}function Id(e){const{text:t,type:r,classType:n=""}=e,[i,s]=he.useState(!1),{addCommonToast:o}=Fa(),a=c=>{i||(_f(c),W5(t,{debug:!1,message:"message"}),o("Copied"),s(!i))};return he.useEffect(()=>{i&&setTimeout(()=>{s(!1)},2e3)},[i]),_.jsx(_.Fragment,{children:r==="btn"?_.jsxs("div",{className:n?`${n} copy-btn`:"copy-btn",onClick:a,children:[_.jsx("svg",{className:"cs-icon cs-copy-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:i?"#icon-sel":"#icon-icon_copy"})}),_.jsx("span",{children:"Copy"})]}):_.jsx("svg",{className:"cs-icon cs-copy-icon","aria-hidden":"true",onClick:a,children:_.jsx("use",{xlinkHref:i?"#icon-sel":"#icon-icon_copy"})})})}const oc=2;function SQ({data:e,config:t={},originFromCoinType:r,originToCoinType:n,isWidget:i}){const{nodes:s,edges:o,tokenMap:a,panelHeight:c,resultColumes:u}=s7(e,r,n),l=he.useRef(null),f={nodeWidth:176,searchStep:5,nodePadding:10,maxSearchDistance:50,arrowOffset:5,...t},p=he.useMemo(()=>s==null?void 0:s.map(v=>{var A;const w=v.originalTarget||v.target,y=a==null?void 0:a.get(w),S=Object.keys(v==null?void 0:v.list);return{...v,targetSymbol:y==null?void 0:y.symbol,targetImg:y==null?void 0:y.logo_url,targetIsTrusted:y==null?void 0:y.is_trusted,fromGroups:(A=Object.values(v==null?void 0:v.list))==null?void 0:A.map((O,j)=>{const V=a==null?void 0:a.get(S[j]),B=`${Ur((V==null?void 0:V.symbol)||"",8)} > ${Ur((y==null?void 0:y.symbol)||"",8)}`,H=O.reduce((se,fe)=>se+parseFloat(fe.amountOut||"0"),0),q=[];O.forEach(se=>{const fe=parseFloat(se.amountOut||"0"),z=H>0?wf(Fe(fe).div(H).mul(100).toString(),0):"0";q.push(Number(z)||1)});const ne=Sf(q);return{list:O.map((se,fe)=>{var h;const z=((h=ne[fe])==null?void 0:h.toString())||"0",N=a==null?void 0:a.get(se==null?void 0:se.from);return{...se,percent:z,fromLogo:N==null?void 0:N.logo_url,targetLogo:y==null?void 0:y.logo_url,fromSymbol:N==null?void 0:N.symbol,targetSymbol:y==null?void 0:y.symbol,fromIsTrusted:N==null?void 0:N.is_trusted,toIsTrusted:y==null?void 0:y.is_trusted,displayFee:ZU(JU(se==null?void 0:se.feeRate,4))}}).sort((se,fe)=>Number(fe==null?void 0:fe.percent)-Number(se==null?void 0:se.percent)),title:B}})}}),[s,a,u]);return _.jsxs("div",{style:{position:"relative",width:"878px",height:`${c?`${c}px`:"531px"}`},ref:l,children:[_.jsx(CQ,{edges:o,nodes:s,config:f}),_.jsx(AQ,{data:p,isWidget:i})]})}function EQ(e,t,r,n,i,s,o,a){const c=i+o,u=s+a,l=Math.min(e,r),f=Math.max(e,r),p=Math.min(t,n),v=Math.max(t,n);if(f<i||l>c||v<s||p>u)return!1;if(l>=i&&f<=c&&p>=s&&v<=u)return!0;if(Math.abs(t-n)<.001)return t>=s&&t<=u&&f>=i&&l<=c;if(Math.abs(e-r)<.001)return e>=i&&e<=c&&v>=s&&p<=u;const w=[{x1:i,y1:s,x2:c,y2:s},{x1:i,y1:u,x2:c,y2:u},{x1:i,y1:s,x2:i,y2:u},{x1:c,y1:s,x2:c,y2:u}];for(const y of w)if(TQ(e,t,r,n,y.x1,y.y1,y.x2,y.y2))return!0;return!1}function TQ(e,t,r,n,i,s,o,a){const c=(e-r)*(s-a)-(t-n)*(i-o);if(Math.abs(c)<.001)return!1;const u=((e-i)*(s-a)-(t-s)*(i-o))/c,l=-((e-r)*(t-s)-(t-n)*(e-i))/c;return u>=0&&u<=1&&l>=0&&l<=1}function Md(e,t,r,n,i,s=176,o,a,c=[],u=[],l={}){const f=l.searchStep||5,p=l.nodePadding||10;l.maxSearchDistance;const v=l.arrowOffset||5,w=(z,N,h,d)=>{for(const m of c)if(!(a.from===m.id||a.to===m.id)&&EQ(z,N,h,d,m.left,m.top,m.width,m.height))return!0;return!1},y=z=>{if(w(e,z,r-v,z))return!1;const N=S.top,h=S.top+S.height,d=A.top,m=A.top+A.height,x=Math.max(N,d),E=Math.min(h,m);return x<E?z>=x+p&&z<=E-p:!1},S=c.find(z=>z.id===a.from),A=c.find(z=>z.id===a.to);if(!S||!A)return`M${e},${t} L${r},${t==n?n:t}`;if(o){const z=A.top+A.height/2;return y(z)?`M${e},${t} L${r-v},${z}`:`M${e},${t} L${r-v},${t}`}const O=u.filter(z=>z.from===a.from);if(u.filter(z=>z.to===a.to),O.length===1){const z=S.top+S.height/2;if(y(z))return`M${e},${z} L${r-v},${z}`}const j=S.top,V=S.top+S.height,B=A.top,H=A.top+A.height,q=Math.max(j,B),ne=Math.min(V,H);if(q<ne){for(let z=q+p;z<=ne-p;z+=f)if(y(z))return`M${e},${z} L${r-v},${z}`}const ge=S.top+S.height/2,se=A.left+A.width/2,fe=A.top+A.height;if(V-10<B){const z=S.left+S.width/2,N=S.top+S.height,h=A.top+A.height/2;return!w(z,V,z,h)&&!w(z,h,r-v,h)?`M${z},${N} L${z},${V} L${z},${h} L${r-v},${h}`:`M${e},${N} L${se},${N} L${se},${fe}`}else if(j+10>=H)return`M${e},${ge} L${se},${ge} L${se},${fe}`;return`M${e},${ge} L${r},${ge}`}function CQ({edges:e,nodes:t,config:r}){var i,s,o,a;const n=he.useRef(null);return _.jsxs("svg",{ref:n,style:{position:"absolute",left:0,top:0,pointerEvents:"none",zIndex:1,width:"100%",height:"100%"},children:[_.jsxs("defs",{children:[_.jsxs("linearGradient",{id:"arrowGradient",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[_.jsx("stop",{offset:"0%",stopColor:"rgba(0, 255, 165, 1)"}),_.jsx("stop",{offset:"100%",stopColor:"rgba(0, 183, 255, 1)"})]}),_.jsx("marker",{id:"arrowhead",markerWidth:"5",markerHeight:"9",refX:"4",refY:"3.5",orient:"auto",children:_.jsx("path",{d:"M1 1 L4 3.5 L1 6",fill:"none",stroke:"url(#arrowGradient)",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round"})})]}),(()=>{const c=(e==null?void 0:e.filter(p=>p.isStart))||[],u=c.reduce((p,v)=>v.fromY>p.fromY?v:p,c[0]),l=(e==null?void 0:e.filter(p=>p.isFinal))||[],f=l.reduce((p,v)=>v.toY>p.toY?v:p,l[0]);if(u&&f){const S=`M 13 8 Q 13 ${u.fromY-10} ${u.fromX} ${u.fromY}`,A=`M 865 4 L 865 ${f.toY} L ${f.toX} ${f.toY}`;return _.jsxs("g",{children:[_.jsx("path",{d:S,stroke:"var(--cs-border)",strokeWidth:oc,fill:"none"}),_.jsx("path",{d:A,stroke:"var(--cs-border)",strokeWidth:oc,fill:"none"}),_.jsx("circle",{cx:13,cy:4,r:"4",fill:"#75C8FF"}),_.jsx("circle",{cx:865,cy:4,r:"4",fill:"#75C8FF"})]})}return null})(),(i=e==null?void 0:e.filter(c=>c.isCrossColumnConnection&&c.isStart))==null?void 0:i.map((c,u)=>{let l,f,p;if(c.segments&&c.segments.length>0){l=c.segments.map((H,q)=>q===0?`M${H.x1},${H.y1} L${H.x2},${H.y2}`:`L${H.x2},${H.y2}`).join(" ");const j=c.segments[0],V=j.x2-j.x1,B=j.y2-j.y1;Math.abs(V)>Math.abs(B)?(p=(j.y1+j.y2)/2,f=j.x1+30):B<0?(p=j.y1-16,f=(j.x1+j.x2)/2):(p=j.y1+30,f=(j.x1+j.x2)/2)}else{l=Md(c.fromX,c.fromY,c.toX,c.toY,c.toBlockHeight,r.nodeWidth,!!c.isStart,c,t,e,r);const j=l.split(" ");let V=c.fromX,B=c.fromY,H=!1;if(j.length>0&&j[0].startsWith("M")){const q=j[0].substring(1).split(",");q.length===2&&(V=parseFloat(q[0]),B=parseFloat(q[1]))}if(j.length>=3){const q=j[1],ne=j[2];if(q&&ne){const ge=q.substring(1).split(","),se=ne.substring(1).split(",");if(ge.length===2&&se.length===2){const fe=parseFloat(ge[1]),z=parseFloat(se[1]);fe<z&&(H=!0)}}}H?(c.fromPercent&&`${c.fromPercent}`,f=V,p=B+12):(f=V+30,p=B)}const v=c.fromPercent?`${c.fromPercent}%`:"",w=v.length*6,y=Math.max(42,w+10),S=16,A=f-y/2,O=p-S/2;return _.jsxs("g",{children:[_.jsx("path",{d:l,stroke:"var(--cs-border)",strokeWidth:oc,fill:"none",markerEnd:"url(#arrowhead)",strokeLinecap:"square",strokeLinejoin:"miter"}),_.jsx("rect",{x:A,y:O,width:y,height:S,rx:"4",ry:"4",fill:"var(--cs-router-percent-bg)"}),_.jsx("text",{x:f,y:O+S/2+.5,fontSize:"10",fill:"#00B7FF",textAnchor:"middle",dominantBaseline:"middle",pointerEvents:"auto",children:v})]},`cross-${u}`)}),(s=e==null?void 0:e.filter(c=>c.renderOnTop))==null?void 0:s.map((c,u)=>{let l,f,p;if(c.segments&&c.segments.length>0){l=c.segments.map((H,q)=>q===0?`M${H.x1},${H.y1} L${H.x2},${H.y2}`:`L${H.x2},${H.y2}`).join(" ");const j=c.segments[0],V=j.x2-j.x1,B=j.y2-j.y1;Math.abs(V)>Math.abs(B)?(p=(j.y1+j.y2)/2,f=j.x1+30):B<0?(p=j.y1-16,f=(j.x1+j.x2)/2):(p=j.y1+30,f=(j.x1+j.x2)/2)}else l=Md(c.fromX,c.fromY,c.toX,c.toY,c.toBlockHeight,r.nodeWidth,!!c.isStart,c,t,e,r),f=(c.fromX+c.toX)/2,p=(c.fromY+c.toY)/2;const v=c.fromPercent?`${c.fromPercent}%`:"",w=v.length*6,y=Math.max(42,w+10),S=16,A=f-y/2,O=p-S/2;return _.jsxs("g",{children:[_.jsx("path",{d:l,stroke:"var(--cs-border)",strokeWidth:oc,fill:"none",markerEnd:"url(#arrowhead)",strokeLinecap:"square",strokeLinejoin:"miter"}),_.jsx("rect",{x:A,y:O,width:y,height:S,rx:"4",ry:"4",fill:"var(--cs-router-percent-bg)"}),_.jsx("text",{x:f,y:O+S/2+.5,fontSize:"10",fill:"#00B7FF",textAnchor:"middle",dominantBaseline:"middle",pointerEvents:"auto",children:v})]},`cross-other-${u}`)}),(o=e==null?void 0:e.filter(c=>c.isCrossColumnConnection&&!c.isStart&&!c.renderOnTop))==null?void 0:o.map((c,u)=>{let l,f,p;if(c.segments&&c.segments.length>0){l=c.segments.map((H,q)=>q===0?`M${H.x1},${H.y1} L${H.x2},${H.y2}`:`L${H.x2},${H.y2}`).join(" ");const j=c.segments[0],V=j.x2-j.x1,B=j.y2-j.y1;Math.abs(V)>Math.abs(B)?(p=(j.y1+j.y2)/2,f=j.x1+30):B<0?(p=j.y1-16,f=(j.x1+j.x2)/2):(p=j.y1+30,f=(j.x1+j.x2)/2)}else l=Md(c.fromX,c.fromY,c.toX,c.toY,c.toBlockHeight,r.nodeWidth,!!c.isStart,c,t,e,r),f=(c.fromX+c.toX)/2,p=(c.fromY+c.toY)/2;const v=c.fromPercent?`${c.fromPercent}%`:"",w=v.length*6,y=Math.max(42,w+10),S=16,A=f-y/2,O=p-S/2;return _.jsxs("g",{children:[_.jsx("path",{d:l,stroke:"var(--cs-border)",strokeWidth:oc,fill:"none",markerEnd:"url(#arrowhead)",strokeLinecap:"square",strokeLinejoin:"miter"}),_.jsx("rect",{x:A,y:O,width:y,height:S,rx:"4",ry:"4",fill:"var(--cs-router-percent-bg)"}),_.jsx("text",{x:f,y:O+S/2+.5,fontSize:"10",fill:"#00B7FF",textAnchor:"middle",dominantBaseline:"middle",pointerEvents:"auto",children:v})]},`cross-other-${u}`)}),(a=e==null?void 0:e.filter(c=>!c.isCrossColumnConnection&&!c.renderOnTop))==null?void 0:a.map((c,u)=>{let l,f,p;if(c.segments&&c.segments.length>0){l=c.segments.map((H,q)=>q===0?`M${H.x1},${H.y1} L${H.x2},${H.y2}`:`L${H.x2},${H.y2}`).join(" ");const j=c.segments[0],V=j.x2-j.x1,B=j.y2-j.y1;Math.abs(V)>Math.abs(B)?(p=(j.y1+j.y2)/2,f=j.x1+30):B<0?(p=j.y1-16,f=(j.x1+j.x2)/2):(p=j.y1+30,f=(j.x1+j.x2)/2)}else{l=Md(c.fromX,c.fromY,c.toX,c.toY,c.toBlockHeight,r.nodeWidth,!!c.isStart,c,t,e,r);const j=l.split(" ");let V=c.fromX,B=c.fromY,H=!1;if(j.length>0&&j[0].startsWith("M")){const q=j[0].substring(1).split(",");q.length===2&&(V=parseFloat(q[0]),B=parseFloat(q[1]))}if(j.length>=3){const q=j[1],ne=j[2];if(q&&ne){const ge=q.substring(1).split(","),se=ne.substring(1).split(",");if(ge.length===2&&se.length===2){const fe=parseFloat(ge[1]),z=parseFloat(se[1]);fe<z&&(H=!0)}}}H?(c.fromPercent&&`${c.fromPercent}`,f=V,p=B+12):(f=V+30,p=B)}const v=c.fromPercent?`${c.fromPercent}%`:"",w=v.length*6,y=Math.max(42,w+10),S=16,A=f-y/2,O=p-S/2;return _.jsxs("g",{children:[_.jsx("path",{d:l,stroke:"var(--cs-border)",strokeWidth:oc,fill:"none",markerEnd:"url(#arrowhead)",strokeLinecap:"square",strokeLinejoin:"miter"}),_.jsx("rect",{x:A,y:O,width:y,height:S,rx:"4",ry:"4",fill:"var(--cs-router-percent-bg)"}),_.jsx("text",{x:f,y:O+S/2+.5,fontSize:"10",fill:"#00B7FF",textAnchor:"middle",dominantBaseline:"middle",pointerEvents:"auto",children:v})]},`normal-${u}`)})]})}function AQ({data:e,isWidget:t}){return _.jsx("div",{style:{width:"100%",position:"relative",height:"100%",zIndex:2},children:e==null?void 0:e.map(r=>_.jsx(IQ,{data:r,isWidget:t},r.target))})}function IQ({data:e,isWidget:t}){var r;return _.jsxs("div",{style:{width:"176px",padding:"8px",background:"--cs-bg-primary",borderRadius:"8px",border:"1px solid",borderColor:"var(--cs-border)",position:"absolute",left:`${e==null?void 0:e.left}px`,top:`${(e==null?void 0:e.top)+"px"}`},"data-node-id":e==null?void 0:e.target,children:[_.jsx(hd,{autoSwitchTooltip:!0,position:"bottom",borderRadius:"12px",content:_.jsx(jQ,{data:e}),children:_.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",height:"24px"},children:[_.jsx(Pr,{src:e==null?void 0:e.targetImg,haveBorder:!1,token:{coin_type:e==null?void 0:e.originalTarget,logo_url:e==null?void 0:e.targetImg,symbol:e==null?void 0:e.targetSymbol,is_trusted:e==null?void 0:e.targetIsTrusted},style:{width:"24px",height:"24px",borderRadius:"100%"}}),_.jsx("span",{style:{color:"var(--cs-text-primary)"},children:Ur((e==null?void 0:e.targetSymbol)||"",16)})]})}),_.jsx("div",{style:{width:"100%",marginTop:"-7.5px",padding:"0px"},children:(r=e==null?void 0:e.fromGroups)==null?void 0:r.map(n=>_.jsx(MQ,{data:n,isWidget:t},n.from))})]})}function MQ({data:e,isWidget:t}){var r;return _.jsxs("div",{style:{padding:"12px 8px",background:"var(--cs-primary-10)",borderRadius:"8px",width:"100%",marginTop:"8px"},children:[_.jsx("span",{style:{height:"16px",fontSize:"14px",color:"var(--cs-primary)",width:"100%"},children:e==null?void 0:e.title}),_.jsx("div",{style:{width:"100%",marginTop:"7px"},children:(r=e==null?void 0:e.list)==null?void 0:r.map(n=>{var i,s;return _.jsx(hd,{position:"bottom",content:_.jsx(OQ,{data:n},n==null?void 0:n.id),children:_.jsxs("div",{style:{display:"flex",height:"22px",width:"142px",cursor:"pointer",alignItems:"center"},children:[_.jsx(Pr,{src:(i=tm[n==null?void 0:n.provider])==null?void 0:i.logo,haveBorder:!1,style:{width:"16px",height:"16px",borderRadius:"100%"}}),_.jsx("span",{style:{fontSize:"12px",color:"#7F98A7",marginLeft:"4px",flex:1},children:(s=tm[n==null?void 0:n.provider])==null?void 0:s.name}),_.jsxs("span",{style:{fontSize:"12px",color:"#7F98A7",flex:"1",textAlign:"right"},children:[n==null?void 0:n.percent,"%"]})]},n.provider)})})})]})}function OQ({data:e}){const{getExplorerUrl:t}=Ba();return _.jsxs("div",{style:{width:"190px",display:"flex",flexDirection:"column",gap:"12px"},className:"no-close-widget-flag",children:[_.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0",gap:"0px"},children:[_.jsx(Pr,{src:e==null?void 0:e.fromLogo,showWarnSize:"12px",haveBorder:!1,token:{coin_type:e==null?void 0:e.from,logo_url:e==null?void 0:e.fromLogo,symbol:e==null?void 0:e.fromSymbol,is_trusted:e==null?void 0:e.fromIsTrusted},style:{width:"16px",height:"16px",borderRadius:"100%"}}),_.jsx(Pr,{src:e==null?void 0:e.targetLogo,showWarnSize:"12px",haveBorder:!1,token:{coin_type:e==null?void 0:e.target,logo_url:e==null?void 0:e.targetLogo,symbol:e==null?void 0:e.targetSymbol,is_trusted:e==null?void 0:e.toIsTrusted},style:{width:"16px",height:"16px",borderRadius:"100%"}}),_.jsxs("span",{style:{fontSize:"12px",color:"var(--cs-text-primary)",flex:1,textAlign:"left",marginLeft:"4px"},children:[Ur((e==null?void 0:e.fromSymbol)||"",8)," -"," ",Ur((e==null?void 0:e.targetSymbol)||"",8)]}),(e==null?void 0:e.feeRate)&&Number(e==null?void 0:e.feeRate)>0&&_.jsx("div",{style:{minWidth:"50px",height:"16px",border:"1px solid var(--cs-border)",borderRadius:"12px",padding:"0px 6px",display:"flex",alignItems:"center",justifyContent:"center"},children:_.jsx("span",{style:{fontSize:"12px",lineHeight:"12px",fontWeight:"400",color:"var(--cs-primary)"},children:e.displayFee})})]}),(e==null?void 0:e.id)&&_.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",height:"20px",padding:"0"},children:[_.jsx("div",{style:{display:"flex",alignItems:"center"},children:_.jsx("span",{style:{fontSize:"12px",color:"var(--cs-text-secondary)"},children:"Pool"})}),_.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[_.jsx("a",{onClick:_f,href:t(e==null?void 0:e.id,"poolAddress"),target:"_blank",style:{textDecoration:"none",color:"var(--cs-text-primary)",marginRight:"4px"},children:qo(e==null?void 0:e.id)}),_.jsx(Id,{text:(e==null?void 0:e.id)||""})]})]})]})}function jQ({data:e}){const{getExplorerUrl:t}=Ba();return _.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:"12px",padding:"0px",gap:"12px"},children:[_.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",flexShrink:0},children:[_.jsx(Pr,{src:e==null?void 0:e.targetImg,showWarnSize:"12px",haveBorder:!1,token:{coin_type:e==null?void 0:e.originalTarget,logo_url:e==null?void 0:e.targetImg,symbol:e==null?void 0:e.targetSymbol,is_trusted:e==null?void 0:e.targetIsTrusted},style:{width:"20px",height:"20px",borderRadius:"100%"}}),_.jsx("span",{style:{color:"var(--cs-text-primary)",fontSize:"12px"},children:Ur((e==null?void 0:e.targetSymbol)||"")})]}),_.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[_.jsx("a",{onClick:_f,href:t(e==null?void 0:e.originalTarget,"coin"),target:"_blank",style:{textDecoration:"none",color:"var(--cs-text-secondary)",marginRight:"4px"},children:qo(e==null?void 0:e.originalTarget)}),_.jsx(Id,{text:(e==null?void 0:e.originalTarget)||""})]})]})}function kQ({toBack:e,data:t,allProviders:r}){const{fromCoin:n,toCoin:i,fromAmount:s,toAmount:o}=tn();return _.jsxs("div",{className:"route-dialog",children:[_.jsx(cg,{title:"Route",backClick:e}),_.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0px 16px",marginTop:"20px"},children:[_.jsx("span",{style:{fontSize:"14px",color:"var(--cs-text-secondary)"},children:"Router"}),_.jsx("div",{style:{display:"flex",alignItems:"center",gap:"2px",flexWrap:"wrap",justifyContent:"flex-end",paddingLeft:"8px"},children:_.jsx(hE,{allProviders:r})})]}),_.jsx("div",{style:{width:"100%",overflow:"auto",padding:"16px",minHeight:"550px",background:"var(--cs-bg-primary)"},children:_.jsxs("div",{style:{width:"876px",marginTop:"16px"},children:[_.jsxs("div",{style:{width:"100%",height:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"16px"},children:[_.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[_.jsx(Pr,{src:n==null?void 0:n.logo_url,style:{width:"24px",height:"24px"}}),_.jsx("span",{style:{fontSize:"14px",fontWeight:"500",color:"var(--cs-text-primary)"},children:so(s||"0")}),_.jsx("span",{style:{fontSize:"14px",fontWeight:"500",color:"var(--cs-text-primary)"},children:n==null?void 0:n.symbol})]}),_.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[_.jsx("span",{style:{fontSize:"14px",fontWeight:"500",color:"var(--cs-text-primary)"},children:so(o||"0")}),_.jsx("span",{style:{fontSize:"14px",fontWeight:"500",color:"var(--cs-text-primary)"},children:i==null?void 0:i.symbol}),_.jsx(Pr,{src:i==null?void 0:i.logo_url,style:{width:"24px",height:"24px"}})]})]}),_.jsx(SQ,{data:t})]})})]})}function PQ({hasSubMenu:e,data:t,isLoading:r,allProviders:n}){const[i,s]=he.useState(!1);return rc(),_.jsxs("div",{className:"simple-router-block",style:{paddingLeft:e?"8px":"0px",paddingRight:e?"8px":"0px"},children:[_.jsx("div",{className:"left",style:{whiteSpace:"nowrap",color:e?"var(--cs-text-secondary)":"var(--cs-text-primary)",paddingRight:"8px"},children:e?"Auto Router":"Route"}),r?_.jsx(Xo,{className:"custom-skeleton",style:{width:"80px",height:"18px"}}):_.jsxs("div",{className:"right",onClick:()=>{s(!0)},children:[_.jsx(hE,{allProviders:n}),e&&_.jsx("svg",{className:"cs-icon spread-icon","aria-hidden":"true",style:{width:"16px",height:"16px",flexShrink:0},children:_.jsx("use",{xlinkHref:"#icon-spread"})})]}),i&&e&&_.jsx(kQ,{data:t,toBack:()=>s(!1),allProviders:n})]})}const Xte="";function pE(){const{setCollectTokenMap:e,collectTokenMap:t}=Wo(),r=i=>{const s=new Map(t);s.get(i.coin_type)?s.delete(i.coin_type):s.set(i.coin_type,i),e(s)},n=he.useCallback(i=>t.get(i.coin_type)!==void 0,[t]);return{handleCollectToken:r,isCollectToken:n,collectTokenMap:t}}function RQ(e){const{trustedTokenList:t}=Ua(),{tokenBalanceObj:r,currentAccount:n}=rn(),{coinPriceObj:i}=H5(),{getTokenAmountValue:s}=Cu(),{fetchTokenInfo:o}=Va(),{currentTypeTab:a,showTokenList:c,setShowTokenList:u,combineTokenList:l,importTokenList:f,setComBineTokenList:p,setImportToken:v,setCurrentImportTokenData:w,setImportTokenIsLoading:y,currentImportTokenData:S,searchInput:A,setSearchInput:O,importTokenIsLoading:j,showTokenListIsLoading:V,setCurrentTypeTab:B,setCurrentPlatformTab:H}=Wo(),[q,ne]=he.useState(!1);he.useEffect(()=>{t&&(t==null?void 0:t.length)>0&&ne(!0)},[t]);const[ge,se]=he.useState(!1);he.useEffect(()=>{h_(i)||se(!0)},[i]);const fe=he.useRef({}),[z,N]=he.useState(!1);he.useEffect(()=>{(!h_(r)||!Q0(fe.current,r))&&(fe.current=r,N(!0))},[r]);const h=he.useMemo(()=>(f==null?void 0:f.length)>1?f==null?void 0:f.map(ue=>{const ie=Af(r==null?void 0:r[ue==null?void 0:ue.coin_type],ue),le=ie==null?void 0:ie.totalBalanceFormat,be=Fe(le).gt("0")?s(ue==null?void 0:ue.coin_type,le):"0";return{...ue,balance:le,rate:be}}):f,[f,r,i]),d=(ue,ie)=>{const le=ie&&ie.toLocaleLowerCase().trim(),be=ue.map(D=>{let F=0,K=0;D.symbol.toLowerCase()===le||D.name.toLowerCase()===le||D.coin_type.toLowerCase()===le?(F=1e3,K=2):D.symbol.toLowerCase().indexOf(le)>-1?(F=100,K=0):D.name.toLowerCase().indexOf(le)>-1?(F=10,K=0):D.coin_type.toLowerCase().indexOf(le)>-1?(F=1,K=0):D.coin_type.toLowerCase()=="0x2::sui::sui"&&(K=1);let te=Array.isArray(D==null?void 0:D.coin_priority)?Number(D.coin_priority[0])||0:Number(D==null?void 0:D.coin_priority)||0;return e===D.coin_type&&!ie&&(K=12,F=1e3,te=1e4),{...D,mark:F,sort:K,coin_priority_sort:te,rateNumber:Number((D==null?void 0:D.rate)||"0"),balanceNumber:Number((D==null?void 0:D.balance)||"0")}});return _Q(be,[D=>!ie&&e===D.coin_type?1:0,"rateNumber","balanceNumber","sort","mark","coin_priority_sort"],["desc","desc","desc","desc","desc","desc"])},m=(ue,ie=!1)=>{const le=ie?ue.trim():ue.toLowerCase().trim(),be=["symbol","name","coin_type"];return pQ(le.length===0?l:[...l,...h],D=>be.some(F=>{const K=D[F];if(typeof K=="string"){const te=ie?K:K.toLowerCase();return F==="coin_type"?te.includes(le)||ms(te,!0).includes(ms(le,!0)):te.includes(le)}return!1}))},x=ue=>{ue||w(void 0);const ie=m(ue);if((ie==null?void 0:ie.length)===0){E(ue);return}else{const le=d(ie,ue);u(le)}},E=async ue=>{y(!0);try{if(p_(ue)){const ie=ue.trim(),le=Sr(ie).full_address,be=await o(le);if(!be){u([]);return}const Ae=Af(r==null?void 0:r[le],be),D=(Ae==null?void 0:Ae.totalBalanceFormat)||"0",F=Fe(D).gt("0")?s(ie,D):"0",K={...be,balance:D,rate:F};u([K]),w(K)}else{u([]);return}}catch{w(void 0),u([]);return}finally{y(!1)}},C=ue=>{if(ue==="Default")g("All"),H("All");else{const ie=d(h,A);u(ie)}},k=()=>{if(S){const ue=v(S,!0),ie=d(ue,A);u(ie),w(void 0),O("")}},M=ue=>{const ie=v(ue,!1),le=d(ie,A);u(le)},g=ue=>{const ie=ue==="All"?[...l]:l.filter(be=>ue=="Native"?!be.labels||be.labels.length==0||be.labels=="Native":be.labels&&be.labels.length>0&&be.labels[0].toLowerCase()==ue.toLowerCase()),le=d(ie,A);u(le)};he.useEffect(()=>{if(!q||!(t!=null&&t.length)){p([]);return}if(!(n!=null&&n.address))p(t);else if(n!=null&&n.address){const ue=[];for(const ie of t){const le=r==null?void 0:r[ie==null?void 0:ie.coin_type],be=Af(le,ie),Ae=(be==null?void 0:be.totalBalanceFormat)||"0",D=(be==null?void 0:be.displayBalance)||"0",F=Fe(Ae).gt("0")?s(ie==null?void 0:ie.coin_type,Ae):"0";ue.push({...ie,balance:D,rate:hn(F,4,!0)})}p(ue)}},[q,ge,z,n==null?void 0:n.address,i]);const b=he.useRef([]);he.useEffect(()=>{if((l==null?void 0:l.length)>0&&!gQ(b.current,l)){b.current=l;const ue=d(l);e?h.find(le=>le.coin_type===e)!==void 0||a!=="Default"?(B("Imported"),C("Imported")):u(S?[S]:ue):u(ue)}},[l,e]);const R=he.useMemo(()=>{if(a==="Default"){if(!V&&(c==null?void 0:c.length)===0)return!0}else if((c==null?void 0:c.length)===0&&!j)return!0;return!1},[A,c,S,j,V]);return{showTokenList:c,handleSearch:x,handleChangePlatform:g,currentImportTokenData:S,handleChangeType:C,handleImportClick:k,handleDeleteImportClick:M,isNoData:R}}function NQ({tokenList:e,onHandleTokenAction:t}){return _.jsx("div",{className:"token-collect-list",children:e.map(r=>_.jsx(DQ,{token:r,onHandleTokenAction:t},r.coin_type))})}function DQ({token:e,onHandleTokenAction:t}){return _.jsxs("div",{className:"token-collect-item",onClick:()=>{t(e,"select_token")},children:[_.jsx(Pr,{src:e==null?void 0:e.logo_url,token:e,style:{width:"20px",height:"20px"}}),_.jsx("span",{style:{marginLeft:"4px"},children:e.symbol}),_.jsx("i",{children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:r=>{r.stopPropagation(),t(e,"un_collect")},children:_.jsx("use",{xlinkHref:"#icon-close"})})})]})}function $Q(e){const{img:t="",text:r,width:n="100%",height:i="100%",padding:s="20px",subItem:o}=e;return _.jsxs("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",width:n,height:i,padding:s,boxSizing:"border-box",textAlign:"center"},children:[t&&_.jsx("img",{src:t,alt:"No Data",style:{width:"160px",height:"160px"}}),r&&_.jsx("div",{style:{color:"var(--cs-text-primary)",fontSize:"14px"},children:r}),o&&o]})}function LQ({tabList:e,currentTab:t,changeTab:r}){return _.jsx("div",{className:"platform-tabs",children:e.map(n=>_.jsx("div",{className:t===n?"platform-tab-item active":"platform-tab-item",onClick:()=>{r(n)},children:n},n))})}var mE=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function BQ(e,t){return!!(e===t||mE(e)&&mE(t))}function UQ(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!BQ(e[r],t[r]))return!1;return!0}function FQ(e,t){t===void 0&&(t=UQ);var r=null;function n(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];if(r&&r.lastThis===this&&t(i,r.lastArgs))return r.lastResult;var o=e.apply(this,i);return r={lastResult:o,lastArgs:i,lastThis:this},o}return n.clear=function(){r=null},n}function Cg(){return Cg=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Cg.apply(null,arguments)}function gE(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ag(e,t){return Ag=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Ag(e,t)}function VQ(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Ag(e,t)}var yE=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function zQ(e,t){return!!(e===t||yE(e)&&yE(t))}function qQ(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!zQ(e[r],t[r]))return!1;return!0}function Ig(e,t){t===void 0&&(t=qQ);var r,n=[],i,s=!1;function o(){for(var a=[],c=0;c<arguments.length;c++)a[c]=arguments[c];return s&&r===this&&t(a,n)||(i=e.apply(this,a),s=!0,r=this,n=a),i}return o}function vE(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var WQ=typeof performance=="object"&&typeof performance.now=="function",bE=WQ?function(){return performance.now()}:function(){return Date.now()};function wE(e){cancelAnimationFrame(e.id)}function GQ(e,t){var r=bE();function n(){bE()-r>=t?e.call(null):i.id=requestAnimationFrame(n)}var i={id:requestAnimationFrame(n)};return i}var Mg=-1;function _E(e){if(e===void 0&&(e=!1),Mg===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),Mg=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Mg}var ac=null;function xE(e){if(e===void 0&&(e=!1),ac===null||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",r.direction="rtl";var n=document.createElement("div"),i=n.style;return i.width="100px",i.height="100px",t.appendChild(n),document.body.appendChild(t),t.scrollLeft>0?ac="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?ac="negative":ac="positive-ascending"),document.body.removeChild(t),ac}return ac}Bn.env.NODE_ENV;var HQ=150,KQ=function(t,r){return t},Od=null,jd=null;Bn.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(Od=new WeakSet,jd=new WeakSet);function YQ(e){var t,r=e.getItemOffset,n=e.getEstimatedTotalSize,i=e.getItemSize,s=e.getOffsetForIndexAndAlignment,o=e.getStartIndexForOffset,a=e.getStopIndexForStartIndex,c=e.initInstanceProps,u=e.shouldResetStyleCacheOnItemSizeChange,l=e.validateProps;return t=function(f){VQ(p,f);function p(w){var y;return y=f.call(this,w)||this,y._instanceProps=c(y.props,gE(y)),y._outerRef=void 0,y._resetIsScrollingTimeoutId=null,y.state={instance:gE(y),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof y.props.initialScrollOffset=="number"?y.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},y._callOnItemsRendered=void 0,y._callOnItemsRendered=Ig(function(S,A,O,j){return y.props.onItemsRendered({overscanStartIndex:S,overscanStopIndex:A,visibleStartIndex:O,visibleStopIndex:j})}),y._callOnScroll=void 0,y._callOnScroll=Ig(function(S,A,O){return y.props.onScroll({scrollDirection:S,scrollOffset:A,scrollUpdateWasRequested:O})}),y._getItemStyle=void 0,y._getItemStyle=function(S){var A=y.props,O=A.direction,j=A.itemSize,V=A.layout,B=y._getItemStyleCache(u&&j,u&&V,u&&O),H;if(B.hasOwnProperty(S))H=B[S];else{var q=r(y.props,S,y._instanceProps),ne=i(y.props,S,y._instanceProps),ge=O==="horizontal"||V==="horizontal",se=O==="rtl",fe=ge?q:0;B[S]=H={position:"absolute",left:se?void 0:fe,right:se?fe:void 0,top:ge?0:q,height:ge?"100%":ne,width:ge?ne:"100%"}}return H},y._getItemStyleCache=void 0,y._getItemStyleCache=Ig(function(S,A,O){return{}}),y._onScrollHorizontal=function(S){var A=S.currentTarget,O=A.clientWidth,j=A.scrollLeft,V=A.scrollWidth;y.setState(function(B){if(B.scrollOffset===j)return null;var H=y.props.direction,q=j;if(H==="rtl")switch(xE()){case"negative":q=-j;break;case"positive-descending":q=V-O-j;break}return q=Math.max(0,Math.min(q,V-O)),{isScrolling:!0,scrollDirection:B.scrollOffset<q?"forward":"backward",scrollOffset:q,scrollUpdateWasRequested:!1}},y._resetIsScrollingDebounced)},y._onScrollVertical=function(S){var A=S.currentTarget,O=A.clientHeight,j=A.scrollHeight,V=A.scrollTop;y.setState(function(B){if(B.scrollOffset===V)return null;var H=Math.max(0,Math.min(V,j-O));return{isScrolling:!0,scrollDirection:B.scrollOffset<H?"forward":"backward",scrollOffset:H,scrollUpdateWasRequested:!1}},y._resetIsScrollingDebounced)},y._outerRefSetter=function(S){var A=y.props.outerRef;y._outerRef=S,typeof A=="function"?A(S):A!=null&&typeof A=="object"&&A.hasOwnProperty("current")&&(A.current=S)},y._resetIsScrollingDebounced=function(){y._resetIsScrollingTimeoutId!==null&&wE(y._resetIsScrollingTimeoutId),y._resetIsScrollingTimeoutId=GQ(y._resetIsScrolling,HQ)},y._resetIsScrolling=function(){y._resetIsScrollingTimeoutId=null,y.setState({isScrolling:!1},function(){y._getItemStyleCache(-1,null)})},y}p.getDerivedStateFromProps=function(y,S){return XQ(y,S),l(y),null};var v=p.prototype;return v.scrollTo=function(y){y=Math.max(0,y),this.setState(function(S){return S.scrollOffset===y?null:{scrollDirection:S.scrollOffset<y?"forward":"backward",scrollOffset:y,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},v.scrollToItem=function(y,S){S===void 0&&(S="auto");var A=this.props,O=A.itemCount,j=A.layout,V=this.state.scrollOffset;y=Math.max(0,Math.min(y,O-1));var B=0;if(this._outerRef){var H=this._outerRef;j==="vertical"?B=H.scrollWidth>H.clientWidth?_E():0:B=H.scrollHeight>H.clientHeight?_E():0}this.scrollTo(s(this.props,y,S,V,this._instanceProps,B))},v.componentDidMount=function(){var y=this.props,S=y.direction,A=y.initialScrollOffset,O=y.layout;if(typeof A=="number"&&this._outerRef!=null){var j=this._outerRef;S==="horizontal"||O==="horizontal"?j.scrollLeft=A:j.scrollTop=A}this._callPropsCallbacks()},v.componentDidUpdate=function(){var y=this.props,S=y.direction,A=y.layout,O=this.state,j=O.scrollOffset,V=O.scrollUpdateWasRequested;if(V&&this._outerRef!=null){var B=this._outerRef;if(S==="horizontal"||A==="horizontal")if(S==="rtl")switch(xE()){case"negative":B.scrollLeft=-j;break;case"positive-ascending":B.scrollLeft=j;break;default:var H=B.clientWidth,q=B.scrollWidth;B.scrollLeft=q-H-j;break}else B.scrollLeft=j;else B.scrollTop=j}this._callPropsCallbacks()},v.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&wE(this._resetIsScrollingTimeoutId)},v.render=function(){var y=this.props,S=y.children,A=y.className,O=y.direction,j=y.height,V=y.innerRef,B=y.innerElementType,H=y.innerTagName,q=y.itemCount,ne=y.itemData,ge=y.itemKey,se=ge===void 0?KQ:ge,fe=y.layout,z=y.outerElementType,N=y.outerTagName,h=y.style,d=y.useIsScrolling,m=y.width,x=this.state.isScrolling,E=O==="horizontal"||fe==="horizontal",C=E?this._onScrollHorizontal:this._onScrollVertical,k=this._getRangeToRender(),M=k[0],g=k[1],b=[];if(q>0)for(var R=M;R<=g;R++)b.push(he.createElement(S,{data:ne,key:se(R,ne),index:R,isScrolling:d?x:void 0,style:this._getItemStyle(R)}));var ue=n(this.props,this._instanceProps);return he.createElement(z||N||"div",{className:A,onScroll:C,ref:this._outerRefSetter,style:Cg({position:"relative",height:j,width:m,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:O},h)},he.createElement(B||H||"div",{children:b,ref:V,style:{height:E?"100%":ue,pointerEvents:x?"none":void 0,width:E?ue:"100%"}}))},v._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var y=this.props.itemCount;if(y>0){var S=this._getRangeToRender(),A=S[0],O=S[1],j=S[2],V=S[3];this._callOnItemsRendered(A,O,j,V)}}if(typeof this.props.onScroll=="function"){var B=this.state,H=B.scrollDirection,q=B.scrollOffset,ne=B.scrollUpdateWasRequested;this._callOnScroll(H,q,ne)}},v._getRangeToRender=function(){var y=this.props,S=y.itemCount,A=y.overscanCount,O=this.state,j=O.isScrolling,V=O.scrollDirection,B=O.scrollOffset;if(S===0)return[0,0,0,0];var H=o(this.props,B,this._instanceProps),q=a(this.props,H,B,this._instanceProps),ne=!j||V==="backward"?Math.max(1,A):1,ge=!j||V==="forward"?Math.max(1,A):1;return[Math.max(0,H-ne),Math.max(0,Math.min(S-1,q+ge)),H,q]},p}(he.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var XQ=function(t,r){var n=t.children,i=t.direction,s=t.height,o=t.layout,a=t.innerTagName,c=t.outerTagName,u=t.width,l=r.instance;if(Bn.env.NODE_ENV!=="production"){(a!=null||c!=null)&&jd&&!jd.has(l)&&(jd.add(l),console.warn("The innerTagName and outerTagName props have been deprecated. Please use the innerElementType and outerElementType props instead."));var f=i==="horizontal"||o==="horizontal";switch(i){case"horizontal":case"vertical":Od&&!Od.has(l)&&(Od.add(l),console.warn('The direction prop should be either "ltr" (default) or "rtl". Please use the layout prop to specify "vertical" (default) or "horizontal" orientation.'));break;case"ltr":case"rtl":break;default:throw Error('An invalid "direction" prop has been specified. Value should be either "ltr" or "rtl". '+('"'+i+'" was specified.'))}switch(o){case"horizontal":case"vertical":break;default:throw Error('An invalid "layout" prop has been specified. Value should be either "horizontal" or "vertical". '+('"'+o+'" was specified.'))}if(n==null)throw Error('An invalid "children" prop has been specified. Value should be a React component. '+('"'+(n===null?"null":typeof n)+'" was specified.'));if(f&&typeof u!="number")throw Error('An invalid "width" prop has been specified. Horizontal lists must specify a number for width. '+('"'+(u===null?"null":typeof u)+'" was specified.'));if(!f&&typeof s!="number")throw Error('An invalid "height" prop has been specified. Vertical lists must specify a number for height. '+('"'+(s===null?"null":typeof s)+'" was specified.'))}},JQ=YQ({getItemOffset:function(t,r){var n=t.itemSize;return r*n},getItemSize:function(t,r){var n=t.itemSize;return n},getEstimatedTotalSize:function(t){var r=t.itemCount,n=t.itemSize;return n*r},getOffsetForIndexAndAlignment:function(t,r,n,i,s,o){var a=t.direction,c=t.height,u=t.itemCount,l=t.itemSize,f=t.layout,p=t.width,v=a==="horizontal"||f==="horizontal",w=v?p:c,y=Math.max(0,u*l-w),S=Math.min(y,r*l),A=Math.max(0,r*l-w+l+o);switch(n==="smart"&&(i>=A-w&&i<=S+w?n="auto":n="center"),n){case"start":return S;case"end":return A;case"center":{var O=Math.round(A+(S-A)/2);return O<Math.ceil(w/2)?0:O>y+Math.floor(w/2)?y:O}case"auto":default:return i>=A&&i<=S?i:i<A?A:S}},getStartIndexForOffset:function(t,r){var n=t.itemCount,i=t.itemSize;return Math.max(0,Math.min(n-1,Math.floor(r/i)))},getStopIndexForStartIndex:function(t,r,n){var i=t.direction,s=t.height,o=t.itemCount,a=t.itemSize,c=t.layout,u=t.width,l=i==="horizontal"||c==="horizontal",f=r*a,p=l?u:s,v=Math.ceil((p+n-f)/a);return Math.max(0,Math.min(o-1,r+v-1))},initInstanceProps:function(t){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(t){var r=t.itemSize;if(Bn.env.NODE_ENV!=="production"&&typeof r!="number")throw Error('An invalid "itemSize" prop has been specified. Value should be a number. '+('"'+(r===null?"null":typeof r)+'" was specified.'))}});function SE(e,t){for(var r in e)if(!(r in t))return!0;for(var n in t)if(e[n]!==t[n])return!0;return!1}var ZQ=["style"],QQ=["style"];function eee(e,t){var r=e.style,n=vE(e,ZQ),i=t.style,s=vE(t,QQ);return!SE(r,i)&&!SE(n,s)}const tee=he.memo(({data:e,index:t,style:r})=>{const{items:n,onHandleTokenAction:i,showCollect:s,showDelete:o}=e,a=n[t];return _.jsx("div",{style:r,children:_.jsx(iee,{data:a,onHandleTokenAction:i,showCollect:s,showDelete:o})})},eee),ree=FQ((e,t,r,n)=>({items:e,onHandleTokenAction:t,showCollect:r,showDelete:n}));function nee({showTokenList:e,onHandleTokenAction:t,showCollect:r=!0,showDelete:n=!1}){const i=he.useRef(null);he.useEffect(()=>{i.current&&i.current.scrollTo(0)},[e.length]);const s=ree(e,t,r,n);return _.jsx("div",{className:"token-list",children:_.jsx(JQ,{ref:i,style:{overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none",padding:"8px"},height:360,itemCount:e.length,itemData:s,itemSize:72,width:"100%",children:tee})})}function iee({data:e,showCollect:t,showDelete:r,onHandleTokenAction:n}){const{isCollectToken:i}=pE(),{getExplorerUrl:s}=Ba();return Cu(),_.jsxs("div",{className:"token-list-item",onClick:o=>{t&&(o.stopPropagation(),n(e,"select_token"))},children:[_.jsx(Pr,{className:"token-img",src:e==null?void 0:e.logo_url,token:e,showWarnSize:"16px",showWarn:!t}),_.jsxs("div",{className:"token-info",children:[_.jsx("h4",{className:"token-symbol",children:_.jsx("span",{children:Ur(e.symbol)})}),_.jsx("p",{className:"token-name",children:Ur(e==null?void 0:e.name,20)}),_.jsxs("div",{className:"copy",children:[_.jsx("a",{onClick:_f,href:s(e==null?void 0:e.coin_type,"coin"),target:"_blank",style:{fontSize:"12px"},children:qo(e==null?void 0:e.coin_type)}),_.jsx(Id,{text:e==null?void 0:e.coin_type})]})]}),_.jsxs("div",{className:"token-balance",children:[_.jsxs("div",{className:"balance",children:[_.jsx("h4",{children:e==null?void 0:e.balance}),_.jsx("p",{children:e!=null&&e.rate?u_(e==null?void 0:e.rate,2):""})]}),r&&_.jsx("div",{className:"collect-button",onClick:o=>{o.stopPropagation(),n(e,"delete_import")},children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-icon_del1"})})}),t&&_.jsx("div",{className:"collect-button",onClick:o=>{o.stopPropagation(),n(e,"collect_token")},children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:i(e)?"#icon-star_sel":"#icon-star"})})})]})]},e==null?void 0:e.coin_type)}function see({currentType:e,changeTab:t}){const r=["Default","Imported"];return _.jsx("div",{className:"type-tabs",children:r.map(n=>_.jsx("div",{className:e===n?"type-tab-item active":"type-tab-item",onClick:()=>t(n),children:n},n))})}function oee({backClick:e,onSelectToken:t,currToken:r}){const{showTokenList:n,isNoData:i,handleSearch:s,handleChangePlatform:o,handleChangeType:a,handleImportClick:c,handleDeleteImportClick:u}=RQ(r==null?void 0:r.coin_type),{importTokenList:l,currentTypeTab:f,setCurrentTypeTab:p,currentPlatformTab:v,setCurrentPlatformTab:w,platformList:y,isOpenImportDialog:S,setIsOpenImportDialog:A,setSearchInput:O,searchInput:j,importTokenIsLoading:V,currentImportTokenData:B,setCurrentImportTokenData:H}=Wo();he.useEffect(()=>()=>{O(""),w("All"),p("Default"),H(void 0)},[]);const{handleCollectToken:q,collectTokenMap:ne}=pE(),ge=m=>{p(m),a(m)},se=m=>{w(m),o(m)},fe=()=>{c(),A(!1)},z=m=>{let x=m.replace(/[^a-zA-Z0-9\s]+$/g,"").trim();O(x),x?N(x):(N(""),ge("Default"))},N=og(m=>{p_(m)?s(ms(m,!0)):s(m)},300),h=(m,x)=>{if(x==="delete_import"){u(m);return}if(x==="collect_token"||x==="un_collect"){q(m);return}x==="select_token"&&(t(m),e())},d=he.useMemo(()=>Array.from(ne.values()),[ne]);return _.jsxs("div",{className:"token-select-modal",children:[_.jsx(cg,{backClick:e,title:"Select Token"}),_.jsxs("div",{className:"token-select-content",style:{position:"relative"},children:[_.jsxs("div",{className:"center-content",children:[_.jsxs("div",{className:"search-input",style:{position:"relative"},children:[_.jsx("input",{className:"token-search-input",placeholder:"Search by token or address",value:j,onChange:m=>z(m.target.value),style:{paddingRight:"40px"}}),j.length>0&&_.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{width:"20px",height:"20px",cursor:"pointer",position:"absolute",top:"50%",transform:"translateY(-50%)",right:"12px"},onClick:m=>{z("")},children:_.jsx("use",{xlinkHref:"#icon-close"})})]}),d.length>0&&_.jsx(NQ,{tokenList:d,onHandleTokenAction:h}),j.length===0&&_.jsx(see,{currentType:f,changeTab:ge}),j.length===0&&f==="Default"&&_.jsx(LQ,{tabList:y,currentTab:v,changeTab:se})]}),i&&_.jsx(aee,{showTooltip:j.length>0,text:j.length>0||B===void 0?"No tokens found":"No Imported Tokens"}),V&&_.jsx(G5,{}),B&&_.jsx("div",{style:{width:"93%",marginLeft:"16px",backgroundColor:"var(--cs-warning-10)",borderRadius:"12px",padding:"16px",fontSize:"12px",marginTop:"16px",color:" var(--cs-warning)"},children:"The token is not on the Frequently Traded List. Please note that anyone can create a token on Sui blockchain with any name, including creating fake versions of existing tokens or tokens that claim to represent projects that do not have a token. Always conduct your own research before trading."}),n.length>0&&_.jsxs("div",{style:{position:"relative"},children:[_.jsx(nee,{showTokenList:n,showCollect:!B,showDelete:!B&&f==="Imported",onHandleTokenAction:h}),B&&_.jsx("div",{className:"center",style:{position:"absolute",top:"100px",left:"50%",transform:"translateX(-50%)"},children:_.jsx("button",{className:"cs-solid-btn swap-btn",style:{height:"32px",width:"140px",fontSize:"14px",borderRadius:"8px",fontFamily:"Inter, Inter",fontWeight:500},onClick:()=>{fe(),h(B,"select_token")},children:"Import"})})]})]})]})}function aee({showTooltip:e,text:t}){return _.jsx("div",{style:{height:"360px"},children:_.jsx($Q,{text:t,subItem:e?_.jsx("div",{children:_.jsx(Jo,{position:"bottom",content:_.jsx("div",{style:{color:"var(--cs-text-primary)"},children:"The unique id of coin"}),children:_.jsxs("div",{style:{fontSize:"12px",color:"var(--cs-text-secondary)",display:"flex",flexDirection:"row"},children:["Or you can enter Coin Type",_.jsx("svg",{className:"cs-icon","aria-hidden":"true",style:{cursor:"pointer",width:"20px",height:"20px"},children:_.jsx("use",{xlinkHref:"#icon-tips"})})]})})}):void 0})})}function cee({onClose:e,tokenList:t,onSureClick:r}){const[n,i]=he.useState(!1),{setIgnoreWarnToken:s}=en();return _.jsxs(_.Fragment,{children:[_.jsx("div",{className:"dialog-mask",onClick:e}),_.jsxs("div",{className:"import-dialog",children:[_.jsxs("div",{className:"cs-dialog-header",children:[_.jsx("div",{className:"title",children:"Tips"}),_.jsx("svg",{className:"cs-icon","aria-hidden":"true",onClick:e,children:_.jsx("use",{xlinkHref:"#icon-close"})})]}),_.jsxs("div",{className:"import-content",children:[_.jsx("div",{className:"tip-text-box",children:_.jsx("p",{className:"tips-text",children:"The default trading pair given in this swap widget contains a community imported token that is imported by the integrator. Please acknowledge the risk and conduct your own research before interacting."})}),t.map(o=>_.jsxs("div",{className:"import-token-info",children:[_.jsx(Pr,{style:{width:"30px",height:"30px",borderRadius:"36px"},token:o,showWarnSize:"16px",src:o.logo_url}),_.jsxs("div",{className:"info",children:[_.jsx("div",{className:"name",children:_.jsxs("span",{children:[" ",o.symbol," "]})}),_.jsxs("div",{className:"address",children:[_.jsx("span",{children:qo(o.coin_type)}),_.jsx(Id,{text:o.coin_type})]})]})]},o.coin_type)),_.jsxs("div",{className:"risk-checkbox ",children:[_.jsx(Kf,{color:"indigo",checked:n,variant:"soft",className:"cs-checkbox cs-allow-change-checkbox",onClick:()=>{i(!n)}}),_.jsx("span",{children:"I acknowledge the risk"})]}),_.jsxs("div",{className:"button-block",children:[_.jsx("button",{className:"cs-outline-btn",onClick:e,children:"Cancel"}),_.jsx("button",{className:"cs-solid-btn",disabled:!n,onClick:()=>{r(),t.forEach(o=>{s(o.coin_type)})},children:"Confirm"})]})]})]})]})}const Jte="";function EE(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}var Ru;(function(e){e.event="event",e.props="prop"})(Ru||(Ru={}));function po(){}function uee(e){var t,r=void 0;return function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];return t&&n.length===t.length&&n.every(function(s,o){return s===t[o]})||(t=n,r=e.apply(void 0,n)),r}}function Nu(e){return!!(e||"").match(/\d/)}function cc(e){return e==null}function lee(e){return typeof e=="number"&&isNaN(e)}function TE(e){return cc(e)||lee(e)||typeof e=="number"&&!isFinite(e)}function CE(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function fee(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;case"thousand":default:return/(\d)(?=(\d{3})+(?!\d))/g}}function dee(e,t,r){var n=fee(r),i=e.search(/[1-9]/);return i=i===-1?e.length:i,e.substring(0,i)+e.substring(i,e.length).replace(n,"$1"+t)}function hee(e){var t=he.useRef(e);t.current=e;var r=he.useRef(function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];return t.current.apply(t,n)});return r.current}function Og(e,t){t===void 0&&(t=!0);var r=e[0]==="-",n=r&&t;e=e.replace("-","");var i=e.split("."),s=i[0],o=i[1]||"";return{beforeDecimal:s,afterDecimal:o,hasNegation:r,addNegation:n}}function pee(e){if(!e)return e;var t=e[0]==="-";t&&(e=e.substring(1,e.length));var r=e.split("."),n=r[0].replace(/^0+/,"")||"0",i=r[1]||"";return(t?"-":"")+n+(i?"."+i:"")}function AE(e,t,r){for(var n="",i=r?"0":"",s=0;s<=t-1;s++)n+=e[s]||i;return n}function IE(e,t){return Array(t+1).join(e)}function ME(e){var t=e+"",r=t[0]==="-"?"-":"";r&&(t=t.substring(1));var n=t.split(/[eE]/g),i=n[0],s=n[1];if(s=Number(s),!s)return r+i;i=i.replace(".","");var o=1+s,a=i.length;return o<0?i="0."+IE("0",Math.abs(o))+i:o>=a?i=i+IE("0",o-a):i=(i.substring(0,o)||"0")+"."+i.substring(o),r+i}function OE(e,t,r){if(["","-"].indexOf(e)!==-1)return e;var n=(e.indexOf(".")!==-1||r)&&t,i=Og(e),s=i.beforeDecimal,o=i.afterDecimal,a=i.hasNegation,c=parseFloat("0."+(o||"0")),u=o.length<=t?"0."+o:c.toFixed(t),l=u.split("."),f=s;s&&Number(l[0])&&(f=s.split("").reverse().reduce(function(y,S,A){return y.length>A?(Number(y[0])+Number(S)).toString()+y.substring(1,y.length):S+y},l[0]));var p=AE(l[1]||"",t,r),v=a?"-":"",w=n?".":"";return""+v+f+w+p}function ia(e,t){if(e.value=e.value,e!==null){if(e.createTextRange){var r=e.createTextRange();return r.move("character",t),r.select(),!0}return e.selectionStart||e.selectionStart===0?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}var jE=uee(function(e,t){for(var r=0,n=0,i=e.length,s=t.length;e[r]===t[r]&&r<i;)r++;for(;e[i-1-n]===t[s-1-n]&&s-n>r&&i-n>r;)n++;return{from:{start:r,end:i-n},to:{start:r,end:s-n}}}),mee=function(e,t){var r=Math.min(e.selectionStart,t);return{from:{start:r,end:e.selectionEnd},to:{start:r,end:t}}};function gee(e,t,r){return Math.min(Math.max(e,t),r)}function jg(e){return Math.max(e.selectionStart,e.selectionEnd)}function yee(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function vee(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function bee(e){var t=e.currentValue,r=e.formattedValue,n=e.currentValueIndex,i=e.formattedValueIndex;return t[n]===r[i]}function wee(e,t,r,n,i,s,o){o===void 0&&(o=bee);var a=i.findIndex(function(V){return V}),c=e.slice(0,a);!t&&!r.startsWith(c)&&(t=c,r=c+r,n=n+c.length);for(var u=r.length,l=e.length,f={},p=new Array(u),v=0;v<u;v++){p[v]=-1;for(var w=0,y=l;w<y;w++){var S=o({currentValue:r,lastValue:t,formattedValue:e,currentValueIndex:v,formattedValueIndex:w});if(S&&f[w]!==!0){p[v]=w,f[w]=!0;break}}}for(var A=n;A<u&&(p[A]===-1||!s(r[A]));)A++;var O=A===u||p[A]===-1?l:p[A];for(A=n-1;A>0&&p[A]===-1;)A--;var j=A===-1||p[A]===-1?0:p[A]+1;return j>O?O:n-j<O-n?j:O}function kE(e,t,r,n){var i=e.length;if(t=gee(t,0,i),n==="left"){for(;t>=0&&!r[t];)t--;t===-1&&(t=r.indexOf(!0))}else{for(;t<=i&&!r[t];)t++;t>i&&(t=r.lastIndexOf(!0))}return t===-1&&(t=i),t}function _ee(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),r=0,n=t.length;r<n;r++)t[r]=!!(Nu(e[r])||Nu(e[r-1]));return t}function PE(e,t,r,n,i,s){s===void 0&&(s=po);var o=hee(function(w,y){var S,A;return TE(w)?(A="",S=""):typeof w=="number"||y?(A=typeof w=="number"?ME(w):w,S=n(A)):(A=i(w,void 0),S=n(A)),{formattedValue:S,numAsString:A}}),a=he.useState(function(){return o(cc(e)?t:e,r)}),c=a[0],u=a[1],l=function(w,y){w.formattedValue!==c.formattedValue&&u({formattedValue:w.formattedValue,numAsString:w.value}),s(w,y)},f=e,p=r;cc(e)&&(f=c.numAsString,p=!0);var v=o(f,p);return he.useMemo(function(){u(v)},[v.formattedValue]),[c,l]}function xee(e){return e.replace(/[^0-9]/g,"")}function See(e){return e}function Eee(e){var t=e.type;t===void 0&&(t="text");var r=e.displayType;r===void 0&&(r="input");var n=e.customInput,i=e.renderText,s=e.getInputRef,o=e.format;o===void 0&&(o=See);var a=e.removeFormatting;a===void 0&&(a=xee);var c=e.defaultValue,u=e.valueIsNumericString,l=e.onValueChange,f=e.isAllowed,p=e.onChange;p===void 0&&(p=po);var v=e.onKeyDown;v===void 0&&(v=po);var w=e.onMouseUp;w===void 0&&(w=po);var y=e.onFocus;y===void 0&&(y=po);var S=e.onBlur;S===void 0&&(S=po);var A=e.value,O=e.getCaretBoundary;O===void 0&&(O=_ee);var j=e.isValidInputCharacter;j===void 0&&(j=Nu);var V=e.isCharacterSame,B=EE(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),H=PE(A,c,!!u,o,a,l),q=H[0],ne=q.formattedValue,ge=q.numAsString,se=H[1],fe=he.useRef(),z=he.useRef({formattedValue:ne,numAsString:ge}),N=function(X,J){z.current={formattedValue:X.formattedValue,numAsString:X.value},se(X,J)},h=he.useState(!1),d=h[0],m=h[1],x=he.useRef(null),E=he.useRef({setCaretTimeout:null,focusTimeout:null});he.useEffect(function(){return m(!0),function(){clearTimeout(E.current.setCaretTimeout),clearTimeout(E.current.focusTimeout)}},[]);var C=o,k=function(X,J){var U=parseFloat(J);return{formattedValue:X,value:J,floatValue:isNaN(U)?void 0:U}},M=function(X,J,U){X.selectionStart===0&&X.selectionEnd===X.value.length||(ia(X,J),E.current.setCaretTimeout=setTimeout(function(){X.value===U&&X.selectionStart!==J&&ia(X,J)},0))},g=function(X,J,U){return kE(X,J,O(X),U)},b=function(X,J,U){var oe=O(J),ye=wee(J,ne,X,U,oe,j,V);return ye=kE(J,ye,oe),ye},R=function(X){var J=X.formattedValue;J===void 0&&(J="");var U=X.input,oe=X.source,ye=X.event,de=X.numAsString,Ee;if(U){var je=X.inputValue||U.value,Ve=jg(U);U.value=J,Ee=b(je,J,Ve),Ee!==void 0&&M(U,Ee,J)}J!==ne&&N(k(J,de),{event:ye,source:oe})};he.useEffect(function(){var X=z.current,J=X.formattedValue,U=X.numAsString;(ne!==J||ge!==U)&&N(k(ne,ge),{event:void 0,source:Ru.props})},[ne,ge]);var ue=x.current?jg(x.current):void 0,ie=typeof window<"u"?he.useLayoutEffect:he.useEffect;ie(function(){var X=x.current;if(ne!==z.current.formattedValue&&X){var J=b(z.current.formattedValue,ne,ue);X.value=ne,M(X,J,ne)}},[ne]);var le=function(X,J,U){var oe=J.target,ye=fe.current?mee(fe.current,oe.selectionEnd):jE(ne,X),de=Object.assign(Object.assign({},ye),{lastValue:ne}),Ee=a(X,de),je=C(Ee);if(Ee=a(je,void 0),f&&!f(k(je,Ee))){var Ve=J.target,Je=jg(Ve),$e=b(X,ne,Je);return Ve.value=ne,M(Ve,$e,ne),!1}return R({formattedValue:je,numAsString:Ee,inputValue:X,event:J,source:U,input:J.target}),!0},be=function(X,J){J===void 0&&(J=0);var U=X.selectionStart,oe=X.selectionEnd;fe.current={selectionStart:U,selectionEnd:oe+J}},Ae=function(X){var J=X.target,U=J.value,oe=le(U,X,Ru.event);oe&&p(X),fe.current=void 0},D=function(X){var J=X.target,U=X.key,oe=J.selectionStart,ye=J.selectionEnd,de=J.value;de===void 0&&(de="");var Ee;U==="ArrowLeft"||U==="Backspace"?Ee=Math.max(oe-1,0):U==="ArrowRight"?Ee=Math.min(oe+1,de.length):U==="Delete"&&(Ee=oe);var je=0;U==="Delete"&&oe===ye&&(je=1);var Ve=U==="ArrowLeft"||U==="ArrowRight";if(Ee===void 0||oe!==ye&&!Ve){v(X),be(J,je);return}var Je=Ee;if(Ve){var $e=U==="ArrowLeft"?"left":"right";Je=g(de,Ee,$e),Je!==Ee&&X.preventDefault()}else U==="Delete"&&!j(de[Ee])?Je=g(de,Ee,"right"):U==="Backspace"&&!j(de[Ee])&&(Je=g(de,Ee,"left"));Je!==Ee&&M(J,Je,de),v(X),be(J,je)},F=function(X){var J=X.target,U=function(){var oe=J.selectionStart,ye=J.selectionEnd,de=J.value;if(de===void 0&&(de=""),oe===ye){var Ee=g(de,oe);Ee!==oe&&M(J,Ee,de)}};U(),requestAnimationFrame(function(){U()}),w(X),be(J)},K=function(X){X.persist&&X.persist();var J=X.target,U=X.currentTarget;x.current=J,E.current.focusTimeout=setTimeout(function(){var oe=J.selectionStart,ye=J.selectionEnd,de=J.value;de===void 0&&(de="");var Ee=g(de,oe);Ee!==oe&&!(oe===0&&ye===de.length)&&M(J,Ee,de),y(Object.assign(Object.assign({},X),{currentTarget:U}))},0)},te=function(X){x.current=null,clearTimeout(E.current.focusTimeout),clearTimeout(E.current.setCaretTimeout),S(X)},Q=d&&yee()?"numeric":void 0,G=Object.assign({inputMode:Q},B,{type:t,value:ne,onChange:Ae,onKeyDown:D,onMouseUp:F,onFocus:K,onBlur:te});if(r==="text")return i?he.createElement(he.Fragment,null,i(ne,B)||null):he.createElement("span",Object.assign({},B,{ref:s}),ne);if(n){var pe=n;return he.createElement(pe,Object.assign({},G,{ref:s}))}return he.createElement("input",Object.assign({},G,{ref:s}))}function RE(e,t){var r=t.decimalScale,n=t.fixedDecimalScale,i=t.prefix;i===void 0&&(i="");var s=t.suffix;s===void 0&&(s="");var o=t.allowNegative,a=t.thousandsGroupStyle;if(a===void 0&&(a="thousand"),e===""||e==="-")return e;var c=kd(t),u=c.thousandSeparator,l=c.decimalSeparator,f=r!==0&&e.indexOf(".")!==-1||r&&n,p=Og(e,o),v=p.beforeDecimal,w=p.afterDecimal,y=p.addNegation;return r!==void 0&&(w=AE(w,r,!!n)),u&&(v=dee(v,u,a)),i&&(v=i+v),s&&(w=w+s),y&&(v="-"+v),e=v+(f&&l||"")+w,e}function kd(e){var t=e.decimalSeparator;t===void 0&&(t=".");var r=e.thousandSeparator,n=e.allowedDecimalSeparators;return r===!0&&(r=","),n||(n=[t,"."]),{decimalSeparator:t,thousandSeparator:r,allowedDecimalSeparators:n}}function Tee(e,t){e===void 0&&(e="");var r=new RegExp("(-)"),n=new RegExp("(-)(.)*(-)"),i=r.test(e),s=n.test(e);return e=e.replace(/-/g,""),i&&!s&&t&&(e="-"+e),e}function Cee(e,t){return new RegExp("(^-)|[0-9]|"+CE(e),t?"g":void 0)}function Aee(e,t,r){return e===""?!0:!(t!=null&&t.match(/\d/))&&!(r!=null&&r.match(/\d/))&&typeof e=="string"&&!isNaN(Number(e))}function Iee(e,t,r){var n;t===void 0&&(t=vee(e));var i=r.allowNegative,s=r.prefix;s===void 0&&(s="");var o=r.suffix;o===void 0&&(o="");var a=r.decimalScale,c=t.from,u=t.to,l=u.start,f=u.end,p=kd(r),v=p.allowedDecimalSeparators,w=p.decimalSeparator,y=e[f]===w;if(Nu(e)&&(e===s||e===o)&&t.lastValue==="")return e;if(f-l===1&&v.indexOf(e[l])!==-1){var S=a===0?"":w;e=e.substring(0,l)+S+e.substring(l+1,e.length)}var A=function(x,E,C){var k=!1,M=!1;s.startsWith("-")?k=!1:x.startsWith("--")?(k=!1,M=!0):o.startsWith("-")&&x.length===o.length?k=!1:x[0]==="-"&&(k=!0);var g=k?1:0;return M&&(g=2),g&&(x=x.substring(g),E-=g,C-=g),{value:x,start:E,end:C,hasNegation:k}},O=A(e,l,f),j=O.hasNegation;n=O,e=n.value,l=n.start,f=n.end;var V=A(t.lastValue,c.start,c.end),B=V.start,H=V.end,q=V.value,ne=e.substring(l,f);e.length&&q.length&&(B>q.length-o.length||H<s.length)&&!(ne&&o.startsWith(ne))&&(e=q);var ge=0;e.startsWith(s)?ge+=s.length:l<s.length&&(ge=l),e=e.substring(ge),f-=ge;var se=e.length,fe=e.length-o.length;e.endsWith(o)?se=fe:(f>fe||f>e.length-o.length)&&(se=f),e=e.substring(0,se),e=Tee(j?"-"+e:e,i),e=(e.match(Cee(w,!0))||[]).join("");var z=e.indexOf(w);e=e.replace(new RegExp(CE(w),"g"),function(x,E){return E===z?".":""});var N=Og(e,i),h=N.beforeDecimal,d=N.afterDecimal,m=N.addNegation;return u.end-u.start<c.end-c.start&&h===""&&y&&!parseFloat(d)&&(e=m?"-":""),e}function Mee(e,t){var r=t.prefix;r===void 0&&(r="");var n=t.suffix;n===void 0&&(n="");var i=Array.from({length:e.length+1}).map(function(){return!0}),s=e[0]==="-";i.fill(!1,0,r.length+(s?1:0));var o=e.length;return i.fill(!1,o-n.length+1,o+1),i}function Oee(e){var t=kd(e),r=t.thousandSeparator,n=t.decimalSeparator,i=e.prefix;i===void 0&&(i="");var s=e.allowNegative;if(s===void 0&&(s=!0),r===n)throw new Error(`
|
|
110
110
|
Decimal separator can't be same as thousand separator.
|
|
111
111
|
thousandSeparator: `+r+` (thousandSeparator = {true} is same as thousandSeparator = ",")
|
|
112
112
|
decimalSeparator: `+n+` (default value for decimalSeparator is .)
|