@dodoex/widgets 3.0.1-solana.18 → 3.0.1-solana.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -20,4 +20,4 @@ import{useLingui as e,I18nProvider as t,Trans as n}from"@lingui/react";import{i1
20
20
  object-assign
21
21
  (c) Sindre Sorhus
22
22
  @license MIT
23
- */function md(){if(td)return ed;td=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;return ed=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var i={};return"abcdefghijklmnopqrst".split("").forEach((function(e){i[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},i)).join("")}catch(e){return!1}}()?Object.assign:function(i,o){for(var r,a,l=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(i),s=1;s<arguments.length;s++){for(var d in r=Object(arguments[s]))t.call(r,d)&&(l[d]=r[d]);if(e){a=e(r);for(var c=0;c<a.length;c++)n.call(r,a[c])&&(l[a[c]]=r[a[c]])}}return l},ed}function fd(){if(id)return nd;id=1;return nd="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}function gd(){return rd?od:(rd=1,od=Function.call.bind(Object.prototype.hasOwnProperty))}if("production"!==process.env.NODE_ENV){var xd=hd();_s.exports=function(){if(dd)return sd;dd=1;var e=hd(),t=md(),n=fd(),i=gd(),o=function(){if(ld)return ad;ld=1;var e=function(){};if("production"!==process.env.NODE_ENV){var t=fd(),n={},i=gd();e=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function o(o,r,a,l,s){if("production"!==process.env.NODE_ENV)for(var d in o)if(i(o,d)){var c;try{if("function"!=typeof o[d]){var u=Error((l||"React class")+": "+a+" type `"+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[d]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw u.name="Invariant Violation",u}c=o[d](r,d,l,a,null,t)}catch(e){c=e}if(!c||c instanceof Error||e((l||"React class")+": type specification of "+a+" `"+d+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof c+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),c instanceof Error&&!(c.message in n)){n[c.message]=!0;var p=s?s():"";e("Failed "+a+" type: "+c.message+(null!=p?p:""))}}}return o.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(n={})},ad=o}(),r=function(){};function a(){return null}return"production"!==process.env.NODE_ENV&&(r=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}),sd=function(l,s){var d="function"==typeof Symbol&&Symbol.iterator,c="@@iterator",u="<<anonymous>>",p={array:g("array"),bigint:g("bigint"),bool:g("boolean"),func:g("function"),number:g("number"),object:g("object"),string:g("string"),symbol:g("symbol"),any:f(a),arrayOf:function(e){return f((function(t,i,o,r,a){if("function"!=typeof e)return new m("Property `"+a+"` of component `"+o+"` has invalid PropType notation inside arrayOf.");var l=t[i];if(!Array.isArray(l))return new m("Invalid "+r+" `"+a+"` of type `"+v(l)+"` supplied to `"+o+"`, expected an array.");for(var s=0;s<l.length;s++){var d=e(l,s,o,r,a+"["+s+"]",n);if(d instanceof Error)return d}return null}))},element:f((function(e,t,n,i,o){var r=e[t];return l(r)?null:new m("Invalid "+i+" `"+o+"` of type `"+v(r)+"` supplied to `"+n+"`, expected a single ReactElement.")})),elementType:f((function(t,n,i,o,r){var a=t[n];return e.isValidElementType(a)?null:new m("Invalid "+o+" `"+r+"` of type `"+v(a)+"` supplied to `"+i+"`, expected a single ReactElement type.")})),instanceOf:function(e){return f((function(t,n,i,o,r){if(!(t[n]instanceof e)){var a=e.name||u;return new m("Invalid "+o+" `"+r+"` of type `"+((l=t[n]).constructor&&l.constructor.name?l.constructor.name:u)+"` supplied to `"+i+"`, expected instance of `"+a+"`.")}var l;return null}))},node:f((function(e,t,n,i,o){return y(e[t])?null:new m("Invalid "+i+" `"+o+"` supplied to `"+n+"`, expected a ReactNode.")})),objectOf:function(e){return f((function(t,o,r,a,l){if("function"!=typeof e)return new m("Property `"+l+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var s=t[o],d=v(s);if("object"!==d)return new m("Invalid "+a+" `"+l+"` of type `"+d+"` supplied to `"+r+"`, expected an object.");for(var c in s)if(i(s,c)){var u=e(s,c,r,a,l+"."+c,n);if(u instanceof Error)return u}return null}))},oneOf:function(e){return Array.isArray(e)?f((function(t,n,i,o,r){for(var a=t[n],l=0;l<e.length;l++)if(h(a,e[l]))return null;var s=JSON.stringify(e,(function(e,t){return"symbol"===b(t)?String(t):t}));return new m("Invalid "+o+" `"+r+"` of value `"+String(a)+"` supplied to `"+i+"`, expected one of "+s+".")})):("production"!==process.env.NODE_ENV&&r(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),a)},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&r("Invalid argument supplied to oneOfType, expected an instance of array."),a;for(var t=0;t<e.length;t++){var o=e[t];if("function"!=typeof o)return r("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+j(o)+" at index "+t+"."),a}return f((function(t,o,r,a,l){for(var s=[],d=0;d<e.length;d++){var c=(0,e[d])(t,o,r,a,l,n);if(null==c)return null;c.data&&i(c.data,"expectedType")&&s.push(c.data.expectedType)}return new m("Invalid "+a+" `"+l+"` supplied to `"+r+"`"+(s.length>0?", expected one of type ["+s.join(", ")+"]":"")+".")}))},shape:function(e){return f((function(t,i,o,r,a){var l=t[i],s=v(l);if("object"!==s)return new m("Invalid "+r+" `"+a+"` of type `"+s+"` supplied to `"+o+"`, expected `object`.");for(var d in e){var c=e[d];if("function"!=typeof c)return x(o,r,a,d,b(c));var u=c(l,d,o,r,a+"."+d,n);if(u)return u}return null}))},exact:function(e){return f((function(o,r,a,l,s){var d=o[r],c=v(d);if("object"!==c)return new m("Invalid "+l+" `"+s+"` of type `"+c+"` supplied to `"+a+"`, expected `object`.");var u=t({},o[r],e);for(var p in u){var h=e[p];if(i(e,p)&&"function"!=typeof h)return x(a,l,s,p,b(h));if(!h)return new m("Invalid "+l+" `"+s+"` key `"+p+"` supplied to `"+a+"`.\nBad object: "+JSON.stringify(o[r],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var f=h(d,p,a,l,s+"."+p,n);if(f)return f}return null}))}};function h(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function m(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function f(e){if("production"!==process.env.NODE_ENV)var t={},i=0;function o(o,a,l,d,c,p,h){if(d=d||u,p=p||l,h!==n){if(s){var f=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw f.name="Invariant Violation",f}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var g=d+":"+l;!t[g]&&i<3&&(r("You are manually calling a React.PropTypes validation function for the `"+p+"` prop on `"+d+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),t[g]=!0,i++)}}return null==a[l]?o?null===a[l]?new m("The "+c+" `"+p+"` is marked as required in `"+d+"`, but its value is `null`."):new m("The "+c+" `"+p+"` is marked as required in `"+d+"`, but its value is `undefined`."):null:e(a,l,d,c,p)}var a=o.bind(null,!1);return a.isRequired=o.bind(null,!0),a}function g(e){return f((function(t,n,i,o,r,a){var l=t[n];return v(l)!==e?new m("Invalid "+o+" `"+r+"` of type `"+b(l)+"` supplied to `"+i+"`, expected `"+e+"`.",{expectedType:e}):null}))}function x(e,t,n,i,o){return new m((e||"React class")+": "+t+" type `"+n+"."+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+o+"`.")}function y(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(y);if(null===e||l(e))return!0;var t=function(e){var t=e&&(d&&e[d]||e[c]);if("function"==typeof t)return t}(e);if(!t)return!1;var n,i=t.call(e);if(t!==e.entries){for(;!(n=i.next()).done;)if(!y(n.value))return!1}else for(;!(n=i.next()).done;){var o=n.value;if(o&&!y(o[1]))return!1}return!0;default:return!1}}function v(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||!!t&&("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}(t,e)?"symbol":t}function b(e){if(null==e)return""+e;var t=v(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function j(e){var t=b(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return m.prototype=Error.prototype,p.checkPropTypes=o,p.resetWarningCache=o.resetWarningCache,p.PropTypes=p,p},sd}()(xd.isElement,!0)}else _s.exports=function(){if(ud)return cd;ud=1;var e=fd();function t(){}function n(){}return n.resetWarningCache=t,cd=function(){function i(t,n,i,o,r,a){if(a!==e){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function o(){return i}i.isRequired=i;var r={array:i,bigint:i,bool:i,func:i,number:i,object:i,string:i,symbol:i,any:i,arrayOf:o,element:i,elementType:i,instanceOf:o,node:i,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return r.PropTypes=r,r}}()();var yd=Vt(_s.exports);function vd(e,t){return"production"===process.env.NODE_ENV?()=>null:function(...n){return e(...n)||t(...n)}}function bd(e,t,n,i,o){const r=e[t],a=o||t;if(null==r||"undefined"==typeof window)return null;let l;const s=r.type;return"function"!=typeof s||function(e){const{prototype:t={}}=e;return Boolean(t.isReactComponent)}(s)||(l="Did you accidentally use a plain function component for an element instead?"),void 0!==l?new Error(`Invalid ${i} \`${a}\` supplied to \`${n}\`. Expected an element that can hold a ref. ${l} For more information see https://mui.com/r/caveat-with-refs-guide`):null}const jd=vd(yd.element,bd);jd.isRequired=vd(yd.element.isRequired,bd);const wd="exact-prop: ​";function Cd(e){return e&&e.ownerDocument||document}const kd="undefined"!=typeof window?q.useLayoutEffect:q.useEffect;function Rd(e){const t=q.useRef(e);return kd((()=>{t.current=e})),q.useRef(((...e)=>(0,t.current)(...e))).current}function Sd(...e){return q.useMemo((()=>e.every((e=>null==e))?null:t=>{e.forEach((e=>{!function(e,t){"function"==typeof e?e(t):e&&(e.current=t)}(e,t)}))}),e)}const Id={};const Ed=[];class Md{static create(){return new Md}currentId=null;start(e,t){this.clear(),this.currentId=setTimeout((()=>{this.currentId=null,t()}),e)}clear=()=>{null!==this.currentId&&(clearTimeout(this.currentId),this.currentId=null)};disposeEffect=()=>this.clear}function Td(){const e=function(e,t){const n=q.useRef(Id);return n.current===Id&&(n.current=e(t)),n}(Md.create).current;var t;return t=e.disposeEffect,q.useEffect(t,Ed),e}const Ld={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function Od(e){var t,n,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Od(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function Wd(){for(var e,t,n=0,i="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Od(e))&&(i&&(i+=" "),i+=t);return i}function Vd(e,t=[]){if(void 0===e)return{};const n={};return Object.keys(e).filter((n=>n.match(/^on[A-Z]/)&&"function"==typeof e[n]&&!t.includes(n))).forEach((t=>{n[t]=e[t]})),n}function Ad(e){if(void 0===e)return{};const t={};return Object.keys(e).filter((t=>!(t.match(/^on[A-Z]/)&&"function"==typeof e[t]))).forEach((n=>{t[n]=e[n]})),t}function Fd(e){const{elementType:t,externalSlotProps:n,ownerState:i,skipResolvingSlotProps:o=!1,...r}=e,a=o?{}:function(e,t,n){return"function"==typeof e?e(t,n):e}(n,i),{props:l,internalRef:s}=function(e){const{getSlotProps:t,additionalProps:n,externalSlotProps:i,externalForwardedProps:o,className:r}=e;if(!t){const e=Wd(n?.className,r,o?.className,i?.className),t={...n?.style,...o?.style,...i?.style},a={...n,...o,...i};return e.length>0&&(a.className=e),Object.keys(t).length>0&&(a.style=t),{props:a,internalRef:void 0}}const a=Vd({...o,...i}),l=Ad(i),s=Ad(o),d=t(a),c=Wd(d?.className,n?.className,r,o?.className,i?.className),u={...d?.style,...n?.style,...o?.style,...i?.style},p={...d,...n,...s,...l};return c.length>0&&(p.className=c),Object.keys(u).length>0&&(p.style=u),{props:p,internalRef:d.ref}}({...r,externalSlotProps:a}),d=function(e,t,n){return void 0===e||"string"==typeof e?t:{...t,ownerState:{...t.ownerState,...n}}}(t,{...l,ref:Sd(s,a?.ref,e.additionalProps?.ref)},i);return d}function Zd(e){return e.substring(2).toLowerCase()}function Pd(e){const{children:t,disableReactTree:n=!1,mouseEvent:i="onClick",onClickAway:o,touchEvent:r="onTouchEnd"}=e,a=q.useRef(!1),l=q.useRef(null),s=q.useRef(!1),d=q.useRef(!1);q.useEffect((()=>(setTimeout((()=>{s.current=!0}),0),()=>{s.current=!1})),[]);const c=Sd((u=t)&&q.isValidElement(u)?u.props.propertyIsEnumerable("ref")?u.props.ref:u.ref:null,l);var u;const p=Rd((e=>{const t=d.current;d.current=!1;const i=Cd(l.current);if(!s.current||!l.current||"clientX"in e&&function(e,t){return t.documentElement.clientWidth<e.clientX||t.documentElement.clientHeight<e.clientY}(e,i))return;if(a.current)return void(a.current=!1);let r;r=e.composedPath?e.composedPath().indexOf(l.current)>-1:!i.documentElement.contains(e.target)||l.current.contains(e.target),r||!n&&t||o(e)})),h=e=>n=>{d.current=!0;const i=t.props[e];i&&i(n)},m={ref:c};return!1!==r&&(m[r]=h(r)),q.useEffect((()=>{if(!1!==r){const e=Zd(r),t=Cd(l.current),n=()=>{a.current=!0};return t.addEventListener(e,p),t.addEventListener("touchmove",n),()=>{t.removeEventListener(e,p),t.removeEventListener("touchmove",n)}}}),[p,r]),!1!==i&&(m[i]=h(i)),q.useEffect((()=>{if(!1!==i){const e=Zd(i),t=Cd(l.current);return t.addEventListener(e,p),()=>{t.removeEventListener(e,p)}}}),[p,i]),Gt.jsx(q.Fragment,{children:q.cloneElement(t,m)})}"production"!==process.env.NODE_ENV&&(Pd.propTypes={children:jd.isRequired,disableReactTree:yd.bool,mouseEvent:yd.oneOf(["onClick","onMouseDown","onMouseUp","onPointerDown","onPointerUp",!1]),onClickAway:yd.func.isRequired,touchEvent:yd.oneOf(["onTouchEnd","onTouchStart",!1])}),"production"!==process.env.NODE_ENV&&(Pd.propTypes=function(e){return"production"===process.env.NODE_ENV?e:{...e,[wd]:t=>{const n=Object.keys(t).filter((t=>!e.hasOwnProperty(t)));return n.length>0?new Error(`The following props are not supported: ${n.map((e=>`\`${e}\``)).join(", ")}. Please remove them.`):null}}}(Pd.propTypes));const Bd="base";function Nd(e,t){const n=Ld[t];return n?`${Bd}--${n}`:function(e,t){return`${Bd}-${e}-${t}`}(e,t)}const Ud="Snackbar";function Hd(e){return Nd(Ud,e)}!function(e,t){const n={};t.forEach((t=>{n[t]=Nd(e,t)}))}(Ud,["root"]);const Dd={disableDefaultClasses:!1},Yd=q.createContext(Dd);"production"!==process.env.NODE_ENV&&(Yd.displayName="ClassNameConfiguratorContext");const zd=()=>function(e,t,n){const i={};for(const o in e){const r=e[o];let a="";for(let e=0;e<r.length;e+=1){const i=r[e];i&&(a+=t(i)+" ",n&&n[i]&&(a+=n[i]+" "))}i[o]=a}return i}({root:["root"]},function(e){const{disableDefaultClasses:t}=q.useContext(Yd);return n=>t?"":e(n)}(Hd)),Xd=q.forwardRef((function(e,t){const{autoHideDuration:n=null,children:i,disableWindowBlurListener:o=!1,exited:r=!0,onBlur:a,onClose:l,onFocus:s,onMouseEnter:d,onMouseLeave:c,open:u,resumeHideDuration:p,slotProps:h={},slots:m={},...f}=e,g=zd(),{getRootProps:x,onClickAway:y}=function(e={}){const{autoHideDuration:t=null,disableWindowBlurListener:n=!1,onClose:i,open:o,resumeHideDuration:r}=e,a=Td();q.useEffect((()=>{if(o)return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)};function e(e){e.defaultPrevented||"Escape"===e.key&&i?.(e,"escapeKeyDown")}}),[o,i]);const l=Rd(((e,t)=>{i?.(e,t)})),s=Rd((e=>{i&&null!=e&&a.start(e,(()=>{l(null,"timeout")}))}));q.useEffect((()=>(o&&s(t),a.clear)),[o,t,s,a]);const d=a.clear,c=q.useCallback((()=>{null!=t&&s(null!=r?r:.5*t)}),[t,r,s]),u=e=>t=>{const n=e.onFocus;n?.(t),d()},p=e=>t=>{const n=e.onMouseEnter;n?.(t),d()},h=e=>t=>{const n=e.onMouseLeave;n?.(t),c()};return q.useEffect((()=>{if(!n&&o)return window.addEventListener("focus",c),window.addEventListener("blur",d),()=>{window.removeEventListener("focus",c),window.removeEventListener("blur",d)}}),[n,o,c,d]),{getRootProps:(t={})=>{const n={...Vd(e),...Vd(t)};return{role:"presentation",...t,...n,onBlur:(i=n,e=>{const t=i.onBlur;t?.(e),c()}),onFocus:u(n),onMouseEnter:p(n),onMouseLeave:h(n)};var i},onClickAway:e=>{i?.(e,"clickaway")}}}({...e,autoHideDuration:n,disableWindowBlurListener:o,onClose:l,open:u,resumeHideDuration:p}),v=e,b=m.root||"div",j=Fd({elementType:b,getSlotProps:x,externalForwardedProps:f,externalSlotProps:h.root,additionalProps:{ref:t},ownerState:v,className:g.root}),w=Fd({elementType:Pd,externalSlotProps:h.clickAwayListener,additionalProps:{onClickAway:y},ownerState:v});return delete w.ownerState,!u&&r?null:Gt.jsx(Pd,{...w,children:Gt.jsx(b,{...j,children:i})})}));function qd({size:e,color:t,time:n,strokeWidth:i=2,sx:o}){const[r,a]=_("0 1069"),l=e/2,s=l-1;return J((()=>{a(2*Math.PI*s+" 0")}),[]),Gt.jsx(x,{width:e,height:e,component:"svg",sx:Object.assign({position:"absolute",top:`-${i}`,left:`-${i}`,transform:"rotate(-90deg)"},o),children:Gt.jsx(x,{component:"circle",cx:l,cy:l,r:s,strokeWidth:i,stroke:t,fill:"none",strokeDasharray:r,sx:{transition:`stroke-dasharray ${n}`}})})}"production"!==process.env.NODE_ENV&&(Xd.propTypes={autoHideDuration:yd.number,children:yd.node,disableWindowBlurListener:yd.bool,exited:yd.bool,onClose:yd.func,open:yd.bool,resumeHideDuration:yd.number,slotProps:yd.shape({clickAwayListener:yd.oneOfType([yd.func,yd.shape({children:yd.element.isRequired,disableReactTree:yd.bool,mouseEvent:yd.oneOf(["onClick","onMouseDown","onMouseUp","onPointerDown","onPointerUp",!1]),onClickAway:yd.func,touchEvent:yd.oneOf(["onTouchEnd","onTouchStart",!1])})]),root:yd.oneOfType([yd.func,yd.object])}),slots:yd.shape({root:yd.elementType})});var Gd=G.memo(qd);const _d=Be((e=>({notify:null,toast:t=>{e({notify:t})},close:()=>{e({notify:null})}}))),Jd={entering:"translateX(0)",entered:"translateX(0)",exiting:"translateX(500px)",exited:"translateX(500px)",unmounted:"translateX(500px)"};function Qd(){const e=y(),{notify:t,close:n}=_d(),[i,o]=G.useState(!0),r=G.useRef(null),a=null==t?void 0:t.timeout,l=!!t;let s=Gt.jsxs("svg",{width:"36",height:"36",viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Gt.jsx("circle",{cx:"18",cy:"18",r:"16.5",stroke:"#2FBA90",strokeWidth:"3"}),Gt.jsx("path",{d:"M25.1384 11.334L14.8873 21.5851L10.8584 17.5718L8.66504 19.7651L14.8873 25.9873L27.3317 13.5429L25.1384 11.334Z",fill:"#2FBA90"})]});switch(null==t?void 0:t.type){case"error":s=Gt.jsxs("svg",{width:"36",height:"37",viewBox:"0 0 36 37",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Gt.jsx("circle",{cx:"18",cy:"18.5",r:"16.5",stroke:"#FF6187",strokeWidth:"3"}),Gt.jsx("path",{d:"M25.3331 13.0452L19.8782 18.5L25.3331 23.9548L23.5148 25.7731L18.06 20.3183L12.6051 25.7731L10.7869 23.9548L16.2417 18.5L10.7869 13.0452L12.6051 11.2269L18.06 16.6817L23.5148 11.2269L25.3331 13.0452Z",fill:"#FF6187"})]});break;case"warning":s=Gt.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Gt.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.4065 3.6189L9.62438 3.59576L3.39812 9.78928L3.37498 18.5714L9.5685 24.7976L18.3506 24.8208L24.5769 18.6273L24.6 9.84516L18.4065 3.6189ZM26.9359 8.88481L19.3791 1.28812L8.66403 1.25988L1.06734 8.81663L1.0391 19.5317L8.59585 27.1284L19.311 27.1567L26.9076 19.5999L26.9359 8.88481Z",fill:"#B15600"}),Gt.jsx("path",{d:"M15.1664 7.58398H12.8331V16.9173H15.1664V7.58398Z",fill:"#B15600"}),Gt.jsx("path",{d:"M13.9998 21.6395C14.8896 21.6395 15.6109 20.9181 15.6109 20.0283C15.6109 19.1386 14.8896 18.4172 13.9998 18.4172C13.11 18.4172 12.3887 19.1386 12.3887 20.0283C12.3887 20.9181 13.11 21.6395 13.9998 21.6395Z",fill:"#B15600"})]})}return Gt.jsx(x,{component:Xd,open:l,autoHideDuration:a,onClose:(e,t)=>{"clickaway"!==t&&n()},exited:i,sx:{position:"fixed",top:20,left:20,right:20,zIndex:1,[e.breakpoints.up("tablet")]:{left:"auto"}},children:Gt.jsx(gt,{timeout:{enter:400,exit:400},in:l,appear:!0,unmountOnExit:!0,onEnter:()=>{o(!1)},onExited:()=>{o(!0)},nodeRef:r,children:i=>Gt.jsxs(x,{ref:r,sx:{display:"flex",justifyContent:"space-between",p:12,borderRadius:8,backgroundColor:"background.paper",color:"text.primary",border:"solid 1px",borderColor:"border.main",boxShadow:"0px 6px 12px 0px rgba(0, 0, 0, 0.10)",transform:Jd[i],transition:"transform 300ms ease",[e.breakpoints.up("tablet")]:{p:20,width:"auto",maxWidth:328}},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[Gt.jsx(x,{sx:{mt:7,"& > svg":{width:28,height:28},[e.breakpoints.up("tablet")]:{"& > svg":{width:36,height:36}}},children:t?s:""}),Gt.jsxs(x,{sx:{ml:20},children:[Gt.jsx(x,{sx:{typography:"caption"},children:null==t?void 0:t.message}),(null==t?void 0:t.link)?Gt.jsxs(x,{component:"a",target:"_blank",rel:"noopener noreferrer",href:t.link.outerLink,sx:{display:"inline-flex",alignItems:"center",typography:"body2",color:"text.secondary","&:hover":{color:"text.primary"}},children:[t.link.text,Gt.jsx(x,{component:"svg",width:"18",height:"19",viewBox:"0 0 18 19",fill:"none",xmlns:"http://www.w3.org/2000/svg",sx:{ml:4,width:18,height:18},children:Gt.jsx("path",{d:"M4.22703 13.2122L10.6811 6.75812L4.75206 6.75812L4.75736 5.25729H13.2426V13.7426H11.7471L11.7418 7.81878L5.28769 14.2729L4.22703 13.2122Z",fill:"currentColor"})})]}):"",(null==t?void 0:t.content)?Gt.jsx(x,{sx:{mt:4,typography:"body2",color:"text.secondary"},children:t.content}):""]})]}),Gt.jsxs(x,{sx:{position:"relative",top:10,ml:12,display:"flex",alignItems:"center",justifyContent:"center",width:24,height:24,borderRadius:12,borderStyle:"solid",borderWidth:a?"2.4px":0,borderColor:e.palette.border.main,backgroundColor:a?"transparent":e.palette.background.paperDarkContrast,cursor:"pointer",boxSizing:"border-box",[e.breakpoints.up("tablet")]:{ml:28}},onClick:n,children:[a?Gt.jsx(Gd,{size:24,strokeWidth:"2.4px",time:`${a}ms`,color:e.palette.text.disabled}):"",Gt.jsx(x,{component:"svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",sx:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:16,height:16,border:"none",color:e.palette.text.disabled},children:Gt.jsx("g",{children:Gt.jsx("path",{d:"M12.8897 4.36345L9.25313 8L12.8897 11.6365L11.6775 12.8487L8.04095 9.21218L4.4044 12.8487L3.19221 11.6365L6.82876 8L3.19221 4.36345L4.4044 3.15127L8.04095 6.78782L11.6775 3.15127L12.8897 4.36345Z",fill:"currentColor"})})})]})]})})})}var Kd;function $d(){return $d=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},$d.apply(null,arguments)}const ec=e=>q.createElement("svg",$d({width:"33px",height:"33px",viewBox:"0 0 33 33",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},e),Kd||(Kd=q.createElement("g",{stroke:"none",strokeWidth:1,fill:"none",fillRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round"},q.createElement("g",{transform:"translate(-186.000000, -375.000000)",stroke:"currentColor",strokeWidth:4},q.createElement("g",{transform:"translate(18.000000, 291.000000)"},q.createElement("g",{transform:"translate(40.000000, 83.000000)"},q.createElement("path",{d:"M159,32 C159,15.9837423 146.016258,3 130,3"}))))))),tc=300;function nc({open:e,onClose:t,afterClose:n,title:i,rightSlot:o,canBack:r=!0,children:a,height:l,testId:s}){return Gt.jsxs(x,{sx:{position:"absolute",top:e?0:"100%",transition:`all ${tc}ms`,zIndex:20,left:0,right:0,bottom:0,display:"flex",flexDirection:"column",backgroundColor:"background.paper",borderRadius:16,height:l},"data-testid":s,"data-active":e?"1":"0",children:[i?Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",p:20},children:[Gt.jsx(x,{sx:{display:"flex",alignItems:"center",typography:"caption"},children:i}),o,!o&&r&&Gt.jsx(x,{component:Ft.Error,sx:{color:"text.secondary",cursor:"pointer"},onClick:()=>{t&&t(),setTimeout((()=>n&&n()),tc)}})]}):"",e?a:""]})}function ic({open:e,onClose:t,afterClose:n,title:i,rightSlot:o,canBack:r=!0,children:a,height:l,testId:s}){return Gt.jsx(v,{open:e,onClose:t,"data-testid":s,"data-active":e?"1":"0",children:Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column",height:l},children:[i?Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",p:20},children:[Gt.jsx(x,{sx:{display:"flex",alignItems:"center",typography:"caption"},children:i}),o,!o&&r&&Gt.jsx(x,{component:Ft.Error,sx:{color:"text.secondary",cursor:"pointer"},onClick:()=>{t&&t(),setTimeout((()=>n&&n()),tc)}})]}):"",e?a:""]})})}function oc(e){var{scope:t,modal:n}=e,i=Wr(e,["scope","modal"]);const{widgetRef:o,DialogComponent:r}=Zr();if(r)return Gt.jsx(r,{scope:t,...i});const a=n?ic:nc;return(null==o?void 0:o.current)&&!t?xt(Gt.jsx(a,{...i}),o.current):Gt.jsx(a,{...i})}const rc=6;function ac({showingDone:e,errorMessage:t}){var n;const i=y();return t?Gt.jsx(x,{component:Ft.ErrorWarn,sx:{width:64,height:64,color:"error.main"}}):e?Gt.jsx(x,{component:Ft.DoneBorder,sx:{width:64,height:64,color:"success.main"}}):Gt.jsx(x,{sx:{mx:"auto",border:`${rc}px solid ${null===(n=i.palette)||void 0===n?void 0:n.background.input}`,borderRadius:"50%",width:"64px",height:"64px",position:"relative",animation:"loadingRotate 1.1s infinite linear","@keyframes loadingRotate":{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(359deg)"}}},children:Gt.jsx(x,{component:ec,sx:{position:"absolute",top:`-${rc}px`,right:`-${rc}px`,color:"primary.main"}})})}function lc({showingDone:e,showing:t}){return Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",flexDirection:"column"},children:[Gt.jsx(x,{sx:{mt:60},children:e?i._({id:"4xbbt/",message:"{0} confirmed",values:{0:null==t?void 0:t.brief}}):i._({id:"/nzjSF",message:"{0} pending",values:{0:null==t?void 0:t.brief}})}),(null==t?void 0:t.subtitle)?Gt.jsx(x,{sx:{mt:20,typography:"body2"},children:null==t?void 0:t.subtitle}):""]})}function sc({isStarted:e,isEnded:t,tx:i}){const[o,r]=_(0),{chainId:a}=Br(),l=K((()=>`https://${yr[a||1]}/tx/${i}`),[i,a]),s=K((()=>{const e=Math.floor(o/60),t=o%60;return e?`${e}m ${t}s`:`${t}s`}),[o]),d=te();return J((()=>(e&&(r(0),window.clearInterval(d.current),d.current=window.setInterval((()=>{r((e=>e+1))}),1e3)),()=>{window.clearInterval(d.current)})),[e]),J((()=>{t&&window.clearInterval(d.current)}),[t]),Gt.jsxs(x,{sx:{mt:20,pt:20,display:"flex",justifyContent:"space-between",alignItems:"center",typography:"body2",color:"text.secondary",border:"solid 1px transparent",borderTopColor:"border.main"},children:[Gt.jsxs(x,{children:[Gt.jsx(n,{id:"+Jkdiu",message:"Transaction Time:"}),s]}),Gt.jsxs(j,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},component:"a",href:l,target:"_blank",rel:"noopener noreferrer",children:[Gt.jsx(n,{id:"S3piC2",message:"Tx"}),Gt.jsx(x,{component:Ft.ArrowTopRightBorder,sx:{width:16,height:16,ml:6}})]})]})}function dc(e){var{children:t,executionStatus:i}=e;const o=ka(Wr(e,["children","executionStatus"])),{ctxVal:r,showing:a,closeShowing:l,showingDone:s,errorMessage:d,transactionTx:c}=Object.assign(Object.assign({},o),i),u=pe(),p=Zr((e=>e.noSubmissionDialog));return Gt.jsxs(Ra.Provider,{value:r,children:[t,Gt.jsx(oc,{open:!!a&&!p,onClose:l,id:"submission",children:Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column",justifyContent:"space-between",px:20,pb:20,flex:1,overflowY:"auto"},children:[Gt.jsxs(x,{children:[Gt.jsx(x,{sx:{textAlign:"center",pt:60},children:Gt.jsx(ac,{showingDone:s,errorMessage:d})}),d?Gt.jsxs(x,{sx:{textAlign:"center",mt:60},children:[Gt.jsx(x,{children:Gt.jsx(n,{id:"kf83Ld",message:"Something went wrong."})}),Gt.jsx(x,{sx:{color:"text.secondary",mt:12,typography:"body2",wordBreak:"break-all"},children:d})]}):Gt.jsxs(Gt.Fragment,{children:[Gt.jsx(lc,{showingDone:s,showing:a}),Gt.jsx(sc,{isStarted:!!a,isEnded:s,tx:c})]})]}),Gt.jsx(b,{fullWidth:!0,size:b.Size.big,onClick:()=>{u(Yr(qr.Initial)),l()},sx:{mt:20},children:d?Gt.jsx(n,{id:"1QfxQT",message:"Dismiss"}):Gt.jsx(n,{id:"yz7wBu",message:"Close"})})]})})]})}const cc="dodo-widget-container";function uc(e){return e.noLangProvider?Gt.jsx(Gt.Fragment,{children:e.children}):Gt.jsx(zs,{locale:e.locale,children:Gt.jsx(dc,{...e,children:e.children})})}function pc(e){!function({tokenList:e,popularTokenList:t}){const n=pe();J((()=>{(()=>{Vr(this,void 0,void 0,(function*(){let i=[];i=se(e)?e:le(t,ll,(e=>e.address.toLowerCase()+e.chainId+e.side)),n(sl(i))}))})()}),[e,n,t]),J((()=>{n(dl(null!=t?t:[]))}),[t,n])}(e),ja();const t=e.width||375,n=e.height||494,{widgetRef:i}=Zr();return e.noUI?Gt.jsx(uc,{...e,children:e.children}):Gt.jsx(uc,{...e,children:Gt.jsx(x,{sx:{width:t,height:n,overflow:"hidden",position:"relative",display:"flex",flexDirection:"column",minWidth:335,minHeight:494,borderRadius:16,backgroundColor:"background.paper"},className:cc,ref:i,children:e.children})})}function hc(e){var t,n;const i=te(null);return Gt.jsx(me,{store:Pa,children:Gt.jsx(Fr,{...Object.assign(Object.assign({},e),{widgetRef:null!==(t=e.widgetRef)&&void 0!==t?t:i,apiDomain:null!==(n=e.apiDomain)&&void 0!==n?n:"dodoex.io"}),children:Gt.jsx(qs,{children:Gt.jsx(As,{children:Gt.jsx(pc,{...e})})})})})}function mc(e){const t=w({mode:e.colorMode,theme:e.theme,lang:e.locale||Ts});return e.apikey||e.apiServices||console.error("apikey and apiServices must have a."),Gt.jsxs(C,{theme:t,children:[Gt.jsx(k,{container:`.${cc}, .${R}, .${S}`}),Gt.jsx(Re,{client:Xs,children:Gt.jsxs(hc,{...e,children:[e.children,Gt.jsx(Qd,{})]})})]})}function fc(e){var{sx:t}=e,n=Wr(e,["sx"]);const{width:i}=Zr(),o=K((()=>{let e="";return"number"==typeof i?e=`${i}px`:i&&(e=i),e?`calc(${e} - 40px)`:"auto"}),[i]);return Gt.jsx(I,{container:document.querySelector(`.${cc}`),maxWidth:o,sx:Object.assign({cursor:"help"},t),...n})}function gc(e){var t,{chainId:i,includeButton:o}=e,r=Wr(e,["chainId","includeButton"]);const{account:a,chainId:l}=Br(),{onConnectWalletClick:s}=Zr(),[d,c]=G.useState(!1),{setVisible:u}=ft();return!a||d||void 0===l||i&&i!==l?Gt.jsx(Gt.Fragment,{children:Gt.jsx(b,{...r,isLoading:d,onClick:()=>Vr(this,void 0,void 0,(function*(){if(s){c(!0);const e=yield s();if(c(!1),e)return}u(!0)})),children:d?Gt.jsx(n,{id:"J28zul",message:"Connecting..."}):Gt.jsx(n,{id:"r7ScnQ",message:"Connect to a wallet"})})}):o?Gt.jsx(Gt.Fragment,{children:null!==(t=r.children)&&void 0!==t?t:null}):Gt.jsx(b,{...r})}function xc({needSwitchChain:e}){return Gt.jsx(Gt.Fragment,{children:Gt.jsx(gc,{size:b.Size.middle,fullWidth:!0,"data-testid":Er,chainId:e})})}function yc({open:e,execute:t,onClose:i,toToken:o,fromToken:r,fromAmount:a,toAmount:l,priceImpact:s,clearFromAmt:d,clearToAmt:c,baseFeeAmount:u,curToFiatPrice:p,curFromFiatPrice:h,additionalFeeAmount:m,loading:f,slippage:g}){var v,j;const w=y(),C=pe(),k=he(Ba),R=K((()=>!!s&&new oe(s).gt(Cr)),[s]),[S,I]=_(!1),[T,L]=_(!1);return J((()=>{k!==qr.Pending&&i(),k===qr.TxSuccess&&(c(),d())}),[k]),J((()=>{I(!1)}),[p]),Gt.jsx(oc,{open:e,onClose:()=>{C(Yr(qr.Initial)),i()},id:"swap-summary",title:Gt.jsx(n,{id:"QR4/RH",message:"Swap summary"}),children:Gt.jsxs(x,{sx:{margin:20,display:"flex",height:"100%",flexDirection:"column",borderTop:`1px solid ${w.palette.border.main}`},children:[Gt.jsxs(x,{sx:{py:20,display:"flex",typography:"body2",alignItems:"center",justifyContent:"center",flexDirection:"column",borderBottom:`1px solid ${w.palette.border.main}`},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[Gt.jsxs(x,{children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"center"},children:[Gt.jsx(Ms,{width:16,height:16,url:null==r?void 0:r.logoURI,address:null!==(v=null==r?void 0:r.address)&&void 0!==v?v:"",marginRight:6}),Gt.jsx(x,{children:`${Kr({input:a,decimals:null==r?void 0:r.decimals})} ${null==r?void 0:r.symbol}`})]}),null!==h&&Gt.jsx(x,{sx:{mt:4,typography:"h6",color:w.palette.text.secondary},children:h?`$${Qr({input:h,showDecimals:1})}`:"-"})]}),Gt.jsx(x,{sx:{width:16,mx:16},component:Ft.DoubleRight}),Gt.jsxs(x,{children:[Gt.jsxs(x,{sx:{display:"flex"},children:[Gt.jsx(Ms,{width:16,height:16,marginRight:6,url:null==o?void 0:o.logoURI,address:null!==(j=null==o?void 0:o.address)&&void 0!==j?j:""}),Gt.jsx(E,{loading:f,loadingProps:{width:30},children:`${Kr({input:l,decimals:null==o?void 0:o.decimals})} ${null==o?void 0:o.symbol}`})]}),null!==h&&Gt.jsx(E,{loading:f,loadingProps:{width:30},sx:{typography:"h6",mt:4,color:w.palette.text.secondary},children:p?`$${Qr({input:p,showDecimals:1})}(${s}%)`:"-"})]})]}),Gt.jsxs(x,{sx:{mt:12,display:"flex",alignItems:"center",typography:"h6"},children:["1",null==r?void 0:r.symbol," = ",Gt.jsx(E,{loading:f,loadingProps:{width:30},children:Kr({input:new oe(l).dividedBy(new oe(a)),decimals:null==o?void 0:o.decimals})})," ",null==o?void 0:o.symbol]})]}),Gt.jsxs(x,{sx:{py:15,typography:"body2",borderBottom:`1px solid ${w.palette.border.main}`},children:[Gt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",color:w.palette.text.secondary},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[Gt.jsx(x,{sx:{width:16,mr:7},component:Ft.DetailBorder}),Gt.jsx(n,{id:"XeovX3",message:"Swap Detail"})]}),Gt.jsx(x,{component:M,children:Gt.jsx(x,{onClick:()=>L(!T),sx:{width:10,color:"text.secondary",transform:T?"rotateX(0deg)":"rotateX(180deg)"},component:Ft.CaretUp})})]}),Gt.jsxs(x,{sx:{mt:16,display:T?"initial":"none"},children:[Gt.jsxs(x,{sx:{mt:8,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[Gt.jsx(n,{id:"93m8jT",message:"Basic Fee"}),Gt.jsx(fc,{title:Gt.jsx(n,{id:"8Z29ZO",message:"Estimated service provider fees"}),ml:5})]}),Gt.jsx(E,{loading:f,loadingProps:{width:30},children:u?`${Kr({input:u,decimals:null==o?void 0:o.decimals})} ${null==o?void 0:o.symbol}`:"0"})]}),Gt.jsxs(x,{sx:{mt:8,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[Gt.jsx(n,{id:"J39pAJ",message:"Additional Fee"}),Gt.jsx(fc,{title:Gt.jsx(n,{id:"ZXvy7b",message:"Additional routing fees set by the Widget user"}),ml:5})]}),Gt.jsx(E,{loading:f,loadingProps:{width:30},children:m?`${Kr({input:m,decimals:null==o?void 0:o.decimals})} ${null==o?void 0:o.symbol}`:"0"})]}),!!s&&Gt.jsxs(x,{sx:{mt:8,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[Gt.jsx(n,{id:"T+qgFw",message:"Price Impact"}),Gt.jsx(fc,{title:Gt.jsx(n,{id:"4kY4C4",message:"Due to the market condition, market price and estimated price may have a slight difference"}),ml:5})]}),Gt.jsx(x,{children:`${s}%`})]}),Gt.jsxs(x,{sx:{mt:8,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[Gt.jsx(n,{id:"CMHmbm",message:"Slippage"}),Gt.jsx(fc,{title:Gt.jsx(n,{id:"GAypnX",message:"High slippage tolerance will increase the success rate of transaction, but might not get the best quote."}),ml:5})]}),Gt.jsxs(x,{children:[g,"%"]})]})]})]}),Gt.jsx(x,{sx:{flex:1}}),R&&Gt.jsxs(x,{sx:{mb:14,display:"flex",cursor:"pointer",justifyContent:"center",alignItems:"center",typography:"h6"},onClick:()=>I(!S),children:[Gt.jsx(x,{sx:{mr:4,width:18,height:18,alignItems:"center"},children:S?Gt.jsx(x,{sx:{width:"100%",height:"100%",borderRadius:4,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"secondary.main"},children:Gt.jsx(x,{component:Ft.Done,sx:{width:14,color:"#1a1a1b"}})}):Gt.jsx(x,{sx:{width:"100%",height:"100%",borderRadius:4,border:`1px solid ${w.palette.text.secondary}`}})}),Gt.jsx(x,{children:Gt.jsx(n,{components:{0:Gt.jsx(x,{component:"span",sx:{color:"error.main"}})},values:{priceImpact:s},id:"Price impact reaches <0>{priceImpact}</0>%, accept the quote"})})]}),Gt.jsx(b,{isLoading:k==qr.Pending,disabled:R&&!S,fullWidth:!0,onClick:()=>{t(),C(Yr(qr.Pending))},children:k==qr.Pending?Gt.jsx(n,{id:"P+K/3O",message:"Confirming"}):Gt.jsx(n,{id:"lQ6r7x",message:"Confirm swap"})})]})})}var vc;function bc({fromToken:e,toToken:t}){const i=y(),{onlySolana:o}=Zr();Ka();const{customSlippage:r,customSlippageNum:a,handleSlippageChange:l,forecastSlippage:s,forecastSlippageQuery:d,recommendSlippage:c}=tl({fromToken:e,toToken:t}),[u,p]=G.useState(!1),[h,m]=G.useState();!h&&e&&t&&m(r?vc.custom:vc.recommend);const f=h===vc.custom;return G.useRef(null),G.useMemo((()=>h===vc.custom?a?new oe(a).div(100).toNumber():void 0:new oe(c).div(100).toNumber()),[h,c,a]),G.useCallback((e=>{f||m(vc.custom),l({slippage:new oe(e).times(100).toString(),disabled:!1,deleted:!1,recommend:String(c)})}),[f,c,l]),o?Gt.jsxs(x,{sx:{pt:20,borderTop:`1px solid ${i.palette.border.main}`},children:[Gt.jsxs(x,{sx:{mb:16,display:"flex",alignItems:"center"},children:[Gt.jsx(n,{id:"lqTDfd",message:"Slippage Tolerance"}),Gt.jsx(I,{title:Gt.jsx(n,{id:"KAmxpM",message:"Attention: High slippage tolerance will increase the success rate of transaction, but might not get the best quote."}),ml:7})]}),Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column"},children:[Gt.jsx(T,{placeholder:String(c),fullWidth:!0,sx:{height:36,"& input":{boxSizing:"border-box","&::placeholder":{color:"custom.input.placeholder",opacity:1}}},inputMode:"decimal",suffix:Gt.jsx(x,{sx:{color:"text.disabled"},children:"%"}),value:r||"",onChange:e=>{const t=e.target.value;l({slippage:t,disabled:!1,recommend:String(c)})},onBlur:()=>{setTimeout((()=>{if(p(!1),!a)return void m(vc.recommend);const e=!a||a<0;e&&r&&l({slippage:r,disabled:e,deleted:e,recommend:String(c)})}),10)}}),Number(r)>=Rr&&Gt.jsx(x,{sx:{typography:"h6",mt:6,color:"error.main"},children:Gt.jsx(n,{id:"Zm56FI",message:"Maximum slippage do not exceed 50%"})})]})]}):null}function jc({checked:e,onChange:t,sx:i,disabled:o}){const r=y();let a=r.palette.background.paper;return e&&(a=r.palette.secondary.main),Gt.jsxs(x,{sx:Object.assign({display:"flex",alignItems:"center",position:"relative",borderRadius:8,backgroundColor:r.palette.background.input,opacity:o?.5:1},i),component:M,disabled:o,onClick:()=>{o||t(!e)},children:[Gt.jsx(x,{sx:{typography:"body2",fontWeight:600,pl:12,pr:13,pt:8,pb:9,width:"50%",zIndex:1,color:r.palette.text.primary,whiteSpace:"nowrap"},children:Gt.jsx(n,{id:"az8lvo",message:"Off"})}),Gt.jsx(x,{sx:{typography:"body2",fontWeight:600,pl:12,pr:13,pt:8,pb:9,width:"50%",zIndex:1,color:e?r.palette.secondary.contrastText:r.palette.text.primary,whiteSpace:"nowrap"},children:Gt.jsx(n,{id:"Z5HWHd",message:"On"})}),Gt.jsx(x,{sx:{borderRadius:6,backgroundColor:a,zIndex:0,position:"absolute",top:2,bottom:2,width:"calc(50% - 2px - 2px)",left:e?"calc(50% + 2px)":"2px",transition:"left 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, transform 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms"}})]})}function wc({show:e,onClick:t}){const i=y();return Gt.jsxs(j,{weak:!0,sx:{display:e?"flex":"none",alignItems:"center",position:"absolute",bottom:28,left:"50%",transform:"translateX(-50%)",p:i.spacing(8,20),fontWeight:600,borderRadius:20,border:`solid 1px ${i.palette.border.main}`,backgroundColor:"background.paperContrast",boxShadow:`0px 8px 16px 0px ${L("light"===i.palette.mode?"#FFF":"#000",.1)}`,cursor:"pointer",whiteSpace:"nowrap",gap:4},onClick:t,children:[Gt.jsx(n,{id:"F8yRdq",message:"More trade settings"}),Gt.jsx(x,{component:"svg",width:25,height:24,viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",sx:{color:"text.secondary"},children:Gt.jsx("path",{d:"M12.5 19L6.5 13L7.9 11.6L12.5 16.175L17.1 11.6L18.5 13L12.5 19ZM12.5 13L6.5 6.99998L7.9 5.59998L12.5 10.175L17.1 5.59998L18.5 6.99998L12.5 13Z",fill:"currentColor"})})]})}function Cc({open:e,onClose:t,fromToken:i,toToken:o}){const r=y(),{ddl:a,disableIndirectRouting:l}=Ka(),{onlySolana:s}=Zr(),d=G.useRef(null),[c,u]=G.useState(!1);return G.useEffect((()=>{const e=d.current,t=new ResizeObserver((()=>{e&&u(e.scrollHeight!==e.offsetHeight)})),n=de((()=>{if(!e)return;const t=e.scrollTop+e.clientHeight<e.scrollHeight-2;u(t)}),50);return e&&(u(e.scrollHeight!==e.clientHeight),t.observe(e),e.addEventListener("scroll",n)),()=>{e&&(t.unobserve(e),e.removeEventListener("scroll",n))}}),[null==d?void 0:d.current]),Gt.jsx(oc,{open:e,onClose:t,id:"swap-settings",title:Gt.jsx(n,{id:"Tz0i8g",message:"Settings"}),children:Gt.jsxs(x,{sx:{px:20,pb:34,overflowY:"auto"},ref:d,children:[Gt.jsx(bc,{fromToken:i,toToken:o}),!s&&Gt.jsxs(x,{sx:{mt:24,pt:14,borderTop:`solid 1px ${r.palette.border.main}`},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",fontWeight:600},children:[Gt.jsx(n,{id:"zSMRJ/",message:"Transaction Deadline"}),Gt.jsx(fc,{title:Gt.jsx(n,{id:"wmCrk7",message:"You may modify the transaction deadline, the maximum time allowed for a trade to be processed on-chain. However, please note that this may lead to your trade executing at a subpar price, as the market price may change during that time."}),ml:7})]}),Gt.jsxs(x,{sx:{mt:16,display:"flex",alignItems:"center",gap:8,typography:"body2"},children:[Gt.jsx(T,{sx:{width:80,height:34,lineHeight:1,typography:"body2","& input":{px:16,py:6}},placeholder:String(Sr),value:a,onChange:e=>{Ka.setState({ddl:e.target.value})}}),Gt.jsx(n,{id:"H9HlDe",message:"minutes"})]})]}),!s&&Gt.jsx(x,{sx:{display:"flex",flexDirection:"column",gap:12,mt:24,pt:14,borderTop:`solid 1px ${r.palette.border.main}`},children:Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[Gt.jsxs(x,{sx:{fontWeight:600},children:[Gt.jsx(n,{id:"MXQodB",message:"Disable Indirect Routing"}),Gt.jsx(fc,{title:Gt.jsx(n,{id:"Y0Knz4",message:"Checking this option means that the routing algorithm will only route to liquidity pools between the two tokens in the trading pair and will ignore routes with any intermediary tokens."}),ml:7})]}),Gt.jsx(jc,{checked:l,onChange:e=>{Ka.setState({disableIndirectRouting:e})}})]})}),Gt.jsx(wc,{show:c,onClick:()=>{var e,t;null===(e=d.current)||void 0===e||e.scrollTo({top:null===(t=d.current)||void 0===t?void 0:t.scrollHeight,behavior:"smooth"})}})]})})}function kc({onClick:e,disabled:t,plus:n}){const i=y(),o=t||n||!e;return Gt.jsx(x,{sx:{width:"100%",position:"relative"},children:Gt.jsx(x,{component:M,sx:Object.assign({width:36,height:36,borderRadius:"50%",backgroundColor:i.palette.background.input,border:`4px solid ${i.palette.background.paper}`,display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%) rotate(-90deg)",color:"text.secondary"},o?{cursor:"inherit"}:{"&:hover":{color:"text.primary"},"&:focus-visible":{"&::before":{content:'""',position:"absolute",display:"block",left:"50%",top:"50%",transform:"translate(-50%, -50%)",borderRadius:"50%",width:28,height:28,border:"solid 1px",borderColor:"text.primary"}}}),disabled:o,onClick:()=>{o||e&&e()},children:n?Gt.jsx(x,{component:Ft.Plus,sx:{width:18,height:18}}):Gt.jsx(x,{component:Ft.ArrowBack,sx:{width:18,height:18}})})})}!function(e){e.recommend="recommend",e.custom="custom"}(vc||(vc={}));const Rc=()=>{const{requests:e,updateText:t}=Sa(),n=G.useMemo((()=>{let t={};return null==e||e.forEach((([e,n])=>{var i,o;if((n===Nr.Running||n===Nr.Success)&&(null===(i=e.metadata)||void 0===i?void 0:i.logBalance)&&(!e.doneTime||Math.ceil(Date.now()/1e3)-e.doneTime<300)){const n=null===(o=e.metadata)||void 0===o?void 0:o.logBalance;t=Object.assign(Object.assign({},t),n)}})),t}),[e&&Array.from(e)]),i=G.useMemo((()=>{let t={};return null==e||e.forEach((([e,n])=>{var i,o;if(n===Nr.Success&&(null===(i=e.metadata)||void 0===i?void 0:i.logBalance)&&e.doneTime&&Math.ceil(Date.now()/1e3)-e.doneTime<300){const n=null===(o=e.metadata)||void 0===o?void 0:o.logBalance;t=Object.assign(Object.assign({},t),n)}})),t}),[e&&Array.from(e)]),o=G.useCallback(((e,n,i)=>{const o=e[n];if(!o)return!1;return!!(oe.isBigNumber(i)?i:new oe(i)).isEqualTo(o)||(t((e=>{var t;const i=Object.assign({},e.metadata);return(null===(t=null==i?void 0:i.logBalance)||void 0===t?void 0:t[n])?(delete i.logBalance[n],Object.keys(i.logBalance).length||delete i.logBalance,{brief:e.brief,spec:e.spec,metadata:i}):null})),!1)}),[t]),r=G.useCallback(((e,t)=>o(n,e,t)),[n,o]),a=G.useCallback(((e,t)=>o(i,e,t)),[i,o]);return{balanceData:n,balanceDataDone:i,isTokenLoading:r,isTokenLoadingDone:a}};function Sc({onClick:e,balance:t,decimals:i,address:o,showMaxBtn:r,canClickBalance:a,loading:l,balanceText:s}){const{palette:d}=y(),c=a&&(null==t?void 0:t.gt(0))&&e;return Gt.jsxs(x,{sx:Object.assign({typography:"body2",alignItems:"center",color:d.text.secondary,wordBreak:"break-word",textAlign:"right"},c?{"&:hover":{color:d.text.primary,cursor:"pointer"}}:{}),onClick:c?()=>e(t?t.toString():""):void 0,children:[null!=s?s:Gt.jsx(n,{id:"0QDjxt",message:"Balance:"})," ",l?Gt.jsx(O,{sx:{position:"relative",top:-2,verticalAlign:"middle"}}):Gt.jsxs(Gt.Fragment,{children:[o?Kr({input:t,decimals:Math.min(i||4,4)}):"-",r&&t&&t.gt(0)&&e&&Gt.jsx(x,{component:M,sx:{ml:6,color:(null==t?void 0:t.gt(0))?d.primary.main:d.text.disabled,cursor:o?"pointer":"unset",typography:"body2"},onClick:()=>e&&e(t?t.toString():""),children:Gt.jsx(n,{id:"CK1KXz",message:"Max"})})]})]})}const Ic=ne((function({readOnly:e,sx:t,value:n,decimals:i,onChange:o,suffix:r,suffixGap:a=0,withClear:l,onFocus:s,placeholder:d,readonlyShowSuffix:c,typography:u},p){const h=y(),m=K((()=>r||(l&&n&&o?Gt.jsx(x,{component:M,sx:{ml:5,width:18,height:18,borderRadius:"50%",backgroundColor:"border.main",display:"flex",justifyContent:"center",alignItems:"center",flexShrink:0,color:"text.secondary","&:focus-visible":{border:"solid 1px",borderColor:"text.primary"}},onClick:()=>{o&&o("")},children:Gt.jsx(x,{component:Ft.Error,sx:{width:12}})}):void 0)),[o,r,h.palette.text.primary,n,l]);return Gt.jsx(T,{fullWidth:!0,value:n,readOnly:e,placeholder:d||"0.00",onFocus:s,onChange:e=>{const t=e.target.value,n=0===t.length?"":ta(t,i);o&&o(n)},"data-testid":"number-input-wrapper",suffix:(!e||c)&&m,suffixGap:a,ref:p,sx:Object.assign({border:"none","& input":{fontSize:24,typography:u,border:"none",outline:"none",padding:0,color:"text.primary","&::placeholder":{fontSize:24,typography:u,color:"text.disabled"}}},t)})}));function Ec(){const e=y(),t=Zr((e=>e.width)),[n,i]=G.useState(null!=t?t:"undefined"==typeof window?375:document.body.clientWidth);G.useEffect((()=>{const e=()=>{i("undefined"==typeof window?375:document.body.clientWidth)};return"number"!=typeof t?(e(),window.addEventListener("resize",e)):i(t),()=>{window.removeEventListener("resize",e)}}),[t]);return{isMobile:G.useMemo((()=>"number"==typeof n&&n<e.breakpoints.values.tablet),[n,e.breakpoints.values]),isTablet:G.useMemo((()=>"number"==typeof n&&n<e.breakpoints.values.tablet),[n,e.breakpoints.values]),minDevice:G.useCallback((e=>"number"==typeof n&&n>e),[n]),maxDevice:G.useCallback((e=>"number"==typeof n&&n<e),[n])}}const Mc=[.25,.5,.75,1];function Tc({value:e,onChange:t,sx:n}){const i=y(),o="light"===i.palette.mode,{isMobile:r}=Ec();return Gt.jsx(x,{sx:Object.assign({display:"grid",gap:r?10:14,gridTemplateColumns:`repeat(${Mc.length}, 1fr)`},n),children:Mc.map((n=>{const r=n===e;return Gt.jsxs(M,{disabled:!t,sx:{typography:"h6",borderRadius:4,padding:i.spacing(4,0),width:"100%",color:"text.secondary",backgroundColor:"background.paperDarkContrast","&:disabled":{color:"text.disabled"},"&:not(:disabled)&:hover":{color:i.palette.text.primary,backgroundColor:L(i.palette.text.primary,.2)},"&.selected, &:focus":{color:"#fff",backgroundColor:o?i.palette.primary.main:L(i.palette.text.primary,.4)}},onClick:()=>{!r&&t&&t(n)},className:r?"selected":void 0,children:[100*n,"%"]},n)}))})}function Lc({token:e,onClick:t,showChainLogo:i,readonly:o,showChainName:r}){var a,l;const s=y(),d=(null==e?void 0:e.chainId)?Is.get(e.chainId):null,c=r&&!!d;return Gt.jsxs(x,{component:M,sx:{display:"flex",alignItems:"center",gap:8,color:s.palette.text.primary,typography:c?"body2":"body1",fontWeight:600,"&:focus-visible":{opacity:.5}},onClick:e=>{o||t&&t(e)},"data-testid":Mr,children:[!!(null==e?void 0:e.address)&&Gt.jsx(Ms,{url:null==e?void 0:e.logoURI,address:null!==(a=null==e?void 0:e.address)&&void 0!==a?a:"",chainId:null==e?void 0:e.chainId,noShowChain:!i,width:30,height:30,chainSize:16,logoOffset:10,marginRight:0}),Gt.jsxs(x,{children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[(null==e?void 0:e.address)?Gt.jsx(Gt.Fragment,{children:Gt.jsx(x,{children:null!==(l=null==e?void 0:e.symbol)&&void 0!==l?l:"-"})}):Gt.jsx(n,{id:"sIPJGT",message:"SELECT TOKEN"}),!o&&Gt.jsx("svg",{width:"18",height:"19",viewBox:"0 0 18 19",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:Gt.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 11.75L12 7.25H6L9 11.75Z",fill:"currentColor"})})]}),!!c&&Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",typography:"h6",color:"text.secondary"},children:[d.name,Gt.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:Gt.jsx("path",{d:"M5.6036 4.12761C5.50037 4.20906 5.3708 4.24967 5.23958 4.24169C5.10836 4.23372 4.98466 4.17773 4.89203 4.08438C4.7994 3.99103 4.74433 3.86685 4.7373 3.73549C4.73026 3.60413 4.77177 3.47477 4.8539 3.37205L5.96239 2.25211C6.46737 1.76405 7.14372 1.494 7.84575 1.5001C8.54779 1.50621 9.21934 1.78798 9.71577 2.28474C10.2122 2.78151 10.4938 3.4535 10.4999 4.156C10.506 4.85851 10.2361 5.5353 9.74839 6.04062L8.60241 7.16592C8.55441 7.22201 8.49533 7.26757 8.4289 7.29974C8.36246 7.3319 8.29009 7.34997 8.21635 7.35282C8.1426 7.35567 8.06906 7.34324 8.00034 7.3163C7.93162 7.28936 7.86921 7.2485 7.81702 7.19627C7.76483 7.14405 7.724 7.0816 7.69707 7.01284C7.67015 6.94407 7.65772 6.87048 7.66057 6.79668C7.66342 6.72289 7.68148 6.65047 7.71363 6.58399C7.74577 6.51751 7.7913 6.4584 7.84736 6.41036L8.97191 5.28506C9.25568 4.98032 9.41017 4.57725 9.40283 4.16078C9.39549 3.74431 9.22689 3.34695 8.93255 3.05242C8.63821 2.75788 8.24111 2.58917 7.82491 2.58182C7.40872 2.57447 7.00592 2.72906 6.70138 3.01302L5.6036 4.12761ZM6.34259 7.93755C6.38819 7.87582 6.44652 7.82461 6.51361 7.7874C6.58071 7.75018 6.65501 7.72783 6.73149 7.72185C6.80798 7.71586 6.88485 7.7264 6.95691 7.75273C7.02897 7.77906 7.09453 7.82058 7.14917 7.87447C7.2038 7.92836 7.24622 7.99337 7.27356 8.06509C7.3009 8.13682 7.31252 8.21358 7.30764 8.29019C7.30275 8.3668 7.28148 8.44147 7.24525 8.50913C7.20902 8.5768 7.15869 8.63589 7.09765 8.68239L5.96774 9.81305C5.45894 10.2708 4.7943 10.5163 4.11029 10.4992C3.42627 10.482 2.77479 10.2034 2.2896 9.72061C1.80441 9.23784 1.52232 8.58752 1.50127 7.90316C1.48021 7.2188 1.72179 6.55234 2.17638 6.04062L3.30629 4.93139C3.3504 4.86735 3.4079 4.81369 3.47482 4.77413C3.54174 4.73456 3.61646 4.71005 3.69379 4.70229C3.77113 4.69453 3.84922 4.70371 3.92266 4.72919C3.99609 4.75466 4.0631 4.79583 4.11904 4.84983C4.17497 4.90384 4.21849 4.96937 4.24657 5.0419C4.27464 5.11442 4.28661 5.19219 4.28163 5.2698C4.27665 5.34742 4.25484 5.42302 4.21773 5.49135C4.18062 5.55969 4.12908 5.61912 4.06671 5.66552L2.93144 6.79618C2.64767 7.10092 2.49318 7.50398 2.50052 7.92045C2.50786 8.33692 2.67647 8.73428 2.97081 9.02882C3.26515 9.32335 3.66224 9.49207 4.07844 9.49942C4.49463 9.50676 4.89743 9.35217 5.20197 9.06821L6.34259 7.93755ZM5.00919 7.76072C4.96119 7.81681 4.90211 7.86237 4.83567 7.89454C4.76924 7.9267 4.69687 7.94477 4.62312 7.94763C4.54937 7.95048 4.47583 7.93804 4.40711 7.9111C4.33839 7.88416 4.27598 7.8433 4.2238 7.79108C4.17161 7.73885 4.13077 7.6764 4.10385 7.60764C4.07693 7.53887 4.0645 7.46528 4.06735 7.39149C4.0702 7.31769 4.08826 7.24528 4.1204 7.17879C4.15255 7.11231 4.19808 7.0532 4.25413 7.00516L6.90487 4.35267C7.00731 4.26488 7.13909 4.21901 7.27386 4.22422C7.40863 4.22943 7.53648 4.28533 7.63185 4.38077C7.72722 4.4762 7.78309 4.60413 7.7883 4.73899C7.7935 4.87385 7.74766 5.00572 7.65993 5.10823L5.00919 7.76072Z",fill:"currentColor"})})]})]})]})}function Oc({token:e,disabled:t,style:n,balance:i,onClick:o}){const r=y(),{account:a}=Br(),l=i?Qr({input:i}):"";return Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",typography:"body2",px:6,py:5,borderRadius:8,cursor:t?"auto":"pointer",opacity:t?.5:1,"&:hover":{backgroundColor:"hover.default"}},style:n,onClick:()=>{t||o()},"data-testid":Or,children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[Gt.jsx(Ms,{token:e}),Gt.jsxs(x,{children:[Gt.jsx(x,{sx:{fontWeight:600,textAlign:"left"},children:e.symbol}),a&&Gt.jsx(x,{sx:{mt:4,textAlign:"left"},children:(null==i?void 0:i.gte(0))?l:Gt.jsx(x,{component:Ft.Loading,width:18,sx:{"& path":{fill:r.palette.text.disabled},animation:"loadingRotate 1.1s infinite linear","@keyframes loadingRotate":{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(359deg)"}}}})})]})]}),Gt.jsx(x,{sx:{color:"text.secondary",textAlign:"right"},children:e.name})]})}function Wc({chain:e,active:t,onClick:i}){return Gt.jsx(W,{title:e.name,placement:"top",onlyHover:!0,children:Gt.jsxs(x,{sx:Object.assign({display:"flex",alignItems:"center",p:8,borderRadius:8,cursor:"pointer"},t?{backgroundColor:"secondary.main",color:"secondary.contrastText"}:{border:"1px solid",borderColor:"border.main","&:hover":{backgroundColor:"hover.default"}}),onClick:i,children:[Gt.jsx(x,{component:e.logo,sx:{width:24,height:24}}),t?Gt.jsxs(x,{sx:{ml:8},children:[Gt.jsx(n,{id:"Fdp03t",message:"on"}),` ${e.name}`]}):""]})},e.chainId)}function Vc(e){try{return new Te(e),!0}catch(e){return!1}}function Ac(e){if(e.length<=10)return e;try{return new Te(e),`${e.slice(0,4)}...${e.slice(-4)}`}catch(t){return`${e.slice(0,6)}...${e.slice(-4)}`}}function Fc(e,t,n="address"){return`https://${yr[e]}${t?`/${n}/${t}`:""}`}function Zc(){return Gt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between"},children:[Gt.jsx(V,{variant:"circular",width:32,sx:{mt:8}}),Gt.jsxs(x,{sx:{ml:8,flex:"1 0 auto"},children:[Gt.jsx(V,{sx:{borderRadius:4},height:24}),Gt.jsx(V,{sx:{mt:4,borderRadius:4},height:19,width:137})]})]})}function Pc({chainId:e,value:t,onChange:n,occupiedAddrs:o,occupiedChainId:r,hiddenAddrs:a,showAddrs:l,visible:s,side:d,defaultLoadBalance:c,multiple:u,searchPlaceholder:p,searchOtherAddress:h,sx:m}){const{chainList:f,selectChainId:g,setSelectChainId:y}=function(e){const{chainId:t}=Br(),n=he(Da),{crossChain:i,onlyChainId:o}=Zr(),r=K((()=>{const t=new Set;return n.forEach((n=>{n.side&&e&&n.side!==e||t.add(n.chainId)})),t}),[n,e]),a=K((()=>{if(!i||o)return[];const e=new Map;let n;return Is.forEach(((i,o)=>{if(r.has(i.chainId)){if(i.mainnet){if(t!==i.chainId)return;n=i.mainnet}e.set(o,Object.assign({},i))}})),void 0!==n&&e.delete(n),Array.from(e.values())}),[t,n,i,o]),l=K((()=>!a.length||t&&r.has(t)?t:a[0].chainId),[t,r]),[s,d]=_(l);J((()=>{void 0===s&&d(l)}),[l]);const c=K((()=>null!=s?s:l),[s,l]);return{chainList:a,selectChainId:c,setSelectChainId:d}}(d),{showTokenList:v,filter:b,setFilter:j,onSelectToken:w,popularTokenList:C,tokenInfoMap:k}=fl({value:t,onChange:n,occupiedAddrs:o,occupiedChainId:r,hiddenAddrs:a,showAddrs:l,side:d,chainId:null!=e?e:g,visible:s,defaultLoadBalance:c,multiple:u}),R=te(null),[S,I]=_(0);J((()=>{if(s&&t)if(Array.isArray(t)){const[e]=t;e&&e.chainId!==g&&y(e.chainId)}else y(t.chainId)}),[t,s]),J((()=>{let e;return s&&(e=window.setTimeout((()=>{R.current&&I(R.current.offsetHeight-16)}),300)),()=>clearTimeout(e)}),[R,s,g]);const E=we({queryKey:["token-picker-searchOtherAddress",b],queryFn:()=>h?h(b):null,enabled:Vc(b)&&!!h}),M=Q((({index:e,style:n})=>{var i;const o=v[e];if(!o)return null;let r=!1;return t&&(r=Array.isArray(t)?t.some((e=>e.address===o.address&&e.chainId===o.chainId)):t.address===o.address&&t.chainId===o.chainId),Gt.jsx(Oc,{token:o,disabled:r,style:n,onClick:()=>w(o),balance:null===(i=k.get(`${o.chainId}-${o.address}`))||void 0===i?void 0:i.balance},o.address+o.chainId)}),[v,C,t]);return Gt.jsxs(x,{sx:Object.assign({display:"flex",flexDirection:"column",px:20,flex:1,overflow:"hidden"},m),children:[Gt.jsx(A,{fullWidth:!0,height:48,value:b,onChange:e=>j(e.target.value),clearValue:()=>j(""),placeholder:null!=p?p:i._({id:"72/M0o",message:"Enter the token symbol or address"}),sx:{mb:16}}),void 0===e&&f.length?Gt.jsx(x,{sx:{position:"relative",display:"flex",gap:8,flexWrap:"wrap",pb:32,"&::after":{content:'""',position:"absolute",bottom:16,left:0,right:0,height:"1px",backgroundColor:"border.main"}},children:f.map((e=>Gt.jsx(Wc,{chain:e,active:e.chainId===g,onClick:()=>{y(e.chainId)}},e.chainId)))}):"",Gt.jsx(x,{sx:{pb:16,flex:1,minHeight:64},ref:R,children:v.length?Gt.jsx(yt,{height:S,itemCount:v.length,itemSize:52,width:"100%",className:"token-list",children:M}):Gt.jsxs(x,{sx:{height:S,overflowY:"auto"},children:[E.isLoading?Gt.jsx(Zc,{}):"",E.data?E.data:""]})})]})}function Bc({open:e,title:t,value:i,onClose:o,occupiedAddrs:r,hiddenAddrs:a,occupiedChainId:l,onTokenChange:s,side:d,defaultLoadBalance:c,multiple:u,searchPlaceholder:p,searchOtherAddress:h,chainId:m,modal:f}){const{height:g}=Zr(),{isMobile:x}=Ec();return Gt.jsx(oc,{height:f?"80vh":g,open:e,onClose:o,title:null!=t?t:Gt.jsx(n,{id:"T0Y2+3",message:"Select a token"}),id:"select-token",testId:Lr,modal:f,children:Gt.jsx(Pc,{value:i,visible:e,onChange:s,occupiedAddrs:r,occupiedChainId:l,hiddenAddrs:a,side:d,defaultLoadBalance:c,multiple:u,searchPlaceholder:p,searchOtherAddress:h,chainId:m,sx:f?{width:x?"100%":420,borderRadius:16}:void 0})})}function Nc(){return Gt.jsx(x,{sx:{position:"relative",height:4},children:Gt.jsx(x,{sx:{width:44,height:44,borderRadius:22,backgroundColor:"background.input",borderWidth:4,borderColor:"background.paper",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%,-50%) rotate(90deg)",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:Gt.jsx(x,{component:Ft.Plus})})})}function Uc({sx:e,inputSx:t,amt:i,token:o,readOnly:r,showMaxBtn:a,canClickBalance:l,onMaxClick:s,fiatPriceTxt:d,occupiedAddrs:c,occupiedChainId:u,onInputFocus:p,onTokenClick:h,onInputChange:m,onTokenChange:f,side:g,showChainLogo:v,showChainName:j,defaultLoadBalance:w,overrideBalance:C,overrideBalanceLoading:k,balanceText:R,showPercentage:S,inputReadonlyTooltip:I,inputTypography:E,chainId:M,hideToken:T,checkLogBalance:L,notTokenPickerModal:O}){var W,V;const{account:A}=Br(),Z=y(),{gotoBuyToken:P}=Zr(),[B,N]=_(!1),{fetchTokenBalance:U}=ya(),H=we({queryKey:["token","balance-allowance",null==o?void 0:o.address],queryFn:()=>Vr(this,void 0,void 0,(function*(){if(!o)return;const e=yield U(o.address);return Object.assign(Object.assign({},o),{balance:e.amount,allowance:Jr})})),enabled:!!o}),D=null!==(V=null!=C?C:null===(W=H.data)||void 0===W?void 0:W.balance)&&void 0!==V?V:null,{isTokenLoading:Y}=Rc();let z=null!=k?k:H.isLoading;!z&&D&&(L?z=Object.entries(L).some((([e,t])=>Y(e,t))):o&&(z=Y(o.address,D)));const[X,q]=_(0),G=te("");J((()=>{i!==G.current&&q(0)}),[i]);let Q=P&&D&&i&&D.lt(i);const K=!!m||!!I;return Gt.jsxs(x,{sx:Object.assign({minHeight:K?133:"auto",padding:Z.spacing(20,20,24),borderRadius:12,overflow:"hidden",display:"flex",flexDirection:"column",justifyContent:"space-between",backgroundColor:Z.palette.background.input},e),children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:4},children:[T?Gt.jsx(x,{}):Gt.jsx(Lc,{token:o,showChainLogo:v,showChainName:j,onClick:()=>N(!0),readonly:!f}),Gt.jsx(Sc,{balance:D,balanceText:R,onClick:r||!s&&!m?void 0:e=>{s?s(e):m&&m(e),0!==X&&1!==X&&(q(1),G.current=e)},showMaxBtn:a,canClickBalance:l,address:null==o?void 0:o.address,decimals:null==o?void 0:o.decimals,loading:z})]}),K&&(r&&I?Gt.jsx(F,{title:I,arrow:!1,children:Gt.jsx(x,{children:Gt.jsx(Ic,{value:i,readOnly:!0,withClear:!0,sx:Object.assign({mt:12},t)})})}):Gt.jsx(Ic,{value:i,onFocus:p,onChange:m?e=>{m(e),q(0)}:void 0,readOnly:r,withClear:!0,suffix:Q?Gt.jsx(b,{variant:b.Variant.tag,backgroundColor:Z.palette.background.paperDarkContrast,sx:{fontSize:12},onClick:e=>{e.stopPropagation(),null==P||P({token:o,account:A})},children:Gt.jsx(n,{id:"qiOIiY",message:"Buy"})}):void 0,typography:E,sx:{mt:12}})),!r&&S?Gt.jsx(Tc,{sx:{mt:16},value:X,onChange:D&&void 0!==(null==o?void 0:o.decimals)?e=>{if(D&&(null==o?void 0:o.decimals))if(q(e),1===e){const e=D.toString();s?s(e):m&&m(e),G.current=e}else if(m){const t=D.multipliedBy(e).dp(o.decimals).toString();m(t),G.current=t}}:void 0}):"",void 0!==d?Gt.jsx(x,{sx:{mt:S?9:0,typography:"h6",color:Z.palette.text.secondary},children:d}):"",Gt.jsx(Bc,{value:o,open:B,side:g,chainId:M,occupiedAddrs:c,occupiedChainId:u,defaultLoadBalance:w,onClose:()=>{N(!1),h&&h()},onTokenChange:(e,t)=>{N(!1),setTimeout((()=>{!Array.isArray(e)&&f&&f(e,t)}),tc)},modal:!O})]})}function Hc({toToken:e,fromToken:t,priceStatus:i,pricePerToToken:o,pricePerFromToken:r}){const[a,l]=_("-"),[s,d]=_(null),[c,u]=_("-"),[p,h]=_(null);J((()=>{l(null==t?void 0:t.symbol),u(null==e?void 0:e.symbol),d(o),h(r)}),[t,e,o,r]);const m=Q((()=>{l(c),u(a),d(p),h(s)}),[a,s,c,p]);return Gt.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center"},children:{[Oa.Initial]:"-",[Oa.Loading]:Gt.jsxs(Gt.Fragment,{children:[Gt.jsx(O,{sx:{mr:5}}),Gt.jsx(n,{id:"JdNn1Y",message:"Fetching best price..."})]}),[Oa.Failed]:Gt.jsxs(Gt.Fragment,{children:[Gt.jsx(x,{component:Ft.Warn,sx:{width:15,mr:5,color:"warning.main"}}),Gt.jsx(n,{id:"NVAuTg",message:"Quote not available"})]}),[Oa.Success]:Gt.jsxs(Gt.Fragment,{children:[Gt.jsx(x,{sx:{typography:"body2"},children:`1 ${a} = ${Qr({input:p,showDecimals:4})} ${c}`}),Gt.jsx(x,{component:M,sx:{width:18,height:18,ml:6,borderRadius:"50%",backgroundColor:"border.main",display:"flex",justifyContent:"center",alignItems:"center"},children:Gt.jsx(x,{sx:{width:16,color:"text.secondary"},onClick:m,component:Ft.Switch})})]})}[i]})}function Dc({getAutoSlippage:e,onPayTokenChange:t,onReceiveTokenChange:a}={}){var l,s;const d=y(),{isInflight:c}=Ia(),{chainId:u,account:p}=Br(),h=pe(),{defaultChainId:m,noPowerBy:f,onlyChainId:g,onlySolana:v}=Zr(),[j,w]=_(!1);K((()=>{var e;return null===(e=r[null!=u?u:m])||void 0===e?void 0:e.address}),[u,m]);const[C,k]=_(""),[R,S]=_(""),[I,E]=_(""),[T,L]=_(""),V=K((()=>ce((e=>E(e)),1e3)),[]),A=K((()=>ce((e=>L(e)),1e3)),[]),[F,Z]=_(null),[P,B]=_(null),[N,U]=_(!1),[H,D]=_(!1),{toFiatPrice:Y,fromFiatPrice:z}=La({toToken:P,fromToken:F});!function({token:e,fiatPrice:t}){K((()=>{var n;const i=null!==(n=null==e?void 0:e.decimals)&&void 0!==n?n:6,o=null!=t?new oe(500).div(t):new oe(0),r=na(o,i);return(r.lt(new oe(1).times(new oe(10).pow(i-3)))?new oe(0):r).toString(10)}),[null==e?void 0:e.decimals,t])}({token:j?P:F,fiatPrice:j?Y:z}),function({fromToken:e,toToken:t,getAutoSlippage:n}){const i=pe();J((()=>{(()=>{Vr(this,void 0,void 0,(function*(){if(!n)return;const o=n({fromToken:e,toToken:t});if(void 0!==o&&"number"!=typeof o){i(Xr(!0));try{const e=yield o;i(zr({loading:!1,value:null!=e?e:null}))}catch(e){console.error(e),i(zr({loading:!1,value:null}))}}else i(zr({loading:!1,value:null}))}))})()}),[e,t])}({fromToken:F,toToken:P,getAutoSlippage:e});const{slippage:X,slippageLoading:q}=tl({fromToken:F,toToken:P}),{isApproving:G,isGetApproveLoading:$,needApprove:ee,insufficientBalance:te,submitApprove:ne,getMaxBalance:ie}=al(F,{amount:I}),re=Q((()=>{ye(ie())}),[ie]);K((()=>!(!p||te||G||$||ee)),[p,te,G,$,ee]);const{status:ae,rawBrief:le,executeSwap:se}=Wa({toToken:P,fromToken:F,fromAmount:I,slippage:X}),{resAmount:de,priceImpact:ue,baseFeeAmount:me,additionalFeeAmount:fe,resPricePerToToken:ge,resPricePerFromToken:xe}=K((()=>{if(!le)return{resAmount:null,priceImpact:null,baseFeeAmount:null,additionalFeeAmount:null,resPricePerToToken:null,resPricePerFromToken:null};const e=new oe(le.inAmount).dividedBy(le.outAmount).toNumber(),t=new oe(le.outAmount).dividedBy(le.inAmount).toNumber();return{resAmount:le.resAmount,priceImpact:le.priceImpact,baseFeeAmount:0,additionalFeeAmount:0,resPricePerToToken:e,resPricePerFromToken:t}}),[le]),ye=Q((e=>{const t=e.toString();k(t),V(t)}),[k,V]),ve=Q((e=>{const t=e.toString();S(t),A(t)}),[S,A]),be=Q((e=>Z((n=>{var i;const o="function"==typeof e?e(n):e;return u||h(va(null!==(i=null==o?void 0:o.chainId)&&void 0!==i?i:void 0)),t&&o&&o!==n&&t(o),o}))),[h,va,t,u]),je=Q((e=>B((t=>{const n="function"==typeof e?e(t):e;return a&&n&&n!==t&&a(n),n}))),[a]);Xa({fromToken:F,toToken:P,setFromToken:be,setToToken:je,updateFromAmt:ye,updateToAmt:ve,setIsReverseRouting:w});const we=Q((()=>{ye(""),ve(""),be(P),je(F),jr("from",P),jr("to",F)}),[be,P,je,F,ye,ve]),Ce=Q(((e,t)=>{if(t)return we();ye(""),ve(""),be(e),jr("from",e)}),[we,ye,ve,be,jr]),ke=Q(((e,t)=>{if(t)return we();ye(""),ve(""),je(e),jr("to",e)}),[we,ye,ve,be,jr]),Re=Q((()=>{j&&ye(""),w(!1)}),[j,ye,h]);Q((()=>{j||ve(""),w(!0)}),[j,ve,h]);const Se=(e=>{const{defaultSlippage:t}=Ga(void 0===e),n=he(qa)||t;return K((()=>(void 0===e?Number(n):e)>5),[n,e])})(X),Ie=K((()=>ue?new oe(ue).multipliedBy(100).dp(4,oe.ROUND_DOWN).toString():null),[ue]),Ee=K((()=>{const e=j?de:I;return e&&z?new oe(z).multipliedBy(e):null}),[z,I,j,de]),Me=K((()=>{if(!Y)return null;const e=j?T:de;return e?new oe(Y).multipliedBy(e):null}),[Y,T,j,de]),Te=K((()=>Gt.jsxs(x,{sx:{display:"flex",fontWeight:600,typography:"body2",alignItems:"center",justifyContent:"center"},children:[Gt.jsx(fc,{title:Gt.jsx(n,{id:"4kY4C4",message:"Due to the market condition, market price and estimated price may have a slight difference"}),mr:8}),Gt.jsxs(x,{sx:{display:"flex"},children:[Gt.jsx(n,{id:"6+mYrD",message:"Current price impact"}),Gt.jsxs(x,{sx:{color:d.palette.error.main,ml:4},children:[Ie,"%"]})]})]})),[Ie,d.palette.error.main]),Le=K((()=>Gt.jsx(Hc,{toToken:P,fromToken:F,priceStatus:ae,pricePerToToken:ge,pricePerFromToken:xe})),[P,F,ae,ge,xe]),Oe=K((()=>!(o[u||1]||g&&g===u)),[u]),We=K((()=>!v&&!!u&&!!(null==F?void 0:F.chainId)&&(null==F?void 0:F.chainId)!==u),[u,null==F?void 0:F.chainId,v]),Ve=function({fromToken:e,toToken:t}){const n=he(Da);return K((()=>!(!e||n.some((t=>t.chainId===e.chainId&&t.address===e.address&&(!t.side||"to"===t.side))))||!(!t||n.some((e=>e.chainId===t.chainId&&e.address===t.address&&(!e.side||"from"===e.side))))),[e,t,n])}({fromToken:F,toToken:P}),Ae=K((()=>Se&&new oe(j?T:I).gt(0)&&!te&&ae===Oa.Success?Gt.jsxs(x,{sx:{textAlign:"center",mb:8},children:[Gt.jsx(x,{component:Ft.Warn,sx:{position:"relative",top:2,mr:6,width:16,height:16,color:"warning.main"}}),i._({id:"//95jS",message:"The current slippage protection coefficient set exceeds {maxSlippageWarning}%, which may result in losses.",values:{maxSlippageWarning:5}})]}):null),[Se,j,I,T,ae]),Fe=K((()=>We?Gt.jsxs(x,{sx:{textAlign:"center"},children:[Gt.jsx(x,{component:Ft.Warn,sx:{position:"relative",top:2,mr:6,width:16,height:16,color:"warning.main"}}),Gt.jsx(n,{id:"54ffaC",message:"The current network is inconsistent with the wallet - please switch in wallet"})]}):ae===Oa.Loading?Gt.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center"},children:Gt.jsxs(Gt.Fragment,{children:[Gt.jsx(O,{sx:{mr:5}}),Gt.jsx(n,{id:"JdNn1Y",message:"Fetching best price..."})]})}):Oe?Gt.jsxs(Gt.Fragment,{children:[Gt.jsx(x,{component:Ft.Warn,sx:{mr:6,width:16,color:"warning.main"}}),Gt.jsx(n,{id:"udsWDJ",message:"Unsupported network - switch to trade"})]}):C&&Ie&&new oe(Ie).gt(Cr)?Te:Gt.jsxs(Gt.Fragment,{children:[Ae,Le]})),[ae,Le,C,Te,Ie,Oe,We,Ae]),Ze=K((()=>j?new oe(R).gt(0)?Kr({input:de,decimals:null==F?void 0:F.decimals}):"-":C),[C,R,de,F,j]),Pe=K((()=>j?R:new oe(C).gt(0)?Kr({input:de,decimals:null==P?void 0:P.decimals}):"-"),[C,R,de,P,j]),Be=K((()=>{if(!p||(null==F?void 0:F.chainId)&&u!==F.chainId)return Gt.jsx(xc,{needSwitchChain:null==F?void 0:F.chainId});if(c)return Gt.jsx(b,{fullWidth:!0,isLoading:!0,disabled:!0,children:Gt.jsx(n,{id:"FRBvjQ",message:"Transaction Pending"})});if(!F||!P)return Gt.jsx(b,{fullWidth:!0,disabled:!0,"data-testid":"swap-alert-select-token-btn",children:Gt.jsx(n,{id:"KlvBGJ",message:"Select Tokens"})});if(ee)return Gt.jsx(b,{fullWidth:!0,disabled:G,onClick:()=>ne(),children:G?Gt.jsx(n,{id:"j2Uisd",message:"Approving"}):Gt.jsx(n,{id:"Z7ZXbT",message:"Approve"})});if(!new oe(j?T:I).gt(0))return Gt.jsx(b,{fullWidth:!0,disabled:!0,"data-testid":"swap-alert-enter-amount-btn",children:Gt.jsx(n,{id:"iPMIoT",message:"Enter an amount"})});if(ae===Oa.Loading)return Gt.jsx(b,{fullWidth:!0,disabled:!0,"data-testid":"swap-alert-fetch-price-btn",children:Gt.jsx(n,{id:"OauUE6",message:"Fetching Price..."})});return!de||ae===Oa.Failed?Gt.jsx(b,{fullWidth:!0,disabled:!0,children:Gt.jsx(n,{id:"NVAuTg",message:"Quote not available"})}):te?Gt.jsx(b,{fullWidth:!0,disabled:!0,"data-testid":"swap-alert-insufficient-balance-btn",children:Gt.jsx(n,{id:"znqB4T",message:"Insufficient balance"})}):Gt.jsx(b,{fullWidth:!0,onClick:()=>U(!0),"data-testid":"swap-review-btn",children:Gt.jsx(n,{id:"K/Ay/d",message:"Review Swap"})})}),[p,F,u,c,P,ee,G,j,T,I,ae,de,te,ne]),Ne=K((()=>F&&P?Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[Gt.jsx(Ms,{token:F,width:16,height:16,marginRight:6,chainId:F.chainId,noShowChain:!!g}),`${Kr({input:j?de:I,decimals:null==F?void 0:F.decimals})} ${null==F?void 0:F.symbol}`,Gt.jsx(x,{component:Ft.DoubleRight,sx:{width:12,height:12,mx:16}}),Gt.jsx(Ms,{token:P,width:16,height:16,marginRight:6,chainId:P.chainId,noShowChain:!!g}),`${Kr({input:j?T:de,decimals:null==P?void 0:P.decimals})} ${null==P?void 0:P.symbol}`]}):Gt.jsx(x,{})),[F,P,I,T,de,j,g]);return Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",typography:"caption",margin:20},children:[Gt.jsx(n,{id:"vH2C/2",message:"Swap"}),Gt.jsx(W,{open:void 0,title:Gt.jsx(n,{id:"NSCBTb",message:"The setting has been switched to swap mode"}),placement:"bottom-end",children:Gt.jsx(x,{component:M,children:Gt.jsx(x,{component:Ft.Setting,onClick:()=>D(!0),sx:{width:19,height:19,color:"text.primary",cursor:"pointer"}})})})]}),Gt.jsxs(x,{sx:{flex:1,padding:"0 16px 12px",overflowY:"auto"},children:[Gt.jsxs(x,{children:[Gt.jsx(Uc,{sx:{mb:4},token:F,side:"from",amt:Ze,defaultLoadBalance:!0,onMaxClick:re,onInputChange:ye,onInputFocus:Re,showMaxBtn:!j&&!C,occupiedAddrs:[null!==(l=null==P?void 0:P.address)&&void 0!==l?l:""],occupiedChainId:null==P?void 0:P.chainId,fiatPriceTxt:Ee?`$${Qr({input:Ee,showDecimals:1})}`:"-",onTokenChange:Ce,readOnly:j,showChainLogo:!g,showChainName:!g,notTokenPickerModal:!0}),Gt.jsx(kc,{onClick:we,disabled:Ve}),Gt.jsx(Uc,{token:P,side:"to",amt:Pe,onInputChange:ve,occupiedAddrs:[null!==(s=null==F?void 0:F.address)&&void 0!==s?s:""],occupiedChainId:null==F?void 0:F.chainId,fiatPriceTxt:Me?`$${Qr({input:Me,showDecimals:1})}(${Ie}%)`:"-",onTokenChange:ke,readOnly:!0,showChainLogo:!g,showChainName:!g,notTokenPickerModal:!0}),Gt.jsx(x,{sx:{py:12,display:"flex",typography:"body2",alignItems:"center",justifyContent:"center",flexWrap:"wrap"},children:Fe})]}),Be,f?"":Gt.jsxs(x,{sx:{mt:13,display:"flex",typography:"h6",cursor:"pointer",justifyContent:"center",alignItems:"center",color:d.palette.text.disabled},onClick:()=>window.open("https://app.dodoex.io"),children:[Gt.jsx(x,{sx:{width:18,height:18,transform:"translate(1px, 2px)","& path":{fill:d.palette.text.disabled}},component:Ft.Dodo}),Gt.jsx(n,{id:"7X+IbB",message:"Powered by DODO protocol"})]})]}),Gt.jsx(yc,{toToken:P,fromToken:F,fromAmount:j?de:I,toAmount:j?T:de,open:N,baseFeeAmount:me,priceImpact:Ie,additionalFeeAmount:fe,curToFiatPrice:Me,execute:()=>se(Ne),clearFromAmt:()=>ye(""),clearToAmt:()=>ve(""),curFromFiatPrice:Ee,onClose:()=>U(!1),loading:ae===Oa.Loading,slippage:X}),Gt.jsx(Cc,{open:H,onClose:()=>D(!1),fromToken:F,toToken:P})]})}var Yc;!function(e){e.Pool="pool",e.PoolDetail="poolDetail",e.CreatePool="createPool",e.ModifyPool="modifyPool",e.MiningList="miningList",e.MiningDetail="miningDetail",e.createPoolAMMV2="createPoolAMMV2",e.createPoolAMMV3="createPoolAMMV3"}(Yc||(Yc={}));const zc=Be(((e,t)=>({page:void 0,historyList:[],push:t=>{e((e=>{var n;const i=[...e.historyList,null!==(n=e.page)&&void 0!==n?n:{type:Yc.Pool}];return{page:t,historyList:i}}))},back:()=>{e((e=>{const t=e.historyList.length;if(!t)return"undefined"!=typeof window&&window.history&&history.back(),e;const n=[...e.historyList];return{page:n.splice(t-1,1)[0],historyList:n}}))}})));function Xc({sx:e,onClick:t}){const i=y();return Gt.jsxs(j,{onClick:()=>{t?t():zc.getState().back()},sx:ue({display:"inline-flex",alignItems:"center",cursor:"pointer","& > svg":{mr:10}},e),children:[Gt.jsx(x,{sx:{color:i.palette.text.secondary,width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",borderColor:i.palette.border.main,borderStyle:"solid",borderWidth:1,borderRadius:"50%",backgroundColor:i.palette.background.paper,mr:6},children:Gt.jsx(Ft.ArrowBack,{})}),Gt.jsx(n,{id:"CKyk7Q",message:"Go back"})]})}function qc({statuses:e,children:t,buttonProps:i}){var o;if(!e.find((e=>e.needShowTokenStatusButton))&&t)return Gt.jsx(Gt.Fragment,{children:t});const r=e.find((e=>e.insufficientBalance));if(r)return Gt.jsx(b,{fullWidth:!0,disabled:!0,...i,children:Gt.jsx(n,{id:"m6RmA/",message:"Insufficient {0} balance",values:{0:null===(o=r.token)||void 0===o?void 0:o.symbol}})});const a=e.some((e=>e.isApproving));return Gt.jsx(x,{sx:{display:"flex",alignItems:"center",gap:4},children:e.map(((e,t)=>{var o,r;let l="";return e.isApproving?l=Gt.jsx(n,{id:"j2Uisd",message:"Approving"}):(e.needReset||e.needApprove)&&(l=e.approveTitle),l?Gt.jsx(b,{fullWidth:!0,isLoading:e.isApproving,onClick:e.submitApprove,disabled:e.insufficientBalance||a,...i,children:l},null!==(r=null===(o=e.token)||void 0===o?void 0:o.symbol)&&void 0!==r?r:t):null}))})}function Gc({token:e,chainId:t,showChainLogo:i,readonly:o,showChainName:r,logoSize:a=24,chainLogoSize:l=12,side:s,occupiedToken:d,defaultLoadBalance:c,notTokenPickerModal:u,border:p,px:h=20,py:m=8,highlightDefault:f,onTokenClick:g,onTokenChange:v}){var b,j;const{onlyChainId:w}=Zr(),C=t||w,k=y(),[R,S]=G.useState(!1),I=(null==e?void 0:e.chainId)?Is.get(e.chainId):null,E=r&&!!I;return Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs(x,{component:M,sx:Object.assign(Object.assign({display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,color:k.palette.text.primary,typography:E?"body2":"body1",fontWeight:600,px:h,py:m,"&:focus-visible":{opacity:.5}},!!p&&{border:`solid 1px ${k.palette.border.main}`,borderRadius:8,"&:hover":{backgroundColor:k.palette.hover.default}}),!(!f||e)&&{backgroundColor:k.palette.primary.main,color:k.palette.primary.contrastText,"&:hover":{opacity:.8}}),onClick:()=>{o||S(!0)},"data-testid":Tr,children:[!!(null==e?void 0:e.address)&&Gt.jsx(Ms,{url:null==e?void 0:e.logoURI,address:null!==(b=null==e?void 0:e.address)&&void 0!==b?b:"",chainId:null==e?void 0:e.chainId,noShowChain:!i,width:a,height:a,chainSize:l,logoOffset:10,marginRight:0}),Gt.jsxs(x,{sx:{flex:1},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(null==e?void 0:e.address)?Gt.jsx(Gt.Fragment,{children:Gt.jsx(x,{children:null!==(j=null==e?void 0:e.symbol)&&void 0!==j?j:"-"})}):Gt.jsx(n,{id:"sIPJGT",message:"SELECT TOKEN"}),!o&&Gt.jsx(x,{component:"svg",width:18,height:18,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",sx:{flexShrink:0},children:Gt.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.58398 12.376C6.78189 12.6728 7.21811 12.6728 7.41603 12.376L10.4818 7.77735C10.7033 7.44507 10.4651 7 10.0657 7H3.93426C3.53491 7 3.29672 7.44507 3.51823 7.77735L6.58398 12.376Z",fill:"currentColor"})})]}),!!E&&Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",typography:"h6",color:"text.secondary"},children:[I.name,Gt.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:Gt.jsx("path",{d:"M5.6036 4.12761C5.50037 4.20906 5.3708 4.24967 5.23958 4.24169C5.10836 4.23372 4.98466 4.17773 4.89203 4.08438C4.7994 3.99103 4.74433 3.86685 4.7373 3.73549C4.73026 3.60413 4.77177 3.47477 4.8539 3.37205L5.96239 2.25211C6.46737 1.76405 7.14372 1.494 7.84575 1.5001C8.54779 1.50621 9.21934 1.78798 9.71577 2.28474C10.2122 2.78151 10.4938 3.4535 10.4999 4.156C10.506 4.85851 10.2361 5.5353 9.74839 6.04062L8.60241 7.16592C8.55441 7.22201 8.49533 7.26757 8.4289 7.29974C8.36246 7.3319 8.29009 7.34997 8.21635 7.35282C8.1426 7.35567 8.06906 7.34324 8.00034 7.3163C7.93162 7.28936 7.86921 7.2485 7.81702 7.19627C7.76483 7.14405 7.724 7.0816 7.69707 7.01284C7.67015 6.94407 7.65772 6.87048 7.66057 6.79668C7.66342 6.72289 7.68148 6.65047 7.71363 6.58399C7.74577 6.51751 7.7913 6.4584 7.84736 6.41036L8.97191 5.28506C9.25568 4.98032 9.41017 4.57725 9.40283 4.16078C9.39549 3.74431 9.22689 3.34695 8.93255 3.05242C8.63821 2.75788 8.24111 2.58917 7.82491 2.58182C7.40872 2.57447 7.00592 2.72906 6.70138 3.01302L5.6036 4.12761ZM6.34259 7.93755C6.38819 7.87582 6.44652 7.82461 6.51361 7.7874C6.58071 7.75018 6.65501 7.72783 6.73149 7.72185C6.80798 7.71586 6.88485 7.7264 6.95691 7.75273C7.02897 7.77906 7.09453 7.82058 7.14917 7.87447C7.2038 7.92836 7.24622 7.99337 7.27356 8.06509C7.3009 8.13682 7.31252 8.21358 7.30764 8.29019C7.30275 8.3668 7.28148 8.44147 7.24525 8.50913C7.20902 8.5768 7.15869 8.63589 7.09765 8.68239L5.96774 9.81305C5.45894 10.2708 4.7943 10.5163 4.11029 10.4992C3.42627 10.482 2.77479 10.2034 2.2896 9.72061C1.80441 9.23784 1.52232 8.58752 1.50127 7.90316C1.48021 7.2188 1.72179 6.55234 2.17638 6.04062L3.30629 4.93139C3.3504 4.86735 3.4079 4.81369 3.47482 4.77413C3.54174 4.73456 3.61646 4.71005 3.69379 4.70229C3.77113 4.69453 3.84922 4.70371 3.92266 4.72919C3.99609 4.75466 4.0631 4.79583 4.11904 4.84983C4.17497 4.90384 4.21849 4.96937 4.24657 5.0419C4.27464 5.11442 4.28661 5.19219 4.28163 5.2698C4.27665 5.34742 4.25484 5.42302 4.21773 5.49135C4.18062 5.55969 4.12908 5.61912 4.06671 5.66552L2.93144 6.79618C2.64767 7.10092 2.49318 7.50398 2.50052 7.92045C2.50786 8.33692 2.67647 8.73428 2.97081 9.02882C3.26515 9.32335 3.66224 9.49207 4.07844 9.49942C4.49463 9.50676 4.89743 9.35217 5.20197 9.06821L6.34259 7.93755ZM5.00919 7.76072C4.96119 7.81681 4.90211 7.86237 4.83567 7.89454C4.76924 7.9267 4.69687 7.94477 4.62312 7.94763C4.54937 7.95048 4.47583 7.93804 4.40711 7.9111C4.33839 7.88416 4.27598 7.8433 4.2238 7.79108C4.17161 7.73885 4.13077 7.6764 4.10385 7.60764C4.07693 7.53887 4.0645 7.46528 4.06735 7.39149C4.0702 7.31769 4.08826 7.24528 4.1204 7.17879C4.15255 7.11231 4.19808 7.0532 4.25413 7.00516L6.90487 4.35267C7.00731 4.26488 7.13909 4.21901 7.27386 4.22422C7.40863 4.22943 7.53648 4.28533 7.63185 4.38077C7.72722 4.4762 7.78309 4.60413 7.7883 4.73899C7.7935 4.87385 7.74766 5.00572 7.65993 5.10823L5.00919 7.76072Z",fill:"currentColor"})})]})]})]}),Gt.jsx(Bc,{value:e,open:R,side:s,chainId:C,occupiedAddrs:d?[d.address]:void 0,occupiedChainId:null==d?void 0:d.chainId,defaultLoadBalance:c,onClose:()=>{S(!1),g&&g()},onTokenChange:(e,t)=>{S(!1),setTimeout((()=>{!Array.isArray(e)&&v&&v(e,t)}),tc)},modal:!u})]})}const _c=G.forwardRef((function(e,t){var{sx:n}=e,i=Wr(e,["sx"]);const{isMobile:o}=Ec(),r=y();return Gt.jsx(x,{className:"widget-module-container",ref:t,sx:Object.assign(Object.assign({flex:1,overflowY:"auto"},o?{padding:0,height:"100%",width:"100%",overflowX:"hidden"}:{padding:r.spacing(28,20,40,40),height:"auto"}),n),...i})})),Jc="auto",Qc="0.1",Kc="0.5",$c="0.5";function eu(e){const t=te();return J((()=>{t.current=e})),t.current}function tu({baseToken:t,quoteToken:n,pairMintAAmount:o,pairMintBAmount:r,slippage:a,isExists:l,poolInfo:s,poolKeys:d,successBack:c,submittedBack:u}){const p=Sa(),{account:h}=Br(),m=Fs();return e(),Ce({mutationFn:()=>Vr(this,void 0,void 0,(function*(){if(!t||!n)throw new Error("token is undefined");if(!h)throw new Error("account is undefined");if(!s||!o||!r)throw new Error("poolInfo is undefined");if(!m)throw new Error("raydium is undefined");const e=new vt(new bt(o).mul(10**s.mintA.decimals).toFixed(0,bt.ROUND_DOWN)),f=new Ye(100*a*100,1e4),{execute:g}=l?yield m.cpmm.addLiquidity({poolInfo:s,poolKeys:d,inputAmount:e,slippage:f,baseIn:!0,txVersion:He.LEGACY}):yield m.cpmm.createPool({programId:ua,poolFeeAccount:pa,mintA:s.mintA,mintB:s.mintB,mintAAmount:e,mintBAmount:new vt(new bt(r).mul(10**s.mintB.decimals).toFixed(0,bt.ROUND_DOWN)),startTime:new vt(0),feeConfig:ha[0],associatedOnly:!1,ownerInfo:{useSOLBalance:!0},txVersion:Ls});return yield p.executeCustom({brief:l?i._({id:"E6MqGy",message:"Add liquidity"}):i._({id:"L37FfW",message:"Create AMM V2 Position"}),metadata:{[l?Ur.addLiquidityAMMV2Position:Ur.createAMMV2Position]:!0},handler:e=>Vr(this,void 0,void 0,(function*(){const{txId:t}=yield g({sendAndConfirm:!0});e.onSuccess(t)})),successBack:c,submittedBack:u})})),onError:e=>{console.error(e)}})}function nu({pool:e,baseAmount:t,quoteAmount:n,slippage:i}){var o,r,a,l,s,d,c,u,p,h,m,f,g,x;const{account:y}=Br(),v=Fs(),[b,j,w,C,k]=K((()=>{if(!(null==e?void 0:e.baseToken)||!e.quoteToken)return[void 0,void 0,void 0,void 0,!0];const{baseToken:i,quoteToken:o}=e,r=new vt(new Te(i.address).toBuffer()).lte(new vt(new Te(o.address).toBuffer())),[a,l]=r?[i,o]:[o,i],[s,d]=r?[t,n]:[n,t];return[a,l,s,d,r]}),[t,e,n]),R=we({queryKey:["cpmm","poolInfo",null==e?void 0:e.address],enabled:null!=(null==e?void 0:e.address),queryFn:()=>Vr(this,void 0,void 0,(function*(){if(!(null==e?void 0:e.address)||!v)return null;const{poolInfo:t,poolKeys:n,rpcData:i}=yield v.cpmm.getPoolInfoFromRpc(e.address);if(!i)return{baseReserve:0,quoteReserve:0,lpAmount:0};const[o,r]=t.mintA.address.toLowerCase()===e.baseToken.address.toLowerCase()?[e.baseToken.symbol,e.quoteToken.symbol]:[e.quoteToken.symbol,e.baseToken.symbol],a=ia(t.lpAmount,t.lpMint.decimals);return{baseReserve:ia(i.baseReserve.toNumber(),n.mintA.decimals),quoteReserve:ia(i.quoteReserve.toNumber(),n.mintB.decimals),lpAmount:a,lpMint:t.lpMint,poolKeys:Object.assign(Object.assign({},n),{mintA:Object.assign(Object.assign({},n.mintA),{symbol:o}),mintB:Object.assign(Object.assign({},n.mintB),{symbol:r})}),poolInfo:Object.assign(Object.assign({},t),{lpAmount:a.toNumber(),mintA:Object.assign(Object.assign({},t.mintA),{symbol:o}),mintB:Object.assign(Object.assign({},t.mintB),{symbol:r})}),rpcData:i}}))}),S=we({queryKey:["cpmm","lpBalance",null===(r=null===(o=R.data)||void 0===o?void 0:o.lpMint)||void 0===r?void 0:r.address],enabled:!!(y&&R.data&&(null===(a=R.data)||void 0===a?void 0:a.lpMint)&&(null===(s=null===(l=R.data)||void 0===l?void 0:l.lpMint)||void 0===s?void 0:s.address)&&(null===(c=null===(d=R.data)||void 0===d?void 0:d.lpMint)||void 0===c?void 0:c.decimals)),queryFn:()=>Vr(this,void 0,void 0,(function*(){var e,t,n,i,o;if(!(y&&R.data&&(null===(e=R.data)||void 0===e?void 0:e.lpMint)&&(null===(n=null===(t=R.data)||void 0===t?void 0:t.lpMint)||void 0===n?void 0:n.address)&&(null===(o=null===(i=R.data)||void 0===i?void 0:i.lpMint)||void 0===o?void 0:o.decimals)&&v))return null;yield v.account.fetchWalletTokenAccounts();const r=R.data.lpMint.address,a=v.account.tokenAccounts.find((e=>e.mint.toBase58()===r));if(!a)throw new Error(`you do not have balance in pool: ${r}`);return ia(a.amount.toNumber(),R.data.lpMint.decimals)}))}),I=we({queryKey:["cpmm","pairAmount",w,null===(u=R.data)||void 0===u?void 0:u.poolInfo],enabled:!(!R.data||!(null===(p=R.data)||void 0===p?void 0:p.poolInfo)||!w),queryFn:()=>Vr(this,void 0,void 0,(function*(){var e;if(!(R.data&&(null===(e=R.data)||void 0===e?void 0:e.poolInfo)&&w&&v))return null;const t=R.data.poolInfo,n=yield v.cpmm.computePairAmount({baseReserve:R.data.rpcData.baseReserve,quoteReserve:R.data.rpcData.quoteReserve,poolInfo:t,amount:w,slippage:new Ye(100*i*100,1e4),baseIn:!0,epochInfo:yield v.fetchEpochInfo()});return{pairMintAAmount:w,pairMintBAmount:ia(n.anotherAmount.amount.toString(),t.mintB.decimals).toString(),liquidityMinted:ia(n.liquidity.toString(),t.lpMint.decimals)}}))}),[E,M,T,L]=K((()=>{if(!R.data||!S.data)return[void 0,void 0,void 0,void 0];const{baseReserve:e,quoteReserve:t,lpAmount:n}=R.data,i=S.data,o=i.div(n),r=i.multipliedBy(e).div(n),a=i.multipliedBy(t).div(n);return[i,o,r,a]}),[R.data,S.data]),O=G.useMemo((()=>R.isFetched&&null!=R.data),[R.isFetched,R.data]),[W,V]=G.useMemo((()=>{var e,i;if(O){if(null!=(null===(i=null===(e=R.data)||void 0===e?void 0:e.poolInfo)||void 0===i?void 0:i.price)){const e=new oe(R.data.poolInfo.price);return[e,new oe(1).div(e)]}return[void 0,void 0]}return t&&n?[new oe(n).div(t),new oe(t).div(n)]:[void 0,void 0]}),[t,O,null===(m=null===(h=R.data)||void 0===h?void 0:h.poolInfo)||void 0===m?void 0:m.price,n]);return{isFront:k,poolInfoQuery:R,lpBalanceQuery:S,lpBalance:E,lpBalancePercentage:M,lpToAmountA:T,lpToAmountB:L,price:W,invertedPrice:V,liquidityMinted:null===(f=I.data)||void 0===f?void 0:f.liquidityMinted,pairMintAAmount:null===(g=I.data)||void 0===g?void 0:g.pairMintAAmount,pairMintBAmount:null===(x=I.data)||void 0===x?void 0:x.pairMintBAmount,isExists:O}}const iu="DODO_WIDGET_POOL_LIST_TAB",ou="DODO_WIDGET_POOLS_LIST_FILTER_CHAIN";var ru;!function(e){e.addLiquidity="add-liquidity",e.myLiquidity="my-liquidity",e.myCreated="my-created"}(ru||(ru={}));var au=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],i=0;i<e.rangeCount;i++)n.push(e.getRangeAt(i));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||n.forEach((function(t){e.addRange(t)})),t&&t.focus()}},lu={"text/plain":"Text","text/html":"Url",default:"Text"};var su=function(e,t){var n,i,o,r,a,l,s=!1;t||(t={}),n=t.debug||!1;try{if(o=au(),r=document.createRange(),a=document.getSelection(),(l=document.createElement("span")).textContent=e,l.ariaHidden="true",l.style.all="unset",l.style.position="fixed",l.style.top=0,l.style.clip="rect(0, 0, 0, 0)",l.style.whiteSpace="pre",l.style.webkitUserSelect="text",l.style.MozUserSelect="text",l.style.msUserSelect="text",l.style.userSelect="text",l.addEventListener("copy",(function(i){if(i.stopPropagation(),t.format)if(i.preventDefault(),void 0===i.clipboardData){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var o=lu[t.format]||lu.default;window.clipboardData.setData(o,e)}else i.clipboardData.clearData(),i.clipboardData.setData(t.format,e);t.onCopy&&(i.preventDefault(),t.onCopy(i.clipboardData))})),document.body.appendChild(l),r.selectNodeContents(l),a.addRange(r),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");s=!0}catch(o){n&&console.error("unable to copy using execCommand: ",o),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),s=!0}catch(o){n&&console.error("unable to copy using clipboardData: ",o),n&&console.error("falling back to prompt"),i=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(i,e)}}finally{a&&("function"==typeof a.removeRange?a.removeRange(r):a.removeAllRanges()),l&&document.body.removeChild(l),o()}return s},du=Vt(su);function cu({copyText:e,size:t,sx:n,componentProps:o,onClick:r,children:a}){var l;const[s,d]=G.useState(!1);return Gt.jsx(F,{title:i._({id:"6V3Ea3",message:"Copied"}),open:s,onClose:()=>d(!1),arrow:!1,children:Gt.jsxs(x,{...o,component:null!==(l=null==o?void 0:o.component)&&void 0!==l?l:M,onClick:t=>{if(null==o?void 0:o.onClick)return o.onClick(t);t.stopPropagation(),e&&(du(e),d(!0)),r&&r()},sx:Object.assign({cursor:"pointer"},null==o?void 0:o.sx),children:[Gt.jsx(x,{component:Ft.Copy,sx:Object.assign({width:t||"auto",height:t||"auto"},n)}),a]})})}function uu({truncate:e,address:t,disabledAddress:n,sx:i,handleOpen:o,addressHoverColor:r,addressHoverShowIcon:a}){return n?Gt.jsx(x,{children:e?Ac(t):t}):Gt.jsx(Z,{lineSx:{bottom:-1},lineColor:null!=r?r:(null==i?void 0:i.color)||"",hoverSx:{color:"addressHoverColor","& svg":{display:"inline-block"}},className:"truncate-address-link",children:Gt.jsxs(x,{onClick:e=>{null==o||o(e,"address")},sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[e?Ac(t):t,a?Gt.jsx(x,{component:Ft.ArrowRight,sx:{display:"none",width:14,height:14}}):""]})})}function pu({address:e,truncate:t,showCopy:n,size:i="medium",iconSize:o,iconSpace:r,sx:a,iconDarkHover:l,disabledAddress:s,addressHoverColor:d,addressHoverShowIcon:c,customChainId:u,handleOpen:p,onAddressClick:h}){const m=y(),f="medium"===i,g=l?P:j,v=e=>{let t=e?12:8;return r&&(t=r),l&&(t-=3),t},b="big"===i?"h5":f?"body1":"body2",{chainId:w}=Br(),C=null!=u?u:w,k=(t,n)=>{p?p(t,n):C&&(t.stopPropagation(),window.open(Fc(C,e,"address")))};return Gt.jsxs(x,{sx:Object.assign({display:"flex",alignItems:"center",typography:b,color:m.palette.text.primary,lineHeight:"normal"},a||{}),children:[Gt.jsx(uu,{truncate:t,address:e,disabledAddress:s,sx:a,typography:b,handleOpen:null!=h?h:k,addressHoverColor:d,addressHoverShowIcon:c}),Gt.jsx(g,{sx:{display:"inline-flex",ml:v(f),cursor:"pointer"},onClick:e=>{k(e,"icon")},children:Gt.jsx(x,{component:Ft.ArrowTopRightBorder,sx:{width:o||(f?16:14),height:o||(f?16:14)}})}),n?Gt.jsx(cu,{size:o||(f?16:14),copyText:e,componentProps:{component:g,sx:{ml:v(f)}}}):null]})}function hu(e){var{sx:t,label:n,children:i}=e,o=Wr(e,["sx","label","children"]);return Gt.jsxs(x,{sx:Object.assign({display:"flex",justifyContent:"space-between"},t),...o,children:[Gt.jsx(x,{children:n}),Gt.jsx(x,{sx:{textAlign:"right",fontWeight:600},children:i})]})}function mu({tokens:e,width:t=24,height:n=24,gap:i=-4,cross:o,mr:r,chainId:a,showChainLogo:l,sx:s}){var d;const c=y(),{onlyChainId:u}=Zr(),p=l&&!u;if(!e||e.length<=0)return null;const h=t/2;return Gt.jsxs(x,{sx:Object.assign({display:"inline-flex",alignItems:"center",mr:r,position:"relative",zIndex:0},s),children:[e.map(((e,n)=>Gt.jsx(x,{sx:{display:"inline-flex",width:t,height:t,ml:n>0?i:0,borderRadius:"50%",backgroundColor:c.palette.background.default},children:"object"==typeof e?Gt.jsx(Ms,{address:e.address,width:t,height:t,chainId:a,url:e.logoURI,cross:o,noShowChain:!0,noBorder:!0,marginRight:0}):Gt.jsx(x,{component:"img",height:t,src:e})},n))),p&&Is.has(a)?Gt.jsx(x,{component:null===(d=Is.get(a))||void 0===d?void 0:d.logo,sx:{position:"absolute",bottom:0,right:0,zIndex:e.length+1,transform:"translateX(50%)",width:h,height:h}}):""]})}function fu({baseToken:e,quoteToken:t,midPrice:n,loading:i,disabled:o}){const r=y(),[a,l]=_(!1),s=a?null==t?void 0:t.symbol:null==e?void 0:e.symbol,d=a&&n?new oe(1).div(n):n,c=a?null==e?void 0:e.symbol:null==t?void 0:t.symbol;return Gt.jsxs(E,{sx:{display:"flex",alignItems:"center",fontWeight:600,overflow:"hidden"},loading:i,loadingProps:{width:50},children:[e&&t?Gt.jsx(W,{title:`1 ${s} = ${d?Qr({input:d}):""} ${c}`,children:n?Gt.jsx(x,{sx:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:`1 ${s} = ${d?Qr({input:d}):""} ${c}`}):Gt.jsxs(x,{children:[`1 ${s} = `,Gt.jsx(E,{loading:i,loadingProps:{width:30},component:"span",sx:{display:"inline-block"},children:"-"}),` ${c}`]})}):"-",Gt.jsx(x,{sx:Object.assign({display:"flex",alignItems:"center",justifyContent:"center",ml:4,width:18,height:18,backgroundColor:"background.paperDarkContrast",borderRadius:"50%"},!o&&{cursor:"pointer","&:hover":{backgroundColor:L(r.palette.text.primary,.04)}}),onClick:()=>{o||l((e=>!e))},children:Gt.jsx(x,{component:Ft.Switch,sx:{width:18,height:18}})})]})}function gu({baseToken:e,quoteToken:t,loading:i,midPrice:o,lpBalancePercentage:r,sx:a}){const l=y(),s=!e||!t;return Gt.jsxs(x,{sx:Object.assign({mt:20,border:"solid 1px",borderColor:"border.main",borderRadius:8},a),children:[Gt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",px:12,py:4,height:36,typography:"body2"},children:[Gt.jsx(x,{sx:{color:"text.secondary",whiteSpace:"nowrap"},children:Gt.jsx(n,{id:"kNeEXg",message:"Current Price"})}),Gt.jsx(fu,{baseToken:e,quoteToken:t,loading:i,disabled:s,midPrice:o})]}),Gt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",px:12,py:4,minHeight:36,typography:"body2",borderStyle:"solid",borderWidth:l.spacing(1,0,0),borderColor:"border.main"},children:[Gt.jsx(x,{sx:{display:"flex",alignItems:"center",color:"text.secondary",whiteSpace:"nowrap"},children:Gt.jsx(n,{id:"SbBMxj",message:"Share of pool"})}),Gt.jsx(x,{sx:{display:"flex",alignItems:"center",fontWeight:600,textAlign:"right",ml:8,overflow:"hidden"},children:Gt.jsx(E,{sx:{display:"flex",alignItems:"center",fontWeight:600,overflow:"hidden"},loading:i,loadingProps:{width:50},children:r?`${da({input:r,roundingMode:oe.ROUND_DOWN})}`:"-%"})})]})]})}function xu({open:e,onClose:t,slippage:i,baseToken:o,quoteToken:r,pairMintAAmount:a,pairMintBAmount:l,lpAmount:s,feeRate:d,price:c,lpBalancePercentage:u,pairAddress:p,createMutation:h}){const m=y(),{isMobile:f}=Ec();return Gt.jsx(oc,{modal:!0,open:e,onClose:t,title:s?Gt.jsx(n,{id:"AeZIvT",message:"You will receive"}):Gt.jsx(n,{id:"aM1tos",message:"You are creating a pool"}),children:Gt.jsxs(x,{sx:{px:20,py:24,borderTopWidth:1,width:f?"100%":420},children:[Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column",alignItems:"center"},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,typography:"h3"},children:[Gt.jsx(mu,{width:24,height:24,tokens:o&&r?[o,r]:[]}),s?Kr({input:s,decimals:null==o?void 0:o.decimals}):""]}),Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,fontWeight:600},children:[Gt.jsx(n,{id:"syToc5",message:"{0}/{1} Pool Tokens",values:{0:null==o?void 0:o.symbol,1:null==r?void 0:r.symbol}}),Gt.jsx(x,{sx:{px:4,py:2,fontSize:10,lineHeight:1,backgroundColor:L(m.palette.purple.main,.1),color:m.palette.purple.main,borderRadius:4},children:Gt.jsx(n,{id:"rbsyJM",message:"AMM V2"})})]})]}),Gt.jsx(x,{sx:{mt:16,typography:"h6",color:"text.secondary",textAlign:"center"},children:Gt.jsx(n,{id:"rQ9c+8",message:"Output is estimated. If the price changes by more than {0} your transaction will revert.",values:{0:da({input:i})}})}),Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:12,mt:20,p:20,typography:"body2",borderRadius:12,backgroundColor:m.palette.background.paperContrast},children:[Gt.jsx(hu,{label:Gt.jsx(n,{id:"YG004A",message:"{0} deposited",values:{0:null==o?void 0:o.symbol}}),children:Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",lineHeight:1},children:[Gt.jsx(Ms,{width:18,height:18,marginRight:4,token:o}),Kr({input:a,decimals:null==o?void 0:o.decimals})]})}),Gt.jsx(hu,{label:Gt.jsx(n,{id:"YG004A",message:"{0} deposited",values:{0:null==r?void 0:r.symbol}}),children:Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[Gt.jsx(Ms,{width:18,height:18,marginRight:4,token:r}),Kr({input:l,decimals:null==r?void 0:r.decimals})]})}),Gt.jsx(hu,{label:Gt.jsx(n,{id:"EU3wU4",message:"Fee tier"}),children:null!=d?Number(d)/1e4+"%":"-"}),Gt.jsx(hu,{label:Gt.jsx(n,{id:"fqDzSu",message:"Rate"}),children:Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[Gt.jsx(Ms,{width:18,height:18,marginRight:4,token:o}),Gt.jsx(fu,{baseToken:o,quoteToken:r,midPrice:c})]})}),Gt.jsx(hu,{label:Gt.jsx(n,{id:"SbBMxj",message:"Share of pool"}),children:u?`${da({input:u})}`:"-%"}),Gt.jsx(hu,{label:Gt.jsx(n,{id:"ESQO1L",message:"Pool address"}),children:Gt.jsx(pu,{showCopy:!1,address:null!=p?p:"",customChainId:null==o?void 0:o.chainId,truncate:!0,iconSpace:4,sx:{typography:"body2"}})})]}),Gt.jsx(b,{fullWidth:!0,size:b.Size.big,sx:{mt:20},isLoading:h.isPending,onClick:()=>{h.mutate()},children:h.isPending?Gt.jsx(n,{id:"pwUZo2",message:"Confirming..."}):Gt.jsx(n,{id:"7VpPHA",message:"Confirm"})})]})})}function yu({title:e,disabled:t,children:n}){return Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:12,opacity:t?.3:void 0},children:[Gt.jsx(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",fontWeight:600},children:e}),n]})}function vu({disabled:e,feeIndex:t,onChange:i,feeList:o}){const r=y(),[a,l]=G.useState(!1),{isMobile:s}=Ec(),d=e,c=o[t];return Gt.jsxs(x,{sx:{opacity:e?.3:void 0,fontWeight:600},children:[Gt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",px:20,py:12,borderWidth:1,borderRadius:12},children:[Gt.jsx(n,{id:"tMMG40",message:"{0}% fee tier",values:{0:c?new oe(c.tradeFeeRate).div(1e4).toString():"-"}}),Gt.jsx(M,{sx:{px:16,py:7,border:`solid 1px ${r.palette.text.primary}`,borderRadius:8,fontWeight:600,color:"text.primary",cursor:d?"default":"pointer"},disabled:d,onClick:()=>{d||l((e=>!e))},children:a?Gt.jsx(n,{id:"vLyv1R",message:"Hide"}):Gt.jsx(n,{id:"ePK91l",message:"Edit"})})]}),a&&Gt.jsx(Gt.Fragment,{children:Gt.jsx(x,{sx:Object.assign({mt:12},s?{display:"grid",gap:8,gridTemplateColumns:"repeat(2, 1fr)"}:{display:"flex",alignItems:"center",gap:8,"& > label":{flex:1}}),children:o.map(((e,n)=>{const o=t===n;return Gt.jsxs(x,{component:"label",sx:Object.assign({display:"flex",alignItems:"center",justifyContent:"space-between",px:20,py:12,borderWidth:1,borderRadius:12,cursor:"pointer"},o&&{borderColor:r.palette.primary.main}),children:[e.tradeFeeRate/1e4,"%",Gt.jsx(B,{size:18,checked:o,onChange:(e,t)=>{t&&i(n)}})]},e.id)}))})})]})}function bu({chainId:e,address:t,showName:n,size:i,offset:o,rightContent:r}){const a=Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:o},children:[Gt.jsx(Ms,{chainId:e,address:t,width:i,height:i,noShowChain:!0,marginRight:0}),n]});return r?Gt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a,r]}):a}function ju({isExists:e,poolInfo:t,poolInfoLoading:i,lpBalanceLoading:r,lpBalance:a,lpBalancePercentage:l,lpToAmountA:s,lpToAmountB:d,sx:c}){var u,p;const h=l?`${da({input:l,roundingMode:oe.ROUND_DOWN})}`:void 0;return e&&t?Gt.jsxs(x,{sx:Object.assign({px:20,py:12,borderWidth:1,borderRadius:8},c),children:[Gt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:Gt.jsx(n,{id:"YHc3B+",message:"My Liquidity"})}),Gt.jsxs(x,{sx:{mt:12,display:"flex",alignItems:"center",flexWrap:"wrap"},children:[Gt.jsx(mu,{width:18,height:18,tokens:[t.mintA,t.mintB],mr:4}),Gt.jsx(E,{loading:r,loadingProps:{width:50},sx:{mr:4},children:Kr({input:a,decimals:t.lpMint.decimals})}),`${t.mintA.symbol}/${t.mintB.symbol} LP`,Gt.jsx(W,{title:Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:10,typography:"body2",color:"text.primary"},children:[Gt.jsx(bu,{address:t.mintA.address,chainId:t.mintA.chainId,showName:null!==(u=t.mintA.symbol)&&void 0!==u?u:"",size:14,offset:4,rightContent:Gt.jsx(E,{loading:i,loadingProps:{width:50},children:Kr({input:s,decimals:t.mintA.decimals})})}),Gt.jsx(bu,{address:t.mintB.address,chainId:t.mintB.chainId,showName:null!==(p=t.mintB.symbol)&&void 0!==p?p:"",size:14,offset:4,rightContent:Gt.jsx(E,{loading:i,loadingProps:{width:50},children:Kr({input:d,decimals:t.mintB.decimals})})}),Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[Gt.jsx(n,{id:"c4miqE",message:"Pool share"}),Gt.jsx(E,{loading:i,loadingProps:{width:50},children:h})]})]}),sx:{padding:20,width:256},children:Gt.jsx(j,{component:Ft.DetailBorder,sx:{ml:4,width:16,height:16,cursor:"pointer"}})}),Gt.jsx(x,{component:"a",target:"_blank",rel:"noopener noreferrer",href:Fc(o.SOON_TESTNET,t.lpMint.address,"address"),sx:{ml:4,display:"inline-flex",height:16},children:Gt.jsx(j,{component:Ft.ArrowTopRightBorder,sx:{width:16,height:16}})})]})]}):null}function wu({active:e,sx:t,onClick:i}){const o=y(),r="light"===o.palette.mode;let a=o.palette.primary.main,l="transparent";return e&&(a=o.palette.primary.contrastText,l=L(o.palette.primary.main,.8)),Gt.jsx(x,{component:M,sx:Object.assign({typography:"body2",p:e?o.spacing(8,20,9):o.spacing(7,19,8),minWidth:79,border:e?void 0:`1px solid ${a}`,color:a,backgroundColor:l,borderRadius:8,fontWeight:600,"&:hover":{color:e?o.palette.primary.contrastText:o.palette.primary.main,backgroundColor:e?o.palette.primary.main:r?"rgba(26, 26, 27, 0.04)":"rgba(241, 249, 2, 0.08)"}},t),onClick:i,children:Gt.jsx(n,{id:"R9Khdg",message:"Auto"})})}function Cu({sx:e,disabled:t,slippage:i,onChangeSlippage:o}){const r=y(),a=i===Jc,[l,s]=_(a?"":new oe(i).times(100).toNumber());return Gt.jsx(W,{disabled:t,onlyClick:!0,title:Gt.jsxs(x,{sx:{backgroundColor:r.palette.background.paper,padding:r.spacing(16,20),borderRadius:16,width:375,maxWidth:"90vw",boxSizing:"border-box"},children:[Gt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",typography:"body2",color:"text.primary"},children:[Gt.jsx("span",{children:Gt.jsx(n,{id:"lqTDfd",message:"Slippage Tolerance"})}),Gt.jsxs("span",{children:[a?Kc:i&&new oe(i).times(100).toNumber(),"%"]})]}),Gt.jsxs(x,{sx:{mt:16,display:"flex",alignItems:"center",margin:r.spacing(16,0,0,0)},children:[Gt.jsx(wu,{sx:{borderRadius:8,whiteSpace:"nowrap"},onClick:()=>{s(""),o(Jc)},active:a}),Gt.jsx(T,{placeholder:String(Kc),value:l,onChange:e=>{const{value:t}=e.target;s(t),o(t?new oe(t).div(100).toNumber():Jc)},onBlur:()=>{(!a&&new oe(i).gt(.1)||new oe(i).lte(0))&&(s(10),o(.1))},suffix:Gt.jsx(x,{sx:{mr:16},children:"%"}),sx:{ml:8,"& input":{px:16,py:0,height:"39px"}}})]})]}),sx:{p:0},arrow:!1,placement:"bottom-end",children:Gt.jsx(P,{sx:Object.assign({width:"max-content",alignItems:"right",margin:r.spacing(0,0,0,"auto"),p:r.spacing(4,12),borderRadius:20,backgroundColor:"background.paperDarkContrast",cursor:"pointer"},e),children:Gt.jsx(x,{component:Ft.Setting,sx:{width:18,height:18,"& path:last-child":{fill:r.palette.text.primary}}})})})}function ku(){var e,t,i;const[o,r]=G.useState(0),[a,l]=G.useState(),[s,d]=G.useState(),[c,u]=G.useState(""),[p,h]=G.useState(""),[m,f]=G.useState(Jc),g=m===Jc?new oe(Kc).div(100).toNumber():m,{isMobile:y}=Ec(),{onlyChainId:v}=Zr(),j=G.useMemo((()=>v||(null==a?void 0:a.chainId)||(null==s?void 0:s.chainId)),[v,a,s]),{poolKeys:w,poolInfo:C,pairAddress:k,price:R,isInvalidPair:S,invertedPrice:I,poolInfoLoading:E,lpBalanceLoading:M,lpBalance:T,lpBalancePercentage:L,lpToAmountA:O,lpToAmountB:W,liquidityMinted:V,pairMintAAmount:A,pairMintBAmount:F,isExists:Z}=function({baseToken:e,quoteToken:t,baseAmount:n,quoteAmount:i,feeIndex:o,slippage:r}){var a,l,s;const[d,c]=G.useMemo((()=>{if(!e||!t||null==o)return[void 0,!0];const n=new vt(new Te(e.address).toBuffer()).lte(new vt(new Te(t.address).toBuffer())),[i,r]=n?[e,t]:[t,e],[a,l]=[new Te(i.address),new Te(r.address)];return[ze({poolId:void 0,programId:ua,configId:new Te(ha[o].id),mintA:a,mintB:l}),a.toBase58()===l.toBase58()]}),[o,e,t]),{price:u,invertedPrice:p,poolInfoQuery:h,lpBalanceQuery:m,lpBalance:f,lpBalancePercentage:g,lpToAmountA:x,lpToAmountB:y,liquidityMinted:v,pairMintAAmount:b,pairMintBAmount:j,isExists:w}=nu({pool:e&&t&&d?{baseToken:e,quoteToken:t,address:d.poolId.toBase58()}:void 0,baseAmount:n,quoteAmount:i,slippage:r});return{poolKeys:null===(a=h.data)||void 0===a?void 0:a.poolKeys,poolInfo:null===(l=h.data)||void 0===l?void 0:l.poolInfo,pairAddress:null===(s=null==d?void 0:d.poolId)||void 0===s?void 0:s.toBase58(),isInvalidPair:c,price:u,invertedPrice:p,poolInfoLoading:h.isLoading,lpBalanceLoading:m.isLoading,lpBalance:f,lpBalancePercentage:g,lpToAmountA:x,lpToAmountB:y,liquidityMinted:v,pairMintAAmount:b,pairMintBAmount:j,isExists:w}}({baseToken:a,quoteToken:s,baseAmount:c,quoteAmount:p,feeIndex:o,slippage:g}),P=eu(R);if(R&&c&&!R.isEqualTo(null!=P?P:0)&&Z){const t=R.times(c).dp(null!==(e=null==s?void 0:s.decimals)&&void 0!==e?e:18);t.isEqualTo(p)||h(t.toString())}const B=al(a,{amount:c}),N=al(s,{amount:p}),[U,H]=G.useState(!1),D=!a||!s,Y=()=>{zc.getState().push({type:Yc.Pool})},z=tu({baseToken:a,quoteToken:s,pairMintAAmount:A,pairMintBAmount:F,isExists:Z,poolKeys:w,poolInfo:C,slippage:g,successBack:()=>{zc.getState().push({type:Yc.Pool,params:{tab:ru.myLiquidity}})}});return Gt.jsxs(_c,{children:[Gt.jsxs(x,{sx:{mx:"auto",borderRadius:y?0:16,backgroundColor:"background.paper",width:y?"100%":600,position:"relative",overflow:"hidden"},children:[y?Gt.jsx(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",p:20,pb:0},children:Gt.jsx(Xc,{onClick:Y})}):Gt.jsxs(x,{sx:{position:"relative",display:"flex",justifyContent:"center",alignItems:"center",px:20,py:24,typography:"caption"},children:[Gt.jsx(x,{component:Ft.ArrowBack,sx:{position:"absolute",left:20,cursor:"pointer"},onClick:Y}),Gt.jsx(n,{id:"E6MqGy",message:"Add liquidity"})]}),Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:20,pt:24,px:20,pb:20},children:[Gt.jsx(ju,{isExists:Z,poolInfo:C,poolInfoLoading:E,lpBalanceLoading:M,lpBalance:T,lpBalancePercentage:L,lpToAmountA:O,lpToAmountB:W}),Gt.jsxs(yu,{title:Gt.jsx(n,{id:"nxRg31",message:"Select pair"}),children:[Gt.jsxs(x,{sx:{display:"grid",gridTemplateColumns:y?"repeat(1, 1fr)":"repeat(2, 1fr)",gap:12},children:[Gt.jsx(Gc,{border:!0,highlightDefault:!0,chainId:j,token:a,onTokenChange:(e,t)=>{t?(l(s),d(a),u(""),h("")):(l(e),u(""))},occupiedToken:s}),Gt.jsx(Gc,{border:!0,highlightDefault:!0,chainId:j,token:s,onTokenChange:(e,t)=>{t?(l(s),d(a)):(d(e),h(""))},occupiedToken:a})]}),Gt.jsx(vu,{feeIndex:o,onChange:r,feeList:ha,disabled:D})]}),Gt.jsx(yu,{title:Gt.jsx(n,{id:"MU9s7M",message:"Deposit amounts"}),disabled:D,children:Gt.jsxs(x,{children:[Gt.jsx(Uc,{sx:{mb:4,pb:28,minHeight:"auto"},token:a,amt:c,defaultLoadBalance:!0,onInputChange:e=>{var t;u(e);const n=Number(e);Z&&R&&n&&h(R.times(e).dp(null!==(t=null==s?void 0:s.decimals)&&void 0!==t?t:18).toString())},showMaxBtn:!0,occupiedAddrs:[null!==(t=null==s?void 0:s.address)&&void 0!==t?t:""],occupiedChainId:null==s?void 0:s.chainId,notTokenPickerModal:!0,showPercentage:!0,readOnly:D}),Gt.jsx(kc,{plus:!0}),Gt.jsx(Uc,{sx:{pb:20,minHeight:"auto"},token:s,amt:p,defaultLoadBalance:!0,onInputChange:e=>{var t;h(e);const n=Number(e);Z&&I&&n&&u(I.times(e).dp(null!==(t=null==a?void 0:a.decimals)&&void 0!==t?t:18).toString())},showMaxBtn:!0,occupiedAddrs:[null!==(i=null==a?void 0:a.address)&&void 0!==i?i:""],occupiedChainId:null==a?void 0:a.chainId,notTokenPickerModal:!0,showPercentage:!0,readOnly:D}),Gt.jsx(Cu,{slippage:m,onChangeSlippage:f,disabled:D,sx:{mt:8}}),Gt.jsx(gu,{baseToken:a,quoteToken:s,loading:E,midPrice:R,lpBalancePercentage:Z?L:100}),!!Z&&Gt.jsxs(x,{sx:{mt:20,p:20,borderRadius:16,backgroundColor:"background.paperContrast",typography:"h6",textAlign:"center","& > b":{fontWeight:600,color:"primary.main"}},children:["🌟",Gt.jsx("b",{children:Gt.jsx(n,{id:"e38JNU",message:"Tips:"})})," ",Gt.jsx(n,{id:"XoymfI",message:"By adding liquidity you’ll earn <0>{0}</0>of all trades on this pair proportional to your share of the pool. Fees are added to the pool, accrue in real time and can be claimed by withdrawing your liquidity.",values:{0:da({input:ha[o].tradeFeeRate/1e4})},components:{0:Gt.jsx("b",{})}})]})]})})]}),Gt.jsx(x,{sx:{py:16,px:20,borderTopWidth:1},children:Gt.jsx(gc,{fullWidth:!0,includeButton:!0,size:b.Size.big,disabled:D,chainId:j,children:Gt.jsx(qc,{statuses:[B,N],buttonProps:{size:b.Size.big},children:Gt.jsx(b,{fullWidth:!0,size:b.Size.big,disabled:!(a&&s&&c&&p&&!S&&null!=o),onClick:()=>H(!0),children:S?Gt.jsx(n,{id:"R7D79P",message:"Invalid pair"}):Gt.jsx(n,{id:"bwSQI0",message:"Supply"})})})})})]}),Gt.jsx(xu,{open:U,onClose:()=>H(!1),slippage:g,baseToken:a,pairMintAAmount:A,quoteToken:s,pairMintBAmount:F,feeRate:ha[o].tradeFeeRate,price:R,lpAmount:V,lpBalancePercentage:Z?L:100,pairAddress:k,createMutation:z})]})}const Ru=({type:e})=>{const[t,n]=_(Jc),i=K((()=>t===Jc?e===u?new oe($c).div(100).toNumber():e===p?new oe(Kc).div(100).toNumber():new oe(Qc).div(100).toNumber():t),[t,e]);return{slipper:t,setSlipper:n,slipperValue:i,resetSlipper:()=>{n(Jc)}}};function Su({type:e,disabled:t,value:i,onChange:o,sx:r}){const a=y(),l=i===Jc,[s,d]=_(l?"":new oe(i).times(100).toNumber()),c=e===u?$c:e===p?Kc:Qc;return Gt.jsx(W,{disabled:t,onlyClick:!0,title:Gt.jsxs(x,{sx:{backgroundColor:a.palette.background.paper,padding:a.spacing(12,20),borderRadius:8,width:318,maxWidth:"90vw",boxSizing:"border-box"},children:[Gt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",typography:"body2"},children:[Gt.jsx("span",{children:Gt.jsx(n,{id:"lqTDfd",message:"Slippage Tolerance"})}),Gt.jsxs("span",{children:[l?c:i&&new oe(i).times(100).toNumber(),"%"]})]}),Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",margin:a.spacing(16,0,0,0)},children:[Gt.jsx(wu,{sx:{borderRadius:8,whiteSpace:"nowrap"},onClick:()=>{d(""),o(Jc)},active:l}),Gt.jsx(T,{placeholder:String(c),value:s,onChange:e=>{const{value:t}=e.target;d(t),o(t?new oe(t).div(100).toNumber():Jc)},onBlur:()=>{(!l&&new oe(i).gt(.1)||new oe(i).lte(0))&&(d(10),o(.1))},suffix:Gt.jsx(x,{sx:{mr:16},children:"%"}),sx:{ml:8,"& input":{px:16,py:0,height:"39px"}}})]})]}),sx:{p:0},arrow:!1,placement:"bottom-end",children:Gt.jsx(P,{sx:Object.assign({width:"max-content",alignItems:"right",margin:a.spacing(0,0,0,"auto"),p:a.spacing(4,12),borderRadius:20,backgroundColor:"background.paperDarkContrast"},r),children:Gt.jsx(x,{component:Ft.Setting,sx:{width:18,height:18,"& path:last-child":{fill:a.palette.text.primary}}})})})}const Iu=({chainId:e,isValid:t,errorMessage:n,setShowConfirm:o})=>Gt.jsx(gc,{includeButton:!0,fullWidth:!0,chainId:e,children:Gt.jsx(b,{fullWidth:!0,size:b.Size.big,onClick:()=>{o(!0)},disabled:!t,danger:!t,children:n||i._({id:"rdUucN",message:"Preview"})})}),Eu=[.25,.5,.75,1];function Mu({currentValue:e,onClick:t,sx:n}){const i=y(),o="light"===i.palette.mode,{isMobile:r}=Ec(),[a,l]=_(null),s=te(0);J((()=>{e?(s.current+=1,s.current>=2&&(l(null),s.current=0)):l(null)}),[e]);const d=eu(e);return J((()=>{d===e&&1===a&&(s.current=1)}),[e,d,a]),Gt.jsx(x,{sx:Object.assign({display:"grid",gap:r?10:14,gridTemplateColumns:`repeat(${Eu.length}, 1fr)`},n),children:Eu.map((e=>{const n=e===a;return Gt.jsxs(M,{sx:{typography:"h6",borderRadius:4,padding:i.spacing(4,0),width:"100%",color:"text.secondary",backgroundColor:"background.paperDarkContrast","&:hover":{color:i.palette.text.primary,backgroundColor:L(i.palette.text.primary,.2)},"&.selected, &:focus":{color:"#fff",backgroundColor:o?i.palette.primary.main:L(i.palette.text.primary,.4)}},onClick:()=>{n||(s.current=0,l(e),t(e))},className:n?"selected":void 0,children:[100*e,"%"]},e)}))})}const Tu=({value:e,onUserInput:t,maxAmount:o,balance:r,mint:a,locked:l})=>{var s,d;const c=y(),u=Q((e=>{if(!o||!a)return;const n=o.multipliedBy(e).dp(a.decimals).toString();t(n)}),[a,o,t]),p=K((()=>r?Kr({input:r,decimals:null==a?void 0:a.decimals}):"-"),[null==a?void 0:a.decimals,r]);return Gt.jsxs(x,{sx:{pt:12,pb:20,px:20,borderWidth:1,borderStyle:"solid",borderColor:"border.main",borderRadius:12,backgroundColor:c.palette.background.input},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:4},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,color:c.palette.text.primary,typography:"h5"},children:[(null==a?void 0:a.address)&&Gt.jsx(Ms,{address:null!==(s=null==a?void 0:a.address)&&void 0!==s?s:"",chainId:null==a?void 0:a.chainId,noShowChain:!0,width:24,height:24,marginRight:0}),Gt.jsx(x,{sx:{display:"flex",alignItems:"center"},children:(null==a?void 0:a.address)?Gt.jsx(x,{children:null!==(d=null==a?void 0:a.symbol)&&void 0!==d?d:"-"}):Gt.jsx(n,{id:"sIPJGT",message:"SELECT TOKEN"})})]}),Gt.jsxs(x,{component:M,sx:{color:c.palette.text.secondary,"&:hover":{color:c.palette.text.primary},cursor:"pointer",display:"flex",flexWrap:"wrap",justifyContent:"flex-end",typography:"body2"},onClick:()=>{u(1)},children:[Gt.jsxs(x,{sx:{wordBreak:"keep-all"},children:[i._({id:"fsBGk0",message:"Balance"}),": "]}),Gt.jsx(x,{sx:{wordBreak:"break-all",textAlign:"right",display:"flex",alignItems:"center"},children:p})]})]}),Gt.jsx(Ic,{sx:{mt:4},suffix:void 0,value:e,onChange:t,readOnly:l,withClear:!l}),l?null:Gt.jsx(Mu,{sx:{mt:20,mb:0},onClick:u,currentValue:e})]})};var Lu,Ou;function Wu(e,t){switch(t.type){case Lu.UpdateMint1:{const n=t.payload;return Object.assign(Object.assign({},e),{mint1:n})}case Lu.UpdateDefaultMint1:{const n=t.payload;return e.mint1?e:Object.assign(Object.assign({},e),{mint1:n})}case Lu.UpdateMint2:{const n=t.payload;return Object.assign(Object.assign({},e),{mint2:n})}case Lu.UpdateDefaultMint2:{const n=t.payload;return e.mint2?e:Object.assign(Object.assign({},e),{mint2:n})}case Lu.UpdateMint1AndClearMint2:{const n=t.payload;return Object.assign(Object.assign({},e),{mint1:n,mint2:void 0})}case Lu.UpdateFeeAmount:return Object.assign(Object.assign({},e),{feeAmount:t.payload});case Lu.UpdateSelectedMintIndex:return Object.assign(Object.assign({},e),{selectedMintIndex:t.payload});case Lu.setFullRange:return Object.assign(Object.assign({},e),{leftRangeTypedValue:!0,rightRangeTypedValue:!0});case Lu.typeStartPriceInput:return Object.assign(Object.assign({},e),{startPriceTypedValue:t.payload.typedValue});case Lu.typeLeftRangeInput:return Object.assign(Object.assign({},e),{leftRangeTypedValue:t.payload.typedValue});case Lu.typeRightRangeInput:return Object.assign(Object.assign({},e),{rightRangeTypedValue:t.payload.typedValue});case Lu.typeInput:{const{payload:{field:n,typedValue:i}}=t;return Object.assign(Object.assign({},e),{independentField:n,typedValue:i})}default:throw Error("Unknown action: "+t.type)}}!function(e){e[e.UpdateMint1=0]="UpdateMint1",e[e.UpdateMint2=1]="UpdateMint2",e[e.UpdateDefaultMint1=2]="UpdateDefaultMint1",e[e.UpdateDefaultMint2=3]="UpdateDefaultMint2",e[e.UpdateMint1AndClearMint2=4]="UpdateMint1AndClearMint2",e[e.UpdateFeeAmount=5]="UpdateFeeAmount",e[e.UpdateSelectedMintIndex=6]="UpdateSelectedMintIndex",e[e.setFullRange=7]="setFullRange",e[e.typeStartPriceInput=8]="typeStartPriceInput",e[e.typeLeftRangeInput=9]="typeLeftRangeInput",e[e.typeRightRangeInput=10]="typeRightRangeInput",e[e.typeInput=11]="typeInput"}(Lu||(Lu={})),function(e){e[e.LOW=1e3]="LOW"}(Ou||(Ou={}));const Vu={[Ou.LOW]:20},Au={[Ou.LOW]:{label:"0.1%"}},Fu=({disabled:e,feeAmount:t,dispatch:n})=>{const o=y(),{isMobile:r}=Ec(),[a,l]=_(!1);return Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs(x,{sx:Object.assign({display:"flex",alignItems:"center",justifyContent:"space-between",px:20,py:12,borderWidth:1,borderStyle:"solid",borderColor:o.palette.border.main,borderRadius:12},e?{opacity:.3}:void 0),children:[Gt.jsx(x,{sx:{typography:"h5",color:o.palette.text.primary},children:t?`${Au[t].label} ${i._({id:"fxRyGG",message:"fee tier"})}`:i._({id:"EU3wU4",message:"Fee tier"})}),Gt.jsx(b,{size:b.Size.small,variant:b.Variant.outlined,disabled:e,onClick:()=>l((e=>!e)),sx:{color:o.palette.text.primary,border:`solid 1px ${o.palette.text.primary}`},children:a?i._({id:"vLyv1R",message:"Hide"}):i._({id:"ePK91l",message:"Edit"})})]}),a&&Gt.jsx(x,{sx:Object.assign({},r?{display:"grid",gap:8,gridTemplateColumns:"repeat(2, 1fr)"}:{display:"flex",alignItems:"center",gap:8}),children:[Ou.LOW].map((i=>{const r=t===i;return Gt.jsxs(b,{size:b.Size.middle,variant:b.Variant.outlined,disabled:e,onClick:()=>{n({type:Lu.UpdateFeeAmount,payload:i})},sx:{flexBasis:"50%",flexShrink:1,flexGrow:1,justifyContent:"space-between",px:20,color:o.palette.text.primary,borderRadius:12,borderColor:r?o.palette.primary.main:o.palette.border.main,[o.breakpoints.up("tablet")]:{flexBasis:"25%"}},children:[Au[i].label,r?Gt.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[Gt.jsx("rect",{x:"0.5",y:"0.5",width:"17",height:"17",rx:"8.5",stroke:o.palette.primary.main}),Gt.jsx("rect",{x:"4.5",y:"4.5",width:"9",height:"9",rx:"4.5",fill:o.palette.primary.main,stroke:o.palette.primary.main})]}):Gt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:Gt.jsx("rect",{x:"0.5",y:"0.5",width:"17",height:"17",rx:"8.5",stroke:o.palette.text.secondary})})]},i)}))})]})};var Zu,Pu,Bu;!function(e){e.DEPOSIT_1="DEPOSIT_1",e.DEPOSIT_2="DEPOSIT_2"}(Zu||(Zu={})),function(e){e.LOWER="LOWER",e.UPPER="UPPER"}(Pu||(Pu={})),function(e){e.TOKEN0="TOKEN0",e.TOKEN1="TOKEN1"}(Bu||(Bu={}));const Nu={xs:"4px",sm:"8px",md:"12px",lg:"24px",xl:"32px"},Uu=({children:e,sx:t})=>(y(),Gt.jsx(x,{sx:Object.assign({display:"flex",flexDirection:"column",gap:20,px:20,py:20,borderRadius:12},t),children:e})),Hu=({children:e,sx:t})=>{const n=y();return Gt.jsx(Uu,{sx:Object.assign(Object.assign({},t),{backgroundColor:n.palette.background.paperContrast}),children:e})},Du=({children:e})=>{const t=y();return Gt.jsxs(x,{sx:{p:8,borderRadius:8,backgroundColor:L(t.palette.warning.main,.1),display:"flex",alignItems:"center",gap:8},children:[Gt.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:Gt.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.75 16.125L9 1.875L17.25 16.125H0.75ZM14.6475 14.625L8.99998 4.86749L3.35247 14.625H14.6475ZM9.75004 12.375H8.25003V13.875H9.75004V12.375ZM8.25003 7.875H9.75004V10.875H8.25003V7.875Z",fill:t.palette.warning.main})}),Gt.jsx(x,{sx:{typography:"h6",color:t.palette.warning.main,textAlign:"left"},children:e})]})};function Yu({gap:e,flex:t,children:n,style:i}){return Gt.jsx(x,{sx:Object.assign(Object.assign(Object.assign({display:"flex",flexDirection:"column",justifyContent:"flex-start",gap:e&&Nu[e]||e},t&&{flex:t}),{width:"100%",alignItems:"center"}),i),children:n})}function zu({gap:e,justify:t,grow:n,children:i,style:o}){return Gt.jsx(x,{sx:Object.assign({display:"grid",gridAutoRows:"auto",gridRowGap:e&&Nu[e]||e,justifyItems:t,flexGrow:n&&1},o),children:i})}function Xu({gap:e,children:t,sx:n}){return Gt.jsx(x,{sx:Object.assign({width:"100%",display:"flex",padding:0,alignItems:"center",justifyContent:"flex-start",gap:e&&Nu[e]||e},n),children:t})}function qu({children:e,style:t}){return Gt.jsx(Xu,{sx:Object.assign({justifyContent:"space-between"},t),children:e})}function Gu({gap:e,justify:t,children:n,sx:i}){return Gt.jsx(Xu,{sx:Object.assign({position:"relative",width:"fit-content",margin:`-${e}`},i),children:n})}function _u({children:e,disabled:t,sx:n}){return Gt.jsx(Xu,{sx:Object.assign({display:"flex",flexDirection:"column",alignItems:"stretch",gap:12,opacity:t?.2:1,pointerEvents:t?"none":"auto"},n),children:e})}const Ju={neutral1:"#222222",neutral2:"#7D7D7D",accent1:"#FC72FF",critical:"FF5F52",white:"#FFFFFF",surface3:"#22222212",opacity:{hover:.6,click:.4,disabled:.5,enabled:1}},Qu=({series:e,xScale:t,yScale:n,xValue:i,yValue:o,fill:r})=>K((()=>{var a;return Gt.jsx(x,{component:"path",opacity:.5,stroke:null!=r?r:Ju.accent1,fill:null!=r?r:Ju.accent1,d:null!==(a=wt().curve(Ct).x((e=>t(i(e)))).y1((e=>n(o(e)))).y0(n(0))(e.filter((e=>{const n=t(i(e));return n>0&&n<=window.innerWidth}))))&&void 0!==a?a:void 0})}),[r,e,t,i,n,o]),Ku=({axisGenerator:e})=>Gt.jsx("g",{ref:t=>{t&&Rt(t).call(e).call((e=>e.select(".domain").remove()))}}),$u=({xScale:e,innerHeight:t,offset:n=0})=>K((()=>Gt.jsx(x,{component:"g",transform:`translate(0, ${t+n})`,sx:{"& line":{display:"none"},"& text":{color:Ju.neutral2,transform:"translateY(5px)"}},children:Gt.jsx(Ku,{axisGenerator:kt(e).ticks(6)})})),[t,n,e]),ep=e=>["M 0 0",`v ${e}`,"m 1 0","V 0","M 0 1","h 12","q 2 0, 2 2","v 22","q 0 2 -2 2","h -12","z"].join(" "),tp=()=>["m 5 7","v 14","M 0 0","m 9 7","v 14","z"].join(" "),np=({color:e,size:t=10,margin:n=10})=>Gt.jsx("polygon",{points:`0 0, ${t} ${t}, 0 ${t}`,transform:` translate(${t+n}, ${n}) rotate(45) `,fill:e,stroke:e,strokeWidth:"4",strokeLinejoin:"round"});const ip=({color:e,d:t})=>Gt.jsx(x,{component:"path",cursor:"ew-resize",pointerEvents:"none",strokeWidth:3,stroke:e,fill:e,d:t}),op=({d:e})=>Gt.jsx(x,{component:"path",cursor:"ew-resize",pointerEvents:"none",stroke:Ju.white,opacity:Ju.opacity.hover,d:e}),rp=({visible:e,transform:t,children:n})=>Gt.jsx(x,{component:"g",opacity:e?"1":"0",transform:t,sx:{transition:"opacity 300ms"},children:n}),ap=({y:e,x:t,height:n,width:i,rx:o})=>Gt.jsx(x,{component:"rect",fill:Ju.surface3,y:e,x:t,height:n,width:i,rx:o}),lp=({y:e,transform:t,dominantBaseline:n,children:i})=>Gt.jsx(x,{component:"text",y:e,textAnchor:"middle",fontSize:"13px",fill:Ju.neutral1,transform:t,dominantBaseline:n,children:i}),sp=(e,t,n)=>{const i=e.map((e=>n(e).toFixed(1))),o=t.map((e=>n(e).toFixed(1)));return i.every(((e,t)=>e===o[t]))},dp=({id:e,xScale:t,interactive:n,brushLabelValue:i,brushExtent:o,setBrushExtent:r,innerWidth:a,innerHeight:l,westHandleColor:s,eastHandleColor:d})=>{const c=te(null),u=te(null),[p,h]=_(o),[m,f]=_(!1),[g,x]=_(!1),y=function(e){const t=te();return J((()=>{t.current=e}),[e]),t.current}(o),v=Q((e=>{const{type:n,selection:i,mode:a}=e;if(!i)return void h(null);const l=i.map(t.invert);"end"!==n||sp(o,l,t)||r(l,a),h(l)}),[t,o,r]);J((()=>{h(o)}),[o]),J((()=>{c.current&&(u.current=St().extent([[Math.max(2,t(0)),0],[a-2,l]]).handleSize(30).filter((()=>n)).on("brush end",v),u.current(Rt(c.current)),y&&sp(o,y,t)&&Rt(c.current).transition().call(u.current.move,o.map(t)),Rt(c.current).selectAll(".selection").attr("stroke","none").attr("fill-opacity","0.1").attr("fill",`url(#${e}-gradient-selection)`))}),[o,v,e,l,a,n,y,t]),J((()=>{c.current&&u.current&&u.current.move(Rt(c.current),o.map(t))}),[o,t]),J((()=>{f(!0);const e=setTimeout((()=>f(!1)),1500);return()=>clearTimeout(e)}),[p]);const b=p&&t(p[0])>20,j=p&&t(p[1])>a-20,w=p&&(t(p[0])<0||t(p[1])<0),C=p&&(t(p[0])>a||t(p[1])>a),k=p&&t(p[0])>=0&&t(p[0])<=a,R=p&&t(p[1])>=0&&t(p[1])<=a;return K((()=>Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs("defs",{children:[Gt.jsxs("linearGradient",{id:`${e}-gradient-selection`,x1:"0%",y1:"100%",x2:"100%",y2:"100%",children:[Gt.jsx("stop",{stopColor:s}),Gt.jsx("stop",{stopColor:d,offset:"1"})]}),Gt.jsx("clipPath",{id:`${e}-brush-clip`,children:Gt.jsx("rect",{x:"0",y:"0",width:a,height:l})})]}),Gt.jsx("g",{ref:c,clipPath:`url(#${e}-brush-clip)`,onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1)}),p&&Gt.jsxs(Gt.Fragment,{children:[k?Gt.jsxs("g",{transform:`translate(${Math.max(0,t(p[0]))}, 0), scale(${b?"-1":"1"}, 1)`,children:[Gt.jsxs("g",{children:[Gt.jsx(ip,{color:s,d:ep(l)}),Gt.jsx(op,{d:tp()})]}),Gt.jsxs(rp,{transform:`translate(50,0), scale(${b?"1":"-1"}, 1)`,visible:m||g,children:[Gt.jsx(ap,{y:"0",x:"-30",height:"30",width:"60",rx:"8"}),Gt.jsx(lp,{transform:"scale(-1, 1)",y:"15",dominantBaseline:"middle",children:i("w",p[0])})]})]}):null,R?Gt.jsxs("g",{transform:`translate(${t(p[1])}, 0), scale(${j?"-1":"1"}, 1)`,children:[Gt.jsxs("g",{children:[Gt.jsx(ip,{color:d,d:ep(l)}),Gt.jsx(op,{d:tp()})]}),Gt.jsxs(rp,{transform:`translate(50,0), scale(${j?"-1":"1"}, 1)`,visible:m||g,children:[Gt.jsx(ap,{y:"0",x:"-30",height:"30",width:"60",rx:"8"}),Gt.jsx(lp,{y:"15",dominantBaseline:"middle",children:i("e",p[1])})]})]}):null,w&&Gt.jsx(np,{color:s}),C&&Gt.jsx("g",{transform:`translate(${a}, 0) scale(-1, 1)`,children:Gt.jsx(np,{color:d})})]})]})),[i,d,R,j,b,g,e,l,a,p,C,m,w,s,k,t])},cp=({value:e,xScale:t,innerHeight:n})=>K((()=>Gt.jsx(x,{component:"line",x1:t(e),y1:"0",x2:t(e),y2:n,sx:{opacity:.5,strokeWidth:2,stroke:Ju.neutral1,fill:"none"}})),[e,t,n]);function up({svg:e,xScale:t,setZoom:n,width:i,height:o,resetBrush:r,showResetButton:a,zoomLevels:l}){const s=te(),[d,c,u,p]=K((()=>[()=>e&&s.current&&Rt(e).transition().call(s.current.scaleBy,2),()=>e&&s.current&&Rt(e).transition().call(s.current.scaleBy,.5),()=>e&&s.current&&Rt(e).transition().call(s.current.scaleTo,.5),()=>e&&s.current&&Rt(e).call(s.current.transform,It.translate(0,0).scale(1)).transition().call(s.current.scaleTo,.5)]),[e]);return J((()=>{e&&(s.current=Et().scaleExtent([l.min,l.max]).extent([[0,0],[i,o]]).on("zoom",(({transform:e})=>n(e))),Rt(e).call(s.current))}),[o,i,n,e,t,s,l,l.max,l.min]),J((()=>{u()}),[u,l]),Gt.jsxs(x,{sx:{display:"grid",gridTemplateColumns:`repeat(${a?3:2}, 1fr)`,gridGap:"6px",position:"absolute",top:"-32px",right:0},children:[a&&Gt.jsx(b,{size:b.Size.small,sx:{borderRadius:16},onClick:()=>{r(),p()},disabled:!1,children:Gt.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[Gt.jsx("polyline",{points:"1 4 1 10 7 10"}),Gt.jsx("polyline",{points:"23 20 23 14 17 14"}),Gt.jsx("path",{d:"M20.49 9A9 9 0 0 0 5.64 5.64L1 10m22 4l-4.64 4.36A9 9 0 0 1 3.51 15"})]})}),Gt.jsx(b,{size:b.Size.small,sx:{borderRadius:16},onClick:d,disabled:!1,children:Gt.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[Gt.jsx("circle",{cx:"11",cy:"11",r:"8"}),Gt.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}),Gt.jsx("line",{x1:"11",y1:"8",x2:"11",y2:"14"}),Gt.jsx("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]})}),Gt.jsx(b,{size:b.Size.small,sx:{borderRadius:16},onClick:c,disabled:!1,children:Gt.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[Gt.jsx("circle",{cx:"11",cy:"11",r:"8"}),Gt.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}),Gt.jsx("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]})})]})}const pp=e=>e.price0,hp=e=>e.activeLiquidity;function mp({id:e="liquidityChartRangeInput",data:{series:t,current:n},ticksAtLimit:i,styles:o,dimensions:{width:r,height:a},margins:l,interactive:s=!0,brushDomain:d,brushLabels:c,onBrushDomainChange:u,zoomLevels:p}){const h=te(null),[m,f]=_(null),[g,y]=K((()=>[a-l.top-l.bottom,r-l.left-l.right]),[r,a,l]),{xScale:v,yScale:b}=K((()=>{const e={xScale:Mt().domain([n*p.initialMin,n*p.initialMax]).range([0,y]),yScale:Mt().domain([0,Tt(t,hp)]).range([g,0])};if(m){const t=m.rescaleX(e.xScale);e.xScale.domain(t.domain())}return e}),[n,p.initialMin,p.initialMax,y,t,g,m]);return J((()=>{f(null)}),[p]),J((()=>{d||u(v.domain(),void 0)}),[d,u,v]),Gt.jsxs(Gt.Fragment,{children:[Gt.jsx(up,{svg:h.current,xScale:v,setZoom:f,width:y,height:a,resetBrush:()=>{u([n*p.initialMin,n*p.initialMax],"reset")},showResetButton:Boolean(i[Pu.LOWER]||i[Pu.UPPER]),zoomLevels:p}),Gt.jsxs("svg",{width:"100%",height:"100%",viewBox:`0 0 ${r} ${a}`,style:{overflow:"visible"},children:[Gt.jsxs("defs",{children:[Gt.jsx("clipPath",{id:`${e}-chart-clip`,children:Gt.jsx("rect",{x:"0",y:"0",width:y,height:a})}),d&&Gt.jsx("mask",{id:`${e}-chart-area-mask`,children:Gt.jsx("rect",{fill:"white",x:v(d[0]),y:"0",width:v(d[1])-v(d[0]),height:g})})]}),Gt.jsxs("g",{transform:`translate(${l.left},${l.top})`,children:[Gt.jsxs("g",{clipPath:`url(#${e}-chart-clip)`,children:[Gt.jsx(Qu,{series:t,xScale:v,yScale:b,xValue:pp,yValue:hp}),d&&Gt.jsx("g",{mask:`url(#${e}-chart-area-mask)`,children:Gt.jsx(Qu,{series:t,xScale:v,yScale:b,xValue:pp,yValue:hp,fill:o.area.selection})}),Gt.jsx(cp,{value:n,xScale:v,innerHeight:g}),Gt.jsx($u,{xScale:v,innerHeight:g})]}),Gt.jsx(x,{component:"rect",width:y,height:a,ref:h,sx:{fill:"transparent",cursor:"grab","&:active":{cursor:"grabbing"}}}),Gt.jsx(dp,{id:e,xScale:v,interactive:s,brushLabelValue:c,brushExtent:null!=d?d:v.domain(),innerWidth:y,innerHeight:g,setBrushExtent:u,westHandleColor:o.brush.handle.west,eastHandleColor:o.brush.handle.east})]})]})]})}function fp({tick:e,decimalsA:t,decimalsB:n}){if(!t||!n||"number"!=typeof e)return;const i=Xe.getSqrtPriceX64FromTick(e);return new oe(Xe.sqrtPriceX64ToPrice(i,t,n).toString())}var gp;function xp(e){const t=Fs(),n=we({queryKey:["clmm","getPoolInfoFromRpc",e],enabled:null!=e&&null!=t,queryFn:()=>Vr(this,void 0,void 0,(function*(){if(!t||!e)return null;try{const{poolInfo:n,poolKeys:i,computePoolInfo:o,tickData:r}=yield t.clmm.getPoolInfoFromRpc(e);return{poolInfo:n,poolKeys:i,computePoolInfo:o,tickData:r}}catch(e){return console.error("getPoolInfoFromRpc error",e),null}}))});return n.isLoading?[gp.LOADING,null,e]:n.isError?[gp.INVALID,null,e]:n.data?[gp.EXISTS,n.data,e]:[gp.NOT_EXISTS,null,e]}function yp(e,t,n,i){return xp(K((()=>{if(!e||!t||!n)return null;const o=function({chainId:e,feeAmount:t,mint1Address:n,mint2Address:i}){const[o,r]=new vt(new Te(n).toBuffer()).gt(new vt(new Te(i).toBuffer()))?[i,n]:[n,i],[a,l]=[new Te(o),new Te(r)],s=xa[e];if(!s)throw new Error("Invalid config");const d=s.config.find((e=>e.tradeFeeRate===t));if(!d)throw new Error("Invalid fee");const{publicKey:c}=qe(s.programId,new Te(d.id),a,l);return c}({mint1Address:e,mint2Address:t,feeAmount:n,chainId:i}).toBase58();return o}),[i,n,e,t]))}!function(e){e[e.LOADING=0]="LOADING",e[e.NOT_EXISTS=1]="NOT_EXISTS",e[e.EXISTS=2]="EXISTS",e[e.INVALID=3]="INVALID"}(gp||(gp={}));const vp=8,bp=(e,t)=>e&&t?Math.floor(e/Vu[t])*Vu[t]:void 0,jp=1e3;function wp(e,t){const[n,i]=_(0),[o,r]=_([]),{data:a,error:s,isLoading:d}=function(e,t=0,n){const i=el().getQuery(h.graphql.AllV3TicksDocument,{skip:t,first:jp,where:{chain:n?l[n]:m.SOON_TESTNET,poolAddress:null!=e?e:"",pairType:u}});return we(Object.assign(Object.assign({},i),{enabled:!!e}))}(e,n,t),c=null==a?void 0:a.amm_getTicksData.ticks;return J((()=>{(null==c?void 0:c.length)&&(r((e=>[...e,...c])),(null==c?void 0:c.length)===jp&&i((e=>e+jp)))}),[c]),{isLoading:d||(null==c?void 0:c.length)===jp,error:s,ticks:o}}function Cp({mint1:e,mint2:t,feeAmount:n}){const{isLoading:i,error:o,data:r}=function(e,t,n,i){var o,r;const{chainId:a}=Br(),[l,s,d]=yp(null==e?void 0:e.address,null==t?void 0:t.address,n,a),c=null===(o=null==s?void 0:s.computePoolInfo)||void 0===o?void 0:o.tickCurrent,u=K((()=>bp(c,n)),[c,n]),{isLoading:p,error:h,ticks:m}=wp(d,a);return K((()=>{var n,i,o,r,a,d;if(!e||!t||void 0===u||l!==gp.EXISTS||!m||0===m.length||p)return{isLoading:p||l===gp.LOADING,error:h,activeTick:u,data:void 0};const c=m.findIndex((e=>(null==e?void 0:e.tickIdx)&&e.tickIdx>u))-1;if(c<0)return console.log("usePoolTickData","usePoolActiveLiquidity","TickData pivot not found",{mint1:e.address,mint2:t.address,chainId:e.chainId}),{isLoading:p,error:h,activeTick:u,data:void 0};const f=fp({decimalsA:e.decimals,decimalsB:t.decimals,tick:u}),g={liquidityActive:null!==(i=null===(n=null==s?void 0:s.computePoolInfo)||void 0===n?void 0:n.liquidity.toNumber())&&void 0!==i?i:0,tick:u,liquidityNet:Number(null===(o=m[c])||void 0===o?void 0:o.tickIdx)===u?Number(null!==(a=null===(r=m[c])||void 0===r?void 0:r.liquidityNet)&&void 0!==a?a:0):0,price0:null!==(d=null==f?void 0:f.toFixed(vp))&&void 0!==d?d:"",sdkPrice:f},x=[].concat(g).concat([]);return{isLoading:p,error:h,data:x}}),[u,h,p,e,t,null===(r=null==s?void 0:s.computePoolInfo)||void 0===r?void 0:r.liquidity,l,m])}(e,t,n),a=Q((()=>{if(!(null==r?void 0:r.length))return;const e=[];for(let t=0;t<r.length;t++){const n=r[t],i={activeLiquidity:parseFloat(n.liquidityActive.toString()),price0:parseFloat(n.price0)};i.activeLiquidity>0&&e.push(i)}return e}),[r]);return K((()=>({isLoading:i,error:o,formattedData:i?void 0:a()})),[i,o,a])}const kp={[Ou.LOW]:{initialMin:.999,initialMax:1.001,min:1e-5,max:1.5}};function Rp({message:e,icon:t}){return Gt.jsxs(Yu,{style:{height:"100%",justifyContent:"center"},children:[t,e&&Gt.jsx(x,{sx:{mt:20,p:10,typography:"caption",textAlign:"center"},children:e})]})}function Sp(){return Gt.jsx(E,{})}function Ip({mint1:e,mint2:t,feeAmount:i,ticksAtLimit:o,price:r,priceLower:a,priceUpper:l,onLeftRangeInput:s,onRightRangeInput:d,interactive:c}){const u=!0,{isLoading:p,error:h,formattedData:m}=Cp({mint1:e,mint2:t,feeAmount:i}),f=Q(((e,t)=>{let n=Number(e[0]);const i=Number(e[1]);n<=0&&(n=1/10**6),fe((()=>{(!o[Pu.LOWER]||"handle"===t||"reset"===t)&&n>0&&s(n.toFixed(6)),(!o[Pu.UPPER]||"reset"===t)&&i>0&&i<1e35&&d(i.toFixed(6))}))}),[u,s,d,o]);c=c&&Boolean(null==m?void 0:m.length);const g=K((()=>{const e=a,t=l;return e&&t?[parseFloat(null==e?void 0:e.toString()),parseFloat(null==t?void 0:t.toString())]:void 0}),[a,l]),y=Q(((e,t)=>{if(!r)return"";if("w"===e&&o[Pu.LOWER])return"0";if("e"===e&&o[Pu.UPPER])return"∞";const n=(t<r?-1:1)*((Math.max(t,r)-Math.min(t,r))/r)*100;return r?`${Kr({input:n,decimals:2})}%`:""}),[u,r,o]),v=!e||!t||void 0===m&&!p&&!h;return Gt.jsx(zu,{gap:"md",style:{minHeight:"200px"},children:v?Gt.jsx(Rp,{message:Gt.jsx(n,{id:"OZUH85",message:"Your position will appear here."}),icon:Gt.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"56",height:"56",viewBox:"0 0 24 24",fill:"none",stroke:Ju.neutral1,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[Gt.jsx("polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12"}),Gt.jsx("path",{d:"M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"})]})}):p?Gt.jsx(Sp,{}):h?Gt.jsx(Rp,{message:Gt.jsx(n,{id:"79D0qY",message:"Liquidity data not available."}),icon:Gt.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"56",height:"56",viewBox:"0 0 24 24",fill:"none",stroke:Ju.neutral2,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[Gt.jsx("path",{d:"M22.61 16.95A5 5 0 0 0 18 10h-1.26a8 8 0 0 0-7.05-6M5 5a8 8 0 0 0 4 15h9a5 5 0 0 0 1.7-.3"}),Gt.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]})}):m&&0!==m.length&&r?Gt.jsx(x,{sx:{position:"relative",width:"100%",maxHeight:"200px",justifyContent:"center",alignContent:"center"},children:Gt.jsx(mp,{data:{series:m,current:r},dimensions:{width:560,height:200},margins:{top:10,right:2,bottom:20,left:0},styles:{area:{selection:Ju.accent1},brush:{handle:{west:Ju.critical,east:Ju.accent1}}},interactive:c,brushLabels:y,brushDomain:g,onBrushDomainChange:f,zoomLevels:kp[null!=i?i:Ou.LOW],ticksAtLimit:o})}):Gt.jsx(Rp,{message:Gt.jsx(n,{id:"rH6vg9",message:"There is no liquidity data."}),icon:Gt.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"56",height:"56",viewBox:"0 0 24 24",fill:"none",stroke:Ju.neutral2,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[Gt.jsx("line",{x1:"18",y1:"20",x2:"18",y2:"10"}),Gt.jsx("line",{x1:"12",y1:"20",x2:"12",y2:"4"}),Gt.jsx("line",{x1:"6",y1:"20",x2:"6",y2:"14"})]})})})}const Ep=({value:e,decrement:t,increment:n,decrementDisabled:i=!1,incrementDisabled:o=!1,locked:r,onUserInput:a,title:l,perPriceText:s})=>{const d=y(),[c,u]=_(""),[p,h]=_(!1),m=Q((()=>{h(!1),a(c)}),[c,a]),f=Q((()=>{h(!1),a(t())}),[t,a]),g=Q((()=>{h(!1),a(n())}),[n,a]);return J((()=>{c===e||p||setTimeout((()=>{u(e)}),0)}),[c,p,e]),Gt.jsx(x,{onFocus:()=>{h(!0)},onBlur:m,sx:{width:"100%",py:12,px:20,borderRadius:16,backgroundColor:d.palette.background.input},children:Gt.jsxs(x,{sx:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column",alignItems:"stretch"},children:[Gt.jsx(x,{sx:{typography:"body2",fontWeight:600,color:d.palette.text.primary},children:l}),Gt.jsx(x,{sx:{mt:4,typography:"h6",fontWeight:500,color:d.palette.text.secondary},children:s}),Gt.jsx(Ic,{sx:{mt:12},value:c,onChange:e=>{u(e)},readOnly:r})]}),Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:8},children:[!r&&Gt.jsx(b,{size:b.Size.small,onClick:g,disabled:o,sx:{px:4,backgroundColor:d.palette.background.paper,"&[disabled]":{cursor:"default"}},children:Gt.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:Gt.jsx("path",{d:"M14.25 9.75H9.75V14.25H8.25V9.75H3.75V8.25H8.25V3.75H9.75V8.25H14.25V9.75Z",fill:i?d.palette.text.disabled:d.palette.text.primary})})}),!r&&Gt.jsx(b,{size:b.Size.small,onClick:f,disabled:i,sx:{px:4,backgroundColor:d.palette.background.paper,"&[disabled]":{cursor:"default"}},children:Gt.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:Gt.jsx("rect",{x:"3.75",y:"8.25",width:"10.5",height:"1.5",fill:i?d.palette.text.disabled:d.palette.text.primary})})})]})]})})},Mp=({priceLower:e,priceUpper:t,onLeftRangeInput:i,onRightRangeInput:o,getDecrementLower:r,getIncrementLower:a,getDecrementUpper:l,getIncrementUpper:s,perPriceText:d,ticksAtLimit:c})=>{var u,p;const h=e,m=t;return Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column",alignItems:"stretch",gap:8},children:[Gt.jsx(Ep,{value:c[Pu.LOWER]?"0":null!==(u=null==h?void 0:h.dp(8).toString())&&void 0!==u?u:"",onUserInput:i,decrement:r,increment:a,decrementDisabled:void 0===h||c[Pu.LOWER],incrementDisabled:void 0===h||c[Pu.LOWER],title:Gt.jsx(n,{id:"uEoBVI",message:"Low price"}),perPriceText:d}),Gt.jsx(Ep,{value:c[Pu.UPPER]?"∞":null!==(p=null==m?void 0:m.dp(8).toString())&&void 0!==p?p:"",onUserInput:o,decrement:l,increment:s,incrementDisabled:void 0===m||c[Pu.UPPER],decrementDisabled:void 0===m||c[Pu.UPPER],title:Gt.jsx(n,{id:"kAC8rT",message:"High price"}),perPriceText:d})]})},Tp=({mintA:e,mintB:t,selectedMintIndex:n,handleRateToggle:i,sx:o})=>{const r=y();return Gt.jsx(x,{component:M,onClick:i,sx:Object.assign({display:"flex",alignItems:"center",p:1,borderRadius:8,backgroundColor:r.palette.border.main},o),children:Gt.jsx(x,{sx:{display:"flex",alignItems:"center",width:"100%",[r.breakpoints.up("tablet")]:{width:"auto"}},children:[e,t].map(((e,t)=>{const i=n===t;return Gt.jsx(x,{sx:Object.assign({flexGrow:1,flexShrink:1,flexBasis:"50%",px:12,py:4,borderRadius:7,textAlign:"center",typography:"h6",whiteSpace:"nowrap"},i?{color:r.palette.text.primary,backgroundColor:r.palette.background.paper}:{color:r.palette.text.secondary,backgroundColor:"transparent"}),children:e.symbol},e.address)}))})})};function Lp(e,t){var n;return e?{chainId:t,address:e.id,name:e.name,decimals:Number(e.decimals),symbol:e.symbol,logoURI:null!==(n=e.logoImg)&&void 0!==n?n:""}:e}function Op(e){var t,n,i,o;const r=null==e?void 0:e.pair;if(r)return{address:r.id,chainId:r.chainId,baseToken:Lp(r.baseToken,r.chainId),quoteToken:Lp(r.quoteToken,r.chainId),type:r.type,creator:r.creator,baseLpToken:{id:null===(t=r.baseLpToken)||void 0===t?void 0:t.id},quoteLpToken:{id:null===(n=r.quoteLpToken)||void 0===n?void 0:n.id},lpFeeRate:null===(i=null==e?void 0:e.pair)||void 0===i?void 0:i.lpFeeRate,mtFeeRate:null===(o=null==e?void 0:e.pair)||void 0===o?void 0:o.mtFeeRate}}function Wp(e){const t=Op(e);if(t)return Object.assign(Object.assign({},t),{liquidityPositions:null==e?void 0:e.liquidityPositions})}function Vp(e){switch(e){case"SVM_AMMV2":return"AMM V2";case"SVM_AMMV3":return"AMM V3";default:return"PMM"}}function Ap({type:e,lpFeeRate:t,mtFeeRate:n}){var i,o;return"SVM_AMMV3"===e?null!==(o=null===(i=Au[t])||void 0===i?void 0:i.label)&&void 0!==o?o:"-":`${Kr({input:new oe(null!=t?t:0).plus(null!=n?n:0).div(1e4),decimals:4})}%`}new f,new h;const Fp=({sx:e})=>{const t=y();return Gt.jsx(x,{sx:Object.assign({py:4,px:8,color:t.palette.primary.main,borderRadius:4,backgroundColor:L(t.palette.primary.main,.1),typography:"h6"},e),children:i._({id:"m8r/Yx",message:"AMM V3"})})};function Zp({removed:e,inRange:t}){const n=y(),o={py:4,px:8,color:n.palette.success.main,borderRadius:4,backgroundColor:L(n.palette.success.main,.1),typography:"h6"};return e?Gt.jsx(W,{title:i._({id:"MZPP7t",message:"Your position has 0 liquidity, and is not earning fees."}),children:Gt.jsx(x,{sx:Object.assign(Object.assign({},o),{color:n.palette.warning.main,backgroundColor:L(n.palette.warning.main,.1)}),children:i._({id:"D87pha",message:"Closed"})})}):t?Gt.jsx(W,{title:i._({id:"aIvv/z",message:"The price of this pool is within your selected range. Your position is currently earning fees."}),children:Gt.jsx(x,{sx:o,children:i._({id:"vOyUlD",message:"In range"})})}):Gt.jsx(W,{title:i._({id:"IwiTcw",message:"The price of this pool is outside of your selected range. Your position is not currently earning fees."}),children:Gt.jsx(x,{sx:Object.assign(Object.assign({},o),{color:n.palette.error.main,backgroundColor:L(n.palette.error.main,.1)}),children:i._({id:"i3Z+/Z",message:"Out of range"})})})}function Pp({price:e,atLimit:t,direction:n}){return t[n]?n===Pu.LOWER?"0":"∞":"string"==typeof e&&"∞"===e?"∞":Kr({input:e})}const Bp=({position:e,title:t,ticksAtLimit:i})=>{const{poolInfo:{mintA:o,mintB:r,feeRate:a,price:l},liquidity:s,amountA:d,amountB:c,tickLowerPrice:u,tickUpperPrice:p}=e,h=y(),[m,f]=_(o),g=K((()=>m.address===o.address?r:o),[m.address,o,r]),v=Q((()=>{f(g)}),[g]);return Gt.jsxs(zu,{gap:"md",children:[Gt.jsxs(qu,{children:[t?Gt.jsx(x,{sx:{typography:"body1",fontWeight:600,color:h.palette.text.secondary},children:t}):Gt.jsx("div",{}),Gt.jsx(Tp,{mintA:o,mintB:r,selectedMintIndex:0,handleRateToggle:v})]}),Gt.jsxs(qu,{children:[Gt.jsxs(Hu,{sx:{width:"48%",py:12,gap:12},children:[Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:4},children:[Gt.jsx(x,{sx:{color:h.palette.text.primary,typography:"body2"},children:Gt.jsx(n,{id:"EQs1sJ",message:"Min price"})}),Gt.jsx(x,{sx:{color:h.palette.text.secondary,typography:"h6"},children:Gt.jsx(n,{id:"7Z4WfS",message:"{0} per {1}",values:{0:g.symbol,1:m.symbol}})})]}),Gt.jsx(x,{sx:{color:h.palette.text.primary,typography:"caption"},children:Pp({price:u,atLimit:i,direction:Pu.LOWER})}),Gt.jsx(x,{sx:{color:h.palette.text.secondary,typography:"h6"},children:Gt.jsx(n,{id:"WgTuci",message:"Your position will be 100% composed of {0} at this price",values:{0:null==m?void 0:m.symbol}})})]}),Gt.jsxs(Hu,{sx:{width:"48%",py:12,gap:12},children:[Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:4},children:[Gt.jsx(x,{sx:{color:h.palette.text.primary,typography:"body2"},children:Gt.jsx(n,{id:"5etEUX",message:"Max price"})}),Gt.jsx(x,{sx:{color:h.palette.text.secondary,typography:"h6"},children:Gt.jsx(n,{id:"7Z4WfS",message:"{0} per {1}",values:{0:g.symbol,1:m.symbol}})})]}),Gt.jsx(x,{sx:{color:h.palette.text.primary,typography:"caption"},children:Pp({price:p,atLimit:i,direction:Pu.UPPER})}),Gt.jsx(x,{sx:{color:h.palette.text.secondary,typography:"h6"},children:Gt.jsx(n,{id:"WgTuci",message:"Your position will be 100% composed of {0} at this price",values:{0:null==g?void 0:g.symbol}})})]})]}),Gt.jsxs(Hu,{sx:{py:12,flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[Gt.jsxs(zu,{gap:"4px",justify:"flex-start",children:[Gt.jsx(x,{sx:{color:h.palette.text.primary,typography:"body2"},children:Gt.jsx(n,{id:"DWd30U",message:"Current price"})}),Gt.jsx(x,{sx:{color:h.palette.text.secondary,typography:"h6"},children:Gt.jsx(n,{id:"7Z4WfS",message:"{0} per {1}",values:{0:g.symbol,1:m.symbol}})})]}),Gt.jsx(x,{sx:{color:h.palette.text.primary,typography:"caption"},children:Kr({input:l})})]})]})},Np=({position:e,title:t,inRange:i,ticksAtLimit:o})=>{Br();const{poolInfo:{mintA:r,mintB:a,feeRate:l},liquidity:s,amountA:d,amountB:c}=e,p=s.isZero();return Gt.jsxs(zu,{gap:"md",style:{marginTop:"0.5rem"},children:[Gt.jsxs(qu,{style:{gap:4},children:[Gt.jsxs(Gu,{children:[Gt.jsx(mu,{tokens:[{address:r.address},{address:a.address}],mr:8}),Gt.jsxs(x,{sx:{typography:"h5"},children:[r.symbol," / ",a.symbol]})]}),Gt.jsx(Fp,{sx:{ml:"auto"}}),Gt.jsx(Zp,{removed:p,inRange:i})]}),Gt.jsxs(Hu,{children:[Gt.jsxs(zu,{gap:"md",children:[Gt.jsxs(qu,{children:[Gt.jsxs(Gu,{children:[Gt.jsx(Ms,{address:r.address,chainId:r.chainId,noShowChain:!0,width:32,height:32,marginRight:0}),Gt.jsx(x,{sx:{ml:8},children:r.symbol})]}),Gt.jsx(Gu,{children:Gt.jsx(x,{sx:{mr:8},children:Kr({input:d,decimals:r.decimals})})})]}),Gt.jsxs(qu,{children:[Gt.jsxs(Gu,{children:[Gt.jsx(Ms,{address:a.address,chainId:a.chainId,noShowChain:!0,width:32,height:32,marginRight:0}),Gt.jsx(x,{ml:"8px",children:a.symbol})]}),Gt.jsx(Gu,{children:Gt.jsx(x,{mr:"8px",children:Kr({input:c,decimals:a.decimals})})})]})]}),Gt.jsxs(qu,{children:[Gt.jsx(x,{children:Gt.jsx(n,{id:"EU3wU4",message:"Fee tier"})}),Gt.jsx(x,{children:Ap({type:u,lpFeeRate:l,mtFeeRate:0})})]})]}),Gt.jsx(Bp,{position:e,title:t,ticksAtLimit:o})]})},Up=({position:e,outOfRange:t,ticksAtLimit:n,on:o,onClose:r,onConfirm:a,loading:l})=>{const{isMobile:s}=Ec();return Gt.jsx(oc,{open:o,onClose:r,modal:!0,title:i._({id:"E6MqGy",message:"Add liquidity"}),height:683,children:Gt.jsxs(x,{sx:{flex:1,px:20,pb:24,display:"flex",flexDirection:"column",justifyContent:"space-between",width:s?void 0:420},children:[Gt.jsx(x,{sx:{pt:0,px:0},children:e?Gt.jsx(Np,{position:e,inRange:!t,ticksAtLimit:n,title:i._({id:"3VUfrF",message:"Selected Range"})}):null}),Gt.jsx(b,{size:b.Size.big,fullWidth:!0,isLoading:l,sx:{mt:20},onClick:a,children:i._({id:"m16xKo",message:"Add"})})]})})};var Hp;function Dp(){return Dp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Dp.apply(null,arguments)}const Yp=e=>q.createElement("svg",Dp({width:18,height:18,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),Hp||(Hp=q.createElement("g",{id:"ICON/18px/arrow/\\xE6\\x94\\xB6\\xE8\\xB5\\xB7/Dark"},q.createElement("path",{id:"\\xE4\\xB8\\x89\\xE8\\xA7\\x92\\xE5\\xBD\\xA2",fillRule:"evenodd",clipRule:"evenodd",d:"M6.58398 12.376C6.78189 12.6728 7.21811 12.6728 7.41603 12.376L10.4818 7.77735C10.7033 7.44507 10.4651 7 10.0657 7H3.93426C3.53491 7 3.29672 7.44507 3.51823 7.77735L6.58398 12.376Z",fill:"currentColor"}))));function zp({token:e,oppositeTokenAddress:t,dispatch:n,tokenSelectOnChange:o}){const r=y(),{chainId:a}=Br(),[l,s]=_(!1);return Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs(x,{component:M,sx:{flexBasis:"100%",flexGrow:1,flexShrink:1,display:"flex",alignItems:"center",px:20,py:8,borderRadius:12,borderWidth:1,borderStyle:"solid",borderColor:e?r.palette.border.main:r.palette.primary.main,color:e?r.palette.text.primary:r.palette.primary.contrastText,backgroundColor:e?"transparent":r.palette.primary.main,"&:hover":{borderColor:e?r.palette.border.main:r.palette.primary.main},[r.breakpoints.up("tablet")]:{flexBasis:"50%"}},onClick:()=>{s(!0)},children:[e?Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:8},children:[Gt.jsx(Ms,{address:e.address,marginRight:0,width:24,height:24,chainId:e.chainId||a,noShowChain:!0,sx:{flexShrink:0}}),Gt.jsx(x,{sx:{typography:"h5",fontWeight:600,lineHeight:"32px",flexShrink:0},children:e.symbol})]}):Gt.jsx(x,{sx:{typography:"h5",fontWeight:600,lineHeight:"32px",flexShrink:0},children:i._({id:"0RrIzN",message:"Select token"})}),Gt.jsx(x,{component:Yp,sx:{flexShrink:0,ml:"auto",width:18,height:18}})]}),Gt.jsx(Bc,{value:e,open:l,chainId:a,occupiedAddrs:[t],occupiedChainId:null==e?void 0:e.chainId,onClose:()=>{s(!1)},onTokenChange:(e,t)=>{if(!Array.isArray(e)){if(t)return n({type:Lu.UpdateMint1AndClearMint2,payload:e}),void s(!1);o(e),s(!1)}},modal:!0})]})}const Xp=({mint1:e,mint2:t,dispatch:n})=>{var i,o;const r=y();return Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:12,flexWrap:"wrap",[r.breakpoints.up("tablet")]:{flexWrap:"nowrap"}},children:[Gt.jsx(zp,{token:e,oppositeTokenAddress:null!==(i=null==t?void 0:t.address)&&void 0!==i?i:"",dispatch:n,tokenSelectOnChange:e=>{n({type:Lu.UpdateMint1,payload:e})}}),Gt.jsx(zp,{token:t,oppositeTokenAddress:null!==(o=null==e?void 0:e.address)&&void 0!==o?o:"",dispatch:n,tokenSelectOnChange:e=>{n({type:Lu.UpdateMint2,payload:e})}})]})};function qp({mint:e,chainId:t,symbol:n}){const{fetchTokenInfo:i}=ya();return we({queryKey:["token","info",t,e],queryFn:()=>Vr(this,void 0,void 0,(function*(){return yield i({mint:e,chainId:t,symbol:n})})),enabled:!!e}).data}function Gp(e,t){Lt(Number.isInteger(e)&&Number.isInteger(t),"INTEGERS"),Lt(t>0,"TICK_SPACING"),Lt(e>=Ge&&e<=_e,"TICK_BOUND");const n=Math.round(e/t)*t;return n<Ge?n+t:n>_e?n-t:n}function _p({price:e,feeAmount:t,mintDecimalsA:n,mintDecimalsB:i,baseIn:o}){const r=new jt(e.toString()),a=o?r:new jt(1).div(r),l=Je.getTickWithPriceAndTickspacing(a,Vu[t],n,i),s=Xe.getSqrtPriceX64FromTick(l),d=Xe.sqrtPriceX64ToPrice(s,n,i);return o?{tick:l,price:d}:{tick:l,price:new jt(1).div(d)}}const Jp=[o.MAINNET,o.ARBITRUM_ONE,o.SEPOLIA,o.TAIKO],Qp={v3CoreFactoryAddress:"0x3d2A7Bac4E8439ABe86B58324695e921a5FC0987",nonfungiblePositionManagerAddress:"0x483E5c0f309577f79b0a19cE65E332DD388aD7A8"},Kp=Object.assign({},Qp),$p=Object.assign({},Qp),eh={v3CoreFactoryAddress:"0x3d2A7Bac4E8439ABe86B58324695e921a5FC0987",nonfungiblePositionManagerAddress:"0x483E5c0f309577f79b0a19cE65E332DD388aD7A8"},th={[o.MAINNET]:Kp,[o.ARBITRUM_ONE]:$p,[o.SEPOLIA]:eh,[o.TAIKO]:eh};var nh,ih;Object.assign({},Jp.reduce(((e,t)=>(e[t]=th[t].v3CoreFactoryAddress,e)),{})),Object.assign({},Jp.reduce(((e,t)=>{const n=th[t].nonfungiblePositionManagerAddress;return n&&(e[t]=n),e}),{})),function(e){e[e.EXACT_INPUT=0]="EXACT_INPUT",e[e.EXACT_OUTPUT=1]="EXACT_OUTPUT"}(nh||(nh={})),function(e){e[e.ROUND_DOWN=0]="ROUND_DOWN",e[e.ROUND_HALF_UP=1]="ROUND_HALF_UP",e[e.ROUND_UP=2]="ROUND_UP"}(ih||(ih={})),Ot.BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const oh={[ih.ROUND_DOWN]:oe.ROUND_DOWN,[ih.ROUND_HALF_UP]:oe.ROUND_HALF_UP,[ih.ROUND_UP]:oe.ROUND_UP},rh={[ih.ROUND_DOWN]:oe.ROUND_DOWN,[ih.ROUND_HALF_UP]:oe.ROUND_HALF_UP,[ih.ROUND_UP]:oe.ROUND_UP};class ah{constructor(e,t=Ot.BigInt(1)){this.numerator=Ot.BigInt(e),this.denominator=Ot.BigInt(t)}static tryParseFraction(e){if(e instanceof Ot||"number"==typeof e||"string"==typeof e)return new ah(e);if("numerator"in e&&"denominator"in e)return e;throw new Error("Could not parse fraction")}get quotient(){return Ot.divide(this.numerator,this.denominator)}get remainder(){return new ah(Ot.remainder(this.numerator,this.denominator),this.denominator)}invert(){return new ah(this.denominator,this.numerator)}add(e){const t=ah.tryParseFraction(e);return Ot.equal(this.denominator,t.denominator)?new ah(Ot.add(this.numerator,t.numerator),this.denominator):new ah(Ot.add(Ot.multiply(this.numerator,t.denominator),Ot.multiply(t.numerator,this.denominator)),Ot.multiply(this.denominator,t.denominator))}subtract(e){const t=ah.tryParseFraction(e);return Ot.equal(this.denominator,t.denominator)?new ah(Ot.subtract(this.numerator,t.numerator),this.denominator):new ah(Ot.subtract(Ot.multiply(this.numerator,t.denominator),Ot.multiply(t.numerator,this.denominator)),Ot.multiply(this.denominator,t.denominator))}lessThan(e){const t=ah.tryParseFraction(e);return Ot.lessThan(Ot.multiply(this.numerator,t.denominator),Ot.multiply(t.numerator,this.denominator))}equalTo(e){const t=ah.tryParseFraction(e);return Ot.equal(Ot.multiply(this.numerator,t.denominator),Ot.multiply(t.numerator,this.denominator))}greaterThan(e){const t=ah.tryParseFraction(e);return Ot.greaterThan(Ot.multiply(this.numerator,t.denominator),Ot.multiply(t.numerator,this.denominator))}multiply(e){const t=ah.tryParseFraction(e);return new ah(Ot.multiply(this.numerator,t.numerator),Ot.multiply(this.denominator,t.denominator))}divide(e){const t=ah.tryParseFraction(e);return new ah(Ot.multiply(this.numerator,t.denominator),Ot.multiply(this.denominator,t.numerator))}toSignificant(e,t={decimalSeparator:".",groupSeparator:"",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:"",fractionGroupSize:0},n=ih.ROUND_HALF_UP){Lt(Number.isInteger(e),`${e} is not an integer.`),Lt(e>0,`${e} is not positive.`);const i=oh[n],o=new oe(this.numerator.toString()).div(this.denominator.toString()).precision(e,i);return o.toFormat(o.decimalPlaces(),i,t)}toFixed(e,t={decimalSeparator:".",groupSeparator:"",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:"",fractionGroupSize:0},n=ih.ROUND_HALF_UP){Lt(Number.isInteger(e),`${e} is not an integer.`),Lt(e>=0,`${e} is negative.`);const i=rh[n];return new oe(this.numerator.toString()).decimalPlaces(e,i).div(this.denominator.toString()).toFormat(e,i,t)}get asFraction(){return new ah(this.numerator,this.denominator)}}const lh=new ah(Ot.BigInt(100));function sh(e){return new dh(e.numerator,e.denominator)}class dh extends ah{constructor(){super(...arguments),this.isPercent=!0}add(e){return sh(super.add(e))}subtract(e){return sh(super.subtract(e))}multiply(e){return sh(super.multiply(e))}divide(e){return sh(super.divide(e))}toSignificant(e=5,t,n){return super.multiply(lh).toSignificant(e,t,n)}toFixed(e=2,t,n){return super.multiply(lh).toFixed(e,t,n)}}function ch(e){const t=new oe(e);if(t.isFinite())return t}Ot.BigInt(Number.MAX_SAFE_INTEGER),Ot.BigInt(0),Ot.BigInt(1),Ot.BigInt(2),Ot.BigInt(0);new dh(Ot.BigInt(1),1e4),new dh(1,100),new dh(3,100),new dh(5,100),new dh(10,100),new dh(15,100);const uh=new dh(0);function ph({mint:e}){const{fetchTokenBalance:t}=ya();return we({queryKey:["token","balance",null==e?void 0:e.toString()],queryFn:()=>Vr(this,void 0,void 0,(function*(){if(!e)return;return(yield t(e.toString())).amount})),enabled:!!e}).data}function hh({state:e,existingPosition:t,slipperValue:n}){const{account:o,chainId:r}=Br(),a=Fs(),{feeAmount:l,selectedMintIndex:s,independentField:d,typedValue:c,leftRangeTypedValue:u,rightRangeTypedValue:p,startPriceTypedValue:h}=e,{mint1:m,mint2:f}=e,[g,x]=K((()=>m&&f?new vt(new Te(m.address).toBuffer()).gt(new vt(new Te(f.address).toBuffer()))?[f,m]:[m,f]:[void 0,void 0]),[m,f]),y=d===Zu.DEPOSIT_1?Zu.DEPOSIT_2:Zu.DEPOSIT_1,[v,b]=K((()=>g&&x?0==s?[g,x]:[x,g]:[void 0,void 0]),[g,x,s]),j=ph({mint:null==v?void 0:v.address}),w=ph({mint:null==b?void 0:b.address}),C=K((()=>({[Zu.DEPOSIT_1]:j,[Zu.DEPOSIT_2]:w})),[j,w]),[k,R,S]=yp(null==m?void 0:m.address,null==f?void 0:f.address,l,r),I=k===gp.NOT_EXISTS,E=K((()=>{if(!x)return;if(I){const e=ch(h);if(!e)return;return 0===s?e:new oe(1).div(e).dp(x.decimals,oe.ROUND_UP)}if(!R||null==R.poolInfo.price)return;return new oe(R.poolInfo.price)}),[x,I,R,h,s]),M=K((()=>{if(!E||null==(null==g?void 0:g.decimals)||null==(null==x?void 0:x.decimals))return!0;const e=Xe.priceToSqrtPriceX64(new jt(E.toString()),null==g?void 0:g.decimals,null==x?void 0:x.decimals);return!(e&&!e.gt(Qe)&&!e.lt(Ke))}),[E,g,x]),T=K((()=>{if(g&&x){if(R){return Object.assign(Object.assign({},R.poolInfo),{mintA:Object.assign(Object.assign({},R.poolInfo.mintA),{chainId:g.chainId,symbol:g.symbol}),mintB:Object.assign(Object.assign({},R.poolInfo.mintB),{chainId:x.chainId,symbol:x.symbol}),tickCurrent:R.computePoolInfo.tickCurrent})}if(l&&E&&!M&&S){const e=xa[r];if(!e)throw new Error("Invalid config");const t=e.config.find((e=>e.tradeFeeRate===l));if(!t)throw new Error("Invalid fee");const{tick:n}=_p({mintDecimalsA:g.decimals,mintDecimalsB:x.decimals,feeAmount:l,price:E,baseIn:0===s});if(null==n)throw new Error("Invalid tick");return{type:"Concentrated",config:t,programId:e.programId.toBase58(),id:S,mintA:Object.assign(Object.assign({},$e({address:g.address,decimals:g.decimals,programId:Ee.toBase58(),extensions:{feeConfig:void 0}})),{chainId:g.chainId,symbol:g.symbol}),mintB:Object.assign(Object.assign({},$e({address:x.address,decimals:x.decimals,programId:Ee.toBase58(),extensions:{feeConfig:void 0}})),{chainId:x.chainId,symbol:x.symbol}),rewardDefaultInfos:[],rewardDefaultPoolInfos:"Clmm",price:E.toNumber(),tickCurrent:n,mintAmountA:0,mintAmountB:0,feeRate:t.tradeFeeRate,openTime:"",tvl:0,day:{volume:0,volumeQuote:0,volumeFee:0,feeApr:0,rewardApr:[0],apr:0,priceMax:0,priceMin:0},week:{volume:0,volumeQuote:0,volumeFee:0,feeApr:0,rewardApr:[0],apr:0,priceMax:0,priceMin:0},month:{volume:0,volumeQuote:0,volumeFee:0,feeApr:0,rewardApr:[0],apr:0,priceMax:0,priceMin:0},pooltype:[],farmUpcomingCount:0,farmOngoingCount:0,farmFinishedCount:0,burnPercent:0}}}}),[r,l,M,g,x,R,S,E,s]),L=K((()=>({[Pu.LOWER]:l?Gp(Ge,Vu[l]):void 0,[Pu.UPPER]:l?Gp(_e,Vu[l]):void 0})),[l]),O=K((()=>{if(t&&t.tickLower&&"number"==typeof(null==t?void 0:t.tickLower)&&t.tickUpper&&"number"==typeof(null==t?void 0:t.tickUpper))return{[Pu.LOWER]:t.tickLower,[Pu.UPPER]:t.tickUpper};if(!g||!x||!l)return{[Pu.LOWER]:void 0,[Pu.UPPER]:void 0};const e="boolean"==typeof u?void 0:ch(u),n="boolean"==typeof p?void 0:ch(p),i=0===s;return{[Pu.LOWER]:"boolean"==typeof u?L[Pu.LOWER]:e?_p({mintDecimalsA:g.decimals,mintDecimalsB:x.decimals,feeAmount:l,price:e,baseIn:i}).tick:void 0,[Pu.UPPER]:"boolean"==typeof p?L[Pu.UPPER]:n?_p({mintDecimalsA:g.decimals,mintDecimalsB:x.decimals,feeAmount:l,price:n,baseIn:i}).tick:void 0}}),[t,l,u,g,x,p,s,L]),{[Pu.LOWER]:W,[Pu.UPPER]:V}=O,A=K((()=>({[Pu.LOWER]:l&&W===L.LOWER,[Pu.UPPER]:l&&V===L.UPPER})),[L,W,V,l]),F=Boolean("number"==typeof W&&"number"==typeof V&&W>=V),Z=K((()=>({[Pu.LOWER]:fp({tick:L.LOWER,decimalsA:null==g?void 0:g.decimals,decimalsB:null==x?void 0:x.decimals}),[Pu.UPPER]:fp({tick:L.UPPER,decimalsA:null==g?void 0:g.decimals,decimalsB:null==x?void 0:x.decimals})})),[null==g?void 0:g.decimals,null==x?void 0:x.decimals,L.LOWER,L.UPPER]),P=K((()=>({[Pu.LOWER]:fp({tick:O[Pu.LOWER],decimalsA:null==g?void 0:g.decimals,decimalsB:null==x?void 0:x.decimals}),[Pu.UPPER]:fp({tick:O[Pu.UPPER],decimalsA:null==g?void 0:g.decimals,decimalsB:null==x?void 0:x.decimals})})),[null==g?void 0:g.decimals,null==x?void 0:x.decimals,O]),{[Pu.LOWER]:B,[Pu.UPPER]:N}=P,U=Boolean(!F&&E&&B&&N&&(E.lt(B)||E.gt(N))),H=K((()=>ch(c)),[c]),[D,Y]=_(void 0);J((()=>{let e=!0;return function(){Vr(this,void 0,void 0,(function*(){try{if(!a||!T||null==W||null==V)return;const t=yield a.fetchEpochInfo(),i=yield et.getLiquidityAmountOutFromAmountIn({poolInfo:T,slippage:n,inputA:!0,tickLower:Math.min(W,V),tickUpper:Math.max(W,V),amount:new vt(new jt(c||"0").mul(10**T.mintA.decimals).toFixed(0)),add:!0,amountHasFee:!0,epochInfo:t});if(e){if(!i.amountSlippageB.amount)return;Y(new oe(i.amountSlippageB.amount.toString()).div(new oe(10**T.mintB.decimals)).dp(T.mintB.decimals,oe.ROUND_UP))}}catch(e){console.error("error",e)}}))}(),()=>{e=!1}}),[T,a,n,W,V,c]);const z=K((()=>({[Zu.DEPOSIT_1]:d===Zu.DEPOSIT_1?H:D,[Zu.DEPOSIT_2]:d===Zu.DEPOSIT_1?D:H})),[D,H,d]),X=Boolean("number"==typeof V&&(null==T?void 0:T.tickCurrent)&&T.tickCurrent>=V),q=Boolean("number"==typeof W&&(null==T?void 0:T.tickCurrent)&&T.tickCurrent<=W),G=F||Boolean(X&&T&&m&&new Te(T.mintA.address).equals(new Te(m.address))||q&&T&&f&&new Te(T.mintA.address).equals(new Te(f.address))),Q=F||Boolean(X&&T&&f&&new Te(T.mintA.address).equals(new Te(f.address))||q&&T&&m&&new Te(T.mintB.address).equals(new Te(m.address))),{inputTax:$,outputTax:ee}=function(){const[{inputTax:e,outputTax:t},n]=_({inputTax:uh,outputTax:uh});return{inputTax:e,outputTax:t}}(),[te,ne]=_();let ie;J((()=>{let e=!0;return function(){Vr(this,void 0,void 0,(function*(){try{if(!a||!T||null==W||null==V)return;const t=yield a.fetchEpochInfo(),i=yield et.getLiquidityAmountOutFromAmountIn({poolInfo:T,slippage:n,inputA:!0,tickLower:Math.min(W,V),tickUpper:Math.max(W,V),amount:new vt(new jt(c||"0").mul(10**T.mintA.decimals).toFixed(0)),add:!0,amountHasFee:!0,epochInfo:t});e&&ne({poolInfo:T,tickLower:W,tickUpper:V,tickLowerPrice:B,tickUpperPrice:N,liquidity:new oe(i.liquidity.toString()),amountA:new oe(i.amountSlippageA.amount.toString()).div(new oe(10**T.mintA.decimals)).dp(T.mintA.decimals,oe.ROUND_UP),amountB:new oe(i.amountSlippageB.amount.toString()).div(new oe(10**T.mintB.decimals)).dp(T.mintB.decimals,oe.ROUND_UP)})}catch(e){console.error("error",e)}}))}(),()=>{e=!1}}),[B,T,P,a,n,W,V,c,N]),o||(ie=i._({id:"r7ScnQ",message:"Connect to a wallet"})),k!==gp.INVALID&&(null==T?void 0:T.mintA.address)!==(null==T?void 0:T.mintB.address)||(ie=null!=ie?ie:i._({id:"R7D79P",message:"Invalid pair"})),M&&(ie=null!=ie?ie:i._({id:"HXBqgG",message:"Invalid price input"})),(z[Zu.DEPOSIT_1]||G)&&(z[Zu.DEPOSIT_2]||Q)||(ie=null!=ie?ie:i._({id:"iPMIoT",message:"Enter an amount"}));const{[Zu.DEPOSIT_1]:re,[Zu.DEPOSIT_2]:ae}=z;re&&(null==j?void 0:j.lt(re))&&(ie=i._({id:"m6RmA/",message:"Insufficient {0} balance",values:{0:null==v?void 0:v.symbol}})),ae&&(null==w?void 0:w.lt(ae))&&(ie=i._({id:"m6RmA/",message:"Insufficient {0} balance",values:{0:null==b?void 0:b.symbol}}));const le=$.greaterThan(0)||ee.greaterThan(0),se=k===gp.INVALID||le;return{mintA:g,mintB:x,dependentField:y,mints:{[Zu.DEPOSIT_1]:v,[Zu.DEPOSIT_2]:b},poolInfo:T,poolState:k,depositBalances:C,parsedAmounts:z,ticks:O,price:E,pricesAtTicks:P,pricesAtLimit:Z,position:te,poolIsNoExisted:I,errorMessage:ie,invalidPool:se,invalidRange:F,outOfRange:U,depositADisabled:G,depositBDisabled:Q,ticksAtLimit:A,isTaxed:le,poolKeys:I||null==R?void 0:R.poolKeys}}function mh({dispatch:e}){return{onField1Input:Q((t=>{e({type:Lu.typeInput,payload:{field:Zu.DEPOSIT_1,typedValue:t}})}),[e]),onField2Input:Q((t=>{e({type:Lu.typeInput,payload:{field:Zu.DEPOSIT_2,typedValue:t}})}),[e]),onLeftRangeInput:Q((t=>{e({type:Lu.typeLeftRangeInput,payload:{typedValue:t}})}),[e]),onRightRangeInput:Q((t=>{e({type:Lu.typeRightRangeInput,payload:{typedValue:t}})}),[e]),onStartPriceInput:Q((t=>{e({type:Lu.typeStartPriceInput,payload:{typedValue:t}})}),[e])}}new dh(1);const fh=new oe(.01);function gh(e){if(e)return e.gt(fh)?e.minus(fh):new oe(0)}const xh=Buffer.from("support_mint","utf8");function yh(e,t){return ot([xh,t.toBuffer()],e)}function vh({params:e,handleGoBack:t,handleGoToPoolList:n}){var o,r,a,l,s,d;const{chainId:c,account:p}=Br(),h=Fs(),m=y(),f=Sa(),{isMobile:g}=Ec(),v=qp({mint:null==e?void 0:e.mint1,chainId:c}),j=qp({mint:null==e?void 0:e.mint2,chainId:c}),[w,C]=ie(Wu,{mint1:v,mint2:j,feeAmount:(null==e?void 0:e.fee)?Number(null==e?void 0:e.fee):void 0,selectedMintIndex:0,independentField:Zu.DEPOSIT_1,typedValue:"",startPriceTypedValue:"1",leftRangeTypedValue:"",rightRangeTypedValue:""});J((()=>{v&&C({type:Lu.UpdateDefaultMint1,payload:v})}),[v]),J((()=>{j&&C({type:Lu.UpdateDefaultMint2,payload:j})}),[j]);const{independentField:k,typedValue:R,startPriceTypedValue:S}=w,{slipper:I,setSlipper:E,slipperValue:T,resetSlipper:O}=Ru({type:u}),{mintA:W,mintB:V,poolInfo:A,poolKeys:F,ticks:Z,dependentField:P,price:B,pricesAtTicks:N,pricesAtLimit:U,parsedAmounts:H,depositBalances:D,position:Y,poolIsNoExisted:z,mints:X,errorMessage:q,invalidPool:G,invalidRange:K,outOfRange:$,depositADisabled:ee,depositBDisabled:te,ticksAtLimit:ne}=hh({state:w,slipperValue:T,existingPosition:void 0}),{onField1Input:re,onField2Input:ae,onLeftRangeInput:le,onRightRangeInput:se,onStartPriceInput:de}=mh({dispatch:C}),ce=!q&&!K,[ue,pe]=_(!1),he={[k]:R,[P]:null!==(r=null===(o=H[P])||void 0===o?void 0:o.toString())&&void 0!==r?r:""},me=[Zu.DEPOSIT_1,Zu.DEPOSIT_2].reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:gh(D[t])})),{}),{[Pu.LOWER]:fe,[Pu.UPPER]:ge}=Z,{[Pu.LOWER]:xe,[Pu.UPPER]:ye}=N,{getDecrementLower:ve,getIncrementLower:be,getDecrementUpper:je,getIncrementUpper:we,getSetFullRange:ke}=function({tickLower:e,tickUpper:t,poolInfo:n,state:i,dispatch:o}){var r,a;const{feeAmount:l}=i,s=null===(r=null==n?void 0:n.mintA)||void 0===r?void 0:r.decimals,d=null===(a=null==n?void 0:n.mintB)||void 0===a?void 0:a.decimals;return{getDecrementLower:Q((()=>{if(!l)return"";const t="number"==typeof e?e:null==n?void 0:n.tickCurrent;if(!t)return"";const i=fp({decimalsA:s,decimalsB:d,tick:t-Vu[l]});return i?i.dp(5,oe.ROUND_UP).toString():""}),[s,d,l,null==n?void 0:n.tickCurrent,e]),getIncrementLower:Q((()=>{if(!l)return"";const t="number"==typeof e?e:null==n?void 0:n.tickCurrent;if(!t)return"";const i=fp({decimalsA:s,decimalsB:d,tick:t+Vu[l]});return i?i.dp(5,oe.ROUND_UP).toString():""}),[s,d,l,null==n?void 0:n.tickCurrent,e]),getDecrementUpper:Q((()=>{if(!l)return"";const e="number"==typeof t?t:null==n?void 0:n.tickCurrent;if(!e)return"";const i=fp({decimalsA:s,decimalsB:d,tick:e-Vu[l]});return i?i.dp(5,oe.ROUND_UP).toString():""}),[s,d,l,null==n?void 0:n.tickCurrent,t]),getIncrementUpper:Q((()=>{if(!l)return"";const e="number"==typeof t?t:null==n?void 0:n.tickCurrent;if(!e)return"";const i=fp({decimalsA:s,decimalsB:d,tick:e+Vu[l]});return i?i.dp(5,oe.ROUND_UP).toString():""}),[s,d,l,null==n?void 0:n.tickCurrent,t]),getSetFullRange:Q((()=>{o({type:Lu.setFullRange,payload:void 0})}),[o])}}({tickLower:fe,tickUpper:ge,poolInfo:A,state:w,dispatch:C}),Re=Q((()=>{ke()}),[ke,le,se,U]),Se=Ce({mutationFn:()=>Vr(this,void 0,void 0,(function*(){if(!p||!c)return;if(!A)throw new Error("poolInfo is undefined");if(!B)throw new Error("price is undefined");if(!h)throw new Error("raydium is undefined");const e=xa[c];if(!e)throw new Error("Invalid config");const n=h.clmm;h.clmm.scope.checkOwner();const o=new rt({connection:n.scope.connection,feePayer:n.scope.ownerPubKey,cluster:n.scope.cluster,owner:n.scope.owner,blockhashCommitment:n.scope.blockhashCommitment,loopMultiTxStatus:n.scope.loopMultiTxStatus,api:n.scope.api,signAllTransactions:n.scope.signAllTransactions}),r=z?yield function(e){return Vr(this,void 0,void 0,(function*(){var t;const{programId:n,mint1:i,mint2:o,ammConfig:r,initialPrice:a,computeBudgetConfig:l,forerunCreate:s,getObserveState:d,txVersion:c,txTipConfig:u,feePayer:p,clmm:h,txBuilder:m}=e,f=(null===(t=h.scope.owner)||void 0===t?void 0:t.publicKey)||Te.default,[g,x,y]=new vt(new Te(i.address).toBuffer()).gt(new vt(new Te(o.address).toBuffer()))?[o,i,new jt(1).div(a)]:[i,o,a],v=Xe.priceToSqrtPriceX64(y,g.decimals,x.decimals),b=[],j=[];g.programId===Me.toBase58()&&j.push(yh(n,new Te(g.address)).publicKey),x.programId===Me.toBase58()&&j.push(yh(n,new Te(x.address)).publicKey),(yield h.scope.connection.getMultipleAccountsInfo(j)).forEach(((e,t)=>{e&&b.push(j[t])}));const w=yield tt.createPoolInstructions({connection:h.scope.connection,programId:n,owner:f,mintA:g,mintB:x,ammConfigId:r.id,initialPriceX64:v,forerunCreate:!d&&s,extendMintAccount:b});return m.addInstruction(w),{address:Object.assign(Object.assign({},w.address),{observationId:w.address.observationId.toBase58(),exBitmapAccount:w.address.exBitmapAccount.toBase58(),programId:n.toString(),id:w.address.poolId.toString(),mintA:g,mintB:x,openTime:"0",vault:{A:w.address.mintAVault.toString(),B:w.address.mintBVault.toString()},rewardInfos:[],config:{id:r.id.toString(),index:r.index,protocolFeeRate:r.protocolFeeRate,tradeFeeRate:r.tradeFeeRate,tickSpacing:r.tickSpacing,fundFeeRate:r.fundFeeRate,description:r.description,defaultRange:0,defaultRangePoint:[]}}),mockPoolInfo:Object.assign({type:"Concentrated",rewardDefaultPoolInfos:"Clmm",id:w.address.poolId.toString(),mintA:g,mintB:x,feeRate:r.tradeFeeRate,openTime:"0",programId:n.toString(),price:y.toNumber(),config:{id:r.id.toString(),index:r.index,protocolFeeRate:r.protocolFeeRate,tradeFeeRate:r.tradeFeeRate,tickSpacing:r.tickSpacing,fundFeeRate:r.fundFeeRate,description:r.description,defaultRange:0,defaultRangePoint:[]},burnPercent:0},nt),forerunCreate:s}}))}({programId:e.programId,mint1:A.mintA,mint2:A.mintB,ammConfig:Object.assign(Object.assign({},A.config),{id:new Te(A.config.id),fundOwner:"",description:""}),initialPrice:new jt(B.toString()),clmm:n,txBuilder:o}):void 0;if(!Y)throw new Error("position is undefined");const a=yield function(e){return Vr(this,arguments,void 0,(function*({poolInfo:e,poolKeys:t,ownerInfo:n,tickLower:i,tickUpper:o,base:r,baseAmount:a,otherAmountMax:l,nft2022:s,associatedOnly:d=!0,checkCreateATAOwner:c=!1,withMetadata:u="create",getEphemeralSigners:p,computeBudgetConfig:h,txTipConfig:m,txVersion:f,feePayer:g,clmm:x,txBuilder:y}){!1===x.scope.availability.addConcentratedPosition&&x.logAndCreateError("add position feature disabled in your region");let v=null,b=null;const j=n.useSOLBalance&&e.mintA.address===it.toString(),w=n.useSOLBalance&&e.mintB.address===it.toString(),[C,k]="MintA"===r?[a,l]:[l,a],{account:R,instructionParams:S}=yield x.scope.account.getOrCreateTokenAccount({tokenProgram:e.mintA.programId,mint:new Te(e.mintA.address),owner:x.scope.ownerPubKey,createInfo:j||C.isZero()?{payer:x.scope.ownerPubKey,amount:C}:void 0,skipCloseAccount:!j,notUseTokenAccount:j,associatedOnly:!j&&d,checkCreateATAOwner:c});R&&(v=R),y.addInstruction(S||{});const{account:I,instructionParams:E}=yield x.scope.account.getOrCreateTokenAccount({tokenProgram:e.mintB.programId,mint:new Te(e.mintB.address),owner:x.scope.ownerPubKey,createInfo:w||k.isZero()?{payer:x.scope.ownerPubKey,amount:k}:void 0,skipCloseAccount:!w,notUseTokenAccount:w,associatedOnly:!w&&d,checkCreateATAOwner:c});I&&(b=I),y.addInstruction(E||{}),v&&b||x.logAndCreateError("cannot found target token accounts","tokenAccounts",{ownerTokenAccountA:null==v?void 0:v.toBase58(),ownerTokenAccountB:null==b?void 0:b.toBase58()});const M=t||(yield x.getClmmPoolKeys(e.id)),T=yield tt.openPositionFromBaseInstructions({poolInfo:e,poolKeys:M,ownerInfo:Object.assign(Object.assign({},n),{feePayer:x.scope.ownerPubKey,wallet:x.scope.ownerPubKey,tokenAccountA:v,tokenAccountB:b}),tickLower:i,tickUpper:o,base:r,baseAmount:a,otherAmountMax:l,withMetadata:u,getEphemeralSigners:p,nft2022:s});return y.addInstruction(T),Object.assign({},T.address)}))}({poolInfo:A,poolKeys:null!=F?F:null==r?void 0:r.address,tickUpper:Math.max(Y.tickLower,Y.tickUpper),tickLower:Math.min(Y.tickLower,Y.tickUpper),base:"MintA",ownerInfo:{useSOLBalance:!0},baseAmount:new vt(new jt(R||"0").mul(10**A.mintA.decimals).toFixed(0)),otherAmountMax:new vt(Y.amountB.multipliedBy(new oe(10**A.mintB.decimals)).toFixed(0)),clmm:n,txBuilder:o});o.addCustomComputeBudget({units:6e5,microLamports:1e3});const{transaction:l,signers:s}=yield o.versionBuild({txVersion:He.LEGACY,extInfo:a});const d=yield f.executeCustom({brief:z?i._({id:"8OiU8L",message:"Pool Creation"}):i._({id:"OBdohg",message:"Add Liquidity"}),metadata:{[z?Ur.createAMMV3Pool:Ur.addAMMV3Pool]:!0},handler:e=>Vr(this,void 0,void 0,(function*(){const{txId:t}=yield function(){return Vr(this,void 0,void 0,(function*(){var e,t,i;if(!h)throw new Error("raydium is undefined");const o=yield at(h.connection,h.blockhashCommitment);l.recentBlockhash=o,s.length&&l.sign(...s),lt([l]);const r=yield null===(t=(e=n.scope).signAllTransactions)||void 0===t?void 0:t.call(e,[l]);if(s.length)for(const e of r);const a=null===(i=null==r?void 0:r[0])||void 0===i?void 0:i.serialize();if(!a)throw new Error("rawTransaction is undefined");return{txId:yield n.scope.connection.sendRawTransaction(a,{skipPreflight:!0}),signedTx:null==r?void 0:r[0]}}))}();e.onSuccess(t)})),successBack:()=>{t()},submittedBack:()=>{t()}});return d})),onError:e=>{console.error(e)}}),Ie=W&&V?0===w.selectedMintIndex?`${null==V?void 0:V.symbol} per ${null==W?void 0:W.symbol}`:`${null==W?void 0:W.symbol} per ${null==V?void 0:V.symbol}`:"-";return Gt.jsx(_c,{children:Gt.jsxs(x,{sx:{mx:"auto",borderRadius:g?0:16,backgroundColor:"background.paper",width:g?"100%":600,display:"flex",flexDirection:"column",alignItems:"stretch"},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",px:20,py:24,borderTopLeftRadius:16,borderTopRightRadius:16,backgroundColor:m.palette.background.paper},children:[Gt.jsx(x,{component:M,onClick:t,sx:{flexGrow:0,flexShrink:0,display:"flex",alignItems:"center",color:m.palette.text.primary,width:24,height:24},children:Gt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",children:Gt.jsx("path",{d:"M20 11.5H7.83L13.42 5.91L12 4.5L4 12.5L12 20.5L13.41 19.09L7.83 13.5H20V11.5Z",fill:"currentColor"})})}),Gt.jsx(x,{sx:{flexGrow:1,textAlign:"center",typography:"caption",color:m.palette.text.primary},children:i._({id:"E6MqGy",message:"Add liquidity"})}),Gt.jsx(x,{sx:{flexGrow:0,flexShrink:0,width:24,height:24}})]}),Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column",alignItems:"stretch",gap:20,p:20},children:[Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column",alignItems:"stretch",gap:12},children:[Gt.jsx(x,{sx:{typography:"body1",fontWeight:600,color:m.palette.text.primary,textAlign:"left"},children:i._({id:"nxRg31",message:"Select pair"})}),Gt.jsx(Xp,{mint1:w.mint1,mint2:w.mint2,dispatch:C}),Gt.jsx(Fu,{disabled:!w.mint1||!w.mint2,feeAmount:w.feeAmount,dispatch:C})]}),Gt.jsxs(_u,{disabled:!w.feeAmount||G,children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[Gt.jsx(x,{sx:{typography:"body1",fontWeight:600,color:m.palette.text.primary,textAlign:"left"},children:i._({id:"5CZbyC",message:"Set price range"})}),W&&V&&Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:8,width:"100%",[m.breakpoints.up("tablet")]:{ml:"auto",width:"auto"}},children:[Gt.jsx(b,{size:b.Size.small,variant:b.Variant.outlined,onClick:Re,sx:Object.assign({py:4,px:12,height:26,typography:"h6",fontWeight:600},g?{flexGrow:0,flexShrink:1,flexBasis:"50%"}:void 0),children:i._({id:"5IHTSS",message:"Full range"})}),Gt.jsx(Tp,{mintA:W,mintB:V,selectedMintIndex:w.selectedMintIndex,handleRateToggle:()=>{C({type:Lu.UpdateSelectedMintIndex,payload:0===w.selectedMintIndex?1:0})},sx:g?{flexGrow:0,flexShrink:1,flexBasis:"50%"}:void 0})]})]}),Gt.jsx(Mp,{priceLower:xe,priceUpper:ye,getDecrementLower:ve,getIncrementLower:be,getDecrementUpper:je,getIncrementUpper:we,onLeftRangeInput:le,onRightRangeInput:se,ticksAtLimit:ne,perPriceText:Ie}),$&&Gt.jsx(Du,{children:i._({id:"b+KjnH",message:"Your position will not earn fees or be used in trades until the market price moves into your range."})}),K&&Gt.jsx(Du,{children:i._({id:"Jh223O",message:"Invalid range selected. The min price must be lower than the max price."})})]}),z?Gt.jsxs(_u,{children:[Gt.jsx(x,{sx:{typography:"body1",fontWeight:600,color:m.palette.text.primary,textAlign:"left"},children:i._({id:"zeSosD",message:"Starting price"})}),Gt.jsx(x,{sx:{p:8,borderRadius:8,backgroundColor:L(m.palette.primary.main,.1),typography:"h6",color:m.palette.primary.main},children:i._({id:"X6T02b",message:"This pool must be initialized before you can add liquidity. To initialize, select a starting price for the pool. Then, enter your liquidity price range and deposit amount. Gas fees will be higher than usual due to the initialization transaction."})}),Gt.jsx(x,{sx:{px:16,py:12,borderRadius:8,borderWidth:1,borderColor:m.palette.border.main,borderStyle:"solid"},children:Gt.jsx(Ic,{sx:{backgroundColor:"transparent"},value:S,onChange:de,suffix:Gt.jsx(x,{sx:{typography:"h6",color:m.palette.text.secondary},children:Ie})})})]}):Gt.jsxs(_u,{disabled:!w.feeAmount||G,children:[Gt.jsxs(x,{sx:{typography:"body1",fontWeight:600,color:m.palette.text.primary,textAlign:"left"},children:[i._({id:"DWd30U",message:"Current price"}),Gt.jsxs(x,{children:[Kr({input:B,decimals:9})," ",i._({id:"b2jAb+",message:"per"})," ",null!==(l=null===(a=w.mint1)||void 0===a?void 0:a.symbol)&&void 0!==l?l:""]})]}),Gt.jsx(Ip,{mint1:w.mint1,mint2:w.mint2,feeAmount:w.feeAmount,ticksAtLimit:ne,price:B?B.toNumber():void 0,priceLower:xe,priceUpper:ye,onLeftRangeInput:le,onRightRangeInput:se,interactive:!0})]}),Gt.jsxs(_u,{disabled:G||K||z&&!S,children:[Gt.jsx(x,{sx:{typography:"body1",fontWeight:600,color:m.palette.text.primary,textAlign:"left"},children:i._({id:"MU9s7M",message:"Deposit amounts"})}),Gt.jsxs(x,{children:[Gt.jsx(Tu,{value:he[Zu.DEPOSIT_1],onUserInput:re,maxAmount:me[Zu.DEPOSIT_1],balance:D[Zu.DEPOSIT_1],mint:null!==(s=X[Zu.DEPOSIT_1])&&void 0!==s?s:null,locked:ee}),Gt.jsx(Nc,{}),Gt.jsx(Tu,{value:he[Zu.DEPOSIT_2],onUserInput:ae,maxAmount:me[Zu.DEPOSIT_2],balance:D[Zu.DEPOSIT_2],mint:null!==(d=X[Zu.DEPOSIT_2])&&void 0!==d?d:null,locked:te})]}),Gt.jsx(Su,{value:I,onChange:E,disabled:!1,type:u})]})]}),Gt.jsx(x,{sx:{display:"flex",alignItems:"center",px:20,py:16,borderBottomLeftRadius:16,borderBottomRightRadius:16,backgroundColor:m.palette.background.paper},children:Gt.jsx(Iu,{chainId:c,isValid:ce,errorMessage:q,setShowConfirm:pe})}),Gt.jsx(Up,{position:Y,outOfRange:$,ticksAtLimit:ne,on:ue,onClose:()=>{pe(!1)},onConfirm:Se.mutate,loading:Se.isPending})]})})}function bh({title:e,desc:t,linkTo:i,LeftImage:o,sx:r}){const a=y(),l="light"===a.palette.mode;return Gt.jsxs(x,{sx:Object.assign({backgroundColor:a.palette.background.paper,borderRadius:16,padding:20},r),children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start"},children:[Gt.jsx(x,{sx:{backgroundColor:L(a.palette.secondary.main,.3),color:l?"#EB8D27":a.palette.secondary.main,borderRadius:6,width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center"},children:Gt.jsx("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",children:Gt.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.55558 0.888672C3.87558 0.888672 0.888916 3.87534 0.888916 7.55534C0.888916 11.2353 3.87558 14.222 7.55558 14.222C11.2356 14.222 14.2222 11.2353 14.2222 7.55534C14.2222 3.87534 11.2356 0.888672 7.55558 0.888672ZM8.22225 11.5553V10.222H6.88892V11.5553H8.22225ZM4.88892 6.22201C4.88892 4.74867 6.08225 3.55534 7.55558 3.55534C9.02892 3.55534 10.2222 4.74867 10.2222 6.22201C10.2222 7.07728 9.69557 7.53755 9.18276 7.9857C8.69626 8.41085 8.22225 8.82509 8.22225 9.55534H6.88892C6.88892 8.34116 7.51699 7.85973 8.06921 7.43646C8.50241 7.10441 8.88892 6.80815 8.88892 6.22201C8.88892 5.48867 8.28892 4.88867 7.55558 4.88867C6.82225 4.88867 6.22225 5.48867 6.22225 6.22201H4.88892Z",fill:"currentColor"})})}),Gt.jsx(x,{sx:{color:a.palette.text.primary,typography:"body1",fontWeight:600,ml:4},children:Gt.jsx(n,{id:"cmUrtC",message:"SEE HOW IT WORKS"})})]}),Gt.jsxs(x,{sx:{mt:20,borderTopWidth:1,pt:20,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[Gt.jsx(x,{component:o,sx:{width:64,height:64,flexShrink:0}}),Gt.jsxs(x,{sx:{ml:16,color:a.palette.text.primary,typography:"body1",fontWeight:600},children:[e,Gt.jsx(x,{sx:{mt:4,color:a.palette.text.secondary,typography:"body2",fontWeight:500},children:t})]})]}),Gt.jsx(x,{component:"a",href:i,target:"_blank",rel:"noopener noreferrer",sx:{pl:16,flexShrink:0},children:Gt.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:Gt.jsx("path",{d:"M7.23375 3.75L6 4.98375L10.0075 9L6 13.0162L7.23375 14.25L12.4838 9L7.23375 3.75Z",fill:a.palette.text.primary})})})]})]})}const jh=[{value:0,label:"0%"},{value:25,label:"25%"},{value:50,label:"50%"},{value:75,label:"75%"},{value:100,label:"100%"}];function wh({disabled:e,value:t,onChange:n,sx:i}){return Gt.jsxs(x,{sx:Object.assign({p:20,backgroundColor:"background.input",borderRadius:12},i),children:[Gt.jsx(Ic,{value:String(t),onChange:e=>n(+e),readOnly:!0,readonlyShowSuffix:!0,suffix:Gt.jsx(x,{sx:{typography:"h2"},children:"%"}),sx:{mt:12,"& input":{pl:0,typography:"h1"}}}),Gt.jsx(x,{sx:{mt:20},children:Gt.jsx(N,{marks:jh,step:1,disabled:e,value:t,onChange:(e,t)=>n(t)})})]})}const Ch=50;var kh;!function(e){e[e.quantity=1]="quantity",e[e.percentage=2]="percentage"}(kh||(kh={}));const Rh=({chainId:e,disabled:t,isLoading:n,onConfirm:o})=>Gt.jsx(gc,{includeButton:!0,fullWidth:!0,chainId:e,children:Gt.jsx(b,{fullWidth:!0,size:b.Size.big,onClick:o,disabled:t,isLoading:n,children:i._({id:"h5pjuM",message:"Collect fees"})})}),Sh=({mint:e,pooledAmount:t})=>{var n;const i=y();return Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4},children:[Gt.jsx(Ms,{address:null!==(n=null==e?void 0:e.address)&&void 0!==n?n:"",chainId:null==e?void 0:e.chainId,noShowChain:!0,width:18,height:18,marginRight:0}),Gt.jsxs(x,{sx:{typography:"body1",color:i.palette.text.primary},children:[Kr({input:t,decimals:null==e?void 0:e.decimals})," ",null==e?void 0:e.symbol]}),Gt.jsx(M,{sx:{display:"flex",alignItems:"center",color:i.palette.text.secondary,"&:hover":{color:i.palette.text.primary}},onClick:()=>{e&&window.open(Fc(e.chainId,e.address,"address"))},children:Gt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:Gt.jsx("path",{opacity:"0.5",fillRule:"evenodd",clipRule:"evenodd",d:"M3.33333 3.33333V12.6667H12.6667V8H14V12.6667C14 13.4 13.4 14 12.6667 14H3.33333C2.59333 14 2 13.4 2 12.6667V3.33333C2 2.6 2.59333 2 3.33333 2H8V3.33333H3.33333ZM9.33333 3.33333V2H14V6.66667H12.6667V4.27333L6.11333 10.8267L5.17333 9.88667L11.7267 3.33333H9.33333Z",fill:"currentColor"})})})]})},Ih=({mintA:e,mintB:t,feeAmount:o,existingPosition:r,positionInfo:a,inRange:l,removed:s})=>{const d=y();return Gt.jsxs(x,{sx:{border:"solid 1px",borderColor:"border.main",borderRadius:8},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",p:d.spacing(12,20),borderBottomStyle:"solid",borderBottomColor:"border.main",borderBottomWidth:1},children:[Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:4},children:[Gt.jsxs(x,{sx:{typography:"body2",color:d.palette.text.primary},children:[i._({id:"PVa3KL",message:"Position on"})," ",null==e?void 0:e.symbol,"/",null==t?void 0:t.symbol]}),Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4},children:[Gt.jsx(Zp,{removed:s,inRange:l}),Gt.jsx(x,{sx:{py:4,px:8,color:d.palette.primary.main,borderRadius:4,backgroundColor:L(d.palette.primary.main,.1),typography:"h6"},children:Ap({type:u,lpFeeRate:o,mtFeeRate:0})})]})]}),Gt.jsxs(M,{sx:{display:"flex",alignItems:"center",gap:0,typography:"body2",color:d.palette.text.secondary,"&:hover":{color:d.palette.text.primary}},onClick:()=>{(null==e?void 0:e.chainId)&&window.open(Fc(e.chainId,null==r?void 0:r.poolId.toBase58(),"address"))},children:[i._({id:"URmyfc",message:"Details"}),Gt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"19",viewBox:"0 0 18 19",fill:"none",children:Gt.jsx("path",{d:"M7.5 5L6.4425 6.0575L9.8775 9.5L6.4425 12.9425L7.5 14L12 9.5L7.5 5Z",fill:"currentColor"})})]})]}),Gt.jsxs(x,{sx:{p:d.spacing(12,20)},children:[Gt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:Gt.jsx(n,{id:"YHc3B+",message:"My Liquidity"})}),Gt.jsxs(x,{sx:{mt:12},children:[Gt.jsx(Sh,{mint:e,pooledAmount:null==a?void 0:a.pooledAmountA}),Gt.jsx(Sh,{mint:t,pooledAmount:null==a?void 0:a.pooledAmountB})]})]})]})},Eh=({chainId:e,disabled:t,removed:n,isLoading:o,onConfirm:r})=>Gt.jsx(gc,{includeButton:!0,fullWidth:!0,chainId:e,children:Gt.jsx(b,{fullWidth:!0,size:b.Size.big,onClick:r,disabled:t,isLoading:o,children:n?i._({id:"D87pha",message:"Closed"}):i._({id:"t/YqKh",message:"Remove"})})});function Mh({position:e}){const t=Fs(),[,n]=xp(e?e.poolId.toBase58():null),{data:i}=we({queryKey:["clmm","getPositionInfo",e,null==n?void 0:n.poolInfo],enabled:!!e&&!!(null==n?void 0:n.poolInfo),queryFn:()=>Vr(this,void 0,void 0,(function*(){const i=null==n?void 0:n.poolInfo;if(!i||!t||!e)return null;const o=st.getTickPrice({poolInfo:i,tick:e.tickLower,baseIn:!0}),r=st.getTickPrice({poolInfo:i,tick:e.tickUpper,baseIn:!0}),a=yield t.connection.getEpochInfo(),{amountA:l,amountB:s}=dt.getAmountsFromLiquidity({poolInfo:i,ownerPosition:e,liquidity:e.liquidity,slippage:0,add:!1,epochInfo:a}),[d,c]=[new oe(l.amount.toString()).div(10**i.mintA.decimals),new oe(s.amount.toString()).div(10**i.mintB.decimals)],[u,p]=[st.getTickArrayAddressByTick(new Te(i.programId),new Te(i.id),e.tickLower,i.config.tickSpacing),st.getTickArrayAddressByTick(new Te(i.programId),new Te(i.id),e.tickUpper,i.config.tickSpacing)],h=yield t.connection.getMultipleAccountsInfo([u,p]);if(!h[0]||!h[1])throw new Error("tick data not found");const m=ct.decode(h[0].data),f=ct.decode(h[1].data),g=m.ticks[st.getTickOffsetInArray(e.tickLower,i.config.tickSpacing)],x=f.ticks[st.getTickOffsetInArray(e.tickUpper,i.config.tickSpacing)],y=yield t.clmm.getRpcClmmPoolInfo({poolId:e.poolId}),v=dt.GetPositionFeesV2(y,e,g,x),b=dt.GetPositionRewardsV2(y,e,g,x),[j,w]=[v.tokenFeeAmountA.gte(new vt(0))&&v.tokenFeeAmountA.lt(ut)?v.tokenFeeAmountA:new vt(0),v.tokenFeeAmountB.gte(new vt(0))&&v.tokenFeeAmountB.lt(ut)?v.tokenFeeAmountB:new vt(0)],[C,k]=[{mint:i.mintA,amount:new jt(j.toString()).div(10**i.mintA.decimals).toDecimalPlaces(i.mintA.decimals)},{mint:i.mintB,amount:new jt(w.toString()).div(10**i.mintB.decimals).toDecimalPlaces(i.mintB.decimals)}],R=b.map((e=>e.gte(new vt(0))&&e.lt(ut)?e:new vt(0))),S=R.map(((e,t)=>{var n;const o=null===(n=i.rewardDefaultInfos.find((e=>e.mint.address===y.rewardInfos[t].tokenMint.toBase58())))||void 0===n?void 0:n.mint;if(o)return{mint:o,amount:new jt(e.toString()).div(10**o.decimals).toDecimalPlaces(o.decimals)}})).filter(Boolean),I=S.findIndex((e=>e.mint.address===i.mintA.address));S[I]?S[I].amount=S[I].amount.add(C.amount):S.push(C);const E=S.findIndex((e=>e.mint.address===i.mintB.address));return S[E]?S[E].amount=S[E].amount.add(k.amount):S.push(k),{pooledAmountA:d,pooledAmountB:c,priceLower:new oe(o.price.toString()),priceUpper:new oe(r.price.toString()),rewardInfos:S.map((e=>({mint:e.mint,amount:e.amount.toString()})))}}))});return{pool:n,positionInfo:null!=i?i:null}}function Th(e){var t;const n=Fs(),i=we({queryKey:["clmm","getOwnerPositionInfo",e,null==n?void 0:n.owner],enabled:null!=e&&null!=n&&null!=n.owner,queryFn:()=>Vr(this,void 0,void 0,(function*(){if(!n||!n.owner||!e)return null;const t=xa[e];if(!t)throw new Error("Invalid config");try{const e=yield n.clmm.getOwnerPositionInfo({programId:t.programId});return e.forEach((e=>{console.log("getOwnerPositionInfo p",e.poolId.toBase58(),e.rewardInfos,e.tokenFeesOwedA.toString(),e.tokenFeesOwedB.toString(),e.nftMint.toBase58(),e.liquidity.toString(),e.tickLower,e.tickUpper)})),{allPosition:e}}catch(e){return console.error("getOwnerPositionInfo error",e),null}}))});return{loading:i.isLoading,positions:null===(t=i.data)||void 0===t?void 0:t.allPosition}}const Lh=({mint:e,amount:t})=>{var n;const i=y(),{chainId:o}=Br(),r=qp({mint:null==e?void 0:e.address,chainId:o});return Gt.jsxs(x,{sx:{py:8,display:"flex",alignItems:"center",gap:6,typography:"h5",color:i.palette.text.primary},children:[Gt.jsx(Ms,{address:null!==(n=null==r?void 0:r.address)&&void 0!==n?n:"",chainId:null==r?void 0:r.chainId,noShowChain:!0,width:24,height:24,marginRight:0}),Gt.jsx(x,{children:null==r?void 0:r.symbol}),Gt.jsx(x,{sx:{ml:"auto"},children:t})]})},Oh=({mint1Address:e,mint2Address:t,feeAmount:n,poolId:o,nftMint:r,onClose:a})=>{const{isMobile:l}=Ec(),s=y(),d=Sa(),c=je(),{account:p,chainId:h}=Br(),m=Fs(),{position:f}=function({chainId:e,nftMint:t,poolId:n}){const i=Th(e);return{position:K((()=>{if(i.positions)return i.positions.find((e=>e.nftMint.equals(new Te(t))&&e.poolId.equals(new Te(n))))}),[i,t,n]),loading:i.loading}}({chainId:h,nftMint:r,poolId:o}),{positionInfo:g,pool:v}=Mh({position:f}),[b,j]=_("stake"),[w,C]=_(!1),[k,R]=_(Ch),S=qp({mint:e,chainId:h}),I=qp({mint:t,chainId:h}),[E,M]=ie(Wu,{mint1:S,mint2:I,feeAmount:n,selectedMintIndex:0,independentField:Zu.DEPOSIT_1,typedValue:"",startPriceTypedValue:"",leftRangeTypedValue:"",rightRangeTypedValue:""});J((()=>{S&&M({type:Lu.UpdateDefaultMint1,payload:S})}),[S]),J((()=>{I&&M({type:Lu.UpdateDefaultMint2,payload:I})}),[I]);const{independentField:T,typedValue:L}=E,{slipper:O,setSlipper:W,slipperValue:V}=Ru({type:u}),{mintA:A,mintB:F,dependentField:Z,parsedAmounts:P,depositBalances:B,position:N,mints:Y,errorMessage:z,invalidRange:X,outOfRange:q,depositADisabled:G,depositBDisabled:Q,ticksAtLimit:$}=hh({state:E,existingPosition:f,slipperValue:V}),ee=(null==f?void 0:f.liquidity)&&f.liquidity.eq(new vt(0)),{onField1Input:te,onField2Input:ne}=mh({dispatch:M}),re=!z&&!X,ae=K((()=>{var e,t;return{[T]:L,[Z]:null!==(t=null===(e=P[Z])||void 0===e?void 0:e.toString())&&void 0!==t?t:""}}),[Z,T,P,L]),le=[Zu.DEPOSIT_1,Zu.DEPOSIT_2].reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:gh(B[t])})),{}),se=Ce({mutationFn:()=>Vr(void 0,void 0,void 0,(function*(){if(!p)throw new Error("account is undefined");if(!m)throw new Error("raydium is undefined");if(!f)throw new Error("existingPosition is undefined");if(!(null==v?void 0:v.poolInfo))throw new Error("poolInfo is undefined");if(!N)throw new Error("position is undefined");const{execute:e}=yield m.clmm.increasePositionFromLiquidity({poolInfo:v.poolInfo,poolKeys:v.poolKeys,ownerPosition:f,ownerInfo:{useSOLBalance:!0},liquidity:new vt(new jt(N.liquidity.toString()).mul(1-V).toFixed(0)),amountMaxA:new vt(new jt(L||"0").mul(10**v.poolInfo.mintA.decimals).toFixed(0)),amountMaxB:new vt(N.amountB.multipliedBy(1+V).multipliedBy(new oe(10**v.poolInfo.mintB.decimals)).toFixed(0)),checkCreateATAOwner:!0,txVersion:He.LEGACY});(yield d.executeCustom({brief:i._({id:"OBdohg",message:"Add Liquidity"}),metadata:{[Ur.addAMMV3Pool]:!0},handler:t=>Vr(void 0,void 0,void 0,(function*(){const{txId:n}=yield e({sendAndConfirm:!0});t.onSuccess(n)}))}))===Hr.Success&&(C(!1),setTimeout((()=>{null==a||a()}),100)),c.invalidateQueries({queryKey:["clmm"],refetchType:"all"})})),onError:e=>{console.error(e)}}),de=Ce({mutationFn:()=>Vr(void 0,void 0,void 0,(function*(){if(!p)throw new Error("account is undefined");if(!m)throw new Error("raydium is undefined");if(!f)throw new Error("existingPosition is undefined");if(!(null==v?void 0:v.poolInfo))throw new Error("poolInfo is undefined");const e=new vt(new jt(f.liquidity.toString()).mul(k/100).toFixed(0)),{execute:t}=yield m.clmm.decreaseLiquidity({poolInfo:v.poolInfo,poolKeys:v.poolKeys,ownerPosition:f,ownerInfo:{useSOLBalance:!0,closePosition:!1},liquidity:e,amountMinA:new vt(0),amountMinB:new vt(0),txVersion:He.LEGACY});(yield d.executeCustom({brief:i._({id:"3XBvkd",message:"Remove Liquidity"}),metadata:{[Ur.removeAMMV3Pool]:!0},handler:e=>Vr(void 0,void 0,void 0,(function*(){const{txId:n}=yield t({sendAndConfirm:!0});e.onSuccess(n)}))}))===Hr.Success&&setTimeout((()=>{null==a||a()}),100),c.invalidateQueries({queryKey:["clmm"],refetchType:"all"})})),onError:e=>{console.error("onRemoveMutation",e)}}),ce=Ce({mutationFn:()=>Vr(void 0,void 0,void 0,(function*(){if(!m)throw new Error("raydium is undefined");if(!f)throw new Error("existingPosition is undefined");if(!(null==v?void 0:v.poolInfo))throw new Error("poolInfo is undefined");const{execute:e}=yield m.clmm.decreaseLiquidity({poolInfo:v.poolInfo,poolKeys:v.poolKeys,ownerPosition:f,ownerInfo:{useSOLBalance:!0,closePosition:!1},liquidity:new vt(0),amountMinA:new vt(0),amountMinB:new vt(0),txVersion:He.LEGACY});(yield d.executeCustom({brief:i._({id:"zXCpR0",message:"Claim Rewards"}),metadata:{[Ur.claimAMMV3Pool]:!0},handler:t=>Vr(void 0,void 0,void 0,(function*(){const{txId:n}=yield e();t.onSuccess(n)}))}))===Hr.Success&&setTimeout((()=>{null==a||a()}),100),c.invalidateQueries({queryKey:["clmm"],refetchType:"all"})})),onError:e=>{console.error("onClaimMutation",e)}}),ue=K((()=>{var e,t;const o=[{key:"stake",value:i._({id:"JYKRJS",message:"Stake"})},{key:"unstake",value:i._({id:"OFjZGo",message:"Unstake"})},{key:"claim",value:i._({id:"hom7qf",message:"Claim"})}];return Gt.jsxs(x,{sx:{borderRadius:16,backgroundColor:s.palette.background.paper},children:[Gt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",px:20,py:24,borderTopLeftRadius:16,borderTopRightRadius:16,backgroundColor:s.palette.background.paper},children:[Gt.jsx(x,{sx:{typography:"body1",fontWeight:600,color:s.palette.text.primary},children:i._({id:"E6MqGy",message:"Add liquidity"})}),a?Gt.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:24,height:24,borderRadius:"50%",borderWidth:1,color:"text.secondary",cursor:"pointer"},children:Gt.jsx(x,{component:Ft.Error,sx:{width:16,height:16},onClick:()=>{a()}})}):void 0]}),Gt.jsx(x,{sx:{mx:20,mb:16},children:Gt.jsx(Ih,{existingPosition:f,positionInfo:g,inRange:!q,removed:ee,mintA:A,mintB:F,feeAmount:n})}),Gt.jsxs(U,{value:b,onChange:(e,t)=>{j(t)},children:[Gt.jsx(H,{tabs:o,variant:"inPaper",tabsListSx:{mx:20}}),Gt.jsxs(D,{value:"stake",children:[N&&Gt.jsx(x,{sx:{mt:16,mx:20},children:Gt.jsx(Bp,{position:N,title:i._({id:"3VUfrF",message:"Selected Range"}),ticksAtLimit:$})}),Gt.jsxs(x,{sx:{mt:16,mx:20,display:"flex",flexDirection:"column",alignItems:"stretch",gap:12},children:[Gt.jsx(x,{sx:{typography:"body1",fontWeight:600,color:s.palette.text.secondary,textAlign:"left"},children:i._({id:"BRi+RY",message:"Add more liquidity"})}),Gt.jsxs(x,{children:[Gt.jsx(Tu,{value:ae[Zu.DEPOSIT_1],onUserInput:te,maxAmount:le[Zu.DEPOSIT_1],balance:B[Zu.DEPOSIT_1],mint:null!==(e=Y[Zu.DEPOSIT_1])&&void 0!==e?e:null,locked:G}),Gt.jsx(Nc,{}),Gt.jsx(Tu,{value:ae[Zu.DEPOSIT_2],onUserInput:ne,maxAmount:le[Zu.DEPOSIT_2],balance:B[Zu.DEPOSIT_2],mint:null!==(t=Y[Zu.DEPOSIT_2])&&void 0!==t?t:null,locked:Q})]}),Gt.jsx(Su,{value:O,onChange:W,disabled:!1,type:u})]}),Gt.jsx(x,{sx:{display:"flex",alignItems:"center",px:20,py:16,borderBottomLeftRadius:16,borderBottomRightRadius:16,backgroundColor:s.palette.background.paper},children:Gt.jsx(Iu,{chainId:h,isValid:re,errorMessage:z,setShowConfirm:C})}),Gt.jsx(Up,{position:N,outOfRange:q,ticksAtLimit:$,on:w,onClose:()=>{C(!1)},onConfirm:se.mutate,loading:se.isPending})]}),Gt.jsxs(D,{value:"unstake",children:[Gt.jsxs(x,{sx:{mt:16,mx:20,display:"flex",flexDirection:"column",alignItems:"stretch",gap:12},children:[Gt.jsx(wh,{disabled:!1,value:k,onChange:e=>R(e)}),Gt.jsx(Su,{value:O,onChange:W,disabled:!1,type:u})]}),Gt.jsxs(x,{sx:{mt:16,mx:20,display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[Gt.jsx(x,{sx:{typography:"body2",color:s.palette.text.secondary},children:"Receive"}),Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:4},children:[Gt.jsxs(x,{sx:{typography:"body1",fontWeight:600,color:s.palette.text.primary},children:[Gt.jsx(x,{component:"span",sx:{color:s.palette.primary.main},children:(null==g?void 0:g.pooledAmountA)?Kr({input:g.pooledAmountA.multipliedBy(k/100),decimals:null==A?void 0:A.decimals}):"-"})," ",null==A?void 0:A.symbol]}),Gt.jsxs(x,{sx:{typography:"body1",fontWeight:600,color:s.palette.text.primary},children:[Gt.jsx(x,{component:"span",sx:{color:s.palette.primary.main},children:(null==g?void 0:g.pooledAmountB)?Kr({input:g.pooledAmountB.multipliedBy(k/100),decimals:null==F?void 0:F.decimals}):"-"})," ",null==F?void 0:F.symbol]})]})]}),Gt.jsx(x,{sx:{mt:20,display:"flex",alignItems:"center",px:20,py:16,borderBottomLeftRadius:16,borderBottomRightRadius:16,backgroundColor:s.palette.background.paper},children:Gt.jsx(Eh,{chainId:h,disabled:ee||0===k,removed:ee,onConfirm:de.mutate,isLoading:de.isPending})})]}),Gt.jsxs(D,{value:"claim",children:[Gt.jsxs(x,{sx:{mx:20,mt:16,borderRadius:12,borderWidth:1,borderStyle:"solid",borderColor:s.palette.border.main},children:[Gt.jsx(x,{sx:{py:12,px:20,typography:"body1",color:s.palette.text.primary,borderBottomWidth:1,borderBottomStyle:"solid",borderBottomColor:s.palette.border.main},children:i._({id:"tu/fxg",message:"Claim fees"})}),Gt.jsx(x,{sx:{p:20},children:null==g?void 0:g.rewardInfos.map((e=>Gt.jsx(Lh,{mint:e.mint,amount:e.amount},e.mint.address)))})]}),Gt.jsx(x,{sx:{mx:20,mt:16,typography:"h6",color:s.palette.text.secondary},children:i._({id:"Joa5Dk",message:"*Collecting fees will withdraw currently available fees for you."})}),Gt.jsx(x,{sx:{mt:20,display:"flex",alignItems:"center",px:20,py:16,borderBottomLeftRadius:16,borderBottomRightRadius:16,backgroundColor:s.palette.background.paper},children:Gt.jsx(Rh,{chainId:h,disabled:ce.isPending||!g,onConfirm:ce.mutate,isLoading:ce.isPending})})]})]})]})}),[h,G,Q,B,z,f,n,ae,re,le,A,F,Y,se.isPending,se.mutate,ce.isPending,ce.mutate,a,te,ne,de.isPending,de.mutate,b,q,N,g,ee,W,w,k,O,s.palette.background.paper,s.palette.border.main,s.palette.primary.main,s.palette.text.primary,s.palette.text.secondary,$]);return l?Gt.jsx(oc,{open:null!=A&&null!=F,onClose:a,scope:!l,modal:void 0,id:"pool-operate",children:ue}):ue};const Wh=({outOfRange:e})=>{const t=y();return Gt.jsx(W,{title:e?i._({id:"i3Z+/Z",message:"Out of range"}):i._({id:"vOyUlD",message:"In range"}),children:Gt.jsx(x,{sx:{display:"flex",alignItems:"center"},children:e?Gt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:Gt.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.583252 12.5416L6.99992 1.45825L13.4166 12.5416H0.583252ZM11.3924 11.3749L6.9999 3.78575L2.6074 11.3749H11.3924ZM7.58328 9.62492H6.41661V10.7916H7.58328V9.62492ZM6.41661 6.12492H7.58328V8.45825H6.41661V6.12492Z",fill:t.palette.warning.main})}):Gt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"8",height:"8",viewBox:"0 0 8 8",fill:"none",children:Gt.jsx("circle",{cx:"4",cy:"4",r:"4",fill:t.palette.success.main})})})})},Vh=({position:e,mintA:t,mintB:n,feeAmount:o,onClickManage:r})=>{const a=y(),{positionInfo:l,pool:s}=Mh({position:e}),d=function(e,t,n){return K((()=>({[Pu.LOWER]:e&&t?t===Gp(Ge,Vu[e]):void 0,[Pu.UPPER]:e&&n?n===Gp(_e,Vu[e]):void 0})),[e,t,n])}(o,e.tickLower,e.tickUpper),c=null==l?void 0:l.priceLower,u=null==l?void 0:l.priceUpper,p=!!(null==s?void 0:s.computePoolInfo)&&(s.computePoolInfo.tickCurrent<e.tickLower||s.computePoolInfo.tickCurrent>=e.tickUpper),h=null==s?void 0:s.poolInfo.price;return Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:24,px:20,py:20,pb:12,borderRadius:12,backgroundColor:a.palette.background.paperContrast},children:[Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:4},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,typography:"h5",color:a.palette.text.primary},children:[Gt.jsx(x,{children:Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs("span",{children:[Pp({price:c,atLimit:d,direction:Pu.LOWER})," "]}),null==n?void 0:n.symbol]})}),Gt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"19",viewBox:"0 0 18 19",fill:"none",children:Gt.jsx("path",{d:"M15.75 9.50293L12.75 12.5029L11.7 11.4529L12.8813 10.2529L5.11875 10.2529L6.3 11.4529L5.25 12.5029L2.25 9.50293L5.25 6.50293L6.31875 7.55293L5.11875 8.75293L12.8813 8.75293L11.7 7.55293L12.75 6.50293L15.75 9.50293Z",fill:"currentColor",fillOpacity:"0.5"})}),Gt.jsx(x,{children:Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs("span",{children:[Pp({price:u,atLimit:d,direction:Pu.UPPER})," "]}),null==n?void 0:n.symbol]})})]}),Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4},children:[Gt.jsx(Wh,{outOfRange:p}),Gt.jsxs(x,{sx:{typography:"h6",color:a.palette.text.secondary},children:["Current price: ",Kr({input:h})," ",null==n?void 0:n.symbol," per ",null==t?void 0:t.symbol]})]})]}),Gt.jsx(b,{variant:b.Variant.outlined,size:b.Size.small,fullWidth:!0,onClick:r,children:i._({id:"wckWOP",message:"Manage"})})]})};const Ah=({mint1Address:e,mint2Address:t,feeAmount:n,poolId:o,onClose:r,handleGoToAddLiquidityV3:a})=>{const{isMobile:l}=Ec(),s=y(),{chainId:d,account:c}=Br(),{positions:u,loading:p}=Th(d),{mintA:h,mintB:m}=function({mint1Address:e,mint2Address:t}){const{chainId:n}=Br(),i=qp({mint:e,chainId:n}),o=qp({mint:t,chainId:n}),[r,a]=K((()=>i&&o?new vt(new Te(i.address).toBuffer()).gt(new vt(new Te(o.address).toBuffer()))?[o,i]:[i,o]:[void 0,void 0]),[i,o]);return{mintA:r,mintB:a}}({mint1Address:e,mint2Address:t}),f=K((()=>{if(void 0!==u)return u.filter((e=>e.poolId.equals(new Te(o))))}),[u,o]),[g,v]=_(null),j=K((()=>{var e;return Gt.jsxs(x,{sx:{p:20,display:"flex",flexDirection:"column",gap:16,borderRadius:16,backgroundColor:s.palette.background.paper,minHeight:480},children:[Gt.jsxs(x,{sx:{pb:16,borderBottomColor:s.palette.border.main,borderBottomStyle:"solid",borderBottomWidth:1,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[Gt.jsxs(x,{sx:{typography:"body1",fontWeight:600,color:s.palette.text.primary},children:[i._({id:"Gs02OK",message:"My Positions"})," (",null!==(e=null==f?void 0:f.length)&&void 0!==e?e:0,")"]}),r?Gt.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:24,height:24,borderRadius:"50%",borderWidth:1,color:"text.secondary",cursor:"pointer"},children:Gt.jsx(x,{component:Ft.Error,sx:{width:16,height:16},onClick:()=>{r()}})}):void 0]}),p||!f?Gt.jsx(Gt.Fragment,{children:Gt.jsx(x,{sx:{mt:100,display:"flex",justifyContent:"center"},children:Gt.jsx(Ys,{})})}):f.length>0?Gt.jsxs(Gt.Fragment,{children:[null==f?void 0:f.map((e=>Gt.jsx(Vh,{position:e,mintA:h,mintB:m,feeAmount:n,onClickManage:()=>{v(e)}},e.nftMint.toBase58()))),Gt.jsxs(b,{size:b.Size.big,variant:b.Variant.second,onClick:()=>{a({mint1:null==h?void 0:h.address,mint2:null==m?void 0:m.address,fee:String(n)})},sx:{gap:8},children:[Gt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:Gt.jsx("path",{d:"M19 13H13V19H11V13H5V11H11V5H13V11H19V13Z",fill:"currentColor"})}),i._({id:"FQ4aT9",message:"Add Position"})]})]}):Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs(x,{sx:{mt:100,display:"flex",flexDirection:"column",alignItems:"center",gap:12},children:[Gt.jsx(Y,{sx:{width:60,height:60,borderRadius:24/105*60}}),Gt.jsx(x,{sx:{typography:"body1",color:s.palette.text.secondary},children:i._({id:"/6L4mj",message:"Your position is empty"})})]}),Gt.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center"},children:Gt.jsx(gc,{size:b.Size.small,includeButton:!0,children:Gt.jsx(b,{size:b.Size.small,onClick:()=>{a({mint1:null==h?void 0:h.address,mint2:null==m?void 0:m.address,fee:String(n)})},children:i._({id:"FQ4aT9",message:"Add Position"})})})})]})]})}),[f,n,a,p,h,m,r,s.palette.background.paper,s.palette.border.main,s.palette.text.primary,s.palette.text.secondary]);return null!==g?Gt.jsx(Oh,{mint1Address:e,mint2Address:t,feeAmount:n,poolId:g.poolId.toBase58(),nftMint:g.nftMint.toBase58(),onClose:()=>{v(null)}}):l?Gt.jsx(oc,{open:null!=h&&null!=m,onClose:r,scope:!l,modal:void 0,id:"pool-operate",children:j}):j};var Fh,Zh;function Ph({message:e,onClose:t}){return Gt.jsx(oc,{open:!!e,onClose:t,id:"error-message",children:Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs(x,{sx:{flex:1,textAlign:"center"},children:[Gt.jsx(x,{component:Ft.ErrorWarn,sx:{mt:60,width:64,height:64,color:"error.main"}}),e?Gt.jsxs(x,{sx:{textAlign:"center",mt:60},children:[Gt.jsx(x,{children:Gt.jsx(n,{id:"kf83Ld",message:"Something went wrong."})}),Gt.jsx(x,{sx:{color:"text.secondary",mt:12,typography:"body2",wordBreak:"break-all"},children:e})]}):""]}),Gt.jsx(x,{sx:{px:16,py:20},children:Gt.jsx(b,{onClick:t,fullWidth:!0,children:Gt.jsx(n,{id:"1QfxQT",message:"Dismiss"})})})]})})}function Bh({status:e,children:t,buttonProps:i}){return!e.needShowTokenStatusButton&&t?Gt.jsx(Gt.Fragment,{children:t}):e.insufficientBalance?Gt.jsx(b,{fullWidth:!0,disabled:!0,...i,children:Gt.jsx(n,{id:"znqB4T",message:"Insufficient balance"})}):Gt.jsx(b,{fullWidth:!0,isLoading:e.isApproving,onClick:e.submitApprove,disabled:e.insufficientBalance,...i,children:e.isApproving?Gt.jsx(n,{id:"j2Uisd",message:"Approving"}):e.approveTitle})}function Nh({chainId:e,baseTokenStatus:t,quoteTokenStatus:i,children:o}){const{runningRequests:r}=Ia(),{account:a,chainId:l}=Br();if(!a||e!==l)return Gt.jsx(gc,{chainId:e,fullWidth:!0});const s=r.some((e=>{var t,n;return(null===(t=e.metadata)||void 0===t?void 0:t[Ur.addLiquidity])||(null===(n=e.metadata)||void 0===n?void 0:n[Ur.removeLiquidity])})),d=[];t.needShowTokenStatusButton&&d.push(Gt.jsx(Bh,{status:t})),i.needShowTokenStatusButton&&!t.isApproving&&d.push(Gt.jsx(Bh,{status:i}));const c=d.length;return 2===c?Gt.jsx(x,{sx:{display:"flex","& > button":{flex:1,"&:last-child":{ml:8}}},children:d.map((e=>e))}):1===c?d[0]:s?Gt.jsx(b,{fullWidth:!0,disabled:!0,isLoading:!0,children:Gt.jsx(n,{id:"UbRKMZ",message:"Pending"})}):Gt.jsx(Gt.Fragment,{children:o})}function Uh({pool:e,maxBaseAmount:t,maxQuoteAmount:n,isRemove:i}){const[o,r]=G.useState(""),[a,l]=G.useState(""),[s,d]=G.useState(wr),c=s===wr?new oe(Kc).div(100).toNumber():s,u=()=>{r(""),l("")},p=nu({pool:(null==e?void 0:e.baseToken)&&e.quoteToken?{baseToken:e.baseToken,quoteToken:e.quoteToken,address:e.address}:void 0,baseAmount:o,quoteAmount:a,slippage:c}),h=p.isFront?p.price:p.invertedPrice,m=h||new oe(1),f=G.useRef(m);if(!e||m.isNaN())return{baseAmount:o,quoteAmount:a,handleChangeBaseAmount:()=>{},handleChangeQuoteAmount:()=>{},reset:u,uniV2Pair:p,slippage:s,slippageNumber:c,setSlippage:d};const g=e.baseToken.decimals,x=e.quoteToken.decimals,y=e=>{if(e){let o=m.multipliedBy(e).dp(x).toString();n&&i&&(n.lte(o)||(null==t?void 0:t.lte(0)))&&(o=n.toString()),l(o)}else l(e)};f.current&&m.isEqualTo(f.current)||(f.current=m,y(o));return{baseAmount:o,quoteAmount:a,handleChangeBaseAmount:e=>{let t=ta(e,g);null===t&&(t=o),r(t),y(t)},handleChangeQuoteAmount:e=>{let o=ta(e,x);null===o&&(o=a),l(o),(e=>{if(e){let o=new oe(e).div(m).dp(g).toString();t&&i&&(t.lte(o)||(null==n?void 0:n.lte(0)))&&(o=t.toString()),r(o)}else r(e)})(o)},reset:u,midPrice:h,addPortion:m,amountCheckedDisabled:!o||!a,uniV2Pair:p,slippage:s,slippageNumber:c,setSlippage:d}}function Hh({submittedBack:e,pool:t}){var n,o,r;const a="SVM_AMMV2"===(null==t?void 0:t.type),[l,s]=G.useState(!1),{baseAmount:d,quoteAmount:c,midPrice:u,amountCheckedDisabled:p,uniV2Pair:h,handleChangeBaseAmount:m,handleChangeQuoteAmount:f,reset:g,slippage:y,slippageNumber:v,setSlippage:j}=Uh({pool:t});G.useEffect((()=>{g()}),[t]);const w=al(null==t?void 0:t.baseToken,{amount:d}),C=al(null==t?void 0:t.quoteToken,{amount:c}),k=w.insufficientBalance||C.insufficientBalance,R=!t||k||!u||!!h.poolInfoQuery.isLoading||!!h.poolInfoQuery.error||p||h.poolInfoQuery.isLoading;let S=a?i._({id:"bwSQI0",message:"Supply"}):i._({id:"m16xKo",message:"Add"});k&&(S=i._({id:"znqB4T",message:"Insufficient balance"}));const I=tu({baseToken:null==t?void 0:t.baseToken,quoteToken:null==t?void 0:t.quoteToken,pairMintAAmount:h.pairMintAAmount,pairMintBAmount:h.pairMintBAmount,isExists:h.isExists,poolKeys:null===(n=h.poolInfoQuery.data)||void 0===n?void 0:n.poolKeys,poolInfo:null===(o=h.poolInfoQuery.data)||void 0===o?void 0:o.poolInfo,slippage:v,submittedBack:()=>{g(),e&&e(),s(!1)}}),E=!(null==t?void 0:t.baseToken)||!(null==t?void 0:t.quoteToken);return Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs(x,{sx:{pt:20,pb:18,px:20},children:[Gt.jsx(Uc,{sx:{mb:4,pb:28,minHeight:"auto"},amt:d,token:null==t?void 0:t.baseToken,canClickBalance:!0,showPercentage:!0,onInputChange:m,readOnly:h.poolInfoQuery.isLoading}),Gt.jsx(kc,{plus:!0}),Gt.jsx(Uc,{sx:{pb:20,minHeight:"auto"},amt:c,token:null==t?void 0:t.quoteToken,canClickBalance:!0,showPercentage:!0,onInputChange:f,readOnly:h.poolInfoQuery.isLoading}),Gt.jsx(Cu,{slippage:y,onChangeSlippage:j,disabled:E,sx:{mt:8}}),Gt.jsx(gu,{baseToken:null==t?void 0:t.baseToken,quoteToken:null==t?void 0:t.quoteToken,loading:h.poolInfoQuery.isLoading,midPrice:u,lpBalancePercentage:h.isExists?h.lpBalancePercentage:100})]}),Gt.jsx(x,{sx:{px:20,py:16,position:"sticky",bottom:0,borderStyle:"solid",borderWidth:"1px 0 0",borderColor:"border.main",backgroundColor:"background.paper"},children:t?Gt.jsx(Nh,{chainId:t.chainId,baseTokenStatus:w,quoteTokenStatus:C,children:Gt.jsx(b,{fullWidth:!0,disabled:R,isLoading:I.isPending,onClick:()=>{R||s(!0)},children:S})}):Gt.jsx(b,{fullWidth:!0,disabled:!0,children:S})}),Gt.jsx(Ph,{message:null===(r=I.error)||void 0===r?void 0:r.message,onClose:()=>I.reset()}),a&&!!t&&Gt.jsx(xu,{open:l,onClose:()=>s(!1),slippage:v,baseToken:t.baseToken,quoteToken:t.quoteToken,pairMintAAmount:h.pairMintAAmount,pairMintBAmount:h.pairMintBAmount,feeRate:t.lpFeeRate,price:null==h?void 0:h.price,lpAmount:null==h?void 0:h.liquidityMinted,lpBalancePercentage:h.isExists?h.lpBalancePercentage:100,pairAddress:t.address,createMutation:I})]})}function Dh({hidePoolInfo:e,pool:t,children:i}){var o,r,a,l,s;const d=y(),c=!t,u="SVM_AMMV2"===(null==t?void 0:t.type),p=t?Ap({type:t.type,lpFeeRate:null!==(o=t.lpFeeRate)&&void 0!==o?o:"0",mtFeeRate:null!==(r=t.mtFeeRate)&&void 0!==r?r:"0"}):"-";return Gt.jsxs(x,{sx:{mt:16,mx:20,border:"solid 1px",borderColor:"border.main",borderRadius:12},children:[e?"":Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",p:d.spacing(12,20),borderStyle:"solid",borderColor:"border.main",borderWidth:d.spacing(0,0,1)},children:[Gt.jsxs(x,{children:[Gt.jsxs(E,{loading:c,loadingSx:{width:100,mb:4},sx:{display:"flex",alignItems:"center",gap:4,typography:"body2",fontWeight:600},children:[null===(a=null==t?void 0:t.baseToken)||void 0===a?void 0:a.symbol,"/",null===(l=null==t?void 0:t.quoteToken)||void 0===l?void 0:l.symbol,u&&Gt.jsx(W,{title:Gt.jsxs(x,{sx:{typography:"h6","& > b":{fontWeight:600,color:"primary.main"}},children:["🌟",Gt.jsx("b",{children:Gt.jsx(n,{id:"e38JNU",message:"Tips:"})})," ",Gt.jsx(n,{id:"ipqmyu",message:"By adding liquidity you’ll earn <0>{feeRate}</0> of all trades on this pair proportional to your share of the pool. Fees are added to the pool, accrue in real time and can be claimed by withdrawing your liquidity.",values:{feeRate:p},components:{0:Gt.jsx("b",{})}})]}),sx:{maxWidth:240},children:Gt.jsx(x,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.disabled"},children:p})})]}),Gt.jsx(E,{loading:c,children:Gt.jsx(pu,{address:null!==(s=null==t?void 0:t.address)&&void 0!==s?s:"",truncate:!0,iconSize:14,iconSpace:4,customChainId:null==t?void 0:t.chainId,sx:{typography:"h6",color:"text.secondary"}})})]}),(null==t?void 0:t.address)&&!u?Gt.jsxs(x,{component:M,sx:{typography:"body2",display:"flex",alignItems:"center",color:"text.secondary"},onClick:()=>{zc.getState().push({type:Yc.PoolDetail,params:{chainId:t.chainId,address:t.address}})},children:[Gt.jsx(n,{id:"URmyfc",message:"Details"}),Gt.jsx(x,{component:Ft.ArrowRight,sx:{ml:4,position:"relative",top:1.2,width:16,height:16}})]}):""]}),Gt.jsx(x,{sx:{p:d.spacing(12,20)},children:i})]})}function Yh({submittedBack:t,pool:n}){var o,r,a;const[l,s]=G.useState(""),[d,c]=G.useState(""),[u,p]=G.useState(wr),h=u===wr?new oe(Kc).div(100).toNumber():u,{isFront:m,price:f,invertedPrice:g,poolInfoQuery:y,lpBalanceQuery:v,lpBalance:j,lpBalancePercentage:w,lpToAmountA:C,lpToAmountB:k,liquidityMinted:R,pairMintAAmount:S,pairMintBAmount:I,isExists:E}=nu({pool:(null==n?void 0:n.baseToken)&&n.quoteToken?{baseToken:n.baseToken,quoteToken:n.quoteToken,address:n.address}:void 0,baseAmount:void 0,quoteAmount:void 0,slippage:0}),{mode:M,modeOptions:T,handleChangeMode:L,sliderPercentage:O,handleChangeSliderPercentage:W,resetPercentage:V}=function({isBase:e,pool:t,baseOverride:n,quoteOverride:o,resetAmount:r,handleChangeBaseAmount:a,handleChangeQuoteAmount:l}){const[s,d]=G.useState(kh.percentage),[c,u]=G.useState(Ch),p=G.useRef(null),h=()=>{p.current&&clearTimeout(p.current)},m=()=>{h(),u(Ch)};return G.useEffect((()=>h),[]),{mode:s,modeOptions:[{key:kh.percentage,value:i._({id:"x4QVeW",message:"Percentage to remove"})}],handleChangeMode:e=>{d(e),null==r||r(),m()},sliderPercentage:c,handleChangeSliderPercentage:i=>{if(h(),i!==c&&u(i),!t)return;const r=100===i,s=()=>{if(t)if(e||void 0===e){if(n){let e=n.toString();r||(e=ea(n.times(i/100),t.baseToken.decimals)),null==a||a(e)}}else if(o){let e=o.toString();r||(e=ea(o.times(i/100),t.quoteToken.decimals)),null==l||l(e)}};r?s():p.current=setTimeout(s,100)},resetPercentage:m}}({isBase:!0,pool:n,baseOverride:C,quoteOverride:k}),A=al(null==n?void 0:n.baseToken,{amount:l}),F=al(null==n?void 0:n.quoteToken,{amount:d}),Z=!n||!!y.isLoading||!!y.error||!!v.error||v.isLoading,P=i._({id:"t/YqKh",message:"Remove"}),B=function({liquidityAmount:t,slippage:n,poolInfo:o,poolKeys:r,submittedBack:a}){const l=Sa(),s=Fs();return e(),Ce({mutationFn:()=>Vr(this,void 0,void 0,(function*(){if(!s)throw new Error("raydium is undefined");if(!o||!r)throw new Error("poolInfo or poolKeys is undefined");if(!t)throw new Error("liquidityAmount is undefined");const e=new vt(new jt(t.toString()).mul(10**o.lpMint.decimals).toFixed(0,jt.ROUND_DOWN)),d=new Ye(100*n*100,1e4),{execute:c}=yield s.cpmm.withdrawLiquidity({poolInfo:o,poolKeys:r,lpAmount:e,txVersion:He.LEGACY,slippage:d});return yield l.executeCustom({brief:i._({id:"cJtosk",message:"Remove liquidity"}),metadata:{[Ur.removeLiqidityAMMV2Position]:!0},handler:e=>Vr(this,void 0,void 0,(function*(){const{txId:t}=yield c({sendAndConfirm:!0});e.onSuccess(t)})),submittedBack:a})}))})}({liquidityAmount:null==j?void 0:j.times(O/100),slippage:h,poolKeys:null===(o=y.data)||void 0===o?void 0:o.poolKeys,poolInfo:null===(r=y.data)||void 0===r?void 0:r.poolInfo,submittedBack:()=>{t&&t()}}),N=!(null==n?void 0:n.baseToken)||!(null==n?void 0:n.quoteToken);return Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs(x,{sx:{pb:18,px:20},children:[Gt.jsx(x,{sx:{pt:20},children:M===kh.percentage?Gt.jsx(wh,{disabled:y.isLoading||!j||j.lte(0),value:O,onChange:W}):Gt.jsx(Gt.Fragment,{})}),Gt.jsx(Cu,{slippage:u,onChangeSlippage:p,disabled:N,sx:{mt:8}}),Gt.jsx(gu,{baseToken:null==n?void 0:n.baseToken,quoteToken:null==n?void 0:n.quoteToken,loading:y.isLoading,midPrice:m?f:g,lpBalancePercentage:E?w:100})]}),Gt.jsx(x,{sx:{px:20,py:16,position:"sticky",bottom:0,borderStyle:"solid",borderWidth:"1px 0 0",borderColor:"border.main",backgroundColor:"background.paper"},children:n?Gt.jsx(Nh,{chainId:n.chainId,baseTokenStatus:A,quoteTokenStatus:F,children:Gt.jsx(b,{fullWidth:!0,disabled:Z,isLoading:B.isPending,onClick:()=>{Z||B.mutate()},children:P})}):Gt.jsx(b,{fullWidth:!0,disabled:!0,children:P})}),Gt.jsx(Ph,{message:null===(a=B.error)||void 0===a?void 0:a.message,onClose:()=>B.reset()})]})}function zh({pool:t,operate:n,hidePoolInfo:i,submittedBack:o}){var r;const{operateTab:a,operateTabs:l,handleChangeTab:s}=function(t=Zh.Add){const{i18n:n}=e(),[i,o]=G.useState(t),r=G.useMemo((()=>[{key:Zh.Add,value:n._({id:"m16xKo",message:"Add"})},{key:Zh.Remove,value:n._({id:"t/YqKh",message:"Remove"})}]),[n._]);return G.useEffect((()=>{o(t)}),[t]),{operateTab:i,operateTabs:r,handleChangeTab:e=>{o(e)}}}(n);Br();const{price:d,invertedPrice:c,poolInfoQuery:u,lpBalanceQuery:p,lpBalance:h,lpBalancePercentage:m,lpToAmountA:f,lpToAmountB:g,liquidityMinted:x,pairMintAAmount:y,pairMintBAmount:v,isExists:b}=nu({pool:(null==t?void 0:t.baseToken)&&t.quoteToken?{baseToken:t.baseToken,quoteToken:t.quoteToken,address:t.address}:void 0,baseAmount:void 0,quoteAmount:void 0,slippage:0});return Gt.jsxs(Gt.Fragment,{children:[Gt.jsx(Dh,{pool:t,hidePoolInfo:i,children:Gt.jsx(ju,{isExists:b,poolInfo:null===(r=u.data)||void 0===r?void 0:r.poolInfo,poolInfoLoading:u.isLoading,lpBalanceLoading:p.isLoading,lpBalance:h,lpBalancePercentage:m,lpToAmountA:f,lpToAmountB:g,sx:{px:0,py:0,border:"none"}})}),Gt.jsxs(U,{value:a,onChange:(e,t)=>{s(t)},children:[Gt.jsx(H,{tabs:l,variant:"inPaper",tabsListSx:{mt:16,mx:20}}),Gt.jsx(D,{value:Zh.Add,children:Gt.jsx(Hh,{pool:t,submittedBack:o})}),Gt.jsx(D,{value:Zh.Remove,children:Gt.jsx(Yh,{pool:t,submittedBack:o})})]})]})}function Xh({onClose:t,pool:n,operate:i,hasMining:o,hidePoolInfo:r,sx:a}){const{poolOrMiningTab:l,poolOrMiningTabs:s,handleChangeTab:d}=function({hasMining:t}){const{i18n:n}=e(),[i,o]=G.useState(Fh.Liquidity);return{poolOrMiningTab:i,poolOrMiningTabs:G.useMemo((()=>{const e=[{key:Fh.Liquidity,value:n._({id:"6y2TB3",message:"Liquidity"})},{key:Fh.Mining,value:n._({id:"Sti4vy",message:"Mining"})}];return t?e:e.slice(0,1)}),[n._,t]),handleChangeTab:e=>{o(e)}}}({hasMining:o});return Gt.jsx(x,{sx:a,children:Gt.jsxs(U,{value:l,onChange:(e,t)=>{d(t)},sx:{display:"flex",flexDirection:"column",overflow:"hidden",height:"100%"},children:[Gt.jsx(z,{tabs:s,tabsListSx:Object.assign({mx:20,justifyContent:t?"space-between":"flex-start"},{}),rightSlot:Gt.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center",gap:12},children:t?Gt.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:24,height:24,borderRadius:"50%",borderWidth:1,color:"text.secondary",cursor:"pointer"},children:Gt.jsx(x,{component:Ft.Error,sx:{width:16,height:16},onClick:()=>{t()}})}):void 0})}),Gt.jsx(D,{value:Fh.Liquidity,sx:{flex:1,overflowY:"auto"},children:Gt.jsx(zh,{pool:n,operate:i,hidePoolInfo:r,submittedBack:()=>{o&&d(Fh.Mining)}})})]})})}function qh(e){var{modal:t}=e,n=Wr(e,["modal"]);const{isMobile:i}=Ec();return Gt.jsx(oc,{open:!!n.pool,onClose:n.onClose,scope:!i,modal:t,id:"pool-operate",children:Gt.jsx(Xh,{...n})})}!function(e){e[e.Liquidity=1]="Liquidity",e[e.Mining=2]="Mining"}(Fh||(Fh={})),function(e){e[e.Add=1]="Add",e[e.Remove=2]="Remove"}(Zh||(Zh={}));const Gh=e=>Object.keys(new Array(e+1).join(","));var _h,Jh,Qh;function Kh({sx:e,hasSearch:t,emptyText:i}){return Gt.jsxs(x,{sx:Object.assign({display:"flex",flexDirection:"column",gap:12,justifyContent:"center",alignItems:"center",typography:"body2",fontWeight:500,color:"text.secondary",textAlign:"center"},e),children:[Gt.jsx(Y,{hasSearch:t,sx:{width:60,height:60,borderRadius:12}}),Gt.jsx(x,{children:null!=i?i:Gt.jsx(n,{id:"AxPAXW",message:"No results found"})})]})}function $h(){return $h=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},$h.apply(null,arguments)}!function(e){e[e.Failed=0]="Failed",e[e.Success=1]="Success",e[e.Warning=2]="Warning"}(_h||(_h={}));const em=e=>q.createElement("svg",$h({width:60,height:60,viewBox:"0 0 60 60",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),q.createElement("g",{opacity:.5},q.createElement("mask",{id:"mask0_3521_179418",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:0,y:0,width:60,height:60},Jh||(Jh=q.createElement("rect",{width:60,height:60,rx:16,fill:"white"}))),Qh||(Qh=q.createElement("g",{mask:"url(#mask0_3521_179418)"},q.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0 30.0352H60V16.0352C60 7.1986 52.8366 0.0351562 44 0.0351562H16C7.16344 0.0351562 0 7.1986 0 16.0352V30.0352Z",fill:"#727272",fillOpacity:.4}),q.createElement("path",{d:"M29.4643 4H16C9.37258 4 4 9.37258 4 16V27H27.1154L31.7914 18.7271L23.1831 13.6634L29.4643 4Z",fill:"#727272",fillOpacity:.4}),q.createElement("path",{d:"M31.7101 27H56V16C56 9.37258 50.6274 4 44 4H34.0384L34.1766 4.08987L28.8164 12.3364L37.2081 17.2727L31.7101 27Z",fill:"#727272",fillOpacity:.4}),q.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0 44C0 52.8366 7.16344 60 16 60H44C52.8366 60 60 52.8366 60 44V30H0V44Z",fill:"#ABABAB",fillOpacity:.4}),q.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M59.4395 44.8861C59.4395 53.0965 52.7625 59.7526 44.5257 59.7526C36.2891 59.7526 29.6118 53.0965 29.6118 44.8861C29.6118 36.6756 36.2891 30.0195 44.5257 30.0195C52.7625 30.0195 59.4395 36.6756 59.4395 44.8861Z",fill:"#727272",fillOpacity:.4}),q.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M29.8277 44.8665C29.8277 53.077 23.1507 59.7331 14.9139 59.7331C6.67727 59.7331 0 53.077 0 44.8665C0 36.6561 6.67727 30 14.9139 30C23.1507 30 29.8277 36.6561 29.8277 44.8665Z",fill:"#727272",fillOpacity:.4}),q.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M51.9177 44.8883C51.9177 48.958 48.6082 52.257 44.5255 52.257C40.4431 52.257 37.1333 48.958 37.1333 44.8883C37.1333 40.8186 40.4431 37.5195 44.5255 37.5195C48.6082 37.5195 51.9177 40.8186 51.9177 44.8883Z",fill:"#444446"})))));function tm({sx:e,refresh:t}){return Gt.jsxs(x,{sx:ue({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},e),children:[Gt.jsx(x,{component:em,sx:{display:"inline-block",width:60,height:60,mb:12}}),Gt.jsx(x,{sx:{typography:"body2",width:252,textAlign:"center"},children:Gt.jsx(x,{component:"span",sx:{color:"text.secondary"},children:Gt.jsx(n,{id:"Vmw6BM",message:"Something went wrong…<0>Refresh again</0>",components:{0:Gt.jsx(j,{component:"span",color:"primary.main",weak:!0,sx:{cursor:"pointer"},onClick:()=>{t()}})}})})})]})}function nm({loading:e,empty:t,hasSearch:n,children:i,refetch:o}){return e?Gt.jsx(x,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",gap:24,px:24,height:320},children:Gh(4).map(((e,t)=>Gt.jsx(V,{width:"100%",height:45},t)))}):o?Gt.jsx(tm,{refresh:o,sx:{height:320}}):t?Gt.jsx(Kh,{hasSearch:n,sx:{height:320}}):Gt.jsx(Gt.Fragment,{children:i})}function im({children:e,sx:t,gap:n=20,repeatBaseForLargeScreen:i=3}){const{isMobile:o,minDevice:r}=Ec();let a={};if(o)a={display:"flex",flexDirection:"column",gap:n};else{let e=2;[1418,1761,2104].some(((t,n)=>{if(r(t))return e=i+n,!0})),a={display:"grid",gap:n,gridTemplateColumns:`repeat(${e}, 1fr)`}}return Gt.jsx(x,{sx:Object.assign(Object.assign({},a),t),children:e})}function om({address:e,chainId:t,hideName:i,sx:o}){const r=y(),a=el(),{onlyChainId:l}=Zr(),s=we(Object.assign({},a.getQuery(g.graphql.fetchLiquidityLpPartnerRewards,{where:{chainId:l||void 0}})));if(!e)return null;const d=[];return("string"==typeof e?[e]:Array.from(new Set(e)).filter((e=>!!e))).forEach((e=>{var n,i,o;e&&(null===(o=null===(i=null===(n=s.data)||void 0===n?void 0:n.liquidity_getLpPartnerRewards)||void 0===i?void 0:i.partnerRewards)||void 0===o||o.some((n=>{var i,o,r,a,l,c,u,p,h,m,f,g,x,y;if((null==n?void 0:n.chainId)===t&&(null===(i=null==n?void 0:n.pool)||void 0===i?void 0:i.toLocaleLowerCase())===e.toLocaleLowerCase()){const e=null===(a=null===(r=null===(o=s.data)||void 0===o?void 0:o.liquidity_getLpPartnerRewards)||void 0===r?void 0:r.partnerInfos)||void 0===a?void 0:a.find((e=>(null==e?void 0:e.partner)===n.partner));if(!e)return;d.push({partner:{name:null!==(l=null==e?void 0:e.partner)&&void 0!==l?l:"",logo:null!==(c=null==e?void 0:e.logo)&&void 0!==c?c:"",introduction:null!==(u=null==e?void 0:e.introduction)&&void 0!==u?u:"",link:null!==(p=null==e?void 0:e.link)&&void 0!==p?p:"",extra:null!==(h=null==e?void 0:e.extra)&&void 0!==h?h:{},background:(null===(m=null==e?void 0:e.theme)||void 0===m?void 0:m[0])||void 0,color:(null===(f=null==e?void 0:e.theme)||void 0===f?void 0:f[1])||void 0},reward:null!==(g=null==n?void 0:n.reward)&&void 0!==g?g:"",type:null!==(x=null==n?void 0:n.type)&&void 0!==x?x:"stakelp",sort:null!==(y=null==e?void 0:e.sort)&&void 0!==y?y:Number.MAX_SAFE_INTEGER})}})))})),(null==d?void 0:d.length)?(d.sort(((e,t)=>e.sort-t.sort)),Gt.jsx(x,{sx:Object.assign({display:"flex",alignItems:"center",gap:4},o),children:d.map((e=>Gt.jsx(W,{leaveDelay:100,title:Gt.jsxs(x,{sx:{maxWidth:240,whiteSpace:"pre-wrap"},children:[e.partner.introduction,!!e.partner.link&&Gt.jsxs(x,{component:"a",target:"_blank",href:e.partner.link,rel:"noopener noreferrer",sx:{display:"flex",alignItems:"center",gap:4,color:"primary.main","&:hover":{opacity:.5}},children:[Gt.jsx(n,{id:"zwWKhA",message:"Learn more"})," ",Gt.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:Gt.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.91667 2.91667V11.0833H11.0833V7H12.25V11.0833C12.25 11.725 11.725 12.25 11.0833 12.25H2.91667C2.26917 12.25 1.75 11.725 1.75 11.0833V2.91667C1.75 2.275 2.26917 1.75 2.91667 1.75H7V2.91667H2.91667ZM8.16667 2.91667V1.75H12.25V5.83333H11.0833V3.73917L5.34917 9.47333L4.52667 8.65083L10.2608 2.91667H8.16667Z",fill:"currentColor"})})]})]}),children:Gt.jsxs(M,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:4,p:r.spacing(0,4),height:20,borderRadius:4,background:e.partner.background,color:e.partner.color,whiteSpace:"nowrap"},children:[Gt.jsx(x,{component:"img",src:e.partner.logo,alt:e.partner.name,sx:{width:14,height:14,borderRadius:"50%"}}),!i&&!!e.reward&&Gt.jsx(x,{sx:{fontSize:"10px",fontWeight:600},children:e.reward})]})},e.partner.name+e.reward)))})):null}var rm,am;function lm(){return lm=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},lm.apply(null,arguments)}const sm=e=>q.createElement("svg",lm({width:32,height:32,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),rm||(rm=q.createElement("circle",{cx:16,cy:16,r:16,fill:"#FFE804"})),am||(am=q.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.5 12.25H12.25V8.5H8.5V12.25ZM14.125 23.5H17.875V19.75H14.125V23.5ZM12.25 23.5H8.5V19.75H12.25V23.5ZM8.5 17.875H12.25V14.125H8.5V17.875ZM17.875 17.875H14.125V14.125H17.875V17.875ZM19.75 8.5V12.25H23.5V8.5H19.75ZM17.875 12.25H14.125V8.5H17.875V12.25ZM19.75 17.875H23.5V14.125H19.75V17.875ZM23.5 23.5H19.75V19.75H23.5V23.5Z",fill:"#1A1A1B"}))),dm="_default";function cm({value:e,onChange:t,placeholder:n,options:i,sx:o,readOnly:r,valueOnlyIcon:a}){const l=y();return Gt.jsx(X,{value:null!=e?e:dm,onChange:(n,i)=>{const o="number"==typeof e?Number(i):i;t(o===dm?void 0:o)},disabled:r,sx:ue({padding:l.spacing(8,12),"& .MuiSelect-select.MuiSelect-select.MuiSelect-select":{display:"flex",alignItems:"center",gap:8,padding:l.spacing(8,12,8,12),minHeight:"auto",backgroundColor:"transparent",color:"text.primary",borderRadius:8,typography:"body2",fontWeight:600,borderStyle:"solid",borderWidth:1,borderColor:"divider","& svg, & img":{width:24,height:24},'&:hover, &[aria-expanded="true"]':{backgroundColor:"background.paper"},"&.Mui-readOnly":{color:"text.disabled"}},"& .MuiSelect-icon":{color:r?"text.disabled":"text.primary"},"& .MuiOutlinedInput-notchedOutline":{display:"none"}},o),renderValue:t=>{if(!(null==t?void 0:t.value)||t.value===dm)return Gt.jsx(x,{sx:{color:"text.secondary"},children:null!=n?n:""});const o=i.find((t=>t.key===e));return o?Gt.jsxs(Gt.Fragment,{children:[o.logo,a?"":o.value]}):null},options:[...i]})}function um({isMobileStyle:e,chain:t,isLastItem:n,logoWidth:i,mobileLogoWidth:o,sx:r}){const a=y();return e?Gt.jsxs(x,{sx:Object.assign({display:"flex",alignItems:"center",py:18,borderTop:`1px solid ${a.palette.border.main}`,borderBottom:n?`1px solid ${a.palette.border.main}`:"none"},r),children:[Gt.jsx(x,{component:null==t?void 0:t.logo,sx:{width:o,height:o}}),Gt.jsx(x,{component:"span",className:"name",sx:{marginLeft:8},children:null==t?void 0:t.name})]}):Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[Gt.jsx(x,{component:null==t?void 0:t.logo,sx:{width:i,height:i}}),Gt.jsx(x,{component:"span",className:"name",sx:{marginLeft:8},children:null==t?void 0:t.name})]})}const pm=-1;function hm({chainId:t,setChainId:i,logoWidth:o=24,mobileLogoWidth:r=32,mainLogoWidth:a=24,mainMobileLogoWidth:l=18,notShowAllChain:s,valueOnlyIcon:d,sx:c}){const u=function(){const{chainId:e}=Ue();return K((()=>{const t=new Map;let n;return Is.forEach(((i,o)=>{if(i.mainnet){if(e!==i.chainId)return;n=i.mainnet}t.set(o,Object.assign({},i))})),void 0!==n&&t.delete(n),Array.from(t.values())}),[e])}(),[p,h]=G.useState(!1),{isMobile:m}=Ec(),{i18n:f}=e(),g=G.useCallback((()=>{const e=void 0===t?u[0]:u.find((e=>e.chainId===t));if(d){if(void 0===t||!e)return"";const n=m?r:a;return Gt.jsx(x,{component:null==e?void 0:e.logo,sx:{width:n,height:n}})}return void 0!==t||s?e?Gt.jsx(um,{isMobileStyle:m,chain:e,logoWidth:a,mobileLogoWidth:l}):null:Gt.jsx(um,{isMobileStyle:m,chain:{chainId:pm,logo:sm,name:f._({id:"pY/ok7",message:"All chains"})},logoWidth:a,mobileLogoWidth:l,sx:{border:"none"}})}),[t,u,s,d,m,f._]),y=G.useMemo((()=>{const e=[];return s||e.push({key:pm,value:Gt.jsx(um,{isMobileStyle:m,chain:{chainId:pm,logo:sm,name:f._({id:"pY/ok7",message:"All chains"})},logoWidth:o,mobileLogoWidth:r})}),u.forEach(((t,n)=>{e.push({key:t.chainId,value:Gt.jsx(um,{isLastItem:n===u.length-1,isMobileStyle:m,chain:t,logoWidth:o,mobileLogoWidth:r})})})),e}),[m,o,r,u,s]);return m?Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs(x,{component:M,onClick:()=>h(!0),sx:Object.assign({display:"flex",alignItems:"center",backgroundColor:"background.tag",borderRadius:8,border:"none",px:8,height:32,fontWeight:600,typography:"body2"},c),children:[Gt.jsx(x,{sx:{pr:5},children:g()}),Gt.jsx(x,{component:Ft.CaretUp,sx:{width:12,height:12,transform:"rotate(180deg)"}})]}),Gt.jsx(oc,{open:p,title:Gt.jsx(n,{id:"lJvbHq",message:"Select Network"}),onClose:()=>h(!1),id:"select-chain",modal:!0,children:Gt.jsx(x,{sx:{mb:20},children:y.map((e=>Gt.jsxs(x,{onClick:()=>{const t=e.key;i(t===pm?void 0:Number(t)),h(!1)},sx:{position:"relative",px:20,"&:active":{backgroundColor:"hover.default"},"&:hover":{backgroundColor:"hover.default"},cursor:"pointer"},children:[e.value,(t?e.key===t:e.key===pm)&&Gt.jsx(x,{sx:{position:"absolute",left:0,top:24,height:20,width:2,backgroundColor:"text.primary"}})]},e.key)))})})]}):Gt.jsx(cm,{value:null!=t?t:pm,onChange:e=>{i(e===pm?void 0:e)},placeholder:f._({id:"lJvbHq",message:"Select Network"}),options:y,valueOnlyIcon:d,sx:Object.assign({height:32,fontWeight:600,typography:"body2"},c)})}function mm({text:e,onClick:t}){const n=y();return Gt.jsxs(x,{sx:{typography:"body2",display:"inline-flex",alignItems:"center",p:n.spacing(0,4,0,8),width:"max-content",height:32,backgroundColor:"hover.default",borderWidth:1,borderRadius:8,cursor:"pointer"},onClick:t,children:[e,Gt.jsx(x,{component:Ft.ArrowBack,sx:{ml:2,width:16,height:16,transform:"rotate(180deg)"}})]})}function fm({lqList:e,onDeleteTag:t,sx:n}){var i;if(!(null==e?void 0:e.length))return null;if(!(null===(i=e[0])||void 0===i?void 0:i.pair))return null;const{pair:o}=e[0],r=Lp(o.baseToken,o.chainId),a=Lp(o.quoteToken,o.chainId);return r&&a?Gt.jsxs(x,{sx:Object.assign({typography:"body2",display:"inline-flex",alignItems:"center",px:8,mr:8,borderRadius:8,fontWeight:600,height:32,backgroundColor:"hover.default"},n),children:[Gt.jsx(mu,{tokens:[r,a],chainId:r.chainId,width:20,mr:8}),r.symbol,"+",a.symbol,Gt.jsx(x,{component:Ft.Error,sx:{ml:4,width:16,height:16,cursor:"pointer",color:"text.secondary",position:"relative",top:1.5},onClick:()=>t()})]}):null}function gm({tags:e,onDeleteTag:t,sx:n}){return e.length?Gt.jsx(x,{sx:Object.assign({display:"inline-flex",alignItems:"center"},n),children:e.map((e=>Gt.jsxs(x,{sx:{typography:"body2",display:"flex",alignItems:"center",px:8,mr:8,borderRadius:8,fontWeight:600,height:32,backgroundColor:"hover.default"},children:[Gt.jsx(Ms,{address:e.address,width:20,height:20,chainId:e.chainId,url:e.logoURI,noShowChain:!0,marginRight:8}),e.symbol,Gt.jsx(x,{component:Ft.Error,sx:{ml:4,width:16,height:16,cursor:"pointer",color:"text.secondary",position:"relative",top:1.5},onClick:()=>t(e)})]},e.address)))}):null}function xm({chainId:e,address:t}){const{isMobile:n}=Ec();return Gt.jsx(x,{component:"button",onClick:n=>{n.stopPropagation(),zc.getState().push({type:Yc.PoolDetail,params:{chainId:e,address:t}})},sx:Object.assign({display:"flex",alignItems:"center",justifyContent:"center",borderRadius:8,cursor:"pointer",flexShrink:0,height:36,"&:hover":{opacity:.5}},n?{width:64,backgroundColor:"background.tag"}:{width:40,backgroundColor:"transparent",borderWidth:1}),children:Gt.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:Gt.jsx("path",{d:"M5.83333 14.1667H7.5V8.33333H5.83333V14.1667ZM9.16667 14.1667H10.8333V5.83333H9.16667V14.1667ZM12.5 14.1667H14.1667V10.8333H12.5V14.1667ZM4.16667 17.5C3.70833 17.5 3.31597 17.3368 2.98958 17.0104C2.66319 16.684 2.5 16.2917 2.5 15.8333V4.16667C2.5 3.70833 2.66319 3.31597 2.98958 2.98958C3.31597 2.66319 3.70833 2.5 4.16667 2.5H15.8333C16.2917 2.5 16.684 2.66319 17.0104 2.98958C17.3368 3.31597 17.5 3.70833 17.5 4.16667V15.8333C17.5 16.2917 17.3368 16.684 17.0104 17.0104C16.684 17.3368 16.2917 17.5 15.8333 17.5H4.16667ZM4.16667 15.8333H15.8333V4.16667H4.16667V15.8333Z",fill:"#1A1A1B"})})})}function ym(e){var{sx:t,children:i,hasMore:o,loadMore:r,loadMoreLoading:a}=e,l=Wr(e,["sx","children","hasMore","loadMore","loadMoreLoading"]);const s=y();return Gt.jsxs(x,{sx:Object.assign({position:"relative",flex:1,overflowY:"auto"},t),...l,children:[Gt.jsx(x,{component:"table",sx:{width:"100%",borderCollapse:"collapse","& th":{p:24,typography:"body1",textAlign:"left",color:"text.secondary"},"& td":{px:24,py:20},"& thead":{position:"sticky",top:0,zIndex:2,backgroundColor:"background.paper"},"& th:last-child, & td:last-child":{position:"sticky",right:0,zIndex:1,backgroundColor:"background.paper","&::before":{content:'""',position:"absolute",top:0,bottom:0,left:1,width:"1px",boxShadow:`${L(s.palette.text.primary,.1)} -2px 0px 4px 0px`}}},children:i}),o&&Gt.jsx(M,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:64,width:"100%",borderStyle:"solid",borderColor:"border.main",borderWidth:s.spacing(1,0,0,0),typography:"body2",color:"text.secondary","&:hover":{color:"text.primary"}},onClick:r,children:a?Gt.jsx(O,{}):Gt.jsxs(Gt.Fragment,{children:[Gt.jsx(n,{id:"yQ2kGp",message:"Load more"}),Gt.jsx(x,{component:Ft.ArrowRight,sx:{transform:"rotate(90deg)"}})]})})]})}function vm({sx:e}){return Gt.jsxs(x,{sx:Object.assign({px:20,pt:20,pb:12,backgroundColor:"background.paperContrast",borderRadius:16,display:"flex",flexDirection:"column"},e),children:[Gt.jsx(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[Gt.jsx(V,{variant:"circular",width:48}),Gt.jsx(V,{variant:"rounded",height:28,width:100,sx:{ml:8}})]})}),Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",mt:44},children:[Gt.jsxs(x,{children:[Gt.jsx(V,{variant:"rounded",height:24,width:100}),Gt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:Gt.jsx(n,{id:"rSayea",message:"APY"})})]}),Gt.jsx(x,{sx:{display:"inline-block",mx:20,height:24,width:"1px",backgroundColor:"custom.border.default"}}),Gt.jsxs(x,{children:[Gt.jsx(V,{variant:"rounded",height:24,width:100}),Gt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:Gt.jsx(n,{id:"FHKsZF",message:"TVL"})})]})]}),Gt.jsx(V,{variant:"rounded",height:32})]})}function bm({chainId:e,baseToken:t,quoteToken:i,apy:o,hasQuote:r,hasMining:a,sx:l,children:s}){if(!t)return null;const d=r?[{token:t,transactionApy:null==o?void 0:o.transactionBaseApy,miningApy:null==o?void 0:o.miningBaseApy},{token:i,transactionApy:null==o?void 0:o.transactionQuoteApy,miningApy:null==o?void 0:o.miningQuoteApy}]:[{transactionApy:null==o?void 0:o.transactionBaseApy,miningApy:null==o?void 0:o.miningBaseApy}];return Gt.jsx(W,{children:null!=s?s:Gt.jsx(j,{component:Ft.QuestionBorder,sx:Object.assign({width:15,height:15},l)}),title:Gt.jsx(x,{sx:{width:236},children:d.map(((o,r)=>{var l,s,d,c;return Gt.jsxs(x,{sx:{mt:0===r?0:20},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",typography:"body2",fontWeight:600,color:"text.primary"},children:[Gt.jsx(x,{sx:{display:"flex",alignItems:"center"},children:o.token?Gt.jsxs(Gt.Fragment,{children:[Gt.jsx(Ms,{width:14,height:14,marginRight:4,address:o.token.address,url:o.token.logoURI,chainId:e,noShowChain:!0}),o.token.symbol]}):Gt.jsxs(Gt.Fragment,{children:[Gt.jsx(mu,{tokens:[t,i],width:14,mr:4,chainId:e}),t.symbol,"/",null==i?void 0:i.symbol]})}),Gt.jsx(x,{children:ca(new oe(null!==(d=o.transactionApy)&&void 0!==d?d:0).plus(null!==(c=o.miningApy)&&void 0!==c?c:0))})]}),Gt.jsxs(x,{sx:{mt:8,display:"flex",justifyContent:"space-between",typography:"h6",color:"text.secondary"},children:[Gt.jsx("span",{children:Gt.jsx(n,{id:"OnDEky",message:"LP Fee"})}),Gt.jsx("span",{children:o.transactionApy?ca(new oe(o.transactionApy)):"-"})]}),a?Gt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",typography:"h6",color:"text.secondary"},children:[Gt.jsx("span",{children:Gt.jsx(n,{id:"pSQ1lM",message:"MT Fee"})}),Gt.jsx("span",{children:o.miningApy?ca(new oe(o.miningApy)):"-"})]}):""]},null!==(s=null===(l=o.token)||void 0===l?void 0:l.address)&&void 0!==s?s:1)}))})})}function jm({sx:e,value:t,onChange:o,searchAddress:r}){const[a,l]=G.useState(!1),{isMobile:s}=Ec();return Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs(x,{component:M,sx:Object.assign(Object.assign({typography:"body2",display:"flex",alignItems:"center",justifyContent:"flex-start",px:12,height:32,backgroundColor:"background.tag",color:"text.secondary",borderRadius:8,fontWeight:600},s?{}:{minWidth:220}),e),onClick:()=>l(!0),children:[Gt.jsx(x,{component:Ft.Search,sx:{width:16,height:16,mr:8,flexShrink:0}}),Gt.jsx(n,{id:"A1taO8",message:"Search"})]}),Gt.jsx(Bc,{value:t,open:a,multiple:!0,title:Gt.jsx(n,{id:"o8aMNm",message:"Select a liquidity pool"}),searchPlaceholder:i._({id:"4nzwq3",message:"Search by token or pool address"}),onClose:()=>{l(!1)},onTokenChange:e=>{if(Array.isArray(e)){if(e.length>2){const t=[e[0],e[2]];o(t)}else o(e);l(!1)}},searchOtherAddress:e=>r(e,(()=>l(!1))),modal:!0})]})}function wm({list:e,onClick:t}){return Gt.jsx(Gt.Fragment,{children:null==e?void 0:e.map((e=>{var i,o,r,a;if(!(null==e?void 0:e.pair))return null;const l=e.pair,s=Lp(l.baseToken,l.chainId),d=Lp(l.quoteToken,l.chainId),c=l.apy?ca(new oe(null===(i=l.apy)||void 0===i?void 0:i.transactionBaseApy).plus(null!==(r=null===(o=l.apy)||void 0===o?void 0:o.miningBaseApy)&&void 0!==r?r:0)):void 0,u=f.utils.singleSideLp(l.type)&&l.apy?ca(new oe(l.apy.transactionQuoteApy).plus(null!==(a=l.apy.miningQuoteApy)&&void 0!==a?a:0)):void 0;return s&&d?Gt.jsxs(x,{onClick:t,sx:{display:"flex",justifyContent:"space-between",alignItems:"center",px:10,py:20,borderRadius:8,cursor:"pointer","&:hover":{backgroundColor:"custom.background.listHover"}},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[Gt.jsx(mu,{tokens:[s,d],chainId:l.chainId,width:24,mr:10}),Gt.jsxs(x,{sx:{typography:"h5"},children:[s.symbol,"/",d.symbol]})]}),Gt.jsxs(x,{children:[Gt.jsxs(x,{sx:{color:"custom.status.green.default",fontWeight:600},children:[c,u?`/${u}`:""]}),Gt.jsx(x,{sx:{mt:2,typography:"h6",color:"text.secondary"},children:Gt.jsx(n,{id:"rSayea",message:"APY"})})]})]},l.id):null}))})}function Cm(){const[e,t]=G.useState([]),[n,i]=G.useState([]),[o,r]=G.useMemo((()=>{const[t,n]=e;return[null==t?void 0:t.symbol,null==n?void 0:n.symbol]}),[e]);return{filterTokens:e,filterASymbol:o,filterBSymbol:r,filterAddressLqList:n,handleDeleteToken:e=>{t((t=>{const n=[...t],i=n.indexOf(e);return-1!==i&&n.splice(i,1),n}))},handleChangeFilterTokens:e=>{i([]),t(e)},handleChangeFilterAddress:e=>{i(e),t([])}}}function km({lqList:e,setOperatePool:t,supportAMM:i}){const o=y();return Gt.jsx(Gt.Fragment,{children:null==e?void 0:e.map((e=>{var r,a,l,s,d,c,u;if(!(null==e?void 0:e.pair))return null;const p=e.pair,h=Lp(p.baseToken,p.chainId),m=Lp(p.quoteToken,p.chainId),g=p.apy?ca(new oe(null===(r=p.apy)||void 0===r?void 0:r.transactionBaseApy).plus(null!==(l=null===(a=p.apy)||void 0===a?void 0:a.miningBaseApy)&&void 0!==l?l:0)):void 0,y=f.utils.singleSideLp(p.type)&&p.apy?ca(new oe(p.apy.transactionQuoteApy).plus(null!==(s=p.apy.miningQuoteApy)&&void 0!==s?s:0)):void 0,v=!!(null===(d=p.miningAddress)||void 0===d?void 0:d[0]),j=Vp(p.type);return Gt.jsx(x,{sx:{p:8,borderRadius:20,borderWidth:1,borderStyle:"solid",borderColor:"border.main",backgroundColor:"border.disabled",backdropFilter:"blur(5px)"},children:Gt.jsxs(x,{sx:{px:20,pt:20,pb:12,backgroundColor:"background.paper",borderRadius:16,borderWidth:1,borderStyle:"solid",borderColor:"border.main"},className:"gradient-card-border",onClick:()=>{i||zc.getState().push({type:Yc.PoolDetail,params:{chainId:p.chainId,address:p.id}})},children:[Gt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap"},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:8},children:[h&&m?Gt.jsx(mu,{tokens:[h,m],width:24,mr:6,chainId:p.chainId,showChainLogo:!0}):"",Gt.jsxs(x,{sx:{typography:"body2",fontWeight:600},children:[`${null==h?void 0:h.symbol}/${null==m?void 0:m.symbol}`,Gt.jsx(om,{address:p.id,chainId:p.chainId})]})]}),v?Gt.jsxs(x,{sx:{p:8,typography:"h6",fontWeight:"bold",background:`linear-gradient(180deg, ${L(o.palette.secondary.main,.3)} 0%, ${L(o.palette.purple.main,.3)} 100%)`,borderRadius:8,color:"purple.main",whiteSpace:"nowrap"},children:["✨ ",Gt.jsx(n,{id:"Sti4vy",message:"Mining"})]}):""]}),Gt.jsxs(x,{sx:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",rowGap:20,mt:44,"& > div:nth-child(odd)":{pr:20},"& > div:nth-child(even)":{position:"relative",pl:20,"&::before":{position:"absolute",left:0,top:"50%",transform:"translateY(-50%)",display:"inline-block",content:'""',height:24,width:"1px",backgroundColor:"border.main"}}},children:[i&&Gt.jsxs(x,{children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,whiteSpace:"nowrap"},children:[j,Gt.jsx(W,{title:Gt.jsx(n,{id:"O6RUgz",message:"Fee rate"}),children:Gt.jsx(x,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary"},children:Ap({type:p.type,lpFeeRate:null!==(c=p.lpFeeRate)&&void 0!==c?c:0,mtFeeRate:null!==(u=p.mtFeeRate)&&void 0!==u?u:0})})})]}),Gt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:Gt.jsx(n,{id:"1Qz63U",message:"Pool Type"})})]}),Gt.jsxs(x,{children:[Gt.jsxs(x,{sx:{typography:"h5",color:"success.main"},children:[g,y?`/${y}`:""]}),Gt.jsxs(x,{sx:{typography:"h6",display:"flex",alignItems:"center",color:"text.secondary"},children:[Gt.jsx(n,{id:"rSayea",message:"APY"}),Gt.jsx(bm,{chainId:p.chainId,apy:p.apy,baseToken:h,quoteToken:m,hasQuote:!!y,hasMining:v,sx:{width:14,height:14}})]})]}),Gt.jsxs(x,{children:[Gt.jsxs(x,{sx:{typography:"h5"},children:["$",sa(new oe(p.tvl))]}),Gt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:Gt.jsx(n,{id:"FHKsZF",message:"TVL"})})]}),i&&Gt.jsxs(x,{children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4},children:["$",Qr({input:p.volume24H||0})]}),Gt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:Gt.jsx(n,{id:"Q8W3SC",message:"Volume (1D)"})})]})]}),Gt.jsxs(x,{sx:{mt:20,display:"flex",gap:"8px"},children:[Gt.jsx(gc,{fullWidth:!0,size:b.Size.small,onClick:n=>{n.stopPropagation(),t({pool:Op(e),hasMining:v})},children:Gt.jsx(n,{id:"m16xKo",message:"Add"})}),i&&"PMM"===j&&Gt.jsx(xm,{chainId:p.chainId,address:p.id})]})]})},p.id+p.chainId)}))})}function Rm({lqList:e,operatePool:t,setOperatePool:o,hasMore:r,loadMore:a,loadMoreLoading:l,supportAMM:s}){const d=y();return Gt.jsxs(ym,{hasMore:r,loadMore:a,loadMoreLoading:l,children:[Gt.jsx(x,{component:"thead",children:Gt.jsxs(x,{component:"tr",children:[Gt.jsx(x,{component:"th",children:Gt.jsx(n,{id:"AxdOHo",message:"Pair"})}),s&&Gt.jsx(x,{component:"th",children:Gt.jsx(n,{id:"1Qz63U",message:"Pool Type"})}),Gt.jsx(x,{component:"th",children:Gt.jsx(n,{id:"FHKsZF",message:"TVL"})}),Gt.jsx(x,{component:"th",children:Gt.jsx(n,{id:"rSayea",message:"APY"})}),s&&Gt.jsx("th",{children:Gt.jsx(n,{id:"Q8W3SC",message:"Volume (1D)"})}),Gt.jsx(x,{component:"th",sx:{width:80}})]})}),Gt.jsx(x,{component:"tbody",children:null==e?void 0:e.map((e=>{var r,a,l,c,u,p,h,m;if(!(null==e?void 0:e.pair))return null;const g=e.pair,y=Lp(g.baseToken,g.chainId),v=Lp(g.quoteToken,g.chainId),j=g.apy?ca(new oe(null===(r=g.apy)||void 0===r?void 0:r.transactionBaseApy).plus(null!==(l=null===(a=g.apy)||void 0===a?void 0:a.miningBaseApy)&&void 0!==l?l:0)):void 0,w=f.utils.singleSideLp(g.type)&&g.apy?ca(new oe(g.apy.transactionQuoteApy).plus(null!==(c=g.apy.miningQuoteApy)&&void 0!==c?c:0)):void 0;let C="";if((null===(u=null==t?void 0:t.pool)||void 0===u?void 0:u.address)===g.id||(null==t?void 0:t.address)===g.id)if(t.operate===Zh.Remove)C=i._({id:"0+31GV",message:"Removing"});else C=i._({id:"1yHVE+",message:"Adding"});const k=!!(null===(p=g.miningAddress)||void 0===p?void 0:p[0]),R=Vp(g.type),S=d.palette.background.tag;return Gt.jsxs(x,{component:"tr",sx:{["&:hover td"+(C?", & td":"")]:{backgroundImage:`linear-gradient(${S}, ${S})`}},children:[Gt.jsx(x,{component:"td",children:Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[y&&v?Gt.jsx(mu,{tokens:[y,v],width:24,mr:10,chainId:g.chainId,showChainLogo:!0}):"",Gt.jsxs(x,{children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,typography:"body2",fontWeight:600},children:[`${null==y?void 0:y.symbol}/${null==v?void 0:v.symbol}`,Gt.jsx(om,{address:g.id,chainId:g.chainId})]}),Gt.jsx(pu,{address:g.id,customChainId:g.chainId,truncate:!0,showCopy:!0,iconDarkHover:!0,iconSize:14,iconSpace:4,sx:{typography:"h6",color:"text.secondary"},disabledAddress:s,onAddressClick:()=>{zc.getState().push({type:Yc.PoolDetail,params:{chainId:g.chainId,address:g.id}})}})]})]})}),s&&Gt.jsx(x,{component:"td",children:Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4},children:[Gt.jsx(x,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary",whiteSpace:"nowrap"},children:R}),Gt.jsx(W,{title:Gt.jsx(n,{id:"O6RUgz",message:"Fee rate"}),children:Gt.jsx(x,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary"},children:Ap({type:g.type,lpFeeRate:null!==(h=g.lpFeeRate)&&void 0!==h?h:0,mtFeeRate:null!==(m=g.mtFeeRate)&&void 0!==m?m:0})})})]})}),Gt.jsx(x,{component:"td",children:Gt.jsxs(x,{sx:{typography:"body2"},title:g.tvl?`$${Qr({input:g.tvl})}`:void 0,children:["$",sa(new oe(g.tvl))]})}),Gt.jsx(x,{component:"td",children:Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[k?Gt.jsx(W,{title:i._({id:"Sti4vy",message:"Mining"}),children:Gt.jsxs(x,{component:"span",sx:{typography:"body2",color:"success.main"},children:["✨"," "]})}):"",Gt.jsx(bm,{chainId:g.chainId,apy:g.apy,baseToken:y,quoteToken:v,hasQuote:!!w,hasMining:k,children:Gt.jsxs(x,{component:"span",sx:{typography:"body2",fontWeight:600,display:"flex",alignItems:"center",width:"max-content",color:"success.main",cursor:"auto"},children:[j,w?`/${w}`:""]})})]})}),s&&Gt.jsxs(x,{component:"td",children:["$",Qr({input:g.volume24H||0})]}),Gt.jsx(x,{component:"td",children:Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"8px"},children:[s&&"PMM"===R&&Gt.jsx(xm,{chainId:g.chainId,address:g.id}),C?Gt.jsx(mm,{text:C,onClick:()=>o(null)}):Gt.jsx(b,{size:b.Size.small,onClick:()=>{o({pool:Op(e),hasMining:k})},children:i._({id:"m16xKo",message:"Add"})})]})})]},g.id+g.chainId)}))})]})}function Sm({scrollParentRef:e,filterChainIds:t,activeChainId:n,handleChangeActiveChainId:i,operatePool:o,setOperatePool:r}){var a;const{onlyChainId:l,supportAMMV2:s,supportAMMV3:d,notSupportPMM:c}=Zr(),{minDevice:u,isMobile:p}=Ec(),h=je(),{filterTokens:m,filterASymbol:g,filterBSymbol:y,filterAddressLqList:v,handleDeleteToken:b,handleChangeFilterTokens:j,handleChangeFilterAddress:w}=Cm(),C=[];s&&C.push("SVM_AMMV2"),d&&C.push("SVM_AMMV3");const k={chainIds:t,pageSize:p?4:8,filterState:{viewOnlyOwn:!1,filterTypes:C}},R=el(),S=R.getInfiniteQuery(f.graphql.fetchLiquidityList,"currentPage",{where:Object.assign(Object.assign({},k),{filterState:Object.assign({filterASymbol:g,filterBSymbol:y},k.filterState)})}),I=Se(Object.assign(Object.assign({},S),{initialPageParam:1,getNextPageParam:e=>{var t;const{currentPage:n,totalCount:i,pageSize:o}=null!==(t=e.liquidity_list)&&void 0!==t?t:{};if(!n||!i||!o)return null;let r=Math.floor(i/o);return i%o&&(r+=1),n>=r?null:n+1}}));let E=[];const M=!!(null==v?void 0:v.length);M?E=[...v]:null===(a=I.data)||void 0===a||a.pages.forEach((e=>{var t,n;null===(n=null===(t=e.liquidity_list)||void 0===t?void 0:t.lqList)||void 0===n||n.forEach((e=>{null==E||E.push(e)}))}));const T=I.hasNextPage&&!M;return Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs(x,{sx:Object.assign(Object.assign({py:16,display:"flex",gap:8},u(475)?{}:{flexDirection:"column"}),p?{}:{px:20,borderBottomWidth:1}),children:[Gt.jsxs(x,{sx:Object.assign({display:"flex",alignItems:"center",gap:8},u(475)?{}:{"& > button":{flex:1}}),children:[!l&&Gt.jsx(hm,{chainId:n,setChainId:i}),Gt.jsx(jm,{value:m,onChange:j,searchAddress:(e,t)=>Vr(this,void 0,void 0,(function*(){var n;const i=R.getInfiniteQuery(f.graphql.fetchLiquidityList,"currentPage",{where:Object.assign(Object.assign({},k),{filterState:Object.assign({address:e},k.filterState)})}),o=null===(n=(yield h.fetchQuery(i)).liquidity_list)||void 0===n?void 0:n.lqList;return(null==o?void 0:o.length)?Gt.jsx(wm,{list:o,onClick:()=>{w(o),t()}}):null}))})]}),(M||!!m.length)&&Gt.jsxs(x,{sx:{my:0},children:[M?Gt.jsx(fm,{lqList:v,onDeleteTag:()=>w([])}):"",Gt.jsx(gm,{tags:m,onDeleteTag:b})]})]}),p?Gt.jsx(Wt,{hasMore:T,threshold:300,loadMore:ce((()=>{I.hasNextPage&&!I.isFetching&&I.fetchNextPage()}),500),useWindow:!1,getScrollParent:()=>e.current||null,loader:Gt.jsx(vm,{sx:{mt:20}},"loader"),children:Gt.jsxs(im,{gap:12,children:[I.isLoading?Gt.jsx(vm,{}):"",!I.isLoading&&!(null==E?void 0:E.length)&&!I.error&&Gt.jsx(Kh,{sx:{mt:40},hasSearch:!!(n&&!l||g||y)}),!!I.error&&Gt.jsx(tm,{refresh:I.refetch,sx:{mt:40}}),Gt.jsx(km,{lqList:E,setOperatePool:r,supportAMM:s||d})]})}):Gt.jsxs(Gt.Fragment,{children:[Gt.jsx(Rm,{lqList:E,operatePool:o,setOperatePool:r,hasMore:T,loadMoreLoading:I.isFetchingNextPage,loadMore:()=>{I.hasNextPage&&!I.isFetching&&I.fetchNextPage()},supportAMM:s||d}),Gt.jsx(nm,{loading:I.isLoading,refetch:I.error?I.refetch:void 0,empty:!(null==E?void 0:E.length),hasSearch:!!(n&&!l||g||y)})]})]})}function Im({onClick:e,title:t,desc:n}){const i=y();return Gt.jsx(x,{sx:{mx:20,px:0,py:14,borderTop:`1px solid ${i.palette.border.main}`,[i.breakpoints.up("tablet")]:{borderTop:"none",mx:0,px:16,py:8}},children:Gt.jsxs(M,{onClick:e,sx:{width:"100%",display:"flex",flexDirection:"column",gap:0,p:0,borderRadius:8,"&:hover":{backgroundColor:i.palette.background.tag},[i.breakpoints.up("tablet")]:{p:8}},children:[Gt.jsx(x,{sx:{typography:"body1",fontWeight:600,color:i.palette.text.primary,textAlign:"left"},children:t}),Gt.jsx(x,{sx:{typography:"h6",fontWeight:500,color:i.palette.text.secondary,textAlign:"left"},children:n})]})})}const Em=e=>{const t=y(),{isMobile:i}=Ec(),{supportAMMV2:o,supportAMMV3:r,notSupportPMM:a}=Zr(),[l,s]=G.useState(!1),d={[Yc.CreatePool]:!a,[Yc.createPoolAMMV2]:!!o,[Yc.createPoolAMMV3]:!!r},c=Object.entries(d).filter((([e,t])=>!0===t)),u=1===c.length?c[0][0]:void 0;if(!u){const e=Gt.jsxs(Gt.Fragment,{children:[!a&&Gt.jsx(Im,{onClick:()=>{zc.getState().push({type:Yc.CreatePool})},title:Gt.jsx(n,{id:"Eif7f6",message:"PMM Pool"}),desc:Gt.jsx(n,{id:"ukTFO0",message:"Description of this type of pool"})}),o&&Gt.jsx(Im,{onClick:()=>{zc.getState().push({type:Yc.createPoolAMMV2})},title:Gt.jsx(n,{id:"lNYomJ",message:"AMM V2 Position"}),desc:Gt.jsx(n,{id:"ukTFO0",message:"Description of this type of pool"})}),r&&Gt.jsx(Im,{onClick:()=>{zc.getState().push({type:Yc.createPoolAMMV3})},title:Gt.jsx(n,{id:"sVlqoo",message:"AMM V3 Position"}),desc:Gt.jsx(n,{id:"ukTFO0",message:"Description of this type of pool"})})]});return i?Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs(b,{variant:b.Variant.outlined,fullWidth:i,onClick:()=>{s(!0)},sx:{height:40},children:[Gt.jsx(x,{component:Ft.Plus,sx:{mr:4}}),Gt.jsx(n,{id:"p2jbcE",message:"Create Pool"})]}),Gt.jsx(oc,{open:l,title:Gt.jsx(n,{id:"p2jbcE",message:"Create Pool"}),onClose:()=>{s(!1)},modal:!0,children:Gt.jsx(x,{sx:{mb:0},children:e})})]}):Gt.jsx(W,{arrow:!1,leaveDelay:300,placement:i?"bottom":"bottom-end",sx:{p:0,backgroundColor:"background.paper"},title:Gt.jsx(x,{children:e}),children:Gt.jsxs(x,{sx:{width:i?"100%":"auto",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:10,pl:8,pr:16,py:7,borderRadius:8,borderWidth:1,borderColor:t.palette.text.primary,typography:"body1",fontWeight:600,color:t.palette.text.primary,cursor:"pointer","&:hover":{backgroundColor:t.palette.background.tag}},children:[Gt.jsx(x,{component:Ft.Plus}),Gt.jsx(n,{id:"p2jbcE",message:"Create Pool"})]})})}return Gt.jsxs(b,{variant:b.Variant.outlined,fullWidth:i,onClick:()=>{zc.getState().push({type:u})},sx:{height:40},children:[Gt.jsx(x,{component:Ft.Plus,sx:{mr:4}}),Gt.jsx(n,{id:"p2jbcE",message:"Create Pool"})]})};const Mm=({onlyV3:e,setOnlyV3:t,sx:n})=>{const o=y(),{notSupportPMM:r}=Zr();return Gt.jsx(x,{component:M,onClick:()=>t(!e),sx:Object.assign({display:"flex",alignItems:"center",p:2,borderRadius:8,backgroundColor:o.palette.border.main},n),children:Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",width:"100%",[o.breakpoints.up("tablet")]:{width:194}},children:[Gt.jsx(x,{sx:Object.assign({flex:1,width:0,pt:4,pb:5,borderRadius:6,textAlign:"center",typography:"body2",whiteSpace:"nowrap"},e?{color:o.palette.text.primary,backgroundColor:o.palette.background.paper}:{color:o.palette.text.secondary,backgroundColor:"transparent"}),children:i._({id:"yoR+O6",message:"V3"})}),Gt.jsx(x,{sx:Object.assign({flex:1,width:0,pt:4,pb:5,borderRadius:6,textAlign:"center",typography:"body2",whiteSpace:"nowrap"},e?{color:o.palette.text.secondary,backgroundColor:"transparent"}:{color:o.palette.text.primary,backgroundColor:o.palette.background.paper}),children:r?"V2":i._({id:"eK6I8d",message:"V2 & PMM"})})]})})};function Tm({account:e,lqList:t,setOperatePool:i,supportAMM:o}){const r=y();return Gt.jsx(Gt.Fragment,{children:null==t?void 0:t.map((t=>{var a,l,s,d,c,u,p,h,m,g,y,v,j,w;if(!(null==t?void 0:t.pair))return null;const C=t.pair,k=Lp(C.baseToken,C.chainId),R=Lp(C.quoteToken,C.chainId),S=f.utils.singleSideLp(C.type),I=C.apy?ca(new oe(null===(a=C.apy)||void 0===a?void 0:a.transactionBaseApy).plus(null!==(s=null===(l=C.apy)||void 0===l?void 0:l.miningBaseApy)&&void 0!==s?s:0)):"0%",E=S&&C.apy?ca(new oe(C.apy.transactionQuoteApy).plus(null!==(d=C.apy.miningQuoteApy)&&void 0!==d?d:0)):void 0;let M,T;(null===(c=t.liquidityPositions)||void 0===c?void 0:c.length)&&t.liquidityPositions.forEach((e=>{var t,n,i,o,r;if(null==e?void 0:e.liquidityTokenBalance){const a=null===(t=e.id)||void 0===t?void 0:t.split("-");if(2===(null==a?void 0:a.length)){const t=a[1].toLocaleLowerCase();if((null===(i=null===(n=null==C?void 0:C.baseLpToken)||void 0===n?void 0:n.id)||void 0===i?void 0:i.toLocaleLowerCase())===t)return void(M=new oe(e.liquidityTokenBalance));(null===(r=null===(o=null==C?void 0:C.quoteLpToken)||void 0===o?void 0:o.id)||void 0===r?void 0:r.toLocaleLowerCase())===t&&(T=new oe(e.liquidityTokenBalance))}}}));const O=!!(null===(u=C.miningAddress)||void 0===u?void 0:u[0]),V=null===(p=t.liquidityPositions)||void 0===p?void 0:p[0],A=C.type,F=Vp(A),Z="SVM_AMMV2"===A,P="SVM_AMMV3"===A;return Gt.jsx(x,{sx:{p:8,borderRadius:20,borderWidth:1,borderStyle:"solid",borderColor:"border.main",backgroundColor:"border.disabled",backdropFilter:"blur(5px)"},children:Gt.jsxs(x,{sx:{px:20,pt:20,pb:12,backgroundColor:"background.paper",borderRadius:16,borderWidth:1,borderStyle:"solid",borderColor:"border.main"},className:"gradient-card-border",onClick:()=>{o||zc.getState().push({type:Yc.PoolDetail,params:{chainId:C.chainId,address:C.id}})},children:[Gt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap"},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:8},children:[k&&R?Gt.jsx(mu,{tokens:[k,R],width:24,mr:6,chainId:C.chainId,showChainLogo:!0}):"",Gt.jsxs(x,{sx:{typography:"body2",fontWeight:600},children:[`${null==k?void 0:k.symbol}/${null==R?void 0:R.symbol}`,Gt.jsx(om,{address:C.id,chainId:C.chainId})]})]}),O?Gt.jsxs(x,{sx:{p:8,typography:"h6",fontWeight:"bold",background:`linear-gradient(180deg, ${L(r.palette.secondary.main,.3)} 0%, ${L(r.palette.purple.main,.3)} 100%)`,borderRadius:8,color:"purple.main",whiteSpace:"nowrap"},children:["✨ ",Gt.jsx(n,{id:"Sti4vy",message:"Mining"})]}):""]}),Gt.jsxs(x,{sx:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",rowGap:20,mt:44,"& > div:nth-child(odd)":{pr:20},"& > div:nth-child(even)":{position:"relative",pl:20,"&::before":{position:"absolute",left:0,top:"50%",transform:"translateY(-50%)",display:"inline-block",content:'""',height:24,width:"1px",backgroundColor:"border.main"}}},children:[o&&Gt.jsxs(x,{children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,whiteSpace:"nowrap"},children:[F,Gt.jsx(W,{title:Gt.jsx(n,{id:"O6RUgz",message:"Fee rate"}),children:Gt.jsx(x,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary"},children:Ap({type:C.type,lpFeeRate:null!==(h=C.lpFeeRate)&&void 0!==h?h:0,mtFeeRate:null!==(m=C.mtFeeRate)&&void 0!==m?m:0})})})]}),Gt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:Gt.jsx(n,{id:"1Qz63U",message:"Pool Type"})})]}),P?null:Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs(x,{children:[Gt.jsxs(x,{sx:{typography:"h5",color:"success.main"},children:[I,E?`/${E}`:""]}),Gt.jsxs(x,{sx:{typography:"h6",display:"flex",alignItems:"center",color:"text.secondary"},children:[Gt.jsx(n,{id:"rSayea",message:"APY"}),Gt.jsx(bm,{chainId:C.chainId,apy:C.apy,baseToken:k,quoteToken:R,hasQuote:!!E,hasMining:O,sx:{width:14,height:14}})]})]}),Gt.jsxs(x,{children:[Gt.jsxs(x,{sx:{typography:"h5"},children:["$",sa(new oe(C.tvl||0))]}),Gt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:Gt.jsx(n,{id:"FHKsZF",message:"TVL"})})]})]}),Z&&Gt.jsxs(x,{children:[Gt.jsx(x,{sx:{typography:"h5"},children:da({input:null===(y=null===(g=t.liquidityPositions)||void 0===g?void 0:g[0])||void 0===y?void 0:y.poolShare})}),Gt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:Gt.jsx(n,{id:"h3PbRN",message:"My Pool Share"})})]}),Gt.jsxs(x,{children:[Gt.jsx(x,{sx:{typography:"h5",display:"flex",alignItems:"center",fontWeight:"bold"},children:P?(null==V?void 0:V.liquidityUSD)?`$${Kr({input:V.liquidityUSD,decimals:2})}`:"-":Gt.jsxs(Gt.Fragment,{children:[S?Gt.jsx(Ms,{address:null==k?void 0:k.address,chainId:C.chainId,url:null==k?void 0:k.logoURI,width:18,height:18,sx:{mr:4}}):Gt.jsx(mu,{tokens:k&&R?[k,R]:[],width:18,mr:4,showChainLogo:!1,chainId:C.chainId}),M?Qr({input:M}):"",S&&Gt.jsxs(Gt.Fragment,{children:[" / ",Gt.jsx(Ms,{address:null==R?void 0:R.address,chainId:C.chainId,url:null==R?void 0:R.logoURI,width:18,height:18,sx:{mx:4}}),T?Qr({input:T}):"0"]})]})}),Gt.jsx(x,{sx:{typography:"h6",display:"flex",alignItems:"center",color:"text.secondary"},children:Gt.jsx(n,{id:"YHc3B+",message:"My Liquidity"})})]}),P&&Gt.jsxs(x,{children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,color:"text.primary"},children:[Gt.jsx(Wh,{outOfRange:null!==(v=null==V?void 0:V.outOfRange)&&void 0!==v&&v}),Gt.jsx(x,{children:Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs("span",{children:[Pp({price:null===(j=null==V?void 0:V.priceRange)||void 0===j?void 0:j.token0LowerPrice,atLimit:{},direction:Pu.LOWER})," "]}),null==k?void 0:k.symbol]})}),Gt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"19",viewBox:"0 0 18 19",fill:"none",children:Gt.jsx("path",{d:"M15.75 9.50293L12.75 12.5029L11.7 11.4529L12.8813 10.2529L5.11875 10.2529L6.3 11.4529L5.25 12.5029L2.25 9.50293L5.25 6.50293L6.31875 7.55293L5.11875 8.75293L12.8813 8.75293L11.7 7.55293L12.75 6.50293L15.75 9.50293Z",fill:"currentColor",fillOpacity:"0.5"})}),Gt.jsx(x,{children:Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs("span",{children:[Pp({price:null===(w=null==V?void 0:V.priceRange)||void 0===w?void 0:w.token1LowerPrice,atLimit:{},direction:Pu.UPPER})," "]}),null==k?void 0:k.symbol]})})]}),Gt.jsx(x,{sx:{typography:"h6",display:"flex",alignItems:"center",color:"text.secondary"},children:Gt.jsx(n,{id:"YA4hwj",message:"Price Range"})})]})]}),Gt.jsxs(x,{sx:{mt:20,display:"flex",gap:"8px"},children:[P?null:!!e&&Gt.jsx(gc,{fullWidth:!0,variant:b.Variant.outlined,size:b.Size.small,onClick:e=>{e.stopPropagation(),i({operate:Zh.Remove,pool:Wp(t),hasMining:O})},children:Gt.jsx(n,{id:"t/YqKh",message:"Remove"})}),Gt.jsx(gc,{fullWidth:!0,size:b.Size.small,onClick:e=>{e.stopPropagation(),i({operate:Zh.Add,pool:Wp(t),hasMining:O})},children:Gt.jsx(n,{id:"J/hVSQ",message:"{0}",values:{0:P?"Manage":"Add"}})}),o&&"PMM"===F&&Gt.jsx(xm,{chainId:C.chainId,address:C.id})]})]})},P?null==V?void 0:V.id:C.id+C.chainId)}))})}function Lm({account:e,lqList:t,operatePool:o,setOperatePool:r,supportAMM:a,onlyV3:l}){const s=y();return Gt.jsxs(ym,{children:[Gt.jsx(x,{component:"thead",children:Gt.jsxs(x,{component:"tr",children:[Gt.jsx(x,{component:"th",children:Gt.jsx(n,{id:"AxdOHo",message:"Pair"})}),a&&Gt.jsx(x,{component:"th",children:Gt.jsx(n,{id:"1Qz63U",message:"Pool Type"})}),l?null:Gt.jsx(x,{component:"th",children:Gt.jsx(n,{id:"FHKsZF",message:"TVL"})}),l?null:Gt.jsx(x,{component:"th",children:Gt.jsx(n,{id:"rSayea",message:"APY"})}),Gt.jsx(x,{component:"th",children:Gt.jsx(n,{id:"YHc3B+",message:"My Liquidity"})}),l?Gt.jsx(x,{component:"th",children:Gt.jsx(n,{id:"YA4hwj",message:"Price Range"})}):null,Gt.jsx(x,{component:"th",sx:{width:210}})]})}),Gt.jsx(x,{component:"tbody",children:null==t?void 0:t.map((t=>{var d,c,u,p,h,m,g,y,v,j,w,C,k,R,S,I,E,M;if(!(null==t?void 0:t.pair))return null;const T=t.pair,L=Lp(T.baseToken,T.chainId),O=Lp(T.quoteToken,T.chainId),V=f.utils.singleSideLp(T.type),A=T.apy?ca(new oe(null===(d=T.apy)||void 0===d?void 0:d.transactionBaseApy).plus(null!==(u=null===(c=T.apy)||void 0===c?void 0:c.miningBaseApy)&&void 0!==u?u:0)):void 0,F=V&&T.apy?ca(new oe(T.apy.transactionQuoteApy).plus(null!==(p=T.apy.miningQuoteApy)&&void 0!==p?p:0)):void 0;let Z,P;(null===(h=t.liquidityPositions)||void 0===h?void 0:h.length)&&t.liquidityPositions.forEach((e=>{var t,n,i,o,r;if(null==e?void 0:e.liquidityTokenBalance){const a=null===(t=e.id)||void 0===t?void 0:t.split("-");if(2===(null==a?void 0:a.length)){const t=a[1].toLocaleLowerCase();if((null===(i=null===(n=null==T?void 0:T.baseLpToken)||void 0===n?void 0:n.id)||void 0===i?void 0:i.toLocaleLowerCase())===t)return void(Z=new oe(e.liquidityTokenBalance));(null===(r=null===(o=null==T?void 0:T.quoteLpToken)||void 0===o?void 0:o.id)||void 0===r?void 0:r.toLocaleLowerCase())===t&&(P=new oe(e.liquidityTokenBalance))}}}));const B=null===(m=t.liquidityPositions)||void 0===m?void 0:m[0],N=T.type,U=Vp(N),H="SVM_AMMV2"===N,D="SVM_AMMV3"===N;let Y="";if(D)(null===(v=null===(y=null===(g=null==o?void 0:o.pool)||void 0===g?void 0:g.liquidityPositions)||void 0===y?void 0:y[0])||void 0===v?void 0:v.id)===(null==B?void 0:B.id)&&(Y=i._({id:"p3607o",message:"Managing"}));else if((null===(j=null==o?void 0:o.pool)||void 0===j?void 0:j.address)===T.id||(null==o?void 0:o.address)===T.id)if(o.operate===Zh.Remove)Y=i._({id:"0+31GV",message:"Removing"});else Y=i._({id:"1yHVE+",message:"Adding"});const z=!!(null===(w=T.miningAddress)||void 0===w?void 0:w[0]),X=s.palette.background.tag;return Gt.jsxs(x,{component:"tr",sx:{["&:hover td"+(Y?", & td":"")]:{backgroundImage:`linear-gradient(${X}, ${X})`}},children:[Gt.jsx(x,{component:"td",children:Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[L&&O?Gt.jsx(mu,{tokens:[L,O],width:24,mr:10,chainId:T.chainId,showChainLogo:!0}):"",Gt.jsxs(x,{children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,typography:"body2",fontWeight:600},children:[`${null==L?void 0:L.symbol}/${null==O?void 0:O.symbol}`,Gt.jsx(om,{address:T.id,chainId:T.chainId})]}),Gt.jsx(pu,{address:T.id,customChainId:T.chainId,truncate:!0,showCopy:!0,iconDarkHover:!0,iconSize:14,iconSpace:4,disabledAddress:a,onAddressClick:()=>{zc.getState().push({type:Yc.PoolDetail,params:{chainId:T.chainId,address:T.id}})},sx:{typography:"h6",color:"text.secondary"}})]})]})}),a&&Gt.jsx(x,{component:"td",children:Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4},children:[Gt.jsx(x,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary",whiteSpace:"nowrap"},children:U}),Gt.jsx(W,{title:Gt.jsx(n,{id:"O6RUgz",message:"Fee rate"}),children:Gt.jsx(x,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary"},children:Ap({type:T.type,lpFeeRate:null!==(C=T.lpFeeRate)&&void 0!==C?C:0,mtFeeRate:null!==(k=T.mtFeeRate)&&void 0!==k?k:0})})})]})}),D?null:Gt.jsx(x,{component:"td",children:Gt.jsxs(x,{sx:{typography:"body2"},title:T.tvl?`$${Qr({input:T.tvl||0})}`:void 0,children:["$",sa(new oe(T.tvl||0))]})}),D?null:Gt.jsx(x,{component:"td",children:Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[z?Gt.jsx(W,{title:i._({id:"Sti4vy",message:"Mining"}),children:Gt.jsxs(x,{component:"span",sx:{typography:"body2",color:"success.main"},children:["✨"," "]})}):"",Gt.jsx(bm,{chainId:T.chainId,apy:T.apy,baseToken:L,quoteToken:O,hasQuote:!!F,hasMining:z,children:Gt.jsxs(x,{component:"span",sx:{typography:"body2",fontWeight:600,display:"flex",alignItems:"center",width:"max-content",color:"success.main",cursor:"auto"},children:[A||"0%",F?`/${F}`:""]})})]})}),Gt.jsx(x,{component:"td",children:Gt.jsx(x,{sx:{display:"flex",alignItems:"center"},children:D?(null==B?void 0:B.liquidityUSD)?`$${Kr({input:B.liquidityUSD,decimals:2})}`:"-":Gt.jsxs(Gt.Fragment,{children:[V?Gt.jsx(Ms,{address:null==L?void 0:L.address,chainId:T.chainId,url:null==L?void 0:L.logoURI,width:24,height:24,noShowChain:!0,sx:{mr:4}}):Gt.jsx(mu,{tokens:L&&O?[L,O]:[],width:24,mr:4,showChainLogo:!1,chainId:T.chainId}),Z?Qr({input:Z}):"-",V&&Gt.jsxs(Gt.Fragment,{children:[" / ",Gt.jsx(Ms,{address:null==O?void 0:O.address,chainId:T.chainId,url:null==O?void 0:O.logoURI,width:24,height:24,noShowChain:!0,sx:{mx:4}}),P?Qr({input:P}):"0"]}),H&&Gt.jsx(W,{title:Gt.jsx(n,{id:"NXZdrO",message:"My pool share"}),children:Gt.jsx(x,{sx:{ml:4,px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary"},children:da({input:null===(S=null===(R=t.liquidityPositions)||void 0===R?void 0:R[0])||void 0===S?void 0:S.poolShare})})})]})})}),l?Gt.jsx(x,{component:"td",children:Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,color:"text.primary"},children:[Gt.jsx(Wh,{outOfRange:null!==(I=null==B?void 0:B.outOfRange)&&void 0!==I&&I}),Gt.jsx(x,{children:Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs("span",{children:[Pp({price:null===(E=null==B?void 0:B.priceRange)||void 0===E?void 0:E.token0LowerPrice,atLimit:{},direction:Pu.LOWER})," "]}),null==L?void 0:L.symbol]})}),Gt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"19",viewBox:"0 0 18 19",fill:"none",children:Gt.jsx("path",{d:"M15.75 9.50293L12.75 12.5029L11.7 11.4529L12.8813 10.2529L5.11875 10.2529L6.3 11.4529L5.25 12.5029L2.25 9.50293L5.25 6.50293L6.31875 7.55293L5.11875 8.75293L12.8813 8.75293L11.7 7.55293L12.75 6.50293L15.75 9.50293Z",fill:"currentColor",fillOpacity:"0.5"})}),Gt.jsx(x,{children:Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs("span",{children:[Pp({price:null===(M=null==B?void 0:B.priceRange)||void 0===M?void 0:M.token0UpperPrice,atLimit:{},direction:Pu.UPPER})," "]}),null==L?void 0:L.symbol]})})]})}):null,Gt.jsx(x,{component:"td",children:Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"8px"},children:[a&&"PMM"===U&&Gt.jsx(xm,{chainId:T.chainId,address:T.id}),Y?Gt.jsx(mm,{text:Y,onClick:()=>r(null)}):Gt.jsxs(Gt.Fragment,{children:[D?null:!!e&&Gt.jsx(gc,{variant:b.Variant.outlined,size:b.Size.small,onClick:e=>{e.stopPropagation(),r({operate:Zh.Remove,pool:Wp(t),hasMining:z})},children:Gt.jsx(n,{id:"t/YqKh",message:"Remove"})}),Gt.jsx(gc,{size:b.Size.small,onClick:()=>{r({pool:Wp(t),hasMining:z})},children:D?i._({id:"wckWOP",message:"Manage"}):i._({id:"m16xKo",message:"Add"})})]})]})})]},D?null==B?void 0:B.id:T.id+T.chainId)}))})]})}function Om({account:e,filterChainIds:t,activeChainId:n,handleChangeActiveChainId:i,operatePool:o,setOperatePool:r}){var a,l,s,d,c,u,p;y();const{minDevice:h,isMobile:m}=Ec(),g=je(),{onlyChainId:v,supportAMMV2:b,supportAMMV3:j,notSupportPMM:w}=Zr(),[C,k]=G.useState(!1),{filterTokens:R,filterASymbol:S,filterBSymbol:I,filterAddressLqList:E,handleDeleteToken:M,handleChangeFilterTokens:T,handleChangeFilterAddress:L}=Cm();let O=[];b&&O.push("SVM_AMMV2"),j&&C&&(O=["SVM_AMMV3"]);const W={currentPage:1,pageSize:1e3,user:e,filterState:{viewOnlyOwn:!0,filterTypes:O}},V=el(),A=V.getQuery(f.graphql.fetchMyLiquidityList,{where:Object.assign(Object.assign({},W),{filterState:Object.assign({filterASymbol:S,filterBSymbol:I},W.filterState)})}),F=we(Object.assign({},A));let Z=null!==(s=null===(l=null===(a=F.data)||void 0===a?void 0:a.liquidity_list)||void 0===l?void 0:l.lqList)&&void 0!==s?s:[];const P=!!(null==E?void 0:E.length);P?Z=[...E]:t&&(Z=null!==(p=null===(u=null===(c=null===(d=F.data)||void 0===d?void 0:d.liquidity_list)||void 0===c?void 0:c.lqList)||void 0===u?void 0:u.filter((e=>{var n,i;return t.includes(null!==(i=null===(n=null==e?void 0:e.pair)||void 0===n?void 0:n.chainId)&&void 0!==i?i:0)})))&&void 0!==p?p:[]);return Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs(x,{sx:Object.assign(Object.assign({py:16,display:"flex",gap:8},h(475)?{}:{flexDirection:"column"}),m?{}:{px:20,borderBottomWidth:1}),children:[Gt.jsxs(x,{sx:Object.assign(Object.assign({display:"flex",alignItems:"center",gap:8},h(475)?{}:{"& > button":{flex:1,flexBasis:"100%"}}),m?{flexWrap:"wrap"}:{}),children:[!v&&Gt.jsx(hm,{chainId:n,setChainId:i}),j&&Gt.jsx(Mm,{onlyV3:C,setOnlyV3:k,sx:m?{flexGrow:1,flexBasis:"100%"}:void 0}),Gt.jsx(jm,{value:R,onChange:T,searchAddress:(e,t)=>Vr(this,void 0,void 0,(function*(){var n;const i=V.getInfiniteQuery(f.graphql.fetchLiquidityList,"currentPage",{where:Object.assign(Object.assign({},W),{filterState:Object.assign({address:e},W.filterState)})}),o=null===(n=(yield g.fetchQuery(i)).liquidity_list)||void 0===n?void 0:n.lqList;return(null==o?void 0:o.length)?Gt.jsx(wm,{list:o,onClick:()=>{L(o),t()}}):null}))})]}),(P||!!R.length)&&Gt.jsxs(x,{sx:{my:0},children:[P?Gt.jsx(fm,{lqList:E,onDeleteTag:()=>L([])}):"",Gt.jsx(gm,{tags:R,onDeleteTag:M})]})]}),m?Gt.jsxs(im,{gap:12,children:[F.isLoading?Gt.jsx(vm,{}):"",!F.isLoading&&!(null==Z?void 0:Z.length)&&!F.error&&Gt.jsx(Kh,{sx:{mt:40},hasSearch:!!(n&&!v||S||I)}),!!F.error&&Gt.jsx(tm,{refresh:F.refetch,sx:{mt:40}}),Gt.jsx(Tm,{account:e,lqList:Z,setOperatePool:r,supportAMM:b||j})]}):Gt.jsxs(Gt.Fragment,{children:[Gt.jsx(Lm,{account:e,lqList:Z,operatePool:o,setOperatePool:r,supportAMM:b||j,onlyV3:C}),Gt.jsx(nm,{loading:F.isLoading,refetch:F.error?F.refetch:void 0,empty:!(null==Z?void 0:Z.length),hasSearch:!!(n&&!v||S||I)})]})]})}var Wm,Vm;function Am(){return Am=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Am.apply(null,arguments)}const Fm=e=>q.createElement("svg",Am({width:66,height:64,viewBox:"0 0 66 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},e),Wm||(Wm=q.createElement("rect",{width:64,height:60.1342,fill:"url(#pattern0)"})),Vm||(Vm=q.createElement("defs",null,q.createElement("pattern",{id:"pattern0",patternContentUnits:"objectBoundingBox",width:1,height:1},q.createElement("use",{xlinkHref:"#image0_2465_53170",transform:"matrix(0.00671141 0 0 0.00714286 -0.503356 -0.9)"})),q.createElement("image",{id:"image0_2465_53170",width:300,height:300,xlinkHref:"data:image/png;base64,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"}))));function Zm(e){var{sx:t}=e,n=Wr(e,["sx"]);return Gt.jsx(D,{...n,sx:Object.assign(Object.assign({},t),{display:"flex",flexDirection:"column",overflow:"hidden"})})}function Pm({params:t}){var n,r,a;const{isMobile:l}=Ec(),s=Zr((e=>e.noDocumentLink)),d=G.useRef(null),{account:c}=Br(),{poolTab:u,tabs:p,handleChangePoolTab:h}=function({account:t,paramsTab:n}){const{i18n:i}=e(),[o,r]=G.useState(ru.addLiquidity),{supportAMMV2:a,supportAMMV3:l,notSupportPMM:s}=Zr(),d=G.useMemo((()=>{const e=[{key:ru.addLiquidity,value:i._({id:"OBdohg",message:"Add Liquidity"})},{key:ru.myLiquidity,value:i._({id:"YHc3B+",message:"My Liquidity"})}];return s||e.push({key:ru.myCreated,value:a||l?i._({id:"zcVtwU",message:"My Pools (PMM)"}):i._({id:"fZFkP1",message:"My Pools"})}),e}),[i._,a,l,s]),c=G.useRef(!1);G.useEffect((()=>{const e=sessionStorage.getItem(iu);t&&e&&!c.current&&(c.current=!0,r(e))}),[t]);const u=e=>{r(e),sessionStorage.setItem(iu,e)};return G.useEffect((()=>{n&&u(n)}),[n]),{poolTab:o,tabs:d,handleChangePoolTab:u}}({account:c,paramsTab:null==t?void 0:t.tab}),{activeChainId:m,filterChainIds:f,handleChangeActiveChainId:g}=function(){const{chainId:e}=Br(),{onlyChainId:t}=Zr(),[n,i]=G.useState(t),r=G.useMemo((()=>void 0!==n?[n]:Es(e)?void 0:Object.values(o).filter((e=>!!Number(e)))),[e,n]);return G.useEffect((()=>{const e=sessionStorage.getItem(ou);e&&i(Number(e))}),[]),{activeChainId:n,filterChainIds:r,handleChangeActiveChainId:e=>{void 0===e?sessionStorage.removeItem(ou):sessionStorage.setItem(ou,String(e)),i(e)}}}(),[y,v]=G.useState(null);return Gt.jsxs(_c,{sx:Object.assign({},l?{p:20}:{display:"flex",gap:12,flex:1}),ref:d,children:[Gt.jsx(x,{sx:l?{}:{p:8,borderRadius:20,borderWidth:1,borderStyle:"solid",borderColor:"border.main",backgroundColor:"border.disabled",backdropFilter:"blur(5px)",flex:1,overflow:"hidden",height:"max-content",maxHeight:"100%"},children:Gt.jsxs(U,{value:u,onChange:(e,t)=>{h(t)},sx:l?{}:{display:"flex",flexDirection:"column",borderRadius:16,borderWidth:1,borderStyle:"solid",borderColor:"border.main",backgroundColor:"background.paper"},className:l?void 0:"gradient-card-border",children:[Gt.jsxs(x,{sx:l?{}:{display:"flex",justifyContent:"space-between",p:20,borderBottomWidth:1},children:[Gt.jsx(z,{tabs:p,variant:"rounded",tabsListSx:Object.assign({},l?{mb:16}:{borderBottomWidth:0,justifyContent:"space-between"}),tabSx:l?void 0:{mb:0}}),Gt.jsx(Em,{})]}),Gt.jsx(Zm,{value:ru.addLiquidity,sx:{display:"flex",flexDirection:"column",overflow:"hidden"},children:Gt.jsx(Sm,{account:c,filterChainIds:f,scrollParentRef:d,activeChainId:m,handleChangeActiveChainId:g,operatePool:y,setOperatePool:v})}),Gt.jsx(Zm,{value:ru.myLiquidity,children:Gt.jsx(Om,{account:c,filterChainIds:f,activeChainId:m,handleChangeActiveChainId:g,operatePool:y,setOperatePool:v})})]})}),Gt.jsxs(x,{sx:{position:"relative",width:s&&!y?"auto":375},children:[!s&&Gt.jsx(bh,{title:i._({id:"6y2TB3",message:"Liquidity"}),desc:i._({id:"QNrpkx",message:"Classical AMM-like pool. Suitable for most assets."}),linkTo:"https://docs.dodoex.io/product/tutorial/how-to-provide-liquidity",LeftImage:Fm}),"SVM_AMMV3"===(null===(n=null==y?void 0:y.pool)||void 0===n?void 0:n.type)&&y.pool.chainId?u===ru.myLiquidity&&(null===(a=null===(r=y.pool.liquidityPositions)||void 0===r?void 0:r[0])||void 0===a?void 0:a.nftMint)?Gt.jsx(Oh,{mint1Address:y.pool.baseToken.address,mint2Address:y.pool.quoteToken.address,feeAmount:Number(y.pool.lpFeeRate),poolId:y.pool.address,nftMint:y.pool.liquidityPositions[0].nftMint,onClose:()=>v(null)}):Gt.jsx(Ah,{mint1Address:y.pool.baseToken.address,mint2Address:y.pool.quoteToken.address,feeAmount:Number(y.pool.lpFeeRate),poolId:y.pool.address,onClose:()=>v(null),handleGoToAddLiquidityV3:e=>{zc.getState().push({type:Yc.createPoolAMMV3,params:e})}}):l?Gt.jsx(qh,{account:c,onClose:()=>v(null),modal:l,pool:null==y?void 0:y.pool,operate:null==y?void 0:y.operate,hasMining:!1,hidePoolInfo:!1}):!!y&&Gt.jsx(Xh,{account:c,onClose:()=>v(null),pool:null==y?void 0:y.pool,operate:null==y?void 0:y.operate,hasMining:!1,hidePoolInfo:!1,sx:{width:375,height:"max-content",backgroundColor:"background.paper",borderRadius:16,overflow:"hidden"}})]})]})}function Bm(){const{routerPage:e}=Zr(),t=zc((e=>e.page)),n=null!=e?e:t;switch(null==n?void 0:n.type){case Yc.Pool:return Gt.jsx(Pm,{params:n.params});case Yc.createPoolAMMV2:return Gt.jsx(ku,{});case Yc.createPoolAMMV3:return Gt.jsx(vh,{params:n.params,handleGoBack:()=>{zc.getState().push({type:Yc.Pool})},handleGoToPoolList:()=>{zc.getState().push({type:Yc.Pool})}});default:return Gt.jsx(Pm,{params:null==n?void 0:n.params})}}export{ku as AMMV2Create,Oh as AMMV3PositionManage,Ah as AMMV3PositionsView,vh as AddLiquidityV3,Ur as MetadataFlag,Yc as PageType,Bm as Pool,Pm as PoolList,Dc as Swap,hc as UnstyleWidget,mc as Widget,zc as useRouterStore};
23
+ */function md(){if(td)return ed;td=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;return ed=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var i={};return"abcdefghijklmnopqrst".split("").forEach((function(e){i[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},i)).join("")}catch(e){return!1}}()?Object.assign:function(i,o){for(var r,a,l=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(i),s=1;s<arguments.length;s++){for(var d in r=Object(arguments[s]))t.call(r,d)&&(l[d]=r[d]);if(e){a=e(r);for(var c=0;c<a.length;c++)n.call(r,a[c])&&(l[a[c]]=r[a[c]])}}return l},ed}function fd(){if(id)return nd;id=1;return nd="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}function gd(){return rd?od:(rd=1,od=Function.call.bind(Object.prototype.hasOwnProperty))}if("production"!==process.env.NODE_ENV){var xd=hd();_s.exports=function(){if(dd)return sd;dd=1;var e=hd(),t=md(),n=fd(),i=gd(),o=function(){if(ld)return ad;ld=1;var e=function(){};if("production"!==process.env.NODE_ENV){var t=fd(),n={},i=gd();e=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function o(o,r,a,l,s){if("production"!==process.env.NODE_ENV)for(var d in o)if(i(o,d)){var c;try{if("function"!=typeof o[d]){var u=Error((l||"React class")+": "+a+" type `"+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[d]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw u.name="Invariant Violation",u}c=o[d](r,d,l,a,null,t)}catch(e){c=e}if(!c||c instanceof Error||e((l||"React class")+": type specification of "+a+" `"+d+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof c+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),c instanceof Error&&!(c.message in n)){n[c.message]=!0;var p=s?s():"";e("Failed "+a+" type: "+c.message+(null!=p?p:""))}}}return o.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(n={})},ad=o}(),r=function(){};function a(){return null}return"production"!==process.env.NODE_ENV&&(r=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}),sd=function(l,s){var d="function"==typeof Symbol&&Symbol.iterator,c="@@iterator",u="<<anonymous>>",p={array:g("array"),bigint:g("bigint"),bool:g("boolean"),func:g("function"),number:g("number"),object:g("object"),string:g("string"),symbol:g("symbol"),any:f(a),arrayOf:function(e){return f((function(t,i,o,r,a){if("function"!=typeof e)return new m("Property `"+a+"` of component `"+o+"` has invalid PropType notation inside arrayOf.");var l=t[i];if(!Array.isArray(l))return new m("Invalid "+r+" `"+a+"` of type `"+v(l)+"` supplied to `"+o+"`, expected an array.");for(var s=0;s<l.length;s++){var d=e(l,s,o,r,a+"["+s+"]",n);if(d instanceof Error)return d}return null}))},element:f((function(e,t,n,i,o){var r=e[t];return l(r)?null:new m("Invalid "+i+" `"+o+"` of type `"+v(r)+"` supplied to `"+n+"`, expected a single ReactElement.")})),elementType:f((function(t,n,i,o,r){var a=t[n];return e.isValidElementType(a)?null:new m("Invalid "+o+" `"+r+"` of type `"+v(a)+"` supplied to `"+i+"`, expected a single ReactElement type.")})),instanceOf:function(e){return f((function(t,n,i,o,r){if(!(t[n]instanceof e)){var a=e.name||u;return new m("Invalid "+o+" `"+r+"` of type `"+((l=t[n]).constructor&&l.constructor.name?l.constructor.name:u)+"` supplied to `"+i+"`, expected instance of `"+a+"`.")}var l;return null}))},node:f((function(e,t,n,i,o){return y(e[t])?null:new m("Invalid "+i+" `"+o+"` supplied to `"+n+"`, expected a ReactNode.")})),objectOf:function(e){return f((function(t,o,r,a,l){if("function"!=typeof e)return new m("Property `"+l+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var s=t[o],d=v(s);if("object"!==d)return new m("Invalid "+a+" `"+l+"` of type `"+d+"` supplied to `"+r+"`, expected an object.");for(var c in s)if(i(s,c)){var u=e(s,c,r,a,l+"."+c,n);if(u instanceof Error)return u}return null}))},oneOf:function(e){return Array.isArray(e)?f((function(t,n,i,o,r){for(var a=t[n],l=0;l<e.length;l++)if(h(a,e[l]))return null;var s=JSON.stringify(e,(function(e,t){return"symbol"===b(t)?String(t):t}));return new m("Invalid "+o+" `"+r+"` of value `"+String(a)+"` supplied to `"+i+"`, expected one of "+s+".")})):("production"!==process.env.NODE_ENV&&r(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),a)},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&r("Invalid argument supplied to oneOfType, expected an instance of array."),a;for(var t=0;t<e.length;t++){var o=e[t];if("function"!=typeof o)return r("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+j(o)+" at index "+t+"."),a}return f((function(t,o,r,a,l){for(var s=[],d=0;d<e.length;d++){var c=(0,e[d])(t,o,r,a,l,n);if(null==c)return null;c.data&&i(c.data,"expectedType")&&s.push(c.data.expectedType)}return new m("Invalid "+a+" `"+l+"` supplied to `"+r+"`"+(s.length>0?", expected one of type ["+s.join(", ")+"]":"")+".")}))},shape:function(e){return f((function(t,i,o,r,a){var l=t[i],s=v(l);if("object"!==s)return new m("Invalid "+r+" `"+a+"` of type `"+s+"` supplied to `"+o+"`, expected `object`.");for(var d in e){var c=e[d];if("function"!=typeof c)return x(o,r,a,d,b(c));var u=c(l,d,o,r,a+"."+d,n);if(u)return u}return null}))},exact:function(e){return f((function(o,r,a,l,s){var d=o[r],c=v(d);if("object"!==c)return new m("Invalid "+l+" `"+s+"` of type `"+c+"` supplied to `"+a+"`, expected `object`.");var u=t({},o[r],e);for(var p in u){var h=e[p];if(i(e,p)&&"function"!=typeof h)return x(a,l,s,p,b(h));if(!h)return new m("Invalid "+l+" `"+s+"` key `"+p+"` supplied to `"+a+"`.\nBad object: "+JSON.stringify(o[r],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var f=h(d,p,a,l,s+"."+p,n);if(f)return f}return null}))}};function h(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function m(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function f(e){if("production"!==process.env.NODE_ENV)var t={},i=0;function o(o,a,l,d,c,p,h){if(d=d||u,p=p||l,h!==n){if(s){var f=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw f.name="Invariant Violation",f}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var g=d+":"+l;!t[g]&&i<3&&(r("You are manually calling a React.PropTypes validation function for the `"+p+"` prop on `"+d+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),t[g]=!0,i++)}}return null==a[l]?o?null===a[l]?new m("The "+c+" `"+p+"` is marked as required in `"+d+"`, but its value is `null`."):new m("The "+c+" `"+p+"` is marked as required in `"+d+"`, but its value is `undefined`."):null:e(a,l,d,c,p)}var a=o.bind(null,!1);return a.isRequired=o.bind(null,!0),a}function g(e){return f((function(t,n,i,o,r,a){var l=t[n];return v(l)!==e?new m("Invalid "+o+" `"+r+"` of type `"+b(l)+"` supplied to `"+i+"`, expected `"+e+"`.",{expectedType:e}):null}))}function x(e,t,n,i,o){return new m((e||"React class")+": "+t+" type `"+n+"."+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+o+"`.")}function y(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(y);if(null===e||l(e))return!0;var t=function(e){var t=e&&(d&&e[d]||e[c]);if("function"==typeof t)return t}(e);if(!t)return!1;var n,i=t.call(e);if(t!==e.entries){for(;!(n=i.next()).done;)if(!y(n.value))return!1}else for(;!(n=i.next()).done;){var o=n.value;if(o&&!y(o[1]))return!1}return!0;default:return!1}}function v(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||!!t&&("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}(t,e)?"symbol":t}function b(e){if(null==e)return""+e;var t=v(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function j(e){var t=b(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return m.prototype=Error.prototype,p.checkPropTypes=o,p.resetWarningCache=o.resetWarningCache,p.PropTypes=p,p},sd}()(xd.isElement,!0)}else _s.exports=function(){if(ud)return cd;ud=1;var e=fd();function t(){}function n(){}return n.resetWarningCache=t,cd=function(){function i(t,n,i,o,r,a){if(a!==e){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function o(){return i}i.isRequired=i;var r={array:i,bigint:i,bool:i,func:i,number:i,object:i,string:i,symbol:i,any:i,arrayOf:o,element:i,elementType:i,instanceOf:o,node:i,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return r.PropTypes=r,r}}()();var yd=Vt(_s.exports);function vd(e,t){return"production"===process.env.NODE_ENV?()=>null:function(...n){return e(...n)||t(...n)}}function bd(e,t,n,i,o){const r=e[t],a=o||t;if(null==r||"undefined"==typeof window)return null;let l;const s=r.type;return"function"!=typeof s||function(e){const{prototype:t={}}=e;return Boolean(t.isReactComponent)}(s)||(l="Did you accidentally use a plain function component for an element instead?"),void 0!==l?new Error(`Invalid ${i} \`${a}\` supplied to \`${n}\`. Expected an element that can hold a ref. ${l} For more information see https://mui.com/r/caveat-with-refs-guide`):null}const jd=vd(yd.element,bd);jd.isRequired=vd(yd.element.isRequired,bd);const wd="exact-prop: ​";function Cd(e){return e&&e.ownerDocument||document}const kd="undefined"!=typeof window?q.useLayoutEffect:q.useEffect;function Rd(e){const t=q.useRef(e);return kd((()=>{t.current=e})),q.useRef(((...e)=>(0,t.current)(...e))).current}function Sd(...e){return q.useMemo((()=>e.every((e=>null==e))?null:t=>{e.forEach((e=>{!function(e,t){"function"==typeof e?e(t):e&&(e.current=t)}(e,t)}))}),e)}const Id={};const Ed=[];class Md{static create(){return new Md}currentId=null;start(e,t){this.clear(),this.currentId=setTimeout((()=>{this.currentId=null,t()}),e)}clear=()=>{null!==this.currentId&&(clearTimeout(this.currentId),this.currentId=null)};disposeEffect=()=>this.clear}function Td(){const e=function(e,t){const n=q.useRef(Id);return n.current===Id&&(n.current=e(t)),n}(Md.create).current;var t;return t=e.disposeEffect,q.useEffect(t,Ed),e}const Ld={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function Od(e){var t,n,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Od(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function Wd(){for(var e,t,n=0,i="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Od(e))&&(i&&(i+=" "),i+=t);return i}function Vd(e,t=[]){if(void 0===e)return{};const n={};return Object.keys(e).filter((n=>n.match(/^on[A-Z]/)&&"function"==typeof e[n]&&!t.includes(n))).forEach((t=>{n[t]=e[t]})),n}function Ad(e){if(void 0===e)return{};const t={};return Object.keys(e).filter((t=>!(t.match(/^on[A-Z]/)&&"function"==typeof e[t]))).forEach((n=>{t[n]=e[n]})),t}function Fd(e){const{elementType:t,externalSlotProps:n,ownerState:i,skipResolvingSlotProps:o=!1,...r}=e,a=o?{}:function(e,t,n){return"function"==typeof e?e(t,n):e}(n,i),{props:l,internalRef:s}=function(e){const{getSlotProps:t,additionalProps:n,externalSlotProps:i,externalForwardedProps:o,className:r}=e;if(!t){const e=Wd(n?.className,r,o?.className,i?.className),t={...n?.style,...o?.style,...i?.style},a={...n,...o,...i};return e.length>0&&(a.className=e),Object.keys(t).length>0&&(a.style=t),{props:a,internalRef:void 0}}const a=Vd({...o,...i}),l=Ad(i),s=Ad(o),d=t(a),c=Wd(d?.className,n?.className,r,o?.className,i?.className),u={...d?.style,...n?.style,...o?.style,...i?.style},p={...d,...n,...s,...l};return c.length>0&&(p.className=c),Object.keys(u).length>0&&(p.style=u),{props:p,internalRef:d.ref}}({...r,externalSlotProps:a}),d=function(e,t,n){return void 0===e||"string"==typeof e?t:{...t,ownerState:{...t.ownerState,...n}}}(t,{...l,ref:Sd(s,a?.ref,e.additionalProps?.ref)},i);return d}function Zd(e){return e.substring(2).toLowerCase()}function Pd(e){const{children:t,disableReactTree:n=!1,mouseEvent:i="onClick",onClickAway:o,touchEvent:r="onTouchEnd"}=e,a=q.useRef(!1),l=q.useRef(null),s=q.useRef(!1),d=q.useRef(!1);q.useEffect((()=>(setTimeout((()=>{s.current=!0}),0),()=>{s.current=!1})),[]);const c=Sd((u=t)&&q.isValidElement(u)?u.props.propertyIsEnumerable("ref")?u.props.ref:u.ref:null,l);var u;const p=Rd((e=>{const t=d.current;d.current=!1;const i=Cd(l.current);if(!s.current||!l.current||"clientX"in e&&function(e,t){return t.documentElement.clientWidth<e.clientX||t.documentElement.clientHeight<e.clientY}(e,i))return;if(a.current)return void(a.current=!1);let r;r=e.composedPath?e.composedPath().indexOf(l.current)>-1:!i.documentElement.contains(e.target)||l.current.contains(e.target),r||!n&&t||o(e)})),h=e=>n=>{d.current=!0;const i=t.props[e];i&&i(n)},m={ref:c};return!1!==r&&(m[r]=h(r)),q.useEffect((()=>{if(!1!==r){const e=Zd(r),t=Cd(l.current),n=()=>{a.current=!0};return t.addEventListener(e,p),t.addEventListener("touchmove",n),()=>{t.removeEventListener(e,p),t.removeEventListener("touchmove",n)}}}),[p,r]),!1!==i&&(m[i]=h(i)),q.useEffect((()=>{if(!1!==i){const e=Zd(i),t=Cd(l.current);return t.addEventListener(e,p),()=>{t.removeEventListener(e,p)}}}),[p,i]),Gt.jsx(q.Fragment,{children:q.cloneElement(t,m)})}"production"!==process.env.NODE_ENV&&(Pd.propTypes={children:jd.isRequired,disableReactTree:yd.bool,mouseEvent:yd.oneOf(["onClick","onMouseDown","onMouseUp","onPointerDown","onPointerUp",!1]),onClickAway:yd.func.isRequired,touchEvent:yd.oneOf(["onTouchEnd","onTouchStart",!1])}),"production"!==process.env.NODE_ENV&&(Pd.propTypes=function(e){return"production"===process.env.NODE_ENV?e:{...e,[wd]:t=>{const n=Object.keys(t).filter((t=>!e.hasOwnProperty(t)));return n.length>0?new Error(`The following props are not supported: ${n.map((e=>`\`${e}\``)).join(", ")}. Please remove them.`):null}}}(Pd.propTypes));const Bd="base";function Nd(e,t){const n=Ld[t];return n?`${Bd}--${n}`:function(e,t){return`${Bd}-${e}-${t}`}(e,t)}const Ud="Snackbar";function Hd(e){return Nd(Ud,e)}!function(e,t){const n={};t.forEach((t=>{n[t]=Nd(e,t)}))}(Ud,["root"]);const Dd={disableDefaultClasses:!1},Yd=q.createContext(Dd);"production"!==process.env.NODE_ENV&&(Yd.displayName="ClassNameConfiguratorContext");const zd=()=>function(e,t,n){const i={};for(const o in e){const r=e[o];let a="";for(let e=0;e<r.length;e+=1){const i=r[e];i&&(a+=t(i)+" ",n&&n[i]&&(a+=n[i]+" "))}i[o]=a}return i}({root:["root"]},function(e){const{disableDefaultClasses:t}=q.useContext(Yd);return n=>t?"":e(n)}(Hd)),Xd=q.forwardRef((function(e,t){const{autoHideDuration:n=null,children:i,disableWindowBlurListener:o=!1,exited:r=!0,onBlur:a,onClose:l,onFocus:s,onMouseEnter:d,onMouseLeave:c,open:u,resumeHideDuration:p,slotProps:h={},slots:m={},...f}=e,g=zd(),{getRootProps:x,onClickAway:y}=function(e={}){const{autoHideDuration:t=null,disableWindowBlurListener:n=!1,onClose:i,open:o,resumeHideDuration:r}=e,a=Td();q.useEffect((()=>{if(o)return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)};function e(e){e.defaultPrevented||"Escape"===e.key&&i?.(e,"escapeKeyDown")}}),[o,i]);const l=Rd(((e,t)=>{i?.(e,t)})),s=Rd((e=>{i&&null!=e&&a.start(e,(()=>{l(null,"timeout")}))}));q.useEffect((()=>(o&&s(t),a.clear)),[o,t,s,a]);const d=a.clear,c=q.useCallback((()=>{null!=t&&s(null!=r?r:.5*t)}),[t,r,s]),u=e=>t=>{const n=e.onFocus;n?.(t),d()},p=e=>t=>{const n=e.onMouseEnter;n?.(t),d()},h=e=>t=>{const n=e.onMouseLeave;n?.(t),c()};return q.useEffect((()=>{if(!n&&o)return window.addEventListener("focus",c),window.addEventListener("blur",d),()=>{window.removeEventListener("focus",c),window.removeEventListener("blur",d)}}),[n,o,c,d]),{getRootProps:(t={})=>{const n={...Vd(e),...Vd(t)};return{role:"presentation",...t,...n,onBlur:(i=n,e=>{const t=i.onBlur;t?.(e),c()}),onFocus:u(n),onMouseEnter:p(n),onMouseLeave:h(n)};var i},onClickAway:e=>{i?.(e,"clickaway")}}}({...e,autoHideDuration:n,disableWindowBlurListener:o,onClose:l,open:u,resumeHideDuration:p}),v=e,b=m.root||"div",j=Fd({elementType:b,getSlotProps:x,externalForwardedProps:f,externalSlotProps:h.root,additionalProps:{ref:t},ownerState:v,className:g.root}),w=Fd({elementType:Pd,externalSlotProps:h.clickAwayListener,additionalProps:{onClickAway:y},ownerState:v});return delete w.ownerState,!u&&r?null:Gt.jsx(Pd,{...w,children:Gt.jsx(b,{...j,children:i})})}));function qd({size:e,color:t,time:n,strokeWidth:i=2,sx:o}){const[r,a]=_("0 1069"),l=e/2,s=l-1;return J((()=>{a(2*Math.PI*s+" 0")}),[]),Gt.jsx(x,{width:e,height:e,component:"svg",sx:Object.assign({position:"absolute",top:`-${i}`,left:`-${i}`,transform:"rotate(-90deg)"},o),children:Gt.jsx(x,{component:"circle",cx:l,cy:l,r:s,strokeWidth:i,stroke:t,fill:"none",strokeDasharray:r,sx:{transition:`stroke-dasharray ${n}`}})})}"production"!==process.env.NODE_ENV&&(Xd.propTypes={autoHideDuration:yd.number,children:yd.node,disableWindowBlurListener:yd.bool,exited:yd.bool,onClose:yd.func,open:yd.bool,resumeHideDuration:yd.number,slotProps:yd.shape({clickAwayListener:yd.oneOfType([yd.func,yd.shape({children:yd.element.isRequired,disableReactTree:yd.bool,mouseEvent:yd.oneOf(["onClick","onMouseDown","onMouseUp","onPointerDown","onPointerUp",!1]),onClickAway:yd.func,touchEvent:yd.oneOf(["onTouchEnd","onTouchStart",!1])})]),root:yd.oneOfType([yd.func,yd.object])}),slots:yd.shape({root:yd.elementType})});var Gd=G.memo(qd);const _d=Be((e=>({notify:null,toast:t=>{e({notify:t})},close:()=>{e({notify:null})}}))),Jd={entering:"translateX(0)",entered:"translateX(0)",exiting:"translateX(500px)",exited:"translateX(500px)",unmounted:"translateX(500px)"};function Qd(){const e=y(),{notify:t,close:n}=_d(),[i,o]=G.useState(!0),r=G.useRef(null),a=null==t?void 0:t.timeout,l=!!t;let s=Gt.jsxs("svg",{width:"36",height:"36",viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Gt.jsx("circle",{cx:"18",cy:"18",r:"16.5",stroke:"#2FBA90",strokeWidth:"3"}),Gt.jsx("path",{d:"M25.1384 11.334L14.8873 21.5851L10.8584 17.5718L8.66504 19.7651L14.8873 25.9873L27.3317 13.5429L25.1384 11.334Z",fill:"#2FBA90"})]});switch(null==t?void 0:t.type){case"error":s=Gt.jsxs("svg",{width:"36",height:"37",viewBox:"0 0 36 37",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Gt.jsx("circle",{cx:"18",cy:"18.5",r:"16.5",stroke:"#FF6187",strokeWidth:"3"}),Gt.jsx("path",{d:"M25.3331 13.0452L19.8782 18.5L25.3331 23.9548L23.5148 25.7731L18.06 20.3183L12.6051 25.7731L10.7869 23.9548L16.2417 18.5L10.7869 13.0452L12.6051 11.2269L18.06 16.6817L23.5148 11.2269L25.3331 13.0452Z",fill:"#FF6187"})]});break;case"warning":s=Gt.jsxs("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Gt.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.4065 3.6189L9.62438 3.59576L3.39812 9.78928L3.37498 18.5714L9.5685 24.7976L18.3506 24.8208L24.5769 18.6273L24.6 9.84516L18.4065 3.6189ZM26.9359 8.88481L19.3791 1.28812L8.66403 1.25988L1.06734 8.81663L1.0391 19.5317L8.59585 27.1284L19.311 27.1567L26.9076 19.5999L26.9359 8.88481Z",fill:"#B15600"}),Gt.jsx("path",{d:"M15.1664 7.58398H12.8331V16.9173H15.1664V7.58398Z",fill:"#B15600"}),Gt.jsx("path",{d:"M13.9998 21.6395C14.8896 21.6395 15.6109 20.9181 15.6109 20.0283C15.6109 19.1386 14.8896 18.4172 13.9998 18.4172C13.11 18.4172 12.3887 19.1386 12.3887 20.0283C12.3887 20.9181 13.11 21.6395 13.9998 21.6395Z",fill:"#B15600"})]})}return Gt.jsx(x,{component:Xd,open:l,autoHideDuration:a,onClose:(e,t)=>{"clickaway"!==t&&n()},exited:i,sx:{position:"fixed",top:20,left:20,right:20,zIndex:1,[e.breakpoints.up("tablet")]:{left:"auto"}},children:Gt.jsx(gt,{timeout:{enter:400,exit:400},in:l,appear:!0,unmountOnExit:!0,onEnter:()=>{o(!1)},onExited:()=>{o(!0)},nodeRef:r,children:i=>Gt.jsxs(x,{ref:r,sx:{display:"flex",justifyContent:"space-between",p:12,borderRadius:8,backgroundColor:"background.paper",color:"text.primary",border:"solid 1px",borderColor:"border.main",boxShadow:"0px 6px 12px 0px rgba(0, 0, 0, 0.10)",transform:Jd[i],transition:"transform 300ms ease",[e.breakpoints.up("tablet")]:{p:20,width:"auto",maxWidth:328}},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[Gt.jsx(x,{sx:{mt:7,"& > svg":{width:28,height:28},[e.breakpoints.up("tablet")]:{"& > svg":{width:36,height:36}}},children:t?s:""}),Gt.jsxs(x,{sx:{ml:20},children:[Gt.jsx(x,{sx:{typography:"caption"},children:null==t?void 0:t.message}),(null==t?void 0:t.link)?Gt.jsxs(x,{component:"a",target:"_blank",rel:"noopener noreferrer",href:t.link.outerLink,sx:{display:"inline-flex",alignItems:"center",typography:"body2",color:"text.secondary","&:hover":{color:"text.primary"}},children:[t.link.text,Gt.jsx(x,{component:"svg",width:"18",height:"19",viewBox:"0 0 18 19",fill:"none",xmlns:"http://www.w3.org/2000/svg",sx:{ml:4,width:18,height:18},children:Gt.jsx("path",{d:"M4.22703 13.2122L10.6811 6.75812L4.75206 6.75812L4.75736 5.25729H13.2426V13.7426H11.7471L11.7418 7.81878L5.28769 14.2729L4.22703 13.2122Z",fill:"currentColor"})})]}):"",(null==t?void 0:t.content)?Gt.jsx(x,{sx:{mt:4,typography:"body2",color:"text.secondary"},children:t.content}):""]})]}),Gt.jsxs(x,{sx:{position:"relative",top:10,ml:12,display:"flex",alignItems:"center",justifyContent:"center",width:24,height:24,borderRadius:12,borderStyle:"solid",borderWidth:a?"2.4px":0,borderColor:e.palette.border.main,backgroundColor:a?"transparent":e.palette.background.paperDarkContrast,cursor:"pointer",boxSizing:"border-box",[e.breakpoints.up("tablet")]:{ml:28}},onClick:n,children:[a?Gt.jsx(Gd,{size:24,strokeWidth:"2.4px",time:`${a}ms`,color:e.palette.text.disabled}):"",Gt.jsx(x,{component:"svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",sx:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:16,height:16,border:"none",color:e.palette.text.disabled},children:Gt.jsx("g",{children:Gt.jsx("path",{d:"M12.8897 4.36345L9.25313 8L12.8897 11.6365L11.6775 12.8487L8.04095 9.21218L4.4044 12.8487L3.19221 11.6365L6.82876 8L3.19221 4.36345L4.4044 3.15127L8.04095 6.78782L11.6775 3.15127L12.8897 4.36345Z",fill:"currentColor"})})})]})]})})})}var Kd;function $d(){return $d=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},$d.apply(null,arguments)}const ec=e=>q.createElement("svg",$d({width:"33px",height:"33px",viewBox:"0 0 33 33",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},e),Kd||(Kd=q.createElement("g",{stroke:"none",strokeWidth:1,fill:"none",fillRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round"},q.createElement("g",{transform:"translate(-186.000000, -375.000000)",stroke:"currentColor",strokeWidth:4},q.createElement("g",{transform:"translate(18.000000, 291.000000)"},q.createElement("g",{transform:"translate(40.000000, 83.000000)"},q.createElement("path",{d:"M159,32 C159,15.9837423 146.016258,3 130,3"}))))))),tc=300;function nc({open:e,onClose:t,afterClose:n,title:i,rightSlot:o,canBack:r=!0,children:a,height:l,testId:s}){return Gt.jsxs(x,{sx:{position:"absolute",top:e?0:"100%",transition:`all ${tc}ms`,zIndex:20,left:0,right:0,bottom:0,display:"flex",flexDirection:"column",backgroundColor:"background.paper",borderRadius:16,height:l},"data-testid":s,"data-active":e?"1":"0",children:[i?Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",p:20},children:[Gt.jsx(x,{sx:{display:"flex",alignItems:"center",typography:"caption"},children:i}),o,!o&&r&&Gt.jsx(x,{component:Ft.Error,sx:{color:"text.secondary",cursor:"pointer"},onClick:()=>{t&&t(),setTimeout((()=>n&&n()),tc)}})]}):"",e?a:""]})}function ic({open:e,onClose:t,afterClose:n,title:i,rightSlot:o,canBack:r=!0,children:a,height:l,testId:s}){return Gt.jsx(v,{open:e,onClose:t,"data-testid":s,"data-active":e?"1":"0",children:Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column",height:l},children:[i?Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",p:20},children:[Gt.jsx(x,{sx:{display:"flex",alignItems:"center",typography:"caption"},children:i}),o,!o&&r&&Gt.jsx(x,{component:Ft.Error,sx:{color:"text.secondary",cursor:"pointer"},onClick:()=>{t&&t(),setTimeout((()=>n&&n()),tc)}})]}):"",e?a:""]})})}function oc(e){var{scope:t,modal:n}=e,i=Wr(e,["scope","modal"]);const{widgetRef:o,DialogComponent:r}=Zr();if(r)return Gt.jsx(r,{scope:t,...i});const a=n?ic:nc;return(null==o?void 0:o.current)&&!t?xt(Gt.jsx(a,{...i}),o.current):Gt.jsx(a,{...i})}const rc=6;function ac({showingDone:e,errorMessage:t}){var n;const i=y();return t?Gt.jsx(x,{component:Ft.ErrorWarn,sx:{width:64,height:64,color:"error.main"}}):e?Gt.jsx(x,{component:Ft.DoneBorder,sx:{width:64,height:64,color:"success.main"}}):Gt.jsx(x,{sx:{mx:"auto",border:`${rc}px solid ${null===(n=i.palette)||void 0===n?void 0:n.background.input}`,borderRadius:"50%",width:"64px",height:"64px",position:"relative",animation:"loadingRotate 1.1s infinite linear","@keyframes loadingRotate":{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(359deg)"}}},children:Gt.jsx(x,{component:ec,sx:{position:"absolute",top:`-${rc}px`,right:`-${rc}px`,color:"primary.main"}})})}function lc({showingDone:e,showing:t}){return Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",flexDirection:"column"},children:[Gt.jsx(x,{sx:{mt:60},children:e?i._({id:"4xbbt/",message:"{0} confirmed",values:{0:null==t?void 0:t.brief}}):i._({id:"/nzjSF",message:"{0} pending",values:{0:null==t?void 0:t.brief}})}),(null==t?void 0:t.subtitle)?Gt.jsx(x,{sx:{mt:20,typography:"body2"},children:null==t?void 0:t.subtitle}):""]})}function sc({isStarted:e,isEnded:t,tx:i}){const[o,r]=_(0),{chainId:a}=Br(),l=K((()=>`https://${yr[a||1]}/tx/${i}`),[i,a]),s=K((()=>{const e=Math.floor(o/60),t=o%60;return e?`${e}m ${t}s`:`${t}s`}),[o]),d=te();return J((()=>(e&&(r(0),window.clearInterval(d.current),d.current=window.setInterval((()=>{r((e=>e+1))}),1e3)),()=>{window.clearInterval(d.current)})),[e]),J((()=>{t&&window.clearInterval(d.current)}),[t]),Gt.jsxs(x,{sx:{mt:20,pt:20,display:"flex",justifyContent:"space-between",alignItems:"center",typography:"body2",color:"text.secondary",border:"solid 1px transparent",borderTopColor:"border.main"},children:[Gt.jsxs(x,{children:[Gt.jsx(n,{id:"+Jkdiu",message:"Transaction Time:"}),s]}),Gt.jsxs(j,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},component:"a",href:l,target:"_blank",rel:"noopener noreferrer",children:[Gt.jsx(n,{id:"S3piC2",message:"Tx"}),Gt.jsx(x,{component:Ft.ArrowTopRightBorder,sx:{width:16,height:16,ml:6}})]})]})}function dc(e){var{children:t,executionStatus:i}=e;const o=ka(Wr(e,["children","executionStatus"])),{ctxVal:r,showing:a,closeShowing:l,showingDone:s,errorMessage:d,transactionTx:c}=Object.assign(Object.assign({},o),i),u=pe(),p=Zr((e=>e.noSubmissionDialog));return Gt.jsxs(Ra.Provider,{value:r,children:[t,Gt.jsx(oc,{open:!!a&&!p,onClose:l,id:"submission",modal:!0,children:Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column",justifyContent:"space-between",px:20,pb:20,flex:1,overflowY:"auto"},children:[Gt.jsxs(x,{children:[Gt.jsx(x,{sx:{textAlign:"center",pt:60},children:Gt.jsx(ac,{showingDone:s,errorMessage:d})}),d?Gt.jsxs(x,{sx:{textAlign:"center",mt:60},children:[Gt.jsx(x,{children:Gt.jsx(n,{id:"kf83Ld",message:"Something went wrong."})}),Gt.jsx(x,{sx:{color:"text.secondary",mt:12,typography:"body2",wordBreak:"break-all"},children:d})]}):Gt.jsxs(Gt.Fragment,{children:[Gt.jsx(lc,{showingDone:s,showing:a}),Gt.jsx(sc,{isStarted:!!a,isEnded:s,tx:c})]})]}),Gt.jsx(b,{fullWidth:!0,size:b.Size.big,onClick:()=>{u(Yr(qr.Initial)),l()},sx:{mt:20},children:d?Gt.jsx(n,{id:"1QfxQT",message:"Dismiss"}):Gt.jsx(n,{id:"yz7wBu",message:"Close"})})]})})]})}const cc="dodo-widget-container";function uc(e){return e.noLangProvider?Gt.jsx(Gt.Fragment,{children:e.children}):Gt.jsx(zs,{locale:e.locale,children:Gt.jsx(dc,{...e,children:e.children})})}function pc(e){!function({tokenList:e,popularTokenList:t}){const n=pe();J((()=>{(()=>{Vr(this,void 0,void 0,(function*(){let i=[];i=se(e)?e:le(t,ll,(e=>e.address.toLowerCase()+e.chainId+e.side)),n(sl(i))}))})()}),[e,n,t]),J((()=>{n(dl(null!=t?t:[]))}),[t,n])}(e),ja();const t=e.width||375,n=e.height||494,{widgetRef:i}=Zr();return e.noUI?Gt.jsx(uc,{...e,children:e.children}):Gt.jsx(uc,{...e,children:Gt.jsx(x,{sx:{width:t,height:n,overflow:"hidden",position:"relative",display:"flex",flexDirection:"column",minWidth:335,minHeight:494,borderRadius:16,backgroundColor:"background.paper"},className:cc,ref:i,children:e.children})})}function hc(e){var t,n;const i=te(null);return Gt.jsx(me,{store:Pa,children:Gt.jsx(Fr,{...Object.assign(Object.assign({},e),{widgetRef:null!==(t=e.widgetRef)&&void 0!==t?t:i,apiDomain:null!==(n=e.apiDomain)&&void 0!==n?n:"dodoex.io"}),children:Gt.jsx(qs,{children:Gt.jsx(As,{children:Gt.jsx(pc,{...e})})})})})}function mc(e){const t=w({mode:e.colorMode,theme:e.theme,lang:e.locale||Ts});return e.apikey||e.apiServices||console.error("apikey and apiServices must have a."),Gt.jsxs(C,{theme:t,children:[Gt.jsx(k,{container:`.${cc}, .${R}, .${S}`}),Gt.jsx(Re,{client:Xs,children:Gt.jsxs(hc,{...e,children:[e.children,Gt.jsx(Qd,{})]})})]})}function fc(e){var{sx:t}=e,n=Wr(e,["sx"]);const{width:i}=Zr(),o=K((()=>{let e="";return"number"==typeof i?e=`${i}px`:i&&(e=i),e?`calc(${e} - 40px)`:"auto"}),[i]);return Gt.jsx(I,{container:document.querySelector(`.${cc}`),maxWidth:o,sx:Object.assign({cursor:"help"},t),...n})}function gc(e){var t,{chainId:i,includeButton:o}=e,r=Wr(e,["chainId","includeButton"]);const{account:a,chainId:l}=Br(),{onConnectWalletClick:s}=Zr(),[d,c]=G.useState(!1),{setVisible:u}=ft();return!a||d||void 0===l||i&&i!==l?Gt.jsx(Gt.Fragment,{children:Gt.jsx(b,{...r,isLoading:d,onClick:()=>Vr(this,void 0,void 0,(function*(){if(s){c(!0);const e=yield s();if(c(!1),e)return}u(!0)})),children:d?Gt.jsx(n,{id:"J28zul",message:"Connecting..."}):Gt.jsx(n,{id:"r7ScnQ",message:"Connect to a wallet"})})}):o?Gt.jsx(Gt.Fragment,{children:null!==(t=r.children)&&void 0!==t?t:null}):Gt.jsx(b,{...r})}function xc({needSwitchChain:e}){return Gt.jsx(Gt.Fragment,{children:Gt.jsx(gc,{size:b.Size.middle,fullWidth:!0,"data-testid":Er,chainId:e})})}function yc({open:e,execute:t,onClose:i,toToken:o,fromToken:r,fromAmount:a,toAmount:l,priceImpact:s,clearFromAmt:d,clearToAmt:c,baseFeeAmount:u,curToFiatPrice:p,curFromFiatPrice:h,additionalFeeAmount:m,loading:f,slippage:g}){var v,j;const w=y(),C=pe(),k=he(Ba),R=K((()=>!!s&&new oe(s).gt(Cr)),[s]),[S,I]=_(!1),[T,L]=_(!1);return J((()=>{k!==qr.Pending&&i(),k===qr.TxSuccess&&(c(),d())}),[k]),J((()=>{I(!1)}),[p]),Gt.jsx(oc,{open:e,onClose:()=>{C(Yr(qr.Initial)),i()},id:"swap-summary",title:Gt.jsx(n,{id:"QR4/RH",message:"Swap summary"}),children:Gt.jsxs(x,{sx:{margin:20,display:"flex",height:"100%",flexDirection:"column",borderTop:`1px solid ${w.palette.border.main}`},children:[Gt.jsxs(x,{sx:{py:20,display:"flex",typography:"body2",alignItems:"center",justifyContent:"center",flexDirection:"column",borderBottom:`1px solid ${w.palette.border.main}`},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[Gt.jsxs(x,{children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"center"},children:[Gt.jsx(Ms,{width:16,height:16,url:null==r?void 0:r.logoURI,address:null!==(v=null==r?void 0:r.address)&&void 0!==v?v:"",marginRight:6}),Gt.jsx(x,{children:`${Kr({input:a,decimals:null==r?void 0:r.decimals})} ${null==r?void 0:r.symbol}`})]}),null!==h&&Gt.jsx(x,{sx:{mt:4,typography:"h6",color:w.palette.text.secondary},children:h?`$${Qr({input:h,showDecimals:1})}`:"-"})]}),Gt.jsx(x,{sx:{width:16,mx:16},component:Ft.DoubleRight}),Gt.jsxs(x,{children:[Gt.jsxs(x,{sx:{display:"flex"},children:[Gt.jsx(Ms,{width:16,height:16,marginRight:6,url:null==o?void 0:o.logoURI,address:null!==(j=null==o?void 0:o.address)&&void 0!==j?j:""}),Gt.jsx(E,{loading:f,loadingProps:{width:30},children:`${Kr({input:l,decimals:null==o?void 0:o.decimals})} ${null==o?void 0:o.symbol}`})]}),null!==h&&Gt.jsx(E,{loading:f,loadingProps:{width:30},sx:{typography:"h6",mt:4,color:w.palette.text.secondary},children:p?`$${Qr({input:p,showDecimals:1})}(${s}%)`:"-"})]})]}),Gt.jsxs(x,{sx:{mt:12,display:"flex",alignItems:"center",typography:"h6"},children:["1",null==r?void 0:r.symbol," = ",Gt.jsx(E,{loading:f,loadingProps:{width:30},children:Kr({input:new oe(l).dividedBy(new oe(a)),decimals:null==o?void 0:o.decimals})})," ",null==o?void 0:o.symbol]})]}),Gt.jsxs(x,{sx:{py:15,typography:"body2",borderBottom:`1px solid ${w.palette.border.main}`},children:[Gt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",color:w.palette.text.secondary},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[Gt.jsx(x,{sx:{width:16,mr:7},component:Ft.DetailBorder}),Gt.jsx(n,{id:"XeovX3",message:"Swap Detail"})]}),Gt.jsx(x,{component:M,children:Gt.jsx(x,{onClick:()=>L(!T),sx:{width:10,color:"text.secondary",transform:T?"rotateX(0deg)":"rotateX(180deg)"},component:Ft.CaretUp})})]}),Gt.jsxs(x,{sx:{mt:16,display:T?"initial":"none"},children:[Gt.jsxs(x,{sx:{mt:8,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[Gt.jsx(n,{id:"93m8jT",message:"Basic Fee"}),Gt.jsx(fc,{title:Gt.jsx(n,{id:"8Z29ZO",message:"Estimated service provider fees"}),ml:5})]}),Gt.jsx(E,{loading:f,loadingProps:{width:30},children:u?`${Kr({input:u,decimals:null==o?void 0:o.decimals})} ${null==o?void 0:o.symbol}`:"0"})]}),Gt.jsxs(x,{sx:{mt:8,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[Gt.jsx(n,{id:"J39pAJ",message:"Additional Fee"}),Gt.jsx(fc,{title:Gt.jsx(n,{id:"ZXvy7b",message:"Additional routing fees set by the Widget user"}),ml:5})]}),Gt.jsx(E,{loading:f,loadingProps:{width:30},children:m?`${Kr({input:m,decimals:null==o?void 0:o.decimals})} ${null==o?void 0:o.symbol}`:"0"})]}),!!s&&Gt.jsxs(x,{sx:{mt:8,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[Gt.jsx(n,{id:"T+qgFw",message:"Price Impact"}),Gt.jsx(fc,{title:Gt.jsx(n,{id:"4kY4C4",message:"Due to the market condition, market price and estimated price may have a slight difference"}),ml:5})]}),Gt.jsx(x,{children:`${s}%`})]}),Gt.jsxs(x,{sx:{mt:8,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[Gt.jsx(n,{id:"CMHmbm",message:"Slippage"}),Gt.jsx(fc,{title:Gt.jsx(n,{id:"GAypnX",message:"High slippage tolerance will increase the success rate of transaction, but might not get the best quote."}),ml:5})]}),Gt.jsxs(x,{children:[g,"%"]})]})]})]}),Gt.jsx(x,{sx:{flex:1}}),R&&Gt.jsxs(x,{sx:{mb:14,display:"flex",cursor:"pointer",justifyContent:"center",alignItems:"center",typography:"h6"},onClick:()=>I(!S),children:[Gt.jsx(x,{sx:{mr:4,width:18,height:18,alignItems:"center"},children:S?Gt.jsx(x,{sx:{width:"100%",height:"100%",borderRadius:4,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"secondary.main"},children:Gt.jsx(x,{component:Ft.Done,sx:{width:14,color:"#1a1a1b"}})}):Gt.jsx(x,{sx:{width:"100%",height:"100%",borderRadius:4,border:`1px solid ${w.palette.text.secondary}`}})}),Gt.jsx(x,{children:Gt.jsx(n,{components:{0:Gt.jsx(x,{component:"span",sx:{color:"error.main"}})},values:{priceImpact:s},id:"Price impact reaches <0>{priceImpact}</0>%, accept the quote"})})]}),Gt.jsx(b,{isLoading:k==qr.Pending,disabled:R&&!S,fullWidth:!0,onClick:()=>{t(),C(Yr(qr.Pending))},children:k==qr.Pending?Gt.jsx(n,{id:"P+K/3O",message:"Confirming"}):Gt.jsx(n,{id:"lQ6r7x",message:"Confirm swap"})})]})})}var vc;function bc({fromToken:e,toToken:t}){const i=y(),{onlySolana:o}=Zr();Ka();const{customSlippage:r,customSlippageNum:a,handleSlippageChange:l,forecastSlippage:s,forecastSlippageQuery:d,recommendSlippage:c}=tl({fromToken:e,toToken:t}),[u,p]=G.useState(!1),[h,m]=G.useState();!h&&e&&t&&m(r?vc.custom:vc.recommend);const f=h===vc.custom;return G.useRef(null),G.useMemo((()=>h===vc.custom?a?new oe(a).div(100).toNumber():void 0:new oe(c).div(100).toNumber()),[h,c,a]),G.useCallback((e=>{f||m(vc.custom),l({slippage:new oe(e).times(100).toString(),disabled:!1,deleted:!1,recommend:String(c)})}),[f,c,l]),o?Gt.jsxs(x,{sx:{pt:20,borderTop:`1px solid ${i.palette.border.main}`},children:[Gt.jsxs(x,{sx:{mb:16,display:"flex",alignItems:"center"},children:[Gt.jsx(n,{id:"lqTDfd",message:"Slippage Tolerance"}),Gt.jsx(I,{title:Gt.jsx(n,{id:"KAmxpM",message:"Attention: High slippage tolerance will increase the success rate of transaction, but might not get the best quote."}),ml:7})]}),Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column"},children:[Gt.jsx(T,{placeholder:String(c),fullWidth:!0,sx:{height:36,"& input":{boxSizing:"border-box","&::placeholder":{color:"custom.input.placeholder",opacity:1}}},inputMode:"decimal",suffix:Gt.jsx(x,{sx:{color:"text.disabled"},children:"%"}),value:r||"",onChange:e=>{const t=e.target.value;l({slippage:t,disabled:!1,recommend:String(c)})},onBlur:()=>{setTimeout((()=>{if(p(!1),!a)return void m(vc.recommend);const e=!a||a<0;e&&r&&l({slippage:r,disabled:e,deleted:e,recommend:String(c)})}),10)}}),Number(r)>=Rr&&Gt.jsx(x,{sx:{typography:"h6",mt:6,color:"error.main"},children:Gt.jsx(n,{id:"Zm56FI",message:"Maximum slippage do not exceed 50%"})})]})]}):null}function jc({checked:e,onChange:t,sx:i,disabled:o}){const r=y();let a=r.palette.background.paper;return e&&(a=r.palette.secondary.main),Gt.jsxs(x,{sx:Object.assign({display:"flex",alignItems:"center",position:"relative",borderRadius:8,backgroundColor:r.palette.background.input,opacity:o?.5:1},i),component:M,disabled:o,onClick:()=>{o||t(!e)},children:[Gt.jsx(x,{sx:{typography:"body2",fontWeight:600,pl:12,pr:13,pt:8,pb:9,width:"50%",zIndex:1,color:r.palette.text.primary,whiteSpace:"nowrap"},children:Gt.jsx(n,{id:"az8lvo",message:"Off"})}),Gt.jsx(x,{sx:{typography:"body2",fontWeight:600,pl:12,pr:13,pt:8,pb:9,width:"50%",zIndex:1,color:e?r.palette.secondary.contrastText:r.palette.text.primary,whiteSpace:"nowrap"},children:Gt.jsx(n,{id:"Z5HWHd",message:"On"})}),Gt.jsx(x,{sx:{borderRadius:6,backgroundColor:a,zIndex:0,position:"absolute",top:2,bottom:2,width:"calc(50% - 2px - 2px)",left:e?"calc(50% + 2px)":"2px",transition:"left 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, transform 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms"}})]})}function wc({show:e,onClick:t}){const i=y();return Gt.jsxs(j,{weak:!0,sx:{display:e?"flex":"none",alignItems:"center",position:"absolute",bottom:28,left:"50%",transform:"translateX(-50%)",p:i.spacing(8,20),fontWeight:600,borderRadius:20,border:`solid 1px ${i.palette.border.main}`,backgroundColor:"background.paperContrast",boxShadow:`0px 8px 16px 0px ${L("light"===i.palette.mode?"#FFF":"#000",.1)}`,cursor:"pointer",whiteSpace:"nowrap",gap:4},onClick:t,children:[Gt.jsx(n,{id:"F8yRdq",message:"More trade settings"}),Gt.jsx(x,{component:"svg",width:25,height:24,viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",sx:{color:"text.secondary"},children:Gt.jsx("path",{d:"M12.5 19L6.5 13L7.9 11.6L12.5 16.175L17.1 11.6L18.5 13L12.5 19ZM12.5 13L6.5 6.99998L7.9 5.59998L12.5 10.175L17.1 5.59998L18.5 6.99998L12.5 13Z",fill:"currentColor"})})]})}function Cc({open:e,onClose:t,fromToken:i,toToken:o}){const r=y(),{ddl:a,disableIndirectRouting:l}=Ka(),{onlySolana:s}=Zr(),d=G.useRef(null),[c,u]=G.useState(!1);return G.useEffect((()=>{const e=d.current,t=new ResizeObserver((()=>{e&&u(e.scrollHeight!==e.offsetHeight)})),n=de((()=>{if(!e)return;const t=e.scrollTop+e.clientHeight<e.scrollHeight-2;u(t)}),50);return e&&(u(e.scrollHeight!==e.clientHeight),t.observe(e),e.addEventListener("scroll",n)),()=>{e&&(t.unobserve(e),e.removeEventListener("scroll",n))}}),[null==d?void 0:d.current]),Gt.jsx(oc,{open:e,onClose:t,id:"swap-settings",title:Gt.jsx(n,{id:"Tz0i8g",message:"Settings"}),children:Gt.jsxs(x,{sx:{px:20,pb:34,overflowY:"auto"},ref:d,children:[Gt.jsx(bc,{fromToken:i,toToken:o}),!s&&Gt.jsxs(x,{sx:{mt:24,pt:14,borderTop:`solid 1px ${r.palette.border.main}`},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",fontWeight:600},children:[Gt.jsx(n,{id:"zSMRJ/",message:"Transaction Deadline"}),Gt.jsx(fc,{title:Gt.jsx(n,{id:"wmCrk7",message:"You may modify the transaction deadline, the maximum time allowed for a trade to be processed on-chain. However, please note that this may lead to your trade executing at a subpar price, as the market price may change during that time."}),ml:7})]}),Gt.jsxs(x,{sx:{mt:16,display:"flex",alignItems:"center",gap:8,typography:"body2"},children:[Gt.jsx(T,{sx:{width:80,height:34,lineHeight:1,typography:"body2","& input":{px:16,py:6}},placeholder:String(Sr),value:a,onChange:e=>{Ka.setState({ddl:e.target.value})}}),Gt.jsx(n,{id:"H9HlDe",message:"minutes"})]})]}),!s&&Gt.jsx(x,{sx:{display:"flex",flexDirection:"column",gap:12,mt:24,pt:14,borderTop:`solid 1px ${r.palette.border.main}`},children:Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[Gt.jsxs(x,{sx:{fontWeight:600},children:[Gt.jsx(n,{id:"MXQodB",message:"Disable Indirect Routing"}),Gt.jsx(fc,{title:Gt.jsx(n,{id:"Y0Knz4",message:"Checking this option means that the routing algorithm will only route to liquidity pools between the two tokens in the trading pair and will ignore routes with any intermediary tokens."}),ml:7})]}),Gt.jsx(jc,{checked:l,onChange:e=>{Ka.setState({disableIndirectRouting:e})}})]})}),Gt.jsx(wc,{show:c,onClick:()=>{var e,t;null===(e=d.current)||void 0===e||e.scrollTo({top:null===(t=d.current)||void 0===t?void 0:t.scrollHeight,behavior:"smooth"})}})]})})}function kc({onClick:e,disabled:t,plus:n}){const i=y(),o=t||n||!e;return Gt.jsx(x,{sx:{width:"100%",position:"relative"},children:Gt.jsx(x,{component:M,sx:Object.assign({width:36,height:36,borderRadius:"50%",backgroundColor:i.palette.background.input,border:`4px solid ${i.palette.background.paper}`,display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%) rotate(-90deg)",color:"text.secondary"},o?{cursor:"inherit"}:{"&:hover":{color:"text.primary"},"&:focus-visible":{"&::before":{content:'""',position:"absolute",display:"block",left:"50%",top:"50%",transform:"translate(-50%, -50%)",borderRadius:"50%",width:28,height:28,border:"solid 1px",borderColor:"text.primary"}}}),disabled:o,onClick:()=>{o||e&&e()},children:n?Gt.jsx(x,{component:Ft.Plus,sx:{width:18,height:18}}):Gt.jsx(x,{component:Ft.ArrowBack,sx:{width:18,height:18}})})})}!function(e){e.recommend="recommend",e.custom="custom"}(vc||(vc={}));const Rc=()=>{const{requests:e,updateText:t}=Sa(),n=G.useMemo((()=>{let t={};return null==e||e.forEach((([e,n])=>{var i,o;if((n===Nr.Running||n===Nr.Success)&&(null===(i=e.metadata)||void 0===i?void 0:i.logBalance)&&(!e.doneTime||Math.ceil(Date.now()/1e3)-e.doneTime<300)){const n=null===(o=e.metadata)||void 0===o?void 0:o.logBalance;t=Object.assign(Object.assign({},t),n)}})),t}),[e&&Array.from(e)]),i=G.useMemo((()=>{let t={};return null==e||e.forEach((([e,n])=>{var i,o;if(n===Nr.Success&&(null===(i=e.metadata)||void 0===i?void 0:i.logBalance)&&e.doneTime&&Math.ceil(Date.now()/1e3)-e.doneTime<300){const n=null===(o=e.metadata)||void 0===o?void 0:o.logBalance;t=Object.assign(Object.assign({},t),n)}})),t}),[e&&Array.from(e)]),o=G.useCallback(((e,n,i)=>{const o=e[n];if(!o)return!1;return!!(oe.isBigNumber(i)?i:new oe(i)).isEqualTo(o)||(t((e=>{var t;const i=Object.assign({},e.metadata);return(null===(t=null==i?void 0:i.logBalance)||void 0===t?void 0:t[n])?(delete i.logBalance[n],Object.keys(i.logBalance).length||delete i.logBalance,{brief:e.brief,spec:e.spec,metadata:i}):null})),!1)}),[t]),r=G.useCallback(((e,t)=>o(n,e,t)),[n,o]),a=G.useCallback(((e,t)=>o(i,e,t)),[i,o]);return{balanceData:n,balanceDataDone:i,isTokenLoading:r,isTokenLoadingDone:a}};function Sc({onClick:e,balance:t,decimals:i,address:o,showMaxBtn:r,canClickBalance:a,loading:l,balanceText:s}){const{palette:d}=y(),c=a&&(null==t?void 0:t.gt(0))&&e;return Gt.jsxs(x,{sx:Object.assign({typography:"body2",alignItems:"center",color:d.text.secondary,wordBreak:"break-word",textAlign:"right"},c?{"&:hover":{color:d.text.primary,cursor:"pointer"}}:{}),onClick:c?()=>e(t?t.toString():""):void 0,children:[null!=s?s:Gt.jsx(n,{id:"0QDjxt",message:"Balance:"})," ",l?Gt.jsx(O,{sx:{position:"relative",top:-2,verticalAlign:"middle"}}):Gt.jsxs(Gt.Fragment,{children:[o?Kr({input:t,decimals:Math.min(i||4,4)}):"-",r&&t&&t.gt(0)&&e&&Gt.jsx(x,{component:M,sx:{ml:6,color:(null==t?void 0:t.gt(0))?d.primary.main:d.text.disabled,cursor:o?"pointer":"unset",typography:"body2"},onClick:()=>e&&e(t?t.toString():""),children:Gt.jsx(n,{id:"CK1KXz",message:"Max"})})]})]})}const Ic=ne((function({readOnly:e,sx:t,value:n,decimals:i,onChange:o,suffix:r,suffixGap:a=0,withClear:l,onFocus:s,placeholder:d,readonlyShowSuffix:c,typography:u},p){const h=y(),m=K((()=>r||(l&&n&&o?Gt.jsx(x,{component:M,sx:{ml:5,width:18,height:18,borderRadius:"50%",backgroundColor:"border.main",display:"flex",justifyContent:"center",alignItems:"center",flexShrink:0,color:"text.secondary","&:focus-visible":{border:"solid 1px",borderColor:"text.primary"}},onClick:()=>{o&&o("")},children:Gt.jsx(x,{component:Ft.Error,sx:{width:12}})}):void 0)),[o,r,h.palette.text.primary,n,l]);return Gt.jsx(T,{fullWidth:!0,value:n,readOnly:e,placeholder:d||"0.00",onFocus:s,onChange:e=>{const t=e.target.value,n=0===t.length?"":ta(t,i);o&&o(n)},"data-testid":"number-input-wrapper",suffix:(!e||c)&&m,suffixGap:a,ref:p,sx:Object.assign({border:"none","& input":{fontSize:24,typography:u,border:"none",outline:"none",padding:0,color:"text.primary","&::placeholder":{fontSize:24,typography:u,color:"text.disabled"}}},t)})}));function Ec(){const e=y(),t=Zr((e=>e.width)),[n,i]=G.useState(null!=t?t:"undefined"==typeof window?375:document.body.clientWidth);G.useEffect((()=>{const e=()=>{i("undefined"==typeof window?375:document.body.clientWidth)};return"number"!=typeof t?(e(),window.addEventListener("resize",e)):i(t),()=>{window.removeEventListener("resize",e)}}),[t]);return{isMobile:G.useMemo((()=>"number"==typeof n&&n<e.breakpoints.values.tablet),[n,e.breakpoints.values]),isTablet:G.useMemo((()=>"number"==typeof n&&n<e.breakpoints.values.tablet),[n,e.breakpoints.values]),minDevice:G.useCallback((e=>"number"==typeof n&&n>e),[n]),maxDevice:G.useCallback((e=>"number"==typeof n&&n<e),[n])}}const Mc=[.25,.5,.75,1];function Tc({value:e,onChange:t,sx:n}){const i=y(),o="light"===i.palette.mode,{isMobile:r}=Ec();return Gt.jsx(x,{sx:Object.assign({display:"grid",gap:r?10:14,gridTemplateColumns:`repeat(${Mc.length}, 1fr)`},n),children:Mc.map((n=>{const r=n===e;return Gt.jsxs(M,{disabled:!t,sx:{typography:"h6",borderRadius:4,padding:i.spacing(4,0),width:"100%",color:"text.secondary",backgroundColor:"background.paperDarkContrast","&:disabled":{color:"text.disabled"},"&:not(:disabled)&:hover":{color:i.palette.text.primary,backgroundColor:L(i.palette.text.primary,.2)},"&.selected, &:focus":{color:"#fff",backgroundColor:o?i.palette.primary.main:L(i.palette.text.primary,.4)}},onClick:()=>{!r&&t&&t(n)},className:r?"selected":void 0,children:[100*n,"%"]},n)}))})}function Lc({token:e,onClick:t,showChainLogo:i,readonly:o,showChainName:r}){var a,l;const s=y(),d=(null==e?void 0:e.chainId)?Is.get(e.chainId):null,c=r&&!!d;return Gt.jsxs(x,{component:M,sx:{display:"flex",alignItems:"center",gap:8,color:s.palette.text.primary,typography:c?"body2":"body1",fontWeight:600,"&:focus-visible":{opacity:.5}},onClick:e=>{o||t&&t(e)},"data-testid":Mr,children:[!!(null==e?void 0:e.address)&&Gt.jsx(Ms,{url:null==e?void 0:e.logoURI,address:null!==(a=null==e?void 0:e.address)&&void 0!==a?a:"",chainId:null==e?void 0:e.chainId,noShowChain:!i,width:30,height:30,chainSize:16,logoOffset:10,marginRight:0}),Gt.jsxs(x,{children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[(null==e?void 0:e.address)?Gt.jsx(Gt.Fragment,{children:Gt.jsx(x,{children:null!==(l=null==e?void 0:e.symbol)&&void 0!==l?l:"-"})}):Gt.jsx(n,{id:"sIPJGT",message:"SELECT TOKEN"}),!o&&Gt.jsx("svg",{width:"18",height:"19",viewBox:"0 0 18 19",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:Gt.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 11.75L12 7.25H6L9 11.75Z",fill:"currentColor"})})]}),!!c&&Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",typography:"h6",color:"text.secondary"},children:[d.name,Gt.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:Gt.jsx("path",{d:"M5.6036 4.12761C5.50037 4.20906 5.3708 4.24967 5.23958 4.24169C5.10836 4.23372 4.98466 4.17773 4.89203 4.08438C4.7994 3.99103 4.74433 3.86685 4.7373 3.73549C4.73026 3.60413 4.77177 3.47477 4.8539 3.37205L5.96239 2.25211C6.46737 1.76405 7.14372 1.494 7.84575 1.5001C8.54779 1.50621 9.21934 1.78798 9.71577 2.28474C10.2122 2.78151 10.4938 3.4535 10.4999 4.156C10.506 4.85851 10.2361 5.5353 9.74839 6.04062L8.60241 7.16592C8.55441 7.22201 8.49533 7.26757 8.4289 7.29974C8.36246 7.3319 8.29009 7.34997 8.21635 7.35282C8.1426 7.35567 8.06906 7.34324 8.00034 7.3163C7.93162 7.28936 7.86921 7.2485 7.81702 7.19627C7.76483 7.14405 7.724 7.0816 7.69707 7.01284C7.67015 6.94407 7.65772 6.87048 7.66057 6.79668C7.66342 6.72289 7.68148 6.65047 7.71363 6.58399C7.74577 6.51751 7.7913 6.4584 7.84736 6.41036L8.97191 5.28506C9.25568 4.98032 9.41017 4.57725 9.40283 4.16078C9.39549 3.74431 9.22689 3.34695 8.93255 3.05242C8.63821 2.75788 8.24111 2.58917 7.82491 2.58182C7.40872 2.57447 7.00592 2.72906 6.70138 3.01302L5.6036 4.12761ZM6.34259 7.93755C6.38819 7.87582 6.44652 7.82461 6.51361 7.7874C6.58071 7.75018 6.65501 7.72783 6.73149 7.72185C6.80798 7.71586 6.88485 7.7264 6.95691 7.75273C7.02897 7.77906 7.09453 7.82058 7.14917 7.87447C7.2038 7.92836 7.24622 7.99337 7.27356 8.06509C7.3009 8.13682 7.31252 8.21358 7.30764 8.29019C7.30275 8.3668 7.28148 8.44147 7.24525 8.50913C7.20902 8.5768 7.15869 8.63589 7.09765 8.68239L5.96774 9.81305C5.45894 10.2708 4.7943 10.5163 4.11029 10.4992C3.42627 10.482 2.77479 10.2034 2.2896 9.72061C1.80441 9.23784 1.52232 8.58752 1.50127 7.90316C1.48021 7.2188 1.72179 6.55234 2.17638 6.04062L3.30629 4.93139C3.3504 4.86735 3.4079 4.81369 3.47482 4.77413C3.54174 4.73456 3.61646 4.71005 3.69379 4.70229C3.77113 4.69453 3.84922 4.70371 3.92266 4.72919C3.99609 4.75466 4.0631 4.79583 4.11904 4.84983C4.17497 4.90384 4.21849 4.96937 4.24657 5.0419C4.27464 5.11442 4.28661 5.19219 4.28163 5.2698C4.27665 5.34742 4.25484 5.42302 4.21773 5.49135C4.18062 5.55969 4.12908 5.61912 4.06671 5.66552L2.93144 6.79618C2.64767 7.10092 2.49318 7.50398 2.50052 7.92045C2.50786 8.33692 2.67647 8.73428 2.97081 9.02882C3.26515 9.32335 3.66224 9.49207 4.07844 9.49942C4.49463 9.50676 4.89743 9.35217 5.20197 9.06821L6.34259 7.93755ZM5.00919 7.76072C4.96119 7.81681 4.90211 7.86237 4.83567 7.89454C4.76924 7.9267 4.69687 7.94477 4.62312 7.94763C4.54937 7.95048 4.47583 7.93804 4.40711 7.9111C4.33839 7.88416 4.27598 7.8433 4.2238 7.79108C4.17161 7.73885 4.13077 7.6764 4.10385 7.60764C4.07693 7.53887 4.0645 7.46528 4.06735 7.39149C4.0702 7.31769 4.08826 7.24528 4.1204 7.17879C4.15255 7.11231 4.19808 7.0532 4.25413 7.00516L6.90487 4.35267C7.00731 4.26488 7.13909 4.21901 7.27386 4.22422C7.40863 4.22943 7.53648 4.28533 7.63185 4.38077C7.72722 4.4762 7.78309 4.60413 7.7883 4.73899C7.7935 4.87385 7.74766 5.00572 7.65993 5.10823L5.00919 7.76072Z",fill:"currentColor"})})]})]})]})}function Oc({token:e,disabled:t,style:n,balance:i,onClick:o}){const r=y(),{account:a}=Br(),l=i?Qr({input:i}):"";return Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",typography:"body2",px:6,py:5,borderRadius:8,cursor:t?"auto":"pointer",opacity:t?.5:1,"&:hover":{backgroundColor:"hover.default"}},style:n,onClick:()=>{t||o()},"data-testid":Or,children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[Gt.jsx(Ms,{token:e}),Gt.jsxs(x,{children:[Gt.jsx(x,{sx:{fontWeight:600,textAlign:"left"},children:e.symbol}),a&&Gt.jsx(x,{sx:{mt:4,textAlign:"left"},children:(null==i?void 0:i.gte(0))?l:Gt.jsx(x,{component:Ft.Loading,width:18,sx:{"& path":{fill:r.palette.text.disabled},animation:"loadingRotate 1.1s infinite linear","@keyframes loadingRotate":{"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(359deg)"}}}})})]})]}),Gt.jsx(x,{sx:{color:"text.secondary",textAlign:"right"},children:e.name})]})}function Wc({chain:e,active:t,onClick:i}){return Gt.jsx(W,{title:e.name,placement:"top",onlyHover:!0,children:Gt.jsxs(x,{sx:Object.assign({display:"flex",alignItems:"center",p:8,borderRadius:8,cursor:"pointer"},t?{backgroundColor:"secondary.main",color:"secondary.contrastText"}:{border:"1px solid",borderColor:"border.main","&:hover":{backgroundColor:"hover.default"}}),onClick:i,children:[Gt.jsx(x,{component:e.logo,sx:{width:24,height:24}}),t?Gt.jsxs(x,{sx:{ml:8},children:[Gt.jsx(n,{id:"Fdp03t",message:"on"}),` ${e.name}`]}):""]})},e.chainId)}function Vc(e){try{return new Te(e),!0}catch(e){return!1}}function Ac(e){if(e.length<=10)return e;try{return new Te(e),`${e.slice(0,4)}...${e.slice(-4)}`}catch(t){return`${e.slice(0,6)}...${e.slice(-4)}`}}function Fc(e,t,n="address"){return`https://${yr[e]}${t?`/${n}/${t}`:""}`}function Zc(){return Gt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between"},children:[Gt.jsx(V,{variant:"circular",width:32,sx:{mt:8}}),Gt.jsxs(x,{sx:{ml:8,flex:"1 0 auto"},children:[Gt.jsx(V,{sx:{borderRadius:4},height:24}),Gt.jsx(V,{sx:{mt:4,borderRadius:4},height:19,width:137})]})]})}function Pc({chainId:e,value:t,onChange:n,occupiedAddrs:o,occupiedChainId:r,hiddenAddrs:a,showAddrs:l,visible:s,side:d,defaultLoadBalance:c,multiple:u,searchPlaceholder:p,searchOtherAddress:h,sx:m}){const{chainList:f,selectChainId:g,setSelectChainId:y}=function(e){const{chainId:t}=Br(),n=he(Da),{crossChain:i,onlyChainId:o}=Zr(),r=K((()=>{const t=new Set;return n.forEach((n=>{n.side&&e&&n.side!==e||t.add(n.chainId)})),t}),[n,e]),a=K((()=>{if(!i||o)return[];const e=new Map;let n;return Is.forEach(((i,o)=>{if(r.has(i.chainId)){if(i.mainnet){if(t!==i.chainId)return;n=i.mainnet}e.set(o,Object.assign({},i))}})),void 0!==n&&e.delete(n),Array.from(e.values())}),[t,n,i,o]),l=K((()=>!a.length||t&&r.has(t)?t:a[0].chainId),[t,r]),[s,d]=_(l);J((()=>{void 0===s&&d(l)}),[l]);const c=K((()=>null!=s?s:l),[s,l]);return{chainList:a,selectChainId:c,setSelectChainId:d}}(d),{showTokenList:v,filter:b,setFilter:j,onSelectToken:w,popularTokenList:C,tokenInfoMap:k}=fl({value:t,onChange:n,occupiedAddrs:o,occupiedChainId:r,hiddenAddrs:a,showAddrs:l,side:d,chainId:null!=e?e:g,visible:s,defaultLoadBalance:c,multiple:u}),R=te(null),[S,I]=_(0);J((()=>{if(s&&t)if(Array.isArray(t)){const[e]=t;e&&e.chainId!==g&&y(e.chainId)}else y(t.chainId)}),[t,s]),J((()=>{let e;return s&&(e=window.setTimeout((()=>{R.current&&I(R.current.offsetHeight-16)}),300)),()=>clearTimeout(e)}),[R,s,g]);const E=we({queryKey:["token-picker-searchOtherAddress",b],queryFn:()=>h?h(b):null,enabled:Vc(b)&&!!h}),M=Q((({index:e,style:n})=>{var i;const o=v[e];if(!o)return null;let r=!1;return t&&(r=Array.isArray(t)?t.some((e=>e.address===o.address&&e.chainId===o.chainId)):t.address===o.address&&t.chainId===o.chainId),Gt.jsx(Oc,{token:o,disabled:r,style:n,onClick:()=>w(o),balance:null===(i=k.get(`${o.chainId}-${o.address}`))||void 0===i?void 0:i.balance},o.address+o.chainId)}),[v,C,t]);return Gt.jsxs(x,{sx:Object.assign({display:"flex",flexDirection:"column",px:20,flex:1,overflow:"hidden"},m),children:[Gt.jsx(A,{fullWidth:!0,height:48,value:b,onChange:e=>j(e.target.value),clearValue:()=>j(""),placeholder:null!=p?p:i._({id:"72/M0o",message:"Enter the token symbol or address"}),sx:{mb:16}}),void 0===e&&f.length?Gt.jsx(x,{sx:{position:"relative",display:"flex",gap:8,flexWrap:"wrap",pb:32,"&::after":{content:'""',position:"absolute",bottom:16,left:0,right:0,height:"1px",backgroundColor:"border.main"}},children:f.map((e=>Gt.jsx(Wc,{chain:e,active:e.chainId===g,onClick:()=>{y(e.chainId)}},e.chainId)))}):"",Gt.jsx(x,{sx:{pb:16,flex:1,minHeight:64},ref:R,children:v.length?Gt.jsx(yt,{height:S,itemCount:v.length,itemSize:52,width:"100%",className:"token-list",children:M}):Gt.jsxs(x,{sx:{height:S,overflowY:"auto"},children:[E.isLoading?Gt.jsx(Zc,{}):"",E.data?E.data:""]})})]})}function Bc({open:e,title:t,value:i,onClose:o,occupiedAddrs:r,hiddenAddrs:a,occupiedChainId:l,onTokenChange:s,side:d,defaultLoadBalance:c,multiple:u,searchPlaceholder:p,searchOtherAddress:h,chainId:m,modal:f}){const{height:g}=Zr(),{isMobile:x}=Ec();return Gt.jsx(oc,{height:f?"80vh":g,open:e,onClose:o,title:null!=t?t:Gt.jsx(n,{id:"T0Y2+3",message:"Select a token"}),id:"select-token",testId:Lr,modal:f,children:Gt.jsx(Pc,{value:i,visible:e,onChange:s,occupiedAddrs:r,occupiedChainId:l,hiddenAddrs:a,side:d,defaultLoadBalance:c,multiple:u,searchPlaceholder:p,searchOtherAddress:h,chainId:m,sx:f?{width:x?"100%":420,borderRadius:16}:void 0})})}function Nc(){return Gt.jsx(x,{sx:{position:"relative",height:4},children:Gt.jsx(x,{sx:{width:44,height:44,borderRadius:22,backgroundColor:"background.input",borderWidth:4,borderColor:"background.paper",position:"absolute",left:"50%",top:"50%",transform:"translate(-50%,-50%) rotate(90deg)",display:"flex",alignItems:"center",justifyContent:"center",color:"text.secondary"},children:Gt.jsx(x,{component:Ft.Plus})})})}function Uc({sx:e,inputSx:t,amt:i,token:o,readOnly:r,showMaxBtn:a,canClickBalance:l,onMaxClick:s,fiatPriceTxt:d,occupiedAddrs:c,occupiedChainId:u,onInputFocus:p,onTokenClick:h,onInputChange:m,onTokenChange:f,side:g,showChainLogo:v,showChainName:j,defaultLoadBalance:w,overrideBalance:C,overrideBalanceLoading:k,balanceText:R,showPercentage:S,inputReadonlyTooltip:I,inputTypography:E,chainId:M,hideToken:T,checkLogBalance:L,notTokenPickerModal:O}){var W,V;const{account:A}=Br(),Z=y(),{gotoBuyToken:P}=Zr(),[B,N]=_(!1),{fetchTokenBalance:U}=ya(),H=we({queryKey:["token","balance-allowance",null==o?void 0:o.address],queryFn:()=>Vr(this,void 0,void 0,(function*(){if(!o)return;const e=yield U(o.address);return Object.assign(Object.assign({},o),{balance:e.amount,allowance:Jr})})),enabled:!!o}),D=null!==(V=null!=C?C:null===(W=H.data)||void 0===W?void 0:W.balance)&&void 0!==V?V:null,{isTokenLoading:Y}=Rc();let z=null!=k?k:H.isLoading;!z&&D&&(L?z=Object.entries(L).some((([e,t])=>Y(e,t))):o&&(z=Y(o.address,D)));const[X,q]=_(0),G=te("");J((()=>{i!==G.current&&q(0)}),[i]);let Q=P&&D&&i&&D.lt(i);const K=!!m||!!I;return Gt.jsxs(x,{sx:Object.assign({minHeight:K?133:"auto",padding:Z.spacing(20,20,24),borderRadius:12,overflow:"hidden",display:"flex",flexDirection:"column",justifyContent:"space-between",backgroundColor:Z.palette.background.input},e),children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:4},children:[T?Gt.jsx(x,{}):Gt.jsx(Lc,{token:o,showChainLogo:v,showChainName:j,onClick:()=>N(!0),readonly:!f}),Gt.jsx(Sc,{balance:D,balanceText:R,onClick:r||!s&&!m?void 0:e=>{s?s(e):m&&m(e),0!==X&&1!==X&&(q(1),G.current=e)},showMaxBtn:a,canClickBalance:l,address:null==o?void 0:o.address,decimals:null==o?void 0:o.decimals,loading:z})]}),K&&(r&&I?Gt.jsx(F,{title:I,arrow:!1,children:Gt.jsx(x,{children:Gt.jsx(Ic,{value:i,readOnly:!0,withClear:!0,sx:Object.assign({mt:12},t)})})}):Gt.jsx(Ic,{value:i,onFocus:p,onChange:m?e=>{m(e),q(0)}:void 0,readOnly:r,withClear:!0,suffix:Q?Gt.jsx(b,{variant:b.Variant.tag,backgroundColor:Z.palette.background.paperDarkContrast,sx:{fontSize:12},onClick:e=>{e.stopPropagation(),null==P||P({token:o,account:A})},children:Gt.jsx(n,{id:"qiOIiY",message:"Buy"})}):void 0,typography:E,sx:{mt:12}})),!r&&S?Gt.jsx(Tc,{sx:{mt:16},value:X,onChange:D&&void 0!==(null==o?void 0:o.decimals)?e=>{if(D&&(null==o?void 0:o.decimals))if(q(e),1===e){const e=D.toString();s?s(e):m&&m(e),G.current=e}else if(m){const t=D.multipliedBy(e).dp(o.decimals).toString();m(t),G.current=t}}:void 0}):"",void 0!==d?Gt.jsx(x,{sx:{mt:S?9:0,typography:"h6",color:Z.palette.text.secondary},children:d}):"",Gt.jsx(Bc,{value:o,open:B,side:g,chainId:M,occupiedAddrs:c,occupiedChainId:u,defaultLoadBalance:w,onClose:()=>{N(!1),h&&h()},onTokenChange:(e,t)=>{N(!1),setTimeout((()=>{!Array.isArray(e)&&f&&f(e,t)}),tc)},modal:!O})]})}function Hc({toToken:e,fromToken:t,priceStatus:i,pricePerToToken:o,pricePerFromToken:r}){const[a,l]=_("-"),[s,d]=_(null),[c,u]=_("-"),[p,h]=_(null);J((()=>{l(null==t?void 0:t.symbol),u(null==e?void 0:e.symbol),d(o),h(r)}),[t,e,o,r]);const m=Q((()=>{l(c),u(a),d(p),h(s)}),[a,s,c,p]);return Gt.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center"},children:{[Oa.Initial]:"-",[Oa.Loading]:Gt.jsxs(Gt.Fragment,{children:[Gt.jsx(O,{sx:{mr:5}}),Gt.jsx(n,{id:"JdNn1Y",message:"Fetching best price..."})]}),[Oa.Failed]:Gt.jsxs(Gt.Fragment,{children:[Gt.jsx(x,{component:Ft.Warn,sx:{width:15,mr:5,color:"warning.main"}}),Gt.jsx(n,{id:"NVAuTg",message:"Quote not available"})]}),[Oa.Success]:Gt.jsxs(Gt.Fragment,{children:[Gt.jsx(x,{sx:{typography:"body2"},children:`1 ${a} = ${Qr({input:p,showDecimals:4})} ${c}`}),Gt.jsx(x,{component:M,sx:{width:18,height:18,ml:6,borderRadius:"50%",backgroundColor:"border.main",display:"flex",justifyContent:"center",alignItems:"center"},children:Gt.jsx(x,{sx:{width:16,color:"text.secondary"},onClick:m,component:Ft.Switch})})]})}[i]})}function Dc({getAutoSlippage:e,onPayTokenChange:t,onReceiveTokenChange:a}={}){var l,s;const d=y(),{isInflight:c}=Ia(),{chainId:u,account:p}=Br(),h=pe(),{defaultChainId:m,noPowerBy:f,onlyChainId:g,onlySolana:v}=Zr(),[j,w]=_(!1);K((()=>{var e;return null===(e=r[null!=u?u:m])||void 0===e?void 0:e.address}),[u,m]);const[C,k]=_(""),[R,S]=_(""),[I,E]=_(""),[T,L]=_(""),V=K((()=>ce((e=>E(e)),1e3)),[]),A=K((()=>ce((e=>L(e)),1e3)),[]),[F,Z]=_(null),[P,B]=_(null),[N,U]=_(!1),[H,D]=_(!1),{toFiatPrice:Y,fromFiatPrice:z}=La({toToken:P,fromToken:F});!function({token:e,fiatPrice:t}){K((()=>{var n;const i=null!==(n=null==e?void 0:e.decimals)&&void 0!==n?n:6,o=null!=t?new oe(500).div(t):new oe(0),r=na(o,i);return(r.lt(new oe(1).times(new oe(10).pow(i-3)))?new oe(0):r).toString(10)}),[null==e?void 0:e.decimals,t])}({token:j?P:F,fiatPrice:j?Y:z}),function({fromToken:e,toToken:t,getAutoSlippage:n}){const i=pe();J((()=>{(()=>{Vr(this,void 0,void 0,(function*(){if(!n)return;const o=n({fromToken:e,toToken:t});if(void 0!==o&&"number"!=typeof o){i(Xr(!0));try{const e=yield o;i(zr({loading:!1,value:null!=e?e:null}))}catch(e){console.error(e),i(zr({loading:!1,value:null}))}}else i(zr({loading:!1,value:null}))}))})()}),[e,t])}({fromToken:F,toToken:P,getAutoSlippage:e});const{slippage:X,slippageLoading:q}=tl({fromToken:F,toToken:P}),{isApproving:G,isGetApproveLoading:$,needApprove:ee,insufficientBalance:te,submitApprove:ne,getMaxBalance:ie}=al(F,{amount:I}),re=Q((()=>{ye(ie())}),[ie]);K((()=>!(!p||te||G||$||ee)),[p,te,G,$,ee]);const{status:ae,rawBrief:le,executeSwap:se}=Wa({toToken:P,fromToken:F,fromAmount:I,slippage:X}),{resAmount:de,priceImpact:ue,baseFeeAmount:me,additionalFeeAmount:fe,resPricePerToToken:ge,resPricePerFromToken:xe}=K((()=>{if(!le)return{resAmount:null,priceImpact:null,baseFeeAmount:null,additionalFeeAmount:null,resPricePerToToken:null,resPricePerFromToken:null};const e=new oe(le.inAmount).dividedBy(le.outAmount).toNumber(),t=new oe(le.outAmount).dividedBy(le.inAmount).toNumber();return{resAmount:le.resAmount,priceImpact:le.priceImpact,baseFeeAmount:0,additionalFeeAmount:0,resPricePerToToken:e,resPricePerFromToken:t}}),[le]),ye=Q((e=>{const t=e.toString();k(t),V(t)}),[k,V]),ve=Q((e=>{const t=e.toString();S(t),A(t)}),[S,A]),be=Q((e=>Z((n=>{var i;const o="function"==typeof e?e(n):e;return u||h(va(null!==(i=null==o?void 0:o.chainId)&&void 0!==i?i:void 0)),t&&o&&o!==n&&t(o),o}))),[h,va,t,u]),je=Q((e=>B((t=>{const n="function"==typeof e?e(t):e;return a&&n&&n!==t&&a(n),n}))),[a]);Xa({fromToken:F,toToken:P,setFromToken:be,setToToken:je,updateFromAmt:ye,updateToAmt:ve,setIsReverseRouting:w});const we=Q((()=>{ye(""),ve(""),be(P),je(F),jr("from",P),jr("to",F)}),[be,P,je,F,ye,ve]),Ce=Q(((e,t)=>{if(t)return we();ye(""),ve(""),be(e),jr("from",e)}),[we,ye,ve,be,jr]),ke=Q(((e,t)=>{if(t)return we();ye(""),ve(""),je(e),jr("to",e)}),[we,ye,ve,be,jr]),Re=Q((()=>{j&&ye(""),w(!1)}),[j,ye,h]);Q((()=>{j||ve(""),w(!0)}),[j,ve,h]);const Se=(e=>{const{defaultSlippage:t}=Ga(void 0===e),n=he(qa)||t;return K((()=>(void 0===e?Number(n):e)>5),[n,e])})(X),Ie=K((()=>ue?new oe(ue).multipliedBy(100).dp(4,oe.ROUND_DOWN).toString():null),[ue]),Ee=K((()=>{const e=j?de:I;return e&&z?new oe(z).multipliedBy(e):null}),[z,I,j,de]),Me=K((()=>{if(!Y)return null;const e=j?T:de;return e?new oe(Y).multipliedBy(e):null}),[Y,T,j,de]),Te=K((()=>Gt.jsxs(x,{sx:{display:"flex",fontWeight:600,typography:"body2",alignItems:"center",justifyContent:"center"},children:[Gt.jsx(fc,{title:Gt.jsx(n,{id:"4kY4C4",message:"Due to the market condition, market price and estimated price may have a slight difference"}),mr:8}),Gt.jsxs(x,{sx:{display:"flex"},children:[Gt.jsx(n,{id:"6+mYrD",message:"Current price impact"}),Gt.jsxs(x,{sx:{color:d.palette.error.main,ml:4},children:[Ie,"%"]})]})]})),[Ie,d.palette.error.main]),Le=K((()=>Gt.jsx(Hc,{toToken:P,fromToken:F,priceStatus:ae,pricePerToToken:ge,pricePerFromToken:xe})),[P,F,ae,ge,xe]),Oe=K((()=>!(o[u||1]||g&&g===u)),[u]),We=K((()=>!v&&!!u&&!!(null==F?void 0:F.chainId)&&(null==F?void 0:F.chainId)!==u),[u,null==F?void 0:F.chainId,v]),Ve=function({fromToken:e,toToken:t}){const n=he(Da);return K((()=>!(!e||n.some((t=>t.chainId===e.chainId&&t.address===e.address&&(!t.side||"to"===t.side))))||!(!t||n.some((e=>e.chainId===t.chainId&&e.address===t.address&&(!e.side||"from"===e.side))))),[e,t,n])}({fromToken:F,toToken:P}),Ae=K((()=>Se&&new oe(j?T:I).gt(0)&&!te&&ae===Oa.Success?Gt.jsxs(x,{sx:{textAlign:"center",mb:8},children:[Gt.jsx(x,{component:Ft.Warn,sx:{position:"relative",top:2,mr:6,width:16,height:16,color:"warning.main"}}),i._({id:"//95jS",message:"The current slippage protection coefficient set exceeds {maxSlippageWarning}%, which may result in losses.",values:{maxSlippageWarning:5}})]}):null),[Se,j,I,T,ae]),Fe=K((()=>We?Gt.jsxs(x,{sx:{textAlign:"center"},children:[Gt.jsx(x,{component:Ft.Warn,sx:{position:"relative",top:2,mr:6,width:16,height:16,color:"warning.main"}}),Gt.jsx(n,{id:"54ffaC",message:"The current network is inconsistent with the wallet - please switch in wallet"})]}):ae===Oa.Loading?Gt.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center"},children:Gt.jsxs(Gt.Fragment,{children:[Gt.jsx(O,{sx:{mr:5}}),Gt.jsx(n,{id:"JdNn1Y",message:"Fetching best price..."})]})}):Oe?Gt.jsxs(Gt.Fragment,{children:[Gt.jsx(x,{component:Ft.Warn,sx:{mr:6,width:16,color:"warning.main"}}),Gt.jsx(n,{id:"udsWDJ",message:"Unsupported network - switch to trade"})]}):C&&Ie&&new oe(Ie).gt(Cr)?Te:Gt.jsxs(Gt.Fragment,{children:[Ae,Le]})),[ae,Le,C,Te,Ie,Oe,We,Ae]),Ze=K((()=>j?new oe(R).gt(0)?Kr({input:de,decimals:null==F?void 0:F.decimals}):"-":C),[C,R,de,F,j]),Pe=K((()=>j?R:new oe(C).gt(0)?Kr({input:de,decimals:null==P?void 0:P.decimals}):"-"),[C,R,de,P,j]),Be=K((()=>{if(!p||(null==F?void 0:F.chainId)&&u!==F.chainId)return Gt.jsx(xc,{needSwitchChain:null==F?void 0:F.chainId});if(c)return Gt.jsx(b,{fullWidth:!0,isLoading:!0,disabled:!0,children:Gt.jsx(n,{id:"FRBvjQ",message:"Transaction Pending"})});if(!F||!P)return Gt.jsx(b,{fullWidth:!0,disabled:!0,"data-testid":"swap-alert-select-token-btn",children:Gt.jsx(n,{id:"KlvBGJ",message:"Select Tokens"})});if(ee)return Gt.jsx(b,{fullWidth:!0,disabled:G,onClick:()=>ne(),children:G?Gt.jsx(n,{id:"j2Uisd",message:"Approving"}):Gt.jsx(n,{id:"Z7ZXbT",message:"Approve"})});if(!new oe(j?T:I).gt(0))return Gt.jsx(b,{fullWidth:!0,disabled:!0,"data-testid":"swap-alert-enter-amount-btn",children:Gt.jsx(n,{id:"iPMIoT",message:"Enter an amount"})});if(ae===Oa.Loading)return Gt.jsx(b,{fullWidth:!0,disabled:!0,"data-testid":"swap-alert-fetch-price-btn",children:Gt.jsx(n,{id:"OauUE6",message:"Fetching Price..."})});return!de||ae===Oa.Failed?Gt.jsx(b,{fullWidth:!0,disabled:!0,children:Gt.jsx(n,{id:"NVAuTg",message:"Quote not available"})}):te?Gt.jsx(b,{fullWidth:!0,disabled:!0,"data-testid":"swap-alert-insufficient-balance-btn",children:Gt.jsx(n,{id:"znqB4T",message:"Insufficient balance"})}):Gt.jsx(b,{fullWidth:!0,onClick:()=>U(!0),"data-testid":"swap-review-btn",children:Gt.jsx(n,{id:"K/Ay/d",message:"Review Swap"})})}),[p,F,u,c,P,ee,G,j,T,I,ae,de,te,ne]),Ne=K((()=>F&&P?Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[Gt.jsx(Ms,{token:F,width:16,height:16,marginRight:6,chainId:F.chainId,noShowChain:!!g}),`${Kr({input:j?de:I,decimals:null==F?void 0:F.decimals})} ${null==F?void 0:F.symbol}`,Gt.jsx(x,{component:Ft.DoubleRight,sx:{width:12,height:12,mx:16}}),Gt.jsx(Ms,{token:P,width:16,height:16,marginRight:6,chainId:P.chainId,noShowChain:!!g}),`${Kr({input:j?T:de,decimals:null==P?void 0:P.decimals})} ${null==P?void 0:P.symbol}`]}):Gt.jsx(x,{})),[F,P,I,T,de,j,g]);return Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",typography:"caption",margin:20},children:[Gt.jsx(n,{id:"vH2C/2",message:"Swap"}),Gt.jsx(W,{open:void 0,title:Gt.jsx(n,{id:"NSCBTb",message:"The setting has been switched to swap mode"}),placement:"bottom-end",children:Gt.jsx(x,{component:M,children:Gt.jsx(x,{component:Ft.Setting,onClick:()=>D(!0),sx:{width:19,height:19,color:"text.primary",cursor:"pointer"}})})})]}),Gt.jsxs(x,{sx:{flex:1,padding:"0 16px 12px",overflowY:"auto"},children:[Gt.jsxs(x,{children:[Gt.jsx(Uc,{sx:{mb:4},token:F,side:"from",amt:Ze,defaultLoadBalance:!0,onMaxClick:re,onInputChange:ye,onInputFocus:Re,showMaxBtn:!j&&!C,occupiedAddrs:[null!==(l=null==P?void 0:P.address)&&void 0!==l?l:""],occupiedChainId:null==P?void 0:P.chainId,fiatPriceTxt:Ee?`$${Qr({input:Ee,showDecimals:1})}`:"-",onTokenChange:Ce,readOnly:j,showChainLogo:!g,showChainName:!g,notTokenPickerModal:!0}),Gt.jsx(kc,{onClick:we,disabled:Ve}),Gt.jsx(Uc,{token:P,side:"to",amt:Pe,onInputChange:ve,occupiedAddrs:[null!==(s=null==F?void 0:F.address)&&void 0!==s?s:""],occupiedChainId:null==F?void 0:F.chainId,fiatPriceTxt:Me?`$${Qr({input:Me,showDecimals:1})}(${Ie}%)`:"-",onTokenChange:ke,readOnly:!0,showChainLogo:!g,showChainName:!g,notTokenPickerModal:!0}),Gt.jsx(x,{sx:{py:12,display:"flex",typography:"body2",alignItems:"center",justifyContent:"center",flexWrap:"wrap"},children:Fe})]}),Be,f?"":Gt.jsxs(x,{sx:{mt:13,display:"flex",typography:"h6",cursor:"pointer",justifyContent:"center",alignItems:"center",color:d.palette.text.disabled},onClick:()=>window.open("https://app.dodoex.io"),children:[Gt.jsx(x,{sx:{width:18,height:18,transform:"translate(1px, 2px)","& path":{fill:d.palette.text.disabled}},component:Ft.Dodo}),Gt.jsx(n,{id:"7X+IbB",message:"Powered by DODO protocol"})]})]}),Gt.jsx(yc,{toToken:P,fromToken:F,fromAmount:j?de:I,toAmount:j?T:de,open:N,baseFeeAmount:me,priceImpact:Ie,additionalFeeAmount:fe,curToFiatPrice:Me,execute:()=>se(Ne),clearFromAmt:()=>ye(""),clearToAmt:()=>ve(""),curFromFiatPrice:Ee,onClose:()=>U(!1),loading:ae===Oa.Loading,slippage:X}),Gt.jsx(Cc,{open:H,onClose:()=>D(!1),fromToken:F,toToken:P})]})}var Yc;!function(e){e.Pool="pool",e.PoolDetail="poolDetail",e.CreatePool="createPool",e.ModifyPool="modifyPool",e.MiningList="miningList",e.MiningDetail="miningDetail",e.createPoolAMMV2="createPoolAMMV2",e.createPoolAMMV3="createPoolAMMV3"}(Yc||(Yc={}));const zc=Be(((e,t)=>({page:void 0,historyList:[],push:t=>{e((e=>{var n;const i=[...e.historyList,null!==(n=e.page)&&void 0!==n?n:{type:Yc.Pool}];return{page:t,historyList:i}}))},back:()=>{e((e=>{const t=e.historyList.length;if(!t)return"undefined"!=typeof window&&window.history&&history.back(),e;const n=[...e.historyList];return{page:n.splice(t-1,1)[0],historyList:n}}))}})));function Xc({sx:e,onClick:t}){const i=y();return Gt.jsxs(j,{onClick:()=>{t?t():zc.getState().back()},sx:ue({display:"inline-flex",alignItems:"center",cursor:"pointer","& > svg":{mr:10}},e),children:[Gt.jsx(x,{sx:{color:i.palette.text.secondary,width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",borderColor:i.palette.border.main,borderStyle:"solid",borderWidth:1,borderRadius:"50%",backgroundColor:i.palette.background.paper,mr:6},children:Gt.jsx(Ft.ArrowBack,{})}),Gt.jsx(n,{id:"CKyk7Q",message:"Go back"})]})}function qc({statuses:e,children:t,buttonProps:i}){var o;if(!e.find((e=>e.needShowTokenStatusButton))&&t)return Gt.jsx(Gt.Fragment,{children:t});const r=e.find((e=>e.insufficientBalance));if(r)return Gt.jsx(b,{fullWidth:!0,disabled:!0,...i,children:Gt.jsx(n,{id:"m6RmA/",message:"Insufficient {0} balance",values:{0:null===(o=r.token)||void 0===o?void 0:o.symbol}})});const a=e.some((e=>e.isApproving));return Gt.jsx(x,{sx:{display:"flex",alignItems:"center",gap:4},children:e.map(((e,t)=>{var o,r;let l="";return e.isApproving?l=Gt.jsx(n,{id:"j2Uisd",message:"Approving"}):(e.needReset||e.needApprove)&&(l=e.approveTitle),l?Gt.jsx(b,{fullWidth:!0,isLoading:e.isApproving,onClick:e.submitApprove,disabled:e.insufficientBalance||a,...i,children:l},null!==(r=null===(o=e.token)||void 0===o?void 0:o.symbol)&&void 0!==r?r:t):null}))})}function Gc({token:e,chainId:t,showChainLogo:i,readonly:o,showChainName:r,logoSize:a=24,chainLogoSize:l=12,side:s,occupiedToken:d,defaultLoadBalance:c,notTokenPickerModal:u,border:p,px:h=20,py:m=8,highlightDefault:f,onTokenClick:g,onTokenChange:v}){var b,j;const{onlyChainId:w}=Zr(),C=t||w,k=y(),[R,S]=G.useState(!1),I=(null==e?void 0:e.chainId)?Is.get(e.chainId):null,E=r&&!!I;return Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs(x,{component:M,sx:Object.assign(Object.assign({display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,color:k.palette.text.primary,typography:E?"body2":"body1",fontWeight:600,px:h,py:m,"&:focus-visible":{opacity:.5}},!!p&&{border:`solid 1px ${k.palette.border.main}`,borderRadius:8,"&:hover":{backgroundColor:k.palette.hover.default}}),!(!f||e)&&{backgroundColor:k.palette.primary.main,color:k.palette.primary.contrastText,"&:hover":{opacity:.8}}),onClick:()=>{o||S(!0)},"data-testid":Tr,children:[!!(null==e?void 0:e.address)&&Gt.jsx(Ms,{url:null==e?void 0:e.logoURI,address:null!==(b=null==e?void 0:e.address)&&void 0!==b?b:"",chainId:null==e?void 0:e.chainId,noShowChain:!i,width:a,height:a,chainSize:l,logoOffset:10,marginRight:0}),Gt.jsxs(x,{sx:{flex:1},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(null==e?void 0:e.address)?Gt.jsx(Gt.Fragment,{children:Gt.jsx(x,{children:null!==(j=null==e?void 0:e.symbol)&&void 0!==j?j:"-"})}):Gt.jsx(n,{id:"sIPJGT",message:"SELECT TOKEN"}),!o&&Gt.jsx(x,{component:"svg",width:18,height:18,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",sx:{flexShrink:0},children:Gt.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.58398 12.376C6.78189 12.6728 7.21811 12.6728 7.41603 12.376L10.4818 7.77735C10.7033 7.44507 10.4651 7 10.0657 7H3.93426C3.53491 7 3.29672 7.44507 3.51823 7.77735L6.58398 12.376Z",fill:"currentColor"})})]}),!!E&&Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",typography:"h6",color:"text.secondary"},children:[I.name,Gt.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:Gt.jsx("path",{d:"M5.6036 4.12761C5.50037 4.20906 5.3708 4.24967 5.23958 4.24169C5.10836 4.23372 4.98466 4.17773 4.89203 4.08438C4.7994 3.99103 4.74433 3.86685 4.7373 3.73549C4.73026 3.60413 4.77177 3.47477 4.8539 3.37205L5.96239 2.25211C6.46737 1.76405 7.14372 1.494 7.84575 1.5001C8.54779 1.50621 9.21934 1.78798 9.71577 2.28474C10.2122 2.78151 10.4938 3.4535 10.4999 4.156C10.506 4.85851 10.2361 5.5353 9.74839 6.04062L8.60241 7.16592C8.55441 7.22201 8.49533 7.26757 8.4289 7.29974C8.36246 7.3319 8.29009 7.34997 8.21635 7.35282C8.1426 7.35567 8.06906 7.34324 8.00034 7.3163C7.93162 7.28936 7.86921 7.2485 7.81702 7.19627C7.76483 7.14405 7.724 7.0816 7.69707 7.01284C7.67015 6.94407 7.65772 6.87048 7.66057 6.79668C7.66342 6.72289 7.68148 6.65047 7.71363 6.58399C7.74577 6.51751 7.7913 6.4584 7.84736 6.41036L8.97191 5.28506C9.25568 4.98032 9.41017 4.57725 9.40283 4.16078C9.39549 3.74431 9.22689 3.34695 8.93255 3.05242C8.63821 2.75788 8.24111 2.58917 7.82491 2.58182C7.40872 2.57447 7.00592 2.72906 6.70138 3.01302L5.6036 4.12761ZM6.34259 7.93755C6.38819 7.87582 6.44652 7.82461 6.51361 7.7874C6.58071 7.75018 6.65501 7.72783 6.73149 7.72185C6.80798 7.71586 6.88485 7.7264 6.95691 7.75273C7.02897 7.77906 7.09453 7.82058 7.14917 7.87447C7.2038 7.92836 7.24622 7.99337 7.27356 8.06509C7.3009 8.13682 7.31252 8.21358 7.30764 8.29019C7.30275 8.3668 7.28148 8.44147 7.24525 8.50913C7.20902 8.5768 7.15869 8.63589 7.09765 8.68239L5.96774 9.81305C5.45894 10.2708 4.7943 10.5163 4.11029 10.4992C3.42627 10.482 2.77479 10.2034 2.2896 9.72061C1.80441 9.23784 1.52232 8.58752 1.50127 7.90316C1.48021 7.2188 1.72179 6.55234 2.17638 6.04062L3.30629 4.93139C3.3504 4.86735 3.4079 4.81369 3.47482 4.77413C3.54174 4.73456 3.61646 4.71005 3.69379 4.70229C3.77113 4.69453 3.84922 4.70371 3.92266 4.72919C3.99609 4.75466 4.0631 4.79583 4.11904 4.84983C4.17497 4.90384 4.21849 4.96937 4.24657 5.0419C4.27464 5.11442 4.28661 5.19219 4.28163 5.2698C4.27665 5.34742 4.25484 5.42302 4.21773 5.49135C4.18062 5.55969 4.12908 5.61912 4.06671 5.66552L2.93144 6.79618C2.64767 7.10092 2.49318 7.50398 2.50052 7.92045C2.50786 8.33692 2.67647 8.73428 2.97081 9.02882C3.26515 9.32335 3.66224 9.49207 4.07844 9.49942C4.49463 9.50676 4.89743 9.35217 5.20197 9.06821L6.34259 7.93755ZM5.00919 7.76072C4.96119 7.81681 4.90211 7.86237 4.83567 7.89454C4.76924 7.9267 4.69687 7.94477 4.62312 7.94763C4.54937 7.95048 4.47583 7.93804 4.40711 7.9111C4.33839 7.88416 4.27598 7.8433 4.2238 7.79108C4.17161 7.73885 4.13077 7.6764 4.10385 7.60764C4.07693 7.53887 4.0645 7.46528 4.06735 7.39149C4.0702 7.31769 4.08826 7.24528 4.1204 7.17879C4.15255 7.11231 4.19808 7.0532 4.25413 7.00516L6.90487 4.35267C7.00731 4.26488 7.13909 4.21901 7.27386 4.22422C7.40863 4.22943 7.53648 4.28533 7.63185 4.38077C7.72722 4.4762 7.78309 4.60413 7.7883 4.73899C7.7935 4.87385 7.74766 5.00572 7.65993 5.10823L5.00919 7.76072Z",fill:"currentColor"})})]})]})]}),Gt.jsx(Bc,{value:e,open:R,side:s,chainId:C,occupiedAddrs:d?[d.address]:void 0,occupiedChainId:null==d?void 0:d.chainId,defaultLoadBalance:c,onClose:()=>{S(!1),g&&g()},onTokenChange:(e,t)=>{S(!1),setTimeout((()=>{!Array.isArray(e)&&v&&v(e,t)}),tc)},modal:!u})]})}const _c=G.forwardRef((function(e,t){var{sx:n}=e,i=Wr(e,["sx"]);const{isMobile:o}=Ec(),r=y();return Gt.jsx(x,{className:"widget-module-container",ref:t,sx:Object.assign(Object.assign({flex:1,overflowY:"auto"},o?{padding:0,height:"100%",width:"100%",overflowX:"hidden"}:{padding:r.spacing(28,20,40,40),height:"auto"}),n),...i})})),Jc="auto",Qc="0.1",Kc="0.5",$c="0.5";function eu(e){const t=te();return J((()=>{t.current=e})),t.current}function tu({baseToken:t,quoteToken:n,pairMintAAmount:o,pairMintBAmount:r,slippage:a,isExists:l,poolInfo:s,poolKeys:d,successBack:c,submittedBack:u}){const p=Sa(),{account:h}=Br(),m=Fs();return e(),Ce({mutationFn:()=>Vr(this,void 0,void 0,(function*(){if(!t||!n)throw new Error("token is undefined");if(!h)throw new Error("account is undefined");if(!s||!o||!r)throw new Error("poolInfo is undefined");if(!m)throw new Error("raydium is undefined");const e=new vt(new bt(o).mul(10**s.mintA.decimals).toFixed(0,bt.ROUND_DOWN)),f=new Ye(100*a*100,1e4),{execute:g}=l?yield m.cpmm.addLiquidity({poolInfo:s,poolKeys:d,inputAmount:e,slippage:f,baseIn:!0,txVersion:He.LEGACY}):yield m.cpmm.createPool({programId:ua,poolFeeAccount:pa,mintA:s.mintA,mintB:s.mintB,mintAAmount:e,mintBAmount:new vt(new bt(r).mul(10**s.mintB.decimals).toFixed(0,bt.ROUND_DOWN)),startTime:new vt(0),feeConfig:ha[0],associatedOnly:!1,ownerInfo:{useSOLBalance:!0},txVersion:Ls});return yield p.executeCustom({brief:l?i._({id:"E6MqGy",message:"Add liquidity"}):i._({id:"L37FfW",message:"Create AMM V2 Position"}),metadata:{[l?Ur.addLiquidityAMMV2Position:Ur.createAMMV2Position]:!0},handler:e=>Vr(this,void 0,void 0,(function*(){const{txId:t}=yield g({sendAndConfirm:!0});e.onSuccess(t)})),successBack:c,submittedBack:u})})),onError:e=>{console.error(e)}})}function nu({pool:e,baseAmount:t,quoteAmount:n,slippage:i}){var o,r,a,l,s,d,c,u,p,h,m,f,g,x;const{account:y}=Br(),v=Fs(),[b,j,w,C,k]=K((()=>{if(!(null==e?void 0:e.baseToken)||!e.quoteToken)return[void 0,void 0,void 0,void 0,!0];const{baseToken:i,quoteToken:o}=e,r=new vt(new Te(i.address).toBuffer()).lte(new vt(new Te(o.address).toBuffer())),[a,l]=r?[i,o]:[o,i],[s,d]=r?[t,n]:[n,t];return[a,l,s,d,r]}),[t,e,n]),R=we({queryKey:["cpmm","poolInfo",null==e?void 0:e.address],enabled:null!=(null==e?void 0:e.address),queryFn:()=>Vr(this,void 0,void 0,(function*(){if(!(null==e?void 0:e.address)||!v)return null;const{poolInfo:t,poolKeys:n,rpcData:i}=yield v.cpmm.getPoolInfoFromRpc(e.address);if(!i)return{baseReserve:0,quoteReserve:0,lpAmount:0};const[o,r]=t.mintA.address.toLowerCase()===e.baseToken.address.toLowerCase()?[e.baseToken.symbol,e.quoteToken.symbol]:[e.quoteToken.symbol,e.baseToken.symbol],a=ia(t.lpAmount,t.lpMint.decimals);return{baseReserve:ia(i.baseReserve.toNumber(),n.mintA.decimals),quoteReserve:ia(i.quoteReserve.toNumber(),n.mintB.decimals),lpAmount:a,lpMint:t.lpMint,poolKeys:Object.assign(Object.assign({},n),{mintA:Object.assign(Object.assign({},n.mintA),{symbol:o}),mintB:Object.assign(Object.assign({},n.mintB),{symbol:r})}),poolInfo:Object.assign(Object.assign({},t),{lpAmount:a.toNumber(),mintA:Object.assign(Object.assign({},t.mintA),{symbol:o}),mintB:Object.assign(Object.assign({},t.mintB),{symbol:r})}),rpcData:i}}))}),S=we({queryKey:["cpmm","lpBalance",null===(r=null===(o=R.data)||void 0===o?void 0:o.lpMint)||void 0===r?void 0:r.address],enabled:!!(y&&R.data&&(null===(a=R.data)||void 0===a?void 0:a.lpMint)&&(null===(s=null===(l=R.data)||void 0===l?void 0:l.lpMint)||void 0===s?void 0:s.address)&&(null===(c=null===(d=R.data)||void 0===d?void 0:d.lpMint)||void 0===c?void 0:c.decimals)),queryFn:()=>Vr(this,void 0,void 0,(function*(){var e,t,n,i,o;if(!(y&&R.data&&(null===(e=R.data)||void 0===e?void 0:e.lpMint)&&(null===(n=null===(t=R.data)||void 0===t?void 0:t.lpMint)||void 0===n?void 0:n.address)&&(null===(o=null===(i=R.data)||void 0===i?void 0:i.lpMint)||void 0===o?void 0:o.decimals)&&v))return null;yield v.account.fetchWalletTokenAccounts();const r=R.data.lpMint.address,a=v.account.tokenAccounts.find((e=>e.mint.toBase58()===r));if(!a)throw new Error(`you do not have balance in pool: ${r}`);return ia(a.amount.toNumber(),R.data.lpMint.decimals)}))}),I=we({queryKey:["cpmm","pairAmount",w,null===(u=R.data)||void 0===u?void 0:u.poolInfo],enabled:!(!R.data||!(null===(p=R.data)||void 0===p?void 0:p.poolInfo)||!w),queryFn:()=>Vr(this,void 0,void 0,(function*(){var e;if(!(R.data&&(null===(e=R.data)||void 0===e?void 0:e.poolInfo)&&w&&v))return null;const t=R.data.poolInfo,n=yield v.cpmm.computePairAmount({baseReserve:R.data.rpcData.baseReserve,quoteReserve:R.data.rpcData.quoteReserve,poolInfo:t,amount:w,slippage:new Ye(100*i*100,1e4),baseIn:!0,epochInfo:yield v.fetchEpochInfo()});return{pairMintAAmount:w,pairMintBAmount:ia(n.anotherAmount.amount.toString(),t.mintB.decimals).toString(),liquidityMinted:ia(n.liquidity.toString(),t.lpMint.decimals)}}))}),[E,M,T,L]=K((()=>{if(!R.data||!S.data)return[void 0,void 0,void 0,void 0];const{baseReserve:e,quoteReserve:t,lpAmount:n}=R.data,i=S.data,o=i.div(n),r=i.multipliedBy(e).div(n),a=i.multipliedBy(t).div(n);return[i,o,r,a]}),[R.data,S.data]),O=G.useMemo((()=>R.isFetched&&null!=R.data),[R.isFetched,R.data]),[W,V]=G.useMemo((()=>{var e,i;if(O){if(null!=(null===(i=null===(e=R.data)||void 0===e?void 0:e.poolInfo)||void 0===i?void 0:i.price)){const e=new oe(R.data.poolInfo.price);return[e,new oe(1).div(e)]}return[void 0,void 0]}return t&&n?[new oe(n).div(t),new oe(t).div(n)]:[void 0,void 0]}),[t,O,null===(m=null===(h=R.data)||void 0===h?void 0:h.poolInfo)||void 0===m?void 0:m.price,n]);return{isFront:k,poolInfoQuery:R,lpBalanceQuery:S,lpBalance:E,lpBalancePercentage:M,lpToAmountA:T,lpToAmountB:L,price:W,invertedPrice:V,liquidityMinted:null===(f=I.data)||void 0===f?void 0:f.liquidityMinted,pairMintAAmount:null===(g=I.data)||void 0===g?void 0:g.pairMintAAmount,pairMintBAmount:null===(x=I.data)||void 0===x?void 0:x.pairMintBAmount,isExists:O}}const iu="DODO_WIDGET_POOL_LIST_TAB",ou="DODO_WIDGET_POOLS_LIST_FILTER_CHAIN";var ru;!function(e){e.addLiquidity="add-liquidity",e.myLiquidity="my-liquidity",e.myCreated="my-created"}(ru||(ru={}));var au=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],i=0;i<e.rangeCount;i++)n.push(e.getRangeAt(i));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null}return e.removeAllRanges(),function(){"Caret"===e.type&&e.removeAllRanges(),e.rangeCount||n.forEach((function(t){e.addRange(t)})),t&&t.focus()}},lu={"text/plain":"Text","text/html":"Url",default:"Text"};var su=function(e,t){var n,i,o,r,a,l,s=!1;t||(t={}),n=t.debug||!1;try{if(o=au(),r=document.createRange(),a=document.getSelection(),(l=document.createElement("span")).textContent=e,l.ariaHidden="true",l.style.all="unset",l.style.position="fixed",l.style.top=0,l.style.clip="rect(0, 0, 0, 0)",l.style.whiteSpace="pre",l.style.webkitUserSelect="text",l.style.MozUserSelect="text",l.style.msUserSelect="text",l.style.userSelect="text",l.addEventListener("copy",(function(i){if(i.stopPropagation(),t.format)if(i.preventDefault(),void 0===i.clipboardData){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var o=lu[t.format]||lu.default;window.clipboardData.setData(o,e)}else i.clipboardData.clearData(),i.clipboardData.setData(t.format,e);t.onCopy&&(i.preventDefault(),t.onCopy(i.clipboardData))})),document.body.appendChild(l),r.selectNodeContents(l),a.addRange(r),!document.execCommand("copy"))throw new Error("copy command was unsuccessful");s=!0}catch(o){n&&console.error("unable to copy using execCommand: ",o),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),s=!0}catch(o){n&&console.error("unable to copy using clipboardData: ",o),n&&console.error("falling back to prompt"),i=function(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}("message"in t?t.message:"Copy to clipboard: #{key}, Enter"),window.prompt(i,e)}}finally{a&&("function"==typeof a.removeRange?a.removeRange(r):a.removeAllRanges()),l&&document.body.removeChild(l),o()}return s},du=Vt(su);function cu({copyText:e,size:t,sx:n,componentProps:o,onClick:r,children:a}){var l;const[s,d]=G.useState(!1);return Gt.jsx(F,{title:i._({id:"6V3Ea3",message:"Copied"}),open:s,onClose:()=>d(!1),arrow:!1,children:Gt.jsxs(x,{...o,component:null!==(l=null==o?void 0:o.component)&&void 0!==l?l:M,onClick:t=>{if(null==o?void 0:o.onClick)return o.onClick(t);t.stopPropagation(),e&&(du(e),d(!0)),r&&r()},sx:Object.assign({cursor:"pointer"},null==o?void 0:o.sx),children:[Gt.jsx(x,{component:Ft.Copy,sx:Object.assign({width:t||"auto",height:t||"auto"},n)}),a]})})}function uu({truncate:e,address:t,disabledAddress:n,sx:i,handleOpen:o,addressHoverColor:r,addressHoverShowIcon:a}){return n?Gt.jsx(x,{children:e?Ac(t):t}):Gt.jsx(Z,{lineSx:{bottom:-1},lineColor:null!=r?r:(null==i?void 0:i.color)||"",hoverSx:{color:"addressHoverColor","& svg":{display:"inline-block"}},className:"truncate-address-link",children:Gt.jsxs(x,{onClick:e=>{null==o||o(e,"address")},sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[e?Ac(t):t,a?Gt.jsx(x,{component:Ft.ArrowRight,sx:{display:"none",width:14,height:14}}):""]})})}function pu({address:e,truncate:t,showCopy:n,size:i="medium",iconSize:o,iconSpace:r,sx:a,iconDarkHover:l,disabledAddress:s,addressHoverColor:d,addressHoverShowIcon:c,customChainId:u,handleOpen:p,onAddressClick:h}){const m=y(),f="medium"===i,g=l?P:j,v=e=>{let t=e?12:8;return r&&(t=r),l&&(t-=3),t},b="big"===i?"h5":f?"body1":"body2",{chainId:w}=Br(),C=null!=u?u:w,k=(t,n)=>{p?p(t,n):C&&(t.stopPropagation(),window.open(Fc(C,e,"address")))};return Gt.jsxs(x,{sx:Object.assign({display:"flex",alignItems:"center",typography:b,color:m.palette.text.primary,lineHeight:"normal"},a||{}),children:[Gt.jsx(uu,{truncate:t,address:e,disabledAddress:s,sx:a,typography:b,handleOpen:null!=h?h:k,addressHoverColor:d,addressHoverShowIcon:c}),Gt.jsx(g,{sx:{display:"inline-flex",ml:v(f),cursor:"pointer"},onClick:e=>{k(e,"icon")},children:Gt.jsx(x,{component:Ft.ArrowTopRightBorder,sx:{width:o||(f?16:14),height:o||(f?16:14)}})}),n?Gt.jsx(cu,{size:o||(f?16:14),copyText:e,componentProps:{component:g,sx:{ml:v(f)}}}):null]})}function hu(e){var{sx:t,label:n,children:i}=e,o=Wr(e,["sx","label","children"]);return Gt.jsxs(x,{sx:Object.assign({display:"flex",justifyContent:"space-between"},t),...o,children:[Gt.jsx(x,{children:n}),Gt.jsx(x,{sx:{textAlign:"right",fontWeight:600},children:i})]})}function mu({tokens:e,width:t=24,height:n=24,gap:i=-4,cross:o,mr:r,chainId:a,showChainLogo:l,sx:s}){var d;const c=y(),{onlyChainId:u}=Zr(),p=l&&!u;if(!e||e.length<=0)return null;const h=t/2;return Gt.jsxs(x,{sx:Object.assign({display:"inline-flex",alignItems:"center",mr:r,position:"relative",zIndex:0},s),children:[e.map(((e,n)=>Gt.jsx(x,{sx:{display:"inline-flex",width:t,height:t,ml:n>0?i:0,borderRadius:"50%",backgroundColor:c.palette.background.default},children:"object"==typeof e?Gt.jsx(Ms,{address:e.address,width:t,height:t,chainId:a,url:e.logoURI,cross:o,noShowChain:!0,noBorder:!0,marginRight:0}):Gt.jsx(x,{component:"img",height:t,src:e})},n))),p&&Is.has(a)?Gt.jsx(x,{component:null===(d=Is.get(a))||void 0===d?void 0:d.logo,sx:{position:"absolute",bottom:0,right:0,zIndex:e.length+1,transform:"translateX(50%)",width:h,height:h}}):""]})}function fu({baseToken:e,quoteToken:t,midPrice:n,loading:i,disabled:o}){const r=y(),[a,l]=_(!1),s=a?null==t?void 0:t.symbol:null==e?void 0:e.symbol,d=a&&n?new oe(1).div(n):n,c=a?null==e?void 0:e.symbol:null==t?void 0:t.symbol;return Gt.jsxs(E,{sx:{display:"flex",alignItems:"center",fontWeight:600,overflow:"hidden"},loading:i,loadingProps:{width:50},children:[e&&t?Gt.jsx(W,{title:`1 ${s} = ${d?Qr({input:d}):""} ${c}`,children:n?Gt.jsx(x,{sx:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:`1 ${s} = ${d?Qr({input:d}):""} ${c}`}):Gt.jsxs(x,{children:[`1 ${s} = `,Gt.jsx(E,{loading:i,loadingProps:{width:30},component:"span",sx:{display:"inline-block"},children:"-"}),` ${c}`]})}):"-",Gt.jsx(x,{sx:Object.assign({display:"flex",alignItems:"center",justifyContent:"center",ml:4,width:18,height:18,backgroundColor:"background.paperDarkContrast",borderRadius:"50%"},!o&&{cursor:"pointer","&:hover":{backgroundColor:L(r.palette.text.primary,.04)}}),onClick:()=>{o||l((e=>!e))},children:Gt.jsx(x,{component:Ft.Switch,sx:{width:18,height:18}})})]})}function gu({baseToken:e,quoteToken:t,loading:i,midPrice:o,lpBalancePercentage:r,sx:a}){const l=y(),s=!e||!t;return Gt.jsxs(x,{sx:Object.assign({mt:20,border:"solid 1px",borderColor:"border.main",borderRadius:8},a),children:[Gt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",px:12,py:4,height:36,typography:"body2"},children:[Gt.jsx(x,{sx:{color:"text.secondary",whiteSpace:"nowrap"},children:Gt.jsx(n,{id:"kNeEXg",message:"Current Price"})}),Gt.jsx(fu,{baseToken:e,quoteToken:t,loading:i,disabled:s,midPrice:o})]}),Gt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",px:12,py:4,minHeight:36,typography:"body2",borderStyle:"solid",borderWidth:l.spacing(1,0,0),borderColor:"border.main"},children:[Gt.jsx(x,{sx:{display:"flex",alignItems:"center",color:"text.secondary",whiteSpace:"nowrap"},children:Gt.jsx(n,{id:"SbBMxj",message:"Share of pool"})}),Gt.jsx(x,{sx:{display:"flex",alignItems:"center",fontWeight:600,textAlign:"right",ml:8,overflow:"hidden"},children:Gt.jsx(E,{sx:{display:"flex",alignItems:"center",fontWeight:600,overflow:"hidden"},loading:i,loadingProps:{width:50},children:r?`${da({input:r,roundingMode:oe.ROUND_DOWN})}`:"-%"})})]})]})}function xu({open:e,onClose:t,slippage:i,baseToken:o,quoteToken:r,pairMintAAmount:a,pairMintBAmount:l,lpAmount:s,feeRate:d,price:c,lpBalancePercentage:u,pairAddress:p,createMutation:h}){const m=y(),{isMobile:f}=Ec();return Gt.jsx(oc,{modal:!0,open:e,onClose:t,title:s?Gt.jsx(n,{id:"AeZIvT",message:"You will receive"}):Gt.jsx(n,{id:"aM1tos",message:"You are creating a pool"}),children:Gt.jsxs(x,{sx:{px:20,py:24,borderTopWidth:1,width:f?"100%":420},children:[Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column",alignItems:"center"},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,typography:"h3"},children:[Gt.jsx(mu,{width:24,height:24,tokens:o&&r?[o,r]:[]}),s?Kr({input:s,decimals:null==o?void 0:o.decimals}):""]}),Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,fontWeight:600},children:[Gt.jsx(n,{id:"syToc5",message:"{0}/{1} Pool Tokens",values:{0:null==o?void 0:o.symbol,1:null==r?void 0:r.symbol}}),Gt.jsx(x,{sx:{px:4,py:2,fontSize:10,lineHeight:1,backgroundColor:L(m.palette.purple.main,.1),color:m.palette.purple.main,borderRadius:4},children:Gt.jsx(n,{id:"rbsyJM",message:"AMM V2"})})]})]}),Gt.jsx(x,{sx:{mt:16,typography:"h6",color:"text.secondary",textAlign:"center"},children:Gt.jsx(n,{id:"rQ9c+8",message:"Output is estimated. If the price changes by more than {0} your transaction will revert.",values:{0:da({input:i})}})}),Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:12,mt:20,p:20,typography:"body2",borderRadius:12,backgroundColor:m.palette.background.paperContrast},children:[Gt.jsx(hu,{label:Gt.jsx(n,{id:"YG004A",message:"{0} deposited",values:{0:null==o?void 0:o.symbol}}),children:Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",lineHeight:1},children:[Gt.jsx(Ms,{width:18,height:18,marginRight:4,token:o}),Kr({input:a,decimals:null==o?void 0:o.decimals})]})}),Gt.jsx(hu,{label:Gt.jsx(n,{id:"YG004A",message:"{0} deposited",values:{0:null==r?void 0:r.symbol}}),children:Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[Gt.jsx(Ms,{width:18,height:18,marginRight:4,token:r}),Kr({input:l,decimals:null==r?void 0:r.decimals})]})}),Gt.jsx(hu,{label:Gt.jsx(n,{id:"EU3wU4",message:"Fee tier"}),children:null!=d?Number(d)/1e4+"%":"-"}),Gt.jsx(hu,{label:Gt.jsx(n,{id:"fqDzSu",message:"Rate"}),children:Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[Gt.jsx(Ms,{width:18,height:18,marginRight:4,token:o}),Gt.jsx(fu,{baseToken:o,quoteToken:r,midPrice:c})]})}),Gt.jsx(hu,{label:Gt.jsx(n,{id:"SbBMxj",message:"Share of pool"}),children:u?`${da({input:u})}`:"-%"}),Gt.jsx(hu,{label:Gt.jsx(n,{id:"ESQO1L",message:"Pool address"}),children:Gt.jsx(pu,{showCopy:!1,address:null!=p?p:"",customChainId:null==o?void 0:o.chainId,truncate:!0,iconSpace:4,sx:{typography:"body2"}})})]}),Gt.jsx(b,{fullWidth:!0,size:b.Size.big,sx:{mt:20},isLoading:h.isPending,onClick:()=>{h.mutate()},children:h.isPending?Gt.jsx(n,{id:"pwUZo2",message:"Confirming..."}):Gt.jsx(n,{id:"7VpPHA",message:"Confirm"})})]})})}function yu({title:e,disabled:t,children:n}){return Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:12,opacity:t?.3:void 0},children:[Gt.jsx(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",fontWeight:600},children:e}),n]})}function vu({disabled:e,feeIndex:t,onChange:i,feeList:o}){const r=y(),[a,l]=G.useState(!1),{isMobile:s}=Ec(),d=e,c=o[t];return Gt.jsxs(x,{sx:{opacity:e?.3:void 0,fontWeight:600},children:[Gt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",px:20,py:12,borderWidth:1,borderRadius:12},children:[Gt.jsx(n,{id:"tMMG40",message:"{0}% fee tier",values:{0:c?new oe(c.tradeFeeRate).div(1e4).toString():"-"}}),Gt.jsx(M,{sx:{px:16,py:7,border:`solid 1px ${r.palette.text.primary}`,borderRadius:8,fontWeight:600,color:"text.primary",cursor:d?"default":"pointer"},disabled:d,onClick:()=>{d||l((e=>!e))},children:a?Gt.jsx(n,{id:"vLyv1R",message:"Hide"}):Gt.jsx(n,{id:"ePK91l",message:"Edit"})})]}),a&&Gt.jsx(Gt.Fragment,{children:Gt.jsx(x,{sx:Object.assign({mt:12},s?{display:"grid",gap:8,gridTemplateColumns:"repeat(2, 1fr)"}:{display:"flex",alignItems:"center",gap:8,"& > label":{flex:1}}),children:o.map(((e,n)=>{const o=t===n;return Gt.jsxs(x,{component:"label",sx:Object.assign({display:"flex",alignItems:"center",justifyContent:"space-between",px:20,py:12,borderWidth:1,borderRadius:12,cursor:"pointer"},o&&{borderColor:r.palette.primary.main}),children:[e.tradeFeeRate/1e4,"%",Gt.jsx(B,{size:18,checked:o,onChange:(e,t)=>{t&&i(n)}})]},e.id)}))})})]})}function bu({chainId:e,address:t,showName:n,size:i,offset:o,rightContent:r}){const a=Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:o},children:[Gt.jsx(Ms,{chainId:e,address:t,width:i,height:i,noShowChain:!0,marginRight:0}),n]});return r?Gt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a,r]}):a}function ju({isExists:e,poolInfo:t,poolInfoLoading:i,lpBalanceLoading:r,lpBalance:a,lpBalancePercentage:l,lpToAmountA:s,lpToAmountB:d,sx:c}){var u,p;const h=l?`${da({input:l,roundingMode:oe.ROUND_DOWN})}`:void 0;return e&&t?Gt.jsxs(x,{sx:Object.assign({px:20,py:12,borderWidth:1,borderRadius:8},c),children:[Gt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:Gt.jsx(n,{id:"YHc3B+",message:"My Liquidity"})}),Gt.jsxs(x,{sx:{mt:12,display:"flex",alignItems:"center",flexWrap:"wrap"},children:[Gt.jsx(mu,{width:18,height:18,tokens:[t.mintA,t.mintB],mr:4}),Gt.jsx(E,{loading:r,loadingProps:{width:50},sx:{mr:4},children:Kr({input:a,decimals:t.lpMint.decimals})}),`${t.mintA.symbol}/${t.mintB.symbol} LP`,Gt.jsx(W,{title:Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:10,typography:"body2",color:"text.primary"},children:[Gt.jsx(bu,{address:t.mintA.address,chainId:t.mintA.chainId,showName:null!==(u=t.mintA.symbol)&&void 0!==u?u:"",size:14,offset:4,rightContent:Gt.jsx(E,{loading:i,loadingProps:{width:50},children:Kr({input:s,decimals:t.mintA.decimals})})}),Gt.jsx(bu,{address:t.mintB.address,chainId:t.mintB.chainId,showName:null!==(p=t.mintB.symbol)&&void 0!==p?p:"",size:14,offset:4,rightContent:Gt.jsx(E,{loading:i,loadingProps:{width:50},children:Kr({input:d,decimals:t.mintB.decimals})})}),Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[Gt.jsx(n,{id:"c4miqE",message:"Pool share"}),Gt.jsx(E,{loading:i,loadingProps:{width:50},children:h})]})]}),sx:{padding:20,width:256},children:Gt.jsx(j,{component:Ft.DetailBorder,sx:{ml:4,width:16,height:16,cursor:"pointer"}})}),Gt.jsx(x,{component:"a",target:"_blank",rel:"noopener noreferrer",href:Fc(o.SOON_TESTNET,t.lpMint.address,"address"),sx:{ml:4,display:"inline-flex",height:16},children:Gt.jsx(j,{component:Ft.ArrowTopRightBorder,sx:{width:16,height:16}})})]})]}):null}function wu({active:e,sx:t,onClick:i}){const o=y(),r="light"===o.palette.mode;let a=o.palette.primary.main,l="transparent";return e&&(a=o.palette.primary.contrastText,l=L(o.palette.primary.main,.8)),Gt.jsx(x,{component:M,sx:Object.assign({typography:"body2",p:e?o.spacing(8,20,9):o.spacing(7,19,8),minWidth:79,border:e?void 0:`1px solid ${a}`,color:a,backgroundColor:l,borderRadius:8,fontWeight:600,"&:hover":{color:e?o.palette.primary.contrastText:o.palette.primary.main,backgroundColor:e?o.palette.primary.main:r?"rgba(26, 26, 27, 0.04)":"rgba(241, 249, 2, 0.08)"}},t),onClick:i,children:Gt.jsx(n,{id:"R9Khdg",message:"Auto"})})}function Cu({sx:e,disabled:t,slippage:i,onChangeSlippage:o}){const r=y(),a=i===Jc,[l,s]=_(a?"":new oe(i).times(100).toNumber());return Gt.jsx(W,{disabled:t,onlyClick:!0,title:Gt.jsxs(x,{sx:{backgroundColor:r.palette.background.paper,padding:r.spacing(16,20),borderRadius:16,width:375,maxWidth:"90vw",boxSizing:"border-box"},children:[Gt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",typography:"body2",color:"text.primary"},children:[Gt.jsx("span",{children:Gt.jsx(n,{id:"lqTDfd",message:"Slippage Tolerance"})}),Gt.jsxs("span",{children:[a?Kc:i&&new oe(i).times(100).toNumber(),"%"]})]}),Gt.jsxs(x,{sx:{mt:16,display:"flex",alignItems:"center",margin:r.spacing(16,0,0,0)},children:[Gt.jsx(wu,{sx:{borderRadius:8,whiteSpace:"nowrap"},onClick:()=>{s(""),o(Jc)},active:a}),Gt.jsx(T,{placeholder:String(Kc),value:l,onChange:e=>{const{value:t}=e.target;s(t),o(t?new oe(t).div(100).toNumber():Jc)},onBlur:()=>{(!a&&new oe(i).gt(.1)||new oe(i).lte(0))&&(s(10),o(.1))},suffix:Gt.jsx(x,{sx:{mr:16},children:"%"}),sx:{ml:8,"& input":{px:16,py:0,height:"39px"}}})]})]}),sx:{p:0},arrow:!1,placement:"bottom-end",children:Gt.jsx(P,{sx:Object.assign({width:"max-content",alignItems:"right",margin:r.spacing(0,0,0,"auto"),p:r.spacing(4,12),borderRadius:20,backgroundColor:"background.paperDarkContrast",cursor:"pointer"},e),children:Gt.jsx(x,{component:Ft.Setting,sx:{width:18,height:18,"& path:last-child":{fill:r.palette.text.primary}}})})})}function ku(){var e,t,i;const[o,r]=G.useState(0),[a,l]=G.useState(),[s,d]=G.useState(),[c,u]=G.useState(""),[p,h]=G.useState(""),[m,f]=G.useState(Jc),g=m===Jc?new oe(Kc).div(100).toNumber():m,{isMobile:y}=Ec(),{onlyChainId:v}=Zr(),j=G.useMemo((()=>v||(null==a?void 0:a.chainId)||(null==s?void 0:s.chainId)),[v,a,s]),{poolKeys:w,poolInfo:C,pairAddress:k,price:R,isInvalidPair:S,invertedPrice:I,poolInfoLoading:E,lpBalanceLoading:M,lpBalance:T,lpBalancePercentage:L,lpToAmountA:O,lpToAmountB:W,liquidityMinted:V,pairMintAAmount:A,pairMintBAmount:F,isExists:Z}=function({baseToken:e,quoteToken:t,baseAmount:n,quoteAmount:i,feeIndex:o,slippage:r}){var a,l,s;const[d,c]=G.useMemo((()=>{if(!e||!t||null==o)return[void 0,!0];const n=new vt(new Te(e.address).toBuffer()).lte(new vt(new Te(t.address).toBuffer())),[i,r]=n?[e,t]:[t,e],[a,l]=[new Te(i.address),new Te(r.address)];return[ze({poolId:void 0,programId:ua,configId:new Te(ha[o].id),mintA:a,mintB:l}),a.toBase58()===l.toBase58()]}),[o,e,t]),{price:u,invertedPrice:p,poolInfoQuery:h,lpBalanceQuery:m,lpBalance:f,lpBalancePercentage:g,lpToAmountA:x,lpToAmountB:y,liquidityMinted:v,pairMintAAmount:b,pairMintBAmount:j,isExists:w}=nu({pool:e&&t&&d?{baseToken:e,quoteToken:t,address:d.poolId.toBase58()}:void 0,baseAmount:n,quoteAmount:i,slippage:r});return{poolKeys:null===(a=h.data)||void 0===a?void 0:a.poolKeys,poolInfo:null===(l=h.data)||void 0===l?void 0:l.poolInfo,pairAddress:null===(s=null==d?void 0:d.poolId)||void 0===s?void 0:s.toBase58(),isInvalidPair:c,price:u,invertedPrice:p,poolInfoLoading:h.isLoading,lpBalanceLoading:m.isLoading,lpBalance:f,lpBalancePercentage:g,lpToAmountA:x,lpToAmountB:y,liquidityMinted:v,pairMintAAmount:b,pairMintBAmount:j,isExists:w}}({baseToken:a,quoteToken:s,baseAmount:c,quoteAmount:p,feeIndex:o,slippage:g}),P=eu(R);if(R&&c&&!R.isEqualTo(null!=P?P:0)&&Z){const t=R.times(c).dp(null!==(e=null==s?void 0:s.decimals)&&void 0!==e?e:18);t.isEqualTo(p)||h(t.toString())}const B=al(a,{amount:c}),N=al(s,{amount:p}),[U,H]=G.useState(!1),D=!a||!s,Y=()=>{zc.getState().push({type:Yc.Pool})},z=tu({baseToken:a,quoteToken:s,pairMintAAmount:A,pairMintBAmount:F,isExists:Z,poolKeys:w,poolInfo:C,slippage:g,successBack:()=>{zc.getState().push({type:Yc.Pool,params:{tab:ru.myLiquidity}})}});return Gt.jsxs(_c,{children:[Gt.jsxs(x,{sx:{mx:"auto",borderRadius:y?0:16,backgroundColor:"background.paper",width:y?"100%":600,position:"relative",overflow:"hidden"},children:[y?Gt.jsx(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",p:20,pb:0},children:Gt.jsx(Xc,{onClick:Y})}):Gt.jsxs(x,{sx:{position:"relative",display:"flex",justifyContent:"center",alignItems:"center",px:20,py:24,typography:"caption"},children:[Gt.jsx(x,{component:Ft.ArrowBack,sx:{position:"absolute",left:20,cursor:"pointer"},onClick:Y}),Gt.jsx(n,{id:"E6MqGy",message:"Add liquidity"})]}),Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:20,pt:24,px:20,pb:20},children:[Gt.jsx(ju,{isExists:Z,poolInfo:C,poolInfoLoading:E,lpBalanceLoading:M,lpBalance:T,lpBalancePercentage:L,lpToAmountA:O,lpToAmountB:W}),Gt.jsxs(yu,{title:Gt.jsx(n,{id:"nxRg31",message:"Select pair"}),children:[Gt.jsxs(x,{sx:{display:"grid",gridTemplateColumns:y?"repeat(1, 1fr)":"repeat(2, 1fr)",gap:12},children:[Gt.jsx(Gc,{border:!0,highlightDefault:!0,chainId:j,token:a,onTokenChange:(e,t)=>{t?(l(s),d(a),u(""),h("")):(l(e),u(""))},occupiedToken:s}),Gt.jsx(Gc,{border:!0,highlightDefault:!0,chainId:j,token:s,onTokenChange:(e,t)=>{t?(l(s),d(a)):(d(e),h(""))},occupiedToken:a})]}),Gt.jsx(vu,{feeIndex:o,onChange:r,feeList:ha,disabled:D})]}),Gt.jsx(yu,{title:Gt.jsx(n,{id:"MU9s7M",message:"Deposit amounts"}),disabled:D,children:Gt.jsxs(x,{children:[Gt.jsx(Uc,{sx:{mb:4,pb:28,minHeight:"auto"},token:a,amt:c,defaultLoadBalance:!0,onInputChange:e=>{var t;u(e);const n=Number(e);Z&&R&&n&&h(R.times(e).dp(null!==(t=null==s?void 0:s.decimals)&&void 0!==t?t:18).toString())},showMaxBtn:!0,occupiedAddrs:[null!==(t=null==s?void 0:s.address)&&void 0!==t?t:""],occupiedChainId:null==s?void 0:s.chainId,notTokenPickerModal:!0,showPercentage:!0,readOnly:D}),Gt.jsx(kc,{plus:!0}),Gt.jsx(Uc,{sx:{pb:20,minHeight:"auto"},token:s,amt:p,defaultLoadBalance:!0,onInputChange:e=>{var t;h(e);const n=Number(e);Z&&I&&n&&u(I.times(e).dp(null!==(t=null==a?void 0:a.decimals)&&void 0!==t?t:18).toString())},showMaxBtn:!0,occupiedAddrs:[null!==(i=null==a?void 0:a.address)&&void 0!==i?i:""],occupiedChainId:null==a?void 0:a.chainId,notTokenPickerModal:!0,showPercentage:!0,readOnly:D}),Gt.jsx(Cu,{slippage:m,onChangeSlippage:f,disabled:D,sx:{mt:8}}),Gt.jsx(gu,{baseToken:a,quoteToken:s,loading:E,midPrice:R,lpBalancePercentage:Z?L:100}),!!Z&&Gt.jsxs(x,{sx:{mt:20,p:20,borderRadius:16,backgroundColor:"background.paperContrast",typography:"h6",textAlign:"center","& > b":{fontWeight:600,color:"primary.main"}},children:["🌟",Gt.jsx("b",{children:Gt.jsx(n,{id:"e38JNU",message:"Tips:"})})," ",Gt.jsx(n,{id:"XoymfI",message:"By adding liquidity you’ll earn <0>{0}</0>of all trades on this pair proportional to your share of the pool. Fees are added to the pool, accrue in real time and can be claimed by withdrawing your liquidity.",values:{0:da({input:ha[o].tradeFeeRate/1e4})},components:{0:Gt.jsx("b",{})}})]})]})})]}),Gt.jsx(x,{sx:{py:16,px:20,borderTopWidth:1},children:Gt.jsx(gc,{fullWidth:!0,includeButton:!0,size:b.Size.big,disabled:D,chainId:j,children:Gt.jsx(qc,{statuses:[B,N],buttonProps:{size:b.Size.big},children:Gt.jsx(b,{fullWidth:!0,size:b.Size.big,disabled:!(a&&s&&c&&p&&!S&&null!=o),onClick:()=>H(!0),children:S?Gt.jsx(n,{id:"R7D79P",message:"Invalid pair"}):Gt.jsx(n,{id:"bwSQI0",message:"Supply"})})})})})]}),Gt.jsx(xu,{open:U,onClose:()=>H(!1),slippage:g,baseToken:a,pairMintAAmount:A,quoteToken:s,pairMintBAmount:F,feeRate:ha[o].tradeFeeRate,price:R,lpAmount:V,lpBalancePercentage:Z?L:100,pairAddress:k,createMutation:z})]})}const Ru=({type:e})=>{const[t,n]=_(Jc),i=K((()=>t===Jc?e===u?new oe($c).div(100).toNumber():e===p?new oe(Kc).div(100).toNumber():new oe(Qc).div(100).toNumber():t),[t,e]);return{slipper:t,setSlipper:n,slipperValue:i,resetSlipper:()=>{n(Jc)}}};function Su({type:e,disabled:t,value:i,onChange:o,sx:r}){const a=y(),l=i===Jc,[s,d]=_(l?"":new oe(i).times(100).toNumber()),c=e===u?$c:e===p?Kc:Qc;return Gt.jsx(W,{disabled:t,onlyClick:!0,title:Gt.jsxs(x,{sx:{backgroundColor:a.palette.background.paper,padding:a.spacing(12,20),borderRadius:8,width:318,maxWidth:"90vw",boxSizing:"border-box"},children:[Gt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",typography:"body2"},children:[Gt.jsx("span",{children:Gt.jsx(n,{id:"lqTDfd",message:"Slippage Tolerance"})}),Gt.jsxs("span",{children:[l?c:i&&new oe(i).times(100).toNumber(),"%"]})]}),Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",margin:a.spacing(16,0,0,0)},children:[Gt.jsx(wu,{sx:{borderRadius:8,whiteSpace:"nowrap"},onClick:()=>{d(""),o(Jc)},active:l}),Gt.jsx(T,{placeholder:String(c),value:s,onChange:e=>{const{value:t}=e.target;d(t),o(t?new oe(t).div(100).toNumber():Jc)},onBlur:()=>{(!l&&new oe(i).gt(.1)||new oe(i).lte(0))&&(d(10),o(.1))},suffix:Gt.jsx(x,{sx:{mr:16},children:"%"}),sx:{ml:8,"& input":{px:16,py:0,height:"39px"}}})]})]}),sx:{p:0},arrow:!1,placement:"bottom-end",children:Gt.jsx(P,{sx:Object.assign({width:"max-content",alignItems:"right",margin:a.spacing(0,0,0,"auto"),p:a.spacing(4,12),borderRadius:20,backgroundColor:"background.paperDarkContrast"},r),children:Gt.jsx(x,{component:Ft.Setting,sx:{width:18,height:18,"& path:last-child":{fill:a.palette.text.primary}}})})})}const Iu=({chainId:e,isValid:t,errorMessage:n,setShowConfirm:o})=>Gt.jsx(gc,{includeButton:!0,fullWidth:!0,chainId:e,children:Gt.jsx(b,{fullWidth:!0,size:b.Size.big,onClick:()=>{o(!0)},disabled:!t,danger:!t,children:n||i._({id:"rdUucN",message:"Preview"})})}),Eu=[.25,.5,.75,1];function Mu({currentValue:e,onClick:t,sx:n}){const i=y(),o="light"===i.palette.mode,{isMobile:r}=Ec(),[a,l]=_(null),s=te(0);J((()=>{e?(s.current+=1,s.current>=2&&(l(null),s.current=0)):l(null)}),[e]);const d=eu(e);return J((()=>{d===e&&1===a&&(s.current=1)}),[e,d,a]),Gt.jsx(x,{sx:Object.assign({display:"grid",gap:r?10:14,gridTemplateColumns:`repeat(${Eu.length}, 1fr)`},n),children:Eu.map((e=>{const n=e===a;return Gt.jsxs(M,{sx:{typography:"h6",borderRadius:4,padding:i.spacing(4,0),width:"100%",color:"text.secondary",backgroundColor:"background.paperDarkContrast","&:hover":{color:i.palette.text.primary,backgroundColor:L(i.palette.text.primary,.2)},"&.selected, &:focus":{color:"#fff",backgroundColor:o?i.palette.primary.main:L(i.palette.text.primary,.4)}},onClick:()=>{n||(s.current=0,l(e),t(e))},className:n?"selected":void 0,children:[100*e,"%"]},e)}))})}const Tu=({value:e,onUserInput:t,maxAmount:o,balance:r,mint:a,locked:l})=>{var s,d;const c=y(),u=Q((e=>{if(!o||!a)return;const n=o.multipliedBy(e).dp(a.decimals).toString();t(n)}),[a,o,t]),p=K((()=>r?Kr({input:r,decimals:null==a?void 0:a.decimals}):"-"),[null==a?void 0:a.decimals,r]);return Gt.jsxs(x,{sx:{pt:12,pb:20,px:20,borderWidth:1,borderStyle:"solid",borderColor:"border.main",borderRadius:12,backgroundColor:c.palette.background.input},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:4},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,color:c.palette.text.primary,typography:"h5"},children:[(null==a?void 0:a.address)&&Gt.jsx(Ms,{address:null!==(s=null==a?void 0:a.address)&&void 0!==s?s:"",chainId:null==a?void 0:a.chainId,noShowChain:!0,width:24,height:24,marginRight:0}),Gt.jsx(x,{sx:{display:"flex",alignItems:"center"},children:(null==a?void 0:a.address)?Gt.jsx(x,{children:null!==(d=null==a?void 0:a.symbol)&&void 0!==d?d:"-"}):Gt.jsx(n,{id:"sIPJGT",message:"SELECT TOKEN"})})]}),Gt.jsxs(x,{component:M,sx:{color:c.palette.text.secondary,"&:hover":{color:c.palette.text.primary},cursor:"pointer",display:"flex",flexWrap:"wrap",justifyContent:"flex-end",typography:"body2"},onClick:()=>{u(1)},children:[Gt.jsxs(x,{sx:{wordBreak:"keep-all"},children:[i._({id:"fsBGk0",message:"Balance"}),": "]}),Gt.jsx(x,{sx:{wordBreak:"break-all",textAlign:"right",display:"flex",alignItems:"center"},children:p})]})]}),Gt.jsx(Ic,{sx:{mt:4},suffix:void 0,value:e,onChange:t,readOnly:l,withClear:!l}),l?null:Gt.jsx(Mu,{sx:{mt:20,mb:0},onClick:u,currentValue:e})]})};var Lu,Ou;function Wu(e,t){switch(t.type){case Lu.UpdateMint1:{const n=t.payload;return Object.assign(Object.assign({},e),{mint1:n})}case Lu.UpdateDefaultMint1:{const n=t.payload;return e.mint1?e:Object.assign(Object.assign({},e),{mint1:n})}case Lu.UpdateMint2:{const n=t.payload;return Object.assign(Object.assign({},e),{mint2:n})}case Lu.UpdateDefaultMint2:{const n=t.payload;return e.mint2?e:Object.assign(Object.assign({},e),{mint2:n})}case Lu.UpdateMint1AndClearMint2:{const n=t.payload;return Object.assign(Object.assign({},e),{mint1:n,mint2:void 0})}case Lu.UpdateFeeAmount:return Object.assign(Object.assign({},e),{feeAmount:t.payload});case Lu.UpdateSelectedMintIndex:return Object.assign(Object.assign({},e),{selectedMintIndex:t.payload});case Lu.setFullRange:return Object.assign(Object.assign({},e),{leftRangeTypedValue:!0,rightRangeTypedValue:!0});case Lu.typeStartPriceInput:return Object.assign(Object.assign({},e),{startPriceTypedValue:t.payload.typedValue});case Lu.typeLeftRangeInput:return Object.assign(Object.assign({},e),{leftRangeTypedValue:t.payload.typedValue});case Lu.typeRightRangeInput:return Object.assign(Object.assign({},e),{rightRangeTypedValue:t.payload.typedValue});case Lu.typeInput:{const{payload:{field:n,typedValue:i}}=t;return Object.assign(Object.assign({},e),{independentField:n,typedValue:i})}default:throw Error("Unknown action: "+t.type)}}!function(e){e[e.UpdateMint1=0]="UpdateMint1",e[e.UpdateMint2=1]="UpdateMint2",e[e.UpdateDefaultMint1=2]="UpdateDefaultMint1",e[e.UpdateDefaultMint2=3]="UpdateDefaultMint2",e[e.UpdateMint1AndClearMint2=4]="UpdateMint1AndClearMint2",e[e.UpdateFeeAmount=5]="UpdateFeeAmount",e[e.UpdateSelectedMintIndex=6]="UpdateSelectedMintIndex",e[e.setFullRange=7]="setFullRange",e[e.typeStartPriceInput=8]="typeStartPriceInput",e[e.typeLeftRangeInput=9]="typeLeftRangeInput",e[e.typeRightRangeInput=10]="typeRightRangeInput",e[e.typeInput=11]="typeInput"}(Lu||(Lu={})),function(e){e[e.LOW=1e3]="LOW"}(Ou||(Ou={}));const Vu={[Ou.LOW]:20},Au={[Ou.LOW]:{label:"0.1%"}},Fu=({disabled:e,feeAmount:t,dispatch:n})=>{const o=y(),{isMobile:r}=Ec(),[a,l]=_(!1);return Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs(x,{sx:Object.assign({display:"flex",alignItems:"center",justifyContent:"space-between",px:20,py:12,borderWidth:1,borderStyle:"solid",borderColor:o.palette.border.main,borderRadius:12},e?{opacity:.3}:void 0),children:[Gt.jsx(x,{sx:{typography:"h5",color:o.palette.text.primary},children:t?`${Au[t].label} ${i._({id:"fxRyGG",message:"fee tier"})}`:i._({id:"EU3wU4",message:"Fee tier"})}),Gt.jsx(b,{size:b.Size.small,variant:b.Variant.outlined,disabled:e,onClick:()=>l((e=>!e)),sx:{color:o.palette.text.primary,border:`solid 1px ${o.palette.text.primary}`},children:a?i._({id:"vLyv1R",message:"Hide"}):i._({id:"ePK91l",message:"Edit"})})]}),a&&Gt.jsx(x,{sx:Object.assign({},r?{display:"grid",gap:8,gridTemplateColumns:"repeat(2, 1fr)"}:{display:"flex",alignItems:"center",gap:8}),children:[Ou.LOW].map((i=>{const r=t===i;return Gt.jsxs(b,{size:b.Size.middle,variant:b.Variant.outlined,disabled:e,onClick:()=>{n({type:Lu.UpdateFeeAmount,payload:i})},sx:{flexBasis:"50%",flexShrink:1,flexGrow:1,justifyContent:"space-between",px:20,color:o.palette.text.primary,borderRadius:12,borderColor:r?o.palette.primary.main:o.palette.border.main,[o.breakpoints.up("tablet")]:{flexBasis:"25%"}},children:[Au[i].label,r?Gt.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[Gt.jsx("rect",{x:"0.5",y:"0.5",width:"17",height:"17",rx:"8.5",stroke:o.palette.primary.main}),Gt.jsx("rect",{x:"4.5",y:"4.5",width:"9",height:"9",rx:"4.5",fill:o.palette.primary.main,stroke:o.palette.primary.main})]}):Gt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:Gt.jsx("rect",{x:"0.5",y:"0.5",width:"17",height:"17",rx:"8.5",stroke:o.palette.text.secondary})})]},i)}))})]})};var Zu,Pu,Bu;!function(e){e.DEPOSIT_1="DEPOSIT_1",e.DEPOSIT_2="DEPOSIT_2"}(Zu||(Zu={})),function(e){e.LOWER="LOWER",e.UPPER="UPPER"}(Pu||(Pu={})),function(e){e.TOKEN0="TOKEN0",e.TOKEN1="TOKEN1"}(Bu||(Bu={}));const Nu={xs:"4px",sm:"8px",md:"12px",lg:"24px",xl:"32px"},Uu=({children:e,sx:t})=>(y(),Gt.jsx(x,{sx:Object.assign({display:"flex",flexDirection:"column",gap:20,px:20,py:20,borderRadius:12},t),children:e})),Hu=({children:e,sx:t})=>{const n=y();return Gt.jsx(Uu,{sx:Object.assign(Object.assign({},t),{backgroundColor:n.palette.background.paperContrast}),children:e})},Du=({children:e})=>{const t=y();return Gt.jsxs(x,{sx:{p:8,borderRadius:8,backgroundColor:L(t.palette.warning.main,.1),display:"flex",alignItems:"center",gap:8},children:[Gt.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:Gt.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.75 16.125L9 1.875L17.25 16.125H0.75ZM14.6475 14.625L8.99998 4.86749L3.35247 14.625H14.6475ZM9.75004 12.375H8.25003V13.875H9.75004V12.375ZM8.25003 7.875H9.75004V10.875H8.25003V7.875Z",fill:t.palette.warning.main})}),Gt.jsx(x,{sx:{typography:"h6",color:t.palette.warning.main,textAlign:"left"},children:e})]})};function Yu({gap:e,flex:t,children:n,style:i}){return Gt.jsx(x,{sx:Object.assign(Object.assign(Object.assign({display:"flex",flexDirection:"column",justifyContent:"flex-start",gap:e&&Nu[e]||e},t&&{flex:t}),{width:"100%",alignItems:"center"}),i),children:n})}function zu({gap:e,justify:t,grow:n,children:i,style:o}){return Gt.jsx(x,{sx:Object.assign({display:"grid",gridAutoRows:"auto",gridRowGap:e&&Nu[e]||e,justifyItems:t,flexGrow:n&&1},o),children:i})}function Xu({gap:e,children:t,sx:n}){return Gt.jsx(x,{sx:Object.assign({width:"100%",display:"flex",padding:0,alignItems:"center",justifyContent:"flex-start",gap:e&&Nu[e]||e},n),children:t})}function qu({children:e,style:t}){return Gt.jsx(Xu,{sx:Object.assign({justifyContent:"space-between"},t),children:e})}function Gu({gap:e,justify:t,children:n,sx:i}){return Gt.jsx(Xu,{sx:Object.assign({position:"relative",width:"fit-content",margin:`-${e}`},i),children:n})}function _u({children:e,disabled:t,sx:n}){return Gt.jsx(Xu,{sx:Object.assign({display:"flex",flexDirection:"column",alignItems:"stretch",gap:12,opacity:t?.2:1,pointerEvents:t?"none":"auto"},n),children:e})}const Ju={neutral1:"#222222",neutral2:"#7D7D7D",accent1:"#FC72FF",critical:"FF5F52",white:"#FFFFFF",surface3:"#22222212",opacity:{hover:.6,click:.4,disabled:.5,enabled:1}},Qu=({series:e,xScale:t,yScale:n,xValue:i,yValue:o,fill:r})=>K((()=>{var a;return Gt.jsx(x,{component:"path",opacity:.5,stroke:null!=r?r:Ju.accent1,fill:null!=r?r:Ju.accent1,d:null!==(a=wt().curve(Ct).x((e=>t(i(e)))).y1((e=>n(o(e)))).y0(n(0))(e.filter((e=>{const n=t(i(e));return n>0&&n<=window.innerWidth}))))&&void 0!==a?a:void 0})}),[r,e,t,i,n,o]),Ku=({axisGenerator:e})=>Gt.jsx("g",{ref:t=>{t&&Rt(t).call(e).call((e=>e.select(".domain").remove()))}}),$u=({xScale:e,innerHeight:t,offset:n=0})=>K((()=>Gt.jsx(x,{component:"g",transform:`translate(0, ${t+n})`,sx:{"& line":{display:"none"},"& text":{color:Ju.neutral2,transform:"translateY(5px)"}},children:Gt.jsx(Ku,{axisGenerator:kt(e).ticks(6)})})),[t,n,e]),ep=e=>["M 0 0",`v ${e}`,"m 1 0","V 0","M 0 1","h 12","q 2 0, 2 2","v 22","q 0 2 -2 2","h -12","z"].join(" "),tp=()=>["m 5 7","v 14","M 0 0","m 9 7","v 14","z"].join(" "),np=({color:e,size:t=10,margin:n=10})=>Gt.jsx("polygon",{points:`0 0, ${t} ${t}, 0 ${t}`,transform:` translate(${t+n}, ${n}) rotate(45) `,fill:e,stroke:e,strokeWidth:"4",strokeLinejoin:"round"});const ip=({color:e,d:t})=>Gt.jsx(x,{component:"path",cursor:"ew-resize",pointerEvents:"none",strokeWidth:3,stroke:e,fill:e,d:t}),op=({d:e})=>Gt.jsx(x,{component:"path",cursor:"ew-resize",pointerEvents:"none",stroke:Ju.white,opacity:Ju.opacity.hover,d:e}),rp=({visible:e,transform:t,children:n})=>Gt.jsx(x,{component:"g",opacity:e?"1":"0",transform:t,sx:{transition:"opacity 300ms"},children:n}),ap=({y:e,x:t,height:n,width:i,rx:o})=>Gt.jsx(x,{component:"rect",fill:Ju.surface3,y:e,x:t,height:n,width:i,rx:o}),lp=({y:e,transform:t,dominantBaseline:n,children:i})=>Gt.jsx(x,{component:"text",y:e,textAnchor:"middle",fontSize:"13px",fill:Ju.neutral1,transform:t,dominantBaseline:n,children:i}),sp=(e,t,n)=>{const i=e.map((e=>n(e).toFixed(1))),o=t.map((e=>n(e).toFixed(1)));return i.every(((e,t)=>e===o[t]))},dp=({id:e,xScale:t,interactive:n,brushLabelValue:i,brushExtent:o,setBrushExtent:r,innerWidth:a,innerHeight:l,westHandleColor:s,eastHandleColor:d})=>{const c=te(null),u=te(null),[p,h]=_(o),[m,f]=_(!1),[g,x]=_(!1),y=function(e){const t=te();return J((()=>{t.current=e}),[e]),t.current}(o),v=Q((e=>{const{type:n,selection:i,mode:a}=e;if(!i)return void h(null);const l=i.map(t.invert);"end"!==n||sp(o,l,t)||r(l,a),h(l)}),[t,o,r]);J((()=>{h(o)}),[o]),J((()=>{c.current&&(u.current=St().extent([[Math.max(2,t(0)),0],[a-2,l]]).handleSize(30).filter((()=>n)).on("brush end",v),u.current(Rt(c.current)),y&&sp(o,y,t)&&Rt(c.current).transition().call(u.current.move,o.map(t)),Rt(c.current).selectAll(".selection").attr("stroke","none").attr("fill-opacity","0.1").attr("fill",`url(#${e}-gradient-selection)`))}),[o,v,e,l,a,n,y,t]),J((()=>{c.current&&u.current&&u.current.move(Rt(c.current),o.map(t))}),[o,t]),J((()=>{f(!0);const e=setTimeout((()=>f(!1)),1500);return()=>clearTimeout(e)}),[p]);const b=p&&t(p[0])>20,j=p&&t(p[1])>a-20,w=p&&(t(p[0])<0||t(p[1])<0),C=p&&(t(p[0])>a||t(p[1])>a),k=p&&t(p[0])>=0&&t(p[0])<=a,R=p&&t(p[1])>=0&&t(p[1])<=a;return K((()=>Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs("defs",{children:[Gt.jsxs("linearGradient",{id:`${e}-gradient-selection`,x1:"0%",y1:"100%",x2:"100%",y2:"100%",children:[Gt.jsx("stop",{stopColor:s}),Gt.jsx("stop",{stopColor:d,offset:"1"})]}),Gt.jsx("clipPath",{id:`${e}-brush-clip`,children:Gt.jsx("rect",{x:"0",y:"0",width:a,height:l})})]}),Gt.jsx("g",{ref:c,clipPath:`url(#${e}-brush-clip)`,onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1)}),p&&Gt.jsxs(Gt.Fragment,{children:[k?Gt.jsxs("g",{transform:`translate(${Math.max(0,t(p[0]))}, 0), scale(${b?"-1":"1"}, 1)`,children:[Gt.jsxs("g",{children:[Gt.jsx(ip,{color:s,d:ep(l)}),Gt.jsx(op,{d:tp()})]}),Gt.jsxs(rp,{transform:`translate(50,0), scale(${b?"1":"-1"}, 1)`,visible:m||g,children:[Gt.jsx(ap,{y:"0",x:"-30",height:"30",width:"60",rx:"8"}),Gt.jsx(lp,{transform:"scale(-1, 1)",y:"15",dominantBaseline:"middle",children:i("w",p[0])})]})]}):null,R?Gt.jsxs("g",{transform:`translate(${t(p[1])}, 0), scale(${j?"-1":"1"}, 1)`,children:[Gt.jsxs("g",{children:[Gt.jsx(ip,{color:d,d:ep(l)}),Gt.jsx(op,{d:tp()})]}),Gt.jsxs(rp,{transform:`translate(50,0), scale(${j?"-1":"1"}, 1)`,visible:m||g,children:[Gt.jsx(ap,{y:"0",x:"-30",height:"30",width:"60",rx:"8"}),Gt.jsx(lp,{y:"15",dominantBaseline:"middle",children:i("e",p[1])})]})]}):null,w&&Gt.jsx(np,{color:s}),C&&Gt.jsx("g",{transform:`translate(${a}, 0) scale(-1, 1)`,children:Gt.jsx(np,{color:d})})]})]})),[i,d,R,j,b,g,e,l,a,p,C,m,w,s,k,t])},cp=({value:e,xScale:t,innerHeight:n})=>K((()=>Gt.jsx(x,{component:"line",x1:t(e),y1:"0",x2:t(e),y2:n,sx:{opacity:.5,strokeWidth:2,stroke:Ju.neutral1,fill:"none"}})),[e,t,n]);function up({svg:e,xScale:t,setZoom:n,width:i,height:o,resetBrush:r,showResetButton:a,zoomLevels:l}){const s=te(),[d,c,u,p]=K((()=>[()=>e&&s.current&&Rt(e).transition().call(s.current.scaleBy,2),()=>e&&s.current&&Rt(e).transition().call(s.current.scaleBy,.5),()=>e&&s.current&&Rt(e).transition().call(s.current.scaleTo,.5),()=>e&&s.current&&Rt(e).call(s.current.transform,It.translate(0,0).scale(1)).transition().call(s.current.scaleTo,.5)]),[e]);return J((()=>{e&&(s.current=Et().scaleExtent([l.min,l.max]).extent([[0,0],[i,o]]).on("zoom",(({transform:e})=>n(e))),Rt(e).call(s.current))}),[o,i,n,e,t,s,l,l.max,l.min]),J((()=>{u()}),[u,l]),Gt.jsxs(x,{sx:{display:"grid",gridTemplateColumns:`repeat(${a?3:2}, 1fr)`,gridGap:"6px",position:"absolute",top:"-32px",right:0},children:[a&&Gt.jsx(b,{size:b.Size.small,sx:{borderRadius:16},onClick:()=>{r(),p()},disabled:!1,children:Gt.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[Gt.jsx("polyline",{points:"1 4 1 10 7 10"}),Gt.jsx("polyline",{points:"23 20 23 14 17 14"}),Gt.jsx("path",{d:"M20.49 9A9 9 0 0 0 5.64 5.64L1 10m22 4l-4.64 4.36A9 9 0 0 1 3.51 15"})]})}),Gt.jsx(b,{size:b.Size.small,sx:{borderRadius:16},onClick:d,disabled:!1,children:Gt.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[Gt.jsx("circle",{cx:"11",cy:"11",r:"8"}),Gt.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}),Gt.jsx("line",{x1:"11",y1:"8",x2:"11",y2:"14"}),Gt.jsx("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]})}),Gt.jsx(b,{size:b.Size.small,sx:{borderRadius:16},onClick:c,disabled:!1,children:Gt.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[Gt.jsx("circle",{cx:"11",cy:"11",r:"8"}),Gt.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}),Gt.jsx("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]})})]})}const pp=e=>e.price0,hp=e=>e.activeLiquidity;function mp({id:e="liquidityChartRangeInput",data:{series:t,current:n},ticksAtLimit:i,styles:o,dimensions:{width:r,height:a},margins:l,interactive:s=!0,brushDomain:d,brushLabels:c,onBrushDomainChange:u,zoomLevels:p}){const h=te(null),[m,f]=_(null),[g,y]=K((()=>[a-l.top-l.bottom,r-l.left-l.right]),[r,a,l]),{xScale:v,yScale:b}=K((()=>{const e={xScale:Mt().domain([n*p.initialMin,n*p.initialMax]).range([0,y]),yScale:Mt().domain([0,Tt(t,hp)]).range([g,0])};if(m){const t=m.rescaleX(e.xScale);e.xScale.domain(t.domain())}return e}),[n,p.initialMin,p.initialMax,y,t,g,m]);return J((()=>{f(null)}),[p]),J((()=>{d||u(v.domain(),void 0)}),[d,u,v]),Gt.jsxs(Gt.Fragment,{children:[Gt.jsx(up,{svg:h.current,xScale:v,setZoom:f,width:y,height:a,resetBrush:()=>{u([n*p.initialMin,n*p.initialMax],"reset")},showResetButton:Boolean(i[Pu.LOWER]||i[Pu.UPPER]),zoomLevels:p}),Gt.jsxs("svg",{width:"100%",height:"100%",viewBox:`0 0 ${r} ${a}`,style:{overflow:"visible"},children:[Gt.jsxs("defs",{children:[Gt.jsx("clipPath",{id:`${e}-chart-clip`,children:Gt.jsx("rect",{x:"0",y:"0",width:y,height:a})}),d&&Gt.jsx("mask",{id:`${e}-chart-area-mask`,children:Gt.jsx("rect",{fill:"white",x:v(d[0]),y:"0",width:v(d[1])-v(d[0]),height:g})})]}),Gt.jsxs("g",{transform:`translate(${l.left},${l.top})`,children:[Gt.jsxs("g",{clipPath:`url(#${e}-chart-clip)`,children:[Gt.jsx(Qu,{series:t,xScale:v,yScale:b,xValue:pp,yValue:hp}),d&&Gt.jsx("g",{mask:`url(#${e}-chart-area-mask)`,children:Gt.jsx(Qu,{series:t,xScale:v,yScale:b,xValue:pp,yValue:hp,fill:o.area.selection})}),Gt.jsx(cp,{value:n,xScale:v,innerHeight:g}),Gt.jsx($u,{xScale:v,innerHeight:g})]}),Gt.jsx(x,{component:"rect",width:y,height:a,ref:h,sx:{fill:"transparent",cursor:"grab","&:active":{cursor:"grabbing"}}}),Gt.jsx(dp,{id:e,xScale:v,interactive:s,brushLabelValue:c,brushExtent:null!=d?d:v.domain(),innerWidth:y,innerHeight:g,setBrushExtent:u,westHandleColor:o.brush.handle.west,eastHandleColor:o.brush.handle.east})]})]})]})}function fp({tick:e,decimalsA:t,decimalsB:n}){if(!t||!n||"number"!=typeof e)return;const i=Xe.getSqrtPriceX64FromTick(e);return new oe(Xe.sqrtPriceX64ToPrice(i,t,n).toString())}var gp;function xp(e){const t=Fs(),n=we({queryKey:["clmm","getPoolInfoFromRpc",e],enabled:null!=e&&null!=t,queryFn:()=>Vr(this,void 0,void 0,(function*(){if(!t||!e)return null;try{const{poolInfo:n,poolKeys:i,computePoolInfo:o,tickData:r}=yield t.clmm.getPoolInfoFromRpc(e);return{poolInfo:n,poolKeys:i,computePoolInfo:o,tickData:r}}catch(e){return console.error("getPoolInfoFromRpc error",e),null}}))});return n.isLoading?[gp.LOADING,null,e]:n.isError?[gp.INVALID,null,e]:n.data?[gp.EXISTS,n.data,e]:[gp.NOT_EXISTS,null,e]}function yp(e,t,n,i){return xp(K((()=>{if(!e||!t||!n)return null;const o=function({chainId:e,feeAmount:t,mint1Address:n,mint2Address:i}){const[o,r]=new vt(new Te(n).toBuffer()).gt(new vt(new Te(i).toBuffer()))?[i,n]:[n,i],[a,l]=[new Te(o),new Te(r)],s=xa[e];if(!s)throw new Error("Invalid config");const d=s.config.find((e=>e.tradeFeeRate===t));if(!d)throw new Error("Invalid fee");const{publicKey:c}=qe(s.programId,new Te(d.id),a,l);return c}({mint1Address:e,mint2Address:t,feeAmount:n,chainId:i}).toBase58();return o}),[i,n,e,t]))}!function(e){e[e.LOADING=0]="LOADING",e[e.NOT_EXISTS=1]="NOT_EXISTS",e[e.EXISTS=2]="EXISTS",e[e.INVALID=3]="INVALID"}(gp||(gp={}));const vp=8,bp=(e,t)=>e&&t?Math.floor(e/Vu[t])*Vu[t]:void 0,jp=1e3;function wp(e,t){const[n,i]=_(0),[o,r]=_([]),{data:a,error:s,isLoading:d}=function(e,t=0,n){const i=el().getQuery(h.graphql.AllV3TicksDocument,{skip:t,first:jp,where:{chain:n?l[n]:m.SOON_TESTNET,poolAddress:null!=e?e:"",pairType:u}});return we(Object.assign(Object.assign({},i),{enabled:!!e}))}(e,n,t),c=null==a?void 0:a.amm_getTicksData.ticks;return J((()=>{(null==c?void 0:c.length)&&(r((e=>[...e,...c])),(null==c?void 0:c.length)===jp&&i((e=>e+jp)))}),[c]),{isLoading:d||(null==c?void 0:c.length)===jp,error:s,ticks:o}}function Cp({mint1:e,mint2:t,feeAmount:n}){const{isLoading:i,error:o,data:r}=function(e,t,n,i){var o,r;const{chainId:a}=Br(),[l,s,d]=yp(null==e?void 0:e.address,null==t?void 0:t.address,n,a),c=null===(o=null==s?void 0:s.computePoolInfo)||void 0===o?void 0:o.tickCurrent,u=K((()=>bp(c,n)),[c,n]),{isLoading:p,error:h,ticks:m}=wp(d,a);return K((()=>{var n,i,o,r,a,d;if(!e||!t||void 0===u||l!==gp.EXISTS||!m||0===m.length||p)return{isLoading:p||l===gp.LOADING,error:h,activeTick:u,data:void 0};const c=m.findIndex((e=>(null==e?void 0:e.tickIdx)&&e.tickIdx>u))-1;if(c<0)return console.log("usePoolTickData","usePoolActiveLiquidity","TickData pivot not found",{mint1:e.address,mint2:t.address,chainId:e.chainId}),{isLoading:p,error:h,activeTick:u,data:void 0};const f=fp({decimalsA:e.decimals,decimalsB:t.decimals,tick:u}),g={liquidityActive:null!==(i=null===(n=null==s?void 0:s.computePoolInfo)||void 0===n?void 0:n.liquidity.toNumber())&&void 0!==i?i:0,tick:u,liquidityNet:Number(null===(o=m[c])||void 0===o?void 0:o.tickIdx)===u?Number(null!==(a=null===(r=m[c])||void 0===r?void 0:r.liquidityNet)&&void 0!==a?a:0):0,price0:null!==(d=null==f?void 0:f.toFixed(vp))&&void 0!==d?d:"",sdkPrice:f},x=[].concat(g).concat([]);return{isLoading:p,error:h,data:x}}),[u,h,p,e,t,null===(r=null==s?void 0:s.computePoolInfo)||void 0===r?void 0:r.liquidity,l,m])}(e,t,n),a=Q((()=>{if(!(null==r?void 0:r.length))return;const e=[];for(let t=0;t<r.length;t++){const n=r[t],i={activeLiquidity:parseFloat(n.liquidityActive.toString()),price0:parseFloat(n.price0)};i.activeLiquidity>0&&e.push(i)}return e}),[r]);return K((()=>({isLoading:i,error:o,formattedData:i?void 0:a()})),[i,o,a])}const kp={[Ou.LOW]:{initialMin:.999,initialMax:1.001,min:1e-5,max:1.5}};function Rp({message:e,icon:t}){return Gt.jsxs(Yu,{style:{height:"100%",justifyContent:"center"},children:[t,e&&Gt.jsx(x,{sx:{mt:20,p:10,typography:"caption",textAlign:"center"},children:e})]})}function Sp(){return Gt.jsx(E,{})}function Ip({mint1:e,mint2:t,feeAmount:i,ticksAtLimit:o,price:r,priceLower:a,priceUpper:l,onLeftRangeInput:s,onRightRangeInput:d,interactive:c}){const u=!0,{isLoading:p,error:h,formattedData:m}=Cp({mint1:e,mint2:t,feeAmount:i}),f=Q(((e,t)=>{let n=Number(e[0]);const i=Number(e[1]);n<=0&&(n=1/10**6),fe((()=>{(!o[Pu.LOWER]||"handle"===t||"reset"===t)&&n>0&&s(n.toFixed(6)),(!o[Pu.UPPER]||"reset"===t)&&i>0&&i<1e35&&d(i.toFixed(6))}))}),[u,s,d,o]);c=c&&Boolean(null==m?void 0:m.length);const g=K((()=>{const e=a,t=l;return e&&t?[parseFloat(null==e?void 0:e.toString()),parseFloat(null==t?void 0:t.toString())]:void 0}),[a,l]),y=Q(((e,t)=>{if(!r)return"";if("w"===e&&o[Pu.LOWER])return"0";if("e"===e&&o[Pu.UPPER])return"∞";const n=(t<r?-1:1)*((Math.max(t,r)-Math.min(t,r))/r)*100;return r?`${Kr({input:n,decimals:2})}%`:""}),[u,r,o]),v=!e||!t||void 0===m&&!p&&!h;return Gt.jsx(zu,{gap:"md",style:{minHeight:"200px"},children:v?Gt.jsx(Rp,{message:Gt.jsx(n,{id:"OZUH85",message:"Your position will appear here."}),icon:Gt.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"56",height:"56",viewBox:"0 0 24 24",fill:"none",stroke:Ju.neutral1,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[Gt.jsx("polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12"}),Gt.jsx("path",{d:"M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"})]})}):p?Gt.jsx(Sp,{}):h?Gt.jsx(Rp,{message:Gt.jsx(n,{id:"79D0qY",message:"Liquidity data not available."}),icon:Gt.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"56",height:"56",viewBox:"0 0 24 24",fill:"none",stroke:Ju.neutral2,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[Gt.jsx("path",{d:"M22.61 16.95A5 5 0 0 0 18 10h-1.26a8 8 0 0 0-7.05-6M5 5a8 8 0 0 0 4 15h9a5 5 0 0 0 1.7-.3"}),Gt.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]})}):m&&0!==m.length&&r?Gt.jsx(x,{sx:{position:"relative",width:"100%",maxHeight:"200px",justifyContent:"center",alignContent:"center"},children:Gt.jsx(mp,{data:{series:m,current:r},dimensions:{width:560,height:200},margins:{top:10,right:2,bottom:20,left:0},styles:{area:{selection:Ju.accent1},brush:{handle:{west:Ju.critical,east:Ju.accent1}}},interactive:c,brushLabels:y,brushDomain:g,onBrushDomainChange:f,zoomLevels:kp[null!=i?i:Ou.LOW],ticksAtLimit:o})}):Gt.jsx(Rp,{message:Gt.jsx(n,{id:"rH6vg9",message:"There is no liquidity data."}),icon:Gt.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"56",height:"56",viewBox:"0 0 24 24",fill:"none",stroke:Ju.neutral2,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[Gt.jsx("line",{x1:"18",y1:"20",x2:"18",y2:"10"}),Gt.jsx("line",{x1:"12",y1:"20",x2:"12",y2:"4"}),Gt.jsx("line",{x1:"6",y1:"20",x2:"6",y2:"14"})]})})})}const Ep=({value:e,decrement:t,increment:n,decrementDisabled:i=!1,incrementDisabled:o=!1,locked:r,onUserInput:a,title:l,perPriceText:s})=>{const d=y(),[c,u]=_(""),[p,h]=_(!1),m=Q((()=>{h(!1),a(c)}),[c,a]),f=Q((()=>{h(!1),a(t())}),[t,a]),g=Q((()=>{h(!1),a(n())}),[n,a]);return J((()=>{c===e||p||setTimeout((()=>{u(e)}),0)}),[c,p,e]),Gt.jsx(x,{onFocus:()=>{h(!0)},onBlur:m,sx:{width:"100%",py:12,px:20,borderRadius:16,backgroundColor:d.palette.background.input},children:Gt.jsxs(x,{sx:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column",alignItems:"stretch"},children:[Gt.jsx(x,{sx:{typography:"body2",fontWeight:600,color:d.palette.text.primary},children:l}),Gt.jsx(x,{sx:{mt:4,typography:"h6",fontWeight:500,color:d.palette.text.secondary},children:s}),Gt.jsx(Ic,{sx:{mt:12},value:c,onChange:e=>{u(e)},readOnly:r})]}),Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:8},children:[!r&&Gt.jsx(b,{size:b.Size.small,onClick:g,disabled:o,sx:{px:4,backgroundColor:d.palette.background.paper,"&[disabled]":{cursor:"default"}},children:Gt.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:Gt.jsx("path",{d:"M14.25 9.75H9.75V14.25H8.25V9.75H3.75V8.25H8.25V3.75H9.75V8.25H14.25V9.75Z",fill:i?d.palette.text.disabled:d.palette.text.primary})})}),!r&&Gt.jsx(b,{size:b.Size.small,onClick:f,disabled:i,sx:{px:4,backgroundColor:d.palette.background.paper,"&[disabled]":{cursor:"default"}},children:Gt.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:Gt.jsx("rect",{x:"3.75",y:"8.25",width:"10.5",height:"1.5",fill:i?d.palette.text.disabled:d.palette.text.primary})})})]})]})})},Mp=({priceLower:e,priceUpper:t,onLeftRangeInput:i,onRightRangeInput:o,getDecrementLower:r,getIncrementLower:a,getDecrementUpper:l,getIncrementUpper:s,perPriceText:d,ticksAtLimit:c})=>{var u,p;const h=e,m=t;return Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column",alignItems:"stretch",gap:8},children:[Gt.jsx(Ep,{value:c[Pu.LOWER]?"0":null!==(u=null==h?void 0:h.dp(8).toString())&&void 0!==u?u:"",onUserInput:i,decrement:r,increment:a,decrementDisabled:void 0===h||c[Pu.LOWER],incrementDisabled:void 0===h||c[Pu.LOWER],title:Gt.jsx(n,{id:"uEoBVI",message:"Low price"}),perPriceText:d}),Gt.jsx(Ep,{value:c[Pu.UPPER]?"∞":null!==(p=null==m?void 0:m.dp(8).toString())&&void 0!==p?p:"",onUserInput:o,decrement:l,increment:s,incrementDisabled:void 0===m||c[Pu.UPPER],decrementDisabled:void 0===m||c[Pu.UPPER],title:Gt.jsx(n,{id:"kAC8rT",message:"High price"}),perPriceText:d})]})},Tp=({mintA:e,mintB:t,selectedMintIndex:n,handleRateToggle:i,sx:o})=>{const r=y();return Gt.jsx(x,{component:M,onClick:i,sx:Object.assign({display:"flex",alignItems:"center",p:1,borderRadius:8,backgroundColor:r.palette.border.main},o),children:Gt.jsx(x,{sx:{display:"flex",alignItems:"center",width:"100%",[r.breakpoints.up("tablet")]:{width:"auto"}},children:[e,t].map(((e,t)=>{const i=n===t;return Gt.jsx(x,{sx:Object.assign({flexGrow:1,flexShrink:1,flexBasis:"50%",px:12,py:4,borderRadius:7,textAlign:"center",typography:"h6",whiteSpace:"nowrap"},i?{color:r.palette.text.primary,backgroundColor:r.palette.background.paper}:{color:r.palette.text.secondary,backgroundColor:"transparent"}),children:e.symbol},e.address)}))})})};function Lp(e,t){var n;return e?{chainId:t,address:e.id,name:e.name,decimals:Number(e.decimals),symbol:e.symbol,logoURI:null!==(n=e.logoImg)&&void 0!==n?n:""}:e}function Op(e){var t,n,i,o;const r=null==e?void 0:e.pair;if(r)return{address:r.id,chainId:r.chainId,baseToken:Lp(r.baseToken,r.chainId),quoteToken:Lp(r.quoteToken,r.chainId),type:r.type,creator:r.creator,baseLpToken:{id:null===(t=r.baseLpToken)||void 0===t?void 0:t.id},quoteLpToken:{id:null===(n=r.quoteLpToken)||void 0===n?void 0:n.id},lpFeeRate:null===(i=null==e?void 0:e.pair)||void 0===i?void 0:i.lpFeeRate,mtFeeRate:null===(o=null==e?void 0:e.pair)||void 0===o?void 0:o.mtFeeRate}}function Wp(e){const t=Op(e);if(t)return Object.assign(Object.assign({},t),{liquidityPositions:null==e?void 0:e.liquidityPositions})}function Vp(e){switch(e){case"SVM_AMMV2":return"AMM V2";case"SVM_AMMV3":return"AMM V3";default:return"PMM"}}function Ap({type:e,lpFeeRate:t,mtFeeRate:n}){var i,o;return"SVM_AMMV3"===e?null!==(o=null===(i=Au[t])||void 0===i?void 0:i.label)&&void 0!==o?o:"-":`${Kr({input:new oe(null!=t?t:0).plus(null!=n?n:0).div(1e4),decimals:4})}%`}new f,new h;const Fp=({sx:e})=>{const t=y();return Gt.jsx(x,{sx:Object.assign({py:4,px:8,color:t.palette.primary.main,borderRadius:4,backgroundColor:L(t.palette.primary.main,.1),typography:"h6"},e),children:i._({id:"m8r/Yx",message:"AMM V3"})})};function Zp({removed:e,inRange:t}){const n=y(),o={py:4,px:8,color:n.palette.success.main,borderRadius:4,backgroundColor:L(n.palette.success.main,.1),typography:"h6"};return e?Gt.jsx(W,{title:i._({id:"MZPP7t",message:"Your position has 0 liquidity, and is not earning fees."}),children:Gt.jsx(x,{sx:Object.assign(Object.assign({},o),{color:n.palette.warning.main,backgroundColor:L(n.palette.warning.main,.1)}),children:i._({id:"D87pha",message:"Closed"})})}):t?Gt.jsx(W,{title:i._({id:"aIvv/z",message:"The price of this pool is within your selected range. Your position is currently earning fees."}),children:Gt.jsx(x,{sx:o,children:i._({id:"vOyUlD",message:"In range"})})}):Gt.jsx(W,{title:i._({id:"IwiTcw",message:"The price of this pool is outside of your selected range. Your position is not currently earning fees."}),children:Gt.jsx(x,{sx:Object.assign(Object.assign({},o),{color:n.palette.error.main,backgroundColor:L(n.palette.error.main,.1)}),children:i._({id:"i3Z+/Z",message:"Out of range"})})})}function Pp({price:e,atLimit:t,direction:n}){return t[n]?n===Pu.LOWER?"0":"∞":"string"==typeof e&&"∞"===e?"∞":Kr({input:e})}const Bp=({position:e,title:t,ticksAtLimit:i})=>{const{poolInfo:{mintA:o,mintB:r,feeRate:a,price:l},liquidity:s,amountA:d,amountB:c,tickLowerPrice:u,tickUpperPrice:p}=e,h=y(),[m,f]=_(o),g=K((()=>m.address===o.address?r:o),[m.address,o,r]),v=Q((()=>{f(g)}),[g]);return Gt.jsxs(zu,{gap:"md",children:[Gt.jsxs(qu,{children:[t?Gt.jsx(x,{sx:{typography:"body1",fontWeight:600,color:h.palette.text.secondary},children:t}):Gt.jsx("div",{}),Gt.jsx(Tp,{mintA:o,mintB:r,selectedMintIndex:0,handleRateToggle:v})]}),Gt.jsxs(qu,{children:[Gt.jsxs(Hu,{sx:{width:"48%",py:12,gap:12},children:[Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:4},children:[Gt.jsx(x,{sx:{color:h.palette.text.primary,typography:"body2"},children:Gt.jsx(n,{id:"EQs1sJ",message:"Min price"})}),Gt.jsx(x,{sx:{color:h.palette.text.secondary,typography:"h6"},children:Gt.jsx(n,{id:"7Z4WfS",message:"{0} per {1}",values:{0:g.symbol,1:m.symbol}})})]}),Gt.jsx(x,{sx:{color:h.palette.text.primary,typography:"caption"},children:Pp({price:u,atLimit:i,direction:Pu.LOWER})}),Gt.jsx(x,{sx:{color:h.palette.text.secondary,typography:"h6"},children:Gt.jsx(n,{id:"WgTuci",message:"Your position will be 100% composed of {0} at this price",values:{0:null==m?void 0:m.symbol}})})]}),Gt.jsxs(Hu,{sx:{width:"48%",py:12,gap:12},children:[Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:4},children:[Gt.jsx(x,{sx:{color:h.palette.text.primary,typography:"body2"},children:Gt.jsx(n,{id:"5etEUX",message:"Max price"})}),Gt.jsx(x,{sx:{color:h.palette.text.secondary,typography:"h6"},children:Gt.jsx(n,{id:"7Z4WfS",message:"{0} per {1}",values:{0:g.symbol,1:m.symbol}})})]}),Gt.jsx(x,{sx:{color:h.palette.text.primary,typography:"caption"},children:Pp({price:p,atLimit:i,direction:Pu.UPPER})}),Gt.jsx(x,{sx:{color:h.palette.text.secondary,typography:"h6"},children:Gt.jsx(n,{id:"WgTuci",message:"Your position will be 100% composed of {0} at this price",values:{0:null==g?void 0:g.symbol}})})]})]}),Gt.jsxs(Hu,{sx:{py:12,flexDirection:"row",alignItems:"center",justifyContent:"space-between"},children:[Gt.jsxs(zu,{gap:"4px",justify:"flex-start",children:[Gt.jsx(x,{sx:{color:h.palette.text.primary,typography:"body2"},children:Gt.jsx(n,{id:"DWd30U",message:"Current price"})}),Gt.jsx(x,{sx:{color:h.palette.text.secondary,typography:"h6"},children:Gt.jsx(n,{id:"7Z4WfS",message:"{0} per {1}",values:{0:g.symbol,1:m.symbol}})})]}),Gt.jsx(x,{sx:{color:h.palette.text.primary,typography:"caption"},children:Kr({input:l})})]})]})},Np=({position:e,title:t,inRange:i,ticksAtLimit:o})=>{Br();const{poolInfo:{mintA:r,mintB:a,feeRate:l},liquidity:s,amountA:d,amountB:c}=e,p=s.isZero();return Gt.jsxs(zu,{gap:"md",style:{marginTop:"0.5rem"},children:[Gt.jsxs(qu,{style:{gap:4},children:[Gt.jsxs(Gu,{children:[Gt.jsx(mu,{tokens:[{address:r.address},{address:a.address}],mr:8}),Gt.jsxs(x,{sx:{typography:"h5"},children:[r.symbol," / ",a.symbol]})]}),Gt.jsx(Fp,{sx:{ml:"auto"}}),Gt.jsx(Zp,{removed:p,inRange:i})]}),Gt.jsxs(Hu,{children:[Gt.jsxs(zu,{gap:"md",children:[Gt.jsxs(qu,{children:[Gt.jsxs(Gu,{children:[Gt.jsx(Ms,{address:r.address,chainId:r.chainId,noShowChain:!0,width:32,height:32,marginRight:0}),Gt.jsx(x,{sx:{ml:8},children:r.symbol})]}),Gt.jsx(Gu,{children:Gt.jsx(x,{sx:{mr:8},children:Kr({input:d,decimals:r.decimals})})})]}),Gt.jsxs(qu,{children:[Gt.jsxs(Gu,{children:[Gt.jsx(Ms,{address:a.address,chainId:a.chainId,noShowChain:!0,width:32,height:32,marginRight:0}),Gt.jsx(x,{ml:"8px",children:a.symbol})]}),Gt.jsx(Gu,{children:Gt.jsx(x,{mr:"8px",children:Kr({input:c,decimals:a.decimals})})})]})]}),Gt.jsxs(qu,{children:[Gt.jsx(x,{children:Gt.jsx(n,{id:"EU3wU4",message:"Fee tier"})}),Gt.jsx(x,{children:Ap({type:u,lpFeeRate:l,mtFeeRate:0})})]})]}),Gt.jsx(Bp,{position:e,title:t,ticksAtLimit:o})]})},Up=({position:e,outOfRange:t,ticksAtLimit:n,on:o,onClose:r,onConfirm:a,loading:l})=>{const{isMobile:s}=Ec();return Gt.jsx(oc,{open:o,onClose:r,modal:!0,title:i._({id:"E6MqGy",message:"Add liquidity"}),height:683,children:Gt.jsxs(x,{sx:{flex:1,px:20,pb:24,display:"flex",flexDirection:"column",justifyContent:"space-between",width:s?void 0:420},children:[Gt.jsx(x,{sx:{pt:0,px:0},children:e?Gt.jsx(Np,{position:e,inRange:!t,ticksAtLimit:n,title:i._({id:"3VUfrF",message:"Selected Range"})}):null}),Gt.jsx(b,{size:b.Size.big,fullWidth:!0,isLoading:l,sx:{mt:20},onClick:a,children:i._({id:"m16xKo",message:"Add"})})]})})};var Hp;function Dp(){return Dp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Dp.apply(null,arguments)}const Yp=e=>q.createElement("svg",Dp({width:18,height:18,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),Hp||(Hp=q.createElement("g",{id:"ICON/18px/arrow/\\xE6\\x94\\xB6\\xE8\\xB5\\xB7/Dark"},q.createElement("path",{id:"\\xE4\\xB8\\x89\\xE8\\xA7\\x92\\xE5\\xBD\\xA2",fillRule:"evenodd",clipRule:"evenodd",d:"M6.58398 12.376C6.78189 12.6728 7.21811 12.6728 7.41603 12.376L10.4818 7.77735C10.7033 7.44507 10.4651 7 10.0657 7H3.93426C3.53491 7 3.29672 7.44507 3.51823 7.77735L6.58398 12.376Z",fill:"currentColor"}))));function zp({token:e,oppositeTokenAddress:t,dispatch:n,tokenSelectOnChange:o}){const r=y(),{chainId:a}=Br(),[l,s]=_(!1);return Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs(x,{component:M,sx:{flexBasis:"100%",flexGrow:1,flexShrink:1,display:"flex",alignItems:"center",px:20,py:8,borderRadius:12,borderWidth:1,borderStyle:"solid",borderColor:e?r.palette.border.main:r.palette.primary.main,color:e?r.palette.text.primary:r.palette.primary.contrastText,backgroundColor:e?"transparent":r.palette.primary.main,"&:hover":{borderColor:e?r.palette.border.main:r.palette.primary.main},[r.breakpoints.up("tablet")]:{flexBasis:"50%"}},onClick:()=>{s(!0)},children:[e?Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:8},children:[Gt.jsx(Ms,{address:e.address,marginRight:0,width:24,height:24,chainId:e.chainId||a,noShowChain:!0,sx:{flexShrink:0}}),Gt.jsx(x,{sx:{typography:"h5",fontWeight:600,lineHeight:"32px",flexShrink:0},children:e.symbol})]}):Gt.jsx(x,{sx:{typography:"h5",fontWeight:600,lineHeight:"32px",flexShrink:0},children:i._({id:"0RrIzN",message:"Select token"})}),Gt.jsx(x,{component:Yp,sx:{flexShrink:0,ml:"auto",width:18,height:18}})]}),Gt.jsx(Bc,{value:e,open:l,chainId:a,occupiedAddrs:[t],occupiedChainId:null==e?void 0:e.chainId,onClose:()=>{s(!1)},onTokenChange:(e,t)=>{if(!Array.isArray(e)){if(t)return n({type:Lu.UpdateMint1AndClearMint2,payload:e}),void s(!1);o(e),s(!1)}},modal:!0})]})}const Xp=({mint1:e,mint2:t,dispatch:n})=>{var i,o;const r=y();return Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:12,flexWrap:"wrap",[r.breakpoints.up("tablet")]:{flexWrap:"nowrap"}},children:[Gt.jsx(zp,{token:e,oppositeTokenAddress:null!==(i=null==t?void 0:t.address)&&void 0!==i?i:"",dispatch:n,tokenSelectOnChange:e=>{n({type:Lu.UpdateMint1,payload:e})}}),Gt.jsx(zp,{token:t,oppositeTokenAddress:null!==(o=null==e?void 0:e.address)&&void 0!==o?o:"",dispatch:n,tokenSelectOnChange:e=>{n({type:Lu.UpdateMint2,payload:e})}})]})};function qp({mint:e,chainId:t,symbol:n}){const{fetchTokenInfo:i}=ya();return we({queryKey:["token","info",t,e],queryFn:()=>Vr(this,void 0,void 0,(function*(){return yield i({mint:e,chainId:t,symbol:n})})),enabled:!!e}).data}function Gp(e,t){Lt(Number.isInteger(e)&&Number.isInteger(t),"INTEGERS"),Lt(t>0,"TICK_SPACING"),Lt(e>=Ge&&e<=_e,"TICK_BOUND");const n=Math.round(e/t)*t;return n<Ge?n+t:n>_e?n-t:n}function _p({price:e,feeAmount:t,mintDecimalsA:n,mintDecimalsB:i,baseIn:o}){const r=new jt(e.toString()),a=o?r:new jt(1).div(r),l=Je.getTickWithPriceAndTickspacing(a,Vu[t],n,i),s=Xe.getSqrtPriceX64FromTick(l),d=Xe.sqrtPriceX64ToPrice(s,n,i);return o?{tick:l,price:d}:{tick:l,price:new jt(1).div(d)}}const Jp=[o.MAINNET,o.ARBITRUM_ONE,o.SEPOLIA,o.TAIKO],Qp={v3CoreFactoryAddress:"0x3d2A7Bac4E8439ABe86B58324695e921a5FC0987",nonfungiblePositionManagerAddress:"0x483E5c0f309577f79b0a19cE65E332DD388aD7A8"},Kp=Object.assign({},Qp),$p=Object.assign({},Qp),eh={v3CoreFactoryAddress:"0x3d2A7Bac4E8439ABe86B58324695e921a5FC0987",nonfungiblePositionManagerAddress:"0x483E5c0f309577f79b0a19cE65E332DD388aD7A8"},th={[o.MAINNET]:Kp,[o.ARBITRUM_ONE]:$p,[o.SEPOLIA]:eh,[o.TAIKO]:eh};var nh,ih;Object.assign({},Jp.reduce(((e,t)=>(e[t]=th[t].v3CoreFactoryAddress,e)),{})),Object.assign({},Jp.reduce(((e,t)=>{const n=th[t].nonfungiblePositionManagerAddress;return n&&(e[t]=n),e}),{})),function(e){e[e.EXACT_INPUT=0]="EXACT_INPUT",e[e.EXACT_OUTPUT=1]="EXACT_OUTPUT"}(nh||(nh={})),function(e){e[e.ROUND_DOWN=0]="ROUND_DOWN",e[e.ROUND_HALF_UP=1]="ROUND_HALF_UP",e[e.ROUND_UP=2]="ROUND_UP"}(ih||(ih={})),Ot.BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const oh={[ih.ROUND_DOWN]:oe.ROUND_DOWN,[ih.ROUND_HALF_UP]:oe.ROUND_HALF_UP,[ih.ROUND_UP]:oe.ROUND_UP},rh={[ih.ROUND_DOWN]:oe.ROUND_DOWN,[ih.ROUND_HALF_UP]:oe.ROUND_HALF_UP,[ih.ROUND_UP]:oe.ROUND_UP};class ah{constructor(e,t=Ot.BigInt(1)){this.numerator=Ot.BigInt(e),this.denominator=Ot.BigInt(t)}static tryParseFraction(e){if(e instanceof Ot||"number"==typeof e||"string"==typeof e)return new ah(e);if("numerator"in e&&"denominator"in e)return e;throw new Error("Could not parse fraction")}get quotient(){return Ot.divide(this.numerator,this.denominator)}get remainder(){return new ah(Ot.remainder(this.numerator,this.denominator),this.denominator)}invert(){return new ah(this.denominator,this.numerator)}add(e){const t=ah.tryParseFraction(e);return Ot.equal(this.denominator,t.denominator)?new ah(Ot.add(this.numerator,t.numerator),this.denominator):new ah(Ot.add(Ot.multiply(this.numerator,t.denominator),Ot.multiply(t.numerator,this.denominator)),Ot.multiply(this.denominator,t.denominator))}subtract(e){const t=ah.tryParseFraction(e);return Ot.equal(this.denominator,t.denominator)?new ah(Ot.subtract(this.numerator,t.numerator),this.denominator):new ah(Ot.subtract(Ot.multiply(this.numerator,t.denominator),Ot.multiply(t.numerator,this.denominator)),Ot.multiply(this.denominator,t.denominator))}lessThan(e){const t=ah.tryParseFraction(e);return Ot.lessThan(Ot.multiply(this.numerator,t.denominator),Ot.multiply(t.numerator,this.denominator))}equalTo(e){const t=ah.tryParseFraction(e);return Ot.equal(Ot.multiply(this.numerator,t.denominator),Ot.multiply(t.numerator,this.denominator))}greaterThan(e){const t=ah.tryParseFraction(e);return Ot.greaterThan(Ot.multiply(this.numerator,t.denominator),Ot.multiply(t.numerator,this.denominator))}multiply(e){const t=ah.tryParseFraction(e);return new ah(Ot.multiply(this.numerator,t.numerator),Ot.multiply(this.denominator,t.denominator))}divide(e){const t=ah.tryParseFraction(e);return new ah(Ot.multiply(this.numerator,t.denominator),Ot.multiply(this.denominator,t.numerator))}toSignificant(e,t={decimalSeparator:".",groupSeparator:"",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:"",fractionGroupSize:0},n=ih.ROUND_HALF_UP){Lt(Number.isInteger(e),`${e} is not an integer.`),Lt(e>0,`${e} is not positive.`);const i=oh[n],o=new oe(this.numerator.toString()).div(this.denominator.toString()).precision(e,i);return o.toFormat(o.decimalPlaces(),i,t)}toFixed(e,t={decimalSeparator:".",groupSeparator:"",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:"",fractionGroupSize:0},n=ih.ROUND_HALF_UP){Lt(Number.isInteger(e),`${e} is not an integer.`),Lt(e>=0,`${e} is negative.`);const i=rh[n];return new oe(this.numerator.toString()).decimalPlaces(e,i).div(this.denominator.toString()).toFormat(e,i,t)}get asFraction(){return new ah(this.numerator,this.denominator)}}const lh=new ah(Ot.BigInt(100));function sh(e){return new dh(e.numerator,e.denominator)}class dh extends ah{constructor(){super(...arguments),this.isPercent=!0}add(e){return sh(super.add(e))}subtract(e){return sh(super.subtract(e))}multiply(e){return sh(super.multiply(e))}divide(e){return sh(super.divide(e))}toSignificant(e=5,t,n){return super.multiply(lh).toSignificant(e,t,n)}toFixed(e=2,t,n){return super.multiply(lh).toFixed(e,t,n)}}function ch(e){const t=new oe(e);if(t.isFinite())return t}Ot.BigInt(Number.MAX_SAFE_INTEGER),Ot.BigInt(0),Ot.BigInt(1),Ot.BigInt(2),Ot.BigInt(0);new dh(Ot.BigInt(1),1e4),new dh(1,100),new dh(3,100),new dh(5,100),new dh(10,100),new dh(15,100);const uh=new dh(0);function ph({mint:e}){const{fetchTokenBalance:t}=ya();return we({queryKey:["token","balance",null==e?void 0:e.toString()],queryFn:()=>Vr(this,void 0,void 0,(function*(){if(!e)return;return(yield t(e.toString())).amount})),enabled:!!e}).data}function hh({state:e,existingPosition:t,slipperValue:n}){const{account:o,chainId:r}=Br(),a=Fs(),{feeAmount:l,selectedMintIndex:s,independentField:d,typedValue:c,leftRangeTypedValue:u,rightRangeTypedValue:p,startPriceTypedValue:h}=e,{mint1:m,mint2:f}=e,[g,x]=K((()=>m&&f?new vt(new Te(m.address).toBuffer()).gt(new vt(new Te(f.address).toBuffer()))?[f,m]:[m,f]:[void 0,void 0]),[m,f]),y=d===Zu.DEPOSIT_1?Zu.DEPOSIT_2:Zu.DEPOSIT_1,[v,b]=K((()=>g&&x?0==s?[g,x]:[x,g]:[void 0,void 0]),[g,x,s]),j=ph({mint:null==v?void 0:v.address}),w=ph({mint:null==b?void 0:b.address}),C=K((()=>({[Zu.DEPOSIT_1]:j,[Zu.DEPOSIT_2]:w})),[j,w]),[k,R,S]=yp(null==m?void 0:m.address,null==f?void 0:f.address,l,r),I=k===gp.NOT_EXISTS,E=K((()=>{if(!x)return;if(I){const e=ch(h);if(!e)return;return 0===s?e:new oe(1).div(e).dp(x.decimals,oe.ROUND_UP)}if(!R||null==R.poolInfo.price)return;return new oe(R.poolInfo.price)}),[x,I,R,h,s]),M=K((()=>{if(!E||null==(null==g?void 0:g.decimals)||null==(null==x?void 0:x.decimals))return!0;const e=Xe.priceToSqrtPriceX64(new jt(E.toString()),null==g?void 0:g.decimals,null==x?void 0:x.decimals);return!(e&&!e.gt(Qe)&&!e.lt(Ke))}),[E,g,x]),T=K((()=>{if(g&&x){if(R){return Object.assign(Object.assign({},R.poolInfo),{mintA:Object.assign(Object.assign({},R.poolInfo.mintA),{chainId:g.chainId,symbol:g.symbol}),mintB:Object.assign(Object.assign({},R.poolInfo.mintB),{chainId:x.chainId,symbol:x.symbol}),tickCurrent:R.computePoolInfo.tickCurrent})}if(l&&E&&!M&&S){const e=xa[r];if(!e)throw new Error("Invalid config");const t=e.config.find((e=>e.tradeFeeRate===l));if(!t)throw new Error("Invalid fee");const{tick:n}=_p({mintDecimalsA:g.decimals,mintDecimalsB:x.decimals,feeAmount:l,price:E,baseIn:0===s});if(null==n)throw new Error("Invalid tick");return{type:"Concentrated",config:t,programId:e.programId.toBase58(),id:S,mintA:Object.assign(Object.assign({},$e({address:g.address,decimals:g.decimals,programId:Ee.toBase58(),extensions:{feeConfig:void 0}})),{chainId:g.chainId,symbol:g.symbol}),mintB:Object.assign(Object.assign({},$e({address:x.address,decimals:x.decimals,programId:Ee.toBase58(),extensions:{feeConfig:void 0}})),{chainId:x.chainId,symbol:x.symbol}),rewardDefaultInfos:[],rewardDefaultPoolInfos:"Clmm",price:E.toNumber(),tickCurrent:n,mintAmountA:0,mintAmountB:0,feeRate:t.tradeFeeRate,openTime:"",tvl:0,day:{volume:0,volumeQuote:0,volumeFee:0,feeApr:0,rewardApr:[0],apr:0,priceMax:0,priceMin:0},week:{volume:0,volumeQuote:0,volumeFee:0,feeApr:0,rewardApr:[0],apr:0,priceMax:0,priceMin:0},month:{volume:0,volumeQuote:0,volumeFee:0,feeApr:0,rewardApr:[0],apr:0,priceMax:0,priceMin:0},pooltype:[],farmUpcomingCount:0,farmOngoingCount:0,farmFinishedCount:0,burnPercent:0}}}}),[r,l,M,g,x,R,S,E,s]),L=K((()=>({[Pu.LOWER]:l?Gp(Ge,Vu[l]):void 0,[Pu.UPPER]:l?Gp(_e,Vu[l]):void 0})),[l]),O=K((()=>{if(t&&t.tickLower&&"number"==typeof(null==t?void 0:t.tickLower)&&t.tickUpper&&"number"==typeof(null==t?void 0:t.tickUpper))return{[Pu.LOWER]:t.tickLower,[Pu.UPPER]:t.tickUpper};if(!g||!x||!l)return{[Pu.LOWER]:void 0,[Pu.UPPER]:void 0};const e="boolean"==typeof u?void 0:ch(u),n="boolean"==typeof p?void 0:ch(p),i=0===s;return{[Pu.LOWER]:"boolean"==typeof u?L[Pu.LOWER]:e?_p({mintDecimalsA:g.decimals,mintDecimalsB:x.decimals,feeAmount:l,price:e,baseIn:i}).tick:void 0,[Pu.UPPER]:"boolean"==typeof p?L[Pu.UPPER]:n?_p({mintDecimalsA:g.decimals,mintDecimalsB:x.decimals,feeAmount:l,price:n,baseIn:i}).tick:void 0}}),[t,l,u,g,x,p,s,L]),{[Pu.LOWER]:W,[Pu.UPPER]:V}=O,A=K((()=>({[Pu.LOWER]:l&&W===L.LOWER,[Pu.UPPER]:l&&V===L.UPPER})),[L,W,V,l]),F=Boolean("number"==typeof W&&"number"==typeof V&&W>=V),Z=K((()=>({[Pu.LOWER]:fp({tick:L.LOWER,decimalsA:null==g?void 0:g.decimals,decimalsB:null==x?void 0:x.decimals}),[Pu.UPPER]:fp({tick:L.UPPER,decimalsA:null==g?void 0:g.decimals,decimalsB:null==x?void 0:x.decimals})})),[null==g?void 0:g.decimals,null==x?void 0:x.decimals,L.LOWER,L.UPPER]),P=K((()=>({[Pu.LOWER]:fp({tick:O[Pu.LOWER],decimalsA:null==g?void 0:g.decimals,decimalsB:null==x?void 0:x.decimals}),[Pu.UPPER]:fp({tick:O[Pu.UPPER],decimalsA:null==g?void 0:g.decimals,decimalsB:null==x?void 0:x.decimals})})),[null==g?void 0:g.decimals,null==x?void 0:x.decimals,O]),{[Pu.LOWER]:B,[Pu.UPPER]:N}=P,U=Boolean(!F&&E&&B&&N&&(E.lt(B)||E.gt(N))),H=K((()=>ch(c)),[c]),[D,Y]=_(void 0);J((()=>{let e=!0;return function(){Vr(this,void 0,void 0,(function*(){try{if(!a||!T||null==W||null==V)return;const t=yield a.fetchEpochInfo(),i=yield et.getLiquidityAmountOutFromAmountIn({poolInfo:T,slippage:n,inputA:!0,tickLower:Math.min(W,V),tickUpper:Math.max(W,V),amount:new vt(new jt(c||"0").mul(10**T.mintA.decimals).toFixed(0)),add:!0,amountHasFee:!0,epochInfo:t});if(e){if(!i.amountSlippageB.amount)return;Y(new oe(i.amountSlippageB.amount.toString()).div(new oe(10**T.mintB.decimals)).dp(T.mintB.decimals,oe.ROUND_UP))}}catch(e){console.error("error",e)}}))}(),()=>{e=!1}}),[T,a,n,W,V,c]);const z=K((()=>({[Zu.DEPOSIT_1]:d===Zu.DEPOSIT_1?H:D,[Zu.DEPOSIT_2]:d===Zu.DEPOSIT_1?D:H})),[D,H,d]),X=Boolean("number"==typeof V&&(null==T?void 0:T.tickCurrent)&&T.tickCurrent>=V),q=Boolean("number"==typeof W&&(null==T?void 0:T.tickCurrent)&&T.tickCurrent<=W),G=F||Boolean(X&&T&&m&&new Te(T.mintA.address).equals(new Te(m.address))||q&&T&&f&&new Te(T.mintA.address).equals(new Te(f.address))),Q=F||Boolean(X&&T&&f&&new Te(T.mintA.address).equals(new Te(f.address))||q&&T&&m&&new Te(T.mintB.address).equals(new Te(m.address))),{inputTax:$,outputTax:ee}=function(){const[{inputTax:e,outputTax:t},n]=_({inputTax:uh,outputTax:uh});return{inputTax:e,outputTax:t}}(),[te,ne]=_();let ie;J((()=>{let e=!0;return function(){Vr(this,void 0,void 0,(function*(){try{if(!a||!T||null==W||null==V)return;const t=yield a.fetchEpochInfo(),i=yield et.getLiquidityAmountOutFromAmountIn({poolInfo:T,slippage:n,inputA:!0,tickLower:Math.min(W,V),tickUpper:Math.max(W,V),amount:new vt(new jt(c||"0").mul(10**T.mintA.decimals).toFixed(0)),add:!0,amountHasFee:!0,epochInfo:t});e&&ne({poolInfo:T,tickLower:W,tickUpper:V,tickLowerPrice:B,tickUpperPrice:N,liquidity:new oe(i.liquidity.toString()),amountA:new oe(i.amountSlippageA.amount.toString()).div(new oe(10**T.mintA.decimals)).dp(T.mintA.decimals,oe.ROUND_UP),amountB:new oe(i.amountSlippageB.amount.toString()).div(new oe(10**T.mintB.decimals)).dp(T.mintB.decimals,oe.ROUND_UP)})}catch(e){console.error("error",e)}}))}(),()=>{e=!1}}),[B,T,P,a,n,W,V,c,N]),o||(ie=i._({id:"r7ScnQ",message:"Connect to a wallet"})),k!==gp.INVALID&&(null==T?void 0:T.mintA.address)!==(null==T?void 0:T.mintB.address)||(ie=null!=ie?ie:i._({id:"R7D79P",message:"Invalid pair"})),M&&(ie=null!=ie?ie:i._({id:"HXBqgG",message:"Invalid price input"})),(z[Zu.DEPOSIT_1]||G)&&(z[Zu.DEPOSIT_2]||Q)||(ie=null!=ie?ie:i._({id:"iPMIoT",message:"Enter an amount"}));const{[Zu.DEPOSIT_1]:re,[Zu.DEPOSIT_2]:ae}=z;re&&(null==j?void 0:j.lt(re))&&(ie=i._({id:"m6RmA/",message:"Insufficient {0} balance",values:{0:null==v?void 0:v.symbol}})),ae&&(null==w?void 0:w.lt(ae))&&(ie=i._({id:"m6RmA/",message:"Insufficient {0} balance",values:{0:null==b?void 0:b.symbol}}));const le=$.greaterThan(0)||ee.greaterThan(0),se=k===gp.INVALID||le;return{mintA:g,mintB:x,dependentField:y,mints:{[Zu.DEPOSIT_1]:v,[Zu.DEPOSIT_2]:b},poolInfo:T,poolState:k,depositBalances:C,parsedAmounts:z,ticks:O,price:E,pricesAtTicks:P,pricesAtLimit:Z,position:te,poolIsNoExisted:I,errorMessage:ie,invalidPool:se,invalidRange:F,outOfRange:U,depositADisabled:G,depositBDisabled:Q,ticksAtLimit:A,isTaxed:le,poolKeys:I||null==R?void 0:R.poolKeys}}function mh({dispatch:e}){return{onField1Input:Q((t=>{e({type:Lu.typeInput,payload:{field:Zu.DEPOSIT_1,typedValue:t}})}),[e]),onField2Input:Q((t=>{e({type:Lu.typeInput,payload:{field:Zu.DEPOSIT_2,typedValue:t}})}),[e]),onLeftRangeInput:Q((t=>{e({type:Lu.typeLeftRangeInput,payload:{typedValue:t}})}),[e]),onRightRangeInput:Q((t=>{e({type:Lu.typeRightRangeInput,payload:{typedValue:t}})}),[e]),onStartPriceInput:Q((t=>{e({type:Lu.typeStartPriceInput,payload:{typedValue:t}})}),[e])}}new dh(1);const fh=new oe(.01);function gh(e){if(e)return e.gt(fh)?e.minus(fh):new oe(0)}const xh=Buffer.from("support_mint","utf8");function yh(e,t){return ot([xh,t.toBuffer()],e)}function vh({params:e,handleGoBack:t,handleGoToPoolList:n}){var o,r,a,l,s,d;const{chainId:c,account:p}=Br(),h=Fs(),m=y(),f=Sa(),{isMobile:g}=Ec(),v=qp({mint:null==e?void 0:e.mint1,chainId:c}),j=qp({mint:null==e?void 0:e.mint2,chainId:c}),[w,C]=ie(Wu,{mint1:v,mint2:j,feeAmount:(null==e?void 0:e.fee)?Number(null==e?void 0:e.fee):void 0,selectedMintIndex:0,independentField:Zu.DEPOSIT_1,typedValue:"",startPriceTypedValue:"1",leftRangeTypedValue:"",rightRangeTypedValue:""});J((()=>{v&&C({type:Lu.UpdateDefaultMint1,payload:v})}),[v]),J((()=>{j&&C({type:Lu.UpdateDefaultMint2,payload:j})}),[j]);const{independentField:k,typedValue:R,startPriceTypedValue:S}=w,{slipper:I,setSlipper:E,slipperValue:T,resetSlipper:O}=Ru({type:u}),{mintA:W,mintB:V,poolInfo:A,poolKeys:F,ticks:Z,dependentField:P,price:B,pricesAtTicks:N,pricesAtLimit:U,parsedAmounts:H,depositBalances:D,position:Y,poolIsNoExisted:z,mints:X,errorMessage:q,invalidPool:G,invalidRange:K,outOfRange:$,depositADisabled:ee,depositBDisabled:te,ticksAtLimit:ne}=hh({state:w,slipperValue:T,existingPosition:void 0}),{onField1Input:re,onField2Input:ae,onLeftRangeInput:le,onRightRangeInput:se,onStartPriceInput:de}=mh({dispatch:C}),ce=!q&&!K,[ue,pe]=_(!1),he={[k]:R,[P]:null!==(r=null===(o=H[P])||void 0===o?void 0:o.toString())&&void 0!==r?r:""},me=[Zu.DEPOSIT_1,Zu.DEPOSIT_2].reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:gh(D[t])})),{}),{[Pu.LOWER]:fe,[Pu.UPPER]:ge}=Z,{[Pu.LOWER]:xe,[Pu.UPPER]:ye}=N,{getDecrementLower:ve,getIncrementLower:be,getDecrementUpper:je,getIncrementUpper:we,getSetFullRange:ke}=function({tickLower:e,tickUpper:t,poolInfo:n,state:i,dispatch:o}){var r,a;const{feeAmount:l}=i,s=null===(r=null==n?void 0:n.mintA)||void 0===r?void 0:r.decimals,d=null===(a=null==n?void 0:n.mintB)||void 0===a?void 0:a.decimals;return{getDecrementLower:Q((()=>{if(!l)return"";const t="number"==typeof e?e:null==n?void 0:n.tickCurrent;if(!t)return"";const i=fp({decimalsA:s,decimalsB:d,tick:t-Vu[l]});return i?i.dp(5,oe.ROUND_UP).toString():""}),[s,d,l,null==n?void 0:n.tickCurrent,e]),getIncrementLower:Q((()=>{if(!l)return"";const t="number"==typeof e?e:null==n?void 0:n.tickCurrent;if(!t)return"";const i=fp({decimalsA:s,decimalsB:d,tick:t+Vu[l]});return i?i.dp(5,oe.ROUND_UP).toString():""}),[s,d,l,null==n?void 0:n.tickCurrent,e]),getDecrementUpper:Q((()=>{if(!l)return"";const e="number"==typeof t?t:null==n?void 0:n.tickCurrent;if(!e)return"";const i=fp({decimalsA:s,decimalsB:d,tick:e-Vu[l]});return i?i.dp(5,oe.ROUND_UP).toString():""}),[s,d,l,null==n?void 0:n.tickCurrent,t]),getIncrementUpper:Q((()=>{if(!l)return"";const e="number"==typeof t?t:null==n?void 0:n.tickCurrent;if(!e)return"";const i=fp({decimalsA:s,decimalsB:d,tick:e+Vu[l]});return i?i.dp(5,oe.ROUND_UP).toString():""}),[s,d,l,null==n?void 0:n.tickCurrent,t]),getSetFullRange:Q((()=>{o({type:Lu.setFullRange,payload:void 0})}),[o])}}({tickLower:fe,tickUpper:ge,poolInfo:A,state:w,dispatch:C}),Re=Q((()=>{ke()}),[ke,le,se,U]),Se=Ce({mutationFn:()=>Vr(this,void 0,void 0,(function*(){if(!p||!c)return;if(!A)throw new Error("poolInfo is undefined");if(!B)throw new Error("price is undefined");if(!h)throw new Error("raydium is undefined");const e=xa[c];if(!e)throw new Error("Invalid config");const n=h.clmm;h.clmm.scope.checkOwner();const o=new rt({connection:n.scope.connection,feePayer:n.scope.ownerPubKey,cluster:n.scope.cluster,owner:n.scope.owner,blockhashCommitment:n.scope.blockhashCommitment,loopMultiTxStatus:n.scope.loopMultiTxStatus,api:n.scope.api,signAllTransactions:n.scope.signAllTransactions}),r=z?yield function(e){return Vr(this,void 0,void 0,(function*(){var t;const{programId:n,mint1:i,mint2:o,ammConfig:r,initialPrice:a,computeBudgetConfig:l,forerunCreate:s,getObserveState:d,txVersion:c,txTipConfig:u,feePayer:p,clmm:h,txBuilder:m}=e,f=(null===(t=h.scope.owner)||void 0===t?void 0:t.publicKey)||Te.default,[g,x,y]=new vt(new Te(i.address).toBuffer()).gt(new vt(new Te(o.address).toBuffer()))?[o,i,new jt(1).div(a)]:[i,o,a],v=Xe.priceToSqrtPriceX64(y,g.decimals,x.decimals),b=[],j=[];g.programId===Me.toBase58()&&j.push(yh(n,new Te(g.address)).publicKey),x.programId===Me.toBase58()&&j.push(yh(n,new Te(x.address)).publicKey),(yield h.scope.connection.getMultipleAccountsInfo(j)).forEach(((e,t)=>{e&&b.push(j[t])}));const w=yield tt.createPoolInstructions({connection:h.scope.connection,programId:n,owner:f,mintA:g,mintB:x,ammConfigId:r.id,initialPriceX64:v,forerunCreate:!d&&s,extendMintAccount:b});return m.addInstruction(w),{address:Object.assign(Object.assign({},w.address),{observationId:w.address.observationId.toBase58(),exBitmapAccount:w.address.exBitmapAccount.toBase58(),programId:n.toString(),id:w.address.poolId.toString(),mintA:g,mintB:x,openTime:"0",vault:{A:w.address.mintAVault.toString(),B:w.address.mintBVault.toString()},rewardInfos:[],config:{id:r.id.toString(),index:r.index,protocolFeeRate:r.protocolFeeRate,tradeFeeRate:r.tradeFeeRate,tickSpacing:r.tickSpacing,fundFeeRate:r.fundFeeRate,description:r.description,defaultRange:0,defaultRangePoint:[]}}),mockPoolInfo:Object.assign({type:"Concentrated",rewardDefaultPoolInfos:"Clmm",id:w.address.poolId.toString(),mintA:g,mintB:x,feeRate:r.tradeFeeRate,openTime:"0",programId:n.toString(),price:y.toNumber(),config:{id:r.id.toString(),index:r.index,protocolFeeRate:r.protocolFeeRate,tradeFeeRate:r.tradeFeeRate,tickSpacing:r.tickSpacing,fundFeeRate:r.fundFeeRate,description:r.description,defaultRange:0,defaultRangePoint:[]},burnPercent:0},nt),forerunCreate:s}}))}({programId:e.programId,mint1:A.mintA,mint2:A.mintB,ammConfig:Object.assign(Object.assign({},A.config),{id:new Te(A.config.id),fundOwner:"",description:""}),initialPrice:new jt(B.toString()),clmm:n,txBuilder:o}):void 0;if(!Y)throw new Error("position is undefined");const a=yield function(e){return Vr(this,arguments,void 0,(function*({poolInfo:e,poolKeys:t,ownerInfo:n,tickLower:i,tickUpper:o,base:r,baseAmount:a,otherAmountMax:l,nft2022:s,associatedOnly:d=!0,checkCreateATAOwner:c=!1,withMetadata:u="create",getEphemeralSigners:p,computeBudgetConfig:h,txTipConfig:m,txVersion:f,feePayer:g,clmm:x,txBuilder:y}){!1===x.scope.availability.addConcentratedPosition&&x.logAndCreateError("add position feature disabled in your region");let v=null,b=null;const j=n.useSOLBalance&&e.mintA.address===it.toString(),w=n.useSOLBalance&&e.mintB.address===it.toString(),[C,k]="MintA"===r?[a,l]:[l,a],{account:R,instructionParams:S}=yield x.scope.account.getOrCreateTokenAccount({tokenProgram:e.mintA.programId,mint:new Te(e.mintA.address),owner:x.scope.ownerPubKey,createInfo:j||C.isZero()?{payer:x.scope.ownerPubKey,amount:C}:void 0,skipCloseAccount:!j,notUseTokenAccount:j,associatedOnly:!j&&d,checkCreateATAOwner:c});R&&(v=R),y.addInstruction(S||{});const{account:I,instructionParams:E}=yield x.scope.account.getOrCreateTokenAccount({tokenProgram:e.mintB.programId,mint:new Te(e.mintB.address),owner:x.scope.ownerPubKey,createInfo:w||k.isZero()?{payer:x.scope.ownerPubKey,amount:k}:void 0,skipCloseAccount:!w,notUseTokenAccount:w,associatedOnly:!w&&d,checkCreateATAOwner:c});I&&(b=I),y.addInstruction(E||{}),v&&b||x.logAndCreateError("cannot found target token accounts","tokenAccounts",{ownerTokenAccountA:null==v?void 0:v.toBase58(),ownerTokenAccountB:null==b?void 0:b.toBase58()});const M=t||(yield x.getClmmPoolKeys(e.id)),T=yield tt.openPositionFromBaseInstructions({poolInfo:e,poolKeys:M,ownerInfo:Object.assign(Object.assign({},n),{feePayer:x.scope.ownerPubKey,wallet:x.scope.ownerPubKey,tokenAccountA:v,tokenAccountB:b}),tickLower:i,tickUpper:o,base:r,baseAmount:a,otherAmountMax:l,withMetadata:u,getEphemeralSigners:p,nft2022:s});return y.addInstruction(T),Object.assign({},T.address)}))}({poolInfo:A,poolKeys:null!=F?F:null==r?void 0:r.address,tickUpper:Math.max(Y.tickLower,Y.tickUpper),tickLower:Math.min(Y.tickLower,Y.tickUpper),base:"MintA",ownerInfo:{useSOLBalance:!0},baseAmount:new vt(new jt(R||"0").mul(10**A.mintA.decimals).toFixed(0)),otherAmountMax:new vt(Y.amountB.multipliedBy(new oe(10**A.mintB.decimals)).toFixed(0)),clmm:n,txBuilder:o});o.addCustomComputeBudget({units:6e5,microLamports:1e3});const{transaction:l,signers:s}=yield o.versionBuild({txVersion:He.LEGACY,extInfo:a});const d=yield f.executeCustom({brief:z?i._({id:"8OiU8L",message:"Pool Creation"}):i._({id:"OBdohg",message:"Add Liquidity"}),metadata:{[z?Ur.createAMMV3Pool:Ur.addAMMV3Pool]:!0},handler:e=>Vr(this,void 0,void 0,(function*(){const{txId:t}=yield function(){return Vr(this,void 0,void 0,(function*(){var e,t,i;if(!h)throw new Error("raydium is undefined");const o=yield at(h.connection,h.blockhashCommitment);l.recentBlockhash=o,s.length&&l.sign(...s),lt([l]);const r=yield null===(t=(e=n.scope).signAllTransactions)||void 0===t?void 0:t.call(e,[l]);if(s.length)for(const e of r);const a=null===(i=null==r?void 0:r[0])||void 0===i?void 0:i.serialize();if(!a)throw new Error("rawTransaction is undefined");return{txId:yield n.scope.connection.sendRawTransaction(a,{skipPreflight:!0}),signedTx:null==r?void 0:r[0]}}))}();e.onSuccess(t)})),successBack:()=>{t()},submittedBack:()=>{t()}});return d})),onError:e=>{console.error(e)}}),Ie=W&&V?0===w.selectedMintIndex?`${null==V?void 0:V.symbol} per ${null==W?void 0:W.symbol}`:`${null==W?void 0:W.symbol} per ${null==V?void 0:V.symbol}`:"-";return Gt.jsx(_c,{children:Gt.jsxs(x,{sx:{mx:"auto",borderRadius:g?0:16,backgroundColor:"background.paper",width:g?"100%":600,display:"flex",flexDirection:"column",alignItems:"stretch"},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",px:20,py:24,borderTopLeftRadius:16,borderTopRightRadius:16,backgroundColor:m.palette.background.paper},children:[Gt.jsx(x,{component:M,onClick:t,sx:{flexGrow:0,flexShrink:0,display:"flex",alignItems:"center",color:m.palette.text.primary,width:24,height:24},children:Gt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",children:Gt.jsx("path",{d:"M20 11.5H7.83L13.42 5.91L12 4.5L4 12.5L12 20.5L13.41 19.09L7.83 13.5H20V11.5Z",fill:"currentColor"})})}),Gt.jsx(x,{sx:{flexGrow:1,textAlign:"center",typography:"caption",color:m.palette.text.primary},children:i._({id:"E6MqGy",message:"Add liquidity"})}),Gt.jsx(x,{sx:{flexGrow:0,flexShrink:0,width:24,height:24}})]}),Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column",alignItems:"stretch",gap:20,p:20},children:[Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column",alignItems:"stretch",gap:12},children:[Gt.jsx(x,{sx:{typography:"body1",fontWeight:600,color:m.palette.text.primary,textAlign:"left"},children:i._({id:"nxRg31",message:"Select pair"})}),Gt.jsx(Xp,{mint1:w.mint1,mint2:w.mint2,dispatch:C}),Gt.jsx(Fu,{disabled:!w.mint1||!w.mint2,feeAmount:w.feeAmount,dispatch:C})]}),Gt.jsxs(_u,{disabled:!w.feeAmount||G,children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[Gt.jsx(x,{sx:{typography:"body1",fontWeight:600,color:m.palette.text.primary,textAlign:"left"},children:i._({id:"5CZbyC",message:"Set price range"})}),W&&V&&Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:8,width:"100%",[m.breakpoints.up("tablet")]:{ml:"auto",width:"auto"}},children:[Gt.jsx(b,{size:b.Size.small,variant:b.Variant.outlined,onClick:Re,sx:Object.assign({py:4,px:12,height:26,typography:"h6",fontWeight:600},g?{flexGrow:0,flexShrink:1,flexBasis:"50%"}:void 0),children:i._({id:"5IHTSS",message:"Full range"})}),Gt.jsx(Tp,{mintA:W,mintB:V,selectedMintIndex:w.selectedMintIndex,handleRateToggle:()=>{C({type:Lu.UpdateSelectedMintIndex,payload:0===w.selectedMintIndex?1:0})},sx:g?{flexGrow:0,flexShrink:1,flexBasis:"50%"}:void 0})]})]}),Gt.jsx(Mp,{priceLower:xe,priceUpper:ye,getDecrementLower:ve,getIncrementLower:be,getDecrementUpper:je,getIncrementUpper:we,onLeftRangeInput:le,onRightRangeInput:se,ticksAtLimit:ne,perPriceText:Ie}),$&&Gt.jsx(Du,{children:i._({id:"b+KjnH",message:"Your position will not earn fees or be used in trades until the market price moves into your range."})}),K&&Gt.jsx(Du,{children:i._({id:"Jh223O",message:"Invalid range selected. The min price must be lower than the max price."})})]}),z?Gt.jsxs(_u,{children:[Gt.jsx(x,{sx:{typography:"body1",fontWeight:600,color:m.palette.text.primary,textAlign:"left"},children:i._({id:"zeSosD",message:"Starting price"})}),Gt.jsx(x,{sx:{p:8,borderRadius:8,backgroundColor:L(m.palette.primary.main,.1),typography:"h6",color:m.palette.primary.main},children:i._({id:"X6T02b",message:"This pool must be initialized before you can add liquidity. To initialize, select a starting price for the pool. Then, enter your liquidity price range and deposit amount. Gas fees will be higher than usual due to the initialization transaction."})}),Gt.jsx(x,{sx:{px:16,py:12,borderRadius:8,borderWidth:1,borderColor:m.palette.border.main,borderStyle:"solid"},children:Gt.jsx(Ic,{sx:{backgroundColor:"transparent"},value:S,onChange:de,suffix:Gt.jsx(x,{sx:{typography:"h6",color:m.palette.text.secondary},children:Ie})})})]}):Gt.jsxs(_u,{disabled:!w.feeAmount||G,children:[Gt.jsxs(x,{sx:{typography:"body1",fontWeight:600,color:m.palette.text.primary,textAlign:"left"},children:[i._({id:"DWd30U",message:"Current price"}),Gt.jsxs(x,{children:[Kr({input:B,decimals:9})," ",i._({id:"b2jAb+",message:"per"})," ",null!==(l=null===(a=w.mint1)||void 0===a?void 0:a.symbol)&&void 0!==l?l:""]})]}),Gt.jsx(Ip,{mint1:w.mint1,mint2:w.mint2,feeAmount:w.feeAmount,ticksAtLimit:ne,price:B?B.toNumber():void 0,priceLower:xe,priceUpper:ye,onLeftRangeInput:le,onRightRangeInput:se,interactive:!0})]}),Gt.jsxs(_u,{disabled:G||K||z&&!S,children:[Gt.jsx(x,{sx:{typography:"body1",fontWeight:600,color:m.palette.text.primary,textAlign:"left"},children:i._({id:"MU9s7M",message:"Deposit amounts"})}),Gt.jsxs(x,{children:[Gt.jsx(Tu,{value:he[Zu.DEPOSIT_1],onUserInput:re,maxAmount:me[Zu.DEPOSIT_1],balance:D[Zu.DEPOSIT_1],mint:null!==(s=X[Zu.DEPOSIT_1])&&void 0!==s?s:null,locked:ee}),Gt.jsx(Nc,{}),Gt.jsx(Tu,{value:he[Zu.DEPOSIT_2],onUserInput:ae,maxAmount:me[Zu.DEPOSIT_2],balance:D[Zu.DEPOSIT_2],mint:null!==(d=X[Zu.DEPOSIT_2])&&void 0!==d?d:null,locked:te})]}),Gt.jsx(Su,{value:I,onChange:E,disabled:!1,type:u})]})]}),Gt.jsx(x,{sx:{display:"flex",alignItems:"center",px:20,py:16,borderBottomLeftRadius:16,borderBottomRightRadius:16,backgroundColor:m.palette.background.paper},children:Gt.jsx(Iu,{chainId:c,isValid:ce,errorMessage:q,setShowConfirm:pe})}),Gt.jsx(Up,{position:Y,outOfRange:$,ticksAtLimit:ne,on:ue,onClose:()=>{pe(!1)},onConfirm:Se.mutate,loading:Se.isPending})]})})}function bh({title:e,desc:t,linkTo:i,LeftImage:o,sx:r}){const a=y(),l="light"===a.palette.mode;return Gt.jsxs(x,{sx:Object.assign({backgroundColor:a.palette.background.paper,borderRadius:16,padding:20},r),children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start"},children:[Gt.jsx(x,{sx:{backgroundColor:L(a.palette.secondary.main,.3),color:l?"#EB8D27":a.palette.secondary.main,borderRadius:6,width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center"},children:Gt.jsx("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",children:Gt.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.55558 0.888672C3.87558 0.888672 0.888916 3.87534 0.888916 7.55534C0.888916 11.2353 3.87558 14.222 7.55558 14.222C11.2356 14.222 14.2222 11.2353 14.2222 7.55534C14.2222 3.87534 11.2356 0.888672 7.55558 0.888672ZM8.22225 11.5553V10.222H6.88892V11.5553H8.22225ZM4.88892 6.22201C4.88892 4.74867 6.08225 3.55534 7.55558 3.55534C9.02892 3.55534 10.2222 4.74867 10.2222 6.22201C10.2222 7.07728 9.69557 7.53755 9.18276 7.9857C8.69626 8.41085 8.22225 8.82509 8.22225 9.55534H6.88892C6.88892 8.34116 7.51699 7.85973 8.06921 7.43646C8.50241 7.10441 8.88892 6.80815 8.88892 6.22201C8.88892 5.48867 8.28892 4.88867 7.55558 4.88867C6.82225 4.88867 6.22225 5.48867 6.22225 6.22201H4.88892Z",fill:"currentColor"})})}),Gt.jsx(x,{sx:{color:a.palette.text.primary,typography:"body1",fontWeight:600,ml:4},children:Gt.jsx(n,{id:"cmUrtC",message:"SEE HOW IT WORKS"})})]}),Gt.jsxs(x,{sx:{mt:20,borderTopWidth:1,pt:20,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[Gt.jsx(x,{component:o,sx:{width:64,height:64,flexShrink:0}}),Gt.jsxs(x,{sx:{ml:16,color:a.palette.text.primary,typography:"body1",fontWeight:600},children:[e,Gt.jsx(x,{sx:{mt:4,color:a.palette.text.secondary,typography:"body2",fontWeight:500},children:t})]})]}),Gt.jsx(x,{component:"a",href:i,target:"_blank",rel:"noopener noreferrer",sx:{pl:16,flexShrink:0},children:Gt.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:Gt.jsx("path",{d:"M7.23375 3.75L6 4.98375L10.0075 9L6 13.0162L7.23375 14.25L12.4838 9L7.23375 3.75Z",fill:a.palette.text.primary})})})]})]})}const jh=[{value:0,label:"0%"},{value:25,label:"25%"},{value:50,label:"50%"},{value:75,label:"75%"},{value:100,label:"100%"}];function wh({disabled:e,value:t,onChange:n,sx:i}){return Gt.jsxs(x,{sx:Object.assign({p:20,backgroundColor:"background.input",borderRadius:12},i),children:[Gt.jsx(Ic,{value:String(t),onChange:e=>n(+e),readOnly:!0,readonlyShowSuffix:!0,suffix:Gt.jsx(x,{sx:{typography:"h2"},children:"%"}),sx:{mt:12,"& input":{pl:0,typography:"h1"}}}),Gt.jsx(x,{sx:{mt:20},children:Gt.jsx(N,{marks:jh,step:1,disabled:e,value:t,onChange:(e,t)=>n(t)})})]})}const Ch=50;var kh;!function(e){e[e.quantity=1]="quantity",e[e.percentage=2]="percentage"}(kh||(kh={}));const Rh=({chainId:e,disabled:t,isLoading:n,onConfirm:o})=>Gt.jsx(gc,{includeButton:!0,fullWidth:!0,chainId:e,children:Gt.jsx(b,{fullWidth:!0,size:b.Size.big,onClick:o,disabled:t,isLoading:n,children:i._({id:"h5pjuM",message:"Collect fees"})})}),Sh=({mint:e,pooledAmount:t})=>{var n;const i=y();return Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4},children:[Gt.jsx(Ms,{address:null!==(n=null==e?void 0:e.address)&&void 0!==n?n:"",chainId:null==e?void 0:e.chainId,noShowChain:!0,width:18,height:18,marginRight:0}),Gt.jsxs(x,{sx:{typography:"body1",color:i.palette.text.primary},children:[Kr({input:t,decimals:null==e?void 0:e.decimals})," ",null==e?void 0:e.symbol]}),Gt.jsx(M,{sx:{display:"flex",alignItems:"center",color:i.palette.text.secondary,"&:hover":{color:i.palette.text.primary}},onClick:()=>{e&&window.open(Fc(e.chainId,e.address,"address"))},children:Gt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:Gt.jsx("path",{opacity:"0.5",fillRule:"evenodd",clipRule:"evenodd",d:"M3.33333 3.33333V12.6667H12.6667V8H14V12.6667C14 13.4 13.4 14 12.6667 14H3.33333C2.59333 14 2 13.4 2 12.6667V3.33333C2 2.6 2.59333 2 3.33333 2H8V3.33333H3.33333ZM9.33333 3.33333V2H14V6.66667H12.6667V4.27333L6.11333 10.8267L5.17333 9.88667L11.7267 3.33333H9.33333Z",fill:"currentColor"})})})]})},Ih=({mintA:e,mintB:t,feeAmount:o,existingPosition:r,positionInfo:a,inRange:l,removed:s})=>{const d=y();return Gt.jsxs(x,{sx:{border:"solid 1px",borderColor:"border.main",borderRadius:8},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",p:d.spacing(12,20),borderBottomStyle:"solid",borderBottomColor:"border.main",borderBottomWidth:1},children:[Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:4},children:[Gt.jsxs(x,{sx:{typography:"body2",color:d.palette.text.primary},children:[i._({id:"PVa3KL",message:"Position on"})," ",null==e?void 0:e.symbol,"/",null==t?void 0:t.symbol]}),Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4},children:[Gt.jsx(Zp,{removed:s,inRange:l}),Gt.jsx(x,{sx:{py:4,px:8,color:d.palette.primary.main,borderRadius:4,backgroundColor:L(d.palette.primary.main,.1),typography:"h6"},children:Ap({type:u,lpFeeRate:o,mtFeeRate:0})})]})]}),Gt.jsxs(M,{sx:{display:"flex",alignItems:"center",gap:0,typography:"body2",color:d.palette.text.secondary,"&:hover":{color:d.palette.text.primary}},onClick:()=>{(null==e?void 0:e.chainId)&&window.open(Fc(e.chainId,null==r?void 0:r.poolId.toBase58(),"address"))},children:[i._({id:"URmyfc",message:"Details"}),Gt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"19",viewBox:"0 0 18 19",fill:"none",children:Gt.jsx("path",{d:"M7.5 5L6.4425 6.0575L9.8775 9.5L6.4425 12.9425L7.5 14L12 9.5L7.5 5Z",fill:"currentColor"})})]})]}),Gt.jsxs(x,{sx:{p:d.spacing(12,20)},children:[Gt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:Gt.jsx(n,{id:"YHc3B+",message:"My Liquidity"})}),Gt.jsxs(x,{sx:{mt:12},children:[Gt.jsx(Sh,{mint:e,pooledAmount:null==a?void 0:a.pooledAmountA}),Gt.jsx(Sh,{mint:t,pooledAmount:null==a?void 0:a.pooledAmountB})]})]})]})},Eh=({chainId:e,disabled:t,removed:n,isLoading:o,onConfirm:r})=>Gt.jsx(gc,{includeButton:!0,fullWidth:!0,chainId:e,children:Gt.jsx(b,{fullWidth:!0,size:b.Size.big,onClick:r,disabled:t,isLoading:o,children:n?i._({id:"D87pha",message:"Closed"}):i._({id:"t/YqKh",message:"Remove"})})});function Mh({position:e}){const t=Fs(),[,n]=xp(e?e.poolId.toBase58():null),{data:i}=we({queryKey:["clmm","getPositionInfo",e,null==n?void 0:n.poolInfo],enabled:!!e&&!!(null==n?void 0:n.poolInfo),queryFn:()=>Vr(this,void 0,void 0,(function*(){const i=null==n?void 0:n.poolInfo;if(!i||!t||!e)return null;const o=st.getTickPrice({poolInfo:i,tick:e.tickLower,baseIn:!0}),r=st.getTickPrice({poolInfo:i,tick:e.tickUpper,baseIn:!0}),a=yield t.connection.getEpochInfo(),{amountA:l,amountB:s}=dt.getAmountsFromLiquidity({poolInfo:i,ownerPosition:e,liquidity:e.liquidity,slippage:0,add:!1,epochInfo:a}),[d,c]=[new oe(l.amount.toString()).div(10**i.mintA.decimals),new oe(s.amount.toString()).div(10**i.mintB.decimals)],[u,p]=[st.getTickArrayAddressByTick(new Te(i.programId),new Te(i.id),e.tickLower,i.config.tickSpacing),st.getTickArrayAddressByTick(new Te(i.programId),new Te(i.id),e.tickUpper,i.config.tickSpacing)],h=yield t.connection.getMultipleAccountsInfo([u,p]);if(!h[0]||!h[1])throw new Error("tick data not found");const m=ct.decode(h[0].data),f=ct.decode(h[1].data),g=m.ticks[st.getTickOffsetInArray(e.tickLower,i.config.tickSpacing)],x=f.ticks[st.getTickOffsetInArray(e.tickUpper,i.config.tickSpacing)],y=yield t.clmm.getRpcClmmPoolInfo({poolId:e.poolId}),v=dt.GetPositionFeesV2(y,e,g,x),b=dt.GetPositionRewardsV2(y,e,g,x),[j,w]=[v.tokenFeeAmountA.gte(new vt(0))&&v.tokenFeeAmountA.lt(ut)?v.tokenFeeAmountA:new vt(0),v.tokenFeeAmountB.gte(new vt(0))&&v.tokenFeeAmountB.lt(ut)?v.tokenFeeAmountB:new vt(0)],[C,k]=[{mint:i.mintA,amount:new jt(j.toString()).div(10**i.mintA.decimals).toDecimalPlaces(i.mintA.decimals)},{mint:i.mintB,amount:new jt(w.toString()).div(10**i.mintB.decimals).toDecimalPlaces(i.mintB.decimals)}],R=b.map((e=>e.gte(new vt(0))&&e.lt(ut)?e:new vt(0))),S=R.map(((e,t)=>{var n;const o=null===(n=i.rewardDefaultInfos.find((e=>e.mint.address===y.rewardInfos[t].tokenMint.toBase58())))||void 0===n?void 0:n.mint;if(o)return{mint:o,amount:new jt(e.toString()).div(10**o.decimals).toDecimalPlaces(o.decimals)}})).filter(Boolean),I=S.findIndex((e=>e.mint.address===i.mintA.address));S[I]?S[I].amount=S[I].amount.add(C.amount):S.push(C);const E=S.findIndex((e=>e.mint.address===i.mintB.address));return S[E]?S[E].amount=S[E].amount.add(k.amount):S.push(k),{pooledAmountA:d,pooledAmountB:c,priceLower:new oe(o.price.toString()),priceUpper:new oe(r.price.toString()),rewardInfos:S.map((e=>({mint:e.mint,amount:e.amount.toString()})))}}))});return{pool:n,positionInfo:null!=i?i:null}}function Th(e){var t;const n=Fs(),i=we({queryKey:["clmm","getOwnerPositionInfo",e,null==n?void 0:n.owner],enabled:null!=e&&null!=n&&null!=n.owner,queryFn:()=>Vr(this,void 0,void 0,(function*(){if(!n||!n.owner||!e)return null;const t=xa[e];if(!t)throw new Error("Invalid config");try{const e=yield n.clmm.getOwnerPositionInfo({programId:t.programId});return e.forEach((e=>{console.log("getOwnerPositionInfo p",e.poolId.toBase58(),e.rewardInfos,e.tokenFeesOwedA.toString(),e.tokenFeesOwedB.toString(),e.nftMint.toBase58(),e.liquidity.toString(),e.tickLower,e.tickUpper)})),{allPosition:e}}catch(e){return console.error("getOwnerPositionInfo error",e),null}}))});return{loading:i.isLoading,positions:null===(t=i.data)||void 0===t?void 0:t.allPosition}}const Lh=({mint:e,amount:t})=>{var n;const i=y(),{chainId:o}=Br(),r=qp({mint:null==e?void 0:e.address,chainId:o});return Gt.jsxs(x,{sx:{py:8,display:"flex",alignItems:"center",gap:6,typography:"h5",color:i.palette.text.primary},children:[Gt.jsx(Ms,{address:null!==(n=null==r?void 0:r.address)&&void 0!==n?n:"",chainId:null==r?void 0:r.chainId,noShowChain:!0,width:24,height:24,marginRight:0}),Gt.jsx(x,{children:null==r?void 0:r.symbol}),Gt.jsx(x,{sx:{ml:"auto"},children:t})]})},Oh=({mint1Address:e,mint2Address:t,feeAmount:n,poolId:o,nftMint:r,onClose:a})=>{const{isMobile:l}=Ec(),s=y(),d=Sa(),c=je(),{account:p,chainId:h}=Br(),m=Fs(),{position:f}=function({chainId:e,nftMint:t,poolId:n}){const i=Th(e);return{position:K((()=>{if(i.positions)return i.positions.find((e=>e.nftMint.equals(new Te(t))&&e.poolId.equals(new Te(n))))}),[i,t,n]),loading:i.loading}}({chainId:h,nftMint:r,poolId:o}),{positionInfo:g,pool:v}=Mh({position:f}),[b,j]=_("stake"),[w,C]=_(!1),[k,R]=_(Ch),S=qp({mint:e,chainId:h}),I=qp({mint:t,chainId:h}),[E,M]=ie(Wu,{mint1:S,mint2:I,feeAmount:n,selectedMintIndex:0,independentField:Zu.DEPOSIT_1,typedValue:"",startPriceTypedValue:"",leftRangeTypedValue:"",rightRangeTypedValue:""});J((()=>{S&&M({type:Lu.UpdateDefaultMint1,payload:S})}),[S]),J((()=>{I&&M({type:Lu.UpdateDefaultMint2,payload:I})}),[I]);const{independentField:T,typedValue:L}=E,{slipper:O,setSlipper:W,slipperValue:V}=Ru({type:u}),{mintA:A,mintB:F,dependentField:Z,parsedAmounts:P,depositBalances:B,position:N,mints:Y,errorMessage:z,invalidRange:X,outOfRange:q,depositADisabled:G,depositBDisabled:Q,ticksAtLimit:$}=hh({state:E,existingPosition:f,slipperValue:V}),ee=(null==f?void 0:f.liquidity)&&f.liquidity.eq(new vt(0)),{onField1Input:te,onField2Input:ne}=mh({dispatch:M}),re=!z&&!X,ae=K((()=>{var e,t;return{[T]:L,[Z]:null!==(t=null===(e=P[Z])||void 0===e?void 0:e.toString())&&void 0!==t?t:""}}),[Z,T,P,L]),le=[Zu.DEPOSIT_1,Zu.DEPOSIT_2].reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:gh(B[t])})),{}),se=Ce({mutationFn:()=>Vr(void 0,void 0,void 0,(function*(){if(!p)throw new Error("account is undefined");if(!m)throw new Error("raydium is undefined");if(!f)throw new Error("existingPosition is undefined");if(!(null==v?void 0:v.poolInfo))throw new Error("poolInfo is undefined");if(!N)throw new Error("position is undefined");const{execute:e}=yield m.clmm.increasePositionFromLiquidity({poolInfo:v.poolInfo,poolKeys:v.poolKeys,ownerPosition:f,ownerInfo:{useSOLBalance:!0},liquidity:new vt(new jt(N.liquidity.toString()).mul(1-V).toFixed(0)),amountMaxA:new vt(new jt(L||"0").mul(10**v.poolInfo.mintA.decimals).toFixed(0)),amountMaxB:new vt(N.amountB.multipliedBy(1+V).multipliedBy(new oe(10**v.poolInfo.mintB.decimals)).toFixed(0)),checkCreateATAOwner:!0,txVersion:He.LEGACY});(yield d.executeCustom({brief:i._({id:"OBdohg",message:"Add Liquidity"}),metadata:{[Ur.addAMMV3Pool]:!0},handler:t=>Vr(void 0,void 0,void 0,(function*(){const{txId:n}=yield e({sendAndConfirm:!0});t.onSuccess(n)}))}))===Hr.Success&&(C(!1),setTimeout((()=>{null==a||a()}),100)),c.invalidateQueries({queryKey:["clmm"],refetchType:"all"})})),onError:e=>{console.error(e)}}),de=Ce({mutationFn:()=>Vr(void 0,void 0,void 0,(function*(){if(!p)throw new Error("account is undefined");if(!m)throw new Error("raydium is undefined");if(!f)throw new Error("existingPosition is undefined");if(!(null==v?void 0:v.poolInfo))throw new Error("poolInfo is undefined");const e=new vt(new jt(f.liquidity.toString()).mul(k/100).toFixed(0)),{execute:t}=yield m.clmm.decreaseLiquidity({poolInfo:v.poolInfo,poolKeys:v.poolKeys,ownerPosition:f,ownerInfo:{useSOLBalance:!0,closePosition:!1},liquidity:e,amountMinA:new vt(0),amountMinB:new vt(0),txVersion:He.LEGACY});(yield d.executeCustom({brief:i._({id:"3XBvkd",message:"Remove Liquidity"}),metadata:{[Ur.removeAMMV3Pool]:!0},handler:e=>Vr(void 0,void 0,void 0,(function*(){const{txId:n}=yield t({sendAndConfirm:!0});e.onSuccess(n)}))}))===Hr.Success&&setTimeout((()=>{null==a||a()}),100),c.invalidateQueries({queryKey:["clmm"],refetchType:"all"})})),onError:e=>{console.error("onRemoveMutation",e)}}),ce=Ce({mutationFn:()=>Vr(void 0,void 0,void 0,(function*(){if(!m)throw new Error("raydium is undefined");if(!f)throw new Error("existingPosition is undefined");if(!(null==v?void 0:v.poolInfo))throw new Error("poolInfo is undefined");const{execute:e}=yield m.clmm.decreaseLiquidity({poolInfo:v.poolInfo,poolKeys:v.poolKeys,ownerPosition:f,ownerInfo:{useSOLBalance:!0,closePosition:!1},liquidity:new vt(0),amountMinA:new vt(0),amountMinB:new vt(0),txVersion:He.LEGACY});(yield d.executeCustom({brief:i._({id:"zXCpR0",message:"Claim Rewards"}),metadata:{[Ur.claimAMMV3Pool]:!0},handler:t=>Vr(void 0,void 0,void 0,(function*(){const{txId:n}=yield e();t.onSuccess(n)}))}))===Hr.Success&&setTimeout((()=>{null==a||a()}),100),c.invalidateQueries({queryKey:["clmm"],refetchType:"all"})})),onError:e=>{console.error("onClaimMutation",e)}}),ue=K((()=>{var e,t;const o=[{key:"stake",value:i._({id:"JYKRJS",message:"Stake"})},{key:"unstake",value:i._({id:"OFjZGo",message:"Unstake"})},{key:"claim",value:i._({id:"hom7qf",message:"Claim"})}];return Gt.jsxs(x,{sx:{borderRadius:16,backgroundColor:s.palette.background.paper},children:[Gt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",px:20,py:24,borderTopLeftRadius:16,borderTopRightRadius:16,backgroundColor:s.palette.background.paper},children:[Gt.jsx(x,{sx:{typography:"body1",fontWeight:600,color:s.palette.text.primary},children:i._({id:"E6MqGy",message:"Add liquidity"})}),a?Gt.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:24,height:24,borderRadius:"50%",borderWidth:1,color:"text.secondary",cursor:"pointer"},children:Gt.jsx(x,{component:Ft.Error,sx:{width:16,height:16},onClick:()=>{a()}})}):void 0]}),Gt.jsx(x,{sx:{mx:20,mb:16},children:Gt.jsx(Ih,{existingPosition:f,positionInfo:g,inRange:!q,removed:ee,mintA:A,mintB:F,feeAmount:n})}),Gt.jsxs(U,{value:b,onChange:(e,t)=>{j(t)},children:[Gt.jsx(H,{tabs:o,variant:"inPaper",tabsListSx:{mx:20}}),Gt.jsxs(D,{value:"stake",children:[N&&Gt.jsx(x,{sx:{mt:16,mx:20},children:Gt.jsx(Bp,{position:N,title:i._({id:"3VUfrF",message:"Selected Range"}),ticksAtLimit:$})}),Gt.jsxs(x,{sx:{mt:16,mx:20,display:"flex",flexDirection:"column",alignItems:"stretch",gap:12},children:[Gt.jsx(x,{sx:{typography:"body1",fontWeight:600,color:s.palette.text.secondary,textAlign:"left"},children:i._({id:"BRi+RY",message:"Add more liquidity"})}),Gt.jsxs(x,{children:[Gt.jsx(Tu,{value:ae[Zu.DEPOSIT_1],onUserInput:te,maxAmount:le[Zu.DEPOSIT_1],balance:B[Zu.DEPOSIT_1],mint:null!==(e=Y[Zu.DEPOSIT_1])&&void 0!==e?e:null,locked:G}),Gt.jsx(Nc,{}),Gt.jsx(Tu,{value:ae[Zu.DEPOSIT_2],onUserInput:ne,maxAmount:le[Zu.DEPOSIT_2],balance:B[Zu.DEPOSIT_2],mint:null!==(t=Y[Zu.DEPOSIT_2])&&void 0!==t?t:null,locked:Q})]}),Gt.jsx(Su,{value:O,onChange:W,disabled:!1,type:u})]}),Gt.jsx(x,{sx:{display:"flex",alignItems:"center",px:20,py:16,borderBottomLeftRadius:16,borderBottomRightRadius:16,backgroundColor:s.palette.background.paper},children:Gt.jsx(Iu,{chainId:h,isValid:re,errorMessage:z,setShowConfirm:C})}),Gt.jsx(Up,{position:N,outOfRange:q,ticksAtLimit:$,on:w,onClose:()=>{C(!1)},onConfirm:se.mutate,loading:se.isPending})]}),Gt.jsxs(D,{value:"unstake",children:[Gt.jsxs(x,{sx:{mt:16,mx:20,display:"flex",flexDirection:"column",alignItems:"stretch",gap:12},children:[Gt.jsx(wh,{disabled:!1,value:k,onChange:e=>R(e)}),Gt.jsx(Su,{value:O,onChange:W,disabled:!1,type:u})]}),Gt.jsxs(x,{sx:{mt:16,mx:20,display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[Gt.jsx(x,{sx:{typography:"body2",color:s.palette.text.secondary},children:"Receive"}),Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:4},children:[Gt.jsxs(x,{sx:{typography:"body1",fontWeight:600,color:s.palette.text.primary},children:[Gt.jsx(x,{component:"span",sx:{color:s.palette.primary.main},children:(null==g?void 0:g.pooledAmountA)?Kr({input:g.pooledAmountA.multipliedBy(k/100),decimals:null==A?void 0:A.decimals}):"-"})," ",null==A?void 0:A.symbol]}),Gt.jsxs(x,{sx:{typography:"body1",fontWeight:600,color:s.palette.text.primary},children:[Gt.jsx(x,{component:"span",sx:{color:s.palette.primary.main},children:(null==g?void 0:g.pooledAmountB)?Kr({input:g.pooledAmountB.multipliedBy(k/100),decimals:null==F?void 0:F.decimals}):"-"})," ",null==F?void 0:F.symbol]})]})]}),Gt.jsx(x,{sx:{mt:20,display:"flex",alignItems:"center",px:20,py:16,borderBottomLeftRadius:16,borderBottomRightRadius:16,backgroundColor:s.palette.background.paper},children:Gt.jsx(Eh,{chainId:h,disabled:ee||0===k,removed:ee,onConfirm:de.mutate,isLoading:de.isPending})})]}),Gt.jsxs(D,{value:"claim",children:[Gt.jsxs(x,{sx:{mx:20,mt:16,borderRadius:12,borderWidth:1,borderStyle:"solid",borderColor:s.palette.border.main},children:[Gt.jsx(x,{sx:{py:12,px:20,typography:"body1",color:s.palette.text.primary,borderBottomWidth:1,borderBottomStyle:"solid",borderBottomColor:s.palette.border.main},children:i._({id:"tu/fxg",message:"Claim fees"})}),Gt.jsx(x,{sx:{p:20},children:null==g?void 0:g.rewardInfos.map((e=>Gt.jsx(Lh,{mint:e.mint,amount:e.amount},e.mint.address)))})]}),Gt.jsx(x,{sx:{mx:20,mt:16,typography:"h6",color:s.palette.text.secondary},children:i._({id:"Joa5Dk",message:"*Collecting fees will withdraw currently available fees for you."})}),Gt.jsx(x,{sx:{mt:20,display:"flex",alignItems:"center",px:20,py:16,borderBottomLeftRadius:16,borderBottomRightRadius:16,backgroundColor:s.palette.background.paper},children:Gt.jsx(Rh,{chainId:h,disabled:ce.isPending||!g,onConfirm:ce.mutate,isLoading:ce.isPending})})]})]})]})}),[h,G,Q,B,z,f,n,ae,re,le,A,F,Y,se.isPending,se.mutate,ce.isPending,ce.mutate,a,te,ne,de.isPending,de.mutate,b,q,N,g,ee,W,w,k,O,s.palette.background.paper,s.palette.border.main,s.palette.primary.main,s.palette.text.primary,s.palette.text.secondary,$]);return l?Gt.jsx(oc,{open:null!=A&&null!=F,onClose:a,scope:!l,modal:void 0,id:"pool-operate",children:ue}):ue};const Wh=({outOfRange:e})=>{const t=y();return Gt.jsx(W,{title:e?i._({id:"i3Z+/Z",message:"Out of range"}):i._({id:"vOyUlD",message:"In range"}),children:Gt.jsx(x,{sx:{display:"flex",alignItems:"center"},children:e?Gt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:Gt.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.583252 12.5416L6.99992 1.45825L13.4166 12.5416H0.583252ZM11.3924 11.3749L6.9999 3.78575L2.6074 11.3749H11.3924ZM7.58328 9.62492H6.41661V10.7916H7.58328V9.62492ZM6.41661 6.12492H7.58328V8.45825H6.41661V6.12492Z",fill:t.palette.warning.main})}):Gt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"8",height:"8",viewBox:"0 0 8 8",fill:"none",children:Gt.jsx("circle",{cx:"4",cy:"4",r:"4",fill:t.palette.success.main})})})})},Vh=({position:e,mintA:t,mintB:n,feeAmount:o,onClickManage:r})=>{const a=y(),{positionInfo:l,pool:s}=Mh({position:e}),d=function(e,t,n){return K((()=>({[Pu.LOWER]:e&&t?t===Gp(Ge,Vu[e]):void 0,[Pu.UPPER]:e&&n?n===Gp(_e,Vu[e]):void 0})),[e,t,n])}(o,e.tickLower,e.tickUpper),c=null==l?void 0:l.priceLower,u=null==l?void 0:l.priceUpper,p=!!(null==s?void 0:s.computePoolInfo)&&(s.computePoolInfo.tickCurrent<e.tickLower||s.computePoolInfo.tickCurrent>=e.tickUpper),h=null==s?void 0:s.poolInfo.price;return Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:24,px:20,py:20,pb:12,borderRadius:12,backgroundColor:a.palette.background.paperContrast},children:[Gt.jsxs(x,{sx:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:4},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,typography:"h5",color:a.palette.text.primary},children:[Gt.jsx(x,{children:Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs("span",{children:[Pp({price:c,atLimit:d,direction:Pu.LOWER})," "]}),null==n?void 0:n.symbol]})}),Gt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"19",viewBox:"0 0 18 19",fill:"none",children:Gt.jsx("path",{d:"M15.75 9.50293L12.75 12.5029L11.7 11.4529L12.8813 10.2529L5.11875 10.2529L6.3 11.4529L5.25 12.5029L2.25 9.50293L5.25 6.50293L6.31875 7.55293L5.11875 8.75293L12.8813 8.75293L11.7 7.55293L12.75 6.50293L15.75 9.50293Z",fill:"currentColor",fillOpacity:"0.5"})}),Gt.jsx(x,{children:Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs("span",{children:[Pp({price:u,atLimit:d,direction:Pu.UPPER})," "]}),null==n?void 0:n.symbol]})})]}),Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4},children:[Gt.jsx(Wh,{outOfRange:p}),Gt.jsxs(x,{sx:{typography:"h6",color:a.palette.text.secondary},children:["Current price: ",Kr({input:h})," ",null==n?void 0:n.symbol," per ",null==t?void 0:t.symbol]})]})]}),Gt.jsx(b,{variant:b.Variant.outlined,size:b.Size.small,fullWidth:!0,onClick:r,children:i._({id:"wckWOP",message:"Manage"})})]})};const Ah=({mint1Address:e,mint2Address:t,feeAmount:n,poolId:o,onClose:r,handleGoToAddLiquidityV3:a})=>{const{isMobile:l}=Ec(),s=y(),{chainId:d,account:c}=Br(),{positions:u,loading:p}=Th(d),{mintA:h,mintB:m}=function({mint1Address:e,mint2Address:t}){const{chainId:n}=Br(),i=qp({mint:e,chainId:n}),o=qp({mint:t,chainId:n}),[r,a]=K((()=>i&&o?new vt(new Te(i.address).toBuffer()).gt(new vt(new Te(o.address).toBuffer()))?[o,i]:[i,o]:[void 0,void 0]),[i,o]);return{mintA:r,mintB:a}}({mint1Address:e,mint2Address:t}),f=K((()=>{if(void 0!==u)return u.filter((e=>e.poolId.equals(new Te(o))))}),[u,o]),[g,v]=_(null),j=K((()=>{var e;return Gt.jsxs(x,{sx:{p:20,display:"flex",flexDirection:"column",gap:16,borderRadius:16,backgroundColor:s.palette.background.paper,minHeight:480},children:[Gt.jsxs(x,{sx:{pb:16,borderBottomColor:s.palette.border.main,borderBottomStyle:"solid",borderBottomWidth:1,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[Gt.jsxs(x,{sx:{typography:"body1",fontWeight:600,color:s.palette.text.primary},children:[i._({id:"Gs02OK",message:"My Positions"})," (",null!==(e=null==f?void 0:f.length)&&void 0!==e?e:0,")"]}),r?Gt.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:24,height:24,borderRadius:"50%",borderWidth:1,color:"text.secondary",cursor:"pointer"},children:Gt.jsx(x,{component:Ft.Error,sx:{width:16,height:16},onClick:()=>{r()}})}):void 0]}),p||!f?Gt.jsx(Gt.Fragment,{children:Gt.jsx(x,{sx:{mt:100,display:"flex",justifyContent:"center"},children:Gt.jsx(Ys,{})})}):f.length>0?Gt.jsxs(Gt.Fragment,{children:[null==f?void 0:f.map((e=>Gt.jsx(Vh,{position:e,mintA:h,mintB:m,feeAmount:n,onClickManage:()=>{v(e)}},e.nftMint.toBase58()))),Gt.jsxs(b,{size:b.Size.big,variant:b.Variant.second,onClick:()=>{a({mint1:null==h?void 0:h.address,mint2:null==m?void 0:m.address,fee:String(n)})},sx:{gap:8},children:[Gt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:Gt.jsx("path",{d:"M19 13H13V19H11V13H5V11H11V5H13V11H19V13Z",fill:"currentColor"})}),i._({id:"FQ4aT9",message:"Add Position"})]})]}):Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs(x,{sx:{mt:100,display:"flex",flexDirection:"column",alignItems:"center",gap:12},children:[Gt.jsx(Y,{sx:{width:60,height:60,borderRadius:24/105*60}}),Gt.jsx(x,{sx:{typography:"body1",color:s.palette.text.secondary},children:i._({id:"/6L4mj",message:"Your position is empty"})})]}),Gt.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center"},children:Gt.jsx(gc,{size:b.Size.small,includeButton:!0,children:Gt.jsx(b,{size:b.Size.small,onClick:()=>{a({mint1:null==h?void 0:h.address,mint2:null==m?void 0:m.address,fee:String(n)})},children:i._({id:"FQ4aT9",message:"Add Position"})})})})]})]})}),[f,n,a,p,h,m,r,s.palette.background.paper,s.palette.border.main,s.palette.text.primary,s.palette.text.secondary]);return null!==g?Gt.jsx(Oh,{mint1Address:e,mint2Address:t,feeAmount:n,poolId:g.poolId.toBase58(),nftMint:g.nftMint.toBase58(),onClose:()=>{v(null)}}):l?Gt.jsx(oc,{open:null!=h&&null!=m,onClose:r,scope:!l,modal:void 0,id:"pool-operate",children:j}):j};var Fh,Zh;function Ph({message:e,onClose:t}){return Gt.jsx(oc,{open:!!e,onClose:t,id:"error-message",children:Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs(x,{sx:{flex:1,textAlign:"center"},children:[Gt.jsx(x,{component:Ft.ErrorWarn,sx:{mt:60,width:64,height:64,color:"error.main"}}),e?Gt.jsxs(x,{sx:{textAlign:"center",mt:60},children:[Gt.jsx(x,{children:Gt.jsx(n,{id:"kf83Ld",message:"Something went wrong."})}),Gt.jsx(x,{sx:{color:"text.secondary",mt:12,typography:"body2",wordBreak:"break-all"},children:e})]}):""]}),Gt.jsx(x,{sx:{px:16,py:20},children:Gt.jsx(b,{onClick:t,fullWidth:!0,children:Gt.jsx(n,{id:"1QfxQT",message:"Dismiss"})})})]})})}function Bh({status:e,children:t,buttonProps:i}){return!e.needShowTokenStatusButton&&t?Gt.jsx(Gt.Fragment,{children:t}):e.insufficientBalance?Gt.jsx(b,{fullWidth:!0,disabled:!0,...i,children:Gt.jsx(n,{id:"znqB4T",message:"Insufficient balance"})}):Gt.jsx(b,{fullWidth:!0,isLoading:e.isApproving,onClick:e.submitApprove,disabled:e.insufficientBalance,...i,children:e.isApproving?Gt.jsx(n,{id:"j2Uisd",message:"Approving"}):e.approveTitle})}function Nh({chainId:e,baseTokenStatus:t,quoteTokenStatus:i,children:o}){const{runningRequests:r}=Ia(),{account:a,chainId:l}=Br();if(!a||e!==l)return Gt.jsx(gc,{chainId:e,fullWidth:!0});const s=r.some((e=>{var t,n;return(null===(t=e.metadata)||void 0===t?void 0:t[Ur.addLiquidity])||(null===(n=e.metadata)||void 0===n?void 0:n[Ur.removeLiquidity])})),d=[];t.needShowTokenStatusButton&&d.push(Gt.jsx(Bh,{status:t})),i.needShowTokenStatusButton&&!t.isApproving&&d.push(Gt.jsx(Bh,{status:i}));const c=d.length;return 2===c?Gt.jsx(x,{sx:{display:"flex","& > button":{flex:1,"&:last-child":{ml:8}}},children:d.map((e=>e))}):1===c?d[0]:s?Gt.jsx(b,{fullWidth:!0,disabled:!0,isLoading:!0,children:Gt.jsx(n,{id:"UbRKMZ",message:"Pending"})}):Gt.jsx(Gt.Fragment,{children:o})}function Uh({pool:e,maxBaseAmount:t,maxQuoteAmount:n,isRemove:i}){const[o,r]=G.useState(""),[a,l]=G.useState(""),[s,d]=G.useState(wr),c=s===wr?new oe(Kc).div(100).toNumber():s,u=()=>{r(""),l("")},p=nu({pool:(null==e?void 0:e.baseToken)&&e.quoteToken?{baseToken:e.baseToken,quoteToken:e.quoteToken,address:e.address}:void 0,baseAmount:o,quoteAmount:a,slippage:c}),h=p.isFront?p.price:p.invertedPrice,m=h||new oe(1),f=G.useRef(m);if(!e||m.isNaN())return{baseAmount:o,quoteAmount:a,handleChangeBaseAmount:()=>{},handleChangeQuoteAmount:()=>{},reset:u,uniV2Pair:p,slippage:s,slippageNumber:c,setSlippage:d};const g=e.baseToken.decimals,x=e.quoteToken.decimals,y=e=>{if(e){let o=m.multipliedBy(e).dp(x).toString();n&&i&&(n.lte(o)||(null==t?void 0:t.lte(0)))&&(o=n.toString()),l(o)}else l(e)};f.current&&m.isEqualTo(f.current)||(f.current=m,y(o));return{baseAmount:o,quoteAmount:a,handleChangeBaseAmount:e=>{let t=ta(e,g);null===t&&(t=o),r(t),y(t)},handleChangeQuoteAmount:e=>{let o=ta(e,x);null===o&&(o=a),l(o),(e=>{if(e){let o=new oe(e).div(m).dp(g).toString();t&&i&&(t.lte(o)||(null==n?void 0:n.lte(0)))&&(o=t.toString()),r(o)}else r(e)})(o)},reset:u,midPrice:h,addPortion:m,amountCheckedDisabled:!o||!a,uniV2Pair:p,slippage:s,slippageNumber:c,setSlippage:d}}function Hh({submittedBack:e,pool:t}){var n,o,r;const a="SVM_AMMV2"===(null==t?void 0:t.type),[l,s]=G.useState(!1),{baseAmount:d,quoteAmount:c,midPrice:u,amountCheckedDisabled:p,uniV2Pair:h,handleChangeBaseAmount:m,handleChangeQuoteAmount:f,reset:g,slippage:y,slippageNumber:v,setSlippage:j}=Uh({pool:t});G.useEffect((()=>{g()}),[t]);const w=al(null==t?void 0:t.baseToken,{amount:d}),C=al(null==t?void 0:t.quoteToken,{amount:c}),k=w.insufficientBalance||C.insufficientBalance,R=!t||k||!u||!!h.poolInfoQuery.isLoading||!!h.poolInfoQuery.error||p||h.poolInfoQuery.isLoading;let S=a?i._({id:"bwSQI0",message:"Supply"}):i._({id:"m16xKo",message:"Add"});k&&(S=i._({id:"znqB4T",message:"Insufficient balance"}));const I=tu({baseToken:null==t?void 0:t.baseToken,quoteToken:null==t?void 0:t.quoteToken,pairMintAAmount:h.pairMintAAmount,pairMintBAmount:h.pairMintBAmount,isExists:h.isExists,poolKeys:null===(n=h.poolInfoQuery.data)||void 0===n?void 0:n.poolKeys,poolInfo:null===(o=h.poolInfoQuery.data)||void 0===o?void 0:o.poolInfo,slippage:v,submittedBack:()=>{g(),e&&e(),s(!1)}}),E=!(null==t?void 0:t.baseToken)||!(null==t?void 0:t.quoteToken);return Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs(x,{sx:{pt:20,pb:18,px:20},children:[Gt.jsx(Uc,{sx:{mb:4,pb:28,minHeight:"auto"},amt:d,token:null==t?void 0:t.baseToken,canClickBalance:!0,showPercentage:!0,onInputChange:m,readOnly:h.poolInfoQuery.isLoading}),Gt.jsx(kc,{plus:!0}),Gt.jsx(Uc,{sx:{pb:20,minHeight:"auto"},amt:c,token:null==t?void 0:t.quoteToken,canClickBalance:!0,showPercentage:!0,onInputChange:f,readOnly:h.poolInfoQuery.isLoading}),Gt.jsx(Cu,{slippage:y,onChangeSlippage:j,disabled:E,sx:{mt:8}}),Gt.jsx(gu,{baseToken:null==t?void 0:t.baseToken,quoteToken:null==t?void 0:t.quoteToken,loading:h.poolInfoQuery.isLoading,midPrice:u,lpBalancePercentage:h.isExists?h.lpBalancePercentage:100})]}),Gt.jsx(x,{sx:{px:20,py:16,position:"sticky",bottom:0,borderStyle:"solid",borderWidth:"1px 0 0",borderColor:"border.main",backgroundColor:"background.paper"},children:t?Gt.jsx(Nh,{chainId:t.chainId,baseTokenStatus:w,quoteTokenStatus:C,children:Gt.jsx(b,{fullWidth:!0,disabled:R,isLoading:I.isPending,onClick:()=>{R||s(!0)},children:S})}):Gt.jsx(b,{fullWidth:!0,disabled:!0,children:S})}),Gt.jsx(Ph,{message:null===(r=I.error)||void 0===r?void 0:r.message,onClose:()=>I.reset()}),a&&!!t&&Gt.jsx(xu,{open:l,onClose:()=>s(!1),slippage:v,baseToken:t.baseToken,quoteToken:t.quoteToken,pairMintAAmount:h.pairMintAAmount,pairMintBAmount:h.pairMintBAmount,feeRate:t.lpFeeRate,price:null==h?void 0:h.price,lpAmount:null==h?void 0:h.liquidityMinted,lpBalancePercentage:h.isExists?h.lpBalancePercentage:100,pairAddress:t.address,createMutation:I})]})}function Dh({hidePoolInfo:e,pool:t,children:i}){var o,r,a,l,s;const d=y(),c=!t,u="SVM_AMMV2"===(null==t?void 0:t.type),p=t?Ap({type:t.type,lpFeeRate:null!==(o=t.lpFeeRate)&&void 0!==o?o:"0",mtFeeRate:null!==(r=t.mtFeeRate)&&void 0!==r?r:"0"}):"-";return Gt.jsxs(x,{sx:{mt:16,mx:20,border:"solid 1px",borderColor:"border.main",borderRadius:12},children:[e?"":Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",p:d.spacing(12,20),borderStyle:"solid",borderColor:"border.main",borderWidth:d.spacing(0,0,1)},children:[Gt.jsxs(x,{children:[Gt.jsxs(E,{loading:c,loadingSx:{width:100,mb:4},sx:{display:"flex",alignItems:"center",gap:4,typography:"body2",fontWeight:600},children:[null===(a=null==t?void 0:t.baseToken)||void 0===a?void 0:a.symbol,"/",null===(l=null==t?void 0:t.quoteToken)||void 0===l?void 0:l.symbol,u&&Gt.jsx(W,{title:Gt.jsxs(x,{sx:{typography:"h6","& > b":{fontWeight:600,color:"primary.main"}},children:["🌟",Gt.jsx("b",{children:Gt.jsx(n,{id:"e38JNU",message:"Tips:"})})," ",Gt.jsx(n,{id:"ipqmyu",message:"By adding liquidity you’ll earn <0>{feeRate}</0> of all trades on this pair proportional to your share of the pool. Fees are added to the pool, accrue in real time and can be claimed by withdrawing your liquidity.",values:{feeRate:p},components:{0:Gt.jsx("b",{})}})]}),sx:{maxWidth:240},children:Gt.jsx(x,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.disabled"},children:p})})]}),Gt.jsx(E,{loading:c,children:Gt.jsx(pu,{address:null!==(s=null==t?void 0:t.address)&&void 0!==s?s:"",truncate:!0,iconSize:14,iconSpace:4,customChainId:null==t?void 0:t.chainId,sx:{typography:"h6",color:"text.secondary"}})})]}),(null==t?void 0:t.address)&&!u?Gt.jsxs(x,{component:M,sx:{typography:"body2",display:"flex",alignItems:"center",color:"text.secondary"},onClick:()=>{zc.getState().push({type:Yc.PoolDetail,params:{chainId:t.chainId,address:t.address}})},children:[Gt.jsx(n,{id:"URmyfc",message:"Details"}),Gt.jsx(x,{component:Ft.ArrowRight,sx:{ml:4,position:"relative",top:1.2,width:16,height:16}})]}):""]}),Gt.jsx(x,{sx:{p:d.spacing(12,20)},children:i})]})}function Yh({submittedBack:t,pool:n}){var o,r,a;const[l,s]=G.useState(""),[d,c]=G.useState(""),[u,p]=G.useState(wr),h=u===wr?new oe(Kc).div(100).toNumber():u,{isFront:m,price:f,invertedPrice:g,poolInfoQuery:y,lpBalanceQuery:v,lpBalance:j,lpBalancePercentage:w,lpToAmountA:C,lpToAmountB:k,liquidityMinted:R,pairMintAAmount:S,pairMintBAmount:I,isExists:E}=nu({pool:(null==n?void 0:n.baseToken)&&n.quoteToken?{baseToken:n.baseToken,quoteToken:n.quoteToken,address:n.address}:void 0,baseAmount:void 0,quoteAmount:void 0,slippage:0}),{mode:M,modeOptions:T,handleChangeMode:L,sliderPercentage:O,handleChangeSliderPercentage:W,resetPercentage:V}=function({isBase:e,pool:t,baseOverride:n,quoteOverride:o,resetAmount:r,handleChangeBaseAmount:a,handleChangeQuoteAmount:l}){const[s,d]=G.useState(kh.percentage),[c,u]=G.useState(Ch),p=G.useRef(null),h=()=>{p.current&&clearTimeout(p.current)},m=()=>{h(),u(Ch)};return G.useEffect((()=>h),[]),{mode:s,modeOptions:[{key:kh.percentage,value:i._({id:"x4QVeW",message:"Percentage to remove"})}],handleChangeMode:e=>{d(e),null==r||r(),m()},sliderPercentage:c,handleChangeSliderPercentage:i=>{if(h(),i!==c&&u(i),!t)return;const r=100===i,s=()=>{if(t)if(e||void 0===e){if(n){let e=n.toString();r||(e=ea(n.times(i/100),t.baseToken.decimals)),null==a||a(e)}}else if(o){let e=o.toString();r||(e=ea(o.times(i/100),t.quoteToken.decimals)),null==l||l(e)}};r?s():p.current=setTimeout(s,100)},resetPercentage:m}}({isBase:!0,pool:n,baseOverride:C,quoteOverride:k}),A=al(null==n?void 0:n.baseToken,{amount:l}),F=al(null==n?void 0:n.quoteToken,{amount:d}),Z=!n||!!y.isLoading||!!y.error||!!v.error||v.isLoading,P=i._({id:"t/YqKh",message:"Remove"}),B=function({liquidityAmount:t,slippage:n,poolInfo:o,poolKeys:r,submittedBack:a}){const l=Sa(),s=Fs();return e(),Ce({mutationFn:()=>Vr(this,void 0,void 0,(function*(){if(!s)throw new Error("raydium is undefined");if(!o||!r)throw new Error("poolInfo or poolKeys is undefined");if(!t)throw new Error("liquidityAmount is undefined");const e=new vt(new jt(t.toString()).mul(10**o.lpMint.decimals).toFixed(0,jt.ROUND_DOWN)),d=new Ye(100*n*100,1e4),{execute:c}=yield s.cpmm.withdrawLiquidity({poolInfo:o,poolKeys:r,lpAmount:e,txVersion:He.LEGACY,slippage:d});return yield l.executeCustom({brief:i._({id:"cJtosk",message:"Remove liquidity"}),metadata:{[Ur.removeLiqidityAMMV2Position]:!0},handler:e=>Vr(this,void 0,void 0,(function*(){const{txId:t}=yield c({sendAndConfirm:!0});e.onSuccess(t)})),submittedBack:a})}))})}({liquidityAmount:null==j?void 0:j.times(O/100),slippage:h,poolKeys:null===(o=y.data)||void 0===o?void 0:o.poolKeys,poolInfo:null===(r=y.data)||void 0===r?void 0:r.poolInfo,submittedBack:()=>{t&&t()}}),N=!(null==n?void 0:n.baseToken)||!(null==n?void 0:n.quoteToken);return Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs(x,{sx:{pb:18,px:20},children:[Gt.jsx(x,{sx:{pt:20},children:M===kh.percentage?Gt.jsx(wh,{disabled:y.isLoading||!j||j.lte(0),value:O,onChange:W}):Gt.jsx(Gt.Fragment,{})}),Gt.jsx(Cu,{slippage:u,onChangeSlippage:p,disabled:N,sx:{mt:8}}),Gt.jsx(gu,{baseToken:null==n?void 0:n.baseToken,quoteToken:null==n?void 0:n.quoteToken,loading:y.isLoading,midPrice:m?f:g,lpBalancePercentage:E?w:100})]}),Gt.jsx(x,{sx:{px:20,py:16,position:"sticky",bottom:0,borderStyle:"solid",borderWidth:"1px 0 0",borderColor:"border.main",backgroundColor:"background.paper"},children:n?Gt.jsx(Nh,{chainId:n.chainId,baseTokenStatus:A,quoteTokenStatus:F,children:Gt.jsx(b,{fullWidth:!0,disabled:Z,isLoading:B.isPending,onClick:()=>{Z||B.mutate()},children:P})}):Gt.jsx(b,{fullWidth:!0,disabled:!0,children:P})}),Gt.jsx(Ph,{message:null===(a=B.error)||void 0===a?void 0:a.message,onClose:()=>B.reset()})]})}function zh({pool:t,operate:n,hidePoolInfo:i,submittedBack:o}){var r;const{operateTab:a,operateTabs:l,handleChangeTab:s}=function(t=Zh.Add){const{i18n:n}=e(),[i,o]=G.useState(t),r=G.useMemo((()=>[{key:Zh.Add,value:n._({id:"m16xKo",message:"Add"})},{key:Zh.Remove,value:n._({id:"t/YqKh",message:"Remove"})}]),[n._]);return G.useEffect((()=>{o(t)}),[t]),{operateTab:i,operateTabs:r,handleChangeTab:e=>{o(e)}}}(n);Br();const{price:d,invertedPrice:c,poolInfoQuery:u,lpBalanceQuery:p,lpBalance:h,lpBalancePercentage:m,lpToAmountA:f,lpToAmountB:g,liquidityMinted:x,pairMintAAmount:y,pairMintBAmount:v,isExists:b}=nu({pool:(null==t?void 0:t.baseToken)&&t.quoteToken?{baseToken:t.baseToken,quoteToken:t.quoteToken,address:t.address}:void 0,baseAmount:void 0,quoteAmount:void 0,slippage:0});return Gt.jsxs(Gt.Fragment,{children:[Gt.jsx(Dh,{pool:t,hidePoolInfo:i,children:Gt.jsx(ju,{isExists:b,poolInfo:null===(r=u.data)||void 0===r?void 0:r.poolInfo,poolInfoLoading:u.isLoading,lpBalanceLoading:p.isLoading,lpBalance:h,lpBalancePercentage:m,lpToAmountA:f,lpToAmountB:g,sx:{px:0,py:0,border:"none"}})}),Gt.jsxs(U,{value:a,onChange:(e,t)=>{s(t)},children:[Gt.jsx(H,{tabs:l,variant:"inPaper",tabsListSx:{mt:16,mx:20}}),Gt.jsx(D,{value:Zh.Add,children:Gt.jsx(Hh,{pool:t,submittedBack:o})}),Gt.jsx(D,{value:Zh.Remove,children:Gt.jsx(Yh,{pool:t,submittedBack:o})})]})]})}function Xh({onClose:t,pool:n,operate:i,hasMining:o,hidePoolInfo:r,sx:a}){const{poolOrMiningTab:l,poolOrMiningTabs:s,handleChangeTab:d}=function({hasMining:t}){const{i18n:n}=e(),[i,o]=G.useState(Fh.Liquidity);return{poolOrMiningTab:i,poolOrMiningTabs:G.useMemo((()=>{const e=[{key:Fh.Liquidity,value:n._({id:"6y2TB3",message:"Liquidity"})},{key:Fh.Mining,value:n._({id:"Sti4vy",message:"Mining"})}];return t?e:e.slice(0,1)}),[n._,t]),handleChangeTab:e=>{o(e)}}}({hasMining:o});return Gt.jsx(x,{sx:a,children:Gt.jsxs(U,{value:l,onChange:(e,t)=>{d(t)},sx:{display:"flex",flexDirection:"column",overflow:"hidden",height:"100%"},children:[Gt.jsx(z,{tabs:s,tabsListSx:Object.assign({mx:20,justifyContent:t?"space-between":"flex-start"},{}),rightSlot:Gt.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center",gap:12},children:t?Gt.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:24,height:24,borderRadius:"50%",borderWidth:1,color:"text.secondary",cursor:"pointer"},children:Gt.jsx(x,{component:Ft.Error,sx:{width:16,height:16},onClick:()=>{t()}})}):void 0})}),Gt.jsx(D,{value:Fh.Liquidity,sx:{flex:1,overflowY:"auto"},children:Gt.jsx(zh,{pool:n,operate:i,hidePoolInfo:r,submittedBack:()=>{o&&d(Fh.Mining)}})})]})})}function qh(e){var{modal:t}=e,n=Wr(e,["modal"]);const{isMobile:i}=Ec();return Gt.jsx(oc,{open:!!n.pool,onClose:n.onClose,scope:!i,modal:t,id:"pool-operate",children:Gt.jsx(Xh,{...n})})}!function(e){e[e.Liquidity=1]="Liquidity",e[e.Mining=2]="Mining"}(Fh||(Fh={})),function(e){e[e.Add=1]="Add",e[e.Remove=2]="Remove"}(Zh||(Zh={}));const Gh=e=>Object.keys(new Array(e+1).join(","));var _h,Jh,Qh;function Kh({sx:e,hasSearch:t,emptyText:i}){return Gt.jsxs(x,{sx:Object.assign({display:"flex",flexDirection:"column",gap:12,justifyContent:"center",alignItems:"center",typography:"body2",fontWeight:500,color:"text.secondary",textAlign:"center"},e),children:[Gt.jsx(Y,{hasSearch:t,sx:{width:60,height:60,borderRadius:12}}),Gt.jsx(x,{children:null!=i?i:Gt.jsx(n,{id:"AxPAXW",message:"No results found"})})]})}function $h(){return $h=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},$h.apply(null,arguments)}!function(e){e[e.Failed=0]="Failed",e[e.Success=1]="Success",e[e.Warning=2]="Warning"}(_h||(_h={}));const em=e=>q.createElement("svg",$h({width:60,height:60,viewBox:"0 0 60 60",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),q.createElement("g",{opacity:.5},q.createElement("mask",{id:"mask0_3521_179418",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:0,y:0,width:60,height:60},Jh||(Jh=q.createElement("rect",{width:60,height:60,rx:16,fill:"white"}))),Qh||(Qh=q.createElement("g",{mask:"url(#mask0_3521_179418)"},q.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0 30.0352H60V16.0352C60 7.1986 52.8366 0.0351562 44 0.0351562H16C7.16344 0.0351562 0 7.1986 0 16.0352V30.0352Z",fill:"#727272",fillOpacity:.4}),q.createElement("path",{d:"M29.4643 4H16C9.37258 4 4 9.37258 4 16V27H27.1154L31.7914 18.7271L23.1831 13.6634L29.4643 4Z",fill:"#727272",fillOpacity:.4}),q.createElement("path",{d:"M31.7101 27H56V16C56 9.37258 50.6274 4 44 4H34.0384L34.1766 4.08987L28.8164 12.3364L37.2081 17.2727L31.7101 27Z",fill:"#727272",fillOpacity:.4}),q.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0 44C0 52.8366 7.16344 60 16 60H44C52.8366 60 60 52.8366 60 44V30H0V44Z",fill:"#ABABAB",fillOpacity:.4}),q.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M59.4395 44.8861C59.4395 53.0965 52.7625 59.7526 44.5257 59.7526C36.2891 59.7526 29.6118 53.0965 29.6118 44.8861C29.6118 36.6756 36.2891 30.0195 44.5257 30.0195C52.7625 30.0195 59.4395 36.6756 59.4395 44.8861Z",fill:"#727272",fillOpacity:.4}),q.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M29.8277 44.8665C29.8277 53.077 23.1507 59.7331 14.9139 59.7331C6.67727 59.7331 0 53.077 0 44.8665C0 36.6561 6.67727 30 14.9139 30C23.1507 30 29.8277 36.6561 29.8277 44.8665Z",fill:"#727272",fillOpacity:.4}),q.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M51.9177 44.8883C51.9177 48.958 48.6082 52.257 44.5255 52.257C40.4431 52.257 37.1333 48.958 37.1333 44.8883C37.1333 40.8186 40.4431 37.5195 44.5255 37.5195C48.6082 37.5195 51.9177 40.8186 51.9177 44.8883Z",fill:"#444446"})))));function tm({sx:e,refresh:t}){return Gt.jsxs(x,{sx:ue({display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},e),children:[Gt.jsx(x,{component:em,sx:{display:"inline-block",width:60,height:60,mb:12}}),Gt.jsx(x,{sx:{typography:"body2",width:252,textAlign:"center"},children:Gt.jsx(x,{component:"span",sx:{color:"text.secondary"},children:Gt.jsx(n,{id:"Vmw6BM",message:"Something went wrong…<0>Refresh again</0>",components:{0:Gt.jsx(j,{component:"span",color:"primary.main",weak:!0,sx:{cursor:"pointer"},onClick:()=>{t()}})}})})})]})}function nm({loading:e,empty:t,hasSearch:n,children:i,refetch:o}){return e?Gt.jsx(x,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",gap:24,px:24,height:320},children:Gh(4).map(((e,t)=>Gt.jsx(V,{width:"100%",height:45},t)))}):o?Gt.jsx(tm,{refresh:o,sx:{height:320}}):t?Gt.jsx(Kh,{hasSearch:n,sx:{height:320}}):Gt.jsx(Gt.Fragment,{children:i})}function im({children:e,sx:t,gap:n=20,repeatBaseForLargeScreen:i=3}){const{isMobile:o,minDevice:r}=Ec();let a={};if(o)a={display:"flex",flexDirection:"column",gap:n};else{let e=2;[1418,1761,2104].some(((t,n)=>{if(r(t))return e=i+n,!0})),a={display:"grid",gap:n,gridTemplateColumns:`repeat(${e}, 1fr)`}}return Gt.jsx(x,{sx:Object.assign(Object.assign({},a),t),children:e})}function om({address:e,chainId:t,hideName:i,sx:o}){const r=y(),a=el(),{onlyChainId:l}=Zr(),s=we(Object.assign({},a.getQuery(g.graphql.fetchLiquidityLpPartnerRewards,{where:{chainId:l||void 0}})));if(!e)return null;const d=[];return("string"==typeof e?[e]:Array.from(new Set(e)).filter((e=>!!e))).forEach((e=>{var n,i,o;e&&(null===(o=null===(i=null===(n=s.data)||void 0===n?void 0:n.liquidity_getLpPartnerRewards)||void 0===i?void 0:i.partnerRewards)||void 0===o||o.some((n=>{var i,o,r,a,l,c,u,p,h,m,f,g,x,y;if((null==n?void 0:n.chainId)===t&&(null===(i=null==n?void 0:n.pool)||void 0===i?void 0:i.toLocaleLowerCase())===e.toLocaleLowerCase()){const e=null===(a=null===(r=null===(o=s.data)||void 0===o?void 0:o.liquidity_getLpPartnerRewards)||void 0===r?void 0:r.partnerInfos)||void 0===a?void 0:a.find((e=>(null==e?void 0:e.partner)===n.partner));if(!e)return;d.push({partner:{name:null!==(l=null==e?void 0:e.partner)&&void 0!==l?l:"",logo:null!==(c=null==e?void 0:e.logo)&&void 0!==c?c:"",introduction:null!==(u=null==e?void 0:e.introduction)&&void 0!==u?u:"",link:null!==(p=null==e?void 0:e.link)&&void 0!==p?p:"",extra:null!==(h=null==e?void 0:e.extra)&&void 0!==h?h:{},background:(null===(m=null==e?void 0:e.theme)||void 0===m?void 0:m[0])||void 0,color:(null===(f=null==e?void 0:e.theme)||void 0===f?void 0:f[1])||void 0},reward:null!==(g=null==n?void 0:n.reward)&&void 0!==g?g:"",type:null!==(x=null==n?void 0:n.type)&&void 0!==x?x:"stakelp",sort:null!==(y=null==e?void 0:e.sort)&&void 0!==y?y:Number.MAX_SAFE_INTEGER})}})))})),(null==d?void 0:d.length)?(d.sort(((e,t)=>e.sort-t.sort)),Gt.jsx(x,{sx:Object.assign({display:"flex",alignItems:"center",gap:4},o),children:d.map((e=>Gt.jsx(W,{leaveDelay:100,title:Gt.jsxs(x,{sx:{maxWidth:240,whiteSpace:"pre-wrap"},children:[e.partner.introduction,!!e.partner.link&&Gt.jsxs(x,{component:"a",target:"_blank",href:e.partner.link,rel:"noopener noreferrer",sx:{display:"flex",alignItems:"center",gap:4,color:"primary.main","&:hover":{opacity:.5}},children:[Gt.jsx(n,{id:"zwWKhA",message:"Learn more"})," ",Gt.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:Gt.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.91667 2.91667V11.0833H11.0833V7H12.25V11.0833C12.25 11.725 11.725 12.25 11.0833 12.25H2.91667C2.26917 12.25 1.75 11.725 1.75 11.0833V2.91667C1.75 2.275 2.26917 1.75 2.91667 1.75H7V2.91667H2.91667ZM8.16667 2.91667V1.75H12.25V5.83333H11.0833V3.73917L5.34917 9.47333L4.52667 8.65083L10.2608 2.91667H8.16667Z",fill:"currentColor"})})]})]}),children:Gt.jsxs(M,{sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:4,p:r.spacing(0,4),height:20,borderRadius:4,background:e.partner.background,color:e.partner.color,whiteSpace:"nowrap"},children:[Gt.jsx(x,{component:"img",src:e.partner.logo,alt:e.partner.name,sx:{width:14,height:14,borderRadius:"50%"}}),!i&&!!e.reward&&Gt.jsx(x,{sx:{fontSize:"10px",fontWeight:600},children:e.reward})]})},e.partner.name+e.reward)))})):null}var rm,am;function lm(){return lm=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},lm.apply(null,arguments)}const sm=e=>q.createElement("svg",lm({width:32,height:32,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),rm||(rm=q.createElement("circle",{cx:16,cy:16,r:16,fill:"#FFE804"})),am||(am=q.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.5 12.25H12.25V8.5H8.5V12.25ZM14.125 23.5H17.875V19.75H14.125V23.5ZM12.25 23.5H8.5V19.75H12.25V23.5ZM8.5 17.875H12.25V14.125H8.5V17.875ZM17.875 17.875H14.125V14.125H17.875V17.875ZM19.75 8.5V12.25H23.5V8.5H19.75ZM17.875 12.25H14.125V8.5H17.875V12.25ZM19.75 17.875H23.5V14.125H19.75V17.875ZM23.5 23.5H19.75V19.75H23.5V23.5Z",fill:"#1A1A1B"}))),dm="_default";function cm({value:e,onChange:t,placeholder:n,options:i,sx:o,readOnly:r,valueOnlyIcon:a}){const l=y();return Gt.jsx(X,{value:null!=e?e:dm,onChange:(n,i)=>{const o="number"==typeof e?Number(i):i;t(o===dm?void 0:o)},disabled:r,sx:ue({padding:l.spacing(8,12),"& .MuiSelect-select.MuiSelect-select.MuiSelect-select":{display:"flex",alignItems:"center",gap:8,padding:l.spacing(8,12,8,12),minHeight:"auto",backgroundColor:"transparent",color:"text.primary",borderRadius:8,typography:"body2",fontWeight:600,borderStyle:"solid",borderWidth:1,borderColor:"divider","& svg, & img":{width:24,height:24},'&:hover, &[aria-expanded="true"]':{backgroundColor:"background.paper"},"&.Mui-readOnly":{color:"text.disabled"}},"& .MuiSelect-icon":{color:r?"text.disabled":"text.primary"},"& .MuiOutlinedInput-notchedOutline":{display:"none"}},o),renderValue:t=>{if(!(null==t?void 0:t.value)||t.value===dm)return Gt.jsx(x,{sx:{color:"text.secondary"},children:null!=n?n:""});const o=i.find((t=>t.key===e));return o?Gt.jsxs(Gt.Fragment,{children:[o.logo,a?"":o.value]}):null},options:[...i]})}function um({isMobileStyle:e,chain:t,isLastItem:n,logoWidth:i,mobileLogoWidth:o,sx:r}){const a=y();return e?Gt.jsxs(x,{sx:Object.assign({display:"flex",alignItems:"center",py:18,borderTop:`1px solid ${a.palette.border.main}`,borderBottom:n?`1px solid ${a.palette.border.main}`:"none"},r),children:[Gt.jsx(x,{component:null==t?void 0:t.logo,sx:{width:o,height:o}}),Gt.jsx(x,{component:"span",className:"name",sx:{marginLeft:8},children:null==t?void 0:t.name})]}):Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[Gt.jsx(x,{component:null==t?void 0:t.logo,sx:{width:i,height:i}}),Gt.jsx(x,{component:"span",className:"name",sx:{marginLeft:8},children:null==t?void 0:t.name})]})}const pm=-1;function hm({chainId:t,setChainId:i,logoWidth:o=24,mobileLogoWidth:r=32,mainLogoWidth:a=24,mainMobileLogoWidth:l=18,notShowAllChain:s,valueOnlyIcon:d,sx:c}){const u=function(){const{chainId:e}=Ue();return K((()=>{const t=new Map;let n;return Is.forEach(((i,o)=>{if(i.mainnet){if(e!==i.chainId)return;n=i.mainnet}t.set(o,Object.assign({},i))})),void 0!==n&&t.delete(n),Array.from(t.values())}),[e])}(),[p,h]=G.useState(!1),{isMobile:m}=Ec(),{i18n:f}=e(),g=G.useCallback((()=>{const e=void 0===t?u[0]:u.find((e=>e.chainId===t));if(d){if(void 0===t||!e)return"";const n=m?r:a;return Gt.jsx(x,{component:null==e?void 0:e.logo,sx:{width:n,height:n}})}return void 0!==t||s?e?Gt.jsx(um,{isMobileStyle:m,chain:e,logoWidth:a,mobileLogoWidth:l}):null:Gt.jsx(um,{isMobileStyle:m,chain:{chainId:pm,logo:sm,name:f._({id:"pY/ok7",message:"All chains"})},logoWidth:a,mobileLogoWidth:l,sx:{border:"none"}})}),[t,u,s,d,m,f._]),y=G.useMemo((()=>{const e=[];return s||e.push({key:pm,value:Gt.jsx(um,{isMobileStyle:m,chain:{chainId:pm,logo:sm,name:f._({id:"pY/ok7",message:"All chains"})},logoWidth:o,mobileLogoWidth:r})}),u.forEach(((t,n)=>{e.push({key:t.chainId,value:Gt.jsx(um,{isLastItem:n===u.length-1,isMobileStyle:m,chain:t,logoWidth:o,mobileLogoWidth:r})})})),e}),[m,o,r,u,s]);return m?Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs(x,{component:M,onClick:()=>h(!0),sx:Object.assign({display:"flex",alignItems:"center",backgroundColor:"background.tag",borderRadius:8,border:"none",px:8,height:32,fontWeight:600,typography:"body2"},c),children:[Gt.jsx(x,{sx:{pr:5},children:g()}),Gt.jsx(x,{component:Ft.CaretUp,sx:{width:12,height:12,transform:"rotate(180deg)"}})]}),Gt.jsx(oc,{open:p,title:Gt.jsx(n,{id:"lJvbHq",message:"Select Network"}),onClose:()=>h(!1),id:"select-chain",modal:!0,children:Gt.jsx(x,{sx:{mb:20},children:y.map((e=>Gt.jsxs(x,{onClick:()=>{const t=e.key;i(t===pm?void 0:Number(t)),h(!1)},sx:{position:"relative",px:20,"&:active":{backgroundColor:"hover.default"},"&:hover":{backgroundColor:"hover.default"},cursor:"pointer"},children:[e.value,(t?e.key===t:e.key===pm)&&Gt.jsx(x,{sx:{position:"absolute",left:0,top:24,height:20,width:2,backgroundColor:"text.primary"}})]},e.key)))})})]}):Gt.jsx(cm,{value:null!=t?t:pm,onChange:e=>{i(e===pm?void 0:e)},placeholder:f._({id:"lJvbHq",message:"Select Network"}),options:y,valueOnlyIcon:d,sx:Object.assign({height:32,fontWeight:600,typography:"body2"},c)})}function mm({text:e,onClick:t}){const n=y();return Gt.jsxs(x,{sx:{typography:"body2",display:"inline-flex",alignItems:"center",p:n.spacing(0,4,0,8),width:"max-content",height:32,backgroundColor:"hover.default",borderWidth:1,borderRadius:8,cursor:"pointer"},onClick:t,children:[e,Gt.jsx(x,{component:Ft.ArrowBack,sx:{ml:2,width:16,height:16,transform:"rotate(180deg)"}})]})}function fm({lqList:e,onDeleteTag:t,sx:n}){var i;if(!(null==e?void 0:e.length))return null;if(!(null===(i=e[0])||void 0===i?void 0:i.pair))return null;const{pair:o}=e[0],r=Lp(o.baseToken,o.chainId),a=Lp(o.quoteToken,o.chainId);return r&&a?Gt.jsxs(x,{sx:Object.assign({typography:"body2",display:"inline-flex",alignItems:"center",px:8,mr:8,borderRadius:8,fontWeight:600,height:32,backgroundColor:"hover.default"},n),children:[Gt.jsx(mu,{tokens:[r,a],chainId:r.chainId,width:20,mr:8}),r.symbol,"+",a.symbol,Gt.jsx(x,{component:Ft.Error,sx:{ml:4,width:16,height:16,cursor:"pointer",color:"text.secondary",position:"relative",top:1.5},onClick:()=>t()})]}):null}function gm({tags:e,onDeleteTag:t,sx:n}){return e.length?Gt.jsx(x,{sx:Object.assign({display:"inline-flex",alignItems:"center"},n),children:e.map((e=>Gt.jsxs(x,{sx:{typography:"body2",display:"flex",alignItems:"center",px:8,mr:8,borderRadius:8,fontWeight:600,height:32,backgroundColor:"hover.default"},children:[Gt.jsx(Ms,{address:e.address,width:20,height:20,chainId:e.chainId,url:e.logoURI,noShowChain:!0,marginRight:8}),e.symbol,Gt.jsx(x,{component:Ft.Error,sx:{ml:4,width:16,height:16,cursor:"pointer",color:"text.secondary",position:"relative",top:1.5},onClick:()=>t(e)})]},e.address)))}):null}function xm({chainId:e,address:t}){const{isMobile:n}=Ec();return Gt.jsx(x,{component:"button",onClick:n=>{n.stopPropagation(),zc.getState().push({type:Yc.PoolDetail,params:{chainId:e,address:t}})},sx:Object.assign({display:"flex",alignItems:"center",justifyContent:"center",borderRadius:8,cursor:"pointer",flexShrink:0,height:36,"&:hover":{opacity:.5}},n?{width:64,backgroundColor:"background.tag"}:{width:40,backgroundColor:"transparent",borderWidth:1}),children:Gt.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:Gt.jsx("path",{d:"M5.83333 14.1667H7.5V8.33333H5.83333V14.1667ZM9.16667 14.1667H10.8333V5.83333H9.16667V14.1667ZM12.5 14.1667H14.1667V10.8333H12.5V14.1667ZM4.16667 17.5C3.70833 17.5 3.31597 17.3368 2.98958 17.0104C2.66319 16.684 2.5 16.2917 2.5 15.8333V4.16667C2.5 3.70833 2.66319 3.31597 2.98958 2.98958C3.31597 2.66319 3.70833 2.5 4.16667 2.5H15.8333C16.2917 2.5 16.684 2.66319 17.0104 2.98958C17.3368 3.31597 17.5 3.70833 17.5 4.16667V15.8333C17.5 16.2917 17.3368 16.684 17.0104 17.0104C16.684 17.3368 16.2917 17.5 15.8333 17.5H4.16667ZM4.16667 15.8333H15.8333V4.16667H4.16667V15.8333Z",fill:"#1A1A1B"})})})}function ym(e){var{sx:t,children:i,hasMore:o,loadMore:r,loadMoreLoading:a}=e,l=Wr(e,["sx","children","hasMore","loadMore","loadMoreLoading"]);const s=y();return Gt.jsxs(x,{sx:Object.assign({position:"relative",flex:1,overflowY:"auto"},t),...l,children:[Gt.jsx(x,{component:"table",sx:{width:"100%",borderCollapse:"collapse","& th":{p:24,typography:"body1",textAlign:"left",color:"text.secondary"},"& td":{px:24,py:20},"& thead":{position:"sticky",top:0,zIndex:2,backgroundColor:"background.paper"},"& th:last-child, & td:last-child":{position:"sticky",right:0,zIndex:1,backgroundColor:"background.paper","&::before":{content:'""',position:"absolute",top:0,bottom:0,left:1,width:"1px",boxShadow:`${L(s.palette.text.primary,.1)} -2px 0px 4px 0px`}}},children:i}),o&&Gt.jsx(M,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:64,width:"100%",borderStyle:"solid",borderColor:"border.main",borderWidth:s.spacing(1,0,0,0),typography:"body2",color:"text.secondary","&:hover":{color:"text.primary"}},onClick:r,children:a?Gt.jsx(O,{}):Gt.jsxs(Gt.Fragment,{children:[Gt.jsx(n,{id:"yQ2kGp",message:"Load more"}),Gt.jsx(x,{component:Ft.ArrowRight,sx:{transform:"rotate(90deg)"}})]})})]})}function vm({sx:e}){return Gt.jsxs(x,{sx:Object.assign({px:20,pt:20,pb:12,backgroundColor:"background.paperContrast",borderRadius:16,display:"flex",flexDirection:"column"},e),children:[Gt.jsx(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[Gt.jsx(V,{variant:"circular",width:48}),Gt.jsx(V,{variant:"rounded",height:28,width:100,sx:{ml:8}})]})}),Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",mt:44},children:[Gt.jsxs(x,{children:[Gt.jsx(V,{variant:"rounded",height:24,width:100}),Gt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:Gt.jsx(n,{id:"rSayea",message:"APY"})})]}),Gt.jsx(x,{sx:{display:"inline-block",mx:20,height:24,width:"1px",backgroundColor:"custom.border.default"}}),Gt.jsxs(x,{children:[Gt.jsx(V,{variant:"rounded",height:24,width:100}),Gt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:Gt.jsx(n,{id:"FHKsZF",message:"TVL"})})]})]}),Gt.jsx(V,{variant:"rounded",height:32})]})}function bm({chainId:e,baseToken:t,quoteToken:i,apy:o,hasQuote:r,hasMining:a,sx:l,children:s}){if(!t)return null;const d=r?[{token:t,transactionApy:null==o?void 0:o.transactionBaseApy,miningApy:null==o?void 0:o.miningBaseApy},{token:i,transactionApy:null==o?void 0:o.transactionQuoteApy,miningApy:null==o?void 0:o.miningQuoteApy}]:[{transactionApy:null==o?void 0:o.transactionBaseApy,miningApy:null==o?void 0:o.miningBaseApy}];return Gt.jsx(W,{children:null!=s?s:Gt.jsx(j,{component:Ft.QuestionBorder,sx:Object.assign({width:15,height:15},l)}),title:Gt.jsx(x,{sx:{width:236},children:d.map(((o,r)=>{var l,s,d,c;return Gt.jsxs(x,{sx:{mt:0===r?0:20},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",typography:"body2",fontWeight:600,color:"text.primary"},children:[Gt.jsx(x,{sx:{display:"flex",alignItems:"center"},children:o.token?Gt.jsxs(Gt.Fragment,{children:[Gt.jsx(Ms,{width:14,height:14,marginRight:4,address:o.token.address,url:o.token.logoURI,chainId:e,noShowChain:!0}),o.token.symbol]}):Gt.jsxs(Gt.Fragment,{children:[Gt.jsx(mu,{tokens:[t,i],width:14,mr:4,chainId:e}),t.symbol,"/",null==i?void 0:i.symbol]})}),Gt.jsx(x,{children:ca(new oe(null!==(d=o.transactionApy)&&void 0!==d?d:0).plus(null!==(c=o.miningApy)&&void 0!==c?c:0))})]}),Gt.jsxs(x,{sx:{mt:8,display:"flex",justifyContent:"space-between",typography:"h6",color:"text.secondary"},children:[Gt.jsx("span",{children:Gt.jsx(n,{id:"OnDEky",message:"LP Fee"})}),Gt.jsx("span",{children:o.transactionApy?ca(new oe(o.transactionApy)):"-"})]}),a?Gt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",typography:"h6",color:"text.secondary"},children:[Gt.jsx("span",{children:Gt.jsx(n,{id:"pSQ1lM",message:"MT Fee"})}),Gt.jsx("span",{children:o.miningApy?ca(new oe(o.miningApy)):"-"})]}):""]},null!==(s=null===(l=o.token)||void 0===l?void 0:l.address)&&void 0!==s?s:1)}))})})}function jm({sx:e,value:t,onChange:o,searchAddress:r}){const[a,l]=G.useState(!1),{isMobile:s}=Ec();return Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs(x,{component:M,sx:Object.assign(Object.assign({typography:"body2",display:"flex",alignItems:"center",justifyContent:"flex-start",px:12,height:32,backgroundColor:"background.tag",color:"text.secondary",borderRadius:8,fontWeight:600},s?{}:{minWidth:220}),e),onClick:()=>l(!0),children:[Gt.jsx(x,{component:Ft.Search,sx:{width:16,height:16,mr:8,flexShrink:0}}),Gt.jsx(n,{id:"A1taO8",message:"Search"})]}),Gt.jsx(Bc,{value:t,open:a,multiple:!0,title:Gt.jsx(n,{id:"o8aMNm",message:"Select a liquidity pool"}),searchPlaceholder:i._({id:"4nzwq3",message:"Search by token or pool address"}),onClose:()=>{l(!1)},onTokenChange:e=>{if(Array.isArray(e)){if(e.length>2){const t=[e[0],e[2]];o(t)}else o(e);l(!1)}},searchOtherAddress:e=>r(e,(()=>l(!1))),modal:!0})]})}function wm({list:e,onClick:t}){return Gt.jsx(Gt.Fragment,{children:null==e?void 0:e.map((e=>{var i,o,r,a;if(!(null==e?void 0:e.pair))return null;const l=e.pair,s=Lp(l.baseToken,l.chainId),d=Lp(l.quoteToken,l.chainId),c=l.apy?ca(new oe(null===(i=l.apy)||void 0===i?void 0:i.transactionBaseApy).plus(null!==(r=null===(o=l.apy)||void 0===o?void 0:o.miningBaseApy)&&void 0!==r?r:0)):void 0,u=f.utils.singleSideLp(l.type)&&l.apy?ca(new oe(l.apy.transactionQuoteApy).plus(null!==(a=l.apy.miningQuoteApy)&&void 0!==a?a:0)):void 0;return s&&d?Gt.jsxs(x,{onClick:t,sx:{display:"flex",justifyContent:"space-between",alignItems:"center",px:10,py:20,borderRadius:8,cursor:"pointer","&:hover":{backgroundColor:"custom.background.listHover"}},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[Gt.jsx(mu,{tokens:[s,d],chainId:l.chainId,width:24,mr:10}),Gt.jsxs(x,{sx:{typography:"h5"},children:[s.symbol,"/",d.symbol]})]}),Gt.jsxs(x,{children:[Gt.jsxs(x,{sx:{color:"custom.status.green.default",fontWeight:600},children:[c,u?`/${u}`:""]}),Gt.jsx(x,{sx:{mt:2,typography:"h6",color:"text.secondary"},children:Gt.jsx(n,{id:"rSayea",message:"APY"})})]})]},l.id):null}))})}function Cm(){const[e,t]=G.useState([]),[n,i]=G.useState([]),[o,r]=G.useMemo((()=>{const[t,n]=e;return[null==t?void 0:t.symbol,null==n?void 0:n.symbol]}),[e]);return{filterTokens:e,filterASymbol:o,filterBSymbol:r,filterAddressLqList:n,handleDeleteToken:e=>{t((t=>{const n=[...t],i=n.indexOf(e);return-1!==i&&n.splice(i,1),n}))},handleChangeFilterTokens:e=>{i([]),t(e)},handleChangeFilterAddress:e=>{i(e),t([])}}}function km({lqList:e,setOperatePool:t,supportAMM:i}){const o=y();return Gt.jsx(Gt.Fragment,{children:null==e?void 0:e.map((e=>{var r,a,l,s,d,c,u;if(!(null==e?void 0:e.pair))return null;const p=e.pair,h=Lp(p.baseToken,p.chainId),m=Lp(p.quoteToken,p.chainId),g=p.apy?ca(new oe(null===(r=p.apy)||void 0===r?void 0:r.transactionBaseApy).plus(null!==(l=null===(a=p.apy)||void 0===a?void 0:a.miningBaseApy)&&void 0!==l?l:0)):void 0,y=f.utils.singleSideLp(p.type)&&p.apy?ca(new oe(p.apy.transactionQuoteApy).plus(null!==(s=p.apy.miningQuoteApy)&&void 0!==s?s:0)):void 0,v=!!(null===(d=p.miningAddress)||void 0===d?void 0:d[0]),j=Vp(p.type);return Gt.jsx(x,{sx:{p:8,borderRadius:20,borderWidth:1,borderStyle:"solid",borderColor:"border.main",backgroundColor:"border.disabled",backdropFilter:"blur(5px)"},children:Gt.jsxs(x,{sx:{px:20,pt:20,pb:12,backgroundColor:"background.paper",borderRadius:16,borderWidth:1,borderStyle:"solid",borderColor:"border.main"},className:"gradient-card-border",onClick:()=>{i||zc.getState().push({type:Yc.PoolDetail,params:{chainId:p.chainId,address:p.id}})},children:[Gt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap"},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:8},children:[h&&m?Gt.jsx(mu,{tokens:[h,m],width:24,mr:6,chainId:p.chainId,showChainLogo:!0}):"",Gt.jsxs(x,{sx:{typography:"body2",fontWeight:600},children:[`${null==h?void 0:h.symbol}/${null==m?void 0:m.symbol}`,Gt.jsx(om,{address:p.id,chainId:p.chainId})]})]}),v?Gt.jsxs(x,{sx:{p:8,typography:"h6",fontWeight:"bold",background:`linear-gradient(180deg, ${L(o.palette.secondary.main,.3)} 0%, ${L(o.palette.purple.main,.3)} 100%)`,borderRadius:8,color:"purple.main",whiteSpace:"nowrap"},children:["✨ ",Gt.jsx(n,{id:"Sti4vy",message:"Mining"})]}):""]}),Gt.jsxs(x,{sx:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",rowGap:20,mt:44,"& > div:nth-child(odd)":{pr:20},"& > div:nth-child(even)":{position:"relative",pl:20,"&::before":{position:"absolute",left:0,top:"50%",transform:"translateY(-50%)",display:"inline-block",content:'""',height:24,width:"1px",backgroundColor:"border.main"}}},children:[i&&Gt.jsxs(x,{children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,whiteSpace:"nowrap"},children:[j,Gt.jsx(W,{title:Gt.jsx(n,{id:"O6RUgz",message:"Fee rate"}),children:Gt.jsx(x,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary"},children:Ap({type:p.type,lpFeeRate:null!==(c=p.lpFeeRate)&&void 0!==c?c:0,mtFeeRate:null!==(u=p.mtFeeRate)&&void 0!==u?u:0})})})]}),Gt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:Gt.jsx(n,{id:"1Qz63U",message:"Pool Type"})})]}),Gt.jsxs(x,{children:[Gt.jsxs(x,{sx:{typography:"h5",color:"success.main"},children:[g,y?`/${y}`:""]}),Gt.jsxs(x,{sx:{typography:"h6",display:"flex",alignItems:"center",color:"text.secondary"},children:[Gt.jsx(n,{id:"rSayea",message:"APY"}),Gt.jsx(bm,{chainId:p.chainId,apy:p.apy,baseToken:h,quoteToken:m,hasQuote:!!y,hasMining:v,sx:{width:14,height:14}})]})]}),Gt.jsxs(x,{children:[Gt.jsxs(x,{sx:{typography:"h5"},children:["$",sa(new oe(p.tvl))]}),Gt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:Gt.jsx(n,{id:"FHKsZF",message:"TVL"})})]}),i&&Gt.jsxs(x,{children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4},children:["$",Qr({input:p.volume24H||0})]}),Gt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:Gt.jsx(n,{id:"Q8W3SC",message:"Volume (1D)"})})]})]}),Gt.jsxs(x,{sx:{mt:20,display:"flex",gap:"8px"},children:[Gt.jsx(gc,{fullWidth:!0,size:b.Size.small,onClick:n=>{n.stopPropagation(),t({pool:Op(e),hasMining:v})},children:Gt.jsx(n,{id:"m16xKo",message:"Add"})}),i&&"PMM"===j&&Gt.jsx(xm,{chainId:p.chainId,address:p.id})]})]})},p.id+p.chainId)}))})}function Rm({lqList:e,operatePool:t,setOperatePool:o,hasMore:r,loadMore:a,loadMoreLoading:l,supportAMM:s}){const d=y();return Gt.jsxs(ym,{hasMore:r,loadMore:a,loadMoreLoading:l,children:[Gt.jsx(x,{component:"thead",children:Gt.jsxs(x,{component:"tr",children:[Gt.jsx(x,{component:"th",children:Gt.jsx(n,{id:"AxdOHo",message:"Pair"})}),s&&Gt.jsx(x,{component:"th",children:Gt.jsx(n,{id:"1Qz63U",message:"Pool Type"})}),Gt.jsx(x,{component:"th",children:Gt.jsx(n,{id:"FHKsZF",message:"TVL"})}),Gt.jsx(x,{component:"th",children:Gt.jsx(n,{id:"rSayea",message:"APY"})}),s&&Gt.jsx("th",{children:Gt.jsx(n,{id:"Q8W3SC",message:"Volume (1D)"})}),Gt.jsx(x,{component:"th",sx:{width:80}})]})}),Gt.jsx(x,{component:"tbody",children:null==e?void 0:e.map((e=>{var r,a,l,c,u,p,h,m;if(!(null==e?void 0:e.pair))return null;const g=e.pair,y=Lp(g.baseToken,g.chainId),v=Lp(g.quoteToken,g.chainId),j=g.apy?ca(new oe(null===(r=g.apy)||void 0===r?void 0:r.transactionBaseApy).plus(null!==(l=null===(a=g.apy)||void 0===a?void 0:a.miningBaseApy)&&void 0!==l?l:0)):void 0,w=f.utils.singleSideLp(g.type)&&g.apy?ca(new oe(g.apy.transactionQuoteApy).plus(null!==(c=g.apy.miningQuoteApy)&&void 0!==c?c:0)):void 0;let C="";if((null===(u=null==t?void 0:t.pool)||void 0===u?void 0:u.address)===g.id||(null==t?void 0:t.address)===g.id)if(t.operate===Zh.Remove)C=i._({id:"0+31GV",message:"Removing"});else C=i._({id:"1yHVE+",message:"Adding"});const k=!!(null===(p=g.miningAddress)||void 0===p?void 0:p[0]),R=Vp(g.type),S=d.palette.background.tag;return Gt.jsxs(x,{component:"tr",sx:{["&:hover td"+(C?", & td":"")]:{backgroundImage:`linear-gradient(${S}, ${S})`}},children:[Gt.jsx(x,{component:"td",children:Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[y&&v?Gt.jsx(mu,{tokens:[y,v],width:24,mr:10,chainId:g.chainId,showChainLogo:!0}):"",Gt.jsxs(x,{children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,typography:"body2",fontWeight:600},children:[`${null==y?void 0:y.symbol}/${null==v?void 0:v.symbol}`,Gt.jsx(om,{address:g.id,chainId:g.chainId})]}),Gt.jsx(pu,{address:g.id,customChainId:g.chainId,truncate:!0,showCopy:!0,iconDarkHover:!0,iconSize:14,iconSpace:4,sx:{typography:"h6",color:"text.secondary"},disabledAddress:s,onAddressClick:()=>{zc.getState().push({type:Yc.PoolDetail,params:{chainId:g.chainId,address:g.id}})}})]})]})}),s&&Gt.jsx(x,{component:"td",children:Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4},children:[Gt.jsx(x,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary",whiteSpace:"nowrap"},children:R}),Gt.jsx(W,{title:Gt.jsx(n,{id:"O6RUgz",message:"Fee rate"}),children:Gt.jsx(x,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary"},children:Ap({type:g.type,lpFeeRate:null!==(h=g.lpFeeRate)&&void 0!==h?h:0,mtFeeRate:null!==(m=g.mtFeeRate)&&void 0!==m?m:0})})})]})}),Gt.jsx(x,{component:"td",children:Gt.jsxs(x,{sx:{typography:"body2"},title:g.tvl?`$${Qr({input:g.tvl})}`:void 0,children:["$",sa(new oe(g.tvl))]})}),Gt.jsx(x,{component:"td",children:Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[k?Gt.jsx(W,{title:i._({id:"Sti4vy",message:"Mining"}),children:Gt.jsxs(x,{component:"span",sx:{typography:"body2",color:"success.main"},children:["✨"," "]})}):"",Gt.jsx(bm,{chainId:g.chainId,apy:g.apy,baseToken:y,quoteToken:v,hasQuote:!!w,hasMining:k,children:Gt.jsxs(x,{component:"span",sx:{typography:"body2",fontWeight:600,display:"flex",alignItems:"center",width:"max-content",color:"success.main",cursor:"auto"},children:[j,w?`/${w}`:""]})})]})}),s&&Gt.jsxs(x,{component:"td",children:["$",Qr({input:g.volume24H||0})]}),Gt.jsx(x,{component:"td",children:Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"8px"},children:[s&&"PMM"===R&&Gt.jsx(xm,{chainId:g.chainId,address:g.id}),C?Gt.jsx(mm,{text:C,onClick:()=>o(null)}):Gt.jsx(b,{size:b.Size.small,onClick:()=>{o({pool:Op(e),hasMining:k})},children:i._({id:"m16xKo",message:"Add"})})]})})]},g.id+g.chainId)}))})]})}function Sm({scrollParentRef:e,filterChainIds:t,activeChainId:n,handleChangeActiveChainId:i,operatePool:o,setOperatePool:r}){var a;const{onlyChainId:l,supportAMMV2:s,supportAMMV3:d,notSupportPMM:c}=Zr(),{minDevice:u,isMobile:p}=Ec(),h=je(),{filterTokens:m,filterASymbol:g,filterBSymbol:y,filterAddressLqList:v,handleDeleteToken:b,handleChangeFilterTokens:j,handleChangeFilterAddress:w}=Cm(),C=[];s&&C.push("SVM_AMMV2"),d&&C.push("SVM_AMMV3");const k={chainIds:t,pageSize:p?4:8,filterState:{viewOnlyOwn:!1,filterTypes:C}},R=el(),S=R.getInfiniteQuery(f.graphql.fetchLiquidityList,"currentPage",{where:Object.assign(Object.assign({},k),{filterState:Object.assign({filterASymbol:g,filterBSymbol:y},k.filterState)})}),I=Se(Object.assign(Object.assign({},S),{initialPageParam:1,getNextPageParam:e=>{var t;const{currentPage:n,totalCount:i,pageSize:o}=null!==(t=e.liquidity_list)&&void 0!==t?t:{};if(!n||!i||!o)return null;let r=Math.floor(i/o);return i%o&&(r+=1),n>=r?null:n+1}}));let E=[];const M=!!(null==v?void 0:v.length);M?E=[...v]:null===(a=I.data)||void 0===a||a.pages.forEach((e=>{var t,n;null===(n=null===(t=e.liquidity_list)||void 0===t?void 0:t.lqList)||void 0===n||n.forEach((e=>{null==E||E.push(e)}))}));const T=I.hasNextPage&&!M;return Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs(x,{sx:Object.assign(Object.assign({py:16,display:"flex",gap:8},u(475)?{}:{flexDirection:"column"}),p?{}:{px:20,borderBottomWidth:1}),children:[Gt.jsxs(x,{sx:Object.assign({display:"flex",alignItems:"center",gap:8},u(475)?{}:{"& > button":{flex:1}}),children:[!l&&Gt.jsx(hm,{chainId:n,setChainId:i}),Gt.jsx(jm,{value:m,onChange:j,searchAddress:(e,t)=>Vr(this,void 0,void 0,(function*(){var n;const i=R.getInfiniteQuery(f.graphql.fetchLiquidityList,"currentPage",{where:Object.assign(Object.assign({},k),{filterState:Object.assign({address:e},k.filterState)})}),o=null===(n=(yield h.fetchQuery(i)).liquidity_list)||void 0===n?void 0:n.lqList;return(null==o?void 0:o.length)?Gt.jsx(wm,{list:o,onClick:()=>{w(o),t()}}):null}))})]}),(M||!!m.length)&&Gt.jsxs(x,{sx:{my:0},children:[M?Gt.jsx(fm,{lqList:v,onDeleteTag:()=>w([])}):"",Gt.jsx(gm,{tags:m,onDeleteTag:b})]})]}),p?Gt.jsx(Wt,{hasMore:T,threshold:300,loadMore:ce((()=>{I.hasNextPage&&!I.isFetching&&I.fetchNextPage()}),500),useWindow:!1,getScrollParent:()=>e.current||null,loader:Gt.jsx(vm,{sx:{mt:20}},"loader"),children:Gt.jsxs(im,{gap:12,children:[I.isLoading?Gt.jsx(vm,{}):"",!I.isLoading&&!(null==E?void 0:E.length)&&!I.error&&Gt.jsx(Kh,{sx:{mt:40},hasSearch:!!(n&&!l||g||y)}),!!I.error&&Gt.jsx(tm,{refresh:I.refetch,sx:{mt:40}}),Gt.jsx(km,{lqList:E,setOperatePool:r,supportAMM:s||d})]})}):Gt.jsxs(Gt.Fragment,{children:[Gt.jsx(Rm,{lqList:E,operatePool:o,setOperatePool:r,hasMore:T,loadMoreLoading:I.isFetchingNextPage,loadMore:()=>{I.hasNextPage&&!I.isFetching&&I.fetchNextPage()},supportAMM:s||d}),Gt.jsx(nm,{loading:I.isLoading,refetch:I.error?I.refetch:void 0,empty:!(null==E?void 0:E.length),hasSearch:!!(n&&!l||g||y)})]})]})}function Im({onClick:e,title:t,desc:n}){const i=y();return Gt.jsx(x,{sx:{mx:20,px:0,py:14,borderTop:`1px solid ${i.palette.border.main}`,[i.breakpoints.up("tablet")]:{borderTop:"none",mx:0,px:16,py:8}},children:Gt.jsxs(M,{onClick:e,sx:{width:"100%",display:"flex",flexDirection:"column",gap:0,p:0,borderRadius:8,"&:hover":{backgroundColor:i.palette.background.tag},[i.breakpoints.up("tablet")]:{p:8}},children:[Gt.jsx(x,{sx:{typography:"body1",fontWeight:600,color:i.palette.text.primary,textAlign:"left"},children:t}),Gt.jsx(x,{sx:{typography:"h6",fontWeight:500,color:i.palette.text.secondary,textAlign:"left"},children:n})]})})}const Em=e=>{const t=y(),{isMobile:i}=Ec(),{supportAMMV2:o,supportAMMV3:r,notSupportPMM:a}=Zr(),[l,s]=G.useState(!1),d={[Yc.CreatePool]:!a,[Yc.createPoolAMMV2]:!!o,[Yc.createPoolAMMV3]:!!r},c=Object.entries(d).filter((([e,t])=>!0===t)),u=1===c.length?c[0][0]:void 0;if(!u){const e=Gt.jsxs(Gt.Fragment,{children:[!a&&Gt.jsx(Im,{onClick:()=>{zc.getState().push({type:Yc.CreatePool})},title:Gt.jsx(n,{id:"Eif7f6",message:"PMM Pool"}),desc:Gt.jsx(n,{id:"ukTFO0",message:"Description of this type of pool"})}),o&&Gt.jsx(Im,{onClick:()=>{zc.getState().push({type:Yc.createPoolAMMV2})},title:Gt.jsx(n,{id:"lNYomJ",message:"AMM V2 Position"}),desc:Gt.jsx(n,{id:"ukTFO0",message:"Description of this type of pool"})}),r&&Gt.jsx(Im,{onClick:()=>{zc.getState().push({type:Yc.createPoolAMMV3})},title:Gt.jsx(n,{id:"sVlqoo",message:"AMM V3 Position"}),desc:Gt.jsx(n,{id:"ukTFO0",message:"Description of this type of pool"})})]});return i?Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs(b,{variant:b.Variant.outlined,fullWidth:i,onClick:()=>{s(!0)},sx:{height:40},children:[Gt.jsx(x,{component:Ft.Plus,sx:{mr:4}}),Gt.jsx(n,{id:"p2jbcE",message:"Create Pool"})]}),Gt.jsx(oc,{open:l,title:Gt.jsx(n,{id:"p2jbcE",message:"Create Pool"}),onClose:()=>{s(!1)},modal:!0,children:Gt.jsx(x,{sx:{mb:0},children:e})})]}):Gt.jsx(W,{arrow:!1,leaveDelay:300,placement:i?"bottom":"bottom-end",sx:{p:0,backgroundColor:"background.paper"},title:Gt.jsx(x,{children:e}),children:Gt.jsxs(x,{sx:{width:i?"100%":"auto",display:"inline-flex",alignItems:"center",justifyContent:"center",gap:10,pl:8,pr:16,py:7,borderRadius:8,borderWidth:1,borderColor:t.palette.text.primary,typography:"body1",fontWeight:600,color:t.palette.text.primary,cursor:"pointer","&:hover":{backgroundColor:t.palette.background.tag}},children:[Gt.jsx(x,{component:Ft.Plus}),Gt.jsx(n,{id:"p2jbcE",message:"Create Pool"})]})})}return Gt.jsxs(b,{variant:b.Variant.outlined,fullWidth:i,onClick:()=>{zc.getState().push({type:u})},sx:{height:40},children:[Gt.jsx(x,{component:Ft.Plus,sx:{mr:4}}),Gt.jsx(n,{id:"p2jbcE",message:"Create Pool"})]})};const Mm=({onlyV3:e,setOnlyV3:t,sx:n})=>{const o=y(),{notSupportPMM:r}=Zr();return Gt.jsx(x,{component:M,onClick:()=>t(!e),sx:Object.assign({display:"flex",alignItems:"center",p:2,borderRadius:8,backgroundColor:o.palette.border.main},n),children:Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",width:"100%",[o.breakpoints.up("tablet")]:{width:194}},children:[Gt.jsx(x,{sx:Object.assign({flex:1,width:0,pt:4,pb:5,borderRadius:6,textAlign:"center",typography:"body2",whiteSpace:"nowrap"},e?{color:o.palette.text.primary,backgroundColor:o.palette.background.paper}:{color:o.palette.text.secondary,backgroundColor:"transparent"}),children:i._({id:"yoR+O6",message:"V3"})}),Gt.jsx(x,{sx:Object.assign({flex:1,width:0,pt:4,pb:5,borderRadius:6,textAlign:"center",typography:"body2",whiteSpace:"nowrap"},e?{color:o.palette.text.secondary,backgroundColor:"transparent"}:{color:o.palette.text.primary,backgroundColor:o.palette.background.paper}),children:r?"V2":i._({id:"eK6I8d",message:"V2 & PMM"})})]})})};function Tm({account:e,lqList:t,setOperatePool:i,supportAMM:o}){const r=y();return Gt.jsx(Gt.Fragment,{children:null==t?void 0:t.map((t=>{var a,l,s,d,c,u,p,h,m,g,y,v,j,w;if(!(null==t?void 0:t.pair))return null;const C=t.pair,k=Lp(C.baseToken,C.chainId),R=Lp(C.quoteToken,C.chainId),S=f.utils.singleSideLp(C.type),I=C.apy?ca(new oe(null===(a=C.apy)||void 0===a?void 0:a.transactionBaseApy).plus(null!==(s=null===(l=C.apy)||void 0===l?void 0:l.miningBaseApy)&&void 0!==s?s:0)):"0%",E=S&&C.apy?ca(new oe(C.apy.transactionQuoteApy).plus(null!==(d=C.apy.miningQuoteApy)&&void 0!==d?d:0)):void 0;let M,T;(null===(c=t.liquidityPositions)||void 0===c?void 0:c.length)&&t.liquidityPositions.forEach((e=>{var t,n,i,o,r;if(null==e?void 0:e.liquidityTokenBalance){const a=null===(t=e.id)||void 0===t?void 0:t.split("-");if(2===(null==a?void 0:a.length)){const t=a[1].toLocaleLowerCase();if((null===(i=null===(n=null==C?void 0:C.baseLpToken)||void 0===n?void 0:n.id)||void 0===i?void 0:i.toLocaleLowerCase())===t)return void(M=new oe(e.liquidityTokenBalance));(null===(r=null===(o=null==C?void 0:C.quoteLpToken)||void 0===o?void 0:o.id)||void 0===r?void 0:r.toLocaleLowerCase())===t&&(T=new oe(e.liquidityTokenBalance))}}}));const O=!!(null===(u=C.miningAddress)||void 0===u?void 0:u[0]),V=null===(p=t.liquidityPositions)||void 0===p?void 0:p[0],A=C.type,F=Vp(A),Z="SVM_AMMV2"===A,P="SVM_AMMV3"===A;return Gt.jsx(x,{sx:{p:8,borderRadius:20,borderWidth:1,borderStyle:"solid",borderColor:"border.main",backgroundColor:"border.disabled",backdropFilter:"blur(5px)"},children:Gt.jsxs(x,{sx:{px:20,pt:20,pb:12,backgroundColor:"background.paper",borderRadius:16,borderWidth:1,borderStyle:"solid",borderColor:"border.main"},className:"gradient-card-border",onClick:()=>{o||zc.getState().push({type:Yc.PoolDetail,params:{chainId:C.chainId,address:C.id}})},children:[Gt.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap"},children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:8},children:[k&&R?Gt.jsx(mu,{tokens:[k,R],width:24,mr:6,chainId:C.chainId,showChainLogo:!0}):"",Gt.jsxs(x,{sx:{typography:"body2",fontWeight:600},children:[`${null==k?void 0:k.symbol}/${null==R?void 0:R.symbol}`,Gt.jsx(om,{address:C.id,chainId:C.chainId})]})]}),O?Gt.jsxs(x,{sx:{p:8,typography:"h6",fontWeight:"bold",background:`linear-gradient(180deg, ${L(r.palette.secondary.main,.3)} 0%, ${L(r.palette.purple.main,.3)} 100%)`,borderRadius:8,color:"purple.main",whiteSpace:"nowrap"},children:["✨ ",Gt.jsx(n,{id:"Sti4vy",message:"Mining"})]}):""]}),Gt.jsxs(x,{sx:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",rowGap:20,mt:44,"& > div:nth-child(odd)":{pr:20},"& > div:nth-child(even)":{position:"relative",pl:20,"&::before":{position:"absolute",left:0,top:"50%",transform:"translateY(-50%)",display:"inline-block",content:'""',height:24,width:"1px",backgroundColor:"border.main"}}},children:[o&&Gt.jsxs(x,{children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,whiteSpace:"nowrap"},children:[F,Gt.jsx(W,{title:Gt.jsx(n,{id:"O6RUgz",message:"Fee rate"}),children:Gt.jsx(x,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary"},children:Ap({type:C.type,lpFeeRate:null!==(h=C.lpFeeRate)&&void 0!==h?h:0,mtFeeRate:null!==(m=C.mtFeeRate)&&void 0!==m?m:0})})})]}),Gt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:Gt.jsx(n,{id:"1Qz63U",message:"Pool Type"})})]}),P?null:Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs(x,{children:[Gt.jsxs(x,{sx:{typography:"h5",color:"success.main"},children:[I,E?`/${E}`:""]}),Gt.jsxs(x,{sx:{typography:"h6",display:"flex",alignItems:"center",color:"text.secondary"},children:[Gt.jsx(n,{id:"rSayea",message:"APY"}),Gt.jsx(bm,{chainId:C.chainId,apy:C.apy,baseToken:k,quoteToken:R,hasQuote:!!E,hasMining:O,sx:{width:14,height:14}})]})]}),Gt.jsxs(x,{children:[Gt.jsxs(x,{sx:{typography:"h5"},children:["$",sa(new oe(C.tvl||0))]}),Gt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:Gt.jsx(n,{id:"FHKsZF",message:"TVL"})})]})]}),Z&&Gt.jsxs(x,{children:[Gt.jsx(x,{sx:{typography:"h5"},children:da({input:null===(y=null===(g=t.liquidityPositions)||void 0===g?void 0:g[0])||void 0===y?void 0:y.poolShare})}),Gt.jsx(x,{sx:{typography:"h6",color:"text.secondary"},children:Gt.jsx(n,{id:"h3PbRN",message:"My Pool Share"})})]}),Gt.jsxs(x,{children:[Gt.jsx(x,{sx:{typography:"h5",display:"flex",alignItems:"center",fontWeight:"bold"},children:P?(null==V?void 0:V.liquidityUSD)?`$${Kr({input:V.liquidityUSD,decimals:2})}`:"-":Gt.jsxs(Gt.Fragment,{children:[S?Gt.jsx(Ms,{address:null==k?void 0:k.address,chainId:C.chainId,url:null==k?void 0:k.logoURI,width:18,height:18,sx:{mr:4}}):Gt.jsx(mu,{tokens:k&&R?[k,R]:[],width:18,mr:4,showChainLogo:!1,chainId:C.chainId}),M?Qr({input:M}):"",S&&Gt.jsxs(Gt.Fragment,{children:[" / ",Gt.jsx(Ms,{address:null==R?void 0:R.address,chainId:C.chainId,url:null==R?void 0:R.logoURI,width:18,height:18,sx:{mx:4}}),T?Qr({input:T}):"0"]})]})}),Gt.jsx(x,{sx:{typography:"h6",display:"flex",alignItems:"center",color:"text.secondary"},children:Gt.jsx(n,{id:"YHc3B+",message:"My Liquidity"})})]}),P&&Gt.jsxs(x,{children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,color:"text.primary"},children:[Gt.jsx(Wh,{outOfRange:null!==(v=null==V?void 0:V.outOfRange)&&void 0!==v&&v}),Gt.jsx(x,{children:Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs("span",{children:[Pp({price:null===(j=null==V?void 0:V.priceRange)||void 0===j?void 0:j.token0LowerPrice,atLimit:{},direction:Pu.LOWER})," "]}),null==k?void 0:k.symbol]})}),Gt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"19",viewBox:"0 0 18 19",fill:"none",children:Gt.jsx("path",{d:"M15.75 9.50293L12.75 12.5029L11.7 11.4529L12.8813 10.2529L5.11875 10.2529L6.3 11.4529L5.25 12.5029L2.25 9.50293L5.25 6.50293L6.31875 7.55293L5.11875 8.75293L12.8813 8.75293L11.7 7.55293L12.75 6.50293L15.75 9.50293Z",fill:"currentColor",fillOpacity:"0.5"})}),Gt.jsx(x,{children:Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs("span",{children:[Pp({price:null===(w=null==V?void 0:V.priceRange)||void 0===w?void 0:w.token1LowerPrice,atLimit:{},direction:Pu.UPPER})," "]}),null==k?void 0:k.symbol]})})]}),Gt.jsx(x,{sx:{typography:"h6",display:"flex",alignItems:"center",color:"text.secondary"},children:Gt.jsx(n,{id:"YA4hwj",message:"Price Range"})})]})]}),Gt.jsxs(x,{sx:{mt:20,display:"flex",gap:"8px"},children:[P?null:!!e&&Gt.jsx(gc,{fullWidth:!0,variant:b.Variant.outlined,size:b.Size.small,onClick:e=>{e.stopPropagation(),i({operate:Zh.Remove,pool:Wp(t),hasMining:O})},children:Gt.jsx(n,{id:"t/YqKh",message:"Remove"})}),Gt.jsx(gc,{fullWidth:!0,size:b.Size.small,onClick:e=>{e.stopPropagation(),i({operate:Zh.Add,pool:Wp(t),hasMining:O})},children:Gt.jsx(n,{id:"J/hVSQ",message:"{0}",values:{0:P?"Manage":"Add"}})}),o&&"PMM"===F&&Gt.jsx(xm,{chainId:C.chainId,address:C.id})]})]})},P?null==V?void 0:V.id:C.id+C.chainId)}))})}function Lm({account:e,lqList:t,operatePool:o,setOperatePool:r,supportAMM:a,onlyV3:l}){const s=y();return Gt.jsxs(ym,{children:[Gt.jsx(x,{component:"thead",children:Gt.jsxs(x,{component:"tr",children:[Gt.jsx(x,{component:"th",children:Gt.jsx(n,{id:"AxdOHo",message:"Pair"})}),a&&Gt.jsx(x,{component:"th",children:Gt.jsx(n,{id:"1Qz63U",message:"Pool Type"})}),l?null:Gt.jsx(x,{component:"th",children:Gt.jsx(n,{id:"FHKsZF",message:"TVL"})}),l?null:Gt.jsx(x,{component:"th",children:Gt.jsx(n,{id:"rSayea",message:"APY"})}),Gt.jsx(x,{component:"th",children:Gt.jsx(n,{id:"YHc3B+",message:"My Liquidity"})}),l?Gt.jsx(x,{component:"th",children:Gt.jsx(n,{id:"YA4hwj",message:"Price Range"})}):null,Gt.jsx(x,{component:"th",sx:{width:210}})]})}),Gt.jsx(x,{component:"tbody",children:null==t?void 0:t.map((t=>{var d,c,u,p,h,m,g,y,v,j,w,C,k,R,S,I,E,M;if(!(null==t?void 0:t.pair))return null;const T=t.pair,L=Lp(T.baseToken,T.chainId),O=Lp(T.quoteToken,T.chainId),V=f.utils.singleSideLp(T.type),A=T.apy?ca(new oe(null===(d=T.apy)||void 0===d?void 0:d.transactionBaseApy).plus(null!==(u=null===(c=T.apy)||void 0===c?void 0:c.miningBaseApy)&&void 0!==u?u:0)):void 0,F=V&&T.apy?ca(new oe(T.apy.transactionQuoteApy).plus(null!==(p=T.apy.miningQuoteApy)&&void 0!==p?p:0)):void 0;let Z,P;(null===(h=t.liquidityPositions)||void 0===h?void 0:h.length)&&t.liquidityPositions.forEach((e=>{var t,n,i,o,r;if(null==e?void 0:e.liquidityTokenBalance){const a=null===(t=e.id)||void 0===t?void 0:t.split("-");if(2===(null==a?void 0:a.length)){const t=a[1].toLocaleLowerCase();if((null===(i=null===(n=null==T?void 0:T.baseLpToken)||void 0===n?void 0:n.id)||void 0===i?void 0:i.toLocaleLowerCase())===t)return void(Z=new oe(e.liquidityTokenBalance));(null===(r=null===(o=null==T?void 0:T.quoteLpToken)||void 0===o?void 0:o.id)||void 0===r?void 0:r.toLocaleLowerCase())===t&&(P=new oe(e.liquidityTokenBalance))}}}));const B=null===(m=t.liquidityPositions)||void 0===m?void 0:m[0],N=T.type,U=Vp(N),H="SVM_AMMV2"===N,D="SVM_AMMV3"===N;let Y="";if(D)(null===(v=null===(y=null===(g=null==o?void 0:o.pool)||void 0===g?void 0:g.liquidityPositions)||void 0===y?void 0:y[0])||void 0===v?void 0:v.id)===(null==B?void 0:B.id)&&(Y=i._({id:"p3607o",message:"Managing"}));else if((null===(j=null==o?void 0:o.pool)||void 0===j?void 0:j.address)===T.id||(null==o?void 0:o.address)===T.id)if(o.operate===Zh.Remove)Y=i._({id:"0+31GV",message:"Removing"});else Y=i._({id:"1yHVE+",message:"Adding"});const z=!!(null===(w=T.miningAddress)||void 0===w?void 0:w[0]),X=s.palette.background.tag;return Gt.jsxs(x,{component:"tr",sx:{["&:hover td"+(Y?", & td":"")]:{backgroundImage:`linear-gradient(${X}, ${X})`}},children:[Gt.jsx(x,{component:"td",children:Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[L&&O?Gt.jsx(mu,{tokens:[L,O],width:24,mr:10,chainId:T.chainId,showChainLogo:!0}):"",Gt.jsxs(x,{children:[Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,typography:"body2",fontWeight:600},children:[`${null==L?void 0:L.symbol}/${null==O?void 0:O.symbol}`,Gt.jsx(om,{address:T.id,chainId:T.chainId})]}),Gt.jsx(pu,{address:T.id,customChainId:T.chainId,truncate:!0,showCopy:!0,iconDarkHover:!0,iconSize:14,iconSpace:4,disabledAddress:a,onAddressClick:()=>{zc.getState().push({type:Yc.PoolDetail,params:{chainId:T.chainId,address:T.id}})},sx:{typography:"h6",color:"text.secondary"}})]})]})}),a&&Gt.jsx(x,{component:"td",children:Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4},children:[Gt.jsx(x,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary",whiteSpace:"nowrap"},children:U}),Gt.jsx(W,{title:Gt.jsx(n,{id:"O6RUgz",message:"Fee rate"}),children:Gt.jsx(x,{sx:{px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary"},children:Ap({type:T.type,lpFeeRate:null!==(C=T.lpFeeRate)&&void 0!==C?C:0,mtFeeRate:null!==(k=T.mtFeeRate)&&void 0!==k?k:0})})})]})}),D?null:Gt.jsx(x,{component:"td",children:Gt.jsxs(x,{sx:{typography:"body2"},title:T.tvl?`$${Qr({input:T.tvl||0})}`:void 0,children:["$",sa(new oe(T.tvl||0))]})}),D?null:Gt.jsx(x,{component:"td",children:Gt.jsxs(x,{sx:{display:"flex",alignItems:"center"},children:[z?Gt.jsx(W,{title:i._({id:"Sti4vy",message:"Mining"}),children:Gt.jsxs(x,{component:"span",sx:{typography:"body2",color:"success.main"},children:["✨"," "]})}):"",Gt.jsx(bm,{chainId:T.chainId,apy:T.apy,baseToken:L,quoteToken:O,hasQuote:!!F,hasMining:z,children:Gt.jsxs(x,{component:"span",sx:{typography:"body2",fontWeight:600,display:"flex",alignItems:"center",width:"max-content",color:"success.main",cursor:"auto"},children:[A||"0%",F?`/${F}`:""]})})]})}),Gt.jsx(x,{component:"td",children:Gt.jsx(x,{sx:{display:"flex",alignItems:"center"},children:D?(null==B?void 0:B.liquidityUSD)?`$${Kr({input:B.liquidityUSD,decimals:2})}`:"-":Gt.jsxs(Gt.Fragment,{children:[V?Gt.jsx(Ms,{address:null==L?void 0:L.address,chainId:T.chainId,url:null==L?void 0:L.logoURI,width:24,height:24,noShowChain:!0,sx:{mr:4}}):Gt.jsx(mu,{tokens:L&&O?[L,O]:[],width:24,mr:4,showChainLogo:!1,chainId:T.chainId}),Z?Qr({input:Z}):"-",V&&Gt.jsxs(Gt.Fragment,{children:[" / ",Gt.jsx(Ms,{address:null==O?void 0:O.address,chainId:T.chainId,url:null==O?void 0:O.logoURI,width:24,height:24,noShowChain:!0,sx:{mx:4}}),P?Qr({input:P}):"0"]}),H&&Gt.jsx(W,{title:Gt.jsx(n,{id:"NXZdrO",message:"My pool share"}),children:Gt.jsx(x,{sx:{ml:4,px:8,py:4,borderRadius:4,typography:"h6",backgroundColor:"background.tag",color:"text.secondary"},children:da({input:null===(S=null===(R=t.liquidityPositions)||void 0===R?void 0:R[0])||void 0===S?void 0:S.poolShare})})})]})})}),l?Gt.jsx(x,{component:"td",children:Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:4,color:"text.primary"},children:[Gt.jsx(Wh,{outOfRange:null!==(I=null==B?void 0:B.outOfRange)&&void 0!==I&&I}),Gt.jsx(x,{children:Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs("span",{children:[Pp({price:null===(E=null==B?void 0:B.priceRange)||void 0===E?void 0:E.token0LowerPrice,atLimit:{},direction:Pu.LOWER})," "]}),null==L?void 0:L.symbol]})}),Gt.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"19",viewBox:"0 0 18 19",fill:"none",children:Gt.jsx("path",{d:"M15.75 9.50293L12.75 12.5029L11.7 11.4529L12.8813 10.2529L5.11875 10.2529L6.3 11.4529L5.25 12.5029L2.25 9.50293L5.25 6.50293L6.31875 7.55293L5.11875 8.75293L12.8813 8.75293L11.7 7.55293L12.75 6.50293L15.75 9.50293Z",fill:"currentColor",fillOpacity:"0.5"})}),Gt.jsx(x,{children:Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs("span",{children:[Pp({price:null===(M=null==B?void 0:B.priceRange)||void 0===M?void 0:M.token0UpperPrice,atLimit:{},direction:Pu.UPPER})," "]}),null==L?void 0:L.symbol]})})]})}):null,Gt.jsx(x,{component:"td",children:Gt.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"8px"},children:[a&&"PMM"===U&&Gt.jsx(xm,{chainId:T.chainId,address:T.id}),Y?Gt.jsx(mm,{text:Y,onClick:()=>r(null)}):Gt.jsxs(Gt.Fragment,{children:[D?null:!!e&&Gt.jsx(gc,{variant:b.Variant.outlined,size:b.Size.small,onClick:e=>{e.stopPropagation(),r({operate:Zh.Remove,pool:Wp(t),hasMining:z})},children:Gt.jsx(n,{id:"t/YqKh",message:"Remove"})}),Gt.jsx(gc,{size:b.Size.small,onClick:()=>{r({pool:Wp(t),hasMining:z})},children:D?i._({id:"wckWOP",message:"Manage"}):i._({id:"m16xKo",message:"Add"})})]})]})})]},D?null==B?void 0:B.id:T.id+T.chainId)}))})]})}function Om({account:e,filterChainIds:t,activeChainId:n,handleChangeActiveChainId:i,operatePool:o,setOperatePool:r}){var a,l,s,d,c,u,p;y();const{minDevice:h,isMobile:m}=Ec(),g=je(),{onlyChainId:v,supportAMMV2:b,supportAMMV3:j,notSupportPMM:w}=Zr(),[C,k]=G.useState(!1),{filterTokens:R,filterASymbol:S,filterBSymbol:I,filterAddressLqList:E,handleDeleteToken:M,handleChangeFilterTokens:T,handleChangeFilterAddress:L}=Cm();let O=[];b&&O.push("SVM_AMMV2"),j&&C&&(O=["SVM_AMMV3"]);const W={currentPage:1,pageSize:1e3,user:e,filterState:{viewOnlyOwn:!0,filterTypes:O}},V=el(),A=V.getQuery(f.graphql.fetchMyLiquidityList,{where:Object.assign(Object.assign({},W),{filterState:Object.assign({filterASymbol:S,filterBSymbol:I},W.filterState)})}),F=we(Object.assign({},A));let Z=null!==(s=null===(l=null===(a=F.data)||void 0===a?void 0:a.liquidity_list)||void 0===l?void 0:l.lqList)&&void 0!==s?s:[];const P=!!(null==E?void 0:E.length);P?Z=[...E]:t&&(Z=null!==(p=null===(u=null===(c=null===(d=F.data)||void 0===d?void 0:d.liquidity_list)||void 0===c?void 0:c.lqList)||void 0===u?void 0:u.filter((e=>{var n,i;return t.includes(null!==(i=null===(n=null==e?void 0:e.pair)||void 0===n?void 0:n.chainId)&&void 0!==i?i:0)})))&&void 0!==p?p:[]);return Gt.jsxs(Gt.Fragment,{children:[Gt.jsxs(x,{sx:Object.assign(Object.assign({py:16,display:"flex",gap:8},h(475)?{}:{flexDirection:"column"}),m?{}:{px:20,borderBottomWidth:1}),children:[Gt.jsxs(x,{sx:Object.assign(Object.assign({display:"flex",alignItems:"center",gap:8},h(475)?{}:{"& > button":{flex:1,flexBasis:"100%"}}),m?{flexWrap:"wrap"}:{}),children:[!v&&Gt.jsx(hm,{chainId:n,setChainId:i}),j&&Gt.jsx(Mm,{onlyV3:C,setOnlyV3:k,sx:m?{flexGrow:1,flexBasis:"100%"}:void 0}),Gt.jsx(jm,{value:R,onChange:T,searchAddress:(e,t)=>Vr(this,void 0,void 0,(function*(){var n;const i=V.getInfiniteQuery(f.graphql.fetchLiquidityList,"currentPage",{where:Object.assign(Object.assign({},W),{filterState:Object.assign({address:e},W.filterState)})}),o=null===(n=(yield g.fetchQuery(i)).liquidity_list)||void 0===n?void 0:n.lqList;return(null==o?void 0:o.length)?Gt.jsx(wm,{list:o,onClick:()=>{L(o),t()}}):null}))})]}),(P||!!R.length)&&Gt.jsxs(x,{sx:{my:0},children:[P?Gt.jsx(fm,{lqList:E,onDeleteTag:()=>L([])}):"",Gt.jsx(gm,{tags:R,onDeleteTag:M})]})]}),m?Gt.jsxs(im,{gap:12,children:[F.isLoading?Gt.jsx(vm,{}):"",!F.isLoading&&!(null==Z?void 0:Z.length)&&!F.error&&Gt.jsx(Kh,{sx:{mt:40},hasSearch:!!(n&&!v||S||I)}),!!F.error&&Gt.jsx(tm,{refresh:F.refetch,sx:{mt:40}}),Gt.jsx(Tm,{account:e,lqList:Z,setOperatePool:r,supportAMM:b||j})]}):Gt.jsxs(Gt.Fragment,{children:[Gt.jsx(Lm,{account:e,lqList:Z,operatePool:o,setOperatePool:r,supportAMM:b||j,onlyV3:C}),Gt.jsx(nm,{loading:F.isLoading,refetch:F.error?F.refetch:void 0,empty:!(null==Z?void 0:Z.length),hasSearch:!!(n&&!v||S||I)})]})]})}var Wm,Vm;function Am(){return Am=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Am.apply(null,arguments)}const Fm=e=>q.createElement("svg",Am({width:66,height:64,viewBox:"0 0 66 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink"},e),Wm||(Wm=q.createElement("rect",{width:64,height:60.1342,fill:"url(#pattern0)"})),Vm||(Vm=q.createElement("defs",null,q.createElement("pattern",{id:"pattern0",patternContentUnits:"objectBoundingBox",width:1,height:1},q.createElement("use",{xlinkHref:"#image0_2465_53170",transform:"matrix(0.00671141 0 0 0.00714286 -0.503356 -0.9)"})),q.createElement("image",{id:"image0_2465_53170",width:300,height:300,xlinkHref:"data:image/png;base64,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"}))));function Zm(e){var{sx:t}=e,n=Wr(e,["sx"]);return Gt.jsx(D,{...n,sx:Object.assign(Object.assign({},t),{display:"flex",flexDirection:"column",overflow:"hidden"})})}function Pm({params:t}){var n,r,a;const{isMobile:l}=Ec(),s=Zr((e=>e.noDocumentLink)),d=G.useRef(null),{account:c}=Br(),{poolTab:u,tabs:p,handleChangePoolTab:h}=function({account:t,paramsTab:n}){const{i18n:i}=e(),[o,r]=G.useState(ru.addLiquidity),{supportAMMV2:a,supportAMMV3:l,notSupportPMM:s}=Zr(),d=G.useMemo((()=>{const e=[{key:ru.addLiquidity,value:i._({id:"OBdohg",message:"Add Liquidity"})},{key:ru.myLiquidity,value:i._({id:"YHc3B+",message:"My Liquidity"})}];return s||e.push({key:ru.myCreated,value:a||l?i._({id:"zcVtwU",message:"My Pools (PMM)"}):i._({id:"fZFkP1",message:"My Pools"})}),e}),[i._,a,l,s]),c=G.useRef(!1);G.useEffect((()=>{const e=sessionStorage.getItem(iu);t&&e&&!c.current&&(c.current=!0,r(e))}),[t]);const u=e=>{r(e),sessionStorage.setItem(iu,e)};return G.useEffect((()=>{n&&u(n)}),[n]),{poolTab:o,tabs:d,handleChangePoolTab:u}}({account:c,paramsTab:null==t?void 0:t.tab}),{activeChainId:m,filterChainIds:f,handleChangeActiveChainId:g}=function(){const{chainId:e}=Br(),{onlyChainId:t}=Zr(),[n,i]=G.useState(t),r=G.useMemo((()=>void 0!==n?[n]:Es(e)?void 0:Object.values(o).filter((e=>!!Number(e)))),[e,n]);return G.useEffect((()=>{const e=sessionStorage.getItem(ou);e&&i(Number(e))}),[]),{activeChainId:n,filterChainIds:r,handleChangeActiveChainId:e=>{void 0===e?sessionStorage.removeItem(ou):sessionStorage.setItem(ou,String(e)),i(e)}}}(),[y,v]=G.useState(null);return Gt.jsxs(_c,{sx:Object.assign({},l?{p:20}:{display:"flex",gap:12,flex:1}),ref:d,children:[Gt.jsx(x,{sx:l?{}:{p:8,borderRadius:20,borderWidth:1,borderStyle:"solid",borderColor:"border.main",backgroundColor:"border.disabled",backdropFilter:"blur(5px)",flex:1,overflow:"hidden",height:"max-content",maxHeight:"100%"},children:Gt.jsxs(U,{value:u,onChange:(e,t)=>{h(t)},sx:l?{}:{display:"flex",flexDirection:"column",borderRadius:16,borderWidth:1,borderStyle:"solid",borderColor:"border.main",backgroundColor:"background.paper"},className:l?void 0:"gradient-card-border",children:[Gt.jsxs(x,{sx:l?{}:{display:"flex",justifyContent:"space-between",p:20,borderBottomWidth:1},children:[Gt.jsx(z,{tabs:p,variant:"rounded",tabsListSx:Object.assign({},l?{mb:16}:{borderBottomWidth:0,justifyContent:"space-between"}),tabSx:l?void 0:{mb:0}}),Gt.jsx(Em,{})]}),Gt.jsx(Zm,{value:ru.addLiquidity,sx:{display:"flex",flexDirection:"column",overflow:"hidden"},children:Gt.jsx(Sm,{account:c,filterChainIds:f,scrollParentRef:d,activeChainId:m,handleChangeActiveChainId:g,operatePool:y,setOperatePool:v})}),Gt.jsx(Zm,{value:ru.myLiquidity,children:Gt.jsx(Om,{account:c,filterChainIds:f,activeChainId:m,handleChangeActiveChainId:g,operatePool:y,setOperatePool:v})})]})}),Gt.jsxs(x,{sx:{position:"relative",width:s&&!y?"auto":375},children:[!s&&Gt.jsx(bh,{title:i._({id:"6y2TB3",message:"Liquidity"}),desc:i._({id:"QNrpkx",message:"Classical AMM-like pool. Suitable for most assets."}),linkTo:"https://docs.dodoex.io/product/tutorial/how-to-provide-liquidity",LeftImage:Fm}),"SVM_AMMV3"===(null===(n=null==y?void 0:y.pool)||void 0===n?void 0:n.type)&&y.pool.chainId?u===ru.myLiquidity&&(null===(a=null===(r=y.pool.liquidityPositions)||void 0===r?void 0:r[0])||void 0===a?void 0:a.nftMint)?Gt.jsx(Oh,{mint1Address:y.pool.baseToken.address,mint2Address:y.pool.quoteToken.address,feeAmount:Number(y.pool.lpFeeRate),poolId:y.pool.address,nftMint:y.pool.liquidityPositions[0].nftMint,onClose:()=>v(null)}):Gt.jsx(Ah,{mint1Address:y.pool.baseToken.address,mint2Address:y.pool.quoteToken.address,feeAmount:Number(y.pool.lpFeeRate),poolId:y.pool.address,onClose:()=>v(null),handleGoToAddLiquidityV3:e=>{zc.getState().push({type:Yc.createPoolAMMV3,params:e})}}):l?Gt.jsx(qh,{account:c,onClose:()=>v(null),modal:l,pool:null==y?void 0:y.pool,operate:null==y?void 0:y.operate,hasMining:!1,hidePoolInfo:!1}):!!y&&Gt.jsx(Xh,{account:c,onClose:()=>v(null),pool:null==y?void 0:y.pool,operate:null==y?void 0:y.operate,hasMining:!1,hidePoolInfo:!1,sx:{width:375,height:"max-content",backgroundColor:"background.paper",borderRadius:16,overflow:"hidden"}})]})]})}function Bm(){const{routerPage:e}=Zr(),t=zc((e=>e.page)),n=null!=e?e:t;switch(null==n?void 0:n.type){case Yc.Pool:return Gt.jsx(Pm,{params:n.params});case Yc.createPoolAMMV2:return Gt.jsx(ku,{});case Yc.createPoolAMMV3:return Gt.jsx(vh,{params:n.params,handleGoBack:()=>{zc.getState().push({type:Yc.Pool})},handleGoToPoolList:()=>{zc.getState().push({type:Yc.Pool})}});default:return Gt.jsx(Pm,{params:null==n?void 0:n.params})}}export{ku as AMMV2Create,Oh as AMMV3PositionManage,Ah as AMMV3PositionsView,vh as AddLiquidityV3,Ur as MetadataFlag,Yc as PageType,Bm as Pool,Pm as PoolList,Dc as Swap,hc as UnstyleWidget,mc as Widget,zc as useRouterStore};