1import{ah as A,bV as D,Y as Q,ap as U,a9 as a,cr as W,cv as Y,S as G,au as J,aa as d,ac as h,av as V,a4 as $,aQ as K,a2 as e,a3 as q,bt as X,a5 as b,aH as _,b0 as z,aL as H,bT as Z,a8 as g,i as ee,aV as te}from"./gtL6pf2-.js";import{_ as oe}from"./BxY3FqLP.js";import{b as se}from"./CmpFLWgZ.js";import{a as re,o as ne}from"./BiRwdywk.js";const ae=["data-cslp"],le=["id"],ie=["id"],ce={__name:"HubspotForm",props:{heading:{type:String,default:""},description:{type:String,default:""},embedOnly:{type:Boolean,default:!1},theme:{type:String,default:"gray",validator:D},hubspotPortalId:{type:String,required:!0},hubspotFormId:{type:String,required:!0},hubspotFormRegion:{type:String,required:!1,default:""},formNotLoadedMessage:{type:String,required:!0},formLoadingMessage:{type:String,required:!0},stackedComponentSpacing:{type:Boolean,default:!0},containerSize:{type:String,default:"xl"},anchorLink:{type:String,default:""},hiddenFields:{type:Array,required:!1,default:()=>[]},legacyForm:{type:Boolean,default:!0},customCss:{type:String,default:void 0},cssClass:{type:String,default:""},...se},setup(r){const t=r,{blockCslp:y,fieldCslp:v}=Z(()=>t.cslp,()=>t.blockType),p=a(null),S=a(null),P=Q(),k=g(()=>(P.fullPath,ee())),M=()=>{const o=S.value;return o?o.$el??o:null},F=o=>{if(!k.value)return;const s=o.target;if(!(s instanceof Element)||s.closest('.visual-builder__button--edit, [data-testid="visual-builder
1-form"]')||!M()?.contains(s))return;if(p.value?.querySelector(".content[data-cslp]")?.contains(s)){re();return}p.value?.querySelector(".title")?.contains(s)||ne()},{heading:C,description:w,formNotLoadedMessage:I,formLoadingMessage:B}=U(t),E=g(()=>t.theme==="dark"||t.theme==="gray"?"theme-light":"theme-gray"),l=a(t.legacyForm),m=a(null),i=a(!0),f=a(!1),T=l.value===!1?`https://js.hsforms.net/forms/embed/${t.hubspotPortalId}.js`:"https://js.hsforms.net/forms/embed/v2.js",L=`hs-form-embed-script-${l.value===!1?t.hubspotPortalId:"v2"}`,x=g(()=>l.value===!0?{}:{class:"hs-form-frame","data-region":t.hubspotFormRegion,"data-portal-id":t.hubspotPortalId,"data-form-id":t.hubspotFormId}),R=()=>{if(setTimeout(()=>{i.value=!1},5e3),l.value===!0&&typeof window.hbspt=="object"){const o={region:t.hubspotFormRegion,portalId:t.hubspotPortalId,formId:t.hubspotFormId,target:`#form-${t.hubspotFormId}`,onFormSubmitted:function(){m.value&&m.value.scrollIntoView({behavior:"smooth",block:"center"})},onFormReady:function(s){t.hiddenFields.forEach(({name:n,value:c})=>{const u=s.querySelector(`input[name*="${n}"]`);u?u.value=c:console.error(`Hidden field "${n}" not found in the HubSpot form!`)})}};t.customCss!==void 0&&(o.css=t.customCss),t.cssClass&&(o.cssClass=t.cssClass),window.hbspt.forms.create(o)}f.value=!0};W(document,"hs-form-event:on-ready",()=>{t.hiddenFields.forEach(({name:o,value:s})=>{const n=$form.querySelector(`input[name*="${o}"]`);n?n.value=s:console.error(`Hidden field "${o}" not found in the HubSpot form!`)})});const{load:j,unload:N}=Y(T,R,{manual:!0,attrs:{id:L}});return G(async()=>{window.addEventListener("click",F,!0),document.getElementById(L)===null?await j():R()}),J(()=>{window.removeEventListener("click",F,!0),N(),l.value===!1&&(delete window.HubSpotFormsV4,delete window.__HS__FORMS__EMBED__)}),(o,s)=>{const n=X,c=oe,u=K,O=te;return r.embedOnly?(d(),q("div",{key:1,class:z(["hubspot-form-embed",e(E)])},[e(f)?b("",!0):(d(),h(c,{key:0,message:e(i)?e(B):e(I),type:e(i)?"default":"error","alert-wrapper":!1},null,8,["message","type"])),_("div",H({id:`form-${r.hubspotFormId}`,ref_key:"formElement",ref:m},e(x)),null,16,ie)],2)):(d(),h(O,{key:0,ref_key:"sectionRoot",ref:S,class:"hubspot-form-component",spacing:r.stackedComponentSpacing,theme:r.theme,"anchor-link":r.anchorLink,"data-cslp":e(y)},{default:V(()=>[$(u,{class:"blurb-form",size:r.containerSize},{default:V(()=>[e(C)||e(w)?(d(),q("div",{key:0,ref_key:"copyRoot",ref:p},[$(n,{title:e(C),content:e(w),"cslp-title":e(v).heading,"cslp-content":e(v).content},null,8,["title","content","cslp-title","cslp-content"])],512)):b("",!0),_("div",{class:z(["form-wrapper",[e(E),{"form-wrapper--visual-builder":e(k)}]]),"data-cslp":e(y)},[e(f)?b("",!0):(d(),h(c,{key:0,message:e(i)?e(B):e(I),type:e(i)?"default":"error","alert-wrapper":!1},null,8,["message","type"])),_("div",H({id:`form-${r.hubspotFormId}`,ref_key:"formElement",ref:m},e(x)),null,16,le)],10,ae)]),_:1},8,["size"])]),_:1},8,["spacing","theme","anchor-link","data-cslp"]))}}},fe=Object.assign(A(ce,[["__scopeId","data-v-a23bdf00"]]),{__name:"HubspotForm"});export{fe as default};
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.