PageSourceSearch

https://www.creatorspotlight.com/assets/translations-BSW24LjB.js

js creatorspotlight.com collected 2026-10-02 03:43:03 UTC 22,527 bytes, 5 lines download raw bytes

1
2!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._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="0ec18c5f-0d22-514e-93d9-47f2253971bb")}catch(e){}}();
3import{s as e,t}from"./jsx-runtime-D4ePz0Hl.js";import{t as n}from"./react-BXH-GOAS.js";import{D as r,f as i,l as a}from"./components-CDo3yjgw.js";import{t as o}from"./useTranslation-xRzBcOIb.js";import{t as s}from"./classnames-B9Sa-P4w.js";import{r as c}from"./dist-DaRpaGs2.js";import{t as l}from"./useGlobalModals-CJ1k8aJl.js";import{a as u,o as d,r as f,s as p,t as m,u as h}from"./ActionForm-ubtCpxTm.js";import{r as g}from"./utils-uQT3RJQj.js";import{t as _}from"./StatusInputs-D5MCvfKS.js";import{t as v}from"./useComponentFetcher-Blqq76Zc.js";var y=e(n(),1),b=e(s(),1),x=typeof navigator>`u`?!1:/Instagram/.test(navigator.userAgent),S=[];for(let e=0;e<256;++e)S.push((e+256).toString(16).slice(1));function C(e,t=0){return(S[e[t+0]]+S[e[t+1]]+S[e[t+2]]+S[e[t+3]]+`-`+S[e[t+4]]+S[e[t+5]]+`-`+S[e[t+6]]+S[e[t+7]]+`-`+S[e[t+8]]+S[e[t+9]]+`-`+S[e[t+10]]+S[e[t+11]]+S[e[t+12]]+S[e[t+13]]+S[e[t+14]]+S[e[t+15]]).toLowerCase()}var w,T=new Uint8Array(16);function E(){if(!w){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);w=crypto.getRandomValues.bind(crypto)}return w(T)}var D={randomUUID:typeof crypto<`u`&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function O(e,t,n){e||={};let r=e.random??e.rng?.()??E();if(r.length<16)throw Error(`Random bytes length must be >= 16`);if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n||=0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return C(r)}function k(e,t,n){return D.randomUUID&&!t&&!e?D.randomUUID():O(e,t,n)}var A=e(t(),1),j=({isOpen:e,className:t,onClose:n})=>{let[r,i]=(0,y.useState)(``),a=(0,y.useRef)(null),o=(0,y.useRef)(null);return(0,y.useEffect)(()=>{e&&o.current&&o.current.focus()},[e]),(0,y.useEffect)(()=>{if(!a.current)return;let e=new IntersectionObserver(([e])=>e.intersectionRatio<1&&n(),{threshold:[1]});return e.observe(a.current),()=>e.disconnect()},[n]),p({isOpen:e,onClose:n,contentRef:a,shouldCloseOnOutsideClick:!0,shouldDisableScroll:!0}),(0,A.jsxs)(`div`,{ref:a,className:(0,b.default)(`absolute p-4 rounded-lg bg-[var(--site-theme-background-color,#ffffff)] border border-[var(--site-theme-border-color,#e5e7eb)] z-[999]`,!e&&`hidden`,t),children:[(0,A.jsx)(`input`,{ref:o,type:`email`,name:`email`,value:r,autoComplete:`email`,onChange:e=>i(e.target.value),placeholder:`Email`,className:`border border-[var(--site-theme-border-color,#e5e7eb)] focus:border-[var(--site-theme-primary-color,#030712)] rounded w-full mb-2`}),(0,A.jsx)(`button`,{type:`submit`,onClick:n,className:(0,b.default)(`px-4 py-2 rounded-[var(--site-theme-border-radius,6px)] bg-[var(--site-theme-primary-color,#030712)] text-[var(--site-theme-background-color,#ffffff)] font-medium text-center block w-full`),style:{fontFamily:`var(--site-theme-button-font)`},children:`Subscribe`})]})},M=({email:e,recommendation:t,submittedIds:n,isLoading:r,translations:i,variant:a=`outline`})=>{let o=(0,y.useMemo)(()=>n.includes(t.id),[n,t.id]),[s,c]=(0,y.useState)(!1);return(0,A.jsxs)(`div`,{className:`relative`,children:[(0,A.jsx)(`button`,{type:e?`submit`:`button`,onClick:t=>{e||(t.preventDefault(),c(!0))},className:(0,b.default)(`px-2 py-1 rounded-[var(--site-theme-border-radius,6px)] border border-[var(--site-theme-primary-color,#030712)] font-medium flex gap-2 items-center`,a===`solid`?`bg-[var(--site-theme-primary-color,#030712)] text-[var(--site-theme-background-color,#ffffff)]`:`bg-[var(--site-theme-background-color,#ffffff)] text-[var(--site-theme-primary-color,#030712)]`,o?`opacity-30 cursor-not-allowed`:`hover:opacity-80`,r&&`cursor-wait`),style:{fontFamily:`var(--site-theme-button-font)`},disabled:o||r,children:o?i?.[`recommendations.modal.subscribed`]||`Subscribed`:r?i?.[`recommendations.modal.subscribing`]||`Subscribing...`:i?.[`recommendations.modal.subscribe`]||`Subscribe`}),(0,A.jsx)(j,{isOpen:s,onClose:()=>c(!1),className:`w-72 -top-3 -right-2`})]})},N=({recommendation:e,submittedIds:t,translations:n,onSubmitSuccess:r,SubscribeForm:i})=>(0,A.jsxs)(`div`,{className:`p-4 rounded-[var(--site-theme-border-radius,6px)] border border-[var(--site-theme-border-color,#e5e7eb)] bg-[var(--site-theme-background-color,#ffffff)] flex flex-col gap-2`,children:[(0,A.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,A.jsxs)(`div`,{className:`flex justify-between items-start`,children:[(0,A.jsx)(`img`,{src:e.logo_url,alt:`${e.name}-logo`,className:`w-[56px] h-[56px] rounded grow-0`}),(0,A.jsx)(i,{recommendations:[e],triggerSource:`individual_card_button`,onSubmitSuccess:()=>r?.([e]),children:({isLoading:r,email:i})=>(0,A.jsx)(M,{recommendation:e,isLoading:r,email:i,submittedIds:t,translations:n})})]}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-1`,style:{fontFamily:`var(--site-theme-header-font)`},children:[e.sponsored&&(0,A.jsx)(`p`,{className:`text-xs font-medium text-[var(--site-theme-text-on-background-color,#222222)] opacity-60`,children:n?.[`recommendations.modal.sponsored`]||`Sponsored`}),(0,A.jsx)(`h3`,{className:`text-lg font-semibold text-[var(--site-theme-text-on-background-color,#222222)] leading-snug line-clamp-2`,children:e.name}),e.publisher_name&&(0,A.jsx)(`p`,{className:`text-sm font-normal text-[var(--site-theme-text-on-background-color,#222222)] opacity-60`,children:`${n?.[`recommendations.modal.by`]||`by`} ${e.publisher_name}`})]})]}),!!e.badge&&(0,A.jsx)(`span`,{className:`shadow-xs inline-flex items-center text-xs font-medium relative group rounded bg-indigo-100 text-indigo-900 border-indigo-200 border px-1.5 py-0.5 gap-x-1 w-max`,children:(0,A.jsx)(`span`,{className:`w-full block overflow-hidden whitespace-nowrap text-ellipsis`,children:e.badge})}),(0,A.jsx)(`p`,{className:`text-base font-normal text-[var(--site-theme-text-on-background-color,#222222)] opacity-60 line-clamp-2`,style:{fontFamily:`var(--site-theme-body-font)`},children:e.description})]},e.id),P=({isDisabled:e=!1,hasSubmitted:t=!1,onClick:n,translations:r})=>{let i=t?r?.[`recommendations.modal.next`]||`Next`:r?.[`recommendations.modal.skip`]||`Skip`;return(0,A.jsx)(`button`,{type:`button`,onClick:n,disabled:e,className:(0,b.default)(`px-4 py-1 rounded-[var(--site-theme-border-radius,6px)] bg-transparent text-[var(--site-theme-text-on-background-color,#222222)] font-medium justify-center items-center duration-300`,e?`opacity-30 curs
3or-not-allowed`:`opacity-50 hover:opacity-80`),style:{fontFamily:`var(--site-theme-button-font)`},children:i})},F=({isLoading:e=!1,isDisabled:t=!1,email:n,translations:r})=>{let[i,a]=(0,y.useState)(!1);return(0,A.jsxs)(`div`,{className:`relative`,children:[(0,A.jsxs)(`button`,{type:`submit`,onClick:e=>{t||n||(e.preventDefault(),a(!0))},disabled:e||t,className:(0,b.default)(`px-4 py-3 rounded-[var(--site-theme-border-radius,6px)] bg-[var(--site-theme-primary-color,#030712)] text-[var(--site-theme-background-color,#ffffff)] font-medium flex gap-2 items-center justify-center w-full duration-300`,e||t?`opacity-30 cursor-not-allowed`:`hover:opacity-80`),style:{fontFamily:`var(--site-theme-button-font)`},children:[r?.[`recommendations.modal.subscribe_to_all`]||`Subscribe to all`,e&&(0,A.jsx)(`div`,{className:`animate-spin w-4 h-4 border-2 border-transparent border-r-[var(--site-theme-primary-color,#030712)] rounded-full`})]}),(0,A.jsx)(j,{isOpen:i,onClose:()=>a(!1),className:`w-full inset-x-0 -top-4`})]})},I=({recommendation:e,submittedIds:t,translations:n,onSubmitSuccess:r,SubscribeForm:i})=>(0,A.jsxs)(`div`,{className:`p-4 rounded-[var(--site-theme-border-radius,6px)] border border-[var(--site-theme-border-color,#e5e7eb)] bg-[var(--site-theme-background-color,#ffffff)] flex flex-col gap-2`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,A.jsx)(`img`,{src:e.logo_url,alt:`${e.name}-logo`,className:`w-8 h-8 rounded grow-0 shrink-0 object-cover`}),(0,A.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,A.jsx)(`h3`,{className:`truncate text-sm font-semibold text-[var(--site-theme-text-on-background-color,#222222)]`,style:{fontFamily:`var(--site-theme-header-font)`},children:e.name}),e.publisher_name&&(0,A.jsx)(`p`,{className:`truncate text-xs font-normal text-[var(--site-theme-text-on-background-color,#222222)] opacity-60`,style:{fontFamily:`var(--site-theme-body-font)`},children:`${n?.[`recommendations.modal.by`]||`by`} ${e.publisher_name}`})]}),(0,A.jsx)(`div`,{className:`shrink-0`,children:(0,A.jsx)(i,{recommendations:[e],triggerSource:`individual_card_button`,onSubmitSuccess:()=>r?.([e]),children:({isLoading:r,email:i})=>(0,A.jsx)(M,{recommendation:e,isLoading:r,email:i,submittedIds:t,translations:n,variant:`solid`})})})]}),e.sponsored&&(0,A.jsx)(`p`,{className:`text-xs font-medium text-[var(--site-theme-text-on-background-color,#222222)] opacity-60`,children:n?.[`recommendations.modal.sponsored`]||`Sponsored`}),!!e.badge&&(0,A.jsx)(`span`,{className:`shadow-xs inline-flex items-center text-xs font-medium rounded bg-indigo-100 text-indigo-900 border-indigo-200 border px-1.5 py-0.5 gap-x-1 w-max`,children:(0,A.jsx)(`span`,{className:`w-full block overflow-hidden whitespace-nowrap text-ellipsis`,children:e.badge})}),e.description&&(0,A.jsx)(`p`,{className:`text-xs font-normal text-[var(--site-theme-text-on-background-color,#222222)] opacity-60 line-clamp-2`,style:{fontFamily:`var(--site-theme-body-font)`},children:e.description})]}),L=`_17w2l0i0`,R=`_17w2l0i1`,z=()=>(0,A.jsx)(`div`,{className:`p-4 rounded-[var(--site-theme-border-radius,6px)] border border-[var(--site-theme-border-color,#e5e7eb)] bg-[var(--site-theme-background-color,#ffffff)] flex flex-col gap-2 opacity-20`,children:(0,A.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,A.jsxs)(`div`,{className:`flex justify-between items-start`,children:[(0,A.jsx)(`div`,{className:`w-[56px] h-[56px] rounded bg-[var(--site-theme-border-color,#e5e7eb)] animate-pulse`}),(0,A.jsx)(`div`,{className:`px-4 py-2 rounded-[var(--site-theme-border-radius,6px)] bg-[var(--site-theme-border-color,#e5e7eb)] animate-pulse w-20 h-8`})]}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,A.jsx)(`div`,{className:`h-4 bg-[var(--site-theme-border-color,#e5e7eb)] animate-pulse rounded w-32`}),(0,A.jsx)(`div`,{className:`h-5 bg-[var(--site-theme-border-color,#e5e7eb)] animate-pulse rounded w-48`}),(0,A.jsx)(`div`,{className:`h-4 bg-[var(--site-theme-border-color,#e5e7eb)] animate-pulse rounded w-full`}),(0,A.jsx)(`div`,{className:`h-4 bg-[var(--site-theme-border-color,#e5e7eb)] animate-pulse rounded w-3/4`})]})]})}),B=()=>(0,A.jsxs)(`div`,{className:`p-4 rounded-[var(--site-theme-border-radius,6px)] border border-[var(--site-theme-border-color,#e5e7eb)] bg-[var(--site-theme-background-color,#ffffff)] flex flex-col gap-2 opacity-20`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,A.jsx)(`div`,{className:`w-8 h-8 rounded bg-[var(--site-theme-border-color,#e5e7eb)] animate-pulse shrink-0`}),(0,A.jsx)(`div`,{className:`h-4 bg-[var(--site-theme-border-color,#e5e7eb)] animate-pulse rounded flex-1`}),(0,A.jsx)(`div`,{className:`h-7 w-20 bg-[var(--site-theme-border-color,#e5e7eb)] animate-pulse rounded-[var(--site-theme-border-radius,6px)] shrink-0`})]}),(0,A.jsx)(`div`,{className:`h-4 bg-[var(--site-theme-border-color,#e5e7eb)] animate-pulse rounded w-full`}),(0,A.jsx)(`div`,{className:`h-4 bg-[var(--site-theme-border-color,#e5e7eb)] animate-pulse rounded w-3/4`})]});function V(e){let{email:t,theme:n,isLoading:r=!0,isOpen:i=!1,v3Layout:a=!1,recommendations:o=[],submittedIds:s=[],translations:c,onOpenChange:l,onSubmitSuccess:u,SubscribeForm:f}=e;if((0,y.useEffect)(()=>
3{if(!i)return;let e=window.getComputedStyle(document.body),t=e.overflow,n=e.position,r=e.height,a=e.touchAction;return document.body.style.overflow=`hidden`,document.body.style.position=`fixed`,document.body.style.height=`100%`,document.body.style.width=`100%`,document.body.style.touchAction=`none`,document.documentElement.style.overflow=`hidden`,()=>{document.body.style.overflow=t,document.body.style.position=n,document.body.style.height=r,document.body.style.touchAction=a,document.documentElement.style.overflow=``}},[i]),a)return(0,A.jsx)(d,{isOpen:i,onClose:l,style:{"--overlay-background-color":`#00000050`,"--modal-close-button-color":`inherit`},showRoundedBorders:!1,className:`shadow-lg rounded-[var(--site-theme-border-radius,6px)]`,placement:`center`,mobilePlacement:`center`,showCloseButton:!1,overlayClassName:`!z-[999]`,shouldDisableScroll:!1,children:(0,A.jsxs)(`div`,{className:`flex flex-col gap-4 p-6 w-full md:w-[400px] border border-[var(--site-theme-border-color,#e5e7eb)] rounded-[var(--site-theme-border-radius,6px)] bg-[var(--site-theme-background-color,#ffffff)]`,style:n?g(n):void 0,"data-recommendations-modal":!0,children:[(0,A.jsxs)(`div`,{className:`flex justify-between gap-2 items-start`,children:[(0,A.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,A.jsx)(`h1`,{className:`text-[var(--site-theme-text-on-background-color,#222222)] text-base font-semibold`,style:{fontFamily:`var(--site-theme-header-font)`},children:t?c?.[`recommendations.modal.thank_you_title`]||`Thank you for subscribing!`:c?.[`recommendations.modal.recommended_title`]||`Recommended for you`}),(0,A.jsx)(`h2`,{className:`text-[var(--site-theme-text-on-background-color,#222222)] text-xs font-normal opacity-60`,style:{fontFamily:`var(--site-theme-body-font)`},children:t?c?.[`recommendations.modal.thank_you_subtitle`]||`We also recommend these newsletters`:c?.[`recommendations.modal.recommended_subtitle`]||`We think you'll like these other newsletters`})]}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>l(!1),className:`text-[var(--site-theme-text-on-background-color,#222222)] p-1 -mr-1 -mt-1 opacity-60 hover:opacity-80 flex-shrink-0`,children:(0,A.jsx)(h,{className:`h-4 w-4`})})]}),(0,A.jsx)(`div`,{className:`flex flex-col gap-3 overflow-y-auto`,style:{maxHeight:`min(60dvh, 520px)`,WebkitOverflowScrolling:`touch`},children:r?Array.from({length:4}).map((e,t)=>(0,A.jsx)(B,{},t)):o.map(e=>(0,A.jsx)(I,{email:t,recommendation:e,submittedIds:s,translations:c,onSubmitSuccess:u,SubscribeForm:f},e.id))}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,A.jsx)(f,{recommendations:o,triggerSource:`subscribe_all_button`,onSubmitSuccess:()=>u?.(o),children:({isLoading:e,email:t})=>(0,A.jsx)(F,{isLoading:e,isDisabled:r,email:t,translations:c})}),(0,A.jsx)(P,{isDisabled:r,hasSubmitted:s.length>0,onClick:()=>l(!1),translations:c})]})]})});let p=(0,A.jsxs)(`div`,{className:(0,b.default)(`flex flex-col h-full`),"data-recommendations-modal":!0,children:[(0,A.jsxs)(`div`,{className:`flex justify-between gap-2 items-start p-6 pb-4 flex-shrink-0`,children:[(0,A.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,A.jsx)(`h1`,{className:`text-[var(--site-theme-text-on-background-color,#222222)] text-xl font-semibold`,style:{fontFamily:`var(--site-theme-header-font)`},children:t?c?.[`recommendations.modal.thank_you_title`]||`Thank you for subscribing!`:c?.[`recommendations.modal.recommended_title`]||`Recommended for you`}),(0,A.jsx)(`h2`,{className:`text-[var(--site-theme-text-on-background-color,#222222)] text-sm font-normal opacity-60`,style:{fontFamily:`var(--site-theme-body-font)`},children:t?c?.[`recommendations.modal.thank_you_subtitle`]||`We also recommend these newsletters`:c?.[`recommendations.modal.recommended_subtitle`]||`We think you'll like these other newsletters`})]}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>l(!1),className:`text-[var(--site-theme-text-on-background-color,#222222)] p-2 -mr-2 -mt-2 opacity-60 hover:opacity-80 flex-shrink-0`,children:(0,A.jsx)(h,{className:`h-4 w-4`})})]}),(0,A.jsx)(`div`,{className:`flex-1 overflow-y-auto px-6`,style:{WebkitOverflowScrolling:`touch`},children:r?(0,A.jsx)(`div`,{className:`flex flex-col gap-4 pb-4`,children:Array.from({length:4}).map((e,t)=>(0,A.jsx)(z,{},t))}):(0,A.jsx)(`div`,{className:`flex flex-col gap-4 pb-4`,children:o.map(e=>(0,A.jsx)(N,{email:t,recommendation:e,submittedIds:s,translations:c,onSubmitSuccess:u,SubscribeForm:f},e.id))})}),(0,A.jsxs)(`div`,{className:(0,b.default)(`flex-shrink-0 border-t border-[var(--site-theme-border-color,#e5e7eb)] bg-[var(--site-theme-background-color,#ffffff)] p-6`,`flex flex-col gap-2`),style:{position:`sticky`,bottom:0,zIndex:10,paddingBottom:x?`7rem`:`max(1.5rem, env(safe-area-inset-bottom))`},children:[(0,A.jsx)(f,{recommendations:o,triggerSource:`subscribe_all_button`,onSubmitSuccess:()=>u?.(o),children:({isLoading:e,email:t})=>(0,A.jsx)(F,{isLoading:e,isDisabled:r,email:t,translations:c})}),(0,A.jsx)(P,{isDisabled:r,hasSubmitted:s.length>0,onClick:()=>l(!1),translations:c})]})]});return(0,A.jsx)(d,{isOpen:i,onClose:l,style:{"--overlay-background-color":`#00000050`,"--modal-close-button-color":`inherit`,"--modal-close-button-placement-top":`24px`,"--modal-close-button-placement-right":`24px`,he
3ight:`100dvh`,bottom:`auto`},showRoundedBorders:!1,className:`shadow-lg rounded-[var(--site-theme-border-radius,6px)]`,mobilePlacement:`bottom`,showCloseButton:!1,overlayClassName:`!z-[999]`,shouldDisableScroll:!1,children:(0,A.jsx)(`div`,{className:(0,b.default)(L,R),style:{...n?{...g(n)}:{},"--width":`640px`,"--maxWidth":`640px`,height:`min(90dvh, 800px)`,maxHeight:`90dvh`},children:p})})}var H=()=>{let e=a();return(0,y.useEffect)(()=>{e.load(`/recommendations_data?index`)},[]),e?.data||{recommendations:[],boostedRecommendations:[],isLoading:!0}};async function U(e,t,n){if(!e.length||!t||!n)return;let r=e.map(e=>({id:e.id,description:e.description??null,impression_token:e.impression_token,slot_position:e.slot_position})).filter(e=>e.id&&e.impression_token);r.length&&await fetch(`/recommendations_impressions`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({slots:r,subscriber_id:t,subscription_uuid:n})})}var W=4,G=6,K=(e,t)=>{let n=e[t];if(n)return n;let r=k();return e[t]=r,r},q=(e,t)=>({id:e.id,impression_token:K(t,e.id),name:e.publication?.name??``,publisher_name:e.publication?.publisher_name??null,description:e.publication?.description??``,logo_url:e.publication?.thumbnail_image_url??``,site_url:e.publication?.site_url??``,sponsored:e.boosted??!1,recommended_publication_id:e.recommended_publication_id??null,isOwner:!1,badge:e.badge}),J=({onOpenChange:e,networkUiEnabled:t=!1,isOpen:n,children:i})=>{let[a]=f(),{isLoading:o,recommendations:s,boostedRecommendations:c,slotsEnabled:u,slots:d}=H(),[p,m]=(0,y.useState)([]),{currentModal:h}=l(),g=n??h===`recommendations`,[_]=r(),v=_.get(`subscriber_id`)??void 0,b=_.get(`sid`)??void 0,x=(0,y.useRef)(!1),S=(0,y.useRef)({}),C=(0,y.useMemo)(()=>{let e=Array.isArray(s)?s:[],n=Array.isArray(c)?c:[],r=u&&Array.isArray(d)?d:[];return r.length>0?r.map(({slot_position:e,recommendation:t})=>({...q(t,S.current),slot_position:e})):(t?[...n,...e].slice(0,W):e.slice(0,4).reverse().concat([...n].reverse()).slice(0,G).reverse()).map(e=>q(e,S.current))},[s,c,t,u,d]);return(0,y.useEffect)(()=>{let t=C.length===0,n=new Set(p).size===C.length;g&&!o&&(t||n)&&e(!1)}),(0,y.useEffect)(()=>{g&&!o&&C.length>0&&!x.current&&(x.current=!0,U(C,v,b).catch(()=>null)),g||(x.current=!1)},[g,o,C,v,b]),i({email:a,isOpen:g,isLoading:o,recommendations:C,submittedIds:p,onSubmitSuccess:e=>{m(t=>[...t,...e.map(e=>e.id)])}})};async function Y(e,t,n,r,i){if(!e.length||!t||!n)return;let a=e.map(e=>({id:e.id,impression_token:e.impression_token})).filter(e=>e.id&&e.impression_token);a.length&&await fetch(`/recommendations_clicks`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({clicks:a,subscriber_id:t,subscription_uuid:n,target_action:r,trigger_source:i})})}var X=({fetcher:e})=>{let[t,n]=r(),[,i]=f();return{handleSubmit:r=>{let a=(r.get(`email`)||``)?.toString().trim();return r.set(`is_js_enabled`,`true`),r.set(`email`,a),a?(i(a),t.set(`email`,a),n(t,{replace:!0}),e.submit(r,{method:`post`,action:`/recommendations_subscribe_form`}),!0):(c.error(`Please enter a valid email address`),!1)}}},Z=({recommendations:e,triggerSource:t=`individual_card_button`,children:n,onSubmitSuccess:a})=>{let{t:s}=o(),[l]=f(),d=v(),{publication:p}=i(`root`),{visitToken:h,referralId:g,setCookie:b}=u(),[x]=r(),S=x.get(`subscriber_id`)??void 0,C=x.get(`sid`)??void 0,w=x.get(`recommendation_widget_id`)??void 0,T=(0,y.useRef)(null),{handleSubmit:E}=X({fetcher:d}),D=()=>{b({name:`email_capture_disabled`,value:`true`,days:30}),c.success(s(`notifications.subscribe.subscribed`)),a?.(e),T.current?.reset()},O=e=>{c.success(e?.response?.data?.error||s(`errors.default`))},k=d.state===`submitting`;return(0,A.jsxs)(m,{fetcher:d,formRef:T,method:`post`,action:`/recommendations_subscribe_form`,onSubmit:n=>{let r=new FormData(n.currentTarget);Y(e,S,C,`subscribe`,t).catch(()=>null),E(r)},onSuccess:D,onError:O,children:[(0,A.jsx)(_,{name:`recommendations`,errorMessage:s(`errors.default`),successMessage:``}),g&&(0,A.jsx)(`input`,{hidden:!0,name:`ref`,defaultValue:g}),h&&(0,A.jsx)(`input`,{hidden:!0,name:`visit_token`,defaultValue:h}),(0,A.jsx)(`input`,{hidden:!0,name:`publication_id`,defaultValue:p.id}),w&&(0,A.jsx)(`input`,{hidden:!0,name:`recommendation_widget_id`,defaultValue:w}),l&&(0,A.jsx)(`input`,{hidden:!0,name:`email`,defaultValue:l}),(0,A.jsx)(`input`,{name:`sent_from_orchid`,type:`hidden`,defaultValue:`true`}),(0,A.jsx)(`input`,{name:`include_current_publication`,type:`hidden`,defaultValue:`false`}),e.map(e=>(0,A.jsx)(`input`,{hidden:!0,name:`recommendation_ids[]`,defaultValue:e.id},e.id)),n({isLoading:k,email:l})]})},Q=[`recommendations.modal.thank_you_title`,`recommendations.modal.recommended_title`,`recommendations.modal.thank_you_subtitle`,`recommendations.modal.recommended_subtitle`,`recommendations.modal.next`,`recommendations.modal.skip`,`recommendations.modal.subscribe_to_all`,`recommendations.modal.subscribe`,`recommendations.modal.subscribed`,`recommendations.modal.subscribing`,`recommendations.modal.sponsored`],$=e=>Object.fromEntries(Q.map(t=>[t,e(t)]));export{k as a,V as i,Z as n,J as r,$ as t};
4//# sourceMappingURL=translations-BSW24LjB.js.map
5//# debugId=0ec18c5f-0d22-514e-93d9-47f2253971bb

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.