1import{ci as le,cG as ce,b3 as de,g0 as q,eY as L,al as Q,u as W,r as E,j as e,C as y,k as _,bb as z,bc as J,bd as K,l as S,be as M,bf as V,bg as Y,m as C,T as X,W as ue,eu as me,ev as he,B as D,o as Z,w as P,c as v,a7 as pe,b0 as ee,G as ne,d1 as ge,dC as R,g1 as xe,v as se,br as be,a$ as fe,g2 as je,S as ye,g3 as _e,_ as Ce,p as ae,ai as T,ak as ve,d as Se,h as Ie,f1 as we,U as te,i as w,g4 as Ne,g5 as Fe,a2 as re,g6 as Pe,aW as oe,g7 as Ue,g8 as Ae,aj as De,aB as We,eD as ke,g9 as Be,ga as Ee,F as O,am as Me,aD as Te,aT as qe,t as U}from"./index-DUWMLp_A.js";import{U as Re}from"./UpgradeBadge-BSQuY__2.js";import{i as j,c as G}from"./imageFileSchema-OFb1auIQ.js";import{M as Oe}from"./MultipleShowsSelect-CZplwuta.js";import"./index-D1ml6xH8.js";import"./file-BZ30gCWE.js";import"./GridList-Cz7qWtp5.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};n.SENTRY_RELEASE={id:"03512784fd78c0db53b8a0e370b452e2333ce80d"};var a=new n.Error().stack;a&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[a]="5b4e8ad2-851d-4c37-b2ad-5a77cc73a32a",n._sentryDebugIdIdentifier="sentry-dbid-5b4e8ad2-851d-4c37-b2ad-5a77cc73a32a")}catch{}})();const k=()=>{const{channelId:n}=le({strict:!1}),{data:a}=ce(Number(n));if(!n)throw new Error("useHasAccessToChannelPage must be used within a channel page route which contains a channelId param");return a?.userOptions?.includes(de.CHANNEL_PAGE)||!1},Ge=n=>{const a=crypto.randomUUID();return q(n.replaceAll("'s",""))+"-"+a},He="Information__Information__form__-d7uxLEh",$e="Information__Information__submitButton__-d7uxLEh",H={form:He,submitButton:$e},Le=({isLoading:n,onSubmit:a,hasSlug:o})=>{const{control:i,formState:s,handleSubmit:p,setValue:l}=L(),m=k(),d=Q({control:i,name:"name"}),{t}=W();return E.useEffect(()=>{!o&&d&&l("slug",q(d))},[o,d,l]),e.jsxs("form",{className:H.form,onSubmit:p(a),children:[e.jsx(y,{control:i,name:"logoUrl",render:({field:r,fieldState:h})=>e.jsx(_,{children:e.jsxs(z,{value:r.value??null,onChange:r.onChange,onBlur:r.onBlur,accept:[...J],children:[e.jsx(K,{className:j.preview}),e.jsxs("div",{className:j.uploaderContent,children:[e.jsxs("div",{className:j.uploaderMain,children:[e.jsxs("div",{className:j.labelGroup,children:[e.jsx(S,{children:t("uVlUmM",{description:"Cover picture",default:"Image de couverture"})}),e.jsx(M,{children:e.jsxs(e.Fragment,{children:[e.jsx("span",{children:t("EqpX2mb8",{description:".JPG or .PNG, up to {max}MB",default:".JPG, ou .PNG, jusqu'à {max}Mo",variables:{max:10}})}),e.jsx("br",{}),e.jsx("span",{children:t("qoNnzw",{description:"{minWidth} x {minHeight} min. ({recommendedWidth} x {recommendedHeight}px recommended)",default:"{minWidth} x {minHeight}px min. ({recommendedWidth} x {recommendedHeight}px recommandé)",variables:{minWidth:400,minHeight:400,recommendedWidth:1400,recommendedHeight:1400}})}),e.jsx("br",{}),e.jsx("span",{children:t("h0FAtl",{description:"RGB color mode",default:"Espace colorimétrique RVB"})})]})})]}),e.jsxs("div",{className:j.buttonsWrapper,children:[e.jsx(V,{children:r.value==null?t("t/ylq2",{description:"Add",default:"Ajouter"}):t("ho0AzM",{description:"Edit",default:"Modifier"})}),e.jsx(Y,{children:t("jTJesD",{description:"Delete",default:"Supprimer"})})]})]}),h.error&&e.jsx(C,{children:h.error.message})]})]})})}),e.jsx(y,{control:i,name:"name",render:({field:r,fieldState:h})=>e.jsxs(_,{children:[e.jsx(S,{children:t("Rf0xHw",{description:"Name of your channel",default:"Nom de votre chaîne"})}),e.jsx(X,{...r}),h.error&&e.jsx(C,{children:h.error.message})]})}),e.jsx(y,{control:i,name:"htmlDescription",render:({field:{value:r,...h},fieldState:u})=>e.jsxs(_,{children:[e.jsxs(ue,{$gap:"0.5rem",$align:"center",$justify:"space-between",$wrap:"nowrap",children:[e.jsx(S,{htmlFor:"channel-description-input",children:t("Q8Qw5B",{description:"Description",default:"Description"})}),e.jsx(me,{current:r?.length??0,max:3900})]}),e.jsx(he,{...h,value:r??"",isInvalid:!!u.invalid,id:"channel-description-input"}),u.error&&e.jsx(C,{children:u.error.message})]})}),!m&&e.jsx(D,{className:H.submitButton,type:"submit",isLoading:n,isDisabled:!s.isDirty,children:t("8pmblh",{description:"Save",default:"Enregistrer"})})]})},Qe=({locale:n="en"})=>{const a=/^[a-zA-Z0-9-Ã-ÿ]+$/,o=/^#([0-9A-F]{3}|[0-9A-F]{6})$/i;return Z({name:P().min(1,v.required()).min(3,v.minLength({min:3})).max(140,v.maxLength({max:140})),htmlDescription:P().max(3900,v.maxLength({max:3900})).optional().nullable(),logoUrl:G({locale:n}),backgroundUrl:G({locale:n}),slug:P().regex(new RegExp(a),v.noSpecialCharacters()).min(1,v.required()),shows:ee(ne()).optional(),enabled:pe().optional(),color:P().regex(o,v.color()).optional()})},ze=ee(Z({channelId:ne()})),Je=async({queryKey:[{slug:n}]})=>{const{data:a}=await xe({slug:n});return ze.parse(a)},Ke=n=>ge({queryKey:R.settingsBySlug(n),queryFn:Je}),Ve="Website__Website__fieldLabelWrapper__cUO2ayse",Ye="Website__Website__form__cUO2ayse",Xe="Website__Website__formDisabled__cUO2ayse",Ze="Website__Website__submitButton__cUO2ayse",A={fieldLabelWrapper:Ve,form:Ye,formDisabled:Xe,submitButton:Ze},en=ae("/_authenticated/app/channel/$channelId/settings"),nn=({shows:n,isLoading:a,onSubmit:o})=>{const{channelId:i}=en.useParams(),{control:s,formState:p,handleSubmit:l,setError:m}=L(),d=Q({control:s,name:"slug"}),t=k(),[r,h]=E.useState(!0),u=se({...Ke(d||""),enabled:!!d&&!r}),{t:c}=W(),{isValid:B,isDirty:b}=p;return E.useEffect(()=>{if(u.data&&u.data.length>0&&u.data[0].channelId!==Number(i)){m("slug",{type:"manual",message:c("bLdWsq",{description:"The slug has already been taken.",default:"Ce permalien est déjà utilisé"})});return}},[u.data,i,c,m]),e.jsxs("form",{className:Ce(A.form,!t&&A.formDisabled),onSubmit:l(o),children:[e.jsx(y,{control:s,name:"enabled",render:({field:{onCh
1ange:g,value:f,...x},fieldState:I})=>e.jsxs(_,{children:[e.jsx(be,{...x,isSelected:f,isDisabled:!t,onChange:g,children:c("HK6qdF",{description:"Activate the website of your channel",default:"Activer le Site web de votre chaîne"})}),I.error&&e.jsx(C,{children:I.error.message})]})}),e.jsx(y,{control:s,name:"slug",render:({field:{onChange:g,...f},fieldState:x})=>e.jsxs(_,{children:[e.jsxs("div",{className:A.fieldLabelWrapper,children:[e.jsx(S,{children:c("MkUBy/",{description:"Link to your channel's website",default:"Permalien du Site web de votre chaîne"})}),r&&e.jsx(D,{variant:"link-primary",onPress:()=>h(!1),children:c("ho0AzM",{description:"Edit",default:"Modifier"})})]}),e.jsx(X,{...f,isInvalid:!!x.error,onChange:I=>g(q(I)),startElement:e.jsx(je,{children:"https://podcast.ausha.co/c/"}),endElement:e.jsx(fe,{valueToCopy:`https://podcast.ausha.co/c/${d}`}),isReadOnly:r,onBlur:()=>h(!0)}),x.error&&e.jsx(C,{children:x.error.message})]})}),e.jsx(y,{control:s,name:"shows",render:({field:{value:g,...f},fieldState:x})=>e.jsxs(_,{children:[e.jsx(S,{children:c("V3OrGu",{description:"Assigned shows",default:"Ãmissions attribuées"})}),e.jsx(Oe,{...f,value:g||[],items:n}),x.error&&e.jsx(C,{children:x.error.message})]})}),e.jsx(y,{control:s,name:"color",render:({field:{onChange:g,...f},fieldState:x})=>e.jsxs(_,{children:[e.jsxs(ye,{children:[e.jsx(S,{children:c("jr63by",{description:"Color",default:"Couleur"})}),e.jsx(M,{children:c("6HeoIa",{description:"The main color will be visible on the buttons and links of your channel's website.",default:"La couleur principale sera visible sur les boutons et les liens du Site web de votre chaîne."})})]}),e.jsx(_e,{...f,isDisabled:!t,onChange:I=>{g(I.toString("hex"))}}),x.error&&e.jsx(C,{children:x.error.message})]})}),e.jsx(y,{control:s,name:"backgroundUrl",render:({field:g,fieldState:f})=>e.jsx(_,{children:e.jsxs(z,{value:g.value??null,onChange:g.onChange,onBlur:g.onBlur,accept:[...J],isDisabled:!t,children:[e.jsx(K,{className:j.preview}),e.jsxs("div",{className:j.uploaderContent,children:[e.jsxs("div",{className:j.uploaderMain,children:[e.jsxs("div",{className:j.labelGroup,children:[e.jsx(S,{children:c("h+Md3N",{description:"Custom background",default:"Fond personnalisé"})}),e.jsx(M,{children:e.jsxs(e.Fragment,{children:[e.jsx("span",{children:c("EqpX2mb8",{description:".JPG or .PNG, up to {max}MB",default:".JPG, ou .PNG, jusqu'à {max}Mo",variables:{max:10}})}),e.jsx("br",{}),e.jsx("span",{children:c("vFpeCV",{description:"{recommendedWidth} x {recommendedHeight}px recommended",default:"{recommendedWidth} x {recommendedHeight}px recommandé",variables:{recommendedWidth:1500,recommendedHeight:1800}})}),e.jsx("br",{}),e.jsx("span",{children:c("h0FAtl",{description:"RGB color mode",default:"Espace colorimétrique RVB"})})]})})]}),e.jsxs("div",{className:j.buttonsWrapper,children:[e.jsx(V,{children:g.value==null?c("t/ylq2",{description:"Add",default:"Ajouter"}):c("ho0AzM",{description:"Edit",default:"Modifier"})}),e.jsx(Y,{children:c("jTJesD",{description:"Delete",default:"Supprimer"})})]})]}),f.error&&e.jsx(C,{children:f.error.message})]})]})})}),e.jsx(D,{className:A.submitButton,type:"submit",isLoading:a,isDisabled:!t||!b||!B,children:c("8pmblh",{description:"Save",default:"Enregistrer"})})]})},sn="Form__Form__section__Jn2wxdCR",an="Form__Form__sectionHeader__Jn2wxdCR",tn="Form__Form__sectionTitle__Jn2wxdCR",N={section:sn,sectionHeader:an,sectionTitle:tn},rn=({values:n,onSubmit:a,isLoading:o,shows:i,hasSlug:s})=>{const{t:p}=W(),{data:l}=T(ve),m=Qe({locale:l.language}),d=Se({mode:"onBlur",resolver:Ie(m),values:n}),t=k(),r=u=>{const c={name:u.name,htmlDescription:u.htmlDescription,logoUrl:u.logoUrl,slug:u.slug};a(c)},h=u=>{a(u)};return e.jsxs(we,{...d,children:[e.jsxs("section",{className:N.section,children:[e.jsx("h2",{className:N.sectionTitle,children:p("px7rUW",{description:"Channel Information",default:"Informations de la Chaîne"})}),e.jsx(Le,{isLoading:o,onSubmit:r,hasSlug:s})]}),e.jsxs("section",{className:N.section,children:[e.jsxs("div",{className:N.sectionHeader,children:[e.jsxs("h2",{className:N.sectionTitle,children:[p("FWP6Fs",{description:"Channel Website",default:"Site web de la Chaîne"}),!t&&e.jsx(Re,{pricing:"pro"})]}),e.jsx(te,{color:"--neutral500",children:p("o0n4Zq",{description:"Customize your Channel page to give it a unique identity and make navigation easier for your listeners.",default:"Personnalisez votre page Chaîne pour lui donner une identité unique et faciliter la navigation de vos auditrices et auditeurs."})})]}),e.jsx(nn,{isLoading:o,onSubmit:h,shows:i})]})]})},on=async({channelId:n,format:a})=>{const{data:o}=await Ne(n,a);return o},ln=()=>w({mutationFn:on}),cn=async({channelId:n,settings:a})=>{const{data:o}=await Fe(n,re.decamelizeKeys(a));return o},dn=()=>w({mutationFn:cn}),un=async({channelId:n,file:a,format:o})=>{const{data:i}=await Pe(n,a,o);return i},ie=()=>w({mutationFn:un}),mn=()=>{const n=oe(),a=dn(),o=ie(),i=ln();return w({mutationFn:({channelId:s,data:p})=>{const{logoUrl:l,backgroundUrl:m,...d}=p,t=[];if(l&&l instanceof File){const r=o.mutateAsync({channelId:Number(s),file:l,format:"logo"});t.push(r)}if(l===null){const r=i.mutateAsync({channelId:s,format:"logo"});t.push(r)}if(m&&m instanceof File){const r=o.mutateAsync({channelId:Number(s),file:m,format:"background"});t.push(r)}if(m===null){const r=i.mutateAsync({channelId:s,format:"background"});t.push(r)}if(Object.keys(d).length>0){const r=a.mutateAsync({channelId:s,settings:d});t.push(r)}return Promise.allSettled(t)},onSuccess:()=>{n.invalidateQueries({queryKey:R.all()})}})},hn=async({channelId:n,settings:a})=>{const{data:o}=await Ue(n,re.decamelizeKeys(a)),i={...o,shows:o.shows.data};return Ae.parse(i)},pn=()=>w({mutationFn:hn}),gn=()=>{const n=oe(),a=pn(),o=ie();return w({mutationFn:async({channelId:i,data:s})=>{const{logoUrl:p,backgroundUrl:l,...m}=s,d=[];if(await a.mutateAsync({channelId:i,settings:m}),s?.logoUrl&&s.logoUrl instanceof File){const t=o.mutateAsync({channelId:Number(i),file:s.logoUrl,format:"logo"});d.push(t)}if(s?.backgroundUrl&&s.backgroundUrl instanceof File){const t=o.mutateAsync({channelId:Number(i),file:s.backgroundUrl,format:"background"});d.push(t)}await Promise.allSettled(d)},onSuccess:()=>{n.invalidateQueries({queryKey:R.all()})}})},xn="Channel__Channel__page__DoiWcyMg",bn="Channel__Channel__inner__DoiWcyMg",fn="Channel__Channel__header__DoiWcyMg",jn="Channel__Channel__backIcon__DoiWcyMg",yn="Channel__Channel__headerIcon__DoiWcyMg",F={page:xn,inner:bn,header:fn,backIcon:jn,headerIcon:yn},$=ae("/_authenticated/app/channel/$channelId/settings"),_n=()=>{const n=$.useNavigate(),a=De(),o=We(),{channelId:i}=$.useParams(),{data:s}=T(ke(Number(i))),{data:p}=T(Be(Number(i))),{data:l}=se(Ee(Number(i))),m=gn(),d=mn(),t=k(),{t:r}=W(),h=m.isPending||d.isPending,u={logoUrl:s.logoUrl||null,name:l?.name||s.name||"",htmlDescription:l?.htmlDescription||"",enabled:t&&l?.enabled||!1,slug:l?.slug||l?.name||Ge(s.name||""),shows:l?l.shows.map(b=>b.id)||[l.shows[0]?.id]:[],color:l?.color||"#751CBF",backgroundUrl:s.backgroundUrl||null},c=p?.map(b=>({id:b.id,name:b.name,image:b.imageUrl}))||[],B=b=>
1{if(!(!s.isOwner&&!s.isAdmin)){if(!l){m.mutate({channelId:s.id,data:b},{onSuccess:()=>{U.success()},onError:()=>{U.alert()}});return}d.mutate({channelId:s.id,data:b},{onSuccess:()=>{U.success()},onError:()=>{U.alert()}})}};return e.jsx("section",{className:F.page,children:e.jsxs("div",{className:F.inner,children:[e.jsxs("div",{className:F.header,children:[e.jsx(D,{startIcon:e.jsx(O,{className:F.backIcon,icon:Me}),variant:"link-secondary",onPress:()=>o?a.history.back():n({to:"/app/channel"}),children:r("tNDdHY",{description:"Go back",default:"Retour"})}),e.jsx(Te,{title:r("Fe4YDX",{description:"Channel settings",default:"Paramètres de chaîne"}),icon:e.jsx(O,{className:F.headerIcon,icon:qe}),children:e.jsx(te,{color:"--neutral500",children:r("Qqg92o",{description:"Complete your channel to easily find and navigate your podcasts.",default:"Complétez les informations de votre chaîne pour naviguer facilement entre vos podcasts."})})})]}),e.jsx(rn,{values:u,shows:c,onSubmit:B,isLoading:h,hasSlug:!!l?.slug})]})})},Pn=_n;export{Pn as component}; 2//# sourceMappingURL=app.channel._channelId.settings-lehPMH05.js.map
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.