"use strict";(self.webpackChunksubstack=self.webpackChunksubstack||[]).push([["4665"],{40484:function(e,t,l){l.d(t,{Z:()=>i});let i={modal:"modal-O8Dx6X",renderOverReactLaagPortal:"renderOverReactLaagPortal-suGnvT",modalBody:"modalBody-qocErY",header:"header-eb1Nyn",title:"title-JUq5uE",description:"description-bku4qR",buttonLeft:"buttonLeft-kZKPjW"}},20746:function(e,t,l){l.d(t,{Z:()=>i});let i={backdropContainer:"backdropContainer-cOZ3hh",backdrop:"backdrop-IqiELY",backdropEnter:"backdropEnter-ZpaQIK",backdropEnterFrom:"backdropEnterFrom-CKaxGg",backdropEnterTo:"backdropEnterTo-QxRXXs",backdropLeave:"backdropLeave-IagLtt",backdropLeaveFrom:"backdropLeaveFrom-dCf923",backdropLeaveTo:"backdropLeaveTo-Zn8qab"}},68742:function(e,t,l){l.d(t,{Z:()=>i});let i={panel:"panel-ulWfet","position-full":"position-full-roTcOT",positionFull:"position-full-roTcOT","position-bottom":"position-bottom-iMkmCS",positionBottom:"position-bottom-iMkmCS","position-default":"position-default-ybuNjD",positionDefault:"position-default-ybuNjD",fullscreenMobile:"fullscreenMobile-uSmZ_w",fullscreenMobileHeight:"fullscreenMobileHeight-ugjrAs",maxFullscreenMobile:"maxFullscreenMobile-xWTeST",panelEnter:"panelEnter-yiVhfS",panelEnterFrom:"panelEnterFrom-zcc_zQ",panelEnterTo:"panelEnterTo-wmKOeP",panelLeave:"panelLeave-W7aUj9",panelLeaveFrom:"panelLeaveFrom-cGPG4g",panelLeaveTo:"panelLeaveTo-xVIwDl"}},63584:function(e,t,l){l.d(t,{Z:()=>i});let i={select:"select-nGc13j",focus:"focus-JiAubq",leading:"leading-o7jWpZ",trailing:"trailing-ezPcro",error:"error-L2xDMl",disabled:"disabled-Dbz4PM",wrapper:"wrapper-IwGljo"}},42224:function(e,t,l){l.d(t,{k:()=>w});var i=l(7409),n=l(99282),a=l(16584),r=l(98661),o=l(30396),d=l(94184),s=l.n(d),c=l(86632),u=l(95441),m=l(48980),v=l(3312),p=l.n(v);let h=(e,t)=>{var l,i,n,r,o,d;let s=null==e?void 0:e.metadata.time,c={"@context":"https://schema.org/","@type":"Recipe",name:e.name,image:e.image_url?[e.image_url]:null,author:{"@type":"Person",name:null===(l=t.publishedBylines)||void 0===l?void 0:l.map(e=>e.name).join(", ")},cookTime:(null===(i=e.settings)||void 0===i?void 0:i.showTime)&&s?g(s):null,datePublished:t.post_date,description:null,recipeIngredient:e.ingredients,recipeInstructions:null===(n=e.steps)||void 0===n?void 0:n.map((e,t)=>({"@type":"HowToStep",text:e,position:t+1})),keywords:null===(r=e.metadata)||void 0===r?void 0:r.keywords,recipeCategory:null===(o=e.metadata)||void 0===o?void 0:o.category,recipeCuisine:null===(d=e.metadata)||void 0===d?void 0:d.cuisine};return(0,a.tZ)("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:p()(c,{json:!0,isSecureContext:!0})}})},g=e=>e.number&&e.unit?({minute:"PT".concat(e.number,"M"),hour:"PT".concat(e.number,"H"),day:"P".concat(e.number,"D")})[e.unit]:null;var b=l(98914),y=l(15771),Z=l(19081),f=l(6490),k=l(17688),T=l(58175);let x={recipe:"recipe-ZIuB27",recipeInfo:"recipeInfo-wi8rys",metaTop:"metaTop-lj6olV",time:"time-KO42PG",metaBottom:"metaBottom-TmCFwy",sectionHead:"sectionHead-ds6yqo",recipeTitle:"recipeTitle-I9hgrm",textInput:"textInput-Eihhm7",editableItem:"editableItem-BKXcL1",tools:"tools-EBrThT",skinny:"skinny-dFa8Rj",dash:"dash-d3gefh",collapsed:"collapsed-Y7SwfF",expandButton:"expandButton-YijU9a",settingsModal:"settingsModal-7Nj14M",disabled:"disabled-JRxT54",divider:"divider-k43Twf",leftHr:"leftHr-BPiRAs",rightAlign:"rightAlign-H80vAQ",imageDropZone:"imageDropZone-KCyMtY",recipeImage:"recipeImage-M1x7RQ"},w=e=>{var t,l,r,d,v,p,g,b;let{node:f,staticData:w,editable:C=!0}=e,N=null==f?void 0:null===(t=f.attrs)||void 0===t?void 0:t.id,[_,D]=(0,o.eJ)(w||null),[M,S]=(0,o.eJ)(null==_?void 0:_.name),[H,L]=(0,o.eJ)(null==_?void 0:_.metadata),[q,E]=(0,o.eJ)(null==_?void 0:_.ingredients),[F,j]=(0,o.eJ)(null==_?void 0:_.steps),[P,z]=(0,o.eJ)(null),[O,J]=(0,o.eJ)(null),[A,K]=(0,o.eJ)(null==_?void 0:_.settings),[R,Y]=(0,o.eJ)(!1),[G,W]=(0,o.eJ)(null==_?void 0:_.image_url),{iString:Q}=(0,u.M1)();return(0,o.d4)(()=>{(async()=>{if(!N)return;let e=await (0,m.rd)("/api/v1/recipe/".concat(N));D(e.recipe),S(e.recipe.name),L(e.recipe.metadata),E(e.recipe.ingredients),j(e.recipe.steps),K(e.recipe.settings),J(e.postInfo),W(e.recipe.image_url)})()},[N]),(0,o.d4)(()=>{let e=async()=>{let e={};M!==(null==_?void 0:_.name)&&(e.name=M),H!==(null==_?void 0:_.metadata)&&(e.metadata=H),q!==(null==_?void 0:_.ingredients)&&(e.ingredients=q),F!==(null==_?void 0:_.steps)&&(e.steps=F),A!==(null==_?void 0:_.settings)&&(e.settings=A),G!==(null==_?void 0:_.image_url)&&(e.image_url=G),Object.keys(e).length&&await (0,m.rd)("/api/v1/recipe/".concat(N),{method:"POST",json:e})};(async function(){P&&clearTimeout(P),z(setTimeout(()=>{e()},1e3))})()},[M,H,q,F,N,A,G]),(0,a.BX)(a.HY,{children:[_&&O?h(_,O):null,(0,a.BX)("div",{className:x.recipe,children:[C?(0,a.tZ)(X,{image:G,setImage:W}):(0,a.tZ)("img",{src:G,className:x.recipeImage}),(0,a.tZ)("textarea",{placeholder:"Title...",value:M,onChange:async e=>{var t;S(null===(t=e.currentTarget)||void 0===t?void 0:t.value)},className:x.recipeTitle,disabled:!C}),(0,a.BX)("div",{className:x.recipeInfo,children:[((null==H?void 0:H.tools)||C)&&(0,a.BX)(Z.gq,{alignItems:"center",gap:8,style:{marginBottom:32},children:[(0,a.tZ)("div",{className:x.tools,children:"Tools:"}),(0,a.tZ)("textarea",{className:x.textInput,placeholder:"A stand mixer, rolling pin, a large working surface",value:null==H?void 0:H.tools,onChange:e=>{var t;L((0,n._)((0,i._)({},H),{tools:null===(t=e.currentTarget)||void 0===t?void 0:t.value}))},disabled:!C})]}),(0,a.tZ)("hr",{className:x.divider})]}),(0,a.BX)(Z.gq,{gap:8,justifyContent:"space-between",padding:16,alignItems:"end",style:{flexWrap:"wrap"},children:[(0,a.BX)(Z.gq,{gap:8,alignItems:"center",children:[(null==A?void 0:A.showTime)&&(0,a.BX)("div",{className:x.metaItem,children:[(0,a.tZ)("div",{className:x.metaTop,children:"Time: "}),(0,a.tZ)(Z.gq,{alignItems:"center",className:x.time,children:C?(0,a.BX)(a.HY,{children:[(0,a.tZ)("input",{className:s()(x.metaBottom,x.textInput,x.skinny),value:null==H?void 0:null===(l=H.time)||void 0===l?void 0:l.number,placeholder:"1",onChange:e=>{var t,l;let a=Math.max(1,Number(null===(t=e.currentTarget)||void 0===t?void 0:t.value));L((0,n._)((0,i._)({},H),{time:{number:a,unit:null==H?void 0:null===(l=H.time)||void 0===l?void 0:l.unit}}))},type:"number",disabled:!C}),(0,a.BX)(k.i,{value:(null==H?void 0:null===(r=H.time)||void 0===r?void 0:r.unit)||"hour",onChange:e=>{var t;return L((0,n._)((0,i._)({},H),{time:{number:null==H?void 0:null===(t=H.time)||void 0===t?void 0:t.number,unit:e.target.value}}))},disabled:!C,children:[(0,a.tZ)("option",{value:"minute",children:Q("Minute(s)")}),(0,a.tZ)("option",{value:"hour",children:Q("Hour(s)")}),(0,a.tZ)("option",{value:"day",children:Q("Day(s)")})]})]}):(0,a.tZ)(T.xv.B3,{children:"".concat(null==H?void 0:null===(d=H.time)||void 0===d?void 0:d.number," ").concat(null==H?void 0:null===(v=H.time)||void 0===v?void 0:v.unit,"(s)")})})]}),(null==A?void 0:A.showServings)&&(0,a.BX)("div",{className:x.metaItem,children:[(0,a.tZ)("div",{className:x.metaTop,children:"Serves:"}),(0,a.tZ)("div",{className:s()(x.metaBottom),children:(0,a.BX)(Z.gq,{gap:8,textAlign:"center",alignItems:"center",children:[C?(0,a.tZ)("input",{className:s()(x.metaBottom,x.textInput,x.skinny),value:null==H?void 0:null===(p=H.serves)||void 0===p?void 0:p.small,placeholder:"4",type:"number",onChange:e=>{var t,l;let a=Math.max(1,Number(null===(t=e.currentTarget)||void 0===t?void 0:t.value));L((0,n._)((0,i._)({},H),{serves:{large:null==H?void 0:null===(l=H.serves)||void 0===l?void 0:l.large,small:a}}))},disabled:!C}):(0,a.tZ)(T.xv.B3,{children:null==H?void 0:null===(g=H.serves)||void 0===g?void 0:g.small}),(0,a.tZ)("div",{className:x.dash,children:"-"}),(0,a.tZ)("input",{className:s()(x.metaBottom,x.textInput,x.skinny),value:null==H?void 0:null===(b=H.serves)||void 0===b?void 0:b.large,placeholder:"8",type:"number",onChange:e=>{var t,l;let a=Math.max(1,Number(null===(t=e.currentTarget)||void 0===t?void 0:t.value));L((0,n._)((0,i._)({},H),{serves:{small:null==H?void 0:null===(l=H.serves)||void 0===l?void 0:l.small,large:a}}))},disabled:!C})]})})]}),(null==A?void 0:A.showDifficulty)&&(0,a.BX)("div",{className:x.metaItem,children:[(0,a.tZ)("div",{className:x.metaTop,children:" Difficulty:"}),(0,a.tZ)("div",{className:x.time,children:(0,a.tZ)(Z.gq,{alignItems:"center",className:x.time,children:C?(0,a.BX)(k.i,{value:(null==H?void 0:H.difficulty)||"easy",onChange:e=>L((0,n._)((0,i._)({},H),{difficulty:e.target.value})),disabled:!C,children:[(0,a.tZ)("option",{value:"easy",children:Q("Easy")}),(0,a.tZ)("option",{value:"medium",children:Q("Medium")}),(0,a.tZ)("option",{value:"advanced",children:Q("Advanced")})]}):(0,a.tZ)(T.xv.B3,{children:null==H?void 0:H.difficulty})})})]})]}),(0,a.BX)(Z.gq,{gap:8,alignItems:"center",children:[(0,a.tZ)(y.zx,{priority:"secondary",children:"Download"}),C&&(0,a.tZ)(y.zx,{priority:"secondary",onClick:()=>{Y(!0)},children:(0,a.tZ)(c.Z,{height:12})})]})]}),(0,a.tZ)("hr",{className:x.divider}),q&&F&&(0,a.tZ)(I,{ingredients:C?q:q.filter(e=>e),steps:C?F:F.filter(e=>e),setIngredients:E,setSteps:j,editable:C,isStatic:!!w})]}),(0,a.tZ)(B,{isOpen:R,setIsOpen:Y,settings:A,setSettings:K,metadata:H,setMetadata:L})]})},B=e=>{let{isOpen:t,setIsOpen:l,settings:r,setSettings:o,metadata:d,setMetadata:s}=e;return(0,a.tZ)(f.u_,{isOpen:t,onClose:()=>{l(!1)},children:(0,a.BX)("div",{className:x.settingsModal,children:[(0,a.tZ)(T.xv.H2,{children:"Settings"}),(0,a.BX)(Z.tu,{style:{marginTop:24},children:[(0,a.tZ)("hr",{className:x.divider}),(0,a.BX)(Z.tu,{gap:24,style:{marginTop:12,marginBottom:12},children:[(0,a.BX)(Z.gq,{gap:4,children:[(0,a.tZ)("label",{htmlFor:"keywords",children:"Keywords: "}),(0,a.tZ)("input",{type:"text",id:"keywords",name:"keywords",value:null==d?void 0:d.keywords,onChange:e=>{var t;s((0,n._)((0,i._)({},d),{keywords:null===(t=e.currentTarget)||void 0===t?void 0:t.value}))},placeholder:"healthy, gluten-free"})]}),(0,a.BX)(Z.gq,{gap:4,children:[(0,a.tZ)("label",{htmlFor:"keywords",children:"Cuisine: "}),(0,a.tZ)("input",{type:"text",id:"cuisine",name:"cuisine",value:null==d?void 0:d.cuisine,placeholder:"New-American",onChange:e=>{var t;s((0,n._)((0,i._)({},d),{cuisine:null===(t=e.currentTarget)||void 0===t?void 0:t.value}))}})]}),(0,a.BX)(Z.gq,{gap:4,children:[(0,a.tZ)("label",{htmlFor:"category",children:"Category: "}),(0,a.tZ)("input",{type:"text",id:"category",name:"category",placeholder:"Main courses",value:null==d?void 0:d.category,onChange:e=>{var t;s((0,n._)((0,i._)({},d),{category:null===(t=e.currentTarget)||void 0===t?void 0:t.value}))}})]})]})]}),(0,a.BX)(Z.gq,{gap:8,alignItems:"center",children:[(0,a.tZ)("input",{type:"checkbox",id:"showTime",name:"showTime",checked:null==r?void 0:r.showTime,onChange:()=>{o((0,n._)((0,i._)({},r),{showTime:!(null==r?void 0:r.showTime)}))}}),(0,a.tZ)("label",{for:"showTime",children:"Show Time"})]}),(0,a.BX)(Z.gq,{gap:8,alignItems:"center",children:[(0,a.tZ)("input",{type:"checkbox",id:"showServings",name:"showServings",checked:null==r?void 0:r.showServings,onChange:()=>{o((0,n._)((0,i._)({},r),{showServings:!(null==r?void 0:r.showServings)}))}}),(0,a.tZ)("label",{for:"showServings",children:"Show Servings"})]}),(0,a.BX)(Z.gq,{gap:8,alignItems:"center",children:[(0,a.tZ)("input",{type:"checkbox",id:"showDifficulty",name:"showDifficulty",checked:null==r?void 0:r.showDifficulty,onChange:()=>{o((0,n._)((0,i._)({},r),{showDifficulty:!(null==r?void 0:r.showDifficulty)}))}}),(0,a.tZ)("label",{for:"showDifficulty",children:"Show Difficulty"})]}),(0,a.tZ)("div",{className:x.rightAlign,children:(0,a.tZ)(y.zx,{onClick:()=>l(!1),children:"Done"})})]})})},I=e=>{let{ingredients:t,steps:l,setIngredients:i,setSteps:n,editable:r,isStatic:d}=e,[c,u]=(0,o.eJ)(!r);return(0,a.BX)(a.HY,{children:[(0,a.BX)(Z.gq,{justifyContent:"space-between",padding:16*!(0,b.K1)(),className:s()(x.mainContent,{[x.collapsed]:c&&!d}),style:{flexDirection:(0,b.K1)()||d?"column":"row"},children:[(0,a.BX)("div",{className:x.sectionHead,children:[(0,a.tZ)(T.xv.H3,{children:"Ingredients"}),(0,a.tZ)("hr",{className:x.leftHr}),(0,a.tZ)(C,{items:t,setItems:i,placeholder:"Add an ingredient...",className:x.ingredientList,disabled:!r})]}),(0,a.BX)("div",{className:x.sectionHead,children:[(0,a.tZ)(T.xv.H3,{children:"Directions"}),(0,a.tZ)("hr",{className:x.leftHr}),(0,a.tZ)(C,{items:l,setItems:n,placeholder:"Add a step...",className:x.stepList,disabled:!r,prefix:"Step"})]})]}),c&&!d&&(0,a.tZ)(y.zx,{onClick:()=>{u(!1)},priority:"secondary",className:x.expandButton,children:"Expand"})]})},C=(0,r.memo)(e=>{let{items:t,setItems:l,placeholder:i,className:n,disabled:r,prefix:o}=e;return(0,a.tZ)(Z.tu,{gap:8,className:n,children:((null==t?void 0:t.length)?t:[""]).map((e,n)=>(0,a.BX)(a.HY,{children:[o&&(0,a.BX)(T.xv.H4,{children:[o," ",n+1]}),r?(0,a.tZ)(T.xv.B3,{children:e}):(0,a.tZ)(N,{item:e,setItem:e=>{let i=[...t];i[n]=e,l(i)},removeItem:()=>{let e=[...t];e.splice(n,1),l(e)},addItem:()=>{let e=[...t];e.splice(n+1,0,""),l(e)},disabled:r,placeholder:i},n)]}))})}),N=e=>{let{item:t,setItem:l,removeItem:i,disabled:n,placeholder:r,addItem:o}=e;return(0,a.BX)(Z.gq,{className:x.editableItem,gap:4,children:[(0,a.tZ)(_,{value:t,onChange:e=>{var t;l(null===(t=e.currentTarget)||void 0===t?void 0:t.value)},disabled:n,placeholder:r,className:s()({[x.disabled]:n})}),!n&&(0,a.tZ)(y.zx,{onClick:o,disabled:n,size:"sm",priority:"secondary",style:{height:"20px"},children:"+"}),!n&&(0,a.tZ)(y.zx,{onClick:i,disabled:n,size:"sm",priority:"secondary",style:{height:"20px"},children:"-"})]})},_=e=>{let{value:t,onChange:l,disabled:i,placeholder:n,className:r}=e,d=(0,o.sO)(null);return(0,o.d4)(()=>{let e=d.current;e&&(e.style.height="auto",e.style.height="".concat(e.scrollHeight,"px"))},[t]),(0,a.tZ)("textarea",{value:t,className:r,onChange:l,disabled:i,placeholder:n,ref:d})};function X(e){let{image:t,setImage:l}=e,i=async e=>{if(e.preventDefault(),e.dataTransfer.files&&e.dataTransfer.files[0]){let t=e.dataTransfer.files[0];l(await (0,b.Zk)(t))}},n=async e=>{if(e.target.files&&e.target.files[0]){let t=e.target.files[0];l(await (0,b.Zk)(t))}};return(0,a.BX)("div",{className:"image-uploader",onDragOver:e=>{e.preventDefault()},onDrop:i,style:{width:"auto",height:"525px",border:"2px dashed #ccc",display:"flex",justifyContent:"center",alignItems:"center",backgroundImage:"url(".concat(t,")"),backgroundSize:"cover",backgroundPosition:"center"},children:[t?(0,a.tZ)("div",{style:{position:"absolute",cursor:"pointer",backgroundColor:"rgba(255, 255, 255, 0.3)"},onClick:()=>l(""),children:"Remove Image"}):null,t?null:(0,a.BX)("label",{style:{cursor:"pointer"},children:["Drag an image or click to select",(0,a.tZ)("input",{type:"file",accept:"image/*",style:{display:"none"},onChange:n})]})]})}},86632:function(e,t,l){l.d(t,{Z:()=>o});var i=l(7409),n=l(99282),a=l(16584),r=l(64515);let o=e=>(0,a.BX)(r.l,(0,n._)((0,i._)({},e),{name:"BurgerIcon",svgParams:{height:100,width:100},children:[(0,a.tZ)("path",{d:"M84.7,53.7H15.1c-2.1,0-3.8-1.7-3.8-3.8v0c0-2.1,1.7-3.8,3.8-3.8h69.7c2.1,0,3.8,1.7,3.8,3.8v0C88.6,52,86.9,53.7,84.7,53.7 z"}),(0,a.tZ)("path",{d:"M84.7,23.7H15.1c-2.1,0-3.8-1.7-3.8-3.8v0c0-2.1,1.7-3.8,3.8-3.8h69.7c2.1,0,3.8,1.7,3.8,3.8v0C88.6,22,86.9,23.7,84.7,23.7 z"}),(0,a.tZ)("path",{d:"M84.7,83.7H15.1c-2.1,0-3.8-1.7-3.8-3.8v0c0-2.1,1.7-3.8,3.8-3.8h69.7c2.1,0,3.8,1.7,3.8,3.8v0C88.6,82,86.9,83.7,84.7,83.7 z"})]}))},27190:function(e,t,l){l.d(t,{Uv:()=>o,_n:()=>d,sc:()=>s});var i=l(16584),n=l(19425);l(98661);var a=l(71068),r=l(20746);let o=e=>{let{children:t}=e;return(0,i.tZ)(a.xu,{className:r.Z.backdropContainer,children:t})},d=()=>(0,i.tZ)(a.xu,{className:r.Z.backdrop,"aria-hidden":!0}),s=e=>{let{children:t}=e;return(0,i.tZ)(n.u.Child,{enter:r.Z.backdropEnter,enterFrom:r.Z.backdropEnterFrom,enterTo:r.Z.backdropEnterTo,leave:r.Z.backdropLeave,leaveFrom:r.Z.backdropLeaveFrom,leaveTo:r.Z.backdropLeaveTo,children:t})}}}]);