1"use strict";(self.webpackChunkStammer_ai=self.webpackChunkStammer_ai||[]).push([[2455],{47940:function(e,n,t){var r=t(81056),i=t(78685);n.A=(0,r.A)((0,i.jsx)("path",{d:"M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96M14 13v4h-4v-4H7l5-5 5 5z"}),"CloudUpload")},18009:function(e,n,t){var r=t(81056),i=t(78685);n.A=(0,r.A)((0,i.jsx)("path",{d:"M20 4H4c-1.11 0-1.99.89-1.99 2L2 18c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V6c0-1.11-.89-2-2-2m0 14H4v-6h16zm0-10H4V6h16z"}),"CreditCard")},52280:function(e,n,t){var r=t(81056),i=t(78685);n.A=(0,r.A)((0,i.jsx)("path",{d:"m14.06 9.02.92.92L5.92 19H5v-.92zM17.66 3c-.25 0-.51.1-.7.29l-1.83 1.83 3.75 3.75 1.83-1.83c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.2-.2-.45-.29-.71-.29m-3.6 3.19L3 17.25V21h3.75L17.81 9.94z"}),"EditOutlined")},46200:function(e,n,t){var r=t(2057),i=t(26400),a=t(78685);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function s(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function l(e,n,t){return(n=function(e){var n=function(e,n){if("object"!=o(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,n||"default");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}(e,"string");return"symbol"==o(n)?n:n+""}(n))in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var c=!1;n.A=r.forwardRef((function(e,n){return c||(console.warn(["MUI: The LoadingButton component functionality is now part of the Button component from Material UI.","","You should use `import Button from '@mui/material/Button'`","or `import { Button } from '@mui/material'`"].join("\n")),c=!0),(0,a.jsx)(i.A,function(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?s(Object(t),!0).forEach((function(n){l(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):s(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}({ref:n},e))}))},42259:function(e,n,t){t.d(n,{l:function(){return d}});var r=t(78685),i=(t(2057),t(86591)),a=t(69179),o=t(16657),s=t(17e3),l=t(16003),c=t(64223);function d(){var e=(0,o.Bd)().t,n=(0,s.zy)(),t=(0,s.ok)()[0].get("tab")||"dashboard_settings",d=(0,i.I)({queryKey:["shell-layout-payload"],queryFn:c.V,staleTime:3e4}).data,u=n.pathname===l.b.AGENCY_PROFILE,x=n.pathname===l.b.AGENCY_SAAS_CONFIGURATOR||n.pathname===l.b.AGENCY_PACKAGE_CREATE||Boolean((0,s.B6)(l.b.AGENCY_PACKAGE_UPDATE,n.pathname)),h=null==d?void 0:d.links.whiteLabelDocs,p=[{key:"dashboard_settings",label:e("DISPLAY_LABELS.SHELL_DASHBOARD_SETTINGS"),to:"".concat(l.b.AGENCY_PROFILE,"?tab=dashboard_settings"),isActive:u&&"dashboard_settings"===t},{key:"custom_domain",label:e("DISPLAY_LABELS.SHELL_CUSTOM_DOMAIN"),to:"".concat(l.b.AGENCY_PROFILE,"?tab=custom_domain"),isActive:u&&"custom_domain"===t},{key:"custom_styling",label:e("DISPLAY_LABELS.SHELL_CUSTOM_STYLING"),to:"".concat(l.b.AGENCY_PROFILE,"?tab=custom_styling"),isActive:u&&"custom_styling"===t},{key:"stripe_integration",label:e("DISPLAY_LABELS.SHELL_STRIPE_INTEGRATION"),to:"".concat(l.b.AGENCY_PROFILE,"?tab=stripe_integration"),isActive:u&&"stripe_integration"===t},{key:"stripe_configuration",label:e("DISPLAY_LABELS.SHELL_SAAS_CONFIGURATOR"),to:l.b.AGENCY_SAAS_CONFIGURATOR,isActive:x}];return(0,r.jsx)(a.azJ,{sx:{display:"grid",gap:2},children:(0,r.jsxs)(a.azJ,{sx:{display:"flex",flexWrap:"wrap",gap:0,borderBottom:1,borderColor:"divider",overflowX:"auto"},children:[p.map((function(e){var n=e.isActive;return(0,r.jsx)(a.$nd,{component:s.N_,to:e.to,sx:{borderRadius:0,px:2,py:1.25,borderBottom:n?2:0,borderColor:n?"primary.main":"transparent",color:n?"primary.main":"text.secondary",fontWeight:n?600:500,whiteSpace:"nowrap",textDecoration:"none","&:hover":{textDecoration:"none"}},children:e.label},e.key)})),(0,r.jsx)(a.$nd,{component:"a",href:h,target:"_blank",rel:"noopener noreferrer",sx:{borderRadius:0,px:2,py:1.25,borderBottom:0,color:"text.secondary",fontWeight:500,whiteSpace:"nowrap",textDecoration:"none","&:hover":{textDecoration:"none"}},children:e("DISPLAY_LABELS.SHELL_WHITE_LABEL_DOCS")})]})})}},29717:function(e,n,t){t.d(n,{$N:function(){return d},CE:function(){return x},Xw:function(){return u},f6:function(){return p},jH:function(){return h}});var r=t(80202),i=t(21762),a=t(60551),o=t(69818),s=t(86591),l=function(e,n,t,r){return new(t||(t=Promise))((function(i,a){function o(e){try{l(r.next(e))}catch(e){a(e)}}function s(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(o,s)}l((r=r.apply(e,n||[])).next())}))},c=function(e,n){var t,r,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(t=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=n.call(e,a)}catch(e){s=[6,e],r=0}finally{t=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},d=function(e){return l(void 0,void 0,void 0,(function(){var n,t,o;return c(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,a.A.post(i.n.BILLING.STRIPE_CONNECTION_CONNECT,{country_code:e})];case 1:return n=s.sent(),(t=n.data.account)?u(t):(0,r.Sx)("",n.data.error,"error"),[3,3];case 2:return o=s.sent(),(0,r.Sx)("",(null==o?void 0:o.message)||"An error occurred","error"),[3,3];case 3:return[2]}}
1))}))},u=function(e){return l(void 0,void 0,void 0,(function(){var n,t,o,s,l;return c(this,(function(c){switch(c.label){case 0:return c.trys.push([0,2,,3]),[4,a.A.get(i.n.BILLING.STRIPE_CONNECTION_ONBOARD+"?account="+e)];case 1:return n=c.sent(),t=n.data,o=t.account_link,s=t.error,o&&(window.location.href=o),s&&(0,r.Sx)("",s,"error"),[3,3];case 2:return l=c.sent(),(0,r.Sx)("",(null==l?void 0:l.message)||"An error occurred","error"),[3,3];case 3:return[2]}}))}))},x=function(e){return l(void 0,void 0,void 0,(function(){var n,t;return c(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,a.A.post(i.n.BILLING.STRIPE_CONNECTION_DISCONNECT)];case 1:return n=o.sent(),(0,r.Sx)("",n.data.message,"success"),e(),[2,!0];case 2:return t=o.sent(),(0,r.Sx)("",(null==t?void 0:t.message)||"An error occurred","error"),[3,3];case 3:return[2,!1]}}))}))},h=function(){return(0,s.I)({queryKey:[o.e.STRIPE_INTEGRATION_STATUS],queryFn:function(){return l(void 0,void 0,Promise,(function(){var e,n;return c(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,a.A.get(i.n.BILLING.STRIPE_CONNECTION_STATUS)];case 1:return e=t.sent(),[2,(0,r.Cb)(e.data)];case 2:return n=t.sent(),(0,r.Sx)("",(null==n?void 0:n.message)||"An error occurred","error"),[3,3];case 3:return[2,{isStripeConnected:!1,agencyPackagesExist:!1,hasActiveSubaccounts:!1,hasSubscriptionPackages:!1,stripeAccountId:""}]}}))}))},refetchOnWindowFocus:!0,refetchOnMount:!0,staleTime:0,retry:!1})},p=function(){return l(void 0,void 0,Promise,(function(){var e,n;return c(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,a.A.get(i.n.BILLING.STRIPE_CONNECTION_TRANSACTIONS)];case 1:return e=t.sent(),[2,(0,r.Cb)(e.data)];case 2:return n=t.sent(),(0,r.Sx)("",(null==n?void 0:n.message)||"An error occurred","error"),[3,3];case 3:return[2,{data:[],hasMore:!1,object:"",url:""}]}}))}))}},86958:function(e,n,t){t.r(n),t.d(n,{AgencyProfilePage:function(){return qe}});var r,i=t(78685),a=t(2057),o=t(50991),s=t(78166),l=t(69179),c=t(10698),d=t(17e3),u=t(81e3),x=t(98653),h=t(28481),p=t(16657),f=t(73433),E=["dashboard_settings","custom_domain","custom_styling","stripe_integration","stripe_configuration","notifications","custom_menu_links","white_label_documentation"],S=[{code:"usd",label:"US Dollar ($)"},{code:"gbp",label:"British Pound (£)"},{code:"eur",label:"Euro (â¬)"},{code:"cad",label:"Canadian Dollar (CA$)"},{code:"dkk",label:"Danish Krone (DKK)"},{code:"aud",label:"Australian Dollar (A$)"},{code:"nzd",label:"New Zealand Dollar (NZ$)"},{code:"sgd",label:"Singapore Dollar (S$)"},{code:"brl",label:"Brazilian Real (R$)"},{code:"jpy",label:"Japanese Yen (Â¥)"},{code:"thb",label:"Thai baht (฿)"},{code:"huf",label:"Hungarian Forint (Ft)"},{code:"sek",label:"Swedish Krona (kr)"},{code:"pln",label:"Polish ZÅoty (zÅ)"},{code:"aed",label:"United Arab Emirates Dirham (د.Ø¥)"}],m=[{code:"en",label:"English",nativeLabel:"English"},{code:"es",label:"Spanish",nativeLabel:"Español"},{code:"fr",label:"French",nativeLabel:"Français"},{code:"pt",label:"Portuguese",nativeLabel:"Português"},{code:"ru",label:"Russian",nativeLabel:"Ð ÑÑÑкий"},{code:"ja",label:"Japanese",nativeLabel:"æ¥æ¬èª"},{code:"de",label:"German",nativeLabel:"Deutsch"},{code:"it",label:"Italian",nativeLabel:"Italiano"},{code:"hi",label:"Hindi",nativeLabel:"हिनà¥à¤¦à¥"},{code:"hu",label:"Hungarian",nativeLabel:"Magyar"},{code:"pl",label:"Polish",nativeLabel:"Polski"},{code:"nl",label:"Dutch",nativeLabel:"Nederlands"}],g="styling",b="custom_colors",T="masterchat",N="https://stammerai-prod-public.s3.amazonaws.com/stammer-login-page-image.jpg",v=["image/png","image/jpeg","image/jpg"],A=t(19124),_=t(61322),j=t(18271),C=t(71259),I=function(){return I=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var i in n=arguments[t])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e},I.apply(this,arguments)},y=function(e){var n=e.agencyId,t=(0,p.Bd)().t,r=(0,x.oS)(n),o=r.data,c=r.isLoading,d=r.isError,u=(0,x._0)(),E=(0,a.useState)(null),g=E[0],b=E[1],T=(0,a.useRef)(null),N=(0,a.useState)(null),v=N[0],y=N[1];(0,a.useEffect)((function(){if(g&&g[0]){var e=URL.createObjectURL(g[0]);return y(e),function(){return URL.revokeObjectURL(e)}}y(null)}),[g]),(0,a.useEffect)((function(){var e,n;if(u.isSuccess)(0,A.Sx)("",t("AGENCY_SETTINGS.SETTINGS_UPDATED"),"success");else if(u.isError){var r=u.error;if(!(400===(null===(e=null==r?void 0:r.response)||void 0===e?void 0:e.status))){var i=(null===(n=u.error)||void 0===n?void 0:n.message)||t("AGENCY_SETTINGS.ERROR_SAVING_SETTINGS");(0,A.Sx)("",i,"error")}}}),[u.isSuccess,u.isError]);return c?(0,i.jsx)(_.A,{}):d?(0,i.jsx)("div",{children:t("AGENCY_SETTINGS.ERROR_LOADING_SETTINGS")}):(0,i.jsx)("div",{id:"agency-profile-settings",children:(0,i.jsx)(s.l1m,I({},function(){var e,t;return{enableReinitialize:!0,initialValues:{name:(null==o?void 0:o.name)||"",siteName:(null===(e=null==o?void 0:o.site)||void 0===e?void 0:e.siteName)||"",logo:(null===(t=null==o?void 0:o.site)||void 0===t?void 0:t.logo)||"",currencyCode:(null==o?void 0:o.currencyCode)||"",supportEmail:(null==o?void 0:o.supportEmail)||"",termsOfServiceUrl:(null==o?void 0:o.termsOfServiceUrl)||"",privacyPolicyUrl:(null==o?void 0:o.privacyPolicyUrl)||"",showAppVersion:(null==o?void 0:o.showAppVersion)||!1,supportLink:(null==o?void 0:o.supportLink)||"",isDocumentationVisisbleToSubaccounts:(null==o?void 0:o.isDocumentationVisisbleToSubaccounts)||!1,defaultLanguage:(null==o?void 0:o.defaultLanguage)||"",enforce_2faForSubAccounts:(null==o?void 0:o.enforce_2faForSubAccounts)||!1,enableRecaptchaForSubaccounts:(null==o?void 0:o.enableRecaptchaForSubaccounts)||!1},validationSchema:C.v3,onSubmit:function(e,t){!function(e,t){var r={siteName:e.siteName},i=g&&g[0],a=I(I({},e),{site:r}),s=e.defaultLanguage&&e.defaultLanguage!==(null==o?void 0:o.defaultLanguage)?{onSuccess:function(){var n=e.defaultLanguage;document.cookie="django_language=".concat(n,";path=/;samesite=Lax");var t=window.location.pathname.replace(/^\/[a-z]{2}\//,"/".concat(n,"/"));window.location.href=t}}:void 0;if(i){var l=new FormData;
1Object.keys(a).forEach((function(e){"site"!==e&&l.append(e,a[e])})),l.append("site.site_name",r.siteName),g&&g[0]&&l.append("site.logo",g[0]),u.mutate({agencyId:n,payload:l,isFormData:!0},s)}else u.mutate({agencyId:n,payload:a},s);t(!1)}(e,t.setSubmitting)}}}(),{children:function(e){var n,r,a,s=e.values,c=e.errors,d=e.touched,x=e.handleChange,p=e.setFieldValue,E=e.isSubmitting;return(0,i.jsx)(h.lV,{className:"p-2",children:(0,i.jsxs)(l.fPr,{container:!0,spacing:2,children:[(0,i.jsx)(l.fPr,{size:{xs:12,md:8},children:(0,i.jsxs)(l.fPr,{container:!0,spacing:2,children:[(0,i.jsxs)(l.fPr,{size:{xs:12,sm:6},children:[(0,i.jsx)(l.JU7,{name:t("AGENCY_SETTINGS.AGENCY_NAME"),required:!0,helptext:t("AGENCY_SETTINGS.AGENCY_NAME_HELP"),ignoreSpace:!0}),(0,i.jsx)(l.A_L,{id:"name",name:"name",value:s.name,onChange:x,error:d.name&&Boolean(c.name),helperText:d.name&&c.name?(0,j.v)(c.name):t("AGENCY_SETTINGS.ENTER_AGENCY_NAME"),slotProps:{formHelperText:{sx:{ml:0}}},fullWidth:!0,size:"small",margin:"dense"})]}),(0,i.jsxs)(l.fPr,{size:{xs:12,sm:6},children:[(0,i.jsx)(l.JU7,{name:t("AGENCY_SETTINGS.SITE_NAME"),required:!0,helptext:t("AGENCY_SETTINGS.SITE_NAME_HELP"),ignoreSpace:!0}),(0,i.jsx)(l.A_L,{id:"siteName",name:"siteName",value:s.siteName,onChange:x,error:d.siteName&&Boolean(c.siteName),helperText:d.siteName&&c.siteName?(0,j.v)(c.siteName):t("AGENCY_SETTINGS.SITE_NAME_HELP"),slotProps:{formHelperText:{sx:{ml:0}}},fullWidth:!0,size:"small",margin:"dense"})]}),(0,i.jsxs)(l.fPr,{size:{xs:12,sm:6},children:[(0,i.jsx)(l.JU7,{name:t("AGENCY_SETTINGS.CURRENCY"),required:!0,helptext:t("AGENCY_SETTINGS.CURRENCY_HELP"),ignoreSpace:!0}),(0,i.jsx)(l.m_M,{title:Boolean(null==o?void 0:o.isCurrencyChangeable)?"":t("AGENCY_SETTINGS.CURRENCY_DISABLED_TOOLTIP"),placement:"top",arrow:!0,children:(0,i.jsxs)(l.MJN,{fullWidth:!0,size:"small",margin:"dense",disabled:!Boolean(null==o?void 0:o.isCurrencyChangeable),error:d.currencyCode&&Boolean(c.currencyCode),children:[(0,i.jsxs)(l.l6P,{id:"currencyCode",name:"currencyCode",value:s.currencyCode,onChange:x,displayEmpty:!0,children:[(0,i.jsx)(l.Drp,{value:"",children:(0,i.jsx)("em",{children:t("AGENCY_SETTINGS.SELECT_CURRENCY")})}),S.map((function(e){return(0,i.jsx)(l.Drp,{value:e.code,children:e.label},e.code)}))]}),(0,i.jsx)(l.eKY,{sx:{ml:0},children:d.currencyCode&&c.currencyCode?(0,j.v)(c.currencyCode):t("AGENCY_SETTINGS.CURRENCY_HELP")})]})})]}),(0,i.jsxs)(l.fPr,{size:{xs:12,sm:6},children:[(0,i.jsx)(l.JU7,{name:t("AGENCY_SETTINGS.DEFAULT_LANGUAGE"),required:!0,helptext:t("AGENCY_SETTINGS.DEFAULT_LANGUAGE_HELP"),ignoreSpace:!0}),(0,i.jsxs)(l.MJN,{fullWidth:!0,size:"small",margin:"dense",error:d.defaultLanguage&&Boolean(c.defaultLanguage),children:[(0,i.jsxs)(l.l6P,{id:"defaultLanguage",name:"defaultLanguage",value:s.defaultLanguage,onChange:x,displayEmpty:!0,renderValue:function(e){if(!e)return(0,i.jsx)("em",{children:t("AGENCY_SETTINGS.SELECT_LANGUAGE")});var n=m.find((function(n){return n.code===e}));return n?(0,i.jsxs)(l.azJ,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,i.jsx)("img",{src:"/static/common/img/flags/".concat(n.code,".png"),alt:"",width:20,height:14,style:{objectFit:"cover"}}),n.nativeLabel]}):e},children:[(0,i.jsx)(l.Drp,{value:"",children:(0,i.jsx)("em",{children:t("AGENCY_SETTINGS.SELECT_LANGUAGE")})}),m.map((function(e){return(0,i.jsxs)(l.Drp,{value:e.code,sx:{display:"flex",alignItems:"center",gap:1},children:[(0,i.jsx)("img",{src:"/static/common/img/flags/".concat(e.code,".png"),alt:"",width:20,height:14,style:{objectFit:"cover"}}),e.nativeLabel]},e.code)}))]}),(0,i.jsx)(l.eKY,{sx:{ml:0},children:d.defaultLanguage&&c.defaultLanguage?(0,j.v)(c.defaultLanguage):t("AGENCY_SETTINGS.DEFAULT_LANGUAGE_HELP")})]})]})]})}),(0,i.jsxs)(l.fPr,{size:{xs:12,md:4},children:[(0,i.jsx)(l.JU7,{name:t("AGENCY_SETTINGS.SITE_LOGO"),required:!0,helptext:t("AGENCY_SETTINGS.SITE_LOGO_HELP"),ignoreSpace:!0}),(0,i.jsx)("input",{ref:T,accept:"image/*",style:{display:"none"},type:"file",onChange:function(e){e.target.files&&(b([e.target.files[0]]),p("logo",e.target.files[0]))}}),(0,i.jsxs)(l.azJ,{onClick:function(){var e;return null===(e=T.current)||void 0===e?void 0:e.click()},sx:{border:"2px dashed",borderColor:"divider",borderRadius:2,minHeight:168,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:1,p:2,mt:"7px",cursor:"pointer",transition:"border-color 0.2s","&:hover":{borderColor:"primary.main"}},children:[v?(0,i.jsx)(l.m_M,{title:null!==(r=null===(n=null==g?void 0:g[0])||void 0===n?void 0:n.name)&&void 0!==r?r:"",placement:"top",arrow:!0,children:(0,i.jsx)("img",{src:v,alt:"logo preview",style:{maxWidth:96,maxHeight:80,objectFit:"contain",borderRadius:4}})}):s.logo?(0,i.jsx)(l.m_M,{title:"string"==typeof s.logo&&null!==(a=s.logo.split("/").pop())&&void 0!==a?a:"",placement:"top",arrow:!0,children:(0,i.jsx)("img",{src:s.logo,alt:"logo",style:{maxWidth:96,maxHeight:80,objectFit:"contain",borderRadius:4}})}):(0,i.jsx)(f.iS,{sx:{fontSize:40,color:"text.disabled"}}),(0,i.jsx)(l.$nd,{variant:"outlined",color:"primary",size:"small",startIcon:(0,i.jsx)(f.ef,{}),onClick:function(e){var n;e.stopPropagation(),null===(n=T.current)||void 0===n||n.click()},children:t("AGENCY_SETTINGS.CHOOSE_FILE")}),(0,i.jsx)(l.o5u,{variant:"caption",color:"text.disabled",textAlign:"center",children:"png · jpg · jpeg  · 32Ã32px"})]})]}),(0,i.jsxs)(l.fPr,{size:{xs:12,sm:6},children:[(0,i.jsx)(l.JU7,{name:t("AGENCY_SETTINGS.SUPPORT_EMAIL"),required:!0,helptext:t("AGENCY_SETTINGS.SUPPORT_EMAIL_HELP"),ignoreSpace:!0}
1),(0,i.jsx)(l.A_L,{id:"supportEmail",name:"supportEmail",type:"email",value:s.supportEmail,onChange:x,error:d.supportEmail&&Boolean(c.supportEmail),helperText:d.supportEmail&&c.supportEmail?(0,j.v)(c.supportEmail):t("AGENCY_SETTINGS.SUPPORT_EMAIL_HELP"),slotProps:{formHelperText:{sx:{ml:0}}},fullWidth:!0,size:"small",margin:"dense"})]}),(0,i.jsxs)(l.fPr,{size:{xs:12,sm:6},children:[(0,i.jsx)(l.JU7,{name:t("AGENCY_SETTINGS.SUPPORT_LINK"),helptext:t("AGENCY_SETTINGS.SUPPORT_LINK_HELP"),ignoreSpace:!0}),(0,i.jsx)(l.A_L,{id:"supportLink",name:"supportLink",value:s.supportLink,onChange:x,error:d.supportLink&&Boolean(c.supportLink),helperText:d.supportLink&&c.supportLink?(0,j.v)(c.supportLink):t("AGENCY_SETTINGS.SUPPORT_LINK_HELP"),slotProps:{formHelperText:{sx:{ml:0}}},fullWidth:!0,size:"small",margin:"dense"})]}),(0,i.jsxs)(l.fPr,{size:{xs:12,sm:6},children:[(0,i.jsx)(l.JU7,{name:t("AGENCY_SETTINGS.PRIVACY_POLICY_URL"),helptext:t("AGENCY_SETTINGS.PRIVACY_POLICY_URL_HELP"),ignoreSpace:!0}),(0,i.jsx)(l.A_L,{id:"privacyPolicyUrl",name:"privacyPolicyUrl",value:s.privacyPolicyUrl,onChange:x,error:d.privacyPolicyUrl&&Boolean(c.privacyPolicyUrl),helperText:d.privacyPolicyUrl&&c.privacyPolicyUrl?(0,j.v)(c.privacyPolicyUrl):t("AGENCY_SETTINGS.PRIVACY_POLICY_URL_HELP"),slotProps:{formHelperText:{sx:{ml:0}}},fullWidth:!0,size:"small",margin:"dense"})]}),(0,i.jsxs)(l.fPr,{size:{xs:12,sm:6},children:[(0,i.jsx)(l.JU7,{name:t("AGENCY_SETTINGS.TERMS_OF_SERVICE_URL"),helptext:t("AGENCY_SETTINGS.TERMS_OF_SERVICE_URL_HELP"),ignoreSpace:!0}),(0,i.jsx)(l.A_L,{id:"termsOfServiceUrl",name:"termsOfServiceUrl",value:s.termsOfServiceUrl,onChange:x,error:d.termsOfServiceUrl&&Boolean(c.termsOfServiceUrl),helperText:d.termsOfServiceUrl&&c.termsOfServiceUrl?(0,j.v)(c.termsOfServiceUrl):t("AGENCY_SETTINGS.TERMS_OF_SERVICE_URL_HELP"),slotProps:{formHelperText:{sx:{ml:0}}},fullWidth:!0,size:"small",margin:"dense"})]}),(0,i.jsxs)(l.fPr,{size:{xs:12,sm:6},children:[(0,i.jsx)(l.ip9,{control:(0,i.jsx)(l.Sc0,{id:"showAppVersion",name:"showAppVersion",checked:s.showAppVersion,onChange:x}),label:(0,i.jsx)(l.$ZZ,{fontSize:14,label:t("AGENCY_SETTINGS.SHOW_APP_VERSION"),tooltipTitle:t("AGENCY_SETTINGS.SHOW_APP_VERSION_HELP")})}),(0,i.jsx)(l.eKY,{sx:{mt:"-10px"},children:t("AGENCY_SETTINGS.SHOW_APP_VERSION_HELP_TEXT")})]}),(0,i.jsxs)(l.fPr,{size:{xs:12,sm:6},children:[(0,i.jsx)(l.ip9,{control:(0,i.jsx)(l.Sc0,{id:"enforce_2faForSubAccounts",name:"enforce_2faForSubAccounts",checked:s.enforce_2faForSubAccounts,onChange:x}),label:(0,i.jsx)(l.$ZZ,{fontSize:14,label:t("AGENCY_SETTINGS.ENFORCE_2FA"),tooltipTitle:t("AGENCY_SETTINGS.ENFORCE_2FA_HELP")})}),(0,i.jsx)(l.eKY,{sx:{mt:"-10px"},children:t("AGENCY_SETTINGS.ENFORCE_2FA_HELP_TEXT")})]}),(0,i.jsxs)(l.fPr,{size:{xs:12,sm:6},children:[(0,i.jsx)(l.ip9,{control:(0,i.jsx)(l.Sc0,{id:"enableRecaptchaForSubaccounts",name:"enableRecaptchaForSubaccounts",checked:s.enableRecaptchaForSubaccounts,onChange:x}),label:(0,i.jsx)(l.$ZZ,{fontSize:14,label:t("AGENCY_SETTINGS.ENABLE_RECAPTCHA"),tooltipTitle:t("AGENCY_SETTINGS.ENABLE_RECAPTCHA_HELP")})}),(0,i.jsx)(l.eKY,{sx:{mt:"-10px"},children:t("AGENCY_SETTINGS.ENABLE_RECAPTCHA_HELP_TEXT")})]}),(0,i.jsxs)(l.fPr,{size:{xs:12,sm:6},children:[(0,i.jsx)(l.ip9,{control:(0,i.jsx)(l.Sc0,{id:"isDocumentationVisisbleToSubaccounts",name:"isDocumentationVisisbleToSubaccounts",checked:s.isDocumentationVisisbleToSubaccounts,onChange:x}),label:(0,i.jsx)(l.$ZZ,{fontSize:14,label:t("AGENCY_SETTINGS.SHOW_DOCUMENTATION"),tooltipTitle:t("AGENCY_SETTINGS.SHOW_DOCUMENTATION_HELP")})}),(0,i.jsx)(l.eKY,{sx:{mt:"-10px"},children:t("AGENCY_SETTINGS.SHOW_DOCUMENTATION_HELP_TEXT")})]}),(0,i.jsx)(l.fPr,{size:12,children:(0,i.jsx)(l.azJ,{sx:{display:"flex",justifyContent:"flex-end"},children:(0,i.jsx)(l.$nd,{type:"submit",variant:"contained",color:"primary",startIcon:(0,i.jsx)(f.c4,{className:"me-1"}),disabled:E||u.isPending,children:u.isPending?t("AGENCY_SETTINGS.SAVING"):t("AGENCY_SETTINGS.UPDATE")})})})]})})}}))})},G=t(81971),L=t(31547),P=t(73349),O=t(38588),w=t(26400),R=t(93715),Y=t(10838),D=t(34994),k=t(22127),z=t(14428),U=t(26088),M=t(21120),H=t(81056),F=(0,H.A)((0,i.jsx)("path",{d:"M10 15l5.19-3L10 9v6m11.56-7.83c.13.47.22 1.1.28 1.9.07.8.1 1.49.1 2.09L22 12c0 2.19-.16 3.8-.44 4.83-.25.9-.83 1.48-1.73 1.73-.47.13-1.33.22-2.65.28-1.3.07-2.49.1-3.59.1L12 19c-4.19 0-6.8-.16-7.83-.44-.9-.25-1.48-.83-1.73-1.73-.13-.47-.22-1.1-.28-1.9-.07-.8-.1-1.49-.1-2.09L2 12c0-2.19.16-3.8.44-4.83.25-.9.83-1.48 1.73-1.73.47-.13 1.33-.22 2.65-.28 1.3-.07 2.49-.1 3.59-.1L12 5c4.19 0 6.8.16 7.83.44.9.25 1.48.83 1.73 1.73z"}),"YouTube"),B=function(e){var n=e.open,t=e.onClose,r=e.record,o=e.host,s=e.ipAddress,c=e.domain,d=e.agencyId,u=e.onSuccess,h=e.onFailure,f=(0,p.Bd)().t,E=(0,x.F9)(d),S=a.useState(null),m=S[0],g=S[1],b=a.useState(0),T=b[0],N=b[1],v=a.useState(!1),_=v[0],j=v[1],C=a.use
1State(!1),I=C[0],y=C[1];a.useEffect((function(){var e=null;return E.isPending?(N(0),e=setInterval((function(){N((function(e){return e>=90?90:e+2}))}),100)):E.isPending||0===T||(N(100),setTimeout((function(){return N(0)}),300)),function(){e&&clearInterval(e)}}),[E.isPending]);return(0,i.jsx)(R.A,{open:n,onClose:t,maxWidth:"md",fullWidth:!0,children:(0,i.jsxs)(L.A,{sx:{p:0,minWidth:500},children:[(0,i.jsxs)(L.A,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:"1px solid #ccc",px:2},children:[(0,i.jsx)(Y.A,{variant:"h6",fontWeight:500,sx:{fontSize:"1rem",color:"primary.main"},children:f("AGENCY_SETTINGS.DNS_SETUP_HEADER")}),(0,i.jsx)("div",{children:(0,i.jsx)(D.A,{"aria-label":"close",onClick:t,children:(0,i.jsx)("span",{"aria-hidden":"true",children:"Ã"})})})]}),(0,i.jsxs)(L.A,{sx:{p:3,pt:2,pb:2},children:[E.isPending&&(0,i.jsx)(L.A,{mb:2,children:(0,i.jsx)(k.A,{variant:"determinate",value:T,sx:{height:10,borderRadius:6}})}),(0,i.jsxs)(z.A,{container:!0,spacing:2,sx:{mb:2},children:[(0,i.jsxs)(z.A,{size:{xs:12,md:4},children:[(0,i.jsx)(l.JU7,{name:f("AGENCY_SETTINGS.DNS_RECORD"),ignoreSpace:!0}),(0,i.jsx)(O.A,{id:"record",size:"small",value:r,InputProps:{readOnly:!0},fullWidth:!0,variant:"outlined"})]}),(0,i.jsxs)(z.A,{size:{xs:12,md:4},children:[(0,i.jsx)(l.JU7,{name:f("AGENCY_SETTINGS.DNS_HOST"),ignoreSpace:!0}),(0,i.jsxs)(L.A,{display:"flex",alignItems:"center",children:[(0,i.jsx)(O.A,{id:"host",size:"small",value:o,InputProps:{readOnly:!0},fullWidth:!0,variant:"outlined"}),(0,i.jsx)(D.A,{onClick:function(){navigator.clipboard.writeText(o),j(!0),setTimeout((function(){return j(!1)}),1e3)},children:_?(0,i.jsx)(M.A,{color:"success",fontSize:"small"}):(0,i.jsx)(U.A,{fontSize:"small"})})]})]}),(0,i.jsxs)(z.A,{size:{xs:12,md:4},children:[(0,i.jsx)(l.JU7,{name:f("AGENCY_SETTINGS.DNS_REQUIRED_VALUE"),ignoreSpace:!0}),(0,i.jsxs)(L.A,{display:"flex",alignItems:"center",children:[(0,i.jsx)(O.A,{id:"ipAddress",size:"small",value:s,InputProps:{readOnly:!0},fullWidth:!0,variant:"outlined"}),(0,i.jsx)(D.A,{onClick:function(){navigator.clipboard.writeText(s),y(!0),setTimeout((function(){return y(!1)}),1e3)},children:I?(0,i.jsx)(M.A,{color:"success",fontSize:"small"}):(0,i.jsx)(U.A,{fontSize:"small"})})]})]})]}),(0,i.jsx)(Y.A,{variant:"body2",color:"textSecondary",children:f("AGENCY_SETTINGS.DNS_INSTRUCTIONS")}),m&&(0,i.jsx)(L.A,{mt:2,children:(0,i.jsx)(P.A,{severity:"warning",children:m})})]}),(0,i.jsxs)(L.A,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",borderTop:"1px solid #e0e0e0",p:2,py:1},children:[(0,i.jsxs)("a",{href:"https://www.youtube.com/watch?v=7yaTxJvA0DQ",target:"_blank",rel:"noopener noreferrer",className:"text-decoration-none d-flex align-items-center gap-2",children:[(0,i.jsx)(F,{sx:{fontSize:18,mr:1}}),f("AGENCY_SETTINGS.WATCH_HELP_VIDEO")]}),(0,i.jsx)(w.A,{onClick:function(){g(null),E.mutate({domain:c},{onSuccess:function(e){(0,A.Sx)("",(null==e?void 0:e.message)||f("AGENCY_SETTINGS.DEPLOYMENT_SUCCESS",{domain:c}),"success"),null==u||u(),t()},onError:function(e){var n,t,r,i;(0,A.Sx)("",(null===(t=null===(n=null==e?void 0:e.response)||void 0===n?void 0:n.data)||void 0===t?void 0:t.message)||f("AGENCY_SETTINGS.DNS_VERIFICATION_FAILED"),"error"),g((null===(i=null===(r=null==e?void 0:e.response)||void 0===r?void 0:r.data)||void 0===i?void 0:i.message)||f("AGENCY_SETTINGS.DNS_VERIFICATION_FAILED")),null==h||h()}})},variant:"contained",color:"primary",disabled:E.isPending,sx:{fontWeight:500},children:E.isPending?f("AGENCY_SETTINGS.VERIFYING"):f("AGENCY_SETTINGS.VERIFY_RECORDS")})]})]})})};!function(e){e.IN_PROGRESS="in_progress",e.SUCCESS="success",e.FAILED="failed",e.COMPLETED_WITH_ERRORS="completed_with_errors"}(r||(r={}));var J=t(50143),W=function(e){var n=e.children,t=e.isPaidUser,r=(e.loadingSkeleton,(0,J.f)().themeMode),a=(0,p.Bd)().t;return t?(0,i.jsx)(i.Fragment,{children:n}):(0,i.jsxs)("div",{style:{position:"relative"},children:[n,(0,i.jsx)("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",backgroundColor:"dark"===r?"rgba(0, 0, 0, 0.7)":"rgba(255, 255, 255, 0.7)",zIndex:1e3,display:"flex",alignItems:"center",justifyContent:"center",cursor:"not-allowed",pointerEvents:"all"},children:(0,i.jsx)(l.o5u,{variant:"h6",sx:{color:"dark"===r?"white":"black",textAlign:"center",padding:"16px 24px",borderRadius:"8px",pointerEvents:"none"},children:a("DISPLAY_STRINGS.NO_PERMISSION_ACCESS")})})]})},V=t(10765),$=function(e){var n=e.show,t=e.onCancel,r=e.onConfirm,a=e.isLoading,o=void 0!==a&&a,s=(0,p.Bd)().t;return(0,i.jsx)("div",{className:"modal fade ".concat(n?"show":""),id:"RemoveDomainConfirmationModal",tabIndex:-1,role:"dialog","aria-labelledby":"RemoveDomainConfirmationModalLabel",style:{display:n?"block":"none",transition:"transform 0.8s ease-out, opacity 0.8s ease-out",opacity:n?1:0,marginTop:"10%"},"aria-hidden":!n,children:(0,i.jsx)("div",{className:"modal-dialog",role:"document",children:(0,i.jsxs)("div",{className:"modal-content",children:[(0,i.jsxs)("div",{className:"modal-header",children:[(0,i.jsx)("h5",{className:"modal-title",id:"RemoveDomainConfirmationModalLabel",children:s("AGENCY_SETTINGS.CONFIRMATION_REQUIRED")}
1),(0,i.jsx)("button",{type:"button",className:"btn-close","data-bs-dismiss":"modal","aria-label":s("AGENCY_SETTINGS.CLOSE_BUTTON"),onClick:t})]}),(0,i.jsx)("div",{className:"modal-body",children:(0,i.jsx)("p",{children:s("AGENCY_SETTINGS.ARE_YOU_SURE_REMOVE_DOMAIN")})}),(0,i.jsxs)("div",{className:"modal-footer",children:[(0,i.jsx)("button",{className:"btn btn-primary-soft",type:"button","data-bs-dismiss":"modal",onClick:t,disabled:o,children:s("AGENCY_SETTINGS.CLOSE_BUTTON")}),(0,i.jsx)("button",{className:"btn btn-danger",type:"button",id:"changeBtn",onClick:r,disabled:o,children:o?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:"spinner-border spinner-border-sm me-2",role:"status","aria-hidden":"true"}),s("AGENCY_SETTINGS.DELETING")]}):s("AGENCY_SETTINGS.CONFIRM")})]})]})})})},K=function(e,n,t,r){return new(t||(t=Promise))((function(i,a){function o(e){try{l(r.next(e))}catch(e){a(e)}}function s(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(o,s)}l((r=r.apply(e,n||[])).next())}))},Z=function(e,n){var t,r,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(t=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=n.call(e,a)}catch(e){s=[6,e],r=0}finally{t=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},q=function(){return(0,i.jsx)(G.A,{variant:"rectangular",height:400})},X=function(e){var n,t=e.agencyId,o=(0,p.Bd)().t,s=(0,a.useState)(""),l=s[0],c=s[1],d=(0,a.useState)(null),u=(d[0],d[1]),h=(0,a.useState)(null),f=h[0],E=h[1],S=(0,a.useState)(!1),m=S[0],g=S[1],b=(0,a.useState)(o("AGENCY_SETTINGS.SET_DOMAIN")),T=b[0],N=b[1],v=(0,a.useState)(null),_=v[0],j=v[1],C=(0,a.useState)(!1),I=C[0],y=C[1],R=(0,a.useState)(!1),Y=R[0],D=R[1],k=(0,x.ky)(t),z=k.data,U=k.isLoading,M=(0,x.qV)(t),H=(0,a.useState)(null),F=H[0],J=H[1];(0,a.useEffect)((function(){(null==z?void 0:z.lastDeployment)?J(z.lastDeployment.status===r.SUCCESS):J(null)}),[z]),(0,a.useEffect)((function(){z&&z.domain&&""===l&&c(z.domain)}),[z]),(0,a.useEffect)((function(){var e,n,t,r;M.isSuccess&&(null===(e=M.data)||void 0===e?void 0:e.data)?(j({record:"A",host:M.data.data.host,ipAddress:M.data.data.serverIpAddress}),g(!0),u(M.data.message||""),E(null)):M.isError&&(E((null===(r=null===(t=null===(n=M.error)||void 0===n?void 0:n.response)||void 0===t?void 0:t.data)||void 0===r?void 0:r.message)||o("AGENCY_SETTINGS.ERROR_SAVING_DOMAIN")),u(null))}),[M.isSuccess,M.isError,M.data,M.error]),(0,a.useEffect)((function(){N(o(l&&F?"AGENCY_SETTINGS.UPDATE_DOMAIN":l&&!1===F?"AGENCY_SETTINGS.REDEPLOY_DOMAIN":"AGENCY_SETTINGS.SET_DOMAIN"))}),[l,F,o]);if(U)return(0,i.jsx)(G.A,{variant:"rectangular",height:100});var W=null===(n=null==z?void 0:z.lastDeployment)||void 0===n?void 0:n.status,q=W===r.FAILED||W===r.COMPLETED_WITH_ERRORS,X=q?"error":W===r.SUCCESS?"success":"info",Q=function(){var e;return q?"ip_mismatch"===(null===(e=null==z?void 0:z.lastDeployment)||void 0===e?void 0:e.failureReasonCode)?o("AGENCY_SETTINGS.DEPLOYMENT_FAILED_IP_MISMATCH"):o("AGENCY_SETTINGS.DEPLOYMENT_FAILED"):W===r.SUCCESS?o("AGENCY_SETTINGS.DEPLOYMENT_SUCCESS",{domain:l}):W===r.IN_PROGRESS?o("AGENCY_SETTINGS.DEPLOYMENT_IN_PROGRESS"):null}();return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(L.A,{sx:{m:1,mt:2},children:[(null==z?void 0:z.lastDeployment)&&(0,i.jsx)(P.A,{severity:X,sx:{mb:1},children:Q}),(0,i.jsx)(V.JU,{name:o("AGENCY_SETTINGS.DOMAIN"),required:!0,helptext:o("AGENCY_SETTINGS.DOMAIN_HELP"),ignoreSpace:!0}),(0,i.jsx)(O.A,{id:"customDomain",variant:"outlined",size:"small",fullWidth:!0,placeholder:o("AGENCY_SETTINGS.DOMAIN_PLACEHOLDER"),value:l,onCh
1ange:function(e){return c(e.target.value)},disabled:U||M.isPending,sx:{mb:1},helperText:(0,i.jsx)("span",{style:{fontSize:12,marginLeft:"-14px"},className:"text-muted",children:o("AGENCY_SETTINGS.DOMAIN_EXAMPLE")})}),f&&(0,i.jsx)(P.A,{severity:"error",sx:{mb:2},children:f}),(0,i.jsxs)(L.A,{sx:{display:"flex",justifyContent:"flex-end",gap:2},children:[l&&(null==z?void 0:z.lastDeployment)&&(0,i.jsx)(w.A,{variant:"contained",color:"error",onClick:function(){return y(!0)},disabled:U||M.isPending||Y,sx:{fontWeight:500},children:o("AGENCY_SETTINGS.REMOVE_DOMAIN")}),(0,i.jsx)(w.A,{variant:"contained",color:"primary",onClick:function(){M.mutate({domain:l})},disabled:U||M.isPending||Y||!l,sx:{fontWeight:500},children:U||M.isPending?o("AGENCY_SETTINGS.SAVING"):T})]})]}),(0,i.jsx)(B,{open:m,onClose:function(){return g(!1)},record:(null==_?void 0:_.record)||"",host:(null==_?void 0:_.host)||"",ipAddress:(null==_?void 0:_.ipAddress)||"",domain:l,agencyId:t,onSuccess:function(){setTimeout((function(){window.location.reload()}),1e3)},onFailure:function(){setTimeout((function(){window.location.reload()}),1e3)}}),(0,i.jsx)($,{show:I,onCancel:function(){return y(!1)},onConfirm:function(){return K(void 0,void 0,void 0,(function(){var e,n,r;return Z(this,(function(i){switch(i.label){case 0:D(!0),i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,(0,x.Kr)(t)];case 2:return i.sent(),c(""),j(null),g(!1),u(null),E(null),y(!1),(0,A.Sx)("",o("AGENCY_SETTINGS.DOMAIN_REMOVED_SUCCESS"),"error"),[3,5];case 3:return e=i.sent(),(0,A.Sx)("",(null===(r=null===(n=null==e?void 0:e.response)||void 0===n?void 0:n.data)||void 0===r?void 0:r.message)||o("AGENCY_SETTINGS.DOMAIN_DELETE_FAILED"),"error"),[3,5];case 4:return D(!1),setTimeout((function(){window.location.reload()}),1e3),[7];case 5:return[2]}}
1))}))},isLoading:Y})]})},Q=function(e){var n,t=e.agencyId,r=(0,u.J)(),a=r.userDetails,o=r.isLoading;r.isError;if(o)return(0,i.jsx)(q,{});var s=null!==(n=null==a?void 0:a.isPaidUser)&&void 0!==n&&n;return(0,i.jsx)(W,{isPaidUser:s,loadingSkeleton:(0,i.jsx)(q,{}),children:(0,i.jsx)(X,{agencyId:t})})},ee=function(){var e=(0,J.f)().themeMode;return(0,i.jsx)(l.ZpM,{sx:{width:"100%",borderRadius:3,boxShadow:3,overflow:"hidden"},children:(0,i.jsxs)(l.Wux,{sx:{p:0},children:[(0,i.jsxs)(l.azJ,{sx:function(n){return{p:3,pb:2,display:"flex",justifyContent:"space-between",alignItems:"center",bgcolor:"dark"===e?n.palette.background.paper:"background.paper",borderBottom:"1px solid ".concat(n.palette.divider),borderColor:"divider"}},children:[(0,i.jsx)(l.EAD,{variant:"text",width:150,height:28}),(0,i.jsx)(l.EAD,{variant:"text",width:80,height:20})]}),(0,i.jsxs)(l.azJ,{sx:{display:"flex",height:"auto"},children:[(0,i.jsxs)(l.azJ,{sx:{flex:"0 0 40%",p:3},children:[(0,i.jsxs)(l.azJ,{sx:{display:"flex",gap:3,mb:3},children:[(0,i.jsxs)(l.azJ,{sx:{display:"flex",alignItems:"center"},children:[(0,i.jsx)(l.EAD,{variant:"rectangular",width:20,height:20,sx:{mr:1}}),(0,i.jsx)(l.EAD,{variant:"text",width:120,height:20})]}),(0,i.jsxs)(l.azJ,{sx:{display:"flex",alignItems:"center"},children:[(0,i.jsx)(l.EAD,{variant:"rectangular",width:20,height:20,sx:{mr:1}}),(0,i.jsx)(l.EAD,{variant:"text",width:130,height:20})]})]}),(0,i.jsxs)(l.azJ,{sx:{mb:3},children:[(0,i.jsx)(l.EAD,{variant:"text",width:100,height:20,sx:{mb:1}}),(0,i.jsx)(l.EAD,{variant:"rectangular",height:40})]}),(0,i.jsxs)(l.azJ,{sx:{mb:3},children:[(0,i.jsx)(l.EAD,{variant:"text",width:180,height:20,sx:{mb:1}}),(0,i.jsx)(l.EAD,{variant:"rectangular",width:100,height:36,sx:{mb:1}}),(0,i.jsx)(l.EAD,{variant:"text",width:"80%",height:16})]}),(0,i.jsxs)(l.azJ,{sx:{mb:3},children:[(0,i.jsx)(l.EAD,{variant:"text",width:200,height:20,sx:{mb:1}}),(0,i.jsx)(l.EAD,{variant:"rectangular",width:100,height:36,sx:{mb:1}}),(0,i.jsx)(l.EAD,{variant:"text",width:"75%",height:16})]}),(0,i.jsx)(l.EAD,{variant:"rectangular",width:120,height:40})]}),(0,i.jsxs)(l.azJ,{sx:{flex:"0 0 60%",display:"flex",flexDirection:"column"},children:[(0,i.jsx)(l.azJ,{sx:function(n){return{flex:1,position:"relative",overflow:"hidden",minHeight:"480px",border:"1px solid ".concat(n.palette.divider),borderRadius:2,boxShadow:"0 2px 8px rgba(0,0,0,0.1)",m:3,bgcolor:"dark"===e?n.palette.background.default:"grey.100"}},children:(0,i.jsxs)(l.azJ,{sx:function(n){return{position:"absolute",right:"10%",top:"50%",transform:"translateY(-50%)",width:"40%",bgcolor:"dark"===e?n.palette.background.paper:"white",p:3,borderRadius:1,boxShadow:1}},children:[(0,i.jsx)(l.EAD,{variant:"circular",width:60,height:60,sx:{mx:"auto",mb:2}}),(0,i.jsx)(l.EAD,{variant:"text",width:"100%",height:40,sx:{mb:2}}),(0,i.jsx)(l.EAD,{variant:"text",width:"100%",height:40,sx:{mb:2}}),(0,i.jsx)(l.EAD,{variant:"rectangular",width:"100%",height:40,sx:{mb:2}}),(0,i.jsx)(l.EAD,{variant:"text",width:"60%",height:16,sx:{mx:"auto"}})]})}),(0,i.jsx)(l.azJ,{sx:{p:3,pt:0,display:"flex",justifyContent:"center"},children:(0,i.jsxs)(l.azJ,{sx:function(n){return{display:"inline-flex",bgcolor:"dark"===e?n.palette.background.paper:"grey.200",borderRadius:1,p:.5,gap:.5}},children:[(0,i.jsx)(l.EAD,{variant:"rectangular",width:60,height:32,sx:{borderRadius:1}}),(0,i.jsx)(l.EAD,{variant:"rectangular",width:70,height:32,sx:{borderRadius:1}})]})})]})]})]})})},ne=function(e,n,t,r){return new(t||(t=Promise))((function(i,a){function o(e){try{l(r.next(e))}catch(e){a(e)}}function s(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(o,s)}l((r=r.apply(e,n||[])).next())}))},te=function(e,n){var t,r,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(t=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=n.call(e,a)}catch(e){s=[6,e],r=0}finally{t=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},re=function(e){var n,t,r,a,o,s,c,d,u,x,h,f,E=e.formik,S=e.loginBackgroun
1dFile,m=e.signupBackgroundFile,g=e.setLoginBackgroundFile,b=e.setSignupBackgroundFile,T=e.updateMutation,N=(0,J.f)().themeMode,v=(0,p.Bd)().t;return(0,i.jsx)(l.azJ,{sx:{flex:"0 0 30%",p:2},children:(0,i.jsxs)("form",{onSubmit:E.handleSubmit,children:[(0,i.jsxs)(l.azJ,{sx:{mb:1},children:[(0,i.jsx)(l.ip9,{control:(0,i.jsx)(l.Sc0,{name:"logoPlacement",checked:E.values.logoPlacement,onChange:function(e){E.handleChange(e),E.setFieldValue("logoPlacement",e.target.checked)}}),label:v("AGENCY_SETTINGS.LOGO_PLACEMENT"),sx:{"& .MuiFormControlLabel-label":{fontSize:"14px"}}}),(0,i.jsx)("br",{}),(0,i.jsx)(l.ip9,{control:(0,i.jsx)(l.Sc0,{name:"footerPlacement",checked:E.values.footerPlacement,onChange:function(e){E.handleChange(e),E.setFieldValue("footerPlacement",e.target.checked)}}),label:v("AGENCY_SETTINGS.FOOTER_PLACEMENT"),sx:{"& .MuiFormControlLabel-label":{fontSize:"14px"}}})]}),(0,i.jsxs)(l.MJN,{fullWidth:!0,sx:{mb:1},children:[(0,i.jsx)(l.l1Y,{sx:{fontSize:"14px"},children:v("AGENCY_SETTINGS.FORM_POSITION")}),(0,i.jsxs)(l.l6P,{name:"formPosition",value:E.values.formPosition,onChange:E.handleChange,label:v("AGENCY_SETTINGS.FORM_POSITION"),size:"small",children:[(0,i.jsx)(l.Drp,{value:"1",children:v("AGENCY_SETTINGS.FORM_POSITION_LEFT")}),(0,i.jsx)(l.Drp,{value:"2",children:v("AGENCY_SETTINGS.FORM_POSITION_RIGHT")})]})]}),(0,i.jsxs)(l.azJ,{sx:{my:1},children:[(0,i.jsx)(l.JU7,{name:v("AGENCY_SETTINGS.LOGIN_BACKGROUND_IMAGE"),helptext:v("AGENCY_SETTINGS.LOGIN_BACKGROUND_HELP"),ignoreSpace:!0}),(0,i.jsx)("br",{}),(0,i.jsx)(l.azJ,{sx:{width:96,height:64,border:"1px solid #ccc",borderRadius:1,background:"dark"===N?"#000":"#fff",display:"flex",marginTop:1,alignItems:"center",justifyContent:"center",overflow:"hidden",position:"relative"},children:S?(0,i.jsx)(l.hcB,{files:[S],setFiles:function(){},themeContext:J.f,readOnly:!0}):(null===(n=null==E?void 0:E.values)||void 0===n?void 0:n.backgroundImage)?(0,i.jsx)("img",{src:null===(t=null==E?void 0:E.values)||void 0===t?void 0:t.backgroundImage,alt:"backgroundImage",style:{width:"100%",height:"100%"}}):null}),(0,i.jsxs)(l.$nd,{variant:"outlined",component:"label",size:"small",sx:{my:1},children:[v("AGENCY_SETTINGS.CHOOSE_FILE"),(0,i.jsx)("input",{type:"file",accept:"image/*",hidden:!0,onChange:function(e){var n,t=null===(n=e.target.files)||void 0===n?void 0:n[0];t&&g(t)}})]}),(null===(r=E.values)||void 0===r?void 0:r.backgroundImage)&&(0,i.jsxs)(l.o5u,{variant:"caption",display:"block",color:"text.secondary",children:[v("AGENCY_SETTINGS.CURRENTLY")," ",(0,i.jsx)(l.azJ,{component:"span",children:(0,i.jsx)("a",{href:null===(a=E.values)||void 0===a?void 0:a.backgroundImage,target:"_blank",rel:"noopener noreferrer",children:null===(s=null===(o=E.values)||void 0===o?void 0:o.backgroundImage)||void 0===s?void 0:s.split("/").pop()})})]}),(0,i.jsx)(l.o5u,{variant:"caption",display:"block",color:"text.secondary",children:v("AGENCY_SETTINGS.RECOMMENDED_SIZE")})]}),(0,i.jsxs)(l.azJ,{sx:{my:1},children:[(0,i.jsx)(l.JU7,{style:{marginBottom:2},name:v("AGENCY_SETTINGS.SIGNUP_BACKGROUND_IMAGE"),helptext:v("AGENCY_SETTINGS.SIGNUP_BACKGROUND_HELP"),ignoreSpace:!0}),(0,i.jsx)("br",{}),(0,i.jsx)(l.azJ,{sx:{width:96,height:64,border:"1px solid #ccc",borderRadius:1,marginTop:1,background:"dark"===N?"#000":"#fff",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",position:"relative"},children:m?(0,i.jsx)(l.hcB,{files:[m],setFiles:function(){},themeContext:J.f,readOnly:!0}):(null===(c=null==E?void 0:E.values)||void 0===c?void 0:c.signupBackgroundImage)?(0,i.jsx)("img",{src:null===(d=null==E?void 0:E.values)||void 0===d?void 0:d.signupBackgroundImage,alt:"backgroundImage",style:{width:"100%",height:"100%"}}):null}),(0,i.jsxs)(l.$nd,{variant:"outlined",component:"label",size:"small",sx:{my:1},children:[v("AGENCY_SETTINGS.CHOOSE_FILE"),(0,i.jsx)("input",{type:"file",accept:"image/*",hidden:!0,onChange:function(e){var n,t=null===(n=e.target.files)||void 0===n?void 0:n[0];t&&b(t)}})]}),(null===(u=E.values)||void 0===u?void 0:u.signupBackgroundImage)&&(0,i.jsxs)(l.o5u,{variant:"caption",display:"block",color:"text.secondary",children:[v("AGENCY_SETTINGS.CURRENTLY")," ",(0,i.jsx)(l.azJ,{component:"span",children:(0,i.jsx)("a",{href:null===(x=E.values)||void 0===x?void 0:x.signupBackgroun
1dImage,target:"_blank",rel:"noopener noreferrer",children:null===(f=null===(h=E.values)||void 0===h?void 0:h.signupBackgroundImage)||void 0===f?void 0:f.split("/").pop()})})]}),(0,i.jsx)(l.o5u,{variant:"caption",display:"block",color:"text.secondary",children:v("AGENCY_SETTINGS.RECOMMENDED_SIZE")})]}),(0,i.jsx)(l.$nd,{type:"submit",variant:"contained",color:"primary",disabled:T.isPending,sx:{borderRadius:"6px",fontSize:"14px"},children:T.isPending?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(l.PaH,{size:"14px",sx:{mr:1}}),v("AGENCY_SETTINGS.UPDATING")]}):v("AGENCY_SETTINGS.UPDATE_THEME")})]})})},ie=function(e){var n=e.loginBackgroundFile,t=e.signupBackgroundFile,r=e.previewMode,a=e.setPreviewMode,o=e.formik,s=e.data,c=(0,J.f)().themeMode,d=(0,p.Bd)().t;return s?(0,i.jsxs)(l.azJ,{sx:{flex:"0 0 70%",display:"flex",flexDirection:"column"},children:[(0,i.jsx)(l.azJ,{sx:{flex:1,position:"relative",overflow:"hidden",minHeight:"480px",border:"dark"===c?"1px solid #333":"1px solid #e0e0e0",borderRadius:2,boxShadow:"0 2px 8px rgba(0,0,0,0.1)",m:3,mt:2},children:(0,i.jsxs)(l.azJ,{sx:{height:"100%",display:"flex",alignItems:"stretch",flexDirection:"1"===(o.values.formPosition||(null==s?void 0:s.formPosition)||"2")?"row-reverse":"row",position:"relative"},children:[(0,i.jsx)(l.azJ,{component:"div",sx:{width:"60%",backgroundImage:"url(".concat("login"===r?n?URL.createObjectURL(n):(null==s?void 0:s.backgroundImage)||N:t?URL.createObjectURL(t):(null==s?void 0:s.signupBackgroundImage)||N,")"),backgroundSize:"cover",backgroundPosition:"center",height:"100%"}}),(0,i.jsxs)(l.azJ,{sx:{width:"40%",backgroundColor:"dark"===c?"#000":"#fff",display:"flex",flexDirection:"column",justifyContent:"center",p:4,borderRadius:0,boxShadow:"none",alignSelf:"stretch",paddingBottom:o.values.footerPlacement?"72px":4},children:[o.values.logoPlacement&&(0,i.jsx)(l.azJ,{sx:{display:"flex",justifyContent:"center",mb:1},children:(0,i.jsx)(l.azJ,{component:"img",src:"/static/common/img/logo.png",alt:"Logo",sx:{height:40}})}),(0,i.jsx)(l.azJ,{sx:{mb:1},children:(0,i.jsx)(l.o5u,{variant:"h5",fontWeight:"bold",sx:{mb:1},align:"center",children:d("login"===r?"AGENCY_SETTINGS.LOGIN":"AGENCY_SETTINGS.CREATE_ACCOUNT")})}),(0,i.jsx)(l.azJ,{sx:{height:48,backgroundColor:"dark"===c?"#333":"#f5f5f5",borderRadius:1,mb:1}}),(0,i.jsx)(l.azJ,{sx:{height:48,backgroundColor:"dark"===c?"#333":"#f5f5f5",borderRadius:1}})]}),o.values.footerPlacement&&(0,i.jsxs)(l.azJ,{sx:{position:"absolute",bottom:0,left:0,right:0,backgroundColor:"#1976d2",color:"white",py:.5,px:3,display:"flex",justifyContent:"space-between",alignItems:"center",zIndex:10,minHeight:"48px","& .MuiTypography-root":{color:"#fff",fontWeight:500,textShadow:"0 1px 2px rgba(0, 0, 0, 0.28)"}},children:[(0,i.jsx)(l.o5u,{variant:"body2",sx:{fontSize:"12px"},children:d("AGENCY_SETTINGS.COPYRIGHT")}),(0,i.jsxs)(l.azJ,{sx:{display:"flex",gap:2},children:[(0,i.jsx)(l.o5u,{variant:"body2",sx:{fontSize:"12px",cursor:"pointer"},children:d("AGENCY_SETTINGS.PRIVACY_POLICY")}),(0,i.jsx)(l.o5u,{variant:"body2",sx:{fontSize:"12px"},children:"â¢"}),(0,i.jsx)(l.o5u,{variant:"body2",sx:{fontSize:"12px",cursor:"pointer"},children:d("AGENCY_SETTINGS.TERMS_CONDITIONS")})]})]})]})}),(0,i.jsx)(l.azJ,{sx:{p:3,pt:0,display:"flex",justifyContent:"center"},children:(0,i.jsxs)(l.WKD,{value:r,exclusive:!0,onChange:function(e,n){
1null!==n&&a(n)},"aria-label":"Preview mode",size:"small",children:[(0,i.jsx)(l.ffE,{value:"login",sx:{textTransform:"none",px:3},children:d("AGENCY_SETTINGS.LOGIN")}),(0,i.jsx)(l.ffE,{value:"signup",sx:{textTransform:"none",px:3},children:d("AGENCY_SETTINGS.SIGNUP")})]})})]}):null},ae=function(e){var n=e.agencyId,t=(0,a.useState)(null),r=t[0],o=t[1],s=(0,a.useState)(null),c=s[0],d=s[1],u=(0,a.useState)("login"),f=u[0],E=u[1],S=(0,a.useState)(!1),m=(S[0],S[1]),g=(0,p.Bd)().t,b=(0,x._V)(n),T=b.data,N=b.isLoading,v=b.isError,_=(0,x.yo)(),j=(0,h.Wx)({enableReinitialize:!0,initialValues:{logoPlacement:(null==T?void 0:T.logoPlacement)||!1,footerPlacement:(null==T?void 0:T.footerPlacement)||!1,formPosition:(null==T?void 0:T.formPosition)||"2",backgroundImage:(null==T?void 0:T.backgroundImage)||"",signupBackgroundImage:(null==T?void 0:T.signupBackgroundImage)||""},onSubmit:function(e){return ne(void 0,void 0,void 0,(function(){var t;return te(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),(t=new FormData).append("logo_placement",e.logoPlacement.toString()),t.append("footer_placement",e.footerPlacement.toString()),t.append("form_position",e.formPosition),r&&t.append("background_image",r),c&&t.append("signup_background_image",c),[4,_.mutateAsync({agencyId:n,payload:t,isFormData:!0})];case 1:return i.sent(),(0,A.Sx)("",g("AGENCY_SETTINGS.STYLING_UPDATED_SUCCESS"),"success"),[3,3];case 2:return i.sent(),(0,A.Sx)("",g("AGENCY_SETTINGS.STYLING_UPDATED_ERROR"),"error"),[3,3];case 3:return[2]}}
1))}))}});return N?(0,i.jsx)(ee,{}):v?(0,i.jsx)(l.FcD,{severity:"error",children:g("AGENCY_SETTINGS.ERROR_LOADING_STYLING")}):(0,i.jsx)(l.ZpM,{sx:{width:"100%"},children:(0,i.jsxs)(l.Wux,{sx:{p:0},children:[(0,i.jsxs)(l.azJ,{sx:{p:2,pb:0,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,i.jsx)(l.o5u,{variant:"subtitle1",color:"primary",className:"mb-2 fw-bolder",children:g("AGENCY_SETTINGS.UPDATE_STYLING")}),(0,i.jsx)(l.o5u,{variant:"body2",color:"primary",sx:{cursor:"pointer",fontSize:"14px"},onClick:function(){return m(!0)},children:g("AGENCY_SETTINGS.NEED_HELP")})]}),(0,i.jsxs)(l.azJ,{sx:{display:"flex",height:"auto"},children:[(0,i.jsx)(re,{formik:j,setLoginBackgroundFile:o,setSignupBackgroundFile:d,updateMutation:_,loginBackgroundFile:r,signupBackgroundFile:c}),(0,i.jsx)(ie,{loginBackgroundFile:r,signupBackgroundFile:c,previewMode:f,setPreviewMode:E,formik:j,data:T})]})]})})},oe={1:"default-theme",2:"seafoam-theme",3:"flat-theme",4:"sunset-theme",5:"subtle-theme"},se=[{value:"1",label:"Default"},{value:"2",label:"SeaFoam"},{value:"3",label:"Flat"},{value:"4",label:"SunSet"},{value:"5",label:"Subtle"}],le={1:{"btn-primary":"rgb(25, 118, 210)","btn-secondary":"rgb(108, 117, 125)","btn-info":"rgb(13, 202, 240)","btn-warning":"rgb(255, 193, 7)","btn-danger":"rgb(220, 53, 69)"},2:{"btn-primary":"rgb(6, 121, 79)","btn-secondary":"rgb(108, 117, 125)","btn-info":"rgb(13, 202, 240)","btn-warning":"rgb(255, 193, 7)","btn-danger":"rgb(220, 53, 69)"},3:{"btn-primary":"rgb(29, 161, 245)","btn-secondary":"rgb(108, 117, 125)","btn-info":"rgb(13, 202, 240)","btn-warning":"rgb(255, 193, 7)","btn-danger":"rgb(220, 53, 69)"},4:{"btn-primary":"rgb(245, 59, 87)","btn-secondary":"rgb(255, 121, 63)","btn-info":"rgb(87, 95, 207)","btn-warning":"rgb(255, 168, 1)","btn-danger":"rgb(221, 67, 58)"},5:{"btn-primary":"rgb(80, 108, 106)","btn-secondary":"rgb(108, 117, 125)","btn-info":"rgb(13, 202, 240)","btn-warning":"rgb(255, 193, 7)","btn-danger":"rgb(220, 53, 69)"}},ce=function(){var e=(0,J.f)().themeMode;return(0,i.jsx)(l.ZpM,{sx:{width:"100%",borderRadius:3,boxShadow:3,overflow:"hidden"},children:(0,i.jsxs)(l.Wux,{sx:{p:0},children:[(0,i.jsxs)(l.azJ,{sx:function(n){return{p:3,pb:2,display:"flex",justifyContent:"space-between",alignItems:"center",bgcolor:"dark"===e?n.palette.background.paper:"background.paper",borderBottom:"1px solid ".concat(n.palette.divider),borderColor:"divider"}},children:[(0,i.jsx)(l.EAD,{variant:"text",width:150,height:28}),(0,i.jsx)(l.EAD,{variant:"text",width:80,height:20})]}),(0,i.jsxs)(l.azJ,{sx:{display:"flex",minHeight:400},children:[(0,i.jsxs)(l.azJ,{sx:function(n){return{flex:"0 0 50%",p:3,bgcolor:"dark"===e?n.palette.background.default:"background.default",borderRight:1,borderColor:"divider"}},children:[(0,i.jsxs)(l.azJ,{sx:{mb:4},children:[(0,i.jsx)(l.EAD,{variant:"text",width:60,height:20,sx:{mb:1}}),(0,i.jsx)(l.EAD,{variant:"rectangular",height:40})]}),(0,i.jsx)(l.EAD,{variant:"rectangular",width:120,height:40})]}),(0,i.jsxs)(l.azJ,{sx:function(n){return{flex:"0 0 50%",p:3,bgcolor:"dark"===e?n.palette.background.paper:"background.paper"}},children:[(0,i.jsx)(l.EAD,{variant:"text",width:180,height:24,sx:{mb:3}}),(0,i.jsx)(l.azJ,{sx:{display:"flex",flexDirection:"column",gap:2},children:[1,2,3,4,5].map((function(e){return(0,i.jsx)(l.ZpM,{elevation:2,sx:{borderRadius:2,overflow:"hidden"},children:(0,i.jsxs)(l.azJ,{sx:{width:"100%",height:56,display:"flex",alignItems:"center",justifyContent:"space-between",px:3},children:[(0,i.jsx)(l.EAD,{variant:"text",width:80,height:20}),(0,i.jsx)(l.EAD,{variant:"rectangular",width:80,height:24,sx:{borderRadius:1}})]})},e)}))})]})]})]})})},de=function(e,n,t,r){return new(t||(t=Promise))((function(i,a){function o(e){try{l(r.next(e))}catch(e){a(e)}}function s(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(o,s)}l((r=r.apply(e,n||[])).next())}))},ue=function(e,n){var t,r,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(t=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=n.call(e,a)}catch(e){s=[6,e],r=0}finally{t=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},xe=function(e){var n=e.agencyId,t=(0,p.Bd)().t,r=(0,x.NP)(n),o=r.data,s=r.isLoading,c=r.isError,d=(0,x.$O)(),u=a.useState(!1),f=(u[0],u[1],(0,h.Wx)({enableReinitialize:!0,initialValues:{theme:(null==o?void 0:o.theme)||"1"},onSubmit:function(e){return de(void 0,void 0,void 0,(function(){var r;return ue(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,d.mutateAsync({agencyId:n,payload:{theme:e.theme}})];case 1:return i.sent(),r=oe[e.theme],window.applyLightMode&&r&&(window.applyLightMode(r),window.themeByValue&&(window.themeByValue[e.theme]=r)),(0,A.Sx)("",t("AGENCY_SETTINGS.UPDATE_THEME"),"success"),[3,3];case 2:return i.sent(),(0,A.Sx)("",t("AGENCY_SETTINGS.ERROR_LOADING_THEME"),"error"),[3,3];case 3:return[2]}}
1))}))}})),E=function(e,n){var t;return(null===(t=le[e])||void 0===t?void 0:t[n])||le[1][n]};return s?(0,i.jsx)(ce,{}):c?(0,i.jsx)(l.FcD,{severity:"error",children:t("AGENCY_SETTINGS.ERROR_LOADING_THEME")}):(0,i.jsx)(l.ZpM,{sx:{width:"100%"},children:(0,i.jsxs)(l.Wux,{sx:{p:0},children:[(0,i.jsxs)(l.azJ,{sx:{p:3,pb:0,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,i.jsx)(l.o5u,{variant:"subtitle1",color:"primary",className:"mb-2 fw-bolder",children:t("AGENCY_SETTINGS.UPDATE_STYLING")}),(0,i.jsx)(l.o5u,{variant:"body2",color:"primary",sx:{cursor:"pointer",fontSize:"14px"},children:t("AGENCY_SETTINGS.NEED_HELP")})]}),(0,i.jsxs)(l.azJ,{sx:{display:"flex",height:"auto"},children:[(0,i.jsx)(l.azJ,{sx:{flex:"0 0 50%",p:3},children:(0,i.jsxs)("form",{onSubmit:f.handleSubmit,children:[(0,i.jsxs)(l.MJN,{fullWidth:!0,sx:{mb:3},children:[(0,i.jsx)(l.l1Y,{sx:{fontSize:"14px"},children:t("AGENCY_SETTINGS.THEME_LABEL")}),(0,i.jsx)(l.l6P,{name:"theme",value:f.values.theme,onChange:f.handleChange,label:t("AGENCY_SETTINGS.THEME_LABEL"),size:"small",children:se.map((function(e){return(0,i.jsx)(l.Drp,{value:e.value,children:e.label},e.value)}))})]}),(0,i.jsx)(l.$nd,{type:"submit",variant:"contained",color:"primary",disabled:d.isPending,children:d.isPending?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(l.PaH,{size:"14px",sx:{mr:1}}),t("AGENCY_SETTINGS.UPDATING")]}):t("AGENCY_SETTINGS.UPDATE_THEME")})]})}),(0,i.jsxs)(l.azJ,{sx:{flex:"0 0 50%",p:3},children:[(0,i.jsx)(l.o5u,{variant:"body2",fontWeight:500,sx:{mb:2,fontSize:"16px"},children:t("AGENCY_SETTINGS.COLOR_PALETTE")}),(0,i.jsx)(l.azJ,{sx:{display:"flex",flexDirection:"column",gap:2},children:["btn-primary","btn-secondary","btn-info","btn-warning","btn-danger"].map((function(e){return(0,i.jsxs)(l.azJ,{sx:{width:"100%",height:"48px",borderRadius:"6px",display:"flex",alignItems:"center",justifyContent:"center",color:"white",fontWeight:500,fontSize:"16px",backgroundColor:E(f.values.theme,e),boxShadow:"0 2px 4px rgba(0,0,0,0.1)",flexDirection:"column"},children:[(0,i.jsx)("span",{children:t("AGENCY_SETTINGS.BTN_".concat(e.replace("btn-","").toUpperCase()))}),(0,i.jsx)("span",{style:{fontSize:"14px",fontWeight:400},children:E(f.values.theme,e)})]},e)}))})]})]})]})})},he=t(69818),pe=t(45602),fe=t(57559),Ee=t(47940),Se=function(e,n,t,r){return new(t||(t=Promise))((function(i,a){function o(e){try{l(r.next(e))}catch(e){a(e)}}function s(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(o,s)}l((r=r.apply(e,n||[])).next())}))},me=function(e,n){var t,r,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(t=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=n.call(e,a)}catch(e){s=[6,e],r=0}finally{t=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},ge=function(e){var n=e.agencyId,t=(0,p.Bd)().t,r=(0,J.f)().themeMode,o=(0,pe.jE)(),s=(0,a.useState)(""),c=s[0],d=s[1],u=(0,a.useState)(null),h=u[0],f=u[1],E=(0,a.useState)(""),S=E[0],m=E[1],g=(0,a.useState)(!1),b=g[0],T=g[1],N=(0,a.useState)(""),_=N[0],j=N[1],C=(0,a.useState)(!1),I=C[0],y=C[1],G=(0,x.NP)(n),L=G.data,P=G.isLoading,O=(0,x.$O)();(0,a.useEffect)((function(){L&&(d(L.masterChatName||""),m(L.masterChatLogo||""),y(!1))}),[L]);var w=function(e){var n,r=null===(n=e.target.files)||void 0===n?void 0:n[0];if(j(""),r){var i=function(e){return v.includes(e.type)?e.size>5242880?t("AGENCY_SETTINGS.ERROR_FILE_TOO_LARGE"):null:t("AGENCY_SETTINGS.ERROR_INVALID_FILE_TYPE")}(r);if(i)return j(i),void(e.target.value="");f(r),y(!1),T(!0);var a=new FileReader;a.onloadend=function(){m(a.result)},a.readAsDataURL(r)}};return P?(0,i.jsx)(l.azJ,{sx:{display:"flex",justifyContent:"center",alignItems:"center",minHeight:300},children:(0,i.jsx)(l.PaH,{})}):(0,i.jsxs)(l.azJ,{sx:{position:"relative",minHeight:"400px"},children:[(0,i.jsx)(l.o5u,{variant:"h6",sx:{mb:3,fontWeight:600,color:"dark"===r?"grey.100":"grey.900"},children:t("AGENCY_SETTINGS.MASTERCHAT_CUSTOMIZATION")}),(0,i.jsxs)(l.azJ,{sx:{display:"flex",flexDirection:"column",gap:3,maxWidth:600,pb:8},children:[(0,i.jsxs)(l.azJ,{children:[(0,i.jsx)(l.o5u,{variant:"body2",sx:{mb:1,fontWeight:500,color:"dark"===r?"grey.300":"grey.700"},children:t("AGENCY_SETTINGS.MASTERCHAT_NAME")}),(0,i.jsx)(l.A_L,{fullWidth:!0,value:c,onChange:function(e){d(e.target.value),T(!0)},placeholder:"MasterChat",size:"small",sx:{maxWidth:400,"& .MuiOutlinedInput-root":{bgcolor:"dark"===r?"grey.800":"common.white"}}})]}),(0,i.jsxs)(l.azJ,{children:[(0,i.jsx)(l.o5u,{variant:"body2",sx:{mb:1,fontWeight:500,color:"dark"===r?"grey.300":"grey.700"},children:t("AGENCY_SETTINGS.MASTERCHAT_LOGO")}),S?(0,i.jsxs)(l.azJ,{children:[(0,i.jsx)(l.azJ,{sx:{mb:2,p:2,border:1,borderColor:"dark"===r?"grey.700":"grey.300",borderRadius:2,bgcolor:"dark"===r?"grey.800":"grey.50",display:"inline-flex",alignItems:"center",justifyContent:"center"},children:(0,i.jsx)(l.azJ,{sx:{display:"flex",alignItems:"center",justifyContent:"center",p:2,bgcolor:"dark"===r?"grey.900":"common.white",borderRadius:1,minWidth:200},children:(0,i.jsx)("img",{src:S,alt:"Masterchat Logo Preview",style:{maxWidth:"200px",maxHeight:"100px",objectFit:"contain",display:"block"}})})}),(0,i.jsxs)(l.BJc,{direction:"row",spacing:1.5,children:[(0,i.jsxs)(l.$nd,{variant:"outlined",component:"label",size:"small",startIcon:(0,i.jsx)(Ee.A,{}),children:[t("AGENCY_SETTINGS.CHANGE_LOGO"),(0,i.jsx)("input",{type:"file",hidden:!0,accept:"image/*",onChange:w})]}),(0,i.jsx)(l.$nd,{variant:"outlined",size:"small",color:"error",startIcon:(0,i.jsx)(fe.A,{}),onClick:function(){f(null),m(""),y(!0),T(!0),j("")},children:t("AGENCY_SETTINGS.REMOVE_LOGO")})]})]}):(0,i.jsx)(l.azJ,{children:(0,i.jsxs)(l.$nd,{variant:"outlined",color:"primary",component:"label",size:"medium",startIcon:(0,i.jsx)(Ee.A,{}),sx:{py:1.5,px:3,borderStyle:"dashed",borderWidth:2,"&:hover":{borderStyle:"dashed",borderWidth:2}},children:[t("AGENCY_SETTINGS.UPLOAD_LOGO"),(0,i.jsx)("input",{type:"file",hidden:!0,accept:"image/*",onChange:w})]})}
1),(0,i.jsx)(l.o5u,{variant:"caption",sx:{display:"block",mt:1,color:"dark"===r?"grey.400":"grey.600"},children:t("AGENCY_SETTINGS.LOGO_REQUIREMENTS")}),_&&(0,i.jsx)(l.FcD,{severity:"error",sx:{mt:2},children:_})]})]}),(0,i.jsxs)(l.azJ,{sx:{position:"absolute",bottom:0,right:0,display:"flex",gap:2,pt:3,pb:2},children:[(0,i.jsx)(l.$nd,{variant:"outlined",onClick:function(){L&&(d(L.masterChatName||""),m(L.masterChatLogo||""),f(null),y(!1),T(!1),j(""))},disabled:!b||O.isPending,size:"medium",children:t("DISPLAY_STRINGS.RESET")}),(0,i.jsx)(l.$nd,{variant:"contained",onClick:function(){return Se(void 0,void 0,void 0,(function(){var e,r;return me(this,(function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),(e=new FormData).append("theme",String((null==L?void 0:L.theme)||1)),e.append("master_chat_name",c),I?e.append("master_chat_logo",""):h&&e.append("master_chat_logo",h),[4,O.mutateAsync({agencyId:n,payload:e,isFormData:!0})];case 1:return i.sent(),[4,o.invalidateQueries({queryKey:[he.e.DASHBOARD_CUSTOMIZATION,n]})];case 2:return i.sent(),T(!1),f(null),y(!1),(0,A.Sx)("",t("AGENCY_SETTINGS.SUCCESS_MASTERCHAT_UPDATED"),"success"),[3,4];case 3:return r=i.sent(),console.error("Error updating masterchat settings:",r),(0,A.Sx)("",t("AGENCY_SETTINGS.ERROR_UPDATE_FAILED"),"error"),[3,4];case 4:return[2]}}
1))}))},disabled:!b||O.isPending||!!_,size:"medium",children:O.isPending?(0,i.jsx)(l.PaH,{size:20,color:"inherit"}):t("AGENCY_SETTINGS.SAVE")})]})]})},be=function(e){var n=e.agencyId,t=(0,p.Bd)().t,r=(0,a.useState)(g),o=r[0],s=r[1];return(0,i.jsxs)(l.azJ,{sx:{width:"100%"},children:[(0,i.jsx)(l.azJ,{sx:{mb:2},children:(0,i.jsxs)(l.IzF,{value:o,exclusive:!0,onChange:function(e,n){null!==n&&s(n)},"aria-label":"Custom Styling Tabs",size:"small",color:"primary",children:[(0,i.jsx)(l.ffE,{value:g,children:t("AGENCY_SETTINGS.TAB_STYLING")}),(0,i.jsx)(l.ffE,{value:b,children:t("AGENCY_SETTINGS.TAB_CUSTOM_COLORS")}),(0,i.jsx)(l.ffE,{value:T,children:t("AGENCY_SETTINGS.MASTERCHAT_CUSTOM")})]})}),(0,i.jsxs)(l.azJ,{children:[o===g&&(0,i.jsx)(ae,{agencyId:n}),o===b&&(0,i.jsx)(xe,{agencyId:n}),o===T&&(0,i.jsx)(ge,{agencyId:n})]})]})},Te=t(51080),Ne=t(18009),ve=(0,H.A)((0,i.jsx)("path",{d:"M20 2H4c-1 0-2 .9-2 2v3.01c0 .72.43 1.34 1 1.69V20c0 1.1 1.1 2 2 2h14c.9 0 2-.9 2-2V8.7c.57-.35 1-.97 1-1.69V4c0-1.1-1-2-2-2m-5 12H9v-2h6zm5-7H4V4l16-.02z"}),"Inventory"),Ae=t(10857),_e=t(56673),je=function(e){var n=e.transactions,t=e.isFetching,r=(0,p.Bd)().t,o=a.useState(""),s=o[0],c=o[1],d=a.useState(0),u=d[0],x=d[1],h=a.useState(50),f=h[0],E=h[1],S=((0,J.f)().themeMode,a.useMemo((function(){if(!n||!Array.isArray(n))return[];if(!s||!s.trim())return n;var e=s.toLowerCase();return n.filter((function(n){var t,r,i,a;if(!n)return!1;try{return[n.id||"",n.description||"",(null===(r=null===(t=n.source)||void 0===t?void 0:t.billing_details)||void 0===r?void 0:r.email)||"",(null===(a=null===(i=n.source)||void 0===i?void 0:i.billing_details)||void 0===a?void 0:a.name)||"",n.status||"",n.type||""].some((function(n){return n.toLowerCase().includes(e)}))}catch(e){return console.warn("Error filtering transaction:",e),!1}}))}),[n,s])),m=a.useMemo((function(){if(!S||!Array.isArray(S))return[];var e=u*f;return S.slice(e,e+f)}),[S,u,f]);return t?(0,i.jsx)(_e.O,{}):(0,i.jsx)(l.ZpM,{sx:{mt:4},children:(0,i.jsxs)(l.Wux,{sx:{p:0},children:[(0,i.jsxs)(l.azJ,{sx:{p:3,borderBottom:1,borderColor:"divider"},children:[(0,i.jsx)(l.o5u,{variant:"h6",fontWeight:600,sx:{mb:2},children:r("AGENCY_SETTINGS.STRIPE_TRANSACTIONS_OVERVIEW")}),(0,i.jsxs)(l.azJ,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:2},children:[(0,i.jsxs)(l.azJ,{sx:{display:"flex",alignItems:"center",gap:2},children:[(0,i.jsx)(l.o5u,{variant:"body2",color:"text.secondary",children:r("AGENCY_SETTINGS.SHOW")}),(0,i.jsx)(l.MJN,{size:"small",sx:{minWidth:80},children:(0,i.jsxs)(l.l6P,{value:f,onChange:function(e){return n=parseInt(e.target.value,10),void(!isNaN(n)&&n>0&&(E(n),x(0)));var n},displayEmpty:!0,children:[(0,i.jsx)(l.Drp,{value:10,children:"10"}),(0,i.jsx)(l.Drp,{value:25,children:"25"}),(0,i.jsx)(l.Drp,{value:50,children:"50"}),(0,i.jsx)(l.Drp,{value:100,children:"100"})]})}),(0,i.jsx)(l.o5u,{variant:"body2",color:"text.secondary",children:r("AGENCY_SETTINGS.ENTRIES")})]}),(0,i.jsxs)(l.azJ,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,i.jsx)(l.o5u,{variant:"body2",color:"text.secondary",children:r("AGENCY_SETTINGS.SEARCH")}),(0,i.jsx)(l.A_L,{size:"small",value:s,onChange:function(e){var n=e.target.value||"";c(n),x(0)},placeholder:"",sx:{minWidth:200}})]})]})]}),(0,i.jsx)(l.K3K,{component:l.tu9,elevation:0,sx:{height:"500px",overflow:"auto"},children:(0,i.jsxs)(l.XIK,{sx:{minWidth:650},size:"small",stickyHeader:!0,children:[(0,i.jsx)(l.ndF,{children:(0,i.jsxs)(l.Hjg,{sx:{backgroundColor:"action.hover"},children:[(0,i.jsx)(l.nA6,{sx:{fontWeight:600,color:"text.secondary"},children:r("AGENCY_SETTINGS.TABLE_ID")}),(0,i.jsx)(l.nA6,{sx:{fontWeight:600,color:"text.secondary"},children:r("AGENCY_SETTINGS.TABLE_AMOUNT")}),(0,i.jsx)(l.nA6,{sx:{fontWeight:600,color:"text.secondary"},children:r("AGENCY_SETTINGS.TABLE_FEE")}),(0,i.jsx)(l.nA6,{sx:{fontWeight:600,color:"text.secondary"},children:r("AGENCY_SETTINGS.TABLE_NET")}),(0,i.jsx)(l.nA6,{sx:{fontWeight:600,color:"text.secondary"},children:r("AGENCY_SETTINGS.TABLE_DESCRIPTION")}),(0,i.jsx)(l.nA6,{sx:{fontWeight:600,color:"text.secondary"},children:r("AGENCY_SETTINGS.TABLE_USER")}),(0,i.jsx)(l.nA6,{sx:{fontWeight:600,color:"text.secondary"},children:r("AGENCY_SETTINGS.TABLE_STATUS")}),(0,i.jsx)(l.nA6,{sx:{fontWeight:600,color:"text.secondary"},children:r("AGENCY_SETTINGS.TABLE_TYPE")}),(0,i.jsx)(l.nA6,{sx:{fontWeight:600,color:"text.secondary"},children:r("AGENCY_SETTINGS.TABLE_DATE")})]})}),(0,i.jsx)(l.BFY,{children:m.length>0?m.map((function(e){var n,t;return(0,i.jsxs)(l.Hjg,{hover:!0,children:[(0,i.jsx)(l.nA6,{sx:{fontFamily:"monospace"},children:e.id?"".concat(e.id.slice(0,7),"...").concat(e.id.slice(-4)):r("AGENCY_SETTINGS.NA")}),(0,i.jsxs)(l.nA6,{children:[e.amount||0," ",e.currency?e.currency.toUpperCase():""]}),(0,i.jsxs)(l.nA6,{children:[e.fee||0," ",e.currency?e.currency.toUpperCase():""]}),(0,i.jsxs)(l.nA6,{sx:{fontWeight:500},children:[e.net||0," ",e.currency?e.currency.toUpperCase():""]}),(0,i.jsx)(l.nA6,{children:e.description||r("AGENCY_SETTINGS.NA")}),(0,i.jsx)(l.nA6,{children:(null===(t=null===(n=e.source)||void 0===n?void 0:n.billing_details)||void 0===t?void 0:t.email)?(0,i.jsxs)(l.azJ,{children:[(0,i.jsx)(l.o5u,{variant:"body2",children:e.source.billing_details.email}),e.source.billing_details.name&&(0,i.jsxs)(l.o5u,{variant:"caption",color:"text.secondary",children:["(",e.source.billing_details.name,")"]})]}):(0,i.jsx)(l.o5u,{variant:"body2",color:"text.secondary",children:r("AGENCY_SETTINGS.NA")})}),(0,i.jsx)(l.nA6,{children:(0,i.jsx)(l.vu3,{label:e.status||r("AGENCY_SETTINGS.NA"),size:"small",color:"available"===e.status?"success":"default",variant:"outlined"})}),(0,i.jsx)(l.nA6,{children:(0,i.jsx)(l.vu3,{label:e.type||r("AGENCY_SETTINGS.NA"),size:"small",variant:"outlined"})}),(0,i.jsx)(l.nA6,{sx:{fontFamily:"monospace",fontSize:"0.875rem"}
1,children:e.created?new Date(e.created).toLocaleString():r("AGENCY_SETTINGS.NA")})]},e.id)})):(0,i.jsx)(l.Hjg,{children:(0,i.jsx)(l.nA6,{colSpan:9,sx:{textAlign:"center",py:3},children:(0,i.jsx)(l.o5u,{variant:"body2",color:"text.secondary",children:r(s?"AGENCY_SETTINGS.NO_TRANSACTIONS_SEARCH":"AGENCY_SETTINGS.NO_TRANSACTIONS")})})})})]})}),S.length>0&&(0,i.jsxs)(l.azJ,{sx:{p:2,borderTop:1,borderColor:"divider",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,i.jsxs)(l.o5u,{variant:"body2",color:"text.secondary",children:[r("AGENCY_SETTINGS.PAGINATION_SHOWING",{from:Math.min(u*f+1,S.length),to:Math.min((u+1)*f,S.length),total:S.length}),s&&r("AGENCY_SETTINGS.PAGINATION_FILTERED",{total:n.length})]}),(0,i.jsxs)(l.azJ,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,i.jsx)(l.$nd,{size:"small",disabled:0===u,onClick:function(){return x(u-1)},sx:{minWidth:"auto",px:2},children:r("AGENCY_SETTINGS.PAGINATION_PREVIOUS")}),(0,i.jsx)(l.azJ,{sx:{display:"flex",gap:.5},children:Array.from({length:Math.ceil(S.length/f)},(function(e,n){return(0,i.jsx)(l.$nd,{size:"small",variant:n===u?"contained":"outlined",onClick:function(){return x(n)},sx:{minWidth:32,height:32},disabled:Math.ceil(S.length/f)<=1,children:n+1},n)})).slice(Math.max(0,u-2),Math.min(Math.ceil(S.length/f),u+3))}),(0,i.jsx)(l.$nd,{size:"small",disabled:u>=Math.ceil(S.length/f)-1,onClick:function(){return x(u+1)},sx:{minWidth:"auto",px:2},children:r("AGENCY_SETTINGS.PAGINATION_NEXT")})]})]})]})})},Ce=t(21762),Ie=t(29717),ye=function(e){var n=e.data,t=e.onDisconnectClick,r=(0,p.Bd)().t,o=(0,d.Zp)(),s=(0,a.useState)(null),c=s[0],u=s[1],x=(0,a.useState)(!1),h=x[0],f=x[1],E=(0,J.f)().themeMode,S=n.hasActiveSubaccounts||!1,m=n.agencyPackagesExist||!1,g=n.hasSubscriptionPackages||!1,b=!S&&!m&&!g;return(0,a.useEffect)((function(){f(!0),(0,Ie.f6)().then((function(e){u(e)})).finally((function(){f(!1)}))}),[]),(0,i.jsxs)(l.azJ,{children:[(0,i.jsx)(l.ZpM,{sx:{mb:4,mt:5,borderRadius:2,background:"dark"===E?"linear-gradient(135deg, #121212 0%, #333333 100%)":"linear-gradient(135deg, #f5f7fa 0%, #efefefff 100%)",border:"1px solid ".concat("dark"===E?"#000":"#e0e7ff"),boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)"},children:(0,i.jsx)(l.Wux,{sx:{p:5},children:(0,i.jsxs)(l.azJ,{sx:{display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[(0,i.jsxs)(l.azJ,{sx:{flex:1,pr:4},children:[(0,i.jsx)(l.o5u,{variant:"h4",sx:{fontSize:"1.5rem",fontWeight:600,lineHeight:1.3,mb:2,color:"#1976d2"},children:r("AGENCY_SETTINGS.STRIPE_CONNECTED_TITLE")}),(0,i.jsx)(l.o5u,{variant:"body1",sx:{fontSize:"0.875rem",lineHeight:1.5,color:"#64748b",mb:3,maxWidth:"600px"},children:r("AGENCY_SETTINGS.STRIPE_CONNECTED_DESCRIPTION")}),!b&&(0,i.jsx)(l.FcD,{severity:"warning",sx:{mb:3,maxWidth:"600px"},children:(0,i.jsx)(l.o5u,{variant:"body2",sx:{fontWeight:500,mb:.5},children:(0,j.w)({hasActiveSubaccounts:S,packagesExist:m,hasSubscriptionPackages:g})})}),(0,i.jsxs)(l.azJ,{sx:{display:"flex",flexDirection:"column",gap:2,alignItems:"flex-start"},children:[(0,i.jsxs)(l.azJ,{sx:{display:"flex",gap:1.5,flexWrap:"wrap",alignItems:"center"},children:[(0,i.jsx)(l.$nd,{variant:"contained",color:"primary",size:"medium",sx:{py:1,px:3,fontSize:"0.875rem",borderRadius:1},onClick:function(){return(0,Ie.Xw)(n.stripeAccountId)},startIcon:(0,i.jsx)(Ne.A,{}),children:r("AGENCY_SETTINGS.UPDATE_STRIPE_ACCOUNT")}),(0,i.jsx)(l.$nd,{variant:"contained",color:"primary",size:"medium",sx:{py:1,px:3,fontSize:"0.875rem",borderRadius:1},onClick:function(){var e,n,t,r;e=Ce.n.WHITE_LABEL.AGENCY_SUBSCRIPTION_PACKAGES,n=new URL(e,window.location.origin),t="/".concat((0,A.BY)()),(r=n.pathname)===t||r==="".concat(t,"/")?r="/":r.startsWith("".concat(t,"/"))&&(r=r.slice(t.length)||"/"),o("".concat(r).concat(n.search).concat(n.hash))},startIcon:(0,i.jsx)(ve,{}),children:r("AGENCY_SETTINGS.CREATE_SUBSCRIPTION_PACKAGES")})]}),(0,i.jsx)(l.m_M,{title:(0,j.w)({hasActiveSubaccounts:S,packagesExist:m,hasSubscriptionPackages:g}),children:(0,i.jsx)("span",{children:(0,i.jsx)(l.$nd,{variant:"contained",color:"error",size:"medium",disabled:!b,onClick:t,startIcon:(0,i.jsx)(Ae.A,{}),sx:{py:1,px:3,fontSize:"0.875rem",borderRadius:1},children:r("AGENCY_SETTINGS.DISCONNECT_STRIPE_ACCOUNT")})})})]})]}),(0,i.jsx)(l.azJ,{sx:{display:{xs:"none",lg:"block"},flex:"0 0 50%",position:"relative",top:"-20px",ml:2},children:(0,i.jsx)(l.azJ,{sx:{width:"100%",height:"300px",backgroundImage:"url(/static/common/img/illustrations/statistics.svg)",backgroundSize:"contain",backgroundRepeat:"no-repeat",backgroundPosition:"center"}})})]})})}),(0,i.jsx)(je,{transactions:(null==c?void 0:c.data)||[],isFetching:h})]})},Ge=function(e,n,t,r){return new(t||(t=Promise))((function(i,a){function o(e){try{l(r.next(e))}catch(e){a(e)}}function s(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(o,s)}l((r=r.apply(e,n||[])).next())}))},Le=function(e,n){var t,r,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(t=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=n.call(e,a)}catch(e){s=[6,e],r=0}finally{t=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},Pe=function(e){var n=e.open,t=e.onClose,r=e.onSubmit,o=(0,p.Bd)().t,s=(0,a.useState)("US"),c=s[0],d=s[1],u=(0,a.useState)(!1),x=u[0],h=u[1];return(0,i.jsx)(l.lGe,{open:n,onClose:t,maxWidth:"sm",fullWidth:!0,children:(0,i.jsxs)("form",{onSubmit:function(e){return Ge(void 0,void 0,void 0,(function(){return Le(this,(function(n){switch(n.label){case 0:if(e.preventDefault(),!c)return[3,4];h(!0),n.label=1;case 1:return n.trys.push([1,,3,4]),[4,r(c.trim().toUpperCase())];case 2:return n.sent(),[3,4];case 3:return h(!1),[7];case 4:return[2]}}
1))}))},children:[(0,i.jsx)(l.L33,{children:o("AGENCY_SETTINGS.CONNECT_STRIPE_TITLE")}),(0,i.jsx)(l.Cff,{children:(0,i.jsxs)(l.azJ,{sx:{mt:2},children:[(0,i.jsx)(l.MJN,{fullWidth:!0,children:(0,i.jsx)(l.A_L,{label:o("AGENCY_SETTINGS.COUNTRY_CODE_LABEL"),value:c,onChange:function(e){return d(e.target.value)},required:!0,inputProps:{maxLength:2},helperText:o("AGENCY_SETTINGS.COUNTRY_CODE_HELP")})}),(0,i.jsxs)(l.o5u,{variant:"body2",color:"text.secondary",sx:{mt:2},children:["See"," ",(0,i.jsx)("a",{href:"https://stripe.com/global",target:"_blank",rel:"noopener noreferrer",children:o("AGENCY_SETTINGS.STRIPE_GLOBAL_MARKETS")})," ","and"," ",(0,i.jsx)("a",{href:"https://stripe.com/docs/connect/cross-border-payouts",target:"_blank",rel:"noopener noreferrer",children:o("AGENCY_SETTINGS.STRIPE_SUPPORTED_COUNTRIES")})," ","for available options."]})]})}),(0,i.jsxs)(l.iin,{children:[(0,i.jsx)(l.$nd,{onClick:t,color:"inherit",children:o("AGENCY_SETTINGS.CLOSE")}),(0,i.jsx)(l.$nd,{type:"submit",variant:"contained",color:"success",disabled:!c||x,startIcon:x?(0,i.jsx)(l.PaH,{size:20,color:"inherit"}):null,children:o(x?"AGENCY_SETTINGS.CONNECTING":"AGENCY_SETTINGS.CONNECT_STRIPE")})]})]})})},Oe=function(e,n,t,r){return new(t||(t=Promise))((function(i,a){function o(e){try{l(r.next(e))}catch(e){a(e)}}function s(e){try{l(r.throw(e))}catch(e){a(e)}}function l(e){var n;e.done?i(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(o,s)}l((r=r.apply(e,n||[])).next())}))},we=function(e,n){var t,r,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(t=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=n.call(e,a)}catch(e){s=[6,e],r=0}finally{t=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},Re=function(e){e.data;var n=e.onConnectClick,t=(0,p.Bd)().t;return(0,i.jsxs)(l.azJ,{children:[(0,i.jsx)(l.FcD,{severity:"warning",sx:{mb:3,"& .MuiAlert-message":{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between"}},action:(0,i.jsx)(l.azJ,{sx:{display:"flex",alignItems:"center",gap:1},children:(0,i.jsx)(l.N_E,{href:"#",onClick:function(e){e.preventDefault(),console.log("Opening help")},sx:{color:"inherit",textDecoration:"none",display:"flex",alignItems:"center",gap:.4,fontSize:"13px"},children:t("AGENCY_SETTINGS.NEED_HELP")})}),children:(0,i.jsxs)(l.azJ,{children:[t("AGENCY_SETTINGS.STRIPE_NOT_CONNECTED")," ",(0,i.jsx)(l.N_E,{href:"#",onClick:function(e){e.preventDefault(),n()},sx:{color:"inherit",textDecoration:"underline",cursor:"pointer","&:hover":{textDecoration:"none"}},children:t("AGENCY_SETTINGS.STRIPE_CLICK_TO_CONNECT")})," ",t("AGENCY_SETTINGS.STRIPE_GET_STARTED")]})}),(0,i.jsx)(l.ZpM,{sx:{bgcolor:"#000",color:"white",borderRadius:2},children:(0,i.jsx)(l.azJ,{component:"iframe",src:"https://www.loom.com/embed/f48f06da9f9440d59f23b4b8129e40a0?sid=9445d310-8513-4d4c-8231-c96d82a1d6f4",sx:{width:"100%",height:600,border:"none",borderRadius:1}})})]})},Ye=function(e){var n=e.open,t=e.onClose,r=e.onConfirm,a=e.packagesExist,o=e.hasActiveSubaccounts,s=e.hasSubscriptionPackages,c=e.isLoading,d=(0,p.Bd)().t,u=a||o||s;return(0,i.jsxs)(l.lGe,{open:n,onClose:t,maxWidth:"sm",fullWidth:!0,children:[(0,i.jsxs)(l.L33,{sx:{display:"flex",alignItems:"center",gap:1},children:[(0,i.jsx)(Te.A,{color:"warning"}),d("AGENCY_SETTINGS.STRIPE_DISCONNECT_TITLE")]}),(0,i.jsx)(l.Cff,{children:(0,i.jsxs)(l.zTD,{children:[d("AGENCY_SETTINGS.STRIPE_DISCONNECT_CONFIRMATION"),(a||o||s)&&(0,i.jsx)(l.FcD,{severity:"warning",sx:{mt:2},children:(0,j.w)({hasActiveSubaccounts:o,packagesExist:a,hasSubscriptionPackages:s})})]})}),(0,i.jsxs)(l.iin,{children:[(0,i.jsx)(l.$nd,{onClick:t,disabled:c,
1children:d("AGENCY_SETTINGS.CANCEL")}),(0,i.jsx)(l.$nd,{onClick:r,color:"error",variant:"contained",disabled:u||c,children:d(c?"AGENCY_SETTINGS.DISCONNECTING":"AGENCY_SETTINGS.DISCONNECT")})]})]})},De=function(){var e=(0,p.Bd)().t,n=(0,Ie.jH)(),t=n.data,r=n.isLoading,o=n.isError,s=n.refetch,c=(0,a.useState)(!1),d=c[0],u=c[1],x=(0,a.useState)(!1),h=x[0],f=x[1];if(r)return(0,i.jsx)(_e.A,{});if(o||!t)return(0,i.jsx)(l.FcD,{severity:"error",sx:{mb:3},children:e("AGENCY_SETTINGS.FAILED_TO_LOAD_STRIPE")});return(0,i.jsxs)(l.azJ,{children:[t.isStripeConnected?(0,i.jsx)(ye,{data:t,onDisconnectClick:function(){return u(!0)}}):(0,i.jsx)(Re,{data:t,onConnectClick:function(){t.stripeAccountId?(0,Ie.Xw)(t.stripeAccountId):f(!0)}}),(0,i.jsx)(Pe,{open:h,onClose:function(){return f(!1)},onSubmit:function(e){return Oe(void 0,void 0,void 0,(function(){return we(this,(function(n){switch(n.label){case 0:return[4,(0,Ie.$N)(e)];case 1:return n.sent(),f(!1),[2]}}))}))}}),(0,i.jsx)(Ye,{open:d,onClose:function(){return u(!1)},onConfirm:function(){return Oe(void 0,void 0,void 0,(function(){return we(this,(function(e){switch(e.label){case 0:return[4,(0,Ie.CE)(s)];case 1:return e.sent(),u(!1),[2]}}))}))},packagesExist:t.agencyPackagesExist,hasActiveSubaccounts:t.hasActiveSubaccounts,hasSubscriptionPackages:t.hasSubscriptionPackages,isLoading:!1})]})},ke=t(28719),ze=t(31326),Ue=t(54307),Me=t(4643),He=t(80345),Fe=t(46200),Be=t(33559),Je=t(43012),We=["dashboard_settings","custom_domain","custom_styling","stripe_integration","notifications","custom_menu_links"],Ve=function(){var e,n=(0,p.Bd)().t,t=(0,u.J)(),r=t.userDetails,o=t.isLoading,s=(t.isError,(r||{agencyId:-1}).agencyId),c=(0,a.useState)(!1),x=c[0],h=c[1],f=(0,Je.$0)(),S=f.data,m=void 0===S?[]:S,g=f.isLoading,b=(0,d.ok)(),T=b[0],N=b[1],v=(e=T.get("tab"))&&E.includes(e)&&We.includes(e)?e:"dashboard_settings";return(0,a.useEffect)((function(){if(T.get("tab")!==v){var e=new URLSearchParams(T);e.set("tab",v),N(e,{replace:!0})}}),[v,T,N]),o?(0,i.jsx)(l.fPr,{container:!0,spacing:2,justifyContent:"center",children:(0,i.jsx)(l.fPr,{container:!0,spacing:2,size:12,children:(0,i.jsx)(l.fPr,{size:12,children:(0,i.jsxs)(l.azJ,{sx:{mt:3},children:["dashboard_settings"===v&&(0,i.jsx)(_.A,{}),"custom_domain"===v&&(0,i.jsx)(Ue.A,{}),"custom_styling"===v&&(0,i.jsx)(Me.A,{}),(null==r?void 0:r.isAgencyAdmin)&&"stripe_integration"===v&&(0,i.jsx)(_e.A,{}),"notifications"===v&&(0,i.jsx)(He.A,{})]})})})}):(0,i.jsx)(l.fPr,{container:!0,spacing:2,justifyContent:"center",children:(0,i.jsx)(l.fPr,{container:!0,spacing:2,size:12,children:(0,i.jsxs)(l.fPr,{size:12,children:["dashboard_settings"===v&&(0,i.jsx)(l.Zkm,{title:n("AGENCY_SETTINGS.PANEL_AGENCY_DETAILS"),sx:{minHeight:{xs:"auto",md:"calc(100vh - 240px)"}},children:(0,i.jsx)(y,{agencyId:s})}),"custom_domain"===v&&(0,i.jsx)(l.Zkm,{title:n("AGENCY_SETTINGS.PANEL_SET_YOUR_DOMAIN"),sx:{minHeight:{xs:"auto",md:"calc(100vh - 240px)"}},children:(0,i.jsx)(Q,{agencyId:s})}),"custom_styling"===v&&(0,i.jsx)(l.ZpM,{variant:"outlined",sx:{borderColor:"divider",boxShadow:"none",minHeight:{xs:"auto",md:"calc(100vh - 240px)"}},children:(0,i.jsx)(l.Wux,{sx:{p:3,"&:last-child":{pb:3}},children:(0,i.jsx)(be,{agencyId:s})})}),(null==r?void 0:r.isAgencyAdmin)&&"stripe_integration"===v&&(0,i.jsx)(l.ZpM,{variant:"outlined",sx:{borderColor:"divider",boxShadow:"none",minHeight:{xs:"auto",md:"calc(100vh - 240px)"}},children:(0,i.jsx)(l.Wux,{sx:{p:3,"&:last-child":{pb:3}},children:(0,i.jsx)(De,{})})}),"notifications"===v&&(0,i.jsx)(ke.A,{agencyId:s}),"custom_menu_links"===v&&(0,i.jsx)(l.Zkm,{title:n("DISPLAY_STRINGS.CUSTOM_MENU_TITLE"),sx:{minHeight:{xs:"auto",md:"calc(100vh - 240px)"}},rightContent:m.length>0?(0,i.jsx)(Fe.A,{variant:"contained",startIcon:(0,i.jsx)(Be.A,{}),onClick:function(){h(!0)},children:n("DISPLAY_STRINGS.CUSTOM_MENU_CREATE")}):void 0,children:(0,i.jsx)(ze.A,{formOpen:x,setFormOpen:h,menuLinks:m,isLoading:g})})]})})})},$e=t(39675);function Ke(e){var n=e.children,t=(0,pe.jE)();return(0,i.jsx)($e.R2,{children:(0,i.jsx)($e.bq,{queryClient:t,children:n})})}var Ze=t(42259);function qe(){return(0,i.jsxs)(Ke,{children:[(0,i.jsx)(s.aTG,{icon:(0,i.jsx)(o.A,{}),heading:"Agency White Label Settings"}),(0,i.jsx)(c.A,{children:(0,i.jsxs)(l.azJ,{sx:{display:"grid",gap:3,pt:0,pb:{xs:2,md:3}},children:[(0,i.jsx)(Ze.l,{}),(0,i.jsx)(Ve,{})]})})]})}}}]);
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.