import{w as i,aD as m,an as u,ap as p,aH as c,x as d,av as l,cc as f,k as x,a2 as j,j as r,T as o}from"./main-TIUJvpaR.js";import{B as g,a as n}from"./breadcrumb-B7oVkzG6.js";import{C}from"./crupdate-resource-layout-CYzZacgj.js";import{C as P}from"./crupdate-plan-form-CsCsVu9O.js";import"./useEffectEvent-Bgk8rSJ3.js";import"./ChevronRight-BaJkMP9s.js";import"./MoreHoriz-Cm8ZCxuL.js";import"./datatable-page-with-header-layout-Bbr3vl7W.js";import"./dashboard-layout-context-DA6Q35rI.js";import"./use-toggle-dashboard-left-sidebar-BuzWlDo2.js";import"./permission-selector-CHlyRAPq.js";import"./accordion-CabB8onw.js";import"./switch-Bj7wwiPq.js";import"./list-DlNGU0yW.js";import"./uc-first-pSl3nM3z.js";import"./formatted-price-BnJL0Dzb.js";import"./select-T49HzTXy.js";import"./Add-CRE_6SK0.js";function v(e){const{trans:a}=i(),t=m();return u({mutationFn:s=>y(s),onSuccess:()=>{c(a(d("Plan created"))),l.invalidateQueries({queryKey:f.products.invalidateKey}),t("/admin/plans")},onError:s=>p(s,e)})}function y(e){const a={...e,feature_list:e.feature_list.map(t=>t.value)};return x.post("billing/products",a).then(t=>t.data)}function D(){const e=j({defaultValues:{free:!1,recommended:!1}}),a=v(e);return r.jsx(C,{form:e,onSubmit:t=>{a.mutate(t)},title:r.jsxs(g,{size:"xl",children:[r.jsx(n,{to:"/admin/plans",children:r.jsx(o,{message:"Plans"})}),r.jsx(n,{children:r.jsx(o,{message:"New plan"})})]}),isLoading:a.isPending,children:r.jsx(P,{})})}export{D as Component};
