var T=Object.defineProperty;var W=(e)=>e;function R(e,t){this[e]=W.bind(null,t)}var F=(e,t)=>{for(var i in t)T(e,i,{get:t[i],enumerable:!0,configurable:!0,set:R.bind(t,i)})};var j=(e,t)=>()=>(e&&(t=e(e=0)),t);import{Logger as $}from"@contractspec/lib.logger";import{createClient as k,Temv1alpha1 as S}from"@scaleway/sdk";var E={email:"noreply@transactional.contractspec.io",name:"ContractSpec"},A={email:"contact@contractspec.io",name:"ContractSpec Team"},P="fr-par",r=null,l=null,d=(e)=>new S.API(e),L=(e)=>{let t=e?.trim().toLowerCase();if(t==="par"||t==="fr-par")return"fr-par";if(t==="ams"||t==="nl-ams")return"nl-ams";if(t==="waw"||t==="pl-waw")return"pl-waw";return P},x=()=>{if(r)return{ok:!0,config:r};let e=process.env.SCALEWAY_ACCESS_KEY||process.env.SCALEWAY_ACCESS_KEY_QUEUE,t=process.env.SCALEWAY_SECRET_KEY||process.env.SCALEWAY_SECRET_KEY_QUEUE,i=process.env.SCALEWAY_PROJECT_ID;if(!e||!t||!i)return{ok:!1,errorMessage:"Email service is not configured. Please contact us directly at contact@contractspec.io."};let a=L(process.env.SCALEWAY_REGION);return r={accessKey:e,secretKey:t,projectId:i,region:a,defaultZone:`${a}-1`,from:{email:process.env.SCALEWAY_EMAIL_FROM_EMAIL??E.email,name:process.env.SCALEWAY_EMAIL_FROM_NAME??E.name},teamInbox:{email:process.env.SCALEWAY_EMAIL_TEAM_EMAIL??A.email,name:process.env.SCALEWAY_EMAIL_TEAM_NAME??A.name}},{ok:!0,config:r}},N=(e)=>{if(l)return l;let t=k({accessKey:e.accessKey,secretKey:e.secretKey,defaultProjectId:e.projectId,defaultRegion:e.region,defaultZone:e.defaultZone});return l=d(t),l},u=async(e,t)=>{try{return await N(e).createEmail({region:e.region,projectId:e.projectId,from:e.from,to:t.to,subject:t.subject,text:t.text,html:t.html||t.text,additionalHeaders:t.replyTo?[{key:"Reply-To",value:t.replyTo}]:void 0}),{success:!0}}catch(i){return new $().error("scaleway_tem_email_send_failed",{context:t.context??"email",error:i instanceof Error?i.message:i}),{success:!1,error:i,errorMessage:"Failed to send email via Scaleway."}}},U={resetCaches(){l=null,r=null,d=(e)=>new S.API(e)},setApiFactory(e){d=e},setClient(e){l=e}};var o=(e)=>e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;"),c=(e)=>o(e).replaceAll(`
`,"<br />");var Y="Waitlist application service is not configured. Please try again later.",w="Failed to submit application. Please try again later or contact us directly.",Q=async(e)=>{let t=(e.get("email")??"").toString().trim(),i=(e.get("name")??"").toString().trim(),a=(e.get("company")??"").toString().trim(),s=(e.get("role")??"").toString().trim(),p=(e.get("whatBuilding")??"").toString().trim(),m=(e.get("whatSolving")??"").toString().trim(),g=(e.get("teamSize")??"").toString().trim(),f=(e.get("timeline")??"").toString().trim(),h=e.get("openToSessions")==="on",y=e.get("okayWithCaseStudies")==="on";if(!t||!t.includes("@"))return{success:!1,text:"Please enter a valid email address."};if(!i||!p||!m)return{success:!1,text:"Please fill in all required fields."};let n=x();if(!n.ok||!n.config)return{success:!1,text:n.errorMessage??Y};let C=`
You're on the list.

Thanks for applying to the ContractSpec design partner program. We're slowly onboarding design partners in waves. If your use case is a good fit, we'll reach out personally.

What happens next:
• We review applications weekly
• If selected, we'll reach out via email to schedule an intro call
• During early access, you'll get hands-on support and influence over the roadmap

In the meantime:
• Check out our docs: https://contractspec.io/docs
• Book a demo call: https://contractspec.io/contact

We're excited about the possibility of working together!

---
ContractSpec Team
https://contractspec.io
  `.trim(),b=`
    <div style="font-family: sans-serif; max-width: 640px; margin: 0 auto;">
      <h1 style="color: #8b5cf6;">You're on the list.</h1>
      <p>Thanks for applying to the ContractSpec design partner program. We're slowly onboarding design partners in waves. If your use case is a good fit, we'll reach out personally.</p>
      <h2 style="color: #8b5cf6; margin-top: 24px;">What happens next:</h2>
      <ul style="line-height: 1.8;">
        <li>We review applications weekly</li>
        <li>If selected, we'll reach out via email to schedule an intro call</li>
        <li>During early access, you'll get hands-on support and influence over the roadmap</li>
      </ul>
      <h2 style="color: #8b5cf6; margin-top: 24px;">In the meantime:</h2>
      <ul style="line-height: 1.8;">
        <li>Check out our <a href="https://contractspec.io/docs" style="color: #8b5cf6;">docs</a></li>
        <li>Book a demo call: <a href="https://contractspec.io/contact" style="color: #8b5cf6;">contractspec.io/contact</a></li>
      </ul>
      <p>We're excited about the possibility of working together!</p>
      <hr style="margin: 30px 0; border: none; border-top: 1px solid #e5e7eb;" />
      <p style="color: #6b7280; font-size: 14px;">
        ContractSpec Team<br />
        <a href="https://contractspec.io" style="color: #8b5cf6;">contractspec.io</a>
      </p>
    </div>
  `;if(!(await u(n.config,{to:[{email:t}],subject:"You're on the ContractSpec design partner waitlist!",text:C,html:b,context:"waitlist-application-welcome"})).success)return{success:!1,text:w};let v=`
Open to 1:1 product/design sessions: ${h?"Yes":"No"}
Okay with anonymized case studies: ${y?"Yes":"No"}
  `.trim(),_=`
New Design Partner Waitlist Application

Contact Information:
- Name: ${i}
- Email: ${t}
${a?`- Company/Project: ${a}`:""}
${s?`- Role: ${s}`:""}

Application Details:
- What are you building with AI today?
${p}

- What do you hope ContractSpec will solve for you?
${m}

- Team Size: ${g||"Not specified"}
- Timeline: ${f||"Not specified"}

Preferences:
- Open to 1:1 product/design sessions: ${h?"Yes":"No"}
- Okay with anonymized case studies: ${y?"Yes":"No"}

---
Submitted via ContractSpec waitlist application form
  `.trim(),I=`
    <div style="font-family: sans-serif; max-width: 720px; margin: 0 auto;">
      <h1 style="color: #8b5cf6;">New Design Partner Waitlist Application</h1>
      <h2 style="color: #8b5cf6; margin: 16px 0 8px;">Contact Information</h2>
      <ul style="padding-left: 16px; line-height: 1.6; margin: 0 0 16px;">
        <li>Name: ${o(i)}</li>
        <li>Email: ${o(t)}</li>
        ${a?`<li>Company/Project: ${o(a)}</li>`:""}
        ${s?`<li>Role: ${o(s)}</li>`:""}
      </ul>
      <h2 style="color: #8b5cf6; margin: 16px 0 8px;">Application Details</h2>
      <p style="margin: 0 0 8px; font-weight: 600;">What are you building with AI today?</p>
      <div style="border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px; background: #f9fafb; white-space: pre-wrap; line-height: 1.6;">
        ${c(p)}
      </div>
      <p style="margin: 16px 0 8px; font-weight: 600;">What do you hope ContractSpec will solve for you?</p>
      <div style="border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px; background: #f9fafb; white-space: pre-wrap; line-height: 1.6;">
        ${c(m)}
      </div>
      <ul style="padding-left: 16px; line-height: 1.6; margin: 16px 0;">
        <li>Team Size: ${o(g||"Not specified")}</li>
        <li>Timeline: ${o(f||"Not specified")}</li>
      </ul>
      <h2 style="color: #8b5cf6; margin: 16px 0 8px;">Preferences</h2>
      <div style="border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px; background: #f9fafb; line-height: 1.6;">
        ${c(v)}
      </div>
      <p style="color: #6b7280; font-size: 12px; margin-top: 20px;">Submitted via ContractSpec waitlist application form</p>
    </div>
  `;if(!(await u(n.config,{to:[n.config.teamInbox],subject:`New Design Partner Application: ${i} (${t})`,text:_,html:I,replyTo:t,context:"waitlist-application-team-notification"})).success)return{success:!1,text:w};return{success:!0,text:"Application submitted successfully!"}};export{Q as submitWaitlistApplication};
