1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6067],{49247:function(e,a,n){"use strict";n.d(a,{Z:function(){return r}});let r=(0,n(87104).Z)("Pencil",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},91587:function(e,a,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/billing",function(){return n(23025)}])},71669:function(e,a,n){"use strict";n.d(a,{m:function(){return t}});var r=n(651);function t(e){let{icon:a,title:n,subtitle:t,actions:i,className:s=""}=e;return(0,r.jsxs)("div",{className:"flex items-center justify-between gap-4 ".concat(s),children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[a&&(0,r.jsx)(a,{className:"text-zinc-500 h-6 w-6"}),n]}),t&&(0,r.jsx)("p",{className:"text-sm text-white/60 mt-1",children:t})]}),i]})}n(92379)},15451:function(e,a,n){"use strict";n.d(a,{Ol:function(){return l},SZ:function(){return o},Zb:function(){return s},aY:function(){return c},eW:function(){return u},ll:function(){return d}});var r=n(651),t=n(92379),i=n(71663);let s=t.forwardRef((e,a)=>{let{className:n,...t}=e;return(0,r.jsx)("div",{ref:a,className:(0,i.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",n),...t})});s.displayName="Card";let l=t.forwardRef((e,a)=>{let{className:n,...t}=e;return(0,r.jsx)("div",{ref:a,className:(0,i.cn)("flex flex-col space-y-1.5 p-6",n),...t})});l.displayName="CardHeader";let d=t.forwardRef((e,a)=>{let{className:n,...t}=e;return(0,r.jsx)("div",{ref:a,className:(0,i.cn)("text-2xl font-semibold leading-none tracking-tight",n),...t})});d.displayName="CardTitle";let o=t.forwardRef((e,a)=>{let{className:n,...t}=e;return(0,r.jsx)("div",{ref:a,className:(0,i.cn)("text-sm text-muted-foreground",n),...t})});o.displayName="CardDescription";let c=t.forwardRef((e,a)=>{let{className:n,...t}=e;return(0,r.jsx)("div",{ref:a,className:(0,i.cn)("p-6 pt-0",n),...t})});c.displayName="CardContent";let u=t.forwardRef((e,a)=>{let{className:n,...t}=e;return(0,r.jsx)("div",{ref:a,className:(0,i.cn)("flex items-center p-6 pt-0",n),...t})});u.displayName="CardFooter"},42248:function(e,a,n){"use strict";n.d(a,{NI:function(){return p},Wi:function(){return u},l0:function(){return o},lX:function(){return h},xJ:function(){return f},zG:function(){return j}});var r=n(651),t=n(92379),i=n(93555),s=n(25109),l=n(71663),d=n(29440);let o=s.RV,c=t.createContext({}),u=e=>{let{...a}=e;return(0,r.jsx)(c.Provider,{value:{name:a.name},children:(0,r.jsx)(s.Qr,{...a})})},m=()=>{let e=t.useContext(c),a=t.useContext(x),{getFieldState:n,formState:r}=(0,s.Gc)(),i=n(e.name,r);if(!e)throw Error("useFormField should be used within <FormField>");let{id:l}=a;return{id:l,name:e.name,formItemId:"".concat(l,"-form-item"),formDescriptionId:"".concat(l,"-form-item-description"),formMessageId:"".concat(l,"-form-item-message"),...i}},x=t.createContext({}),f=t.forwardRef((e,a)=>{let{className:n,...i}=e,s=t.useId();return(0,r.jsx)(x.Provider,{value:{id:s},children:(0,r.jsx)("div",{ref:a,className:(0,l.cn)("space-y-2",n),...i})})});f.displayName="FormItem";let h=t.forwardRef((e,a)=>{let{className:n,...t}=e,{error:i,formItemId:s}=m();return(0,r.jsx)(d._,{ref:a,className:(0,l.cn)(i&&"text-destructive",n),htmlFor:s,...t})});h.displayName="FormLabel";let p=t.forwardRef((e,a)=>{let{...n}=e,{error:t,formItemId:s,formDescriptionId:l,formMessageId:d}=m();return(0,r.jsx)(i.g7,{ref:a,id:s,"aria-describedby":t?"".concat(l," ").concat(d):"".concat(l),"aria-invalid":!!t,...n})});p.displayName="FormControl",t.forwardRef((e,a)=>{let{className:n,...t}=e,{formDescriptionId:i}=m();return(0,r.jsx)("p",{ref:a,id:i,className:(0,l.cn)("text-sm text-muted-foreground",n),...t})}).displayName="FormDescription";let j=t.forwardRef((e,a)=>{let{className:n,children:t,...i}=e,{error:s,formMessageId:d}=m(),o=s?String(null==s?void 0:s.message):t;return o?(0,r.jsx)("p",{ref:a,id:d,className:(0,l.cn)("text-sm font-medium text-destructive",n),...i,children:o}):null});j.displayName="FormMessage"},29440:function(e,a,n){"use strict";n.d(a,{_:function(){return o}});var r=n(651),t=n(92379),i=n(62266),s=n(34990),l=n(71663);let d=(0,s.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),o=t.forwardRef((e,a)=>{let{className:n,...t}=e;return(0,r.jsx)(i.f,{ref:a,className:(0,l.cn)(d(),n),...t})});o.displayName=i.f.displayName},23500:function(e,a,n){"use strict";n.d(a,{Bw:function(){return h},Ph:function(){return c},Ql:function(){return p},i4:function(){return m},ki:function(){return u}});var r=n(651),t=n(92379),i=n(2703),s=n(87545),l=n(29543),d=n(42657),o=n(71663);let c=i.fC;i.ZA;let u=i.B4,m=t.forwardRef((e,a)=>{let{className:n,children:t,...l}=e;return(0,r.jsxs)(i.xz,{ref:a,className:(0,o.cn)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm r
1ing-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",n),...l,children:[t,(0,r.jsx)(i.JO,{asChild:!0,children:(0,r.jsx)(s.Z,{className:"h-4 w-4 opacity-50"})})]})});m.displayName=i.xz.displayName;let x=t.forwardRef((e,a)=>{let{className:n,...t}=e;return(0,r.jsx)(i.u_,{ref:a,className:(0,o.cn)("flex cursor-default items-center justify-center py-1",n),...t,children:(0,r.jsx)(l.Z,{className:"h-4 w-4"})})});x.displayName=i.u_.displayName;let f=t.forwardRef((e,a)=>{let{className:n,...t}=e;return(0,r.jsx)(i.$G,{ref:a,className:(0,o.cn)("flex cursor-default items-center justify-center py-1",n),...t,children:(0,r.jsx)(s.Z,{className:"h-4 w-4"})})});f.displayName=i.$G.displayName;let h=t.forwardRef((e,a)=>{let{className:n,children:t,position:s="popper",...l}=e;return(0,r.jsx)(i.h_,{children:(0,r.jsxs)(i.VY,{ref:a,className:(0,o.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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","popper"===s&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",n),position:s,...l,children:[(0,r.jsx)(x,{}),(0,r.jsx)(i.l_,{className:(0,o.cn)("p-1","popper"===s&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),(0,r.jsx)(f,{})]})})});h.displayName=i.VY.displayName,t.forwardRef((e,a)=>{let{className:n,...t}=e;return(0,r.jsx)(i.__,{ref:a,className:(0,o.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",n),...t})}).displayName=i.__.displayName;let p=t.forwardRef((e,a)=>{let{className:n,children:t,...s}=e;return(0,r.jsxs)(i.ck,{ref:a,className:(0,o.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n),...s,children:[(0,r.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,r.jsx)(i.wU,{children:(0,r.jsx)(d.Z,{className:"h-4 w-4"})})}),(0,r.jsx)(i.eT,{children:t})]})});p.displayName=i.ck.displayName,t.forwardRef((e,a)=>{let{className:n,...t}=e;return(0,r.jsx)(i.Z0,{ref:a,className:(0,o.cn)("-mx-1 my-1 h-px bg-muted",n),...t})}).displayName=i.Z0.displayName},35480:function(e,a,n){"use strict";n.d(a,{RM:function(){return d},SC:function(){return o},iA:function(){return s},pj:function(){return u},ss:function(){return c},xD:function(){return l}});var r=n(651),t=n(92379),i=n(71663);let s=t.forwardRef((e,a)=>{let{className:n,...t}=e;return(0,r.jsx)("div",{className:"relative w-full overflow-auto",children:(0,r.jsx)("table",{ref:a,className:(0,i.cn)("w-full caption-bottom text-sm",n),...t})})});s.displayName="Table";let l=t.forwardRef((e,a)=>{let{className:n,...t}=e;return(0,r.jsx)("thead",{ref:a,className:(0,i.cn)("[&_tr]:border-b",n),...t})});l.displayName="TableHeader";let d=t.forwardRef((e,a)=>{let{className:n,...t}=e;return(0,r.jsx)("tbody",{ref:a,className:(0,i.cn)("[&_tr:last-child]:border-0",n),...t})});d.displayName="TableBody",t.forwardRef((e,a)=>{let{className:n,...t}=e;return(0,r.jsx)("tfoot",{ref:a,className:(0,i.cn)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",n),...t})}).displayName="TableFooter";let o=t.forwardRef((e,a)=>{let{className:n,...t}=e;return(0,r.jsx)("tr",{ref:a,className:(0,i.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",n),...t})});o.displayName="TableRow";let c=t.forwardRef((e,a)=>{let{className:n,...t}=e;return(0,r.jsx)("th",{ref:a,className:(0,i.cn)("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",n),...t})});c.displayName="TableHead";let u=t.forwardRef((e,a)=>{let{className:n,...t}=e;return(0,r.jsx)("td",{ref:a,className:(0,i.cn)("p-4 align-middle [&:has([role=checkbox])]:pr-0",n),...t})});u.displayName="TableCell",t.forwardRef((e,a)=>{let{className:n,...t}=e;return(0,r.jsx)("caption",{ref:a,className:(0,i.cn)("mt-4 text-sm text-muted-foreground",n),...t})}).displayName="TableCaption"},23025:function(e,a,n){"use strict";n.r(a),n.d(a,{__N_SSP:function(){return I},default:function(){return M}});var r=n(651),t=n(52990),i=n(71669),s=n(25109),l=n(85359),d=n(70845),o=n(42248),c=n(6203),u=n(92379),m=n(15451),x=n(12446),f=n(23500),h=n(46969),p=n(49247);let j={BD:"Bangladesh",BE:"Belgium",BF:"Burkina Faso",BG:"Bulgaria",BA:"Bosnia and Herzegovina",BB:"Barbados",WF:"Wallis and Futuna",BL:"Saint Barthelemy",BM:"Bermuda",BN:"Brunei",BO:"Bolivia",BH:"Bahrain",BI:"Burundi",BJ:"Benin",BT:"Bhutan",JM:"Jamaica",BV:"Bouvet Island",BW:"Botswana",WS:"Samoa",BQ:"Bonaire, Saint Eustatius and Saba ",BR:"Brazil",BS:"Bahamas",JE:"Jersey",BY:"Belarus",BZ:"Belize",RU:"Russia",RW:"Rwanda",RS:"Serb
1ia",TL:"East Timor",RE:"Reunion",TM:"Turkmenistan",TJ:"Tajikistan",RO:"Romania",TK:"Tokelau",GW:"Guinea-Bissau",GU:"Guam",GT:"Guatemala",GS:"South Georgia and the South Sandwich Islands",GR:"Greece",GQ:"Equatorial Guinea",GP:"Guadeloupe",JP:"Japan",GY:"Guyana",GG:"Guernsey",GF:"French Guiana",GE:"Georgia",GD:"Grenada",GB:"United Kingdom",GA:"Gabon",SV:"El Salvador",GN:"Guinea",GM:"Gambia",GL:"Greenland",GI:"Gibraltar",GH:"Ghana",OM:"Oman",TN:"Tunisia",JO:"Jordan",HR:"Croatia",HT:"Haiti",HU:"Hungary",HK:"Hong Kong",HN:"Honduras",HM:"Heard Island and McDonald Islands",VE:"Venezuela",PR:"Puerto Rico",PS:"Palestinian Territory",PW:"Palau",PT:"Portugal",SJ:"Svalbard and Jan Mayen",PY:"Paraguay",IQ:"Iraq",PA:"Panama",PF:"French Polynesia",PG:"Papua New Guinea",PE:"Peru",PK:"Pakistan",PH:"Philippines",PN:"Pitcairn",PL:"Poland",PM:"Saint Pierre and Miquelon",ZM:"Zambia",EH:"Western Sahara",EE:"Estonia",EG:"Egypt",ZA:"South Africa",EC:"Ecuador",IT:"Italy",VN:"Vietnam",SB:"Solomon Islands",ET:"Ethiopia",SO:"Somalia",ZW:"Zimbabwe",SA:"Saudi Arabia",ES:"Spain",ER:"Eritrea",ME:"Montenegro",MD:"Moldova",MG:"Madagascar",MF:"Saint Martin",MA:"Morocco",MC:"Monaco",UZ:"Uzbekistan",MM:"Myanmar",ML:"Mali",MO:"Macao",MN:"Mongolia",MH:"Marshall Islands",MK:"Macedonia",MU:"Mauritius",MT:"Malta",MW:"Malawi",MV:"Maldives",MQ:"Martinique",MP:"Northern Mariana Islands",MS:"Montserrat",MR:"Mauritania",IM:"Isle of Man",UG:"Uganda",TZ:"Tanzania",MY:"Malaysia",MX:"Mexico",IL:"Israel",FR:"France",IO:"British Indian Ocean Territory",SH:"Saint Helena",FI:"Finland",FJ:"Fiji",FK:"Falkland Islands",FM:"Micronesia",FO:"Faroe Islands",NI:"Nicaragua",NL:"Netherlands",NO:"Norway",NA:"Namibia",VU:"Vanuatu",NC:"New Caledonia",NE:"Niger",NF:"Norfolk Island",NG:"Nigeria",NZ:"New Zealand",NP:"Nepal",NR:"Nauru",NU:"Niue",CK:"Cook Islands",XK:"Kosovo",CI:"Ivory Coast",CH:"Switzerland",CO:"Colombia",CN:"China",CM:"Cameroon",CL:"Chile",CC:"Cocos Islands",CA:"Canada",CG:"Republic of the Congo",CF:"Central African Republic",CD:"Democratic Republic of the Congo",CZ:"Czech Republic",CY:"Cyprus",CX:"Christmas Island",CR:"Costa Rica",CW:"Curacao",CV:"Cape Verde",CU:"Cuba",SZ:"Swaziland",SY:"Syria",SX:"Sint Maarten",KG:"Kyrgyzstan",KE:"Kenya",SS:"South Sudan",SR:"Suriname",KI:"Kiribati",KH:"Cambodia",KN:"Saint Kitts and Nevis",KM:"Comoros",ST:"Sao Tome and Principe",SK:"Slovakia",KR:"South Korea",SI:"Slovenia",KP:"North Korea",KW:"Kuwait",SN:"Senegal",SM:"San Marino",SL:"Sierra Leone",SC:"Seychelles",KZ:"Kazakhstan",KY:"Cayman Islands",SG:"Singapore",SE:"Sweden",SD:"Sudan",DO:"Dominican Republic",DM:"Dominica",DJ:"Djibouti",DK:"Denmark",VG:"British Virgin Islands",DE:"Germany",YE:"Yemen",DZ:"Algeria",US:"United States",UY:"Uruguay",YT:"Mayotte",UM:"United States Minor Outlying Islands",LB:"Lebanon",LC:"Saint Lucia",LA:"Laos",TV:"Tuvalu",TW:"Taiwan",TT:"Trinidad and Tobago",TR:"Turkey",LK:"Sri Lanka",LI:"Liechtenstein",LV:"Latvia",TO:"Tonga",LT:"Lithuania",LU:"Luxembourg",LR:"Liberia",LS:"Lesotho",TH:"Thailand",TF:"French Southern Territories",TG:"Togo",TD:"Chad",TC:"Turks and Caicos Islands",LY:"Libya",VA:"Vatican",VC:"Saint Vincent and the Grenadines",AE:"United Arab Emirates",AD:"Andorra",AG:"Antigua and Barbuda",AF:"Afghanistan",AI:"Anguilla",VI:"U.S. Virgin Islands",IS:"Iceland",IR:"Iran",AM:"Armenia",AL:"Albania",AO:"Angola",AQ:"Antarctica",AS:"American Samoa",AR:"Argentina",AU:"Australia",AT:"Austria",AW:"Aruba",IN:"India",AX:"Aland Islands",AZ:"Azerbaijan",IE:"Ireland",ID:"Indonesia",UA:"Ukraine",QA:"Qatar",MZ:"Mozambique"};function N(e){let{data:a,onEdit:n}=e;return(0,r.jsxs)(m.Zb,{children:[(0,r.jsxs)(m.Ol,{className:"flex flex-row items-center justify-between",children:[(0,r.jsx)(m.ll,{children:"Billing Information"}),(0,r.jsx)(d.z,{variant:"ghost",size:"icon",onClick:n,children:(0,r.jsx)(p.Z,{className:"h-4 w-4"})})]}),(0,r.jsxs)(m.aY,{className:"space-y-4",children:[(0,r.jsxs)("div",{className:"grid gap-2",children:[(0,r.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Company Name"}),(0,r.jsx)("div",{children:a.company_name||"â"})]}),(0,r.jsxs)("div",{className:"grid gap-2",children:[(0,r.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Address"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{children:a.address_line1}),a.address_line2&&(0,r.jsx)("div",{children:a.address_line2}),(0,r.jsx)("div",{children:"".concat(a.city).concat(a.state?", ".concat(a.state):""," ").concat(a.postal_code||"")}),(0,r.jsx)("div",{children:j[a.country]})]})]}
1),a.tax_id&&(0,r.jsxs)("div",{className:"grid gap-2",children:[(0,r.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:"Tax ID"}),(0,r.jsx)("div",{children:a.tax_id})]})]})]})}function y(e){let{onSuccess:a,onCancel:n,initialData:t}=e,{toast:i}=(0,l.pm)(),[x,h]=(0,u.useState)(!1),p=(0,s.cI)({values:t||{company_name:"",address_line1:"",address_line2:"",city:"",state:"",postal_code:"",country:"",tax_id:""}});async function N(e){h(!0);try{let n=await fetch("/api/v1/billing",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok){let e=await n.json();throw Error(e.message)}i({title:"Success",description:"Billing information has been updated"}),null==a||a()}catch(e){console.error("Failed to update billing info:",e),i({title:"Error",description:e instanceof Error?e.message:"Failed to update billing information",variant:"destructive"})}finally{h(!1)}}return(0,u.useEffect)(()=>{t&&p.reset(t)},[t,p]),(0,r.jsxs)(m.Zb,{children:[(0,r.jsx)(m.Ol,{children:(0,r.jsx)(m.ll,{children:"Billing Information"})}),(0,r.jsx)(m.aY,{children:(0,r.jsx)(o.l0,{...p,children:(0,r.jsxs)("form",{onSubmit:p.handleSubmit(N),className:"space-y-4",children:[(0,r.jsx)(o.Wi,{control:p.control,name:"company_name",render:e=>{let{field:a}=e;return(0,r.jsxs)(o.xJ,{children:[(0,r.jsx)(o.lX,{children:"Company Name"}),(0,r.jsx)(o.NI,{children:(0,r.jsx)(c.I,{placeholder:"Company name",...a})}),(0,r.jsx)(o.zG,{})]})}}),(0,r.jsx)(o.Wi,{control:p.control,name:"address_line1",render:e=>{let{field:a}=e;return(0,r.jsxs)(o.xJ,{children:[(0,r.jsx)(o.lX,{children:"Address Line 1"}),(0,r.jsx)(o.NI,{children:(0,r.jsx)(c.I,{placeholder:"Address Line 1",...a})}),(0,r.jsx)(o.zG,{})]})}}),(0,r.jsx)(o.Wi,{control:p.control,name:"address_line2",render:e=>{let{field:a}=e;return(0,r.jsxs)(o.xJ,{children:[(0,r.jsx)(o.lX,{children:"Address Line 2"}),(0,r.jsx)(o.NI,{children:(0,r.jsx)(c.I,{placeholder:"Address Line 2 (optional)",...a})}),(0,r.jsx)(o.zG,{})]})}}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,r.jsx)(o.Wi,{control:p.control,name:"city",render:e=>{let{field:a}=e;return(0,r.jsxs)(o.xJ,{children:[(0,r.jsx)(o.lX,{children:"City"}),(0,r.jsx)(o.NI,{children:(0,r.jsx)(c.I,{placeholder:"City",...a})}),(0,r.jsx)(o.zG,{})]})}}),(0,r.jsx)(o.Wi,{control:p.control,name:"state",render:e=>{let{field:a}=e;return(0,r.jsxs)(o.xJ,{children:[(0,r.jsx)(o.lX,{children:"State/Province"}),(0,r.jsx)(o.NI,{children:(0,r.jsx)(c.I,{placeholder:"State",...a})}),(0,r.jsx)(o.zG,{})]})}})]}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,r.jsx)(o.Wi,{control:p.control,name:"postal_code",render:e=>{let{field:a}=e;return(0,r.jsxs)(o.xJ,{children:[(0,r.jsx)(o.lX,{children:"Postal Code"}),(0,r.jsx)(o.NI,{children:(0,r.jsx)(c.I,{placeholder:"Postal code",...a})}),(0,r.jsx)(o.zG,{})]})}}),(0,r.jsx)(o.Wi,{control:p.control,name:"country",render:e=>{let{field:a}=e;return(0,r.jsxs)(o.xJ,{children:[(0,r.jsx)(o.lX,{children:"Country"}),(0,r.jsxs)(f.Ph,{onValueChange:a.onChange,defaultValue:a.value,children:[(0,r.jsx)(o.NI,{children:(0,r.jsx)(f.i4,{children:(0,r.jsx)(f.ki,{placeholder:"Country"})})}),(0,r.jsx)(f.Bw,{children:Object.entries(j).map(e=>{let[a,n]=e;return(0,r.jsx)(f.Ql,{value:a,children:n},a)})})]}),(0,r.jsx)(o.zG,{})]})}})]}),(0,r.jsx)(o.Wi,{control:p.control,name:"tax_id",render:e=>{let{field:a}=e;return(0,r.jsxs)(o.xJ,{children:[(0,r.jsx)(o.lX,{children:"Tax ID"}),(0,r.jsx)(o.NI,{children:(0,r.jsx)(c.I,{placeholder:"Tax ID (optional)",...a})}),(0,r.jsx)(o.zG,{})]})}}),(0,r.jsxs)("div",{className:"flex justify-end gap-4",children:[n&&(0,r.jsx)(d.z,{type:"button",variant:"outline",onClick:n,children:"Cancel"}),(0,r.jsx)(d.z,{type:"submit",disabled:x,children:x?"Saving...":"Save Billing Information"})]})]})})})]})}function g(){let[e,a]=(0,u.useState)(!1),{data:n,mutate:t}=(0,x.ZP)("/api/v1/billing",h._),i=async()=>{await t(),a(!1)};return n?e?(0,r.jsx)(y,{initialData:n,onSuccess:i,onCancel:()=>a(!1)}):(0,r.jsx)(N,{data:n,onEdit:()=>a(!0)}):(0,r.jsx)(y,{onSuccess:i})}var b=n(35480),v=n(71663),w=n(23767);function S(){let{data:e,error:a}=(0,x.ZP)("/api/v1/payments",h._),{toast:n}=(0,l.pm)(),[t,i]=(0,u.useState)({}),s=async(e,a)=>{i(n=>({...n,[e.id]:{...n[e.id],[a]:!0}}));try{let r=await fetch("/api/v1/invoice?type=".concat(a,"&payment_id=").concat(e.id),{method:"GET"});if(!r.ok){let e=await r.json();throw Error(e.message)}let t=await r.blob(),i=window.URL.createObjectURL(t),s=document.createElement("a");s.href=i,s.download="".concat(a,"-").concat(e.gateway_payment_id,".pdf"),document.body.appendChild(s),s.click(),window.URL.revokeObjectURL(i),document.body.removeChild(s),n({title:"Success",description:"".concat(a.charAt(0).toUpperCase()+a.slice(1)," downloaded successfully")})}catch(e){console.error("Download error:",e),n({title:"Error",description:e instanceof Error?e.message:"Failed to download document",variant:"destructive"})}finally{i(n=>({...n,[e.id]:{...n[e.id],[a]:!1}}))}};return a?(0,r.jsxs)(m.Zb,{children:[(0,r.jsx)(m.Ol,{children:(0,r.jsx)(m.ll,{children:"Payment History"})}),(0,r.jsx)(m.aY,{children:(0,r.jsx)("div",{className:"text-sm text-red-500",children:"Failed to load payment history"})})]}):e?(0,r.jsxs)(m.Zb,{children:[(0,r.jsx)(m.Ol,{children:(0,r.jsx)(m.ll,{children:"Payment History"})}),(0,r.jsxs)(m.aY,{children:[(0,r.jsxs)(b.iA,{children:[(0,r.jsx)(b.xD,{children:(0,r.jsxs)(b.SC,{children:[(0,r.jsx)(b.ss,{children:"Date"}),(0,r.jsx)(b.ss,{children:"Amount"}),(0,r.jsx)(b.ss,{children:"Status"}),(0,r.jsx)(b.ss,{children:"Documents"})]})}),(0,r.jsx)(b.RM,{children:e.map(e=>{var a,n,i,l;return(0,r.jsxs)(b.SC,{children:[(0,r.jsx)(b.pj,{children:(0,v.p6)(new Date(e.created_at))}),(0,r.jsx)(b.pj,{children:new Intl.NumberFormat("en-US",{style:"currency",currency:e.currency}).format(e.amount/100)}),(0,r.jsx)(b.pj,{children:(0,r.jsx)("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ".concat("COMPLETED"===e.status?"bg-green-100 text-green-800":"pending"===e.status?"bg-yellow-100 text-yellow-800":"bg-red-100 text-red-800"),children:e.status})}),(0,r.jsx)(b.pj,{children:"COMPLETED"===e.status&&(0,r.jsxs)("div",{className:"flex space-x-2",children:[(0,r.jsxs)(d.z,{variant:"outline",size:"sm",onClick:()=>s(e,"invoice"),disabled:null===(a=t[e.id])||void 0===a?void 0:a.invoice,children:[(null===(n=t[e.id])||void 0===n?void 0:n.invoice)?(0,r.jsx)(w.frZ,{className:"h-4 w-4 animate-spin mr-1"}):null,"Invoice"]}),(0,r.jsxs)(d.z,{variant:"outline",size:"sm",onClick:()=>s(e,"receipt"),disabled:null===(i=t[e.id])||void 0===i?void 0:i.receipt,children:[(null===(l=t[e.id])||void 0===l?void 0:l.receipt)?(0,r.jsx)(w.frZ,{className:"h-4 w-4 animate-spin mr-1"}):null,"Receipt"]})]})})]},e.id)})})]}),0===e.length&&(0,r.jsx)("div",{className:"text-center py-4 text-sm text-gray-500",children:"No payment history available"})]})]}):(0,r.jsxs)(m.Zb,{children:[(0,r.jsx)(m.Ol,{children:(0,r.jsx)(m.ll,{children:"Payment History"})}),(0,r.jsx)(m.aY,{children:(0,r.jsx)("div",{className:"flex items-center justify-center py-4",children:(0,r.jsx)(w.frZ,{className:"h-6 w-6 animate-spin text-gray-500"})})})]})}var C=n(48704),I=!0;function M(){return(0,r.jsx)(t.Z,{children:(0,r.jsxs)("div",{className:"flex flex-col gap-6 p-6",children:[(0,r.jsx)(i.m,{icon:C.XiQ,title:"Billing"}),(0,r.jsx)(g,{}),(0,r.jsx)(S,{})]})})}},62266:function(e,a,n){"use strict";n.d(a,{f:function(){return l}});var r=n(92379),t=n(58039),i=n(651),s=r.forwardRef((e,a)=>(0,i.jsx)(t.WV.label,{...e,ref:a,onMouseDown:a=>{a.target.closest("button, input, select, textarea")||(e.onMouseDown?.(a),!a.defaultPrevented&&a.detail>1&&a.preventDefault())}}));s.displayName="Label";var l=s}},function(e){e.O(0,[3623,9017,3416,8101,5193,7649,5109,1773,1929,2990,2888,9774,179],function(){return e(e.s=91587)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.