PageSourceSearch

https://app.magicpitch.com/_next/static/chunks/188tkifg1bkxm.js

js magicpitch.com collected 2026-09-29 19:13:18 UTC 27,671 bytes, 4 lines download raw bytes

1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]="01a0ea2e-d568-78c0-b3cc-15b3b99522e4")}catch(e){}}();(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,239616,e=>{"use strict";let t=(0,e.i(475254).default)("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);e.s(["Settings",0,t],239616)},221305,e=>{"use strict";let t=["0-500","500-1k","1k-2k","2k-5k","5k-10k","10k-20k","20k-50k","50k-250k","250k+"],r=t.filter(e=>"0-500"!==e);e.s(["DEFAULT_PODCAST_LISTENERS",0,r,"PODCAST_LISTENER_OPTIONS",0,t])},865568,e=>{"use strict";var t=e.i(221305);let r=["podcast","newsletter","journalist"];function s(e){return"podcast"===e||"newsletter"===e?e:"journo"===e||"journo_v2"===e?"journalist":null}function n(e){let t=e&&"object"==typeof e&&!Array.isArray(e)?e:{};return Array.isArray(t.sources)?t.sources.filter(e=>"string"==typeof e&&r.includes(e)):[...r]}let a={frequency:["daily","weekly","monthly"],listeners:[...t.DEFAULT_PODCAST_LISTENERS],countries:["USA","UK","CA","Other"],use_listeners_and_social:!1,open_to_in_person:["false"],in_person_locations:[],paid:!1,max_paid_amount:null},i={"0-500":[0,500],"500-1k":[500,1e3],"1k-2k":[1001,2e3],"2k-5k":[2001,5e3],"5k-10k":[5001,1e4],"10k-20k":[10001,2e4],"20k-50k":[20001,5e4],"50k-250k":[50001,25e4],"250k+":[250001,1e8]},l={languages:["en"],subscribers:["0-100","100-1k","1k-5k","5k-10k","10k-50k","50k+"],post_recency_days:180},o=["Wire Service","Corporate Media","Research Publication","Academic Journal"],c={locations:[],topics:[],languages:["EN"],media_types:[],visits:[]},u=l.subscribers,d={...l,subscribers:l.subscribers.filter(e=>"0-100"!==e)},p=e=>e.map(e=>"Other"===e?"Worldwide":e),m={podcast:{db:"podcast",label:"Podcasts",filterKey:"podcast",defaultFilter:a},journalist:{db:"journo_v2",label:"Journalists",filterKey:"journo",defaultFilter:{languages:["en"]}},newsletter:{db:"newsletter",label:"Newsletters",filterKey:"newsletter",defaultFilter:d}};function g(e,{teamId:t,userEmails:r,campaignId:s,queryString:n,profileId:i},l){if("podcast"===e){let e=l??a;return{endpoint:"/match/itunes",body:{team_id:t,user_emails:r,campaign_id:s,query_string:n,num:50,filter:{...e,countries:p(e.countries)},profile_id:i,reranker:!0,auto_save:!0,sanitize:!0,llm_check:!0,cut_off_score:6,exclude:!0}}}if("newsletter"===e)return{endpoint:"/match/substack",body:{query_string:n,profile_id:i,num:50,reranker:!1,auto_save:!0,team_id:t,exclude:!0,filter:l??d,user_emails:r,campaign_id:s}};let o=l??c;return{endpoint:"/match/article",body:{team_id:t,user_emails:r,campaign_id:s,query_string:n,num:50,filter:{locations:o.locations,topics:o.topics,languages:["EN"],media_types:o.media_types,visits:o.visits},profile_id:i,auto_save:!0,exclude:!0}}}function f(...e){let t=[];for(let r of e)if(r){if(Array.isArray(r))for(let e of r)"string"==typeof e&&e.trim()&&t.push(e.trim());else if("string"==typeof r)for(let e of r.split(","))e.trim()&&t.push(e.trim())}let r=new Set,s=[];for(let e of t){let t=e.toLowerCase();r.has(t)||(r.add(t),s.push(e))}return s.slice(0,3)}function b(e){if(Array.isArray(e)){let t=e.find(e=>"string"==typeof e&&e.trim());return"string"==typeof t?t.trim():null}return"string"==typeof e&&e.trim()?e.trim():null}e.s(["JOURNO_FILTER_DEFAULT",0,c,"NEWSLETTER_FILTER",0,l,"NEWSLETTER_SUBSCRIBER_OPTIONS",0,u,"OMI_NEWSLETTER_FILTER",0,d,"OMI_SOURCE_KEYS",0,r,"OMI_SOURCE_META",0,m,"PODCAST_FILTER",0,a,"PODCAST_SMART_FIT_CUTOFF",0,6,"PREVIEW_SAMPLE_SIZE",0,10,"buildCountRequest",0,function(e,t,r){if("podcast"===e){let{body:e}=g("podcast",t,r);return{endpoint:"/match/itunes-length",body:{...e,preview:!0},extract:e=>"number"==typeof e?.length?e.length:null}}if("newsletter"===e){let e=r??l;return{endpoint:"/match/search/substack",body:{query_string:t.queryString,filter:{languages:["en"],subscribers:e.subscribers,post_recency_days:e.post_recency_days},page_num:null},extract:e=>e?.matches?.documents?.length??null}}let s=r??c;return{endpoint:"/match/search/article",body:{query_string:t.queryString,profile_id:t.profileId,page_num:0,per_page:60,exclude:!0,filter:{locations:s.locations,topics:s.topics,languages:["EN"],media_types:s.media_types,visits:s.visits},time_range_days:180},extract:e=>"number"==typeof e?.matches?.total_count?e.matches.total_count:e?.matches?.documents?.length??null}},"buildJournoFacetsRequest",0,function(e){return{endpoint:"/match/search/article",body:{query_string:e.queryString,profile_id:e.profileId,page_num:0,per_page:60,exclude:!0,filter:{locations:[],topics:[],languages:["EN"],media_types:[],visits:[]},time_range_days:180}}},"buildJournoFilterFromFacets",0,function(e){let t=e??{},r=(t.media_types??[]).map(e=>e.value),s=(t.visits??[]).map(e=>e.value),n=s.filter(e=>"0-1k"!==e);return{locations:[],topics:[],visits:n.length>0?n:s,media_types:r.filter(e=>"newsletter"!==e.toLowerCase()).filter(e=>!o.includes(e))}},"buildMatcherRequest",0,g,"buildSearchRequest",0,function(e,{teamId:t,campaignId:r,queryString:s,profileId:n},i){let l=m[e].db;if("podcast"===e){let e=i??a;return{endpoint:"/match/search/podcast",body:{query_string:s,filter:{...e,countries:p(e.countries)},page:1,per_page:50,profile_id:n,team_id:t,campaign_id:r,exclude:!0,reranker:!0},normalize:e=>(e?.matches?.hits??[]).map(e=>e?.document).filter(e=>e?.id!=null).map(e=>({entity_id:String(e.id),database:l,target:e.title??"",target_description:e.description??null,target_avatar:e.image_url??null,target_url:null,target_recipient:e.host??null,target_data:"number"==typeof e.est_weekly_downloads?e.est_weekly_downloads:Number(e.est_weekly_downloads)||null,target_total_social_followers:Number(e.total_social_followers)||null,categories:f(e.primary_genre,e.genres),location:b(e.country)??b(e.countries),target_reference:e.episode_description??null,target_reference_title:e.episode_name??null,target_reference_date:e.episode_date??null,h:e.h??null})),extractCount:()=>null}}if("newsletter"===e)return{endpoint:"/match/search/substack",body:{query_string:s,filter:{languages:["en"],subscribers:i?.subscribers??[],post_recency_days:i?.post_recency_days??null},page_num:null},normalize:e=>(e?.matches?.documents??[]).filter(e=>e?.id!=null).map(e=>({entity_id:String(e.id),database:l,target:e.name??"",target_description:e.description??null,target_avatar:e.logo_url??null,target_url:null,target_recipient:e.hostname??null,target_data:null,categories:f(e.categories,e.tags),location:null})),extractCount:e=>Array.isArray(e?.matches?.documents)?e.matches.documents.length:null};let o=i??c;return{endpoint:"/match/search/article",body:{query_string:s,profile_id:n,page_num:0,per_page:60,exclude:!0,filter:{locations:o.locations,topics:o.topics,languages:["EN"],media_types:o.media_types,visits:o.visits},time_range_days:180},normalize:e=>{let t=new Set;return(e?.matches?.documents??[]).filter(e=>{let r=e?.author_id;return!(null==r||t.has(String(r)))&&(t.add(String(r)),!0)}).map(e=>({entity_id:String(e.author_id),database:l,target:e.journalist_name??"",target_description:e.headline??e.outlet_name??null,target_avatar:e.journalist_avatar_url??null,target_url:null,target_recipient:e.outlet_name??null,target_data:null,categories:f(e.topics,e.beats),location:function(e){let t=e?.location;if("string"==typeof t){let e=t.trim();if(!e.startsWith("{"))return e||null;try{t=JSON.parse(e)}catch{return e||null}}let r=t&&"object"==typeof t?t:e,s=[b(r?.cities)??b(r?.city),b(r?.countries)??b(r?.country)].filter(
1Boolean);return s.length?s.join(", "):null}(e),outlet_source_id:null!=e.outlet_id?String(e.outlet_id):null,match_score:"number"==typeof e.similarity?e.similarity:null}))},extractCount:e=>{let t=e?.matches?.retrieval_diagnostics?.unique_author_count;return"number"==typeof t?t:Array.isArray(e?.matches?.documents)?new Set(e.matches.documents.map(e=>e?.author_id).filter(e=>null!=e).map(String)).size:null}}},"getApprovedOmiSources",0,function(e,t,r){return e.filter(e=>"done"===t[e]&&!0===r[e])},"getOmiDraftSource",0,s,"getOmiSources",0,n,"keywordsForSource",0,function(e,t){return(e.matching_blurb_by_source?.[t]??"").trim()||e.matching_blurb||""},"mergeOmiSourceFilters",0,function(e,t){let r=e&&"object"==typeof e&&!Array.isArray(e)?{...e}:{},s=n(r);return delete r.podcast,delete r.journo,delete r.newsletter,r.sources=s,s.includes("podcast")&&t.podcast&&(r.podcast=t.podcast),s.includes("journalist")&&t.journalist&&(r.journo=t.journalist),s.includes("newsletter")&&t.newsletter&&(r.newsletter=t.newsletter),r},"pickPodcastAudience",0,function(e,t,r){let s=e=>r.some(t=>{let r=i[t];return!!r&&e>=r[0]&&e<=r[1]});return e>0&&s(e)?{kind:"listeners",value:e}:t>0&&s(t)?{kind:"followers",value:t}:e>=t?{kind:"listeners",value:e}:{kind:"followers",value:t}},"resolveSubjectDataForDraft",0,function(e,t,r){let n=Array.isArray(e)?e:void 0,a=s(r),i=a&&t&&"object"==typeof t&&!Array.isArray(t)?t:null,l=i?.[a];return Array.isArray(l)&&l.some(e=>e?.is_active!==!1&&"string"==typeof e?.subject&&!!e.subject.trim())?l:n},"unwrapSourceFilter",0,function(e,t){if(!e||"object"!=typeof e)return;let r=e[m[t].filterKey];return r&&"object"==typeof r?r:"sources"in e?void 0:e}])},500152,e=>{"use strict";var t=e.i(95187);let r=(0,t.createServerReference)("704054a4431c583ca2a3a672366e465e5bb53ee266",t.callServer,void 0,t.findSourceMapURL,"updateCampaignSubjectData");e.s(["updateCampaignSubjectData",0,r])},601017,e=>{"use strict";var t=e.i(283599),r=e.i(41931);e.s(["useSubjectStats",0,function(e,s=!0){return(0,t.default)(s&&e?["campaign-subject-stats",String(e)]:null,()=>(0,r.apiRequest)(`/v1/campaign/${encodeURIComponent(String(e))}/subject-stats`),{shouldRetryOnError:!1})}])},578158,e=>{"use strict";var t=e.i(843476),r=e.i(271645),s=e.i(776639),n=e.i(519455),a=e.i(793479),i=e.i(664030),l=e.i(283086),o=e.i(727612),c=e.i(531278),u=e.i(975558),d=e.i(643531),p=e.i(975157),m=e.i(41931),g=e.i(500152),f=e.i(13217),b=e.i(618566),_=e.i(865568),h=e.i(198153),x=e.i(306552),y=e.i(601017),S=e.i(494588),j=e.i(997541),E=e.i(985595);let v={podcast:h.PodcastIcon,journalist:h.JournalistIcon,newsletter:h.NewsletterIcon},R={podcast:"border-purple-200 bg-purple-50 text-purple-700 shadow-sm",journalist:"border-blue-200 bg-blue-50 text-blue-700 shadow-sm",newsletter:"border-orange-200 bg-orange-50 text-orange-700 shadow-sm"},N=({checked:e,onCheckedChange:r})=>(0,t.jsx)("button",{type:"button",role:"switch","aria-checked":e,className:(0,p.cn)("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 cursor-pointer",e?"bg-primary":"bg-input"),onClick:()=>r(!e),children:(0,t.jsx)("span",{className:(0,p.cn)("inline-block h-4 w-4 transform rounded-full bg-background shadow-sm transition-transform",e?"translate-x-[18px]":"translate-x-0.5")})});function T({label:e,value:r}){return(0,t.jsxs)("span",{className:"inline-flex items-baseline gap-1",children:[(0,t.jsx)("span",{className:"font-semibold text-foreground tabular-nums",children:r}),(0,t.jsx)("span",{className:"text-muted-foreground",children:e})]})}function w({status:e}){return"idle"===e?null:"saving"===e?(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,t.jsx)(c.Loader2,{className:"h-3.5 w-3.5 animate-spin"}),"Saving…"]}):"saved"===e?(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,t.jsx)(d.Check,{className:"h-3.5 w-3.5 text-emerald-600"}),"Saved"]}):(0,t.jsx)("span",{className:"inline-flex items-center gap-1.5 text-xs text-destructive",children:"Couldn't save"})}e.s(["SubjectLinesModal",0,function({open:e,onOpenChange:d,subjectLines:h,campaignName:O,campaignId:C,profileBio:A,profileBioBySource:k,matchingBlurb:I,matchingBlurbBySource:U,profileName:P,database:M="podcast",selfPitching:L,perRecipientSubjects:D,onPerRecipientSubjectsChange:F,sources:B,subjectLinesBySource:G,onSubjectLinesChange:q,onSubjectLinesSaved:J}){let H,K,V=(0,b.useRouter)(),W=(0,b.useSearchParams)(),z="linkedin_exa"===M,[$,Y]=(0,r.useState)(!!D),[Z,Q]=(0,r.useState)(!1);(0,r.useEffect)(()=>{Y(!!D)},[D]);let X=z&&$,ee=W.get("tab"),et=B??[],er="omicampaign"===M&&et.length>0,es=er&&et.length>1,en=et.join(","),[ea,ei]=(0,r.useState)(ee&&et.includes(ee)?ee:et[0]??"podcast"),el=er&&G?.[ea]?.length?G[ea]:h,eo=er?_.OMI_SOURCE_META[ea]?.db??"podcast":M,ec=er&&k?.[ea]||A,eu=er&&U?.[ea]||I,[ed,ep]=(0,r.useState)(h),[em,eg]=(0,r.useState)(""),ef=(0,r.useRef)(null),[eb,e_]=(0,r.useState)(!1),[eh,ex]=(0,r.useState)("idle"),ey=(0,r.useRef)(null),eS=(0,r.useRef)(null),ej=(0,r.useRef)(0),eE=(0,r.useRef)(!1),ev=(0,r.useRef)(el);ev.current=el;let eR=(0,r.useRef)(ed),eN=(0,r.useRef)(0),eT=(0,r.useRef)(new Map),ew=e=>{let t=eT.current.get(e);return t||(t=new Set,eT.current.set(e,t)),t},eO=e=>{(0,x.captureEvent)(E.POSTHOG_EVENTS.CAMPAIGN_SUBJECT_LINES_CTA_CLICKED,{[E.CUSTOM_PROPERTIES.BUTTON_NAME]:e,[E.CUSTOM_PROPERTIES.SURFACE]:E.POSTHOG_SURFACES.CAMPAIGN_SUBJECT_LINES_MODAL})};(0,r.useEffect)(()=>
1{if(eN.current+=1,e){eR.current=ev.current,ep(ev.current),eS.current=null,ex("idle");let e=ew(ea);for(let t of ev.current){let r=t.subject.trim();r&&e.add(r)}}},[e,ea]);let eC=(0,r.useCallback)(async e=>{if(!C)return void f.toastUtils.error("Campaign ID is missing");let t=++ej.current;ex("saving");try{let r=await (0,g.updateCampaignSubjectData)(C,e,er?ea:void 0),s=t===ej.current;if(r.success){if(s){eS.current=null,ex("saved"),J?.(e,er?ea:void 0);let t=ew(ea);for(let r of e){let e=r.subject.trim();e&&t.add(e)}let r=er?en.split(",").filter(Boolean):[void 0];Promise.all(r.map(e=>(0,m.apiRequest)(`/v1/campaign/${C}/sync-draft-subjects`,{method:"POST",body:{...e?{source:e}:{},known_subjects:[...t]}}))).then(()=>{V.refresh(),(0,x.captureEvent)(E.POSTHOG_EVENTS.CAMPAIGN_SUBJECT_LINES_DRAFT_SYNC_SUCCEEDED,{[E.CUSTOM_PROPERTIES.CAMPAIGN_ID]:C,[E.CUSTOM_PROPERTIES.SURFACE]:E.POSTHOG_SURFACES.CAMPAIGN_SUBJECT_LINES_MODAL,...er?{[E.CUSTOM_PROPERTIES.SOURCE]:ea}:{}})}).catch(e=>{(0,x.captureEvent)(E.POSTHOG_EVENTS.CAMPAIGN_SUBJECT_LINES_DRAFT_SYNC_FAILED,{[E.CUSTOM_PROPERTIES.CAMPAIGN_ID]:C,[E.CUSTOM_PROPERTIES.SURFACE]:E.POSTHOG_SURFACES.CAMPAIGN_SUBJECT_LINES_MODAL,...er?{[E.CUSTOM_PROPERTIES.SOURCE]:ea}:{},[E.CUSTOM_PROPERTIES.ERROR_MESSAGE]:e instanceof Error?e.message:String(e)}),console.error("Error syncing draft subjects:",e)})}}else s&&ex("error"),f.toastUtils.error(r.error||"Failed to save subject lines")}catch(e){console.error("Error saving subject lines:",e),t===ej.current&&ex("error"),f.toastUtils.error("Error occurred while saving subject lines")}},[C,er,ea,en,J,V]),eA=(0,r.useCallback)(e=>{eE.current=!0,eS.current=e,eR.current=e,ep(e),q?.(e,er?ea:void 0),ex("saving"),ey.current&&clearTimeout(ey.current),ey.current=setTimeout(()=>{ey.current=null;let e=eS.current;e&&eC(e)},600)},[eC,q,er,ea]),ek=(0,r.useCallback)(()=>{ey.current&&(clearTimeout(ey.current),ey.current=null),eS.current&&eC(eS.current)},[eC]);(0,r.useEffect)(()=>{e&&(eE.current=!1)},[e]);let eI=(0,r.useRef)(ek);(0,r.useEffect)(()=>{eI.current=ek},[ek]),(0,r.useEffect)(()=>()=>eI.current(),[]);let eU=(0,r.useCallback)(e=>{e!==ea&&(ek(),ei(e))},[ea,ek]),eP=(0,r.useRef)(eU);(0,r.useEffect)(()=>{eP.current=eU},[eU]),(0,r.useEffect)(()=>{let e=en.split(",").filter(Boolean);er&&!e.includes(ea)&&eP.current(e[0]??"podcast")},[er,en,ea]),(0,r.useEffect)(()=>{if(!e||!er)return;let t=en.split(",").filter(Boolean),r=ee&&t.includes(ee)?ee:t[0];r&&eP.current(r)},[e,er,en,ee]);let{data:eM,error:eL,isLoading:eD}=(0,y.useSubjectStats)(C,e);(0,r.useEffect)(()=>{if(!eM)return;let e=new Map(((er&&eM.subject_data_by_source?.[ea]?.length?eM.subject_data_by_source[ea]:eM.subject_data)??[]).map(e=>[e.subject,e])),t=t=>t.map(t=>{let r=e.get(t.subject);return r?{...t,"Open Rate":r["Open Rate"],"Unfiltered Open Rate":r["Unfiltered Open Rate"],"Reply Rate":r["Reply Rate"],"Total Record":r["Total Record"]}:t});ep(t),eR.current=t(eR.current)},[eM,er,ea]);let eF=ed.filter(e=>!1!==e.is_active).length,eB=!!ec&&!!eu,eG=(H=-1,K=0,ed.forEach((e,t)=>{!1!==e.is_active&&e["Total Record"]>0&&e["Reply Rate"]>K&&(H=t,K=e["Reply Rate"])}),H),eq=(0,S.unsupportedSubjectVariables)(em).length>0||(0,S.isNameOnlySubject)(em),eJ=()=>{let e=em.trim();!e||eq||(eA([...ed,{subject:e,"Open Rate":0,"Reply Rate":0,"Total Record":0,is_active:!0}]),eg(""))},eH=e=>`${(100*e).toFixed(0)}%`,eK=(0,r.useCallback)(async()=>{if(!ec||!eu)return f.toastUtils.error("Add campaign details before generating subject lines"),[];e_(!0);try{let e=Date.now(),t=await (0,m.apiRequest)("/generate-campaign-subjects-and-name",{method:"POST",body:{name:P||"Client",bio:ec,keywords:eu,database:"journo_v2"===eo?"journo_v2":"newsletter"===eo?"newsletter":"podcast",self_pitching:L,variation:e}});return Array.isArray(t.subjects)?t.subjects.filter(e=>"string"==typeof e&&!!e.trim()).map(e=>e.trim()).filter(e=>0===(0,S.unsupportedSubjectVariables)(e).length&&!(0,S.isNameOnlySubject)(e)):[]}catch(e){return console.error("Error generating subject line:",e),f.toastUtils.error("Failed to generate subject line. Please try again."),[]}finally{e_(!1)}},[eo,eu,ec,P,L]),eV=(0,r.useCallback)(async()=>{let e=eN.current,t=await eK();if(0===t.length||e!==eN.current)return;let r=Math.floor(Math.random()*t.length);eg(t[r])},[eK]),eW=(0,r.useCallback)(async()=>{let e=eN.current,t=await eK();0===t.length||e===eN.current&&eA([...eR.current,...t.slice(0,3).map(e=>({subject:e,"Open Rate":0,"Reply Rate":0,"Total Record":0,is_active:!0}))])},[eA,eK]),ez=async e=>{if(C&&!Z){Q(!0),Y(e);try{await (0,m.apiRequest)(`/v1/campaign/${C}/per-recipient-subjects`,{method:"POST",body:{enabled:e}}),(0,x.captureEvent)(E.POSTHOG_EVENTS.CAMPAIGN_SUBJECT_LINES_CTA_CLICKED,{[E.CUSTOM_PROPERTIES.BUTTON_NAME]:E.POSTHOG_BUTTON_NAMES.PER_RECIPIENT_SUBJECTS_TOGGLED,[E.CUSTOM_PROPERTIES.SURFACE]:E.POSTHOG_SURFACES.CAMPAIGN_SUBJECT_LINES_MODAL,[E.CUSTOM_PROPERTIES.CAMPAIGN_ID]:C,enabled:e}),F?.(e),f.toastUtils.success(e?"Each email will get its own subject line":"We will rotate your subject lines across sends"),V.refresh()}catch(t){console.error("Error updating per-recipient subject lines:",t),Y(!e),f.toastUtils.error("Failed to update subject line settings")}finally{Q(!1)}}};return(0,t.jsx)(s.Dialog,{open:e,onOpenChange:e=>
1{!e&&(ek(),eE.current&&(eE.current=!1,V.refresh())),d(e)},children:(0,t.jsxs)(s.DialogContent,{"data-e2e-modal-id":"subject-lines","data-e2e-modal-kind":"core",className:"z-[60] flex max-h-[85vh] w-full max-w-2xl flex-col gap-0 overflow-hidden border-border bg-card p-0 text-card-foreground",onInteractOutside:e=>e.preventDefault(),children:[(0,t.jsxs)(s.DialogHeader,{className:"shrink-0 space-y-1 border-b border-border px-6 pt-6 pb-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,t.jsx)(s.DialogTitle,{className:"text-lg font-semibold text-foreground",children:"Subject lines"}),(0,t.jsx)(w,{status:eh})]}),(0,t.jsxs)(s.DialogDescription,{className:"text-sm text-muted-foreground",children:[O?`${O} \xb7 `:"",X?"Each email gets a subject line written for that person.":"We rotate your active subject lines across sends and surface the one getting the most replies. Changes save automatically."]}),z?(0,t.jsxs)("div",{className:(0,p.cn)("mt-3 flex items-start justify-between gap-4 rounded-xl border p-4",$?"border-primary/30 bg-primary/5":"border-border bg-muted/30"),children:[(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("p",{className:"text-sm font-medium text-foreground",children:"Per-recipient subject lines"}),(0,t.jsx)("p",{className:"mt-1 text-xs leading-relaxed text-muted-foreground",children:$?"On. Every email gets its own subject line, written from that person's profile and your campaign brief. Turn this off to write your own subject lines instead, and we will rotate those across sends.":"Off. We rotate the subject lines below across sends. Turn this on and every email gets its own subject line, written for that person."})]}),(0,t.jsxs)("div",{className:"flex shrink-0 items-center gap-2 pt-0.5",children:[Z?(0,t.jsx)(c.Loader2,{className:"h-4 w-4 animate-spin text-muted-foreground"}):null,(0,t.jsx)(N,{checked:$,onCheckedChange:e=>void ez(e)})]})]}):null,es?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"flex items-center gap-1 rounded-full border bg-muted/40 p-1 w-fit mt-2",children:et.map(e=>{let r=v[e];return(0,t.jsxs)("button",{type:"button",onClick:()=>eU(e),className:(0,p.cn)("flex items-center gap-1.5 whitespace-nowrap rounded-full border border-transparent px-3.5 py-1 text-xs font-medium transition-colors",ea===e?R[e]??"border-border bg-white text-foreground shadow-sm":"text-muted-foreground hover:bg-white/70 hover:text-foreground/70"),children:[r?(0,t.jsx)("span",{"aria-hidden":"true",children:(0,t.jsx)(r,{size:"xs"})}):null,_.OMI_SOURCE_META[e]?.label??e]},e)})}),(0,t.jsx)("div",{className:"mt-1.5 min-h-4",children:G?.[ea]?.length?(0,t.jsxs)("p",{className:"truncate text-xs text-muted-foreground",children:["Subject lines for"," ",_.OMI_SOURCE_META[ea]?.label??ea,". Each source sends with its own set."]}):(0,t.jsxs)("p",{className:"truncate text-xs text-amber-600",children:["Showing the campaign's shared set. Edits here save a"," ",_.OMI_SOURCE_META[ea]?.label??ea,"-only version."]})})]}):null]}),(0,t.jsxs)("div",{inert:X||void 0,className:(0,p.cn)("scrollbar-hide space-y-2 overflow-auto px-6 py-4",er?"h-[320px] flex-shrink-0":"flex-1 min-h-0",X&&"pointer-events-none select-none opacity-50"),children:[eD?(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Loading stats..."}):eL?(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Stats could not be loaded. Rates shown may be out of date."}):null,ed.some(e=>null!=e["Unfiltered Open Rate"])?(0,t.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:"Open rate leaves out pixel requests in the first 60 seconds after sending, which come from mail servers rather than people. Unfiltered open counts every request."}):null,X?(0,t.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:"These are not in use while per-recipient subject lines are on."}):null,0===ed.length?(0,t.jsx)("div",{className:"flex flex-col items-center justify-center rounded-xl border border-dashed border-border py-12 text-center",children:eb?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(c.Loader2,{className:"h-5 w-5 animate-spin text-primary"}),(0,t.jsx)("p",{className:"mt-3 text-sm font-medium text-foreground",children:"Writing subject line suggestions"})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"text-sm font-medium text-foreground",children:"No subject lines yet"}),(0,t.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:"Add one below or generate suggestions to start testing."}),eB?(0,t.jsxs)(n.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>void eW(),className:"mt-4 gap-2","data-testid":"subject-lines-suggest",children:[(0,t.jsx)(l.Sparkles,{className:"h-4 w-4","aria-hidden":!0}),"Suggest subject lines"]}):null]})}):ed.map((e,r)=>{let s=!1!==e.is_active,n=e["Total Record"]>0;return(0,t.jsxs)("div",{className:(0,p.cn)("group flex items-start gap-3 rounded-xl border p-4 transition-colors",s?"border-border bg-card":"border-border/60 bg-muted/30"),children:[(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("p",{className:(0,p.cn)("text-sm font-medium leading-snug",s?"text-foreground":"text-muted-foreground line-through decoration-muted-foreground
1/40"),children:(0,t.jsx)(j.SubjectLineText,{subject:e.subject})}),r===eG&&(0,t.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-amber-100 px-2 py-0.5 text-[10px] font-semibold text-amber-700",children:[(0,t.jsx)(i.Trophy,{className:"h-3 w-3"}),"Top"]})]}),(0,t.jsx)(j.SubjectVariablePreview,{subject:e.subject,showWithoutName:!1,className:"mt-1"}),(0,t.jsx)("div",{className:"mt-2 flex flex-wrap items-center gap-x-4 gap-y-1 text-xs",children:n?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(T,{label:"open",value:eH(e["Open Rate"])}),null!=e["Unfiltered Open Rate"]?(0,t.jsx)(T,{label:"unfiltered open",value:eH(e["Unfiltered Open Rate"])}):null,(0,t.jsx)(T,{label:"reply",value:eH(e["Reply Rate"])}),(0,t.jsx)(T,{label:"sent",value:e["Total Record"].toLocaleString()})]}):(0,t.jsx)("span",{className:"text-muted-foreground",children:"Not sent yet"})})]}),(0,t.jsxs)("div",{className:"flex shrink-0 items-center gap-3 pt-0.5",children:[(0,t.jsx)(N,{checked:s,onCheckedChange:()=>{!1!==ed[r].is_active&&eF<=1?f.toastUtils.error("Keep at least one subject line active"):eA(ed.map((e,t)=>t===r?{...e,is_active:!1===e.is_active}:e))}}),(0,t.jsx)("button",{type:"button",onClick:()=>{let e,t;return e=!1!==ed[r].is_active,t=ed.length>1,void(e&&eF<=1&&t?f.toastUtils.error("Keep at least one subject line active"):eA(ed.filter((e,t)=>t!==r)))},"aria-label":"Remove subject line",className:"rounded-md p-1 text-muted-foreground/60 opacity-0 transition-all hover:bg-destructive/10 hover:text-destructive focus-visible:opacity-100 group-hover:opacity-100 cursor-pointer",children:(0,t.jsx)(o.Trash2,{className:"h-4 w-4"})})]})]},r)})]}),(0,t.jsxs)("div",{inert:X||void 0,className:(0,p.cn)("shrink-0 border-t border-border px-6 py-4",X&&"pointer-events-none select-none opacity-50"),children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 rounded-xl border border-border bg-background pl-3 pr-2 focus-within:ring-1 focus-within:ring-ring",children:[(0,t.jsx)(a.Input,{ref:ef,value:em,onChange:e=>eg(e.target.value),placeholder:"Write a new subject line…",className:"h-10 flex-1 border-0 bg-transparent px-0 shadow-none focus-visible:ring-0",onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),eJ())}}),eB&&(0,t.jsxs)(n.Button,{type:"button",variant:"ghost",size:"sm",onClick:()=>void eV(),disabled:eb,className:"h-8 gap-1.5 px-2 text-muted-foreground hover:text-foreground",title:"Generate a subject line with AI","data-testid":"subject-lines-suggest-one",children:[eb?(0,t.jsx)(c.Loader2,{className:"h-4 w-4 animate-spin"}):(0,t.jsx)(l.Sparkles,{className:"h-4 w-4"}),"Suggest"]}),(0,t.jsx)(n.Button,{type:"button",size:"sm",onClick:()=>{eO(E.POSTHOG_BUTTON_NAMES.ADD_ANOTHER_SUBJECT_LINE),eJ()},disabled:!em.trim()||eq,className:"h-8 w-8 p-0","aria-label":"Add subject line",children:(0,t.jsx)(u.ArrowUp,{className:"h-4 w-4"})})]}),(0,t.jsx)(j.SubjectVariableToolbar,{className:"mt-2",subject:em,onInsert:e=>{let t=ef.current,r=(0,S.subjectInsertSelection)(t),{value:s,cursor:n}=(0,S.insertSubjectVariable)(em,e,r.start,r.end);eg(s),eO(E.POSTHOG_BUTTON_NAMES.INSERT_SUBJECT_VARIABLE),requestAnimationFrame(()=>{t?.focus(),t?.setSelectionRange(n,n)})}}),(0,t.jsx)(j.SubjectVariablePreview,{subject:em,className:"mt-2"}),(0,t.jsx)(j.UnsupportedSubjectVariablesHint,{subject:em,className:"mt-2"}),(0,t.jsxs)("p",{className:"mt-2 text-xs text-muted-foreground",children:[eF," active · ",ed.length," total"]})]})]})})}])}]);
2
3//# sourceMappingURL=0kr-r24rjo1yl.js.map
4//# chunkId=01a0ea2e-d568-78c0-b3cc-15b3b99522e4

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.