sidekick-client 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,2 +1,2 @@
1
- import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import{Toaster as r,toast as n}from"sonner";import{useLocation as i,Navigate as s,createBrowserRouter as l,RouterProvider as o,NavLink as d,useBlocker as c,Outlet as m,useNavigate as u,useParams as p,useSearchParams as h}from"react-router";import*as g from"react";import f,{useState as b,useEffect as x,createContext as v,useContext as y,useCallback as N,lazy as w,Suspense as _,useMemo as C,useRef as k,useTransition as P,useImperativeHandle as z,Fragment as S,useId as I,forwardRef as T}from"react";import{clsx as O}from"clsx";import{twMerge as A}from"tailwind-merge";import{SquarePen as F,Bookmark as $,BookOpen as D,Settings2 as E,NotebookText as L,Loader2Icon as M,XIcon as R,ChevronDownIcon as j,CheckIcon as U,ChevronUpIcon as B,CircleIcon as V,ChevronRightIcon as H,Menu as Y,ChevronDown as q,RefreshCcw as K,ChevronLeftIcon as G,MoreHorizontalIcon as W,Check as X,X as J,ArrowUpDown as Z,MoreHorizontal as Q,InfoIcon as ee,Crown as te,Bold as ae,Italic as re,Underline as ne,Link as ie,List as se,Quote as le,Sparkles as oe,Heading1 as de,Heading2 as ce,ListOrdered as me,Copy as ue,PanelLeftIcon as pe,ChevronRight as he,ChevronsUpDown as ge,CircleUserRound as fe,Sparkle as be,BadgeCheck as xe,CreditCard as ve,LogOut as ye,Users2 as Ne,UserRoundPlus as we,Pen as _e,Plus as Ce,FolderKanban as ke,Pencil as Pe,Trash as ze,Files as Se,ArrowLeft as Ie,Package as Te,Building2 as Oe,Award as Ae,Circle as Fe,Calendar as $e,MoveUpRight as De,LogIn as Ee,CheckCircle2 as Le,GalleryVerticalEnd as Me,History as Re,ArrowRight as je,AlertCircleIcon as Ue,ReceiptText as Be,CalendarDays as Ve,Download as He,SquareArrowOutUpRight as Ye}from"lucide-react";import*as qe from"@radix-ui/react-label";import{Label as Ke}from"@radix-ui/react-label";import*as Ge from"@radix-ui/react-select";import*as We from"@radix-ui/react-dialog";import*as Xe from"@radix-ui/react-switch";import*as Je from"@radix-ui/react-tooltip";import*as Ze from"@radix-ui/react-separator";import{useEditor as Qe,mergeAttributes as et,BubbleMenu as tt,FloatingMenu as at,EditorContent as rt}from"@tiptap/react";import nt from"@tiptap/starter-kit";import it from"@tiptap/extension-underline";import st from"@tiptap/extension-link";import lt from"@tiptap/extension-placeholder";import ot from"@tiptap/extension-bubble-menu";import dt from"@tiptap/extension-floating-menu";import*as ct from"@radix-ui/react-dropdown-menu";import*as mt from"@radix-ui/react-tabs";import{TabsContent as ut}from"@radix-ui/react-tabs";import{Turnstile as pt}from"@marsidev/react-turnstile";import*as ht from"@radix-ui/react-collapsible";import{Slot as gt}from"@radix-ui/react-slot";import{cva as ft}from"class-variance-authority";import*as bt from"@radix-ui/react-avatar";import*as xt from"@radix-ui/react-accordion";import{OTPInput as vt,OTPInputContext as yt}from"input-otp";import{motion as Nt,AnimatePresence as wt}from"motion/react";import*as _t from"@radix-ui/react-radio-group";import*as Ct from"@radix-ui/react-toggle";import{useRazorpay as kt}from"react-razorpay";import{useReactTable as Pt,getPaginationRowModel as zt,getFilteredRowModel as St,getSortedRowModel as It,getCoreRowModel as Tt,flexRender as Ot}from"@tanstack/react-table";import At from"axios";const Ft={navMain:[{title:"Your Work",items:[{title:"Sample",icon:F,url:"sample-documents"},{title:"Sample Saved",icon:$,url:"sample-saved-documents"}]},{title:"Settings",items:[{title:"Documentation",icon:D,items:[{title:"Sample Get Started",url:"sample-doc-get-started"},{title:"Sample Tutorials",url:"sample-tutorials"}]},{title:"Settings",icon:E,items:[{title:"Sample General",url:"sample-general-settings"},{title:"Sample Active Plan",url:"sample-active-plan-setting"}]}]}],virtualChildOf:[]},$t=(e,t,a)=>{e.forEach(e=>{const{items:r,...n}=e;n.parent=a,t.push(n),r&&$t(r,t,n)})},Dt=(e,t)=>{Ft.navMain=e,Ft.virtualChildOf=t||[]},Et={TEAM:"team",ORG:"org"},Lt={appId:"gamma_tech",appName:"Gamma Tech",appDescription:"Gamma Tech is a software company that provides a range of services to help businesses grow and succeed.",logo:L,version:"2.0.1",account_type_txt:{singular:"Team",plural:"Teams",value:Et.TEAM},supportEmail:"support@gammatech.com",cloudFareKey:"",razorPayKey:"",themeColor:"#00c950",serverUrl:"http://192.168.31.71:6001"},Mt=e=>{Object.assign(Lt,e)},Rt=e=>{Object.assign(Et,e)};function jt(...e){return A(O(e))}const Ut=e=>{const t=new FormData(e);return Object.fromEntries(t.entries())},Bt=e=>`${Lt.appId}_${e}`,Vt=(e,t)=>{localStorage.setItem(Bt(e),t)},Ht=e=>localStorage.getItem(Bt(e)),Yt=(e,t)=>{if(!e)return!1;if(t===e)return!0;return!!Ft.virtualChildOf.find(a=>a.id===e&&a.parentId===t)},qt=e=>{const t=(()=>{const e=[],t=Ft.navMain;return $t(t,e,void 0),e})(),a=t.find(t=>t.url===e);if(a)return a;const r=Ft.virtualChildOf.find(t=>t.id===e);return r?t.find(e=>e.url===r.parentId):void 0},Kt=e=>Array.from({length:e},(e,t)=>t),Gt={open:!1,type:"CONFIRM",text:""},Wt=e=>{const t=/[A-Z]/.test(e),a=/[a-z]/.test(e),r=/[0-9]/.test(e),n=/[!@#$%^&*(),.?":{}|<>]/.test(e);return e.length<8?{valid:!1,message:"Password must be at least 8 characters long."}:t?a?r?n?{valid:!0,message:"Password is valid."}:{valid:!1,message:"Password must contain at least one special character."}:{valid:!1,message:"Password must contain at least one number."}:{valid:!1,message:"Password must contain at least one lowercase letter."}:{valid:!1,message:"Password must contain at least one uppercase letter."}},Xt=e=>{console.error(e)},Jt=e=>{if(!e)return!1;const t=String(e).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);return Array.isArray(t)&&t.length>0},Zt=e=>{if(!e||"string"!=typeof e)return{validEmails:[],invalidEmails:[],totalProcessed:0};const t=e.replace(/\n/g,"").split(",").map(e=>e.trim()).filter(e=>e.length>0),a=[],r=[];return t.forEach(e=>{Jt(e)?a.push(e):r.push(e)}),{validEmails:a,invalidEmails:r,totalProcessed:t.length}},Qt=(e=3e3)=>new Promise(t=>setTimeout(t,e)),ea=e=>new Date(e),ta=(e,t=!0)=>{if(!e)return"";const a=e instanceof Date?e:ea(e),r=String(a.getDate()).padStart(2,"0"),n=String(a.getMonth()+1).padStart(2,"0"),i=a.getFullYear();let s=a.getHours();const l=String(a.getMinutes()).padStart(2,"0");let o="";t&&(o=s>=12?"PM":"AM",s=s%12||12);const d=String(s).padStart(2,"0");return t?`${r}/${n}/${i}, ${d}:${l} ${o}`:`${r}/${n}/${i}, ${d}:${l}`},aa=e=>{const t=(new Date).getTime()-e.getTime(),a=t/36e5,r=t/864e5;return t<3e5?"Just now":a<1?`${Math.floor(t/6e4)} minutes ago`:a<24?`${Math.floor(a)} hours ago`:r<7?`${Math.floor(r)} days ago`:e.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})},ra=729444,na=e=>e*ra,ia=e=>Math.floor(e/ra),sa=(e,t)=>{const a=[];for(let r=0;r<e.length;r+=2){const n=e[r],i=e[r+1];a.push(t(n,i,r))}return a},la=()=>Math.floor(1e3+9e3*Math.random()).toString(),oa=e=>"function"==typeof e,da=e=>1===e||"1"===e||!0===e,ca=Object.freeze({NOT_SAVED:10,INVITED:0,ACCEPTED:1,REJECTED:2,LEFT:3,text:{10:"Not Saved",0:"Invited",1:"Active (Accepted)",2:"Rejected",3:"Left"},getDisplay(e){return this.text[e]}}),ma=e=>e&&0===Object.keys(e).length,ua=e=>parseInt(e,10)>0,pa=e=>e.split("/")[2];function ha(e,t){let a;return function(...r){clearTimeout(a),a=setTimeout(()=>{e.apply(this,r)},t)}}const ga="active-theme",fa=(e=(()=>Ht(ga)||"system")())=>{const[t,a]=b(e);return x(()=>{const e=window.document.documentElement;e.classList.remove("light","dark");let a=t;"system"===t&&(a=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),e.classList.add(a),Vt(ga,a)},[t]),{theme:t,setTheme:a}},ba=({...t})=>{const{theme:a="system"}=fa();return e(r,{theme:a,position:"top-center",style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)","--border-radius":"var(--radius)"},...t})},xa=v({setAlertDlgOptions:()=>{},alertDlgOptions:Gt,orgs:[],setOrgs:()=>{},loggedInUser:null,setLoggedInUser:()=>{},activeOrg:void 0,setActiveOrg:()=>{},purchasePlans:[],setPurchasePlans:()=>{},activePlan:null,setActivePlan:()=>{},subscriptionConfig:{},setSubscriptionConfig:()=>{},featureFlags:{},setFeatureFlags:()=>{}}),va=()=>e(M,{className:"animate-spin"}),ya=()=>t("div",{className:"bg-muted flex min-h-svh flex-col items-center justify-center gap-6",children:[t("h3",{className:"scroll-m-20 text-xl font-semibold tracking-tight text-primary inline-flex gap-2",children:[e("div",{className:"bg-sidebar-primary text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg",children:e(Lt.logo,{className:"size-4"})}),e("div",{className:"grid flex-1 text-left leading-tight items-center text-foreground",children:Lt.appName})]}),t("div",{className:"inline-flex gap-1 ml-5",children:[e(va,{}),"Loading application..."]})]}),Na=({header:e="Success",description:t})=>{n.success(e,{description:t})},wa=({header:e="Error",description:t})=>{n.error(e,{description:t})},_a=({header:e="Warning",description:t})=>{n.warning(e,{description:t})};let Ca=null;const ka=()=>Ca||(Ca=At.create({baseURL:Lt.serverUrl,headers:{api:Ht("apiKey")||"","Content-Type":"application/json"}}),Ca.interceptors.request.use(e=>(e.headers=e.headers||{},e.headers.api=Ht("apiKey")||"",e)),Ca.interceptors.response.use(e=>e.data?.response,e=>{if(!e.response)throw wa({header:e.message||"Network error",description:"Unable to connect with server."}),e;const t=e.response.data;throw wa({header:za(t?.error?.errorMsg)||"Server error",description:za(t.error.solution)||""}),t.error}),Ca),Pa={auth_users_tbl:{user_id:"User Id",user_email:"User Email",user_mobile_no:"User Mobile Number",user_fname:"User's First Name",user_lname:"User's Last Name",user_is_active:"User Is Active"},auth_organization_tbl:{org_id:Lt.account_type_txt.singular+" Id",org_name:Lt.account_type_txt.singular+" Name",org_address:Lt.account_type_txt.singular+" Address",org_state:Lt.account_type_txt.singular+" State",org_country:Lt.account_type_txt.singular+" Country",org_external_id:Lt.account_type_txt.singular+" External ID",org_gst_in:Lt.account_type_txt.singular+" External ID",org_is_deleted:Lt.account_type_txt.singular+" Deleted",org_created_by:Lt.account_type_txt.singular+" Created By"},auth_organization_users_tbl:{org_user_id:Lt.account_type_txt.singular+"User ID",org_id:Lt.account_type_txt.singular+"ID",user_id:"User Id",org_user_role_id:Lt.account_type_txt.singular+"User Role Id",org_user_is_active:Lt.account_type_txt.singular+"User is active",user_opinion:"User Opinion"},auth_invited_users_tbl:{invited_users_id:"Invited Users Id",org_id:Lt.account_type_txt.singular+"Id",email:"Email",invited_user_role_id:"Invited user role Id",invited_by_user_id:"Invited by user Id",is_deleted:"Deleted"}},za=e=>{let t=e;const a=e.matchAll(/(\w+)\.(\w+)/g);for(const e of a){const a=e[0],r=e[1],n=e[2];if(Pa[r]?.[n]){const e=Pa[r][n];t=t.replace(a,e)}}return t=t.replaceAll("key","field"),t},Sa=e=>"INR"===e?"₹":"USD"===e?"$":"EUR"===e?"€":"GBP"===e?"£":"AUD"===e||"CAD"===e?"$":"CHF"===e?"₣":"CNY"===e?"¥":"DKK"===e?"kr":"HKD"===e||"NZD"===e?"$":"SEK"===e?"kr":"SGD"===e?"$":"ZAR"===e?"R":"",Ia=e=>!e||"starter"===e.plan_id,Ta=(e,t,a,r,n)=>new Promise((i,s)=>{const l={key:Lt.razorPayKey,amount:100*e,currency:t,order_id:a.orderId,name:Lt.appName,description:Lt.appDescription,handler:async function(e){try{if(!(await ka().post("payment-gateway/verify-payment",{orderId:a.orderId,razorpayPaymentId:e.razorpay_payment_id,razorpaySignature:e.razorpay_signature})).success)return s("Payment verification failed.");i(!0)}catch(e){wa({header:"Payment failed!",description:e?.message||"Payment verification failed."}),s(e)}},prefill:r,theme:{color:Lt.themeColor},modal:{ondismiss:function(){s(new Error("Payment cancelled!"))}}},o=new n(l);o.on("payment.failed",function(e){wa({header:"Payment Failed!",description:e.error.description||"Payment could not be processed."}),ka().post("payment-gateway/log-failure",{orderId:a.orderId,errorCode:e.error.code,errorDescription:e.error.description,errorReason:e.error.reason,paymentId:e.metadata?.payment_id}).catch(()=>{})}),o.open()}),Oa=e=>("paid"!==e.status||(e.startAt=new Date(e.startAt),e.endAt=new Date(e.endAt),e.old_purchased_amount=Number(e.amount),e.updatedRecords&&e.updatedRecords.forEach(t=>{e.amount=Number(e.amount)+Number(t.amount)})),e),Aa=()=>{const{setPurchasePlans:e,setActivePlan:t,featureFlags:a,activePlan:r,activeOrg:n}=y(xa);return{loadPurchasedPlans:N(async(r=!1)=>{if(!r&&!a.ff_enable_paid_subscription)return;const n=await ka().get("/purchased-plans");n.purchasedPlans.forEach(Oa),e([...n.purchasedPlans||[]].reverse()),t(Oa(n.activePlan))},[e,t,a.ff_enable_paid_subscription]),isActiveOrgFreePlan:N(()=>Ia(n?.active_purchased_plan),[n]),isUserFreePlan:N(()=>Ia(r),[r])}},Fa=({children:t})=>{const[a,r]=b(!0),n=i(),{orgs:l,setOrgs:o,loggedInUser:d,setLoggedInUser:c,setActiveOrg:m,subscriptionConfig:u,setSubscriptionConfig:p,featureFlags:h,setFeatureFlags:g}=y(xa),{loadPurchasedPlans:f}=Aa();return x(()=>{(async()=>{try{await new Promise(e=>setTimeout(e,200));const e=await ka().get("/feature-flags");g(e.featureFlags);const t=await ka().get("/check-session"),a=!!t.sessionInfo?.id;if(c({email:t.user.user_email,id:t.sessionInfo?.id,fname:t.user.user_fname,lname:t.user.user_lname,mobNo:String(t.user.user_mobile_no)}),!0===a&&(e.featureFlags.ff_enable_paid_subscription&&await f(!0),e.featureFlags.ff_enable_teams)){const e=await ka().get("organization"),t=e?.orgs||[];o(t);const a=Ht("activeOrgId");let r=t[0];a&&(r=t.find(e=>String(e.org_id)===a)||r),m(r)}if(e.featureFlags.ff_enable_paid_subscription&&"plans"in u==!1){const e=await ka().get("/get-subscription-config");p(e)}}finally{r(!1)}})()},[]),a?e(ya,{}):d?.id?h.ff_enable_teams&&0===l.length&&!n.pathname.includes("infrastructure")?e(s,{to:h.ff_enable_paid_subscription?"/infrastructure/manage-subscription":"/infrastructure",state:{from:n},replace:!0}):t:e(s,{to:"/login",state:{from:n},replace:!0})},$a=w(()=>Promise.resolve().then(function(){return hi})),Da=w(()=>Promise.resolve().then(function(){return gi})),Ea=w(()=>Promise.resolve().then(function(){return wi})),La=w(()=>Promise.resolve().then(function(){return ms})),Ma=w(()=>Promise.resolve().then(function(){return us})),Ra=w(()=>Promise.resolve().then(function(){return hs})),ja=w(()=>Promise.resolve().then(function(){return gs})),Ua=w(()=>Promise.resolve().then(function(){return vs})),Ba=w(()=>Promise.resolve().then(function(){return ys})),Va=w(()=>Promise.resolve().then(function(){return _s})),Ha=w(()=>Promise.resolve().then(function(){return Cs})),Ya=w(()=>Promise.resolve().then(function(){return Ls}).then(e=>({default:e.PricingTbl}))),qa=w(()=>Promise.resolve().then(function(){return Ks})),Ka=w(()=>Promise.resolve().then(function(){return Zs})),Ga=w(()=>Promise.resolve().then(function(){return el})),Wa=w(()=>Promise.resolve().then(function(){return al}));function Xa({appRoutes:t,publicRoutes:a=[]}){const{featureFlags:r}=y(xa),n=l([{path:"/",element:e(Fa,{children:e(La,{})}),children:[...t,{path:"app/general-settings",Component:Wa},{path:"app/*",element:e(Ma,{canShowHeader:!1})}]},...!1===r.ff_enable_paid_subscription?[]:[{path:"plans",Component:Ya}],...a,{path:"infrastructure",element:e(Fa,{children:e(Va,{})}),children:[...!1===r.ff_enable_teams?[]:[{index:!0,Component:ja},{path:"create-new-org",Component:Ua},{path:"edit-org/:orgId",Component:Ua},{path:"user-invitations",Component:Ba},{path:"manage-infra",Component:Ha}],...!1===r.ff_enable_paid_subscription?[]:[{path:"manage-subscription",Component:qa},{path:"checkout",Component:Ka},{path:"payment-history",Component:Ga}]]},{Component:$a,children:[{path:"login",Component:Da},{path:"forgot-password",Component:Ra},{path:"register",Component:Ea}]},{path:"*",Component:Ma}]);return e(_,{fallback:e(ya,{}),children:e(o,{router:n})})}function Ja({...t}){return e(We.Root,{"data-slot":"dialog",...t})}function Za({...t}){return e(We.Trigger,{"data-slot":"dialog-trigger",...t})}function Qa({...t}){return e(We.Portal,{"data-slot":"dialog-portal",...t})}function er({...t}){return e(We.Close,{"data-slot":"dialog-close",...t})}function tr({className:t,...a}){return e(We.Overlay,{"data-slot":"dialog-overlay",className:jt("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...a})}function ar({className:a,children:r,showCloseButton:n=!0,...i}){return t(Qa,{"data-slot":"dialog-portal",children:[e(tr,{}),t(We.Content,{"data-slot":"dialog-content",className:jt("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",a),...i,children:[r,n&&t(We.Close,{"data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[e(R,{}),e("span",{className:"sr-only",children:"Close"})]})]})]})}function rr({className:t,...a}){return e("div",{"data-slot":"dialog-header",className:jt("flex flex-col gap-2 text-center sm:text-left",t),...a})}function nr({className:t,...a}){return e("div",{"data-slot":"dialog-footer",className:jt("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...a})}function ir({className:t,...a}){return e(We.Title,{"data-slot":"dialog-title",className:jt("text-lg leading-none font-semibold",t),...a})}function sr({className:t,...a}){return e(We.Description,{"data-slot":"dialog-description",className:jt("text-muted-foreground text-sm",t),...a})}const lr=ft("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline",linkNoUnderline:"text-primary underline-offset-4"},size:{default:"h-8 px-4 py-2 has-[>svg]:px-3",sm:"h-7 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-9 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function or({className:t,variant:a,size:r,asChild:n=!1,...i}){return e(n?gt:"button",{"data-slot":"button",className:jt(lr({variant:a,size:r,className:t}),"cursor-pointer"),...i})}function dr({loading:a=!1,children:r,...n}){return t(or,{...n,disabled:a||n.disabled,children:[a&&e(va,{}),r]})}const cr=({open:a,setIsOpen:r,header:n,children:i,actionsJSX:s,disableOutsideClick:l=!1,dlgContentClsName:o})=>e(Ja,{open:a,onOpenChange:e=>r(!0===e),children:t(ar,{"aria-describedby":"dialog-content",onPointerDownOutside:e=>{l&&e.preventDefault()},className:o,children:[e(rr,{children:e(ir,{children:n})}),i,e(nr,{children:s})]})}),mr=()=>{const e=y(xa),t=t=>{e.setAlertDlgOptions({...t,open:!0})};return{showAlertBox:t,closeAlertBox:()=>{e.setAlertDlgOptions({...e.alertDlgOptions,open:!1})},showAlertDlgPromise:async e=>new Promise((a,r)=>{t({...e,async onClose(e){"CONFIRM"===e?a(e):r(e)}})})}},ur=({options:r})=>{const n=mr(),i=()=>{n.closeAlertBox(),r.onClose&&r.onClose("CANCEL")};return e(cr,{open:r.open,setIsOpen:i,header:"ALERT"===r.type?"Alert":"Confirmation",actionsJSX:t(a,{children:[e(dr,{onClick:i,variant:"ghost",children:"Cancel"}),"CONFIRM"===r.type&&e(dr,{onClick:()=>{n.closeAlertBox(),r.onClose&&r.onClose("CONFIRM")},children:"Confirm"})]}),children:e(sr,{className:"mt-3",children:r.text})})};function pr({appRoutes:a,publicRoutes:r}){fa();const[n,i]=b(Gt),[s,l]=b([]),[o,d]=b(),[c,m]=b(),[u,p]=b([]),[h,g]=b(),[f,x]=b({}),[v,y]=b({}),w=N(e=>{e&&(Vt("activeOrgId",String(e.org_id)),m(e))},[m]);return t(xa.Provider,{value:{alertDlgOptions:n,setAlertDlgOptions:i,orgs:s,setOrgs:l,loggedInUser:o||{},setLoggedInUser:d,activeOrg:c,setActiveOrg:w,purchasePlans:u,setPurchasePlans:p,activePlan:h,setActivePlan:g,subscriptionConfig:f,setSubscriptionConfig:x,featureFlags:v,setFeatureFlags:y},children:[e(Xa,{appRoutes:a,publicRoutes:r}),e(ba,{}),e(ur,{options:n})]})}const hr={READ:0,ADMIN:1,WRITE:2,Is_ADMIN:function(e){return e===this.ADMIN},CAN_WRITE:function(e){return e===this.WRITE||e===this.ADMIN},CAN_READ:function(e){return e===this.READ||e===this.WRITE||e===this.ADMIN},DISPLAY_TEXT:function(e){return{[this.READ]:"Read",[this.WRITE]:"Read / Write",[this.ADMIN]:Lt.account_type_txt.singular+" Admin"}[e]||""},IS_VALID_ROLE_ID:function(e){return e===this.READ||e===this.ADMIN||e===this.WRITE},GET_LIST:function(){return[{id:this.READ.toString(),text:this.DISPLAY_TEXT(this.READ)},{id:this.WRITE.toString(),text:this.DISPLAY_TEXT(this.WRITE)},{id:this.ADMIN.toString(),text:this.DISPLAY_TEXT(this.ADMIN)}]}},gr=e=>{Object.assign(hr,e)};function fr({className:t,...a}){return e("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto flex-1",children:e("table",{"data-slot":"table",className:jt("w-full caption-bottom text-sm",t),...a})})}function br({className:t,...a}){return e("thead",{"data-slot":"table-header",className:jt("[&_tr]:border-b",t),...a})}function xr({className:t,...a}){return e("tbody",{"data-slot":"table-body",className:jt("[&_tr:last-child]:border-0",t),...a})}function vr({className:t,...a}){return e("tfoot",{"data-slot":"table-footer",className:jt("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",t),...a})}function yr({className:t,...a}){return e("tr",{"data-slot":"table-row",className:jt("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",t),...a})}function Nr({className:t,...a}){return e("th",{"data-slot":"table-head",className:jt("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...a})}function wr({className:t,...a}){return e("td",{"data-slot":"table-cell",className:jt("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...a})}function _r({className:t,...a}){return e("caption",{"data-slot":"table-caption",className:jt("text-muted-foreground mt-4 text-sm",t),...a})}function Cr({className:t,...a}){return e("div",{"data-slot":"card",className:jt("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",t),...a})}function kr({className:t,...a}){return e("div",{"data-slot":"card-header",className:jt("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",t),...a})}function Pr({className:t,...a}){return e("div",{"data-slot":"card-title",className:jt("leading-none font-semibold",t),...a})}function zr({className:t,...a}){return e("div",{"data-slot":"card-description",className:jt("text-muted-foreground text-sm",t),...a})}function Sr({className:t,...a}){return e("div",{"data-slot":"card-action",className:jt("col-start-2 row-span-2 row-start-1 self-start justify-self-end",t),...a})}function Ir({className:t,...a}){return e("div",{"data-slot":"card-content",className:jt("px-6",t),...a})}function Tr({className:t,...a}){return e("div",{"data-slot":"card-footer",className:jt("flex items-center px-6 [.border-t]:pt-6",t),...a})}function Or({className:t,type:a,...r}){return e("input",{type:a,"data-slot":"input",className:jt("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",t),...r})}function Ar({className:t,...a}){return e(qe.Root,{"data-slot":"label",className:jt("flex items-center gap-2 text-sm leading-none font-medium",t),...a})}function Fr({...t}){return e(Ge.Root,{"data-slot":"select",...t})}function $r({...t}){return e(Ge.Value,{"data-slot":"select-value",...t})}function Dr({className:a,size:r="default",children:n,...i}){return t(Ge.Trigger,{"data-slot":"select-trigger","data-size":r,className:jt("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",a),...i,children:[n,e(Ge.Icon,{asChild:!0,children:e(j,{className:"size-4 opacity-50"})})]})}function Er({className:a,children:r,position:n="popper",...i}){return e(Ge.Portal,{children:t(Ge.Content,{"data-slot":"select-content",className:jt("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md","popper"===n&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",a),position:n,...i,children:[e(jr,{}),e(Ge.Viewport,{className:jt("p-1","popper"===n&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:r}),e(Ur,{})]})})}function Lr({className:t,...a}){return e(Ge.Label,{"data-slot":"select-label",className:jt("text-muted-foreground px-2 py-1.5 text-xs",t),...a})}function Mr({className:a,children:r,...n}){return t(Ge.Item,{"data-slot":"select-item",className:jt("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",a),...n,children:[e("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:e(Ge.ItemIndicator,{children:e(U,{className:"size-4"})})}),e(Ge.ItemText,{children:r})]})}function Rr({className:t,...a}){return e(Ge.Separator,{"data-slot":"select-separator",className:jt("bg-border pointer-events-none -mx-1 my-1 h-px",t),...a})}function jr({className:t,...a}){return e(Ge.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:jt("flex cursor-default items-center justify-center py-1",t),...a,children:e(B,{className:"size-4"})})}function Ur({className:t,...a}){return e(Ge.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:jt("flex cursor-default items-center justify-center py-1",t),...a,children:e(j,{className:"size-4"})})}function Br({...t}){return e(We.Root,{"data-slot":"sheet",...t})}function Vr({...t}){return e(We.Trigger,{"data-slot":"sheet-trigger",...t})}function Hr({...t}){return e(We.Portal,{"data-slot":"sheet-portal",...t})}function Yr({className:t,...a}){return e(We.Overlay,{"data-slot":"sheet-overlay",className:jt("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...a})}function qr({className:a,children:r,side:n="right",...i}){return t(Hr,{children:[e(Yr,{}),t(We.Content,{"data-slot":"sheet-content",className:jt("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500","right"===n&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm","left"===n&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm","top"===n&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b","bottom"===n&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",a),...i,children:[r,t(We.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[e(R,{className:"size-4"}),e("span",{className:"sr-only",children:"Close"})]})]})]})}function Kr({className:t,...a}){return e("div",{"data-slot":"sheet-header",className:jt("flex flex-col gap-1.5 p-4",t),...a})}function Gr({className:t,...a}){return e(We.Title,{"data-slot":"sheet-title",className:jt("text-foreground font-semibold",t),...a})}function Wr({className:t,...a}){return e(We.Description,{"data-slot":"sheet-description",className:jt("text-muted-foreground text-sm",t),...a})}function Xr({className:t,...a}){return e("div",{"data-slot":"skeleton",className:jt("bg-accent animate-pulse rounded-md",t),...a})}function Jr({className:t,...a}){return e(Xe.Root,{"data-slot":"switch",className:jt("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...a,children:e(Xe.Thumb,{"data-slot":"switch-thumb",className:jt("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}function Zr({delayDuration:t=0,...a}){return e(Je.Provider,{"data-slot":"tooltip-provider",delayDuration:t,...a})}function Qr({delayDuration:t,...a}){return e(Zr,{delayDuration:t,children:e(Je.Root,{"data-slot":"tooltip",...a})})}function en({...t}){return e(Je.Trigger,{"data-slot":"tooltip-trigger",...t})}function tn({className:a,sideOffset:r=0,children:n,...i}){return e(Je.Portal,{children:t(Je.Content,{"data-slot":"tooltip-content",sideOffset:r,className:jt("bg-primary text-primary-foreground 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 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",a),...i,children:[n,e(Je.Arrow,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const an=ft("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",success:"border-transparent bg-primary/10 text-primary [a&]:hover:bg-primary/20",failure:"border-transparent bg-destructive/10 text-destructive [a&]:hover:bg-destructive/20"}},defaultVariants:{variant:"default"}});function rn({className:t,variant:a,asChild:r=!1,...n}){return e(r?gt:"span",{"data-slot":"badge",className:jt(an({variant:a}),t),...n})}function nn({className:t,orientation:a="horizontal",decorative:r=!0,...n}){return e(Ze.Root,{"data-slot":"separator",decorative:r,orientation:a,className:jt("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",t),...n})}function sn({...t}){return e(ct.Root,{"data-slot":"dropdown-menu",...t})}function ln({...t}){return e(ct.Portal,{"data-slot":"dropdown-menu-portal",...t})}function on({...t}){return e(ct.Trigger,{"data-slot":"dropdown-menu-trigger",...t})}function dn({className:t,sideOffset:a=4,...r}){return e(ct.Portal,{children:e(ct.Content,{"data-slot":"dropdown-menu-content",sideOffset:a,className:jt("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",t),...r})})}function cn({...t}){return e(ct.Group,{"data-slot":"dropdown-menu-group",...t})}function mn({className:t,inset:a,variant:r="default",...n}){return e(ct.Item,{"data-slot":"dropdown-menu-item","data-inset":a,"data-variant":r,className:jt("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...n})}function un({className:a,children:r,checked:n,...i}){return t(ct.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item",className:jt("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",a),checked:n,...i,children:[e("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:e(ct.ItemIndicator,{children:e(U,{className:"size-4"})})}),r]})}function pn({...t}){return e(ct.RadioGroup,{"data-slot":"dropdown-menu-radio-group",...t})}function hn({className:a,children:r,...n}){return t(ct.RadioItem,{"data-slot":"dropdown-menu-radio-item",className:jt("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",a),...n,children:[e("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:e(ct.ItemIndicator,{children:e(V,{className:"size-2 fill-current"})})}),r]})}function gn({className:t,inset:a,...r}){return e(ct.Label,{"data-slot":"dropdown-menu-label","data-inset":a,className:jt("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",t),...r})}function fn({className:t,...a}){return e(ct.Separator,{"data-slot":"dropdown-menu-separator",className:jt("bg-border -mx-1 my-1 h-px",t),...a})}function bn({className:t,...a}){return e("span",{"data-slot":"dropdown-menu-shortcut",className:jt("text-muted-foreground ml-auto text-xs tracking-widest",t),...a})}function xn({...t}){return e(ct.Sub,{"data-slot":"dropdown-menu-sub",...t})}function vn({className:a,inset:r,children:n,...i}){return t(ct.SubTrigger,{"data-slot":"dropdown-menu-sub-trigger","data-inset":r,className:jt("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8",a),...i,children:[n,e(H,{className:"ml-auto size-4"})]})}function yn({className:t,...a}){return e(ct.SubContent,{"data-slot":"dropdown-menu-sub-content",className:jt("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",t),...a})}function Nn({className:t,...a}){return e("textarea",{"data-slot":"textarea",className:jt("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),...a})}function wn({className:t,orientation:a="horizontal",...r}){return e(mt.Root,{"data-slot":"tabs","data-orientation":a,orientation:a,className:jt("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col",t),...r})}const _n=ft("rounded-lg p-[3px] group-data-[orientation=horizontal]/tabs:h-9 data-[variant=line]:rounded-none group/tabs-list text-muted-foreground inline-flex w-fit items-center justify-center group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function Cn({className:t,variant:a="default",...r}){return e(mt.List,{"data-slot":"tabs-list","data-variant":a,className:jt(_n({variant:a}),t),...r})}function kn({className:t,...a}){return e(mt.Trigger,{"data-slot":"tabs-trigger",className:jt("focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground/60 hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:border-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent","data-[state=active]:bg-background dark:data-[state=active]:text-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 data-[state=active]:text-foreground","after:bg-foreground after:absolute after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100",t),...a})}function Pn({className:t,...a}){return e(mt.Content,{"data-slot":"tabs-content",className:jt("flex-1 outline-none",t),...a})}const zn=()=>t("div",{className:"absolute inset-0 flex items-center justify-center",children:[e(va,{}),"  Loading..."]}),Sn=({className:a,layout:r="vertical",loading:n,doNotAppendFlex1:i=!1,responsive:s=!1,...l})=>{const o="horizontal"===r?!0===s?"sm:flex-row flex-col":"flex-row":"flex-col",d=i?"":"flex-1",c=t=>e("div",{className:`${d} flex ${o} items-stretch overflow-auto ${t||""} ${a}`,...l});if(!n)return c();const m=n?"pointer-events-none opacity-50":"";return t("div",{className:"relative flex-1",children:[n&&e(zn,{}),c(m)]})};function In(){const[e,t]=g.useState(void 0);return g.useEffect(()=>{const e=window.matchMedia("(max-width: 767px)"),a=()=>{t(window.innerWidth<768)};return e.addEventListener("change",a),t(window.innerWidth<768),()=>e.removeEventListener("change",a)},[]),!!e}const Tn=({leftItems:r=[],centerItems:n=[],rightItems:i=[],className:s="",style:l={}})=>{const o=In(),[d,c]=b(!1),m=[...r,...n,...i];return e("div",{className:`flex items-center w-full ${s}`,style:{minHeight:48,...l},children:o?t("div",{className:"flex w-full justify-end items-center",children:[e(dr,{type:"button",onClick:()=>c(!0),children:e(Y,{})}),e(cr,{open:d,setIsOpen:c,header:"Menu",actionsJSX:e(a,{}),disableOutsideClick:!1,children:e("div",{className:"flex flex-col gap-5 mt-2",children:m.map((t,a)=>e("div",{children:t},a))})})]}):t(a,{children:[r.length>0&&e("div",{className:"flex flex-1 items-center gap-2 justify-start px-1",children:r}),n.length>0&&e("div",{className:"flex flex-1 items-center gap-2 justify-center px-1",children:n}),i.length>0&&e("div",{className:"flex flex-1 items-center gap-2 justify-end px-1",children:i})]})})};function On({table:r,canShowSearchField:n=!0,searchFieldConfig:i={},canShowColumnsBtn:s=!1,additionalJSX:l,rawColumns:o,refreshBtn:d={canShow:!1,onClick:()=>{}}}){const c=e=>o.find(t=>t.id===e),m=In();return e(Sn,{className:"px-1 py-2 gap-2",layout:m?"vertical":"horizontal",doNotAppendFlex1:!0,children:e(Tn,{leftItems:[n&&i.searchField?e(Or,{placeholder:i.placeholder,value:r.getColumn(i.searchField)?.getFilterValue()??"",onChange:e=>{const t=r.getColumn(i.searchField);t?.setFilterValue(e.target.value)},className:"max-w-sm"},"searchField"):e(a,{}),d.canShow&&t(dr,{variant:"ghost",onClick:d.onClick,children:[e(K,{})," Refresh"]},"refreshBtn")],rightItems:[s&&t(sn,{children:[e(on,{asChild:!0,children:t(dr,{variant:"ghost",children:["Columns ",e(q,{})]},"columnsBtn")}),e(dn,{align:"end",children:r.getAllColumns().filter(e=>e.getCanHide()&&c(e.id)?.enableHiding).map(t=>e(un,{checked:t.getIsVisible(),onCheckedChange:e=>t.toggleVisibility(!!e),children:c(t.id)?.headerText||""},t.id))})]},"columnsBtnDropDown"),...l]})})}function An({className:t,...a}){return e("nav",{role:"navigation","aria-label":"pagination","data-slot":"pagination",className:jt("mx-auto flex w-full justify-center",t),...a})}function Fn({className:t,...a}){return e("ul",{"data-slot":"pagination-content",className:jt("flex flex-row items-center gap-1",t),...a})}function $n({...t}){return e("li",{"data-slot":"pagination-item",...t})}function Dn({className:t,isActive:a,size:r="icon",...n}){return e("a",{"aria-current":a?"page":void 0,"data-slot":"pagination-link","data-active":a,className:jt(lr({variant:a?"outline":"ghost",size:r}),"cursor-pointer",t),...n})}function En({className:a,...r}){return t(Dn,{"aria-label":"Go to previous page",size:"default",className:jt("gap-1 px-2.5 sm:pl-2.5",a),...r,children:[e(G,{}),e("span",{className:"hidden sm:block",children:"Previous"})]})}function Ln({className:a,...r}){return t(Dn,{"aria-label":"Go to next page",size:"default",className:jt("gap-1 px-2.5 sm:pr-2.5",a),...r,children:[e("span",{className:"hidden sm:block",children:"Next"}),e(H,{})]})}function Mn({className:a,...r}){return t("span",{"aria-hidden":!0,"data-slot":"pagination-ellipsis",className:jt("flex size-9 items-center justify-center",a),...r,children:[e(W,{className:"size-4"}),e("span",{className:"sr-only",children:"More pages"})]})}const Rn=({totalCount:a,activePage:r,pageSize:n,onPageChange:i})=>{const s=C(()=>Math.ceil(a/n),[a,n]),l=e=>{e<0||e>=s||i(e)},o="opacity-50 cursor-not-allowed",d=Kt(s).filter(e=>e<r+3&&e>r-3||0===e||e===s-1);return e(An,{className:"text-secondary-foreground",children:t(Fn,{children:[e($n,{children:e(En,{className:0===r?o:"",onClick:()=>l(r-1)})}),d.map((a,n)=>{let i=null;return n>0&&a-d[n-1]!==1&&(i=e($n,{children:e(Mn,{})})),t(f.Fragment,{children:[i,e($n,{className:r===a?"bg-primary text-primary-foreground rounded-2xl hover:bg-primary":"",children:e(Dn,{onClick:()=>l(a),children:a+1})})]},a)}),e($n,{children:e(Ln,{className:r===s-1?o:"",onClick:()=>l(r+1)})})]})})},jn=({pagination:t,totalCount:a,table:r})=>e("div",{className:"flex items-center justify-end space-x-2 pt-4",children:e(Rn,{totalCount:a,activePage:t.pageIndex,onPageChange:e=>{r.setPageIndex(e)},pageSize:t.pageSize})});var Un=g.memo(function({data:a,columns:r,actions:n,toolbarConfig:i,loading:s=!1,canShowToolbar:l=!0,canShowPagination:o=!0}){const[d,c]=g.useState([]),[m,u]=g.useState([]),[p,h]=g.useState({}),[f,b]=g.useState({}),x=r.map(a=>({accessorKey:a.id,header:({column:r})=>a.enableSorting?t(dr,{variant:"ghost",onClick:()=>r.toggleSorting("asc"===r.getIsSorted()),children:[a.headerText,e(Z,{})]}):e("span",{children:a.headerText}),cell:({row:t})=>{const r=t.getValue(a.id);if(oa(a.renderer))return a.renderer(t,r);let n;return n="boolean"===a.type?r?e(X,{size:20}):e(J,{size:18}):"date"===a.type?ta(r):String(r),e("div",{children:n})}}));n&&n.length>0&&x.unshift({id:"actions",enableHiding:!1,cell:({row:a})=>{const r=a.original;return t(sn,{children:[e(on,{asChild:!0,children:t(dr,{variant:"secondary",className:"h-5 w-8 p-0",children:[e("span",{className:"sr-only",children:"Open menu"}),e(Q,{})]})}),t(dn,{align:"start",children:[e(gn,{children:"Actions"}),n.map(t=>"SEPARATOR"===t.headerText?e(fn,{},t.id):e(mn,{onClick:()=>t.onClick&&t.onClick(r),children:t.headerText},t.id))]})]})}});const[v,y]=g.useState({pageIndex:0,pageSize:100}),N=Pt({data:a,columns:x,onSortingChange:c,onColumnFiltersChange:u,getCoreRowModel:Tt(),getSortedRowModel:It(),getFilteredRowModel:St(),onColumnVisibilityChange:h,onRowSelectionChange:b,...o&&{getPaginationRowModel:zt(),onPaginationChange:y},state:{sorting:d,columnFilters:m,columnVisibility:p,rowSelection:f,pagination:v}}),w=s?"pointer-events-none opacity-50":"";return t(Sn,{className:"w-full",children:[l&&e(On,{table:N,rawColumns:r,canShowSearchField:!0,canShowColumnsBtn:!0,...i,additionalJSX:i?.additionalJSX||[]}),s&&e(zn,{}),e(Sn,{className:`rounded-md border overflow-auto ${w}`,children:t(fr,{children:[e(br,{className:"sticky top-0 bg-sidebar",children:N.getHeaderGroups().map(t=>e(yr,{children:t.headers.map(t=>e(Nr,{children:t.isPlaceholder?null:Ot(t.column.columnDef.header,t.getContext())},t.id))},t.id))}),e(xr,{className:"flex-1",children:N.getRowModel().rows?.length?N.getRowModel().rows.map(t=>e(yr,{"data-state":t.getIsSelected()&&"selected",children:t.getVisibleCells().map(t=>e(wr,{children:Ot(t.column.columnDef.cell,t.getContext())},t.id))},t.id)):e(yr,{children:e(wr,{colSpan:n&&n.length>0?r.length+1:r.length,className:"h-24 text-center",children:"No results."})})})]})}),o&&e(jn,{pagination:v,totalCount:a.length,table:N})]})});const Bn=({child:a,className:r,rowCls:n,leftCls:i,rightCls:s})=>e("div",{className:`w-full ${r||""}`,children:sa(a,(a,r,l)=>t("div",{className:`flex w-full ${n||""}`,children:[e("div",{className:`flex-shrink-0 ${i||""}`,children:a}),e("div",{className:`flex-1 min-w-0 ${s||""}`,children:r})]},l+"tabularLayout"))}),Vn=({className:t="",children:a})=>e("div",{className:`flex-1 flex items-center justify-center ${t}`,children:a});function Hn({className:t,...a}){return e("h4",{className:`scroll-m-20 text-xl font-semibold tracking-tight ${t||""}`,...a})}function Yn({...t}){return e("p",{className:"leading-7 [&:not(:first-child)]:mt-6",...t})}function qn({...t}){return e(xt.Root,{"data-slot":"accordion",...t})}function Kn({className:t,...a}){return e(xt.Item,{"data-slot":"accordion-item",className:jt("border-b last:border-b-0",t),...a})}function Gn({className:a,children:r,...n}){return e(xt.Header,{className:"flex",children:t(xt.Trigger,{"data-slot":"accordion-trigger",className:jt("focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",a),...n,children:[r,e(j,{className:"text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200"})]})})}function Wn({className:t,children:a,...r}){return e(xt.Content,{"data-slot":"accordion-content",className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm",...r,children:e("div",{className:jt("pt-0 pb-4",t),children:a})})}const Xn=({title:a,children:r})=>e(qn,{type:"single",collapsible:!0,children:t(Kn,{value:"item-1",children:[e(Gn,{children:a}),e(Wn,{children:r})]})}),Jn=({...t})=>e("span",{...t}),Zn=({className:t,disabled:a,removeAllStyles:r=!1,...n})=>e(a?Jn:d,{className:(t||"")+" "+(r?"":a?"opacity-40 cursor-not-allowed":"cursor-pointer hover:underline"),...n}),Qn=({children:t,toPath:a,disabled:r,className:n,...i})=>e(Zn,{to:a,disabled:r,className:"h-40 p-5 w-60 border-2 border-primary rounded-4xl font-semibold flex flex-col justify-center hover:bg-accent "+n,...i,children:t}),ei=({label:a,children:r,items:n,onItemSelect:i,disabled:s})=>t(sn,{children:[e(on,{asChild:!0,disabled:s,children:r||t(dr,{className:"flex items-center gap-1",children:[a," ",e(q,{size:15})]})}),e(dn,{children:n.map(t=>e(mn,{onClick:()=>i?.(t),children:t.label},t.value))})]}),ti=({label:a,selectedRec:r,setSelectedRec:n,items:i})=>t(sn,{children:[e(on,{asChild:!0,children:t("div",{className:"flex items-center gap-2",children:[a&&e(Ar,{className:"whitespace-nowrap",children:a}),t("span",{className:"whitespace-nowrap text-primary flex items-center gap-1 text-sm cursor-pointer",children:[r.label," ",e(q,{size:15})]})]})}),e(dn,{children:i.map(t=>e(mn,{onClick:()=>n(t),children:t.label},t.value))})]}),ai=({children:t})=>e("h3",{className:"text-lg font-medium",children:t}),ri=({children:a,side:r})=>t(Qr,{children:[e(en,{asChild:!0,children:e("span",{className:"ml-2 align-middle cursor-pointer",children:e(dr,{variant:"link",className:"-ml-5",type:"button",tabIndex:-1,children:e(ee,{})})})}),e(tn,{side:r,children:a})]}),ni=({title:a,description:r,control:n,labelCls:i="",className:s=""})=>t("div",{className:`flex flex-row items-center justify-between rounded-lg border p-4 shadow-sm ${s}`,children:[t("div",{className:"flex-1 space-y-2",children:[e(Ar,{className:`cursor-pointer ${i}`,children:a}),e(Ar,{className:`font-normal text-gray-500 cursor-pointer ${i}`,children:r})]}),e("div",{children:n})]}),ii=({children:a})=>t("span",{className:`premium-icon-wrapper relative inline-flex items-center ${a?"gap-1":""} px-1.5 py-1.5 rounded-lg bg-gradient-to-br from-amber-400 via-amber-500 to-amber-600 bg-[length:200%_200%] text-xs font-semibold text-white transition-all duration-300 ease-in-out overflow-hidden hover:scale-105 hover:shadow-[0_0_20px_rgba(251,191,36,0.6),0_0_40px_rgba(251,191,36,0.3)] dark:from-amber-900 dark:via-amber-700 dark:to-amber-600 dark:bg-[length:200%_200%]`,children:[e(te,{size:14,className:"premium-crown relative z-10 flex-shrink-0 drop-shadow-[0_2px_4px_rgba(0,0,0,0.2)] text-white",strokeWidth:2.5}),e("span",{className:"relative z-10",children:a})]}),si=({placeholder:a,items:r,value:n,onValueChange:i,triggerClassName:s="w-[180px]",valueField:l="value",labelField:o="label",id:d,...c})=>t(Fr,{value:n,onValueChange:e=>{i?.(e)},children:[e(Dr,{className:s,...c,id:d,children:e($r,{placeholder:a})}),e(Er,{children:r.map(t=>e(Mr,{value:t[l],children:t[o]},t[l]))})]}),li=({content:a,side:r="bottom",rootProps:n,contentProps:i,triggerProps:s,children:l,canShowTooltip:o=!0,delayDuration:d=100,triggerOn:c="default"})=>{const[m,u]=b(()=>"default"===c&&(!!o&&void 0)),p=k(null),h=e=>{"click"===c&&((e=>{const t=e?.target;return t&&p.current&&p.current?.contains(t)})(e)||u(!1))};return t(Qr,{open:m,delayDuration:d,...n,children:[e(en,{"data-testid":"tooltip-trigger",asChild:!0,ref:p,onClick:()=>{"click"===c&&u(o&&!m)},...s,children:l}),e(tn,{side:r,"data-testid":"tooltip-content",onPointerDownOutside:h,onEscapeKeyDown:h,...i,children:a})]})},oi=({value:r,onChange:n,onAICall:i,placeholder:s="Type / for commands or start writing...",className:l="",classNameEditor:o="",minHeight:d="unset",id:c="",enableSlashMenu:m=!1,canShowAIOptions:u=!1,readingMode:p=!1})=>{const h=e=>{if(!g)return;const t=`link-${Math.random().toString(36).slice(2,9)}`;g.chain().focus().insertContent(`<a href="${e}" data-marker="${t}">${e}</a>`).run(),ka().get(`/link-metadata?url=${encodeURIComponent(e)}`).then(a=>{if(!a)return;const{title:r,image:n=`https://www.google.com/s2/favicons?domain=${e}`,description:i}=a,s=r||e;let l=-1,o=0;g.state.doc.descendants((e,a)=>{if(e.isText){if(e.marks.find(e=>"link"===e.type.name&&e.attrs["data-marker"]===t))return l=a,o=e.nodeSize,!1}return!0}),-1!==l&&g.chain().deleteRange({from:l,to:l+o}).insertContent(`<a href="${e}" data-image="${n||""}" data-description="${i||""}">${s}</a>`).run()}).catch(()=>{g.state.doc.descendants((a,r)=>{if(a.isText){if(a.marks.find(e=>"link"===e.type.name&&e.attrs["data-marker"]===t))return g.chain().deleteRange({from:r,to:r+a.nodeSize}).insertContent(`<a href="${e}">${e}</a>`).run(),!1}return!0})})},g=Qe({editable:!p,extensions:[nt.configure({heading:{levels:[1,2,3]}}),it,st.extend({inclusive:!1,addAttributes(){return{...this.parent?.(),"data-marker":{default:null,parseHTML:e=>e.getAttribute("data-marker"),renderHTML:e=>e["data-marker"]?{"data-marker":e["data-marker"]}:{}},"data-image":{default:null,parseHTML:e=>e.getAttribute("data-image"),renderHTML:e=>e["data-image"]?{"data-image":e["data-image"]}:{}},"data-description":{default:null,parseHTML:e=>e.getAttribute("data-description"),renderHTML:e=>e["data-description"]?{"data-description":e["data-description"]}:{}},style:{default:null,parseHTML:e=>e.getAttribute("style"),renderHTML:e=>e.style?{style:e.style}:{}}}},renderHTML({HTMLAttributes:e}){const{"data-image":t,"data-description":a,...r}=e,n=et(this.options.HTMLAttributes,r,{"data-image":t,"data-description":a,title:a||""});return t?["a",n,["img",{src:t,width:"16",height:"16"}],["span",0]]:["a",n,0]}}).configure({openOnClick:!1,autolink:!0,HTMLAttributes:{}}),lt.configure({placeholder:s,emptyEditorClass:"is-editor-empty"}),...m?[ot]:[],dt],content:r,onUpdate:({editor:e})=>{n(e.getHTML())},editorProps:{attributes:{class:jt("prose dark:prose-invert max-w-none focus:outline-none min-h-full","selection:bg-primary/30"),id:c},handlePaste:(e,t)=>{const a=t.clipboardData?.getData("text/plain");return!(!a||!(e=>{try{const t=new URL(e);return"http:"===t.protocol||"https:"===t.protocol}catch{return!1}})(a))&&(h(a),!0)}}});if(x(()=>{g&&r!==g.getHTML()&&g.commands.setContent(r)},[r,g]),x(()=>{g&&g.setEditable(!p)},[g,p]),!g)return null;const[b,v]=f.useState(!1),[y,N]=f.useState(""),w=()=>{const{from:e,to:t}=g.state.selection,a=g.state.doc.textBetween(e,t," "),r=g.getText();i&&i(a,r)},_=()=>{if(""===y)g.chain().focus().extendMarkRange("link").unsetLink().run();else{let e=y;/^https?:\/\//i.test(e)||e.startsWith("/")||e.startsWith("#")||(e="https://"+e);const{empty:t}=g.state.selection;t?h(e):g.chain().focus().extendMarkRange("link").setLink({href:e}).run()}v(!1),N("")},C=()=>{const e=g.getAttributes("link").href;N(e||""),v(!0)};x(()=>{const e=e=>{if((e.ctrlKey||e.metaKey)&&"k"===e.key){if(p)return;e.preventDefault(),C()}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[g]);const k=e=>jt("h-8 w-8 p-0 transition-all duration-200",e?"bg-primary text-primary-foreground hover:bg-primary/90":"hover:bg-accent hover:text-accent-foreground");return e("div",{className:jt("group relative w-full border rounded-md bg-transparent dark:bg-input/30 transition-[color,box-shadow] outline-none shadow-xs","border-input focus-within:border-ring focus-within:ring-ring/50 focus-within:ring-[3px] text-sm",l),style:{minHeight:d},children:t("div",{className:jt("px-3 py-2 h-full",p?"cursor-default":"cursor-text",o),onClick:()=>!p&&g.chain().focus().run(),children:[!p&&e(tt,{editor:g,tippyOptions:{duration:150,animation:"shift-away",onHidden:()=>v(!1)},className:"flex items-center gap-0.5 bg-popover/90 backdrop-blur-md border border-border rounded-lg shadow-xl p-1 overflow-hidden animate-in fade-in zoom-in duration-200",children:b?t("div",{className:"flex items-center gap-1 px-1",onClick:e=>e.stopPropagation(),children:[e(Or,{type:"text",value:y,onChange:e=>N(e.target.value),placeholder:"Paste or type a link...",className:"h-7 w-48 text-xs border-none focus-visible:ring-0 bg-transparent",autoFocus:!0,onKeyDown:e=>{e.stopPropagation(),"Enter"===e.key&&(e.preventDefault(),_()),"Escape"===e.key&&v(!1)}}),e(dr,{type:"button",variant:"ghost",size:"sm",onClick:_,className:"h-7 w-7 p-0",children:e(X,{className:"h-3.5 w-3.5"})}),e(dr,{type:"button",variant:"ghost",size:"sm",onClick:()=>v(!1),className:"h-7 w-7 p-0",children:e(J,{className:"h-3.5 w-3.5"})})]}):t(a,{children:[e(dr,{type:"button",variant:"ghost",size:"sm",onClick:()=>g.chain().focus().toggleBold().run(),className:k(g.isActive("bold")),children:e(ae,{className:"h-4 w-4"})}),e(dr,{type:"button",variant:"ghost",size:"sm",onClick:()=>g.chain().focus().toggleItalic().run(),className:k(g.isActive("italic")),children:e(re,{className:"h-4 w-4"})}),e(dr,{type:"button",variant:"ghost",size:"sm",onClick:()=>g.chain().focus().toggleUnderline().run(),className:k(g.isActive("underline")),children:e(ne,{className:"h-4 w-4"})}),e(dr,{type:"button",variant:"ghost",size:"sm",onClick:C,className:k(g.isActive("link")),children:e(ie,{className:"h-4 w-4"})}),e(nn,{orientation:"vertical",className:"h-4 mx-1"}),e(dr,{type:"button",variant:"ghost",size:"sm",onClick:()=>g.chain().focus().toggleBulletList().run(),className:k(g.isActive("bulletList")),children:e(se,{className:"h-4 w-4"})}),e(dr,{type:"button",variant:"ghost",size:"sm",onClick:()=>{g.chain().focus().deleteRange({from:g.state.selection.from-1,to:g.state.selection.from}).toggleBlockquote().run()},className:k(g.isActive("blockquote")),children:e(le,{className:"h-4 w-4"})}),u&&t(a,{children:[e(nn,{orientation:"vertical",className:"h-4 mx-1"}),t(dr,{type:"button",variant:"ghost",size:"sm",onClick:w,className:"h-8 px-2 flex items-center gap-1.5 text-primary hover:bg-primary/10 transition-colors",children:[e(oe,{className:"h-4 w-4 fill-primary/20 animate-pulse"}),e("span",{className:"text-xs font-semibold",children:"AI Edit"})]})]})]})}),m&&!p&&t(at,{editor:g,tippyOptions:{duration:150,placement:"bottom-start",offset:[0,8]},shouldShow:({state:e})=>{const{selection:t}=e,{$from:a}=t,r=a.nodeBefore?.text||"";return 1===a.parentOffset&&"/"===r},className:"flex flex-col min-w-[180px] bg-popover border border-border rounded-lg shadow-2xl p-1.5 animate-in slide-in-from-top-2 duration-200 z-50",children:[e("div",{className:"px-2 py-1.5 text-[10px] font-bold text-muted-foreground uppercase tracking-wider",children:"Quick Actions"}),e(di,{onClick:()=>{g.chain().focus().deleteRange({from:g.state.selection.from-1,to:g.state.selection.from}).toggleHeading({level:1}).run()},icon:e(de,{className:"h-4 w-4"}),label:"Heading 1",shortcut:"H1"}),e(di,{onClick:()=>{g.chain().focus().deleteRange({from:g.state.selection.from-1,to:g.state.selection.from}).toggleHeading({level:2}).run()},icon:e(ce,{className:"h-4 w-4"}),label:"Heading 2",shortcut:"H2"}),e(di,{onClick:()=>{g.chain().focus().deleteRange({from:g.state.selection.from-1,to:g.state.selection.from}).toggleBulletList().run()},icon:e(se,{className:"h-4 w-4"}),label:"Bullet List",shortcut:"-"}),e(di,{onClick:()=>{g.chain().focus().deleteRange({from:g.state.selection.from-1,to:g.state.selection.from}).toggleOrderedList().run()},icon:e(me,{className:"h-4 w-4"}),label:"Ordered List",shortcut:"1."}),e(di,{onClick:()=>{g.chain().focus().deleteRange({from:g.state.selection.from-1,to:g.state.selection.from}).toggleBlockquote().run()},icon:e(le,{className:"h-4 w-4"}),label:"Quote",shortcut:">"}),e(di,{onClick:()=>{g.chain().focus().deleteRange({from:g.state.selection.from-1,to:g.state.selection.from}).run(),C()},icon:e(ie,{className:"h-4 w-4"}),label:"Hyperlink",shortcut:"K"}),e(nn,{className:"my-1"}),u&&e(di,{onClick:()=>{g.chain().focus().deleteRange({from:g.state.selection.from-1,to:g.state.selection.from}).run(),w()},icon:e(oe,{className:"h-4 w-4 text-primary"}),label:"AI Assistant",className:"text-primary hover:bg-primary/10"})]}),e(rt,{editor:g})]})})},di=({onClick:a,icon:r,label:n,shortcut:i,className:s})=>t("button",{onClick:e=>{e.preventDefault(),e.stopPropagation(),a()},className:jt("flex items-center justify-between w-full px-2 py-1.5 text-sm rounded-md transition-colors","hover:bg-accent hover:text-accent-foreground text-left",s),children:[t("div",{className:"flex items-center gap-2",children:[e("div",{className:"flex items-center justify-center w-6 h-6 rounded-md bg-muted/50",children:r}),e("span",{children:n})]}),i&&e("span",{className:"text-[10px] text-muted-foreground bg-muted px-1.5 py-0.5 rounded uppercase font-medium",children:i})]}),ci=({isDirty:t,setDirty:a})=>{const r=c(t);return x(()=>{const e=e=>{t&&(e.preventDefault(),e.returnValue="")};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[t]),"blocked"===r.state?e(ur,{options:{open:!0,text:"Are you sure you want to leave this page?",type:"CONFIRM",onClose:e=>{"CONFIRM"===e?(r?.proceed(),a(!1)):r?.reset()}}}):null},mi=({tabs:a,variant:r,defaultValue:n})=>t(wn,{defaultValue:n,children:[e(Cn,{variant:r,children:a.map(t=>e(kn,{value:t.value,children:t.title},t.value))}),a.map(t=>e(ut,{value:t.value,children:t.content},t.value))]}),ui=({copyText:a})=>{const[r,n]=b(!1);return t("div",{className:"flex gap-2",children:[e(Nn,{readOnly:!0,value:a}),e(dr,{variant:"outline",size:"icon",onClick:()=>(async e=>{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),2e3),Na({description:"Copied to clipboard"})})(a),className:"shrink-0",children:e("span",{className:"flex items-center",children:r?e(X,{size:16,className:"text-green-500"}):e(ue,{size:16})})})]})},pi=e=>{const[t,a]=b(null),[r,n]=b(!1);return x(()=>{(async()=>{n(!0);try{const t=await ka().get(e);a(t)}finally{n(!1)}})()},[e]),{loading:r,response:t}};var hi=Object.freeze({__proto__:null,default:function(){return e("div",{className:"bg-muted flex min-h-svh flex-col items-center justify-center gap-6 p-6 md:p-10",children:t("div",{className:"flex w-full max-w-sm flex-col gap-6",children:[t("span",{className:"flex items-center gap-2 self-center font-medium",children:[e("div",{className:"bg-primary text-primary-foreground flex size-6 items-center justify-center rounded-md",children:e(Lt.logo,{className:"size-4"})}),Lt.appName]}),t("div",{className:jt("flex flex-col gap-6"),children:[t(Cr,{children:[t(kr,{className:"text-center",children:[e(Pr,{className:"text-xl",children:"Welcome"}),e(zr,{children:"Please fill the below details to continue"})]}),e(Ir,{children:e(m,{})})]}),t("div",{className:"text-muted-foreground *:[a]:hover:text-primary text-center text-xs text-balance *:[a]:underline *:[a]:underline-offset-4",children:["By clicking continue, you agree to our ",e("a",{children:"Terms of Service"})," and ",e("a",{children:"Privacy Policy"}),"."]})]})]})})}});var gi=Object.freeze({__proto__:null,default:function(){const a=k(null),r=u(),[n,s]=P(),l=i(),[o,c]=b(""),m=k(null),p=l.state?.from,h=p?`${p.pathname}${p.search}${p.hash}`:"/",g="grid gap-1";return x(()=>{a?.current?.focus()},[]),t("div",{className:"grid gap-6",children:[e("div",{className:"after:border-border relative text-center text-sm after:absolute after:inset-0 after:top-1/2 after:z-0 after:flex after:items-center after:border-t",children:e("span",{className:"bg-card text-muted-foreground relative z-10 px-2",children:"Login"})}),t("form",{onSubmit:async e=>{if(e.preventDefault(),!o)return void wa({header:"Captcha not completed",description:"Please complete the captcha to proceed."});const t=Ut(e.currentTarget),a={username:t.email,password:t.password,turnstileToken:o};!1!==Jt(a.username)?s(async()=>{try{const e=await ka().post("/login",a),{api:t=""}=e;if(!t)return wa({header:"Something went wrong!",description:"API Key not found."}),void Xt("API key not found in login command.");Na({header:"Welcome Back!",description:"Login Successful."}),Vt("apiKey",t),r(h)}catch(e){m.current?.reset(),c(""),Xt(e)}}):wa({header:"Email is not valid.",description:"Kindly recheck the email and try again."})},className:"grid gap-6",children:[t("div",{className:g,children:[e(Ar,{htmlFor:"email",children:"Email *"}),e(Or,{id:"email",type:"email",placeholder:"mail@example.com",name:"email",ref:a,required:!0})]}),t("div",{className:g,children:[e(Ar,{htmlFor:"password",children:"Password *"}),e(Or,{id:"password",type:"password",name:"password",placeholder:"**********",required:!0}),e(d,{to:"/forgot-password",className:"ml-auto text-sm underline-offset-4 hover:underline cursor-pointer",children:"Forgot your password?"})]}),e("div",{className:"text-center",children:e(pt,{ref:m,siteKey:Lt.cloudFareKey,onSuccess:e=>c(e)})}),e(dr,{type:"submit",className:"w-full",size:"lg",loading:n,children:"Login"})]}),t("div",{className:"text-center text-sm",children:["Don't have an account?"," ",e(d,{to:"/register",children:e("span",{className:"underline underline-offset-4",children:"Register"})})]})]})}});const fi=()=>t(ri,{side:"right",children:[e("h5",{children:"Password Policy:"}),t("ul",{children:[e("li",{children:"Password must be at least 8 characters long."}),e("li",{children:"Password must contain at least one uppercase letter."}),e("li",{children:"Password must contain at least one lowercase letter."}),e("li",{children:"Password must contain at least one number."}),e("li",{children:"Password must contain at least one special character."})]})]}),bi=({handleOnOTPSent:a,ref:r,gridCls:n,hidden:i,path:s})=>{const l=k(null),[o,d]=P();z(r,()=>({focus(){l.current?.focus()}}),[]);return t("form",{onSubmit:async e=>{e.preventDefault();const t={email:Ut(e.currentTarget).email||""};d(async()=>{try{await(async(e,t)=>{if(!1===Jt(t.email))throw wa({header:"Email is not valid.",description:"Kindly recheck the email and try again."});try{const a=await ka().post("/send-otp/"+e,t);Na({header:a.message||"OTP has been sent successfully",description:"Kindly enter below details to continue."})}catch(e){throw Xt(e),e}})(s,t),a(t)}catch(e){Xt(e)}})},className:`grid gap-5 ${i&&"hidden"}`,children:[t("div",{className:n,children:[e(Ar,{htmlFor:"email",children:"Email *"}),e(Or,{id:"email",type:"email",name:"email",placeholder:"mail@example.com",ref:l,required:!0})]}),e(dr,{type:"submit",className:"w-full",loading:o,children:"Generate OTP"})]})};function xi({className:t,containerClassName:a,...r}){return e(vt,{"data-slot":"input-otp",containerClassName:jt("flex items-center gap-2 has-disabled:opacity-50",a),className:jt("disabled:cursor-not-allowed",t),...r})}function vi({className:t,...a}){return e("div",{"data-slot":"input-otp-group",className:jt("flex items-center",t),...a})}function yi({index:a,className:r,...n}){const i=g.useContext(yt),{char:s,hasFakeCaret:l,isActive:o}=i?.slots[a]??{};return t("div",{"data-slot":"input-otp-slot","data-active":o,className:jt("data-[active=true]:border-ring data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive dark:bg-input/30 border-input relative flex h-9 w-9 items-center justify-center border-y border-r text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md data-[active=true]:z-10 data-[active=true]:ring-[3px]",r),...n,children:[s,l&&e("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:e("div",{className:"animate-caret-blink bg-foreground h-4 w-px duration-1000"})})]})}const Ni=({className:a,inputOTPField:r,otp:n,setOtp:i,onChangeEmailClick:s})=>{const l=function(e=30){const[t,a]=b(e);return x(()=>{if(t>0){const e=setTimeout(()=>a(t-1),1e3);return()=>clearTimeout(e)}},[t]),t}();return t("div",{className:a,children:[e(Ar,{htmlFor:"otp",children:"Enter OTP *"}),e(xi,{maxLength:4,name:"otp",id:"otp",ref:r,value:n,onChange:i,children:t(vi,{children:[e(yi,{index:0}),e(yi,{index:1}),e(yi,{index:2}),e(yi,{index:3})]})}),e("span",{className:"text-xs underline-offset-4 italic",children:l>0?t("span",{className:"muted-foreground",children:["You can resend the OTP in ",l," seconds."]}):e("span",{className:"hover:underline cursor-pointer",onClick:()=>s(),children:"Didn't receive the OTP? Send again."})})]})};var wi=Object.freeze({__proto__:null,default:function(){const a=k(null),r="grid gap-1",n=k(null),[i,s]=b(!1),[l,o]=b(""),[c,m]=b(""),[p,h]=P(),g=u();x(()=>{i?n.current?.focus():a?.current?.focus()},[i]);const f=()=>{s(!1)};return t("div",{className:"grid gap-5",children:[e("div",{className:"after:border-border relative text-center text-sm after:absolute after:inset-0 after:top-1/2 after:z-0 after:flex after:items-center after:border-t",children:e("span",{className:"bg-card text-muted-foreground relative z-10 px-2",children:"User Registration"})}),e(bi,{ref:a,handleOnOTPSent:e=>{s(!0),m(e.email)},gridCls:r,hidden:i,path:"new-registration"}),i&&t("form",{onSubmit:e=>{if(e.preventDefault(),!l)return wa({header:"OTP Required!",description:"Please enter your OTP and try again."}),void n.current?.focus();const t=Ut(e.currentTarget);t.otp=l,t.user_email=c;const a=Wt(t.user_password);!1!==a.valid?h(async()=>{try{await ka().post("user-registration",t),Na({header:`Welcome to ${Lt.appName}`,description:"Registration successful! Please log in to continue."}),g("/login")}catch(e){Xt(e)}}):wa({header:"Password Policy",description:a.message})},className:"grid gap-5",children:[t("div",{className:r,children:[e(Ar,{htmlFor:"emailOTPGenerated",children:"Email *"}),e(Or,{id:"emailOTPGenerated",type:"email",name:"email",placeholder:"mail@example.com",value:c,disabled:!0,required:!0}),e("span",{className:"ml-auto text-xs underline-offset-4 hover:underline cursor-pointer italic",onClick:f,children:"Change Email"})]}),e(Ni,{className:r,inputOTPField:n,otp:l,setOtp:o,onChangeEmailClick:f}),t("div",{className:"flex gap-4",children:[t("div",{className:r+" flex-1",children:[e(Ar,{htmlFor:"firstName",children:"First Name *"}),e(Or,{id:"firstName",name:"user_fname",type:"text",required:!0})]}),t("div",{className:r+" flex-1",children:[e(Ar,{htmlFor:"lastName",children:"Last Name *"}),e(Or,{id:"lastName",name:"user_lname",type:"text",required:!0})]})]}),t("div",{className:r,children:[e(Ar,{htmlFor:"mobile",children:"Mobile No"}),e(Or,{id:"mobile",type:"number",name:"user_mobile_no",placeholder:"98******88"})]}),t("div",{className:r,children:[t(Ar,{htmlFor:"password",children:["Set Password * ",e(fi,{})]}),e(Or,{id:"password",name:"user_password",type:"password",placeholder:"**********",required:!0})]}),e(dr,{type:"submit",className:"w-full",size:"lg",loading:p,children:"Create account"})]}),t("div",{className:"text-center text-sm",children:["Already have an account?"," ",e(d,{to:"/login",children:e("span",{className:"underline underline-offset-4",children:"Login"})})]})]})}});function _i({...t}){return e(ht.Root,{"data-slot":"collapsible",...t})}function Ci({isCollapsible:t,...r}){return t?e(ht.CollapsibleTrigger,{"data-slot":"collapsible-trigger",...r}):e(a,{children:r.children})}function ki({...t}){return e(ht.CollapsibleContent,{"data-slot":"collapsible-content",...t})}const Pi=g.createContext(null);function zi(){const e=g.useContext(Pi);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function Si({defaultOpen:t=!0,open:a,onOpenChange:r,className:n,style:i,children:s,...l}){const o=In(),[d,c]=g.useState(!1),[m,u]=g.useState(t),p=a??m,h=g.useCallback(e=>{const t="function"==typeof e?e(p):e;r?r(t):u(t),document.cookie=`sidebar_state=${t}; path=/; max-age=604800`},[r,p]),f=g.useCallback(()=>o?c(e=>!e):h(e=>!e),[o,h,c]);g.useEffect(()=>{const e=e=>{"l"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),f())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[f]);const b=p?"expanded":"collapsed",x=g.useMemo(()=>({state:b,open:p,setOpen:h,isMobile:o,openMobile:d,setOpenMobile:c,toggleSidebar:f}),[b,p,h,o,d,c,f]);return e(Pi.Provider,{value:x,children:e(Zr,{delayDuration:0,children:e("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":"16rem","--sidebar-width-icon":"3rem",...i},className:jt("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",n),...l,children:s})})})}function Ii({side:a="left",variant:r="sidebar",collapsible:n="offcanvas",className:i,children:s,...l}){const{isMobile:o,state:d,openMobile:c,setOpenMobile:m}=zi();return"none"===n?e("div",{"data-slot":"sidebar",className:jt("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",i),...l,children:s}):o?e(Br,{open:c,onOpenChange:m,...l,children:t(qr,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",style:{"--sidebar-width":"18rem"},side:a,children:[t(Kr,{className:"sr-only",children:[e(Gr,{children:"Sidebar"}),e(Wr,{children:"Displays the mobile sidebar."})]}),e("div",{className:"flex h-full w-full flex-col",children:s})]})}):t("div",{className:"group peer text-sidebar-foreground hidden md:block","data-state":d,"data-collapsible":"collapsed"===d?n:"","data-variant":r,"data-side":a,"data-slot":"sidebar",children:[e("div",{"data-slot":"sidebar-gap",className:jt("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180","floating"===r||"inset"===r?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),e("div",{"data-slot":"sidebar-container",className:jt("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex","left"===a?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]","floating"===r||"inset"===r?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",i),...l,children:e("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",children:s})})]})}function Ti({className:a,onClick:r,...n}){const{toggleSidebar:i}=zi();return t(dr,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon",className:jt("size-7",a),onClick:e=>{r?.(e),i()},...n,children:[e(pe,{}),e("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function Oi({className:t,...a}){const{toggleSidebar:r}=zi();return e("button",{"data-sidebar":"rail","data-slot":"sidebar-rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:r,title:"Toggle Sidebar",className:jt("hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] sm:flex","in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",t),...a})}function Ai({className:t,...a}){return e("main",{"data-slot":"sidebar-inset",className:jt("bg-background relative flex w-full flex-1 flex-col","md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",t),...a})}function Fi({className:t,...a}){return e("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:jt("flex flex-col gap-2 p-2",t),...a})}function $i({className:t,...a}){return e("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:jt("flex flex-col gap-2 p-2",t),...a})}function Di({className:t,...a}){return e("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:jt("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",t),...a})}function Ei({className:t,...a}){return e("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:jt("relative flex w-full min-w-0 flex-col p-2",t),...a})}function Li({className:t,asChild:a=!1,...r}){return e(a?gt:"div",{"data-slot":"sidebar-group-label","data-sidebar":"group-label",className:jt("text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",t),...r})}function Mi({className:t,...a}){return e("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:jt("flex w-full min-w-0 flex-col gap-1",t),...a})}function Ri({className:t,...a}){return e("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:jt("group/menu-item relative",t),...a})}const ji=ft("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function Ui({asChild:a=!1,isExpanded:r=!1,variant:n="default",size:i="default",tooltip:s,className:l,...o}){const d=e(a?gt:"button",{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":i,"data-active":r,className:jt(ji({variant:n,size:i}),l),...o});return s?("string"==typeof s&&(s={children:s}),t(Qr,{children:[e(en,{asChild:!0,children:d}),e(tn,{side:"right",align:"center",...s})]})):d}function Bi({className:t,...a}){return e("ul",{"data-slot":"sidebar-menu-sub","data-sidebar":"menu-sub",className:jt("border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",t),...a})}function Vi({className:t,...a}){return e("li",{"data-slot":"sidebar-menu-sub-item","data-sidebar":"menu-sub-item",className:jt("group/menu-sub-item relative",t),...a})}function Hi({asChild:t=!1,size:a="md",isExpanded:r=!1,className:n,...i}){return e(t?gt:"a",{"data-slot":"sidebar-menu-sub-button","data-sidebar":"menu-sub-button","data-size":a,"data-active":r,className:jt("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-hidden focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground","sm"===a&&"text-xs","md"===a&&"text-sm","group-data-[collapsible=icon]:hidden",n),...i})}function Yi({navItems:r}){const n=i().pathname,s=pa(n),l=e=>`app/${e}`,o="bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground",c=a=>{const r=t(Ui,{tooltip:a.title,className:"cursor-pointer "+(Yt(s,a.url||"")?o:""),children:[a.icon&&e(a.icon,{}),e("span",{children:a.title}),a.items&&e(he,{className:"ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90"})]});return a.url?e(d,{to:l(a.url),className:"w-full",children:r}):r};return e(a,{children:r.map(a=>t(Ei,{children:[e(Li,{children:a.title}),e(Mi,{children:a.items.map(a=>{const r=a.items&&a.items.some(e=>Yt(s,e.url));return e(_i,{asChild:!0,defaultOpen:r,className:"group/collapsible",children:t(Ri,{children:[e(Ci,{isCollapsible:!!a.items,asChild:!0,children:c(a)}),e(ki,{children:e(Bi,{children:a.items?.map(t=>e(Vi,{children:e(Hi,{asChild:!0,className:Yt(s,t.url)?o:"",children:e(d,{to:l(t.url),title:t.title,children:e("span",{children:t.title})})})},t.title))})})]})},a.title)})})]},a.title))})}function qi({className:t,...a}){return e(bt.Root,{"data-slot":"avatar",className:jt("relative flex size-8 shrink-0 overflow-hidden rounded-full",t),...a})}function Ki({className:t,...a}){return e(bt.Image,{"data-slot":"avatar-image",className:jt("aspect-square size-full",t),...a})}function Gi({className:t,...a}){return e(bt.Fallback,{"data-slot":"avatar-fallback",className:jt("bg-muted flex size-full items-center justify-center rounded-full",t),...a})}const Wi=({isDialogOpen:a,setIsDialogOpen:r})=>{const{loggedInUser:n,setLoggedInUser:i}=y(xa),[s,l]=b(!1),[o,d]=b(!1),[c,m]=b(null),[u,p]=b({});x(()=>{a&&h()},[a]);const h=async()=>{l(!0);try{const e={user_id:n.id,user_email:n.email,user_mobile_no:n.mobNo?.toString()||"",user_fname:n.fname||"",user_lname:n.lname||"",user_is_active:!0,created_at:(new Date).toISOString(),updated_at:(new Date).toISOString()};m(e),p(e)}catch(e){console.error("Error fetching user data:",e)}finally{l(!1)}},g=(e,t)=>{p(a=>({...a,[e]:t}))};return e(cr,{open:a,setIsOpen:r,header:"Edit User Profile",disableOutsideClick:!0,actionsJSX:t("div",{className:"flex gap-3",children:[e(dr,{variant:"outline",onClick:()=>{p(c||{}),r(!1)},disabled:o,children:"Cancel"}),e(dr,{onClick:async()=>{d(!0);try{const e={user_mobile_no:u.user_mobile_no,user_fname:u.user_fname,user_lname:u.user_lname};await ka().put(`/user-profile/${u.user_id}`,e),Na({header:"Success",description:"User profile updated successfully"}),m(u),i({...n,mobNo:u.user_mobile_no,fname:u.user_fname,lname:u.user_lname}),r(!1)}catch(e){console.error("Error saving user data:",e)}finally{d(!1)}},loading:o,children:"Save Changes"})]}),children:s?e("div",{className:"flex items-center justify-center py-8",children:t("div",{className:"text-muted-foreground flex items-center gap-1",children:[e(va,{}),"Loading user data..."]})}):t("div",{className:"space-y-4 mt-4",children:[t("div",{className:"space-y-2",children:[e(Ar,{htmlFor:"user_id",children:"User ID"}),e(Or,{id:"user_id",value:u.user_id?na(u.user_id):"",disabled:!0,className:"bg-muted"})]}),t("div",{className:"space-y-2",children:[e(Ar,{htmlFor:"user_email",children:"Email"}),e(Or,{id:"user_email",type:"email",value:u.user_email||"",placeholder:"Enter email address",disabled:!0,className:"bg-muted"})]}),t("div",{className:"space-y-2",children:[e(Ar,{htmlFor:"user_mobile_no",children:"Mobile Number"}),e(Or,{id:"user_mobile_no",type:"number",value:u.user_mobile_no||"",onChange:e=>g("user_mobile_no",e.target.value),placeholder:"Enter mobile number"})]}),t("div",{className:"space-y-2",children:[e(Ar,{htmlFor:"user_fname",children:"First Name"}),e(Or,{id:"user_fname",value:u.user_fname||"",onChange:e=>g("user_fname",e.target.value),placeholder:"Enter first name"})]}),t("div",{className:"space-y-2",children:[e(Ar,{htmlFor:"user_lname",children:"Last Name"}),e(Or,{id:"user_lname",value:u.user_lname||"",onChange:e=>g("user_lname",e.target.value),placeholder:"Enter last name"})]}),t("div",{className:"space-y-2",children:[e(Ar,{htmlFor:"created_at",children:"Joined On"}),e(Or,{id:"created_at",value:u.created_at?new Date(u.created_at).toLocaleString():"",disabled:!0,className:"bg-muted"})]})]})})};function Xi({fname:r,lname:n,email:i,avatar:s}){const l=u(),{isMobile:o}=zi(),{activePlan:d,featureFlags:c}=y(xa),m=`${r} ${n}`,[p,h]=b(!1);return t(a,{children:[e(Wi,{isDialogOpen:p,setIsDialogOpen:h}),e(Mi,{children:e(Ri,{children:t(sn,{children:[e(on,{asChild:!0,children:t(Ui,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",children:[t(qi,{className:"h-8 w-8 rounded-lg",children:[e(Ki,{src:s,alt:m}),t(Gi,{className:"rounded-lg",children:[r[0].toLocaleUpperCase(),n[0].toLocaleUpperCase()]})]}),t("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[e("span",{className:"truncate font-medium",children:m}),e("span",{className:"truncate text-xs",children:i})]}),e(ge,{className:"ml-auto size-4"})]})}),t(dn,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:o?"bottom":"right",align:"end",sideOffset:4,children:[e(gn,{className:"p-0 font-normal",children:t("div",{className:"flex items-center gap-2 px-1 py-1.5 text-left text-sm",children:[t(qi,{className:"h-8 w-8 rounded-lg",children:[e(Ki,{src:s,alt:m}),t(Gi,{className:"rounded-lg",children:[r[0].toLocaleUpperCase(),n[0].toLocaleUpperCase()]})]}),t("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[e("span",{className:"truncate font-medium",children:m}),e("span",{className:"truncate text-xs",children:i})]})]})}),e(fn,{}),t(mn,{onClick:()=>h(!0),children:[e(fe,{}),"Your Profile"]}),c.ff_enable_paid_subscription?t(a,{children:[e(fn,{}),e(cn,{children:t(mn,{onClick:()=>{setTimeout(()=>{l("/plans")},o?500:0)},children:[e(be,{}),Ia(d)?"Upgrade to premium":"View Plans"]})}),e(fn,{}),t(cn,{children:[t(mn,{onClick:()=>{setTimeout(()=>{l("/infrastructure/manage-subscription")},o?500:0)},children:[e(xe,{}),"Subscriptions"]}),t(mn,{onClick:()=>{setTimeout(()=>{l("/infrastructure/payment-history")},o?500:0)},children:[e(ve,{}),"Payment History"]})]})]}):null,e(fn,{}),t(mn,{onClick:()=>{Vt("apiKey",""),l("/login")},children:[e(ye,{}),"Log out"]})]})]})})})]})}const Ji=({purchasedPlan:r})=>{const{subscriptionConfig:n,featureFlags:i}=y(xa);if(!i.ff_enable_paid_subscription)return null;const s=n.plans.find(e=>e.id===r.plan_id);if(!s)return null;const l=Ia(r);return e(li,{delayDuration:20,content:t(a,{children:["This ",Lt.account_type_txt.singular.toLocaleLowerCase(),' is on a "',s.title,'" plan.']}),side:"right",children:e("div",{children:e(rn,{variant:"success",children:l?"Free":"Premium"})})})};function Zi(){const{isMobile:r,setOpenMobile:n}=zi(),{orgs:i,activeOrg:s,setActiveOrg:l}=y(xa),o=u();return e(Mi,{children:e(Ri,{children:t(sn,{children:[e(on,{asChild:!0,children:t(Ui,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",children:[e("div",{className:"flex aspect-square size-8 items-center justify-center rounded-lg",children:e(s?.logo?s.logo:Ne,{className:"size-4"})}),s?e(li,{content:s.org_name+" - "+s.org_external_id,side:"right",canShowTooltip:!0,children:t("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[e("span",{className:"truncate font-medium",children:s.org_name}),e("span",{className:"truncate text-xs",children:s.org_external_id})]})}):t("div",{className:"truncate text-xs",children:["No Active ",Lt.account_type_txt.singular,", select one."]}),s?.active_purchased_plan&&e("div",{className:"flex items-center justify-center rounded-md border",children:e(Ji,{purchasedPlan:s.active_purchased_plan})}),e(ge,{className:"ml-auto"})]})}),t(dn,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",align:"start",side:r?"bottom":"right",sideOffset:4,children:[e(gn,{className:"text-muted-foreground text-xs",children:Lt.account_type_txt.plural}),i.map(r=>t(mn,{onClick:()=>l(r),className:"gap-2 p-2",children:[r.logo?e("div",{className:"flex size-6 items-center justify-center rounded-md border",children:e(r.logo,{className:"size-3.5 shrink-0"})}):e(a,{}),r.org_name,r.active_purchased_plan&&e("div",{className:"ml-auto flex items-center justify-center rounded-md border",children:e(Ji,{purchasedPlan:r.active_purchased_plan})})]},r.org_id)),e(fn,{}),(()=>{const i=[];if(s&&ua(s?.org_id||0)){const r=hr.Is_ADMIN(s?.role_id||NaN);i.push({text:e(a,{children:"Invite team members"}),link:`/infrastructure/edit-org/${na(s?.org_id||0)}`,disabled:!r,icon:e(we,{className:"size-4"}),tooltip:r?`Invite peoples to "${s.org_name}" ${Lt.account_type_txt.singular.toLocaleLowerCase()}`:`You are not an admin for "${s.org_name}" ${Lt.account_type_txt.singular.toLocaleLowerCase()}, Only admins can invite peoples.`,key:"invite-peoples"},{text:t(a,{children:["Edit ",Lt.account_type_txt.singular.toLocaleLowerCase()]}),link:`/infrastructure/edit-org/${na(s?.org_id||0)}`,disabled:!r,icon:e(_e,{className:"size-4"}),tooltip:r?`Edit "${s.org_name}" ${Lt.account_type_txt.singular.toLocaleLowerCase()} details`:`You are not an admin for "${s.org_name}" ${Lt.account_type_txt.singular.toLocaleLowerCase()}, Only admins can invite peoples.`,key:"edit-org"})}return i.push({addTopSeparator:!0,text:t(a,{children:["Create new ",Lt.account_type_txt.singular.toLocaleLowerCase()]}),link:"/infrastructure/create-new-org",icon:e(Ce,{className:"size-4"}),key:"create-new-org"},{text:t(a,{children:["View all ",Lt.account_type_txt.plural.toLocaleLowerCase()]}),link:"/infrastructure/manage-infra",icon:e(ke,{className:"size-4"}),key:"view-all-orgs"},{addTopSeparator:!0,text:e(a,{children:"Check invites"}),link:"infrastructure/user-invitations",icon:e(we,{className:"size-4"}),key:"check-invitations"}),e(a,{children:i.map(i=>e(li,{content:e(a,{children:i.tooltip}),side:"right",canShowTooltip:!!i.tooltip,children:t("div",{children:[i.addTopSeparator?e(fn,{}):null,t(mn,{className:"gap-2 p-2 cursor-pointer",onClick:()=>{n(!1),setTimeout(()=>{i.disabled?wa({header:"Action not allowed!",description:i.tooltip||"You cannot access this option"}):o(i.link)},r?500:0)},children:[e("div",{className:"flex size-6 items-center justify-center rounded-md border bg-transparent",title:i.tooltip,children:i.icon}),e("div",{className:"text-muted-foreground font-medium",children:i.text})]},i.link)]},i.key)},i.key))})})()]})]})})})}function Qi(){return e(Mi,{children:e(d,{to:"/",children:e(Ri,{children:t(Ui,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",children:[e("div",{className:"w-10 h-10 bg-sidebar-primary text-sidebar-primary-foreground rounded-lg flex items-center justify-center",children:e(Lt.logo,{})}),t("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[e("span",{className:"truncate font-medium",children:Lt.appName}),t("span",{className:"truncate text-xs",children:["v",Lt.version]})]})]})})})})}const es=Ft;function ts({...a}){const{loggedInUser:r,featureFlags:n}=g.useContext(xa);return t(Ii,{collapsible:"icon",...a,children:[t(Fi,{children:[e(Qi,{}),n.ff_enable_teams&&e(Zi,{})]}),e(Di,{children:e(Yi,{navItems:es.navMain})}),e($i,{children:e(Xi,{email:r?.email||"",fname:r?.fname||"",lname:r?.lname||"",avatar:"/avatars/shadcn.jpg"})}),e(Oi,{})]})}function as({...t}){return e("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",...t})}function rs({className:t,...a}){return e("ol",{"data-slot":"breadcrumb-list",className:jt("text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5",t),...a})}function ns({className:t,...a}){return e("li",{"data-slot":"breadcrumb-item",className:jt("inline-flex items-center gap-1.5",t),...a})}function is({asChild:t,className:a,...r}){return e(t?gt:"a",{"data-slot":"breadcrumb-link",className:jt("hover:text-foreground transition-colors",a),...r})}function ss({className:t,...a}){return e("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:jt("text-foreground font-normal",t),...a})}function ls({children:t,className:a,...r}){return e("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:jt("[&>svg]:size-3.5",a),...r,children:t??e(he,{})})}const os=()=>{const a=(()=>{const e=i().pathname;if(!e||"/"===e)return{title:"Dashboard"};const t=pa(e),a=qt(t);return a||{title:"Not Found",url:"notFound"}})(),r=(a,n)=>{let i=[];return i.push(t(S,{children:[e(ns,{children:e(n?ss:is,{children:a.title})}),!n&&e(ls,{})]},a.title)),a.parent&&(i=[r(a.parent,!1),...i].flat()),i};return e(as,{children:e(rs,{children:r(a,!0)})})},ds=()=>{const r=u(),n=mr(),{activeOrg:i,loggedInUser:s}=y(xa);return{editOrganization:n=>{hr.Is_ADMIN(n.role_id)?r("/infrastructure/edit-org/"+na(n.org_id)):_a({header:"Alert",description:t(a,{children:["You are not allowed to edit the ",e("b",{children:n.org_name})," ",Lt.account_type_txt.singular.toLocaleLowerCase(),"."]})})},handleOnDeleteUnregisteredUser:(e,t)=>{const{id:a,email:r}=e;return new Promise((e,i)=>{n.showAlertBox({type:"CONFIRM",text:`Are you sure you want to remove "${r}" user from your ${Lt.account_type_txt.singular}?`,async onClose(n){if("CONFIRM"!==n)return void i();const s={invited_users_id:a,org_id:t};try{const t=await ka().delete("/org-member/unregistered-user-invitation",{data:s});Na({description:`${r} has been successfully removed from the team.`}),e(t)}catch(e){i(e)}}})})},isActiveOrgCreatedByMe:()=>Number(i?.org_created_by)===Number(s.id)}},cs=()=>{const{featureFlags:t}=y(xa),{isMobile:a,setOpenMobile:r}=zi(),n=u(),{isActiveOrgFreePlan:i,isUserFreePlan:s}=Aa(),{isActiveOrgCreatedByMe:l}=ds();if(!1===t.ff_enable_paid_subscription)return null;const o=()=>{a&&r(!1),n("/plans")};return s()&&(!t.ff_enable_teams||i()&&l())?e("button",{onClick:o,children:e(ii,{children:"Upgrade to premium"})}):null};var ms=Object.freeze({__proto__:null,default:function(){const r=In();return t(Si,{children:[e(ts,{}),t(Ai,{className:"h-screen",children:[t("header",{className:"flex py-4 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12 bg-background",children:[t("div",{className:"flex items-center gap-2 px-4",children:[e(Ti,{className:"-ml-1"}),e(nn,{orientation:"vertical",className:"mr-2 data-[orientation=vertical]:h-4"}),e(os,{})]}),e("div",{className:"flex-1"}),e("div",{className:"flex items-center gap-2 px-4",children:e(r?a:cs,{})})]}),e("div",{className:"flex items-stretch flex-col flex-1 overflow-auto",children:e(m,{})})]})]})}});var us=Object.freeze({__proto__:null,default:({canShowHeader:r=!0})=>t("div",{className:"flex flex-col stretch justify-center gap-4 items-center flex-1 p-5",children:[r&&t(a,{children:[e("h1",{className:"text-3xl font-bold text-primary p-0",children:Lt.appName}),e("p",{className:"text-sm",children:Lt.appDescription})]}),t("div",{className:"flex flex-col justify-center",children:[e("div",{className:"text-muted-foreground mb-4 text-sm",children:"404 Page Not Found"}),e(d,{to:"/",className:"p-2 bg-primary text-primary-foreground rounded-md transition-colors text-sm",children:"Go to Homepage"})]})]})});const ps=({ref:a,gridCls:r,onChangeEmailClick:n,email:i})=>{const[s,l]=b(""),[o,d]=P(),c=u(),m=k(null);return z(a,()=>({focus(){m.current?.focus()}}),[]),t("form",{onSubmit:async e=>{if(e.preventDefault(),!s)return wa({header:"OTP Required!",description:"Please enter your OTP and try again."}),void m.current?.focus();const t=Ut(e.currentTarget);t.otp=s,t.user_email=i;const a=Wt(t.password);!1!==a.valid?t.password===t.user_password?d(async()=>{try{delete t.password,await ka().put("/reset-password",t),Na({header:"Your password has been reset successfully!",description:"Please log in using your new password."}),c("/login")}catch(e){Xt(e)}}):wa({header:"Password and Confirm Password fields contain different passwords.",description:""}):wa({header:"Password Policy",description:a.message})},className:"grid gap-6",children:[t("div",{className:r,children:[e(Ar,{htmlFor:"emailOTPGenerated",children:"Email *"}),e(Or,{id:"emailOTPGenerated",type:"email",name:"user_email",placeholder:"mail@example.com",value:i,disabled:!0,required:!0}),e("span",{className:"ml-auto text-xs underline-offset-4 hover:underline cursor-pointer italic",onClick:()=>n(),children:"Change Email"})]}),e(Ni,{className:r,inputOTPField:m,otp:s,setOtp:l,onChangeEmailClick:n}),t("div",{className:r,children:[t(Ar,{htmlFor:"password",children:["New Password * ",e(fi,{})]}),e(Or,{id:"password",type:"password",name:"password",placeholder:"**********",required:!0})]}),t("div",{className:r,children:[e(Ar,{htmlFor:"cnf-password",children:"Confirm Password *"}),e(Or,{id:"cnf-password",type:"password",name:"user_password",placeholder:"**********",required:!0})]}),e(dr,{type:"submit",className:"w-full",size:"lg",loading:o,children:"Reset Password"})]})};var hs=Object.freeze({__proto__:null,default:function(){const a=k(null),r=k(null),[n,i]=b(!1),[s,l]=b(""),o="grid gap-1";return x(()=>{n?r.current?.focus():a?.current?.focus()},[n]),t("div",{className:"grid gap-6",children:[e("div",{className:"after:border-border relative text-center text-sm after:absolute after:inset-0 after:top-1/2 after:z-0 after:flex after:items-center after:border-t",children:e("span",{className:"bg-card text-muted-foreground relative z-10 px-2",children:"Forgot Password"})}),e(bi,{ref:a,handleOnOTPSent:e=>{i(!0),l(e.email)},gridCls:o,hidden:n,path:"forgot-password"}),n&&e(ps,{ref:r,gridCls:o,onChangeEmailClick:()=>i(!1),email:s}),t("div",{className:"text-center text-sm",children:["Already have an account?"," ",e(d,{to:"/login",children:e("span",{className:"underline underline-offset-4",children:"Login"})})]})]})}});var gs=Object.freeze({__proto__:null,default:()=>{const{orgs:a}=y(xa);return t("div",{className:"mt-5",children:[t("div",{className:"flex flex-row justify-center gap-6",children:[t(Qn,{toPath:"create-new-org",className:"text-center",children:["Create new ",Lt.account_type_txt.singular.toLocaleLowerCase()]}),e(Qn,{toPath:"user-invitations",className:"text-center",children:"Accept/Reject Invitations"})]}),e("div",{className:"flex flex-row justify-center gap-6 mt-5",children:t(Qn,{toPath:"manage-infra",className:"text-center",disabled:a.length<=0,children:["Manage ",Lt.account_type_txt.plural.toLocaleLowerCase()]})})]})}});const fs=({value:t,setValue:a,id:r})=>e(si,{valueField:"id",labelField:"text",placeholder:"Specify Role",items:hr.GET_LIST(),value:t,onValueChange:e=>{a(e)},triggerClassName:"w-[180px]",id:r}),bs=(e,t)=>-1===t||e?.user_opinion===ca.NOT_SAVED,xs=({teamMembers:r,setTeamMembers:n,inactiveUsers:i})=>{const[s,l]=b(),[o,d]=b(NaN),c=mr(),[m,u]=b(),[p,h]=b(!1),[g,f]=b({email:"",role_id:hr.READ,user_opinion:ca.INVITED,id:""}),{loggedInUser:v}=y(xa),N=e=>{const t={},a=[...r??[],...e];a.forEach(e=>{const a=e.email;t[a]=t[a]?t[a]++:1});const i=a.filter(e=>(t[e.email]--,0===t[e.email]));return n(i),a.length===i.length},w=e=>e&&e.email&&!1!==Jt(e.email)?!!hr.IS_VALID_ROLE_ID(e.role_id)||(wa({description:"Invalid role selected. Please select a valid role and try again."}),!1):(wa({description:"Invalid email, please enter correct email and try again."}),!1);return x(()=>{if(!m)return void f({email:"",role_id:NaN,user_opinion:ca.INVITED,id:""});if(-1===m)return;const e=r?.find(e=>e.id===m);e?f({email:e.email,role_id:e.role_id,user_opinion:e.user_opinion,id:e.id||e.email}):wa({description:"Something went wrong, please reload and try again."})},[m]),t(Sn,{layout:"vertical",className:"gap-2",children:[p&&t(cr,{open:!0,setIsOpen:h,header:"Bulk Add Users",actionsJSX:e(dr,{onClick:()=>{const{validEmails:e}=s||{};if(!e?.length||e?.length<=0)return _a({description:"Please add comma separated emails, then press Continue button"});const t=e.map(e=>({email:e,role_id:o,id:e,user_opinion:ca.INVITED}));N(t),l(void 0),h(!1),Na({description:`${e?.length} emails has been added.`})},children:"Add users"}),children:[t(Sn,{layout:"horizontal",className:"gap-2",children:[e(Nn,{id:"includeUsers",placeholder:"Enter comma separated emailIds like mail1@temp.com, mail2@temp.com",className:"w-full min-h-[80px] max-h-[500px] mr-1",onChange:e=>l(Zt(e.target.value))}),e("span",{children:e(ri,{side:"right",children:"Enter comma separated emailIds like mail1@temp.com, mail2@temp.com"})})]}),t("span",{className:"mb-5",children:[t("span",{className:"text-success",children:["Valid Emails: ",s?.validEmails.length||0]}),","," ",t("span",{className:"text-failure",children:["Invalid Emails: ",s?.invalidEmails.length||0]})]}),t("div",{className:"flex flex-row gap-2",children:[e(Ar,{htmlFor:"roles",children:"Role *"}),e(fs,{id:"bulk-roles",value:o?.toString()||"",setValue:e=>{d(Number(e))}})]})]}),m&&e(cr,{open:!0,setIsOpen:e=>{u(!1===e?void 0:m)},header:-1===m?"Add User":"Edit User",actionsJSX:e(dr,{type:"button",onClick:-1===m?()=>{if(!w(g))return;N([{...g,id:g.email,user_opinion:ca.NOT_SAVED}])?u(void 0):wa({description:`This email is already exists in list: ${g.email}`})}:()=>{if(!w(g))return;const e=r?.find(e=>e.email===g.email&&e.id!==m);if(e)return void _a({description:`This email is already exists in list: ${g.email}`});const t=[...r||[]],a=t.find(e=>e.id===m);a?(a.email=g.email,a.role_id=g.role_id,n(t),u(void 0)):wa({description:"Record not found to update, something went wrong!"})},children:"Update"}),children:t("div",{className:"flex flex-col p-5 gap-5",children:[t("div",{className:"flex flex-col gap-2",children:[e(Ar,{htmlFor:"email",children:"Email *"}),e(Or,{id:"email",type:"email",placeholder:"mail@example.com",value:g.email,disabled:!1===bs(g,m),onChange:e=>f(t=>({...t,email:e.target.value}))})]}),t("div",{className:"flex flex-col gap-2 ",children:[e(Ar,{htmlFor:"roles",children:"Role *"}),e(fs,{id:"roles",value:g.role_id?.toString()||"",setValue:e=>{f(t=>({...t,role_id:Number(e)}))}})]})]})}),e(Un,{canShowToolbar:!0,canShowPagination:!1,data:r||[],toolbarConfig:{canShowSearchField:!1,canShowColumnsBtn:!1,additionalJSX:[t(dr,{variant:"secondary",type:"button",onClick:()=>{u(-1)},children:[e(Ce,{})," Add User"]}),t(dr,{variant:"outline",type:"button",onClick:()=>{h(!0)},children:[e(Se,{})," Bulk Add"]})]},columns:[{id:"email",headerText:"Email",enableSorting:!1,enableHiding:!1,editable:!0},{id:"role_id",headerText:"Role",enableSorting:!1,enableHiding:!1,editable:!0,type:"string",renderer:(e,t)=>hr.DISPLAY_TEXT(t)},{id:"user_opinion",headerText:"Status",enableSorting:!1,enableHiding:!1,type:"boolean",editable:!1,renderer(e){const{user_opinion:t}=e.original;return ca.getDisplay(t)}},{id:"joinedOn",headerText:"Joined On",enableSorting:!1,enableHiding:!1,type:"date",editable:!0},{id:"actions",headerText:"Actions",enableSorting:!1,enableHiding:!1,renderer(i){const{id:s}=i?.original;return t(a,{children:[e(dr,{variant:"ghost",onClick:()=>{const e=r?.find(e=>e.id===s),t=e?.fname||e?.lname?`${e?.fname} ${e?.lname}`:e?.email;e?.email!==v?.email?(!1===bs(e,void 0)&&_a({header:`Not allowed to edit email "${t}", however you can update its administrative privileges.`,description:"The invitation has been already sent. If you do not want this user as a team member, you can delete them and correct one."}),u(s)):_a({header:`Not allowed to edit "${t}"`,description:`If you want to leave this ${Lt.account_type_txt.singular.toLocaleLowerCase()}, go to "Manage ${Lt.account_type_txt.singular}," open the actions menu (three dots), and click "Leave ${Lt.account_type_txt.singular}."`})},type:"button",children:e(Pe,{})}),e(dr,{variant:"ghost",onClick:()=>{const e=r?.find(e=>e.id===s),t=e?.fname||e?.lname?`${e?.fname} ${e?.lname}`:e?.email;e?.email!==v?.email?c.showAlertBox({type:"CONFIRM",text:`Are you sure you want to remove "${t}" user?`,async onClose(e){"CONFIRM"===e&&n(r?.filter(e=>e.id!==s))}}):_a({header:`Not allowed to remove "${t}"`,description:`If you want to leave this ${Lt.account_type_txt.singular}, go to "Manage ${Lt.account_type_txt.singular}," open the actions menu (three dots), and click "Leave ${Lt.account_type_txt.singular}."`})},type:"button",children:e(ze,{})})]})}}]}),i.length>0&&t(a,{children:[e(Yn,{className:"mt-5 leading-normal font-semibold",children:"Following users are inactive/deleted."}),e("ol",{children:i.map((e,a)=>t("li",{children:[a+1,". ",e.email," ",hr.DISPLAY_TEXT(e.role_id)]},e.email))})]})]})};var vs=Object.freeze({__proto__:null,default:()=>{const r=u(),{orgId:n=""}=p(),[i,s]=b(()=>n?ia(parseInt(n,10)):-1),[l,o]=b(!1),[d,c]=b([]),[m,h]=b([]),[g,f]=b([]),[v,N]=b(!1),w=k([]),[_,C]=b(),{orgs:P,setOrgs:z,loggedInUser:S}=y(xa),I=i>-1?P.find(e=>e.org_id===i):null,T=i>-1||I,{handleOnDeleteUnregisteredUser:O}=ds();x(()=>{if(!T)return;const e=e=>e.map(e=>({id:e.user_id,email:e.user_email,role_id:e.role_id,user_opinion:e.user_opinion,fname:e.user_fname,lname:e.user_lname,joinedOn:e.joined_on}));(async()=>{N("Fetching Team Members");try{const t=await ka().get(`org-member/${i}`),a=t.orgMembers.filter(e=>da(e.is_active)),r=e(a),n=t.unregisteredUsers.map(e=>({role_id:e.role_id,email:e.email,id:e.invited_users_id})),s=t.orgMembers.filter(e=>!da(e.is_active));c(r),o(!0),h(n),f(e(s)),w.current=structuredClone(r)}finally{N(!1)}})()},[T,i]);const A=T?I?.org_name:`${S?.fname}'s ${Lt.account_type_txt.singular} ${P.length>=1?P.length+1:""}`;return e(Sn,{className:"pb-5 sm:px-0 px-5 pt-5",children:t(Sn,{layout:"horizontal",children:[e("span",{className:"md:flex-1 flex-none"}),t(Sn,{className:"flex-4 max-w-4xl pr-5 sm:pl-0 pl-2 overflow-visible",children:[e(Hn,{className:"text-center pl-5 gap-1",children:t("span",{className:"inline-flex items-center gap-2",children:[T?`Editing "${I?.org_name}" ${Lt.account_type_txt.singular}`:`Create new ${Lt.account_type_txt.singular}`,T&&I?.active_purchased_plan?e(Ji,{purchasedPlan:I?.active_purchased_plan}):null]})}),e("form",{onSubmit:async e=>{e.preventDefault(),N("Saving...");try{let t=I?.org_id;const a=Ut(e.currentTarget);if(T)await(e=>{const t={},a=I;if(e.org_name!==a?.org_name&&e.org_name&&(t.org_name=e.org_name),e.org_address!==a?.org_address&&e.org_address&&(t.org_address=e.org_address),e.org_state!==a?.org_state&&e.org_state&&(t.org_state=e.org_state),e.org_country!==a?.org_country&&e.org_country&&(t.org_country=e.org_country),e.org_external_id!==a?.org_external_id&&e.org_external_id&&(t.org_external_id=e.org_external_id),!ma(t))return ka().put(`/organization/${I?.org_id}`,t)})(a);else{const e=await(async e=>{const t={org_name:e.org_name,org_address:e.org_address,org_state:e.org_state,org_country:e.org_country,org_external_id:e.org_external_id};return ka().post("/organization",t)})(a);t=parseInt(e.insertedOrgId,10),!1===ua(t)&&(wa({description:`No response received from the ${Lt.account_type_txt.singular.toLocaleLowerCase()} service. Returning to the Manage ${Lt.account_type_txt.singular} page.`}),setTimeout(()=>{r("/infrastructure/manage-infra")},1e3))}const n=e=>{Na({description:`${Lt.account_type_txt.singular} has been ${T?"updated":"created"} successfully.${e?" Team members have also been updated successfully and sent invitation emails.":""}`}),r("/infrastructure/manage-infra")};if(!l)return n(!1);try{const e=w.current,a=e.filter(e=>!d.find(t=>e.email===t.email));if(a&&a.length>0){const e={org_id:t,users:a.map(e=>({user_id:e.id}))};await ka().delete("/org-member",{data:e})}const r=d.filter(t=>{const a=e.find(e=>t.id===e.id);return!!a&&a.role_id!==t.role_id});if(r&&r.length>0){const e={org_id:t,users:r.map(e=>({user_id:e.id,role_id:e.role_id}))};await ka().put("/org-member",e)}const i=d.filter(t=>!e.find(e=>e.email===t.email));if(i&&i.length>0){const e={org_id:t,included_users:i.map(e=>({email:e.email,role_id:e.role_id}))};await ka().post("/org-member/by-emails",e)}n(!0)}finally{s(t||-1)}}finally{N(!1);const e=await ka().get("organization");z(e?.orgs||[])}},children:e(Bn,{className:"w-full pr-1 mt-2 text-sm",leftCls:"w-32 sm:w-36 md:w-40 w-full sm:w-40 text-left sm:text-right pr-0 sm:pr-2 pt-3 sm:pt-7",rightCls:"pt-1 sm:pt-5",rowCls:"flex-col sm:flex-row",child:[t(Ke,{htmlFor:"orgName",className:"font-medium",children:[Lt.account_type_txt.singular," Name * :"]}),e(Or,{id:"orgName",name:"org_name",type:"text",required:!0,className:"w-full",defaultValue:I?.org_name??A,autoFocus:!0}),...Lt.account_type_txt.value===Et.ORG?[e(Ke,{htmlFor:"address",className:"font-medium",children:"Address * :"}),e(Or,{id:"address",name:"org_address",type:"text",required:!0,className:"w-full",defaultValue:I?.org_address??""}),e(Ke,{htmlFor:"state",className:"font-medium",children:"State * :"}),e(Or,{id:"state",name:"org_state",type:"text",required:!0,className:"w-full",defaultValue:I?.org_state??""}),e(Ke,{htmlFor:"country",className:"font-medium",children:"Country * :"}),e(Or,{id:"country",name:"org_country",type:"text",required:!0,className:"w-full",defaultValue:I?.org_country??""})]:[],e(Ke,{htmlFor:"org_external_id",className:"font-medium",children:"External Id (optional) :"}),e(Or,{id:"org_external_id",name:"org_external_id",type:"text",className:"w-full",defaultValue:I?.org_external_id??""}),e(a,{}),t(Sn,{layout:"horizontal",children:[e(Or,{id:"doIncludeUsers",type:"checkbox",className:"w-4",checked:l,onChange:e=>o(e.target.checked)}),t(Ke,{htmlFor:"doIncludeUsers",className:"font-medium mt-2 ml-1",children:["Would you like to invite your team-members in this ",Lt.account_type_txt.singular,"?"]})]}),...l?[e(Ke,{htmlFor:"includeUsers",className:"font-medium",children:"Team Members:"}),e(xs,{teamMembers:d,setTeamMembers:c,inactiveUsers:g})]:[],e(a,{}),t("div",{className:"flex gap-2 pt-2",children:[e(dr,{type:"submit",className:"flex-1 sm:flex-none",loading:!!v,children:v||"Save"}),e(dr,{type:"button",variant:"outline",className:"flex-1 sm:flex-none",onClick:()=>r(-1),children:"Cancel"})]}),e(a,{}),e(a,{}),e(a,{}),e(a,{children:m.length>0&&e(nn,{})}),e(a,{children:m.length>0&&"Unregistered Users:"}),e(a,{children:m.length>0&&t(Sn,{loading:_,children:[t(Yn,{className:"mt-2 leading-normal font-semibold",children:["Following users are unregistered. We have sent them invitation emails; once they accept, they will be part of this"," ",Lt.account_type_txt.singular.toLocaleLowerCase(),"."]}),e("ol",{children:m.map((a,r)=>e("li",{className:"mt-1",children:t("span",{className:"inline-flex group",children:[t("span",{children:[r+1,". ",a.email,", (role:  ",hr.DISPLAY_TEXT(a.role_id),")"]}),e("span",{title:"Delete",children:e(ze,{size:"15px",className:"opacity-40 group-hover:opacity-60 hover:opacity-100 ml-1 mt-0.5 cursor-pointer",onClick:async()=>{try{C(!0),await O(a,i);const e=[...m];e.splice(r,1),h(e)}finally{C(!1)}}})})]})},a.email))})]})})]})})]}),e("span",{className:"md:flex-1 flex-none"})]})})}});var ys=Object.freeze({__proto__:null,default:()=>{const{loading:a,response:r}=pi("/invitation"),n=mr(),i=r?.invites.filter(e=>e.user_opinion!==ca.ACCEPTED),[s,l]=b(-1),{setOrgs:o}=y(xa),d=async(e,t)=>{if(t)try{const a=parseInt(t.org_id,10);l(a);const r={org_id:a,user_opinion:e};await ka().put("/invitation",r);const n=await ka().get("organization");o(n?.orgs||[]),t.user_opinion=ca.ACCEPTED,Na({description:`Invitation for ${t.org_name} ${Lt.account_type_txt.singular} has been ${e===ca.ACCEPTED?"accepted":"rejected"} successfully.`})}finally{l(-1)}};return t(Sn,{layout:"horizontal",children:[e("span",{className:"md:flex-1 flex-none"}),e(Sn,{className:"flex-4 max-w-4xl mt-5",children:t(Sn,{children:[(()=>{if(a)return e("span",{children:e(Sn,{layout:"horizontal",className:"text-center mt-5 justify-center items-center",children:e(va,{})})});if(!i||i.length<=0)return t(Yn,{className:"text-center mt-5",children:["You don't have any invitations from any ",Lt.account_type_txt.singular.toLocaleLowerCase(),"."]});const r=i.filter(e=>da(e.org_user_is_active)).map(a=>[t(Ar,{className:"font-normal",children:[t("span",{className:"font-semibold",children:[a.org_name,","]}),"sent on  ",ta(a.sent_at)]}),t(Sn,{className:"gap-1 justify-end pr-3",layout:"horizontal",children:[t(dr,{onClick:()=>d(ca.ACCEPTED,a),loading:s===parseInt(a.org_id,10),disabled:-1!==s,className:"bg-green-500 hover:bg-green-600",children:[e(X,{})," Accept"]}),t(dr,{variant:"destructive",loading:s===parseInt(a.org_id,10),disabled:-1!==s,onClick:()=>{n.showAlertBox({type:"CONFIRM",text:`Are you sure you want to reject this ${Lt.account_type_txt.singular.toLocaleLowerCase()} request? You can't re-join until an administrator invites you again.`,async onClose(e){"CONFIRM"===e&&d(ca.REJECTED,a)}})},children:[e(J,{})," Reject"]})]})]);return e(Bn,{className:"w-full mt-5 text-sm border-b-1",leftCls:"w-full sm:w-100 text-left sm:text-right pt-3",rightCls:"sm:pt-0 pt-2",rowCls:"flex-col sm:flex-row border-t-1 p-2 hover:bg-muted",child:r.flat()})})(),e("span",{className:"mt-5 text-center",children:e(dr,{className:"mt-5",variant:"link",children:t(Zn,{to:"/infrastructure/manage-infra",children:["View all ",Lt.account_type_txt.plural.toLocaleLowerCase()]})})})]})}),e("span",{className:"md:flex-1 flex-none"})]})}});const Ns=ft("flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md has-[>[data-slot=button-group]]:gap-2",{variants:{orientation:{horizontal:"[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",vertical:"flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"}},defaultVariants:{orientation:"horizontal"}});function ws({className:t,orientation:a,...r}){return e("div",{role:"group","data-slot":"button-group","data-orientation":a,className:jt(Ns({orientation:a}),t),...r})}var _s=Object.freeze({__proto__:null,default:()=>{const{orgs:a,featureFlags:r}=y(xa),n=r.ff_enable_teams&&0===a.length,s=i(),l=u(),o=In(),c=[...r.ff_enable_teams?[{title:Lt.account_type_txt.plural,url:"/infrastructure/manage-infra"},{title:"Invitations",url:"/infrastructure/user-invitations"}]:[],...r.ff_enable_paid_subscription?[{title:"Subscriptions",url:"/infrastructure/manage-subscription"},{title:"Payment History",url:"/infrastructure/payment-history"}]:[]];return t(Sn,{className:"h-screen sm:pt-10 pt-5",children:[t("div",{className:"scroll-m-20 text-xl inline-flex gap-2 px-5 pb-5",children:["/infrastructure"!==s.pathname&&t(dr,{variant:"ghost",onClick:()=>l(-1),children:[e(Ie,{size:20})," Back"]}),e("span",{className:"flex-1"}),e("div",{className:"bg-sidebar-primary text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg",children:e(Lt.logo,{className:"size-4"})}),e("div",{className:"grid text-left leading-tight items-center text-foreground font-semibold tracking-tight",children:Lt.appName}),e("span",{className:"flex-1"}),e(d,n?{to:"/login",children:t(dr,{variant:"ghost",children:[e(ye,{}),"Log out"]})}:{to:"/",children:e(dr,{variant:"ghost",title:"close",children:e(J,{size:20})})})]}),c.some(e=>e.url===s.pathname)&&e(Sn,{doNotAppendFlex1:!0,className:"mx-auto mb-4",children:o?t(sn,{children:[e(on,{asChild:!0,children:t(dr,{variant:"default",children:[e(Y,{}),"Menu"]})}),e(dn,{children:c.map(t=>e(mn,{onClick:()=>l(t.url),children:t.title},t.title))})]}):e(ws,{children:c.map(t=>e(dr,{variant:s.pathname===t.url?"default":"outline",onClick:()=>l(t.url),children:t.title},t.title))})}),e(m,{})]})}});var Cs=Object.freeze({__proto__:null,default:()=>{const{orgs:r,setOrgs:n,featureFlags:i,loggedInUser:s,setActiveOrg:l}=y(xa),o=mr(),[d,c]=b(!1),m=u(),{editOrganization:p}=ds(),h=async()=>{c(!0);try{const e=await ka().get("organization");n(e?.orgs||[])}catch{n([])}finally{c(!1)}};return e(Sn,{children:e("div",{className:"flex-1 flex p-5 sm:px-10 px-4 flex-col sm:w-300 m:w-full w-full mx-auto",children:e(Un,{loading:d,toolbarConfig:{canShowSearchField:!0,searchFieldConfig:{placeholder:`Search by ${Lt.account_type_txt.singular} Name...`,searchField:"org_name"},canShowColumnsBtn:!0,additionalJSX:[e(Zn,{to:"/infrastructure/create-new-org",children:t(dr,{variant:"default",children:[e(Ce,{})," Create new ",Lt.account_type_txt.singular]})})],refreshBtn:{canShow:!0,onClick:h}},data:r,actions:[{id:"actionId1",headerText:"Edit",onClick:e=>{p(e)}},{id:"actionId2",headerText:"Delete",onClick:r=>{const n=r;hr.Is_ADMIN(n.role_id)?o.showAlertBox({type:"CONFIRM",text:`Are you sure you want to delete "${n.org_name}" ${Lt.account_type_txt.singular.toLocaleLowerCase()}?`,async onClose(e){if("CONFIRM"===e){c(!0);try{const e=await ka().delete("organization/"+n.org_id);Na({header:`${Lt.account_type_txt.singular} has been deleted successfully.`,description:e.message}),await h()}finally{c(!1)}}}}):_a({header:"Alert",description:t(a,{children:["You are not allowed to delete the ",e("b",{children:n.org_name})," ",Lt.account_type_txt.singular,"."]})})}},{id:"separate",headerText:"SEPARATOR"},{id:"actionId3",headerText:`Leave this ${Lt.account_type_txt.singular.toLocaleLowerCase()}`,onClick:e=>{const t=e;o.showAlertBox({type:"CONFIRM",text:`Are you sure you want to leave this ${Lt.account_type_txt.singular.toLocaleLowerCase()}? You can't re-join until an administrator invites you again.`,async onClose(e){if("CONFIRM"===e){c(!0);try{const e={org_id:t.org_id,user_opinion:ca.LEFT};await ka().put("invitation",e),Na({header:`You have successfully left this ${Lt.account_type_txt.singular.toLocaleLowerCase()}.`,description:""}),await h()}finally{c(!1)}}}})}},{id:"separate2",headerText:"SEPARATOR"},{id:"actionId4",headerText:"Impersonate",onClick:e=>{l(e),m("/")}}],columns:[...!1===i.ff_enable_paid_subscription?[]:[{id:"active_purchased_plan",headerText:"",enableSorting:!1,enableHiding:!1,type:"string",renderer:(t,a)=>e(Ji,{purchasedPlan:a})}],{id:"org_name",headerText:`${Lt.account_type_txt.singular} Name`,enableSorting:!0,enableHiding:!0},...Lt.account_type_txt.value===Et.ORG?[{id:"org_address",headerText:"Address",enableSorting:!0,enableHiding:!0},{id:"org_state",headerText:"State",enableSorting:!0,enableHiding:!0},{id:"org_country",headerText:"Country",enableSorting:!0,enableHiding:!0}]:[],{id:"role_id",headerText:"Role",enableSorting:!0,enableHiding:!0,type:"string",renderer:(e,t)=>hr.DISPLAY_TEXT(t)},{id:"org_created_by",headerText:"Created By Me?",enableSorting:!1,enableHiding:!0,renderer:(t,a)=>Number(a)===Number(s.id)?e(X,{}):e(J,{})},{id:"updated_at",headerText:"Updated On",enableSorting:!0,enableHiding:!0,type:"date"},{id:"created_at",headerText:"Created On",enableSorting:!0,enableHiding:!0,type:"date"}]})})})}});function ks({className:t,...a}){return e(_t.Root,{"data-slot":"radio-group",className:jt("grid gap-3",t),...a})}function Ps({className:t,...a}){return e(_t.Item,{"data-slot":"radio-group-item",className:jt("border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...a,children:e(_t.Indicator,{"data-slot":"radio-group-indicator",className:"relative flex items-center justify-center",children:e(V,{className:"fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2"})})})}const zs=ft("py-32 relative overflow-hidden",{variants:{size:{small:"py-12",medium:"py-20",large:"py-32"},theme:{minimal:"bg-background",classic:"bg-gradient-to-b from-background to-muted/20"}},defaultVariants:{size:"medium",theme:"minimal"}}),Ss=ft("font-bold mb-4 text-foreground",{variants:{size:{small:"text-3xl lg:text-4xl",medium:"text-4xl lg:text-5xl",large:"text-4xl lg:text-6xl"},theme:{minimal:"",classic:"bg-gradient-to-r from-foreground to-muted-foreground bg-clip-text text-transparent"}},defaultVariants:{size:"medium",theme:"minimal"}}),Is=ft("text-muted-foreground max-w-3xl mx-auto mb-2",{variants:{size:{small:"text-base lg:text-lg",medium:"text-lg lg:text-xl",large:"lg:text-xl"},theme:{minimal:"",classic:""}},defaultVariants:{size:"medium",theme:"minimal"}}),Ts=ft("relative h-full transition-all duration-300 rounded-lg border bg-card text-card-foreground",{variants:{size:{small:"p-4",medium:"p-5",large:"p-6"},theme:{minimal:"hover:bg-muted/30",classic:"hover:shadow-xl backdrop-blur-sm bg-card/50 border-border/50"},highlight:{true:"",false:""}},compoundVariants:[{theme:"classic",highlight:!0,className:"ring-2 ring-primary/20 border-primary/30 bg-gradient-to-b from-primary/5 to-transparent relative overflow-hidden shadow-xl"},{theme:"minimal",highlight:!0,className:"bg-muted/50 border-primary/20"}],defaultVariants:{size:"large",theme:"minimal",highlight:!1}}),Os=ft("flex h-11 w-fit shrink-0 items-center rounded-md p-1 text-lg",{variants:{theme:{minimal:"bg-muted",classic:"bg-muted/50 backdrop-blur-sm border border-border/50 shadow-lg"}},defaultVariants:{theme:"minimal"}}),As=ft("font-medium",{variants:{size:{small:"text-2xl",medium:"text-3xl",large:"text-4xl"},theme:{minimal:"",classic:"font-extrabold bg-gradient-to-r from-foreground to-muted-foreground bg-clip-text text-transparent"}},defaultVariants:{size:"large",theme:"minimal"}}),Fs=ft("w-full transition-all duration-300 hover:cursor-pointer",{variants:{theme:{minimal:"shadow hover:bg-primary/90 h-9 py-2 group bg-primary text-primary-foreground ring-primary before:from-primary-foreground/20 after:from-primary-foreground/10 relative isolate inline-flex w-full items-center justify-center overflow-hidden rounded-md px-3 text-left text-sm font-medium ring-1 before:pointer-events-none before:absolute before:inset-0 before:-z-10 before:rounded-md before:bg-gradient-to-b before:opacity-80 before:transition-opacity before:duration-300 before:ease-[cubic-bezier(0.4,0.36,0,1)] after:pointer-events-none after:absolute after:inset-0 after:-z-10 after:rounded-md after:bg-gradient-to-b after:to-transparent after:mix-blend-overlay",classic:"relative overflow-hidden bg-gradient-to-r from-primary to-primary/80 text-primary-foreground font-semibold py-3 px-6 rounded-lg hover:shadow-xl active:scale-95 border border-primary/20"}},defaultVariants:{theme:"minimal"}}),$s=ft("flex-none h-[1lh]",{variants:{size:{small:"size-3",medium:"size-4",large:"size-4"},theme:{minimal:"text-primary",classic:"text-primary"}},defaultVariants:{size:"large",theme:"minimal"}}),Ds={starter:e(Te,{className:"w-4 h-4"}),pro:e(Ae,{className:"w-4 h-4"}),enterprise:e(Oe,{className:"w-4 h-4"})};function Es({plans:r,title:n="Choose Your Perfect Plan",description:i="Transform your project with our comprehensive pricing options designed for every need.",subtitle:s,onPlanSelect:l,className:o,size:d="medium",theme:c="minimal",showBillingToggle:m=!0,billingToggleLabels:u={monthly:"Monthly",yearly:"Yearly"}}){const[p,h]=b(!1),g=I();function f(e,t){const a=parseFloat(e),r=parseFloat(t);if("custom"===e.toLowerCase()||"custom"===t.toLowerCase()||isNaN(a)||isNaN(r)||0===a)return 0;const n=(12*a-r)/(12*a)*100;return Math.round(n)}const x=r.length?Math.max(...r.map(e=>f(e.monthlyPrice,e.yearlyPrice))):0;return t("section",{className:jt(zs({size:d,theme:c}),o),children:["classic"===c&&t(a,{children:[e("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),e("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-96 h-96 bg-primary/5 rounded-full blur-3xl"}),e("div",{className:"absolute top-1/4 right-1/4 w-64 h-64 bg-secondary/5 rounded-full blur-2xl"})]}),t("div",{className:"container max-w-7xl mx-auto relative",children:[t("div",{className:"text-center mb-12",children:[s&&e("p",{className:"text-sm font-medium text-primary mb-3 tracking-wide uppercase",children:s}),e("h2",{className:jt(Ss({size:d,theme:c})),children:n}),e("p",{className:jt(Is({size:d,theme:c})),children:i}),m&&e("div",{className:jt("flex justify-center mt-8 mx-auto",Os({theme:c})),children:t(ks,{defaultValue:"monthly",className:"h-full grid-cols-2",onValueChange:e=>{h("annually"===e)},children:[t("div",{className:'has-[button[data-state="checked"]]:bg-background h-full rounded-md transition-all',children:[e(Ps,{value:"monthly",id:`${g}-monthly`,className:"peer sr-only"}),e(Ar,{htmlFor:`${g}-monthly`,className:"text-muted-foreground peer-data-[state=checked]:text-primary flex h-full cursor-pointer items-center justify-center px-2 md:px-7 font-semibold transition-all hover:text-foreground",children:u.monthly})]}),t("div",{className:'has-[button[data-state="checked"]]:bg-background h-full rounded-md transition-all',children:[e(Ps,{value:"annually",id:`${g}-annually`,className:"peer sr-only"}),t(Ar,{htmlFor:`${g}-annually`,className:"text-muted-foreground peer-data-[state=checked]:text-primary flex h-full cursor-pointer items-center justify-center gap-1 px-2 md:px-7 font-semibold transition-all hover:text-foreground",children:[u.yearly,x>0&&t("span",{className:"ml-1 rounded bg-primary/10 px-2 py-0.5 text-xs text-primary border border-primary/20 font-medium",children:["Save ",x,"%"]})]})]})]})})]}),e("div",{className:jt("grid gap-6",1===r.length&&"grid-cols-1 max-w-md mx-auto",2===r.length&&"grid-cols-1 md:grid-cols-2 max-w-4xl mx-auto",3===r.length&&"grid-cols-1 md:grid-cols-3",r.length>=4&&"grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"),children:r.map((r,n)=>{return t(Nt.div,{className:"relative group h-full",initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.4,delay:.1*n,ease:"easeOut"},children:[r.badge&&e(rn,{className:jt("absolute -top-3 left-1/2 transform -translate-x-1/2 z-20","classic"===c?"bg-gradient-to-r from-primary to-primary/80 text-primary-foreground border-primary/20 shadow-lg":"bg-primary text-primary-foreground"),children:r.badge}),"classic"===c&&r.highlight&&e("div",{className:"absolute -top-px left-1/2 -translate-x-1/2 w-32 h-px bg-gradient-to-r from-transparent via-primary to-transparent"}),e("div",{className:jt(Ts({size:d,theme:c,highlight:r.highlight})),children:t("div",{className:"flex flex-col h-full",children:[t("div",{className:"flex items-start gap-4 mb-4",children:[t("div",{className:"flex-1",children:[e("h3",{className:jt("text-xl font-bold mb-1","classic"===c?"text-lg":""),children:r.title}),e("p",{className:jt("text-sm text-muted-foreground","classic"===c&&"text-foreground/80"),children:r.description})]}),e("div",{className:jt("w-10 h-10 flex items-center rounded-lg justify-center flex-shrink-0","classic"===c?"bg-primary/10 text-primary border border-primary/20":"bg-muted text-foreground border border-border"),children:(i=r.id,Ds[i]||e(Te,{className:"w-5 h-5"}))})]}),e("div",{className:"mb-6",children:e(wt,{mode:"wait",children:e(Nt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:t("div",p?{className:"flex items-baseline gap-1",children:[t("span",{className:jt(As({size:d,theme:c})),children:[parseFloat(r.yearlyPrice)>=0&&"custom"!==r.yearlyPrice.toLowerCase()&&e(a,{children:r.currency}),r.yearlyPrice]}),e("span",{className:"text-muted-foreground text-sm",children:"/year"}),f(r.monthlyPrice,r.yearlyPrice)>0&&t("span",{className:jt("text-xs ml-2","classic"===c?"text-emerald-500 font-semibold":"text-primary font-medium"),children:[f(r.monthlyPrice,r.yearlyPrice),"% off"]})]}:{className:"flex items-baseline gap-1",children:[t("span",{className:jt(As({size:d,theme:c})),children:[parseFloat(r.monthlyPrice)>=0&&"custom"!==r.monthlyPrice.toLowerCase()&&e(a,{children:r.currency}),r.monthlyPrice]}),e("span",{className:"text-muted-foreground text-sm",children:"/month"})]})},p?"year":"month")})}),e("div",{className:"mb-6",children:t(dr,{onClick:()=>(e=>{l?.(e,p)})(r.id),className:jt(Fs({theme:c}),!r.highlight&&"minimal"===c&&"bg-secondary hover:bg-secondary/80 text-secondary-foreground"),variant:r.highlight?"default":"secondary",children:[r.buttonText,"classic"===c&&r.highlight&&e("div",{className:"absolute inset-0 bg-gradient-to-r from-white/0 via-white/10 to-white/0 translate-x-[-100%] hover:translate-x-[100%] transition-transform duration-700"})]})}),e("div",{className:"flex-1",children:e("ul",{className:"space-y-3",children:r.features.map((a,r)=>t(Nt.li,{className:"flex gap-3 items-start",initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{duration:.3,delay:.05*r},children:[e(X,{className:jt($s({size:d,theme:c}))}),e("span",{className:jt("text-sm","classic"===c?"text-foreground/90":"text-muted-foreground"),children:a.name})]},r))})})]})})]},r.id);var i})})]})]})}var Ls=Object.freeze({__proto__:null,PricingTbl:function(){const a=u(),{subscriptionConfig:r,setSubscriptionConfig:n}=y(xa),{plans:i,faqs:s}=r;return x(()=>{(async()=>{if("plans"in r==!1){const e=await ka().get("/get-subscription-config");n(e)}})()},[n,r]),"plans"in r==!1?e(ya,{}):t("div",{className:"px-5",children:[e(Es,{plans:i,title:"Choose Your Perfect Plan",theme:"classic",description:"Transform your project with our comprehensive pricing options designed for every need.",subtitle:Lt.appName,onPlanSelect:(e,t)=>{a(`/infrastructure/checkout?plan=${e}&billing=${t?"yearly":"monthly"}`)},size:"small",className:"w-full",showBillingToggle:!0,billingToggleLabels:{monthly:"Monthly",yearly:"Yearly"}}),t("div",{className:"m-8 mx-auto max-w-200",children:[e(Hn,{className:"mb-2",children:"Need a custom plan?"}),e("p",{className:"text-muted-foreground",children:"Contact our sales team for tailored solutions that fit your organization's unique needs."}),e(Hn,{className:"mb-2 mt-15 font-medium text-lg",children:"Frequently Asked Questions"}),e("div",{className:"mt-5",children:s.map((t,a)=>e("div",{className:"border-t",children:e(Xn,{title:e("h1",{className:"",children:t.question}),children:e("div",{className:"",children:t.answer})})},a))}),e(Hn,{className:"mb-2 mt-15 font-medium text-lg",children:"Still have questions?"}),t("p",{className:"text-muted-foreground",children:["Reach out to our support team at"," ",e("a",{href:`mailto:${Lt.supportEmail}`,className:"text-primary underline",children:Lt.supportEmail})," ","for personalized assistance."]})]})]})}});function Ms({title:a,description:r,plan:n,triggerButtonText:i,leftPanelImageUrl:s,warningTitle:l,warningText:o,keepButtonText:d,continueButtonText:c,finalTitle:m,finalSubtitle:u,finalWarningText:p,goBackButtonText:h,confirmButtonText:g,onCancel:f,onKeepSubscription:v,onDialogClose:y,className:N}){const[w,_]=b(!1),[C,k]=b(!1),[P,z]=b(!1),[S,I]=b(null),T=()=>{k(!1),_(!1),I(null),z(!1),y?.()};return x(()=>{const e=e=>{C&&"Escape"===e.key&&(e.preventDefault(),T())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[C]),t(Ja,{open:C,onOpenChange:e=>{e?k(!0):T()},children:[e(Za,{asChild:!0,children:e(dr,{variant:"outline",children:i||"Cancel Subscription"})}),t(ar,{className:jt("sm:max-w-[1000px] flex flex-col md:flex-row p-0 overflow-hidden text-foreground w-[95%] md:w-[100%]",s?"":"sm:max-w-[500px]",N),children:[e(ir,{className:"sr-only",children:a}),t(er,{className:"absolute right-4 top-4 z-10 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",onClick:T,children:[e(J,{className:"h-4 w-4"}),e("span",{className:"sr-only",children:"Close"})]}),s&&t("div",{className:"w-full md:w-1/2 min-h-[500px] relative hidden md:block overflow-hidden",children:[e("img",{src:s,alt:"Cancel Subscription",className:"absolute inset-0 w-full h-full object-cover"}),e("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-background/30 to-background/90 dark:block hidden"}),e("div",{className:"absolute inset-0 bg-gradient-to-t from-background/80 via-transparent to-background/20 dark:block hidden"})]}),t("div",{className:jt("py-6 px-4 flex flex-col gap-4",s?"w-full md:w-1/2":"w-full"),children:[t("div",{className:"flex flex-col gap-2 text-center md:text-left",children:[e("h2",{className:"md:text-2xl text-xl font-semibold",children:a}),e("p",{className:"md:text-sm text-xs text-muted-foreground",children:r}),S&&e("div",{className:"p-3 bg-destructive/10 border border-destructive/20 rounded-md",children:e("p",{className:"text-sm text-destructive",children:S})})]}),!w&&t("div",{className:"flex flex-col gap-4 p-4 bg-muted/50 rounded-lg",children:[t("div",{className:"flex items-center justify-between",children:[t("div",{className:"flex flex-col gap-1",children:[t("span",{className:"font-semibold text-lg",children:[n.title," Plan"]}),e("span",{className:"text-sm text-muted-foreground",children:"Current subscription"})]}),e(rn,{variant:"secondary",children:parseFloat(n.monthlyPrice)>=0?`${n.currency}${n.monthlyPrice}/monthly`:`${n.monthlyPrice}/monthly`})]}),e("div",{className:"flex flex-col gap-2",children:n.features.slice(0,4).map((a,r)=>t("div",{className:"flex items-center gap-2",children:[e(Fe,{className:"w-2 h-2 fill-primary text-primary"}),e("span",{className:"text-sm text-muted-foreground",children:a.name})]},r))})]}),!w&&(l||o)&&t("div",{className:"p-4 bg-muted/30 border border-border rounded-lg",children:[l&&e("h3",{className:"font-semibold text-foreground mb-2",children:l}),o&&e("p",{className:"text-sm text-muted-foreground",children:o})]}),t("div",w?{className:"flex flex-col gap-4 mt-auto",children:[t("div",{className:"text-center p-4 bg-muted/50 rounded-lg",children:[e("h3",{className:"font-semibold mb-2 text-foreground",children:m||"Final Confirmation"}),e("p",{className:"text-sm text-muted-foreground mb-2",children:u||"Are you sure you want to cancel your subscription?"}),e("p",{className:"text-sm text-destructive",children:p||"This action cannot be undone and you'll lose access to all premium features."})]}),t("div",{className:"flex flex-col sm:flex-row gap-3",children:[e(dr,{variant:"outline",className:"flex-1",onClick:()=>{_(!1),I(null)},disabled:P,children:h||"Go Back"}),e(dr,{variant:"destructive",className:"flex-1",onClick:async()=>{try{z(!0),I(null),await f(n.id),T()}catch(e){I(e instanceof Error?e.message:"Failed to cancel subscription")}finally{z(!1)}},disabled:P,children:P?"Cancelling...":g||"Yes, Cancel Subscription"})]})]}:{className:"flex flex-col sm:flex-row gap-3 mt-auto",children:[e(dr,{className:"flex-1",onClick:async()=>{try{z(!0),I(null),v&&await v(n.id),T()}catch(e){I(e instanceof Error?e.message:"Failed to keep subscription")}finally{z(!1)}},disabled:P,children:P?"Processing...":d||"Keep My Subscription"}),e(dr,{variant:"destructive",className:"flex-1",onClick:()=>{_(!0),I(null)},disabled:P,children:c||"Continue Cancellation"})]})]})]})]})}const Rs=ft("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-9 px-2 min-w-9",sm:"h-8 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}});function js({className:t,variant:a,size:r,...n}){return e(Ct.Root,{"data-slot":"toggle",className:jt(Rs({variant:a,size:r,className:t})),...n})}const Us=[.4,0,.2,1];function Bs({currentPlan:a,plans:r,onPlanChange:n,className:i,title:s,triggerText:l}){const[o,d]=b(!1),[c,m]=b(void 0),[u,p]=b(!1),h=N(e=>o?`${e.yearlyPrice}`:`${e.monthlyPrice}`,[o]),g=N(e=>{m(t=>t===e?void 0:e)},[]),f=N(e=>{p(e),e||m(void 0)},[]);return t(Ja,{open:u,onOpenChange:f,children:[e(Za,{asChild:!0,children:e(dr,{children:l||"Update Plan"})}),t(ar,{className:jt("gap-3 sm:gap-4 max-h-[95vh] sm:max-h-[90vh] flex flex-col text-foreground","w-[calc(100vw-2rem)] sm:w-full max-w-2xl","p-4 sm:p-6",i),children:[t(rr,{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 sm:gap-4 pb-2 sm:pb-0",children:[e(ir,{className:"text-lg sm:text-xl font-semibold",children:s||"Upgrade Plan"}),t("div",{className:"flex items-center gap-1.5 sm:gap-2 text-sm",children:[e(js,{size:"sm",pressed:!o,onPressedChange:e=>d(!e),className:"px-3 sm:px-4 h-9 sm:h-10 text-xs sm:text-sm",children:"Monthly"}),e(js,{size:"sm",pressed:o,onPressedChange:e=>d(e),className:"px-3 sm:px-4 h-9 sm:h-10 text-xs sm:text-sm",children:"Yearly"})]})]}),e("div",{className:"flex-1 min-h-0 overflow-y-auto overflow-x-hidden -mx-4 sm:-mx-6 px-4 sm:px-6 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:bg-muted [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:border-2 [&::-webkit-scrollbar-thumb]:border-transparent hover:[&::-webkit-scrollbar-thumb]:bg-muted-foreground/20",style:{scrollbarWidth:"thin",scrollbarColor:"hsl(var(--muted)) transparent"},children:0===r.length?e("div",{className:"flex items-center justify-center py-12 text-center",children:e("p",{className:"text-sm text-muted-foreground",children:"No plans available"})}):e(ks,{value:c,onValueChange:g,children:e("div",{className:"space-y-2.5 sm:space-y-3 pb-2 pr-0.5",children:r.map((r,i)=>t(Nt.div,{layout:!0,initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{layout:{duration:.3,ease:Us},opacity:{delay:.05*i,duration:.3,ease:Us},y:{delay:.05*i,duration:.3,ease:Us}},onClick:()=>g(r.id),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),g(r.id))},role:"button",tabIndex:0,"aria-pressed":c===r.id,className:jt("relative rounded-lg sm:rounded-xl border cursor-pointer overflow-hidden transition-all duration-200","touch-manipulation focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",c===r.id?"border-primary bg-gradient-to-br from-muted/60 to-muted/30 shadow-sm":"border-border hover:border-primary/50"),children:[e(Nt.div,{layout:"position",className:"p-3 sm:p-4",children:t("div",{className:"flex items-start justify-between gap-2 sm:gap-3",children:[t("div",{className:"flex gap-2 sm:gap-3 min-w-0 flex-1",children:[e(Ps,{value:r.id,id:r.id,className:"flex-shrink-0 pointer-events-none mt-0.5 sm:mt-1"}),t("div",{className:"min-w-0 flex-1",children:[t("div",{className:"flex items-center gap-1.5 sm:gap-2 flex-wrap",children:[e(Ar,{htmlFor:r.id,className:"font-semibold sm:font-medium text-sm sm:text-base cursor-pointer leading-tight",children:r.title}),r.badge&&e(rn,{variant:"secondary",className:"flex-shrink-0 text-[10px] sm:text-xs px-1.5 sm:px-2 py-0 sm:py-0.5 h-5 sm:h-auto",children:r.badge})]}),e("p",{className:"text-[11px] sm:text-xs text-muted-foreground mt-1 leading-relaxed",children:r.description}),r.features.length>0&&e("div",{className:"pt-2 sm:pt-3",children:e("div",{className:"flex flex-wrap gap-1.5 sm:gap-2",children:r.features.map((a,r)=>t("div",{className:"flex items-center gap-1.5 sm:gap-2 px-2 py-1 rounded-md sm:rounded-lg bg-muted/20 border border-border/30 flex-shrink-0",children:[e("div",{className:"w-1 h-1 sm:w-1.5 sm:h-1.5 rounded-full bg-primary flex-shrink-0"}),e("span",{className:"text-[10px] sm:text-xs text-muted-foreground whitespace-nowrap leading-none",children:a.name})]},r))})})]})]}),t("div",{className:"text-right flex-shrink-0 min-w-[60px] sm:min-w-[80px]",children:[e("div",{className:"text-base sm:text-xl font-bold sm:font-semibold leading-tight",children:parseFloat(h(r))>=0?`${r.currency}${h(r)}`:h(r)}),t("div",{className:"text-[10px] sm:text-xs text-muted-foreground mt-0.5",children:["/",o?"year":"month"]})]})]})}),e(wt,{initial:!1,children:c===r.id&&e(Nt.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1,transition:{height:{duration:.3,ease:Us},opacity:{duration:.25,delay:.05,ease:Us}}},exit:{height:0,opacity:0,transition:{height:{duration:.25,ease:Us},opacity:{duration:.15,ease:Us}}},className:"overflow-hidden",children:e(Nt.div,{initial:{y:-8},animate:{y:0,transition:{duration:.25,delay:.05,ease:Us}},exit:{y:-8},className:"px-3 sm:px-4 pb-3 sm:pb-4",children:e(dr,{className:"w-full h-10 sm:h-11 text-sm sm:text-base font-medium touch-manipulation",disabled:c===a.id,onClick:e=>{e.stopPropagation(),n(r.id,o),f(!1)},children:c===a.id?"Current Plan":"Upgrade"})})})})]},r.id))})})})]})]})}function Vs({className:a,currentPlan:r,cancelSubscription:n,updatePlan:i,canShowUpdatePlanBtn:s,addMoreBtnProps:l,canShowCancelPlanBtn:o}){return e("div",{className:jt("text-left w-full",a),children:t(Cr,{className:"",children:[t(kr,{className:"pb-4 sm:pb-6 px-4 sm:px-6",children:[t(Pr,{className:"flex items-center gap-2 sm:gap-3 text-lg sm:text-xl",children:[e("div",{className:"p-1.5 sm:p-2 rounded-lg bg-primary/10 ring-1 ring-primary/20",children:e(ve,{className:"h-4 w-4 sm:h-5 sm:w-5 text-primary"})}),"Current Subscription"]}),e(zr,{className:"text-sm sm:text-base",children:"Manage your billing and subscription settings"})]}),t(Ir,{className:"space-y-6 sm:space-y-8 px-4 sm:px-6",children:[e("div",{className:"relative p-3 sm:p-4 rounded-xl bg-gradient-to-r from-muted/30 via-muted/20 to-muted/30 border border-border/50 overflow-hidden",children:e("div",{className:"relative",children:e("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 sm:gap-0",children:t("div",{className:"w-full",children:[t("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-3 mb-2",children:[e("div",{className:"flex items-center gap-2",children:t("h3",{className:"text-lg sm:text-xl font-semibold",children:[r.plan.title," Plan"]})}),t("div",{className:"flex flex-wrap items-center gap-2",children:[e(rn,{variant:"active"===r.status?"default":"outline",className:"shadow-sm text-xs sm:text-sm bg-primary/90 hover:bg-primary border-0 font-medium",children:"monthly"===r.type?`${r.plan.currency}${r.plan.monthlyPrice}/month`:"yearly"===r.type?`${r.plan.currency}${r.plan.yearlyPrice}/year`:`${r.price}`}),e(rn,{variant:"outline",className:"shadow-sm text-xs sm:text-sm border-border/60 bg-background/50 backdrop-blur-sm",children:r.status})]})]}),e("div",{className:"relative",children:e("p",{className:"text-xs sm:text-sm text-muted-foreground relative z-10",children:r.plan.description})})]})})})}),e(nn,{className:"my-4 sm:my-6 bg-gradient-to-r from-transparent via-border to-transparent"}),t("div",{className:"space-y-3 sm:space-y-4",children:[t("h4",{className:"font-medium flex items-center gap-2 text-base sm:text-lg",children:[e("div",{className:"p-1 sm:p-1.5 rounded-md bg-muted ring-1 ring-border/50",children:e($e,{className:"h-3 w-3 sm:h-4 sm:w-4"})}),"Billing Information"]}),t("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-6",children:[t("div",{className:"group p-2.5 sm:p-3 rounded-lg md:bg-gradient-to-tl bg-gradient-to-b from-muted to-background/10 border border-border/30 hover:border-border/60 transition-all duration-200",children:[e("span",{className:"text-xs sm:text-sm text-muted-foreground block mb-1",children:"Start Date"}),e("div",{className:"font-medium text-sm sm:text-base group-hover:text-primary transition-colors duration-200",children:r.startDate})]}),t("div",{className:"group p-2.5 sm:p-3 rounded-lg md:bg-gradient-to-tl bg-gradient-to-b from-muted to-background/10 border border-border/30 hover:border-border/60 transition-all duration-200",children:[e("span",{className:"text-xs sm:text-sm text-muted-foreground block mb-1",children:"Plan Expiry Date"}),e("div",{className:"font-medium text-sm sm:text-base group-hover:text-primary transition-colors duration-200",children:r.expiryDate})]})]}),t("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-6",children:[t("div",{className:"group p-2.5 sm:p-3 rounded-lg md:bg-gradient-to-tl bg-gradient-to-b from-muted to-background/10 border border-border/30 hover:border-border/60 transition-all duration-200",children:[e("span",{className:"text-xs sm:text-sm text-muted-foreground block mb-1",children:"Active Plan for"}),t("div",{className:"font-medium text-sm sm:text-base group-hover:text-primary transition-colors duration-200",children:[r.activePlanFor," users"]})]}),t("div",{className:"group p-2.5 sm:p-3 rounded-lg md:bg-gradient-to-tr bg-gradient-to-b from-muted to-background/10 border border-border/30 hover:border-border/60 transition-all duration-200",children:[e("span",{className:"text-xs sm:text-sm text-muted-foreground block mb-1",children:"Total Paid Amount"}),e("div",{className:"font-medium text-sm sm:text-base group-hover:text-primary transition-colors duration-200",children:r.paidAmount})]})]}),t("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-6",children:[t("div",{className:"group p-2.5 sm:p-3 rounded-lg md:bg-gradient-to-tr bg-gradient-to-b from-muted to-background/10 border border-border/30 hover:border-border/60 transition-all duration-200",children:[e("span",{className:"text-xs sm:text-sm text-muted-foreground block mb-1",children:"Payment method"}),e("div",{className:"font-medium text-sm sm:text-base group-hover:text-primary transition-colors duration-200",children:r.paymentMethod})]}),t("div",{className:"group p-2.5 sm:p-3 rounded-lg md:bg-gradient-to-tr bg-gradient-to-b from-muted to-background/10 border border-border/30 hover:border-border/60 transition-all duration-200",children:[e("span",{className:"text-xs sm:text-sm text-muted-foreground block mb-1",children:"Order Id"}),e("div",{className:"font-medium text-sm sm:text-base group-hover:text-primary transition-colors duration-200",children:r.transactionId||"N/A"})]})]})]}),e(nn,{className:"my-4 sm:my-6 bg-gradient-to-r from-transparent via-border to-transparent"}),t("div",{className:"flex flex-col sm:flex-row gap-3",children:[s&&e(Bs,{className:"mx-0 shadow-lg hover:shadow-xl transition-all duration-200",...i}),l&&l.canShow&&e(dr,{...l.buttonProps,children:l.text}),o&&e(Ms,{className:"mx-0 shadow-lg hover:shadow-xl transition-all duration-200",...n}),e(Zn,{to:"/plans",children:t(dr,{variant:"outline",children:["Buy Upcoming Plan ",e(De,{})]})})]}),t("div",{className:"pt-4 sm:pt-6",children:[e("h4",{className:"font-medium mb-3 sm:mb-4 text-base sm:text-lg",children:"Current Plan Features"}),e("div",{className:"flex flex-wrap gap-2 sm:gap-3",children:r.plan.features.map((a,r)=>t("div",{className:"group flex items-center gap-2 p-2 sm:p-2 rounded-lg border border-border/80 hover:border-primary/30 hover:bg-primary/5 transition-all duration-200",children:[e("div",{className:"w-1 h-1 sm:w-1.5 sm:h-1.5 rounded-full bg-primary flex-shrink-0 group-hover:bg-primary group-hover:scale-125 transition-all duration-200"}),e("span",{className:"text-xs sm:text-sm text-muted-foreground group-hover:text-foreground transition-colors duration-200",children:a.name})]},r))})]})]})]})})}const Hs=({upcomingPlans:r,Icon:n,title:i,badgeText:s,isFreePlan:l=!1})=>{const{subscriptionConfig:o,orgs:d,featureFlags:c}=y(xa),{plans:m}=o;return t(Cr,{className:"mt-5",children:[e(kr,{children:t(Pr,{className:"flex items-center gap-2 sm:gap-3 text-lg sm:text-xl",children:[e("div",{className:"p-1.5 sm:p-2 rounded-lg bg-primary/10 ring-1 ring-primary/20",children:e(n,{className:"h-4 w-4 sm:h-5 sm:w-5 text-primary"})}),i]})}),e(Ir,{children:e("div",{className:"flex flex-wrap gap-2 sm:gap-3",children:r.length?r.map(r=>{const n=m.find(e=>e.id===r.plan_id);return e("div",{className:"w-full relative p-3 sm:p-4 rounded-xl bg-gradient-to-r from-muted/30 via-muted/20 to-muted/30 border border-border/50 overflow-hidden",children:e("div",{className:"relative",children:e("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 sm:gap-0",children:t("div",{className:"w-full",children:[t("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-3 mb-2",children:[e("div",{className:"flex items-center gap-2",children:t("h3",{className:"text-lg sm:text-xl font-semibold",children:[n?.title," Plan"]})}),t("div",{className:"flex flex-wrap items-center gap-2",children:[t(rn,{variant:"active"===r.status?"default":"outline",className:"shadow-sm text-xs sm:text-sm bg-primary/90 hover:bg-primary border-0 font-medium text-primary-foreground",children:[Sa(r.z_currency),r.amount]}),e(rn,{variant:"outline",className:"shadow-sm text-xs sm:text-sm border-border/60 bg-background/50 backdrop-blur-sm",children:s})]})]}),l?e(a,{children:t("div",{className:"mt-5",children:[e(Zn,{to:"/plans",children:e(ii,{children:"Upgrade to premium"})}),c.ff_enable_teams&&0===d.length&&e(Zn,{to:"/infrastructure/create-new-org",children:t(dr,{className:"ml-2",variant:"outline",children:[e(Ee,{})," Continue with Free Plan"]})})]})}):e("div",{className:"relative",children:t("span",{className:"text-xs sm:text-sm text-muted-foreground relative z-10",children:[t("p",{children:[r.for_no_users," Users for ",r.for_months," Months"]}),t("p",{children:["Start Date: ",ta(r.startAt)]}),t("p",{children:["End Date: ",ta(r.endAt)]}),t("p",{children:["Order Id: ",r.z_order_id]})]})})]})})})},r.z_order_id)}):t("p",{className:"text-center text-muted-foreground",children:["No ",s," Plans"]})})})]},"upcoming-plans")},Ys=T(function({title:a="Congratulations!",subtitle:r="Your payment was successful.",currencySymbol:n="$",price:i,productName:s,proceedButtonText:l="Proceed",backButtonText:o="Back",onProceed:d,onBack:c,className:m,open:u,onOpenChange:p},h){const g=void 0!==u,[f,v]=b(!1),y=g?u:f,N=e=>{g?p?.(e):v(e)};z(h,()=>({open:()=>N(!0),close:()=>N(!1)}),[g,p]);const[w,_]=b(!1);x(()=>{if(y){_(!0);const e=setTimeout(()=>_(!1),2200);return()=>clearTimeout(e)}_(!1)},[y]);const k=C(()=>{const e=[],t=["--primary","--accent","--secondary"];for(let a=0;a<42;a++){const r=100*Math.random(),n=24*(Math.random()-.5);e.push({id:a,x:r,xEnd:Math.max(0,Math.min(100,r+n)),delay:.4*Math.random(),rotation:360*Math.random(),size:6+Math.round(6*Math.random()),colorVar:t[a%t.length]})}return e},[]);return e(Ja,{open:y,onOpenChange:N,children:e(ar,{className:jt("w-[95%] sm:max-w-[560px] p-0 overflow-hidden text-foreground",m),children:t("div",{className:"relative",children:[t("div",{className:"p-7 flex flex-col items-center text-center gap-5",children:[t("div",{className:"relative",children:[e(Nt.div,{className:"absolute inset-0 -z-10 mx-auto size-20 rounded-full blur-xl",style:{background:"var(--primary)",opacity:.12},initial:{scale:.9,opacity:0},animate:{scale:1,opacity:.12},transition:{duration:.5,ease:"easeOut"}}),t("div",{className:"relative",children:[e("div",{className:"size-16 rounded-full bg-primary/10 flex items-center justify-center border border-primary/30 shadow-sm",children:e(Le,{className:"size-10 text-primary"})}),e(Nt.span,{className:"absolute inset-0 rounded-full border-2 border-primary/30",initial:{scale:.9,opacity:.5},animate:{scale:1.25,opacity:0},transition:{duration:1.2,repeat:1/0,ease:"easeOut"}}),e(Nt.span,{className:"absolute inset-0 rounded-full border-2 border-accent/30",initial:{scale:.9,opacity:.5},animate:{scale:1.6,opacity:0},transition:{duration:1.6,repeat:1/0,ease:"easeOut",delay:.2}})]})]}),e(rr,{className:"text-center",children:e(ir,{className:"text-2xl font-semibold",children:a})}),e("p",{className:"text-sm text-muted-foreground max-w-[38ch]",children:r}),t("div",{className:"flex flex-col items-center gap-1",children:[t(Nt.div,{className:"text-4xl font-semibold tracking-tight",initial:{y:6,opacity:0},animate:{y:0,opacity:1},transition:{type:"spring",stiffness:280,damping:22},children:[n,i]}),t("div",{className:"text-xs text-muted-foreground",children:["Paid for ",s]})]}),t(nr,{className:"w-full flex-col sm:flex-col gap-3 mt-1",children:[e(dr,{variant:"outline",className:"w-full",onClick:()=>{c?.(),N(!1)},children:o}),e(dr,{className:"w-full",onClick:()=>{d?.(),N(!1)},children:l})]})]}),e(wt,{children:w&&e(Nt.div,{className:"pointer-events-none absolute inset-0",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:k.map(t=>e(Nt.span,{className:"absolute block rounded-[2px]",style:{left:`${t.x}%`,top:"-16px",width:t.size,height:.6*t.size,backgroundColor:`var(${t.colorVar})`},initial:{y:-20,rotate:t.rotation},animate:{y:360+80*Math.random(),x:`${t.xEnd}%`,rotate:t.rotation+720},transition:{duration:1.8+.8*Math.random(),delay:t.delay,ease:"easeOut"}},t.id))})})]})})})}),qs=({isOpen:r,setIsOpen:n,purchasePlanId:i})=>{const{purchasePlans:s,subscriptionConfig:l,loggedInUser:o}=y(xa),{plans:d,CURRENCY_SYMBOL:c,CURRENCY:m}=l,[p,h]=b(1),[g,f]=P(),{Razorpay:x}=kt(),{loadPurchasedPlans:v}=Aa(),N=u(),[w,_]=b(!1),k=C(()=>s.find(e=>e.purchased_id===i),[s,i]),z=C(()=>d.find(e=>e.id===k?.plan_id),[d,k]),S=C(()=>{if(!k||!z)return 0;return(12===k.for_months?parseFloat(z.yearlyPrice):parseFloat(z.monthlyPrice))*p},[k,z,p]);return k&&z?t(cr,{open:r,setIsOpen:n,disableOutsideClick:!0,header:`Add More Users in ${z.title}`,actionsJSX:t(a,{children:[e(dr,{variant:"outline",onClick:()=>{h(1),n(!1)},children:"Cancel"}),e(dr,{onClick:()=>{n(!1),f(async()=>{try{await new Promise(e=>setTimeout(e,200));const e=await ka().post("payment-gateway/add-more-users-order",{purchased_id:i,currency:m,for_no_users:p});await Ta(S,m,e,{name:`${o.fname} ${o.lname}`,email:o.email,contact:o.mobNo?.toString()||""},x),n(!0),_(!0)}catch(e){n(!0),wa({header:"Failed to add users.",description:"Please try again later or contact support if the issue persists."})}finally{v()}})},disabled:p<1,loading:g,children:"Make Payment"})]}),children:[t("div",{className:"space-y-4 pt-4",children:[t("div",{className:"text-sm text-muted-foreground",children:[t("p",{children:[e("span",{className:"font-medium",children:"Order ID:"})," ",k.z_order_id]}),t("p",{children:[e("span",{className:"font-medium",children:"Current Users:"})," ",k.for_no_users]}),t("p",{children:[e("span",{className:"font-medium",children:"Plan Duration:"})," ",12===k.for_months?"Yearly":"Monthly"]})]}),t("div",{className:"space-y-2",children:[e(Ar,{htmlFor:"numberOfUsers",children:"Number of Users to Add"}),e(Or,{id:"numberOfUsers",type:"number",min:"1",value:p,onChange:e=>h(Math.max(1,parseInt(e.target.value)||1)),placeholder:"Enter number of users"})]}),t("div",{className:"rounded-lg bg-muted p-4 space-y-2",children:[t("div",{className:"flex justify-between items-center",children:[e("span",{className:"text-sm font-medium",children:"Price per user:"}),t("span",{className:"text-sm",children:[c,12===k.for_months?z.yearlyPrice:z.monthlyPrice]})]}),t("div",{className:"flex justify-between items-center",children:[e("span",{className:"text-sm font-medium",children:"Number of users:"}),e("span",{className:"text-sm",children:p})]}),e("div",{className:"border-t pt-2 mt-2",children:t("div",{className:"flex justify-between items-center",children:[e("span",{className:"font-semibold",children:"Total Amount:"}),t("span",{className:"text-lg font-bold text-primary",children:[c,S.toFixed(2)]})]})})]})]}),e(Ys,{open:w,onOpenChange:e=>{_(e),e||N("/infrastructure/payment-history")},price:S.toFixed(2),currencySymbol:c,productName:z.title,proceedButtonText:"Go to Dashboard",backButtonText:"Go to Payment History",onProceed:()=>N("/"),onBack:()=>N("/infrastructure/payment-history")})]}):(wa({header:"Failed to load plan details.",description:"Please try again later or contact support if the issue persists."}),null)};var Ks=Object.freeze({__proto__:null,default:()=>{const r=u(),{activePlan:n,purchasePlans:i,subscriptionConfig:s}=y(xa),{plans:l,CURRENCY_SYMBOL:o}=s,[d,c]=b(!1),m=l.find(e=>e.id===n?.plan_id)||l[0],p=C(()=>i.filter(e=>"paid"===e.status&&new Date(e.startAt)>new Date).reverse(),[i]),h=C(()=>i.filter(e=>"paid"===e.status&&new Date(e.endAt)<new Date),[i]),g=!n||Ia(n);return e(Sn,{children:t("div",{className:"pb-5 sm:pl-20 px-2 w-200 mx-auto",children:[g?e(Hs,{upcomingPlans:[n],Icon:ve,title:"Current Subscription",badgeText:"Active",isFreePlan:!0}):t(a,{children:[e(Vs,{currentPlan:{plan:m,type:12===n.for_months?"yearly":"monthly",startDate:ta(n.startAt),expiryDate:ta(n.endAt),paymentMethod:(f=n.z_payment_method,"netbanking"===f?"Net Banking":"wallet"===f?"Wallet":"upi"===f?"UPI":"card"===f?"Card":f),activePlanFor:n.for_no_users,paidAmount:`${o}${n.amount}`,status:"active",transactionId:(()=>{const e=[n.z_order_id];return n.updatedRecords&&n.updatedRecords.forEach(t=>{"paid"===t.status&&e.push(t.z_order_id)}),e.join(", ")})()},canShowCancelPlanBtn:!1,cancelSubscription:{title:"Cancel Subscription",description:"Are you sure you want to cancel your subscription?",plan:m,onCancel:e=>console.log("Subscription cancelled for plan:",e),onKeepSubscription:e=>console.log("Subscription kept for plan:",e)},addMoreBtnProps:{text:"Add more users to your plan",buttonProps:{onClick:()=>c(!0)},canShow:n.for_no_users<m.maxUserRequired},canShowUpdatePlanBtn:!1,updatePlan:{currentPlan:m,plans:l,triggerText:"Change Plan",onPlanChange:(e,t)=>{r(`/infrastructure/checkout?plan=${e}&billing=${t?"yearly":"monthly"}`)}}}),e(qs,{isOpen:d,setIsOpen:c,purchasePlanId:n.purchased_id})]}),e(Hs,{upcomingPlans:p,Icon:Me,title:"Upcoming Plans",badgeText:"Upcoming"}),e(Hs,{upcomingPlans:h,Icon:Re,title:"Expired Plans",badgeText:"Expired"})]})});var f}});const Gs=ft("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}});function Ws({className:t,variant:a,...r}){return e("div",{"data-slot":"alert",role:"alert",className:jt(Gs({variant:a}),t),...r})}function Xs({className:t,...a}){return e("div",{"data-slot":"alert-title",className:jt("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",t),...a})}function Js({className:t,...a}){return e("div",{"data-slot":"alert-description",className:jt("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",t),...a})}var Zs=Object.freeze({__proto__:null,default:()=>{const{Razorpay:r}=kt(),{loggedInUser:n,subscriptionConfig:i,activePlan:l}=y(xa),[o]=h(),d=o.get("plan"),c=o.get("billing")||"yearly",m=(()=>{const[e,t]=b([]);return x(()=>{(async()=>{const e=Ht("countries");if(e)try{const a=JSON.parse(e);if(Array.isArray(a))return void t(a)}catch{}const a=(await ka().get("get-countries")).countries??[];a.length>0&&Vt("countries",JSON.stringify(a)),t(a)})()},[]),e})(),p=u(),[g,f]=b(!1),[v,N]=b(!1),{plans:w,CURRENCY:_,CURRENCY_SYMBOL:C}=i,P=w.find(e=>e.id===d)||w[0],{minUserRequired:z,maxUserRequired:S}=P,[I,T]=b(c),[O,A]=b(z),F=O<=z?z:O,$="yearly"===I?P.yearlyPrice:P.monthlyPrice,D=F*parseFloat($),E="yearly"===I?12:1,L=P.monthlyPrice,M=E*F*parseFloat(L),R=k({fullName:n?.fname+" "+n?.lname,country:"",address:"",email:n?.email,mobileNo:n?.mobNo?.toString()}),{loadPurchasedPlans:j}=Aa();if("0"===P.monthlyPrice||"0"===P.yearlyPrice)return e(s,{to:"/"});return t(Sn,{className:"pb-5",responsive:!0,children:[t("div",{className:"sm:mx-auto mx-1 px-5",children:[t(Hn,{className:"mb-4",children:['Checkout "',P.title,'" Plan'," ",e(Zn,{className:"text-xs text-primary",to:"/plans",children:"Change Plan"})]}),Ia(l)?null:t(Ws,{variant:"default",className:"mb-5",children:[e(Ue,{}),e(Xs,{children:"You currently have an active paid plan."}),e(Js,{children:t("p",{children:["Please be aware that this purchase is for an upcoming plan. Check your"," ",e(Zn,{className:"text-primary",to:"/infrastructure/manage-subscription",children:"current subscription"}),"."]})})]}),t(Sn,{layout:"horizontal",className:"gap-5",responsive:!0,children:[t(Sn,{layout:"vertical",className:"sm:w-150 w-full gap-5",doNotAppendFlex1:!0,responsive:!0,children:[t(Cr,{children:[t(kr,{children:[e(Pr,{children:"Specify billing period and team size"}),e(zr,{children:"With yearly plans, you can save up to 17%."})]}),e(Ir,{children:t("div",{className:"grid gap-6",children:[t("div",{className:"grid gap-2",children:[e(Ar,{children:"Billing period *"}),e(si,{triggerClassName:"w-full",placeholder:"Select billing period",items:[{value:"monthly",label:`Monthly - ${P.planDisplayCost?.monthly}`},{value:"yearly",label:`Yearly - ${P.planDisplayCost?.yearly}`}],value:I,onValueChange:e=>T(e)})]}),z>1?t("div",{className:"grid gap-2",children:[t(Ar,{htmlFor:"teamSize",children:["Team Size (This should be ",z," or > ",z,") *"]}),e(Or,{type:"number",id:"teamSize",placeholder:"",min:z,max:S,value:O,onChange:e=>A(Math.max(z,parseInt(e.target.value)||z))})]}):e(a,{})]})})]}),t(Cr,{children:[t(kr,{children:[e(Pr,{children:"Billing Details"}),e(zr,{children:"To finalize your subscription, kindly complete your details."})]}),e(Ir,{children:t("div",{className:"grid gap-6",children:[t("div",{className:"grid gap-2",children:[e(Ar,{htmlFor:"fullName",children:"Full Name *"}),e(Or,{onChange:e=>R.current.fullName=e.currentTarget.value,id:"fullName",type:"text",placeholder:"",name:"fullName",defaultValue:n?.fname+" "+n?.lname})]}),t("div",{className:"grid gap-2",children:[e(Ar,{htmlFor:"country",children:"Country *"}),e(si,{valueField:"countryCode",labelField:"countryName",triggerClassName:"w-full",placeholder:"",items:m,onValueChange:e=>{R.current.country=e}})]}),t("div",{className:"grid gap-2",children:[e(Ar,{htmlFor:"address",children:"Address *"}),e(Nn,{onChange:e=>R.current.address=e.target.value,id:"address",placeholder:""})]}),t("div",{className:"grid gap-2",children:[e(Ar,{htmlFor:"email",children:"Email *"}),e(Or,{defaultValue:n?.email,onChange:e=>R.current.email=e.target.value,id:"email",type:"email",placeholder:"",name:"email"})]}),t("div",{className:"grid gap-2",children:[e(Ar,{htmlFor:"mobileNo",children:"Mobile No *"}),e(Or,{onChange:e=>R.current.mobileNo=e.target.value,id:"mobileNo",type:"number",placeholder:"",name:"mobileNo",defaultValue:n?.mobNo})]})]})})]})]}),t(Sn,{layout:"vertical",className:"sm:w-80 w-full",doNotAppendFlex1:!0,responsive:!0,children:[t(Cr,{children:[e(kr,{children:e(Pr,{children:"Summary"})}),e(Ir,{children:t("div",{className:"space-y-2",children:[t("div",{className:"flex items-center justify-between text-sm",children:[e("span",{className:"text-muted-foreground",children:"Subtotal"}),t("span",{className:"tabular-nums",children:[C,M.toFixed(2)]})]}),t("div",{className:"flex items-center justify-between text-sm",children:[e("span",{className:"text-muted-foreground",children:"Discount (Yearly)"}),t("span",{className:"tabular-nums",children:["- ",C,(M-D).toFixed(2)]})]}),t("div",{className:"flex items-center justify-between border-t pt-2",children:[e("span",{className:"font-medium",children:"Total"}),t("span",{className:"text-xl font-semibold tabular-nums",children:[C,D.toFixed(2)]})]})]})})]}),t(dr,{className:"mt-5",onClick:async()=>{const e=(()=>{const e={},t=R.current;return t.fullName.trim()||(e.fullName="Full Name is required."),t.country.trim()||(e.country="Country is required."),t.address.trim()?t.address.trim().length<5&&(e.address="Address must be at least 5 characters."):e.address="Address is required.",t.email.trim()?Jt(t.email)||(e.email="Email is invalid."):e.email="Email is required.",t.mobileNo?.toString().trim()?(!/^\d+$/.test(t.mobileNo?.toString())||t.mobileNo?.toString().trim().length<10||t.mobileNo?.toString().trim().length>15)&&(e.mobileNo="Mobile Number is invalid (must be 10-15 digits)."):e.mobileNo="Mobile Number is required.",e})();if(Object.keys(e).length>0)Object.values(e).reverse().forEach(e=>wa({header:"Invalid Billing Details",description:e}));else try{N(!0);const e=await ka().post("payment-gateway/create-order",{planId:P.id,currency:_,billingPeriod:I||"yearly",for_no_users:F,billing_name:R.current.fullName,billing_email:R.current.email,billing_contact_no:R.current.mobileNo,billing_address:R.current.address,billing_country:R.current.country}),t=R.current;await Ta(D,_,e,{name:t.fullName||`${n.fname} ${n.lname}`,email:t.email||n.email,contact:t.mobileNo?.toString()||n.mobNo?.toString()||""},r),f(!0)}catch(e){wa({header:"Payment Failed!",description:e?.message})}finally{await j(),N(!1)}},loading:v,children:["Make Payment ",e(je,{})]})]})]})]}),e(Ys,{open:g,onOpenChange:e=>{f(e),e||p("/infrastructure/payment-history")},price:D.toFixed(2),currencySymbol:C,productName:P.title,proceedButtonText:"Go to Dashboard",backButtonText:"Go to Payment History",onProceed:()=>p("/"),onBack:()=>p("/infrastructure/payment-history")})]})}});function Qs({className:a,title:r="Invoice History",description:n="Your past invoices and payment receipts.",invoices:i,onDownload:s}){if(!i)return null;const l=t=>{switch(t){case"paid":return e(rn,{className:"bg-emerald-600 text-emerald-50 border-emerald-700/40",children:"Paid"});case"refunded":return e(rn,{variant:"secondary",children:"Refunded"});case"idle":return e(rn,{variant:"outline",children:"Open"});case"verified":return e(rn,{variant:"outline",children:"Verified"});case"failed":return e(rn,{variant:"destructive",children:"Failed"})}};return t(Cr,{className:jt("w-full",a),children:[(r||n)&&t(kr,{className:"space-y-1",children:[r&&t(Pr,{className:"text-base font-medium leading-tight truncate flex items-center gap-2 sm:gap-3 text-lg sm:text-xl",children:[e(Be,{className:"h-4 w-4 text-primary"}),r]}),n&&e(zr,{className:"text-sm text-muted-foreground",children:n})]}),e(Ir,{children:t(fr,{children:[e(_r,{className:"sr-only",children:"List of past invoices with dates, amounts, status and download actions"}),e(br,{children:t(yr,{children:[e(Nr,{className:"w-[120px]",children:"Date"}),e(Nr,{className:"text-left",children:"Order ID"}),e(Nr,{children:"Description"}),e(Nr,{className:"text-right",children:"Amount"}),e(Nr,{className:"text-right",children:"Status"}),e(Nr,{className:"text-right",children:"Action"})]})}),t(xr,{children:[0===i.length&&e(yr,{children:e(wr,{colSpan:6,className:"h-24 text-center text-muted-foreground",children:"No invoices yet"})}),i.map(a=>t(yr,{className:"group",children:[e(wr,{className:"text-muted-foreground",children:t("div",{className:"inline-flex items-center gap-2",children:[e(Ve,{className:"h-3.5 w-3.5"}),a.date]})}),e(wr,{className:"text-left",children:a.transactionId}),e(wr,{className:"max-w-[320px]",children:e("div",{className:"truncate",title:a.description||"Invoice",children:a.description||"Invoice"})}),e(wr,{className:"text-right font-medium",children:a.amount}),e(wr,{className:"text-right",children:l(a.status)}),e(wr,{className:"text-right",children:t(dr,{variant:"outline",size:"sm",className:"h-8 text-xs",onClick:()=>a.invoiceUrl?window.open(a.invoiceUrl,"_blank","noopener,noreferrer"):s?.(a.id),"aria-label":`Download invoice ${a.id}`,children:[e(He,{className:"h-3.5 w-3.5"}),"Download"]})})]},a.id))]})]})})]})}var el=Object.freeze({__proto__:null,default:()=>{const{purchasePlans:t,subscriptionConfig:a}=y(xa),{plans:r}=a,n=[];return t.forEach(e=>{const t=r.find(t=>t.id===e.plan_id),a={id:e.z_order_id,date:ta(e.purchased_at),amount:`${Sa(e.z_currency)}${e.old_purchased_amount||e.amount} (${e.z_currency})`,status:e.status,description:`${t?.title} — ${e.for_months} months, ${e.old_purchased_for_no_users||e.for_no_users} users`,transactionId:e.z_order_id};e.updatedRecords&&e.updatedRecords.forEach(t=>{n.push({id:t.z_order_id,date:ta(t.updated_at),amount:`${Sa(t.z_currency)}${t.amount} (${t.z_currency})`,status:t.status,description:`Added ${t.for_no_users} more users, in ${e.z_order_id}`,transactionId:t.z_order_id})}),n.push(a)}),n.sort((e,t)=>new Date(e.date).getTime()-new Date(t.date).getTime()),e(Sn,{children:e("div",{className:"w-full sm:max-w-250 mx-auto",children:e(Qs,{title:"Payment History",description:"Your past payment receipts.",className:"shadow-none border-none",invoices:n.reverse()})})})}});const tl=()=>{const{theme:a,setTheme:r}=fa();return t(Fr,{value:a,onValueChange:e=>{r(e)},children:[e(Dr,{className:"w-[180px]",children:e($r,{placeholder:"Theme"})}),t(Er,{children:[e(Mr,{value:"light",children:"Light"}),e(Mr,{value:"dark",children:"Dark"}),e(Mr,{value:"system",children:"System"})]})]})};var al=Object.freeze({__proto__:null,default:()=>{const{featureFlags:r}=y(xa);return t(Sn,{className:"pr-5 pl-5",children:[t("div",{className:"space-y-3",children:[e(ai,{children:"Email Settings"}),e(ni,{title:"Security emails",description:"Receive emails about your account security.",control:e(Jr,{checked:!0,disabled:!0})})]}),t("div",{className:"space-y-3 mt-4",children:[e(ai,{children:"Theme"}),e(ni,{title:"Specify theme",description:"Choose your preferred theme to enhance your reading experience.",control:e(tl,{})})]}),r?.ff_enable_teams&&t("div",{className:"space-y-3 mt-4",children:[e(ai,{children:t(a,{children:[Lt.account_type_txt.plural," Settings"]})}),e(Zn,{to:"/infrastructure/manage-infra",children:e(ni,{title:`Manage ${Lt.account_type_txt.plural}`,description:`Create and manage ${Lt.account_type_txt.plural}, update ${Lt.account_type_txt.singular} details, and invite members as needed.`,control:e(Ye,{}),labelCls:"cursor-pointer"})}),e(Zn,{to:"/infrastructure/user-invitations",children:e(ni,{title:"Check Invitations",description:`View and respond to ${Lt.account_type_txt.singular} invitations you have received.`,control:e(Ye,{}),labelCls:"cursor-pointer",className:"mt-3"})})]})]})}});export{Xn as AccordionWrapper,ur as AlertDialog,rn as Badge,Qn as BigSquare,dr as Button,Cr as Card,Sr as CardAction,Ir as CardContent,zr as CardDescription,Tr as CardFooter,kr as CardHeader,Pr as CardTitle,Vn as CenterAndMiddle,ui as CopyTextField,Un as DataTable,cr as DialogWrapper,ei as DropdownBtn,ti as DropdownLbl,sn as DropdownMenu,un as DropdownMenuCheckboxItem,dn as DropdownMenuContent,cn as DropdownMenuGroup,mn as DropdownMenuItem,gn as DropdownMenuLabel,ln as DropdownMenuPortal,pn as DropdownMenuRadioGroup,hn as DropdownMenuRadioItem,fn as DropdownMenuSeparator,bn as DropdownMenuShortcut,xn as DropdownMenuSub,yn as DropdownMenuSubContent,vn as DropdownMenuSubTrigger,on as DropdownMenuTrigger,Sn as FlexColsLayout,ya as FullPageLoading,ai as HeaderText,ca as INVITATION_ENUMS,ri as InfoButton,Or as Input,Ar as Label,Zn as LinkWrapper,ni as ListPanel,va as LoadingCmp,zn as LoadingMask,Rn as PaginationWrapper,ii as PremiumHighlighter,oi as RichTextEditor,Fr as Select,Er as SelectContent,Mr as SelectItem,Lr as SelectLabel,si as SelectListWrapper,Rr as SelectSeparator,Dr as SelectTrigger,$r as SelectValue,nn as Separator,Br as Sheet,qr as SheetContent,Wr as SheetDescription,Kr as SheetHeader,Gr as SheetTitle,Vr as SheetTrigger,pr as SideKickClient,xa as SideKickContext,Xr as Skeleton,Jr as Switch,fr as Table,xr as TableBody,_r as TableCaption,wr as TableCell,vr as TableFooter,Nr as TableHead,br as TableHeader,yr as TableRow,wn as Tabs,Pn as TabsContent,Cn as TabsList,kn as TabsTrigger,mi as TabsWrapper,Bn as TabularLayout,Nn as Textarea,Tn as Toolbar,Qr as Tooltip,tn as TooltipContent,Zr as TooltipProvider,en as TooltipTrigger,li as TooltipWrapper,Hn as TypographyHeading,Yn as TypographyP,ci as UrlChangesGuard,jt as cn,ea as convertServerDateToJS,Kt as createIndexedArray,ha as debounce,Gt as defaultAlertConfig,Xt as errorLogger,qt as findNavMenu,aa as formatElapsedTime,ta as formatISODateWithTime24H,na as generatePublicId,la as generateRandom4Digits,ka as getAxiosInstance,Sa as getCurrencySymbol,Ut as getFormDataByFormEl,Ht as getLocalStorage,pa as getModuleNameFromUrl,Jt as isEmailValid,oa as isFunction,ma as isObjectEmpty,Yt as isSameNavItem,da as isTruthyValue,ua as isValidId,sa as mapIncrementBy2,Zt as processEmailsWithValidation,Rt as setAccountType,Mt as setAppInfo,Vt as setLocalStorage,Dt as setNavigationItems,wa as showErrorToast,Na as showSuccessToast,_a as showWarningToast,ia as undoPublicId,gr as updateRolesEnum,mr as useAlertDialog,pi as useFetchData,In as useIsMobile,Wt as validatePassword,Qt as waitTill};
1
+ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import{Toaster as r,toast as n}from"sonner";import{useLocation as i,Navigate as s,createBrowserRouter as l,RouterProvider as o,NavLink as d,useBlocker as c,Outlet as m,useNavigate as u,useParams as p,useSearchParams as h}from"react-router";import*as g from"react";import f,{useState as b,useEffect as x,createContext as v,useContext as y,useCallback as N,lazy as w,Suspense as _,useMemo as C,useRef as k,useTransition as P,useImperativeHandle as z,Fragment as S,useId as I,forwardRef as T}from"react";import{clsx as O}from"clsx";import{twMerge as A}from"tailwind-merge";import{SquarePen as F,Bookmark as $,BookOpen as D,Settings2 as E,NotebookText as L,Loader2Icon as M,XIcon as R,ChevronDownIcon as j,CheckIcon as U,ChevronUpIcon as B,CircleIcon as V,ChevronRightIcon as H,Menu as Y,ChevronDown as q,RefreshCcw as K,ChevronLeftIcon as G,MoreHorizontalIcon as W,Check as X,X as J,ArrowUpDown as Z,MoreHorizontal as Q,InfoIcon as ee,Crown as te,Bold as ae,Italic as re,Underline as ne,Link as ie,List as se,Quote as le,Sparkles as oe,Heading1 as de,Heading2 as ce,ListOrdered as me,Copy as ue,PanelLeftIcon as pe,ChevronRight as he,ChevronsUpDown as ge,CircleUserRound as fe,Sparkle as be,BadgeCheck as xe,CreditCard as ve,LogOut as ye,Users2 as Ne,UserRoundPlus as we,Pen as _e,Plus as Ce,FolderKanban as ke,Pencil as Pe,Trash as ze,Files as Se,ArrowLeft as Ie,Package as Te,Building2 as Oe,Award as Ae,Circle as Fe,Calendar as $e,MoveUpRight as De,LogIn as Ee,CheckCircle2 as Le,GalleryVerticalEnd as Me,History as Re,ArrowRight as je,AlertCircleIcon as Ue,ReceiptText as Be,CalendarDays as Ve,Download as He,SquareArrowOutUpRight as Ye}from"lucide-react";import*as qe from"@radix-ui/react-label";import{Label as Ke}from"@radix-ui/react-label";import*as Ge from"@radix-ui/react-select";import*as We from"@radix-ui/react-dialog";import*as Xe from"@radix-ui/react-switch";import*as Je from"@radix-ui/react-tooltip";import*as Ze from"@radix-ui/react-separator";import{useEditor as Qe,mergeAttributes as et,BubbleMenu as tt,FloatingMenu as at,EditorContent as rt}from"@tiptap/react";import nt from"@tiptap/starter-kit";import it from"@tiptap/extension-underline";import st from"@tiptap/extension-link";import lt from"@tiptap/extension-placeholder";import ot from"@tiptap/extension-bubble-menu";import dt from"@tiptap/extension-floating-menu";import*as ct from"@radix-ui/react-dropdown-menu";import*as mt from"@radix-ui/react-tabs";import{TabsContent as ut}from"@radix-ui/react-tabs";import{Turnstile as pt}from"@marsidev/react-turnstile";import*as ht from"@radix-ui/react-collapsible";import{Slot as gt}from"@radix-ui/react-slot";import{cva as ft}from"class-variance-authority";import*as bt from"@radix-ui/react-avatar";import*as xt from"@radix-ui/react-accordion";import{OTPInput as vt,OTPInputContext as yt}from"input-otp";import{motion as Nt,AnimatePresence as wt}from"motion/react";import*as _t from"@radix-ui/react-radio-group";import*as Ct from"@radix-ui/react-toggle";import{useRazorpay as kt}from"react-razorpay";import{useReactTable as Pt,getPaginationRowModel as zt,getFilteredRowModel as St,getSortedRowModel as It,getCoreRowModel as Tt,flexRender as Ot}from"@tanstack/react-table";import At from"axios";const Ft={navMain:[{title:"Your Work",items:[{title:"Sample",icon:F,url:"sample-documents"},{title:"Sample Saved",icon:$,url:"sample-saved-documents"}]},{title:"Settings",items:[{title:"Documentation",icon:D,items:[{title:"Sample Get Started",url:"sample-doc-get-started"},{title:"Sample Tutorials",url:"sample-tutorials"}]},{title:"Settings",icon:E,items:[{title:"Sample General",url:"sample-general-settings"},{title:"Sample Active Plan",url:"sample-active-plan-setting"}]}]}],virtualChildOf:[]},$t=(e,t,a)=>{e.forEach(e=>{const{items:r,...n}=e;n.parent=a,t.push(n),r&&$t(r,t,n)})},Dt=(e,t)=>{Ft.navMain=e,Ft.virtualChildOf=t||[]},Et={TEAM:"team",ORG:"org"},Lt={appId:"gamma_tech",appName:"Gamma Tech",appDescription:"Gamma Tech is a software company that provides a range of services to help businesses grow and succeed.",logo:L,version:"2.0.1",account_type_txt:{singular:"Team",plural:"Teams",value:Et.TEAM},supportEmail:"support@gammatech.com",cloudFareKey:"",razorPayKey:"",themeColor:"#00c950",serverUrl:"http://192.168.31.71:6001",homepageUrl:""},Mt=e=>{Object.assign(Lt,e)},Rt=e=>{Object.assign(Et,e)};function jt(...e){return A(O(e))}const Ut=e=>{const t=new FormData(e);return Object.fromEntries(t.entries())},Bt=e=>`${Lt.appId}_${e}`,Vt=(e,t)=>{localStorage.setItem(Bt(e),t)},Ht=e=>localStorage.getItem(Bt(e)),Yt=(e,t)=>{if(!e)return!1;if(t===e)return!0;return!!Ft.virtualChildOf.find(a=>a.id===e&&a.parentId===t)},qt=e=>{const t=(()=>{const e=[],t=Ft.navMain;return $t(t,e,void 0),e})(),a=t.find(t=>t.url===e);if(a)return a;const r=Ft.virtualChildOf.find(t=>t.id===e);return r?t.find(e=>e.url===r.parentId):void 0},Kt=e=>Array.from({length:e},(e,t)=>t),Gt={open:!1,type:"CONFIRM",text:""},Wt=e=>{const t=/[A-Z]/.test(e),a=/[a-z]/.test(e),r=/[0-9]/.test(e),n=/[!@#$%^&*(),.?":{}|<>]/.test(e);return e.length<8?{valid:!1,message:"Password must be at least 8 characters long."}:t?a?r?n?{valid:!0,message:"Password is valid."}:{valid:!1,message:"Password must contain at least one special character."}:{valid:!1,message:"Password must contain at least one number."}:{valid:!1,message:"Password must contain at least one lowercase letter."}:{valid:!1,message:"Password must contain at least one uppercase letter."}},Xt=e=>{console.error(e)},Jt=e=>{if(!e)return!1;const t=String(e).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);return Array.isArray(t)&&t.length>0},Zt=e=>{if(!e||"string"!=typeof e)return{validEmails:[],invalidEmails:[],totalProcessed:0};const t=e.replace(/\n/g,"").split(",").map(e=>e.trim()).filter(e=>e.length>0),a=[],r=[];return t.forEach(e=>{Jt(e)?a.push(e):r.push(e)}),{validEmails:a,invalidEmails:r,totalProcessed:t.length}},Qt=(e=3e3)=>new Promise(t=>setTimeout(t,e)),ea=e=>new Date(e),ta=(e,t=!0)=>{if(!e)return"";const a=e instanceof Date?e:ea(e),r=String(a.getDate()).padStart(2,"0"),n=String(a.getMonth()+1).padStart(2,"0"),i=a.getFullYear();let s=a.getHours();const l=String(a.getMinutes()).padStart(2,"0");let o="";t&&(o=s>=12?"PM":"AM",s=s%12||12);const d=String(s).padStart(2,"0");return t?`${r}/${n}/${i}, ${d}:${l} ${o}`:`${r}/${n}/${i}, ${d}:${l}`},aa=e=>{const t=(new Date).getTime()-e.getTime(),a=t/36e5,r=t/864e5;return t<3e5?"Just now":a<1?`${Math.floor(t/6e4)} minutes ago`:a<24?`${Math.floor(a)} hours ago`:r<7?`${Math.floor(r)} days ago`:e.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})},ra=729444,na=e=>e*ra,ia=e=>Math.floor(e/ra),sa=(e,t)=>{const a=[];for(let r=0;r<e.length;r+=2){const n=e[r],i=e[r+1];a.push(t(n,i,r))}return a},la=()=>Math.floor(1e3+9e3*Math.random()).toString(),oa=e=>"function"==typeof e,da=e=>1===e||"1"===e||!0===e,ca=Object.freeze({NOT_SAVED:10,INVITED:0,ACCEPTED:1,REJECTED:2,LEFT:3,text:{10:"Not Saved",0:"Invited",1:"Active (Accepted)",2:"Rejected",3:"Left"},getDisplay(e){return this.text[e]}}),ma=e=>e&&0===Object.keys(e).length,ua=e=>parseInt(e,10)>0,pa=e=>e.split("/")[2];function ha(e,t){let a;return function(...r){clearTimeout(a),a=setTimeout(()=>{e.apply(this,r)},t)}}const ga="active-theme",fa=(e=(()=>Ht(ga)||"system")())=>{const[t,a]=b(e);return x(()=>{const e=window.document.documentElement;e.classList.remove("light","dark");let a=t;"system"===t&&(a=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),e.classList.add(a),Vt(ga,a)},[t]),{theme:t,setTheme:a}},ba=({...t})=>{const{theme:a="system"}=fa();return e(r,{theme:a,position:"top-center",style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)","--border-radius":"var(--radius)"},...t})},xa=v({setAlertDlgOptions:()=>{},alertDlgOptions:Gt,orgs:[],setOrgs:()=>{},loggedInUser:null,setLoggedInUser:()=>{},activeOrg:void 0,setActiveOrg:()=>{},purchasePlans:[],setPurchasePlans:()=>{},activePlan:null,setActivePlan:()=>{},subscriptionConfig:{},setSubscriptionConfig:()=>{},featureFlags:{},setFeatureFlags:()=>{}}),va=()=>e(M,{className:"animate-spin"}),ya=()=>t("div",{className:"bg-muted flex min-h-svh flex-col items-center justify-center gap-6",children:[t("h3",{className:"scroll-m-20 text-xl font-semibold tracking-tight text-primary inline-flex gap-2",children:[e("div",{className:"bg-sidebar-primary text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg",children:e(Lt.logo,{className:"size-4"})}),e("div",{className:"grid flex-1 text-left leading-tight items-center text-foreground",children:Lt.appName})]}),t("div",{className:"inline-flex gap-1 ml-5",children:[e(va,{}),"Loading application..."]})]}),Na=({header:e="Success",description:t})=>{n.success(e,{description:t})},wa=({header:e="Error",description:t})=>{n.error(e,{description:t})},_a=({header:e="Warning",description:t})=>{n.warning(e,{description:t})};let Ca=null;const ka=()=>Ca||(Ca=At.create({baseURL:Lt.serverUrl,headers:{api:Ht("apiKey")||"","Content-Type":"application/json"}}),Ca.interceptors.request.use(e=>(e.headers=e.headers||{},e.headers.api=Ht("apiKey")||"",e)),Ca.interceptors.response.use(e=>e.data?.response,e=>{if(!e.response)throw wa({header:e.message||"Network error",description:"Unable to connect with server."}),e;const t=e.response.data;throw wa({header:za(t?.error?.errorMsg)||"Server error",description:za(t.error.solution)||""}),t.error}),Ca),Pa={auth_users_tbl:{user_id:"User Id",user_email:"User Email",user_mobile_no:"User Mobile Number",user_fname:"User's First Name",user_lname:"User's Last Name",user_is_active:"User Is Active"},auth_organization_tbl:{org_id:Lt.account_type_txt.singular+" Id",org_name:Lt.account_type_txt.singular+" Name",org_address:Lt.account_type_txt.singular+" Address",org_state:Lt.account_type_txt.singular+" State",org_country:Lt.account_type_txt.singular+" Country",org_external_id:Lt.account_type_txt.singular+" External ID",org_gst_in:Lt.account_type_txt.singular+" External ID",org_is_deleted:Lt.account_type_txt.singular+" Deleted",org_created_by:Lt.account_type_txt.singular+" Created By"},auth_organization_users_tbl:{org_user_id:Lt.account_type_txt.singular+"User ID",org_id:Lt.account_type_txt.singular+"ID",user_id:"User Id",org_user_role_id:Lt.account_type_txt.singular+"User Role Id",org_user_is_active:Lt.account_type_txt.singular+"User is active",user_opinion:"User Opinion"},auth_invited_users_tbl:{invited_users_id:"Invited Users Id",org_id:Lt.account_type_txt.singular+"Id",email:"Email",invited_user_role_id:"Invited user role Id",invited_by_user_id:"Invited by user Id",is_deleted:"Deleted"}},za=e=>{let t=e;const a=e.matchAll(/(\w+)\.(\w+)/g);for(const e of a){const a=e[0],r=e[1],n=e[2];if(Pa[r]?.[n]){const e=Pa[r][n];t=t.replace(a,e)}}return t=t.replaceAll("key","field"),t},Sa=e=>"INR"===e?"₹":"USD"===e?"$":"EUR"===e?"€":"GBP"===e?"£":"AUD"===e||"CAD"===e?"$":"CHF"===e?"₣":"CNY"===e?"¥":"DKK"===e?"kr":"HKD"===e||"NZD"===e?"$":"SEK"===e?"kr":"SGD"===e?"$":"ZAR"===e?"R":"",Ia=e=>!e||"starter"===e.plan_id,Ta=(e,t,a,r,n)=>new Promise((i,s)=>{const l={key:Lt.razorPayKey,amount:100*e,currency:t,order_id:a.orderId,name:Lt.appName,description:Lt.appDescription,handler:async function(e){try{if(!(await ka().post("payment-gateway/verify-payment",{orderId:a.orderId,razorpayPaymentId:e.razorpay_payment_id,razorpaySignature:e.razorpay_signature})).success)return s("Payment verification failed.");i(!0)}catch(e){wa({header:"Payment failed!",description:e?.message||"Payment verification failed."}),s(e)}},prefill:r,theme:{color:Lt.themeColor},modal:{ondismiss:function(){s(new Error("Payment cancelled!"))}}},o=new n(l);o.on("payment.failed",function(e){wa({header:"Payment Failed!",description:e.error.description||"Payment could not be processed."}),ka().post("payment-gateway/log-failure",{orderId:a.orderId,errorCode:e.error.code,errorDescription:e.error.description,errorReason:e.error.reason,paymentId:e.metadata?.payment_id}).catch(()=>{})}),o.open()}),Oa=e=>("paid"!==e.status||(e.startAt=new Date(e.startAt),e.endAt=new Date(e.endAt),e.old_purchased_amount=Number(e.amount),e.updatedRecords&&e.updatedRecords.forEach(t=>{e.amount=Number(e.amount)+Number(t.amount)})),e),Aa=()=>{const{setPurchasePlans:e,setActivePlan:t,featureFlags:a,activePlan:r,activeOrg:n}=y(xa);return{loadPurchasedPlans:N(async(r=!1)=>{if(!r&&!a.ff_enable_paid_subscription)return;const n=await ka().get("/purchased-plans");n.purchasedPlans.forEach(Oa),e([...n.purchasedPlans||[]].reverse()),t(Oa(n.activePlan))},[e,t,a.ff_enable_paid_subscription]),isActiveOrgFreePlan:N(()=>Ia(n?.active_purchased_plan),[n]),isUserFreePlan:N(()=>Ia(r),[r])}},Fa=({children:t})=>{const[a,r]=b(!0),n=i(),{orgs:l,setOrgs:o,loggedInUser:d,setLoggedInUser:c,setActiveOrg:m,subscriptionConfig:u,setSubscriptionConfig:p,featureFlags:h,setFeatureFlags:g}=y(xa),{loadPurchasedPlans:f}=Aa();return x(()=>{(async()=>{try{await new Promise(e=>setTimeout(e,200));const e=await ka().get("/feature-flags");g(e.featureFlags);const t=await ka().get("/check-session"),a=!!t.sessionInfo?.id;if(c({email:t.user.user_email,id:t.sessionInfo?.id,fname:t.user.user_fname,lname:t.user.user_lname,mobNo:String(t.user.user_mobile_no)}),!0===a&&(e.featureFlags.ff_enable_paid_subscription&&await f(!0),e.featureFlags.ff_enable_teams)){const e=await ka().get("organization"),t=e?.orgs||[];o(t);const a=Ht("activeOrgId");let r=t[0];a&&(r=t.find(e=>String(e.org_id)===a)||r),m(r)}if(e.featureFlags.ff_enable_paid_subscription&&"plans"in u==!1){const e=await ka().get("/get-subscription-config");p(e)}}finally{r(!1)}})()},[]),a?e(ya,{}):d?.id?h.ff_enable_teams&&0===l.length&&!n.pathname.includes("infrastructure")?e(s,{to:h.ff_enable_paid_subscription?"/infrastructure/manage-subscription":"/infrastructure",state:{from:n},replace:!0}):t:e(s,{to:"/login",state:{from:n},replace:!0})},$a=w(()=>Promise.resolve().then(function(){return hi})),Da=w(()=>Promise.resolve().then(function(){return gi})),Ea=w(()=>Promise.resolve().then(function(){return wi})),La=w(()=>Promise.resolve().then(function(){return ms})),Ma=w(()=>Promise.resolve().then(function(){return us})),Ra=w(()=>Promise.resolve().then(function(){return hs})),ja=w(()=>Promise.resolve().then(function(){return gs})),Ua=w(()=>Promise.resolve().then(function(){return vs})),Ba=w(()=>Promise.resolve().then(function(){return ys})),Va=w(()=>Promise.resolve().then(function(){return _s})),Ha=w(()=>Promise.resolve().then(function(){return Cs})),Ya=w(()=>Promise.resolve().then(function(){return Ls}).then(e=>({default:e.PricingTbl}))),qa=w(()=>Promise.resolve().then(function(){return Ks})),Ka=w(()=>Promise.resolve().then(function(){return Zs})),Ga=w(()=>Promise.resolve().then(function(){return el})),Wa=w(()=>Promise.resolve().then(function(){return al}));function Xa({appRoutes:t,publicRoutes:a=[]}){const{featureFlags:r}=y(xa),n=l([{path:"/",element:e(Fa,{children:e(La,{})}),children:[...t,{path:"app/general-settings",Component:Wa},{path:"app/*",element:e(Ma,{canShowHeader:!1})}]},...!1===r.ff_enable_paid_subscription?[]:[{path:"plans",Component:Ya}],...a,{path:"infrastructure",element:e(Fa,{children:e(Va,{})}),children:[...!1===r.ff_enable_teams?[]:[{index:!0,Component:ja},{path:"create-new-org",Component:Ua},{path:"edit-org/:orgId",Component:Ua},{path:"user-invitations",Component:Ba},{path:"manage-infra",Component:Ha}],...!1===r.ff_enable_paid_subscription?[]:[{path:"manage-subscription",Component:qa},{path:"checkout",Component:Ka},{path:"payment-history",Component:Ga}]]},{Component:$a,children:[{path:"login",Component:Da},{path:"forgot-password",Component:Ra},{path:"register",Component:Ea}]},{path:"*",Component:Ma}]);return e(_,{fallback:e(ya,{}),children:e(o,{router:n})})}function Ja({...t}){return e(We.Root,{"data-slot":"dialog",...t})}function Za({...t}){return e(We.Trigger,{"data-slot":"dialog-trigger",...t})}function Qa({...t}){return e(We.Portal,{"data-slot":"dialog-portal",...t})}function er({...t}){return e(We.Close,{"data-slot":"dialog-close",...t})}function tr({className:t,...a}){return e(We.Overlay,{"data-slot":"dialog-overlay",className:jt("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...a})}function ar({className:a,children:r,showCloseButton:n=!0,...i}){return t(Qa,{"data-slot":"dialog-portal",children:[e(tr,{}),t(We.Content,{"data-slot":"dialog-content",className:jt("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",a),...i,children:[r,n&&t(We.Close,{"data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[e(R,{}),e("span",{className:"sr-only",children:"Close"})]})]})]})}function rr({className:t,...a}){return e("div",{"data-slot":"dialog-header",className:jt("flex flex-col gap-2 text-center sm:text-left",t),...a})}function nr({className:t,...a}){return e("div",{"data-slot":"dialog-footer",className:jt("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...a})}function ir({className:t,...a}){return e(We.Title,{"data-slot":"dialog-title",className:jt("text-lg leading-none font-semibold",t),...a})}function sr({className:t,...a}){return e(We.Description,{"data-slot":"dialog-description",className:jt("text-muted-foreground text-sm",t),...a})}const lr=ft("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline",linkNoUnderline:"text-primary underline-offset-4"},size:{default:"h-8 px-4 py-2 has-[>svg]:px-3",sm:"h-7 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-9 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function or({className:t,variant:a,size:r,asChild:n=!1,...i}){return e(n?gt:"button",{"data-slot":"button",className:jt(lr({variant:a,size:r,className:t}),"cursor-pointer"),...i})}function dr({loading:a=!1,children:r,...n}){return t(or,{...n,disabled:a||n.disabled,children:[a&&e(va,{}),r]})}const cr=({open:a,setIsOpen:r,header:n,children:i,actionsJSX:s,disableOutsideClick:l=!1,dlgContentClsName:o})=>e(Ja,{open:a,onOpenChange:e=>r(!0===e),children:t(ar,{"aria-describedby":"dialog-content",onPointerDownOutside:e=>{l&&e.preventDefault()},className:o,children:[e(rr,{children:e(ir,{children:n})}),i,e(nr,{children:s})]})}),mr=()=>{const e=y(xa),t=t=>{e.setAlertDlgOptions({...t,open:!0})};return{showAlertBox:t,closeAlertBox:()=>{e.setAlertDlgOptions({...e.alertDlgOptions,open:!1})},showAlertDlgPromise:async e=>new Promise((a,r)=>{t({...e,async onClose(e){"CONFIRM"===e?a(e):r(e)}})})}},ur=({options:r})=>{const n=mr(),i=()=>{n.closeAlertBox(),r.onClose&&r.onClose("CANCEL")};return e(cr,{open:r.open,setIsOpen:i,header:"ALERT"===r.type?"Alert":"Confirmation",actionsJSX:t(a,{children:[e(dr,{onClick:i,variant:"ghost",children:"Cancel"}),"CONFIRM"===r.type&&e(dr,{onClick:()=>{n.closeAlertBox(),r.onClose&&r.onClose("CONFIRM")},children:"Confirm"})]}),children:e(sr,{className:"mt-3",children:r.text})})};function pr({appRoutes:a,publicRoutes:r}){fa();const[n,i]=b(Gt),[s,l]=b([]),[o,d]=b(),[c,m]=b(),[u,p]=b([]),[h,g]=b(),[f,x]=b({}),[v,y]=b({}),w=N(e=>{e&&(Vt("activeOrgId",String(e.org_id)),m(e))},[m]);return t(xa.Provider,{value:{alertDlgOptions:n,setAlertDlgOptions:i,orgs:s,setOrgs:l,loggedInUser:o||{},setLoggedInUser:d,activeOrg:c,setActiveOrg:w,purchasePlans:u,setPurchasePlans:p,activePlan:h,setActivePlan:g,subscriptionConfig:f,setSubscriptionConfig:x,featureFlags:v,setFeatureFlags:y},children:[e(Xa,{appRoutes:a,publicRoutes:r}),e(ba,{}),e(ur,{options:n})]})}const hr={READ:0,ADMIN:1,WRITE:2,Is_ADMIN:function(e){return e===this.ADMIN},CAN_WRITE:function(e){return e===this.WRITE||e===this.ADMIN},CAN_READ:function(e){return e===this.READ||e===this.WRITE||e===this.ADMIN},DISPLAY_TEXT:function(e){return{[this.READ]:"Read",[this.WRITE]:"Read / Write",[this.ADMIN]:Lt.account_type_txt.singular+" Admin"}[e]||""},IS_VALID_ROLE_ID:function(e){return e===this.READ||e===this.ADMIN||e===this.WRITE},GET_LIST:function(){return[{id:this.READ.toString(),text:this.DISPLAY_TEXT(this.READ)},{id:this.WRITE.toString(),text:this.DISPLAY_TEXT(this.WRITE)},{id:this.ADMIN.toString(),text:this.DISPLAY_TEXT(this.ADMIN)}]}},gr=e=>{Object.assign(hr,e)};function fr({className:t,...a}){return e("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto flex-1",children:e("table",{"data-slot":"table",className:jt("w-full caption-bottom text-sm",t),...a})})}function br({className:t,...a}){return e("thead",{"data-slot":"table-header",className:jt("[&_tr]:border-b",t),...a})}function xr({className:t,...a}){return e("tbody",{"data-slot":"table-body",className:jt("[&_tr:last-child]:border-0",t),...a})}function vr({className:t,...a}){return e("tfoot",{"data-slot":"table-footer",className:jt("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",t),...a})}function yr({className:t,...a}){return e("tr",{"data-slot":"table-row",className:jt("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",t),...a})}function Nr({className:t,...a}){return e("th",{"data-slot":"table-head",className:jt("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...a})}function wr({className:t,...a}){return e("td",{"data-slot":"table-cell",className:jt("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...a})}function _r({className:t,...a}){return e("caption",{"data-slot":"table-caption",className:jt("text-muted-foreground mt-4 text-sm",t),...a})}function Cr({className:t,...a}){return e("div",{"data-slot":"card",className:jt("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",t),...a})}function kr({className:t,...a}){return e("div",{"data-slot":"card-header",className:jt("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",t),...a})}function Pr({className:t,...a}){return e("div",{"data-slot":"card-title",className:jt("leading-none font-semibold",t),...a})}function zr({className:t,...a}){return e("div",{"data-slot":"card-description",className:jt("text-muted-foreground text-sm",t),...a})}function Sr({className:t,...a}){return e("div",{"data-slot":"card-action",className:jt("col-start-2 row-span-2 row-start-1 self-start justify-self-end",t),...a})}function Ir({className:t,...a}){return e("div",{"data-slot":"card-content",className:jt("px-6",t),...a})}function Tr({className:t,...a}){return e("div",{"data-slot":"card-footer",className:jt("flex items-center px-6 [.border-t]:pt-6",t),...a})}function Or({className:t,type:a,...r}){return e("input",{type:a,"data-slot":"input",className:jt("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",t),...r})}function Ar({className:t,...a}){return e(qe.Root,{"data-slot":"label",className:jt("flex items-center gap-2 text-sm leading-none font-medium",t),...a})}function Fr({...t}){return e(Ge.Root,{"data-slot":"select",...t})}function $r({...t}){return e(Ge.Value,{"data-slot":"select-value",...t})}function Dr({className:a,size:r="default",children:n,...i}){return t(Ge.Trigger,{"data-slot":"select-trigger","data-size":r,className:jt("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",a),...i,children:[n,e(Ge.Icon,{asChild:!0,children:e(j,{className:"size-4 opacity-50"})})]})}function Er({className:a,children:r,position:n="popper",...i}){return e(Ge.Portal,{children:t(Ge.Content,{"data-slot":"select-content",className:jt("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md","popper"===n&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",a),position:n,...i,children:[e(jr,{}),e(Ge.Viewport,{className:jt("p-1","popper"===n&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:r}),e(Ur,{})]})})}function Lr({className:t,...a}){return e(Ge.Label,{"data-slot":"select-label",className:jt("text-muted-foreground px-2 py-1.5 text-xs",t),...a})}function Mr({className:a,children:r,...n}){return t(Ge.Item,{"data-slot":"select-item",className:jt("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",a),...n,children:[e("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:e(Ge.ItemIndicator,{children:e(U,{className:"size-4"})})}),e(Ge.ItemText,{children:r})]})}function Rr({className:t,...a}){return e(Ge.Separator,{"data-slot":"select-separator",className:jt("bg-border pointer-events-none -mx-1 my-1 h-px",t),...a})}function jr({className:t,...a}){return e(Ge.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:jt("flex cursor-default items-center justify-center py-1",t),...a,children:e(B,{className:"size-4"})})}function Ur({className:t,...a}){return e(Ge.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:jt("flex cursor-default items-center justify-center py-1",t),...a,children:e(j,{className:"size-4"})})}function Br({...t}){return e(We.Root,{"data-slot":"sheet",...t})}function Vr({...t}){return e(We.Trigger,{"data-slot":"sheet-trigger",...t})}function Hr({...t}){return e(We.Portal,{"data-slot":"sheet-portal",...t})}function Yr({className:t,...a}){return e(We.Overlay,{"data-slot":"sheet-overlay",className:jt("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...a})}function qr({className:a,children:r,side:n="right",...i}){return t(Hr,{children:[e(Yr,{}),t(We.Content,{"data-slot":"sheet-content",className:jt("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500","right"===n&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm","left"===n&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm","top"===n&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b","bottom"===n&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",a),...i,children:[r,t(We.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[e(R,{className:"size-4"}),e("span",{className:"sr-only",children:"Close"})]})]})]})}function Kr({className:t,...a}){return e("div",{"data-slot":"sheet-header",className:jt("flex flex-col gap-1.5 p-4",t),...a})}function Gr({className:t,...a}){return e(We.Title,{"data-slot":"sheet-title",className:jt("text-foreground font-semibold",t),...a})}function Wr({className:t,...a}){return e(We.Description,{"data-slot":"sheet-description",className:jt("text-muted-foreground text-sm",t),...a})}function Xr({className:t,...a}){return e("div",{"data-slot":"skeleton",className:jt("bg-accent animate-pulse rounded-md",t),...a})}function Jr({className:t,...a}){return e(Xe.Root,{"data-slot":"switch",className:jt("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...a,children:e(Xe.Thumb,{"data-slot":"switch-thumb",className:jt("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}function Zr({delayDuration:t=0,...a}){return e(Je.Provider,{"data-slot":"tooltip-provider",delayDuration:t,...a})}function Qr({delayDuration:t,...a}){return e(Zr,{delayDuration:t,children:e(Je.Root,{"data-slot":"tooltip",...a})})}function en({...t}){return e(Je.Trigger,{"data-slot":"tooltip-trigger",...t})}function tn({className:a,sideOffset:r=0,children:n,...i}){return e(Je.Portal,{children:t(Je.Content,{"data-slot":"tooltip-content",sideOffset:r,className:jt("bg-primary text-primary-foreground 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 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",a),...i,children:[n,e(Je.Arrow,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const an=ft("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",success:"border-transparent bg-primary/10 text-primary [a&]:hover:bg-primary/20",failure:"border-transparent bg-destructive/10 text-destructive [a&]:hover:bg-destructive/20"}},defaultVariants:{variant:"default"}});function rn({className:t,variant:a,asChild:r=!1,...n}){return e(r?gt:"span",{"data-slot":"badge",className:jt(an({variant:a}),t),...n})}function nn({className:t,orientation:a="horizontal",decorative:r=!0,...n}){return e(Ze.Root,{"data-slot":"separator",decorative:r,orientation:a,className:jt("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",t),...n})}function sn({...t}){return e(ct.Root,{"data-slot":"dropdown-menu",...t})}function ln({...t}){return e(ct.Portal,{"data-slot":"dropdown-menu-portal",...t})}function on({...t}){return e(ct.Trigger,{"data-slot":"dropdown-menu-trigger",...t})}function dn({className:t,sideOffset:a=4,...r}){return e(ct.Portal,{children:e(ct.Content,{"data-slot":"dropdown-menu-content",sideOffset:a,className:jt("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",t),...r})})}function cn({...t}){return e(ct.Group,{"data-slot":"dropdown-menu-group",...t})}function mn({className:t,inset:a,variant:r="default",...n}){return e(ct.Item,{"data-slot":"dropdown-menu-item","data-inset":a,"data-variant":r,className:jt("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...n})}function un({className:a,children:r,checked:n,...i}){return t(ct.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item",className:jt("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",a),checked:n,...i,children:[e("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:e(ct.ItemIndicator,{children:e(U,{className:"size-4"})})}),r]})}function pn({...t}){return e(ct.RadioGroup,{"data-slot":"dropdown-menu-radio-group",...t})}function hn({className:a,children:r,...n}){return t(ct.RadioItem,{"data-slot":"dropdown-menu-radio-item",className:jt("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",a),...n,children:[e("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:e(ct.ItemIndicator,{children:e(V,{className:"size-2 fill-current"})})}),r]})}function gn({className:t,inset:a,...r}){return e(ct.Label,{"data-slot":"dropdown-menu-label","data-inset":a,className:jt("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",t),...r})}function fn({className:t,...a}){return e(ct.Separator,{"data-slot":"dropdown-menu-separator",className:jt("bg-border -mx-1 my-1 h-px",t),...a})}function bn({className:t,...a}){return e("span",{"data-slot":"dropdown-menu-shortcut",className:jt("text-muted-foreground ml-auto text-xs tracking-widest",t),...a})}function xn({...t}){return e(ct.Sub,{"data-slot":"dropdown-menu-sub",...t})}function vn({className:a,inset:r,children:n,...i}){return t(ct.SubTrigger,{"data-slot":"dropdown-menu-sub-trigger","data-inset":r,className:jt("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8",a),...i,children:[n,e(H,{className:"ml-auto size-4"})]})}function yn({className:t,...a}){return e(ct.SubContent,{"data-slot":"dropdown-menu-sub-content",className:jt("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",t),...a})}function Nn({className:t,...a}){return e("textarea",{"data-slot":"textarea",className:jt("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),...a})}function wn({className:t,orientation:a="horizontal",...r}){return e(mt.Root,{"data-slot":"tabs","data-orientation":a,orientation:a,className:jt("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col",t),...r})}const _n=ft("rounded-lg p-[3px] group-data-[orientation=horizontal]/tabs:h-9 data-[variant=line]:rounded-none group/tabs-list text-muted-foreground inline-flex w-fit items-center justify-center group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function Cn({className:t,variant:a="default",...r}){return e(mt.List,{"data-slot":"tabs-list","data-variant":a,className:jt(_n({variant:a}),t),...r})}function kn({className:t,...a}){return e(mt.Trigger,{"data-slot":"tabs-trigger",className:jt("focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground/60 hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:border-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent","data-[state=active]:bg-background dark:data-[state=active]:text-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 data-[state=active]:text-foreground","after:bg-foreground after:absolute after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100",t),...a})}function Pn({className:t,...a}){return e(mt.Content,{"data-slot":"tabs-content",className:jt("flex-1 outline-none",t),...a})}const zn=()=>t("div",{className:"absolute inset-0 flex items-center justify-center",children:[e(va,{}),"  Loading..."]}),Sn=({className:a,layout:r="vertical",loading:n,doNotAppendFlex1:i=!1,responsive:s=!1,...l})=>{const o="horizontal"===r?!0===s?"sm:flex-row flex-col":"flex-row":"flex-col",d=i?"":"flex-1",c=t=>e("div",{className:`${d} flex ${o} items-stretch overflow-auto ${t||""} ${a}`,...l});if(!n)return c();const m=n?"pointer-events-none opacity-50":"";return t("div",{className:"relative flex-1",children:[n&&e(zn,{}),c(m)]})};function In(){const[e,t]=g.useState(void 0);return g.useEffect(()=>{const e=window.matchMedia("(max-width: 767px)"),a=()=>{t(window.innerWidth<768)};return e.addEventListener("change",a),t(window.innerWidth<768),()=>e.removeEventListener("change",a)},[]),!!e}const Tn=({leftItems:r=[],centerItems:n=[],rightItems:i=[],className:s="",style:l={}})=>{const o=In(),[d,c]=b(!1),m=[...r,...n,...i];return e("div",{className:`flex items-center w-full ${s}`,style:{minHeight:48,...l},children:o?t("div",{className:"flex w-full justify-end items-center",children:[e(dr,{type:"button",onClick:()=>c(!0),children:e(Y,{})}),e(cr,{open:d,setIsOpen:c,header:"Menu",actionsJSX:e(a,{}),disableOutsideClick:!1,children:e("div",{className:"flex flex-col gap-5 mt-2",children:m.map((t,a)=>e("div",{children:t},a))})})]}):t(a,{children:[r.length>0&&e("div",{className:"flex flex-1 items-center gap-2 justify-start px-1",children:r}),n.length>0&&e("div",{className:"flex flex-1 items-center gap-2 justify-center px-1",children:n}),i.length>0&&e("div",{className:"flex flex-1 items-center gap-2 justify-end px-1",children:i})]})})};function On({table:r,canShowSearchField:n=!0,searchFieldConfig:i={},canShowColumnsBtn:s=!1,additionalJSX:l,rawColumns:o,refreshBtn:d={canShow:!1,onClick:()=>{}}}){const c=e=>o.find(t=>t.id===e),m=In();return e(Sn,{className:"px-1 py-2 gap-2",layout:m?"vertical":"horizontal",doNotAppendFlex1:!0,children:e(Tn,{leftItems:[n&&i.searchField?e(Or,{placeholder:i.placeholder,value:r.getColumn(i.searchField)?.getFilterValue()??"",onChange:e=>{const t=r.getColumn(i.searchField);t?.setFilterValue(e.target.value)},className:"max-w-sm"},"searchField"):e(a,{}),d.canShow&&t(dr,{variant:"ghost",onClick:d.onClick,children:[e(K,{})," Refresh"]},"refreshBtn")],rightItems:[s&&t(sn,{children:[e(on,{asChild:!0,children:t(dr,{variant:"ghost",children:["Columns ",e(q,{})]},"columnsBtn")}),e(dn,{align:"end",children:r.getAllColumns().filter(e=>e.getCanHide()&&c(e.id)?.enableHiding).map(t=>e(un,{checked:t.getIsVisible(),onCheckedChange:e=>t.toggleVisibility(!!e),children:c(t.id)?.headerText||""},t.id))})]},"columnsBtnDropDown"),...l]})})}function An({className:t,...a}){return e("nav",{role:"navigation","aria-label":"pagination","data-slot":"pagination",className:jt("mx-auto flex w-full justify-center",t),...a})}function Fn({className:t,...a}){return e("ul",{"data-slot":"pagination-content",className:jt("flex flex-row items-center gap-1",t),...a})}function $n({...t}){return e("li",{"data-slot":"pagination-item",...t})}function Dn({className:t,isActive:a,size:r="icon",...n}){return e("a",{"aria-current":a?"page":void 0,"data-slot":"pagination-link","data-active":a,className:jt(lr({variant:a?"outline":"ghost",size:r}),"cursor-pointer",t),...n})}function En({className:a,...r}){return t(Dn,{"aria-label":"Go to previous page",size:"default",className:jt("gap-1 px-2.5 sm:pl-2.5",a),...r,children:[e(G,{}),e("span",{className:"hidden sm:block",children:"Previous"})]})}function Ln({className:a,...r}){return t(Dn,{"aria-label":"Go to next page",size:"default",className:jt("gap-1 px-2.5 sm:pr-2.5",a),...r,children:[e("span",{className:"hidden sm:block",children:"Next"}),e(H,{})]})}function Mn({className:a,...r}){return t("span",{"aria-hidden":!0,"data-slot":"pagination-ellipsis",className:jt("flex size-9 items-center justify-center",a),...r,children:[e(W,{className:"size-4"}),e("span",{className:"sr-only",children:"More pages"})]})}const Rn=({totalCount:a,activePage:r,pageSize:n,onPageChange:i})=>{const s=C(()=>Math.ceil(a/n),[a,n]),l=e=>{e<0||e>=s||i(e)},o="opacity-50 cursor-not-allowed",d=Kt(s).filter(e=>e<r+3&&e>r-3||0===e||e===s-1);return e(An,{className:"text-secondary-foreground",children:t(Fn,{children:[e($n,{children:e(En,{className:0===r?o:"",onClick:()=>l(r-1)})}),d.map((a,n)=>{let i=null;return n>0&&a-d[n-1]!==1&&(i=e($n,{children:e(Mn,{})})),t(f.Fragment,{children:[i,e($n,{className:r===a?"bg-primary text-primary-foreground rounded-2xl hover:bg-primary":"",children:e(Dn,{onClick:()=>l(a),children:a+1})})]},a)}),e($n,{children:e(Ln,{className:r===s-1?o:"",onClick:()=>l(r+1)})})]})})},jn=({pagination:t,totalCount:a,table:r})=>e("div",{className:"flex items-center justify-end space-x-2 pt-4",children:e(Rn,{totalCount:a,activePage:t.pageIndex,onPageChange:e=>{r.setPageIndex(e)},pageSize:t.pageSize})});var Un=g.memo(function({data:a,columns:r,actions:n,toolbarConfig:i,loading:s=!1,canShowToolbar:l=!0,canShowPagination:o=!0}){const[d,c]=g.useState([]),[m,u]=g.useState([]),[p,h]=g.useState({}),[f,b]=g.useState({}),x=r.map(a=>({accessorKey:a.id,header:({column:r})=>a.enableSorting?t(dr,{variant:"ghost",onClick:()=>r.toggleSorting("asc"===r.getIsSorted()),children:[a.headerText,e(Z,{})]}):e("span",{children:a.headerText}),cell:({row:t})=>{const r=t.getValue(a.id);if(oa(a.renderer))return a.renderer(t,r);let n;return n="boolean"===a.type?r?e(X,{size:20}):e(J,{size:18}):"date"===a.type?ta(r):String(r),e("div",{children:n})}}));n&&n.length>0&&x.unshift({id:"actions",enableHiding:!1,cell:({row:a})=>{const r=a.original;return t(sn,{children:[e(on,{asChild:!0,children:t(dr,{variant:"secondary",className:"h-5 w-8 p-0",children:[e("span",{className:"sr-only",children:"Open menu"}),e(Q,{})]})}),t(dn,{align:"start",children:[e(gn,{children:"Actions"}),n.map(t=>"SEPARATOR"===t.headerText?e(fn,{},t.id):e(mn,{onClick:()=>t.onClick&&t.onClick(r),children:t.headerText},t.id))]})]})}});const[v,y]=g.useState({pageIndex:0,pageSize:100}),N=Pt({data:a,columns:x,onSortingChange:c,onColumnFiltersChange:u,getCoreRowModel:Tt(),getSortedRowModel:It(),getFilteredRowModel:St(),onColumnVisibilityChange:h,onRowSelectionChange:b,...o&&{getPaginationRowModel:zt(),onPaginationChange:y},state:{sorting:d,columnFilters:m,columnVisibility:p,rowSelection:f,pagination:v}}),w=s?"pointer-events-none opacity-50":"";return t(Sn,{className:"w-full",children:[l&&e(On,{table:N,rawColumns:r,canShowSearchField:!0,canShowColumnsBtn:!0,...i,additionalJSX:i?.additionalJSX||[]}),s&&e(zn,{}),e(Sn,{className:`rounded-md border overflow-auto ${w}`,children:t(fr,{children:[e(br,{className:"sticky top-0 bg-sidebar",children:N.getHeaderGroups().map(t=>e(yr,{children:t.headers.map(t=>e(Nr,{children:t.isPlaceholder?null:Ot(t.column.columnDef.header,t.getContext())},t.id))},t.id))}),e(xr,{className:"flex-1",children:N.getRowModel().rows?.length?N.getRowModel().rows.map(t=>e(yr,{"data-state":t.getIsSelected()&&"selected",children:t.getVisibleCells().map(t=>e(wr,{children:Ot(t.column.columnDef.cell,t.getContext())},t.id))},t.id)):e(yr,{children:e(wr,{colSpan:n&&n.length>0?r.length+1:r.length,className:"h-24 text-center",children:"No results."})})})]})}),o&&e(jn,{pagination:v,totalCount:a.length,table:N})]})});const Bn=({child:a,className:r,rowCls:n,leftCls:i,rightCls:s})=>e("div",{className:`w-full ${r||""}`,children:sa(a,(a,r,l)=>t("div",{className:`flex w-full ${n||""}`,children:[e("div",{className:`flex-shrink-0 ${i||""}`,children:a}),e("div",{className:`flex-1 min-w-0 ${s||""}`,children:r})]},l+"tabularLayout"))}),Vn=({className:t="",children:a})=>e("div",{className:`flex-1 flex items-center justify-center ${t}`,children:a});function Hn({className:t,...a}){return e("h4",{className:`scroll-m-20 text-xl font-semibold tracking-tight ${t||""}`,...a})}function Yn({...t}){return e("p",{className:"leading-7 [&:not(:first-child)]:mt-6",...t})}function qn({...t}){return e(xt.Root,{"data-slot":"accordion",...t})}function Kn({className:t,...a}){return e(xt.Item,{"data-slot":"accordion-item",className:jt("border-b last:border-b-0",t),...a})}function Gn({className:a,children:r,...n}){return e(xt.Header,{className:"flex",children:t(xt.Trigger,{"data-slot":"accordion-trigger",className:jt("focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",a),...n,children:[r,e(j,{className:"text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200"})]})})}function Wn({className:t,children:a,...r}){return e(xt.Content,{"data-slot":"accordion-content",className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm",...r,children:e("div",{className:jt("pt-0 pb-4",t),children:a})})}const Xn=({title:a,children:r})=>e(qn,{type:"single",collapsible:!0,children:t(Kn,{value:"item-1",children:[e(Gn,{children:a}),e(Wn,{children:r})]})}),Jn=({...t})=>e("span",{...t}),Zn=({className:t,disabled:a,removeAllStyles:r=!1,...n})=>e(a?Jn:d,{className:(t||"")+" "+(r?"":a?"opacity-40 cursor-not-allowed":"cursor-pointer hover:underline"),...n}),Qn=({children:t,toPath:a,disabled:r,className:n,...i})=>e(Zn,{to:a,disabled:r,className:"h-40 p-5 w-60 border-2 border-primary rounded-4xl font-semibold flex flex-col justify-center hover:bg-accent "+n,...i,children:t}),ei=({label:a,children:r,items:n,onItemSelect:i,disabled:s})=>t(sn,{children:[e(on,{asChild:!0,disabled:s,children:r||t(dr,{className:"flex items-center gap-1",children:[a," ",e(q,{size:15})]})}),e(dn,{children:n.map(t=>e(mn,{onClick:()=>i?.(t),children:t.label},t.value))})]}),ti=({label:a,selectedRec:r,setSelectedRec:n,items:i})=>t(sn,{children:[e(on,{asChild:!0,children:t("div",{className:"flex items-center gap-2",children:[a&&e(Ar,{className:"whitespace-nowrap",children:a}),t("span",{className:"whitespace-nowrap text-primary flex items-center gap-1 text-sm cursor-pointer",children:[r.label," ",e(q,{size:15})]})]})}),e(dn,{children:i.map(t=>e(mn,{onClick:()=>n(t),children:t.label},t.value))})]}),ai=({children:t})=>e("h3",{className:"text-lg font-medium",children:t}),ri=({children:a,side:r})=>t(Qr,{children:[e(en,{asChild:!0,children:e("span",{className:"ml-2 align-middle cursor-pointer",children:e(dr,{variant:"link",className:"-ml-5",type:"button",tabIndex:-1,children:e(ee,{})})})}),e(tn,{side:r,children:a})]}),ni=({title:a,description:r,control:n,labelCls:i="",className:s=""})=>t("div",{className:`flex flex-row items-center justify-between rounded-lg border p-4 shadow-sm ${s}`,children:[t("div",{className:"flex-1 space-y-2",children:[e(Ar,{className:`cursor-pointer ${i}`,children:a}),e(Ar,{className:`font-normal text-gray-500 cursor-pointer ${i}`,children:r})]}),e("div",{children:n})]}),ii=({children:a})=>t("span",{className:`premium-icon-wrapper relative inline-flex items-center ${a?"gap-1":""} px-1.5 py-1.5 rounded-lg bg-gradient-to-br from-amber-400 via-amber-500 to-amber-600 bg-[length:200%_200%] text-xs font-semibold text-white transition-all duration-300 ease-in-out overflow-hidden hover:scale-105 hover:shadow-[0_0_20px_rgba(251,191,36,0.6),0_0_40px_rgba(251,191,36,0.3)] dark:from-amber-900 dark:via-amber-700 dark:to-amber-600 dark:bg-[length:200%_200%]`,children:[e(te,{size:14,className:"premium-crown relative z-10 flex-shrink-0 drop-shadow-[0_2px_4px_rgba(0,0,0,0.2)] text-white",strokeWidth:2.5}),e("span",{className:"relative z-10",children:a})]}),si=({placeholder:a,items:r,value:n,onValueChange:i,triggerClassName:s="w-[180px]",valueField:l="value",labelField:o="label",id:d,...c})=>t(Fr,{value:n,onValueChange:e=>{i?.(e)},children:[e(Dr,{className:s,...c,id:d,children:e($r,{placeholder:a})}),e(Er,{children:r.map(t=>e(Mr,{value:t[l],children:t[o]},t[l]))})]}),li=({content:a,side:r="bottom",rootProps:n,contentProps:i,triggerProps:s,children:l,canShowTooltip:o=!0,delayDuration:d=100,triggerOn:c="default"})=>{const[m,u]=b(()=>"default"===c&&(!!o&&void 0)),p=k(null),h=e=>{"click"===c&&((e=>{const t=e?.target;return t&&p.current&&p.current?.contains(t)})(e)||u(!1))};return t(Qr,{open:m,delayDuration:d,...n,children:[e(en,{"data-testid":"tooltip-trigger",asChild:!0,ref:p,onClick:()=>{"click"===c&&u(o&&!m)},...s,children:l}),e(tn,{side:r,"data-testid":"tooltip-content",onPointerDownOutside:h,onEscapeKeyDown:h,...i,children:a})]})},oi=({value:r,onChange:n,onAICall:i,placeholder:s="Type / for commands or start writing...",className:l="",classNameEditor:o="",minHeight:d="unset",id:c="",enableSlashMenu:m=!1,canShowAIOptions:u=!1,readingMode:p=!1})=>{const h=e=>{if(!g)return;const t=`link-${Math.random().toString(36).slice(2,9)}`;g.chain().focus().insertContent(`<a href="${e}" data-marker="${t}">${e}</a>`).run(),ka().get(`/link-metadata?url=${encodeURIComponent(e)}`).then(a=>{if(!a)return;const{title:r,image:n=`https://www.google.com/s2/favicons?domain=${e}`,description:i}=a,s=r||e;let l=-1,o=0;g.state.doc.descendants((e,a)=>{if(e.isText){if(e.marks.find(e=>"link"===e.type.name&&e.attrs["data-marker"]===t))return l=a,o=e.nodeSize,!1}return!0}),-1!==l&&g.chain().deleteRange({from:l,to:l+o}).insertContent(`<a href="${e}" data-image="${n||""}" data-description="${i||""}">${s}</a>`).run()}).catch(()=>{g.state.doc.descendants((a,r)=>{if(a.isText){if(a.marks.find(e=>"link"===e.type.name&&e.attrs["data-marker"]===t))return g.chain().deleteRange({from:r,to:r+a.nodeSize}).insertContent(`<a href="${e}">${e}</a>`).run(),!1}return!0})})},g=Qe({editable:!p,extensions:[nt.configure({heading:{levels:[1,2,3]}}),it,st.extend({inclusive:!1,addAttributes(){return{...this.parent?.(),"data-marker":{default:null,parseHTML:e=>e.getAttribute("data-marker"),renderHTML:e=>e["data-marker"]?{"data-marker":e["data-marker"]}:{}},"data-image":{default:null,parseHTML:e=>e.getAttribute("data-image"),renderHTML:e=>e["data-image"]?{"data-image":e["data-image"]}:{}},"data-description":{default:null,parseHTML:e=>e.getAttribute("data-description"),renderHTML:e=>e["data-description"]?{"data-description":e["data-description"]}:{}},style:{default:null,parseHTML:e=>e.getAttribute("style"),renderHTML:e=>e.style?{style:e.style}:{}}}},renderHTML({HTMLAttributes:e}){const{"data-image":t,"data-description":a,...r}=e,n=et(this.options.HTMLAttributes,r,{"data-image":t,"data-description":a,title:a||""});return t?["a",n,["img",{src:t,width:"16",height:"16"}],["span",0]]:["a",n,0]}}).configure({openOnClick:!1,autolink:!0,HTMLAttributes:{}}),lt.configure({placeholder:s,emptyEditorClass:"is-editor-empty"}),...m?[ot]:[],dt],content:r,onUpdate:({editor:e})=>{n(e.getHTML())},editorProps:{attributes:{class:jt("prose dark:prose-invert max-w-none focus:outline-none min-h-full","selection:bg-primary/30"),id:c},handlePaste:(e,t)=>{const a=t.clipboardData?.getData("text/plain");return!(!a||!(e=>{try{const t=new URL(e);return"http:"===t.protocol||"https:"===t.protocol}catch{return!1}})(a))&&(h(a),!0)}}});if(x(()=>{g&&r!==g.getHTML()&&g.commands.setContent(r)},[r,g]),x(()=>{g&&g.setEditable(!p)},[g,p]),!g)return null;const[b,v]=f.useState(!1),[y,N]=f.useState(""),w=()=>{const{from:e,to:t}=g.state.selection,a=g.state.doc.textBetween(e,t," "),r=g.getText();i&&i(a,r)},_=()=>{if(""===y)g.chain().focus().extendMarkRange("link").unsetLink().run();else{let e=y;/^https?:\/\//i.test(e)||e.startsWith("/")||e.startsWith("#")||(e="https://"+e);const{empty:t}=g.state.selection;t?h(e):g.chain().focus().extendMarkRange("link").setLink({href:e}).run()}v(!1),N("")},C=()=>{const e=g.getAttributes("link").href;N(e||""),v(!0)};x(()=>{const e=e=>{if((e.ctrlKey||e.metaKey)&&"k"===e.key){if(p)return;e.preventDefault(),C()}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[g]);const k=e=>jt("h-8 w-8 p-0 transition-all duration-200",e?"bg-primary text-primary-foreground hover:bg-primary/90":"hover:bg-accent hover:text-accent-foreground");return e("div",{className:jt("group relative w-full border rounded-md bg-transparent dark:bg-input/30 transition-[color,box-shadow] outline-none shadow-xs","border-input focus-within:border-ring focus-within:ring-ring/50 focus-within:ring-[3px] text-sm",l),style:{minHeight:d},children:t("div",{className:jt("px-3 py-2 h-full",p?"cursor-default":"cursor-text",o),onClick:()=>!p&&g.chain().focus().run(),children:[!p&&e(tt,{editor:g,tippyOptions:{duration:150,animation:"shift-away",onHidden:()=>v(!1)},className:"flex items-center gap-0.5 bg-popover/90 backdrop-blur-md border border-border rounded-lg shadow-xl p-1 overflow-hidden animate-in fade-in zoom-in duration-200",children:b?t("div",{className:"flex items-center gap-1 px-1",onClick:e=>e.stopPropagation(),children:[e(Or,{type:"text",value:y,onChange:e=>N(e.target.value),placeholder:"Paste or type a link...",className:"h-7 w-48 text-xs border-none focus-visible:ring-0 bg-transparent",autoFocus:!0,onKeyDown:e=>{e.stopPropagation(),"Enter"===e.key&&(e.preventDefault(),_()),"Escape"===e.key&&v(!1)}}),e(dr,{type:"button",variant:"ghost",size:"sm",onClick:_,className:"h-7 w-7 p-0",children:e(X,{className:"h-3.5 w-3.5"})}),e(dr,{type:"button",variant:"ghost",size:"sm",onClick:()=>v(!1),className:"h-7 w-7 p-0",children:e(J,{className:"h-3.5 w-3.5"})})]}):t(a,{children:[e(dr,{type:"button",variant:"ghost",size:"sm",onClick:()=>g.chain().focus().toggleBold().run(),className:k(g.isActive("bold")),children:e(ae,{className:"h-4 w-4"})}),e(dr,{type:"button",variant:"ghost",size:"sm",onClick:()=>g.chain().focus().toggleItalic().run(),className:k(g.isActive("italic")),children:e(re,{className:"h-4 w-4"})}),e(dr,{type:"button",variant:"ghost",size:"sm",onClick:()=>g.chain().focus().toggleUnderline().run(),className:k(g.isActive("underline")),children:e(ne,{className:"h-4 w-4"})}),e(dr,{type:"button",variant:"ghost",size:"sm",onClick:C,className:k(g.isActive("link")),children:e(ie,{className:"h-4 w-4"})}),e(nn,{orientation:"vertical",className:"h-4 mx-1"}),e(dr,{type:"button",variant:"ghost",size:"sm",onClick:()=>g.chain().focus().toggleBulletList().run(),className:k(g.isActive("bulletList")),children:e(se,{className:"h-4 w-4"})}),e(dr,{type:"button",variant:"ghost",size:"sm",onClick:()=>{g.chain().focus().deleteRange({from:g.state.selection.from-1,to:g.state.selection.from}).toggleBlockquote().run()},className:k(g.isActive("blockquote")),children:e(le,{className:"h-4 w-4"})}),u&&t(a,{children:[e(nn,{orientation:"vertical",className:"h-4 mx-1"}),t(dr,{type:"button",variant:"ghost",size:"sm",onClick:w,className:"h-8 px-2 flex items-center gap-1.5 text-primary hover:bg-primary/10 transition-colors",children:[e(oe,{className:"h-4 w-4 fill-primary/20 animate-pulse"}),e("span",{className:"text-xs font-semibold",children:"AI Edit"})]})]})]})}),m&&!p&&t(at,{editor:g,tippyOptions:{duration:150,placement:"bottom-start",offset:[0,8]},shouldShow:({state:e})=>{const{selection:t}=e,{$from:a}=t,r=a.nodeBefore?.text||"";return 1===a.parentOffset&&"/"===r},className:"flex flex-col min-w-[180px] bg-popover border border-border rounded-lg shadow-2xl p-1.5 animate-in slide-in-from-top-2 duration-200 z-50",children:[e("div",{className:"px-2 py-1.5 text-[10px] font-bold text-muted-foreground uppercase tracking-wider",children:"Quick Actions"}),e(di,{onClick:()=>{g.chain().focus().deleteRange({from:g.state.selection.from-1,to:g.state.selection.from}).toggleHeading({level:1}).run()},icon:e(de,{className:"h-4 w-4"}),label:"Heading 1",shortcut:"H1"}),e(di,{onClick:()=>{g.chain().focus().deleteRange({from:g.state.selection.from-1,to:g.state.selection.from}).toggleHeading({level:2}).run()},icon:e(ce,{className:"h-4 w-4"}),label:"Heading 2",shortcut:"H2"}),e(di,{onClick:()=>{g.chain().focus().deleteRange({from:g.state.selection.from-1,to:g.state.selection.from}).toggleBulletList().run()},icon:e(se,{className:"h-4 w-4"}),label:"Bullet List",shortcut:"-"}),e(di,{onClick:()=>{g.chain().focus().deleteRange({from:g.state.selection.from-1,to:g.state.selection.from}).toggleOrderedList().run()},icon:e(me,{className:"h-4 w-4"}),label:"Ordered List",shortcut:"1."}),e(di,{onClick:()=>{g.chain().focus().deleteRange({from:g.state.selection.from-1,to:g.state.selection.from}).toggleBlockquote().run()},icon:e(le,{className:"h-4 w-4"}),label:"Quote",shortcut:">"}),e(di,{onClick:()=>{g.chain().focus().deleteRange({from:g.state.selection.from-1,to:g.state.selection.from}).run(),C()},icon:e(ie,{className:"h-4 w-4"}),label:"Hyperlink",shortcut:"K"}),e(nn,{className:"my-1"}),u&&e(di,{onClick:()=>{g.chain().focus().deleteRange({from:g.state.selection.from-1,to:g.state.selection.from}).run(),w()},icon:e(oe,{className:"h-4 w-4 text-primary"}),label:"AI Assistant",className:"text-primary hover:bg-primary/10"})]}),e(rt,{editor:g})]})})},di=({onClick:a,icon:r,label:n,shortcut:i,className:s})=>t("button",{onClick:e=>{e.preventDefault(),e.stopPropagation(),a()},className:jt("flex items-center justify-between w-full px-2 py-1.5 text-sm rounded-md transition-colors","hover:bg-accent hover:text-accent-foreground text-left",s),children:[t("div",{className:"flex items-center gap-2",children:[e("div",{className:"flex items-center justify-center w-6 h-6 rounded-md bg-muted/50",children:r}),e("span",{children:n})]}),i&&e("span",{className:"text-[10px] text-muted-foreground bg-muted px-1.5 py-0.5 rounded uppercase font-medium",children:i})]}),ci=({isDirty:t,setDirty:a})=>{const r=c(t);return x(()=>{const e=e=>{t&&(e.preventDefault(),e.returnValue="")};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[t]),"blocked"===r.state?e(ur,{options:{open:!0,text:"Are you sure you want to leave this page?",type:"CONFIRM",onClose:e=>{"CONFIRM"===e?(r?.proceed(),a(!1)):r?.reset()}}}):null},mi=({tabs:a,variant:r,defaultValue:n})=>t(wn,{defaultValue:n,children:[e(Cn,{variant:r,children:a.map(t=>e(kn,{value:t.value,children:t.title},t.value))}),a.map(t=>e(ut,{value:t.value,children:t.content},t.value))]}),ui=({copyText:a})=>{const[r,n]=b(!1);return t("div",{className:"flex gap-2",children:[e(Nn,{readOnly:!0,value:a}),e(dr,{variant:"outline",size:"icon",onClick:()=>(async e=>{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),2e3),Na({description:"Copied to clipboard"})})(a),className:"shrink-0",children:e("span",{className:"flex items-center",children:r?e(X,{size:16,className:"text-green-500"}):e(ue,{size:16})})})]})},pi=e=>{const[t,a]=b(null),[r,n]=b(!1);return x(()=>{(async()=>{n(!0);try{const t=await ka().get(e);a(t)}finally{n(!1)}})()},[e]),{loading:r,response:t}};var hi=Object.freeze({__proto__:null,default:function(){return e("div",{className:"bg-muted flex min-h-svh flex-col items-center justify-center gap-6 p-6 md:p-10",children:t("div",{className:"flex w-full max-w-sm flex-col gap-6",children:[t("span",{className:"flex items-center gap-2 self-center font-medium",children:[e("div",{className:"bg-primary text-primary-foreground flex size-6 items-center justify-center rounded-md",children:e(Lt.logo,{className:"size-4"})}),Lt.appName]}),t("div",{className:jt("flex flex-col gap-6"),children:[t(Cr,{children:[t(kr,{className:"text-center",children:[e(Pr,{className:"text-xl",children:"Welcome"}),e(zr,{children:"Please fill the below details to continue"})]}),e(Ir,{children:e(m,{})})]}),t("div",{className:"text-muted-foreground *:[a]:hover:text-primary text-center text-xs text-balance *:[a]:underline *:[a]:underline-offset-4",children:["By clicking continue, you agree to our"," ",e("a",{href:Lt.homepageUrl+"/privacy-policy",target:"_blank",children:"Privacy Policy"}),"."]})]})]})})}});var gi=Object.freeze({__proto__:null,default:function(){const a=k(null),r=u(),[n,s]=P(),l=i(),[o,c]=b(""),m=k(null),p=l.state?.from,h=p?`${p.pathname}${p.search}${p.hash}`:"/",g="grid gap-1";return x(()=>{a?.current?.focus()},[]),t("div",{className:"grid gap-6",children:[e("div",{className:"after:border-border relative text-center text-sm after:absolute after:inset-0 after:top-1/2 after:z-0 after:flex after:items-center after:border-t",children:e("span",{className:"bg-card text-muted-foreground relative z-10 px-2",children:"Login"})}),t("form",{onSubmit:async e=>{if(e.preventDefault(),!o)return void wa({header:"Captcha not completed",description:"Please complete the captcha to proceed."});const t=Ut(e.currentTarget),a={username:t.email,password:t.password,turnstileToken:o};!1!==Jt(a.username)?s(async()=>{try{const e=await ka().post("/login",a),{api:t=""}=e;if(!t)return wa({header:"Something went wrong!",description:"API Key not found."}),void Xt("API key not found in login command.");Na({header:"Welcome Back!",description:"Login Successful."}),Vt("apiKey",t),r(h)}catch(e){m.current?.reset(),c(""),Xt(e)}}):wa({header:"Email is not valid.",description:"Kindly recheck the email and try again."})},className:"grid gap-6",children:[t("div",{className:g,children:[e(Ar,{htmlFor:"email",children:"Email *"}),e(Or,{id:"email",type:"email",placeholder:"mail@example.com",name:"email",ref:a,required:!0})]}),t("div",{className:g,children:[e(Ar,{htmlFor:"password",children:"Password *"}),e(Or,{id:"password",type:"password",name:"password",placeholder:"**********",required:!0}),e(d,{to:"/forgot-password",className:"ml-auto text-sm underline-offset-4 hover:underline cursor-pointer",children:"Forgot your password?"})]}),e("div",{className:"text-center",children:e(pt,{ref:m,siteKey:Lt.cloudFareKey,onSuccess:e=>c(e)})}),e(dr,{type:"submit",className:"w-full",size:"lg",loading:n,children:"Login"})]}),t("div",{className:"text-center text-sm",children:["Don't have an account?"," ",e(d,{to:"/register",children:e("span",{className:"underline underline-offset-4",children:"Register"})})]})]})}});const fi=()=>t(ri,{side:"right",children:[e("h5",{children:"Password Policy:"}),t("ul",{children:[e("li",{children:"Password must be at least 8 characters long."}),e("li",{children:"Password must contain at least one uppercase letter."}),e("li",{children:"Password must contain at least one lowercase letter."}),e("li",{children:"Password must contain at least one number."}),e("li",{children:"Password must contain at least one special character."})]})]}),bi=({handleOnOTPSent:a,ref:r,gridCls:n,hidden:i,path:s})=>{const l=k(null),[o,d]=P();z(r,()=>({focus(){l.current?.focus()}}),[]);return t("form",{onSubmit:async e=>{e.preventDefault();const t={email:Ut(e.currentTarget).email||""};d(async()=>{try{await(async(e,t)=>{if(!1===Jt(t.email))throw wa({header:"Email is not valid.",description:"Kindly recheck the email and try again."});try{const a=await ka().post("/send-otp/"+e,t);Na({header:a.message||"OTP has been sent successfully",description:"Kindly enter below details to continue."})}catch(e){throw Xt(e),e}})(s,t),a(t)}catch(e){Xt(e)}})},className:`grid gap-5 ${i&&"hidden"}`,children:[t("div",{className:n,children:[e(Ar,{htmlFor:"email",children:"Email *"}),e(Or,{id:"email",type:"email",name:"email",placeholder:"mail@example.com",ref:l,required:!0})]}),e(dr,{type:"submit",className:"w-full",loading:o,children:"Generate OTP"})]})};function xi({className:t,containerClassName:a,...r}){return e(vt,{"data-slot":"input-otp",containerClassName:jt("flex items-center gap-2 has-disabled:opacity-50",a),className:jt("disabled:cursor-not-allowed",t),...r})}function vi({className:t,...a}){return e("div",{"data-slot":"input-otp-group",className:jt("flex items-center",t),...a})}function yi({index:a,className:r,...n}){const i=g.useContext(yt),{char:s,hasFakeCaret:l,isActive:o}=i?.slots[a]??{};return t("div",{"data-slot":"input-otp-slot","data-active":o,className:jt("data-[active=true]:border-ring data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:ring-destructive/20 dark:data-[active=true]:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[active=true]:aria-invalid:border-destructive dark:bg-input/30 border-input relative flex h-9 w-9 items-center justify-center border-y border-r text-sm shadow-xs transition-all outline-none first:rounded-l-md first:border-l last:rounded-r-md data-[active=true]:z-10 data-[active=true]:ring-[3px]",r),...n,children:[s,l&&e("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:e("div",{className:"animate-caret-blink bg-foreground h-4 w-px duration-1000"})})]})}const Ni=({className:a,inputOTPField:r,otp:n,setOtp:i,onChangeEmailClick:s})=>{const l=function(e=30){const[t,a]=b(e);return x(()=>{if(t>0){const e=setTimeout(()=>a(t-1),1e3);return()=>clearTimeout(e)}},[t]),t}();return t("div",{className:a,children:[e(Ar,{htmlFor:"otp",children:"Enter OTP *"}),e(xi,{maxLength:4,name:"otp",id:"otp",ref:r,value:n,onChange:i,children:t(vi,{children:[e(yi,{index:0}),e(yi,{index:1}),e(yi,{index:2}),e(yi,{index:3})]})}),e("span",{className:"text-xs underline-offset-4 italic",children:l>0?t("span",{className:"muted-foreground",children:["You can resend the OTP in ",l," seconds."]}):e("span",{className:"hover:underline cursor-pointer",onClick:()=>s(),children:"Didn't receive the OTP? Send again."})})]})};var wi=Object.freeze({__proto__:null,default:function(){const a=k(null),r="grid gap-1",n=k(null),[i,s]=b(!1),[l,o]=b(""),[c,m]=b(""),[p,h]=P(),g=u();x(()=>{i?n.current?.focus():a?.current?.focus()},[i]);const f=()=>{s(!1)};return t("div",{className:"grid gap-5",children:[e("div",{className:"after:border-border relative text-center text-sm after:absolute after:inset-0 after:top-1/2 after:z-0 after:flex after:items-center after:border-t",children:e("span",{className:"bg-card text-muted-foreground relative z-10 px-2",children:"User Registration"})}),e(bi,{ref:a,handleOnOTPSent:e=>{s(!0),m(e.email)},gridCls:r,hidden:i,path:"new-registration"}),i&&t("form",{onSubmit:e=>{if(e.preventDefault(),!l)return wa({header:"OTP Required!",description:"Please enter your OTP and try again."}),void n.current?.focus();const t=Ut(e.currentTarget);t.otp=l,t.user_email=c;const a=Wt(t.user_password);!1!==a.valid?h(async()=>{try{await ka().post("user-registration",t),Na({header:`Welcome to ${Lt.appName}`,description:"Registration successful! Please log in to continue."}),g("/login")}catch(e){Xt(e)}}):wa({header:"Password Policy",description:a.message})},className:"grid gap-5",children:[t("div",{className:r,children:[e(Ar,{htmlFor:"emailOTPGenerated",children:"Email *"}),e(Or,{id:"emailOTPGenerated",type:"email",name:"email",placeholder:"mail@example.com",value:c,disabled:!0,required:!0}),e("span",{className:"ml-auto text-xs underline-offset-4 hover:underline cursor-pointer italic",onClick:f,children:"Change Email"})]}),e(Ni,{className:r,inputOTPField:n,otp:l,setOtp:o,onChangeEmailClick:f}),t("div",{className:"flex gap-4",children:[t("div",{className:r+" flex-1",children:[e(Ar,{htmlFor:"firstName",children:"First Name *"}),e(Or,{id:"firstName",name:"user_fname",type:"text",required:!0})]}),t("div",{className:r+" flex-1",children:[e(Ar,{htmlFor:"lastName",children:"Last Name *"}),e(Or,{id:"lastName",name:"user_lname",type:"text",required:!0})]})]}),t("div",{className:r,children:[e(Ar,{htmlFor:"mobile",children:"Mobile No"}),e(Or,{id:"mobile",type:"number",name:"user_mobile_no",placeholder:"98******88"})]}),t("div",{className:r,children:[t(Ar,{htmlFor:"password",children:["Set Password * ",e(fi,{})]}),e(Or,{id:"password",name:"user_password",type:"password",placeholder:"**********",required:!0})]}),e(dr,{type:"submit",className:"w-full",size:"lg",loading:p,children:"Create account"})]}),t("div",{className:"text-center text-sm",children:["Already have an account?"," ",e(d,{to:"/login",children:e("span",{className:"underline underline-offset-4",children:"Login"})})]})]})}});function _i({...t}){return e(ht.Root,{"data-slot":"collapsible",...t})}function Ci({isCollapsible:t,...r}){return t?e(ht.CollapsibleTrigger,{"data-slot":"collapsible-trigger",...r}):e(a,{children:r.children})}function ki({...t}){return e(ht.CollapsibleContent,{"data-slot":"collapsible-content",...t})}const Pi=g.createContext(null);function zi(){const e=g.useContext(Pi);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function Si({defaultOpen:t=!0,open:a,onOpenChange:r,className:n,style:i,children:s,...l}){const o=In(),[d,c]=g.useState(!1),[m,u]=g.useState(t),p=a??m,h=g.useCallback(e=>{const t="function"==typeof e?e(p):e;r?r(t):u(t),document.cookie=`sidebar_state=${t}; path=/; max-age=604800`},[r,p]),f=g.useCallback(()=>o?c(e=>!e):h(e=>!e),[o,h,c]);g.useEffect(()=>{const e=e=>{"l"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),f())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[f]);const b=p?"expanded":"collapsed",x=g.useMemo(()=>({state:b,open:p,setOpen:h,isMobile:o,openMobile:d,setOpenMobile:c,toggleSidebar:f}),[b,p,h,o,d,c,f]);return e(Pi.Provider,{value:x,children:e(Zr,{delayDuration:0,children:e("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":"16rem","--sidebar-width-icon":"3rem",...i},className:jt("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",n),...l,children:s})})})}function Ii({side:a="left",variant:r="sidebar",collapsible:n="offcanvas",className:i,children:s,...l}){const{isMobile:o,state:d,openMobile:c,setOpenMobile:m}=zi();return"none"===n?e("div",{"data-slot":"sidebar",className:jt("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",i),...l,children:s}):o?e(Br,{open:c,onOpenChange:m,...l,children:t(qr,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",style:{"--sidebar-width":"18rem"},side:a,children:[t(Kr,{className:"sr-only",children:[e(Gr,{children:"Sidebar"}),e(Wr,{children:"Displays the mobile sidebar."})]}),e("div",{className:"flex h-full w-full flex-col",children:s})]})}):t("div",{className:"group peer text-sidebar-foreground hidden md:block","data-state":d,"data-collapsible":"collapsed"===d?n:"","data-variant":r,"data-side":a,"data-slot":"sidebar",children:[e("div",{"data-slot":"sidebar-gap",className:jt("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180","floating"===r||"inset"===r?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),e("div",{"data-slot":"sidebar-container",className:jt("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex","left"===a?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]","floating"===r||"inset"===r?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",i),...l,children:e("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",children:s})})]})}function Ti({className:a,onClick:r,...n}){const{toggleSidebar:i}=zi();return t(dr,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon",className:jt("size-7",a),onClick:e=>{r?.(e),i()},...n,children:[e(pe,{}),e("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function Oi({className:t,...a}){const{toggleSidebar:r}=zi();return e("button",{"data-sidebar":"rail","data-slot":"sidebar-rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:r,title:"Toggle Sidebar",className:jt("hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] sm:flex","in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",t),...a})}function Ai({className:t,...a}){return e("main",{"data-slot":"sidebar-inset",className:jt("bg-background relative flex w-full flex-1 flex-col","md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",t),...a})}function Fi({className:t,...a}){return e("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:jt("flex flex-col gap-2 p-2",t),...a})}function $i({className:t,...a}){return e("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:jt("flex flex-col gap-2 p-2",t),...a})}function Di({className:t,...a}){return e("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:jt("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",t),...a})}function Ei({className:t,...a}){return e("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:jt("relative flex w-full min-w-0 flex-col p-2",t),...a})}function Li({className:t,asChild:a=!1,...r}){return e(a?gt:"div",{"data-slot":"sidebar-group-label","data-sidebar":"group-label",className:jt("text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",t),...r})}function Mi({className:t,...a}){return e("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:jt("flex w-full min-w-0 flex-col gap-1",t),...a})}function Ri({className:t,...a}){return e("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:jt("group/menu-item relative",t),...a})}const ji=ft("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function Ui({asChild:a=!1,isExpanded:r=!1,variant:n="default",size:i="default",tooltip:s,className:l,...o}){const d=e(a?gt:"button",{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":i,"data-active":r,className:jt(ji({variant:n,size:i}),l),...o});return s?("string"==typeof s&&(s={children:s}),t(Qr,{children:[e(en,{asChild:!0,children:d}),e(tn,{side:"right",align:"center",...s})]})):d}function Bi({className:t,...a}){return e("ul",{"data-slot":"sidebar-menu-sub","data-sidebar":"menu-sub",className:jt("border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",t),...a})}function Vi({className:t,...a}){return e("li",{"data-slot":"sidebar-menu-sub-item","data-sidebar":"menu-sub-item",className:jt("group/menu-sub-item relative",t),...a})}function Hi({asChild:t=!1,size:a="md",isExpanded:r=!1,className:n,...i}){return e(t?gt:"a",{"data-slot":"sidebar-menu-sub-button","data-sidebar":"menu-sub-button","data-size":a,"data-active":r,className:jt("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-hidden focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground","sm"===a&&"text-xs","md"===a&&"text-sm","group-data-[collapsible=icon]:hidden",n),...i})}function Yi({navItems:r}){const n=i().pathname,s=pa(n),l=e=>`app/${e}`,o="bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground",c=a=>{const r=t(Ui,{tooltip:a.title,className:"cursor-pointer "+(Yt(s,a.url||"")?o:""),children:[a.icon&&e(a.icon,{}),e("span",{children:a.title}),a.items&&e(he,{className:"ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90"})]});return a.url?e(d,{to:l(a.url),className:"w-full",children:r}):r};return e(a,{children:r.map(a=>t(Ei,{children:[e(Li,{children:a.title}),e(Mi,{children:a.items.map(a=>{const r=a.items&&a.items.some(e=>Yt(s,e.url));return e(_i,{asChild:!0,defaultOpen:r,className:"group/collapsible",children:t(Ri,{children:[e(Ci,{isCollapsible:!!a.items,asChild:!0,children:c(a)}),e(ki,{children:e(Bi,{children:a.items?.map(t=>e(Vi,{children:e(Hi,{asChild:!0,className:Yt(s,t.url)?o:"",children:e(d,{to:l(t.url),title:t.title,children:e("span",{children:t.title})})})},t.title))})})]})},a.title)})})]},a.title))})}function qi({className:t,...a}){return e(bt.Root,{"data-slot":"avatar",className:jt("relative flex size-8 shrink-0 overflow-hidden rounded-full",t),...a})}function Ki({className:t,...a}){return e(bt.Image,{"data-slot":"avatar-image",className:jt("aspect-square size-full",t),...a})}function Gi({className:t,...a}){return e(bt.Fallback,{"data-slot":"avatar-fallback",className:jt("bg-muted flex size-full items-center justify-center rounded-full",t),...a})}const Wi=({isDialogOpen:a,setIsDialogOpen:r})=>{const{loggedInUser:n,setLoggedInUser:i}=y(xa),[s,l]=b(!1),[o,d]=b(!1),[c,m]=b(null),[u,p]=b({});x(()=>{a&&h()},[a]);const h=async()=>{l(!0);try{const e={user_id:n.id,user_email:n.email,user_mobile_no:n.mobNo?.toString()||"",user_fname:n.fname||"",user_lname:n.lname||"",user_is_active:!0,created_at:(new Date).toISOString(),updated_at:(new Date).toISOString()};m(e),p(e)}catch(e){console.error("Error fetching user data:",e)}finally{l(!1)}},g=(e,t)=>{p(a=>({...a,[e]:t}))};return e(cr,{open:a,setIsOpen:r,header:"Edit User Profile",disableOutsideClick:!0,actionsJSX:t("div",{className:"flex gap-3",children:[e(dr,{variant:"outline",onClick:()=>{p(c||{}),r(!1)},disabled:o,children:"Cancel"}),e(dr,{onClick:async()=>{d(!0);try{const e={user_mobile_no:u.user_mobile_no,user_fname:u.user_fname,user_lname:u.user_lname};await ka().put(`/user-profile/${u.user_id}`,e),Na({header:"Success",description:"User profile updated successfully"}),m(u),i({...n,mobNo:u.user_mobile_no,fname:u.user_fname,lname:u.user_lname}),r(!1)}catch(e){console.error("Error saving user data:",e)}finally{d(!1)}},loading:o,children:"Save Changes"})]}),children:s?e("div",{className:"flex items-center justify-center py-8",children:t("div",{className:"text-muted-foreground flex items-center gap-1",children:[e(va,{}),"Loading user data..."]})}):t("div",{className:"space-y-4 mt-4",children:[t("div",{className:"space-y-2",children:[e(Ar,{htmlFor:"user_id",children:"User ID"}),e(Or,{id:"user_id",value:u.user_id?na(u.user_id):"",disabled:!0,className:"bg-muted"})]}),t("div",{className:"space-y-2",children:[e(Ar,{htmlFor:"user_email",children:"Email"}),e(Or,{id:"user_email",type:"email",value:u.user_email||"",placeholder:"Enter email address",disabled:!0,className:"bg-muted"})]}),t("div",{className:"space-y-2",children:[e(Ar,{htmlFor:"user_mobile_no",children:"Mobile Number"}),e(Or,{id:"user_mobile_no",type:"number",value:u.user_mobile_no||"",onChange:e=>g("user_mobile_no",e.target.value),placeholder:"Enter mobile number"})]}),t("div",{className:"space-y-2",children:[e(Ar,{htmlFor:"user_fname",children:"First Name"}),e(Or,{id:"user_fname",value:u.user_fname||"",onChange:e=>g("user_fname",e.target.value),placeholder:"Enter first name"})]}),t("div",{className:"space-y-2",children:[e(Ar,{htmlFor:"user_lname",children:"Last Name"}),e(Or,{id:"user_lname",value:u.user_lname||"",onChange:e=>g("user_lname",e.target.value),placeholder:"Enter last name"})]}),t("div",{className:"space-y-2",children:[e(Ar,{htmlFor:"created_at",children:"Joined On"}),e(Or,{id:"created_at",value:u.created_at?new Date(u.created_at).toLocaleString():"",disabled:!0,className:"bg-muted"})]})]})})};function Xi({fname:r,lname:n,email:i,avatar:s}){const l=u(),{isMobile:o}=zi(),{activePlan:d,featureFlags:c}=y(xa),m=`${r} ${n}`,[p,h]=b(!1);return t(a,{children:[e(Wi,{isDialogOpen:p,setIsDialogOpen:h}),e(Mi,{children:e(Ri,{children:t(sn,{children:[e(on,{asChild:!0,children:t(Ui,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",children:[t(qi,{className:"h-8 w-8 rounded-lg",children:[e(Ki,{src:s,alt:m}),t(Gi,{className:"rounded-lg",children:[r[0].toLocaleUpperCase(),n[0].toLocaleUpperCase()]})]}),t("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[e("span",{className:"truncate font-medium",children:m}),e("span",{className:"truncate text-xs",children:i})]}),e(ge,{className:"ml-auto size-4"})]})}),t(dn,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:o?"bottom":"right",align:"end",sideOffset:4,children:[e(gn,{className:"p-0 font-normal",children:t("div",{className:"flex items-center gap-2 px-1 py-1.5 text-left text-sm",children:[t(qi,{className:"h-8 w-8 rounded-lg",children:[e(Ki,{src:s,alt:m}),t(Gi,{className:"rounded-lg",children:[r[0].toLocaleUpperCase(),n[0].toLocaleUpperCase()]})]}),t("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[e("span",{className:"truncate font-medium",children:m}),e("span",{className:"truncate text-xs",children:i})]})]})}),e(fn,{}),t(mn,{onClick:()=>h(!0),children:[e(fe,{}),"Your Profile"]}),c.ff_enable_paid_subscription?t(a,{children:[e(fn,{}),e(cn,{children:t(mn,{onClick:()=>{setTimeout(()=>{l("/plans")},o?500:0)},children:[e(be,{}),Ia(d)?"Upgrade to premium":"View Plans"]})}),e(fn,{}),t(cn,{children:[t(mn,{onClick:()=>{setTimeout(()=>{l("/infrastructure/manage-subscription")},o?500:0)},children:[e(xe,{}),"Subscriptions"]}),t(mn,{onClick:()=>{setTimeout(()=>{l("/infrastructure/payment-history")},o?500:0)},children:[e(ve,{}),"Payment History"]})]})]}):null,e(fn,{}),t(mn,{onClick:()=>{Vt("apiKey",""),l("/login")},children:[e(ye,{}),"Log out"]})]})]})})})]})}const Ji=({purchasedPlan:r})=>{const{subscriptionConfig:n,featureFlags:i}=y(xa);if(!i.ff_enable_paid_subscription)return null;const s=n.plans.find(e=>e.id===r.plan_id);if(!s)return null;const l=Ia(r);return e(li,{delayDuration:20,content:t(a,{children:["This ",Lt.account_type_txt.singular.toLocaleLowerCase(),' is on a "',s.title,'" plan.']}),side:"right",children:e("div",{children:e(rn,{variant:"success",children:l?"Free":"Premium"})})})};function Zi(){const{isMobile:r,setOpenMobile:n}=zi(),{orgs:i,activeOrg:s,setActiveOrg:l}=y(xa),o=u();return e(Mi,{children:e(Ri,{children:t(sn,{children:[e(on,{asChild:!0,children:t(Ui,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",children:[e("div",{className:"flex aspect-square size-8 items-center justify-center rounded-lg",children:e(s?.logo?s.logo:Ne,{className:"size-4"})}),s?e(li,{content:s.org_name+" - "+s.org_external_id,side:"right",canShowTooltip:!0,children:t("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[e("span",{className:"truncate font-medium",children:s.org_name}),e("span",{className:"truncate text-xs",children:s.org_external_id})]})}):t("div",{className:"truncate text-xs",children:["No Active ",Lt.account_type_txt.singular,", select one."]}),s?.active_purchased_plan&&e("div",{className:"flex items-center justify-center rounded-md border",children:e(Ji,{purchasedPlan:s.active_purchased_plan})}),e(ge,{className:"ml-auto"})]})}),t(dn,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",align:"start",side:r?"bottom":"right",sideOffset:4,children:[e(gn,{className:"text-muted-foreground text-xs",children:Lt.account_type_txt.plural}),i.map(r=>t(mn,{onClick:()=>l(r),className:"gap-2 p-2",children:[r.logo?e("div",{className:"flex size-6 items-center justify-center rounded-md border",children:e(r.logo,{className:"size-3.5 shrink-0"})}):e(a,{}),r.org_name,r.active_purchased_plan&&e("div",{className:"ml-auto flex items-center justify-center rounded-md border",children:e(Ji,{purchasedPlan:r.active_purchased_plan})})]},r.org_id)),e(fn,{}),(()=>{const i=[];if(s&&ua(s?.org_id||0)){const r=hr.Is_ADMIN(s?.role_id||NaN);i.push({text:e(a,{children:"Invite team members"}),link:`/infrastructure/edit-org/${na(s?.org_id||0)}`,disabled:!r,icon:e(we,{className:"size-4"}),tooltip:r?`Invite peoples to "${s.org_name}" ${Lt.account_type_txt.singular.toLocaleLowerCase()}`:`You are not an admin for "${s.org_name}" ${Lt.account_type_txt.singular.toLocaleLowerCase()}, Only admins can invite peoples.`,key:"invite-peoples"},{text:t(a,{children:["Edit ",Lt.account_type_txt.singular.toLocaleLowerCase()]}),link:`/infrastructure/edit-org/${na(s?.org_id||0)}`,disabled:!r,icon:e(_e,{className:"size-4"}),tooltip:r?`Edit "${s.org_name}" ${Lt.account_type_txt.singular.toLocaleLowerCase()} details`:`You are not an admin for "${s.org_name}" ${Lt.account_type_txt.singular.toLocaleLowerCase()}, Only admins can invite peoples.`,key:"edit-org"})}return i.push({addTopSeparator:!0,text:t(a,{children:["Create new ",Lt.account_type_txt.singular.toLocaleLowerCase()]}),link:"/infrastructure/create-new-org",icon:e(Ce,{className:"size-4"}),key:"create-new-org"},{text:t(a,{children:["View all ",Lt.account_type_txt.plural.toLocaleLowerCase()]}),link:"/infrastructure/manage-infra",icon:e(ke,{className:"size-4"}),key:"view-all-orgs"},{addTopSeparator:!0,text:e(a,{children:"Check invites"}),link:"infrastructure/user-invitations",icon:e(we,{className:"size-4"}),key:"check-invitations"}),e(a,{children:i.map(i=>e(li,{content:e(a,{children:i.tooltip}),side:"right",canShowTooltip:!!i.tooltip,children:t("div",{children:[i.addTopSeparator?e(fn,{}):null,t(mn,{className:"gap-2 p-2 cursor-pointer",onClick:()=>{n(!1),setTimeout(()=>{i.disabled?wa({header:"Action not allowed!",description:i.tooltip||"You cannot access this option"}):o(i.link)},r?500:0)},children:[e("div",{className:"flex size-6 items-center justify-center rounded-md border bg-transparent",title:i.tooltip,children:i.icon}),e("div",{className:"text-muted-foreground font-medium",children:i.text})]},i.link)]},i.key)},i.key))})})()]})]})})})}function Qi(){return e(Mi,{children:e(d,{to:"/",children:e(Ri,{children:t(Ui,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",children:[e("div",{className:"w-10 h-10 bg-sidebar-primary text-sidebar-primary-foreground rounded-lg flex items-center justify-center",children:e(Lt.logo,{})}),t("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[e("span",{className:"truncate font-medium",children:Lt.appName}),t("span",{className:"truncate text-xs",children:["v",Lt.version]})]})]})})})})}const es=Ft;function ts({...a}){const{loggedInUser:r,featureFlags:n}=g.useContext(xa);return t(Ii,{collapsible:"icon",...a,children:[t(Fi,{children:[e(Qi,{}),n.ff_enable_teams&&e(Zi,{})]}),e(Di,{children:e(Yi,{navItems:es.navMain})}),e($i,{children:e(Xi,{email:r?.email||"",fname:r?.fname||"",lname:r?.lname||"",avatar:"/avatars/shadcn.jpg"})}),e(Oi,{})]})}function as({...t}){return e("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",...t})}function rs({className:t,...a}){return e("ol",{"data-slot":"breadcrumb-list",className:jt("text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5",t),...a})}function ns({className:t,...a}){return e("li",{"data-slot":"breadcrumb-item",className:jt("inline-flex items-center gap-1.5",t),...a})}function is({asChild:t,className:a,...r}){return e(t?gt:"a",{"data-slot":"breadcrumb-link",className:jt("hover:text-foreground transition-colors",a),...r})}function ss({className:t,...a}){return e("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:jt("text-foreground font-normal",t),...a})}function ls({children:t,className:a,...r}){return e("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:jt("[&>svg]:size-3.5",a),...r,children:t??e(he,{})})}const os=()=>{const a=(()=>{const e=i().pathname;if(!e||"/"===e)return{title:"Dashboard"};const t=pa(e),a=qt(t);return a||{title:"Not Found",url:"notFound"}})(),r=(a,n)=>{let i=[];return i.push(t(S,{children:[e(ns,{children:e(n?ss:is,{children:a.title})}),!n&&e(ls,{})]},a.title)),a.parent&&(i=[r(a.parent,!1),...i].flat()),i};return e(as,{children:e(rs,{children:r(a,!0)})})},ds=()=>{const r=u(),n=mr(),{activeOrg:i,loggedInUser:s}=y(xa);return{editOrganization:n=>{hr.Is_ADMIN(n.role_id)?r("/infrastructure/edit-org/"+na(n.org_id)):_a({header:"Alert",description:t(a,{children:["You are not allowed to edit the ",e("b",{children:n.org_name})," ",Lt.account_type_txt.singular.toLocaleLowerCase(),"."]})})},handleOnDeleteUnregisteredUser:(e,t)=>{const{id:a,email:r}=e;return new Promise((e,i)=>{n.showAlertBox({type:"CONFIRM",text:`Are you sure you want to remove "${r}" user from your ${Lt.account_type_txt.singular}?`,async onClose(n){if("CONFIRM"!==n)return void i();const s={invited_users_id:a,org_id:t};try{const t=await ka().delete("/org-member/unregistered-user-invitation",{data:s});Na({description:`${r} has been successfully removed from the team.`}),e(t)}catch(e){i(e)}}})})},isActiveOrgCreatedByMe:()=>Number(i?.org_created_by)===Number(s.id)}},cs=()=>{const{featureFlags:t}=y(xa),{isMobile:a,setOpenMobile:r}=zi(),n=u(),{isActiveOrgFreePlan:i,isUserFreePlan:s}=Aa(),{isActiveOrgCreatedByMe:l}=ds();if(!1===t.ff_enable_paid_subscription)return null;const o=()=>{a&&r(!1),n("/plans")};return s()&&(!t.ff_enable_teams||i()&&l())?e("button",{onClick:o,children:e(ii,{children:"Upgrade to premium"})}):null};var ms=Object.freeze({__proto__:null,default:function(){const r=In();return t(Si,{children:[e(ts,{}),t(Ai,{className:"h-screen",children:[t("header",{className:"flex py-4 shrink-0 items-center gap-2 transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12 bg-background",children:[t("div",{className:"flex items-center gap-2 px-4",children:[e(Ti,{className:"-ml-1"}),e(nn,{orientation:"vertical",className:"mr-2 data-[orientation=vertical]:h-4"}),e(os,{})]}),e("div",{className:"flex-1"}),e("div",{className:"flex items-center gap-2 px-4",children:e(r?a:cs,{})})]}),e("div",{className:"flex items-stretch flex-col flex-1 overflow-auto",children:e(m,{})})]})]})}});var us=Object.freeze({__proto__:null,default:({canShowHeader:r=!0})=>t("div",{className:"flex flex-col stretch justify-center gap-4 items-center flex-1 p-5",children:[r&&t(a,{children:[e("h1",{className:"text-3xl font-bold text-primary p-0",children:Lt.appName}),e("p",{className:"text-sm",children:Lt.appDescription})]}),t("div",{className:"flex flex-col justify-center",children:[e("div",{className:"text-muted-foreground mb-4 text-sm",children:"404 Page Not Found"}),e(d,{to:"/",className:"p-2 bg-primary text-primary-foreground rounded-md transition-colors text-sm",children:"Go to Homepage"})]})]})});const ps=({ref:a,gridCls:r,onChangeEmailClick:n,email:i})=>{const[s,l]=b(""),[o,d]=P(),c=u(),m=k(null);return z(a,()=>({focus(){m.current?.focus()}}),[]),t("form",{onSubmit:async e=>{if(e.preventDefault(),!s)return wa({header:"OTP Required!",description:"Please enter your OTP and try again."}),void m.current?.focus();const t=Ut(e.currentTarget);t.otp=s,t.user_email=i;const a=Wt(t.password);!1!==a.valid?t.password===t.user_password?d(async()=>{try{delete t.password,await ka().put("/reset-password",t),Na({header:"Your password has been reset successfully!",description:"Please log in using your new password."}),c("/login")}catch(e){Xt(e)}}):wa({header:"Password and Confirm Password fields contain different passwords.",description:""}):wa({header:"Password Policy",description:a.message})},className:"grid gap-6",children:[t("div",{className:r,children:[e(Ar,{htmlFor:"emailOTPGenerated",children:"Email *"}),e(Or,{id:"emailOTPGenerated",type:"email",name:"user_email",placeholder:"mail@example.com",value:i,disabled:!0,required:!0}),e("span",{className:"ml-auto text-xs underline-offset-4 hover:underline cursor-pointer italic",onClick:()=>n(),children:"Change Email"})]}),e(Ni,{className:r,inputOTPField:m,otp:s,setOtp:l,onChangeEmailClick:n}),t("div",{className:r,children:[t(Ar,{htmlFor:"password",children:["New Password * ",e(fi,{})]}),e(Or,{id:"password",type:"password",name:"password",placeholder:"**********",required:!0})]}),t("div",{className:r,children:[e(Ar,{htmlFor:"cnf-password",children:"Confirm Password *"}),e(Or,{id:"cnf-password",type:"password",name:"user_password",placeholder:"**********",required:!0})]}),e(dr,{type:"submit",className:"w-full",size:"lg",loading:o,children:"Reset Password"})]})};var hs=Object.freeze({__proto__:null,default:function(){const a=k(null),r=k(null),[n,i]=b(!1),[s,l]=b(""),o="grid gap-1";return x(()=>{n?r.current?.focus():a?.current?.focus()},[n]),t("div",{className:"grid gap-6",children:[e("div",{className:"after:border-border relative text-center text-sm after:absolute after:inset-0 after:top-1/2 after:z-0 after:flex after:items-center after:border-t",children:e("span",{className:"bg-card text-muted-foreground relative z-10 px-2",children:"Forgot Password"})}),e(bi,{ref:a,handleOnOTPSent:e=>{i(!0),l(e.email)},gridCls:o,hidden:n,path:"forgot-password"}),n&&e(ps,{ref:r,gridCls:o,onChangeEmailClick:()=>i(!1),email:s}),t("div",{className:"text-center text-sm",children:["Already have an account?"," ",e(d,{to:"/login",children:e("span",{className:"underline underline-offset-4",children:"Login"})})]})]})}});var gs=Object.freeze({__proto__:null,default:()=>{const{orgs:a}=y(xa);return t("div",{className:"mt-5",children:[t("div",{className:"flex flex-row justify-center gap-6",children:[t(Qn,{toPath:"create-new-org",className:"text-center",children:["Create new ",Lt.account_type_txt.singular.toLocaleLowerCase()]}),e(Qn,{toPath:"user-invitations",className:"text-center",children:"Accept/Reject Invitations"})]}),e("div",{className:"flex flex-row justify-center gap-6 mt-5",children:t(Qn,{toPath:"manage-infra",className:"text-center",disabled:a.length<=0,children:["Manage ",Lt.account_type_txt.plural.toLocaleLowerCase()]})})]})}});const fs=({value:t,setValue:a,id:r})=>e(si,{valueField:"id",labelField:"text",placeholder:"Specify Role",items:hr.GET_LIST(),value:t,onValueChange:e=>{a(e)},triggerClassName:"w-[180px]",id:r}),bs=(e,t)=>-1===t||e?.user_opinion===ca.NOT_SAVED,xs=({teamMembers:r,setTeamMembers:n,inactiveUsers:i})=>{const[s,l]=b(),[o,d]=b(NaN),c=mr(),[m,u]=b(),[p,h]=b(!1),[g,f]=b({email:"",role_id:hr.READ,user_opinion:ca.INVITED,id:""}),{loggedInUser:v}=y(xa),N=e=>{const t={},a=[...r??[],...e];a.forEach(e=>{const a=e.email;t[a]=t[a]?t[a]++:1});const i=a.filter(e=>(t[e.email]--,0===t[e.email]));return n(i),a.length===i.length},w=e=>e&&e.email&&!1!==Jt(e.email)?!!hr.IS_VALID_ROLE_ID(e.role_id)||(wa({description:"Invalid role selected. Please select a valid role and try again."}),!1):(wa({description:"Invalid email, please enter correct email and try again."}),!1);return x(()=>{if(!m)return void f({email:"",role_id:NaN,user_opinion:ca.INVITED,id:""});if(-1===m)return;const e=r?.find(e=>e.id===m);e?f({email:e.email,role_id:e.role_id,user_opinion:e.user_opinion,id:e.id||e.email}):wa({description:"Something went wrong, please reload and try again."})},[m]),t(Sn,{layout:"vertical",className:"gap-2",children:[p&&t(cr,{open:!0,setIsOpen:h,header:"Bulk Add Users",actionsJSX:e(dr,{onClick:()=>{const{validEmails:e}=s||{};if(!e?.length||e?.length<=0)return _a({description:"Please add comma separated emails, then press Continue button"});const t=e.map(e=>({email:e,role_id:o,id:e,user_opinion:ca.INVITED}));N(t),l(void 0),h(!1),Na({description:`${e?.length} emails has been added.`})},children:"Add users"}),children:[t(Sn,{layout:"horizontal",className:"gap-2",children:[e(Nn,{id:"includeUsers",placeholder:"Enter comma separated emailIds like mail1@temp.com, mail2@temp.com",className:"w-full min-h-[80px] max-h-[500px] mr-1",onChange:e=>l(Zt(e.target.value))}),e("span",{children:e(ri,{side:"right",children:"Enter comma separated emailIds like mail1@temp.com, mail2@temp.com"})})]}),t("span",{className:"mb-5",children:[t("span",{className:"text-success",children:["Valid Emails: ",s?.validEmails.length||0]}),","," ",t("span",{className:"text-failure",children:["Invalid Emails: ",s?.invalidEmails.length||0]})]}),t("div",{className:"flex flex-row gap-2",children:[e(Ar,{htmlFor:"roles",children:"Role *"}),e(fs,{id:"bulk-roles",value:o?.toString()||"",setValue:e=>{d(Number(e))}})]})]}),m&&e(cr,{open:!0,setIsOpen:e=>{u(!1===e?void 0:m)},header:-1===m?"Add User":"Edit User",actionsJSX:e(dr,{type:"button",onClick:-1===m?()=>{if(!w(g))return;N([{...g,id:g.email,user_opinion:ca.NOT_SAVED}])?u(void 0):wa({description:`This email is already exists in list: ${g.email}`})}:()=>{if(!w(g))return;const e=r?.find(e=>e.email===g.email&&e.id!==m);if(e)return void _a({description:`This email is already exists in list: ${g.email}`});const t=[...r||[]],a=t.find(e=>e.id===m);a?(a.email=g.email,a.role_id=g.role_id,n(t),u(void 0)):wa({description:"Record not found to update, something went wrong!"})},children:"Update"}),children:t("div",{className:"flex flex-col p-5 gap-5",children:[t("div",{className:"flex flex-col gap-2",children:[e(Ar,{htmlFor:"email",children:"Email *"}),e(Or,{id:"email",type:"email",placeholder:"mail@example.com",value:g.email,disabled:!1===bs(g,m),onChange:e=>f(t=>({...t,email:e.target.value}))})]}),t("div",{className:"flex flex-col gap-2 ",children:[e(Ar,{htmlFor:"roles",children:"Role *"}),e(fs,{id:"roles",value:g.role_id?.toString()||"",setValue:e=>{f(t=>({...t,role_id:Number(e)}))}})]})]})}),e(Un,{canShowToolbar:!0,canShowPagination:!1,data:r||[],toolbarConfig:{canShowSearchField:!1,canShowColumnsBtn:!1,additionalJSX:[t(dr,{variant:"secondary",type:"button",onClick:()=>{u(-1)},children:[e(Ce,{})," Add User"]}),t(dr,{variant:"outline",type:"button",onClick:()=>{h(!0)},children:[e(Se,{})," Bulk Add"]})]},columns:[{id:"email",headerText:"Email",enableSorting:!1,enableHiding:!1,editable:!0},{id:"role_id",headerText:"Role",enableSorting:!1,enableHiding:!1,editable:!0,type:"string",renderer:(e,t)=>hr.DISPLAY_TEXT(t)},{id:"user_opinion",headerText:"Status",enableSorting:!1,enableHiding:!1,type:"boolean",editable:!1,renderer(e){const{user_opinion:t}=e.original;return ca.getDisplay(t)}},{id:"joinedOn",headerText:"Joined On",enableSorting:!1,enableHiding:!1,type:"date",editable:!0},{id:"actions",headerText:"Actions",enableSorting:!1,enableHiding:!1,renderer(i){const{id:s}=i?.original;return t(a,{children:[e(dr,{variant:"ghost",onClick:()=>{const e=r?.find(e=>e.id===s),t=e?.fname||e?.lname?`${e?.fname} ${e?.lname}`:e?.email;e?.email!==v?.email?(!1===bs(e,void 0)&&_a({header:`Not allowed to edit email "${t}", however you can update its administrative privileges.`,description:"The invitation has been already sent. If you do not want this user as a team member, you can delete them and correct one."}),u(s)):_a({header:`Not allowed to edit "${t}"`,description:`If you want to leave this ${Lt.account_type_txt.singular.toLocaleLowerCase()}, go to "Manage ${Lt.account_type_txt.singular}," open the actions menu (three dots), and click "Leave ${Lt.account_type_txt.singular}."`})},type:"button",children:e(Pe,{})}),e(dr,{variant:"ghost",onClick:()=>{const e=r?.find(e=>e.id===s),t=e?.fname||e?.lname?`${e?.fname} ${e?.lname}`:e?.email;e?.email!==v?.email?c.showAlertBox({type:"CONFIRM",text:`Are you sure you want to remove "${t}" user?`,async onClose(e){"CONFIRM"===e&&n(r?.filter(e=>e.id!==s))}}):_a({header:`Not allowed to remove "${t}"`,description:`If you want to leave this ${Lt.account_type_txt.singular}, go to "Manage ${Lt.account_type_txt.singular}," open the actions menu (three dots), and click "Leave ${Lt.account_type_txt.singular}."`})},type:"button",children:e(ze,{})})]})}}]}),i.length>0&&t(a,{children:[e(Yn,{className:"mt-5 leading-normal font-semibold",children:"Following users are inactive/deleted."}),e("ol",{children:i.map((e,a)=>t("li",{children:[a+1,". ",e.email," ",hr.DISPLAY_TEXT(e.role_id)]},e.email))})]})]})};var vs=Object.freeze({__proto__:null,default:()=>{const r=u(),{orgId:n=""}=p(),[i,s]=b(()=>n?ia(parseInt(n,10)):-1),[l,o]=b(!1),[d,c]=b([]),[m,h]=b([]),[g,f]=b([]),[v,N]=b(!1),w=k([]),[_,C]=b(),{orgs:P,setOrgs:z,loggedInUser:S}=y(xa),I=i>-1?P.find(e=>e.org_id===i):null,T=i>-1||I,{handleOnDeleteUnregisteredUser:O}=ds();x(()=>{if(!T)return;const e=e=>e.map(e=>({id:e.user_id,email:e.user_email,role_id:e.role_id,user_opinion:e.user_opinion,fname:e.user_fname,lname:e.user_lname,joinedOn:e.joined_on}));(async()=>{N("Fetching Team Members");try{const t=await ka().get(`org-member/${i}`),a=t.orgMembers.filter(e=>da(e.is_active)),r=e(a),n=t.unregisteredUsers.map(e=>({role_id:e.role_id,email:e.email,id:e.invited_users_id})),s=t.orgMembers.filter(e=>!da(e.is_active));c(r),o(!0),h(n),f(e(s)),w.current=structuredClone(r)}finally{N(!1)}})()},[T,i]);const A=T?I?.org_name:`${S?.fname}'s ${Lt.account_type_txt.singular} ${P.length>=1?P.length+1:""}`;return e(Sn,{className:"pb-5 sm:px-0 px-5 pt-5",children:t(Sn,{layout:"horizontal",children:[e("span",{className:"md:flex-1 flex-none"}),t(Sn,{className:"flex-4 max-w-4xl pr-5 sm:pl-0 pl-2 overflow-visible",children:[e(Hn,{className:"text-center pl-5 gap-1",children:t("span",{className:"inline-flex items-center gap-2",children:[T?`Editing "${I?.org_name}" ${Lt.account_type_txt.singular}`:`Create new ${Lt.account_type_txt.singular}`,T&&I?.active_purchased_plan?e(Ji,{purchasedPlan:I?.active_purchased_plan}):null]})}),e("form",{onSubmit:async e=>{e.preventDefault(),N("Saving...");try{let t=I?.org_id;const a=Ut(e.currentTarget);if(T)await(e=>{const t={},a=I;if(e.org_name!==a?.org_name&&e.org_name&&(t.org_name=e.org_name),e.org_address!==a?.org_address&&e.org_address&&(t.org_address=e.org_address),e.org_state!==a?.org_state&&e.org_state&&(t.org_state=e.org_state),e.org_country!==a?.org_country&&e.org_country&&(t.org_country=e.org_country),e.org_external_id!==a?.org_external_id&&e.org_external_id&&(t.org_external_id=e.org_external_id),!ma(t))return ka().put(`/organization/${I?.org_id}`,t)})(a);else{const e=await(async e=>{const t={org_name:e.org_name,org_address:e.org_address,org_state:e.org_state,org_country:e.org_country,org_external_id:e.org_external_id};return ka().post("/organization",t)})(a);t=parseInt(e.insertedOrgId,10),!1===ua(t)&&(wa({description:`No response received from the ${Lt.account_type_txt.singular.toLocaleLowerCase()} service. Returning to the Manage ${Lt.account_type_txt.singular} page.`}),setTimeout(()=>{r("/infrastructure/manage-infra")},1e3))}const n=e=>{Na({description:`${Lt.account_type_txt.singular} has been ${T?"updated":"created"} successfully.${e?" Team members have also been updated successfully and sent invitation emails.":""}`}),r("/infrastructure/manage-infra")};if(!l)return n(!1);try{const e=w.current,a=e.filter(e=>!d.find(t=>e.email===t.email));if(a&&a.length>0){const e={org_id:t,users:a.map(e=>({user_id:e.id}))};await ka().delete("/org-member",{data:e})}const r=d.filter(t=>{const a=e.find(e=>t.id===e.id);return!!a&&a.role_id!==t.role_id});if(r&&r.length>0){const e={org_id:t,users:r.map(e=>({user_id:e.id,role_id:e.role_id}))};await ka().put("/org-member",e)}const i=d.filter(t=>!e.find(e=>e.email===t.email));if(i&&i.length>0){const e={org_id:t,included_users:i.map(e=>({email:e.email,role_id:e.role_id}))};await ka().post("/org-member/by-emails",e)}n(!0)}finally{s(t||-1)}}finally{N(!1);const e=await ka().get("organization");z(e?.orgs||[])}},children:e(Bn,{className:"w-full pr-1 mt-2 text-sm",leftCls:"w-32 sm:w-36 md:w-40 w-full sm:w-40 text-left sm:text-right pr-0 sm:pr-2 pt-3 sm:pt-7",rightCls:"pt-1 sm:pt-5",rowCls:"flex-col sm:flex-row",child:[t(Ke,{htmlFor:"orgName",className:"font-medium",children:[Lt.account_type_txt.singular," Name * :"]}),e(Or,{id:"orgName",name:"org_name",type:"text",required:!0,className:"w-full",defaultValue:I?.org_name??A,autoFocus:!0}),...Lt.account_type_txt.value===Et.ORG?[e(Ke,{htmlFor:"address",className:"font-medium",children:"Address * :"}),e(Or,{id:"address",name:"org_address",type:"text",required:!0,className:"w-full",defaultValue:I?.org_address??""}),e(Ke,{htmlFor:"state",className:"font-medium",children:"State * :"}),e(Or,{id:"state",name:"org_state",type:"text",required:!0,className:"w-full",defaultValue:I?.org_state??""}),e(Ke,{htmlFor:"country",className:"font-medium",children:"Country * :"}),e(Or,{id:"country",name:"org_country",type:"text",required:!0,className:"w-full",defaultValue:I?.org_country??""})]:[],e(Ke,{htmlFor:"org_external_id",className:"font-medium",children:"External Id (optional) :"}),e(Or,{id:"org_external_id",name:"org_external_id",type:"text",className:"w-full",defaultValue:I?.org_external_id??""}),e(a,{}),t(Sn,{layout:"horizontal",children:[e(Or,{id:"doIncludeUsers",type:"checkbox",className:"w-4",checked:l,onChange:e=>o(e.target.checked)}),t(Ke,{htmlFor:"doIncludeUsers",className:"font-medium mt-2 ml-1",children:["Would you like to invite your team-members in this ",Lt.account_type_txt.singular,"?"]})]}),...l?[e(Ke,{htmlFor:"includeUsers",className:"font-medium",children:"Team Members:"}),e(xs,{teamMembers:d,setTeamMembers:c,inactiveUsers:g})]:[],e(a,{}),t("div",{className:"flex gap-2 pt-2",children:[e(dr,{type:"submit",className:"flex-1 sm:flex-none",loading:!!v,children:v||"Save"}),e(dr,{type:"button",variant:"outline",className:"flex-1 sm:flex-none",onClick:()=>r(-1),children:"Cancel"})]}),e(a,{}),e(a,{}),e(a,{}),e(a,{children:m.length>0&&e(nn,{})}),e(a,{children:m.length>0&&"Unregistered Users:"}),e(a,{children:m.length>0&&t(Sn,{loading:_,children:[t(Yn,{className:"mt-2 leading-normal font-semibold",children:["Following users are unregistered. We have sent them invitation emails; once they accept, they will be part of this"," ",Lt.account_type_txt.singular.toLocaleLowerCase(),"."]}),e("ol",{children:m.map((a,r)=>e("li",{className:"mt-1",children:t("span",{className:"inline-flex group",children:[t("span",{children:[r+1,". ",a.email,", (role:  ",hr.DISPLAY_TEXT(a.role_id),")"]}),e("span",{title:"Delete",children:e(ze,{size:"15px",className:"opacity-40 group-hover:opacity-60 hover:opacity-100 ml-1 mt-0.5 cursor-pointer",onClick:async()=>{try{C(!0),await O(a,i);const e=[...m];e.splice(r,1),h(e)}finally{C(!1)}}})})]})},a.email))})]})})]})})]}),e("span",{className:"md:flex-1 flex-none"})]})})}});var ys=Object.freeze({__proto__:null,default:()=>{const{loading:a,response:r}=pi("/invitation"),n=mr(),i=r?.invites.filter(e=>e.user_opinion!==ca.ACCEPTED),[s,l]=b(-1),{setOrgs:o}=y(xa),d=async(e,t)=>{if(t)try{const a=parseInt(t.org_id,10);l(a);const r={org_id:a,user_opinion:e};await ka().put("/invitation",r);const n=await ka().get("organization");o(n?.orgs||[]),t.user_opinion=ca.ACCEPTED,Na({description:`Invitation for ${t.org_name} ${Lt.account_type_txt.singular} has been ${e===ca.ACCEPTED?"accepted":"rejected"} successfully.`})}finally{l(-1)}};return t(Sn,{layout:"horizontal",children:[e("span",{className:"md:flex-1 flex-none"}),e(Sn,{className:"flex-4 max-w-4xl mt-5",children:t(Sn,{children:[(()=>{if(a)return e("span",{children:e(Sn,{layout:"horizontal",className:"text-center mt-5 justify-center items-center",children:e(va,{})})});if(!i||i.length<=0)return t(Yn,{className:"text-center mt-5",children:["You don't have any invitations from any ",Lt.account_type_txt.singular.toLocaleLowerCase(),"."]});const r=i.filter(e=>da(e.org_user_is_active)).map(a=>[t(Ar,{className:"font-normal",children:[t("span",{className:"font-semibold",children:[a.org_name,","]}),"sent on  ",ta(a.sent_at)]}),t(Sn,{className:"gap-1 justify-end pr-3",layout:"horizontal",children:[t(dr,{onClick:()=>d(ca.ACCEPTED,a),loading:s===parseInt(a.org_id,10),disabled:-1!==s,className:"bg-green-500 hover:bg-green-600",children:[e(X,{})," Accept"]}),t(dr,{variant:"destructive",loading:s===parseInt(a.org_id,10),disabled:-1!==s,onClick:()=>{n.showAlertBox({type:"CONFIRM",text:`Are you sure you want to reject this ${Lt.account_type_txt.singular.toLocaleLowerCase()} request? You can't re-join until an administrator invites you again.`,async onClose(e){"CONFIRM"===e&&d(ca.REJECTED,a)}})},children:[e(J,{})," Reject"]})]})]);return e(Bn,{className:"w-full mt-5 text-sm border-b-1",leftCls:"w-full sm:w-100 text-left sm:text-right pt-3",rightCls:"sm:pt-0 pt-2",rowCls:"flex-col sm:flex-row border-t-1 p-2 hover:bg-muted",child:r.flat()})})(),e("span",{className:"mt-5 text-center",children:e(dr,{className:"mt-5",variant:"link",children:t(Zn,{to:"/infrastructure/manage-infra",children:["View all ",Lt.account_type_txt.plural.toLocaleLowerCase()]})})})]})}),e("span",{className:"md:flex-1 flex-none"})]})}});const Ns=ft("flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md has-[>[data-slot=button-group]]:gap-2",{variants:{orientation:{horizontal:"[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",vertical:"flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none"}},defaultVariants:{orientation:"horizontal"}});function ws({className:t,orientation:a,...r}){return e("div",{role:"group","data-slot":"button-group","data-orientation":a,className:jt(Ns({orientation:a}),t),...r})}var _s=Object.freeze({__proto__:null,default:()=>{const{orgs:a,featureFlags:r}=y(xa),n=r.ff_enable_teams&&0===a.length,s=i(),l=u(),o=In(),c=[...r.ff_enable_teams?[{title:Lt.account_type_txt.plural,url:"/infrastructure/manage-infra"},{title:"Invitations",url:"/infrastructure/user-invitations"}]:[],...r.ff_enable_paid_subscription?[{title:"Subscriptions",url:"/infrastructure/manage-subscription"},{title:"Payment History",url:"/infrastructure/payment-history"}]:[]];return t(Sn,{className:"h-screen sm:pt-10 pt-5",children:[t("div",{className:"scroll-m-20 text-xl inline-flex gap-2 px-5 pb-5",children:["/infrastructure"!==s.pathname&&t(dr,{variant:"ghost",onClick:()=>l(-1),children:[e(Ie,{size:20})," Back"]}),e("span",{className:"flex-1"}),e("div",{className:"bg-sidebar-primary text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg",children:e(Lt.logo,{className:"size-4"})}),e("div",{className:"grid text-left leading-tight items-center text-foreground font-semibold tracking-tight",children:Lt.appName}),e("span",{className:"flex-1"}),e(d,n?{to:"/login",children:t(dr,{variant:"ghost",children:[e(ye,{}),"Log out"]})}:{to:"/",children:e(dr,{variant:"ghost",title:"close",children:e(J,{size:20})})})]}),c.some(e=>e.url===s.pathname)&&e(Sn,{doNotAppendFlex1:!0,className:"mx-auto mb-4",children:o?t(sn,{children:[e(on,{asChild:!0,children:t(dr,{variant:"default",children:[e(Y,{}),"Menu"]})}),e(dn,{children:c.map(t=>e(mn,{onClick:()=>l(t.url),children:t.title},t.title))})]}):e(ws,{children:c.map(t=>e(dr,{variant:s.pathname===t.url?"default":"outline",onClick:()=>l(t.url),children:t.title},t.title))})}),e(m,{})]})}});var Cs=Object.freeze({__proto__:null,default:()=>{const{orgs:r,setOrgs:n,featureFlags:i,loggedInUser:s,setActiveOrg:l,activeOrg:o}=y(xa),d=mr(),[c,m]=b(!1),p=u(),{editOrganization:h}=ds(),g=async()=>{m(!0);try{const e=await ka().get("organization");if(n(e?.orgs||[]),o){e.orgs.find(e=>e.org_id===o.org_id)||l(e.orgs[0])}else e.orgs.length>0&&l(e.orgs[0])}catch{n([])}finally{m(!1)}};return x(()=>{r.length>0&&!o&&l(r[0])},[]),e(Sn,{children:e("div",{className:"flex-1 flex p-5 sm:px-10 px-4 flex-col sm:w-300 m:w-full w-full mx-auto",children:e(Un,{loading:c,toolbarConfig:{canShowSearchField:!0,searchFieldConfig:{placeholder:`Search by ${Lt.account_type_txt.singular} Name...`,searchField:"org_name"},canShowColumnsBtn:!0,additionalJSX:[e(Zn,{to:"/infrastructure/create-new-org",children:t(dr,{variant:"default",children:[e(Ce,{})," Create new ",Lt.account_type_txt.singular]})})],refreshBtn:{canShow:!0,onClick:g}},data:r,actions:[{id:"actionId1",headerText:"Edit",onClick:e=>{h(e)}},{id:"actionId2",headerText:"Delete",onClick:r=>{const n=r;hr.Is_ADMIN(n.role_id)?d.showAlertBox({type:"CONFIRM",text:`Are you sure you want to delete "${n.org_name}" ${Lt.account_type_txt.singular.toLocaleLowerCase()}?`,async onClose(e){if("CONFIRM"===e){m(!0);try{const e=await ka().delete("organization/"+n.org_id);Na({header:`${Lt.account_type_txt.singular} has been deleted successfully.`,description:e.message}),await g()}finally{m(!1)}}}}):_a({header:"Alert",description:t(a,{children:["You are not allowed to delete the ",e("b",{children:n.org_name})," ",Lt.account_type_txt.singular,"."]})})}},{id:"separate",headerText:"SEPARATOR"},{id:"actionId3",headerText:`Leave this ${Lt.account_type_txt.singular.toLocaleLowerCase()}`,onClick:e=>{const t=e;d.showAlertBox({type:"CONFIRM",text:`Are you sure you want to leave this ${Lt.account_type_txt.singular.toLocaleLowerCase()}? You can't re-join until an administrator invites you again.`,async onClose(e){if("CONFIRM"===e){m(!0);try{const e={org_id:t.org_id,user_opinion:ca.LEFT};await ka().put("invitation",e),Na({header:`You have successfully left this ${Lt.account_type_txt.singular.toLocaleLowerCase()}.`,description:""}),await g()}finally{m(!1)}}}})}},{id:"separate2",headerText:"SEPARATOR"},{id:"actionId4",headerText:"Impersonate",onClick:e=>{l(e),p("/")}}],columns:[...!1===i.ff_enable_paid_subscription?[]:[{id:"active_purchased_plan",headerText:"",enableSorting:!1,enableHiding:!1,type:"string",renderer:(t,a)=>e(Ji,{purchasedPlan:a})}],{id:"org_name",headerText:`${Lt.account_type_txt.singular} Name`,enableSorting:!0,enableHiding:!0},...Lt.account_type_txt.value===Et.ORG?[{id:"org_address",headerText:"Address",enableSorting:!0,enableHiding:!0},{id:"org_state",headerText:"State",enableSorting:!0,enableHiding:!0},{id:"org_country",headerText:"Country",enableSorting:!0,enableHiding:!0}]:[],{id:"role_id",headerText:"Role",enableSorting:!0,enableHiding:!0,type:"string",renderer:(e,t)=>hr.DISPLAY_TEXT(t)},{id:"org_created_by",headerText:"Created By Me?",enableSorting:!1,enableHiding:!0,renderer:(t,a)=>Number(a)===Number(s.id)?e(X,{}):e(J,{})},{id:"updated_at",headerText:"Updated On",enableSorting:!0,enableHiding:!0,type:"date"},{id:"created_at",headerText:"Created On",enableSorting:!0,enableHiding:!0,type:"date"}]})})})}});function ks({className:t,...a}){return e(_t.Root,{"data-slot":"radio-group",className:jt("grid gap-3",t),...a})}function Ps({className:t,...a}){return e(_t.Item,{"data-slot":"radio-group-item",className:jt("border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...a,children:e(_t.Indicator,{"data-slot":"radio-group-indicator",className:"relative flex items-center justify-center",children:e(V,{className:"fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2"})})})}const zs=ft("py-32 relative overflow-hidden",{variants:{size:{small:"py-12",medium:"py-20",large:"py-32"},theme:{minimal:"bg-background",classic:"bg-gradient-to-b from-background to-muted/20"}},defaultVariants:{size:"medium",theme:"minimal"}}),Ss=ft("font-bold mb-4 text-foreground",{variants:{size:{small:"text-3xl lg:text-4xl",medium:"text-4xl lg:text-5xl",large:"text-4xl lg:text-6xl"},theme:{minimal:"",classic:"bg-gradient-to-r from-foreground to-muted-foreground bg-clip-text text-transparent"}},defaultVariants:{size:"medium",theme:"minimal"}}),Is=ft("text-muted-foreground max-w-3xl mx-auto mb-2",{variants:{size:{small:"text-base lg:text-lg",medium:"text-lg lg:text-xl",large:"lg:text-xl"},theme:{minimal:"",classic:""}},defaultVariants:{size:"medium",theme:"minimal"}}),Ts=ft("relative h-full transition-all duration-300 rounded-lg border bg-card text-card-foreground",{variants:{size:{small:"p-4",medium:"p-5",large:"p-6"},theme:{minimal:"hover:bg-muted/30",classic:"hover:shadow-xl backdrop-blur-sm bg-card/50 border-border/50"},highlight:{true:"",false:""}},compoundVariants:[{theme:"classic",highlight:!0,className:"ring-2 ring-primary/20 border-primary/30 bg-gradient-to-b from-primary/5 to-transparent relative overflow-hidden shadow-xl"},{theme:"minimal",highlight:!0,className:"bg-muted/50 border-primary/20"}],defaultVariants:{size:"large",theme:"minimal",highlight:!1}}),Os=ft("flex h-11 w-fit shrink-0 items-center rounded-md p-1 text-lg",{variants:{theme:{minimal:"bg-muted",classic:"bg-muted/50 backdrop-blur-sm border border-border/50 shadow-lg"}},defaultVariants:{theme:"minimal"}}),As=ft("font-medium",{variants:{size:{small:"text-2xl",medium:"text-3xl",large:"text-4xl"},theme:{minimal:"",classic:"font-extrabold bg-gradient-to-r from-foreground to-muted-foreground bg-clip-text text-transparent"}},defaultVariants:{size:"large",theme:"minimal"}}),Fs=ft("w-full transition-all duration-300 hover:cursor-pointer",{variants:{theme:{minimal:"shadow hover:bg-primary/90 h-9 py-2 group bg-primary text-primary-foreground ring-primary before:from-primary-foreground/20 after:from-primary-foreground/10 relative isolate inline-flex w-full items-center justify-center overflow-hidden rounded-md px-3 text-left text-sm font-medium ring-1 before:pointer-events-none before:absolute before:inset-0 before:-z-10 before:rounded-md before:bg-gradient-to-b before:opacity-80 before:transition-opacity before:duration-300 before:ease-[cubic-bezier(0.4,0.36,0,1)] after:pointer-events-none after:absolute after:inset-0 after:-z-10 after:rounded-md after:bg-gradient-to-b after:to-transparent after:mix-blend-overlay",classic:"relative overflow-hidden bg-gradient-to-r from-primary to-primary/80 text-primary-foreground font-semibold py-3 px-6 rounded-lg hover:shadow-xl active:scale-95 border border-primary/20"}},defaultVariants:{theme:"minimal"}}),$s=ft("flex-none h-[1lh]",{variants:{size:{small:"size-3",medium:"size-4",large:"size-4"},theme:{minimal:"text-primary",classic:"text-primary"}},defaultVariants:{size:"large",theme:"minimal"}}),Ds={starter:e(Te,{className:"w-4 h-4"}),pro:e(Ae,{className:"w-4 h-4"}),enterprise:e(Oe,{className:"w-4 h-4"})};function Es({plans:r,title:n="Choose Your Perfect Plan",description:i="Transform your project with our comprehensive pricing options designed for every need.",subtitle:s,onPlanSelect:l,className:o,size:d="medium",theme:c="minimal",showBillingToggle:m=!0,billingToggleLabels:u={monthly:"Monthly",yearly:"Yearly"}}){const[p,h]=b(!1),g=I();function f(e,t){const a=parseFloat(e),r=parseFloat(t);if("custom"===e.toLowerCase()||"custom"===t.toLowerCase()||isNaN(a)||isNaN(r)||0===a)return 0;const n=(12*a-r)/(12*a)*100;return Math.round(n)}const x=r.length?Math.max(...r.map(e=>f(e.monthlyPrice,e.yearlyPrice))):0;return t("section",{className:jt(zs({size:d,theme:c}),o),children:["classic"===c&&t(a,{children:[e("div",{className:"absolute inset-0 bg-grid-pattern opacity-5"}),e("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-96 h-96 bg-primary/5 rounded-full blur-3xl"}),e("div",{className:"absolute top-1/4 right-1/4 w-64 h-64 bg-secondary/5 rounded-full blur-2xl"})]}),t("div",{className:"container max-w-7xl mx-auto relative",children:[t("div",{className:"text-center mb-12",children:[s&&e("p",{className:"text-sm font-medium text-primary mb-3 tracking-wide uppercase",children:s}),e("h2",{className:jt(Ss({size:d,theme:c})),children:n}),e("p",{className:jt(Is({size:d,theme:c})),children:i}),m&&e("div",{className:jt("flex justify-center mt-8 mx-auto",Os({theme:c})),children:t(ks,{defaultValue:"monthly",className:"h-full grid-cols-2",onValueChange:e=>{h("annually"===e)},children:[t("div",{className:'has-[button[data-state="checked"]]:bg-background h-full rounded-md transition-all',children:[e(Ps,{value:"monthly",id:`${g}-monthly`,className:"peer sr-only"}),e(Ar,{htmlFor:`${g}-monthly`,className:"text-muted-foreground peer-data-[state=checked]:text-primary flex h-full cursor-pointer items-center justify-center px-2 md:px-7 font-semibold transition-all hover:text-foreground",children:u.monthly})]}),t("div",{className:'has-[button[data-state="checked"]]:bg-background h-full rounded-md transition-all',children:[e(Ps,{value:"annually",id:`${g}-annually`,className:"peer sr-only"}),t(Ar,{htmlFor:`${g}-annually`,className:"text-muted-foreground peer-data-[state=checked]:text-primary flex h-full cursor-pointer items-center justify-center gap-1 px-2 md:px-7 font-semibold transition-all hover:text-foreground",children:[u.yearly,x>0&&t("span",{className:"ml-1 rounded bg-primary/10 px-2 py-0.5 text-xs text-primary border border-primary/20 font-medium",children:["Save ",x,"%"]})]})]})]})})]}),e("div",{className:jt("grid gap-6",1===r.length&&"grid-cols-1 max-w-md mx-auto",2===r.length&&"grid-cols-1 md:grid-cols-2 max-w-4xl mx-auto",3===r.length&&"grid-cols-1 md:grid-cols-3",r.length>=4&&"grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4"),children:r.map((r,n)=>{return t(Nt.div,{className:"relative group h-full",initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.4,delay:.1*n,ease:"easeOut"},children:[r.badge&&e(rn,{className:jt("absolute -top-3 left-1/2 transform -translate-x-1/2 z-20","classic"===c?"bg-gradient-to-r from-primary to-primary/80 text-primary-foreground border-primary/20 shadow-lg":"bg-primary text-primary-foreground"),children:r.badge}),"classic"===c&&r.highlight&&e("div",{className:"absolute -top-px left-1/2 -translate-x-1/2 w-32 h-px bg-gradient-to-r from-transparent via-primary to-transparent"}),e("div",{className:jt(Ts({size:d,theme:c,highlight:r.highlight})),children:t("div",{className:"flex flex-col h-full",children:[t("div",{className:"flex items-start gap-4 mb-4",children:[t("div",{className:"flex-1",children:[e("h3",{className:jt("text-xl font-bold mb-1","classic"===c?"text-lg":""),children:r.title}),e("p",{className:jt("text-sm text-muted-foreground","classic"===c&&"text-foreground/80"),children:r.description})]}),e("div",{className:jt("w-10 h-10 flex items-center rounded-lg justify-center flex-shrink-0","classic"===c?"bg-primary/10 text-primary border border-primary/20":"bg-muted text-foreground border border-border"),children:(i=r.id,Ds[i]||e(Te,{className:"w-5 h-5"}))})]}),e("div",{className:"mb-6",children:e(wt,{mode:"wait",children:e(Nt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},children:t("div",p?{className:"flex items-baseline gap-1",children:[t("span",{className:jt(As({size:d,theme:c})),children:[parseFloat(r.yearlyPrice)>=0&&"custom"!==r.yearlyPrice.toLowerCase()&&e(a,{children:r.currency}),r.yearlyPrice]}),e("span",{className:"text-muted-foreground text-sm",children:"/year"}),f(r.monthlyPrice,r.yearlyPrice)>0&&t("span",{className:jt("text-xs ml-2","classic"===c?"text-emerald-500 font-semibold":"text-primary font-medium"),children:[f(r.monthlyPrice,r.yearlyPrice),"% off"]})]}:{className:"flex items-baseline gap-1",children:[t("span",{className:jt(As({size:d,theme:c})),children:[parseFloat(r.monthlyPrice)>=0&&"custom"!==r.monthlyPrice.toLowerCase()&&e(a,{children:r.currency}),r.monthlyPrice]}),e("span",{className:"text-muted-foreground text-sm",children:"/month"})]})},p?"year":"month")})}),e("div",{className:"mb-6",children:t(dr,{onClick:()=>(e=>{l?.(e,p)})(r.id),className:jt(Fs({theme:c}),!r.highlight&&"minimal"===c&&"bg-secondary hover:bg-secondary/80 text-secondary-foreground"),variant:r.highlight?"default":"secondary",children:[r.buttonText,"classic"===c&&r.highlight&&e("div",{className:"absolute inset-0 bg-gradient-to-r from-white/0 via-white/10 to-white/0 translate-x-[-100%] hover:translate-x-[100%] transition-transform duration-700"})]})}),e("div",{className:"flex-1",children:e("ul",{className:"space-y-3",children:r.features.map((a,r)=>t(Nt.li,{className:"flex gap-3 items-start",initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{duration:.3,delay:.05*r},children:[e(X,{className:jt($s({size:d,theme:c}))}),e("span",{className:jt("text-sm","classic"===c?"text-foreground/90":"text-muted-foreground"),children:a.name})]},r))})})]})})]},r.id);var i})})]})]})}var Ls=Object.freeze({__proto__:null,PricingTbl:function(){const a=u(),{subscriptionConfig:r,setSubscriptionConfig:n}=y(xa),{plans:i,faqs:s}=r;return x(()=>{(async()=>{if("plans"in r==!1){const e=await ka().get("/get-subscription-config");n(e)}})()},[n,r]),"plans"in r==!1?e(ya,{}):t("div",{className:"px-5",children:[e(Es,{plans:i,title:"Choose Your Perfect Plan",theme:"classic",description:"Transform your project with our comprehensive pricing options designed for every need.",subtitle:Lt.appName,onPlanSelect:(e,t)=>{a(`/infrastructure/checkout?plan=${e}&billing=${t?"yearly":"monthly"}`)},size:"small",className:"w-full",showBillingToggle:!0,billingToggleLabels:{monthly:"Monthly",yearly:"Yearly"}}),t("div",{className:"m-8 mx-auto max-w-200",children:[e(Hn,{className:"mb-2",children:"Need a custom plan?"}),e("p",{className:"text-muted-foreground",children:"Contact our sales team for tailored solutions that fit your organization's unique needs."}),e(Hn,{className:"mb-2 mt-15 font-medium text-lg",children:"Frequently Asked Questions"}),e("div",{className:"mt-5",children:s.map((t,a)=>e("div",{className:"border-t",children:e(Xn,{title:e("h1",{className:"",children:t.question}),children:e("div",{className:"",children:t.answer})})},a))}),e(Hn,{className:"mb-2 mt-15 font-medium text-lg",children:"Still have questions?"}),t("p",{className:"text-muted-foreground",children:["Reach out to our support team at"," ",e("a",{href:`mailto:${Lt.supportEmail}`,className:"text-primary underline",children:Lt.supportEmail})," ","for personalized assistance."]})]})]})}});function Ms({title:a,description:r,plan:n,triggerButtonText:i,leftPanelImageUrl:s,warningTitle:l,warningText:o,keepButtonText:d,continueButtonText:c,finalTitle:m,finalSubtitle:u,finalWarningText:p,goBackButtonText:h,confirmButtonText:g,onCancel:f,onKeepSubscription:v,onDialogClose:y,className:N}){const[w,_]=b(!1),[C,k]=b(!1),[P,z]=b(!1),[S,I]=b(null),T=()=>{k(!1),_(!1),I(null),z(!1),y?.()};return x(()=>{const e=e=>{C&&"Escape"===e.key&&(e.preventDefault(),T())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[C]),t(Ja,{open:C,onOpenChange:e=>{e?k(!0):T()},children:[e(Za,{asChild:!0,children:e(dr,{variant:"outline",children:i||"Cancel Subscription"})}),t(ar,{className:jt("sm:max-w-[1000px] flex flex-col md:flex-row p-0 overflow-hidden text-foreground w-[95%] md:w-[100%]",s?"":"sm:max-w-[500px]",N),children:[e(ir,{className:"sr-only",children:a}),t(er,{className:"absolute right-4 top-4 z-10 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",onClick:T,children:[e(J,{className:"h-4 w-4"}),e("span",{className:"sr-only",children:"Close"})]}),s&&t("div",{className:"w-full md:w-1/2 min-h-[500px] relative hidden md:block overflow-hidden",children:[e("img",{src:s,alt:"Cancel Subscription",className:"absolute inset-0 w-full h-full object-cover"}),e("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-background/30 to-background/90 dark:block hidden"}),e("div",{className:"absolute inset-0 bg-gradient-to-t from-background/80 via-transparent to-background/20 dark:block hidden"})]}),t("div",{className:jt("py-6 px-4 flex flex-col gap-4",s?"w-full md:w-1/2":"w-full"),children:[t("div",{className:"flex flex-col gap-2 text-center md:text-left",children:[e("h2",{className:"md:text-2xl text-xl font-semibold",children:a}),e("p",{className:"md:text-sm text-xs text-muted-foreground",children:r}),S&&e("div",{className:"p-3 bg-destructive/10 border border-destructive/20 rounded-md",children:e("p",{className:"text-sm text-destructive",children:S})})]}),!w&&t("div",{className:"flex flex-col gap-4 p-4 bg-muted/50 rounded-lg",children:[t("div",{className:"flex items-center justify-between",children:[t("div",{className:"flex flex-col gap-1",children:[t("span",{className:"font-semibold text-lg",children:[n.title," Plan"]}),e("span",{className:"text-sm text-muted-foreground",children:"Current subscription"})]}),e(rn,{variant:"secondary",children:parseFloat(n.monthlyPrice)>=0?`${n.currency}${n.monthlyPrice}/monthly`:`${n.monthlyPrice}/monthly`})]}),e("div",{className:"flex flex-col gap-2",children:n.features.slice(0,4).map((a,r)=>t("div",{className:"flex items-center gap-2",children:[e(Fe,{className:"w-2 h-2 fill-primary text-primary"}),e("span",{className:"text-sm text-muted-foreground",children:a.name})]},r))})]}),!w&&(l||o)&&t("div",{className:"p-4 bg-muted/30 border border-border rounded-lg",children:[l&&e("h3",{className:"font-semibold text-foreground mb-2",children:l}),o&&e("p",{className:"text-sm text-muted-foreground",children:o})]}),t("div",w?{className:"flex flex-col gap-4 mt-auto",children:[t("div",{className:"text-center p-4 bg-muted/50 rounded-lg",children:[e("h3",{className:"font-semibold mb-2 text-foreground",children:m||"Final Confirmation"}),e("p",{className:"text-sm text-muted-foreground mb-2",children:u||"Are you sure you want to cancel your subscription?"}),e("p",{className:"text-sm text-destructive",children:p||"This action cannot be undone and you'll lose access to all premium features."})]}),t("div",{className:"flex flex-col sm:flex-row gap-3",children:[e(dr,{variant:"outline",className:"flex-1",onClick:()=>{_(!1),I(null)},disabled:P,children:h||"Go Back"}),e(dr,{variant:"destructive",className:"flex-1",onClick:async()=>{try{z(!0),I(null),await f(n.id),T()}catch(e){I(e instanceof Error?e.message:"Failed to cancel subscription")}finally{z(!1)}},disabled:P,children:P?"Cancelling...":g||"Yes, Cancel Subscription"})]})]}:{className:"flex flex-col sm:flex-row gap-3 mt-auto",children:[e(dr,{className:"flex-1",onClick:async()=>{try{z(!0),I(null),v&&await v(n.id),T()}catch(e){I(e instanceof Error?e.message:"Failed to keep subscription")}finally{z(!1)}},disabled:P,children:P?"Processing...":d||"Keep My Subscription"}),e(dr,{variant:"destructive",className:"flex-1",onClick:()=>{_(!0),I(null)},disabled:P,children:c||"Continue Cancellation"})]})]})]})]})}const Rs=ft("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-9 px-2 min-w-9",sm:"h-8 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}});function js({className:t,variant:a,size:r,...n}){return e(Ct.Root,{"data-slot":"toggle",className:jt(Rs({variant:a,size:r,className:t})),...n})}const Us=[.4,0,.2,1];function Bs({currentPlan:a,plans:r,onPlanChange:n,className:i,title:s,triggerText:l}){const[o,d]=b(!1),[c,m]=b(void 0),[u,p]=b(!1),h=N(e=>o?`${e.yearlyPrice}`:`${e.monthlyPrice}`,[o]),g=N(e=>{m(t=>t===e?void 0:e)},[]),f=N(e=>{p(e),e||m(void 0)},[]);return t(Ja,{open:u,onOpenChange:f,children:[e(Za,{asChild:!0,children:e(dr,{children:l||"Update Plan"})}),t(ar,{className:jt("gap-3 sm:gap-4 max-h-[95vh] sm:max-h-[90vh] flex flex-col text-foreground","w-[calc(100vw-2rem)] sm:w-full max-w-2xl","p-4 sm:p-6",i),children:[t(rr,{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 sm:gap-4 pb-2 sm:pb-0",children:[e(ir,{className:"text-lg sm:text-xl font-semibold",children:s||"Upgrade Plan"}),t("div",{className:"flex items-center gap-1.5 sm:gap-2 text-sm",children:[e(js,{size:"sm",pressed:!o,onPressedChange:e=>d(!e),className:"px-3 sm:px-4 h-9 sm:h-10 text-xs sm:text-sm",children:"Monthly"}),e(js,{size:"sm",pressed:o,onPressedChange:e=>d(e),className:"px-3 sm:px-4 h-9 sm:h-10 text-xs sm:text-sm",children:"Yearly"})]})]}),e("div",{className:"flex-1 min-h-0 overflow-y-auto overflow-x-hidden -mx-4 sm:-mx-6 px-4 sm:px-6 [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:bg-muted [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:border-2 [&::-webkit-scrollbar-thumb]:border-transparent hover:[&::-webkit-scrollbar-thumb]:bg-muted-foreground/20",style:{scrollbarWidth:"thin",scrollbarColor:"hsl(var(--muted)) transparent"},children:0===r.length?e("div",{className:"flex items-center justify-center py-12 text-center",children:e("p",{className:"text-sm text-muted-foreground",children:"No plans available"})}):e(ks,{value:c,onValueChange:g,children:e("div",{className:"space-y-2.5 sm:space-y-3 pb-2 pr-0.5",children:r.map((r,i)=>t(Nt.div,{layout:!0,initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{layout:{duration:.3,ease:Us},opacity:{delay:.05*i,duration:.3,ease:Us},y:{delay:.05*i,duration:.3,ease:Us}},onClick:()=>g(r.id),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),g(r.id))},role:"button",tabIndex:0,"aria-pressed":c===r.id,className:jt("relative rounded-lg sm:rounded-xl border cursor-pointer overflow-hidden transition-all duration-200","touch-manipulation focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",c===r.id?"border-primary bg-gradient-to-br from-muted/60 to-muted/30 shadow-sm":"border-border hover:border-primary/50"),children:[e(Nt.div,{layout:"position",className:"p-3 sm:p-4",children:t("div",{className:"flex items-start justify-between gap-2 sm:gap-3",children:[t("div",{className:"flex gap-2 sm:gap-3 min-w-0 flex-1",children:[e(Ps,{value:r.id,id:r.id,className:"flex-shrink-0 pointer-events-none mt-0.5 sm:mt-1"}),t("div",{className:"min-w-0 flex-1",children:[t("div",{className:"flex items-center gap-1.5 sm:gap-2 flex-wrap",children:[e(Ar,{htmlFor:r.id,className:"font-semibold sm:font-medium text-sm sm:text-base cursor-pointer leading-tight",children:r.title}),r.badge&&e(rn,{variant:"secondary",className:"flex-shrink-0 text-[10px] sm:text-xs px-1.5 sm:px-2 py-0 sm:py-0.5 h-5 sm:h-auto",children:r.badge})]}),e("p",{className:"text-[11px] sm:text-xs text-muted-foreground mt-1 leading-relaxed",children:r.description}),r.features.length>0&&e("div",{className:"pt-2 sm:pt-3",children:e("div",{className:"flex flex-wrap gap-1.5 sm:gap-2",children:r.features.map((a,r)=>t("div",{className:"flex items-center gap-1.5 sm:gap-2 px-2 py-1 rounded-md sm:rounded-lg bg-muted/20 border border-border/30 flex-shrink-0",children:[e("div",{className:"w-1 h-1 sm:w-1.5 sm:h-1.5 rounded-full bg-primary flex-shrink-0"}),e("span",{className:"text-[10px] sm:text-xs text-muted-foreground whitespace-nowrap leading-none",children:a.name})]},r))})})]})]}),t("div",{className:"text-right flex-shrink-0 min-w-[60px] sm:min-w-[80px]",children:[e("div",{className:"text-base sm:text-xl font-bold sm:font-semibold leading-tight",children:parseFloat(h(r))>=0?`${r.currency}${h(r)}`:h(r)}),t("div",{className:"text-[10px] sm:text-xs text-muted-foreground mt-0.5",children:["/",o?"year":"month"]})]})]})}),e(wt,{initial:!1,children:c===r.id&&e(Nt.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1,transition:{height:{duration:.3,ease:Us},opacity:{duration:.25,delay:.05,ease:Us}}},exit:{height:0,opacity:0,transition:{height:{duration:.25,ease:Us},opacity:{duration:.15,ease:Us}}},className:"overflow-hidden",children:e(Nt.div,{initial:{y:-8},animate:{y:0,transition:{duration:.25,delay:.05,ease:Us}},exit:{y:-8},className:"px-3 sm:px-4 pb-3 sm:pb-4",children:e(dr,{className:"w-full h-10 sm:h-11 text-sm sm:text-base font-medium touch-manipulation",disabled:c===a.id,onClick:e=>{e.stopPropagation(),n(r.id,o),f(!1)},children:c===a.id?"Current Plan":"Upgrade"})})})})]},r.id))})})})]})]})}function Vs({className:a,currentPlan:r,cancelSubscription:n,updatePlan:i,canShowUpdatePlanBtn:s,addMoreBtnProps:l,canShowCancelPlanBtn:o}){return e("div",{className:jt("text-left w-full",a),children:t(Cr,{className:"",children:[t(kr,{className:"pb-4 sm:pb-6 px-4 sm:px-6",children:[t(Pr,{className:"flex items-center gap-2 sm:gap-3 text-lg sm:text-xl",children:[e("div",{className:"p-1.5 sm:p-2 rounded-lg bg-primary/10 ring-1 ring-primary/20",children:e(ve,{className:"h-4 w-4 sm:h-5 sm:w-5 text-primary"})}),"Current Subscription"]}),e(zr,{className:"text-sm sm:text-base",children:"Manage your billing and subscription settings"})]}),t(Ir,{className:"space-y-6 sm:space-y-8 px-4 sm:px-6",children:[e("div",{className:"relative p-3 sm:p-4 rounded-xl bg-gradient-to-r from-muted/30 via-muted/20 to-muted/30 border border-border/50 overflow-hidden",children:e("div",{className:"relative",children:e("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 sm:gap-0",children:t("div",{className:"w-full",children:[t("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-3 mb-2",children:[e("div",{className:"flex items-center gap-2",children:t("h3",{className:"text-lg sm:text-xl font-semibold",children:[r.plan.title," Plan"]})}),t("div",{className:"flex flex-wrap items-center gap-2",children:[e(rn,{variant:"active"===r.status?"default":"outline",className:"shadow-sm text-xs sm:text-sm bg-primary/90 hover:bg-primary border-0 font-medium",children:"monthly"===r.type?`${r.plan.currency}${r.plan.monthlyPrice}/month`:"yearly"===r.type?`${r.plan.currency}${r.plan.yearlyPrice}/year`:`${r.price}`}),e(rn,{variant:"outline",className:"shadow-sm text-xs sm:text-sm border-border/60 bg-background/50 backdrop-blur-sm",children:r.status})]})]}),e("div",{className:"relative",children:e("p",{className:"text-xs sm:text-sm text-muted-foreground relative z-10",children:r.plan.description})})]})})})}),e(nn,{className:"my-4 sm:my-6 bg-gradient-to-r from-transparent via-border to-transparent"}),t("div",{className:"space-y-3 sm:space-y-4",children:[t("h4",{className:"font-medium flex items-center gap-2 text-base sm:text-lg",children:[e("div",{className:"p-1 sm:p-1.5 rounded-md bg-muted ring-1 ring-border/50",children:e($e,{className:"h-3 w-3 sm:h-4 sm:w-4"})}),"Billing Information"]}),t("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-6",children:[t("div",{className:"group p-2.5 sm:p-3 rounded-lg md:bg-gradient-to-tl bg-gradient-to-b from-muted to-background/10 border border-border/30 hover:border-border/60 transition-all duration-200",children:[e("span",{className:"text-xs sm:text-sm text-muted-foreground block mb-1",children:"Start Date"}),e("div",{className:"font-medium text-sm sm:text-base group-hover:text-primary transition-colors duration-200",children:r.startDate})]}),t("div",{className:"group p-2.5 sm:p-3 rounded-lg md:bg-gradient-to-tl bg-gradient-to-b from-muted to-background/10 border border-border/30 hover:border-border/60 transition-all duration-200",children:[e("span",{className:"text-xs sm:text-sm text-muted-foreground block mb-1",children:"Plan Expiry Date"}),e("div",{className:"font-medium text-sm sm:text-base group-hover:text-primary transition-colors duration-200",children:r.expiryDate})]})]}),t("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-6",children:[t("div",{className:"group p-2.5 sm:p-3 rounded-lg md:bg-gradient-to-tl bg-gradient-to-b from-muted to-background/10 border border-border/30 hover:border-border/60 transition-all duration-200",children:[e("span",{className:"text-xs sm:text-sm text-muted-foreground block mb-1",children:"Active Plan for"}),t("div",{className:"font-medium text-sm sm:text-base group-hover:text-primary transition-colors duration-200",children:[r.activePlanFor," users"]})]}),t("div",{className:"group p-2.5 sm:p-3 rounded-lg md:bg-gradient-to-tr bg-gradient-to-b from-muted to-background/10 border border-border/30 hover:border-border/60 transition-all duration-200",children:[e("span",{className:"text-xs sm:text-sm text-muted-foreground block mb-1",children:"Total Paid Amount"}),e("div",{className:"font-medium text-sm sm:text-base group-hover:text-primary transition-colors duration-200",children:r.paidAmount})]})]}),t("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-6",children:[t("div",{className:"group p-2.5 sm:p-3 rounded-lg md:bg-gradient-to-tr bg-gradient-to-b from-muted to-background/10 border border-border/30 hover:border-border/60 transition-all duration-200",children:[e("span",{className:"text-xs sm:text-sm text-muted-foreground block mb-1",children:"Payment method"}),e("div",{className:"font-medium text-sm sm:text-base group-hover:text-primary transition-colors duration-200",children:r.paymentMethod})]}),t("div",{className:"group p-2.5 sm:p-3 rounded-lg md:bg-gradient-to-tr bg-gradient-to-b from-muted to-background/10 border border-border/30 hover:border-border/60 transition-all duration-200",children:[e("span",{className:"text-xs sm:text-sm text-muted-foreground block mb-1",children:"Order Id"}),e("div",{className:"font-medium text-sm sm:text-base group-hover:text-primary transition-colors duration-200",children:r.transactionId||"N/A"})]})]})]}),e(nn,{className:"my-4 sm:my-6 bg-gradient-to-r from-transparent via-border to-transparent"}),t("div",{className:"flex flex-col sm:flex-row gap-3",children:[s&&e(Bs,{className:"mx-0 shadow-lg hover:shadow-xl transition-all duration-200",...i}),l&&l.canShow&&e(dr,{...l.buttonProps,children:l.text}),o&&e(Ms,{className:"mx-0 shadow-lg hover:shadow-xl transition-all duration-200",...n}),e(Zn,{to:"/plans",children:t(dr,{variant:"outline",children:["Buy Upcoming Plan ",e(De,{})]})})]}),t("div",{className:"pt-4 sm:pt-6",children:[e("h4",{className:"font-medium mb-3 sm:mb-4 text-base sm:text-lg",children:"Current Plan Features"}),e("div",{className:"flex flex-wrap gap-2 sm:gap-3",children:r.plan.features.map((a,r)=>t("div",{className:"group flex items-center gap-2 p-2 sm:p-2 rounded-lg border border-border/80 hover:border-primary/30 hover:bg-primary/5 transition-all duration-200",children:[e("div",{className:"w-1 h-1 sm:w-1.5 sm:h-1.5 rounded-full bg-primary flex-shrink-0 group-hover:bg-primary group-hover:scale-125 transition-all duration-200"}),e("span",{className:"text-xs sm:text-sm text-muted-foreground group-hover:text-foreground transition-colors duration-200",children:a.name})]},r))})]})]})]})})}const Hs=({upcomingPlans:r,Icon:n,title:i,badgeText:s,isFreePlan:l=!1})=>{const{subscriptionConfig:o,orgs:d,featureFlags:c}=y(xa),{plans:m}=o;return t(Cr,{className:"mt-5",children:[e(kr,{children:t(Pr,{className:"flex items-center gap-2 sm:gap-3 text-lg sm:text-xl",children:[e("div",{className:"p-1.5 sm:p-2 rounded-lg bg-primary/10 ring-1 ring-primary/20",children:e(n,{className:"h-4 w-4 sm:h-5 sm:w-5 text-primary"})}),i]})}),e(Ir,{children:e("div",{className:"flex flex-wrap gap-2 sm:gap-3",children:r.length?r.map(r=>{const n=m.find(e=>e.id===r.plan_id);return e("div",{className:"w-full relative p-3 sm:p-4 rounded-xl bg-gradient-to-r from-muted/30 via-muted/20 to-muted/30 border border-border/50 overflow-hidden",children:e("div",{className:"relative",children:e("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 sm:gap-0",children:t("div",{className:"w-full",children:[t("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-3 mb-2",children:[e("div",{className:"flex items-center gap-2",children:t("h3",{className:"text-lg sm:text-xl font-semibold",children:[n?.title," Plan"]})}),t("div",{className:"flex flex-wrap items-center gap-2",children:[t(rn,{variant:"active"===r.status?"default":"outline",className:"shadow-sm text-xs sm:text-sm bg-primary/90 hover:bg-primary border-0 font-medium text-primary-foreground",children:[Sa(r.z_currency),r.amount]}),e(rn,{variant:"outline",className:"shadow-sm text-xs sm:text-sm border-border/60 bg-background/50 backdrop-blur-sm",children:s})]})]}),l?e(a,{children:t("div",{className:"mt-5",children:[e(Zn,{to:"/plans",children:e(ii,{children:"Upgrade to premium"})}),c.ff_enable_teams&&0===d.length&&e(Zn,{to:"/infrastructure/create-new-org",children:t(dr,{className:"ml-2",variant:"outline",children:[e(Ee,{})," Continue with Free Plan"]})})]})}):e("div",{className:"relative",children:t("span",{className:"text-xs sm:text-sm text-muted-foreground relative z-10",children:[t("p",{children:[r.for_no_users," Users for ",r.for_months," Months"]}),t("p",{children:["Start Date: ",ta(r.startAt)]}),t("p",{children:["End Date: ",ta(r.endAt)]}),t("p",{children:["Order Id: ",r.z_order_id]})]})})]})})})},r.z_order_id)}):t("p",{className:"text-center text-muted-foreground",children:["No ",s," Plans"]})})})]},"upcoming-plans")},Ys=T(function({title:a="Congratulations!",subtitle:r="Your payment was successful.",currencySymbol:n="$",price:i,productName:s,proceedButtonText:l="Proceed",backButtonText:o="Back",onProceed:d,onBack:c,className:m,open:u,onOpenChange:p},h){const g=void 0!==u,[f,v]=b(!1),y=g?u:f,N=e=>{g?p?.(e):v(e)};z(h,()=>({open:()=>N(!0),close:()=>N(!1)}),[g,p]);const[w,_]=b(!1);x(()=>{if(y){_(!0);const e=setTimeout(()=>_(!1),2200);return()=>clearTimeout(e)}_(!1)},[y]);const k=C(()=>{const e=[],t=["--primary","--accent","--secondary"];for(let a=0;a<42;a++){const r=100*Math.random(),n=24*(Math.random()-.5);e.push({id:a,x:r,xEnd:Math.max(0,Math.min(100,r+n)),delay:.4*Math.random(),rotation:360*Math.random(),size:6+Math.round(6*Math.random()),colorVar:t[a%t.length]})}return e},[]);return e(Ja,{open:y,onOpenChange:N,children:e(ar,{className:jt("w-[95%] sm:max-w-[560px] p-0 overflow-hidden text-foreground",m),children:t("div",{className:"relative",children:[t("div",{className:"p-7 flex flex-col items-center text-center gap-5",children:[t("div",{className:"relative",children:[e(Nt.div,{className:"absolute inset-0 -z-10 mx-auto size-20 rounded-full blur-xl",style:{background:"var(--primary)",opacity:.12},initial:{scale:.9,opacity:0},animate:{scale:1,opacity:.12},transition:{duration:.5,ease:"easeOut"}}),t("div",{className:"relative",children:[e("div",{className:"size-16 rounded-full bg-primary/10 flex items-center justify-center border border-primary/30 shadow-sm",children:e(Le,{className:"size-10 text-primary"})}),e(Nt.span,{className:"absolute inset-0 rounded-full border-2 border-primary/30",initial:{scale:.9,opacity:.5},animate:{scale:1.25,opacity:0},transition:{duration:1.2,repeat:1/0,ease:"easeOut"}}),e(Nt.span,{className:"absolute inset-0 rounded-full border-2 border-accent/30",initial:{scale:.9,opacity:.5},animate:{scale:1.6,opacity:0},transition:{duration:1.6,repeat:1/0,ease:"easeOut",delay:.2}})]})]}),e(rr,{className:"text-center",children:e(ir,{className:"text-2xl font-semibold",children:a})}),e("p",{className:"text-sm text-muted-foreground max-w-[38ch]",children:r}),t("div",{className:"flex flex-col items-center gap-1",children:[t(Nt.div,{className:"text-4xl font-semibold tracking-tight",initial:{y:6,opacity:0},animate:{y:0,opacity:1},transition:{type:"spring",stiffness:280,damping:22},children:[n,i]}),t("div",{className:"text-xs text-muted-foreground",children:["Paid for ",s]})]}),t(nr,{className:"w-full flex-col sm:flex-col gap-3 mt-1",children:[e(dr,{variant:"outline",className:"w-full",onClick:()=>{c?.(),N(!1)},children:o}),e(dr,{className:"w-full",onClick:()=>{d?.(),N(!1)},children:l})]})]}),e(wt,{children:w&&e(Nt.div,{className:"pointer-events-none absolute inset-0",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},children:k.map(t=>e(Nt.span,{className:"absolute block rounded-[2px]",style:{left:`${t.x}%`,top:"-16px",width:t.size,height:.6*t.size,backgroundColor:`var(${t.colorVar})`},initial:{y:-20,rotate:t.rotation},animate:{y:360+80*Math.random(),x:`${t.xEnd}%`,rotate:t.rotation+720},transition:{duration:1.8+.8*Math.random(),delay:t.delay,ease:"easeOut"}},t.id))})})]})})})}),qs=({isOpen:r,setIsOpen:n,purchasePlanId:i})=>{const{purchasePlans:s,subscriptionConfig:l,loggedInUser:o}=y(xa),{plans:d,CURRENCY_SYMBOL:c,CURRENCY:m}=l,[p,h]=b(1),[g,f]=P(),{Razorpay:x}=kt(),{loadPurchasedPlans:v}=Aa(),N=u(),[w,_]=b(!1),k=C(()=>s.find(e=>e.purchased_id===i),[s,i]),z=C(()=>d.find(e=>e.id===k?.plan_id),[d,k]),S=C(()=>{if(!k||!z)return 0;return(12===k.for_months?parseFloat(z.yearlyPrice):parseFloat(z.monthlyPrice))*p},[k,z,p]);return k&&z?t(cr,{open:r,setIsOpen:n,disableOutsideClick:!0,header:`Add More Users in ${z.title}`,actionsJSX:t(a,{children:[e(dr,{variant:"outline",onClick:()=>{h(1),n(!1)},children:"Cancel"}),e(dr,{onClick:()=>{n(!1),f(async()=>{try{await new Promise(e=>setTimeout(e,200));const e=await ka().post("payment-gateway/add-more-users-order",{purchased_id:i,currency:m,for_no_users:p});await Ta(S,m,e,{name:`${o.fname} ${o.lname}`,email:o.email,contact:o.mobNo?.toString()||""},x),n(!0),_(!0)}catch(e){n(!0),wa({header:"Failed to add users.",description:"Please try again later or contact support if the issue persists."})}finally{v()}})},disabled:p<1,loading:g,children:"Make Payment"})]}),children:[t("div",{className:"space-y-4 pt-4",children:[t("div",{className:"text-sm text-muted-foreground",children:[t("p",{children:[e("span",{className:"font-medium",children:"Order ID:"})," ",k.z_order_id]}),t("p",{children:[e("span",{className:"font-medium",children:"Current Users:"})," ",k.for_no_users]}),t("p",{children:[e("span",{className:"font-medium",children:"Plan Duration:"})," ",12===k.for_months?"Yearly":"Monthly"]})]}),t("div",{className:"space-y-2",children:[e(Ar,{htmlFor:"numberOfUsers",children:"Number of Users to Add"}),e(Or,{id:"numberOfUsers",type:"number",min:"1",value:p,onChange:e=>h(Math.max(1,parseInt(e.target.value)||1)),placeholder:"Enter number of users"})]}),t("div",{className:"rounded-lg bg-muted p-4 space-y-2",children:[t("div",{className:"flex justify-between items-center",children:[e("span",{className:"text-sm font-medium",children:"Price per user:"}),t("span",{className:"text-sm",children:[c,12===k.for_months?z.yearlyPrice:z.monthlyPrice]})]}),t("div",{className:"flex justify-between items-center",children:[e("span",{className:"text-sm font-medium",children:"Number of users:"}),e("span",{className:"text-sm",children:p})]}),e("div",{className:"border-t pt-2 mt-2",children:t("div",{className:"flex justify-between items-center",children:[e("span",{className:"font-semibold",children:"Total Amount:"}),t("span",{className:"text-lg font-bold text-primary",children:[c,S.toFixed(2)]})]})})]})]}),e(Ys,{open:w,onOpenChange:e=>{_(e),e||N("/infrastructure/payment-history")},price:S.toFixed(2),currencySymbol:c,productName:z.title,proceedButtonText:"Go to Dashboard",backButtonText:"Go to Payment History",onProceed:()=>N("/"),onBack:()=>N("/infrastructure/payment-history")})]}):(wa({header:"Failed to load plan details.",description:"Please try again later or contact support if the issue persists."}),null)};var Ks=Object.freeze({__proto__:null,default:()=>{const r=u(),{activePlan:n,purchasePlans:i,subscriptionConfig:s}=y(xa),{plans:l,CURRENCY_SYMBOL:o}=s,[d,c]=b(!1),m=l.find(e=>e.id===n?.plan_id)||l[0],p=C(()=>i.filter(e=>"paid"===e.status&&new Date(e.startAt)>new Date).reverse(),[i]),h=C(()=>i.filter(e=>"paid"===e.status&&new Date(e.endAt)<new Date),[i]),g=!n||Ia(n);return e(Sn,{children:t("div",{className:"pb-5 sm:pl-20 px-2 w-200 mx-auto",children:[g?e(Hs,{upcomingPlans:[n],Icon:ve,title:"Current Subscription",badgeText:"Active",isFreePlan:!0}):t(a,{children:[e(Vs,{currentPlan:{plan:m,type:12===n.for_months?"yearly":"monthly",startDate:ta(n.startAt),expiryDate:ta(n.endAt),paymentMethod:(f=n.z_payment_method,"netbanking"===f?"Net Banking":"wallet"===f?"Wallet":"upi"===f?"UPI":"card"===f?"Card":f),activePlanFor:n.for_no_users,paidAmount:`${o}${n.amount}`,status:"active",transactionId:(()=>{const e=[n.z_order_id];return n.updatedRecords&&n.updatedRecords.forEach(t=>{"paid"===t.status&&e.push(t.z_order_id)}),e.join(", ")})()},canShowCancelPlanBtn:!1,cancelSubscription:{title:"Cancel Subscription",description:"Are you sure you want to cancel your subscription?",plan:m,onCancel:e=>console.log("Subscription cancelled for plan:",e),onKeepSubscription:e=>console.log("Subscription kept for plan:",e)},addMoreBtnProps:{text:"Add more users to your plan",buttonProps:{onClick:()=>c(!0)},canShow:n.for_no_users<m.maxUserRequired},canShowUpdatePlanBtn:!1,updatePlan:{currentPlan:m,plans:l,triggerText:"Change Plan",onPlanChange:(e,t)=>{r(`/infrastructure/checkout?plan=${e}&billing=${t?"yearly":"monthly"}`)}}}),e(qs,{isOpen:d,setIsOpen:c,purchasePlanId:n.purchased_id})]}),e(Hs,{upcomingPlans:p,Icon:Me,title:"Upcoming Plans",badgeText:"Upcoming"}),e(Hs,{upcomingPlans:h,Icon:Re,title:"Expired Plans",badgeText:"Expired"})]})});var f}});const Gs=ft("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}});function Ws({className:t,variant:a,...r}){return e("div",{"data-slot":"alert",role:"alert",className:jt(Gs({variant:a}),t),...r})}function Xs({className:t,...a}){return e("div",{"data-slot":"alert-title",className:jt("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",t),...a})}function Js({className:t,...a}){return e("div",{"data-slot":"alert-description",className:jt("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",t),...a})}var Zs=Object.freeze({__proto__:null,default:()=>{const{Razorpay:r}=kt(),{loggedInUser:n,subscriptionConfig:i,activePlan:l}=y(xa),[o]=h(),d=o.get("plan"),c=o.get("billing")||"yearly",m=(()=>{const[e,t]=b([]);return x(()=>{(async()=>{const e=Ht("countries");if(e)try{const a=JSON.parse(e);if(Array.isArray(a))return void t(a)}catch{}const a=(await ka().get("get-countries")).countries??[];a.length>0&&Vt("countries",JSON.stringify(a)),t(a)})()},[]),e})(),p=u(),[g,f]=b(!1),[v,N]=b(!1),{plans:w,CURRENCY:_,CURRENCY_SYMBOL:C}=i,P=w.find(e=>e.id===d)||w[0],{minUserRequired:z,maxUserRequired:S}=P,[I,T]=b(c),[O,A]=b(z),F=O<=z?z:O,$="yearly"===I?P.yearlyPrice:P.monthlyPrice,D=F*parseFloat($),E="yearly"===I?12:1,L=P.monthlyPrice,M=E*F*parseFloat(L),R=k({fullName:n?.fname+" "+n?.lname,country:"",address:"",email:n?.email,mobileNo:n?.mobNo?.toString()}),{loadPurchasedPlans:j}=Aa();if("0"===P.monthlyPrice||"0"===P.yearlyPrice)return e(s,{to:"/"});return t(Sn,{className:"pb-5",responsive:!0,children:[t("div",{className:"sm:mx-auto mx-1 px-5",children:[t(Hn,{className:"mb-4",children:['Checkout "',P.title,'" Plan'," ",e(Zn,{className:"text-xs text-primary",to:"/plans",children:"Change Plan"})]}),Ia(l)?null:t(Ws,{variant:"default",className:"mb-5",children:[e(Ue,{}),e(Xs,{children:"You currently have an active paid plan."}),e(Js,{children:t("p",{children:["Please be aware that this purchase is for an upcoming plan. Check your"," ",e(Zn,{className:"text-primary",to:"/infrastructure/manage-subscription",children:"current subscription"}),"."]})})]}),t(Sn,{layout:"horizontal",className:"gap-5",responsive:!0,children:[t(Sn,{layout:"vertical",className:"sm:w-150 w-full gap-5",doNotAppendFlex1:!0,responsive:!0,children:[t(Cr,{children:[t(kr,{children:[e(Pr,{children:"Specify billing period and team size"}),e(zr,{children:"With yearly plans, you can save up to 17%."})]}),e(Ir,{children:t("div",{className:"grid gap-6",children:[t("div",{className:"grid gap-2",children:[e(Ar,{children:"Billing period *"}),e(si,{triggerClassName:"w-full",placeholder:"Select billing period",items:[{value:"monthly",label:`Monthly - ${P.planDisplayCost?.monthly}`},{value:"yearly",label:`Yearly - ${P.planDisplayCost?.yearly}`}],value:I,onValueChange:e=>T(e)})]}),z>1?t("div",{className:"grid gap-2",children:[t(Ar,{htmlFor:"teamSize",children:["Team Size (This should be ",z," or > ",z,") *"]}),e(Or,{type:"number",id:"teamSize",placeholder:"",min:z,max:S,value:O,onChange:e=>A(Math.max(z,parseInt(e.target.value)||z))})]}):e(a,{})]})})]}),t(Cr,{children:[t(kr,{children:[e(Pr,{children:"Billing Details"}),e(zr,{children:"To finalize your subscription, kindly complete your details."})]}),e(Ir,{children:t("div",{className:"grid gap-6",children:[t("div",{className:"grid gap-2",children:[e(Ar,{htmlFor:"fullName",children:"Full Name *"}),e(Or,{onChange:e=>R.current.fullName=e.currentTarget.value,id:"fullName",type:"text",placeholder:"",name:"fullName",defaultValue:n?.fname+" "+n?.lname})]}),t("div",{className:"grid gap-2",children:[e(Ar,{htmlFor:"country",children:"Country *"}),e(si,{valueField:"countryCode",labelField:"countryName",triggerClassName:"w-full",placeholder:"",items:m,onValueChange:e=>{R.current.country=e}})]}),t("div",{className:"grid gap-2",children:[e(Ar,{htmlFor:"address",children:"Address *"}),e(Nn,{onChange:e=>R.current.address=e.target.value,id:"address",placeholder:""})]}),t("div",{className:"grid gap-2",children:[e(Ar,{htmlFor:"email",children:"Email *"}),e(Or,{defaultValue:n?.email,onChange:e=>R.current.email=e.target.value,id:"email",type:"email",placeholder:"",name:"email"})]}),t("div",{className:"grid gap-2",children:[e(Ar,{htmlFor:"mobileNo",children:"Mobile No *"}),e(Or,{onChange:e=>R.current.mobileNo=e.target.value,id:"mobileNo",type:"number",placeholder:"",name:"mobileNo",defaultValue:n?.mobNo})]})]})})]})]}),t(Sn,{layout:"vertical",className:"sm:w-80 w-full",doNotAppendFlex1:!0,responsive:!0,children:[t(Cr,{children:[e(kr,{children:e(Pr,{children:"Summary"})}),e(Ir,{children:t("div",{className:"space-y-2",children:[t("div",{className:"flex items-center justify-between text-sm",children:[e("span",{className:"text-muted-foreground",children:"Subtotal"}),t("span",{className:"tabular-nums",children:[C,M.toFixed(2)]})]}),t("div",{className:"flex items-center justify-between text-sm",children:[e("span",{className:"text-muted-foreground",children:"Discount (Yearly)"}),t("span",{className:"tabular-nums",children:["- ",C,(M-D).toFixed(2)]})]}),t("div",{className:"flex items-center justify-between border-t pt-2",children:[e("span",{className:"font-medium",children:"Total"}),t("span",{className:"text-xl font-semibold tabular-nums",children:[C,D.toFixed(2)]})]})]})})]}),t(dr,{className:"mt-5",onClick:async()=>{const e=(()=>{const e={},t=R.current;return t.fullName.trim()||(e.fullName="Full Name is required."),t.country.trim()||(e.country="Country is required."),t.address.trim()?t.address.trim().length<5&&(e.address="Address must be at least 5 characters."):e.address="Address is required.",t.email.trim()?Jt(t.email)||(e.email="Email is invalid."):e.email="Email is required.",t.mobileNo?.toString().trim()?(!/^\d+$/.test(t.mobileNo?.toString())||t.mobileNo?.toString().trim().length<10||t.mobileNo?.toString().trim().length>15)&&(e.mobileNo="Mobile Number is invalid (must be 10-15 digits)."):e.mobileNo="Mobile Number is required.",e})();if(Object.keys(e).length>0)Object.values(e).reverse().forEach(e=>wa({header:"Invalid Billing Details",description:e}));else try{N(!0);const e=await ka().post("payment-gateway/create-order",{planId:P.id,currency:_,billingPeriod:I||"yearly",for_no_users:F,billing_name:R.current.fullName,billing_email:R.current.email,billing_contact_no:R.current.mobileNo,billing_address:R.current.address,billing_country:R.current.country}),t=R.current;await Ta(D,_,e,{name:t.fullName||`${n.fname} ${n.lname}`,email:t.email||n.email,contact:t.mobileNo?.toString()||n.mobNo?.toString()||""},r),f(!0)}catch(e){wa({header:"Payment Failed!",description:e?.message})}finally{await j(),N(!1)}},loading:v,children:["Make Payment ",e(je,{})]})]})]})]}),e(Ys,{open:g,onOpenChange:e=>{f(e),e||p("/infrastructure/payment-history")},price:D.toFixed(2),currencySymbol:C,productName:P.title,proceedButtonText:"Go to Dashboard",backButtonText:"Go to Payment History",onProceed:()=>p("/"),onBack:()=>p("/infrastructure/payment-history")})]})}});function Qs({className:a,title:r="Invoice History",description:n="Your past invoices and payment receipts.",invoices:i,onDownload:s}){if(!i)return null;const l=t=>{switch(t){case"paid":return e(rn,{className:"bg-emerald-600 text-emerald-50 border-emerald-700/40",children:"Paid"});case"refunded":return e(rn,{variant:"secondary",children:"Refunded"});case"idle":return e(rn,{variant:"outline",children:"Open"});case"verified":return e(rn,{variant:"outline",children:"Verified"});case"failed":return e(rn,{variant:"destructive",children:"Failed"})}};return t(Cr,{className:jt("w-full",a),children:[(r||n)&&t(kr,{className:"space-y-1",children:[r&&t(Pr,{className:"text-base font-medium leading-tight truncate flex items-center gap-2 sm:gap-3 text-lg sm:text-xl",children:[e(Be,{className:"h-4 w-4 text-primary"}),r]}),n&&e(zr,{className:"text-sm text-muted-foreground",children:n})]}),e(Ir,{children:t(fr,{children:[e(_r,{className:"sr-only",children:"List of past invoices with dates, amounts, status and download actions"}),e(br,{children:t(yr,{children:[e(Nr,{className:"w-[120px]",children:"Date"}),e(Nr,{className:"text-left",children:"Order ID"}),e(Nr,{children:"Description"}),e(Nr,{className:"text-right",children:"Amount"}),e(Nr,{className:"text-right",children:"Status"}),e(Nr,{className:"text-right",children:"Action"})]})}),t(xr,{children:[0===i.length&&e(yr,{children:e(wr,{colSpan:6,className:"h-24 text-center text-muted-foreground",children:"No invoices yet"})}),i.map(a=>t(yr,{className:"group",children:[e(wr,{className:"text-muted-foreground",children:t("div",{className:"inline-flex items-center gap-2",children:[e(Ve,{className:"h-3.5 w-3.5"}),a.date]})}),e(wr,{className:"text-left",children:a.transactionId}),e(wr,{className:"max-w-[320px]",children:e("div",{className:"truncate",title:a.description||"Invoice",children:a.description||"Invoice"})}),e(wr,{className:"text-right font-medium",children:a.amount}),e(wr,{className:"text-right",children:l(a.status)}),e(wr,{className:"text-right",children:t(dr,{variant:"outline",size:"sm",className:"h-8 text-xs",onClick:()=>a.invoiceUrl?window.open(a.invoiceUrl,"_blank","noopener,noreferrer"):s?.(a.id),"aria-label":`Download invoice ${a.id}`,children:[e(He,{className:"h-3.5 w-3.5"}),"Download"]})})]},a.id))]})]})})]})}var el=Object.freeze({__proto__:null,default:()=>{const{purchasePlans:t,subscriptionConfig:a}=y(xa),{plans:r}=a,n=[];return t.forEach(e=>{const t=r.find(t=>t.id===e.plan_id),a={id:e.z_order_id,date:ta(e.purchased_at),amount:`${Sa(e.z_currency)}${e.old_purchased_amount||e.amount} (${e.z_currency})`,status:e.status,description:`${t?.title} — ${e.for_months} months, ${e.old_purchased_for_no_users||e.for_no_users} users`,transactionId:e.z_order_id};e.updatedRecords&&e.updatedRecords.forEach(t=>{n.push({id:t.z_order_id,date:ta(t.updated_at),amount:`${Sa(t.z_currency)}${t.amount} (${t.z_currency})`,status:t.status,description:`Added ${t.for_no_users} more users, in ${e.z_order_id}`,transactionId:t.z_order_id})}),n.push(a)}),n.sort((e,t)=>new Date(e.date).getTime()-new Date(t.date).getTime()),e(Sn,{children:e("div",{className:"w-full sm:max-w-250 mx-auto",children:e(Qs,{title:"Payment History",description:"Your past payment receipts.",className:"shadow-none border-none",invoices:n.reverse()})})})}});const tl=()=>{const{theme:a,setTheme:r}=fa();return t(Fr,{value:a,onValueChange:e=>{r(e)},children:[e(Dr,{className:"w-[180px]",children:e($r,{placeholder:"Theme"})}),t(Er,{children:[e(Mr,{value:"light",children:"Light"}),e(Mr,{value:"dark",children:"Dark"}),e(Mr,{value:"system",children:"System"})]})]})};var al=Object.freeze({__proto__:null,default:()=>{const{featureFlags:r}=y(xa);return t(Sn,{className:"pr-5 pl-5",children:[t("div",{className:"space-y-3",children:[e(ai,{children:"Email Settings"}),e(ni,{title:"Security emails",description:"Receive emails about your account security.",control:e(Jr,{checked:!0,disabled:!0})})]}),t("div",{className:"space-y-3 mt-4",children:[e(ai,{children:"Theme"}),e(ni,{title:"Specify theme",description:"Choose your preferred theme to enhance your reading experience.",control:e(tl,{})})]}),r?.ff_enable_teams&&t("div",{className:"space-y-3 mt-4",children:[e(ai,{children:t(a,{children:[Lt.account_type_txt.plural," Settings"]})}),e(Zn,{to:"/infrastructure/manage-infra",children:e(ni,{title:`Manage ${Lt.account_type_txt.plural}`,description:`Create and manage ${Lt.account_type_txt.plural}, update ${Lt.account_type_txt.singular} details, and invite members as needed.`,control:e(Ye,{}),labelCls:"cursor-pointer"})}),e(Zn,{to:"/infrastructure/user-invitations",children:e(ni,{title:"Check Invitations",description:`View and respond to ${Lt.account_type_txt.singular} invitations you have received.`,control:e(Ye,{}),labelCls:"cursor-pointer",className:"mt-3"})})]})]})}});export{Xn as AccordionWrapper,ur as AlertDialog,rn as Badge,Qn as BigSquare,dr as Button,Cr as Card,Sr as CardAction,Ir as CardContent,zr as CardDescription,Tr as CardFooter,kr as CardHeader,Pr as CardTitle,Vn as CenterAndMiddle,ui as CopyTextField,Un as DataTable,cr as DialogWrapper,ei as DropdownBtn,ti as DropdownLbl,sn as DropdownMenu,un as DropdownMenuCheckboxItem,dn as DropdownMenuContent,cn as DropdownMenuGroup,mn as DropdownMenuItem,gn as DropdownMenuLabel,ln as DropdownMenuPortal,pn as DropdownMenuRadioGroup,hn as DropdownMenuRadioItem,fn as DropdownMenuSeparator,bn as DropdownMenuShortcut,xn as DropdownMenuSub,yn as DropdownMenuSubContent,vn as DropdownMenuSubTrigger,on as DropdownMenuTrigger,Sn as FlexColsLayout,ya as FullPageLoading,ai as HeaderText,ca as INVITATION_ENUMS,ri as InfoButton,Or as Input,Ar as Label,Zn as LinkWrapper,ni as ListPanel,va as LoadingCmp,zn as LoadingMask,Rn as PaginationWrapper,ii as PremiumHighlighter,oi as RichTextEditor,Fr as Select,Er as SelectContent,Mr as SelectItem,Lr as SelectLabel,si as SelectListWrapper,Rr as SelectSeparator,Dr as SelectTrigger,$r as SelectValue,nn as Separator,Br as Sheet,qr as SheetContent,Wr as SheetDescription,Kr as SheetHeader,Gr as SheetTitle,Vr as SheetTrigger,pr as SideKickClient,xa as SideKickContext,Xr as Skeleton,Jr as Switch,fr as Table,xr as TableBody,_r as TableCaption,wr as TableCell,vr as TableFooter,Nr as TableHead,br as TableHeader,yr as TableRow,wn as Tabs,Pn as TabsContent,Cn as TabsList,kn as TabsTrigger,mi as TabsWrapper,Bn as TabularLayout,Nn as Textarea,Tn as Toolbar,Qr as Tooltip,tn as TooltipContent,Zr as TooltipProvider,en as TooltipTrigger,li as TooltipWrapper,Hn as TypographyHeading,Yn as TypographyP,ci as UrlChangesGuard,jt as cn,ea as convertServerDateToJS,Kt as createIndexedArray,ha as debounce,Gt as defaultAlertConfig,Xt as errorLogger,qt as findNavMenu,aa as formatElapsedTime,ta as formatISODateWithTime24H,na as generatePublicId,la as generateRandom4Digits,ka as getAxiosInstance,Sa as getCurrencySymbol,Ut as getFormDataByFormEl,Ht as getLocalStorage,pa as getModuleNameFromUrl,Jt as isEmailValid,oa as isFunction,ma as isObjectEmpty,Yt as isSameNavItem,da as isTruthyValue,ua as isValidId,sa as mapIncrementBy2,Zt as processEmailsWithValidation,Rt as setAccountType,Mt as setAppInfo,Vt as setLocalStorage,Dt as setNavigationItems,wa as showErrorToast,Na as showSuccessToast,_a as showWarningToast,ia as undoPublicId,gr as updateRolesEnum,mr as useAlertDialog,pi as useFetchData,In as useIsMobile,Wt as validatePassword,Qt as waitTill};
2
2
  //# sourceMappingURL=index.esm.js.map