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.10 to 0.1.11

dist/components/MultipleChoiceMultiQuestion.d.ts

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={},h=[],_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function g(e,t){for(var n in t)e[n]=t[n];return e}function v(e){var t=e.parentNode;t&&t.removeChild(e)}function m(e,t,n){var r,o,i,s={};for(i in t)"key"==i?r=t[i]:"ref"==i?o=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?a.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===s[i]&&(s[i]=e.defaultProps[i]);return w(e,s,r,o,null)}function w(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?++l:o};return null==o&&null!=f.vnode&&f.vnode(i),i}function y(e){return e.children}function j(e,t){this.props=e,this.context=t}function x(e,t){if(null==t)return e.__?x(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?x(e):null}function k(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 k(e)}}function P(e){(!e.__d&&(e.__d=!0)&&u.push(e)&&!C.__r++||c!==f.debounceRendering)&&((c=f.debounceRendering)||d)(C)}function C(){var e,t,n,r,o,i,s,a;for(u.sort(b);e=u.shift();)e.__d&&(t=u.length,r=void 0,o=void 0,s=(i=(n=e).__v).__e,(a=n.__P)&&(r=[],(o=g({},i)).__v=i.__v+1,L(a,i,o,n.__n,void 0!==a.ownerSVGElement,null!=i.__h?[s]:null,r,null==s?x(i):s,i.__h),F(r,i),i.__e!=s&&k(i)),u.length>t&&u.sort(b));C.__r=0}function S(e,t,n,r,o,i,s,a,f,l){var u,c,d,b,_,g,v,m=r&&r.__k||h,j=m.length;for(n.__k=[],u=0;u<t.length;u++)if(null!=(b=n.__k[u]=null==(b=t[u])||"boolean"==typeof b||"function"==typeof b?null:"string"==typeof b||"number"==typeof b||"bigint"==typeof b?w(null,b,null,null,b):Array.isArray(b)?w(y,{children:b},null,null,null):b.__b>0?w(b.type,b.props,b.key,b.ref?b.ref:null,b.__v):b)){if(b.__=n,b.__b=n.__b+1,null===(d=m[u])||d&&b.key==d.key&&b.type===d.type)m[u]=void 0;else for(c=0;c<j;c++){if((d=m[c])&&b.key==d.key&&b.type===d.type){m[c]=void 0;break}d=null}L(e,b,d=d||p,o,i,s,a,f,l),_=b.__e,(c=b.ref)&&d.ref!=c&&(v||(v=[]),d.ref&&v.push(d.ref,null,b),v.push(c,b.__c||_,b)),null!=_?(null==g&&(g=_),"function"==typeof b.type&&b.__k===d.__k?b.__d=f=I(b,f,e):f=E(e,b,d,m,_,f),"function"==typeof n.type&&(n.__d=f)):f&&d.__e==f&&f.parentNode!=e&&(f=x(d))}for(n.__e=g,u=j;u--;)null!=m[u]&&("function"==typeof n.type&&null!=m[u].__e&&m[u].__e==n.__d&&(n.__d=N(r).nextSibling),A(m[u],m[u]));if(v)for(u=0;u<v.length;u++)U(v[u],v[++u],v[++u])}function I(e,t,n){for(var r,o=e.__k,i=0;o&&i<o.length;i++)(r=o[i])&&(r.__=e,t="function"==typeof r.type?I(r,t,n):E(n,r,r,o,r.__e,t));return t}function E(e,t,n,r,o,i){var s,a,f;if(void 0!==t.__d)s=t.__d,t.__d=void 0;else if(null==n||o!=i||null==o.parentNode)e:if(null==i||i.parentNode!==e)e.appendChild(o),s=null;else{for(a=i,f=0;(a=a.nextSibling)&&f<r.length;f+=1)if(a==o)break e;e.insertBefore(o,i),s=i}return void 0!==s?s:o.nextSibling}function N(e){var t,n,r;if(null==e.type||"string"==typeof e.type)return e.__e;if(e.__k)for(t=e.__k.length-1;t>=0;t--)if((n=e.__k[t])&&(r=N(n)))return r;return null}function H(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||_.test(t)?n:n+"px"}function T(e,t,n,r,o){var i;e:if("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||H(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||H(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])i=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r||e.addEventListener(t,i?z:q,i):e.removeEventListener(t,i?z:q,i);else if("dangerouslySetInnerHTML"!==t){if(o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function q(e){return this.l[e.type+!1](f.event?f.event(e):e)}function z(e){return this.l[e.type+!0](f.event?f.event(e):e)}function L(e,t,n,r,o,i,s,a,l){var u,c,d,b,p,h,_,v,m,w,x,k,P,C,I,E=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(l=n.__h,a=t.__e=n.__e,t.__h=null,i=[a]),(u=f.__b)&&u(t);try{e:if("function"==typeof E){if(v=t.props,m=(u=E.contextType)&&r[u.__c],w=u?m?m.props.value:u.__:r,n.__c?_=(c=t.__c=n.__c).__=c.__E:("prototype"in E&&E.prototype.render?t.__c=c=new E(v,w):(t.__c=c=new j(v,w),c.constructor=E,c.render=M),m&&m.sub(c),c.props=v,c.state||(c.state={}),c.context=w,c.__n=r,d=c.__d=!0,c.__h=[],c._sb=[]),null==c.__s&&(c.__s=c.state),null!=E.getDerivedStateFromProps&&(c.__s==c.state&&(c.__s=g({},c.__s)),g(c.__s,E.getDerivedStateFromProps(v,c.__s))),b=c.props,p=c.state,c.__v=t,d)null==E.getDerivedStateFromProps&&null!=c.componentWillMount&&c.componentWillMount(),null!=c.componentDidMount&&c.__h.push(c.componentDidMount);else{if(null==E.getDerivedStateFromProps&&v!==b&&null!=c.componentWillReceiveProps&&c.componentWillReceiveProps(v,w),!c.__e&&null!=c.shouldComponentUpdate&&!1===c.shouldComponentUpdate(v,c.__s,w)||t.__v===n.__v){for(t.__v!==n.__v&&(c.props=v,c.state=c.__s,c.__d=!1),c.__e=!1,t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(e){e&&(e.__=t)}),x=0;x<c._sb.length;x++)c.__h.push(c._sb[x]);c._sb=[],c.__h.length&&s.push(c);break e}null!=c.componentWillUpdate&&c.componentWillUpdate(v,c.__s,w),null!=c.componentDidUpdate&&c.__h.push(function(){c.componentDidUpdate(b,p,h)})}if(c.context=w,c.props=v,c.__P=e,k=f.__r,P=0,"prototype"in E&&E.prototype.render){for(c.state=c.__s,c.__d=!1,k&&k(t),u=c.render(c.props,c.state,c.context),C=0;C<c._sb.length;C++)c.__h.push(c._sb[C]);c._sb=[]}else do{c.__d=!1,k&&k(t),u=c.render(c.props,c.state,c.context),c.state=c.__s}while(c.__d&&++P<25);c.state=c.__s,null!=c.getChildContext&&(r=g(g({},r),c.getChildContext())),d||null==c.getSnapshotBeforeUpdate||(h=c.getSnapshotBeforeUpdate(b,p)),I=null!=u&&u.type===y&&null==u.key?u.props.children:u,S(e,Array.isArray(I)?I:[I],t,n,r,o,i,s,a,l),c.base=t.__e,t.__h=null,c.__h.length&&s.push(c),_&&(c.__E=c.__=null),c.__e=!1}else null==i&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=O(n.__e,t,n,r,o,i,s,l);(u=f.diffed)&&u(t)}catch(e){t.__v=null,(l||null!=i)&&(t.__e=a,t.__h=!!l,i[i.indexOf(a)]=null),f.__e(e,t,n)}}function F(e,t){f.__c&&f.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){f.__e(e,t.__v)}})}function O(e,t,n,r,o,i,s,f){var l,u,c,d=n.props,b=t.props,h=t.type,_=0;if("svg"===h&&(o=!0),null!=i)for(;_<i.length;_++)if((l=i[_])&&"setAttribute"in l==!!h&&(h?l.localName===h:3===l.nodeType)){e=l,i[_]=null;break}if(null==e){if(null===h)return document.createTextNode(b);e=o?document.createElementNS("http://www.w3.org/2000/svg",h):document.createElement(h,b.is&&b),i=null,f=!1}if(null===h)d===b||f&&e.data===b||(e.data=b);else{if(i=i&&a.call(e.childNodes),u=(d=n.props||p).dangerouslySetInnerHTML,c=b.dangerouslySetInnerHTML,!f){if(null!=i)for(d={},_=0;_<e.attributes.length;_++)d[e.attributes[_].name]=e.attributes[_].value;(c||u)&&(c&&(u&&c.__html==u.__html||c.__html===e.innerHTML)||(e.innerHTML=c&&c.__html||""))}if(function(e,t,n,r,o){var i;for(i in n)"children"===i||"key"===i||i in t||T(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]||T(e,i,t[i],n[i],r)}(e,b,d,o,f),c)t.__k=[];else if(_=t.props.children,S(e,Array.isArray(_)?_:[_],t,n,r,o&&"foreignObject"!==h,i,s,i?i[0]:n.__k&&x(n,0),f),null!=i)for(_=i.length;_--;)null!=i[_]&&v(i[_]);f||("value"in b&&void 0!==(_=b.value)&&(_!==e.value||"progress"===h&&!_||"option"===h&&_!==d.value)&&T(e,"value",_,d.value,!1),"checked"in b&&void 0!==(_=b.checked)&&_!==e.checked&&T(e,"checked",_,d.checked,!1))}return e}function U(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){f.__e(e,n)}}function A(e,t,n){var r,o;if(f.unmount&&f.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||U(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){f.__e(e,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&A(r[o],t,n||"function"!=typeof e.type);n||null==e.__e||v(e.__e),e.__=e.__e=e.__d=void 0}function M(e,t,n){return this.constructor(e,n)}a=h.slice,f={__e:function(e,t,n,r){for(var o,i,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&null!=i.getDerivedStateFromError&&(o.setState(i.getDerivedStateFromError(e)),s=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,r||{}),s=o.__d),s)return o.__E=o}catch(t){e=t}throw e}},l=0,j.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=g({},this.state),"function"==typeof e&&(e=e(g({},n),this.props)),e&&g(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),P(this))},j.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),P(this))},j.prototype.render=y,u=[],d="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,b=function(e,t){return e.__v.__b-t.__v.__b},C.__r=0;var D,W,B,J,Y=0,R=[],V=[],Q=f.__b,X=f.__r,$=f.diffed,G=f.__c,K=f.unmount;function Z(e,t){f.__h&&f.__h(W,e,Y||t),Y=0;var n=W.__H||(W.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:V}),n.__[e]}function ee(e){return Y=1,function(e,t,n){var r=Z(D++,2);if(r.t=e,!r.__c&&(r.__=[ae(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=W,!W.u)){var o=function(e,t,n){if(!r.__c.__H)return!0;var o=r.__c.__H.__.filter(function(e){return e.__c});if(o.every(function(e){return!e.__N}))return!i||i.call(this,e,t,n);var s=!1;return o.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}}),!(!s&&r.__c.props===e)&&(!i||i.call(this,e,t,n))};W.u=!0;var i=W.shouldComponentUpdate,s=W.componentWillUpdate;W.componentWillUpdate=function(e,t,n){if(this.__e){var r=i;i=void 0,o(e,t,n),i=r}s&&s.call(this,e,t,n)},W.shouldComponentUpdate=o}return r.__N||r.__}(ae,e)}function te(e,t){var n=Z(D++,3);!f.__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.i=t,W.__H.__h.push(n))}function ne(){for(var e;e=R.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ie),e.__H.__h.forEach(se),e.__H.__h=[]}catch(t){e.__H.__h=[],f.__e(t,e.__v)}}f.__b=function(e){W=null,Q&&Q(e)},f.__r=function(e){X&&X(e),D=0;var t=(W=e.__c).__H;t&&(B===W?(t.__h=[],W.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.__V=V,e.__N=e.i=void 0})):(t.__h.forEach(ie),t.__h.forEach(se),t.__h=[])),B=W},f.diffed=function(e){$&&$(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==R.push(t)&&J===f.requestAnimationFrame||((J=f.requestAnimationFrame)||oe)(ne)),t.__H.__.forEach(function(e){e.i&&(e.__H=e.i),e.__V!==V&&(e.__=e.__V),e.i=void 0,e.__V=V})),B=W=null},f.__c=function(e,t){t.some(function(e){try{e.__h.forEach(ie),e.__h=e.__h.filter(function(e){return!e.__||se(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],f.__e(n,e.__v)}}),G&&G(e,t)},f.unmount=function(e){K&&K(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{ie(e)}catch(e){t=e}}),n.__H=void 0,t&&f.__e(t,n.__v))};var re="function"==typeof requestAnimationFrame;function oe(e){var t,n=function(){clearTimeout(r),re&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);re&&(t=requestAnimationFrame(n))}function ie(e){var t=W,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),W=t}function se(e){var t=W;e.__c=e.__(),W=t}function ae(e,t){return"function"==typeof t?t(e):t}var fe=function(){return[].slice.call(arguments).filter(Boolean).join(" ")};function le(e){var t=e.children,n=e.isOpen,r=e.close,o=ee(!1),i=o[0],s=o[1];return te(function(){s(n)},[n]),m("div",{"aria-live":"assertive",className:"fb-pointer-events-none fb-fixed fb-inset-0 fb-flex fb-items-end"},m("div",{className:"fb-flex fb-w-full fb-flex-col fb-items-center fb-space-y-4 sm:fb-items-end"},m("div",{className:fe(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 fb-z-40")},m("div",{class:"fb-absolute fb-top-0 fb-right-0 fb-hidden fb-pt-4 fb-pr-4 sm:fb-block"},m("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 fb-text-slate-400 hover:fb-text-slate-500 focus:ring-slate-500"},m("span",{class:"fb-sr-only"},"Close"),m("svg",{class:"fb-h-6 fb-w-6",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})))),m("div",{className:""},t))))}var ue=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)}},ce=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 de(e){return m("label",{htmlFor:e.questionId,className:"fb-mb-1.5 fb-block fb-text-base fb-font-semibold fb-leading-6 fb-mr-8 text-slate-900",style:e.style},e.headline)}function be(e){return m("label",{for:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600"},e.subheader)}function pe(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return m("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)}},m(de,{headline:t.headline,questionId:t.id}),m(be,{subheader:t.subheader,questionId:t.id}),m("div",{className:"fb-mt-4"},m("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 fb-bg-slate-50 fb-border-slate-100 focus:fb-border-slate-500"})),m("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},m("div",null),m("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:fb-ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function he(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ee(null),s=i[0],a=i[1];return m("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)}},m(de,{headline:t.headline,questionId:t.id}),m(be,{subheader:t.subheader,questionId:t.id}),m("div",{className:"fb-mt-4"},m("fieldset",null,m("legend",{className:"fb-sr-only"},"Choices"),m("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e,n){return m("label",{key:e.id,className:fe(s===e.label?"fb-z-10 fb-bg-slate-50 fb-border-slate-400":"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")},m("span",{className:"fb-flex fb-items-center fb-text-sm"},m("input",{type:"radio",id:e.id,name:t.id,value:e.label,className:"fb-h-4 fb-w-4 fb-border fb-border-slate-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},required:t.required&&0===n}),m("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),m("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},m("div",null),m("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 _e(e){return m("div",{className:"fb-h-1 fb-w-full fb-rounded-full bg-slate-200"},m("div",{className:"fb-h-1 fb-rounded-full",style:{backgroundColor:e.brandColor,width:Math.floor(100*e.progress)+"%"}}))}function ge(e){var t=e.headline,n=e.subheader;return m("div",{className:"fb-text-center"},m("div",{className:"fb-flex fb-items-center fb-justify-center",style:{color:e.brandColor}},m("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"fb-h-24 fb-w-24"},m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))),m("span",{className:"fb-inline-block fb-rounded-[100%] fb-w-16 fb-h-1 fb-mb-[10px] fb-bg-slate-300"}),m("div",null,m(de,{headline:t,questionId:"thankYouCard",style:{"margin-right":0}}),m(be,{subheader:n,questionId:"thankYouCard"})))}function ve(e){var t,n=e.config,r=e.survey,o=e.close,i=e.brandColor,s=ee(r.questions[0]),a=s[0],f=s[1],l=ee(0),u=l[0],c=l[1],d=ee(null),b=d[0],p=d[1],h=ee(null),_=h[0],g=h[1],v=ee(!1),w=v[0],y=v[1];te(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:r.id,personId:n.person.id},n)).then(function(e){g(e.id)})}catch(e){return Promise.reject(e)}}()},[n,r]),te(function(){var e;c((e=r.questions.findIndex(function(e){return e.id===a.id}),e/r.questions.length))},[a,r]);var j=function(e){try{var t=function(){y(!1),s?(c(100),r.thankYouCard.enabled?setTimeout(function(){o()},2e3):o()):f(r.questions[i+1])};y(!0);var i=r.questions.findIndex(function(e){return e.id===a.id}),s=i===r.questions.length-1,l={surveyId:r.id,personId:n.person.id,response:{finished:s,data:e}},u=b?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,b,n)).then(function(){}):Promise.resolve(Promise.all([ce(l,n),ue(_,n)])).then(function(e){p(e[0].id)});return Promise.resolve(u&&u.then?u.then(t):t())}catch(e){return Promise.reject(e)}};return m("div",null,m("div",{className:fe(w?"fb-animate-pulse fb-opacity-60":"","fb-text-slate-800 fb-font-sans fb-px-4 fb-py-6 sm:fb-p-6")},100===u&&r.thankYouCard.enabled?m(ge,{headline:r.thankYouCard.headline,subheader:r.thankYouCard.subheader,brandColor:null==(t=n.settings)?void 0:t.brandColor}):"multipleChoiceSingle"===a.type?m(he,{question:a,onSubmit:j,lastQuestion:r.questions.findIndex(function(e){return e.id===a.id})===r.questions.length-1,brandColor:i}):"openText"===a.type?m(pe,{question:a,onSubmit:j,lastQuestion:r.questions.findIndex(function(e){return e.id===a.id})===r.questions.length-1,brandColor:i}):null),m(_e,{progress:u,brandColor:i}))}function me(e){var t,n=e.config,r=e.survey,o=e.closeSurvey,i=ee(!0),s=i[1],a=function(){s(!1),setTimeout(function(){o()},1e3)};return m("div",{id:"fbjs"},m(le,{isOpen:i[0],close:a},m(ve,{config:n,survey:r,close:a,brandColor:null==(t=n.settings)?void 0:t.brandColor})))}var we=/*#__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}();we.instance=void 0;var ye=/*#__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}();ye.instance=void 0;var je=ye.getInstance(),xe=we.getInstance(),ke=function(){try{return Promise.resolve(fetch(xe.get().apiHost+"/api/v1/client/environments/"+xe.get().environmentId+"/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:xe.get().person.id})})).then(function(e){if(!e.ok)throw je.error("Error getting settings"),Error("Error getting settings");return e.json()})}catch(e){return Promise.reject(e)}},Pe="formbricks-web-container",Ce=we.getInstance(),Se=ye.getInstance(),Ie=!1,Ee=function(e){Ie?Se.debug("A survey is already running. Skipping."):(Ie=!0,function(e,t,n){var r,o;f.__&&f.__(e,t),r=t.__k,o=[],L(t,e=t.__k=m(y,null,[e]),r||p,p,void 0!==t.ownerSVGElement,r?null:t.firstChild?a.call(t.childNodes):null,o,r?r.__e:t.firstChild,!1),F(o,e)}(m(me,{config:Ce.get(),survey:e,closeSurvey:Ne}),document.getElementById(Pe)))},Ne=function(){try{return document.getElementById(Pe).remove(),He(),Promise.resolve(ke()).then(function(e){Ce.update({settings:e}),Ie=!1})}catch(e){return Promise.reject(e)}},He=function(){var e=document.createElement("div");e.id=Pe,document.body.appendChild(e)},Te=ye.getInstance(),qe=we.getInstance(),ze=function(e,t){try{return Promise.resolve(fetch(qe.get().apiHost+"/api/v1/client/environments/"+qe.get().environmentId+"/events",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:qe.get().session.id,eventName:e,properties:t})})).then(function(t){var n;function r(t){if(n)return t;Te.debug('Formbricks: Event "'+e+'" tracked'),Le(e)}var o=function(){if(!t.ok)return Promise.resolve(t.json()).then(function(e){Te.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)}},Le=function(e){for(var t,n=s(null==(r=qe.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 Te.debug("Formbricks: survey "+i.id+' triggered by event "'+e+'"'),void Ee(i)}},Fe=we.getInstance(),Oe=ye.getInstance(),Ue=function(){try{return Oe.debug("Creating new person"),Promise.resolve(fetch(Fe.get().apiHost+"/api/v1/client/environments/"+Fe.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)}},Ae=function(e,t){var n=Fe.get().person.attributes.find(function(t){var n;return(null==(n=t.attributeClass)?void 0:n.name)===e});return!(!n||n.value!==t)},Me=ye.getInstance(),De=we.getInstance(),We=function(){try{return De.get().person?Promise.resolve(fetch(De.get().apiHost+"/api/v1/client/environments/"+De.get().environmentId+"/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:De.get().person.id})})).then(function(e){if(e.ok)return Promise.resolve(e.json());Me.error("Error creating session")}):(Me.error("Formbricks: Unable to create session. No person found"),Promise.resolve())}catch(e){return Promise.reject(e)}},Be=function(e){Me.debug("Session expired. Creating new session.");var t=o({},e);return t.expiresAt=Date.now()+36e5,t},Je=function(e){return e.expiresAt<=Date.now()},Ye=we.getInstance(),Re=ye.getInstance(),Ve=function(){var e=Ye.get().settings,t=null==e?void 0:e.noCodeEvents.filter(function(e){var t;return"pageUrl"===(null==(t=e.noCodeConfig)?void 0:t.type)});if(Re.debug("checking page url"),0!==t.length)for(var n,r=s(t);!(n=r()).done;){var o=n.value,i=o.noCodeConfig.pageUrl;i&&Qe(window.location.href,i.value,i.rule)&&ze(o.name)}};function Qe(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 Xe=function(e){var t=Ye.get().settings,n=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"innerHtml"===(null==(t=e.noCodeConfig)?void 0:t.type)}),r=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"cssSelector"===(null==(t=e.noCodeConfig)?void 0:t.type)}),o=e.target;n.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.innerHtml;n&&o.innerHTML===n.value&&ze(e.name)}),r.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.cssSelector;n&&o.matches(n.value)&&ze(e.name)})},$e=we.getInstance(),Ge=ye.getInstance(),Ke=function(){if(!($e.get().apiHost&&$e.get().environmentId&&$e.get().person&&$e.get().session&&$e.get().settings))throw Error("Formbricks: Formbricks not initialized. Call initialize() first.")},Ze=new r,et=function(e,t){Ze.add(function(){try{return Ke(),Promise.resolve(function(e,t){try{return Oe.debug("setting attribute: "+e+" to value: "+t),Ae(e,t)?(Oe.debug("attribute already set to this value. Skipping update."),Promise.resolve()):Promise.resolve(function(e,t){try{return Fe.get().person&&Fe.get().person.id?Promise.resolve(fetch(Fe.get().apiHost+"/api/v1/client/environments/"+Fe.get().environmentId+"/people/"+Fe.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 Oe.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 Oe.error("Error updating attribute"),new Error("Formbricks: Error updating attribute");Fe.update({person:t,settings:n})})}catch(e){return Promise.reject(e)}}(e,t)).then(function(){})}catch(e){return Promise.reject(e)}})},tt={init:function(e){Ze.add(function(){try{return function(e){try{var t,n=function(e){if(t)return e;(function(){if("undefined"!=typeof window){var e=window.setInterval(function(){try{return Promise.resolve(function(){try{var e=function(e){Me.debug("Session not expired, extending session"),De.update({session:Be(De.get().session)})};Me.debug("Checking session");var t=function(){if(Je(De.get().session))return Me.debug("Session expired, creating new session"),Promise.resolve(We()).then(function(e){var t=e.session,n=e.settings;if(!t||!n)throw Me.error("Error creating new session"),Error("Error creating new session");De.update({session:t,settings:n}),ze("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",Ve),window.addEventListener("popstate",Ve),window.addEventListener("pushstate",Ve),window.addEventListener("replacestate",Ve),window.addEventListener("load",Ve)),"undefined"!=typeof window&&document.addEventListener("click",Xe),Ge.debug("Initialized")};if(!e.environmentId)throw Error("Formbricks: environmentId is required");if(!e.apiHost)throw Error("Formbricks: apiHost is required");e.logLevel&&Ge.configure({logLevel:e.logLevel}),He(),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 :is(.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 :is(.fb-pointer-events-none){pointer-events:none}#fbjs :is(.fb-pointer-events-auto){pointer-events:auto}#fbjs :is(.fb-fixed){position:fixed}#fbjs :is(.fb-absolute){position:absolute}#fbjs :is(.fb-relative){position:relative}#fbjs :is(.fb-inset-0){inset:0}#fbjs :is(.fb-right-0){right:0}#fbjs :is(.fb-top-0){top:0}#fbjs :is(.fb-z-10){z-index:10}#fbjs :is(.fb-mb-\\[10px\\]){margin-bottom:10px}#fbjs :is(.fb-ml-3){margin-left:.75rem}#fbjs :is(.fb-mr-8){margin-right:2rem}#fbjs :is(.fb-mt-2){margin-top:.5rem}#fbjs :is(.fb-mt-4){margin-top:1rem}#fbjs :is(.fb-mt-\\[35px\\]){margin-top:35px}#fbjs :is(.fb-block){display:block}#fbjs :is(.fb-inline-block){display:inline-block}#fbjs :is(.fb-flex){display:flex}#fbjs :is(.fb-hidden){display:none}#fbjs :is(.fb-h-1){height:.25rem}#fbjs :is(.fb-h-24){height:6rem}#fbjs :is(.fb-h-4){height:1rem}#fbjs :is(.fb-h-6){height:1.5rem}#fbjs :is(.fb-h-\\[2px\\]){height:2px}#fbjs :is(.fb-w-16){width:4rem}#fbjs :is(.fb-w-24){width:6rem}#fbjs :is(.fb-w-4){width:1rem}#fbjs :is(.fb-w-4\\/5){width:80%}#fbjs :is(.fb-w-6){width:1.5rem}#fbjs :is(.fb-w-full){width:100%}#fbjs :is(.fb-max-w-sm){max-width:24rem}#fbjs :is(.fb-translate-x-0){--tw-translate-x:0px;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 :is(.fb-translate-x-28){--tw-translate-x:7rem;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))}@keyframes fb-pulse{50%{opacity:.5}}#fbjs :is(.fb-animate-pulse){animation:fb-pulse 2s cubic-bezier(.4,0,.6,1) infinite}#fbjs :is(.fb-cursor-pointer){cursor:pointer}#fbjs :is(.fb-flex-col){flex-direction:column}#fbjs :is(.fb-items-end){align-items:flex-end}#fbjs :is(.fb-items-center){align-items:center}#fbjs :is(.fb-justify-center){justify-content:center}#fbjs :is(.fb-justify-between){justify-content:space-between}#fbjs :is(.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 :is(.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 :is(.fb-overflow-hidden){overflow:hidden}#fbjs :is(.fb-rounded-\\[100\\%\\]){border-radius:100%}#fbjs :is(.fb-rounded-full){border-radius:9999px}#fbjs :is(.fb-rounded-lg){border-radius:.5rem}#fbjs :is(.fb-rounded-md){border-radius:.375rem}#fbjs :is(.fb-border){border-width:1px}#fbjs :is(.fb-border-gray-200){--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-100){--tw-border-opacity:1;border-color:rgb(241 245 249/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-300){--tw-border-opacity:1;border-color:rgb(203 213 225/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-400){--tw-border-opacity:1;border-color:rgb(148 163 184/var(--tw-border-opacity))}#fbjs :is(.fb-border-transparent){border-color:transparent}#fbjs :is(.fb-bg-slate-300){--tw-bg-opacity:1;background-color:rgb(203 213 225/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-slate-50){--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-white){--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}#fbjs :is(.fb-p-2){padding:.5rem}#fbjs :is(.fb-p-4){padding:1rem}#fbjs :is(.fb-px-3){padding-left:.75rem;padding-right:.75rem}#fbjs :is(.fb-px-4){padding-left:1rem;padding-right:1rem}#fbjs :is(.fb-py-3){padding-bottom:.75rem;padding-top:.75rem}#fbjs :is(.fb-py-6){padding-bottom:1.5rem;padding-top:1.5rem}#fbjs :is(.fb-pr-4){padding-right:1rem}#fbjs :is(.fb-pt-4){padding-top:1rem}#fbjs :is(.fb-text-center){text-align:center}#fbjs :is(.fb-font-sans){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}#fbjs :is(.fb-text-base){font-size:1rem;line-height:1.5rem}#fbjs :is(.fb-text-sm){font-size:.875rem;line-height:1.25rem}#fbjs :is(.fb-text-xs){font-size:.75rem;line-height:1rem}#fbjs :is(.fb-font-medium){font-weight:500}#fbjs :is(.fb-font-normal){font-weight:400}#fbjs :is(.fb-font-semibold){font-weight:600}#fbjs :is(.fb-leading-4){line-height:1rem}#fbjs :is(.fb-leading-6){line-height:1.5rem}#fbjs :is(.fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-500){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-800){--tw-text-opacity:1;color:rgb(30 41 59/var(--tw-text-opacity))}#fbjs :is(.fb-text-white){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}#fbjs :is(.fb-opacity-0){opacity:0}#fbjs :is(.fb-opacity-100){opacity:1}#fbjs :is(.fb-opacity-60){opacity:.6}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.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 :is(.fb-ring-black){--tw-ring-opacity:1;--tw-ring-color:rgb(0 0 0/var(--tw-ring-opacity))}#fbjs :is(.fb-ring-opacity-5){--tw-ring-opacity:0.05}#fbjs :is(.fb-transition-all){transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.fb-duration-500){transition-duration:.5s}#fbjs :is(.fb-ease-in-out){transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.hover\\:fb-text-slate-500:hover){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.hover\\:fb-opacity-90:hover){opacity:.9}#fbjs :is(.focus\\:fb-border-slate-500:focus){--tw-border-opacity:1;border-color:rgb(100 116 139/var(--tw-border-opacity))}#fbjs :is(.focus\\:fb-outline-none:focus){outline:2px solid transparent;outline-offset:2px}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.focus\\:fb-ring-slate-500:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(100 116 139/var(--tw-ring-opacity))}#fbjs :is(.focus\\:fb-ring-offset-0:focus){--tw-ring-offset-width:0px}#fbjs :is(.focus\\:fb-ring-offset-2:focus){--tw-ring-offset-width:2px}@media (min-width:640px){#fbjs :is(.sm\\:fb-block){display:block}#fbjs :is(.sm\\:fb-items-end){align-items:flex-end}#fbjs :is(.sm\\:fb-p-6){padding:1.5rem}#fbjs :is(.sm\\:fb-text-sm){font-size:.875rem;line-height:1.25rem}}',document.head.appendChild(e)}}();var r=$e&&$e.get().environmentId===e.environmentId&&$e.get().apiHost===e.apiHost?$e.get().session&&Je($e.get().session)?Promise.resolve(We()).then(function(e){var t=e.settings;$e.update({session:Be(e.session),settings:t}),ze("New Session")}):$e.get().session?void 0:(Ge.error("Unable to initialize. No session found"),void(t=1)):($e.update({environmentId:e.environmentId,apiHost:e.apiHost}),Promise.resolve(Ue()).then(function(e){var t=e.settings;$e.update({person:e.person,session:Be(e.session),settings:t}),ze("New Session")}));Promise.resolve(r&&r.then?r.then(n):n(r))}catch(e){return Promise.reject(e)}}(e),Promise.resolve()}catch(e){return Promise.reject(e)}})},setUserId:function(e){Ze.add(function(){try{return Ke(),Promise.resolve(function(e){try{return Oe.debug("setting userId: "+e),Ae("userId",e)?(Oe.debug("userId already set to this value. Skipping update."),Promise.resolve()):(t=Fe.get().person.attributes.find(function(e){var t;return"userId"===(null==(t=e.attributeClass)?void 0:t.name)}),t?(Oe.error("userId cannot be changed after it has been set. You need to reset first"),Promise.resolve()):Promise.resolve(function(e){try{return Fe.get().person&&Fe.get().person.id?Promise.resolve(fetch(Fe.get().apiHost+"/api/v1/client/environments/"+Fe.get().environmentId+"/people/"+Fe.get().person.id+"/user-id",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,sessionId:Fe.get().session.id})})).then(function(e){if(!e.ok)throw Oe.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){Fe.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){et("email",e)},setAttribute:et,track:function(e,t){void 0===t&&(t={}),Ze.add(function(){try{return Ke(),Promise.resolve(ze(e,t)).then(function(){})}catch(e){return Promise.reject(e)}})},logout:function(){Ze.add(function(){try{return Ke(),Promise.resolve(function(){try{return Oe.debug("Resetting person. Getting new person, session and settings from backend"),Promise.resolve(Ue()).then(function(e){var t=e.person,n=e.session,r=e.settings;if(!t||!n||!r)throw Oe.error("Error resetting user"),new Error("Formbricks: Error resetting user");Fe.update({person:t,session:n,settings:r})})}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}})},refresh:function(){Ze.add(function(){try{return Ke(),Promise.resolve(function(){try{return je.debug("Refreshing - getting settings from backend"),Promise.resolve(ke()).then(function(e){xe.update({settings:e})})}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}})},registerRouteChange:function(){Ze.add(function(){try{return Ke(),Ve(),Promise.resolve()}catch(e){return Promise.reject(e)}})}};module.exports=tt;
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(b):1===s?f.then(c):(void 0).then(function(){(a=r())?a.then?a.then(b).then(void 0,u):b(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(b).then(void 0,u);n(f=i())&&(f=f.v)}while(!f||!f.then);f.then(c).then(void 0,u)}function b(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,b,d,p={},h=[],_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function g(e,t){for(var n in t)e[n]=t[n];return e}function m(e){var t=e.parentNode;t&&t.removeChild(e)}function v(e,t,n){var r,o,i,s={};for(i in t)"key"==i?r=t[i]:"ref"==i?o=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?a.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===s[i]&&(s[i]=e.defaultProps[i]);return w(e,s,r,o,null)}function w(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?++l:o};return null==o&&null!=f.vnode&&f.vnode(i),i}function y(e){return e.children}function j(e,t){this.props=e,this.context=t}function x(e,t){if(null==t)return e.__?x(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?x(e):null}function k(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 k(e)}}function C(e){(!e.__d&&(e.__d=!0)&&u.push(e)&&!P.__r++||c!==f.debounceRendering)&&((c=f.debounceRendering)||b)(P)}function P(){var e,t,n,r,o,i,s,a;for(u.sort(d);e=u.shift();)e.__d&&(t=u.length,r=void 0,o=void 0,s=(i=(n=e).__v).__e,(a=n.__P)&&(r=[],(o=g({},i)).__v=i.__v+1,L(a,i,o,n.__n,void 0!==a.ownerSVGElement,null!=i.__h?[s]:null,r,null==s?x(i):s,i.__h),F(r,i),i.__e!=s&&k(i)),u.length>t&&u.sort(d));P.__r=0}function N(e,t,n,r,o,i,s,a,f,l){var u,c,b,d,_,g,m,v=r&&r.__k||h,j=v.length;for(n.__k=[],u=0;u<t.length;u++)if(null!=(d=n.__k[u]=null==(d=t[u])||"boolean"==typeof d||"function"==typeof d?null:"string"==typeof d||"number"==typeof d||"bigint"==typeof d?w(null,d,null,null,d):Array.isArray(d)?w(y,{children:d},null,null,null):d.__b>0?w(d.type,d.props,d.key,d.ref?d.ref:null,d.__v):d)){if(d.__=n,d.__b=n.__b+1,null===(b=v[u])||b&&d.key==b.key&&d.type===b.type)v[u]=void 0;else for(c=0;c<j;c++){if((b=v[c])&&d.key==b.key&&d.type===b.type){v[c]=void 0;break}b=null}L(e,d,b=b||p,o,i,s,a,f,l),_=d.__e,(c=d.ref)&&b.ref!=c&&(m||(m=[]),b.ref&&m.push(b.ref,null,d),m.push(c,d.__c||_,d)),null!=_?(null==g&&(g=_),"function"==typeof d.type&&d.__k===b.__k?d.__d=f=S(d,f,e):f=I(e,d,b,v,_,f),"function"==typeof n.type&&(n.__d=f)):f&&b.__e==f&&f.parentNode!=e&&(f=x(b))}for(n.__e=g,u=j;u--;)null!=v[u]&&("function"==typeof n.type&&null!=v[u].__e&&v[u].__e==n.__d&&(n.__d=E(r).nextSibling),A(v[u],v[u]));if(m)for(u=0;u<m.length;u++)U(m[u],m[++u],m[++u])}function S(e,t,n){for(var r,o=e.__k,i=0;o&&i<o.length;i++)(r=o[i])&&(r.__=e,t="function"==typeof r.type?S(r,t,n):I(n,r,r,o,r.__e,t));return t}function I(e,t,n,r,o,i){var s,a,f;if(void 0!==t.__d)s=t.__d,t.__d=void 0;else if(null==n||o!=i||null==o.parentNode)e:if(null==i||i.parentNode!==e)e.appendChild(o),s=null;else{for(a=i,f=0;(a=a.nextSibling)&&f<r.length;f+=1)if(a==o)break e;e.insertBefore(o,i),s=i}return void 0!==s?s:o.nextSibling}function E(e){var t,n,r;if(null==e.type||"string"==typeof e.type)return e.__e;if(e.__k)for(t=e.__k.length-1;t>=0;t--)if((n=e.__k[t])&&(r=E(n)))return r;return null}function q(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||_.test(t)?n:n+"px"}function H(e,t,n,r,o){var i;e:if("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||q(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||q(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])i=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r||e.addEventListener(t,i?z:T,i):e.removeEventListener(t,i?z:T,i);else if("dangerouslySetInnerHTML"!==t){if(o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function T(e){return this.l[e.type+!1](f.event?f.event(e):e)}function z(e){return this.l[e.type+!0](f.event?f.event(e):e)}function L(e,t,n,r,o,i,s,a,l){var u,c,b,d,p,h,_,m,v,w,x,k,C,P,S,I=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(l=n.__h,a=t.__e=n.__e,t.__h=null,i=[a]),(u=f.__b)&&u(t);try{e:if("function"==typeof I){if(m=t.props,v=(u=I.contextType)&&r[u.__c],w=u?v?v.props.value:u.__:r,n.__c?_=(c=t.__c=n.__c).__=c.__E:("prototype"in I&&I.prototype.render?t.__c=c=new I(m,w):(t.__c=c=new j(m,w),c.constructor=I,c.render=M),v&&v.sub(c),c.props=m,c.state||(c.state={}),c.context=w,c.__n=r,b=c.__d=!0,c.__h=[],c._sb=[]),null==c.__s&&(c.__s=c.state),null!=I.getDerivedStateFromProps&&(c.__s==c.state&&(c.__s=g({},c.__s)),g(c.__s,I.getDerivedStateFromProps(m,c.__s))),d=c.props,p=c.state,c.__v=t,b)null==I.getDerivedStateFromProps&&null!=c.componentWillMount&&c.componentWillMount(),null!=c.componentDidMount&&c.__h.push(c.componentDidMount);else{if(null==I.getDerivedStateFromProps&&m!==d&&null!=c.componentWillReceiveProps&&c.componentWillReceiveProps(m,w),!c.__e&&null!=c.shouldComponentUpdate&&!1===c.shouldComponentUpdate(m,c.__s,w)||t.__v===n.__v){for(t.__v!==n.__v&&(c.props=m,c.state=c.__s,c.__d=!1),c.__e=!1,t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(e){e&&(e.__=t)}),x=0;x<c._sb.length;x++)c.__h.push(c._sb[x]);c._sb=[],c.__h.length&&s.push(c);break e}null!=c.componentWillUpdate&&c.componentWillUpdate(m,c.__s,w),null!=c.componentDidUpdate&&c.__h.push(function(){c.componentDidUpdate(d,p,h)})}if(c.context=w,c.props=m,c.__P=e,k=f.__r,C=0,"prototype"in I&&I.prototype.render){for(c.state=c.__s,c.__d=!1,k&&k(t),u=c.render(c.props,c.state,c.context),P=0;P<c._sb.length;P++)c.__h.push(c._sb[P]);c._sb=[]}else do{c.__d=!1,k&&k(t),u=c.render(c.props,c.state,c.context),c.state=c.__s}while(c.__d&&++C<25);c.state=c.__s,null!=c.getChildContext&&(r=g(g({},r),c.getChildContext())),b||null==c.getSnapshotBeforeUpdate||(h=c.getSnapshotBeforeUpdate(d,p)),S=null!=u&&u.type===y&&null==u.key?u.props.children:u,N(e,Array.isArray(S)?S:[S],t,n,r,o,i,s,a,l),c.base=t.__e,t.__h=null,c.__h.length&&s.push(c),_&&(c.__E=c.__=null),c.__e=!1}else null==i&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=O(n.__e,t,n,r,o,i,s,l);(u=f.diffed)&&u(t)}catch(e){t.__v=null,(l||null!=i)&&(t.__e=a,t.__h=!!l,i[i.indexOf(a)]=null),f.__e(e,t,n)}}function F(e,t){f.__c&&f.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){f.__e(e,t.__v)}})}function O(e,t,n,r,o,i,s,f){var l,u,c,b=n.props,d=t.props,h=t.type,_=0;if("svg"===h&&(o=!0),null!=i)for(;_<i.length;_++)if((l=i[_])&&"setAttribute"in l==!!h&&(h?l.localName===h:3===l.nodeType)){e=l,i[_]=null;break}if(null==e){if(null===h)return document.createTextNode(d);e=o?document.createElementNS("http://www.w3.org/2000/svg",h):document.createElement(h,d.is&&d),i=null,f=!1}if(null===h)b===d||f&&e.data===d||(e.data=d);else{if(i=i&&a.call(e.childNodes),u=(b=n.props||p).dangerouslySetInnerHTML,c=d.dangerouslySetInnerHTML,!f){if(null!=i)for(b={},_=0;_<e.attributes.length;_++)b[e.attributes[_].name]=e.attributes[_].value;(c||u)&&(c&&(u&&c.__html==u.__html||c.__html===e.innerHTML)||(e.innerHTML=c&&c.__html||""))}if(function(e,t,n,r,o){var i;for(i in n)"children"===i||"key"===i||i in t||H(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]||H(e,i,t[i],n[i],r)}(e,d,b,o,f),c)t.__k=[];else if(_=t.props.children,N(e,Array.isArray(_)?_:[_],t,n,r,o&&"foreignObject"!==h,i,s,i?i[0]:n.__k&&x(n,0),f),null!=i)for(_=i.length;_--;)null!=i[_]&&m(i[_]);f||("value"in d&&void 0!==(_=d.value)&&(_!==e.value||"progress"===h&&!_||"option"===h&&_!==b.value)&&H(e,"value",_,b.value,!1),"checked"in d&&void 0!==(_=d.checked)&&_!==e.checked&&H(e,"checked",_,b.checked,!1))}return e}function U(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){f.__e(e,n)}}function A(e,t,n){var r,o;if(f.unmount&&f.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||U(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){f.__e(e,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&A(r[o],t,n||"function"!=typeof e.type);n||null==e.__e||m(e.__e),e.__=e.__e=e.__d=void 0}function M(e,t,n){return this.constructor(e,n)}a=h.slice,f={__e:function(e,t,n,r){for(var o,i,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&null!=i.getDerivedStateFromError&&(o.setState(i.getDerivedStateFromError(e)),s=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,r||{}),s=o.__d),s)return o.__E=o}catch(t){e=t}throw e}},l=0,j.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=g({},this.state),"function"==typeof e&&(e=e(g({},n),this.props)),e&&g(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),C(this))},j.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),C(this))},j.prototype.render=y,u=[],b="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,d=function(e,t){return e.__v.__b-t.__v.__b},P.__r=0;var D,W,B,J,Y=0,Q=[],R=[],V=f.__b,X=f.__r,$=f.diffed,G=f.__c,K=f.unmount;function Z(e,t){f.__h&&f.__h(W,e,Y||t),Y=0;var n=W.__H||(W.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:R}),n.__[e]}function ee(e){return Y=1,function(e,t,n){var r=Z(D++,2);if(r.t=e,!r.__c&&(r.__=[ae(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=W,!W.u)){var o=function(e,t,n){if(!r.__c.__H)return!0;var o=r.__c.__H.__.filter(function(e){return e.__c});if(o.every(function(e){return!e.__N}))return!i||i.call(this,e,t,n);var s=!1;return o.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}}),!(!s&&r.__c.props===e)&&(!i||i.call(this,e,t,n))};W.u=!0;var i=W.shouldComponentUpdate,s=W.componentWillUpdate;W.componentWillUpdate=function(e,t,n){if(this.__e){var r=i;i=void 0,o(e,t,n),i=r}s&&s.call(this,e,t,n)},W.shouldComponentUpdate=o}return r.__N||r.__}(ae,e)}function te(e,t){var n=Z(D++,3);!f.__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.i=t,W.__H.__h.push(n))}function ne(){for(var e;e=Q.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ie),e.__H.__h.forEach(se),e.__H.__h=[]}catch(t){e.__H.__h=[],f.__e(t,e.__v)}}f.__b=function(e){W=null,V&&V(e)},f.__r=function(e){X&&X(e),D=0;var t=(W=e.__c).__H;t&&(B===W?(t.__h=[],W.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.__V=R,e.__N=e.i=void 0})):(t.__h.forEach(ie),t.__h.forEach(se),t.__h=[])),B=W},f.diffed=function(e){$&&$(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==Q.push(t)&&J===f.requestAnimationFrame||((J=f.requestAnimationFrame)||oe)(ne)),t.__H.__.forEach(function(e){e.i&&(e.__H=e.i),e.__V!==R&&(e.__=e.__V),e.i=void 0,e.__V=R})),B=W=null},f.__c=function(e,t){t.some(function(e){try{e.__h.forEach(ie),e.__h=e.__h.filter(function(e){return!e.__||se(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],f.__e(n,e.__v)}}),G&&G(e,t)},f.unmount=function(e){K&&K(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{ie(e)}catch(e){t=e}}),n.__H=void 0,t&&f.__e(t,n.__v))};var re="function"==typeof requestAnimationFrame;function oe(e){var t,n=function(){clearTimeout(r),re&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);re&&(t=requestAnimationFrame(n))}function ie(e){var t=W,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),W=t}function se(e){var t=W;e.__c=e.__(),W=t}function ae(e,t){return"function"==typeof t?t(e):t}var fe=function(){return[].slice.call(arguments).filter(Boolean).join(" ")};function le(e){var t=e.children,n=e.isOpen,r=e.close,o=ee(!1),i=o[0],s=o[1];return te(function(){s(n)},[n]),v("div",{"aria-live":"assertive",className:"fb-pointer-events-none fb-fixed fb-inset-0 fb-flex fb-items-end"},v("div",{className:"fb-flex fb-w-full fb-flex-col fb-items-center fb-space-y-4 sm:fb-items-end"},v("div",{className:fe(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 fb-z-40 fb-m-4")},v("div",{class:"fb-absolute fb-top-0 fb-right-0 fb-hidden fb-pt-4 fb-pr-4 sm:fb-block"},v("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 fb-text-slate-400 hover:fb-text-slate-500 focus:ring-slate-500"},v("span",{class:"fb-sr-only"},"Close"),v("svg",{class:"fb-h-6 fb-w-6",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},v("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})))),v("div",{className:""},t))))}var ue=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)}},ce=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 be(e){return v("div",{className:"fb-h-1 fb-w-full fb-rounded-full bg-slate-200"},v("div",{className:"fb-h-1 fb-rounded-full",style:{backgroundColor:e.brandColor,width:Math.floor(100*e.progress)+"%"}}))}function de(e){return v("label",{htmlFor:e.questionId,className:"fb-mb-1.5 fb-block fb-text-base fb-font-semibold fb-leading-6 fb-mr-8 text-slate-900",style:e.style},e.headline)}function pe(e){return v("label",{for:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600"},e.subheader)}function he(e){var t=e.headline,n=e.subheader;return v("div",{className:"fb-text-center"},v("div",{className:"fb-flex fb-items-center fb-justify-center",style:{color:e.brandColor}},v("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"fb-h-24 fb-w-24"},v("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))),v("span",{className:"fb-inline-block fb-rounded-[100%] fb-w-16 fb-h-1 fb-mb-[10px] fb-bg-slate-300"}),v("div",null,v(de,{headline:t,questionId:"thankYouCard",style:{"margin-right":0}}),v(pe,{subheader:n,questionId:"thankYouCard"})))}function _e(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return v("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)}},v(de,{headline:t.headline,questionId:t.id}),v(pe,{subheader:t.subheader,questionId:t.id}),v("div",{className:"fb-mt-4"},v("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 fb-bg-slate-50 fb-border-slate-100 focus:fb-border-slate-500"})),v("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},v("div",null),v("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:fb-ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function ge(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ee(null),s=i[0],a=i[1];return v("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);n(o),a(null)}},v(de,{headline:t.headline,questionId:t.id}),v(pe,{subheader:t.subheader,questionId:t.id}),v("div",{className:"fb-mt-4"},v("fieldset",null,v("legend",{className:"fb-sr-only"},"Choices"),v("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e,n){return v("label",{key:e.id,className:fe(s===e.label?"fb-z-10 fb-bg-slate-50 fb-border-slate-400":"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")},v("span",{className:"fb-flex fb-items-center fb-text-sm"},v("input",{type:"radio",id:e.id,name:t.id,value:e.label,className:"fb-h-4 fb-w-4 fb-border fb-border-slate-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":e.id+"-label",onChange:function(e){a(e.currentTarget.value)},checked:s===e.label,style:{borderColor:o,color:o},required:t.required&&0===n}),v("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),v("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},v("div",null),v("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 me(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ee([]),s=i[0],a=i[1],f=function(){return s.length>0};return v("form",{onSubmit:function(e){var r;if(e.preventDefault(),f()||!t.required){var o=((r={})[t.id]=s,r);n(o),a([])}}},v(de,{headline:t.headline,questionId:t.id}),v(pe,{subheader:t.subheader,questionId:t.id}),v("div",{className:"fb-mt-4"},v("fieldset",null,v("legend",{className:"fb-sr-only"},"Choices"),v("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e){return v("label",{key:e.id,className:fe(s.includes(e.label)?"fb-z-10 fb-border-slate-400 fb-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 hover:fb-bg-slate-50 focus:fb-outline-none")},v("span",{className:"fb-flex fb-items-center fb-text-sm"},v("input",{type:"checkbox",id:e.id,name:t.id,value:e.label,className:"fb-h-4 fb-w-4 fb-border fb-border-slate-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":e.id+"-label",onChange:function(e){a(e.currentTarget.checked?[].concat(s,[e.currentTarget.value]):s.filter(function(t){return t!==e.currentTarget.value}))},checked:s.includes(e.label),style:{borderColor:o,color:o}}),v("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),v("input",{type:"text",className:"clip-[rect(0,0,0,0)] fb-absolute fb-m-[-1px] fb-h-1 fb-w-1 fb-overflow-hidden fb-whitespace-nowrap fb-border-0 fb-p-0 fb-text-transparent fb-caret-transparent focus:fb-border-transparent focus:fb-ring-0",required:t.required,value:f()?"checked":""}),v("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},v("div",null),v("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 ve(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ee(null),s=i[0],a=i[1];return v("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=s,r);n(o)}},v(de,{headline:t.headline,questionId:t.id}),v(pe,{subheader:t.subheader,questionId:t.id}),v("div",{className:"fb-my-4"},v("fieldset",null,v("legend",{className:"fb-sr-only"},"Choices"),v("div",{className:"fb-flex"},Array.from({length:11},function(e,t){return t}).map(function(e){return v("label",{key:e,className:fe(s===e?"fb-z-10 fb-border-slate-400 fb-bg-slate-50":"","fb-relative fb-h-10 fb-flex-1 fb-cursor-pointer fb-border fb-bg-white fb-text-center fb-text-sm fb-leading-10 fb-hover:bg-gray-100 fb-focus:outline-none")},v("input",{type:"radio",name:"nps",value:e,className:"fb-absolute fb-h-full fb-w-full fb-cursor-pointer fb-opacity-0",onChange:function(){return a(e)},required:t.required}),e)})),v("div",{className:"fb-flex fb-justify-between fb-text-sm fb-font-semibold fb-leading-6"},v("p",null,t.lowerLabel),v("p",null,t.upperLabel)))),v("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},v("div",null),v("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 fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function we(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return"openText"===t.type?v(_e,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceSingle"===t.type?v(ge,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceMulti"===t.type?v(me,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"nps"===t.type?v(ve,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):null}function ye(e){var t,n=e.config,r=e.survey,o=e.close,i=e.brandColor,s=ee(r.questions[0].id),a=s[0],f=s[1],l=ee(0),u=l[0],c=l[1],b=ee(null),d=b[0],p=b[1],h=ee(null),_=h[0],g=h[1],m=ee(!1),w=m[0],y=m[1];te(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:r.id,personId:n.person.id},n)).then(function(e){g(e.id)})}catch(e){return Promise.reject(e)}}(),console.log(r)},[n,r]),te(function(){var e;c((e=r.questions.findIndex(function(e){return e.id===a}),e/r.questions.length))},[a,r]);var j=function(e){try{var t=function(){y(!1),s?(c(100),r.thankYouCard.enabled?setTimeout(function(){o()},2e3):o()):f(r.questions[i+1].id)};y(!0);var i=r.questions.findIndex(function(e){return e.id===a}),s=i===r.questions.length-1,l={surveyId:r.id,personId:n.person.id,response:{finished:s,data:e}},u=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,n)).then(function(){}):Promise.resolve(Promise.all([ce(l,n),ue(_,n)])).then(function(e){p(e[0].id)});return Promise.resolve(u&&u.then?u.then(t):t())}catch(e){return Promise.reject(e)}};return v("div",null,v("div",{className:fe(w?"fb-animate-pulse fb-opacity-60":"","fb-text-slate-800 fb-font-sans fb-px-4 fb-py-6 sm:fb-p-6")},100===u&&r.thankYouCard.enabled?v(he,{headline:r.thankYouCard.headline,subheader:r.thankYouCard.subheader,brandColor:null==(t=n.settings)?void 0:t.brandColor}):r.questions.map(function(e,t){return a===e.id&&v(we,{key:e.id,brandColor:i,lastQuestion:t===r.questions.length-1,onSubmit:j,question:e})})),v(be,{progress:u,brandColor:i}))}function je(e){var t,n=e.config,r=e.survey,o=e.closeSurvey,i=ee(!0),s=i[1],a=function(){s(!1),setTimeout(function(){o()},1e3)};return v("div",{id:"fbjs"},v(le,{isOpen:i[0],close:a},v(ye,{config:n,survey:r,close:a,brandColor:null==(t=n.settings)?void 0:t.brandColor})))}var xe=/*#__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}();xe.instance=void 0;var ke=/*#__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}();ke.instance=void 0;var Ce=ke.getInstance(),Pe=xe.getInstance(),Ne=function(){try{return Promise.resolve(fetch(Pe.get().apiHost+"/api/v1/client/environments/"+Pe.get().environmentId+"/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:Pe.get().person.id})})).then(function(e){if(!e.ok)throw Ce.error("Error getting settings"),Error("Error getting settings");return e.json()})}catch(e){return Promise.reject(e)}},Se="formbricks-web-container",Ie=xe.getInstance(),Ee=ke.getInstance(),qe=!1,He=function(e){qe?Ee.debug("A survey is already running. Skipping."):(qe=!0,function(e,t,n){var r,o;f.__&&f.__(e,t),r=t.__k,o=[],L(t,e=t.__k=v(y,null,[e]),r||p,p,void 0!==t.ownerSVGElement,r?null:t.firstChild?a.call(t.childNodes):null,o,r?r.__e:t.firstChild,!1),F(o,e)}(v(je,{config:Ie.get(),survey:e,closeSurvey:Te}),document.getElementById(Se)))},Te=function(){try{return document.getElementById(Se).remove(),ze(),Promise.resolve(Ne()).then(function(e){Ie.update({settings:e}),qe=!1})}catch(e){return Promise.reject(e)}},ze=function(){var e=document.createElement("div");e.id=Se,document.body.appendChild(e)},Le=ke.getInstance(),Fe=xe.getInstance(),Oe=function(e,t){try{return Promise.resolve(fetch(Fe.get().apiHost+"/api/v1/client/environments/"+Fe.get().environmentId+"/events",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:Fe.get().session.id,eventName:e,properties:t})})).then(function(t){var n;function r(t){if(n)return t;Le.debug('Formbricks: Event "'+e+'" tracked'),Ue(e)}var o=function(){if(!t.ok)return Promise.resolve(t.json()).then(function(e){Le.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)}},Ue=function(e){for(var t,n=s(null==(r=Fe.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 Le.debug("Formbricks: survey "+i.id+' triggered by event "'+e+'"'),void He(i)}},Ae=xe.getInstance(),Me=ke.getInstance(),De=function(){try{return Me.debug("Creating new person"),Promise.resolve(fetch(Ae.get().apiHost+"/api/v1/client/environments/"+Ae.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)}},We=function(e,t){var n=Ae.get().person.attributes.find(function(t){var n;return(null==(n=t.attributeClass)?void 0:n.name)===e});return!(!n||n.value!==t)},Be=ke.getInstance(),Je=xe.getInstance(),Ye=function(){try{return Je.get().person?Promise.resolve(fetch(Je.get().apiHost+"/api/v1/client/environments/"+Je.get().environmentId+"/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:Je.get().person.id})})).then(function(e){if(e.ok)return Promise.resolve(e.json());Be.error("Error creating session")}):(Be.error("Formbricks: Unable to create session. No person found"),Promise.resolve())}catch(e){return Promise.reject(e)}},Qe=function(e){Be.debug("Session expired. Creating new session.");var t=o({},e);return t.expiresAt=Date.now()+36e5,t},Re=function(e){return e.expiresAt<=Date.now()},Ve=xe.getInstance(),Xe=ke.getInstance(),$e=function(){var e=Ve.get().settings,t=null==e?void 0:e.noCodeEvents.filter(function(e){var t;return"pageUrl"===(null==(t=e.noCodeConfig)?void 0:t.type)});if(Xe.debug("checking page url"),0!==t.length)for(var n,r=s(t);!(n=r()).done;){var o=n.value,i=o.noCodeConfig.pageUrl;i&&Ge(window.location.href,i.value,i.rule)&&Oe(o.name)}};function Ge(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 Ke=function(e){var t=Ve.get().settings,n=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"innerHtml"===(null==(t=e.noCodeConfig)?void 0:t.type)}),r=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"cssSelector"===(null==(t=e.noCodeConfig)?void 0:t.type)}),o=e.target;n.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.innerHtml;n&&o.innerHTML===n.value&&Oe(e.name)}),r.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.cssSelector;n&&o.matches(n.value)&&Oe(e.name)})},Ze=xe.getInstance(),et=ke.getInstance(),tt=function(){if(!(Ze.get().apiHost&&Ze.get().environmentId&&Ze.get().person&&Ze.get().session&&Ze.get().settings))throw Error("Formbricks: Formbricks not initialized. Call initialize() first.")},nt=new r,rt=function(e,t){nt.add(function(){try{return tt(),Promise.resolve(function(e,t){try{return Me.debug("setting attribute: "+e+" to value: "+t),We(e,t)?(Me.debug("attribute already set to this value. Skipping update."),Promise.resolve()):Promise.resolve(function(e,t){try{return Ae.get().person&&Ae.get().person.id?Promise.resolve(fetch(Ae.get().apiHost+"/api/v1/client/environments/"+Ae.get().environmentId+"/people/"+Ae.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 Me.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 Me.error("Error updating attribute"),new Error("Formbricks: Error updating attribute");Ae.update({person:t,settings:n})})}catch(e){return Promise.reject(e)}}(e,t)).then(function(){})}catch(e){return Promise.reject(e)}})},ot={init:function(e){nt.add(function(){try{return function(e){try{var t,n=function(e){if(t)return e;(function(){if("undefined"!=typeof window){var e=window.setInterval(function(){try{return Promise.resolve(function(){try{var e=function(e){Be.debug("Session not expired, extending session"),Je.update({session:Qe(Je.get().session)})};Be.debug("Checking session");var t=function(){if(Re(Je.get().session))return Be.debug("Session expired, creating new session"),Promise.resolve(Ye()).then(function(e){var t=e.session,n=e.settings;if(!t||!n)throw Be.error("Error creating new session"),Error("Error creating new session");Je.update({session:t,settings:n}),Oe("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",$e),window.addEventListener("popstate",$e),window.addEventListener("pushstate",$e),window.addEventListener("replacestate",$e),window.addEventListener("load",$e)),"undefined"!=typeof window&&document.addEventListener("click",Ke),et.debug("Initialized")};if(!e.environmentId)throw Error("Formbricks: environmentId is required");if(!e.apiHost)throw Error("Formbricks: apiHost is required");e.logLevel&&et.configure({logLevel:e.logLevel}),ze(),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 :is(.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 :is(.fb-pointer-events-none){pointer-events:none}#fbjs :is(.fb-pointer-events-auto){pointer-events:auto}#fbjs :is(.fb-fixed){position:fixed}#fbjs :is(.fb-absolute){position:absolute}#fbjs :is(.fb-relative){position:relative}#fbjs :is(.fb-inset-0){inset:0}#fbjs :is(.fb-right-0){right:0}#fbjs :is(.fb-top-0){top:0}#fbjs :is(.fb-z-10){z-index:10}#fbjs :is(.fb-z-40){z-index:40}#fbjs :is(.fb-m-4){margin:1rem}#fbjs :is(.fb-m-\\[-1px\\]){margin:-1px}#fbjs :is(.fb-my-4){margin-bottom:1rem;margin-top:1rem}#fbjs :is(.fb-mb-1){margin-bottom:.25rem}#fbjs :is(.fb-mb-1\\.5){margin-bottom:.375rem}#fbjs :is(.fb-mb-\\[10px\\]){margin-bottom:10px}#fbjs :is(.fb-ml-3){margin-left:.75rem}#fbjs :is(.fb-mr-8){margin-right:2rem}#fbjs :is(.fb-mt-4){margin-top:1rem}#fbjs :is(.fb-mt-\\[35px\\]){margin-top:35px}#fbjs :is(.fb-block){display:block}#fbjs :is(.fb-inline-block){display:inline-block}#fbjs :is(.fb-flex){display:flex}#fbjs :is(.fb-hidden){display:none}#fbjs :is(.fb-h-1){height:.25rem}#fbjs :is(.fb-h-10){height:2.5rem}#fbjs :is(.fb-h-24){height:6rem}#fbjs :is(.fb-h-4){height:1rem}#fbjs :is(.fb-h-6){height:1.5rem}#fbjs :is(.fb-h-\\[2px\\]){height:2px}#fbjs :is(.fb-h-full){height:100%}#fbjs :is(.fb-w-1){width:.25rem}#fbjs :is(.fb-w-16){width:4rem}#fbjs :is(.fb-w-24){width:6rem}#fbjs :is(.fb-w-4){width:1rem}#fbjs :is(.fb-w-4\\/5){width:80%}#fbjs :is(.fb-w-6){width:1.5rem}#fbjs :is(.fb-w-full){width:100%}#fbjs :is(.fb-max-w-sm){max-width:24rem}#fbjs :is(.fb-flex-1){flex:1 1 0%}#fbjs :is(.fb-translate-x-0){--tw-translate-x:0px;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 :is(.fb-translate-x-28){--tw-translate-x:7rem;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))}@keyframes fb-pulse{50%{opacity:.5}}#fbjs :is(.fb-animate-pulse){animation:fb-pulse 2s cubic-bezier(.4,0,.6,1) infinite}#fbjs :is(.fb-cursor-pointer){cursor:pointer}#fbjs :is(.fb-flex-col){flex-direction:column}#fbjs :is(.fb-items-end){align-items:flex-end}#fbjs :is(.fb-items-center){align-items:center}#fbjs :is(.fb-justify-center){justify-content:center}#fbjs :is(.fb-justify-between){justify-content:space-between}#fbjs :is(.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 :is(.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 :is(.fb-overflow-hidden){overflow:hidden}#fbjs :is(.fb-whitespace-nowrap){white-space:nowrap}#fbjs :is(.fb-rounded-\\[100\\%\\]){border-radius:100%}#fbjs :is(.fb-rounded-full){border-radius:9999px}#fbjs :is(.fb-rounded-lg){border-radius:.5rem}#fbjs :is(.fb-rounded-md){border-radius:.375rem}#fbjs :is(.fb-border){border-width:1px}#fbjs :is(.fb-border-0){border-width:0}#fbjs :is(.fb-border-gray-200){--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-100){--tw-border-opacity:1;border-color:rgb(241 245 249/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-300){--tw-border-opacity:1;border-color:rgb(203 213 225/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-400){--tw-border-opacity:1;border-color:rgb(148 163 184/var(--tw-border-opacity))}#fbjs :is(.fb-border-transparent){border-color:transparent}#fbjs :is(.fb-bg-slate-300){--tw-bg-opacity:1;background-color:rgb(203 213 225/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-slate-50){--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-white){--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}#fbjs :is(.fb-p-0){padding:0}#fbjs :is(.fb-p-2){padding:.5rem}#fbjs :is(.fb-p-4){padding:1rem}#fbjs :is(.fb-px-3){padding-left:.75rem;padding-right:.75rem}#fbjs :is(.fb-px-4){padding-left:1rem;padding-right:1rem}#fbjs :is(.fb-py-3){padding-bottom:.75rem;padding-top:.75rem}#fbjs :is(.fb-py-6){padding-bottom:1.5rem;padding-top:1.5rem}#fbjs :is(.fb-pr-4){padding-right:1rem}#fbjs :is(.fb-pt-4){padding-top:1rem}#fbjs :is(.fb-text-center){text-align:center}#fbjs :is(.fb-font-sans){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}#fbjs :is(.fb-text-base){font-size:1rem;line-height:1.5rem}#fbjs :is(.fb-text-sm){font-size:.875rem;line-height:1.25rem}#fbjs :is(.fb-text-xs){font-size:.75rem;line-height:1rem}#fbjs :is(.fb-font-medium){font-weight:500}#fbjs :is(.fb-font-normal){font-weight:400}#fbjs :is(.fb-font-semibold){font-weight:600}#fbjs :is(.fb-leading-10){line-height:2.5rem}#fbjs :is(.fb-leading-4){line-height:1rem}#fbjs :is(.fb-leading-6){line-height:1.5rem}#fbjs :is(.fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-500){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-800){--tw-text-opacity:1;color:rgb(30 41 59/var(--tw-text-opacity))}#fbjs :is(.fb-text-transparent){color:transparent}#fbjs :is(.fb-text-white){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}#fbjs :is(.fb-caret-transparent){caret-color:transparent}#fbjs :is(.fb-opacity-0){opacity:0}#fbjs :is(.fb-opacity-100){opacity:1}#fbjs :is(.fb-opacity-60){opacity:.6}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.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 :is(.fb-ring-black){--tw-ring-opacity:1;--tw-ring-color:rgb(0 0 0/var(--tw-ring-opacity))}#fbjs :is(.fb-ring-opacity-5){--tw-ring-opacity:0.05}#fbjs :is(.fb-transition-all){transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.fb-duration-500){transition-duration:.5s}#fbjs :is(.fb-ease-in-out){transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.hover\\:fb-bg-slate-50:hover){--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity))}#fbjs :is(.hover\\:fb-text-slate-500:hover){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.hover\\:fb-opacity-90:hover){opacity:.9}#fbjs :is(.focus\\:fb-border-slate-500:focus){--tw-border-opacity:1;border-color:rgb(100 116 139/var(--tw-border-opacity))}#fbjs :is(.focus\\:fb-border-transparent:focus){border-color:transparent}#fbjs :is(.focus\\:fb-outline-none:focus){outline:2px solid transparent;outline-offset:2px}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.focus\\:fb-ring-slate-500:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(100 116 139/var(--tw-ring-opacity))}#fbjs :is(.focus\\:fb-ring-offset-0:focus){--tw-ring-offset-width:0px}#fbjs :is(.focus\\:fb-ring-offset-2:focus){--tw-ring-offset-width:2px}@media (min-width:640px){#fbjs :is(.sm\\:fb-block){display:block}#fbjs :is(.sm\\:fb-items-end){align-items:flex-end}#fbjs :is(.sm\\:fb-p-6){padding:1.5rem}#fbjs :is(.sm\\:fb-text-sm){font-size:.875rem;line-height:1.25rem}}',document.head.appendChild(e)}}();var r=Ze&&Ze.get().environmentId===e.environmentId&&Ze.get().apiHost===e.apiHost?Ze.get().session&&Re(Ze.get().session)?Promise.resolve(Ye()).then(function(e){var t=e.settings;Ze.update({session:Qe(e.session),settings:t}),Oe("New Session")}):Ze.get().session?void 0:(et.error("Unable to initialize. No session found"),void(t=1)):(Ze.update({environmentId:e.environmentId,apiHost:e.apiHost}),Promise.resolve(De()).then(function(e){var t=e.settings;Ze.update({person:e.person,session:Qe(e.session),settings:t}),Oe("New Session")}));Promise.resolve(r&&r.then?r.then(n):n(r))}catch(e){return Promise.reject(e)}}(e),Promise.resolve()}catch(e){return Promise.reject(e)}})},setUserId:function(e){nt.add(function(){try{return tt(),Promise.resolve(function(e){try{return Me.debug("setting userId: "+e),We("userId",e)?(Me.debug("userId already set to this value. Skipping update."),Promise.resolve()):(t=Ae.get().person.attributes.find(function(e){var t;return"userId"===(null==(t=e.attributeClass)?void 0:t.name)}),t?(Me.error("userId cannot be changed after it has been set. You need to reset first"),Promise.resolve()):Promise.resolve(function(e){try{return Ae.get().person&&Ae.get().person.id?Promise.resolve(fetch(Ae.get().apiHost+"/api/v1/client/environments/"+Ae.get().environmentId+"/people/"+Ae.get().person.id+"/user-id",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,sessionId:Ae.get().session.id})})).then(function(e){if(!e.ok)throw Me.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){Ae.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){rt("email",e)},setAttribute:rt,track:function(e,t){void 0===t&&(t={}),nt.add(function(){try{return tt(),Promise.resolve(Oe(e,t)).then(function(){})}catch(e){return Promise.reject(e)}})},logout:function(){nt.add(function(){try{return tt(),Promise.resolve(function(){try{return Me.debug("Resetting person. Getting new person, session and settings from backend"),Promise.resolve(De()).then(function(e){var t=e.person,n=e.session,r=e.settings;if(!t||!n||!r)throw Me.error("Error resetting user"),new Error("Formbricks: Error resetting user");Ae.update({person:t,session:n,settings:r})})}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}})},refresh:function(){nt.add(function(){try{return tt(),Promise.resolve(function(){try{return Ce.debug("Refreshing - getting settings from backend"),Promise.resolve(Ne()).then(function(e){Pe.update({settings:e})})}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}})},registerRouteChange:function(){nt.add(function(){try{return tt(),$e(),Promise.resolve()}catch(e){return Promise.reject(e)}})}};module.exports=ot;
//# sourceMappingURL=index.js.map
import { h } from "preact";
import type { MultipleChoiceSingleQuestion } from "@formbricks/types/js";
import type { MultipleChoiceSingleQuestion } from "@formbricks/types/questions";
interface MultipleChoiceSingleProps {

@@ -4,0 +4,0 @@ question: MultipleChoiceSingleQuestion;

@@ -0,3 +1,3 @@

import type { OpenTextQuestion } from "@formbricks/types/questions";
import { h } from "preact";
import type { OpenTextQuestion } from "@formbricks/types/js";
interface OpenTextQuestionProps {

@@ -4,0 +4,0 @@ question: OpenTextQuestion;

@@ -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={},h=[],_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function g(e,t){for(var n in t)e[n]=t[n];return e}function v(e){var t=e.parentNode;t&&t.removeChild(e)}function m(e,t,n){var r,o,i,s={};for(i in t)"key"==i?r=t[i]:"ref"==i?o=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?a.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===s[i]&&(s[i]=e.defaultProps[i]);return w(e,s,r,o,null)}function w(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?++l:o};return null==o&&null!=f.vnode&&f.vnode(i),i}function y(e){return e.children}function j(e,t){this.props=e,this.context=t}function x(e,t){if(null==t)return e.__?x(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?x(e):null}function k(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 k(e)}}function P(e){(!e.__d&&(e.__d=!0)&&u.push(e)&&!C.__r++||c!==f.debounceRendering)&&((c=f.debounceRendering)||d)(C)}function C(){var e,t,n,r,o,i,s,a;for(u.sort(b);e=u.shift();)e.__d&&(t=u.length,r=void 0,o=void 0,s=(i=(n=e).__v).__e,(a=n.__P)&&(r=[],(o=g({},i)).__v=i.__v+1,L(a,i,o,n.__n,void 0!==a.ownerSVGElement,null!=i.__h?[s]:null,r,null==s?x(i):s,i.__h),F(r,i),i.__e!=s&&k(i)),u.length>t&&u.sort(b));C.__r=0}function S(e,t,n,r,o,i,s,a,f,l){var u,c,d,b,_,g,v,m=r&&r.__k||h,j=m.length;for(n.__k=[],u=0;u<t.length;u++)if(null!=(b=n.__k[u]=null==(b=t[u])||"boolean"==typeof b||"function"==typeof b?null:"string"==typeof b||"number"==typeof b||"bigint"==typeof b?w(null,b,null,null,b):Array.isArray(b)?w(y,{children:b},null,null,null):b.__b>0?w(b.type,b.props,b.key,b.ref?b.ref:null,b.__v):b)){if(b.__=n,b.__b=n.__b+1,null===(d=m[u])||d&&b.key==d.key&&b.type===d.type)m[u]=void 0;else for(c=0;c<j;c++){if((d=m[c])&&b.key==d.key&&b.type===d.type){m[c]=void 0;break}d=null}L(e,b,d=d||p,o,i,s,a,f,l),_=b.__e,(c=b.ref)&&d.ref!=c&&(v||(v=[]),d.ref&&v.push(d.ref,null,b),v.push(c,b.__c||_,b)),null!=_?(null==g&&(g=_),"function"==typeof b.type&&b.__k===d.__k?b.__d=f=I(b,f,e):f=E(e,b,d,m,_,f),"function"==typeof n.type&&(n.__d=f)):f&&d.__e==f&&f.parentNode!=e&&(f=x(d))}for(n.__e=g,u=j;u--;)null!=m[u]&&("function"==typeof n.type&&null!=m[u].__e&&m[u].__e==n.__d&&(n.__d=N(r).nextSibling),A(m[u],m[u]));if(v)for(u=0;u<v.length;u++)U(v[u],v[++u],v[++u])}function I(e,t,n){for(var r,o=e.__k,i=0;o&&i<o.length;i++)(r=o[i])&&(r.__=e,t="function"==typeof r.type?I(r,t,n):E(n,r,r,o,r.__e,t));return t}function E(e,t,n,r,o,i){var s,a,f;if(void 0!==t.__d)s=t.__d,t.__d=void 0;else if(null==n||o!=i||null==o.parentNode)e:if(null==i||i.parentNode!==e)e.appendChild(o),s=null;else{for(a=i,f=0;(a=a.nextSibling)&&f<r.length;f+=1)if(a==o)break e;e.insertBefore(o,i),s=i}return void 0!==s?s:o.nextSibling}function N(e){var t,n,r;if(null==e.type||"string"==typeof e.type)return e.__e;if(e.__k)for(t=e.__k.length-1;t>=0;t--)if((n=e.__k[t])&&(r=N(n)))return r;return null}function H(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||_.test(t)?n:n+"px"}function T(e,t,n,r,o){var i;e:if("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||H(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||H(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])i=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r||e.addEventListener(t,i?z:q,i):e.removeEventListener(t,i?z:q,i);else if("dangerouslySetInnerHTML"!==t){if(o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function q(e){return this.l[e.type+!1](f.event?f.event(e):e)}function z(e){return this.l[e.type+!0](f.event?f.event(e):e)}function L(e,t,n,r,o,i,s,a,l){var u,c,d,b,p,h,_,v,m,w,x,k,P,C,I,E=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(l=n.__h,a=t.__e=n.__e,t.__h=null,i=[a]),(u=f.__b)&&u(t);try{e:if("function"==typeof E){if(v=t.props,m=(u=E.contextType)&&r[u.__c],w=u?m?m.props.value:u.__:r,n.__c?_=(c=t.__c=n.__c).__=c.__E:("prototype"in E&&E.prototype.render?t.__c=c=new E(v,w):(t.__c=c=new j(v,w),c.constructor=E,c.render=M),m&&m.sub(c),c.props=v,c.state||(c.state={}),c.context=w,c.__n=r,d=c.__d=!0,c.__h=[],c._sb=[]),null==c.__s&&(c.__s=c.state),null!=E.getDerivedStateFromProps&&(c.__s==c.state&&(c.__s=g({},c.__s)),g(c.__s,E.getDerivedStateFromProps(v,c.__s))),b=c.props,p=c.state,c.__v=t,d)null==E.getDerivedStateFromProps&&null!=c.componentWillMount&&c.componentWillMount(),null!=c.componentDidMount&&c.__h.push(c.componentDidMount);else{if(null==E.getDerivedStateFromProps&&v!==b&&null!=c.componentWillReceiveProps&&c.componentWillReceiveProps(v,w),!c.__e&&null!=c.shouldComponentUpdate&&!1===c.shouldComponentUpdate(v,c.__s,w)||t.__v===n.__v){for(t.__v!==n.__v&&(c.props=v,c.state=c.__s,c.__d=!1),c.__e=!1,t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(e){e&&(e.__=t)}),x=0;x<c._sb.length;x++)c.__h.push(c._sb[x]);c._sb=[],c.__h.length&&s.push(c);break e}null!=c.componentWillUpdate&&c.componentWillUpdate(v,c.__s,w),null!=c.componentDidUpdate&&c.__h.push(function(){c.componentDidUpdate(b,p,h)})}if(c.context=w,c.props=v,c.__P=e,k=f.__r,P=0,"prototype"in E&&E.prototype.render){for(c.state=c.__s,c.__d=!1,k&&k(t),u=c.render(c.props,c.state,c.context),C=0;C<c._sb.length;C++)c.__h.push(c._sb[C]);c._sb=[]}else do{c.__d=!1,k&&k(t),u=c.render(c.props,c.state,c.context),c.state=c.__s}while(c.__d&&++P<25);c.state=c.__s,null!=c.getChildContext&&(r=g(g({},r),c.getChildContext())),d||null==c.getSnapshotBeforeUpdate||(h=c.getSnapshotBeforeUpdate(b,p)),I=null!=u&&u.type===y&&null==u.key?u.props.children:u,S(e,Array.isArray(I)?I:[I],t,n,r,o,i,s,a,l),c.base=t.__e,t.__h=null,c.__h.length&&s.push(c),_&&(c.__E=c.__=null),c.__e=!1}else null==i&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=O(n.__e,t,n,r,o,i,s,l);(u=f.diffed)&&u(t)}catch(e){t.__v=null,(l||null!=i)&&(t.__e=a,t.__h=!!l,i[i.indexOf(a)]=null),f.__e(e,t,n)}}function F(e,t){f.__c&&f.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){f.__e(e,t.__v)}})}function O(e,t,n,r,o,i,s,f){var l,u,c,d=n.props,b=t.props,h=t.type,_=0;if("svg"===h&&(o=!0),null!=i)for(;_<i.length;_++)if((l=i[_])&&"setAttribute"in l==!!h&&(h?l.localName===h:3===l.nodeType)){e=l,i[_]=null;break}if(null==e){if(null===h)return document.createTextNode(b);e=o?document.createElementNS("http://www.w3.org/2000/svg",h):document.createElement(h,b.is&&b),i=null,f=!1}if(null===h)d===b||f&&e.data===b||(e.data=b);else{if(i=i&&a.call(e.childNodes),u=(d=n.props||p).dangerouslySetInnerHTML,c=b.dangerouslySetInnerHTML,!f){if(null!=i)for(d={},_=0;_<e.attributes.length;_++)d[e.attributes[_].name]=e.attributes[_].value;(c||u)&&(c&&(u&&c.__html==u.__html||c.__html===e.innerHTML)||(e.innerHTML=c&&c.__html||""))}if(function(e,t,n,r,o){var i;for(i in n)"children"===i||"key"===i||i in t||T(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]||T(e,i,t[i],n[i],r)}(e,b,d,o,f),c)t.__k=[];else if(_=t.props.children,S(e,Array.isArray(_)?_:[_],t,n,r,o&&"foreignObject"!==h,i,s,i?i[0]:n.__k&&x(n,0),f),null!=i)for(_=i.length;_--;)null!=i[_]&&v(i[_]);f||("value"in b&&void 0!==(_=b.value)&&(_!==e.value||"progress"===h&&!_||"option"===h&&_!==d.value)&&T(e,"value",_,d.value,!1),"checked"in b&&void 0!==(_=b.checked)&&_!==e.checked&&T(e,"checked",_,d.checked,!1))}return e}function U(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){f.__e(e,n)}}function A(e,t,n){var r,o;if(f.unmount&&f.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||U(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){f.__e(e,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&A(r[o],t,n||"function"!=typeof e.type);n||null==e.__e||v(e.__e),e.__=e.__e=e.__d=void 0}function M(e,t,n){return this.constructor(e,n)}a=h.slice,f={__e:function(e,t,n,r){for(var o,i,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&null!=i.getDerivedStateFromError&&(o.setState(i.getDerivedStateFromError(e)),s=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,r||{}),s=o.__d),s)return o.__E=o}catch(t){e=t}throw e}},l=0,j.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=g({},this.state),"function"==typeof e&&(e=e(g({},n),this.props)),e&&g(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),P(this))},j.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),P(this))},j.prototype.render=y,u=[],d="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,b=function(e,t){return e.__v.__b-t.__v.__b},C.__r=0;var D,W,B,J,Y=0,R=[],V=[],Q=f.__b,X=f.__r,$=f.diffed,G=f.__c,K=f.unmount;function Z(e,t){f.__h&&f.__h(W,e,Y||t),Y=0;var n=W.__H||(W.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:V}),n.__[e]}function ee(e){return Y=1,function(e,t,n){var r=Z(D++,2);if(r.t=e,!r.__c&&(r.__=[ae(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=W,!W.u)){var o=function(e,t,n){if(!r.__c.__H)return!0;var o=r.__c.__H.__.filter(function(e){return e.__c});if(o.every(function(e){return!e.__N}))return!i||i.call(this,e,t,n);var s=!1;return o.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}}),!(!s&&r.__c.props===e)&&(!i||i.call(this,e,t,n))};W.u=!0;var i=W.shouldComponentUpdate,s=W.componentWillUpdate;W.componentWillUpdate=function(e,t,n){if(this.__e){var r=i;i=void 0,o(e,t,n),i=r}s&&s.call(this,e,t,n)},W.shouldComponentUpdate=o}return r.__N||r.__}(ae,e)}function te(e,t){var n=Z(D++,3);!f.__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.i=t,W.__H.__h.push(n))}function ne(){for(var e;e=R.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ie),e.__H.__h.forEach(se),e.__H.__h=[]}catch(t){e.__H.__h=[],f.__e(t,e.__v)}}f.__b=function(e){W=null,Q&&Q(e)},f.__r=function(e){X&&X(e),D=0;var t=(W=e.__c).__H;t&&(B===W?(t.__h=[],W.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.__V=V,e.__N=e.i=void 0})):(t.__h.forEach(ie),t.__h.forEach(se),t.__h=[])),B=W},f.diffed=function(e){$&&$(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==R.push(t)&&J===f.requestAnimationFrame||((J=f.requestAnimationFrame)||oe)(ne)),t.__H.__.forEach(function(e){e.i&&(e.__H=e.i),e.__V!==V&&(e.__=e.__V),e.i=void 0,e.__V=V})),B=W=null},f.__c=function(e,t){t.some(function(e){try{e.__h.forEach(ie),e.__h=e.__h.filter(function(e){return!e.__||se(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],f.__e(n,e.__v)}}),G&&G(e,t)},f.unmount=function(e){K&&K(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{ie(e)}catch(e){t=e}}),n.__H=void 0,t&&f.__e(t,n.__v))};var re="function"==typeof requestAnimationFrame;function oe(e){var t,n=function(){clearTimeout(r),re&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);re&&(t=requestAnimationFrame(n))}function ie(e){var t=W,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),W=t}function se(e){var t=W;e.__c=e.__(),W=t}function ae(e,t){return"function"==typeof t?t(e):t}var fe=function(){return[].slice.call(arguments).filter(Boolean).join(" ")};function le(e){var t=e.children,n=e.isOpen,r=e.close,o=ee(!1),i=o[0],s=o[1];return te(function(){s(n)},[n]),m("div",{"aria-live":"assertive",className:"fb-pointer-events-none fb-fixed fb-inset-0 fb-flex fb-items-end"},m("div",{className:"fb-flex fb-w-full fb-flex-col fb-items-center fb-space-y-4 sm:fb-items-end"},m("div",{className:fe(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 fb-z-40")},m("div",{class:"fb-absolute fb-top-0 fb-right-0 fb-hidden fb-pt-4 fb-pr-4 sm:fb-block"},m("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 fb-text-slate-400 hover:fb-text-slate-500 focus:ring-slate-500"},m("span",{class:"fb-sr-only"},"Close"),m("svg",{class:"fb-h-6 fb-w-6",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})))),m("div",{className:""},t))))}var ue=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)}},ce=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 de(e){return m("label",{htmlFor:e.questionId,className:"fb-mb-1.5 fb-block fb-text-base fb-font-semibold fb-leading-6 fb-mr-8 text-slate-900",style:e.style},e.headline)}function be(e){return m("label",{for:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600"},e.subheader)}function pe(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return m("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)}},m(de,{headline:t.headline,questionId:t.id}),m(be,{subheader:t.subheader,questionId:t.id}),m("div",{className:"fb-mt-4"},m("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 fb-bg-slate-50 fb-border-slate-100 focus:fb-border-slate-500"})),m("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},m("div",null),m("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:fb-ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function he(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ee(null),s=i[0],a=i[1];return m("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)}},m(de,{headline:t.headline,questionId:t.id}),m(be,{subheader:t.subheader,questionId:t.id}),m("div",{className:"fb-mt-4"},m("fieldset",null,m("legend",{className:"fb-sr-only"},"Choices"),m("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e,n){return m("label",{key:e.id,className:fe(s===e.label?"fb-z-10 fb-bg-slate-50 fb-border-slate-400":"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")},m("span",{className:"fb-flex fb-items-center fb-text-sm"},m("input",{type:"radio",id:e.id,name:t.id,value:e.label,className:"fb-h-4 fb-w-4 fb-border fb-border-slate-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},required:t.required&&0===n}),m("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),m("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},m("div",null),m("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 _e(e){return m("div",{className:"fb-h-1 fb-w-full fb-rounded-full bg-slate-200"},m("div",{className:"fb-h-1 fb-rounded-full",style:{backgroundColor:e.brandColor,width:Math.floor(100*e.progress)+"%"}}))}function ge(e){var t=e.headline,n=e.subheader;return m("div",{className:"fb-text-center"},m("div",{className:"fb-flex fb-items-center fb-justify-center",style:{color:e.brandColor}},m("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"fb-h-24 fb-w-24"},m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))),m("span",{className:"fb-inline-block fb-rounded-[100%] fb-w-16 fb-h-1 fb-mb-[10px] fb-bg-slate-300"}),m("div",null,m(de,{headline:t,questionId:"thankYouCard",style:{"margin-right":0}}),m(be,{subheader:n,questionId:"thankYouCard"})))}function ve(e){var t,n=e.config,r=e.survey,o=e.close,i=e.brandColor,s=ee(r.questions[0]),a=s[0],f=s[1],l=ee(0),u=l[0],c=l[1],d=ee(null),b=d[0],p=d[1],h=ee(null),_=h[0],g=h[1],v=ee(!1),w=v[0],y=v[1];te(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:r.id,personId:n.person.id},n)).then(function(e){g(e.id)})}catch(e){return Promise.reject(e)}}()},[n,r]),te(function(){var e;c((e=r.questions.findIndex(function(e){return e.id===a.id}),e/r.questions.length))},[a,r]);var j=function(e){try{var t=function(){y(!1),s?(c(100),r.thankYouCard.enabled?setTimeout(function(){o()},2e3):o()):f(r.questions[i+1])};y(!0);var i=r.questions.findIndex(function(e){return e.id===a.id}),s=i===r.questions.length-1,l={surveyId:r.id,personId:n.person.id,response:{finished:s,data:e}},u=b?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,b,n)).then(function(){}):Promise.resolve(Promise.all([ce(l,n),ue(_,n)])).then(function(e){p(e[0].id)});return Promise.resolve(u&&u.then?u.then(t):t())}catch(e){return Promise.reject(e)}};return m("div",null,m("div",{className:fe(w?"fb-animate-pulse fb-opacity-60":"","fb-text-slate-800 fb-font-sans fb-px-4 fb-py-6 sm:fb-p-6")},100===u&&r.thankYouCard.enabled?m(ge,{headline:r.thankYouCard.headline,subheader:r.thankYouCard.subheader,brandColor:null==(t=n.settings)?void 0:t.brandColor}):"multipleChoiceSingle"===a.type?m(he,{question:a,onSubmit:j,lastQuestion:r.questions.findIndex(function(e){return e.id===a.id})===r.questions.length-1,brandColor:i}):"openText"===a.type?m(pe,{question:a,onSubmit:j,lastQuestion:r.questions.findIndex(function(e){return e.id===a.id})===r.questions.length-1,brandColor:i}):null),m(_e,{progress:u,brandColor:i}))}function me(e){var t,n=e.config,r=e.survey,o=e.closeSurvey,i=ee(!0),s=i[1],a=function(){s(!1),setTimeout(function(){o()},1e3)};return m("div",{id:"fbjs"},m(le,{isOpen:i[0],close:a},m(ve,{config:n,survey:r,close:a,brandColor:null==(t=n.settings)?void 0:t.brandColor})))}var we=/*#__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}();we.instance=void 0;var ye=/*#__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}();ye.instance=void 0;var je=ye.getInstance(),xe=we.getInstance(),ke=function(){try{return Promise.resolve(fetch(xe.get().apiHost+"/api/v1/client/environments/"+xe.get().environmentId+"/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:xe.get().person.id})})).then(function(e){if(!e.ok)throw je.error("Error getting settings"),Error("Error getting settings");return e.json()})}catch(e){return Promise.reject(e)}},Pe="formbricks-web-container",Ce=we.getInstance(),Se=ye.getInstance(),Ie=!1,Ee=function(e){Ie?Se.debug("A survey is already running. Skipping."):(Ie=!0,function(e,t,n){var r,o;f.__&&f.__(e,t),r=t.__k,o=[],L(t,e=t.__k=m(y,null,[e]),r||p,p,void 0!==t.ownerSVGElement,r?null:t.firstChild?a.call(t.childNodes):null,o,r?r.__e:t.firstChild,!1),F(o,e)}(m(me,{config:Ce.get(),survey:e,closeSurvey:Ne}),document.getElementById(Pe)))},Ne=function(){try{return document.getElementById(Pe).remove(),He(),Promise.resolve(ke()).then(function(e){Ce.update({settings:e}),Ie=!1})}catch(e){return Promise.reject(e)}},He=function(){var e=document.createElement("div");e.id=Pe,document.body.appendChild(e)},Te=ye.getInstance(),qe=we.getInstance(),ze=function(e,t){try{return Promise.resolve(fetch(qe.get().apiHost+"/api/v1/client/environments/"+qe.get().environmentId+"/events",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:qe.get().session.id,eventName:e,properties:t})})).then(function(t){var n;function r(t){if(n)return t;Te.debug('Formbricks: Event "'+e+'" tracked'),Le(e)}var o=function(){if(!t.ok)return Promise.resolve(t.json()).then(function(e){Te.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)}},Le=function(e){for(var t,n=s(null==(r=qe.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 Te.debug("Formbricks: survey "+i.id+' triggered by event "'+e+'"'),void Ee(i)}},Fe=we.getInstance(),Oe=ye.getInstance(),Ue=function(){try{return Oe.debug("Creating new person"),Promise.resolve(fetch(Fe.get().apiHost+"/api/v1/client/environments/"+Fe.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)}},Ae=function(e,t){var n=Fe.get().person.attributes.find(function(t){var n;return(null==(n=t.attributeClass)?void 0:n.name)===e});return!(!n||n.value!==t)},Me=ye.getInstance(),De=we.getInstance(),We=function(){try{return De.get().person?Promise.resolve(fetch(De.get().apiHost+"/api/v1/client/environments/"+De.get().environmentId+"/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:De.get().person.id})})).then(function(e){if(e.ok)return Promise.resolve(e.json());Me.error("Error creating session")}):(Me.error("Formbricks: Unable to create session. No person found"),Promise.resolve())}catch(e){return Promise.reject(e)}},Be=function(e){Me.debug("Session expired. Creating new session.");var t=o({},e);return t.expiresAt=Date.now()+36e5,t},Je=function(e){return e.expiresAt<=Date.now()},Ye=we.getInstance(),Re=ye.getInstance(),Ve=function(){var e=Ye.get().settings,t=null==e?void 0:e.noCodeEvents.filter(function(e){var t;return"pageUrl"===(null==(t=e.noCodeConfig)?void 0:t.type)});if(Re.debug("checking page url"),0!==t.length)for(var n,r=s(t);!(n=r()).done;){var o=n.value,i=o.noCodeConfig.pageUrl;i&&Qe(window.location.href,i.value,i.rule)&&ze(o.name)}};function Qe(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 Xe=function(e){var t=Ye.get().settings,n=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"innerHtml"===(null==(t=e.noCodeConfig)?void 0:t.type)}),r=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"cssSelector"===(null==(t=e.noCodeConfig)?void 0:t.type)}),o=e.target;n.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.innerHtml;n&&o.innerHTML===n.value&&ze(e.name)}),r.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.cssSelector;n&&o.matches(n.value)&&ze(e.name)})},$e=we.getInstance(),Ge=ye.getInstance(),Ke=function(){if(!($e.get().apiHost&&$e.get().environmentId&&$e.get().person&&$e.get().session&&$e.get().settings))throw Error("Formbricks: Formbricks not initialized. Call initialize() first.")},Ze=new r,et=function(e,t){Ze.add(function(){try{return Ke(),Promise.resolve(function(e,t){try{return Oe.debug("setting attribute: "+e+" to value: "+t),Ae(e,t)?(Oe.debug("attribute already set to this value. Skipping update."),Promise.resolve()):Promise.resolve(function(e,t){try{return Fe.get().person&&Fe.get().person.id?Promise.resolve(fetch(Fe.get().apiHost+"/api/v1/client/environments/"+Fe.get().environmentId+"/people/"+Fe.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 Oe.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 Oe.error("Error updating attribute"),new Error("Formbricks: Error updating attribute");Fe.update({person:t,settings:n})})}catch(e){return Promise.reject(e)}}(e,t)).then(function(){})}catch(e){return Promise.reject(e)}})},tt={init:function(e){Ze.add(function(){try{return function(e){try{var t,n=function(e){if(t)return e;(function(){if("undefined"!=typeof window){var e=window.setInterval(function(){try{return Promise.resolve(function(){try{var e=function(e){Me.debug("Session not expired, extending session"),De.update({session:Be(De.get().session)})};Me.debug("Checking session");var t=function(){if(Je(De.get().session))return Me.debug("Session expired, creating new session"),Promise.resolve(We()).then(function(e){var t=e.session,n=e.settings;if(!t||!n)throw Me.error("Error creating new session"),Error("Error creating new session");De.update({session:t,settings:n}),ze("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",Ve),window.addEventListener("popstate",Ve),window.addEventListener("pushstate",Ve),window.addEventListener("replacestate",Ve),window.addEventListener("load",Ve)),"undefined"!=typeof window&&document.addEventListener("click",Xe),Ge.debug("Initialized")};if(!e.environmentId)throw Error("Formbricks: environmentId is required");if(!e.apiHost)throw Error("Formbricks: apiHost is required");e.logLevel&&Ge.configure({logLevel:e.logLevel}),He(),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 :is(.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 :is(.fb-pointer-events-none){pointer-events:none}#fbjs :is(.fb-pointer-events-auto){pointer-events:auto}#fbjs :is(.fb-fixed){position:fixed}#fbjs :is(.fb-absolute){position:absolute}#fbjs :is(.fb-relative){position:relative}#fbjs :is(.fb-inset-0){inset:0}#fbjs :is(.fb-right-0){right:0}#fbjs :is(.fb-top-0){top:0}#fbjs :is(.fb-z-10){z-index:10}#fbjs :is(.fb-mb-\\[10px\\]){margin-bottom:10px}#fbjs :is(.fb-ml-3){margin-left:.75rem}#fbjs :is(.fb-mr-8){margin-right:2rem}#fbjs :is(.fb-mt-2){margin-top:.5rem}#fbjs :is(.fb-mt-4){margin-top:1rem}#fbjs :is(.fb-mt-\\[35px\\]){margin-top:35px}#fbjs :is(.fb-block){display:block}#fbjs :is(.fb-inline-block){display:inline-block}#fbjs :is(.fb-flex){display:flex}#fbjs :is(.fb-hidden){display:none}#fbjs :is(.fb-h-1){height:.25rem}#fbjs :is(.fb-h-24){height:6rem}#fbjs :is(.fb-h-4){height:1rem}#fbjs :is(.fb-h-6){height:1.5rem}#fbjs :is(.fb-h-\\[2px\\]){height:2px}#fbjs :is(.fb-w-16){width:4rem}#fbjs :is(.fb-w-24){width:6rem}#fbjs :is(.fb-w-4){width:1rem}#fbjs :is(.fb-w-4\\/5){width:80%}#fbjs :is(.fb-w-6){width:1.5rem}#fbjs :is(.fb-w-full){width:100%}#fbjs :is(.fb-max-w-sm){max-width:24rem}#fbjs :is(.fb-translate-x-0){--tw-translate-x:0px;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 :is(.fb-translate-x-28){--tw-translate-x:7rem;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))}@keyframes fb-pulse{50%{opacity:.5}}#fbjs :is(.fb-animate-pulse){animation:fb-pulse 2s cubic-bezier(.4,0,.6,1) infinite}#fbjs :is(.fb-cursor-pointer){cursor:pointer}#fbjs :is(.fb-flex-col){flex-direction:column}#fbjs :is(.fb-items-end){align-items:flex-end}#fbjs :is(.fb-items-center){align-items:center}#fbjs :is(.fb-justify-center){justify-content:center}#fbjs :is(.fb-justify-between){justify-content:space-between}#fbjs :is(.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 :is(.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 :is(.fb-overflow-hidden){overflow:hidden}#fbjs :is(.fb-rounded-\\[100\\%\\]){border-radius:100%}#fbjs :is(.fb-rounded-full){border-radius:9999px}#fbjs :is(.fb-rounded-lg){border-radius:.5rem}#fbjs :is(.fb-rounded-md){border-radius:.375rem}#fbjs :is(.fb-border){border-width:1px}#fbjs :is(.fb-border-gray-200){--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-100){--tw-border-opacity:1;border-color:rgb(241 245 249/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-300){--tw-border-opacity:1;border-color:rgb(203 213 225/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-400){--tw-border-opacity:1;border-color:rgb(148 163 184/var(--tw-border-opacity))}#fbjs :is(.fb-border-transparent){border-color:transparent}#fbjs :is(.fb-bg-slate-300){--tw-bg-opacity:1;background-color:rgb(203 213 225/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-slate-50){--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-white){--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}#fbjs :is(.fb-p-2){padding:.5rem}#fbjs :is(.fb-p-4){padding:1rem}#fbjs :is(.fb-px-3){padding-left:.75rem;padding-right:.75rem}#fbjs :is(.fb-px-4){padding-left:1rem;padding-right:1rem}#fbjs :is(.fb-py-3){padding-bottom:.75rem;padding-top:.75rem}#fbjs :is(.fb-py-6){padding-bottom:1.5rem;padding-top:1.5rem}#fbjs :is(.fb-pr-4){padding-right:1rem}#fbjs :is(.fb-pt-4){padding-top:1rem}#fbjs :is(.fb-text-center){text-align:center}#fbjs :is(.fb-font-sans){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}#fbjs :is(.fb-text-base){font-size:1rem;line-height:1.5rem}#fbjs :is(.fb-text-sm){font-size:.875rem;line-height:1.25rem}#fbjs :is(.fb-text-xs){font-size:.75rem;line-height:1rem}#fbjs :is(.fb-font-medium){font-weight:500}#fbjs :is(.fb-font-normal){font-weight:400}#fbjs :is(.fb-font-semibold){font-weight:600}#fbjs :is(.fb-leading-4){line-height:1rem}#fbjs :is(.fb-leading-6){line-height:1.5rem}#fbjs :is(.fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-500){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-800){--tw-text-opacity:1;color:rgb(30 41 59/var(--tw-text-opacity))}#fbjs :is(.fb-text-white){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}#fbjs :is(.fb-opacity-0){opacity:0}#fbjs :is(.fb-opacity-100){opacity:1}#fbjs :is(.fb-opacity-60){opacity:.6}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.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 :is(.fb-ring-black){--tw-ring-opacity:1;--tw-ring-color:rgb(0 0 0/var(--tw-ring-opacity))}#fbjs :is(.fb-ring-opacity-5){--tw-ring-opacity:0.05}#fbjs :is(.fb-transition-all){transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.fb-duration-500){transition-duration:.5s}#fbjs :is(.fb-ease-in-out){transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.hover\\:fb-text-slate-500:hover){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.hover\\:fb-opacity-90:hover){opacity:.9}#fbjs :is(.focus\\:fb-border-slate-500:focus){--tw-border-opacity:1;border-color:rgb(100 116 139/var(--tw-border-opacity))}#fbjs :is(.focus\\:fb-outline-none:focus){outline:2px solid transparent;outline-offset:2px}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.focus\\:fb-ring-slate-500:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(100 116 139/var(--tw-ring-opacity))}#fbjs :is(.focus\\:fb-ring-offset-0:focus){--tw-ring-offset-width:0px}#fbjs :is(.focus\\:fb-ring-offset-2:focus){--tw-ring-offset-width:2px}@media (min-width:640px){#fbjs :is(.sm\\:fb-block){display:block}#fbjs :is(.sm\\:fb-items-end){align-items:flex-end}#fbjs :is(.sm\\:fb-p-6){padding:1.5rem}#fbjs :is(.sm\\:fb-text-sm){font-size:.875rem;line-height:1.25rem}}',document.head.appendChild(e)}}();var r=$e&&$e.get().environmentId===e.environmentId&&$e.get().apiHost===e.apiHost?$e.get().session&&Je($e.get().session)?Promise.resolve(We()).then(function(e){var t=e.settings;$e.update({session:Be(e.session),settings:t}),ze("New Session")}):$e.get().session?void 0:(Ge.error("Unable to initialize. No session found"),void(t=1)):($e.update({environmentId:e.environmentId,apiHost:e.apiHost}),Promise.resolve(Ue()).then(function(e){var t=e.settings;$e.update({person:e.person,session:Be(e.session),settings:t}),ze("New Session")}));Promise.resolve(r&&r.then?r.then(n):n(r))}catch(e){return Promise.reject(e)}}(e),Promise.resolve()}catch(e){return Promise.reject(e)}})},setUserId:function(e){Ze.add(function(){try{return Ke(),Promise.resolve(function(e){try{return Oe.debug("setting userId: "+e),Ae("userId",e)?(Oe.debug("userId already set to this value. Skipping update."),Promise.resolve()):(t=Fe.get().person.attributes.find(function(e){var t;return"userId"===(null==(t=e.attributeClass)?void 0:t.name)}),t?(Oe.error("userId cannot be changed after it has been set. You need to reset first"),Promise.resolve()):Promise.resolve(function(e){try{return Fe.get().person&&Fe.get().person.id?Promise.resolve(fetch(Fe.get().apiHost+"/api/v1/client/environments/"+Fe.get().environmentId+"/people/"+Fe.get().person.id+"/user-id",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,sessionId:Fe.get().session.id})})).then(function(e){if(!e.ok)throw Oe.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){Fe.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){et("email",e)},setAttribute:et,track:function(e,t){void 0===t&&(t={}),Ze.add(function(){try{return Ke(),Promise.resolve(ze(e,t)).then(function(){})}catch(e){return Promise.reject(e)}})},logout:function(){Ze.add(function(){try{return Ke(),Promise.resolve(function(){try{return Oe.debug("Resetting person. Getting new person, session and settings from backend"),Promise.resolve(Ue()).then(function(e){var t=e.person,n=e.session,r=e.settings;if(!t||!n||!r)throw Oe.error("Error resetting user"),new Error("Formbricks: Error resetting user");Fe.update({person:t,session:n,settings:r})})}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}})},refresh:function(){Ze.add(function(){try{return Ke(),Promise.resolve(function(){try{return je.debug("Refreshing - getting settings from backend"),Promise.resolve(ke()).then(function(e){xe.update({settings:e})})}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}})},registerRouteChange:function(){Ze.add(function(){try{return Ke(),Ve(),Promise.resolve()}catch(e){return Promise.reject(e)}})}};module.exports=tt;
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(b):1===s?f.then(c):(void 0).then(function(){(a=r())?a.then?a.then(b).then(void 0,u):b(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(b).then(void 0,u);n(f=i())&&(f=f.v)}while(!f||!f.then);f.then(c).then(void 0,u)}function b(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,b,d,p={},h=[],_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function g(e,t){for(var n in t)e[n]=t[n];return e}function m(e){var t=e.parentNode;t&&t.removeChild(e)}function v(e,t,n){var r,o,i,s={};for(i in t)"key"==i?r=t[i]:"ref"==i?o=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?a.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===s[i]&&(s[i]=e.defaultProps[i]);return w(e,s,r,o,null)}function w(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?++l:o};return null==o&&null!=f.vnode&&f.vnode(i),i}function y(e){return e.children}function j(e,t){this.props=e,this.context=t}function x(e,t){if(null==t)return e.__?x(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?x(e):null}function k(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 k(e)}}function C(e){(!e.__d&&(e.__d=!0)&&u.push(e)&&!P.__r++||c!==f.debounceRendering)&&((c=f.debounceRendering)||b)(P)}function P(){var e,t,n,r,o,i,s,a;for(u.sort(d);e=u.shift();)e.__d&&(t=u.length,r=void 0,o=void 0,s=(i=(n=e).__v).__e,(a=n.__P)&&(r=[],(o=g({},i)).__v=i.__v+1,L(a,i,o,n.__n,void 0!==a.ownerSVGElement,null!=i.__h?[s]:null,r,null==s?x(i):s,i.__h),F(r,i),i.__e!=s&&k(i)),u.length>t&&u.sort(d));P.__r=0}function N(e,t,n,r,o,i,s,a,f,l){var u,c,b,d,_,g,m,v=r&&r.__k||h,j=v.length;for(n.__k=[],u=0;u<t.length;u++)if(null!=(d=n.__k[u]=null==(d=t[u])||"boolean"==typeof d||"function"==typeof d?null:"string"==typeof d||"number"==typeof d||"bigint"==typeof d?w(null,d,null,null,d):Array.isArray(d)?w(y,{children:d},null,null,null):d.__b>0?w(d.type,d.props,d.key,d.ref?d.ref:null,d.__v):d)){if(d.__=n,d.__b=n.__b+1,null===(b=v[u])||b&&d.key==b.key&&d.type===b.type)v[u]=void 0;else for(c=0;c<j;c++){if((b=v[c])&&d.key==b.key&&d.type===b.type){v[c]=void 0;break}b=null}L(e,d,b=b||p,o,i,s,a,f,l),_=d.__e,(c=d.ref)&&b.ref!=c&&(m||(m=[]),b.ref&&m.push(b.ref,null,d),m.push(c,d.__c||_,d)),null!=_?(null==g&&(g=_),"function"==typeof d.type&&d.__k===b.__k?d.__d=f=S(d,f,e):f=I(e,d,b,v,_,f),"function"==typeof n.type&&(n.__d=f)):f&&b.__e==f&&f.parentNode!=e&&(f=x(b))}for(n.__e=g,u=j;u--;)null!=v[u]&&("function"==typeof n.type&&null!=v[u].__e&&v[u].__e==n.__d&&(n.__d=E(r).nextSibling),A(v[u],v[u]));if(m)for(u=0;u<m.length;u++)U(m[u],m[++u],m[++u])}function S(e,t,n){for(var r,o=e.__k,i=0;o&&i<o.length;i++)(r=o[i])&&(r.__=e,t="function"==typeof r.type?S(r,t,n):I(n,r,r,o,r.__e,t));return t}function I(e,t,n,r,o,i){var s,a,f;if(void 0!==t.__d)s=t.__d,t.__d=void 0;else if(null==n||o!=i||null==o.parentNode)e:if(null==i||i.parentNode!==e)e.appendChild(o),s=null;else{for(a=i,f=0;(a=a.nextSibling)&&f<r.length;f+=1)if(a==o)break e;e.insertBefore(o,i),s=i}return void 0!==s?s:o.nextSibling}function E(e){var t,n,r;if(null==e.type||"string"==typeof e.type)return e.__e;if(e.__k)for(t=e.__k.length-1;t>=0;t--)if((n=e.__k[t])&&(r=E(n)))return r;return null}function q(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||_.test(t)?n:n+"px"}function H(e,t,n,r,o){var i;e:if("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||q(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||q(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])i=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r||e.addEventListener(t,i?z:T,i):e.removeEventListener(t,i?z:T,i);else if("dangerouslySetInnerHTML"!==t){if(o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function T(e){return this.l[e.type+!1](f.event?f.event(e):e)}function z(e){return this.l[e.type+!0](f.event?f.event(e):e)}function L(e,t,n,r,o,i,s,a,l){var u,c,b,d,p,h,_,m,v,w,x,k,C,P,S,I=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(l=n.__h,a=t.__e=n.__e,t.__h=null,i=[a]),(u=f.__b)&&u(t);try{e:if("function"==typeof I){if(m=t.props,v=(u=I.contextType)&&r[u.__c],w=u?v?v.props.value:u.__:r,n.__c?_=(c=t.__c=n.__c).__=c.__E:("prototype"in I&&I.prototype.render?t.__c=c=new I(m,w):(t.__c=c=new j(m,w),c.constructor=I,c.render=M),v&&v.sub(c),c.props=m,c.state||(c.state={}),c.context=w,c.__n=r,b=c.__d=!0,c.__h=[],c._sb=[]),null==c.__s&&(c.__s=c.state),null!=I.getDerivedStateFromProps&&(c.__s==c.state&&(c.__s=g({},c.__s)),g(c.__s,I.getDerivedStateFromProps(m,c.__s))),d=c.props,p=c.state,c.__v=t,b)null==I.getDerivedStateFromProps&&null!=c.componentWillMount&&c.componentWillMount(),null!=c.componentDidMount&&c.__h.push(c.componentDidMount);else{if(null==I.getDerivedStateFromProps&&m!==d&&null!=c.componentWillReceiveProps&&c.componentWillReceiveProps(m,w),!c.__e&&null!=c.shouldComponentUpdate&&!1===c.shouldComponentUpdate(m,c.__s,w)||t.__v===n.__v){for(t.__v!==n.__v&&(c.props=m,c.state=c.__s,c.__d=!1),c.__e=!1,t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(e){e&&(e.__=t)}),x=0;x<c._sb.length;x++)c.__h.push(c._sb[x]);c._sb=[],c.__h.length&&s.push(c);break e}null!=c.componentWillUpdate&&c.componentWillUpdate(m,c.__s,w),null!=c.componentDidUpdate&&c.__h.push(function(){c.componentDidUpdate(d,p,h)})}if(c.context=w,c.props=m,c.__P=e,k=f.__r,C=0,"prototype"in I&&I.prototype.render){for(c.state=c.__s,c.__d=!1,k&&k(t),u=c.render(c.props,c.state,c.context),P=0;P<c._sb.length;P++)c.__h.push(c._sb[P]);c._sb=[]}else do{c.__d=!1,k&&k(t),u=c.render(c.props,c.state,c.context),c.state=c.__s}while(c.__d&&++C<25);c.state=c.__s,null!=c.getChildContext&&(r=g(g({},r),c.getChildContext())),b||null==c.getSnapshotBeforeUpdate||(h=c.getSnapshotBeforeUpdate(d,p)),S=null!=u&&u.type===y&&null==u.key?u.props.children:u,N(e,Array.isArray(S)?S:[S],t,n,r,o,i,s,a,l),c.base=t.__e,t.__h=null,c.__h.length&&s.push(c),_&&(c.__E=c.__=null),c.__e=!1}else null==i&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=O(n.__e,t,n,r,o,i,s,l);(u=f.diffed)&&u(t)}catch(e){t.__v=null,(l||null!=i)&&(t.__e=a,t.__h=!!l,i[i.indexOf(a)]=null),f.__e(e,t,n)}}function F(e,t){f.__c&&f.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){f.__e(e,t.__v)}})}function O(e,t,n,r,o,i,s,f){var l,u,c,b=n.props,d=t.props,h=t.type,_=0;if("svg"===h&&(o=!0),null!=i)for(;_<i.length;_++)if((l=i[_])&&"setAttribute"in l==!!h&&(h?l.localName===h:3===l.nodeType)){e=l,i[_]=null;break}if(null==e){if(null===h)return document.createTextNode(d);e=o?document.createElementNS("http://www.w3.org/2000/svg",h):document.createElement(h,d.is&&d),i=null,f=!1}if(null===h)b===d||f&&e.data===d||(e.data=d);else{if(i=i&&a.call(e.childNodes),u=(b=n.props||p).dangerouslySetInnerHTML,c=d.dangerouslySetInnerHTML,!f){if(null!=i)for(b={},_=0;_<e.attributes.length;_++)b[e.attributes[_].name]=e.attributes[_].value;(c||u)&&(c&&(u&&c.__html==u.__html||c.__html===e.innerHTML)||(e.innerHTML=c&&c.__html||""))}if(function(e,t,n,r,o){var i;for(i in n)"children"===i||"key"===i||i in t||H(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]||H(e,i,t[i],n[i],r)}(e,d,b,o,f),c)t.__k=[];else if(_=t.props.children,N(e,Array.isArray(_)?_:[_],t,n,r,o&&"foreignObject"!==h,i,s,i?i[0]:n.__k&&x(n,0),f),null!=i)for(_=i.length;_--;)null!=i[_]&&m(i[_]);f||("value"in d&&void 0!==(_=d.value)&&(_!==e.value||"progress"===h&&!_||"option"===h&&_!==b.value)&&H(e,"value",_,b.value,!1),"checked"in d&&void 0!==(_=d.checked)&&_!==e.checked&&H(e,"checked",_,b.checked,!1))}return e}function U(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){f.__e(e,n)}}function A(e,t,n){var r,o;if(f.unmount&&f.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||U(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){f.__e(e,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&A(r[o],t,n||"function"!=typeof e.type);n||null==e.__e||m(e.__e),e.__=e.__e=e.__d=void 0}function M(e,t,n){return this.constructor(e,n)}a=h.slice,f={__e:function(e,t,n,r){for(var o,i,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&null!=i.getDerivedStateFromError&&(o.setState(i.getDerivedStateFromError(e)),s=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,r||{}),s=o.__d),s)return o.__E=o}catch(t){e=t}throw e}},l=0,j.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=g({},this.state),"function"==typeof e&&(e=e(g({},n),this.props)),e&&g(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),C(this))},j.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),C(this))},j.prototype.render=y,u=[],b="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,d=function(e,t){return e.__v.__b-t.__v.__b},P.__r=0;var D,W,B,J,Y=0,Q=[],R=[],V=f.__b,X=f.__r,$=f.diffed,G=f.__c,K=f.unmount;function Z(e,t){f.__h&&f.__h(W,e,Y||t),Y=0;var n=W.__H||(W.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:R}),n.__[e]}function ee(e){return Y=1,function(e,t,n){var r=Z(D++,2);if(r.t=e,!r.__c&&(r.__=[ae(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=W,!W.u)){var o=function(e,t,n){if(!r.__c.__H)return!0;var o=r.__c.__H.__.filter(function(e){return e.__c});if(o.every(function(e){return!e.__N}))return!i||i.call(this,e,t,n);var s=!1;return o.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}}),!(!s&&r.__c.props===e)&&(!i||i.call(this,e,t,n))};W.u=!0;var i=W.shouldComponentUpdate,s=W.componentWillUpdate;W.componentWillUpdate=function(e,t,n){if(this.__e){var r=i;i=void 0,o(e,t,n),i=r}s&&s.call(this,e,t,n)},W.shouldComponentUpdate=o}return r.__N||r.__}(ae,e)}function te(e,t){var n=Z(D++,3);!f.__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.i=t,W.__H.__h.push(n))}function ne(){for(var e;e=Q.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ie),e.__H.__h.forEach(se),e.__H.__h=[]}catch(t){e.__H.__h=[],f.__e(t,e.__v)}}f.__b=function(e){W=null,V&&V(e)},f.__r=function(e){X&&X(e),D=0;var t=(W=e.__c).__H;t&&(B===W?(t.__h=[],W.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.__V=R,e.__N=e.i=void 0})):(t.__h.forEach(ie),t.__h.forEach(se),t.__h=[])),B=W},f.diffed=function(e){$&&$(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==Q.push(t)&&J===f.requestAnimationFrame||((J=f.requestAnimationFrame)||oe)(ne)),t.__H.__.forEach(function(e){e.i&&(e.__H=e.i),e.__V!==R&&(e.__=e.__V),e.i=void 0,e.__V=R})),B=W=null},f.__c=function(e,t){t.some(function(e){try{e.__h.forEach(ie),e.__h=e.__h.filter(function(e){return!e.__||se(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],f.__e(n,e.__v)}}),G&&G(e,t)},f.unmount=function(e){K&&K(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{ie(e)}catch(e){t=e}}),n.__H=void 0,t&&f.__e(t,n.__v))};var re="function"==typeof requestAnimationFrame;function oe(e){var t,n=function(){clearTimeout(r),re&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);re&&(t=requestAnimationFrame(n))}function ie(e){var t=W,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),W=t}function se(e){var t=W;e.__c=e.__(),W=t}function ae(e,t){return"function"==typeof t?t(e):t}var fe=function(){return[].slice.call(arguments).filter(Boolean).join(" ")};function le(e){var t=e.children,n=e.isOpen,r=e.close,o=ee(!1),i=o[0],s=o[1];return te(function(){s(n)},[n]),v("div",{"aria-live":"assertive",className:"fb-pointer-events-none fb-fixed fb-inset-0 fb-flex fb-items-end"},v("div",{className:"fb-flex fb-w-full fb-flex-col fb-items-center fb-space-y-4 sm:fb-items-end"},v("div",{className:fe(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 fb-z-40 fb-m-4")},v("div",{class:"fb-absolute fb-top-0 fb-right-0 fb-hidden fb-pt-4 fb-pr-4 sm:fb-block"},v("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 fb-text-slate-400 hover:fb-text-slate-500 focus:ring-slate-500"},v("span",{class:"fb-sr-only"},"Close"),v("svg",{class:"fb-h-6 fb-w-6",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},v("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})))),v("div",{className:""},t))))}var ue=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)}},ce=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 be(e){return v("div",{className:"fb-h-1 fb-w-full fb-rounded-full bg-slate-200"},v("div",{className:"fb-h-1 fb-rounded-full",style:{backgroundColor:e.brandColor,width:Math.floor(100*e.progress)+"%"}}))}function de(e){return v("label",{htmlFor:e.questionId,className:"fb-mb-1.5 fb-block fb-text-base fb-font-semibold fb-leading-6 fb-mr-8 text-slate-900",style:e.style},e.headline)}function pe(e){return v("label",{for:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600"},e.subheader)}function he(e){var t=e.headline,n=e.subheader;return v("div",{className:"fb-text-center"},v("div",{className:"fb-flex fb-items-center fb-justify-center",style:{color:e.brandColor}},v("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"fb-h-24 fb-w-24"},v("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))),v("span",{className:"fb-inline-block fb-rounded-[100%] fb-w-16 fb-h-1 fb-mb-[10px] fb-bg-slate-300"}),v("div",null,v(de,{headline:t,questionId:"thankYouCard",style:{"margin-right":0}}),v(pe,{subheader:n,questionId:"thankYouCard"})))}function _e(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return v("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)}},v(de,{headline:t.headline,questionId:t.id}),v(pe,{subheader:t.subheader,questionId:t.id}),v("div",{className:"fb-mt-4"},v("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 fb-bg-slate-50 fb-border-slate-100 focus:fb-border-slate-500"})),v("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},v("div",null),v("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:fb-ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function ge(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ee(null),s=i[0],a=i[1];return v("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);n(o),a(null)}},v(de,{headline:t.headline,questionId:t.id}),v(pe,{subheader:t.subheader,questionId:t.id}),v("div",{className:"fb-mt-4"},v("fieldset",null,v("legend",{className:"fb-sr-only"},"Choices"),v("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e,n){return v("label",{key:e.id,className:fe(s===e.label?"fb-z-10 fb-bg-slate-50 fb-border-slate-400":"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")},v("span",{className:"fb-flex fb-items-center fb-text-sm"},v("input",{type:"radio",id:e.id,name:t.id,value:e.label,className:"fb-h-4 fb-w-4 fb-border fb-border-slate-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":e.id+"-label",onChange:function(e){a(e.currentTarget.value)},checked:s===e.label,style:{borderColor:o,color:o},required:t.required&&0===n}),v("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),v("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},v("div",null),v("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 me(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ee([]),s=i[0],a=i[1],f=function(){return s.length>0};return v("form",{onSubmit:function(e){var r;if(e.preventDefault(),f()||!t.required){var o=((r={})[t.id]=s,r);n(o),a([])}}},v(de,{headline:t.headline,questionId:t.id}),v(pe,{subheader:t.subheader,questionId:t.id}),v("div",{className:"fb-mt-4"},v("fieldset",null,v("legend",{className:"fb-sr-only"},"Choices"),v("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e){return v("label",{key:e.id,className:fe(s.includes(e.label)?"fb-z-10 fb-border-slate-400 fb-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 hover:fb-bg-slate-50 focus:fb-outline-none")},v("span",{className:"fb-flex fb-items-center fb-text-sm"},v("input",{type:"checkbox",id:e.id,name:t.id,value:e.label,className:"fb-h-4 fb-w-4 fb-border fb-border-slate-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":e.id+"-label",onChange:function(e){a(e.currentTarget.checked?[].concat(s,[e.currentTarget.value]):s.filter(function(t){return t!==e.currentTarget.value}))},checked:s.includes(e.label),style:{borderColor:o,color:o}}),v("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),v("input",{type:"text",className:"clip-[rect(0,0,0,0)] fb-absolute fb-m-[-1px] fb-h-1 fb-w-1 fb-overflow-hidden fb-whitespace-nowrap fb-border-0 fb-p-0 fb-text-transparent fb-caret-transparent focus:fb-border-transparent focus:fb-ring-0",required:t.required,value:f()?"checked":""}),v("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},v("div",null),v("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 ve(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ee(null),s=i[0],a=i[1];return v("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=s,r);n(o)}},v(de,{headline:t.headline,questionId:t.id}),v(pe,{subheader:t.subheader,questionId:t.id}),v("div",{className:"fb-my-4"},v("fieldset",null,v("legend",{className:"fb-sr-only"},"Choices"),v("div",{className:"fb-flex"},Array.from({length:11},function(e,t){return t}).map(function(e){return v("label",{key:e,className:fe(s===e?"fb-z-10 fb-border-slate-400 fb-bg-slate-50":"","fb-relative fb-h-10 fb-flex-1 fb-cursor-pointer fb-border fb-bg-white fb-text-center fb-text-sm fb-leading-10 fb-hover:bg-gray-100 fb-focus:outline-none")},v("input",{type:"radio",name:"nps",value:e,className:"fb-absolute fb-h-full fb-w-full fb-cursor-pointer fb-opacity-0",onChange:function(){return a(e)},required:t.required}),e)})),v("div",{className:"fb-flex fb-justify-between fb-text-sm fb-font-semibold fb-leading-6"},v("p",null,t.lowerLabel),v("p",null,t.upperLabel)))),v("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},v("div",null),v("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 fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function we(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return"openText"===t.type?v(_e,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceSingle"===t.type?v(ge,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceMulti"===t.type?v(me,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"nps"===t.type?v(ve,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):null}function ye(e){var t,n=e.config,r=e.survey,o=e.close,i=e.brandColor,s=ee(r.questions[0].id),a=s[0],f=s[1],l=ee(0),u=l[0],c=l[1],b=ee(null),d=b[0],p=b[1],h=ee(null),_=h[0],g=h[1],m=ee(!1),w=m[0],y=m[1];te(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:r.id,personId:n.person.id},n)).then(function(e){g(e.id)})}catch(e){return Promise.reject(e)}}(),console.log(r)},[n,r]),te(function(){var e;c((e=r.questions.findIndex(function(e){return e.id===a}),e/r.questions.length))},[a,r]);var j=function(e){try{var t=function(){y(!1),s?(c(100),r.thankYouCard.enabled?setTimeout(function(){o()},2e3):o()):f(r.questions[i+1].id)};y(!0);var i=r.questions.findIndex(function(e){return e.id===a}),s=i===r.questions.length-1,l={surveyId:r.id,personId:n.person.id,response:{finished:s,data:e}},u=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,n)).then(function(){}):Promise.resolve(Promise.all([ce(l,n),ue(_,n)])).then(function(e){p(e[0].id)});return Promise.resolve(u&&u.then?u.then(t):t())}catch(e){return Promise.reject(e)}};return v("div",null,v("div",{className:fe(w?"fb-animate-pulse fb-opacity-60":"","fb-text-slate-800 fb-font-sans fb-px-4 fb-py-6 sm:fb-p-6")},100===u&&r.thankYouCard.enabled?v(he,{headline:r.thankYouCard.headline,subheader:r.thankYouCard.subheader,brandColor:null==(t=n.settings)?void 0:t.brandColor}):r.questions.map(function(e,t){return a===e.id&&v(we,{key:e.id,brandColor:i,lastQuestion:t===r.questions.length-1,onSubmit:j,question:e})})),v(be,{progress:u,brandColor:i}))}function je(e){var t,n=e.config,r=e.survey,o=e.closeSurvey,i=ee(!0),s=i[1],a=function(){s(!1),setTimeout(function(){o()},1e3)};return v("div",{id:"fbjs"},v(le,{isOpen:i[0],close:a},v(ye,{config:n,survey:r,close:a,brandColor:null==(t=n.settings)?void 0:t.brandColor})))}var xe=/*#__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}();xe.instance=void 0;var ke=/*#__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}();ke.instance=void 0;var Ce=ke.getInstance(),Pe=xe.getInstance(),Ne=function(){try{return Promise.resolve(fetch(Pe.get().apiHost+"/api/v1/client/environments/"+Pe.get().environmentId+"/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:Pe.get().person.id})})).then(function(e){if(!e.ok)throw Ce.error("Error getting settings"),Error("Error getting settings");return e.json()})}catch(e){return Promise.reject(e)}},Se="formbricks-web-container",Ie=xe.getInstance(),Ee=ke.getInstance(),qe=!1,He=function(e){qe?Ee.debug("A survey is already running. Skipping."):(qe=!0,function(e,t,n){var r,o;f.__&&f.__(e,t),r=t.__k,o=[],L(t,e=t.__k=v(y,null,[e]),r||p,p,void 0!==t.ownerSVGElement,r?null:t.firstChild?a.call(t.childNodes):null,o,r?r.__e:t.firstChild,!1),F(o,e)}(v(je,{config:Ie.get(),survey:e,closeSurvey:Te}),document.getElementById(Se)))},Te=function(){try{return document.getElementById(Se).remove(),ze(),Promise.resolve(Ne()).then(function(e){Ie.update({settings:e}),qe=!1})}catch(e){return Promise.reject(e)}},ze=function(){var e=document.createElement("div");e.id=Se,document.body.appendChild(e)},Le=ke.getInstance(),Fe=xe.getInstance(),Oe=function(e,t){try{return Promise.resolve(fetch(Fe.get().apiHost+"/api/v1/client/environments/"+Fe.get().environmentId+"/events",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:Fe.get().session.id,eventName:e,properties:t})})).then(function(t){var n;function r(t){if(n)return t;Le.debug('Formbricks: Event "'+e+'" tracked'),Ue(e)}var o=function(){if(!t.ok)return Promise.resolve(t.json()).then(function(e){Le.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)}},Ue=function(e){for(var t,n=s(null==(r=Fe.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 Le.debug("Formbricks: survey "+i.id+' triggered by event "'+e+'"'),void He(i)}},Ae=xe.getInstance(),Me=ke.getInstance(),De=function(){try{return Me.debug("Creating new person"),Promise.resolve(fetch(Ae.get().apiHost+"/api/v1/client/environments/"+Ae.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)}},We=function(e,t){var n=Ae.get().person.attributes.find(function(t){var n;return(null==(n=t.attributeClass)?void 0:n.name)===e});return!(!n||n.value!==t)},Be=ke.getInstance(),Je=xe.getInstance(),Ye=function(){try{return Je.get().person?Promise.resolve(fetch(Je.get().apiHost+"/api/v1/client/environments/"+Je.get().environmentId+"/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:Je.get().person.id})})).then(function(e){if(e.ok)return Promise.resolve(e.json());Be.error("Error creating session")}):(Be.error("Formbricks: Unable to create session. No person found"),Promise.resolve())}catch(e){return Promise.reject(e)}},Qe=function(e){Be.debug("Session expired. Creating new session.");var t=o({},e);return t.expiresAt=Date.now()+36e5,t},Re=function(e){return e.expiresAt<=Date.now()},Ve=xe.getInstance(),Xe=ke.getInstance(),$e=function(){var e=Ve.get().settings,t=null==e?void 0:e.noCodeEvents.filter(function(e){var t;return"pageUrl"===(null==(t=e.noCodeConfig)?void 0:t.type)});if(Xe.debug("checking page url"),0!==t.length)for(var n,r=s(t);!(n=r()).done;){var o=n.value,i=o.noCodeConfig.pageUrl;i&&Ge(window.location.href,i.value,i.rule)&&Oe(o.name)}};function Ge(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 Ke=function(e){var t=Ve.get().settings,n=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"innerHtml"===(null==(t=e.noCodeConfig)?void 0:t.type)}),r=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"cssSelector"===(null==(t=e.noCodeConfig)?void 0:t.type)}),o=e.target;n.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.innerHtml;n&&o.innerHTML===n.value&&Oe(e.name)}),r.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.cssSelector;n&&o.matches(n.value)&&Oe(e.name)})},Ze=xe.getInstance(),et=ke.getInstance(),tt=function(){if(!(Ze.get().apiHost&&Ze.get().environmentId&&Ze.get().person&&Ze.get().session&&Ze.get().settings))throw Error("Formbricks: Formbricks not initialized. Call initialize() first.")},nt=new r,rt=function(e,t){nt.add(function(){try{return tt(),Promise.resolve(function(e,t){try{return Me.debug("setting attribute: "+e+" to value: "+t),We(e,t)?(Me.debug("attribute already set to this value. Skipping update."),Promise.resolve()):Promise.resolve(function(e,t){try{return Ae.get().person&&Ae.get().person.id?Promise.resolve(fetch(Ae.get().apiHost+"/api/v1/client/environments/"+Ae.get().environmentId+"/people/"+Ae.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 Me.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 Me.error("Error updating attribute"),new Error("Formbricks: Error updating attribute");Ae.update({person:t,settings:n})})}catch(e){return Promise.reject(e)}}(e,t)).then(function(){})}catch(e){return Promise.reject(e)}})},ot={init:function(e){nt.add(function(){try{return function(e){try{var t,n=function(e){if(t)return e;(function(){if("undefined"!=typeof window){var e=window.setInterval(function(){try{return Promise.resolve(function(){try{var e=function(e){Be.debug("Session not expired, extending session"),Je.update({session:Qe(Je.get().session)})};Be.debug("Checking session");var t=function(){if(Re(Je.get().session))return Be.debug("Session expired, creating new session"),Promise.resolve(Ye()).then(function(e){var t=e.session,n=e.settings;if(!t||!n)throw Be.error("Error creating new session"),Error("Error creating new session");Je.update({session:t,settings:n}),Oe("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",$e),window.addEventListener("popstate",$e),window.addEventListener("pushstate",$e),window.addEventListener("replacestate",$e),window.addEventListener("load",$e)),"undefined"!=typeof window&&document.addEventListener("click",Ke),et.debug("Initialized")};if(!e.environmentId)throw Error("Formbricks: environmentId is required");if(!e.apiHost)throw Error("Formbricks: apiHost is required");e.logLevel&&et.configure({logLevel:e.logLevel}),ze(),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 :is(.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 :is(.fb-pointer-events-none){pointer-events:none}#fbjs :is(.fb-pointer-events-auto){pointer-events:auto}#fbjs :is(.fb-fixed){position:fixed}#fbjs :is(.fb-absolute){position:absolute}#fbjs :is(.fb-relative){position:relative}#fbjs :is(.fb-inset-0){inset:0}#fbjs :is(.fb-right-0){right:0}#fbjs :is(.fb-top-0){top:0}#fbjs :is(.fb-z-10){z-index:10}#fbjs :is(.fb-z-40){z-index:40}#fbjs :is(.fb-m-4){margin:1rem}#fbjs :is(.fb-m-\\[-1px\\]){margin:-1px}#fbjs :is(.fb-my-4){margin-bottom:1rem;margin-top:1rem}#fbjs :is(.fb-mb-1){margin-bottom:.25rem}#fbjs :is(.fb-mb-1\\.5){margin-bottom:.375rem}#fbjs :is(.fb-mb-\\[10px\\]){margin-bottom:10px}#fbjs :is(.fb-ml-3){margin-left:.75rem}#fbjs :is(.fb-mr-8){margin-right:2rem}#fbjs :is(.fb-mt-4){margin-top:1rem}#fbjs :is(.fb-mt-\\[35px\\]){margin-top:35px}#fbjs :is(.fb-block){display:block}#fbjs :is(.fb-inline-block){display:inline-block}#fbjs :is(.fb-flex){display:flex}#fbjs :is(.fb-hidden){display:none}#fbjs :is(.fb-h-1){height:.25rem}#fbjs :is(.fb-h-10){height:2.5rem}#fbjs :is(.fb-h-24){height:6rem}#fbjs :is(.fb-h-4){height:1rem}#fbjs :is(.fb-h-6){height:1.5rem}#fbjs :is(.fb-h-\\[2px\\]){height:2px}#fbjs :is(.fb-h-full){height:100%}#fbjs :is(.fb-w-1){width:.25rem}#fbjs :is(.fb-w-16){width:4rem}#fbjs :is(.fb-w-24){width:6rem}#fbjs :is(.fb-w-4){width:1rem}#fbjs :is(.fb-w-4\\/5){width:80%}#fbjs :is(.fb-w-6){width:1.5rem}#fbjs :is(.fb-w-full){width:100%}#fbjs :is(.fb-max-w-sm){max-width:24rem}#fbjs :is(.fb-flex-1){flex:1 1 0%}#fbjs :is(.fb-translate-x-0){--tw-translate-x:0px;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 :is(.fb-translate-x-28){--tw-translate-x:7rem;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))}@keyframes fb-pulse{50%{opacity:.5}}#fbjs :is(.fb-animate-pulse){animation:fb-pulse 2s cubic-bezier(.4,0,.6,1) infinite}#fbjs :is(.fb-cursor-pointer){cursor:pointer}#fbjs :is(.fb-flex-col){flex-direction:column}#fbjs :is(.fb-items-end){align-items:flex-end}#fbjs :is(.fb-items-center){align-items:center}#fbjs :is(.fb-justify-center){justify-content:center}#fbjs :is(.fb-justify-between){justify-content:space-between}#fbjs :is(.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 :is(.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 :is(.fb-overflow-hidden){overflow:hidden}#fbjs :is(.fb-whitespace-nowrap){white-space:nowrap}#fbjs :is(.fb-rounded-\\[100\\%\\]){border-radius:100%}#fbjs :is(.fb-rounded-full){border-radius:9999px}#fbjs :is(.fb-rounded-lg){border-radius:.5rem}#fbjs :is(.fb-rounded-md){border-radius:.375rem}#fbjs :is(.fb-border){border-width:1px}#fbjs :is(.fb-border-0){border-width:0}#fbjs :is(.fb-border-gray-200){--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-100){--tw-border-opacity:1;border-color:rgb(241 245 249/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-300){--tw-border-opacity:1;border-color:rgb(203 213 225/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-400){--tw-border-opacity:1;border-color:rgb(148 163 184/var(--tw-border-opacity))}#fbjs :is(.fb-border-transparent){border-color:transparent}#fbjs :is(.fb-bg-slate-300){--tw-bg-opacity:1;background-color:rgb(203 213 225/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-slate-50){--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-white){--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}#fbjs :is(.fb-p-0){padding:0}#fbjs :is(.fb-p-2){padding:.5rem}#fbjs :is(.fb-p-4){padding:1rem}#fbjs :is(.fb-px-3){padding-left:.75rem;padding-right:.75rem}#fbjs :is(.fb-px-4){padding-left:1rem;padding-right:1rem}#fbjs :is(.fb-py-3){padding-bottom:.75rem;padding-top:.75rem}#fbjs :is(.fb-py-6){padding-bottom:1.5rem;padding-top:1.5rem}#fbjs :is(.fb-pr-4){padding-right:1rem}#fbjs :is(.fb-pt-4){padding-top:1rem}#fbjs :is(.fb-text-center){text-align:center}#fbjs :is(.fb-font-sans){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}#fbjs :is(.fb-text-base){font-size:1rem;line-height:1.5rem}#fbjs :is(.fb-text-sm){font-size:.875rem;line-height:1.25rem}#fbjs :is(.fb-text-xs){font-size:.75rem;line-height:1rem}#fbjs :is(.fb-font-medium){font-weight:500}#fbjs :is(.fb-font-normal){font-weight:400}#fbjs :is(.fb-font-semibold){font-weight:600}#fbjs :is(.fb-leading-10){line-height:2.5rem}#fbjs :is(.fb-leading-4){line-height:1rem}#fbjs :is(.fb-leading-6){line-height:1.5rem}#fbjs :is(.fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-500){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-800){--tw-text-opacity:1;color:rgb(30 41 59/var(--tw-text-opacity))}#fbjs :is(.fb-text-transparent){color:transparent}#fbjs :is(.fb-text-white){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}#fbjs :is(.fb-caret-transparent){caret-color:transparent}#fbjs :is(.fb-opacity-0){opacity:0}#fbjs :is(.fb-opacity-100){opacity:1}#fbjs :is(.fb-opacity-60){opacity:.6}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.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 :is(.fb-ring-black){--tw-ring-opacity:1;--tw-ring-color:rgb(0 0 0/var(--tw-ring-opacity))}#fbjs :is(.fb-ring-opacity-5){--tw-ring-opacity:0.05}#fbjs :is(.fb-transition-all){transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.fb-duration-500){transition-duration:.5s}#fbjs :is(.fb-ease-in-out){transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.hover\\:fb-bg-slate-50:hover){--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity))}#fbjs :is(.hover\\:fb-text-slate-500:hover){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.hover\\:fb-opacity-90:hover){opacity:.9}#fbjs :is(.focus\\:fb-border-slate-500:focus){--tw-border-opacity:1;border-color:rgb(100 116 139/var(--tw-border-opacity))}#fbjs :is(.focus\\:fb-border-transparent:focus){border-color:transparent}#fbjs :is(.focus\\:fb-outline-none:focus){outline:2px solid transparent;outline-offset:2px}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.focus\\:fb-ring-slate-500:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(100 116 139/var(--tw-ring-opacity))}#fbjs :is(.focus\\:fb-ring-offset-0:focus){--tw-ring-offset-width:0px}#fbjs :is(.focus\\:fb-ring-offset-2:focus){--tw-ring-offset-width:2px}@media (min-width:640px){#fbjs :is(.sm\\:fb-block){display:block}#fbjs :is(.sm\\:fb-items-end){align-items:flex-end}#fbjs :is(.sm\\:fb-p-6){padding:1.5rem}#fbjs :is(.sm\\:fb-text-sm){font-size:.875rem;line-height:1.25rem}}',document.head.appendChild(e)}}();var r=Ze&&Ze.get().environmentId===e.environmentId&&Ze.get().apiHost===e.apiHost?Ze.get().session&&Re(Ze.get().session)?Promise.resolve(Ye()).then(function(e){var t=e.settings;Ze.update({session:Qe(e.session),settings:t}),Oe("New Session")}):Ze.get().session?void 0:(et.error("Unable to initialize. No session found"),void(t=1)):(Ze.update({environmentId:e.environmentId,apiHost:e.apiHost}),Promise.resolve(De()).then(function(e){var t=e.settings;Ze.update({person:e.person,session:Qe(e.session),settings:t}),Oe("New Session")}));Promise.resolve(r&&r.then?r.then(n):n(r))}catch(e){return Promise.reject(e)}}(e),Promise.resolve()}catch(e){return Promise.reject(e)}})},setUserId:function(e){nt.add(function(){try{return tt(),Promise.resolve(function(e){try{return Me.debug("setting userId: "+e),We("userId",e)?(Me.debug("userId already set to this value. Skipping update."),Promise.resolve()):(t=Ae.get().person.attributes.find(function(e){var t;return"userId"===(null==(t=e.attributeClass)?void 0:t.name)}),t?(Me.error("userId cannot be changed after it has been set. You need to reset first"),Promise.resolve()):Promise.resolve(function(e){try{return Ae.get().person&&Ae.get().person.id?Promise.resolve(fetch(Ae.get().apiHost+"/api/v1/client/environments/"+Ae.get().environmentId+"/people/"+Ae.get().person.id+"/user-id",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,sessionId:Ae.get().session.id})})).then(function(e){if(!e.ok)throw Me.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){Ae.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){rt("email",e)},setAttribute:rt,track:function(e,t){void 0===t&&(t={}),nt.add(function(){try{return tt(),Promise.resolve(Oe(e,t)).then(function(){})}catch(e){return Promise.reject(e)}})},logout:function(){nt.add(function(){try{return tt(),Promise.resolve(function(){try{return Me.debug("Resetting person. Getting new person, session and settings from backend"),Promise.resolve(De()).then(function(e){var t=e.person,n=e.session,r=e.settings;if(!t||!n||!r)throw Me.error("Error resetting user"),new Error("Formbricks: Error resetting user");Ae.update({person:t,session:n,settings:r})})}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}})},refresh:function(){nt.add(function(){try{return tt(),Promise.resolve(function(){try{return Ce.debug("Refreshing - getting settings from backend"),Promise.resolve(Ne()).then(function(e){Pe.update({settings:e})})}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}})},registerRouteChange:function(){nt.add(function(){try{return tt(),$e(),Promise.resolve()}catch(e){return Promise.reject(e)}})}};module.exports=ot;
//# sourceMappingURL=index.js.map

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

var e,t,n,o,r,s,i,a={},f=[],l=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function d(e,t){for(var n in t)e[n]=t[n];return e}function c(e){var t=e.parentNode;t&&t.removeChild(e)}function b(t,n,o){var r,s,i,a={};for(i in n)"key"==i?r=n[i]:"ref"==i?s=n[i]:a[i]=n[i];if(arguments.length>2&&(a.children=arguments.length>3?e.call(arguments,2):o),"function"==typeof t&&null!=t.defaultProps)for(i in t.defaultProps)void 0===a[i]&&(a[i]=t.defaultProps[i]);return u(t,a,r,s,null)}function u(e,o,r,s,i){var a={type:e,props:o,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==i?++n:i};return null==i&&null!=t.vnode&&t.vnode(a),a}function p(e){return e.children}function _(e,t){this.props=e,this.context=t}function g(e,t){if(null==t)return e.__?g(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?g(e):null}function h(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 h(e)}}function w(e){(!e.__d&&(e.__d=!0)&&o.push(e)&&!m.__r++||r!==t.debounceRendering)&&((r=t.debounceRendering)||s)(m)}function m(){var e,t,n,r,s,a,f,l;for(o.sort(i);e=o.shift();)e.__d&&(t=o.length,r=void 0,s=void 0,f=(a=(n=e).__v).__e,(l=n.__P)&&(r=[],(s=d({},a)).__v=a.__v+1,E(l,a,s,n.__n,void 0!==l.ownerSVGElement,null!=a.__h?[f]:null,r,null==f?g(a):f,a.__h),N(r,a),a.__e!=f&&h(a)),o.length>t&&o.sort(i));m.__r=0}function v(e,t,n,o,r,s,i,l,d,c){var b,_,h,w,m,v,k,C=o&&o.__k||f,I=C.length;for(n.__k=[],b=0;b<t.length;b++)if(null!=(w=n.__k[b]=null==(w=t[b])||"boolean"==typeof w||"function"==typeof w?null:"string"==typeof w||"number"==typeof w||"bigint"==typeof w?u(null,w,null,null,w):Array.isArray(w)?u(p,{children:w},null,null,null):w.__b>0?u(w.type,w.props,w.key,w.ref?w.ref:null,w.__v):w)){if(w.__=n,w.__b=n.__b+1,null===(h=C[b])||h&&w.key==h.key&&w.type===h.type)C[b]=void 0;else for(_=0;_<I;_++){if((h=C[_])&&w.key==h.key&&w.type===h.type){C[_]=void 0;break}h=null}E(e,w,h=h||a,r,s,i,l,d,c),m=w.__e,(_=w.ref)&&h.ref!=_&&(k||(k=[]),h.ref&&k.push(h.ref,null,w),k.push(_,w.__c||m,w)),null!=m?(null==v&&(v=m),"function"==typeof w.type&&w.__k===h.__k?w.__d=d=y(w,d,e):d=j(e,w,h,C,m,d),"function"==typeof n.type&&(n.__d=d)):d&&h.__e==d&&d.parentNode!=e&&(d=g(h))}for(n.__e=v,b=I;b--;)null!=C[b]&&("function"==typeof n.type&&null!=C[b].__e&&C[b].__e==n.__d&&(n.__d=x(o).nextSibling),q(C[b],C[b]));if(k)for(b=0;b<k.length;b++)T(k[b],k[++b],k[++b])}function y(e,t,n){for(var o,r=e.__k,s=0;r&&s<r.length;s++)(o=r[s])&&(o.__=e,t="function"==typeof o.type?y(o,t,n):j(n,o,o,r,o.__e,t));return t}function j(e,t,n,o,r,s){var i,a,f;if(void 0!==t.__d)i=t.__d,t.__d=void 0;else if(null==n||r!=s||null==r.parentNode)e:if(null==s||s.parentNode!==e)e.appendChild(r),i=null;else{for(a=s,f=0;(a=a.nextSibling)&&f<o.length;f+=1)if(a==r)break e;e.insertBefore(r,s),i=s}return void 0!==i?i:r.nextSibling}function x(e){var t,n,o;if(null==e.type||"string"==typeof e.type)return e.__e;if(e.__k)for(t=e.__k.length-1;t>=0;t--)if((n=e.__k[t])&&(o=x(n)))return o;return null}function k(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||l.test(t)?n:n+"px"}function C(e,t,n,o,r){var s;e:if("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||k(e.style,t,"");if(n)for(t in n)o&&n[t]===o[t]||k(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])s=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+s]=n,n?o||e.addEventListener(t,s?S:I,s):e.removeEventListener(t,s?S:I,s);else if("dangerouslySetInnerHTML"!==t){if(r)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function I(e){return this.l[e.type+!1](t.event?t.event(e):e)}function S(e){return this.l[e.type+!0](t.event?t.event(e):e)}function E(e,n,o,r,s,i,a,f,l){var c,b,u,g,h,w,m,y,j,x,k,C,I,S,E,N=n.type;if(void 0!==n.constructor)return null;null!=o.__h&&(l=o.__h,f=n.__e=o.__e,n.__h=null,i=[f]),(c=t.__b)&&c(n);try{e:if("function"==typeof N){if(y=n.props,j=(c=N.contextType)&&r[c.__c],x=c?j?j.props.value:c.__:r,o.__c?m=(b=n.__c=o.__c).__=b.__E:("prototype"in N&&N.prototype.render?n.__c=b=new N(y,x):(n.__c=b=new _(y,x),b.constructor=N,b.render=z),j&&j.sub(b),b.props=y,b.state||(b.state={}),b.context=x,b.__n=r,u=b.__d=!0,b.__h=[],b._sb=[]),null==b.__s&&(b.__s=b.state),null!=N.getDerivedStateFromProps&&(b.__s==b.state&&(b.__s=d({},b.__s)),d(b.__s,N.getDerivedStateFromProps(y,b.__s))),g=b.props,h=b.state,b.__v=n,u)null==N.getDerivedStateFromProps&&null!=b.componentWillMount&&b.componentWillMount(),null!=b.componentDidMount&&b.__h.push(b.componentDidMount);else{if(null==N.getDerivedStateFromProps&&y!==g&&null!=b.componentWillReceiveProps&&b.componentWillReceiveProps(y,x),!b.__e&&null!=b.shouldComponentUpdate&&!1===b.shouldComponentUpdate(y,b.__s,x)||n.__v===o.__v){for(n.__v!==o.__v&&(b.props=y,b.state=b.__s,b.__d=!1),b.__e=!1,n.__e=o.__e,n.__k=o.__k,n.__k.forEach(function(e){e&&(e.__=n)}),k=0;k<b._sb.length;k++)b.__h.push(b._sb[k]);b._sb=[],b.__h.length&&a.push(b);break e}null!=b.componentWillUpdate&&b.componentWillUpdate(y,b.__s,x),null!=b.componentDidUpdate&&b.__h.push(function(){b.componentDidUpdate(g,h,w)})}if(b.context=x,b.props=y,b.__P=e,C=t.__r,I=0,"prototype"in N&&N.prototype.render){for(b.state=b.__s,b.__d=!1,C&&C(n),c=b.render(b.props,b.state,b.context),S=0;S<b._sb.length;S++)b.__h.push(b._sb[S]);b._sb=[]}else do{b.__d=!1,C&&C(n),c=b.render(b.props,b.state,b.context),b.state=b.__s}while(b.__d&&++I<25);b.state=b.__s,null!=b.getChildContext&&(r=d(d({},r),b.getChildContext())),u||null==b.getSnapshotBeforeUpdate||(w=b.getSnapshotBeforeUpdate(g,h)),E=null!=c&&c.type===p&&null==c.key?c.props.children:c,v(e,Array.isArray(E)?E:[E],n,o,r,s,i,a,f,l),b.base=n.__e,n.__h=null,b.__h.length&&a.push(b),m&&(b.__E=b.__=null),b.__e=!1}else null==i&&n.__v===o.__v?(n.__k=o.__k,n.__e=o.__e):n.__e=H(o.__e,n,o,r,s,i,a,l);(c=t.diffed)&&c(n)}catch(e){n.__v=null,(l||null!=i)&&(n.__e=f,n.__h=!!l,i[i.indexOf(f)]=null),t.__e(e,n,o)}}function N(e,n){t.__c&&t.__c(n,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(e){e.call(n)})}catch(e){t.__e(e,n.__v)}})}function H(t,n,o,r,s,i,f,l){var d,b,u,p=o.props,_=n.props,h=n.type,w=0;if("svg"===h&&(s=!0),null!=i)for(;w<i.length;w++)if((d=i[w])&&"setAttribute"in d==!!h&&(h?d.localName===h:3===d.nodeType)){t=d,i[w]=null;break}if(null==t){if(null===h)return document.createTextNode(_);t=s?document.createElementNS("http://www.w3.org/2000/svg",h):document.createElement(h,_.is&&_),i=null,l=!1}if(null===h)p===_||l&&t.data===_||(t.data=_);else{if(i=i&&e.call(t.childNodes),b=(p=o.props||a).dangerouslySetInnerHTML,u=_.dangerouslySetInnerHTML,!l){if(null!=i)for(p={},w=0;w<t.attributes.length;w++)p[t.attributes[w].name]=t.attributes[w].value;(u||b)&&(u&&(b&&u.__html==b.__html||u.__html===t.innerHTML)||(t.innerHTML=u&&u.__html||""))}if(function(e,t,n,o,r){var s;for(s in n)"children"===s||"key"===s||s in t||C(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]||C(e,s,t[s],n[s],o)}(t,_,p,s,l),u)n.__k=[];else if(w=n.props.children,v(t,Array.isArray(w)?w:[w],n,o,r,s&&"foreignObject"!==h,i,f,i?i[0]:o.__k&&g(o,0),l),null!=i)for(w=i.length;w--;)null!=i[w]&&c(i[w]);l||("value"in _&&void 0!==(w=_.value)&&(w!==t.value||"progress"===h&&!w||"option"===h&&w!==p.value)&&C(t,"value",w,p.value,!1),"checked"in _&&void 0!==(w=_.checked)&&w!==t.checked&&C(t,"checked",w,p.checked,!1))}return t}function T(e,n,o){try{"function"==typeof e?e(n):e.current=n}catch(e){t.__e(e,o)}}function q(e,n,o){var r,s;if(t.unmount&&t.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||T(r,null,n)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){t.__e(e,n)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(s=0;s<r.length;s++)r[s]&&q(r[s],n,o||"function"!=typeof e.type);o||null==e.__e||c(e.__e),e.__=e.__e=e.__d=void 0}function z(e,t,n){return this.constructor(e,n)}e=f.slice,t={__e:function(e,t,n,o){for(var r,s,i;t=t.__;)if((r=t.__c)&&!r.__)try{if((s=r.constructor)&&null!=s.getDerivedStateFromError&&(r.setState(s.getDerivedStateFromError(e)),i=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(e,o||{}),i=r.__d),i)return r.__E=r}catch(t){e=t}throw e}},n=0,_.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=d({},this.state),"function"==typeof e&&(e=e(d({},n),this.props)),e&&d(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),w(this))},_.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),w(this))},_.prototype.render=p,o=[],s="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,i=function(e,t){return e.__v.__b-t.__v.__b},m.__r=0;var $,L,F,O,U=0,P=[],M=[],A=t.__b,D=t.__r,W=t.diffed,B=t.__c,J=t.unmount;function Y(e,n){t.__h&&t.__h(L,e,U||n),U=0;var o=L.__H||(L.__H={__:[],__h:[]});return e>=o.__.length&&o.__.push({__V:M}),o.__[e]}function R(e){return U=1,function(e,t,n){var o=Y($++,2);if(o.t=e,!o.__c&&(o.__=[ee(void 0,t),function(e){var t=o.__N?o.__N[0]:o.__[0],n=o.t(t,e);t!==n&&(o.__N=[n,o.__[1]],o.__c.setState({}))}],o.__c=L,!L.u)){var r=function(e,t,n){if(!o.__c.__H)return!0;var r=o.__c.__H.__.filter(function(e){return e.__c});if(r.every(function(e){return!e.__N}))return!s||s.call(this,e,t,n);var i=!1;return r.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(i=!0)}}),!(!i&&o.__c.props===e)&&(!s||s.call(this,e,t,n))};L.u=!0;var s=L.shouldComponentUpdate,i=L.componentWillUpdate;L.componentWillUpdate=function(e,t,n){if(this.__e){var o=s;s=void 0,r(e,t,n),s=o}i&&i.call(this,e,t,n)},L.shouldComponentUpdate=r}return o.__N||o.__}(ee,e)}function V(e,n){var o=Y($++,3);!t.__s&&function(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}(o.__H,n)&&(o.__=e,o.i=n,L.__H.__h.push(o))}function Q(){for(var e;e=P.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(K),e.__H.__h.forEach(Z),e.__H.__h=[]}catch(n){e.__H.__h=[],t.__e(n,e.__v)}}t.__b=function(e){L=null,A&&A(e)},t.__r=function(e){D&&D(e),$=0;var t=(L=e.__c).__H;t&&(F===L?(t.__h=[],L.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.__V=M,e.__N=e.i=void 0})):(t.__h.forEach(K),t.__h.forEach(Z),t.__h=[])),F=L},t.diffed=function(e){W&&W(e);var n=e.__c;n&&n.__H&&(n.__H.__h.length&&(1!==P.push(n)&&O===t.requestAnimationFrame||((O=t.requestAnimationFrame)||G)(Q)),n.__H.__.forEach(function(e){e.i&&(e.__H=e.i),e.__V!==M&&(e.__=e.__V),e.i=void 0,e.__V=M})),F=L=null},t.__c=function(e,n){n.some(function(e){try{e.__h.forEach(K),e.__h=e.__h.filter(function(e){return!e.__||Z(e)})}catch(o){n.some(function(e){e.__h&&(e.__h=[])}),n=[],t.__e(o,e.__v)}}),B&&B(e,n)},t.unmount=function(e){J&&J(e);var n,o=e.__c;o&&o.__H&&(o.__H.__.forEach(function(e){try{K(e)}catch(e){n=e}}),o.__H=void 0,n&&t.__e(n,o.__v))};var X="function"==typeof requestAnimationFrame;function G(e){var t,n=function(){clearTimeout(o),X&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,100);X&&(t=requestAnimationFrame(n))}function K(e){var t=L,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),L=t}function Z(e){var t=L;e.__c=e.__(),L=t}function ee(e,t){return"function"==typeof t?t(e):t}const te=(...e)=>e.filter(Boolean).join(" ");function ne({children:e,isOpen:t,close:n}){const[o,r]=R(!1);return V(()=>{r(t)},[t]),b("div",{"aria-live":"assertive",className:"fb-pointer-events-none fb-fixed fb-inset-0 fb-flex fb-items-end"},b("div",{className:"fb-flex fb-w-full fb-flex-col fb-items-center fb-space-y-4 sm:fb-items-end"},b("div",{className:te(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 fb-z-40")},b("div",{class:"fb-absolute fb-top-0 fb-right-0 fb-hidden fb-pt-4 fb-pr-4 sm:fb-block"},b("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 fb-text-slate-400 hover:fb-text-slate-500 focus:ring-slate-500"},b("span",{class:"fb-sr-only"},"Close"),b("svg",{class:"fb-h-6 fb-w-6",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},b("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})))),b("div",{className:""},e))))}const oe=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")},re=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 se({headline:e,questionId:t,style:n}){return b("label",{htmlFor:t,className:"fb-mb-1.5 fb-block fb-text-base fb-font-semibold fb-leading-6 fb-mr-8 text-slate-900",style:n},e)}function ie({subheader:e,questionId:t}){return b("label",{for:t,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600"},e)}function ae({question:e,onSubmit:t,lastQuestion:n,brandColor:o}){return b("form",{onSubmit:n=>{n.preventDefault();const o={[e.id]:n.currentTarget[e.id].value};n.currentTarget[e.id].value="",t(o)}},b(se,{headline:e.headline,questionId:e.id}),b(ie,{subheader:e.subheader,questionId:e.id}),b("div",{className:"fb-mt-4"},b("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 fb-bg-slate-50 fb-border-slate-100 focus:fb-border-slate-500"})),b("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},b("div",null),b("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:fb-ring-slate-500",style:{backgroundColor:o}},e.buttonLabel||(n?"Finish":"Next"))))}function fe({question:e,onSubmit:t,lastQuestion:n,brandColor:o}){const[r,s]=R(null);return b("form",{onSubmit:n=>{n.preventDefault();const o={[e.id]:n.currentTarget[e.id].value};n.currentTarget[e.id].value="",t(o)}},b(se,{headline:e.headline,questionId:e.id}),b(ie,{subheader:e.subheader,questionId:e.id}),b("div",{className:"fb-mt-4"},b("fieldset",null,b("legend",{className:"fb-sr-only"},"Choices"),b("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},e.choices&&e.choices.map((t,n)=>b("label",{key:t.id,className:te(r===t.label?"fb-z-10 fb-bg-slate-50 fb-border-slate-400":"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")},b("span",{className:"fb-flex fb-items-center fb-text-sm"},b("input",{type:"radio",id:t.id,name:e.id,value:t.label,className:"fb-h-4 fb-w-4 fb-border fb-border-slate-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},required:e.required&&0===n}),b("span",{id:`${t.id}-label`,className:"fb-ml-3 fb-font-medium"},t.label))))))),b("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},b("div",null),b("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 le({progress:e,brandColor:t}){return b("div",{className:"fb-h-1 fb-w-full fb-rounded-full bg-slate-200"},b("div",{className:"fb-h-1 fb-rounded-full",style:{backgroundColor:t,width:`${Math.floor(100*e)}%`}}))}function de({headline:e,subheader:t,brandColor:n}){return b("div",{className:"fb-text-center"},b("div",{className:"fb-flex fb-items-center fb-justify-center",style:{color:n}},b("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"fb-h-24 fb-w-24"},b("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))),b("span",{className:"fb-inline-block fb-rounded-[100%] fb-w-16 fb-h-1 fb-mb-[10px] fb-bg-slate-300"}),b("div",null,b(se,{headline:e,questionId:"thankYouCard",style:{"margin-right":0}}),b(ie,{subheader:t,questionId:"thankYouCard"})))}function ce({config:e,survey:t,close:n,brandColor:o}){var r;const[s,i]=R(t.questions[0]),[a,f]=R(0),[l,d]=R(null),[c,u]=R(null),[p,_]=R(!1);V(()=>{!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);u(n.id)}()},[e,t]),V(()=>{f(function(){const e=t.questions.findIndex(e=>e.id===s.id);return e/t.questions.length}())},[s,t]);const g=async o=>{_(!0);const r=t.questions.findIndex(e=>e.id===s.id),a=r===t.questions.length-1,b={surveyId:t.id,personId:e.person.id,response:{finished:a,data:o}};if(l)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,l,e);else{const[t,n]=await Promise.all([re(b,e),oe(c,e)]);d(t.id)}_(!1),a?(f(100),t.thankYouCard.enabled?setTimeout(()=>{n()},2e3):n()):i(t.questions[r+1])};return b("div",null,b("div",{className:te(p?"fb-animate-pulse fb-opacity-60":"","fb-text-slate-800 fb-font-sans fb-px-4 fb-py-6 sm:fb-p-6")},100===a&&t.thankYouCard.enabled?b(de,{headline:t.thankYouCard.headline,subheader:t.thankYouCard.subheader,brandColor:null==(r=e.settings)?void 0:r.brandColor}):"multipleChoiceSingle"===s.type?b(fe,{question:s,onSubmit:g,lastQuestion:t.questions.findIndex(e=>e.id===s.id)===t.questions.length-1,brandColor:o}):"openText"===s.type?b(ae,{question:s,onSubmit:g,lastQuestion:t.questions.findIndex(e=>e.id===s.id)===t.questions.length-1,brandColor:o}):null),b(le,{progress:a,brandColor:o}))}function be({config:e,survey:t,closeSurvey:n}){var o;const[r,s]=R(!0),i=()=>{s(!1),setTimeout(()=>{n()},1e3)};return b("div",{id:"fbjs"},b(ne,{isOpen:r,close:i},b(ce,{config:e,survey:t,close:i,brandColor:null==(o=e.settings)?void 0:o.brandColor})))}function ue(){return ue=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},ue.apply(this,arguments)}class pe{constructor(){this.config=this.loadFromLocalStorage()}static getInstance(){return pe.instance||(pe.instance=new pe),pe.instance}update(e){e&&(this.config=ue({},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))}}pe.instance=void 0;class _e{constructor(){this.logLevel="error"}static getInstance(){return _e.instance||(_e.instance=new _e),_e.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")}}_e.instance=void 0;const ge=_e.getInstance(),he=pe.getInstance(),we=async()=>{const e=await 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})});if(!e.ok)throw ge.error("Error getting settings"),Error("Error getting settings");return e.json()},me="formbricks-web-container",ve=pe.getInstance(),ye=_e.getInstance();let je=!1;const xe=n=>{je?ye.debug("A survey is already running. Skipping."):(je=!0,function(n,o,r){var s,i;t.__&&t.__(n,o),s=o.__k,i=[],E(o,n=o.__k=b(p,null,[n]),s||a,a,void 0!==o.ownerSVGElement,s?null:o.firstChild?e.call(o.childNodes):null,i,s?s.__e:o.firstChild,!1),N(i,n)}(b(be,{config:ve.get(),survey:n,closeSurvey:ke}),document.getElementById(me)))},ke=async()=>{document.getElementById(me).remove(),Ce();const e=await we();ve.update({settings:e}),je=!1},Ce=()=>{const e=document.createElement("div");e.id=me,document.body.appendChild(e)},Ie=_e.getInstance(),Se=pe.getInstance(),Ee=async(e,t)=>{const n=await fetch(`${Se.get().apiHost}/api/v1/client/environments/${Se.get().environmentId}/events`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:Se.get().session.id,eventName:e,properties:t})});if(n.ok)Ie.debug(`Formbricks: Event "${e}" tracked`),Ne(e);else{const e=await n.json();Ie.error(`Formbricks: Error tracking event: ${JSON.stringify(e)}`)}},Ne=e=>{for(const o of null==(t=Se.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 Ie.debug(`Formbricks: survey ${o.id} triggered by event "${e}"`),void xe(o)}}},He=pe.getInstance(),Te=_e.getInstance(),qe=async()=>{Te.debug("Creating new person");const e=await fetch(`${He.get().apiHost}/api/v1/client/environments/${He.get().environmentId}/people`,{method:"POST",headers:{"Content-Type":"application/json"}});return e.ok?await e.json():(console.error("Formbricks: Error fetching person"),null)},ze=(e,t)=>{const n=He.get().person.attributes.find(t=>{var n;return(null==(n=t.attributeClass)?void 0:n.name)===e});return!(!n||n.value!==t)},$e=_e.getInstance(),Le=pe.getInstance(),Fe=async()=>{if(!Le.get().person)return void $e.error("Formbricks: Unable to create session. No person found");const e=await fetch(`${Le.get().apiHost}/api/v1/client/environments/${Le.get().environmentId}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:Le.get().person.id})});if(e.ok)return await e.json();$e.error("Error creating session")},Oe=e=>{$e.debug("Session expired. Creating new session.");const t=ue({},e);return t.expiresAt=Date.now()+36e5,t},Ue=e=>e.expiresAt<=Date.now(),Pe=pe.getInstance(),Me=_e.getInstance(),Ae=()=>{const{settings:e}=Pe.get(),t=null==e?void 0:e.noCodeEvents.filter(e=>{var t;return"pageUrl"===(null==(t=e.noCodeConfig)?void 0:t.type)});if(Me.debug("checking page url"),0!==t.length)for(const e of t){const{noCodeConfig:{pageUrl:t}}=e;t&&De(window.location.href,t.value,t.rule)&&Ee(e.name)}};function De(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 We=e=>{const{settings:t}=Pe.get(),n=null==t?void 0:t.noCodeEvents.filter(e=>{var t;return"innerHtml"===(null==(t=e.noCodeConfig)?void 0:t.type)}),o=null==t?void 0:t.noCodeEvents.filter(e=>{var t;return"cssSelector"===(null==(t=e.noCodeConfig)?void 0:t.type)}),r=e.target;n.forEach(e=>{var t;const n=null==(t=e.noCodeConfig)?void 0:t.innerHtml;n&&r.innerHTML===n.value&&Ee(e.name)}),o.forEach(e=>{var t;const n=null==(t=e.noCodeConfig)?void 0:t.cssSelector;n&&r.matches(n.value)&&Ee(e.name)})},Be=pe.getInstance(),Je=_e.getInstance(),Ye=()=>{if(!(Be.get().apiHost&&Be.get().environmentId&&Be.get().person&&Be.get().session&&Be.get().settings))throw Error("Formbricks: Formbricks not initialized. Call initialize() first.")},Re=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}},Ve=(e,t)=>{Re.add(async()=>{Ye(),await(async(e,t)=>{if(Te.debug("setting attribute: "+e+" to value: "+t),ze(e,t))return void Te.debug("attribute already set to this value. Skipping update.");const{person:n,settings:o}=await(async(e,t)=>{if(!He.get().person||!He.get().person.id)return void console.error("Formbricks: Unable to update attribute. No person set.");const n=await fetch(`${He.get().apiHost}/api/v1/client/environments/${He.get().environmentId}/people/${He.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 Te.error("Error updating person"),Error("Error updating person");return o})(e,t);if(!n||!o)throw Te.error("Error updating attribute"),new Error("Formbricks: Error updating attribute");He.update({person:n,settings:o})})(e,t)})},Qe={init:e=>{Re.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&&Je.configure({logLevel:e.logLevel}),Ce(),(()=>{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 :is(.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 :is(.fb-pointer-events-none){pointer-events:none}#fbjs :is(.fb-pointer-events-auto){pointer-events:auto}#fbjs :is(.fb-fixed){position:fixed}#fbjs :is(.fb-absolute){position:absolute}#fbjs :is(.fb-relative){position:relative}#fbjs :is(.fb-inset-0){inset:0}#fbjs :is(.fb-right-0){right:0}#fbjs :is(.fb-top-0){top:0}#fbjs :is(.fb-z-10){z-index:10}#fbjs :is(.fb-mb-\\[10px\\]){margin-bottom:10px}#fbjs :is(.fb-ml-3){margin-left:.75rem}#fbjs :is(.fb-mr-8){margin-right:2rem}#fbjs :is(.fb-mt-2){margin-top:.5rem}#fbjs :is(.fb-mt-4){margin-top:1rem}#fbjs :is(.fb-mt-\\[35px\\]){margin-top:35px}#fbjs :is(.fb-block){display:block}#fbjs :is(.fb-inline-block){display:inline-block}#fbjs :is(.fb-flex){display:flex}#fbjs :is(.fb-hidden){display:none}#fbjs :is(.fb-h-1){height:.25rem}#fbjs :is(.fb-h-24){height:6rem}#fbjs :is(.fb-h-4){height:1rem}#fbjs :is(.fb-h-6){height:1.5rem}#fbjs :is(.fb-h-\\[2px\\]){height:2px}#fbjs :is(.fb-w-16){width:4rem}#fbjs :is(.fb-w-24){width:6rem}#fbjs :is(.fb-w-4){width:1rem}#fbjs :is(.fb-w-4\\/5){width:80%}#fbjs :is(.fb-w-6){width:1.5rem}#fbjs :is(.fb-w-full){width:100%}#fbjs :is(.fb-max-w-sm){max-width:24rem}#fbjs :is(.fb-translate-x-0){--tw-translate-x:0px;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 :is(.fb-translate-x-28){--tw-translate-x:7rem;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))}@keyframes fb-pulse{50%{opacity:.5}}#fbjs :is(.fb-animate-pulse){animation:fb-pulse 2s cubic-bezier(.4,0,.6,1) infinite}#fbjs :is(.fb-cursor-pointer){cursor:pointer}#fbjs :is(.fb-flex-col){flex-direction:column}#fbjs :is(.fb-items-end){align-items:flex-end}#fbjs :is(.fb-items-center){align-items:center}#fbjs :is(.fb-justify-center){justify-content:center}#fbjs :is(.fb-justify-between){justify-content:space-between}#fbjs :is(.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 :is(.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 :is(.fb-overflow-hidden){overflow:hidden}#fbjs :is(.fb-rounded-\\[100\\%\\]){border-radius:100%}#fbjs :is(.fb-rounded-full){border-radius:9999px}#fbjs :is(.fb-rounded-lg){border-radius:.5rem}#fbjs :is(.fb-rounded-md){border-radius:.375rem}#fbjs :is(.fb-border){border-width:1px}#fbjs :is(.fb-border-gray-200){--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-100){--tw-border-opacity:1;border-color:rgb(241 245 249/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-300){--tw-border-opacity:1;border-color:rgb(203 213 225/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-400){--tw-border-opacity:1;border-color:rgb(148 163 184/var(--tw-border-opacity))}#fbjs :is(.fb-border-transparent){border-color:transparent}#fbjs :is(.fb-bg-slate-300){--tw-bg-opacity:1;background-color:rgb(203 213 225/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-slate-50){--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-white){--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}#fbjs :is(.fb-p-2){padding:.5rem}#fbjs :is(.fb-p-4){padding:1rem}#fbjs :is(.fb-px-3){padding-left:.75rem;padding-right:.75rem}#fbjs :is(.fb-px-4){padding-left:1rem;padding-right:1rem}#fbjs :is(.fb-py-3){padding-bottom:.75rem;padding-top:.75rem}#fbjs :is(.fb-py-6){padding-bottom:1.5rem;padding-top:1.5rem}#fbjs :is(.fb-pr-4){padding-right:1rem}#fbjs :is(.fb-pt-4){padding-top:1rem}#fbjs :is(.fb-text-center){text-align:center}#fbjs :is(.fb-font-sans){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}#fbjs :is(.fb-text-base){font-size:1rem;line-height:1.5rem}#fbjs :is(.fb-text-sm){font-size:.875rem;line-height:1.25rem}#fbjs :is(.fb-text-xs){font-size:.75rem;line-height:1rem}#fbjs :is(.fb-font-medium){font-weight:500}#fbjs :is(.fb-font-normal){font-weight:400}#fbjs :is(.fb-font-semibold){font-weight:600}#fbjs :is(.fb-leading-4){line-height:1rem}#fbjs :is(.fb-leading-6){line-height:1.5rem}#fbjs :is(.fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-500){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-800){--tw-text-opacity:1;color:rgb(30 41 59/var(--tw-text-opacity))}#fbjs :is(.fb-text-white){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}#fbjs :is(.fb-opacity-0){opacity:0}#fbjs :is(.fb-opacity-100){opacity:1}#fbjs :is(.fb-opacity-60){opacity:.6}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.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 :is(.fb-ring-black){--tw-ring-opacity:1;--tw-ring-color:rgb(0 0 0/var(--tw-ring-opacity))}#fbjs :is(.fb-ring-opacity-5){--tw-ring-opacity:0.05}#fbjs :is(.fb-transition-all){transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.fb-duration-500){transition-duration:.5s}#fbjs :is(.fb-ease-in-out){transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.hover\\:fb-text-slate-500:hover){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.hover\\:fb-opacity-90:hover){opacity:.9}#fbjs :is(.focus\\:fb-border-slate-500:focus){--tw-border-opacity:1;border-color:rgb(100 116 139/var(--tw-border-opacity))}#fbjs :is(.focus\\:fb-outline-none:focus){outline:2px solid transparent;outline-offset:2px}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.focus\\:fb-ring-slate-500:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(100 116 139/var(--tw-ring-opacity))}#fbjs :is(.focus\\:fb-ring-offset-0:focus){--tw-ring-offset-width:0px}#fbjs :is(.focus\\:fb-ring-offset-2:focus){--tw-ring-offset-width:2px}@media (min-width:640px){#fbjs :is(.sm\\:fb-block){display:block}#fbjs :is(.sm\\:fb-items-end){align-items:flex-end}#fbjs :is(.sm\\:fb-p-6){padding:1.5rem}#fbjs :is(.sm\\:fb-text-sm){font-size:.875rem;line-height:1.25rem}}',document.head.appendChild(e)}})(),Be&&Be.get().environmentId===e.environmentId&&Be.get().apiHost===e.apiHost){if(Be.get().session&&Ue(Be.get().session)){const{session:e,settings:t}=await Fe();Be.update({session:Oe(e),settings:t}),Ee("New Session")}else if(!Be.get().session)return void Je.error("Unable to initialize. No session found")}else{Be.update({environmentId:e.environmentId,apiHost:e.apiHost});const{person:t,session:n,settings:o}=await qe();Be.update({person:t,session:Oe(n),settings:o}),Ee("New Session")}(()=>{if("undefined"!=typeof window){const e=window.setInterval(async()=>{await(async()=>{if($e.debug("Checking session"),Ue(Le.get().session)){$e.debug("Session expired, creating new session");const{session:e,settings:t}=await Fe();if(!e||!t)throw $e.error("Error creating new session"),Error("Error creating new session");Le.update({session:e,settings:t}),Ee("New Session")}$e.debug("Session not expired, extending session"),Le.update({session:Oe(Le.get().session)})})()},3e5);window.addEventListener("beforeunload",()=>{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)),"undefined"!=typeof window&&document.addEventListener("click",We),Je.debug("Initialized")})(e)})},setUserId:e=>{Re.add(async()=>{Ye(),await(async e=>{if(Te.debug("setting userId: "+e),ze("userId",e))return void Te.debug("userId already set to this value. Skipping update.");if((e=>{const t=He.get().person.attributes.find(e=>{var t;return"userId"===(null==(t=e.attributeClass)?void 0:t.name)});return!!t})())return void Te.error("userId cannot be changed after it has been set. You need to reset first");const{person:t,settings:n}=await(async e=>{if(!He.get().person||!He.get().person.id)return void console.error("Formbricks: Unable to update userId. No person set.");const t=await fetch(`${He.get().apiHost}/api/v1/client/environments/${He.get().environmentId}/people/${He.get().person.id}/user-id`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,sessionId:He.get().session.id})});if(!t.ok)throw Te.error("Formbricks: Error updating person"),Error("Error updating person");return await t.json()})(e);He.update({person:t,settings:n})})(e)})},setEmail:e=>{Ve("email",e)},setAttribute:Ve,track:(e,t={})=>{Re.add(async()=>{Ye(),await Ee(e,t)})},logout:()=>{Re.add(async()=>{Ye(),await(async()=>{Te.debug("Resetting person. Getting new person, session and settings from backend");const{person:e,session:t,settings:n}=await qe();if(!e||!t||!n)throw Te.error("Error resetting user"),new Error("Formbricks: Error resetting user");He.update({person:e,session:t,settings:n})})()})},refresh:()=>{Re.add(async()=>{Ye(),await(async()=>{ge.debug("Refreshing - getting settings from backend");const e=await we();he.update({settings:e})})()})},registerRouteChange:()=>{Re.add(async()=>{Ye(),Ae()})}};export{Qe as default};
var e,t,n,r,o,s,i,a={},f=[],l=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function b(e,t){for(var n in t)e[n]=t[n];return e}function d(e){var t=e.parentNode;t&&t.removeChild(e)}function c(t,n,r){var o,s,i,a={};for(i in n)"key"==i?o=n[i]:"ref"==i?s=n[i]:a[i]=n[i];if(arguments.length>2&&(a.children=arguments.length>3?e.call(arguments,2):r),"function"==typeof t&&null!=t.defaultProps)for(i in t.defaultProps)void 0===a[i]&&(a[i]=t.defaultProps[i]);return u(t,a,o,s,null)}function u(e,r,o,s,i){var a={type:e,props:r,key:o,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==i?++n:i};return null==i&&null!=t.vnode&&t.vnode(a),a}function p(e){return e.children}function _(e,t){this.props=e,this.context=t}function g(e,t){if(null==t)return e.__?g(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?g(e):null}function h(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 h(e)}}function m(e){(!e.__d&&(e.__d=!0)&&r.push(e)&&!w.__r++||o!==t.debounceRendering)&&((o=t.debounceRendering)||s)(w)}function w(){var e,t,n,o,s,a,f,l;for(r.sort(i);e=r.shift();)e.__d&&(t=r.length,o=void 0,s=void 0,f=(a=(n=e).__v).__e,(l=n.__P)&&(o=[],(s=b({},a)).__v=a.__v+1,I(l,a,s,n.__n,void 0!==l.ownerSVGElement,null!=a.__h?[f]:null,o,null==f?g(a):f,a.__h),E(o,a),a.__e!=f&&h(a)),r.length>t&&r.sort(i));w.__r=0}function v(e,t,n,r,o,s,i,l,b,d){var c,_,h,m,w,v,k,C=r&&r.__k||f,N=C.length;for(n.__k=[],c=0;c<t.length;c++)if(null!=(m=n.__k[c]=null==(m=t[c])||"boolean"==typeof m||"function"==typeof m?null:"string"==typeof m||"number"==typeof m||"bigint"==typeof m?u(null,m,null,null,m):Array.isArray(m)?u(p,{children:m},null,null,null):m.__b>0?u(m.type,m.props,m.key,m.ref?m.ref:null,m.__v):m)){if(m.__=n,m.__b=n.__b+1,null===(h=C[c])||h&&m.key==h.key&&m.type===h.type)C[c]=void 0;else for(_=0;_<N;_++){if((h=C[_])&&m.key==h.key&&m.type===h.type){C[_]=void 0;break}h=null}I(e,m,h=h||a,o,s,i,l,b,d),w=m.__e,(_=m.ref)&&h.ref!=_&&(k||(k=[]),h.ref&&k.push(h.ref,null,m),k.push(_,m.__c||w,m)),null!=w?(null==v&&(v=w),"function"==typeof m.type&&m.__k===h.__k?m.__d=b=y(m,b,e):b=j(e,m,h,C,w,b),"function"==typeof n.type&&(n.__d=b)):b&&h.__e==b&&b.parentNode!=e&&(b=g(h))}for(n.__e=v,c=N;c--;)null!=C[c]&&("function"==typeof n.type&&null!=C[c].__e&&C[c].__e==n.__d&&(n.__d=x(r).nextSibling),T(C[c],C[c]));if(k)for(c=0;c<k.length;c++)H(k[c],k[++c],k[++c])}function y(e,t,n){for(var r,o=e.__k,s=0;o&&s<o.length;s++)(r=o[s])&&(r.__=e,t="function"==typeof r.type?y(r,t,n):j(n,r,r,o,r.__e,t));return t}function j(e,t,n,r,o,s){var i,a,f;if(void 0!==t.__d)i=t.__d,t.__d=void 0;else if(null==n||o!=s||null==o.parentNode)e:if(null==s||s.parentNode!==e)e.appendChild(o),i=null;else{for(a=s,f=0;(a=a.nextSibling)&&f<r.length;f+=1)if(a==o)break e;e.insertBefore(o,s),i=s}return void 0!==i?i:o.nextSibling}function x(e){var t,n,r;if(null==e.type||"string"==typeof e.type)return e.__e;if(e.__k)for(t=e.__k.length-1;t>=0;t--)if((n=e.__k[t])&&(r=x(n)))return r;return null}function k(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||l.test(t)?n:n+"px"}function C(e,t,n,r,o){var s;e:if("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||k(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||k(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])s=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+s]=n,n?r||e.addEventListener(t,s?S:N,s):e.removeEventListener(t,s?S:N,s);else if("dangerouslySetInnerHTML"!==t){if(o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function N(e){return this.l[e.type+!1](t.event?t.event(e):e)}function S(e){return this.l[e.type+!0](t.event?t.event(e):e)}function I(e,n,r,o,s,i,a,f,l){var d,c,u,g,h,m,w,y,j,x,k,C,N,S,I,E=n.type;if(void 0!==n.constructor)return null;null!=r.__h&&(l=r.__h,f=n.__e=r.__e,n.__h=null,i=[f]),(d=t.__b)&&d(n);try{e:if("function"==typeof E){if(y=n.props,j=(d=E.contextType)&&o[d.__c],x=d?j?j.props.value:d.__:o,r.__c?w=(c=n.__c=r.__c).__=c.__E:("prototype"in E&&E.prototype.render?n.__c=c=new E(y,x):(n.__c=c=new _(y,x),c.constructor=E,c.render=z),j&&j.sub(c),c.props=y,c.state||(c.state={}),c.context=x,c.__n=o,u=c.__d=!0,c.__h=[],c._sb=[]),null==c.__s&&(c.__s=c.state),null!=E.getDerivedStateFromProps&&(c.__s==c.state&&(c.__s=b({},c.__s)),b(c.__s,E.getDerivedStateFromProps(y,c.__s))),g=c.props,h=c.state,c.__v=n,u)null==E.getDerivedStateFromProps&&null!=c.componentWillMount&&c.componentWillMount(),null!=c.componentDidMount&&c.__h.push(c.componentDidMount);else{if(null==E.getDerivedStateFromProps&&y!==g&&null!=c.componentWillReceiveProps&&c.componentWillReceiveProps(y,x),!c.__e&&null!=c.shouldComponentUpdate&&!1===c.shouldComponentUpdate(y,c.__s,x)||n.__v===r.__v){for(n.__v!==r.__v&&(c.props=y,c.state=c.__s,c.__d=!1),c.__e=!1,n.__e=r.__e,n.__k=r.__k,n.__k.forEach(function(e){e&&(e.__=n)}),k=0;k<c._sb.length;k++)c.__h.push(c._sb[k]);c._sb=[],c.__h.length&&a.push(c);break e}null!=c.componentWillUpdate&&c.componentWillUpdate(y,c.__s,x),null!=c.componentDidUpdate&&c.__h.push(function(){c.componentDidUpdate(g,h,m)})}if(c.context=x,c.props=y,c.__P=e,C=t.__r,N=0,"prototype"in E&&E.prototype.render){for(c.state=c.__s,c.__d=!1,C&&C(n),d=c.render(c.props,c.state,c.context),S=0;S<c._sb.length;S++)c.__h.push(c._sb[S]);c._sb=[]}else do{c.__d=!1,C&&C(n),d=c.render(c.props,c.state,c.context),c.state=c.__s}while(c.__d&&++N<25);c.state=c.__s,null!=c.getChildContext&&(o=b(b({},o),c.getChildContext())),u||null==c.getSnapshotBeforeUpdate||(m=c.getSnapshotBeforeUpdate(g,h)),I=null!=d&&d.type===p&&null==d.key?d.props.children:d,v(e,Array.isArray(I)?I:[I],n,r,o,s,i,a,f,l),c.base=n.__e,n.__h=null,c.__h.length&&a.push(c),w&&(c.__E=c.__=null),c.__e=!1}else null==i&&n.__v===r.__v?(n.__k=r.__k,n.__e=r.__e):n.__e=q(r.__e,n,r,o,s,i,a,l);(d=t.diffed)&&d(n)}catch(e){n.__v=null,(l||null!=i)&&(n.__e=f,n.__h=!!l,i[i.indexOf(f)]=null),t.__e(e,n,r)}}function E(e,n){t.__c&&t.__c(n,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(e){e.call(n)})}catch(e){t.__e(e,n.__v)}})}function q(t,n,r,o,s,i,f,l){var b,c,u,p=r.props,_=n.props,h=n.type,m=0;if("svg"===h&&(s=!0),null!=i)for(;m<i.length;m++)if((b=i[m])&&"setAttribute"in b==!!h&&(h?b.localName===h:3===b.nodeType)){t=b,i[m]=null;break}if(null==t){if(null===h)return document.createTextNode(_);t=s?document.createElementNS("http://www.w3.org/2000/svg",h):document.createElement(h,_.is&&_),i=null,l=!1}if(null===h)p===_||l&&t.data===_||(t.data=_);else{if(i=i&&e.call(t.childNodes),c=(p=r.props||a).dangerouslySetInnerHTML,u=_.dangerouslySetInnerHTML,!l){if(null!=i)for(p={},m=0;m<t.attributes.length;m++)p[t.attributes[m].name]=t.attributes[m].value;(u||c)&&(u&&(c&&u.__html==c.__html||u.__html===t.innerHTML)||(t.innerHTML=u&&u.__html||""))}if(function(e,t,n,r,o){var s;for(s in n)"children"===s||"key"===s||s in t||C(e,s,null,n[s],r);for(s in t)o&&"function"!=typeof t[s]||"children"===s||"key"===s||"value"===s||"checked"===s||n[s]===t[s]||C(e,s,t[s],n[s],r)}(t,_,p,s,l),u)n.__k=[];else if(m=n.props.children,v(t,Array.isArray(m)?m:[m],n,r,o,s&&"foreignObject"!==h,i,f,i?i[0]:r.__k&&g(r,0),l),null!=i)for(m=i.length;m--;)null!=i[m]&&d(i[m]);l||("value"in _&&void 0!==(m=_.value)&&(m!==t.value||"progress"===h&&!m||"option"===h&&m!==p.value)&&C(t,"value",m,p.value,!1),"checked"in _&&void 0!==(m=_.checked)&&m!==t.checked&&C(t,"checked",m,p.checked,!1))}return t}function H(e,n,r){try{"function"==typeof e?e(n):e.current=n}catch(e){t.__e(e,r)}}function T(e,n,r){var o,s;if(t.unmount&&t.unmount(e),(o=e.ref)&&(o.current&&o.current!==e.__e||H(o,null,n)),null!=(o=e.__c)){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(e){t.__e(e,n)}o.base=o.__P=null,e.__c=void 0}if(o=e.__k)for(s=0;s<o.length;s++)o[s]&&T(o[s],n,r||"function"!=typeof e.type);r||null==e.__e||d(e.__e),e.__=e.__e=e.__d=void 0}function z(e,t,n){return this.constructor(e,n)}e=f.slice,t={__e:function(e,t,n,r){for(var o,s,i;t=t.__;)if((o=t.__c)&&!o.__)try{if((s=o.constructor)&&null!=s.getDerivedStateFromError&&(o.setState(s.getDerivedStateFromError(e)),i=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,r||{}),i=o.__d),i)return o.__E=o}catch(t){e=t}throw e}},n=0,_.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=b({},this.state),"function"==typeof e&&(e=e(b({},n),this.props)),e&&b(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),m(this))},_.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),m(this))},_.prototype.render=p,r=[],s="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,i=function(e,t){return e.__v.__b-t.__v.__b},w.__r=0;var L,$,F,O,U=0,P=[],M=[],A=t.__b,D=t.__r,W=t.diffed,B=t.__c,J=t.unmount;function Y(e,n){t.__h&&t.__h($,e,U||n),U=0;var r=$.__H||($.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({__V:M}),r.__[e]}function Q(e){return U=1,function(e,t,n){var r=Y(L++,2);if(r.t=e,!r.__c&&(r.__=[ee(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=$,!$.u)){var o=function(e,t,n){if(!r.__c.__H)return!0;var o=r.__c.__H.__.filter(function(e){return e.__c});if(o.every(function(e){return!e.__N}))return!s||s.call(this,e,t,n);var i=!1;return o.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(i=!0)}}),!(!i&&r.__c.props===e)&&(!s||s.call(this,e,t,n))};$.u=!0;var s=$.shouldComponentUpdate,i=$.componentWillUpdate;$.componentWillUpdate=function(e,t,n){if(this.__e){var r=s;s=void 0,o(e,t,n),s=r}i&&i.call(this,e,t,n)},$.shouldComponentUpdate=o}return r.__N||r.__}(ee,e)}function R(e,n){var r=Y(L++,3);!t.__s&&function(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}(r.__H,n)&&(r.__=e,r.i=n,$.__H.__h.push(r))}function V(){for(var e;e=P.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(K),e.__H.__h.forEach(Z),e.__H.__h=[]}catch(n){e.__H.__h=[],t.__e(n,e.__v)}}t.__b=function(e){$=null,A&&A(e)},t.__r=function(e){D&&D(e),L=0;var t=($=e.__c).__H;t&&(F===$?(t.__h=[],$.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.__V=M,e.__N=e.i=void 0})):(t.__h.forEach(K),t.__h.forEach(Z),t.__h=[])),F=$},t.diffed=function(e){W&&W(e);var n=e.__c;n&&n.__H&&(n.__H.__h.length&&(1!==P.push(n)&&O===t.requestAnimationFrame||((O=t.requestAnimationFrame)||G)(V)),n.__H.__.forEach(function(e){e.i&&(e.__H=e.i),e.__V!==M&&(e.__=e.__V),e.i=void 0,e.__V=M})),F=$=null},t.__c=function(e,n){n.some(function(e){try{e.__h.forEach(K),e.__h=e.__h.filter(function(e){return!e.__||Z(e)})}catch(r){n.some(function(e){e.__h&&(e.__h=[])}),n=[],t.__e(r,e.__v)}}),B&&B(e,n)},t.unmount=function(e){J&&J(e);var n,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(e){try{K(e)}catch(e){n=e}}),r.__H=void 0,n&&t.__e(n,r.__v))};var X="function"==typeof requestAnimationFrame;function G(e){var t,n=function(){clearTimeout(r),X&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);X&&(t=requestAnimationFrame(n))}function K(e){var t=$,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),$=t}function Z(e){var t=$;e.__c=e.__(),$=t}function ee(e,t){return"function"==typeof t?t(e):t}const te=(...e)=>e.filter(Boolean).join(" ");function ne({children:e,isOpen:t,close:n}){const[r,o]=Q(!1);return R(()=>{o(t)},[t]),c("div",{"aria-live":"assertive",className:"fb-pointer-events-none fb-fixed fb-inset-0 fb-flex fb-items-end"},c("div",{className:"fb-flex fb-w-full fb-flex-col fb-items-center fb-space-y-4 sm:fb-items-end"},c("div",{className:te(r?"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 fb-z-40 fb-m-4")},c("div",{class:"fb-absolute fb-top-0 fb-right-0 fb-hidden fb-pt-4 fb-pr-4 sm:fb-block"},c("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 fb-text-slate-400 hover:fb-text-slate-500 focus:ring-slate-500"},c("span",{class:"fb-sr-only"},"Close"),c("svg",{class:"fb-h-6 fb-w-6",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},c("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})))),c("div",{className:""},e))))}const re=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")},oe=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 se({progress:e,brandColor:t}){return c("div",{className:"fb-h-1 fb-w-full fb-rounded-full bg-slate-200"},c("div",{className:"fb-h-1 fb-rounded-full",style:{backgroundColor:t,width:`${Math.floor(100*e)}%`}}))}function ie({headline:e,questionId:t,style:n}){return c("label",{htmlFor:t,className:"fb-mb-1.5 fb-block fb-text-base fb-font-semibold fb-leading-6 fb-mr-8 text-slate-900",style:n},e)}function ae({subheader:e,questionId:t}){return c("label",{for:t,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600"},e)}function fe({headline:e,subheader:t,brandColor:n}){return c("div",{className:"fb-text-center"},c("div",{className:"fb-flex fb-items-center fb-justify-center",style:{color:n}},c("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"fb-h-24 fb-w-24"},c("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))),c("span",{className:"fb-inline-block fb-rounded-[100%] fb-w-16 fb-h-1 fb-mb-[10px] fb-bg-slate-300"}),c("div",null,c(ie,{headline:e,questionId:"thankYouCard",style:{"margin-right":0}}),c(ae,{subheader:t,questionId:"thankYouCard"})))}function le({question:e,onSubmit:t,lastQuestion:n,brandColor:r}){return c("form",{onSubmit:n=>{n.preventDefault();const r={[e.id]:n.currentTarget[e.id].value};n.currentTarget[e.id].value="",t(r)}},c(ie,{headline:e.headline,questionId:e.id}),c(ae,{subheader:e.subheader,questionId:e.id}),c("div",{className:"fb-mt-4"},c("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 fb-bg-slate-50 fb-border-slate-100 focus:fb-border-slate-500"})),c("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},c("div",null),c("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:fb-ring-slate-500",style:{backgroundColor:r}},e.buttonLabel||(n?"Finish":"Next"))))}function be({question:e,onSubmit:t,lastQuestion:n,brandColor:r}){const[o,s]=Q(null);return c("form",{onSubmit:n=>{n.preventDefault(),t({[e.id]:n.currentTarget[e.id].value}),s(null)}},c(ie,{headline:e.headline,questionId:e.id}),c(ae,{subheader:e.subheader,questionId:e.id}),c("div",{className:"fb-mt-4"},c("fieldset",null,c("legend",{className:"fb-sr-only"},"Choices"),c("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},e.choices&&e.choices.map((t,n)=>c("label",{key:t.id,className:te(o===t.label?"fb-z-10 fb-bg-slate-50 fb-border-slate-400":"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")},c("span",{className:"fb-flex fb-items-center fb-text-sm"},c("input",{type:"radio",id:t.id,name:e.id,value:t.label,className:"fb-h-4 fb-w-4 fb-border fb-border-slate-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":`${t.id}-label`,onChange:e=>{s(e.currentTarget.value)},checked:o===t.label,style:{borderColor:r,color:r},required:e.required&&0===n}),c("span",{id:`${t.id}-label`,className:"fb-ml-3 fb-font-medium"},t.label))))))),c("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},c("div",null),c("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:r}},e.buttonLabel||(n?"Finish":"Next"))))}function de({question:e,onSubmit:t,lastQuestion:n,brandColor:r}){const[o,s]=Q([]),i=()=>o.length>0;return c("form",{onSubmit:n=>{n.preventDefault(),(i()||!e.required)&&(t({[e.id]:o}),s([]))}},c(ie,{headline:e.headline,questionId:e.id}),c(ae,{subheader:e.subheader,questionId:e.id}),c("div",{className:"fb-mt-4"},c("fieldset",null,c("legend",{className:"fb-sr-only"},"Choices"),c("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},e.choices&&e.choices.map(t=>c("label",{key:t.id,className:te(o.includes(t.label)?"fb-z-10 fb-border-slate-400 fb-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 hover:fb-bg-slate-50 focus:fb-outline-none")},c("span",{className:"fb-flex fb-items-center fb-text-sm"},c("input",{type:"checkbox",id:t.id,name:e.id,value:t.label,className:"fb-h-4 fb-w-4 fb-border fb-border-slate-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":`${t.id}-label`,onChange:e=>{s(e.currentTarget.checked?[...o,e.currentTarget.value]:o.filter(t=>t!==e.currentTarget.value))},checked:o.includes(t.label),style:{borderColor:r,color:r}}),c("span",{id:`${t.id}-label`,className:"fb-ml-3 fb-font-medium"},t.label))))))),c("input",{type:"text",className:"clip-[rect(0,0,0,0)] fb-absolute fb-m-[-1px] fb-h-1 fb-w-1 fb-overflow-hidden fb-whitespace-nowrap fb-border-0 fb-p-0 fb-text-transparent fb-caret-transparent focus:fb-border-transparent focus:fb-ring-0",required:e.required,value:i()?"checked":""}),c("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},c("div",null),c("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:r}},e.buttonLabel||(n?"Finish":"Next"))))}function ce({question:e,onSubmit:t,lastQuestion:n,brandColor:r}){const[o,s]=Q(null);return c("form",{onSubmit:n=>{n.preventDefault(),t({[e.id]:o})}},c(ie,{headline:e.headline,questionId:e.id}),c(ae,{subheader:e.subheader,questionId:e.id}),c("div",{className:"fb-my-4"},c("fieldset",null,c("legend",{className:"fb-sr-only"},"Choices"),c("div",{className:"fb-flex"},Array.from({length:11},(e,t)=>t).map(t=>c("label",{key:t,className:te(o===t?"fb-z-10 fb-border-slate-400 fb-bg-slate-50":"","fb-relative fb-h-10 fb-flex-1 fb-cursor-pointer fb-border fb-bg-white fb-text-center fb-text-sm fb-leading-10 fb-hover:bg-gray-100 fb-focus:outline-none")},c("input",{type:"radio",name:"nps",value:t,className:"fb-absolute fb-h-full fb-w-full fb-cursor-pointer fb-opacity-0",onChange:()=>s(t),required:e.required}),t))),c("div",{className:"fb-flex fb-justify-between fb-text-sm fb-font-semibold fb-leading-6"},c("p",null,e.lowerLabel),c("p",null,e.upperLabel)))),c("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},c("div",null),c("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 fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2",style:{backgroundColor:r}},e.buttonLabel||(n?"Finish":"Next"))))}function ue({question:e,onSubmit:t,lastQuestion:n,brandColor:r}){return"openText"===e.type?c(le,{question:e,onSubmit:t,lastQuestion:n,brandColor:r}):"multipleChoiceSingle"===e.type?c(be,{question:e,onSubmit:t,lastQuestion:n,brandColor:r}):"multipleChoiceMulti"===e.type?c(de,{question:e,onSubmit:t,lastQuestion:n,brandColor:r}):"nps"===e.type?c(ce,{question:e,onSubmit:t,lastQuestion:n,brandColor:r}):null}function pe({config:e,survey:t,close:n,brandColor:r}){var o;const[s,i]=Q(t.questions[0].id),[a,f]=Q(0),[l,b]=Q(null),[d,u]=Q(null),[p,_]=Q(!1);R(()=>{!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);u(n.id)}(),console.log(t)},[e,t]),R(()=>{f(function(){const e=t.questions.findIndex(e=>e.id===s);return e/t.questions.length}())},[s,t]);const g=async r=>{_(!0);const o=t.questions.findIndex(e=>e.id===s),a=o===t.questions.length-1,c={surveyId:t.id,personId:e.person.id,response:{finished:a,data:r}};if(l)await(async(e,t,n)=>{const r=await fetch(`${n.apiHost}/api/v1/client/environments/${n.environmentId}/responses/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!r.ok)throw new Error("Could not update response");return await r.json()})(c,l,e);else{const[t,n]=await Promise.all([oe(c,e),re(d,e)]);b(t.id)}_(!1),a?(f(100),t.thankYouCard.enabled?setTimeout(()=>{n()},2e3):n()):i(t.questions[o+1].id)};return c("div",null,c("div",{className:te(p?"fb-animate-pulse fb-opacity-60":"","fb-text-slate-800 fb-font-sans fb-px-4 fb-py-6 sm:fb-p-6")},100===a&&t.thankYouCard.enabled?c(fe,{headline:t.thankYouCard.headline,subheader:t.thankYouCard.subheader,brandColor:null==(o=e.settings)?void 0:o.brandColor}):t.questions.map((e,n)=>s===e.id&&c(ue,{key:e.id,brandColor:r,lastQuestion:n===t.questions.length-1,onSubmit:g,question:e}))),c(se,{progress:a,brandColor:r}))}function _e({config:e,survey:t,closeSurvey:n}){var r;const[o,s]=Q(!0),i=()=>{s(!1),setTimeout(()=>{n()},1e3)};return c("div",{id:"fbjs"},c(ne,{isOpen:o,close:i},c(pe,{config:e,survey:t,close:i,brandColor:null==(r=e.settings)?void 0:r.brandColor})))}function ge(){return ge=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},ge.apply(this,arguments)}class he{constructor(){this.config=this.loadFromLocalStorage()}static getInstance(){return he.instance||(he.instance=new he),he.instance}update(e){e&&(this.config=ge({},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))}}he.instance=void 0;class me{constructor(){this.logLevel="error"}static getInstance(){return me.instance||(me.instance=new me),me.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")}}me.instance=void 0;const we=me.getInstance(),ve=he.getInstance(),ye=async()=>{const e=await fetch(`${ve.get().apiHost}/api/v1/client/environments/${ve.get().environmentId}/settings`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:ve.get().person.id})});if(!e.ok)throw we.error("Error getting settings"),Error("Error getting settings");return e.json()},je="formbricks-web-container",xe=he.getInstance(),ke=me.getInstance();let Ce=!1;const Ne=n=>{Ce?ke.debug("A survey is already running. Skipping."):(Ce=!0,function(n,r,o){var s,i;t.__&&t.__(n,r),s=r.__k,i=[],I(r,n=r.__k=c(p,null,[n]),s||a,a,void 0!==r.ownerSVGElement,s?null:r.firstChild?e.call(r.childNodes):null,i,s?s.__e:r.firstChild,!1),E(i,n)}(c(_e,{config:xe.get(),survey:n,closeSurvey:Se}),document.getElementById(je)))},Se=async()=>{document.getElementById(je).remove(),Ie();const e=await ye();xe.update({settings:e}),Ce=!1},Ie=()=>{const e=document.createElement("div");e.id=je,document.body.appendChild(e)},Ee=me.getInstance(),qe=he.getInstance(),He=async(e,t)=>{const n=await fetch(`${qe.get().apiHost}/api/v1/client/environments/${qe.get().environmentId}/events`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:qe.get().session.id,eventName:e,properties:t})});if(n.ok)Ee.debug(`Formbricks: Event "${e}" tracked`),Te(e);else{const e=await n.json();Ee.error(`Formbricks: Error tracking event: ${JSON.stringify(e)}`)}},Te=e=>{for(const r of null==(t=qe.get().settings)?void 0:t.surveys){var t;for(const t of r.triggers){var n;if((null==(n=t.eventClass)?void 0:n.name)===e)return Ee.debug(`Formbricks: survey ${r.id} triggered by event "${e}"`),void Ne(r)}}},ze=he.getInstance(),Le=me.getInstance(),$e=async()=>{Le.debug("Creating new person");const e=await fetch(`${ze.get().apiHost}/api/v1/client/environments/${ze.get().environmentId}/people`,{method:"POST",headers:{"Content-Type":"application/json"}});return e.ok?await e.json():(console.error("Formbricks: Error fetching person"),null)},Fe=(e,t)=>{const n=ze.get().person.attributes.find(t=>{var n;return(null==(n=t.attributeClass)?void 0:n.name)===e});return!(!n||n.value!==t)},Oe=me.getInstance(),Ue=he.getInstance(),Pe=async()=>{if(!Ue.get().person)return void Oe.error("Formbricks: Unable to create session. No person found");const e=await fetch(`${Ue.get().apiHost}/api/v1/client/environments/${Ue.get().environmentId}/sessions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:Ue.get().person.id})});if(e.ok)return await e.json();Oe.error("Error creating session")},Me=e=>{Oe.debug("Session expired. Creating new session.");const t=ge({},e);return t.expiresAt=Date.now()+36e5,t},Ae=e=>e.expiresAt<=Date.now(),De=he.getInstance(),We=me.getInstance(),Be=()=>{const{settings:e}=De.get(),t=null==e?void 0:e.noCodeEvents.filter(e=>{var t;return"pageUrl"===(null==(t=e.noCodeConfig)?void 0:t.type)});if(We.debug("checking page url"),0!==t.length)for(const e of t){const{noCodeConfig:{pageUrl:t}}=e;t&&Je(window.location.href,t.value,t.rule)&&He(e.name)}};function Je(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 Ye=e=>{const{settings:t}=De.get(),n=null==t?void 0:t.noCodeEvents.filter(e=>{var t;return"innerHtml"===(null==(t=e.noCodeConfig)?void 0:t.type)}),r=null==t?void 0:t.noCodeEvents.filter(e=>{var t;return"cssSelector"===(null==(t=e.noCodeConfig)?void 0:t.type)}),o=e.target;n.forEach(e=>{var t;const n=null==(t=e.noCodeConfig)?void 0:t.innerHtml;n&&o.innerHTML===n.value&&He(e.name)}),r.forEach(e=>{var t;const n=null==(t=e.noCodeConfig)?void 0:t.cssSelector;n&&o.matches(n.value)&&He(e.name)})},Qe=he.getInstance(),Re=me.getInstance(),Ve=()=>{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.")},Xe=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}},Ge=(e,t)=>{Xe.add(async()=>{Ve(),await(async(e,t)=>{if(Le.debug("setting attribute: "+e+" to value: "+t),Fe(e,t))return void Le.debug("attribute already set to this value. Skipping update.");const{person:n,settings:r}=await(async(e,t)=>{if(!ze.get().person||!ze.get().person.id)return void console.error("Formbricks: Unable to update attribute. No person set.");const n=await fetch(`${ze.get().apiHost}/api/v1/client/environments/${ze.get().environmentId}/people/${ze.get().person.id}/attribute`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e,value:t})}),r=await n.json();if(!n.ok)throw Le.error("Error updating person"),Error("Error updating person");return r})(e,t);if(!n||!r)throw Le.error("Error updating attribute"),new Error("Formbricks: Error updating attribute");ze.update({person:n,settings:r})})(e,t)})},Ke={init:e=>{Xe.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&&Re.configure({logLevel:e.logLevel}),Ie(),(()=>{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 :is(.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 :is(.fb-pointer-events-none){pointer-events:none}#fbjs :is(.fb-pointer-events-auto){pointer-events:auto}#fbjs :is(.fb-fixed){position:fixed}#fbjs :is(.fb-absolute){position:absolute}#fbjs :is(.fb-relative){position:relative}#fbjs :is(.fb-inset-0){inset:0}#fbjs :is(.fb-right-0){right:0}#fbjs :is(.fb-top-0){top:0}#fbjs :is(.fb-z-10){z-index:10}#fbjs :is(.fb-z-40){z-index:40}#fbjs :is(.fb-m-4){margin:1rem}#fbjs :is(.fb-m-\\[-1px\\]){margin:-1px}#fbjs :is(.fb-my-4){margin-bottom:1rem;margin-top:1rem}#fbjs :is(.fb-mb-1){margin-bottom:.25rem}#fbjs :is(.fb-mb-1\\.5){margin-bottom:.375rem}#fbjs :is(.fb-mb-\\[10px\\]){margin-bottom:10px}#fbjs :is(.fb-ml-3){margin-left:.75rem}#fbjs :is(.fb-mr-8){margin-right:2rem}#fbjs :is(.fb-mt-4){margin-top:1rem}#fbjs :is(.fb-mt-\\[35px\\]){margin-top:35px}#fbjs :is(.fb-block){display:block}#fbjs :is(.fb-inline-block){display:inline-block}#fbjs :is(.fb-flex){display:flex}#fbjs :is(.fb-hidden){display:none}#fbjs :is(.fb-h-1){height:.25rem}#fbjs :is(.fb-h-10){height:2.5rem}#fbjs :is(.fb-h-24){height:6rem}#fbjs :is(.fb-h-4){height:1rem}#fbjs :is(.fb-h-6){height:1.5rem}#fbjs :is(.fb-h-\\[2px\\]){height:2px}#fbjs :is(.fb-h-full){height:100%}#fbjs :is(.fb-w-1){width:.25rem}#fbjs :is(.fb-w-16){width:4rem}#fbjs :is(.fb-w-24){width:6rem}#fbjs :is(.fb-w-4){width:1rem}#fbjs :is(.fb-w-4\\/5){width:80%}#fbjs :is(.fb-w-6){width:1.5rem}#fbjs :is(.fb-w-full){width:100%}#fbjs :is(.fb-max-w-sm){max-width:24rem}#fbjs :is(.fb-flex-1){flex:1 1 0%}#fbjs :is(.fb-translate-x-0){--tw-translate-x:0px;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 :is(.fb-translate-x-28){--tw-translate-x:7rem;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))}@keyframes fb-pulse{50%{opacity:.5}}#fbjs :is(.fb-animate-pulse){animation:fb-pulse 2s cubic-bezier(.4,0,.6,1) infinite}#fbjs :is(.fb-cursor-pointer){cursor:pointer}#fbjs :is(.fb-flex-col){flex-direction:column}#fbjs :is(.fb-items-end){align-items:flex-end}#fbjs :is(.fb-items-center){align-items:center}#fbjs :is(.fb-justify-center){justify-content:center}#fbjs :is(.fb-justify-between){justify-content:space-between}#fbjs :is(.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 :is(.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 :is(.fb-overflow-hidden){overflow:hidden}#fbjs :is(.fb-whitespace-nowrap){white-space:nowrap}#fbjs :is(.fb-rounded-\\[100\\%\\]){border-radius:100%}#fbjs :is(.fb-rounded-full){border-radius:9999px}#fbjs :is(.fb-rounded-lg){border-radius:.5rem}#fbjs :is(.fb-rounded-md){border-radius:.375rem}#fbjs :is(.fb-border){border-width:1px}#fbjs :is(.fb-border-0){border-width:0}#fbjs :is(.fb-border-gray-200){--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-100){--tw-border-opacity:1;border-color:rgb(241 245 249/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-300){--tw-border-opacity:1;border-color:rgb(203 213 225/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-400){--tw-border-opacity:1;border-color:rgb(148 163 184/var(--tw-border-opacity))}#fbjs :is(.fb-border-transparent){border-color:transparent}#fbjs :is(.fb-bg-slate-300){--tw-bg-opacity:1;background-color:rgb(203 213 225/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-slate-50){--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-white){--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}#fbjs :is(.fb-p-0){padding:0}#fbjs :is(.fb-p-2){padding:.5rem}#fbjs :is(.fb-p-4){padding:1rem}#fbjs :is(.fb-px-3){padding-left:.75rem;padding-right:.75rem}#fbjs :is(.fb-px-4){padding-left:1rem;padding-right:1rem}#fbjs :is(.fb-py-3){padding-bottom:.75rem;padding-top:.75rem}#fbjs :is(.fb-py-6){padding-bottom:1.5rem;padding-top:1.5rem}#fbjs :is(.fb-pr-4){padding-right:1rem}#fbjs :is(.fb-pt-4){padding-top:1rem}#fbjs :is(.fb-text-center){text-align:center}#fbjs :is(.fb-font-sans){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}#fbjs :is(.fb-text-base){font-size:1rem;line-height:1.5rem}#fbjs :is(.fb-text-sm){font-size:.875rem;line-height:1.25rem}#fbjs :is(.fb-text-xs){font-size:.75rem;line-height:1rem}#fbjs :is(.fb-font-medium){font-weight:500}#fbjs :is(.fb-font-normal){font-weight:400}#fbjs :is(.fb-font-semibold){font-weight:600}#fbjs :is(.fb-leading-10){line-height:2.5rem}#fbjs :is(.fb-leading-4){line-height:1rem}#fbjs :is(.fb-leading-6){line-height:1.5rem}#fbjs :is(.fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-500){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-800){--tw-text-opacity:1;color:rgb(30 41 59/var(--tw-text-opacity))}#fbjs :is(.fb-text-transparent){color:transparent}#fbjs :is(.fb-text-white){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}#fbjs :is(.fb-caret-transparent){caret-color:transparent}#fbjs :is(.fb-opacity-0){opacity:0}#fbjs :is(.fb-opacity-100){opacity:1}#fbjs :is(.fb-opacity-60){opacity:.6}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.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 :is(.fb-ring-black){--tw-ring-opacity:1;--tw-ring-color:rgb(0 0 0/var(--tw-ring-opacity))}#fbjs :is(.fb-ring-opacity-5){--tw-ring-opacity:0.05}#fbjs :is(.fb-transition-all){transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.fb-duration-500){transition-duration:.5s}#fbjs :is(.fb-ease-in-out){transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.hover\\:fb-bg-slate-50:hover){--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity))}#fbjs :is(.hover\\:fb-text-slate-500:hover){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.hover\\:fb-opacity-90:hover){opacity:.9}#fbjs :is(.focus\\:fb-border-slate-500:focus){--tw-border-opacity:1;border-color:rgb(100 116 139/var(--tw-border-opacity))}#fbjs :is(.focus\\:fb-border-transparent:focus){border-color:transparent}#fbjs :is(.focus\\:fb-outline-none:focus){outline:2px solid transparent;outline-offset:2px}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.focus\\:fb-ring-slate-500:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(100 116 139/var(--tw-ring-opacity))}#fbjs :is(.focus\\:fb-ring-offset-0:focus){--tw-ring-offset-width:0px}#fbjs :is(.focus\\:fb-ring-offset-2:focus){--tw-ring-offset-width:2px}@media (min-width:640px){#fbjs :is(.sm\\:fb-block){display:block}#fbjs :is(.sm\\:fb-items-end){align-items:flex-end}#fbjs :is(.sm\\:fb-p-6){padding:1.5rem}#fbjs :is(.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){if(Qe.get().session&&Ae(Qe.get().session)){const{session:e,settings:t}=await Pe();Qe.update({session:Me(e),settings:t}),He("New Session")}else if(!Qe.get().session)return void Re.error("Unable to initialize. No session found")}else{Qe.update({environmentId:e.environmentId,apiHost:e.apiHost});const{person:t,session:n,settings:r}=await $e();Qe.update({person:t,session:Me(n),settings:r}),He("New Session")}(()=>{if("undefined"!=typeof window){const e=window.setInterval(async()=>{await(async()=>{if(Oe.debug("Checking session"),Ae(Ue.get().session)){Oe.debug("Session expired, creating new session");const{session:e,settings:t}=await Pe();if(!e||!t)throw Oe.error("Error creating new session"),Error("Error creating new session");Ue.update({session:e,settings:t}),He("New Session")}Oe.debug("Session not expired, extending session"),Ue.update({session:Me(Ue.get().session)})})()},3e5);window.addEventListener("beforeunload",()=>{clearInterval(e)})}})(),"undefined"!=typeof window&&(window.addEventListener("hashchange",Be),window.addEventListener("popstate",Be),window.addEventListener("pushstate",Be),window.addEventListener("replacestate",Be),window.addEventListener("load",Be)),"undefined"!=typeof window&&document.addEventListener("click",Ye),Re.debug("Initialized")})(e)})},setUserId:e=>{Xe.add(async()=>{Ve(),await(async e=>{if(Le.debug("setting userId: "+e),Fe("userId",e))return void Le.debug("userId already set to this value. Skipping update.");if((e=>{const t=ze.get().person.attributes.find(e=>{var t;return"userId"===(null==(t=e.attributeClass)?void 0:t.name)});return!!t})())return void Le.error("userId cannot be changed after it has been set. You need to reset first");const{person:t,settings:n}=await(async e=>{if(!ze.get().person||!ze.get().person.id)return void console.error("Formbricks: Unable to update userId. No person set.");const t=await fetch(`${ze.get().apiHost}/api/v1/client/environments/${ze.get().environmentId}/people/${ze.get().person.id}/user-id`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,sessionId:ze.get().session.id})});if(!t.ok)throw Le.error("Formbricks: Error updating person"),Error("Error updating person");return await t.json()})(e);ze.update({person:t,settings:n})})(e)})},setEmail:e=>{Ge("email",e)},setAttribute:Ge,track:(e,t={})=>{Xe.add(async()=>{Ve(),await He(e,t)})},logout:()=>{Xe.add(async()=>{Ve(),await(async()=>{Le.debug("Resetting person. Getting new person, session and settings from backend");const{person:e,session:t,settings:n}=await $e();if(!e||!t||!n)throw Le.error("Error resetting user"),new Error("Formbricks: Error resetting user");ze.update({person:e,session:t,settings:n})})()})},refresh:()=>{Xe.add(async()=>{Ve(),await(async()=>{we.debug("Refreshing - getting settings from backend");const e=await ye();ve.update({settings:e})})()})},registerRouteChange:()=>{Xe.add(async()=>{Ve(),Be()})}};export{Ke 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={},h=[],_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function g(e,t){for(var n in t)e[n]=t[n];return e}function v(e){var t=e.parentNode;t&&t.removeChild(e)}function m(e,t,n){var r,o,i,s={};for(i in t)"key"==i?r=t[i]:"ref"==i?o=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?a.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===s[i]&&(s[i]=e.defaultProps[i]);return w(e,s,r,o,null)}function w(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?++l:o};return null==o&&null!=f.vnode&&f.vnode(i),i}function y(e){return e.children}function j(e,t){this.props=e,this.context=t}function x(e,t){if(null==t)return e.__?x(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?x(e):null}function k(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 k(e)}}function P(e){(!e.__d&&(e.__d=!0)&&u.push(e)&&!C.__r++||c!==f.debounceRendering)&&((c=f.debounceRendering)||d)(C)}function C(){var e,t,n,r,o,i,s,a;for(u.sort(b);e=u.shift();)e.__d&&(t=u.length,r=void 0,o=void 0,s=(i=(n=e).__v).__e,(a=n.__P)&&(r=[],(o=g({},i)).__v=i.__v+1,L(a,i,o,n.__n,void 0!==a.ownerSVGElement,null!=i.__h?[s]:null,r,null==s?x(i):s,i.__h),F(r,i),i.__e!=s&&k(i)),u.length>t&&u.sort(b));C.__r=0}function S(e,t,n,r,o,i,s,a,f,l){var u,c,d,b,_,g,v,m=r&&r.__k||h,j=m.length;for(n.__k=[],u=0;u<t.length;u++)if(null!=(b=n.__k[u]=null==(b=t[u])||"boolean"==typeof b||"function"==typeof b?null:"string"==typeof b||"number"==typeof b||"bigint"==typeof b?w(null,b,null,null,b):Array.isArray(b)?w(y,{children:b},null,null,null):b.__b>0?w(b.type,b.props,b.key,b.ref?b.ref:null,b.__v):b)){if(b.__=n,b.__b=n.__b+1,null===(d=m[u])||d&&b.key==d.key&&b.type===d.type)m[u]=void 0;else for(c=0;c<j;c++){if((d=m[c])&&b.key==d.key&&b.type===d.type){m[c]=void 0;break}d=null}L(e,b,d=d||p,o,i,s,a,f,l),_=b.__e,(c=b.ref)&&d.ref!=c&&(v||(v=[]),d.ref&&v.push(d.ref,null,b),v.push(c,b.__c||_,b)),null!=_?(null==g&&(g=_),"function"==typeof b.type&&b.__k===d.__k?b.__d=f=I(b,f,e):f=E(e,b,d,m,_,f),"function"==typeof n.type&&(n.__d=f)):f&&d.__e==f&&f.parentNode!=e&&(f=x(d))}for(n.__e=g,u=j;u--;)null!=m[u]&&("function"==typeof n.type&&null!=m[u].__e&&m[u].__e==n.__d&&(n.__d=N(r).nextSibling),A(m[u],m[u]));if(v)for(u=0;u<v.length;u++)U(v[u],v[++u],v[++u])}function I(e,t,n){for(var r,o=e.__k,i=0;o&&i<o.length;i++)(r=o[i])&&(r.__=e,t="function"==typeof r.type?I(r,t,n):E(n,r,r,o,r.__e,t));return t}function E(e,t,n,r,o,i){var s,a,f;if(void 0!==t.__d)s=t.__d,t.__d=void 0;else if(null==n||o!=i||null==o.parentNode)e:if(null==i||i.parentNode!==e)e.appendChild(o),s=null;else{for(a=i,f=0;(a=a.nextSibling)&&f<r.length;f+=1)if(a==o)break e;e.insertBefore(o,i),s=i}return void 0!==s?s:o.nextSibling}function N(e){var t,n,r;if(null==e.type||"string"==typeof e.type)return e.__e;if(e.__k)for(t=e.__k.length-1;t>=0;t--)if((n=e.__k[t])&&(r=N(n)))return r;return null}function H(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||_.test(t)?n:n+"px"}function T(e,t,n,r,o){var i;e:if("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||H(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||H(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])i=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r||e.addEventListener(t,i?z:q,i):e.removeEventListener(t,i?z:q,i);else if("dangerouslySetInnerHTML"!==t){if(o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function q(e){return this.l[e.type+!1](f.event?f.event(e):e)}function z(e){return this.l[e.type+!0](f.event?f.event(e):e)}function L(e,t,n,r,o,i,s,a,l){var u,c,d,b,p,h,_,v,m,w,x,k,P,C,I,E=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(l=n.__h,a=t.__e=n.__e,t.__h=null,i=[a]),(u=f.__b)&&u(t);try{e:if("function"==typeof E){if(v=t.props,m=(u=E.contextType)&&r[u.__c],w=u?m?m.props.value:u.__:r,n.__c?_=(c=t.__c=n.__c).__=c.__E:("prototype"in E&&E.prototype.render?t.__c=c=new E(v,w):(t.__c=c=new j(v,w),c.constructor=E,c.render=M),m&&m.sub(c),c.props=v,c.state||(c.state={}),c.context=w,c.__n=r,d=c.__d=!0,c.__h=[],c._sb=[]),null==c.__s&&(c.__s=c.state),null!=E.getDerivedStateFromProps&&(c.__s==c.state&&(c.__s=g({},c.__s)),g(c.__s,E.getDerivedStateFromProps(v,c.__s))),b=c.props,p=c.state,c.__v=t,d)null==E.getDerivedStateFromProps&&null!=c.componentWillMount&&c.componentWillMount(),null!=c.componentDidMount&&c.__h.push(c.componentDidMount);else{if(null==E.getDerivedStateFromProps&&v!==b&&null!=c.componentWillReceiveProps&&c.componentWillReceiveProps(v,w),!c.__e&&null!=c.shouldComponentUpdate&&!1===c.shouldComponentUpdate(v,c.__s,w)||t.__v===n.__v){for(t.__v!==n.__v&&(c.props=v,c.state=c.__s,c.__d=!1),c.__e=!1,t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(e){e&&(e.__=t)}),x=0;x<c._sb.length;x++)c.__h.push(c._sb[x]);c._sb=[],c.__h.length&&s.push(c);break e}null!=c.componentWillUpdate&&c.componentWillUpdate(v,c.__s,w),null!=c.componentDidUpdate&&c.__h.push(function(){c.componentDidUpdate(b,p,h)})}if(c.context=w,c.props=v,c.__P=e,k=f.__r,P=0,"prototype"in E&&E.prototype.render){for(c.state=c.__s,c.__d=!1,k&&k(t),u=c.render(c.props,c.state,c.context),C=0;C<c._sb.length;C++)c.__h.push(c._sb[C]);c._sb=[]}else do{c.__d=!1,k&&k(t),u=c.render(c.props,c.state,c.context),c.state=c.__s}while(c.__d&&++P<25);c.state=c.__s,null!=c.getChildContext&&(r=g(g({},r),c.getChildContext())),d||null==c.getSnapshotBeforeUpdate||(h=c.getSnapshotBeforeUpdate(b,p)),I=null!=u&&u.type===y&&null==u.key?u.props.children:u,S(e,Array.isArray(I)?I:[I],t,n,r,o,i,s,a,l),c.base=t.__e,t.__h=null,c.__h.length&&s.push(c),_&&(c.__E=c.__=null),c.__e=!1}else null==i&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=O(n.__e,t,n,r,o,i,s,l);(u=f.diffed)&&u(t)}catch(e){t.__v=null,(l||null!=i)&&(t.__e=a,t.__h=!!l,i[i.indexOf(a)]=null),f.__e(e,t,n)}}function F(e,t){f.__c&&f.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){f.__e(e,t.__v)}})}function O(e,t,n,r,o,i,s,f){var l,u,c,d=n.props,b=t.props,h=t.type,_=0;if("svg"===h&&(o=!0),null!=i)for(;_<i.length;_++)if((l=i[_])&&"setAttribute"in l==!!h&&(h?l.localName===h:3===l.nodeType)){e=l,i[_]=null;break}if(null==e){if(null===h)return document.createTextNode(b);e=o?document.createElementNS("http://www.w3.org/2000/svg",h):document.createElement(h,b.is&&b),i=null,f=!1}if(null===h)d===b||f&&e.data===b||(e.data=b);else{if(i=i&&a.call(e.childNodes),u=(d=n.props||p).dangerouslySetInnerHTML,c=b.dangerouslySetInnerHTML,!f){if(null!=i)for(d={},_=0;_<e.attributes.length;_++)d[e.attributes[_].name]=e.attributes[_].value;(c||u)&&(c&&(u&&c.__html==u.__html||c.__html===e.innerHTML)||(e.innerHTML=c&&c.__html||""))}if(function(e,t,n,r,o){var i;for(i in n)"children"===i||"key"===i||i in t||T(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]||T(e,i,t[i],n[i],r)}(e,b,d,o,f),c)t.__k=[];else if(_=t.props.children,S(e,Array.isArray(_)?_:[_],t,n,r,o&&"foreignObject"!==h,i,s,i?i[0]:n.__k&&x(n,0),f),null!=i)for(_=i.length;_--;)null!=i[_]&&v(i[_]);f||("value"in b&&void 0!==(_=b.value)&&(_!==e.value||"progress"===h&&!_||"option"===h&&_!==d.value)&&T(e,"value",_,d.value,!1),"checked"in b&&void 0!==(_=b.checked)&&_!==e.checked&&T(e,"checked",_,d.checked,!1))}return e}function U(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){f.__e(e,n)}}function A(e,t,n){var r,o;if(f.unmount&&f.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||U(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){f.__e(e,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&A(r[o],t,n||"function"!=typeof e.type);n||null==e.__e||v(e.__e),e.__=e.__e=e.__d=void 0}function M(e,t,n){return this.constructor(e,n)}a=h.slice,f={__e:function(e,t,n,r){for(var o,i,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&null!=i.getDerivedStateFromError&&(o.setState(i.getDerivedStateFromError(e)),s=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,r||{}),s=o.__d),s)return o.__E=o}catch(t){e=t}throw e}},l=0,j.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=g({},this.state),"function"==typeof e&&(e=e(g({},n),this.props)),e&&g(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),P(this))},j.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),P(this))},j.prototype.render=y,u=[],d="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,b=function(e,t){return e.__v.__b-t.__v.__b},C.__r=0;var D,W,B,J,Y=0,R=[],V=[],Q=f.__b,X=f.__r,$=f.diffed,G=f.__c,K=f.unmount;function Z(e,t){f.__h&&f.__h(W,e,Y||t),Y=0;var n=W.__H||(W.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:V}),n.__[e]}function ee(e){return Y=1,function(e,t,n){var r=Z(D++,2);if(r.t=e,!r.__c&&(r.__=[ae(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=W,!W.u)){var o=function(e,t,n){if(!r.__c.__H)return!0;var o=r.__c.__H.__.filter(function(e){return e.__c});if(o.every(function(e){return!e.__N}))return!i||i.call(this,e,t,n);var s=!1;return o.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}}),!(!s&&r.__c.props===e)&&(!i||i.call(this,e,t,n))};W.u=!0;var i=W.shouldComponentUpdate,s=W.componentWillUpdate;W.componentWillUpdate=function(e,t,n){if(this.__e){var r=i;i=void 0,o(e,t,n),i=r}s&&s.call(this,e,t,n)},W.shouldComponentUpdate=o}return r.__N||r.__}(ae,e)}function te(e,t){var n=Z(D++,3);!f.__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.i=t,W.__H.__h.push(n))}function ne(){for(var e;e=R.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ie),e.__H.__h.forEach(se),e.__H.__h=[]}catch(t){e.__H.__h=[],f.__e(t,e.__v)}}f.__b=function(e){W=null,Q&&Q(e)},f.__r=function(e){X&&X(e),D=0;var t=(W=e.__c).__H;t&&(B===W?(t.__h=[],W.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.__V=V,e.__N=e.i=void 0})):(t.__h.forEach(ie),t.__h.forEach(se),t.__h=[])),B=W},f.diffed=function(e){$&&$(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==R.push(t)&&J===f.requestAnimationFrame||((J=f.requestAnimationFrame)||oe)(ne)),t.__H.__.forEach(function(e){e.i&&(e.__H=e.i),e.__V!==V&&(e.__=e.__V),e.i=void 0,e.__V=V})),B=W=null},f.__c=function(e,t){t.some(function(e){try{e.__h.forEach(ie),e.__h=e.__h.filter(function(e){return!e.__||se(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],f.__e(n,e.__v)}}),G&&G(e,t)},f.unmount=function(e){K&&K(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{ie(e)}catch(e){t=e}}),n.__H=void 0,t&&f.__e(t,n.__v))};var re="function"==typeof requestAnimationFrame;function oe(e){var t,n=function(){clearTimeout(r),re&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);re&&(t=requestAnimationFrame(n))}function ie(e){var t=W,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),W=t}function se(e){var t=W;e.__c=e.__(),W=t}function ae(e,t){return"function"==typeof t?t(e):t}var fe=function(){return[].slice.call(arguments).filter(Boolean).join(" ")};function le(e){var t=e.children,n=e.isOpen,r=e.close,o=ee(!1),i=o[0],s=o[1];return te(function(){s(n)},[n]),m("div",{"aria-live":"assertive",className:"fb-pointer-events-none fb-fixed fb-inset-0 fb-flex fb-items-end"},m("div",{className:"fb-flex fb-w-full fb-flex-col fb-items-center fb-space-y-4 sm:fb-items-end"},m("div",{className:fe(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 fb-z-40")},m("div",{class:"fb-absolute fb-top-0 fb-right-0 fb-hidden fb-pt-4 fb-pr-4 sm:fb-block"},m("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 fb-text-slate-400 hover:fb-text-slate-500 focus:ring-slate-500"},m("span",{class:"fb-sr-only"},"Close"),m("svg",{class:"fb-h-6 fb-w-6",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})))),m("div",{className:""},t))))}var ue=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)}},ce=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 de(e){return m("label",{htmlFor:e.questionId,className:"fb-mb-1.5 fb-block fb-text-base fb-font-semibold fb-leading-6 fb-mr-8 text-slate-900",style:e.style},e.headline)}function be(e){return m("label",{for:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600"},e.subheader)}function pe(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return m("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)}},m(de,{headline:t.headline,questionId:t.id}),m(be,{subheader:t.subheader,questionId:t.id}),m("div",{className:"fb-mt-4"},m("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 fb-bg-slate-50 fb-border-slate-100 focus:fb-border-slate-500"})),m("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},m("div",null),m("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:fb-ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function he(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ee(null),s=i[0],a=i[1];return m("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)}},m(de,{headline:t.headline,questionId:t.id}),m(be,{subheader:t.subheader,questionId:t.id}),m("div",{className:"fb-mt-4"},m("fieldset",null,m("legend",{className:"fb-sr-only"},"Choices"),m("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e,n){return m("label",{key:e.id,className:fe(s===e.label?"fb-z-10 fb-bg-slate-50 fb-border-slate-400":"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")},m("span",{className:"fb-flex fb-items-center fb-text-sm"},m("input",{type:"radio",id:e.id,name:t.id,value:e.label,className:"fb-h-4 fb-w-4 fb-border fb-border-slate-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},required:t.required&&0===n}),m("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),m("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},m("div",null),m("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 _e(e){return m("div",{className:"fb-h-1 fb-w-full fb-rounded-full bg-slate-200"},m("div",{className:"fb-h-1 fb-rounded-full",style:{backgroundColor:e.brandColor,width:Math.floor(100*e.progress)+"%"}}))}function ge(e){var t=e.headline,n=e.subheader;return m("div",{className:"fb-text-center"},m("div",{className:"fb-flex fb-items-center fb-justify-center",style:{color:e.brandColor}},m("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"fb-h-24 fb-w-24"},m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))),m("span",{className:"fb-inline-block fb-rounded-[100%] fb-w-16 fb-h-1 fb-mb-[10px] fb-bg-slate-300"}),m("div",null,m(de,{headline:t,questionId:"thankYouCard",style:{"margin-right":0}}),m(be,{subheader:n,questionId:"thankYouCard"})))}function ve(e){var t,n=e.config,r=e.survey,o=e.close,i=e.brandColor,s=ee(r.questions[0]),a=s[0],f=s[1],l=ee(0),u=l[0],c=l[1],d=ee(null),b=d[0],p=d[1],h=ee(null),_=h[0],g=h[1],v=ee(!1),w=v[0],y=v[1];te(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:r.id,personId:n.person.id},n)).then(function(e){g(e.id)})}catch(e){return Promise.reject(e)}}()},[n,r]),te(function(){var e;c((e=r.questions.findIndex(function(e){return e.id===a.id}),e/r.questions.length))},[a,r]);var j=function(e){try{var t=function(){y(!1),s?(c(100),r.thankYouCard.enabled?setTimeout(function(){o()},2e3):o()):f(r.questions[i+1])};y(!0);var i=r.questions.findIndex(function(e){return e.id===a.id}),s=i===r.questions.length-1,l={surveyId:r.id,personId:n.person.id,response:{finished:s,data:e}},u=b?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,b,n)).then(function(){}):Promise.resolve(Promise.all([ce(l,n),ue(_,n)])).then(function(e){p(e[0].id)});return Promise.resolve(u&&u.then?u.then(t):t())}catch(e){return Promise.reject(e)}};return m("div",null,m("div",{className:fe(w?"fb-animate-pulse fb-opacity-60":"","fb-text-slate-800 fb-font-sans fb-px-4 fb-py-6 sm:fb-p-6")},100===u&&r.thankYouCard.enabled?m(ge,{headline:r.thankYouCard.headline,subheader:r.thankYouCard.subheader,brandColor:null==(t=n.settings)?void 0:t.brandColor}):"multipleChoiceSingle"===a.type?m(he,{question:a,onSubmit:j,lastQuestion:r.questions.findIndex(function(e){return e.id===a.id})===r.questions.length-1,brandColor:i}):"openText"===a.type?m(pe,{question:a,onSubmit:j,lastQuestion:r.questions.findIndex(function(e){return e.id===a.id})===r.questions.length-1,brandColor:i}):null),m(_e,{progress:u,brandColor:i}))}function me(e){var t,n=e.config,r=e.survey,o=e.closeSurvey,i=ee(!0),s=i[1],a=function(){s(!1),setTimeout(function(){o()},1e3)};return m("div",{id:"fbjs"},m(le,{isOpen:i[0],close:a},m(ve,{config:n,survey:r,close:a,brandColor:null==(t=n.settings)?void 0:t.brandColor})))}var we=/*#__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}();we.instance=void 0;var ye=/*#__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}();ye.instance=void 0;var je=ye.getInstance(),xe=we.getInstance(),ke=function(){try{return Promise.resolve(fetch(xe.get().apiHost+"/api/v1/client/environments/"+xe.get().environmentId+"/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:xe.get().person.id})})).then(function(e){if(!e.ok)throw je.error("Error getting settings"),Error("Error getting settings");return e.json()})}catch(e){return Promise.reject(e)}},Pe="formbricks-web-container",Ce=we.getInstance(),Se=ye.getInstance(),Ie=!1,Ee=function(e){Ie?Se.debug("A survey is already running. Skipping."):(Ie=!0,function(e,t,n){var r,o;f.__&&f.__(e,t),r=t.__k,o=[],L(t,e=t.__k=m(y,null,[e]),r||p,p,void 0!==t.ownerSVGElement,r?null:t.firstChild?a.call(t.childNodes):null,o,r?r.__e:t.firstChild,!1),F(o,e)}(m(me,{config:Ce.get(),survey:e,closeSurvey:Ne}),document.getElementById(Pe)))},Ne=function(){try{return document.getElementById(Pe).remove(),He(),Promise.resolve(ke()).then(function(e){Ce.update({settings:e}),Ie=!1})}catch(e){return Promise.reject(e)}},He=function(){var e=document.createElement("div");e.id=Pe,document.body.appendChild(e)},Te=ye.getInstance(),qe=we.getInstance(),ze=function(e,t){try{return Promise.resolve(fetch(qe.get().apiHost+"/api/v1/client/environments/"+qe.get().environmentId+"/events",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:qe.get().session.id,eventName:e,properties:t})})).then(function(t){var n;function r(t){if(n)return t;Te.debug('Formbricks: Event "'+e+'" tracked'),Le(e)}var o=function(){if(!t.ok)return Promise.resolve(t.json()).then(function(e){Te.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)}},Le=function(e){for(var t,n=s(null==(r=qe.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 Te.debug("Formbricks: survey "+i.id+' triggered by event "'+e+'"'),void Ee(i)}},Fe=we.getInstance(),Oe=ye.getInstance(),Ue=function(){try{return Oe.debug("Creating new person"),Promise.resolve(fetch(Fe.get().apiHost+"/api/v1/client/environments/"+Fe.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)}},Ae=function(e,t){var n=Fe.get().person.attributes.find(function(t){var n;return(null==(n=t.attributeClass)?void 0:n.name)===e});return!(!n||n.value!==t)},Me=ye.getInstance(),De=we.getInstance(),We=function(){try{return De.get().person?Promise.resolve(fetch(De.get().apiHost+"/api/v1/client/environments/"+De.get().environmentId+"/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:De.get().person.id})})).then(function(e){if(e.ok)return Promise.resolve(e.json());Me.error("Error creating session")}):(Me.error("Formbricks: Unable to create session. No person found"),Promise.resolve())}catch(e){return Promise.reject(e)}},Be=function(e){Me.debug("Session expired. Creating new session.");var t=o({},e);return t.expiresAt=Date.now()+36e5,t},Je=function(e){return e.expiresAt<=Date.now()},Ye=we.getInstance(),Re=ye.getInstance(),Ve=function(){var e=Ye.get().settings,t=null==e?void 0:e.noCodeEvents.filter(function(e){var t;return"pageUrl"===(null==(t=e.noCodeConfig)?void 0:t.type)});if(Re.debug("checking page url"),0!==t.length)for(var n,r=s(t);!(n=r()).done;){var o=n.value,i=o.noCodeConfig.pageUrl;i&&Qe(window.location.href,i.value,i.rule)&&ze(o.name)}};function Qe(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 Xe=function(e){var t=Ye.get().settings,n=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"innerHtml"===(null==(t=e.noCodeConfig)?void 0:t.type)}),r=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"cssSelector"===(null==(t=e.noCodeConfig)?void 0:t.type)}),o=e.target;n.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.innerHtml;n&&o.innerHTML===n.value&&ze(e.name)}),r.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.cssSelector;n&&o.matches(n.value)&&ze(e.name)})},$e=we.getInstance(),Ge=ye.getInstance(),Ke=function(){if(!($e.get().apiHost&&$e.get().environmentId&&$e.get().person&&$e.get().session&&$e.get().settings))throw Error("Formbricks: Formbricks not initialized. Call initialize() first.")},Ze=new r,et=function(e,t){Ze.add(function(){try{return Ke(),Promise.resolve(function(e,t){try{return Oe.debug("setting attribute: "+e+" to value: "+t),Ae(e,t)?(Oe.debug("attribute already set to this value. Skipping update."),Promise.resolve()):Promise.resolve(function(e,t){try{return Fe.get().person&&Fe.get().person.id?Promise.resolve(fetch(Fe.get().apiHost+"/api/v1/client/environments/"+Fe.get().environmentId+"/people/"+Fe.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 Oe.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 Oe.error("Error updating attribute"),new Error("Formbricks: Error updating attribute");Fe.update({person:t,settings:n})})}catch(e){return Promise.reject(e)}}(e,t)).then(function(){})}catch(e){return Promise.reject(e)}})},tt={init:function(e){Ze.add(function(){try{return function(e){try{var t,n=function(e){if(t)return e;(function(){if("undefined"!=typeof window){var e=window.setInterval(function(){try{return Promise.resolve(function(){try{var e=function(e){Me.debug("Session not expired, extending session"),De.update({session:Be(De.get().session)})};Me.debug("Checking session");var t=function(){if(Je(De.get().session))return Me.debug("Session expired, creating new session"),Promise.resolve(We()).then(function(e){var t=e.session,n=e.settings;if(!t||!n)throw Me.error("Error creating new session"),Error("Error creating new session");De.update({session:t,settings:n}),ze("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",Ve),window.addEventListener("popstate",Ve),window.addEventListener("pushstate",Ve),window.addEventListener("replacestate",Ve),window.addEventListener("load",Ve)),"undefined"!=typeof window&&document.addEventListener("click",Xe),Ge.debug("Initialized")};if(!e.environmentId)throw Error("Formbricks: environmentId is required");if(!e.apiHost)throw Error("Formbricks: apiHost is required");e.logLevel&&Ge.configure({logLevel:e.logLevel}),He(),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 :is(.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 :is(.fb-pointer-events-none){pointer-events:none}#fbjs :is(.fb-pointer-events-auto){pointer-events:auto}#fbjs :is(.fb-fixed){position:fixed}#fbjs :is(.fb-absolute){position:absolute}#fbjs :is(.fb-relative){position:relative}#fbjs :is(.fb-inset-0){inset:0}#fbjs :is(.fb-right-0){right:0}#fbjs :is(.fb-top-0){top:0}#fbjs :is(.fb-z-10){z-index:10}#fbjs :is(.fb-mb-\\[10px\\]){margin-bottom:10px}#fbjs :is(.fb-ml-3){margin-left:.75rem}#fbjs :is(.fb-mr-8){margin-right:2rem}#fbjs :is(.fb-mt-2){margin-top:.5rem}#fbjs :is(.fb-mt-4){margin-top:1rem}#fbjs :is(.fb-mt-\\[35px\\]){margin-top:35px}#fbjs :is(.fb-block){display:block}#fbjs :is(.fb-inline-block){display:inline-block}#fbjs :is(.fb-flex){display:flex}#fbjs :is(.fb-hidden){display:none}#fbjs :is(.fb-h-1){height:.25rem}#fbjs :is(.fb-h-24){height:6rem}#fbjs :is(.fb-h-4){height:1rem}#fbjs :is(.fb-h-6){height:1.5rem}#fbjs :is(.fb-h-\\[2px\\]){height:2px}#fbjs :is(.fb-w-16){width:4rem}#fbjs :is(.fb-w-24){width:6rem}#fbjs :is(.fb-w-4){width:1rem}#fbjs :is(.fb-w-4\\/5){width:80%}#fbjs :is(.fb-w-6){width:1.5rem}#fbjs :is(.fb-w-full){width:100%}#fbjs :is(.fb-max-w-sm){max-width:24rem}#fbjs :is(.fb-translate-x-0){--tw-translate-x:0px;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 :is(.fb-translate-x-28){--tw-translate-x:7rem;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))}@keyframes fb-pulse{50%{opacity:.5}}#fbjs :is(.fb-animate-pulse){animation:fb-pulse 2s cubic-bezier(.4,0,.6,1) infinite}#fbjs :is(.fb-cursor-pointer){cursor:pointer}#fbjs :is(.fb-flex-col){flex-direction:column}#fbjs :is(.fb-items-end){align-items:flex-end}#fbjs :is(.fb-items-center){align-items:center}#fbjs :is(.fb-justify-center){justify-content:center}#fbjs :is(.fb-justify-between){justify-content:space-between}#fbjs :is(.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 :is(.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 :is(.fb-overflow-hidden){overflow:hidden}#fbjs :is(.fb-rounded-\\[100\\%\\]){border-radius:100%}#fbjs :is(.fb-rounded-full){border-radius:9999px}#fbjs :is(.fb-rounded-lg){border-radius:.5rem}#fbjs :is(.fb-rounded-md){border-radius:.375rem}#fbjs :is(.fb-border){border-width:1px}#fbjs :is(.fb-border-gray-200){--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-100){--tw-border-opacity:1;border-color:rgb(241 245 249/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-300){--tw-border-opacity:1;border-color:rgb(203 213 225/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-400){--tw-border-opacity:1;border-color:rgb(148 163 184/var(--tw-border-opacity))}#fbjs :is(.fb-border-transparent){border-color:transparent}#fbjs :is(.fb-bg-slate-300){--tw-bg-opacity:1;background-color:rgb(203 213 225/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-slate-50){--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-white){--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}#fbjs :is(.fb-p-2){padding:.5rem}#fbjs :is(.fb-p-4){padding:1rem}#fbjs :is(.fb-px-3){padding-left:.75rem;padding-right:.75rem}#fbjs :is(.fb-px-4){padding-left:1rem;padding-right:1rem}#fbjs :is(.fb-py-3){padding-bottom:.75rem;padding-top:.75rem}#fbjs :is(.fb-py-6){padding-bottom:1.5rem;padding-top:1.5rem}#fbjs :is(.fb-pr-4){padding-right:1rem}#fbjs :is(.fb-pt-4){padding-top:1rem}#fbjs :is(.fb-text-center){text-align:center}#fbjs :is(.fb-font-sans){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}#fbjs :is(.fb-text-base){font-size:1rem;line-height:1.5rem}#fbjs :is(.fb-text-sm){font-size:.875rem;line-height:1.25rem}#fbjs :is(.fb-text-xs){font-size:.75rem;line-height:1rem}#fbjs :is(.fb-font-medium){font-weight:500}#fbjs :is(.fb-font-normal){font-weight:400}#fbjs :is(.fb-font-semibold){font-weight:600}#fbjs :is(.fb-leading-4){line-height:1rem}#fbjs :is(.fb-leading-6){line-height:1.5rem}#fbjs :is(.fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-500){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-800){--tw-text-opacity:1;color:rgb(30 41 59/var(--tw-text-opacity))}#fbjs :is(.fb-text-white){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}#fbjs :is(.fb-opacity-0){opacity:0}#fbjs :is(.fb-opacity-100){opacity:1}#fbjs :is(.fb-opacity-60){opacity:.6}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.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 :is(.fb-ring-black){--tw-ring-opacity:1;--tw-ring-color:rgb(0 0 0/var(--tw-ring-opacity))}#fbjs :is(.fb-ring-opacity-5){--tw-ring-opacity:0.05}#fbjs :is(.fb-transition-all){transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.fb-duration-500){transition-duration:.5s}#fbjs :is(.fb-ease-in-out){transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.hover\\:fb-text-slate-500:hover){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.hover\\:fb-opacity-90:hover){opacity:.9}#fbjs :is(.focus\\:fb-border-slate-500:focus){--tw-border-opacity:1;border-color:rgb(100 116 139/var(--tw-border-opacity))}#fbjs :is(.focus\\:fb-outline-none:focus){outline:2px solid transparent;outline-offset:2px}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.focus\\:fb-ring-slate-500:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(100 116 139/var(--tw-ring-opacity))}#fbjs :is(.focus\\:fb-ring-offset-0:focus){--tw-ring-offset-width:0px}#fbjs :is(.focus\\:fb-ring-offset-2:focus){--tw-ring-offset-width:2px}@media (min-width:640px){#fbjs :is(.sm\\:fb-block){display:block}#fbjs :is(.sm\\:fb-items-end){align-items:flex-end}#fbjs :is(.sm\\:fb-p-6){padding:1.5rem}#fbjs :is(.sm\\:fb-text-sm){font-size:.875rem;line-height:1.25rem}}',document.head.appendChild(e)}}();var r=$e&&$e.get().environmentId===e.environmentId&&$e.get().apiHost===e.apiHost?$e.get().session&&Je($e.get().session)?Promise.resolve(We()).then(function(e){var t=e.settings;$e.update({session:Be(e.session),settings:t}),ze("New Session")}):$e.get().session?void 0:(Ge.error("Unable to initialize. No session found"),void(t=1)):($e.update({environmentId:e.environmentId,apiHost:e.apiHost}),Promise.resolve(Ue()).then(function(e){var t=e.settings;$e.update({person:e.person,session:Be(e.session),settings:t}),ze("New Session")}));Promise.resolve(r&&r.then?r.then(n):n(r))}catch(e){return Promise.reject(e)}}(e),Promise.resolve()}catch(e){return Promise.reject(e)}})},setUserId:function(e){Ze.add(function(){try{return Ke(),Promise.resolve(function(e){try{return Oe.debug("setting userId: "+e),Ae("userId",e)?(Oe.debug("userId already set to this value. Skipping update."),Promise.resolve()):(t=Fe.get().person.attributes.find(function(e){var t;return"userId"===(null==(t=e.attributeClass)?void 0:t.name)}),t?(Oe.error("userId cannot be changed after it has been set. You need to reset first"),Promise.resolve()):Promise.resolve(function(e){try{return Fe.get().person&&Fe.get().person.id?Promise.resolve(fetch(Fe.get().apiHost+"/api/v1/client/environments/"+Fe.get().environmentId+"/people/"+Fe.get().person.id+"/user-id",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,sessionId:Fe.get().session.id})})).then(function(e){if(!e.ok)throw Oe.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){Fe.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){et("email",e)},setAttribute:et,track:function(e,t){void 0===t&&(t={}),Ze.add(function(){try{return Ke(),Promise.resolve(ze(e,t)).then(function(){})}catch(e){return Promise.reject(e)}})},logout:function(){Ze.add(function(){try{return Ke(),Promise.resolve(function(){try{return Oe.debug("Resetting person. Getting new person, session and settings from backend"),Promise.resolve(Ue()).then(function(e){var t=e.person,n=e.session,r=e.settings;if(!t||!n||!r)throw Oe.error("Error resetting user"),new Error("Formbricks: Error resetting user");Fe.update({person:t,session:n,settings:r})})}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}})},refresh:function(){Ze.add(function(){try{return Ke(),Promise.resolve(function(){try{return je.debug("Refreshing - getting settings from backend"),Promise.resolve(ke()).then(function(e){xe.update({settings:e})})}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}})},registerRouteChange:function(){Ze.add(function(){try{return Ke(),Ve(),Promise.resolve()}catch(e){return Promise.reject(e)}})}};export{tt 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(b):1===s?f.then(c):(void 0).then(function(){(a=r())?a.then?a.then(b).then(void 0,u):b(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(b).then(void 0,u);n(f=i())&&(f=f.v)}while(!f||!f.then);f.then(c).then(void 0,u)}function b(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,b,d,p={},h=[],_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function g(e,t){for(var n in t)e[n]=t[n];return e}function m(e){var t=e.parentNode;t&&t.removeChild(e)}function v(e,t,n){var r,o,i,s={};for(i in t)"key"==i?r=t[i]:"ref"==i?o=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?a.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===s[i]&&(s[i]=e.defaultProps[i]);return w(e,s,r,o,null)}function w(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?++l:o};return null==o&&null!=f.vnode&&f.vnode(i),i}function y(e){return e.children}function j(e,t){this.props=e,this.context=t}function x(e,t){if(null==t)return e.__?x(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?x(e):null}function k(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 k(e)}}function C(e){(!e.__d&&(e.__d=!0)&&u.push(e)&&!P.__r++||c!==f.debounceRendering)&&((c=f.debounceRendering)||b)(P)}function P(){var e,t,n,r,o,i,s,a;for(u.sort(d);e=u.shift();)e.__d&&(t=u.length,r=void 0,o=void 0,s=(i=(n=e).__v).__e,(a=n.__P)&&(r=[],(o=g({},i)).__v=i.__v+1,L(a,i,o,n.__n,void 0!==a.ownerSVGElement,null!=i.__h?[s]:null,r,null==s?x(i):s,i.__h),F(r,i),i.__e!=s&&k(i)),u.length>t&&u.sort(d));P.__r=0}function N(e,t,n,r,o,i,s,a,f,l){var u,c,b,d,_,g,m,v=r&&r.__k||h,j=v.length;for(n.__k=[],u=0;u<t.length;u++)if(null!=(d=n.__k[u]=null==(d=t[u])||"boolean"==typeof d||"function"==typeof d?null:"string"==typeof d||"number"==typeof d||"bigint"==typeof d?w(null,d,null,null,d):Array.isArray(d)?w(y,{children:d},null,null,null):d.__b>0?w(d.type,d.props,d.key,d.ref?d.ref:null,d.__v):d)){if(d.__=n,d.__b=n.__b+1,null===(b=v[u])||b&&d.key==b.key&&d.type===b.type)v[u]=void 0;else for(c=0;c<j;c++){if((b=v[c])&&d.key==b.key&&d.type===b.type){v[c]=void 0;break}b=null}L(e,d,b=b||p,o,i,s,a,f,l),_=d.__e,(c=d.ref)&&b.ref!=c&&(m||(m=[]),b.ref&&m.push(b.ref,null,d),m.push(c,d.__c||_,d)),null!=_?(null==g&&(g=_),"function"==typeof d.type&&d.__k===b.__k?d.__d=f=S(d,f,e):f=I(e,d,b,v,_,f),"function"==typeof n.type&&(n.__d=f)):f&&b.__e==f&&f.parentNode!=e&&(f=x(b))}for(n.__e=g,u=j;u--;)null!=v[u]&&("function"==typeof n.type&&null!=v[u].__e&&v[u].__e==n.__d&&(n.__d=E(r).nextSibling),A(v[u],v[u]));if(m)for(u=0;u<m.length;u++)U(m[u],m[++u],m[++u])}function S(e,t,n){for(var r,o=e.__k,i=0;o&&i<o.length;i++)(r=o[i])&&(r.__=e,t="function"==typeof r.type?S(r,t,n):I(n,r,r,o,r.__e,t));return t}function I(e,t,n,r,o,i){var s,a,f;if(void 0!==t.__d)s=t.__d,t.__d=void 0;else if(null==n||o!=i||null==o.parentNode)e:if(null==i||i.parentNode!==e)e.appendChild(o),s=null;else{for(a=i,f=0;(a=a.nextSibling)&&f<r.length;f+=1)if(a==o)break e;e.insertBefore(o,i),s=i}return void 0!==s?s:o.nextSibling}function E(e){var t,n,r;if(null==e.type||"string"==typeof e.type)return e.__e;if(e.__k)for(t=e.__k.length-1;t>=0;t--)if((n=e.__k[t])&&(r=E(n)))return r;return null}function q(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||_.test(t)?n:n+"px"}function H(e,t,n,r,o){var i;e:if("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||q(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||q(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])i=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r||e.addEventListener(t,i?z:T,i):e.removeEventListener(t,i?z:T,i);else if("dangerouslySetInnerHTML"!==t){if(o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function T(e){return this.l[e.type+!1](f.event?f.event(e):e)}function z(e){return this.l[e.type+!0](f.event?f.event(e):e)}function L(e,t,n,r,o,i,s,a,l){var u,c,b,d,p,h,_,m,v,w,x,k,C,P,S,I=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(l=n.__h,a=t.__e=n.__e,t.__h=null,i=[a]),(u=f.__b)&&u(t);try{e:if("function"==typeof I){if(m=t.props,v=(u=I.contextType)&&r[u.__c],w=u?v?v.props.value:u.__:r,n.__c?_=(c=t.__c=n.__c).__=c.__E:("prototype"in I&&I.prototype.render?t.__c=c=new I(m,w):(t.__c=c=new j(m,w),c.constructor=I,c.render=M),v&&v.sub(c),c.props=m,c.state||(c.state={}),c.context=w,c.__n=r,b=c.__d=!0,c.__h=[],c._sb=[]),null==c.__s&&(c.__s=c.state),null!=I.getDerivedStateFromProps&&(c.__s==c.state&&(c.__s=g({},c.__s)),g(c.__s,I.getDerivedStateFromProps(m,c.__s))),d=c.props,p=c.state,c.__v=t,b)null==I.getDerivedStateFromProps&&null!=c.componentWillMount&&c.componentWillMount(),null!=c.componentDidMount&&c.__h.push(c.componentDidMount);else{if(null==I.getDerivedStateFromProps&&m!==d&&null!=c.componentWillReceiveProps&&c.componentWillReceiveProps(m,w),!c.__e&&null!=c.shouldComponentUpdate&&!1===c.shouldComponentUpdate(m,c.__s,w)||t.__v===n.__v){for(t.__v!==n.__v&&(c.props=m,c.state=c.__s,c.__d=!1),c.__e=!1,t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(e){e&&(e.__=t)}),x=0;x<c._sb.length;x++)c.__h.push(c._sb[x]);c._sb=[],c.__h.length&&s.push(c);break e}null!=c.componentWillUpdate&&c.componentWillUpdate(m,c.__s,w),null!=c.componentDidUpdate&&c.__h.push(function(){c.componentDidUpdate(d,p,h)})}if(c.context=w,c.props=m,c.__P=e,k=f.__r,C=0,"prototype"in I&&I.prototype.render){for(c.state=c.__s,c.__d=!1,k&&k(t),u=c.render(c.props,c.state,c.context),P=0;P<c._sb.length;P++)c.__h.push(c._sb[P]);c._sb=[]}else do{c.__d=!1,k&&k(t),u=c.render(c.props,c.state,c.context),c.state=c.__s}while(c.__d&&++C<25);c.state=c.__s,null!=c.getChildContext&&(r=g(g({},r),c.getChildContext())),b||null==c.getSnapshotBeforeUpdate||(h=c.getSnapshotBeforeUpdate(d,p)),S=null!=u&&u.type===y&&null==u.key?u.props.children:u,N(e,Array.isArray(S)?S:[S],t,n,r,o,i,s,a,l),c.base=t.__e,t.__h=null,c.__h.length&&s.push(c),_&&(c.__E=c.__=null),c.__e=!1}else null==i&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=O(n.__e,t,n,r,o,i,s,l);(u=f.diffed)&&u(t)}catch(e){t.__v=null,(l||null!=i)&&(t.__e=a,t.__h=!!l,i[i.indexOf(a)]=null),f.__e(e,t,n)}}function F(e,t){f.__c&&f.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){f.__e(e,t.__v)}})}function O(e,t,n,r,o,i,s,f){var l,u,c,b=n.props,d=t.props,h=t.type,_=0;if("svg"===h&&(o=!0),null!=i)for(;_<i.length;_++)if((l=i[_])&&"setAttribute"in l==!!h&&(h?l.localName===h:3===l.nodeType)){e=l,i[_]=null;break}if(null==e){if(null===h)return document.createTextNode(d);e=o?document.createElementNS("http://www.w3.org/2000/svg",h):document.createElement(h,d.is&&d),i=null,f=!1}if(null===h)b===d||f&&e.data===d||(e.data=d);else{if(i=i&&a.call(e.childNodes),u=(b=n.props||p).dangerouslySetInnerHTML,c=d.dangerouslySetInnerHTML,!f){if(null!=i)for(b={},_=0;_<e.attributes.length;_++)b[e.attributes[_].name]=e.attributes[_].value;(c||u)&&(c&&(u&&c.__html==u.__html||c.__html===e.innerHTML)||(e.innerHTML=c&&c.__html||""))}if(function(e,t,n,r,o){var i;for(i in n)"children"===i||"key"===i||i in t||H(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]||H(e,i,t[i],n[i],r)}(e,d,b,o,f),c)t.__k=[];else if(_=t.props.children,N(e,Array.isArray(_)?_:[_],t,n,r,o&&"foreignObject"!==h,i,s,i?i[0]:n.__k&&x(n,0),f),null!=i)for(_=i.length;_--;)null!=i[_]&&m(i[_]);f||("value"in d&&void 0!==(_=d.value)&&(_!==e.value||"progress"===h&&!_||"option"===h&&_!==b.value)&&H(e,"value",_,b.value,!1),"checked"in d&&void 0!==(_=d.checked)&&_!==e.checked&&H(e,"checked",_,b.checked,!1))}return e}function U(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){f.__e(e,n)}}function A(e,t,n){var r,o;if(f.unmount&&f.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||U(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){f.__e(e,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&A(r[o],t,n||"function"!=typeof e.type);n||null==e.__e||m(e.__e),e.__=e.__e=e.__d=void 0}function M(e,t,n){return this.constructor(e,n)}a=h.slice,f={__e:function(e,t,n,r){for(var o,i,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&null!=i.getDerivedStateFromError&&(o.setState(i.getDerivedStateFromError(e)),s=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,r||{}),s=o.__d),s)return o.__E=o}catch(t){e=t}throw e}},l=0,j.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=g({},this.state),"function"==typeof e&&(e=e(g({},n),this.props)),e&&g(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),C(this))},j.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),C(this))},j.prototype.render=y,u=[],b="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,d=function(e,t){return e.__v.__b-t.__v.__b},P.__r=0;var D,W,B,J,Y=0,Q=[],R=[],V=f.__b,X=f.__r,$=f.diffed,G=f.__c,K=f.unmount;function Z(e,t){f.__h&&f.__h(W,e,Y||t),Y=0;var n=W.__H||(W.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:R}),n.__[e]}function ee(e){return Y=1,function(e,t,n){var r=Z(D++,2);if(r.t=e,!r.__c&&(r.__=[ae(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=W,!W.u)){var o=function(e,t,n){if(!r.__c.__H)return!0;var o=r.__c.__H.__.filter(function(e){return e.__c});if(o.every(function(e){return!e.__N}))return!i||i.call(this,e,t,n);var s=!1;return o.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}}),!(!s&&r.__c.props===e)&&(!i||i.call(this,e,t,n))};W.u=!0;var i=W.shouldComponentUpdate,s=W.componentWillUpdate;W.componentWillUpdate=function(e,t,n){if(this.__e){var r=i;i=void 0,o(e,t,n),i=r}s&&s.call(this,e,t,n)},W.shouldComponentUpdate=o}return r.__N||r.__}(ae,e)}function te(e,t){var n=Z(D++,3);!f.__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.i=t,W.__H.__h.push(n))}function ne(){for(var e;e=Q.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ie),e.__H.__h.forEach(se),e.__H.__h=[]}catch(t){e.__H.__h=[],f.__e(t,e.__v)}}f.__b=function(e){W=null,V&&V(e)},f.__r=function(e){X&&X(e),D=0;var t=(W=e.__c).__H;t&&(B===W?(t.__h=[],W.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.__V=R,e.__N=e.i=void 0})):(t.__h.forEach(ie),t.__h.forEach(se),t.__h=[])),B=W},f.diffed=function(e){$&&$(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==Q.push(t)&&J===f.requestAnimationFrame||((J=f.requestAnimationFrame)||oe)(ne)),t.__H.__.forEach(function(e){e.i&&(e.__H=e.i),e.__V!==R&&(e.__=e.__V),e.i=void 0,e.__V=R})),B=W=null},f.__c=function(e,t){t.some(function(e){try{e.__h.forEach(ie),e.__h=e.__h.filter(function(e){return!e.__||se(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],f.__e(n,e.__v)}}),G&&G(e,t)},f.unmount=function(e){K&&K(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{ie(e)}catch(e){t=e}}),n.__H=void 0,t&&f.__e(t,n.__v))};var re="function"==typeof requestAnimationFrame;function oe(e){var t,n=function(){clearTimeout(r),re&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);re&&(t=requestAnimationFrame(n))}function ie(e){var t=W,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),W=t}function se(e){var t=W;e.__c=e.__(),W=t}function ae(e,t){return"function"==typeof t?t(e):t}var fe=function(){return[].slice.call(arguments).filter(Boolean).join(" ")};function le(e){var t=e.children,n=e.isOpen,r=e.close,o=ee(!1),i=o[0],s=o[1];return te(function(){s(n)},[n]),v("div",{"aria-live":"assertive",className:"fb-pointer-events-none fb-fixed fb-inset-0 fb-flex fb-items-end"},v("div",{className:"fb-flex fb-w-full fb-flex-col fb-items-center fb-space-y-4 sm:fb-items-end"},v("div",{className:fe(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 fb-z-40 fb-m-4")},v("div",{class:"fb-absolute fb-top-0 fb-right-0 fb-hidden fb-pt-4 fb-pr-4 sm:fb-block"},v("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 fb-text-slate-400 hover:fb-text-slate-500 focus:ring-slate-500"},v("span",{class:"fb-sr-only"},"Close"),v("svg",{class:"fb-h-6 fb-w-6",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},v("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})))),v("div",{className:""},t))))}var ue=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)}},ce=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 be(e){return v("div",{className:"fb-h-1 fb-w-full fb-rounded-full bg-slate-200"},v("div",{className:"fb-h-1 fb-rounded-full",style:{backgroundColor:e.brandColor,width:Math.floor(100*e.progress)+"%"}}))}function de(e){return v("label",{htmlFor:e.questionId,className:"fb-mb-1.5 fb-block fb-text-base fb-font-semibold fb-leading-6 fb-mr-8 text-slate-900",style:e.style},e.headline)}function pe(e){return v("label",{for:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600"},e.subheader)}function he(e){var t=e.headline,n=e.subheader;return v("div",{className:"fb-text-center"},v("div",{className:"fb-flex fb-items-center fb-justify-center",style:{color:e.brandColor}},v("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"fb-h-24 fb-w-24"},v("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))),v("span",{className:"fb-inline-block fb-rounded-[100%] fb-w-16 fb-h-1 fb-mb-[10px] fb-bg-slate-300"}),v("div",null,v(de,{headline:t,questionId:"thankYouCard",style:{"margin-right":0}}),v(pe,{subheader:n,questionId:"thankYouCard"})))}function _e(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return v("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)}},v(de,{headline:t.headline,questionId:t.id}),v(pe,{subheader:t.subheader,questionId:t.id}),v("div",{className:"fb-mt-4"},v("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 fb-bg-slate-50 fb-border-slate-100 focus:fb-border-slate-500"})),v("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},v("div",null),v("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:fb-ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function ge(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ee(null),s=i[0],a=i[1];return v("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);n(o),a(null)}},v(de,{headline:t.headline,questionId:t.id}),v(pe,{subheader:t.subheader,questionId:t.id}),v("div",{className:"fb-mt-4"},v("fieldset",null,v("legend",{className:"fb-sr-only"},"Choices"),v("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e,n){return v("label",{key:e.id,className:fe(s===e.label?"fb-z-10 fb-bg-slate-50 fb-border-slate-400":"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")},v("span",{className:"fb-flex fb-items-center fb-text-sm"},v("input",{type:"radio",id:e.id,name:t.id,value:e.label,className:"fb-h-4 fb-w-4 fb-border fb-border-slate-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":e.id+"-label",onChange:function(e){a(e.currentTarget.value)},checked:s===e.label,style:{borderColor:o,color:o},required:t.required&&0===n}),v("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),v("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},v("div",null),v("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 me(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ee([]),s=i[0],a=i[1],f=function(){return s.length>0};return v("form",{onSubmit:function(e){var r;if(e.preventDefault(),f()||!t.required){var o=((r={})[t.id]=s,r);n(o),a([])}}},v(de,{headline:t.headline,questionId:t.id}),v(pe,{subheader:t.subheader,questionId:t.id}),v("div",{className:"fb-mt-4"},v("fieldset",null,v("legend",{className:"fb-sr-only"},"Choices"),v("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e){return v("label",{key:e.id,className:fe(s.includes(e.label)?"fb-z-10 fb-border-slate-400 fb-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 hover:fb-bg-slate-50 focus:fb-outline-none")},v("span",{className:"fb-flex fb-items-center fb-text-sm"},v("input",{type:"checkbox",id:e.id,name:t.id,value:e.label,className:"fb-h-4 fb-w-4 fb-border fb-border-slate-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":e.id+"-label",onChange:function(e){a(e.currentTarget.checked?[].concat(s,[e.currentTarget.value]):s.filter(function(t){return t!==e.currentTarget.value}))},checked:s.includes(e.label),style:{borderColor:o,color:o}}),v("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),v("input",{type:"text",className:"clip-[rect(0,0,0,0)] fb-absolute fb-m-[-1px] fb-h-1 fb-w-1 fb-overflow-hidden fb-whitespace-nowrap fb-border-0 fb-p-0 fb-text-transparent fb-caret-transparent focus:fb-border-transparent focus:fb-ring-0",required:t.required,value:f()?"checked":""}),v("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},v("div",null),v("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 ve(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ee(null),s=i[0],a=i[1];return v("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=s,r);n(o)}},v(de,{headline:t.headline,questionId:t.id}),v(pe,{subheader:t.subheader,questionId:t.id}),v("div",{className:"fb-my-4"},v("fieldset",null,v("legend",{className:"fb-sr-only"},"Choices"),v("div",{className:"fb-flex"},Array.from({length:11},function(e,t){return t}).map(function(e){return v("label",{key:e,className:fe(s===e?"fb-z-10 fb-border-slate-400 fb-bg-slate-50":"","fb-relative fb-h-10 fb-flex-1 fb-cursor-pointer fb-border fb-bg-white fb-text-center fb-text-sm fb-leading-10 fb-hover:bg-gray-100 fb-focus:outline-none")},v("input",{type:"radio",name:"nps",value:e,className:"fb-absolute fb-h-full fb-w-full fb-cursor-pointer fb-opacity-0",onChange:function(){return a(e)},required:t.required}),e)})),v("div",{className:"fb-flex fb-justify-between fb-text-sm fb-font-semibold fb-leading-6"},v("p",null,t.lowerLabel),v("p",null,t.upperLabel)))),v("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},v("div",null),v("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 fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function we(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return"openText"===t.type?v(_e,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceSingle"===t.type?v(ge,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceMulti"===t.type?v(me,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"nps"===t.type?v(ve,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):null}function ye(e){var t,n=e.config,r=e.survey,o=e.close,i=e.brandColor,s=ee(r.questions[0].id),a=s[0],f=s[1],l=ee(0),u=l[0],c=l[1],b=ee(null),d=b[0],p=b[1],h=ee(null),_=h[0],g=h[1],m=ee(!1),w=m[0],y=m[1];te(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:r.id,personId:n.person.id},n)).then(function(e){g(e.id)})}catch(e){return Promise.reject(e)}}(),console.log(r)},[n,r]),te(function(){var e;c((e=r.questions.findIndex(function(e){return e.id===a}),e/r.questions.length))},[a,r]);var j=function(e){try{var t=function(){y(!1),s?(c(100),r.thankYouCard.enabled?setTimeout(function(){o()},2e3):o()):f(r.questions[i+1].id)};y(!0);var i=r.questions.findIndex(function(e){return e.id===a}),s=i===r.questions.length-1,l={surveyId:r.id,personId:n.person.id,response:{finished:s,data:e}},u=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,n)).then(function(){}):Promise.resolve(Promise.all([ce(l,n),ue(_,n)])).then(function(e){p(e[0].id)});return Promise.resolve(u&&u.then?u.then(t):t())}catch(e){return Promise.reject(e)}};return v("div",null,v("div",{className:fe(w?"fb-animate-pulse fb-opacity-60":"","fb-text-slate-800 fb-font-sans fb-px-4 fb-py-6 sm:fb-p-6")},100===u&&r.thankYouCard.enabled?v(he,{headline:r.thankYouCard.headline,subheader:r.thankYouCard.subheader,brandColor:null==(t=n.settings)?void 0:t.brandColor}):r.questions.map(function(e,t){return a===e.id&&v(we,{key:e.id,brandColor:i,lastQuestion:t===r.questions.length-1,onSubmit:j,question:e})})),v(be,{progress:u,brandColor:i}))}function je(e){var t,n=e.config,r=e.survey,o=e.closeSurvey,i=ee(!0),s=i[1],a=function(){s(!1),setTimeout(function(){o()},1e3)};return v("div",{id:"fbjs"},v(le,{isOpen:i[0],close:a},v(ye,{config:n,survey:r,close:a,brandColor:null==(t=n.settings)?void 0:t.brandColor})))}var xe=/*#__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}();xe.instance=void 0;var ke=/*#__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}();ke.instance=void 0;var Ce=ke.getInstance(),Pe=xe.getInstance(),Ne=function(){try{return Promise.resolve(fetch(Pe.get().apiHost+"/api/v1/client/environments/"+Pe.get().environmentId+"/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:Pe.get().person.id})})).then(function(e){if(!e.ok)throw Ce.error("Error getting settings"),Error("Error getting settings");return e.json()})}catch(e){return Promise.reject(e)}},Se="formbricks-web-container",Ie=xe.getInstance(),Ee=ke.getInstance(),qe=!1,He=function(e){qe?Ee.debug("A survey is already running. Skipping."):(qe=!0,function(e,t,n){var r,o;f.__&&f.__(e,t),r=t.__k,o=[],L(t,e=t.__k=v(y,null,[e]),r||p,p,void 0!==t.ownerSVGElement,r?null:t.firstChild?a.call(t.childNodes):null,o,r?r.__e:t.firstChild,!1),F(o,e)}(v(je,{config:Ie.get(),survey:e,closeSurvey:Te}),document.getElementById(Se)))},Te=function(){try{return document.getElementById(Se).remove(),ze(),Promise.resolve(Ne()).then(function(e){Ie.update({settings:e}),qe=!1})}catch(e){return Promise.reject(e)}},ze=function(){var e=document.createElement("div");e.id=Se,document.body.appendChild(e)},Le=ke.getInstance(),Fe=xe.getInstance(),Oe=function(e,t){try{return Promise.resolve(fetch(Fe.get().apiHost+"/api/v1/client/environments/"+Fe.get().environmentId+"/events",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:Fe.get().session.id,eventName:e,properties:t})})).then(function(t){var n;function r(t){if(n)return t;Le.debug('Formbricks: Event "'+e+'" tracked'),Ue(e)}var o=function(){if(!t.ok)return Promise.resolve(t.json()).then(function(e){Le.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)}},Ue=function(e){for(var t,n=s(null==(r=Fe.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 Le.debug("Formbricks: survey "+i.id+' triggered by event "'+e+'"'),void He(i)}},Ae=xe.getInstance(),Me=ke.getInstance(),De=function(){try{return Me.debug("Creating new person"),Promise.resolve(fetch(Ae.get().apiHost+"/api/v1/client/environments/"+Ae.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)}},We=function(e,t){var n=Ae.get().person.attributes.find(function(t){var n;return(null==(n=t.attributeClass)?void 0:n.name)===e});return!(!n||n.value!==t)},Be=ke.getInstance(),Je=xe.getInstance(),Ye=function(){try{return Je.get().person?Promise.resolve(fetch(Je.get().apiHost+"/api/v1/client/environments/"+Je.get().environmentId+"/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:Je.get().person.id})})).then(function(e){if(e.ok)return Promise.resolve(e.json());Be.error("Error creating session")}):(Be.error("Formbricks: Unable to create session. No person found"),Promise.resolve())}catch(e){return Promise.reject(e)}},Qe=function(e){Be.debug("Session expired. Creating new session.");var t=o({},e);return t.expiresAt=Date.now()+36e5,t},Re=function(e){return e.expiresAt<=Date.now()},Ve=xe.getInstance(),Xe=ke.getInstance(),$e=function(){var e=Ve.get().settings,t=null==e?void 0:e.noCodeEvents.filter(function(e){var t;return"pageUrl"===(null==(t=e.noCodeConfig)?void 0:t.type)});if(Xe.debug("checking page url"),0!==t.length)for(var n,r=s(t);!(n=r()).done;){var o=n.value,i=o.noCodeConfig.pageUrl;i&&Ge(window.location.href,i.value,i.rule)&&Oe(o.name)}};function Ge(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 Ke=function(e){var t=Ve.get().settings,n=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"innerHtml"===(null==(t=e.noCodeConfig)?void 0:t.type)}),r=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"cssSelector"===(null==(t=e.noCodeConfig)?void 0:t.type)}),o=e.target;n.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.innerHtml;n&&o.innerHTML===n.value&&Oe(e.name)}),r.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.cssSelector;n&&o.matches(n.value)&&Oe(e.name)})},Ze=xe.getInstance(),et=ke.getInstance(),tt=function(){if(!(Ze.get().apiHost&&Ze.get().environmentId&&Ze.get().person&&Ze.get().session&&Ze.get().settings))throw Error("Formbricks: Formbricks not initialized. Call initialize() first.")},nt=new r,rt=function(e,t){nt.add(function(){try{return tt(),Promise.resolve(function(e,t){try{return Me.debug("setting attribute: "+e+" to value: "+t),We(e,t)?(Me.debug("attribute already set to this value. Skipping update."),Promise.resolve()):Promise.resolve(function(e,t){try{return Ae.get().person&&Ae.get().person.id?Promise.resolve(fetch(Ae.get().apiHost+"/api/v1/client/environments/"+Ae.get().environmentId+"/people/"+Ae.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 Me.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 Me.error("Error updating attribute"),new Error("Formbricks: Error updating attribute");Ae.update({person:t,settings:n})})}catch(e){return Promise.reject(e)}}(e,t)).then(function(){})}catch(e){return Promise.reject(e)}})},ot={init:function(e){nt.add(function(){try{return function(e){try{var t,n=function(e){if(t)return e;(function(){if("undefined"!=typeof window){var e=window.setInterval(function(){try{return Promise.resolve(function(){try{var e=function(e){Be.debug("Session not expired, extending session"),Je.update({session:Qe(Je.get().session)})};Be.debug("Checking session");var t=function(){if(Re(Je.get().session))return Be.debug("Session expired, creating new session"),Promise.resolve(Ye()).then(function(e){var t=e.session,n=e.settings;if(!t||!n)throw Be.error("Error creating new session"),Error("Error creating new session");Je.update({session:t,settings:n}),Oe("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",$e),window.addEventListener("popstate",$e),window.addEventListener("pushstate",$e),window.addEventListener("replacestate",$e),window.addEventListener("load",$e)),"undefined"!=typeof window&&document.addEventListener("click",Ke),et.debug("Initialized")};if(!e.environmentId)throw Error("Formbricks: environmentId is required");if(!e.apiHost)throw Error("Formbricks: apiHost is required");e.logLevel&&et.configure({logLevel:e.logLevel}),ze(),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 :is(.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 :is(.fb-pointer-events-none){pointer-events:none}#fbjs :is(.fb-pointer-events-auto){pointer-events:auto}#fbjs :is(.fb-fixed){position:fixed}#fbjs :is(.fb-absolute){position:absolute}#fbjs :is(.fb-relative){position:relative}#fbjs :is(.fb-inset-0){inset:0}#fbjs :is(.fb-right-0){right:0}#fbjs :is(.fb-top-0){top:0}#fbjs :is(.fb-z-10){z-index:10}#fbjs :is(.fb-z-40){z-index:40}#fbjs :is(.fb-m-4){margin:1rem}#fbjs :is(.fb-m-\\[-1px\\]){margin:-1px}#fbjs :is(.fb-my-4){margin-bottom:1rem;margin-top:1rem}#fbjs :is(.fb-mb-1){margin-bottom:.25rem}#fbjs :is(.fb-mb-1\\.5){margin-bottom:.375rem}#fbjs :is(.fb-mb-\\[10px\\]){margin-bottom:10px}#fbjs :is(.fb-ml-3){margin-left:.75rem}#fbjs :is(.fb-mr-8){margin-right:2rem}#fbjs :is(.fb-mt-4){margin-top:1rem}#fbjs :is(.fb-mt-\\[35px\\]){margin-top:35px}#fbjs :is(.fb-block){display:block}#fbjs :is(.fb-inline-block){display:inline-block}#fbjs :is(.fb-flex){display:flex}#fbjs :is(.fb-hidden){display:none}#fbjs :is(.fb-h-1){height:.25rem}#fbjs :is(.fb-h-10){height:2.5rem}#fbjs :is(.fb-h-24){height:6rem}#fbjs :is(.fb-h-4){height:1rem}#fbjs :is(.fb-h-6){height:1.5rem}#fbjs :is(.fb-h-\\[2px\\]){height:2px}#fbjs :is(.fb-h-full){height:100%}#fbjs :is(.fb-w-1){width:.25rem}#fbjs :is(.fb-w-16){width:4rem}#fbjs :is(.fb-w-24){width:6rem}#fbjs :is(.fb-w-4){width:1rem}#fbjs :is(.fb-w-4\\/5){width:80%}#fbjs :is(.fb-w-6){width:1.5rem}#fbjs :is(.fb-w-full){width:100%}#fbjs :is(.fb-max-w-sm){max-width:24rem}#fbjs :is(.fb-flex-1){flex:1 1 0%}#fbjs :is(.fb-translate-x-0){--tw-translate-x:0px;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 :is(.fb-translate-x-28){--tw-translate-x:7rem;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))}@keyframes fb-pulse{50%{opacity:.5}}#fbjs :is(.fb-animate-pulse){animation:fb-pulse 2s cubic-bezier(.4,0,.6,1) infinite}#fbjs :is(.fb-cursor-pointer){cursor:pointer}#fbjs :is(.fb-flex-col){flex-direction:column}#fbjs :is(.fb-items-end){align-items:flex-end}#fbjs :is(.fb-items-center){align-items:center}#fbjs :is(.fb-justify-center){justify-content:center}#fbjs :is(.fb-justify-between){justify-content:space-between}#fbjs :is(.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 :is(.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 :is(.fb-overflow-hidden){overflow:hidden}#fbjs :is(.fb-whitespace-nowrap){white-space:nowrap}#fbjs :is(.fb-rounded-\\[100\\%\\]){border-radius:100%}#fbjs :is(.fb-rounded-full){border-radius:9999px}#fbjs :is(.fb-rounded-lg){border-radius:.5rem}#fbjs :is(.fb-rounded-md){border-radius:.375rem}#fbjs :is(.fb-border){border-width:1px}#fbjs :is(.fb-border-0){border-width:0}#fbjs :is(.fb-border-gray-200){--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-100){--tw-border-opacity:1;border-color:rgb(241 245 249/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-300){--tw-border-opacity:1;border-color:rgb(203 213 225/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-400){--tw-border-opacity:1;border-color:rgb(148 163 184/var(--tw-border-opacity))}#fbjs :is(.fb-border-transparent){border-color:transparent}#fbjs :is(.fb-bg-slate-300){--tw-bg-opacity:1;background-color:rgb(203 213 225/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-slate-50){--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-white){--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}#fbjs :is(.fb-p-0){padding:0}#fbjs :is(.fb-p-2){padding:.5rem}#fbjs :is(.fb-p-4){padding:1rem}#fbjs :is(.fb-px-3){padding-left:.75rem;padding-right:.75rem}#fbjs :is(.fb-px-4){padding-left:1rem;padding-right:1rem}#fbjs :is(.fb-py-3){padding-bottom:.75rem;padding-top:.75rem}#fbjs :is(.fb-py-6){padding-bottom:1.5rem;padding-top:1.5rem}#fbjs :is(.fb-pr-4){padding-right:1rem}#fbjs :is(.fb-pt-4){padding-top:1rem}#fbjs :is(.fb-text-center){text-align:center}#fbjs :is(.fb-font-sans){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}#fbjs :is(.fb-text-base){font-size:1rem;line-height:1.5rem}#fbjs :is(.fb-text-sm){font-size:.875rem;line-height:1.25rem}#fbjs :is(.fb-text-xs){font-size:.75rem;line-height:1rem}#fbjs :is(.fb-font-medium){font-weight:500}#fbjs :is(.fb-font-normal){font-weight:400}#fbjs :is(.fb-font-semibold){font-weight:600}#fbjs :is(.fb-leading-10){line-height:2.5rem}#fbjs :is(.fb-leading-4){line-height:1rem}#fbjs :is(.fb-leading-6){line-height:1.5rem}#fbjs :is(.fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-500){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-800){--tw-text-opacity:1;color:rgb(30 41 59/var(--tw-text-opacity))}#fbjs :is(.fb-text-transparent){color:transparent}#fbjs :is(.fb-text-white){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}#fbjs :is(.fb-caret-transparent){caret-color:transparent}#fbjs :is(.fb-opacity-0){opacity:0}#fbjs :is(.fb-opacity-100){opacity:1}#fbjs :is(.fb-opacity-60){opacity:.6}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.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 :is(.fb-ring-black){--tw-ring-opacity:1;--tw-ring-color:rgb(0 0 0/var(--tw-ring-opacity))}#fbjs :is(.fb-ring-opacity-5){--tw-ring-opacity:0.05}#fbjs :is(.fb-transition-all){transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.fb-duration-500){transition-duration:.5s}#fbjs :is(.fb-ease-in-out){transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.hover\\:fb-bg-slate-50:hover){--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity))}#fbjs :is(.hover\\:fb-text-slate-500:hover){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.hover\\:fb-opacity-90:hover){opacity:.9}#fbjs :is(.focus\\:fb-border-slate-500:focus){--tw-border-opacity:1;border-color:rgb(100 116 139/var(--tw-border-opacity))}#fbjs :is(.focus\\:fb-border-transparent:focus){border-color:transparent}#fbjs :is(.focus\\:fb-outline-none:focus){outline:2px solid transparent;outline-offset:2px}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.focus\\:fb-ring-slate-500:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(100 116 139/var(--tw-ring-opacity))}#fbjs :is(.focus\\:fb-ring-offset-0:focus){--tw-ring-offset-width:0px}#fbjs :is(.focus\\:fb-ring-offset-2:focus){--tw-ring-offset-width:2px}@media (min-width:640px){#fbjs :is(.sm\\:fb-block){display:block}#fbjs :is(.sm\\:fb-items-end){align-items:flex-end}#fbjs :is(.sm\\:fb-p-6){padding:1.5rem}#fbjs :is(.sm\\:fb-text-sm){font-size:.875rem;line-height:1.25rem}}',document.head.appendChild(e)}}();var r=Ze&&Ze.get().environmentId===e.environmentId&&Ze.get().apiHost===e.apiHost?Ze.get().session&&Re(Ze.get().session)?Promise.resolve(Ye()).then(function(e){var t=e.settings;Ze.update({session:Qe(e.session),settings:t}),Oe("New Session")}):Ze.get().session?void 0:(et.error("Unable to initialize. No session found"),void(t=1)):(Ze.update({environmentId:e.environmentId,apiHost:e.apiHost}),Promise.resolve(De()).then(function(e){var t=e.settings;Ze.update({person:e.person,session:Qe(e.session),settings:t}),Oe("New Session")}));Promise.resolve(r&&r.then?r.then(n):n(r))}catch(e){return Promise.reject(e)}}(e),Promise.resolve()}catch(e){return Promise.reject(e)}})},setUserId:function(e){nt.add(function(){try{return tt(),Promise.resolve(function(e){try{return Me.debug("setting userId: "+e),We("userId",e)?(Me.debug("userId already set to this value. Skipping update."),Promise.resolve()):(t=Ae.get().person.attributes.find(function(e){var t;return"userId"===(null==(t=e.attributeClass)?void 0:t.name)}),t?(Me.error("userId cannot be changed after it has been set. You need to reset first"),Promise.resolve()):Promise.resolve(function(e){try{return Ae.get().person&&Ae.get().person.id?Promise.resolve(fetch(Ae.get().apiHost+"/api/v1/client/environments/"+Ae.get().environmentId+"/people/"+Ae.get().person.id+"/user-id",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,sessionId:Ae.get().session.id})})).then(function(e){if(!e.ok)throw Me.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){Ae.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){rt("email",e)},setAttribute:rt,track:function(e,t){void 0===t&&(t={}),nt.add(function(){try{return tt(),Promise.resolve(Oe(e,t)).then(function(){})}catch(e){return Promise.reject(e)}})},logout:function(){nt.add(function(){try{return tt(),Promise.resolve(function(){try{return Me.debug("Resetting person. Getting new person, session and settings from backend"),Promise.resolve(De()).then(function(e){var t=e.person,n=e.session,r=e.settings;if(!t||!n||!r)throw Me.error("Error resetting user"),new Error("Formbricks: Error resetting user");Ae.update({person:t,session:n,settings:r})})}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}})},refresh:function(){nt.add(function(){try{return tt(),Promise.resolve(function(){try{return Ce.debug("Refreshing - getting settings from backend"),Promise.resolve(Ne()).then(function(e){Pe.update({settings:e})})}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}})},registerRouteChange:function(){nt.add(function(){try{return tt(),$e(),Promise.resolve()}catch(e){return Promise.reject(e)}})}};export{ot 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={},h=[],_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function g(e,t){for(var n in t)e[n]=t[n];return e}function v(e){var t=e.parentNode;t&&t.removeChild(e)}function m(e,t,n){var r,o,i,s={};for(i in t)"key"==i?r=t[i]:"ref"==i?o=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?a.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===s[i]&&(s[i]=e.defaultProps[i]);return w(e,s,r,o,null)}function w(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?++l:o};return null==o&&null!=f.vnode&&f.vnode(i),i}function y(e){return e.children}function j(e,t){this.props=e,this.context=t}function x(e,t){if(null==t)return e.__?x(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?x(e):null}function k(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 k(e)}}function P(e){(!e.__d&&(e.__d=!0)&&u.push(e)&&!C.__r++||c!==f.debounceRendering)&&((c=f.debounceRendering)||d)(C)}function C(){var e,t,n,r,o,i,s,a;for(u.sort(b);e=u.shift();)e.__d&&(t=u.length,r=void 0,o=void 0,s=(i=(n=e).__v).__e,(a=n.__P)&&(r=[],(o=g({},i)).__v=i.__v+1,L(a,i,o,n.__n,void 0!==a.ownerSVGElement,null!=i.__h?[s]:null,r,null==s?x(i):s,i.__h),F(r,i),i.__e!=s&&k(i)),u.length>t&&u.sort(b));C.__r=0}function S(e,t,n,r,o,i,s,a,f,l){var u,c,d,b,_,g,v,m=r&&r.__k||h,j=m.length;for(n.__k=[],u=0;u<t.length;u++)if(null!=(b=n.__k[u]=null==(b=t[u])||"boolean"==typeof b||"function"==typeof b?null:"string"==typeof b||"number"==typeof b||"bigint"==typeof b?w(null,b,null,null,b):Array.isArray(b)?w(y,{children:b},null,null,null):b.__b>0?w(b.type,b.props,b.key,b.ref?b.ref:null,b.__v):b)){if(b.__=n,b.__b=n.__b+1,null===(d=m[u])||d&&b.key==d.key&&b.type===d.type)m[u]=void 0;else for(c=0;c<j;c++){if((d=m[c])&&b.key==d.key&&b.type===d.type){m[c]=void 0;break}d=null}L(e,b,d=d||p,o,i,s,a,f,l),_=b.__e,(c=b.ref)&&d.ref!=c&&(v||(v=[]),d.ref&&v.push(d.ref,null,b),v.push(c,b.__c||_,b)),null!=_?(null==g&&(g=_),"function"==typeof b.type&&b.__k===d.__k?b.__d=f=I(b,f,e):f=E(e,b,d,m,_,f),"function"==typeof n.type&&(n.__d=f)):f&&d.__e==f&&f.parentNode!=e&&(f=x(d))}for(n.__e=g,u=j;u--;)null!=m[u]&&("function"==typeof n.type&&null!=m[u].__e&&m[u].__e==n.__d&&(n.__d=N(r).nextSibling),A(m[u],m[u]));if(v)for(u=0;u<v.length;u++)U(v[u],v[++u],v[++u])}function I(e,t,n){for(var r,o=e.__k,i=0;o&&i<o.length;i++)(r=o[i])&&(r.__=e,t="function"==typeof r.type?I(r,t,n):E(n,r,r,o,r.__e,t));return t}function E(e,t,n,r,o,i){var s,a,f;if(void 0!==t.__d)s=t.__d,t.__d=void 0;else if(null==n||o!=i||null==o.parentNode)e:if(null==i||i.parentNode!==e)e.appendChild(o),s=null;else{for(a=i,f=0;(a=a.nextSibling)&&f<r.length;f+=1)if(a==o)break e;e.insertBefore(o,i),s=i}return void 0!==s?s:o.nextSibling}function N(e){var t,n,r;if(null==e.type||"string"==typeof e.type)return e.__e;if(e.__k)for(t=e.__k.length-1;t>=0;t--)if((n=e.__k[t])&&(r=N(n)))return r;return null}function H(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||_.test(t)?n:n+"px"}function T(e,t,n,r,o){var i;e:if("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||H(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||H(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])i=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r||e.addEventListener(t,i?z:q,i):e.removeEventListener(t,i?z:q,i);else if("dangerouslySetInnerHTML"!==t){if(o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function q(e){return this.l[e.type+!1](f.event?f.event(e):e)}function z(e){return this.l[e.type+!0](f.event?f.event(e):e)}function L(e,t,n,r,o,i,s,a,l){var u,c,d,b,p,h,_,v,m,w,x,k,P,C,I,E=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(l=n.__h,a=t.__e=n.__e,t.__h=null,i=[a]),(u=f.__b)&&u(t);try{e:if("function"==typeof E){if(v=t.props,m=(u=E.contextType)&&r[u.__c],w=u?m?m.props.value:u.__:r,n.__c?_=(c=t.__c=n.__c).__=c.__E:("prototype"in E&&E.prototype.render?t.__c=c=new E(v,w):(t.__c=c=new j(v,w),c.constructor=E,c.render=M),m&&m.sub(c),c.props=v,c.state||(c.state={}),c.context=w,c.__n=r,d=c.__d=!0,c.__h=[],c._sb=[]),null==c.__s&&(c.__s=c.state),null!=E.getDerivedStateFromProps&&(c.__s==c.state&&(c.__s=g({},c.__s)),g(c.__s,E.getDerivedStateFromProps(v,c.__s))),b=c.props,p=c.state,c.__v=t,d)null==E.getDerivedStateFromProps&&null!=c.componentWillMount&&c.componentWillMount(),null!=c.componentDidMount&&c.__h.push(c.componentDidMount);else{if(null==E.getDerivedStateFromProps&&v!==b&&null!=c.componentWillReceiveProps&&c.componentWillReceiveProps(v,w),!c.__e&&null!=c.shouldComponentUpdate&&!1===c.shouldComponentUpdate(v,c.__s,w)||t.__v===n.__v){for(t.__v!==n.__v&&(c.props=v,c.state=c.__s,c.__d=!1),c.__e=!1,t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(e){e&&(e.__=t)}),x=0;x<c._sb.length;x++)c.__h.push(c._sb[x]);c._sb=[],c.__h.length&&s.push(c);break e}null!=c.componentWillUpdate&&c.componentWillUpdate(v,c.__s,w),null!=c.componentDidUpdate&&c.__h.push(function(){c.componentDidUpdate(b,p,h)})}if(c.context=w,c.props=v,c.__P=e,k=f.__r,P=0,"prototype"in E&&E.prototype.render){for(c.state=c.__s,c.__d=!1,k&&k(t),u=c.render(c.props,c.state,c.context),C=0;C<c._sb.length;C++)c.__h.push(c._sb[C]);c._sb=[]}else do{c.__d=!1,k&&k(t),u=c.render(c.props,c.state,c.context),c.state=c.__s}while(c.__d&&++P<25);c.state=c.__s,null!=c.getChildContext&&(r=g(g({},r),c.getChildContext())),d||null==c.getSnapshotBeforeUpdate||(h=c.getSnapshotBeforeUpdate(b,p)),I=null!=u&&u.type===y&&null==u.key?u.props.children:u,S(e,Array.isArray(I)?I:[I],t,n,r,o,i,s,a,l),c.base=t.__e,t.__h=null,c.__h.length&&s.push(c),_&&(c.__E=c.__=null),c.__e=!1}else null==i&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=O(n.__e,t,n,r,o,i,s,l);(u=f.diffed)&&u(t)}catch(e){t.__v=null,(l||null!=i)&&(t.__e=a,t.__h=!!l,i[i.indexOf(a)]=null),f.__e(e,t,n)}}function F(e,t){f.__c&&f.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){f.__e(e,t.__v)}})}function O(e,t,n,r,o,i,s,f){var l,u,c,d=n.props,b=t.props,h=t.type,_=0;if("svg"===h&&(o=!0),null!=i)for(;_<i.length;_++)if((l=i[_])&&"setAttribute"in l==!!h&&(h?l.localName===h:3===l.nodeType)){e=l,i[_]=null;break}if(null==e){if(null===h)return document.createTextNode(b);e=o?document.createElementNS("http://www.w3.org/2000/svg",h):document.createElement(h,b.is&&b),i=null,f=!1}if(null===h)d===b||f&&e.data===b||(e.data=b);else{if(i=i&&a.call(e.childNodes),u=(d=n.props||p).dangerouslySetInnerHTML,c=b.dangerouslySetInnerHTML,!f){if(null!=i)for(d={},_=0;_<e.attributes.length;_++)d[e.attributes[_].name]=e.attributes[_].value;(c||u)&&(c&&(u&&c.__html==u.__html||c.__html===e.innerHTML)||(e.innerHTML=c&&c.__html||""))}if(function(e,t,n,r,o){var i;for(i in n)"children"===i||"key"===i||i in t||T(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]||T(e,i,t[i],n[i],r)}(e,b,d,o,f),c)t.__k=[];else if(_=t.props.children,S(e,Array.isArray(_)?_:[_],t,n,r,o&&"foreignObject"!==h,i,s,i?i[0]:n.__k&&x(n,0),f),null!=i)for(_=i.length;_--;)null!=i[_]&&v(i[_]);f||("value"in b&&void 0!==(_=b.value)&&(_!==e.value||"progress"===h&&!_||"option"===h&&_!==d.value)&&T(e,"value",_,d.value,!1),"checked"in b&&void 0!==(_=b.checked)&&_!==e.checked&&T(e,"checked",_,d.checked,!1))}return e}function U(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){f.__e(e,n)}}function A(e,t,n){var r,o;if(f.unmount&&f.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||U(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){f.__e(e,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&A(r[o],t,n||"function"!=typeof e.type);n||null==e.__e||v(e.__e),e.__=e.__e=e.__d=void 0}function M(e,t,n){return this.constructor(e,n)}a=h.slice,f={__e:function(e,t,n,r){for(var o,i,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&null!=i.getDerivedStateFromError&&(o.setState(i.getDerivedStateFromError(e)),s=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,r||{}),s=o.__d),s)return o.__E=o}catch(t){e=t}throw e}},l=0,j.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=g({},this.state),"function"==typeof e&&(e=e(g({},n),this.props)),e&&g(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),P(this))},j.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),P(this))},j.prototype.render=y,u=[],d="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,b=function(e,t){return e.__v.__b-t.__v.__b},C.__r=0;var D,W,B,J,Y=0,R=[],V=[],Q=f.__b,X=f.__r,$=f.diffed,G=f.__c,K=f.unmount;function Z(e,t){f.__h&&f.__h(W,e,Y||t),Y=0;var n=W.__H||(W.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:V}),n.__[e]}function ee(e){return Y=1,function(e,t,n){var r=Z(D++,2);if(r.t=e,!r.__c&&(r.__=[ae(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=W,!W.u)){var o=function(e,t,n){if(!r.__c.__H)return!0;var o=r.__c.__H.__.filter(function(e){return e.__c});if(o.every(function(e){return!e.__N}))return!i||i.call(this,e,t,n);var s=!1;return o.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}}),!(!s&&r.__c.props===e)&&(!i||i.call(this,e,t,n))};W.u=!0;var i=W.shouldComponentUpdate,s=W.componentWillUpdate;W.componentWillUpdate=function(e,t,n){if(this.__e){var r=i;i=void 0,o(e,t,n),i=r}s&&s.call(this,e,t,n)},W.shouldComponentUpdate=o}return r.__N||r.__}(ae,e)}function te(e,t){var n=Z(D++,3);!f.__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.i=t,W.__H.__h.push(n))}function ne(){for(var e;e=R.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ie),e.__H.__h.forEach(se),e.__H.__h=[]}catch(t){e.__H.__h=[],f.__e(t,e.__v)}}f.__b=function(e){W=null,Q&&Q(e)},f.__r=function(e){X&&X(e),D=0;var t=(W=e.__c).__H;t&&(B===W?(t.__h=[],W.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.__V=V,e.__N=e.i=void 0})):(t.__h.forEach(ie),t.__h.forEach(se),t.__h=[])),B=W},f.diffed=function(e){$&&$(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==R.push(t)&&J===f.requestAnimationFrame||((J=f.requestAnimationFrame)||oe)(ne)),t.__H.__.forEach(function(e){e.i&&(e.__H=e.i),e.__V!==V&&(e.__=e.__V),e.i=void 0,e.__V=V})),B=W=null},f.__c=function(e,t){t.some(function(e){try{e.__h.forEach(ie),e.__h=e.__h.filter(function(e){return!e.__||se(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],f.__e(n,e.__v)}}),G&&G(e,t)},f.unmount=function(e){K&&K(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{ie(e)}catch(e){t=e}}),n.__H=void 0,t&&f.__e(t,n.__v))};var re="function"==typeof requestAnimationFrame;function oe(e){var t,n=function(){clearTimeout(r),re&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);re&&(t=requestAnimationFrame(n))}function ie(e){var t=W,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),W=t}function se(e){var t=W;e.__c=e.__(),W=t}function ae(e,t){return"function"==typeof t?t(e):t}var fe=function(){return[].slice.call(arguments).filter(Boolean).join(" ")};function le(e){var t=e.children,n=e.isOpen,r=e.close,o=ee(!1),i=o[0],s=o[1];return te(function(){s(n)},[n]),m("div",{"aria-live":"assertive",className:"fb-pointer-events-none fb-fixed fb-inset-0 fb-flex fb-items-end"},m("div",{className:"fb-flex fb-w-full fb-flex-col fb-items-center fb-space-y-4 sm:fb-items-end"},m("div",{className:fe(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 fb-z-40")},m("div",{class:"fb-absolute fb-top-0 fb-right-0 fb-hidden fb-pt-4 fb-pr-4 sm:fb-block"},m("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 fb-text-slate-400 hover:fb-text-slate-500 focus:ring-slate-500"},m("span",{class:"fb-sr-only"},"Close"),m("svg",{class:"fb-h-6 fb-w-6",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})))),m("div",{className:""},t))))}var ue=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)}},ce=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 de(e){return m("label",{htmlFor:e.questionId,className:"fb-mb-1.5 fb-block fb-text-base fb-font-semibold fb-leading-6 fb-mr-8 text-slate-900",style:e.style},e.headline)}function be(e){return m("label",{for:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600"},e.subheader)}function pe(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return m("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)}},m(de,{headline:t.headline,questionId:t.id}),m(be,{subheader:t.subheader,questionId:t.id}),m("div",{className:"fb-mt-4"},m("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 fb-bg-slate-50 fb-border-slate-100 focus:fb-border-slate-500"})),m("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},m("div",null),m("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:fb-ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function he(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ee(null),s=i[0],a=i[1];return m("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)}},m(de,{headline:t.headline,questionId:t.id}),m(be,{subheader:t.subheader,questionId:t.id}),m("div",{className:"fb-mt-4"},m("fieldset",null,m("legend",{className:"fb-sr-only"},"Choices"),m("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e,n){return m("label",{key:e.id,className:fe(s===e.label?"fb-z-10 fb-bg-slate-50 fb-border-slate-400":"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")},m("span",{className:"fb-flex fb-items-center fb-text-sm"},m("input",{type:"radio",id:e.id,name:t.id,value:e.label,className:"fb-h-4 fb-w-4 fb-border fb-border-slate-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},required:t.required&&0===n}),m("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),m("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},m("div",null),m("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 _e(e){return m("div",{className:"fb-h-1 fb-w-full fb-rounded-full bg-slate-200"},m("div",{className:"fb-h-1 fb-rounded-full",style:{backgroundColor:e.brandColor,width:Math.floor(100*e.progress)+"%"}}))}function ge(e){var t=e.headline,n=e.subheader;return m("div",{className:"fb-text-center"},m("div",{className:"fb-flex fb-items-center fb-justify-center",style:{color:e.brandColor}},m("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"fb-h-24 fb-w-24"},m("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))),m("span",{className:"fb-inline-block fb-rounded-[100%] fb-w-16 fb-h-1 fb-mb-[10px] fb-bg-slate-300"}),m("div",null,m(de,{headline:t,questionId:"thankYouCard",style:{"margin-right":0}}),m(be,{subheader:n,questionId:"thankYouCard"})))}function ve(e){var t,n=e.config,r=e.survey,o=e.close,i=e.brandColor,s=ee(r.questions[0]),a=s[0],f=s[1],l=ee(0),u=l[0],c=l[1],d=ee(null),b=d[0],p=d[1],h=ee(null),_=h[0],g=h[1],v=ee(!1),w=v[0],y=v[1];te(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:r.id,personId:n.person.id},n)).then(function(e){g(e.id)})}catch(e){return Promise.reject(e)}}()},[n,r]),te(function(){var e;c((e=r.questions.findIndex(function(e){return e.id===a.id}),e/r.questions.length))},[a,r]);var j=function(e){try{var t=function(){y(!1),s?(c(100),r.thankYouCard.enabled?setTimeout(function(){o()},2e3):o()):f(r.questions[i+1])};y(!0);var i=r.questions.findIndex(function(e){return e.id===a.id}),s=i===r.questions.length-1,l={surveyId:r.id,personId:n.person.id,response:{finished:s,data:e}},u=b?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,b,n)).then(function(){}):Promise.resolve(Promise.all([ce(l,n),ue(_,n)])).then(function(e){p(e[0].id)});return Promise.resolve(u&&u.then?u.then(t):t())}catch(e){return Promise.reject(e)}};return m("div",null,m("div",{className:fe(w?"fb-animate-pulse fb-opacity-60":"","fb-text-slate-800 fb-font-sans fb-px-4 fb-py-6 sm:fb-p-6")},100===u&&r.thankYouCard.enabled?m(ge,{headline:r.thankYouCard.headline,subheader:r.thankYouCard.subheader,brandColor:null==(t=n.settings)?void 0:t.brandColor}):"multipleChoiceSingle"===a.type?m(he,{question:a,onSubmit:j,lastQuestion:r.questions.findIndex(function(e){return e.id===a.id})===r.questions.length-1,brandColor:i}):"openText"===a.type?m(pe,{question:a,onSubmit:j,lastQuestion:r.questions.findIndex(function(e){return e.id===a.id})===r.questions.length-1,brandColor:i}):null),m(_e,{progress:u,brandColor:i}))}function me(e){var t,n=e.config,r=e.survey,o=e.closeSurvey,i=ee(!0),s=i[1],a=function(){s(!1),setTimeout(function(){o()},1e3)};return m("div",{id:"fbjs"},m(le,{isOpen:i[0],close:a},m(ve,{config:n,survey:r,close:a,brandColor:null==(t=n.settings)?void 0:t.brandColor})))}var we=/*#__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}();we.instance=void 0;var ye=/*#__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}();ye.instance=void 0;var je=ye.getInstance(),xe=we.getInstance(),ke=function(){try{return Promise.resolve(fetch(xe.get().apiHost+"/api/v1/client/environments/"+xe.get().environmentId+"/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:xe.get().person.id})})).then(function(e){if(!e.ok)throw je.error("Error getting settings"),Error("Error getting settings");return e.json()})}catch(e){return Promise.reject(e)}},Pe="formbricks-web-container",Ce=we.getInstance(),Se=ye.getInstance(),Ie=!1,Ee=function(e){Ie?Se.debug("A survey is already running. Skipping."):(Ie=!0,function(e,t,n){var r,o;f.__&&f.__(e,t),r=t.__k,o=[],L(t,e=t.__k=m(y,null,[e]),r||p,p,void 0!==t.ownerSVGElement,r?null:t.firstChild?a.call(t.childNodes):null,o,r?r.__e:t.firstChild,!1),F(o,e)}(m(me,{config:Ce.get(),survey:e,closeSurvey:Ne}),document.getElementById(Pe)))},Ne=function(){try{return document.getElementById(Pe).remove(),He(),Promise.resolve(ke()).then(function(e){Ce.update({settings:e}),Ie=!1})}catch(e){return Promise.reject(e)}},He=function(){var e=document.createElement("div");e.id=Pe,document.body.appendChild(e)},Te=ye.getInstance(),qe=we.getInstance(),ze=function(e,t){try{return Promise.resolve(fetch(qe.get().apiHost+"/api/v1/client/environments/"+qe.get().environmentId+"/events",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:qe.get().session.id,eventName:e,properties:t})})).then(function(t){var n;function r(t){if(n)return t;Te.debug('Formbricks: Event "'+e+'" tracked'),Le(e)}var o=function(){if(!t.ok)return Promise.resolve(t.json()).then(function(e){Te.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)}},Le=function(e){for(var t,n=s(null==(r=qe.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 Te.debug("Formbricks: survey "+i.id+' triggered by event "'+e+'"'),void Ee(i)}},Fe=we.getInstance(),Oe=ye.getInstance(),Ue=function(){try{return Oe.debug("Creating new person"),Promise.resolve(fetch(Fe.get().apiHost+"/api/v1/client/environments/"+Fe.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)}},Ae=function(e,t){var n=Fe.get().person.attributes.find(function(t){var n;return(null==(n=t.attributeClass)?void 0:n.name)===e});return!(!n||n.value!==t)},Me=ye.getInstance(),De=we.getInstance(),We=function(){try{return De.get().person?Promise.resolve(fetch(De.get().apiHost+"/api/v1/client/environments/"+De.get().environmentId+"/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:De.get().person.id})})).then(function(e){if(e.ok)return Promise.resolve(e.json());Me.error("Error creating session")}):(Me.error("Formbricks: Unable to create session. No person found"),Promise.resolve())}catch(e){return Promise.reject(e)}},Be=function(e){Me.debug("Session expired. Creating new session.");var t=o({},e);return t.expiresAt=Date.now()+36e5,t},Je=function(e){return e.expiresAt<=Date.now()},Ye=we.getInstance(),Re=ye.getInstance(),Ve=function(){var e=Ye.get().settings,t=null==e?void 0:e.noCodeEvents.filter(function(e){var t;return"pageUrl"===(null==(t=e.noCodeConfig)?void 0:t.type)});if(Re.debug("checking page url"),0!==t.length)for(var n,r=s(t);!(n=r()).done;){var o=n.value,i=o.noCodeConfig.pageUrl;i&&Qe(window.location.href,i.value,i.rule)&&ze(o.name)}};function Qe(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 Xe=function(e){var t=Ye.get().settings,n=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"innerHtml"===(null==(t=e.noCodeConfig)?void 0:t.type)}),r=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"cssSelector"===(null==(t=e.noCodeConfig)?void 0:t.type)}),o=e.target;n.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.innerHtml;n&&o.innerHTML===n.value&&ze(e.name)}),r.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.cssSelector;n&&o.matches(n.value)&&ze(e.name)})},$e=we.getInstance(),Ge=ye.getInstance(),Ke=function(){if(!($e.get().apiHost&&$e.get().environmentId&&$e.get().person&&$e.get().session&&$e.get().settings))throw Error("Formbricks: Formbricks not initialized. Call initialize() first.")},Ze=new r,et=function(e,t){Ze.add(function(){try{return Ke(),Promise.resolve(function(e,t){try{return Oe.debug("setting attribute: "+e+" to value: "+t),Ae(e,t)?(Oe.debug("attribute already set to this value. Skipping update."),Promise.resolve()):Promise.resolve(function(e,t){try{return Fe.get().person&&Fe.get().person.id?Promise.resolve(fetch(Fe.get().apiHost+"/api/v1/client/environments/"+Fe.get().environmentId+"/people/"+Fe.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 Oe.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 Oe.error("Error updating attribute"),new Error("Formbricks: Error updating attribute");Fe.update({person:t,settings:n})})}catch(e){return Promise.reject(e)}}(e,t)).then(function(){})}catch(e){return Promise.reject(e)}})},tt={init:function(e){Ze.add(function(){try{return function(e){try{var t,n=function(e){if(t)return e;(function(){if("undefined"!=typeof window){var e=window.setInterval(function(){try{return Promise.resolve(function(){try{var e=function(e){Me.debug("Session not expired, extending session"),De.update({session:Be(De.get().session)})};Me.debug("Checking session");var t=function(){if(Je(De.get().session))return Me.debug("Session expired, creating new session"),Promise.resolve(We()).then(function(e){var t=e.session,n=e.settings;if(!t||!n)throw Me.error("Error creating new session"),Error("Error creating new session");De.update({session:t,settings:n}),ze("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",Ve),window.addEventListener("popstate",Ve),window.addEventListener("pushstate",Ve),window.addEventListener("replacestate",Ve),window.addEventListener("load",Ve)),"undefined"!=typeof window&&document.addEventListener("click",Xe),Ge.debug("Initialized")};if(!e.environmentId)throw Error("Formbricks: environmentId is required");if(!e.apiHost)throw Error("Formbricks: apiHost is required");e.logLevel&&Ge.configure({logLevel:e.logLevel}),He(),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 :is(.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 :is(.fb-pointer-events-none){pointer-events:none}#fbjs :is(.fb-pointer-events-auto){pointer-events:auto}#fbjs :is(.fb-fixed){position:fixed}#fbjs :is(.fb-absolute){position:absolute}#fbjs :is(.fb-relative){position:relative}#fbjs :is(.fb-inset-0){inset:0}#fbjs :is(.fb-right-0){right:0}#fbjs :is(.fb-top-0){top:0}#fbjs :is(.fb-z-10){z-index:10}#fbjs :is(.fb-mb-\\[10px\\]){margin-bottom:10px}#fbjs :is(.fb-ml-3){margin-left:.75rem}#fbjs :is(.fb-mr-8){margin-right:2rem}#fbjs :is(.fb-mt-2){margin-top:.5rem}#fbjs :is(.fb-mt-4){margin-top:1rem}#fbjs :is(.fb-mt-\\[35px\\]){margin-top:35px}#fbjs :is(.fb-block){display:block}#fbjs :is(.fb-inline-block){display:inline-block}#fbjs :is(.fb-flex){display:flex}#fbjs :is(.fb-hidden){display:none}#fbjs :is(.fb-h-1){height:.25rem}#fbjs :is(.fb-h-24){height:6rem}#fbjs :is(.fb-h-4){height:1rem}#fbjs :is(.fb-h-6){height:1.5rem}#fbjs :is(.fb-h-\\[2px\\]){height:2px}#fbjs :is(.fb-w-16){width:4rem}#fbjs :is(.fb-w-24){width:6rem}#fbjs :is(.fb-w-4){width:1rem}#fbjs :is(.fb-w-4\\/5){width:80%}#fbjs :is(.fb-w-6){width:1.5rem}#fbjs :is(.fb-w-full){width:100%}#fbjs :is(.fb-max-w-sm){max-width:24rem}#fbjs :is(.fb-translate-x-0){--tw-translate-x:0px;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 :is(.fb-translate-x-28){--tw-translate-x:7rem;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))}@keyframes fb-pulse{50%{opacity:.5}}#fbjs :is(.fb-animate-pulse){animation:fb-pulse 2s cubic-bezier(.4,0,.6,1) infinite}#fbjs :is(.fb-cursor-pointer){cursor:pointer}#fbjs :is(.fb-flex-col){flex-direction:column}#fbjs :is(.fb-items-end){align-items:flex-end}#fbjs :is(.fb-items-center){align-items:center}#fbjs :is(.fb-justify-center){justify-content:center}#fbjs :is(.fb-justify-between){justify-content:space-between}#fbjs :is(.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 :is(.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 :is(.fb-overflow-hidden){overflow:hidden}#fbjs :is(.fb-rounded-\\[100\\%\\]){border-radius:100%}#fbjs :is(.fb-rounded-full){border-radius:9999px}#fbjs :is(.fb-rounded-lg){border-radius:.5rem}#fbjs :is(.fb-rounded-md){border-radius:.375rem}#fbjs :is(.fb-border){border-width:1px}#fbjs :is(.fb-border-gray-200){--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-100){--tw-border-opacity:1;border-color:rgb(241 245 249/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-300){--tw-border-opacity:1;border-color:rgb(203 213 225/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-400){--tw-border-opacity:1;border-color:rgb(148 163 184/var(--tw-border-opacity))}#fbjs :is(.fb-border-transparent){border-color:transparent}#fbjs :is(.fb-bg-slate-300){--tw-bg-opacity:1;background-color:rgb(203 213 225/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-slate-50){--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-white){--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}#fbjs :is(.fb-p-2){padding:.5rem}#fbjs :is(.fb-p-4){padding:1rem}#fbjs :is(.fb-px-3){padding-left:.75rem;padding-right:.75rem}#fbjs :is(.fb-px-4){padding-left:1rem;padding-right:1rem}#fbjs :is(.fb-py-3){padding-bottom:.75rem;padding-top:.75rem}#fbjs :is(.fb-py-6){padding-bottom:1.5rem;padding-top:1.5rem}#fbjs :is(.fb-pr-4){padding-right:1rem}#fbjs :is(.fb-pt-4){padding-top:1rem}#fbjs :is(.fb-text-center){text-align:center}#fbjs :is(.fb-font-sans){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}#fbjs :is(.fb-text-base){font-size:1rem;line-height:1.5rem}#fbjs :is(.fb-text-sm){font-size:.875rem;line-height:1.25rem}#fbjs :is(.fb-text-xs){font-size:.75rem;line-height:1rem}#fbjs :is(.fb-font-medium){font-weight:500}#fbjs :is(.fb-font-normal){font-weight:400}#fbjs :is(.fb-font-semibold){font-weight:600}#fbjs :is(.fb-leading-4){line-height:1rem}#fbjs :is(.fb-leading-6){line-height:1.5rem}#fbjs :is(.fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-500){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-800){--tw-text-opacity:1;color:rgb(30 41 59/var(--tw-text-opacity))}#fbjs :is(.fb-text-white){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}#fbjs :is(.fb-opacity-0){opacity:0}#fbjs :is(.fb-opacity-100){opacity:1}#fbjs :is(.fb-opacity-60){opacity:.6}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.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 :is(.fb-ring-black){--tw-ring-opacity:1;--tw-ring-color:rgb(0 0 0/var(--tw-ring-opacity))}#fbjs :is(.fb-ring-opacity-5){--tw-ring-opacity:0.05}#fbjs :is(.fb-transition-all){transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.fb-duration-500){transition-duration:.5s}#fbjs :is(.fb-ease-in-out){transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.hover\\:fb-text-slate-500:hover){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.hover\\:fb-opacity-90:hover){opacity:.9}#fbjs :is(.focus\\:fb-border-slate-500:focus){--tw-border-opacity:1;border-color:rgb(100 116 139/var(--tw-border-opacity))}#fbjs :is(.focus\\:fb-outline-none:focus){outline:2px solid transparent;outline-offset:2px}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.focus\\:fb-ring-slate-500:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(100 116 139/var(--tw-ring-opacity))}#fbjs :is(.focus\\:fb-ring-offset-0:focus){--tw-ring-offset-width:0px}#fbjs :is(.focus\\:fb-ring-offset-2:focus){--tw-ring-offset-width:2px}@media (min-width:640px){#fbjs :is(.sm\\:fb-block){display:block}#fbjs :is(.sm\\:fb-items-end){align-items:flex-end}#fbjs :is(.sm\\:fb-p-6){padding:1.5rem}#fbjs :is(.sm\\:fb-text-sm){font-size:.875rem;line-height:1.25rem}}',document.head.appendChild(e)}}();var r=$e&&$e.get().environmentId===e.environmentId&&$e.get().apiHost===e.apiHost?$e.get().session&&Je($e.get().session)?Promise.resolve(We()).then(function(e){var t=e.settings;$e.update({session:Be(e.session),settings:t}),ze("New Session")}):$e.get().session?void 0:(Ge.error("Unable to initialize. No session found"),void(t=1)):($e.update({environmentId:e.environmentId,apiHost:e.apiHost}),Promise.resolve(Ue()).then(function(e){var t=e.settings;$e.update({person:e.person,session:Be(e.session),settings:t}),ze("New Session")}));Promise.resolve(r&&r.then?r.then(n):n(r))}catch(e){return Promise.reject(e)}}(e),Promise.resolve()}catch(e){return Promise.reject(e)}})},setUserId:function(e){Ze.add(function(){try{return Ke(),Promise.resolve(function(e){try{return Oe.debug("setting userId: "+e),Ae("userId",e)?(Oe.debug("userId already set to this value. Skipping update."),Promise.resolve()):(t=Fe.get().person.attributes.find(function(e){var t;return"userId"===(null==(t=e.attributeClass)?void 0:t.name)}),t?(Oe.error("userId cannot be changed after it has been set. You need to reset first"),Promise.resolve()):Promise.resolve(function(e){try{return Fe.get().person&&Fe.get().person.id?Promise.resolve(fetch(Fe.get().apiHost+"/api/v1/client/environments/"+Fe.get().environmentId+"/people/"+Fe.get().person.id+"/user-id",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,sessionId:Fe.get().session.id})})).then(function(e){if(!e.ok)throw Oe.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){Fe.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){et("email",e)},setAttribute:et,track:function(e,t){void 0===t&&(t={}),Ze.add(function(){try{return Ke(),Promise.resolve(ze(e,t)).then(function(){})}catch(e){return Promise.reject(e)}})},logout:function(){Ze.add(function(){try{return Ke(),Promise.resolve(function(){try{return Oe.debug("Resetting person. Getting new person, session and settings from backend"),Promise.resolve(Ue()).then(function(e){var t=e.person,n=e.session,r=e.settings;if(!t||!n||!r)throw Oe.error("Error resetting user"),new Error("Formbricks: Error resetting user");Fe.update({person:t,session:n,settings:r})})}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}})},refresh:function(){Ze.add(function(){try{return Ke(),Promise.resolve(function(){try{return je.debug("Refreshing - getting settings from backend"),Promise.resolve(ke()).then(function(e){xe.update({settings:e})})}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}})},registerRouteChange:function(){Ze.add(function(){try{return Ke(),Ve(),Promise.resolve()}catch(e){return Promise.reject(e)}})}};return tt});
!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(b):1===s?f.then(c):(void 0).then(function(){(a=r())?a.then?a.then(b).then(void 0,u):b(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(b).then(void 0,u);n(f=i())&&(f=f.v)}while(!f||!f.then);f.then(c).then(void 0,u)}function b(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,b,d,p={},h=[],_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function g(e,t){for(var n in t)e[n]=t[n];return e}function m(e){var t=e.parentNode;t&&t.removeChild(e)}function v(e,t,n){var r,o,i,s={};for(i in t)"key"==i?r=t[i]:"ref"==i?o=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?a.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(i in e.defaultProps)void 0===s[i]&&(s[i]=e.defaultProps[i]);return w(e,s,r,o,null)}function w(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?++l:o};return null==o&&null!=f.vnode&&f.vnode(i),i}function y(e){return e.children}function j(e,t){this.props=e,this.context=t}function x(e,t){if(null==t)return e.__?x(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?x(e):null}function k(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 k(e)}}function C(e){(!e.__d&&(e.__d=!0)&&u.push(e)&&!P.__r++||c!==f.debounceRendering)&&((c=f.debounceRendering)||b)(P)}function P(){var e,t,n,r,o,i,s,a;for(u.sort(d);e=u.shift();)e.__d&&(t=u.length,r=void 0,o=void 0,s=(i=(n=e).__v).__e,(a=n.__P)&&(r=[],(o=g({},i)).__v=i.__v+1,L(a,i,o,n.__n,void 0!==a.ownerSVGElement,null!=i.__h?[s]:null,r,null==s?x(i):s,i.__h),F(r,i),i.__e!=s&&k(i)),u.length>t&&u.sort(d));P.__r=0}function N(e,t,n,r,o,i,s,a,f,l){var u,c,b,d,_,g,m,v=r&&r.__k||h,j=v.length;for(n.__k=[],u=0;u<t.length;u++)if(null!=(d=n.__k[u]=null==(d=t[u])||"boolean"==typeof d||"function"==typeof d?null:"string"==typeof d||"number"==typeof d||"bigint"==typeof d?w(null,d,null,null,d):Array.isArray(d)?w(y,{children:d},null,null,null):d.__b>0?w(d.type,d.props,d.key,d.ref?d.ref:null,d.__v):d)){if(d.__=n,d.__b=n.__b+1,null===(b=v[u])||b&&d.key==b.key&&d.type===b.type)v[u]=void 0;else for(c=0;c<j;c++){if((b=v[c])&&d.key==b.key&&d.type===b.type){v[c]=void 0;break}b=null}L(e,d,b=b||p,o,i,s,a,f,l),_=d.__e,(c=d.ref)&&b.ref!=c&&(m||(m=[]),b.ref&&m.push(b.ref,null,d),m.push(c,d.__c||_,d)),null!=_?(null==g&&(g=_),"function"==typeof d.type&&d.__k===b.__k?d.__d=f=S(d,f,e):f=I(e,d,b,v,_,f),"function"==typeof n.type&&(n.__d=f)):f&&b.__e==f&&f.parentNode!=e&&(f=x(b))}for(n.__e=g,u=j;u--;)null!=v[u]&&("function"==typeof n.type&&null!=v[u].__e&&v[u].__e==n.__d&&(n.__d=E(r).nextSibling),A(v[u],v[u]));if(m)for(u=0;u<m.length;u++)U(m[u],m[++u],m[++u])}function S(e,t,n){for(var r,o=e.__k,i=0;o&&i<o.length;i++)(r=o[i])&&(r.__=e,t="function"==typeof r.type?S(r,t,n):I(n,r,r,o,r.__e,t));return t}function I(e,t,n,r,o,i){var s,a,f;if(void 0!==t.__d)s=t.__d,t.__d=void 0;else if(null==n||o!=i||null==o.parentNode)e:if(null==i||i.parentNode!==e)e.appendChild(o),s=null;else{for(a=i,f=0;(a=a.nextSibling)&&f<r.length;f+=1)if(a==o)break e;e.insertBefore(o,i),s=i}return void 0!==s?s:o.nextSibling}function E(e){var t,n,r;if(null==e.type||"string"==typeof e.type)return e.__e;if(e.__k)for(t=e.__k.length-1;t>=0;t--)if((n=e.__k[t])&&(r=E(n)))return r;return null}function T(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||_.test(t)?n:n+"px"}function q(e,t,n,r,o){var i;e:if("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||T(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||T(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])i=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r||e.addEventListener(t,i?z:H,i):e.removeEventListener(t,i?z:H,i);else if("dangerouslySetInnerHTML"!==t){if(o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function H(e){return this.l[e.type+!1](f.event?f.event(e):e)}function z(e){return this.l[e.type+!0](f.event?f.event(e):e)}function L(e,t,n,r,o,i,s,a,l){var u,c,b,d,p,h,_,m,v,w,x,k,C,P,S,I=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(l=n.__h,a=t.__e=n.__e,t.__h=null,i=[a]),(u=f.__b)&&u(t);try{e:if("function"==typeof I){if(m=t.props,v=(u=I.contextType)&&r[u.__c],w=u?v?v.props.value:u.__:r,n.__c?_=(c=t.__c=n.__c).__=c.__E:("prototype"in I&&I.prototype.render?t.__c=c=new I(m,w):(t.__c=c=new j(m,w),c.constructor=I,c.render=M),v&&v.sub(c),c.props=m,c.state||(c.state={}),c.context=w,c.__n=r,b=c.__d=!0,c.__h=[],c._sb=[]),null==c.__s&&(c.__s=c.state),null!=I.getDerivedStateFromProps&&(c.__s==c.state&&(c.__s=g({},c.__s)),g(c.__s,I.getDerivedStateFromProps(m,c.__s))),d=c.props,p=c.state,c.__v=t,b)null==I.getDerivedStateFromProps&&null!=c.componentWillMount&&c.componentWillMount(),null!=c.componentDidMount&&c.__h.push(c.componentDidMount);else{if(null==I.getDerivedStateFromProps&&m!==d&&null!=c.componentWillReceiveProps&&c.componentWillReceiveProps(m,w),!c.__e&&null!=c.shouldComponentUpdate&&!1===c.shouldComponentUpdate(m,c.__s,w)||t.__v===n.__v){for(t.__v!==n.__v&&(c.props=m,c.state=c.__s,c.__d=!1),c.__e=!1,t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(e){e&&(e.__=t)}),x=0;x<c._sb.length;x++)c.__h.push(c._sb[x]);c._sb=[],c.__h.length&&s.push(c);break e}null!=c.componentWillUpdate&&c.componentWillUpdate(m,c.__s,w),null!=c.componentDidUpdate&&c.__h.push(function(){c.componentDidUpdate(d,p,h)})}if(c.context=w,c.props=m,c.__P=e,k=f.__r,C=0,"prototype"in I&&I.prototype.render){for(c.state=c.__s,c.__d=!1,k&&k(t),u=c.render(c.props,c.state,c.context),P=0;P<c._sb.length;P++)c.__h.push(c._sb[P]);c._sb=[]}else do{c.__d=!1,k&&k(t),u=c.render(c.props,c.state,c.context),c.state=c.__s}while(c.__d&&++C<25);c.state=c.__s,null!=c.getChildContext&&(r=g(g({},r),c.getChildContext())),b||null==c.getSnapshotBeforeUpdate||(h=c.getSnapshotBeforeUpdate(d,p)),S=null!=u&&u.type===y&&null==u.key?u.props.children:u,N(e,Array.isArray(S)?S:[S],t,n,r,o,i,s,a,l),c.base=t.__e,t.__h=null,c.__h.length&&s.push(c),_&&(c.__E=c.__=null),c.__e=!1}else null==i&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=O(n.__e,t,n,r,o,i,s,l);(u=f.diffed)&&u(t)}catch(e){t.__v=null,(l||null!=i)&&(t.__e=a,t.__h=!!l,i[i.indexOf(a)]=null),f.__e(e,t,n)}}function F(e,t){f.__c&&f.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){f.__e(e,t.__v)}})}function O(e,t,n,r,o,i,s,f){var l,u,c,b=n.props,d=t.props,h=t.type,_=0;if("svg"===h&&(o=!0),null!=i)for(;_<i.length;_++)if((l=i[_])&&"setAttribute"in l==!!h&&(h?l.localName===h:3===l.nodeType)){e=l,i[_]=null;break}if(null==e){if(null===h)return document.createTextNode(d);e=o?document.createElementNS("http://www.w3.org/2000/svg",h):document.createElement(h,d.is&&d),i=null,f=!1}if(null===h)b===d||f&&e.data===d||(e.data=d);else{if(i=i&&a.call(e.childNodes),u=(b=n.props||p).dangerouslySetInnerHTML,c=d.dangerouslySetInnerHTML,!f){if(null!=i)for(b={},_=0;_<e.attributes.length;_++)b[e.attributes[_].name]=e.attributes[_].value;(c||u)&&(c&&(u&&c.__html==u.__html||c.__html===e.innerHTML)||(e.innerHTML=c&&c.__html||""))}if(function(e,t,n,r,o){var i;for(i in n)"children"===i||"key"===i||i in t||q(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]||q(e,i,t[i],n[i],r)}(e,d,b,o,f),c)t.__k=[];else if(_=t.props.children,N(e,Array.isArray(_)?_:[_],t,n,r,o&&"foreignObject"!==h,i,s,i?i[0]:n.__k&&x(n,0),f),null!=i)for(_=i.length;_--;)null!=i[_]&&m(i[_]);f||("value"in d&&void 0!==(_=d.value)&&(_!==e.value||"progress"===h&&!_||"option"===h&&_!==b.value)&&q(e,"value",_,b.value,!1),"checked"in d&&void 0!==(_=d.checked)&&_!==e.checked&&q(e,"checked",_,b.checked,!1))}return e}function U(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){f.__e(e,n)}}function A(e,t,n){var r,o;if(f.unmount&&f.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||U(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){f.__e(e,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&A(r[o],t,n||"function"!=typeof e.type);n||null==e.__e||m(e.__e),e.__=e.__e=e.__d=void 0}function M(e,t,n){return this.constructor(e,n)}a=h.slice,f={__e:function(e,t,n,r){for(var o,i,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&null!=i.getDerivedStateFromError&&(o.setState(i.getDerivedStateFromError(e)),s=o.__d),null!=o.componentDidCatch&&(o.componentDidCatch(e,r||{}),s=o.__d),s)return o.__E=o}catch(t){e=t}throw e}},l=0,j.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=g({},this.state),"function"==typeof e&&(e=e(g({},n),this.props)),e&&g(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),C(this))},j.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),C(this))},j.prototype.render=y,u=[],b="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,d=function(e,t){return e.__v.__b-t.__v.__b},P.__r=0;var D,W,B,J,Y=0,Q=[],R=[],V=f.__b,X=f.__r,$=f.diffed,G=f.__c,K=f.unmount;function Z(e,t){f.__h&&f.__h(W,e,Y||t),Y=0;var n=W.__H||(W.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:R}),n.__[e]}function ee(e){return Y=1,function(e,t,n){var r=Z(D++,2);if(r.t=e,!r.__c&&(r.__=[ae(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=W,!W.u)){var o=function(e,t,n){if(!r.__c.__H)return!0;var o=r.__c.__H.__.filter(function(e){return e.__c});if(o.every(function(e){return!e.__N}))return!i||i.call(this,e,t,n);var s=!1;return o.forEach(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}}),!(!s&&r.__c.props===e)&&(!i||i.call(this,e,t,n))};W.u=!0;var i=W.shouldComponentUpdate,s=W.componentWillUpdate;W.componentWillUpdate=function(e,t,n){if(this.__e){var r=i;i=void 0,o(e,t,n),i=r}s&&s.call(this,e,t,n)},W.shouldComponentUpdate=o}return r.__N||r.__}(ae,e)}function te(e,t){var n=Z(D++,3);!f.__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.i=t,W.__H.__h.push(n))}function ne(){for(var e;e=Q.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ie),e.__H.__h.forEach(se),e.__H.__h=[]}catch(t){e.__H.__h=[],f.__e(t,e.__v)}}f.__b=function(e){W=null,V&&V(e)},f.__r=function(e){X&&X(e),D=0;var t=(W=e.__c).__H;t&&(B===W?(t.__h=[],W.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.__V=R,e.__N=e.i=void 0})):(t.__h.forEach(ie),t.__h.forEach(se),t.__h=[])),B=W},f.diffed=function(e){$&&$(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==Q.push(t)&&J===f.requestAnimationFrame||((J=f.requestAnimationFrame)||oe)(ne)),t.__H.__.forEach(function(e){e.i&&(e.__H=e.i),e.__V!==R&&(e.__=e.__V),e.i=void 0,e.__V=R})),B=W=null},f.__c=function(e,t){t.some(function(e){try{e.__h.forEach(ie),e.__h=e.__h.filter(function(e){return!e.__||se(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],f.__e(n,e.__v)}}),G&&G(e,t)},f.unmount=function(e){K&&K(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{ie(e)}catch(e){t=e}}),n.__H=void 0,t&&f.__e(t,n.__v))};var re="function"==typeof requestAnimationFrame;function oe(e){var t,n=function(){clearTimeout(r),re&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);re&&(t=requestAnimationFrame(n))}function ie(e){var t=W,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),W=t}function se(e){var t=W;e.__c=e.__(),W=t}function ae(e,t){return"function"==typeof t?t(e):t}var fe=function(){return[].slice.call(arguments).filter(Boolean).join(" ")};function le(e){var t=e.children,n=e.isOpen,r=e.close,o=ee(!1),i=o[0],s=o[1];return te(function(){s(n)},[n]),v("div",{"aria-live":"assertive",className:"fb-pointer-events-none fb-fixed fb-inset-0 fb-flex fb-items-end"},v("div",{className:"fb-flex fb-w-full fb-flex-col fb-items-center fb-space-y-4 sm:fb-items-end"},v("div",{className:fe(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 fb-z-40 fb-m-4")},v("div",{class:"fb-absolute fb-top-0 fb-right-0 fb-hidden fb-pt-4 fb-pr-4 sm:fb-block"},v("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 fb-text-slate-400 hover:fb-text-slate-500 focus:ring-slate-500"},v("span",{class:"fb-sr-only"},"Close"),v("svg",{class:"fb-h-6 fb-w-6",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},v("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})))),v("div",{className:""},t))))}var ue=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)}},ce=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 be(e){return v("div",{className:"fb-h-1 fb-w-full fb-rounded-full bg-slate-200"},v("div",{className:"fb-h-1 fb-rounded-full",style:{backgroundColor:e.brandColor,width:Math.floor(100*e.progress)+"%"}}))}function de(e){return v("label",{htmlFor:e.questionId,className:"fb-mb-1.5 fb-block fb-text-base fb-font-semibold fb-leading-6 fb-mr-8 text-slate-900",style:e.style},e.headline)}function pe(e){return v("label",{for:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600"},e.subheader)}function he(e){var t=e.headline,n=e.subheader;return v("div",{className:"fb-text-center"},v("div",{className:"fb-flex fb-items-center fb-justify-center",style:{color:e.brandColor}},v("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"fb-h-24 fb-w-24"},v("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}))),v("span",{className:"fb-inline-block fb-rounded-[100%] fb-w-16 fb-h-1 fb-mb-[10px] fb-bg-slate-300"}),v("div",null,v(de,{headline:t,questionId:"thankYouCard",style:{"margin-right":0}}),v(pe,{subheader:n,questionId:"thankYouCard"})))}function _e(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return v("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)}},v(de,{headline:t.headline,questionId:t.id}),v(pe,{subheader:t.subheader,questionId:t.id}),v("div",{className:"fb-mt-4"},v("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 fb-bg-slate-50 fb-border-slate-100 focus:fb-border-slate-500"})),v("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},v("div",null),v("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:fb-ring-slate-500",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function ge(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ee(null),s=i[0],a=i[1];return v("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);n(o),a(null)}},v(de,{headline:t.headline,questionId:t.id}),v(pe,{subheader:t.subheader,questionId:t.id}),v("div",{className:"fb-mt-4"},v("fieldset",null,v("legend",{className:"fb-sr-only"},"Choices"),v("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e,n){return v("label",{key:e.id,className:fe(s===e.label?"fb-z-10 fb-bg-slate-50 fb-border-slate-400":"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")},v("span",{className:"fb-flex fb-items-center fb-text-sm"},v("input",{type:"radio",id:e.id,name:t.id,value:e.label,className:"fb-h-4 fb-w-4 fb-border fb-border-slate-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":e.id+"-label",onChange:function(e){a(e.currentTarget.value)},checked:s===e.label,style:{borderColor:o,color:o},required:t.required&&0===n}),v("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),v("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},v("div",null),v("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 me(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ee([]),s=i[0],a=i[1],f=function(){return s.length>0};return v("form",{onSubmit:function(e){var r;if(e.preventDefault(),f()||!t.required){var o=((r={})[t.id]=s,r);n(o),a([])}}},v(de,{headline:t.headline,questionId:t.id}),v(pe,{subheader:t.subheader,questionId:t.id}),v("div",{className:"fb-mt-4"},v("fieldset",null,v("legend",{className:"fb-sr-only"},"Choices"),v("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e){return v("label",{key:e.id,className:fe(s.includes(e.label)?"fb-z-10 fb-border-slate-400 fb-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 hover:fb-bg-slate-50 focus:fb-outline-none")},v("span",{className:"fb-flex fb-items-center fb-text-sm"},v("input",{type:"checkbox",id:e.id,name:t.id,value:e.label,className:"fb-h-4 fb-w-4 fb-border fb-border-slate-300 focus:fb-ring-0 focus:fb-ring-offset-0","aria-labelledby":e.id+"-label",onChange:function(e){a(e.currentTarget.checked?[].concat(s,[e.currentTarget.value]):s.filter(function(t){return t!==e.currentTarget.value}))},checked:s.includes(e.label),style:{borderColor:o,color:o}}),v("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),v("input",{type:"text",className:"clip-[rect(0,0,0,0)] fb-absolute fb-m-[-1px] fb-h-1 fb-w-1 fb-overflow-hidden fb-whitespace-nowrap fb-border-0 fb-p-0 fb-text-transparent fb-caret-transparent focus:fb-border-transparent focus:fb-ring-0",required:t.required,value:f()?"checked":""}),v("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},v("div",null),v("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 ve(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ee(null),s=i[0],a=i[1];return v("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=s,r);n(o)}},v(de,{headline:t.headline,questionId:t.id}),v(pe,{subheader:t.subheader,questionId:t.id}),v("div",{className:"fb-my-4"},v("fieldset",null,v("legend",{className:"fb-sr-only"},"Choices"),v("div",{className:"fb-flex"},Array.from({length:11},function(e,t){return t}).map(function(e){return v("label",{key:e,className:fe(s===e?"fb-z-10 fb-border-slate-400 fb-bg-slate-50":"","fb-relative fb-h-10 fb-flex-1 fb-cursor-pointer fb-border fb-bg-white fb-text-center fb-text-sm fb-leading-10 fb-hover:bg-gray-100 fb-focus:outline-none")},v("input",{type:"radio",name:"nps",value:e,className:"fb-absolute fb-h-full fb-w-full fb-cursor-pointer fb-opacity-0",onChange:function(){return a(e)},required:t.required}),e)})),v("div",{className:"fb-flex fb-justify-between fb-text-sm fb-font-semibold fb-leading-6"},v("p",null,t.lowerLabel),v("p",null,t.upperLabel)))),v("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},v("div",null),v("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 fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function we(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return"openText"===t.type?v(_e,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceSingle"===t.type?v(ge,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceMulti"===t.type?v(me,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"nps"===t.type?v(ve,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):null}function ye(e){var t,n=e.config,r=e.survey,o=e.close,i=e.brandColor,s=ee(r.questions[0].id),a=s[0],f=s[1],l=ee(0),u=l[0],c=l[1],b=ee(null),d=b[0],p=b[1],h=ee(null),_=h[0],g=h[1],m=ee(!1),w=m[0],y=m[1];te(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:r.id,personId:n.person.id},n)).then(function(e){g(e.id)})}catch(e){return Promise.reject(e)}}(),console.log(r)},[n,r]),te(function(){var e;c((e=r.questions.findIndex(function(e){return e.id===a}),e/r.questions.length))},[a,r]);var j=function(e){try{var t=function(){y(!1),s?(c(100),r.thankYouCard.enabled?setTimeout(function(){o()},2e3):o()):f(r.questions[i+1].id)};y(!0);var i=r.questions.findIndex(function(e){return e.id===a}),s=i===r.questions.length-1,l={surveyId:r.id,personId:n.person.id,response:{finished:s,data:e}},u=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,n)).then(function(){}):Promise.resolve(Promise.all([ce(l,n),ue(_,n)])).then(function(e){p(e[0].id)});return Promise.resolve(u&&u.then?u.then(t):t())}catch(e){return Promise.reject(e)}};return v("div",null,v("div",{className:fe(w?"fb-animate-pulse fb-opacity-60":"","fb-text-slate-800 fb-font-sans fb-px-4 fb-py-6 sm:fb-p-6")},100===u&&r.thankYouCard.enabled?v(he,{headline:r.thankYouCard.headline,subheader:r.thankYouCard.subheader,brandColor:null==(t=n.settings)?void 0:t.brandColor}):r.questions.map(function(e,t){return a===e.id&&v(we,{key:e.id,brandColor:i,lastQuestion:t===r.questions.length-1,onSubmit:j,question:e})})),v(be,{progress:u,brandColor:i}))}function je(e){var t,n=e.config,r=e.survey,o=e.closeSurvey,i=ee(!0),s=i[1],a=function(){s(!1),setTimeout(function(){o()},1e3)};return v("div",{id:"fbjs"},v(le,{isOpen:i[0],close:a},v(ye,{config:n,survey:r,close:a,brandColor:null==(t=n.settings)?void 0:t.brandColor})))}var xe=/*#__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}();xe.instance=void 0;var ke=/*#__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}();ke.instance=void 0;var Ce=ke.getInstance(),Pe=xe.getInstance(),Ne=function(){try{return Promise.resolve(fetch(Pe.get().apiHost+"/api/v1/client/environments/"+Pe.get().environmentId+"/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:Pe.get().person.id})})).then(function(e){if(!e.ok)throw Ce.error("Error getting settings"),Error("Error getting settings");return e.json()})}catch(e){return Promise.reject(e)}},Se="formbricks-web-container",Ie=xe.getInstance(),Ee=ke.getInstance(),Te=!1,qe=function(e){Te?Ee.debug("A survey is already running. Skipping."):(Te=!0,function(e,t,n){var r,o;f.__&&f.__(e,t),r=t.__k,o=[],L(t,e=t.__k=v(y,null,[e]),r||p,p,void 0!==t.ownerSVGElement,r?null:t.firstChild?a.call(t.childNodes):null,o,r?r.__e:t.firstChild,!1),F(o,e)}(v(je,{config:Ie.get(),survey:e,closeSurvey:He}),document.getElementById(Se)))},He=function(){try{return document.getElementById(Se).remove(),ze(),Promise.resolve(Ne()).then(function(e){Ie.update({settings:e}),Te=!1})}catch(e){return Promise.reject(e)}},ze=function(){var e=document.createElement("div");e.id=Se,document.body.appendChild(e)},Le=ke.getInstance(),Fe=xe.getInstance(),Oe=function(e,t){try{return Promise.resolve(fetch(Fe.get().apiHost+"/api/v1/client/environments/"+Fe.get().environmentId+"/events",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:Fe.get().session.id,eventName:e,properties:t})})).then(function(t){var n;function r(t){if(n)return t;Le.debug('Formbricks: Event "'+e+'" tracked'),Ue(e)}var o=function(){if(!t.ok)return Promise.resolve(t.json()).then(function(e){Le.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)}},Ue=function(e){for(var t,n=s(null==(r=Fe.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 Le.debug("Formbricks: survey "+i.id+' triggered by event "'+e+'"'),void qe(i)}},Ae=xe.getInstance(),Me=ke.getInstance(),De=function(){try{return Me.debug("Creating new person"),Promise.resolve(fetch(Ae.get().apiHost+"/api/v1/client/environments/"+Ae.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)}},We=function(e,t){var n=Ae.get().person.attributes.find(function(t){var n;return(null==(n=t.attributeClass)?void 0:n.name)===e});return!(!n||n.value!==t)},Be=ke.getInstance(),Je=xe.getInstance(),Ye=function(){try{return Je.get().person?Promise.resolve(fetch(Je.get().apiHost+"/api/v1/client/environments/"+Je.get().environmentId+"/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:Je.get().person.id})})).then(function(e){if(e.ok)return Promise.resolve(e.json());Be.error("Error creating session")}):(Be.error("Formbricks: Unable to create session. No person found"),Promise.resolve())}catch(e){return Promise.reject(e)}},Qe=function(e){Be.debug("Session expired. Creating new session.");var t=o({},e);return t.expiresAt=Date.now()+36e5,t},Re=function(e){return e.expiresAt<=Date.now()},Ve=xe.getInstance(),Xe=ke.getInstance(),$e=function(){var e=Ve.get().settings,t=null==e?void 0:e.noCodeEvents.filter(function(e){var t;return"pageUrl"===(null==(t=e.noCodeConfig)?void 0:t.type)});if(Xe.debug("checking page url"),0!==t.length)for(var n,r=s(t);!(n=r()).done;){var o=n.value,i=o.noCodeConfig.pageUrl;i&&Ge(window.location.href,i.value,i.rule)&&Oe(o.name)}};function Ge(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 Ke=function(e){var t=Ve.get().settings,n=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"innerHtml"===(null==(t=e.noCodeConfig)?void 0:t.type)}),r=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"cssSelector"===(null==(t=e.noCodeConfig)?void 0:t.type)}),o=e.target;n.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.innerHtml;n&&o.innerHTML===n.value&&Oe(e.name)}),r.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.cssSelector;n&&o.matches(n.value)&&Oe(e.name)})},Ze=xe.getInstance(),et=ke.getInstance(),tt=function(){if(!(Ze.get().apiHost&&Ze.get().environmentId&&Ze.get().person&&Ze.get().session&&Ze.get().settings))throw Error("Formbricks: Formbricks not initialized. Call initialize() first.")},nt=new r,rt=function(e,t){nt.add(function(){try{return tt(),Promise.resolve(function(e,t){try{return Me.debug("setting attribute: "+e+" to value: "+t),We(e,t)?(Me.debug("attribute already set to this value. Skipping update."),Promise.resolve()):Promise.resolve(function(e,t){try{return Ae.get().person&&Ae.get().person.id?Promise.resolve(fetch(Ae.get().apiHost+"/api/v1/client/environments/"+Ae.get().environmentId+"/people/"+Ae.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 Me.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 Me.error("Error updating attribute"),new Error("Formbricks: Error updating attribute");Ae.update({person:t,settings:n})})}catch(e){return Promise.reject(e)}}(e,t)).then(function(){})}catch(e){return Promise.reject(e)}})},ot={init:function(e){nt.add(function(){try{return function(e){try{var t,n=function(e){if(t)return e;(function(){if("undefined"!=typeof window){var e=window.setInterval(function(){try{return Promise.resolve(function(){try{var e=function(e){Be.debug("Session not expired, extending session"),Je.update({session:Qe(Je.get().session)})};Be.debug("Checking session");var t=function(){if(Re(Je.get().session))return Be.debug("Session expired, creating new session"),Promise.resolve(Ye()).then(function(e){var t=e.session,n=e.settings;if(!t||!n)throw Be.error("Error creating new session"),Error("Error creating new session");Je.update({session:t,settings:n}),Oe("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",$e),window.addEventListener("popstate",$e),window.addEventListener("pushstate",$e),window.addEventListener("replacestate",$e),window.addEventListener("load",$e)),"undefined"!=typeof window&&document.addEventListener("click",Ke),et.debug("Initialized")};if(!e.environmentId)throw Error("Formbricks: environmentId is required");if(!e.apiHost)throw Error("Formbricks: apiHost is required");e.logLevel&&et.configure({logLevel:e.logLevel}),ze(),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 :is(.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 :is(.fb-pointer-events-none){pointer-events:none}#fbjs :is(.fb-pointer-events-auto){pointer-events:auto}#fbjs :is(.fb-fixed){position:fixed}#fbjs :is(.fb-absolute){position:absolute}#fbjs :is(.fb-relative){position:relative}#fbjs :is(.fb-inset-0){inset:0}#fbjs :is(.fb-right-0){right:0}#fbjs :is(.fb-top-0){top:0}#fbjs :is(.fb-z-10){z-index:10}#fbjs :is(.fb-z-40){z-index:40}#fbjs :is(.fb-m-4){margin:1rem}#fbjs :is(.fb-m-\\[-1px\\]){margin:-1px}#fbjs :is(.fb-my-4){margin-bottom:1rem;margin-top:1rem}#fbjs :is(.fb-mb-1){margin-bottom:.25rem}#fbjs :is(.fb-mb-1\\.5){margin-bottom:.375rem}#fbjs :is(.fb-mb-\\[10px\\]){margin-bottom:10px}#fbjs :is(.fb-ml-3){margin-left:.75rem}#fbjs :is(.fb-mr-8){margin-right:2rem}#fbjs :is(.fb-mt-4){margin-top:1rem}#fbjs :is(.fb-mt-\\[35px\\]){margin-top:35px}#fbjs :is(.fb-block){display:block}#fbjs :is(.fb-inline-block){display:inline-block}#fbjs :is(.fb-flex){display:flex}#fbjs :is(.fb-hidden){display:none}#fbjs :is(.fb-h-1){height:.25rem}#fbjs :is(.fb-h-10){height:2.5rem}#fbjs :is(.fb-h-24){height:6rem}#fbjs :is(.fb-h-4){height:1rem}#fbjs :is(.fb-h-6){height:1.5rem}#fbjs :is(.fb-h-\\[2px\\]){height:2px}#fbjs :is(.fb-h-full){height:100%}#fbjs :is(.fb-w-1){width:.25rem}#fbjs :is(.fb-w-16){width:4rem}#fbjs :is(.fb-w-24){width:6rem}#fbjs :is(.fb-w-4){width:1rem}#fbjs :is(.fb-w-4\\/5){width:80%}#fbjs :is(.fb-w-6){width:1.5rem}#fbjs :is(.fb-w-full){width:100%}#fbjs :is(.fb-max-w-sm){max-width:24rem}#fbjs :is(.fb-flex-1){flex:1 1 0%}#fbjs :is(.fb-translate-x-0){--tw-translate-x:0px;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 :is(.fb-translate-x-28){--tw-translate-x:7rem;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))}@keyframes fb-pulse{50%{opacity:.5}}#fbjs :is(.fb-animate-pulse){animation:fb-pulse 2s cubic-bezier(.4,0,.6,1) infinite}#fbjs :is(.fb-cursor-pointer){cursor:pointer}#fbjs :is(.fb-flex-col){flex-direction:column}#fbjs :is(.fb-items-end){align-items:flex-end}#fbjs :is(.fb-items-center){align-items:center}#fbjs :is(.fb-justify-center){justify-content:center}#fbjs :is(.fb-justify-between){justify-content:space-between}#fbjs :is(.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 :is(.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 :is(.fb-overflow-hidden){overflow:hidden}#fbjs :is(.fb-whitespace-nowrap){white-space:nowrap}#fbjs :is(.fb-rounded-\\[100\\%\\]){border-radius:100%}#fbjs :is(.fb-rounded-full){border-radius:9999px}#fbjs :is(.fb-rounded-lg){border-radius:.5rem}#fbjs :is(.fb-rounded-md){border-radius:.375rem}#fbjs :is(.fb-border){border-width:1px}#fbjs :is(.fb-border-0){border-width:0}#fbjs :is(.fb-border-gray-200){--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-100){--tw-border-opacity:1;border-color:rgb(241 245 249/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-300){--tw-border-opacity:1;border-color:rgb(203 213 225/var(--tw-border-opacity))}#fbjs :is(.fb-border-slate-400){--tw-border-opacity:1;border-color:rgb(148 163 184/var(--tw-border-opacity))}#fbjs :is(.fb-border-transparent){border-color:transparent}#fbjs :is(.fb-bg-slate-300){--tw-bg-opacity:1;background-color:rgb(203 213 225/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-slate-50){--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity))}#fbjs :is(.fb-bg-white){--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}#fbjs :is(.fb-p-0){padding:0}#fbjs :is(.fb-p-2){padding:.5rem}#fbjs :is(.fb-p-4){padding:1rem}#fbjs :is(.fb-px-3){padding-left:.75rem;padding-right:.75rem}#fbjs :is(.fb-px-4){padding-left:1rem;padding-right:1rem}#fbjs :is(.fb-py-3){padding-bottom:.75rem;padding-top:.75rem}#fbjs :is(.fb-py-6){padding-bottom:1.5rem;padding-top:1.5rem}#fbjs :is(.fb-pr-4){padding-right:1rem}#fbjs :is(.fb-pt-4){padding-top:1rem}#fbjs :is(.fb-text-center){text-align:center}#fbjs :is(.fb-font-sans){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}#fbjs :is(.fb-text-base){font-size:1rem;line-height:1.5rem}#fbjs :is(.fb-text-sm){font-size:.875rem;line-height:1.25rem}#fbjs :is(.fb-text-xs){font-size:.75rem;line-height:1rem}#fbjs :is(.fb-font-medium){font-weight:500}#fbjs :is(.fb-font-normal){font-weight:400}#fbjs :is(.fb-font-semibold){font-weight:600}#fbjs :is(.fb-leading-10){line-height:2.5rem}#fbjs :is(.fb-leading-4){line-height:1rem}#fbjs :is(.fb-leading-6){line-height:1.5rem}#fbjs :is(.fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-500){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.fb-text-slate-800){--tw-text-opacity:1;color:rgb(30 41 59/var(--tw-text-opacity))}#fbjs :is(.fb-text-transparent){color:transparent}#fbjs :is(.fb-text-white){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}#fbjs :is(.fb-caret-transparent){caret-color:transparent}#fbjs :is(.fb-opacity-0){opacity:0}#fbjs :is(.fb-opacity-100){opacity:1}#fbjs :is(.fb-opacity-60){opacity:.6}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}#fbjs :is(.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 :is(.fb-ring-black){--tw-ring-opacity:1;--tw-ring-color:rgb(0 0 0/var(--tw-ring-opacity))}#fbjs :is(.fb-ring-opacity-5){--tw-ring-opacity:0.05}#fbjs :is(.fb-transition-all){transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.fb-duration-500){transition-duration:.5s}#fbjs :is(.fb-ease-in-out){transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs :is(.hover\\:fb-bg-slate-50:hover){--tw-bg-opacity:1;background-color:rgb(248 250 252/var(--tw-bg-opacity))}#fbjs :is(.hover\\:fb-text-slate-500:hover){--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}#fbjs :is(.hover\\:fb-opacity-90:hover){opacity:.9}#fbjs :is(.focus\\:fb-border-slate-500:focus){--tw-border-opacity:1;border-color:rgb(100 116 139/var(--tw-border-opacity))}#fbjs :is(.focus\\:fb-border-transparent:focus){border-color:transparent}#fbjs :is(.focus\\:fb-outline-none:focus){outline:2px solid transparent;outline-offset:2px}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.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);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}#fbjs :is(.focus\\:fb-ring-slate-500:focus){--tw-ring-opacity:1;--tw-ring-color:rgb(100 116 139/var(--tw-ring-opacity))}#fbjs :is(.focus\\:fb-ring-offset-0:focus){--tw-ring-offset-width:0px}#fbjs :is(.focus\\:fb-ring-offset-2:focus){--tw-ring-offset-width:2px}@media (min-width:640px){#fbjs :is(.sm\\:fb-block){display:block}#fbjs :is(.sm\\:fb-items-end){align-items:flex-end}#fbjs :is(.sm\\:fb-p-6){padding:1.5rem}#fbjs :is(.sm\\:fb-text-sm){font-size:.875rem;line-height:1.25rem}}',document.head.appendChild(e)}}();var r=Ze&&Ze.get().environmentId===e.environmentId&&Ze.get().apiHost===e.apiHost?Ze.get().session&&Re(Ze.get().session)?Promise.resolve(Ye()).then(function(e){var t=e.settings;Ze.update({session:Qe(e.session),settings:t}),Oe("New Session")}):Ze.get().session?void 0:(et.error("Unable to initialize. No session found"),void(t=1)):(Ze.update({environmentId:e.environmentId,apiHost:e.apiHost}),Promise.resolve(De()).then(function(e){var t=e.settings;Ze.update({person:e.person,session:Qe(e.session),settings:t}),Oe("New Session")}));Promise.resolve(r&&r.then?r.then(n):n(r))}catch(e){return Promise.reject(e)}}(e),Promise.resolve()}catch(e){return Promise.reject(e)}})},setUserId:function(e){nt.add(function(){try{return tt(),Promise.resolve(function(e){try{return Me.debug("setting userId: "+e),We("userId",e)?(Me.debug("userId already set to this value. Skipping update."),Promise.resolve()):(t=Ae.get().person.attributes.find(function(e){var t;return"userId"===(null==(t=e.attributeClass)?void 0:t.name)}),t?(Me.error("userId cannot be changed after it has been set. You need to reset first"),Promise.resolve()):Promise.resolve(function(e){try{return Ae.get().person&&Ae.get().person.id?Promise.resolve(fetch(Ae.get().apiHost+"/api/v1/client/environments/"+Ae.get().environmentId+"/people/"+Ae.get().person.id+"/user-id",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,sessionId:Ae.get().session.id})})).then(function(e){if(!e.ok)throw Me.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){Ae.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){rt("email",e)},setAttribute:rt,track:function(e,t){void 0===t&&(t={}),nt.add(function(){try{return tt(),Promise.resolve(Oe(e,t)).then(function(){})}catch(e){return Promise.reject(e)}})},logout:function(){nt.add(function(){try{return tt(),Promise.resolve(function(){try{return Me.debug("Resetting person. Getting new person, session and settings from backend"),Promise.resolve(De()).then(function(e){var t=e.person,n=e.session,r=e.settings;if(!t||!n||!r)throw Me.error("Error resetting user"),new Error("Formbricks: Error resetting user");Ae.update({person:t,session:n,settings:r})})}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}})},refresh:function(){nt.add(function(){try{return tt(),Promise.resolve(function(){try{return Ce.debug("Refreshing - getting settings from backend"),Promise.resolve(Ne()).then(function(e){Pe.update({settings:e})})}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}})},registerRouteChange:function(){nt.add(function(){try{return tt(),$e(),Promise.resolve()}catch(e){return Promise.reject(e)}})}};return ot});
//# sourceMappingURL=index.umd.js.map

@@ -1,3 +0,3 @@

import { Response, DisplayCreateRequest } from "@formbricks/types/js";
export declare const createDisplay: (displayCreateRequest: DisplayCreateRequest, config: any) => Promise<Response>;
export declare const markDisplayResponded: (displayId: any, config: any) => Promise<void>;
import { Response, DisplayCreateRequest, JsConfig } from "@formbricks/types/js";
export declare const createDisplay: (displayCreateRequest: DisplayCreateRequest, config: JsConfig) => Promise<Response>;
export declare const markDisplayResponded: (displayId: string, config: JsConfig) => Promise<void>;

@@ -0,0 +0,0 @@ import { JsConfig } from "@formbricks/types/js";

{
"name": "@formbricks/js",
"version": "0.1.10",
"version": "0.1.11",
"description": "Formbricks-js allows you to connect your app to Formbricks, display surveys and trigger events.",

@@ -5,0 +5,0 @@ "keywords": [

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