1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1907],{51907:function(e,t,r){r.r(t),r.d(t,{default:function(){return G}});var n=r(57437),s=r(16463),i=r(2265),a=r(29893),c=r(99533),o=r(64678),u=r(88726),l=r(81056),d=r(61379),b=r(2478);let m=e=>{let{newsletterState:t,newsletterName:r,title:s,setMessage:i,setNewslettersState:a,setSubscriptionChanges:c,reader:o,routeName:u,newsletterDescriptionsStyles:m}=e,p=(e,t)=>{i(""),c(r=>t?{subscribes:r.subscribes.filter(t=>t!=e),unsubscribes:o["".concat(e,"_subscribed")]?Array.from(new Set([...r.unsubscribes,e])):r.unsubscribes}:{subscribes:o["".concat(e,"_subscribed")]?r.subscribes:Array.from(new Set([...r.subscribes,e])),unsubscribes:r.unsubscribes.filter(t=>t!=e)}),a(t=>({...t,[e]:!t[e]}))},[f,g]=s.split(" - ");return(0,n.jsxs)("div",{className:"msf-card mb-3 min-h-[70px] w-full bg-zinc-900 max-w-[420px] py-3 px-4 rounded-lg flex items-center justify-between",children:[(0,n.jsxs)("div",{className:(0,b.cn)("flex flex-col w-4/5"),children:[(0,n.jsx)("span",{className:(0,b.cn)("text-sm",null==m?void 0:m.titleStyling),children:f}),!u.includes("/manage")&&(0,n.jsx)("span",{className:(0,b.cn)("text-base leading-[1.2rem] text-zinc-300",null==m?void 0:m.descriptionStyling),children:g})]}),(0,n.jsx)(l.r,{checked:!!t,onChange:()=>p(r,t),"data-testid":"newsletter-switch-".concat(r),className:(0,b.cn)("h-[28px] w-[43px] items-center rounded-full",t?"bg-gray-200":"bg-gray-400"),children:(0,n.jsx)("span",{className:(0,b.cn)("h-[24px] w-[24px] transform rounded-full transition flex items-center justify-center",t?"translate-x-4 bg-purple-900":"translate-x-0.5 bg-gray-100"),children:(0,n.jsx)(d.bzc,{size:10.5,className:(0,b.cn)("font-bold",t?"opacity-1":"opacity-0")})})})]})};r(74590);var p=(0,r(58064).$)("e0f9488e210fcdc318ed039c29399b70552fc5cc"),f=r(22605),g=r(70553),h=r(88563),w=r(72351),v=r(59344),D=r(25422),y=r(58569),_=r(84330),x=r(87699),k=r(50759),S=r(89059),T=r(3723),R=r(12873),j=r(96320),N=r(12355),C=r(12064);let E={tech:w.r,ai:x.R,webdev:v.c,it:g.W,data:h.J,infosec:D.M,founders:y.n,marketing:_.e,mobile_dev:{name:"mobile_dev",titleMeta:"TLDR Mobile Dev Newsletter - Curated tools, trends, and tactics for mobile developers",headline:"Improve your Mobile Dev skills in 5 minutes",descriptionMeta:"TLDR Mobile Dev is a free newsletter with curated tools, trends, and tactics for Mobile Developers",emojiDescription:"Get our free daily newsletter with curated tools \uD83D\uDCBB, trends \uD83D\uDCC8, and insights \uD83D\uDCA1, for Mobile Developers \uD83D\uDCF1",newsletterEmoji:"\uD83D\uDCF1",newsletterHeadline:"TLDR Mobile Dev",multiDescription:"TLDR Mobile Development - Tools, trends, and insights for mobile developers"},crypto:k.W,devops:S.M,product:T.V,hardware:R.f,telecom:j.U,fintech:N.$,design:C.C};var L=r(21193);let M={subscribes:[],unsubscribes:[]};var A=r(25810),P=r(11393),O=r(39979);let Z={tech:3,webdev:2.5,dev:2.5,ai:2.5,infosec:2,founders:2,devops:2,product:2,marketing:1.5,design:1.5,crypto:1.5},F={subscribes:[],unsubscribes:[]},I=[{name:"server-action",attempts:1,run:async function(e){try{let t=await p(e);if(!t)return{status:"transport_failure",message:"action returned undefined (transport/deploy failure)"};if(t.error)return{status:"server_error",message:t.error};return{status:"ok"}}catch(e){return{status:"transport_failure",message:"action threw: ".concat((null==e?void 0:e.message)||"unknown")}}}},{name:"api-route",attempts:3,run:async function(e){try{let t=await fetch("/api/subscriptions/patch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)return{status:"transport_failure",message:"api route responded ".concat(t.status)};let r=await t.json();if(null==r?void 0:r.error)return{status:"server_error",message:r.error};return{status:"ok"}}catch(e){return{status:"transport_failure",message:"api route threw: ".concat((null==e?void 0:e.message)||"unknown")}}}}];async function U(e,t,r,n,s){let i=e.trim().toLowerCase(),a={subscribes:t.subscribes,unsubscribes:t.unsubscribes,email:i},c=(e,t)=>r("".concat("warn"===t?"Subscription update retrying":"Error updating reader"," for ").concat(i,": ").concat(e,", payload: ").concat(JSON.stringify(a)),"handleManageSubscriptionsSubmit",t),u="unknown error";for(let e of I)for(let t=1;t<=e.attempts;t++){let r=await e.run(a);if("ok"===r.status)return n(),!0;if("server_error"===r.status)return c("".concat(e.name," server error: ").concat(r.message)),s.error(o.ERROR_MESSAGES.subscription_error),!1;u="".concat(e.name,": ").concat(r.message),t<e.attempts&&(c(u,"warn"),await new Promise(e=>setTimeout(e,600*t)))}return c("all transports failed, last: ".concat(u)),s.error(o.ERROR_MESSAGES.subscription_error),!1}function G(e){let{newsletter:t,searchParams:r,email:o,reader:l,ctaButtonStyles:d,ctaButtonText:p,newsletterDescriptions:g,newsletterDescriptionsStyles:h,distinctId:w}=e,v=(0,s.useRouter)(),[D,y]=(0,i.useState)(!1),[_,x]=(0,i.useState)(""),k=r["em-tldr"],{subscriptionChanges:S,originalSubscribes:T,newSubscribes:R,newsletters:j,newslettersState:N,setNewslettersState:C,setSubscriptionChanges:I}=function(e,t){let[r,n]=(0,i.useState)(M),s=(0,i.useMemo)(()=>{let t=[];for(let r of L.sG)(null==e?void 0:e["".concat(r,"_subscribed")])&&t.pu
1sh(r);return t},[e]),a=r.subscribes.filter(e=>!s.includes(e)),c=t=>!!r.subscribes.includes(t)||!r.unsubscribes.includes(t)&&((null==e?void 0:e["".concat(t,"_subscribed")])||null),[o,u]=(0,i.useState)(()=>({tech:c("tech"),crypto:c("crypto"),ai:c("ai"),webdev:c("webdev"),infosec:c("infosec"),product:c("product"),marketing:c("marketing"),it:c("it"),data:c("data"),design:c("design"),founders:c("founders"),devops:c("devops"),hardware:c("hardware"),fintech:c("fintech")}));return(0,i.useEffect)(()=>{u({tech:c("tech"),crypto:c("crypto"),ai:c("ai"),webdev:c("webdev"),infosec:c("infosec"),product:c("product"),marketing:c("marketing"),it:c("it"),data:c("data"),design:c("design"),founders:c("founders"),devops:c("devops"),hardware:c("hardware"),fintech:c("fintech")})},[e,r]),{newsletters:(0,i.useMemo)(()=>[{order:1,flag:o.tech,subscribed:"tech_subscribed",name:E.tech.name,title:(null==t?void 0:t.tech)?"TLDR Tech - ".concat(t.tech):E.tech.multiDescription},{order:2,flag:o.ai,subscribed:"ai_subscribed",name:E.ai.name,title:(null==t?void 0:t.ai)?"TLDR AI - ".concat(t.ai):E.ai.multiDescription},{order:6,flag:o.webdev,subscribed:"webdev_subscribed",name:E.webdev.name,title:(null==t?void 0:t.webdev)?"TLDR WebDev - ".concat(t.webdev):E.webdev.multiDescription},{order:5,flag:o.infosec,subscribed:"infosec_subscribed",name:E.infosec.name,title:(null==t?void 0:t.infosec)?"TLDR InfoSec - ".concat(t.infosec):E.infosec.multiDescription},{order:4,flag:o.product,subscribed:"product_subscribed",name:E.product.name,title:(null==t?void 0:t.product)?"TLDR Product - ".concat(t.product):E.product.multiDescription},{order:3,flag:o.devops,subscribed:"devops_subscribed",name:E.devops.name,title:(null==t?void 0:t.devops)?"TLDR DevOps - ".concat(t.devops):E.devops.multiDescription},{order:7,flag:o.founders,subscribed:"founders_subscribed",name:E.founders.name,title:(null==t?void 0:t.founders)?"TLDR Founders - ".concat(t.founders):E.founders.multiDescription},{order:10,flag:o.design,subscribed:"design_subscribed",name:E.design.name,title:(null==t?void 0:t.design)?"TLDR Design - ".concat(t.design):E.design.multiDescription},{order:9,flag:o.marketing,subscribed:"marketing_subscribed",name:E.marketing.name,title:(null==t?void 0:t.marketing)?"TLDR Marketing - ".concat(t.marketing):E.marketing.multiDescription},{order:8,flag:o.crypto,subscribed:"crypto_subscribed",name:E.crypto.name,title:(null==t?void 0:t.crypto)?"TLDR Crypto - ".concat(t.crypto):E.crypto.multiDescription},{flag:o.it,subscribed:"it_subscribed",name:E.it.name,title:(null==t?void 0:t.it)?"TLDR IT - ".concat(t.it):E.it.multiDescription},{flag:o.data,subscribed:"data_subscribed",name:E.data.name,title:(null==t?void 0:t.data)?"TLDR Data - ".concat(t.data):E.data.multiDescription},{flag:o.fintech,subscribed:"fintech_subscribed",name:E.fintech.name,title:(null==t?void 0:t.fintech)?"TLDR Fintech - ".concat(t.fintech):E.fintech.multiDescription},{flag:o.hardware,subscribed:"hardware_subscribed",name:E.hardware.name,title:(null==t?void 0:t.hardware)?"TLDR Hardware - ".concat(t.hardware):E.hardware.multiDescription}].sort((e,t)=>void 0!==e.order&&void 0!==t.order?e.order-t.order:0),[o,t]),newslettersState:o,setNewslettersState:u,originalSubscribes:s,newSubscribes:a,subscriptionChanges:r,setSubscriptionChanges:n}}(l,g),{captureEvent:G}=(0,c.Z)("multi-signup-form",w),{captureEvent:z}=(0,c.Z)("additional-newsletter-subscribed",w),J=(0,i.useCallback)(()=>{G({originalSubscribesCount:T.length,newSubscribesCount:R.length,newSubscribesScore:R.reduce((e,t)=>e+(Z[t]||1),0)}),R.length>0&&(console.log("captureAdditionalNewsletterEvent",{initialNewsletter:t,originalSubscriptions:T,newSubscriptions:R,totalSubscriptions:[...T,...R],subscriptionCount:T.length+R.length}),z({initialNewsletter:t,originalSubscriptions:T,newSubscriptions:R,totalSubscriptions:[...T,...R],subscriptionCount:T.length+R.length}))},[G,z,T,R,t]),H=(0,s.usePathname)(),W=(0,i.useMemo)(()=>l.job_function||l.enriched_data?l.clicked_welcome_email_date?A._.thanks:"".concat(A._.finish,"?").concat(P.vf.encryptedEmail,"=").concat(k,"&id=").concat(r.id):"".concat(A._.info,"?").concat(P.vf.encryptedEmail,"=").concat(k,"&id=").concat(r.id),[l,k,r.id]),B=(0,i.useCallback)(async()=>(null==H?void 0:H.includes(A._.manage))?K():D||0===S.subscribes.length&&0===S.unsubscribes.length?v.push(W):void(y(!0),await U(o,S,f.D,J,u.Am)?v.push(W):y(!1)),[o,D,v,S,H,J,W]),K=(0,i.useCallback)(async()=>
1{if(!D){if(y(!0),0===S.subscribes.length&&0===S.unsubscribes.length)return y(!1),u.Am.error("No subscription changes submitted",{style:{background:"#fde047",color:"black"}});let e=await U(o,S,f.D,J,u.Am);if(y(!1),e)return I(F),v.refresh(),u.Am.success("Subscriptions updated!")}},[D,S,o,J,I,v]),$=(0,i.useMemo)(()=>j.map(e=>({...e,name:"dev"==e.name?"webdev":e.name})).filter(e=>{let{name:r}=e;return null!=H&&!!H.includes(A._.manage)||r!==t}).map(e=>{let{name:t,title:r}=e;return(0,n.jsx)(m,{routeName:H||"",newsletterName:t,title:r,newsletterState:N[t],setMessage:x,setNewslettersState:C,setSubscriptionChanges:I,reader:l,newsletterDescriptionsStyles:h},t)}),[t,j,N,l,H,h]),V=null==H?void 0:H.includes(A._.manage),Y=(0,O.Z)(!V),q=!V&&"next"===Y,Q=e=>(0,n.jsx)("form",{onSubmit:()=>B(),className:(0,b.cn)("flex justify-center",e),children:(0,n.jsx)(a.Z,{background:0==S.unsubscribes.length&&0==S.subscribes.length?"gray":"linear-gradient(-225deg, #AC32E4 0%, #7918F2 48%, #5a19ff 100%)",className:(0,b.cn)("py-1",!V&&"w-full max-w-[420px] md:w-auto",d),disabled:_,onClick:e=>{e.preventDefault(),B()},children:q?D?"Updating...":_||"Next":p||(V&&!D?"Update Subscriptions":D?"Updating...":_||"Save")})});return V?(0,n.jsxs)("div",{className:"content-center max-w-md mx-auto mt-5",children:[(0,n.jsx)("div",{className:"w-full flex flex-col items-center",children:$}),Q("mt-3 w-full")]}):(0,n.jsxs)("div",{className:"content-center max-w-md md:max-w-3xl mx-auto mt-5",children:[Q("mb-5 mt-3"),(0,n.jsx)("div",{className:"grid w-full grid-cols-1 md:grid-cols-2 md:gap-x-4 justify-items-center",children:$}),Q("mb-8 mt-2 md:hidden")]})}},64678:function(e,t,r){r.r(t),r.d(t,{ERROR_MESSAGES:function(){return o}});var n=r(57437),s=r(16463),i=r(2265),a=r(88726),c=r(65948);let o={email:"There was an error confirming your email. Please check your email and try again.",missing_parameters:"There was an error with the URL.",db_error:"There was an error updating your subscription, please try again.",unknown_error:"An unexpected error occurred. Please try again.",subscription_error:"There was an error confirming your subscriptions, please try again."},u={error:{invalid_email:o.email,missing_parameters:o.missing_parameters,db_error:o.db_error,eo_error:o.db_error,unknown_error:o.unknown_error,subscription:o.subscription_error},success:{confirm_unsubscribe:"You are now unsubscribed from the newsletter."}},l=function(e,t){var r;let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"error",s=(null===(r=u[e])||void 0===r?void 0:r[t])||o.unknown_error;switch(n){case"success":a.Am.success(s);break;case"error":a.Am.error(s);break;default:(0,a.Am)(s)}};t.default=()=>{let e=(0,s.useRouter)(),t=(0,s.usePathname)(),r=(0,s.useSearchParams)(),{kf:o}=(0,c.h)();return(0,i.useEffect)(()=>{Object.keys(u).forEach(n=>{let s=null==r?void 0:r.get(n);s&&(l(n,s,n),e.replace(t))})},[]),(0,n.jsx)(a.x7,{toastOptions:{className:"text-sm",style:o?{background:"var(--panel)",color:"var(--ink)",border:"1px solid var(--line)"}:{background:"#111827",color:"white"}},position:"top-center"})}},96320:function(e,t,r){r.d(t,{U:function(){return n}});let n={name:"telecom",titleMeta:"TLDR Telecom - Keep up with network infrastructure and IoT in 5 minutes",headline:"Keep up with network infrastructure and IoT in 5 minutes",descriptionMeta:"Trends in network infrastructure and IoT",emojiDescription:"Trends in network infrastructure and IoT",newsletterEmoji:"\uD83D\uDCE1",newsletterHeadline:"TLDR Telecom",multiDescription:"TLDR Telecom - Trends in network infrastructure and IoT"}},39979:function(e,t,r){r.d(t,{Z:function(){return i}});var n=r(42477),s=r(2265);function i(e){let[t,r]=(0,s.useState)(null);return(0,s.useEffect)(()=>{if(!e)return;let t=new URLSearchParams(window.location.search).get("onboarding_cta");if("next"===t||"control"===t){r(t);return}return n.ZP.onFeatureFlags(()=>{let e=n.ZP.getFeatureFlag("onboarding-next-cta");
1r("next"===e?"next":"control"===e?"control":null)})},[e]),t}},99533:function(e,t,r){r.d(t,{Z:function(){return i}});var n=r(42477),s=r(2265);function i(e,t){return{captureEvent:(0,s.useCallback)(r=>{t&&n.ZP.identify(t),n.ZP.capture(e,r)},[e,t])}}},22605:function(e,t,r){r.d(t,{D:function(){return n}});let n=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"error";try{await fetch("/api/log",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:e,label:t,level:r})})}catch(e){}}}}]);
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.