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.15 to 0.1.16

dist/App.d.ts

2

./dist/index.js

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

var e=/*#__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}();e.instance=void 0;var t=function(e){return{ok:!0,value:e}},n=function(e){return{ok:!1,error:e}};function r(e,t,n){return!0===e.ok?t(e.value):n(e.error)}e.getInstance();var o=/*#__PURE__*/function(){function t(t){this.handleError=void 0,this.handleError=t||function(t){return e.getInstance().error(JSON.stringify(t))}}return t.getInstance=function(){return t.instance||(t.instance=new t),t.instance},t.init=function(e){this.initialized=!0,console.log("🧱 Formbricks - initializing error handler"),console.log("🧱 Formbricks - Custom error handler: ","function"==typeof e?"yes":"no"),t.instance=new t(e)},t.prototype.handle=function(e){this.handleError(e)},t}();function i(){return i=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},i.apply(this,arguments)}function s(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 a(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 s(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)?s(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.")}o.instance=void 0,o.initialized=!1;var f=/*#__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=i({},this.config,e),this.saveToLocalStorage())},t.get=function(){return this.config},t.loadFromLocalStorage=function(){if("undefined"!=typeof window){var e=localStorage.getItem("formbricksConfig");if(e)return JSON.parse(e)}return{apiHost:null,environmentId:null}},t.saveToLocalStorage=function(){var e,t=this;return(e=function(){return localStorage.setItem("formbricksConfig",JSON.stringify(t.config))},function(){try{return{ok:!0,value:e.apply(void 0,[].slice.call(arguments))}}catch(e){return{ok:!1,error:e}}})()},e}();f.instance=void 0;var l,u,b,d,c,p,h,g={},m=[],v=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function _(e,t){for(var n in t)e[n]=t[n];return e}function w(e){var t=e.parentNode;t&&t.removeChild(e)}function y(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?l.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 j(e,s,r,o,null)}function j(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?++b:o};return null==o&&null!=u.vnode&&u.vnode(i),i}function x(e){return e.children}function k(e,t){this.props=e,this.context=t}function C(e,t){if(null==t)return e.__?C(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?C(e):null}function S(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 S(e)}}function N(e){(!e.__d&&(e.__d=!0)&&d.push(e)&&!I.__r++||c!==u.debounceRendering)&&((c=u.debounceRendering)||p)(I)}function I(){var e,t,n,r,o,i,s,a;for(d.sort(h);e=d.shift();)e.__d&&(t=d.length,r=void 0,o=void 0,s=(i=(n=e).__v).__e,(a=n.__P)&&(r=[],(o=_({},i)).__v=i.__v+1,M(a,i,o,n.__n,void 0!==a.ownerSVGElement,null!=i.__h?[s]:null,r,null==s?C(i):s,i.__h),A(r,i),i.__e!=s&&S(i)),d.length>t&&d.sort(h));I.__r=0}function P(e,t,n,r,o,i,s,a,f,l){var u,b,d,c,p,h,v,_=r&&r.__k||m,w=_.length;for(n.__k=[],u=0;u<t.length;u++)if(null!=(c=n.__k[u]=null==(c=t[u])||"boolean"==typeof c||"function"==typeof c?null:"string"==typeof c||"number"==typeof c||"bigint"==typeof c?j(null,c,null,null,c):Array.isArray(c)?j(x,{children:c},null,null,null):c.__b>0?j(c.type,c.props,c.key,c.ref?c.ref:null,c.__v):c)){if(c.__=n,c.__b=n.__b+1,null===(d=_[u])||d&&c.key==d.key&&c.type===d.type)_[u]=void 0;else for(b=0;b<w;b++){if((d=_[b])&&c.key==d.key&&c.type===d.type){_[b]=void 0;break}d=null}M(e,c,d=d||g,o,i,s,a,f,l),p=c.__e,(b=c.ref)&&d.ref!=b&&(v||(v=[]),d.ref&&v.push(d.ref,null,c),v.push(b,c.__c||p,c)),null!=p?(null==h&&(h=p),"function"==typeof c.type&&c.__k===d.__k?c.__d=f=q(c,f,e):f=E(e,c,d,_,p,f),"function"==typeof n.type&&(n.__d=f)):f&&d.__e==f&&f.parentNode!=e&&(f=C(d))}for(n.__e=h,u=w;u--;)null!=_[u]&&("function"==typeof n.type&&null!=_[u].__e&&_[u].__e==n.__d&&(n.__d=H(r).nextSibling),D(_[u],_[u]));if(v)for(u=0;u<v.length;u++)U(v[u],v[++u],v[++u])}function q(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?q(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 H(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=H(n)))return r;return null}function z(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||v.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||z(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||z(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?O:L,i):e.removeEventListener(t,i?O:L,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 L(e){return this.l[e.type+!1](u.event?u.event(e):e)}function O(e){return this.l[e.type+!0](u.event?u.event(e):e)}function M(e,t,n,r,o,i,s,a,f){var l,b,d,c,p,h,g,m,v,w,y,j,C,S,N,I=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(f=n.__h,a=t.__e=n.__e,t.__h=null,i=[a]),(l=u.__b)&&l(t);try{e:if("function"==typeof I){if(m=t.props,v=(l=I.contextType)&&r[l.__c],w=l?v?v.props.value:l.__:r,n.__c?g=(b=t.__c=n.__c).__=b.__E:("prototype"in I&&I.prototype.render?t.__c=b=new I(m,w):(t.__c=b=new k(m,w),b.constructor=I,b.render=W),v&&v.sub(b),b.props=m,b.state||(b.state={}),b.context=w,b.__n=r,d=b.__d=!0,b.__h=[],b._sb=[]),null==b.__s&&(b.__s=b.state),null!=I.getDerivedStateFromProps&&(b.__s==b.state&&(b.__s=_({},b.__s)),_(b.__s,I.getDerivedStateFromProps(m,b.__s))),c=b.props,p=b.state,b.__v=t,d)null==I.getDerivedStateFromProps&&null!=b.componentWillMount&&b.componentWillMount(),null!=b.componentDidMount&&b.__h.push(b.componentDidMount);else{if(null==I.getDerivedStateFromProps&&m!==c&&null!=b.componentWillReceiveProps&&b.componentWillReceiveProps(m,w),!b.__e&&null!=b.shouldComponentUpdate&&!1===b.shouldComponentUpdate(m,b.__s,w)||t.__v===n.__v){for(t.__v!==n.__v&&(b.props=m,b.state=b.__s,b.__d=!1),b.__e=!1,t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(e){e&&(e.__=t)}),y=0;y<b._sb.length;y++)b.__h.push(b._sb[y]);b._sb=[],b.__h.length&&s.push(b);break e}null!=b.componentWillUpdate&&b.componentWillUpdate(m,b.__s,w),null!=b.componentDidUpdate&&b.__h.push(function(){b.componentDidUpdate(c,p,h)})}if(b.context=w,b.props=m,b.__P=e,j=u.__r,C=0,"prototype"in I&&I.prototype.render){for(b.state=b.__s,b.__d=!1,j&&j(t),l=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,j&&j(t),l=b.render(b.props,b.state,b.context),b.state=b.__s}while(b.__d&&++C<25);b.state=b.__s,null!=b.getChildContext&&(r=_(_({},r),b.getChildContext())),d||null==b.getSnapshotBeforeUpdate||(h=b.getSnapshotBeforeUpdate(c,p)),N=null!=l&&l.type===x&&null==l.key?l.props.children:l,P(e,Array.isArray(N)?N:[N],t,n,r,o,i,s,a,f),b.base=t.__e,t.__h=null,b.__h.length&&s.push(b),g&&(b.__E=b.__=null),b.__e=!1}else null==i&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=F(n.__e,t,n,r,o,i,s,f);(l=u.diffed)&&l(t)}catch(e){t.__v=null,(f||null!=i)&&(t.__e=a,t.__h=!!f,i[i.indexOf(a)]=null),u.__e(e,t,n)}}function A(e,t){u.__c&&u.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){u.__e(e,t.__v)}})}function F(e,t,n,r,o,i,s,a){var f,u,b,d=n.props,c=t.props,p=t.type,h=0;if("svg"===p&&(o=!0),null!=i)for(;h<i.length;h++)if((f=i[h])&&"setAttribute"in f==!!p&&(p?f.localName===p:3===f.nodeType)){e=f,i[h]=null;break}if(null==e){if(null===p)return document.createTextNode(c);e=o?document.createElementNS("http://www.w3.org/2000/svg",p):document.createElement(p,c.is&&c),i=null,a=!1}if(null===p)d===c||a&&e.data===c||(e.data=c);else{if(i=i&&l.call(e.childNodes),u=(d=n.props||g).dangerouslySetInnerHTML,b=c.dangerouslySetInnerHTML,!a){if(null!=i)for(d={},h=0;h<e.attributes.length;h++)d[e.attributes[h].name]=e.attributes[h].value;(b||u)&&(b&&(u&&b.__html==u.__html||b.__html===e.innerHTML)||(e.innerHTML=b&&b.__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,c,d,o,a),b)t.__k=[];else if(h=t.props.children,P(e,Array.isArray(h)?h:[h],t,n,r,o&&"foreignObject"!==p,i,s,i?i[0]:n.__k&&C(n,0),a),null!=i)for(h=i.length;h--;)null!=i[h]&&w(i[h]);a||("value"in c&&void 0!==(h=c.value)&&(h!==e.value||"progress"===p&&!h||"option"===p&&h!==d.value)&&T(e,"value",h,d.value,!1),"checked"in c&&void 0!==(h=c.checked)&&h!==e.checked&&T(e,"checked",h,d.checked,!1))}return e}function U(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){u.__e(e,n)}}function D(e,t,n){var r,o;if(u.unmount&&u.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){u.__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]&&D(r[o],t,n||"function"!=typeof e.type);n||null==e.__e||w(e.__e),e.__=e.__e=e.__d=void 0}function W(e,t,n){return this.constructor(e,n)}l=m.slice,u={__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}},b=0,k.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=_({},this.state),"function"==typeof e&&(e=e(_({},n),this.props)),e&&_(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),N(this))},k.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),N(this))},k.prototype.render=x,d=[],p="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,h=function(e,t){return e.__v.__b-t.__v.__b},I.__r=0;var Q,J,B,Y,R=0,V=[],G=[],X=u.__b,$=u.__r,K=u.diffed,Z=u.__c,ee=u.unmount;function te(e,t){u.__h&&u.__h(J,e,R||t),R=0;var n=J.__H||(J.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:G}),n.__[e]}function ne(e){return R=1,function(e,t,n){var r=te(Q++,2);if(r.t=e,!r.__c&&(r.__=[le(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=J,!J.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))};J.u=!0;var i=J.shouldComponentUpdate,s=J.componentWillUpdate;J.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)},J.shouldComponentUpdate=o}return r.__N||r.__}(le,e)}function re(e,t){var n=te(Q++,3);!u.__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,J.__H.__h.push(n))}function oe(){for(var e;e=V.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ae),e.__H.__h.forEach(fe),e.__H.__h=[]}catch(t){e.__H.__h=[],u.__e(t,e.__v)}}u.__b=function(e){J=null,X&&X(e)},u.__r=function(e){$&&$(e),Q=0;var t=(J=e.__c).__H;t&&(B===J?(t.__h=[],J.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.__V=G,e.__N=e.i=void 0})):(t.__h.forEach(ae),t.__h.forEach(fe),t.__h=[])),B=J},u.diffed=function(e){K&&K(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==V.push(t)&&Y===u.requestAnimationFrame||((Y=u.requestAnimationFrame)||se)(oe)),t.__H.__.forEach(function(e){e.i&&(e.__H=e.i),e.__V!==G&&(e.__=e.__V),e.i=void 0,e.__V=G})),B=J=null},u.__c=function(e,t){t.some(function(e){try{e.__h.forEach(ae),e.__h=e.__h.filter(function(e){return!e.__||fe(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],u.__e(n,e.__v)}}),Z&&Z(e,t)},u.unmount=function(e){ee&&ee(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{ae(e)}catch(e){t=e}}),n.__H=void 0,t&&u.__e(t,n.__v))};var ie="function"==typeof requestAnimationFrame;function se(e){var t,n=function(){clearTimeout(r),ie&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);ie&&(t=requestAnimationFrame(n))}function ae(e){var t=J,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),J=t}function fe(e){var t=J;e.__c=e.__(),J=t}function le(e,t){return"function"==typeof t?t(e):t}var ue=function(){return[].slice.call(arguments).filter(Boolean).join(" ")};function be(e){var t=e.children,n=e.isOpen,r=e.close,o=ne(!1),i=o[0],s=o[1];return re(function(){s(n)},[n]),y("div",{"aria-live":"assertive",className:"fb-pointer-events-none fb-fixed fb-inset-0 fb-flex fb-items-end fb-z-40"},y("div",{className:"fb-flex fb-w-full fb-flex-col fb-items-center fb-space-y-4 sm:fb-items-end"},y("div",{className:ue(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-m-4")},y("div",{class:"fb-absolute fb-top-0 fb-right-0 fb-hidden fb-pt-4 fb-pr-4 sm:fb-block"},y("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"},y("span",{class:"fb-sr-only"},"Close"),y("svg",{class:"fb-h-6 fb-w-6",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},y("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})))),y("div",{className:""},t))))}var de=function(e,t){try{var r=t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/displays/"+e+"/responded";return Promise.resolve(fetch(r,{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(e){var t;function o(e){return t?e:{ok:!0,value:void 0}}var i=function(){if(!e.ok)return Promise.resolve(e.json()).then(function(o){var i=n({code:"network_error",message:"Could not mark display as responded",status:e.status,url:r,responseMessage:o.message});return t=1,i})}();return i&&i.then?i.then(o):o(i)})}catch(e){return Promise.reject(e)}},ce=function(e,r){try{var o=r.apiHost+"/api/v1/client/environments/"+r.environmentId+"/responses";return Promise.resolve(fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){return Promise.resolve(e.json()).then(function(r){return e.ok?t(r):n({code:"network_error",message:"Could not create response",status:e.status,url:o,responseMessage:r.message})})})}catch(e){return Promise.reject(e)}};function pe(e){return y("div",{className:"fb-h-1 fb-w-full fb-rounded-full bg-slate-200"},y("div",{className:"fb-h-1 fb-rounded-full",style:{backgroundColor:e.brandColor,width:Math.floor(100*e.progress)+"%"}}))}function he(e){return y("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 ge(e){return y("label",{htmlFor:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600"},e.subheader)}function me(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return y("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)}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-mt-4"},y("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"})),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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 ve(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne(null),s=i[0],a=i[1];return y("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);n(o),a(null)}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-mt-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Options"),y("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e,n){return y("label",{key:e.id,className:ue(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")},y("span",{className:"fb-flex fb-items-center fb-text-sm"},y("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}),y("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne([]),s=i[0],a=i[1],f=function(){return s.length>0};return y("form",{onSubmit:function(e){var r;if(e.preventDefault(),f()||!t.required){var o=((r={})[t.id]=s,r);n(o),a([])}}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-mt-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Options"),y("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e){return y("label",{key:e.id,className:ue(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")},y("span",{className:"fb-flex fb-items-center fb-text-sm"},y("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}}),y("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),y("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":""}),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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 we(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne(null),s=i[0],a=i[1];return y("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=s,r);n(o)}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-my-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Options"),y("div",{className:"fb-flex"},Array.from({length:11},function(e,t){return t}).map(function(e){return y("label",{key:e,className:ue(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 first:fb-rounded-l-md last:fb-rounded-r-md hover:fb-bg-gray-100 focus:fb-outline-none")},y("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 function(e){var r;a(e),t.required&&n(((r={})[t.id]=e,r))}(e)},required:t.required}),e)})),y("div",{className:"fb-flex fb-justify-between fb-text-slate-500 fb-leading-6 fb-px-1.5 fb-text-xs"},y("p",null,t.lowerLabel),y("p",null,t.upperLabel)))),!t.required&&y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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 ye(e){function t(e,t){var n=t.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(e)||!n.includes("javascript:")&&!n.includes("data:"))||!!e.startsWith("on")||void 0}function n(e){for(var n,r=a(e.attributes);!(n=r()).done;){var o=n.value,i=o.name;t(i,o.value)&&e.removeAttribute(i)}}var r=(new DOMParser).parseFromString(e,"text/html").body||document.createElement("body");return function(e){for(var t,n=a(e.querySelectorAll("script"));!(t=n()).done;)t.value.remove()}(r),function e(t){for(var r,o=a(t.children);!(r=o()).done;){var i=r.value;n(i),e(i)}}(r),r.innerHTML}function je(e){return y("label",{htmlFor:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600",dangerouslySetInnerHTML:{__html:ye(e.htmlString)}})}function xe(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return y("div",null,y(he,{headline:t.headline,questionId:t.id}),y(je,{htmlString:t.html,questionId:t.id}),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-end"},y("div",null),!t.required&&y("button",{type:"button",onClick:function(){var e;n(((e={})[t.id]="dismissed",e))},className:"fb-flex fb-items-center dark:fb-text-slate-400 fb-rounded-md fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2 fb-mr-4"},t.dismissButtonLabel||"Skip"),y("button",{type:"button",onClick:function(){var e,r,o;t.buttonExternal&&t.buttonUrl&&(null==(r=window)||null==(o=r.open(t.buttonUrl,"_blank"))||o.focus()),n(((e={})[t.id]="clicked",e))},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 ke(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne(null),s=i[0],a=i[1];return y("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=s,r);a(null),n(o)}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-my-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Choices"),y("div",{className:"fb-flex"},Array.from({length:t.range},function(e,t){return t+1}).map(function(e){return y("label",{key:e,className:ue(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 first:fb-rounded-l-md last:fb-rounded-r-md hover:fb-bg-gray-100 focus:fb-outline-none")},y("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 function(e){var r;a(e),t.required&&(n(((r={})[t.id]=e,r)),a(null))}(e)},required:t.required}),e)})),y("div",{className:"fb-flex fb-justify-between fb-text-slate-500 fb-leading-6 fb-px-1.5 fb-text-xs"},y("p",null,t.lowerLabel),y("p",null,t.upperLabel)))),!t.required&&y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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-slate-500 focus:fb-ring-offset-2",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function Ce(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return"openText"===t.type?y(me,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceSingle"===t.type?y(ve,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceMulti"===t.type?y(_e,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"nps"===t.type?y(we,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"cta"===t.type?y(xe,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"rating"===t.type?y(ke,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):null}function Se(e){var t=e.headline,n=e.subheader;return y("div",{className:"fb-text-center"},y("div",{className:"fb-flex fb-items-center fb-justify-center",style:{color:e.brandColor}},y("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"},y("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"}))),y("span",{className:"fb-inline-block fb-rounded-[100%] fb-w-16 fb-h-1 fb-mb-[10px] fb-bg-slate-300"}),y("div",null,y(he,{headline:t,questionId:"thankYouCard",style:{"margin-right":0}}),y(ge,{subheader:n,questionId:"thankYouCard"})))}function Ne(r){var o,i=r.config,s=r.survey,a=r.close,f=r.brandColor,l=r.errorHandler,u=ne(s.questions[0].id),b=u[0],d=u[1],c=ne(0),p=c[0],h=c[1],g=ne(null),m=g[0],v=g[1],_=ne(null),w=_[0],j=_[1],x=ne(!1),k=x[0],C=x[1];re(function(){!function(){try{Promise.resolve(function(e,r){try{var o=r.apiHost+"/api/v1/client/environments/"+r.environmentId+"/displays";return Promise.resolve(fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){var r;function i(n){return r?n:Promise.resolve(e.json()).then(t)}var s=function(){if(!e.ok)return Promise.resolve(e.json()).then(function(t){var i=n({code:"network_error",message:"Could not create display",status:e.status,url:o,responseMessage:t.message});return r=1,i})}();return s&&s.then?s.then(i):i(s)})}catch(e){return Promise.reject(e)}}({surveyId:s.id,personId:i.person.id},i)).then(function(e){!0===e.ok?j(e.value.id):l(e.error)})}catch(e){return Promise.reject(e)}}()},[i,s,l]),re(function(){var e;h((e=s.questions.findIndex(function(e){return e.id===b}),e/s.questions.length))},[b,s]);var S=function(r){try{var o=function(){C(!1),u?(h(100),s.thankYouCard.enabled?setTimeout(function(){a()},2e3):a()):d(s.questions[f+1].id)};C(!0);var f=s.questions.findIndex(function(e){return e.id===b}),u=f===s.questions.length-1,c={surveyId:s.id,personId:i.person.id,response:{finished:u,data:r}},p=m?Promise.resolve(function(e,r,o){try{var i=o.apiHost+"/api/v1/client/environments/"+o.environmentId+"/responses/"+r;return Promise.resolve(fetch(i,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){return Promise.resolve(e.json()).then(function(r){return e.ok?t(r):n({code:"network_error",message:"Could not update response",status:e.status,url:i,responseMessage:r.message})})})}catch(e){return Promise.reject(e)}}(c,m,i)).then(function(t){!0!==t.ok?l(t.error):c.response.finished&&e.getInstance().debug("Submitted response")}):Promise.resolve(Promise.all([ce(c,i),de(w,i)])).then(function(e){var t=e[0];!0===t.ok?v(t.value.id):l(t.error)});return Promise.resolve(p&&p.then?p.then(o):o())}catch(e){return Promise.reject(e)}};return y("div",null,y("div",{className:ue(k?"fb-animate-pulse fb-opacity-60":"","fb-text-slate-800 fb-font-sans fb-px-4 fb-py-6 sm:fb-p-6")},100===p&&s.thankYouCard.enabled?y(Se,{headline:s.thankYouCard.headline,subheader:s.thankYouCard.subheader,brandColor:null==(o=i.settings)?void 0:o.brandColor}):s.questions.map(function(e,t){return b===e.id&&y(Ce,{key:e.id,brandColor:f,lastQuestion:t===s.questions.length-1,onSubmit:S,question:e})})),y(pe,{progress:p,brandColor:f}))}function Ie(e){var t,n=e.config,r=e.survey,o=e.closeSurvey,i=e.errorHandler,s=ne(!0),a=s[1],f=function(){a(!1),setTimeout(function(){o()},1e3)};return y("div",{id:"fbjs"},y(be,{isOpen:s[0],close:f},y(Ne,{config:n,survey:r,close:f,brandColor:null==(t=n.settings)?void 0:t.brandColor,errorHandler:i})))}var Pe=e.getInstance(),qe=f.getInstance(),Ee=function(){try{var e=qe.get().apiHost+"/api/v1/client/environments/"+qe.get().environmentId+"/settings";return Promise.resolve(fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:qe.get().person.id})})).then(function(r){var o;function i(e){return o?e:Promise.resolve(r.json()).then(t)}var s=function(){if(!r.ok)return Promise.resolve(r.json()).then(function(t){var i=n({code:"network_error",status:r.status,message:"Error getting settings",url:e,responseMessage:t.message});return o=1,i})}();return s&&s.then?s.then(i):i(s)})}catch(e){return Promise.reject(e)}},He=function(){try{return Pe.debug("Refreshing - getting settings from backend"),Promise.resolve(Ee()).then(function(e){return!0!==e.ok?n(e.error):(Pe.debug("Settings refreshed"),qe.update({settings:e.value}),{ok:!0,value:void 0})})}catch(e){return Promise.reject(e)}},ze="formbricks-web-container",Te=f.getInstance(),Le=e.getInstance(),Oe=o.getInstance(),Me=!1,Ae=function(e){Me?Le.debug("A survey is already running. Skipping."):(Me=!0,function(e,t,n){var r,o;u.__&&u.__(e,t),r=t.__k,o=[],M(t,e=t.__k=y(x,null,[e]),r||g,g,void 0!==t.ownerSVGElement,r?null:t.firstChild?l.call(t.childNodes):null,o,r?r.__e:t.firstChild,!1),A(o,e)}(y(Ie,{config:Te.get(),survey:e,closeSurvey:Fe,errorHandler:Oe.handle}),document.getElementById(ze)))},Fe=function(){try{return document.getElementById(ze).remove(),Ue(),Promise.resolve(Ee()).then(function(e){r(e,function(e){Te.update({settings:e}),Me=!1},function(e){Oe.handle(e)})})}catch(e){return Promise.reject(e)}},Ue=function(){var e=document.createElement("div");e.id=ze,document.body.appendChild(e)},De=e.getInstance(),We=f.getInstance(),Qe=function(e,t){try{return Promise.resolve(fetch(We.get().apiHost+"/api/v1/client/environments/"+We.get().environmentId+"/events",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:We.get().session.id,eventName:e,properties:t})})).then(function(t){var r;function o(t){return r?t:(De.debug('Formbricks: Event "'+e+'" tracked'),Je(e),{ok:!0,value:void 0})}var i=function(){if(!t.ok)return Promise.resolve(t.json()).then(function(e){var o=n({code:"network_error",message:"Error tracking event: "+JSON.stringify(e),status:t.status,url:t.url,responseMessage:e.message});return r=1,o})}();return i&&i.then?i.then(o):o(i)})}catch(e){return Promise.reject(e)}},Je=function(e){for(var t,n=a(null==(r=We.get().settings)?void 0:r.surveys);!(t=n()).done;)for(var r,o,i=t.value,s=a(i.triggers);!(o=s()).done;){var f;if((null==(f=o.value.eventClass)?void 0:f.name)===e)return De.debug("Formbricks: survey "+i.id+' triggered by event "'+e+'"'),void Ae(i)}},Be="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function Ye(e,t,n){if(!e.s){if(n instanceof Re){if(!n.s)return void(n.o=Ye.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(Ye.bind(null,e,t),Ye.bind(null,e,2));e.s=t,e.v=n;var r=e.o;r&&r(e)}}var Re=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){var r=new e,o=this.s;if(o){var i=1&o?t:n;if(i){try{Ye(r,1,i(this.v))}catch(e){Ye(r,2,e)}return r}return this}return this.o=function(e){try{var o=e.v;1&e.s?Ye(r,1,t?t(o):o):n?Ye(r,1,n(o)):Ye(r,2,o)}catch(e){Ye(r,2,e)}},r},e}();function Ve(e){return e instanceof Re&&1&e.s}var Ge=f.getInstance(),Xe=e.getInstance(),$e=o.getInstance(),Ke=function(){try{var e,r=function(t){return e?t:{ok:!0,value:void 0}};Xe.debug("checking page url");var o=Ge.get().settings,i=null==o?void 0:o.noCodeEvents.filter(function(e){var t;return"pageUrl"===(null==(t=e.noCodeConfig)?void 0:t.type)});if(0===i.length)return Promise.resolve({ok:!0,value:void 0});var s=function(e,t,n){if("function"==typeof e[Be]){var r,o,i,s=e[Be]();if(function e(a){try{for(;!((r=s.next()).done||n&&n());)if((a=t(r.value))&&a.then){if(!Ve(a))return void a.then(e,i||(i=Ye.bind(null,o=new Re,2)));a=a.v}o?Ye(o,1,a):o=a}catch(e){Ye(o||(o=new Re),2,e)}}(),s.return){var a=function(e){try{r.done||s.return()}catch(e){}return e};if(o&&o.then)return o.then(a,function(e){throw a(e)});a()}return o}if(!("length"in e))throw new TypeError("Object is not iterable");for(var f=[],l=0;l<e.length;l++)f.push(e[l]);return function(e,t,n){var r,o,i=-1;return function s(a){try{for(;++i<e.length&&(!n||!n());)if((a=t(i))&&a.then){if(!Ve(a))return void a.then(s,o||(o=Ye.bind(null,r=new Re,2)));a=a.v}r?Ye(r,1,a):r=a}catch(e){Ye(r||(r=new Re),2,e)}}(),r}(f,function(e){return t(f[e])},n)}(i,function(r){var o=r.noCodeConfig.pageUrl;if(o){var i=function(e,r,o){var i,s;switch(o){case"exactMatch":i=e===r;break;case"contains":i=e.includes(r);break;case"startsWith":i=e.startsWith(r);break;case"endsWith":i=e.endsWith(r);break;case"notMatch":i=e!==r;break;case"notContains":i=!e.includes(r);break;default:s=n({code:"invalid_match_type",message:"Invalid match type"})}return s||t(i)}(window.location.href,o.value,o.rule);if(!0!==i.ok){var s=n(i.error);return e=1,s}if(!1!==i.value)return Promise.resolve(Qe(r.name)).then(function(t){if(!0!==t.ok){var r=n(t.error);return e=1,r}})}},function(){return e});return Promise.resolve(s&&s.then?s.then(r):r(s))}catch(e){return Promise.reject(e)}},Ze=function(e){var t=Ge.get().settings,n=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"innerHtml"===(null==(t=e.noCodeConfig)?void 0:t.type)}),o=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"cssSelector"===(null==(t=e.noCodeConfig)?void 0:t.type)}),i=e.target;n.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.innerHtml;n&&i.innerHTML===n.value&&Qe(e.name).then(function(e){r(e,function(e){},function(e){$e.handle(e)})})}),o.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.cssSelector;n&&i.matches(n.value)&&Qe(e.name).then(function(e){r(e,function(e){},function(e){$e.handle(e)})})})},et=f.getInstance(),tt=e.getInstance(),nt=function(){try{tt.debug("Creating new person");var e=et.get().apiHost+"/api/v1/client/environments/"+et.get().environmentId+"/people";return Promise.resolve(fetch(e,{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(r){return Promise.resolve(r.json()).then(function(o){return r.ok?t(o):n({code:"network_error",message:"Error creating person",status:r.status,url:e,responseMessage:o.message})})})}catch(e){return Promise.reject(e)}},rt=function(e,t){var n=et.get().person.attributes.find(function(t){var n;return(null==(n=t.attributeClass)?void 0:n.name)===e});return!(!n||n.value!==t)},ot=function(e){try{return tt.debug("setting userId: "+e),rt("userId",e)?(tt.debug("userId already set to this value. Skipping update."),Promise.resolve({ok:!0,value:void 0})):(r=et.get().person.attributes.find(function(e){var t;return"userId"===(null==(t=e.attributeClass)?void 0:t.name)}),r?Promise.resolve(n({code:"attribute_already_exists",message:"userId cannot be changed after it has been set. You need to reset first"})):Promise.resolve(function(e){try{if(!et.get().person||!et.get().person.id)return Promise.resolve(n({code:"missing_person",message:"Unable to update userId. No person set."}));var r=et.get().apiHost+"/api/v1/client/environments/"+et.get().environmentId+"/people/"+et.get().person.id+"/user-id";return Promise.resolve(fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,sessionId:et.get().session.id})})).then(function(e){return Promise.resolve(e.json()).then(function(o){return e.ok?t(o):n({code:"network_error",message:"Error updating person",status:e.status,url:r,responseMessage:o.message})})})}catch(e){return Promise.reject(e)}}(e)).then(function(e){if(!0!==e.ok)return n(e.error);var t=e.value;return et.update({person:t.person,settings:t.settings}),{ok:!0,value:void 0}}))}catch(e){return Promise.reject(e)}var r},it=function(e,o){try{return tt.debug("setting attribute: "+e+" to value: "+o),rt(e,o)?(tt.debug("attribute already set to this value. Skipping update."),Promise.resolve({ok:!0,value:void 0})):Promise.resolve(function(e,r){try{return et.get().person&&et.get().person.id?Promise.resolve(fetch(et.get().apiHost+"/api/v1/client/environments/"+et.get().environmentId+"/people/"+et.get().person.id+"/attribute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e,value:r})})).then(function(e){return Promise.resolve(e.json()).then(function(r){return e.ok?t(r):n({code:"network_error",status:e.status,message:"Error updating person",url:e.url,responseMessage:r.message})})}):Promise.resolve(n({code:"missing_person",message:"Unable to update attribute. No person set."}))}catch(e){return Promise.reject(e)}}(e,o)).then(function(e){var t;return r(e,function(e){et.update({person:e.person,settings:e.settings})},function(e){t=e}),t?n(t):{ok:!0,value:void 0}})}catch(e){return Promise.reject(e)}},st=function(){try{return tt.debug("Resetting person. Getting new person, session and settings from backend"),Promise.resolve(nt()).then(function(e){var t;return r(e,function(e){et.update({person:e.person,session:e.session,settings:e.settings})},function(e){t=e}),t?n(t):{ok:!0,value:void 0}})}catch(e){return Promise.reject(e)}},at=e.getInstance(),ft=f.getInstance(),lt=function(){try{if(!ft.get().person)return Promise.resolve(n({code:"missing_person",message:"Unable to create session. No person found"}));var e=ft.get().apiHost+"/api/v1/client/environments/"+ft.get().environmentId+"/sessions";return Promise.resolve(fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:ft.get().person.id})})).then(function(r){return Promise.resolve(r.json()).then(function(o){return r.ok?t(o):n({code:"network_error",message:"Error creating session",status:r.status,url:e,responseMessage:o.message})})})}catch(e){return Promise.reject(e)}},ut=function(e){var t=i({},e);return t.expiresAt=Date.now()+36e5,t},bt=function(e){return!e||e.expiresAt<=Date.now()},dt=f.getInstance(),ct=e.getInstance(),pt=function(e){try{var t,r=function(e){return t?e:(ct.debug("Add session event listeners"),function(){if("undefined"!=typeof window){var e=window.setInterval(function(){try{return Promise.resolve(function(){try{var e,t=function(t){return e?t:(at.debug("Session not expired, extending session"),ft.update({session:ut(ft.get().session)}),{ok:!0,value:void 0})};at.debug("Checking session");var r=function(){if(bt(ft.get().session))return at.debug("Session expired, creating new session"),Promise.resolve(lt()).then(function(t){if(!0!==t.ok){var r=n(t.error);return e=1,r}var o=t.value;return ft.update({session:o.session,settings:o.settings}),Promise.resolve(Qe("New Session")).then(function(t){if(!0!==t.ok){var r=n(t.error);return e=1,r}return e=1,{ok:!0,value:void 0}})})}();return Promise.resolve(r&&r.then?r.then(t):t(r))}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}},3e5);window.addEventListener("beforeunload",function(){clearInterval(e)})}}(),ct.debug("Add page url event listeners"),"undefined"!=typeof window&&(window.addEventListener("hashchange",Ke),window.addEventListener("popstate",Ke),window.addEventListener("pushstate",Ke),window.addEventListener("replacestate",Ke),window.addEventListener("load",Ke)),ct.debug("Add click event listeners"),"undefined"!=typeof window&&document.addEventListener("click",Ze),ct.debug("Initialized"),Ke(),{ok:!0,value:void 0})};if(ct.debug("Start initialize"),!e.environmentId)return ct.debug("No environmentId provided"),Promise.resolve(n({code:"missing_field",field:"environmentId"}));if(!e.apiHost)return ct.debug("No apiHost provided"),Promise.resolve(n({code:"missing_field",field:"apiHost"}));e.logLevel&&(ct.debug("Setting log level to "+e.logLevel),ct.configure({logLevel:e.logLevel})),ct.debug("Adding widget container to DOM"),Ue(),ct.debug("Adding styles to DOM"),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-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--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-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--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-4){margin-right:1rem}#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-end){justify-content:flex-end}#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-1){padding-left:.25rem;padding-right:.25rem}#fbjs :is(.fb-px-1\\.5){padding-left:.375rem;padding-right:.375rem}#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(.first\\:fb-rounded-l-md:first-child){border-bottom-left-radius:.375rem;border-top-left-radius:.375rem}#fbjs :is(.last\\:fb-rounded-r-md:last-child){border-bottom-right-radius:.375rem;border-top-right-radius:.375rem}#fbjs :is(.hover\\:fb-bg-gray-100:hover){--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}#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}#fbjs :is(.fb-dark .dark\\:fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}@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}}.fb-editor-text-bold{font-weight:700!important}.fb-editor-text-italic{font-style:italic!important}.fb-editor-link{color:#334155!important;text-decoration:underline!important}.editor-tokenFunction{color:#dd4a68!important}.fb-editor-paragraph{color:#334155!important;margin:0!important;position:relative!important}.fb-editor-paragraph:last-child{margin-bottom:0!important}.fb-editor-heading-h1{font-size:25px!important;font-weight:400!important}.fb-editor-heading-h1,.fb-editor-heading-h2{font-weight:700!important;margin-bottom:20px!important}.fb-editor-heading-h2{font-size:20px!important}.fb-editor-list-ol,.fb-editor-list-ul{margin-bottom:12px!important}.fb-editor-listitem{margin:0 32px!important}.fb-editor-nested-listitem{list-style-type:none!important}',document.head.appendChild(e)}}();var o=function(){if(dt.get().session&&dt.get().environmentId===e.environmentId&&dt.get().apiHost===e.apiHost){ct.debug("Found existing configuration. Checking session.");var r=dt.get().session;return function(){if(bt(r))return ct.debug("Session expired. Creating new session."),Promise.resolve(lt()).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}var o=e.value,i=o.settings;return dt.update({session:ut(o.session),settings:i}),Promise.resolve(Qe("New Session")).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}})});ct.debug("Session valid. Extending session."),dt.update({session:ut(r)})}()}return ct.debug("No valid session found. Creating new config."),dt.update({environmentId:e.environmentId,apiHost:e.apiHost}),ct.debug("Get person, session and settings from server"),Promise.resolve(nt()).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}var o=e.value,i=o.settings;return dt.update({person:o.person,session:ut(o.session),settings:i}),Promise.resolve(Qe("New Session")).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}})})}();return Promise.resolve(o&&o.then?o.then(r):r(o))}catch(e){return Promise.reject(e)}};function ht(e,t,n){if(!e.s){if(n instanceof mt){if(!n.s)return void(n.o=ht.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(ht.bind(null,e,t),ht.bind(null,e,2));e.s=t,e.v=n;var r=e.o;r&&r(e)}}var gt=e.getInstance();const mt=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){const r=new e,o=this.s;if(o){const e=1&o?t:n;if(e){try{ht(r,1,e(this.v))}catch(e){ht(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?ht(r,1,t?t(o):o):n?ht(r,1,n(o)):ht(r,2,o)}catch(e){ht(r,2,e)}},r},e}();function vt(e){return e instanceof mt&&1&e.s}var _t=/*#__PURE__*/function(){function e(){this.queue=[],this.running=!1}var t=e.prototype;return t.add=function(e,t){void 0===e&&(e=!0);var n=[].slice.call(arguments,2);gt.debug("Add command to queue: "+t.name+"("+JSON.stringify(n)+")"),this.queue.push({command:t,checkInitialized:e,commandArgs:n}),this.running||this.run()},t.run=function(){try{var e=function(){t.running=!1},t=this;t.running=!0;var r=function(e,t,n){for(var r;;){var o=e();if(vt(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!vt(i)){r=1;break}i=i.s}}var s=new mt,a=ht.bind(null,s,2);return(0===r?o.then(l):1===r?i.then(f):(void 0).then(function(){(o=e())?o.then?o.then(l).then(void 0,a):l(o):ht(s,1,i)})).then(void 0,a),s;function f(t){i=t;do{if(!(o=e())||vt(o)&&!o.v)return void ht(s,1,i);if(o.then)return void o.then(l).then(void 0,a);vt(i=n())&&(i=i.v)}while(!i||!i.then);i.then(f).then(void 0,a)}function l(e){e?(i=n())&&i.then?i.then(f).then(void 0,a):f(i):ht(s,1,i)}}(function(){return t.queue.length>0},0,function(){var e=o.getInstance(),r=t.queue.shift();if(r.checkInitialized){var i=(ct.debug("Check if initialized"),dt.get().apiHost&&dt.get().environmentId&&dt.get().person&&dt.get().session&&dt.get().settings&&o.initialized?{ok:!0,value:void 0}:n({code:"not_initialized",message:"Formbricks not initialized. Call initialize() first."}));i&&!0!==i.ok&&e.handle(i.error)}return Promise.resolve(r.command.apply(null,r.commandArgs)).then(function(t){t&&(gt.debug("Command result: "+(!0===t.ok?"OK":"Something went really wrong")+", "+r.command.name),!0!==t.ok&&e.handle(t.error))})});return Promise.resolve(r&&r.then?r.then(e):e())}catch(e){return Promise.reject(e)}},e}();e.getInstance().debug("Create command queue");var wt=new _t,yt=function(e,t){wt.add(!0,it,e,t)};module.exports={init:function(e){o.init(e.errorHandler),wt.add(!1,pt,e)},setUserId:function(e){wt.add(!0,ot,e)},setEmail:function(e){yt("email",e)},setAttribute:yt,track:function(e,t){void 0===t&&(t={}),wt.add(!0,Qe,e,t)},logout:function(){wt.add(!0,st)},refresh:function(){wt.add(!0,He)},registerRouteChange:function(){wt.add(!0,Ke)}};
var e=/*#__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}();e.instance=void 0;var t=function(e){return{ok:!0,value:e}},n=function(e){return{ok:!1,error:e}};function r(e,t,n){return!0===e.ok?t(e.value):n(e.error)}e.getInstance();var o=/*#__PURE__*/function(){function t(t){this.handleError=void 0,this.handleError=t||function(t){return e.getInstance().error(JSON.stringify(t))}}return t.getInstance=function(){return t.instance||(t.instance=new t),t.instance},t.init=function(e){this.initialized=!0,console.log("🧱 Formbricks - initializing error handler"),console.log("🧱 Formbricks - Custom error handler: ","function"==typeof e?"yes":"no"),t.instance=new t(e)},t.prototype.handle=function(e){this.handleError(e)},t}();function i(){return i=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},i.apply(this,arguments)}function s(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 a(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 s(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)?s(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.")}o.instance=void 0,o.initialized=!1;var f=/*#__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=i({},this.config,e),this.saveToLocalStorage())},t.get=function(){return this.config},t.loadFromLocalStorage=function(){if("undefined"!=typeof window){var e=localStorage.getItem("formbricksConfig");if(e)return JSON.parse(e)}return{apiHost:null,environmentId:null}},t.saveToLocalStorage=function(){var e,t=this;return(e=function(){return localStorage.setItem("formbricksConfig",JSON.stringify(t.config))},function(){try{return{ok:!0,value:e.apply(void 0,[].slice.call(arguments))}}catch(e){return{ok:!1,error:e}}})()},e}();f.instance=void 0;var l,u,b,c,d,p,h,m={},g=[],v=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function _(e,t){for(var n in t)e[n]=t[n];return e}function w(e){var t=e.parentNode;t&&t.removeChild(e)}function y(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?l.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 j(e,s,r,o,null)}function j(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?++b:o};return null==o&&null!=u.vnode&&u.vnode(i),i}function x(e){return e.children}function k(e,t){this.props=e,this.context=t}function C(e,t){if(null==t)return e.__?C(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?C(e):null}function S(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 S(e)}}function N(e){(!e.__d&&(e.__d=!0)&&c.push(e)&&!I.__r++||d!==u.debounceRendering)&&((d=u.debounceRendering)||p)(I)}function I(){var e,t,n,r,o,i,s,a;for(c.sort(h);e=c.shift();)e.__d&&(t=c.length,r=void 0,o=void 0,s=(i=(n=e).__v).__e,(a=n.__P)&&(r=[],(o=_({},i)).__v=i.__v+1,M(a,i,o,n.__n,void 0!==a.ownerSVGElement,null!=i.__h?[s]:null,r,null==s?C(i):s,i.__h),A(r,i),i.__e!=s&&S(i)),c.length>t&&c.sort(h));I.__r=0}function P(e,t,n,r,o,i,s,a,f,l){var u,b,c,d,p,h,v,_=r&&r.__k||g,w=_.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?j(null,d,null,null,d):Array.isArray(d)?j(x,{children:d},null,null,null):d.__b>0?j(d.type,d.props,d.key,d.ref?d.ref:null,d.__v):d)){if(d.__=n,d.__b=n.__b+1,null===(c=_[u])||c&&d.key==c.key&&d.type===c.type)_[u]=void 0;else for(b=0;b<w;b++){if((c=_[b])&&d.key==c.key&&d.type===c.type){_[b]=void 0;break}c=null}M(e,d,c=c||m,o,i,s,a,f,l),p=d.__e,(b=d.ref)&&c.ref!=b&&(v||(v=[]),c.ref&&v.push(c.ref,null,d),v.push(b,d.__c||p,d)),null!=p?(null==h&&(h=p),"function"==typeof d.type&&d.__k===c.__k?d.__d=f=q(d,f,e):f=E(e,d,c,_,p,f),"function"==typeof n.type&&(n.__d=f)):f&&c.__e==f&&f.parentNode!=e&&(f=C(c))}for(n.__e=h,u=w;u--;)null!=_[u]&&("function"==typeof n.type&&null!=_[u].__e&&_[u].__e==n.__d&&(n.__d=H(r).nextSibling),D(_[u],_[u]));if(v)for(u=0;u<v.length;u++)U(v[u],v[++u],v[++u])}function q(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?q(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 H(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=H(n)))return r;return null}function z(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||v.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||z(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||z(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?O:L,i):e.removeEventListener(t,i?O:L,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 L(e){return this.l[e.type+!1](u.event?u.event(e):e)}function O(e){return this.l[e.type+!0](u.event?u.event(e):e)}function M(e,t,n,r,o,i,s,a,f){var l,b,c,d,p,h,m,g,v,w,y,j,C,S,N,I=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(f=n.__h,a=t.__e=n.__e,t.__h=null,i=[a]),(l=u.__b)&&l(t);try{e:if("function"==typeof I){if(g=t.props,v=(l=I.contextType)&&r[l.__c],w=l?v?v.props.value:l.__:r,n.__c?m=(b=t.__c=n.__c).__=b.__E:("prototype"in I&&I.prototype.render?t.__c=b=new I(g,w):(t.__c=b=new k(g,w),b.constructor=I,b.render=W),v&&v.sub(b),b.props=g,b.state||(b.state={}),b.context=w,b.__n=r,c=b.__d=!0,b.__h=[],b._sb=[]),null==b.__s&&(b.__s=b.state),null!=I.getDerivedStateFromProps&&(b.__s==b.state&&(b.__s=_({},b.__s)),_(b.__s,I.getDerivedStateFromProps(g,b.__s))),d=b.props,p=b.state,b.__v=t,c)null==I.getDerivedStateFromProps&&null!=b.componentWillMount&&b.componentWillMount(),null!=b.componentDidMount&&b.__h.push(b.componentDidMount);else{if(null==I.getDerivedStateFromProps&&g!==d&&null!=b.componentWillReceiveProps&&b.componentWillReceiveProps(g,w),!b.__e&&null!=b.shouldComponentUpdate&&!1===b.shouldComponentUpdate(g,b.__s,w)||t.__v===n.__v){for(t.__v!==n.__v&&(b.props=g,b.state=b.__s,b.__d=!1),b.__e=!1,t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(e){e&&(e.__=t)}),y=0;y<b._sb.length;y++)b.__h.push(b._sb[y]);b._sb=[],b.__h.length&&s.push(b);break e}null!=b.componentWillUpdate&&b.componentWillUpdate(g,b.__s,w),null!=b.componentDidUpdate&&b.__h.push(function(){b.componentDidUpdate(d,p,h)})}if(b.context=w,b.props=g,b.__P=e,j=u.__r,C=0,"prototype"in I&&I.prototype.render){for(b.state=b.__s,b.__d=!1,j&&j(t),l=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,j&&j(t),l=b.render(b.props,b.state,b.context),b.state=b.__s}while(b.__d&&++C<25);b.state=b.__s,null!=b.getChildContext&&(r=_(_({},r),b.getChildContext())),c||null==b.getSnapshotBeforeUpdate||(h=b.getSnapshotBeforeUpdate(d,p)),N=null!=l&&l.type===x&&null==l.key?l.props.children:l,P(e,Array.isArray(N)?N:[N],t,n,r,o,i,s,a,f),b.base=t.__e,t.__h=null,b.__h.length&&s.push(b),m&&(b.__E=b.__=null),b.__e=!1}else null==i&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=F(n.__e,t,n,r,o,i,s,f);(l=u.diffed)&&l(t)}catch(e){t.__v=null,(f||null!=i)&&(t.__e=a,t.__h=!!f,i[i.indexOf(a)]=null),u.__e(e,t,n)}}function A(e,t){u.__c&&u.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){u.__e(e,t.__v)}})}function F(e,t,n,r,o,i,s,a){var f,u,b,c=n.props,d=t.props,p=t.type,h=0;if("svg"===p&&(o=!0),null!=i)for(;h<i.length;h++)if((f=i[h])&&"setAttribute"in f==!!p&&(p?f.localName===p:3===f.nodeType)){e=f,i[h]=null;break}if(null==e){if(null===p)return document.createTextNode(d);e=o?document.createElementNS("http://www.w3.org/2000/svg",p):document.createElement(p,d.is&&d),i=null,a=!1}if(null===p)c===d||a&&e.data===d||(e.data=d);else{if(i=i&&l.call(e.childNodes),u=(c=n.props||m).dangerouslySetInnerHTML,b=d.dangerouslySetInnerHTML,!a){if(null!=i)for(c={},h=0;h<e.attributes.length;h++)c[e.attributes[h].name]=e.attributes[h].value;(b||u)&&(b&&(u&&b.__html==u.__html||b.__html===e.innerHTML)||(e.innerHTML=b&&b.__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,d,c,o,a),b)t.__k=[];else if(h=t.props.children,P(e,Array.isArray(h)?h:[h],t,n,r,o&&"foreignObject"!==p,i,s,i?i[0]:n.__k&&C(n,0),a),null!=i)for(h=i.length;h--;)null!=i[h]&&w(i[h]);a||("value"in d&&void 0!==(h=d.value)&&(h!==e.value||"progress"===p&&!h||"option"===p&&h!==c.value)&&T(e,"value",h,c.value,!1),"checked"in d&&void 0!==(h=d.checked)&&h!==e.checked&&T(e,"checked",h,c.checked,!1))}return e}function U(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){u.__e(e,n)}}function D(e,t,n){var r,o;if(u.unmount&&u.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){u.__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]&&D(r[o],t,n||"function"!=typeof e.type);n||null==e.__e||w(e.__e),e.__=e.__e=e.__d=void 0}function W(e,t,n){return this.constructor(e,n)}l=g.slice,u={__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}},b=0,k.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=_({},this.state),"function"==typeof e&&(e=e(_({},n),this.props)),e&&_(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),N(this))},k.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),N(this))},k.prototype.render=x,c=[],p="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,h=function(e,t){return e.__v.__b-t.__v.__b},I.__r=0;var Q,J,B,Y,R=0,V=[],G=[],X=u.__b,$=u.__r,K=u.diffed,Z=u.__c,ee=u.unmount;function te(e,t){u.__h&&u.__h(J,e,R||t),R=0;var n=J.__H||(J.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:G}),n.__[e]}function ne(e){return R=1,function(e,t,n){var r=te(Q++,2);if(r.t=e,!r.__c&&(r.__=[le(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=J,!J.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))};J.u=!0;var i=J.shouldComponentUpdate,s=J.componentWillUpdate;J.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)},J.shouldComponentUpdate=o}return r.__N||r.__}(le,e)}function re(e,t){var n=te(Q++,3);!u.__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,J.__H.__h.push(n))}function oe(){for(var e;e=V.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ae),e.__H.__h.forEach(fe),e.__H.__h=[]}catch(t){e.__H.__h=[],u.__e(t,e.__v)}}u.__b=function(e){J=null,X&&X(e)},u.__r=function(e){$&&$(e),Q=0;var t=(J=e.__c).__H;t&&(B===J?(t.__h=[],J.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.__V=G,e.__N=e.i=void 0})):(t.__h.forEach(ae),t.__h.forEach(fe),t.__h=[])),B=J},u.diffed=function(e){K&&K(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==V.push(t)&&Y===u.requestAnimationFrame||((Y=u.requestAnimationFrame)||se)(oe)),t.__H.__.forEach(function(e){e.i&&(e.__H=e.i),e.__V!==G&&(e.__=e.__V),e.i=void 0,e.__V=G})),B=J=null},u.__c=function(e,t){t.some(function(e){try{e.__h.forEach(ae),e.__h=e.__h.filter(function(e){return!e.__||fe(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],u.__e(n,e.__v)}}),Z&&Z(e,t)},u.unmount=function(e){ee&&ee(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{ae(e)}catch(e){t=e}}),n.__H=void 0,t&&u.__e(t,n.__v))};var ie="function"==typeof requestAnimationFrame;function se(e){var t,n=function(){clearTimeout(r),ie&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);ie&&(t=requestAnimationFrame(n))}function ae(e){var t=J,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),J=t}function fe(e){var t=J;e.__c=e.__(),J=t}function le(e,t){return"function"==typeof t?t(e):t}var ue=function(){return[].slice.call(arguments).filter(Boolean).join(" ")};function be(e){var t=e.children,n=e.isOpen,r=e.close,o=ne(!1),i=o[0],s=o[1];return re(function(){s(n)},[n]),y("div",{"aria-live":"assertive",className:"fb-pointer-events-none fb-fixed fb-inset-0 fb-flex fb-items-end fb-z-40"},y("div",{className:"fb-flex fb-w-full fb-flex-col fb-items-center fb-space-y-4 sm:fb-items-end"},y("div",{className:ue(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-m-4")},y("div",{class:"fb-absolute fb-top-0 fb-right-0 fb-hidden fb-pt-4 fb-pr-4 sm:fb-block"},y("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"},y("span",{class:"fb-sr-only"},"Close"),y("svg",{class:"fb-h-6 fb-w-6",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},y("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})))),y("div",{className:""},t))))}var ce=function(e,t){try{var r=t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/displays/"+e+"/responded";return Promise.resolve(fetch(r,{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(e){var t;function o(e){return t?e:{ok:!0,value:void 0}}var i=function(){if(!e.ok)return Promise.resolve(e.json()).then(function(o){var i=n({code:"network_error",message:"Could not mark display as responded",status:e.status,url:r,responseMessage:o.message});return t=1,i})}();return i&&i.then?i.then(o):o(i)})}catch(e){return Promise.reject(e)}},de=function(e,r){try{var o=r.apiHost+"/api/v1/client/environments/"+r.environmentId+"/responses";return Promise.resolve(fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){return Promise.resolve(e.json()).then(function(r){return e.ok?t(r):n({code:"network_error",message:"Could not create response",status:e.status,url:o,responseMessage:r.message})})})}catch(e){return Promise.reject(e)}};function pe(e){return y("div",{className:"fb-h-1 fb-w-full fb-rounded-full bg-slate-200"},y("div",{className:"fb-h-1 fb-rounded-full",style:{backgroundColor:e.brandColor,width:Math.floor(100*e.progress)+"%"}}))}function he(e){return y("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 me(e){return y("label",{htmlFor:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600"},e.subheader)}function ge(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return y("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)}},y(he,{headline:t.headline,questionId:t.id}),y(me,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-mt-4"},y("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"})),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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 ve(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne(null),s=i[0],a=i[1];return y("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);n(o),a(null)}},y(he,{headline:t.headline,questionId:t.id}),y(me,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-mt-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Options"),y("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e,n){return y("label",{key:e.id,className:ue(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")},y("span",{className:"fb-flex fb-items-center fb-text-sm"},y("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}),y("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne([]),s=i[0],a=i[1],f=function(){return s.length>0};return y("form",{onSubmit:function(e){var r;if(e.preventDefault(),f()||!t.required){var o=((r={})[t.id]=s,r);n(o),a([])}}},y(he,{headline:t.headline,questionId:t.id}),y(me,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-mt-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Options"),y("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e){return y("label",{key:e.id,className:ue(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")},y("span",{className:"fb-flex fb-items-center fb-text-sm"},y("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}}),y("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),y("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":""}),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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 we(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne(null),s=i[0],a=i[1];return y("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=s,r);n(o)}},y(he,{headline:t.headline,questionId:t.id}),y(me,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-my-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Options"),y("div",{className:"fb-flex"},Array.from({length:11},function(e,t){return t}).map(function(e){return y("label",{key:e,className:ue(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 first:fb-rounded-l-md last:fb-rounded-r-md hover:fb-bg-gray-100 focus:fb-outline-none")},y("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 function(e){var r;a(e),t.required&&n(((r={})[t.id]=e,r))}(e)},required:t.required}),e)})),y("div",{className:"fb-flex fb-justify-between fb-text-slate-500 fb-leading-6 fb-px-1.5 fb-text-xs"},y("p",null,t.lowerLabel),y("p",null,t.upperLabel)))),!t.required&&y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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 ye(e){function t(e,t){var n=t.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(e)||!n.includes("javascript:")&&!n.includes("data:"))||!!e.startsWith("on")||void 0}function n(e){for(var n,r=a(e.attributes);!(n=r()).done;){var o=n.value,i=o.name;t(i,o.value)&&e.removeAttribute(i)}}var r=(new DOMParser).parseFromString(e,"text/html").body||document.createElement("body");return function(e){for(var t,n=a(e.querySelectorAll("script"));!(t=n()).done;)t.value.remove()}(r),function e(t){for(var r,o=a(t.children);!(r=o()).done;){var i=r.value;n(i),e(i)}}(r),r.innerHTML}function je(e){return y("label",{htmlFor:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600",dangerouslySetInnerHTML:{__html:ye(e.htmlString)}})}function xe(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return y("div",null,y(he,{headline:t.headline,questionId:t.id}),y(je,{htmlString:t.html,questionId:t.id}),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-end"},y("div",null),!t.required&&y("button",{type:"button",onClick:function(){var e;n(((e={})[t.id]="dismissed",e))},className:"fb-flex fb-items-center dark:fb-text-slate-400 fb-rounded-md fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2 fb-mr-4"},t.dismissButtonLabel||"Skip"),y("button",{type:"button",onClick:function(){var e,r,o;t.buttonExternal&&t.buttonUrl&&(null==(r=window)||null==(o=r.open(t.buttonUrl,"_blank"))||o.focus()),n(((e={})[t.id]="clicked",e))},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 ke(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne(null),s=i[0],a=i[1];return y("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=s,r);a(null),n(o)}},y(he,{headline:t.headline,questionId:t.id}),y(me,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-my-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Choices"),y("div",{className:"fb-flex"},Array.from({length:t.range},function(e,t){return t+1}).map(function(e){return y("label",{key:e,className:ue(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 first:fb-rounded-l-md last:fb-rounded-r-md hover:fb-bg-gray-100 focus:fb-outline-none")},y("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 function(e){var r;a(e),t.required&&(n(((r={})[t.id]=e,r)),a(null))}(e)},required:t.required}),e)})),y("div",{className:"fb-flex fb-justify-between fb-text-slate-500 fb-leading-6 fb-px-1.5 fb-text-xs"},y("p",null,t.lowerLabel),y("p",null,t.upperLabel)))),!t.required&&y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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-slate-500 focus:fb-ring-offset-2",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function Ce(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return"openText"===t.type?y(ge,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceSingle"===t.type?y(ve,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceMulti"===t.type?y(_e,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"nps"===t.type?y(we,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"cta"===t.type?y(xe,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"rating"===t.type?y(ke,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):null}function Se(e){var t=e.headline,n=e.subheader;return y("div",{className:"fb-text-center"},y("div",{className:"fb-flex fb-items-center fb-justify-center",style:{color:e.brandColor}},y("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"},y("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"}))),y("span",{className:"fb-inline-block fb-rounded-[100%] fb-w-16 fb-h-1 fb-mb-[10px] fb-bg-slate-300"}),y("div",null,y(he,{headline:t,questionId:"thankYouCard",style:{"margin-right":0}}),y(me,{subheader:n,questionId:"thankYouCard"})))}function Ne(r){var o,i=r.config,s=r.survey,a=r.close,f=r.brandColor,l=r.errorHandler,u=ne(s.questions[0].id),b=u[0],c=u[1],d=ne(0),p=d[0],h=d[1],m=ne(null),g=m[0],v=m[1],_=ne(null),w=_[0],j=_[1],x=ne(!1),k=x[0],C=x[1];re(function(){!function(){try{Promise.resolve(function(e,r){try{var o=r.apiHost+"/api/v1/client/environments/"+r.environmentId+"/displays";return Promise.resolve(fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){var r;function i(n){return r?n:Promise.resolve(e.json()).then(t)}var s=function(){if(!e.ok)return Promise.resolve(e.json()).then(function(t){var i=n({code:"network_error",message:"Could not create display",status:e.status,url:o,responseMessage:t.message});return r=1,i})}();return s&&s.then?s.then(i):i(s)})}catch(e){return Promise.reject(e)}}({surveyId:s.id,personId:i.person.id},i)).then(function(e){!0===e.ok?j(e.value.id):l(e.error)})}catch(e){return Promise.reject(e)}}()},[i,s,l]),re(function(){var e;h((e=s.questions.findIndex(function(e){return e.id===b}),e/s.questions.length))},[b,s]);var S=function(r){try{var o=function(){C(!1),u?(h(100),s.thankYouCard.enabled?setTimeout(function(){a()},2e3):a()):c(s.questions[f+1].id)};C(!0);var f=s.questions.findIndex(function(e){return e.id===b}),u=f===s.questions.length-1,d={surveyId:s.id,personId:i.person.id,response:{finished:u,data:r}},p=g?Promise.resolve(function(e,r,o){try{var i=o.apiHost+"/api/v1/client/environments/"+o.environmentId+"/responses/"+r;return Promise.resolve(fetch(i,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){return Promise.resolve(e.json()).then(function(r){return e.ok?t(r):n({code:"network_error",message:"Could not update response",status:e.status,url:i,responseMessage:r.message})})})}catch(e){return Promise.reject(e)}}(d,g,i)).then(function(t){!0!==t.ok?l(t.error):d.response.finished&&e.getInstance().debug("Submitted response")}):Promise.resolve(Promise.all([de(d,i),ce(w,i)])).then(function(e){var t=e[0];!0===t.ok?v(t.value.id):l(t.error)});return Promise.resolve(p&&p.then?p.then(o):o())}catch(e){return Promise.reject(e)}};return y("div",null,y("div",{className:ue(k?"fb-animate-pulse fb-opacity-60":"","fb-text-slate-800 fb-font-sans fb-px-4 fb-py-6 sm:fb-p-6")},100===p&&s.thankYouCard.enabled?y(Se,{headline:s.thankYouCard.headline,subheader:s.thankYouCard.subheader,brandColor:null==(o=i.settings)?void 0:o.brandColor}):s.questions.map(function(e,t){return b===e.id&&y(Ce,{key:e.id,brandColor:f,lastQuestion:t===s.questions.length-1,onSubmit:S,question:e})})),y(pe,{progress:p,brandColor:f}))}function Ie(e){var t,n=e.config,r=e.survey,o=e.closeSurvey,i=e.errorHandler,s=ne(!0),a=s[1],f=function(){a(!1),setTimeout(function(){o()},1e3)};return y("div",{id:"fbjs"},y(be,{isOpen:s[0],close:f},y(Ne,{config:n,survey:r,close:f,brandColor:null==(t=n.settings)?void 0:t.brandColor,errorHandler:i})))}var Pe=e.getInstance(),qe=f.getInstance(),Ee=function(){try{var e=qe.get().apiHost+"/api/v1/client/environments/"+qe.get().environmentId+"/settings";return Promise.resolve(fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:qe.get().person.id})})).then(function(r){var o;function i(e){return o?e:Promise.resolve(r.json()).then(t)}var s=function(){if(!r.ok)return Promise.resolve(r.json()).then(function(t){var i=n({code:"network_error",status:r.status,message:"Error getting settings",url:e,responseMessage:t.message});return o=1,i})}();return s&&s.then?s.then(i):i(s)})}catch(e){return Promise.reject(e)}},He=function(){try{return Pe.debug("Refreshing - getting settings from backend"),Promise.resolve(Ee()).then(function(e){return!0!==e.ok?n(e.error):(Pe.debug("Settings refreshed"),qe.update({settings:e.value}),{ok:!0,value:void 0})})}catch(e){return Promise.reject(e)}},ze="formbricks-web-container",Te=f.getInstance(),Le=e.getInstance(),Oe=o.getInstance(),Me=!1,Ae=function(e){Me?Le.debug("A survey is already running. Skipping."):(Me=!0,function(e,t,n){var r,o;u.__&&u.__(e,t),r=t.__k,o=[],M(t,e=t.__k=y(x,null,[e]),r||m,m,void 0!==t.ownerSVGElement,r?null:t.firstChild?l.call(t.childNodes):null,o,r?r.__e:t.firstChild,!1),A(o,e)}(y(Ie,{config:Te.get(),survey:e,closeSurvey:Fe,errorHandler:Oe.handle}),document.getElementById(ze)))},Fe=function(){try{return document.getElementById(ze).remove(),Ue(),Promise.resolve(Ee()).then(function(e){r(e,function(e){Te.update({settings:e}),Me=!1},function(e){Oe.handle(e)})})}catch(e){return Promise.reject(e)}},Ue=function(){var e=document.createElement("div");e.id=ze,document.body.appendChild(e)},De=e.getInstance(),We=f.getInstance(),Qe=function(e,t){try{return Promise.resolve(fetch(We.get().apiHost+"/api/v1/client/environments/"+We.get().environmentId+"/events",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:We.get().session.id,eventName:e,properties:t})})).then(function(t){var r;function o(t){return r?t:(De.debug('Formbricks: Event "'+e+'" tracked'),Je(e),{ok:!0,value:void 0})}var i=function(){if(!t.ok)return Promise.resolve(t.json()).then(function(e){var o=n({code:"network_error",message:"Error tracking event: "+JSON.stringify(e),status:t.status,url:t.url,responseMessage:e.message});return r=1,o})}();return i&&i.then?i.then(o):o(i)})}catch(e){return Promise.reject(e)}},Je=function(e){for(var t,n=a(null==(r=We.get().settings)?void 0:r.surveys);!(t=n()).done;)for(var r,o,i=t.value,s=a(i.triggers);!(o=s()).done;){var f;if((null==(f=o.value.eventClass)?void 0:f.name)===e)return De.debug("Formbricks: survey "+i.id+' triggered by event "'+e+'"'),void Ae(i)}},Be="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function Ye(e,t,n){if(!e.s){if(n instanceof Re){if(!n.s)return void(n.o=Ye.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(Ye.bind(null,e,t),Ye.bind(null,e,2));e.s=t,e.v=n;var r=e.o;r&&r(e)}}var Re=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){var r=new e,o=this.s;if(o){var i=1&o?t:n;if(i){try{Ye(r,1,i(this.v))}catch(e){Ye(r,2,e)}return r}return this}return this.o=function(e){try{var o=e.v;1&e.s?Ye(r,1,t?t(o):o):n?Ye(r,1,n(o)):Ye(r,2,o)}catch(e){Ye(r,2,e)}},r},e}();function Ve(e){return e instanceof Re&&1&e.s}var Ge=f.getInstance(),Xe=e.getInstance(),$e=o.getInstance(),Ke=function(){try{var e,r=function(t){return e?t:{ok:!0,value:void 0}};Xe.debug("checking page url");var o=Ge.get().settings,i=null==o?void 0:o.noCodeEvents.filter(function(e){var t;return"pageUrl"===(null==(t=e.noCodeConfig)?void 0:t.type)});if(0===i.length)return Promise.resolve({ok:!0,value:void 0});var s=function(e,t,n){if("function"==typeof e[Be]){var r,o,i,s=e[Be]();if(function e(a){try{for(;!((r=s.next()).done||n&&n());)if((a=t(r.value))&&a.then){if(!Ve(a))return void a.then(e,i||(i=Ye.bind(null,o=new Re,2)));a=a.v}o?Ye(o,1,a):o=a}catch(e){Ye(o||(o=new Re),2,e)}}(),s.return){var a=function(e){try{r.done||s.return()}catch(e){}return e};if(o&&o.then)return o.then(a,function(e){throw a(e)});a()}return o}if(!("length"in e))throw new TypeError("Object is not iterable");for(var f=[],l=0;l<e.length;l++)f.push(e[l]);return function(e,t,n){var r,o,i=-1;return function s(a){try{for(;++i<e.length&&(!n||!n());)if((a=t(i))&&a.then){if(!Ve(a))return void a.then(s,o||(o=Ye.bind(null,r=new Re,2)));a=a.v}r?Ye(r,1,a):r=a}catch(e){Ye(r||(r=new Re),2,e)}}(),r}(f,function(e){return t(f[e])},n)}(i,function(r){var o=r.noCodeConfig.pageUrl;if(o){var i=function(e,r,o){var i,s;switch(o){case"exactMatch":i=e===r;break;case"contains":i=e.includes(r);break;case"startsWith":i=e.startsWith(r);break;case"endsWith":i=e.endsWith(r);break;case"notMatch":i=e!==r;break;case"notContains":i=!e.includes(r);break;default:s=n({code:"invalid_match_type",message:"Invalid match type"})}return s||t(i)}(window.location.href,o.value,o.rule);if(!0!==i.ok){var s=n(i.error);return e=1,s}if(!1!==i.value)return Promise.resolve(Qe(r.name)).then(function(t){if(!0!==t.ok){var r=n(t.error);return e=1,r}})}},function(){return e});return Promise.resolve(s&&s.then?s.then(r):r(s))}catch(e){return Promise.reject(e)}},Ze=function(e){var t=Ge.get().settings,n=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"innerHtml"===(null==(t=e.noCodeConfig)?void 0:t.type)}),o=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"cssSelector"===(null==(t=e.noCodeConfig)?void 0:t.type)}),i=e.target;n.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.innerHtml;n&&i.innerHTML===n.value&&Qe(e.name).then(function(e){r(e,function(e){},function(e){$e.handle(e)})})}),o.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.cssSelector;n&&i.matches(n.value)&&Qe(e.name).then(function(e){r(e,function(e){},function(e){$e.handle(e)})})})},et=f.getInstance(),tt=e.getInstance(),nt=function(){try{tt.debug("Creating new person");var e=et.get().apiHost+"/api/v1/client/environments/"+et.get().environmentId+"/people";return Promise.resolve(fetch(e,{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(r){return Promise.resolve(r.json()).then(function(o){return r.ok?t(o):n({code:"network_error",message:"Error creating person",status:r.status,url:e,responseMessage:o.message})})})}catch(e){return Promise.reject(e)}},rt=function(e,t){var n=et.get().person.attributes.find(function(t){var n;return(null==(n=t.attributeClass)?void 0:n.name)===e});return!(!n||n.value!==t)},ot=function(e){try{return tt.debug("setting userId: "+e),rt("userId",e)?(tt.debug("userId already set to this value. Skipping update."),Promise.resolve({ok:!0,value:void 0})):(r=et.get().person.attributes.find(function(e){var t;return"userId"===(null==(t=e.attributeClass)?void 0:t.name)}),r?Promise.resolve(n({code:"attribute_already_exists",message:"userId cannot be changed after it has been set. You need to reset first"})):Promise.resolve(function(e){try{if(!et.get().person||!et.get().person.id)return Promise.resolve(n({code:"missing_person",message:"Unable to update userId. No person set."}));var r=et.get().apiHost+"/api/v1/client/environments/"+et.get().environmentId+"/people/"+et.get().person.id+"/user-id";return Promise.resolve(fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,sessionId:et.get().session.id})})).then(function(e){return Promise.resolve(e.json()).then(function(o){return e.ok?t(o):n({code:"network_error",message:"Error updating person",status:e.status,url:r,responseMessage:o.message})})})}catch(e){return Promise.reject(e)}}(e)).then(function(e){if(!0!==e.ok)return n(e.error);var t=e.value;return et.update({person:t.person,settings:t.settings}),{ok:!0,value:void 0}}))}catch(e){return Promise.reject(e)}var r},it=function(e,o){try{return tt.debug("setting attribute: "+e+" to value: "+o),rt(e,o)?(tt.debug("attribute already set to this value. Skipping update."),Promise.resolve({ok:!0,value:void 0})):Promise.resolve(function(e,r){try{return et.get().person&&et.get().person.id?Promise.resolve(fetch(et.get().apiHost+"/api/v1/client/environments/"+et.get().environmentId+"/people/"+et.get().person.id+"/attribute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e,value:r})})).then(function(e){return Promise.resolve(e.json()).then(function(r){return e.ok?t(r):n({code:"network_error",status:e.status,message:"Error updating person",url:e.url,responseMessage:r.message})})}):Promise.resolve(n({code:"missing_person",message:"Unable to update attribute. No person set."}))}catch(e){return Promise.reject(e)}}(e,o)).then(function(e){var t;return r(e,function(e){et.update({person:e.person,settings:e.settings})},function(e){t=e}),t?n(t):{ok:!0,value:void 0}})}catch(e){return Promise.reject(e)}},st=function(){try{return tt.debug("Resetting person. Getting new person, session and settings from backend"),Promise.resolve(nt()).then(function(e){var t;return r(e,function(e){et.update({person:e.person,session:e.session,settings:e.settings})},function(e){t=e}),t?n(t):{ok:!0,value:void 0}})}catch(e){return Promise.reject(e)}},at=e.getInstance(),ft=f.getInstance(),lt=function(){try{if(!ft.get().person)return Promise.resolve(n({code:"missing_person",message:"Unable to create session. No person found"}));var e=ft.get().apiHost+"/api/v1/client/environments/"+ft.get().environmentId+"/sessions";return Promise.resolve(fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:ft.get().person.id})})).then(function(r){return Promise.resolve(r.json()).then(function(o){return r.ok?t(o):n({code:"network_error",message:"Error creating session",status:r.status,url:e,responseMessage:o.message})})})}catch(e){return Promise.reject(e)}},ut=function(e){var t=i({},e);return t.expiresAt=Date.now()+36e5,t},bt=function(e){return!e||e.expiresAt<=Date.now()},ct=f.getInstance(),dt=e.getInstance(),pt=function(e){try{var t,r=function(e){return t?e:(dt.debug("Add session event listeners"),function(){if("undefined"!=typeof window){var e=window.setInterval(function(){try{return Promise.resolve(function(){try{var e,t=function(t){return e?t:(at.debug("Session not expired, extending session"),ft.update({session:ut(ft.get().session)}),{ok:!0,value:void 0})};at.debug("Checking session");var r=function(){if(bt(ft.get().session))return at.debug("Session expired, creating new session"),Promise.resolve(lt()).then(function(t){if(!0!==t.ok){var r=n(t.error);return e=1,r}var o=t.value;return ft.update({session:o.session,settings:o.settings}),Promise.resolve(Qe("New Session")).then(function(t){if(!0!==t.ok){var r=n(t.error);return e=1,r}return e=1,{ok:!0,value:void 0}})})}();return Promise.resolve(r&&r.then?r.then(t):t(r))}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}},3e5);window.addEventListener("beforeunload",function(){clearInterval(e)})}}(),dt.debug("Add page url event listeners"),"undefined"!=typeof window&&(window.addEventListener("hashchange",Ke),window.addEventListener("popstate",Ke),window.addEventListener("pushstate",Ke),window.addEventListener("replacestate",Ke),window.addEventListener("load",Ke)),dt.debug("Add click event listeners"),"undefined"!=typeof window&&document.addEventListener("click",Ze),dt.debug("Initialized"),Ke(),{ok:!0,value:void 0})};if(dt.debug("Start initialize"),!e.environmentId)return dt.debug("No environmentId provided"),Promise.resolve(n({code:"missing_field",field:"environmentId"}));if(!e.apiHost)return dt.debug("No apiHost provided"),Promise.resolve(n({code:"missing_field",field:"apiHost"}));e.logLevel&&(dt.debug("Setting log level to "+e.logLevel),dt.configure({logLevel:e.logLevel})),dt.debug("Adding widget container to DOM"),Ue(),dt.debug("Adding styles to DOM"),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-4){margin-right:1rem}#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-end){justify-content:flex-end}#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-1){padding-left:.25rem;padding-right:.25rem}#fbjs :is(.fb-px-1\\.5){padding-left:.375rem;padding-right:.375rem}#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(.first\\:fb-rounded-l-md:first-child){border-bottom-left-radius:.375rem;border-top-left-radius:.375rem}#fbjs :is(.last\\:fb-rounded-r-md:last-child){border-bottom-right-radius:.375rem;border-top-right-radius:.375rem}#fbjs :is(.hover\\:fb-bg-gray-100:hover){--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}#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}#fbjs :is(.fb-dark .dark\\:fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}@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}}.fb-editor-text-bold{font-weight:700!important}.fb-editor-text-italic{font-style:italic!important}.fb-editor-link{color:#334155!important;text-decoration:underline!important}.editor-tokenFunction{color:#dd4a68!important}.fb-editor-paragraph{color:#334155!important;margin:0!important;position:relative!important}.fb-editor-paragraph:last-child{margin-bottom:0!important}.fb-editor-heading-h1{font-size:25px!important;font-weight:400!important}.fb-editor-heading-h1,.fb-editor-heading-h2{font-weight:700!important;margin-bottom:20px!important}.fb-editor-heading-h2{font-size:20px!important}.fb-editor-list-ol,.fb-editor-list-ul{margin-bottom:12px!important}.fb-editor-listitem{margin:0 32px!important}.fb-editor-nested-listitem{list-style-type:none!important}',document.head.appendChild(e)}}();var o=function(){if(ct.get().session&&ct.get().environmentId===e.environmentId&&ct.get().apiHost===e.apiHost){dt.debug("Found existing configuration. Checking session.");var r=ct.get().session;return function(){if(bt(r))return dt.debug("Session expired. Creating new session."),Promise.resolve(lt()).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}var o=e.value,i=o.settings;return ct.update({session:ut(o.session),settings:i}),Promise.resolve(Qe("New Session")).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}})});dt.debug("Session valid. Extending session."),ct.update({session:ut(r)})}()}return dt.debug("No valid session found. Creating new config."),ct.update({environmentId:e.environmentId,apiHost:e.apiHost}),dt.debug("Get person, session and settings from server"),Promise.resolve(nt()).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}var o=e.value,i=o.settings;return ct.update({person:o.person,session:ut(o.session),settings:i}),Promise.resolve(Qe("New Session")).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}})})}();return Promise.resolve(o&&o.then?o.then(r):r(o))}catch(e){return Promise.reject(e)}};function ht(e,t,n){if(!e.s){if(n instanceof gt){if(!n.s)return void(n.o=ht.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(ht.bind(null,e,t),ht.bind(null,e,2));e.s=t,e.v=n;var r=e.o;r&&r(e)}}var mt=e.getInstance();const gt=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){const r=new e,o=this.s;if(o){const e=1&o?t:n;if(e){try{ht(r,1,e(this.v))}catch(e){ht(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?ht(r,1,t?t(o):o):n?ht(r,1,n(o)):ht(r,2,o)}catch(e){ht(r,2,e)}},r},e}();function vt(e){return e instanceof gt&&1&e.s}var _t=/*#__PURE__*/function(){function e(){this.queue=[],this.running=!1}var t=e.prototype;return t.add=function(e,t){void 0===e&&(e=!0);var n=[].slice.call(arguments,2);mt.debug("Add command to queue: "+t.name+"("+JSON.stringify(n)+")"),this.queue.push({command:t,checkInitialized:e,commandArgs:n}),this.running||this.run()},t.run=function(){try{var e=function(){t.running=!1},t=this;t.running=!0;var r=function(e,t,n){for(var r;;){var o=e();if(vt(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!vt(i)){r=1;break}i=i.s}}var s=new gt,a=ht.bind(null,s,2);return(0===r?o.then(l):1===r?i.then(f):(void 0).then(function(){(o=e())?o.then?o.then(l).then(void 0,a):l(o):ht(s,1,i)})).then(void 0,a),s;function f(t){i=t;do{if(!(o=e())||vt(o)&&!o.v)return void ht(s,1,i);if(o.then)return void o.then(l).then(void 0,a);vt(i=n())&&(i=i.v)}while(!i||!i.then);i.then(f).then(void 0,a)}function l(e){e?(i=n())&&i.then?i.then(f).then(void 0,a):f(i):ht(s,1,i)}}(function(){return t.queue.length>0},0,function(){var e=o.getInstance(),r=t.queue.shift();if(r.checkInitialized){var i=(dt.debug("Check if initialized"),ct.get().apiHost&&ct.get().environmentId&&ct.get().person&&ct.get().session&&ct.get().settings&&o.initialized?{ok:!0,value:void 0}:n({code:"not_initialized",message:"Formbricks not initialized. Call initialize() first."}));i&&!0!==i.ok&&e.handle(i.error)}return Promise.resolve(r.command.apply(null,r.commandArgs)).then(function(t){t&&(mt.debug("Command result: "+(!0===t.ok?"OK":"Something went really wrong")+", "+r.command.name),!0!==t.ok&&e.handle(t.error))})});return Promise.resolve(r&&r.then?r.then(e):e())}catch(e){return Promise.reject(e)}},e}();e.getInstance().debug("Create command queue");var wt=new _t,yt=function(e,t){wt.add(!0,it,e,t)};module.exports={init:function(e){o.init(e.errorHandler),wt.add(!1,pt,e)},setUserId:function(e){wt.add(!0,ot,e)},setEmail:function(e){yt("email",e)},setAttribute:yt,track:function(e,t){void 0===t&&(t={}),wt.add(!0,Qe,e,t)},logout:function(){wt.add(!0,st)},refresh:function(){wt.add(!0,He)},registerRouteChange:function(){wt.add(!0,Ke)}};
//# sourceMappingURL=index.js.map

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

var e=/*#__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}();e.instance=void 0;var t=function(e){return{ok:!0,value:e}},n=function(e){return{ok:!1,error:e}};function r(e,t,n){return!0===e.ok?t(e.value):n(e.error)}e.getInstance();var o=/*#__PURE__*/function(){function t(t){this.handleError=void 0,this.handleError=t||function(t){return e.getInstance().error(JSON.stringify(t))}}return t.getInstance=function(){return t.instance||(t.instance=new t),t.instance},t.init=function(e){this.initialized=!0,console.log("🧱 Formbricks - initializing error handler"),console.log("🧱 Formbricks - Custom error handler: ","function"==typeof e?"yes":"no"),t.instance=new t(e)},t.prototype.handle=function(e){this.handleError(e)},t}();function i(){return i=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},i.apply(this,arguments)}function s(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 a(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 s(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)?s(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.")}o.instance=void 0,o.initialized=!1;var f=/*#__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=i({},this.config,e),this.saveToLocalStorage())},t.get=function(){return this.config},t.loadFromLocalStorage=function(){if("undefined"!=typeof window){var e=localStorage.getItem("formbricksConfig");if(e)return JSON.parse(e)}return{apiHost:null,environmentId:null}},t.saveToLocalStorage=function(){var e,t=this;return(e=function(){return localStorage.setItem("formbricksConfig",JSON.stringify(t.config))},function(){try{return{ok:!0,value:e.apply(void 0,[].slice.call(arguments))}}catch(e){return{ok:!1,error:e}}})()},e}();f.instance=void 0;var l,u,b,d,c,p,h,g={},m=[],v=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function _(e,t){for(var n in t)e[n]=t[n];return e}function w(e){var t=e.parentNode;t&&t.removeChild(e)}function y(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?l.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 j(e,s,r,o,null)}function j(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?++b:o};return null==o&&null!=u.vnode&&u.vnode(i),i}function x(e){return e.children}function k(e,t){this.props=e,this.context=t}function C(e,t){if(null==t)return e.__?C(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?C(e):null}function S(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 S(e)}}function N(e){(!e.__d&&(e.__d=!0)&&d.push(e)&&!I.__r++||c!==u.debounceRendering)&&((c=u.debounceRendering)||p)(I)}function I(){var e,t,n,r,o,i,s,a;for(d.sort(h);e=d.shift();)e.__d&&(t=d.length,r=void 0,o=void 0,s=(i=(n=e).__v).__e,(a=n.__P)&&(r=[],(o=_({},i)).__v=i.__v+1,M(a,i,o,n.__n,void 0!==a.ownerSVGElement,null!=i.__h?[s]:null,r,null==s?C(i):s,i.__h),A(r,i),i.__e!=s&&S(i)),d.length>t&&d.sort(h));I.__r=0}function P(e,t,n,r,o,i,s,a,f,l){var u,b,d,c,p,h,v,_=r&&r.__k||m,w=_.length;for(n.__k=[],u=0;u<t.length;u++)if(null!=(c=n.__k[u]=null==(c=t[u])||"boolean"==typeof c||"function"==typeof c?null:"string"==typeof c||"number"==typeof c||"bigint"==typeof c?j(null,c,null,null,c):Array.isArray(c)?j(x,{children:c},null,null,null):c.__b>0?j(c.type,c.props,c.key,c.ref?c.ref:null,c.__v):c)){if(c.__=n,c.__b=n.__b+1,null===(d=_[u])||d&&c.key==d.key&&c.type===d.type)_[u]=void 0;else for(b=0;b<w;b++){if((d=_[b])&&c.key==d.key&&c.type===d.type){_[b]=void 0;break}d=null}M(e,c,d=d||g,o,i,s,a,f,l),p=c.__e,(b=c.ref)&&d.ref!=b&&(v||(v=[]),d.ref&&v.push(d.ref,null,c),v.push(b,c.__c||p,c)),null!=p?(null==h&&(h=p),"function"==typeof c.type&&c.__k===d.__k?c.__d=f=q(c,f,e):f=E(e,c,d,_,p,f),"function"==typeof n.type&&(n.__d=f)):f&&d.__e==f&&f.parentNode!=e&&(f=C(d))}for(n.__e=h,u=w;u--;)null!=_[u]&&("function"==typeof n.type&&null!=_[u].__e&&_[u].__e==n.__d&&(n.__d=H(r).nextSibling),D(_[u],_[u]));if(v)for(u=0;u<v.length;u++)U(v[u],v[++u],v[++u])}function q(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?q(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 H(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=H(n)))return r;return null}function z(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||v.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||z(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||z(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?O:L,i):e.removeEventListener(t,i?O:L,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 L(e){return this.l[e.type+!1](u.event?u.event(e):e)}function O(e){return this.l[e.type+!0](u.event?u.event(e):e)}function M(e,t,n,r,o,i,s,a,f){var l,b,d,c,p,h,g,m,v,w,y,j,C,S,N,I=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(f=n.__h,a=t.__e=n.__e,t.__h=null,i=[a]),(l=u.__b)&&l(t);try{e:if("function"==typeof I){if(m=t.props,v=(l=I.contextType)&&r[l.__c],w=l?v?v.props.value:l.__:r,n.__c?g=(b=t.__c=n.__c).__=b.__E:("prototype"in I&&I.prototype.render?t.__c=b=new I(m,w):(t.__c=b=new k(m,w),b.constructor=I,b.render=W),v&&v.sub(b),b.props=m,b.state||(b.state={}),b.context=w,b.__n=r,d=b.__d=!0,b.__h=[],b._sb=[]),null==b.__s&&(b.__s=b.state),null!=I.getDerivedStateFromProps&&(b.__s==b.state&&(b.__s=_({},b.__s)),_(b.__s,I.getDerivedStateFromProps(m,b.__s))),c=b.props,p=b.state,b.__v=t,d)null==I.getDerivedStateFromProps&&null!=b.componentWillMount&&b.componentWillMount(),null!=b.componentDidMount&&b.__h.push(b.componentDidMount);else{if(null==I.getDerivedStateFromProps&&m!==c&&null!=b.componentWillReceiveProps&&b.componentWillReceiveProps(m,w),!b.__e&&null!=b.shouldComponentUpdate&&!1===b.shouldComponentUpdate(m,b.__s,w)||t.__v===n.__v){for(t.__v!==n.__v&&(b.props=m,b.state=b.__s,b.__d=!1),b.__e=!1,t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(e){e&&(e.__=t)}),y=0;y<b._sb.length;y++)b.__h.push(b._sb[y]);b._sb=[],b.__h.length&&s.push(b);break e}null!=b.componentWillUpdate&&b.componentWillUpdate(m,b.__s,w),null!=b.componentDidUpdate&&b.__h.push(function(){b.componentDidUpdate(c,p,h)})}if(b.context=w,b.props=m,b.__P=e,j=u.__r,C=0,"prototype"in I&&I.prototype.render){for(b.state=b.__s,b.__d=!1,j&&j(t),l=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,j&&j(t),l=b.render(b.props,b.state,b.context),b.state=b.__s}while(b.__d&&++C<25);b.state=b.__s,null!=b.getChildContext&&(r=_(_({},r),b.getChildContext())),d||null==b.getSnapshotBeforeUpdate||(h=b.getSnapshotBeforeUpdate(c,p)),N=null!=l&&l.type===x&&null==l.key?l.props.children:l,P(e,Array.isArray(N)?N:[N],t,n,r,o,i,s,a,f),b.base=t.__e,t.__h=null,b.__h.length&&s.push(b),g&&(b.__E=b.__=null),b.__e=!1}else null==i&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=F(n.__e,t,n,r,o,i,s,f);(l=u.diffed)&&l(t)}catch(e){t.__v=null,(f||null!=i)&&(t.__e=a,t.__h=!!f,i[i.indexOf(a)]=null),u.__e(e,t,n)}}function A(e,t){u.__c&&u.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){u.__e(e,t.__v)}})}function F(e,t,n,r,o,i,s,a){var f,u,b,d=n.props,c=t.props,p=t.type,h=0;if("svg"===p&&(o=!0),null!=i)for(;h<i.length;h++)if((f=i[h])&&"setAttribute"in f==!!p&&(p?f.localName===p:3===f.nodeType)){e=f,i[h]=null;break}if(null==e){if(null===p)return document.createTextNode(c);e=o?document.createElementNS("http://www.w3.org/2000/svg",p):document.createElement(p,c.is&&c),i=null,a=!1}if(null===p)d===c||a&&e.data===c||(e.data=c);else{if(i=i&&l.call(e.childNodes),u=(d=n.props||g).dangerouslySetInnerHTML,b=c.dangerouslySetInnerHTML,!a){if(null!=i)for(d={},h=0;h<e.attributes.length;h++)d[e.attributes[h].name]=e.attributes[h].value;(b||u)&&(b&&(u&&b.__html==u.__html||b.__html===e.innerHTML)||(e.innerHTML=b&&b.__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,c,d,o,a),b)t.__k=[];else if(h=t.props.children,P(e,Array.isArray(h)?h:[h],t,n,r,o&&"foreignObject"!==p,i,s,i?i[0]:n.__k&&C(n,0),a),null!=i)for(h=i.length;h--;)null!=i[h]&&w(i[h]);a||("value"in c&&void 0!==(h=c.value)&&(h!==e.value||"progress"===p&&!h||"option"===p&&h!==d.value)&&T(e,"value",h,d.value,!1),"checked"in c&&void 0!==(h=c.checked)&&h!==e.checked&&T(e,"checked",h,d.checked,!1))}return e}function U(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){u.__e(e,n)}}function D(e,t,n){var r,o;if(u.unmount&&u.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){u.__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]&&D(r[o],t,n||"function"!=typeof e.type);n||null==e.__e||w(e.__e),e.__=e.__e=e.__d=void 0}function W(e,t,n){return this.constructor(e,n)}l=m.slice,u={__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}},b=0,k.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=_({},this.state),"function"==typeof e&&(e=e(_({},n),this.props)),e&&_(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),N(this))},k.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),N(this))},k.prototype.render=x,d=[],p="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,h=function(e,t){return e.__v.__b-t.__v.__b},I.__r=0;var Q,J,B,Y,R=0,V=[],G=[],X=u.__b,$=u.__r,K=u.diffed,Z=u.__c,ee=u.unmount;function te(e,t){u.__h&&u.__h(J,e,R||t),R=0;var n=J.__H||(J.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:G}),n.__[e]}function ne(e){return R=1,function(e,t,n){var r=te(Q++,2);if(r.t=e,!r.__c&&(r.__=[le(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=J,!J.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))};J.u=!0;var i=J.shouldComponentUpdate,s=J.componentWillUpdate;J.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)},J.shouldComponentUpdate=o}return r.__N||r.__}(le,e)}function re(e,t){var n=te(Q++,3);!u.__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,J.__H.__h.push(n))}function oe(){for(var e;e=V.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ae),e.__H.__h.forEach(fe),e.__H.__h=[]}catch(t){e.__H.__h=[],u.__e(t,e.__v)}}u.__b=function(e){J=null,X&&X(e)},u.__r=function(e){$&&$(e),Q=0;var t=(J=e.__c).__H;t&&(B===J?(t.__h=[],J.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.__V=G,e.__N=e.i=void 0})):(t.__h.forEach(ae),t.__h.forEach(fe),t.__h=[])),B=J},u.diffed=function(e){K&&K(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==V.push(t)&&Y===u.requestAnimationFrame||((Y=u.requestAnimationFrame)||se)(oe)),t.__H.__.forEach(function(e){e.i&&(e.__H=e.i),e.__V!==G&&(e.__=e.__V),e.i=void 0,e.__V=G})),B=J=null},u.__c=function(e,t){t.some(function(e){try{e.__h.forEach(ae),e.__h=e.__h.filter(function(e){return!e.__||fe(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],u.__e(n,e.__v)}}),Z&&Z(e,t)},u.unmount=function(e){ee&&ee(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{ae(e)}catch(e){t=e}}),n.__H=void 0,t&&u.__e(t,n.__v))};var ie="function"==typeof requestAnimationFrame;function se(e){var t,n=function(){clearTimeout(r),ie&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);ie&&(t=requestAnimationFrame(n))}function ae(e){var t=J,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),J=t}function fe(e){var t=J;e.__c=e.__(),J=t}function le(e,t){return"function"==typeof t?t(e):t}var ue=function(){return[].slice.call(arguments).filter(Boolean).join(" ")};function be(e){var t=e.children,n=e.isOpen,r=e.close,o=ne(!1),i=o[0],s=o[1];return re(function(){s(n)},[n]),y("div",{"aria-live":"assertive",className:"fb-pointer-events-none fb-fixed fb-inset-0 fb-flex fb-items-end fb-z-40"},y("div",{className:"fb-flex fb-w-full fb-flex-col fb-items-center fb-space-y-4 sm:fb-items-end"},y("div",{className:ue(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-m-4")},y("div",{class:"fb-absolute fb-top-0 fb-right-0 fb-hidden fb-pt-4 fb-pr-4 sm:fb-block"},y("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"},y("span",{class:"fb-sr-only"},"Close"),y("svg",{class:"fb-h-6 fb-w-6",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},y("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})))),y("div",{className:""},t))))}var de=function(e,t){try{var r=t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/displays/"+e+"/responded";return Promise.resolve(fetch(r,{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(e){var t;function o(e){return t?e:{ok:!0,value:void 0}}var i=function(){if(!e.ok)return Promise.resolve(e.json()).then(function(o){var i=n({code:"network_error",message:"Could not mark display as responded",status:e.status,url:r,responseMessage:o.message});return t=1,i})}();return i&&i.then?i.then(o):o(i)})}catch(e){return Promise.reject(e)}},ce=function(e,r){try{var o=r.apiHost+"/api/v1/client/environments/"+r.environmentId+"/responses";return Promise.resolve(fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){return Promise.resolve(e.json()).then(function(r){return e.ok?t(r):n({code:"network_error",message:"Could not create response",status:e.status,url:o,responseMessage:r.message})})})}catch(e){return Promise.reject(e)}};function pe(e){return y("div",{className:"fb-h-1 fb-w-full fb-rounded-full bg-slate-200"},y("div",{className:"fb-h-1 fb-rounded-full",style:{backgroundColor:e.brandColor,width:Math.floor(100*e.progress)+"%"}}))}function he(e){return y("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 ge(e){return y("label",{htmlFor:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600"},e.subheader)}function me(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return y("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)}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-mt-4"},y("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"})),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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 ve(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne(null),s=i[0],a=i[1];return y("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);n(o),a(null)}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-mt-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Options"),y("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e,n){return y("label",{key:e.id,className:ue(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")},y("span",{className:"fb-flex fb-items-center fb-text-sm"},y("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}),y("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne([]),s=i[0],a=i[1],f=function(){return s.length>0};return y("form",{onSubmit:function(e){var r;if(e.preventDefault(),f()||!t.required){var o=((r={})[t.id]=s,r);n(o),a([])}}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-mt-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Options"),y("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e){return y("label",{key:e.id,className:ue(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")},y("span",{className:"fb-flex fb-items-center fb-text-sm"},y("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}}),y("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),y("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":""}),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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 we(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne(null),s=i[0],a=i[1];return y("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=s,r);n(o)}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-my-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Options"),y("div",{className:"fb-flex"},Array.from({length:11},function(e,t){return t}).map(function(e){return y("label",{key:e,className:ue(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 first:fb-rounded-l-md last:fb-rounded-r-md hover:fb-bg-gray-100 focus:fb-outline-none")},y("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 function(e){var r;a(e),t.required&&n(((r={})[t.id]=e,r))}(e)},required:t.required}),e)})),y("div",{className:"fb-flex fb-justify-between fb-text-slate-500 fb-leading-6 fb-px-1.5 fb-text-xs"},y("p",null,t.lowerLabel),y("p",null,t.upperLabel)))),!t.required&&y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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 ye(e){function t(e,t){var n=t.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(e)||!n.includes("javascript:")&&!n.includes("data:"))||!!e.startsWith("on")||void 0}function n(e){for(var n,r=a(e.attributes);!(n=r()).done;){var o=n.value,i=o.name;t(i,o.value)&&e.removeAttribute(i)}}var r=(new DOMParser).parseFromString(e,"text/html").body||document.createElement("body");return function(e){for(var t,n=a(e.querySelectorAll("script"));!(t=n()).done;)t.value.remove()}(r),function e(t){for(var r,o=a(t.children);!(r=o()).done;){var i=r.value;n(i),e(i)}}(r),r.innerHTML}function je(e){return y("label",{htmlFor:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600",dangerouslySetInnerHTML:{__html:ye(e.htmlString)}})}function xe(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return y("div",null,y(he,{headline:t.headline,questionId:t.id}),y(je,{htmlString:t.html,questionId:t.id}),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-end"},y("div",null),!t.required&&y("button",{type:"button",onClick:function(){var e;n(((e={})[t.id]="dismissed",e))},className:"fb-flex fb-items-center dark:fb-text-slate-400 fb-rounded-md fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2 fb-mr-4"},t.dismissButtonLabel||"Skip"),y("button",{type:"button",onClick:function(){var e,r,o;t.buttonExternal&&t.buttonUrl&&(null==(r=window)||null==(o=r.open(t.buttonUrl,"_blank"))||o.focus()),n(((e={})[t.id]="clicked",e))},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 ke(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne(null),s=i[0],a=i[1];return y("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=s,r);a(null),n(o)}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-my-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Choices"),y("div",{className:"fb-flex"},Array.from({length:t.range},function(e,t){return t+1}).map(function(e){return y("label",{key:e,className:ue(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 first:fb-rounded-l-md last:fb-rounded-r-md hover:fb-bg-gray-100 focus:fb-outline-none")},y("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 function(e){var r;a(e),t.required&&(n(((r={})[t.id]=e,r)),a(null))}(e)},required:t.required}),e)})),y("div",{className:"fb-flex fb-justify-between fb-text-slate-500 fb-leading-6 fb-px-1.5 fb-text-xs"},y("p",null,t.lowerLabel),y("p",null,t.upperLabel)))),!t.required&&y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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-slate-500 focus:fb-ring-offset-2",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function Ce(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return"openText"===t.type?y(me,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceSingle"===t.type?y(ve,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceMulti"===t.type?y(_e,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"nps"===t.type?y(we,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"cta"===t.type?y(xe,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"rating"===t.type?y(ke,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):null}function Se(e){var t=e.headline,n=e.subheader;return y("div",{className:"fb-text-center"},y("div",{className:"fb-flex fb-items-center fb-justify-center",style:{color:e.brandColor}},y("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"},y("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"}))),y("span",{className:"fb-inline-block fb-rounded-[100%] fb-w-16 fb-h-1 fb-mb-[10px] fb-bg-slate-300"}),y("div",null,y(he,{headline:t,questionId:"thankYouCard",style:{"margin-right":0}}),y(ge,{subheader:n,questionId:"thankYouCard"})))}function Ne(r){var o,i=r.config,s=r.survey,a=r.close,f=r.brandColor,l=r.errorHandler,u=ne(s.questions[0].id),b=u[0],d=u[1],c=ne(0),p=c[0],h=c[1],g=ne(null),m=g[0],v=g[1],_=ne(null),w=_[0],j=_[1],x=ne(!1),k=x[0],C=x[1];re(function(){!function(){try{Promise.resolve(function(e,r){try{var o=r.apiHost+"/api/v1/client/environments/"+r.environmentId+"/displays";return Promise.resolve(fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){var r;function i(n){return r?n:Promise.resolve(e.json()).then(t)}var s=function(){if(!e.ok)return Promise.resolve(e.json()).then(function(t){var i=n({code:"network_error",message:"Could not create display",status:e.status,url:o,responseMessage:t.message});return r=1,i})}();return s&&s.then?s.then(i):i(s)})}catch(e){return Promise.reject(e)}}({surveyId:s.id,personId:i.person.id},i)).then(function(e){!0===e.ok?j(e.value.id):l(e.error)})}catch(e){return Promise.reject(e)}}()},[i,s,l]),re(function(){var e;h((e=s.questions.findIndex(function(e){return e.id===b}),e/s.questions.length))},[b,s]);var S=function(r){try{var o=function(){C(!1),u?(h(100),s.thankYouCard.enabled?setTimeout(function(){a()},2e3):a()):d(s.questions[f+1].id)};C(!0);var f=s.questions.findIndex(function(e){return e.id===b}),u=f===s.questions.length-1,c={surveyId:s.id,personId:i.person.id,response:{finished:u,data:r}},p=m?Promise.resolve(function(e,r,o){try{var i=o.apiHost+"/api/v1/client/environments/"+o.environmentId+"/responses/"+r;return Promise.resolve(fetch(i,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){return Promise.resolve(e.json()).then(function(r){return e.ok?t(r):n({code:"network_error",message:"Could not update response",status:e.status,url:i,responseMessage:r.message})})})}catch(e){return Promise.reject(e)}}(c,m,i)).then(function(t){!0!==t.ok?l(t.error):c.response.finished&&e.getInstance().debug("Submitted response")}):Promise.resolve(Promise.all([ce(c,i),de(w,i)])).then(function(e){var t=e[0];!0===t.ok?v(t.value.id):l(t.error)});return Promise.resolve(p&&p.then?p.then(o):o())}catch(e){return Promise.reject(e)}};return y("div",null,y("div",{className:ue(k?"fb-animate-pulse fb-opacity-60":"","fb-text-slate-800 fb-font-sans fb-px-4 fb-py-6 sm:fb-p-6")},100===p&&s.thankYouCard.enabled?y(Se,{headline:s.thankYouCard.headline,subheader:s.thankYouCard.subheader,brandColor:null==(o=i.settings)?void 0:o.brandColor}):s.questions.map(function(e,t){return b===e.id&&y(Ce,{key:e.id,brandColor:f,lastQuestion:t===s.questions.length-1,onSubmit:S,question:e})})),y(pe,{progress:p,brandColor:f}))}function Ie(e){var t,n=e.config,r=e.survey,o=e.closeSurvey,i=e.errorHandler,s=ne(!0),a=s[1],f=function(){a(!1),setTimeout(function(){o()},1e3)};return y("div",{id:"fbjs"},y(be,{isOpen:s[0],close:f},y(Ne,{config:n,survey:r,close:f,brandColor:null==(t=n.settings)?void 0:t.brandColor,errorHandler:i})))}var Pe=e.getInstance(),qe=f.getInstance(),Ee=function(){try{var e=qe.get().apiHost+"/api/v1/client/environments/"+qe.get().environmentId+"/settings";return Promise.resolve(fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:qe.get().person.id})})).then(function(r){var o;function i(e){return o?e:Promise.resolve(r.json()).then(t)}var s=function(){if(!r.ok)return Promise.resolve(r.json()).then(function(t){var i=n({code:"network_error",status:r.status,message:"Error getting settings",url:e,responseMessage:t.message});return o=1,i})}();return s&&s.then?s.then(i):i(s)})}catch(e){return Promise.reject(e)}},He=function(){try{return Pe.debug("Refreshing - getting settings from backend"),Promise.resolve(Ee()).then(function(e){return!0!==e.ok?n(e.error):(Pe.debug("Settings refreshed"),qe.update({settings:e.value}),{ok:!0,value:void 0})})}catch(e){return Promise.reject(e)}},ze="formbricks-web-container",Te=f.getInstance(),Le=e.getInstance(),Oe=o.getInstance(),Me=!1,Ae=function(e){Me?Le.debug("A survey is already running. Skipping."):(Me=!0,function(e,t,n){var r,o;u.__&&u.__(e,t),r=t.__k,o=[],M(t,e=t.__k=y(x,null,[e]),r||g,g,void 0!==t.ownerSVGElement,r?null:t.firstChild?l.call(t.childNodes):null,o,r?r.__e:t.firstChild,!1),A(o,e)}(y(Ie,{config:Te.get(),survey:e,closeSurvey:Fe,errorHandler:Oe.handle}),document.getElementById(ze)))},Fe=function(){try{return document.getElementById(ze).remove(),Ue(),Promise.resolve(Ee()).then(function(e){r(e,function(e){Te.update({settings:e}),Me=!1},function(e){Oe.handle(e)})})}catch(e){return Promise.reject(e)}},Ue=function(){var e=document.createElement("div");e.id=ze,document.body.appendChild(e)},De=e.getInstance(),We=f.getInstance(),Qe=function(e,t){try{return Promise.resolve(fetch(We.get().apiHost+"/api/v1/client/environments/"+We.get().environmentId+"/events",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:We.get().session.id,eventName:e,properties:t})})).then(function(t){var r;function o(t){return r?t:(De.debug('Formbricks: Event "'+e+'" tracked'),Je(e),{ok:!0,value:void 0})}var i=function(){if(!t.ok)return Promise.resolve(t.json()).then(function(e){var o=n({code:"network_error",message:"Error tracking event: "+JSON.stringify(e),status:t.status,url:t.url,responseMessage:e.message});return r=1,o})}();return i&&i.then?i.then(o):o(i)})}catch(e){return Promise.reject(e)}},Je=function(e){for(var t,n=a(null==(r=We.get().settings)?void 0:r.surveys);!(t=n()).done;)for(var r,o,i=t.value,s=a(i.triggers);!(o=s()).done;){var f;if((null==(f=o.value.eventClass)?void 0:f.name)===e)return De.debug("Formbricks: survey "+i.id+' triggered by event "'+e+'"'),void Ae(i)}},Be="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function Ye(e,t,n){if(!e.s){if(n instanceof Re){if(!n.s)return void(n.o=Ye.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(Ye.bind(null,e,t),Ye.bind(null,e,2));e.s=t,e.v=n;var r=e.o;r&&r(e)}}var Re=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){var r=new e,o=this.s;if(o){var i=1&o?t:n;if(i){try{Ye(r,1,i(this.v))}catch(e){Ye(r,2,e)}return r}return this}return this.o=function(e){try{var o=e.v;1&e.s?Ye(r,1,t?t(o):o):n?Ye(r,1,n(o)):Ye(r,2,o)}catch(e){Ye(r,2,e)}},r},e}();function Ve(e){return e instanceof Re&&1&e.s}var Ge=f.getInstance(),Xe=e.getInstance(),$e=o.getInstance(),Ke=function(){try{var e,r=function(t){return e?t:{ok:!0,value:void 0}};Xe.debug("checking page url");var o=Ge.get().settings,i=null==o?void 0:o.noCodeEvents.filter(function(e){var t;return"pageUrl"===(null==(t=e.noCodeConfig)?void 0:t.type)});if(0===i.length)return Promise.resolve({ok:!0,value:void 0});var s=function(e,t,n){if("function"==typeof e[Be]){var r,o,i,s=e[Be]();if(function e(a){try{for(;!((r=s.next()).done||n&&n());)if((a=t(r.value))&&a.then){if(!Ve(a))return void a.then(e,i||(i=Ye.bind(null,o=new Re,2)));a=a.v}o?Ye(o,1,a):o=a}catch(e){Ye(o||(o=new Re),2,e)}}(),s.return){var a=function(e){try{r.done||s.return()}catch(e){}return e};if(o&&o.then)return o.then(a,function(e){throw a(e)});a()}return o}if(!("length"in e))throw new TypeError("Object is not iterable");for(var f=[],l=0;l<e.length;l++)f.push(e[l]);return function(e,t,n){var r,o,i=-1;return function s(a){try{for(;++i<e.length&&(!n||!n());)if((a=t(i))&&a.then){if(!Ve(a))return void a.then(s,o||(o=Ye.bind(null,r=new Re,2)));a=a.v}r?Ye(r,1,a):r=a}catch(e){Ye(r||(r=new Re),2,e)}}(),r}(f,function(e){return t(f[e])},n)}(i,function(r){var o=r.noCodeConfig.pageUrl;if(o){var i=function(e,r,o){var i,s;switch(o){case"exactMatch":i=e===r;break;case"contains":i=e.includes(r);break;case"startsWith":i=e.startsWith(r);break;case"endsWith":i=e.endsWith(r);break;case"notMatch":i=e!==r;break;case"notContains":i=!e.includes(r);break;default:s=n({code:"invalid_match_type",message:"Invalid match type"})}return s||t(i)}(window.location.href,o.value,o.rule);if(!0!==i.ok){var s=n(i.error);return e=1,s}if(!1!==i.value)return Promise.resolve(Qe(r.name)).then(function(t){if(!0!==t.ok){var r=n(t.error);return e=1,r}})}},function(){return e});return Promise.resolve(s&&s.then?s.then(r):r(s))}catch(e){return Promise.reject(e)}},Ze=function(e){var t=Ge.get().settings,n=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"innerHtml"===(null==(t=e.noCodeConfig)?void 0:t.type)}),o=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"cssSelector"===(null==(t=e.noCodeConfig)?void 0:t.type)}),i=e.target;n.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.innerHtml;n&&i.innerHTML===n.value&&Qe(e.name).then(function(e){r(e,function(e){},function(e){$e.handle(e)})})}),o.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.cssSelector;n&&i.matches(n.value)&&Qe(e.name).then(function(e){r(e,function(e){},function(e){$e.handle(e)})})})},et=f.getInstance(),tt=e.getInstance(),nt=function(){try{tt.debug("Creating new person");var e=et.get().apiHost+"/api/v1/client/environments/"+et.get().environmentId+"/people";return Promise.resolve(fetch(e,{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(r){return Promise.resolve(r.json()).then(function(o){return r.ok?t(o):n({code:"network_error",message:"Error creating person",status:r.status,url:e,responseMessage:o.message})})})}catch(e){return Promise.reject(e)}},rt=function(e,t){var n=et.get().person.attributes.find(function(t){var n;return(null==(n=t.attributeClass)?void 0:n.name)===e});return!(!n||n.value!==t)},ot=function(e){try{return tt.debug("setting userId: "+e),rt("userId",e)?(tt.debug("userId already set to this value. Skipping update."),Promise.resolve({ok:!0,value:void 0})):(r=et.get().person.attributes.find(function(e){var t;return"userId"===(null==(t=e.attributeClass)?void 0:t.name)}),r?Promise.resolve(n({code:"attribute_already_exists",message:"userId cannot be changed after it has been set. You need to reset first"})):Promise.resolve(function(e){try{if(!et.get().person||!et.get().person.id)return Promise.resolve(n({code:"missing_person",message:"Unable to update userId. No person set."}));var r=et.get().apiHost+"/api/v1/client/environments/"+et.get().environmentId+"/people/"+et.get().person.id+"/user-id";return Promise.resolve(fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,sessionId:et.get().session.id})})).then(function(e){return Promise.resolve(e.json()).then(function(o){return e.ok?t(o):n({code:"network_error",message:"Error updating person",status:e.status,url:r,responseMessage:o.message})})})}catch(e){return Promise.reject(e)}}(e)).then(function(e){if(!0!==e.ok)return n(e.error);var t=e.value;return et.update({person:t.person,settings:t.settings}),{ok:!0,value:void 0}}))}catch(e){return Promise.reject(e)}var r},it=function(e,o){try{return tt.debug("setting attribute: "+e+" to value: "+o),rt(e,o)?(tt.debug("attribute already set to this value. Skipping update."),Promise.resolve({ok:!0,value:void 0})):Promise.resolve(function(e,r){try{return et.get().person&&et.get().person.id?Promise.resolve(fetch(et.get().apiHost+"/api/v1/client/environments/"+et.get().environmentId+"/people/"+et.get().person.id+"/attribute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e,value:r})})).then(function(e){return Promise.resolve(e.json()).then(function(r){return e.ok?t(r):n({code:"network_error",status:e.status,message:"Error updating person",url:e.url,responseMessage:r.message})})}):Promise.resolve(n({code:"missing_person",message:"Unable to update attribute. No person set."}))}catch(e){return Promise.reject(e)}}(e,o)).then(function(e){var t;return r(e,function(e){et.update({person:e.person,settings:e.settings})},function(e){t=e}),t?n(t):{ok:!0,value:void 0}})}catch(e){return Promise.reject(e)}},st=function(){try{return tt.debug("Resetting person. Getting new person, session and settings from backend"),Promise.resolve(nt()).then(function(e){var t;return r(e,function(e){et.update({person:e.person,session:e.session,settings:e.settings})},function(e){t=e}),t?n(t):{ok:!0,value:void 0}})}catch(e){return Promise.reject(e)}},at=e.getInstance(),ft=f.getInstance(),lt=function(){try{if(!ft.get().person)return Promise.resolve(n({code:"missing_person",message:"Unable to create session. No person found"}));var e=ft.get().apiHost+"/api/v1/client/environments/"+ft.get().environmentId+"/sessions";return Promise.resolve(fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:ft.get().person.id})})).then(function(r){return Promise.resolve(r.json()).then(function(o){return r.ok?t(o):n({code:"network_error",message:"Error creating session",status:r.status,url:e,responseMessage:o.message})})})}catch(e){return Promise.reject(e)}},ut=function(e){var t=i({},e);return t.expiresAt=Date.now()+36e5,t},bt=function(e){return!e||e.expiresAt<=Date.now()},dt=f.getInstance(),ct=e.getInstance(),pt=function(e){try{var t,r=function(e){return t?e:(ct.debug("Add session event listeners"),function(){if("undefined"!=typeof window){var e=window.setInterval(function(){try{return Promise.resolve(function(){try{var e,t=function(t){return e?t:(at.debug("Session not expired, extending session"),ft.update({session:ut(ft.get().session)}),{ok:!0,value:void 0})};at.debug("Checking session");var r=function(){if(bt(ft.get().session))return at.debug("Session expired, creating new session"),Promise.resolve(lt()).then(function(t){if(!0!==t.ok){var r=n(t.error);return e=1,r}var o=t.value;return ft.update({session:o.session,settings:o.settings}),Promise.resolve(Qe("New Session")).then(function(t){if(!0!==t.ok){var r=n(t.error);return e=1,r}return e=1,{ok:!0,value:void 0}})})}();return Promise.resolve(r&&r.then?r.then(t):t(r))}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}},3e5);window.addEventListener("beforeunload",function(){clearInterval(e)})}}(),ct.debug("Add page url event listeners"),"undefined"!=typeof window&&(window.addEventListener("hashchange",Ke),window.addEventListener("popstate",Ke),window.addEventListener("pushstate",Ke),window.addEventListener("replacestate",Ke),window.addEventListener("load",Ke)),ct.debug("Add click event listeners"),"undefined"!=typeof window&&document.addEventListener("click",Ze),ct.debug("Initialized"),Ke(),{ok:!0,value:void 0})};if(ct.debug("Start initialize"),!e.environmentId)return ct.debug("No environmentId provided"),Promise.resolve(n({code:"missing_field",field:"environmentId"}));if(!e.apiHost)return ct.debug("No apiHost provided"),Promise.resolve(n({code:"missing_field",field:"apiHost"}));e.logLevel&&(ct.debug("Setting log level to "+e.logLevel),ct.configure({logLevel:e.logLevel})),ct.debug("Adding widget container to DOM"),Ue(),ct.debug("Adding styles to DOM"),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-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--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-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--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-4){margin-right:1rem}#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-end){justify-content:flex-end}#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-1){padding-left:.25rem;padding-right:.25rem}#fbjs :is(.fb-px-1\\.5){padding-left:.375rem;padding-right:.375rem}#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(.first\\:fb-rounded-l-md:first-child){border-bottom-left-radius:.375rem;border-top-left-radius:.375rem}#fbjs :is(.last\\:fb-rounded-r-md:last-child){border-bottom-right-radius:.375rem;border-top-right-radius:.375rem}#fbjs :is(.hover\\:fb-bg-gray-100:hover){--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}#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}#fbjs :is(.fb-dark .dark\\:fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}@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}}.fb-editor-text-bold{font-weight:700!important}.fb-editor-text-italic{font-style:italic!important}.fb-editor-link{color:#334155!important;text-decoration:underline!important}.editor-tokenFunction{color:#dd4a68!important}.fb-editor-paragraph{color:#334155!important;margin:0!important;position:relative!important}.fb-editor-paragraph:last-child{margin-bottom:0!important}.fb-editor-heading-h1{font-size:25px!important;font-weight:400!important}.fb-editor-heading-h1,.fb-editor-heading-h2{font-weight:700!important;margin-bottom:20px!important}.fb-editor-heading-h2{font-size:20px!important}.fb-editor-list-ol,.fb-editor-list-ul{margin-bottom:12px!important}.fb-editor-listitem{margin:0 32px!important}.fb-editor-nested-listitem{list-style-type:none!important}',document.head.appendChild(e)}}();var o=function(){if(dt.get().session&&dt.get().environmentId===e.environmentId&&dt.get().apiHost===e.apiHost){ct.debug("Found existing configuration. Checking session.");var r=dt.get().session;return function(){if(bt(r))return ct.debug("Session expired. Creating new session."),Promise.resolve(lt()).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}var o=e.value,i=o.settings;return dt.update({session:ut(o.session),settings:i}),Promise.resolve(Qe("New Session")).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}})});ct.debug("Session valid. Extending session."),dt.update({session:ut(r)})}()}return ct.debug("No valid session found. Creating new config."),dt.update({environmentId:e.environmentId,apiHost:e.apiHost}),ct.debug("Get person, session and settings from server"),Promise.resolve(nt()).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}var o=e.value,i=o.settings;return dt.update({person:o.person,session:ut(o.session),settings:i}),Promise.resolve(Qe("New Session")).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}})})}();return Promise.resolve(o&&o.then?o.then(r):r(o))}catch(e){return Promise.reject(e)}};function ht(e,t,n){if(!e.s){if(n instanceof mt){if(!n.s)return void(n.o=ht.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(ht.bind(null,e,t),ht.bind(null,e,2));e.s=t,e.v=n;var r=e.o;r&&r(e)}}var gt=e.getInstance();const mt=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){const r=new e,o=this.s;if(o){const e=1&o?t:n;if(e){try{ht(r,1,e(this.v))}catch(e){ht(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?ht(r,1,t?t(o):o):n?ht(r,1,n(o)):ht(r,2,o)}catch(e){ht(r,2,e)}},r},e}();function vt(e){return e instanceof mt&&1&e.s}var _t=/*#__PURE__*/function(){function e(){this.queue=[],this.running=!1}var t=e.prototype;return t.add=function(e,t){void 0===e&&(e=!0);var n=[].slice.call(arguments,2);gt.debug("Add command to queue: "+t.name+"("+JSON.stringify(n)+")"),this.queue.push({command:t,checkInitialized:e,commandArgs:n}),this.running||this.run()},t.run=function(){try{var e=function(){t.running=!1},t=this;t.running=!0;var r=function(e,t,n){for(var r;;){var o=e();if(vt(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!vt(i)){r=1;break}i=i.s}}var s=new mt,a=ht.bind(null,s,2);return(0===r?o.then(l):1===r?i.then(f):(void 0).then(function(){(o=e())?o.then?o.then(l).then(void 0,a):l(o):ht(s,1,i)})).then(void 0,a),s;function f(t){i=t;do{if(!(o=e())||vt(o)&&!o.v)return void ht(s,1,i);if(o.then)return void o.then(l).then(void 0,a);vt(i=n())&&(i=i.v)}while(!i||!i.then);i.then(f).then(void 0,a)}function l(e){e?(i=n())&&i.then?i.then(f).then(void 0,a):f(i):ht(s,1,i)}}(function(){return t.queue.length>0},0,function(){var e=o.getInstance(),r=t.queue.shift();if(r.checkInitialized){var i=(ct.debug("Check if initialized"),dt.get().apiHost&&dt.get().environmentId&&dt.get().person&&dt.get().session&&dt.get().settings&&o.initialized?{ok:!0,value:void 0}:n({code:"not_initialized",message:"Formbricks not initialized. Call initialize() first."}));i&&!0!==i.ok&&e.handle(i.error)}return Promise.resolve(r.command.apply(null,r.commandArgs)).then(function(t){t&&(gt.debug("Command result: "+(!0===t.ok?"OK":"Something went really wrong")+", "+r.command.name),!0!==t.ok&&e.handle(t.error))})});return Promise.resolve(r&&r.then?r.then(e):e())}catch(e){return Promise.reject(e)}},e}();e.getInstance().debug("Create command queue");var wt=new _t,yt=function(e,t){wt.add(!0,it,e,t)};module.exports={init:function(e){o.init(e.errorHandler),wt.add(!1,pt,e)},setUserId:function(e){wt.add(!0,ot,e)},setEmail:function(e){yt("email",e)},setAttribute:yt,track:function(e,t){void 0===t&&(t={}),wt.add(!0,Qe,e,t)},logout:function(){wt.add(!0,st)},refresh:function(){wt.add(!0,He)},registerRouteChange:function(){wt.add(!0,Ke)}};
var e=/*#__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}();e.instance=void 0;var t=function(e){return{ok:!0,value:e}},n=function(e){return{ok:!1,error:e}};function r(e,t,n){return!0===e.ok?t(e.value):n(e.error)}e.getInstance();var o=/*#__PURE__*/function(){function t(t){this.handleError=void 0,this.handleError=t||function(t){return e.getInstance().error(JSON.stringify(t))}}return t.getInstance=function(){return t.instance||(t.instance=new t),t.instance},t.init=function(e){this.initialized=!0,console.log("🧱 Formbricks - initializing error handler"),console.log("🧱 Formbricks - Custom error handler: ","function"==typeof e?"yes":"no"),t.instance=new t(e)},t.prototype.handle=function(e){this.handleError(e)},t}();function i(){return i=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},i.apply(this,arguments)}function s(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 a(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 s(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)?s(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.")}o.instance=void 0,o.initialized=!1;var f=/*#__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=i({},this.config,e),this.saveToLocalStorage())},t.get=function(){return this.config},t.loadFromLocalStorage=function(){if("undefined"!=typeof window){var e=localStorage.getItem("formbricksConfig");if(e)return JSON.parse(e)}return{apiHost:null,environmentId:null}},t.saveToLocalStorage=function(){var e,t=this;return(e=function(){return localStorage.setItem("formbricksConfig",JSON.stringify(t.config))},function(){try{return{ok:!0,value:e.apply(void 0,[].slice.call(arguments))}}catch(e){return{ok:!1,error:e}}})()},e}();f.instance=void 0;var l,u,b,c,d,p,h,m={},g=[],v=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function _(e,t){for(var n in t)e[n]=t[n];return e}function w(e){var t=e.parentNode;t&&t.removeChild(e)}function y(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?l.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 j(e,s,r,o,null)}function j(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?++b:o};return null==o&&null!=u.vnode&&u.vnode(i),i}function x(e){return e.children}function k(e,t){this.props=e,this.context=t}function C(e,t){if(null==t)return e.__?C(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?C(e):null}function S(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 S(e)}}function N(e){(!e.__d&&(e.__d=!0)&&c.push(e)&&!I.__r++||d!==u.debounceRendering)&&((d=u.debounceRendering)||p)(I)}function I(){var e,t,n,r,o,i,s,a;for(c.sort(h);e=c.shift();)e.__d&&(t=c.length,r=void 0,o=void 0,s=(i=(n=e).__v).__e,(a=n.__P)&&(r=[],(o=_({},i)).__v=i.__v+1,M(a,i,o,n.__n,void 0!==a.ownerSVGElement,null!=i.__h?[s]:null,r,null==s?C(i):s,i.__h),A(r,i),i.__e!=s&&S(i)),c.length>t&&c.sort(h));I.__r=0}function P(e,t,n,r,o,i,s,a,f,l){var u,b,c,d,p,h,v,_=r&&r.__k||g,w=_.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?j(null,d,null,null,d):Array.isArray(d)?j(x,{children:d},null,null,null):d.__b>0?j(d.type,d.props,d.key,d.ref?d.ref:null,d.__v):d)){if(d.__=n,d.__b=n.__b+1,null===(c=_[u])||c&&d.key==c.key&&d.type===c.type)_[u]=void 0;else for(b=0;b<w;b++){if((c=_[b])&&d.key==c.key&&d.type===c.type){_[b]=void 0;break}c=null}M(e,d,c=c||m,o,i,s,a,f,l),p=d.__e,(b=d.ref)&&c.ref!=b&&(v||(v=[]),c.ref&&v.push(c.ref,null,d),v.push(b,d.__c||p,d)),null!=p?(null==h&&(h=p),"function"==typeof d.type&&d.__k===c.__k?d.__d=f=q(d,f,e):f=E(e,d,c,_,p,f),"function"==typeof n.type&&(n.__d=f)):f&&c.__e==f&&f.parentNode!=e&&(f=C(c))}for(n.__e=h,u=w;u--;)null!=_[u]&&("function"==typeof n.type&&null!=_[u].__e&&_[u].__e==n.__d&&(n.__d=H(r).nextSibling),D(_[u],_[u]));if(v)for(u=0;u<v.length;u++)U(v[u],v[++u],v[++u])}function q(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?q(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 H(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=H(n)))return r;return null}function z(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||v.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||z(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||z(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?O:L,i):e.removeEventListener(t,i?O:L,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 L(e){return this.l[e.type+!1](u.event?u.event(e):e)}function O(e){return this.l[e.type+!0](u.event?u.event(e):e)}function M(e,t,n,r,o,i,s,a,f){var l,b,c,d,p,h,m,g,v,w,y,j,C,S,N,I=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(f=n.__h,a=t.__e=n.__e,t.__h=null,i=[a]),(l=u.__b)&&l(t);try{e:if("function"==typeof I){if(g=t.props,v=(l=I.contextType)&&r[l.__c],w=l?v?v.props.value:l.__:r,n.__c?m=(b=t.__c=n.__c).__=b.__E:("prototype"in I&&I.prototype.render?t.__c=b=new I(g,w):(t.__c=b=new k(g,w),b.constructor=I,b.render=W),v&&v.sub(b),b.props=g,b.state||(b.state={}),b.context=w,b.__n=r,c=b.__d=!0,b.__h=[],b._sb=[]),null==b.__s&&(b.__s=b.state),null!=I.getDerivedStateFromProps&&(b.__s==b.state&&(b.__s=_({},b.__s)),_(b.__s,I.getDerivedStateFromProps(g,b.__s))),d=b.props,p=b.state,b.__v=t,c)null==I.getDerivedStateFromProps&&null!=b.componentWillMount&&b.componentWillMount(),null!=b.componentDidMount&&b.__h.push(b.componentDidMount);else{if(null==I.getDerivedStateFromProps&&g!==d&&null!=b.componentWillReceiveProps&&b.componentWillReceiveProps(g,w),!b.__e&&null!=b.shouldComponentUpdate&&!1===b.shouldComponentUpdate(g,b.__s,w)||t.__v===n.__v){for(t.__v!==n.__v&&(b.props=g,b.state=b.__s,b.__d=!1),b.__e=!1,t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(e){e&&(e.__=t)}),y=0;y<b._sb.length;y++)b.__h.push(b._sb[y]);b._sb=[],b.__h.length&&s.push(b);break e}null!=b.componentWillUpdate&&b.componentWillUpdate(g,b.__s,w),null!=b.componentDidUpdate&&b.__h.push(function(){b.componentDidUpdate(d,p,h)})}if(b.context=w,b.props=g,b.__P=e,j=u.__r,C=0,"prototype"in I&&I.prototype.render){for(b.state=b.__s,b.__d=!1,j&&j(t),l=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,j&&j(t),l=b.render(b.props,b.state,b.context),b.state=b.__s}while(b.__d&&++C<25);b.state=b.__s,null!=b.getChildContext&&(r=_(_({},r),b.getChildContext())),c||null==b.getSnapshotBeforeUpdate||(h=b.getSnapshotBeforeUpdate(d,p)),N=null!=l&&l.type===x&&null==l.key?l.props.children:l,P(e,Array.isArray(N)?N:[N],t,n,r,o,i,s,a,f),b.base=t.__e,t.__h=null,b.__h.length&&s.push(b),m&&(b.__E=b.__=null),b.__e=!1}else null==i&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=F(n.__e,t,n,r,o,i,s,f);(l=u.diffed)&&l(t)}catch(e){t.__v=null,(f||null!=i)&&(t.__e=a,t.__h=!!f,i[i.indexOf(a)]=null),u.__e(e,t,n)}}function A(e,t){u.__c&&u.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){u.__e(e,t.__v)}})}function F(e,t,n,r,o,i,s,a){var f,u,b,c=n.props,d=t.props,p=t.type,h=0;if("svg"===p&&(o=!0),null!=i)for(;h<i.length;h++)if((f=i[h])&&"setAttribute"in f==!!p&&(p?f.localName===p:3===f.nodeType)){e=f,i[h]=null;break}if(null==e){if(null===p)return document.createTextNode(d);e=o?document.createElementNS("http://www.w3.org/2000/svg",p):document.createElement(p,d.is&&d),i=null,a=!1}if(null===p)c===d||a&&e.data===d||(e.data=d);else{if(i=i&&l.call(e.childNodes),u=(c=n.props||m).dangerouslySetInnerHTML,b=d.dangerouslySetInnerHTML,!a){if(null!=i)for(c={},h=0;h<e.attributes.length;h++)c[e.attributes[h].name]=e.attributes[h].value;(b||u)&&(b&&(u&&b.__html==u.__html||b.__html===e.innerHTML)||(e.innerHTML=b&&b.__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,d,c,o,a),b)t.__k=[];else if(h=t.props.children,P(e,Array.isArray(h)?h:[h],t,n,r,o&&"foreignObject"!==p,i,s,i?i[0]:n.__k&&C(n,0),a),null!=i)for(h=i.length;h--;)null!=i[h]&&w(i[h]);a||("value"in d&&void 0!==(h=d.value)&&(h!==e.value||"progress"===p&&!h||"option"===p&&h!==c.value)&&T(e,"value",h,c.value,!1),"checked"in d&&void 0!==(h=d.checked)&&h!==e.checked&&T(e,"checked",h,c.checked,!1))}return e}function U(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){u.__e(e,n)}}function D(e,t,n){var r,o;if(u.unmount&&u.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){u.__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]&&D(r[o],t,n||"function"!=typeof e.type);n||null==e.__e||w(e.__e),e.__=e.__e=e.__d=void 0}function W(e,t,n){return this.constructor(e,n)}l=g.slice,u={__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}},b=0,k.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=_({},this.state),"function"==typeof e&&(e=e(_({},n),this.props)),e&&_(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),N(this))},k.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),N(this))},k.prototype.render=x,c=[],p="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,h=function(e,t){return e.__v.__b-t.__v.__b},I.__r=0;var Q,J,B,Y,R=0,V=[],G=[],X=u.__b,$=u.__r,K=u.diffed,Z=u.__c,ee=u.unmount;function te(e,t){u.__h&&u.__h(J,e,R||t),R=0;var n=J.__H||(J.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:G}),n.__[e]}function ne(e){return R=1,function(e,t,n){var r=te(Q++,2);if(r.t=e,!r.__c&&(r.__=[le(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=J,!J.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))};J.u=!0;var i=J.shouldComponentUpdate,s=J.componentWillUpdate;J.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)},J.shouldComponentUpdate=o}return r.__N||r.__}(le,e)}function re(e,t){var n=te(Q++,3);!u.__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,J.__H.__h.push(n))}function oe(){for(var e;e=V.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ae),e.__H.__h.forEach(fe),e.__H.__h=[]}catch(t){e.__H.__h=[],u.__e(t,e.__v)}}u.__b=function(e){J=null,X&&X(e)},u.__r=function(e){$&&$(e),Q=0;var t=(J=e.__c).__H;t&&(B===J?(t.__h=[],J.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.__V=G,e.__N=e.i=void 0})):(t.__h.forEach(ae),t.__h.forEach(fe),t.__h=[])),B=J},u.diffed=function(e){K&&K(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==V.push(t)&&Y===u.requestAnimationFrame||((Y=u.requestAnimationFrame)||se)(oe)),t.__H.__.forEach(function(e){e.i&&(e.__H=e.i),e.__V!==G&&(e.__=e.__V),e.i=void 0,e.__V=G})),B=J=null},u.__c=function(e,t){t.some(function(e){try{e.__h.forEach(ae),e.__h=e.__h.filter(function(e){return!e.__||fe(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],u.__e(n,e.__v)}}),Z&&Z(e,t)},u.unmount=function(e){ee&&ee(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{ae(e)}catch(e){t=e}}),n.__H=void 0,t&&u.__e(t,n.__v))};var ie="function"==typeof requestAnimationFrame;function se(e){var t,n=function(){clearTimeout(r),ie&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);ie&&(t=requestAnimationFrame(n))}function ae(e){var t=J,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),J=t}function fe(e){var t=J;e.__c=e.__(),J=t}function le(e,t){return"function"==typeof t?t(e):t}var ue=function(){return[].slice.call(arguments).filter(Boolean).join(" ")};function be(e){var t=e.children,n=e.isOpen,r=e.close,o=ne(!1),i=o[0],s=o[1];return re(function(){s(n)},[n]),y("div",{"aria-live":"assertive",className:"fb-pointer-events-none fb-fixed fb-inset-0 fb-flex fb-items-end fb-z-40"},y("div",{className:"fb-flex fb-w-full fb-flex-col fb-items-center fb-space-y-4 sm:fb-items-end"},y("div",{className:ue(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-m-4")},y("div",{class:"fb-absolute fb-top-0 fb-right-0 fb-hidden fb-pt-4 fb-pr-4 sm:fb-block"},y("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"},y("span",{class:"fb-sr-only"},"Close"),y("svg",{class:"fb-h-6 fb-w-6",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},y("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})))),y("div",{className:""},t))))}var ce=function(e,t){try{var r=t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/displays/"+e+"/responded";return Promise.resolve(fetch(r,{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(e){var t;function o(e){return t?e:{ok:!0,value:void 0}}var i=function(){if(!e.ok)return Promise.resolve(e.json()).then(function(o){var i=n({code:"network_error",message:"Could not mark display as responded",status:e.status,url:r,responseMessage:o.message});return t=1,i})}();return i&&i.then?i.then(o):o(i)})}catch(e){return Promise.reject(e)}},de=function(e,r){try{var o=r.apiHost+"/api/v1/client/environments/"+r.environmentId+"/responses";return Promise.resolve(fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){return Promise.resolve(e.json()).then(function(r){return e.ok?t(r):n({code:"network_error",message:"Could not create response",status:e.status,url:o,responseMessage:r.message})})})}catch(e){return Promise.reject(e)}};function pe(e){return y("div",{className:"fb-h-1 fb-w-full fb-rounded-full bg-slate-200"},y("div",{className:"fb-h-1 fb-rounded-full",style:{backgroundColor:e.brandColor,width:Math.floor(100*e.progress)+"%"}}))}function he(e){return y("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 me(e){return y("label",{htmlFor:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600"},e.subheader)}function ge(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return y("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)}},y(he,{headline:t.headline,questionId:t.id}),y(me,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-mt-4"},y("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"})),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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 ve(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne(null),s=i[0],a=i[1];return y("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);n(o),a(null)}},y(he,{headline:t.headline,questionId:t.id}),y(me,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-mt-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Options"),y("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e,n){return y("label",{key:e.id,className:ue(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")},y("span",{className:"fb-flex fb-items-center fb-text-sm"},y("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}),y("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne([]),s=i[0],a=i[1],f=function(){return s.length>0};return y("form",{onSubmit:function(e){var r;if(e.preventDefault(),f()||!t.required){var o=((r={})[t.id]=s,r);n(o),a([])}}},y(he,{headline:t.headline,questionId:t.id}),y(me,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-mt-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Options"),y("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e){return y("label",{key:e.id,className:ue(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")},y("span",{className:"fb-flex fb-items-center fb-text-sm"},y("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}}),y("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),y("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":""}),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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 we(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne(null),s=i[0],a=i[1];return y("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=s,r);n(o)}},y(he,{headline:t.headline,questionId:t.id}),y(me,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-my-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Options"),y("div",{className:"fb-flex"},Array.from({length:11},function(e,t){return t}).map(function(e){return y("label",{key:e,className:ue(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 first:fb-rounded-l-md last:fb-rounded-r-md hover:fb-bg-gray-100 focus:fb-outline-none")},y("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 function(e){var r;a(e),t.required&&n(((r={})[t.id]=e,r))}(e)},required:t.required}),e)})),y("div",{className:"fb-flex fb-justify-between fb-text-slate-500 fb-leading-6 fb-px-1.5 fb-text-xs"},y("p",null,t.lowerLabel),y("p",null,t.upperLabel)))),!t.required&&y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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 ye(e){function t(e,t){var n=t.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(e)||!n.includes("javascript:")&&!n.includes("data:"))||!!e.startsWith("on")||void 0}function n(e){for(var n,r=a(e.attributes);!(n=r()).done;){var o=n.value,i=o.name;t(i,o.value)&&e.removeAttribute(i)}}var r=(new DOMParser).parseFromString(e,"text/html").body||document.createElement("body");return function(e){for(var t,n=a(e.querySelectorAll("script"));!(t=n()).done;)t.value.remove()}(r),function e(t){for(var r,o=a(t.children);!(r=o()).done;){var i=r.value;n(i),e(i)}}(r),r.innerHTML}function je(e){return y("label",{htmlFor:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600",dangerouslySetInnerHTML:{__html:ye(e.htmlString)}})}function xe(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return y("div",null,y(he,{headline:t.headline,questionId:t.id}),y(je,{htmlString:t.html,questionId:t.id}),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-end"},y("div",null),!t.required&&y("button",{type:"button",onClick:function(){var e;n(((e={})[t.id]="dismissed",e))},className:"fb-flex fb-items-center dark:fb-text-slate-400 fb-rounded-md fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2 fb-mr-4"},t.dismissButtonLabel||"Skip"),y("button",{type:"button",onClick:function(){var e,r,o;t.buttonExternal&&t.buttonUrl&&(null==(r=window)||null==(o=r.open(t.buttonUrl,"_blank"))||o.focus()),n(((e={})[t.id]="clicked",e))},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 ke(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne(null),s=i[0],a=i[1];return y("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=s,r);a(null),n(o)}},y(he,{headline:t.headline,questionId:t.id}),y(me,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-my-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Choices"),y("div",{className:"fb-flex"},Array.from({length:t.range},function(e,t){return t+1}).map(function(e){return y("label",{key:e,className:ue(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 first:fb-rounded-l-md last:fb-rounded-r-md hover:fb-bg-gray-100 focus:fb-outline-none")},y("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 function(e){var r;a(e),t.required&&(n(((r={})[t.id]=e,r)),a(null))}(e)},required:t.required}),e)})),y("div",{className:"fb-flex fb-justify-between fb-text-slate-500 fb-leading-6 fb-px-1.5 fb-text-xs"},y("p",null,t.lowerLabel),y("p",null,t.upperLabel)))),!t.required&&y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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-slate-500 focus:fb-ring-offset-2",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function Ce(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return"openText"===t.type?y(ge,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceSingle"===t.type?y(ve,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceMulti"===t.type?y(_e,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"nps"===t.type?y(we,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"cta"===t.type?y(xe,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"rating"===t.type?y(ke,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):null}function Se(e){var t=e.headline,n=e.subheader;return y("div",{className:"fb-text-center"},y("div",{className:"fb-flex fb-items-center fb-justify-center",style:{color:e.brandColor}},y("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"},y("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"}))),y("span",{className:"fb-inline-block fb-rounded-[100%] fb-w-16 fb-h-1 fb-mb-[10px] fb-bg-slate-300"}),y("div",null,y(he,{headline:t,questionId:"thankYouCard",style:{"margin-right":0}}),y(me,{subheader:n,questionId:"thankYouCard"})))}function Ne(r){var o,i=r.config,s=r.survey,a=r.close,f=r.brandColor,l=r.errorHandler,u=ne(s.questions[0].id),b=u[0],c=u[1],d=ne(0),p=d[0],h=d[1],m=ne(null),g=m[0],v=m[1],_=ne(null),w=_[0],j=_[1],x=ne(!1),k=x[0],C=x[1];re(function(){!function(){try{Promise.resolve(function(e,r){try{var o=r.apiHost+"/api/v1/client/environments/"+r.environmentId+"/displays";return Promise.resolve(fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){var r;function i(n){return r?n:Promise.resolve(e.json()).then(t)}var s=function(){if(!e.ok)return Promise.resolve(e.json()).then(function(t){var i=n({code:"network_error",message:"Could not create display",status:e.status,url:o,responseMessage:t.message});return r=1,i})}();return s&&s.then?s.then(i):i(s)})}catch(e){return Promise.reject(e)}}({surveyId:s.id,personId:i.person.id},i)).then(function(e){!0===e.ok?j(e.value.id):l(e.error)})}catch(e){return Promise.reject(e)}}()},[i,s,l]),re(function(){var e;h((e=s.questions.findIndex(function(e){return e.id===b}),e/s.questions.length))},[b,s]);var S=function(r){try{var o=function(){C(!1),u?(h(100),s.thankYouCard.enabled?setTimeout(function(){a()},2e3):a()):c(s.questions[f+1].id)};C(!0);var f=s.questions.findIndex(function(e){return e.id===b}),u=f===s.questions.length-1,d={surveyId:s.id,personId:i.person.id,response:{finished:u,data:r}},p=g?Promise.resolve(function(e,r,o){try{var i=o.apiHost+"/api/v1/client/environments/"+o.environmentId+"/responses/"+r;return Promise.resolve(fetch(i,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){return Promise.resolve(e.json()).then(function(r){return e.ok?t(r):n({code:"network_error",message:"Could not update response",status:e.status,url:i,responseMessage:r.message})})})}catch(e){return Promise.reject(e)}}(d,g,i)).then(function(t){!0!==t.ok?l(t.error):d.response.finished&&e.getInstance().debug("Submitted response")}):Promise.resolve(Promise.all([de(d,i),ce(w,i)])).then(function(e){var t=e[0];!0===t.ok?v(t.value.id):l(t.error)});return Promise.resolve(p&&p.then?p.then(o):o())}catch(e){return Promise.reject(e)}};return y("div",null,y("div",{className:ue(k?"fb-animate-pulse fb-opacity-60":"","fb-text-slate-800 fb-font-sans fb-px-4 fb-py-6 sm:fb-p-6")},100===p&&s.thankYouCard.enabled?y(Se,{headline:s.thankYouCard.headline,subheader:s.thankYouCard.subheader,brandColor:null==(o=i.settings)?void 0:o.brandColor}):s.questions.map(function(e,t){return b===e.id&&y(Ce,{key:e.id,brandColor:f,lastQuestion:t===s.questions.length-1,onSubmit:S,question:e})})),y(pe,{progress:p,brandColor:f}))}function Ie(e){var t,n=e.config,r=e.survey,o=e.closeSurvey,i=e.errorHandler,s=ne(!0),a=s[1],f=function(){a(!1),setTimeout(function(){o()},1e3)};return y("div",{id:"fbjs"},y(be,{isOpen:s[0],close:f},y(Ne,{config:n,survey:r,close:f,brandColor:null==(t=n.settings)?void 0:t.brandColor,errorHandler:i})))}var Pe=e.getInstance(),qe=f.getInstance(),Ee=function(){try{var e=qe.get().apiHost+"/api/v1/client/environments/"+qe.get().environmentId+"/settings";return Promise.resolve(fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:qe.get().person.id})})).then(function(r){var o;function i(e){return o?e:Promise.resolve(r.json()).then(t)}var s=function(){if(!r.ok)return Promise.resolve(r.json()).then(function(t){var i=n({code:"network_error",status:r.status,message:"Error getting settings",url:e,responseMessage:t.message});return o=1,i})}();return s&&s.then?s.then(i):i(s)})}catch(e){return Promise.reject(e)}},He=function(){try{return Pe.debug("Refreshing - getting settings from backend"),Promise.resolve(Ee()).then(function(e){return!0!==e.ok?n(e.error):(Pe.debug("Settings refreshed"),qe.update({settings:e.value}),{ok:!0,value:void 0})})}catch(e){return Promise.reject(e)}},ze="formbricks-web-container",Te=f.getInstance(),Le=e.getInstance(),Oe=o.getInstance(),Me=!1,Ae=function(e){Me?Le.debug("A survey is already running. Skipping."):(Me=!0,function(e,t,n){var r,o;u.__&&u.__(e,t),r=t.__k,o=[],M(t,e=t.__k=y(x,null,[e]),r||m,m,void 0!==t.ownerSVGElement,r?null:t.firstChild?l.call(t.childNodes):null,o,r?r.__e:t.firstChild,!1),A(o,e)}(y(Ie,{config:Te.get(),survey:e,closeSurvey:Fe,errorHandler:Oe.handle}),document.getElementById(ze)))},Fe=function(){try{return document.getElementById(ze).remove(),Ue(),Promise.resolve(Ee()).then(function(e){r(e,function(e){Te.update({settings:e}),Me=!1},function(e){Oe.handle(e)})})}catch(e){return Promise.reject(e)}},Ue=function(){var e=document.createElement("div");e.id=ze,document.body.appendChild(e)},De=e.getInstance(),We=f.getInstance(),Qe=function(e,t){try{return Promise.resolve(fetch(We.get().apiHost+"/api/v1/client/environments/"+We.get().environmentId+"/events",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:We.get().session.id,eventName:e,properties:t})})).then(function(t){var r;function o(t){return r?t:(De.debug('Formbricks: Event "'+e+'" tracked'),Je(e),{ok:!0,value:void 0})}var i=function(){if(!t.ok)return Promise.resolve(t.json()).then(function(e){var o=n({code:"network_error",message:"Error tracking event: "+JSON.stringify(e),status:t.status,url:t.url,responseMessage:e.message});return r=1,o})}();return i&&i.then?i.then(o):o(i)})}catch(e){return Promise.reject(e)}},Je=function(e){for(var t,n=a(null==(r=We.get().settings)?void 0:r.surveys);!(t=n()).done;)for(var r,o,i=t.value,s=a(i.triggers);!(o=s()).done;){var f;if((null==(f=o.value.eventClass)?void 0:f.name)===e)return De.debug("Formbricks: survey "+i.id+' triggered by event "'+e+'"'),void Ae(i)}},Be="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function Ye(e,t,n){if(!e.s){if(n instanceof Re){if(!n.s)return void(n.o=Ye.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(Ye.bind(null,e,t),Ye.bind(null,e,2));e.s=t,e.v=n;var r=e.o;r&&r(e)}}var Re=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){var r=new e,o=this.s;if(o){var i=1&o?t:n;if(i){try{Ye(r,1,i(this.v))}catch(e){Ye(r,2,e)}return r}return this}return this.o=function(e){try{var o=e.v;1&e.s?Ye(r,1,t?t(o):o):n?Ye(r,1,n(o)):Ye(r,2,o)}catch(e){Ye(r,2,e)}},r},e}();function Ve(e){return e instanceof Re&&1&e.s}var Ge=f.getInstance(),Xe=e.getInstance(),$e=o.getInstance(),Ke=function(){try{var e,r=function(t){return e?t:{ok:!0,value:void 0}};Xe.debug("checking page url");var o=Ge.get().settings,i=null==o?void 0:o.noCodeEvents.filter(function(e){var t;return"pageUrl"===(null==(t=e.noCodeConfig)?void 0:t.type)});if(0===i.length)return Promise.resolve({ok:!0,value:void 0});var s=function(e,t,n){if("function"==typeof e[Be]){var r,o,i,s=e[Be]();if(function e(a){try{for(;!((r=s.next()).done||n&&n());)if((a=t(r.value))&&a.then){if(!Ve(a))return void a.then(e,i||(i=Ye.bind(null,o=new Re,2)));a=a.v}o?Ye(o,1,a):o=a}catch(e){Ye(o||(o=new Re),2,e)}}(),s.return){var a=function(e){try{r.done||s.return()}catch(e){}return e};if(o&&o.then)return o.then(a,function(e){throw a(e)});a()}return o}if(!("length"in e))throw new TypeError("Object is not iterable");for(var f=[],l=0;l<e.length;l++)f.push(e[l]);return function(e,t,n){var r,o,i=-1;return function s(a){try{for(;++i<e.length&&(!n||!n());)if((a=t(i))&&a.then){if(!Ve(a))return void a.then(s,o||(o=Ye.bind(null,r=new Re,2)));a=a.v}r?Ye(r,1,a):r=a}catch(e){Ye(r||(r=new Re),2,e)}}(),r}(f,function(e){return t(f[e])},n)}(i,function(r){var o=r.noCodeConfig.pageUrl;if(o){var i=function(e,r,o){var i,s;switch(o){case"exactMatch":i=e===r;break;case"contains":i=e.includes(r);break;case"startsWith":i=e.startsWith(r);break;case"endsWith":i=e.endsWith(r);break;case"notMatch":i=e!==r;break;case"notContains":i=!e.includes(r);break;default:s=n({code:"invalid_match_type",message:"Invalid match type"})}return s||t(i)}(window.location.href,o.value,o.rule);if(!0!==i.ok){var s=n(i.error);return e=1,s}if(!1!==i.value)return Promise.resolve(Qe(r.name)).then(function(t){if(!0!==t.ok){var r=n(t.error);return e=1,r}})}},function(){return e});return Promise.resolve(s&&s.then?s.then(r):r(s))}catch(e){return Promise.reject(e)}},Ze=function(e){var t=Ge.get().settings,n=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"innerHtml"===(null==(t=e.noCodeConfig)?void 0:t.type)}),o=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"cssSelector"===(null==(t=e.noCodeConfig)?void 0:t.type)}),i=e.target;n.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.innerHtml;n&&i.innerHTML===n.value&&Qe(e.name).then(function(e){r(e,function(e){},function(e){$e.handle(e)})})}),o.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.cssSelector;n&&i.matches(n.value)&&Qe(e.name).then(function(e){r(e,function(e){},function(e){$e.handle(e)})})})},et=f.getInstance(),tt=e.getInstance(),nt=function(){try{tt.debug("Creating new person");var e=et.get().apiHost+"/api/v1/client/environments/"+et.get().environmentId+"/people";return Promise.resolve(fetch(e,{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(r){return Promise.resolve(r.json()).then(function(o){return r.ok?t(o):n({code:"network_error",message:"Error creating person",status:r.status,url:e,responseMessage:o.message})})})}catch(e){return Promise.reject(e)}},rt=function(e,t){var n=et.get().person.attributes.find(function(t){var n;return(null==(n=t.attributeClass)?void 0:n.name)===e});return!(!n||n.value!==t)},ot=function(e){try{return tt.debug("setting userId: "+e),rt("userId",e)?(tt.debug("userId already set to this value. Skipping update."),Promise.resolve({ok:!0,value:void 0})):(r=et.get().person.attributes.find(function(e){var t;return"userId"===(null==(t=e.attributeClass)?void 0:t.name)}),r?Promise.resolve(n({code:"attribute_already_exists",message:"userId cannot be changed after it has been set. You need to reset first"})):Promise.resolve(function(e){try{if(!et.get().person||!et.get().person.id)return Promise.resolve(n({code:"missing_person",message:"Unable to update userId. No person set."}));var r=et.get().apiHost+"/api/v1/client/environments/"+et.get().environmentId+"/people/"+et.get().person.id+"/user-id";return Promise.resolve(fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,sessionId:et.get().session.id})})).then(function(e){return Promise.resolve(e.json()).then(function(o){return e.ok?t(o):n({code:"network_error",message:"Error updating person",status:e.status,url:r,responseMessage:o.message})})})}catch(e){return Promise.reject(e)}}(e)).then(function(e){if(!0!==e.ok)return n(e.error);var t=e.value;return et.update({person:t.person,settings:t.settings}),{ok:!0,value:void 0}}))}catch(e){return Promise.reject(e)}var r},it=function(e,o){try{return tt.debug("setting attribute: "+e+" to value: "+o),rt(e,o)?(tt.debug("attribute already set to this value. Skipping update."),Promise.resolve({ok:!0,value:void 0})):Promise.resolve(function(e,r){try{return et.get().person&&et.get().person.id?Promise.resolve(fetch(et.get().apiHost+"/api/v1/client/environments/"+et.get().environmentId+"/people/"+et.get().person.id+"/attribute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e,value:r})})).then(function(e){return Promise.resolve(e.json()).then(function(r){return e.ok?t(r):n({code:"network_error",status:e.status,message:"Error updating person",url:e.url,responseMessage:r.message})})}):Promise.resolve(n({code:"missing_person",message:"Unable to update attribute. No person set."}))}catch(e){return Promise.reject(e)}}(e,o)).then(function(e){var t;return r(e,function(e){et.update({person:e.person,settings:e.settings})},function(e){t=e}),t?n(t):{ok:!0,value:void 0}})}catch(e){return Promise.reject(e)}},st=function(){try{return tt.debug("Resetting person. Getting new person, session and settings from backend"),Promise.resolve(nt()).then(function(e){var t;return r(e,function(e){et.update({person:e.person,session:e.session,settings:e.settings})},function(e){t=e}),t?n(t):{ok:!0,value:void 0}})}catch(e){return Promise.reject(e)}},at=e.getInstance(),ft=f.getInstance(),lt=function(){try{if(!ft.get().person)return Promise.resolve(n({code:"missing_person",message:"Unable to create session. No person found"}));var e=ft.get().apiHost+"/api/v1/client/environments/"+ft.get().environmentId+"/sessions";return Promise.resolve(fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:ft.get().person.id})})).then(function(r){return Promise.resolve(r.json()).then(function(o){return r.ok?t(o):n({code:"network_error",message:"Error creating session",status:r.status,url:e,responseMessage:o.message})})})}catch(e){return Promise.reject(e)}},ut=function(e){var t=i({},e);return t.expiresAt=Date.now()+36e5,t},bt=function(e){return!e||e.expiresAt<=Date.now()},ct=f.getInstance(),dt=e.getInstance(),pt=function(e){try{var t,r=function(e){return t?e:(dt.debug("Add session event listeners"),function(){if("undefined"!=typeof window){var e=window.setInterval(function(){try{return Promise.resolve(function(){try{var e,t=function(t){return e?t:(at.debug("Session not expired, extending session"),ft.update({session:ut(ft.get().session)}),{ok:!0,value:void 0})};at.debug("Checking session");var r=function(){if(bt(ft.get().session))return at.debug("Session expired, creating new session"),Promise.resolve(lt()).then(function(t){if(!0!==t.ok){var r=n(t.error);return e=1,r}var o=t.value;return ft.update({session:o.session,settings:o.settings}),Promise.resolve(Qe("New Session")).then(function(t){if(!0!==t.ok){var r=n(t.error);return e=1,r}return e=1,{ok:!0,value:void 0}})})}();return Promise.resolve(r&&r.then?r.then(t):t(r))}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}},3e5);window.addEventListener("beforeunload",function(){clearInterval(e)})}}(),dt.debug("Add page url event listeners"),"undefined"!=typeof window&&(window.addEventListener("hashchange",Ke),window.addEventListener("popstate",Ke),window.addEventListener("pushstate",Ke),window.addEventListener("replacestate",Ke),window.addEventListener("load",Ke)),dt.debug("Add click event listeners"),"undefined"!=typeof window&&document.addEventListener("click",Ze),dt.debug("Initialized"),Ke(),{ok:!0,value:void 0})};if(dt.debug("Start initialize"),!e.environmentId)return dt.debug("No environmentId provided"),Promise.resolve(n({code:"missing_field",field:"environmentId"}));if(!e.apiHost)return dt.debug("No apiHost provided"),Promise.resolve(n({code:"missing_field",field:"apiHost"}));e.logLevel&&(dt.debug("Setting log level to "+e.logLevel),dt.configure({logLevel:e.logLevel})),dt.debug("Adding widget container to DOM"),Ue(),dt.debug("Adding styles to DOM"),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-4){margin-right:1rem}#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-end){justify-content:flex-end}#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-1){padding-left:.25rem;padding-right:.25rem}#fbjs :is(.fb-px-1\\.5){padding-left:.375rem;padding-right:.375rem}#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(.first\\:fb-rounded-l-md:first-child){border-bottom-left-radius:.375rem;border-top-left-radius:.375rem}#fbjs :is(.last\\:fb-rounded-r-md:last-child){border-bottom-right-radius:.375rem;border-top-right-radius:.375rem}#fbjs :is(.hover\\:fb-bg-gray-100:hover){--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}#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}#fbjs :is(.fb-dark .dark\\:fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}@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}}.fb-editor-text-bold{font-weight:700!important}.fb-editor-text-italic{font-style:italic!important}.fb-editor-link{color:#334155!important;text-decoration:underline!important}.editor-tokenFunction{color:#dd4a68!important}.fb-editor-paragraph{color:#334155!important;margin:0!important;position:relative!important}.fb-editor-paragraph:last-child{margin-bottom:0!important}.fb-editor-heading-h1{font-size:25px!important;font-weight:400!important}.fb-editor-heading-h1,.fb-editor-heading-h2{font-weight:700!important;margin-bottom:20px!important}.fb-editor-heading-h2{font-size:20px!important}.fb-editor-list-ol,.fb-editor-list-ul{margin-bottom:12px!important}.fb-editor-listitem{margin:0 32px!important}.fb-editor-nested-listitem{list-style-type:none!important}',document.head.appendChild(e)}}();var o=function(){if(ct.get().session&&ct.get().environmentId===e.environmentId&&ct.get().apiHost===e.apiHost){dt.debug("Found existing configuration. Checking session.");var r=ct.get().session;return function(){if(bt(r))return dt.debug("Session expired. Creating new session."),Promise.resolve(lt()).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}var o=e.value,i=o.settings;return ct.update({session:ut(o.session),settings:i}),Promise.resolve(Qe("New Session")).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}})});dt.debug("Session valid. Extending session."),ct.update({session:ut(r)})}()}return dt.debug("No valid session found. Creating new config."),ct.update({environmentId:e.environmentId,apiHost:e.apiHost}),dt.debug("Get person, session and settings from server"),Promise.resolve(nt()).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}var o=e.value,i=o.settings;return ct.update({person:o.person,session:ut(o.session),settings:i}),Promise.resolve(Qe("New Session")).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}})})}();return Promise.resolve(o&&o.then?o.then(r):r(o))}catch(e){return Promise.reject(e)}};function ht(e,t,n){if(!e.s){if(n instanceof gt){if(!n.s)return void(n.o=ht.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(ht.bind(null,e,t),ht.bind(null,e,2));e.s=t,e.v=n;var r=e.o;r&&r(e)}}var mt=e.getInstance();const gt=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){const r=new e,o=this.s;if(o){const e=1&o?t:n;if(e){try{ht(r,1,e(this.v))}catch(e){ht(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?ht(r,1,t?t(o):o):n?ht(r,1,n(o)):ht(r,2,o)}catch(e){ht(r,2,e)}},r},e}();function vt(e){return e instanceof gt&&1&e.s}var _t=/*#__PURE__*/function(){function e(){this.queue=[],this.running=!1}var t=e.prototype;return t.add=function(e,t){void 0===e&&(e=!0);var n=[].slice.call(arguments,2);mt.debug("Add command to queue: "+t.name+"("+JSON.stringify(n)+")"),this.queue.push({command:t,checkInitialized:e,commandArgs:n}),this.running||this.run()},t.run=function(){try{var e=function(){t.running=!1},t=this;t.running=!0;var r=function(e,t,n){for(var r;;){var o=e();if(vt(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!vt(i)){r=1;break}i=i.s}}var s=new gt,a=ht.bind(null,s,2);return(0===r?o.then(l):1===r?i.then(f):(void 0).then(function(){(o=e())?o.then?o.then(l).then(void 0,a):l(o):ht(s,1,i)})).then(void 0,a),s;function f(t){i=t;do{if(!(o=e())||vt(o)&&!o.v)return void ht(s,1,i);if(o.then)return void o.then(l).then(void 0,a);vt(i=n())&&(i=i.v)}while(!i||!i.then);i.then(f).then(void 0,a)}function l(e){e?(i=n())&&i.then?i.then(f).then(void 0,a):f(i):ht(s,1,i)}}(function(){return t.queue.length>0},0,function(){var e=o.getInstance(),r=t.queue.shift();if(r.checkInitialized){var i=(dt.debug("Check if initialized"),ct.get().apiHost&&ct.get().environmentId&&ct.get().person&&ct.get().session&&ct.get().settings&&o.initialized?{ok:!0,value:void 0}:n({code:"not_initialized",message:"Formbricks not initialized. Call initialize() first."}));i&&!0!==i.ok&&e.handle(i.error)}return Promise.resolve(r.command.apply(null,r.commandArgs)).then(function(t){t&&(mt.debug("Command result: "+(!0===t.ok?"OK":"Something went really wrong")+", "+r.command.name),!0!==t.ok&&e.handle(t.error))})});return Promise.resolve(r&&r.then?r.then(e):e())}catch(e){return Promise.reject(e)}},e}();e.getInstance().debug("Create command queue");var wt=new _t,yt=function(e,t){wt.add(!0,it,e,t)};module.exports={init:function(e){o.init(e.errorHandler),wt.add(!1,pt,e)},setUserId:function(e){wt.add(!0,ot,e)},setEmail:function(e){yt("email",e)},setAttribute:yt,track:function(e,t){void 0===t&&(t={}),wt.add(!0,Qe,e,t)},logout:function(){wt.add(!0,st)},refresh:function(){wt.add(!0,He)},registerRouteChange:function(){wt.add(!0,Ke)}};
//# sourceMappingURL=index.js.map

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

var e=/*#__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}();e.instance=void 0;var t=function(e){return{ok:!0,value:e}},n=function(e){return{ok:!1,error:e}};function r(e,t,n){return!0===e.ok?t(e.value):n(e.error)}e.getInstance();var o=/*#__PURE__*/function(){function t(t){this.handleError=void 0,this.handleError=t||function(t){return e.getInstance().error(JSON.stringify(t))}}return t.getInstance=function(){return t.instance||(t.instance=new t),t.instance},t.init=function(e){this.initialized=!0,console.log("🧱 Formbricks - initializing error handler"),console.log("🧱 Formbricks - Custom error handler: ","function"==typeof e?"yes":"no"),t.instance=new t(e)},t.prototype.handle=function(e){this.handleError(e)},t}();function i(){return i=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},i.apply(this,arguments)}function s(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 a(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 s(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)?s(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.")}o.instance=void 0,o.initialized=!1;var f=/*#__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=i({},this.config,e),this.saveToLocalStorage())},t.get=function(){return this.config},t.loadFromLocalStorage=function(){if("undefined"!=typeof window){var e=localStorage.getItem("formbricksConfig");if(e)return JSON.parse(e)}return{apiHost:null,environmentId:null}},t.saveToLocalStorage=function(){var e,t=this;return(e=function(){return localStorage.setItem("formbricksConfig",JSON.stringify(t.config))},function(){try{return{ok:!0,value:e.apply(void 0,[].slice.call(arguments))}}catch(e){return{ok:!1,error:e}}})()},e}();f.instance=void 0;var l,u,b,d,c,p,h,g={},m=[],v=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function _(e,t){for(var n in t)e[n]=t[n];return e}function w(e){var t=e.parentNode;t&&t.removeChild(e)}function y(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?l.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 j(e,s,r,o,null)}function j(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?++b:o};return null==o&&null!=u.vnode&&u.vnode(i),i}function x(e){return e.children}function k(e,t){this.props=e,this.context=t}function C(e,t){if(null==t)return e.__?C(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?C(e):null}function S(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 S(e)}}function N(e){(!e.__d&&(e.__d=!0)&&d.push(e)&&!I.__r++||c!==u.debounceRendering)&&((c=u.debounceRendering)||p)(I)}function I(){var e,t,n,r,o,i,s,a;for(d.sort(h);e=d.shift();)e.__d&&(t=d.length,r=void 0,o=void 0,s=(i=(n=e).__v).__e,(a=n.__P)&&(r=[],(o=_({},i)).__v=i.__v+1,M(a,i,o,n.__n,void 0!==a.ownerSVGElement,null!=i.__h?[s]:null,r,null==s?C(i):s,i.__h),A(r,i),i.__e!=s&&S(i)),d.length>t&&d.sort(h));I.__r=0}function P(e,t,n,r,o,i,s,a,f,l){var u,b,d,c,p,h,v,_=r&&r.__k||m,w=_.length;for(n.__k=[],u=0;u<t.length;u++)if(null!=(c=n.__k[u]=null==(c=t[u])||"boolean"==typeof c||"function"==typeof c?null:"string"==typeof c||"number"==typeof c||"bigint"==typeof c?j(null,c,null,null,c):Array.isArray(c)?j(x,{children:c},null,null,null):c.__b>0?j(c.type,c.props,c.key,c.ref?c.ref:null,c.__v):c)){if(c.__=n,c.__b=n.__b+1,null===(d=_[u])||d&&c.key==d.key&&c.type===d.type)_[u]=void 0;else for(b=0;b<w;b++){if((d=_[b])&&c.key==d.key&&c.type===d.type){_[b]=void 0;break}d=null}M(e,c,d=d||g,o,i,s,a,f,l),p=c.__e,(b=c.ref)&&d.ref!=b&&(v||(v=[]),d.ref&&v.push(d.ref,null,c),v.push(b,c.__c||p,c)),null!=p?(null==h&&(h=p),"function"==typeof c.type&&c.__k===d.__k?c.__d=f=q(c,f,e):f=E(e,c,d,_,p,f),"function"==typeof n.type&&(n.__d=f)):f&&d.__e==f&&f.parentNode!=e&&(f=C(d))}for(n.__e=h,u=w;u--;)null!=_[u]&&("function"==typeof n.type&&null!=_[u].__e&&_[u].__e==n.__d&&(n.__d=H(r).nextSibling),D(_[u],_[u]));if(v)for(u=0;u<v.length;u++)U(v[u],v[++u],v[++u])}function q(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?q(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 H(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=H(n)))return r;return null}function z(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||v.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||z(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||z(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?O:L,i):e.removeEventListener(t,i?O:L,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 L(e){return this.l[e.type+!1](u.event?u.event(e):e)}function O(e){return this.l[e.type+!0](u.event?u.event(e):e)}function M(e,t,n,r,o,i,s,a,f){var l,b,d,c,p,h,g,m,v,w,y,j,C,S,N,I=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(f=n.__h,a=t.__e=n.__e,t.__h=null,i=[a]),(l=u.__b)&&l(t);try{e:if("function"==typeof I){if(m=t.props,v=(l=I.contextType)&&r[l.__c],w=l?v?v.props.value:l.__:r,n.__c?g=(b=t.__c=n.__c).__=b.__E:("prototype"in I&&I.prototype.render?t.__c=b=new I(m,w):(t.__c=b=new k(m,w),b.constructor=I,b.render=W),v&&v.sub(b),b.props=m,b.state||(b.state={}),b.context=w,b.__n=r,d=b.__d=!0,b.__h=[],b._sb=[]),null==b.__s&&(b.__s=b.state),null!=I.getDerivedStateFromProps&&(b.__s==b.state&&(b.__s=_({},b.__s)),_(b.__s,I.getDerivedStateFromProps(m,b.__s))),c=b.props,p=b.state,b.__v=t,d)null==I.getDerivedStateFromProps&&null!=b.componentWillMount&&b.componentWillMount(),null!=b.componentDidMount&&b.__h.push(b.componentDidMount);else{if(null==I.getDerivedStateFromProps&&m!==c&&null!=b.componentWillReceiveProps&&b.componentWillReceiveProps(m,w),!b.__e&&null!=b.shouldComponentUpdate&&!1===b.shouldComponentUpdate(m,b.__s,w)||t.__v===n.__v){for(t.__v!==n.__v&&(b.props=m,b.state=b.__s,b.__d=!1),b.__e=!1,t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(e){e&&(e.__=t)}),y=0;y<b._sb.length;y++)b.__h.push(b._sb[y]);b._sb=[],b.__h.length&&s.push(b);break e}null!=b.componentWillUpdate&&b.componentWillUpdate(m,b.__s,w),null!=b.componentDidUpdate&&b.__h.push(function(){b.componentDidUpdate(c,p,h)})}if(b.context=w,b.props=m,b.__P=e,j=u.__r,C=0,"prototype"in I&&I.prototype.render){for(b.state=b.__s,b.__d=!1,j&&j(t),l=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,j&&j(t),l=b.render(b.props,b.state,b.context),b.state=b.__s}while(b.__d&&++C<25);b.state=b.__s,null!=b.getChildContext&&(r=_(_({},r),b.getChildContext())),d||null==b.getSnapshotBeforeUpdate||(h=b.getSnapshotBeforeUpdate(c,p)),N=null!=l&&l.type===x&&null==l.key?l.props.children:l,P(e,Array.isArray(N)?N:[N],t,n,r,o,i,s,a,f),b.base=t.__e,t.__h=null,b.__h.length&&s.push(b),g&&(b.__E=b.__=null),b.__e=!1}else null==i&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=F(n.__e,t,n,r,o,i,s,f);(l=u.diffed)&&l(t)}catch(e){t.__v=null,(f||null!=i)&&(t.__e=a,t.__h=!!f,i[i.indexOf(a)]=null),u.__e(e,t,n)}}function A(e,t){u.__c&&u.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){u.__e(e,t.__v)}})}function F(e,t,n,r,o,i,s,a){var f,u,b,d=n.props,c=t.props,p=t.type,h=0;if("svg"===p&&(o=!0),null!=i)for(;h<i.length;h++)if((f=i[h])&&"setAttribute"in f==!!p&&(p?f.localName===p:3===f.nodeType)){e=f,i[h]=null;break}if(null==e){if(null===p)return document.createTextNode(c);e=o?document.createElementNS("http://www.w3.org/2000/svg",p):document.createElement(p,c.is&&c),i=null,a=!1}if(null===p)d===c||a&&e.data===c||(e.data=c);else{if(i=i&&l.call(e.childNodes),u=(d=n.props||g).dangerouslySetInnerHTML,b=c.dangerouslySetInnerHTML,!a){if(null!=i)for(d={},h=0;h<e.attributes.length;h++)d[e.attributes[h].name]=e.attributes[h].value;(b||u)&&(b&&(u&&b.__html==u.__html||b.__html===e.innerHTML)||(e.innerHTML=b&&b.__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,c,d,o,a),b)t.__k=[];else if(h=t.props.children,P(e,Array.isArray(h)?h:[h],t,n,r,o&&"foreignObject"!==p,i,s,i?i[0]:n.__k&&C(n,0),a),null!=i)for(h=i.length;h--;)null!=i[h]&&w(i[h]);a||("value"in c&&void 0!==(h=c.value)&&(h!==e.value||"progress"===p&&!h||"option"===p&&h!==d.value)&&T(e,"value",h,d.value,!1),"checked"in c&&void 0!==(h=c.checked)&&h!==e.checked&&T(e,"checked",h,d.checked,!1))}return e}function U(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){u.__e(e,n)}}function D(e,t,n){var r,o;if(u.unmount&&u.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){u.__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]&&D(r[o],t,n||"function"!=typeof e.type);n||null==e.__e||w(e.__e),e.__=e.__e=e.__d=void 0}function W(e,t,n){return this.constructor(e,n)}l=m.slice,u={__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}},b=0,k.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=_({},this.state),"function"==typeof e&&(e=e(_({},n),this.props)),e&&_(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),N(this))},k.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),N(this))},k.prototype.render=x,d=[],p="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,h=function(e,t){return e.__v.__b-t.__v.__b},I.__r=0;var Q,J,B,Y,R=0,V=[],G=[],X=u.__b,$=u.__r,K=u.diffed,Z=u.__c,ee=u.unmount;function te(e,t){u.__h&&u.__h(J,e,R||t),R=0;var n=J.__H||(J.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:G}),n.__[e]}function ne(e){return R=1,function(e,t,n){var r=te(Q++,2);if(r.t=e,!r.__c&&(r.__=[le(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=J,!J.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))};J.u=!0;var i=J.shouldComponentUpdate,s=J.componentWillUpdate;J.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)},J.shouldComponentUpdate=o}return r.__N||r.__}(le,e)}function re(e,t){var n=te(Q++,3);!u.__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,J.__H.__h.push(n))}function oe(){for(var e;e=V.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ae),e.__H.__h.forEach(fe),e.__H.__h=[]}catch(t){e.__H.__h=[],u.__e(t,e.__v)}}u.__b=function(e){J=null,X&&X(e)},u.__r=function(e){$&&$(e),Q=0;var t=(J=e.__c).__H;t&&(B===J?(t.__h=[],J.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.__V=G,e.__N=e.i=void 0})):(t.__h.forEach(ae),t.__h.forEach(fe),t.__h=[])),B=J},u.diffed=function(e){K&&K(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==V.push(t)&&Y===u.requestAnimationFrame||((Y=u.requestAnimationFrame)||se)(oe)),t.__H.__.forEach(function(e){e.i&&(e.__H=e.i),e.__V!==G&&(e.__=e.__V),e.i=void 0,e.__V=G})),B=J=null},u.__c=function(e,t){t.some(function(e){try{e.__h.forEach(ae),e.__h=e.__h.filter(function(e){return!e.__||fe(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],u.__e(n,e.__v)}}),Z&&Z(e,t)},u.unmount=function(e){ee&&ee(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{ae(e)}catch(e){t=e}}),n.__H=void 0,t&&u.__e(t,n.__v))};var ie="function"==typeof requestAnimationFrame;function se(e){var t,n=function(){clearTimeout(r),ie&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);ie&&(t=requestAnimationFrame(n))}function ae(e){var t=J,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),J=t}function fe(e){var t=J;e.__c=e.__(),J=t}function le(e,t){return"function"==typeof t?t(e):t}var ue=function(){return[].slice.call(arguments).filter(Boolean).join(" ")};function be(e){var t=e.children,n=e.isOpen,r=e.close,o=ne(!1),i=o[0],s=o[1];return re(function(){s(n)},[n]),y("div",{"aria-live":"assertive",className:"fb-pointer-events-none fb-fixed fb-inset-0 fb-flex fb-items-end fb-z-40"},y("div",{className:"fb-flex fb-w-full fb-flex-col fb-items-center fb-space-y-4 sm:fb-items-end"},y("div",{className:ue(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-m-4")},y("div",{class:"fb-absolute fb-top-0 fb-right-0 fb-hidden fb-pt-4 fb-pr-4 sm:fb-block"},y("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"},y("span",{class:"fb-sr-only"},"Close"),y("svg",{class:"fb-h-6 fb-w-6",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},y("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})))),y("div",{className:""},t))))}var de=function(e,t){try{var r=t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/displays/"+e+"/responded";return Promise.resolve(fetch(r,{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(e){var t;function o(e){return t?e:{ok:!0,value:void 0}}var i=function(){if(!e.ok)return Promise.resolve(e.json()).then(function(o){var i=n({code:"network_error",message:"Could not mark display as responded",status:e.status,url:r,responseMessage:o.message});return t=1,i})}();return i&&i.then?i.then(o):o(i)})}catch(e){return Promise.reject(e)}},ce=function(e,r){try{var o=r.apiHost+"/api/v1/client/environments/"+r.environmentId+"/responses";return Promise.resolve(fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){return Promise.resolve(e.json()).then(function(r){return e.ok?t(r):n({code:"network_error",message:"Could not create response",status:e.status,url:o,responseMessage:r.message})})})}catch(e){return Promise.reject(e)}};function pe(e){return y("div",{className:"fb-h-1 fb-w-full fb-rounded-full bg-slate-200"},y("div",{className:"fb-h-1 fb-rounded-full",style:{backgroundColor:e.brandColor,width:Math.floor(100*e.progress)+"%"}}))}function he(e){return y("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 ge(e){return y("label",{htmlFor:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600"},e.subheader)}function me(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return y("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)}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-mt-4"},y("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"})),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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 ve(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne(null),s=i[0],a=i[1];return y("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);n(o),a(null)}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-mt-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Options"),y("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e,n){return y("label",{key:e.id,className:ue(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")},y("span",{className:"fb-flex fb-items-center fb-text-sm"},y("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}),y("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne([]),s=i[0],a=i[1],f=function(){return s.length>0};return y("form",{onSubmit:function(e){var r;if(e.preventDefault(),f()||!t.required){var o=((r={})[t.id]=s,r);n(o),a([])}}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-mt-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Options"),y("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e){return y("label",{key:e.id,className:ue(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")},y("span",{className:"fb-flex fb-items-center fb-text-sm"},y("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}}),y("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),y("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":""}),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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 we(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne(null),s=i[0],a=i[1];return y("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=s,r);n(o)}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-my-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Options"),y("div",{className:"fb-flex"},Array.from({length:11},function(e,t){return t}).map(function(e){return y("label",{key:e,className:ue(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 first:fb-rounded-l-md last:fb-rounded-r-md hover:fb-bg-gray-100 focus:fb-outline-none")},y("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 function(e){var r;a(e),t.required&&n(((r={})[t.id]=e,r))}(e)},required:t.required}),e)})),y("div",{className:"fb-flex fb-justify-between fb-text-slate-500 fb-leading-6 fb-px-1.5 fb-text-xs"},y("p",null,t.lowerLabel),y("p",null,t.upperLabel)))),!t.required&&y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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 ye(e){function t(e,t){var n=t.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(e)||!n.includes("javascript:")&&!n.includes("data:"))||!!e.startsWith("on")||void 0}function n(e){for(var n,r=a(e.attributes);!(n=r()).done;){var o=n.value,i=o.name;t(i,o.value)&&e.removeAttribute(i)}}var r=(new DOMParser).parseFromString(e,"text/html").body||document.createElement("body");return function(e){for(var t,n=a(e.querySelectorAll("script"));!(t=n()).done;)t.value.remove()}(r),function e(t){for(var r,o=a(t.children);!(r=o()).done;){var i=r.value;n(i),e(i)}}(r),r.innerHTML}function je(e){return y("label",{htmlFor:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600",dangerouslySetInnerHTML:{__html:ye(e.htmlString)}})}function xe(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return y("div",null,y(he,{headline:t.headline,questionId:t.id}),y(je,{htmlString:t.html,questionId:t.id}),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-end"},y("div",null),!t.required&&y("button",{type:"button",onClick:function(){var e;n(((e={})[t.id]="dismissed",e))},className:"fb-flex fb-items-center dark:fb-text-slate-400 fb-rounded-md fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2 fb-mr-4"},t.dismissButtonLabel||"Skip"),y("button",{type:"button",onClick:function(){var e,r,o;t.buttonExternal&&t.buttonUrl&&(null==(r=window)||null==(o=r.open(t.buttonUrl,"_blank"))||o.focus()),n(((e={})[t.id]="clicked",e))},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 ke(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne(null),s=i[0],a=i[1];return y("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=s,r);a(null),n(o)}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-my-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Choices"),y("div",{className:"fb-flex"},Array.from({length:t.range},function(e,t){return t+1}).map(function(e){return y("label",{key:e,className:ue(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 first:fb-rounded-l-md last:fb-rounded-r-md hover:fb-bg-gray-100 focus:fb-outline-none")},y("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 function(e){var r;a(e),t.required&&(n(((r={})[t.id]=e,r)),a(null))}(e)},required:t.required}),e)})),y("div",{className:"fb-flex fb-justify-between fb-text-slate-500 fb-leading-6 fb-px-1.5 fb-text-xs"},y("p",null,t.lowerLabel),y("p",null,t.upperLabel)))),!t.required&&y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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-slate-500 focus:fb-ring-offset-2",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function Ce(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return"openText"===t.type?y(me,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceSingle"===t.type?y(ve,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceMulti"===t.type?y(_e,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"nps"===t.type?y(we,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"cta"===t.type?y(xe,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"rating"===t.type?y(ke,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):null}function Se(e){var t=e.headline,n=e.subheader;return y("div",{className:"fb-text-center"},y("div",{className:"fb-flex fb-items-center fb-justify-center",style:{color:e.brandColor}},y("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"},y("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"}))),y("span",{className:"fb-inline-block fb-rounded-[100%] fb-w-16 fb-h-1 fb-mb-[10px] fb-bg-slate-300"}),y("div",null,y(he,{headline:t,questionId:"thankYouCard",style:{"margin-right":0}}),y(ge,{subheader:n,questionId:"thankYouCard"})))}function Ne(r){var o,i=r.config,s=r.survey,a=r.close,f=r.brandColor,l=r.errorHandler,u=ne(s.questions[0].id),b=u[0],d=u[1],c=ne(0),p=c[0],h=c[1],g=ne(null),m=g[0],v=g[1],_=ne(null),w=_[0],j=_[1],x=ne(!1),k=x[0],C=x[1];re(function(){!function(){try{Promise.resolve(function(e,r){try{var o=r.apiHost+"/api/v1/client/environments/"+r.environmentId+"/displays";return Promise.resolve(fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){var r;function i(n){return r?n:Promise.resolve(e.json()).then(t)}var s=function(){if(!e.ok)return Promise.resolve(e.json()).then(function(t){var i=n({code:"network_error",message:"Could not create display",status:e.status,url:o,responseMessage:t.message});return r=1,i})}();return s&&s.then?s.then(i):i(s)})}catch(e){return Promise.reject(e)}}({surveyId:s.id,personId:i.person.id},i)).then(function(e){!0===e.ok?j(e.value.id):l(e.error)})}catch(e){return Promise.reject(e)}}()},[i,s,l]),re(function(){var e;h((e=s.questions.findIndex(function(e){return e.id===b}),e/s.questions.length))},[b,s]);var S=function(r){try{var o=function(){C(!1),u?(h(100),s.thankYouCard.enabled?setTimeout(function(){a()},2e3):a()):d(s.questions[f+1].id)};C(!0);var f=s.questions.findIndex(function(e){return e.id===b}),u=f===s.questions.length-1,c={surveyId:s.id,personId:i.person.id,response:{finished:u,data:r}},p=m?Promise.resolve(function(e,r,o){try{var i=o.apiHost+"/api/v1/client/environments/"+o.environmentId+"/responses/"+r;return Promise.resolve(fetch(i,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){return Promise.resolve(e.json()).then(function(r){return e.ok?t(r):n({code:"network_error",message:"Could not update response",status:e.status,url:i,responseMessage:r.message})})})}catch(e){return Promise.reject(e)}}(c,m,i)).then(function(t){!0!==t.ok?l(t.error):c.response.finished&&e.getInstance().debug("Submitted response")}):Promise.resolve(Promise.all([ce(c,i),de(w,i)])).then(function(e){var t=e[0];!0===t.ok?v(t.value.id):l(t.error)});return Promise.resolve(p&&p.then?p.then(o):o())}catch(e){return Promise.reject(e)}};return y("div",null,y("div",{className:ue(k?"fb-animate-pulse fb-opacity-60":"","fb-text-slate-800 fb-font-sans fb-px-4 fb-py-6 sm:fb-p-6")},100===p&&s.thankYouCard.enabled?y(Se,{headline:s.thankYouCard.headline,subheader:s.thankYouCard.subheader,brandColor:null==(o=i.settings)?void 0:o.brandColor}):s.questions.map(function(e,t){return b===e.id&&y(Ce,{key:e.id,brandColor:f,lastQuestion:t===s.questions.length-1,onSubmit:S,question:e})})),y(pe,{progress:p,brandColor:f}))}function Ie(e){var t,n=e.config,r=e.survey,o=e.closeSurvey,i=e.errorHandler,s=ne(!0),a=s[1],f=function(){a(!1),setTimeout(function(){o()},1e3)};return y("div",{id:"fbjs"},y(be,{isOpen:s[0],close:f},y(Ne,{config:n,survey:r,close:f,brandColor:null==(t=n.settings)?void 0:t.brandColor,errorHandler:i})))}var Pe=e.getInstance(),qe=f.getInstance(),Ee=function(){try{var e=qe.get().apiHost+"/api/v1/client/environments/"+qe.get().environmentId+"/settings";return Promise.resolve(fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:qe.get().person.id})})).then(function(r){var o;function i(e){return o?e:Promise.resolve(r.json()).then(t)}var s=function(){if(!r.ok)return Promise.resolve(r.json()).then(function(t){var i=n({code:"network_error",status:r.status,message:"Error getting settings",url:e,responseMessage:t.message});return o=1,i})}();return s&&s.then?s.then(i):i(s)})}catch(e){return Promise.reject(e)}},He=function(){try{return Pe.debug("Refreshing - getting settings from backend"),Promise.resolve(Ee()).then(function(e){return!0!==e.ok?n(e.error):(Pe.debug("Settings refreshed"),qe.update({settings:e.value}),{ok:!0,value:void 0})})}catch(e){return Promise.reject(e)}},ze="formbricks-web-container",Te=f.getInstance(),Le=e.getInstance(),Oe=o.getInstance(),Me=!1,Ae=function(e){Me?Le.debug("A survey is already running. Skipping."):(Me=!0,function(e,t,n){var r,o;u.__&&u.__(e,t),r=t.__k,o=[],M(t,e=t.__k=y(x,null,[e]),r||g,g,void 0!==t.ownerSVGElement,r?null:t.firstChild?l.call(t.childNodes):null,o,r?r.__e:t.firstChild,!1),A(o,e)}(y(Ie,{config:Te.get(),survey:e,closeSurvey:Fe,errorHandler:Oe.handle}),document.getElementById(ze)))},Fe=function(){try{return document.getElementById(ze).remove(),Ue(),Promise.resolve(Ee()).then(function(e){r(e,function(e){Te.update({settings:e}),Me=!1},function(e){Oe.handle(e)})})}catch(e){return Promise.reject(e)}},Ue=function(){var e=document.createElement("div");e.id=ze,document.body.appendChild(e)},De=e.getInstance(),We=f.getInstance(),Qe=function(e,t){try{return Promise.resolve(fetch(We.get().apiHost+"/api/v1/client/environments/"+We.get().environmentId+"/events",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:We.get().session.id,eventName:e,properties:t})})).then(function(t){var r;function o(t){return r?t:(De.debug('Formbricks: Event "'+e+'" tracked'),Je(e),{ok:!0,value:void 0})}var i=function(){if(!t.ok)return Promise.resolve(t.json()).then(function(e){var o=n({code:"network_error",message:"Error tracking event: "+JSON.stringify(e),status:t.status,url:t.url,responseMessage:e.message});return r=1,o})}();return i&&i.then?i.then(o):o(i)})}catch(e){return Promise.reject(e)}},Je=function(e){for(var t,n=a(null==(r=We.get().settings)?void 0:r.surveys);!(t=n()).done;)for(var r,o,i=t.value,s=a(i.triggers);!(o=s()).done;){var f;if((null==(f=o.value.eventClass)?void 0:f.name)===e)return De.debug("Formbricks: survey "+i.id+' triggered by event "'+e+'"'),void Ae(i)}},Be="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function Ye(e,t,n){if(!e.s){if(n instanceof Re){if(!n.s)return void(n.o=Ye.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(Ye.bind(null,e,t),Ye.bind(null,e,2));e.s=t,e.v=n;var r=e.o;r&&r(e)}}var Re=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){var r=new e,o=this.s;if(o){var i=1&o?t:n;if(i){try{Ye(r,1,i(this.v))}catch(e){Ye(r,2,e)}return r}return this}return this.o=function(e){try{var o=e.v;1&e.s?Ye(r,1,t?t(o):o):n?Ye(r,1,n(o)):Ye(r,2,o)}catch(e){Ye(r,2,e)}},r},e}();function Ve(e){return e instanceof Re&&1&e.s}var Ge=f.getInstance(),Xe=e.getInstance(),$e=o.getInstance(),Ke=function(){try{var e,r=function(t){return e?t:{ok:!0,value:void 0}};Xe.debug("checking page url");var o=Ge.get().settings,i=null==o?void 0:o.noCodeEvents.filter(function(e){var t;return"pageUrl"===(null==(t=e.noCodeConfig)?void 0:t.type)});if(0===i.length)return Promise.resolve({ok:!0,value:void 0});var s=function(e,t,n){if("function"==typeof e[Be]){var r,o,i,s=e[Be]();if(function e(a){try{for(;!((r=s.next()).done||n&&n());)if((a=t(r.value))&&a.then){if(!Ve(a))return void a.then(e,i||(i=Ye.bind(null,o=new Re,2)));a=a.v}o?Ye(o,1,a):o=a}catch(e){Ye(o||(o=new Re),2,e)}}(),s.return){var a=function(e){try{r.done||s.return()}catch(e){}return e};if(o&&o.then)return o.then(a,function(e){throw a(e)});a()}return o}if(!("length"in e))throw new TypeError("Object is not iterable");for(var f=[],l=0;l<e.length;l++)f.push(e[l]);return function(e,t,n){var r,o,i=-1;return function s(a){try{for(;++i<e.length&&(!n||!n());)if((a=t(i))&&a.then){if(!Ve(a))return void a.then(s,o||(o=Ye.bind(null,r=new Re,2)));a=a.v}r?Ye(r,1,a):r=a}catch(e){Ye(r||(r=new Re),2,e)}}(),r}(f,function(e){return t(f[e])},n)}(i,function(r){var o=r.noCodeConfig.pageUrl;if(o){var i=function(e,r,o){var i,s;switch(o){case"exactMatch":i=e===r;break;case"contains":i=e.includes(r);break;case"startsWith":i=e.startsWith(r);break;case"endsWith":i=e.endsWith(r);break;case"notMatch":i=e!==r;break;case"notContains":i=!e.includes(r);break;default:s=n({code:"invalid_match_type",message:"Invalid match type"})}return s||t(i)}(window.location.href,o.value,o.rule);if(!0!==i.ok){var s=n(i.error);return e=1,s}if(!1!==i.value)return Promise.resolve(Qe(r.name)).then(function(t){if(!0!==t.ok){var r=n(t.error);return e=1,r}})}},function(){return e});return Promise.resolve(s&&s.then?s.then(r):r(s))}catch(e){return Promise.reject(e)}},Ze=function(e){var t=Ge.get().settings,n=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"innerHtml"===(null==(t=e.noCodeConfig)?void 0:t.type)}),o=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"cssSelector"===(null==(t=e.noCodeConfig)?void 0:t.type)}),i=e.target;n.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.innerHtml;n&&i.innerHTML===n.value&&Qe(e.name).then(function(e){r(e,function(e){},function(e){$e.handle(e)})})}),o.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.cssSelector;n&&i.matches(n.value)&&Qe(e.name).then(function(e){r(e,function(e){},function(e){$e.handle(e)})})})},et=f.getInstance(),tt=e.getInstance(),nt=function(){try{tt.debug("Creating new person");var e=et.get().apiHost+"/api/v1/client/environments/"+et.get().environmentId+"/people";return Promise.resolve(fetch(e,{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(r){return Promise.resolve(r.json()).then(function(o){return r.ok?t(o):n({code:"network_error",message:"Error creating person",status:r.status,url:e,responseMessage:o.message})})})}catch(e){return Promise.reject(e)}},rt=function(e,t){var n=et.get().person.attributes.find(function(t){var n;return(null==(n=t.attributeClass)?void 0:n.name)===e});return!(!n||n.value!==t)},ot=function(e){try{return tt.debug("setting userId: "+e),rt("userId",e)?(tt.debug("userId already set to this value. Skipping update."),Promise.resolve({ok:!0,value:void 0})):(r=et.get().person.attributes.find(function(e){var t;return"userId"===(null==(t=e.attributeClass)?void 0:t.name)}),r?Promise.resolve(n({code:"attribute_already_exists",message:"userId cannot be changed after it has been set. You need to reset first"})):Promise.resolve(function(e){try{if(!et.get().person||!et.get().person.id)return Promise.resolve(n({code:"missing_person",message:"Unable to update userId. No person set."}));var r=et.get().apiHost+"/api/v1/client/environments/"+et.get().environmentId+"/people/"+et.get().person.id+"/user-id";return Promise.resolve(fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,sessionId:et.get().session.id})})).then(function(e){return Promise.resolve(e.json()).then(function(o){return e.ok?t(o):n({code:"network_error",message:"Error updating person",status:e.status,url:r,responseMessage:o.message})})})}catch(e){return Promise.reject(e)}}(e)).then(function(e){if(!0!==e.ok)return n(e.error);var t=e.value;return et.update({person:t.person,settings:t.settings}),{ok:!0,value:void 0}}))}catch(e){return Promise.reject(e)}var r},it=function(e,o){try{return tt.debug("setting attribute: "+e+" to value: "+o),rt(e,o)?(tt.debug("attribute already set to this value. Skipping update."),Promise.resolve({ok:!0,value:void 0})):Promise.resolve(function(e,r){try{return et.get().person&&et.get().person.id?Promise.resolve(fetch(et.get().apiHost+"/api/v1/client/environments/"+et.get().environmentId+"/people/"+et.get().person.id+"/attribute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e,value:r})})).then(function(e){return Promise.resolve(e.json()).then(function(r){return e.ok?t(r):n({code:"network_error",status:e.status,message:"Error updating person",url:e.url,responseMessage:r.message})})}):Promise.resolve(n({code:"missing_person",message:"Unable to update attribute. No person set."}))}catch(e){return Promise.reject(e)}}(e,o)).then(function(e){var t;return r(e,function(e){et.update({person:e.person,settings:e.settings})},function(e){t=e}),t?n(t):{ok:!0,value:void 0}})}catch(e){return Promise.reject(e)}},st=function(){try{return tt.debug("Resetting person. Getting new person, session and settings from backend"),Promise.resolve(nt()).then(function(e){var t;return r(e,function(e){et.update({person:e.person,session:e.session,settings:e.settings})},function(e){t=e}),t?n(t):{ok:!0,value:void 0}})}catch(e){return Promise.reject(e)}},at=e.getInstance(),ft=f.getInstance(),lt=function(){try{if(!ft.get().person)return Promise.resolve(n({code:"missing_person",message:"Unable to create session. No person found"}));var e=ft.get().apiHost+"/api/v1/client/environments/"+ft.get().environmentId+"/sessions";return Promise.resolve(fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:ft.get().person.id})})).then(function(r){return Promise.resolve(r.json()).then(function(o){return r.ok?t(o):n({code:"network_error",message:"Error creating session",status:r.status,url:e,responseMessage:o.message})})})}catch(e){return Promise.reject(e)}},ut=function(e){var t=i({},e);return t.expiresAt=Date.now()+36e5,t},bt=function(e){return!e||e.expiresAt<=Date.now()},dt=f.getInstance(),ct=e.getInstance(),pt=function(e){try{var t,r=function(e){return t?e:(ct.debug("Add session event listeners"),function(){if("undefined"!=typeof window){var e=window.setInterval(function(){try{return Promise.resolve(function(){try{var e,t=function(t){return e?t:(at.debug("Session not expired, extending session"),ft.update({session:ut(ft.get().session)}),{ok:!0,value:void 0})};at.debug("Checking session");var r=function(){if(bt(ft.get().session))return at.debug("Session expired, creating new session"),Promise.resolve(lt()).then(function(t){if(!0!==t.ok){var r=n(t.error);return e=1,r}var o=t.value;return ft.update({session:o.session,settings:o.settings}),Promise.resolve(Qe("New Session")).then(function(t){if(!0!==t.ok){var r=n(t.error);return e=1,r}return e=1,{ok:!0,value:void 0}})})}();return Promise.resolve(r&&r.then?r.then(t):t(r))}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}},3e5);window.addEventListener("beforeunload",function(){clearInterval(e)})}}(),ct.debug("Add page url event listeners"),"undefined"!=typeof window&&(window.addEventListener("hashchange",Ke),window.addEventListener("popstate",Ke),window.addEventListener("pushstate",Ke),window.addEventListener("replacestate",Ke),window.addEventListener("load",Ke)),ct.debug("Add click event listeners"),"undefined"!=typeof window&&document.addEventListener("click",Ze),ct.debug("Initialized"),Ke(),{ok:!0,value:void 0})};if(ct.debug("Start initialize"),!e.environmentId)return ct.debug("No environmentId provided"),Promise.resolve(n({code:"missing_field",field:"environmentId"}));if(!e.apiHost)return ct.debug("No apiHost provided"),Promise.resolve(n({code:"missing_field",field:"apiHost"}));e.logLevel&&(ct.debug("Setting log level to "+e.logLevel),ct.configure({logLevel:e.logLevel})),ct.debug("Adding widget container to DOM"),Ue(),ct.debug("Adding styles to DOM"),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-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--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-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--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-4){margin-right:1rem}#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-end){justify-content:flex-end}#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-1){padding-left:.25rem;padding-right:.25rem}#fbjs :is(.fb-px-1\\.5){padding-left:.375rem;padding-right:.375rem}#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(.first\\:fb-rounded-l-md:first-child){border-bottom-left-radius:.375rem;border-top-left-radius:.375rem}#fbjs :is(.last\\:fb-rounded-r-md:last-child){border-bottom-right-radius:.375rem;border-top-right-radius:.375rem}#fbjs :is(.hover\\:fb-bg-gray-100:hover){--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}#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}#fbjs :is(.fb-dark .dark\\:fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}@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}}.fb-editor-text-bold{font-weight:700!important}.fb-editor-text-italic{font-style:italic!important}.fb-editor-link{color:#334155!important;text-decoration:underline!important}.editor-tokenFunction{color:#dd4a68!important}.fb-editor-paragraph{color:#334155!important;margin:0!important;position:relative!important}.fb-editor-paragraph:last-child{margin-bottom:0!important}.fb-editor-heading-h1{font-size:25px!important;font-weight:400!important}.fb-editor-heading-h1,.fb-editor-heading-h2{font-weight:700!important;margin-bottom:20px!important}.fb-editor-heading-h2{font-size:20px!important}.fb-editor-list-ol,.fb-editor-list-ul{margin-bottom:12px!important}.fb-editor-listitem{margin:0 32px!important}.fb-editor-nested-listitem{list-style-type:none!important}',document.head.appendChild(e)}}();var o=function(){if(dt.get().session&&dt.get().environmentId===e.environmentId&&dt.get().apiHost===e.apiHost){ct.debug("Found existing configuration. Checking session.");var r=dt.get().session;return function(){if(bt(r))return ct.debug("Session expired. Creating new session."),Promise.resolve(lt()).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}var o=e.value,i=o.settings;return dt.update({session:ut(o.session),settings:i}),Promise.resolve(Qe("New Session")).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}})});ct.debug("Session valid. Extending session."),dt.update({session:ut(r)})}()}return ct.debug("No valid session found. Creating new config."),dt.update({environmentId:e.environmentId,apiHost:e.apiHost}),ct.debug("Get person, session and settings from server"),Promise.resolve(nt()).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}var o=e.value,i=o.settings;return dt.update({person:o.person,session:ut(o.session),settings:i}),Promise.resolve(Qe("New Session")).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}})})}();return Promise.resolve(o&&o.then?o.then(r):r(o))}catch(e){return Promise.reject(e)}};function ht(e,t,n){if(!e.s){if(n instanceof mt){if(!n.s)return void(n.o=ht.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(ht.bind(null,e,t),ht.bind(null,e,2));e.s=t,e.v=n;var r=e.o;r&&r(e)}}var gt=e.getInstance();const mt=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){const r=new e,o=this.s;if(o){const e=1&o?t:n;if(e){try{ht(r,1,e(this.v))}catch(e){ht(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?ht(r,1,t?t(o):o):n?ht(r,1,n(o)):ht(r,2,o)}catch(e){ht(r,2,e)}},r},e}();function vt(e){return e instanceof mt&&1&e.s}var _t=/*#__PURE__*/function(){function e(){this.queue=[],this.running=!1}var t=e.prototype;return t.add=function(e,t){void 0===e&&(e=!0);var n=[].slice.call(arguments,2);gt.debug("Add command to queue: "+t.name+"("+JSON.stringify(n)+")"),this.queue.push({command:t,checkInitialized:e,commandArgs:n}),this.running||this.run()},t.run=function(){try{var e=function(){t.running=!1},t=this;t.running=!0;var r=function(e,t,n){for(var r;;){var o=e();if(vt(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!vt(i)){r=1;break}i=i.s}}var s=new mt,a=ht.bind(null,s,2);return(0===r?o.then(l):1===r?i.then(f):(void 0).then(function(){(o=e())?o.then?o.then(l).then(void 0,a):l(o):ht(s,1,i)})).then(void 0,a),s;function f(t){i=t;do{if(!(o=e())||vt(o)&&!o.v)return void ht(s,1,i);if(o.then)return void o.then(l).then(void 0,a);vt(i=n())&&(i=i.v)}while(!i||!i.then);i.then(f).then(void 0,a)}function l(e){e?(i=n())&&i.then?i.then(f).then(void 0,a):f(i):ht(s,1,i)}}(function(){return t.queue.length>0},0,function(){var e=o.getInstance(),r=t.queue.shift();if(r.checkInitialized){var i=(ct.debug("Check if initialized"),dt.get().apiHost&&dt.get().environmentId&&dt.get().person&&dt.get().session&&dt.get().settings&&o.initialized?{ok:!0,value:void 0}:n({code:"not_initialized",message:"Formbricks not initialized. Call initialize() first."}));i&&!0!==i.ok&&e.handle(i.error)}return Promise.resolve(r.command.apply(null,r.commandArgs)).then(function(t){t&&(gt.debug("Command result: "+(!0===t.ok?"OK":"Something went really wrong")+", "+r.command.name),!0!==t.ok&&e.handle(t.error))})});return Promise.resolve(r&&r.then?r.then(e):e())}catch(e){return Promise.reject(e)}},e}();e.getInstance().debug("Create command queue");var wt=new _t,yt=function(e,t){wt.add(!0,it,e,t)},jt={init:function(e){o.init(e.errorHandler),wt.add(!1,pt,e)},setUserId:function(e){wt.add(!0,ot,e)},setEmail:function(e){yt("email",e)},setAttribute:yt,track:function(e,t){void 0===t&&(t={}),wt.add(!0,Qe,e,t)},logout:function(){wt.add(!0,st)},refresh:function(){wt.add(!0,He)},registerRouteChange:function(){wt.add(!0,Ke)}};export{jt as default};
var e=/*#__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}();e.instance=void 0;var t=function(e){return{ok:!0,value:e}},n=function(e){return{ok:!1,error:e}};function r(e,t,n){return!0===e.ok?t(e.value):n(e.error)}e.getInstance();var o=/*#__PURE__*/function(){function t(t){this.handleError=void 0,this.handleError=t||function(t){return e.getInstance().error(JSON.stringify(t))}}return t.getInstance=function(){return t.instance||(t.instance=new t),t.instance},t.init=function(e){this.initialized=!0,console.log("🧱 Formbricks - initializing error handler"),console.log("🧱 Formbricks - Custom error handler: ","function"==typeof e?"yes":"no"),t.instance=new t(e)},t.prototype.handle=function(e){this.handleError(e)},t}();function i(){return i=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},i.apply(this,arguments)}function s(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 a(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 s(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)?s(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.")}o.instance=void 0,o.initialized=!1;var f=/*#__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=i({},this.config,e),this.saveToLocalStorage())},t.get=function(){return this.config},t.loadFromLocalStorage=function(){if("undefined"!=typeof window){var e=localStorage.getItem("formbricksConfig");if(e)return JSON.parse(e)}return{apiHost:null,environmentId:null}},t.saveToLocalStorage=function(){var e,t=this;return(e=function(){return localStorage.setItem("formbricksConfig",JSON.stringify(t.config))},function(){try{return{ok:!0,value:e.apply(void 0,[].slice.call(arguments))}}catch(e){return{ok:!1,error:e}}})()},e}();f.instance=void 0;var l,u,b,c,d,p,h,g={},m=[],v=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function _(e,t){for(var n in t)e[n]=t[n];return e}function w(e){var t=e.parentNode;t&&t.removeChild(e)}function y(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?l.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 j(e,s,r,o,null)}function j(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?++b:o};return null==o&&null!=u.vnode&&u.vnode(i),i}function x(e){return e.children}function k(e,t){this.props=e,this.context=t}function C(e,t){if(null==t)return e.__?C(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?C(e):null}function S(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 S(e)}}function N(e){(!e.__d&&(e.__d=!0)&&c.push(e)&&!I.__r++||d!==u.debounceRendering)&&((d=u.debounceRendering)||p)(I)}function I(){var e,t,n,r,o,i,s,a;for(c.sort(h);e=c.shift();)e.__d&&(t=c.length,r=void 0,o=void 0,s=(i=(n=e).__v).__e,(a=n.__P)&&(r=[],(o=_({},i)).__v=i.__v+1,M(a,i,o,n.__n,void 0!==a.ownerSVGElement,null!=i.__h?[s]:null,r,null==s?C(i):s,i.__h),A(r,i),i.__e!=s&&S(i)),c.length>t&&c.sort(h));I.__r=0}function P(e,t,n,r,o,i,s,a,f,l){var u,b,c,d,p,h,v,_=r&&r.__k||m,w=_.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?j(null,d,null,null,d):Array.isArray(d)?j(x,{children:d},null,null,null):d.__b>0?j(d.type,d.props,d.key,d.ref?d.ref:null,d.__v):d)){if(d.__=n,d.__b=n.__b+1,null===(c=_[u])||c&&d.key==c.key&&d.type===c.type)_[u]=void 0;else for(b=0;b<w;b++){if((c=_[b])&&d.key==c.key&&d.type===c.type){_[b]=void 0;break}c=null}M(e,d,c=c||g,o,i,s,a,f,l),p=d.__e,(b=d.ref)&&c.ref!=b&&(v||(v=[]),c.ref&&v.push(c.ref,null,d),v.push(b,d.__c||p,d)),null!=p?(null==h&&(h=p),"function"==typeof d.type&&d.__k===c.__k?d.__d=f=q(d,f,e):f=E(e,d,c,_,p,f),"function"==typeof n.type&&(n.__d=f)):f&&c.__e==f&&f.parentNode!=e&&(f=C(c))}for(n.__e=h,u=w;u--;)null!=_[u]&&("function"==typeof n.type&&null!=_[u].__e&&_[u].__e==n.__d&&(n.__d=H(r).nextSibling),D(_[u],_[u]));if(v)for(u=0;u<v.length;u++)U(v[u],v[++u],v[++u])}function q(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?q(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 H(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=H(n)))return r;return null}function z(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||v.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||z(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||z(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?O:L,i):e.removeEventListener(t,i?O:L,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 L(e){return this.l[e.type+!1](u.event?u.event(e):e)}function O(e){return this.l[e.type+!0](u.event?u.event(e):e)}function M(e,t,n,r,o,i,s,a,f){var l,b,c,d,p,h,g,m,v,w,y,j,C,S,N,I=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(f=n.__h,a=t.__e=n.__e,t.__h=null,i=[a]),(l=u.__b)&&l(t);try{e:if("function"==typeof I){if(m=t.props,v=(l=I.contextType)&&r[l.__c],w=l?v?v.props.value:l.__:r,n.__c?g=(b=t.__c=n.__c).__=b.__E:("prototype"in I&&I.prototype.render?t.__c=b=new I(m,w):(t.__c=b=new k(m,w),b.constructor=I,b.render=W),v&&v.sub(b),b.props=m,b.state||(b.state={}),b.context=w,b.__n=r,c=b.__d=!0,b.__h=[],b._sb=[]),null==b.__s&&(b.__s=b.state),null!=I.getDerivedStateFromProps&&(b.__s==b.state&&(b.__s=_({},b.__s)),_(b.__s,I.getDerivedStateFromProps(m,b.__s))),d=b.props,p=b.state,b.__v=t,c)null==I.getDerivedStateFromProps&&null!=b.componentWillMount&&b.componentWillMount(),null!=b.componentDidMount&&b.__h.push(b.componentDidMount);else{if(null==I.getDerivedStateFromProps&&m!==d&&null!=b.componentWillReceiveProps&&b.componentWillReceiveProps(m,w),!b.__e&&null!=b.shouldComponentUpdate&&!1===b.shouldComponentUpdate(m,b.__s,w)||t.__v===n.__v){for(t.__v!==n.__v&&(b.props=m,b.state=b.__s,b.__d=!1),b.__e=!1,t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(e){e&&(e.__=t)}),y=0;y<b._sb.length;y++)b.__h.push(b._sb[y]);b._sb=[],b.__h.length&&s.push(b);break e}null!=b.componentWillUpdate&&b.componentWillUpdate(m,b.__s,w),null!=b.componentDidUpdate&&b.__h.push(function(){b.componentDidUpdate(d,p,h)})}if(b.context=w,b.props=m,b.__P=e,j=u.__r,C=0,"prototype"in I&&I.prototype.render){for(b.state=b.__s,b.__d=!1,j&&j(t),l=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,j&&j(t),l=b.render(b.props,b.state,b.context),b.state=b.__s}while(b.__d&&++C<25);b.state=b.__s,null!=b.getChildContext&&(r=_(_({},r),b.getChildContext())),c||null==b.getSnapshotBeforeUpdate||(h=b.getSnapshotBeforeUpdate(d,p)),N=null!=l&&l.type===x&&null==l.key?l.props.children:l,P(e,Array.isArray(N)?N:[N],t,n,r,o,i,s,a,f),b.base=t.__e,t.__h=null,b.__h.length&&s.push(b),g&&(b.__E=b.__=null),b.__e=!1}else null==i&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=F(n.__e,t,n,r,o,i,s,f);(l=u.diffed)&&l(t)}catch(e){t.__v=null,(f||null!=i)&&(t.__e=a,t.__h=!!f,i[i.indexOf(a)]=null),u.__e(e,t,n)}}function A(e,t){u.__c&&u.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){u.__e(e,t.__v)}})}function F(e,t,n,r,o,i,s,a){var f,u,b,c=n.props,d=t.props,p=t.type,h=0;if("svg"===p&&(o=!0),null!=i)for(;h<i.length;h++)if((f=i[h])&&"setAttribute"in f==!!p&&(p?f.localName===p:3===f.nodeType)){e=f,i[h]=null;break}if(null==e){if(null===p)return document.createTextNode(d);e=o?document.createElementNS("http://www.w3.org/2000/svg",p):document.createElement(p,d.is&&d),i=null,a=!1}if(null===p)c===d||a&&e.data===d||(e.data=d);else{if(i=i&&l.call(e.childNodes),u=(c=n.props||g).dangerouslySetInnerHTML,b=d.dangerouslySetInnerHTML,!a){if(null!=i)for(c={},h=0;h<e.attributes.length;h++)c[e.attributes[h].name]=e.attributes[h].value;(b||u)&&(b&&(u&&b.__html==u.__html||b.__html===e.innerHTML)||(e.innerHTML=b&&b.__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,d,c,o,a),b)t.__k=[];else if(h=t.props.children,P(e,Array.isArray(h)?h:[h],t,n,r,o&&"foreignObject"!==p,i,s,i?i[0]:n.__k&&C(n,0),a),null!=i)for(h=i.length;h--;)null!=i[h]&&w(i[h]);a||("value"in d&&void 0!==(h=d.value)&&(h!==e.value||"progress"===p&&!h||"option"===p&&h!==c.value)&&T(e,"value",h,c.value,!1),"checked"in d&&void 0!==(h=d.checked)&&h!==e.checked&&T(e,"checked",h,c.checked,!1))}return e}function U(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){u.__e(e,n)}}function D(e,t,n){var r,o;if(u.unmount&&u.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){u.__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]&&D(r[o],t,n||"function"!=typeof e.type);n||null==e.__e||w(e.__e),e.__=e.__e=e.__d=void 0}function W(e,t,n){return this.constructor(e,n)}l=m.slice,u={__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}},b=0,k.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=_({},this.state),"function"==typeof e&&(e=e(_({},n),this.props)),e&&_(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),N(this))},k.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),N(this))},k.prototype.render=x,c=[],p="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,h=function(e,t){return e.__v.__b-t.__v.__b},I.__r=0;var Q,J,B,Y,R=0,V=[],G=[],X=u.__b,$=u.__r,K=u.diffed,Z=u.__c,ee=u.unmount;function te(e,t){u.__h&&u.__h(J,e,R||t),R=0;var n=J.__H||(J.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:G}),n.__[e]}function ne(e){return R=1,function(e,t,n){var r=te(Q++,2);if(r.t=e,!r.__c&&(r.__=[le(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=J,!J.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))};J.u=!0;var i=J.shouldComponentUpdate,s=J.componentWillUpdate;J.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)},J.shouldComponentUpdate=o}return r.__N||r.__}(le,e)}function re(e,t){var n=te(Q++,3);!u.__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,J.__H.__h.push(n))}function oe(){for(var e;e=V.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ae),e.__H.__h.forEach(fe),e.__H.__h=[]}catch(t){e.__H.__h=[],u.__e(t,e.__v)}}u.__b=function(e){J=null,X&&X(e)},u.__r=function(e){$&&$(e),Q=0;var t=(J=e.__c).__H;t&&(B===J?(t.__h=[],J.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.__V=G,e.__N=e.i=void 0})):(t.__h.forEach(ae),t.__h.forEach(fe),t.__h=[])),B=J},u.diffed=function(e){K&&K(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==V.push(t)&&Y===u.requestAnimationFrame||((Y=u.requestAnimationFrame)||se)(oe)),t.__H.__.forEach(function(e){e.i&&(e.__H=e.i),e.__V!==G&&(e.__=e.__V),e.i=void 0,e.__V=G})),B=J=null},u.__c=function(e,t){t.some(function(e){try{e.__h.forEach(ae),e.__h=e.__h.filter(function(e){return!e.__||fe(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],u.__e(n,e.__v)}}),Z&&Z(e,t)},u.unmount=function(e){ee&&ee(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{ae(e)}catch(e){t=e}}),n.__H=void 0,t&&u.__e(t,n.__v))};var ie="function"==typeof requestAnimationFrame;function se(e){var t,n=function(){clearTimeout(r),ie&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);ie&&(t=requestAnimationFrame(n))}function ae(e){var t=J,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),J=t}function fe(e){var t=J;e.__c=e.__(),J=t}function le(e,t){return"function"==typeof t?t(e):t}var ue=function(){return[].slice.call(arguments).filter(Boolean).join(" ")};function be(e){var t=e.children,n=e.isOpen,r=e.close,o=ne(!1),i=o[0],s=o[1];return re(function(){s(n)},[n]),y("div",{"aria-live":"assertive",className:"fb-pointer-events-none fb-fixed fb-inset-0 fb-flex fb-items-end fb-z-40"},y("div",{className:"fb-flex fb-w-full fb-flex-col fb-items-center fb-space-y-4 sm:fb-items-end"},y("div",{className:ue(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-m-4")},y("div",{class:"fb-absolute fb-top-0 fb-right-0 fb-hidden fb-pt-4 fb-pr-4 sm:fb-block"},y("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"},y("span",{class:"fb-sr-only"},"Close"),y("svg",{class:"fb-h-6 fb-w-6",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},y("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})))),y("div",{className:""},t))))}var ce=function(e,t){try{var r=t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/displays/"+e+"/responded";return Promise.resolve(fetch(r,{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(e){var t;function o(e){return t?e:{ok:!0,value:void 0}}var i=function(){if(!e.ok)return Promise.resolve(e.json()).then(function(o){var i=n({code:"network_error",message:"Could not mark display as responded",status:e.status,url:r,responseMessage:o.message});return t=1,i})}();return i&&i.then?i.then(o):o(i)})}catch(e){return Promise.reject(e)}},de=function(e,r){try{var o=r.apiHost+"/api/v1/client/environments/"+r.environmentId+"/responses";return Promise.resolve(fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){return Promise.resolve(e.json()).then(function(r){return e.ok?t(r):n({code:"network_error",message:"Could not create response",status:e.status,url:o,responseMessage:r.message})})})}catch(e){return Promise.reject(e)}};function pe(e){return y("div",{className:"fb-h-1 fb-w-full fb-rounded-full bg-slate-200"},y("div",{className:"fb-h-1 fb-rounded-full",style:{backgroundColor:e.brandColor,width:Math.floor(100*e.progress)+"%"}}))}function he(e){return y("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 ge(e){return y("label",{htmlFor:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600"},e.subheader)}function me(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return y("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)}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-mt-4"},y("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"})),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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 ve(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne(null),s=i[0],a=i[1];return y("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);n(o),a(null)}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-mt-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Options"),y("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e,n){return y("label",{key:e.id,className:ue(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")},y("span",{className:"fb-flex fb-items-center fb-text-sm"},y("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}),y("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne([]),s=i[0],a=i[1],f=function(){return s.length>0};return y("form",{onSubmit:function(e){var r;if(e.preventDefault(),f()||!t.required){var o=((r={})[t.id]=s,r);n(o),a([])}}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-mt-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Options"),y("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e){return y("label",{key:e.id,className:ue(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")},y("span",{className:"fb-flex fb-items-center fb-text-sm"},y("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}}),y("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),y("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":""}),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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 we(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne(null),s=i[0],a=i[1];return y("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=s,r);n(o)}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-my-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Options"),y("div",{className:"fb-flex"},Array.from({length:11},function(e,t){return t}).map(function(e){return y("label",{key:e,className:ue(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 first:fb-rounded-l-md last:fb-rounded-r-md hover:fb-bg-gray-100 focus:fb-outline-none")},y("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 function(e){var r;a(e),t.required&&n(((r={})[t.id]=e,r))}(e)},required:t.required}),e)})),y("div",{className:"fb-flex fb-justify-between fb-text-slate-500 fb-leading-6 fb-px-1.5 fb-text-xs"},y("p",null,t.lowerLabel),y("p",null,t.upperLabel)))),!t.required&&y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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 ye(e){function t(e,t){var n=t.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(e)||!n.includes("javascript:")&&!n.includes("data:"))||!!e.startsWith("on")||void 0}function n(e){for(var n,r=a(e.attributes);!(n=r()).done;){var o=n.value,i=o.name;t(i,o.value)&&e.removeAttribute(i)}}var r=(new DOMParser).parseFromString(e,"text/html").body||document.createElement("body");return function(e){for(var t,n=a(e.querySelectorAll("script"));!(t=n()).done;)t.value.remove()}(r),function e(t){for(var r,o=a(t.children);!(r=o()).done;){var i=r.value;n(i),e(i)}}(r),r.innerHTML}function je(e){return y("label",{htmlFor:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600",dangerouslySetInnerHTML:{__html:ye(e.htmlString)}})}function xe(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return y("div",null,y(he,{headline:t.headline,questionId:t.id}),y(je,{htmlString:t.html,questionId:t.id}),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-end"},y("div",null),!t.required&&y("button",{type:"button",onClick:function(){var e;n(((e={})[t.id]="dismissed",e))},className:"fb-flex fb-items-center dark:fb-text-slate-400 fb-rounded-md fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2 fb-mr-4"},t.dismissButtonLabel||"Skip"),y("button",{type:"button",onClick:function(){var e,r,o;t.buttonExternal&&t.buttonUrl&&(null==(r=window)||null==(o=r.open(t.buttonUrl,"_blank"))||o.focus()),n(((e={})[t.id]="clicked",e))},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 ke(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne(null),s=i[0],a=i[1];return y("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=s,r);a(null),n(o)}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-my-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Choices"),y("div",{className:"fb-flex"},Array.from({length:t.range},function(e,t){return t+1}).map(function(e){return y("label",{key:e,className:ue(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 first:fb-rounded-l-md last:fb-rounded-r-md hover:fb-bg-gray-100 focus:fb-outline-none")},y("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 function(e){var r;a(e),t.required&&(n(((r={})[t.id]=e,r)),a(null))}(e)},required:t.required}),e)})),y("div",{className:"fb-flex fb-justify-between fb-text-slate-500 fb-leading-6 fb-px-1.5 fb-text-xs"},y("p",null,t.lowerLabel),y("p",null,t.upperLabel)))),!t.required&&y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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-slate-500 focus:fb-ring-offset-2",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function Ce(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return"openText"===t.type?y(me,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceSingle"===t.type?y(ve,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceMulti"===t.type?y(_e,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"nps"===t.type?y(we,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"cta"===t.type?y(xe,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"rating"===t.type?y(ke,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):null}function Se(e){var t=e.headline,n=e.subheader;return y("div",{className:"fb-text-center"},y("div",{className:"fb-flex fb-items-center fb-justify-center",style:{color:e.brandColor}},y("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"},y("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"}))),y("span",{className:"fb-inline-block fb-rounded-[100%] fb-w-16 fb-h-1 fb-mb-[10px] fb-bg-slate-300"}),y("div",null,y(he,{headline:t,questionId:"thankYouCard",style:{"margin-right":0}}),y(ge,{subheader:n,questionId:"thankYouCard"})))}function Ne(r){var o,i=r.config,s=r.survey,a=r.close,f=r.brandColor,l=r.errorHandler,u=ne(s.questions[0].id),b=u[0],c=u[1],d=ne(0),p=d[0],h=d[1],g=ne(null),m=g[0],v=g[1],_=ne(null),w=_[0],j=_[1],x=ne(!1),k=x[0],C=x[1];re(function(){!function(){try{Promise.resolve(function(e,r){try{var o=r.apiHost+"/api/v1/client/environments/"+r.environmentId+"/displays";return Promise.resolve(fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){var r;function i(n){return r?n:Promise.resolve(e.json()).then(t)}var s=function(){if(!e.ok)return Promise.resolve(e.json()).then(function(t){var i=n({code:"network_error",message:"Could not create display",status:e.status,url:o,responseMessage:t.message});return r=1,i})}();return s&&s.then?s.then(i):i(s)})}catch(e){return Promise.reject(e)}}({surveyId:s.id,personId:i.person.id},i)).then(function(e){!0===e.ok?j(e.value.id):l(e.error)})}catch(e){return Promise.reject(e)}}()},[i,s,l]),re(function(){var e;h((e=s.questions.findIndex(function(e){return e.id===b}),e/s.questions.length))},[b,s]);var S=function(r){try{var o=function(){C(!1),u?(h(100),s.thankYouCard.enabled?setTimeout(function(){a()},2e3):a()):c(s.questions[f+1].id)};C(!0);var f=s.questions.findIndex(function(e){return e.id===b}),u=f===s.questions.length-1,d={surveyId:s.id,personId:i.person.id,response:{finished:u,data:r}},p=m?Promise.resolve(function(e,r,o){try{var i=o.apiHost+"/api/v1/client/environments/"+o.environmentId+"/responses/"+r;return Promise.resolve(fetch(i,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){return Promise.resolve(e.json()).then(function(r){return e.ok?t(r):n({code:"network_error",message:"Could not update response",status:e.status,url:i,responseMessage:r.message})})})}catch(e){return Promise.reject(e)}}(d,m,i)).then(function(t){!0!==t.ok?l(t.error):d.response.finished&&e.getInstance().debug("Submitted response")}):Promise.resolve(Promise.all([de(d,i),ce(w,i)])).then(function(e){var t=e[0];!0===t.ok?v(t.value.id):l(t.error)});return Promise.resolve(p&&p.then?p.then(o):o())}catch(e){return Promise.reject(e)}};return y("div",null,y("div",{className:ue(k?"fb-animate-pulse fb-opacity-60":"","fb-text-slate-800 fb-font-sans fb-px-4 fb-py-6 sm:fb-p-6")},100===p&&s.thankYouCard.enabled?y(Se,{headline:s.thankYouCard.headline,subheader:s.thankYouCard.subheader,brandColor:null==(o=i.settings)?void 0:o.brandColor}):s.questions.map(function(e,t){return b===e.id&&y(Ce,{key:e.id,brandColor:f,lastQuestion:t===s.questions.length-1,onSubmit:S,question:e})})),y(pe,{progress:p,brandColor:f}))}function Ie(e){var t,n=e.config,r=e.survey,o=e.closeSurvey,i=e.errorHandler,s=ne(!0),a=s[1],f=function(){a(!1),setTimeout(function(){o()},1e3)};return y("div",{id:"fbjs"},y(be,{isOpen:s[0],close:f},y(Ne,{config:n,survey:r,close:f,brandColor:null==(t=n.settings)?void 0:t.brandColor,errorHandler:i})))}var Pe=e.getInstance(),qe=f.getInstance(),Ee=function(){try{var e=qe.get().apiHost+"/api/v1/client/environments/"+qe.get().environmentId+"/settings";return Promise.resolve(fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:qe.get().person.id})})).then(function(r){var o;function i(e){return o?e:Promise.resolve(r.json()).then(t)}var s=function(){if(!r.ok)return Promise.resolve(r.json()).then(function(t){var i=n({code:"network_error",status:r.status,message:"Error getting settings",url:e,responseMessage:t.message});return o=1,i})}();return s&&s.then?s.then(i):i(s)})}catch(e){return Promise.reject(e)}},He=function(){try{return Pe.debug("Refreshing - getting settings from backend"),Promise.resolve(Ee()).then(function(e){return!0!==e.ok?n(e.error):(Pe.debug("Settings refreshed"),qe.update({settings:e.value}),{ok:!0,value:void 0})})}catch(e){return Promise.reject(e)}},ze="formbricks-web-container",Te=f.getInstance(),Le=e.getInstance(),Oe=o.getInstance(),Me=!1,Ae=function(e){Me?Le.debug("A survey is already running. Skipping."):(Me=!0,function(e,t,n){var r,o;u.__&&u.__(e,t),r=t.__k,o=[],M(t,e=t.__k=y(x,null,[e]),r||g,g,void 0!==t.ownerSVGElement,r?null:t.firstChild?l.call(t.childNodes):null,o,r?r.__e:t.firstChild,!1),A(o,e)}(y(Ie,{config:Te.get(),survey:e,closeSurvey:Fe,errorHandler:Oe.handle}),document.getElementById(ze)))},Fe=function(){try{return document.getElementById(ze).remove(),Ue(),Promise.resolve(Ee()).then(function(e){r(e,function(e){Te.update({settings:e}),Me=!1},function(e){Oe.handle(e)})})}catch(e){return Promise.reject(e)}},Ue=function(){var e=document.createElement("div");e.id=ze,document.body.appendChild(e)},De=e.getInstance(),We=f.getInstance(),Qe=function(e,t){try{return Promise.resolve(fetch(We.get().apiHost+"/api/v1/client/environments/"+We.get().environmentId+"/events",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:We.get().session.id,eventName:e,properties:t})})).then(function(t){var r;function o(t){return r?t:(De.debug('Formbricks: Event "'+e+'" tracked'),Je(e),{ok:!0,value:void 0})}var i=function(){if(!t.ok)return Promise.resolve(t.json()).then(function(e){var o=n({code:"network_error",message:"Error tracking event: "+JSON.stringify(e),status:t.status,url:t.url,responseMessage:e.message});return r=1,o})}();return i&&i.then?i.then(o):o(i)})}catch(e){return Promise.reject(e)}},Je=function(e){for(var t,n=a(null==(r=We.get().settings)?void 0:r.surveys);!(t=n()).done;)for(var r,o,i=t.value,s=a(i.triggers);!(o=s()).done;){var f;if((null==(f=o.value.eventClass)?void 0:f.name)===e)return De.debug("Formbricks: survey "+i.id+' triggered by event "'+e+'"'),void Ae(i)}},Be="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function Ye(e,t,n){if(!e.s){if(n instanceof Re){if(!n.s)return void(n.o=Ye.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(Ye.bind(null,e,t),Ye.bind(null,e,2));e.s=t,e.v=n;var r=e.o;r&&r(e)}}var Re=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){var r=new e,o=this.s;if(o){var i=1&o?t:n;if(i){try{Ye(r,1,i(this.v))}catch(e){Ye(r,2,e)}return r}return this}return this.o=function(e){try{var o=e.v;1&e.s?Ye(r,1,t?t(o):o):n?Ye(r,1,n(o)):Ye(r,2,o)}catch(e){Ye(r,2,e)}},r},e}();function Ve(e){return e instanceof Re&&1&e.s}var Ge=f.getInstance(),Xe=e.getInstance(),$e=o.getInstance(),Ke=function(){try{var e,r=function(t){return e?t:{ok:!0,value:void 0}};Xe.debug("checking page url");var o=Ge.get().settings,i=null==o?void 0:o.noCodeEvents.filter(function(e){var t;return"pageUrl"===(null==(t=e.noCodeConfig)?void 0:t.type)});if(0===i.length)return Promise.resolve({ok:!0,value:void 0});var s=function(e,t,n){if("function"==typeof e[Be]){var r,o,i,s=e[Be]();if(function e(a){try{for(;!((r=s.next()).done||n&&n());)if((a=t(r.value))&&a.then){if(!Ve(a))return void a.then(e,i||(i=Ye.bind(null,o=new Re,2)));a=a.v}o?Ye(o,1,a):o=a}catch(e){Ye(o||(o=new Re),2,e)}}(),s.return){var a=function(e){try{r.done||s.return()}catch(e){}return e};if(o&&o.then)return o.then(a,function(e){throw a(e)});a()}return o}if(!("length"in e))throw new TypeError("Object is not iterable");for(var f=[],l=0;l<e.length;l++)f.push(e[l]);return function(e,t,n){var r,o,i=-1;return function s(a){try{for(;++i<e.length&&(!n||!n());)if((a=t(i))&&a.then){if(!Ve(a))return void a.then(s,o||(o=Ye.bind(null,r=new Re,2)));a=a.v}r?Ye(r,1,a):r=a}catch(e){Ye(r||(r=new Re),2,e)}}(),r}(f,function(e){return t(f[e])},n)}(i,function(r){var o=r.noCodeConfig.pageUrl;if(o){var i=function(e,r,o){var i,s;switch(o){case"exactMatch":i=e===r;break;case"contains":i=e.includes(r);break;case"startsWith":i=e.startsWith(r);break;case"endsWith":i=e.endsWith(r);break;case"notMatch":i=e!==r;break;case"notContains":i=!e.includes(r);break;default:s=n({code:"invalid_match_type",message:"Invalid match type"})}return s||t(i)}(window.location.href,o.value,o.rule);if(!0!==i.ok){var s=n(i.error);return e=1,s}if(!1!==i.value)return Promise.resolve(Qe(r.name)).then(function(t){if(!0!==t.ok){var r=n(t.error);return e=1,r}})}},function(){return e});return Promise.resolve(s&&s.then?s.then(r):r(s))}catch(e){return Promise.reject(e)}},Ze=function(e){var t=Ge.get().settings,n=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"innerHtml"===(null==(t=e.noCodeConfig)?void 0:t.type)}),o=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"cssSelector"===(null==(t=e.noCodeConfig)?void 0:t.type)}),i=e.target;n.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.innerHtml;n&&i.innerHTML===n.value&&Qe(e.name).then(function(e){r(e,function(e){},function(e){$e.handle(e)})})}),o.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.cssSelector;n&&i.matches(n.value)&&Qe(e.name).then(function(e){r(e,function(e){},function(e){$e.handle(e)})})})},et=f.getInstance(),tt=e.getInstance(),nt=function(){try{tt.debug("Creating new person");var e=et.get().apiHost+"/api/v1/client/environments/"+et.get().environmentId+"/people";return Promise.resolve(fetch(e,{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(r){return Promise.resolve(r.json()).then(function(o){return r.ok?t(o):n({code:"network_error",message:"Error creating person",status:r.status,url:e,responseMessage:o.message})})})}catch(e){return Promise.reject(e)}},rt=function(e,t){var n=et.get().person.attributes.find(function(t){var n;return(null==(n=t.attributeClass)?void 0:n.name)===e});return!(!n||n.value!==t)},ot=function(e){try{return tt.debug("setting userId: "+e),rt("userId",e)?(tt.debug("userId already set to this value. Skipping update."),Promise.resolve({ok:!0,value:void 0})):(r=et.get().person.attributes.find(function(e){var t;return"userId"===(null==(t=e.attributeClass)?void 0:t.name)}),r?Promise.resolve(n({code:"attribute_already_exists",message:"userId cannot be changed after it has been set. You need to reset first"})):Promise.resolve(function(e){try{if(!et.get().person||!et.get().person.id)return Promise.resolve(n({code:"missing_person",message:"Unable to update userId. No person set."}));var r=et.get().apiHost+"/api/v1/client/environments/"+et.get().environmentId+"/people/"+et.get().person.id+"/user-id";return Promise.resolve(fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,sessionId:et.get().session.id})})).then(function(e){return Promise.resolve(e.json()).then(function(o){return e.ok?t(o):n({code:"network_error",message:"Error updating person",status:e.status,url:r,responseMessage:o.message})})})}catch(e){return Promise.reject(e)}}(e)).then(function(e){if(!0!==e.ok)return n(e.error);var t=e.value;return et.update({person:t.person,settings:t.settings}),{ok:!0,value:void 0}}))}catch(e){return Promise.reject(e)}var r},it=function(e,o){try{return tt.debug("setting attribute: "+e+" to value: "+o),rt(e,o)?(tt.debug("attribute already set to this value. Skipping update."),Promise.resolve({ok:!0,value:void 0})):Promise.resolve(function(e,r){try{return et.get().person&&et.get().person.id?Promise.resolve(fetch(et.get().apiHost+"/api/v1/client/environments/"+et.get().environmentId+"/people/"+et.get().person.id+"/attribute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e,value:r})})).then(function(e){return Promise.resolve(e.json()).then(function(r){return e.ok?t(r):n({code:"network_error",status:e.status,message:"Error updating person",url:e.url,responseMessage:r.message})})}):Promise.resolve(n({code:"missing_person",message:"Unable to update attribute. No person set."}))}catch(e){return Promise.reject(e)}}(e,o)).then(function(e){var t;return r(e,function(e){et.update({person:e.person,settings:e.settings})},function(e){t=e}),t?n(t):{ok:!0,value:void 0}})}catch(e){return Promise.reject(e)}},st=function(){try{return tt.debug("Resetting person. Getting new person, session and settings from backend"),Promise.resolve(nt()).then(function(e){var t;return r(e,function(e){et.update({person:e.person,session:e.session,settings:e.settings})},function(e){t=e}),t?n(t):{ok:!0,value:void 0}})}catch(e){return Promise.reject(e)}},at=e.getInstance(),ft=f.getInstance(),lt=function(){try{if(!ft.get().person)return Promise.resolve(n({code:"missing_person",message:"Unable to create session. No person found"}));var e=ft.get().apiHost+"/api/v1/client/environments/"+ft.get().environmentId+"/sessions";return Promise.resolve(fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:ft.get().person.id})})).then(function(r){return Promise.resolve(r.json()).then(function(o){return r.ok?t(o):n({code:"network_error",message:"Error creating session",status:r.status,url:e,responseMessage:o.message})})})}catch(e){return Promise.reject(e)}},ut=function(e){var t=i({},e);return t.expiresAt=Date.now()+36e5,t},bt=function(e){return!e||e.expiresAt<=Date.now()},ct=f.getInstance(),dt=e.getInstance(),pt=function(e){try{var t,r=function(e){return t?e:(dt.debug("Add session event listeners"),function(){if("undefined"!=typeof window){var e=window.setInterval(function(){try{return Promise.resolve(function(){try{var e,t=function(t){return e?t:(at.debug("Session not expired, extending session"),ft.update({session:ut(ft.get().session)}),{ok:!0,value:void 0})};at.debug("Checking session");var r=function(){if(bt(ft.get().session))return at.debug("Session expired, creating new session"),Promise.resolve(lt()).then(function(t){if(!0!==t.ok){var r=n(t.error);return e=1,r}var o=t.value;return ft.update({session:o.session,settings:o.settings}),Promise.resolve(Qe("New Session")).then(function(t){if(!0!==t.ok){var r=n(t.error);return e=1,r}return e=1,{ok:!0,value:void 0}})})}();return Promise.resolve(r&&r.then?r.then(t):t(r))}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}},3e5);window.addEventListener("beforeunload",function(){clearInterval(e)})}}(),dt.debug("Add page url event listeners"),"undefined"!=typeof window&&(window.addEventListener("hashchange",Ke),window.addEventListener("popstate",Ke),window.addEventListener("pushstate",Ke),window.addEventListener("replacestate",Ke),window.addEventListener("load",Ke)),dt.debug("Add click event listeners"),"undefined"!=typeof window&&document.addEventListener("click",Ze),dt.debug("Initialized"),Ke(),{ok:!0,value:void 0})};if(dt.debug("Start initialize"),!e.environmentId)return dt.debug("No environmentId provided"),Promise.resolve(n({code:"missing_field",field:"environmentId"}));if(!e.apiHost)return dt.debug("No apiHost provided"),Promise.resolve(n({code:"missing_field",field:"apiHost"}));e.logLevel&&(dt.debug("Setting log level to "+e.logLevel),dt.configure({logLevel:e.logLevel})),dt.debug("Adding widget container to DOM"),Ue(),dt.debug("Adding styles to DOM"),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-4){margin-right:1rem}#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-end){justify-content:flex-end}#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-1){padding-left:.25rem;padding-right:.25rem}#fbjs :is(.fb-px-1\\.5){padding-left:.375rem;padding-right:.375rem}#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(.first\\:fb-rounded-l-md:first-child){border-bottom-left-radius:.375rem;border-top-left-radius:.375rem}#fbjs :is(.last\\:fb-rounded-r-md:last-child){border-bottom-right-radius:.375rem;border-top-right-radius:.375rem}#fbjs :is(.hover\\:fb-bg-gray-100:hover){--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}#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}#fbjs :is(.fb-dark .dark\\:fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}@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}}.fb-editor-text-bold{font-weight:700!important}.fb-editor-text-italic{font-style:italic!important}.fb-editor-link{color:#334155!important;text-decoration:underline!important}.editor-tokenFunction{color:#dd4a68!important}.fb-editor-paragraph{color:#334155!important;margin:0!important;position:relative!important}.fb-editor-paragraph:last-child{margin-bottom:0!important}.fb-editor-heading-h1{font-size:25px!important;font-weight:400!important}.fb-editor-heading-h1,.fb-editor-heading-h2{font-weight:700!important;margin-bottom:20px!important}.fb-editor-heading-h2{font-size:20px!important}.fb-editor-list-ol,.fb-editor-list-ul{margin-bottom:12px!important}.fb-editor-listitem{margin:0 32px!important}.fb-editor-nested-listitem{list-style-type:none!important}',document.head.appendChild(e)}}();var o=function(){if(ct.get().session&&ct.get().environmentId===e.environmentId&&ct.get().apiHost===e.apiHost){dt.debug("Found existing configuration. Checking session.");var r=ct.get().session;return function(){if(bt(r))return dt.debug("Session expired. Creating new session."),Promise.resolve(lt()).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}var o=e.value,i=o.settings;return ct.update({session:ut(o.session),settings:i}),Promise.resolve(Qe("New Session")).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}})});dt.debug("Session valid. Extending session."),ct.update({session:ut(r)})}()}return dt.debug("No valid session found. Creating new config."),ct.update({environmentId:e.environmentId,apiHost:e.apiHost}),dt.debug("Get person, session and settings from server"),Promise.resolve(nt()).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}var o=e.value,i=o.settings;return ct.update({person:o.person,session:ut(o.session),settings:i}),Promise.resolve(Qe("New Session")).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}})})}();return Promise.resolve(o&&o.then?o.then(r):r(o))}catch(e){return Promise.reject(e)}};function ht(e,t,n){if(!e.s){if(n instanceof mt){if(!n.s)return void(n.o=ht.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(ht.bind(null,e,t),ht.bind(null,e,2));e.s=t,e.v=n;var r=e.o;r&&r(e)}}var gt=e.getInstance();const mt=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){const r=new e,o=this.s;if(o){const e=1&o?t:n;if(e){try{ht(r,1,e(this.v))}catch(e){ht(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?ht(r,1,t?t(o):o):n?ht(r,1,n(o)):ht(r,2,o)}catch(e){ht(r,2,e)}},r},e}();function vt(e){return e instanceof mt&&1&e.s}var _t=/*#__PURE__*/function(){function e(){this.queue=[],this.running=!1}var t=e.prototype;return t.add=function(e,t){void 0===e&&(e=!0);var n=[].slice.call(arguments,2);gt.debug("Add command to queue: "+t.name+"("+JSON.stringify(n)+")"),this.queue.push({command:t,checkInitialized:e,commandArgs:n}),this.running||this.run()},t.run=function(){try{var e=function(){t.running=!1},t=this;t.running=!0;var r=function(e,t,n){for(var r;;){var o=e();if(vt(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!vt(i)){r=1;break}i=i.s}}var s=new mt,a=ht.bind(null,s,2);return(0===r?o.then(l):1===r?i.then(f):(void 0).then(function(){(o=e())?o.then?o.then(l).then(void 0,a):l(o):ht(s,1,i)})).then(void 0,a),s;function f(t){i=t;do{if(!(o=e())||vt(o)&&!o.v)return void ht(s,1,i);if(o.then)return void o.then(l).then(void 0,a);vt(i=n())&&(i=i.v)}while(!i||!i.then);i.then(f).then(void 0,a)}function l(e){e?(i=n())&&i.then?i.then(f).then(void 0,a):f(i):ht(s,1,i)}}(function(){return t.queue.length>0},0,function(){var e=o.getInstance(),r=t.queue.shift();if(r.checkInitialized){var i=(dt.debug("Check if initialized"),ct.get().apiHost&&ct.get().environmentId&&ct.get().person&&ct.get().session&&ct.get().settings&&o.initialized?{ok:!0,value:void 0}:n({code:"not_initialized",message:"Formbricks not initialized. Call initialize() first."}));i&&!0!==i.ok&&e.handle(i.error)}return Promise.resolve(r.command.apply(null,r.commandArgs)).then(function(t){t&&(gt.debug("Command result: "+(!0===t.ok?"OK":"Something went really wrong")+", "+r.command.name),!0!==t.ok&&e.handle(t.error))})});return Promise.resolve(r&&r.then?r.then(e):e())}catch(e){return Promise.reject(e)}},e}();e.getInstance().debug("Create command queue");var wt=new _t,yt=function(e,t){wt.add(!0,it,e,t)},jt={init:function(e){o.init(e.errorHandler),wt.add(!1,pt,e)},setUserId:function(e){wt.add(!0,ot,e)},setEmail:function(e){yt("email",e)},setAttribute:yt,track:function(e,t){void 0===t&&(t={}),wt.add(!0,Qe,e,t)},logout:function(){wt.add(!0,st)},refresh:function(){wt.add(!0,He)},registerRouteChange:function(){wt.add(!0,Ke)}};export{jt 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(){var e=/*#__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}();e.instance=void 0;var t=function(e){return{ok:!0,value:e}},n=function(e){return{ok:!1,error:e}};function r(e,t,n){return!0===e.ok?t(e.value):n(e.error)}e.getInstance();var o=/*#__PURE__*/function(){function t(t){this.handleError=void 0,this.handleError=t||function(t){return e.getInstance().error(JSON.stringify(t))}}return t.getInstance=function(){return t.instance||(t.instance=new t),t.instance},t.init=function(e){this.initialized=!0,console.log("🧱 Formbricks - initializing error handler"),console.log("🧱 Formbricks - Custom error handler: ","function"==typeof e?"yes":"no"),t.instance=new t(e)},t.prototype.handle=function(e){this.handleError(e)},t}();function i(){return i=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},i.apply(this,arguments)}function s(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 a(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 s(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)?s(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.")}o.instance=void 0,o.initialized=!1;var f=/*#__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=i({},this.config,e),this.saveToLocalStorage())},t.get=function(){return this.config},t.loadFromLocalStorage=function(){if("undefined"!=typeof window){var e=localStorage.getItem("formbricksConfig");if(e)return JSON.parse(e)}return{apiHost:null,environmentId:null}},t.saveToLocalStorage=function(){var e,t=this;return(e=function(){return localStorage.setItem("formbricksConfig",JSON.stringify(t.config))},function(){try{return{ok:!0,value:e.apply(void 0,[].slice.call(arguments))}}catch(e){return{ok:!1,error:e}}})()},e}();f.instance=void 0;var l,u,b,d,c,p,h,g={},m=[],v=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function _(e,t){for(var n in t)e[n]=t[n];return e}function w(e){var t=e.parentNode;t&&t.removeChild(e)}function y(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?l.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 j(e,s,r,o,null)}function j(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?++b:o};return null==o&&null!=u.vnode&&u.vnode(i),i}function x(e){return e.children}function k(e,t){this.props=e,this.context=t}function C(e,t){if(null==t)return e.__?C(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?C(e):null}function S(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 S(e)}}function N(e){(!e.__d&&(e.__d=!0)&&d.push(e)&&!I.__r++||c!==u.debounceRendering)&&((c=u.debounceRendering)||p)(I)}function I(){var e,t,n,r,o,i,s,a;for(d.sort(h);e=d.shift();)e.__d&&(t=d.length,r=void 0,o=void 0,s=(i=(n=e).__v).__e,(a=n.__P)&&(r=[],(o=_({},i)).__v=i.__v+1,M(a,i,o,n.__n,void 0!==a.ownerSVGElement,null!=i.__h?[s]:null,r,null==s?C(i):s,i.__h),A(r,i),i.__e!=s&&S(i)),d.length>t&&d.sort(h));I.__r=0}function P(e,t,n,r,o,i,s,a,f,l){var u,b,d,c,p,h,v,_=r&&r.__k||m,w=_.length;for(n.__k=[],u=0;u<t.length;u++)if(null!=(c=n.__k[u]=null==(c=t[u])||"boolean"==typeof c||"function"==typeof c?null:"string"==typeof c||"number"==typeof c||"bigint"==typeof c?j(null,c,null,null,c):Array.isArray(c)?j(x,{children:c},null,null,null):c.__b>0?j(c.type,c.props,c.key,c.ref?c.ref:null,c.__v):c)){if(c.__=n,c.__b=n.__b+1,null===(d=_[u])||d&&c.key==d.key&&c.type===d.type)_[u]=void 0;else for(b=0;b<w;b++){if((d=_[b])&&c.key==d.key&&c.type===d.type){_[b]=void 0;break}d=null}M(e,c,d=d||g,o,i,s,a,f,l),p=c.__e,(b=c.ref)&&d.ref!=b&&(v||(v=[]),d.ref&&v.push(d.ref,null,c),v.push(b,c.__c||p,c)),null!=p?(null==h&&(h=p),"function"==typeof c.type&&c.__k===d.__k?c.__d=f=q(c,f,e):f=E(e,c,d,_,p,f),"function"==typeof n.type&&(n.__d=f)):f&&d.__e==f&&f.parentNode!=e&&(f=C(d))}for(n.__e=h,u=w;u--;)null!=_[u]&&("function"==typeof n.type&&null!=_[u].__e&&_[u].__e==n.__d&&(n.__d=H(r).nextSibling),D(_[u],_[u]));if(v)for(u=0;u<v.length;u++)U(v[u],v[++u],v[++u])}function q(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?q(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 H(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=H(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||v.test(t)?n:n+"px"}function z(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?O:L,i):e.removeEventListener(t,i?O:L,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 L(e){return this.l[e.type+!1](u.event?u.event(e):e)}function O(e){return this.l[e.type+!0](u.event?u.event(e):e)}function M(e,t,n,r,o,i,s,a,f){var l,b,d,c,p,h,g,m,v,w,y,j,C,S,N,I=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(f=n.__h,a=t.__e=n.__e,t.__h=null,i=[a]),(l=u.__b)&&l(t);try{e:if("function"==typeof I){if(m=t.props,v=(l=I.contextType)&&r[l.__c],w=l?v?v.props.value:l.__:r,n.__c?g=(b=t.__c=n.__c).__=b.__E:("prototype"in I&&I.prototype.render?t.__c=b=new I(m,w):(t.__c=b=new k(m,w),b.constructor=I,b.render=W),v&&v.sub(b),b.props=m,b.state||(b.state={}),b.context=w,b.__n=r,d=b.__d=!0,b.__h=[],b._sb=[]),null==b.__s&&(b.__s=b.state),null!=I.getDerivedStateFromProps&&(b.__s==b.state&&(b.__s=_({},b.__s)),_(b.__s,I.getDerivedStateFromProps(m,b.__s))),c=b.props,p=b.state,b.__v=t,d)null==I.getDerivedStateFromProps&&null!=b.componentWillMount&&b.componentWillMount(),null!=b.componentDidMount&&b.__h.push(b.componentDidMount);else{if(null==I.getDerivedStateFromProps&&m!==c&&null!=b.componentWillReceiveProps&&b.componentWillReceiveProps(m,w),!b.__e&&null!=b.shouldComponentUpdate&&!1===b.shouldComponentUpdate(m,b.__s,w)||t.__v===n.__v){for(t.__v!==n.__v&&(b.props=m,b.state=b.__s,b.__d=!1),b.__e=!1,t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(e){e&&(e.__=t)}),y=0;y<b._sb.length;y++)b.__h.push(b._sb[y]);b._sb=[],b.__h.length&&s.push(b);break e}null!=b.componentWillUpdate&&b.componentWillUpdate(m,b.__s,w),null!=b.componentDidUpdate&&b.__h.push(function(){b.componentDidUpdate(c,p,h)})}if(b.context=w,b.props=m,b.__P=e,j=u.__r,C=0,"prototype"in I&&I.prototype.render){for(b.state=b.__s,b.__d=!1,j&&j(t),l=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,j&&j(t),l=b.render(b.props,b.state,b.context),b.state=b.__s}while(b.__d&&++C<25);b.state=b.__s,null!=b.getChildContext&&(r=_(_({},r),b.getChildContext())),d||null==b.getSnapshotBeforeUpdate||(h=b.getSnapshotBeforeUpdate(c,p)),N=null!=l&&l.type===x&&null==l.key?l.props.children:l,P(e,Array.isArray(N)?N:[N],t,n,r,o,i,s,a,f),b.base=t.__e,t.__h=null,b.__h.length&&s.push(b),g&&(b.__E=b.__=null),b.__e=!1}else null==i&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=F(n.__e,t,n,r,o,i,s,f);(l=u.diffed)&&l(t)}catch(e){t.__v=null,(f||null!=i)&&(t.__e=a,t.__h=!!f,i[i.indexOf(a)]=null),u.__e(e,t,n)}}function A(e,t){u.__c&&u.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){u.__e(e,t.__v)}})}function F(e,t,n,r,o,i,s,a){var f,u,b,d=n.props,c=t.props,p=t.type,h=0;if("svg"===p&&(o=!0),null!=i)for(;h<i.length;h++)if((f=i[h])&&"setAttribute"in f==!!p&&(p?f.localName===p:3===f.nodeType)){e=f,i[h]=null;break}if(null==e){if(null===p)return document.createTextNode(c);e=o?document.createElementNS("http://www.w3.org/2000/svg",p):document.createElement(p,c.is&&c),i=null,a=!1}if(null===p)d===c||a&&e.data===c||(e.data=c);else{if(i=i&&l.call(e.childNodes),u=(d=n.props||g).dangerouslySetInnerHTML,b=c.dangerouslySetInnerHTML,!a){if(null!=i)for(d={},h=0;h<e.attributes.length;h++)d[e.attributes[h].name]=e.attributes[h].value;(b||u)&&(b&&(u&&b.__html==u.__html||b.__html===e.innerHTML)||(e.innerHTML=b&&b.__html||""))}if(function(e,t,n,r,o){var i;for(i in n)"children"===i||"key"===i||i in t||z(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]||z(e,i,t[i],n[i],r)}(e,c,d,o,a),b)t.__k=[];else if(h=t.props.children,P(e,Array.isArray(h)?h:[h],t,n,r,o&&"foreignObject"!==p,i,s,i?i[0]:n.__k&&C(n,0),a),null!=i)for(h=i.length;h--;)null!=i[h]&&w(i[h]);a||("value"in c&&void 0!==(h=c.value)&&(h!==e.value||"progress"===p&&!h||"option"===p&&h!==d.value)&&z(e,"value",h,d.value,!1),"checked"in c&&void 0!==(h=c.checked)&&h!==e.checked&&z(e,"checked",h,d.checked,!1))}return e}function U(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){u.__e(e,n)}}function D(e,t,n){var r,o;if(u.unmount&&u.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){u.__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]&&D(r[o],t,n||"function"!=typeof e.type);n||null==e.__e||w(e.__e),e.__=e.__e=e.__d=void 0}function W(e,t,n){return this.constructor(e,n)}l=m.slice,u={__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}},b=0,k.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=_({},this.state),"function"==typeof e&&(e=e(_({},n),this.props)),e&&_(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),N(this))},k.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),N(this))},k.prototype.render=x,d=[],p="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,h=function(e,t){return e.__v.__b-t.__v.__b},I.__r=0;var Q,J,B,Y,R=0,V=[],G=[],X=u.__b,$=u.__r,K=u.diffed,Z=u.__c,ee=u.unmount;function te(e,t){u.__h&&u.__h(J,e,R||t),R=0;var n=J.__H||(J.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:G}),n.__[e]}function ne(e){return R=1,function(e,t,n){var r=te(Q++,2);if(r.t=e,!r.__c&&(r.__=[le(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=J,!J.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))};J.u=!0;var i=J.shouldComponentUpdate,s=J.componentWillUpdate;J.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)},J.shouldComponentUpdate=o}return r.__N||r.__}(le,e)}function re(e,t){var n=te(Q++,3);!u.__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,J.__H.__h.push(n))}function oe(){for(var e;e=V.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ae),e.__H.__h.forEach(fe),e.__H.__h=[]}catch(t){e.__H.__h=[],u.__e(t,e.__v)}}u.__b=function(e){J=null,X&&X(e)},u.__r=function(e){$&&$(e),Q=0;var t=(J=e.__c).__H;t&&(B===J?(t.__h=[],J.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.__V=G,e.__N=e.i=void 0})):(t.__h.forEach(ae),t.__h.forEach(fe),t.__h=[])),B=J},u.diffed=function(e){K&&K(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==V.push(t)&&Y===u.requestAnimationFrame||((Y=u.requestAnimationFrame)||se)(oe)),t.__H.__.forEach(function(e){e.i&&(e.__H=e.i),e.__V!==G&&(e.__=e.__V),e.i=void 0,e.__V=G})),B=J=null},u.__c=function(e,t){t.some(function(e){try{e.__h.forEach(ae),e.__h=e.__h.filter(function(e){return!e.__||fe(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],u.__e(n,e.__v)}}),Z&&Z(e,t)},u.unmount=function(e){ee&&ee(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{ae(e)}catch(e){t=e}}),n.__H=void 0,t&&u.__e(t,n.__v))};var ie="function"==typeof requestAnimationFrame;function se(e){var t,n=function(){clearTimeout(r),ie&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);ie&&(t=requestAnimationFrame(n))}function ae(e){var t=J,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),J=t}function fe(e){var t=J;e.__c=e.__(),J=t}function le(e,t){return"function"==typeof t?t(e):t}var ue=function(){return[].slice.call(arguments).filter(Boolean).join(" ")};function be(e){var t=e.children,n=e.isOpen,r=e.close,o=ne(!1),i=o[0],s=o[1];return re(function(){s(n)},[n]),y("div",{"aria-live":"assertive",className:"fb-pointer-events-none fb-fixed fb-inset-0 fb-flex fb-items-end fb-z-40"},y("div",{className:"fb-flex fb-w-full fb-flex-col fb-items-center fb-space-y-4 sm:fb-items-end"},y("div",{className:ue(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-m-4")},y("div",{class:"fb-absolute fb-top-0 fb-right-0 fb-hidden fb-pt-4 fb-pr-4 sm:fb-block"},y("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"},y("span",{class:"fb-sr-only"},"Close"),y("svg",{class:"fb-h-6 fb-w-6",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},y("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})))),y("div",{className:""},t))))}var de=function(e,t){try{var r=t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/displays/"+e+"/responded";return Promise.resolve(fetch(r,{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(e){var t;function o(e){return t?e:{ok:!0,value:void 0}}var i=function(){if(!e.ok)return Promise.resolve(e.json()).then(function(o){var i=n({code:"network_error",message:"Could not mark display as responded",status:e.status,url:r,responseMessage:o.message});return t=1,i})}();return i&&i.then?i.then(o):o(i)})}catch(e){return Promise.reject(e)}},ce=function(e,r){try{var o=r.apiHost+"/api/v1/client/environments/"+r.environmentId+"/responses";return Promise.resolve(fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){return Promise.resolve(e.json()).then(function(r){return e.ok?t(r):n({code:"network_error",message:"Could not create response",status:e.status,url:o,responseMessage:r.message})})})}catch(e){return Promise.reject(e)}};function pe(e){return y("div",{className:"fb-h-1 fb-w-full fb-rounded-full bg-slate-200"},y("div",{className:"fb-h-1 fb-rounded-full",style:{backgroundColor:e.brandColor,width:Math.floor(100*e.progress)+"%"}}))}function he(e){return y("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 ge(e){return y("label",{htmlFor:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600"},e.subheader)}function me(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return y("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)}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-mt-4"},y("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"})),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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 ve(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne(null),s=i[0],a=i[1];return y("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);n(o),a(null)}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-mt-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Options"),y("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e,n){return y("label",{key:e.id,className:ue(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")},y("span",{className:"fb-flex fb-items-center fb-text-sm"},y("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}),y("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne([]),s=i[0],a=i[1],f=function(){return s.length>0};return y("form",{onSubmit:function(e){var r;if(e.preventDefault(),f()||!t.required){var o=((r={})[t.id]=s,r);n(o),a([])}}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-mt-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Options"),y("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e){return y("label",{key:e.id,className:ue(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")},y("span",{className:"fb-flex fb-items-center fb-text-sm"},y("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}}),y("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),y("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":""}),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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 we(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne(null),s=i[0],a=i[1];return y("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=s,r);n(o)}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-my-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Options"),y("div",{className:"fb-flex"},Array.from({length:11},function(e,t){return t}).map(function(e){return y("label",{key:e,className:ue(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 first:fb-rounded-l-md last:fb-rounded-r-md hover:fb-bg-gray-100 focus:fb-outline-none")},y("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 function(e){var r;a(e),t.required&&n(((r={})[t.id]=e,r))}(e)},required:t.required}),e)})),y("div",{className:"fb-flex fb-justify-between fb-text-slate-500 fb-leading-6 fb-px-1.5 fb-text-xs"},y("p",null,t.lowerLabel),y("p",null,t.upperLabel)))),!t.required&&y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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 ye(e){function t(e,t){var n=t.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(e)||!n.includes("javascript:")&&!n.includes("data:"))||!!e.startsWith("on")||void 0}function n(e){for(var n,r=a(e.attributes);!(n=r()).done;){var o=n.value,i=o.name;t(i,o.value)&&e.removeAttribute(i)}}var r=(new DOMParser).parseFromString(e,"text/html").body||document.createElement("body");return function(e){for(var t,n=a(e.querySelectorAll("script"));!(t=n()).done;)t.value.remove()}(r),function e(t){for(var r,o=a(t.children);!(r=o()).done;){var i=r.value;n(i),e(i)}}(r),r.innerHTML}function je(e){return y("label",{htmlFor:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600",dangerouslySetInnerHTML:{__html:ye(e.htmlString)}})}function xe(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return y("div",null,y(he,{headline:t.headline,questionId:t.id}),y(je,{htmlString:t.html,questionId:t.id}),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-end"},y("div",null),!t.required&&y("button",{type:"button",onClick:function(){var e;n(((e={})[t.id]="dismissed",e))},className:"fb-flex fb-items-center dark:fb-text-slate-400 fb-rounded-md fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2 fb-mr-4"},t.dismissButtonLabel||"Skip"),y("button",{type:"button",onClick:function(){var e,r,o;t.buttonExternal&&t.buttonUrl&&(null==(r=window)||null==(o=r.open(t.buttonUrl,"_blank"))||o.focus()),n(((e={})[t.id]="clicked",e))},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 ke(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne(null),s=i[0],a=i[1];return y("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=s,r);a(null),n(o)}},y(he,{headline:t.headline,questionId:t.id}),y(ge,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-my-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Choices"),y("div",{className:"fb-flex"},Array.from({length:t.range},function(e,t){return t+1}).map(function(e){return y("label",{key:e,className:ue(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 first:fb-rounded-l-md last:fb-rounded-r-md hover:fb-bg-gray-100 focus:fb-outline-none")},y("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 function(e){var r;a(e),t.required&&(n(((r={})[t.id]=e,r)),a(null))}(e)},required:t.required}),e)})),y("div",{className:"fb-flex fb-justify-between fb-text-slate-500 fb-leading-6 fb-px-1.5 fb-text-xs"},y("p",null,t.lowerLabel),y("p",null,t.upperLabel)))),!t.required&&y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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-slate-500 focus:fb-ring-offset-2",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function Ce(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return"openText"===t.type?y(me,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceSingle"===t.type?y(ve,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceMulti"===t.type?y(_e,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"nps"===t.type?y(we,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"cta"===t.type?y(xe,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"rating"===t.type?y(ke,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):null}function Se(e){var t=e.headline,n=e.subheader;return y("div",{className:"fb-text-center"},y("div",{className:"fb-flex fb-items-center fb-justify-center",style:{color:e.brandColor}},y("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"},y("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"}))),y("span",{className:"fb-inline-block fb-rounded-[100%] fb-w-16 fb-h-1 fb-mb-[10px] fb-bg-slate-300"}),y("div",null,y(he,{headline:t,questionId:"thankYouCard",style:{"margin-right":0}}),y(ge,{subheader:n,questionId:"thankYouCard"})))}function Ne(r){var o,i=r.config,s=r.survey,a=r.close,f=r.brandColor,l=r.errorHandler,u=ne(s.questions[0].id),b=u[0],d=u[1],c=ne(0),p=c[0],h=c[1],g=ne(null),m=g[0],v=g[1],_=ne(null),w=_[0],j=_[1],x=ne(!1),k=x[0],C=x[1];re(function(){!function(){try{Promise.resolve(function(e,r){try{var o=r.apiHost+"/api/v1/client/environments/"+r.environmentId+"/displays";return Promise.resolve(fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){var r;function i(n){return r?n:Promise.resolve(e.json()).then(t)}var s=function(){if(!e.ok)return Promise.resolve(e.json()).then(function(t){var i=n({code:"network_error",message:"Could not create display",status:e.status,url:o,responseMessage:t.message});return r=1,i})}();return s&&s.then?s.then(i):i(s)})}catch(e){return Promise.reject(e)}}({surveyId:s.id,personId:i.person.id},i)).then(function(e){!0===e.ok?j(e.value.id):l(e.error)})}catch(e){return Promise.reject(e)}}()},[i,s,l]),re(function(){var e;h((e=s.questions.findIndex(function(e){return e.id===b}),e/s.questions.length))},[b,s]);var S=function(r){try{var o=function(){C(!1),u?(h(100),s.thankYouCard.enabled?setTimeout(function(){a()},2e3):a()):d(s.questions[f+1].id)};C(!0);var f=s.questions.findIndex(function(e){return e.id===b}),u=f===s.questions.length-1,c={surveyId:s.id,personId:i.person.id,response:{finished:u,data:r}},p=m?Promise.resolve(function(e,r,o){try{var i=o.apiHost+"/api/v1/client/environments/"+o.environmentId+"/responses/"+r;return Promise.resolve(fetch(i,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){return Promise.resolve(e.json()).then(function(r){return e.ok?t(r):n({code:"network_error",message:"Could not update response",status:e.status,url:i,responseMessage:r.message})})})}catch(e){return Promise.reject(e)}}(c,m,i)).then(function(t){!0!==t.ok?l(t.error):c.response.finished&&e.getInstance().debug("Submitted response")}):Promise.resolve(Promise.all([ce(c,i),de(w,i)])).then(function(e){var t=e[0];!0===t.ok?v(t.value.id):l(t.error)});return Promise.resolve(p&&p.then?p.then(o):o())}catch(e){return Promise.reject(e)}};return y("div",null,y("div",{className:ue(k?"fb-animate-pulse fb-opacity-60":"","fb-text-slate-800 fb-font-sans fb-px-4 fb-py-6 sm:fb-p-6")},100===p&&s.thankYouCard.enabled?y(Se,{headline:s.thankYouCard.headline,subheader:s.thankYouCard.subheader,brandColor:null==(o=i.settings)?void 0:o.brandColor}):s.questions.map(function(e,t){return b===e.id&&y(Ce,{key:e.id,brandColor:f,lastQuestion:t===s.questions.length-1,onSubmit:S,question:e})})),y(pe,{progress:p,brandColor:f}))}function Ie(e){var t,n=e.config,r=e.survey,o=e.closeSurvey,i=e.errorHandler,s=ne(!0),a=s[1],f=function(){a(!1),setTimeout(function(){o()},1e3)};return y("div",{id:"fbjs"},y(be,{isOpen:s[0],close:f},y(Ne,{config:n,survey:r,close:f,brandColor:null==(t=n.settings)?void 0:t.brandColor,errorHandler:i})))}var Pe=e.getInstance(),qe=f.getInstance(),Ee=function(){try{var e=qe.get().apiHost+"/api/v1/client/environments/"+qe.get().environmentId+"/settings";return Promise.resolve(fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:qe.get().person.id})})).then(function(r){var o;function i(e){return o?e:Promise.resolve(r.json()).then(t)}var s=function(){if(!r.ok)return Promise.resolve(r.json()).then(function(t){var i=n({code:"network_error",status:r.status,message:"Error getting settings",url:e,responseMessage:t.message});return o=1,i})}();return s&&s.then?s.then(i):i(s)})}catch(e){return Promise.reject(e)}},He=function(){try{return Pe.debug("Refreshing - getting settings from backend"),Promise.resolve(Ee()).then(function(e){return!0!==e.ok?n(e.error):(Pe.debug("Settings refreshed"),qe.update({settings:e.value}),{ok:!0,value:void 0})})}catch(e){return Promise.reject(e)}},Te="formbricks-web-container",ze=f.getInstance(),Le=e.getInstance(),Oe=o.getInstance(),Me=!1,Ae=function(e){Me?Le.debug("A survey is already running. Skipping."):(Me=!0,function(e,t,n){var r,o;u.__&&u.__(e,t),r=t.__k,o=[],M(t,e=t.__k=y(x,null,[e]),r||g,g,void 0!==t.ownerSVGElement,r?null:t.firstChild?l.call(t.childNodes):null,o,r?r.__e:t.firstChild,!1),A(o,e)}(y(Ie,{config:ze.get(),survey:e,closeSurvey:Fe,errorHandler:Oe.handle}),document.getElementById(Te)))},Fe=function(){try{return document.getElementById(Te).remove(),Ue(),Promise.resolve(Ee()).then(function(e){r(e,function(e){ze.update({settings:e}),Me=!1},function(e){Oe.handle(e)})})}catch(e){return Promise.reject(e)}},Ue=function(){var e=document.createElement("div");e.id=Te,document.body.appendChild(e)},De=e.getInstance(),We=f.getInstance(),Qe=function(e,t){try{return Promise.resolve(fetch(We.get().apiHost+"/api/v1/client/environments/"+We.get().environmentId+"/events",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:We.get().session.id,eventName:e,properties:t})})).then(function(t){var r;function o(t){return r?t:(De.debug('Formbricks: Event "'+e+'" tracked'),Je(e),{ok:!0,value:void 0})}var i=function(){if(!t.ok)return Promise.resolve(t.json()).then(function(e){var o=n({code:"network_error",message:"Error tracking event: "+JSON.stringify(e),status:t.status,url:t.url,responseMessage:e.message});return r=1,o})}();return i&&i.then?i.then(o):o(i)})}catch(e){return Promise.reject(e)}},Je=function(e){for(var t,n=a(null==(r=We.get().settings)?void 0:r.surveys);!(t=n()).done;)for(var r,o,i=t.value,s=a(i.triggers);!(o=s()).done;){var f;if((null==(f=o.value.eventClass)?void 0:f.name)===e)return De.debug("Formbricks: survey "+i.id+' triggered by event "'+e+'"'),void Ae(i)}},Be="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function Ye(e,t,n){if(!e.s){if(n instanceof Re){if(!n.s)return void(n.o=Ye.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(Ye.bind(null,e,t),Ye.bind(null,e,2));e.s=t,e.v=n;var r=e.o;r&&r(e)}}var Re=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){var r=new e,o=this.s;if(o){var i=1&o?t:n;if(i){try{Ye(r,1,i(this.v))}catch(e){Ye(r,2,e)}return r}return this}return this.o=function(e){try{var o=e.v;1&e.s?Ye(r,1,t?t(o):o):n?Ye(r,1,n(o)):Ye(r,2,o)}catch(e){Ye(r,2,e)}},r},e}();function Ve(e){return e instanceof Re&&1&e.s}var Ge=f.getInstance(),Xe=e.getInstance(),$e=o.getInstance(),Ke=function(){try{var e,r=function(t){return e?t:{ok:!0,value:void 0}};Xe.debug("checking page url");var o=Ge.get().settings,i=null==o?void 0:o.noCodeEvents.filter(function(e){var t;return"pageUrl"===(null==(t=e.noCodeConfig)?void 0:t.type)});if(0===i.length)return Promise.resolve({ok:!0,value:void 0});var s=function(e,t,n){if("function"==typeof e[Be]){var r,o,i,s=e[Be]();if(function e(a){try{for(;!((r=s.next()).done||n&&n());)if((a=t(r.value))&&a.then){if(!Ve(a))return void a.then(e,i||(i=Ye.bind(null,o=new Re,2)));a=a.v}o?Ye(o,1,a):o=a}catch(e){Ye(o||(o=new Re),2,e)}}(),s.return){var a=function(e){try{r.done||s.return()}catch(e){}return e};if(o&&o.then)return o.then(a,function(e){throw a(e)});a()}return o}if(!("length"in e))throw new TypeError("Object is not iterable");for(var f=[],l=0;l<e.length;l++)f.push(e[l]);return function(e,t,n){var r,o,i=-1;return function s(a){try{for(;++i<e.length&&(!n||!n());)if((a=t(i))&&a.then){if(!Ve(a))return void a.then(s,o||(o=Ye.bind(null,r=new Re,2)));a=a.v}r?Ye(r,1,a):r=a}catch(e){Ye(r||(r=new Re),2,e)}}(),r}(f,function(e){return t(f[e])},n)}(i,function(r){var o=r.noCodeConfig.pageUrl;if(o){var i=function(e,r,o){var i,s;switch(o){case"exactMatch":i=e===r;break;case"contains":i=e.includes(r);break;case"startsWith":i=e.startsWith(r);break;case"endsWith":i=e.endsWith(r);break;case"notMatch":i=e!==r;break;case"notContains":i=!e.includes(r);break;default:s=n({code:"invalid_match_type",message:"Invalid match type"})}return s||t(i)}(window.location.href,o.value,o.rule);if(!0!==i.ok){var s=n(i.error);return e=1,s}if(!1!==i.value)return Promise.resolve(Qe(r.name)).then(function(t){if(!0!==t.ok){var r=n(t.error);return e=1,r}})}},function(){return e});return Promise.resolve(s&&s.then?s.then(r):r(s))}catch(e){return Promise.reject(e)}},Ze=function(e){var t=Ge.get().settings,n=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"innerHtml"===(null==(t=e.noCodeConfig)?void 0:t.type)}),o=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"cssSelector"===(null==(t=e.noCodeConfig)?void 0:t.type)}),i=e.target;n.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.innerHtml;n&&i.innerHTML===n.value&&Qe(e.name).then(function(e){r(e,function(e){},function(e){$e.handle(e)})})}),o.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.cssSelector;n&&i.matches(n.value)&&Qe(e.name).then(function(e){r(e,function(e){},function(e){$e.handle(e)})})})},et=f.getInstance(),tt=e.getInstance(),nt=function(){try{tt.debug("Creating new person");var e=et.get().apiHost+"/api/v1/client/environments/"+et.get().environmentId+"/people";return Promise.resolve(fetch(e,{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(r){return Promise.resolve(r.json()).then(function(o){return r.ok?t(o):n({code:"network_error",message:"Error creating person",status:r.status,url:e,responseMessage:o.message})})})}catch(e){return Promise.reject(e)}},rt=function(e,t){var n=et.get().person.attributes.find(function(t){var n;return(null==(n=t.attributeClass)?void 0:n.name)===e});return!(!n||n.value!==t)},ot=function(e){try{return tt.debug("setting userId: "+e),rt("userId",e)?(tt.debug("userId already set to this value. Skipping update."),Promise.resolve({ok:!0,value:void 0})):(r=et.get().person.attributes.find(function(e){var t;return"userId"===(null==(t=e.attributeClass)?void 0:t.name)}),r?Promise.resolve(n({code:"attribute_already_exists",message:"userId cannot be changed after it has been set. You need to reset first"})):Promise.resolve(function(e){try{if(!et.get().person||!et.get().person.id)return Promise.resolve(n({code:"missing_person",message:"Unable to update userId. No person set."}));var r=et.get().apiHost+"/api/v1/client/environments/"+et.get().environmentId+"/people/"+et.get().person.id+"/user-id";return Promise.resolve(fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,sessionId:et.get().session.id})})).then(function(e){return Promise.resolve(e.json()).then(function(o){return e.ok?t(o):n({code:"network_error",message:"Error updating person",status:e.status,url:r,responseMessage:o.message})})})}catch(e){return Promise.reject(e)}}(e)).then(function(e){if(!0!==e.ok)return n(e.error);var t=e.value;return et.update({person:t.person,settings:t.settings}),{ok:!0,value:void 0}}))}catch(e){return Promise.reject(e)}var r},it=function(e,o){try{return tt.debug("setting attribute: "+e+" to value: "+o),rt(e,o)?(tt.debug("attribute already set to this value. Skipping update."),Promise.resolve({ok:!0,value:void 0})):Promise.resolve(function(e,r){try{return et.get().person&&et.get().person.id?Promise.resolve(fetch(et.get().apiHost+"/api/v1/client/environments/"+et.get().environmentId+"/people/"+et.get().person.id+"/attribute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e,value:r})})).then(function(e){return Promise.resolve(e.json()).then(function(r){return e.ok?t(r):n({code:"network_error",status:e.status,message:"Error updating person",url:e.url,responseMessage:r.message})})}):Promise.resolve(n({code:"missing_person",message:"Unable to update attribute. No person set."}))}catch(e){return Promise.reject(e)}}(e,o)).then(function(e){var t;return r(e,function(e){et.update({person:e.person,settings:e.settings})},function(e){t=e}),t?n(t):{ok:!0,value:void 0}})}catch(e){return Promise.reject(e)}},st=function(){try{return tt.debug("Resetting person. Getting new person, session and settings from backend"),Promise.resolve(nt()).then(function(e){var t;return r(e,function(e){et.update({person:e.person,session:e.session,settings:e.settings})},function(e){t=e}),t?n(t):{ok:!0,value:void 0}})}catch(e){return Promise.reject(e)}},at=e.getInstance(),ft=f.getInstance(),lt=function(){try{if(!ft.get().person)return Promise.resolve(n({code:"missing_person",message:"Unable to create session. No person found"}));var e=ft.get().apiHost+"/api/v1/client/environments/"+ft.get().environmentId+"/sessions";return Promise.resolve(fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:ft.get().person.id})})).then(function(r){return Promise.resolve(r.json()).then(function(o){return r.ok?t(o):n({code:"network_error",message:"Error creating session",status:r.status,url:e,responseMessage:o.message})})})}catch(e){return Promise.reject(e)}},ut=function(e){var t=i({},e);return t.expiresAt=Date.now()+36e5,t},bt=function(e){return!e||e.expiresAt<=Date.now()},dt=f.getInstance(),ct=e.getInstance(),pt=function(e){try{var t,r=function(e){return t?e:(ct.debug("Add session event listeners"),function(){if("undefined"!=typeof window){var e=window.setInterval(function(){try{return Promise.resolve(function(){try{var e,t=function(t){return e?t:(at.debug("Session not expired, extending session"),ft.update({session:ut(ft.get().session)}),{ok:!0,value:void 0})};at.debug("Checking session");var r=function(){if(bt(ft.get().session))return at.debug("Session expired, creating new session"),Promise.resolve(lt()).then(function(t){if(!0!==t.ok){var r=n(t.error);return e=1,r}var o=t.value;return ft.update({session:o.session,settings:o.settings}),Promise.resolve(Qe("New Session")).then(function(t){if(!0!==t.ok){var r=n(t.error);return e=1,r}return e=1,{ok:!0,value:void 0}})})}();return Promise.resolve(r&&r.then?r.then(t):t(r))}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}},3e5);window.addEventListener("beforeunload",function(){clearInterval(e)})}}(),ct.debug("Add page url event listeners"),"undefined"!=typeof window&&(window.addEventListener("hashchange",Ke),window.addEventListener("popstate",Ke),window.addEventListener("pushstate",Ke),window.addEventListener("replacestate",Ke),window.addEventListener("load",Ke)),ct.debug("Add click event listeners"),"undefined"!=typeof window&&document.addEventListener("click",Ze),ct.debug("Initialized"),Ke(),{ok:!0,value:void 0})};if(ct.debug("Start initialize"),!e.environmentId)return ct.debug("No environmentId provided"),Promise.resolve(n({code:"missing_field",field:"environmentId"}));if(!e.apiHost)return ct.debug("No apiHost provided"),Promise.resolve(n({code:"missing_field",field:"apiHost"}));e.logLevel&&(ct.debug("Setting log level to "+e.logLevel),ct.configure({logLevel:e.logLevel})),ct.debug("Adding widget container to DOM"),Ue(),ct.debug("Adding styles to DOM"),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-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--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-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--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-4){margin-right:1rem}#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-end){justify-content:flex-end}#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-1){padding-left:.25rem;padding-right:.25rem}#fbjs :is(.fb-px-1\\.5){padding-left:.375rem;padding-right:.375rem}#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(.first\\:fb-rounded-l-md:first-child){border-bottom-left-radius:.375rem;border-top-left-radius:.375rem}#fbjs :is(.last\\:fb-rounded-r-md:last-child){border-bottom-right-radius:.375rem;border-top-right-radius:.375rem}#fbjs :is(.hover\\:fb-bg-gray-100:hover){--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}#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}#fbjs :is(.fb-dark .dark\\:fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}@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}}.fb-editor-text-bold{font-weight:700!important}.fb-editor-text-italic{font-style:italic!important}.fb-editor-link{color:#334155!important;text-decoration:underline!important}.editor-tokenFunction{color:#dd4a68!important}.fb-editor-paragraph{color:#334155!important;margin:0!important;position:relative!important}.fb-editor-paragraph:last-child{margin-bottom:0!important}.fb-editor-heading-h1{font-size:25px!important;font-weight:400!important}.fb-editor-heading-h1,.fb-editor-heading-h2{font-weight:700!important;margin-bottom:20px!important}.fb-editor-heading-h2{font-size:20px!important}.fb-editor-list-ol,.fb-editor-list-ul{margin-bottom:12px!important}.fb-editor-listitem{margin:0 32px!important}.fb-editor-nested-listitem{list-style-type:none!important}',document.head.appendChild(e)}}();var o=function(){if(dt.get().session&&dt.get().environmentId===e.environmentId&&dt.get().apiHost===e.apiHost){ct.debug("Found existing configuration. Checking session.");var r=dt.get().session;return function(){if(bt(r))return ct.debug("Session expired. Creating new session."),Promise.resolve(lt()).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}var o=e.value,i=o.settings;return dt.update({session:ut(o.session),settings:i}),Promise.resolve(Qe("New Session")).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}})});ct.debug("Session valid. Extending session."),dt.update({session:ut(r)})}()}return ct.debug("No valid session found. Creating new config."),dt.update({environmentId:e.environmentId,apiHost:e.apiHost}),ct.debug("Get person, session and settings from server"),Promise.resolve(nt()).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}var o=e.value,i=o.settings;return dt.update({person:o.person,session:ut(o.session),settings:i}),Promise.resolve(Qe("New Session")).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}})})}();return Promise.resolve(o&&o.then?o.then(r):r(o))}catch(e){return Promise.reject(e)}};function ht(e,t,n){if(!e.s){if(n instanceof mt){if(!n.s)return void(n.o=ht.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(ht.bind(null,e,t),ht.bind(null,e,2));e.s=t,e.v=n;var r=e.o;r&&r(e)}}var gt=e.getInstance();const mt=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){const r=new e,o=this.s;if(o){const e=1&o?t:n;if(e){try{ht(r,1,e(this.v))}catch(e){ht(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?ht(r,1,t?t(o):o):n?ht(r,1,n(o)):ht(r,2,o)}catch(e){ht(r,2,e)}},r},e}();function vt(e){return e instanceof mt&&1&e.s}var _t=/*#__PURE__*/function(){function e(){this.queue=[],this.running=!1}var t=e.prototype;return t.add=function(e,t){void 0===e&&(e=!0);var n=[].slice.call(arguments,2);gt.debug("Add command to queue: "+t.name+"("+JSON.stringify(n)+")"),this.queue.push({command:t,checkInitialized:e,commandArgs:n}),this.running||this.run()},t.run=function(){try{var e=function(){t.running=!1},t=this;t.running=!0;var r=function(e,t,n){for(var r;;){var o=e();if(vt(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!vt(i)){r=1;break}i=i.s}}var s=new mt,a=ht.bind(null,s,2);return(0===r?o.then(l):1===r?i.then(f):(void 0).then(function(){(o=e())?o.then?o.then(l).then(void 0,a):l(o):ht(s,1,i)})).then(void 0,a),s;function f(t){i=t;do{if(!(o=e())||vt(o)&&!o.v)return void ht(s,1,i);if(o.then)return void o.then(l).then(void 0,a);vt(i=n())&&(i=i.v)}while(!i||!i.then);i.then(f).then(void 0,a)}function l(e){e?(i=n())&&i.then?i.then(f).then(void 0,a):f(i):ht(s,1,i)}}(function(){return t.queue.length>0},0,function(){var e=o.getInstance(),r=t.queue.shift();if(r.checkInitialized){var i=(ct.debug("Check if initialized"),dt.get().apiHost&&dt.get().environmentId&&dt.get().person&&dt.get().session&&dt.get().settings&&o.initialized?{ok:!0,value:void 0}:n({code:"not_initialized",message:"Formbricks not initialized. Call initialize() first."}));i&&!0!==i.ok&&e.handle(i.error)}return Promise.resolve(r.command.apply(null,r.commandArgs)).then(function(t){t&&(gt.debug("Command result: "+(!0===t.ok?"OK":"Something went really wrong")+", "+r.command.name),!0!==t.ok&&e.handle(t.error))})});return Promise.resolve(r&&r.then?r.then(e):e())}catch(e){return Promise.reject(e)}},e}();e.getInstance().debug("Create command queue");var wt=new _t,yt=function(e,t){wt.add(!0,it,e,t)};return{init:function(e){o.init(e.errorHandler),wt.add(!1,pt,e)},setUserId:function(e){wt.add(!0,ot,e)},setEmail:function(e){yt("email",e)},setAttribute:yt,track:function(e,t){void 0===t&&(t={}),wt.add(!0,Qe,e,t)},logout:function(){wt.add(!0,st)},refresh:function(){wt.add(!0,He)},registerRouteChange:function(){wt.add(!0,Ke)}}});
!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(){var e=/*#__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}();e.instance=void 0;var t=function(e){return{ok:!0,value:e}},n=function(e){return{ok:!1,error:e}};function r(e,t,n){return!0===e.ok?t(e.value):n(e.error)}e.getInstance();var o=/*#__PURE__*/function(){function t(t){this.handleError=void 0,this.handleError=t||function(t){return e.getInstance().error(JSON.stringify(t))}}return t.getInstance=function(){return t.instance||(t.instance=new t),t.instance},t.init=function(e){this.initialized=!0,console.log("🧱 Formbricks - initializing error handler"),console.log("🧱 Formbricks - Custom error handler: ","function"==typeof e?"yes":"no"),t.instance=new t(e)},t.prototype.handle=function(e){this.handleError(e)},t}();function i(){return i=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},i.apply(this,arguments)}function s(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 a(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 s(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)?s(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.")}o.instance=void 0,o.initialized=!1;var f=/*#__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=i({},this.config,e),this.saveToLocalStorage())},t.get=function(){return this.config},t.loadFromLocalStorage=function(){if("undefined"!=typeof window){var e=localStorage.getItem("formbricksConfig");if(e)return JSON.parse(e)}return{apiHost:null,environmentId:null}},t.saveToLocalStorage=function(){var e,t=this;return(e=function(){return localStorage.setItem("formbricksConfig",JSON.stringify(t.config))},function(){try{return{ok:!0,value:e.apply(void 0,[].slice.call(arguments))}}catch(e){return{ok:!1,error:e}}})()},e}();f.instance=void 0;var l,u,b,d,c,p,h,m={},g=[],v=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function _(e,t){for(var n in t)e[n]=t[n];return e}function w(e){var t=e.parentNode;t&&t.removeChild(e)}function y(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?l.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 j(e,s,r,o,null)}function j(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?++b:o};return null==o&&null!=u.vnode&&u.vnode(i),i}function x(e){return e.children}function k(e,t){this.props=e,this.context=t}function C(e,t){if(null==t)return e.__?C(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?C(e):null}function S(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 S(e)}}function N(e){(!e.__d&&(e.__d=!0)&&d.push(e)&&!I.__r++||c!==u.debounceRendering)&&((c=u.debounceRendering)||p)(I)}function I(){var e,t,n,r,o,i,s,a;for(d.sort(h);e=d.shift();)e.__d&&(t=d.length,r=void 0,o=void 0,s=(i=(n=e).__v).__e,(a=n.__P)&&(r=[],(o=_({},i)).__v=i.__v+1,M(a,i,o,n.__n,void 0!==a.ownerSVGElement,null!=i.__h?[s]:null,r,null==s?C(i):s,i.__h),A(r,i),i.__e!=s&&S(i)),d.length>t&&d.sort(h));I.__r=0}function P(e,t,n,r,o,i,s,a,f,l){var u,b,d,c,p,h,v,_=r&&r.__k||g,w=_.length;for(n.__k=[],u=0;u<t.length;u++)if(null!=(c=n.__k[u]=null==(c=t[u])||"boolean"==typeof c||"function"==typeof c?null:"string"==typeof c||"number"==typeof c||"bigint"==typeof c?j(null,c,null,null,c):Array.isArray(c)?j(x,{children:c},null,null,null):c.__b>0?j(c.type,c.props,c.key,c.ref?c.ref:null,c.__v):c)){if(c.__=n,c.__b=n.__b+1,null===(d=_[u])||d&&c.key==d.key&&c.type===d.type)_[u]=void 0;else for(b=0;b<w;b++){if((d=_[b])&&c.key==d.key&&c.type===d.type){_[b]=void 0;break}d=null}M(e,c,d=d||m,o,i,s,a,f,l),p=c.__e,(b=c.ref)&&d.ref!=b&&(v||(v=[]),d.ref&&v.push(d.ref,null,c),v.push(b,c.__c||p,c)),null!=p?(null==h&&(h=p),"function"==typeof c.type&&c.__k===d.__k?c.__d=f=q(c,f,e):f=E(e,c,d,_,p,f),"function"==typeof n.type&&(n.__d=f)):f&&d.__e==f&&f.parentNode!=e&&(f=C(d))}for(n.__e=h,u=w;u--;)null!=_[u]&&("function"==typeof n.type&&null!=_[u].__e&&_[u].__e==n.__d&&(n.__d=H(r).nextSibling),D(_[u],_[u]));if(v)for(u=0;u<v.length;u++)U(v[u],v[++u],v[++u])}function q(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?q(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 H(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=H(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||v.test(t)?n:n+"px"}function z(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?O:L,i):e.removeEventListener(t,i?O:L,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 L(e){return this.l[e.type+!1](u.event?u.event(e):e)}function O(e){return this.l[e.type+!0](u.event?u.event(e):e)}function M(e,t,n,r,o,i,s,a,f){var l,b,d,c,p,h,m,g,v,w,y,j,C,S,N,I=t.type;if(void 0!==t.constructor)return null;null!=n.__h&&(f=n.__h,a=t.__e=n.__e,t.__h=null,i=[a]),(l=u.__b)&&l(t);try{e:if("function"==typeof I){if(g=t.props,v=(l=I.contextType)&&r[l.__c],w=l?v?v.props.value:l.__:r,n.__c?m=(b=t.__c=n.__c).__=b.__E:("prototype"in I&&I.prototype.render?t.__c=b=new I(g,w):(t.__c=b=new k(g,w),b.constructor=I,b.render=W),v&&v.sub(b),b.props=g,b.state||(b.state={}),b.context=w,b.__n=r,d=b.__d=!0,b.__h=[],b._sb=[]),null==b.__s&&(b.__s=b.state),null!=I.getDerivedStateFromProps&&(b.__s==b.state&&(b.__s=_({},b.__s)),_(b.__s,I.getDerivedStateFromProps(g,b.__s))),c=b.props,p=b.state,b.__v=t,d)null==I.getDerivedStateFromProps&&null!=b.componentWillMount&&b.componentWillMount(),null!=b.componentDidMount&&b.__h.push(b.componentDidMount);else{if(null==I.getDerivedStateFromProps&&g!==c&&null!=b.componentWillReceiveProps&&b.componentWillReceiveProps(g,w),!b.__e&&null!=b.shouldComponentUpdate&&!1===b.shouldComponentUpdate(g,b.__s,w)||t.__v===n.__v){for(t.__v!==n.__v&&(b.props=g,b.state=b.__s,b.__d=!1),b.__e=!1,t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(e){e&&(e.__=t)}),y=0;y<b._sb.length;y++)b.__h.push(b._sb[y]);b._sb=[],b.__h.length&&s.push(b);break e}null!=b.componentWillUpdate&&b.componentWillUpdate(g,b.__s,w),null!=b.componentDidUpdate&&b.__h.push(function(){b.componentDidUpdate(c,p,h)})}if(b.context=w,b.props=g,b.__P=e,j=u.__r,C=0,"prototype"in I&&I.prototype.render){for(b.state=b.__s,b.__d=!1,j&&j(t),l=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,j&&j(t),l=b.render(b.props,b.state,b.context),b.state=b.__s}while(b.__d&&++C<25);b.state=b.__s,null!=b.getChildContext&&(r=_(_({},r),b.getChildContext())),d||null==b.getSnapshotBeforeUpdate||(h=b.getSnapshotBeforeUpdate(c,p)),N=null!=l&&l.type===x&&null==l.key?l.props.children:l,P(e,Array.isArray(N)?N:[N],t,n,r,o,i,s,a,f),b.base=t.__e,t.__h=null,b.__h.length&&s.push(b),m&&(b.__E=b.__=null),b.__e=!1}else null==i&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=F(n.__e,t,n,r,o,i,s,f);(l=u.diffed)&&l(t)}catch(e){t.__v=null,(f||null!=i)&&(t.__e=a,t.__h=!!f,i[i.indexOf(a)]=null),u.__e(e,t,n)}}function A(e,t){u.__c&&u.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){u.__e(e,t.__v)}})}function F(e,t,n,r,o,i,s,a){var f,u,b,d=n.props,c=t.props,p=t.type,h=0;if("svg"===p&&(o=!0),null!=i)for(;h<i.length;h++)if((f=i[h])&&"setAttribute"in f==!!p&&(p?f.localName===p:3===f.nodeType)){e=f,i[h]=null;break}if(null==e){if(null===p)return document.createTextNode(c);e=o?document.createElementNS("http://www.w3.org/2000/svg",p):document.createElement(p,c.is&&c),i=null,a=!1}if(null===p)d===c||a&&e.data===c||(e.data=c);else{if(i=i&&l.call(e.childNodes),u=(d=n.props||m).dangerouslySetInnerHTML,b=c.dangerouslySetInnerHTML,!a){if(null!=i)for(d={},h=0;h<e.attributes.length;h++)d[e.attributes[h].name]=e.attributes[h].value;(b||u)&&(b&&(u&&b.__html==u.__html||b.__html===e.innerHTML)||(e.innerHTML=b&&b.__html||""))}if(function(e,t,n,r,o){var i;for(i in n)"children"===i||"key"===i||i in t||z(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]||z(e,i,t[i],n[i],r)}(e,c,d,o,a),b)t.__k=[];else if(h=t.props.children,P(e,Array.isArray(h)?h:[h],t,n,r,o&&"foreignObject"!==p,i,s,i?i[0]:n.__k&&C(n,0),a),null!=i)for(h=i.length;h--;)null!=i[h]&&w(i[h]);a||("value"in c&&void 0!==(h=c.value)&&(h!==e.value||"progress"===p&&!h||"option"===p&&h!==d.value)&&z(e,"value",h,d.value,!1),"checked"in c&&void 0!==(h=c.checked)&&h!==e.checked&&z(e,"checked",h,d.checked,!1))}return e}function U(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){u.__e(e,n)}}function D(e,t,n){var r,o;if(u.unmount&&u.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){u.__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]&&D(r[o],t,n||"function"!=typeof e.type);n||null==e.__e||w(e.__e),e.__=e.__e=e.__d=void 0}function W(e,t,n){return this.constructor(e,n)}l=g.slice,u={__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}},b=0,k.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=_({},this.state),"function"==typeof e&&(e=e(_({},n),this.props)),e&&_(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),N(this))},k.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),N(this))},k.prototype.render=x,d=[],p="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,h=function(e,t){return e.__v.__b-t.__v.__b},I.__r=0;var Q,J,B,Y,R=0,V=[],G=[],X=u.__b,$=u.__r,K=u.diffed,Z=u.__c,ee=u.unmount;function te(e,t){u.__h&&u.__h(J,e,R||t),R=0;var n=J.__H||(J.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:G}),n.__[e]}function ne(e){return R=1,function(e,t,n){var r=te(Q++,2);if(r.t=e,!r.__c&&(r.__=[le(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=J,!J.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))};J.u=!0;var i=J.shouldComponentUpdate,s=J.componentWillUpdate;J.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)},J.shouldComponentUpdate=o}return r.__N||r.__}(le,e)}function re(e,t){var n=te(Q++,3);!u.__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,J.__H.__h.push(n))}function oe(){for(var e;e=V.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ae),e.__H.__h.forEach(fe),e.__H.__h=[]}catch(t){e.__H.__h=[],u.__e(t,e.__v)}}u.__b=function(e){J=null,X&&X(e)},u.__r=function(e){$&&$(e),Q=0;var t=(J=e.__c).__H;t&&(B===J?(t.__h=[],J.__h=[],t.__.forEach(function(e){e.__N&&(e.__=e.__N),e.__V=G,e.__N=e.i=void 0})):(t.__h.forEach(ae),t.__h.forEach(fe),t.__h=[])),B=J},u.diffed=function(e){K&&K(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==V.push(t)&&Y===u.requestAnimationFrame||((Y=u.requestAnimationFrame)||se)(oe)),t.__H.__.forEach(function(e){e.i&&(e.__H=e.i),e.__V!==G&&(e.__=e.__V),e.i=void 0,e.__V=G})),B=J=null},u.__c=function(e,t){t.some(function(e){try{e.__h.forEach(ae),e.__h=e.__h.filter(function(e){return!e.__||fe(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],u.__e(n,e.__v)}}),Z&&Z(e,t)},u.unmount=function(e){ee&&ee(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(e){try{ae(e)}catch(e){t=e}}),n.__H=void 0,t&&u.__e(t,n.__v))};var ie="function"==typeof requestAnimationFrame;function se(e){var t,n=function(){clearTimeout(r),ie&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);ie&&(t=requestAnimationFrame(n))}function ae(e){var t=J,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),J=t}function fe(e){var t=J;e.__c=e.__(),J=t}function le(e,t){return"function"==typeof t?t(e):t}var ue=function(){return[].slice.call(arguments).filter(Boolean).join(" ")};function be(e){var t=e.children,n=e.isOpen,r=e.close,o=ne(!1),i=o[0],s=o[1];return re(function(){s(n)},[n]),y("div",{"aria-live":"assertive",className:"fb-pointer-events-none fb-fixed fb-inset-0 fb-flex fb-items-end fb-z-40"},y("div",{className:"fb-flex fb-w-full fb-flex-col fb-items-center fb-space-y-4 sm:fb-items-end"},y("div",{className:ue(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-m-4")},y("div",{class:"fb-absolute fb-top-0 fb-right-0 fb-hidden fb-pt-4 fb-pr-4 sm:fb-block"},y("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"},y("span",{class:"fb-sr-only"},"Close"),y("svg",{class:"fb-h-6 fb-w-6",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true"},y("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})))),y("div",{className:""},t))))}var de=function(e,t){try{var r=t.apiHost+"/api/v1/client/environments/"+t.environmentId+"/displays/"+e+"/responded";return Promise.resolve(fetch(r,{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(e){var t;function o(e){return t?e:{ok:!0,value:void 0}}var i=function(){if(!e.ok)return Promise.resolve(e.json()).then(function(o){var i=n({code:"network_error",message:"Could not mark display as responded",status:e.status,url:r,responseMessage:o.message});return t=1,i})}();return i&&i.then?i.then(o):o(i)})}catch(e){return Promise.reject(e)}},ce=function(e,r){try{var o=r.apiHost+"/api/v1/client/environments/"+r.environmentId+"/responses";return Promise.resolve(fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){return Promise.resolve(e.json()).then(function(r){return e.ok?t(r):n({code:"network_error",message:"Could not create response",status:e.status,url:o,responseMessage:r.message})})})}catch(e){return Promise.reject(e)}};function pe(e){return y("div",{className:"fb-h-1 fb-w-full fb-rounded-full bg-slate-200"},y("div",{className:"fb-h-1 fb-rounded-full",style:{backgroundColor:e.brandColor,width:Math.floor(100*e.progress)+"%"}}))}function he(e){return y("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 me(e){return y("label",{htmlFor:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600"},e.subheader)}function ge(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return y("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)}},y(he,{headline:t.headline,questionId:t.id}),y(me,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-mt-4"},y("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"})),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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 ve(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne(null),s=i[0],a=i[1];return y("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=e.currentTarget[t.id].value,r);n(o),a(null)}},y(he,{headline:t.headline,questionId:t.id}),y(me,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-mt-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Options"),y("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e,n){return y("label",{key:e.id,className:ue(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")},y("span",{className:"fb-flex fb-items-center fb-text-sm"},y("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}),y("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne([]),s=i[0],a=i[1],f=function(){return s.length>0};return y("form",{onSubmit:function(e){var r;if(e.preventDefault(),f()||!t.required){var o=((r={})[t.id]=s,r);n(o),a([])}}},y(he,{headline:t.headline,questionId:t.id}),y(me,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-mt-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Options"),y("div",{className:"fb-relative fb-space-y-2 fb-rounded-md fb-bg-white"},t.choices&&t.choices.map(function(e){return y("label",{key:e.id,className:ue(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")},y("span",{className:"fb-flex fb-items-center fb-text-sm"},y("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}}),y("span",{id:e.id+"-label",className:"fb-ml-3 fb-font-medium"},e.label)))})))),y("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":""}),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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 we(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne(null),s=i[0],a=i[1];return y("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=s,r);n(o)}},y(he,{headline:t.headline,questionId:t.id}),y(me,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-my-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Options"),y("div",{className:"fb-flex"},Array.from({length:11},function(e,t){return t}).map(function(e){return y("label",{key:e,className:ue(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 first:fb-rounded-l-md last:fb-rounded-r-md hover:fb-bg-gray-100 focus:fb-outline-none")},y("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 function(e){var r;a(e),t.required&&n(((r={})[t.id]=e,r))}(e)},required:t.required}),e)})),y("div",{className:"fb-flex fb-justify-between fb-text-slate-500 fb-leading-6 fb-px-1.5 fb-text-xs"},y("p",null,t.lowerLabel),y("p",null,t.upperLabel)))),!t.required&&y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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 ye(e){function t(e,t){var n=t.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(e)||!n.includes("javascript:")&&!n.includes("data:"))||!!e.startsWith("on")||void 0}function n(e){for(var n,r=a(e.attributes);!(n=r()).done;){var o=n.value,i=o.name;t(i,o.value)&&e.removeAttribute(i)}}var r=(new DOMParser).parseFromString(e,"text/html").body||document.createElement("body");return function(e){for(var t,n=a(e.querySelectorAll("script"));!(t=n()).done;)t.value.remove()}(r),function e(t){for(var r,o=a(t.children);!(r=o()).done;){var i=r.value;n(i),e(i)}}(r),r.innerHTML}function je(e){return y("label",{htmlFor:e.questionId,className:"fb-block fb-text-sm fb-font-normal fb-leading-6 text-slate-600",dangerouslySetInnerHTML:{__html:ye(e.htmlString)}})}function xe(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return y("div",null,y(he,{headline:t.headline,questionId:t.id}),y(je,{htmlString:t.html,questionId:t.id}),y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-end"},y("div",null),!t.required&&y("button",{type:"button",onClick:function(){var e;n(((e={})[t.id]="dismissed",e))},className:"fb-flex fb-items-center dark:fb-text-slate-400 fb-rounded-md fb-px-3 fb-py-3 fb-text-base fb-font-medium fb-leading-4 fb-hover:opacity-90 fb-focus:outline-none fb-focus:ring-2 fb-focus:ring-slate-500 fb-focus:ring-offset-2 fb-mr-4"},t.dismissButtonLabel||"Skip"),y("button",{type:"button",onClick:function(){var e,r,o;t.buttonExternal&&t.buttonUrl&&(null==(r=window)||null==(o=r.open(t.buttonUrl,"_blank"))||o.focus()),n(((e={})[t.id]="clicked",e))},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 ke(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor,i=ne(null),s=i[0],a=i[1];return y("form",{onSubmit:function(e){var r;e.preventDefault();var o=((r={})[t.id]=s,r);a(null),n(o)}},y(he,{headline:t.headline,questionId:t.id}),y(me,{subheader:t.subheader,questionId:t.id}),y("div",{className:"fb-my-4"},y("fieldset",null,y("legend",{className:"fb-sr-only"},"Choices"),y("div",{className:"fb-flex"},Array.from({length:t.range},function(e,t){return t+1}).map(function(e){return y("label",{key:e,className:ue(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 first:fb-rounded-l-md last:fb-rounded-r-md hover:fb-bg-gray-100 focus:fb-outline-none")},y("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 function(e){var r;a(e),t.required&&(n(((r={})[t.id]=e,r)),a(null))}(e)},required:t.required}),e)})),y("div",{className:"fb-flex fb-justify-between fb-text-slate-500 fb-leading-6 fb-px-1.5 fb-text-xs"},y("p",null,t.lowerLabel),y("p",null,t.upperLabel)))),!t.required&&y("div",{className:"fb-mt-4 fb-flex fb-w-full fb-justify-between"},y("div",null),y("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-slate-500 focus:fb-ring-offset-2",style:{backgroundColor:o}},t.buttonLabel||(r?"Finish":"Next"))))}function Ce(e){var t=e.question,n=e.onSubmit,r=e.lastQuestion,o=e.brandColor;return"openText"===t.type?y(ge,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceSingle"===t.type?y(ve,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"multipleChoiceMulti"===t.type?y(_e,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"nps"===t.type?y(we,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"cta"===t.type?y(xe,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):"rating"===t.type?y(ke,{question:t,onSubmit:n,lastQuestion:r,brandColor:o}):null}function Se(e){var t=e.headline,n=e.subheader;return y("div",{className:"fb-text-center"},y("div",{className:"fb-flex fb-items-center fb-justify-center",style:{color:e.brandColor}},y("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"},y("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"}))),y("span",{className:"fb-inline-block fb-rounded-[100%] fb-w-16 fb-h-1 fb-mb-[10px] fb-bg-slate-300"}),y("div",null,y(he,{headline:t,questionId:"thankYouCard",style:{"margin-right":0}}),y(me,{subheader:n,questionId:"thankYouCard"})))}function Ne(r){var o,i=r.config,s=r.survey,a=r.close,f=r.brandColor,l=r.errorHandler,u=ne(s.questions[0].id),b=u[0],d=u[1],c=ne(0),p=c[0],h=c[1],m=ne(null),g=m[0],v=m[1],_=ne(null),w=_[0],j=_[1],x=ne(!1),k=x[0],C=x[1];re(function(){!function(){try{Promise.resolve(function(e,r){try{var o=r.apiHost+"/api/v1/client/environments/"+r.environmentId+"/displays";return Promise.resolve(fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){var r;function i(n){return r?n:Promise.resolve(e.json()).then(t)}var s=function(){if(!e.ok)return Promise.resolve(e.json()).then(function(t){var i=n({code:"network_error",message:"Could not create display",status:e.status,url:o,responseMessage:t.message});return r=1,i})}();return s&&s.then?s.then(i):i(s)})}catch(e){return Promise.reject(e)}}({surveyId:s.id,personId:i.person.id},i)).then(function(e){!0===e.ok?j(e.value.id):l(e.error)})}catch(e){return Promise.reject(e)}}()},[i,s,l]),re(function(){var e;h((e=s.questions.findIndex(function(e){return e.id===b}),e/s.questions.length))},[b,s]);var S=function(r){try{var o=function(){C(!1),u?(h(100),s.thankYouCard.enabled?setTimeout(function(){a()},2e3):a()):d(s.questions[f+1].id)};C(!0);var f=s.questions.findIndex(function(e){return e.id===b}),u=f===s.questions.length-1,c={surveyId:s.id,personId:i.person.id,response:{finished:u,data:r}},p=g?Promise.resolve(function(e,r,o){try{var i=o.apiHost+"/api/v1/client/environments/"+o.environmentId+"/responses/"+r;return Promise.resolve(fetch(i,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).then(function(e){return Promise.resolve(e.json()).then(function(r){return e.ok?t(r):n({code:"network_error",message:"Could not update response",status:e.status,url:i,responseMessage:r.message})})})}catch(e){return Promise.reject(e)}}(c,g,i)).then(function(t){!0!==t.ok?l(t.error):c.response.finished&&e.getInstance().debug("Submitted response")}):Promise.resolve(Promise.all([ce(c,i),de(w,i)])).then(function(e){var t=e[0];!0===t.ok?v(t.value.id):l(t.error)});return Promise.resolve(p&&p.then?p.then(o):o())}catch(e){return Promise.reject(e)}};return y("div",null,y("div",{className:ue(k?"fb-animate-pulse fb-opacity-60":"","fb-text-slate-800 fb-font-sans fb-px-4 fb-py-6 sm:fb-p-6")},100===p&&s.thankYouCard.enabled?y(Se,{headline:s.thankYouCard.headline,subheader:s.thankYouCard.subheader,brandColor:null==(o=i.settings)?void 0:o.brandColor}):s.questions.map(function(e,t){return b===e.id&&y(Ce,{key:e.id,brandColor:f,lastQuestion:t===s.questions.length-1,onSubmit:S,question:e})})),y(pe,{progress:p,brandColor:f}))}function Ie(e){var t,n=e.config,r=e.survey,o=e.closeSurvey,i=e.errorHandler,s=ne(!0),a=s[1],f=function(){a(!1),setTimeout(function(){o()},1e3)};return y("div",{id:"fbjs"},y(be,{isOpen:s[0],close:f},y(Ne,{config:n,survey:r,close:f,brandColor:null==(t=n.settings)?void 0:t.brandColor,errorHandler:i})))}var Pe=e.getInstance(),qe=f.getInstance(),Ee=function(){try{var e=qe.get().apiHost+"/api/v1/client/environments/"+qe.get().environmentId+"/settings";return Promise.resolve(fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:qe.get().person.id})})).then(function(r){var o;function i(e){return o?e:Promise.resolve(r.json()).then(t)}var s=function(){if(!r.ok)return Promise.resolve(r.json()).then(function(t){var i=n({code:"network_error",status:r.status,message:"Error getting settings",url:e,responseMessage:t.message});return o=1,i})}();return s&&s.then?s.then(i):i(s)})}catch(e){return Promise.reject(e)}},He=function(){try{return Pe.debug("Refreshing - getting settings from backend"),Promise.resolve(Ee()).then(function(e){return!0!==e.ok?n(e.error):(Pe.debug("Settings refreshed"),qe.update({settings:e.value}),{ok:!0,value:void 0})})}catch(e){return Promise.reject(e)}},Te="formbricks-web-container",ze=f.getInstance(),Le=e.getInstance(),Oe=o.getInstance(),Me=!1,Ae=function(e){Me?Le.debug("A survey is already running. Skipping."):(Me=!0,function(e,t,n){var r,o;u.__&&u.__(e,t),r=t.__k,o=[],M(t,e=t.__k=y(x,null,[e]),r||m,m,void 0!==t.ownerSVGElement,r?null:t.firstChild?l.call(t.childNodes):null,o,r?r.__e:t.firstChild,!1),A(o,e)}(y(Ie,{config:ze.get(),survey:e,closeSurvey:Fe,errorHandler:Oe.handle}),document.getElementById(Te)))},Fe=function(){try{return document.getElementById(Te).remove(),Ue(),Promise.resolve(Ee()).then(function(e){r(e,function(e){ze.update({settings:e}),Me=!1},function(e){Oe.handle(e)})})}catch(e){return Promise.reject(e)}},Ue=function(){var e=document.createElement("div");e.id=Te,document.body.appendChild(e)},De=e.getInstance(),We=f.getInstance(),Qe=function(e,t){try{return Promise.resolve(fetch(We.get().apiHost+"/api/v1/client/environments/"+We.get().environmentId+"/events",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:We.get().session.id,eventName:e,properties:t})})).then(function(t){var r;function o(t){return r?t:(De.debug('Formbricks: Event "'+e+'" tracked'),Je(e),{ok:!0,value:void 0})}var i=function(){if(!t.ok)return Promise.resolve(t.json()).then(function(e){var o=n({code:"network_error",message:"Error tracking event: "+JSON.stringify(e),status:t.status,url:t.url,responseMessage:e.message});return r=1,o})}();return i&&i.then?i.then(o):o(i)})}catch(e){return Promise.reject(e)}},Je=function(e){for(var t,n=a(null==(r=We.get().settings)?void 0:r.surveys);!(t=n()).done;)for(var r,o,i=t.value,s=a(i.triggers);!(o=s()).done;){var f;if((null==(f=o.value.eventClass)?void 0:f.name)===e)return De.debug("Formbricks: survey "+i.id+' triggered by event "'+e+'"'),void Ae(i)}},Be="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function Ye(e,t,n){if(!e.s){if(n instanceof Re){if(!n.s)return void(n.o=Ye.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(Ye.bind(null,e,t),Ye.bind(null,e,2));e.s=t,e.v=n;var r=e.o;r&&r(e)}}var Re=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){var r=new e,o=this.s;if(o){var i=1&o?t:n;if(i){try{Ye(r,1,i(this.v))}catch(e){Ye(r,2,e)}return r}return this}return this.o=function(e){try{var o=e.v;1&e.s?Ye(r,1,t?t(o):o):n?Ye(r,1,n(o)):Ye(r,2,o)}catch(e){Ye(r,2,e)}},r},e}();function Ve(e){return e instanceof Re&&1&e.s}var Ge=f.getInstance(),Xe=e.getInstance(),$e=o.getInstance(),Ke=function(){try{var e,r=function(t){return e?t:{ok:!0,value:void 0}};Xe.debug("checking page url");var o=Ge.get().settings,i=null==o?void 0:o.noCodeEvents.filter(function(e){var t;return"pageUrl"===(null==(t=e.noCodeConfig)?void 0:t.type)});if(0===i.length)return Promise.resolve({ok:!0,value:void 0});var s=function(e,t,n){if("function"==typeof e[Be]){var r,o,i,s=e[Be]();if(function e(a){try{for(;!((r=s.next()).done||n&&n());)if((a=t(r.value))&&a.then){if(!Ve(a))return void a.then(e,i||(i=Ye.bind(null,o=new Re,2)));a=a.v}o?Ye(o,1,a):o=a}catch(e){Ye(o||(o=new Re),2,e)}}(),s.return){var a=function(e){try{r.done||s.return()}catch(e){}return e};if(o&&o.then)return o.then(a,function(e){throw a(e)});a()}return o}if(!("length"in e))throw new TypeError("Object is not iterable");for(var f=[],l=0;l<e.length;l++)f.push(e[l]);return function(e,t,n){var r,o,i=-1;return function s(a){try{for(;++i<e.length&&(!n||!n());)if((a=t(i))&&a.then){if(!Ve(a))return void a.then(s,o||(o=Ye.bind(null,r=new Re,2)));a=a.v}r?Ye(r,1,a):r=a}catch(e){Ye(r||(r=new Re),2,e)}}(),r}(f,function(e){return t(f[e])},n)}(i,function(r){var o=r.noCodeConfig.pageUrl;if(o){var i=function(e,r,o){var i,s;switch(o){case"exactMatch":i=e===r;break;case"contains":i=e.includes(r);break;case"startsWith":i=e.startsWith(r);break;case"endsWith":i=e.endsWith(r);break;case"notMatch":i=e!==r;break;case"notContains":i=!e.includes(r);break;default:s=n({code:"invalid_match_type",message:"Invalid match type"})}return s||t(i)}(window.location.href,o.value,o.rule);if(!0!==i.ok){var s=n(i.error);return e=1,s}if(!1!==i.value)return Promise.resolve(Qe(r.name)).then(function(t){if(!0!==t.ok){var r=n(t.error);return e=1,r}})}},function(){return e});return Promise.resolve(s&&s.then?s.then(r):r(s))}catch(e){return Promise.reject(e)}},Ze=function(e){var t=Ge.get().settings,n=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"innerHtml"===(null==(t=e.noCodeConfig)?void 0:t.type)}),o=null==t?void 0:t.noCodeEvents.filter(function(e){var t;return"cssSelector"===(null==(t=e.noCodeConfig)?void 0:t.type)}),i=e.target;n.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.innerHtml;n&&i.innerHTML===n.value&&Qe(e.name).then(function(e){r(e,function(e){},function(e){$e.handle(e)})})}),o.forEach(function(e){var t,n=null==(t=e.noCodeConfig)?void 0:t.cssSelector;n&&i.matches(n.value)&&Qe(e.name).then(function(e){r(e,function(e){},function(e){$e.handle(e)})})})},et=f.getInstance(),tt=e.getInstance(),nt=function(){try{tt.debug("Creating new person");var e=et.get().apiHost+"/api/v1/client/environments/"+et.get().environmentId+"/people";return Promise.resolve(fetch(e,{method:"POST",headers:{"Content-Type":"application/json"}})).then(function(r){return Promise.resolve(r.json()).then(function(o){return r.ok?t(o):n({code:"network_error",message:"Error creating person",status:r.status,url:e,responseMessage:o.message})})})}catch(e){return Promise.reject(e)}},rt=function(e,t){var n=et.get().person.attributes.find(function(t){var n;return(null==(n=t.attributeClass)?void 0:n.name)===e});return!(!n||n.value!==t)},ot=function(e){try{return tt.debug("setting userId: "+e),rt("userId",e)?(tt.debug("userId already set to this value. Skipping update."),Promise.resolve({ok:!0,value:void 0})):(r=et.get().person.attributes.find(function(e){var t;return"userId"===(null==(t=e.attributeClass)?void 0:t.name)}),r?Promise.resolve(n({code:"attribute_already_exists",message:"userId cannot be changed after it has been set. You need to reset first"})):Promise.resolve(function(e){try{if(!et.get().person||!et.get().person.id)return Promise.resolve(n({code:"missing_person",message:"Unable to update userId. No person set."}));var r=et.get().apiHost+"/api/v1/client/environments/"+et.get().environmentId+"/people/"+et.get().person.id+"/user-id";return Promise.resolve(fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e,sessionId:et.get().session.id})})).then(function(e){return Promise.resolve(e.json()).then(function(o){return e.ok?t(o):n({code:"network_error",message:"Error updating person",status:e.status,url:r,responseMessage:o.message})})})}catch(e){return Promise.reject(e)}}(e)).then(function(e){if(!0!==e.ok)return n(e.error);var t=e.value;return et.update({person:t.person,settings:t.settings}),{ok:!0,value:void 0}}))}catch(e){return Promise.reject(e)}var r},it=function(e,o){try{return tt.debug("setting attribute: "+e+" to value: "+o),rt(e,o)?(tt.debug("attribute already set to this value. Skipping update."),Promise.resolve({ok:!0,value:void 0})):Promise.resolve(function(e,r){try{return et.get().person&&et.get().person.id?Promise.resolve(fetch(et.get().apiHost+"/api/v1/client/environments/"+et.get().environmentId+"/people/"+et.get().person.id+"/attribute",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:e,value:r})})).then(function(e){return Promise.resolve(e.json()).then(function(r){return e.ok?t(r):n({code:"network_error",status:e.status,message:"Error updating person",url:e.url,responseMessage:r.message})})}):Promise.resolve(n({code:"missing_person",message:"Unable to update attribute. No person set."}))}catch(e){return Promise.reject(e)}}(e,o)).then(function(e){var t;return r(e,function(e){et.update({person:e.person,settings:e.settings})},function(e){t=e}),t?n(t):{ok:!0,value:void 0}})}catch(e){return Promise.reject(e)}},st=function(){try{return tt.debug("Resetting person. Getting new person, session and settings from backend"),Promise.resolve(nt()).then(function(e){var t;return r(e,function(e){et.update({person:e.person,session:e.session,settings:e.settings})},function(e){t=e}),t?n(t):{ok:!0,value:void 0}})}catch(e){return Promise.reject(e)}},at=e.getInstance(),ft=f.getInstance(),lt=function(){try{if(!ft.get().person)return Promise.resolve(n({code:"missing_person",message:"Unable to create session. No person found"}));var e=ft.get().apiHost+"/api/v1/client/environments/"+ft.get().environmentId+"/sessions";return Promise.resolve(fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({personId:ft.get().person.id})})).then(function(r){return Promise.resolve(r.json()).then(function(o){return r.ok?t(o):n({code:"network_error",message:"Error creating session",status:r.status,url:e,responseMessage:o.message})})})}catch(e){return Promise.reject(e)}},ut=function(e){var t=i({},e);return t.expiresAt=Date.now()+36e5,t},bt=function(e){return!e||e.expiresAt<=Date.now()},dt=f.getInstance(),ct=e.getInstance(),pt=function(e){try{var t,r=function(e){return t?e:(ct.debug("Add session event listeners"),function(){if("undefined"!=typeof window){var e=window.setInterval(function(){try{return Promise.resolve(function(){try{var e,t=function(t){return e?t:(at.debug("Session not expired, extending session"),ft.update({session:ut(ft.get().session)}),{ok:!0,value:void 0})};at.debug("Checking session");var r=function(){if(bt(ft.get().session))return at.debug("Session expired, creating new session"),Promise.resolve(lt()).then(function(t){if(!0!==t.ok){var r=n(t.error);return e=1,r}var o=t.value;return ft.update({session:o.session,settings:o.settings}),Promise.resolve(Qe("New Session")).then(function(t){if(!0!==t.ok){var r=n(t.error);return e=1,r}return e=1,{ok:!0,value:void 0}})})}();return Promise.resolve(r&&r.then?r.then(t):t(r))}catch(e){return Promise.reject(e)}}()).then(function(){})}catch(e){return Promise.reject(e)}},3e5);window.addEventListener("beforeunload",function(){clearInterval(e)})}}(),ct.debug("Add page url event listeners"),"undefined"!=typeof window&&(window.addEventListener("hashchange",Ke),window.addEventListener("popstate",Ke),window.addEventListener("pushstate",Ke),window.addEventListener("replacestate",Ke),window.addEventListener("load",Ke)),ct.debug("Add click event listeners"),"undefined"!=typeof window&&document.addEventListener("click",Ze),ct.debug("Initialized"),Ke(),{ok:!0,value:void 0})};if(ct.debug("Start initialize"),!e.environmentId)return ct.debug("No environmentId provided"),Promise.resolve(n({code:"missing_field",field:"environmentId"}));if(!e.apiHost)return ct.debug("No apiHost provided"),Promise.resolve(n({code:"missing_field",field:"apiHost"}));e.logLevel&&(ct.debug("Setting log level to "+e.logLevel),ct.configure({logLevel:e.logLevel})),ct.debug("Adding widget container to DOM"),Ue(),ct.debug("Adding styles to DOM"),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-4){margin-right:1rem}#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-end){justify-content:flex-end}#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-1){padding-left:.25rem;padding-right:.25rem}#fbjs :is(.fb-px-1\\.5){padding-left:.375rem;padding-right:.375rem}#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(.first\\:fb-rounded-l-md:first-child){border-bottom-left-radius:.375rem;border-top-left-radius:.375rem}#fbjs :is(.last\\:fb-rounded-r-md:last-child){border-bottom-right-radius:.375rem;border-top-right-radius:.375rem}#fbjs :is(.hover\\:fb-bg-gray-100:hover){--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}#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}#fbjs :is(.fb-dark .dark\\:fb-text-slate-400){--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}@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}}.fb-editor-text-bold{font-weight:700!important}.fb-editor-text-italic{font-style:italic!important}.fb-editor-link{color:#334155!important;text-decoration:underline!important}.editor-tokenFunction{color:#dd4a68!important}.fb-editor-paragraph{color:#334155!important;margin:0!important;position:relative!important}.fb-editor-paragraph:last-child{margin-bottom:0!important}.fb-editor-heading-h1{font-size:25px!important;font-weight:400!important}.fb-editor-heading-h1,.fb-editor-heading-h2{font-weight:700!important;margin-bottom:20px!important}.fb-editor-heading-h2{font-size:20px!important}.fb-editor-list-ol,.fb-editor-list-ul{margin-bottom:12px!important}.fb-editor-listitem{margin:0 32px!important}.fb-editor-nested-listitem{list-style-type:none!important}',document.head.appendChild(e)}}();var o=function(){if(dt.get().session&&dt.get().environmentId===e.environmentId&&dt.get().apiHost===e.apiHost){ct.debug("Found existing configuration. Checking session.");var r=dt.get().session;return function(){if(bt(r))return ct.debug("Session expired. Creating new session."),Promise.resolve(lt()).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}var o=e.value,i=o.settings;return dt.update({session:ut(o.session),settings:i}),Promise.resolve(Qe("New Session")).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}})});ct.debug("Session valid. Extending session."),dt.update({session:ut(r)})}()}return ct.debug("No valid session found. Creating new config."),dt.update({environmentId:e.environmentId,apiHost:e.apiHost}),ct.debug("Get person, session and settings from server"),Promise.resolve(nt()).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}var o=e.value,i=o.settings;return dt.update({person:o.person,session:ut(o.session),settings:i}),Promise.resolve(Qe("New Session")).then(function(e){if(!0!==e.ok){var r=n(e.error);return t=1,r}})})}();return Promise.resolve(o&&o.then?o.then(r):r(o))}catch(e){return Promise.reject(e)}};function ht(e,t,n){if(!e.s){if(n instanceof gt){if(!n.s)return void(n.o=ht.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(ht.bind(null,e,t),ht.bind(null,e,2));e.s=t,e.v=n;var r=e.o;r&&r(e)}}var mt=e.getInstance();const gt=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){const r=new e,o=this.s;if(o){const e=1&o?t:n;if(e){try{ht(r,1,e(this.v))}catch(e){ht(r,2,e)}return r}return this}return this.o=function(e){try{const o=e.v;1&e.s?ht(r,1,t?t(o):o):n?ht(r,1,n(o)):ht(r,2,o)}catch(e){ht(r,2,e)}},r},e}();function vt(e){return e instanceof gt&&1&e.s}var _t=/*#__PURE__*/function(){function e(){this.queue=[],this.running=!1}var t=e.prototype;return t.add=function(e,t){void 0===e&&(e=!0);var n=[].slice.call(arguments,2);mt.debug("Add command to queue: "+t.name+"("+JSON.stringify(n)+")"),this.queue.push({command:t,checkInitialized:e,commandArgs:n}),this.running||this.run()},t.run=function(){try{var e=function(){t.running=!1},t=this;t.running=!0;var r=function(e,t,n){for(var r;;){var o=e();if(vt(o)&&(o=o.v),!o)return i;if(o.then){r=0;break}var i=n();if(i&&i.then){if(!vt(i)){r=1;break}i=i.s}}var s=new gt,a=ht.bind(null,s,2);return(0===r?o.then(l):1===r?i.then(f):(void 0).then(function(){(o=e())?o.then?o.then(l).then(void 0,a):l(o):ht(s,1,i)})).then(void 0,a),s;function f(t){i=t;do{if(!(o=e())||vt(o)&&!o.v)return void ht(s,1,i);if(o.then)return void o.then(l).then(void 0,a);vt(i=n())&&(i=i.v)}while(!i||!i.then);i.then(f).then(void 0,a)}function l(e){e?(i=n())&&i.then?i.then(f).then(void 0,a):f(i):ht(s,1,i)}}(function(){return t.queue.length>0},0,function(){var e=o.getInstance(),r=t.queue.shift();if(r.checkInitialized){var i=(ct.debug("Check if initialized"),dt.get().apiHost&&dt.get().environmentId&&dt.get().person&&dt.get().session&&dt.get().settings&&o.initialized?{ok:!0,value:void 0}:n({code:"not_initialized",message:"Formbricks not initialized. Call initialize() first."}));i&&!0!==i.ok&&e.handle(i.error)}return Promise.resolve(r.command.apply(null,r.commandArgs)).then(function(t){t&&(mt.debug("Command result: "+(!0===t.ok?"OK":"Something went really wrong")+", "+r.command.name),!0!==t.ok&&e.handle(t.error))})});return Promise.resolve(r&&r.then?r.then(e):e())}catch(e){return Promise.reject(e)}},e}();e.getInstance().debug("Create command queue");var wt=new _t,yt=function(e,t){wt.add(!0,it,e,t)};return{init:function(e){o.init(e.errorHandler),wt.add(!1,pt,e)},setUserId:function(e){wt.add(!0,ot,e)},setEmail:function(e){yt("email",e)},setAttribute:yt,track:function(e,t){void 0===t&&(t={}),wt.add(!0,Qe,e,t)},logout:function(){wt.add(!0,st)},refresh:function(){wt.add(!0,He)},registerRouteChange:function(){wt.add(!0,Ke)}}});
//# sourceMappingURL=index.umd.js.map

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

import type { Survey as PrismaSurvey } from "@prisma/client";
import { Question } from "./questions";

@@ -8,3 +7,11 @@ export interface ThankYouCard {

}
export interface Survey extends Omit<PrismaSurvey, "questions" | "triggers" | "thankYouCard"> {
export interface Survey {
id: string;
createdAt: string;
updatedAt: string;
name: string;
type: "web" | "email" | "link" | "mobile";
environmentId: string;
status: "draft" | "inProgress" | "archived" | "paused" | "completed";
recontactDays: number | null;
questions: Question[];

@@ -15,3 +22,3 @@ thankYouCard: ThankYouCard;

responseRate: number;
displayOptions: "displayOnce" | "displayMultiple" | "respondMultiple";
displayOption: "displayOnce" | "displayMultiple" | "respondMultiple";
}
{
"name": "@formbricks/js",
"version": "0.1.15",
"version": "0.1.16",
"description": "Formbricks-js allows you to connect your app to Formbricks, display surveys and trigger events.",

@@ -59,4 +59,4 @@ "keywords": [

"typescript": "^5.0.4",
"@formbricks/types": "0.0.0",
"eslint-config-formbricks": "1.0.0"
"eslint-config-formbricks": "1.0.0",
"@formbricks/types": "0.0.0"
},

@@ -63,0 +63,0 @@ "jest": {

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