@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.
@@ -106,7 +106,7 @@ body { background-color: var(--color-page-background); }
106
106
  `)},Jy=function(){var e=parseInt(document.body.getAttribute(Da)||"0",10);return isFinite(e)?e:0},nW=function(){R.useEffect(function(){return document.body.setAttribute(Da,(Jy()+1).toString()),function(){var e=Jy()-1;e<=0?document.body.removeAttribute(Da):document.body.setAttribute(Da,e.toString())}},[])},iW=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,i=n===void 0?"margin":n;nW();var s=R.useMemo(function(){return eW(i)},[i]);return R.createElement(tW,{styles:rW(s,!t,i,r?"":"!important")})},Gp=!1;if(typeof window<"u")try{var Ku=Object.defineProperty({},"passive",{get:function(){return Gp=!0,!0}});window.addEventListener("test",Ku,Ku),window.removeEventListener("test",Ku,Ku)}catch{Gp=!1}var fa=Gp?{passive:!1}:!1,sW=function(e){return e.tagName==="TEXTAREA"},f5=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!sW(e)&&r[t]==="visible")},oW=function(e){return f5(e,"overflowY")},aW=function(e){return f5(e,"overflowX")},Zy=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var i=d5(e,n);if(i){var s=h5(e,n),o=s[1],a=s[2];if(o>a)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},cW=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},uW=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},d5=function(e,t){return e==="v"?oW(t):aW(t)},h5=function(e,t){return e==="v"?cW(t):uW(t)},lW=function(e,t){return e==="h"&&t==="rtl"?-1:1},fW=function(e,t,r,n,i){var s=lW(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=h5(e,a),w=v[0],y=v[1],S=v[2],C=y-S-s*w;(w||C)&&d5(e,a)&&(f+=C,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},Yu=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Qy=function(e){return[e.deltaX,e.deltaY]},ev=function(e){return e&&"current"in e?e.current:e},dW=function(e,t){return e[0]===t[0]&&e[1]===t[1]},hW=function(e){return`
107
107
  .block-interactivity-`.concat(e,` {pointer-events: none;}
108
108
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
109
- `)},pW=0,da=[];function mW(e){var t=R.useRef([]),r=R.useRef([0,0]),n=R.useRef(),i=R.useState(pW++)[0],s=R.useState(l5)[0],o=R.useRef(e);R.useEffect(function(){o.current=e},[e]),R.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var y=Dq([e.lockRef.current],(e.shards||[]).map(ev),!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=R.useCallback(function(y,S){if("touches"in y&&y.touches.length===2||y.type==="wheel"&&y.ctrlKey)return!o.current.allowPinchZoom;var C=Yu(y),O=r.current,j="deltaX"in y?y.deltaX:O[0]-C[0],V="deltaY"in y?y.deltaY:O[1]-C[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=Zy(q,H);if(!ne)return!0;if(ne?B=q:(B=q==="v"?"h":"v",ne=Zy(q,H)),!ne)return!1;if(!n.current&&"changedTouches"in y&&(j||V)&&(n.current=B),!B)return!0;var me=n.current||B;return fW(me,S,y,me==="h"?j:V,!0)},[]),c=R.useCallback(function(y){var S=y;if(!(!da.length||da[da.length-1]!==s)){var C="deltaY"in S?Qy(S):Yu(S),O=t.current.filter(function(B){return B.name===S.type&&(B.target===S.target||S.target===B.shadowParent)&&dW(B.delta,C)})[0];if(O&&O.should){S.cancelable&&S.preventDefault();return}if(!O){var j=(o.current.shards||[]).map(ev).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=R.useCallback(function(y,S,C,O){var j={name:y,delta:S,target:C,should:O,shadowParent:gW(C)};t.current.push(j),setTimeout(function(){t.current=t.current.filter(function(V){return V!==j})},1)},[]),l=R.useCallback(function(y){r.current=Yu(y),n.current=void 0},[]),f=R.useCallback(function(y){u(y.type,Qy(y),y.target,a(y,e.lockRef.current))},[]),p=R.useCallback(function(y){u(y.type,Yu(y),y.target,a(y,e.lockRef.current))},[]);R.useEffect(function(){return da.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",c,fa),document.addEventListener("touchmove",c,fa),document.addEventListener("touchstart",l,fa),function(){da=da.filter(function(y){return y!==s}),document.removeEventListener("wheel",c,fa),document.removeEventListener("touchmove",c,fa),document.removeEventListener("touchstart",l,fa)}},[]);var v=e.removeScrollBar,w=e.inert;return R.createElement(R.Fragment,null,w?R.createElement(s,{styles:hW(i)}):null,v?R.createElement(iW,{gapMode:e.gapMode}):null)}function gW(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const yW=Wq(u5,mW);var p5=R.forwardRef(function(e,t){return R.createElement(gd,Ai({},e,{ref:t,sideCar:yW}))});p5.classNames=gd.classNames;const vW=p5;function bW(e,t){return R.useReducer((r,n)=>t[r][n]??r,e)}var ag="ScrollArea",[m5,Dte]=Cs(ag),[wW,$n]=m5(ag),g5=R.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:i,scrollHideDelay:s=600,...o}=e,[a,c]=R.useState(null),[u,l]=R.useState(null),[f,p]=R.useState(null),[v,w]=R.useState(null),[y,S]=R.useState(null),[C,O]=R.useState(0),[j,V]=R.useState(0),[B,H]=R.useState(!1),[q,ne]=R.useState(!1),me=Xt(t,fe=>c(fe)),se=ng(i);return _.jsx(wW,{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(Jt.div,{dir:se,...o,ref:me,style:{position:"relative","--radix-scroll-area-corner-width":C+"px","--radix-scroll-area-corner-height":j+"px",...e.style}})})});g5.displayName=ag;var y5="ScrollAreaViewport",v5=R.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:i,...s}=e,o=$n(y5,r),a=R.useRef(null),c=Xt(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(Jt.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})})]})});v5.displayName=y5;var zi="ScrollAreaScrollbar",b5=R.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=$n(zi,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:o}=i,a=e.orientation==="horizontal";return R.useEffect(()=>(a?s(!0):o(!0),()=>{a?s(!1):o(!1)}),[a,s,o]),i.type==="hover"?_.jsx(_W,{...n,ref:t,forceMount:r}):i.type==="scroll"?_.jsx(xW,{...n,ref:t,forceMount:r}):i.type==="auto"?_.jsx(w5,{...n,ref:t,forceMount:r}):i.type==="always"?_.jsx(cg,{...n,ref:t}):null});b5.displayName=zi;var _W=R.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=$n(zi,e.__scopeScrollArea),[s,o]=R.useState(!1);return R.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(ci,{present:r||s,children:_.jsx(w5,{"data-state":s?"visible":"hidden",...n,ref:t})})}),xW=R.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=$n(zi,e.__scopeScrollArea),s=e.orientation==="horizontal",o=vd(()=>c("SCROLL_END"),100),[a,c]=bW("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 R.useEffect(()=>{if(a==="idle"){const u=window.setTimeout(()=>c("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(u)}},[a,i.scrollHideDelay,c]),R.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(ci,{present:r||a!=="hidden",children:_.jsx(cg,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:_t(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:_t(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),w5=R.forwardRef((e,t)=>{const r=$n(zi,e.__scopeScrollArea),{forceMount:n,...i}=e,[s,o]=R.useState(!1),a=e.orientation==="horizontal",c=vd(()=>{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(ci,{present:n||s,children:_.jsx(cg,{"data-state":s?"visible":"hidden",...i,ref:t})})}),cg=R.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,i=$n(zi,e.__scopeScrollArea),s=R.useRef(null),o=R.useRef(0),[a,c]=R.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=T5(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 IW(p,o.current,a,v)}return r==="horizontal"?_.jsx(SW,{...l,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const p=i.viewport.scrollLeft,v=tv(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(EW,{...l,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const p=i.viewport.scrollTop,v=tv(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}),SW=R.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,s=$n(zi,e.__scopeScrollArea),[o,a]=R.useState(),c=R.useRef(null),u=Xt(t,c,s.onScrollbarXChange);return R.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),_.jsx(x5,{"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":yd(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),C5(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:vf(o.paddingLeft),paddingEnd:vf(o.paddingRight)}})}})}),EW=R.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,s=$n(zi,e.__scopeScrollArea),[o,a]=R.useState(),c=R.useRef(null),u=Xt(t,c,s.onScrollbarYChange);return R.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),_.jsx(x5,{"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":yd(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),C5(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:vf(o.paddingTop),paddingEnd:vf(o.paddingBottom)}})}})}),[TW,_5]=m5(zi),x5=R.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=$n(zi,r),[w,y]=R.useState(null),S=Xt(t,me=>y(me)),C=R.useRef(null),O=R.useRef(""),j=v.viewport,V=n.content-n.viewport,B=Lr(l),H=Lr(c),q=vd(f,10);function ne(me){if(C.current){const se=me.clientX-C.current.left,fe=me.clientY-C.current.top;u({x:se,y:fe})}}return R.useEffect(()=>{const me=se=>{const fe=se.target;(w==null?void 0:w.contains(fe))&&B(se,V)};return document.addEventListener("wheel",me,{passive:!1}),()=>document.removeEventListener("wheel",me,{passive:!1})},[j,w,V,B]),R.useEffect(H,[n,H]),qa(w,q),qa(v.content,q),_.jsx(TW,{scope:r,scrollbar:w,hasThumb:i,onThumbChange:Lr(s),onThumbPointerUp:Lr(o),onThumbPositionChange:H,onThumbPointerDown:Lr(a),children:_.jsx(Jt.div,{...p,ref:S,style:{position:"absolute",...p.style},onPointerDown:_t(e.onPointerDown,me=>{me.button===0&&(me.target.setPointerCapture(me.pointerId),C.current=w.getBoundingClientRect(),O.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",v.viewport&&(v.viewport.style.scrollBehavior="auto"),ne(me))}),onPointerMove:_t(e.onPointerMove,ne),onPointerUp:_t(e.onPointerUp,me=>{const se=me.target;se.hasPointerCapture(me.pointerId)&&se.releasePointerCapture(me.pointerId),document.body.style.webkitUserSelect=O.current,v.viewport&&(v.viewport.style.scrollBehavior=""),C.current=null})})})}),yf="ScrollAreaThumb",S5=R.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=_5(yf,e.__scopeScrollArea);return _.jsx(ci,{present:r||i.hasThumb,children:_.jsx(AW,{ref:t,...n})})}),AW=R.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...i}=e,s=$n(yf,r),o=_5(yf,r),{onThumbPositionChange:a}=o,c=Xt(t,f=>o.onThumbChange(f)),u=R.useRef(void 0),l=vd(()=>{u.current&&(u.current(),u.current=void 0)},100);return R.useEffect(()=>{const f=s.viewport;if(f){const p=()=>{if(l(),!u.current){const v=MW(f,a);u.current=v,a()}};return a(),f.addEventListener("scroll",p),()=>f.removeEventListener("scroll",p)}},[s.viewport,l,a]),_.jsx(Jt.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:_t(e.onPointerDownCapture,f=>{const v=f.target.getBoundingClientRect(),w=f.clientX-v.left,y=f.clientY-v.top;o.onThumbPointerDown({x:w,y})}),onPointerUp:_t(e.onPointerUp,o.onThumbPointerUp)})});S5.displayName=yf;var ug="ScrollAreaCorner",E5=R.forwardRef((e,t)=>{const r=$n(ug,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?_.jsx(CW,{...e,ref:t}):null});E5.displayName=ug;var CW=R.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,i=$n(ug,r),[s,o]=R.useState(0),[a,c]=R.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(Jt.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 vf(e){return e?parseInt(e,10):0}function T5(e,t){const r=e/t;return isNaN(r)?0:r}function yd(e){const t=T5(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function IW(e,t,r,n="ltr"){const i=yd(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 A5([c,u],f)(e)}function tv(e,t,r="ltr"){const n=yd(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=Sq(e,c);return A5([0,o],[0,a])(u)}function A5(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 C5(e,t){return e>0&&e<t}var MW=(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 vd(e,t){const r=Lr(e),n=R.useRef(0);return R.useEffect(()=>()=>window.clearTimeout(n.current),[]),R.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function qa(e,t){const r=Lr(t);_s(()=>{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 OW=g5,jW=v5,rv=b5,nv=S5,kW=E5,bd="Switch",[RW,$te]=Cs(bd),[PW,NW]=RW(bd),I5=R.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]=R.useState(null),w=Xt(t,j=>v(j)),y=R.useRef(!1),S=p?l||!!p.closest("form"):!0,[C,O]=Tu({prop:i,defaultProp:s??!1,onChange:u,caller:bd});return _.jsxs(PW,{scope:r,checked:C,disabled:a,children:[_.jsx(Jt.button,{type:"button",role:"switch","aria-checked":C,"aria-required":o,"data-state":k5(C),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:w,onClick:_t(e.onClick,j=>{O(V=>!V),S&&(y.current=j.isPropagationStopped(),y.current||j.stopPropagation())})}),S&&_.jsx(j5,{control:p,bubbles:!y.current,name:n,value:c,checked:C,required:o,disabled:a,form:l,style:{transform:"translateX(-100%)"}})]})});I5.displayName=bd;var M5="SwitchThumb",O5=R.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,i=NW(M5,r);return _.jsx(Jt.span,{"data-state":k5(i.checked),"data-disabled":i.disabled?"":void 0,...n,ref:t})});O5.displayName=M5;var DW="SwitchBubbleInput",j5=R.forwardRef(({__scopeSwitch:e,control:t,checked:r,bubbles:n=!0,...i},s)=>{const o=R.useRef(null),a=Xt(o,s),c=FS(r),u=Qm(t);return R.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}})});j5.displayName=DW;function k5(e){return e?"checked":"unchecked"}var $W=I5,LW=O5;const BW=["1","2","3"],UW=["classic","surface","soft"],wc={size:{type:"enum",values:BW,default:"2",responsive:!0},variant:{type:"enum",values:UW,default:"surface"},color:Au,highContrast:dd,radius:sg},R5=R.forwardRef((e,t)=>{const{rest:r,...n}=Cu(e),{className:i,style:s,size:o=wc.size.default,variant:a=wc.variant.default,color:c=wc.color.default,highContrast:u=wc.highContrast.default,radius:l=wc.radius.default,...f}=r;return R.createElement("span",{"data-radius":l,className:cr("rt-SwitchRoot",i,an(o,"rt-r-size"),`rt-variant-${a}`,{"rt-high-contrast":u},Iu(n)),style:s},R.createElement($W,{"data-accent-color":c,...f,ref:t,className:cr("rt-reset","rt-SwitchButton",{"rt-high-contrast":u})},R.createElement(LW,{className:cr("rt-SwitchThumb",{"rt-high-contrast":u})})))});R5.displayName="Switch";var Hp=["Enter"," "],FW=["ArrowDown","PageUp","Home"],P5=["ArrowUp","PageDown","End"],VW=[...FW,...P5],zW={ltr:[...Hp,"ArrowRight"],rtl:[...Hp,"ArrowLeft"]},qW={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Ou="Menu",[ru,WW,GW]=JS(Ou),[ea,N5]=Cs(Ou,[GW,cd,QS]),ju=cd(),D5=QS(),[$5,ho]=ea(Ou),[HW,ku]=ea(Ou),L5=e=>{const{__scopeMenu:t,open:r=!1,children:n,dir:i,onOpenChange:s,modal:o=!0}=e,a=ju(t),[c,u]=R.useState(null),l=R.useRef(!1),f=Lr(s),p=ng(i);return R.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(AS,{...a,children:_.jsx($5,{scope:t,open:r,onOpenChange:f,content:c,onContentChange:u,children:_.jsx(HW,{scope:t,onClose:R.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:l,dir:p,modal:o,children:n})})})};L5.displayName=Ou;var KW="MenuAnchor",lg=R.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=ju(r);return _.jsx(CS,{...i,...n,ref:t})});lg.displayName=KW;var fg="MenuPortal",[YW,B5]=ea(fg,{forceMount:void 0}),U5=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:i}=e,s=ho(fg,t);return _.jsx(YW,{scope:t,forceMount:r,children:_.jsx(ci,{present:r||s.open,children:_.jsx(OS,{asChild:!0,container:i,children:n})})})};U5.displayName=fg;var Dn="MenuContent",[XW,dg]=ea(Dn),F5=R.forwardRef((e,t)=>{const r=B5(Dn,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,s=ho(Dn,e.__scopeMenu),o=ku(Dn,e.__scopeMenu);return _.jsx(ru.Provider,{scope:e.__scopeMenu,children:_.jsx(ci,{present:n||s.open,children:_.jsx(ru.Slot,{scope:e.__scopeMenu,children:o.modal?_.jsx(JW,{...i,ref:t}):_.jsx(ZW,{...i,ref:t})})})})}),JW=R.forwardRef((e,t)=>{const r=ho(Dn,e.__scopeMenu),n=R.useRef(null),i=Xt(t,n);return R.useEffect(()=>{const s=n.current;if(s)return Nq(s)},[]),_.jsx(hg,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:_t(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),ZW=R.forwardRef((e,t)=>{const r=ho(Dn,e.__scopeMenu);return _.jsx(hg,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),QW=Zc("MenuContent.ScrollLock"),hg=R.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=ho(Dn,r),C=ku(Dn,r),O=ju(r),j=D5(r),V=WW(r),[B,H]=R.useState(null),q=R.useRef(null),ne=Xt(t,q,S.onContentChange),me=R.useRef(0),se=R.useRef(""),fe=R.useRef(0),z=R.useRef(null),N=R.useRef("right"),h=R.useRef(0),d=w?vW:R.Fragment,m=w?{as:QW,allowPinchZoom:!0}:void 0,x=A=>{var le,be;const k=se.current+A,M=V().filter(Ce=>!Ce.disabled),g=document.activeElement,b=(le=M.find(Ce=>Ce.ref.current===g))==null?void 0:le.textValue,P=M.map(Ce=>Ce.textValue),ue=fG(P,k,b),ie=(be=M.find(Ce=>Ce.textValue===ue))==null?void 0:be.ref.current;(function Ce(D){se.current=D,window.clearTimeout(me.current),D!==""&&(me.current=window.setTimeout(()=>Ce(""),1e3))})(k),ie&&setTimeout(()=>ie.focus())};R.useEffect(()=>()=>window.clearTimeout(me.current),[]),Eq();const E=R.useCallback(A=>{var M,g;return N.current===((M=z.current)==null?void 0:M.side)&&hG(A,(g=z.current)==null?void 0:g.area)},[]);return _.jsx(XW,{scope:r,searchRef:se,onItemEnter:R.useCallback(A=>{E(A)&&A.preventDefault()},[E]),onItemLeave:R.useCallback(A=>{var k;E(A)||((k=q.current)==null||k.focus(),H(null))},[E]),onTriggerLeave:R.useCallback(A=>{E(A)&&A.preventDefault()},[E]),pointerGraceTimerRef:fe,onPointerGraceIntentChange:R.useCallback(A=>{z.current=A},[]),children:_.jsx(d,{...m,children:_.jsx(i5,{asChild:!0,trapped:i,onMountAutoFocus:_t(s,A=>{var k;A.preventDefault(),(k=q.current)==null||k.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:_.jsx(Wm,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:l,onFocusOutside:f,onInteractOutside:p,onDismiss:v,children:_.jsx(_q,{asChild:!0,...j,dir:C.dir,orientation:"vertical",loop:n,currentTabStopId:B,onCurrentTabStopIdChange:H,onEntryFocus:_t(c,A=>{C.isUsingKeyboardRef.current||A.preventDefault()}),preventScrollOnEntryFocus:!0,children:_.jsx(IS,{role:"menu","aria-orientation":"vertical","data-state":i7(S.open),"data-radix-menu-content":"",dir:C.dir,...O,...y,ref:ne,style:{outline:"none",...y.style},onKeyDown:_t(y.onKeyDown,A=>{const M=A.target.closest("[data-radix-menu-content]")===A.currentTarget,g=A.ctrlKey||A.altKey||A.metaKey,b=A.key.length===1;M&&(A.key==="Tab"&&A.preventDefault(),!g&&b&&x(A.key));const P=q.current;if(A.target!==P||!VW.includes(A.key))return;A.preventDefault();const ie=V().filter(le=>!le.disabled).map(le=>le.ref.current);P5.includes(A.key)&&ie.reverse(),uG(ie)}),onBlur:_t(e.onBlur,A=>{A.currentTarget.contains(A.target)||(window.clearTimeout(me.current),se.current="")}),onPointerMove:_t(e.onPointerMove,nu(A=>{const k=A.target,M=h.current!==A.clientX;if(A.currentTarget.contains(k)&&M){const g=A.clientX>h.current?"right":"left";N.current=g,h.current=A.clientX}}))})})})})})})});F5.displayName=Dn;var eG="MenuGroup",pg=R.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return _.jsx(Jt.div,{role:"group",...n,ref:t})});pg.displayName=eG;var tG="MenuLabel",V5=R.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return _.jsx(Jt.div,{...n,ref:t})});V5.displayName=tG;var bf="MenuItem",iv="menu.itemSelect",wd=R.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...i}=e,s=R.useRef(null),o=ku(bf,e.__scopeMenu),a=dg(bf,e.__scopeMenu),c=Xt(t,s),u=R.useRef(!1),l=()=>{const f=s.current;if(!r&&f){const p=new CustomEvent(iv,{bubbles:!0,cancelable:!0});f.addEventListener(iv,v=>n==null?void 0:n(v),{once:!0}),nS(f,p),p.defaultPrevented?u.current=!1:o.onClose()}};return _.jsx(z5,{...i,ref:c,disabled:r,onClick:_t(e.onClick,l),onPointerDown:f=>{var p;(p=e.onPointerDown)==null||p.call(e,f),u.current=!0},onPointerUp:_t(e.onPointerUp,f=>{var p;u.current||(p=f.currentTarget)==null||p.click()}),onKeyDown:_t(e.onKeyDown,f=>{const p=a.searchRef.current!=="";r||p&&f.key===" "||Hp.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});wd.displayName=bf;var z5=R.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:i,...s}=e,o=dg(bf,r),a=D5(r),c=R.useRef(null),u=Xt(t,c),[l,f]=R.useState(!1),[p,v]=R.useState("");return R.useEffect(()=>{const w=c.current;w&&v((w.textContent??"").trim())},[s.children]),_.jsx(ru.ItemSlot,{scope:r,disabled:n,textValue:i??p,children:_.jsx(xq,{asChild:!0,...a,focusable:!n,children:_.jsx(Jt.div,{role:"menuitem","data-highlighted":l?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...s,ref:u,onPointerMove:_t(e.onPointerMove,nu(w=>{n?o.onItemLeave(w):(o.onItemEnter(w),w.defaultPrevented||w.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:_t(e.onPointerLeave,nu(w=>o.onItemLeave(w))),onFocus:_t(e.onFocus,()=>f(!0)),onBlur:_t(e.onBlur,()=>f(!1))})})})}),rG="MenuCheckboxItem",q5=R.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:n,...i}=e;return _.jsx(Y5,{scope:e.__scopeMenu,checked:r,children:_.jsx(wd,{role:"menuitemcheckbox","aria-checked":wf(r)?"mixed":r,...i,ref:t,"data-state":yg(r),onSelect:_t(i.onSelect,()=>n==null?void 0:n(wf(r)?!0:!r),{checkForDefaultPrevented:!1})})})});q5.displayName=rG;var W5="MenuRadioGroup",[nG,iG]=ea(W5,{value:void 0,onValueChange:()=>{}}),G5=R.forwardRef((e,t)=>{const{value:r,onValueChange:n,...i}=e,s=Lr(n);return _.jsx(nG,{scope:e.__scopeMenu,value:r,onValueChange:s,children:_.jsx(pg,{...i,ref:t})})});G5.displayName=W5;var H5="MenuRadioItem",K5=R.forwardRef((e,t)=>{const{value:r,...n}=e,i=iG(H5,e.__scopeMenu),s=r===i.value;return _.jsx(Y5,{scope:e.__scopeMenu,checked:s,children:_.jsx(wd,{role:"menuitemradio","aria-checked":s,...n,ref:t,"data-state":yg(s),onSelect:_t(n.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,r)},{checkForDefaultPrevented:!1})})})});K5.displayName=H5;var mg="MenuItemIndicator",[Y5,sG]=ea(mg,{checked:!1}),X5=R.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:n,...i}=e,s=sG(mg,r);return _.jsx(ci,{present:n||wf(s.checked)||s.checked===!0,children:_.jsx(Jt.span,{...i,ref:t,"data-state":yg(s.checked)})})});X5.displayName=mg;var oG="MenuSeparator",J5=R.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return _.jsx(Jt.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});J5.displayName=oG;var aG="MenuArrow",Z5=R.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=ju(r);return _.jsx(MS,{...i,...n,ref:t})});Z5.displayName=aG;var gg="MenuSub",[cG,Q5]=ea(gg),e7=e=>{const{__scopeMenu:t,children:r,open:n=!1,onOpenChange:i}=e,s=ho(gg,t),o=ju(t),[a,c]=R.useState(null),[u,l]=R.useState(null),f=Lr(i);return R.useEffect(()=>(s.open===!1&&f(!1),()=>f(!1)),[s.open,f]),_.jsx(AS,{...o,children:_.jsx($5,{scope:t,open:n,onOpenChange:f,content:u,onContentChange:l,children:_.jsx(cG,{scope:t,contentId:Qc(),triggerId:Qc(),trigger:a,onTriggerChange:c,children:r})})})};e7.displayName=gg;var Ic="MenuSubTrigger",t7=R.forwardRef((e,t)=>{const r=ho(Ic,e.__scopeMenu),n=ku(Ic,e.__scopeMenu),i=Q5(Ic,e.__scopeMenu),s=dg(Ic,e.__scopeMenu),o=R.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=s,u={__scopeMenu:e.__scopeMenu},l=R.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return R.useEffect(()=>l,[l]),R.useEffect(()=>{const f=a.current;return()=>{window.clearTimeout(f),c(null)}},[a,c]),_.jsx(lg,{asChild:!0,...u,children:_.jsx(z5,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":i.contentId,"data-state":i7(r.open),...e,ref:zm(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:_t(e.onPointerMove,nu(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:_t(e.onPointerLeave,nu(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",C=S?-5:5,O=p[S?"left":"right"],j=p[S?"right":"left"];s.onPointerGraceIntentChange({area:[{x:f.clientX+C,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:_t(e.onKeyDown,f=>{var v;const p=s.searchRef.current!=="";e.disabled||p&&f.key===" "||zW[n.dir].includes(f.key)&&(r.onOpenChange(!0),(v=r.content)==null||v.focus(),f.preventDefault())})})})});t7.displayName=Ic;var r7="MenuSubContent",n7=R.forwardRef((e,t)=>{const r=B5(Dn,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,s=ho(Dn,e.__scopeMenu),o=ku(Dn,e.__scopeMenu),a=Q5(r7,e.__scopeMenu),c=R.useRef(null),u=Xt(t,c);return _.jsx(ru.Provider,{scope:e.__scopeMenu,children:_.jsx(ci,{present:n||s.open,children:_.jsx(ru.Slot,{scope:e.__scopeMenu,children:_.jsx(hg,{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:_t(e.onFocusOutside,l=>{l.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:_t(e.onEscapeKeyDown,l=>{o.onClose(),l.preventDefault()}),onKeyDown:_t(e.onKeyDown,l=>{var v;const f=l.currentTarget.contains(l.target),p=qW[o.dir].includes(l.key);f&&p&&(s.onOpenChange(!1),(v=a.trigger)==null||v.focus(),l.preventDefault())})})})})})});n7.displayName=r7;function i7(e){return e?"open":"closed"}function wf(e){return e==="indeterminate"}function yg(e){return wf(e)?"indeterminate":e?"checked":"unchecked"}function uG(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function lG(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function fG(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=lG(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 dG(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 hG(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return dG(r,t)}function nu(e){return t=>t.pointerType==="mouse"?e(t):void 0}var pG=L5,mG=lg,gG=U5,yG=F5,vG=pg,bG=V5,wG=wd,_G=q5,xG=G5,SG=K5,EG=X5,TG=J5,AG=Z5,CG=e7,IG=t7,MG=n7,_d="DropdownMenu",[OG,Lte]=Cs(_d,[N5]),Yr=N5(),[jG,s7]=OG(_d),o7=e=>{const{__scopeDropdownMenu:t,children:r,dir:n,open:i,defaultOpen:s,onOpenChange:o,modal:a=!0}=e,c=Yr(t),u=R.useRef(null),[l,f]=Tu({prop:i,defaultProp:s??!1,onChange:o,caller:_d});return _.jsx(jG,{scope:t,triggerId:Qc(),triggerRef:u,contentId:Qc(),open:l,onOpenChange:f,onOpenToggle:R.useCallback(()=>f(p=>!p),[f]),modal:a,children:_.jsx(pG,{...c,open:l,onOpenChange:f,dir:n,modal:a,children:r})})};o7.displayName=_d;var a7="DropdownMenuTrigger",c7=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...i}=e,s=s7(a7,r),o=Yr(r);return _.jsx(mG,{asChild:!0,...o,children:_.jsx(Jt.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:zm(t,s.triggerRef),onPointerDown:_t(e.onPointerDown,a=>{!n&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:_t(e.onKeyDown,a=>{n||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});c7.displayName=a7;var kG="DropdownMenuPortal",u7=e=>{const{__scopeDropdownMenu:t,...r}=e,n=Yr(t);return _.jsx(gG,{...n,...r})};u7.displayName=kG;var l7="DropdownMenuContent",f7=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=s7(l7,r),s=Yr(r),o=R.useRef(!1);return _.jsx(yG,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...n,ref:t,onCloseAutoFocus:_t(e.onCloseAutoFocus,a=>{var c;o.current||(c=i.triggerRef.current)==null||c.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:_t(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)"}})});f7.displayName=l7;var RG="DropdownMenuGroup",d7=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Yr(r);return _.jsx(vG,{...i,...n,ref:t})});d7.displayName=RG;var PG="DropdownMenuLabel",h7=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Yr(r);return _.jsx(bG,{...i,...n,ref:t})});h7.displayName=PG;var NG="DropdownMenuItem",p7=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Yr(r);return _.jsx(wG,{...i,...n,ref:t})});p7.displayName=NG;var DG="DropdownMenuCheckboxItem",m7=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Yr(r);return _.jsx(_G,{...i,...n,ref:t})});m7.displayName=DG;var $G="DropdownMenuRadioGroup",g7=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Yr(r);return _.jsx(xG,{...i,...n,ref:t})});g7.displayName=$G;var LG="DropdownMenuRadioItem",y7=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Yr(r);return _.jsx(SG,{...i,...n,ref:t})});y7.displayName=LG;var BG="DropdownMenuItemIndicator",v7=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Yr(r);return _.jsx(EG,{...i,...n,ref:t})});v7.displayName=BG;var UG="DropdownMenuSeparator",b7=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Yr(r);return _.jsx(TG,{...i,...n,ref:t})});b7.displayName=UG;var FG="DropdownMenuArrow",VG=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Yr(r);return _.jsx(AG,{...i,...n,ref:t})});VG.displayName=FG;var zG=e=>{const{__scopeDropdownMenu:t,children:r,open:n,onOpenChange:i,defaultOpen:s}=e,o=Yr(t),[a,c]=Tu({prop:n,defaultProp:s??!1,onChange:i,caller:"DropdownMenuSub"});return _.jsx(CG,{...o,open:a,onOpenChange:c,children:r})},qG="DropdownMenuSubTrigger",w7=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Yr(r);return _.jsx(IG,{...i,...n,ref:t})});w7.displayName=qG;var WG="DropdownMenuSubContent",_7=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Yr(r);return _.jsx(MG,{...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)"}})});_7.displayName=WG;var GG=o7,HG=c7,x7=u7,KG=f7,YG=d7,XG=h7,JG=p7,ZG=m7,QG=g7,eH=y7,S7=v7,tH=b7,rH=zG,nH=w7,iH=_7;const sH=["1","2","3"],oH=["vertical","horizontal","both"],Ih={size:{type:"enum",values:sH,default:"1",responsive:!0},radius:sg,scrollbars:{type:"enum",values:oH,default:"both"}},vg=R.forwardRef((e,t)=>{const{rest:r,...n}=Cu(e),{className:i,style:s,type:o,scrollHideDelay:a=o!=="scroll"?0:void 0,dir:c,size:u=Ih.size.default,radius:l=Ih.radius.default,scrollbars:f=Ih.scrollbars.default,...p}=r;return R.createElement(OW,{type:o,scrollHideDelay:a,className:cr("rt-ScrollAreaRoot",i,Iu(n)),style:s},R.createElement(jW,{...p,ref:t,className:"rt-ScrollAreaViewport"}),R.createElement("div",{className:"rt-ScrollAreaViewportFocusRing"}),f!=="vertical"?R.createElement(rv,{"data-radius":l,orientation:"horizontal",className:cr("rt-ScrollAreaScrollbar",an(u,"rt-r-size"))},R.createElement(nv,{className:"rt-ScrollAreaThumb"})):null,f!=="horizontal"?R.createElement(rv,{"data-radius":l,orientation:"vertical",className:cr("rt-ScrollAreaScrollbar",an(u,"rt-r-size"))},R.createElement(nv,{className:"rt-ScrollAreaThumb"})):null,f==="both"?R.createElement(kW,{className:"rt-ScrollAreaCorner"}):null)});vg.displayName="ScrollArea";const aH=["1","2"],cH=["solid","soft"],Mh={size:{type:"enum",values:aH,default:"2",responsive:!0},variant:{type:"enum",values:cH,default:"solid"},color:Au,highContrast:dd},E7={color:Au,shortcut:{type:"string",default:void 0}},T7=e=>R.createElement(GG,{...e});T7.displayName="DropdownMenuRoot";const A7=R.forwardRef((e,t)=>R.createElement(HG,{...e,ref:t,asChild:!0}));A7.displayName="DropdownMenuTrigger";const C7=R.createContext({}),I7=R.forwardRef((e,t)=>{const r=tq(),{className:n,children:i,size:s=Mh.size.default,variant:o=Mh.variant.default,highContrast:a=Mh.highContrast.default,color:c=E7.color.default,container:u,forceMount:l,...f}=e,p=c??r.accentColor;return R.createElement(x7,{container:u,forceMount:l},R.createElement(fd,{asChild:!0},R.createElement(KG,{"data-accent-color":p,align:"start",sideOffset:4,collisionPadding:10,...f,ref:t,className:cr("rt-PopperContent","rt-BaseMenuContent","rt-DropdownMenuContent",n,an(s,"rt-r-size"),`rt-variant-${o}`,{"rt-high-contrast":a})},R.createElement(vg,{type:"auto"},R.createElement("div",{className:cr("rt-BaseMenuViewport","rt-DropdownMenuViewport")},R.createElement(C7.Provider,{value:R.useMemo(()=>({size:s,variant:o,color:p,highContrast:a}),[s,o,p,a])},i))))))});I7.displayName="DropdownMenuContent";const M7=R.forwardRef((e,t)=>R.createElement(XG,{...e,ref:t,className:cr("rt-BaseMenuLabel","rt-DropdownMenuLabel",e.className)}));M7.displayName="DropdownMenuLabel";const O7=R.forwardRef((e,t)=>{const{className:r,children:n,color:i=E7.color.default,shortcut:s,...o}=e;return R.createElement(JG,{"data-accent-color":i,...o,ref:t,className:cr("rt-reset","rt-BaseMenuItem","rt-DropdownMenuItem",r)},R.createElement(id,null,n),s&&R.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},s))});O7.displayName="DropdownMenuItem";const j7=R.forwardRef((e,t)=>R.createElement(YG,{...e,ref:t,className:cr("rt-BaseMenuGroup","rt-DropdownMenuGroup",e.className)}));j7.displayName="DropdownMenuGroup";const k7=R.forwardRef((e,t)=>R.createElement(QG,{...e,ref:t,className:cr("rt-BaseMenuRadioGroup","rt-DropdownMenuRadioGroup",e.className)}));k7.displayName="DropdownMenuRadioGroup";const R7=R.forwardRef((e,t)=>{const{children:r,className:n,...i}=e;return R.createElement(eH,{...i,ref:t,className:cr("rt-BaseMenuItem","rt-BaseMenuRadioItem","rt-DropdownMenuItem","rt-DropdownMenuRadioItem",n)},R.createElement(id,null,r),R.createElement(S7,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},R.createElement(pd,{className:"rt-BaseMenuItemIndicatorIcon rt-DropdownMenuItemIndicatorIcon"})))});R7.displayName="DropdownMenuRadioItem";const P7=R.forwardRef((e,t)=>{const{children:r,className:n,shortcut:i,...s}=e;return R.createElement(ZG,{...s,ref:t,className:cr("rt-BaseMenuItem","rt-BaseMenuCheckboxItem","rt-DropdownMenuItem","rt-DropdownMenuCheckboxItem",n)},R.createElement(id,null,r),R.createElement(S7,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},R.createElement(pd,{className:"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon"})),i&&R.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},i))});P7.displayName="DropdownMenuCheckboxItem";const N7=e=>R.createElement(rH,{...e});N7.displayName="DropdownMenuSub";const D7=R.forwardRef((e,t)=>{const{className:r,children:n,...i}=e;return R.createElement(nH,{...i,ref:t,className:cr("rt-BaseMenuItem","rt-BaseMenuSubTrigger","rt-DropdownMenuItem","rt-DropdownMenuSubTrigger",r)},R.createElement(id,null,n),R.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},R.createElement(XS,{className:"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon"})))});D7.displayName="DropdownMenuSubTrigger";const $7=R.forwardRef((e,t)=>{const{className:r,children:n,container:i,forceMount:s,...o}=e,{size:a,variant:c,color:u,highContrast:l}=R.useContext(C7);return R.createElement(x7,{container:i,forceMount:s},R.createElement(fd,{asChild:!0},R.createElement(iH,{"data-accent-color":u,alignOffset:-Number(a)*4,sideOffset:1,collisionPadding:10,...o,ref:t,className:cr("rt-PopperContent","rt-BaseMenuContent","rt-BaseMenuSubContent","rt-DropdownMenuContent","rt-DropdownMenuSubContent",r,an(a,"rt-r-size"),`rt-variant-${c}`,{"rt-high-contrast":l})},R.createElement(vg,{type:"auto"},R.createElement("div",{className:cr("rt-BaseMenuViewport","rt-DropdownMenuViewport")},n)))))});$7.displayName="DropdownMenuSubContent";const L7=R.forwardRef((e,t)=>R.createElement(tH,{...e,ref:t,className:cr("rt-BaseMenuSeparator","rt-DropdownMenuSeparator",e.className)}));L7.displayName="DropdownMenuSeparator";const vs=Object.assign({},{Root:T7,Trigger:A7,Content:I7,Label:M7,Item:O7,Group:j7,RadioGroup:k7,RadioItem:R7,CheckboxItem:P7,Sub:N7,SubTrigger:D7,SubContent:$7,Separator:L7}),uH=["1","2","3","4"],lH=["classic","solid","soft","surface","outline","ghost"],_c={size:{type:"enum",values:uH,default:"2",responsive:!0},variant:{type:"enum",values:lH,default:"solid"},color:Au,highContrast:dd,radius:sg},B7=R.forwardRef((e,t)=>{const{rest:r,...n}=Cu(e),{className:i,asChild:s=!1,size:o=_c.size.default,variant:a=_c.variant.default,color:c=_c.color.default,highContrast:u=_c.highContrast.default,radius:l=_c.radius.default,...f}=r,p=s?qm:"button";return R.createElement(p,{"data-disabled":f.disabled||void 0,"data-accent-color":c,"data-radius":l,...f,ref:t,className:cr("rt-reset","rt-BaseButton",i,an(o,"rt-r-size"),`rt-variant-${a}`,{"rt-high-contrast":u},Iu(n))})});B7.displayName="BaseButton";const U7=R.forwardRef((e,t)=>R.createElement(B7,{...e,ref:t,className:cr("rt-Button",e.className)}));U7.displayName="Button";const fH={loading:{type:"boolean",default:!0}},ta=R.forwardRef((e,t)=>{const{rest:r,...n}=Cu(e),{className:i,children:s,loading:o=fH.loading.default,...a}=r;if(!o)return R.createElement(R.Fragment,null,s);const c=R.isValidElement(s)?qm:"span";return R.createElement(c,{ref:t,"aria-hidden":!0,className:cr("rt-Skeleton",i,Iu(n)),"data-inline-skeleton":R.isValidElement(s)?void 0:!0,tabIndex:-1,inert:"",...a},s)});ta.displayName="Skeleton";function bg(e){const{text:t,onClick:r,className:n,btnIsDisabled:i=!1}=e,s=()=>{r&&r()};return _.jsx(U7,{disabled:i,className:n?`cs-button ${n}`:"cs-button",onClick:s,children:t})}function Go({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]=ve.useState(!1),[u,l]=ve.useState(!1),f=ve.useRef(null),p=()=>{f.current&&(clearTimeout(f.current),f.current=null),c(!0)};ve.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=ve.useRef(null),[S,C]=ve.useState({left:void 0,top:void 0});return ve.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`),C({left:V,top:B})}},[a]),_.jsxs("div",{ref:y,style:{position:"relative",display:"inline-block"},onMouseEnter:p,onMouseLeave:v,children:[t,a&&Ef.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 Oh=[{label:"Default"},{label:"Fast Mode",beforeIcon:{xlinkHref:"#icon-icon_flash",fontSize:"16px",activeColor:"var(--cs-primary)",activeHoverColor:"var(--cs-primary)"}}],dH=e=>{const{transactionMode:t,setTransactionMode:r,maxCapForGas:n,setMaxCapForGas:i,customGasPrice:s,setCustomGasPrice:o,suiBalance:a,themeType:c}=e,u=c=="Light"?Nt("/images/icon_shio_light@2x.png"):Nt("/images/icon_shio@2x.png"),l=ve.useMemo(()=>{var O;return(O=Oh.filter(j=>(j==null?void 0:j.label)===t))==null?void 0:O[0]},[t,Oh]),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=Ve(O.target.value).gt(0)?Ve(O.target.value).div(Math.pow(10,9)).toString():"0";Ve(V).gt(n)&&i(V),o(O.target.value)},v=ve.useMemo(()=>!n||Number(n)==0?"Please enter a value higher than 0":n&&Number(n)>5?"Only allow up to 5 SUI":Ve(n).gt(a)?"Insufficient SUI balance ":Ve(n).lt(Ve(s).div(Math.pow(10,9)))?"Max cap cannot be less than custom gas.":"",[n]),w=ve.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=ve.useMemo(()=>!s||Number(s)==0?"Please enter a value higher than 0":"",[s]),S=ve.useMemo(()=>s&&Number(s)>0&&Ve(s).lt(750)?"Your current maximum fee is below the market rate. Please raise it to ensure your transactions are processed.":"",[s]),C=ve.useMemo(()=>!s||s==="0"?"0":Ve(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:Oh.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(Go,{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:C}),"SUI"]})]})]}),y&&_.jsx(Xu,{text:y,type:"error"}),S&&_.jsx(Xu,{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(Go,{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(Xu,{text:v,type:"error"}),w&&_.jsx(Xu,{text:w,type:"warn"}),_.jsxs("div",{className:"powered-by",children:[_.jsx("span",{children:"Powered by"}),_.jsx("img",{src:u,alt:"shio"})]})]})]})},Xu=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})})},hH={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 pH({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(mH,{themeType:e,onClose:()=>t(!1)})]})}function mH({onClose:e,themeType:t}){const{transactionMode:r,maxCapForGas:n,customGasPrice:i,setMaxCapForGas:s,setCustomGasPrice:o,setTransctionMode:a,mevProtect:c,setMevProtect:u}=en(),{balanceInfo:l}=Jc(hH),[f,p]=ve.useState(r),[v,w]=ve.useState(n),[y,S]=ve.useState(i),[C,O]=ve.useState(c),{slippage:j,setSlippage:V}=en(),[B,H]=ve.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)},me=()=>{B&&V(B),f==="Fast Mode"&&(s(v),o(y)),a(f),u(C),e()};ve.useEffect(()=>{f==="Fast Mode"&&O(!0)},[f]);const se=ve.useMemo(()=>f==="Fast Mode"&&(!v||Number(v)===0||Number(v)>5||!y||Number(y)===0||Ve(v).gt((l==null?void 0:l.totalBalanceFormat)||"0")||Ve(v).lt(Ve(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:bF.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(dH,{transactionMode:f,setTransactionMode:p,maxCapForGas:v,setMaxCapForGas:w,customGasPrice:y,setCustomGasPrice:S,suiBalance:(l==null?void 0:l.totalBalanceFormat)||"0",themeType:t}),_.jsx(gH,{mevProtect:C,setMevProtect:O,disabled:f==="Fast Mode"}),_.jsx(bg,{text:"Save",btnIsDisabled:se,className:"slippage-save-btn",onClick:me})]})})]})}const gH=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(Go,{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(R5,{checked:t,disabled:r,className:"cs-switch",onClick:()=>{n(!t)}})]})]})};function yH({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(pH,{themeType:t}),_.jsx(VF,{onClick:e})]})]})})}function vH(){const[e,t]=ve.useState(!1);return _.jsxs(vs.Root,{open:e,onOpenChange:t,children:[_.jsx(vs.Trigger,{children:_.jsx("div",{className:"cs-settings-btn",children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-settings"})})})}),_.jsx(vs.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(bH,{}),_.jsx(_H,{onClose:()=>{t(!1)}})]})})]})}function bH(){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:rd.map(s=>_.jsxs("div",{className:"group-item",style:{justifyContent:"center"},onClick:()=>i(s.link),children:[_.jsx(md,{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 wH=e=>!/^(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(e);function _H({onClose:e}){const{addTxToast:t}=tc(),{currentRpc:r,setCurrentRpc:n,customRpc:i,setCustomRpc:s,rpcList:o}=en(),[a,c]=ve.useState(i),[u,l]=ve.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(md,{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(bg,{btnIsDisabled:wH(a),text:"Save",onClick:w})]})]})]})}function F7(){const{suiClient:e}=fo(),{setAccountServiceNameObj:t,accountServiceNameObj:r}=nn(),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 xH=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()}},SH=xH,sv={"text/plain":"Text","text/html":"Url",default:"Text"},EH="Copy to clipboard: #{key}, Enter";function TH(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function AH(e,t){var r,n,i,s,o,a,c=!1;t||(t={}),r=t.debug||!1;try{i=SH(),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=sv[t.format]||sv.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=TH("message"in t?t.message:EH),window.prompt(n,e)}}finally{o&&(typeof o.removeRange=="function"?o.removeRange(s):o.removeAllRanges()),a&&document.body.removeChild(a),i()}return c}var CH=AH;const V7=lu(CH);function IH({currentAccount:e}){const{mutate:t}=un.useSwitchAccount(),r=un.useAccounts(),{isOpenAccountList:n,setIsOpenAccountList:i,accountServiceNameObj:s}=nn(),{getServiceNames:o}=F7(),a=ve.useCallback(()=>{n||o(r),i(!n)},[n,r]);ve.useEffect(()=>()=>{i(!1)},[]);const c=ve.useMemo(()=>r.filter(l=>l.address!==e),[r,e]);ve.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 MH=ve.forwardRef(({connect:e,isSimulate:t=!1})=>{const r=un.useCurrentAccount();return _.jsx("div",{children:r?_.jsx(OH,{isSimulate:t}):_.jsx(bg,{text:"Connect",className:"cs-connect-button",onClick:()=>e(!0)})})});function OH({isSimulate:e}){const{mutate:t}=un.useDisconnectWallet(),r=un.useCurrentAccount(),{currentWallet:n}=un.useCurrentWallet(),{addCommonToast:i}=tc(),{getExplorerUrl:s}=Qa(),{accountServiceNameObj:o}=nn(),a=()=>{r&&(V7(r.address||"",{debug:!1,message:"message"}),i("Copied"))},c=()=>{r&&window.open(s(r.address,"account"),"_blank")};return ve.useEffect(()=>{},[n]),_.jsxs(vs.Root,{children:[_.jsx(vs.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(vs.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(IH,{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 jH({isSimulate:e=!1}){const{fetchServiceNames:t}=F7(),r=un.useCurrentAccount();un.useCurrentWallet();const{isOpenWalletModal:n,onWalletModal:i,saveCurrentAccount:s}=nn();return un.useWallets(),ve.useEffect(()=>{r!=null&&r.address&&t([r==null?void 0:r.address])},[r==null?void 0:r.address]),_.jsx(_.Fragment,{children:_.jsx(un.ConnectModal,{trigger:_.jsx(MH,{connect:i,isSimulate:e}),open:n,onOpenChange:o=>i(o)})})}function kH({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(jH,{}),_.jsx(vH,{})]})]}),_.jsx("div",{style:{marginTop:"12px"}})]})}const z7=()=>{const e=ve.useRef(null);ve.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 RH({onClose:e,transactionData:t}){const{status:r,buildShowInfo:n,tx:i}=t,s=ve.useMemo(()=>{if(n&&r)return n(r)},[r]);return _.jsxs("div",{className:"ts-status-dialog",children:[(r==="confirmation"||r==="submitted")&&_.jsx(PH,{info:s,status:r}),(r==="success"||r==="rejected")&&_.jsx(NH,{info:s,status:r,tx:i,onClose:e})]})}function PH({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(z7,{})}),_.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 NH({info:e,status:t,tx:r,onClose:n}){const{getExplorerUrl:i}=Qa();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"}),rd.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 DH(){const{fetchByApi:e}=nd(),{setProviders:t}=en();return{fetchRouterConfig:async()=>{try{const n=await e("/router_v3/status","GET"),{providers:i}=n;i&&t(i)}catch{}}}}function $H({interval:e,callback:t}){const r=ve.useRef(),n=ve.useRef(null);ve.useEffect(()=>{r.current=t},[t]);const i=ve.useCallback(()=>{n.current&&clearInterval(n.current),e>0&&(n.current=setInterval(()=>{r.current&&r.current(Date.now())},e))},[e]),s=ve.useCallback(()=>{n.current&&(clearInterval(n.current),n.current=null)},[]);return ve.useEffect(()=>(i(),()=>s()),[]),{startTimer:i,stopTimer:s}}const LH=(e,t)=>({coinPriceObj:{},setPriceObj:r=>{const n=t().coinPriceObj;e({coinPriceObj:{...n,...r}})},clearPriceObj:r=>{const n=t().coinPriceObj;r.forEach(i=>{delete n[xr(i).full_address]}),e({coinPriceObj:{...n}})}}),q7=As(LH);function BH(e,t){const r=[];for(let n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r}function Ru(){const{fetchByApi:e}=nd(),{coinPriceObj:t,setPriceObj:r,clearPriceObj:n}=q7(),i=async a=>{const u=BH(a,10);try{const f=(await Promise.all(u.map(p=>e("/v3/sui/market_price","GET",{base_symbol_address:p.map(v=>ws(v,!1))})))).map(p=>p.prices).flat();if(f){const p={};f.forEach(v=>{p[xr(v.base_symbol).full_address]=v}),r(p)}return f}catch{return n(a),null}},s=ve.useCallback(a=>{if(!a)return;const c=t[xr(a).full_address];if(c)return c},[t]),o=ve.useCallback((a,c,u)=>{const l=Number(c)==0||!u?"0":u;if(c&&a&&+c){const f=s(a);if(f)return Ve(c).mul(f.price).toString()}return l},[t]);return{fetchTokenPrices:i,getTokenPrice:s,getTokenAmountValue:o}}function UH(){const{tokenBalanceObj:e}=nn(),{fetchTokenPrices:t}=Ru(),{isOpenTokensDialog:r}=rn(),n=ve.useCallback(()=>{if(mF(e)){const i=Object.keys(e);t(i)}},[e]);return ve.useEffect(()=>{r&&n()},[r]),{getMyAssetsPrice:n}}const FH={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"}},VH={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"}},W7=VH,G7=FH;function zH(e,t){const{fetchTokenInfo:r}=rc(),{setFromCoin:n,setToCoin:i,setDefaultCoin:s,fromCoin:o,toCoin:a}=rn(),{setSlippage:c,setRpcList:u,setCurrentRpc:l}=en(),{tokenMapIsInit:f}=ec(),p=ve.useRef({}),v=async(y,S)=>{if(!S&&!y&&(o||a))return;const C=y?await r(y):W7,O=S?await r(S):G7;n(C),i(O),s(C==null?void 0:C.coin_type,O==null?void 0:O.coin_type)},w=(y=[],S)=>{let C=[],O=Bc[0],j=Bc[0];y.forEach(V=>{const B={name:V,link:V,isCustom:!1};C.push(B),V===S&&(j=B)}),S&&y.includes(S)?C=[j,O,...C.filter(V=>V.link!==S)]:C.unshift(Bc[0]),u([...C,{name:"Custom RPC URL",link:"",isCustom:!0}]),l(j)};return ve.useEffect(()=>{if(f&&!Fm(e,p.current)){const{defaultFromToken:y,defaultToToken:S,defaultSlippage:C,customRpcList:O,defaultRpc:j}=e;v(y,S),C&&c(C),w(O||[],j),p.current=e}},[e,f]),{handleSetDefaultPair:v}}function qH(e){const{currentRpc:t}=en(),{setSuiClient:r,setAggregatorSDK:n}=fo(),{currentAccount:i}=nn();ve.useEffect(()=>{if(t){const o=new Vo({url:t.link});r(o)}},[t]);const s=()=>{const o={endpoint:Pa.aggregatorUrl,signer:(i==null?void 0:i.address)||"",client:new Vo({url:t.link}),env:Mx.Mainnet,overlayFeeRate:(e==null?void 0:e.overlayFeeRate)||void 0,overlayFeeReceiver:(e==null?void 0:e.overlayFeeReceiver)||void 0},a=new Ix(o);n(a)};ve.useEffect(()=>{t&&s()},[t.link,i==null?void 0:i.address]),ve.useEffect(()=>{e!=null&&e.overlayFeeRate&&(e!=null&&e.overlayFeeReceiver)&&s()},[e==null?void 0:e.overlayFeeRate,e==null?void 0:e.overlayFeeReceiver])}const wg=As((e,t)=>({transactionData:void 0,setTransactionData:r=>{e(()=>({transactionData:r}))}})),$r=[];for(let e=0;e<256;++e)$r.push((e+256).toString(16).slice(1));function WH(e,t=0){return($r[e[t+0]]+$r[e[t+1]]+$r[e[t+2]]+$r[e[t+3]]+"-"+$r[e[t+4]]+$r[e[t+5]]+"-"+$r[e[t+6]]+$r[e[t+7]]+"-"+$r[e[t+8]]+$r[e[t+9]]+"-"+$r[e[t+10]]+$r[e[t+11]]+$r[e[t+12]]+$r[e[t+13]]+$r[e[t+14]]+$r[e[t+15]]).toLowerCase()}let jh;const GH=new Uint8Array(16);function HH(){if(!jh){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");jh=crypto.getRandomValues.bind(crypto)}return jh(GH)}const KH=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),ov={randomUUID:KH};function av(e,t,r){var i;if(ov.randomUUID&&!t&&!e)return ov.randomUUID();e=e||{};const n=e.random??((i=e.rng)==null?void 0:i.call(e))??HH();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 WH(n)}var Uo=(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))(Uo||{});const YH=new Vo({url:e_("mainnet")}),XH=["0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC","0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD","0xf16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a::fdusd::FDUSD","0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb::usdy::USDY","0x294de7579d55c110a00a7c4946e09a1b5cbeca2592fbb83fd7bfacba3cfeaf0e::drf::DRF"],JH=["deny_list","DenyList","DenyCap","create_regulated_currency"],ZH={showType:!0,showContent:!0,showOwner:!1,showPreviousTransaction:!1,showStorageRebate:!1,showDisplay:!1},QH=async e=>{let t=!1;if(XH.includes(e))return t;const r=e.split("::"),n=r[0]&&zt(r[0]),i=r[1],s=await YH.getObject({id:n,options:ZH}),o="disassembled"in s.data.content?s.data.content.disassembled[i]:null;return o&&typeof o=="string"&&new RegExp(JH.join("|"),"i").test(o)&&(t=!0),t},eK=e=>{var n;if(!e)return"";const t=e==null?void 0:e.split(",");return(n=t==null?void 0:t.map(i=>ws(i,!1)))==null?void 0:n.join(",")};function tK(){const{fetchByApi:e}=nd(),t=async s=>{try{const o={...s},a=eK(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=Nt("/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=>Bo(S).source_address);v=p==null?void 0:p.filter(S=>{var j,V;const C=Bo((j=S==null?void 0:S.coin_a)==null?void 0:j.address).source_address,O=Bo((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(C)&&y.includes(O)?!0:!!((y==null?void 0:y.length)===1&&(y.includes(C)||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=>Cy(s)==="0x2::sui::SUI"?"0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI":Cy(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 rK(e=!0){const{poolApiMap:t,setPoolApiMap:r}=en(),{getPoolList:n,getLocalJsonPoolList:i,getLocalJsonPoolAddress:s}=tK();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 nK(e){const{routerData:t}=rn();return{priceAcceptRouterData:ve.useMemo(()=>{if(t&&e){if(e.byAmountIn){if(!Ve(e.toAmountUi).eq(t.toAmountUi||"0"))return t}else if(!Ve(e.fromAmountUi).eq(t.fromAmountUi||"0"))return t;return}},[t,e])}}function H7(e,t){return{amountLimit:ve.useMemo(()=>{if(t&&t.routerData){const{byAmountIn:n,fromAmountUi:i,toAmountUi:s}=t;return n?Ve(s).mul(Ve(1).sub(Ve(e).div(100))).toString():Ve(i).mul(Ve(1).add(Ve(e).div(100))).toString()}},[e,t])}}function iK(){const{fromCoin:e,toCoin:t}=rn(),{getPoolAddressByCoinType:r}=rK(!0);return{getSwapPoolAddress:async()=>e&&t?await r(e.coin_type,t.coin_type):[]}}function K7(e,t,r){return ve.useMemo(()=>t&&r&&+t&&+r?e?Ve(r).div(t).toString():Ve(t).div(r).toString():"0",[t,r,e])}function cv(e){const[t,r]=ve.useState(),n=async i=>{if(i.is_trusted)return!1;try{return await QH(i.coin_type)}catch{}return!1};return ve.useEffect(()=>{r(void 0),e&&n(e).then(i=>{r(i)})},[e==null?void 0:e.coin_type]),{isScamsCoin:t}}function sK(e,t){const{defaultFromCoinType:r,defaultToCoinCoinType:n}=rn(),{getTokenInfo:i}=rc(),{ignoreWarnTokenMap:s}=en(),o=i(e),a=i(t),c=ve.useMemo(()=>!Fu(r,W7.coin_type)||!Fu(n,G7.coin_type),[r,n]),u=ve.useCallback(f=>f&&!s[ws(f.coin_type)]&&(Fu(r,f.coin_type)||Fu(n,f.coin_type))?!f.is_trusted:!1,[r,n,s]),l=ve.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 oK(){const{aggregatorSDK:e}=fo(),{getSwapPoolAddress:t}=iK(),r=s=>s&&s.error?s.error.code===Uo.InsufficientLiquidity||Uo.HoneyPot||Uo.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 O1(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 O1(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=Dp(l.amountIn.toString(),c.decimals).toString(),w=Dp(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 ha(e){const t=ve.useRef(e);return ve.useEffect(()=>{t.current=e},[e]),t}function aK(e){try{return e&&e.toString().includes("Rejected from user")}catch{return!1}}function cK(e){const t=String(e);return t.indexOf("withdraw_with_proof")>-1||t.indexOf("check_coin_threshold")>-1||t.indexOf('Identifier("balance")')>-1}function uK(e){return!!String(e).includes("Could not find the referenced transaction")}function lK(e){return!!String(e).includes("Max cap reached.")}function fK(e){return!!String(e).includes("Fast Mode service error")}function dK(e){return aK(e)?"User rejected the request":cK(e)?"Exceeded price slippage":uK(e)?"Oops. Failed to sync data from your txid. Please check your txn status from explorer or from your wallet.":lK(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.":fK(e)?"Fast Mode service error, please switch to the Default Transaction Mode or try again later.":"Transaction failed"}var _g={},hK=Pr&&Pr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(_g,"__esModule",{value:!0});var pK=_g.executeAuction=Y7;const mK=hK(W_),gK="https://rpc.getshio.com",yK=500,vK=300;function Y7(e,t,r=yK){const n={jsonrpc:"2.0",method:"shio_executeAuction",params:[e,t],id:1};return new Promise((i,s)=>{setTimeout(i,r),mK.default.post(gK,n,{headers:{"Content-Type":"application/json"},timeout:r}).then(o=>{setTimeout(i,vK)}).catch(s)})}_g.default={executeAuction:Y7};const bK="0x2::sui::SUI",wK="https://rpc.getshio.com/fast",_K="0x1889977f0fb56ae730e7bda8e8e32859ce78874458c74910d36121a81a615123",uv=[{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 xK(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,Zl.from(r).toString("base64")])}function SK(){return uv[Math.floor(Math.random()*uv.length)]}async function EK(e,t,r){return await e.executeTransactionBlock({transactionBlock:t.bytes,signature:t.signature,options:r})}async function TK(e,t,r){let n=e.moveCall({package:"0x2",module:"coin",function:"into_balance",typeArguments:[bK],arguments:[t]});return AK(e,n,r)}async function AK(e,t,r){let n=SK();e.moveCall({package:_K,module:"auctioneer",function:"submit_bid",arguments:[e.sharedObjectRef({objectId:n.objectId,mutable:!0,initialSharedVersion:n.version}),e.pure.u64(r),t]})}const Kp="CoinWithBalance",CK=$.object({type:$.string(),balance:$.bigint()});async function IK(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===Kp){const{type:p,balance:v}=$.parse(CK,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 MK({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!==Kp)continue;const{type:v,balance:w}=p.$Intent.data;if(w===0n&&v!=="gas"){e.replaceCommand(f,Rn.Commands.MoveCall({target:"0x2::coin::zero",typeArguments:[v]}));continue}const y=[];if(!c.has(v)){const[S,...C]=o.get(v).map(O=>e.addInput("object",Rn.Inputs.ObjectRef({objectId:O.coinObjectId,digest:O.digest,version:O.version})));C.length>0&&y.push(Rn.Commands.MergeCoins(S,C)),c.set(v,S)}y.push(Rn.Commands.SplitCoins(c.get(v),[e.addInput("pure",Rn.Inputs.Pure(oi.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 MK({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 X7(){const{suiClient:e}=fo(),{currentAccount:t}=nn(),{mutateAsync:r}=un.useSignTransaction(),{mutate:n}=un.useSignAndExecuteTransaction({execute:async({bytes:c,signature:u})=>await s(c,u)}),i=ve.useMemo(()=>"sui:mainnet",[t]),s=async(c,u,l=!1)=>{var p,v;if(l){const w=await e.devInspectTransactionBlock({transactionBlock:Rn.Transaction.from(Sr(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=Rn.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=Rn.Transaction.from(c)),typeof c=="string"&&(c=Rn.Transaction.from(Sr(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 OK(){const{signTransactionBlock:e,executeTransactionBlock:t,signAndExecuteTransactionBlock:r}=X7(),{currentAccount:n}=nn();return{getFastModeTx:async(s,o,a)=>{let c,u,l;try{const f=new Vo({url:wK});s.setSender(n==null?void 0:n.address),s.setGasPrice(Number(a));const p=Rn.Transaction.from(s);p.addIntentResolver(Kp,IK);const v=await xK({transaction:p,client:f}),w=Ve(o).mul(Math.pow(10,9)).toString();if(Ve(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]);TK(s,y[0],v.tipAmount);const S=await s.build({client:f}),C=await e(S),{bytes:O,signature:j}=C;l=O,u=new Date().getTime(),c=await EK(f,C,{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 jK(){const{signTransactionBlock:e,executeTransactionBlock:t,signAndExecuteTransactionBlock:r}=X7(),{currentAccount:n}=nn(),{suiClient:i}=fo(),{setTransactionData:s}=wg(),{addTxToast:o,removeToast:a}=tc(),{getFastModeTx:c}=OK(),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 Ty(l),f(w,y+1)}}const p=async(w,y,S={useDevInspect:!1,useMev:!1,txAction:"signTransactionBlock",useFastMode:!1,maxCapForGas:"",customGasPrice:""})=>{var me,se,fe;const{useDevInspect:C=!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:A}=x;if(O)try{const k=await pK(E,A,500)}catch{}z=await t(E,A,C)}else z=await r(h,C);y.status="submitted",s({...y}),y.tx=z.digest,q=o(y),await Ty(l),ne=z==null?void 0:z.digest;let m;if(((me=z==null?void 0:z.effects)==null?void 0:me.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=pF(m,n==null?void 0:n.address,!1);if(y.buildShowInfo){const E=y.buildShowInfo("success",x);y.buildShowInfo=A=>E}a(q),y.status="success",s({...y})}return m}catch(z){v(y,z)}},v=(w,y)=>{const S=dK(y);if(w.buildShowInfo){const C=w.buildShowInfo("confirmation");w.buildShowInfo=O=>(C.toastDescriptionContent=S,C.modalDescriptionText=S,C),w.status="rejected",s({...w})}else w.buildShowInfo=C=>{const O={};return O.toastDescriptionContent=S,O.modalDescriptionText=S,O},w.status="rejected",s({...w})};return{signAndExecuteTransaction:p}}function xg(e,t=1e3){const r=ve.useRef(),n=ve.useCallback((...i)=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{e(...i)},t)},[e,t]);return ve.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]),n}function kK(){const{aggregatorSDK:e}=fo(),{findBestRouters:t}=oK(),{getTokenAmountValue:r,fetchTokenPrices:n}=Ru(),{providers:i,slippage:s,mevProtect:o,maxCapForGas:a,transactionMode:c,customGasPrice:u}=en(),{signAndExecuteTransaction:l}=jK(),{setTransactionData:f}=wg(),{addTxToast:p}=tc(),{fromCoin:v,toCoin:w,setFromCoin:y,setToCoin:S,setToAmount:C,fromAmount:O,toAmount:j,setFromAmount:V,setFindRouterLoading:B,setRouterData:H,setByAmountIn:q,byAmountIn:ne}=rn(),[me,se]=ve.useState(""),fe=ha(me),z=ha(ne),N=ha(O),h=ha(j),d=ha(v),m=ha(w),{balanceInfo:x,getOwnerCoinBalances:E}=Jc(v),{balanceInfo:A}=Jc(w),k=r(v==null?void 0:v.coin_type,O),M=r(w==null?void 0:w.coin_type,j),b=xg(async(te,Q,G)=>{if(d.current&&m.current&&+te){(+N.current||+h.current)&&B(!0);const he=dF(te,Q?d.current.decimals:m.current.decimals),X=await t({fromToken:d.current,toToken:m.current,amount:he.toString(),providersKeys:i,by_amount_in:Q,uuid:G});B(!1),fe.current===G&&(Q?+N.current?(C(X.toAmountUi||""),H(X)):C(""):+h.current?(V(X.fromAmountUi||"ß"),H(X)):V(""))}else ie(!Q)},500),P=(te,Q,G=!1)=>{if(q(Q),Q?(V(te),G&&C("")):(C(te),G&&V("")),+te){const he=av();se(he),b(te,Q,he)}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(""),C("")):te?V(""):C(""),B(!1),H(void 0)},le=()=>{const te=z.current?N.current:h.current;if(+te){const Q=av();se(Q),b(te,z.current,Q)}},be=async(te,Q)=>{const{routerData:G,byAmountIn:he,fromAmountUi:X,toAmountUi:J}=te,U=new Rn.Transaction,oe={router:G,slippage:Number(s)/100,txb:U,partner:Q||xF};try{const ge={status:"confirmation",buildShowInfo:(je,Fe)=>{const Je=`Swap ${ln(X,v==null?void 0:v.decimals)} ${v==null?void 0:v.symbol} for ${ln(J,w==null?void 0:w.decimals)} ${w==null?void 0:w.symbol}`,Ne={modalDescriptionText:Je,toastTitleText:Je};if(je==="success"){let Ge=X,nt=J;Fe&&(Ge=Ay(Fe,v)||X,nt=Ay(Fe,w)||J);const et=`Swapped ${ln(Ge,v==null?void 0:v.decimals)} ${v==null?void 0:v.symbol} for ${ln(nt,w==null?void 0:w.decimals)} ${w==null?void 0:w.symbol}`;Ne.toastTitleText=et,Ne.modalDescriptionText=et}return Ne},id:0};f(ge),await l(async()=>(await e.fastRouterSwap(oe),U),ge,{useMev:o,useFastMode:c==="Fast Mode",maxCapForGas:a,customGasPrice:u})?(ie(),E()):le()}catch(ge){String(ge).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."}}})}};ve.useEffect(()=>{Ce(),ie()},[v==null?void 0:v.coin_type,w==null?void 0:w.coin_type]);const Ce=()=>{const te=[];v&&te.push(v.coin_type),w&&te.push(w.coin_type),te.length>0&&n(te)},{isScamsCoin:D}=cv(v),{isScamsCoin:F}=cv(w),K=ve.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:P,handleSelectToken:ue,fromBalanceInfo:x,toBalanceInfo:A,fromAmountValue:k,toAmountValue:M,doSwapAction:be,reCalculateRouteData:le,refreshMarketPrice:Ce,scamsText:K}}function RK(e){const{fromCoin:t,toCoin:r,fromAmount:n,toAmount:i,routerData:s}=rn(),{currentAccount:o}=nn(),a=ve.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===Uo.InsufficientLiquidity)return c.text="Insufficient liquidity for this trade",c.disabled=!0,c;if(s.errorCode===Uo.NoRouter||s.errorCode===Uo.HoneyPot)return c.text="No Available Route",c.disabled=!0,c}return+n&&Ve(n).gt(e||0)?(c.disabled=!0,c.text=`Insufficient ${Vr(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 lv=878,yi=176,Ju=72,wo=22,PK=8,ts=16,NK=24,DK=12,$K=16,LK=8,BK=22,Dr=50,br=55,pa=13,En=5;function J7(e,t,r){const[n,i]=ve.useState({}),[s,o]=ve.useState([]),[a,c]=ve.useState([]),[u,l]=ve.useState(0),{fromCoin:f,toCoin:p}=rn(),[v,w]=ve.useState([]),[y,S]=ve.useState([]);function C(h,d,m,x=3){const E=new Set;h.forEach(ie=>{E.add(ie.from),E.add(ie.target)});const A=[],k=[],M=new Set;h.forEach(ie=>{var le;if(ie.from===d&&ie.target!==m){const be=ie.target,Ce=h.some(F=>F.target===be&&F.from!==d);let D=!1;if(Ce){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 Ce=new Map;le[be].forEach(D=>{const F=D.provider,K=D.feeRate,te=`${F}_${K}`;if(Ce.has(te)){const Q=Ce.get(te);Q.amountIn=Ve(Q.amountIn).plus(D.amountIn||"0").toString(),Q.amountOut=Ve(Q.amountOut).plus(D.amountOut||"0").toString()}else Ce.set(te,{...D,amountIn:D.amountIn||"0",amountOut:D.amountOut||"0"})}),le[be]=Array.from(Ce.values())}),k.push({target:`0-${ie}`,originalTarget:ie,list:le})}),k.length>0&&A.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 Ce=new Map;le[be].forEach(D=>{const F=D.provider,K=D.feeRate,te=`${F}_${K}`;if(Ce.has(te)){const Q=Ce.get(te);Q.amountIn=Ve(Q.amountIn).plus(D.amountIn||"0").toString(),Q.amountOut=Ve(Q.amountOut).plus(D.amountOut||"0").toString()}else Ce.set(te,{...D,amountIn:D.amountIn||"0",amountOut:D.amountOut||"0"})}),le[be]=Array.from(Ce.values())}),g.push({target:`1-${ie}`,originalTarget:ie,list:le}))}),g.length>0&&A.push(g);const P=[],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 Ce=be.provider,D=be.feeRate,F=`${Ce}_${D}`;if(le.has(F)){const K=le.get(F);K.amountIn=Ve(K.amountIn).plus(be.amountIn||"0").toString(),K.amountOut=Ve(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())}),P.push({target:`2-${m}`,originalTarget:m,list:ue})),P.length>0&&A.push(P),A}function O(h,d,m){var b,P,ue;const x=h.length,E=x*yi+(x-1)*Ju,A=(lv-E)/2,k=new Map,M=[],g=new Map;if(h.forEach((ie,le)=>{ie.forEach(be=>{const Ce=`${le}-${be.target}`,D=N(be.list);g.set(Ce,D)})}),x===1){const ie=h[0];let le=Dr;ie.forEach(be=>{const Ce=`0-${be.target}`,D=g.get(Ce)||0;k.set(Ce,{...be,id:Ce,top:le,left:A,height:D,width:yi,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]),Ce=ie.map(K=>{var Q;const te=((Q=K.list[d])==null?void 0:Q.reduce((G,he)=>G+parseFloat(he.amountIn||"0"),0))||0;return{block:K,totalAmountIn:te}}).sort((K,te)=>te.totalAmountIn-K.totalAmountIn).map(({block:K})=>K);let D=be?Dr+wo:Dr;Ce.forEach(K=>{const te=`0-${K.target}`,Q=g.get(te)||0;k.set(te,{...K,id:te,top:D,left:A,height:Q,width:yi,columnIndex:0}),D+=Q+ts});let F=Dr;le.forEach(K=>{const te=`1-${K.target}`,Q=g.get(te)||0;k.set(te,{...K,id:te,top:F,left:A+yi+Ju,height:Q,width:yi,columnIndex:1}),F+=Q+ts}),M.push(Ce,le)}else{const ie=h[0],le=h[1],be=h[2],Ce=((b=be[0])==null?void 0:b.originalTarget)||((P=be[0])==null?void 0:P.target),D=ie.map(de=>{var Ct,Rt;const Ee=de.originalTarget||de.target,je=`0-${de.target}`,Fe=g.get(je)||0,Je=le.some(He=>He.originalTarget==de.originalTarget),Ne=((Rt=(Ct=be==null?void 0:be[0])==null?void 0:Ct.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(ut=>ut.from===Ee&&ut.target===pt)}),nt=[];le.forEach(He=>{const pt=He.originalTarget||He.target;m.some(ut=>ut.from===Ee&&ut.target===pt)&&nt.push(pt)});let et=6;if(Ne&&!Ge)et=1;else if(Ne&&Ge)et=2;else if(!Ne&&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 ut=le.find(ot=>(ot.originalTarget||ot.target)===pt);return(ut?Object.keys(ut.list||{}).length:0)===1})?et=4:et=6;return{block:de,target:Ee,height:Fe,hasDirectToTarget:Ne,hasConnectionToSecond:Ge,secondColTargets:nt,priority:et}});D.sort((de,Ee)=>{var Je,Ne;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(((Ne=Ee.block.list[d])==null?void 0:Ne.reduce((Ge,nt)=>Ge+parseFloat(nt.amountIn||"0"),0))||0)-je});const F=be.some(de=>(de.originalTarget||de.target)===Ce&&de.list&&de.list[d]),K=le.some(de=>de.list&&de.list[d]);let te=F?Dr+wo:Dr;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}`,Fe=g.get(je)||0;te+=Fe+ts}else te+=wo}K&&D.length>0&&(D[0].hasDirectToTarget&&te<=Dr+wo?te+=50:te+=ts);let Q=te;D.forEach((de,Ee)=>{const je=`0-${de.block.target}`,Fe=g.get(je)||0;k.set(je,{...de.block,id:je,top:Q,left:A,height:Fe,width:yi,columnIndex:0}),Ee<D.length-1&&(Q+=Fe+ts)});const G=[],he=le.find(de=>de.list&&de.list[d]);he&&G.push(he),D.forEach(de=>{de.secondColTargets.forEach(Ee=>{const je=le.find(Fe=>(Fe.originalTarget||Fe.target)===Ee);je&&!G.some(Fe=>Fe.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?Dr+wo:Dr;D.some(de=>de.hasDirectToTarget&&de.hasConnectionToSecond)&&(X+=wo);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}`,Fe=g.get(je)||0;Ee===0&&U>0&&(K?oe+=wo:oe+=U*120+U*ts),k.set(je,{...de,id:je,top:oe,left:A+yi+Ju,height:Fe,width:yi,columnIndex:1}),oe+=Fe+ts});let ge=Dr;be.forEach(de=>{const Ee=`2-${de.target}`,je=g.get(Ee)||0;k.set(Ee,{...de,id:Ee,top:ge,left:A+2*yi+2*Ju,height:je,width:yi,columnIndex:2}),ge+=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((A,k)=>{A.forEach(M=>{const g=M.originalTarget||M.target;if(M.list&&M.list[m]){const b=M.list[m].reduce((P,ue)=>P+parseFloat(ue.amountIn||"0"),0);E.push({target:g,amountIn:b,colIndex:k})}})}),E.length>0){const A=E.reduce((g,b)=>g+b.amountIn,0),k=[];E.forEach(({amountIn:g})=>{const b=A>0?Tl(Ve(g).div(A).mul(100).toString(),0):0;k.push(Number(b)||1)});const M=Al(k);E.forEach(({target:g},b)=>{var ue;const P=((ue=M[b])==null?void 0:ue.toString())||"0";x[m]||(x[m]={}),x[m][g]={fromPercent:P}})}return h.length>0&&h[0].forEach(k=>{const M=k.originalTarget||k.target,g=`0-${M}`,b=[];let P=!1;if(h.length>1&&(P=h[1].some(ie=>(ie.originalTarget||ie.target)===M)),P)h[1].forEach(ie=>{const le=ie.originalTarget||ie.target;if(ie.list&&ie.list[M]){const be=ie.list[M].reduce((Ce,D)=>Ce+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 Ce=le.list[M].reduce((D,F)=>D+parseFloat(F.amountIn||"0"),0);b.push({target:be,amountIn:Ce})}});if(b.length>0){const ue=b.reduce((be,Ce)=>be+Ce.amountIn,0),ie=[];b.forEach(({amountIn:be})=>{const Ce=ue>0?Tl(Ve(be).div(ue).mul(100).toString(),0):0;ie.push(Number(Ce)||1)});const le=Al(ie);b.forEach(({target:be},Ce)=>{const D=le[Ce];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,Ce)=>be+parseFloat(Ce.amountIn||"0"),0);b.push({target:ie,amountIn:le})}}),b.length>0){const ue=b.reduce((be,Ce)=>be+Ce.amountIn,0),ie=[];b.forEach(({amountIn:be})=>{const Ce=ue>0?Tl(Ve(be).div(ue).mul(100).toString(),0):0;ie.push(Number(Ce)||1)});const le=Al(ie);b.forEach(({target:be},Ce)=>{const D=le[Ce];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,Ce,D;const A=[],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=(Ce=h[m])==null?void 0:Ce[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?A.push({from:m,to:F.id,fromX:pa,fromY:F.top+F.height/2,toX:F.left-En,toY:F.top+F.height/2,fromPercent:K,isStart:!0}):A.push({from:m,to:F.id,fromX:pa,fromY:Dr+10,toX:F.left-En,toY:Dr+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?A.push({from:m,to:G.id,fromX:pa,fromY:G.top+G.height/2,toX:G.left-En,toY:G.top+G.height/2,fromPercent:X,isStart:!0}):A.push({from:m,to:G.id,fromX:pa,fromY:G.top+10,toX:G.left-En,toY:G.top+10,fromPercent:X,isStart:!0}):A.push({from:m,to:G.id,fromX:pa,fromY:G.top+G.height/2,toX:G.left-En,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 he=te.list||{};Object.entries(he).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,ge=M.get(oe)||0;M.set(oe,ge+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 he=te.list||{};Object.entries(he).forEach(([X,J])=>{var je,Fe,Je,Ne,Ge,nt,et,Ct,Rt,He,pt,ut,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,ge=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=(Fe=h[`${U.columnIndex}-${U.originalTarget||U.target}`])==null?void 0:Fe[Q])==null?void 0:Je.fromPercent)||"0";A.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(ge>=G.top&&ge<=G.top+G.height){const st=((Ge=(Ne=h[`${U.columnIndex}-${U.originalTarget||U.target}`])==null?void 0:Ne[Q])==null?void 0:Ge.fromPercent)||"0";A.push({from:U.id,to:G.id,fromX:U.left+U.width,fromY:ge,toX:G.left-En,toY:ge,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 Pt=((et=(nt=h[`${U.columnIndex}-${U.originalTarget||U.target}`])==null?void 0:nt[Q])==null?void 0:et.fromPercent)||"0";A.push({from:U.id,to:G.id,fromX:U.left+U.width,fromY:yt,toX:G.left-En,toY:yt,fromPercent:Pt}),st=!0;break}st||(de=!0)}}else if(ge>=G.top&&ge<=G.top+G.height){const gt=((Rt=(Ct=h[`${U.columnIndex}-${U.originalTarget||U.target}`])==null?void 0:Ct[Q])==null?void 0:Rt.fromPercent)||"0";A.push({from:U.id,to:G.id,fromX:U.left+U.width,fromY:ge,toX:G.left,toY:ge,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";A.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=(ut=h[`${U.columnIndex}-${U.originalTarget||U.target}`])==null?void 0:ut[Q])==null?void 0:tt.fromPercent)||"0",st=M.get(oe)||1,yt=g.get(oe)||0,Pt=50,mt=U.top+10,It=U.height-20,$t=st>3?Math.min(Pt,It/Math.max(1,st-1)):Pt,Ke=mt+yt*$t;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 Lt=U.left+U.width/2,L=U.top;A.push({from:U.id,to:G.id,fromX:Lt,fromY:L,toX:G.left,toY:Dr+10,fromPercent:gt,segments:[{x1:Lt,y1:L,x2:Lt,y2:Dr+10},{x1:Lt,y1:Dr+10,x2:G.left-En,y2:Dr+10}]})}else G.top>U.top+U.height?A.push({from:U.id,to:G.id,fromX:U.left+U.width,fromY:Ke,toX:U.left+U.width+br,toY:Ke,fromPercent:gt,segments:[{x1:U.left+U.width,y1:Ke,x2:U.left+U.width+br,y2:Ke},{x1:U.left+U.width+br,y1:Ke,x2:U.left+U.width+br,y2:G.top+20},{x1:U.left+U.width+br,y1:G.top+20,x2:G.left,y2:G.top+20}]}):A.push({from:U.id,to:G.id,fromX:U.left+U.width,fromY:Ke,toX:U.left+U.width+br,toY:Ke,fromPercent:gt,segments:[{x1:U.left+U.width,y1:Ke,x2:U.left+U.width+br,y2:Ke},{x1:U.left+U.width+br,y1:Ke,x2:U.left+U.width+br,y2:G.top+G.height-20},{x1:U.left+U.width+br,y1:G.top+G.height-20,x2:G.left-En,y2:G.top+G.height-20}]})}else x.length===3&&U.columnIndex===1&&G.columnIndex===2&&G.top<U.top?A.push({from:U.id,to:G.id,fromX:U.left+U.width,fromY:Ke,toX:G.left+G.width/2,toY:Ke,fromPercent:gt,segments:[{x1:U.left+U.width,y1:Ke,x2:G.left+G.width/2,y2:Ke},{x1:G.left+G.width/2,y1:Ke,x2:G.left+G.width/2,y2:G.top+G.height+En}]}):G.top>U.top+U.height?A.push({from:U.id,to:G.id,fromX:U.left+U.width,fromY:Ke,toX:U.left+U.width+br,toY:Ke,fromPercent:gt,segments:[{x1:U.left+U.width,y1:Ke,x2:U.left+U.width+br,y2:Ke},{x1:U.left+U.width+br,y1:Ke,x2:U.left+U.width+br,y2:G.top+20},{x1:U.left+U.width+br,y1:G.top+20,x2:G.left-En,y2:G.top+20}]}):A.push({from:U.id,to:G.id,fromX:U.left+U.width,fromY:Ke,toX:U.left+U.width+br,toY:Ke,fromPercent:gt,segments:[{x1:U.left+U.width,y1:Ke,x2:U.left+U.width+br,y2:Ke},{x1:U.left+U.width+br,y1:Ke,x2:U.left+U.width+br,y2:G.top+G.height-20},{x1:U.left+U.width+br,y1:G.top+G.height-20,x2:G.left-En,y2:G.top+G.height-20}]})}})});const b=Math.max(...Array.from(d.values()).map(F=>F.columnIndex)),P=Array.from(d.values()).filter(F=>F.columnIndex===b);if(P.length>0){const F=P[0],K=F.top+F.height/2;A.push({from:F.id,to:"final",fromX:F.left+F.width,fromY:K,toX:lv-pa,toY:K,fromPercent:"100",isFinal:!0})}return{edges:A}}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=Iy((f==null?void 0:f.coin_type)||t||""),m=Iy((p==null?void 0:p.coin_type)||r||""),x=C(h,d,m,3),{nodesMap:E,orderedNodeColume:A}=O(x,d,h);S(A);const k=j(A,h,d),{edges:M}=B(k,E,d,A),g=[...E.values()],b=H([...E.values()])+Dr+32;l(b),o(g),c(M);const P=Array.from(new Set([...E.values()].map(ie=>ie.originalTarget||ie.target)));fe([...P,d])},{getTokenListInfo:ne}=rc(),[me,se]=ve.useState(new Map),fe=async h=>{const d=await ne(h);d&&(d==null?void 0:d.size)>0&&se(d)};ve.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=PK*2+NK;const m=Object.entries(h);return m.forEach(([x,E],A)=>{d+=DK*2,d+=$K,d+=10,E.forEach(k=>{d+=BK})}),d+((m==null?void 0:m.length)-1)*LK+10}return{newFormatSwapRouter:n,nodes:s,edges:a,tokenMap:me,panelHeight:u,getAllProviders:z,allProviders:v,resultColumes:y}}function UK({themeType:e}){const t=e=="Light"?Nt("/images/logo_light@2x.png"):Nt("/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 Sg({baseToken:e,quoteToken:t,baseAmount:r,quoteAmount:n,loading:i,fontSize:s="14px"}){const[o,a]=ve.useState(!0),c=K7(o,r,n);return _.jsxs("div",{className:"current-price-block",style:{cursor:"pointer"},onClick:()=>{a(!o)},children:[_.jsx(kr,{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"," ",Vr(o?e==null?void 0:e.symbol:t==null?void 0:t.symbol)," ","="," ",i?_.jsx(ta,{className:"custom-skeleton",style:{height:"16px",width:"40px",marginLeft:"2px",marginRight:"2px"}}):ln(c,t==null?void 0:t.decimals)," ",Vr(o?t==null?void 0:t.symbol:e==null?void 0:e.symbol)]}),_.jsx(kr,{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 sc(){const[e,t]=ve.useState(window.innerWidth),r=xg(()=>{t(window.innerWidth)},300);ve.useEffect(()=>(window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r)}),[]);const n=ve.useMemo(()=>e<810,[e]);return{windowWidth:e,isApp:n}}function xd({content:e,children:t,position:r,autoSwitchTooltip:n=!1,borderRadius:i="8px"}){const{isApp:s}=sc();return s&&n?_.jsxs(vs.Root,{children:[_.jsx(vs.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(vs.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(Go,{content:e,position:r,borderRadius:i,children:t})}function FK({pr:e="8px",pl:t="8px",value:r,isLoading:n}){const{isApp:i}=sc();return _.jsxs("div",{className:"swap-info-between",style:{paddingLeft:t,paddingRight:e},children:[_.jsxs("div",{className:"left",children:[_.jsx("span",{children:"Overlay Fee"}),_.jsx(xd,{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(ta,{className:"custom-skeleton",style:{height:"18px",width:"80px"}}):_.jsx("div",{className:"right",children:r?`${Ve(r).mul(100).toString()}%`:""})]})}function Z7(e,t,r,n){const{getTokenPrice:i}=Ru(),s=i(e==null?void 0:e.coin_type),o=i(t==null?void 0:t.coin_type),a=K7(!0,r,n),c=ve.useMemo(()=>{if(o&&s)return Ve(s.price).div(o.price).toString()},[s==null?void 0:s.price,o==null?void 0:o.price]),u=ve.useMemo(()=>{if(c&&+a)return Ve(a).sub(c).div(a).mul(100).toFixed(10)},[c,a]),l=ve.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=ve.useMemo(()=>!s||!o||s.market==="cetus"||o.market==="cetus",[s,o]),p=ve.useMemo(()=>f?!1:u&&Ve(u).lt(0)?Ve(u).abs().gt(5):!1,[u,f]),v=ve.useMemo(()=>f?!1:u&&Ve(u).lt(0)?Ve(u).abs().gt(10):!1,[u,f]),w=ve.useMemo(()=>{let y,S="yellow";if(f)return{priceImpactText:void 0,textColor:"yellow"};if(u)if(Ve(u).gt(0))S="green",Ve(u).lt(.1)?y="< 0.1% cheaper than":y=`${ln(u,2,!0,Fr.ROUND_UP)}% cheaper than`;else if(Ve(u).eq(0))y="0%",S="green";else{const C=Ve(u).abs();C.lte(5)?(S="green",y=`Within ${ln(C.toString(),2,!0,Fr.ROUND_UP)}%`):C.lte(10)?(S="yellow",y=`${ln(C.toString(),2,!0,Fr.ROUND_UP)}% more than`):C.lte(100)?(S="red",y=`${ln(C.toString(),2,!0,Fr.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 Q7({isLoading:e,routerData:t,noTips:r}){const{fromCoin:n,toCoin:i,fromAmount:s,toAmount:o}=rn();sc();const{priceImpact:a,sources:c,marketPrice:u,priceImpactTextInfo:l,showIncalculable:f}=Z7(n,i,t==null?void 0:t.fromAmountUi,t==null?void 0:t.toAmountUi);return _.jsxs(_.Fragment,{children:[!r&&Ve(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(xd,{autoSwitchTooltip:!0,position:"top",content:_.jsx(VK,{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(ta,{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(Go,{content:_.jsx("span",{style:{fontSize:"12px",color:"var(--cs-text-primary)"},children:Zx[p]}),position:"top",delay:300,children:_.jsx(kr,{src:CF[p],haveBorder:!1,style:{width:"16px",height:"16px"}})},p))})]})]})]})]})}function VK({fromToken:e,toToken:t,baseAmount:r,quoteAmount:n,sources:i,showIncalculable:s}){const{isApp:o}=sc();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(Sg,{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=>Zx[a]+" ").join("")})]})]})}function eE({pr:e="8px",pl:t="8px",amountLimit:r,isLoading:n}){const{fromCoin:i,toCoin:s,byAmountIn:o}=rn();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(ta,{className:"custom-skeleton",style:{height:"18px",width:"80px"}}):_.jsxs("div",{className:"right",children:[ln(r,o?s==null?void 0:s.decimals:i==null?void 0:i.decimals,!1,Fr.ROUND_DOWN)," ",Vr(o?(s==null?void 0:s.symbol)||"":(i==null?void 0:i.symbol)||"")]})]})}function zK({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(Qx,{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 qK({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 Eg({title:e,backClick:t}){return _.jsxs("div",{className:"cs-have-back-header",children:[_.jsx(qK,{onClick:t}),_.jsx("span",{className:"title",children:e})]})}const Zu=globalThis||void 0||self;var WK=typeof Zu=="object"&&Zu&&Zu.Object===Object&&Zu;const tE=WK;var GK=typeof self=="object"&&self&&self.Object===Object&&self,HK=tE||GK||Function("return this")();const qi=HK;var KK=qi.Symbol;const Fi=KK;var rE=Object.prototype,YK=rE.hasOwnProperty,XK=rE.toString,xc=Fi?Fi.toStringTag:void 0;function JK(e){var t=YK.call(e,xc),r=e[xc];try{e[xc]=void 0;var n=!0}catch{}var i=XK.call(e);return n&&(t?e[xc]=r:delete e[xc]),i}var ZK=Object.prototype,QK=ZK.toString;function eY(e){return QK.call(e)}var tY="[object Null]",rY="[object Undefined]",fv=Fi?Fi.toStringTag:void 0;function oc(e){return e==null?e===void 0?rY:tY:fv&&fv in Object(e)?JK(e):eY(e)}function ao(e){return e!=null&&typeof e=="object"}var nY="[object Symbol]";function iu(e){return typeof e=="symbol"||ao(e)&&oc(e)==nY}function jl(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 iY=Array.isArray;const mn=iY;var sY=1/0,dv=Fi?Fi.prototype:void 0,hv=dv?dv.toString:void 0;function nE(e){if(typeof e=="string")return e;if(mn(e))return jl(e,nE)+"";if(iu(e))return hv?hv.call(e):"";var t=e+"";return t=="0"&&1/e==-sY?"-0":t}function ac(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function iE(e){return e}var oY="[object AsyncFunction]",aY="[object Function]",cY="[object GeneratorFunction]",uY="[object Proxy]";function sE(e){if(!ac(e))return!1;var t=oc(e);return t==aY||t==cY||t==oY||t==uY}var lY=qi["__core-js_shared__"];const kh=lY;var pv=function(){var e=/[^.]+$/.exec(kh&&kh.keys&&kh.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function fY(e){return!!pv&&pv in e}var dY=Function.prototype,hY=dY.toString;function ra(e){if(e!=null){try{return hY.call(e)}catch{}try{return e+""}catch{}}return""}var pY=/[\\^$.*+?()[\]{}|]/g,mY=/^\[object .+?Constructor\]$/,gY=Function.prototype,yY=Object.prototype,vY=gY.toString,bY=yY.hasOwnProperty,wY=RegExp("^"+vY.call(bY).replace(pY,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function _Y(e){if(!ac(e)||fY(e))return!1;var t=sE(e)?wY:mY;return t.test(ra(e))}function xY(e,t){return e==null?void 0:e[t]}function na(e,t){var r=xY(e,t);return _Y(r)?r:void 0}var SY=na(qi,"WeakMap");const Yp=SY;var mv=Object.create,EY=function(){function e(){}return function(t){if(!ac(t))return{};if(mv)return mv(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();const TY=EY;function AY(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var CY=function(){try{var e=na(Object,"defineProperty");return e({},"",{}),e}catch{}}();const gv=CY;function IY(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}var MY=9007199254740991,OY=/^(?:0|[1-9]\d*)$/;function oE(e,t){var r=typeof e;return t=t??MY,!!t&&(r=="number"||r!="symbol"&&OY.test(e))&&e>-1&&e%1==0&&e<t}function aE(e,t,r){t=="__proto__"&&gv?gv(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function Tg(e,t){return e===t||e!==e&&t!==t}var jY=Object.prototype,kY=jY.hasOwnProperty;function cE(e,t,r){var n=e[t];(!(kY.call(e,t)&&Tg(n,r))||r===void 0&&!(t in e))&&aE(e,t,r)}function Sd(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?aE(r,a,c):cE(r,a,c)}return r}var RY=9007199254740991;function Ag(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=RY}function Ed(e){return e!=null&&Ag(e.length)&&!sE(e)}var PY=Object.prototype;function Cg(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||PY;return e===r}function NY(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var DY="[object Arguments]";function yv(e){return ao(e)&&oc(e)==DY}var uE=Object.prototype,$Y=uE.hasOwnProperty,LY=uE.propertyIsEnumerable,BY=yv(function(){return arguments}())?yv:function(e){return ao(e)&&$Y.call(e,"callee")&&!LY.call(e,"callee")};const lE=BY;function UY(){return!1}var fE=typeof exports=="object"&&exports&&!exports.nodeType&&exports,vv=fE&&typeof module=="object"&&module&&!module.nodeType&&module,FY=vv&&vv.exports===fE,bv=FY?qi.Buffer:void 0,VY=bv?bv.isBuffer:void 0,zY=VY||UY;const _f=zY;var qY="[object Arguments]",WY="[object Array]",GY="[object Boolean]",HY="[object Date]",KY="[object Error]",YY="[object Function]",XY="[object Map]",JY="[object Number]",ZY="[object Object]",QY="[object RegExp]",eX="[object Set]",tX="[object String]",rX="[object WeakMap]",nX="[object ArrayBuffer]",iX="[object DataView]",sX="[object Float32Array]",oX="[object Float64Array]",aX="[object Int8Array]",cX="[object Int16Array]",uX="[object Int32Array]",lX="[object Uint8Array]",fX="[object Uint8ClampedArray]",dX="[object Uint16Array]",hX="[object Uint32Array]",tr={};tr[sX]=tr[oX]=tr[aX]=tr[cX]=tr[uX]=tr[lX]=tr[fX]=tr[dX]=tr[hX]=!0;tr[qY]=tr[WY]=tr[nX]=tr[GY]=tr[iX]=tr[HY]=tr[KY]=tr[YY]=tr[XY]=tr[JY]=tr[ZY]=tr[QY]=tr[eX]=tr[tX]=tr[rX]=!1;function pX(e){return ao(e)&&Ag(e.length)&&!!tr[oc(e)]}function Td(e){return function(t){return e(t)}}var dE=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Uc=dE&&typeof module=="object"&&module&&!module.nodeType&&module,mX=Uc&&Uc.exports===dE,Rh=mX&&tE.process,gX=function(){try{var e=Uc&&Uc.require&&Uc.require("util").types;return e||Rh&&Rh.binding&&Rh.binding("util")}catch{}}();const Wa=gX;var wv=Wa&&Wa.isTypedArray,yX=wv?Td(wv):pX;const hE=yX;var vX=Object.prototype,bX=vX.hasOwnProperty;function pE(e,t){var r=mn(e),n=!r&&lE(e),i=!r&&!n&&_f(e),s=!r&&!n&&!i&&hE(e),o=r||n||i||s,a=o?NY(e.length,String):[],c=a.length;for(var u in e)(t||bX.call(e,u))&&!(o&&(u=="length"||i&&(u=="offset"||u=="parent")||s&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||oE(u,c)))&&a.push(u);return a}function mE(e,t){return function(r){return e(t(r))}}var wX=mE(Object.keys,Object);const _X=wX;var xX=Object.prototype,SX=xX.hasOwnProperty;function EX(e){if(!Cg(e))return _X(e);var t=[];for(var r in Object(e))SX.call(e,r)&&r!="constructor"&&t.push(r);return t}function Pu(e){return Ed(e)?pE(e):EX(e)}function TX(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var AX=Object.prototype,CX=AX.hasOwnProperty;function IX(e){if(!ac(e))return TX(e);var t=Cg(e),r=[];for(var n in e)n=="constructor"&&(t||!CX.call(e,n))||r.push(n);return r}function Ig(e){return Ed(e)?pE(e,!0):IX(e)}var MX=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,OX=/^\w*$/;function Mg(e,t){if(mn(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||iu(e)?!0:OX.test(e)||!MX.test(e)||t!=null&&e in Object(t)}var jX=na(Object,"create");const su=jX;function kX(){this.__data__=su?su(null):{},this.size=0}function RX(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var PX="__lodash_hash_undefined__",NX=Object.prototype,DX=NX.hasOwnProperty;function $X(e){var t=this.__data__;if(su){var r=t[e];return r===PX?void 0:r}return DX.call(t,e)?t[e]:void 0}var LX=Object.prototype,BX=LX.hasOwnProperty;function UX(e){var t=this.__data__;return su?t[e]!==void 0:BX.call(t,e)}var FX="__lodash_hash_undefined__";function VX(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=su&&t===void 0?FX:t,this}function Ho(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])}}Ho.prototype.clear=kX;Ho.prototype.delete=RX;Ho.prototype.get=$X;Ho.prototype.has=UX;Ho.prototype.set=VX;function zX(){this.__data__=[],this.size=0}function Ad(e,t){for(var r=e.length;r--;)if(Tg(e[r][0],t))return r;return-1}var qX=Array.prototype,WX=qX.splice;function GX(e){var t=this.__data__,r=Ad(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():WX.call(t,r,1),--this.size,!0}function HX(e){var t=this.__data__,r=Ad(t,e);return r<0?void 0:t[r][1]}function KX(e){return Ad(this.__data__,e)>-1}function YX(e,t){var r=this.__data__,n=Ad(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function Is(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])}}Is.prototype.clear=zX;Is.prototype.delete=GX;Is.prototype.get=HX;Is.prototype.has=KX;Is.prototype.set=YX;var XX=na(qi,"Map");const ou=XX;function JX(){this.size=0,this.__data__={hash:new Ho,map:new(ou||Is),string:new Ho}}function ZX(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Cd(e,t){var r=e.__data__;return ZX(t)?r[typeof t=="string"?"string":"hash"]:r.map}function QX(e){var t=Cd(this,e).delete(e);return this.size-=t?1:0,t}function eJ(e){return Cd(this,e).get(e)}function tJ(e){return Cd(this,e).has(e)}function rJ(e,t){var r=Cd(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function Ms(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])}}Ms.prototype.clear=JX;Ms.prototype.delete=QX;Ms.prototype.get=eJ;Ms.prototype.has=tJ;Ms.prototype.set=rJ;var nJ="Expected a function";function Og(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(nJ);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(Og.Cache||Ms),r}Og.Cache=Ms;var iJ=500;function sJ(e){var t=Og(e,function(n){return r.size===iJ&&r.clear(),n}),r=t.cache;return t}var oJ=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,aJ=/\\(\\)?/g,cJ=sJ(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(oJ,function(r,n,i,s){t.push(i?s.replace(aJ,"$1"):n||r)}),t});const uJ=cJ;function lJ(e){return e==null?"":nE(e)}function gE(e,t){return mn(e)?e:Mg(e,t)?[e]:uJ(lJ(e))}var fJ=1/0;function Id(e){if(typeof e=="string"||iu(e))return e;var t=e+"";return t=="0"&&1/e==-fJ?"-0":t}function jg(e,t){t=gE(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[Id(t[r++])];return r&&r==n?e:void 0}function dJ(e,t,r){var n=e==null?void 0:jg(e,t);return n===void 0?r:n}function yE(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var hJ=mE(Object.getPrototypeOf,Object);const vE=hJ;function pJ(){this.__data__=new Is,this.size=0}function mJ(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function gJ(e){return this.__data__.get(e)}function yJ(e){return this.__data__.has(e)}var vJ=200;function bJ(e,t){var r=this.__data__;if(r instanceof Is){var n=r.__data__;if(!ou||n.length<vJ-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Ms(n)}return r.set(e,t),this.size=r.size,this}function Pi(e){var t=this.__data__=new Is(e);this.size=t.size}Pi.prototype.clear=pJ;Pi.prototype.delete=mJ;Pi.prototype.get=gJ;Pi.prototype.has=yJ;Pi.prototype.set=bJ;function wJ(e,t){return e&&Sd(t,Pu(t),e)}function _J(e,t){return e&&Sd(t,Ig(t),e)}var bE=typeof exports=="object"&&exports&&!exports.nodeType&&exports,_v=bE&&typeof module=="object"&&module&&!module.nodeType&&module,xJ=_v&&_v.exports===bE,xv=xJ?qi.Buffer:void 0,Sv=xv?xv.allocUnsafe:void 0;function SJ(e,t){if(t)return e.slice();var r=e.length,n=Sv?Sv(r):new e.constructor(r);return e.copy(n),n}function wE(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 _E(){return[]}var EJ=Object.prototype,TJ=EJ.propertyIsEnumerable,Ev=Object.getOwnPropertySymbols,AJ=Ev?function(e){return e==null?[]:(e=Object(e),wE(Ev(e),function(t){return TJ.call(e,t)}))}:_E;const kg=AJ;function CJ(e,t){return Sd(e,kg(e),t)}var IJ=Object.getOwnPropertySymbols,MJ=IJ?function(e){for(var t=[];e;)yE(t,kg(e)),e=vE(e);return t}:_E;const xE=MJ;function OJ(e,t){return Sd(e,xE(e),t)}function SE(e,t,r){var n=t(e);return mn(e)?n:yE(n,r(e))}function Xp(e){return SE(e,Pu,kg)}function jJ(e){return SE(e,Ig,xE)}var kJ=na(qi,"DataView");const Jp=kJ;var RJ=na(qi,"Promise");const Zp=RJ;var PJ=na(qi,"Set");const Qp=PJ;var Tv="[object Map]",NJ="[object Object]",Av="[object Promise]",Cv="[object Set]",Iv="[object WeakMap]",Mv="[object DataView]",DJ=ra(Jp),$J=ra(ou),LJ=ra(Zp),BJ=ra(Qp),UJ=ra(Yp),Eo=oc;(Jp&&Eo(new Jp(new ArrayBuffer(1)))!=Mv||ou&&Eo(new ou)!=Tv||Zp&&Eo(Zp.resolve())!=Av||Qp&&Eo(new Qp)!=Cv||Yp&&Eo(new Yp)!=Iv)&&(Eo=function(e){var t=oc(e),r=t==NJ?e.constructor:void 0,n=r?ra(r):"";if(n)switch(n){case DJ:return Mv;case $J:return Tv;case LJ:return Av;case BJ:return Cv;case UJ:return Iv}return t});const au=Eo;var FJ=Object.prototype,VJ=FJ.hasOwnProperty;function zJ(e){var t=e.length,r=new e.constructor(t);return t&&typeof e[0]=="string"&&VJ.call(e,"index")&&(r.index=e.index,r.input=e.input),r}var qJ=qi.Uint8Array;const xf=qJ;function Rg(e){var t=new e.constructor(e.byteLength);return new xf(t).set(new xf(e)),t}function WJ(e,t){var r=t?Rg(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}var GJ=/\w*$/;function HJ(e){var t=new e.constructor(e.source,GJ.exec(e));return t.lastIndex=e.lastIndex,t}var Ov=Fi?Fi.prototype:void 0,jv=Ov?Ov.valueOf:void 0;function KJ(e){return jv?Object(jv.call(e)):{}}function YJ(e,t){var r=t?Rg(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var XJ="[object Boolean]",JJ="[object Date]",ZJ="[object Map]",QJ="[object Number]",eZ="[object RegExp]",tZ="[object Set]",rZ="[object String]",nZ="[object Symbol]",iZ="[object ArrayBuffer]",sZ="[object DataView]",oZ="[object Float32Array]",aZ="[object Float64Array]",cZ="[object Int8Array]",uZ="[object Int16Array]",lZ="[object Int32Array]",fZ="[object Uint8Array]",dZ="[object Uint8ClampedArray]",hZ="[object Uint16Array]",pZ="[object Uint32Array]";function mZ(e,t,r){var n=e.constructor;switch(t){case iZ:return Rg(e);case XJ:case JJ:return new n(+e);case sZ:return WJ(e,r);case oZ:case aZ:case cZ:case uZ:case lZ:case fZ:case dZ:case hZ:case pZ:return YJ(e,r);case ZJ:return new n;case QJ:case rZ:return new n(e);case eZ:return HJ(e);case tZ:return new n;case nZ:return KJ(e)}}function gZ(e){return typeof e.constructor=="function"&&!Cg(e)?TY(vE(e)):{}}var yZ="[object Map]";function vZ(e){return ao(e)&&au(e)==yZ}var kv=Wa&&Wa.isMap,bZ=kv?Td(kv):vZ;const wZ=bZ;var _Z="[object Set]";function xZ(e){return ao(e)&&au(e)==_Z}var Rv=Wa&&Wa.isSet,SZ=Rv?Td(Rv):xZ;const EZ=SZ;var TZ=1,AZ=2,CZ=4,EE="[object Arguments]",IZ="[object Array]",MZ="[object Boolean]",OZ="[object Date]",jZ="[object Error]",TE="[object Function]",kZ="[object GeneratorFunction]",RZ="[object Map]",PZ="[object Number]",AE="[object Object]",NZ="[object RegExp]",DZ="[object Set]",$Z="[object String]",LZ="[object Symbol]",BZ="[object WeakMap]",UZ="[object ArrayBuffer]",FZ="[object DataView]",VZ="[object Float32Array]",zZ="[object Float64Array]",qZ="[object Int8Array]",WZ="[object Int16Array]",GZ="[object Int32Array]",HZ="[object Uint8Array]",KZ="[object Uint8ClampedArray]",YZ="[object Uint16Array]",XZ="[object Uint32Array]",Zt={};Zt[EE]=Zt[IZ]=Zt[UZ]=Zt[FZ]=Zt[MZ]=Zt[OZ]=Zt[VZ]=Zt[zZ]=Zt[qZ]=Zt[WZ]=Zt[GZ]=Zt[RZ]=Zt[PZ]=Zt[AE]=Zt[NZ]=Zt[DZ]=Zt[$Z]=Zt[LZ]=Zt[HZ]=Zt[KZ]=Zt[YZ]=Zt[XZ]=!0;Zt[jZ]=Zt[TE]=Zt[BZ]=!1;function kl(e,t,r,n,i,s){var o,a=t&TZ,c=t&AZ,u=t&CZ;if(r&&(o=i?r(e,n,i,s):r(e)),o!==void 0)return o;if(!ac(e))return e;var l=mn(e);if(l){if(o=zJ(e),!a)return AY(e,o)}else{var f=au(e),p=f==TE||f==kZ;if(_f(e))return SJ(e,a);if(f==AE||f==EE||p&&!i){if(o=c||p?{}:gZ(e),!a)return c?OJ(e,_J(o,e)):CJ(e,wJ(o,e))}else{if(!Zt[f])return i?e:{};o=mZ(e,f,a)}}s||(s=new Pi);var v=s.get(e);if(v)return v;s.set(e,o),EZ(e)?e.forEach(function(S){o.add(kl(S,t,r,S,e,s))}):wZ(e)&&e.forEach(function(S,C){o.set(C,kl(S,t,r,C,e,s))});var w=u?c?jJ:Xp:c?Ig:Pu,y=l?void 0:w(e);return IY(y||e,function(S,C){y&&(C=S,S=e[C]),cE(o,C,kl(S,t,r,C,e,s))}),o}var JZ=1,ZZ=4;function QZ(e){return kl(e,JZ|ZZ)}var eQ="__lodash_hash_undefined__";function tQ(e){return this.__data__.set(e,eQ),this}function rQ(e){return this.__data__.has(e)}function Sf(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new Ms;++t<r;)this.add(e[t])}Sf.prototype.add=Sf.prototype.push=tQ;Sf.prototype.has=rQ;function nQ(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 iQ(e,t){return e.has(t)}var sQ=1,oQ=2;function CE(e,t,r,n,i,s){var o=r&sQ,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&oQ?new Sf: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(!nQ(t,function(C,O){if(!iQ(v,O)&&(w===C||i(w,C,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 aQ(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}function cQ(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var uQ=1,lQ=2,fQ="[object Boolean]",dQ="[object Date]",hQ="[object Error]",pQ="[object Map]",mQ="[object Number]",gQ="[object RegExp]",yQ="[object Set]",vQ="[object String]",bQ="[object Symbol]",wQ="[object ArrayBuffer]",_Q="[object DataView]",Pv=Fi?Fi.prototype:void 0,Ph=Pv?Pv.valueOf:void 0;function xQ(e,t,r,n,i,s,o){switch(r){case _Q:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case wQ:return!(e.byteLength!=t.byteLength||!s(new xf(e),new xf(t)));case fQ:case dQ:case mQ:return Tg(+e,+t);case hQ:return e.name==t.name&&e.message==t.message;case gQ:case vQ:return e==t+"";case pQ:var a=aQ;case yQ:var c=n&uQ;if(a||(a=cQ),e.size!=t.size&&!c)return!1;var u=o.get(e);if(u)return u==t;n|=lQ,o.set(e,t);var l=CE(a(e),a(t),n,i,s,o);return o.delete(e),l;case bQ:if(Ph)return Ph.call(e)==Ph.call(t)}return!1}var SQ=1,EQ=Object.prototype,TQ=EQ.hasOwnProperty;function AQ(e,t,r,n,i,s){var o=r&SQ,a=Xp(e),c=a.length,u=Xp(t),l=u.length;if(c!=l&&!o)return!1;for(var f=c;f--;){var p=a[f];if(!(o?p in t:TQ.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 C=e[p],O=t[p];if(n)var j=o?n(O,C,p,t,e,s):n(C,O,p,e,t,s);if(!(j===void 0?C===O||i(C,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 CQ=1,Nv="[object Arguments]",Dv="[object Array]",Qu="[object Object]",IQ=Object.prototype,$v=IQ.hasOwnProperty;function MQ(e,t,r,n,i,s){var o=mn(e),a=mn(t),c=o?Dv:au(e),u=a?Dv:au(t);c=c==Nv?Qu:c,u=u==Nv?Qu:u;var l=c==Qu,f=u==Qu,p=c==u;if(p&&_f(e)){if(!_f(t))return!1;o=!0,l=!1}if(p&&!l)return s||(s=new Pi),o||hE(e)?CE(e,t,r,n,i,s):xQ(e,t,c,r,n,i,s);if(!(r&CQ)){var v=l&&$v.call(e,"__wrapped__"),w=f&&$v.call(t,"__wrapped__");if(v||w){var y=v?e.value():e,S=w?t.value():t;return s||(s=new Pi),i(y,S,r,n,s)}}return p?(s||(s=new Pi),AQ(e,t,r,n,i,s)):!1}function Md(e,t,r,n,i){return e===t?!0:e==null||t==null||!ao(e)&&!ao(t)?e!==e&&t!==t:MQ(e,t,r,n,Md,i)}var OQ=1,jQ=2;function kQ(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 Pi;if(n)var p=n(u,l,c,e,t,f);if(!(p===void 0?Md(l,u,OQ|jQ,n,f):p))return!1}}return!0}function IE(e){return e===e&&!ac(e)}function RQ(e){for(var t=Pu(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,IE(i)]}return t}function ME(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}function PQ(e){var t=RQ(e);return t.length==1&&t[0][2]?ME(t[0][0],t[0][1]):function(r){return r===e||kQ(r,e,t)}}function NQ(e,t){return e!=null&&t in Object(e)}function DQ(e,t,r){t=gE(t,e);for(var n=-1,i=t.length,s=!1;++n<i;){var o=Id(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&&Ag(i)&&oE(o,i)&&(mn(e)||lE(e)))}function $Q(e,t){return e!=null&&DQ(e,t,NQ)}var LQ=1,BQ=2;function UQ(e,t){return Mg(e)&&IE(t)?ME(Id(e),t):function(r){var n=dJ(r,e);return n===void 0&&n===t?$Q(r,e):Md(t,n,LQ|BQ)}}function FQ(e){return function(t){return t==null?void 0:t[e]}}function VQ(e){return function(t){return jg(t,e)}}function zQ(e){return Mg(e)?FQ(Id(e)):VQ(e)}function OE(e){return typeof e=="function"?e:e==null?iE:typeof e=="object"?mn(e)?UQ(e[0],e[1]):PQ(e):zQ(e)}function qQ(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 WQ=qQ();const GQ=WQ;function HQ(e,t){return e&&GQ(e,t,Pu)}function KQ(e,t){return function(r,n){if(r==null)return r;if(!Ed(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 YQ=KQ(HQ);const jE=YQ;function XQ(e,t){var r=[];return jE(e,function(n,i,s){t(n,i,s)&&r.push(n)}),r}function JQ(e,t){var r=mn(e)?wE:XQ;return r(e,OE(t))}function ZQ(e,t){var r=-1,n=Ed(e)?Array(e.length):[];return jE(e,function(i,s,o){n[++r]=t(i,s,o)}),n}function QQ(e,t){return Md(e,t)}function eee(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}function tee(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 ree(e,t,r){for(var n=-1,i=e.criteria,s=t.criteria,o=i.length,a=r.length;++n<o;){var c=tee(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 nee(e,t,r){t.length?t=jl(t,function(s){return mn(s)?function(o){return jg(o,s.length===1?s[0]:s)}:s}):t=[iE];var n=-1;t=jl(t,Td(OE));var i=ZQ(e,function(s,o,a){var c=jl(t,function(u){return u(s)});return{criteria:c,index:++n,value:s}});return eee(i,function(s,o){return ree(s,o,r)})}function iee(e,t,r,n){return e==null?[]:(mn(t)||(t=t==null?[]:[t]),r=n?void 0:r,mn(r)||(r=r==null?[]:[r]),nee(e,t,r))}function see({toBack:e,onSubmitClick:t,data:r}){const{fromCoin:n,toCoin:i}=rn(),s=ve.useRef(!1),{slippage:o}=en(),[a,c]=ve.useState(r),{fromAmountUi:u,toAmountUi:l,byAmountIn:f}=a,{amountLimit:p}=H7(o,a),{showPriceImpactTips:v,showPriceImpactWarn:w}=Z7(n,i,u,l),{priceAcceptRouterData:y}=nK(a),[S,C]=ve.useState(!1),[O,j]=ve.useState(!1);ve.useMemo(()=>f?i:n,[f]);const V=ve.useMemo(()=>y!==void 0,[y]),B=()=>{if(y){if(s.current)return;s.current=!0;const q=QZ(y);c(q),setTimeout(()=>{s.current=!1},300)}},H=ve.useMemo(()=>S?!1:!!w,[S,w]);return _.jsxs("div",{className:"secondary-dialog",children:[_.jsx(Eg,{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:io(u||"")}),_.jsx(kr,{src:n==null?void 0:n.logo_url,token:n,style:{width:"28px",height:"28px"}}),_.jsx("span",{className:"symbol",children:Vr((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:io(l||"")}),_.jsx(kr,{src:i==null?void 0:i.logo_url,token:i,style:{width:"28px",height:"28px"}}),_.jsx("span",{className:"symbol",children:Vr((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(Sg,{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(eE,{pl:"0px",pr:"0px",isLoading:!1,amountLimit:p}),_.jsx(Q7,{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:()=>{C(!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(Vm,{})}):"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 kE({allProviders:e}){const{isApp:t}=sc();return _.jsx(_.Fragment,{children:e==null?void 0:e.map(r=>{var n;return t?_.jsx(kr,{src:Bt==null?void 0:Bt[r],style:{width:"16px",height:"16px"},haveBorder:!1},r):_.jsx(Go,{content:_.jsx("div",{style:{color:"var(--cs-text-primary)"},children:((n=Lp[r])==null?void 0:n.name)||r}),position:"top",delay:300,children:_.jsx(kr,{src:Bt==null?void 0:Bt[r],style:{width:"16px",height:"16px"},haveBorder:!1})},r)})})}function Od(e){const{text:t,type:r,classType:n=""}=e,[i,s]=ve.useState(!1),{addCommonToast:o}=tc(),a=c=>{i||(td(c),V7(t,{debug:!1,message:"message"}),o("Copied"),s(!i))};return ve.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 ma=2;function oee({data:e,config:t={},originFromCoinType:r,originToCoinType:n,isWidget:i}){const{nodes:s,edges:o,tokenMap:a,panelHeight:c,resultColumes:u}=J7(e,r,n),l=ve.useRef(null),f={nodeWidth:176,searchStep:5,nodePadding:10,maxSearchDistance:50,arrowOffset:5,...t},p=ve.useMemo(()=>s==null?void 0:s.map(v=>{var C;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:(C=Object.values(v==null?void 0:v.list))==null?void 0:C.map((O,j)=>{const V=a==null?void 0:a.get(S[j]),B=`${Vr((V==null?void 0:V.symbol)||"",8)} > ${Vr((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?Tl(Ve(fe).div(H).mul(100).toString(),0):"0";q.push(Number(z)||1)});const ne=Al(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:lF(uF(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(uee,{edges:o,nodes:s,config:f}),_.jsx(lee,{data:p,isWidget:i})]})}function aee(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(cee(e,t,r,n,y.x1,y.y1,y.x2,y.y2))return!0;return!1}function cee(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 el(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)&&aee(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=C.top,m=C.top+C.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),C=c.find(z=>z.id===a.to);if(!S||!C)return`M${e},${t} L${r},${t==n?n:t}`;if(o){const z=C.top+C.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=C.top,H=C.top+C.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 me=S.top+S.height/2,se=C.left+C.width/2,fe=C.top+C.height;if(V-10<B){const z=S.left+S.width/2,N=S.top+S.height,h=C.top+C.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},${me} L${se},${me} L${se},${fe}`;return`M${e},${me} L${r},${me}`}function uee({edges:e,nodes:t,config:r}){var i,s,o,a;const n=ve.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}`,C=`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:ma,fill:"none"}),_.jsx("path",{d:C,stroke:"var(--cs-border)",strokeWidth:ma,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=el(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 me=q.substring(1).split(","),se=ne.substring(1).split(",");if(me.length===2&&se.length===2){const fe=parseFloat(me[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,C=f-y/2,O=p-S/2;return _.jsxs("g",{children:[_.jsx("path",{d:l,stroke:"var(--cs-border)",strokeWidth:ma,fill:"none",markerEnd:"url(#arrowhead)",strokeLinecap:"square",strokeLinejoin:"miter"}),_.jsx("rect",{x:C,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=el(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,C=f-y/2,O=p-S/2;return _.jsxs("g",{children:[_.jsx("path",{d:l,stroke:"var(--cs-border)",strokeWidth:ma,fill:"none",markerEnd:"url(#arrowhead)",strokeLinecap:"square",strokeLinejoin:"miter"}),_.jsx("rect",{x:C,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=el(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,C=f-y/2,O=p-S/2;return _.jsxs("g",{children:[_.jsx("path",{d:l,stroke:"var(--cs-border)",strokeWidth:ma,fill:"none",markerEnd:"url(#arrowhead)",strokeLinecap:"square",strokeLinejoin:"miter"}),_.jsx("rect",{x:C,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=el(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 me=q.substring(1).split(","),se=ne.substring(1).split(",");if(me.length===2&&se.length===2){const fe=parseFloat(me[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,C=f-y/2,O=p-S/2;return _.jsxs("g",{children:[_.jsx("path",{d:l,stroke:"var(--cs-border)",strokeWidth:ma,fill:"none",markerEnd:"url(#arrowhead)",strokeLinecap:"square",strokeLinejoin:"miter"}),_.jsx("rect",{x:C,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 lee({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(fee,{data:r,isWidget:t},r.target))})}function fee({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(xd,{autoSwitchTooltip:!0,position:"bottom",borderRadius:"12px",content:_.jsx(pee,{data:e}),children:_.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",height:"24px"},children:[_.jsx(kr,{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:Vr((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(dee,{data:n,isWidget:t},n.from))})]})}function dee({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(xd,{position:"bottom",content:_.jsx(hee,{data:n},n==null?void 0:n.id),children:_.jsxs("div",{style:{display:"flex",height:"22px",width:"142px",cursor:"pointer",alignItems:"center"},children:[_.jsx(kr,{src:(i=Lp[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=Lp[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 hee({data:e}){const{getExplorerUrl:t}=Qa();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(kr,{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(kr,{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:[Vr((e==null?void 0:e.fromSymbol)||"",8)," -"," ",Vr((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:td,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(Od,{text:(e==null?void 0:e.id)||""})]})]})]})}function pee({data:e}){const{getExplorerUrl:t}=Qa();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(kr,{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:Vr((e==null?void 0:e.targetSymbol)||"")})]}),_.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[_.jsx("a",{onClick:td,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(Od,{text:(e==null?void 0:e.originalTarget)||""})]})]})}function mee({toBack:e,data:t,allProviders:r}){const{fromCoin:n,toCoin:i,fromAmount:s,toAmount:o}=rn();return _.jsxs("div",{className:"route-dialog",children:[_.jsx(Eg,{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(kE,{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(kr,{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:io(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:io(o||"0")}),_.jsx("span",{style:{fontSize:"14px",fontWeight:"500",color:"var(--cs-text-primary)"},children:i==null?void 0:i.symbol}),_.jsx(kr,{src:i==null?void 0:i.logo_url,style:{width:"24px",height:"24px"}})]})]}),_.jsx(oee,{data:t})]})})]})}function gee({hasSubMenu:e,data:t,isLoading:r,allProviders:n}){const[i,s]=ve.useState(!1);return sc(),_.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(ta,{className:"custom-skeleton",style:{width:"80px",height:"18px"}}):_.jsxs("div",{className:"right",onClick:()=>{s(!0)},children:[_.jsx(kE,{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(mee,{data:t,toBack:()=>s(!1),allProviders:n})]})}function RE(){const{setCollectTokenMap:e,collectTokenMap:t}=Qo(),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=ve.useCallback(i=>t.get(i.coin_type)!==void 0,[t]);return{handleCollectToken:r,isCollectToken:n,collectTokenMap:t}}function yee(e){const{trustedTokenList:t}=ec(),{tokenBalanceObj:r,currentAccount:n}=nn(),{coinPriceObj:i}=q7(),{getTokenAmountValue:s}=Ru(),{fetchTokenInfo:o}=rc(),{currentTypeTab:a,showTokenList:c,setShowTokenList:u,combineTokenList:l,importTokenList:f,setComBineTokenList:p,setImportToken:v,setCurrentImportTokenData:w,setImportTokenIsLoading:y,currentImportTokenData:S,searchInput:C,setSearchInput:O,importTokenIsLoading:j,showTokenListIsLoading:V,setCurrentTypeTab:B,setCurrentPlatformTab:H}=Qo(),[q,ne]=ve.useState(!1);ve.useEffect(()=>{t&&(t==null?void 0:t.length)>0&&ne(!0)},[t]);const[me,se]=ve.useState(!1);ve.useEffect(()=>{Ey(i)||se(!0)},[i]);const fe=ve.useRef({}),[z,N]=ve.useState(!1);ve.useEffect(()=>{(!Ey(r)||!Fm(fe.current,r))&&(fe.current=r,N(!0))},[r]);const h=ve.useMemo(()=>(f==null?void 0:f.length)>1?f==null?void 0:f.map(ue=>{const ie=Cl(r==null?void 0:r[ue==null?void 0:ue.coin_type],ue),le=ie==null?void 0:ie.totalBalanceFormat,be=Ve(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 iee(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 JQ(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)||ws(te,!0).includes(ws(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(Gx(ue)){const ie=ue.trim(),le=xr(ie).full_address,be=await o(le);if(!be){u([]);return}const Ce=Cl(r==null?void 0:r[le],be),D=(Ce==null?void 0:Ce.totalBalanceFormat)||"0",F=Ve(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)}},A=ue=>{if(ue==="Default")g("All"),H("All");else{const ie=d(h,C);u(ie)}},k=()=>{if(S){const ue=v(S,!0),ie=d(ue,C);u(ie),w(void 0),O("")}},M=ue=>{const ie=v(ue,!1),le=d(ie,C);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,C);u(le)};ve.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=Cl(le,ie),Ce=(be==null?void 0:be.totalBalanceFormat)||"0",D=(be==null?void 0:be.displayBalance)||"0",F=Ve(Ce).gt("0")?s(ie==null?void 0:ie.coin_type,Ce):"0";ue.push({...ie,balance:D,rate:ln(F,4,!0)})}p(ue)}},[q,me,z,n==null?void 0:n.address,i]);const b=ve.useRef([]);ve.useEffect(()=>{if((l==null?void 0:l.length)>0&&!QQ(b.current,l)){b.current=l;const ue=d(l);e?h.find(le=>le.coin_type===e)!==void 0||a!=="Default"?(B("Imported"),A("Imported")):u(S?[S]:ue):u(ue)}},[l,e]);const P=ve.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},[C,c,S,j,V]);return{showTokenList:c,handleSearch:x,handleChangePlatform:g,currentImportTokenData:S,handleChangeType:A,handleImportClick:k,handleDeleteImportClick:M,isNoData:P}}function vee({tokenList:e,onHandleTokenAction:t}){return _.jsx("div",{className:"token-collect-list",children:e.map(r=>_.jsx(bee,{token:r,onHandleTokenAction:t},r.coin_type))})}function bee({token:e,onHandleTokenAction:t}){return _.jsxs("div",{className:"token-collect-item",onClick:()=>{t(e,"select_token")},children:[_.jsx(kr,{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 wee(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 _ee({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 Lv=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function xee(e,t){return!!(e===t||Lv(e)&&Lv(t))}function See(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!xee(e[r],t[r]))return!1;return!0}function Eee(e,t){t===void 0&&(t=See);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 e0(){return e0=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},e0.apply(null,arguments)}function Bv(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function t0(e,t){return t0=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},t0(e,t)}function Tee(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,t0(e,t)}var Uv=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function Aee(e,t){return!!(e===t||Uv(e)&&Uv(t))}function Cee(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!Aee(e[r],t[r]))return!1;return!0}function Nh(e,t){t===void 0&&(t=Cee);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 Fv(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 Iee=typeof performance=="object"&&typeof performance.now=="function",Vv=Iee?function(){return performance.now()}:function(){return Date.now()};function zv(e){cancelAnimationFrame(e.id)}function Mee(e,t){var r=Vv();function n(){Vv()-r>=t?e.call(null):i.id=requestAnimationFrame(n)}var i={id:requestAnimationFrame(n)};return i}var Dh=-1;function qv(e){if(e===void 0&&(e=!1),Dh===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),Dh=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Dh}var ga=null;function Wv(e){if(e===void 0&&(e=!1),ga===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?ga="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?ga="negative":ga="positive-ascending"),document.body.removeChild(t),ga}return ga}ei.env.NODE_ENV;var Oee=150,jee=function(t,r){return t},Rl=null,Pl=null;ei.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(Rl=new WeakSet,Pl=new WeakSet);function kee(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){Tee(p,f);function p(w){var y;return y=f.call(this,w)||this,y._instanceProps=c(y.props,Bv(y)),y._outerRef=void 0,y._resetIsScrollingTimeoutId=null,y.state={instance:Bv(y),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof y.props.initialScrollOffset=="number"?y.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},y._callOnItemsRendered=void 0,y._callOnItemsRendered=Nh(function(S,C,O,j){return y.props.onItemsRendered({overscanStartIndex:S,overscanStopIndex:C,visibleStartIndex:O,visibleStopIndex:j})}),y._callOnScroll=void 0,y._callOnScroll=Nh(function(S,C,O){return y.props.onScroll({scrollDirection:S,scrollOffset:C,scrollUpdateWasRequested:O})}),y._getItemStyle=void 0,y._getItemStyle=function(S){var C=y.props,O=C.direction,j=C.itemSize,V=C.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),me=O==="horizontal"||V==="horizontal",se=O==="rtl",fe=me?q:0;B[S]=H={position:"absolute",left:se?void 0:fe,right:se?fe:void 0,top:me?0:q,height:me?"100%":ne,width:me?ne:"100%"}}return H},y._getItemStyleCache=void 0,y._getItemStyleCache=Nh(function(S,C,O){return{}}),y._onScrollHorizontal=function(S){var C=S.currentTarget,O=C.clientWidth,j=C.scrollLeft,V=C.scrollWidth;y.setState(function(B){if(B.scrollOffset===j)return null;var H=y.props.direction,q=j;if(H==="rtl")switch(Wv()){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 C=S.currentTarget,O=C.clientHeight,j=C.scrollHeight,V=C.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 C=y.props.outerRef;y._outerRef=S,typeof C=="function"?C(S):C!=null&&typeof C=="object"&&C.hasOwnProperty("current")&&(C.current=S)},y._resetIsScrollingDebounced=function(){y._resetIsScrollingTimeoutId!==null&&zv(y._resetIsScrollingTimeoutId),y._resetIsScrollingTimeoutId=Mee(y._resetIsScrolling,Oee)},y._resetIsScrolling=function(){y._resetIsScrollingTimeoutId=null,y.setState({isScrolling:!1},function(){y._getItemStyleCache(-1,null)})},y}p.getDerivedStateFromProps=function(y,S){return Ree(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 C=this.props,O=C.itemCount,j=C.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?qv():0:B=H.scrollHeight>H.clientHeight?qv():0}this.scrollTo(s(this.props,y,S,V,this._instanceProps,B))},v.componentDidMount=function(){var y=this.props,S=y.direction,C=y.initialScrollOffset,O=y.layout;if(typeof C=="number"&&this._outerRef!=null){var j=this._outerRef;S==="horizontal"||O==="horizontal"?j.scrollLeft=C:j.scrollTop=C}this._callPropsCallbacks()},v.componentDidUpdate=function(){var y=this.props,S=y.direction,C=y.layout,O=this.state,j=O.scrollOffset,V=O.scrollUpdateWasRequested;if(V&&this._outerRef!=null){var B=this._outerRef;if(S==="horizontal"||C==="horizontal")if(S==="rtl")switch(Wv()){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&&zv(this._resetIsScrollingTimeoutId)},v.render=function(){var y=this.props,S=y.children,C=y.className,O=y.direction,j=y.height,V=y.innerRef,B=y.innerElementType,H=y.innerTagName,q=y.itemCount,ne=y.itemData,me=y.itemKey,se=me===void 0?jee:me,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",A=E?this._onScrollHorizontal:this._onScrollVertical,k=this._getRangeToRender(),M=k[0],g=k[1],b=[];if(q>0)for(var P=M;P<=g;P++)b.push(ve.createElement(S,{data:ne,key:se(P,ne),index:P,isScrolling:d?x:void 0,style:this._getItemStyle(P)}));var ue=n(this.props,this._instanceProps);return ve.createElement(z||N||"div",{className:C,onScroll:A,ref:this._outerRefSetter,style:e0({position:"relative",height:j,width:m,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:O},h)},ve.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(),C=S[0],O=S[1],j=S[2],V=S[3];this._callOnItemsRendered(C,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,C=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,C):1,me=!j||V==="forward"?Math.max(1,C):1;return[Math.max(0,H-ne),Math.max(0,Math.min(S-1,q+me)),H,q]},p}(ve.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var Ree=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(ei.env.NODE_ENV!=="production"){(a!=null||c!=null)&&Pl&&!Pl.has(l)&&(Pl.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":Rl&&!Rl.has(l)&&(Rl.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.'))}},Pee=kee({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),C=Math.max(0,r*l-w+l+o);switch(n==="smart"&&(i>=C-w&&i<=S+w?n="auto":n="center"),n){case"start":return S;case"end":return C;case"center":{var O=Math.round(C+(S-C)/2);return O<Math.ceil(w/2)?0:O>y+Math.floor(w/2)?y:O}case"auto":default:return i>=C&&i<=S?i:i<C?C: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(ei.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 Gv(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 Nee=["style"],Dee=["style"];function $ee(e,t){var r=e.style,n=Fv(e,Nee),i=t.style,s=Fv(t,Dee);return!Gv(r,i)&&!Gv(n,s)}const Lee=ve.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(Fee,{data:a,onHandleTokenAction:i,showCollect:s,showDelete:o})})},$ee),Bee=Eee((e,t,r,n)=>({items:e,onHandleTokenAction:t,showCollect:r,showDelete:n}));function Uee({showTokenList:e,onHandleTokenAction:t,showCollect:r=!0,showDelete:n=!1}){const i=ve.useRef(null);ve.useEffect(()=>{i.current&&i.current.scrollTo(0)},[e.length]);const s=Bee(e,t,r,n);return _.jsx("div",{className:"token-list",children:_.jsx(Pee,{ref:i,style:{overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none",padding:"8px"},height:360,itemCount:e.length,itemData:s,itemSize:72,width:"100%",children:Lee})})}function Fee({data:e,showCollect:t,showDelete:r,onHandleTokenAction:n}){const{isCollectToken:i}=RE(),{getExplorerUrl:s}=Qa();return Ru(),_.jsxs("div",{className:"token-list-item",onClick:o=>{t&&(o.stopPropagation(),n(e,"select_token"))},children:[_.jsx(kr,{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:Vr(e.symbol)})}),_.jsx("p",{className:"token-name",children:Vr(e==null?void 0:e.name,20)}),_.jsxs("div",{className:"copy",children:[_.jsx("a",{onClick:td,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(Od,{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?Vx(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 Vee({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 zee({backClick:e,onSelectToken:t,currToken:r}){const{showTokenList:n,isNoData:i,handleSearch:s,handleChangePlatform:o,handleChangeType:a,handleImportClick:c,handleDeleteImportClick:u}=yee(r==null?void 0:r.coin_type),{importTokenList:l,currentTypeTab:f,setCurrentTypeTab:p,currentPlatformTab:v,setCurrentPlatformTab:w,platformList:y,isOpenImportDialog:S,setIsOpenImportDialog:C,setSearchInput:O,searchInput:j,importTokenIsLoading:V,currentImportTokenData:B,setCurrentImportTokenData:H}=Qo();ve.useEffect(()=>()=>{O(""),w("All"),p("Default"),H(void 0)},[]);const{handleCollectToken:q,collectTokenMap:ne}=RE(),me=m=>{p(m),a(m)},se=m=>{w(m),o(m)},fe=()=>{c(),C(!1)},z=m=>{let x=m.replace(/[^a-zA-Z0-9\s]+$/g,"").trim();O(x),x?N(x):(N(""),me("Default"))},N=xg(m=>{Gx(m)?s(ws(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=ve.useMemo(()=>Array.from(ne.values()),[ne]);return _.jsxs("div",{className:"token-select-modal",children:[_.jsx(Eg,{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(vee,{tokenList:d,onHandleTokenAction:h}),j.length===0&&_.jsx(Vee,{currentType:f,changeTab:me}),j.length===0&&f==="Default"&&_.jsx(_ee,{tabList:y,currentTab:v,changeTab:se})]}),i&&_.jsx(qee,{showTooltip:j.length>0,text:j.length>0||B===void 0?"No tokens found":"No Imported Tokens"}),V&&_.jsx(z7,{}),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(Uee,{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 qee({showTooltip:e,text:t}){return _.jsx("div",{style:{height:"360px"},children:_.jsx(wee,{text:t,subItem:e?_.jsx("div",{children:_.jsx(Go,{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 Wee({onClose:e,tokenList:t,onSureClick:r}){const[n,i]=ve.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(kr,{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(Od,{text:o.coin_type})]})]})]},o.coin_type)),_.jsxs("div",{className:"risk-checkbox ",children:[_.jsx(md,{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"})]})]})]})]})}function PE(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 cu;(function(e){e.event="event",e.props="prop"})(cu||(cu={}));function Gs(){}function Gee(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 uu(e){return!!(e||"").match(/\d/)}function $a(e){return e==null}function Hee(e){return typeof e=="number"&&isNaN(e)}function NE(e){return $a(e)||Hee(e)||typeof e=="number"&&!isFinite(e)}function DE(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function Kee(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 Yee(e,t,r){var n=Kee(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 Xee(e){var t=ve.useRef(e);t.current=e;var r=ve.useRef(function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];return t.current.apply(t,n)});return r.current}function Pg(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 Jee(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 $E(e,t,r){for(var n="",i=r?"0":"",s=0;s<=t-1;s++)n+=e[s]||i;return n}function Hv(e,t){return Array(t+1).join(e)}function LE(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."+Hv("0",Math.abs(o))+i:o>=a?i=i+Hv("0",o-a):i=(i.substring(0,o)||"0")+"."+i.substring(o),r+i}function Kv(e,t,r){if(["","-"].indexOf(e)!==-1)return e;var n=(e.indexOf(".")!==-1||r)&&t,i=Pg(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,C){return y.length>C?(Number(y[0])+Number(S)).toString()+y.substring(1,y.length):S+y},l[0]));var p=$E(l[1]||"",t,r),v=a?"-":"",w=n?".":"";return""+v+f+w+p}function Ao(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 BE=Gee(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}}}),Zee=function(e,t){var r=Math.min(e.selectionStart,t);return{from:{start:r,end:e.selectionEnd},to:{start:r,end:t}}};function Qee(e,t,r){return Math.min(Math.max(e,t),r)}function $h(e){return Math.max(e.selectionStart,e.selectionEnd)}function ete(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function tte(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function rte(e){var t=e.currentValue,r=e.formattedValue,n=e.currentValueIndex,i=e.formattedValueIndex;return t[n]===r[i]}function nte(e,t,r,n,i,s,o){o===void 0&&(o=rte);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 C=n;C<u&&(p[C]===-1||!s(r[C]));)C++;var O=C===u||p[C]===-1?l:p[C];for(C=n-1;C>0&&p[C]===-1;)C--;var j=C===-1||p[C]===-1?0:p[C]+1;return j>O?O:n-j<O-n?j:O}function Yv(e,t,r,n){var i=e.length;if(t=Qee(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 ite(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),r=0,n=t.length;r<n;r++)t[r]=!!(uu(e[r])||uu(e[r-1]));return t}function UE(e,t,r,n,i,s){s===void 0&&(s=Gs);var o=Xee(function(w,y){var S,C;return NE(w)?(C="",S=""):typeof w=="number"||y?(C=typeof w=="number"?LE(w):w,S=n(C)):(C=i(w,void 0),S=n(C)),{formattedValue:S,numAsString:C}}),a=ve.useState(function(){return o($a(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;$a(e)&&(f=c.numAsString,p=!0);var v=o(f,p);return ve.useMemo(function(){u(v)},[v.formattedValue]),[c,l]}function ste(e){return e.replace(/[^0-9]/g,"")}function ote(e){return e}function ate(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=ote);var a=e.removeFormatting;a===void 0&&(a=ste);var c=e.defaultValue,u=e.valueIsNumericString,l=e.onValueChange,f=e.isAllowed,p=e.onChange;p===void 0&&(p=Gs);var v=e.onKeyDown;v===void 0&&(v=Gs);var w=e.onMouseUp;w===void 0&&(w=Gs);var y=e.onFocus;y===void 0&&(y=Gs);var S=e.onBlur;S===void 0&&(S=Gs);var C=e.value,O=e.getCaretBoundary;O===void 0&&(O=ite);var j=e.isValidInputCharacter;j===void 0&&(j=uu);var V=e.isCharacterSame,B=PE(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),H=UE(C,c,!!u,o,a,l),q=H[0],ne=q.formattedValue,me=q.numAsString,se=H[1],fe=ve.useRef(),z=ve.useRef({formattedValue:ne,numAsString:me}),N=function(X,J){z.current={formattedValue:X.formattedValue,numAsString:X.value},se(X,J)},h=ve.useState(!1),d=h[0],m=h[1],x=ve.useRef(null),E=ve.useRef({setCaretTimeout:null,focusTimeout:null});ve.useEffect(function(){return m(!0),function(){clearTimeout(E.current.setCaretTimeout),clearTimeout(E.current.focusTimeout)}},[]);var A=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||(Ao(X,J),E.current.setCaretTimeout=setTimeout(function(){X.value===U&&X.selectionStart!==J&&Ao(X,J)},0))},g=function(X,J,U){return Yv(X,J,O(X),U)},b=function(X,J,U){var oe=O(J),ge=nte(J,ne,X,U,oe,j,V);return ge=Yv(J,ge,oe),ge},P=function(X){var J=X.formattedValue;J===void 0&&(J="");var U=X.input,oe=X.source,ge=X.event,de=X.numAsString,Ee;if(U){var je=X.inputValue||U.value,Fe=$h(U);U.value=J,Ee=b(je,J,Fe),Ee!==void 0&&M(U,Ee,J)}J!==ne&&N(k(J,de),{event:ge,source:oe})};ve.useEffect(function(){var X=z.current,J=X.formattedValue,U=X.numAsString;(ne!==J||me!==U)&&N(k(ne,me),{event:void 0,source:cu.props})},[ne,me]);var ue=x.current?$h(x.current):void 0,ie=typeof window<"u"?ve.useLayoutEffect:ve.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,ge=fe.current?Zee(fe.current,oe.selectionEnd):BE(ne,X),de=Object.assign(Object.assign({},ge),{lastValue:ne}),Ee=a(X,de),je=A(Ee);if(Ee=a(je,void 0),f&&!f(k(je,Ee))){var Fe=J.target,Je=$h(Fe),Ne=b(X,ne,Je);return Fe.value=ne,M(Fe,Ne,ne),!1}return P({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}},Ce=function(X){var J=X.target,U=J.value,oe=le(U,X,cu.event);oe&&p(X),fe.current=void 0},D=function(X){var J=X.target,U=X.key,oe=J.selectionStart,ge=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===ge&&(je=1);var Fe=U==="ArrowLeft"||U==="ArrowRight";if(Ee===void 0||oe!==ge&&!Fe){v(X),be(J,je);return}var Je=Ee;if(Fe){var Ne=U==="ArrowLeft"?"left":"right";Je=g(de,Ee,Ne),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,ge=J.selectionEnd,de=J.value;if(de===void 0&&(de=""),oe===ge){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,ge=J.selectionEnd,de=J.value;de===void 0&&(de="");var Ee=g(de,oe);Ee!==oe&&!(oe===0&&ge===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&&ete()?"numeric":void 0,G=Object.assign({inputMode:Q},B,{type:t,value:ne,onChange:Ce,onKeyDown:D,onMouseUp:F,onFocus:K,onBlur:te});if(r==="text")return i?ve.createElement(ve.Fragment,null,i(ne,B)||null):ve.createElement("span",Object.assign({},B,{ref:s}),ne);if(n){var he=n;return ve.createElement(he,Object.assign({},G,{ref:s}))}return ve.createElement("input",Object.assign({},G,{ref:s}))}function Xv(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=jd(t),u=c.thousandSeparator,l=c.decimalSeparator,f=r!==0&&e.indexOf(".")!==-1||r&&n,p=Pg(e,o),v=p.beforeDecimal,w=p.afterDecimal,y=p.addNegation;return r!==void 0&&(w=$E(w,r,!!n)),u&&(v=Yee(v,u,a)),i&&(v=i+v),s&&(w=w+s),y&&(v="-"+v),e=v+(f&&l||"")+w,e}function jd(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 cte(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 ute(e,t){return new RegExp("(^-)|[0-9]|"+DE(e),t?"g":void 0)}function lte(e,t,r){return e===""?!0:!(t!=null&&t.match(/\d/))&&!(r!=null&&r.match(/\d/))&&typeof e=="string"&&!isNaN(Number(e))}function fte(e,t,r){var n;t===void 0&&(t=tte(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=jd(r),v=p.allowedDecimalSeparators,w=p.decimalSeparator,y=e[f]===w;if(uu(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 C=function(x,E,A){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,A-=g),{value:x,start:E,end:A,hasNegation:k}},O=C(e,l,f),j=O.hasNegation;n=O,e=n.value,l=n.start,f=n.end;var V=C(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 me=0;e.startsWith(s)?me+=s.length:l<s.length&&(me=l),e=e.substring(me),f-=me;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=cte(j?"-"+e:e,i),e=(e.match(ute(w,!0))||[]).join("");var z=e.indexOf(w);e=e.replace(new RegExp(DE(w),"g"),function(x,E){return E===z?".":""});var N=Pg(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 dte(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 hte(e){var t=jd(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
+ `)},pW=0,da=[];function mW(e){var t=R.useRef([]),r=R.useRef([0,0]),n=R.useRef(),i=R.useState(pW++)[0],s=R.useState(l5)[0],o=R.useRef(e);R.useEffect(function(){o.current=e},[e]),R.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var y=Dq([e.lockRef.current],(e.shards||[]).map(ev),!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=R.useCallback(function(y,S){if("touches"in y&&y.touches.length===2||y.type==="wheel"&&y.ctrlKey)return!o.current.allowPinchZoom;var C=Yu(y),O=r.current,j="deltaX"in y?y.deltaX:O[0]-C[0],V="deltaY"in y?y.deltaY:O[1]-C[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=Zy(q,H);if(!ne)return!0;if(ne?B=q:(B=q==="v"?"h":"v",ne=Zy(q,H)),!ne)return!1;if(!n.current&&"changedTouches"in y&&(j||V)&&(n.current=B),!B)return!0;var me=n.current||B;return fW(me,S,y,me==="h"?j:V,!0)},[]),c=R.useCallback(function(y){var S=y;if(!(!da.length||da[da.length-1]!==s)){var C="deltaY"in S?Qy(S):Yu(S),O=t.current.filter(function(B){return B.name===S.type&&(B.target===S.target||S.target===B.shadowParent)&&dW(B.delta,C)})[0];if(O&&O.should){S.cancelable&&S.preventDefault();return}if(!O){var j=(o.current.shards||[]).map(ev).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=R.useCallback(function(y,S,C,O){var j={name:y,delta:S,target:C,should:O,shadowParent:gW(C)};t.current.push(j),setTimeout(function(){t.current=t.current.filter(function(V){return V!==j})},1)},[]),l=R.useCallback(function(y){r.current=Yu(y),n.current=void 0},[]),f=R.useCallback(function(y){u(y.type,Qy(y),y.target,a(y,e.lockRef.current))},[]),p=R.useCallback(function(y){u(y.type,Yu(y),y.target,a(y,e.lockRef.current))},[]);R.useEffect(function(){return da.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",c,fa),document.addEventListener("touchmove",c,fa),document.addEventListener("touchstart",l,fa),function(){da=da.filter(function(y){return y!==s}),document.removeEventListener("wheel",c,fa),document.removeEventListener("touchmove",c,fa),document.removeEventListener("touchstart",l,fa)}},[]);var v=e.removeScrollBar,w=e.inert;return R.createElement(R.Fragment,null,w?R.createElement(s,{styles:hW(i)}):null,v?R.createElement(iW,{gapMode:e.gapMode}):null)}function gW(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const yW=Wq(u5,mW);var p5=R.forwardRef(function(e,t){return R.createElement(gd,Ai({},e,{ref:t,sideCar:yW}))});p5.classNames=gd.classNames;const vW=p5;function bW(e,t){return R.useReducer((r,n)=>t[r][n]??r,e)}var ag="ScrollArea",[m5,Dte]=Cs(ag),[wW,$n]=m5(ag),g5=R.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:i,scrollHideDelay:s=600,...o}=e,[a,c]=R.useState(null),[u,l]=R.useState(null),[f,p]=R.useState(null),[v,w]=R.useState(null),[y,S]=R.useState(null),[C,O]=R.useState(0),[j,V]=R.useState(0),[B,H]=R.useState(!1),[q,ne]=R.useState(!1),me=Xt(t,fe=>c(fe)),se=ng(i);return _.jsx(wW,{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(Jt.div,{dir:se,...o,ref:me,style:{position:"relative","--radix-scroll-area-corner-width":C+"px","--radix-scroll-area-corner-height":j+"px",...e.style}})})});g5.displayName=ag;var y5="ScrollAreaViewport",v5=R.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:i,...s}=e,o=$n(y5,r),a=R.useRef(null),c=Xt(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(Jt.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})})]})});v5.displayName=y5;var zi="ScrollAreaScrollbar",b5=R.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=$n(zi,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:o}=i,a=e.orientation==="horizontal";return R.useEffect(()=>(a?s(!0):o(!0),()=>{a?s(!1):o(!1)}),[a,s,o]),i.type==="hover"?_.jsx(_W,{...n,ref:t,forceMount:r}):i.type==="scroll"?_.jsx(xW,{...n,ref:t,forceMount:r}):i.type==="auto"?_.jsx(w5,{...n,ref:t,forceMount:r}):i.type==="always"?_.jsx(cg,{...n,ref:t}):null});b5.displayName=zi;var _W=R.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=$n(zi,e.__scopeScrollArea),[s,o]=R.useState(!1);return R.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(ci,{present:r||s,children:_.jsx(w5,{"data-state":s?"visible":"hidden",...n,ref:t})})}),xW=R.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=$n(zi,e.__scopeScrollArea),s=e.orientation==="horizontal",o=vd(()=>c("SCROLL_END"),100),[a,c]=bW("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 R.useEffect(()=>{if(a==="idle"){const u=window.setTimeout(()=>c("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(u)}},[a,i.scrollHideDelay,c]),R.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(ci,{present:r||a!=="hidden",children:_.jsx(cg,{"data-state":a==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:_t(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:_t(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),w5=R.forwardRef((e,t)=>{const r=$n(zi,e.__scopeScrollArea),{forceMount:n,...i}=e,[s,o]=R.useState(!1),a=e.orientation==="horizontal",c=vd(()=>{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(ci,{present:n||s,children:_.jsx(cg,{"data-state":s?"visible":"hidden",...i,ref:t})})}),cg=R.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,i=$n(zi,e.__scopeScrollArea),s=R.useRef(null),o=R.useRef(0),[a,c]=R.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=T5(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 IW(p,o.current,a,v)}return r==="horizontal"?_.jsx(SW,{...l,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const p=i.viewport.scrollLeft,v=tv(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(EW,{...l,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const p=i.viewport.scrollTop,v=tv(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}),SW=R.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,s=$n(zi,e.__scopeScrollArea),[o,a]=R.useState(),c=R.useRef(null),u=Xt(t,c,s.onScrollbarXChange);return R.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),_.jsx(x5,{"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":yd(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),C5(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:vf(o.paddingLeft),paddingEnd:vf(o.paddingRight)}})}})}),EW=R.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...i}=e,s=$n(zi,e.__scopeScrollArea),[o,a]=R.useState(),c=R.useRef(null),u=Xt(t,c,s.onScrollbarYChange);return R.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),_.jsx(x5,{"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":yd(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),C5(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:vf(o.paddingTop),paddingEnd:vf(o.paddingBottom)}})}})}),[TW,_5]=m5(zi),x5=R.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=$n(zi,r),[w,y]=R.useState(null),S=Xt(t,me=>y(me)),C=R.useRef(null),O=R.useRef(""),j=v.viewport,V=n.content-n.viewport,B=Lr(l),H=Lr(c),q=vd(f,10);function ne(me){if(C.current){const se=me.clientX-C.current.left,fe=me.clientY-C.current.top;u({x:se,y:fe})}}return R.useEffect(()=>{const me=se=>{const fe=se.target;(w==null?void 0:w.contains(fe))&&B(se,V)};return document.addEventListener("wheel",me,{passive:!1}),()=>document.removeEventListener("wheel",me,{passive:!1})},[j,w,V,B]),R.useEffect(H,[n,H]),qa(w,q),qa(v.content,q),_.jsx(TW,{scope:r,scrollbar:w,hasThumb:i,onThumbChange:Lr(s),onThumbPointerUp:Lr(o),onThumbPositionChange:H,onThumbPointerDown:Lr(a),children:_.jsx(Jt.div,{...p,ref:S,style:{position:"absolute",...p.style},onPointerDown:_t(e.onPointerDown,me=>{me.button===0&&(me.target.setPointerCapture(me.pointerId),C.current=w.getBoundingClientRect(),O.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",v.viewport&&(v.viewport.style.scrollBehavior="auto"),ne(me))}),onPointerMove:_t(e.onPointerMove,ne),onPointerUp:_t(e.onPointerUp,me=>{const se=me.target;se.hasPointerCapture(me.pointerId)&&se.releasePointerCapture(me.pointerId),document.body.style.webkitUserSelect=O.current,v.viewport&&(v.viewport.style.scrollBehavior=""),C.current=null})})})}),yf="ScrollAreaThumb",S5=R.forwardRef((e,t)=>{const{forceMount:r,...n}=e,i=_5(yf,e.__scopeScrollArea);return _.jsx(ci,{present:r||i.hasThumb,children:_.jsx(AW,{ref:t,...n})})}),AW=R.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...i}=e,s=$n(yf,r),o=_5(yf,r),{onThumbPositionChange:a}=o,c=Xt(t,f=>o.onThumbChange(f)),u=R.useRef(void 0),l=vd(()=>{u.current&&(u.current(),u.current=void 0)},100);return R.useEffect(()=>{const f=s.viewport;if(f){const p=()=>{if(l(),!u.current){const v=MW(f,a);u.current=v,a()}};return a(),f.addEventListener("scroll",p),()=>f.removeEventListener("scroll",p)}},[s.viewport,l,a]),_.jsx(Jt.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:_t(e.onPointerDownCapture,f=>{const v=f.target.getBoundingClientRect(),w=f.clientX-v.left,y=f.clientY-v.top;o.onThumbPointerDown({x:w,y})}),onPointerUp:_t(e.onPointerUp,o.onThumbPointerUp)})});S5.displayName=yf;var ug="ScrollAreaCorner",E5=R.forwardRef((e,t)=>{const r=$n(ug,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?_.jsx(CW,{...e,ref:t}):null});E5.displayName=ug;var CW=R.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,i=$n(ug,r),[s,o]=R.useState(0),[a,c]=R.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(Jt.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 vf(e){return e?parseInt(e,10):0}function T5(e,t){const r=e/t;return isNaN(r)?0:r}function yd(e){const t=T5(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function IW(e,t,r,n="ltr"){const i=yd(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 A5([c,u],f)(e)}function tv(e,t,r="ltr"){const n=yd(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=Sq(e,c);return A5([0,o],[0,a])(u)}function A5(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 C5(e,t){return e>0&&e<t}var MW=(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 vd(e,t){const r=Lr(e),n=R.useRef(0);return R.useEffect(()=>()=>window.clearTimeout(n.current),[]),R.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function qa(e,t){const r=Lr(t);_s(()=>{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 OW=g5,jW=v5,rv=b5,nv=S5,kW=E5,bd="Switch",[RW,$te]=Cs(bd),[PW,NW]=RW(bd),I5=R.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]=R.useState(null),w=Xt(t,j=>v(j)),y=R.useRef(!1),S=p?l||!!p.closest("form"):!0,[C,O]=Tu({prop:i,defaultProp:s??!1,onChange:u,caller:bd});return _.jsxs(PW,{scope:r,checked:C,disabled:a,children:[_.jsx(Jt.button,{type:"button",role:"switch","aria-checked":C,"aria-required":o,"data-state":k5(C),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:w,onClick:_t(e.onClick,j=>{O(V=>!V),S&&(y.current=j.isPropagationStopped(),y.current||j.stopPropagation())})}),S&&_.jsx(j5,{control:p,bubbles:!y.current,name:n,value:c,checked:C,required:o,disabled:a,form:l,style:{transform:"translateX(-100%)"}})]})});I5.displayName=bd;var M5="SwitchThumb",O5=R.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,i=NW(M5,r);return _.jsx(Jt.span,{"data-state":k5(i.checked),"data-disabled":i.disabled?"":void 0,...n,ref:t})});O5.displayName=M5;var DW="SwitchBubbleInput",j5=R.forwardRef(({__scopeSwitch:e,control:t,checked:r,bubbles:n=!0,...i},s)=>{const o=R.useRef(null),a=Xt(o,s),c=FS(r),u=Qm(t);return R.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}})});j5.displayName=DW;function k5(e){return e?"checked":"unchecked"}var $W=I5,LW=O5;const BW=["1","2","3"],UW=["classic","surface","soft"],wc={size:{type:"enum",values:BW,default:"2",responsive:!0},variant:{type:"enum",values:UW,default:"surface"},color:Au,highContrast:dd,radius:sg},R5=R.forwardRef((e,t)=>{const{rest:r,...n}=Cu(e),{className:i,style:s,size:o=wc.size.default,variant:a=wc.variant.default,color:c=wc.color.default,highContrast:u=wc.highContrast.default,radius:l=wc.radius.default,...f}=r;return R.createElement("span",{"data-radius":l,className:cr("rt-SwitchRoot",i,an(o,"rt-r-size"),`rt-variant-${a}`,{"rt-high-contrast":u},Iu(n)),style:s},R.createElement($W,{"data-accent-color":c,...f,ref:t,className:cr("rt-reset","rt-SwitchButton",{"rt-high-contrast":u})},R.createElement(LW,{className:cr("rt-SwitchThumb",{"rt-high-contrast":u})})))});R5.displayName="Switch";var Hp=["Enter"," "],FW=["ArrowDown","PageUp","Home"],P5=["ArrowUp","PageDown","End"],VW=[...FW,...P5],zW={ltr:[...Hp,"ArrowRight"],rtl:[...Hp,"ArrowLeft"]},qW={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Ou="Menu",[ru,WW,GW]=JS(Ou),[ea,N5]=Cs(Ou,[GW,cd,QS]),ju=cd(),D5=QS(),[$5,ho]=ea(Ou),[HW,ku]=ea(Ou),L5=e=>{const{__scopeMenu:t,open:r=!1,children:n,dir:i,onOpenChange:s,modal:o=!0}=e,a=ju(t),[c,u]=R.useState(null),l=R.useRef(!1),f=Lr(s),p=ng(i);return R.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(AS,{...a,children:_.jsx($5,{scope:t,open:r,onOpenChange:f,content:c,onContentChange:u,children:_.jsx(HW,{scope:t,onClose:R.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:l,dir:p,modal:o,children:n})})})};L5.displayName=Ou;var KW="MenuAnchor",lg=R.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=ju(r);return _.jsx(CS,{...i,...n,ref:t})});lg.displayName=KW;var fg="MenuPortal",[YW,B5]=ea(fg,{forceMount:void 0}),U5=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:i}=e,s=ho(fg,t);return _.jsx(YW,{scope:t,forceMount:r,children:_.jsx(ci,{present:r||s.open,children:_.jsx(OS,{asChild:!0,container:i,children:n})})})};U5.displayName=fg;var Dn="MenuContent",[XW,dg]=ea(Dn),F5=R.forwardRef((e,t)=>{const r=B5(Dn,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,s=ho(Dn,e.__scopeMenu),o=ku(Dn,e.__scopeMenu);return _.jsx(ru.Provider,{scope:e.__scopeMenu,children:_.jsx(ci,{present:n||s.open,children:_.jsx(ru.Slot,{scope:e.__scopeMenu,children:o.modal?_.jsx(JW,{...i,ref:t}):_.jsx(ZW,{...i,ref:t})})})})}),JW=R.forwardRef((e,t)=>{const r=ho(Dn,e.__scopeMenu),n=R.useRef(null),i=Xt(t,n);return R.useEffect(()=>{const s=n.current;if(s)return Nq(s)},[]),_.jsx(hg,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:_t(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),ZW=R.forwardRef((e,t)=>{const r=ho(Dn,e.__scopeMenu);return _.jsx(hg,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),QW=Zc("MenuContent.ScrollLock"),hg=R.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=ho(Dn,r),C=ku(Dn,r),O=ju(r),j=D5(r),V=WW(r),[B,H]=R.useState(null),q=R.useRef(null),ne=Xt(t,q,S.onContentChange),me=R.useRef(0),se=R.useRef(""),fe=R.useRef(0),z=R.useRef(null),N=R.useRef("right"),h=R.useRef(0),d=w?vW:R.Fragment,m=w?{as:QW,allowPinchZoom:!0}:void 0,x=A=>{var le,be;const k=se.current+A,M=V().filter(Ce=>!Ce.disabled),g=document.activeElement,b=(le=M.find(Ce=>Ce.ref.current===g))==null?void 0:le.textValue,P=M.map(Ce=>Ce.textValue),ue=fG(P,k,b),ie=(be=M.find(Ce=>Ce.textValue===ue))==null?void 0:be.ref.current;(function Ce(D){se.current=D,window.clearTimeout(me.current),D!==""&&(me.current=window.setTimeout(()=>Ce(""),1e3))})(k),ie&&setTimeout(()=>ie.focus())};R.useEffect(()=>()=>window.clearTimeout(me.current),[]),Eq();const E=R.useCallback(A=>{var M,g;return N.current===((M=z.current)==null?void 0:M.side)&&hG(A,(g=z.current)==null?void 0:g.area)},[]);return _.jsx(XW,{scope:r,searchRef:se,onItemEnter:R.useCallback(A=>{E(A)&&A.preventDefault()},[E]),onItemLeave:R.useCallback(A=>{var k;E(A)||((k=q.current)==null||k.focus(),H(null))},[E]),onTriggerLeave:R.useCallback(A=>{E(A)&&A.preventDefault()},[E]),pointerGraceTimerRef:fe,onPointerGraceIntentChange:R.useCallback(A=>{z.current=A},[]),children:_.jsx(d,{...m,children:_.jsx(i5,{asChild:!0,trapped:i,onMountAutoFocus:_t(s,A=>{var k;A.preventDefault(),(k=q.current)==null||k.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:_.jsx(Wm,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:l,onFocusOutside:f,onInteractOutside:p,onDismiss:v,children:_.jsx(_q,{asChild:!0,...j,dir:C.dir,orientation:"vertical",loop:n,currentTabStopId:B,onCurrentTabStopIdChange:H,onEntryFocus:_t(c,A=>{C.isUsingKeyboardRef.current||A.preventDefault()}),preventScrollOnEntryFocus:!0,children:_.jsx(IS,{role:"menu","aria-orientation":"vertical","data-state":i7(S.open),"data-radix-menu-content":"",dir:C.dir,...O,...y,ref:ne,style:{outline:"none",...y.style},onKeyDown:_t(y.onKeyDown,A=>{const M=A.target.closest("[data-radix-menu-content]")===A.currentTarget,g=A.ctrlKey||A.altKey||A.metaKey,b=A.key.length===1;M&&(A.key==="Tab"&&A.preventDefault(),!g&&b&&x(A.key));const P=q.current;if(A.target!==P||!VW.includes(A.key))return;A.preventDefault();const ie=V().filter(le=>!le.disabled).map(le=>le.ref.current);P5.includes(A.key)&&ie.reverse(),uG(ie)}),onBlur:_t(e.onBlur,A=>{A.currentTarget.contains(A.target)||(window.clearTimeout(me.current),se.current="")}),onPointerMove:_t(e.onPointerMove,nu(A=>{const k=A.target,M=h.current!==A.clientX;if(A.currentTarget.contains(k)&&M){const g=A.clientX>h.current?"right":"left";N.current=g,h.current=A.clientX}}))})})})})})})});F5.displayName=Dn;var eG="MenuGroup",pg=R.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return _.jsx(Jt.div,{role:"group",...n,ref:t})});pg.displayName=eG;var tG="MenuLabel",V5=R.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return _.jsx(Jt.div,{...n,ref:t})});V5.displayName=tG;var bf="MenuItem",iv="menu.itemSelect",wd=R.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...i}=e,s=R.useRef(null),o=ku(bf,e.__scopeMenu),a=dg(bf,e.__scopeMenu),c=Xt(t,s),u=R.useRef(!1),l=()=>{const f=s.current;if(!r&&f){const p=new CustomEvent(iv,{bubbles:!0,cancelable:!0});f.addEventListener(iv,v=>n==null?void 0:n(v),{once:!0}),nS(f,p),p.defaultPrevented?u.current=!1:o.onClose()}};return _.jsx(z5,{...i,ref:c,disabled:r,onClick:_t(e.onClick,l),onPointerDown:f=>{var p;(p=e.onPointerDown)==null||p.call(e,f),u.current=!0},onPointerUp:_t(e.onPointerUp,f=>{var p;u.current||(p=f.currentTarget)==null||p.click()}),onKeyDown:_t(e.onKeyDown,f=>{const p=a.searchRef.current!=="";r||p&&f.key===" "||Hp.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});wd.displayName=bf;var z5=R.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:i,...s}=e,o=dg(bf,r),a=D5(r),c=R.useRef(null),u=Xt(t,c),[l,f]=R.useState(!1),[p,v]=R.useState("");return R.useEffect(()=>{const w=c.current;w&&v((w.textContent??"").trim())},[s.children]),_.jsx(ru.ItemSlot,{scope:r,disabled:n,textValue:i??p,children:_.jsx(xq,{asChild:!0,...a,focusable:!n,children:_.jsx(Jt.div,{role:"menuitem","data-highlighted":l?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...s,ref:u,onPointerMove:_t(e.onPointerMove,nu(w=>{n?o.onItemLeave(w):(o.onItemEnter(w),w.defaultPrevented||w.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:_t(e.onPointerLeave,nu(w=>o.onItemLeave(w))),onFocus:_t(e.onFocus,()=>f(!0)),onBlur:_t(e.onBlur,()=>f(!1))})})})}),rG="MenuCheckboxItem",q5=R.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:n,...i}=e;return _.jsx(Y5,{scope:e.__scopeMenu,checked:r,children:_.jsx(wd,{role:"menuitemcheckbox","aria-checked":wf(r)?"mixed":r,...i,ref:t,"data-state":yg(r),onSelect:_t(i.onSelect,()=>n==null?void 0:n(wf(r)?!0:!r),{checkForDefaultPrevented:!1})})})});q5.displayName=rG;var W5="MenuRadioGroup",[nG,iG]=ea(W5,{value:void 0,onValueChange:()=>{}}),G5=R.forwardRef((e,t)=>{const{value:r,onValueChange:n,...i}=e,s=Lr(n);return _.jsx(nG,{scope:e.__scopeMenu,value:r,onValueChange:s,children:_.jsx(pg,{...i,ref:t})})});G5.displayName=W5;var H5="MenuRadioItem",K5=R.forwardRef((e,t)=>{const{value:r,...n}=e,i=iG(H5,e.__scopeMenu),s=r===i.value;return _.jsx(Y5,{scope:e.__scopeMenu,checked:s,children:_.jsx(wd,{role:"menuitemradio","aria-checked":s,...n,ref:t,"data-state":yg(s),onSelect:_t(n.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,r)},{checkForDefaultPrevented:!1})})})});K5.displayName=H5;var mg="MenuItemIndicator",[Y5,sG]=ea(mg,{checked:!1}),X5=R.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:n,...i}=e,s=sG(mg,r);return _.jsx(ci,{present:n||wf(s.checked)||s.checked===!0,children:_.jsx(Jt.span,{...i,ref:t,"data-state":yg(s.checked)})})});X5.displayName=mg;var oG="MenuSeparator",J5=R.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return _.jsx(Jt.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});J5.displayName=oG;var aG="MenuArrow",Z5=R.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,i=ju(r);return _.jsx(MS,{...i,...n,ref:t})});Z5.displayName=aG;var gg="MenuSub",[cG,Q5]=ea(gg),e7=e=>{const{__scopeMenu:t,children:r,open:n=!1,onOpenChange:i}=e,s=ho(gg,t),o=ju(t),[a,c]=R.useState(null),[u,l]=R.useState(null),f=Lr(i);return R.useEffect(()=>(s.open===!1&&f(!1),()=>f(!1)),[s.open,f]),_.jsx(AS,{...o,children:_.jsx($5,{scope:t,open:n,onOpenChange:f,content:u,onContentChange:l,children:_.jsx(cG,{scope:t,contentId:Qc(),triggerId:Qc(),trigger:a,onTriggerChange:c,children:r})})})};e7.displayName=gg;var Ic="MenuSubTrigger",t7=R.forwardRef((e,t)=>{const r=ho(Ic,e.__scopeMenu),n=ku(Ic,e.__scopeMenu),i=Q5(Ic,e.__scopeMenu),s=dg(Ic,e.__scopeMenu),o=R.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:c}=s,u={__scopeMenu:e.__scopeMenu},l=R.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return R.useEffect(()=>l,[l]),R.useEffect(()=>{const f=a.current;return()=>{window.clearTimeout(f),c(null)}},[a,c]),_.jsx(lg,{asChild:!0,...u,children:_.jsx(z5,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":i.contentId,"data-state":i7(r.open),...e,ref:zm(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:_t(e.onPointerMove,nu(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:_t(e.onPointerLeave,nu(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",C=S?-5:5,O=p[S?"left":"right"],j=p[S?"right":"left"];s.onPointerGraceIntentChange({area:[{x:f.clientX+C,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:_t(e.onKeyDown,f=>{var v;const p=s.searchRef.current!=="";e.disabled||p&&f.key===" "||zW[n.dir].includes(f.key)&&(r.onOpenChange(!0),(v=r.content)==null||v.focus(),f.preventDefault())})})})});t7.displayName=Ic;var r7="MenuSubContent",n7=R.forwardRef((e,t)=>{const r=B5(Dn,e.__scopeMenu),{forceMount:n=r.forceMount,...i}=e,s=ho(Dn,e.__scopeMenu),o=ku(Dn,e.__scopeMenu),a=Q5(r7,e.__scopeMenu),c=R.useRef(null),u=Xt(t,c);return _.jsx(ru.Provider,{scope:e.__scopeMenu,children:_.jsx(ci,{present:n||s.open,children:_.jsx(ru.Slot,{scope:e.__scopeMenu,children:_.jsx(hg,{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:_t(e.onFocusOutside,l=>{l.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:_t(e.onEscapeKeyDown,l=>{o.onClose(),l.preventDefault()}),onKeyDown:_t(e.onKeyDown,l=>{var v;const f=l.currentTarget.contains(l.target),p=qW[o.dir].includes(l.key);f&&p&&(s.onOpenChange(!1),(v=a.trigger)==null||v.focus(),l.preventDefault())})})})})})});n7.displayName=r7;function i7(e){return e?"open":"closed"}function wf(e){return e==="indeterminate"}function yg(e){return wf(e)?"indeterminate":e?"checked":"unchecked"}function uG(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function lG(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function fG(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=lG(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 dG(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 hG(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return dG(r,t)}function nu(e){return t=>t.pointerType==="mouse"?e(t):void 0}var pG=L5,mG=lg,gG=U5,yG=F5,vG=pg,bG=V5,wG=wd,_G=q5,xG=G5,SG=K5,EG=X5,TG=J5,AG=Z5,CG=e7,IG=t7,MG=n7,_d="DropdownMenu",[OG,Lte]=Cs(_d,[N5]),Yr=N5(),[jG,s7]=OG(_d),o7=e=>{const{__scopeDropdownMenu:t,children:r,dir:n,open:i,defaultOpen:s,onOpenChange:o,modal:a=!0}=e,c=Yr(t),u=R.useRef(null),[l,f]=Tu({prop:i,defaultProp:s??!1,onChange:o,caller:_d});return _.jsx(jG,{scope:t,triggerId:Qc(),triggerRef:u,contentId:Qc(),open:l,onOpenChange:f,onOpenToggle:R.useCallback(()=>f(p=>!p),[f]),modal:a,children:_.jsx(pG,{...c,open:l,onOpenChange:f,dir:n,modal:a,children:r})})};o7.displayName=_d;var a7="DropdownMenuTrigger",c7=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...i}=e,s=s7(a7,r),o=Yr(r);return _.jsx(mG,{asChild:!0,...o,children:_.jsx(Jt.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:zm(t,s.triggerRef),onPointerDown:_t(e.onPointerDown,a=>{!n&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:_t(e.onKeyDown,a=>{n||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});c7.displayName=a7;var kG="DropdownMenuPortal",u7=e=>{const{__scopeDropdownMenu:t,...r}=e,n=Yr(t);return _.jsx(gG,{...n,...r})};u7.displayName=kG;var l7="DropdownMenuContent",f7=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=s7(l7,r),s=Yr(r),o=R.useRef(!1);return _.jsx(yG,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...n,ref:t,onCloseAutoFocus:_t(e.onCloseAutoFocus,a=>{var c;o.current||(c=i.triggerRef.current)==null||c.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:_t(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)"}})});f7.displayName=l7;var RG="DropdownMenuGroup",d7=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Yr(r);return _.jsx(vG,{...i,...n,ref:t})});d7.displayName=RG;var PG="DropdownMenuLabel",h7=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Yr(r);return _.jsx(bG,{...i,...n,ref:t})});h7.displayName=PG;var NG="DropdownMenuItem",p7=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Yr(r);return _.jsx(wG,{...i,...n,ref:t})});p7.displayName=NG;var DG="DropdownMenuCheckboxItem",m7=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Yr(r);return _.jsx(_G,{...i,...n,ref:t})});m7.displayName=DG;var $G="DropdownMenuRadioGroup",g7=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Yr(r);return _.jsx(xG,{...i,...n,ref:t})});g7.displayName=$G;var LG="DropdownMenuRadioItem",y7=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Yr(r);return _.jsx(SG,{...i,...n,ref:t})});y7.displayName=LG;var BG="DropdownMenuItemIndicator",v7=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Yr(r);return _.jsx(EG,{...i,...n,ref:t})});v7.displayName=BG;var UG="DropdownMenuSeparator",b7=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Yr(r);return _.jsx(TG,{...i,...n,ref:t})});b7.displayName=UG;var FG="DropdownMenuArrow",VG=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Yr(r);return _.jsx(AG,{...i,...n,ref:t})});VG.displayName=FG;var zG=e=>{const{__scopeDropdownMenu:t,children:r,open:n,onOpenChange:i,defaultOpen:s}=e,o=Yr(t),[a,c]=Tu({prop:n,defaultProp:s??!1,onChange:i,caller:"DropdownMenuSub"});return _.jsx(CG,{...o,open:a,onOpenChange:c,children:r})},qG="DropdownMenuSubTrigger",w7=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Yr(r);return _.jsx(IG,{...i,...n,ref:t})});w7.displayName=qG;var WG="DropdownMenuSubContent",_7=R.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,i=Yr(r);return _.jsx(MG,{...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)"}})});_7.displayName=WG;var GG=o7,HG=c7,x7=u7,KG=f7,YG=d7,XG=h7,JG=p7,ZG=m7,QG=g7,eH=y7,S7=v7,tH=b7,rH=zG,nH=w7,iH=_7;const sH=["1","2","3"],oH=["vertical","horizontal","both"],Ih={size:{type:"enum",values:sH,default:"1",responsive:!0},radius:sg,scrollbars:{type:"enum",values:oH,default:"both"}},vg=R.forwardRef((e,t)=>{const{rest:r,...n}=Cu(e),{className:i,style:s,type:o,scrollHideDelay:a=o!=="scroll"?0:void 0,dir:c,size:u=Ih.size.default,radius:l=Ih.radius.default,scrollbars:f=Ih.scrollbars.default,...p}=r;return R.createElement(OW,{type:o,scrollHideDelay:a,className:cr("rt-ScrollAreaRoot",i,Iu(n)),style:s},R.createElement(jW,{...p,ref:t,className:"rt-ScrollAreaViewport"}),R.createElement("div",{className:"rt-ScrollAreaViewportFocusRing"}),f!=="vertical"?R.createElement(rv,{"data-radius":l,orientation:"horizontal",className:cr("rt-ScrollAreaScrollbar",an(u,"rt-r-size"))},R.createElement(nv,{className:"rt-ScrollAreaThumb"})):null,f!=="horizontal"?R.createElement(rv,{"data-radius":l,orientation:"vertical",className:cr("rt-ScrollAreaScrollbar",an(u,"rt-r-size"))},R.createElement(nv,{className:"rt-ScrollAreaThumb"})):null,f==="both"?R.createElement(kW,{className:"rt-ScrollAreaCorner"}):null)});vg.displayName="ScrollArea";const aH=["1","2"],cH=["solid","soft"],Mh={size:{type:"enum",values:aH,default:"2",responsive:!0},variant:{type:"enum",values:cH,default:"solid"},color:Au,highContrast:dd},E7={color:Au,shortcut:{type:"string",default:void 0}},T7=e=>R.createElement(GG,{...e});T7.displayName="DropdownMenuRoot";const A7=R.forwardRef((e,t)=>R.createElement(HG,{...e,ref:t,asChild:!0}));A7.displayName="DropdownMenuTrigger";const C7=R.createContext({}),I7=R.forwardRef((e,t)=>{const r=tq(),{className:n,children:i,size:s=Mh.size.default,variant:o=Mh.variant.default,highContrast:a=Mh.highContrast.default,color:c=E7.color.default,container:u,forceMount:l,...f}=e,p=c??r.accentColor;return R.createElement(x7,{container:u,forceMount:l},R.createElement(fd,{asChild:!0},R.createElement(KG,{"data-accent-color":p,align:"start",sideOffset:4,collisionPadding:10,...f,ref:t,className:cr("rt-PopperContent","rt-BaseMenuContent","rt-DropdownMenuContent",n,an(s,"rt-r-size"),`rt-variant-${o}`,{"rt-high-contrast":a})},R.createElement(vg,{type:"auto"},R.createElement("div",{className:cr("rt-BaseMenuViewport","rt-DropdownMenuViewport")},R.createElement(C7.Provider,{value:R.useMemo(()=>({size:s,variant:o,color:p,highContrast:a}),[s,o,p,a])},i))))))});I7.displayName="DropdownMenuContent";const M7=R.forwardRef((e,t)=>R.createElement(XG,{...e,ref:t,className:cr("rt-BaseMenuLabel","rt-DropdownMenuLabel",e.className)}));M7.displayName="DropdownMenuLabel";const O7=R.forwardRef((e,t)=>{const{className:r,children:n,color:i=E7.color.default,shortcut:s,...o}=e;return R.createElement(JG,{"data-accent-color":i,...o,ref:t,className:cr("rt-reset","rt-BaseMenuItem","rt-DropdownMenuItem",r)},R.createElement(id,null,n),s&&R.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},s))});O7.displayName="DropdownMenuItem";const j7=R.forwardRef((e,t)=>R.createElement(YG,{...e,ref:t,className:cr("rt-BaseMenuGroup","rt-DropdownMenuGroup",e.className)}));j7.displayName="DropdownMenuGroup";const k7=R.forwardRef((e,t)=>R.createElement(QG,{...e,ref:t,className:cr("rt-BaseMenuRadioGroup","rt-DropdownMenuRadioGroup",e.className)}));k7.displayName="DropdownMenuRadioGroup";const R7=R.forwardRef((e,t)=>{const{children:r,className:n,...i}=e;return R.createElement(eH,{...i,ref:t,className:cr("rt-BaseMenuItem","rt-BaseMenuRadioItem","rt-DropdownMenuItem","rt-DropdownMenuRadioItem",n)},R.createElement(id,null,r),R.createElement(S7,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},R.createElement(pd,{className:"rt-BaseMenuItemIndicatorIcon rt-DropdownMenuItemIndicatorIcon"})))});R7.displayName="DropdownMenuRadioItem";const P7=R.forwardRef((e,t)=>{const{children:r,className:n,shortcut:i,...s}=e;return R.createElement(ZG,{...s,ref:t,className:cr("rt-BaseMenuItem","rt-BaseMenuCheckboxItem","rt-DropdownMenuItem","rt-DropdownMenuCheckboxItem",n)},R.createElement(id,null,r),R.createElement(S7,{className:"rt-BaseMenuItemIndicator rt-DropdownMenuItemIndicator"},R.createElement(pd,{className:"rt-BaseMenuItemIndicatorIcon rt-ContextMenuItemIndicatorIcon"})),i&&R.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},i))});P7.displayName="DropdownMenuCheckboxItem";const N7=e=>R.createElement(rH,{...e});N7.displayName="DropdownMenuSub";const D7=R.forwardRef((e,t)=>{const{className:r,children:n,...i}=e;return R.createElement(nH,{...i,ref:t,className:cr("rt-BaseMenuItem","rt-BaseMenuSubTrigger","rt-DropdownMenuItem","rt-DropdownMenuSubTrigger",r)},R.createElement(id,null,n),R.createElement("div",{className:"rt-BaseMenuShortcut rt-DropdownMenuShortcut"},R.createElement(XS,{className:"rt-BaseMenuSubTriggerIcon rt-DropdownMenuSubtriggerIcon"})))});D7.displayName="DropdownMenuSubTrigger";const $7=R.forwardRef((e,t)=>{const{className:r,children:n,container:i,forceMount:s,...o}=e,{size:a,variant:c,color:u,highContrast:l}=R.useContext(C7);return R.createElement(x7,{container:i,forceMount:s},R.createElement(fd,{asChild:!0},R.createElement(iH,{"data-accent-color":u,alignOffset:-Number(a)*4,sideOffset:1,collisionPadding:10,...o,ref:t,className:cr("rt-PopperContent","rt-BaseMenuContent","rt-BaseMenuSubContent","rt-DropdownMenuContent","rt-DropdownMenuSubContent",r,an(a,"rt-r-size"),`rt-variant-${c}`,{"rt-high-contrast":l})},R.createElement(vg,{type:"auto"},R.createElement("div",{className:cr("rt-BaseMenuViewport","rt-DropdownMenuViewport")},n)))))});$7.displayName="DropdownMenuSubContent";const L7=R.forwardRef((e,t)=>R.createElement(tH,{...e,ref:t,className:cr("rt-BaseMenuSeparator","rt-DropdownMenuSeparator",e.className)}));L7.displayName="DropdownMenuSeparator";const vs=Object.assign({},{Root:T7,Trigger:A7,Content:I7,Label:M7,Item:O7,Group:j7,RadioGroup:k7,RadioItem:R7,CheckboxItem:P7,Sub:N7,SubTrigger:D7,SubContent:$7,Separator:L7}),uH=["1","2","3","4"],lH=["classic","solid","soft","surface","outline","ghost"],_c={size:{type:"enum",values:uH,default:"2",responsive:!0},variant:{type:"enum",values:lH,default:"solid"},color:Au,highContrast:dd,radius:sg},B7=R.forwardRef((e,t)=>{const{rest:r,...n}=Cu(e),{className:i,asChild:s=!1,size:o=_c.size.default,variant:a=_c.variant.default,color:c=_c.color.default,highContrast:u=_c.highContrast.default,radius:l=_c.radius.default,...f}=r,p=s?qm:"button";return R.createElement(p,{"data-disabled":f.disabled||void 0,"data-accent-color":c,"data-radius":l,...f,ref:t,className:cr("rt-reset","rt-BaseButton",i,an(o,"rt-r-size"),`rt-variant-${a}`,{"rt-high-contrast":u},Iu(n))})});B7.displayName="BaseButton";const U7=R.forwardRef((e,t)=>R.createElement(B7,{...e,ref:t,className:cr("rt-Button",e.className)}));U7.displayName="Button";const fH={loading:{type:"boolean",default:!0}},ta=R.forwardRef((e,t)=>{const{rest:r,...n}=Cu(e),{className:i,children:s,loading:o=fH.loading.default,...a}=r;if(!o)return R.createElement(R.Fragment,null,s);const c=R.isValidElement(s)?qm:"span";return R.createElement(c,{ref:t,"aria-hidden":!0,className:cr("rt-Skeleton",i,Iu(n)),"data-inline-skeleton":R.isValidElement(s)?void 0:!0,tabIndex:-1,inert:"",...a},s)});ta.displayName="Skeleton";function bg(e){const{text:t,onClick:r,className:n,btnIsDisabled:i=!1}=e,s=()=>{r&&r()};return _.jsx(U7,{disabled:i,className:n?`cs-button ${n}`:"cs-button",onClick:s,children:t})}function Go({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]=ve.useState(!1),[u,l]=ve.useState(!1),f=ve.useRef(null),p=()=>{f.current&&(clearTimeout(f.current),f.current=null),c(!0)};ve.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=ve.useRef(null),[S,C]=ve.useState({left:void 0,top:void 0});return ve.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`),C({left:V,top:B})}},[a]),_.jsxs("div",{ref:y,style:{position:"relative",display:"inline-block"},onMouseEnter:p,onMouseLeave:v,children:[t,a&&Ef.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 Oh=[{label:"Default"},{label:"Fast Mode",beforeIcon:{xlinkHref:"#icon-icon_flash",fontSize:"16px",activeColor:"var(--cs-primary)",activeHoverColor:"var(--cs-primary)"}}],dH=e=>{const{transactionMode:t,setTransactionMode:r,maxCapForGas:n,setMaxCapForGas:i,customGasPrice:s,setCustomGasPrice:o,suiBalance:a,themeType:c}=e,u=c=="Light"?Nt("/images/icon_shio_light@2x.png"):Nt("/images/icon_shio@2x.png"),l=ve.useMemo(()=>{var O;return(O=Oh.filter(j=>(j==null?void 0:j.label)===t))==null?void 0:O[0]},[t,Oh]),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=Ve(O.target.value).gt(0)?Ve(O.target.value).div(Math.pow(10,9)).toString():"0";Ve(V).gt(n)&&i(V),o(O.target.value)},v=ve.useMemo(()=>!n||Number(n)==0?"Please enter a value higher than 0":n&&Number(n)>5?"Only allow up to 5 SUI":Ve(n).gt(a)?"Insufficient SUI balance ":Ve(n).lt(Ve(s).div(Math.pow(10,9)))?"Max cap cannot be less than custom gas.":"",[n]),w=ve.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=ve.useMemo(()=>!s||Number(s)==0?"Please enter a value higher than 0":"",[s]),S=ve.useMemo(()=>s&&Number(s)>0&&Ve(s).lt(750)?"Your current maximum fee is below the market rate. Please raise it to ensure your transactions are processed.":"",[s]),C=ve.useMemo(()=>!s||s==="0"?"0":Ve(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:Oh.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(Go,{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:C}),"SUI"]})]})]}),y&&_.jsx(Xu,{text:y,type:"error"}),S&&_.jsx(Xu,{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(Go,{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(Xu,{text:v,type:"error"}),w&&_.jsx(Xu,{text:w,type:"warn"}),_.jsxs("div",{className:"powered-by",children:[_.jsx("span",{children:"Powered by"}),_.jsx("img",{src:u,alt:"shio"})]})]})]})},Xu=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})})},hH={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 pH({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(mH,{themeType:e,onClose:()=>t(!1)})]})}function mH({onClose:e,themeType:t}){const{transactionMode:r,maxCapForGas:n,customGasPrice:i,setMaxCapForGas:s,setCustomGasPrice:o,setTransctionMode:a,mevProtect:c,setMevProtect:u}=en(),{balanceInfo:l}=Jc(hH),[f,p]=ve.useState(r),[v,w]=ve.useState(n),[y,S]=ve.useState(i),[C,O]=ve.useState(c),{slippage:j,setSlippage:V}=en(),[B,H]=ve.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)},me=()=>{B&&V(B),f==="Fast Mode"&&(s(v),o(y)),a(f),u(C),e()};ve.useEffect(()=>{f==="Fast Mode"&&O(!0)},[f]);const se=ve.useMemo(()=>f==="Fast Mode"&&(!v||Number(v)===0||Number(v)>5||!y||Number(y)===0||Ve(v).gt((l==null?void 0:l.totalBalanceFormat)||"0")||Ve(v).lt(Ve(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:bF.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(dH,{transactionMode:f,setTransactionMode:p,maxCapForGas:v,setMaxCapForGas:w,customGasPrice:y,setCustomGasPrice:S,suiBalance:(l==null?void 0:l.totalBalanceFormat)||"0",themeType:t}),_.jsx(gH,{mevProtect:C,setMevProtect:O,disabled:f==="Fast Mode"}),_.jsx(bg,{text:"Save",btnIsDisabled:se,className:"slippage-save-btn",onClick:me})]})})]})}const gH=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(Go,{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(R5,{checked:t,disabled:r,className:"cs-switch",onClick:()=>{n(!t)}})]})]})};function yH({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(pH,{themeType:t}),_.jsx(VF,{onClick:e})]})]})})}function vH(){const[e,t]=ve.useState(!1);return _.jsxs(vs.Root,{open:e,onOpenChange:t,children:[_.jsx(vs.Trigger,{children:_.jsx("div",{className:"cs-settings-btn",children:_.jsx("svg",{className:"cs-icon","aria-hidden":"true",children:_.jsx("use",{xlinkHref:"#icon-settings"})})})}),_.jsx(vs.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(bH,{}),_.jsx(_H,{onClose:()=>{t(!1)}})]})})]})}function bH(){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:rd.map(s=>_.jsxs("div",{className:"group-item",style:{justifyContent:"center"},onClick:()=>i(s.link),children:[_.jsx(md,{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 wH=e=>!/^(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/.test(e);function _H({onClose:e}){const{addTxToast:t}=tc(),{currentRpc:r,setCurrentRpc:n,customRpc:i,setCustomRpc:s,rpcList:o}=en(),[a,c]=ve.useState(i),[u,l]=ve.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(md,{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(bg,{btnIsDisabled:wH(a),text:"Save",onClick:w})]})]})]})}function F7(){const{suiClient:e}=fo(),{setAccountServiceNameObj:t,accountServiceNameObj:r}=nn(),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 xH=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()}},SH=xH,sv={"text/plain":"Text","text/html":"Url",default:"Text"},EH="Copy to clipboard: #{key}, Enter";function TH(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function AH(e,t){var r,n,i,s,o,a,c=!1;t||(t={}),r=t.debug||!1;try{i=SH(),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=sv[t.format]||sv.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=TH("message"in t?t.message:EH),window.prompt(n,e)}}finally{o&&(typeof o.removeRange=="function"?o.removeRange(s):o.removeAllRanges()),a&&document.body.removeChild(a),i()}return c}var CH=AH;const V7=lu(CH);function IH({currentAccount:e}){const{mutate:t}=un.useSwitchAccount(),r=un.useAccounts(),{isOpenAccountList:n,setIsOpenAccountList:i,accountServiceNameObj:s}=nn(),{getServiceNames:o}=F7(),a=ve.useCallback(()=>{n||o(r),i(!n)},[n,r]);ve.useEffect(()=>()=>{i(!1)},[]);const c=ve.useMemo(()=>r.filter(l=>l.address!==e),[r,e]);ve.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 MH=ve.forwardRef(({connect:e,isSimulate:t=!1})=>{const r=un.useCurrentAccount();return _.jsx("div",{children:r?_.jsx(OH,{isSimulate:t}):_.jsx(bg,{text:"Connect",className:"cs-connect-button",onClick:()=>e(!0)})})});function OH({isSimulate:e}){const{mutate:t}=un.useDisconnectWallet(),r=un.useCurrentAccount(),{currentWallet:n}=un.useCurrentWallet(),{addCommonToast:i}=tc(),{getExplorerUrl:s}=Qa(),{accountServiceNameObj:o}=nn(),a=()=>{r&&(V7(r.address||"",{debug:!1,message:"message"}),i("Copied"))},c=()=>{r&&window.open(s(r.address,"account"),"_blank")};return ve.useEffect(()=>{},[n]),_.jsxs(vs.Root,{children:[_.jsx(vs.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(vs.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(IH,{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 jH({isSimulate:e=!1}){const{fetchServiceNames:t}=F7(),r=un.useCurrentAccount();un.useCurrentWallet();const{isOpenWalletModal:n,onWalletModal:i,saveCurrentAccount:s}=nn();return un.useWallets(),ve.useEffect(()=>{r!=null&&r.address&&t([r==null?void 0:r.address])},[r==null?void 0:r.address]),_.jsx(_.Fragment,{children:_.jsx(un.ConnectModal,{trigger:_.jsx(MH,{connect:i,isSimulate:e}),open:n,onOpenChange:o=>i(o)})})}function kH({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(jH,{}),_.jsx(vH,{})]})]}),_.jsx("div",{style:{marginTop:"12px"}})]})}const z7=()=>{const e=ve.useRef(null);ve.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 RH({onClose:e,transactionData:t}){const{status:r,buildShowInfo:n,tx:i}=t,s=ve.useMemo(()=>{if(n&&r)return n(r)},[r]);return _.jsxs("div",{className:"ts-status-dialog",children:[(r==="confirmation"||r==="submitted")&&_.jsx(PH,{info:s,status:r}),(r==="success"||r==="rejected")&&_.jsx(NH,{info:s,status:r,tx:i,onClose:e})]})}function PH({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(z7,{})}),_.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 NH({info:e,status:t,tx:r,onClose:n}){const{getExplorerUrl:i}=Qa();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"}),rd.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 DH(){const{fetchByApi:e}=nd(),{setProviders:t}=en();return{fetchRouterConfig:async()=>{try{const n=await e("/router_v3/status","GET"),{providers:i}=n;i&&t(i)}catch{}}}}function $H({interval:e,callback:t}){const r=ve.useRef(),n=ve.useRef(null);ve.useEffect(()=>{r.current=t},[t]);const i=ve.useCallback(()=>{n.current&&clearInterval(n.current),e>0&&(n.current=setInterval(()=>{r.current&&r.current(Date.now())},e))},[e]),s=ve.useCallback(()=>{n.current&&(clearInterval(n.current),n.current=null)},[]);return ve.useEffect(()=>(i(),()=>s()),[]),{startTimer:i,stopTimer:s}}const LH=(e,t)=>({coinPriceObj:{},setPriceObj:r=>{const n=t().coinPriceObj;e({coinPriceObj:{...n,...r}})},clearPriceObj:r=>{const n=t().coinPriceObj;r.forEach(i=>{delete n[xr(i).full_address]}),e({coinPriceObj:{...n}})}}),q7=As(LH);function BH(e,t){const r=[];for(let n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r}function Ru(){const{fetchByApi:e}=nd(),{coinPriceObj:t,setPriceObj:r,clearPriceObj:n}=q7(),i=async a=>{const u=BH(a,10);try{const f=(await Promise.all(u.map(p=>e("/v3/sui/market_price","GET",{base_symbol_address:p.map(v=>ws(v,!1))})))).map(p=>p.prices).flat();if(f){const p={};f.forEach(v=>{p[xr(v.base_symbol).full_address]=v}),r(p)}return f}catch{return n(a),null}},s=ve.useCallback(a=>{if(!a)return;const c=t[xr(a).full_address];if(c)return c},[t]),o=ve.useCallback((a,c,u)=>{const l=Number(c)==0||!u?"0":u;if(c&&a&&+c){const f=s(a);if(f)return Ve(c).mul(f.price).toString()}return l},[t]);return{fetchTokenPrices:i,getTokenPrice:s,getTokenAmountValue:o}}function UH(){const{tokenBalanceObj:e}=nn(),{fetchTokenPrices:t}=Ru(),{isOpenTokensDialog:r}=rn(),n=ve.useCallback(()=>{if(mF(e)){const i=Object.keys(e);t(i)}},[e]);return ve.useEffect(()=>{r&&n()},[r]),{getMyAssetsPrice:n}}const FH={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"}},VH={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"}},W7=VH,G7=FH;function zH(e,t){const{fetchTokenInfo:r}=rc(),{setFromCoin:n,setToCoin:i,setDefaultCoin:s,fromCoin:o,toCoin:a}=rn(),{setSlippage:c,setRpcList:u,setCurrentRpc:l}=en(),{tokenMapIsInit:f}=ec(),p=ve.useRef({}),v=async(y,S)=>{if(!S&&!y&&(o||a))return;const C=y?await r(y):W7,O=S?await r(S):G7;n(C),i(O),s(C==null?void 0:C.coin_type,O==null?void 0:O.coin_type)},w=(y=[],S)=>{let C=[],O=Bc[0],j=Bc[0];y.forEach(V=>{const B={name:V,link:V,isCustom:!1};C.push(B),V===S&&(j=B)}),S&&y.includes(S)?C=[j,O,...C.filter(V=>V.link!==S)]:C.unshift(Bc[0]),u([...C,{name:"Custom RPC URL",link:"",isCustom:!0}]),l(j)};return ve.useEffect(()=>{if(f&&!Fm(e,p.current)){const{defaultFromToken:y,defaultToToken:S,defaultSlippage:C,customRpcList:O,defaultRpc:j}=e;v(y,S),C&&c(C),w(O||[],j),p.current=e}},[e,f]),{handleSetDefaultPair:v}}function qH(e){const{currentRpc:t}=en(),{setSuiClient:r,setAggregatorSDK:n}=fo(),{currentAccount:i}=nn();ve.useEffect(()=>{if(t){const o=new Vo({url:t.link});r(o)}},[t]);const s=()=>{const o={endpoint:Pa.aggregatorUrl,signer:(i==null?void 0:i.address)||"",client:new Vo({url:t.link}),env:Mx.Mainnet,overlayFeeRate:(e==null?void 0:e.overlayFeeRate)||void 0,overlayFeeReceiver:(e==null?void 0:e.overlayFeeReceiver)||void 0},a=new Ix(o);n(a)};ve.useEffect(()=>{t&&s()},[t.link,i==null?void 0:i.address]),ve.useEffect(()=>{e!=null&&e.overlayFeeRate&&(e!=null&&e.overlayFeeReceiver)&&s()},[e==null?void 0:e.overlayFeeRate,e==null?void 0:e.overlayFeeReceiver])}const wg=As((e,t)=>({transactionData:void 0,setTransactionData:r=>{e(()=>({transactionData:r}))}})),$r=[];for(let e=0;e<256;++e)$r.push((e+256).toString(16).slice(1));function WH(e,t=0){return($r[e[t+0]]+$r[e[t+1]]+$r[e[t+2]]+$r[e[t+3]]+"-"+$r[e[t+4]]+$r[e[t+5]]+"-"+$r[e[t+6]]+$r[e[t+7]]+"-"+$r[e[t+8]]+$r[e[t+9]]+"-"+$r[e[t+10]]+$r[e[t+11]]+$r[e[t+12]]+$r[e[t+13]]+$r[e[t+14]]+$r[e[t+15]]).toLowerCase()}let jh;const GH=new Uint8Array(16);function HH(){if(!jh){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");jh=crypto.getRandomValues.bind(crypto)}return jh(GH)}const KH=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),ov={randomUUID:KH};function av(e,t,r){var i;if(ov.randomUUID&&!t&&!e)return ov.randomUUID();e=e||{};const n=e.random??((i=e.rng)==null?void 0:i.call(e))??HH();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 WH(n)}var Uo=(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))(Uo||{});const YH=new Vo({url:e_("mainnet")}),XH=["0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC","0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD","0xf16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a::fdusd::FDUSD","0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb::usdy::USDY","0x294de7579d55c110a00a7c4946e09a1b5cbeca2592fbb83fd7bfacba3cfeaf0e::drf::DRF"],JH=["deny_list","DenyList","DenyCap","create_regulated_currency"],ZH={showType:!0,showContent:!0,showOwner:!1,showPreviousTransaction:!1,showStorageRebate:!1,showDisplay:!1},QH=async e=>{let t=!1;if(XH.includes(e))return t;const r=e.split("::"),n=r[0]&&zt(r[0]),i=r[1],s=await YH.getObject({id:n,options:ZH}),o="disassembled"in s.data.content?s.data.content.disassembled[i]:null;return o&&typeof o=="string"&&new RegExp(JH.join("|"),"i").test(o)&&(t=!0),t},eK=e=>{var n;if(!e)return"";const t=e==null?void 0:e.split(",");return(n=t==null?void 0:t.map(i=>ws(i,!1)))==null?void 0:n.join(",")};function tK(){const{fetchByApi:e}=nd(),t=async s=>{try{const o={...s},a=eK(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=Nt("/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=>Bo(S).source_address);v=p==null?void 0:p.filter(S=>{var j,V;const C=Bo((j=S==null?void 0:S.coin_a)==null?void 0:j.address).source_address,O=Bo((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(C)&&y.includes(O)?!0:!!((y==null?void 0:y.length)===1&&(y.includes(C)||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=>Cy(s)==="0x2::sui::SUI"?"0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI":Cy(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 rK(e=!0){const{poolApiMap:t,setPoolApiMap:r}=en(),{getPoolList:n,getLocalJsonPoolList:i,getLocalJsonPoolAddress:s}=tK();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 nK(e){const{routerData:t}=rn();return{priceAcceptRouterData:ve.useMemo(()=>{if(t&&e){if(e.byAmountIn){if(!Ve(e.toAmountUi).eq(t.toAmountUi||"0"))return t}else if(!Ve(e.fromAmountUi).eq(t.fromAmountUi||"0"))return t;return}},[t,e])}}function H7(e,t){return{amountLimit:ve.useMemo(()=>{if(t&&t.routerData){const{byAmountIn:n,fromAmountUi:i,toAmountUi:s}=t;return n?Ve(s).mul(Ve(1).sub(Ve(e).div(100))).toString():Ve(i).mul(Ve(1).add(Ve(e).div(100))).toString()}},[e,t])}}function iK(){const{fromCoin:e,toCoin:t}=rn(),{getPoolAddressByCoinType:r}=rK(!0);return{getSwapPoolAddress:async()=>e&&t?await r(e.coin_type,t.coin_type):[]}}function K7(e,t,r){return ve.useMemo(()=>t&&r&&+t&&+r?e?Ve(r).div(t).toString():Ve(t).div(r).toString():"0",[t,r,e])}function cv(e){const[t,r]=ve.useState(),n=async i=>{if(i.is_trusted)return!1;try{return await QH(i.coin_type)}catch{}return!1};return ve.useEffect(()=>{r(void 0),e&&n(e).then(i=>{r(i)})},[e==null?void 0:e.coin_type]),{isScamsCoin:t}}function sK(e,t){const{defaultFromCoinType:r,defaultToCoinCoinType:n}=rn(),{getTokenInfo:i}=rc(),{ignoreWarnTokenMap:s}=en(),o=i(e),a=i(t),c=ve.useMemo(()=>!Fu(r,W7.coin_type)||!Fu(n,G7.coin_type),[r,n]),u=ve.useCallback(f=>f&&!s[ws(f.coin_type)]&&(Fu(r,f.coin_type)||Fu(n,f.coin_type))?!f.is_trusted:!1,[r,n,s]),l=ve.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 oK(){const{aggregatorSDK:e}=fo(),{getSwapPoolAddress:t}=iK(),r=s=>s&&s.error?s.error.code===Uo.InsufficientLiquidity||Uo.HoneyPot||Uo.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 O1(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 O1(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=Dp(l.amountIn.toString(),c.decimals).toString(),w=Dp(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 ha(e){const t=ve.useRef(e);return ve.useEffect(()=>{t.current=e},[e]),t}function aK(e){try{return e&&e.toString().includes("Rejected from user")}catch{return!1}}function cK(e){const t=String(e);return t.indexOf("withdraw_with_proof")>-1||t.indexOf("check_coin_threshold")>-1||t.indexOf('Identifier("balance")')>-1}function uK(e){return!!String(e).includes("Could not find the referenced transaction")}function lK(e){return!!String(e).includes("Max cap reached.")}function fK(e){return!!String(e).includes("Fast Mode service error")}function dK(e){return aK(e)?"User rejected the request":cK(e)?"Exceeded price slippage":uK(e)?"Oops. Failed to sync data from your txid. Please check your txn status from explorer or from your wallet.":lK(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.":fK(e)?"Fast Mode service error, please switch to the Default Transaction Mode or try again later.":"Transaction failed"}var _g={},hK=Pr&&Pr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(_g,"__esModule",{value:!0});var pK=_g.executeAuction=Y7;const mK=hK(W_),gK="https://rpc.getshio.com",yK=500,vK=300;function Y7(e,t,r=yK){const n={jsonrpc:"2.0",method:"shio_executeAuction",params:[e,t],id:1};return new Promise((i,s)=>{setTimeout(i,r),mK.default.post(gK,n,{headers:{"Content-Type":"application/json"},timeout:r}).then(o=>{setTimeout(i,vK)}).catch(s)})}_g.default={executeAuction:Y7};const bK="0x2::sui::SUI",wK="https://rpc.getshio.com/fast",_K="0x1889977f0fb56ae730e7bda8e8e32859ce78874458c74910d36121a81a615123",uv=[{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 xK(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,Zl.from(r).toString("base64")])}function SK(){return uv[Math.floor(Math.random()*uv.length)]}async function EK(e,t,r){return await e.executeTransactionBlock({transactionBlock:t.bytes,signature:t.signature,options:r})}async function TK(e,t,r){let n=e.moveCall({package:"0x2",module:"coin",function:"into_balance",typeArguments:[bK],arguments:[t]});return AK(e,n,r)}async function AK(e,t,r){let n=SK();e.moveCall({package:_K,module:"auctioneer",function:"submit_bid",arguments:[e.sharedObjectRef({objectId:n.objectId,mutable:!0,initialSharedVersion:n.version}),e.pure.u64(r),t]})}const Kp="CoinWithBalance",CK=$.object({type:$.string(),balance:$.bigint()});async function IK(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===Kp){const{type:p,balance:v}=$.parse(CK,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 MK({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!==Kp)continue;const{type:v,balance:w}=p.$Intent.data;if(w===0n&&v!=="gas"){e.replaceCommand(f,Rn.Commands.MoveCall({target:"0x2::coin::zero",typeArguments:[v]}));continue}const y=[];if(!c.has(v)){const[S,...C]=o.get(v).map(O=>e.addInput("object",Rn.Inputs.ObjectRef({objectId:O.coinObjectId,digest:O.digest,version:O.version})));C.length>0&&y.push(Rn.Commands.MergeCoins(S,C)),c.set(v,S)}y.push(Rn.Commands.SplitCoins(c.get(v),[e.addInput("pure",Rn.Inputs.Pure(oi.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 MK({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 X7(){const{suiClient:e}=fo(),{currentAccount:t}=nn(),{mutateAsync:r}=un.useSignTransaction(),{mutate:n}=un.useSignAndExecuteTransaction({execute:async({bytes:c,signature:u})=>await s(c,u)}),i=ve.useMemo(()=>"sui:mainnet",[t]),s=async(c,u,l=!1)=>{var p,v;if(l){const w=await e.devInspectTransactionBlock({transactionBlock:Rn.Transaction.from(Sr(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=Rn.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=Rn.Transaction.from(c)),typeof c=="string"&&(c=Rn.Transaction.from(Sr(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 OK(){const{signTransactionBlock:e,executeTransactionBlock:t,signAndExecuteTransactionBlock:r}=X7(),{currentAccount:n}=nn();return{getFastModeTx:async(s,o,a)=>{let c,u,l;try{const f=new Vo({url:wK});s.setSender(n==null?void 0:n.address),s.setGasPrice(Number(a));const p=Rn.Transaction.from(s);p.addIntentResolver(Kp,IK);const v=await xK({transaction:p,client:f}),w=Ve(o).mul(Math.pow(10,9)).toString();if(Ve(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]);TK(s,y[0],v.tipAmount);const S=await s.build({client:f}),C=await e(S),{bytes:O,signature:j}=C;l=O,u=new Date().getTime(),c=await EK(f,C,{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 jK(){const{signTransactionBlock:e,executeTransactionBlock:t,signAndExecuteTransactionBlock:r}=X7(),{currentAccount:n}=nn(),{suiClient:i}=fo(),{setTransactionData:s}=wg(),{addTxToast:o,removeToast:a}=tc(),{getFastModeTx:c}=OK(),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 Ty(l),f(w,y+1)}}const p=async(w,y,S={useDevInspect:!1,useMev:!1,txAction:"signTransactionBlock",useFastMode:!1,maxCapForGas:"",customGasPrice:""})=>{var me,se,fe;const{useDevInspect:C=!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:A}=x;if(O)try{const k=await pK(E,A,500)}catch{}z=await t(E,A,C)}else z=await r(h,C);y.status="submitted",s({...y}),y.tx=z.digest,q=o(y),await Ty(l),ne=z==null?void 0:z.digest;let m;if(((me=z==null?void 0:z.effects)==null?void 0:me.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=pF(m,n==null?void 0:n.address,!1);if(y.buildShowInfo){const E=y.buildShowInfo("success",x);y.buildShowInfo=A=>E}a(q),y.status="success",s({...y})}return m}catch(z){v(y,z)}},v=(w,y)=>{const S=dK(y);if(w.buildShowInfo){const C=w.buildShowInfo("confirmation");w.buildShowInfo=O=>(C.toastDescriptionContent=S,C.modalDescriptionText=S,C),w.status="rejected",s({...w})}else w.buildShowInfo=C=>{const O={};return O.toastDescriptionContent=S,O.modalDescriptionText=S,O},w.status="rejected",s({...w})};return{signAndExecuteTransaction:p}}function xg(e,t=1e3){const r=ve.useRef(),n=ve.useCallback((...i)=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{e(...i)},t)},[e,t]);return ve.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]),n}function kK(){const{aggregatorSDK:e}=fo(),{findBestRouters:t}=oK(),{getTokenAmountValue:r,fetchTokenPrices:n}=Ru(),{providers:i,slippage:s,mevProtect:o,maxCapForGas:a,transactionMode:c,customGasPrice:u}=en(),{signAndExecuteTransaction:l}=jK(),{setTransactionData:f}=wg(),{addTxToast:p}=tc(),{fromCoin:v,toCoin:w,setFromCoin:y,setToCoin:S,setToAmount:C,fromAmount:O,toAmount:j,setFromAmount:V,setFindRouterLoading:B,setRouterData:H,setByAmountIn:q,byAmountIn:ne}=rn(),[me,se]=ve.useState(""),fe=ha(me),z=ha(ne),N=ha(O),h=ha(j),d=ha(v),m=ha(w),{balanceInfo:x,getOwnerCoinBalances:E}=Jc(v),{balanceInfo:A}=Jc(w),k=r(v==null?void 0:v.coin_type,O),M=r(w==null?void 0:w.coin_type,j),b=xg(async(te,Q,G)=>{if(d.current&&m.current&&+te){(+N.current||+h.current)&&B(!0);const he=dF(te,Q?d.current.decimals:m.current.decimals),X=await t({fromToken:d.current,toToken:m.current,amount:he.toString(),providersKeys:i,by_amount_in:Q,uuid:G});B(!1),fe.current===G&&(Q?+N.current?(C(X.toAmountUi||""),H(X)):C(""):+h.current?(V(X.fromAmountUi||"ß"),H(X)):V(""))}else ie(!Q)},500),P=(te,Q,G=!1)=>{if(q(Q),Q?(V(te),G&&C("")):(C(te),G&&V("")),+te){const he=av();se(he),b(te,Q,he)}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(""),C("")):te?V(""):C(""),B(!1),H(void 0)},le=()=>{const te=z.current?N.current:h.current;if(+te){const Q=av();se(Q),b(te,z.current,Q)}},be=async(te,Q)=>{const{routerData:G,byAmountIn:he,fromAmountUi:X,toAmountUi:J}=te,U=new Rn.Transaction,oe={router:G,slippage:Number(s)/100,txb:U,partner:Q||xF};try{const ge={status:"confirmation",buildShowInfo:(je,Fe)=>{const Je=`Swap ${ln(X,v==null?void 0:v.decimals)} ${v==null?void 0:v.symbol} for ${ln(J,w==null?void 0:w.decimals)} ${w==null?void 0:w.symbol}`,Ne={modalDescriptionText:Je,toastTitleText:Je};if(je==="success"){let Ge=X,nt=J;Fe&&(Ge=Ay(Fe,v)||X,nt=Ay(Fe,w)||J);const et=`Swapped ${ln(Ge,v==null?void 0:v.decimals)} ${v==null?void 0:v.symbol} for ${ln(nt,w==null?void 0:w.decimals)} ${w==null?void 0:w.symbol}`;Ne.toastTitleText=et,Ne.modalDescriptionText=et}return Ne},id:0};f(ge),await l(async()=>(await e.fastRouterSwap(oe),U),ge,{useMev:o,useFastMode:c==="Fast Mode",maxCapForGas:a,customGasPrice:u})?(ie(),E()):le()}catch(ge){String(ge).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."}}})}};ve.useEffect(()=>{Ce(),ie()},[v==null?void 0:v.coin_type,w==null?void 0:w.coin_type]);const Ce=()=>{const te=[];v&&te.push(v.coin_type),w&&te.push(w.coin_type),te.length>0&&n(te)},{isScamsCoin:D}=cv(v),{isScamsCoin:F}=cv(w),K=ve.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:P,handleSelectToken:ue,fromBalanceInfo:x,toBalanceInfo:A,fromAmountValue:k,toAmountValue:M,doSwapAction:be,reCalculateRouteData:le,refreshMarketPrice:Ce,scamsText:K}}function RK(e){const{fromCoin:t,toCoin:r,fromAmount:n,toAmount:i,routerData:s}=rn(),{currentAccount:o}=nn(),a=ve.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===Uo.InsufficientLiquidity)return c.text="Insufficient liquidity for this trade",c.disabled=!0,c;if(s.errorCode===Uo.NoRouter||s.errorCode===Uo.HoneyPot)return c.text="No Available Route",c.disabled=!0,c}return+n&&Ve(n).gt(e||0)?(c.disabled=!0,c.text=`Insufficient ${Vr(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 lv=878,yi=176,Ju=72,wo=22,PK=8,ts=16,NK=24,DK=12,$K=16,LK=8,BK=22,Dr=50,br=55,pa=13,En=5;function J7(e,t,r){const[n,i]=ve.useState({}),[s,o]=ve.useState([]),[a,c]=ve.useState([]),[u,l]=ve.useState(0),{fromCoin:f,toCoin:p}=rn(),[v,w]=ve.useState([]),[y,S]=ve.useState([]);function C(h,d,m,x=3){const E=new Set;h.forEach(ie=>{E.add(ie.from),E.add(ie.target)});const A=[],k=[],M=new Set;h.forEach(ie=>{var le;if(ie.from===d&&ie.target!==m){const be=ie.target,Ce=h.some(F=>F.target===be&&F.from!==d);let D=!1;if(Ce){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 Ce=new Map;le[be].forEach(D=>{const F=D.provider,K=D.feeRate,te=`${F}_${K}`;if(Ce.has(te)){const Q=Ce.get(te);Q.amountIn=Ve(Q.amountIn).plus(D.amountIn||"0").toString(),Q.amountOut=Ve(Q.amountOut).plus(D.amountOut||"0").toString()}else Ce.set(te,{...D,amountIn:D.amountIn||"0",amountOut:D.amountOut||"0"})}),le[be]=Array.from(Ce.values())}),k.push({target:`0-${ie}`,originalTarget:ie,list:le})}),k.length>0&&A.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 Ce=new Map;le[be].forEach(D=>{const F=D.provider,K=D.feeRate,te=`${F}_${K}`;if(Ce.has(te)){const Q=Ce.get(te);Q.amountIn=Ve(Q.amountIn).plus(D.amountIn||"0").toString(),Q.amountOut=Ve(Q.amountOut).plus(D.amountOut||"0").toString()}else Ce.set(te,{...D,amountIn:D.amountIn||"0",amountOut:D.amountOut||"0"})}),le[be]=Array.from(Ce.values())}),g.push({target:`1-${ie}`,originalTarget:ie,list:le}))}),g.length>0&&A.push(g);const P=[],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 Ce=be.provider,D=be.feeRate,F=`${Ce}_${D}`;if(le.has(F)){const K=le.get(F);K.amountIn=Ve(K.amountIn).plus(be.amountIn||"0").toString(),K.amountOut=Ve(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())}),P.push({target:`2-${m}`,originalTarget:m,list:ue})),P.length>0&&A.push(P),A}function O(h,d,m){var b,P,ue;const x=h.length,E=x*yi+(x-1)*Ju,A=(lv-E)/2,k=new Map,M=[],g=new Map;if(h.forEach((ie,le)=>{ie.forEach(be=>{const Ce=`${le}-${be.target}`,D=N(be.list);g.set(Ce,D)})}),x===1){const ie=h[0];let le=Dr;ie.forEach(be=>{const Ce=`0-${be.target}`,D=g.get(Ce)||0;k.set(Ce,{...be,id:Ce,top:le,left:A,height:D,width:yi,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]),Ce=ie.map(K=>{var Q;const te=((Q=K.list[d])==null?void 0:Q.reduce((G,he)=>G+parseFloat(he.amountIn||"0"),0))||0;return{block:K,totalAmountIn:te}}).sort((K,te)=>te.totalAmountIn-K.totalAmountIn).map(({block:K})=>K);let D=be?Dr+wo:Dr;Ce.forEach(K=>{const te=`0-${K.target}`,Q=g.get(te)||0;k.set(te,{...K,id:te,top:D,left:A,height:Q,width:yi,columnIndex:0}),D+=Q+ts});let F=Dr;le.forEach(K=>{const te=`1-${K.target}`,Q=g.get(te)||0;k.set(te,{...K,id:te,top:F,left:A+yi+Ju,height:Q,width:yi,columnIndex:1}),F+=Q+ts}),M.push(Ce,le)}else{const ie=h[0],le=h[1],be=h[2],Ce=((b=be[0])==null?void 0:b.originalTarget)||((P=be[0])==null?void 0:P.target),D=ie.map(de=>{var Ct,Rt;const Ee=de.originalTarget||de.target,je=`0-${de.target}`,Fe=g.get(je)||0,Je=le.some(He=>He.originalTarget==de.originalTarget),Ne=((Rt=(Ct=be==null?void 0:be[0])==null?void 0:Ct.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(ut=>ut.from===Ee&&ut.target===pt)}),nt=[];le.forEach(He=>{const pt=He.originalTarget||He.target;m.some(ut=>ut.from===Ee&&ut.target===pt)&&nt.push(pt)});let et=6;if(Ne&&!Ge)et=1;else if(Ne&&Ge)et=2;else if(!Ne&&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 ut=le.find(ot=>(ot.originalTarget||ot.target)===pt);return(ut?Object.keys(ut.list||{}).length:0)===1})?et=4:et=6;return{block:de,target:Ee,height:Fe,hasDirectToTarget:Ne,hasConnectionToSecond:Ge,secondColTargets:nt,priority:et}});D.sort((de,Ee)=>{var Je,Ne;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(((Ne=Ee.block.list[d])==null?void 0:Ne.reduce((Ge,nt)=>Ge+parseFloat(nt.amountIn||"0"),0))||0)-je});const F=be.some(de=>(de.originalTarget||de.target)===Ce&&de.list&&de.list[d]),K=le.some(de=>de.list&&de.list[d]);let te=F?Dr+wo:Dr;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}`,Fe=g.get(je)||0;te+=Fe+ts}else te+=wo}K&&D.length>0&&(D[0].hasDirectToTarget&&te<=Dr+wo?te+=50:te+=ts);let Q=te;D.forEach((de,Ee)=>{const je=`0-${de.block.target}`,Fe=g.get(je)||0;k.set(je,{...de.block,id:je,top:Q,left:A,height:Fe,width:yi,columnIndex:0}),Ee<D.length-1&&(Q+=Fe+ts)});const G=[],he=le.find(de=>de.list&&de.list[d]);he&&G.push(he),D.forEach(de=>{de.secondColTargets.forEach(Ee=>{const je=le.find(Fe=>(Fe.originalTarget||Fe.target)===Ee);je&&!G.some(Fe=>Fe.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?Dr+wo:Dr;D.some(de=>de.hasDirectToTarget&&de.hasConnectionToSecond)&&(X+=wo);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}`,Fe=g.get(je)||0;Ee===0&&U>0&&(K?oe+=wo:oe+=U*120+U*ts),k.set(je,{...de,id:je,top:oe,left:A+yi+Ju,height:Fe,width:yi,columnIndex:1}),oe+=Fe+ts});let ge=Dr;be.forEach(de=>{const Ee=`2-${de.target}`,je=g.get(Ee)||0;k.set(Ee,{...de,id:Ee,top:ge,left:A+2*yi+2*Ju,height:je,width:yi,columnIndex:2}),ge+=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((A,k)=>{A.forEach(M=>{const g=M.originalTarget||M.target;if(M.list&&M.list[m]){const b=M.list[m].reduce((P,ue)=>P+parseFloat(ue.amountIn||"0"),0);E.push({target:g,amountIn:b,colIndex:k})}})}),E.length>0){const A=E.reduce((g,b)=>g+b.amountIn,0),k=[];E.forEach(({amountIn:g})=>{const b=A>0?Tl(Ve(g).div(A).mul(100).toString(),0):0;k.push(Number(b)||1)});const M=Al(k);E.forEach(({target:g},b)=>{var ue;const P=((ue=M[b])==null?void 0:ue.toString())||"0";x[m]||(x[m]={}),x[m][g]={fromPercent:P}})}return h.length>0&&h[0].forEach(k=>{const M=k.originalTarget||k.target,g=`0-${M}`,b=[];let P=!1;if(h.length>1&&(P=h[1].some(ie=>(ie.originalTarget||ie.target)===M)),P)h[1].forEach(ie=>{const le=ie.originalTarget||ie.target;if(ie.list&&ie.list[M]){const be=ie.list[M].reduce((Ce,D)=>Ce+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 Ce=le.list[M].reduce((D,F)=>D+parseFloat(F.amountIn||"0"),0);b.push({target:be,amountIn:Ce})}});if(b.length>0){const ue=b.reduce((be,Ce)=>be+Ce.amountIn,0),ie=[];b.forEach(({amountIn:be})=>{const Ce=ue>0?Tl(Ve(be).div(ue).mul(100).toString(),0):0;ie.push(Number(Ce)||1)});const le=Al(ie);b.forEach(({target:be},Ce)=>{const D=le[Ce];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,Ce)=>be+parseFloat(Ce.amountIn||"0"),0);b.push({target:ie,amountIn:le})}}),b.length>0){const ue=b.reduce((be,Ce)=>be+Ce.amountIn,0),ie=[];b.forEach(({amountIn:be})=>{const Ce=ue>0?Tl(Ve(be).div(ue).mul(100).toString(),0):0;ie.push(Number(Ce)||1)});const le=Al(ie);b.forEach(({target:be},Ce)=>{const D=le[Ce];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,Ce,D;const A=[],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=(Ce=h[m])==null?void 0:Ce[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?A.push({from:m,to:F.id,fromX:pa,fromY:F.top+F.height/2,toX:F.left-En,toY:F.top+F.height/2,fromPercent:K,isStart:!0}):A.push({from:m,to:F.id,fromX:pa,fromY:Dr+10,toX:F.left-En,toY:Dr+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?A.push({from:m,to:G.id,fromX:pa,fromY:G.top+G.height/2,toX:G.left-En,toY:G.top+G.height/2,fromPercent:X,isStart:!0}):A.push({from:m,to:G.id,fromX:pa,fromY:G.top+10,toX:G.left-En,toY:G.top+10,fromPercent:X,isStart:!0}):A.push({from:m,to:G.id,fromX:pa,fromY:G.top+G.height/2,toX:G.left-En,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 he=te.list||{};Object.entries(he).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,ge=M.get(oe)||0;M.set(oe,ge+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 he=te.list||{};Object.entries(he).forEach(([X,J])=>{var je,Fe,Je,Ne,Ge,nt,et,Ct,Rt,He,pt,ut,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,ge=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=(Fe=h[`${U.columnIndex}-${U.originalTarget||U.target}`])==null?void 0:Fe[Q])==null?void 0:Je.fromPercent)||"0";A.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(ge>=G.top&&ge<=G.top+G.height){const st=((Ge=(Ne=h[`${U.columnIndex}-${U.originalTarget||U.target}`])==null?void 0:Ne[Q])==null?void 0:Ge.fromPercent)||"0";A.push({from:U.id,to:G.id,fromX:U.left+U.width,fromY:ge,toX:G.left-En,toY:ge,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 Pt=((et=(nt=h[`${U.columnIndex}-${U.originalTarget||U.target}`])==null?void 0:nt[Q])==null?void 0:et.fromPercent)||"0";A.push({from:U.id,to:G.id,fromX:U.left+U.width,fromY:yt,toX:G.left-En,toY:yt,fromPercent:Pt}),st=!0;break}st||(de=!0)}}else if(ge>=G.top&&ge<=G.top+G.height){const gt=((Rt=(Ct=h[`${U.columnIndex}-${U.originalTarget||U.target}`])==null?void 0:Ct[Q])==null?void 0:Rt.fromPercent)||"0";A.push({from:U.id,to:G.id,fromX:U.left+U.width,fromY:ge,toX:G.left,toY:ge,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";A.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=(ut=h[`${U.columnIndex}-${U.originalTarget||U.target}`])==null?void 0:ut[Q])==null?void 0:tt.fromPercent)||"0",st=M.get(oe)||1,yt=g.get(oe)||0,Pt=50,mt=U.top+10,It=U.height-20,$t=st>3?Math.min(Pt,It/Math.max(1,st-1)):Pt,Ke=mt+yt*$t;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 Lt=U.left+U.width/2,L=U.top;A.push({from:U.id,to:G.id,fromX:Lt,fromY:L,toX:G.left,toY:Dr+10,fromPercent:gt,segments:[{x1:Lt,y1:L,x2:Lt,y2:Dr+10},{x1:Lt,y1:Dr+10,x2:G.left-En,y2:Dr+10}]})}else G.top>U.top+U.height?A.push({from:U.id,to:G.id,fromX:U.left+U.width,fromY:Ke,toX:U.left+U.width+br,toY:Ke,fromPercent:gt,segments:[{x1:U.left+U.width,y1:Ke,x2:U.left+U.width+br,y2:Ke},{x1:U.left+U.width+br,y1:Ke,x2:U.left+U.width+br,y2:G.top+20},{x1:U.left+U.width+br,y1:G.top+20,x2:G.left,y2:G.top+20}]}):A.push({from:U.id,to:G.id,fromX:U.left+U.width,fromY:Ke,toX:U.left+U.width+br,toY:Ke,fromPercent:gt,segments:[{x1:U.left+U.width,y1:Ke,x2:U.left+U.width+br,y2:Ke},{x1:U.left+U.width+br,y1:Ke,x2:U.left+U.width+br,y2:G.top+G.height-20},{x1:U.left+U.width+br,y1:G.top+G.height-20,x2:G.left-En,y2:G.top+G.height-20}]})}else x.length===3&&U.columnIndex===1&&G.columnIndex===2&&G.top<U.top?A.push({from:U.id,to:G.id,fromX:U.left+U.width,fromY:Ke,toX:G.left+G.width/2,toY:Ke,fromPercent:gt,segments:[{x1:U.left+U.width,y1:Ke,x2:G.left+G.width/2,y2:Ke},{x1:G.left+G.width/2,y1:Ke,x2:G.left+G.width/2,y2:G.top+G.height+En}]}):G.top>U.top+U.height?A.push({from:U.id,to:G.id,fromX:U.left+U.width,fromY:Ke,toX:U.left+U.width+br,toY:Ke,fromPercent:gt,segments:[{x1:U.left+U.width,y1:Ke,x2:U.left+U.width+br,y2:Ke},{x1:U.left+U.width+br,y1:Ke,x2:U.left+U.width+br,y2:G.top+20},{x1:U.left+U.width+br,y1:G.top+20,x2:G.left-En,y2:G.top+20}]}):A.push({from:U.id,to:G.id,fromX:U.left+U.width,fromY:Ke,toX:U.left+U.width+br,toY:Ke,fromPercent:gt,segments:[{x1:U.left+U.width,y1:Ke,x2:U.left+U.width+br,y2:Ke},{x1:U.left+U.width+br,y1:Ke,x2:U.left+U.width+br,y2:G.top+G.height-20},{x1:U.left+U.width+br,y1:G.top+G.height-20,x2:G.left-En,y2:G.top+G.height-20}]})}})});const b=Math.max(...Array.from(d.values()).map(F=>F.columnIndex)),P=Array.from(d.values()).filter(F=>F.columnIndex===b);if(P.length>0){const F=P[0],K=F.top+F.height/2;A.push({from:F.id,to:"final",fromX:F.left+F.width,fromY:K,toX:lv-pa,toY:K,fromPercent:"100",isFinal:!0})}return{edges:A}}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=Iy((f==null?void 0:f.coin_type)||t||""),m=Iy((p==null?void 0:p.coin_type)||r||""),x=C(h,d,m,3),{nodesMap:E,orderedNodeColume:A}=O(x,d,h);S(A);const k=j(A,h,d),{edges:M}=B(k,E,d,A),g=[...E.values()],b=H([...E.values()])+Dr+32;l(b),o(g),c(M);const P=Array.from(new Set([...E.values()].map(ie=>ie.originalTarget||ie.target)));fe([...P,d])},{getTokenListInfo:ne}=rc(),[me,se]=ve.useState(new Map),fe=async h=>{const d=await ne(h);d&&(d==null?void 0:d.size)>0&&se(d)};ve.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=PK*2+NK;const m=Object.entries(h);return m.forEach(([x,E],A)=>{d+=DK*2,d+=$K,d+=10,E.forEach(k=>{d+=BK})}),d+((m==null?void 0:m.length)-1)*LK+10}return{newFormatSwapRouter:n,nodes:s,edges:a,tokenMap:me,panelHeight:u,getAllProviders:z,allProviders:v,resultColumes:y}}function UK({themeType:e}){const t=e=="Light"?Nt("/images/logo_light@2x.png"):Nt("/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 Sg({baseToken:e,quoteToken:t,baseAmount:r,quoteAmount:n,loading:i,fontSize:s="14px"}){const[o,a]=ve.useState(!0),c=K7(o,r,n);return _.jsxs("div",{className:"current-price-block",style:{cursor:"pointer"},onClick:()=>{a(!o)},children:[_.jsx(kr,{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"," ",Vr(o?e==null?void 0:e.symbol:t==null?void 0:t.symbol)," ","="," ",i?_.jsx(ta,{className:"custom-skeleton",style:{height:"16px",width:"40px",marginLeft:"2px",marginRight:"2px"}}):ln(c,t==null?void 0:t.decimals)," ",Vr(o?t==null?void 0:t.symbol:e==null?void 0:e.symbol)]}),_.jsx(kr,{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 sc(){const[e,t]=ve.useState(window.innerWidth),r=xg(()=>{t(window.innerWidth)},300);ve.useEffect(()=>(window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r)}),[]);const n=ve.useMemo(()=>e<810,[e]);return{windowWidth:e,isApp:n}}function xd({content:e,children:t,position:r,autoSwitchTooltip:n=!1,borderRadius:i="8px"}){const{isApp:s}=sc();return s&&n?_.jsxs(vs.Root,{children:[_.jsx(vs.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(vs.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(Go,{content:e,position:r,borderRadius:i,children:t})}function FK({pr:e="8px",pl:t="8px",value:r,isLoading:n}){const{isApp:i}=sc();return _.jsxs("div",{className:"swap-info-between",style:{paddingLeft:t,paddingRight:e},children:[_.jsxs("div",{className:"left",children:[_.jsx("span",{children:"Overlay Fee"}),_.jsx(xd,{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(ta,{className:"custom-skeleton",style:{height:"18px",width:"80px"}}):_.jsx("div",{className:"right",children:r?`${Ve(r).mul(100).toString()}%`:""})]})}function Z7(e,t,r,n){const{getTokenPrice:i}=Ru(),s=i(e==null?void 0:e.coin_type),o=i(t==null?void 0:t.coin_type),a=K7(!0,r,n),c=ve.useMemo(()=>{if(o&&s)return Ve(s.price).div(o.price).toString()},[s==null?void 0:s.price,o==null?void 0:o.price]),u=ve.useMemo(()=>{if(c&&+a)return Ve(a).sub(c).div(a).mul(100).toFixed(10)},[c,a]),l=ve.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=ve.useMemo(()=>!s||!o||s.market==="cetus"||o.market==="cetus",[s,o]),p=ve.useMemo(()=>f?!1:u&&Ve(u).lt(0)?Ve(u).abs().gt(5):!1,[u,f]),v=ve.useMemo(()=>f?!1:u&&Ve(u).lt(0)?Ve(u).abs().gt(10):!1,[u,f]),w=ve.useMemo(()=>{let y,S="yellow";if(f)return{priceImpactText:void 0,textColor:"yellow"};if(u)if(Ve(u).gt(0))S="green",Ve(u).lt(.1)?y="< 0.1% cheaper than":y=`${ln(u,2,!0,Fr.ROUND_UP)}% cheaper than`;else if(Ve(u).eq(0))y="0%",S="green";else{const C=Ve(u).abs();C.lte(5)?(S="green",y=`Within ${ln(C.toString(),2,!0,Fr.ROUND_UP)}%`):C.lte(10)?(S="yellow",y=`${ln(C.toString(),2,!0,Fr.ROUND_UP)}% more than`):C.lte(100)?(S="red",y=`${ln(C.toString(),2,!0,Fr.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 Q7({isLoading:e,routerData:t,noTips:r}){const{fromCoin:n,toCoin:i,fromAmount:s,toAmount:o}=rn();sc();const{priceImpact:a,sources:c,marketPrice:u,priceImpactTextInfo:l,showIncalculable:f}=Z7(n,i,t==null?void 0:t.fromAmountUi,t==null?void 0:t.toAmountUi);return _.jsxs(_.Fragment,{children:[!r&&Ve(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(xd,{autoSwitchTooltip:!0,position:"top",content:_.jsx(VK,{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(ta,{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(Go,{content:_.jsx("span",{style:{fontSize:"12px",color:"var(--cs-text-primary)"},children:Zx[p]}),position:"top",delay:300,children:_.jsx(kr,{src:CF[p],haveBorder:!1,style:{width:"16px",height:"16px"}})},p))})]})]})]})]})}function VK({fromToken:e,toToken:t,baseAmount:r,quoteAmount:n,sources:i,showIncalculable:s}){const{isApp:o}=sc();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(Sg,{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=>Zx[a]+" ").join("")})]})]})}function eE({pr:e="8px",pl:t="8px",amountLimit:r,isLoading:n}){const{fromCoin:i,toCoin:s,byAmountIn:o}=rn();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(ta,{className:"custom-skeleton",style:{height:"18px",width:"80px"}}):_.jsxs("div",{className:"right",children:[ln(r,o?s==null?void 0:s.decimals:i==null?void 0:i.decimals,!1,Fr.ROUND_DOWN)," ",Vr(o?(s==null?void 0:s.symbol)||"":(i==null?void 0:i.symbol)||"")]})]})}function zK({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(Qx,{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 qK({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 Eg({title:e,backClick:t}){return _.jsxs("div",{className:"cs-have-back-header",children:[_.jsx(qK,{onClick:t}),_.jsx("span",{className:"title",children:e})]})}const Zu=globalThis||void 0||self;var WK=typeof Zu=="object"&&Zu&&Zu.Object===Object&&Zu;const tE=WK;var GK=typeof self=="object"&&self&&self.Object===Object&&self,HK=tE||GK||Function("return this")();const qi=HK;var KK=qi.Symbol;const Fi=KK;var rE=Object.prototype,YK=rE.hasOwnProperty,XK=rE.toString,xc=Fi?Fi.toStringTag:void 0;function JK(e){var t=YK.call(e,xc),r=e[xc];try{e[xc]=void 0;var n=!0}catch{}var i=XK.call(e);return n&&(t?e[xc]=r:delete e[xc]),i}var ZK=Object.prototype,QK=ZK.toString;function eY(e){return QK.call(e)}var tY="[object Null]",rY="[object Undefined]",fv=Fi?Fi.toStringTag:void 0;function oc(e){return e==null?e===void 0?rY:tY:fv&&fv in Object(e)?JK(e):eY(e)}function ao(e){return e!=null&&typeof e=="object"}var nY="[object Symbol]";function iu(e){return typeof e=="symbol"||ao(e)&&oc(e)==nY}function jl(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 iY=Array.isArray;const mn=iY;var sY=1/0,dv=Fi?Fi.prototype:void 0,hv=dv?dv.toString:void 0;function nE(e){if(typeof e=="string")return e;if(mn(e))return jl(e,nE)+"";if(iu(e))return hv?hv.call(e):"";var t=e+"";return t=="0"&&1/e==-sY?"-0":t}function ac(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function iE(e){return e}var oY="[object AsyncFunction]",aY="[object Function]",cY="[object GeneratorFunction]",uY="[object Proxy]";function sE(e){if(!ac(e))return!1;var t=oc(e);return t==aY||t==cY||t==oY||t==uY}var lY=qi["__core-js_shared__"];const kh=lY;var pv=function(){var e=/[^.]+$/.exec(kh&&kh.keys&&kh.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function fY(e){return!!pv&&pv in e}var dY=Function.prototype,hY=dY.toString;function ra(e){if(e!=null){try{return hY.call(e)}catch{}try{return e+""}catch{}}return""}var pY=/[\\^$.*+?()[\]{}|]/g,mY=/^\[object .+?Constructor\]$/,gY=Function.prototype,yY=Object.prototype,vY=gY.toString,bY=yY.hasOwnProperty,wY=RegExp("^"+vY.call(bY).replace(pY,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function _Y(e){if(!ac(e)||fY(e))return!1;var t=sE(e)?wY:mY;return t.test(ra(e))}function xY(e,t){return e==null?void 0:e[t]}function na(e,t){var r=xY(e,t);return _Y(r)?r:void 0}var SY=na(qi,"WeakMap");const Yp=SY;var mv=Object.create,EY=function(){function e(){}return function(t){if(!ac(t))return{};if(mv)return mv(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();const TY=EY;function AY(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var CY=function(){try{var e=na(Object,"defineProperty");return e({},"",{}),e}catch{}}();const gv=CY;function IY(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}var MY=9007199254740991,OY=/^(?:0|[1-9]\d*)$/;function oE(e,t){var r=typeof e;return t=t??MY,!!t&&(r=="number"||r!="symbol"&&OY.test(e))&&e>-1&&e%1==0&&e<t}function aE(e,t,r){t=="__proto__"&&gv?gv(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function Tg(e,t){return e===t||e!==e&&t!==t}var jY=Object.prototype,kY=jY.hasOwnProperty;function cE(e,t,r){var n=e[t];(!(kY.call(e,t)&&Tg(n,r))||r===void 0&&!(t in e))&&aE(e,t,r)}function Sd(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?aE(r,a,c):cE(r,a,c)}return r}var RY=9007199254740991;function Ag(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=RY}function Ed(e){return e!=null&&Ag(e.length)&&!sE(e)}var PY=Object.prototype;function Cg(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||PY;return e===r}function NY(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var DY="[object Arguments]";function yv(e){return ao(e)&&oc(e)==DY}var uE=Object.prototype,$Y=uE.hasOwnProperty,LY=uE.propertyIsEnumerable,BY=yv(function(){return arguments}())?yv:function(e){return ao(e)&&$Y.call(e,"callee")&&!LY.call(e,"callee")};const lE=BY;function UY(){return!1}var fE=typeof exports=="object"&&exports&&!exports.nodeType&&exports,vv=fE&&typeof module=="object"&&module&&!module.nodeType&&module,FY=vv&&vv.exports===fE,bv=FY?qi.Buffer:void 0,VY=bv?bv.isBuffer:void 0,zY=VY||UY;const _f=zY;var qY="[object Arguments]",WY="[object Array]",GY="[object Boolean]",HY="[object Date]",KY="[object Error]",YY="[object Function]",XY="[object Map]",JY="[object Number]",ZY="[object Object]",QY="[object RegExp]",eX="[object Set]",tX="[object String]",rX="[object WeakMap]",nX="[object ArrayBuffer]",iX="[object DataView]",sX="[object Float32Array]",oX="[object Float64Array]",aX="[object Int8Array]",cX="[object Int16Array]",uX="[object Int32Array]",lX="[object Uint8Array]",fX="[object Uint8ClampedArray]",dX="[object Uint16Array]",hX="[object Uint32Array]",tr={};tr[sX]=tr[oX]=tr[aX]=tr[cX]=tr[uX]=tr[lX]=tr[fX]=tr[dX]=tr[hX]=!0;tr[qY]=tr[WY]=tr[nX]=tr[GY]=tr[iX]=tr[HY]=tr[KY]=tr[YY]=tr[XY]=tr[JY]=tr[ZY]=tr[QY]=tr[eX]=tr[tX]=tr[rX]=!1;function pX(e){return ao(e)&&Ag(e.length)&&!!tr[oc(e)]}function Td(e){return function(t){return e(t)}}var dE=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Uc=dE&&typeof module=="object"&&module&&!module.nodeType&&module,mX=Uc&&Uc.exports===dE,Rh=mX&&tE.process,gX=function(){try{var e=Uc&&Uc.require&&Uc.require("util").types;return e||Rh&&Rh.binding&&Rh.binding("util")}catch{}}();const Wa=gX;var wv=Wa&&Wa.isTypedArray,yX=wv?Td(wv):pX;const hE=yX;var vX=Object.prototype,bX=vX.hasOwnProperty;function pE(e,t){var r=mn(e),n=!r&&lE(e),i=!r&&!n&&_f(e),s=!r&&!n&&!i&&hE(e),o=r||n||i||s,a=o?NY(e.length,String):[],c=a.length;for(var u in e)(t||bX.call(e,u))&&!(o&&(u=="length"||i&&(u=="offset"||u=="parent")||s&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||oE(u,c)))&&a.push(u);return a}function mE(e,t){return function(r){return e(t(r))}}var wX=mE(Object.keys,Object);const _X=wX;var xX=Object.prototype,SX=xX.hasOwnProperty;function EX(e){if(!Cg(e))return _X(e);var t=[];for(var r in Object(e))SX.call(e,r)&&r!="constructor"&&t.push(r);return t}function Pu(e){return Ed(e)?pE(e):EX(e)}function TX(e){var t=[];if(e!=null)for(var r in Object(e))t.push(r);return t}var AX=Object.prototype,CX=AX.hasOwnProperty;function IX(e){if(!ac(e))return TX(e);var t=Cg(e),r=[];for(var n in e)n=="constructor"&&(t||!CX.call(e,n))||r.push(n);return r}function Ig(e){return Ed(e)?pE(e,!0):IX(e)}var MX=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,OX=/^\w*$/;function Mg(e,t){if(mn(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||iu(e)?!0:OX.test(e)||!MX.test(e)||t!=null&&e in Object(t)}var jX=na(Object,"create");const su=jX;function kX(){this.__data__=su?su(null):{},this.size=0}function RX(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var PX="__lodash_hash_undefined__",NX=Object.prototype,DX=NX.hasOwnProperty;function $X(e){var t=this.__data__;if(su){var r=t[e];return r===PX?void 0:r}return DX.call(t,e)?t[e]:void 0}var LX=Object.prototype,BX=LX.hasOwnProperty;function UX(e){var t=this.__data__;return su?t[e]!==void 0:BX.call(t,e)}var FX="__lodash_hash_undefined__";function VX(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=su&&t===void 0?FX:t,this}function Ho(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])}}Ho.prototype.clear=kX;Ho.prototype.delete=RX;Ho.prototype.get=$X;Ho.prototype.has=UX;Ho.prototype.set=VX;function zX(){this.__data__=[],this.size=0}function Ad(e,t){for(var r=e.length;r--;)if(Tg(e[r][0],t))return r;return-1}var qX=Array.prototype,WX=qX.splice;function GX(e){var t=this.__data__,r=Ad(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():WX.call(t,r,1),--this.size,!0}function HX(e){var t=this.__data__,r=Ad(t,e);return r<0?void 0:t[r][1]}function KX(e){return Ad(this.__data__,e)>-1}function YX(e,t){var r=this.__data__,n=Ad(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}function Is(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])}}Is.prototype.clear=zX;Is.prototype.delete=GX;Is.prototype.get=HX;Is.prototype.has=KX;Is.prototype.set=YX;var XX=na(qi,"Map");const ou=XX;function JX(){this.size=0,this.__data__={hash:new Ho,map:new(ou||Is),string:new Ho}}function ZX(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Cd(e,t){var r=e.__data__;return ZX(t)?r[typeof t=="string"?"string":"hash"]:r.map}function QX(e){var t=Cd(this,e).delete(e);return this.size-=t?1:0,t}function eJ(e){return Cd(this,e).get(e)}function tJ(e){return Cd(this,e).has(e)}function rJ(e,t){var r=Cd(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}function Ms(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])}}Ms.prototype.clear=JX;Ms.prototype.delete=QX;Ms.prototype.get=eJ;Ms.prototype.has=tJ;Ms.prototype.set=rJ;var nJ="Expected a function";function Og(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(nJ);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(Og.Cache||Ms),r}Og.Cache=Ms;var iJ=500;function sJ(e){var t=Og(e,function(n){return r.size===iJ&&r.clear(),n}),r=t.cache;return t}var oJ=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,aJ=/\\(\\)?/g,cJ=sJ(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(oJ,function(r,n,i,s){t.push(i?s.replace(aJ,"$1"):n||r)}),t});const uJ=cJ;function lJ(e){return e==null?"":nE(e)}function gE(e,t){return mn(e)?e:Mg(e,t)?[e]:uJ(lJ(e))}var fJ=1/0;function Id(e){if(typeof e=="string"||iu(e))return e;var t=e+"";return t=="0"&&1/e==-fJ?"-0":t}function jg(e,t){t=gE(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[Id(t[r++])];return r&&r==n?e:void 0}function dJ(e,t,r){var n=e==null?void 0:jg(e,t);return n===void 0?r:n}function yE(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var hJ=mE(Object.getPrototypeOf,Object);const vE=hJ;function pJ(){this.__data__=new Is,this.size=0}function mJ(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}function gJ(e){return this.__data__.get(e)}function yJ(e){return this.__data__.has(e)}var vJ=200;function bJ(e,t){var r=this.__data__;if(r instanceof Is){var n=r.__data__;if(!ou||n.length<vJ-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Ms(n)}return r.set(e,t),this.size=r.size,this}function Pi(e){var t=this.__data__=new Is(e);this.size=t.size}Pi.prototype.clear=pJ;Pi.prototype.delete=mJ;Pi.prototype.get=gJ;Pi.prototype.has=yJ;Pi.prototype.set=bJ;function wJ(e,t){return e&&Sd(t,Pu(t),e)}function _J(e,t){return e&&Sd(t,Ig(t),e)}var bE=typeof exports=="object"&&exports&&!exports.nodeType&&exports,_v=bE&&typeof module=="object"&&module&&!module.nodeType&&module,xJ=_v&&_v.exports===bE,xv=xJ?qi.Buffer:void 0,Sv=xv?xv.allocUnsafe:void 0;function SJ(e,t){if(t)return e.slice();var r=e.length,n=Sv?Sv(r):new e.constructor(r);return e.copy(n),n}function wE(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 _E(){return[]}var EJ=Object.prototype,TJ=EJ.propertyIsEnumerable,Ev=Object.getOwnPropertySymbols,AJ=Ev?function(e){return e==null?[]:(e=Object(e),wE(Ev(e),function(t){return TJ.call(e,t)}))}:_E;const kg=AJ;function CJ(e,t){return Sd(e,kg(e),t)}var IJ=Object.getOwnPropertySymbols,MJ=IJ?function(e){for(var t=[];e;)yE(t,kg(e)),e=vE(e);return t}:_E;const xE=MJ;function OJ(e,t){return Sd(e,xE(e),t)}function SE(e,t,r){var n=t(e);return mn(e)?n:yE(n,r(e))}function Xp(e){return SE(e,Pu,kg)}function jJ(e){return SE(e,Ig,xE)}var kJ=na(qi,"DataView");const Jp=kJ;var RJ=na(qi,"Promise");const Zp=RJ;var PJ=na(qi,"Set");const Qp=PJ;var Tv="[object Map]",NJ="[object Object]",Av="[object Promise]",Cv="[object Set]",Iv="[object WeakMap]",Mv="[object DataView]",DJ=ra(Jp),$J=ra(ou),LJ=ra(Zp),BJ=ra(Qp),UJ=ra(Yp),Eo=oc;(Jp&&Eo(new Jp(new ArrayBuffer(1)))!=Mv||ou&&Eo(new ou)!=Tv||Zp&&Eo(Zp.resolve())!=Av||Qp&&Eo(new Qp)!=Cv||Yp&&Eo(new Yp)!=Iv)&&(Eo=function(e){var t=oc(e),r=t==NJ?e.constructor:void 0,n=r?ra(r):"";if(n)switch(n){case DJ:return Mv;case $J:return Tv;case LJ:return Av;case BJ:return Cv;case UJ:return Iv}return t});const au=Eo;var FJ=Object.prototype,VJ=FJ.hasOwnProperty;function zJ(e){var t=e.length,r=new e.constructor(t);return t&&typeof e[0]=="string"&&VJ.call(e,"index")&&(r.index=e.index,r.input=e.input),r}var qJ=qi.Uint8Array;const xf=qJ;function Rg(e){var t=new e.constructor(e.byteLength);return new xf(t).set(new xf(e)),t}function WJ(e,t){var r=t?Rg(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}var GJ=/\w*$/;function HJ(e){var t=new e.constructor(e.source,GJ.exec(e));return t.lastIndex=e.lastIndex,t}var Ov=Fi?Fi.prototype:void 0,jv=Ov?Ov.valueOf:void 0;function KJ(e){return jv?Object(jv.call(e)):{}}function YJ(e,t){var r=t?Rg(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var XJ="[object Boolean]",JJ="[object Date]",ZJ="[object Map]",QJ="[object Number]",eZ="[object RegExp]",tZ="[object Set]",rZ="[object String]",nZ="[object Symbol]",iZ="[object ArrayBuffer]",sZ="[object DataView]",oZ="[object Float32Array]",aZ="[object Float64Array]",cZ="[object Int8Array]",uZ="[object Int16Array]",lZ="[object Int32Array]",fZ="[object Uint8Array]",dZ="[object Uint8ClampedArray]",hZ="[object Uint16Array]",pZ="[object Uint32Array]";function mZ(e,t,r){var n=e.constructor;switch(t){case iZ:return Rg(e);case XJ:case JJ:return new n(+e);case sZ:return WJ(e,r);case oZ:case aZ:case cZ:case uZ:case lZ:case fZ:case dZ:case hZ:case pZ:return YJ(e,r);case ZJ:return new n;case QJ:case rZ:return new n(e);case eZ:return HJ(e);case tZ:return new n;case nZ:return KJ(e)}}function gZ(e){return typeof e.constructor=="function"&&!Cg(e)?TY(vE(e)):{}}var yZ="[object Map]";function vZ(e){return ao(e)&&au(e)==yZ}var kv=Wa&&Wa.isMap,bZ=kv?Td(kv):vZ;const wZ=bZ;var _Z="[object Set]";function xZ(e){return ao(e)&&au(e)==_Z}var Rv=Wa&&Wa.isSet,SZ=Rv?Td(Rv):xZ;const EZ=SZ;var TZ=1,AZ=2,CZ=4,EE="[object Arguments]",IZ="[object Array]",MZ="[object Boolean]",OZ="[object Date]",jZ="[object Error]",TE="[object Function]",kZ="[object GeneratorFunction]",RZ="[object Map]",PZ="[object Number]",AE="[object Object]",NZ="[object RegExp]",DZ="[object Set]",$Z="[object String]",LZ="[object Symbol]",BZ="[object WeakMap]",UZ="[object ArrayBuffer]",FZ="[object DataView]",VZ="[object Float32Array]",zZ="[object Float64Array]",qZ="[object Int8Array]",WZ="[object Int16Array]",GZ="[object Int32Array]",HZ="[object Uint8Array]",KZ="[object Uint8ClampedArray]",YZ="[object Uint16Array]",XZ="[object Uint32Array]",Zt={};Zt[EE]=Zt[IZ]=Zt[UZ]=Zt[FZ]=Zt[MZ]=Zt[OZ]=Zt[VZ]=Zt[zZ]=Zt[qZ]=Zt[WZ]=Zt[GZ]=Zt[RZ]=Zt[PZ]=Zt[AE]=Zt[NZ]=Zt[DZ]=Zt[$Z]=Zt[LZ]=Zt[HZ]=Zt[KZ]=Zt[YZ]=Zt[XZ]=!0;Zt[jZ]=Zt[TE]=Zt[BZ]=!1;function kl(e,t,r,n,i,s){var o,a=t&TZ,c=t&AZ,u=t&CZ;if(r&&(o=i?r(e,n,i,s):r(e)),o!==void 0)return o;if(!ac(e))return e;var l=mn(e);if(l){if(o=zJ(e),!a)return AY(e,o)}else{var f=au(e),p=f==TE||f==kZ;if(_f(e))return SJ(e,a);if(f==AE||f==EE||p&&!i){if(o=c||p?{}:gZ(e),!a)return c?OJ(e,_J(o,e)):CJ(e,wJ(o,e))}else{if(!Zt[f])return i?e:{};o=mZ(e,f,a)}}s||(s=new Pi);var v=s.get(e);if(v)return v;s.set(e,o),EZ(e)?e.forEach(function(S){o.add(kl(S,t,r,S,e,s))}):wZ(e)&&e.forEach(function(S,C){o.set(C,kl(S,t,r,C,e,s))});var w=u?c?jJ:Xp:c?Ig:Pu,y=l?void 0:w(e);return IY(y||e,function(S,C){y&&(C=S,S=e[C]),cE(o,C,kl(S,t,r,C,e,s))}),o}var JZ=1,ZZ=4;function QZ(e){return kl(e,JZ|ZZ)}var eQ="__lodash_hash_undefined__";function tQ(e){return this.__data__.set(e,eQ),this}function rQ(e){return this.__data__.has(e)}function Sf(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new Ms;++t<r;)this.add(e[t])}Sf.prototype.add=Sf.prototype.push=tQ;Sf.prototype.has=rQ;function nQ(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 iQ(e,t){return e.has(t)}var sQ=1,oQ=2;function CE(e,t,r,n,i,s){var o=r&sQ,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&oQ?new Sf: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(!nQ(t,function(C,O){if(!iQ(v,O)&&(w===C||i(w,C,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 aQ(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}function cQ(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var uQ=1,lQ=2,fQ="[object Boolean]",dQ="[object Date]",hQ="[object Error]",pQ="[object Map]",mQ="[object Number]",gQ="[object RegExp]",yQ="[object Set]",vQ="[object String]",bQ="[object Symbol]",wQ="[object ArrayBuffer]",_Q="[object DataView]",Pv=Fi?Fi.prototype:void 0,Ph=Pv?Pv.valueOf:void 0;function xQ(e,t,r,n,i,s,o){switch(r){case _Q:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case wQ:return!(e.byteLength!=t.byteLength||!s(new xf(e),new xf(t)));case fQ:case dQ:case mQ:return Tg(+e,+t);case hQ:return e.name==t.name&&e.message==t.message;case gQ:case vQ:return e==t+"";case pQ:var a=aQ;case yQ:var c=n&uQ;if(a||(a=cQ),e.size!=t.size&&!c)return!1;var u=o.get(e);if(u)return u==t;n|=lQ,o.set(e,t);var l=CE(a(e),a(t),n,i,s,o);return o.delete(e),l;case bQ:if(Ph)return Ph.call(e)==Ph.call(t)}return!1}var SQ=1,EQ=Object.prototype,TQ=EQ.hasOwnProperty;function AQ(e,t,r,n,i,s){var o=r&SQ,a=Xp(e),c=a.length,u=Xp(t),l=u.length;if(c!=l&&!o)return!1;for(var f=c;f--;){var p=a[f];if(!(o?p in t:TQ.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 C=e[p],O=t[p];if(n)var j=o?n(O,C,p,t,e,s):n(C,O,p,e,t,s);if(!(j===void 0?C===O||i(C,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 CQ=1,Nv="[object Arguments]",Dv="[object Array]",Qu="[object Object]",IQ=Object.prototype,$v=IQ.hasOwnProperty;function MQ(e,t,r,n,i,s){var o=mn(e),a=mn(t),c=o?Dv:au(e),u=a?Dv:au(t);c=c==Nv?Qu:c,u=u==Nv?Qu:u;var l=c==Qu,f=u==Qu,p=c==u;if(p&&_f(e)){if(!_f(t))return!1;o=!0,l=!1}if(p&&!l)return s||(s=new Pi),o||hE(e)?CE(e,t,r,n,i,s):xQ(e,t,c,r,n,i,s);if(!(r&CQ)){var v=l&&$v.call(e,"__wrapped__"),w=f&&$v.call(t,"__wrapped__");if(v||w){var y=v?e.value():e,S=w?t.value():t;return s||(s=new Pi),i(y,S,r,n,s)}}return p?(s||(s=new Pi),AQ(e,t,r,n,i,s)):!1}function Md(e,t,r,n,i){return e===t?!0:e==null||t==null||!ao(e)&&!ao(t)?e!==e&&t!==t:MQ(e,t,r,n,Md,i)}var OQ=1,jQ=2;function kQ(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 Pi;if(n)var p=n(u,l,c,e,t,f);if(!(p===void 0?Md(l,u,OQ|jQ,n,f):p))return!1}}return!0}function IE(e){return e===e&&!ac(e)}function RQ(e){for(var t=Pu(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,IE(i)]}return t}function ME(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}function PQ(e){var t=RQ(e);return t.length==1&&t[0][2]?ME(t[0][0],t[0][1]):function(r){return r===e||kQ(r,e,t)}}function NQ(e,t){return e!=null&&t in Object(e)}function DQ(e,t,r){t=gE(t,e);for(var n=-1,i=t.length,s=!1;++n<i;){var o=Id(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&&Ag(i)&&oE(o,i)&&(mn(e)||lE(e)))}function $Q(e,t){return e!=null&&DQ(e,t,NQ)}var LQ=1,BQ=2;function UQ(e,t){return Mg(e)&&IE(t)?ME(Id(e),t):function(r){var n=dJ(r,e);return n===void 0&&n===t?$Q(r,e):Md(t,n,LQ|BQ)}}function FQ(e){return function(t){return t==null?void 0:t[e]}}function VQ(e){return function(t){return jg(t,e)}}function zQ(e){return Mg(e)?FQ(Id(e)):VQ(e)}function OE(e){return typeof e=="function"?e:e==null?iE:typeof e=="object"?mn(e)?UQ(e[0],e[1]):PQ(e):zQ(e)}function qQ(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 WQ=qQ();const GQ=WQ;function HQ(e,t){return e&&GQ(e,t,Pu)}function KQ(e,t){return function(r,n){if(r==null)return r;if(!Ed(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 YQ=KQ(HQ);const jE=YQ;function XQ(e,t){var r=[];return jE(e,function(n,i,s){t(n,i,s)&&r.push(n)}),r}function JQ(e,t){var r=mn(e)?wE:XQ;return r(e,OE(t))}function ZQ(e,t){var r=-1,n=Ed(e)?Array(e.length):[];return jE(e,function(i,s,o){n[++r]=t(i,s,o)}),n}function QQ(e,t){return Md(e,t)}function eee(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}function tee(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 ree(e,t,r){for(var n=-1,i=e.criteria,s=t.criteria,o=i.length,a=r.length;++n<o;){var c=tee(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 nee(e,t,r){t.length?t=jl(t,function(s){return mn(s)?function(o){return jg(o,s.length===1?s[0]:s)}:s}):t=[iE];var n=-1;t=jl(t,Td(OE));var i=ZQ(e,function(s,o,a){var c=jl(t,function(u){return u(s)});return{criteria:c,index:++n,value:s}});return eee(i,function(s,o){return ree(s,o,r)})}function iee(e,t,r,n){return e==null?[]:(mn(t)||(t=t==null?[]:[t]),r=n?void 0:r,mn(r)||(r=r==null?[]:[r]),nee(e,t,r))}function see({toBack:e,onSubmitClick:t,data:r}){const{fromCoin:n,toCoin:i}=rn(),s=ve.useRef(!1),{slippage:o}=en(),[a,c]=ve.useState(r),{fromAmountUi:u,toAmountUi:l,byAmountIn:f}=a,{amountLimit:p}=H7(o,a),{showPriceImpactTips:v,showPriceImpactWarn:w}=Z7(n,i,u,l),{priceAcceptRouterData:y}=nK(a),[S,C]=ve.useState(!1),[O,j]=ve.useState(!1);ve.useMemo(()=>f?i:n,[f]);const V=ve.useMemo(()=>y!==void 0,[y]),B=()=>{if(y){if(s.current)return;s.current=!0;const q=QZ(y);c(q),setTimeout(()=>{s.current=!1},300)}},H=ve.useMemo(()=>S?!1:!!w,[S,w]);return _.jsxs("div",{className:"secondary-dialog",children:[_.jsx(Eg,{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:io(u||"")}),_.jsx(kr,{src:n==null?void 0:n.logo_url,token:n,style:{width:"28px",height:"28px"}}),_.jsx("span",{className:"symbol",children:Vr((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:io(l||"")}),_.jsx(kr,{src:i==null?void 0:i.logo_url,token:i,style:{width:"28px",height:"28px"}}),_.jsx("span",{className:"symbol",children:Vr((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(Sg,{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(eE,{pl:"0px",pr:"0px",isLoading:!1,amountLimit:p}),_.jsx(Q7,{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:()=>{C(!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(Vm,{})}):"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 kE({allProviders:e}){const{isApp:t}=sc();return _.jsx(_.Fragment,{children:e==null?void 0:e.map(r=>{var n;return t?_.jsx(kr,{src:Bt==null?void 0:Bt[r],style:{width:"16px",height:"16px"},haveBorder:!1},r):_.jsx(Go,{content:_.jsx("div",{style:{color:"var(--cs-text-primary)"},children:((n=Lp[r])==null?void 0:n.name)||r}),position:"top",delay:300,children:_.jsx(kr,{src:Bt==null?void 0:Bt[r],style:{width:"16px",height:"16px"},haveBorder:!1})},r)})})}function Od(e){const{text:t,type:r,classType:n=""}=e,[i,s]=ve.useState(!1),{addCommonToast:o}=tc(),a=c=>{i||(td(c),V7(t,{debug:!1,message:"message"}),o("Copied"),s(!i))};return ve.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 ma=2;function oee({data:e,config:t={},originFromCoinType:r,originToCoinType:n,isWidget:i}){const{nodes:s,edges:o,tokenMap:a,panelHeight:c,resultColumes:u}=J7(e,r,n),l=ve.useRef(null),f={nodeWidth:176,searchStep:5,nodePadding:10,maxSearchDistance:50,arrowOffset:5,...t},p=ve.useMemo(()=>s==null?void 0:s.map(v=>{var C;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:(C=Object.values(v==null?void 0:v.list))==null?void 0:C.map((O,j)=>{const V=a==null?void 0:a.get(S[j]),B=`${Vr((V==null?void 0:V.symbol)||"",8)} > ${Vr((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?Tl(Ve(fe).div(H).mul(100).toString(),0):"0";q.push(Number(z)||1)});const ne=Al(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:lF(uF(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(uee,{edges:o,nodes:s,config:f}),_.jsx(lee,{data:p,isWidget:i})]})}function aee(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(cee(e,t,r,n,y.x1,y.y1,y.x2,y.y2))return!0;return!1}function cee(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 el(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)&&aee(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=C.top,m=C.top+C.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),C=c.find(z=>z.id===a.to);if(!S||!C)return`M${e},${t} L${r},${t==n?n:t}`;if(o){const z=C.top+C.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=C.top,H=C.top+C.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 me=S.top+S.height/2,se=C.left+C.width/2,fe=C.top+C.height;if(V-10<B){const z=S.left+S.width/2,N=S.top+S.height,h=C.top+C.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},${me} L${se},${me} L${se},${fe}`;return`M${e},${me} L${r},${me}`}function uee({edges:e,nodes:t,config:r}){var i,s,o,a;const n=ve.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}`,C=`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:ma,fill:"none"}),_.jsx("path",{d:C,stroke:"var(--cs-border)",strokeWidth:ma,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=el(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 me=q.substring(1).split(","),se=ne.substring(1).split(",");if(me.length===2&&se.length===2){const fe=parseFloat(me[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,C=f-y/2,O=p-S/2;return _.jsxs("g",{children:[_.jsx("path",{d:l,stroke:"var(--cs-border)",strokeWidth:ma,fill:"none",markerEnd:"url(#arrowhead)",strokeLinecap:"square",strokeLinejoin:"miter"}),_.jsx("rect",{x:C,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=el(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,C=f-y/2,O=p-S/2;return _.jsxs("g",{children:[_.jsx("path",{d:l,stroke:"var(--cs-border)",strokeWidth:ma,fill:"none",markerEnd:"url(#arrowhead)",strokeLinecap:"square",strokeLinejoin:"miter"}),_.jsx("rect",{x:C,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=el(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,C=f-y/2,O=p-S/2;return _.jsxs("g",{children:[_.jsx("path",{d:l,stroke:"var(--cs-border)",strokeWidth:ma,fill:"none",markerEnd:"url(#arrowhead)",strokeLinecap:"square",strokeLinejoin:"miter"}),_.jsx("rect",{x:C,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=el(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 me=q.substring(1).split(","),se=ne.substring(1).split(",");if(me.length===2&&se.length===2){const fe=parseFloat(me[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,C=f-y/2,O=p-S/2;return _.jsxs("g",{children:[_.jsx("path",{d:l,stroke:"var(--cs-border)",strokeWidth:ma,fill:"none",markerEnd:"url(#arrowhead)",strokeLinecap:"square",strokeLinejoin:"miter"}),_.jsx("rect",{x:C,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 lee({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(fee,{data:r,isWidget:t},r.target))})}function fee({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(xd,{autoSwitchTooltip:!0,position:"bottom",borderRadius:"12px",content:_.jsx(pee,{data:e}),children:_.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",height:"24px"},children:[_.jsx(kr,{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:Vr((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(dee,{data:n,isWidget:t},n.from))})]})}function dee({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(xd,{position:"bottom",content:_.jsx(hee,{data:n},n==null?void 0:n.id),children:_.jsxs("div",{style:{display:"flex",height:"22px",width:"142px",cursor:"pointer",alignItems:"center"},children:[_.jsx(kr,{src:(i=Lp[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=Lp[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 hee({data:e}){const{getExplorerUrl:t}=Qa();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(kr,{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(kr,{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:[Vr((e==null?void 0:e.fromSymbol)||"",8)," -"," ",Vr((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:td,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(Od,{text:(e==null?void 0:e.id)||""})]})]})]})}function pee({data:e}){const{getExplorerUrl:t}=Qa();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(kr,{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:Vr((e==null?void 0:e.targetSymbol)||"")})]}),_.jsxs("div",{style:{display:"flex",flexDirection:"row",alignItems:"center"},children:[_.jsx("a",{onClick:td,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(Od,{text:(e==null?void 0:e.originalTarget)||""})]})]})}function mee({toBack:e,data:t,allProviders:r}){const{fromCoin:n,toCoin:i,fromAmount:s,toAmount:o}=rn();return _.jsxs("div",{className:"route-dialog",children:[_.jsx(Eg,{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(kE,{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(kr,{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:io(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:io(o||"0")}),_.jsx("span",{style:{fontSize:"14px",fontWeight:"500",color:"var(--cs-text-primary)"},children:i==null?void 0:i.symbol}),_.jsx(kr,{src:i==null?void 0:i.logo_url,style:{width:"24px",height:"24px"}})]})]}),_.jsx(oee,{data:t})]})})]})}function gee({hasSubMenu:e,data:t,isLoading:r,allProviders:n}){const[i,s]=ve.useState(!1);return sc(),_.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(ta,{className:"custom-skeleton",style:{width:"80px",height:"18px"}}):_.jsxs("div",{className:"right",onClick:()=>{s(!0)},children:[_.jsx(kE,{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(mee,{data:t,toBack:()=>s(!1),allProviders:n})]})}function RE(){const{setCollectTokenMap:e,collectTokenMap:t}=Qo(),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=ve.useCallback(i=>t.get(i.coin_type)!==void 0,[t]);return{handleCollectToken:r,isCollectToken:n,collectTokenMap:t}}function yee(e){const{trustedTokenList:t}=ec(),{tokenBalanceObj:r,currentAccount:n}=nn(),{coinPriceObj:i}=q7(),{getTokenAmountValue:s}=Ru(),{fetchTokenInfo:o}=rc(),{currentTypeTab:a,showTokenList:c,setShowTokenList:u,combineTokenList:l,importTokenList:f,setComBineTokenList:p,setImportToken:v,setCurrentImportTokenData:w,setImportTokenIsLoading:y,currentImportTokenData:S,searchInput:C,setSearchInput:O,importTokenIsLoading:j,showTokenListIsLoading:V,setCurrentTypeTab:B,setCurrentPlatformTab:H}=Qo(),[q,ne]=ve.useState(!1);ve.useEffect(()=>{t&&(t==null?void 0:t.length)>0&&ne(!0)},[t]);const[me,se]=ve.useState(!1);ve.useEffect(()=>{Ey(i)||se(!0)},[i]);const fe=ve.useRef({}),[z,N]=ve.useState(!1);ve.useEffect(()=>{(!Ey(r)||!Fm(fe.current,r))&&(fe.current=r,N(!0))},[r]);const h=ve.useMemo(()=>(f==null?void 0:f.length)>1?f==null?void 0:f.map(ue=>{const ie=Cl(r==null?void 0:r[ue==null?void 0:ue.coin_type],ue),le=ie==null?void 0:ie.totalBalanceFormat,be=Ve(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 iee(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 JQ(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)||ws(te,!0).includes(ws(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(Gx(ue)){const ie=ue.trim(),le=xr(ie).full_address,be=await o(le);if(!be){u([]);return}const Ce=Cl(r==null?void 0:r[le],be),D=(Ce==null?void 0:Ce.totalBalanceFormat)||"0",F=Ve(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)}},A=ue=>{if(ue==="Default")g("All"),H("All");else{const ie=d(h,C);u(ie)}},k=()=>{if(S){const ue=v(S,!0),ie=d(ue,C);u(ie),w(void 0),O("")}},M=ue=>{const ie=v(ue,!1),le=d(ie,C);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,C);u(le)};ve.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=Cl(le,ie),Ce=(be==null?void 0:be.totalBalanceFormat)||"0",D=(be==null?void 0:be.displayBalance)||"0",F=Ve(Ce).gt("0")?s(ie==null?void 0:ie.coin_type,Ce):"0";ue.push({...ie,balance:D,rate:ln(F,4,!0)})}p(ue)}},[q,me,z,n==null?void 0:n.address,i]);const b=ve.useRef([]);ve.useEffect(()=>{if((l==null?void 0:l.length)>0&&!QQ(b.current,l)){b.current=l;const ue=d(l);e?h.find(le=>le.coin_type===e)!==void 0||a!=="Default"?(B("Imported"),A("Imported")):u(S?[S]:ue):u(ue)}},[l,e]);const P=ve.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},[C,c,S,j,V]);return{showTokenList:c,handleSearch:x,handleChangePlatform:g,currentImportTokenData:S,handleChangeType:A,handleImportClick:k,handleDeleteImportClick:M,isNoData:P}}function vee({tokenList:e,onHandleTokenAction:t}){return _.jsx("div",{className:"token-collect-list",children:e.map(r=>_.jsx(bee,{token:r,onHandleTokenAction:t},r.coin_type))})}function bee({token:e,onHandleTokenAction:t}){return _.jsxs("div",{className:"token-collect-item",onClick:()=>{t(e,"select_token")},children:[_.jsx(kr,{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 wee(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 _ee({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 Lv=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function xee(e,t){return!!(e===t||Lv(e)&&Lv(t))}function See(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!xee(e[r],t[r]))return!1;return!0}function Eee(e,t){t===void 0&&(t=See);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 e0(){return e0=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},e0.apply(null,arguments)}function Bv(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function t0(e,t){return t0=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},t0(e,t)}function Tee(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,t0(e,t)}var Uv=Number.isNaN||function(t){return typeof t=="number"&&t!==t};function Aee(e,t){return!!(e===t||Uv(e)&&Uv(t))}function Cee(e,t){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(!Aee(e[r],t[r]))return!1;return!0}function Nh(e,t){t===void 0&&(t=Cee);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 Fv(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 Iee=typeof performance=="object"&&typeof performance.now=="function",Vv=Iee?function(){return performance.now()}:function(){return Date.now()};function zv(e){cancelAnimationFrame(e.id)}function Mee(e,t){var r=Vv();function n(){Vv()-r>=t?e.call(null):i.id=requestAnimationFrame(n)}var i={id:requestAnimationFrame(n)};return i}var Dh=-1;function qv(e){if(e===void 0&&(e=!1),Dh===-1||e){var t=document.createElement("div"),r=t.style;r.width="50px",r.height="50px",r.overflow="scroll",document.body.appendChild(t),Dh=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return Dh}var ga=null;function Wv(e){if(e===void 0&&(e=!1),ga===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?ga="positive-descending":(t.scrollLeft=1,t.scrollLeft===0?ga="negative":ga="positive-ascending"),document.body.removeChild(t),ga}return ga}ei.env.NODE_ENV;var Oee=150,jee=function(t,r){return t},Rl=null,Pl=null;ei.env.NODE_ENV!=="production"&&typeof window<"u"&&typeof window.WeakSet<"u"&&(Rl=new WeakSet,Pl=new WeakSet);function kee(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){Tee(p,f);function p(w){var y;return y=f.call(this,w)||this,y._instanceProps=c(y.props,Bv(y)),y._outerRef=void 0,y._resetIsScrollingTimeoutId=null,y.state={instance:Bv(y),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof y.props.initialScrollOffset=="number"?y.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},y._callOnItemsRendered=void 0,y._callOnItemsRendered=Nh(function(S,C,O,j){return y.props.onItemsRendered({overscanStartIndex:S,overscanStopIndex:C,visibleStartIndex:O,visibleStopIndex:j})}),y._callOnScroll=void 0,y._callOnScroll=Nh(function(S,C,O){return y.props.onScroll({scrollDirection:S,scrollOffset:C,scrollUpdateWasRequested:O})}),y._getItemStyle=void 0,y._getItemStyle=function(S){var C=y.props,O=C.direction,j=C.itemSize,V=C.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),me=O==="horizontal"||V==="horizontal",se=O==="rtl",fe=me?q:0;B[S]=H={position:"absolute",left:se?void 0:fe,right:se?fe:void 0,top:me?0:q,height:me?"100%":ne,width:me?ne:"100%"}}return H},y._getItemStyleCache=void 0,y._getItemStyleCache=Nh(function(S,C,O){return{}}),y._onScrollHorizontal=function(S){var C=S.currentTarget,O=C.clientWidth,j=C.scrollLeft,V=C.scrollWidth;y.setState(function(B){if(B.scrollOffset===j)return null;var H=y.props.direction,q=j;if(H==="rtl")switch(Wv()){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 C=S.currentTarget,O=C.clientHeight,j=C.scrollHeight,V=C.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 C=y.props.outerRef;y._outerRef=S,typeof C=="function"?C(S):C!=null&&typeof C=="object"&&C.hasOwnProperty("current")&&(C.current=S)},y._resetIsScrollingDebounced=function(){y._resetIsScrollingTimeoutId!==null&&zv(y._resetIsScrollingTimeoutId),y._resetIsScrollingTimeoutId=Mee(y._resetIsScrolling,Oee)},y._resetIsScrolling=function(){y._resetIsScrollingTimeoutId=null,y.setState({isScrolling:!1},function(){y._getItemStyleCache(-1,null)})},y}p.getDerivedStateFromProps=function(y,S){return Ree(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 C=this.props,O=C.itemCount,j=C.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?qv():0:B=H.scrollHeight>H.clientHeight?qv():0}this.scrollTo(s(this.props,y,S,V,this._instanceProps,B))},v.componentDidMount=function(){var y=this.props,S=y.direction,C=y.initialScrollOffset,O=y.layout;if(typeof C=="number"&&this._outerRef!=null){var j=this._outerRef;S==="horizontal"||O==="horizontal"?j.scrollLeft=C:j.scrollTop=C}this._callPropsCallbacks()},v.componentDidUpdate=function(){var y=this.props,S=y.direction,C=y.layout,O=this.state,j=O.scrollOffset,V=O.scrollUpdateWasRequested;if(V&&this._outerRef!=null){var B=this._outerRef;if(S==="horizontal"||C==="horizontal")if(S==="rtl")switch(Wv()){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&&zv(this._resetIsScrollingTimeoutId)},v.render=function(){var y=this.props,S=y.children,C=y.className,O=y.direction,j=y.height,V=y.innerRef,B=y.innerElementType,H=y.innerTagName,q=y.itemCount,ne=y.itemData,me=y.itemKey,se=me===void 0?jee:me,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",A=E?this._onScrollHorizontal:this._onScrollVertical,k=this._getRangeToRender(),M=k[0],g=k[1],b=[];if(q>0)for(var P=M;P<=g;P++)b.push(ve.createElement(S,{data:ne,key:se(P,ne),index:P,isScrolling:d?x:void 0,style:this._getItemStyle(P)}));var ue=n(this.props,this._instanceProps);return ve.createElement(z||N||"div",{className:C,onScroll:A,ref:this._outerRefSetter,style:e0({position:"relative",height:j,width:m,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:O},h)},ve.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(),C=S[0],O=S[1],j=S[2],V=S[3];this._callOnItemsRendered(C,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,C=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,C):1,me=!j||V==="forward"?Math.max(1,C):1;return[Math.max(0,H-ne),Math.max(0,Math.min(S-1,q+me)),H,q]},p}(ve.PureComponent),t.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var Ree=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(ei.env.NODE_ENV!=="production"){(a!=null||c!=null)&&Pl&&!Pl.has(l)&&(Pl.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":Rl&&!Rl.has(l)&&(Rl.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.'))}},Pee=kee({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),C=Math.max(0,r*l-w+l+o);switch(n==="smart"&&(i>=C-w&&i<=S+w?n="auto":n="center"),n){case"start":return S;case"end":return C;case"center":{var O=Math.round(C+(S-C)/2);return O<Math.ceil(w/2)?0:O>y+Math.floor(w/2)?y:O}case"auto":default:return i>=C&&i<=S?i:i<C?C: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(ei.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 Gv(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 Nee=["style"],Dee=["style"];function $ee(e,t){var r=e.style,n=Fv(e,Nee),i=t.style,s=Fv(t,Dee);return!Gv(r,i)&&!Gv(n,s)}const Lee=ve.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(Fee,{data:a,onHandleTokenAction:i,showCollect:s,showDelete:o})})},$ee),Bee=Eee((e,t,r,n)=>({items:e,onHandleTokenAction:t,showCollect:r,showDelete:n}));function Uee({showTokenList:e,onHandleTokenAction:t,showCollect:r=!0,showDelete:n=!1}){const i=ve.useRef(null);ve.useEffect(()=>{i.current&&i.current.scrollTo(0)},[e.length]);const s=Bee(e,t,r,n);return _.jsx("div",{className:"token-list",children:_.jsx(Pee,{ref:i,style:{overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none",padding:"8px"},height:360,itemCount:e.length,itemData:s,itemSize:72,width:"100%",children:Lee})})}function Fee({data:e,showCollect:t,showDelete:r,onHandleTokenAction:n}){const{isCollectToken:i}=RE(),{getExplorerUrl:s}=Qa();return Ru(),_.jsxs("div",{className:"token-list-item",onClick:o=>{t&&(o.stopPropagation(),n(e,"select_token"))},children:[_.jsx(kr,{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:Vr(e.symbol)})}),_.jsx("p",{className:"token-name",children:Vr(e==null?void 0:e.name,20)}),_.jsxs("div",{className:"copy",children:[_.jsx("a",{onClick:td,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(Od,{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?Vx(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 Vee({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 zee({backClick:e,onSelectToken:t,currToken:r}){const{showTokenList:n,isNoData:i,handleSearch:s,handleChangePlatform:o,handleChangeType:a,handleImportClick:c,handleDeleteImportClick:u}=yee(r==null?void 0:r.coin_type),{importTokenList:l,currentTypeTab:f,setCurrentTypeTab:p,currentPlatformTab:v,setCurrentPlatformTab:w,platformList:y,isOpenImportDialog:S,setIsOpenImportDialog:C,setSearchInput:O,searchInput:j,importTokenIsLoading:V,currentImportTokenData:B,setCurrentImportTokenData:H}=Qo();ve.useEffect(()=>()=>{O(""),w("All"),p("Default"),H(void 0)},[]);const{handleCollectToken:q,collectTokenMap:ne}=RE(),me=m=>{p(m),a(m)},se=m=>{w(m),o(m)},fe=()=>{c(),C(!1)},z=m=>{let x=m.replace(/[^a-zA-Z0-9\s]+$/g,"").trim();O(x),x?N(x):(N(""),me("Default"))},N=xg(m=>{Gx(m)?s(ws(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=ve.useMemo(()=>Array.from(ne.values()),[ne]);return _.jsxs("div",{className:"token-select-modal",children:[_.jsx(Eg,{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(vee,{tokenList:d,onHandleTokenAction:h}),j.length===0&&_.jsx(Vee,{currentType:f,changeTab:me}),j.length===0&&f==="Default"&&_.jsx(_ee,{tabList:y,currentTab:v,changeTab:se})]}),i&&_.jsx(qee,{showTooltip:j.length>0,text:j.length>0||B===void 0?"No tokens found":"No Imported Tokens"}),V&&_.jsx(z7,{}),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(Uee,{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 qee({showTooltip:e,text:t}){return _.jsx("div",{style:{height:"360px"},children:_.jsx(wee,{text:t,subItem:e?_.jsx("div",{children:_.jsx(Go,{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 Wee({onClose:e,tokenList:t,onSureClick:r}){const[n,i]=ve.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(kr,{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(Od,{text:o.coin_type})]})]})]},o.coin_type)),_.jsxs("div",{className:"risk-checkbox ",children:[_.jsx(md,{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"})]})]})]})]})}function PE(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 cu;(function(e){e.event="event",e.props="prop"})(cu||(cu={}));function Gs(){}function Gee(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 uu(e){return!!(e||"").match(/\d/)}function $a(e){return e==null}function Hee(e){return typeof e=="number"&&isNaN(e)}function NE(e){return $a(e)||Hee(e)||typeof e=="number"&&!isFinite(e)}function DE(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function Kee(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 Yee(e,t,r){var n=Kee(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 Xee(e){var t=ve.useRef(e);t.current=e;var r=ve.useRef(function(){for(var n=[],i=arguments.length;i--;)n[i]=arguments[i];return t.current.apply(t,n)});return r.current}function Pg(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 Jee(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 $E(e,t,r){for(var n="",i=r?"0":"",s=0;s<=t-1;s++)n+=e[s]||i;return n}function Hv(e,t){return Array(t+1).join(e)}function LE(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."+Hv("0",Math.abs(o))+i:o>=a?i=i+Hv("0",o-a):i=(i.substring(0,o)||"0")+"."+i.substring(o),r+i}function Kv(e,t,r){if(["","-"].indexOf(e)!==-1)return e;var n=(e.indexOf(".")!==-1||r)&&t,i=Pg(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,C){return y.length>C?(Number(y[0])+Number(S)).toString()+y.substring(1,y.length):S+y},l[0]));var p=$E(l[1]||"",t,r),v=a?"-":"",w=n?".":"";return""+v+f+w+p}function Ao(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 BE=Gee(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}}}),Zee=function(e,t){var r=Math.min(e.selectionStart,t);return{from:{start:r,end:e.selectionEnd},to:{start:r,end:t}}};function Qee(e,t,r){return Math.min(Math.max(e,t),r)}function $h(e){return Math.max(e.selectionStart,e.selectionEnd)}function ete(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function tte(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function rte(e){var t=e.currentValue,r=e.formattedValue,n=e.currentValueIndex,i=e.formattedValueIndex;return t[n]===r[i]}function nte(e,t,r,n,i,s,o){o===void 0&&(o=rte);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 C=n;C<u&&(p[C]===-1||!s(r[C]));)C++;var O=C===u||p[C]===-1?l:p[C];for(C=n-1;C>0&&p[C]===-1;)C--;var j=C===-1||p[C]===-1?0:p[C]+1;return j>O?O:n-j<O-n?j:O}function Yv(e,t,r,n){var i=e.length;if(t=Qee(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 ite(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),r=0,n=t.length;r<n;r++)t[r]=!!(uu(e[r])||uu(e[r-1]));return t}function UE(e,t,r,n,i,s){s===void 0&&(s=Gs);var o=Xee(function(w,y){var S,C;return NE(w)?(C="",S=""):typeof w=="number"||y?(C=typeof w=="number"?LE(w):w,S=n(C)):(C=i(w,void 0),S=n(C)),{formattedValue:S,numAsString:C}}),a=ve.useState(function(){return o($a(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;$a(e)&&(f=c.numAsString,p=!0);var v=o(f,p);return ve.useMemo(function(){u(v)},[v.formattedValue]),[c,l]}function ste(e){return e.replace(/[^0-9]/g,"")}function ote(e){return e}function ate(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=ote);var a=e.removeFormatting;a===void 0&&(a=ste);var c=e.defaultValue,u=e.valueIsNumericString,l=e.onValueChange,f=e.isAllowed,p=e.onChange;p===void 0&&(p=Gs);var v=e.onKeyDown;v===void 0&&(v=Gs);var w=e.onMouseUp;w===void 0&&(w=Gs);var y=e.onFocus;y===void 0&&(y=Gs);var S=e.onBlur;S===void 0&&(S=Gs);var C=e.value,O=e.getCaretBoundary;O===void 0&&(O=ite);var j=e.isValidInputCharacter;j===void 0&&(j=uu);var V=e.isCharacterSame,B=PE(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),H=UE(C,c,!!u,o,a,l),q=H[0],ne=q.formattedValue,me=q.numAsString,se=H[1],fe=ve.useRef(),z=ve.useRef({formattedValue:ne,numAsString:me}),N=function(X,J){z.current={formattedValue:X.formattedValue,numAsString:X.value},se(X,J)},h=ve.useState(!1),d=h[0],m=h[1],x=ve.useRef(null),E=ve.useRef({setCaretTimeout:null,focusTimeout:null});ve.useEffect(function(){return m(!0),function(){clearTimeout(E.current.setCaretTimeout),clearTimeout(E.current.focusTimeout)}},[]);var A=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||(Ao(X,J),E.current.setCaretTimeout=setTimeout(function(){X.value===U&&X.selectionStart!==J&&Ao(X,J)},0))},g=function(X,J,U){return Yv(X,J,O(X),U)},b=function(X,J,U){var oe=O(J),ge=nte(J,ne,X,U,oe,j,V);return ge=Yv(J,ge,oe),ge},P=function(X){var J=X.formattedValue;J===void 0&&(J="");var U=X.input,oe=X.source,ge=X.event,de=X.numAsString,Ee;if(U){var je=X.inputValue||U.value,Fe=$h(U);U.value=J,Ee=b(je,J,Fe),Ee!==void 0&&M(U,Ee,J)}J!==ne&&N(k(J,de),{event:ge,source:oe})};ve.useEffect(function(){var X=z.current,J=X.formattedValue,U=X.numAsString;(ne!==J||me!==U)&&N(k(ne,me),{event:void 0,source:cu.props})},[ne,me]);var ue=x.current?$h(x.current):void 0,ie=typeof window<"u"?ve.useLayoutEffect:ve.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,ge=fe.current?Zee(fe.current,oe.selectionEnd):BE(ne,X),de=Object.assign(Object.assign({},ge),{lastValue:ne}),Ee=a(X,de),je=A(Ee);if(Ee=a(je,void 0),f&&!f(k(je,Ee))){var Fe=J.target,Je=$h(Fe),Ne=b(X,ne,Je);return Fe.value=ne,M(Fe,Ne,ne),!1}return P({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}},Ce=function(X){var J=X.target,U=J.value,oe=le(U,X,cu.event);oe&&p(X),fe.current=void 0},D=function(X){var J=X.target,U=X.key,oe=J.selectionStart,ge=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===ge&&(je=1);var Fe=U==="ArrowLeft"||U==="ArrowRight";if(Ee===void 0||oe!==ge&&!Fe){v(X),be(J,je);return}var Je=Ee;if(Fe){var Ne=U==="ArrowLeft"?"left":"right";Je=g(de,Ee,Ne),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,ge=J.selectionEnd,de=J.value;if(de===void 0&&(de=""),oe===ge){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,ge=J.selectionEnd,de=J.value;de===void 0&&(de="");var Ee=g(de,oe);Ee!==oe&&!(oe===0&&ge===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&&ete()?"numeric":void 0,G=Object.assign({inputMode:Q},B,{type:t,value:ne,onChange:Ce,onKeyDown:D,onMouseUp:F,onFocus:K,onBlur:te});if(r==="text")return i?ve.createElement(ve.Fragment,null,i(ne,B)||null):ve.createElement("span",Object.assign({},B,{ref:s}),ne);if(n){var he=n;return ve.createElement(he,Object.assign({},G,{ref:s}))}return ve.createElement("input",Object.assign({},G,{ref:s}))}function Xv(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=jd(t),u=c.thousandSeparator,l=c.decimalSeparator,f=r!==0&&e.indexOf(".")!==-1||r&&n,p=Pg(e,o),v=p.beforeDecimal,w=p.afterDecimal,y=p.addNegation;return r!==void 0&&(w=$E(w,r,!!n)),u&&(v=Yee(v,u,a)),i&&(v=i+v),s&&(w=w+s),y&&(v="-"+v),e=v+(f&&l||"")+w,e}function jd(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 cte(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 ute(e,t){return new RegExp("(^-)|[0-9]|"+DE(e),t?"g":void 0)}function lte(e,t,r){return e===""?!0:!(t!=null&&t.match(/\d/))&&!(r!=null&&r.match(/\d/))&&typeof e=="string"&&!isNaN(Number(e))}function fte(e,t,r){var n;t===void 0&&(t=tte(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=jd(r),v=p.allowedDecimalSeparators,w=p.decimalSeparator,y=e[f]===w;if(uu(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 C=function(x,E,A){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,A-=g),{value:x,start:E,end:A,hasNegation:k}},O=C(e,l,f),j=O.hasNegation;n=O,e=n.value,l=n.start,f=n.end;var V=C(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 me=0;e.startsWith(s)?me+=s.length:l<s.length&&(me=l),e=e.substring(me),f-=me;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=cte(j?"-"+e:e,i),e=(e.match(ute(w,!0))||[]).join("");var z=e.indexOf(w);e=e.replace(new RegExp(DE(w),"g"),function(x,E){return E===z?".":""});var N=Pg(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 dte(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 hte(e){var t=jd(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 .)