import{r as E,I as ei,C as ii,c as Ie,u as ri,P as ni,a as ti,b as si,U as oi,O as oe,d as ai,e as li,R as ci,j as p,B as ae,D as Te,L as ui}from"./index-BsAdyuxG.js";import{T as mi}from"./TopNav-DcZjsLL6.js";import{u as ve}from"./useQuery-BvnSz2O8.js";import{F as _e}from"./floatlabel.esm-CstXtEwt.js";import{I as ke}from"./inputtext.esm-i7_YoY9X.js";import{P as di}from"./index.esm-DSvlBssd.js";import"./keyfilter.esm-Bp4LdhxN.js";function we(){return we=Object.assign?Object.assign.bind():function(e){for(var i=1;i<arguments.length;i++){var r=arguments[i];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},we.apply(null,arguments)}var Oe=E.memo(E.forwardRef(function(e,i){var r=ei.getPTI(e);return E.createElement("svg",we({ref:i,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r),E.createElement("path",{d:"M13.2222 7.77778H0.777778C0.571498 7.77778 0.373667 7.69584 0.227806 7.54998C0.0819442 7.40412 0 7.20629 0 7.00001C0 6.79373 0.0819442 6.5959 0.227806 6.45003C0.373667 6.30417 0.571498 6.22223 0.777778 6.22223H13.2222C13.4285 6.22223 13.6263 6.30417 13.7722 6.45003C13.9181 6.5959 14 6.79373 14 7.00001C14 7.20629 13.9181 7.40412 13.7722 7.54998C13.6263 7.69584 13.4285 7.77778 13.2222 7.77778Z",fill:"currentColor"}))}));Oe.displayName="MinusIcon";function be(){return be=Object.assign?Object.assign.bind():function(e){for(var i=1;i<arguments.length;i++){var r=arguments[i];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},be.apply(null,arguments)}function fi(e){if(Array.isArray(e))return e}function pi(e,i){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,t,s,o,a=[],c=!0,l=!1;try{if(s=(r=r.call(e)).next,i!==0)for(;!(c=(n=s.call(r)).done)&&(a.push(n.value),a.length!==i);c=!0);}catch(u){l=!0,t=u}finally{try{if(!c&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(l)throw t}}return a}}function Ve(e,i){(i==null||i>e.length)&&(i=e.length);for(var r=0,n=Array(i);r<i;r++)n[r]=e[r];return n}function hi(e,i){if(e){if(typeof e=="string")return Ve(e,i);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ve(e,i):void 0}}function gi(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Me(e,i){return fi(e)||pi(e,i)||hi(e,i)||gi()}var ue=ii.extend({defaultProps:{__TYPE:"Panel",id:null,header:null,headerTemplate:null,footer:null,footerTemplate:null,toggleable:null,style:null,className:null,collapsed:null,expandIcon:null,collapseIcon:null,icons:null,transitionOptions:null,onExpand:null,onCollapse:null,onToggle:null,children:void 0},css:{classes:{root:function(i){var r=i.props;return Ie("p-panel p-component",{"p-panel-toggleable":r.toggleable})},header:"p-panel-header",title:"p-panel-title",icons:"p-panel-icons",toggler:"p-panel-header-icon p-panel-toggler p-link",togglerIcon:"p-panel-header-icon p-panel-toggler p-link",toggleableContent:"p-toggleable-content",content:"p-panel-content",footer:"p-panel-footer",transition:"p-toggleable-content"},styles:`
        @layer primereact {
            .p-panel-header {
              display: flex;
              justify-content: space-between;
              align-items: center;
            }
            
            .p-panel-title {
              line-height: 1;
            }
            
            .p-panel-header-icon {
              display: inline-flex;
              justify-content: center;
              align-items: center;
              cursor: pointer;
              text-decoration: none;
              overflow: hidden;
              position: relative;
            }
        }
        `}}),Fe=E.forwardRef(function(e,i){var r=ri(),n=E.useContext(ni),t=ue.getProps(e,n),s=E.useState(t.id),o=Me(s,2),a=o[0],c=o[1],l=E.useState(t.collapsed),u=Me(l,2),m=u[0],d=u[1],g=E.useRef(null),b=E.useRef(null),h=t.toggleable?t.onToggle?t.collapsed:m:!1,S=a+"_header",x=a+"_content",L=ue.setMetaData({props:t,state:{id:a,collapsed:h}}),D=L.ptm,j=L.cx,Q=L.isUnstyled;ti(ue.css.styles,Q,{name:"panel"});var I=function(A){t.toggleable&&(h?Y(A):W(A),A&&(t.onToggle&&t.onToggle({originalEvent:A,value:!h}),A.preventDefault()))},Y=function(A){t.onToggle||d(!1),t.onExpand&&A&&t.onExpand(A)},W=function(A){t.onToggle||d(!0),t.onCollapse&&A&&t.onCollapse(A)};E.useImperativeHandle(i,function(){return{props:t,toggle:I,expand:Y,collapse:W,getElement:function(){return g.current},getContent:function(){return b.current}}}),si(function(){a||c(oi())});var G=function(){if(t.toggleable){var A=a+"_label",K=r({className:j("toggler"),onClick:I,id:A,"aria-controls":x,"aria-expanded":!h,type:"button",role:"button","aria-label":t.header},D("toggler")),_=r(D("togglericon")),se=h?t.expandIcon||E.createElement(di,_):t.collapseIcon||E.createElement(Oe,_),ce=li.getJSXIcon(se,_,{props:t,collapsed:h});return E.createElement("button",K,ce,E.createElement(ci,null))}return null},ne=function(){var A=oe.getJSXElement(t.header,t),K=oe.getJSXElement(t.icons,t),_=G(),se=r({id:S,className:j("title")},D("title")),ce=E.createElement("span",se,A),Qe=r({className:j("icons")},D("icons")),Ae=E.createElement("div",Qe,K,_),Ye=r({className:j("header")},D("header")),Ue=E.createElement("div",Ye,ce,Ae);if(t.headerTemplate){var ze={className:"p-panel-header",titleClassName:"p-panel-title",iconsClassName:"p-panel-icons",togglerClassName:"p-panel-header-icon p-panel-toggler p-link",onTogglerClick:I,titleElement:ce,iconsElement:Ae,togglerElement:_,element:Ue,id:a+"_header",props:t,collapsed:h};return oe.getJSXElement(t.headerTemplate,ze)}else if(t.header||t.toggleable)return Ue;return null},T=function(){var A=oe.getJSXElement(t.footer,t),K=r({className:j("footer")},D("footer")),_=E.createElement("div",K,A);if(t.footerTemplate){var se={className:j("footer"),element:_,props:t};return oe.getJSXElement(t.footerTemplate,se)}else if(t.footer)return _;return null},z=function(){var A=r({ref:b,className:j("toggleableContent"),"aria-hidden":h,role:"region",id:x,"aria-labelledby":S},D("toggleablecontent")),K=r({className:j("content")},D("content")),_=r({classNames:j("transition"),timeout:{enter:1e3,exit:450},in:!h,unmountOnExit:!0,options:t.transitionOptions},D("transition"));return E.createElement(ai,be({nodeRef:b},_),E.createElement("div",A,E.createElement("div",K,t.children)))},ee=r({id:a,ref:g,style:t.style,className:Ie(t.className,j("root"))},ue.getOtherProps(t),D("root")),te=ne(),V=z(),C=T();return E.createElement("div",ee,te,V,C)});Fe.displayName="Panel";function Ni({apiList:e,nextPage:i}){const[r,n]=E.useState(null),t=p.jsxDEV("div",{className:"inline-flex align-items-center justify-content-center gap-2",children:[p.jsxDEV("img",{className:"max-w-4rem shadow-2 flex-shrink-0 border-round",src:r==null?void 0:r.logo,alt:r==null?void 0:r.name},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/ApiList.jsx",lineNumber:13,columnNumber:7},this),p.jsxDEV("span",{className:"font-bold white-space-nowrap",children:r==null?void 0:r.name},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/ApiList.jsx",lineNumber:18,columnNumber:7},this)]},void 0,!0,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/ApiList.jsx",lineNumber:12,columnNumber:5},this),s=p.jsxDEV("div",{children:p.jsxDEV(ae,{label:"NEXT",icon:"pi pi-angle-right",onClick:()=>{i({...r,api_key:document.getElementById("api-key").value}),n(!1)},autoFocus:!0},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/ApiList.jsx",lineNumber:24,columnNumber:7},this)},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/ApiList.jsx",lineNumber:23,columnNumber:5},this),o={root:()=>({className:"md:w-20rem"})};return p.jsxDEV("div",{className:"card xl:flex xl:justify-content-center",children:[p.jsxDEV("br",{},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/ApiList.jsx",lineNumber:47,columnNumber:7},this),p.jsxDEV(Fe,{header:"Available APIs",pt:o,children:e.map(a=>p.jsxDEV("div",{className:"flex flex-wrap p-2 align-items-center gap-3 mt-3 hover:bg-primary-100",children:[p.jsxDEV("img",{className:"max-w-4rem max-h-2rem shadow-2 flex-shrink-0 border-round",src:a.logo,alt:a.name},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/ApiList.jsx",lineNumber:54,columnNumber:13},this),p.jsxDEV("div",{className:"flex-1 flex flex-column gap-2 xl:mr-8",children:p.jsxDEV("span",{className:"font-bold",children:a.name},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/ApiList.jsx",lineNumber:60,columnNumber:15},this)},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/ApiList.jsx",lineNumber:59,columnNumber:13},this),p.jsxDEV(ae,{icon:"pi pi-angle-right",onClick:()=>n(a)},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/ApiList.jsx",lineNumber:62,columnNumber:13},this)]},a.name,!0,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/ApiList.jsx",lineNumber:50,columnNumber:11},this))},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/ApiList.jsx",lineNumber:48,columnNumber:7},this),p.jsxDEV(Te,{visible:r,modal:!0,header:t,footer:s,style:{width:"50rem"},onHide:()=>{r&&n(null)},children:p.jsxDEV("div",{className:"flex flex-column",children:[p.jsxDEV("p",{className:"font-medium text-800",children:["Enter Your ",r==null?void 0:r.name," Api Key/Token"]},void 0,!0,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/ApiList.jsx",lineNumber:81,columnNumber:11},this),p.jsxDEV(_e,{className:"mt-3 w-full",children:[p.jsxDEV("label",{htmlFor:"api-key",children:"Api Key/Token"},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/ApiList.jsx",lineNumber:85,columnNumber:13},this),p.jsxDEV(ke,{id:"api-key",className:"w-full",autoFocus:!0},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/ApiList.jsx",lineNumber:86,columnNumber:13},this)]},void 0,!0,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/ApiList.jsx",lineNumber:84,columnNumber:11},this)]},void 0,!0,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/ApiList.jsx",lineNumber:80,columnNumber:9},this)},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/ApiList.jsx",lineNumber:69,columnNumber:7},this)]},void 0,!0,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/ApiList.jsx",lineNumber:46,columnNumber:5},this)}function vi({countries:e,selectedApi:i,closeModal:r}){const[n,t]=E.useState(null),[s,o]=E.useState({});E.useEffect(()=>{e&&t(e)},[e]);const a=m=>{m.target.checked?o(d=>({...d,[m.target.id]:m.target.name})):o(d=>{const{[m.target.id]:g,...b}=d;return b})},c=()=>{r(s),t(null),o({})},l=p.jsxDEV("div",{className:"inline-flex align-items-center justify-content-center gap-2",children:[p.jsxDEV("img",{className:"max-w-4rem shadow-2 flex-shrink-0 border-round",src:i==null?void 0:i.logo,alt:i==null?void 0:i.name},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/CountriesModal.jsx",lineNumber:35,columnNumber:7},this),p.jsxDEV("span",{className:"font-bold white-space-nowrap",children:"Select Countries"},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/CountriesModal.jsx",lineNumber:40,columnNumber:7},this)]},void 0,!0,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/CountriesModal.jsx",lineNumber:34,columnNumber:5},this),u=p.jsxDEV("div",{children:p.jsxDEV(ae,{label:"NEXT",icon:"pi pi-angle-right",onClick:c,autoFocus:!0},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/CountriesModal.jsx",lineNumber:45,columnNumber:7},this)},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/CountriesModal.jsx",lineNumber:44,columnNumber:5},this);return p.jsxDEV(Te,{visible:n,modal:!0,header:l,footer:u,style:{width:"50rem"},onHide:()=>{r(),t(null)},children:[p.jsxDEV("div",{className:"flex",children:p.jsxDEV(_e,{className:"w-full mt-4",children:[p.jsxDEV(ke,{id:"search-country",className:"w-full",onChange:m=>{t(e.filter(d=>d.country.toLowerCase().includes(m.target.value.toLowerCase())))}},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/CountriesModal.jsx",lineNumber:68,columnNumber:11},this),p.jsxDEV("label",{htmlFor:"search-country",children:"Search Country"},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/CountriesModal.jsx",lineNumber:81,columnNumber:11},this)]},void 0,!0,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/CountriesModal.jsx",lineNumber:67,columnNumber:9},this)},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/CountriesModal.jsx",lineNumber:66,columnNumber:7},this),p.jsxDEV("div",{className:"flex flex-wrap py-3",children:n==null?void 0:n.map(m=>p.jsxDEV("div",{className:"flex items-center gap-2 mt-2 w-6 lg:w-4",children:[p.jsxDEV("input",{type:"checkbox",id:m.id,name:m.country,checked:!!s[m.id],onChange:a},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/CountriesModal.jsx",lineNumber:91,columnNumber:15},this),p.jsxDEV("label",{htmlFor:m.id,className:"font-semibold",children:[m.country[0].toUpperCase(),m.country.slice(1)]},void 0,!0,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/CountriesModal.jsx",lineNumber:98,columnNumber:15},this)]},m.id,!0,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/CountriesModal.jsx",lineNumber:87,columnNumber:13},this))},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/CountriesModal.jsx",lineNumber:84,columnNumber:7},this)]},void 0,!0,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/CountriesModal.jsx",lineNumber:55,columnNumber:5},this)}/*!
 *  decimal.js v10.4.3
 *  An arbitrary-precision Decimal type for JavaScript.
 *  https://github.com/MikeMcl/decimal.js
 *  Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
 *  MIT Licence
 */var ie=9e15,J=1e9,De="0123456789abcdef",de="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",fe="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",xe={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-ie,maxE:ie,crypto:!1},qe,B,w=!0,he="[DecimalError] ",X=he+"Invalid argument: ",Re=he+"Precision limit exceeded",Be=he+"crypto unavailable",He="[object Decimal]",P=Math.floor,U=Math.pow,wi=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,bi=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Di=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Ze=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,F=1e7,v=7,xi=9007199254740991,Ei=de.length-1,Ee=fe.length-1,f={toStringTag:He};f.absoluteValue=f.abs=function(){var e=new this.constructor(this);return e.s<0&&(e.s=1),N(e)};f.ceil=function(){return N(new this.constructor(this),this.e+1,2)};f.clampedTo=f.clamp=function(e,i){var r,n=this,t=n.constructor;if(e=new t(e),i=new t(i),!e.s||!i.s)return new t(NaN);if(e.gt(i))throw Error(X+i);return r=n.cmp(e),r<0?e:n.cmp(i)>0?i:new t(n)};f.comparedTo=f.cmp=function(e){var i,r,n,t,s=this,o=s.d,a=(e=new s.constructor(e)).d,c=s.s,l=e.s;if(!o||!a)return!c||!l?NaN:c!==l?c:o===a?0:!o^c<0?1:-1;if(!o[0]||!a[0])return o[0]?c:a[0]?-l:0;if(c!==l)return c;if(s.e!==e.e)return s.e>e.e^c<0?1:-1;for(n=o.length,t=a.length,i=0,r=n<t?n:t;i<r;++i)if(o[i]!==a[i])return o[i]>a[i]^c<0?1:-1;return n===t?0:n>t^c<0?1:-1};f.cosine=f.cos=function(){var e,i,r=this,n=r.constructor;return r.d?r.d[0]?(e=n.precision,i=n.rounding,n.precision=e+Math.max(r.e,r.sd())+v,n.rounding=1,r=Ci(n,Ge(n,r)),n.precision=e,n.rounding=i,N(B==2||B==3?r.neg():r,e,i,!0)):new n(1):new n(NaN)};f.cubeRoot=f.cbrt=function(){var e,i,r,n,t,s,o,a,c,l,u=this,m=u.constructor;if(!u.isFinite()||u.isZero())return new m(u);for(w=!1,s=u.s*U(u.s*u,1/3),!s||Math.abs(s)==1/0?(r=M(u.d),e=u.e,(s=(e-r.length+1)%3)&&(r+=s==1||s==-2?"0":"00"),s=U(r,1/3),e=P((e+1)/3)-(e%3==(e<0?-1:2)),s==1/0?r="5e"+e:(r=s.toExponential(),r=r.slice(0,r.indexOf("e")+1)+e),n=new m(r),n.s=u.s):n=new m(s.toString()),o=(e=m.precision)+3;;)if(a=n,c=a.times(a).times(a),l=c.plus(u),n=k(l.plus(u).times(a),l.plus(c),o+2,1),M(a.d).slice(0,o)===(r=M(n.d)).slice(0,o))if(r=r.slice(o-3,o+1),r=="9999"||!t&&r=="4999"){if(!t&&(N(a,e+1,0),a.times(a).times(a).eq(u))){n=a;break}o+=4,t=1}else{(!+r||!+r.slice(1)&&r.charAt(0)=="5")&&(N(n,e+1,1),i=!n.times(n).times(n).eq(u));break}return w=!0,N(n,e,m.rounding,i)};f.decimalPlaces=f.dp=function(){var e,i=this.d,r=NaN;if(i){if(e=i.length-1,r=(e-P(this.e/v))*v,e=i[e],e)for(;e%10==0;e/=10)r--;r<0&&(r=0)}return r};f.dividedBy=f.div=function(e){return k(this,new this.constructor(e))};f.dividedToIntegerBy=f.divToInt=function(e){var i=this,r=i.constructor;return N(k(i,new r(e),0,1,1),r.precision,r.rounding)};f.equals=f.eq=function(e){return this.cmp(e)===0};f.floor=function(){return N(new this.constructor(this),this.e+1,3)};f.greaterThan=f.gt=function(e){return this.cmp(e)>0};f.greaterThanOrEqualTo=f.gte=function(e){var i=this.cmp(e);return i==1||i===0};f.hyperbolicCosine=f.cosh=function(){var e,i,r,n,t,s=this,o=s.constructor,a=new o(1);if(!s.isFinite())return new o(s.s?1/0:NaN);if(s.isZero())return a;r=o.precision,n=o.rounding,o.precision=r+Math.max(s.e,s.sd())+4,o.rounding=1,t=s.d.length,t<32?(e=Math.ceil(t/3),i=(1/Ne(4,e)).toString()):(e=16,i="2.3283064365386962890625e-10"),s=re(o,1,s.times(i),new o(1),!0);for(var c,l=e,u=new o(8);l--;)c=s.times(s),s=a.minus(c.times(u.minus(c.times(u))));return N(s,o.precision=r,o.rounding=n,!0)};f.hyperbolicSine=f.sinh=function(){var e,i,r,n,t=this,s=t.constructor;if(!t.isFinite()||t.isZero())return new s(t);if(i=s.precision,r=s.rounding,s.precision=i+Math.max(t.e,t.sd())+4,s.rounding=1,n=t.d.length,n<3)t=re(s,2,t,t,!0);else{e=1.4*Math.sqrt(n),e=e>16?16:e|0,t=t.times(1/Ne(5,e)),t=re(s,2,t,t,!0);for(var o,a=new s(5),c=new s(16),l=new s(20);e--;)o=t.times(t),t=t.times(a.plus(o.times(c.times(o).plus(l))))}return s.precision=i,s.rounding=r,N(t,i,r,!0)};f.hyperbolicTangent=f.tanh=function(){var e,i,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,i=n.rounding,n.precision=e+7,n.rounding=1,k(r.sinh(),r.cosh(),n.precision=e,n.rounding=i)):new n(r.s)};f.inverseCosine=f.acos=function(){var e,i=this,r=i.constructor,n=i.abs().cmp(1),t=r.precision,s=r.rounding;return n!==-1?n===0?i.isNeg()?O(r,t,s):new r(0):new r(NaN):i.isZero()?O(r,t+4,s).times(.5):(r.precision=t+6,r.rounding=1,i=i.asin(),e=O(r,t+4,s).times(.5),r.precision=t,r.rounding=s,e.minus(i))};f.inverseHyperbolicCosine=f.acosh=function(){var e,i,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(e=n.precision,i=n.rounding,n.precision=e+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,w=!1,r=r.times(r).minus(1).sqrt().plus(r),w=!0,n.precision=e,n.rounding=i,r.ln()):new n(r)};f.inverseHyperbolicSine=f.asinh=function(){var e,i,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(e=n.precision,i=n.rounding,n.precision=e+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,w=!1,r=r.times(r).plus(1).sqrt().plus(r),w=!0,n.precision=e,n.rounding=i,r.ln())};f.inverseHyperbolicTangent=f.atanh=function(){var e,i,r,n,t=this,s=t.constructor;return t.isFinite()?t.e>=0?new s(t.abs().eq(1)?t.s/0:t.isZero()?t:NaN):(e=s.precision,i=s.rounding,n=t.sd(),Math.max(n,e)<2*-t.e-1?N(new s(t),e,i,!0):(s.precision=r=n-t.e,t=k(t.plus(1),new s(1).minus(t),r+e,1),s.precision=e+4,s.rounding=1,t=t.ln(),s.precision=e,s.rounding=i,t.times(.5))):new s(NaN)};f.inverseSine=f.asin=function(){var e,i,r,n,t=this,s=t.constructor;return t.isZero()?new s(t):(i=t.abs().cmp(1),r=s.precision,n=s.rounding,i!==-1?i===0?(e=O(s,r+4,n).times(.5),e.s=t.s,e):new s(NaN):(s.precision=r+6,s.rounding=1,t=t.div(new s(1).minus(t.times(t)).sqrt().plus(1)).atan(),s.precision=r,s.rounding=n,t.times(2)))};f.inverseTangent=f.atan=function(){var e,i,r,n,t,s,o,a,c,l=this,u=l.constructor,m=u.precision,d=u.rounding;if(l.isFinite()){if(l.isZero())return new u(l);if(l.abs().eq(1)&&m+4<=Ee)return o=O(u,m+4,d).times(.25),o.s=l.s,o}else{if(!l.s)return new u(NaN);if(m+4<=Ee)return o=O(u,m+4,d).times(.5),o.s=l.s,o}for(u.precision=a=m+10,u.rounding=1,r=Math.min(28,a/v+2|0),e=r;e;--e)l=l.div(l.times(l).plus(1).sqrt().plus(1));for(w=!1,i=Math.ceil(a/v),n=1,c=l.times(l),o=new u(l),t=l;e!==-1;)if(t=t.times(c),s=o.minus(t.div(n+=2)),t=t.times(c),o=s.plus(t.div(n+=2)),o.d[i]!==void 0)for(e=i;o.d[e]===s.d[e]&&e--;);return r&&(o=o.times(2<<r-1)),w=!0,N(o,u.precision=m,u.rounding=d,!0)};f.isFinite=function(){return!!this.d};f.isInteger=f.isInt=function(){return!!this.d&&P(this.e/v)>this.d.length-2};f.isNaN=function(){return!this.s};f.isNegative=f.isNeg=function(){return this.s<0};f.isPositive=f.isPos=function(){return this.s>0};f.isZero=function(){return!!this.d&&this.d[0]===0};f.lessThan=f.lt=function(e){return this.cmp(e)<0};f.lessThanOrEqualTo=f.lte=function(e){return this.cmp(e)<1};f.logarithm=f.log=function(e){var i,r,n,t,s,o,a,c,l=this,u=l.constructor,m=u.precision,d=u.rounding,g=5;if(e==null)e=new u(10),i=!0;else{if(e=new u(e),r=e.d,e.s<0||!r||!r[0]||e.eq(1))return new u(NaN);i=e.eq(10)}if(r=l.d,l.s<0||!r||!r[0]||l.eq(1))return new u(r&&!r[0]?-1/0:l.s!=1?NaN:r?0:1/0);if(i)if(r.length>1)s=!0;else{for(t=r[0];t%10===0;)t/=10;s=t!==1}if(w=!1,a=m+g,o=$(l,a),n=i?pe(u,a+10):$(e,a),c=k(o,n,a,1),le(c.d,t=m,d))do if(a+=10,o=$(l,a),n=i?pe(u,a+10):$(e,a),c=k(o,n,a,1),!s){+M(c.d).slice(t+1,t+15)+1==1e14&&(c=N(c,m+1,0));break}while(le(c.d,t+=10,d));return w=!0,N(c,m,d)};f.minus=f.sub=function(e){var i,r,n,t,s,o,a,c,l,u,m,d,g=this,b=g.constructor;if(e=new b(e),!g.d||!e.d)return!g.s||!e.s?e=new b(NaN):g.d?e.s=-e.s:e=new b(e.d||g.s!==e.s?g:NaN),e;if(g.s!=e.s)return e.s=-e.s,g.plus(e);if(l=g.d,d=e.d,a=b.precision,c=b.rounding,!l[0]||!d[0]){if(d[0])e.s=-e.s;else if(l[0])e=new b(g);else return new b(c===3?-0:0);return w?N(e,a,c):e}if(r=P(e.e/v),u=P(g.e/v),l=l.slice(),s=u-r,s){for(m=s<0,m?(i=l,s=-s,o=d.length):(i=d,r=u,o=l.length),n=Math.max(Math.ceil(a/v),o)+2,s>n&&(s=n,i.length=1),i.reverse(),n=s;n--;)i.push(0);i.reverse()}else{for(n=l.length,o=d.length,m=n<o,m&&(o=n),n=0;n<o;n++)if(l[n]!=d[n]){m=l[n]<d[n];break}s=0}for(m&&(i=l,l=d,d=i,e.s=-e.s),o=l.length,n=d.length-o;n>0;--n)l[o++]=0;for(n=d.length;n>s;){if(l[--n]<d[n]){for(t=n;t&&l[--t]===0;)l[t]=F-1;--l[t],l[n]+=F}l[n]-=d[n]}for(;l[--o]===0;)l.pop();for(;l[0]===0;l.shift())--r;return l[0]?(e.d=l,e.e=ge(l,r),w?N(e,a,c):e):new b(c===3?-0:0)};f.modulo=f.mod=function(e){var i,r=this,n=r.constructor;return e=new n(e),!r.d||!e.s||e.d&&!e.d[0]?new n(NaN):!e.d||r.d&&!r.d[0]?N(new n(r),n.precision,n.rounding):(w=!1,n.modulo==9?(i=k(r,e.abs(),0,3,1),i.s*=e.s):i=k(r,e,0,n.modulo,1),i=i.times(e),w=!0,r.minus(i))};f.naturalExponential=f.exp=function(){return Ce(this)};f.naturalLogarithm=f.ln=function(){return $(this)};f.negated=f.neg=function(){var e=new this.constructor(this);return e.s=-e.s,N(e)};f.plus=f.add=function(e){var i,r,n,t,s,o,a,c,l,u,m=this,d=m.constructor;if(e=new d(e),!m.d||!e.d)return!m.s||!e.s?e=new d(NaN):m.d||(e=new d(e.d||m.s===e.s?m:NaN)),e;if(m.s!=e.s)return e.s=-e.s,m.minus(e);if(l=m.d,u=e.d,a=d.precision,c=d.rounding,!l[0]||!u[0])return u[0]||(e=new d(m)),w?N(e,a,c):e;if(s=P(m.e/v),n=P(e.e/v),l=l.slice(),t=s-n,t){for(t<0?(r=l,t=-t,o=u.length):(r=u,n=s,o=l.length),s=Math.ceil(a/v),o=s>o?s+1:o+1,t>o&&(t=o,r.length=1),r.reverse();t--;)r.push(0);r.reverse()}for(o=l.length,t=u.length,o-t<0&&(t=o,r=u,u=l,l=r),i=0;t;)i=(l[--t]=l[t]+u[t]+i)/F|0,l[t]%=F;for(i&&(l.unshift(i),++n),o=l.length;l[--o]==0;)l.pop();return e.d=l,e.e=ge(l,n),w?N(e,a,c):e};f.precision=f.sd=function(e){var i,r=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(X+e);return r.d?(i=$e(r.d),e&&r.e+1>i&&(i=r.e+1)):i=NaN,i};f.round=function(){var e=this,i=e.constructor;return N(new i(e),e.e+1,i.rounding)};f.sine=f.sin=function(){var e,i,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,i=n.rounding,n.precision=e+Math.max(r.e,r.sd())+v,n.rounding=1,r=ki(n,Ge(n,r)),n.precision=e,n.rounding=i,N(B>2?r.neg():r,e,i,!0)):new n(NaN)};f.squareRoot=f.sqrt=function(){var e,i,r,n,t,s,o=this,a=o.d,c=o.e,l=o.s,u=o.constructor;if(l!==1||!a||!a[0])return new u(!l||l<0&&(!a||a[0])?NaN:a?o:1/0);for(w=!1,l=Math.sqrt(+o),l==0||l==1/0?(i=M(a),(i.length+c)%2==0&&(i+="0"),l=Math.sqrt(i),c=P((c+1)/2)-(c<0||c%2),l==1/0?i="5e"+c:(i=l.toExponential(),i=i.slice(0,i.indexOf("e")+1)+c),n=new u(i)):n=new u(l.toString()),r=(c=u.precision)+3;;)if(s=n,n=s.plus(k(o,s,r+2,1)).times(.5),M(s.d).slice(0,r)===(i=M(n.d)).slice(0,r))if(i=i.slice(r-3,r+1),i=="9999"||!t&&i=="4999"){if(!t&&(N(s,c+1,0),s.times(s).eq(o))){n=s;break}r+=4,t=1}else{(!+i||!+i.slice(1)&&i.charAt(0)=="5")&&(N(n,c+1,1),e=!n.times(n).eq(o));break}return w=!0,N(n,c,u.rounding,e)};f.tangent=f.tan=function(){var e,i,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(e=n.precision,i=n.rounding,n.precision=e+10,n.rounding=1,r=r.sin(),r.s=1,r=k(r,new n(1).minus(r.times(r)).sqrt(),e+10,0),n.precision=e,n.rounding=i,N(B==2||B==4?r.neg():r,e,i,!0)):new n(NaN)};f.times=f.mul=function(e){var i,r,n,t,s,o,a,c,l,u=this,m=u.constructor,d=u.d,g=(e=new m(e)).d;if(e.s*=u.s,!d||!d[0]||!g||!g[0])return new m(!e.s||d&&!d[0]&&!g||g&&!g[0]&&!d?NaN:!d||!g?e.s/0:e.s*0);for(r=P(u.e/v)+P(e.e/v),c=d.length,l=g.length,c<l&&(s=d,d=g,g=s,o=c,c=l,l=o),s=[],o=c+l,n=o;n--;)s.push(0);for(n=l;--n>=0;){for(i=0,t=c+n;t>n;)a=s[t]+g[n]*d[t-n-1]+i,s[t--]=a%F|0,i=a/F|0;s[t]=(s[t]+i)%F|0}for(;!s[--o];)s.pop();return i?++r:s.shift(),e.d=s,e.e=ge(s,r),w?N(e,m.precision,m.rounding):e};f.toBinary=function(e,i){return Se(this,2,e,i)};f.toDecimalPlaces=f.toDP=function(e,i){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(y(e,0,J),i===void 0?i=n.rounding:y(i,0,8),N(r,e+r.e+1,i))};f.toExponential=function(e,i){var r,n=this,t=n.constructor;return e===void 0?r=R(n,!0):(y(e,0,J),i===void 0?i=t.rounding:y(i,0,8),n=N(new t(n),e+1,i),r=R(n,!0,e+1)),n.isNeg()&&!n.isZero()?"-"+r:r};f.toFixed=function(e,i){var r,n,t=this,s=t.constructor;return e===void 0?r=R(t):(y(e,0,J),i===void 0?i=s.rounding:y(i,0,8),n=N(new s(t),e+t.e+1,i),r=R(n,!1,e+n.e+1)),t.isNeg()&&!t.isZero()?"-"+r:r};f.toFraction=function(e){var i,r,n,t,s,o,a,c,l,u,m,d,g=this,b=g.d,h=g.constructor;if(!b)return new h(g);if(l=r=new h(1),n=c=new h(0),i=new h(n),s=i.e=$e(b)-g.e-1,o=s%v,i.d[0]=U(10,o<0?v+o:o),e==null)e=s>0?i:l;else{if(a=new h(e),!a.isInt()||a.lt(l))throw Error(X+a);e=a.gt(i)?s>0?i:l:a}for(w=!1,a=new h(M(b)),u=h.precision,h.precision=s=b.length*v*2;m=k(a,i,0,1,1),t=r.plus(m.times(n)),t.cmp(e)!=1;)r=n,n=t,t=l,l=c.plus(m.times(t)),c=t,t=i,i=a.minus(m.times(t)),a=t;return t=k(e.minus(r),n,0,1,1),c=c.plus(t.times(l)),r=r.plus(t.times(n)),c.s=l.s=g.s,d=k(l,n,s,1).minus(g).abs().cmp(k(c,r,s,1).minus(g).abs())<1?[l,n]:[c,r],h.precision=u,w=!0,d};f.toHexadecimal=f.toHex=function(e,i){return Se(this,16,e,i)};f.toNearest=function(e,i){var r=this,n=r.constructor;if(r=new n(r),e==null){if(!r.d)return r;e=new n(1),i=n.rounding}else{if(e=new n(e),i===void 0?i=n.rounding:y(i,0,8),!r.d)return e.s?r:e;if(!e.d)return e.s&&(e.s=r.s),e}return e.d[0]?(w=!1,r=k(r,e,0,i,1).times(e),w=!0,N(r)):(e.s=r.s,r=e),r};f.toNumber=function(){return+this};f.toOctal=function(e,i){return Se(this,8,e,i)};f.toPower=f.pow=function(e){var i,r,n,t,s,o,a=this,c=a.constructor,l=+(e=new c(e));if(!a.d||!e.d||!a.d[0]||!e.d[0])return new c(U(+a,l));if(a=new c(a),a.eq(1))return a;if(n=c.precision,s=c.rounding,e.eq(1))return N(a,n,s);if(i=P(e.e/v),i>=e.d.length-1&&(r=l<0?-l:l)<=xi)return t=Xe(c,a,r,n),e.s<0?new c(1).div(t):N(t,n,s);if(o=a.s,o<0){if(i<e.d.length-1)return new c(NaN);if(e.d[i]&1||(o=1),a.e==0&&a.d[0]==1&&a.d.length==1)return a.s=o,a}return r=U(+a,l),i=r==0||!isFinite(r)?P(l*(Math.log("0."+M(a.d))/Math.LN10+a.e+1)):new c(r+"").e,i>c.maxE+1||i<c.minE-1?new c(i>0?o/0:0):(w=!1,c.rounding=a.s=1,r=Math.min(12,(i+"").length),t=Ce(e.times($(a,n+r)),n),t.d&&(t=N(t,n+5,1),le(t.d,n,s)&&(i=n+10,t=N(Ce(e.times($(a,i+r)),i),i+5,1),+M(t.d).slice(n+1,n+15)+1==1e14&&(t=N(t,n+1,0)))),t.s=o,w=!0,c.rounding=s,N(t,n,s))};f.toPrecision=function(e,i){var r,n=this,t=n.constructor;return e===void 0?r=R(n,n.e<=t.toExpNeg||n.e>=t.toExpPos):(y(e,1,J),i===void 0?i=t.rounding:y(i,0,8),n=N(new t(n),e,i),r=R(n,e<=n.e||n.e<=t.toExpNeg,e)),n.isNeg()&&!n.isZero()?"-"+r:r};f.toSignificantDigits=f.toSD=function(e,i){var r=this,n=r.constructor;return e===void 0?(e=n.precision,i=n.rounding):(y(e,1,J),i===void 0?i=n.rounding:y(i,0,8)),N(new n(r),e,i)};f.toString=function(){var e=this,i=e.constructor,r=R(e,e.e<=i.toExpNeg||e.e>=i.toExpPos);return e.isNeg()&&!e.isZero()?"-"+r:r};f.truncated=f.trunc=function(){return N(new this.constructor(this),this.e+1,1)};f.valueOf=f.toJSON=function(){var e=this,i=e.constructor,r=R(e,e.e<=i.toExpNeg||e.e>=i.toExpPos);return e.isNeg()?"-"+r:r};function M(e){var i,r,n,t=e.length-1,s="",o=e[0];if(t>0){for(s+=o,i=1;i<t;i++)n=e[i]+"",r=v-n.length,r&&(s+=Z(r)),s+=n;o=e[i],n=o+"",r=v-n.length,r&&(s+=Z(r))}else if(o===0)return"0";for(;o%10===0;)o/=10;return s+o}function y(e,i,r){if(e!==~~e||e<i||e>r)throw Error(X+e)}function le(e,i,r,n){var t,s,o,a;for(s=e[0];s>=10;s/=10)--i;return--i<0?(i+=v,t=0):(t=Math.ceil((i+1)/v),i%=v),s=U(10,v-i),a=e[t]%s|0,n==null?i<3?(i==0?a=a/100|0:i==1&&(a=a/10|0),o=r<4&&a==99999||r>3&&a==49999||a==5e4||a==0):o=(r<4&&a+1==s||r>3&&a+1==s/2)&&(e[t+1]/s/100|0)==U(10,i-2)-1||(a==s/2||a==0)&&(e[t+1]/s/100|0)==0:i<4?(i==0?a=a/1e3|0:i==1?a=a/100|0:i==2&&(a=a/10|0),o=(n||r<4)&&a==9999||!n&&r>3&&a==4999):o=((n||r<4)&&a+1==s||!n&&r>3&&a+1==s/2)&&(e[t+1]/s/1e3|0)==U(10,i-3)-1,o}function me(e,i,r){for(var n,t=[0],s,o=0,a=e.length;o<a;){for(s=t.length;s--;)t[s]*=i;for(t[0]+=De.indexOf(e.charAt(o++)),n=0;n<t.length;n++)t[n]>r-1&&(t[n+1]===void 0&&(t[n+1]=0),t[n+1]+=t[n]/r|0,t[n]%=r)}return t.reverse()}function Ci(e,i){var r,n,t;if(i.isZero())return i;n=i.d.length,n<32?(r=Math.ceil(n/3),t=(1/Ne(4,r)).toString()):(r=16,t="2.3283064365386962890625e-10"),e.precision+=r,i=re(e,1,i.times(t),new e(1));for(var s=r;s--;){var o=i.times(i);i=o.times(o).minus(o).times(8).plus(1)}return e.precision-=r,i}var k=function(){function e(n,t,s){var o,a=0,c=n.length;for(n=n.slice();c--;)o=n[c]*t+a,n[c]=o%s|0,a=o/s|0;return a&&n.unshift(a),n}function i(n,t,s,o){var a,c;if(s!=o)c=s>o?1:-1;else for(a=c=0;a<s;a++)if(n[a]!=t[a]){c=n[a]>t[a]?1:-1;break}return c}function r(n,t,s,o){for(var a=0;s--;)n[s]-=a,a=n[s]<t[s]?1:0,n[s]=a*o+n[s]-t[s];for(;!n[0]&&n.length>1;)n.shift()}return function(n,t,s,o,a,c){var l,u,m,d,g,b,h,S,x,L,D,j,Q,I,Y,W,G,ne,T,z,ee=n.constructor,te=n.s==t.s?1:-1,V=n.d,C=t.d;if(!V||!V[0]||!C||!C[0])return new ee(!n.s||!t.s||(V?C&&V[0]==C[0]:!C)?NaN:V&&V[0]==0||!C?te*0:te/0);for(c?(g=1,u=n.e-t.e):(c=F,g=v,u=P(n.e/g)-P(t.e/g)),T=C.length,G=V.length,x=new ee(te),L=x.d=[],m=0;C[m]==(V[m]||0);m++);if(C[m]>(V[m]||0)&&u--,s==null?(I=s=ee.precision,o=ee.rounding):a?I=s+(n.e-t.e)+1:I=s,I<0)L.push(1),b=!0;else{if(I=I/g+2|0,m=0,T==1){for(d=0,C=C[0],I++;(m<G||d)&&I--;m++)Y=d*c+(V[m]||0),L[m]=Y/C|0,d=Y%C|0;b=d||m<G}else{for(d=c/(C[0]+1)|0,d>1&&(C=e(C,d,c),V=e(V,d,c),T=C.length,G=V.length),W=T,D=V.slice(0,T),j=D.length;j<T;)D[j++]=0;z=C.slice(),z.unshift(0),ne=C[0],C[1]>=c/2&&++ne;do d=0,l=i(C,D,T,j),l<0?(Q=D[0],T!=j&&(Q=Q*c+(D[1]||0)),d=Q/ne|0,d>1?(d>=c&&(d=c-1),h=e(C,d,c),S=h.length,j=D.length,l=i(h,D,S,j),l==1&&(d--,r(h,T<S?z:C,S,c))):(d==0&&(l=d=1),h=C.slice()),S=h.length,S<j&&h.unshift(0),r(D,h,j,c),l==-1&&(j=D.length,l=i(C,D,T,j),l<1&&(d++,r(D,T<j?z:C,j,c))),j=D.length):l===0&&(d++,D=[0]),L[m++]=d,l&&D[0]?D[j++]=V[W]||0:(D=[V[W]],j=1);while((W++<G||D[0]!==void 0)&&I--);b=D[0]!==void 0}L[0]||L.shift()}if(g==1)x.e=u,qe=b;else{for(m=1,d=L[0];d>=10;d/=10)m++;x.e=m+u*g-1,N(x,a?s+x.e+1:s,o,b)}return x}}();function N(e,i,r,n){var t,s,o,a,c,l,u,m,d,g=e.constructor;e:if(i!=null){if(m=e.d,!m)return e;for(t=1,a=m[0];a>=10;a/=10)t++;if(s=i-t,s<0)s+=v,o=i,u=m[d=0],c=u/U(10,t-o-1)%10|0;else if(d=Math.ceil((s+1)/v),a=m.length,d>=a)if(n){for(;a++<=d;)m.push(0);u=c=0,t=1,s%=v,o=s-v+1}else break e;else{for(u=a=m[d],t=1;a>=10;a/=10)t++;s%=v,o=s-v+t,c=o<0?0:u/U(10,t-o-1)%10|0}if(n=n||i<0||m[d+1]!==void 0||(o<0?u:u%U(10,t-o-1)),l=r<4?(c||n)&&(r==0||r==(e.s<0?3:2)):c>5||c==5&&(r==4||n||r==6&&(s>0?o>0?u/U(10,t-o):0:m[d-1])%10&1||r==(e.s<0?8:7)),i<1||!m[0])return m.length=0,l?(i-=e.e+1,m[0]=U(10,(v-i%v)%v),e.e=-i||0):m[0]=e.e=0,e;if(s==0?(m.length=d,a=1,d--):(m.length=d+1,a=U(10,v-s),m[d]=o>0?(u/U(10,t-o)%U(10,o)|0)*a:0),l)for(;;)if(d==0){for(s=1,o=m[0];o>=10;o/=10)s++;for(o=m[0]+=a,a=1;o>=10;o/=10)a++;s!=a&&(e.e++,m[0]==F&&(m[0]=1));break}else{if(m[d]+=a,m[d]!=F)break;m[d--]=0,a=1}for(s=m.length;m[--s]===0;)m.pop()}return w&&(e.e>g.maxE?(e.d=null,e.e=NaN):e.e<g.minE&&(e.e=0,e.d=[0])),e}function R(e,i,r){if(!e.isFinite())return We(e);var n,t=e.e,s=M(e.d),o=s.length;return i?(r&&(n=r-o)>0?s=s.charAt(0)+"."+s.slice(1)+Z(n):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(e.e<0?"e":"e+")+e.e):t<0?(s="0."+Z(-t-1)+s,r&&(n=r-o)>0&&(s+=Z(n))):t>=o?(s+=Z(t+1-o),r&&(n=r-t-1)>0&&(s=s+"."+Z(n))):((n=t+1)<o&&(s=s.slice(0,n)+"."+s.slice(n)),r&&(n=r-o)>0&&(t+1===o&&(s+="."),s+=Z(n))),s}function ge(e,i){var r=e[0];for(i*=v;r>=10;r/=10)i++;return i}function pe(e,i,r){if(i>Ei)throw w=!0,r&&(e.precision=r),Error(Re);return N(new e(de),i,1,!0)}function O(e,i,r){if(i>Ee)throw Error(Re);return N(new e(fe),i,r,!0)}function $e(e){var i=e.length-1,r=i*v+1;if(i=e[i],i){for(;i%10==0;i/=10)r--;for(i=e[0];i>=10;i/=10)r++}return r}function Z(e){for(var i="";e--;)i+="0";return i}function Xe(e,i,r,n){var t,s=new e(1),o=Math.ceil(n/v+4);for(w=!1;;){if(r%2&&(s=s.times(i),Le(s.d,o)&&(t=!0)),r=P(r/2),r===0){r=s.d.length-1,t&&s.d[r]===0&&++s.d[r];break}i=i.times(i),Le(i.d,o)}return w=!0,s}function Pe(e){return e.d[e.d.length-1]&1}function Je(e,i,r){for(var n,t=new e(i[0]),s=0;++s<i.length;)if(n=new e(i[s]),n.s)t[r](n)&&(t=n);else{t=n;break}return t}function Ce(e,i){var r,n,t,s,o,a,c,l=0,u=0,m=0,d=e.constructor,g=d.rounding,b=d.precision;if(!e.d||!e.d[0]||e.e>17)return new d(e.d?e.d[0]?e.s<0?0:1/0:1:e.s?e.s<0?0:e:NaN);for(i==null?(w=!1,c=b):c=i,a=new d(.03125);e.e>-2;)e=e.times(a),m+=5;for(n=Math.log(U(2,m))/Math.LN10*2+5|0,c+=n,r=s=o=new d(1),d.precision=c;;){if(s=N(s.times(e),c,1),r=r.times(++u),a=o.plus(k(s,r,c,1)),M(a.d).slice(0,c)===M(o.d).slice(0,c)){for(t=m;t--;)o=N(o.times(o),c,1);if(i==null)if(l<3&&le(o.d,c-n,g,l))d.precision=c+=10,r=s=a=new d(1),u=0,l++;else return N(o,d.precision=b,g,w=!0);else return d.precision=b,o}o=a}}function $(e,i){var r,n,t,s,o,a,c,l,u,m,d,g=1,b=10,h=e,S=h.d,x=h.constructor,L=x.rounding,D=x.precision;if(h.s<0||!S||!S[0]||!h.e&&S[0]==1&&S.length==1)return new x(S&&!S[0]?-1/0:h.s!=1?NaN:S?0:h);if(i==null?(w=!1,u=D):u=i,x.precision=u+=b,r=M(S),n=r.charAt(0),Math.abs(s=h.e)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)h=h.times(e),r=M(h.d),n=r.charAt(0),g++;s=h.e,n>1?(h=new x("0."+r),s++):h=new x(n+"."+r.slice(1))}else return l=pe(x,u+2,D).times(s+""),h=$(new x(n+"."+r.slice(1)),u-b).plus(l),x.precision=D,i==null?N(h,D,L,w=!0):h;for(m=h,c=o=h=k(h.minus(1),h.plus(1),u,1),d=N(h.times(h),u,1),t=3;;){if(o=N(o.times(d),u,1),l=c.plus(k(o,new x(t),u,1)),M(l.d).slice(0,u)===M(c.d).slice(0,u))if(c=c.times(2),s!==0&&(c=c.plus(pe(x,u+2,D).times(s+""))),c=k(c,new x(g),u,1),i==null)if(le(c.d,u-b,L,a))x.precision=u+=b,l=o=h=k(m.minus(1),m.plus(1),u,1),d=N(h.times(h),u,1),t=a=1;else return N(c,x.precision=D,L,w=!0);else return x.precision=D,c;c=l,t+=2}}function We(e){return String(e.s*e.s/0)}function je(e,i){var r,n,t;for((r=i.indexOf("."))>-1&&(i=i.replace(".","")),(n=i.search(/e/i))>0?(r<0&&(r=n),r+=+i.slice(n+1),i=i.substring(0,n)):r<0&&(r=i.length),n=0;i.charCodeAt(n)===48;n++);for(t=i.length;i.charCodeAt(t-1)===48;--t);if(i=i.slice(n,t),i){if(t-=n,e.e=r=r-n-1,e.d=[],n=(r+1)%v,r<0&&(n+=v),n<t){for(n&&e.d.push(+i.slice(0,n)),t-=v;n<t;)e.d.push(+i.slice(n,n+=v));i=i.slice(n),n=v-i.length}else n-=t;for(;n--;)i+="0";e.d.push(+i),w&&(e.e>e.constructor.maxE?(e.d=null,e.e=NaN):e.e<e.constructor.minE&&(e.e=0,e.d=[0]))}else e.e=0,e.d=[0];return e}function ji(e,i){var r,n,t,s,o,a,c,l,u;if(i.indexOf("_")>-1){if(i=i.replace(/(\d)_(?=\d)/g,"$1"),Ze.test(i))return je(e,i)}else if(i==="Infinity"||i==="NaN")return+i||(e.s=NaN),e.e=NaN,e.d=null,e;if(bi.test(i))r=16,i=i.toLowerCase();else if(wi.test(i))r=2;else if(Di.test(i))r=8;else throw Error(X+i);for(s=i.search(/p/i),s>0?(c=+i.slice(s+1),i=i.substring(2,s)):i=i.slice(2),s=i.indexOf("."),o=s>=0,n=e.constructor,o&&(i=i.replace(".",""),a=i.length,s=a-s,t=Xe(n,new n(r),s,s*2)),l=me(i,r,F),u=l.length-1,s=u;l[s]===0;--s)l.pop();return s<0?new n(e.s*0):(e.e=ge(l,u),e.d=l,w=!1,o&&(e=k(e,t,a*4)),c&&(e=e.times(Math.abs(c)<54?U(2,c):q.pow(2,c))),w=!0,e)}function ki(e,i){var r,n=i.d.length;if(n<3)return i.isZero()?i:re(e,2,i,i);r=1.4*Math.sqrt(n),r=r>16?16:r|0,i=i.times(1/Ne(5,r)),i=re(e,2,i,i);for(var t,s=new e(5),o=new e(16),a=new e(20);r--;)t=i.times(i),i=i.times(s.plus(t.times(o.times(t).minus(a))));return i}function re(e,i,r,n,t){var s,o,a,c,l=e.precision,u=Math.ceil(l/v);for(w=!1,c=r.times(r),a=new e(n);;){if(o=k(a.times(c),new e(i++*i++),l,1),a=t?n.plus(o):n.minus(o),n=k(o.times(c),new e(i++*i++),l,1),o=a.plus(n),o.d[u]!==void 0){for(s=u;o.d[s]===a.d[s]&&s--;);if(s==-1)break}s=a,a=n,n=o,o=s}return w=!0,o.d.length=u+1,o}function Ne(e,i){for(var r=e;--i;)r*=e;return r}function Ge(e,i){var r,n=i.s<0,t=O(e,e.precision,1),s=t.times(.5);if(i=i.abs(),i.lte(s))return B=n?4:1,i;if(r=i.divToInt(t),r.isZero())B=n?3:2;else{if(i=i.minus(r.times(t)),i.lte(s))return B=Pe(r)?n?2:3:n?4:1,i;B=Pe(r)?n?1:4:n?3:2}return i.minus(t).abs()}function Se(e,i,r,n){var t,s,o,a,c,l,u,m,d,g=e.constructor,b=r!==void 0;if(b?(y(r,1,J),n===void 0?n=g.rounding:y(n,0,8)):(r=g.precision,n=g.rounding),!e.isFinite())u=We(e);else{for(u=R(e),o=u.indexOf("."),b?(t=2,i==16?r=r*4-3:i==8&&(r=r*3-2)):t=i,o>=0&&(u=u.replace(".",""),d=new g(1),d.e=u.length-o,d.d=me(R(d),10,t),d.e=d.d.length),m=me(u,10,t),s=c=m.length;m[--c]==0;)m.pop();if(!m[0])u=b?"0p+0":"0";else{if(o<0?s--:(e=new g(e),e.d=m,e.e=s,e=k(e,d,r,n,0,t),m=e.d,s=e.e,l=qe),o=m[r],a=t/2,l=l||m[r+1]!==void 0,l=n<4?(o!==void 0||l)&&(n===0||n===(e.s<0?3:2)):o>a||o===a&&(n===4||l||n===6&&m[r-1]&1||n===(e.s<0?8:7)),m.length=r,l)for(;++m[--r]>t-1;)m[r]=0,r||(++s,m.unshift(1));for(c=m.length;!m[c-1];--c);for(o=0,u="";o<c;o++)u+=De.charAt(m[o]);if(b){if(c>1)if(i==16||i==8){for(o=i==16?4:3,--c;c%o;c++)u+="0";for(m=me(u,t,i),c=m.length;!m[c-1];--c);for(o=1,u="1.";o<c;o++)u+=De.charAt(m[o])}else u=u.charAt(0)+"."+u.slice(1);u=u+(s<0?"p":"p+")+s}else if(s<0){for(;++s;)u="0"+u;u="0."+u}else if(++s>c)for(s-=c;s--;)u+="0";else s<c&&(u=u.slice(0,s)+"."+u.slice(s))}u=(i==16?"0x":i==2?"0b":i==8?"0o":"")+u}return e.s<0?"-"+u:u}function Le(e,i){if(e.length>i)return e.length=i,!0}function Si(e){return new this(e).abs()}function Ai(e){return new this(e).acos()}function Ui(e){return new this(e).acosh()}function Vi(e,i){return new this(e).plus(i)}function Mi(e){return new this(e).asin()}function Pi(e){return new this(e).asinh()}function Li(e){return new this(e).atan()}function yi(e){return new this(e).atanh()}function Ii(e,i){e=new this(e),i=new this(i);var r,n=this.precision,t=this.rounding,s=n+4;return!e.s||!i.s?r=new this(NaN):!e.d&&!i.d?(r=O(this,s,1).times(i.s>0?.25:.75),r.s=e.s):!i.d||e.isZero()?(r=i.s<0?O(this,n,t):new this(0),r.s=e.s):!e.d||i.isZero()?(r=O(this,s,1).times(.5),r.s=e.s):i.s<0?(this.precision=s,this.rounding=1,r=this.atan(k(e,i,s,1)),i=O(this,s,1),this.precision=n,this.rounding=t,r=e.s<0?r.minus(i):r.plus(i)):r=this.atan(k(e,i,s,1)),r}function Ti(e){return new this(e).cbrt()}function _i(e){return N(e=new this(e),e.e+1,2)}function Oi(e,i,r){return new this(e).clamp(i,r)}function Fi(e){if(!e||typeof e!="object")throw Error(he+"Object expected");var i,r,n,t=e.defaults===!0,s=["precision",1,J,"rounding",0,8,"toExpNeg",-ie,0,"toExpPos",0,ie,"maxE",0,ie,"minE",-ie,0,"modulo",0,9];for(i=0;i<s.length;i+=3)if(r=s[i],t&&(this[r]=xe[r]),(n=e[r])!==void 0)if(P(n)===n&&n>=s[i+1]&&n<=s[i+2])this[r]=n;else throw Error(X+r+": "+n);if(r="crypto",t&&(this[r]=xe[r]),(n=e[r])!==void 0)if(n===!0||n===!1||n===0||n===1)if(n)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))this[r]=!0;else throw Error(Be);else this[r]=!1;else throw Error(X+r+": "+n);return this}function qi(e){return new this(e).cos()}function Ri(e){return new this(e).cosh()}function Ke(e){var i,r,n;function t(s){var o,a,c,l=this;if(!(l instanceof t))return new t(s);if(l.constructor=t,ye(s)){l.s=s.s,w?!s.d||s.e>t.maxE?(l.e=NaN,l.d=null):s.e<t.minE?(l.e=0,l.d=[0]):(l.e=s.e,l.d=s.d.slice()):(l.e=s.e,l.d=s.d?s.d.slice():s.d);return}if(c=typeof s,c==="number"){if(s===0){l.s=1/s<0?-1:1,l.e=0,l.d=[0];return}if(s<0?(s=-s,l.s=-1):l.s=1,s===~~s&&s<1e7){for(o=0,a=s;a>=10;a/=10)o++;w?o>t.maxE?(l.e=NaN,l.d=null):o<t.minE?(l.e=0,l.d=[0]):(l.e=o,l.d=[s]):(l.e=o,l.d=[s]);return}else if(s*0!==0){s||(l.s=NaN),l.e=NaN,l.d=null;return}return je(l,s.toString())}else if(c!=="string")throw Error(X+s);return(a=s.charCodeAt(0))===45?(s=s.slice(1),l.s=-1):(a===43&&(s=s.slice(1)),l.s=1),Ze.test(s)?je(l,s):ji(l,s)}if(t.prototype=f,t.ROUND_UP=0,t.ROUND_DOWN=1,t.ROUND_CEIL=2,t.ROUND_FLOOR=3,t.ROUND_HALF_UP=4,t.ROUND_HALF_DOWN=5,t.ROUND_HALF_EVEN=6,t.ROUND_HALF_CEIL=7,t.ROUND_HALF_FLOOR=8,t.EUCLID=9,t.config=t.set=Fi,t.clone=Ke,t.isDecimal=ye,t.abs=Si,t.acos=Ai,t.acosh=Ui,t.add=Vi,t.asin=Mi,t.asinh=Pi,t.atan=Li,t.atanh=yi,t.atan2=Ii,t.cbrt=Ti,t.ceil=_i,t.clamp=Oi,t.cos=qi,t.cosh=Ri,t.div=Bi,t.exp=Hi,t.floor=Zi,t.hypot=$i,t.ln=Xi,t.log=Ji,t.log10=Gi,t.log2=Wi,t.max=Ki,t.min=Qi,t.mod=Yi,t.mul=zi,t.pow=er,t.random=ir,t.round=rr,t.sign=nr,t.sin=tr,t.sinh=sr,t.sqrt=or,t.sub=ar,t.sum=lr,t.tan=cr,t.tanh=ur,t.trunc=mr,e===void 0&&(e={}),e&&e.defaults!==!0)for(n=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],i=0;i<n.length;)e.hasOwnProperty(r=n[i++])||(e[r]=this[r]);return t.config(e),t}function Bi(e,i){return new this(e).div(i)}function Hi(e){return new this(e).exp()}function Zi(e){return N(e=new this(e),e.e+1,3)}function $i(){var e,i,r=new this(0);for(w=!1,e=0;e<arguments.length;)if(i=new this(arguments[e++]),i.d)r.d&&(r=r.plus(i.times(i)));else{if(i.s)return w=!0,new this(1/0);r=i}return w=!0,r.sqrt()}function ye(e){return e instanceof q||e&&e.toStringTag===He||!1}function Xi(e){return new this(e).ln()}function Ji(e,i){return new this(e).log(i)}function Wi(e){return new this(e).log(2)}function Gi(e){return new this(e).log(10)}function Ki(){return Je(this,arguments,"lt")}function Qi(){return Je(this,arguments,"gt")}function Yi(e,i){return new this(e).mod(i)}function zi(e,i){return new this(e).mul(i)}function er(e,i){return new this(e).pow(i)}function ir(e){var i,r,n,t,s=0,o=new this(1),a=[];if(e===void 0?e=this.precision:y(e,1,J),n=Math.ceil(e/v),this.crypto)if(crypto.getRandomValues)for(i=crypto.getRandomValues(new Uint32Array(n));s<n;)t=i[s],t>=429e7?i[s]=crypto.getRandomValues(new Uint32Array(1))[0]:a[s++]=t%1e7;else if(crypto.randomBytes){for(i=crypto.randomBytes(n*=4);s<n;)t=i[s]+(i[s+1]<<8)+(i[s+2]<<16)+((i[s+3]&127)<<24),t>=214e7?crypto.randomBytes(4).copy(i,s):(a.push(t%1e7),s+=4);s=n/4}else throw Error(Be);else for(;s<n;)a[s++]=Math.random()*1e7|0;for(n=a[--s],e%=v,n&&e&&(t=U(10,v-e),a[s]=(n/t|0)*t);a[s]===0;s--)a.pop();if(s<0)r=0,a=[0];else{for(r=-1;a[0]===0;r-=v)a.shift();for(n=1,t=a[0];t>=10;t/=10)n++;n<v&&(r-=v-n)}return o.e=r,o.d=a,o}function rr(e){return N(e=new this(e),e.e+1,this.rounding)}function nr(e){return e=new this(e),e.d?e.d[0]?e.s:0*e.s:e.s||NaN}function tr(e){return new this(e).sin()}function sr(e){return new this(e).sinh()}function or(e){return new this(e).sqrt()}function ar(e,i){return new this(e).sub(i)}function lr(){var e=0,i=arguments,r=new this(i[e]);for(w=!1;r.s&&++e<i.length;)r=r.plus(i[e]);return w=!0,N(r,this.precision,this.rounding)}function cr(e){return new this(e).tan()}function ur(e){return new this(e).tanh()}function mr(e){return N(e=new this(e),e.e+1,1)}f[Symbol.for("nodejs.util.inspect.custom")]=f.toString;f[Symbol.toStringTag]="Decimal";var q=f.constructor=Ke(xe);de=new q(de);fe=new q(fe);function dr({services:e,selectedApi:i,goBack:r}){const[n,t]=E.useState({});E.useEffect(()=>{const o=(e==null?void 0:e.map(a=>[a.country.code,a.country.profit]))||[];t(Object.fromEntries(o))},[]);const s=()=>{window.showLoaderModal({text:"Saving Selected Servers..."});const o=e.map(a=>{var l;const c=n[a.country.code];return{country:{...a.country,profit:c},list:((l=a.list)==null?void 0:l.map(u=>({...u,profitAmt:new q(new q(+u.price).dividedBy(100)).times(new q(+c)).plus(+u.price).toFixed(2)})))||[]}});window.api.post(`/api/admin/auto-import?q=saveServers&api=${i.name}&key=${i.api_key}`,{servers:o}).then(({data:a})=>{if(window.hideModal(),a.status!=1)return window.toast({type:"error",message:a.message});const c=p.jsxDEV("div",{children:p.jsxDEV(ae,{label:"Ok",icon:"pi pi-check",onClick:()=>{r(),window.hideModal()},autoFocus:!0},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/Services.jsx",lineNumber:57,columnNumber:13},this)},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/Services.jsx",lineNumber:56,columnNumber:11},this);window.showModal({body:p.jsxDEV("p",{className:"m-0 font-semibold text-800",children:a.message},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/Services.jsx",lineNumber:70,columnNumber:17},this),header:"Success",footer:c})}).catch(a=>{console.log("Error saving servers: ",a),window.hideModal(),window.toast({type:"error",message:`unable to communicate with server to save ${apiData.name} Api Services`})})};return p.jsxDEV("div",{className:"px-4 py-3",children:[p.jsxDEV("div",{className:"font-semibold text-lg flex align-items-center gap-2",children:[p.jsxDEV("img",{className:"h-2rem w-2rem border-round-md",src:i==null?void 0:i.logo,onError:({currentTarget:o})=>{o.onerror=null,o.src="https://upload.wikimedia.org/wikipedia/commons/thumb/2/25/Icon-round-Question_mark.jpg/800px-Icon-round-Question_mark.jpg"},alt:i==null?void 0:i.name},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/Services.jsx",lineNumber:88,columnNumber:9},this),p.jsxDEV("span",{children:[i==null?void 0:i.name," Services"]},void 0,!0,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/Services.jsx",lineNumber:97,columnNumber:9},this)]},void 0,!0,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/Services.jsx",lineNumber:87,columnNumber:7},this),p.jsxDEV("div",{className:"mt-4",children:e==null?void 0:e.map((o,a)=>p.jsxDEV(fr,{index:a,service:o,margin:n[o.country.code],updateMargin:c=>{t(l=>({...l,[o.country.code]:+c||0}))}},o.country.code,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/Services.jsx",lineNumber:101,columnNumber:11},this))},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/Services.jsx",lineNumber:99,columnNumber:7},this),p.jsxDEV(ae,{label:"Save Servers",className:"w-10 mx-auto mt-4 block",onClick:s},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/Services.jsx",lineNumber:115,columnNumber:7},this)]},void 0,!0,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/Services.jsx",lineNumber:86,columnNumber:5},this)}function fr({index:e,service:i,updateMargin:r,margin:n}){var a;const[t,s]=E.useState(e==0),o=({item:c})=>{const l=E.useMemo(()=>{var u=new q(+c.price),m=new q(u.dividedBy(100)).times(new q(+n)).plus(+u).toFixed(2);return m},[n]);return p.jsxDEV("div",{className:"flex align-items-center border-2 border-600 border-round-md",style:{width:"48%"},children:[p.jsxDEV("div",{className:"flex flex-column w-5",children:[p.jsxDEV("img",{src:c.logo,alt:c.name,className:"border-round-lg ml-2 mx-auto h-auto max-h-3rem w-auto max-w-3rem"},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/Services.jsx",lineNumber:145,columnNumber:11},this),p.jsxDEV("span",{className:"font-semibold capitalize text-center text-700",style:{wordBreak:"break-all"},children:c.name},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/Services.jsx",lineNumber:150,columnNumber:11},this)]},void 0,!0,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/Services.jsx",lineNumber:144,columnNumber:9},this),p.jsxDEV("div",{className:"pl-2",children:[p.jsxDEV("div",{className:"capitalize text-blue-700",children:["Actual Price:"," ",p.jsxDEV("span",{className:"font-semibold text-800",children:["UGX ",c.price]},void 0,!0,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/Services.jsx",lineNumber:162,columnNumber:13},this)]},void 0,!0,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/Services.jsx",lineNumber:160,columnNumber:11},this),p.jsxDEV("div",{className:"capitalize text-red-700",children:["Your Price:"," ",p.jsxDEV("span",{className:"font-semibold text-800",children:["UGX ",l]},void 0,!0,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/Services.jsx",lineNumber:166,columnNumber:13},this)]},void 0,!0,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/Services.jsx",lineNumber:164,columnNumber:11},this)]},void 0,!0,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/Services.jsx",lineNumber:159,columnNumber:9},this)]},void 0,!0,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/Services.jsx",lineNumber:138,columnNumber:7},this)};return p.jsxDEV("div",{className:"shadow-2 my-3 bg-white",children:[p.jsxDEV("div",{className:"flex align-items-center gap-2",children:[p.jsxDEV("img",{src:`https://flagsapi.com/${i.country.country_code}/flat/64.png`,alt:"country",className:"border-round-lg ml-2 h-auto max-h-3rem"},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/Services.jsx",lineNumber:176,columnNumber:9},this),p.jsxDEV("span",{className:"font-semibold capitalize",children:i.country.name},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/Services.jsx",lineNumber:181,columnNumber:9},this),p.jsxDEV("button",{className:"border-none cursor-pointer ml-auto mr-2 h-3rem w-2rem text-center",onClick:()=>s(!t),style:{background:"transparent"},children:p.jsxDEV("i",{className:`pi pi-angle-${t?"up":"down"} font-bold text-lg`},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/Services.jsx",lineNumber:187,columnNumber:11},this)},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/Services.jsx",lineNumber:182,columnNumber:9},this)]},void 0,!0,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/Services.jsx",lineNumber:175,columnNumber:7},this),p.jsxDEV("div",{children:t&&p.jsxDEV(p.Fragment,{children:(a=i.list)!=null&&a.length?p.jsxDEV("div",{className:"mt-2 border-top-1 border-gray-300 py-3 px-2",children:[p.jsxDEV("div",{className:" flex align-items-center justify-content-between",children:[p.jsxDEV("span",{className:"font-semibold",children:"Profit Margin: "},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/Services.jsx",lineNumber:198,columnNumber:19},this),p.jsxDEV("span",{className:"mr-2",children:[p.jsxDEV(ke,{type:"number",step:"0.01",defaultValue:n,onChange:c=>r(c.target.value),className:"w-6rem mr-2"},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/Services.jsx",lineNumber:200,columnNumber:21},this),p.jsxDEV("span",{className:"font-semibold",children:"%"},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/Services.jsx",lineNumber:207,columnNumber:21},this)]},void 0,!0,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/Services.jsx",lineNumber:199,columnNumber:19},this)]},void 0,!0,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/Services.jsx",lineNumber:197,columnNumber:17},this),p.jsxDEV("div",{className:"mt-2 min-h-full max-h-18rem overflow-y-scroll flex flex-wrap gap-2",children:i.list.map(c=>p.jsxDEV(o,{item:c},c.code,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/Services.jsx",lineNumber:213,columnNumber:21},this))},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/Services.jsx",lineNumber:211,columnNumber:17},this)]},void 0,!0,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/Services.jsx",lineNumber:196,columnNumber:15},this):p.jsxDEV("div",{className:"mt-2 pb-3 px-3 font-semibold text-800",children:"No Services Available Here..."},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/Services.jsx",lineNumber:218,columnNumber:15},this)},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/Services.jsx",lineNumber:194,columnNumber:11},this)},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/Services.jsx",lineNumber:192,columnNumber:7},this)]},void 0,!0,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/Services.jsx",lineNumber:174,columnNumber:5},this)}function Dr(){const{data:e=null,isLoading:i}=ve({url:"/api/admin/auto-import?q=getApis",type:"post"}),{data:r=null,setData:n,refetch:t}=ve(),{data:s=null,isLoading:o,refetch:a}=ve(),[c,l]=E.useState(0),[u,m]=E.useState(null),d=h=>{window.showLoaderModal({text:"Loading Countries..."}),t({url:`/api/admin/auto-import?q=getServers&api=${h.name}&key=${h.api_key}`,type:"post",onSuccess:S=>{if(S[0].msg)return window.toast({type:"error",message:"Unable to fetch servers from this API"});if(!S.length)return window.toast({type:"error",message:"No servers found"});m(h)},onError:()=>{window.toast({type:"error",message:`unable to communicate with server to fetch ${h.name} Api Servers`})},finally:()=>{window.hideModal()}})},g=(h=null)=>{if(n(null),!h)return;window.showLoaderModal({text:"Loading Available Services..."});const S=Object.keys(h).map(x=>({id:x,country:h[x]}));a({url:`/api/admin/auto-import?q=getServices&api=${u.name}&key=${u.api_key}`,type:"post",data:{servers:S},onSuccess:x=>{if(!x.length)return window.toast({type:"error",message:"No API servers found"});l(1)},onError:x=>{console.log("error handling selected countries: ",x),window.toast({type:"error",message:`unable to communicate with server to fetch ${u.name} Api Countries`})},finally:()=>{window.hideModal()}})},b=()=>{if(i||o)return p.jsxDEV(ui,{},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/index.jsx",lineNumber:108,columnNumber:52},this);if(!e)return p.jsxDEV("div",{className:"text-center mt-4 font-medium",children:"No APIs found"},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/index.jsx",lineNumber:111,columnNumber:14},this);if(c==0)return p.jsxDEV(Ni,{apiList:e,nextPage:d},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/index.jsx",lineNumber:114,columnNumber:14},this);if(c==1)return p.jsxDEV(dr,{services:s,selectedApi:u,goBack:()=>l(0)},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/index.jsx",lineNumber:118,columnNumber:9},this)};return p.jsxDEV(p.Fragment,{children:[p.jsxDEV(mi,{href:"/admin/services",title:"Direct Import"},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/index.jsx",lineNumber:128,columnNumber:7},this),p.jsxDEV("main",{children:[p.jsxDEV(b,{},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/index.jsx",lineNumber:130,columnNumber:9},this),p.jsxDEV(vi,{countries:r,selectedApi:u,closeModal:g},void 0,!1,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/index.jsx",lineNumber:131,columnNumber:9},this)]},void 0,!0,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/index.jsx",lineNumber:129,columnNumber:7},this)]},void 0,!0,{fileName:"C:/Users/pc/Desktop/otp-website-mainsmmprovider-/src/admin/pages/Add-Direct/index.jsx",lineNumber:127,columnNumber:5},this)}export{Dr as default};
