1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3261],{25051:(e,t,l)=>{"use strict";l.d(t,{A:()=>d});var a=l(6029),s=l(75828),i=l.n(s),n=l(8461),r=l(81783),o=l(82558),c=l(49956);let d=e=>{let{isScrolledToEnd:t,label:l="Scroll Down",className:s}=e;return(0,a.jsx)(n.N,{children:(0,a.jsx)(r.P.div,{className:i()("pointer-events-none sticky bottom-4 z-10 flex w-full justify-center",s),initial:{opacity:0},animate:{opacity:100*!t},exit:{opacity:0},children:(0,a.jsxs)("div",{className:"flex flex-row items-center space-x-0.5 rounded-[100px] bg-black/[32%] px-[10px] py-1 backdrop-blur-[12px] dark:bg-white/[32%]",children:[(0,a.jsx)(c.E,{typography:c.o.Caption1,bold:!0,className:"text-white",children:l}),(0,a.jsx)(o.I,{type:o.A.Arrow,className:"rotate-90 fill-white",size:12})]})})})}},33972:(e,t,l)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/ar-roster/[arProfileId]",function(){return l(71046)}])},40399:(e,t,l)=>{"use strict";l.d(t,{A:()=>o});var a=l(6029),s=l(63804),i=l(82558),n=l(49956),r=l(48732);let o=e=>{let{socialContent:t,thumbnailOverlay:l}=e;return(0,a.jsxs)("div",{className:"flex flex-row items-center space-x-3",children:[(0,a.jsxs)("div",{className:"relative h-[60px] w-[40px] shrink-0 rounded-lg ring-1 ring-slate-200",children:[t.cover_url?(0,a.jsx)("img",{className:"h-full w-full rounded-lg object-cover",src:t.cover_url,alt:t.author.username}):t.play_url?(0,a.jsx)("video",{className:"h-full w-full rounded-lg object-cover",src:"".concat(t.play_url,"#t=0.001")}):(0,a.jsx)("div",{className:"flex h-full w-full items-center justify-center rounded-lg bg-slate-200",children:(0,a.jsx)(i.I,{className:"fill-slate-400",type:(0,s.tV)(t.platform),size:16})}),(0,a.jsx)("div",{className:"absolute inset-0 flex h-full w-full items-center justify-center rounded-lg bg-black/50 opacity-0 transition group-hover/tablerow:opacity-100",children:(0,a.jsx)(i.I,{className:"fill-white",type:i.A.Eye,size:20})}),l&&(0,a.jsx)("div",{className:"absolute -bottom-1 -right-[6px] flex h-5 w-5 items-center justify-center overflow-hidden rounded-lg bg-white",children:l})]}),(0,a.jsxs)("div",{className:"space-y-0.5",children:[(0,a.jsxs)("div",{className:"group flex items-center space-x-0.5",children:[(0,a.jsx)(i.I,{className:"group-hover/tablerow:fill-primary-600 fill-slate-600 transition",type:(0,s.tV)(t.platform),size:16}),(0,a.jsx)(n.E,{className:"group-hover/tablerow:text-primary-600 text-slate-600 transition group-hover:underline",typography:n.o.Footnote,bold:!0,children:"@".concat(t.author.username.replace("@",""))}),t.author.is_verified&&(0,a.jsx)(r.A,{})]}),(0,a.jsx)(n.E,{className:"!line-clamp-1 break-all text-slate-500",typography:n.o.Caption1,children:t.description})]})]})}},58914:(e,t,l)=>{"use strict";l.d(t,{U:()=>s});var a=l(6029);let s=()=>(0,a.jsx)("div",{className:"h-[16px] w-full animate-pulse rounded-lg bg-slate-100"})},71046:(e,t,l)=>{"use strict";l.r(t),l.d(t,{default:()=>tY});var a=l(6029),s=l(81278),i=l(55729),n=l(51308),r=l(86501),o=l(29229),c=l(2531),d=l(99998),u=l(17989),p=l(49956),m=l(93251),x=l(16932),h=l(93486),y=l(38718),g=l(84203),f=l(19117),v=l(95099);let j="AR_PROFILE_DEMOS";var N=l(83409),_=l(64373),S=l(82558);let b=e=>{let{title:t,description:l,action:s,children:i}=e;return(0,a.jsxs)("div",{className:"space-y-5 rounded-2xl border border-slate-200 p-5",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(p.E,{typography:p.o.Callout,bold:!0,children:t}),(0,a.jsx)(p.E,{typography:p.o.Footnote,className:"text-slate-500",children:l})]}),s]}),i]})};var w=l(89388),A=l(63752),C=l(85693),k=l(71091),E=l(35430),T=l(79895),P=l(74369),I=l(92711);let M=e=>{let{isOpen:t,onClose:l,arProfileId:s,demo:r}=e,o=!!r,c=(()=>{let{addToast:e}=(0,h.Xm)(),t=(0,m.jE)(),l=(0,f.MI)({needsAuthentication:!0,includeHost:!1});return(0,x.n)({mutationFn:e=>l("".concat(g.nM,"/demo/create"),{method:"POST",body:JSON.stringify(e)}),onSuccess:()=>{e(y.K.Success,"Demo Added"),t.invalidateQueries({queryKey:[n.Z]}),t.invalidateQueries({queryKey:[j]})},onError:()=>{e(y.K.Error,"Failed to Add Demo")}})})(),d=(()=>{let{addToast:e}=(0,h.Xm)(),t=(0,m.jE)(),l=(0,f.MI)({needsAuthentication:!0,includeHost:!1});return(0,x.n)({mutationFn:e=>l("".concat(g.nM,"/demo/update"),{method:"POST",body:JSON.stringify(e)}),onSuccess:()=>{e(y.K.Success,"Demo Updated"),t.invalidateQueries({queryKey:[n.Z]}),t.invalidateQueries({queryKey:[j]})},onError:()=>{e(y.K.Error,"Failed to Update Demo")}})})(),[u,p]=(0,i.useState)(""),[v,_]=(0,i.useState)(""),[S,b]=(0,i.useState)("");(0,i.useEffect)(()=>{var e,t,l;p(null!=(e=null==r?void 0:r.title)?e:""),_(null!=(t=null==r?void 0:r.link)?t:""),b(null!=(l=null==r?void 0:r.notes)?l:"")},[r,t]);let M=u.trim().length>0&&v.trim().length>0&&(0,w.IF)(v.trim()).isValid;return(0,a.jsxs)(E.a,{isOpen:t,className:"flex max-h-full w-full max-w-[600px] flex-col overflow-hidden",children:[(0,a.jsx)(P.r,{title:o?"Edit Artist Demo":"Add Artist Demo",onClose:l}
1),(0,a.jsxs)("div",{className:"flex-grow space-y-5 overflow-auto p-6",children:[(0,a.jsx)(C.p,{value:u,placeholder:"Enter a title for this demo...",onChange:e=>p(e.target.value),label:"Demo Title"}),(0,a.jsx)(C.p,{value:v,placeholder:"https://website.com/artist-demo",onChange:e=>_(e.target.value),label:"Demo Link",validators:[w.IF]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(k.A,{label:"Demo Notes",optional:!0}),(0,a.jsx)(I.f,{value:S,placeholder:"Add any additional context about this demo...",onChange:e=>b(e.target.value),className:"min-h-[104px] w-full"})]})]}),(0,a.jsx)(T.j,{children:(0,a.jsxs)(A.e,{className:"ml-auto",children:[(0,a.jsx)(N.$n,{type:N.VQ.Quaternary,size:N.Mp.Small,text:"Cancel",onClick:l}),(0,a.jsx)(N.$n,{type:N.VQ.Primary,size:N.Mp.Small,text:o?"Save Changes":"Add Demo",disabled:!M,loading:c.isPending||d.isPending,onClick:()=>{if(M){if(o&&r)return void d.mutate({demo_id:r.id,title:u.trim(),link:v.trim(),notes:S.trim()},{onSuccess:()=>l()});c.mutate({ar_profile_id:s,title:u.trim(),link:v.trim(),notes:S.trim()||void 0},{onSuccess:()=>l()})}}})]})})]})};var O=l(75828),z=l.n(O),L=l(68071);let D=e=>{let{demo:t,onEdit:l,onDelete:s}=e,[n,r]=(0,i.useState)(!1),[o,c]=(0,i.useState)(!1),d=(0,i.useRef)(null);return(0,i.useLayoutEffect)(()=>{let e=d.current;if(!e)return;let t=()=>c(e.scrollHeight>36);return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[t.notes]),(0,a.jsxs)("div",{className:"flex items-start",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1 space-y-1 py-3 pr-3",children:[(0,a.jsxs)("div",{className:"space-y-0.5",children:[(0,a.jsx)(p.E,{typography:p.o.Footnote,bold:!0,className:"text-slate-600",children:t.title}),(0,a.jsx)("a",{href:t.link,target:"_blank",rel:"noopener noreferrer",children:(0,a.jsx)(p.E,{typography:p.o.Caption1,className:"truncate text-blue-600 underline",children:t.link})})]}),(0,a.jsxs)(p.E,{typography:p.o.Caption1,className:"text-slate-400",children:[t.author.email_address," ⢠",(0,L.HX)(t.created_at)]})]}),(0,a.jsx)("div",{className:"min-w-0 flex-1 space-y-1 p-3",children:t.notes?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(p.E,{ref:d,typography:p.o.Footnote,className:z()("block text-slate-600",{"max-h-[36px] overflow-hidden":!n}),children:t.notes}),o&&(0,a.jsx)(N.$n,{type:N.VQ.Text,size:N.Mp.Micro,text:n?"Show less":"Show more",onClick:()=>r(e=>!e),bold:!1})]}):(0,a.jsx)(p.E,{typography:p.o.Footnote,className:"text-slate-400",children:"--"})}),(0,a.jsxs)("div",{className:"flex h-full shrink-0 items-center gap-3 self-center py-3 pl-3",children:[(0,a.jsx)(N.$n,{type:N.VQ.IconOnly,size:N.Mp.Small,iconType:S.A.Edit,onClick:l}),(0,a.jsx)(N.$n,{type:N.VQ.IconOnly,size:N.Mp.Small,iconType:S.A.Trash,onClick:s})]})]})},F=e=>{let{organizationId:t,arProfileId:l}=e,[s,r]=(0,i.useState)(!1),[o,d]=(0,i.useState)(void 0),[u,w]=(0,i.useState)(null),A=(()=>{let{addToast:e}=(0,h.Xm)(),t=(0,m.jE)(),l=(0,f.MI)({needsAuthentication:!0,includeHost:!1});return(0,x.n)({mutationFn:e=>l("".concat(g.nM,"/demo/delete"),{method:"POST",body:JSON.stringify(e)}),onSuccess:()=>{e(y.K.Success,"Demo Deleted"),t.invalidateQueries({queryKey:[n.Z]}),t.invalidateQueries({queryKey:[j]})},onError:()=>{e(y.K.Error,"Failed to Delete Demo")}})})(),C=(e=>{let{organizationId:t,arProfileId:l,pageSize:a=10,enabled:s=!0}=e,i=(0,f.MI)({needsAuthentication:!0,includeHost:!1});return(0,v.q)({queryKey:[j,t,l],queryFn:e=>{let{pageParam:t}=e;return i("".concat(g.nM,"/demo/list"),{method:"POST",body:JSON.stringify({ar_profile_id:l,cursor:t,page_size:a})})},getNextPageParam:e=>(null==e?void 0:e.links.has_next)?e.links.next:void 0,initialPageParam:void 0,enabled:s&&!!t&&!!l})})({organizationId:t,arProfileId:l}),k=(0,i.useMemo)(()=>{var e,t;return null!=(t=null==(e=C.data)?void 0:e.pages.flatMap(e=>{var t;return null!=(t=null==e?void 0:e.items)?t:[]}))?t:[]},[C.data]),E=()=>{d(void 0),r(!0)};return(0,a.jsxs)(b,{title:"Artist Demos",description:"Links to the artist's demo projects.",action:k.length>0?(0,a.jsx)(N.$n,{type:N.VQ.Quaternary,size:N.Mp.Small,iconType:S.A.Plus,onClick:E}):void 0,children:[s&&(0,a.jsx)(M,{isOpen:s,onClose:()=>r(!1),arProfileId:l,demo:o}),u&&(0,a.jsx)(c.R,{title:"Delete Demo?",message:"This action cannot be undone.",destructiveText:"Delete",isOpen:!!u,onClose:()=>w(null),onConfirm:async()=>{await A.mutateAsync({demo_id:u.id}),w(null)}}),0===k.length?!C.isLoading&&(0,a.jsx)(_.P,{title:"Add Artist Demo",iconType:S.A.Music,onClick:E,className:"!p-8"}):(0,a.jsxs)("div",{className:"divide-y divide-slate-200",children:[(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(p.E,{typography:p.o.Caption1,className:"flex-1 py-3 pr-3 text-slate-600",bold:!0,children:"Details"}),(0,a.jsx)(p.E,{typography:p.o.Caption1,className:"flex-1 p-3 text-slate-600",bold:!0,children:"Notes"}),(0,a.jsx)("div",{className:"w-[56px] shrink-0"})]}),k.map(e=>(0,a.jsx)(D,{demo:e,onEdit:()=>{d(e),r(!0)},onDelete:()=>w(e)}
1,e.id)),C.hasNextPage&&(0,a.jsx)("div",{className:"pt-4",children:(0,a.jsx)(N.$n,{type:N.VQ.Link,size:N.Mp.Small,text:"Show More",bold:!1,loading:C.isFetchingNextPage,onClick:()=>C.fetchNextPage()})})]})]})},R="AR_PROFILE_PHOTOS";var V=l(29957),Q=l(64237),q=l(9182);let U=e=>{let{photo:t,onDelete:l}=e,[s,n]=(0,i.useState)(!1),[r,o]=(0,i.useState)(!1),{addToast:c}=(0,h.Xm)(),d=t.asset.download_url,u=async()=>{o(!0);try{let e=await fetch(d);if(!e.ok)throw Error("Failed to fetch image: ".concat(e.status));let l=await e.blob(),a=URL.createObjectURL(l),s=document.createElement("a");s.href=a,s.download=t.asset.filename,document.body.appendChild(s),s.click(),document.body.removeChild(s),setTimeout(()=>URL.revokeObjectURL(a),1e4)}catch(e){c(y.K.Error,"Failed to Download Photo")}finally{o(!1)}};return(0,a.jsxs)(a.Fragment,{children:[s&&(0,a.jsx)(q.A,{isOpen:s,onClose:()=>n(!1),children:(0,a.jsx)("img",{alt:t.asset.filename,src:d,className:"max-h-[85vh] max-w-[85vw] rounded-xl object-contain"})}),(0,a.jsxs)("div",{className:"group relative h-[200px] w-auto shrink-0 overflow-hidden rounded-xl bg-slate-100",children:[(0,a.jsx)("img",{alt:t.asset.filename,src:d,className:"h-[200px] w-auto object-contain"}),(0,a.jsxs)("div",{className:"absolute bottom-0 flex w-full items-center justify-center gap-2 p-2 opacity-0 transition group-hover:opacity-100",children:[(0,a.jsx)(N.$n,{type:N.VQ.Overlay,size:N.Mp.Small,iconType:S.A.Expand,onClick:()=>n(!0),className:"w-full",tooltipTitle:"View",tooltipTriggerClassName:"w-full"}),(0,a.jsx)(N.$n,{type:N.VQ.Overlay,size:N.Mp.Small,iconType:S.A.Download,onClick:u,loading:r,className:"w-full",tooltipTitle:"Download",tooltipTriggerClassName:"w-full"}),(0,a.jsx)(N.$n,{type:N.VQ.Overlay,size:N.Mp.Small,iconType:S.A.Trash,onClick:l,className:"w-full",tooltipTitle:"Remove",tooltipTriggerClassName:"w-full"})]})]})]})},K=e=>{let{organizationId:t,arProfileId:l}=e,[s,n]=(0,i.useState)(!1),[r,o]=(0,i.useState)(null),d=(0,V.m)(),u=(()=>{let{addToast:e}=(0,h.Xm)(),t=(0,m.jE)(),l=(0,f.MI)({needsAuthentication:!0,includeHost:!1});return(0,x.n)({mutationFn:e=>l("".concat(g.nM,"/photo/add"),{method:"POST",body:JSON.stringify(e)}),onSuccess:()=>{t.invalidateQueries({queryKey:[R]})},onError:()=>{e(y.K.Error,"Failed to Add Photo")}})})(),p=(()=>{let{addToast:e}=(0,h.Xm)(),t=(0,m.jE)(),l=(0,f.MI)({needsAuthentication:!0,includeHost:!1});return(0,x.n)({mutationFn:e=>l("".concat(g.nM,"/photo/delete"),{method:"POST",body:JSON.stringify(e)}),onSuccess:()=>{e(y.K.Success,"Photo Deleted"),t.invalidateQueries({queryKey:[R]})},onError:()=>{e(y.K.Error,"Failed to Delete Photo")}})})(),j=(e=>{let{arProfileId:t,pageSize:l=20,enabled:a=!0}=e,s=(0,f.MI)({needsAuthentication:!0,includeHost:!1});return(0,v.q)({queryKey:[R,t],queryFn:e=>{let{pageParam:a}=e;return s("".concat(g.nM,"/photo/list"),{method:"POST",body:JSON.stringify({ar_profile_id:t,cursor:a,page_size:l})})},getNextPageParam:e=>(null==e?void 0:e.links.has_next)?e.links.next:void 0,initialPageParam:void 0,enabled:a&&!!t})})({arProfileId:l}),_=(0,i.useMemo)(()=>{var e,t;return null!=(t=null==(e=j.data)?void 0:e.pages.flatMap(e=>{var t;return null!=(t=null==e?void 0:e.items)?t:[]}))?t:[]},[j.data]),w=async e=>{if(0===e.length)return;n(!0);let a=await d({organizationId:t,files:e});await Promise.all(a.map(e=>u.mutateAsync({ar_profile_id:l,asset_id:e.id}))),n(!1)};return(0,a.jsxs)(b,{title:"Artist Photos",description:"Upload photos related to this artist for internal visibility.",action:_.length>0?(0,a.jsx)(Q.l,{multiple:!0,accept:"image/*",setFiles:w,isDisabled:s,children:(0,a.jsx)(N.$n,{type:N.VQ.Quaternary,size:N.Mp.Small,iconType:S.A.Plus,loading:s,onClick:()=>void 0,tooltipTitle:"Add Photo"})}):void 0,children:[r&&(0,a.jsx)(c.R,{title:"Delete Photo?",message:"This action cannot be undone.",destructiveText:"Delete",isOpen:!!r,onClose:()=>o(null),onConfirm:async()=>{await p.mutateAsync({photo_id:r.id}),o(null)}}),0===_.length?!j.isLoading&&(0,a.jsx)(Q.l,{multiple:!0,accept:"image/*",setFiles:w,isDisabled:s,title:"Add Artist Photos",iconType:S.A.MediaImage,triggerClassName:"!p-8"}):(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsx)("div",{className:"flex gap-2 overflow-x-auto pb-3",children:_.map(e=>(0,a.jsx)(U,{photo:e,onDelete:()=>o(e)},e.id))}),j.hasNextPage&&(0,a.jsx)(N.$n,{type:N.VQ.Link,size:N.Mp.Small,text:"Show More",bold:!1,loading:j.isFetchingNextPage,onClick:()=>j.fetchNextPage()})]})]})};var $=l(42042),H=l(9255);let B=e=>
1{let{imageUrl:t,name:l,subtitle:s,href:i}=e,n=!!i;return(0,a.jsxs)("div",{className:"group relative block aspect-square overflow-hidden rounded-xl border border-slate-300 bg-slate-100",children:[t&&(0,a.jsx)("img",{alt:l,src:t,className:"h-full w-full object-cover"}),(0,a.jsxs)("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 space-y-0.5 bg-gradient-to-b from-black/0 to-black px-3 pb-3 pt-5 opacity-100 transition group-hover:opacity-0",children:[(0,a.jsx)(p.E,{typography:p.o.Subheadline,bold:!0,className:"!line-clamp-1 text-white",children:l}),(0,a.jsx)(p.E,{typography:p.o.Caption1,className:"text-white",children:s})]}),(0,a.jsx)("div",{className:"absolute inset-x-0 bottom-0 p-2 opacity-0 transition group-hover:opacity-100",children:(0,a.jsx)("a",{href:null!=i?i:void 0,target:n?"_blank":void 0,rel:n?"noopener noreferrer":void 0,children:(0,a.jsx)(N.$n,{type:N.VQ.Overlay,size:N.Mp.Small,onClick:()=>void 0,iconType:S.A.Open,className:"w-full",tooltipTitle:"Open",tooltipTriggerClassName:"w-full"})})})]})},J=()=>(0,a.jsx)("div",{className:"aspect-square animate-pulse rounded-xl bg-slate-100"}),X=e=>{var t;let{organizationId:l,arProfileId:s}=e,[n,r]=(0,i.useState)(1),o=2*n,{data:c,isLoading:d,hasNextPage:u,fetchNextPage:m,isFetchingNextPage:x}=(e=>{let{organizationId:t,arProfileId:l,pageSize:a=12}=e,s=(0,f.MI)({needsAuthentication:!0,includeHost:!1});return(0,v.q)({queryKey:["AR_PROFILE_PLAYLISTS",t,l,a],queryFn:e=>{let{pageParam:i}=e;return s("".concat(g.nM,"/profile/list_playlists"),{method:"POST",body:JSON.stringify({organization_id:t,ar_profile_id:l,cursor:i,page_size:a})})},getNextPageParam:e=>(null==e?void 0:e.links.has_next)?e.links.next:void 0,initialPageParam:void 0,enabled:!!t&&!!l,retry:!1})})({organizationId:l,arProfileId:s,pageSize:o}),h=null!=(t=null==c?void 0:c.pages.flatMap(e=>{var t;return null!=(t=null==e?void 0:e.items)?t:[]}))?t:[];return(0,a.jsx)(b,{title:"Featured Spotify Editorial Playlists",description:"Playlists that are currently driving meaningful streams, visibility, or discovery for this artist",children:d||0!==h.length?(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)(H.N,{className:"gap-4",calculateColumns:e=>{let t=1;return e>=1280?t=5:e>=1024?t=4:e>=768?t=3:e>=512&&(t=2),r(t),t},children:[h.map(e=>{var t,l;return(0,a.jsx)(B,{imageUrl:null!=(l=null==(t=e.images[0])?void 0:t.url)?l:null,name:e.name,subtitle:"".concat((0,$.$M)(e.followers_count)," Followers"),href:"https://open.spotify.com/playlist/".concat(e.spotify_id)},e.id)}),d&&Array(o).fill(null).map((e,t)=>(0,a.jsx)(J,{},t))]}),u&&(0,a.jsx)(N.$n,{type:N.VQ.Link,size:N.Mp.Small,text:"Load more",loading:x,onClick:()=>m()})]}):(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center gap-1 py-11 text-center",children:[(0,a.jsx)(p.E,{typography:p.o.Footnote,bold:!0,className:"text-slate-400",children:"No featured playlists detected"}),(0,a.jsx)(p.E,{typography:p.o.Caption1,className:"text-slate-400",children:"Featured playlists will be automatically added once detected."})]})})};var G=l(90380),W=l(76950),Z=l(91517),Y=l(26092);let ee=e=>{let{organizationId:t,arProfileId:l}=e,[s,n]=(0,i.useState)(!1),[r,o]=(0,i.useState)(void 0),[d,u]=(0,i.useState)(null),p=(0,G.J)(),m=(0,W.$)({organizationId:t,arProfileId:l}),x=(0,i.useMemo)(()=>{var e,t;return null!=(t=null==(e=m.data)?void 0:e.pages.flatMap(e=>{var t;return null!=(t=null==e?void 0:e.items)?t:[]}))?t:[]},[m.data]),h=()=>{o(void 0),n(!0)};return(0,a.jsxs)(b,{title:"Internal Artist Notes",description:"Notes about this artist and/or artist deal history for internal visibility.",action:x.length>0?(0,a.jsx)(N.$n,{type:N.VQ.Quaternary,size:N.Mp.Small,iconType:S.A.Plus,onClick:h}):void 0,children:[s&&(0,a.jsx)(Z.A,{isOpen:s,onClose:()=>n(!1),organizationId:t,arProfileId:l,note:r}),d&&(0,a.jsx)(c.R,{title:"Delete Note?",message:"This action cannot be undone.",destructiveText:"Delete",isOpen:!!d,onClose:()=>u(null),onConfirm:async()=>{await p.mutateAsync({note_id:d.id}),u(null)}}),0===x.length?!m.isLoading&&(0,a.jsx)(_.P,{title:"Add Internal Note",iconType:S.A.Notes,onClick:h,className:"!p-8"}):(0,a.jsxs)("div",{className:"divide-y divide-slate-100",children:[x.map(e=>(0,a.jsx)(Y.A,{note:e,onEdit:()=>{o(e),n(!0)},onDelete:()=>u(e)},e.id)),m.hasNextPage&&(0,a.jsx)("div",{className:"pt-4",children:(0,a.jsx)(N.$n,{type:N.VQ.Link,size:N.Mp.Small,text:"Show More",bold:!1,loading:m.isFetchingNextPage,onClick:()=>m.fetchNextPage()})})]})]})},et=e=>{let{organizationId:t,profile:l}=e;return(0,a.jsxs)("div",{className:"space-y-5",children:[(0,a.jsx)(ee,{organizationId:t,arProfileId:l.id}),(0,a.jsx)(F,{organizationId:t,arProfileId:l.id}),(0,a.jsx)(X,{organizationId:t,arProfileId:l.id}),(0,a.jsx)(K,{organizationId:t,arProfileId:l.id})]})};var el=l(93998),ea=l(40974),es=l(33076),ei=l(48290),en=l(26553),er=l(12482);let eo=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{enabled:l=!0}=t,a=(0,f.MI)({needsAuthentication:!0,includeHost:!1});
1return(0,er.I)({queryKey:["AR_PROFILE_SOCIAL",e],queryFn:()=>a("".concat(g.nM,"/profile/get_social_insights"),{method:"POST",body:JSON.stringify(e)}),enabled:l&&!!e.organization_id&&!!e.ar_profile_id,retry:!1})},ec=e=>{let t=(0,f.MI)({needsAuthentication:!0,includeHost:!1});return(0,er.I)({queryKey:["AR_PROFILE_STREAMING_TS",e],queryFn:()=>t("".concat(g.nM,"/profile/streaming_ts"),{method:"POST",body:JSON.stringify(e)}),enabled:!!e.ar_profile_id,retry:!1})};var ed=l(91550),eu=l(33250),ep=l(80504),em=l(45063),ex=l(40571),eh=l(17911);let ey=e=>{let{title:t,rangeLabel:l,data:s,metrics:i,isLoading:n,startYAxisAtZero:r=!1}=e;return(0,a.jsx)(eh.T,{type:"LINE",data:s,metrics:i,isLoading:n,startYAxisAtZero:r,header:(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(p.E,{typography:p.o.Subheadline,bold:!0,children:t}),(0,a.jsx)(p.E,{typography:p.o.Caption2,className:"text-slate-400",children:l})]}),className:"!p-5"})},eg=e=>{let{streams:t,isLoading:l}=e;return(0,a.jsx)(ex.f,{title:"Total Streams",value:t,unit:ed.N.Number,formatMetric:L.Dj,isLoading:l,isSelected:!0,lineStyle:"dotted"})},ef=e=>{var t,l,s,n;let{organizationId:r,arProfileId:o,window:c,rangeLabel:d,platform:u,hasConnectedSocial:m,hasSpotifyArtist:x,onAddSocialAccounts:h}=e,[y,g]=(0,i.useState)([eu.P5.FOLLOWERS]),f=e=>ep.s[y.indexOf(e)%ep.s.length],{start_date:v,end_date:j}=(0,L.eP)(c),{data:_,isLoading:b}=eo({organization_id:r,ar_profile_id:o,start_date:v,end_date:j},{enabled:m}),w=x&&c!==el.Ab.DAY,{data:A,isLoading:C}=ec({ar_profile_id:w?o:"",start_date:v,end_date:j,country_code__in:[]}),k=new Map((null!=(t=null==A?void 0:A.timeseries)?t:[]).map(e=>[e.report_date,e.streams]));if(!m)return(0,a.jsxs)("div",{className:"space-y-5",children:[(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:[w&&(0,a.jsx)(eg,{streams:null!=(l=null==A?void 0:A.summary.streams)?l:null,isLoading:C}),L.IX.map(e=>(0,a.jsx)(ex.f,{title:e.title,value:null,unit:e.unit,formatMetric:e.formatMetric},e.key))]}),(0,a.jsxs)("div",{className:"flex h-[332px] flex-col items-center justify-center space-y-5 rounded-2xl border border-slate-200 p-5",children:[(0,a.jsxs)("div",{className:"space-y-1 text-center",children:[(0,a.jsx)(p.E,{typography:p.o.Footnote,bold:!0,className:"text-slate-500",children:"No social accounts connected."}),(0,a.jsx)(p.E,{typography:p.o.Caption1,className:"text-slate-400",children:"Add social accounts to track and measure the artists social growth."})]}),(0,a.jsx)(N.$n,{type:N.VQ.Quaternary,size:N.Mp.Small,onClick:h,text:"Add Social Accounts",iconType:S.A.Plus})]})]});let E=eu.kl[u],T=null==_?void 0:_.summary[E],P=(null!=(s=null==_?void 0:_.timeseries)?s:[]).map(e=>{let t=e[E],l={date_day:e.date};if(y.forEach(e=>{l[e]=t[e]}),w&&k.has(e.date)){var a;
1l[el.Ui.STREAMS]=null!=(a=k.get(e.date))?a:null}return l}),I=y.map(e=>{var t,l;let a=L.IX.find(t=>t.key===e);return{key:e,title:null!=(t=null==a?void 0:a.title)?t:e,unit:null!=(l=null==a?void 0:a.unit)?l:L.IX[0].unit,color:f(e),source:em.O.TikTok}});return w&&I.push({key:el.Ui.STREAMS,title:"Total Streams",unit:ed.N.Number,color:"#94A3B8",source:em.O.Spotify,lineStyle:"dotted"}),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:[w&&(0,a.jsx)(eg,{streams:null!=(n=null==A?void 0:A.summary.streams)?n:null,isLoading:C}),L.IX.map(e=>{var t;let l=null!=(t=null==T?void 0:T[e.key])?t:null,s=T&&c!==el.Ab.TOTAL?((e,t)=>{let l=e[t],a=e["".concat(t,"_delta")];if(null==l||null==a)return null;let s=l-a;return s>0?a/s:null})(T,e.key):null,i=null!=l,n=i&&y.includes(e.key);return(0,a.jsx)(ex.f,{title:e.title,value:l,deltaValue:s,unit:e.unit,formatMetric:e.formatMetric,isLoading:b,isSelectable:i,isSelected:n,colorHex:n?f(e.key):void 0,onClick:i?()=>(e=>g(t=>t.includes(e)?t.length>1?t.filter(t=>t!==e):t:[...t,e]))(e.key):void 0},e.key)})]}),(0,a.jsx)(ey,{title:"Social ⢠".concat((0,L.Sy)(u)),rangeLabel:d,data:P,metrics:I,isLoading:b})]})},ev=e=>{var t;let{arProfileId:l,window:s,rangeLabel:n,countryCodes:r}
1=e,[o,c]=(0,i.useState)([el.Ui.STREAMS]),d=e=>ep.s[o.indexOf(e)%ep.s.length],{start_date:u,end_date:p}=(0,L.eP)(s),{data:m,isLoading:x}=ec({ar_profile_id:l,start_date:u,end_date:p,country_code__in:r.length?r:[L.HG]}),h=null!=(t=null==m?void 0:m.timeseries)?t:[],y=null==m?void 0:m.summary,g=h.map(e=>e.popularity).filter(e=>null!=e),f=g.length>=2?g[g.length-1]-g[0]:null,v=h.map(e=>{let t={date_day:e.report_date};return o.forEach(l=>{let a=L.Dz.find(e=>e.key===l);t[l]=(0,L.jI)(e,l),a&&(t[a.changePctKey]=e[a.changePctKey])}),t}),j=o.map(e=>{var t,l;let a=L.Dz.find(t=>t.key===e);return{key:e,title:null!=(t=null==a?void 0:a.title)?t:e,unit:null!=(l=null==a?void 0:a.unit)?l:L.Dz[0].unit,color:d(e),source:em.O.Spotify,deltaKey:null==a?void 0:a.changePctKey,deltaUnit:ed.N.Percent}});return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:L.Dz.map(e=>{var t;let l=m?(0,L.jI)(m.summary,e.key):null,i=null!=l,n=i&&o.includes(e.key),r=e.key===el.Ui.POPULARITY,u=y&&s!==el.Ab.TOTAL?r?f:null!=(t=null==y?void 0:y[e.changePctKey])?t:null:null;return(0,a.jsx)(ex.f,{title:e.title,iconType:e.iconType,description:e.description,value:l,deltaValue:u,deltaUnit:r?ed.N.Number:ed.N.Percent,unit:e.unit,formatMetric:e.formatMetric,isLoading:x,isSelectable:i,isSelected:n,colorHex:n?d(e.key):void 0,onClick:i?()=>(e=>c(t=>t.includes(e)?t.length>1?t.filter(t=>t!==e):t:[...t,e]))(e.key):void 0},e.key)})}),(0,a.jsx)(ey,{title:"Streaming ⢠".concat((0,L.wI)(r)),rangeLabel:n,data:v,metrics:j,isLoading:x})]})},ej=e=>{var t;let{organizationId:l,arProfileId:s,profile:n,onAddSocialAccounts:r}=e,[o,c]=(0,i.useState)(0),[d,u]=(0,i.useState)(el.Ab.MONTH),[p,m]=(0,i.useState)(0),[x,h]=(0,i.useState)([]),y=!!(null==(t=n.artist)?void 0:t.spotify_id),g=y&&0===o,f=L.Jk[p],v=g?L.pe:L.pN,j=v.findIndex(e=>e.window===d),_=-1===j?v.findIndex(e=>e.window===el.Ab.MONTH):j,b=v[_],w=n.social_profiles.length>0,A=!w;return(0,a.jsxs)("div",{className:"space-y-5",children:[!g&&!w&&(0,a.jsx)(en.NE,{type:en.le.Warning,size:en._g.Small,description:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"font-semibold",children:"No social accounts connected."})," Add social accounts to track and measure the artist's social growth."]}),button:(0,a.jsx)(N.$n,{type:N.VQ.Quaternary,size:N.Mp.Small,onClick:r,text:"Add Social Accounts"})}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[y&&(0,a.jsx)("div",{children:(0,a.jsx)(ei.I,{tabs:[{title:"Streaming"},{title:"Social"}],index:o,onTabChange:c})}),!g&&(0,a.jsx)("div",{children:(0,a.jsx)(ei.I,{tabs:L.Jk.map(e=>({title:e.iconType?void 0:e.label,iconType:e.iconType})),index:p,onTabChange:m,isDisabled:A})}),(0,a.jsx)("div",{children:(0,a.jsx)(ei.I,{tabs:v.map(e=>({title:e.label})),index:_,onTabChange:e=>u(v[e].window),isDisabled:!g&&A})}),g&&(0,a.jsx)(ea.A,{selectedCountryCodes:x,onChange:h,unselectedText:"Worldwide",triggerType:es.m.Dropdown,defaultIconType:S.A.Globe})]}),g?(0,a.jsx)(ev,{arProfileId:s,window:b.window,rangeLabel:b.rangeLabel,countryCodes:x}):(0,a.jsx)(ef,{organizationId:l,arProfileId:s,window:b.window,rangeLabel:b.rangeLabel,platform:f.platform,hasConnectedSocial:w,hasSpotifyArtist:y,onAddSocialAccounts:r})]})},eN=e=>{let t=(0,f.MI)({needsAuthentication:!0,includeHost:!1});return(0,er.I)({queryKey:["AR_PROFILE_PERFORMANCE_TOTAL",e],queryFn:()=>t("".concat(g.nM,"/profile/performance_total"),{method:"POST",body:JSON.stringify(e)}),enabled:!!e.ar_profile_id,retry:!1})};var e_=l(18643),eS=l(6259),eb=l(6117),ew=l(60907),eA=l(8542),eC=l(82022),ek=l(69316),eE=l(66417),eT=l(25984);let eP=[eb.BZ.HIGH,eb.BZ.MEDIUM,eb.BZ.LOW].map(e=>({title:L.C6[e],value:e})),eI=e=>{var t,l,s,n,r,o,c,d,u,m;let{organizationId:x,profile:h,onEdit:y,onDelete:g}=e,f=(0,e_.B)(),v=(0,eS.t)(),[j,_]=(0,i.useState)(h.is_favourited),{data:b}=eN({ar_profile_id:h.id}),w=null!=(o=null==b?void 0:b.total_streams)?o:0,A=eP.findIndex(e=>e.value===h.priority),C=null!=(d=null!=(c=null==(t=h.artist)?void 0:t.image_url)?c:null==(l=h.profile_image)?void 0:l.download_url)?d:null;return(0,a.jsx)("div",{className:"shrink-0",children:(0,a.jsxs)(eC.A,{backgroundImageUrl:C,className:"items-start !p-4",children:[(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-5",children:[(0,a.jsx)(eA.e,{src:C,size:90,backupIconType:S.A.Account,className:"shrink-0 border-none"}),(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-2",children:[(0,a.jsxs)("div",{className:"flex flex-col space-y-0.5",children:[(0,a.jsx)(p.E,{typography:p.o.Title1,className:"truncate text-white",children:null!=(u=null==(s=h.artist)?void 0:s.name)?u:h.stage_name}),h.legal_name&&(0,a.jsx)(p.E,{typography:p.o.Callout,className:"text-white",children:h.legal_name})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[!(null==(n=h.artist)?void 0:n.spotify_id)&&(0,a.jsx)(ek.E,{type:ek._.Blurred,title:"No Spotify Profile",onClick:()=>y(),iconType:S.A.Warning}),w>0&&(0,a.jsx)(ek.E,{type:ek._.Blurred,title:"".concat((0,$.$M)(w)," Total Streams")}),(null==(r=h.artist)?void 0:r.country_of_origin)&&(0,a.jsx)(ek.E,{type:ek._.Blurred,title:null!=(m=ew.ax.get(h.artist.country_of_origin.toUpperCase()))?m:h.artist.country_of_origin,leftSideElement:(0,a.jsx)(eE.J,{countryCode:h.artist.country_of_origin.toUpperCase()})}),(0,a.jsx)(eT.m,{items:eP,selectedIndex:A>=0?A:void 0,onItemIndexChange:e=>v.mutate({ar_profile_id:h.id,priority:eP[e].value}),isDisabled:v.isPending,renderCustomTrigger:e=>{let{onClick:t}=e;return(0,a.jsx)(ek.E,{type:L.YE[h.priority],title:"Priority: ".concat(L.C6[h.priority]),rightSideIconType:S.A.SortDown,onClick:t})}})]})]})]}),(0,a.jsxs)("div",{className:"flex shrink-0 gap-2",children:[(0,a.jsx)(N.$n,{type:N.VQ.Overlay,size:N.Mp.Small,iconType:S.A.Save,tooltipTitle:j?"Remove From My Favorites":"Add To My Favorites",onClick:()=>{let e=!j;_(e),f.mutate({ar_profile_id:h.id},{onSuccess:e=>{e&&_(e.is_favourited)},onError:()=>_(!e)})},iconOutline:!j}),(0,a.jsx)(N.$n,{type:N.VQ.Overlay,size:N.Mp.Small,iconType:S.A.Edit,tooltipTitle:"Edit",onClick:()=>y()}),(0,a.jsx)(N.$n,{type:N.VQ.Overlay,size:N.Mp.Small,iconType:S.A.Trash,tooltipTitle:"Delete",onClick:()=>g()})]})]})})};var eM=l(25051);let eO=e=>{let{title:t,action:l,children:s,className:i}=e;return(0,a.jsxs)("div",{className:z()("space-y-3 py-4",i),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsx)(p.E,{typography:p.o.Footnote,bold:!0,children:t}),l]}),s]})},ez=e=>{let{email:t}=e;return(0,a.jsx)(eO,{title:"Assigned A&R Rep",children:t?(0,a.jsx)(p.E,{typography:p.o.Footnote,className:"truncate text-slate-600",children:t}):(0,a.jsx)(p.E,{typography:p.o.Caption1,className:"text-slate-400",children:"--"})})},eL="AR_PROFILE_CONTACT_METHODS",eD=e=>{let{contactMethod:t}=e;return(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(S.I,{className:"shrink-0 fill-slate-400",type:L.HK[t.type],size:16}),(0,a.jsxs)("div",{className:"min-w-0 space-y-0.5",children:[(0,a.jsx)(p.E,{typography:p.o.Footnote,className:"truncate text-slate-600",children:t.value}),t.description&&(0,a.jsx)(p.E,{typography:p.o.Caption2,className:"text-slate-400",children:t.description})]})]})};var eF=l(36002),eR=l(47312),eV=l(16989),eQ=l(24447);let eq=e=>{let{isOpen:t,onClose:l,organizationId:s,arProfileId:r,contactMethods:o}=e,[c,d]=(0,i.useState)(()=>o.map(e=>({id:e.id,type:e.type,value:e.type===eb.Wo.PHONE?e.value.replace(/\D/g,""):e.value,description:e.description}))),u=(()=>{let{addToast:e}=(0,h.Xm)(),t=(0,m.jE)(),l=(0,f.MI)({needsAuthentication:!0,includeHost:!1});return(0,x.n)({mutationFn:e=>l("".concat(g.nM,"/contact_method/set"),{method:"POST",body:JSON.stringify(e)}),onSuccess:()=>{e(y.K.Success,"Contact Methods Updated"),t.invalidateQueries({queryKey:[n.Z]}),t.invalidateQueries({queryKey:[eL]})},onError:()=>{e(y.K.Error,"Failed to Update Contact Methods")}})})(),p=c.some(e=>e.type===eb.Wo.PHONE&&""!==e.value.trim()&&!(0,w.U1)(e.value).isValid),v=()=>{d(e=>[...e,{id:(0,eF.A)(),type:eb.Wo.EMAIL,value:"",description:""}])},j=[{title:"Email Address",iconType:S.A.Mail,value:eb.Wo.EMAIL},{title:"Phone Number",iconType:S.A.Mobile,value:eb.Wo.PHONE}],_=[{key:"type",title:"Type",colspan:.3,cell:e=>{let{row:t}=e;return(0,a.jsx)(eT.m,{items:j,selectedIndex:j.findIndex(e=>e.value===t.type),onItemIndexChange:e=>d(l=>l.map(l=>l.id===t.id?{...l,type:j[e].value}:l))})}},{key:"contact_info",title:"Contact Info",colspan:1,cell:(0,i.useMemo)(()=>e=>{let{row:t}=e;return t.type===eb.Wo.PHONE?(0,a.jsx)(eV.A,{value:t.value,onChange:e=>d(l=>l.map(l=>l.id===t.id?{...l,value:e}:l)),label:"",className:"w-full",containerClassName:"w-full"}):(0,a.jsx)(C.p,{value:t.value,onChange:e=>d(l=>l.map(l=>l.id===t.id?{...l,value:e.target.value}:l)),placeholder:"[email protected]"})},[])},{key:"description",title:"Description",colspan:1,cell:(0,i.useMemo)(()=>e=>{let{row:t}=e;return(0,a.jsx)(C.p,{value:t.description,onChange:e=>d(l=>l.map(l=>l.id===t.id?{...l,description:e.target.value}:l)),placeholder:"Ex. Management"})},[])},{key:"action",title:"",colspan:.25,cell:e=>{let{row:t}=e;return(0,a.jsx)(N.$n,{type:N.VQ.Tertiary,size:N.Mp.Small,onClick:()=>d(e=>e.filter(e=>e.id!==t.id)),iconType:S.A.Trash,tooltipTitle:"Remove"})}}];return(0,a.jsxs)(E.a,{isOpen:t,className:"flex h-full max-h-[750px] w-[850px] flex-col overflow-hidden",children:[(0,a.jsx)(P.r,{title:"Contact Methods",onClose:l}),(0,a.jsxs)("div",{className:"flex flex-grow flex-col overflow-hidden p-6",children:[c.length>0?(0,a.jsx)("div",{className:"overflow-hidden",children:(0,a.jsx)(eQ.XI,{headers:_,pageSize:c.length,data:c})}):(0,a.jsx)("div",{className:"flex flex-grow items-center justify-center",children:(0,a.jsx)(eR.A,{type:eR.S.Gray,iconType:S.A.Mail,title:"No Contact Methods Yet",subtitle:"Document the artist's email addresses and phone numbers for internal visibility.",additionalReactNodes:(0,a.jsx)(N.$n,{type:N.VQ.Quaternary,size:N.Mp.Small,onClick:v,text:"Add Contact Method",iconType:S.A.Plus})})}),c.length>0&&(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(N.$n,{type:N.VQ.Link,size:N.Mp.Small,onClick:v,text:"Add Contact Method",iconType:S.A.Plus})})]}
1),(0,a.jsx)(T.j,{className:"justify-end",children:(0,a.jsxs)(A.e,{children:[(0,a.jsx)(N.$n,{type:N.VQ.Tertiary,size:N.Mp.Small,onClick:l,text:"Cancel"}),(0,a.jsx)(N.$n,{type:N.VQ.Primary,size:N.Mp.Small,onClick:()=>{u.mutateAsync({ar_profile_id:r,contact_methods:c.filter(e=>e.value.trim()).map(e=>({type:e.type,value:e.type===eb.Wo.PHONE?"+".concat(e.value.replace(/\D/g,"")):e.value.trim(),description:e.description.trim()}))}).then(()=>l())},text:"Save Changes",loading:u.isPending,disabled:p})]})})]})},eU=e=>{var t,l;let{organizationId:s,arProfileId:n}=e,[r,o]=(0,i.useState)(!1),c=(e=>{let{arProfileId:t,enabled:l=!0}=e,a=(0,f.MI)({needsAuthentication:!0,includeHost:!1});return(0,er.I)({queryKey:[eL,t],queryFn:()=>a("".concat(g.nM,"/contact_method/list"),{method:"POST",body:JSON.stringify({ar_profile_id:t})}),enabled:l&&!!t})})({arProfileId:n}),d=null!=(l=null==(t=c.data)?void 0:t.items)?l:[],u=d.length>0;return(0,a.jsxs)(eO,{title:"Contact Methods",action:u&&(0,a.jsx)(N.$n,{type:N.VQ.IconOnly,size:N.Mp.Small,iconType:S.A.Edit,onClick:()=>o(!0)}),children:[r&&(0,a.jsx)(eq,{isOpen:r,onClose:()=>o(!1),organizationId:s,arProfileId:n,contactMethods:d}),u?(0,a.jsx)("div",{className:"space-y-2",children:d.map(e=>(0,a.jsx)(eD,{contactMethod:e},e.id))}):!c.isLoading&&(0,a.jsx)(N.$n,{type:N.VQ.Link,size:N.Mp.Small,iconType:S.A.Plus,text:"Add",onClick:()=>o(!0)})]})};var eK=l(4308),e$=l(59295);let eH=e=>{let{event:t}=e;return(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)("div",{className:"shrink-0 p-1",children:(0,a.jsx)("div",{className:"ring-primary-100 bg-primary-600 h-2 w-2 rounded-full ring-4"})}),(0,a.jsxs)("div",{className:"min-w-0 space-y-0.5",children:[(0,a.jsx)(p.E,{typography:p.o.Footnote,className:"text-slate-600",children:(0,L.g_)(t)}),(0,a.jsxs)(p.E,{typography:p.o.Caption2,className:"text-slate-400",children:[(0,e$.A)(t.created_at).format("MM/DD/YY"),t.actor_email_address?" ⢠".concat(t.actor_email_address):""]})]})]})},eB=e=>{var t;let{arProfileId:l}=e,[s,n]=(0,i.useState)(!1),{data:r,isFetching:o}=(e=>{let t=(0,f.MI)({needsAuthentication:!0,includeHost:!1});return(0,er.I)({queryKey:["AR_PROFILE_EVENTS",e],queryFn:()=>t("".concat(g.nM,"/profile/list_events"),{method:"POST",body:JSON.stringify(e)}),enabled:!!e.ar_profile_id,placeholderData:eK.rX,retry:!1})})({ar_profile_id:l,page_size:s?100:4}),c=null!=(t=null==r?void 0:r.items)?t:[];if(0===c.length)return null;let d=!s&&!!(null==r?void 0:r.links.has_next),u=s?"Show Less":"Show More";return o&&(u=s?"Show More...":"Show Less..."),(0,a.jsxs)(eO,{title:"Deal History",children:[(0,a.jsx)("div",{className:"space-y-2",children:c.map((e,t)=>(0,a.jsx)(eH,{event:e},t))}),(d||s)&&(0,a.jsx)("div",{className:"pl-6",children:(0,a.jsx)(N.$n,{type:N.VQ.Link,size:N.Mp.Small,text:u,disabled:o,onClick:()=>n(!s),bold:!1})})]})};var eJ=l(77271);let eX=[eb.f6.PROSPECTING,eb.f6.NEGOTIATING,eb.f6.OFFER_SENT,eb.f6.SIGNED,eb.f6.PASSED].map(e=>({title:L.tx[e],value:e,iconType:L.og[e],description:L.Ls[e]})),eG=e=>{let{organizationId:t,arProfileId:l,dealStatus:s}=e,i=(0,eJ.t)(),n=eX.findIndex(e=>e.value===s);return(0,a.jsx)(eO,{title:"Profile Status",children:(0,a.jsxs)("div",{className:"!mt-2 space-y-2",children:[(0,a.jsx)(eT.m,{items:eX,selectedIndex:n>=0?n:void 0,onItemIndexChange:e=>i.mutate({ar_profile_id:l,deal_status:eX[e].value}),matchTriggerWidth:!0,triggerClassName:"w-full",isDisabled:i.isPending}),(0,a.jsx)(p.E,{typography:p.o.Caption1,className:"text-slate-400",children:L.Ls[s]})]})})};var eW=l(52081);let eZ=e=>{let{rightHolders:t}=e,l=[null==t?void 0:t.imprint,null==t?void 0:t.record_label,null==t?void 0:t.distributor].filter(
1Boolean);return(0,a.jsx)(eO,{title:"Rights Holders",children:t&&l.length>0?(0,a.jsx)(eW.A,{rightHolders:t}):(0,a.jsx)(p.E,{typography:p.o.Caption1,className:"text-slate-400",children:"Based on the artist's most recent release."})})},eY=e=>{let{territoryCodes:t}=e;return(0,a.jsx)(eO,{title:"Rights Territories",children:t.length>0?(0,a.jsx)("div",{className:"flex flex-wrap gap-1",children:t.map(e=>(0,a.jsx)(ek.E,{type:ek._.White,title:ew.ax.get(e),iconType:S.A.Globe},e))}):(0,a.jsx)(p.E,{typography:p.o.Caption1,className:"text-slate-400",children:"All territories"})})};var e0=l(44603),e1=l(82203),e2=l.n(e1);let e5=e=>{let{iconType:t,label:l,url:s,followersCount:i}=e;return(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,a.jsx)(S.I,{type:t,size:16,className:"fill-slate-400"}),(0,a.jsx)(e2(),{href:s,target:"_blank",rel:"noreferrer",className:"flex items-center justify-between gap-2",children:(0,a.jsx)(p.E,{typography:p.o.Caption1,className:"text-primary-600 hover:text-primary-800 active:text-primary-900 truncate underline transition",children:l})})]}),null!=i&&(0,a.jsx)(p.E,{typography:p.o.Caption1,className:"text-slate-500",children:(0,$.$M)(i)})]})},e3={[em.O.Instagram]:S.A.InstagramColor,[em.O.TikTok]:S.A.TikTokColor},e4=e=>{let{spotifyArtist:t,instagramProfile:l,tiktokProfile:s,websiteUrl:i,onAdd:n}=e,r=!!(t||l||s||i);return(0,a.jsx)(eO,{title:"Social Profiles / Links",action:r&&(0,a.jsx)(N.$n,{type:N.VQ.IconOnly,size:N.Mp.Small,iconType:S.A.Edit,onClick:()=>n()}),children:r?(0,a.jsxs)("div",{className:"space-y-2",children:[t&&(0,a.jsx)(e5,{iconType:S.A.SpotifyColor,label:t.name,url:(0,e0.VQ)(t.spotifyId)}),l&&(0,a.jsx)(e5,{iconType:e3[em.O.Instagram],label:"@".concat(l.username),url:"https://www.instagram.com/".concat(l.username),followersCount:l.follower_count}),s&&(0,a.jsx)(e5,{iconType:e3[em.O.TikTok],label:"@".concat(s.username),url:"https://www.tiktok.com/@".concat(s.username),followersCount:s.follower_count}),i&&(0,a.jsx)(e5,{iconType:S.A.Community,label:i.replace(/^https?:\/\//,""),url:i})]}):(0,a.jsx)(N.$n,{type:N.VQ.Link,size:N.Mp.Small,iconType:S.A.Plus,text:"Add",onClick:()=>n()})})};var e6=l(95412),e8=function(e){return e.Compact="COMPACT",e.Default="DEFAULT",e.Expanded="EXPANDED",e}({});let e9=e=>{let{segments:t,className:l,splitBarLegendType:s="DEFAULT"}=e,n=t.reduce((e,t)=>e+t.value,0),r=(0,$.R$)(t.map(e=>e.value),1),o=0===n?t.map(e=>({...e,widthPercent:0,displayPercent:0})):t.map((e,t)=>({...e,widthPercent:e.value/n*100,displayPercent:r[t]}));return(0,a.jsxs)("div",{className:z()("w-full space-y-2",l),children:["COMPACT"===s&&(0,a.jsx)("div",{className:"flex flex-row space-x-1",children:o.map((e,t)=>{let l=(0,$.ZV)(e.displayPercent/100,ed.N.Percent,0),s=(0,a.jsxs)("div",{className:"flex flex-row items-center space-x-1",children:[(0,a.jsx)("div",{className:z()("inline-block h-3 w-3 rounded",e.colorClassName)}),(0,a.jsx)(p.E,{typography:p.o.Footnote,className:"!truncate text-inherit text-slate-600",children:l})]});return(0,a.jsxs)(i.Fragment,{children:[(0,a.jsx)(e6.m,{title:"".concat(e.label,": ").concat(void 0!==e.count?(0,$.ZV)(e.count,ed.N.Number):l),triggerClassName:"!w-max",children:s}),t<o.length-1&&(0,a.jsx)(p.E,{typography:p.o.Footnote,className:"text-slate-600",children:"/"})]},"split-bar__legend__".concat(t))})}),(0,a.jsx)("div",{className:"h-[6px] w-full overflow-hidden rounded-full",children:(0,a.jsx)("div",{className:"flex h-full space-x-0.5",children:0!==n&&o.map((e,t)=>(0,a.jsx)("div",{className:e.colorClassName,style:{width:"".concat(Math.max(e.widthPercent,.5),"%")}},"split-bar__segment__".concat(t)))})}),"DEFAULT"===s&&(0,a.jsx)("div",{className:"flex w-full items-center space-x-3 overflow-hidden",children:o.map((e,t)=>{let l=(0,a.jsxs)("div",{className:"flex flex-1 flex-row items-center space-x-1",children:[(0,a.jsx)("div",{className:z()("inline-block h-3 w-3 rounded",e.colorClassName)}),(0,a.jsxs)(p.E,{typography:p.o.Caption1,className:"!truncate text-inherit",children:[(0,$.ZV)(e.displayPercent/100,ed.N.Percent,0)," ",e.label]})]});return void 0===e.count?(0,a.jsx)(i.Fragment,{children:l},"split-bar__legend__".concat(t)):(0,a.jsx)(e6.m,{title:"".concat(e.label,": ").concat((0,$.ZV)(e.count,ed.N.Number)),triggerClassName:"!w-max",children:l},"split-bar__legend__".concat(t))})}),"EXPANDED"===s&&(0,a.jsx)(a.Fragment,{children:o.map((e,t)=>(0,a.jsxs)(i.Fragment,{children:[(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)("div",{className:"flex flex-row items-center space-x-1",children:[(0,a.jsx)("div",{className:z()("inline-block h-3 w-3 rounded",e.colorClassName)}),(0,a.jsx)(p.E,{typography:p.o.Caption1,bold:!0,className:"text-slate-500",children:e.label})]}),(0,a.jsxs)("div",{className:"flex flex-row justify-between",children:[(0,a.jsx)(p.E,{typography:p.o.Caption1,bold:!0,className:"text-white",children:(0,$.ZV)(e.value,ed.N.Number)}),(0,a.jsx)(p.E,{typography:p.o.Caption1,bold:!0,className:"text-slate-500",children:(0,$.ZV)(e.widthPercent/100,ed.N.Percent)})]})]}),t!==o.length-1&&(0,a.jsx)("div",{className:"h-[1px] w-full bg-slate-800"})]},"split-bar__expanded-legend__".concat(t)))})]})};var e7=l(58914);let te=["US / Non-US Streams","Active / Programmed Streams"],tt=()=>(0,a.jsx)(a.Fragment,{children:te.map(e=>(0,a.jsx)(eO,{title:e,children:(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("div",{className:"w-24",children:(0,a.jsx)(e7.U,{})}),(0,a.jsx)("div",{className:"h-4 w-full animate-pulse rounded-full bg-slate-100"})]})},e))}),tl=e=>{let{arProfileId:t}=e,{data:l,isLoading:s}=eN({ar_profile_id:t});if(s)return(0,a.jsx)(tt,{});if(!l||0===l.total_streams)return null;let{us_summary:i,service_type_summary:n}=l;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(eO,{title:"US / Non-US Streams",children:(0,a.jsx)(e9,{segments:[{value:i.us_streams_pct,count:i.us_streams,label:"US",colorClassName:"bg-primary-600"},{value:i.non_us_streams_pct,count:i.non_us_streams,label:"Non-US",colorClassName:"bg-primary-200"}],splitBarLegendType:e8.Compact})}),(0,a.jsx)(eO,{title:"On-Demand / Programmed Streams",children:(0,a.jsx)(e9,{segments:[{value:n.active_streams_pct,count:n.active_streams,label:"On-Demand",colorClassName:"bg-primary-600"},{value:n.programmed_streams_pct,count:n.programmed_streams,label:"Programmed",colorClassName:"bg-primary-200"}],splitBarLegendType:e8.Compact})})]})},ta=e=>{var t,l;let{market:s,sharePct:i}=e,n=null===s.country_code?"Other":null!=(t=ew.ax.get(s.country_code))?t:s.country_code;return(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(eE.J,{countryCode:null!=(l=s.country_code)?l:"ZZ"}),(0,a.jsx)(p.E,{typography:p.o.Footnote,className:"flex-grow truncate text-slate-600",children:n}),(0,a.jsx)(p.E,{typography:p.o.Caption1,className:"text-slate-500",children:(0,$.$M)(s.streams)}),(0,a.jsx)(p.E,{typography:p.o.Caption1,className:"w-9 text-right text-slate-400",children:(0,$.ZV)(i/100,ed.N.Percent,0)})]})},ts=e=>{let{arProfileId:t}=e,{data:l}=eN({ar_profile_id:t}),s=null==l?void 0:l.countries;if(!s||0===s.length)return null;let i=(0,$.R$)(s.map(e=>e.streams));return(0,a.jsx)(eO,{title:"Top Markets",children:(0,a.jsx)("div",{className:"space-y-2",children:s.map((e,t)=>{var l;return(0,a.jsx)(ta,{market:e,sharePct:i[t]},null!=(l=e.country_code)?l:"other")})})})},ti=e=>{var t;let{organizationId:l,profile:s,onAdd:n}=e,r=(0,i.useRef)(null),[o,c]=(0,i.useState)(!1),d=e=>{if(e.current){let{scrollTop:t,scrollHeight:l,clientHeight:a}=e.current;c(l<=a||t+a+24>=l)}};(0,i.useEffect)(()=>{d(r)},[s.id]);let u=(null==(t=s.artist)?void 0:t.spotify_id)?{spotifyId:s.artist.spotify_id,name:s.artist.name}:null;return(0,a.jsx)("div",{className:"relative w-[280px] max-w-[280px] shrink-0 self-stretch",children:(0,a.jsxs)("div",{ref:r,onScroll:()=>d(r),className:"scrollbar-hidden absolute inset-0 overflow-y-auto rounded-2xl border border-slate-200 bg-white",children:[(0,a.jsxs)("div",{className:"divide-y divide-slate-200 px-4",children:[(0,a.jsx)(eG,{organizationId:l,arProfileId:s.id,dealStatus:s.deal_status}),(0,a.jsx)(eB,{arProfileId:s.id}),(0,a.jsx)(tl,{arProfileId:s.id}),(0,a.jsx)(ts,{arProfileId:s.id}),(0,a.jsx)(e4,{spotifyArtist:u,instagramProfile:s.social_profiles.find(e=>e.platform===em.O.Instagram),tiktokProfile:s.social_profiles.find(e=>e.platform===em.O.TikTok),websiteUrl:s.website_url,onAdd:n}),(0,a.jsx)(ez,{email:s.assigned_rep_email_address}),(0,a.jsx)(eZ,{rightHolders:s.right_holders}),(0,a.jsx)(eU,{organizationId:l,arProfileId:s.id}),(0,a.jsx)(eY,{territoryCodes:s.country_codes})]}),(0,a.jsx)(eM.A,{isScrolledToEnd:o,label:"More"})]})})};var tn=l(63372),tr=l(32393),to=l(16853),tc=l(85077),td=l(43027),tu=l(15935);let tp=e=>{let{row:t}=e;return(0,a.jsx)(e2(),{href:"".concat("https://open.spotify.com/album","/").concat(t.spotify_album_id),target:"_blank",rel:"noopener noreferrer",children:(0,a.jsx)(N.$n,{type:N.VQ.Quaternary,size:N.Mp.Small,onClick:()=>void 0,iconType:S.A.Open,tooltipTitle:"Open in Spotify"})})},tm=e=>{let{row:t,interactive:l=!1,active:s=!1}=e;return(0,a.jsxs)("div",{className:"flex h-full w-full min-w-0 items-center gap-3",children:[(0,a.jsx)("div",{className:"shrink-0",children:(0,a.jsx)(eA.e,{src:t.image_url,size:40,backupIconType:S.A.Music})}),(0,a.jsxs)("div",{className:"min-w-0 flex-1 space-y-0.5 text-left",children:[(0,a.jsx)(p.E,{typography:p.o.Footnote,bold:!0,className:z()("truncate",{"text-slate-600":!s,"text-primary-600":s,"group-hover/tablerow:text-primary-600 group-hover:underline":l}),children:t.title}),(0,a.jsx)(p.E,{typography:p.o.Caption1,className:"text-slate-500",children:L.e$[t.release_type]})]})]})};var tx=l(20922),th=l(14430),ty=l(10783);let tg=e=>{let{row:t}=e,l=(0,s.useRouter)(),[n,r]=(0,i.useState)(!1);return(0,a.jsx)(ty.AM,{content:(0,a.jsx)(th.i,{className:"max-h-[280px] w-[260px] space-y-0.5 overflow-y-auto",onClick:e=>e.stopPropagation(),children:t.tracks.map((e,t)=>(0,a.jsx)(e2(),{href:{pathname:"/songs/".concat(e.auto_segment_id),query:l.query},onClick:()=>r(!1),children:(0,a.jsx)(tx.t,{title:(0,a.jsxs)("span",{className:"flex w-[200px] items-center gap-2",children:[(0,a.jsx)("span",{className:"w-5 shrink-0 text-right text-slate-400",children:t+1}),(0,a.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.track_name})]}),onClick:()=>void 0})},e.auto_segment_id))}),isOpen:n,align:ty.bq.Start,onOutsideClick:()=>r(!1),triggerClassName:"w-full",children:(0,a.jsx)("button",{type:"button",className:"group flex h-full w-full items-center",onClick:e=>{e.stopPropagation(),r(e=>!e)},children:(0,a.jsx)(tm,{row:t,interactive:!0,active:n})})})},tf=e=>{let{row:t}=e,l=(0,s.useRouter)();return 1===t.tracks.length?(0,a.jsx)(e2(),{href:{pathname:"/songs/".concat(t.tracks[0].auto_segment_id),query:l.query},className:"group flex h-full w-full items-center",onClick:e=>e.stopPropagation(),children:(0,a.jsx)(tm,{row:t,interactive:!0})}):t.tracks.length>1?(0,a.jsx)(tg,{row:t}):(0,a.jsx)(tm,{row:t})},tv=[{title:"All Types",value:null},...Object.values(tr.F).map(e=>({title:L.e$[e],value:e}))],tj=e=>{var t;let{organizationId:l,arProfileId:s}=e,[n,r]=(0,i.useState)(""),o=(0,tn.d)(n,400),[c,d]=(0,i.useState)(null),[u,p]=(0,i.useState)(0),[m,x]=(0,i.useState)(void 0),[h,y]=(0,i.useState)(10),{countKey:v,deltaKey:j,label:N}=L.uv[u],_=()=>x(void 0),{data:b,isLoading:w}=(e=>{let t=(0,f.MI)({needsAuthentication:!0,includeHost:!1});return(0,er.I)({queryKey:["AR_PROFILE_RECENT_RELEASES",e],queryFn:()=>t("".concat(g.nM,"/profile/list_recent_releases"),{method:"POST",body:JSON.stringify(e)}),enabled:!!e.organization_id&&!!e.ar_profile_id,retry:!1})})({organization_id:l,ar_profile_id:s,search:o||void 0,release_type:c,cursor:m,page_size:h}),A=(null!=(t=null==b?void 0:b.items)?t:[]).map(e=>({...e,id:e.spotify_album_id,window_streams:e[v],window_streams_delta_pct:e[j]})),k=[{key:"title",title:"Release",colspan:1.5,cell:tf,sticky:!0},{key:"release_date",title:"Release Date",colspan:1,cell:to.d},{key:"window_streams",deltaKey:"window_streams_delta_pct",title:"".concat(N," Streams"),colspan:1,cell:td.B},{key:"streams_total",title:"Total Streams",colspan:1,cell:tc.r}];return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("div",{className:"min-w-[200px] flex-grow",children:(0,a.jsx)(C.p,{className:"w-full",iconType:S.A.Search,placeholder:"Search releases...",value:n,onChange:e=>{r(e.target.value),_()}})}),(0,a.jsx)(eT.m,{items:tv,selectedIndex:tv.findIndex(e=>e.value===c),onItemIndexChange:e=>{d(tv[e].value),_()}}),(0,a.jsx)("div",{children:(0,a.jsx)(ei.I,{tabs:L.uv.map(e=>({title:e.label})),index:u,onTabChange:e=>{p(e),_()}})})]}),(0,a.jsx)(eQ.XI,{headers:k,data:A,isLoading:w,pageSize:h,emptyText:"No releases found",renderActionCell:e=>(0,a.jsx)(tp,{row:e}),footer:(0,a.jsx)(tu.A,{cursor:m,links:null==b?void 0:b.links,onPageChange:e=>x(e),pageSize:h,setPageSize:e=>{y(e),_()}})})]})},tN=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{enabled:l=!0}=t,a=(0,f.MI)({needsAuthentication:!0,includeHost:!1});
1return(0,er.I)({queryKey:["AR_PROFILE_SOCIAL_CREATES",e],queryFn:()=>a("".concat(g.nM,"/profile/list_social_creates"),{method:"POST",body:JSON.stringify(e)}),enabled:l&&!!e.organization_id&&!!e.ar_profile_id,retry:!1})};var t_=l(38620),tS=l(72152),tb=l(20300),tw=l(25880),tA=l(80535);let tC=e=>{let{row:t}=e,l=(0,s.useRouter)(),i=t.social_content.sound,n=(null==i?void 0:i.title)||"--";return(0,a.jsxs)("div",{className:"flex h-full min-w-0 flex-col justify-center space-y-0.5",children:[t.auto_segment_id?(0,a.jsx)(e2(),{href:{pathname:"/songs/".concat(t.auto_segment_id),query:l.query},className:"hover:text-primary-600 truncate text-slate-600 transition hover:underline",onClick:e=>e.stopPropagation(),children:(0,a.jsx)(p.E,{typography:p.o.Footnote,bold:!0,className:"text-inherit",children:n})}):(0,a.jsx)(p.E,{typography:p.o.Footnote,bold:!0,className:"truncate text-slate-600",children:n}),(null==i?void 0:i.author_name)&&(0,a.jsx)(p.E,{typography:p.o.Caption1,className:"truncate text-slate-500",children:i.author_name})]})};var tk=l(40399);let tE=e=>{let{row:t}=e;return(0,a.jsx)("div",{className:"flex h-full w-full items-center",children:(0,a.jsx)(tk.A,{socialContent:t.social_content,thumbnailOverlay:t.social_content.country_code?(0,a.jsx)(eE.J,{countryCode:t.social_content.country_code,width:"12"}):void 0})})};var tT=l(63804);let tP=e=>{let{row:t,setIsActive:l}=e,{addToast:s}=(0,h.Xm)(),[n,r]=(0,i.useState)(!1),o=t.social_content.platform,c=(0,tb.Gc)(t.social_content),d=()=>{r(!1),null==l||l(!1)};return(0,a.jsx)(ty.AM,{content:(0,a.jsxs)(th.i,{className:"w-[200px] space-y-0.5",onClick:e=>e.stopPropagation(),children:[(0,a.jsx)(tx.t,{title:"Copy Link",iconType:S.A.Link,isDisabled:!c,onClick:()=>{d(),c&&navigator.clipboard.writeText(c).then(()=>{s(y.K.Success,"Link copied to clipboard!")})}}),(0,a.jsx)(tx.t,{title:"View on ".concat((0,tT.$r)(o)),iconType:S.A.Open,isDisabled:!c,onClick:()=>{d(),c&&window.open(c,"_blank","noopener,noreferrer")}})]}),isOpen:n,align:ty.bq.End,onOutsideClick:d,children:(0,a.jsx)(N.$n,{type:N.VQ.Quaternary,size:N.Mp.Small,iconType:S.A.More,onClick:()=>{n?d():(r(!0),null==l||l(!0))}})})},tI=e=>{var t;let{organizationId:l,arProfileId:s,hasConnectedSocial:n,onAddSocialAccounts:r}=e,[o,c]=(0,i.useState)(0),[d,u]=(0,i.useState)([]),[m,x]=(0,i.useState)(void 0),[h,y]=(0,i.useState)(L.rx[0].sortBy),[g,f]=(0,i.useState)(tS.m.Desc),[v,j]=(0,i.useState)(void 0),[_,b]=(0,i.useState)(25),[w,A]=(0,i.useState)(void 0),C=L.Jk[o],k=()=>j(void 0),{data:E,isLoading:T}=tN({organization_id:l,ar_profile_id:s,platform:L.y6[C.platform],author_filter:m,sort_by:h,sort_direction:g===tS.m.Asc?t_.z0.ASC:t_.z0.DESC,country_code__in:d,cursor:v,page_size:_},{enabled:n});if(!n)return(0,a.jsxs)("div",{className:"flex h-[332px] flex-col items-center justify-center space-y-5 rounded-2xl border border-slate-200 p-5",children:[(0,a.jsxs)("div",{className:"space-y-1 text-center",children:[(0,a.jsx)(p.E,{typography:p.o.Footnote,bold:!0,className:"text-slate-500",children:"No social accounts connected."}),(0,a.jsx)(p.E,{typography:p.o.Caption1,className:"text-slate-400",children:"Add social accounts to track the posts using the artist's sounds."})]}),(0,a.jsx)(N.$n,{type:N.VQ.Quaternary,size:N.Mp.Small,onClick:r,text:"Add Social Accounts",iconType:S.A.Plus})]});let P=(null!=(t=null==E?void 0:E.items)?t:[]).map(e=>({...e,...e.performance,id:e.social_content.id})),I=[{key:"post",title:"Post",colspan:2,cell:tE,sticky:!0},{key:"associated_sound",title:"Associated Song",colspan:1.5,cell:tC},...L.rx.map(e=>({key:e.sortBy,title:e.label,colspan:1,sortable:!0,unit:e.unit,cell:tc.r}))],M=w?P.findIndex(e=>e.id===w.id):-1;return(0,a.jsxs)("div",{className:"space-y-4",children:[w&&(0,a.jsx)(tw.V,{video:(0,tb.sU)(w.social_content),organizationId:l,onClose:()=>A(void 0),onClickNext:()=>{M>-1&&M<P.length-1&&A(P[M+1])},onClickBack:()=>{M>0&&A(P[M-1])},isNextButtonDisabled:M===P.length-1,isBackButtonDisabled:0===M}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("div",{children:(0,a.jsx)(ei.I,{tabs:L.Jk.map(e=>({title:e.iconType?void 0:e.label,iconType:e.iconType})),index:o,onTabChange:e=>{c(e),k()}})}),(0,a.jsx)(ea.A,{selectedCountryCodes:d,onChange:e=>{u(e),k()},triggerType:es.m.Dropdown,unselectedText:"Worldwide",defaultIconType:S.A.Globe}),(0,a.jsx)(tA.e,{items:[{title:"Artist Only",value:t_.Bf.ARTIST_ONLY},{title:"UGC Only",value:t_.Bf.UGC_ONLY}],selectedItem:m,selectedItemPrefix:"",unselectedText:"Post Type",onChange:e=>{x(e),k()},triggerType:es.m.Dropdown})]}),(0,a.jsx)(eQ.XI,{headers:I,data:P,isLoading:T,pageSize:_,emptyText:"No social creates found",sort:h,sortDirection:g,onSortChange:(e,t)=>
1{y(e),f(t),k()},onRowClick:e=>A(e),renderActionCell:(e,t)=>(0,a.jsx)(tP,{row:e,setIsActive:t}),footer:(0,a.jsx)(tu.A,{cursor:v,links:null==E?void 0:E.links,onPageChange:e=>j(e),pageSize:_,setPageSize:e=>{b(e),k()}})})]})},tM="AR_PROFILE_SOCIAL_SOUNDS",tO=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{enabled:l=!0}=t,a=(0,f.MI)({needsAuthentication:!0,includeHost:!1});return(0,er.I)({queryKey:[tM,e],queryFn:()=>a("".concat(g.nM,"/profile/list_social_sounds"),{method:"POST",body:JSON.stringify(e)}),enabled:l&&!!e.organization_id&&!!e.ar_profile_id,retry:!1})};var tz=l(74143),tL=l(47291),tD=l(90101);let tF=e=>{let{row:t}=e,l=(0,s.useRouter)(),i=t.song.title||"--";return(0,a.jsxs)("div",{className:"flex h-full min-w-0 flex-col justify-center space-y-0.5",children:[t.auto_segment_id?(0,a.jsx)(e2(),{href:{pathname:"/songs/".concat(t.auto_segment_id),query:l.query},className:"hover:text-primary-600 truncate text-slate-600 transition hover:underline",onClick:e=>e.stopPropagation(),children:(0,a.jsx)(p.E,{typography:p.o.Footnote,bold:!0,className:"text-inherit",children:i})}):(0,a.jsx)(p.E,{typography:p.o.Footnote,bold:!0,className:"truncate text-slate-600",children:i}),t.song.artist&&(0,a.jsx)(p.E,{typography:p.o.Caption1,className:"truncate text-slate-500",children:t.song.artist})]})},tR=e=>{let{row:t}=e;return(0,a.jsx)(p.E,{className:"break-words text-inherit text-slate-600",typography:p.o.Footnote,children:(0,$.nJ)(t.sound.published_at)})};var tV=l(75234),tQ=l(49616);let tq=e=>{var t,l,s;let{row:i,onTitleClick:n}=e,r=(0,L.Mo)(i.sound.platform);return(0,a.jsx)(tQ.A,{title:i.sound.title,authorName:null!=(t=i.sound.author_name)?t:void 0,platform:r,hrefUrl:n?void 0:null!=(l=(0,L.af)(i.sound))?l:void 0,onTitleClick:n,coverUrl:i.sound.cover_url,playUrl:null!=(s=i.sound.play_url)?s:void 0,additionalThumbnailElements:(0,a.jsx)(tV.A,{sound:{platform:r,is_pgc:i.sound.is_pgc,is_matched_pgc_sound:i.sound.is_matched_pgc_sound}})})},tU=e=>{var t;let{organizationId:l,arProfileId:s,hasConnectedSocial:n,onAddSocialAccounts:r,renderSongPickerModal:o,renderAddUnreleasedTrackModal:c}=e,[d,u]=(0,i.useState)(),[m,x]=(0,i.useState)(""),h=(0,tn.d)(m,400),[y,g]=(0,i.useState)(0),[f,v]=(0,i.useState)(0),[j,_]=(0,i.useState)(L.MG[0].countSortBy),[b,w]=(0,i.useState)(tS.m.Desc),[A,k]=(0,i.useState)(void 0),[E,T]=(0,i.useState)(25),P=L.Jk[y],I=L.MG[f],M=()=>k(void 0),{data:O,isLoading:z}=tO({organization_id:l,ar_profile_id:s,search:h||void 0,platform:L.PI[P.platform],sort_by:j,sort_direction:b,cursor:A,page_size:E},{enabled:n});if(!n)return(0,a.jsxs)("div",{className:"flex h-[332px] flex-col items-center justify-center space-y-5 rounded-2xl border border-slate-200 p-5",children:[(0,a.jsxs)("div",{className:"space-y-1 text-center",children:[(0,a.jsx)(p.E,{typography:p.o.Footnote,bold:!0,className:"text-slate-500",children:"No social accounts connected."}),(0,a.jsx)(p.E,{typography:p.o.Caption1,className:"text-slate-400",children:"Add social accounts to track the sounds driving the artist's creates."})]}),(0,a.jsx)(N.$n,{type:N.VQ.Quaternary,size:N.Mp.Small,onClick:r,text:"Add Social Accounts",iconType:S.A.Plus})]});let D=(null!=(t=null==O?void 0:O.items)?t:[]).map(e=>({...e,...e.performance,id:e.sound.id})),F=L.uj.flatMap(e=>{let t={key:e.totalSortBy,title:"Total ".concat(e.label),colspan:1,sortable:!0,unit:e.unit,cell:tc.r};return e.hasWindows?[{key:I.countSortBy,deltaKey:I.changePctSortBy,deltaKeySortable:!0,title:"".concat(I.label," ").concat(e.label),colspan:1,sortable:!0,unit:e.unit,cell:td.B},t]:e.deltaSortBy?[{key:e.deltaSortBy,title:"24hr ".concat(e.label),colspan:1,sortable:!0,unit:e.unit,cell:tc.r},t]:[{...t,title:e.label}]}),R=[{key:"sound",title:"Sound",colspan:1.5,cell:e=>{let{row:t}=e;return(0,a.jsx)(tq,{row:t,onTitleClick:()=>u(t)})},sticky:!0},{key:"associated_song",title:"Associated Song",colspan:1.5,cell:tF},{key:tz.K.PUBLISHED_AT,title:"Published",colspan:1,sortable:!0,cell:tR},...F];return(0,a.jsxs)("div",{className:"space-y-4",children:[d&&(0,a.jsx)(tD.A,{sound:(0,L.qQ)(d.sound),song:(0,L.w3)(d.song),organizationId:l,onClose:()=>u(void 0),renderSongPickerModal:o,renderAddUnreleasedTrackModal:c}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("div",{className:"min-w-[200px] flex-grow",children:(0,a.jsx)(C.p,{className:"w-full",iconType:S.A.Search,placeholder:"Search social sounds...",value:m,onChange:e=>{x(e.target.value),M()}})}),(0,a.jsx)("div",{children:(0,a.jsx)(ei.I,{tabs:L.Jk.map(e=>({title:e.iconType?void 0:e.label,iconType:e.iconType})),index:y,onTabChange:e=>{g(e),M()}})}),(0,a.jsx)("div",{children:(0,a.jsx)(ei.I,{tabs:L.MG.map(e=>({title:"".concat(e.label," Creates")})),index:f,onTabChange:e=>{v(e),_(((e,t)=>{let l=L.MG[t];return L.MG.some(t=>t.countSortBy===e)?l.countSortBy:L.MG.some(t=>t.changePctSortBy===e)?l.changePctSortBy:e})(j,e)),M()}})})]}),(0,a.jsx)(eQ.XI,{headers:R,data:D,isLoading:z,pageSize:E,emptyText:"No social sounds found",sort:j,sortDirection:b,onSortChange:(e,t)=>
1{_(e),w(t),M()},onRowClick:e=>u(e),renderActionCell:(e,t)=>(0,a.jsx)(tL.A,{rows:[(0,L.wA)(e)],organizationId:l,renderAs:tL.l.Dropdown,setIsActive:t,renderSongPickerModal:o,renderAddUnreleasedTrackModal:c}),footer:(0,a.jsx)(tu.A,{cursor:A,links:null==O?void 0:O.links,onPageChange:e=>k(e),pageSize:E,setPageSize:e=>{T(e),M()}})})]})};var tK=function(e){return e.Overview="OVERVIEW",e.RecentReleases="RECENT_RELEASES",e.SocialSounds="SOCIAL_SOUNDS",e.SocialCreates="SOCIAL_CREATES",e}(tK||{});let t$=e=>{var t;let{organizationId:l,arProfileId:m,renderSongPickerModal:x,renderAddUnreleasedTrackModal:h}=e,y=(0,s.useRouter)(),{data:g,isLoading:f}=(0,n.a)({ar_profile_id:m}),v=(0,r.v)(),[j,N]=(0,i.useState)(!1),[_,S]=(0,i.useState)(!1),[b,w]=(0,i.useState)("OVERVIEW");if(!g)return(0,a.jsx)("div",{className:"flex h-full w-full items-center justify-center p-8",children:f?(0,a.jsx)(d.I,{size:16,className:"fill-primary-600"}):(0,a.jsx)(p.E,{typography:p.o.Footnote,className:"text-slate-400",children:"Profile not found."})});let A=[{key:"OVERVIEW",title:"Overview"},...(null==(t=g.artist)?void 0:t.spotify_id)?[{key:"RECENT_RELEASES",title:"Recent Releases"}]:[],{key:"SOCIAL_SOUNDS",title:"Social Sounds"},{key:"SOCIAL_CREATES",title:"Social Creates"}],C=A.findIndex(e=>e.key===b);return(0,a.jsxs)("div",{className:"flex h-full w-full flex-col gap-8 p-8",children:[j&&(0,a.jsx)(o.A,{isOpen:j,onClose:()=>N(!1),organizationId:l,profile:g}),_&&(0,a.jsx)(c.R,{isOpen:_,title:"Delete Profile?",message:"Are you sure you want to delete this profile? This can be reversed by an admin.",destructiveText:"Delete",onClose:()=>S(!1),onConfirm:async()=>{await v.mutateAsync({ar_profile_id:g.id}),S(!1),y.push({pathname:"/ar-roster",query:y.query})}}),(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsx)(eI,{organizationId:null!=l?l:"",profile:g,onEdit:()=>N(!0),onDelete:()=>S(!0)}),(0,a.jsxs)("div",{className:"flex flex-row gap-5",children:[(0,a.jsx)(ti,{organizationId:null!=l?l:"",profile:g,onAdd:()=>N(!0)}),(0,a.jsx)("div",{className:"min-w-0 flex-grow",children:(0,a.jsx)(ej,{organizationId:null!=l?l:"",arProfileId:g.id,profile:g,onAddSocialAccounts:()=>N(!0)})})]})]}),(0,a.jsx)("div",{className:"border-t border-slate-200"}),(0,a.jsxs)("div",{className:"space-y-7 pb-12",children:[(0,a.jsx)(u.V,{tabs:A.map(e=>({title:e.title})),index:-1===C?0:C,onTabChange:e=>w(A[e].key)}),"OVERVIEW"===b&&(0,a.jsx)(et,{organizationId:null!=l?l:"",profile:g}),"RECENT_RELEASES"===b&&(0,a.jsx)(tj,{organizationId:null!=l?l:"",arProfileId:g.id}),"SOCIAL_SOUNDS"===b&&(0,a.jsx)(tU,{organizationId:null!=l?l:"",arProfileId:g.id,hasConnectedSocial:g.social_profiles.length>0,onAddSocialAccounts:()=>N(!0),renderSongPickerModal:x,renderAddUnreleasedTrackModal:h}),"SOCIAL_CREATES"===b&&(0,a.jsx)(tI,{organizationId:null!=l?l:"",arProfileId:g.id,hasConnectedSocial:g.social_profiles.length>0,onAddSocialAccounts:()=>N(!0)})]})]})};var tH=l(99615),tB=l(36055),tJ=l(88231),tX=l(48631),tG=l(10607),tW=l(80589);let tZ=()=>{var e,t,l;let r=(0,s.useRouter)(),o=(0,m.jE)(),{setBreadcrumbs:c}=(0,tG.Cq)(),{activeOrganizationId:d}=(0,tW.A)(),u=r.query.arProfileId,{data:p}=(0,n.a)({ar_profile_id:null!=u?u:""}),x=null!=(l=null!=(t=null==p||null==(e=p.artist)?void 0:e.name)?t:null==p?void 0:p.stage_name)?l:"Profile",h=(0,tH.x)();return((0,i.useEffect)(()=>{c([{title:"A&R Roster",href:"/ar-roster"},{title:x}])},[c,x]),u)?(0,a.jsx)(t$,{organizationId:d,arProfileId:u,renderSongPickerModal:e=>{let{isOpen:t,onClose:l,rows:s}=e;return(0,a.jsx)(tX.A,{isOpen:t,onClose:l,onAdd:e=>{d&&Promise.all(e.map(e=>h.mutateAsync({organization_id:d,segment_id:e,sounds:s.map(e=>({platform:e.platform,id_platform:e.id_platform}))}))).then(()=>{o.invalidateQueries({queryKey:[tM]}),l()})},addingIsLoading:h.isPending})},renderAddUnreleasedTrackModal:e=>{let{isOpen:t,onClose:l,rows:s}=e;return(0,a.jsx)(tB.A,{isOpen:t,onClose:l,initialSounds:s})}}):null};tZ.getLayout=function(e){return(0,a.jsx)(tJ.A,{noPadding:!0,children:e})};let tY=tZ}},e=>{e.O(0,[8435,7280,5121,813,9880,4540,2824,2359,4204,7225,113,5312,9432,1518,5340,8231,101,7782,636,6593,8792],()=>e(e.s=33972)),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.