(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4235],{89411:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/user",function(){return s(85720)}])},22729:function(e,t,s){"use strict";s.d(t,{OL:function(){return j},_T:function(){return f},aR:function(){return u},f$:function(){return b},fY:function(){return p},vW:function(){return m},xo:function(){return g},yT:function(){return v}});var n=s(26042),a=s(69396),r=s(99534),i=s(85893),o=s(67294),l=s(89532),c=s(81626),d=s(28007),u=l.fC,m=l.xz,x=l.h_,h=o.forwardRef((function(e,t){var s=e.className,o=(0,r.Z)(e,["className"]);return(0,i.jsx)(l.aV,(0,a.Z)((0,n.Z)({className:(0,c.cn)("fixed inset-0 z-50 bg-black/70 ",s)},o),{ref:t}))}));h.displayName=l.aV.displayName;var f=o.forwardRef((function(e,t){var s=e.className,a=(0,r.Z)(e,["className"]);return(0,i.jsxs)(x,{children:[(0,i.jsx)(h,{}),(0,i.jsx)(l.VY,(0,n.Z)({ref:t,className:(0,c.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg transition-all rounded-2xl",s)},a))]})}));f.displayName=l.VY.displayName;var p=function(e){var t=e.className,s=(0,r.Z)(e,["className"]);return(0,i.jsx)("div",(0,n.Z)({className:(0,c.cn)("flex flex-col space-y-2 text-center sm:text-left",t)},s))};p.displayName="AlertDialogHeader";var g=function(e){var t=e.className,s=(0,r.Z)(e,["className"]);return(0,i.jsx)("div",(0,n.Z)({className:(0,c.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t)},s))};g.displayName="AlertDialogFooter";var b=o.forwardRef((function(e,t){var s=e.className,a=(0,r.Z)(e,["className"]);return(0,i.jsx)(l.Dx,(0,n.Z)({ref:t,className:(0,c.cn)("text-lg font-semibold text-black text-xl",s)},a))}));b.displayName=l.Dx.displayName;var v=o.forwardRef((function(e,t){var s=e.className,a=(0,r.Z)(e,["className"]);return(0,i.jsx)(l.dk,(0,n.Z)({ref:t,className:(0,c.cn)("text-sm text-muted-foreground",s)},a))}));v.displayName=l.dk.displayName;var j=o.forwardRef((function(e,t){var s=e.className,a=(0,r.Z)(e,["className"]);return(0,i.jsx)(l.aU,(0,n.Z)({ref:t,className:(0,c.cn)((0,d.d)(),s)},a))}));j.displayName=l.aU.displayName,o.forwardRef((function(e,t){var s=e.className,a=(0,r.Z)(e,["className"]);return(0,i.jsx)(l.$j,(0,n.Z)({ref:t,className:(0,c.cn)((0,d.d)({variant:"outline"}),"mt-2 sm:mt-0",s)},a))})).displayName=l.$j.displayName},28007:function(e,t,s){"use strict";s.d(t,{d:function(){return d},z:function(){return u}});var n=s(26042),a=s(99534),r=s(85893),i=s(67294),o=s(88426),l=s(45139),c=s(81626),d=(0,l.j)("inline-flex items-center justify-center whitespace-nowrap rounded-xl text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-lg px-3",lg:"h-11 rounded-lg px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),u=i.forwardRef((function(e,t){var s=e.className,i=e.variant,l=e.size,u=e.asChild,m=void 0!==u&&u,x=(0,a.Z)(e,["className","variant","size","asChild"]),h=m?o.g7:"button";return(0,r.jsx)(h,(0,n.Z)({className:(0,c.cn)(d({variant:i,size:l,className:s})),ref:t},x))}));u.displayName="Button"},90532:function(e,t,s){"use strict";s.d(t,{_v:function(){return m},aJ:function(){return u},pn:function(){return c},u:function(){return d}});var n=s(26042),a=s(99534),r=s(85893),i=s(67294),o=s(47356),l=s(81626),c=o.zt,d=o.fC,u=o.xz,m=i.forwardRef((function(e,t){var s=e.className,i=e.sideOffset,c=void 0===i?4:i,d=(0,a.Z)(e,["className","sideOffset"]);return(0,r.jsx)(o.VY,(0,n.Z)({ref:t,sideOffset:c,className:(0,l.cn)("z-50 overflow-hidden rounded-xl border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s)},d))}));m.displayName=o.VY.displayName},60381:function(e,t,s){"use strict";var n=s(85893),a=s(67294),r=s(22729),i=s(11355);t.Z=function(e){var t=e.isOpen,s=e.onClose,o=e.onConfirm,l=e.title,c=e.message,d=e.deleteButtonLabel,u=void 0===d?"Delete":d,m=e.subMessage,x=void 0===m?null:m,h=(0,a.useState)(!1),f=h[0],p=h[1];return(0,n.jsx)(i.u.Root,{show:t,as:a.Fragment,children:(0,n.jsx)("div",{children:(0,n.jsxs)(r.aR,{open:t,onClose:s,children:[(0,n.jsx)(i.u.Child,{as:a.Fragment,enter:"transition-opacity duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"transition-opacity duration-300",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,n.jsx)(r.vW,{children:(0,n.jsx)("div",{})})}),(0,n.jsx)(i.u.Child,{as:a.Fragment,enter:"transition-transform ease-out duration-300",enterFrom:"scale-95 opacity-0",enterTo:"scale-100 opacity-100",leave:"transition-transform ease-in duration-300",leaveFrom:"scale-100 opacity-100",leaveTo:"scale-95 opacity-0",children:(0,n.jsxs)(r._T,{className:"overflow-hidden ".concat(f?"fade-out":""),children:[(0,n.jsxs)(r.fY,{children:[(0,n.jsx)(r.f$,{children:l}),(0,n.jsx)(r.yT,{children:c}),x&&(0,n.jsx)(r.yT,{children:x})]}),(0,n.jsxs)(r.xo,{children:[(0,n.jsx)(r.OL,{onClick:function(){p(!0),setTimeout((function(){s(),p(!1)}),200)},className:"bg-black text-white",children:"Cancel"}),(0,n.jsx)(r.OL,{onClick:function(){p(!0),setTimeout((function(){o(),p(!1)}),200)},className:"bg-red-600 hover:bg-red-700",children:u})]})]})})]})})})}},95593:function(e,t,s){"use strict";var n=s(85893);s(67294);t.Z=function(){return(0,n.jsx)("div",{className:"fixed inset-0 flex items-center justify-center bg-gray-500 bg-opacity-50 z-50",children:(0,n.jsxs)("div",{className:"bg-white rounded-lg p-3 flex justify-center items-center flex-col gap-3 relative",children:[(0,n.jsxs)("p",{className:"text-sm font-semibold text-black flex justify-center items-center",children:[(0,n.jsx)("img",{className:"w-4 h-4 ml-1 mr-1",src:"/notion-icon.svg",alt:"icon"}),"'s Sending Data..."]}),(0,n.jsxs)("span",{className:"flex absolute h-3 w-3 top-0 right-0 -mt-1 -mr-1",children:[(0,n.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-notion-addon-blue hover:bg-notion-addon-blue-hover opacity-75"}),(0,n.jsx)("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-blue-700"})]})]})})}},21947:function(e,t,s){"use strict";var n=s(85893),a=s(80624);t.Z=function(e){var t=e.color,s=void 0===t?"#fff":t,r=e.classname,i=void 0===r?"":r;return(0,n.jsx)(a.g4,{height:"10",width:"80",radius:"9",color:s,ariaLabel:"three-dots-loading",wrapperStyle:{},visible:!0,wrapperClass:i})}},50360:function(e,t,s){"use strict";var n=s(85893),a=(s(67294),s(80624));t.Z=function(e){var t=e.color,s=void 0===t?"#fff":t,r=e.classname,i=void 0===r?"":r;return(0,n.jsx)("div",{className:"fixed inset-0 flex items-center justify-center bg-white bg-opacity-50 z-50",children:(0,n.jsx)(a.g4,{height:"10",width:"80",radius:"9",color:s,ariaLabel:"three-dots-loading",wrapperStyle:{},visible:!0,wrapperClass:i})})}},84483:function(e,t,s){"use strict";var n=s(26042),a=s(69396),r=s(11163),i=s(8100),o=s(14860),l=s(63744),c=s(92871);t.Z=function(){var e,t=(0,r.useRouter)(),s=l.Z.authenticated,d=t.query.id,u=s?o.DT:"".concat(o.Vg,"?uuid=").concat(d),m=(0,i.ZP)(u,c._,{revalidateOnMount:!0}),x=m.data,h=m.error,f=m.mutate,p=m.isValidating;if(d)e=x;else if(x){var g=new Map;x.forEach((function(e){e.users.results.filter((function(e){return"person"===e.type})).forEach((function(t){g.has(t.id)?g.get(t.id).workspace_ids.push(e.workspace_id):g.set(t.id,(0,a.Z)((0,n.Z)({},t),{workspace_ids:[e.workspace_id]}))}))})),e=Array.from(g.values())}else e=[];return{users:e,isLoading:p,isError:!!h,mutate:f}}},92871:function(e,t,s){"use strict";s.d(t,{_:function(){return a}});var n=s(50196),a=function(e){return n.default.get(e).then((function(e){return e.data}))}},85720:function(e,t,s){"use strict";s.r(t),s.d(t,{__N_SSP:function(){return he},default:function(){return fe}});var n,a=s(47568),r=s(29815),i=s(20414),o=s(85893),l=s(3312),c=s(60937),d=s(82592),u=s(92509),m=s(49525),x=s(6775),h=s(67294),f=s(50196),p=s(56264),g=s.n(p),b=s(11163),v=s(91444),j=s(66167),y=s(38260),N=s(62725),w=s(51853),C=s(21947),k=function(e){var t=e.activePlan,s=e.handleEndTrailAndStartBill,n=e.buttonLoader,a=e.handleDoNotCancelSubscription,r=(0,h.useState)(0),i=r[0],l=r[1];return(0,h.useEffect)((function(){if(t&&t.dateOfPurchase){var e=new Date,s=(0,y.j)(null===t||void 0===t?void 0:t.endsAt,e);l(s)}}),[t]),(0,o.jsx)(o.Fragment,{children:t&&("canceled"===(null===t||void 0===t?void 0:t.status)||(null===t||void 0===t?void 0:t.isCancelScheduled))?(0,o.jsx)("div",{className:"mt-8",children:(0,o.jsxs)("div",{className:"p-4 custom-shadow rounded-2xl bg-red-200 border border-red-400 flex gap-3 ",children:[(0,o.jsx)("div",{className:"text-base font-semibold text-red-900",children:(0,o.jsx)(w.Z,{})}),(0,o.jsxs)("div",{children:[(0,o.jsx)("h2",{className:"text-base font-semibold text-red-900 mb-1",children:"You have canceled your subscription."}),(0,o.jsxs)("p",{className:"text-sm text-red-700",children:["Your plan will expire on"," ",(0,o.jsxs)("span",{className:"text-red-900 font-semibold",children:[" ",t&&(null===t||void 0===t?void 0:t.endsAt)&&(0,N.WU)(null===t||void 0===t?void 0:t.endsAt,"PPP")]}),"."]}),(0,o.jsxs)("p",{className:"text-sm text-red-700",children:[" ","If you want to continue using Notion Addon, Please resubscribe to your preferred plan as soon as possible."]}),(0,o.jsx)("button",{className:"flex justify-center items-center bg-white hover:bg-gray-100 shadow-sm block rounded-xl text-gray-700 py-2 px-3 text-center text-sm font-medium leading-6 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600 ring-1 ring-inset ring-gray-300 mt-4",onClick:a,children:n?(0,o.jsx)(C.Z,{color:"#2563eb"}):"Don't Cancel"})]})]})}):t&&(null===t||void 0===t?void 0:t.onTrial)&&"active"===(null===t||void 0===t?void 0:t.status)?(0,o.jsx)("div",{className:"mt-8",children:(0,o.jsxs)("div",{className:"p-4 custom-shadow rounded-2xl bg-green-200 border border-green-400 flex gap-3 ",children:[(0,o.jsx)("div",{className:"text-base font-semibold text-green-900",children:(0,o.jsx)(w.Z,{})}),(0,o.jsxs)("div",{children:[(0,o.jsx)("h2",{className:"text-base font-semibold text-green-900 mb-1",children:"This subscription is currently trialing for the next ".concat(i," days.")}),(0,o.jsxs)("p",{className:"text-sm text-green-700",children:["Your trial ends on"," ",(0,o.jsxs)("span",{className:"text-green-900 font-semibold",children:[" ",t&&(null===t||void 0===t?void 0:t.endsAt)&&(0,N.WU)(null===t||void 0===t?void 0:t.endsAt,"PPP")]}),"."," "]}),(0,o.jsx)("p",{className:"text-sm text-green-700",children:"Click the below button to end the trial immediately and activate your subscription."}),(0,o.jsx)("button",{className:"flex justify-center items-center bg-white hover:bg-gray-100 shadow-sm block rounded-xl text-gray-700 py-2 px-3 text-center text-sm font-medium leading-6 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600 ring-1 ring-inset ring-gray-300 mt-4",onClick:s,children:n?(0,o.jsx)(C.Z,{color:"#2563eb"}):" End Trial & Bill Now"})]})]})}):null})},P=s(7658),_=function(e){var t,s=e.userData,n=e.router,a=e.handleGetSubscriptionData,r=e.activePlan,i=e.selectedPlan,l=e.isSubscribed;return(0,o.jsx)("div",{className:"mt-8 flex",children:(0,o.jsxs)("div",{className:"p-6 w-1/2 custom-shadow rounded-2xl",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h2",{className:"text-base font-semibold",children:"Plan Details"}),(0,o.jsxs)("p",{className:"text-sm text-gray-500",children:["You are currently logged in as"," ",(0,o.jsx)("span",{className:"text-grey-700 font-medium",children:null===s||void 0===s?void 0:s.email})]})]}),l&&(0,o.jsxs)("div",{className:"mt-4",children:[(0,o.jsxs)("h2",{className:"text-base font-semibold flex items-center mb-1",children:[(t=null===i||void 0===i?void 0:i.name,t?t.charAt(0).toUpperCase()+t.slice(1):""),(0,o.jsx)("span",{className:"bg-blue-100 text-blue-800 text-xs font-medium ml-2 px-2.5 py-0.5 rounded-md ring-1 ring-inset ring-blue-400",children:"yearly"===(null===i||void 0===i?void 0:i.planPeriod)?"Billed Yearly":"Billed Monthly"})]}),(0,o.jsxs)("p",{className:"text-xs",children:[(0,o.jsxs)("span",{className:"text-base font-semibold",children:["$",null===i||void 0===i?void 0:i.totalAmount,"0"]}),(0,o.jsxs)("span",{className:"text-sm text-gray-500",children:[" ","/","yearly"===(null===i||void 0===i?void 0:i.planPeriod)?"Year":"Month"," ","(Inc. tax)"]})," "]}),(0,o.jsxs)("p",{className:"text-sm text-gray-500",children:["renews on"," ",r&&(null===r||void 0===r?void 0:r.endsAt)&&(0,N.WU)(null===r||void 0===r?void 0:r.endsAt,"PPP")]})]}),l&&(0,o.jsxs)("div",{className:"flex gap-3 mt-6",children:[(0,o.jsx)("button",{className:"rounded-xl justify-center items-center bg-notion-addon-blue hover:bg-notion-addon-blue-hover text-white shadow-sm py-2 px-3 text-center text-sm font-semibold leading-6 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600",onClick:function(){return n.push(P.Z.PRICING)},children:"Change Plan"}),(0,o.jsx)("button",{className:"rounded-xl justify-center items-center bg-notion-addon-blue hover:bg-notion-addon-blue-hover text-white shadow-sm py-2 px-3 text-center text-sm font-semibold leading-6 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600",onClick:function(){return a()},children:"Update Payment Method"})]})]})})},Z=s(14860),T=s(63744),S=s(22274),A=s(70838),F=s(11358),B=s.n(F),L=s(60381),O=s(22729),M=s(11355),R=function(e){var t=e.isOpen,s=e.onClose,n=e.onConfirm,a=e.title,r=e.message,i=e.deleteButtonLabel,l=void 0===i?"Delete":i,c=e.SelectionMessage,d=e.pauseMonthList,u=e.pauseMessage,m=e.numberOfPauseMonths,x=e.onChange,f=(0,h.useState)(!1),p=f[0],g=f[1];return(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(M.u.Root,{show:t,as:h.Fragment,children:(0,o.jsx)("div",{children:(0,o.jsxs)(O.aR,{open:t,onClose:s,children:[(0,o.jsx)(M.u.Child,{as:h.Fragment,enter:"transition-opacity duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"transition-opacity duration-300",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,o.jsx)(O.vW,{children:(0,o.jsx)("div",{})})}),(0,o.jsx)(M.u.Child,{as:h.Fragment,enter:"transition-transform ease-out duration-300",enterFrom:"scale-95 opacity-0",enterTo:"scale-100 opacity-100",leave:"transition-transform ease-in duration-300",leaveFrom:"scale-100 opacity-100",leaveTo:"scale-95 opacity-0",children:(0,o.jsxs)(O._T,{className:"overflow-hidden ".concat(p?"fade-out":""),children:[(0,o.jsxs)(O.fY,{children:[(0,o.jsx)(O.f$,{children:a}),(0,o.jsx)(O.yT,{children:r}),(0,o.jsx)(O.yT,{children:c}),(0,o.jsx)(O.yT,{children:(0,o.jsx)("div",{className:"flex gap-4",children:d&&d.length>0&&d.map((function(e,t){return(0,o.jsx)("button",{className:"border-2 rounded-md w-10 h-10  hover:bg-notion-addon-blue-hover hover:text-white ".concat(m===e.value?"bg-notion-addon-blue text-white":"text-black"),onClick:function(){return x(e.value)},children:e.value},t+1)}))})}),(0,o.jsx)(O.yT,{className:"text-notion-addon-blue",children:u})]}),(0,o.jsxs)(O.xo,{children:[(0,o.jsx)(O.OL,{onClick:function(){g(!0),setTimeout((function(){s(),g(!1)}),200)},className:"bg-black text-white",children:"Cancel"}),(0,o.jsx)(O.OL,{onClick:function(){g(!0),setTimeout((function(){n(),g(!1)}),200)},className:"bg-red-600 hover:bg-red-700",children:l})]})]})})]})})})})},D=function(e){var t=e.plansList,s=function(e){return e?e.charAt(0).toUpperCase()+e.slice(1):""},n=function(e){var n=e.subscription,a=t.find((function(e){return e.id===n.planId}));return a?(0,o.jsxs)("div",{className:"",children:[(0,o.jsx)("span",{className:"block text-sm font-medium",children:s(a.name)}),(0,o.jsx)("span",{className:"block text-sm text-gray-500",children:s(a.planPeriod)})]}):(0,o.jsx)("div",{className:"text-red-500",children:"Plan not found"})},r=T.Z.getUser(),l=(0,h.useState)([]),c=l[0],d=l[1],u=(0,h.useState)(!1),m=u[0],x=u[1],p=(0,h.useState)(1),b=p[0],j=p[1],y=function(){var e=(0,a.Z)((function(){var e;return(0,i.__generator)(this,(function(t){switch(t.label){case 0:x(!0),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,f.default.get("".concat(Z._X,"/").concat(null===r||void 0===r?void 0:r.id))];case 2:return e=t.sent(),x(!1),d(g().camelizeKeys(null===e||void 0===e?void 0:e.data)),[3,4];case 3:return t.sent(),x(!1),v.Am.error("Something Went wrong. Please try again!",{autoClose:2e3,hideProgressBar:!0}),[3,4];case 4:return[2]}}))}));return function(){return e.apply(this,arguments)}}();(0,h.useEffect)((function(){y()}),[]);var w=Math.ceil(c.length/7),k=7*(b-1),P=c.slice(k,k+7),_=function(e){j(e.selected+1)};return(0,o.jsxs)("div",{className:"",children:[(0,o.jsx)("h2",{className:"text-base font-semibold",children:"Billing History"}),(0,o.jsxs)("table",{className:"min-w-full table-fixed text-sm mt-4",children:[(0,o.jsx)("thead",{className:"",children:(0,o.jsxs)("tr",{children:[(0,o.jsx)("th",{scope:"col",className:"py-3 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 border-b border-gray-200",children:"Invoice"}),(0,o.jsx)("th",{scope:"col",className:"py-3 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 border-b border-gray-200"}),(0,o.jsx)("th",{scope:"col",className:"py-3 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 border-b border-gray-200",children:"Amount"}),(0,o.jsx)("th",{scope:"col",className:"py-3 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 border-b border-gray-200",children:"Date Paid"}),(0,o.jsx)("th",{scope:"col",className:"py-3 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 border-b border-gray-200",children:"Product"}),(0,o.jsx)("th",{scope:"col",className:"py-3 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 border-b border-gray-200",children:"Payment Status"}),(0,o.jsx)("th",{scope:"col",className:"py-3 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 border-b border-gray-200",children:"Subscription Status"}),(0,o.jsx)("th",{scope:"col",className:"py-3 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 border-b border-gray-200"})]})}),(0,o.jsx)("tbody",{className:"divide-y divide-gray-200 bg-white",children:P&&P.length>0?P.map((function(e){var t;return(0,o.jsxs)("tr",{className:"whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-gray-900",children:[(0,o.jsx)("td",{className:"whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-gray-900",children:null===e||void 0===e?void 0:e.transactionId}),(0,o.jsx)("td",{className:"whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-gray-900",children:(null===e||void 0===e?void 0:e.reciptUrl)&&(0,o.jsx)("a",{href:null===e||void 0===e?void 0:e.reciptUrl,target:"_blank",className:"text-notion-addon-blue hover:underline hover:text-notion-addon-blue-hover",children:(0,o.jsx)(A.Z,{color:"#2563eb",width:20,height:20})})}),(0,o.jsxs)("td",{className:"whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-gray-900",children:["$",(null===e||void 0===e?void 0:e.onTrial)?"0.00":null===e||void 0===e||null===(t=e.plan)||void 0===t?void 0:t.totalAmount]}),(0,o.jsx)("td",{className:"whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-gray-900",children:(0,N.WU)(e.dateOfPurchase,"PPP")}),(0,o.jsx)("td",{className:"whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-gray-900",children:(0,o.jsx)(n,{subscription:e})}),(0,o.jsx)("td",{className:"whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-gray-900",children:(0,o.jsxs)("span",{className:"canceled"===(null===e||void 0===e?void 0:e.status)?"bg-red-100 text-red-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded-full dark:bg-red-900 dark:text-red-300":"bg-green-100 text-green-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded-full dark:bg-green-900 dark:text-green-300",children:[" ","canceled"===(null===e||void 0===e?void 0:e.status)?s(null===e||void 0===e?void 0:e.status):"Completed"]})}),(0,o.jsxs)("td",{className:"whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-gray-900",children:[(0,o.jsxs)("span",{className:"canceled"===(null===e||void 0===e?void 0:e.status)?"bg-red-100 text-red-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded-full dark:bg-red-900 dark:text-red-300":(null===e||void 0===e?void 0:e.onTrial)?"bg-blue-100 text-notion-addon-blue text-xs font-medium me-2 px-2.5 py-0.5 rounded-full dark:bg-blue-900 dark:text-blue-300":"bg-green-100 text-green-800 text-xs font-medium me-2 px-2.5 py-0.5 rounded-full dark:bg-green-900 dark:text-green-300",children:[" ","canceled"===(null===e||void 0===e?void 0:e.status)?s(null===e||void 0===e?void 0:e.status):(null===e||void 0===e?void 0:e.onTrial)?"Trial":s(null===e||void 0===e?void 0:e.status)]}),null===e||void 0===e?void 0:e.onTrial]})]},null===e||void 0===e?void 0:e.id)})):(0,o.jsx)("tr",{children:(0,o.jsx)("td",{colSpan:7,className:"!text-center py-4",children:m?(0,o.jsx)(C.Z,{color:"#2563eb",classname:"justify-center"}):"No Active Subscription"})})})]}),w>1&&!m&&(0,o.jsx)("div",{className:"pagination-sec flex mt-3",children:(0,o.jsxs)("div",{className:"flex ml-auto items-center gap-4",children:[(0,o.jsxs)("span",{className:"text-sm font-medium text-gray-400",children:["Page ",b," of ",w]}),(0,o.jsx)(B(),{breakLabel:"...",nextLabel:(0,o.jsx)(S.Z,{chartType:"PageangleRight"}),pageRangeDisplayed:0,pageCount:w,previousLabel:(0,o.jsx)(S.Z,{chartType:"PageangleLeft"}),renderOnZeroPageCount:null,containerClassName:"flex items-center justify-end gap-2 text-sm pagination",pageClassName:"hidden",handlePageClick:_,onPageChange:_,nextClassName:"text-white bg-white p-2 px-3 rounded-3xl text-sm select-none font-medium ".concat(b===w?"disabled":""),previousClassName:"text-white  bg-white p-2 px-3 rounded-3xl text-sm select-none font-medium ".concat(1===b?"disabled":""),onClick:function(e){_(e)},breakClassName:"hidden",disabledClassName:"text-gray-400 disabled_cursor rounded select-none",activeClassName:"active-page"})]})})]})},z=function(e){var t=e.handleCloseSubscriptionModalBox;return(0,o.jsx)(o.Fragment,{children:(0,o.jsxs)("div",{className:"mt-8",children:[(0,o.jsx)("div",{className:"mb-2",children:(0,o.jsx)("span",{className:"bg-red-100 text-red-800 text-xs font-medium me-2 px-2.5 py-0.5 dark:bg-red-900 dark:text-red-300 rounded-md ring-1 ring-inset ring-red-400",children:"Danger Zone"})}),(0,o.jsxs)("div",{children:[(0,o.jsx)("h2",{className:"text-lg font-bold",children:"Cancel Subscription"}),(0,o.jsx)("p",{className:"text-sm text-gray-500",children:"Upon cancelling, once your current billing periods ends, your subscription will be deactivated."})]}),(0,o.jsx)("button",{className:"flex justify-center items-center bg-red-600 hover:bg-red-700-hover text-white shadow-sm mt-6 block rounded-xl py-2 px-3 text-center text-sm font-semibold leading-6 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-red-600",onClick:t,children:"Cancel Subscription"})]})})},I=function(e){var t=e.router;return(0,o.jsx)("div",{className:"mt-8",children:(0,o.jsxs)("div",{className:"p-4 custom-shadow rounded-2xl bg-blue-200 border border-blue-400 flex gap-3 w-1/2",children:[(0,o.jsx)("div",{className:"text-base font-semibold text-blue-900"}),(0,o.jsxs)("div",{children:[(0,o.jsx)("h2",{className:"text-base font-semibold text-blue-900 mb-1",children:"You don't have an active plan right now."}),(0,o.jsx)("p",{className:"text-sm text-blue-700",children:"Please subscribe to a plan to continue using Notion Addon."}),(0,o.jsx)("button",{className:"flex justify-center items-center bg-white hover:bg-gray-100 shadow-sm block rounded-xl text-gray-700 py-2 px-3 text-center text-sm font-medium leading-6 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600 ring-1 ring-inset ring-gray-300 mt-4",onClick:function(){return t.push(P.Z.PRICING)},children:"Get Started"})]})]})})},E=s(42027),Y=function(e){var t=e.onConfirm,s=e.onClose,n=e.isOpen,a=e.handleContactSupport,r=e.handlePauseSubscription,i=e.activePlan,l=(0,h.useState)(!1),c=l[0],d=l[1];return(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(M.u.Root,{show:n,as:h.Fragment,children:(0,o.jsx)("div",{children:(0,o.jsxs)(O.aR,{open:n,onClose:s,children:[(0,o.jsx)(M.u.Child,{as:h.Fragment,enter:"transition-opacity duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"transition-opacity duration-300",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,o.jsx)(O.vW,{children:(0,o.jsx)("div",{})})}),(0,o.jsx)(M.u.Child,{as:h.Fragment,enter:"transition-transform ease-out duration-300",enterFrom:"scale-95 opacity-0",enterTo:"scale-100 opacity-100",leave:"transition-transform ease-in duration-300",leaveFrom:"scale-100 opacity-100",leaveTo:"scale-95 opacity-0",children:(0,o.jsxs)(O._T,{className:"overflow-hidden ".concat(c?"fade-out":""," "),children:[(0,o.jsx)(O.fY,{children:(0,o.jsx)(O.f$,{children:"Cancel Subscription"})}),(0,o.jsx)(O.yT,{children:"Before you go, talk to us & give us a chance to set things right?"}),(0,o.jsx)(O.OL,{onClick:a,className:"bg-green-600 hover:bg-green-700 mt-2 w-1/3 mb-2",children:"Contact Support"}),(0,o.jsx)(O.yT,{children:"If you cancel now, you'll lose access to your Addon's fetaures immediately."}),(0,o.jsx)(O.yT,{className:"",children:(0,o.jsxs)("div",{children:[(0,o.jsxs)("p",{className:"flex gap-3 mb-2",children:[(0,o.jsx)("span",{className:"text-red-500",children:(0,o.jsx)(E.Z,{className:"h-5 w-5"})}),(0,o.jsx)("span",{children:"Your portal will stop syncing."})]}),(0,o.jsxs)("p",{className:"flex gap-3 mb-2",children:[(0,o.jsx)("span",{className:"text-red-500",children:(0,o.jsx)(E.Z,{className:"h-5 w-5"})}),(0,o.jsx)("span",{children:"Chart & Form embeds will be disabled."})]}),(0,o.jsxs)("p",{className:"flex gap-3 mb-2",children:[(0,o.jsx)("span",{className:"text-red-500",children:(0,o.jsx)(E.Z,{className:"h-5 w-5"})}),(0,o.jsx)("span",{children:"You'll lose all access to everything else."})]})]})}),(0,o.jsxs)(O.xo,{children:[(0,o.jsx)(O.OL,{onClick:function(){d(!0),setTimeout((function(){s(),d(!1)}),200)},className:"bg-black text-white",children:"Stay"}),i&&!i.onTrial&&(0,o.jsx)(O.OL,{onClick:r,className:"bg-notion-addon-blue text-white hover:bg-notion-addon-blue-hover",children:"Pause"}),(0,o.jsx)(O.OL,{onClick:function(){d(!0),setTimeout((function(){t(),d(!1)}),200)},className:"bg-red-600 hover:bg-red-700",children:"Cancel"})]})]})})]})})})})},W=function(e){var t=e.onConfirm,s=e.onClose,n=e.isOpen,a=e.text,r=e.handleChange,i=(0,h.useState)(!1),l=i[0],c=i[1],d=a.replace(/\s+/g,"").length;return(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(M.u.Root,{show:n,as:h.Fragment,children:(0,o.jsx)("div",{children:(0,o.jsxs)(O.aR,{open:n,onClose:s,children:[(0,o.jsx)(M.u.Child,{as:h.Fragment,enter:"transition-opacity duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"transition-opacity duration-300",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,o.jsx)(O.vW,{children:(0,o.jsx)("div",{})})}),(0,o.jsx)(M.u.Child,{as:h.Fragment,enter:"transition-transform ease-out duration-300",enterFrom:"scale-95 opacity-0",enterTo:"scale-100 opacity-100",leave:"transition-transform ease-in duration-300",leaveFrom:"scale-100 opacity-100",leaveTo:"scale-95 opacity-0",children:(0,o.jsxs)(O._T,{className:"overflow-hidden ".concat(l?"fade-out":""," "),children:[(0,o.jsx)(O.fY,{children:(0,o.jsx)(O.f$,{children:"We're sorry to see you go!"})}),(0,o.jsx)(O.yT,{children:"Before you leave, take a moment to tell us why?"}),(0,o.jsx)(O.yT,{children:"We consider ALL feedback & use it to improve Notion Addon!"}),(0,o.jsxs)(O.yT,{className:"font-medium text-black",children:[(0,o.jsx)("div",{children:(0,o.jsx)("textarea",{className:"w-full p-2 border border-gray-300 rounded",value:a,onChange:r,rows:"4",placeholder:"Reason.."})}),d<25&&(0,o.jsxs)("div",{className:"text-right text-gray-600",children:[d,"/25"]})]}),(0,o.jsxs)(O.xo,{children:[(0,o.jsx)(O.OL,{onClick:function(){c(!0),setTimeout((function(){s(),c(!1)}),200)},className:"bg-black text-white",children:"Stay"}),(0,o.jsx)(O.OL,{onClick:function(){c(!0),setTimeout((function(){t(),c(!1)}),200)},className:"bg-red-600 hover:bg-red-700",children:"Cancel"})]})]})})]})})})})},U=(null===(n='["abdo@mobayad.com","notion@onehouse.com","gauravtest12@yopmail.com","iziad652@gmail.com","rordev@ongraph.com"]')?void 0:n.split(","))||["abdo@mobayad.com","notion@onehouse.com","rordev@ongraph.com","iziad652@gmail.com"],$=[{id:1,value:1},{id:2,value:2},{id:3,value:3}],J=function(){var e=T.Z.getUser(),t=(0,b.useRouter)(),s=(0,h.useState)([]),n=s[0],r=s[1],l=(0,h.useState)(!0),c=l[0],d=l[1],u=(0,h.useState)(!1),m=u[0],x=u[1],p=(0,h.useState)(!1),y=p[0],w=p[1],P=(0,h.useState)(null),S=P[0],A=P[1],F=(0,h.useState)(null),B=F[0],L=F[1],O=(0,h.useState)(!1),M=O[0],E=O[1],J=(0,h.useState)(1),K=J[0],V=J[1],q=(0,h.useState)(null),X=q[0],G=q[1],H=(0,h.useState)(!1),Q=H[0],ee=H[1],te=(0,h.useState)(""),se=te[0],ne=te[1],ae=(0,h.useState)(!1),re=ae[0],ie=ae[1],oe=(0,h.useCallback)((0,a.Z)((function(){var t,s,n,a,r,o;return(0,i.__generator)(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,f.default.get(Z.RM,{params:{user_id:null===e||void 0===e?void 0:e.id}})];case 1:if(t=i.sent().data,s=t.subscription_id,n=t.data,a=JSON.parse(n),r=a.data,o=r.id,!s||!o)throw new Error("Invalid subscription data");return le({subscriptionId:s,transactionId:o}),[3,3];case 2:return i.sent(),v.Am.error("Failed to retrieve subscription data. Please try again.",{autoClose:2e3,hideProgressBar:!0}),[3,3];case 3:return[2]}}))})),[e]),le=(0,h.useCallback)((function(e){var t=e.subscriptionId,s=e.transactionId;(0,j.J4)({environment:"production",token:"live_2398ed0df39f1331d9718e34916",eventCallback:function(){var e=(0,a.Z)((function(e){return(0,i.__generator)(this,(function(e){return[2]}))}));return function(t){return e.apply(this,arguments)}}()}).then((function(e){e&&e.Checkout.open({transactionId:s,mode:"update",subscriptionId:t})})).catch((function(e){console.error("Error initializing Paddle:",e),v.Am.error("An error occurred during checkout. Please try again later.",{autoClose:2e3,hideProgressBar:!0})}))}),[]),ce=(0,h.useCallback)((0,a.Z)((function(){var e,t;return(0,i.__generator)(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,f.default.get(Z.ej)];case 1:return e=s.sent().data,[2,g().camelizeKeys(e.plans)];case 2:return t=s.sent(),console.error("Error fetching plan list:",t),[3,3];case 3:return[2]}}))})),[]),de=(0,h.useCallback)((0,a.Z)((function(){var t,s,n,a,o,l;return(0,i.__generator)(this,(function(i){switch(i.label){case 0:return i.trys.push([0,3,4,5]),[4,ce()];case 1:return t=i.sent(),r(t),U.includes(null===e||void 0===e?void 0:e.email)?(w(!0),[2]):(d(!0),[4,f.default.get("".concat(Z._X,"/").concat(null===e||void 0===e?void 0:e.id))]);case 2:return s=i.sent().data,(n=g().camelizeKeys(s))&&n.length>0&&(a=n.find((function(e){return"active"===e.status})))?(A(a),w(!0),a.planId&&((o=t.find((function(e){return e.id===a.planId})))?L(o):console.warn("Selected plan not found in the plans list"))):(w(!1),A(null),L(null)),[3,5];case 3:return l=i.sent(),console.error("Error checking subscription:",l),w(!1),[3,5];case 4:return d(!1),[7];case 5:return[2]}}))})),[e,ce]),ue=function(e){if(S){var t=S.dateOfPurchase,s=S.planPeriod,n=new Date(t),a=new Date(n);"yearly"===s?a.setFullYear(a.getFullYear()+1):"monthly"===s&&a.setMonth(a.getMonth()+1),a.setMonth(a.getMonth()+e),G(a)}},me=function(){var t=(0,a.Z)((function(){var t;return(0,i.__generator)(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,3,4]),[4,f.default.post(Z.Ks,{user_id:null===e||void 0===e?void 0:e.id,pause_for:parseInt(K)})];case 1:return s.sent(),v.Am.success("Subscription paused successfully",{autoClose:2e3,hideProgressBar:!0}),[3,4];case 2:return t=s.sent(),console.error("Error pause subscription:",t),v.Am.error("Failed to pause subscription. Please try again later.",{autoClose:2e3,hideProgressBar:!0}),[3,4];case 3:return ee(!1),[7];case 4:return[2]}}))}));return function(){return t.apply(this,arguments)}}(),xe=function(){var t=(0,a.Z)((function(){var t;return(0,i.__generator)(this,(function(s){switch(s.label){case 0:if(se.replace(/\s+/g,"").length<25)return v.Am.error("The text must be at least 25 characters.",{autoClose:2e3,hideProgressBar:!0}),[2];s.label=1;case 1:return s.trys.push([1,3,4,5]),[4,f.default.post(Z.EO,{user_id:null===e||void 0===e?void 0:e.id,reason:se})];case 2:return s.sent(),de(),v.Am.success("Subscription canceled successfully",{autoClose:2e3,hideProgressBar:!0}),ne(""),[3,5];case 3:return t=s.sent(),console.error("Error canceling subscription:",t),v.Am.error("Failed to cancel subscription. Please try again later.",{autoClose:2e3,hideProgressBar:!0}),[3,5];case 4:return ie(!1),[7];case 5:return[2]}}))}));return function(){return t.apply(this,arguments)}}(),he=function(){var t=(0,a.Z)((function(){var t;return(0,i.__generator)(this,(function(s){switch(s.label){case 0:x(!0),s.label=1;case 1:return s.trys.push([1,3,4,5]),[4,f.default.post(Z.jM,{user_id:null===e||void 0===e?void 0:e.id})];case 2:return s.sent(),de(),v.Am.success("Billing started successfully.",{autoClose:2e3,hideProgressBar:!0}),[3,5];case 3:return t=s.sent(),console.error("Error pause subscription:",t),v.Am.error("Failed to end trail and start billing. Please try again later.",{autoClose:2e3,hideProgressBar:!0}),[3,5];case 4:return x(!1),[7];case 5:return[2]}}))}));return function(){return t.apply(this,arguments)}}(),fe=function(){var t=(0,a.Z)((function(){var t;return(0,i.__generator)(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,f.default.post(Z.YR,{user_id:null===e||void 0===e?void 0:e.id})];case 1:return s.sent(),v.Am.success("Subscription continued successful.",{autoClose:2e3,hideProgressBar:!0}),de(),[3,3];case 2:return t=s.sent(),v.Am.error("An error occurred while processing your continue subscription. Please try again later.",{autoClose:2e3,hideProgressBar:!0}),console.error("Error continue plan:",t),[3,3];case 3:return[2]}}))}));return function(){return t.apply(this,arguments)}}();return(0,h.useEffect)((function(){de()}),[t.asPath]),c?(0,o.jsx)("div",{className:"sm:px-6 lg:px-8",children:(0,o.jsx)("div",{className:"text-center flex justify-center mt-10",children:(0,o.jsx)(C.Z,{color:"#2563eb"})})}):(0,o.jsxs)(o.Fragment,{children:[y&&(0,o.jsx)(k,{activePlan:S,handleEndTrailAndStartBill:he,buttonLoader:m,handleDoNotCancelSubscription:fe}),!y&&(0,o.jsx)(I,{router:t}),(0,o.jsx)(_,{userData:e,router:t,handleGetSubscriptionData:oe,activePlan:S,selectedPlan:B,isSubscribed:y}),y&&(0,o.jsx)("div",{className:"mt-8 p-6 bg-white rounded-2xl custom-shadow",children:(0,o.jsx)(D,{plansList:n})}),y&&(0,o.jsx)(z,{handleCloseSubscriptionModalBox:function(){E(!0)}}),(0,o.jsx)(Y,{onConfirm:function(){E(!1),ie(!0)},onClose:function(){E(!1)},isOpen:M,handleContactSupport:function(){E(!1);var e=encodeURIComponent("Reason to cancel subscription."),t="mailto:".concat("abdo@notionaddon.io","?subject=").concat(e);window.location.href=t},handlePauseSubscription:function(){E(!1),ue(K),ee(!0)},activePlan:S}),(0,o.jsx)(R,{isOpen:Q,onClose:function(){ee(!1),E(!0)},onConfirm:me,title:"Pause Subscription",message:"Your subscription will be paused at the end of your current plan.",SelectionMessage:"You can pause for a maximum of 3 months.",pauseMonthList:$,pauseMessage:"Your Subscription will resume on: ".concat(X&&(0,N.WU)(X,"LLL dd, y")),deleteButtonLabel:"Pause",numberOfPauseMonths:K,onChange:function(e){V(e),ue(e)}}),(0,o.jsx)(W,{onConfirm:xe,isOpen:re,onClose:function(){ie(!1),ne("")},text:se,handleChange:function(e){ne(e.target.value)}})]})},K=s(27345),V=s(8100),q=s(92871);var X=function(){var e=(0,V.ZP)(Z.hR,q._,{revalidateOnFocus:!0,revalidateOnMount:!0}),t=e.data,s=e.error;return{workspaces:t,isLoading:!s&&!t,isError:s}},G=s(95593),H=s(90532),Q=s(47356);var ee=s(26042),te=s(69396),se=s(87536);var ne=s(84483),ae=s(77e3),re=function(){var e=(0,h.useState)(1),t=e[0],s=e[1],n=(0,h.useState)(!1),r=n[0],l=n[1],c=(0,h.useState)([]),d=c[0],u=c[1],m=(0,h.useState)(""),x=m[0],p=m[1],b=(0,h.useState)(!1),j=b[0],y=b[1],N=(0,h.useState)(null),w=N[0],k=N[1],P=T.Z.getUser(),_=function(){var e=(0,a.Z)((function(){return(0,i.__generator)(this,(function(e){switch(e.label){case 0:if(!x)return v.Am.error("Email address is required",{autoClose:2e3,hideProgressBar:!0}),[2];if(!function(e){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(e).toLowerCase())}(x))return v.Am.error("Invalid email address",{autoClose:2e3,hideProgressBar:!0}),[2];l(!0),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,f.default.post(Z.wd,{user_id:null===P||void 0===P?void 0:P.id,email:x})];case 2:return 200===e.sent().status?(v.Am.success("Invitation sent successfully",{autoClose:2e3,hideProgressBar:!0}),A(),p("")):(v.Am.error("Failed to send invitation",{autoClose:2e3,hideProgressBar:!0}),l(!1)),[3,4];case 3:return e.sent(),v.Am.error("Failed to send invitation",{autoClose:2e3,hideProgressBar:!0}),l(!1),[3,4];case 4:return[2]}}))}));return function(){return e.apply(this,arguments)}}(),A=function(){var e=(0,a.Z)((function(){var e,t,s;return(0,i.__generator)(this,(function(n){switch(n.label){case 0:l(!0),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,f.default.get(Z.X1,{params:{user_id:null===P||void 0===P?void 0:P.id}})];case 2:return 200===(e=n.sent()).status?(s=null===e||void 0===e||null===(t=e.data)||void 0===t?void 0:t.members.filter((function(e){return"owner"!==e.organization_role})),u(g().camelizeKeys(s)),l(!1)):(v.Am.error("Failed to fetch team members",{autoClose:2e3,hideProgressBar:!0}),l(!1)),[3,4];case 3:return n.sent(),v.Am.error("Failed to fetch team members",{autoClose:2e3,hideProgressBar:!0}),l(!1),[3,4];case 4:return[2]}}))}));return function(){return e.apply(this,arguments)}}();(0,h.useEffect)((function(){A()}),[P]);var F=function(){var e=(0,a.Z)((function(){return(0,i.__generator)(this,(function(e){switch(e.label){case 0:l(!0),e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,f.default.post(Z.MH,{user_id:parseInt(w)})];case 2:return 200===e.sent().status?(v.Am.success("Team member deleted successfully",{autoClose:2e3,hideProgressBar:!0}),A()):(v.Am.error("Failed to delete team member",{autoClose:2e3,hideProgressBar:!0}),l(!1)),[3,5];case 3:return e.sent(),v.Am.error("An error occurred while deleting the team member",{autoClose:2e3,hideProgressBar:!0}),l(!1),[3,5];case 4:return y(!1),[7];case 5:return[2]}}))}));return function(){return e.apply(this,arguments)}}(),O=function(){var e=(0,a.Z)((function(e){return(0,i.__generator)(this,(function(t){return k(e),y(!0),[2]}))}));return function(t){return e.apply(this,arguments)}}(),M=Math.ceil(d.length/7),R=7*(t-1),D=d.slice(R,R+7),z=function(e){s(e.selected+1)};return(0,o.jsxs)("div",{className:"py-6 sm:mx-auto sm:w-full sm:max-w-md",children:[(0,o.jsx)("h2",{className:"text-center text-2xl font-bold tracking-tight text-gray-900",children:"Addon Team"}),(0,o.jsx)("p",{className:"mt-1 text-center text-sm tracking-tight text-gray-500",children:"Users invited to your team plan."}),(0,o.jsxs)("div",{className:"text-center mt-5",children:[(0,o.jsx)("p",{id:"add-team-members-helper",className:"sr-only",children:"Search by email address"}),(0,o.jsxs)("div",{className:"flex",children:[(0,o.jsx)("div",{className:"flex-grow",children:(0,o.jsx)("input",{type:"text",name:"add-team-members",id:"add-team-members",className:"block w-full rounded-lg border-gray-300 shadow-sm focus:border-notion-addon-blue focus:ring-notion-addon-blue sm:text-sm",placeholder:"Email address","aria-describedby":"add-team-members-helper",value:x,onChange:function(e){p(e.target.value)}})}),(0,o.jsx)("span",{className:"ml-3",children:(0,o.jsxs)("button",{type:"button",className:"inline-flex items-center rounded-xl border border-notion-addon-blue bg-notion-addon-blue hover:bg-notion-addon-blue-hover px-4 py-2 text-sm font-medium shadow-sm focus:outline-none focus:ring-2 focus:ring-notion-addon-blue focus:ring-offset-2 text-white",onClick:_,children:[(0,o.jsx)(ae.Z,{className:"-ml-2 mr-1 h-5 w-5 text-white","aria-hidden":"true"}),(0,o.jsx)("span",{children:"Add"})]})})]}),(0,o.jsx)("div",{className:"",children:(0,o.jsxs)("div",{className:"min-h-[60%]",children:[(0,o.jsx)("table",{className:"table-fixed simple-table",children:(0,o.jsx)("tbody",{className:"divide-y divide-gray-200 bg-white",children:!r&&D&&D.length>0?null===D||void 0===D?void 0:D.map((function(e,t){return(0,o.jsxs)("tr",{className:"w-full !flex items-center justify-between space-x-6 h-16 mb-3",children:[(0,o.jsx)("td",{className:"w-full max-w-0 px-8 py-0 font-medium text-sm text-gray-900 sm:w-auto sm:max-w-none",children:(0,o.jsx)("span",{className:"flex gap-3 items-center text-sm font-medium text-gray-900 text-left",children:(0,o.jsx)(o.Fragment,{children:(0,o.jsxs)("div",{className:"ml-3 flex flex-col",children:[(0,o.jsx)("span",{className:"text-sm font-medium text-gray-900 text-left",children:null===e||void 0===e?void 0:e.name}),(0,o.jsx)("span",{className:"text-sm text-gray-500",children:null===e||void 0===e?void 0:e.email})]})})})}),(0,o.jsx)(H.pn,{children:(0,o.jsx)("td",{className:"w-full max-w-0 px-8 py-0 font-medium text-sm text-gray-900 sm:w-auto sm:max-w-none",onClick:function(){return O(e.id)},children:(0,o.jsxs)(H.u,{delayDuration:0,children:[(0,o.jsx)(H.aJ,{className:"",children:(0,o.jsx)("span",{className:"flex gap-3 items-center text-sm font-medium text-gray-900 text-left",children:(0,o.jsx)(S.Z,{chartType:"bin"})})}),(0,o.jsxs)(H._v,{className:"TooltipContent",side:"bottom",children:[(0,o.jsx)("p",{children:"Delete Member"}),(0,o.jsx)(Q.Ce,{className:"TooltipArrow"})]})]})})})]},t+1)})):(0,o.jsx)("td",{colSpan:5,className:"!text-center py-4 !flex !justify-center text-sm",children:r?(0,o.jsx)(C.Z,{color:"#2563eb"}):"No Members Found"})})}),M>1&&!r&&(0,o.jsx)("div",{className:"pagination-sec flex mt-3",children:(0,o.jsxs)("div",{className:"flex ml-auto items-center gap-4",children:[(0,o.jsxs)("span",{className:"text-sm font-medium text-gray-400",children:["Page ",t," of ",M]}),(0,o.jsx)(B(),{breakLabel:"...",nextLabel:(0,o.jsx)(S.Z,{chartType:"PageangleRight"}),pageRangeDisplayed:0,pageCount:M,previousLabel:(0,o.jsx)(S.Z,{chartType:"PageangleLeft"}),renderOnZeroPageCount:null,containerClassName:"flex items-center justify-end gap-2 text-sm pagination",pageClassName:"hidden",handlePageClick:z,onPageChange:z,nextClassName:"text-white bg-white p-2 px-3 rounded-3xl text-sm select-none font-medium ".concat(t===M?"disabled":""),previousClassName:"text-white  bg-white p-2 px-3 rounded-3xl text-sm select-none font-medium ".concat(1===t?"disabled":""),onClick:function(e){z(e)},breakClassName:"hidden",disabledClassName:"text-gray-400 disabled_cursor rounded select-none",activeClassName:"active-page"})]})})]})})]}),(0,o.jsx)(L.Z,{isOpen:j,onClose:function(){k(null),y(!1)},onConfirm:F,title:"Delete Team Member",message:"Are you sure you want to delete this team member?"})]})},ie=function(){var e=(0,ne.Z)(),t=e.users,s=e.isLoading,n=X(),a=n.workspaces,r=n.isLoading,i=(0,h.useState)(1),l=i[0],c=i[1],d=(0,h.useState)([]),m=d[0],x=d[1],f=(T.Z.getUser(),(0,h.useMemo)((function(){return function(e){if(!Array.isArray(e))return[];var t=a.filter((function(t){return e.includes(t.id)})).map((function(e,t){return{name:e.name,icon_url:e.icon_url,id:t+1}}));x(t)}}),[a])),p=Math.ceil(t.length/7),g=7*(l-1),b=t.slice(g,g+7),v=function(e){c(e.selected+1)};return(0,o.jsxs)("div",{className:"py-6 sm:mx-auto sm:w-full sm:max-w-md",children:[(0,o.jsx)("h2",{className:"text-center text-2xl font-bold tracking-tight text-gray-900",children:"Notion Members"}),(0,o.jsx)("p",{className:"mt-1 text-center text-sm tracking-tight text-gray-500",children:"Your Notion Workspace members."}),(0,o.jsx)("div",{className:"text-center mt-5",children:(0,o.jsx)("div",{className:"",children:(0,o.jsxs)("div",{className:"min-h-[60%]",children:[(0,o.jsx)("table",{className:"table-fixed simple-table",children:(0,o.jsx)("tbody",{className:"divide-y divide-gray-200 bg-white",children:b&&b.length>0?null===b||void 0===b?void 0:b.map((function(e,t){var s;return(0,o.jsxs)("tr",{className:"w-full !flex items-center justify-between space-x-6 h-16 mb-3",children:[(0,o.jsx)("td",{className:"w-full max-w-0 px-8 py-0 font-medium text-sm text-gray-900 sm:w-auto sm:max-w-none",children:(0,o.jsx)("span",{className:"flex gap-3 items-center text-sm font-medium text-gray-900 text-left",children:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("img",{className:"h-10 w-10 rounded-full",src:e.avatar_url,alt:""}),(0,o.jsxs)("div",{className:"ml-3 flex flex-col",children:[(0,o.jsx)("span",{className:"text-sm font-medium text-gray-900 text-left",children:e.name}),(0,o.jsx)("span",{className:"text-sm text-gray-500",children:null===(s=e.person)||void 0===s?void 0:s.email})]})]})})}),(0,o.jsx)(H.pn,{children:(0,o.jsx)("td",{className:"w-full max-w-0 px-8 py-0 font-medium text-sm text-gray-900 sm:w-auto sm:max-w-none",children:(0,o.jsxs)(H.u,{delayDuration:0,children:[(0,o.jsx)(H.aJ,{className:"",onMouseEnter:function(){return f(null===e||void 0===e?void 0:e.workspace_ids)},children:(0,o.jsx)("span",{className:"flex gap-3 items-center text-sm font-medium text-gray-900 text-left",children:(0,o.jsx)(u.Z,{className:"w-5 h-5"})})}),(0,o.jsxs)(H._v,{className:"TooltipContent",side:"bottom",children:[(0,o.jsx)("div",{className:"flex",children:(null===e||void 0===e?void 0:e.workspace_ids)&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("ul",{className:"mr-4 list-none",children:m.slice(0,Math.min(m.length,5)).map((function(e,t){return(0,o.jsx)("li",{className:"text-white before:text-white mb-2 mt-2",children:(0,o.jsxs)("div",{className:"flex gap-2 items-center Form_TooltipContent",children:[(null===e||void 0===e?void 0:e.icon_url)?(0,o.jsx)("img",{className:"w-5",src:e.icon_url,alt:"icon"}):(0,o.jsx)("img",{className:"",src:"/charts_icons/database_default_white.svg",alt:"icon",width:20,height:20}),e.name]})},t+1)}))}),m.length>5&&(0,o.jsx)("ul",{className:"list-none",children:m.slice(5,m.length).map((function(e,t){return(0,o.jsx)("li",{className:"text-white before:text-white mb-2",children:(0,o.jsxs)("div",{className:"flex gap-2 items-center Form_TooltipContent",children:[(null===e||void 0===e?void 0:e.icon_url)?(0,o.jsx)("img",{className:"w-5",src:e.icon_url,alt:"icon"}):(0,o.jsx)("img",{className:"",src:"/charts_icons/database_default_white.svg",alt:"icon",width:20,height:20}),e.name]})},t+1)}))})]})}),(0,o.jsx)(Q.Ce,{className:"TooltipArrow"})]})]})})})]},t+1)})):(0,o.jsx)("tr",{children:(0,o.jsx)("td",{colSpan:5,className:"!text-center py-4 !flex !justify-center text-sm",children:s||r?(0,o.jsx)(C.Z,{color:"#2563eb"}):"No Members Invited"})})})}),p>1&&!(s||r)&&(0,o.jsx)("div",{className:"pagination-sec flex mt-3",children:(0,o.jsxs)("div",{className:"flex ml-auto items-center gap-4",children:[(0,o.jsxs)("span",{className:"text-sm font-medium text-gray-400",children:["Page ",l," of ",p]}),(0,o.jsx)(B(),{breakLabel:"...",nextLabel:(0,o.jsx)(S.Z,{chartType:"PageangleRight"}),pageRangeDisplayed:0,pageCount:p,previousLabel:(0,o.jsx)(S.Z,{chartType:"PageangleLeft"}),renderOnZeroPageCount:null,containerClassName:"flex items-center justify-end gap-2 text-sm pagination",pageClassName:"hidden",handlePageClick:v,onPageChange:v,nextClassName:"text-white bg-white p-2 px-3 rounded-3xl text-sm select-none font-medium ".concat(l===p?"disabled":""),previousClassName:"text-white  bg-white p-2 px-3 rounded-3xl text-sm select-none font-medium ".concat(1===l?"disabled":""),onClick:function(e){v(e)},breakClassName:"hidden",disabledClassName:"text-gray-400 disabled_cursor rounded select-none",activeClassName:"active-page"})]})})]})})})]})},oe=s(50360),le=function(){return(0,o.jsx)(o.Fragment,{children:(0,o.jsxs)("div",{className:"py-6 sm:mx-auto sm:w-full sm:max-w-md",children:[(0,o.jsx)("h2",{className:"text-center text-2xl font-bold tracking-tight text-gray-900",children:"Your Templates"}),(0,o.jsx)("p",{className:"mt-1 text-center text-sm tracking-tight text-gray-500",children:"Your purchases can be found here"}),(0,o.jsx)("div",{className:"",children:(0,o.jsx)("div",{className:"min-h-[60%]",children:(0,o.jsx)("table",{className:"table-fixed simple-table",children:(0,o.jsx)("tbody",{className:"divide-y divide-gray-200 bg-white",children:(0,o.jsxs)("tr",{className:"w-full !flex items-center justify-between space-x-6 h-16 mb-3 !rounded-xl",children:[(0,o.jsx)(H.pn,{children:(0,o.jsx)("td",{className:"w-full max-w-0 px-8 py-0 font-medium text-sm text-gray-900 sm:w-auto sm:max-w-none",children:(0,o.jsxs)(H.u,{delayDuration:0,children:[(0,o.jsx)(H.aJ,{className:"",children:(0,o.jsx)("span",{className:"flex gap-3 items-center text-sm font-medium text-gray-900 text-left",children:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("img",{className:"w-5 h-5",src:"/notion-addon-logo.svg",alt:"Notion Addon"}),"Notion Addon OS"]})})}),(0,o.jsxs)(H._v,{className:"TooltipContent",side:"bottom",children:[(0,o.jsx)("p",{className:"flex items-center",children:"Company Management System"}),(0,o.jsx)(Q.Ce,{className:"TooltipArrow"})]})]})})}),(0,o.jsx)(H.pn,{children:(0,o.jsx)("td",{className:"w-full max-w-0 px-8 py-0 font-medium text-sm text-gray-900 sm:w-auto sm:max-w-none",children:(0,o.jsx)("a",{href:"https://addon.notion.site/Notion-Addon-OS-c885128f79e244b9a62c66d5ad82bd03?pvs=4",target:"_blank",className:"rounded-sm p-2 w-10 h-10 flex items-center justify-center",children:(0,o.jsxs)(H.u,{delayDuration:0,children:[(0,o.jsx)(H.aJ,{children:(0,o.jsx)(S.Z,{chartType:"share"})}),(0,o.jsxs)(H._v,{className:"TooltipContent",side:"bottom",children:[(0,o.jsx)("p",{className:"flex items-center",children:"Duplicate"}),(0,o.jsx)(Q.Ce,{className:"TooltipArrow"})]})]})})})})]},"workspace")})})})})]})})},ce=[{name:"Workspaces",value:"Workspaces",href:"#Workspaces",icon:(0,o.jsx)(u.Z,{className:"w-5 h-5"})},{name:"Password",value:"Password",href:"#Password",icon:(0,o.jsx)(l.Z,{className:"w-5 h-5"})},{name:"Members",value:"Members",href:"#Members",icon:(0,o.jsx)(m.Z,{className:"w-5 h-5"})},{name:"Billing",value:"Billing",href:"#Billing",icon:(0,o.jsx)(c.Z,{className:"w-5 h-5"})},{name:"Team",value:"Team",href:"#Team",icon:(0,o.jsx)(m.Z,{className:"w-5 h-5"})}],de={name:"Templates",value:"Templates",href:"#Templates",icon:(0,o.jsx)(d.Z,{className:"w-5 h-5"})},ue='["abdo@mobayad.com","notion@onehouse.com","gauravtest12@yopmail.com","iziad652@gmail.com","rordev@ongraph.com"]',me={Workspaces:function(e){e.setActiveTab;var t=X(),s=t.workspaces,n=t.isLoading,r=(0,b.useRouter)(),l=(0,h.useState)(null),c=l[0],d=l[1],u=(0,h.useState)(!1),m=u[0],x=u[1],p=(0,h.useState)(1),g=p[0],j=p[1],y=function(){var e=(0,a.Z)((function(){return(0,i.__generator)(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,f.default.delete("".concat(Z.hR,"/").concat(c))];case 1:return e.sent(),d(null),x(!1),v.Am.success("Workspace Deleted!",{autoClose:2e3,hideProgressBar:!0}),r.reload(),[3,3];case 2:return e.sent(),v.Am.error("Something Went wrong. Please try again!",{autoClose:2e3,hideProgressBar:!0}),[3,3];case 3:return[2]}}))}));return function(){return e.apply(this,arguments)}}();if(n)return(0,o.jsx)(G.Z,{});var N=Math.ceil((null===s||void 0===s?void 0:s.length)/7),w=7*(g-1),C=s&&s.slice(w,w+7),k=function(e){j(e.selected+1)};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(L.Z,{isOpen:m,onClose:function(){d(null),x(!1)},onConfirm:y,title:"Delete Workspace",message:"Are you sure you want to delete this workspace connection?"}),(0,o.jsxs)("div",{className:"py-6 sm:mx-auto sm:w-full sm:max-w-md",children:[(0,o.jsx)("h2",{className:"text-center text-2xl font-bold tracking-tight text-gray-900",children:"Your Workspace"}),(0,o.jsx)("p",{className:"mt-1 text-center text-sm tracking-tight text-gray-500",children:"Connect your Notion Workspace Here"}),(0,o.jsx)("div",{className:"text-center mt-5",children:(0,o.jsx)("button",{onClick:function(){return window.open("https://api.notion.com/v1/oauth/authorize?client_id=".concat("c0f3cf94-065b-4343-b38b-49b148c1c14a","&response_type=code&owner=user&redirect_uri=").concat("https://notionaddon.io/api/notion/authorization"),"_blank","toolbar=no,popup=true,scrollbars=yes,resizable=yes,width=600,height=600")},className:"inline-flex items-center bg-notion-addon-blue hover:bg-notion-addon-blue-hover text-white text-sm font-medium py-2 px-4 rounded-xl shadow-md ",children:"Connect your workspace"})}),(0,o.jsx)("div",{className:"",children:(0,o.jsxs)("div",{className:"min-h-[60%]",children:[(0,o.jsx)("table",{className:"table-fixed simple-table",children:(0,o.jsx)("tbody",{className:"divide-y divide-gray-200 bg-white",children:null===C||void 0===C?void 0:C.map((function(e,t){return(0,o.jsxs)("tr",{className:"w-full !flex items-center justify-between space-x-6 h-16 mb-3 !rounded-xl",children:[(0,o.jsx)(H.pn,{children:(0,o.jsx)("td",{className:"w-full max-w-0 px-8 py-0 font-medium text-sm text-gray-900 sm:w-auto sm:max-w-none",children:(0,o.jsxs)(H.u,{delayDuration:0,children:[(0,o.jsx)(H.aJ,{className:"",children:(0,o.jsx)("span",{className:"flex gap-3 items-center text-sm font-medium text-gray-900 text-left",children:(0,o.jsxs)(o.Fragment,{children:[(null===e||void 0===e?void 0:e.icon_url)?(0,o.jsx)("img",{className:"w-5",src:null===e||void 0===e?void 0:e.icon_url,alt:"icon"}):(0,o.jsx)("img",{className:"",src:"/charts_icons/database-default.svg",alt:"icon",width:20,height:20}),null===e||void 0===e?void 0:e.name]})})}),(0,o.jsxs)(H._v,{className:"TooltipContent",side:"bottom",children:[(0,o.jsx)("p",{className:"flex items-center",children:"Workspace Name"}),(0,o.jsx)(Q.Ce,{className:"TooltipArrow"})]})]})})}),(0,o.jsx)(H.pn,{children:(0,o.jsx)("td",{className:"w-full max-w-0 px-8 py-0 font-medium text-sm text-gray-900 sm:w-auto sm:max-w-none",children:(0,o.jsx)("div",{className:"justify-end gap-8 items-end flex",children:(0,o.jsxs)(H.u,{delayDuration:0,children:[(0,o.jsx)(H.aJ,{onClick:function(){return t=e.id,d(t),void x(!0);var t},children:(0,o.jsx)(S.Z,{chartType:"bin"})}),(0,o.jsxs)(H._v,{className:"TooltipContent",side:"bottom",children:[(0,o.jsx)("span",{className:"",children:"Delete"}),(0,o.jsx)(Q.Ce,{className:"TooltipArrow"})]})]})})})})]},t+1)}))})}),N>1&&!n&&(0,o.jsx)("div",{className:"pagination-sec flex mt-3",children:(0,o.jsxs)("div",{className:"flex ml-auto items-center gap-4",children:[(0,o.jsxs)("span",{className:"text-sm font-medium text-gray-400",children:["Page ",g," of ",N]}),(0,o.jsx)(B(),{breakLabel:"...",nextLabel:(0,o.jsx)(S.Z,{chartType:"PageangleRight"}),pageRangeDisplayed:0,pageCount:N,previousLabel:(0,o.jsx)(S.Z,{chartType:"PageangleLeft"}),renderOnZeroPageCount:null,containerClassName:"flex items-center justify-end gap-2 text-sm pagination",pageClassName:"hidden",handlePageClick:k,onPageChange:k,nextClassName:"text-white bg-white p-2 px-3 rounded-3xl text-sm select-none font-medium ".concat(g===N?"disabled":""),previousClassName:"text-white  bg-white p-2 px-3 rounded-3xl text-sm select-none font-medium ".concat(1===g?"disabled":""),onClick:function(e){k(e)},breakClassName:"hidden",disabledClassName:"text-gray-400 disabled_cursor rounded select-none",activeClassName:"active-page"})]})})]})})]})]})},Profile:function(){return(0,o.jsx)(o.Fragment,{children:(0,o.jsx)("div",{className:"flex min-h-full flex-col justify-center sm:px-6 lg:px-8",children:(0,o.jsxs)("div",{className:" sm:mx-auto sm:w-full sm:max-w-md",children:[(0,o.jsx)("h2",{className:"text-center text-2xl font-bold tracking-tight text-gray-900",children:"Update your profile"}),(0,o.jsx)("div",{className:"mt-8 sm:mx-auto sm:w-full sm:max-w-md",children:(0,o.jsx)("div",{className:"bg-white py-8 px-4 shadow sm:rounded-lg sm:px-10",children:(0,o.jsxs)("form",{className:"space-y-6",action:"#",method:"POST",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{htmlFor:"email",className:"block text-sm font-medium text-gray-700",children:"Your Email address"}),(0,o.jsx)("div",{className:"mt-1",children:(0,o.jsx)("input",{id:"email",name:"email",type:"email",autoComplete:"email",required:!0,className:"block w-full appearance-none rounded-lg border border-gray-300 px-3 py-2 placeholder-gray-400 focus:border-notion-addon-blue focus:outline-none focus:ring-notion-addon-blue sm:text-sm"})})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{htmlFor:"password",className:"block text-sm font-medium text-gray-700",children:"Password"}),(0,o.jsx)("div",{className:"mt-1",children:(0,o.jsx)("input",{id:"password",name:"password",type:"password",autoComplete:"current-password",required:!0,className:"block w-full appearance-none rounded-lg border border-gray-300 px-3 py-2 placeholder-gray-400 focus:border-notion-addon-blue focus:outline-none focus:ring-notion-addon-blue sm:text-sm"})})]}),(0,o.jsx)("div",{children:(0,o.jsx)("button",{type:"submit",className:"flex w-full justify-center rounded-lg border border-transparent bg-notion-addon-blue hover:bg-notion-addon-blue-hover py-2 px-4 text-sm font-medium text-white shadow-sm hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-notion-addon-blue focus:ring-offset-2",children:"Update profile"})})]})})})]})})})},Members:ie,Password:function(){var e=(0,se.cI)(),t=e.register,s=e.handleSubmit,n=(e.watch,e.errors,function(){var e=(0,a.Z)((function(e){var t,s;return(0,i.__generator)(this,(function(n){switch(n.label){case 0:return(null===e||void 0===e?void 0:e.password)&&(null===e||void 0===e?void 0:e.passwordConfirmation)&&(null===e||void 0===e?void 0:e.password.trim())&&(null===e||void 0===e?void 0:e.passwordConfirmation.trim())&&(null===e||void 0===e?void 0:e.password)!==(null===e||void 0===e?void 0:e.passwordConfirmation)?(v.Am.error("New Password and confirm password do not match.",{autoClose:2e3,hideProgressBar:!0}),[3,5]):[3,1];case 1:t=g().decamelizeKeys(e),n.label=2;case 2:return n.trys.push([2,4,,5]),[4,f.default.put(Z.pd,t)];case 3:return 200===n.sent().status&&v.Am.success("Password changed successfully",{autoClose:2e3,hideProgressBar:!0}),[3,5];case 4:return s=n.sent(),v.Am.error(s.response.data.errors.full_messages[0],{autoClose:2e3,hideProgressBar:!0}),[3,5];case 5:return[2]}}))}));return function(t){return e.apply(this,arguments)}}());return(0,o.jsx)(o.Fragment,{children:(0,o.jsx)("div",{className:"flex min-h-full flex-col justify-center sm:px-6 lg:px-8",children:(0,o.jsxs)("div",{className:"py-6 sm:mx-auto sm:w-full sm:max-w-md",children:[(0,o.jsx)("h2",{className:"text-center text-2xl font-bold tracking-tight text-gray-900",children:"Change your password"}),(0,o.jsx)("div",{className:"mt-8 sm:mx-auto sm:w-full sm:max-w-md",children:(0,o.jsx)("div",{className:"bg-white py-8 px-4 custom-shadow rounded-2xl sm:px-10",children:(0,o.jsxs)("form",{className:"space-y-6",onSubmit:s(n),children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{htmlFor:"oldPassword",className:"block text-sm font-medium text-gray-700",children:"Current password"}),(0,o.jsx)("div",{className:"mt-1",children:(0,o.jsx)("input",(0,te.Z)((0,ee.Z)({id:"currentPassword",name:"currentPassword",type:"password"},t("currentPassword",{required:!0})),{className:"block w-full appearance-none rounded-lg border border-gray-300 px-3 py-2 placeholder-gray-400 focus:border-notion-addon-blue focus:outline-none focus:ring-notion-addon-blue sm:text-sm"}))})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{htmlFor:"password",className:"block text-sm font-medium text-gray-700",children:"New password"}),(0,o.jsx)("div",{className:"mt-1",children:(0,o.jsx)("input",(0,te.Z)((0,ee.Z)({id:"password",name:"password",type:"password"},t("password",{required:!0})),{className:"block w-full appearance-none rounded-lg border border-gray-300 px-3 py-2 placeholder-gray-400 focus:border-notion-addon-blue focus:outline-none focus:ring-notion-addon-blue sm:text-sm"}))})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{htmlFor:"passwordConfirmation",className:"block text-sm font-medium text-gray-700",children:"Password Confirmation"}),(0,o.jsx)("div",{className:"mt-1",children:(0,o.jsx)("input",(0,te.Z)((0,ee.Z)({id:"passwordConfirmation",name:"passwordConfirmation",type:"password"},t("passwordConfirmation",{required:!0})),{className:"block w-full appearance-none rounded-lg border border-gray-300 px-3 py-2 placeholder-gray-400 focus:border-notion-addon-blue focus:outline-none focus:ring-notion-addon-blue sm:text-sm"}))})]}),(0,o.jsx)("div",{children:(0,o.jsx)("button",{type:"submit",className:"flex w-full justify-center rounded-xl border border-transparent bg-notion-addon-blue hover:bg-notion-addon-blue-hover py-2 px-4 text-sm font-medium text-white shadow-sm hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-notion-addon-blue focus:ring-offset-2 h-10",children:"Change password"})})]})})})]})})})},Billing:J,Team:re,Templates:le};function xe(){for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];return t.filter(Boolean).join(" ")}var he=!0;function fe(e){var t=e.user,s=(e.token,(0,h.useState)("Workspaces")),n=s[0],l=s[1],c=(0,h.useState)(ce),d=c[0],u=c[1],m=(0,h.useState)(!1),p=m[0],v=m[1],j=(0,b.useRouter)(),y=T.Z.getUser(),N=function(){var e=(0,a.Z)((function(){var e;return(0,i.__generator)(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,f.default.get(Z.R0,{params:{user_id:y.id}})];case 1:return e=t.sent(),[2,g().camelizeKeys(null===e||void 0===e?void 0:e.data)];case 2:return t.sent(),toast.error("An error occurred during plan fetch. Please try again later.",{autoClose:2e3,hideProgressBar:!0}),[3,3];case 3:return[2]}}))}));return function(){return e.apply(this,arguments)}}(),w=function(){var e=(0,a.Z)((function(){var e,t;return(0,i.__generator)(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,f.default.get(Z.ej)];case 1:return t=s.sent(),[2,g().camelizeKeys(null===t||void 0===t||null===(e=t.data)||void 0===e?void 0:e.plans)];case 2:return s.sent(),toast.error("An error occurred during plan fetch. Please try again later.",{autoClose:2e3,hideProgressBar:!0}),[3,3];case 3:return[2]}}))}));return function(){return e.apply(this,arguments)}}(),C=function(){var e=window.location.hash.slice(1),t=localStorage.getItem("activeTab"),s=e||t||"Workspaces";l(s),localStorage.setItem("activeTab",s),v(!1)},k=function(){var e=(0,a.Z)((function(){var e,t,s,n,a,o,c,d;return(0,i.__generator)(this,(function(i){switch(i.label){case 0:v(!0),i.label=1;case 1:return i.trys.push([1,7,,8]),[4,w()];case 2:return e=i.sent(),t=e.filter((function(e){return"team"===e.name.toLowerCase()})).map((function(e){return e.id})),ue.includes(null===y||void 0===y?void 0:y.email)||"member"===y.organization_role?((s="member"===y.organization_role?ce.slice(0,2):(0,r.Z)(ce)).push(de),u(s),C(),v(!1),[2]):[4,f.default.get("".concat(Z._X,"/").concat(null===y||void 0===y?void 0:y.id))];case 3:return n=i.sent().data,a=g().camelizeKeys(n),(o=(null===a||void 0===a?void 0:a.filter((function(e){return"active"===e.status})))||[]).length>0?(c=t.includes(o[0].planId)?ce:ce.slice(0,4),[4,N()]):[3,5];case 4:return(null===(d=i.sent())||void 0===d?void 0:d.osUser)&&(c=(0,r.Z)(c).concat([de])),u(c),C(),[3,6];case 5:u([ce[3]]),l("Billing"),localStorage.setItem("activeTab","Billing"),i.label=6;case 6:return v(!1),[3,8];case 7:return i.sent(),v(!1),u([ce[3]]),l("Billing"),localStorage.setItem("activeTab","Billing"),[3,8];case 8:return v(!1),[2]}}))}));return function(){return e.apply(this,arguments)}}();if((0,h.useEffect)((function(){k()}),[j.asPath]),p)return(0,o.jsx)(oe.Z,{color:"#2563eb"});var P=me[n];return(0,o.jsxs)(K.Z,{children:[(0,o.jsx)("div",{className:"bg-white w-full align-center flex p-8",children:(0,o.jsx)("div",{className:"flex items-center",children:(0,o.jsxs)("h3",{className:"text-black text-xl font-semibold flex gap-3 items-center",children:[(0,o.jsx)("div",{className:"chat-icon w-12 h-12 bg-blue-100 rounded-lg flex justify-center items-center",children:(0,o.jsx)(x.Z,{color:"#2563eb"})}),"Profile"]})})}),(0,o.jsx)("main",{className:"flex flex-1",children:(0,o.jsx)("div",{className:"mx-auto w-10/12 mt-1",children:(0,o.jsx)("div",{className:"px-4 sm:px-6 md:px-0",children:(0,o.jsxs)("div",{className:"py-6 pt-0",children:[(0,o.jsxs)("div",{className:"lg:hidden",children:[(0,o.jsx)("label",{htmlFor:"selected-tab",className:"sr-only",children:"Select a tab"}),(0,o.jsx)("select",{id:"selected-tab",name:"selected-tab",className:"mt-1 block w-full rounded-lg border-gray-300 py-2 pl-3 pr-10 text-base focus:border-notion-addon-blue focus:outline-none focus:ring-notion-addon-blue sm:text-sm",value:n,onChange:function(e){return l(e.target.value)},children:d.map((function(e){return(0,o.jsx)("option",{value:e.value,children:e.name},e.name)}))})]}),(0,o.jsx)("div",{className:"hidden lg:block",children:(0,o.jsx)("div",{className:"border-b border-gray-200",children:(0,o.jsx)("nav",{className:"-mb-px flex gap-5",children:d.map((function(e){return(0,o.jsx)("a",{href:e.href,onClick:function(){return t=e.value,l(t),void localStorage.setItem("activeTab",t);var t},className:xe(e.value===n?"border-notion-addon-blue text-notion-addon-blue":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700","whitespace-nowrap py-4 pb-2 px-1 border-b-2 font-medium text-md"),children:(0,o.jsxs)("div",{className:"flex gap-3 justify-center items-center",children:[e.icon,e.name]})},e.name)}))})})}),(0,o.jsx)("div",{className:"lg:col-span-9 text-3xl",children:(0,o.jsx)(P,{user:t,setActiveTab:l})})]})})})})]})}}},function(e){e.O(0,[1664,2535,624,3780,5605,2854,9091,8066,8100,7536,7356,2725,7635,3011,230,9774,2888,179],(function(){return t=89411,e(e.s=t);var t}));var t=e.O();_N_E=t}]);