import{aj as x,j as e,ak as f,n as q,r as t,bp as P,D as R,N as T,k,A as h,T as D,e as m,M as p,Q as $,g as v}from"./index-B1H8BCL7.js";var u={},U=f;Object.defineProperty(u,"__esModule",{value:!0});var A=u.default=void 0,z=U(x()),B=e,E=(0,z.default)((0,B.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12zm8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8z"}),"Block");A=u.default=E;var n={},I=f;Object.defineProperty(n,"__esModule",{value:!0});var W=n.default=void 0,L=I(x()),O=e,F=(0,L.default)((0,O.jsx)("path",{d:"M8 5v14l11-7z"}),"PlayArrow");W=n.default=F;function G({open:j,onClose:o,featureCode:i}){const{data:y=[]}=q(),[d,b]=t.useState(""),[r,_]=t.useState(""),[C,{isLoading:M}]=P(),[s,w]=t.useState(!1),[c,g]=t.useState(null),S=async()=>{var a;g(null);try{await C({targetPlan:d||null,message:r?`${r}

(Triggered by feature: ${i||"unknown"})`:`Upgrade requested (triggered by feature: ${i||"unknown"})`}).unwrap(),w(!0)}catch(l){g(((a=l==null?void 0:l.data)==null?void 0:a.message)||"Unable to submit upgrade request.")}};return e.jsxs(R,{open:j,onClose:o,maxWidth:"sm",fullWidth:!0,children:[e.jsx(T,{children:"Upgrade your plan"}),e.jsx(k,{children:s?e.jsx(h,{severity:"success",children:"Your upgrade request has been submitted. Our team will contact you shortly."}):e.jsxs(e.Fragment,{children:[e.jsx(D,{gutterBottom:!0,children:"To continue using this feature, please upgrade your subscription."}),e.jsxs(m,{select:!0,fullWidth:!0,label:"Target plan",value:d,onChange:a=>b(a.target.value),sx:{mt:2},children:[e.jsx(p,{value:"",children:"Choose a plan"}),y.map(a=>e.jsxs(p,{value:a.code,children:[a.name," — ",a.currency," ",a.monthlyPrice,"/month"]},a.code))]}),e.jsx(m,{fullWidth:!0,multiline:!0,minRows:3,label:"Message (optional)",value:r,onChange:a=>_(a.target.value),sx:{mt:2},placeholder:"Tell us what you need and when."}),c&&e.jsx(h,{severity:"error",sx:{mt:2},children:c})]})}),e.jsxs($,{children:[e.jsx(v,{onClick:o,children:s?"Close":"Cancel"}),!s&&e.jsx(v,{variant:"contained",onClick:S,disabled:M,children:"Request upgrade"})]})]})}export{G as U,W as a,A as d};
