1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,33792,327837,176629,e=>{"use strict";var t=e.i(843476),n=e.i(476819),r=e.i(271645),a=e.i(424154);let l=/\{\{booking_slots(?::([a-z0-9][a-z0-9-]{0,63}))?\}\}/gi,o="-apple-system,BlinkMacSystemFont,'SF Pro Display','Segoe UI',Helvetica,Arial,sans-serif",i="#454545",s="#A5A29B",d="#F5F4ED",c="#A6BFD0";function u(e,t){return`${e.replace(/\/$/,"")}/book/${t}`}function p(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}let m={first_name:"Alex",last_name:"Johnson",full_name:"Alex Johnson",email:"[email protected]",phone:"+1 555-0123",job_title:"VP of Sales",company_name:"Acme Inc",company_domain:"acme.com",owner_first_name:"You",owner_last_name:"",owner_name:"You",owner_email:"[email protected]",linkedin_url:"linkedin.com/in/alexjohnson",city:"San Francisco",unsubscribe_link:"#"};function h(e){let t=(e?.fullName||"").trim(),n=t?t.split(/\s+/):[];return{owner_name:t||m.owner_name,owner_first_name:n[0]||m.owner_first_name,owner_last_name:n.slice(1).join(" "),owner_email:(e?.email||"").trim()||m.owner_email}}function f(e,t="text",n={}){let r,a=n.keepBookingSlots?e:(r=function(){let e=[["9:00 AM","10:30 AM","1:00 PM"],["9:30 AM","11:00 AM","2:00 PM"],["10:00 AM","12:00 PM","3:30 PM"],["9:00 AM","11:30 AM","2:30 PM"]],t=["SUN","MON","TUE","WED","THU","FRI","SAT"],n=[],r=new Date;for(r.setDate(r.getDate()+1);n.length<e.length;){let a=r.getDay();0!==a&&6!==a&&n.push({date:r.toISOString().slice(0,10),weekday:t[a],dayOfMonth:String(r.getDate()),slots:e[n.length].map((e,t)=>({start:new Date(r.getTime()+60*t*6e4).toISOString(),label:e}))}),r.setDate(r.getDate()+1)}return{slug:"sample",name:"Intro call",timezone:"your timezone",durationMinutes:30,days:n}}(),e.replace(l,()=>{let e;return"html"===t?function(e,t,n={}){let r=n.inert?"#":p(u(t,e.slug)),a=`${(100/e.days.length).toFixed(4)}%`,l=e.days.map((r,l)=>{let c=l===e.days.length-1,m=r.slots.map((a,l)=>{var s;let c,m=n.inert?"#":p((s=e.slug,c=new URLSearchParams({date:r.date,slot:a.start}),`${u(t,s)}?${c.toString()}`));return` 2${l>0?'<tr><td height="6" style="height:6px; font-size:0; line-height:0;"> </td></tr>':""} 3<tr><td bgcolor="${d}" style="background-color:${d}; border-radius:12px;"><a href="${m}" style="display:block; padding:10px 0; text-align:center; font-family:${o}; font-size:13px; font-weight:500; line-height:16px; color:${i}; text-decoration:none;">${p(a.label)}</a></td></tr>`}).join("");return` 4<td width="${a}" valign="top" style="width:${a};${c?"":" padding-right:8px;"}"> 5<div style="text-align:center; font-family:${o}; font-size:11px; font-weight:600; letter-spacing:1.2px; line-height:14px; color:${s};">${p(r.weekday)}</div> 6<div style="text-align:center; padding:1px 0 11px 0; font-family:${o}; font-size:18px; font-weight:600; letter-spacing:-0.4px; line-height:24px; color:${i};">${p(r.dayOfMonth)}</div> 7<table role="presentation" cellpadding="0" cellspacing="0" border="0" width="100%" style="border-collapse:collapse;">${m} 8</table> 9</td>`}).join("");return`<table role="presentation" cellpadding="0" cellspacing="0" border="0" width="100%" bgcolor="#FFFFFF" style="background-color:#FFFFFF; border:1px solid #EDE9E0; border-radius:28px; border-collapse:separate;"> 10<tr> 11<td style="padding:32px 30px 34px 30px;"> 12 13<table role="presentation" cellpadding="0" cellspacing="0" border="0" width="100%" style="border-collapse:collapse;"> 14<tr> 15<td align="left" style="font-family:${o}; font-size:16px; line-height:22px; font-weight:600; letter-spacing:-0.3px; color:${i};">${p(e.name)}</td> 16<td align="right" style="font-family:${o}; font-size:13px; line-height:22px; color:#9A968E;">${e.durationMinutes} minutes · times in ${p(e.timezone)}</td> 17</tr> 18</table> 19 20<table role="presentation" cellpadding="0" cellspacing="0" border="0" width="100%" style="border-collapse:collapse;"> 21<tr><td height="24" colspan="${e.days.length}" style="height:24px; font-size:0; line-height:0;"> </td></tr> 22<tr>${l} 23</tr> 24</table> 25 26<table role="presentation" cellpadding="0" cellspacing="0" border="0" width="100%" style="border-collapse:collapse;"> 27<tr><td height="26" style="height:26px; font-size:0; line-height:0;"> </td></tr> 28<tr> 29<td align="center"> 30<table role="presentation" cellpadding="0" cellspacing="0" border="0" style="border-collapse:separate;"> 31<tr> 32<td align="center" bgcolor="${c}" style="background-color:${c}; border-radius:22px;"> 33<a href="${r}" style="display:block; text-decoration:none;"><img src="https://rotavfygaurxurrqxygr.supabase.co/storage/v1/object/public/avatars/workspace-aa3e00e3-bd1f-408a-a03c-735751311ad4/btn-see-all-open-times.png" width="165" height="44" alt="See all open times" style="display:block; width:165px; height:44px; border:0; outline:none; text-decoration:none;" /></a> 34</td> 35</tr> 36</table> 37</td> 38</tr> 39<tr> 40<td align="center" style="padding:16px 0 0 0; font-family:${o}; font-size:13px; line-height:20px; color:${s};">Any slot opens the calendar with the rest of the week. Or just reply to this email.</td> 41</tr> 42</table> 43 44</td> 45</tr> 46</table>`}(r,"https://thetool.company",{inert:!0}):(e=r.days.map(e=>
46`${e.weekday} ${e.dayOfMonth}: ${e.slots.map(e=>e.label).join(", ")}`),[`${r.name}, ${r.durationMinutes} minutes. Times in ${r.timezone}.`,"",...e,"",`Book a time: ${u("https://thetool.company",r.slug)}`].join("\n"))})),g=n.sender?{...m,...h(n.sender)}:m;return a.replace(/\{\{(\w+)(?:\|([^}]*))?\}\}/g,(e,t,n)=>{let r=g[t];return void 0!==r&&""!==r?r:void 0!==n?n:e})}e.s(["SAMPLE_VALUES",0,m,"senderSampleValues",0,h,"substituteSampleValues",0,f],327837);let g="data-ee-t",b="data-ee-s",x="data-ee-var",y="data-ee-var-block",w=new Set(["SCRIPT","STYLE","TITLE","HEAD","NOSCRIPT"]),k=/\{\{[^{}]+\}\}/g,v=/<[a-z][^>]*>/i;function E(e){let t=e.createTreeWalker(e.body,NodeFilter.SHOW_TEXT),n=[],r=t.nextNode();for(;r;)r.data.trim()&&!w.has(r.parentElement?.tagName??"")&&n.push(r),r=t.nextNode();return n}function j(e,t){if(!/<html[\s>]/i.test(e))return t.body.innerHTML;let n=e.match(/^\s*<!doctype[^>]*>/i)?.[0]??"";return n+(n?"\n":"")+t.documentElement.outerHTML}function _(e,t){let n=new DOMParser().parseFromString(e,"text/html"),r=E(n),a=r.map(e=>(function(e){let t=[],n=0;for(let r of e.matchAll(k)){let a=r.index??0;a>n&&t.push({kind:"text",value:e.slice(n,a)}),t.push({kind:"var",value:r[0]}),n=a+r[0].length}return n<e.length&&t.push({kind:"text",value:e.slice(n)}),t})(e.data)),l=new DOMParser().parseFromString(e,"text/html");return E(l).forEach((e,n)=>{let r=l.createDocumentFragment();a[n].forEach((e,a)=>{let o=l.createElement("span");if("var"===e.kind){o.setAttribute(x,"");let n=t(e.value);v.test(n)?(o.setAttribute(y,""),o.style.display="block",o.innerHTML=n):o.textContent=n}else o.setAttribute(g,String(n)),o.setAttribute(b,String(a)),o.textContent=e.value;r.appendChild(o)}),e.parentNode?.replaceChild(r,e)}),{sourceDoc:n,sourceNodes:r,segments:a,markedHtml:j(e,l)}}function S(e){let t=e=>{if(!e)return;let t=e.match(/background-color\s*:\s*([^;"']+)/i)?.[1],n=e.match(/background\s*:\s*([^;"']+)/i)?.[1],r=(t??n)?.trim();return r&&!/^(transparent|none|inherit|initial)$/i.test(r)?r:void 0},n=e.match(/<body\b[^>]*>/i)?.[0],r=t(n?.match(/style=["']([^"']*)["']/i)?.[1]);if(r)return r;let a=e.match(/<table\b[^>]*width=["']100%["'][^>]*>/i)?.[0]??e.match(/<table\b[^>]*>/i)?.[0];return(t(a?.match(/style=["']([^"']*)["']/i)?.[1])??a?.match(/bgcolor=["']([^"']+)["']/i)?.[1]?.trim())||"#ffffff"}function $(e){let t=S(e),n=a.default.sanitize(e,{WHOLE_DOCUMENT:!0,ADD_TAGS:["style"],FORBID_TAGS:["script","iframe","object","embed","form","input","button","select","textarea","noscript","link","meta"],FORBID_ATTR:["onclick","onload","onerror","onmouseover","onmouseout","onfocus","onblur","onsubmit","onreset","onchange","onkeydown","onkeyup","onkeypress","onabort","onbeforeunload","oncontextmenu","ondblclick","oninput","onsearch","onselect","onwheel"],ADD_ATTR:["target"]}),r="",l=n.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);l&&(r=l[1],n=n.replace(/<head\b[^>]*>[\s\S]*?<\/head>/i,"")),n=n.replace(/<\/?html\b[^>]*>/gi,"").replace(/<\/?body\b[^>]*>/gi,"");let o=` 47 html, body { 48 margin: 0; padding: 0; background: ${t}; 49 height: auto !important; 50 min-height: 0 !important; 51 max-height: none !important; 52 } 53 body { 54 font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif; 55 font-size: 14px; line-height: 1.5; color: #111; 56 word-wrap: break-word; overflow-wrap: break-word; 57 transform-origin: top left; 58 } 59 img { max-width: 100%; } 60 `;return`<!DOCTYPE html> 61<html> 62<head> 63<meta charset="utf-8"> 64<base target="_blank"> 65<style>${o}</style> 66${r} 67</head> 68<body>${n}</body> 69</html>`}e.s(["RUN_NODE",0,g,"RUN_SEG",0,b,"VAR_BLOCK",0,y,"VAR_MARKER",0,x,"buildEditModel",0,_,"serializeLike",0,j,"syncPlainTextIntoDesign",0,function(e,t,n){let r=t.split("\n"),a=n.split("\n");if(r.length!==a.length)return null;let l=new DOMParser().parseFromString(e,"text/html"),o=E(l),i=!1;for(let e=0;e<r.length;e++){let t=r[e].trim(),n=a[e].trim();if(t===n||!t||!n)continue;let l=o.filter(e=>e.data.trim()===t);1===l.length&&(l[0].data=l[0].data.replace(t,n),i=!0)}return i?j(e,l):null}],176629),e.s(["EmailDesignPreview",0,function({html:e,sampleVars:a=!0,sender:l,className:o,maxHeight:i,onHtmlChange:s}){let d=!!s,c=(0,r.useRef)(null),[u,p]=(0,r.useState)(360),[m]=(0,r.useState)(()=>!0),[h,w]=(0,r.useState)(e),k=(0,r.useRef)(null);(0,r.useEffect)(()=>{e!==k.current&&w(e)},[e]);let v=(0,r.useRef)(null),E=(0,r.useMemo)(()=>
69{if(!m)return"";if(!d)return $(a?f(h,"html",{sender:l}):h);let e=_(h,e=>a?f(e,"html",{sender:l}):e);return v.current=e,$(e.markedHtml)},[h,a,l,m,d]),N=(0,r.useMemo)(()=>S(e),[e]),A=(0,r.useRef)(!1),C=(0,r.useRef)(0),D=(0,r.useCallback)(()=>{let e=c.current;if(e)try{let t=e.contentDocument;if(!t?.body||!t.documentElement)return;let n=t.body;A.current=!0;try{n.style.transform="",n.style.width="";let r=e.clientWidth,a=Math.max(n.scrollWidth,n.offsetWidth,t.documentElement.scrollWidth,t.documentElement.offsetWidth),l=1;r>0&&a>r+1&&(l=r/a,n.style.width=`${a}px`,n.style.transform=`scale(${l})`);let o=Math.max(n.scrollHeight,n.offsetHeight,n.getBoundingClientRect().height);if(o<=0)return;let i=Math.max(120,Math.ceil(o*l)+8);p(e=>Math.abs(e-i)>2?i:e),C.current=r}finally{Promise.resolve().then(()=>{A.current=!1})}}catch{A.current=!1}},[]);(0,r.useLayoutEffect)(()=>{let e=c.current;e&&E&&e.clientWidth!==C.current&&e.contentDocument?.body&&D()});let T=(0,r.useRef)(s);return(T.current=s,(0,r.useEffect)(()=>{let e=c.current;if(!e||!d||!E)return;let t=[],n=()=>{let n=e.contentDocument,r=v.current;if(!n?.body||!r)return;let{sourceDoc:a,sourceNodes:l,segments:o}=r;n.querySelectorAll(`[${g}]`).forEach(e=>{let n=Number(e.getAttribute(g)),r=Number(e.getAttribute(b)),i=l[n],s=o[n];if(!i||!s?.[r])return;e.contentEditable="plaintext-only","plaintext-only"!==e.contentEditable&&(e.contentEditable="true"),e.style.outline="none";let d=()=>{s[r].value=e.textContent??"",i.data=s.map(e=>e.value).join("");let t=j(h,a);k.current=t,T.current?.(t)};e.addEventListener("input",d),t.push(()=>{e.removeEventListener("input",d),e.removeAttribute("contenteditable")})}),n.querySelectorAll(`[${x}]`).forEach(e=>{e.contentEditable="false",e.setAttribute("title",e.hasAttribute(y)?"Filled in from your calendar when this sends":"Merge variable, filled in per recipient")});let i=n.createElement("style");i.textContent=` 70 [${g}] { cursor: text; } 71 [${g}]:hover { background: rgba(166, 191, 208, 0.22); border-radius: 3px; } 72 [${g}]:focus { background: rgba(166, 191, 208, 0.34); border-radius: 3px; } 73 [${x}]:not([${y}]) { 74 cursor: default; 75 border-radius: 3px; 76 background: rgba(166, 191, 208, 0.16); 77 box-shadow: 0 0 0 1px rgba(166, 191, 208, 0.34); 78 } 79 [${y}] { display: block; } 80 `,n.head.appendChild(i),t.push(()=>i.remove())};return e.addEventListener("load",n),e.contentDocument?.readyState==="complete"&&n(),()=>{e.removeEventListener("load",n),t.forEach(e=>e())}},[E,h,d]),(0,r.useEffect)(()=>{let e=c.current;if(!e)return;let t=[],n=()=>{D(),window.requestAnimationFrame(()=>D());let n=e.contentDocument;if(n?.body){try{let e=new ResizeObserver(()=>{A.current||D()});e.observe(n.body),t.push(()=>e.disconnect())}catch{}n.querySelectorAll("img").forEach(e=>{if(e.complete)return;let n=()=>D();e.addEventListener("load",n),e.addEventListener("error",n),t.push(()=>{e.removeEventListener("load",n),e.removeEventListener("error",n)})})}try{let n=e.clientWidth,r=new ResizeObserver(()=>{e.clientWidth!==n&&(n=e.clientWidth,D())});r.observe(e),t.push(()=>r.disconnect())}catch{}let r=[150,500,1500,3500,6e3,1e4].map(e=>window.setTimeout(()=>D(),e));t.push(()=>r.forEach(e=>window.clearTimeout(e)));let a=()=>D();window.addEventListener("resize",a),t.push(()=>window.removeEventListener("resize",a))};return e.addEventListener("load",n),e.contentDocument?.readyState==="complete"&&n(),()=>{e.removeEventListener("load",n),t.forEach(e=>e())}},[E,D]),E)?(0,t.jsx)("iframe",{ref:c,srcDoc:E,title:"Email design preview",sandbox:"allow-same-origin allow-popups allow-popups-to-escape-sandbox",className:o,style:{width:"100%",height:i?`${Math.min(u,i)}px`:`${u}px`,border:"none",display:"block",background:N}}):(0,t.jsx)("div",{className:o,style:{height:(0,n.designPx)(360),background:N}})},"buildDesignSrcdoc",0,$,"extractDesignBackground",0,S],33792)},657084,e=>{"use strict";var t=e.i(843476),n=e.i(271645),r=e.i(846696),a=e.i(920755),l=e.i(37727),o=e.i(941388),i=e.i(555436);let s=["#9bbbd4","#BCD2CA","#a3d4c3","#e0c3a3","#d4b89b","#d4a3a3","#d4a3c3","#c3a3d4","#a3c3d4","#c0c0c0"];function d({selected:e,options:r,onAdd:a,onRemove:c,onCreate:u,colorable:p,placeholder:m="Type to searchâ¦",loading:h,emptyText:f="No matches"}
80){let[g,b]=(0,n.useState)(""),[x,y]=(0,n.useState)(!1),[w,k]=(0,n.useState)(!1),[v,E]=(0,n.useState)(s[0]),j=(0,n.useRef)(null),_=(0,n.useRef)(null),S=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(!x)return;let e=()=>{let e=_.current;if(!e)return;let t=e.getBoundingClientRect(),n=window.innerHeight-t.bottom,r=t.top;k(n<280&&r>n)};return e(),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}},[x]);let $=new Set(e.map(e=>e.id)),N=g.trim().toLowerCase(),A=r.filter(e=>!$.has(e.id)&&(!N||e.label.toLowerCase().includes(N))),C=r.some(e=>e.label.toLowerCase()===N)||e.some(e=>e.label.toLowerCase()===N),D=!!u&&N.length>0&&!C;function T(e){a(e),b(""),j.current?.focus()}function M(e){u&&g.trim()&&(u(g.trim(),e),b(""),j.current?.focus())}return(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsxs)("div",{ref:_,className:"flex flex-wrap items-center gap-1.5 rounded-[12px] [corner-shape:squircle] squircle-field-fallback border border-transparent bg-[#FAF9F5] dark:bg-black p-2 min-h-[38px] cursor-text",onClick:()=>j.current?.focus(),children:[e.map(e=>(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full pl-2 pr-1 py-0.5 text-xs",style:p&&e.color?{backgroundColor:e.color+"24",color:"var(--foreground)"}:{backgroundColor:"var(--muted)"},children:[p&&e.color&&(0,t.jsx)("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:e.color}}),(0,t.jsx)("span",{className:"truncate max-w-[160px]",children:e.label}),(0,t.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),c(e.id)}
80,className:"rounded-full p-0.5 hover:bg-foreground/10 transition-colors",children:(0,t.jsx)(l.X,{className:"h-3 w-3"})})]},e.id)),(0,t.jsx)("input",{ref:j,value:g,onChange:e=>{b(e.target.value),y(!0)},onFocus:()=>y(!0),onBlur:()=>{S.current=setTimeout(()=>y(!1),120)},onKeyDown:function(t){if("Enter"===t.key){t.preventDefault();let e=A[0];e?T(e):D&&M(v)}else"Backspace"===t.key&&!g&&e.length>0?c(e[e.length-1].id):"Escape"===t.key&&y(!1)},placeholder:0===e.length?m:"",className:"flex-1 min-w-[80px] bg-transparent text-sm outline-none placeholder:text-muted-foreground/60"})]}),x&&(0,t.jsxs)("div",{className:`absolute z-50 w-full ${w?"bottom-full mb-1":"top-full mt-1"} rounded-[12px] [corner-shape:squircle] squircle-field-fallback border bg-popover p-1 shadow-[0_8px_24px_rgba(0,0,0,0.08)]`,onMouseDown:e=>{e.preventDefault(),S.current&&clearTimeout(S.current)},children:[(0,t.jsx)("div",{className:"max-h-56 overflow-y-auto",children:h?(0,t.jsxs)("p",{className:"px-2.5 py-2 text-xs text-muted-foreground inline-flex items-center gap-1.5",children:[(0,t.jsx)(i.Search,{className:"h-3 w-3"})," Loadingâ¦"]}):0!==A.length||D?A.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>T(e),className:"flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-sm hover:bg-muted",children:[p&&e.color&&(0,t.jsx)("span",{className:"h-2.5 w-2.5 rounded-full shrink-0",style:{backgroundColor:e.color}}),(0,t.jsx)("span",{className:"flex-1 text-left truncate",children:e.label}),e.hint&&(0,t.jsx)("span",{className:"text-[10px] text-muted-foreground shrink-0",children:e.hint})]},e.id)):(0,t.jsx)("p",{className:"px-2.5 py-2 text-xs text-muted-foreground",children:N?f:"Start typingâ¦"})}),D&&(0,t.jsxs)("div",{className:A.length>0?"border-t mt-1 pt-1":"",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>M(p?v:""),className:"flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-sm hover:bg-muted text-muted-foreground",children:[(0,t.jsx)(o.Plus,{className:"h-3.5 w-3.5 shrink-0"}),(0,t.jsxs)("span",{className:"flex-1 text-left truncate",children:["Create â",g.trim(),"â"]}),p&&(0,t.jsx)("span",{className:"h-2.5 w-2.5 rounded-full shrink-0",style:{backgroundColor:v}})]}),p&&(0,t.jsx)("div",{className:"flex items-center gap-1 flex-wrap px-2.5 pb-1.5 pt-1",children:s.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>M(e),className:"h-5 w-5 rounded-full border-2 transition-all",style:{backgroundColor:e,borderColor:v===e?"var(--foreground)":"transparent"},onMouseEnter:()=>E(e),title:"Create with this color"},e))})]})]})]})}s[1],e.s(["TemplateCategoriesField",0,function({value:e,onChange:l,paletteEndpoint:o="/api/template-categories",table:i="email_templates"}){let[s,c]=(0,n.useState)([]),[u,p]=(0,n.useState)([]);(0,n.useEffect)(()=>{fetch(o).then(e=>e.ok?e.json():null).then(e=>e&&c(e.categories||[])).catch(()=>{}),(0,a.createClient)().from(i).select("category").then(({data:e})=>{p(Array.from(new Set((e??[]).flatMap(e=>e.category??[]))).filter(Boolean))})},[o,i]);let m={};for(let e of s)m[e.name]=e.color;let h=Array.from(new Set([...s.map(e=>e.name),...u])).sort();return(0,t.jsx)(d,{colorable:!0,placeholder:"Add a categoryâ¦",selected:e.map(e=>({id:e,label:e,color:m[e]})),options:h.map(e=>({id:e,label:e,color:m[e]})),onAdd:t=>{e.includes(t.label)||l([...e,t.label])},onRemove:t=>l(e.filter(e=>e!==t)),onCreate:async(t,n)=>{try{let r=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t,color:n})});if(!r.ok)throw Error();let a=await r.json();c(e=>[...e.filter(e=>e.name!==a.category.name),a.category]),e.includes(t)||l([...e,t])}catch{r.toast.error("Failed to create category")}}})},"TemplatePersonasField",0,function({side:e,onChanged:l}){let[o,i]=(0,n.useState)([]),[s,c]=(0,n.useState)([]),[u,p]=(0,n.useState)(!0),m="template_id"in e?`template_id=${e.template_id}`:"component_id"in e?`component_id=${e.component_id}`:"framework_id"in e?`framework_id=${e.framework_id}`:`snippet_id=${e.snippet_id}`,h=(0,n.useCallback)(async()=>{let e=await fetch(`/api/icp/messaging-links?${m}`);e.ok&&i(((await e.json()).links??[]).filter(e=>e.persona_profile_id))},[m]);(0,n.useEffect)(()=>{let e=!1;return(async()=>{let t=(0,a.createClient)(),[n,{data:r}]=await Promise.all([fetch(`/api/icp/messaging-links?${m}`).then(e=>e.ok?e.json():{links:[]}),t.from("icp_persona_profiles").select("id, name, tier").order("tier").order("name")]);e||(i((n.links??[]).filter(e=>e.persona_profile_id)),c(r??[]),p(!1))})(),()=>{e=!0}},[m]);let f=new Set(o.map(e=>e.persona_profile_id));async function g(t){let n=await fetch("/api/icp/messaging-links",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...e,persona_profile_id:t})});n.ok||409===n.status?(await h(),l?.()):r.toast.error("Failed to link persona")}async function b(e){i(t=>t.filter(t=>t.id!==e)),await fetch("/api/icp/messaging-links",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e})}),l?.()}return(0,t.jsx)(d,{loading:u,placeholder:"Add a personaâ¦",emptyText:"No persona profiles",selected:o.map(e=>({id:e.id,label:e.persona_profile?.name??"Persona",hint:e.persona_profile?`T${e.persona_profile.tier}`:void 0})),options:s.filter(e=>!f.has(e.id)).map(e=>({id:e.id,label:e.name,hint:`T${e.tier}`})),onAdd:e=>g(e.id),onRemove:e=>b(e)})},"TemplateTagsField",0,function({templateId:e,entityType:a="email_template"}
80){let[l,o]=(0,n.useState)([]),[i,s]=(0,n.useState)([]),[c,u]=(0,n.useState)(!0),p=(0,n.useCallback)(async()=>{let t=await fetch(`/api/tags/entities?entity_type=${a}&entity_ids=${e}`);t.ok&&o((await t.json())[e]||[])},[e,a]);async function m(t){(await fetch("/api/tags/entities",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({entity_type:a,entity_ids:[e],tag_id:t})})).ok?await p():r.toast.error("Failed to apply tag")}async function h(t){o(e=>e.filter(e=>e.id!==t)),await fetch(`/api/tags/entities?entity_type=${a}&entity_id=${e}&tag_id=${t}`,{method:"DELETE"})}return(0,n.useEffect)(()=>{let t=!1;return Promise.all([fetch(`/api/tags/entities?entity_type=${a}&entity_ids=${e}`).then(e=>e.ok?e.json():{}),fetch("/api/tags").then(e=>e.ok?e.json():{tags:[]})]).then(([n,r])=>{t||(o(n[e]||[]),s(r.tags||[]),u(!1))}),()=>{t=!0}},[e,a]),(0,t.jsx)(d,{colorable:!0,loading:c,placeholder:"Add a tagâ¦",selected:l.map(e=>({id:e.id,label:e.name,color:e.color})),options:i.map(e=>({id:e.id,label:e.name,color:e.color})),onAdd:e=>m(e.id),onRemove:e=>h(e),onCreate:async(e,t)=>{try{let n=await fetch("/api/tags",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,color:t||"#9bbbd4"})});if(!n.ok)throw Error();let r=await n.json();s(e=>[...e,r.tag]),await m(r.tag.id)}catch{r.toast.error("Failed to create tag")}}})}],657084)},413754,775481,405794,e=>{"use strict";var t=e.i(843476),n=e.i(899602),r=e.i(643531),a=e.i(167881),l=e.i(463415),o=e.i(647163);e.s(["SortByDropdown",0,function({options:e,sortColumn:i,sortDir:s,onChange:d,className:c}){let u=e.find(e=>e.column===i&&e.dir===s);return(0,t.jsxs)(l.DropdownMenu,{children:[(0,t.jsx)(l.DropdownMenuTrigger,{asChild:!0,children:(0,t.jsxs)(a.Button,{variant:"outline",size:"sm",className:(0,o.cn)("h-8 shrink-0 rounded-full px-3 text-xs",c),children:[(0,t.jsx)(n.ArrowUpDown,{className:"mr-1.5 size-3.5"}),(0,t.jsx)("span",{className:"hidden sm:inline",children:u?u.label:"Sort"})]})}),(0,t.jsx)(l.DropdownMenuContent,{align:"start",className:"w-48",children:e.map(e=>{let n=u?.value===e.value;return(0,t.jsxs)(l.DropdownMenuItem,{onClick:()=>d(e.column,e.dir),className:"text-xs",children:[(0,t.jsx)("span",{className:"flex-1",children:e.label}),n&&(0,t.jsx)(r.Check,{className:"size-3.5 text-muted-foreground"})]},e.value)})})]})}],413754);var i=e.i(852008);e.s(["GroupByDropdown",0,function({options:e,value:n,onChange:s,className:d}){let c=n?e.find(e=>e.value===n):null;return(0,t.jsxs)(l.DropdownMenu,{children:[(0,t.jsx)(l.DropdownMenuTrigger,{asChild:!0,children:(0,t.jsxs)(a.Button,{variant:"outline",size:"sm",className:(0,o.cn)("h-8 shrink-0 rounded-full px-3 text-xs",c&&"border-foreground
80/20 bg-muted",d),children:[(0,t.jsx)(i.Layers,{className:"mr-1.5 size-3.5"}),(0,t.jsx)("span",{className:"hidden sm:inline",children:c?`Group: ${c.label}`:"Group"})]})}),(0,t.jsxs)(l.DropdownMenuContent,{align:"start",className:"w-44",children:[(0,t.jsxs)(l.DropdownMenuItem,{onClick:()=>s(null),className:"text-xs",children:[(0,t.jsx)("span",{className:"flex-1",children:"None"}),!n&&(0,t.jsx)(r.Check,{className:"size-3.5 text-muted-foreground"})]}),e.map(e=>(0,t.jsxs)(l.DropdownMenuItem,{onClick:()=>s(e.value),className:"text-xs",children:[(0,t.jsx)("span",{className:"flex-1",children:e.label}),n===e.value&&(0,t.jsx)(r.Check,{className:"size-3.5 text-muted-foreground"})]},e.value))]})]})}],775481),e.s(["PersonaCell",0,function({names:e}){if(!e||0===e.length)return(0,t.jsx)("span",{className:"text-muted-foreground",children:"-"});let n=e.slice(0,2),r=e.length-n.length;return(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-1",children:[n.map((e,n)=>(0,t.jsx)("span",{className:"inline-flex items-center rounded-full bg-muted px-1.5 py-0.5 text-[10px] text-foreground/80 truncate max-w-[110px]",title:e,children:e},n)),r>0&&(0,t.jsxs)("span",{className:"text-[10px] text-muted-foreground shrink-0",title:e.slice(2).join(", "),children:["+",r]})]})}],405794)},678728,e=>{"use strict";let t=/\{\{=\s*([^}]*?)\s*\}\}/g,n="INSERT label";function r(e){if(!e)return[];let n=[];for(let r of e.matchAll(t))n.push({raw:r[0],label:r[1].trim()});return n}e.s(["DEFAULT_PLACEHOLDER_LABEL",0,n,"PLACEHOLDER_PATTERN",0,t,"collectPlaceholderLabels",0,function(...e){let t=new Set,n=[];for(let a of e)for(let e of r(a)){let r=e.label.toLowerCase();t.has(r)||(t.add(r),n.push(e.label))}return n},"hasUnfilledPlaceholders",0,function(...e){return e.some(e=>r(e).length>0)},"makePlaceholderToken",0,function(e){return`{{=${e.trim()||n}}}`}])},57603,e=>{"use strict";let t=(0,e.i(475254).default)("arrow-up-down",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);e.s(["default",0,t])},899602,e=>{"use strict";var t=e.i(57603);e.s(["ArrowUpDown",()=>t.default])},58763,e=>{"use strict";let t=(0,e.i(475254).default)("folder-plus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);e.s(["default",0,t])},722038,e=>{"use strict";var t=e.i(58763);e.s(["FolderPlus",()=>t.default])},319882,e=>{"use strict";let t=(0,e.i(475254).default)("square-asterisk",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"m8.5 14 7-4",key:"12hpby"}],["path",{d:"m8.5 10 7 4",key:"wwy2dy"}]]);e.s(["default",0,t])}]);
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.