(()=>{"use strict";let r=!1,e=!1;const t=[],o=new Proxy({},{get:(o,i,n)=>(...o)=>(async(o,...i)=>{if(e){if(window.formbricks){const r=window.formbricks,e=o;await r[e](...i)}}else if("setup"===o){if(r)return void console.warn("🧱 Formbricks - Warning: Formbricks is already initializing.");r=!0;const o=i[0],{appUrl:n,environmentId:s}=o;if(!n)return void console.error("🧱 Formbricks - Error: appUrl is required");if(!s)return void console.error("🧱 Formbricks - Error: environmentId is required");if((await(async r=>{if(!window.formbricks){const e=document.createElement("script");e.type="text/javascript",e.src=`${r}/js/formbricks.umd.cjs`,e.async=!0;const t=async()=>new Promise(((r,t)=>{const o=setTimeout((()=>{t(new Error("Formbricks SDK loading timed out"))}),1e4);e.onload=()=>{clearTimeout(o),r()},e.onerror=()=>{clearTimeout(o),t(new Error("Failed to load Formbricks SDK"))}}));document.head.appendChild(e);try{return await t(),{ok:!0,data:void 0}}catch(r){return{ok:!1,error:new Error(r.message??"Failed to load Formbricks SDK")}}}return{ok:!0,data:void 0}})(n)).ok&&window.formbricks){const o=window.formbricks;o.setup(...i),r=!1,e=!0;for(const{prop:r,args:e}of t)"function"==typeof o[r]?o[r](...e):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."),t.push({prop:o,args:i})})(i,...o)});document.addEventListener("DOMContentLoaded",(()=>{window.tsdk_formbricks={init:async r=>{var e,t;"object"==typeof r&&null!==r||(r={});const i={...window.tsdk_survey_data,...r,attributes:{...null!==(e=window.tsdk_survey_data.attributes)&&void 0!==e?e:{},...null!==(t=r.attributes)&&void 0!==t?t:{}}},{environmentId:n,appUrl:s,attributes:a,userId:d}=i;await(o?.setup({environmentId:n,appUrl:s})),o?.setAttributes(a),function(){const r=localStorage.getItem("formbricks-js");if(!r)return!0;try{const e=JSON.parse(r);if(e?.user?.data?.userId)return!1}catch(r){console.warn(r)}return!0}()&&o?.setUserId(d)}};let r=null;var e;e=window.tsdk_survey_data?.attributes?.install_days_number,isNaN(e)||"boolean"==typeof e||(r=setTimeout((()=>{window.tsdk_formbricks?.init()}),350)),window.addEventListener("themeisle:survey:trigger:cancel",(()=>{clearTimeout(r)})),window.dispatchEvent(new Event("themeisle:survey:loaded"))}))})();