Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@formbricks/js

Package Overview
Dependencies
Maintainers
1
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@formbricks/js - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

2

dist/index.js

@@ -1,2 +0,2 @@

function e(n,r,o){if(!n.s){if(o instanceof t){if(!o.s)return void(o.o=e.bind(null,n,r));1&r&&(r=o.s),o=o.v}if(o&&o.then)return void o.then(e.bind(null,n,r),e.bind(null,n,2));n.s=r,n.v=o;var i=n.o;i&&i(n)}}var t=/*#__PURE__*/function(){function t(){}return t.prototype.then=function(n,r){var o=new t,i=this.s;if(i){var s=1&i?n:r;if(s){try{e(o,1,s(this.v))}catch(t){e(o,2,t)}return o}return this}return this.o=function(t){try{var i=t.v;1&t.s?e(o,1,n?n(i):i):r?e(o,1,r(i)):e(o,2,i)}catch(t){e(o,2,t)}},o},t}();function n(e){return e instanceof t&&1&e.s}var r=/*#__PURE__*/function(){function r(){this.queue=[],this.running=!1}var o=r.prototype;return o.add=function(e){this.queue.push(e),this.running||this.run()},o.run=function(){try{var r=function(){o.running=!1},o=this;o.running=!0;var i=function(r,o,i){for(var s;;){var a=r();if(n(a)&&(a=a.v),!a)return f;if(a.then){s=0;break}var f=i();if(f&&f.then){if(!n(f)){s=1;break}f=f.s}}var l=new t,u=e.bind(null,l,2);return(0===s?a.then(d):1===s?f.then(c):(void 0).then(function(){(a=r())?a.then?a.then(d).then(void 0,u):d(a):e(l,1,f)})).then(void 0,u),l;function c(t){f=t;do{if(!(a=r())||n(a)&&!a.v)return void e(l,1,f);if(a.then)return void a.then(d).then(void 0,u);n(f=i())&&(f=f.v)}while(!f||!f.then);f.then(c).then(void 0,u)}function d(t){t?(f=i())&&f.then?f.then(c).then(void 0,u):c(f):e(l,1,f)}}(function(){return o.queue.length>0},0,function(){var e=o.queue.shift(),t=function(t,n){try{var r=Promise.resolve(e()).then(function(){})}catch(e){return n(e)}return r&&r.then?r.then(void 0,n):r}(0,function(e){console.error(e)});if(t&&t.then)return t.then(function(){})});return Promise.resolve(i&&i.then?i.then(r):r())}catch(e){return Promise.reject(e)}},r}();function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o.apply(this,arguments)}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,f,l,u,c,d={},b=[],p=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function h(e,t){for(var n in t)e[n]=t[n];return e}function _(e){var t=e.parentNode;t&&t.removeChild(e)}function g(e,t,n){var r,o,i,s=arguments,a={};for(i in t)"key"==i?r=t[i]:"ref"==i?o=t[i]:a[i]=t[i];if(arguments.length>3)for(n=[n],i=3;i<arguments.length;i++)n.push(s[i]);if(null!=n&&(a.children=n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===a[i]&&(a[i]=e.defaultProps[i]);return m(e,a,r,o,null)}function m(e,t,n,r,o){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==o?++a.__v:o};return null!=a.vnode&&a.vnode(i),i}function v(e){return e.children}function w(e,t){this.props=e,this.context=t}function y(e,t){if(null==t)return e.__?y(e.__,e.__.__k.indexOf(e)+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?y(e):null}function j(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return j(e)}}function x(e){(!e.__d&&(e.__d=!0)&&f.push(e)&&!k.__r++||u!==a.debounceRendering)&&((u=a.debounceRendering)||l)(k)}function k(){for(var e;k.__r=f.length;)e=f.sort(function(e,t){return e.__v.__b-t.__v.__b}),f=[],e.some(function(e){var t,n,r,o,i,s,a;e.__d&&(s=(i=(t=e).__v).__e,(a=t.__P)&&(n=[],(r=h({},i)).__v=i.__v+1,o=H(a,i,r,t.__n,void 0!==a.ownerSVGElement,null!=i.__h?[s]:null,n,null==s?y(i):s,i.__h),L(n,i),o!=s&&j(i)))})}function P(e,t,n,r,o,i,s,a,f,l){var u,c,p,h,g,w,j,x=r&&r.__k||b,k=x.length;for(f==d&&(f=null!=s?s[0]:k?y(r,0):null),n.__k=[],u=0;u<t.length;u++)if(null!=(h=n.__k[u]=null==(h=t[u])||"boolean"==typeof h?null:"string"==typeof h||"number"==typeof h?m(null,h,null,null,h):Array.isArray(h)?m(v,{children:h},null,null,null):null!=h.__e||null!=h.__c?m(h.type,h.props,h.key,null,h.__v):h)){if(h.__=n,h.__b=n.__b+1,null===(p=x[u])||p&&h.key==p.key&&h.type===p.type)x[u]=void 0;else for(c=0;c<k;c++){if((p=x[c])&&h.key==p.key&&h.type===p.type){x[c]=void 0;break}p=null}g=H(e,h,p=p||d,o,i,s,a,f,l),(c=h.ref)&&p.ref!=c&&(j||(j=[]),p.ref&&j.push(p.ref,null,h),j.push(c,h.__c||g,h)),null!=g?(null==w&&(w=g),f=I(e,h,p,x,s,g,f),l||"option"!=n.type?"function"==typeof n.type&&(n.__d=f):e.value=""):f&&p.__e==f&&f.parentNode!=e&&(f=y(p))}if(n.__e=w,null!=s&&"function"!=typeof n.type)for(u=s.length;u--;)null!=s[u]&&_(s[u]);for(u=k;u--;)null!=x[u]&&z(x[u],x[u]);if(j)for(u=0;u<j.length;u++)q(j[u],j[++u],j[++u])}function I(e,t,n,r,o,i,s){var a,f,l;if(void 0!==t.__d)a=t.__d,t.__d=void 0;else if(o==n||i!=s||null==i.parentNode)e:if(null==s||s.parentNode!==e)e.appendChild(i),a=null;else{for(f=s,l=0;(f=f.nextSibling)&&l<r.length;l+=2)if(f==i)break e;e.insertBefore(i,s),a=s}return void 0!==a?a:i.nextSibling}function S(e,t,n){"-"===t[0]?e.setProperty(t,n):e[t]=null==n?"":"number"!=typeof n||p.test(t)?n:n+"px"}function C(e,t,n,r,o){var i,s,a;if(o&&"className"==t&&(t="class"),"style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||S(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||S(e.style,t,n[t])}else"o"===t[0]&&"n"===t[1]?(i=t!==(t=t.replace(/Capture$/,"")),(s=t.toLowerCase())in e&&(t=s),t=t.slice(2),e.l||(e.l={}),e.l[t+i]=n,a=i?N:E,n?r||e.addEventListener(t,a,i):e.removeEventListener(t,a,i)):"list"!==t&&"tagName"!==t&&"form"!==t&&"type"!==t&&"size"!==t&&"download"!==t&&"href"!==t&&!o&&t in e?e[t]=null==n?"":n:"function"!=typeof n&&"dangerouslySetInnerHTML"!==t&&(t!==(t=t.replace(/xlink:?/,""))?null==n||!1===n?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),n):null==n||!1===n&&!/^ar/.test(t)?e.removeAttribute(t):e.setAttribute(t,n))}function E(e){this.l[e.type+!1](a.event?a.event(e):e)}function N(e){this.l[e.type+!0](a.event?a.event(e):e)}function T(e,t,n){var r,o;for(r=0;r<e.__k.length;r++)(o=e.__k[r])&&(o.__=e,o.__e&&("function"==typeof o.type&&o.__k.length>1&&T(o,t,n),t=I(n,o,o,e.__k,null,o.__e,t),"function"==typeof e.type&&(e.__d=t)))}function H(e,t,n,r,o,i,s,f,l){var u,c,p,_,g,m,y,j,x,k,I,S=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(l=n.__h,f=t.__e=n.__e,t.__h=null,i=[f]),(u=a.__b)&&u(t);try{e:if("function"==typeof S){if(j=t.props,x=(u=S.contextType)&&r[u.__c],k=u?x?x.props.value:u.__:r,n.__c?y=(c=t.__c=n.__c).__=c.__E:("prototype"in S&&S.prototype.render?t.__c=c=new S(j,k):(t.__c=c=new w(j,k),c.constructor=S,c.render=F),x&&x.sub(c),c.props=j,c.state||(c.state={}),c.context=k,c.__n=r,p=c.__d=!0,c.__h=[]),null==c.__s&&(c.__s=c.state),null!=S.getDerivedStateFromProps&&(c.__s==c.state&&(c.__s=h({},c.__s)),h(c.__s,S.getDerivedStateFromProps(j,c.__s))),_=c.props,g=c.state,p)null==S.getDerivedStateFromProps&&null!=c.componentWillMount&&c.componentWillMount(),null!=c.componentDidMount&&c.__h.push(c.componentDidMount);else{if(null==S.getDerivedStateFromProps&&j!==_&&null!=c.componentWillReceiveProps&&c.componentWillReceiveProps(j,k),!c.__e&&null!=c.shouldComponentUpdate&&!1===c.shouldComponentUpdate(j,c.__s,k)||t.__v===n.__v){c.props=j,c.state=c.__s,t.__v!==n.__v&&(c.__d=!1),c.__v=t,t.__e=n.__e,t.__k=n.__k,c.__h.length&&s.push(c),T(t,f,e);break e}null!=c.componentWillUpdate&&c.componentWillUpdate(j,c.__s,k),null!=c.componentDidUpdate&&c.__h.push(function(){c.componentDidUpdate(_,g,m)})}c.context=k,c.props=j,c.state=c.__s,(u=a.__r)&&u(t),c.__d=!1,c.__v=t,c.__P=e,u=c.render(c.props,c.state,c.context),c.state=c.__s,null!=c.getChildContext&&(r=h(h({},r),c.getChildContext())),p||null==c.getSnapshotBeforeUpdate||(m=c.getSnapshotBeforeUpdate(_,g)),I=null!=u&&u.type==v&&null==u.key?u.props.children:u,P(e,Array.isArray(I)?I:[I],t,n,r,o,i,s,f,l),c.base=t.__e,t.__h=null,c.__h.length&&s.push(c),y&&(c.__E=c.__=null),c.__e=!1}else null==i&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=function(e,t,n,r,o,i,s,a){var f,l,u,c,p,h=n.props,_=t.props;if(o="svg"===t.type||o,null!=i)for(f=0;f<i.length;f++)if(null!=(l=i[f])&&((null===t.type?3===l.nodeType:l.localName===t.type)||e==l)){e=l,i[f]=null;break}if(null==e){if(null===t.type)return document.createTextNode(_);e=o?document.createElementNS("http://www.w3.org/2000/svg",t.type):document.createElement(t.type,_.is&&{is:_.is}),i=null,a=!1}if(null===t.type)h===_||a&&e.data===_||(e.data=_);else{if(null!=i&&(i=b.slice.call(e.childNodes)),u=(h=n.props||d).dangerouslySetInnerHTML,c=_.dangerouslySetInnerHTML,!a){if(null!=i)for(h={},p=0;p<e.attributes.length;p++)h[e.attributes[p].name]=e.attributes[p].value;(c||u)&&(c&&(u&&c.__html==u.__html||c.__html===e.innerHTML)||(e.innerHTML=c&&c.__html||""))}(function(e,t,n,r,o){var i;for(i in n)"children"===i||"key"===i||i in t||C(e,i,null,n[i],r);for(i in t)o&&"function"!=typeof t[i]||"children"===i||"key"===i||"value"===i||"checked"===i||n[i]===t[i]||C(e,i,t[i],n[i],r)})(e,_,h,o,a),c?t.__k=[]:(f=t.props.children,P(e,Array.isArray(f)?f:[f],t,n,r,"foreignObject"!==t.type&&o,i,s,d,a)),a||("value"in _&&void 0!==(f=_.value)&&(f!==e.value||"progress"===t.type&&!f)&&C(e,"value",f,h.value,!1),"checked"in _&&void 0!==(f=_.checked)&&f!==e.checked&&C(e,"checked",f,h.checked,!1))}return e}(n.__e,t,n,r,o,i,s,l);(u=a.diffed)&&u(t)}catch(e){t.__v=null,(l||null!=i)&&(t.__e=f,t.__h=!!l,i[i.indexOf(f)]=null),a.__e(e,t,n)}return t.__e}function L(e,t){a.__c&&a.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){a.__e(e,t.__v)}})}function q(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){a.__e(e,n)}}function z(e,t,n){var r,o,i;if(a.unmount&&a.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||q(r,null,t)),n||"function"==typeof e.type||(n=null!=(o=e.__e)),e.__e=e.__d=void 0,null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){a.__e(e,t)}r.base=r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&z(r[i],t,n);null!=o&&_(o)}function F(e,t,n){return this.constructor(e,n)}a={__e:function(e,t){for(var n,r,o,i=t.__h;t=t.__;)if((n=t.__c)&&!n.__)try{if((r=n.constructor)&&null!=r.getDerivedStateFromError&&(n.setState(r.getDerivedStateFromError(e)),o=n.__d),null!=n.componentDidCatch&&(n.componentDidCatch(e),o=n.__d),o)return t.__h=i,n.__E=n}catch(t){e=t}throw e},__v:0},w.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=h({},this.state),"function"==typeof e&&(e=e(h({},n),this.props)),e&&h(n,e),null!=e&&this.__v&&(t&&this.__h.push(t),x(this))},w.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),x(this))},w.prototype.render=v,f=[],l="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,k.__r=0,c=d;var O,A,U,M=0,D=[],W=a.__b,J=a.__r,B=a.diffed,R=a.__c,Q=a.unmount;function G(e,t){a.__h&&a.__h(A,e,M||t),M=0;var n=A.__H||(A.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Y(e){return M=1,function(e,t,n){var r=G(O++,2);return r.t=e,r.__c||(r.__=[ee(void 0,t),function(e){var t=r.t(r.__[0],e);r.__[0]!==t&&(r.__=[t,r.__[1]],r.__c.setState({}))}],r.__c=A),r.__}(ee,e)}function $(e,t){var n=G(O++,3);!a.__s&&function(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}(n.__H,t)&&(n.__=e,n.__H=t,A.__H.__h.push(n))}function V(){D.forEach(function(e){if(e.__P)try{e.__H.__h.forEach(K),e.__H.__h.forEach(Z),e.__H.__h=[]}catch(t){e.__H.__h=[],a.__e(t,e.__v)}}),D=[]}a.__b=function(e){A=null,W&&W(e)},a.__r=function(e){J&&J(e),O=0;var t=(A=e.__c).__H;t&&(t.__h.forEach(K),t.__h.forEach(Z),t.__h=[])},a.diffed=function(e){B&&B(e);var t=e.__c;t&&t.__H&&t.__H.__h.length&&(1!==D.push(t)&&U===a.requestAnimationFrame||((U=a.requestAnimationFrame)||function(e){var t,n=function(){clearTimeout(r),X&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);X&&(t=requestAnimationFrame(n))})(V)),A=void 0},a.__c=function(e,t){t.some(function(e){try{e.__h.forEach(K),e.__h=e.__h.filter(function(e){return!e.__||Z(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],a.__e(n,e.__v)}}),R&&R(e,t)},a.unmount=function(e){Q&&Q(e);var t=e.__c;if(t&&t.__H)try{t.__H.__.forEach(K)}catch(e){a.__e(e,t.__v)}};var X="function"==typeof requestAnimationFrame;function K(e){var t=A;"function"==typeof e.__c&&e.__c(),A=t}function Z(e){var t=A;e.__c=e.__(),A=t}function ee(e,t){return"function"==typeof t?t(e):t}var te=function(){return[].slice.call(arguments).filter(Boolean).join(" ")};function ne(e){var t=e.children,n=e.isOpen,r=e.close,o=Y(!1),i=o[0],s=o[1];return $(function(){s(n)},[n]),g("div",{"aria-live":"assertive",className:"fb-pointer-events-none fb-fixed fb-inset-0 fb-flex fb-items-end fb-px-4 fb-py-6 sm:fb-p-6"},g("div",{className:"fb-flex fb-w-full fb-flex-col fb-items-center fb-space-y-4 sm:fb-items-end"},g("div",{className:te(i?"fb-translate-x-0 fb-opacity-100":"fb-translate-x-28 fb-opacity-0","fb-pointer-events-auto fb-relative fb-w-full fb-max-w-sm fb-overflow-hidden fb-rounded-lg fb-bg-white fb-shadow-lg fb-ring-1 fb-ring-black fb-ring-opacity-5 fb-transition-all fb-duration-500 fb-ease-in-out")},g("div",{class:"fb-absolute fb-top-0 fb-right-0 fb-hidden fb-pt-4 fb-pr-4 sm:fb-block"},g("button",{type:"button",onClick:r,class:"fb-rounded-md fb-bg-white focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 text-slate-400 hover:text-slate-500 focus:ring-slate-500"},g("span",{class:"fb-sr-only"},"Close"),g("svg",{class:"fb-h-6 fb-w-6",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},g("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})))),g("div",{className:""},t))))}var re=function(e,t){try{return Promise.resolve(fetch(t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/displays/"+e+"/responded",{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(e){if(!e.ok)throw new Error("Could not update display")})}catch(e){return Promise.reject(e)}},oe=function(e,t){try{return Promise.resolve(fetch(t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/responses",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){if(!e.ok)throw console.error(e.text),new Error("Could not create response");return Promise.resolve(e.json())})}catch(e){return Promise.reject(e)}};function ie(e){return g("label",{htmlFor:e.questionId,className:"fb-block fb-text-base fb-font-semibold fb-leading-6 fb-mr-8 text-slate-900"},e.headline)}function se(e){return g("label",{for:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600"},e.subheader)}function ae(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return g("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);e.currentTarget[t.id].value="",n(o)}},g(ie,{headline:t.headline,questionId:t.id}),g(se,{subheader:t.subheader,questionId:t.id}),g("div",{className:"fb-mt-4"},g("textarea",{rows:3,name:t.id,id:t.id,placeholder:t.placeholder,required:t.required,className:"fb-block fb-w-full fb-rounded-md fb-border fb-p-2 fb-shadow-sm focus:fb-ring-0 sm:fb-text-sm border-slate-100 bg-slate-50 focus:border-slate-500"})),g("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},g("div",null),g("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function fe(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=Y(null),s=i[0],a=i[1];return g("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);e.currentTarget[t.id].value="",n(o)}},g(ie,{headline:t.headline,questionId:t.id}),g(se,{subheader:t.subheader,questionId:t.id}),g("div",{className:"fb-mt-4"},g("fieldset",null,g("legend",{className:"fb-sr-only"},"Choices"),g("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e){return g("label",{key:e.id,className:te(s===e.label?"fb-z-10 border-slate-400 bg-slate-50":"fb-border-gray-200","fb-relative fb-flex fb-cursor-pointer fb-flex-col fb-rounded-md fb-border fb-p-4 focus:fb-outline-none hover:bg-slate-50")},g("span",{className:"fb-flex fb-items-center fb-text-sm"},g("input",{type:"radio",id:e.id,name:t.id,value:e.label,className:"fb-h-4 fb-w-4 fb-border fb-border-gray-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":e.id+"-label",onChange:function(e){a(e.currentTarget.value)},style:{borderColor:o,color:o}}),g("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),g("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},g("div",null),g("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function le(e){return g("div",{className:"fb-h-1 fb-w-full fb-rounded-full bg-slate-200"},g("div",{className:"fb-h-1 fb-rounded-full",style:{backgroundColor:e.brandColor,width:Math.floor(100*e.progress)+"%"}}))}function ue(e){var t=e.config,n=e.survey,r=e.close,o=e.brandColor,i=Y(n.questions[0]),s=i[0],a=i[1],f=Y(0),l=f[0],u=f[1],c=Y(null),d=c[0],b=c[1],p=Y(null),h=p[0],_=p[1],m=Y(!1),v=m[0],w=m[1];$(function(){!function(){try{Promise.resolve(function(e,t){try{return Promise.resolve(fetch(t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/displays",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){if(!e.ok)throw console.error(e.text),new Error("Could not create display");return Promise.resolve(e.json())})}catch(e){return Promise.reject(e)}}({surveyId:n.id,personId:t.person.id},t)).then(function(e){_(e.id)})}catch(e){return Promise.reject(e)}}()},[t,n]),$(function(){var e;u((e=n.questions.findIndex(function(e){return e.id===s.id}),e/n.questions.length))},[s,n]);var y=function(e){try{var o=function(){w(!1),f?(u(100),r()):a(n.questions[i+1])};w(!0);var i=n.questions.findIndex(function(e){return e.id===s.id}),f=i===n.questions.length-1,l={surveyId:n.id,personId:t.person.id,response:{finished:f,data:e}},c=d?Promise.resolve(function(e,t,n){try{return Promise.resolve(fetch(n.apiHost+"/api/v1/client/environments/"+n.environmentId+"/responses/"+t,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){if(!e.ok)throw new Error("Could not update response");return Promise.resolve(e.json())})}catch(e){return Promise.reject(e)}}(l,d,t)).then(function(){}):Promise.resolve(Promise.all([oe(l,t),re(h,t)])).then(function(e){b(e[0].id)});return Promise.resolve(c&&c.then?c.then(o):o())}catch(e){return Promise.reject(e)}};return g("div",null,g("div",{className:te(v?"fb-animate-pulse fb-opacity-60":"","fb-p-4")},"multipleChoiceSingle"===s.type?g(fe,{question:s,onSubmit:y,lastQuestion:n.questions.findIndex(function(e){return e.id===s.id})===n.questions.length-1,brandColor:o}):"openText"===s.type?g(ae,{question:s,onSubmit:y,lastQuestion:n.questions.findIndex(function(e){return e.id===s.id})===n.questions.length-1,brandColor:o}):null),g("div",{className:"fb-mt-2"},g(le,{progress:l,brandColor:o})))}function ce(e){var t,n=e.config,r=e.survey,o=e.closeSurvey,i=Y(!0),s=i[1],a=function(){s(!1),setTimeout(function(){o()},1e3)};return g("div",{id:"fbjs"},g(ne,{isOpen:i[0],close:a},g(ue,{config:n,survey:r,close:a,brandColor:null==(t=n.settings)?void 0:t.brandColor})))}var de=/*#__PURE__*/function(){function e(){this.config=this.loadFromLocalStorage()}e.getInstance=function(){return e.instance||(e.instance=new e),e.instance};var t=e.prototype;return t.update=function(e){e&&(this.config=o({},this.config,e),this.saveToLocalStorage())},t.get=function(){return this.config},t.loadFromLocalStorage=function(){if("undefined"!=typeof window){var e=localStorage.getItem("config");if(e)return JSON.parse(e)}return{apiHost:null,environmentId:null}},t.saveToLocalStorage=function(){localStorage.setItem("config",JSON.stringify(this.config))},e}();de.instance=void 0;var be=/*#__PURE__*/function(){function e(){this.logLevel="error"}e.getInstance=function(){return e.instance||(e.instance=new e),e.instance};var t=e.prototype;return t.configure=function(e){e&&void 0!==e.logLevel&&(this.logLevel=e.logLevel)},t.logger=function(e,t){if("debug"!==t||"debug"===this.logLevel){var n="🧱 Formbricks - "+(new Date).toISOString()+" ["+t.toUpperCase()+"] - "+e;"error"===t?console.error(n):console.log(n)}},t.debug=function(e){this.logger(e,"debug")},t.error=function(e){this.logger(e,"error")},e}();be.instance=void 0;var pe=be.getInstance(),he=de.getInstance(),_e=function(){try{return Promise.resolve(fetch(he.get().apiHost+"/api/v1/client/environments/"+he.get().environmentId+"/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:he.get().person.id})})).then(function(e){if(!e.ok)throw pe.error("Error getting settings"),Error("Error getting settings");return e.json()})}catch(e){return Promise.reject(e)}},ge="formbricks-web-container",me=de.getInstance(),ve=be.getInstance(),we=!1,ye=function(e){we?ve.debug("A survey is already running. Skipping."):(we=!0,function(e,t,n){var r,o,i;a.__&&a.__(e,t),o=(r=void 0===c)?null:t.__k,e=g(v,null,[e]),i=[],H(t,t.__k=e,o||d,d,void 0!==t.ownerSVGElement,o?null:t.childNodes.length?b.slice.call(t.childNodes):null,i,d,r),L(i,e)}(g(ce,{config:me.get(),survey:e,closeSurvey:je}),document.getElementById(ge)))},je=function(){try{return document.getElementById(ge).innerHTML="",Promise.resolve(_e()).then(function(e){me.update({settings:e}),we=!1})}catch(e){return Promise.reject(e)}},xe=be.getInstance(),ke=de.getInstance(),Pe=function(e,t){try{return Promise.resolve(fetch(ke.get().apiHost+"/api/v1/client/environments/"+ke.get().environmentId+"/events",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:ke.get().session.id,eventName:e,properties:t})})).then(function(t){var n;function r(t){if(n)return t;xe.debug('Formbricks: Event "'+e+'" tracked'),Ie(e)}var o=function(){if(!t.ok)return Promise.resolve(t.json()).then(function(e){xe.error("Formbricks: Error tracking event: "+JSON.stringify(e)),n=1})}();return o&&o.then?o.then(r):r(o)})}catch(e){return Promise.reject(e)}},Ie=function(e){for(var t,n=s(null==(r=ke.get().settings)?void 0:r.surveys);!(t=n()).done;)for(var r,o,i=t.value,a=s(i.triggers);!(o=a()).done;){var f;if((null==(f=o.value.eventClass)?void 0:f.name)===e)return xe.debug("Formbricks: survey "+i.id+' triggered by event "'+e+'"'),void ye(i)}},Se=de.getInstance(),Ce=be.getInstance(),Ee=function(){try{return Ce.debug("Creating new person"),Promise.resolve(fetch(Se.get().apiHost+"/api/v1/client/environments/"+Se.get().environmentId+"/people",{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(e){return e.ok?Promise.resolve(e.json()):(console.error("Formbricks: Error fetching person"),null)})}catch(e){return Promise.reject(e)}},Ne=function(e,t){var n=Se.get().person.attributes.find(function(t){var n;return(null==(n=t.attributeClass)?void 0:n.name)===e});return!(!n||n.value!==t)},Te=be.getInstance(),He=de.getInstance(),Le=function(){try{return He.get().person?Promise.resolve(fetch(He.get().apiHost+"/api/v1/client/environments/"+He.get().environmentId+"/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:He.get().person.id})})).then(function(e){if(e.ok)return Promise.resolve(e.json());Te.error("Error creating session")}):(Te.error("Formbricks: Unable to create session. No person found"),Promise.resolve())}catch(e){return Promise.reject(e)}},qe=function(e){var t=o({},e);return t.expiresAt=Date.now()+36e5,t},ze=function(e){return e.expiresAt<=Date.now()},Fe=de.getInstance(),Oe=be.getInstance(),Ae=function(){var e;Oe.debug("checking page url");var t=null==(e=Fe.get().settings)?void 0:e.noCodeEvents.filter(function(e){var t;return"pageUrl"===(null==(t=e.noCodeConfig)?void 0:t.type)});if(0!==t.length)for(var n,r=s(t);!(n=r()).done;){var o=n.value,i=o.noCodeConfig.pageUrl;i&&Ue(window.location.href,i.value,i.rule)&&Pe(o.name)}};function Ue(e,t,n){switch(n){case"exactMatch":return e===t;case"contains":return e.includes(t);case"startsWith":return e.startsWith(t);case"endsWith":return e.endsWith(t);case"notMatch":return e!==t;case"notContains":return!e.includes(t);default:throw new Error("Invalid match type")}}var Me=de.getInstance(),De=be.getInstance(),We=function(){if(!(Me.get().apiHost&&Me.get().environmentId&&Me.get().person&&Me.get().session&&Me.get().settings))throw Error("Formbricks: Formbricks not initialized. Call initialize() first.")},Je=new r,Be=function(e,t){Je.add(function(){try{return We(),Promise.resolve(function(e,t){try{return Ce.debug("setting attribute: "+e+" to value: "+t),Ne(e,t)?(Ce.debug("attribute already set to this value. Skipping update."),Promise.resolve()):Promise.resolve(function(e,t){try{return Se.get().person&&Se.get().person.id?Promise.resolve(fetch(Se.get().apiHost+"/api/v1/client/environments/"+Se.get().environmentId+"/people/"+Se.get().person.id+"/attribute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e,value:t})})).then(function(e){return Promise.resolve(e.json()).then(function(t){if(!e.ok)throw Ce.error("Error updating person"),Error("Error updating person");return t})}):(console.error("Formbricks: Unable to update attribute. No person set."),Promise.resolve())}catch(e){return Promise.reject(e)}}(e,t)).then(function(e){var t=e.person,n=e.settings;if(!t||!n)throw Ce.error("Error updating attribute"),new Error("Formbricks: Error updating attribute");Se.update({person:t,settings:n})})}catch(e){return Promise.reject(e)}}(e,t)).then(function(){})}catch(e){return Promise.reject(e)}})},Re={init:function(e){Je.add(function(){try{return function(e){try{var t=function(){function e(){(function(){if("undefined"!=typeof window){var e=window.setInterval(function(){try{return Promise.resolve(function(){try{var e=function(e){Te.debug("Session not expired, extending session"),He.update({session:qe(He.get().session)})};Te.debug("Checking session");var t=function(){if(ze(He.get().session))return Te.debug("Session expired, creating new session"),Promise.resolve(Le()).then(function(e){var t=e.session,n=e.settings;if(!t||!n)throw Te.error("Error creating new session"),Error("Error creating new session");He.update({session:t,settings:n}),Pe("New Session")})}();return Promise.resolve(t&&t.then?t.then(e):e())}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}},3e5);window.addEventListener("beforeunload",function(){clearInterval(e)})}})(),"undefined"!=typeof window&&(window.addEventListener("hashchange",Ae),window.addEventListener("popstate",Ae),window.addEventListener("pushstate",Ae),window.addEventListener("replacestate",Ae),window.addEventListener("load",Ae))}var t=function(){if(ze(Me.get().session))return Promise.resolve(Le()).then(function(e){var t=e.settings;Me.update({session:qe(e.session),settings:t}),Pe("New Session")})}();return t&&t.then?t.then(e):e()};if(!e.environmentId)throw Error("Formbricks: environmentId is required");if(!e.apiHost)throw Error("Formbricks: apiHost is required");e.logLevel&&De.configure({logLevel:e.logLevel}),(r=document.createElement("div")).id=ge,document.body.appendChild(r),function(){if(null===document.getElementById("formbricks__css")){var e=document.createElement("style");e.id="formbricks__css",e.innerHTML='#fbjs *,#fbjs :after,#fbjs :before{border:0 solid #e5e7eb;box-sizing:border-box}#fbjs :after,#fbjs :before{--tw-content:""}#fbjs html{-webkit-text-size-adjust:100%;font-feature-settings:normal;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}#fbjs body{line-height:inherit;margin:0}#fbjs hr{border-top-width:1px;color:inherit;height:0}#fbjs abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6{font-size:inherit;font-weight:inherit}#fbjs a{color:inherit;text-decoration:inherit}#fbjs b,#fbjs strong{font-weight:bolder}#fbjs code,#fbjs kbd,#fbjs pre,#fbjs samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}#fbjs small{font-size:80%}#fbjs sub,#fbjs sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}#fbjs sub{bottom:-.25em}#fbjs sup{top:-.5em}#fbjs table{border-collapse:collapse;border-color:inherit;text-indent:0}#fbjs button,#fbjs input,#fbjs optgroup,#fbjs select,#fbjs textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}#fbjs button,#fbjs select{text-transform:none}#fbjs [type=button],#fbjs [type=reset],#fbjs [type=submit],#fbjs button{-webkit-appearance:button;background-color:transparent;background-image:none}#fbjs :-moz-focusring{outline:auto}#fbjs :-moz-ui-invalid{box-shadow:none}#fbjs progress{vertical-align:baseline}#fbjs ::-webkit-inner-spin-button,#fbjs ::-webkit-outer-spin-button{height:auto}#fbjs [type=search]{-webkit-appearance:textfield;outline-offset:-2px}#fbjs ::-webkit-search-decoration{-webkit-appearance:none}#fbjs ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}#fbjs summary{display:list-item}#fbjs blockquote,#fbjs dd,#fbjs dl,#fbjs figure,#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6,#fbjs hr,#fbjs p,#fbjs pre{margin:0}#fbjs fieldset{margin:0;padding:0}#fbjs legend{padding:0}#fbjs menu,#fbjs ol,#fbjs ul{list-style:none;margin:0;padding:0}#fbjs textarea{resize:vertical}#fbjs input::-moz-placeholder,#fbjs textarea::-moz-placeholder{color:#9ca3af;opacity:1}#fbjs input::placeholder,#fbjs textarea::placeholder{color:#9ca3af;opacity:1}#fbjs [role=button],#fbjs button{cursor:pointer}#fbjs :disabled{cursor:default}#fbjs audio,#fbjs canvas,#fbjs embed,#fbjs iframe,#fbjs img,#fbjs object,#fbjs svg,#fbjs video{display:block;vertical-align:middle}#fbjs img,#fbjs video{height:auto;max-width:100%}#fbjs [hidden]{display:none}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }#fbjs .fb-sr-only{clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}#fbjs .fb-pointer-events-none{pointer-events:none}#fbjs .fb-pointer-events-auto{pointer-events:auto}#fbjs .fb-fixed{position:fixed}#fbjs .fb-absolute{position:absolute}#fbjs .fb-relative{position:relative}#fbjs .fb-inset-0{bottom:0;left:0;right:0;top:0}#fbjs .fb-right-0{right:0}#fbjs .fb-top-0{top:0}#fbjs .fb-z-10{z-index:10}#fbjs .fb-ml-3{margin-left:.75rem}#fbjs .fb-mr-8{margin-right:2rem}#fbjs .fb-mt-2{margin-top:.5rem}#fbjs .fb-mt-4{margin-top:1rem}#fbjs .fb-block{display:block}#fbjs .fb-flex{display:flex}#fbjs .fb-hidden{display:none}#fbjs .fb-h-1{height:.25rem}#fbjs .fb-h-4{height:1rem}#fbjs .fb-h-6{height:1.5rem}#fbjs .fb-w-4{width:1rem}#fbjs .fb-w-6{width:1.5rem}#fbjs .fb-w-full{width:100%}#fbjs .fb-max-w-sm{max-width:24rem}#fbjs .fb-translate-x-0{--tw-translate-x:0px}#fbjs .fb-translate-x-0,#fbjs .fb-translate-x-28{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#fbjs .fb-translate-x-28{--tw-translate-x:7rem}@keyframes fb-pulse{50%{opacity:.5}}#fbjs .fb-animate-pulse{animation:fb-pulse 2s cubic-bezier(.4,0,.6,1) infinite}#fbjs .fb-cursor-pointer{cursor:pointer}#fbjs .fb-flex-col{flex-direction:column}#fbjs .fb-items-end{align-items:flex-end}#fbjs .fb-items-center{align-items:center}#fbjs .fb-justify-between{justify-content:space-between}#fbjs .fb-space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}#fbjs .fb-space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}#fbjs .fb-overflow-hidden{overflow:hidden}#fbjs .fb-rounded-full{border-radius:9999px}#fbjs .fb-rounded-lg{border-radius:.5rem}#fbjs .fb-rounded-md{border-radius:.375rem}#fbjs .fb-border{border-width:1px}#fbjs .fb-border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}#fbjs .fb-border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity))}#fbjs .fb-border-transparent{border-color:transparent}#fbjs .fb-bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}#fbjs .fb-p-2{padding:.5rem}#fbjs .fb-p-4{padding:1rem}#fbjs .fb-px-3{padding-left:.75rem;padding-right:.75rem}#fbjs .fb-px-4{padding-left:1rem;padding-right:1rem}#fbjs .fb-py-3{padding-bottom:.75rem;padding-top:.75rem}#fbjs .fb-py-6{padding-bottom:1.5rem;padding-top:1.5rem}#fbjs .fb-pr-4{padding-right:1rem}#fbjs .fb-pt-4{padding-top:1rem}#fbjs .fb-text-base{font-size:1rem;line-height:1.5rem}#fbjs .fb-text-sm{font-size:.875rem;line-height:1.25rem}#fbjs .fb-font-medium{font-weight:500}#fbjs .fb-font-normal{font-weight:400}#fbjs .fb-font-semibold{font-weight:600}#fbjs .fb-leading-4{line-height:1rem}#fbjs .fb-leading-6{line-height:1.5rem}#fbjs .fb-text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}#fbjs .fb-opacity-0{opacity:0}#fbjs .fb-opacity-100{opacity:1}#fbjs .fb-opacity-60{opacity:.6}#fbjs .fb-shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}#fbjs .fb-shadow-lg,#fbjs .fb-shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs .fb-shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}#fbjs .fb-ring-1{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs .fb-ring-black{--tw-ring-opacity:1;--tw-ring-color:rgb(0 0 0/var(--tw-ring-opacity))}#fbjs .fb-ring-opacity-5{--tw-ring-opacity:0.05}#fbjs .fb-transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs .fb-duration-500{transition-duration:.5s}#fbjs .fb-ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs .hover\\:fb-opacity-90:hover{opacity:.9}#fbjs .focus\\:fb-outline-none:focus{outline:2px solid transparent;outline-offset:2px}#fbjs .focus\\:fb-ring-0:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color)}#fbjs .focus\\:fb-ring-0:focus,#fbjs .focus\\:fb-ring-2:focus{box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs .focus\\:fb-ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color)}#fbjs .focus\\:fb-ring-offset-0:focus{--tw-ring-offset-width:0px}#fbjs .focus\\:fb-ring-offset-2:focus{--tw-ring-offset-width:2px}@media (min-width:640px){#fbjs .sm\\:fb-block{display:block}#fbjs .sm\\:fb-items-end{align-items:flex-end}#fbjs .sm\\:fb-p-6{padding:1.5rem}#fbjs .sm\\:fb-text-sm{font-size:.875rem;line-height:1.25rem}}',document.head.appendChild(e)}}();var n=function(){if(!Me||Me.get().environmentId!==e.environmentId||Me.get().apiHost!==e.apiHost)return Me.update({environmentId:e.environmentId,apiHost:e.apiHost}),Promise.resolve(Ee()).then(function(e){var t=e.settings;Me.update({person:e.person,session:qe(e.session),settings:t}),Pe("New Session")})}();return Promise.resolve(n&&n.then?n.then(t):t())}catch(e){return Promise.reject(e)}var r}(e),Promise.resolve()}catch(e){return Promise.reject(e)}})},setUserId:function(e){Je.add(function(){try{return We(),Promise.resolve(function(e){try{return Ce.debug("setting userId: "+e),Ne("userId",e)?(Ce.debug("userId already set to this value. Skipping update."),Promise.resolve()):(t=Se.get().person.attributes.find(function(e){var t;return"userId"===(null==(t=e.attributeClass)?void 0:t.name)}),t?(Ce.error("userId cannot be changed after it has been set. You need to reset first"),Promise.resolve()):Promise.resolve(function(e){try{return Se.get().person&&Se.get().person.id?Promise.resolve(fetch(Se.get().apiHost+"/api/v1/client/environments/"+Se.get().environmentId+"/people/"+Se.get().person.id+"/user-id",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,sessionId:Se.get().session.id})})).then(function(e){if(!e.ok)throw Ce.error("Formbricks: Error updating person"),Error("Error updating person");return Promise.resolve(e.json())}):(console.error("Formbricks: Unable to update userId. No person set."),Promise.resolve())}catch(e){return Promise.reject(e)}}(e)).then(function(e){Se.update({person:e.person,settings:e.settings})}))}catch(e){return Promise.reject(e)}var t}(e)).then(function(){})}catch(e){return Promise.reject(e)}})},setEmail:function(e){Be("email",e)},setAttribute:Be,track:function(e,t){void 0===t&&(t={}),Je.add(function(){try{return We(),Promise.resolve(Pe(e,t)).then(function(){})}catch(e){return Promise.reject(e)}})},logout:function(){Je.add(function(){try{return We(),Promise.resolve(function(){try{return Ce.debug("Resetting person. Getting new person, session and settings from backend"),Promise.resolve(Ee()).then(function(e){var t=e.person,n=e.session,r=e.settings;if(!t||!n||!r)throw Ce.error("Error resetting user"),new Error("Formbricks: Error resetting user");Se.update({person:t,session:n,settings:r})})}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}})},refresh:function(){Je.add(function(){try{return We(),Promise.resolve(function(){try{return pe.debug("Refreshing - getting settings from backend"),Promise.resolve(_e()).then(function(e){he.update({settings:e})})}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}})},registerRouteChange:function(){console.log("fire!!!"),Je.add(function(){try{return We(),Ae(),Promise.resolve()}catch(e){return Promise.reject(e)}})}};"undefined"!=typeof window&&(window.formbricks=Re),module.exports=Re;
function e(n,r,o){if(!n.s){if(o instanceof t){if(!o.s)return void(o.o=e.bind(null,n,r));1&r&&(r=o.s),o=o.v}if(o&&o.then)return void o.then(e.bind(null,n,r),e.bind(null,n,2));n.s=r,n.v=o;var i=n.o;i&&i(n)}}var t=/*#__PURE__*/function(){function t(){}return t.prototype.then=function(n,r){var o=new t,i=this.s;if(i){var s=1&i?n:r;if(s){try{e(o,1,s(this.v))}catch(t){e(o,2,t)}return o}return this}return this.o=function(t){try{var i=t.v;1&t.s?e(o,1,n?n(i):i):r?e(o,1,r(i)):e(o,2,i)}catch(t){e(o,2,t)}},o},t}();function n(e){return e instanceof t&&1&e.s}var r=/*#__PURE__*/function(){function r(){this.queue=[],this.running=!1}var o=r.prototype;return o.add=function(e){this.queue.push(e),this.running||this.run()},o.run=function(){try{var r=function(){o.running=!1},o=this;o.running=!0;var i=function(r,o,i){for(var s;;){var a=r();if(n(a)&&(a=a.v),!a)return f;if(a.then){s=0;break}var f=i();if(f&&f.then){if(!n(f)){s=1;break}f=f.s}}var l=new t,u=e.bind(null,l,2);return(0===s?a.then(d):1===s?f.then(c):(void 0).then(function(){(a=r())?a.then?a.then(d).then(void 0,u):d(a):e(l,1,f)})).then(void 0,u),l;function c(t){f=t;do{if(!(a=r())||n(a)&&!a.v)return void e(l,1,f);if(a.then)return void a.then(d).then(void 0,u);n(f=i())&&(f=f.v)}while(!f||!f.then);f.then(c).then(void 0,u)}function d(t){t?(f=i())&&f.then?f.then(c).then(void 0,u):c(f):e(l,1,f)}}(function(){return o.queue.length>0},0,function(){var e=o.queue.shift(),t=function(t,n){try{var r=Promise.resolve(e()).then(function(){})}catch(e){return n(e)}return r&&r.then?r.then(void 0,n):r}(0,function(e){console.error(e)});if(t&&t.then)return t.then(function(){})});return Promise.resolve(i&&i.then?i.then(r):r())}catch(e){return Promise.reject(e)}},r}();function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o.apply(this,arguments)}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,f,l,u,c,d={},b=[],p=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function h(e,t){for(var n in t)e[n]=t[n];return e}function _(e){var t=e.parentNode;t&&t.removeChild(e)}function g(e,t,n){var r,o,i,s=arguments,a={};for(i in t)"key"==i?r=t[i]:"ref"==i?o=t[i]:a[i]=t[i];if(arguments.length>3)for(n=[n],i=3;i<arguments.length;i++)n.push(s[i]);if(null!=n&&(a.children=n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===a[i]&&(a[i]=e.defaultProps[i]);return m(e,a,r,o,null)}function m(e,t,n,r,o){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==o?++a.__v:o};return null!=a.vnode&&a.vnode(i),i}function v(e){return e.children}function w(e,t){this.props=e,this.context=t}function y(e,t){if(null==t)return e.__?y(e.__,e.__.__k.indexOf(e)+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?y(e):null}function j(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return j(e)}}function x(e){(!e.__d&&(e.__d=!0)&&f.push(e)&&!k.__r++||u!==a.debounceRendering)&&((u=a.debounceRendering)||l)(k)}function k(){for(var e;k.__r=f.length;)e=f.sort(function(e,t){return e.__v.__b-t.__v.__b}),f=[],e.some(function(e){var t,n,r,o,i,s,a;e.__d&&(s=(i=(t=e).__v).__e,(a=t.__P)&&(n=[],(r=h({},i)).__v=i.__v+1,o=H(a,i,r,t.__n,void 0!==a.ownerSVGElement,null!=i.__h?[s]:null,n,null==s?y(i):s,i.__h),L(n,i),o!=s&&j(i)))})}function P(e,t,n,r,o,i,s,a,f,l){var u,c,p,h,g,w,j,x=r&&r.__k||b,k=x.length;for(f==d&&(f=null!=s?s[0]:k?y(r,0):null),n.__k=[],u=0;u<t.length;u++)if(null!=(h=n.__k[u]=null==(h=t[u])||"boolean"==typeof h?null:"string"==typeof h||"number"==typeof h?m(null,h,null,null,h):Array.isArray(h)?m(v,{children:h},null,null,null):null!=h.__e||null!=h.__c?m(h.type,h.props,h.key,null,h.__v):h)){if(h.__=n,h.__b=n.__b+1,null===(p=x[u])||p&&h.key==p.key&&h.type===p.type)x[u]=void 0;else for(c=0;c<k;c++){if((p=x[c])&&h.key==p.key&&h.type===p.type){x[c]=void 0;break}p=null}g=H(e,h,p=p||d,o,i,s,a,f,l),(c=h.ref)&&p.ref!=c&&(j||(j=[]),p.ref&&j.push(p.ref,null,h),j.push(c,h.__c||g,h)),null!=g?(null==w&&(w=g),f=I(e,h,p,x,s,g,f),l||"option"!=n.type?"function"==typeof n.type&&(n.__d=f):e.value=""):f&&p.__e==f&&f.parentNode!=e&&(f=y(p))}if(n.__e=w,null!=s&&"function"!=typeof n.type)for(u=s.length;u--;)null!=s[u]&&_(s[u]);for(u=k;u--;)null!=x[u]&&z(x[u],x[u]);if(j)for(u=0;u<j.length;u++)q(j[u],j[++u],j[++u])}function I(e,t,n,r,o,i,s){var a,f,l;if(void 0!==t.__d)a=t.__d,t.__d=void 0;else if(o==n||i!=s||null==i.parentNode)e:if(null==s||s.parentNode!==e)e.appendChild(i),a=null;else{for(f=s,l=0;(f=f.nextSibling)&&l<r.length;l+=2)if(f==i)break e;e.insertBefore(i,s),a=s}return void 0!==a?a:i.nextSibling}function S(e,t,n){"-"===t[0]?e.setProperty(t,n):e[t]=null==n?"":"number"!=typeof n||p.test(t)?n:n+"px"}function C(e,t,n,r,o){var i,s,a;if(o&&"className"==t&&(t="class"),"style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||S(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||S(e.style,t,n[t])}else"o"===t[0]&&"n"===t[1]?(i=t!==(t=t.replace(/Capture$/,"")),(s=t.toLowerCase())in e&&(t=s),t=t.slice(2),e.l||(e.l={}),e.l[t+i]=n,a=i?N:E,n?r||e.addEventListener(t,a,i):e.removeEventListener(t,a,i)):"list"!==t&&"tagName"!==t&&"form"!==t&&"type"!==t&&"size"!==t&&"download"!==t&&"href"!==t&&!o&&t in e?e[t]=null==n?"":n:"function"!=typeof n&&"dangerouslySetInnerHTML"!==t&&(t!==(t=t.replace(/xlink:?/,""))?null==n||!1===n?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),n):null==n||!1===n&&!/^ar/.test(t)?e.removeAttribute(t):e.setAttribute(t,n))}function E(e){this.l[e.type+!1](a.event?a.event(e):e)}function N(e){this.l[e.type+!0](a.event?a.event(e):e)}function T(e,t,n){var r,o;for(r=0;r<e.__k.length;r++)(o=e.__k[r])&&(o.__=e,o.__e&&("function"==typeof o.type&&o.__k.length>1&&T(o,t,n),t=I(n,o,o,e.__k,null,o.__e,t),"function"==typeof e.type&&(e.__d=t)))}function H(e,t,n,r,o,i,s,f,l){var u,c,p,_,g,m,y,j,x,k,I,S=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(l=n.__h,f=t.__e=n.__e,t.__h=null,i=[f]),(u=a.__b)&&u(t);try{e:if("function"==typeof S){if(j=t.props,x=(u=S.contextType)&&r[u.__c],k=u?x?x.props.value:u.__:r,n.__c?y=(c=t.__c=n.__c).__=c.__E:("prototype"in S&&S.prototype.render?t.__c=c=new S(j,k):(t.__c=c=new w(j,k),c.constructor=S,c.render=F),x&&x.sub(c),c.props=j,c.state||(c.state={}),c.context=k,c.__n=r,p=c.__d=!0,c.__h=[]),null==c.__s&&(c.__s=c.state),null!=S.getDerivedStateFromProps&&(c.__s==c.state&&(c.__s=h({},c.__s)),h(c.__s,S.getDerivedStateFromProps(j,c.__s))),_=c.props,g=c.state,p)null==S.getDerivedStateFromProps&&null!=c.componentWillMount&&c.componentWillMount(),null!=c.componentDidMount&&c.__h.push(c.componentDidMount);else{if(null==S.getDerivedStateFromProps&&j!==_&&null!=c.componentWillReceiveProps&&c.componentWillReceiveProps(j,k),!c.__e&&null!=c.shouldComponentUpdate&&!1===c.shouldComponentUpdate(j,c.__s,k)||t.__v===n.__v){c.props=j,c.state=c.__s,t.__v!==n.__v&&(c.__d=!1),c.__v=t,t.__e=n.__e,t.__k=n.__k,c.__h.length&&s.push(c),T(t,f,e);break e}null!=c.componentWillUpdate&&c.componentWillUpdate(j,c.__s,k),null!=c.componentDidUpdate&&c.__h.push(function(){c.componentDidUpdate(_,g,m)})}c.context=k,c.props=j,c.state=c.__s,(u=a.__r)&&u(t),c.__d=!1,c.__v=t,c.__P=e,u=c.render(c.props,c.state,c.context),c.state=c.__s,null!=c.getChildContext&&(r=h(h({},r),c.getChildContext())),p||null==c.getSnapshotBeforeUpdate||(m=c.getSnapshotBeforeUpdate(_,g)),I=null!=u&&u.type==v&&null==u.key?u.props.children:u,P(e,Array.isArray(I)?I:[I],t,n,r,o,i,s,f,l),c.base=t.__e,t.__h=null,c.__h.length&&s.push(c),y&&(c.__E=c.__=null),c.__e=!1}else null==i&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=function(e,t,n,r,o,i,s,a){var f,l,u,c,p,h=n.props,_=t.props;if(o="svg"===t.type||o,null!=i)for(f=0;f<i.length;f++)if(null!=(l=i[f])&&((null===t.type?3===l.nodeType:l.localName===t.type)||e==l)){e=l,i[f]=null;break}if(null==e){if(null===t.type)return document.createTextNode(_);e=o?document.createElementNS("http://www.w3.org/2000/svg",t.type):document.createElement(t.type,_.is&&{is:_.is}),i=null,a=!1}if(null===t.type)h===_||a&&e.data===_||(e.data=_);else{if(null!=i&&(i=b.slice.call(e.childNodes)),u=(h=n.props||d).dangerouslySetInnerHTML,c=_.dangerouslySetInnerHTML,!a){if(null!=i)for(h={},p=0;p<e.attributes.length;p++)h[e.attributes[p].name]=e.attributes[p].value;(c||u)&&(c&&(u&&c.__html==u.__html||c.__html===e.innerHTML)||(e.innerHTML=c&&c.__html||""))}(function(e,t,n,r,o){var i;for(i in n)"children"===i||"key"===i||i in t||C(e,i,null,n[i],r);for(i in t)o&&"function"!=typeof t[i]||"children"===i||"key"===i||"value"===i||"checked"===i||n[i]===t[i]||C(e,i,t[i],n[i],r)})(e,_,h,o,a),c?t.__k=[]:(f=t.props.children,P(e,Array.isArray(f)?f:[f],t,n,r,"foreignObject"!==t.type&&o,i,s,d,a)),a||("value"in _&&void 0!==(f=_.value)&&(f!==e.value||"progress"===t.type&&!f)&&C(e,"value",f,h.value,!1),"checked"in _&&void 0!==(f=_.checked)&&f!==e.checked&&C(e,"checked",f,h.checked,!1))}return e}(n.__e,t,n,r,o,i,s,l);(u=a.diffed)&&u(t)}catch(e){t.__v=null,(l||null!=i)&&(t.__e=f,t.__h=!!l,i[i.indexOf(f)]=null),a.__e(e,t,n)}return t.__e}function L(e,t){a.__c&&a.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){a.__e(e,t.__v)}})}function q(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){a.__e(e,n)}}function z(e,t,n){var r,o,i;if(a.unmount&&a.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||q(r,null,t)),n||"function"==typeof e.type||(n=null!=(o=e.__e)),e.__e=e.__d=void 0,null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){a.__e(e,t)}r.base=r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&z(r[i],t,n);null!=o&&_(o)}function F(e,t,n){return this.constructor(e,n)}a={__e:function(e,t){for(var n,r,o,i=t.__h;t=t.__;)if((n=t.__c)&&!n.__)try{if((r=n.constructor)&&null!=r.getDerivedStateFromError&&(n.setState(r.getDerivedStateFromError(e)),o=n.__d),null!=n.componentDidCatch&&(n.componentDidCatch(e),o=n.__d),o)return t.__h=i,n.__E=n}catch(t){e=t}throw e},__v:0},w.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=h({},this.state),"function"==typeof e&&(e=e(h({},n),this.props)),e&&h(n,e),null!=e&&this.__v&&(t&&this.__h.push(t),x(this))},w.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),x(this))},w.prototype.render=v,f=[],l="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,k.__r=0,c=d;var O,A,U,M=0,D=[],W=a.__b,J=a.__r,B=a.diffed,R=a.__c,Q=a.unmount;function G(e,t){a.__h&&a.__h(A,e,M||t),M=0;var n=A.__H||(A.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Y(e){return M=1,function(e,t,n){var r=G(O++,2);return r.t=e,r.__c||(r.__=[ee(void 0,t),function(e){var t=r.t(r.__[0],e);r.__[0]!==t&&(r.__=[t,r.__[1]],r.__c.setState({}))}],r.__c=A),r.__}(ee,e)}function $(e,t){var n=G(O++,3);!a.__s&&function(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}(n.__H,t)&&(n.__=e,n.__H=t,A.__H.__h.push(n))}function V(){D.forEach(function(e){if(e.__P)try{e.__H.__h.forEach(K),e.__H.__h.forEach(Z),e.__H.__h=[]}catch(t){e.__H.__h=[],a.__e(t,e.__v)}}),D=[]}a.__b=function(e){A=null,W&&W(e)},a.__r=function(e){J&&J(e),O=0;var t=(A=e.__c).__H;t&&(t.__h.forEach(K),t.__h.forEach(Z),t.__h=[])},a.diffed=function(e){B&&B(e);var t=e.__c;t&&t.__H&&t.__H.__h.length&&(1!==D.push(t)&&U===a.requestAnimationFrame||((U=a.requestAnimationFrame)||function(e){var t,n=function(){clearTimeout(r),X&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);X&&(t=requestAnimationFrame(n))})(V)),A=void 0},a.__c=function(e,t){t.some(function(e){try{e.__h.forEach(K),e.__h=e.__h.filter(function(e){return!e.__||Z(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],a.__e(n,e.__v)}}),R&&R(e,t)},a.unmount=function(e){Q&&Q(e);var t=e.__c;if(t&&t.__H)try{t.__H.__.forEach(K)}catch(e){a.__e(e,t.__v)}};var X="function"==typeof requestAnimationFrame;function K(e){var t=A;"function"==typeof e.__c&&e.__c(),A=t}function Z(e){var t=A;e.__c=e.__(),A=t}function ee(e,t){return"function"==typeof t?t(e):t}var te=function(){return[].slice.call(arguments).filter(Boolean).join(" ")};function ne(e){var t=e.children,n=e.isOpen,r=e.close,o=Y(!1),i=o[0],s=o[1];return $(function(){s(n)},[n]),g("div",{"aria-live":"assertive",className:"fb-pointer-events-none fb-fixed fb-inset-0 fb-flex fb-items-end fb-px-4 fb-py-6 sm:fb-p-6"},g("div",{className:"fb-flex fb-w-full fb-flex-col fb-items-center fb-space-y-4 sm:fb-items-end"},g("div",{className:te(i?"fb-translate-x-0 fb-opacity-100":"fb-translate-x-28 fb-opacity-0","fb-pointer-events-auto fb-relative fb-w-full fb-max-w-sm fb-overflow-hidden fb-rounded-lg fb-bg-white fb-shadow-lg fb-ring-1 fb-ring-black fb-ring-opacity-5 fb-transition-all fb-duration-500 fb-ease-in-out")},g("div",{class:"fb-absolute fb-top-0 fb-right-0 fb-hidden fb-pt-4 fb-pr-4 sm:fb-block"},g("button",{type:"button",onClick:r,class:"fb-rounded-md fb-bg-white focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 text-slate-400 hover:text-slate-500 focus:ring-slate-500"},g("span",{class:"fb-sr-only"},"Close"),g("svg",{class:"fb-h-6 fb-w-6",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},g("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})))),g("div",{className:""},t))))}var re=function(e,t){try{return Promise.resolve(fetch(t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/displays/"+e+"/responded",{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(e){if(!e.ok)throw new Error("Could not update display")})}catch(e){return Promise.reject(e)}},oe=function(e,t){try{return Promise.resolve(fetch(t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/responses",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){if(!e.ok)throw console.error(e.text),new Error("Could not create response");return Promise.resolve(e.json())})}catch(e){return Promise.reject(e)}};function ie(e){return g("label",{htmlFor:e.questionId,className:"fb-block fb-text-base fb-font-semibold fb-leading-6 fb-mr-8 text-slate-900"},e.headline)}function se(e){return g("label",{for:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600"},e.subheader)}function ae(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return g("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);e.currentTarget[t.id].value="",n(o)}},g(ie,{headline:t.headline,questionId:t.id}),g(se,{subheader:t.subheader,questionId:t.id}),g("div",{className:"fb-mt-4"},g("textarea",{rows:3,name:t.id,id:t.id,placeholder:t.placeholder,required:t.required,className:"fb-block fb-w-full fb-rounded-md fb-border fb-p-2 fb-shadow-sm focus:fb-ring-0 sm:fb-text-sm border-slate-100 bg-slate-50 focus:border-slate-500"})),g("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},g("div",null),g("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function fe(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=Y(null),s=i[0],a=i[1];return g("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);e.currentTarget[t.id].value="",n(o)}},g(ie,{headline:t.headline,questionId:t.id}),g(se,{subheader:t.subheader,questionId:t.id}),g("div",{className:"fb-mt-4"},g("fieldset",null,g("legend",{className:"fb-sr-only"},"Choices"),g("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e){return g("label",{key:e.id,className:te(s===e.label?"fb-z-10 border-slate-400 bg-slate-50":"fb-border-gray-200","fb-relative fb-flex fb-cursor-pointer fb-flex-col fb-rounded-md fb-border fb-p-4 focus:fb-outline-none hover:bg-slate-50")},g("span",{className:"fb-flex fb-items-center fb-text-sm"},g("input",{type:"radio",id:e.id,name:t.id,value:e.label,className:"fb-h-4 fb-w-4 fb-border fb-border-gray-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":e.id+"-label",onChange:function(e){a(e.currentTarget.value)},style:{borderColor:o,color:o}}),g("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),g("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},g("div",null),g("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function le(e){return g("div",{className:"fb-h-1 fb-w-full fb-rounded-full bg-slate-200"},g("div",{className:"fb-h-1 fb-rounded-full",style:{backgroundColor:e.brandColor,width:Math.floor(100*e.progress)+"%"}}))}function ue(e){var t=e.config,n=e.survey,r=e.close,o=e.brandColor,i=Y(n.questions[0]),s=i[0],a=i[1],f=Y(0),l=f[0],u=f[1],c=Y(null),d=c[0],b=c[1],p=Y(null),h=p[0],_=p[1],m=Y(!1),v=m[0],w=m[1];$(function(){!function(){try{Promise.resolve(function(e,t){try{return Promise.resolve(fetch(t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/displays",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){if(!e.ok)throw console.error(e.text),new Error("Could not create display");return Promise.resolve(e.json())})}catch(e){return Promise.reject(e)}}({surveyId:n.id,personId:t.person.id},t)).then(function(e){_(e.id)})}catch(e){return Promise.reject(e)}}()},[t,n]),$(function(){var e;u((e=n.questions.findIndex(function(e){return e.id===s.id}),e/n.questions.length))},[s,n]);var y=function(e){try{var o=function(){w(!1),f?(u(100),r()):a(n.questions[i+1])};w(!0);var i=n.questions.findIndex(function(e){return e.id===s.id}),f=i===n.questions.length-1,l={surveyId:n.id,personId:t.person.id,response:{finished:f,data:e}},c=d?Promise.resolve(function(e,t,n){try{return Promise.resolve(fetch(n.apiHost+"/api/v1/client/environments/"+n.environmentId+"/responses/"+t,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){if(!e.ok)throw new Error("Could not update response");return Promise.resolve(e.json())})}catch(e){return Promise.reject(e)}}(l,d,t)).then(function(){}):Promise.resolve(Promise.all([oe(l,t),re(h,t)])).then(function(e){b(e[0].id)});return Promise.resolve(c&&c.then?c.then(o):o())}catch(e){return Promise.reject(e)}};return g("div",null,g("div",{className:te(v?"fb-animate-pulse fb-opacity-60":"","fb-p-4")},"multipleChoiceSingle"===s.type?g(fe,{question:s,onSubmit:y,lastQuestion:n.questions.findIndex(function(e){return e.id===s.id})===n.questions.length-1,brandColor:o}):"openText"===s.type?g(ae,{question:s,onSubmit:y,lastQuestion:n.questions.findIndex(function(e){return e.id===s.id})===n.questions.length-1,brandColor:o}):null),g("div",{className:"fb-mt-2"},g(le,{progress:l,brandColor:o})))}function ce(e){var t,n=e.config,r=e.survey,o=e.closeSurvey,i=Y(!0),s=i[1],a=function(){s(!1),setTimeout(function(){o()},1e3)};return g("div",{id:"fbjs"},g(ne,{isOpen:i[0],close:a},g(ue,{config:n,survey:r,close:a,brandColor:null==(t=n.settings)?void 0:t.brandColor})))}var de=/*#__PURE__*/function(){function e(){this.config=this.loadFromLocalStorage()}e.getInstance=function(){return e.instance||(e.instance=new e),e.instance};var t=e.prototype;return t.update=function(e){e&&(this.config=o({},this.config,e),this.saveToLocalStorage())},t.get=function(){return this.config},t.loadFromLocalStorage=function(){if("undefined"!=typeof window){var e=localStorage.getItem("config");if(e)return JSON.parse(e)}return{apiHost:null,environmentId:null}},t.saveToLocalStorage=function(){localStorage.setItem("config",JSON.stringify(this.config))},e}();de.instance=void 0;var be=/*#__PURE__*/function(){function e(){this.logLevel="error"}e.getInstance=function(){return e.instance||(e.instance=new e),e.instance};var t=e.prototype;return t.configure=function(e){e&&void 0!==e.logLevel&&(this.logLevel=e.logLevel)},t.logger=function(e,t){if("debug"!==t||"debug"===this.logLevel){var n="🧱 Formbricks - "+(new Date).toISOString()+" ["+t.toUpperCase()+"] - "+e;"error"===t?console.error(n):console.log(n)}},t.debug=function(e){this.logger(e,"debug")},t.error=function(e){this.logger(e,"error")},e}();be.instance=void 0;var pe=be.getInstance(),he=de.getInstance(),_e=function(){try{return Promise.resolve(fetch(he.get().apiHost+"/api/v1/client/environments/"+he.get().environmentId+"/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:he.get().person.id})})).then(function(e){if(!e.ok)throw pe.error("Error getting settings"),Error("Error getting settings");return e.json()})}catch(e){return Promise.reject(e)}},ge="formbricks-web-container",me=de.getInstance(),ve=be.getInstance(),we=!1,ye=function(e){we?ve.debug("A survey is already running. Skipping."):(we=!0,function(e,t,n){var r,o,i;a.__&&a.__(e,t),o=(r=void 0===c)?null:t.__k,e=g(v,null,[e]),i=[],H(t,t.__k=e,o||d,d,void 0!==t.ownerSVGElement,o?null:t.childNodes.length?b.slice.call(t.childNodes):null,i,d,r),L(i,e)}(g(ce,{config:me.get(),survey:e,closeSurvey:je}),document.getElementById(ge)))},je=function(){try{return document.getElementById(ge).innerHTML="",Promise.resolve(_e()).then(function(e){me.update({settings:e}),we=!1})}catch(e){return Promise.reject(e)}},xe=be.getInstance(),ke=de.getInstance(),Pe=function(e,t){try{return Promise.resolve(fetch(ke.get().apiHost+"/api/v1/client/environments/"+ke.get().environmentId+"/events",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:ke.get().session.id,eventName:e,properties:t})})).then(function(t){var n;function r(t){if(n)return t;xe.debug('Formbricks: Event "'+e+'" tracked'),Ie(e)}var o=function(){if(!t.ok)return Promise.resolve(t.json()).then(function(e){xe.error("Formbricks: Error tracking event: "+JSON.stringify(e)),n=1})}();return o&&o.then?o.then(r):r(o)})}catch(e){return Promise.reject(e)}},Ie=function(e){for(var t,n=s(null==(r=ke.get().settings)?void 0:r.surveys);!(t=n()).done;)for(var r,o,i=t.value,a=s(i.triggers);!(o=a()).done;){var f;if((null==(f=o.value.eventClass)?void 0:f.name)===e)return xe.debug("Formbricks: survey "+i.id+' triggered by event "'+e+'"'),void ye(i)}},Se=de.getInstance(),Ce=be.getInstance(),Ee=function(){try{return Ce.debug("Creating new person"),Promise.resolve(fetch(Se.get().apiHost+"/api/v1/client/environments/"+Se.get().environmentId+"/people",{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(e){return e.ok?Promise.resolve(e.json()):(console.error("Formbricks: Error fetching person"),null)})}catch(e){return Promise.reject(e)}},Ne=function(e,t){var n=Se.get().person.attributes.find(function(t){var n;return(null==(n=t.attributeClass)?void 0:n.name)===e});return!(!n||n.value!==t)},Te=be.getInstance(),He=de.getInstance(),Le=function(){try{return He.get().person?Promise.resolve(fetch(He.get().apiHost+"/api/v1/client/environments/"+He.get().environmentId+"/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:He.get().person.id})})).then(function(e){if(e.ok)return Promise.resolve(e.json());Te.error("Error creating session")}):(Te.error("Formbricks: Unable to create session. No person found"),Promise.resolve())}catch(e){return Promise.reject(e)}},qe=function(e){var t=o({},e);return t.expiresAt=Date.now()+36e5,t},ze=function(e){return e.expiresAt<=Date.now()},Fe=de.getInstance(),Oe=be.getInstance(),Ae=function(){var e;Oe.debug("checking page url");var t=null==(e=Fe.get().settings)?void 0:e.noCodeEvents.filter(function(e){var t;return"pageUrl"===(null==(t=e.noCodeConfig)?void 0:t.type)});if(0!==t.length)for(var n,r=s(t);!(n=r()).done;){var o=n.value,i=o.noCodeConfig.pageUrl;i&&Ue(window.location.href,i.value,i.rule)&&Pe(o.name)}};function Ue(e,t,n){switch(n){case"exactMatch":return e===t;case"contains":return e.includes(t);case"startsWith":return e.startsWith(t);case"endsWith":return e.endsWith(t);case"notMatch":return e!==t;case"notContains":return!e.includes(t);default:throw new Error("Invalid match type")}}var Me=de.getInstance(),De=be.getInstance(),We=function(){if(!(Me.get().apiHost&&Me.get().environmentId&&Me.get().person&&Me.get().session&&Me.get().settings))throw Error("Formbricks: Formbricks not initialized. Call initialize() first.")},Je=new r,Be=function(e,t){Je.add(function(){try{return We(),Promise.resolve(function(e,t){try{return Ce.debug("setting attribute: "+e+" to value: "+t),Ne(e,t)?(Ce.debug("attribute already set to this value. Skipping update."),Promise.resolve()):Promise.resolve(function(e,t){try{return Se.get().person&&Se.get().person.id?Promise.resolve(fetch(Se.get().apiHost+"/api/v1/client/environments/"+Se.get().environmentId+"/people/"+Se.get().person.id+"/attribute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e,value:t})})).then(function(e){return Promise.resolve(e.json()).then(function(t){if(!e.ok)throw Ce.error("Error updating person"),Error("Error updating person");return t})}):(console.error("Formbricks: Unable to update attribute. No person set."),Promise.resolve())}catch(e){return Promise.reject(e)}}(e,t)).then(function(e){var t=e.person,n=e.settings;if(!t||!n)throw Ce.error("Error updating attribute"),new Error("Formbricks: Error updating attribute");Se.update({person:t,settings:n})})}catch(e){return Promise.reject(e)}}(e,t)).then(function(){})}catch(e){return Promise.reject(e)}})},Re={init:function(e){Je.add(function(){try{return function(e){try{var t=function(){function e(){(function(){if("undefined"!=typeof window){var e=window.setInterval(function(){try{return Promise.resolve(function(){try{var e=function(e){Te.debug("Session not expired, extending session"),He.update({session:qe(He.get().session)})};Te.debug("Checking session");var t=function(){if(ze(He.get().session))return Te.debug("Session expired, creating new session"),Promise.resolve(Le()).then(function(e){var t=e.session,n=e.settings;if(!t||!n)throw Te.error("Error creating new session"),Error("Error creating new session");He.update({session:t,settings:n}),Pe("New Session")})}();return Promise.resolve(t&&t.then?t.then(e):e())}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}},3e5);window.addEventListener("beforeunload",function(){clearInterval(e)})}})(),"undefined"!=typeof window&&(window.addEventListener("hashchange",Ae),window.addEventListener("popstate",Ae),window.addEventListener("pushstate",Ae),window.addEventListener("replacestate",Ae),window.addEventListener("load",Ae))}var t=function(){if(ze(Me.get().session))return Promise.resolve(Le()).then(function(e){var t=e.settings;Me.update({session:qe(e.session),settings:t}),Pe("New Session")})}();return t&&t.then?t.then(e):e()};if(!e.environmentId)throw Error("Formbricks: environmentId is required");if(!e.apiHost)throw Error("Formbricks: apiHost is required");e.logLevel&&De.configure({logLevel:e.logLevel}),(r=document.createElement("div")).id=ge,document.body.appendChild(r),function(){if(null===document.getElementById("formbricks__css")){var e=document.createElement("style");e.id="formbricks__css",e.innerHTML='#fbjs *,#fbjs :after,#fbjs :before{border:0 solid #e5e7eb;box-sizing:border-box}#fbjs :after,#fbjs :before{--tw-content:""}#fbjs html{-webkit-text-size-adjust:100%;font-feature-settings:normal;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}#fbjs body{line-height:inherit;margin:0}#fbjs hr{border-top-width:1px;color:inherit;height:0}#fbjs abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6{font-size:inherit;font-weight:inherit}#fbjs a{color:inherit;text-decoration:inherit}#fbjs b,#fbjs strong{font-weight:bolder}#fbjs code,#fbjs kbd,#fbjs pre,#fbjs samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}#fbjs small{font-size:80%}#fbjs sub,#fbjs sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}#fbjs sub{bottom:-.25em}#fbjs sup{top:-.5em}#fbjs table{border-collapse:collapse;border-color:inherit;text-indent:0}#fbjs button,#fbjs input,#fbjs optgroup,#fbjs select,#fbjs textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}#fbjs button,#fbjs select{text-transform:none}#fbjs [type=button],#fbjs [type=reset],#fbjs [type=submit],#fbjs button{-webkit-appearance:button;background-color:transparent;background-image:none}#fbjs :-moz-focusring{outline:auto}#fbjs :-moz-ui-invalid{box-shadow:none}#fbjs progress{vertical-align:baseline}#fbjs ::-webkit-inner-spin-button,#fbjs ::-webkit-outer-spin-button{height:auto}#fbjs [type=search]{-webkit-appearance:textfield;outline-offset:-2px}#fbjs ::-webkit-search-decoration{-webkit-appearance:none}#fbjs ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}#fbjs summary{display:list-item}#fbjs blockquote,#fbjs dd,#fbjs dl,#fbjs figure,#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6,#fbjs hr,#fbjs p,#fbjs pre{margin:0}#fbjs fieldset{margin:0;padding:0}#fbjs legend{padding:0}#fbjs menu,#fbjs ol,#fbjs ul{list-style:none;margin:0;padding:0}#fbjs textarea{resize:vertical}#fbjs input::-moz-placeholder,#fbjs textarea::-moz-placeholder{color:#9ca3af;opacity:1}#fbjs input::placeholder,#fbjs textarea::placeholder{color:#9ca3af;opacity:1}#fbjs [role=button],#fbjs button{cursor:pointer}#fbjs :disabled{cursor:default}#fbjs audio,#fbjs canvas,#fbjs embed,#fbjs iframe,#fbjs img,#fbjs object,#fbjs svg,#fbjs video{display:block;vertical-align:middle}#fbjs img,#fbjs video{height:auto;max-width:100%}#fbjs [hidden]{display:none}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }#fbjs .fb-sr-only{clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}#fbjs .fb-pointer-events-none{pointer-events:none}#fbjs .fb-pointer-events-auto{pointer-events:auto}#fbjs .fb-fixed{position:fixed}#fbjs .fb-absolute{position:absolute}#fbjs .fb-relative{position:relative}#fbjs .fb-inset-0{bottom:0;left:0;right:0;top:0}#fbjs .fb-right-0{right:0}#fbjs .fb-top-0{top:0}#fbjs .fb-z-10{z-index:10}#fbjs .fb-ml-3{margin-left:.75rem}#fbjs .fb-mr-8{margin-right:2rem}#fbjs .fb-mt-2{margin-top:.5rem}#fbjs .fb-mt-4{margin-top:1rem}#fbjs .fb-block{display:block}#fbjs .fb-flex{display:flex}#fbjs .fb-hidden{display:none}#fbjs .fb-h-1{height:.25rem}#fbjs .fb-h-4{height:1rem}#fbjs .fb-h-6{height:1.5rem}#fbjs .fb-w-4{width:1rem}#fbjs .fb-w-6{width:1.5rem}#fbjs .fb-w-full{width:100%}#fbjs .fb-max-w-sm{max-width:24rem}#fbjs .fb-translate-x-0{--tw-translate-x:0px}#fbjs .fb-translate-x-0,#fbjs .fb-translate-x-28{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#fbjs .fb-translate-x-28{--tw-translate-x:7rem}@keyframes fb-pulse{50%{opacity:.5}}#fbjs .fb-animate-pulse{animation:fb-pulse 2s cubic-bezier(.4,0,.6,1) infinite}#fbjs .fb-cursor-pointer{cursor:pointer}#fbjs .fb-flex-col{flex-direction:column}#fbjs .fb-items-end{align-items:flex-end}#fbjs .fb-items-center{align-items:center}#fbjs .fb-justify-between{justify-content:space-between}#fbjs .fb-space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}#fbjs .fb-space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}#fbjs .fb-overflow-hidden{overflow:hidden}#fbjs .fb-rounded-full{border-radius:9999px}#fbjs .fb-rounded-lg{border-radius:.5rem}#fbjs .fb-rounded-md{border-radius:.375rem}#fbjs .fb-border{border-width:1px}#fbjs .fb-border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}#fbjs .fb-border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity))}#fbjs .fb-border-transparent{border-color:transparent}#fbjs .fb-bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}#fbjs .fb-p-2{padding:.5rem}#fbjs .fb-p-4{padding:1rem}#fbjs .fb-px-3{padding-left:.75rem;padding-right:.75rem}#fbjs .fb-px-4{padding-left:1rem;padding-right:1rem}#fbjs .fb-py-3{padding-bottom:.75rem;padding-top:.75rem}#fbjs .fb-py-6{padding-bottom:1.5rem;padding-top:1.5rem}#fbjs .fb-pr-4{padding-right:1rem}#fbjs .fb-pt-4{padding-top:1rem}#fbjs .fb-text-base{font-size:1rem;line-height:1.5rem}#fbjs .fb-text-sm{font-size:.875rem;line-height:1.25rem}#fbjs .fb-font-medium{font-weight:500}#fbjs .fb-font-normal{font-weight:400}#fbjs .fb-font-semibold{font-weight:600}#fbjs .fb-leading-4{line-height:1rem}#fbjs .fb-leading-6{line-height:1.5rem}#fbjs .fb-text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}#fbjs .fb-opacity-0{opacity:0}#fbjs .fb-opacity-100{opacity:1}#fbjs .fb-opacity-60{opacity:.6}#fbjs .fb-shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}#fbjs .fb-shadow-lg,#fbjs .fb-shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs .fb-shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}#fbjs .fb-ring-1{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs .fb-ring-black{--tw-ring-opacity:1;--tw-ring-color:rgb(0 0 0/var(--tw-ring-opacity))}#fbjs .fb-ring-opacity-5{--tw-ring-opacity:0.05}#fbjs .fb-transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs .fb-duration-500{transition-duration:.5s}#fbjs .fb-ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs .hover\\:fb-opacity-90:hover{opacity:.9}#fbjs .focus\\:fb-outline-none:focus{outline:2px solid transparent;outline-offset:2px}#fbjs .focus\\:fb-ring-0:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color)}#fbjs .focus\\:fb-ring-0:focus,#fbjs .focus\\:fb-ring-2:focus{box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs .focus\\:fb-ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color)}#fbjs .focus\\:fb-ring-offset-0:focus{--tw-ring-offset-width:0px}#fbjs .focus\\:fb-ring-offset-2:focus{--tw-ring-offset-width:2px}@media (min-width:640px){#fbjs .sm\\:fb-block{display:block}#fbjs .sm\\:fb-items-end{align-items:flex-end}#fbjs .sm\\:fb-p-6{padding:1.5rem}#fbjs .sm\\:fb-text-sm{font-size:.875rem;line-height:1.25rem}}',document.head.appendChild(e)}}();var n=function(){if(!Me||Me.get().environmentId!==e.environmentId||Me.get().apiHost!==e.apiHost)return Me.update({environmentId:e.environmentId,apiHost:e.apiHost}),Promise.resolve(Ee()).then(function(e){var t=e.settings;Me.update({person:e.person,session:qe(e.session),settings:t}),Pe("New Session")})}();return Promise.resolve(n&&n.then?n.then(t):t())}catch(e){return Promise.reject(e)}var r}(e),Promise.resolve()}catch(e){return Promise.reject(e)}})},setUserId:function(e){Je.add(function(){try{return We(),Promise.resolve(function(e){try{return Ce.debug("setting userId: "+e),Ne("userId",e)?(Ce.debug("userId already set to this value. Skipping update."),Promise.resolve()):(t=Se.get().person.attributes.find(function(e){var t;return"userId"===(null==(t=e.attributeClass)?void 0:t.name)}),t?(Ce.error("userId cannot be changed after it has been set. You need to reset first"),Promise.resolve()):Promise.resolve(function(e){try{return Se.get().person&&Se.get().person.id?Promise.resolve(fetch(Se.get().apiHost+"/api/v1/client/environments/"+Se.get().environmentId+"/people/"+Se.get().person.id+"/user-id",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,sessionId:Se.get().session.id})})).then(function(e){if(!e.ok)throw Ce.error("Formbricks: Error updating person"),Error("Error updating person");return Promise.resolve(e.json())}):(console.error("Formbricks: Unable to update userId. No person set."),Promise.resolve())}catch(e){return Promise.reject(e)}}(e)).then(function(e){Se.update({person:e.person,settings:e.settings})}))}catch(e){return Promise.reject(e)}var t}(e)).then(function(){})}catch(e){return Promise.reject(e)}})},setEmail:function(e){Be("email",e)},setAttribute:Be,track:function(e,t){void 0===t&&(t={}),Je.add(function(){try{return We(),Promise.resolve(Pe(e,t)).then(function(){})}catch(e){return Promise.reject(e)}})},logout:function(){Je.add(function(){try{return We(),Promise.resolve(function(){try{return Ce.debug("Resetting person. Getting new person, session and settings from backend"),Promise.resolve(Ee()).then(function(e){var t=e.person,n=e.session,r=e.settings;if(!t||!n||!r)throw Ce.error("Error resetting user"),new Error("Formbricks: Error resetting user");Se.update({person:t,session:n,settings:r})})}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}})},refresh:function(){Je.add(function(){try{return We(),Promise.resolve(function(){try{return pe.debug("Refreshing - getting settings from backend"),Promise.resolve(_e()).then(function(e){he.update({settings:e})})}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}})},registerRouteChange:function(){Je.add(function(){try{return We(),Ae(),Promise.resolve()}catch(e){return Promise.reject(e)}})}};module.exports=Re;
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

var e,t,n,o,r,s={},i=[],a=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function f(e,t){for(var n in t)e[n]=t[n];return e}function l(e){var t=e.parentNode;t&&t.removeChild(e)}function d(e,t,n){var o,r,s,i=arguments,a={};for(s in t)"key"==s?o=t[s]:"ref"==s?r=t[s]:a[s]=t[s];if(arguments.length>3)for(n=[n],s=3;s<arguments.length;s++)n.push(i[s]);if(null!=n&&(a.children=n),"function"==typeof e&&null!=e.defaultProps)for(s in e.defaultProps)void 0===a[s]&&(a[s]=e.defaultProps[s]);return c(e,a,o,r,null)}function c(t,n,o,r,s){var i={type:t,props:n,key:o,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==s?++e.__v:s};return null!=e.vnode&&e.vnode(i),i}function b(e){return e.children}function u(e,t){this.props=e,this.context=t}function p(e,t){if(null==t)return e.__?p(e.__,e.__.__k.indexOf(e)+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?p(e):null}function _(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return _(e)}}function g(r){(!r.__d&&(r.__d=!0)&&t.push(r)&&!h.__r++||o!==e.debounceRendering)&&((o=e.debounceRendering)||n)(h)}function h(){for(var e;h.__r=t.length;)e=t.sort(function(e,t){return e.__v.__b-t.__v.__b}),t=[],e.some(function(e){var t,n,o,r,s,i,a;e.__d&&(i=(s=(t=e).__v).__e,(a=t.__P)&&(n=[],(o=f({},s)).__v=s.__v+1,r=I(a,s,o,t.__n,void 0!==a.ownerSVGElement,null!=s.__h?[i]:null,n,null==i?p(s):i,s.__h),S(n,s),r!=i&&_(s)))})}function w(e,t,n,o,r,a,f,d,u,_){var g,h,w,v,y,j,x,k=o&&o.__k||i,S=k.length;for(u==s&&(u=null!=f?f[0]:S?p(o,0):null),n.__k=[],g=0;g<t.length;g++)if(null!=(v=n.__k[g]=null==(v=t[g])||"boolean"==typeof v?null:"string"==typeof v||"number"==typeof v?c(null,v,null,null,v):Array.isArray(v)?c(b,{children:v},null,null,null):null!=v.__e||null!=v.__c?c(v.type,v.props,v.key,null,v.__v):v)){if(v.__=n,v.__b=n.__b+1,null===(w=k[g])||w&&v.key==w.key&&v.type===w.type)k[g]=void 0;else for(h=0;h<S;h++){if((w=k[h])&&v.key==w.key&&v.type===w.type){k[h]=void 0;break}w=null}y=I(e,v,w=w||s,r,a,f,d,u,_),(h=v.ref)&&w.ref!=h&&(x||(x=[]),w.ref&&x.push(w.ref,null,v),x.push(h,v.__c||y,v)),null!=y?(null==j&&(j=y),u=m(e,v,w,k,f,y,u),_||"option"!=n.type?"function"==typeof n.type&&(n.__d=u):e.value=""):u&&w.__e==u&&u.parentNode!=e&&(u=p(w))}if(n.__e=j,null!=f&&"function"!=typeof n.type)for(g=f.length;g--;)null!=f[g]&&l(f[g]);for(g=S;g--;)null!=k[g]&&E(k[g],k[g]);if(x)for(g=0;g<x.length;g++)C(x[g],x[++g],x[++g])}function m(e,t,n,o,r,s,i){var a,f,l;if(void 0!==t.__d)a=t.__d,t.__d=void 0;else if(r==n||s!=i||null==s.parentNode)e:if(null==i||i.parentNode!==e)e.appendChild(s),a=null;else{for(f=i,l=0;(f=f.nextSibling)&&l<o.length;l+=2)if(f==s)break e;e.insertBefore(s,i),a=i}return void 0!==a?a:s.nextSibling}function v(e,t,n){"-"===t[0]?e.setProperty(t,n):e[t]=null==n?"":"number"!=typeof n||a.test(t)?n:n+"px"}function y(e,t,n,o,r){var s,i,a;if(r&&"className"==t&&(t="class"),"style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof o&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||v(e.style,t,"");if(n)for(t in n)o&&n[t]===o[t]||v(e.style,t,n[t])}else"o"===t[0]&&"n"===t[1]?(s=t!==(t=t.replace(/Capture$/,"")),(i=t.toLowerCase())in e&&(t=i),t=t.slice(2),e.l||(e.l={}),e.l[t+s]=n,a=s?x:j,n?o||e.addEventListener(t,a,s):e.removeEventListener(t,a,s)):"list"!==t&&"tagName"!==t&&"form"!==t&&"type"!==t&&"size"!==t&&"download"!==t&&"href"!==t&&!r&&t in e?e[t]=null==n?"":n:"function"!=typeof n&&"dangerouslySetInnerHTML"!==t&&(t!==(t=t.replace(/xlink:?/,""))?null==n||!1===n?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),n):null==n||!1===n&&!/^ar/.test(t)?e.removeAttribute(t):e.setAttribute(t,n))}function j(t){this.l[t.type+!1](e.event?e.event(t):t)}function x(t){this.l[t.type+!0](e.event?e.event(t):t)}function k(e,t,n){var o,r;for(o=0;o<e.__k.length;o++)(r=e.__k[o])&&(r.__=e,r.__e&&("function"==typeof r.type&&r.__k.length>1&&k(r,t,n),t=m(n,r,r,e.__k,null,r.__e,t),"function"==typeof e.type&&(e.__d=t)))}function I(t,n,o,r,a,l,d,c,p){var _,g,h,m,v,j,x,I,S,C,E,T=n.type;if(void 0!==n.constructor)return null;null!=o.__h&&(p=o.__h,c=n.__e=o.__e,n.__h=null,l=[c]),(_=e.__b)&&_(n);try{e:if("function"==typeof T){if(I=n.props,S=(_=T.contextType)&&r[_.__c],C=_?S?S.props.value:_.__:r,o.__c?x=(g=n.__c=o.__c).__=g.__E:("prototype"in T&&T.prototype.render?n.__c=g=new T(I,C):(n.__c=g=new u(I,C),g.constructor=T,g.render=N),S&&S.sub(g),g.props=I,g.state||(g.state={}),g.context=C,g.__n=r,h=g.__d=!0,g.__h=[]),null==g.__s&&(g.__s=g.state),null!=T.getDerivedStateFromProps&&(g.__s==g.state&&(g.__s=f({},g.__s)),f(g.__s,T.getDerivedStateFromProps(I,g.__s))),m=g.props,v=g.state,h)null==T.getDerivedStateFromProps&&null!=g.componentWillMount&&g.componentWillMount(),null!=g.componentDidMount&&g.__h.push(g.componentDidMount);else{if(null==T.getDerivedStateFromProps&&I!==m&&null!=g.componentWillReceiveProps&&g.componentWillReceiveProps(I,C),!g.__e&&null!=g.shouldComponentUpdate&&!1===g.shouldComponentUpdate(I,g.__s,C)||n.__v===o.__v){g.props=I,g.state=g.__s,n.__v!==o.__v&&(g.__d=!1),g.__v=n,n.__e=o.__e,n.__k=o.__k,g.__h.length&&d.push(g),k(n,c,t);break e}null!=g.componentWillUpdate&&g.componentWillUpdate(I,g.__s,C),null!=g.componentDidUpdate&&g.__h.push(function(){g.componentDidUpdate(m,v,j)})}g.context=C,g.props=I,g.state=g.__s,(_=e.__r)&&_(n),g.__d=!1,g.__v=n,g.__P=t,_=g.render(g.props,g.state,g.context),g.state=g.__s,null!=g.getChildContext&&(r=f(f({},r),g.getChildContext())),h||null==g.getSnapshotBeforeUpdate||(j=g.getSnapshotBeforeUpdate(m,v)),E=null!=_&&_.type==b&&null==_.key?_.props.children:_,w(t,Array.isArray(E)?E:[E],n,o,r,a,l,d,c,p),g.base=n.__e,n.__h=null,g.__h.length&&d.push(g),x&&(g.__E=g.__=null),g.__e=!1}else null==l&&n.__v===o.__v?(n.__k=o.__k,n.__e=o.__e):n.__e=function(e,t,n,o,r,a,f,l){var d,c,b,u,p,_=n.props,g=t.props;if(r="svg"===t.type||r,null!=a)for(d=0;d<a.length;d++)if(null!=(c=a[d])&&((null===t.type?3===c.nodeType:c.localName===t.type)||e==c)){e=c,a[d]=null;break}if(null==e){if(null===t.type)return document.createTextNode(g);e=r?document.createElementNS("http://www.w3.org/2000/svg",t.type):document.createElement(t.type,g.is&&{is:g.is}),a=null,l=!1}if(null===t.type)_===g||l&&e.data===g||(e.data=g);else{if(null!=a&&(a=i.slice.call(e.childNodes)),b=(_=n.props||s).dangerouslySetInnerHTML,u=g.dangerouslySetInnerHTML,!l){if(null!=a)for(_={},p=0;p<e.attributes.length;p++)_[e.attributes[p].name]=e.attributes[p].value;(u||b)&&(u&&(b&&u.__html==b.__html||u.__html===e.innerHTML)||(e.innerHTML=u&&u.__html||""))}(function(e,t,n,o,r){var s;for(s in n)"children"===s||"key"===s||s in t||y(e,s,null,n[s],o);for(s in t)r&&"function"!=typeof t[s]||"children"===s||"key"===s||"value"===s||"checked"===s||n[s]===t[s]||y(e,s,t[s],n[s],o)})(e,g,_,r,l),u?t.__k=[]:(d=t.props.children,w(e,Array.isArray(d)?d:[d],t,n,o,"foreignObject"!==t.type&&r,a,f,s,l)),l||("value"in g&&void 0!==(d=g.value)&&(d!==e.value||"progress"===t.type&&!d)&&y(e,"value",d,_.value,!1),"checked"in g&&void 0!==(d=g.checked)&&d!==e.checked&&y(e,"checked",d,_.checked,!1))}return e}(o.__e,n,o,r,a,l,d,p);(_=e.diffed)&&_(n)}catch(t){n.__v=null,(p||null!=l)&&(n.__e=c,n.__h=!!p,l[l.indexOf(c)]=null),e.__e(t,n,o)}return n.__e}function S(t,n){e.__c&&e.__c(n,t),t.some(function(n){try{t=n.__h,n.__h=[],t.some(function(e){e.call(n)})}catch(t){e.__e(t,n.__v)}})}function C(t,n,o){try{"function"==typeof t?t(n):t.current=n}catch(t){e.__e(t,o)}}function E(t,n,o){var r,s,i;if(e.unmount&&e.unmount(t),(r=t.ref)&&(r.current&&r.current!==t.__e||C(r,null,n)),o||"function"==typeof t.type||(o=null!=(s=t.__e)),t.__e=t.__d=void 0,null!=(r=t.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(t){e.__e(t,n)}r.base=r.__P=null}if(r=t.__k)for(i=0;i<r.length;i++)r[i]&&E(r[i],n,o);null!=s&&l(s)}function N(e,t,n){return this.constructor(e,n)}e={__e:function(e,t){for(var n,o,r,s=t.__h;t=t.__;)if((n=t.__c)&&!n.__)try{if((o=n.constructor)&&null!=o.getDerivedStateFromError&&(n.setState(o.getDerivedStateFromError(e)),r=n.__d),null!=n.componentDidCatch&&(n.componentDidCatch(e),r=n.__d),r)return t.__h=s,n.__E=n}catch(t){e=t}throw e},__v:0},u.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=f({},this.state),"function"==typeof e&&(e=e(f({},n),this.props)),e&&f(n,e),null!=e&&this.__v&&(t&&this.__h.push(t),g(this))},u.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),g(this))},u.prototype.render=b,t=[],n="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,h.__r=0,r=s;var T,H,$,L=0,q=[],z=e.__b,F=e.__r,O=e.diffed,P=e.__c,U=e.unmount;function A(t,n){e.__h&&e.__h(H,t,L||n),L=0;var o=H.__H||(H.__H={__:[],__h:[]});return t>=o.__.length&&o.__.push({}),o.__[t]}function M(e){return L=1,function(e,t,n){var o=A(T++,2);return o.t=e,o.__c||(o.__=[Q(void 0,t),function(e){var t=o.t(o.__[0],e);o.__[0]!==t&&(o.__=[t,o.__[1]],o.__c.setState({}))}],o.__c=H),o.__}(Q,e)}function D(t,n){var o=A(T++,3);!e.__s&&function(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}(o.__H,n)&&(o.__=t,o.__H=n,H.__H.__h.push(o))}function W(){q.forEach(function(t){if(t.__P)try{t.__H.__h.forEach(B),t.__H.__h.forEach(R),t.__H.__h=[]}catch(n){t.__H.__h=[],e.__e(n,t.__v)}}),q=[]}e.__b=function(e){H=null,z&&z(e)},e.__r=function(e){F&&F(e),T=0;var t=(H=e.__c).__H;t&&(t.__h.forEach(B),t.__h.forEach(R),t.__h=[])},e.diffed=function(t){O&&O(t);var n=t.__c;n&&n.__H&&n.__H.__h.length&&(1!==q.push(n)&&$===e.requestAnimationFrame||(($=e.requestAnimationFrame)||function(e){var t,n=function(){clearTimeout(o),J&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,100);J&&(t=requestAnimationFrame(n))})(W)),H=void 0},e.__c=function(t,n){n.some(function(t){try{t.__h.forEach(B),t.__h=t.__h.filter(function(e){return!e.__||R(e)})}catch(o){n.some(function(e){e.__h&&(e.__h=[])}),n=[],e.__e(o,t.__v)}}),P&&P(t,n)},e.unmount=function(t){U&&U(t);var n=t.__c;if(n&&n.__H)try{n.__H.__.forEach(B)}catch(t){e.__e(t,n.__v)}};var J="function"==typeof requestAnimationFrame;function B(e){var t=H;"function"==typeof e.__c&&e.__c(),H=t}function R(e){var t=H;e.__c=e.__(),H=t}function Q(e,t){return"function"==typeof t?t(e):t}const G=(...e)=>e.filter(Boolean).join(" ");function Y({children:e,isOpen:t,close:n}){const[o,r]=M(!1);return D(()=>{r(t)},[t]),d("div",{"aria-live":"assertive",className:"fb-pointer-events-none fb-fixed fb-inset-0 fb-flex fb-items-end fb-px-4 fb-py-6 sm:fb-p-6"},d("div",{className:"fb-flex fb-w-full fb-flex-col fb-items-center fb-space-y-4 sm:fb-items-end"},d("div",{className:G(o?"fb-translate-x-0 fb-opacity-100":"fb-translate-x-28 fb-opacity-0","fb-pointer-events-auto fb-relative fb-w-full fb-max-w-sm fb-overflow-hidden fb-rounded-lg fb-bg-white fb-shadow-lg fb-ring-1 fb-ring-black fb-ring-opacity-5 fb-transition-all fb-duration-500 fb-ease-in-out")},d("div",{class:"fb-absolute fb-top-0 fb-right-0 fb-hidden fb-pt-4 fb-pr-4 sm:fb-block"},d("button",{type:"button",onClick:n,class:"fb-rounded-md fb-bg-white focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 text-slate-400 hover:text-slate-500 focus:ring-slate-500"},d("span",{class:"fb-sr-only"},"Close"),d("svg",{class:"fb-h-6 fb-w-6",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})))),d("div",{className:""},e))))}const V=async(e,t)=>{if(!(await fetch(`${t.apiHost}/api/v1/client/environments/${t.environmentId}/displays/${e}/responded`,{method:"POST",headers:{"Content-Type":"application/json"}})).ok)throw new Error("Could not update display")},X=async(e,t)=>{const n=await fetch(`${t.apiHost}/api/v1/client/environments/${t.environmentId}/responses`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw console.error(n.text),new Error("Could not create response");return await n.json()};function K({headline:e,questionId:t}){return d("label",{htmlFor:t,className:"fb-block fb-text-base fb-font-semibold fb-leading-6 fb-mr-8 text-slate-900"},e)}function Z({subheader:e,questionId:t}){return d("label",{for:t,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600"},e)}function ee({question:e,onSubmit:t,lastQuestion:n,brandColor:o}){return d("form",{onSubmit:n=>{n.preventDefault();const o={[e.id]:n.currentTarget[e.id].value};n.currentTarget[e.id].value="",t(o)}},d(K,{headline:e.headline,questionId:e.id}),d(Z,{subheader:e.subheader,questionId:e.id}),d("div",{className:"fb-mt-4"},d("textarea",{rows:3,name:e.id,id:e.id,placeholder:e.placeholder,required:e.required,className:"fb-block fb-w-full fb-rounded-md fb-border fb-p-2 fb-shadow-sm focus:fb-ring-0 sm:fb-text-sm border-slate-100 bg-slate-50 focus:border-slate-500"})),d("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},d("div",null),d("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:ring-slate-500",style:{backgroundColor:o}},e.buttonLabel||(n?"Finish":"Next"))))}function te({question:e,onSubmit:t,lastQuestion:n,brandColor:o}){const[r,s]=M(null);return d("form",{onSubmit:n=>{n.preventDefault();const o={[e.id]:n.currentTarget[e.id].value};n.currentTarget[e.id].value="",t(o)}},d(K,{headline:e.headline,questionId:e.id}),d(Z,{subheader:e.subheader,questionId:e.id}),d("div",{className:"fb-mt-4"},d("fieldset",null,d("legend",{className:"fb-sr-only"},"Choices"),d("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},e.choices&&e.choices.map(t=>d("label",{key:t.id,className:G(r===t.label?"fb-z-10 border-slate-400 bg-slate-50":"fb-border-gray-200","fb-relative fb-flex fb-cursor-pointer fb-flex-col fb-rounded-md fb-border fb-p-4 focus:fb-outline-none hover:bg-slate-50")},d("span",{className:"fb-flex fb-items-center fb-text-sm"},d("input",{type:"radio",id:t.id,name:e.id,value:t.label,className:"fb-h-4 fb-w-4 fb-border fb-border-gray-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":`${t.id}-label`,onChange:e=>{s(e.currentTarget.value)},style:{borderColor:o,color:o}}),d("span",{id:`${t.id}-label`,className:"fb-ml-3 fb-font-medium"},t.label))))))),d("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},d("div",null),d("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:ring-slate-500",style:{backgroundColor:o}},e.buttonLabel||(n?"Finish":"Next"))))}function ne({progress:e,brandColor:t}){return d("div",{className:"fb-h-1 fb-w-full fb-rounded-full bg-slate-200"},d("div",{className:"fb-h-1 fb-rounded-full",style:{backgroundColor:t,width:`${Math.floor(100*e)}%`}}))}function oe({config:e,survey:t,close:n,brandColor:o}){const[r,s]=M(t.questions[0]),[i,a]=M(0),[f,l]=M(null),[c,b]=M(null),[u,p]=M(!1);D(()=>{!async function(){const n=await(async(e,t)=>{const n=await fetch(`${t.apiHost}/api/v1/client/environments/${t.environmentId}/displays`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw console.error(n.text),new Error("Could not create display");return await n.json()})({surveyId:t.id,personId:e.person.id},e);b(n.id)}()},[e,t]),D(()=>{a(function(){const e=t.questions.findIndex(e=>e.id===r.id);return e/t.questions.length}())},[r,t]);const _=async o=>{p(!0);const i=t.questions.findIndex(e=>e.id===r.id),d=i===t.questions.length-1,b={surveyId:t.id,personId:e.person.id,response:{finished:d,data:o}};if(f)await(async(e,t,n)=>{const o=await fetch(`${n.apiHost}/api/v1/client/environments/${n.environmentId}/responses/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!o.ok)throw new Error("Could not update response");return await o.json()})(b,f,e);else{const[t,n]=await Promise.all([X(b,e),V(c,e)]);l(t.id)}p(!1),d?(a(100),n()):s(t.questions[i+1])};return d("div",null,d("div",{className:G(u?"fb-animate-pulse fb-opacity-60":"","fb-p-4")},"multipleChoiceSingle"===r.type?d(te,{question:r,onSubmit:_,lastQuestion:t.questions.findIndex(e=>e.id===r.id)===t.questions.length-1,brandColor:o}):"openText"===r.type?d(ee,{question:r,onSubmit:_,lastQuestion:t.questions.findIndex(e=>e.id===r.id)===t.questions.length-1,brandColor:o}):null),d("div",{className:"fb-mt-2"},d(ne,{progress:i,brandColor:o})))}function re({config:e,survey:t,closeSurvey:n}){var o;const[r,s]=M(!0),i=()=>{s(!1),setTimeout(()=>{n()},1e3)};return d("div",{id:"fbjs"},d(Y,{isOpen:r,close:i},d(oe,{config:e,survey:t,close:i,brandColor:null==(o=e.settings)?void 0:o.brandColor})))}function se(){return se=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},se.apply(this,arguments)}class ie{constructor(){this.config=this.loadFromLocalStorage()}static getInstance(){return ie.instance||(ie.instance=new ie),ie.instance}update(e){e&&(this.config=se({},this.config,e),this.saveToLocalStorage())}get(){return this.config}loadFromLocalStorage(){if("undefined"!=typeof window){const e=localStorage.getItem("config");if(e)return JSON.parse(e)}return{apiHost:null,environmentId:null}}saveToLocalStorage(){localStorage.setItem("config",JSON.stringify(this.config))}}ie.instance=void 0;class ae{constructor(){this.logLevel="error"}static getInstance(){return ae.instance||(ae.instance=new ae),ae.instance}configure(e){e&&void 0!==e.logLevel&&(this.logLevel=e.logLevel)}logger(e,t){if("debug"===t&&"debug"!==this.logLevel)return;const n=`🧱 Formbricks - ${(new Date).toISOString()} [${t.toUpperCase()}] - ${e}`;"error"===t?console.error(n):console.log(n)}debug(e){this.logger(e,"debug")}error(e){this.logger(e,"error")}}ae.instance=void 0;const fe=ae.getInstance(),le=ie.getInstance(),de=async()=>{const e=await fetch(`${le.get().apiHost}/api/v1/client/environments/${le.get().environmentId}/settings`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:le.get().person.id})});if(!e.ok)throw fe.error("Error getting settings"),Error("Error getting settings");return e.json()},ce="formbricks-web-container",be=ie.getInstance(),ue=ae.getInstance();let pe=!1;const _e=t=>{pe?ue.debug("A survey is already running. Skipping."):(pe=!0,function(t,n,o){var a,f,l;e.__&&e.__(t,n),f=(a=void 0===r)?null:n.__k,t=d(b,null,[t]),l=[],I(n,n.__k=t,f||s,s,void 0!==n.ownerSVGElement,f?null:n.childNodes.length?i.slice.call(n.childNodes):null,l,s,a),S(l,t)}(d(re,{config:be.get(),survey:t,closeSurvey:ge}),document.getElementById(ce)))},ge=async()=>{document.getElementById(ce).innerHTML="";const e=await de();be.update({settings:e}),pe=!1},he=ae.getInstance(),we=ie.getInstance(),me=async(e,t)=>{const n=await fetch(`${we.get().apiHost}/api/v1/client/environments/${we.get().environmentId}/events`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:we.get().session.id,eventName:e,properties:t})});if(n.ok)he.debug(`Formbricks: Event "${e}" tracked`),ve(e);else{const e=await n.json();he.error(`Formbricks: Error tracking event: ${JSON.stringify(e)}`)}},ve=e=>{for(const o of null==(t=we.get().settings)?void 0:t.surveys){var t;for(const t of o.triggers){var n;if((null==(n=t.eventClass)?void 0:n.name)===e)return he.debug(`Formbricks: survey ${o.id} triggered by event "${e}"`),void _e(o)}}},ye=ie.getInstance(),je=ae.getInstance(),xe=async()=>{je.debug("Creating new person");const e=await fetch(`${ye.get().apiHost}/api/v1/client/environments/${ye.get().environmentId}/people`,{method:"POST",headers:{"Content-Type":"application/json"}});return e.ok?await e.json():(console.error("Formbricks: Error fetching person"),null)},ke=(e,t)=>{const n=ye.get().person.attributes.find(t=>{var n;return(null==(n=t.attributeClass)?void 0:n.name)===e});return!(!n||n.value!==t)},Ie=ae.getInstance(),Se=ie.getInstance(),Ce=async()=>{if(!Se.get().person)return void Ie.error("Formbricks: Unable to create session. No person found");const e=await fetch(`${Se.get().apiHost}/api/v1/client/environments/${Se.get().environmentId}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:Se.get().person.id})});if(e.ok)return await e.json();Ie.error("Error creating session")},Ee=e=>{const t=se({},e);return t.expiresAt=Date.now()+36e5,t},Ne=e=>e.expiresAt<=Date.now(),Te=ie.getInstance(),He=ae.getInstance(),$e=()=>{var e;He.debug("checking page url");const t=null==(e=Te.get().settings)?void 0:e.noCodeEvents.filter(e=>{var t;return"pageUrl"===(null==(t=e.noCodeConfig)?void 0:t.type)});if(0!==t.length)for(const e of t){const{noCodeConfig:{pageUrl:t}}=e;t&&Le(window.location.href,t.value,t.rule)&&me(e.name)}};function Le(e,t,n){switch(n){case"exactMatch":return e===t;case"contains":return e.includes(t);case"startsWith":return e.startsWith(t);case"endsWith":return e.endsWith(t);case"notMatch":return e!==t;case"notContains":return!e.includes(t);default:throw new Error("Invalid match type")}}const qe=ie.getInstance(),ze=ae.getInstance(),Fe=()=>{if(!(qe.get().apiHost&&qe.get().environmentId&&qe.get().person&&qe.get().session&&qe.get().settings))throw Error("Formbricks: Formbricks not initialized. Call initialize() first.")},Oe=new class{constructor(){this.queue=[],this.running=!1}add(e){this.queue.push(e),this.running||this.run()}async run(){for(this.running=!0;this.queue.length>0;){const e=this.queue.shift();try{await e()}catch(e){console.error(e)}}this.running=!1}},Pe=(e,t)=>{Oe.add(async()=>{Fe(),await(async(e,t)=>{if(je.debug("setting attribute: "+e+" to value: "+t),ke(e,t))return void je.debug("attribute already set to this value. Skipping update.");const{person:n,settings:o}=await(async(e,t)=>{if(!ye.get().person||!ye.get().person.id)return void console.error("Formbricks: Unable to update attribute. No person set.");const n=await fetch(`${ye.get().apiHost}/api/v1/client/environments/${ye.get().environmentId}/people/${ye.get().person.id}/attribute`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e,value:t})}),o=await n.json();if(!n.ok)throw je.error("Error updating person"),Error("Error updating person");return o})(e,t);if(!n||!o)throw je.error("Error updating attribute"),new Error("Formbricks: Error updating attribute");ye.update({person:n,settings:o})})(e,t)})},Ue={init:e=>{Oe.add(async()=>{(async e=>{if(!e.environmentId)throw Error("Formbricks: environmentId is required");if(!e.apiHost)throw Error("Formbricks: apiHost is required");if(e.logLevel&&ze.configure({logLevel:e.logLevel}),(()=>{const e=document.createElement("div");e.id=ce,document.body.appendChild(e)})(),(()=>{if(null===document.getElementById("formbricks__css")){const e=document.createElement("style");e.id="formbricks__css",e.innerHTML='#fbjs *,#fbjs :after,#fbjs :before{border:0 solid #e5e7eb;box-sizing:border-box}#fbjs :after,#fbjs :before{--tw-content:""}#fbjs html{-webkit-text-size-adjust:100%;font-feature-settings:normal;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}#fbjs body{line-height:inherit;margin:0}#fbjs hr{border-top-width:1px;color:inherit;height:0}#fbjs abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6{font-size:inherit;font-weight:inherit}#fbjs a{color:inherit;text-decoration:inherit}#fbjs b,#fbjs strong{font-weight:bolder}#fbjs code,#fbjs kbd,#fbjs pre,#fbjs samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}#fbjs small{font-size:80%}#fbjs sub,#fbjs sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}#fbjs sub{bottom:-.25em}#fbjs sup{top:-.5em}#fbjs table{border-collapse:collapse;border-color:inherit;text-indent:0}#fbjs button,#fbjs input,#fbjs optgroup,#fbjs select,#fbjs textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}#fbjs button,#fbjs select{text-transform:none}#fbjs [type=button],#fbjs [type=reset],#fbjs [type=submit],#fbjs button{-webkit-appearance:button;background-color:transparent;background-image:none}#fbjs :-moz-focusring{outline:auto}#fbjs :-moz-ui-invalid{box-shadow:none}#fbjs progress{vertical-align:baseline}#fbjs ::-webkit-inner-spin-button,#fbjs ::-webkit-outer-spin-button{height:auto}#fbjs [type=search]{-webkit-appearance:textfield;outline-offset:-2px}#fbjs ::-webkit-search-decoration{-webkit-appearance:none}#fbjs ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}#fbjs summary{display:list-item}#fbjs blockquote,#fbjs dd,#fbjs dl,#fbjs figure,#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6,#fbjs hr,#fbjs p,#fbjs pre{margin:0}#fbjs fieldset{margin:0;padding:0}#fbjs legend{padding:0}#fbjs menu,#fbjs ol,#fbjs ul{list-style:none;margin:0;padding:0}#fbjs textarea{resize:vertical}#fbjs input::-moz-placeholder,#fbjs textarea::-moz-placeholder{color:#9ca3af;opacity:1}#fbjs input::placeholder,#fbjs textarea::placeholder{color:#9ca3af;opacity:1}#fbjs [role=button],#fbjs button{cursor:pointer}#fbjs :disabled{cursor:default}#fbjs audio,#fbjs canvas,#fbjs embed,#fbjs iframe,#fbjs img,#fbjs object,#fbjs svg,#fbjs video{display:block;vertical-align:middle}#fbjs img,#fbjs video{height:auto;max-width:100%}#fbjs [hidden]{display:none}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }#fbjs .fb-sr-only{clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}#fbjs .fb-pointer-events-none{pointer-events:none}#fbjs .fb-pointer-events-auto{pointer-events:auto}#fbjs .fb-fixed{position:fixed}#fbjs .fb-absolute{position:absolute}#fbjs .fb-relative{position:relative}#fbjs .fb-inset-0{bottom:0;left:0;right:0;top:0}#fbjs .fb-right-0{right:0}#fbjs .fb-top-0{top:0}#fbjs .fb-z-10{z-index:10}#fbjs .fb-ml-3{margin-left:.75rem}#fbjs .fb-mr-8{margin-right:2rem}#fbjs .fb-mt-2{margin-top:.5rem}#fbjs .fb-mt-4{margin-top:1rem}#fbjs .fb-block{display:block}#fbjs .fb-flex{display:flex}#fbjs .fb-hidden{display:none}#fbjs .fb-h-1{height:.25rem}#fbjs .fb-h-4{height:1rem}#fbjs .fb-h-6{height:1.5rem}#fbjs .fb-w-4{width:1rem}#fbjs .fb-w-6{width:1.5rem}#fbjs .fb-w-full{width:100%}#fbjs .fb-max-w-sm{max-width:24rem}#fbjs .fb-translate-x-0{--tw-translate-x:0px}#fbjs .fb-translate-x-0,#fbjs .fb-translate-x-28{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#fbjs .fb-translate-x-28{--tw-translate-x:7rem}@keyframes fb-pulse{50%{opacity:.5}}#fbjs .fb-animate-pulse{animation:fb-pulse 2s cubic-bezier(.4,0,.6,1) infinite}#fbjs .fb-cursor-pointer{cursor:pointer}#fbjs .fb-flex-col{flex-direction:column}#fbjs .fb-items-end{align-items:flex-end}#fbjs .fb-items-center{align-items:center}#fbjs .fb-justify-between{justify-content:space-between}#fbjs .fb-space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}#fbjs .fb-space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}#fbjs .fb-overflow-hidden{overflow:hidden}#fbjs .fb-rounded-full{border-radius:9999px}#fbjs .fb-rounded-lg{border-radius:.5rem}#fbjs .fb-rounded-md{border-radius:.375rem}#fbjs .fb-border{border-width:1px}#fbjs .fb-border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}#fbjs .fb-border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity))}#fbjs .fb-border-transparent{border-color:transparent}#fbjs .fb-bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}#fbjs .fb-p-2{padding:.5rem}#fbjs .fb-p-4{padding:1rem}#fbjs .fb-px-3{padding-left:.75rem;padding-right:.75rem}#fbjs .fb-px-4{padding-left:1rem;padding-right:1rem}#fbjs .fb-py-3{padding-bottom:.75rem;padding-top:.75rem}#fbjs .fb-py-6{padding-bottom:1.5rem;padding-top:1.5rem}#fbjs .fb-pr-4{padding-right:1rem}#fbjs .fb-pt-4{padding-top:1rem}#fbjs .fb-text-base{font-size:1rem;line-height:1.5rem}#fbjs .fb-text-sm{font-size:.875rem;line-height:1.25rem}#fbjs .fb-font-medium{font-weight:500}#fbjs .fb-font-normal{font-weight:400}#fbjs .fb-font-semibold{font-weight:600}#fbjs .fb-leading-4{line-height:1rem}#fbjs .fb-leading-6{line-height:1.5rem}#fbjs .fb-text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}#fbjs .fb-opacity-0{opacity:0}#fbjs .fb-opacity-100{opacity:1}#fbjs .fb-opacity-60{opacity:.6}#fbjs .fb-shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}#fbjs .fb-shadow-lg,#fbjs .fb-shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs .fb-shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}#fbjs .fb-ring-1{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs .fb-ring-black{--tw-ring-opacity:1;--tw-ring-color:rgb(0 0 0/var(--tw-ring-opacity))}#fbjs .fb-ring-opacity-5{--tw-ring-opacity:0.05}#fbjs .fb-transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs .fb-duration-500{transition-duration:.5s}#fbjs .fb-ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs .hover\\:fb-opacity-90:hover{opacity:.9}#fbjs .focus\\:fb-outline-none:focus{outline:2px solid transparent;outline-offset:2px}#fbjs .focus\\:fb-ring-0:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color)}#fbjs .focus\\:fb-ring-0:focus,#fbjs .focus\\:fb-ring-2:focus{box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs .focus\\:fb-ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color)}#fbjs .focus\\:fb-ring-offset-0:focus{--tw-ring-offset-width:0px}#fbjs .focus\\:fb-ring-offset-2:focus{--tw-ring-offset-width:2px}@media (min-width:640px){#fbjs .sm\\:fb-block{display:block}#fbjs .sm\\:fb-items-end{align-items:flex-end}#fbjs .sm\\:fb-p-6{padding:1.5rem}#fbjs .sm\\:fb-text-sm{font-size:.875rem;line-height:1.25rem}}',document.head.appendChild(e)}})(),!qe||qe.get().environmentId!==e.environmentId||qe.get().apiHost!==e.apiHost){qe.update({environmentId:e.environmentId,apiHost:e.apiHost});const{person:t,session:n,settings:o}=await xe();qe.update({person:t,session:Ee(n),settings:o}),me("New Session")}if(Ne(qe.get().session)){const{session:e,settings:t}=await Ce();qe.update({session:Ee(e),settings:t}),me("New Session")}(()=>{if("undefined"!=typeof window){const e=window.setInterval(async()=>{await(async()=>{if(Ie.debug("Checking session"),Ne(Se.get().session)){Ie.debug("Session expired, creating new session");const{session:e,settings:t}=await Ce();if(!e||!t)throw Ie.error("Error creating new session"),Error("Error creating new session");Se.update({session:e,settings:t}),me("New Session")}Ie.debug("Session not expired, extending session"),Se.update({session:Ee(Se.get().session)})})()},3e5);window.addEventListener("beforeunload",()=>{clearInterval(e)})}})(),"undefined"!=typeof window&&(window.addEventListener("hashchange",$e),window.addEventListener("popstate",$e),window.addEventListener("pushstate",$e),window.addEventListener("replacestate",$e),window.addEventListener("load",$e))})(e)})},setUserId:e=>{Oe.add(async()=>{Fe(),await(async e=>{if(je.debug("setting userId: "+e),ke("userId",e))return void je.debug("userId already set to this value. Skipping update.");if((e=>{const t=ye.get().person.attributes.find(e=>{var t;return"userId"===(null==(t=e.attributeClass)?void 0:t.name)});return!!t})())return void je.error("userId cannot be changed after it has been set. You need to reset first");const{person:t,settings:n}=await(async e=>{if(!ye.get().person||!ye.get().person.id)return void console.error("Formbricks: Unable to update userId. No person set.");const t=await fetch(`${ye.get().apiHost}/api/v1/client/environments/${ye.get().environmentId}/people/${ye.get().person.id}/user-id`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,sessionId:ye.get().session.id})});if(!t.ok)throw je.error("Formbricks: Error updating person"),Error("Error updating person");return await t.json()})(e);ye.update({person:t,settings:n})})(e)})},setEmail:e=>{Pe("email",e)},setAttribute:Pe,track:(e,t={})=>{Oe.add(async()=>{Fe(),await me(e,t)})},logout:()=>{Oe.add(async()=>{Fe(),await(async()=>{je.debug("Resetting person. Getting new person, session and settings from backend");const{person:e,session:t,settings:n}=await xe();if(!e||!t||!n)throw je.error("Error resetting user"),new Error("Formbricks: Error resetting user");ye.update({person:e,session:t,settings:n})})()})},refresh:()=>{Oe.add(async()=>{Fe(),await(async()=>{fe.debug("Refreshing - getting settings from backend");const e=await de();le.update({settings:e})})()})},registerRouteChange:()=>{console.log("fire!!!"),Oe.add(async()=>{Fe(),$e()})}};"undefined"!=typeof window&&(window.formbricks=Ue);export{Ue as default};
var e,t,n,o,r,s={},i=[],a=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function f(e,t){for(var n in t)e[n]=t[n];return e}function l(e){var t=e.parentNode;t&&t.removeChild(e)}function d(e,t,n){var o,r,s,i=arguments,a={};for(s in t)"key"==s?o=t[s]:"ref"==s?r=t[s]:a[s]=t[s];if(arguments.length>3)for(n=[n],s=3;s<arguments.length;s++)n.push(i[s]);if(null!=n&&(a.children=n),"function"==typeof e&&null!=e.defaultProps)for(s in e.defaultProps)void 0===a[s]&&(a[s]=e.defaultProps[s]);return c(e,a,o,r,null)}function c(t,n,o,r,s){var i={type:t,props:n,key:o,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==s?++e.__v:s};return null!=e.vnode&&e.vnode(i),i}function b(e){return e.children}function u(e,t){this.props=e,this.context=t}function p(e,t){if(null==t)return e.__?p(e.__,e.__.__k.indexOf(e)+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?p(e):null}function _(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return _(e)}}function g(r){(!r.__d&&(r.__d=!0)&&t.push(r)&&!h.__r++||o!==e.debounceRendering)&&((o=e.debounceRendering)||n)(h)}function h(){for(var e;h.__r=t.length;)e=t.sort(function(e,t){return e.__v.__b-t.__v.__b}),t=[],e.some(function(e){var t,n,o,r,s,i,a;e.__d&&(i=(s=(t=e).__v).__e,(a=t.__P)&&(n=[],(o=f({},s)).__v=s.__v+1,r=I(a,s,o,t.__n,void 0!==a.ownerSVGElement,null!=s.__h?[i]:null,n,null==i?p(s):i,s.__h),S(n,s),r!=i&&_(s)))})}function w(e,t,n,o,r,a,f,d,u,_){var g,h,w,v,y,j,x,k=o&&o.__k||i,S=k.length;for(u==s&&(u=null!=f?f[0]:S?p(o,0):null),n.__k=[],g=0;g<t.length;g++)if(null!=(v=n.__k[g]=null==(v=t[g])||"boolean"==typeof v?null:"string"==typeof v||"number"==typeof v?c(null,v,null,null,v):Array.isArray(v)?c(b,{children:v},null,null,null):null!=v.__e||null!=v.__c?c(v.type,v.props,v.key,null,v.__v):v)){if(v.__=n,v.__b=n.__b+1,null===(w=k[g])||w&&v.key==w.key&&v.type===w.type)k[g]=void 0;else for(h=0;h<S;h++){if((w=k[h])&&v.key==w.key&&v.type===w.type){k[h]=void 0;break}w=null}y=I(e,v,w=w||s,r,a,f,d,u,_),(h=v.ref)&&w.ref!=h&&(x||(x=[]),w.ref&&x.push(w.ref,null,v),x.push(h,v.__c||y,v)),null!=y?(null==j&&(j=y),u=m(e,v,w,k,f,y,u),_||"option"!=n.type?"function"==typeof n.type&&(n.__d=u):e.value=""):u&&w.__e==u&&u.parentNode!=e&&(u=p(w))}if(n.__e=j,null!=f&&"function"!=typeof n.type)for(g=f.length;g--;)null!=f[g]&&l(f[g]);for(g=S;g--;)null!=k[g]&&E(k[g],k[g]);if(x)for(g=0;g<x.length;g++)C(x[g],x[++g],x[++g])}function m(e,t,n,o,r,s,i){var a,f,l;if(void 0!==t.__d)a=t.__d,t.__d=void 0;else if(r==n||s!=i||null==s.parentNode)e:if(null==i||i.parentNode!==e)e.appendChild(s),a=null;else{for(f=i,l=0;(f=f.nextSibling)&&l<o.length;l+=2)if(f==s)break e;e.insertBefore(s,i),a=i}return void 0!==a?a:s.nextSibling}function v(e,t,n){"-"===t[0]?e.setProperty(t,n):e[t]=null==n?"":"number"!=typeof n||a.test(t)?n:n+"px"}function y(e,t,n,o,r){var s,i,a;if(r&&"className"==t&&(t="class"),"style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof o&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||v(e.style,t,"");if(n)for(t in n)o&&n[t]===o[t]||v(e.style,t,n[t])}else"o"===t[0]&&"n"===t[1]?(s=t!==(t=t.replace(/Capture$/,"")),(i=t.toLowerCase())in e&&(t=i),t=t.slice(2),e.l||(e.l={}),e.l[t+s]=n,a=s?x:j,n?o||e.addEventListener(t,a,s):e.removeEventListener(t,a,s)):"list"!==t&&"tagName"!==t&&"form"!==t&&"type"!==t&&"size"!==t&&"download"!==t&&"href"!==t&&!r&&t in e?e[t]=null==n?"":n:"function"!=typeof n&&"dangerouslySetInnerHTML"!==t&&(t!==(t=t.replace(/xlink:?/,""))?null==n||!1===n?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),n):null==n||!1===n&&!/^ar/.test(t)?e.removeAttribute(t):e.setAttribute(t,n))}function j(t){this.l[t.type+!1](e.event?e.event(t):t)}function x(t){this.l[t.type+!0](e.event?e.event(t):t)}function k(e,t,n){var o,r;for(o=0;o<e.__k.length;o++)(r=e.__k[o])&&(r.__=e,r.__e&&("function"==typeof r.type&&r.__k.length>1&&k(r,t,n),t=m(n,r,r,e.__k,null,r.__e,t),"function"==typeof e.type&&(e.__d=t)))}function I(t,n,o,r,a,l,d,c,p){var _,g,h,m,v,j,x,I,S,C,E,T=n.type;if(void 0!==n.constructor)return null;null!=o.__h&&(p=o.__h,c=n.__e=o.__e,n.__h=null,l=[c]),(_=e.__b)&&_(n);try{e:if("function"==typeof T){if(I=n.props,S=(_=T.contextType)&&r[_.__c],C=_?S?S.props.value:_.__:r,o.__c?x=(g=n.__c=o.__c).__=g.__E:("prototype"in T&&T.prototype.render?n.__c=g=new T(I,C):(n.__c=g=new u(I,C),g.constructor=T,g.render=N),S&&S.sub(g),g.props=I,g.state||(g.state={}),g.context=C,g.__n=r,h=g.__d=!0,g.__h=[]),null==g.__s&&(g.__s=g.state),null!=T.getDerivedStateFromProps&&(g.__s==g.state&&(g.__s=f({},g.__s)),f(g.__s,T.getDerivedStateFromProps(I,g.__s))),m=g.props,v=g.state,h)null==T.getDerivedStateFromProps&&null!=g.componentWillMount&&g.componentWillMount(),null!=g.componentDidMount&&g.__h.push(g.componentDidMount);else{if(null==T.getDerivedStateFromProps&&I!==m&&null!=g.componentWillReceiveProps&&g.componentWillReceiveProps(I,C),!g.__e&&null!=g.shouldComponentUpdate&&!1===g.shouldComponentUpdate(I,g.__s,C)||n.__v===o.__v){g.props=I,g.state=g.__s,n.__v!==o.__v&&(g.__d=!1),g.__v=n,n.__e=o.__e,n.__k=o.__k,g.__h.length&&d.push(g),k(n,c,t);break e}null!=g.componentWillUpdate&&g.componentWillUpdate(I,g.__s,C),null!=g.componentDidUpdate&&g.__h.push(function(){g.componentDidUpdate(m,v,j)})}g.context=C,g.props=I,g.state=g.__s,(_=e.__r)&&_(n),g.__d=!1,g.__v=n,g.__P=t,_=g.render(g.props,g.state,g.context),g.state=g.__s,null!=g.getChildContext&&(r=f(f({},r),g.getChildContext())),h||null==g.getSnapshotBeforeUpdate||(j=g.getSnapshotBeforeUpdate(m,v)),E=null!=_&&_.type==b&&null==_.key?_.props.children:_,w(t,Array.isArray(E)?E:[E],n,o,r,a,l,d,c,p),g.base=n.__e,n.__h=null,g.__h.length&&d.push(g),x&&(g.__E=g.__=null),g.__e=!1}else null==l&&n.__v===o.__v?(n.__k=o.__k,n.__e=o.__e):n.__e=function(e,t,n,o,r,a,f,l){var d,c,b,u,p,_=n.props,g=t.props;if(r="svg"===t.type||r,null!=a)for(d=0;d<a.length;d++)if(null!=(c=a[d])&&((null===t.type?3===c.nodeType:c.localName===t.type)||e==c)){e=c,a[d]=null;break}if(null==e){if(null===t.type)return document.createTextNode(g);e=r?document.createElementNS("http://www.w3.org/2000/svg",t.type):document.createElement(t.type,g.is&&{is:g.is}),a=null,l=!1}if(null===t.type)_===g||l&&e.data===g||(e.data=g);else{if(null!=a&&(a=i.slice.call(e.childNodes)),b=(_=n.props||s).dangerouslySetInnerHTML,u=g.dangerouslySetInnerHTML,!l){if(null!=a)for(_={},p=0;p<e.attributes.length;p++)_[e.attributes[p].name]=e.attributes[p].value;(u||b)&&(u&&(b&&u.__html==b.__html||u.__html===e.innerHTML)||(e.innerHTML=u&&u.__html||""))}(function(e,t,n,o,r){var s;for(s in n)"children"===s||"key"===s||s in t||y(e,s,null,n[s],o);for(s in t)r&&"function"!=typeof t[s]||"children"===s||"key"===s||"value"===s||"checked"===s||n[s]===t[s]||y(e,s,t[s],n[s],o)})(e,g,_,r,l),u?t.__k=[]:(d=t.props.children,w(e,Array.isArray(d)?d:[d],t,n,o,"foreignObject"!==t.type&&r,a,f,s,l)),l||("value"in g&&void 0!==(d=g.value)&&(d!==e.value||"progress"===t.type&&!d)&&y(e,"value",d,_.value,!1),"checked"in g&&void 0!==(d=g.checked)&&d!==e.checked&&y(e,"checked",d,_.checked,!1))}return e}(o.__e,n,o,r,a,l,d,p);(_=e.diffed)&&_(n)}catch(t){n.__v=null,(p||null!=l)&&(n.__e=c,n.__h=!!p,l[l.indexOf(c)]=null),e.__e(t,n,o)}return n.__e}function S(t,n){e.__c&&e.__c(n,t),t.some(function(n){try{t=n.__h,n.__h=[],t.some(function(e){e.call(n)})}catch(t){e.__e(t,n.__v)}})}function C(t,n,o){try{"function"==typeof t?t(n):t.current=n}catch(t){e.__e(t,o)}}function E(t,n,o){var r,s,i;if(e.unmount&&e.unmount(t),(r=t.ref)&&(r.current&&r.current!==t.__e||C(r,null,n)),o||"function"==typeof t.type||(o=null!=(s=t.__e)),t.__e=t.__d=void 0,null!=(r=t.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(t){e.__e(t,n)}r.base=r.__P=null}if(r=t.__k)for(i=0;i<r.length;i++)r[i]&&E(r[i],n,o);null!=s&&l(s)}function N(e,t,n){return this.constructor(e,n)}e={__e:function(e,t){for(var n,o,r,s=t.__h;t=t.__;)if((n=t.__c)&&!n.__)try{if((o=n.constructor)&&null!=o.getDerivedStateFromError&&(n.setState(o.getDerivedStateFromError(e)),r=n.__d),null!=n.componentDidCatch&&(n.componentDidCatch(e),r=n.__d),r)return t.__h=s,n.__E=n}catch(t){e=t}throw e},__v:0},u.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=f({},this.state),"function"==typeof e&&(e=e(f({},n),this.props)),e&&f(n,e),null!=e&&this.__v&&(t&&this.__h.push(t),g(this))},u.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),g(this))},u.prototype.render=b,t=[],n="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,h.__r=0,r=s;var T,H,$,L=0,q=[],z=e.__b,F=e.__r,O=e.diffed,P=e.__c,U=e.unmount;function A(t,n){e.__h&&e.__h(H,t,L||n),L=0;var o=H.__H||(H.__H={__:[],__h:[]});return t>=o.__.length&&o.__.push({}),o.__[t]}function M(e){return L=1,function(e,t,n){var o=A(T++,2);return o.t=e,o.__c||(o.__=[Q(void 0,t),function(e){var t=o.t(o.__[0],e);o.__[0]!==t&&(o.__=[t,o.__[1]],o.__c.setState({}))}],o.__c=H),o.__}(Q,e)}function D(t,n){var o=A(T++,3);!e.__s&&function(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}(o.__H,n)&&(o.__=t,o.__H=n,H.__H.__h.push(o))}function W(){q.forEach(function(t){if(t.__P)try{t.__H.__h.forEach(B),t.__H.__h.forEach(R),t.__H.__h=[]}catch(n){t.__H.__h=[],e.__e(n,t.__v)}}),q=[]}e.__b=function(e){H=null,z&&z(e)},e.__r=function(e){F&&F(e),T=0;var t=(H=e.__c).__H;t&&(t.__h.forEach(B),t.__h.forEach(R),t.__h=[])},e.diffed=function(t){O&&O(t);var n=t.__c;n&&n.__H&&n.__H.__h.length&&(1!==q.push(n)&&$===e.requestAnimationFrame||(($=e.requestAnimationFrame)||function(e){var t,n=function(){clearTimeout(o),J&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,100);J&&(t=requestAnimationFrame(n))})(W)),H=void 0},e.__c=function(t,n){n.some(function(t){try{t.__h.forEach(B),t.__h=t.__h.filter(function(e){return!e.__||R(e)})}catch(o){n.some(function(e){e.__h&&(e.__h=[])}),n=[],e.__e(o,t.__v)}}),P&&P(t,n)},e.unmount=function(t){U&&U(t);var n=t.__c;if(n&&n.__H)try{n.__H.__.forEach(B)}catch(t){e.__e(t,n.__v)}};var J="function"==typeof requestAnimationFrame;function B(e){var t=H;"function"==typeof e.__c&&e.__c(),H=t}function R(e){var t=H;e.__c=e.__(),H=t}function Q(e,t){return"function"==typeof t?t(e):t}const G=(...e)=>e.filter(Boolean).join(" ");function Y({children:e,isOpen:t,close:n}){const[o,r]=M(!1);return D(()=>{r(t)},[t]),d("div",{"aria-live":"assertive",className:"fb-pointer-events-none fb-fixed fb-inset-0 fb-flex fb-items-end fb-px-4 fb-py-6 sm:fb-p-6"},d("div",{className:"fb-flex fb-w-full fb-flex-col fb-items-center fb-space-y-4 sm:fb-items-end"},d("div",{className:G(o?"fb-translate-x-0 fb-opacity-100":"fb-translate-x-28 fb-opacity-0","fb-pointer-events-auto fb-relative fb-w-full fb-max-w-sm fb-overflow-hidden fb-rounded-lg fb-bg-white fb-shadow-lg fb-ring-1 fb-ring-black fb-ring-opacity-5 fb-transition-all fb-duration-500 fb-ease-in-out")},d("div",{class:"fb-absolute fb-top-0 fb-right-0 fb-hidden fb-pt-4 fb-pr-4 sm:fb-block"},d("button",{type:"button",onClick:n,class:"fb-rounded-md fb-bg-white focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 text-slate-400 hover:text-slate-500 focus:ring-slate-500"},d("span",{class:"fb-sr-only"},"Close"),d("svg",{class:"fb-h-6 fb-w-6",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},d("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})))),d("div",{className:""},e))))}const V=async(e,t)=>{if(!(await fetch(`${t.apiHost}/api/v1/client/environments/${t.environmentId}/displays/${e}/responded`,{method:"POST",headers:{"Content-Type":"application/json"}})).ok)throw new Error("Could not update display")},X=async(e,t)=>{const n=await fetch(`${t.apiHost}/api/v1/client/environments/${t.environmentId}/responses`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw console.error(n.text),new Error("Could not create response");return await n.json()};function K({headline:e,questionId:t}){return d("label",{htmlFor:t,className:"fb-block fb-text-base fb-font-semibold fb-leading-6 fb-mr-8 text-slate-900"},e)}function Z({subheader:e,questionId:t}){return d("label",{for:t,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600"},e)}function ee({question:e,onSubmit:t,lastQuestion:n,brandColor:o}){return d("form",{onSubmit:n=>{n.preventDefault();const o={[e.id]:n.currentTarget[e.id].value};n.currentTarget[e.id].value="",t(o)}},d(K,{headline:e.headline,questionId:e.id}),d(Z,{subheader:e.subheader,questionId:e.id}),d("div",{className:"fb-mt-4"},d("textarea",{rows:3,name:e.id,id:e.id,placeholder:e.placeholder,required:e.required,className:"fb-block fb-w-full fb-rounded-md fb-border fb-p-2 fb-shadow-sm focus:fb-ring-0 sm:fb-text-sm border-slate-100 bg-slate-50 focus:border-slate-500"})),d("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},d("div",null),d("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:ring-slate-500",style:{backgroundColor:o}},e.buttonLabel||(n?"Finish":"Next"))))}function te({question:e,onSubmit:t,lastQuestion:n,brandColor:o}){const[r,s]=M(null);return d("form",{onSubmit:n=>{n.preventDefault();const o={[e.id]:n.currentTarget[e.id].value};n.currentTarget[e.id].value="",t(o)}},d(K,{headline:e.headline,questionId:e.id}),d(Z,{subheader:e.subheader,questionId:e.id}),d("div",{className:"fb-mt-4"},d("fieldset",null,d("legend",{className:"fb-sr-only"},"Choices"),d("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},e.choices&&e.choices.map(t=>d("label",{key:t.id,className:G(r===t.label?"fb-z-10 border-slate-400 bg-slate-50":"fb-border-gray-200","fb-relative fb-flex fb-cursor-pointer fb-flex-col fb-rounded-md fb-border fb-p-4 focus:fb-outline-none hover:bg-slate-50")},d("span",{className:"fb-flex fb-items-center fb-text-sm"},d("input",{type:"radio",id:t.id,name:e.id,value:t.label,className:"fb-h-4 fb-w-4 fb-border fb-border-gray-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":`${t.id}-label`,onChange:e=>{s(e.currentTarget.value)},style:{borderColor:o,color:o}}),d("span",{id:`${t.id}-label`,className:"fb-ml-3 fb-font-medium"},t.label))))))),d("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},d("div",null),d("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:ring-slate-500",style:{backgroundColor:o}},e.buttonLabel||(n?"Finish":"Next"))))}function ne({progress:e,brandColor:t}){return d("div",{className:"fb-h-1 fb-w-full fb-rounded-full bg-slate-200"},d("div",{className:"fb-h-1 fb-rounded-full",style:{backgroundColor:t,width:`${Math.floor(100*e)}%`}}))}function oe({config:e,survey:t,close:n,brandColor:o}){const[r,s]=M(t.questions[0]),[i,a]=M(0),[f,l]=M(null),[c,b]=M(null),[u,p]=M(!1);D(()=>{!async function(){const n=await(async(e,t)=>{const n=await fetch(`${t.apiHost}/api/v1/client/environments/${t.environmentId}/displays`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw console.error(n.text),new Error("Could not create display");return await n.json()})({surveyId:t.id,personId:e.person.id},e);b(n.id)}()},[e,t]),D(()=>{a(function(){const e=t.questions.findIndex(e=>e.id===r.id);return e/t.questions.length}())},[r,t]);const _=async o=>{p(!0);const i=t.questions.findIndex(e=>e.id===r.id),d=i===t.questions.length-1,b={surveyId:t.id,personId:e.person.id,response:{finished:d,data:o}};if(f)await(async(e,t,n)=>{const o=await fetch(`${n.apiHost}/api/v1/client/environments/${n.environmentId}/responses/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!o.ok)throw new Error("Could not update response");return await o.json()})(b,f,e);else{const[t,n]=await Promise.all([X(b,e),V(c,e)]);l(t.id)}p(!1),d?(a(100),n()):s(t.questions[i+1])};return d("div",null,d("div",{className:G(u?"fb-animate-pulse fb-opacity-60":"","fb-p-4")},"multipleChoiceSingle"===r.type?d(te,{question:r,onSubmit:_,lastQuestion:t.questions.findIndex(e=>e.id===r.id)===t.questions.length-1,brandColor:o}):"openText"===r.type?d(ee,{question:r,onSubmit:_,lastQuestion:t.questions.findIndex(e=>e.id===r.id)===t.questions.length-1,brandColor:o}):null),d("div",{className:"fb-mt-2"},d(ne,{progress:i,brandColor:o})))}function re({config:e,survey:t,closeSurvey:n}){var o;const[r,s]=M(!0),i=()=>{s(!1),setTimeout(()=>{n()},1e3)};return d("div",{id:"fbjs"},d(Y,{isOpen:r,close:i},d(oe,{config:e,survey:t,close:i,brandColor:null==(o=e.settings)?void 0:o.brandColor})))}function se(){return se=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},se.apply(this,arguments)}class ie{constructor(){this.config=this.loadFromLocalStorage()}static getInstance(){return ie.instance||(ie.instance=new ie),ie.instance}update(e){e&&(this.config=se({},this.config,e),this.saveToLocalStorage())}get(){return this.config}loadFromLocalStorage(){if("undefined"!=typeof window){const e=localStorage.getItem("config");if(e)return JSON.parse(e)}return{apiHost:null,environmentId:null}}saveToLocalStorage(){localStorage.setItem("config",JSON.stringify(this.config))}}ie.instance=void 0;class ae{constructor(){this.logLevel="error"}static getInstance(){return ae.instance||(ae.instance=new ae),ae.instance}configure(e){e&&void 0!==e.logLevel&&(this.logLevel=e.logLevel)}logger(e,t){if("debug"===t&&"debug"!==this.logLevel)return;const n=`🧱 Formbricks - ${(new Date).toISOString()} [${t.toUpperCase()}] - ${e}`;"error"===t?console.error(n):console.log(n)}debug(e){this.logger(e,"debug")}error(e){this.logger(e,"error")}}ae.instance=void 0;const fe=ae.getInstance(),le=ie.getInstance(),de=async()=>{const e=await fetch(`${le.get().apiHost}/api/v1/client/environments/${le.get().environmentId}/settings`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:le.get().person.id})});if(!e.ok)throw fe.error("Error getting settings"),Error("Error getting settings");return e.json()},ce="formbricks-web-container",be=ie.getInstance(),ue=ae.getInstance();let pe=!1;const _e=t=>{pe?ue.debug("A survey is already running. Skipping."):(pe=!0,function(t,n,o){var a,f,l;e.__&&e.__(t,n),f=(a=void 0===r)?null:n.__k,t=d(b,null,[t]),l=[],I(n,n.__k=t,f||s,s,void 0!==n.ownerSVGElement,f?null:n.childNodes.length?i.slice.call(n.childNodes):null,l,s,a),S(l,t)}(d(re,{config:be.get(),survey:t,closeSurvey:ge}),document.getElementById(ce)))},ge=async()=>{document.getElementById(ce).innerHTML="";const e=await de();be.update({settings:e}),pe=!1},he=ae.getInstance(),we=ie.getInstance(),me=async(e,t)=>{const n=await fetch(`${we.get().apiHost}/api/v1/client/environments/${we.get().environmentId}/events`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:we.get().session.id,eventName:e,properties:t})});if(n.ok)he.debug(`Formbricks: Event "${e}" tracked`),ve(e);else{const e=await n.json();he.error(`Formbricks: Error tracking event: ${JSON.stringify(e)}`)}},ve=e=>{for(const o of null==(t=we.get().settings)?void 0:t.surveys){var t;for(const t of o.triggers){var n;if((null==(n=t.eventClass)?void 0:n.name)===e)return he.debug(`Formbricks: survey ${o.id} triggered by event "${e}"`),void _e(o)}}},ye=ie.getInstance(),je=ae.getInstance(),xe=async()=>{je.debug("Creating new person");const e=await fetch(`${ye.get().apiHost}/api/v1/client/environments/${ye.get().environmentId}/people`,{method:"POST",headers:{"Content-Type":"application/json"}});return e.ok?await e.json():(console.error("Formbricks: Error fetching person"),null)},ke=(e,t)=>{const n=ye.get().person.attributes.find(t=>{var n;return(null==(n=t.attributeClass)?void 0:n.name)===e});return!(!n||n.value!==t)},Ie=ae.getInstance(),Se=ie.getInstance(),Ce=async()=>{if(!Se.get().person)return void Ie.error("Formbricks: Unable to create session. No person found");const e=await fetch(`${Se.get().apiHost}/api/v1/client/environments/${Se.get().environmentId}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:Se.get().person.id})});if(e.ok)return await e.json();Ie.error("Error creating session")},Ee=e=>{const t=se({},e);return t.expiresAt=Date.now()+36e5,t},Ne=e=>e.expiresAt<=Date.now(),Te=ie.getInstance(),He=ae.getInstance(),$e=()=>{var e;He.debug("checking page url");const t=null==(e=Te.get().settings)?void 0:e.noCodeEvents.filter(e=>{var t;return"pageUrl"===(null==(t=e.noCodeConfig)?void 0:t.type)});if(0!==t.length)for(const e of t){const{noCodeConfig:{pageUrl:t}}=e;t&&Le(window.location.href,t.value,t.rule)&&me(e.name)}};function Le(e,t,n){switch(n){case"exactMatch":return e===t;case"contains":return e.includes(t);case"startsWith":return e.startsWith(t);case"endsWith":return e.endsWith(t);case"notMatch":return e!==t;case"notContains":return!e.includes(t);default:throw new Error("Invalid match type")}}const qe=ie.getInstance(),ze=ae.getInstance(),Fe=()=>{if(!(qe.get().apiHost&&qe.get().environmentId&&qe.get().person&&qe.get().session&&qe.get().settings))throw Error("Formbricks: Formbricks not initialized. Call initialize() first.")},Oe=new class{constructor(){this.queue=[],this.running=!1}add(e){this.queue.push(e),this.running||this.run()}async run(){for(this.running=!0;this.queue.length>0;){const e=this.queue.shift();try{await e()}catch(e){console.error(e)}}this.running=!1}},Pe=(e,t)=>{Oe.add(async()=>{Fe(),await(async(e,t)=>{if(je.debug("setting attribute: "+e+" to value: "+t),ke(e,t))return void je.debug("attribute already set to this value. Skipping update.");const{person:n,settings:o}=await(async(e,t)=>{if(!ye.get().person||!ye.get().person.id)return void console.error("Formbricks: Unable to update attribute. No person set.");const n=await fetch(`${ye.get().apiHost}/api/v1/client/environments/${ye.get().environmentId}/people/${ye.get().person.id}/attribute`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e,value:t})}),o=await n.json();if(!n.ok)throw je.error("Error updating person"),Error("Error updating person");return o})(e,t);if(!n||!o)throw je.error("Error updating attribute"),new Error("Formbricks: Error updating attribute");ye.update({person:n,settings:o})})(e,t)})},Ue={init:e=>{Oe.add(async()=>{(async e=>{if(!e.environmentId)throw Error("Formbricks: environmentId is required");if(!e.apiHost)throw Error("Formbricks: apiHost is required");if(e.logLevel&&ze.configure({logLevel:e.logLevel}),(()=>{const e=document.createElement("div");e.id=ce,document.body.appendChild(e)})(),(()=>{if(null===document.getElementById("formbricks__css")){const e=document.createElement("style");e.id="formbricks__css",e.innerHTML='#fbjs *,#fbjs :after,#fbjs :before{border:0 solid #e5e7eb;box-sizing:border-box}#fbjs :after,#fbjs :before{--tw-content:""}#fbjs html{-webkit-text-size-adjust:100%;font-feature-settings:normal;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}#fbjs body{line-height:inherit;margin:0}#fbjs hr{border-top-width:1px;color:inherit;height:0}#fbjs abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6{font-size:inherit;font-weight:inherit}#fbjs a{color:inherit;text-decoration:inherit}#fbjs b,#fbjs strong{font-weight:bolder}#fbjs code,#fbjs kbd,#fbjs pre,#fbjs samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}#fbjs small{font-size:80%}#fbjs sub,#fbjs sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}#fbjs sub{bottom:-.25em}#fbjs sup{top:-.5em}#fbjs table{border-collapse:collapse;border-color:inherit;text-indent:0}#fbjs button,#fbjs input,#fbjs optgroup,#fbjs select,#fbjs textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}#fbjs button,#fbjs select{text-transform:none}#fbjs [type=button],#fbjs [type=reset],#fbjs [type=submit],#fbjs button{-webkit-appearance:button;background-color:transparent;background-image:none}#fbjs :-moz-focusring{outline:auto}#fbjs :-moz-ui-invalid{box-shadow:none}#fbjs progress{vertical-align:baseline}#fbjs ::-webkit-inner-spin-button,#fbjs ::-webkit-outer-spin-button{height:auto}#fbjs [type=search]{-webkit-appearance:textfield;outline-offset:-2px}#fbjs ::-webkit-search-decoration{-webkit-appearance:none}#fbjs ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}#fbjs summary{display:list-item}#fbjs blockquote,#fbjs dd,#fbjs dl,#fbjs figure,#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6,#fbjs hr,#fbjs p,#fbjs pre{margin:0}#fbjs fieldset{margin:0;padding:0}#fbjs legend{padding:0}#fbjs menu,#fbjs ol,#fbjs ul{list-style:none;margin:0;padding:0}#fbjs textarea{resize:vertical}#fbjs input::-moz-placeholder,#fbjs textarea::-moz-placeholder{color:#9ca3af;opacity:1}#fbjs input::placeholder,#fbjs textarea::placeholder{color:#9ca3af;opacity:1}#fbjs [role=button],#fbjs button{cursor:pointer}#fbjs :disabled{cursor:default}#fbjs audio,#fbjs canvas,#fbjs embed,#fbjs iframe,#fbjs img,#fbjs object,#fbjs svg,#fbjs video{display:block;vertical-align:middle}#fbjs img,#fbjs video{height:auto;max-width:100%}#fbjs [hidden]{display:none}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }#fbjs .fb-sr-only{clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}#fbjs .fb-pointer-events-none{pointer-events:none}#fbjs .fb-pointer-events-auto{pointer-events:auto}#fbjs .fb-fixed{position:fixed}#fbjs .fb-absolute{position:absolute}#fbjs .fb-relative{position:relative}#fbjs .fb-inset-0{bottom:0;left:0;right:0;top:0}#fbjs .fb-right-0{right:0}#fbjs .fb-top-0{top:0}#fbjs .fb-z-10{z-index:10}#fbjs .fb-ml-3{margin-left:.75rem}#fbjs .fb-mr-8{margin-right:2rem}#fbjs .fb-mt-2{margin-top:.5rem}#fbjs .fb-mt-4{margin-top:1rem}#fbjs .fb-block{display:block}#fbjs .fb-flex{display:flex}#fbjs .fb-hidden{display:none}#fbjs .fb-h-1{height:.25rem}#fbjs .fb-h-4{height:1rem}#fbjs .fb-h-6{height:1.5rem}#fbjs .fb-w-4{width:1rem}#fbjs .fb-w-6{width:1.5rem}#fbjs .fb-w-full{width:100%}#fbjs .fb-max-w-sm{max-width:24rem}#fbjs .fb-translate-x-0{--tw-translate-x:0px}#fbjs .fb-translate-x-0,#fbjs .fb-translate-x-28{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#fbjs .fb-translate-x-28{--tw-translate-x:7rem}@keyframes fb-pulse{50%{opacity:.5}}#fbjs .fb-animate-pulse{animation:fb-pulse 2s cubic-bezier(.4,0,.6,1) infinite}#fbjs .fb-cursor-pointer{cursor:pointer}#fbjs .fb-flex-col{flex-direction:column}#fbjs .fb-items-end{align-items:flex-end}#fbjs .fb-items-center{align-items:center}#fbjs .fb-justify-between{justify-content:space-between}#fbjs .fb-space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}#fbjs .fb-space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}#fbjs .fb-overflow-hidden{overflow:hidden}#fbjs .fb-rounded-full{border-radius:9999px}#fbjs .fb-rounded-lg{border-radius:.5rem}#fbjs .fb-rounded-md{border-radius:.375rem}#fbjs .fb-border{border-width:1px}#fbjs .fb-border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}#fbjs .fb-border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity))}#fbjs .fb-border-transparent{border-color:transparent}#fbjs .fb-bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}#fbjs .fb-p-2{padding:.5rem}#fbjs .fb-p-4{padding:1rem}#fbjs .fb-px-3{padding-left:.75rem;padding-right:.75rem}#fbjs .fb-px-4{padding-left:1rem;padding-right:1rem}#fbjs .fb-py-3{padding-bottom:.75rem;padding-top:.75rem}#fbjs .fb-py-6{padding-bottom:1.5rem;padding-top:1.5rem}#fbjs .fb-pr-4{padding-right:1rem}#fbjs .fb-pt-4{padding-top:1rem}#fbjs .fb-text-base{font-size:1rem;line-height:1.5rem}#fbjs .fb-text-sm{font-size:.875rem;line-height:1.25rem}#fbjs .fb-font-medium{font-weight:500}#fbjs .fb-font-normal{font-weight:400}#fbjs .fb-font-semibold{font-weight:600}#fbjs .fb-leading-4{line-height:1rem}#fbjs .fb-leading-6{line-height:1.5rem}#fbjs .fb-text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}#fbjs .fb-opacity-0{opacity:0}#fbjs .fb-opacity-100{opacity:1}#fbjs .fb-opacity-60{opacity:.6}#fbjs .fb-shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}#fbjs .fb-shadow-lg,#fbjs .fb-shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs .fb-shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}#fbjs .fb-ring-1{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs .fb-ring-black{--tw-ring-opacity:1;--tw-ring-color:rgb(0 0 0/var(--tw-ring-opacity))}#fbjs .fb-ring-opacity-5{--tw-ring-opacity:0.05}#fbjs .fb-transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs .fb-duration-500{transition-duration:.5s}#fbjs .fb-ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs .hover\\:fb-opacity-90:hover{opacity:.9}#fbjs .focus\\:fb-outline-none:focus{outline:2px solid transparent;outline-offset:2px}#fbjs .focus\\:fb-ring-0:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color)}#fbjs .focus\\:fb-ring-0:focus,#fbjs .focus\\:fb-ring-2:focus{box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs .focus\\:fb-ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color)}#fbjs .focus\\:fb-ring-offset-0:focus{--tw-ring-offset-width:0px}#fbjs .focus\\:fb-ring-offset-2:focus{--tw-ring-offset-width:2px}@media (min-width:640px){#fbjs .sm\\:fb-block{display:block}#fbjs .sm\\:fb-items-end{align-items:flex-end}#fbjs .sm\\:fb-p-6{padding:1.5rem}#fbjs .sm\\:fb-text-sm{font-size:.875rem;line-height:1.25rem}}',document.head.appendChild(e)}})(),!qe||qe.get().environmentId!==e.environmentId||qe.get().apiHost!==e.apiHost){qe.update({environmentId:e.environmentId,apiHost:e.apiHost});const{person:t,session:n,settings:o}=await xe();qe.update({person:t,session:Ee(n),settings:o}),me("New Session")}if(Ne(qe.get().session)){const{session:e,settings:t}=await Ce();qe.update({session:Ee(e),settings:t}),me("New Session")}(()=>{if("undefined"!=typeof window){const e=window.setInterval(async()=>{await(async()=>{if(Ie.debug("Checking session"),Ne(Se.get().session)){Ie.debug("Session expired, creating new session");const{session:e,settings:t}=await Ce();if(!e||!t)throw Ie.error("Error creating new session"),Error("Error creating new session");Se.update({session:e,settings:t}),me("New Session")}Ie.debug("Session not expired, extending session"),Se.update({session:Ee(Se.get().session)})})()},3e5);window.addEventListener("beforeunload",()=>{clearInterval(e)})}})(),"undefined"!=typeof window&&(window.addEventListener("hashchange",$e),window.addEventListener("popstate",$e),window.addEventListener("pushstate",$e),window.addEventListener("replacestate",$e),window.addEventListener("load",$e))})(e)})},setUserId:e=>{Oe.add(async()=>{Fe(),await(async e=>{if(je.debug("setting userId: "+e),ke("userId",e))return void je.debug("userId already set to this value. Skipping update.");if((e=>{const t=ye.get().person.attributes.find(e=>{var t;return"userId"===(null==(t=e.attributeClass)?void 0:t.name)});return!!t})())return void je.error("userId cannot be changed after it has been set. You need to reset first");const{person:t,settings:n}=await(async e=>{if(!ye.get().person||!ye.get().person.id)return void console.error("Formbricks: Unable to update userId. No person set.");const t=await fetch(`${ye.get().apiHost}/api/v1/client/environments/${ye.get().environmentId}/people/${ye.get().person.id}/user-id`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,sessionId:ye.get().session.id})});if(!t.ok)throw je.error("Formbricks: Error updating person"),Error("Error updating person");return await t.json()})(e);ye.update({person:t,settings:n})})(e)})},setEmail:e=>{Pe("email",e)},setAttribute:Pe,track:(e,t={})=>{Oe.add(async()=>{Fe(),await me(e,t)})},logout:()=>{Oe.add(async()=>{Fe(),await(async()=>{je.debug("Resetting person. Getting new person, session and settings from backend");const{person:e,session:t,settings:n}=await xe();if(!e||!t||!n)throw je.error("Error resetting user"),new Error("Formbricks: Error resetting user");ye.update({person:e,session:t,settings:n})})()})},refresh:()=>{Oe.add(async()=>{Fe(),await(async()=>{fe.debug("Refreshing - getting settings from backend");const e=await de();le.update({settings:e})})()})},registerRouteChange:()=>{Oe.add(async()=>{Fe(),$e()})}};export{Ue as default};
//# sourceMappingURL=index.modern.js.map

@@ -1,2 +0,2 @@

function e(n,r,o){if(!n.s){if(o instanceof t){if(!o.s)return void(o.o=e.bind(null,n,r));1&r&&(r=o.s),o=o.v}if(o&&o.then)return void o.then(e.bind(null,n,r),e.bind(null,n,2));n.s=r,n.v=o;var i=n.o;i&&i(n)}}var t=/*#__PURE__*/function(){function t(){}return t.prototype.then=function(n,r){var o=new t,i=this.s;if(i){var s=1&i?n:r;if(s){try{e(o,1,s(this.v))}catch(t){e(o,2,t)}return o}return this}return this.o=function(t){try{var i=t.v;1&t.s?e(o,1,n?n(i):i):r?e(o,1,r(i)):e(o,2,i)}catch(t){e(o,2,t)}},o},t}();function n(e){return e instanceof t&&1&e.s}var r=/*#__PURE__*/function(){function r(){this.queue=[],this.running=!1}var o=r.prototype;return o.add=function(e){this.queue.push(e),this.running||this.run()},o.run=function(){try{var r=function(){o.running=!1},o=this;o.running=!0;var i=function(r,o,i){for(var s;;){var a=r();if(n(a)&&(a=a.v),!a)return f;if(a.then){s=0;break}var f=i();if(f&&f.then){if(!n(f)){s=1;break}f=f.s}}var l=new t,u=e.bind(null,l,2);return(0===s?a.then(d):1===s?f.then(c):(void 0).then(function(){(a=r())?a.then?a.then(d).then(void 0,u):d(a):e(l,1,f)})).then(void 0,u),l;function c(t){f=t;do{if(!(a=r())||n(a)&&!a.v)return void e(l,1,f);if(a.then)return void a.then(d).then(void 0,u);n(f=i())&&(f=f.v)}while(!f||!f.then);f.then(c).then(void 0,u)}function d(t){t?(f=i())&&f.then?f.then(c).then(void 0,u):c(f):e(l,1,f)}}(function(){return o.queue.length>0},0,function(){var e=o.queue.shift(),t=function(t,n){try{var r=Promise.resolve(e()).then(function(){})}catch(e){return n(e)}return r&&r.then?r.then(void 0,n):r}(0,function(e){console.error(e)});if(t&&t.then)return t.then(function(){})});return Promise.resolve(i&&i.then?i.then(r):r())}catch(e){return Promise.reject(e)}},r}();function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o.apply(this,arguments)}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,f,l,u,c,d={},b=[],p=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function h(e,t){for(var n in t)e[n]=t[n];return e}function _(e){var t=e.parentNode;t&&t.removeChild(e)}function g(e,t,n){var r,o,i,s=arguments,a={};for(i in t)"key"==i?r=t[i]:"ref"==i?o=t[i]:a[i]=t[i];if(arguments.length>3)for(n=[n],i=3;i<arguments.length;i++)n.push(s[i]);if(null!=n&&(a.children=n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===a[i]&&(a[i]=e.defaultProps[i]);return m(e,a,r,o,null)}function m(e,t,n,r,o){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==o?++a.__v:o};return null!=a.vnode&&a.vnode(i),i}function v(e){return e.children}function w(e,t){this.props=e,this.context=t}function y(e,t){if(null==t)return e.__?y(e.__,e.__.__k.indexOf(e)+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?y(e):null}function j(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return j(e)}}function x(e){(!e.__d&&(e.__d=!0)&&f.push(e)&&!k.__r++||u!==a.debounceRendering)&&((u=a.debounceRendering)||l)(k)}function k(){for(var e;k.__r=f.length;)e=f.sort(function(e,t){return e.__v.__b-t.__v.__b}),f=[],e.some(function(e){var t,n,r,o,i,s,a;e.__d&&(s=(i=(t=e).__v).__e,(a=t.__P)&&(n=[],(r=h({},i)).__v=i.__v+1,o=H(a,i,r,t.__n,void 0!==a.ownerSVGElement,null!=i.__h?[s]:null,n,null==s?y(i):s,i.__h),L(n,i),o!=s&&j(i)))})}function P(e,t,n,r,o,i,s,a,f,l){var u,c,p,h,g,w,j,x=r&&r.__k||b,k=x.length;for(f==d&&(f=null!=s?s[0]:k?y(r,0):null),n.__k=[],u=0;u<t.length;u++)if(null!=(h=n.__k[u]=null==(h=t[u])||"boolean"==typeof h?null:"string"==typeof h||"number"==typeof h?m(null,h,null,null,h):Array.isArray(h)?m(v,{children:h},null,null,null):null!=h.__e||null!=h.__c?m(h.type,h.props,h.key,null,h.__v):h)){if(h.__=n,h.__b=n.__b+1,null===(p=x[u])||p&&h.key==p.key&&h.type===p.type)x[u]=void 0;else for(c=0;c<k;c++){if((p=x[c])&&h.key==p.key&&h.type===p.type){x[c]=void 0;break}p=null}g=H(e,h,p=p||d,o,i,s,a,f,l),(c=h.ref)&&p.ref!=c&&(j||(j=[]),p.ref&&j.push(p.ref,null,h),j.push(c,h.__c||g,h)),null!=g?(null==w&&(w=g),f=I(e,h,p,x,s,g,f),l||"option"!=n.type?"function"==typeof n.type&&(n.__d=f):e.value=""):f&&p.__e==f&&f.parentNode!=e&&(f=y(p))}if(n.__e=w,null!=s&&"function"!=typeof n.type)for(u=s.length;u--;)null!=s[u]&&_(s[u]);for(u=k;u--;)null!=x[u]&&z(x[u],x[u]);if(j)for(u=0;u<j.length;u++)q(j[u],j[++u],j[++u])}function I(e,t,n,r,o,i,s){var a,f,l;if(void 0!==t.__d)a=t.__d,t.__d=void 0;else if(o==n||i!=s||null==i.parentNode)e:if(null==s||s.parentNode!==e)e.appendChild(i),a=null;else{for(f=s,l=0;(f=f.nextSibling)&&l<r.length;l+=2)if(f==i)break e;e.insertBefore(i,s),a=s}return void 0!==a?a:i.nextSibling}function S(e,t,n){"-"===t[0]?e.setProperty(t,n):e[t]=null==n?"":"number"!=typeof n||p.test(t)?n:n+"px"}function C(e,t,n,r,o){var i,s,a;if(o&&"className"==t&&(t="class"),"style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||S(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||S(e.style,t,n[t])}else"o"===t[0]&&"n"===t[1]?(i=t!==(t=t.replace(/Capture$/,"")),(s=t.toLowerCase())in e&&(t=s),t=t.slice(2),e.l||(e.l={}),e.l[t+i]=n,a=i?N:E,n?r||e.addEventListener(t,a,i):e.removeEventListener(t,a,i)):"list"!==t&&"tagName"!==t&&"form"!==t&&"type"!==t&&"size"!==t&&"download"!==t&&"href"!==t&&!o&&t in e?e[t]=null==n?"":n:"function"!=typeof n&&"dangerouslySetInnerHTML"!==t&&(t!==(t=t.replace(/xlink:?/,""))?null==n||!1===n?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),n):null==n||!1===n&&!/^ar/.test(t)?e.removeAttribute(t):e.setAttribute(t,n))}function E(e){this.l[e.type+!1](a.event?a.event(e):e)}function N(e){this.l[e.type+!0](a.event?a.event(e):e)}function T(e,t,n){var r,o;for(r=0;r<e.__k.length;r++)(o=e.__k[r])&&(o.__=e,o.__e&&("function"==typeof o.type&&o.__k.length>1&&T(o,t,n),t=I(n,o,o,e.__k,null,o.__e,t),"function"==typeof e.type&&(e.__d=t)))}function H(e,t,n,r,o,i,s,f,l){var u,c,p,_,g,m,y,j,x,k,I,S=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(l=n.__h,f=t.__e=n.__e,t.__h=null,i=[f]),(u=a.__b)&&u(t);try{e:if("function"==typeof S){if(j=t.props,x=(u=S.contextType)&&r[u.__c],k=u?x?x.props.value:u.__:r,n.__c?y=(c=t.__c=n.__c).__=c.__E:("prototype"in S&&S.prototype.render?t.__c=c=new S(j,k):(t.__c=c=new w(j,k),c.constructor=S,c.render=F),x&&x.sub(c),c.props=j,c.state||(c.state={}),c.context=k,c.__n=r,p=c.__d=!0,c.__h=[]),null==c.__s&&(c.__s=c.state),null!=S.getDerivedStateFromProps&&(c.__s==c.state&&(c.__s=h({},c.__s)),h(c.__s,S.getDerivedStateFromProps(j,c.__s))),_=c.props,g=c.state,p)null==S.getDerivedStateFromProps&&null!=c.componentWillMount&&c.componentWillMount(),null!=c.componentDidMount&&c.__h.push(c.componentDidMount);else{if(null==S.getDerivedStateFromProps&&j!==_&&null!=c.componentWillReceiveProps&&c.componentWillReceiveProps(j,k),!c.__e&&null!=c.shouldComponentUpdate&&!1===c.shouldComponentUpdate(j,c.__s,k)||t.__v===n.__v){c.props=j,c.state=c.__s,t.__v!==n.__v&&(c.__d=!1),c.__v=t,t.__e=n.__e,t.__k=n.__k,c.__h.length&&s.push(c),T(t,f,e);break e}null!=c.componentWillUpdate&&c.componentWillUpdate(j,c.__s,k),null!=c.componentDidUpdate&&c.__h.push(function(){c.componentDidUpdate(_,g,m)})}c.context=k,c.props=j,c.state=c.__s,(u=a.__r)&&u(t),c.__d=!1,c.__v=t,c.__P=e,u=c.render(c.props,c.state,c.context),c.state=c.__s,null!=c.getChildContext&&(r=h(h({},r),c.getChildContext())),p||null==c.getSnapshotBeforeUpdate||(m=c.getSnapshotBeforeUpdate(_,g)),I=null!=u&&u.type==v&&null==u.key?u.props.children:u,P(e,Array.isArray(I)?I:[I],t,n,r,o,i,s,f,l),c.base=t.__e,t.__h=null,c.__h.length&&s.push(c),y&&(c.__E=c.__=null),c.__e=!1}else null==i&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=function(e,t,n,r,o,i,s,a){var f,l,u,c,p,h=n.props,_=t.props;if(o="svg"===t.type||o,null!=i)for(f=0;f<i.length;f++)if(null!=(l=i[f])&&((null===t.type?3===l.nodeType:l.localName===t.type)||e==l)){e=l,i[f]=null;break}if(null==e){if(null===t.type)return document.createTextNode(_);e=o?document.createElementNS("http://www.w3.org/2000/svg",t.type):document.createElement(t.type,_.is&&{is:_.is}),i=null,a=!1}if(null===t.type)h===_||a&&e.data===_||(e.data=_);else{if(null!=i&&(i=b.slice.call(e.childNodes)),u=(h=n.props||d).dangerouslySetInnerHTML,c=_.dangerouslySetInnerHTML,!a){if(null!=i)for(h={},p=0;p<e.attributes.length;p++)h[e.attributes[p].name]=e.attributes[p].value;(c||u)&&(c&&(u&&c.__html==u.__html||c.__html===e.innerHTML)||(e.innerHTML=c&&c.__html||""))}(function(e,t,n,r,o){var i;for(i in n)"children"===i||"key"===i||i in t||C(e,i,null,n[i],r);for(i in t)o&&"function"!=typeof t[i]||"children"===i||"key"===i||"value"===i||"checked"===i||n[i]===t[i]||C(e,i,t[i],n[i],r)})(e,_,h,o,a),c?t.__k=[]:(f=t.props.children,P(e,Array.isArray(f)?f:[f],t,n,r,"foreignObject"!==t.type&&o,i,s,d,a)),a||("value"in _&&void 0!==(f=_.value)&&(f!==e.value||"progress"===t.type&&!f)&&C(e,"value",f,h.value,!1),"checked"in _&&void 0!==(f=_.checked)&&f!==e.checked&&C(e,"checked",f,h.checked,!1))}return e}(n.__e,t,n,r,o,i,s,l);(u=a.diffed)&&u(t)}catch(e){t.__v=null,(l||null!=i)&&(t.__e=f,t.__h=!!l,i[i.indexOf(f)]=null),a.__e(e,t,n)}return t.__e}function L(e,t){a.__c&&a.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){a.__e(e,t.__v)}})}function q(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){a.__e(e,n)}}function z(e,t,n){var r,o,i;if(a.unmount&&a.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||q(r,null,t)),n||"function"==typeof e.type||(n=null!=(o=e.__e)),e.__e=e.__d=void 0,null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){a.__e(e,t)}r.base=r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&z(r[i],t,n);null!=o&&_(o)}function F(e,t,n){return this.constructor(e,n)}a={__e:function(e,t){for(var n,r,o,i=t.__h;t=t.__;)if((n=t.__c)&&!n.__)try{if((r=n.constructor)&&null!=r.getDerivedStateFromError&&(n.setState(r.getDerivedStateFromError(e)),o=n.__d),null!=n.componentDidCatch&&(n.componentDidCatch(e),o=n.__d),o)return t.__h=i,n.__E=n}catch(t){e=t}throw e},__v:0},w.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=h({},this.state),"function"==typeof e&&(e=e(h({},n),this.props)),e&&h(n,e),null!=e&&this.__v&&(t&&this.__h.push(t),x(this))},w.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),x(this))},w.prototype.render=v,f=[],l="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,k.__r=0,c=d;var O,A,U,M=0,D=[],W=a.__b,J=a.__r,B=a.diffed,R=a.__c,Q=a.unmount;function G(e,t){a.__h&&a.__h(A,e,M||t),M=0;var n=A.__H||(A.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Y(e){return M=1,function(e,t,n){var r=G(O++,2);return r.t=e,r.__c||(r.__=[ee(void 0,t),function(e){var t=r.t(r.__[0],e);r.__[0]!==t&&(r.__=[t,r.__[1]],r.__c.setState({}))}],r.__c=A),r.__}(ee,e)}function $(e,t){var n=G(O++,3);!a.__s&&function(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}(n.__H,t)&&(n.__=e,n.__H=t,A.__H.__h.push(n))}function V(){D.forEach(function(e){if(e.__P)try{e.__H.__h.forEach(K),e.__H.__h.forEach(Z),e.__H.__h=[]}catch(t){e.__H.__h=[],a.__e(t,e.__v)}}),D=[]}a.__b=function(e){A=null,W&&W(e)},a.__r=function(e){J&&J(e),O=0;var t=(A=e.__c).__H;t&&(t.__h.forEach(K),t.__h.forEach(Z),t.__h=[])},a.diffed=function(e){B&&B(e);var t=e.__c;t&&t.__H&&t.__H.__h.length&&(1!==D.push(t)&&U===a.requestAnimationFrame||((U=a.requestAnimationFrame)||function(e){var t,n=function(){clearTimeout(r),X&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);X&&(t=requestAnimationFrame(n))})(V)),A=void 0},a.__c=function(e,t){t.some(function(e){try{e.__h.forEach(K),e.__h=e.__h.filter(function(e){return!e.__||Z(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],a.__e(n,e.__v)}}),R&&R(e,t)},a.unmount=function(e){Q&&Q(e);var t=e.__c;if(t&&t.__H)try{t.__H.__.forEach(K)}catch(e){a.__e(e,t.__v)}};var X="function"==typeof requestAnimationFrame;function K(e){var t=A;"function"==typeof e.__c&&e.__c(),A=t}function Z(e){var t=A;e.__c=e.__(),A=t}function ee(e,t){return"function"==typeof t?t(e):t}var te=function(){return[].slice.call(arguments).filter(Boolean).join(" ")};function ne(e){var t=e.children,n=e.isOpen,r=e.close,o=Y(!1),i=o[0],s=o[1];return $(function(){s(n)},[n]),g("div",{"aria-live":"assertive",className:"fb-pointer-events-none fb-fixed fb-inset-0 fb-flex fb-items-end fb-px-4 fb-py-6 sm:fb-p-6"},g("div",{className:"fb-flex fb-w-full fb-flex-col fb-items-center fb-space-y-4 sm:fb-items-end"},g("div",{className:te(i?"fb-translate-x-0 fb-opacity-100":"fb-translate-x-28 fb-opacity-0","fb-pointer-events-auto fb-relative fb-w-full fb-max-w-sm fb-overflow-hidden fb-rounded-lg fb-bg-white fb-shadow-lg fb-ring-1 fb-ring-black fb-ring-opacity-5 fb-transition-all fb-duration-500 fb-ease-in-out")},g("div",{class:"fb-absolute fb-top-0 fb-right-0 fb-hidden fb-pt-4 fb-pr-4 sm:fb-block"},g("button",{type:"button",onClick:r,class:"fb-rounded-md fb-bg-white focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 text-slate-400 hover:text-slate-500 focus:ring-slate-500"},g("span",{class:"fb-sr-only"},"Close"),g("svg",{class:"fb-h-6 fb-w-6",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},g("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})))),g("div",{className:""},t))))}var re=function(e,t){try{return Promise.resolve(fetch(t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/displays/"+e+"/responded",{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(e){if(!e.ok)throw new Error("Could not update display")})}catch(e){return Promise.reject(e)}},oe=function(e,t){try{return Promise.resolve(fetch(t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/responses",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){if(!e.ok)throw console.error(e.text),new Error("Could not create response");return Promise.resolve(e.json())})}catch(e){return Promise.reject(e)}};function ie(e){return g("label",{htmlFor:e.questionId,className:"fb-block fb-text-base fb-font-semibold fb-leading-6 fb-mr-8 text-slate-900"},e.headline)}function se(e){return g("label",{for:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600"},e.subheader)}function ae(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return g("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);e.currentTarget[t.id].value="",n(o)}},g(ie,{headline:t.headline,questionId:t.id}),g(se,{subheader:t.subheader,questionId:t.id}),g("div",{className:"fb-mt-4"},g("textarea",{rows:3,name:t.id,id:t.id,placeholder:t.placeholder,required:t.required,className:"fb-block fb-w-full fb-rounded-md fb-border fb-p-2 fb-shadow-sm focus:fb-ring-0 sm:fb-text-sm border-slate-100 bg-slate-50 focus:border-slate-500"})),g("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},g("div",null),g("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function fe(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=Y(null),s=i[0],a=i[1];return g("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);e.currentTarget[t.id].value="",n(o)}},g(ie,{headline:t.headline,questionId:t.id}),g(se,{subheader:t.subheader,questionId:t.id}),g("div",{className:"fb-mt-4"},g("fieldset",null,g("legend",{className:"fb-sr-only"},"Choices"),g("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e){return g("label",{key:e.id,className:te(s===e.label?"fb-z-10 border-slate-400 bg-slate-50":"fb-border-gray-200","fb-relative fb-flex fb-cursor-pointer fb-flex-col fb-rounded-md fb-border fb-p-4 focus:fb-outline-none hover:bg-slate-50")},g("span",{className:"fb-flex fb-items-center fb-text-sm"},g("input",{type:"radio",id:e.id,name:t.id,value:e.label,className:"fb-h-4 fb-w-4 fb-border fb-border-gray-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":e.id+"-label",onChange:function(e){a(e.currentTarget.value)},style:{borderColor:o,color:o}}),g("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),g("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},g("div",null),g("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function le(e){return g("div",{className:"fb-h-1 fb-w-full fb-rounded-full bg-slate-200"},g("div",{className:"fb-h-1 fb-rounded-full",style:{backgroundColor:e.brandColor,width:Math.floor(100*e.progress)+"%"}}))}function ue(e){var t=e.config,n=e.survey,r=e.close,o=e.brandColor,i=Y(n.questions[0]),s=i[0],a=i[1],f=Y(0),l=f[0],u=f[1],c=Y(null),d=c[0],b=c[1],p=Y(null),h=p[0],_=p[1],m=Y(!1),v=m[0],w=m[1];$(function(){!function(){try{Promise.resolve(function(e,t){try{return Promise.resolve(fetch(t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/displays",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){if(!e.ok)throw console.error(e.text),new Error("Could not create display");return Promise.resolve(e.json())})}catch(e){return Promise.reject(e)}}({surveyId:n.id,personId:t.person.id},t)).then(function(e){_(e.id)})}catch(e){return Promise.reject(e)}}()},[t,n]),$(function(){var e;u((e=n.questions.findIndex(function(e){return e.id===s.id}),e/n.questions.length))},[s,n]);var y=function(e){try{var o=function(){w(!1),f?(u(100),r()):a(n.questions[i+1])};w(!0);var i=n.questions.findIndex(function(e){return e.id===s.id}),f=i===n.questions.length-1,l={surveyId:n.id,personId:t.person.id,response:{finished:f,data:e}},c=d?Promise.resolve(function(e,t,n){try{return Promise.resolve(fetch(n.apiHost+"/api/v1/client/environments/"+n.environmentId+"/responses/"+t,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){if(!e.ok)throw new Error("Could not update response");return Promise.resolve(e.json())})}catch(e){return Promise.reject(e)}}(l,d,t)).then(function(){}):Promise.resolve(Promise.all([oe(l,t),re(h,t)])).then(function(e){b(e[0].id)});return Promise.resolve(c&&c.then?c.then(o):o())}catch(e){return Promise.reject(e)}};return g("div",null,g("div",{className:te(v?"fb-animate-pulse fb-opacity-60":"","fb-p-4")},"multipleChoiceSingle"===s.type?g(fe,{question:s,onSubmit:y,lastQuestion:n.questions.findIndex(function(e){return e.id===s.id})===n.questions.length-1,brandColor:o}):"openText"===s.type?g(ae,{question:s,onSubmit:y,lastQuestion:n.questions.findIndex(function(e){return e.id===s.id})===n.questions.length-1,brandColor:o}):null),g("div",{className:"fb-mt-2"},g(le,{progress:l,brandColor:o})))}function ce(e){var t,n=e.config,r=e.survey,o=e.closeSurvey,i=Y(!0),s=i[1],a=function(){s(!1),setTimeout(function(){o()},1e3)};return g("div",{id:"fbjs"},g(ne,{isOpen:i[0],close:a},g(ue,{config:n,survey:r,close:a,brandColor:null==(t=n.settings)?void 0:t.brandColor})))}var de=/*#__PURE__*/function(){function e(){this.config=this.loadFromLocalStorage()}e.getInstance=function(){return e.instance||(e.instance=new e),e.instance};var t=e.prototype;return t.update=function(e){e&&(this.config=o({},this.config,e),this.saveToLocalStorage())},t.get=function(){return this.config},t.loadFromLocalStorage=function(){if("undefined"!=typeof window){var e=localStorage.getItem("config");if(e)return JSON.parse(e)}return{apiHost:null,environmentId:null}},t.saveToLocalStorage=function(){localStorage.setItem("config",JSON.stringify(this.config))},e}();de.instance=void 0;var be=/*#__PURE__*/function(){function e(){this.logLevel="error"}e.getInstance=function(){return e.instance||(e.instance=new e),e.instance};var t=e.prototype;return t.configure=function(e){e&&void 0!==e.logLevel&&(this.logLevel=e.logLevel)},t.logger=function(e,t){if("debug"!==t||"debug"===this.logLevel){var n="🧱 Formbricks - "+(new Date).toISOString()+" ["+t.toUpperCase()+"] - "+e;"error"===t?console.error(n):console.log(n)}},t.debug=function(e){this.logger(e,"debug")},t.error=function(e){this.logger(e,"error")},e}();be.instance=void 0;var pe=be.getInstance(),he=de.getInstance(),_e=function(){try{return Promise.resolve(fetch(he.get().apiHost+"/api/v1/client/environments/"+he.get().environmentId+"/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:he.get().person.id})})).then(function(e){if(!e.ok)throw pe.error("Error getting settings"),Error("Error getting settings");return e.json()})}catch(e){return Promise.reject(e)}},ge="formbricks-web-container",me=de.getInstance(),ve=be.getInstance(),we=!1,ye=function(e){we?ve.debug("A survey is already running. Skipping."):(we=!0,function(e,t,n){var r,o,i;a.__&&a.__(e,t),o=(r=void 0===c)?null:t.__k,e=g(v,null,[e]),i=[],H(t,t.__k=e,o||d,d,void 0!==t.ownerSVGElement,o?null:t.childNodes.length?b.slice.call(t.childNodes):null,i,d,r),L(i,e)}(g(ce,{config:me.get(),survey:e,closeSurvey:je}),document.getElementById(ge)))},je=function(){try{return document.getElementById(ge).innerHTML="",Promise.resolve(_e()).then(function(e){me.update({settings:e}),we=!1})}catch(e){return Promise.reject(e)}},xe=be.getInstance(),ke=de.getInstance(),Pe=function(e,t){try{return Promise.resolve(fetch(ke.get().apiHost+"/api/v1/client/environments/"+ke.get().environmentId+"/events",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:ke.get().session.id,eventName:e,properties:t})})).then(function(t){var n;function r(t){if(n)return t;xe.debug('Formbricks: Event "'+e+'" tracked'),Ie(e)}var o=function(){if(!t.ok)return Promise.resolve(t.json()).then(function(e){xe.error("Formbricks: Error tracking event: "+JSON.stringify(e)),n=1})}();return o&&o.then?o.then(r):r(o)})}catch(e){return Promise.reject(e)}},Ie=function(e){for(var t,n=s(null==(r=ke.get().settings)?void 0:r.surveys);!(t=n()).done;)for(var r,o,i=t.value,a=s(i.triggers);!(o=a()).done;){var f;if((null==(f=o.value.eventClass)?void 0:f.name)===e)return xe.debug("Formbricks: survey "+i.id+' triggered by event "'+e+'"'),void ye(i)}},Se=de.getInstance(),Ce=be.getInstance(),Ee=function(){try{return Ce.debug("Creating new person"),Promise.resolve(fetch(Se.get().apiHost+"/api/v1/client/environments/"+Se.get().environmentId+"/people",{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(e){return e.ok?Promise.resolve(e.json()):(console.error("Formbricks: Error fetching person"),null)})}catch(e){return Promise.reject(e)}},Ne=function(e,t){var n=Se.get().person.attributes.find(function(t){var n;return(null==(n=t.attributeClass)?void 0:n.name)===e});return!(!n||n.value!==t)},Te=be.getInstance(),He=de.getInstance(),Le=function(){try{return He.get().person?Promise.resolve(fetch(He.get().apiHost+"/api/v1/client/environments/"+He.get().environmentId+"/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:He.get().person.id})})).then(function(e){if(e.ok)return Promise.resolve(e.json());Te.error("Error creating session")}):(Te.error("Formbricks: Unable to create session. No person found"),Promise.resolve())}catch(e){return Promise.reject(e)}},qe=function(e){var t=o({},e);return t.expiresAt=Date.now()+36e5,t},ze=function(e){return e.expiresAt<=Date.now()},Fe=de.getInstance(),Oe=be.getInstance(),Ae=function(){var e;Oe.debug("checking page url");var t=null==(e=Fe.get().settings)?void 0:e.noCodeEvents.filter(function(e){var t;return"pageUrl"===(null==(t=e.noCodeConfig)?void 0:t.type)});if(0!==t.length)for(var n,r=s(t);!(n=r()).done;){var o=n.value,i=o.noCodeConfig.pageUrl;i&&Ue(window.location.href,i.value,i.rule)&&Pe(o.name)}};function Ue(e,t,n){switch(n){case"exactMatch":return e===t;case"contains":return e.includes(t);case"startsWith":return e.startsWith(t);case"endsWith":return e.endsWith(t);case"notMatch":return e!==t;case"notContains":return!e.includes(t);default:throw new Error("Invalid match type")}}var Me=de.getInstance(),De=be.getInstance(),We=function(){if(!(Me.get().apiHost&&Me.get().environmentId&&Me.get().person&&Me.get().session&&Me.get().settings))throw Error("Formbricks: Formbricks not initialized. Call initialize() first.")},Je=new r,Be=function(e,t){Je.add(function(){try{return We(),Promise.resolve(function(e,t){try{return Ce.debug("setting attribute: "+e+" to value: "+t),Ne(e,t)?(Ce.debug("attribute already set to this value. Skipping update."),Promise.resolve()):Promise.resolve(function(e,t){try{return Se.get().person&&Se.get().person.id?Promise.resolve(fetch(Se.get().apiHost+"/api/v1/client/environments/"+Se.get().environmentId+"/people/"+Se.get().person.id+"/attribute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e,value:t})})).then(function(e){return Promise.resolve(e.json()).then(function(t){if(!e.ok)throw Ce.error("Error updating person"),Error("Error updating person");return t})}):(console.error("Formbricks: Unable to update attribute. No person set."),Promise.resolve())}catch(e){return Promise.reject(e)}}(e,t)).then(function(e){var t=e.person,n=e.settings;if(!t||!n)throw Ce.error("Error updating attribute"),new Error("Formbricks: Error updating attribute");Se.update({person:t,settings:n})})}catch(e){return Promise.reject(e)}}(e,t)).then(function(){})}catch(e){return Promise.reject(e)}})},Re={init:function(e){Je.add(function(){try{return function(e){try{var t=function(){function e(){(function(){if("undefined"!=typeof window){var e=window.setInterval(function(){try{return Promise.resolve(function(){try{var e=function(e){Te.debug("Session not expired, extending session"),He.update({session:qe(He.get().session)})};Te.debug("Checking session");var t=function(){if(ze(He.get().session))return Te.debug("Session expired, creating new session"),Promise.resolve(Le()).then(function(e){var t=e.session,n=e.settings;if(!t||!n)throw Te.error("Error creating new session"),Error("Error creating new session");He.update({session:t,settings:n}),Pe("New Session")})}();return Promise.resolve(t&&t.then?t.then(e):e())}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}},3e5);window.addEventListener("beforeunload",function(){clearInterval(e)})}})(),"undefined"!=typeof window&&(window.addEventListener("hashchange",Ae),window.addEventListener("popstate",Ae),window.addEventListener("pushstate",Ae),window.addEventListener("replacestate",Ae),window.addEventListener("load",Ae))}var t=function(){if(ze(Me.get().session))return Promise.resolve(Le()).then(function(e){var t=e.settings;Me.update({session:qe(e.session),settings:t}),Pe("New Session")})}();return t&&t.then?t.then(e):e()};if(!e.environmentId)throw Error("Formbricks: environmentId is required");if(!e.apiHost)throw Error("Formbricks: apiHost is required");e.logLevel&&De.configure({logLevel:e.logLevel}),(r=document.createElement("div")).id=ge,document.body.appendChild(r),function(){if(null===document.getElementById("formbricks__css")){var e=document.createElement("style");e.id="formbricks__css",e.innerHTML='#fbjs *,#fbjs :after,#fbjs :before{border:0 solid #e5e7eb;box-sizing:border-box}#fbjs :after,#fbjs :before{--tw-content:""}#fbjs html{-webkit-text-size-adjust:100%;font-feature-settings:normal;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}#fbjs body{line-height:inherit;margin:0}#fbjs hr{border-top-width:1px;color:inherit;height:0}#fbjs abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6{font-size:inherit;font-weight:inherit}#fbjs a{color:inherit;text-decoration:inherit}#fbjs b,#fbjs strong{font-weight:bolder}#fbjs code,#fbjs kbd,#fbjs pre,#fbjs samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}#fbjs small{font-size:80%}#fbjs sub,#fbjs sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}#fbjs sub{bottom:-.25em}#fbjs sup{top:-.5em}#fbjs table{border-collapse:collapse;border-color:inherit;text-indent:0}#fbjs button,#fbjs input,#fbjs optgroup,#fbjs select,#fbjs textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}#fbjs button,#fbjs select{text-transform:none}#fbjs [type=button],#fbjs [type=reset],#fbjs [type=submit],#fbjs button{-webkit-appearance:button;background-color:transparent;background-image:none}#fbjs :-moz-focusring{outline:auto}#fbjs :-moz-ui-invalid{box-shadow:none}#fbjs progress{vertical-align:baseline}#fbjs ::-webkit-inner-spin-button,#fbjs ::-webkit-outer-spin-button{height:auto}#fbjs [type=search]{-webkit-appearance:textfield;outline-offset:-2px}#fbjs ::-webkit-search-decoration{-webkit-appearance:none}#fbjs ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}#fbjs summary{display:list-item}#fbjs blockquote,#fbjs dd,#fbjs dl,#fbjs figure,#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6,#fbjs hr,#fbjs p,#fbjs pre{margin:0}#fbjs fieldset{margin:0;padding:0}#fbjs legend{padding:0}#fbjs menu,#fbjs ol,#fbjs ul{list-style:none;margin:0;padding:0}#fbjs textarea{resize:vertical}#fbjs input::-moz-placeholder,#fbjs textarea::-moz-placeholder{color:#9ca3af;opacity:1}#fbjs input::placeholder,#fbjs textarea::placeholder{color:#9ca3af;opacity:1}#fbjs [role=button],#fbjs button{cursor:pointer}#fbjs :disabled{cursor:default}#fbjs audio,#fbjs canvas,#fbjs embed,#fbjs iframe,#fbjs img,#fbjs object,#fbjs svg,#fbjs video{display:block;vertical-align:middle}#fbjs img,#fbjs video{height:auto;max-width:100%}#fbjs [hidden]{display:none}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }#fbjs .fb-sr-only{clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}#fbjs .fb-pointer-events-none{pointer-events:none}#fbjs .fb-pointer-events-auto{pointer-events:auto}#fbjs .fb-fixed{position:fixed}#fbjs .fb-absolute{position:absolute}#fbjs .fb-relative{position:relative}#fbjs .fb-inset-0{bottom:0;left:0;right:0;top:0}#fbjs .fb-right-0{right:0}#fbjs .fb-top-0{top:0}#fbjs .fb-z-10{z-index:10}#fbjs .fb-ml-3{margin-left:.75rem}#fbjs .fb-mr-8{margin-right:2rem}#fbjs .fb-mt-2{margin-top:.5rem}#fbjs .fb-mt-4{margin-top:1rem}#fbjs .fb-block{display:block}#fbjs .fb-flex{display:flex}#fbjs .fb-hidden{display:none}#fbjs .fb-h-1{height:.25rem}#fbjs .fb-h-4{height:1rem}#fbjs .fb-h-6{height:1.5rem}#fbjs .fb-w-4{width:1rem}#fbjs .fb-w-6{width:1.5rem}#fbjs .fb-w-full{width:100%}#fbjs .fb-max-w-sm{max-width:24rem}#fbjs .fb-translate-x-0{--tw-translate-x:0px}#fbjs .fb-translate-x-0,#fbjs .fb-translate-x-28{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#fbjs .fb-translate-x-28{--tw-translate-x:7rem}@keyframes fb-pulse{50%{opacity:.5}}#fbjs .fb-animate-pulse{animation:fb-pulse 2s cubic-bezier(.4,0,.6,1) infinite}#fbjs .fb-cursor-pointer{cursor:pointer}#fbjs .fb-flex-col{flex-direction:column}#fbjs .fb-items-end{align-items:flex-end}#fbjs .fb-items-center{align-items:center}#fbjs .fb-justify-between{justify-content:space-between}#fbjs .fb-space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}#fbjs .fb-space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}#fbjs .fb-overflow-hidden{overflow:hidden}#fbjs .fb-rounded-full{border-radius:9999px}#fbjs .fb-rounded-lg{border-radius:.5rem}#fbjs .fb-rounded-md{border-radius:.375rem}#fbjs .fb-border{border-width:1px}#fbjs .fb-border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}#fbjs .fb-border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity))}#fbjs .fb-border-transparent{border-color:transparent}#fbjs .fb-bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}#fbjs .fb-p-2{padding:.5rem}#fbjs .fb-p-4{padding:1rem}#fbjs .fb-px-3{padding-left:.75rem;padding-right:.75rem}#fbjs .fb-px-4{padding-left:1rem;padding-right:1rem}#fbjs .fb-py-3{padding-bottom:.75rem;padding-top:.75rem}#fbjs .fb-py-6{padding-bottom:1.5rem;padding-top:1.5rem}#fbjs .fb-pr-4{padding-right:1rem}#fbjs .fb-pt-4{padding-top:1rem}#fbjs .fb-text-base{font-size:1rem;line-height:1.5rem}#fbjs .fb-text-sm{font-size:.875rem;line-height:1.25rem}#fbjs .fb-font-medium{font-weight:500}#fbjs .fb-font-normal{font-weight:400}#fbjs .fb-font-semibold{font-weight:600}#fbjs .fb-leading-4{line-height:1rem}#fbjs .fb-leading-6{line-height:1.5rem}#fbjs .fb-text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}#fbjs .fb-opacity-0{opacity:0}#fbjs .fb-opacity-100{opacity:1}#fbjs .fb-opacity-60{opacity:.6}#fbjs .fb-shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}#fbjs .fb-shadow-lg,#fbjs .fb-shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs .fb-shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}#fbjs .fb-ring-1{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs .fb-ring-black{--tw-ring-opacity:1;--tw-ring-color:rgb(0 0 0/var(--tw-ring-opacity))}#fbjs .fb-ring-opacity-5{--tw-ring-opacity:0.05}#fbjs .fb-transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs .fb-duration-500{transition-duration:.5s}#fbjs .fb-ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs .hover\\:fb-opacity-90:hover{opacity:.9}#fbjs .focus\\:fb-outline-none:focus{outline:2px solid transparent;outline-offset:2px}#fbjs .focus\\:fb-ring-0:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color)}#fbjs .focus\\:fb-ring-0:focus,#fbjs .focus\\:fb-ring-2:focus{box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs .focus\\:fb-ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color)}#fbjs .focus\\:fb-ring-offset-0:focus{--tw-ring-offset-width:0px}#fbjs .focus\\:fb-ring-offset-2:focus{--tw-ring-offset-width:2px}@media (min-width:640px){#fbjs .sm\\:fb-block{display:block}#fbjs .sm\\:fb-items-end{align-items:flex-end}#fbjs .sm\\:fb-p-6{padding:1.5rem}#fbjs .sm\\:fb-text-sm{font-size:.875rem;line-height:1.25rem}}',document.head.appendChild(e)}}();var n=function(){if(!Me||Me.get().environmentId!==e.environmentId||Me.get().apiHost!==e.apiHost)return Me.update({environmentId:e.environmentId,apiHost:e.apiHost}),Promise.resolve(Ee()).then(function(e){var t=e.settings;Me.update({person:e.person,session:qe(e.session),settings:t}),Pe("New Session")})}();return Promise.resolve(n&&n.then?n.then(t):t())}catch(e){return Promise.reject(e)}var r}(e),Promise.resolve()}catch(e){return Promise.reject(e)}})},setUserId:function(e){Je.add(function(){try{return We(),Promise.resolve(function(e){try{return Ce.debug("setting userId: "+e),Ne("userId",e)?(Ce.debug("userId already set to this value. Skipping update."),Promise.resolve()):(t=Se.get().person.attributes.find(function(e){var t;return"userId"===(null==(t=e.attributeClass)?void 0:t.name)}),t?(Ce.error("userId cannot be changed after it has been set. You need to reset first"),Promise.resolve()):Promise.resolve(function(e){try{return Se.get().person&&Se.get().person.id?Promise.resolve(fetch(Se.get().apiHost+"/api/v1/client/environments/"+Se.get().environmentId+"/people/"+Se.get().person.id+"/user-id",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,sessionId:Se.get().session.id})})).then(function(e){if(!e.ok)throw Ce.error("Formbricks: Error updating person"),Error("Error updating person");return Promise.resolve(e.json())}):(console.error("Formbricks: Unable to update userId. No person set."),Promise.resolve())}catch(e){return Promise.reject(e)}}(e)).then(function(e){Se.update({person:e.person,settings:e.settings})}))}catch(e){return Promise.reject(e)}var t}(e)).then(function(){})}catch(e){return Promise.reject(e)}})},setEmail:function(e){Be("email",e)},setAttribute:Be,track:function(e,t){void 0===t&&(t={}),Je.add(function(){try{return We(),Promise.resolve(Pe(e,t)).then(function(){})}catch(e){return Promise.reject(e)}})},logout:function(){Je.add(function(){try{return We(),Promise.resolve(function(){try{return Ce.debug("Resetting person. Getting new person, session and settings from backend"),Promise.resolve(Ee()).then(function(e){var t=e.person,n=e.session,r=e.settings;if(!t||!n||!r)throw Ce.error("Error resetting user"),new Error("Formbricks: Error resetting user");Se.update({person:t,session:n,settings:r})})}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}})},refresh:function(){Je.add(function(){try{return We(),Promise.resolve(function(){try{return pe.debug("Refreshing - getting settings from backend"),Promise.resolve(_e()).then(function(e){he.update({settings:e})})}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}})},registerRouteChange:function(){console.log("fire!!!"),Je.add(function(){try{return We(),Ae(),Promise.resolve()}catch(e){return Promise.reject(e)}})}};"undefined"!=typeof window&&(window.formbricks=Re);export{Re as default};
function e(n,r,o){if(!n.s){if(o instanceof t){if(!o.s)return void(o.o=e.bind(null,n,r));1&r&&(r=o.s),o=o.v}if(o&&o.then)return void o.then(e.bind(null,n,r),e.bind(null,n,2));n.s=r,n.v=o;var i=n.o;i&&i(n)}}var t=/*#__PURE__*/function(){function t(){}return t.prototype.then=function(n,r){var o=new t,i=this.s;if(i){var s=1&i?n:r;if(s){try{e(o,1,s(this.v))}catch(t){e(o,2,t)}return o}return this}return this.o=function(t){try{var i=t.v;1&t.s?e(o,1,n?n(i):i):r?e(o,1,r(i)):e(o,2,i)}catch(t){e(o,2,t)}},o},t}();function n(e){return e instanceof t&&1&e.s}var r=/*#__PURE__*/function(){function r(){this.queue=[],this.running=!1}var o=r.prototype;return o.add=function(e){this.queue.push(e),this.running||this.run()},o.run=function(){try{var r=function(){o.running=!1},o=this;o.running=!0;var i=function(r,o,i){for(var s;;){var a=r();if(n(a)&&(a=a.v),!a)return f;if(a.then){s=0;break}var f=i();if(f&&f.then){if(!n(f)){s=1;break}f=f.s}}var l=new t,u=e.bind(null,l,2);return(0===s?a.then(d):1===s?f.then(c):(void 0).then(function(){(a=r())?a.then?a.then(d).then(void 0,u):d(a):e(l,1,f)})).then(void 0,u),l;function c(t){f=t;do{if(!(a=r())||n(a)&&!a.v)return void e(l,1,f);if(a.then)return void a.then(d).then(void 0,u);n(f=i())&&(f=f.v)}while(!f||!f.then);f.then(c).then(void 0,u)}function d(t){t?(f=i())&&f.then?f.then(c).then(void 0,u):c(f):e(l,1,f)}}(function(){return o.queue.length>0},0,function(){var e=o.queue.shift(),t=function(t,n){try{var r=Promise.resolve(e()).then(function(){})}catch(e){return n(e)}return r&&r.then?r.then(void 0,n):r}(0,function(e){console.error(e)});if(t&&t.then)return t.then(function(){})});return Promise.resolve(i&&i.then?i.then(r):r())}catch(e){return Promise.reject(e)}},r}();function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o.apply(this,arguments)}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,f,l,u,c,d={},b=[],p=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function h(e,t){for(var n in t)e[n]=t[n];return e}function _(e){var t=e.parentNode;t&&t.removeChild(e)}function g(e,t,n){var r,o,i,s=arguments,a={};for(i in t)"key"==i?r=t[i]:"ref"==i?o=t[i]:a[i]=t[i];if(arguments.length>3)for(n=[n],i=3;i<arguments.length;i++)n.push(s[i]);if(null!=n&&(a.children=n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===a[i]&&(a[i]=e.defaultProps[i]);return m(e,a,r,o,null)}function m(e,t,n,r,o){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==o?++a.__v:o};return null!=a.vnode&&a.vnode(i),i}function v(e){return e.children}function w(e,t){this.props=e,this.context=t}function y(e,t){if(null==t)return e.__?y(e.__,e.__.__k.indexOf(e)+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?y(e):null}function j(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return j(e)}}function x(e){(!e.__d&&(e.__d=!0)&&f.push(e)&&!k.__r++||u!==a.debounceRendering)&&((u=a.debounceRendering)||l)(k)}function k(){for(var e;k.__r=f.length;)e=f.sort(function(e,t){return e.__v.__b-t.__v.__b}),f=[],e.some(function(e){var t,n,r,o,i,s,a;e.__d&&(s=(i=(t=e).__v).__e,(a=t.__P)&&(n=[],(r=h({},i)).__v=i.__v+1,o=H(a,i,r,t.__n,void 0!==a.ownerSVGElement,null!=i.__h?[s]:null,n,null==s?y(i):s,i.__h),L(n,i),o!=s&&j(i)))})}function P(e,t,n,r,o,i,s,a,f,l){var u,c,p,h,g,w,j,x=r&&r.__k||b,k=x.length;for(f==d&&(f=null!=s?s[0]:k?y(r,0):null),n.__k=[],u=0;u<t.length;u++)if(null!=(h=n.__k[u]=null==(h=t[u])||"boolean"==typeof h?null:"string"==typeof h||"number"==typeof h?m(null,h,null,null,h):Array.isArray(h)?m(v,{children:h},null,null,null):null!=h.__e||null!=h.__c?m(h.type,h.props,h.key,null,h.__v):h)){if(h.__=n,h.__b=n.__b+1,null===(p=x[u])||p&&h.key==p.key&&h.type===p.type)x[u]=void 0;else for(c=0;c<k;c++){if((p=x[c])&&h.key==p.key&&h.type===p.type){x[c]=void 0;break}p=null}g=H(e,h,p=p||d,o,i,s,a,f,l),(c=h.ref)&&p.ref!=c&&(j||(j=[]),p.ref&&j.push(p.ref,null,h),j.push(c,h.__c||g,h)),null!=g?(null==w&&(w=g),f=I(e,h,p,x,s,g,f),l||"option"!=n.type?"function"==typeof n.type&&(n.__d=f):e.value=""):f&&p.__e==f&&f.parentNode!=e&&(f=y(p))}if(n.__e=w,null!=s&&"function"!=typeof n.type)for(u=s.length;u--;)null!=s[u]&&_(s[u]);for(u=k;u--;)null!=x[u]&&z(x[u],x[u]);if(j)for(u=0;u<j.length;u++)q(j[u],j[++u],j[++u])}function I(e,t,n,r,o,i,s){var a,f,l;if(void 0!==t.__d)a=t.__d,t.__d=void 0;else if(o==n||i!=s||null==i.parentNode)e:if(null==s||s.parentNode!==e)e.appendChild(i),a=null;else{for(f=s,l=0;(f=f.nextSibling)&&l<r.length;l+=2)if(f==i)break e;e.insertBefore(i,s),a=s}return void 0!==a?a:i.nextSibling}function S(e,t,n){"-"===t[0]?e.setProperty(t,n):e[t]=null==n?"":"number"!=typeof n||p.test(t)?n:n+"px"}function C(e,t,n,r,o){var i,s,a;if(o&&"className"==t&&(t="class"),"style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||S(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||S(e.style,t,n[t])}else"o"===t[0]&&"n"===t[1]?(i=t!==(t=t.replace(/Capture$/,"")),(s=t.toLowerCase())in e&&(t=s),t=t.slice(2),e.l||(e.l={}),e.l[t+i]=n,a=i?N:E,n?r||e.addEventListener(t,a,i):e.removeEventListener(t,a,i)):"list"!==t&&"tagName"!==t&&"form"!==t&&"type"!==t&&"size"!==t&&"download"!==t&&"href"!==t&&!o&&t in e?e[t]=null==n?"":n:"function"!=typeof n&&"dangerouslySetInnerHTML"!==t&&(t!==(t=t.replace(/xlink:?/,""))?null==n||!1===n?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),n):null==n||!1===n&&!/^ar/.test(t)?e.removeAttribute(t):e.setAttribute(t,n))}function E(e){this.l[e.type+!1](a.event?a.event(e):e)}function N(e){this.l[e.type+!0](a.event?a.event(e):e)}function T(e,t,n){var r,o;for(r=0;r<e.__k.length;r++)(o=e.__k[r])&&(o.__=e,o.__e&&("function"==typeof o.type&&o.__k.length>1&&T(o,t,n),t=I(n,o,o,e.__k,null,o.__e,t),"function"==typeof e.type&&(e.__d=t)))}function H(e,t,n,r,o,i,s,f,l){var u,c,p,_,g,m,y,j,x,k,I,S=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(l=n.__h,f=t.__e=n.__e,t.__h=null,i=[f]),(u=a.__b)&&u(t);try{e:if("function"==typeof S){if(j=t.props,x=(u=S.contextType)&&r[u.__c],k=u?x?x.props.value:u.__:r,n.__c?y=(c=t.__c=n.__c).__=c.__E:("prototype"in S&&S.prototype.render?t.__c=c=new S(j,k):(t.__c=c=new w(j,k),c.constructor=S,c.render=F),x&&x.sub(c),c.props=j,c.state||(c.state={}),c.context=k,c.__n=r,p=c.__d=!0,c.__h=[]),null==c.__s&&(c.__s=c.state),null!=S.getDerivedStateFromProps&&(c.__s==c.state&&(c.__s=h({},c.__s)),h(c.__s,S.getDerivedStateFromProps(j,c.__s))),_=c.props,g=c.state,p)null==S.getDerivedStateFromProps&&null!=c.componentWillMount&&c.componentWillMount(),null!=c.componentDidMount&&c.__h.push(c.componentDidMount);else{if(null==S.getDerivedStateFromProps&&j!==_&&null!=c.componentWillReceiveProps&&c.componentWillReceiveProps(j,k),!c.__e&&null!=c.shouldComponentUpdate&&!1===c.shouldComponentUpdate(j,c.__s,k)||t.__v===n.__v){c.props=j,c.state=c.__s,t.__v!==n.__v&&(c.__d=!1),c.__v=t,t.__e=n.__e,t.__k=n.__k,c.__h.length&&s.push(c),T(t,f,e);break e}null!=c.componentWillUpdate&&c.componentWillUpdate(j,c.__s,k),null!=c.componentDidUpdate&&c.__h.push(function(){c.componentDidUpdate(_,g,m)})}c.context=k,c.props=j,c.state=c.__s,(u=a.__r)&&u(t),c.__d=!1,c.__v=t,c.__P=e,u=c.render(c.props,c.state,c.context),c.state=c.__s,null!=c.getChildContext&&(r=h(h({},r),c.getChildContext())),p||null==c.getSnapshotBeforeUpdate||(m=c.getSnapshotBeforeUpdate(_,g)),I=null!=u&&u.type==v&&null==u.key?u.props.children:u,P(e,Array.isArray(I)?I:[I],t,n,r,o,i,s,f,l),c.base=t.__e,t.__h=null,c.__h.length&&s.push(c),y&&(c.__E=c.__=null),c.__e=!1}else null==i&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=function(e,t,n,r,o,i,s,a){var f,l,u,c,p,h=n.props,_=t.props;if(o="svg"===t.type||o,null!=i)for(f=0;f<i.length;f++)if(null!=(l=i[f])&&((null===t.type?3===l.nodeType:l.localName===t.type)||e==l)){e=l,i[f]=null;break}if(null==e){if(null===t.type)return document.createTextNode(_);e=o?document.createElementNS("http://www.w3.org/2000/svg",t.type):document.createElement(t.type,_.is&&{is:_.is}),i=null,a=!1}if(null===t.type)h===_||a&&e.data===_||(e.data=_);else{if(null!=i&&(i=b.slice.call(e.childNodes)),u=(h=n.props||d).dangerouslySetInnerHTML,c=_.dangerouslySetInnerHTML,!a){if(null!=i)for(h={},p=0;p<e.attributes.length;p++)h[e.attributes[p].name]=e.attributes[p].value;(c||u)&&(c&&(u&&c.__html==u.__html||c.__html===e.innerHTML)||(e.innerHTML=c&&c.__html||""))}(function(e,t,n,r,o){var i;for(i in n)"children"===i||"key"===i||i in t||C(e,i,null,n[i],r);for(i in t)o&&"function"!=typeof t[i]||"children"===i||"key"===i||"value"===i||"checked"===i||n[i]===t[i]||C(e,i,t[i],n[i],r)})(e,_,h,o,a),c?t.__k=[]:(f=t.props.children,P(e,Array.isArray(f)?f:[f],t,n,r,"foreignObject"!==t.type&&o,i,s,d,a)),a||("value"in _&&void 0!==(f=_.value)&&(f!==e.value||"progress"===t.type&&!f)&&C(e,"value",f,h.value,!1),"checked"in _&&void 0!==(f=_.checked)&&f!==e.checked&&C(e,"checked",f,h.checked,!1))}return e}(n.__e,t,n,r,o,i,s,l);(u=a.diffed)&&u(t)}catch(e){t.__v=null,(l||null!=i)&&(t.__e=f,t.__h=!!l,i[i.indexOf(f)]=null),a.__e(e,t,n)}return t.__e}function L(e,t){a.__c&&a.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){a.__e(e,t.__v)}})}function q(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){a.__e(e,n)}}function z(e,t,n){var r,o,i;if(a.unmount&&a.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||q(r,null,t)),n||"function"==typeof e.type||(n=null!=(o=e.__e)),e.__e=e.__d=void 0,null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){a.__e(e,t)}r.base=r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&z(r[i],t,n);null!=o&&_(o)}function F(e,t,n){return this.constructor(e,n)}a={__e:function(e,t){for(var n,r,o,i=t.__h;t=t.__;)if((n=t.__c)&&!n.__)try{if((r=n.constructor)&&null!=r.getDerivedStateFromError&&(n.setState(r.getDerivedStateFromError(e)),o=n.__d),null!=n.componentDidCatch&&(n.componentDidCatch(e),o=n.__d),o)return t.__h=i,n.__E=n}catch(t){e=t}throw e},__v:0},w.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=h({},this.state),"function"==typeof e&&(e=e(h({},n),this.props)),e&&h(n,e),null!=e&&this.__v&&(t&&this.__h.push(t),x(this))},w.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),x(this))},w.prototype.render=v,f=[],l="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,k.__r=0,c=d;var O,A,U,M=0,D=[],W=a.__b,J=a.__r,B=a.diffed,R=a.__c,Q=a.unmount;function G(e,t){a.__h&&a.__h(A,e,M||t),M=0;var n=A.__H||(A.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Y(e){return M=1,function(e,t,n){var r=G(O++,2);return r.t=e,r.__c||(r.__=[ee(void 0,t),function(e){var t=r.t(r.__[0],e);r.__[0]!==t&&(r.__=[t,r.__[1]],r.__c.setState({}))}],r.__c=A),r.__}(ee,e)}function $(e,t){var n=G(O++,3);!a.__s&&function(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}(n.__H,t)&&(n.__=e,n.__H=t,A.__H.__h.push(n))}function V(){D.forEach(function(e){if(e.__P)try{e.__H.__h.forEach(K),e.__H.__h.forEach(Z),e.__H.__h=[]}catch(t){e.__H.__h=[],a.__e(t,e.__v)}}),D=[]}a.__b=function(e){A=null,W&&W(e)},a.__r=function(e){J&&J(e),O=0;var t=(A=e.__c).__H;t&&(t.__h.forEach(K),t.__h.forEach(Z),t.__h=[])},a.diffed=function(e){B&&B(e);var t=e.__c;t&&t.__H&&t.__H.__h.length&&(1!==D.push(t)&&U===a.requestAnimationFrame||((U=a.requestAnimationFrame)||function(e){var t,n=function(){clearTimeout(r),X&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);X&&(t=requestAnimationFrame(n))})(V)),A=void 0},a.__c=function(e,t){t.some(function(e){try{e.__h.forEach(K),e.__h=e.__h.filter(function(e){return!e.__||Z(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],a.__e(n,e.__v)}}),R&&R(e,t)},a.unmount=function(e){Q&&Q(e);var t=e.__c;if(t&&t.__H)try{t.__H.__.forEach(K)}catch(e){a.__e(e,t.__v)}};var X="function"==typeof requestAnimationFrame;function K(e){var t=A;"function"==typeof e.__c&&e.__c(),A=t}function Z(e){var t=A;e.__c=e.__(),A=t}function ee(e,t){return"function"==typeof t?t(e):t}var te=function(){return[].slice.call(arguments).filter(Boolean).join(" ")};function ne(e){var t=e.children,n=e.isOpen,r=e.close,o=Y(!1),i=o[0],s=o[1];return $(function(){s(n)},[n]),g("div",{"aria-live":"assertive",className:"fb-pointer-events-none fb-fixed fb-inset-0 fb-flex fb-items-end fb-px-4 fb-py-6 sm:fb-p-6"},g("div",{className:"fb-flex fb-w-full fb-flex-col fb-items-center fb-space-y-4 sm:fb-items-end"},g("div",{className:te(i?"fb-translate-x-0 fb-opacity-100":"fb-translate-x-28 fb-opacity-0","fb-pointer-events-auto fb-relative fb-w-full fb-max-w-sm fb-overflow-hidden fb-rounded-lg fb-bg-white fb-shadow-lg fb-ring-1 fb-ring-black fb-ring-opacity-5 fb-transition-all fb-duration-500 fb-ease-in-out")},g("div",{class:"fb-absolute fb-top-0 fb-right-0 fb-hidden fb-pt-4 fb-pr-4 sm:fb-block"},g("button",{type:"button",onClick:r,class:"fb-rounded-md fb-bg-white focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 text-slate-400 hover:text-slate-500 focus:ring-slate-500"},g("span",{class:"fb-sr-only"},"Close"),g("svg",{class:"fb-h-6 fb-w-6",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},g("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})))),g("div",{className:""},t))))}var re=function(e,t){try{return Promise.resolve(fetch(t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/displays/"+e+"/responded",{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(e){if(!e.ok)throw new Error("Could not update display")})}catch(e){return Promise.reject(e)}},oe=function(e,t){try{return Promise.resolve(fetch(t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/responses",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){if(!e.ok)throw console.error(e.text),new Error("Could not create response");return Promise.resolve(e.json())})}catch(e){return Promise.reject(e)}};function ie(e){return g("label",{htmlFor:e.questionId,className:"fb-block fb-text-base fb-font-semibold fb-leading-6 fb-mr-8 text-slate-900"},e.headline)}function se(e){return g("label",{for:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600"},e.subheader)}function ae(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return g("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);e.currentTarget[t.id].value="",n(o)}},g(ie,{headline:t.headline,questionId:t.id}),g(se,{subheader:t.subheader,questionId:t.id}),g("div",{className:"fb-mt-4"},g("textarea",{rows:3,name:t.id,id:t.id,placeholder:t.placeholder,required:t.required,className:"fb-block fb-w-full fb-rounded-md fb-border fb-p-2 fb-shadow-sm focus:fb-ring-0 sm:fb-text-sm border-slate-100 bg-slate-50 focus:border-slate-500"})),g("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},g("div",null),g("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function fe(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=Y(null),s=i[0],a=i[1];return g("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);e.currentTarget[t.id].value="",n(o)}},g(ie,{headline:t.headline,questionId:t.id}),g(se,{subheader:t.subheader,questionId:t.id}),g("div",{className:"fb-mt-4"},g("fieldset",null,g("legend",{className:"fb-sr-only"},"Choices"),g("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e){return g("label",{key:e.id,className:te(s===e.label?"fb-z-10 border-slate-400 bg-slate-50":"fb-border-gray-200","fb-relative fb-flex fb-cursor-pointer fb-flex-col fb-rounded-md fb-border fb-p-4 focus:fb-outline-none hover:bg-slate-50")},g("span",{className:"fb-flex fb-items-center fb-text-sm"},g("input",{type:"radio",id:e.id,name:t.id,value:e.label,className:"fb-h-4 fb-w-4 fb-border fb-border-gray-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":e.id+"-label",onChange:function(e){a(e.currentTarget.value)},style:{borderColor:o,color:o}}),g("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),g("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},g("div",null),g("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function le(e){return g("div",{className:"fb-h-1 fb-w-full fb-rounded-full bg-slate-200"},g("div",{className:"fb-h-1 fb-rounded-full",style:{backgroundColor:e.brandColor,width:Math.floor(100*e.progress)+"%"}}))}function ue(e){var t=e.config,n=e.survey,r=e.close,o=e.brandColor,i=Y(n.questions[0]),s=i[0],a=i[1],f=Y(0),l=f[0],u=f[1],c=Y(null),d=c[0],b=c[1],p=Y(null),h=p[0],_=p[1],m=Y(!1),v=m[0],w=m[1];$(function(){!function(){try{Promise.resolve(function(e,t){try{return Promise.resolve(fetch(t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/displays",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){if(!e.ok)throw console.error(e.text),new Error("Could not create display");return Promise.resolve(e.json())})}catch(e){return Promise.reject(e)}}({surveyId:n.id,personId:t.person.id},t)).then(function(e){_(e.id)})}catch(e){return Promise.reject(e)}}()},[t,n]),$(function(){var e;u((e=n.questions.findIndex(function(e){return e.id===s.id}),e/n.questions.length))},[s,n]);var y=function(e){try{var o=function(){w(!1),f?(u(100),r()):a(n.questions[i+1])};w(!0);var i=n.questions.findIndex(function(e){return e.id===s.id}),f=i===n.questions.length-1,l={surveyId:n.id,personId:t.person.id,response:{finished:f,data:e}},c=d?Promise.resolve(function(e,t,n){try{return Promise.resolve(fetch(n.apiHost+"/api/v1/client/environments/"+n.environmentId+"/responses/"+t,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){if(!e.ok)throw new Error("Could not update response");return Promise.resolve(e.json())})}catch(e){return Promise.reject(e)}}(l,d,t)).then(function(){}):Promise.resolve(Promise.all([oe(l,t),re(h,t)])).then(function(e){b(e[0].id)});return Promise.resolve(c&&c.then?c.then(o):o())}catch(e){return Promise.reject(e)}};return g("div",null,g("div",{className:te(v?"fb-animate-pulse fb-opacity-60":"","fb-p-4")},"multipleChoiceSingle"===s.type?g(fe,{question:s,onSubmit:y,lastQuestion:n.questions.findIndex(function(e){return e.id===s.id})===n.questions.length-1,brandColor:o}):"openText"===s.type?g(ae,{question:s,onSubmit:y,lastQuestion:n.questions.findIndex(function(e){return e.id===s.id})===n.questions.length-1,brandColor:o}):null),g("div",{className:"fb-mt-2"},g(le,{progress:l,brandColor:o})))}function ce(e){var t,n=e.config,r=e.survey,o=e.closeSurvey,i=Y(!0),s=i[1],a=function(){s(!1),setTimeout(function(){o()},1e3)};return g("div",{id:"fbjs"},g(ne,{isOpen:i[0],close:a},g(ue,{config:n,survey:r,close:a,brandColor:null==(t=n.settings)?void 0:t.brandColor})))}var de=/*#__PURE__*/function(){function e(){this.config=this.loadFromLocalStorage()}e.getInstance=function(){return e.instance||(e.instance=new e),e.instance};var t=e.prototype;return t.update=function(e){e&&(this.config=o({},this.config,e),this.saveToLocalStorage())},t.get=function(){return this.config},t.loadFromLocalStorage=function(){if("undefined"!=typeof window){var e=localStorage.getItem("config");if(e)return JSON.parse(e)}return{apiHost:null,environmentId:null}},t.saveToLocalStorage=function(){localStorage.setItem("config",JSON.stringify(this.config))},e}();de.instance=void 0;var be=/*#__PURE__*/function(){function e(){this.logLevel="error"}e.getInstance=function(){return e.instance||(e.instance=new e),e.instance};var t=e.prototype;return t.configure=function(e){e&&void 0!==e.logLevel&&(this.logLevel=e.logLevel)},t.logger=function(e,t){if("debug"!==t||"debug"===this.logLevel){var n="🧱 Formbricks - "+(new Date).toISOString()+" ["+t.toUpperCase()+"] - "+e;"error"===t?console.error(n):console.log(n)}},t.debug=function(e){this.logger(e,"debug")},t.error=function(e){this.logger(e,"error")},e}();be.instance=void 0;var pe=be.getInstance(),he=de.getInstance(),_e=function(){try{return Promise.resolve(fetch(he.get().apiHost+"/api/v1/client/environments/"+he.get().environmentId+"/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:he.get().person.id})})).then(function(e){if(!e.ok)throw pe.error("Error getting settings"),Error("Error getting settings");return e.json()})}catch(e){return Promise.reject(e)}},ge="formbricks-web-container",me=de.getInstance(),ve=be.getInstance(),we=!1,ye=function(e){we?ve.debug("A survey is already running. Skipping."):(we=!0,function(e,t,n){var r,o,i;a.__&&a.__(e,t),o=(r=void 0===c)?null:t.__k,e=g(v,null,[e]),i=[],H(t,t.__k=e,o||d,d,void 0!==t.ownerSVGElement,o?null:t.childNodes.length?b.slice.call(t.childNodes):null,i,d,r),L(i,e)}(g(ce,{config:me.get(),survey:e,closeSurvey:je}),document.getElementById(ge)))},je=function(){try{return document.getElementById(ge).innerHTML="",Promise.resolve(_e()).then(function(e){me.update({settings:e}),we=!1})}catch(e){return Promise.reject(e)}},xe=be.getInstance(),ke=de.getInstance(),Pe=function(e,t){try{return Promise.resolve(fetch(ke.get().apiHost+"/api/v1/client/environments/"+ke.get().environmentId+"/events",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:ke.get().session.id,eventName:e,properties:t})})).then(function(t){var n;function r(t){if(n)return t;xe.debug('Formbricks: Event "'+e+'" tracked'),Ie(e)}var o=function(){if(!t.ok)return Promise.resolve(t.json()).then(function(e){xe.error("Formbricks: Error tracking event: "+JSON.stringify(e)),n=1})}();return o&&o.then?o.then(r):r(o)})}catch(e){return Promise.reject(e)}},Ie=function(e){for(var t,n=s(null==(r=ke.get().settings)?void 0:r.surveys);!(t=n()).done;)for(var r,o,i=t.value,a=s(i.triggers);!(o=a()).done;){var f;if((null==(f=o.value.eventClass)?void 0:f.name)===e)return xe.debug("Formbricks: survey "+i.id+' triggered by event "'+e+'"'),void ye(i)}},Se=de.getInstance(),Ce=be.getInstance(),Ee=function(){try{return Ce.debug("Creating new person"),Promise.resolve(fetch(Se.get().apiHost+"/api/v1/client/environments/"+Se.get().environmentId+"/people",{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(e){return e.ok?Promise.resolve(e.json()):(console.error("Formbricks: Error fetching person"),null)})}catch(e){return Promise.reject(e)}},Ne=function(e,t){var n=Se.get().person.attributes.find(function(t){var n;return(null==(n=t.attributeClass)?void 0:n.name)===e});return!(!n||n.value!==t)},Te=be.getInstance(),He=de.getInstance(),Le=function(){try{return He.get().person?Promise.resolve(fetch(He.get().apiHost+"/api/v1/client/environments/"+He.get().environmentId+"/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:He.get().person.id})})).then(function(e){if(e.ok)return Promise.resolve(e.json());Te.error("Error creating session")}):(Te.error("Formbricks: Unable to create session. No person found"),Promise.resolve())}catch(e){return Promise.reject(e)}},qe=function(e){var t=o({},e);return t.expiresAt=Date.now()+36e5,t},ze=function(e){return e.expiresAt<=Date.now()},Fe=de.getInstance(),Oe=be.getInstance(),Ae=function(){var e;Oe.debug("checking page url");var t=null==(e=Fe.get().settings)?void 0:e.noCodeEvents.filter(function(e){var t;return"pageUrl"===(null==(t=e.noCodeConfig)?void 0:t.type)});if(0!==t.length)for(var n,r=s(t);!(n=r()).done;){var o=n.value,i=o.noCodeConfig.pageUrl;i&&Ue(window.location.href,i.value,i.rule)&&Pe(o.name)}};function Ue(e,t,n){switch(n){case"exactMatch":return e===t;case"contains":return e.includes(t);case"startsWith":return e.startsWith(t);case"endsWith":return e.endsWith(t);case"notMatch":return e!==t;case"notContains":return!e.includes(t);default:throw new Error("Invalid match type")}}var Me=de.getInstance(),De=be.getInstance(),We=function(){if(!(Me.get().apiHost&&Me.get().environmentId&&Me.get().person&&Me.get().session&&Me.get().settings))throw Error("Formbricks: Formbricks not initialized. Call initialize() first.")},Je=new r,Be=function(e,t){Je.add(function(){try{return We(),Promise.resolve(function(e,t){try{return Ce.debug("setting attribute: "+e+" to value: "+t),Ne(e,t)?(Ce.debug("attribute already set to this value. Skipping update."),Promise.resolve()):Promise.resolve(function(e,t){try{return Se.get().person&&Se.get().person.id?Promise.resolve(fetch(Se.get().apiHost+"/api/v1/client/environments/"+Se.get().environmentId+"/people/"+Se.get().person.id+"/attribute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e,value:t})})).then(function(e){return Promise.resolve(e.json()).then(function(t){if(!e.ok)throw Ce.error("Error updating person"),Error("Error updating person");return t})}):(console.error("Formbricks: Unable to update attribute. No person set."),Promise.resolve())}catch(e){return Promise.reject(e)}}(e,t)).then(function(e){var t=e.person,n=e.settings;if(!t||!n)throw Ce.error("Error updating attribute"),new Error("Formbricks: Error updating attribute");Se.update({person:t,settings:n})})}catch(e){return Promise.reject(e)}}(e,t)).then(function(){})}catch(e){return Promise.reject(e)}})},Re={init:function(e){Je.add(function(){try{return function(e){try{var t=function(){function e(){(function(){if("undefined"!=typeof window){var e=window.setInterval(function(){try{return Promise.resolve(function(){try{var e=function(e){Te.debug("Session not expired, extending session"),He.update({session:qe(He.get().session)})};Te.debug("Checking session");var t=function(){if(ze(He.get().session))return Te.debug("Session expired, creating new session"),Promise.resolve(Le()).then(function(e){var t=e.session,n=e.settings;if(!t||!n)throw Te.error("Error creating new session"),Error("Error creating new session");He.update({session:t,settings:n}),Pe("New Session")})}();return Promise.resolve(t&&t.then?t.then(e):e())}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}},3e5);window.addEventListener("beforeunload",function(){clearInterval(e)})}})(),"undefined"!=typeof window&&(window.addEventListener("hashchange",Ae),window.addEventListener("popstate",Ae),window.addEventListener("pushstate",Ae),window.addEventListener("replacestate",Ae),window.addEventListener("load",Ae))}var t=function(){if(ze(Me.get().session))return Promise.resolve(Le()).then(function(e){var t=e.settings;Me.update({session:qe(e.session),settings:t}),Pe("New Session")})}();return t&&t.then?t.then(e):e()};if(!e.environmentId)throw Error("Formbricks: environmentId is required");if(!e.apiHost)throw Error("Formbricks: apiHost is required");e.logLevel&&De.configure({logLevel:e.logLevel}),(r=document.createElement("div")).id=ge,document.body.appendChild(r),function(){if(null===document.getElementById("formbricks__css")){var e=document.createElement("style");e.id="formbricks__css",e.innerHTML='#fbjs *,#fbjs :after,#fbjs :before{border:0 solid #e5e7eb;box-sizing:border-box}#fbjs :after,#fbjs :before{--tw-content:""}#fbjs html{-webkit-text-size-adjust:100%;font-feature-settings:normal;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}#fbjs body{line-height:inherit;margin:0}#fbjs hr{border-top-width:1px;color:inherit;height:0}#fbjs abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6{font-size:inherit;font-weight:inherit}#fbjs a{color:inherit;text-decoration:inherit}#fbjs b,#fbjs strong{font-weight:bolder}#fbjs code,#fbjs kbd,#fbjs pre,#fbjs samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}#fbjs small{font-size:80%}#fbjs sub,#fbjs sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}#fbjs sub{bottom:-.25em}#fbjs sup{top:-.5em}#fbjs table{border-collapse:collapse;border-color:inherit;text-indent:0}#fbjs button,#fbjs input,#fbjs optgroup,#fbjs select,#fbjs textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}#fbjs button,#fbjs select{text-transform:none}#fbjs [type=button],#fbjs [type=reset],#fbjs [type=submit],#fbjs button{-webkit-appearance:button;background-color:transparent;background-image:none}#fbjs :-moz-focusring{outline:auto}#fbjs :-moz-ui-invalid{box-shadow:none}#fbjs progress{vertical-align:baseline}#fbjs ::-webkit-inner-spin-button,#fbjs ::-webkit-outer-spin-button{height:auto}#fbjs [type=search]{-webkit-appearance:textfield;outline-offset:-2px}#fbjs ::-webkit-search-decoration{-webkit-appearance:none}#fbjs ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}#fbjs summary{display:list-item}#fbjs blockquote,#fbjs dd,#fbjs dl,#fbjs figure,#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6,#fbjs hr,#fbjs p,#fbjs pre{margin:0}#fbjs fieldset{margin:0;padding:0}#fbjs legend{padding:0}#fbjs menu,#fbjs ol,#fbjs ul{list-style:none;margin:0;padding:0}#fbjs textarea{resize:vertical}#fbjs input::-moz-placeholder,#fbjs textarea::-moz-placeholder{color:#9ca3af;opacity:1}#fbjs input::placeholder,#fbjs textarea::placeholder{color:#9ca3af;opacity:1}#fbjs [role=button],#fbjs button{cursor:pointer}#fbjs :disabled{cursor:default}#fbjs audio,#fbjs canvas,#fbjs embed,#fbjs iframe,#fbjs img,#fbjs object,#fbjs svg,#fbjs video{display:block;vertical-align:middle}#fbjs img,#fbjs video{height:auto;max-width:100%}#fbjs [hidden]{display:none}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }#fbjs .fb-sr-only{clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}#fbjs .fb-pointer-events-none{pointer-events:none}#fbjs .fb-pointer-events-auto{pointer-events:auto}#fbjs .fb-fixed{position:fixed}#fbjs .fb-absolute{position:absolute}#fbjs .fb-relative{position:relative}#fbjs .fb-inset-0{bottom:0;left:0;right:0;top:0}#fbjs .fb-right-0{right:0}#fbjs .fb-top-0{top:0}#fbjs .fb-z-10{z-index:10}#fbjs .fb-ml-3{margin-left:.75rem}#fbjs .fb-mr-8{margin-right:2rem}#fbjs .fb-mt-2{margin-top:.5rem}#fbjs .fb-mt-4{margin-top:1rem}#fbjs .fb-block{display:block}#fbjs .fb-flex{display:flex}#fbjs .fb-hidden{display:none}#fbjs .fb-h-1{height:.25rem}#fbjs .fb-h-4{height:1rem}#fbjs .fb-h-6{height:1.5rem}#fbjs .fb-w-4{width:1rem}#fbjs .fb-w-6{width:1.5rem}#fbjs .fb-w-full{width:100%}#fbjs .fb-max-w-sm{max-width:24rem}#fbjs .fb-translate-x-0{--tw-translate-x:0px}#fbjs .fb-translate-x-0,#fbjs .fb-translate-x-28{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#fbjs .fb-translate-x-28{--tw-translate-x:7rem}@keyframes fb-pulse{50%{opacity:.5}}#fbjs .fb-animate-pulse{animation:fb-pulse 2s cubic-bezier(.4,0,.6,1) infinite}#fbjs .fb-cursor-pointer{cursor:pointer}#fbjs .fb-flex-col{flex-direction:column}#fbjs .fb-items-end{align-items:flex-end}#fbjs .fb-items-center{align-items:center}#fbjs .fb-justify-between{justify-content:space-between}#fbjs .fb-space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}#fbjs .fb-space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}#fbjs .fb-overflow-hidden{overflow:hidden}#fbjs .fb-rounded-full{border-radius:9999px}#fbjs .fb-rounded-lg{border-radius:.5rem}#fbjs .fb-rounded-md{border-radius:.375rem}#fbjs .fb-border{border-width:1px}#fbjs .fb-border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}#fbjs .fb-border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity))}#fbjs .fb-border-transparent{border-color:transparent}#fbjs .fb-bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}#fbjs .fb-p-2{padding:.5rem}#fbjs .fb-p-4{padding:1rem}#fbjs .fb-px-3{padding-left:.75rem;padding-right:.75rem}#fbjs .fb-px-4{padding-left:1rem;padding-right:1rem}#fbjs .fb-py-3{padding-bottom:.75rem;padding-top:.75rem}#fbjs .fb-py-6{padding-bottom:1.5rem;padding-top:1.5rem}#fbjs .fb-pr-4{padding-right:1rem}#fbjs .fb-pt-4{padding-top:1rem}#fbjs .fb-text-base{font-size:1rem;line-height:1.5rem}#fbjs .fb-text-sm{font-size:.875rem;line-height:1.25rem}#fbjs .fb-font-medium{font-weight:500}#fbjs .fb-font-normal{font-weight:400}#fbjs .fb-font-semibold{font-weight:600}#fbjs .fb-leading-4{line-height:1rem}#fbjs .fb-leading-6{line-height:1.5rem}#fbjs .fb-text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}#fbjs .fb-opacity-0{opacity:0}#fbjs .fb-opacity-100{opacity:1}#fbjs .fb-opacity-60{opacity:.6}#fbjs .fb-shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}#fbjs .fb-shadow-lg,#fbjs .fb-shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs .fb-shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}#fbjs .fb-ring-1{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs .fb-ring-black{--tw-ring-opacity:1;--tw-ring-color:rgb(0 0 0/var(--tw-ring-opacity))}#fbjs .fb-ring-opacity-5{--tw-ring-opacity:0.05}#fbjs .fb-transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs .fb-duration-500{transition-duration:.5s}#fbjs .fb-ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs .hover\\:fb-opacity-90:hover{opacity:.9}#fbjs .focus\\:fb-outline-none:focus{outline:2px solid transparent;outline-offset:2px}#fbjs .focus\\:fb-ring-0:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color)}#fbjs .focus\\:fb-ring-0:focus,#fbjs .focus\\:fb-ring-2:focus{box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs .focus\\:fb-ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color)}#fbjs .focus\\:fb-ring-offset-0:focus{--tw-ring-offset-width:0px}#fbjs .focus\\:fb-ring-offset-2:focus{--tw-ring-offset-width:2px}@media (min-width:640px){#fbjs .sm\\:fb-block{display:block}#fbjs .sm\\:fb-items-end{align-items:flex-end}#fbjs .sm\\:fb-p-6{padding:1.5rem}#fbjs .sm\\:fb-text-sm{font-size:.875rem;line-height:1.25rem}}',document.head.appendChild(e)}}();var n=function(){if(!Me||Me.get().environmentId!==e.environmentId||Me.get().apiHost!==e.apiHost)return Me.update({environmentId:e.environmentId,apiHost:e.apiHost}),Promise.resolve(Ee()).then(function(e){var t=e.settings;Me.update({person:e.person,session:qe(e.session),settings:t}),Pe("New Session")})}();return Promise.resolve(n&&n.then?n.then(t):t())}catch(e){return Promise.reject(e)}var r}(e),Promise.resolve()}catch(e){return Promise.reject(e)}})},setUserId:function(e){Je.add(function(){try{return We(),Promise.resolve(function(e){try{return Ce.debug("setting userId: "+e),Ne("userId",e)?(Ce.debug("userId already set to this value. Skipping update."),Promise.resolve()):(t=Se.get().person.attributes.find(function(e){var t;return"userId"===(null==(t=e.attributeClass)?void 0:t.name)}),t?(Ce.error("userId cannot be changed after it has been set. You need to reset first"),Promise.resolve()):Promise.resolve(function(e){try{return Se.get().person&&Se.get().person.id?Promise.resolve(fetch(Se.get().apiHost+"/api/v1/client/environments/"+Se.get().environmentId+"/people/"+Se.get().person.id+"/user-id",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,sessionId:Se.get().session.id})})).then(function(e){if(!e.ok)throw Ce.error("Formbricks: Error updating person"),Error("Error updating person");return Promise.resolve(e.json())}):(console.error("Formbricks: Unable to update userId. No person set."),Promise.resolve())}catch(e){return Promise.reject(e)}}(e)).then(function(e){Se.update({person:e.person,settings:e.settings})}))}catch(e){return Promise.reject(e)}var t}(e)).then(function(){})}catch(e){return Promise.reject(e)}})},setEmail:function(e){Be("email",e)},setAttribute:Be,track:function(e,t){void 0===t&&(t={}),Je.add(function(){try{return We(),Promise.resolve(Pe(e,t)).then(function(){})}catch(e){return Promise.reject(e)}})},logout:function(){Je.add(function(){try{return We(),Promise.resolve(function(){try{return Ce.debug("Resetting person. Getting new person, session and settings from backend"),Promise.resolve(Ee()).then(function(e){var t=e.person,n=e.session,r=e.settings;if(!t||!n||!r)throw Ce.error("Error resetting user"),new Error("Formbricks: Error resetting user");Se.update({person:t,session:n,settings:r})})}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}})},refresh:function(){Je.add(function(){try{return We(),Promise.resolve(function(){try{return pe.debug("Refreshing - getting settings from backend"),Promise.resolve(_e()).then(function(e){he.update({settings:e})})}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}})},registerRouteChange:function(){Je.add(function(){try{return We(),Ae(),Promise.resolve()}catch(e){return Promise.reject(e)}})}};export{Re as default};
//# sourceMappingURL=index.module.js.map

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e||self).js=t()}(this,function(){function e(n,r,o){if(!n.s){if(o instanceof t){if(!o.s)return void(o.o=e.bind(null,n,r));1&r&&(r=o.s),o=o.v}if(o&&o.then)return void o.then(e.bind(null,n,r),e.bind(null,n,2));n.s=r,n.v=o;var i=n.o;i&&i(n)}}var t=/*#__PURE__*/function(){function t(){}return t.prototype.then=function(n,r){var o=new t,i=this.s;if(i){var s=1&i?n:r;if(s){try{e(o,1,s(this.v))}catch(t){e(o,2,t)}return o}return this}return this.o=function(t){try{var i=t.v;1&t.s?e(o,1,n?n(i):i):r?e(o,1,r(i)):e(o,2,i)}catch(t){e(o,2,t)}},o},t}();function n(e){return e instanceof t&&1&e.s}var r=/*#__PURE__*/function(){function r(){this.queue=[],this.running=!1}var o=r.prototype;return o.add=function(e){this.queue.push(e),this.running||this.run()},o.run=function(){try{var r=function(){o.running=!1},o=this;o.running=!0;var i=function(r,o,i){for(var s;;){var a=r();if(n(a)&&(a=a.v),!a)return f;if(a.then){s=0;break}var f=i();if(f&&f.then){if(!n(f)){s=1;break}f=f.s}}var l=new t,u=e.bind(null,l,2);return(0===s?a.then(d):1===s?f.then(c):(void 0).then(function(){(a=r())?a.then?a.then(d).then(void 0,u):d(a):e(l,1,f)})).then(void 0,u),l;function c(t){f=t;do{if(!(a=r())||n(a)&&!a.v)return void e(l,1,f);if(a.then)return void a.then(d).then(void 0,u);n(f=i())&&(f=f.v)}while(!f||!f.then);f.then(c).then(void 0,u)}function d(t){t?(f=i())&&f.then?f.then(c).then(void 0,u):c(f):e(l,1,f)}}(function(){return o.queue.length>0},0,function(){var e=o.queue.shift(),t=function(t,n){try{var r=Promise.resolve(e()).then(function(){})}catch(e){return n(e)}return r&&r.then?r.then(void 0,n):r}(0,function(e){console.error(e)});if(t&&t.then)return t.then(function(){})});return Promise.resolve(i&&i.then?i.then(r):r())}catch(e){return Promise.reject(e)}},r}();function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o.apply(this,arguments)}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,f,l,u,c,d={},b=[],p=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function h(e,t){for(var n in t)e[n]=t[n];return e}function _(e){var t=e.parentNode;t&&t.removeChild(e)}function g(e,t,n){var r,o,i,s=arguments,a={};for(i in t)"key"==i?r=t[i]:"ref"==i?o=t[i]:a[i]=t[i];if(arguments.length>3)for(n=[n],i=3;i<arguments.length;i++)n.push(s[i]);if(null!=n&&(a.children=n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===a[i]&&(a[i]=e.defaultProps[i]);return m(e,a,r,o,null)}function m(e,t,n,r,o){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==o?++a.__v:o};return null!=a.vnode&&a.vnode(i),i}function v(e){return e.children}function w(e,t){this.props=e,this.context=t}function y(e,t){if(null==t)return e.__?y(e.__,e.__.__k.indexOf(e)+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?y(e):null}function j(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return j(e)}}function x(e){(!e.__d&&(e.__d=!0)&&f.push(e)&&!k.__r++||u!==a.debounceRendering)&&((u=a.debounceRendering)||l)(k)}function k(){for(var e;k.__r=f.length;)e=f.sort(function(e,t){return e.__v.__b-t.__v.__b}),f=[],e.some(function(e){var t,n,r,o,i,s,a;e.__d&&(s=(i=(t=e).__v).__e,(a=t.__P)&&(n=[],(r=h({},i)).__v=i.__v+1,o=H(a,i,r,t.__n,void 0!==a.ownerSVGElement,null!=i.__h?[s]:null,n,null==s?y(i):s,i.__h),L(n,i),o!=s&&j(i)))})}function P(e,t,n,r,o,i,s,a,f,l){var u,c,p,h,g,w,j,x=r&&r.__k||b,k=x.length;for(f==d&&(f=null!=s?s[0]:k?y(r,0):null),n.__k=[],u=0;u<t.length;u++)if(null!=(h=n.__k[u]=null==(h=t[u])||"boolean"==typeof h?null:"string"==typeof h||"number"==typeof h?m(null,h,null,null,h):Array.isArray(h)?m(v,{children:h},null,null,null):null!=h.__e||null!=h.__c?m(h.type,h.props,h.key,null,h.__v):h)){if(h.__=n,h.__b=n.__b+1,null===(p=x[u])||p&&h.key==p.key&&h.type===p.type)x[u]=void 0;else for(c=0;c<k;c++){if((p=x[c])&&h.key==p.key&&h.type===p.type){x[c]=void 0;break}p=null}g=H(e,h,p=p||d,o,i,s,a,f,l),(c=h.ref)&&p.ref!=c&&(j||(j=[]),p.ref&&j.push(p.ref,null,h),j.push(c,h.__c||g,h)),null!=g?(null==w&&(w=g),f=I(e,h,p,x,s,g,f),l||"option"!=n.type?"function"==typeof n.type&&(n.__d=f):e.value=""):f&&p.__e==f&&f.parentNode!=e&&(f=y(p))}if(n.__e=w,null!=s&&"function"!=typeof n.type)for(u=s.length;u--;)null!=s[u]&&_(s[u]);for(u=k;u--;)null!=x[u]&&z(x[u],x[u]);if(j)for(u=0;u<j.length;u++)q(j[u],j[++u],j[++u])}function I(e,t,n,r,o,i,s){var a,f,l;if(void 0!==t.__d)a=t.__d,t.__d=void 0;else if(o==n||i!=s||null==i.parentNode)e:if(null==s||s.parentNode!==e)e.appendChild(i),a=null;else{for(f=s,l=0;(f=f.nextSibling)&&l<r.length;l+=2)if(f==i)break e;e.insertBefore(i,s),a=s}return void 0!==a?a:i.nextSibling}function S(e,t,n){"-"===t[0]?e.setProperty(t,n):e[t]=null==n?"":"number"!=typeof n||p.test(t)?n:n+"px"}function C(e,t,n,r,o){var i,s,a;if(o&&"className"==t&&(t="class"),"style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||S(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||S(e.style,t,n[t])}else"o"===t[0]&&"n"===t[1]?(i=t!==(t=t.replace(/Capture$/,"")),(s=t.toLowerCase())in e&&(t=s),t=t.slice(2),e.l||(e.l={}),e.l[t+i]=n,a=i?N:E,n?r||e.addEventListener(t,a,i):e.removeEventListener(t,a,i)):"list"!==t&&"tagName"!==t&&"form"!==t&&"type"!==t&&"size"!==t&&"download"!==t&&"href"!==t&&!o&&t in e?e[t]=null==n?"":n:"function"!=typeof n&&"dangerouslySetInnerHTML"!==t&&(t!==(t=t.replace(/xlink:?/,""))?null==n||!1===n?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),n):null==n||!1===n&&!/^ar/.test(t)?e.removeAttribute(t):e.setAttribute(t,n))}function E(e){this.l[e.type+!1](a.event?a.event(e):e)}function N(e){this.l[e.type+!0](a.event?a.event(e):e)}function T(e,t,n){var r,o;for(r=0;r<e.__k.length;r++)(o=e.__k[r])&&(o.__=e,o.__e&&("function"==typeof o.type&&o.__k.length>1&&T(o,t,n),t=I(n,o,o,e.__k,null,o.__e,t),"function"==typeof e.type&&(e.__d=t)))}function H(e,t,n,r,o,i,s,f,l){var u,c,p,_,g,m,y,j,x,k,I,S=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(l=n.__h,f=t.__e=n.__e,t.__h=null,i=[f]),(u=a.__b)&&u(t);try{e:if("function"==typeof S){if(j=t.props,x=(u=S.contextType)&&r[u.__c],k=u?x?x.props.value:u.__:r,n.__c?y=(c=t.__c=n.__c).__=c.__E:("prototype"in S&&S.prototype.render?t.__c=c=new S(j,k):(t.__c=c=new w(j,k),c.constructor=S,c.render=F),x&&x.sub(c),c.props=j,c.state||(c.state={}),c.context=k,c.__n=r,p=c.__d=!0,c.__h=[]),null==c.__s&&(c.__s=c.state),null!=S.getDerivedStateFromProps&&(c.__s==c.state&&(c.__s=h({},c.__s)),h(c.__s,S.getDerivedStateFromProps(j,c.__s))),_=c.props,g=c.state,p)null==S.getDerivedStateFromProps&&null!=c.componentWillMount&&c.componentWillMount(),null!=c.componentDidMount&&c.__h.push(c.componentDidMount);else{if(null==S.getDerivedStateFromProps&&j!==_&&null!=c.componentWillReceiveProps&&c.componentWillReceiveProps(j,k),!c.__e&&null!=c.shouldComponentUpdate&&!1===c.shouldComponentUpdate(j,c.__s,k)||t.__v===n.__v){c.props=j,c.state=c.__s,t.__v!==n.__v&&(c.__d=!1),c.__v=t,t.__e=n.__e,t.__k=n.__k,c.__h.length&&s.push(c),T(t,f,e);break e}null!=c.componentWillUpdate&&c.componentWillUpdate(j,c.__s,k),null!=c.componentDidUpdate&&c.__h.push(function(){c.componentDidUpdate(_,g,m)})}c.context=k,c.props=j,c.state=c.__s,(u=a.__r)&&u(t),c.__d=!1,c.__v=t,c.__P=e,u=c.render(c.props,c.state,c.context),c.state=c.__s,null!=c.getChildContext&&(r=h(h({},r),c.getChildContext())),p||null==c.getSnapshotBeforeUpdate||(m=c.getSnapshotBeforeUpdate(_,g)),I=null!=u&&u.type==v&&null==u.key?u.props.children:u,P(e,Array.isArray(I)?I:[I],t,n,r,o,i,s,f,l),c.base=t.__e,t.__h=null,c.__h.length&&s.push(c),y&&(c.__E=c.__=null),c.__e=!1}else null==i&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=function(e,t,n,r,o,i,s,a){var f,l,u,c,p,h=n.props,_=t.props;if(o="svg"===t.type||o,null!=i)for(f=0;f<i.length;f++)if(null!=(l=i[f])&&((null===t.type?3===l.nodeType:l.localName===t.type)||e==l)){e=l,i[f]=null;break}if(null==e){if(null===t.type)return document.createTextNode(_);e=o?document.createElementNS("http://www.w3.org/2000/svg",t.type):document.createElement(t.type,_.is&&{is:_.is}),i=null,a=!1}if(null===t.type)h===_||a&&e.data===_||(e.data=_);else{if(null!=i&&(i=b.slice.call(e.childNodes)),u=(h=n.props||d).dangerouslySetInnerHTML,c=_.dangerouslySetInnerHTML,!a){if(null!=i)for(h={},p=0;p<e.attributes.length;p++)h[e.attributes[p].name]=e.attributes[p].value;(c||u)&&(c&&(u&&c.__html==u.__html||c.__html===e.innerHTML)||(e.innerHTML=c&&c.__html||""))}(function(e,t,n,r,o){var i;for(i in n)"children"===i||"key"===i||i in t||C(e,i,null,n[i],r);for(i in t)o&&"function"!=typeof t[i]||"children"===i||"key"===i||"value"===i||"checked"===i||n[i]===t[i]||C(e,i,t[i],n[i],r)})(e,_,h,o,a),c?t.__k=[]:(f=t.props.children,P(e,Array.isArray(f)?f:[f],t,n,r,"foreignObject"!==t.type&&o,i,s,d,a)),a||("value"in _&&void 0!==(f=_.value)&&(f!==e.value||"progress"===t.type&&!f)&&C(e,"value",f,h.value,!1),"checked"in _&&void 0!==(f=_.checked)&&f!==e.checked&&C(e,"checked",f,h.checked,!1))}return e}(n.__e,t,n,r,o,i,s,l);(u=a.diffed)&&u(t)}catch(e){t.__v=null,(l||null!=i)&&(t.__e=f,t.__h=!!l,i[i.indexOf(f)]=null),a.__e(e,t,n)}return t.__e}function L(e,t){a.__c&&a.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){a.__e(e,t.__v)}})}function q(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){a.__e(e,n)}}function z(e,t,n){var r,o,i;if(a.unmount&&a.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||q(r,null,t)),n||"function"==typeof e.type||(n=null!=(o=e.__e)),e.__e=e.__d=void 0,null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){a.__e(e,t)}r.base=r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&z(r[i],t,n);null!=o&&_(o)}function F(e,t,n){return this.constructor(e,n)}a={__e:function(e,t){for(var n,r,o,i=t.__h;t=t.__;)if((n=t.__c)&&!n.__)try{if((r=n.constructor)&&null!=r.getDerivedStateFromError&&(n.setState(r.getDerivedStateFromError(e)),o=n.__d),null!=n.componentDidCatch&&(n.componentDidCatch(e),o=n.__d),o)return t.__h=i,n.__E=n}catch(t){e=t}throw e},__v:0},w.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=h({},this.state),"function"==typeof e&&(e=e(h({},n),this.props)),e&&h(n,e),null!=e&&this.__v&&(t&&this.__h.push(t),x(this))},w.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),x(this))},w.prototype.render=v,f=[],l="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,k.__r=0,c=d;var O,A,U,M=0,D=[],W=a.__b,J=a.__r,B=a.diffed,R=a.__c,Q=a.unmount;function G(e,t){a.__h&&a.__h(A,e,M||t),M=0;var n=A.__H||(A.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Y(e){return M=1,function(e,t,n){var r=G(O++,2);return r.t=e,r.__c||(r.__=[ee(void 0,t),function(e){var t=r.t(r.__[0],e);r.__[0]!==t&&(r.__=[t,r.__[1]],r.__c.setState({}))}],r.__c=A),r.__}(ee,e)}function $(e,t){var n=G(O++,3);!a.__s&&function(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}(n.__H,t)&&(n.__=e,n.__H=t,A.__H.__h.push(n))}function V(){D.forEach(function(e){if(e.__P)try{e.__H.__h.forEach(K),e.__H.__h.forEach(Z),e.__H.__h=[]}catch(t){e.__H.__h=[],a.__e(t,e.__v)}}),D=[]}a.__b=function(e){A=null,W&&W(e)},a.__r=function(e){J&&J(e),O=0;var t=(A=e.__c).__H;t&&(t.__h.forEach(K),t.__h.forEach(Z),t.__h=[])},a.diffed=function(e){B&&B(e);var t=e.__c;t&&t.__H&&t.__H.__h.length&&(1!==D.push(t)&&U===a.requestAnimationFrame||((U=a.requestAnimationFrame)||function(e){var t,n=function(){clearTimeout(r),X&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);X&&(t=requestAnimationFrame(n))})(V)),A=void 0},a.__c=function(e,t){t.some(function(e){try{e.__h.forEach(K),e.__h=e.__h.filter(function(e){return!e.__||Z(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],a.__e(n,e.__v)}}),R&&R(e,t)},a.unmount=function(e){Q&&Q(e);var t=e.__c;if(t&&t.__H)try{t.__H.__.forEach(K)}catch(e){a.__e(e,t.__v)}};var X="function"==typeof requestAnimationFrame;function K(e){var t=A;"function"==typeof e.__c&&e.__c(),A=t}function Z(e){var t=A;e.__c=e.__(),A=t}function ee(e,t){return"function"==typeof t?t(e):t}var te=function(){return[].slice.call(arguments).filter(Boolean).join(" ")};function ne(e){var t=e.children,n=e.isOpen,r=e.close,o=Y(!1),i=o[0],s=o[1];return $(function(){s(n)},[n]),g("div",{"aria-live":"assertive",className:"fb-pointer-events-none fb-fixed fb-inset-0 fb-flex fb-items-end fb-px-4 fb-py-6 sm:fb-p-6"},g("div",{className:"fb-flex fb-w-full fb-flex-col fb-items-center fb-space-y-4 sm:fb-items-end"},g("div",{className:te(i?"fb-translate-x-0 fb-opacity-100":"fb-translate-x-28 fb-opacity-0","fb-pointer-events-auto fb-relative fb-w-full fb-max-w-sm fb-overflow-hidden fb-rounded-lg fb-bg-white fb-shadow-lg fb-ring-1 fb-ring-black fb-ring-opacity-5 fb-transition-all fb-duration-500 fb-ease-in-out")},g("div",{class:"fb-absolute fb-top-0 fb-right-0 fb-hidden fb-pt-4 fb-pr-4 sm:fb-block"},g("button",{type:"button",onClick:r,class:"fb-rounded-md fb-bg-white focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 text-slate-400 hover:text-slate-500 focus:ring-slate-500"},g("span",{class:"fb-sr-only"},"Close"),g("svg",{class:"fb-h-6 fb-w-6",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},g("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})))),g("div",{className:""},t))))}var re=function(e,t){try{return Promise.resolve(fetch(t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/displays/"+e+"/responded",{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(e){if(!e.ok)throw new Error("Could not update display")})}catch(e){return Promise.reject(e)}},oe=function(e,t){try{return Promise.resolve(fetch(t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/responses",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){if(!e.ok)throw console.error(e.text),new Error("Could not create response");return Promise.resolve(e.json())})}catch(e){return Promise.reject(e)}};function ie(e){return g("label",{htmlFor:e.questionId,className:"fb-block fb-text-base fb-font-semibold fb-leading-6 fb-mr-8 text-slate-900"},e.headline)}function se(e){return g("label",{for:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600"},e.subheader)}function ae(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return g("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);e.currentTarget[t.id].value="",n(o)}},g(ie,{headline:t.headline,questionId:t.id}),g(se,{subheader:t.subheader,questionId:t.id}),g("div",{className:"fb-mt-4"},g("textarea",{rows:3,name:t.id,id:t.id,placeholder:t.placeholder,required:t.required,className:"fb-block fb-w-full fb-rounded-md fb-border fb-p-2 fb-shadow-sm focus:fb-ring-0 sm:fb-text-sm border-slate-100 bg-slate-50 focus:border-slate-500"})),g("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},g("div",null),g("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function fe(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=Y(null),s=i[0],a=i[1];return g("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);e.currentTarget[t.id].value="",n(o)}},g(ie,{headline:t.headline,questionId:t.id}),g(se,{subheader:t.subheader,questionId:t.id}),g("div",{className:"fb-mt-4"},g("fieldset",null,g("legend",{className:"fb-sr-only"},"Choices"),g("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e){return g("label",{key:e.id,className:te(s===e.label?"fb-z-10 border-slate-400 bg-slate-50":"fb-border-gray-200","fb-relative fb-flex fb-cursor-pointer fb-flex-col fb-rounded-md fb-border fb-p-4 focus:fb-outline-none hover:bg-slate-50")},g("span",{className:"fb-flex fb-items-center fb-text-sm"},g("input",{type:"radio",id:e.id,name:t.id,value:e.label,className:"fb-h-4 fb-w-4 fb-border fb-border-gray-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":e.id+"-label",onChange:function(e){a(e.currentTarget.value)},style:{borderColor:o,color:o}}),g("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),g("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},g("div",null),g("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function le(e){return g("div",{className:"fb-h-1 fb-w-full fb-rounded-full bg-slate-200"},g("div",{className:"fb-h-1 fb-rounded-full",style:{backgroundColor:e.brandColor,width:Math.floor(100*e.progress)+"%"}}))}function ue(e){var t=e.config,n=e.survey,r=e.close,o=e.brandColor,i=Y(n.questions[0]),s=i[0],a=i[1],f=Y(0),l=f[0],u=f[1],c=Y(null),d=c[0],b=c[1],p=Y(null),h=p[0],_=p[1],m=Y(!1),v=m[0],w=m[1];$(function(){!function(){try{Promise.resolve(function(e,t){try{return Promise.resolve(fetch(t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/displays",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){if(!e.ok)throw console.error(e.text),new Error("Could not create display");return Promise.resolve(e.json())})}catch(e){return Promise.reject(e)}}({surveyId:n.id,personId:t.person.id},t)).then(function(e){_(e.id)})}catch(e){return Promise.reject(e)}}()},[t,n]),$(function(){var e;u((e=n.questions.findIndex(function(e){return e.id===s.id}),e/n.questions.length))},[s,n]);var y=function(e){try{var o=function(){w(!1),f?(u(100),r()):a(n.questions[i+1])};w(!0);var i=n.questions.findIndex(function(e){return e.id===s.id}),f=i===n.questions.length-1,l={surveyId:n.id,personId:t.person.id,response:{finished:f,data:e}},c=d?Promise.resolve(function(e,t,n){try{return Promise.resolve(fetch(n.apiHost+"/api/v1/client/environments/"+n.environmentId+"/responses/"+t,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){if(!e.ok)throw new Error("Could not update response");return Promise.resolve(e.json())})}catch(e){return Promise.reject(e)}}(l,d,t)).then(function(){}):Promise.resolve(Promise.all([oe(l,t),re(h,t)])).then(function(e){b(e[0].id)});return Promise.resolve(c&&c.then?c.then(o):o())}catch(e){return Promise.reject(e)}};return g("div",null,g("div",{className:te(v?"fb-animate-pulse fb-opacity-60":"","fb-p-4")},"multipleChoiceSingle"===s.type?g(fe,{question:s,onSubmit:y,lastQuestion:n.questions.findIndex(function(e){return e.id===s.id})===n.questions.length-1,brandColor:o}):"openText"===s.type?g(ae,{question:s,onSubmit:y,lastQuestion:n.questions.findIndex(function(e){return e.id===s.id})===n.questions.length-1,brandColor:o}):null),g("div",{className:"fb-mt-2"},g(le,{progress:l,brandColor:o})))}function ce(e){var t,n=e.config,r=e.survey,o=e.closeSurvey,i=Y(!0),s=i[1],a=function(){s(!1),setTimeout(function(){o()},1e3)};return g("div",{id:"fbjs"},g(ne,{isOpen:i[0],close:a},g(ue,{config:n,survey:r,close:a,brandColor:null==(t=n.settings)?void 0:t.brandColor})))}var de=/*#__PURE__*/function(){function e(){this.config=this.loadFromLocalStorage()}e.getInstance=function(){return e.instance||(e.instance=new e),e.instance};var t=e.prototype;return t.update=function(e){e&&(this.config=o({},this.config,e),this.saveToLocalStorage())},t.get=function(){return this.config},t.loadFromLocalStorage=function(){if("undefined"!=typeof window){var e=localStorage.getItem("config");if(e)return JSON.parse(e)}return{apiHost:null,environmentId:null}},t.saveToLocalStorage=function(){localStorage.setItem("config",JSON.stringify(this.config))},e}();de.instance=void 0;var be=/*#__PURE__*/function(){function e(){this.logLevel="error"}e.getInstance=function(){return e.instance||(e.instance=new e),e.instance};var t=e.prototype;return t.configure=function(e){e&&void 0!==e.logLevel&&(this.logLevel=e.logLevel)},t.logger=function(e,t){if("debug"!==t||"debug"===this.logLevel){var n="🧱 Formbricks - "+(new Date).toISOString()+" ["+t.toUpperCase()+"] - "+e;"error"===t?console.error(n):console.log(n)}},t.debug=function(e){this.logger(e,"debug")},t.error=function(e){this.logger(e,"error")},e}();be.instance=void 0;var pe=be.getInstance(),he=de.getInstance(),_e=function(){try{return Promise.resolve(fetch(he.get().apiHost+"/api/v1/client/environments/"+he.get().environmentId+"/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:he.get().person.id})})).then(function(e){if(!e.ok)throw pe.error("Error getting settings"),Error("Error getting settings");return e.json()})}catch(e){return Promise.reject(e)}},ge="formbricks-web-container",me=de.getInstance(),ve=be.getInstance(),we=!1,ye=function(e){we?ve.debug("A survey is already running. Skipping."):(we=!0,function(e,t,n){var r,o,i;a.__&&a.__(e,t),o=(r=void 0===c)?null:t.__k,e=g(v,null,[e]),i=[],H(t,t.__k=e,o||d,d,void 0!==t.ownerSVGElement,o?null:t.childNodes.length?b.slice.call(t.childNodes):null,i,d,r),L(i,e)}(g(ce,{config:me.get(),survey:e,closeSurvey:je}),document.getElementById(ge)))},je=function(){try{return document.getElementById(ge).innerHTML="",Promise.resolve(_e()).then(function(e){me.update({settings:e}),we=!1})}catch(e){return Promise.reject(e)}},xe=be.getInstance(),ke=de.getInstance(),Pe=function(e,t){try{return Promise.resolve(fetch(ke.get().apiHost+"/api/v1/client/environments/"+ke.get().environmentId+"/events",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:ke.get().session.id,eventName:e,properties:t})})).then(function(t){var n;function r(t){if(n)return t;xe.debug('Formbricks: Event "'+e+'" tracked'),Ie(e)}var o=function(){if(!t.ok)return Promise.resolve(t.json()).then(function(e){xe.error("Formbricks: Error tracking event: "+JSON.stringify(e)),n=1})}();return o&&o.then?o.then(r):r(o)})}catch(e){return Promise.reject(e)}},Ie=function(e){for(var t,n=s(null==(r=ke.get().settings)?void 0:r.surveys);!(t=n()).done;)for(var r,o,i=t.value,a=s(i.triggers);!(o=a()).done;){var f;if((null==(f=o.value.eventClass)?void 0:f.name)===e)return xe.debug("Formbricks: survey "+i.id+' triggered by event "'+e+'"'),void ye(i)}},Se=de.getInstance(),Ce=be.getInstance(),Ee=function(){try{return Ce.debug("Creating new person"),Promise.resolve(fetch(Se.get().apiHost+"/api/v1/client/environments/"+Se.get().environmentId+"/people",{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(e){return e.ok?Promise.resolve(e.json()):(console.error("Formbricks: Error fetching person"),null)})}catch(e){return Promise.reject(e)}},Ne=function(e,t){var n=Se.get().person.attributes.find(function(t){var n;return(null==(n=t.attributeClass)?void 0:n.name)===e});return!(!n||n.value!==t)},Te=be.getInstance(),He=de.getInstance(),Le=function(){try{return He.get().person?Promise.resolve(fetch(He.get().apiHost+"/api/v1/client/environments/"+He.get().environmentId+"/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:He.get().person.id})})).then(function(e){if(e.ok)return Promise.resolve(e.json());Te.error("Error creating session")}):(Te.error("Formbricks: Unable to create session. No person found"),Promise.resolve())}catch(e){return Promise.reject(e)}},qe=function(e){var t=o({},e);return t.expiresAt=Date.now()+36e5,t},ze=function(e){return e.expiresAt<=Date.now()},Fe=de.getInstance(),Oe=be.getInstance(),Ae=function(){var e;Oe.debug("checking page url");var t=null==(e=Fe.get().settings)?void 0:e.noCodeEvents.filter(function(e){var t;return"pageUrl"===(null==(t=e.noCodeConfig)?void 0:t.type)});if(0!==t.length)for(var n,r=s(t);!(n=r()).done;){var o=n.value,i=o.noCodeConfig.pageUrl;i&&Ue(window.location.href,i.value,i.rule)&&Pe(o.name)}};function Ue(e,t,n){switch(n){case"exactMatch":return e===t;case"contains":return e.includes(t);case"startsWith":return e.startsWith(t);case"endsWith":return e.endsWith(t);case"notMatch":return e!==t;case"notContains":return!e.includes(t);default:throw new Error("Invalid match type")}}var Me=de.getInstance(),De=be.getInstance(),We=function(){if(!(Me.get().apiHost&&Me.get().environmentId&&Me.get().person&&Me.get().session&&Me.get().settings))throw Error("Formbricks: Formbricks not initialized. Call initialize() first.")},Je=new r,Be=function(e,t){Je.add(function(){try{return We(),Promise.resolve(function(e,t){try{return Ce.debug("setting attribute: "+e+" to value: "+t),Ne(e,t)?(Ce.debug("attribute already set to this value. Skipping update."),Promise.resolve()):Promise.resolve(function(e,t){try{return Se.get().person&&Se.get().person.id?Promise.resolve(fetch(Se.get().apiHost+"/api/v1/client/environments/"+Se.get().environmentId+"/people/"+Se.get().person.id+"/attribute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e,value:t})})).then(function(e){return Promise.resolve(e.json()).then(function(t){if(!e.ok)throw Ce.error("Error updating person"),Error("Error updating person");return t})}):(console.error("Formbricks: Unable to update attribute. No person set."),Promise.resolve())}catch(e){return Promise.reject(e)}}(e,t)).then(function(e){var t=e.person,n=e.settings;if(!t||!n)throw Ce.error("Error updating attribute"),new Error("Formbricks: Error updating attribute");Se.update({person:t,settings:n})})}catch(e){return Promise.reject(e)}}(e,t)).then(function(){})}catch(e){return Promise.reject(e)}})},Re={init:function(e){Je.add(function(){try{return function(e){try{var t=function(){function e(){(function(){if("undefined"!=typeof window){var e=window.setInterval(function(){try{return Promise.resolve(function(){try{var e=function(e){Te.debug("Session not expired, extending session"),He.update({session:qe(He.get().session)})};Te.debug("Checking session");var t=function(){if(ze(He.get().session))return Te.debug("Session expired, creating new session"),Promise.resolve(Le()).then(function(e){var t=e.session,n=e.settings;if(!t||!n)throw Te.error("Error creating new session"),Error("Error creating new session");He.update({session:t,settings:n}),Pe("New Session")})}();return Promise.resolve(t&&t.then?t.then(e):e())}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}},3e5);window.addEventListener("beforeunload",function(){clearInterval(e)})}})(),"undefined"!=typeof window&&(window.addEventListener("hashchange",Ae),window.addEventListener("popstate",Ae),window.addEventListener("pushstate",Ae),window.addEventListener("replacestate",Ae),window.addEventListener("load",Ae))}var t=function(){if(ze(Me.get().session))return Promise.resolve(Le()).then(function(e){var t=e.settings;Me.update({session:qe(e.session),settings:t}),Pe("New Session")})}();return t&&t.then?t.then(e):e()};if(!e.environmentId)throw Error("Formbricks: environmentId is required");if(!e.apiHost)throw Error("Formbricks: apiHost is required");e.logLevel&&De.configure({logLevel:e.logLevel}),(r=document.createElement("div")).id=ge,document.body.appendChild(r),function(){if(null===document.getElementById("formbricks__css")){var e=document.createElement("style");e.id="formbricks__css",e.innerHTML='#fbjs *,#fbjs :after,#fbjs :before{border:0 solid #e5e7eb;box-sizing:border-box}#fbjs :after,#fbjs :before{--tw-content:""}#fbjs html{-webkit-text-size-adjust:100%;font-feature-settings:normal;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}#fbjs body{line-height:inherit;margin:0}#fbjs hr{border-top-width:1px;color:inherit;height:0}#fbjs abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6{font-size:inherit;font-weight:inherit}#fbjs a{color:inherit;text-decoration:inherit}#fbjs b,#fbjs strong{font-weight:bolder}#fbjs code,#fbjs kbd,#fbjs pre,#fbjs samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}#fbjs small{font-size:80%}#fbjs sub,#fbjs sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}#fbjs sub{bottom:-.25em}#fbjs sup{top:-.5em}#fbjs table{border-collapse:collapse;border-color:inherit;text-indent:0}#fbjs button,#fbjs input,#fbjs optgroup,#fbjs select,#fbjs textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}#fbjs button,#fbjs select{text-transform:none}#fbjs [type=button],#fbjs [type=reset],#fbjs [type=submit],#fbjs button{-webkit-appearance:button;background-color:transparent;background-image:none}#fbjs :-moz-focusring{outline:auto}#fbjs :-moz-ui-invalid{box-shadow:none}#fbjs progress{vertical-align:baseline}#fbjs ::-webkit-inner-spin-button,#fbjs ::-webkit-outer-spin-button{height:auto}#fbjs [type=search]{-webkit-appearance:textfield;outline-offset:-2px}#fbjs ::-webkit-search-decoration{-webkit-appearance:none}#fbjs ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}#fbjs summary{display:list-item}#fbjs blockquote,#fbjs dd,#fbjs dl,#fbjs figure,#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6,#fbjs hr,#fbjs p,#fbjs pre{margin:0}#fbjs fieldset{margin:0;padding:0}#fbjs legend{padding:0}#fbjs menu,#fbjs ol,#fbjs ul{list-style:none;margin:0;padding:0}#fbjs textarea{resize:vertical}#fbjs input::-moz-placeholder,#fbjs textarea::-moz-placeholder{color:#9ca3af;opacity:1}#fbjs input::placeholder,#fbjs textarea::placeholder{color:#9ca3af;opacity:1}#fbjs [role=button],#fbjs button{cursor:pointer}#fbjs :disabled{cursor:default}#fbjs audio,#fbjs canvas,#fbjs embed,#fbjs iframe,#fbjs img,#fbjs object,#fbjs svg,#fbjs video{display:block;vertical-align:middle}#fbjs img,#fbjs video{height:auto;max-width:100%}#fbjs [hidden]{display:none}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }#fbjs .fb-sr-only{clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}#fbjs .fb-pointer-events-none{pointer-events:none}#fbjs .fb-pointer-events-auto{pointer-events:auto}#fbjs .fb-fixed{position:fixed}#fbjs .fb-absolute{position:absolute}#fbjs .fb-relative{position:relative}#fbjs .fb-inset-0{bottom:0;left:0;right:0;top:0}#fbjs .fb-right-0{right:0}#fbjs .fb-top-0{top:0}#fbjs .fb-z-10{z-index:10}#fbjs .fb-ml-3{margin-left:.75rem}#fbjs .fb-mr-8{margin-right:2rem}#fbjs .fb-mt-2{margin-top:.5rem}#fbjs .fb-mt-4{margin-top:1rem}#fbjs .fb-block{display:block}#fbjs .fb-flex{display:flex}#fbjs .fb-hidden{display:none}#fbjs .fb-h-1{height:.25rem}#fbjs .fb-h-4{height:1rem}#fbjs .fb-h-6{height:1.5rem}#fbjs .fb-w-4{width:1rem}#fbjs .fb-w-6{width:1.5rem}#fbjs .fb-w-full{width:100%}#fbjs .fb-max-w-sm{max-width:24rem}#fbjs .fb-translate-x-0{--tw-translate-x:0px}#fbjs .fb-translate-x-0,#fbjs .fb-translate-x-28{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#fbjs .fb-translate-x-28{--tw-translate-x:7rem}@keyframes fb-pulse{50%{opacity:.5}}#fbjs .fb-animate-pulse{animation:fb-pulse 2s cubic-bezier(.4,0,.6,1) infinite}#fbjs .fb-cursor-pointer{cursor:pointer}#fbjs .fb-flex-col{flex-direction:column}#fbjs .fb-items-end{align-items:flex-end}#fbjs .fb-items-center{align-items:center}#fbjs .fb-justify-between{justify-content:space-between}#fbjs .fb-space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}#fbjs .fb-space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}#fbjs .fb-overflow-hidden{overflow:hidden}#fbjs .fb-rounded-full{border-radius:9999px}#fbjs .fb-rounded-lg{border-radius:.5rem}#fbjs .fb-rounded-md{border-radius:.375rem}#fbjs .fb-border{border-width:1px}#fbjs .fb-border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}#fbjs .fb-border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity))}#fbjs .fb-border-transparent{border-color:transparent}#fbjs .fb-bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}#fbjs .fb-p-2{padding:.5rem}#fbjs .fb-p-4{padding:1rem}#fbjs .fb-px-3{padding-left:.75rem;padding-right:.75rem}#fbjs .fb-px-4{padding-left:1rem;padding-right:1rem}#fbjs .fb-py-3{padding-bottom:.75rem;padding-top:.75rem}#fbjs .fb-py-6{padding-bottom:1.5rem;padding-top:1.5rem}#fbjs .fb-pr-4{padding-right:1rem}#fbjs .fb-pt-4{padding-top:1rem}#fbjs .fb-text-base{font-size:1rem;line-height:1.5rem}#fbjs .fb-text-sm{font-size:.875rem;line-height:1.25rem}#fbjs .fb-font-medium{font-weight:500}#fbjs .fb-font-normal{font-weight:400}#fbjs .fb-font-semibold{font-weight:600}#fbjs .fb-leading-4{line-height:1rem}#fbjs .fb-leading-6{line-height:1.5rem}#fbjs .fb-text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}#fbjs .fb-opacity-0{opacity:0}#fbjs .fb-opacity-100{opacity:1}#fbjs .fb-opacity-60{opacity:.6}#fbjs .fb-shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}#fbjs .fb-shadow-lg,#fbjs .fb-shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs .fb-shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}#fbjs .fb-ring-1{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs .fb-ring-black{--tw-ring-opacity:1;--tw-ring-color:rgb(0 0 0/var(--tw-ring-opacity))}#fbjs .fb-ring-opacity-5{--tw-ring-opacity:0.05}#fbjs .fb-transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs .fb-duration-500{transition-duration:.5s}#fbjs .fb-ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs .hover\\:fb-opacity-90:hover{opacity:.9}#fbjs .focus\\:fb-outline-none:focus{outline:2px solid transparent;outline-offset:2px}#fbjs .focus\\:fb-ring-0:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color)}#fbjs .focus\\:fb-ring-0:focus,#fbjs .focus\\:fb-ring-2:focus{box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs .focus\\:fb-ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color)}#fbjs .focus\\:fb-ring-offset-0:focus{--tw-ring-offset-width:0px}#fbjs .focus\\:fb-ring-offset-2:focus{--tw-ring-offset-width:2px}@media (min-width:640px){#fbjs .sm\\:fb-block{display:block}#fbjs .sm\\:fb-items-end{align-items:flex-end}#fbjs .sm\\:fb-p-6{padding:1.5rem}#fbjs .sm\\:fb-text-sm{font-size:.875rem;line-height:1.25rem}}',document.head.appendChild(e)}}();var n=function(){if(!Me||Me.get().environmentId!==e.environmentId||Me.get().apiHost!==e.apiHost)return Me.update({environmentId:e.environmentId,apiHost:e.apiHost}),Promise.resolve(Ee()).then(function(e){var t=e.settings;Me.update({person:e.person,session:qe(e.session),settings:t}),Pe("New Session")})}();return Promise.resolve(n&&n.then?n.then(t):t())}catch(e){return Promise.reject(e)}var r}(e),Promise.resolve()}catch(e){return Promise.reject(e)}})},setUserId:function(e){Je.add(function(){try{return We(),Promise.resolve(function(e){try{return Ce.debug("setting userId: "+e),Ne("userId",e)?(Ce.debug("userId already set to this value. Skipping update."),Promise.resolve()):(t=Se.get().person.attributes.find(function(e){var t;return"userId"===(null==(t=e.attributeClass)?void 0:t.name)}),t?(Ce.error("userId cannot be changed after it has been set. You need to reset first"),Promise.resolve()):Promise.resolve(function(e){try{return Se.get().person&&Se.get().person.id?Promise.resolve(fetch(Se.get().apiHost+"/api/v1/client/environments/"+Se.get().environmentId+"/people/"+Se.get().person.id+"/user-id",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,sessionId:Se.get().session.id})})).then(function(e){if(!e.ok)throw Ce.error("Formbricks: Error updating person"),Error("Error updating person");return Promise.resolve(e.json())}):(console.error("Formbricks: Unable to update userId. No person set."),Promise.resolve())}catch(e){return Promise.reject(e)}}(e)).then(function(e){Se.update({person:e.person,settings:e.settings})}))}catch(e){return Promise.reject(e)}var t}(e)).then(function(){})}catch(e){return Promise.reject(e)}})},setEmail:function(e){Be("email",e)},setAttribute:Be,track:function(e,t){void 0===t&&(t={}),Je.add(function(){try{return We(),Promise.resolve(Pe(e,t)).then(function(){})}catch(e){return Promise.reject(e)}})},logout:function(){Je.add(function(){try{return We(),Promise.resolve(function(){try{return Ce.debug("Resetting person. Getting new person, session and settings from backend"),Promise.resolve(Ee()).then(function(e){var t=e.person,n=e.session,r=e.settings;if(!t||!n||!r)throw Ce.error("Error resetting user"),new Error("Formbricks: Error resetting user");Se.update({person:t,session:n,settings:r})})}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}})},refresh:function(){Je.add(function(){try{return We(),Promise.resolve(function(){try{return pe.debug("Refreshing - getting settings from backend"),Promise.resolve(_e()).then(function(e){he.update({settings:e})})}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}})},registerRouteChange:function(){console.log("fire!!!"),Je.add(function(){try{return We(),Ae(),Promise.resolve()}catch(e){return Promise.reject(e)}})}};return"undefined"!=typeof window&&(window.formbricks=Re),Re});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e||self).js=t()}(this,function(){function e(n,r,o){if(!n.s){if(o instanceof t){if(!o.s)return void(o.o=e.bind(null,n,r));1&r&&(r=o.s),o=o.v}if(o&&o.then)return void o.then(e.bind(null,n,r),e.bind(null,n,2));n.s=r,n.v=o;var i=n.o;i&&i(n)}}var t=/*#__PURE__*/function(){function t(){}return t.prototype.then=function(n,r){var o=new t,i=this.s;if(i){var s=1&i?n:r;if(s){try{e(o,1,s(this.v))}catch(t){e(o,2,t)}return o}return this}return this.o=function(t){try{var i=t.v;1&t.s?e(o,1,n?n(i):i):r?e(o,1,r(i)):e(o,2,i)}catch(t){e(o,2,t)}},o},t}();function n(e){return e instanceof t&&1&e.s}var r=/*#__PURE__*/function(){function r(){this.queue=[],this.running=!1}var o=r.prototype;return o.add=function(e){this.queue.push(e),this.running||this.run()},o.run=function(){try{var r=function(){o.running=!1},o=this;o.running=!0;var i=function(r,o,i){for(var s;;){var a=r();if(n(a)&&(a=a.v),!a)return f;if(a.then){s=0;break}var f=i();if(f&&f.then){if(!n(f)){s=1;break}f=f.s}}var l=new t,u=e.bind(null,l,2);return(0===s?a.then(d):1===s?f.then(c):(void 0).then(function(){(a=r())?a.then?a.then(d).then(void 0,u):d(a):e(l,1,f)})).then(void 0,u),l;function c(t){f=t;do{if(!(a=r())||n(a)&&!a.v)return void e(l,1,f);if(a.then)return void a.then(d).then(void 0,u);n(f=i())&&(f=f.v)}while(!f||!f.then);f.then(c).then(void 0,u)}function d(t){t?(f=i())&&f.then?f.then(c).then(void 0,u):c(f):e(l,1,f)}}(function(){return o.queue.length>0},0,function(){var e=o.queue.shift(),t=function(t,n){try{var r=Promise.resolve(e()).then(function(){})}catch(e){return n(e)}return r&&r.then?r.then(void 0,n):r}(0,function(e){console.error(e)});if(t&&t.then)return t.then(function(){})});return Promise.resolve(i&&i.then?i.then(r):r())}catch(e){return Promise.reject(e)}},r}();function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o.apply(this,arguments)}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function s(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,f,l,u,c,d={},b=[],p=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function h(e,t){for(var n in t)e[n]=t[n];return e}function _(e){var t=e.parentNode;t&&t.removeChild(e)}function g(e,t,n){var r,o,i,s=arguments,a={};for(i in t)"key"==i?r=t[i]:"ref"==i?o=t[i]:a[i]=t[i];if(arguments.length>3)for(n=[n],i=3;i<arguments.length;i++)n.push(s[i]);if(null!=n&&(a.children=n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===a[i]&&(a[i]=e.defaultProps[i]);return m(e,a,r,o,null)}function m(e,t,n,r,o){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==o?++a.__v:o};return null!=a.vnode&&a.vnode(i),i}function v(e){return e.children}function w(e,t){this.props=e,this.context=t}function y(e,t){if(null==t)return e.__?y(e.__,e.__.__k.indexOf(e)+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?y(e):null}function j(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return j(e)}}function x(e){(!e.__d&&(e.__d=!0)&&f.push(e)&&!k.__r++||u!==a.debounceRendering)&&((u=a.debounceRendering)||l)(k)}function k(){for(var e;k.__r=f.length;)e=f.sort(function(e,t){return e.__v.__b-t.__v.__b}),f=[],e.some(function(e){var t,n,r,o,i,s,a;e.__d&&(s=(i=(t=e).__v).__e,(a=t.__P)&&(n=[],(r=h({},i)).__v=i.__v+1,o=H(a,i,r,t.__n,void 0!==a.ownerSVGElement,null!=i.__h?[s]:null,n,null==s?y(i):s,i.__h),L(n,i),o!=s&&j(i)))})}function P(e,t,n,r,o,i,s,a,f,l){var u,c,p,h,g,w,j,x=r&&r.__k||b,k=x.length;for(f==d&&(f=null!=s?s[0]:k?y(r,0):null),n.__k=[],u=0;u<t.length;u++)if(null!=(h=n.__k[u]=null==(h=t[u])||"boolean"==typeof h?null:"string"==typeof h||"number"==typeof h?m(null,h,null,null,h):Array.isArray(h)?m(v,{children:h},null,null,null):null!=h.__e||null!=h.__c?m(h.type,h.props,h.key,null,h.__v):h)){if(h.__=n,h.__b=n.__b+1,null===(p=x[u])||p&&h.key==p.key&&h.type===p.type)x[u]=void 0;else for(c=0;c<k;c++){if((p=x[c])&&h.key==p.key&&h.type===p.type){x[c]=void 0;break}p=null}g=H(e,h,p=p||d,o,i,s,a,f,l),(c=h.ref)&&p.ref!=c&&(j||(j=[]),p.ref&&j.push(p.ref,null,h),j.push(c,h.__c||g,h)),null!=g?(null==w&&(w=g),f=I(e,h,p,x,s,g,f),l||"option"!=n.type?"function"==typeof n.type&&(n.__d=f):e.value=""):f&&p.__e==f&&f.parentNode!=e&&(f=y(p))}if(n.__e=w,null!=s&&"function"!=typeof n.type)for(u=s.length;u--;)null!=s[u]&&_(s[u]);for(u=k;u--;)null!=x[u]&&z(x[u],x[u]);if(j)for(u=0;u<j.length;u++)q(j[u],j[++u],j[++u])}function I(e,t,n,r,o,i,s){var a,f,l;if(void 0!==t.__d)a=t.__d,t.__d=void 0;else if(o==n||i!=s||null==i.parentNode)e:if(null==s||s.parentNode!==e)e.appendChild(i),a=null;else{for(f=s,l=0;(f=f.nextSibling)&&l<r.length;l+=2)if(f==i)break e;e.insertBefore(i,s),a=s}return void 0!==a?a:i.nextSibling}function S(e,t,n){"-"===t[0]?e.setProperty(t,n):e[t]=null==n?"":"number"!=typeof n||p.test(t)?n:n+"px"}function C(e,t,n,r,o){var i,s,a;if(o&&"className"==t&&(t="class"),"style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||S(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||S(e.style,t,n[t])}else"o"===t[0]&&"n"===t[1]?(i=t!==(t=t.replace(/Capture$/,"")),(s=t.toLowerCase())in e&&(t=s),t=t.slice(2),e.l||(e.l={}),e.l[t+i]=n,a=i?N:E,n?r||e.addEventListener(t,a,i):e.removeEventListener(t,a,i)):"list"!==t&&"tagName"!==t&&"form"!==t&&"type"!==t&&"size"!==t&&"download"!==t&&"href"!==t&&!o&&t in e?e[t]=null==n?"":n:"function"!=typeof n&&"dangerouslySetInnerHTML"!==t&&(t!==(t=t.replace(/xlink:?/,""))?null==n||!1===n?e.removeAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase()):e.setAttributeNS("http://www.w3.org/1999/xlink",t.toLowerCase(),n):null==n||!1===n&&!/^ar/.test(t)?e.removeAttribute(t):e.setAttribute(t,n))}function E(e){this.l[e.type+!1](a.event?a.event(e):e)}function N(e){this.l[e.type+!0](a.event?a.event(e):e)}function T(e,t,n){var r,o;for(r=0;r<e.__k.length;r++)(o=e.__k[r])&&(o.__=e,o.__e&&("function"==typeof o.type&&o.__k.length>1&&T(o,t,n),t=I(n,o,o,e.__k,null,o.__e,t),"function"==typeof e.type&&(e.__d=t)))}function H(e,t,n,r,o,i,s,f,l){var u,c,p,_,g,m,y,j,x,k,I,S=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(l=n.__h,f=t.__e=n.__e,t.__h=null,i=[f]),(u=a.__b)&&u(t);try{e:if("function"==typeof S){if(j=t.props,x=(u=S.contextType)&&r[u.__c],k=u?x?x.props.value:u.__:r,n.__c?y=(c=t.__c=n.__c).__=c.__E:("prototype"in S&&S.prototype.render?t.__c=c=new S(j,k):(t.__c=c=new w(j,k),c.constructor=S,c.render=F),x&&x.sub(c),c.props=j,c.state||(c.state={}),c.context=k,c.__n=r,p=c.__d=!0,c.__h=[]),null==c.__s&&(c.__s=c.state),null!=S.getDerivedStateFromProps&&(c.__s==c.state&&(c.__s=h({},c.__s)),h(c.__s,S.getDerivedStateFromProps(j,c.__s))),_=c.props,g=c.state,p)null==S.getDerivedStateFromProps&&null!=c.componentWillMount&&c.componentWillMount(),null!=c.componentDidMount&&c.__h.push(c.componentDidMount);else{if(null==S.getDerivedStateFromProps&&j!==_&&null!=c.componentWillReceiveProps&&c.componentWillReceiveProps(j,k),!c.__e&&null!=c.shouldComponentUpdate&&!1===c.shouldComponentUpdate(j,c.__s,k)||t.__v===n.__v){c.props=j,c.state=c.__s,t.__v!==n.__v&&(c.__d=!1),c.__v=t,t.__e=n.__e,t.__k=n.__k,c.__h.length&&s.push(c),T(t,f,e);break e}null!=c.componentWillUpdate&&c.componentWillUpdate(j,c.__s,k),null!=c.componentDidUpdate&&c.__h.push(function(){c.componentDidUpdate(_,g,m)})}c.context=k,c.props=j,c.state=c.__s,(u=a.__r)&&u(t),c.__d=!1,c.__v=t,c.__P=e,u=c.render(c.props,c.state,c.context),c.state=c.__s,null!=c.getChildContext&&(r=h(h({},r),c.getChildContext())),p||null==c.getSnapshotBeforeUpdate||(m=c.getSnapshotBeforeUpdate(_,g)),I=null!=u&&u.type==v&&null==u.key?u.props.children:u,P(e,Array.isArray(I)?I:[I],t,n,r,o,i,s,f,l),c.base=t.__e,t.__h=null,c.__h.length&&s.push(c),y&&(c.__E=c.__=null),c.__e=!1}else null==i&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=function(e,t,n,r,o,i,s,a){var f,l,u,c,p,h=n.props,_=t.props;if(o="svg"===t.type||o,null!=i)for(f=0;f<i.length;f++)if(null!=(l=i[f])&&((null===t.type?3===l.nodeType:l.localName===t.type)||e==l)){e=l,i[f]=null;break}if(null==e){if(null===t.type)return document.createTextNode(_);e=o?document.createElementNS("http://www.w3.org/2000/svg",t.type):document.createElement(t.type,_.is&&{is:_.is}),i=null,a=!1}if(null===t.type)h===_||a&&e.data===_||(e.data=_);else{if(null!=i&&(i=b.slice.call(e.childNodes)),u=(h=n.props||d).dangerouslySetInnerHTML,c=_.dangerouslySetInnerHTML,!a){if(null!=i)for(h={},p=0;p<e.attributes.length;p++)h[e.attributes[p].name]=e.attributes[p].value;(c||u)&&(c&&(u&&c.__html==u.__html||c.__html===e.innerHTML)||(e.innerHTML=c&&c.__html||""))}(function(e,t,n,r,o){var i;for(i in n)"children"===i||"key"===i||i in t||C(e,i,null,n[i],r);for(i in t)o&&"function"!=typeof t[i]||"children"===i||"key"===i||"value"===i||"checked"===i||n[i]===t[i]||C(e,i,t[i],n[i],r)})(e,_,h,o,a),c?t.__k=[]:(f=t.props.children,P(e,Array.isArray(f)?f:[f],t,n,r,"foreignObject"!==t.type&&o,i,s,d,a)),a||("value"in _&&void 0!==(f=_.value)&&(f!==e.value||"progress"===t.type&&!f)&&C(e,"value",f,h.value,!1),"checked"in _&&void 0!==(f=_.checked)&&f!==e.checked&&C(e,"checked",f,h.checked,!1))}return e}(n.__e,t,n,r,o,i,s,l);(u=a.diffed)&&u(t)}catch(e){t.__v=null,(l||null!=i)&&(t.__e=f,t.__h=!!l,i[i.indexOf(f)]=null),a.__e(e,t,n)}return t.__e}function L(e,t){a.__c&&a.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){a.__e(e,t.__v)}})}function q(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){a.__e(e,n)}}function z(e,t,n){var r,o,i;if(a.unmount&&a.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||q(r,null,t)),n||"function"==typeof e.type||(n=null!=(o=e.__e)),e.__e=e.__d=void 0,null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){a.__e(e,t)}r.base=r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&z(r[i],t,n);null!=o&&_(o)}function F(e,t,n){return this.constructor(e,n)}a={__e:function(e,t){for(var n,r,o,i=t.__h;t=t.__;)if((n=t.__c)&&!n.__)try{if((r=n.constructor)&&null!=r.getDerivedStateFromError&&(n.setState(r.getDerivedStateFromError(e)),o=n.__d),null!=n.componentDidCatch&&(n.componentDidCatch(e),o=n.__d),o)return t.__h=i,n.__E=n}catch(t){e=t}throw e},__v:0},w.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=h({},this.state),"function"==typeof e&&(e=e(h({},n),this.props)),e&&h(n,e),null!=e&&this.__v&&(t&&this.__h.push(t),x(this))},w.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),x(this))},w.prototype.render=v,f=[],l="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,k.__r=0,c=d;var O,A,U,M=0,D=[],W=a.__b,J=a.__r,B=a.diffed,R=a.__c,Q=a.unmount;function G(e,t){a.__h&&a.__h(A,e,M||t),M=0;var n=A.__H||(A.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Y(e){return M=1,function(e,t,n){var r=G(O++,2);return r.t=e,r.__c||(r.__=[ee(void 0,t),function(e){var t=r.t(r.__[0],e);r.__[0]!==t&&(r.__=[t,r.__[1]],r.__c.setState({}))}],r.__c=A),r.__}(ee,e)}function $(e,t){var n=G(O++,3);!a.__s&&function(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}(n.__H,t)&&(n.__=e,n.__H=t,A.__H.__h.push(n))}function V(){D.forEach(function(e){if(e.__P)try{e.__H.__h.forEach(K),e.__H.__h.forEach(Z),e.__H.__h=[]}catch(t){e.__H.__h=[],a.__e(t,e.__v)}}),D=[]}a.__b=function(e){A=null,W&&W(e)},a.__r=function(e){J&&J(e),O=0;var t=(A=e.__c).__H;t&&(t.__h.forEach(K),t.__h.forEach(Z),t.__h=[])},a.diffed=function(e){B&&B(e);var t=e.__c;t&&t.__H&&t.__H.__h.length&&(1!==D.push(t)&&U===a.requestAnimationFrame||((U=a.requestAnimationFrame)||function(e){var t,n=function(){clearTimeout(r),X&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);X&&(t=requestAnimationFrame(n))})(V)),A=void 0},a.__c=function(e,t){t.some(function(e){try{e.__h.forEach(K),e.__h=e.__h.filter(function(e){return!e.__||Z(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],a.__e(n,e.__v)}}),R&&R(e,t)},a.unmount=function(e){Q&&Q(e);var t=e.__c;if(t&&t.__H)try{t.__H.__.forEach(K)}catch(e){a.__e(e,t.__v)}};var X="function"==typeof requestAnimationFrame;function K(e){var t=A;"function"==typeof e.__c&&e.__c(),A=t}function Z(e){var t=A;e.__c=e.__(),A=t}function ee(e,t){return"function"==typeof t?t(e):t}var te=function(){return[].slice.call(arguments).filter(Boolean).join(" ")};function ne(e){var t=e.children,n=e.isOpen,r=e.close,o=Y(!1),i=o[0],s=o[1];return $(function(){s(n)},[n]),g("div",{"aria-live":"assertive",className:"fb-pointer-events-none fb-fixed fb-inset-0 fb-flex fb-items-end fb-px-4 fb-py-6 sm:fb-p-6"},g("div",{className:"fb-flex fb-w-full fb-flex-col fb-items-center fb-space-y-4 sm:fb-items-end"},g("div",{className:te(i?"fb-translate-x-0 fb-opacity-100":"fb-translate-x-28 fb-opacity-0","fb-pointer-events-auto fb-relative fb-w-full fb-max-w-sm fb-overflow-hidden fb-rounded-lg fb-bg-white fb-shadow-lg fb-ring-1 fb-ring-black fb-ring-opacity-5 fb-transition-all fb-duration-500 fb-ease-in-out")},g("div",{class:"fb-absolute fb-top-0 fb-right-0 fb-hidden fb-pt-4 fb-pr-4 sm:fb-block"},g("button",{type:"button",onClick:r,class:"fb-rounded-md fb-bg-white focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 text-slate-400 hover:text-slate-500 focus:ring-slate-500"},g("span",{class:"fb-sr-only"},"Close"),g("svg",{class:"fb-h-6 fb-w-6",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},g("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})))),g("div",{className:""},t))))}var re=function(e,t){try{return Promise.resolve(fetch(t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/displays/"+e+"/responded",{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(e){if(!e.ok)throw new Error("Could not update display")})}catch(e){return Promise.reject(e)}},oe=function(e,t){try{return Promise.resolve(fetch(t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/responses",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){if(!e.ok)throw console.error(e.text),new Error("Could not create response");return Promise.resolve(e.json())})}catch(e){return Promise.reject(e)}};function ie(e){return g("label",{htmlFor:e.questionId,className:"fb-block fb-text-base fb-font-semibold fb-leading-6 fb-mr-8 text-slate-900"},e.headline)}function se(e){return g("label",{for:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600"},e.subheader)}function ae(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return g("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);e.currentTarget[t.id].value="",n(o)}},g(ie,{headline:t.headline,questionId:t.id}),g(se,{subheader:t.subheader,questionId:t.id}),g("div",{className:"fb-mt-4"},g("textarea",{rows:3,name:t.id,id:t.id,placeholder:t.placeholder,required:t.required,className:"fb-block fb-w-full fb-rounded-md fb-border fb-p-2 fb-shadow-sm focus:fb-ring-0 sm:fb-text-sm border-slate-100 bg-slate-50 focus:border-slate-500"})),g("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},g("div",null),g("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function fe(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=Y(null),s=i[0],a=i[1];return g("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);e.currentTarget[t.id].value="",n(o)}},g(ie,{headline:t.headline,questionId:t.id}),g(se,{subheader:t.subheader,questionId:t.id}),g("div",{className:"fb-mt-4"},g("fieldset",null,g("legend",{className:"fb-sr-only"},"Choices"),g("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e){return g("label",{key:e.id,className:te(s===e.label?"fb-z-10 border-slate-400 bg-slate-50":"fb-border-gray-200","fb-relative fb-flex fb-cursor-pointer fb-flex-col fb-rounded-md fb-border fb-p-4 focus:fb-outline-none hover:bg-slate-50")},g("span",{className:"fb-flex fb-items-center fb-text-sm"},g("input",{type:"radio",id:e.id,name:t.id,value:e.label,className:"fb-h-4 fb-w-4 fb-border fb-border-gray-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":e.id+"-label",onChange:function(e){a(e.currentTarget.value)},style:{borderColor:o,color:o}}),g("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),g("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},g("div",null),g("button",{type:"submit",className:"fb-flex fb-items-center fb-rounded-md fb-border fb-border-transparent fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-text-white fb-shadow-sm hover:fb-opacity-90 focus:fb-outline-none focus:fb-ring-2 focus:fb-ring-offset-2 focus:ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function le(e){return g("div",{className:"fb-h-1 fb-w-full fb-rounded-full bg-slate-200"},g("div",{className:"fb-h-1 fb-rounded-full",style:{backgroundColor:e.brandColor,width:Math.floor(100*e.progress)+"%"}}))}function ue(e){var t=e.config,n=e.survey,r=e.close,o=e.brandColor,i=Y(n.questions[0]),s=i[0],a=i[1],f=Y(0),l=f[0],u=f[1],c=Y(null),d=c[0],b=c[1],p=Y(null),h=p[0],_=p[1],m=Y(!1),v=m[0],w=m[1];$(function(){!function(){try{Promise.resolve(function(e,t){try{return Promise.resolve(fetch(t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/displays",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){if(!e.ok)throw console.error(e.text),new Error("Could not create display");return Promise.resolve(e.json())})}catch(e){return Promise.reject(e)}}({surveyId:n.id,personId:t.person.id},t)).then(function(e){_(e.id)})}catch(e){return Promise.reject(e)}}()},[t,n]),$(function(){var e;u((e=n.questions.findIndex(function(e){return e.id===s.id}),e/n.questions.length))},[s,n]);var y=function(e){try{var o=function(){w(!1),f?(u(100),r()):a(n.questions[i+1])};w(!0);var i=n.questions.findIndex(function(e){return e.id===s.id}),f=i===n.questions.length-1,l={surveyId:n.id,personId:t.person.id,response:{finished:f,data:e}},c=d?Promise.resolve(function(e,t,n){try{return Promise.resolve(fetch(n.apiHost+"/api/v1/client/environments/"+n.environmentId+"/responses/"+t,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){if(!e.ok)throw new Error("Could not update response");return Promise.resolve(e.json())})}catch(e){return Promise.reject(e)}}(l,d,t)).then(function(){}):Promise.resolve(Promise.all([oe(l,t),re(h,t)])).then(function(e){b(e[0].id)});return Promise.resolve(c&&c.then?c.then(o):o())}catch(e){return Promise.reject(e)}};return g("div",null,g("div",{className:te(v?"fb-animate-pulse fb-opacity-60":"","fb-p-4")},"multipleChoiceSingle"===s.type?g(fe,{question:s,onSubmit:y,lastQuestion:n.questions.findIndex(function(e){return e.id===s.id})===n.questions.length-1,brandColor:o}):"openText"===s.type?g(ae,{question:s,onSubmit:y,lastQuestion:n.questions.findIndex(function(e){return e.id===s.id})===n.questions.length-1,brandColor:o}):null),g("div",{className:"fb-mt-2"},g(le,{progress:l,brandColor:o})))}function ce(e){var t,n=e.config,r=e.survey,o=e.closeSurvey,i=Y(!0),s=i[1],a=function(){s(!1),setTimeout(function(){o()},1e3)};return g("div",{id:"fbjs"},g(ne,{isOpen:i[0],close:a},g(ue,{config:n,survey:r,close:a,brandColor:null==(t=n.settings)?void 0:t.brandColor})))}var de=/*#__PURE__*/function(){function e(){this.config=this.loadFromLocalStorage()}e.getInstance=function(){return e.instance||(e.instance=new e),e.instance};var t=e.prototype;return t.update=function(e){e&&(this.config=o({},this.config,e),this.saveToLocalStorage())},t.get=function(){return this.config},t.loadFromLocalStorage=function(){if("undefined"!=typeof window){var e=localStorage.getItem("config");if(e)return JSON.parse(e)}return{apiHost:null,environmentId:null}},t.saveToLocalStorage=function(){localStorage.setItem("config",JSON.stringify(this.config))},e}();de.instance=void 0;var be=/*#__PURE__*/function(){function e(){this.logLevel="error"}e.getInstance=function(){return e.instance||(e.instance=new e),e.instance};var t=e.prototype;return t.configure=function(e){e&&void 0!==e.logLevel&&(this.logLevel=e.logLevel)},t.logger=function(e,t){if("debug"!==t||"debug"===this.logLevel){var n="🧱 Formbricks - "+(new Date).toISOString()+" ["+t.toUpperCase()+"] - "+e;"error"===t?console.error(n):console.log(n)}},t.debug=function(e){this.logger(e,"debug")},t.error=function(e){this.logger(e,"error")},e}();be.instance=void 0;var pe=be.getInstance(),he=de.getInstance(),_e=function(){try{return Promise.resolve(fetch(he.get().apiHost+"/api/v1/client/environments/"+he.get().environmentId+"/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:he.get().person.id})})).then(function(e){if(!e.ok)throw pe.error("Error getting settings"),Error("Error getting settings");return e.json()})}catch(e){return Promise.reject(e)}},ge="formbricks-web-container",me=de.getInstance(),ve=be.getInstance(),we=!1,ye=function(e){we?ve.debug("A survey is already running. Skipping."):(we=!0,function(e,t,n){var r,o,i;a.__&&a.__(e,t),o=(r=void 0===c)?null:t.__k,e=g(v,null,[e]),i=[],H(t,t.__k=e,o||d,d,void 0!==t.ownerSVGElement,o?null:t.childNodes.length?b.slice.call(t.childNodes):null,i,d,r),L(i,e)}(g(ce,{config:me.get(),survey:e,closeSurvey:je}),document.getElementById(ge)))},je=function(){try{return document.getElementById(ge).innerHTML="",Promise.resolve(_e()).then(function(e){me.update({settings:e}),we=!1})}catch(e){return Promise.reject(e)}},xe=be.getInstance(),ke=de.getInstance(),Pe=function(e,t){try{return Promise.resolve(fetch(ke.get().apiHost+"/api/v1/client/environments/"+ke.get().environmentId+"/events",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:ke.get().session.id,eventName:e,properties:t})})).then(function(t){var n;function r(t){if(n)return t;xe.debug('Formbricks: Event "'+e+'" tracked'),Ie(e)}var o=function(){if(!t.ok)return Promise.resolve(t.json()).then(function(e){xe.error("Formbricks: Error tracking event: "+JSON.stringify(e)),n=1})}();return o&&o.then?o.then(r):r(o)})}catch(e){return Promise.reject(e)}},Ie=function(e){for(var t,n=s(null==(r=ke.get().settings)?void 0:r.surveys);!(t=n()).done;)for(var r,o,i=t.value,a=s(i.triggers);!(o=a()).done;){var f;if((null==(f=o.value.eventClass)?void 0:f.name)===e)return xe.debug("Formbricks: survey "+i.id+' triggered by event "'+e+'"'),void ye(i)}},Se=de.getInstance(),Ce=be.getInstance(),Ee=function(){try{return Ce.debug("Creating new person"),Promise.resolve(fetch(Se.get().apiHost+"/api/v1/client/environments/"+Se.get().environmentId+"/people",{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(e){return e.ok?Promise.resolve(e.json()):(console.error("Formbricks: Error fetching person"),null)})}catch(e){return Promise.reject(e)}},Ne=function(e,t){var n=Se.get().person.attributes.find(function(t){var n;return(null==(n=t.attributeClass)?void 0:n.name)===e});return!(!n||n.value!==t)},Te=be.getInstance(),He=de.getInstance(),Le=function(){try{return He.get().person?Promise.resolve(fetch(He.get().apiHost+"/api/v1/client/environments/"+He.get().environmentId+"/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:He.get().person.id})})).then(function(e){if(e.ok)return Promise.resolve(e.json());Te.error("Error creating session")}):(Te.error("Formbricks: Unable to create session. No person found"),Promise.resolve())}catch(e){return Promise.reject(e)}},qe=function(e){var t=o({},e);return t.expiresAt=Date.now()+36e5,t},ze=function(e){return e.expiresAt<=Date.now()},Fe=de.getInstance(),Oe=be.getInstance(),Ae=function(){var e;Oe.debug("checking page url");var t=null==(e=Fe.get().settings)?void 0:e.noCodeEvents.filter(function(e){var t;return"pageUrl"===(null==(t=e.noCodeConfig)?void 0:t.type)});if(0!==t.length)for(var n,r=s(t);!(n=r()).done;){var o=n.value,i=o.noCodeConfig.pageUrl;i&&Ue(window.location.href,i.value,i.rule)&&Pe(o.name)}};function Ue(e,t,n){switch(n){case"exactMatch":return e===t;case"contains":return e.includes(t);case"startsWith":return e.startsWith(t);case"endsWith":return e.endsWith(t);case"notMatch":return e!==t;case"notContains":return!e.includes(t);default:throw new Error("Invalid match type")}}var Me=de.getInstance(),De=be.getInstance(),We=function(){if(!(Me.get().apiHost&&Me.get().environmentId&&Me.get().person&&Me.get().session&&Me.get().settings))throw Error("Formbricks: Formbricks not initialized. Call initialize() first.")},Je=new r,Be=function(e,t){Je.add(function(){try{return We(),Promise.resolve(function(e,t){try{return Ce.debug("setting attribute: "+e+" to value: "+t),Ne(e,t)?(Ce.debug("attribute already set to this value. Skipping update."),Promise.resolve()):Promise.resolve(function(e,t){try{return Se.get().person&&Se.get().person.id?Promise.resolve(fetch(Se.get().apiHost+"/api/v1/client/environments/"+Se.get().environmentId+"/people/"+Se.get().person.id+"/attribute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e,value:t})})).then(function(e){return Promise.resolve(e.json()).then(function(t){if(!e.ok)throw Ce.error("Error updating person"),Error("Error updating person");return t})}):(console.error("Formbricks: Unable to update attribute. No person set."),Promise.resolve())}catch(e){return Promise.reject(e)}}(e,t)).then(function(e){var t=e.person,n=e.settings;if(!t||!n)throw Ce.error("Error updating attribute"),new Error("Formbricks: Error updating attribute");Se.update({person:t,settings:n})})}catch(e){return Promise.reject(e)}}(e,t)).then(function(){})}catch(e){return Promise.reject(e)}})},Re={init:function(e){Je.add(function(){try{return function(e){try{var t=function(){function e(){(function(){if("undefined"!=typeof window){var e=window.setInterval(function(){try{return Promise.resolve(function(){try{var e=function(e){Te.debug("Session not expired, extending session"),He.update({session:qe(He.get().session)})};Te.debug("Checking session");var t=function(){if(ze(He.get().session))return Te.debug("Session expired, creating new session"),Promise.resolve(Le()).then(function(e){var t=e.session,n=e.settings;if(!t||!n)throw Te.error("Error creating new session"),Error("Error creating new session");He.update({session:t,settings:n}),Pe("New Session")})}();return Promise.resolve(t&&t.then?t.then(e):e())}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}},3e5);window.addEventListener("beforeunload",function(){clearInterval(e)})}})(),"undefined"!=typeof window&&(window.addEventListener("hashchange",Ae),window.addEventListener("popstate",Ae),window.addEventListener("pushstate",Ae),window.addEventListener("replacestate",Ae),window.addEventListener("load",Ae))}var t=function(){if(ze(Me.get().session))return Promise.resolve(Le()).then(function(e){var t=e.settings;Me.update({session:qe(e.session),settings:t}),Pe("New Session")})}();return t&&t.then?t.then(e):e()};if(!e.environmentId)throw Error("Formbricks: environmentId is required");if(!e.apiHost)throw Error("Formbricks: apiHost is required");e.logLevel&&De.configure({logLevel:e.logLevel}),(r=document.createElement("div")).id=ge,document.body.appendChild(r),function(){if(null===document.getElementById("formbricks__css")){var e=document.createElement("style");e.id="formbricks__css",e.innerHTML='#fbjs *,#fbjs :after,#fbjs :before{border:0 solid #e5e7eb;box-sizing:border-box}#fbjs :after,#fbjs :before{--tw-content:""}#fbjs html{-webkit-text-size-adjust:100%;font-feature-settings:normal;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}#fbjs body{line-height:inherit;margin:0}#fbjs hr{border-top-width:1px;color:inherit;height:0}#fbjs abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6{font-size:inherit;font-weight:inherit}#fbjs a{color:inherit;text-decoration:inherit}#fbjs b,#fbjs strong{font-weight:bolder}#fbjs code,#fbjs kbd,#fbjs pre,#fbjs samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}#fbjs small{font-size:80%}#fbjs sub,#fbjs sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}#fbjs sub{bottom:-.25em}#fbjs sup{top:-.5em}#fbjs table{border-collapse:collapse;border-color:inherit;text-indent:0}#fbjs button,#fbjs input,#fbjs optgroup,#fbjs select,#fbjs textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}#fbjs button,#fbjs select{text-transform:none}#fbjs [type=button],#fbjs [type=reset],#fbjs [type=submit],#fbjs button{-webkit-appearance:button;background-color:transparent;background-image:none}#fbjs :-moz-focusring{outline:auto}#fbjs :-moz-ui-invalid{box-shadow:none}#fbjs progress{vertical-align:baseline}#fbjs ::-webkit-inner-spin-button,#fbjs ::-webkit-outer-spin-button{height:auto}#fbjs [type=search]{-webkit-appearance:textfield;outline-offset:-2px}#fbjs ::-webkit-search-decoration{-webkit-appearance:none}#fbjs ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}#fbjs summary{display:list-item}#fbjs blockquote,#fbjs dd,#fbjs dl,#fbjs figure,#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6,#fbjs hr,#fbjs p,#fbjs pre{margin:0}#fbjs fieldset{margin:0;padding:0}#fbjs legend{padding:0}#fbjs menu,#fbjs ol,#fbjs ul{list-style:none;margin:0;padding:0}#fbjs textarea{resize:vertical}#fbjs input::-moz-placeholder,#fbjs textarea::-moz-placeholder{color:#9ca3af;opacity:1}#fbjs input::placeholder,#fbjs textarea::placeholder{color:#9ca3af;opacity:1}#fbjs [role=button],#fbjs button{cursor:pointer}#fbjs :disabled{cursor:default}#fbjs audio,#fbjs canvas,#fbjs embed,#fbjs iframe,#fbjs img,#fbjs object,#fbjs svg,#fbjs video{display:block;vertical-align:middle}#fbjs img,#fbjs video{height:auto;max-width:100%}#fbjs [hidden]{display:none}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }#fbjs .fb-sr-only{clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}#fbjs .fb-pointer-events-none{pointer-events:none}#fbjs .fb-pointer-events-auto{pointer-events:auto}#fbjs .fb-fixed{position:fixed}#fbjs .fb-absolute{position:absolute}#fbjs .fb-relative{position:relative}#fbjs .fb-inset-0{bottom:0;left:0;right:0;top:0}#fbjs .fb-right-0{right:0}#fbjs .fb-top-0{top:0}#fbjs .fb-z-10{z-index:10}#fbjs .fb-ml-3{margin-left:.75rem}#fbjs .fb-mr-8{margin-right:2rem}#fbjs .fb-mt-2{margin-top:.5rem}#fbjs .fb-mt-4{margin-top:1rem}#fbjs .fb-block{display:block}#fbjs .fb-flex{display:flex}#fbjs .fb-hidden{display:none}#fbjs .fb-h-1{height:.25rem}#fbjs .fb-h-4{height:1rem}#fbjs .fb-h-6{height:1.5rem}#fbjs .fb-w-4{width:1rem}#fbjs .fb-w-6{width:1.5rem}#fbjs .fb-w-full{width:100%}#fbjs .fb-max-w-sm{max-width:24rem}#fbjs .fb-translate-x-0{--tw-translate-x:0px}#fbjs .fb-translate-x-0,#fbjs .fb-translate-x-28{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#fbjs .fb-translate-x-28{--tw-translate-x:7rem}@keyframes fb-pulse{50%{opacity:.5}}#fbjs .fb-animate-pulse{animation:fb-pulse 2s cubic-bezier(.4,0,.6,1) infinite}#fbjs .fb-cursor-pointer{cursor:pointer}#fbjs .fb-flex-col{flex-direction:column}#fbjs .fb-items-end{align-items:flex-end}#fbjs .fb-items-center{align-items:center}#fbjs .fb-justify-between{justify-content:space-between}#fbjs .fb-space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}#fbjs .fb-space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}#fbjs .fb-overflow-hidden{overflow:hidden}#fbjs .fb-rounded-full{border-radius:9999px}#fbjs .fb-rounded-lg{border-radius:.5rem}#fbjs .fb-rounded-md{border-radius:.375rem}#fbjs .fb-border{border-width:1px}#fbjs .fb-border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}#fbjs .fb-border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity))}#fbjs .fb-border-transparent{border-color:transparent}#fbjs .fb-bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}#fbjs .fb-p-2{padding:.5rem}#fbjs .fb-p-4{padding:1rem}#fbjs .fb-px-3{padding-left:.75rem;padding-right:.75rem}#fbjs .fb-px-4{padding-left:1rem;padding-right:1rem}#fbjs .fb-py-3{padding-bottom:.75rem;padding-top:.75rem}#fbjs .fb-py-6{padding-bottom:1.5rem;padding-top:1.5rem}#fbjs .fb-pr-4{padding-right:1rem}#fbjs .fb-pt-4{padding-top:1rem}#fbjs .fb-text-base{font-size:1rem;line-height:1.5rem}#fbjs .fb-text-sm{font-size:.875rem;line-height:1.25rem}#fbjs .fb-font-medium{font-weight:500}#fbjs .fb-font-normal{font-weight:400}#fbjs .fb-font-semibold{font-weight:600}#fbjs .fb-leading-4{line-height:1rem}#fbjs .fb-leading-6{line-height:1.5rem}#fbjs .fb-text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}#fbjs .fb-opacity-0{opacity:0}#fbjs .fb-opacity-100{opacity:1}#fbjs .fb-opacity-60{opacity:.6}#fbjs .fb-shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}#fbjs .fb-shadow-lg,#fbjs .fb-shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs .fb-shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}#fbjs .fb-ring-1{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs .fb-ring-black{--tw-ring-opacity:1;--tw-ring-color:rgb(0 0 0/var(--tw-ring-opacity))}#fbjs .fb-ring-opacity-5{--tw-ring-opacity:0.05}#fbjs .fb-transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs .fb-duration-500{transition-duration:.5s}#fbjs .fb-ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs .hover\\:fb-opacity-90:hover{opacity:.9}#fbjs .focus\\:fb-outline-none:focus{outline:2px solid transparent;outline-offset:2px}#fbjs .focus\\:fb-ring-0:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color)}#fbjs .focus\\:fb-ring-0:focus,#fbjs .focus\\:fb-ring-2:focus{box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs .focus\\:fb-ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color)}#fbjs .focus\\:fb-ring-offset-0:focus{--tw-ring-offset-width:0px}#fbjs .focus\\:fb-ring-offset-2:focus{--tw-ring-offset-width:2px}@media (min-width:640px){#fbjs .sm\\:fb-block{display:block}#fbjs .sm\\:fb-items-end{align-items:flex-end}#fbjs .sm\\:fb-p-6{padding:1.5rem}#fbjs .sm\\:fb-text-sm{font-size:.875rem;line-height:1.25rem}}',document.head.appendChild(e)}}();var n=function(){if(!Me||Me.get().environmentId!==e.environmentId||Me.get().apiHost!==e.apiHost)return Me.update({environmentId:e.environmentId,apiHost:e.apiHost}),Promise.resolve(Ee()).then(function(e){var t=e.settings;Me.update({person:e.person,session:qe(e.session),settings:t}),Pe("New Session")})}();return Promise.resolve(n&&n.then?n.then(t):t())}catch(e){return Promise.reject(e)}var r}(e),Promise.resolve()}catch(e){return Promise.reject(e)}})},setUserId:function(e){Je.add(function(){try{return We(),Promise.resolve(function(e){try{return Ce.debug("setting userId: "+e),Ne("userId",e)?(Ce.debug("userId already set to this value. Skipping update."),Promise.resolve()):(t=Se.get().person.attributes.find(function(e){var t;return"userId"===(null==(t=e.attributeClass)?void 0:t.name)}),t?(Ce.error("userId cannot be changed after it has been set. You need to reset first"),Promise.resolve()):Promise.resolve(function(e){try{return Se.get().person&&Se.get().person.id?Promise.resolve(fetch(Se.get().apiHost+"/api/v1/client/environments/"+Se.get().environmentId+"/people/"+Se.get().person.id+"/user-id",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,sessionId:Se.get().session.id})})).then(function(e){if(!e.ok)throw Ce.error("Formbricks: Error updating person"),Error("Error updating person");return Promise.resolve(e.json())}):(console.error("Formbricks: Unable to update userId. No person set."),Promise.resolve())}catch(e){return Promise.reject(e)}}(e)).then(function(e){Se.update({person:e.person,settings:e.settings})}))}catch(e){return Promise.reject(e)}var t}(e)).then(function(){})}catch(e){return Promise.reject(e)}})},setEmail:function(e){Be("email",e)},setAttribute:Be,track:function(e,t){void 0===t&&(t={}),Je.add(function(){try{return We(),Promise.resolve(Pe(e,t)).then(function(){})}catch(e){return Promise.reject(e)}})},logout:function(){Je.add(function(){try{return We(),Promise.resolve(function(){try{return Ce.debug("Resetting person. Getting new person, session and settings from backend"),Promise.resolve(Ee()).then(function(e){var t=e.person,n=e.session,r=e.settings;if(!t||!n||!r)throw Ce.error("Error resetting user"),new Error("Formbricks: Error resetting user");Se.update({person:t,session:n,settings:r})})}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}})},refresh:function(){Je.add(function(){try{return We(),Promise.resolve(function(){try{return pe.debug("Refreshing - getting settings from backend"),Promise.resolve(_e()).then(function(e){he.update({settings:e})})}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}})},registerRouteChange:function(){Je.add(function(){try{return We(),Ae(),Promise.resolve()}catch(e){return Promise.reject(e)}})}};return Re});
//# sourceMappingURL=index.umd.js.map
{
"name": "@formbricks/js",
"version": "0.1.0",
"version": "0.1.1",
"description": "",

@@ -5,0 +5,0 @@ "source": "src/index.ts",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc