(()=>{"use strict";let r=!1,i=!1;const o=[],t=new Proxy({},{get:(t,e,n)=>(...t)=>(async(t,e,...n)=>{if(i){if(window.formbricks){const r=t;await window.formbricks[r](...n)}}else if("init"===t){if(r)return void console.warn("🧱 Formbricks - Warning: Formbricks is already initializing.");r=!0;const t=n[0].apiHost,s=await(async(r,i)=>{if(!window.formbricks){const o=await fetch(`${r}/api/packages/${i}`);if(!o.ok)return{ok:!1,error:new Error(`Failed to load Formbricks ${i} SDK`)};const t=await o.text(),e=document.createElement("script");e.innerHTML=t,document.head.appendChild(e);const n=async()=>new Promise(((r,o)=>{const t=setInterval((()=>{window.formbricks&&(clearInterval(t),r())}),100);setTimeout((()=>{clearInterval(t),o(new Error(`Formbricks ${i} SDK loading timed out`))}),1e4)}));try{return await n(),{ok:!0,data:void 0}}catch(r){return{ok:!1,error:new Error(r.message??`Failed to load Formbricks ${i} SDK`)}}}return{ok:!0,data:void 0}})(t,e);if(s.ok&&window.formbricks){window.formbricks.init(...n),r=!1,i=!0;for(const{prop:r,args:i}of o)"function"==typeof window.formbricks[r]?window.formbricks[r](...i):console.error(`🧱 Formbricks - Error: Method ${r} does not exist on formbricks`)}}else console.warn("🧱 Formbricks - Warning: Formbricks not initialized. This method will be queued and executed after initialization."),o.push({prop:t,args:n})})(e,"app",...t)});document.addEventListener("DOMContentLoaded",(()=>{window.tsdk_formbricks={init:r=>{"object"==typeof r.attributes&&(r.attributes={...window.tsdk_survey_attrs,...r.attributes}),t?.init(r)}},window.dispatchEvent(new Event("themeisle:survey:loaded"))}))})();