posthog-js 1.444.1 → 1.444.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all-external-dependencies.js +1 -1
- package/dist/all-external-dependencies.js.map +1 -1
- package/dist/array.full.es5.js +1 -1
- package/dist/array.full.js +1 -1
- package/dist/array.full.js.map +1 -1
- package/dist/array.full.no-external.js +1 -1
- package/dist/array.full.no-external.js.map +1 -1
- package/dist/array.js +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/conversations.js +1 -1
- package/dist/customizations.full.js +1 -1
- package/dist/customizations.js +1 -1
- package/dist/dead-clicks-autocapture.js +1 -1
- package/dist/default-extensions.js +1 -1
- package/dist/extension-bundles.js +1 -1
- package/dist/lazy-recorder.js +1 -1
- package/dist/lazy-recorder.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/module.full.cjs +1 -1
- package/dist/module.full.js +1 -1
- package/dist/module.full.js.map +1 -1
- package/dist/module.full.no-external.cjs +1 -1
- package/dist/module.full.no-external.js +1 -1
- package/dist/module.full.no-external.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.mjs +1 -1
- package/dist/module.no-external.cjs +1 -1
- package/dist/module.no-external.js +1 -1
- package/dist/module.slim.js +1 -1
- package/dist/module.slim.no-external.js +1 -1
- package/dist/posthog-recorder.js +1 -1
- package/dist/posthog-recorder.js.map +1 -1
- package/dist/product-tours.js +1 -1
- package/dist/recorder-v2.js +1 -1
- package/dist/recorder-v2.js.map +1 -1
- package/dist/recorder.js +1 -1
- package/dist/recorder.js.map +1 -1
- package/dist/rrweb.js +1 -1
- package/dist/rrweb.js.map +1 -1
- package/dist/surveys-preview.js +1 -1
- package/dist/surveys.js +1 -1
- package/lib/package.json +1 -1
- package/package.json +7 -7
package/dist/surveys.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e){var t,n,r,o,i,s,u,l,a,c,d,v,p,h,f;Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var y={},m=[],g=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,b=Array.isArray;function w(e,t){for(var n in t)e[n]=t[n];return e}function x(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function k(e,n,r){var o,i,s,u={};for(s in n)"key"==s?o=n[s]:"ref"==s?i=n[s]:u[s]=n[s];if(arguments.length>2&&(u.children=arguments.length>3?t.call(arguments,2):r),"function"==typeof e&&null!=e.defaultProps)for(s in e.defaultProps)void 0===u[s]&&(u[s]=e.defaultProps[s]);return S(e,u,o,i,null)}function S(e,t,o,i,s){var u={type:e,props:t,key:o,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==s?++r:s,__i:-1,__u:0};return null==s&&null!=n.vnode&&n.vnode(u),u}function q(e){return e.children}function _(e,t){this.props=e,this.context=t}function $(e,t){if(null==t)return e.__?$(e.__,e.__i+1):null;for(var n;e.__k.length>t;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?$(e):null}function T(e){if(e.__P&&e.__d){var t=e.__v,r=t.__e,o=[],i=[],s=w({},t);s.__v=t.__v+1,n.vnode&&n.vnode(s),H(e.__P,s,t,e.__n,e.__P.namespaceURI,32&t.__u?[r]:null,o,null==r?$(t):r,!!(32&t.__u),i),s.__v=t.__v,s.__.__k[s.__i]=s,z(o,s,i),t.__e=t.__=null,s.__e!=r&&P(s)}}function P(e){if(null!=(e=e.__)&&null!=e.__c)return e.__e=e.__c.base=null,e.__k.some(function(t){if(null!=t&&null!=t.__e)return e.__e=e.__c.base=t.__e}),P(e)}function I(e){(!e.__d&&(e.__d=!0)&&o.push(e)&&!C.__r++||i!=n.debounceRendering)&&((i=n.debounceRendering)||s)(C)}function C(){try{for(var e,t=1;o.length;)o.length>t&&o.sort(u),e=o.shift(),t=o.length,T(e)}finally{o.length=C.__r=0}}function M(e,t,n,r,o,i,s,u,l,a,c){var d,v,p,h,f,g,b,w=r&&r.__k||m,x=t.length;for(l=N(n,t,w,l,x),d=0;x>d;d++)null!=(p=n.__k[d])&&(v=-1!=p.__i&&w[p.__i]||y,p.__i=d,g=H(e,p,v,o,i,s,u,l,a,c),h=p.__e,p.ref&&v.ref!=p.ref&&(v.ref&&O(v.ref,null,p),c.push(p.ref,p.__c||h,p)),null==f&&null!=h&&(f=h),(b=!!(4&p.__u))||v.__k===p.__k?(l=E(p,l,e,b),b&&v.__e&&(v.__e=null)):"function"==typeof p.type&&void 0!==g?l=g:h&&(l=h.nextSibling),p.__u&=-7);return n.__e=f,l}function N(e,t,n,r,o){var i,s,u,l,a,c=n.length,d=c,v=0;for(e.__k=new Array(o),i=0;o>i;i++)null!=(s=t[i])&&"boolean"!=typeof s&&"function"!=typeof s?("string"==typeof s||"number"==typeof s||"bigint"==typeof s||s.constructor==String?s=e.__k[i]=S(null,s,null,null,null):b(s)?s=e.__k[i]=S(q,{children:s},null,null,null):void 0===s.constructor&&s.__b>0?s=e.__k[i]=S(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[i]=s,l=i+v,s.__=e,s.__b=e.__b+1,u=null,-1!=(a=s.__i=B(s,n,l,d))&&(d--,(u=n[a])&&(u.__u|=2)),null==u||null==u.__v?(-1==a&&(o>c?v--:c>o&&v++),"function"!=typeof s.type&&(s.__u|=4)):a!=l&&(a==l-1?v--:a==l+1?v++:(a>l?v--:v++,s.__u|=4))):e.__k[i]=null;if(d)for(i=0;c>i;i++)null!=(u=n[i])&&!(2&u.__u)&&(u.__e==r&&(r=$(u)),Q(u,u));return r}function E(e,t,n,r){var o,i;if("function"==typeof e.type){for(o=e.__k,i=0;o&&o.length>i;i++)o[i]&&(o[i].__=e,t=E(o[i],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=$(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function B(e,t,n,r){var o,i,s,u=e.key,l=e.type,a=t[n],c=null!=a&&!(2&a.__u);if(null===a&&null==u||c&&u==a.key&&l==a.type)return n;if(r>(c?1:0))for(o=n-1,i=n+1;o>=0||t.length>i;)if(null!=(a=t[s=0>o?i++:o--])&&!(2&a.__u)&&u==a.key&&l==a.type)return s;return-1}function D(e,t,n){"-"==t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||g.test(t)?n:n+"px"}function j(e,t,n,r,o){var i,s;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||D(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||D(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])i=t!=(t=t.replace(d,"$1")),s=t.toLowerCase(),t=s in e||"onFocusOut"==t||"onFocusIn"==t?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r?n[c]=r[c]:(n[c]=v,e.addEventListener(t,i?h:p,i)):e.removeEventListener(t,i?h:p,i);else{if("http://www.w3.org/2000/svg"==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&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=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,"popover"==t&&1==n?"":n))}}function F(e){return function(t){if(this.l){var r=this.l[t.type+e];if(null==t[a])t[a]=v++;else if(r[c]>t[a])return;return r(n.event?n.event(t):t)}}}function H(e,t,r,o,i,s,u,l,a,c){var d,v,p,h,f,y,g,k,S,T,$,P,I,C,N,E,B=t.type;if(void 0!==t.constructor)return null;128&r.__u&&(a=!!(32&r.__u),s=[l=t.__e=r.__e]),(d=n.__b)&&d(t);e:if("function"==typeof B){v=u.length;try{if(S=t.props,T=B.prototype&&B.prototype.render,$=(d=B.contextType)&&o[d.__c],P=d?$?$.props.value:d.__:o,r.__c?k=(p=t.__c=r.__c).__=p.__E:(T?t.__c=p=new B(S,P):(t.__c=p=new _(S,P),p.constructor=B,p.render=V),$&&$.sub(p),p.state||(p.state={}),p.__n=o,h=p.__d=!0,p.__h=[],p._sb=[]),T&&null==p.__s&&(p.__s=p.state),T&&null!=B.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=w({},p.__s)),w(p.__s,B.getDerivedStateFromProps(S,p.__s))),f=p.props,y=p.state,p.__v=t,h)T&&null==B.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),T&&null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(T&&null==B.getDerivedStateFromProps&&S!==f&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(S,P),t.__v==r.__v||!p.__e&&null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(S,p.__s,P)){t.__v!=r.__v&&(p.props=S,p.state=p.__s,p.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(e){e&&(e.__=t)}),m.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&u.push(p);break e}null!=p.componentWillUpdate&&p.componentWillUpdate(S,p.__s,P),T&&null!=p.componentDidUpdate&&p.__h.push(function(){p.componentDidUpdate(f,y,g)})}if(p.context=P,p.props=S,p.__P=e,p.__e=!1,I=n.__r,C=0,T)p.state=p.__s,p.__d=!1,I&&I(t),d=p.render(p.props,p.state,p.context),m.push.apply(p.__h,p._sb),p._sb=[];else do{p.__d=!1,I&&I(t),d=p.render(p.props,p.state,p.context),p.state=p.__s}while(p.__d&&25>++C);p.state=p.__s,null!=p.getChildContext&&(o=w(w({},o),p.getChildContext())),T&&!h&&null!=p.getSnapshotBeforeUpdate&&(g=p.getSnapshotBeforeUpdate(f,y)),N=null!=d&&d.type===q&&null==d.key?A(d.props.children):d,l=M(e,b(N)?N:[N],t,r,o,i,s,u,l,a,c),p.base=t.__e,t.__u&=-161,p.__h.length&&u.push(p),k&&(p.__E=p.__=null)}catch(e){if(u.length=v,t.__v=null,a||null!=s)if(e.then){for(t.__u|=a?160:128;l&&8==l.nodeType&&l.nextSibling;)l=l.nextSibling;null!=s&&(s[s.indexOf(l)]=null),t.__e=l}else{if(null!=s)for(E=s.length;E--;)x(s[E]);L(t)}else t.__e=r.__e,!t.__k&&r.__k&&(t.__k=r.__k),e.then||L(t);n.__e(e,t,r)}}else null==s&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):l=t.__e=R(r.__e,t,r,o,i,s,u,a,c);return(d=n.diffed)&&d(t),128&t.__u?void 0:l}function L(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(L))}function z(e,t,r){for(var o=0;r.length>o;o++)O(r[o],r[++o],r[++o]);n.__c&&n.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){n.__e(e,t.__v)}})}function A(e){return"object"!=typeof e||null==e||e.__b>0?e:b(e)?e.map(A):void 0!==e.constructor?null:w({},e)}function R(e,r,o,i,s,u,l,a,c){var d,v,p,h,f,m,g,w=o.props||y,k=r.props,S=r.type;if("svg"==S?s="http://www.w3.org/2000/svg":"math"==S?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),null!=u)for(d=0;u.length>d;d++)if((f=u[d])&&"setAttribute"in f==!!S&&(S?f.localName==S:3==f.nodeType)){e=f,u[d]=null;break}if(null==e){if(null==S)return document.createTextNode(k);e=document.createElementNS(s,S,k.is&&k),a&&(n.__m&&n.__m(r,u),a=!1),u=null}if(null==S)w===k||a&&e.data==k||(e.data=k);else{if(u="textarea"==S&&null!=k.defaultValue?null:u&&t.call(e.childNodes),!a&&null!=u)for(w={},d=0;e.attributes.length>d;d++)w[(f=e.attributes[d]).name]=f.value;for(d in w)f=w[d],"dangerouslySetInnerHTML"==d?p=f:"children"==d||d in k||"value"==d&&"defaultValue"in k||"checked"==d&&"defaultChecked"in k||j(e,d,null,f,s);for(d in k)f=k[d],"children"==d?h=f:"dangerouslySetInnerHTML"==d?v=f:"value"==d?m=f:"checked"==d?g=f:a&&"function"!=typeof f||w[d]===f||j(e,d,f,w[d],s);if(v)a||p&&(v.__html==p.__html||v.__html==e.innerHTML)||(e.innerHTML=v.__html),r.__k=[];else if(p&&(e.innerHTML=""),M("template"==r.type?e.content:e,b(h)?h:[h],r,o,i,"foreignObject"==S?"http://www.w3.org/1999/xhtml":s,u,l,u?u[0]:o.__k&&$(o,0),a,c),null!=u)for(d=u.length;d--;)x(u[d]);a&&"textarea"!=S||(d="value","progress"==S&&null==m?e.removeAttribute("value"):null!=m&&(m!==e[d]||"progress"==S&&!m||"option"==S&&m!=w[d])&&j(e,d,m,w[d],s),d="checked",null!=g&&g!=e[d]&&j(e,d,g,w[d],s))}return e}function O(e,t,r){try{if("function"==typeof e){var o="function"==typeof e.__u;o&&e.__u(),o&&null==t||(e.__u=e(t))}else e.current=t}catch(e){n.__e(e,r)}}function Q(e,t,r){var o,i;if(n.unmount&&n.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||O(o,null,t)),null!=(o=e.__c)){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(e){n.__e(e,t)}o.base=o.__P=o.__n=null}if(o=e.__k)for(i=0;o.length>i;i++)o[i]&&Q(o[i],t,r||"function"!=typeof e.type);r||x(e.__e),e.__c=e.__=e.__e=void 0}function V(e,t,n){return this.constructor(e,n)}function U(e,r,o){var i,s,u,l;r==document&&(r=document.documentElement),n.__&&n.__(e,r),s=(i="function"==typeof o)?null:o&&o.__k||r.__k,u=[],l=[],H(r,e=(!i&&o||r).__k=k(q,null,[e]),s||y,y,r.namespaceURI,!i&&o?[o]:s?null:r.firstChild?t.call(r.childNodes):null,u,!i&&o?o:s?s.__e:r.firstChild,i,l),z(u,e,l),e.props.children=null}t=m.slice,n={__e(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}},r=0,_.prototype.setState=function(e,t){var n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=w({},this.state);"function"==typeof e&&(e=e(w({},n),this.props)),e&&w(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),I(this))},_.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),I(this))},_.prototype.render=q,o=[],s="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,u=function(e,t){return e.__v.__b-t.__v.__b},C.__r=0,l=Math.random().toString(8),a="__d"+l,c="__a"+l,d=/(PointerCapture)$|Capture$/i,v=0,p=F(!1),h=F(!0),f=0;var Z=0;function G(e,t,r,o,i,s){t||(t={});var u,l,a=t;if("ref"in a)for(l in a={},t)"ref"==l?u=t[l]:a[l]=t[l];var c={type:e,props:a,key:r,ref:u,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Z,__i:-1,__u:0,__source:i,__self:s};if("function"==typeof e&&(u=e.defaultProps))for(l in u)void 0===a[l]&&(a[l]=u[l]);return n.vnode&&n.vnode(c),c}const W="$surveys",K="featureFlagsCommon";function Y({client:e,config:t}){var n;if(!e||!t.uiHost)return;const r=null===(n=e.session)||void 0===n?void 0:n.sessionId;return r?`${t.uiHost}/project/${e.projectToken}/replay/${r}`:void 0}var J=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({});const X="min_length",ee="max_length",te=Object.prototype,ne=te.hasOwnProperty,re=te.toString,oe=Array.isArray||function(e){return"[object Array]"===re.call(e)},ie=e=>"function"==typeof e,se=e=>void 0===e,ue=e=>"[object String]"==re.call(e),le=e=>null===e,ae=e=>se(e)||le(e),ce=e=>"[object Number]"==re.call(e)&&e==e;function de(e,t,n,r,o,i,s){try{var u=e[i](s),l=u.value}catch(e){return void n(e)}u.done?t(l):Promise.resolve(l).then(r,o)}function ve(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function s(e){de(i,r,o,s,u,"next",e)}function u(e){de(i,r,o,s,u,"throw",e)}s(void 0)})}}const pe="Mobile",he="Tablet",fe="Android Tablet",ye="iPad",me="Apple Watch",ge="Nintendo",be="PlayStation",we="Xbox",xe="Nokia",ke="Ouya",Se="Generic "+pe.toLowerCase(),qe="Generic "+he.toLowerCase(),_e=new RegExp(we,"i"),Te=new RegExp("PlayStation \\w+","i"),Pe=new RegExp("Nintendo \\w+","i"),$e=new RegExp("BlackBerry|PlayBook|BB10","i");new RegExp(ge,"i"),new RegExp(be,"i"),new RegExp("Windows","i");function Ie(e){return Ie="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ie(e)}function Ce(e,t,n){return(t=function(e){var t=function(e){if("object"!=Ie(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Ie(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ie(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Me(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ne(e){for(var t=1;arguments.length>t;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Me(Object(n),!0).forEach(function(t){Ce(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Me(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}let Ee;const Be=e=>{throw function(e,t){const n=new Error(t);try{Object.defineProperty(n,"name",{value:"NativeGzipValidationError",writable:!0,enumerable:!0,configurable:!0})}catch(e){}return n}(0,`Native gzip produced invalid output: ${e}`)},De=(je=ve(function*(e,t){18>e.size&&Be("too-short");const n=new Uint8Array(yield e.slice(0,10).arrayBuffer());var r;(2>(r=n).length||31!==r[0]||139!==r[1]||8!==n[2])&&Be("invalid-header");const o=new DataView(yield e.slice(e.size-8).arrayBuffer());o.getUint32(0,!0)!==(e=>{const t=(()=>{if(Ee)return Ee;Ee=[];for(let e=0;256>e;e++){let t=e;for(let e=0;8>e;e++)t=1&t?3988292384^t>>>1:t>>>1;Ee[e]=t>>>0}return Ee})();let n=4294967295;for(let r=0;e.length>r;r++)n=t[255&(n^e[r])]^n>>>8;return(4294967295^n)>>>0})(t)&&Be("invalid-crc");const i=t.length>>>0;o.getUint32(4,!0)!==i&&Be("invalid-size")}),function(e,t){return je.apply(this,arguments)});var je;function Fe(){return Fe=ve(function*(e,t=!0,n){try{const t=(new TextEncoder).encode(e),n=new globalThis.CompressionStream("gzip"),o=n.writable.getWriter(),i=o.write(t).then(()=>o.close()).catch((r=ve(function*(e){try{yield o.abort(e)}catch(e){}throw e}),function(e){return r.apply(this,arguments)})),s=new Response(n.readable).blob(),[u]=yield Promise.all([s,i]);return yield De(u,t),u}catch(e){if(null==n?void 0:n.rethrow)throw e;return t&&console.error("Failed to gzip compress data",e),null}var r}),Fe.apply(this,arguments)}function He(e,t){if(!e)return;const n=e.find(e=>e.type===t);return null==n?void 0:n.value}var Le=class e{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,r,o){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(o)||0>t||0>n||0>r||0>o||t>0xffffffffffff||n>4095||r>1073741823||o>4294967295)throw new RangeError("invalid field value");const i=new Uint8Array(16);return i[0]=t/Math.pow(2,40),i[1]=t/Math.pow(2,32),i[2]=t/Math.pow(2,24),i[3]=t/Math.pow(2,16),i[4]=t/256,i[5]=t,i[6]=112|n>>>8,i[7]=n,i[8]=128|r>>>24,i[9]=r>>>16,i[10]=r>>>8,i[11]=r,i[12]=o>>>24,i[13]=o>>>16,i[14]=o>>>8,i[15]=o,new e(i)}toString(){let e="";for(let t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new e(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(let t=0;16>t;t++){const n=this.bytes[t]-e.bytes[t];if(0!==n)return Math.sign(n)}return 0}},ze=class{generate(){const e=this.generateOrAbort();if(!se(e))return e;{this.Ct=0;const e=this.generateOrAbort();if(se(e))throw new Error("Could not generate UUID after timestamp reset");return e}}generateOrAbort(){const e=(()=>{const e=Date.now();return ce(e)&&isFinite(e)?Math.min(Math.max(Math.floor(e),0),0xffffffffffff):0})();if(e>this.Ct)this.Ct=e,this.It();else{if(this.Ct>=e+1e4)return;this.Mt++,this.Mt>4398046511103&&(this.Ct++,this.It())}return Le.fromFieldsV7(this.Ct,Math.trunc(this.Mt/Math.pow(2,30)),this.Mt&Math.pow(2,30)-1,this.Tt.nextUint32())}It(){this.Mt=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.Mt=0,this.Tt=new Oe}};const Ae=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};let Re;var Oe=class{nextUint32(){var e;return this.Rt.length>this.$t||((null!==(e=Re)&&void 0!==e?e:Re="u">typeof window&&!se(window.crypto)&&crypto.getRandomValues?e=>{try{return crypto.getRandomValues(e)}catch(t){return Ae(e)}}:Ae)(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}};let Qe;const Ve=()=>Ue().toString(),Ue=()=>(Qe||(Qe=new ze)).generate();var Ze,Ge,We,Ke,Ye=0,Je=[],Xe=n,et=Xe.__b,tt=Xe.__r,nt=Xe.diffed,rt=Xe.__c,ot=Xe.unmount,it=Xe.__;function st(e,t){Xe.__h&&Xe.__h(Ge,e,Ye||t),Ye=0;var n=Ge.__H||(Ge.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function ut(e){return Ye=1,function(e,t){var n=st(Ze++,2);if(n.t=e,!n.__c&&(n.__=[gt(void 0,t),function(e){var t=n.__N?n.__N[0]:n.__[0],r=n.t(t,e);t!==r&&(n.__N=[r,n.__[1]],n.__c.setState({}))}],n.__c=Ge,!Ge.__f)){var r=function(e,t,r){if(!n.__c.__H)return!0;var i=!1,s=n.__c.props!==e;if(n.__c.__H.__.some(function(e){if(e.__N){i=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}}),o){var u=o.call(this,e,t,r);return i?u||s:u}return!i||s};Ge.__f=!0;var o=Ge.shouldComponentUpdate,i=Ge.componentWillUpdate;Ge.componentWillUpdate=function(e,t,n){if(this.__e){var s=o;o=void 0,r(e,t,n),o=s}i&&i.call(this,e,t,n)},Ge.shouldComponentUpdate=r}return n.__N||n.__}(gt,e)}function lt(e,t){var n=st(Ze++,3);!Xe.__s&&mt(n.__H,t)&&(n.__=e,n.u=t,Ge.__H.__h.push(n))}function at(e){return Ye=5,ct(function(){return{current:e}},[])}function ct(e,t){var n=st(Ze++,7);return mt(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function dt(e){var t=Ge.context[e.__c],n=st(Ze++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(Ge)),t.props.value):e.__}function vt(){for(var e;e=Je.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(ft),t.__h.some(yt),t.__h=[]}catch(n){t.__h=[],Xe.__e(n,e.__v)}}}Xe.__b=function(e){Ge=null,et&&et(e)},Xe.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),it&&it(e,t)},Xe.__r=function(e){tt&&tt(e),Ze=0;var t=(Ge=e.__c).__H;t&&(We===Ge?(t.__h=[],Ge.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.length&&vt(),Ze=0)),We=Ge},Xe.diffed=function(e){nt&&nt(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==Je.push(t)&&Ke===Xe.requestAnimationFrame||((Ke=Xe.requestAnimationFrame)||ht)(vt)),t.__H.__.some(function(e){e.u&&(e.__H=e.u,e.u=void 0)})),We=Ge=null},Xe.__c=function(e,t){t.some(function(e){try{e.__h.some(ft),e.__h=e.__h.filter(function(e){return!e.__||yt(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],Xe.__e(n,e.__v)}}),rt&&rt(e,t)},Xe.unmount=function(e){ot&&ot(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{ft(e)}catch(e){t=e}}),n.__H=void 0,t&&Xe.__e(t,n.__v))};var pt="function"==typeof requestAnimationFrame;function ht(e){var t,n=function(){clearTimeout(r),pt&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);pt&&(t=requestAnimationFrame(n))}function ft(e){var t=Ge,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),Ge=t}function yt(e){var t=Ge;e.__c=e.__(),Ge=t}function mt(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function gt(e,t){return"function"==typeof t?t(e):t}const bt="tab",wt="left",xt="center",kt="right",St="next_to_trigger",qt="popover",_t="widget",Tt="external_survey",Pt="open",$t="multiple_choice",It="single_choice",Ct="rating",Mt="end",Nt="always",Et="survey shown",Bt="survey dismissed",Dt="survey sent",jt="$survey_id",Ft="$survey_name",Ht="$survey_iteration",Lt="$survey_iteration_start_date",zt="$survey_language",At="0.10.2",Rt={DEBUG:!1,LIB_VERSION:At,LIB_NAME:"browser-common",JS_SDK_VERSION:At},Ot=(e,{debugEnabled:t}={})=>{const n={N(n,...r){let o;try{o=typeof window>"u"?void 0:window}catch(e){return}o&&(Rt.DEBUG||o.POSTHOG_DEBUG||t)&&!se(o.console)&&o.console&&("__rrweb_original__"in o.console[n]?o.console[n].__rrweb_original__:o.console[n])(e,...r)},debug(...e){n.N("debug",...e)},info(...e){n.N("log",...e)},warn(...e){n.N("warn",...e)},error(...e){n.N("error",...e)},critical(...t){console.error(e,...t)},uninitializedWarning(e){n.error(`You must initialize PostHog before calling ${e}`)},createLogger:(t,n)=>Ot(`${e} ${t}`,n)};return n},Qt=Ot("[PostHog.js]"),Vt=Qt.createLogger;function Ut(e,t,n,r){const{capture:o=!1,passive:i=!0}=null!=r?r:{};null==e||e.addEventListener(t,n,{capture:o,passive:i})}function Zt(e){return`$survey_response_${e}`}function Gt(e,t){if(!t)return null;const n=e[Zt(t)];return oe(n)?[...n]:n}function Wt({event:e,survey:t,responses:n={},submissionId:r,completed:o,surveyLanguage:i,questionSnapshots:s}){return Ne(Ne(Ne(Ne({},!se(r)&&{$survey_submission_id:r}),"sent"===e?!se(o)&&{$survey_completed:o}:{$survey_partially_completed:Kt(n)}),i&&{$survey_language:i}),function(e={},t,n){const r={};return t.questions.forEach(t=>{if(se(t.originalQuestionIndex))return;const n=0===(o=t.originalQuestionIndex)?"$survey_response":`$survey_response_${o}`;var o;const i=Gt(e,t.id);se(i)||(r[n]=i)}),Ne(Ne({$survey_questions:t.questions.map(t=>{var r,o;return{id:t.id,question:null!==(r=null==n?void 0:n[null!==(o=t.id)&&void 0!==o?o:""])&&void 0!==r?r:t.question,response:Gt(e,t.id)}})},e),r)}(n,t,s))}function Kt(e={}){return Object.values(e).some(e=>!ae(e))}function Yt(e,t){let n=`$survey_${t}/${e.id}`;return e.current_iteration&&e.current_iteration>0&&(n=`$survey_${t}/${e.id}/${e.current_iteration}`),n}function Jt(e){return"string"==typeof e&&e.trim()?e.trim():null}function Xt(e){return e.toLowerCase()}function en(e,t,n){if(!e||!t)return null;const r=Xt(t),o=Object.keys(e).find(e=>Xt(e)===r);if(o)return null==n||n.debug(`Found exact translation match: ${o}`),o;if(r.includes("-")){const o=r.split("-")[0],i=Object.keys(e).find(e=>Xt(e)===o);if(i)return null==n||n.debug(`Found base language translation match: ${i} (from ${t})`),i}return null}const tn=["thankYouMessageHeader","thankYouMessageDescription","thankYouMessageCloseButtonText","introScreenHeader","introScreenDescription","introScreenButtonText","submitButtonText","backButtonText"];function nn(e,t,n){var r;const o=en(e.translations,t,n),i=Ne({},e);let s=!1;if(o){var u;const t=null===(u=e.translations)||void 0===u?void 0:u[o];if(t)if(null==n||n.info(`Applying survey-level translation for language: ${o}`),se(t.name)||(i.name=t.name,s=!0),i.appearance){const e=Ne({},i.appearance);for(const n of tn){const r=t[n];se(r)||(e[n]=r,s=!0)}i.appearance=e}else(function(e){return tn.some(t=>!se(e[t]))})(t)&&(s=!0)}const l=e.questions.map(e=>function(e,t,n){var r;const o=en(e.translations,t,n);if(!o)return{question:e,matchedKey:null,hasChanges:!1};const i=null===(r=e.translations)||void 0===r?void 0:r[o];if(!i)return{question:e,matchedKey:null,hasChanges:!1};const s=Ne({},e);let u=!1;return se(i.question)||(s.question=i.question,u=!0),se(i.description)||(s.description=i.description,u=!0),se(i.buttonText)||(s.buttonText=i.buttonText,u=!0),"link"in s&&!se(i.link)&&(s.link=i.link,u=!0),"lowerBoundLabel"in s&&!se(i.lowerBoundLabel)&&(s.lowerBoundLabel=i.lowerBoundLabel,u=!0),"upperBoundLabel"in s&&!se(i.upperBoundLabel)&&(s.upperBoundLabel=i.upperBoundLabel,u=!0),"choices"in s&&function(e){return oe(e.choices)}(i)&&(s.choices=i.choices,u=!0),{question:u?s:e,matchedKey:u?o:null,hasChanges:u}}(e,t,n)),a=l.map(e=>e.question),c=l.some(e=>e.hasChanges);let d=null;return o||(d=(null===(r=l.find(e=>e.matchedKey))||void 0===r?void 0:r.matchedKey)||null),c&&(i.questions=a,s=!0,null==n||n.info(`Applied question-level translations for language: ${t}`)),{survey:i,matchedKey:s?o||d:null}}function rn(e){var t;return!!(null===(t=e.conditions)||void 0===t||null===(t=t.events)||void 0===t||null===(t=t.values)||void 0===t?void 0:t.length)}const on=(e,t)=>{if(!(e=>{try{new RegExp(e)}catch(e){return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}},sn=e=>e.toLowerCase(),un={exact:(e,t)=>t.some(t=>e.some(e=>t===e)),is_not:(e,t)=>t.every(t=>e.every(e=>t!==e)),regex:(e,t)=>t.some(t=>e.some(e=>on(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!on(t,e))),icontains:(e,t)=>t.map(sn).some(t=>e.map(sn).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(sn).every(t=>e.map(sn).every(e=>!t.includes(e))),gt:(e,t)=>t.some(t=>{const n=parseFloat(t);return!isNaN(n)&&e.some(e=>n>parseFloat(e))}),lt:(e,t)=>t.some(t=>{const n=parseFloat(t);return!isNaN(n)&&e.some(e=>n<parseFloat(e))})},ln=e=>{const t=[...e];for(let e=t.length-1;e>0;e--){const n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}return t},an=Vt("[Surveys]"),cn=(e,t)=>`${e}${function(e){return e.current_iteration&&e.current_iteration>0?`${e.id}_${e.current_iteration}`:e.id}(t)}`,dn=e=>cn("seenSurvey_",e),vn=[qt,_t,"api"];const pn=Vt("[Stylesheet Loader]"),hn="#020617",fn={fontFamily:"inherit",backgroundColor:"#eeeded",submitButtonColor:"black",submitButtonTextColor:"white",ratingButtonColor:"white",ratingButtonActiveColor:"black",borderColor:"#c9c6c6",whiteLabel:!1,displayThankYouMessage:!0,thankYouMessageHeader:"Thank you for your feedback!",position:kt,widgetType:bt,widgetLabel:"Feedback",widgetColor:"black",zIndex:String(2147483645),disabledButtonOpacity:"0.6",maxWidth:"300px",textSubtleColor:"#939393",boxPadding:"20px 24px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",borderRadius:"10px",shuffleQuestions:!1,outlineColor:"rgba(59, 130, 246, 0.8)",inputBackground:"white",inputTextColor:hn,scrollbarThumbColor:"var(--ph-survey-border-color)",scrollbarTrackColor:"var(--ph-survey-background-color)"},yn=[xt,wt,kt];function mn(e){if(e.startsWith("#")){let t=e.replace(/^#/,"");return/^[0-9A-Fa-f]{3}$/.test(t)&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),/^[0-9A-Fa-f]{6}$/.test(t)?`rgb(${parseInt(t.slice(0,2),16)},${parseInt(t.slice(2,4),16)},${parseInt(t.slice(4,6),16)})`:"rgb(255, 255, 255)"}return"rgb(255, 255, 255)"}function gn(e=fn.backgroundColor){let t;"#"===e[0]&&(t=mn(e)),e.startsWith("rgb")&&(t=e);const n={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}[e.toLowerCase()];if(n&&(t=mn(n)),!t)return hn;const r=t.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);if(r){const e=parseInt(r[1]),t=parseInt(r[2]),n=parseInt(r[3]);return Math.sqrt(e*e*.299+t*t*.587+n*n*.114)>127.5?hn:"white"}return hn}const bn=(e,t,n)=>{const r=Ln(e),o=document.querySelector(`.${r}`);if(o&&o.shadowRoot)return{shadow:o.shadowRoot,isNewlyCreated:!1};const i=document.createElement("div");((e,t,n)=>{const r=Ne(Ne({},fn),n),o=e.style,i=!yn.includes(r.position)||t===_t&&(null==n?void 0:n.widgetType)===bt;o.setProperty("--ph-survey-font-family",function(e){if("inherit"===e)return"inherit";const t='BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';return e?`${e}, ${t}`:`-apple-system, ${t}`}(r.fontFamily)),o.setProperty("--ph-survey-box-padding",r.boxPadding),o.setProperty("--ph-survey-max-width",r.maxWidth),o.setProperty("--ph-survey-z-index",r.zIndex),o.setProperty("--ph-survey-border-color",r.borderColor),i?(o.setProperty("--ph-survey-border-radius",r.borderRadius),o.setProperty("--ph-survey-border-bottom","1.5px solid var(--ph-survey-border-color)")):(o.setProperty("--ph-survey-border-bottom","none"),o.setProperty("--ph-survey-border-radius",`${r.borderRadius} ${r.borderRadius} 0 0`)),o.setProperty("--ph-survey-background-color",r.backgroundColor),o.setProperty("--ph-survey-box-shadow",r.boxShadow),o.setProperty("--ph-survey-disabled-button-opacity",r.disabledButtonOpacity),o.setProperty("--ph-survey-submit-button-color",r.submitButtonColor),o.setProperty("--ph-survey-submit-button-text-color",(null==n?void 0:n.submitButtonTextColor)||gn(r.submitButtonColor)),o.setProperty("--ph-survey-rating-bg-color",r.ratingButtonColor),o.setProperty("--ph-survey-rating-active-bg-color",r.ratingButtonActiveColor),o.setProperty("--ph-survey-rating-active-text-color",gn(r.ratingButtonActiveColor)),o.setProperty("--ph-survey-text-primary-color",(null==n?void 0:n.textColor)||gn(r.backgroundColor)),o.setProperty("--ph-survey-text-subtle-color",r.textSubtleColor),o.setProperty("--ph-widget-color",r.widgetColor),o.setProperty("--ph-widget-text-color",gn(r.widgetColor)),o.setProperty("--ph-widget-z-index",r.zIndex);const s=(null==n?void 0:n.inputBackground)||(null==n?void 0:n.inputBackgroundColor);let u=s||r.inputBackground;s||"white"!==r.backgroundColor||(u="#f8f8f8"),o.setProperty("--ph-survey-input-background",u);const l=(null==n?void 0:n.inputTextColor)||gn(u);o.setProperty("--ph-survey-input-text-color",l),o.setProperty("--ph-survey-rating-text-color",l),o.setProperty("--ph-survey-scrollbar-thumb-color",r.scrollbarThumbColor),o.setProperty("--ph-survey-scrollbar-track-color",r.scrollbarTrackColor),o.setProperty("--ph-survey-outline-color",r.outlineColor)})(i,e.type,e.appearance),i.className=r;const s=i.attachShadow({mode:"open"}),u=function(e){const t=((e,t,n)=>{let r=e.createElement("style");r.innerText=t;const o=(e=>{var t;return ie(e)?e:null==e||null===(t=e.config)||void 0===t?void 0:t.prepare_external_dependency_stylesheet})(n);return o&&(r=o(r)),r||(pn.error("prepare_external_dependency_stylesheet returned null"),null)})(document,':host{--ph-survey-font-family:-apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";--ph-survey-box-padding:20px 24px;--ph-survey-max-width:300px;--ph-survey-z-index:calc(2147480000 + 3645);--ph-survey-border-color:#dcdcdc;--ph-survey-border-bottom:1.5px solid var(--ph-survey-border-color);--ph-survey-border-radius:10px;--ph-survey-background-color:#eeeded;--ph-survey-box-shadow:0 4px 12px #00000026;--ph-survey-submit-button-color:black;--ph-survey-submit-button-text-color:white;--ph-survey-rating-bg-color:white;--ph-survey-rating-text-color:#020617;--ph-survey-rating-active-bg-color:black;--ph-survey-rating-active-text-color:white;--ph-survey-text-primary-color:#020617;--ph-survey-text-subtle-color:#939393;--ph-widget-color:#e0a045;--ph-widget-text-color:white;--ph-survey-scrollbar-thumb-color:var(--ph-survey-border-color);--ph-survey-scrollbar-track-color:var(--ph-survey-background-color);--ph-survey-outline-color:#3b82f6cc;--ph-survey-input-background:white;--ph-survey-input-text-color:#020617;--ph-survey-disabled-button-opacity:.6}.ph-survey{min-width:300px;width:var(--ph-survey-max-width);max-width:85%;z-index:var(--ph-survey-z-index);height:fit-content;margin:0;position:fixed;bottom:0}.ph-survey h3,.ph-survey p{margin:0}.ph-survey *{box-sizing:border-box;font-family:var(--ph-survey-font-family);color:var(--ph-survey-text-primary-color)}.ph-survey textarea,.ph-survey input[type=text],.ph-survey .multiple-choice-options label{color:var(--ph-survey-input-text-color);background:var(--ph-survey-input-background);border:1.5px solid var(--ph-survey-border-color);border-radius:4px;padding:10px;transition:border-color .2s ease-out,box-shadow .2s ease-out,transform .15s ease-out}.ph-survey textarea,.ph-survey input[type=text]{transition:border-color .2s ease-out,box-shadow .2s ease-out,transform .15s ease-out}.ph-survey input{margin:0}.ph-survey textarea:focus,.ph-survey textarea:focus-visible,.ph-survey input[type=text]:focus,.ph-survey input[type=text]:focus-visible,.ph-survey .form-submit:focus,.ph-survey .form-submit:focus-visible,.ph-survey input[type=checkbox]:focus,.ph-survey input[type=radio]:focus,.ph-survey input[type=checkbox]:focus-visible,.ph-survey input[type=radio]:focus-visible{outline:1.5px solid var(--ph-survey-outline-color);border-color:var(--ph-survey-rating-active-bg-color);outline-offset:2px}.ph-survey textarea:focus:not(:focus-visible),.ph-survey input[type=text]:focus:not(:focus-visible),.ph-survey button:focus:not(:focus-visible),.ph-survey input[type=checkbox]:focus:not(:focus-visible),.ph-survey input[type=radio]:focus:not(:focus-visible){outline:none}.ph-survey textarea:hover:not(:focus),.ph-survey input[type=text]:hover:not(:focus){border-color:var(--ph-survey-rating-active-bg-color)}@media (max-width:768px){.ph-survey textarea,.ph-survey input[type=text]{font-size:1rem}}.ph-survey .multiple-choice-options label,.ph-survey .rating-options-number,.ph-survey .form-cancel,.ph-survey input[type=checkbox],.ph-survey input[type=radio]{border:1.5px solid var(--ph-survey-border-color)}.ph-survey label,.ph-survey input[type=checkbox],.ph-survey input[type=radio],.ph-survey .ratings-emoji,.ph-survey .ratings-number,.ph-survey .footer-branding,.ph-survey .form-cancel,.ph-survey .form-submit{transition:all .2s ease-out}@media (prefers-reduced-motion:no-preference){.ph-survey button:active,.ph-survey input[type=checkbox]:active,.ph-survey input[type=radio]:active,.ph-survey label:active{transition-duration:.1s}}.ph-survey-widget-tab{background:var(--ph-widget-color);color:var(--ph-widget-text-color);text-align:center;cursor:pointer;z-index:var(--ph-survey-z-index);border:none;border-radius:3px 3px 0 0;padding:10px 12px;transition:padding .2s ease-out;position:fixed}.ph-survey-widget-tab:hover:not(.widget-tab-top){padding-bottom:16px}.ph-survey-widget-tab.widget-tab-top{border-radius:0 0 3px 3px}.ph-survey-widget-tab.widget-tab-top:hover{padding-top:16px}@keyframes ph-survey-fade-in{0%{opacity:0}to{opacity:1}}.survey-box{flex-direction:column;gap:16px;display:flex}.bottom-section{flex-direction:column;gap:8px;display:flex}.thank-you-message-header~.bottom-section,.intro-screen-header~.bottom-section{padding-top:16px}.question-container,.thank-you-message,.intro-screen{flex-direction:column;gap:8px;display:flex}.survey-question{font-size:14px;font-weight:500}.survey-question-description{opacity:.8;padding-top:4px;font-size:13px}.survey-question-description,.thank-you-message-body,.intro-screen-body{word-wrap:break-word;overflow-wrap:break-word}:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) img,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) video,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) iframe,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) embed,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) object,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) svg{max-width:100%;height:auto}.question-textarea-wrapper{flex-direction:column;display:flex}.survey-form{animation:.3s ease-out forwards ph-survey-fade-in}.survey-form,.thank-you-message,.intro-screen{text-align:left;width:100%;z-index:var(--ph-survey-z-index);border:1.5px solid var(--ph-survey-border-color);border-bottom:var(--ph-survey-border-bottom);background:var(--ph-survey-background-color);border-radius:var(--ph-survey-border-radius);box-shadow:var(--ph-survey-box-shadow);padding:var(--ph-survey-box-padding);margin:0;position:relative}.survey-form textarea,.survey-form input[type=text]{min-width:100%}.survey-form textarea:focus,.survey-form textarea:focus-visible{box-shadow:0 4px 12px #00000014}.survey-form textarea:focus:not(:focus-visible){box-shadow:none}.survey-box .question-header--empty~.multiple-choice-options,.survey-box .question-header--empty~textarea{margin-top:0}.multiple-choice-options{border:none;flex-direction:column;gap:8px;margin:0;padding:1px 0;font-size:14px;display:flex}.multiple-choice-options label,.multiple-choice-options .response-choice{color:inherit;align-items:center;gap:8px;display:flex}.multiple-choice-options label{cursor:pointer;font-size:13px}.multiple-choice-options label:hover:not(:has(input:checked)){border-color:var(--ph-survey-text-subtle-color);box-shadow:0 2px 8px #00000014}.multiple-choice-options label:has(input:checked){border-color:var(--ph-survey-rating-active-bg-color);box-shadow:0 1px 4px #0000000d}.multiple-choice-options label.choice-option-open{flex-wrap:wrap}.multiple-choice-options label span{color:inherit}.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:var(--ph-survey-input-background);cursor:pointer;z-index:1;border-radius:3px;flex-shrink:0;width:1rem;height:1rem;transition:all .2s cubic-bezier(.4,0,.2,1),transform .15s ease-out;position:relative}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):focus{transform:scale(1.05)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):hover{border-color:var(--ph-survey-rating-active-bg-color);transform:scale(1.05)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):active{transform:scale(.95)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):checked{background:var(--ph-survey-rating-active-bg-color);border-color:var(--ph-survey-rating-active-bg-color);transform:scale(1)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):checked:hover{transform:scale(1.05)}.multiple-choice-options input[type=checkbox]:checked:after{border:solid var(--ph-survey-rating-active-text-color);border-width:0 2px 2px 0;width:4px;height:8px;animation:.2s ease-out .1s forwards ph-survey-checkmark-reveal;left:4px;transform:rotate(45deg)scale(0)}.multiple-choice-options input[type=radio]:checked:after{background:var(--ph-survey-rating-active-text-color);border-radius:50%;width:6px;height:6px;animation:.15s ease-out 50ms forwards ph-survey-radio-reveal;top:5px;left:5px;transform:scale(0)}.multiple-choice-options input[type=checkbox]:checked:after,.multiple-choice-options input[type=radio]:checked:after{content:"";box-sizing:content-box;position:absolute}.multiple-choice-options input[type=radio]{border-radius:50%}.multiple-choice-options input[type=radio]:checked{border:none}:is(.multiple-choice-options input[type=checkbox]:checked,.multiple-choice-options input[type=radio]:checked)~*{font-weight:700}.multiple-choice-options .choice-option-open input[type=text]::placeholder{color:var(--ph-survey-text-subtle-color);font-weight:400}.rating-options-emoji{justify-content:space-between;display:flex}.rating-options-emoji-2{justify-content:space-around}.ratings-emoji{opacity:.5;background-color:#0000;border:none;padding:0;font-size:16px}.ratings-emoji:hover{cursor:pointer;opacity:1;transform:scale(1.15)}.ratings-emoji.rating-active{opacity:1}.ratings-emoji svg{fill:var(--ph-survey-text-primary-color);transition:fill .2s ease-out}.rating-options-number{border-radius:6px;grid-auto-columns:1fr;grid-auto-flow:column;display:grid;overflow:hidden}.rating-options-number .ratings-number{border-right:1px solid var(--ph-survey-border-color);text-align:center;cursor:pointer;color:var(--ph-survey-rating-text-color);border-top:none;border-bottom:none;border-left:none;font-weight:700}.rating-options-number .ratings-number:last-of-type{border-right:0}.rating-options-number .ratings-number.rating-active{background:var(--ph-survey-rating-active-bg-color);color:var(--ph-survey-rating-active-text-color)}.ratings-number{background-color:var(--ph-survey-rating-bg-color);border:none;padding:8px 0}.ratings-number .rating-active{background-color:var(--ph-survey-rating-active-bg-color)}.ratings-number{cursor:pointer}@media (hover:hover) and (pointer:fine){.ratings-number:hover:not(.rating-active){background-color:color-mix(in srgb, var(--ph-survey-rating-active-bg-color) 14%, var(--ph-survey-rating-bg-color))}}.rating-text{opacity:.7;flex-direction:row;justify-content:space-between;font-size:11px;display:flex}.form-buttons{flex-direction:row;gap:8px;width:100%;display:flex}.form-buttons-with-back>.form-submit{flex:auto;min-width:0}.form-submit{text-align:center;cursor:pointer;user-select:none;background:var(--ph-survey-submit-button-color);color:var(--ph-survey-submit-button-text-color);border:none;border-radius:6px;min-width:100%;padding:12px;font-weight:700;box-shadow:0 2px #0000000b}.form-submit:not([disabled]):hover{transform:scale(1.02);box-shadow:0 4px 8px #0000001a}.form-submit:not([disabled]):active{transform:scale(.98);box-shadow:0 1px 2px #0000000d}.form-submit[disabled]{opacity:var(--ph-survey-disabled-button-opacity);cursor:not-allowed}.form-back{text-align:center;cursor:pointer;user-select:none;color:var(--ph-survey-text-primary-color);border:1.5px solid var(--ph-survey-border-color);background:0 0;border-radius:6px;flex:none;padding:12px 16px;font-weight:600}.form-back:hover{transform:scale(1.02)}.form-back:active{transform:scale(.98)}.validation-hint{opacity:.7;margin-top:4px;font-size:12px}.form-cancel{cursor:pointer;background:#fff;border-radius:100%;padding:12px;line-height:0;position:absolute;top:0;right:0;transform:translate(50%,-50%)}.form-cancel:hover{opacity:.7;transform:translate(50%,-50%)scale(1.1)}.footer-branding{opacity:.6;justify-content:center;align-items:center;gap:4px;font-size:11px;font-weight:500;text-decoration:none;display:flex}.footer-branding:hover{opacity:1}.footer-branding a{text-decoration:none}.thank-you-message{text-align:center}.thank-you-message-header{margin:10px 0 0}.thank-you-message-body{opacity:.8;font-size:14px}.intro-screen{text-align:center;animation:.3s ease-out forwards ph-survey-fade-in}.intro-screen-header{margin:10px 0 0}.intro-screen-body{opacity:.8;font-size:14px}.limit-height{scrollbar-width:thin;scrollbar-color:var(--ph-survey-scrollbar-thumb-color) var(--ph-survey-scrollbar-track-color);max-height:256px;overflow:hidden auto}.limit-height::-webkit-scrollbar{width:8px}.limit-height::-webkit-scrollbar-track{background:var(--ph-survey-scrollbar-track-color);border-radius:4px}.limit-height::-webkit-scrollbar-thumb{background-color:var(--ph-survey-scrollbar-thumb-color);border:2px solid var(--ph-survey-scrollbar-track-color);border-radius:4px}.limit-height::-webkit-scrollbar-thumb:hover{background-color:var(--ph-survey-text-subtle-color)}.sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}@media (prefers-reduced-motion:reduce){.ph-survey *{scroll-behavior:auto!important;transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}@keyframes ph-survey-checkmark-reveal{0%{opacity:0;transform:rotate(45deg)scale(0)}50%{opacity:1;transform:rotate(45deg)scale(1.2)}to{opacity:1;transform:rotate(45deg)scale(1)}}@keyframes ph-survey-radio-reveal{0%{opacity:0;transform:scale(0)}50%{opacity:1;transform:scale(1.3)}to{opacity:1;transform:scale(1)}}',null==e?void 0:e.config.prepareStylesheet);return null==t||t.setAttribute("data-ph-survey-style","true"),t}(t);if(u){const e=s.querySelector("style");e&&s.removeChild(e),s.appendChild(u)}return(n||document.body).appendChild(i),{shadow:s,isNewlyCreated:!0}},wn=e=>{try{const t=dn(e);localStorage.getItem(t)||localStorage.setItem(t,"true")}catch(e){an.error("Failed to persist survey seen state",e)}},xn=({responses:e,survey:t,surveySubmissionId:n,posthog:r,isSurveyCompleted:o,properties:i,surveyLanguage:s,questionSnapshots:u})=>{var l,a,c;r?(null===(l=r.client)||void 0===l?void 0:l.canCapture)&&(wn(t),o&&Hn(t),null===(a=r.client)||void 0===a||a.capture(Dt,Ne(Ne(Ne({[Ft]:t.name,[jt]:t.id,[Ht]:t.current_iteration,[Lt]:t.current_iteration_start_date,sessionRecordingUrl:Y(r)},Wt(Ne(Ne({event:"sent",survey:t,responses:e,submissionId:n,completed:o},!se(s)&&{surveyLanguage:s}),!se(u)&&{questionSnapshots:u}))),i),{},{$set:{[Yt(t,"responded")]:!0}})),o&&(window.dispatchEvent(new CustomEvent("PHSurveySent",{detail:{surveyId:t.id}})),null===(c=r.client)||void 0===c||null===(c=c.getExtension("featureFlagsCommon"))||void 0===c||c.reloadFeatureFlags())):an.error("[survey sent] event not captured, PostHog instance not found.")},kn=(e,t,n,r)=>Ne({[Ft]:t.name,[jt]:t.id,[Ht]:t.current_iteration,[Lt]:t.current_iteration_start_date,sessionRecordingUrl:Y(r)},Wt(Ne(Ne(Ne(Ne({event:e,survey:t},!se(null==n?void 0:n.responses)&&{responses:n.responses}),!se(null==n?void 0:n.surveySubmissionId)&&{submissionId:n.surveySubmissionId}),!se(null==n?void 0:n.surveyLanguage)&&{surveyLanguage:n.surveyLanguage}),!se(null==n?void 0:n.questionSnapshots)&&{questionSnapshots:n.questionSnapshots}))),Sn=(e,t,n,r)=>{var o;if(!t)return void an.error("[survey dismissed] event not captured, PostHog instance not found.");if(n)return;const i=jn(e),s=i?i.surveyLanguage:r,u=Ne(Ne(Ne({},kn("dismissed",e,i,t)),s&&{[zt]:s}),{},{$set:{[Yt(e,"dismissed")]:!0}});Hn(e),wn(e),null===(o=t.client)||void 0===o||o.capture(Bt,u),window.dispatchEvent(new CustomEvent("PHSurveyClosed",{detail:{surveyId:e.id}}))},qn=(e,t)=>{var n,r;if(!t)return void an.error("[survey abandoned] event not captured, PostHog instance not found.");if(!(null===(n=t.client)||void 0===n?void 0:n.canCapture))return;const o=(e=>cn("abandonedSurvey_",e))(e);try{if("true"===localStorage.getItem(o))return}catch(e){return}const i=jn(e);if(i){try{localStorage.setItem(o,"true")}catch(e){}null===(r=t.client)||void 0===r||r.capture("survey abandoned",kn("abandoned",e,i,t),{delivery:"unload"})}},_n=e=>{const t=e.map(e=>e.id);return t.every(e=>!!e)?t:void 0},Tn=(e,t)=>{var n,r,o;return(e=>e.questions.some(e=>{var t;return!!(null===(t=e.branching)||void 0===t?void 0:t.type)}))(e)?e.questions:t?null!==(n=((e,t)=>{if(!t||t.length!==e.questions.length)return null;const n=new Map(e.questions.map(e=>[e.id,e])),r=[];for(const e of t){const t=n.get(e);if(!t)return null;r.push(t)}return r})(e,t.questionOrder))&&void 0!==n?n:e.questions:e.appearance&&e.appearance.shuffleQuestions&&!e.enable_partial_responses?(r=e.questions,o=ln(e.questions),r.length===o.length&&r.every((e,t)=>e===o[t])?o.reverse():o):e.questions},Pn=e=>function(e){var t;return rn(e)&&!!(null===(t=e.conditions)||void 0===t||null===(t=t.events)||void 0===t?void 0:t.repeatedActivation)||"always"===e.schedule}(e)||Fn(e),$n=function(e){function t(e){var n,r;return this.getChildContext||(n=new Set,(r={})[t.__c]=this,this.getChildContext=function(){return r},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&n.forEach(function(e){e.__e=!0,I(e)})},this.sub=function(e){n.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),t&&t.call(e)}}),e.children}return t.__c="__cC"+f++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t}({isPreviewMode:!1,previewPageIndex:0,onPopupSurveyDismissed(){},isPopup:!0,onPreviewSubmit(){},onPreviewBack(){},surveySubmissionId:"",properties:void 0,surveyLanguage:null}),In=()=>dt($n),Cn=({component:e,children:n,renderAsHtml:r,style:o})=>function(e,n,r){var o,i,s,u,l=w({},e.props);for(s in e.type&&e.type.defaultProps&&(u=e.type.defaultProps),n)"key"==s?o=n[s]:"ref"==s?i=n[s]:l[s]=void 0===n[s]&&null!=u?u[s]:n[s];return arguments.length>2&&(l.children=arguments.length>3?t.call(arguments,2):r),S(e.type,l,o||e.key,i||e.ref,null)}(e,r?{dangerouslySetInnerHTML:{__html:n},style:o}:{children:n,style:o});function Mn(e,t){var n,r,o;if(!(null===(n=e.conditions)||void 0===n?void 0:n.url))return!0;const i=null!==(r=function(e){var t;const n=typeof window>"u"?void 0:window,r=null==n||null===(t=n.location)||void 0===t?void 0:t.href;return se(r)?void 0:function(e,t){var n;const r=null==e||null===(n=e.config)||void 0===n?void 0:n.get_current_url;if(!ie(r))return t;try{const e=r(t);return ue(e)&&e?e:t}catch(e){return Qt.error("Error in get_current_url, falling back to window.location.href",e),t}}(e,r)}(t))&&void 0!==r?r:"u">typeof window?window.location.href:void 0;if(!i)return!1;const s=[e.conditions.url],u=function(e){return null!=e?e:"icontains"}(null===(o=e.conditions)||void 0===o?void 0:o.urlMatchType);return un[u](s,[i])}function Nn(e){var t,n;return function(e,t){var n,r,o;if(!e||0===e.length)return!0;const i="u">typeof window?window:void 0,s="u">typeof globalThis?globalThis:i,u=null==s?void 0:s.navigator,l=null==u?void 0:u.userAgent;if(!l)return!1;const a=function(e,t){var n;const r=function(e){return Pe.test(e)?ge:Te.test(e)?be:_e.test(e)?we:new RegExp(ke,"i").test(e)?ke:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?"Windows Phone":/iPad/.test(e)?ye:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?me:$e.test(e)?"BlackBerry":/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(xe,"i").test(e)?xe:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(pe).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?"Android":fe:new RegExp("(pda|Mobile)","i").test(e)?Se:new RegExp(he,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?qe:""}(e);return r===ye||r===fe||"Kobo"===r||"Kindle Fire"===r||r===qe?he:r===ge||r===we||r===be||r===ke?"Console":r===me?"Wearable":r?pe:"Android"===(null==t?void 0:t.userAgentDataPlatform)&&(null!==(n=null==t?void 0:t.maxTouchPoints)&&void 0!==n?n:0)>0?600>Math.min(null!==(o=null==t?void 0:t.screenWidth)&&void 0!==o?o:0,null!==(i=null==t?void 0:t.screenHeight)&&void 0!==i?i:0)/(null!==(s=null==t?void 0:t.devicePixelRatio)&&void 0!==s?s:1)?pe:he:"Desktop";var o,i,s}(l,{userAgentDataPlatform:null==u||null===(n=u.userAgentData)||void 0===n?void 0:n.platform,maxTouchPoints:null==u?void 0:u.maxTouchPoints,screenWidth:null==i||null===(r=i.screen)||void 0===r?void 0:r.width,screenHeight:null==i||null===(o=i.screen)||void 0===o?void 0:o.height,devicePixelRatio:null==i?void 0:i.devicePixelRatio});return un[null!=t?t:"icontains"](e,[a])}(null===(t=e.conditions)||void 0===t?void 0:t.deviceTypes,null===(n=e.conditions)||void 0===n?void 0:n.deviceTypesMatchType)}const En=e=>cn("inProgressSurvey_",e),Bn={},Dn=(e,t)=>{const n=En(e);try{localStorage.setItem(n,JSON.stringify(t)),delete Bn[n]}catch(e){an.error("Error setting in-progress survey state in localStorage",e),Bn[n]=t}},jn=e=>{const t=En(e),n=Bn[t];if(n)return n;try{const e=localStorage.getItem(t);if(e)return JSON.parse(e)}catch(e){an.error("Error getting in-progress survey state from localStorage",e)}return null},Fn=e=>{const t=jn(e);return!ae(null==t?void 0:t.surveySubmissionId)},Hn=e=>{const t=En(e);delete Bn[t];try{localStorage.removeItem(t)}catch(e){an.error("Error clearing in-progress survey state from localStorage",e)}};function Ln(e,t=!1){const n=`PostHogSurvey-${e.id}`;return t?`.${n}`:n}function zn(e,t=kt,n){if(e===Tt)return{};switch(t){case"top_left":return{top:"0",left:"0",transform:"translate(30px, 30px)"};case"top_right":return{top:"0",right:"0",transform:"translate(-30px, 30px)"};case"top_center":return{top:"0",left:"50%",transform:"translate(-50%, 30px)"};case"middle_left":return{top:"50%",left:"0",transform:"translate(30px, -50%)"};case"middle_right":return{top:"50%",right:"0",transform:"translate(-30px, -50%)"};case"middle_center":return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};case wt:return{left:"30px"};case xt:return{left:"50%",transform:"translateX(-50%)"};default:return{right:e===_t&&n===bt?"60px":"30px"}}}const An=G("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:G("path",{d:"M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm146 272q66 0 121.5-35.5T682-393h-52q-23 40-63 61.5T480.5-310q-46.5 0-87-21T331-393h-53q26 61 81 96.5T480-261Zm0 181q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),Rn=G("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:G("path",{d:"M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm20 194h253v-49H354v49ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),On=G("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:G("path",{d:"M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm146.174 116Q413-417 358.5-379.5T278-280h53q22-42 62.173-65t87.5-23Q528-368 567.5-344.5T630-280h52q-25-63-79.826-100-54.826-37-122-37ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),Qn=G("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:G("path",{d:"M480-417q-67 0-121.5 37.5T278-280h404q-25-63-80-100t-122-37Zm-183-72 50-45 45 45 31-36-45-45 45-45-31-36-45 45-50-45-31 36 45 45-45 45 31 36Zm272 0 44-45 51 45 31-36-45-45 45-45-31-36-51 45-44-45-31 36 44 45-44 45 31 36ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142 0 241-99t99-241q0-142-99-241t-241-99q-142 0-241 99t-99 241q0 142 99 241t241 99Z"})}),Vn=G("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:G("path",{d:"M479.504-261Q537-261 585.5-287q48.5-26 78.5-72.4 6-11.6-.75-22.6-6.75-11-20.25-11H316.918Q303-393 296.5-382t-.5 22.6q30 46.4 78.5 72.4 48.5 26 105.004 26ZM347-578l27 27q7.636 8 17.818 8Q402-543 410-551q8-8 8-18t-8-18l-42-42q-8.8-9-20.9-9-12.1 0-21.1 9l-42 42q-8 7.636-8 17.818Q276-559 284-551q8 8 18 8t18-8l27-27Zm267 0 27 27q7.714 8 18 8t18-8q8-7.636 8-17.818Q685-579 677-587l-42-42q-8.8-9-20.9-9-12.1 0-21.1 9l-42 42q-8 7.714-8 18t8 18q7.636 8 17.818 8Q579-543 587-551l27-27ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),Un=G("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:G("path",{d:"M2 20h2c.55 0 1-.45 1-1v-9c0-.55-.45-1-1-1H2v11zm19.83-7.12c.11-.25.17-.52.17-.8V11c0-1.1-.9-2-2-2h-5.5l.92-4.65c.05-.22.02-.46-.08-.66-.23-.45-.52-.86-.88-1.22L14 2 7.59 8.41C7.21 8.79 7 9.3 7 9.83v7.84C7 18.95 8.05 20 9.34 20h8.11c.7 0 1.36-.37 1.72-.97l2.66-6.15z"})}),Zn=G("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:G("path",{d:"M22 4h-2c-.55 0-1 .45-1 1v9c0 .55.45 1 1 1h2V4zM2.17 11.12c-.11.25-.17.52-.17.8V13c0 1.1.9 2 2 2h5.5l-.92 4.65c-.05.22-.02.46.08.66.23.45.52.86.88 1.22L10 22l6.41-6.41c.38-.38.59-.89.59-1.42V6.34C17 5.05 15.95 4 14.66 4H6.55c-.7 0-1.36.37-1.72.97l-2.66 6.15z"})}),Gn=({fill:e="currentColor"}={})=>G("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:e,xmlns:"http://www.w3.org/2000/svg","aria-labelledby":"close-survey-title-adam",children:[G("title",{id:"close-survey-title",className:"adam-testing",children:"Close survey"}),G("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0.164752 0.164752C0.384422 -0.0549175 0.740578 -0.0549175 0.960248 0.164752L6 5.20451L11.0398 0.164752C11.2594 -0.0549175 11.6156 -0.0549175 11.8352 0.164752C12.0549 0.384422 12.0549 0.740578 11.8352 0.960248L6.79549 6L11.8352 11.0398C12.0549 11.2594 12.0549 11.6156 11.8352 11.8352C11.6156 12.0549 11.2594 12.0549 11.0398 11.8352L6 6.79549L0.960248 11.8352C0.740578 12.0549 0.384422 12.0549 0.164752 11.8352C-0.0549175 11.6156 -0.0549175 11.2594 0.164752 11.0398L5.20451 6L0.164752 0.960248C-0.0549175 0.740578 -0.0549175 0.384422 0.164752 0.164752Z",fill:e})]}),Wn=G("svg",{width:"80",height:"14",viewBox:"0 0 160 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[G("g",{"clip-path":"url(#ph-survey-logo-clip)",children:[G("path",{fill:"currentColor",d:"m50 23.34-.35-.05A4.5 4.5 0 0 1 47 21.97L35.56 10.1c-.3-.33-.86-.1-.86.35V27.5c0 .27.22.5.5.5h13.78c1.48 0 2.67-1.2 2.67-2.67v-.1a1.9 1.9 0 0 0-1.67-1.89zm-10.81.2a1.8 1.8 0 1 1 0-3.58 1.8 1.8 0 0 1 0 3.58"}),G("path",{fill:"#0054ff",d:"M.87 19.13a.5.5 0 0 0-.87.34v5.94a2.6 2.6 0 0 0 2.59 2.58H7.8a.5.5 0 0 0 .37-.84zM.86 8.4c-.3-.32-.86-.1-.86.36v6.73q0 .2.13.34l8.81 9.68 1.8 2.06v-8.82zM4.59.82A2.67 2.67 0 0 0 0 2.68v1.93q0 .4.27.69l10.47 10.95v-9.1z"}),G("path",{fill:"#ff5506",d:"M11.36 28h7.08a.5.5 0 0 0 .36-.85l-8.05-8.4v8.8l.23.28q.16.17.38.17m-.61-11.76 8.84 9.25 2.1 2.33q.1.11.27.14V18.7L10.75 7.15zm0-13.7v1.41a2 2 0 0 0 .55 1.28L21.96 16.2V7.65L15.32.8a2.67 2.67 0 0 0-4.57 1.71z"}),G("path",{fill:"#ffb70f",d:"M22.06 28h7.76a.5.5 0 0 0 .36-.86l-8.22-8.45v9.27l.09.02zM31 25.49l1.13 1.14c.32.31.85.09.85-.35v-7.3l-.49-.51L21.96 7.64v8.55zM22.52 5.73l9.62 9.89c.3.32.86.1.86-.35V7.46L26.56.82a2.67 2.67 0 0 0-4.59 1.84v1.7c0 .51.2 1 .57 1.37z"})]}),G("path",{fill:"currentColor",d:"M64.9 22.88c-.67 0-1.23-.56-1.23-1.24V5.24c0-.69.56-1.24 1.24-1.24h6.55c3.89 0 6.39 2.32 6.39 5.9 0 3.6-2.5 5.91-6.4 5.91h-3.53v5.83c0 .68-.56 1.24-1.24 1.24zm3.02-11.94c0 .68.55 1.23 1.23 1.23h1.88c1.6 0 2.58-.86 2.58-2.26s-.97-2.27-2.58-2.27h-1.88c-.68 0-1.23.55-1.23 1.23zM84.71 23.1c-4.18 0-7.14-2.97-7.14-7.02s2.96-7.01 7.14-7.01c4.14 0 7.14 2.97 7.14 7.01 0 4.05-3 7.01-7.14 7.01m-3.22-7.02c0 2.16 1.3 3.64 3.22 3.64 1.9 0 3.2-1.48 3.2-3.64s-1.3-3.64-3.2-3.64c-1.93 0-3.22 1.48-3.22 3.64m16.34 7.03a6.2 6.2 0 0 1-5.54-3.01c-.34-.57-.01-1.26.6-1.5l.77-.3c.7-.27 1.45.15 1.92.73a2.8 2.8 0 0 0 2.25 1.08c1.05 0 1.75-.51 1.75-1.27 0-2.13-7.17-.7-7.17-5.85 0-2.13 1.85-3.91 4.83-3.91 2.27 0 4.2.9 5.17 2.31.36.53.05 1.2-.54 1.44l-.85.35c-.68.29-1.45-.14-2-.63a2.5 2.5 0 0 0-1.64-.64c-.89 0-1.5.38-1.5.97 0 2.16 7.27.38 7.27 5.88 0 2.35-2.15 4.34-5.32 4.34m14.64-1.31c.04.57-.3 1.1-.86 1.2q-.6.1-1.27.11c-2.92 0-5.15-1.56-5.15-4.85v-5.66h-.91c-.69 0-1.24-.56-1.24-1.24v-.82c0-.68.55-1.23 1.24-1.23h.91v-2.7c0-.69.55-1.24 1.23-1.24h1.48c.68 0 1.24.55 1.24 1.23v2.7h2.04c.68 0 1.23.56 1.23 1.24v.82c0 .68-.55 1.24-1.23 1.24h-2.04v5.15c0 1.2.64 1.91 1.6 1.91.75 0 1.6.5 1.66 1.25zM125.5 5.23c0-.68.55-1.23 1.23-1.23h1.8c.68 0 1.23.55 1.23 1.23v16.41c0 .68-.55 1.24-1.23 1.24h-1.8c-.68 0-1.23-.56-1.23-1.24v-5.43c0-.68-.56-1.23-1.24-1.23h-5c-.67 0-1.23.55-1.23 1.23v5.43c0 .68-.55 1.24-1.23 1.24h-1.77c-.69 0-1.24-.56-1.24-1.24V5.24c0-.69.55-1.24 1.24-1.24h1.77c.68 0 1.23.55 1.23 1.23v4.87c0 .68.56 1.23 1.24 1.23h5c.67 0 1.23-.55 1.23-1.23zm12.87 17.87c-4.19 0-7.14-2.97-7.14-7.02s2.95-7.01 7.14-7.01c4.13 0 7.14 2.97 7.14 7.01 0 4.05-3 7.01-7.14 7.01m-3.22-7.02c0 2.16 1.29 3.64 3.22 3.64 1.9 0 3.2-1.48 3.2-3.64s-1.3-3.64-3.2-3.64c-1.93 0-3.22 1.48-3.22 3.64m17.17 6.37c-3.84 0-6.2-2.58-6.2-6.68s2.36-6.69 6.12-6.69c1.58 0 2.82.54 3.54 1.37 0-.64.52-1.15 1.16-1.15h1.5c.68 0 1.24.55 1.24 1.23V21.9c0 3.64-2.77 6.09-6.93 6.09-2.64 0-4.9-1.2-5.85-3.09-.31-.62.16-1.29.85-1.4l1.14-.17c.67-.11 1.29.4 1.78.85.5.46 1.26.7 2.08.7 1.85 0 3.06-1.04 3.06-2.55v-1.3c-.7.9-2.01 1.4-3.49 1.4m-2.36-6.68c0 2.02 1.18 3.31 3 3.31 1.86 0 3.04-1.29 3.04-3.31s-1.18-3.32-3.03-3.32c-1.83 0-3.01 1.3-3.01 3.32"}),G("defs",{children:G("clipPath",{id:"ph-survey-logo-clip",children:G("path",{fill:"#fff",d:"M0 0h51.67v28H0z"})})})]});function Kn({urlParams:e}){const t=e?Object.entries(e).map(([e,t])=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`).join("&"):"";return G("a",{href:"https://posthog.com/surveys"+(t?`?${t}`:""),target:"_blank",rel:"noopener",className:"footer-branding",children:["Survey by ",Wn]})}function Yn({text:e,submitDisabled:t,appearance:n,onSubmit:r,link:o,onPreviewSubmit:i,skipSubmitButton:s,canGoBack:u,onBack:l}){const{isPreviewMode:a}=dt($n),c=!!u&&!!l,d=!s&&G("button",{className:"form-submit",disabled:t,"aria-label":"Submit survey",type:"button",onClick(){var e;o&&(null===(e=window)||void 0===e||e.open(o)),a?null==i||i():r()},children:e});return G("div",{className:"bottom-section",children:[c?G("div",{className:"form-buttons form-buttons-with-back",children:[G("button",{className:"form-back",type:"button","aria-label":"Go to previous question",onClick:l,children:n.backButtonText||"Back"}),d]}):d,!n.whiteLabel&&G(Kn,{urlParams:{utm_source:"survey-footer"}})]})}function Jn({question:e,forceDisableHtml:t,htmlFor:n}){return G("div",{class:e.question||e.description?"question-header":"question-header question-header--empty",children:[G(e.type===Pt?"label":"h3",{className:"survey-question",htmlFor:n,children:e.question}),e.description&&Cn({component:k("p",{className:"survey-question-description"}),children:e.description,renderAsHtml:!t&&"text"!==e.descriptionContentType})]})}function Xn({onClick:e}){const{isPreviewMode:t}=dt($n);return G("button",{className:"form-cancel",onClick:e,disabled:t,"aria-label":"Close survey",type:"button",children:Gn({fill:"black"})})}function er({header:e,description:t,contentType:n,forceDisableHtml:r,appearance:o,onClose:i}){const{isPopup:s}=dt($n);return lt(()=>{const e=e=>{"Enter"!==e.key&&"Escape"!==e.key||(e.preventDefault(),i())};return Ut(window,"keydown",e),()=>{window.removeEventListener("keydown",e)}},[i]),G("div",{className:"thank-you-message",role:"status",tabIndex:0,"aria-atomic":"true",children:[s&&!0!==o.hideCancelButton&&G(Xn,{onClick:()=>i()}),G("h3",{className:"thank-you-message-header",children:e}),t&&Cn({component:k("p",{className:"thank-you-message-body"}),children:t,renderAsHtml:!r&&"text"!==n}),s&&G(Yn,{text:o.thankYouMessageCloseButtonText||"Close",submitDisabled:!1,appearance:o,onSubmit:()=>i()})]})}function tr({header:e,description:t,contentType:n,forceDisableHtml:r,appearance:o,onStart:i}){const{isPopup:s,onPreviewSubmit:u,onPopupSurveyDismissed:l}=dt($n);return G("div",{className:"intro-screen",role:"status",tabIndex:0,"aria-atomic":"true",children:[s&&!0!==o.hideCancelButton&&G(Xn,{onClick:()=>l()}),e&&G("h3",{className:"intro-screen-header",children:e}),t&&Cn({component:k("p",{className:"intro-screen-body"}),children:t,renderAsHtml:!r&&"text"!==n}),G(Yn,{text:o.introScreenButtonText||"Get started",submitDisabled:!1,appearance:o,onSubmit:i,onPreviewSubmit:()=>u(null)})]})}const nr=e=>oe(e)&&e.every(e=>ue(e));function rr({question:e,forceDisableHtml:t,appearance:n,onSubmit:r,onPreviewSubmit:o,displayQuestionIndex:i,initialValue:s,canGoBack:u,onBack:l}){const{isPreviewMode:a}=In(),c=at(null),[d,v]=ut(()=>ue(s)?s:""),p=null==n?void 0:n.disableAutofocus;lt(()=>{p||setTimeout(()=>{var e;a||null===(e=c.current)||void 0===e||e.focus()},100)},[a,p]);const h=`surveyQuestion${i}`,f=ct(()=>function(e,t,n){const r=e.trim();if(!n&&""===r)return"This field is required";if(""===r)return!1;if(t&&t.length>0)for(const e of t)switch(e.type){case X:var o;if(void 0!==e.value&&e.value>r.length)return null!==(o=e.errorMessage)&&void 0!==o?o:`Please enter at least ${e.value} characters`;break;case ee:var i;if(void 0!==e.value&&r.length>e.value)return null!==(i=e.errorMessage)&&void 0!==i?i:`Please enter no more than ${e.value} characters`}return!1}(d,e.validation,e.optional),[d,e.validation,e.optional]),y=He(e.validation,X),m=He(e.validation,ee),g=ct(()=>function(e,t){const n=1===e?void 0:e;return n&&t?`Enter ${n}-${t} characters`:n?`Enter at least ${n} ${1===n?"character":"characters"}`:t?`Maximum ${t} ${1===t?"character":"characters"}`:void 0}(y,m),[y,m]),b=()=>{f||r(d.trim())},w=()=>{f||o(d.trim())};return G(q,{children:[G("div",{className:"question-container",children:[G(Jn,{question:e,forceDisableHtml:t,htmlFor:h}),G("textarea",{ref:c,id:h,rows:4,placeholder:null==n?void 0:n.placeholder,minLength:y,maxLength:m,onInput(e){v(e.currentTarget.value),e.stopPropagation()},onKeyDown(e){e.stopPropagation(),"Enter"!==e.key||!e.metaKey&&!e.ctrlKey||f||(e.preventDefault(),a?w():b())},value:d}),g&&G("div",{className:"validation-hint",children:g})]}),G(Yn,{text:e.buttonText||"Submit",submitDisabled:!!f,appearance:n,onSubmit:b,onPreviewSubmit:w,canGoBack:u,onBack:l})]})}function or({question:e,forceDisableHtml:t,appearance:n,onSubmit:r,onPreviewSubmit:o,canGoBack:i,onBack:s}){return G(q,{children:[G("div",{className:"question-container",children:G(Jn,{question:e,forceDisableHtml:t})}),G(Yn,{text:e.buttonText||"Submit",submitDisabled:!1,link:e.link,appearance:n,onSubmit:()=>r("link clicked"),onPreviewSubmit:()=>o("link clicked"),canGoBack:i,onBack:s})]})}function ir({question:e,forceDisableHtml:t,displayQuestionIndex:n,appearance:r,onSubmit:o,onPreviewSubmit:i,initialValue:s,canGoBack:u,onBack:l}){var a;const c=e.scale,d=10===e.scale?0:1,[v,p]=ut(()=>ce(s)?s:oe(s)&&s.length>0&&ce(parseInt(s[0]))?parseInt(s[0]):ue(s)&&ce(parseInt(s))?parseInt(s):null),h="emoji"===e.display&&2===e.scale,{isPreviewMode:f}=In(),y=e=>f?i(e):o(e);return G(q,{children:[G("div",{className:"question-container",children:[G(Jn,{question:e,forceDisableHtml:t}),G("div",{className:"rating-section",children:[G("div",{className:"rating-options",children:["emoji"===e.display&&G("div",{className:"rating-options-emoji"+(h?" rating-options-emoji-2":""),children:null===(a=dr[e.scale])||void 0===a?void 0:a.map((t,r)=>G("button",{"aria-label":`Rate ${r+1}`,className:`ratings-emoji question-${n}-rating-${r} ${r+1===v?"rating-active":""}`,value:r+1,type:"button",onClick(){const t=r+1;p(t),e.skipSubmitButton&&y(t)},children:t},r))}),"number"===e.display&&G("div",{className:"rating-options-number",style:{gridTemplateColumns:`repeat(${c-d+1}, minmax(0, 1fr))`},children:vr(e.scale).map((t,o)=>G(sr,{displayQuestionIndex:n,active:v===t,appearance:r,num:t,setActiveNumber(t){p(t),e.skipSubmitButton&&y(t)}},o))})]}),!h&&G("div",{className:"rating-text",children:[G("div",{children:e.lowerBoundLabel}),G("div",{children:e.upperBoundLabel})]})]})]}),G(Yn,{text:e.buttonText||(null==r?void 0:r.submitButtonText)||"Submit",submitDisabled:le(v)&&!e.optional,appearance:r,onSubmit:()=>o(v),onPreviewSubmit:()=>i(v),skipSubmitButton:e.skipSubmitButton,canGoBack:u,onBack:l})]})}function sr({num:e,active:t,displayQuestionIndex:n,setActiveNumber:r}){return G("button",{"aria-label":`Rate ${e}`,className:`ratings-number question-${n}-rating-${e} ${t?"rating-active":""}`,type:"button",onClick(){r(e)},children:e})}function ur({question:e,forceDisableHtml:t,displayQuestionIndex:n,appearance:r,onSubmit:o,onPreviewSubmit:i,initialValue:s,canGoBack:u,onBack:l}){const a=at(null),c=ct(()=>(e=>{var t;if(!e.shuffleOptions)return e.choices;const n=[...e.choices],r=e.hasOpenChoice&&null!==(t=n.pop())&&void 0!==t?t:null,o=(i=n,(s=ln(n)).length>1&&i.every((e,t)=>e===s[t])?s.reverse():s);var i,s;return le(r)||o.push(r),o})(e),[e]),[d,v]=ut(()=>((e,t)=>ue(e)||nr(e)?e:t===It?null:[])(s,e.type)),[p,h]=ut(()=>((e,t)=>{if(ue(e)&&!t.includes(e))return{isSelected:!0,inputValue:e};if(nr(e)){const n=e.find(e=>!t.includes(e));if(n)return{isSelected:!0,inputValue:n}}return{isSelected:!1,inputValue:""}})(s,c)),{isPreviewMode:f}=In(),y=e.type===It,m=e.type===$t,g=e.skipSubmitButton&&y&&!e.hasOpenChoice,b=(e,t)=>{if(t){const e=!p.isSelected;return h(t=>Ne(Ne({},t),{},{isSelected:e,inputValue:e?t.inputValue:""})),y&&v(""),void(e&&setTimeout(()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.focus()},75))}if(y)return v(e),h(e=>Ne(Ne({},e),{},{isSelected:!1,inputValue:""})),void(g&&(o(e),f&&i(e)));m&&oe(d)&&(d.includes(e)?v(d.filter(t=>t!==e)):v([...d,e]))},w=e=>{e.stopPropagation();const t=e.currentTarget.value;h(e=>Ne(Ne({},e),{},{inputValue:t})),y&&v(t)},x=e=>{e.stopPropagation(),"Enter"!==e.key||k()||(e.preventDefault(),S()),"Escape"===e.key&&(e.preventDefault(),h(e=>Ne(Ne({},e),{},{isSelected:!1,inputValue:""})),y&&v(null))},k=()=>!(e.optional||!le(d)&&(!oe(d)||p.isSelected||0!==d.length)&&(!p.isSelected||""!==p.inputValue.trim())),S=()=>{p.isSelected&&m?oe(d)&&(f?i([...d,p.inputValue]):o([...d,p.inputValue])):f?i(d):o(d)};return G(q,{children:[G("div",{className:"question-container",children:[G(Jn,{question:e,forceDisableHtml:t}),G("fieldset",{className:"multiple-choice-options limit-height",children:[G("legend",{className:"sr-only",children:m?" Select all that apply":" Select one"}),c.map((t,r)=>{const o=!!e.hasOpenChoice&&r===e.choices.length-1,i=`surveyQuestion${n}Choice${r}`,s=`${i}Open`,u=o?p.isSelected:y?d===t:oe(d)&&d.includes(t);return G("label",{className:o?"choice-option-open":"",children:[G("div",{className:"response-choice",children:[G("input",{type:y?"radio":"checkbox",name:i,checked:u,onChange:()=>b(t,o),id:i,"aria-controls":s}),G("span",{children:o?`${t}:`:t})]}),o&&G("input",{type:"text",ref:a,id:s,name:`question${n}Open`,value:p.inputValue,onKeyDown:x,onInput:w,onClick(e){p.isSelected||b(t,!0),e.stopPropagation()},"aria-label":`${t} - please specify`})]},r)})]})]}),G(Yn,{text:e.buttonText||"Submit",submitDisabled:k(),appearance:r,onSubmit:S,onPreviewSubmit:S,skipSubmitButton:g,canGoBack:u,onBack:l})]})}const lr=[1,2,3,4,5],ar=[1,2,3,4,5,6,7],cr=[0,1,2,3,4,5,6,7,8,9,10],dr={2:[Un,Zn],3:[On,Rn,An],5:[Qn,On,Rn,An,Vn]};function vr(e){switch(e){case 5:default:return lr;case 7:return ar;case 10:return cr}}const pr=Vt("[Surveys]");function hr(e,t,n){var r;const o=e.questions[t],i=t+1;if(!(null===(r=o.branching)||void 0===r?void 0:r.type))return t===e.questions.length-1?Mt:i;if(o.branching.type===Mt)return Mt;if("specific_question"===o.branching.type){if(Number.isInteger(o.branching.index))return o.branching.index}else if("response_based"===o.branching.type){if(o.type===It){var s;let e=o.choices.indexOf(`${n}`);if(-1===e&&o.hasOpenChoice&&(e=o.choices.length-1),null===(s=o.branching)||void 0===s||null===(s=s.responseValues)||void 0===s?void 0:s.hasOwnProperty(e)){const t=o.branching.responseValues[e];if(Number.isInteger(t))return t;if(t===Mt)return Mt}}else if(o.type===Ct){var u;if(o.optional&&ae(n))return i===e.questions.length?Mt:i;if("number"!=typeof n||!Number.isInteger(n))throw new Error("The response type must be an integer");const t=function(e,t){if(2===t){if(1>e||e>2)throw new Error("The response must be in range 1-2");return 1===e?"positive":"negative"}if(3===t){if(1>e||e>3)throw new Error("The response must be in range 1-3");return 1===e?"negative":2===e?"neutral":"positive"}if(5===t){if(1>e||e>5)throw new Error("The response must be in range 1-5");return e>2?3===e?"neutral":"positive":"negative"}if(7===t){if(1>e||e>7)throw new Error("The response must be in range 1-7");return e>3?4===e?"neutral":"positive":"negative"}if(10===t){if(0>e||e>10)throw new Error("The response must be in range 0-10");return e>6?e>8?"promoters":"passives":"detractors"}throw new Error("The scale must be one of: 2, 3, 5, 7, 10")}(n,o.scale);if(null===(u=o.branching)||void 0===u||null===(u=u.responseValues)||void 0===u?void 0:u.hasOwnProperty(t)){const e=o.branching.responseValues[t];if(Number.isInteger(e))return e;if(e===Mt)return Mt}}return i}return pr.warn("Falling back to next question index due to unexpected branching type"),i}const fr=Vt("[SurveyTranslations]");function yr(e,t){const n=function(e){var t;return function({overrideLanguage:e,storedPersonProperties:t,locale:n},r){const o=Jt(e);if(o)return null==r||r.info(`Using override display language: ${o}`),o;const i=function(e){return e&&"object"==typeof e&&"language"in e?Jt(e.language):null}(t);if(i)return null==r||r.info(`Using person property language: ${i}`),i;const s=Jt(n);return s?(null==r||r.info(`Using detected locale: ${s}`),s):(null==r||r.info("No user language detected"),null)}({overrideLanguage:e.config.overrideLanguage,storedPersonProperties:null===(t=e.client)||void 0===t?void 0:t.kv.get("$stored_person_properties"),locale:"u">typeof navigator?navigator.language||navigator.userLanguage:void 0},fr)}(t);if(!n)return fr.info("No user language detected"),{survey:e,language:null};const r=nn(e,n,fr);return{survey:r.survey,language:r.matchedKey}}const mr="ph:show_survey_widget",gr="PHWidgetSurveyClickListener";function br(e,t){try{const n=e.getBoundingClientRect(),r=window.innerHeight,o=window.innerWidth;let i=n.left+n.width/2-t/2;i+t>o-20&&(i=o-t-20),20>i&&(i=20);const s=r-n.bottom,u=250>s&&n.top>s;return{position:"fixed",top:u?"auto":`${n.bottom+12}px`,left:`${i}px`,right:"auto",bottom:u?r-n.top+12+"px":"auto",zIndex:fn.zIndex}}catch(e){return an.warn("Failed to calculate trigger position:",e),null}}var wr=class{constructor(e){var t,n;this.bi=new Map,this.wi=new Map,this.ki=new Map,this.Si=new Map,this.xi=new Set,this.Ci=!1,this.Ii=null,this.Mi=!1,this.Ti=null,this.Ri=null,this.$i=null,this.Ei=!1,this.handlePageUnload=()=>{var e;const t=null===(e=this.Ai.client)||void 0===e?void 0:e.kv.get(W);if(t)for(const e of t)Fn(e)&&qn(e,this.Ai)},this.handlePopoverSurvey=(e,t,{resumeDelayFromActivation:n=!1}={})=>{var r,o,i,s,u,l,a;if(!(null===(r=this.Ai.client)||void 0===r?void 0:r.canCapture))return;const{survey:c,language:d}=this.Oi(e);this.Ii=d,this.$i=null,this.Pi=t;const v=this.Li(c,t);this.Fi(v.id);const{properties:p,initialResponses:h}=null!=t?t:{},f=!(!h||0>=Object.keys(h).length)&&this.Di(v,h,p,d);if(f&&!(null===(o=v.appearance)||void 0===o?void 0:o.displayThankYouMessage))return;this.Ni(v);let y={};if((null===(i=v.appearance)||void 0===i?void 0:i.position)===St&&(null===(s=v.appearance)||void 0===s?void 0:s.widgetSelector)){var m;const e=document.querySelector(v.appearance.widgetSelector);e&&(y=br(e,parseInt((null===(m=v.appearance)||void 0===m?void 0:m.maxWidth)||fn.maxWidth))||{})}const g=(null===(u=v.appearance)||void 0===u?void 0:u.surveyPopupDelaySeconds)||0,{shadow:b}=bn(v,this.Ai);this.Si.set(b,b.host);const w={posthog:this.Ai,survey:v,removeSurveyFromFocus:this.qi,properties:p,style:y,isSurveyCompleted:f,skipShownEvent:null==t?void 0:t.skipShownEvent,surveyLanguage:d};if(this.$i=w,0>=g)return this.Mi=!0,U(G(qr,Ne({},w)),b);const x=()=>{this.Mi=!0;const{survey:n,language:r}=this.Oi(e);this.Ii=r;const o=this.Li(n,t),i=Ne(Ne({},w),{},{survey:o,surveyLanguage:r});this.$i=i,U(G(qr,Ne(Ne({},i),{},{survey:Ne(Ne({},o),{},{appearance:Ne(Ne({},o.appearance),{},{surveyPopupDelaySeconds:0})})})),b)},k=()=>{var e;if(!(null===(e=this.Ai.client)||void 0===e?void 0:e.canCapture)||!this.ji(v))return an.info(`Survey ${v.id} no longer eligible when its display delay elapsed; not displaying`),this.qi(v);x()},S=n?null===(l=this.Ai.surveys)||void 0===l||null===(l=l._surveyEventReceiver)||void 0===l||null===(a=l.getActivationTimestamp)||void 0===a?void 0:a.call(l,v.id):void 0,q=ce(S)?Math.max(0,Date.now()-S):0,_=Math.max(0,1e3*g-q);if(0>=_)return k();const T=window.setTimeout(()=>{this.bi.delete(v.id),k()},_);this.bi.set(v.id,T)},this.Bi=e=>{var t;const{survey:n,language:r}=this.Oi(e),{shadow:o,isNewlyCreated:i}=bn(n,this.Ai);this.Si.set(o,o.host),(null===(t=e.appearance)||void 0===t?void 0:t.widgetType)===bt&&this.ki.set(e.id,e),i&&U(G(Tr,{posthog:this.Ai,survey:n,surveyLanguage:r},e.id),o)},this.zi=e=>{const t=this.wi.get(e);t&&(t.element.removeEventListener("click",t.listener),t.element.removeAttribute(gr),this.wi.delete(e),an.info(`Removed click listener for survey ${e}`))},this.Hi=e=>{this.Ui(e)||(this.Wi(e),this.zi(e.id))},this.Vi=e=>{this.Ui(e)||(this.Wi(e),this.ki.delete(e.id))},this.Ui=e=>{try{var t;const n=document.querySelector(Ln(e,!0));return!!(null==n||null===(t=n.shadowRoot)||void 0===t?void 0:t.querySelector(".ph-survey"))}catch(e){return!1}},this.Gi=(e,t)=>{const n=document.querySelector(t),r=this.wi.get(e.id);if(n){if(this.Bi(e),r){if(n===r.element)return;an.info(`Selector element changed for survey ${e.id}. Re-attaching listener.`),this.zi(e.id)}if(!n.hasAttribute(gr)){const t=t=>{var n,r;t.stopPropagation();const o=(null===(n=e.appearance)||void 0===n?void 0:n.position)===St?br(t.currentTarget,parseInt((null===(r=e.appearance)||void 0===r?void 0:r.maxWidth)||fn.maxWidth)):{};window.dispatchEvent(new CustomEvent(mr,{detail:{surveyId:e.id,position:o}}))};Ut(n,"click",t),n.setAttribute(gr,"true"),this.wi.set(e.id,{element:n,listener:t,survey:e}),an.info(`Attached click listener for feedback button survey ${e.id}`)}}else r&&this.Hi(e)},this.renderPopover=e=>{var t;if(!(null===(t=this.Ai.client)||void 0===t?void 0:t.canCapture))return;const{survey:n,language:r}=this.Oi(e),{shadow:o}=bn(n,this.Ai);this.Si.set(o,o.host),U(G(qr,{posthog:this.Ai,survey:n,removeSurveyFromFocus:this.qi,surveyLanguage:r}),o)},this.renderSurvey=(e,t,n)=>{var r;if(!(null===(r=this.Ai.client)||void 0===r?void 0:r.canCapture))return;const{survey:o,language:i}=this.Oi(e);let s=!1;this.Ai.config.prefillFromUrl&&(s=this.Qi(o,i,n)),U(G(qr,{posthog:this.Ai,survey:o,removeSurveyFromFocus:this.qi,isPopup:!1,properties:n,isSurveyCompleted:s,surveyLanguage:i}),t)},this.getActiveMatchingSurveys=(e,t=!1)=>{var n;null===(n=this.Ai.surveys)||void 0===n||n.getSurveys(t=>{e(t.filter(e=>this.ji(e)))},t)},this.callSurveysAndEvaluateDisplayLogic=(e=!1)=>{this.getActiveMatchingSurveys(e=>{var t;const n=null===(t=this.Ai.client)||void 0===t?void 0:t.canCapture,r=e.filter(e=>n&&(e.type===qt||e.type===_t)),o=new Set(r.map(e=>e.id));for(const e of Array.from(this.bi.keys()))o.has(e)||this.cancelSurvey(e);const i=this.Zi(r),s=new Set,u=new Set;i.forEach(e=>{if(e.type===_t){var t,n,r,o;if((null===(t=e.appearance)||void 0===t?void 0:t.widgetType)===bt)return u.add(e.id),void this.Bi(e);"selector"===(null===(n=e.appearance)||void 0===n?void 0:n.widgetType)&&(null===(r=e.appearance)||void 0===r?void 0:r.widgetSelector)&&(s.add(e.id),this.Gi(e,null===(o=e.appearance)||void 0===o?void 0:o.widgetSelector))}le(this.Ji)&&e.type===qt&&this.handlePopoverSurvey(e,void 0,{resumeDelayFromActivation:!0})}),this.wi.forEach(({survey:e})=>{s.has(e.id)||this.Hi(e)}),this.ki.forEach((e,t)=>{u.has(t)||this.Vi(e)})},e)},this.Ni=e=>{le(this.Ji)||an.error(`Survey ${this.Ji} already in focus. Cannot add survey ${e.id}.`),this.Ji=e.id},this.qi=e=>{this.Ji!==e.id&&an.error(`Survey ${e.id} is not in focus. Cannot remove survey ${e.id}.`),this.Fi(e.id),this.Ji=null,this.Ii=null,this.Mi=!1,this.$i=null,this.Pi=void 0,this.Wi(e)},this.Ai=e,this.Ji=null,this.Ti=()=>this.Ki(),Ut(window,"languagechange",this.Ti),this.Ri=null!==(t=null===(n=e.client)||void 0===n||null===(n=n.getExtension("featureFlagsCommon"))||void 0===n?void 0:n.onFeatureFlags(()=>this.Ki()))&&void 0!==t?t:null}Ki(){var e;if(le(this.Ji))return;const t=null===(e=this.Ai.client)||void 0===e?void 0:e.kv.get(W),n=null==t?void 0:t.find(e=>e.id===this.Ji);if(!n)return;const{survey:r,language:o}=this.Oi(n);if(o===this.Ii)return;if(this.Ii=o,!this.Mi)return;const i=this.Li(r,this.Pi),{shadow:s}=bn(i,this.Ai);U(G(qr,Ne(Ne({},this.$i),{},{posthog:this.Ai,survey:i,removeSurveyFromFocus:this.qi,surveyLanguage:o})),s)}Li(e,t){return(null==t?void 0:t.position)||(null==t?void 0:t.selector)?Ne(Ne({},e),{},{appearance:Ne(Ne(Ne({},e.appearance),t.position&&{position:t.position}),t.selector&&{widgetSelector:t.selector})}):e}Fi(e){const t=this.bi.get(e);t&&(clearTimeout(t),this.bi.delete(e))}cancelSurvey(e){this.bi.has(e)&&(an.info(`Cancelled pending survey ${e}`),this.Fi(e),this.Ji===e&&(this.Ji=null,this.Ii=null,this.Mi=!1,this.$i=null,this.Pi=void 0))}startAutomaticDisplay(){if(this.Ci||this.Xi||!1===this.Ai.config.automaticDisplay)return;this.Xi=()=>{};const e=function(e){let t;e.callSurveysAndEvaluateDisplayLogic(!0);const n=()=>{se(t)&&(t=setInterval(()=>{e.callSurveysAndEvaluateDisplayLogic(!1)},1e3))},r=()=>{se(t)||(clearInterval(t),t=void 0)};n();const o=()=>{document.hidden?r():(e.callSurveysAndEvaluateDisplayLogic(!1),n())};return Ut(document,"visibilitychange",o),()=>{r(),document.removeEventListener("visibilitychange",o)}}(this);this.Ci?e():this.Xi=e}clearInMemoryInProgressSurveyState(){(()=>{for(const e of Object.keys(Bn))delete Bn[e]})()}dispose(){var e;this.Ci=!0,null===(e=this.Xi)||void 0===e||e.call(this),this.Xi=void 0,this.Ti&&(window.removeEventListener("languagechange",this.Ti),this.Ti=null),this.Ri&&(this.Ri(),this.Ri=null),this.bi.forEach((e,t)=>this.Fi(t)),this.wi.forEach((e,t)=>this.zi(t)),this.Si.forEach((e,t)=>{U(null,t),null==e||e.remove()}),this.Si.clear(),this.ki.clear(),this.Ji=null}Zi(e){return e.sort((e,t)=>{var n,r;const o=Fn(e),i=Fn(t);if(o&&!i)return-1;if(!o&&i)return 1;const s=e.schedule===Nt,u=t.schedule===Nt;return s&&!u?1:!s&&u?-1:((null===(n=e.appearance)||void 0===n?void 0:n.surveyPopupDelaySeconds)||0)-((null===(r=t.appearance)||void 0===r?void 0:r.surveyPopupDelaySeconds)||0)})}Oi(e){return yr(e,this.Ai)}Qi(e,t,n){if(this.xi.has(e.id))return!1;const{params:r}=function(){const e={};let t=!1;const n=window.location.search.replace(/^\?/,"");if(!n)return{params:e,autoSubmit:t};const r=n.split("&");for(const n of r){const r=n.indexOf("=");if(0>=r)continue;let o,i;try{o=decodeURIComponent(n.slice(0,r)),i=decodeURIComponent(n.slice(r+1))}catch(e){continue}if("auto_submit"===o&&"true"===i){t=!0;continue}const s=o.match(/^q(\d+)$/);if(s){const t=parseInt(s[1],10);e[t]||(e[t]=[]),e[t].push(i)}}return{params:e,autoSubmit:t}}();if(0===Object.keys(r).length)return!1;an.info("[Survey Prefill] Detected URL prefill parameters");const o=this.Yi(e,r,t);return!!o&&(this.tr(e,o,n,t),this.xi.add(e.id),o.isSurveyCompleted)}tr(e,t,n,r){const{responses:o,submissionId:i,isSurveyCompleted:s,skippedResponses:u}=t;(Object.keys(u).length>0&&e.enable_partial_responses||s)&&xn({responses:s?o:u,survey:e,surveySubmissionId:i,posthog:this.Ai,isSurveyCompleted:s,properties:n,surveyLanguage:r})}Di(e,t,n,r){const o={};for(const[e,n]of Object.entries(t))o[parseInt(e)]=oe(n)?n.map(String):[String(n)];an.info("[Survey] Processing initial responses");const i=this.Yi(e,o,r);return!!i&&(this.tr(e,i,n,r),i.isSurveyCompleted)}Yi(e,t,n){try{const r=function(e,t){const n={};return e.questions.forEach((e,r)=>{if(!t[r]||!e.id)return;const o=t[r],i=Zt(e.id);try{switch(e.type){case It:{if(!e.choices||0===e.choices.length)return void Qt.warn(`[Survey Prefill] Question ${r} has no choices`);const t=parseInt(o[0],10);if(isNaN(t)||0>t||t>=e.choices.length)return void Qt.warn(`[Survey Prefill] Invalid choice index for q${r}: ${o[0]}`);n[i]=e.choices[t];break}case $t:{if(!e.choices||0===e.choices.length)return void Qt.warn(`[Survey Prefill] Question ${r} has no choices`);const t=o.map(e=>parseInt(e,10)).filter(t=>!isNaN(t)&&t>=0&&e.choices.length>t);if(0===t.length)return void Qt.warn(`[Survey Prefill] No valid choices for q${r}`);const s=[...new Set(t.map(t=>e.choices[t]))];t.length>s.length&&Qt.warn(`[Survey Prefill] Removed duplicate choices for q${r}`),n[i]=s;break}case Ct:{const t=parseInt(o[0],10),s=e.scale||10,u=10===s?0:1;if(isNaN(t)||u>t||t>s)return void Qt.warn(`[Survey Prefill] Invalid rating for q${r}: ${o[0]} (scale: ${u}-${s})`);n[i]=t;break}default:Qt.info(`[Survey Prefill] Question type ${e.type} does not support prefill`)}}catch(e){Qt.error(`[Survey Prefill] Error converting q${r}:`,e)}}),n}(e,t);if(0===Object.keys(r).length)return an.warn("[Survey Prefill] No valid responses after conversion"),null;const o=Ve(),{startQuestionIndex:i,skippedResponses:s,skippedIndices:u}=function(e,t,n){let r=0;const o={},i=[],s=e.questions.length+1;let u=0;for(;e.questions.length>r&&s>u&&(u++,t.includes(r));){const t=e.questions[r];if(!t||!("skipSubmitButton"in t)||!t.skipSubmitButton)break;if(t.id){const e=Zt(t.id);se(n[e])||(o[e]=n[e])}i.push(r);const s=hr(e,r,t.id?n[Zt(t.id)]:null);if(s===Mt)return{startQuestionIndex:e.questions.length,skippedResponses:o,skippedIndices:i};r=s}return{startQuestionIndex:r,skippedResponses:o,skippedIndices:i}}(e,Object.keys(t).map(e=>parseInt(e,10)).filter(t=>{const n=e.questions[t];return(null==n?void 0:n.id)&&!se(r[Zt(n.id)])}),r),l=i>=e.questions.length;return Dn(e,{surveySubmissionId:o,responses:r,lastQuestionIndex:i,questionOrder:_n(e.questions),visitedIndices:u,surveyLanguage:n}),an.info("[Survey Prefill] Stored prefilled responses in localStorage"),{responses:r,submissionId:o,startQuestionIndex:i,isSurveyCompleted:l,skippedResponses:s}}catch(e){return an.error("[Survey Prefill] Error handling prefill:",e),null}}er(e,t){var n;if(!e)return!0;const r=null===(n=this.Ai.client)||void 0===n?void 0:n.getExtension(K),o=!!(null==r?void 0:r.isFeatureEnabled(e,{send_event:!e.startsWith("survey-targeting-")}));let i=!0;t&&(i=(null==r?void 0:r.getFeatureFlag(e,{send_event:!1}))===t||"any"===t);const s=o&&i;return s||this.nr(e),s}nr(e){this.Ei||!1!==this.Ai.config.featureFlagEvaluation||(this.Ei=!0,an.warn(`Survey feature flag "${e}" evaluated to false because advanced_disable_feature_flags is set. PostHog creates an internal targeting flag for almost every survey, so no survey can display while flags are disabled. To keep surveys working, replace advanced_disable_feature_flags with advanced_only_evaluate_survey_feature_flags, which evaluates survey flags only.`))}ir(e){return!e.conditions||Mn(e,this.Ai)&&Nn(e)&&function(e){var t,n;return!(null===(t=e.conditions)||void 0===t?void 0:t.selector)||!!(null===(n=document)||void 0===n?void 0:n.querySelector(e.conditions.selector))}(e)}rr(e){var t;return Pn(e)?{satisfied:!0}:e.internal_targeting_flag_key&&function(e){var t;return"recurring"===e.schedule||(null!==(t=e.current_iteration)&&void 0!==t?t:0)>0}(e)&&!(null===(t=this.Ai.client)||void 0===t||null===(t=t.getExtension("featureFlagsCommon"))||void 0===t?void 0:t.hasLoadedFlags)?(this.nr(e.internal_targeting_flag_key),{satisfied:!1,reason:"Feature flags have not loaded yet; deferring internal targeting flag check"}):{satisfied:this.er(e.internal_targeting_flag_key)}}checkSurveyEligibility(e){var t,n;const r={eligible:!0,reason:void 0};if(!function(e){return!(!e.start_date||e.end_date)}(e))return r.eligible=!1,r.reason=`Survey is not running. It was completed on ${e.end_date}`,r;if(!vn.includes(e.type))return r.eligible=!1,r.reason=`Surveys of type ${e.type} are never eligible to be shown in the app`,r;const o=null===(t=e.conditions)||void 0===t?void 0:t.linkedFlagVariant;if(!this.er(e.linked_flag_key,o))return r.eligible=!1,r.reason=o?`Survey linked feature flag is not enabled for variant ${o}`:"Survey linked feature flag is not enabled",r;if(!this.er(e.targeting_flag_key))return r.eligible=!1,r.reason="Survey targeting feature flag is not enabled",r;const i=this.rr(e);var s;return i.satisfied?(e=>{let t=null;try{t=localStorage.getItem("lastSeenSurveyDate")}catch(e){an.error("localStorage error: "+e)}return function(e,t){if(!e||!t)return!0;const n="string"==typeof t?new Date(t):t,r=Math.abs((new Date).getTime()-n.getTime());return Math.ceil(r/864e5)>e}(e,t)})(null===(n=e.conditions)||void 0===n?void 0:n.seenSurveyWaitPeriodInDays)?((e=>{let t=null;try{t=localStorage.getItem(dn(e))}catch(e){an.error("localStorage error: "+e)}return!!t&&!Pn(e)})(e)&&(r.eligible=!1,r.reason="Survey has already been seen and it can't be activated again"),r):(r.eligible=!1,r.reason="Survey wait period has not passed",r):(r.eligible=!1,r.reason=null!==(s=i.reason)&&void 0!==s?s:"Survey internal targeting flag is not enabled and survey cannot activate repeatedly and survey is not in progress",r)}checkSurveyCaptureEligibility(){var e;return(null===(e=this.Ai.client)||void 0===e?void 0:e.canCapture)?{eligible:!0}:{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"}}checkSurveyDisplayEligibility(e){const t=this.checkSurveyCaptureEligibility();return t.eligible?this.checkSurveyEligibility(e):t}checkSurveyRenderability(e){const t=this.checkSurveyDisplayEligibility(e);return t.eligible&&!this.sr(e)?{eligible:!1,reason:"Survey event/action trigger has not been fired yet"}:t}sr(e){var t;if(!rn(e)&&!function(e){var t;return!!(null===(t=e.conditions)||void 0===t||null===(t=t.actions)||void 0===t||null===(t=t.values)||void 0===t?void 0:t.length)}(e))return!0;const n=null===(t=this.Ai.surveys)||void 0===t||null===(t=t._surveyEventReceiver)||void 0===t?void 0:t.getSurveys();return!!(null==n?void 0:n.includes(e.id))}ar(e){var t;return!(null===(t=e.feature_flag_keys)||void 0===t?void 0:t.length)||e.feature_flag_keys.every(({key:e,value:t})=>!e||!t||this.er(t))}ji(e){return this.checkSurveyEligibility(e).eligible&&this.ir(e)&&this.sr(e)&&this.ar(e)}Wi(e){try{const t=document.querySelector(Ln(e,!0));(null==t?void 0:t.shadowRoot)&&(U(null,t.shadowRoot),this.Si.delete(t.shadowRoot)),null==t||t.remove()}catch(t){an.warn(`Failed to remove survey ${e.id} from DOM:`,t)}}getTestAPI(){return{addSurveyToFocus:this.Ni,removeSurveyFromFocus:this.qi,surveyInFocus:this.Ji,surveyTimeouts:this.bi,handleWidget:this.Bi,handlePopoverSurvey:this.handlePopoverSurvey,manageWidgetSelectorListener:this.Gi,sortSurveysByAppearanceDelay:this.Zi.bind(this),checkFlags:this.ar.bind(this),isSurveyFeatureFlagEnabled:this.er.bind(this),onLanguageChange:this.Ki.bind(this),currentLanguage:this.Ii,surveyIsRendered:this.Mi}}};function xr({survey:e,removeSurveyFromFocus:t=()=>{},setSurveyVisible:n,isPreviewMode:r=!1,posthog:o}){lt(()=>{var i;if(r||!(null===(i=e.conditions)||void 0===i?void 0:i.url))return;const s=()=>{var r;const i=e.type===_t,s=Mn(e,o),u=(null===(r=e.appearance)||void 0===r?void 0:r.widgetType)===bt&&i;if(!s)return an.info(`Hiding survey ${e.id} because URL does not match`),n(!1),t(e);u&&(an.info(`Showing survey ${e.id} because it is a feedback button tab and URL matches`),n(!0))};Ut(window,"popstate",s),Ut(window,"hashchange",s);const u=window.history.pushState,l=window.history.replaceState;return window.history.pushState=function(...e){u.apply(this,e),s()},window.history.replaceState=function(...e){l.apply(this,e),s()},()=>{window.removeEventListener("popstate",s),window.removeEventListener("hashchange",s),window.history.pushState=u,window.history.replaceState=l}},[r,e,t,n,o])}const kr=200;function Sr(e="right"){switch(e){case"top":return{top:"0",left:"50%",transform:"translateX(-50%)"};case"left":return{top:"50%",left:"0",transform:"rotate(90deg) translateY(-100%)",transformOrigin:"left top"};case"bottom":return{bottom:"0",left:"50%",transform:"translateX(-50%)"};default:return{top:"50%",right:"0",transform:"rotate(-90deg) translateY(-100%)",transformOrigin:"right top"}}}function qr({survey:e,forceDisableHtml:t,posthog:n,style:r={},previewPageIndex:o,removeSurveyFromFocus:i=()=>{},isPopup:s=!0,onPreviewSubmit:u=()=>{},onPreviewBack:l=()=>{},onPopupSurveyDismissed:a=()=>{},onCloseConfirmationMessage:c=()=>{},properties:d,isSurveyCompleted:v,skipShownEvent:p,surveyLanguage:h}){var f,y,m,g,b,w,x,k,S,q,_,T;const P=at(null),I=Number.isInteger(o),{isPopupVisible:C,isSurveySent:M,hidePopupWithAnimation:N}=function(e,t,n,r,o,i,s,u,l){const[a,c]=ut(r||0===n||e.type===Tt),[d,v]=ut(!1),p=at(!1),h=()=>{const t=()=>{i&&o(e),c(!1)};if(p.current)return;const n=null==s?void 0:s.current;n?(p.current=!0,n.style.transition=`opacity ${kr}ms ease-out`,n.style.opacity="0",setTimeout(()=>{p.current=!1,t()},250)):t()},f=t=>{t.detail.surveyId===e.id&&h()};return lt(()=>{if(!t)return void an.error("usePopupVisibility hook called without a PostHog instance.");if(r)return;let o;const i=t=>{var n,r;if(t.detail.surveyId===e.id){if(!(null===(n=e.appearance)||void 0===n?void 0:n.displayThankYouMessage))return h();v(!0),(null===(r=e.appearance)||void 0===r?void 0:r.autoDisappear)&&(o&&clearTimeout(o),o=setTimeout(h,5e3))}},s=()=>{var n;if(Mn(e,t)){c(!0);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(e){}window.dispatchEvent(new Event("PHSurveyShown")),u||null===(n=t.client)||void 0===n||n.capture(Et,Ne(Ne({[Ft]:e.name,[jt]:e.id,[Ht]:e.current_iteration,[Lt]:e.current_iteration_start_date},l&&{[zt]:l}),{},{sessionRecordingUrl:Y(t)}))}};Ut(window,"PHSurveyClosed",f),Ut(window,"PHSurveySent",i);const a=n>0?setTimeout(s,n):void 0;return se(a)&&s(),()=>{se(a)||clearTimeout(a),se(o)||clearTimeout(o),window.removeEventListener("PHSurveyClosed",f),window.removeEventListener("PHSurveySent",i)}},[]),xr({survey:e,removeSurveyFromFocus:o,setSurveyVisible:c,isPreviewMode:r,posthog:t}),{isPopupVisible:a,isSurveySent:d,setIsPopupVisible:c,hidePopupWithAnimation:h}}(e,n,(null===(f=e.appearance)||void 0===f?void 0:f.surveyPopupDelaySeconds)?1e3*e.appearance.surveyPopupDelaySeconds:0,I,i,s,P,p,h),E=M||o===e.questions.length||!0===v,[B,D]=ut(!1),j=ct(()=>!!jn(e),[e]),F=!(!(null===(y=e.appearance)||void 0===y?void 0:y.introScreenHeader)&&!(null===(m=e.appearance)||void 0===m?void 0:m.introScreenDescription)),H=I?-1===o:!!(null===(g=e.appearance)||void 0===g?void 0:g.displayIntroScreen)&&F&&!B&&!j,L=ct(()=>{const t=jn(e),r=(null==t?void 0:t.surveySubmissionId)||Ve()||"";return{isPreviewMode:I,previewPageIndex:o,onPopupSurveyDismissed(){h?Sn(e,n,I,h):Sn(e,n,I),a()},isPopup:s||!1,surveySubmissionId:r,onPreviewSubmit:u,onPreviewBack:l,posthog:n,properties:d,surveyLanguage:h}},[I,o,s,n,e,a,u,l,d,h]);return C?G($n.Provider,{value:L,children:G("div",{className:"ph-survey",style:Ne(Ne({},zn(e.type,null===(b=e.appearance)||void 0===b?void 0:b.position,null===(w=e.appearance)||void 0===w?void 0:w.widgetType)),r),ref:P,children:E?G(er,{header:(null===(x=e.appearance)||void 0===x?void 0:x.thankYouMessageHeader)||"Thank you!",description:(null===(k=e.appearance)||void 0===k?void 0:k.thankYouMessageDescription)||"",forceDisableHtml:!!t,contentType:null===(S=e.appearance)||void 0===S?void 0:S.thankYouMessageDescriptionContentType,appearance:e.appearance||fn,onClose(){N(),c()}}):H?G(tr,{header:(null===(q=e.appearance)||void 0===q?void 0:q.introScreenHeader)||"",description:(null===(_=e.appearance)||void 0===_?void 0:_.introScreenDescription)||"",forceDisableHtml:!!t,contentType:null===(T=e.appearance)||void 0===T?void 0:T.introScreenDescriptionContentType,appearance:e.appearance||fn,onStart:()=>D(!0)}):G(_r,{survey:e,forceDisableHtml:!!t,posthog:n})})}):null}function _r({survey:e,forceDisableHtml:t,posthog:n}){var r,o;const i=ct(()=>{const t=jn(e);if(!t)return null;const n=ce(t.lastQuestionIndex);return!n||n&&t.lastQuestionIndex>=0&&e.questions.length>t.lastQuestionIndex?t:(Hn(e),null)},[e]),[s,u]=ut(()=>((null==i?void 0:i.responses)&&an.info("Survey is already in progress, filling in initial responses"),(null==i?void 0:i.responses)||{})),[l,a]=ut(!1),{previewPageIndex:c,onPopupSurveyDismissed:d,isPopup:v,onPreviewSubmit:p,onPreviewBack:h,surveySubmissionId:f,isPreviewMode:y,properties:m,surveyLanguage:g}=dt($n),[b,w]=ut(()=>{const t=null==i?void 0:i.lastQuestionIndex,n=ce(t)&&t>=0&&e.questions.length>t?t:0;return ce(c)&&c>=0?c:n}),[x,k]=ut(()=>{var t;return(null!==(t=null==i?void 0:i.visitedIndices)&&void 0!==t?t:[]).filter(t=>t>=0&&e.questions.length>t)}),[S,q]=ut(()=>{var t;const n=jn(e);return null!==(t=null==n?void 0:n.questionSnapshots)&&void 0!==t?t:{}}),_=ct(()=>_n(Tn(e,i)),[e.id,i]),T=ct(()=>{if(!_||new Set(_).size!==_.length)return Tn(e,i);const t=new Map(e.questions.map(e=>[e.id,e])),n=_.map(e=>t.get(e)).filter(e=>!!e);return n.length===_.length?n:e.questions},[_,e.questions,e,i]);lt(()=>{!y||se(c)||0>c||w(c)},[c,y]);const P=!!(null===(r=e.appearance)||void 0===r?void 0:r.allowGoBack)&&(y?(null!=c?c:0)>0:x.length>0),I=T.at(b);return I?G("form",{className:"survey-form",name:"surveyForm",children:[v&&!0!==(null===(o=e.appearance)||void 0===o?void 0:o.hideCancelButton)&&G(Xn,{onClick(){d()}}),G("div",{className:"survey-box","data-question-index":b,children:[l&&G("p",{role:"alert",children:"Your response could not be sent. Please try again later."}),Pr({question:I,forceDisableHtml:t,displayQuestionIndex:b,appearance:e.appearance||fn,onSubmit:t=>(({res:t,displayQuestionIndex:r,questionId:o})=>{var i;if(!n)return void an.error("onNextButtonClick called without a PostHog instance.");if(!(null===(i=n.client)||void 0===i?void 0:i.canCapture))return void a(!0);if(a(!1),!o)return void an.error("onNextButtonClick called without a questionId.");const{responses:l,questionSnapshots:c}=function({responses:e,questionSnapshots:t={}},n,r,o){return{responses:Ne(Ne({},e),{},{[Zt(n)]:r}),questionSnapshots:(null==o?void 0:o.id)?Ne(Ne({},t),{},{[o.id]:o.question}):t}}({responses:s,questionSnapshots:S},o,t,T[r]);u(l),q(c);const d=hr(e,r,t),v=d===Mt,p=[...x,r];if(v||(k(p),w(d),Dn(e,{surveySubmissionId:f,responses:l,lastQuestionIndex:d,questionOrder:_n(T),visitedIndices:p,surveyLanguage:g,questionSnapshots:c})),e.enable_partial_responses||v){const t=new Set(p.map(e=>{var t;return null===(t=T[e])||void 0===t?void 0:t.id}).filter(e=>!!e).map(e=>Zt(e))),r=Object.fromEntries(Object.entries(l).filter(([e])=>t.has(e)));xn({responses:r,survey:e,surveySubmissionId:f,isSurveyCompleted:v,posthog:n,properties:m,surveyLanguage:g,questionSnapshots:c})}})({res:t,displayQuestionIndex:b,questionId:I.id}),onPreviewSubmit:p,initialValue:I.id?s[Zt(I.id)]:void 0,canGoBack:P,onBack(){if(y)return void h();if(0===x.length)return;const t=x[x.length-1],n=x.slice(0,-1);k(n),w(t),Dn(e,{surveySubmissionId:f,responses:s,lastQuestionIndex:t,questionOrder:_n(T),visitedIndices:n,surveyLanguage:g,questionSnapshots:S})}})]})]}):null}function Tr({survey:e,forceDisableHtml:t,posthog:n,readOnly:r,surveyLanguage:o}){var i,s,u,l,a,c,d;const[v,p]=ut(!0),[h,f]=ut(!1),[y,m]=ut({}),g=at(void 0),b=()=>{var e;(h||!n||r||(null===(e=n.client)||void 0===e?void 0:e.canCapture))&&f(!h)};if(lt(()=>{var t;if(!n)return void an.error("FeedbackWidget called without a PostHog instance.");if(r)return;"tab"===(null===(t=e.appearance)||void 0===t?void 0:t.widgetType)&&m({top:"50%",bottom:"auto"});const o=t=>{var n;const r=t;(null===(n=r.detail)||void 0===n?void 0:n.surveyId)===e.id&&(an.info(`Received show event for feedback button survey ${e.id}`),m(r.detail.position||{}),b())};return Ut(window,mr,o),()=>{se(g.current)||(clearTimeout(g.current),g.current=void 0),window.removeEventListener(mr,o)}},[n,r,e.id,null===(i=e.appearance)||void 0===i?void 0:i.widgetType,null===(s=e.appearance)||void 0===s?void 0:s.widgetSelector,null===(u=e.appearance)||void 0===u?void 0:u.borderColor]),xr({survey:e,setSurveyVisible:p,posthog:n}),!v)return null;const w=()=>{e.schedule!==Nt&&p(!1),se(g.current)||clearTimeout(g.current),g.current=setTimeout(()=>{g.current=void 0,f(!1)},200)};return G(q,{children:["tab"===(null===(l=e.appearance)||void 0===l?void 0:l.widgetType)&&G("button",{className:"ph-survey-widget-tab "+("top"===(null===(a=e.appearance)||void 0===a?void 0:a.tabPosition)?"widget-tab-top":""),onClick:b,disabled:r,style:Sr(null===(c=e.appearance)||void 0===c?void 0:c.tabPosition),children:(null===(d=e.appearance)||void 0===d?void 0:d.widgetLabel)||""}),h&&G(qr,{posthog:n,survey:e,forceDisableHtml:t,style:y,onPopupSurveyDismissed:w,onCloseConfirmationMessage:w,surveyLanguage:o})]})}const Pr=({question:e,forceDisableHtml:t,displayQuestionIndex:n,appearance:r,onSubmit:o,onPreviewSubmit:i,initialValue:s,canGoBack:u,onBack:l})=>{const a={forceDisableHtml:t,appearance:r,onPreviewSubmit(e){i(e)},onSubmit(e){o(e)},initialValue:s,displayQuestionIndex:n,canGoBack:u,onBack:l};switch(e.type){case Pt:return k(rr,Ne(Ne({},a),{},{question:e,key:e.id}));case"link":return k(or,Ne(Ne({},a),{},{question:e,key:e.id}));case Ct:return k(ir,Ne(Ne({},a),{},{question:e,key:e.id}));case It:case $t:return k(ur,Ne(Ne({},a),{},{question:e,key:e.id}));default:return an.error(`Unsupported question type: ${e.type}`),null}};function $r(e){let t=!0;return{dispose(){if(t){t=!1;const n=e();n&&ie(n.then)&&n.then(void 0,()=>{})}}}}const Ir="u">typeof window?window:void 0,Cr="u">typeof globalThis?globalThis:Ir;null!=Cr&&Cr.XMLHttpRequest&&new Cr.XMLHttpRequest;const Mr="undefined"!=typeof globalThis?globalThis:Ir;Mr&&"undefined"==typeof self&&(Mr.self=Mr),Mr&&"undefined"==typeof File&&(Mr.File=function(){});const Nr=null!=Ir?Ir:{};Rt.DEBUG=!1,Rt.LIB_VERSION="1.444.1",Rt.LIB_NAME="web";var Er=Rt;Vt("[AutoCapture]");const Br=(e,t)=>{try{let n;return JSON.stringify(e,(e,t)=>{var r;return function(e){switch({}.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return function(e,t){try{return e instanceof t}catch(e){return!1}}(e,Error)}}(t)?(null!==(r=n)&&void 0!==r||(n=new WeakMap),n.has(t)||n.set(t,function(e){const t=Ne({},e);for(const n of["name","message","stack","cause","errors"])try{n in e&&(t[n]=e[n])}catch(e){}return t}(t)),n.get(t)):"bigint"==typeof t?t.toString():t},t)}catch(t){return function(e){var t;const n=[];return null!==(t=JSON.stringify(e,function(e,t){if("bigint"==typeof t)return t.toString();if("function"!=typeof t&&"symbol"!=typeof t){if(t instanceof Error)return{name:t.name,message:t.message,stack:t.stack};if(t&&"object"==typeof t){for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(n.includes(t))return"[Circular]";n.push(t)}return t}}))&&void 0!==t?t:"null"}(e)}},Dr=function(e,t="&"){let n,r;const o=[];return function(e,t){if(!ae(e))if(oe(e))e.forEach(t);else if((e=>e instanceof FormData)(e))e.forEach((e,n)=>t(e,n));else for(const n in e)ne.call(e,n)&&t(e[n],n)}(e,function(e,t){se(e)||se(t)||"undefined"===t||(n=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),r=encodeURIComponent(t),o[o.length]=r+"="+n)}),o.join(t)};ve(function*(e){const t=yield function(e){return Fe.apply(this,arguments)}(Br(e.data),Er.DEBUG,{rethrow:!0});if(!t)return e;const n=yield t.arrayBuffer();return Ne(Ne({},e),{},{lr:{contentType:"text/plain",body:n,estimatedSize:n.byteLength}})});var jr=class{constructor(e){this._instance=e}initialize(){}get(e){const t=this._instance.persistence;if("string"==typeof e)return null==t?void 0:t.get_property(e);const n={};for(const r of e){const e=null==t?void 0:t.get_property(r);se(e)||(n[r]=e)}return n}set(e,t){var n;null===(n=this._instance.persistence)||void 0===n||n.register("string"==typeof e?{[e]:t}:e)}remove(e){var t;null===(t=this._instance.persistence)||void 0===t||t.unregister(e)}},Fr=class{constructor(e){this.instance=e,this.$=Qt,this.kv=new jr(e),this.onSession=e=>$r(this.instance.onSessionId(t=>{try{e(t)}catch(e){this.$.error("Browser extension session listener failed",e)}})),this.onEvent=e=>$r(this.instance._addCaptureHook((t,n)=>{if(n)try{e({event:t,properties:n.properties})}catch(e){this.$.error("Browser extension event listener failed",e)}})),this.onRemoteConfig=e=>{const t=t=>{try{e(t)}catch(e){this.$.error("Browser extension remote config listener failed",e)}},n=this.instance.ur.on("extensionsRemoteConfig",t);return this.instance.cr&&t(this.instance.cr),$r(n)}}get logger(){return this.$}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return null!==(e=this.instance.get_property("$device_id"))&&void 0!==e?e:this.distinctId}get deviceId(){const e=this.instance.get_property("$device_id");return"string"==typeof e?e:void 0}get library(){return{name:Er.LIB_NAME,version:Er.LIB_VERSION}}get initialPersonProperties(){var e,t;return null!==(e=null===(t=this.instance.persistence)||void 0===t?void 0:t.get_initial_props())&&void 0!==e?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,n,r,o;const i=null===(e=this.instance.sessionManager)||void 0===e?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(t=null==i?void 0:i.sessionId)&&void 0!==t?t:"",windowId:null!==(n=null==i?void 0:i.windowId)&&void 0!==n?n:"",sessionStartTimestamp:null!==(r=null==i?void 0:i.sessionStartTimestamp)&&void 0!==r?r:0,lastActivityTimestamp:null!==(o=null==i?void 0:i.lastActivityTimestamp)&&void 0!==o?o:0}}catch(e){return{sessionId:"",windowId:"",sessionStartTimestamp:0,lastActivityTimestamp:0}}}get isOptedOut(){return this.instance.has_opted_out_capturing()}get canCapture(){return ie(this.instance.is_capturing)?this.instance.is_capturing():!this.isOptedOut}get projectToken(){return this.instance.config.token}getExtension(e){let t;switch(e){case"featureFlags":case K:t=this.instance.featureFlags;break;case"logs":t=this.instance.logs;break;case"surveys":t=this.instance.surveys;break;case"autocapture":t=this.instance.autocapture}return t}capture(e,t,n){if(!n)return void this.instance.capture(e,t);const r=Ne({timestamp:n.timestamp,uuid:n.uuid,$set:n.set,$set_once:n.setOnce},"unload"===n.delivery?{transport:"sendBeacon",send_instantly:!0}:{});this.instance.capture(e,t,r)}registerDynamicEventProperties(e){return $r(this.instance.dr(e))}sendRequest(e){var t=this;return ve(function*(e,n={}){var r;const o=null!==(r=n.target)&&void 0!==r?r:"api",i=n.query?((e,t,n=!0)=>{var r;const[o,i]=e.split("?"),s=Ne({},t),u=null!==(r=null==i?void 0:i.split("&").map(e=>{var t;const[r,o]=e.split("="),i=n&&null!==(t=s[r])&&void 0!==t?t:o;return delete s[r],`${r}=${i}`}))&&void 0!==r?r:[],l=Dr(s);return l&&u.push(l),u.length>0?`${o}?${u.join("&")}`:o})(e,n.query):e,s=t.instance.requestRouter.endpointFor(o,i),u={method:n.method,url:s,data:n.body,headers:n.headers,timeout:n.timeoutMs,fireCallbackOnDrop:!0,transport:n.transport,compression:n.compression,compressionFallback:"flags"===n.target&&"best-available"===n.compression?J.Base64:void 0,timestampMode:n.sentAt};return"api"===o&&"/i/v1/logs"===e&&(u.batchKey="logs"),"sendBeacon"===n.transport?(t.instance._send_request(u),{statusCode:202}):new Promise(e=>{u.callback=e,t.instance._send_request(u)})}).apply(this,arguments)}},Hr=class{constructor(e){this._instance=e}get(){var e,t,n,r;const o=null===(e=this._instance)||void 0===e?void 0:e.config;return{disableSurveys:!!(null==o?void 0:o.disable_surveys),cookielessMode:!!(null==o?void 0:o.cookieless_mode),advancedEnableSurveys:!!(null==o?void 0:o.advanced_enable_surveys),requestTimeoutMs:null!==(t=null==o?void 0:o.surveys_request_timeout_ms)&&void 0!==t?t:1e4,prefillFromUrl:!!(null==o||null===(n=o.surveys)||void 0===n?void 0:n.prefillFromUrl),automaticDisplay:!(null==o?void 0:o.disable_surveys_automatic_display),featureFlagEvaluation:!(null==o?void 0:o.advanced_disable_feature_flags),overrideLanguage:null==o?void 0:o.override_display_language,prepareStylesheet:null==o?void 0:o.prepare_external_dependency_stylesheet,get_current_url:null==o?void 0:o.get_current_url,uiHost:null===(r=this._instance)||void 0===r||null===(r=r.requestRouter)||void 0===r?void 0:r.endpointFor("ui","")}}getExtensions(){const e=null==Nr?void 0:Nr.__PosthogExtensions__;if(!e||!this._instance)return;const t=this._instance,{generateSurveys:n,loadExternalDependency:r}=e;return{generateSurveys:n?e=>n(t,e):void 0,loadExternalDependency:r?e=>r(t,"surveys",e):void 0}}onMatchingConditionsChanged(e){var t,n;const r=null===(t=this._instance)||void 0===t?void 0:t._addCaptureHook(t=>{"$pageview"!==t&&t!==Et&&t!==Bt&&t!==Dt||e()}),o=()=>e();Ut(Ir,"PHSurveyShown",o);let i=!1;const s=null===(n=this._instance)||void 0===n?void 0:n.onFeatureFlags(()=>{i&&e()});return i=!0,()=>{i=!1,null==r||r(),null==s||s(),null==Ir||Ir.removeEventListener("PHSurveyShown",o)}}};const Lr=new WeakMap,zr=(e,t)=>{const n=function(e){var t;const n=new Hr(e);if(!e)return{get config(){return n.get()}};if(null===(t=e.surveys)||void 0===t?void 0:t.getRenderContext)return e.surveys.getRenderContext();let r=Lr.get(e);return r||(r={client:new Fr(e),get config(){return n.get()},surveys:e.surveys},Lr.set(e,r)),r}(e);return n?function(e,t){if(typeof document>"u"||typeof window>"u")return;const n=new wr(e);return!1===e.config.automaticDisplay?(an.info("Surveys automatic display is disabled. Skipping call surveys and evaluate display logic."),n):!1===t?(an.info("There are no surveys to load or Surveys is disabled in the project settings."),n):(n.startAutomaticDisplay(),n)}(n,t):void 0};Nr.__PosthogExtensions__=Nr.__PosthogExtensions__||{},Nr.__PosthogExtensions__.generateSurveys=zr,Nr.extendPostHogWithSurveys=zr,e.default=zr,e.generateSurveys=zr}({});
|
|
1
|
+
!function(e){var t,n,r,o,i,s,u,l,a,c,d,v,p,h,f;Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var y={},m=[],g=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,b=Array.isArray;function w(e,t){for(var n in t)e[n]=t[n];return e}function x(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function k(e,n,r){var o,i,s,u={};for(s in n)"key"==s?o=n[s]:"ref"==s?i=n[s]:u[s]=n[s];if(arguments.length>2&&(u.children=arguments.length>3?t.call(arguments,2):r),"function"==typeof e&&null!=e.defaultProps)for(s in e.defaultProps)void 0===u[s]&&(u[s]=e.defaultProps[s]);return S(e,u,o,i,null)}function S(e,t,o,i,s){var u={type:e,props:t,key:o,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==s?++r:s,__i:-1,__u:0};return null==s&&null!=n.vnode&&n.vnode(u),u}function q(e){return e.children}function _(e,t){this.props=e,this.context=t}function $(e,t){if(null==t)return e.__?$(e.__,e.__i+1):null;for(var n;e.__k.length>t;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?$(e):null}function T(e){if(e.__P&&e.__d){var t=e.__v,r=t.__e,o=[],i=[],s=w({},t);s.__v=t.__v+1,n.vnode&&n.vnode(s),H(e.__P,s,t,e.__n,e.__P.namespaceURI,32&t.__u?[r]:null,o,null==r?$(t):r,!!(32&t.__u),i),s.__v=t.__v,s.__.__k[s.__i]=s,z(o,s,i),t.__e=t.__=null,s.__e!=r&&P(s)}}function P(e){if(null!=(e=e.__)&&null!=e.__c)return e.__e=e.__c.base=null,e.__k.some(function(t){if(null!=t&&null!=t.__e)return e.__e=e.__c.base=t.__e}),P(e)}function I(e){(!e.__d&&(e.__d=!0)&&o.push(e)&&!C.__r++||i!=n.debounceRendering)&&((i=n.debounceRendering)||s)(C)}function C(){try{for(var e,t=1;o.length;)o.length>t&&o.sort(u),e=o.shift(),t=o.length,T(e)}finally{o.length=C.__r=0}}function M(e,t,n,r,o,i,s,u,l,a,c){var d,v,p,h,f,g,b,w=r&&r.__k||m,x=t.length;for(l=N(n,t,w,l,x),d=0;x>d;d++)null!=(p=n.__k[d])&&(v=-1!=p.__i&&w[p.__i]||y,p.__i=d,g=H(e,p,v,o,i,s,u,l,a,c),h=p.__e,p.ref&&v.ref!=p.ref&&(v.ref&&O(v.ref,null,p),c.push(p.ref,p.__c||h,p)),null==f&&null!=h&&(f=h),(b=!!(4&p.__u))||v.__k===p.__k?(l=E(p,l,e,b),b&&v.__e&&(v.__e=null)):"function"==typeof p.type&&void 0!==g?l=g:h&&(l=h.nextSibling),p.__u&=-7);return n.__e=f,l}function N(e,t,n,r,o){var i,s,u,l,a,c=n.length,d=c,v=0;for(e.__k=new Array(o),i=0;o>i;i++)null!=(s=t[i])&&"boolean"!=typeof s&&"function"!=typeof s?("string"==typeof s||"number"==typeof s||"bigint"==typeof s||s.constructor==String?s=e.__k[i]=S(null,s,null,null,null):b(s)?s=e.__k[i]=S(q,{children:s},null,null,null):void 0===s.constructor&&s.__b>0?s=e.__k[i]=S(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[i]=s,l=i+v,s.__=e,s.__b=e.__b+1,u=null,-1!=(a=s.__i=B(s,n,l,d))&&(d--,(u=n[a])&&(u.__u|=2)),null==u||null==u.__v?(-1==a&&(o>c?v--:c>o&&v++),"function"!=typeof s.type&&(s.__u|=4)):a!=l&&(a==l-1?v--:a==l+1?v++:(a>l?v--:v++,s.__u|=4))):e.__k[i]=null;if(d)for(i=0;c>i;i++)null!=(u=n[i])&&!(2&u.__u)&&(u.__e==r&&(r=$(u)),Q(u,u));return r}function E(e,t,n,r){var o,i;if("function"==typeof e.type){for(o=e.__k,i=0;o&&o.length>i;i++)o[i]&&(o[i].__=e,t=E(o[i],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=$(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function B(e,t,n,r){var o,i,s,u=e.key,l=e.type,a=t[n],c=null!=a&&!(2&a.__u);if(null===a&&null==u||c&&u==a.key&&l==a.type)return n;if(r>(c?1:0))for(o=n-1,i=n+1;o>=0||t.length>i;)if(null!=(a=t[s=0>o?i++:o--])&&!(2&a.__u)&&u==a.key&&l==a.type)return s;return-1}function D(e,t,n){"-"==t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||g.test(t)?n:n+"px"}function j(e,t,n,r,o){var i,s;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||D(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||D(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])i=t!=(t=t.replace(d,"$1")),s=t.toLowerCase(),t=s in e||"onFocusOut"==t||"onFocusIn"==t?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r?n[c]=r[c]:(n[c]=v,e.addEventListener(t,i?h:p,i)):e.removeEventListener(t,i?h:p,i);else{if("http://www.w3.org/2000/svg"==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&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=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,"popover"==t&&1==n?"":n))}}function F(e){return function(t){if(this.l){var r=this.l[t.type+e];if(null==t[a])t[a]=v++;else if(r[c]>t[a])return;return r(n.event?n.event(t):t)}}}function H(e,t,r,o,i,s,u,l,a,c){var d,v,p,h,f,y,g,k,S,T,$,P,I,C,N,E,B=t.type;if(void 0!==t.constructor)return null;128&r.__u&&(a=!!(32&r.__u),s=[l=t.__e=r.__e]),(d=n.__b)&&d(t);e:if("function"==typeof B){v=u.length;try{if(S=t.props,T=B.prototype&&B.prototype.render,$=(d=B.contextType)&&o[d.__c],P=d?$?$.props.value:d.__:o,r.__c?k=(p=t.__c=r.__c).__=p.__E:(T?t.__c=p=new B(S,P):(t.__c=p=new _(S,P),p.constructor=B,p.render=V),$&&$.sub(p),p.state||(p.state={}),p.__n=o,h=p.__d=!0,p.__h=[],p._sb=[]),T&&null==p.__s&&(p.__s=p.state),T&&null!=B.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=w({},p.__s)),w(p.__s,B.getDerivedStateFromProps(S,p.__s))),f=p.props,y=p.state,p.__v=t,h)T&&null==B.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),T&&null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(T&&null==B.getDerivedStateFromProps&&S!==f&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(S,P),t.__v==r.__v||!p.__e&&null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(S,p.__s,P)){t.__v!=r.__v&&(p.props=S,p.state=p.__s,p.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(e){e&&(e.__=t)}),m.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&u.push(p);break e}null!=p.componentWillUpdate&&p.componentWillUpdate(S,p.__s,P),T&&null!=p.componentDidUpdate&&p.__h.push(function(){p.componentDidUpdate(f,y,g)})}if(p.context=P,p.props=S,p.__P=e,p.__e=!1,I=n.__r,C=0,T)p.state=p.__s,p.__d=!1,I&&I(t),d=p.render(p.props,p.state,p.context),m.push.apply(p.__h,p._sb),p._sb=[];else do{p.__d=!1,I&&I(t),d=p.render(p.props,p.state,p.context),p.state=p.__s}while(p.__d&&25>++C);p.state=p.__s,null!=p.getChildContext&&(o=w(w({},o),p.getChildContext())),T&&!h&&null!=p.getSnapshotBeforeUpdate&&(g=p.getSnapshotBeforeUpdate(f,y)),N=null!=d&&d.type===q&&null==d.key?A(d.props.children):d,l=M(e,b(N)?N:[N],t,r,o,i,s,u,l,a,c),p.base=t.__e,t.__u&=-161,p.__h.length&&u.push(p),k&&(p.__E=p.__=null)}catch(e){if(u.length=v,t.__v=null,a||null!=s)if(e.then){for(t.__u|=a?160:128;l&&8==l.nodeType&&l.nextSibling;)l=l.nextSibling;null!=s&&(s[s.indexOf(l)]=null),t.__e=l}else{if(null!=s)for(E=s.length;E--;)x(s[E]);L(t)}else t.__e=r.__e,!t.__k&&r.__k&&(t.__k=r.__k),e.then||L(t);n.__e(e,t,r)}}else null==s&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):l=t.__e=R(r.__e,t,r,o,i,s,u,a,c);return(d=n.diffed)&&d(t),128&t.__u?void 0:l}function L(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(L))}function z(e,t,r){for(var o=0;r.length>o;o++)O(r[o],r[++o],r[++o]);n.__c&&n.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){n.__e(e,t.__v)}})}function A(e){return"object"!=typeof e||null==e||e.__b>0?e:b(e)?e.map(A):void 0!==e.constructor?null:w({},e)}function R(e,r,o,i,s,u,l,a,c){var d,v,p,h,f,m,g,w=o.props||y,k=r.props,S=r.type;if("svg"==S?s="http://www.w3.org/2000/svg":"math"==S?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),null!=u)for(d=0;u.length>d;d++)if((f=u[d])&&"setAttribute"in f==!!S&&(S?f.localName==S:3==f.nodeType)){e=f,u[d]=null;break}if(null==e){if(null==S)return document.createTextNode(k);e=document.createElementNS(s,S,k.is&&k),a&&(n.__m&&n.__m(r,u),a=!1),u=null}if(null==S)w===k||a&&e.data==k||(e.data=k);else{if(u="textarea"==S&&null!=k.defaultValue?null:u&&t.call(e.childNodes),!a&&null!=u)for(w={},d=0;e.attributes.length>d;d++)w[(f=e.attributes[d]).name]=f.value;for(d in w)f=w[d],"dangerouslySetInnerHTML"==d?p=f:"children"==d||d in k||"value"==d&&"defaultValue"in k||"checked"==d&&"defaultChecked"in k||j(e,d,null,f,s);for(d in k)f=k[d],"children"==d?h=f:"dangerouslySetInnerHTML"==d?v=f:"value"==d?m=f:"checked"==d?g=f:a&&"function"!=typeof f||w[d]===f||j(e,d,f,w[d],s);if(v)a||p&&(v.__html==p.__html||v.__html==e.innerHTML)||(e.innerHTML=v.__html),r.__k=[];else if(p&&(e.innerHTML=""),M("template"==r.type?e.content:e,b(h)?h:[h],r,o,i,"foreignObject"==S?"http://www.w3.org/1999/xhtml":s,u,l,u?u[0]:o.__k&&$(o,0),a,c),null!=u)for(d=u.length;d--;)x(u[d]);a&&"textarea"!=S||(d="value","progress"==S&&null==m?e.removeAttribute("value"):null!=m&&(m!==e[d]||"progress"==S&&!m||"option"==S&&m!=w[d])&&j(e,d,m,w[d],s),d="checked",null!=g&&g!=e[d]&&j(e,d,g,w[d],s))}return e}function O(e,t,r){try{if("function"==typeof e){var o="function"==typeof e.__u;o&&e.__u(),o&&null==t||(e.__u=e(t))}else e.current=t}catch(e){n.__e(e,r)}}function Q(e,t,r){var o,i;if(n.unmount&&n.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||O(o,null,t)),null!=(o=e.__c)){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(e){n.__e(e,t)}o.base=o.__P=o.__n=null}if(o=e.__k)for(i=0;o.length>i;i++)o[i]&&Q(o[i],t,r||"function"!=typeof e.type);r||x(e.__e),e.__c=e.__=e.__e=void 0}function V(e,t,n){return this.constructor(e,n)}function U(e,r,o){var i,s,u,l;r==document&&(r=document.documentElement),n.__&&n.__(e,r),s=(i="function"==typeof o)?null:o&&o.__k||r.__k,u=[],l=[],H(r,e=(!i&&o||r).__k=k(q,null,[e]),s||y,y,r.namespaceURI,!i&&o?[o]:s?null:r.firstChild?t.call(r.childNodes):null,u,!i&&o?o:s?s.__e:r.firstChild,i,l),z(u,e,l),e.props.children=null}t=m.slice,n={__e(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}},r=0,_.prototype.setState=function(e,t){var n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=w({},this.state);"function"==typeof e&&(e=e(w({},n),this.props)),e&&w(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),I(this))},_.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),I(this))},_.prototype.render=q,o=[],s="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,u=function(e,t){return e.__v.__b-t.__v.__b},C.__r=0,l=Math.random().toString(8),a="__d"+l,c="__a"+l,d=/(PointerCapture)$|Capture$/i,v=0,p=F(!1),h=F(!0),f=0;var Z=0;function G(e,t,r,o,i,s){t||(t={});var u,l,a=t;if("ref"in a)for(l in a={},t)"ref"==l?u=t[l]:a[l]=t[l];var c={type:e,props:a,key:r,ref:u,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Z,__i:-1,__u:0,__source:i,__self:s};if("function"==typeof e&&(u=e.defaultProps))for(l in u)void 0===a[l]&&(a[l]=u[l]);return n.vnode&&n.vnode(c),c}const W="$surveys",K="featureFlagsCommon";function Y({client:e,config:t}){var n;if(!e||!t.uiHost)return;const r=null===(n=e.session)||void 0===n?void 0:n.sessionId;return r?`${t.uiHost}/project/${e.projectToken}/replay/${r}`:void 0}var J=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({});const X="min_length",ee="max_length",te=Object.prototype,ne=te.hasOwnProperty,re=te.toString,oe=Array.isArray||function(e){return"[object Array]"===re.call(e)},ie=e=>"function"==typeof e,se=e=>void 0===e,ue=e=>"[object String]"==re.call(e),le=e=>null===e,ae=e=>se(e)||le(e),ce=e=>"[object Number]"==re.call(e)&&e==e;function de(e,t,n,r,o,i,s){try{var u=e[i](s),l=u.value}catch(e){return void n(e)}u.done?t(l):Promise.resolve(l).then(r,o)}function ve(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function s(e){de(i,r,o,s,u,"next",e)}function u(e){de(i,r,o,s,u,"throw",e)}s(void 0)})}}const pe="Mobile",he="Tablet",fe="Android Tablet",ye="iPad",me="Apple Watch",ge="Nintendo",be="PlayStation",we="Xbox",xe="Nokia",ke="Ouya",Se="Generic "+pe.toLowerCase(),qe="Generic "+he.toLowerCase(),_e=new RegExp(we,"i"),Te=new RegExp("PlayStation \\w+","i"),Pe=new RegExp("Nintendo \\w+","i"),$e=new RegExp("BlackBerry|PlayBook|BB10","i");new RegExp(ge,"i"),new RegExp(be,"i"),new RegExp("Windows","i");function Ie(e){return Ie="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ie(e)}function Ce(e,t,n){return(t=function(e){var t=function(e){if("object"!=Ie(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Ie(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ie(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Me(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ne(e){for(var t=1;arguments.length>t;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Me(Object(n),!0).forEach(function(t){Ce(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Me(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}let Ee;const Be=e=>{throw function(e,t){const n=new Error(t);try{Object.defineProperty(n,"name",{value:"NativeGzipValidationError",writable:!0,enumerable:!0,configurable:!0})}catch(e){}return n}(0,`Native gzip produced invalid output: ${e}`)},De=(je=ve(function*(e,t){18>e.size&&Be("too-short");const n=new Uint8Array(yield e.slice(0,10).arrayBuffer());var r;(2>(r=n).length||31!==r[0]||139!==r[1]||8!==n[2])&&Be("invalid-header");const o=new DataView(yield e.slice(e.size-8).arrayBuffer());o.getUint32(0,!0)!==(e=>{const t=(()=>{if(Ee)return Ee;Ee=[];for(let e=0;256>e;e++){let t=e;for(let e=0;8>e;e++)t=1&t?3988292384^t>>>1:t>>>1;Ee[e]=t>>>0}return Ee})();let n=4294967295;for(let r=0;e.length>r;r++)n=t[255&(n^e[r])]^n>>>8;return(4294967295^n)>>>0})(t)&&Be("invalid-crc");const i=t.length>>>0;o.getUint32(4,!0)!==i&&Be("invalid-size")}),function(e,t){return je.apply(this,arguments)});var je;function Fe(){return Fe=ve(function*(e,t=!0,n){try{const t=(new TextEncoder).encode(e),n=new globalThis.CompressionStream("gzip"),o=n.writable.getWriter(),i=o.write(t).then(()=>o.close()).catch((r=ve(function*(e){try{yield o.abort(e)}catch(e){}throw e}),function(e){return r.apply(this,arguments)})),s=new Response(n.readable).blob(),[u]=yield Promise.all([s,i]);return yield De(u,t),u}catch(e){if(null==n?void 0:n.rethrow)throw e;return t&&console.error("Failed to gzip compress data",e),null}var r}),Fe.apply(this,arguments)}function He(e,t){if(!e)return;const n=e.find(e=>e.type===t);return null==n?void 0:n.value}var Le=class e{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,r,o){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(o)||0>t||0>n||0>r||0>o||t>0xffffffffffff||n>4095||r>1073741823||o>4294967295)throw new RangeError("invalid field value");const i=new Uint8Array(16);return i[0]=t/Math.pow(2,40),i[1]=t/Math.pow(2,32),i[2]=t/Math.pow(2,24),i[3]=t/Math.pow(2,16),i[4]=t/256,i[5]=t,i[6]=112|n>>>8,i[7]=n,i[8]=128|r>>>24,i[9]=r>>>16,i[10]=r>>>8,i[11]=r,i[12]=o>>>24,i[13]=o>>>16,i[14]=o>>>8,i[15]=o,new e(i)}toString(){let e="";for(let t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new e(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(let t=0;16>t;t++){const n=this.bytes[t]-e.bytes[t];if(0!==n)return Math.sign(n)}return 0}},ze=class{generate(){const e=this.generateOrAbort();if(!se(e))return e;{this.Ct=0;const e=this.generateOrAbort();if(se(e))throw new Error("Could not generate UUID after timestamp reset");return e}}generateOrAbort(){const e=(()=>{const e=Date.now();return ce(e)&&isFinite(e)?Math.min(Math.max(Math.floor(e),0),0xffffffffffff):0})();if(e>this.Ct)this.Ct=e,this.It();else{if(this.Ct>=e+1e4)return;this.Mt++,this.Mt>4398046511103&&(this.Ct++,this.It())}return Le.fromFieldsV7(this.Ct,Math.trunc(this.Mt/Math.pow(2,30)),this.Mt&Math.pow(2,30)-1,this.Tt.nextUint32())}It(){this.Mt=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.Mt=0,this.Tt=new Oe}};const Ae=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};let Re;var Oe=class{nextUint32(){var e;return this.Rt.length>this.$t||((null!==(e=Re)&&void 0!==e?e:Re="u">typeof window&&!se(window.crypto)&&crypto.getRandomValues?e=>{try{return crypto.getRandomValues(e)}catch(t){return Ae(e)}}:Ae)(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}};let Qe;const Ve=()=>Ue().toString(),Ue=()=>(Qe||(Qe=new ze)).generate();var Ze,Ge,We,Ke,Ye=0,Je=[],Xe=n,et=Xe.__b,tt=Xe.__r,nt=Xe.diffed,rt=Xe.__c,ot=Xe.unmount,it=Xe.__;function st(e,t){Xe.__h&&Xe.__h(Ge,e,Ye||t),Ye=0;var n=Ge.__H||(Ge.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function ut(e){return Ye=1,function(e,t){var n=st(Ze++,2);if(n.t=e,!n.__c&&(n.__=[gt(void 0,t),function(e){var t=n.__N?n.__N[0]:n.__[0],r=n.t(t,e);t!==r&&(n.__N=[r,n.__[1]],n.__c.setState({}))}],n.__c=Ge,!Ge.__f)){var r=function(e,t,r){if(!n.__c.__H)return!0;var i=!1,s=n.__c.props!==e;if(n.__c.__H.__.some(function(e){if(e.__N){i=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}}),o){var u=o.call(this,e,t,r);return i?u||s:u}return!i||s};Ge.__f=!0;var o=Ge.shouldComponentUpdate,i=Ge.componentWillUpdate;Ge.componentWillUpdate=function(e,t,n){if(this.__e){var s=o;o=void 0,r(e,t,n),o=s}i&&i.call(this,e,t,n)},Ge.shouldComponentUpdate=r}return n.__N||n.__}(gt,e)}function lt(e,t){var n=st(Ze++,3);!Xe.__s&&mt(n.__H,t)&&(n.__=e,n.u=t,Ge.__H.__h.push(n))}function at(e){return Ye=5,ct(function(){return{current:e}},[])}function ct(e,t){var n=st(Ze++,7);return mt(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function dt(e){var t=Ge.context[e.__c],n=st(Ze++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(Ge)),t.props.value):e.__}function vt(){for(var e;e=Je.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(ft),t.__h.some(yt),t.__h=[]}catch(n){t.__h=[],Xe.__e(n,e.__v)}}}Xe.__b=function(e){Ge=null,et&&et(e)},Xe.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),it&&it(e,t)},Xe.__r=function(e){tt&&tt(e),Ze=0;var t=(Ge=e.__c).__H;t&&(We===Ge?(t.__h=[],Ge.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.length&&vt(),Ze=0)),We=Ge},Xe.diffed=function(e){nt&&nt(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==Je.push(t)&&Ke===Xe.requestAnimationFrame||((Ke=Xe.requestAnimationFrame)||ht)(vt)),t.__H.__.some(function(e){e.u&&(e.__H=e.u,e.u=void 0)})),We=Ge=null},Xe.__c=function(e,t){t.some(function(e){try{e.__h.some(ft),e.__h=e.__h.filter(function(e){return!e.__||yt(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],Xe.__e(n,e.__v)}}),rt&&rt(e,t)},Xe.unmount=function(e){ot&&ot(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{ft(e)}catch(e){t=e}}),n.__H=void 0,t&&Xe.__e(t,n.__v))};var pt="function"==typeof requestAnimationFrame;function ht(e){var t,n=function(){clearTimeout(r),pt&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);pt&&(t=requestAnimationFrame(n))}function ft(e){var t=Ge,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),Ge=t}function yt(e){var t=Ge;e.__c=e.__(),Ge=t}function mt(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function gt(e,t){return"function"==typeof t?t(e):t}const bt="tab",wt="left",xt="center",kt="right",St="next_to_trigger",qt="popover",_t="widget",Tt="external_survey",Pt="open",$t="multiple_choice",It="single_choice",Ct="rating",Mt="end",Nt="always",Et="survey shown",Bt="survey dismissed",Dt="survey sent",jt="$survey_id",Ft="$survey_name",Ht="$survey_iteration",Lt="$survey_iteration_start_date",zt="$survey_language",At="0.10.2",Rt={DEBUG:!1,LIB_VERSION:At,LIB_NAME:"browser-common",JS_SDK_VERSION:At},Ot=(e,{debugEnabled:t}={})=>{const n={N(n,...r){let o;try{o=typeof window>"u"?void 0:window}catch(e){return}o&&(Rt.DEBUG||o.POSTHOG_DEBUG||t)&&!se(o.console)&&o.console&&("__rrweb_original__"in o.console[n]?o.console[n].__rrweb_original__:o.console[n])(e,...r)},debug(...e){n.N("debug",...e)},info(...e){n.N("log",...e)},warn(...e){n.N("warn",...e)},error(...e){n.N("error",...e)},critical(...t){console.error(e,...t)},uninitializedWarning(e){n.error(`You must initialize PostHog before calling ${e}`)},createLogger:(t,n)=>Ot(`${e} ${t}`,n)};return n},Qt=Ot("[PostHog.js]"),Vt=Qt.createLogger;function Ut(e,t,n,r){const{capture:o=!1,passive:i=!0}=null!=r?r:{};null==e||e.addEventListener(t,n,{capture:o,passive:i})}function Zt(e){return`$survey_response_${e}`}function Gt(e,t){if(!t)return null;const n=e[Zt(t)];return oe(n)?[...n]:n}function Wt({event:e,survey:t,responses:n={},submissionId:r,completed:o,surveyLanguage:i,questionSnapshots:s}){return Ne(Ne(Ne(Ne({},!se(r)&&{$survey_submission_id:r}),"sent"===e?!se(o)&&{$survey_completed:o}:{$survey_partially_completed:Kt(n)}),i&&{$survey_language:i}),function(e={},t,n){const r={};return t.questions.forEach(t=>{if(se(t.originalQuestionIndex))return;const n=0===(o=t.originalQuestionIndex)?"$survey_response":`$survey_response_${o}`;var o;const i=Gt(e,t.id);se(i)||(r[n]=i)}),Ne(Ne({$survey_questions:t.questions.map(t=>{var r,o;return{id:t.id,question:null!==(r=null==n?void 0:n[null!==(o=t.id)&&void 0!==o?o:""])&&void 0!==r?r:t.question,response:Gt(e,t.id)}})},e),r)}(n,t,s))}function Kt(e={}){return Object.values(e).some(e=>!ae(e))}function Yt(e,t){let n=`$survey_${t}/${e.id}`;return e.current_iteration&&e.current_iteration>0&&(n=`$survey_${t}/${e.id}/${e.current_iteration}`),n}function Jt(e){return"string"==typeof e&&e.trim()?e.trim():null}function Xt(e){return e.toLowerCase()}function en(e,t,n){if(!e||!t)return null;const r=Xt(t),o=Object.keys(e).find(e=>Xt(e)===r);if(o)return null==n||n.debug(`Found exact translation match: ${o}`),o;if(r.includes("-")){const o=r.split("-")[0],i=Object.keys(e).find(e=>Xt(e)===o);if(i)return null==n||n.debug(`Found base language translation match: ${i} (from ${t})`),i}return null}const tn=["thankYouMessageHeader","thankYouMessageDescription","thankYouMessageCloseButtonText","introScreenHeader","introScreenDescription","introScreenButtonText","submitButtonText","backButtonText"];function nn(e,t,n){var r;const o=en(e.translations,t,n),i=Ne({},e);let s=!1;if(o){var u;const t=null===(u=e.translations)||void 0===u?void 0:u[o];if(t)if(null==n||n.info(`Applying survey-level translation for language: ${o}`),se(t.name)||(i.name=t.name,s=!0),i.appearance){const e=Ne({},i.appearance);for(const n of tn){const r=t[n];se(r)||(e[n]=r,s=!0)}i.appearance=e}else(function(e){return tn.some(t=>!se(e[t]))})(t)&&(s=!0)}const l=e.questions.map(e=>function(e,t,n){var r;const o=en(e.translations,t,n);if(!o)return{question:e,matchedKey:null,hasChanges:!1};const i=null===(r=e.translations)||void 0===r?void 0:r[o];if(!i)return{question:e,matchedKey:null,hasChanges:!1};const s=Ne({},e);let u=!1;return se(i.question)||(s.question=i.question,u=!0),se(i.description)||(s.description=i.description,u=!0),se(i.buttonText)||(s.buttonText=i.buttonText,u=!0),"link"in s&&!se(i.link)&&(s.link=i.link,u=!0),"lowerBoundLabel"in s&&!se(i.lowerBoundLabel)&&(s.lowerBoundLabel=i.lowerBoundLabel,u=!0),"upperBoundLabel"in s&&!se(i.upperBoundLabel)&&(s.upperBoundLabel=i.upperBoundLabel,u=!0),"choices"in s&&function(e){return oe(e.choices)}(i)&&(s.choices=i.choices,u=!0),{question:u?s:e,matchedKey:u?o:null,hasChanges:u}}(e,t,n)),a=l.map(e=>e.question),c=l.some(e=>e.hasChanges);let d=null;return o||(d=(null===(r=l.find(e=>e.matchedKey))||void 0===r?void 0:r.matchedKey)||null),c&&(i.questions=a,s=!0,null==n||n.info(`Applied question-level translations for language: ${t}`)),{survey:i,matchedKey:s?o||d:null}}function rn(e){var t;return!!(null===(t=e.conditions)||void 0===t||null===(t=t.events)||void 0===t||null===(t=t.values)||void 0===t?void 0:t.length)}const on=(e,t)=>{if(!(e=>{try{new RegExp(e)}catch(e){return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}},sn=e=>e.toLowerCase(),un={exact:(e,t)=>t.some(t=>e.some(e=>t===e)),is_not:(e,t)=>t.every(t=>e.every(e=>t!==e)),regex:(e,t)=>t.some(t=>e.some(e=>on(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!on(t,e))),icontains:(e,t)=>t.map(sn).some(t=>e.map(sn).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(sn).every(t=>e.map(sn).every(e=>!t.includes(e))),gt:(e,t)=>t.some(t=>{const n=parseFloat(t);return!isNaN(n)&&e.some(e=>n>parseFloat(e))}),lt:(e,t)=>t.some(t=>{const n=parseFloat(t);return!isNaN(n)&&e.some(e=>n<parseFloat(e))})},ln=e=>{const t=[...e];for(let e=t.length-1;e>0;e--){const n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}return t},an=Vt("[Surveys]"),cn=(e,t)=>`${e}${function(e){return e.current_iteration&&e.current_iteration>0?`${e.id}_${e.current_iteration}`:e.id}(t)}`,dn=e=>cn("seenSurvey_",e),vn=[qt,_t,"api"];const pn=Vt("[Stylesheet Loader]"),hn="#020617",fn={fontFamily:"inherit",backgroundColor:"#eeeded",submitButtonColor:"black",submitButtonTextColor:"white",ratingButtonColor:"white",ratingButtonActiveColor:"black",borderColor:"#c9c6c6",whiteLabel:!1,displayThankYouMessage:!0,thankYouMessageHeader:"Thank you for your feedback!",position:kt,widgetType:bt,widgetLabel:"Feedback",widgetColor:"black",zIndex:String(2147483645),disabledButtonOpacity:"0.6",maxWidth:"300px",textSubtleColor:"#939393",boxPadding:"20px 24px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",borderRadius:"10px",shuffleQuestions:!1,outlineColor:"rgba(59, 130, 246, 0.8)",inputBackground:"white",inputTextColor:hn,scrollbarThumbColor:"var(--ph-survey-border-color)",scrollbarTrackColor:"var(--ph-survey-background-color)"},yn=[xt,wt,kt];function mn(e){if(e.startsWith("#")){let t=e.replace(/^#/,"");return/^[0-9A-Fa-f]{3}$/.test(t)&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),/^[0-9A-Fa-f]{6}$/.test(t)?`rgb(${parseInt(t.slice(0,2),16)},${parseInt(t.slice(2,4),16)},${parseInt(t.slice(4,6),16)})`:"rgb(255, 255, 255)"}return"rgb(255, 255, 255)"}function gn(e=fn.backgroundColor){let t;"#"===e[0]&&(t=mn(e)),e.startsWith("rgb")&&(t=e);const n={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}[e.toLowerCase()];if(n&&(t=mn(n)),!t)return hn;const r=t.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);if(r){const e=parseInt(r[1]),t=parseInt(r[2]),n=parseInt(r[3]);return Math.sqrt(e*e*.299+t*t*.587+n*n*.114)>127.5?hn:"white"}return hn}const bn=(e,t,n)=>{const r=Ln(e),o=document.querySelector(`.${r}`);if(o&&o.shadowRoot)return{shadow:o.shadowRoot,isNewlyCreated:!1};const i=document.createElement("div");((e,t,n)=>{const r=Ne(Ne({},fn),n),o=e.style,i=!yn.includes(r.position)||t===_t&&(null==n?void 0:n.widgetType)===bt;o.setProperty("--ph-survey-font-family",function(e){if("inherit"===e)return"inherit";const t='BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';return e?`${e}, ${t}`:`-apple-system, ${t}`}(r.fontFamily)),o.setProperty("--ph-survey-box-padding",r.boxPadding),o.setProperty("--ph-survey-max-width",r.maxWidth),o.setProperty("--ph-survey-z-index",r.zIndex),o.setProperty("--ph-survey-border-color",r.borderColor),i?(o.setProperty("--ph-survey-border-radius",r.borderRadius),o.setProperty("--ph-survey-border-bottom","1.5px solid var(--ph-survey-border-color)")):(o.setProperty("--ph-survey-border-bottom","none"),o.setProperty("--ph-survey-border-radius",`${r.borderRadius} ${r.borderRadius} 0 0`)),o.setProperty("--ph-survey-background-color",r.backgroundColor),o.setProperty("--ph-survey-box-shadow",r.boxShadow),o.setProperty("--ph-survey-disabled-button-opacity",r.disabledButtonOpacity),o.setProperty("--ph-survey-submit-button-color",r.submitButtonColor),o.setProperty("--ph-survey-submit-button-text-color",(null==n?void 0:n.submitButtonTextColor)||gn(r.submitButtonColor)),o.setProperty("--ph-survey-rating-bg-color",r.ratingButtonColor),o.setProperty("--ph-survey-rating-active-bg-color",r.ratingButtonActiveColor),o.setProperty("--ph-survey-rating-active-text-color",gn(r.ratingButtonActiveColor)),o.setProperty("--ph-survey-text-primary-color",(null==n?void 0:n.textColor)||gn(r.backgroundColor)),o.setProperty("--ph-survey-text-subtle-color",r.textSubtleColor),o.setProperty("--ph-widget-color",r.widgetColor),o.setProperty("--ph-widget-text-color",gn(r.widgetColor)),o.setProperty("--ph-widget-z-index",r.zIndex);const s=(null==n?void 0:n.inputBackground)||(null==n?void 0:n.inputBackgroundColor);let u=s||r.inputBackground;s||"white"!==r.backgroundColor||(u="#f8f8f8"),o.setProperty("--ph-survey-input-background",u);const l=(null==n?void 0:n.inputTextColor)||gn(u);o.setProperty("--ph-survey-input-text-color",l),o.setProperty("--ph-survey-rating-text-color",l),o.setProperty("--ph-survey-scrollbar-thumb-color",r.scrollbarThumbColor),o.setProperty("--ph-survey-scrollbar-track-color",r.scrollbarTrackColor),o.setProperty("--ph-survey-outline-color",r.outlineColor)})(i,e.type,e.appearance),i.className=r;const s=i.attachShadow({mode:"open"}),u=function(e){const t=((e,t,n)=>{let r=e.createElement("style");r.innerText=t;const o=(e=>{var t;return ie(e)?e:null==e||null===(t=e.config)||void 0===t?void 0:t.prepare_external_dependency_stylesheet})(n);return o&&(r=o(r)),r||(pn.error("prepare_external_dependency_stylesheet returned null"),null)})(document,':host{--ph-survey-font-family:-apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";--ph-survey-box-padding:20px 24px;--ph-survey-max-width:300px;--ph-survey-z-index:calc(2147480000 + 3645);--ph-survey-border-color:#dcdcdc;--ph-survey-border-bottom:1.5px solid var(--ph-survey-border-color);--ph-survey-border-radius:10px;--ph-survey-background-color:#eeeded;--ph-survey-box-shadow:0 4px 12px #00000026;--ph-survey-submit-button-color:black;--ph-survey-submit-button-text-color:white;--ph-survey-rating-bg-color:white;--ph-survey-rating-text-color:#020617;--ph-survey-rating-active-bg-color:black;--ph-survey-rating-active-text-color:white;--ph-survey-text-primary-color:#020617;--ph-survey-text-subtle-color:#939393;--ph-widget-color:#e0a045;--ph-widget-text-color:white;--ph-survey-scrollbar-thumb-color:var(--ph-survey-border-color);--ph-survey-scrollbar-track-color:var(--ph-survey-background-color);--ph-survey-outline-color:#3b82f6cc;--ph-survey-input-background:white;--ph-survey-input-text-color:#020617;--ph-survey-disabled-button-opacity:.6}.ph-survey{min-width:300px;width:var(--ph-survey-max-width);max-width:85%;z-index:var(--ph-survey-z-index);height:fit-content;margin:0;position:fixed;bottom:0}.ph-survey h3,.ph-survey p{margin:0}.ph-survey *{box-sizing:border-box;font-family:var(--ph-survey-font-family);color:var(--ph-survey-text-primary-color)}.ph-survey textarea,.ph-survey input[type=text],.ph-survey .multiple-choice-options label{color:var(--ph-survey-input-text-color);background:var(--ph-survey-input-background);border:1.5px solid var(--ph-survey-border-color);border-radius:4px;padding:10px;transition:border-color .2s ease-out,box-shadow .2s ease-out,transform .15s ease-out}.ph-survey textarea,.ph-survey input[type=text]{transition:border-color .2s ease-out,box-shadow .2s ease-out,transform .15s ease-out}.ph-survey input{margin:0}.ph-survey textarea:focus,.ph-survey textarea:focus-visible,.ph-survey input[type=text]:focus,.ph-survey input[type=text]:focus-visible,.ph-survey .form-submit:focus,.ph-survey .form-submit:focus-visible,.ph-survey input[type=checkbox]:focus,.ph-survey input[type=radio]:focus,.ph-survey input[type=checkbox]:focus-visible,.ph-survey input[type=radio]:focus-visible{outline:1.5px solid var(--ph-survey-outline-color);border-color:var(--ph-survey-rating-active-bg-color);outline-offset:2px}.ph-survey textarea:focus:not(:focus-visible),.ph-survey input[type=text]:focus:not(:focus-visible),.ph-survey button:focus:not(:focus-visible),.ph-survey input[type=checkbox]:focus:not(:focus-visible),.ph-survey input[type=radio]:focus:not(:focus-visible){outline:none}.ph-survey textarea:hover:not(:focus),.ph-survey input[type=text]:hover:not(:focus){border-color:var(--ph-survey-rating-active-bg-color)}@media (max-width:768px){.ph-survey textarea,.ph-survey input[type=text]{font-size:1rem}}.ph-survey .multiple-choice-options label,.ph-survey .rating-options-number,.ph-survey .form-cancel,.ph-survey input[type=checkbox],.ph-survey input[type=radio]{border:1.5px solid var(--ph-survey-border-color)}.ph-survey label,.ph-survey input[type=checkbox],.ph-survey input[type=radio],.ph-survey .ratings-emoji,.ph-survey .ratings-number,.ph-survey .footer-branding,.ph-survey .form-cancel,.ph-survey .form-submit{transition:all .2s ease-out}@media (prefers-reduced-motion:no-preference){.ph-survey button:active,.ph-survey input[type=checkbox]:active,.ph-survey input[type=radio]:active,.ph-survey label:active{transition-duration:.1s}}.ph-survey-widget-tab{background:var(--ph-widget-color);color:var(--ph-widget-text-color);text-align:center;cursor:pointer;z-index:var(--ph-survey-z-index);border:none;border-radius:3px 3px 0 0;padding:10px 12px;transition:padding .2s ease-out;position:fixed}.ph-survey-widget-tab:hover:not(.widget-tab-top){padding-bottom:16px}.ph-survey-widget-tab.widget-tab-top{border-radius:0 0 3px 3px}.ph-survey-widget-tab.widget-tab-top:hover{padding-top:16px}@keyframes ph-survey-fade-in{0%{opacity:0}to{opacity:1}}.survey-box{flex-direction:column;gap:16px;display:flex}.bottom-section{flex-direction:column;gap:8px;display:flex}.thank-you-message-header~.bottom-section,.intro-screen-header~.bottom-section{padding-top:16px}.question-container,.thank-you-message,.intro-screen{flex-direction:column;gap:8px;display:flex}.survey-question{font-size:14px;font-weight:500}.survey-question-description{opacity:.8;padding-top:4px;font-size:13px}.survey-question-description,.thank-you-message-body,.intro-screen-body{word-wrap:break-word;overflow-wrap:break-word}:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) img,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) video,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) iframe,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) embed,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) object,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) svg{max-width:100%;height:auto}.question-textarea-wrapper{flex-direction:column;display:flex}.survey-form{animation:.3s ease-out forwards ph-survey-fade-in}.survey-form,.thank-you-message,.intro-screen{text-align:left;width:100%;z-index:var(--ph-survey-z-index);border:1.5px solid var(--ph-survey-border-color);border-bottom:var(--ph-survey-border-bottom);background:var(--ph-survey-background-color);border-radius:var(--ph-survey-border-radius);box-shadow:var(--ph-survey-box-shadow);padding:var(--ph-survey-box-padding);margin:0;position:relative}.survey-form textarea,.survey-form input[type=text]{min-width:100%}.survey-form textarea:focus,.survey-form textarea:focus-visible{box-shadow:0 4px 12px #00000014}.survey-form textarea:focus:not(:focus-visible){box-shadow:none}.survey-box .question-header--empty~.multiple-choice-options,.survey-box .question-header--empty~textarea{margin-top:0}.multiple-choice-options{border:none;flex-direction:column;gap:8px;margin:0;padding:1px 0;font-size:14px;display:flex}.multiple-choice-options label,.multiple-choice-options .response-choice{color:inherit;align-items:center;gap:8px;display:flex}.multiple-choice-options label{cursor:pointer;font-size:13px}.multiple-choice-options label:hover:not(:has(input:checked)){border-color:var(--ph-survey-text-subtle-color);box-shadow:0 2px 8px #00000014}.multiple-choice-options label:has(input:checked){border-color:var(--ph-survey-rating-active-bg-color);box-shadow:0 1px 4px #0000000d}.multiple-choice-options label.choice-option-open{flex-wrap:wrap}.multiple-choice-options label span{color:inherit}.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:var(--ph-survey-input-background);cursor:pointer;z-index:1;border-radius:3px;flex-shrink:0;width:1rem;height:1rem;transition:all .2s cubic-bezier(.4,0,.2,1),transform .15s ease-out;position:relative}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):focus{transform:scale(1.05)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):hover{border-color:var(--ph-survey-rating-active-bg-color);transform:scale(1.05)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):active{transform:scale(.95)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):checked{background:var(--ph-survey-rating-active-bg-color);border-color:var(--ph-survey-rating-active-bg-color);transform:scale(1)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):checked:hover{transform:scale(1.05)}.multiple-choice-options input[type=checkbox]:checked:after{border:solid var(--ph-survey-rating-active-text-color);border-width:0 2px 2px 0;width:4px;height:8px;animation:.2s ease-out .1s forwards ph-survey-checkmark-reveal;left:4px;transform:rotate(45deg)scale(0)}.multiple-choice-options input[type=radio]:checked:after{background:var(--ph-survey-rating-active-text-color);border-radius:50%;width:6px;height:6px;animation:.15s ease-out 50ms forwards ph-survey-radio-reveal;top:5px;left:5px;transform:scale(0)}.multiple-choice-options input[type=checkbox]:checked:after,.multiple-choice-options input[type=radio]:checked:after{content:"";box-sizing:content-box;position:absolute}.multiple-choice-options input[type=radio]{border-radius:50%}.multiple-choice-options input[type=radio]:checked{border:none}:is(.multiple-choice-options input[type=checkbox]:checked,.multiple-choice-options input[type=radio]:checked)~*{font-weight:700}.multiple-choice-options .choice-option-open input[type=text]::placeholder{color:var(--ph-survey-text-subtle-color);font-weight:400}.rating-options-emoji{justify-content:space-between;display:flex}.rating-options-emoji-2{justify-content:space-around}.ratings-emoji{opacity:.5;background-color:#0000;border:none;padding:0;font-size:16px}.ratings-emoji:hover{cursor:pointer;opacity:1;transform:scale(1.15)}.ratings-emoji.rating-active{opacity:1}.ratings-emoji svg{fill:var(--ph-survey-text-primary-color);transition:fill .2s ease-out}.rating-options-number{border-radius:6px;grid-auto-columns:1fr;grid-auto-flow:column;display:grid;overflow:hidden}.rating-options-number .ratings-number{border-right:1px solid var(--ph-survey-border-color);text-align:center;cursor:pointer;color:var(--ph-survey-rating-text-color);border-top:none;border-bottom:none;border-left:none;font-weight:700}.rating-options-number .ratings-number:last-of-type{border-right:0}.rating-options-number .ratings-number.rating-active{background:var(--ph-survey-rating-active-bg-color);color:var(--ph-survey-rating-active-text-color)}.ratings-number{background-color:var(--ph-survey-rating-bg-color);border:none;padding:8px 0}.ratings-number .rating-active{background-color:var(--ph-survey-rating-active-bg-color)}.ratings-number{cursor:pointer}@media (hover:hover) and (pointer:fine){.ratings-number:hover:not(.rating-active){background-color:color-mix(in srgb, var(--ph-survey-rating-active-bg-color) 14%, var(--ph-survey-rating-bg-color))}}.rating-text{opacity:.7;flex-direction:row;justify-content:space-between;font-size:11px;display:flex}.form-buttons{flex-direction:row;gap:8px;width:100%;display:flex}.form-buttons-with-back>.form-submit{flex:auto;min-width:0}.form-submit{text-align:center;cursor:pointer;user-select:none;background:var(--ph-survey-submit-button-color);color:var(--ph-survey-submit-button-text-color);border:none;border-radius:6px;min-width:100%;padding:12px;font-weight:700;box-shadow:0 2px #0000000b}.form-submit:not([disabled]):hover{transform:scale(1.02);box-shadow:0 4px 8px #0000001a}.form-submit:not([disabled]):active{transform:scale(.98);box-shadow:0 1px 2px #0000000d}.form-submit[disabled]{opacity:var(--ph-survey-disabled-button-opacity);cursor:not-allowed}.form-back{text-align:center;cursor:pointer;user-select:none;color:var(--ph-survey-text-primary-color);border:1.5px solid var(--ph-survey-border-color);background:0 0;border-radius:6px;flex:none;padding:12px 16px;font-weight:600}.form-back:hover{transform:scale(1.02)}.form-back:active{transform:scale(.98)}.validation-hint{opacity:.7;margin-top:4px;font-size:12px}.form-cancel{cursor:pointer;background:#fff;border-radius:100%;padding:12px;line-height:0;position:absolute;top:0;right:0;transform:translate(50%,-50%)}.form-cancel:hover{opacity:.7;transform:translate(50%,-50%)scale(1.1)}.footer-branding{opacity:.6;justify-content:center;align-items:center;gap:4px;font-size:11px;font-weight:500;text-decoration:none;display:flex}.footer-branding:hover{opacity:1}.footer-branding a{text-decoration:none}.thank-you-message{text-align:center}.thank-you-message-header{margin:10px 0 0}.thank-you-message-body{opacity:.8;font-size:14px}.intro-screen{text-align:center;animation:.3s ease-out forwards ph-survey-fade-in}.intro-screen-header{margin:10px 0 0}.intro-screen-body{opacity:.8;font-size:14px}.limit-height{scrollbar-width:thin;scrollbar-color:var(--ph-survey-scrollbar-thumb-color) var(--ph-survey-scrollbar-track-color);max-height:256px;overflow:hidden auto}.limit-height::-webkit-scrollbar{width:8px}.limit-height::-webkit-scrollbar-track{background:var(--ph-survey-scrollbar-track-color);border-radius:4px}.limit-height::-webkit-scrollbar-thumb{background-color:var(--ph-survey-scrollbar-thumb-color);border:2px solid var(--ph-survey-scrollbar-track-color);border-radius:4px}.limit-height::-webkit-scrollbar-thumb:hover{background-color:var(--ph-survey-text-subtle-color)}.sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}@media (prefers-reduced-motion:reduce){.ph-survey *{scroll-behavior:auto!important;transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}@keyframes ph-survey-checkmark-reveal{0%{opacity:0;transform:rotate(45deg)scale(0)}50%{opacity:1;transform:rotate(45deg)scale(1.2)}to{opacity:1;transform:rotate(45deg)scale(1)}}@keyframes ph-survey-radio-reveal{0%{opacity:0;transform:scale(0)}50%{opacity:1;transform:scale(1.3)}to{opacity:1;transform:scale(1)}}',null==e?void 0:e.config.prepareStylesheet);return null==t||t.setAttribute("data-ph-survey-style","true"),t}(t);if(u){const e=s.querySelector("style");e&&s.removeChild(e),s.appendChild(u)}return(n||document.body).appendChild(i),{shadow:s,isNewlyCreated:!0}},wn=e=>{try{const t=dn(e);localStorage.getItem(t)||localStorage.setItem(t,"true")}catch(e){an.error("Failed to persist survey seen state",e)}},xn=({responses:e,survey:t,surveySubmissionId:n,posthog:r,isSurveyCompleted:o,properties:i,surveyLanguage:s,questionSnapshots:u})=>{var l,a,c;r?(null===(l=r.client)||void 0===l?void 0:l.canCapture)&&(wn(t),o&&Hn(t),null===(a=r.client)||void 0===a||a.capture(Dt,Ne(Ne(Ne({[Ft]:t.name,[jt]:t.id,[Ht]:t.current_iteration,[Lt]:t.current_iteration_start_date,sessionRecordingUrl:Y(r)},Wt(Ne(Ne({event:"sent",survey:t,responses:e,submissionId:n,completed:o},!se(s)&&{surveyLanguage:s}),!se(u)&&{questionSnapshots:u}))),i),{},{$set:{[Yt(t,"responded")]:!0}})),o&&(window.dispatchEvent(new CustomEvent("PHSurveySent",{detail:{surveyId:t.id}})),null===(c=r.client)||void 0===c||null===(c=c.getExtension("featureFlagsCommon"))||void 0===c||c.reloadFeatureFlags())):an.error("[survey sent] event not captured, PostHog instance not found.")},kn=(e,t,n,r)=>Ne({[Ft]:t.name,[jt]:t.id,[Ht]:t.current_iteration,[Lt]:t.current_iteration_start_date,sessionRecordingUrl:Y(r)},Wt(Ne(Ne(Ne(Ne({event:e,survey:t},!se(null==n?void 0:n.responses)&&{responses:n.responses}),!se(null==n?void 0:n.surveySubmissionId)&&{submissionId:n.surveySubmissionId}),!se(null==n?void 0:n.surveyLanguage)&&{surveyLanguage:n.surveyLanguage}),!se(null==n?void 0:n.questionSnapshots)&&{questionSnapshots:n.questionSnapshots}))),Sn=(e,t,n,r)=>{var o;if(!t)return void an.error("[survey dismissed] event not captured, PostHog instance not found.");if(n)return;const i=jn(e),s=i?i.surveyLanguage:r,u=Ne(Ne(Ne({},kn("dismissed",e,i,t)),s&&{[zt]:s}),{},{$set:{[Yt(e,"dismissed")]:!0}});Hn(e),wn(e),null===(o=t.client)||void 0===o||o.capture(Bt,u),window.dispatchEvent(new CustomEvent("PHSurveyClosed",{detail:{surveyId:e.id}}))},qn=(e,t)=>{var n,r;if(!t)return void an.error("[survey abandoned] event not captured, PostHog instance not found.");if(!(null===(n=t.client)||void 0===n?void 0:n.canCapture))return;const o=(e=>cn("abandonedSurvey_",e))(e);try{if("true"===localStorage.getItem(o))return}catch(e){return}const i=jn(e);if(i){try{localStorage.setItem(o,"true")}catch(e){}null===(r=t.client)||void 0===r||r.capture("survey abandoned",kn("abandoned",e,i,t),{delivery:"unload"})}},_n=e=>{const t=e.map(e=>e.id);return t.every(e=>!!e)?t:void 0},Tn=(e,t)=>{var n,r,o;return(e=>e.questions.some(e=>{var t;return!!(null===(t=e.branching)||void 0===t?void 0:t.type)}))(e)?e.questions:t?null!==(n=((e,t)=>{if(!t||t.length!==e.questions.length)return null;const n=new Map(e.questions.map(e=>[e.id,e])),r=[];for(const e of t){const t=n.get(e);if(!t)return null;r.push(t)}return r})(e,t.questionOrder))&&void 0!==n?n:e.questions:e.appearance&&e.appearance.shuffleQuestions&&!e.enable_partial_responses?(r=e.questions,o=ln(e.questions),r.length===o.length&&r.every((e,t)=>e===o[t])?o.reverse():o):e.questions},Pn=e=>function(e){var t;return rn(e)&&!!(null===(t=e.conditions)||void 0===t||null===(t=t.events)||void 0===t?void 0:t.repeatedActivation)||"always"===e.schedule}(e)||Fn(e),$n=function(e){function t(e){var n,r;return this.getChildContext||(n=new Set,(r={})[t.__c]=this,this.getChildContext=function(){return r},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&n.forEach(function(e){e.__e=!0,I(e)})},this.sub=function(e){n.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),t&&t.call(e)}}),e.children}return t.__c="__cC"+f++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t}({isPreviewMode:!1,previewPageIndex:0,onPopupSurveyDismissed(){},isPopup:!0,onPreviewSubmit(){},onPreviewBack(){},surveySubmissionId:"",properties:void 0,surveyLanguage:null}),In=()=>dt($n),Cn=({component:e,children:n,renderAsHtml:r,style:o})=>function(e,n,r){var o,i,s,u,l=w({},e.props);for(s in e.type&&e.type.defaultProps&&(u=e.type.defaultProps),n)"key"==s?o=n[s]:"ref"==s?i=n[s]:l[s]=void 0===n[s]&&null!=u?u[s]:n[s];return arguments.length>2&&(l.children=arguments.length>3?t.call(arguments,2):r),S(e.type,l,o||e.key,i||e.ref,null)}(e,r?{dangerouslySetInnerHTML:{__html:n},style:o}:{children:n,style:o});function Mn(e,t){var n,r,o;if(!(null===(n=e.conditions)||void 0===n?void 0:n.url))return!0;const i=null!==(r=function(e){var t;const n=typeof window>"u"?void 0:window,r=null==n||null===(t=n.location)||void 0===t?void 0:t.href;return se(r)?void 0:function(e,t){var n;const r=null==e||null===(n=e.config)||void 0===n?void 0:n.get_current_url;if(!ie(r))return t;try{const e=r(t);return ue(e)&&e?e:t}catch(e){return Qt.error("Error in get_current_url, falling back to window.location.href",e),t}}(e,r)}(t))&&void 0!==r?r:"u">typeof window?window.location.href:void 0;if(!i)return!1;const s=[e.conditions.url],u=function(e){return null!=e?e:"icontains"}(null===(o=e.conditions)||void 0===o?void 0:o.urlMatchType);return un[u](s,[i])}function Nn(e){var t,n;return function(e,t){var n,r,o;if(!e||0===e.length)return!0;const i="u">typeof window?window:void 0,s="u">typeof globalThis?globalThis:i,u=null==s?void 0:s.navigator,l=null==u?void 0:u.userAgent;if(!l)return!1;const a=function(e,t){var n;const r=function(e){return Pe.test(e)?ge:Te.test(e)?be:_e.test(e)?we:new RegExp(ke,"i").test(e)?ke:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?"Windows Phone":/iPad/.test(e)?ye:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?me:$e.test(e)?"BlackBerry":/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(xe,"i").test(e)?xe:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(pe).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?"Android":fe:new RegExp("(pda|Mobile)","i").test(e)?Se:new RegExp(he,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?qe:""}(e);return r===ye||r===fe||"Kobo"===r||"Kindle Fire"===r||r===qe?he:r===ge||r===we||r===be||r===ke?"Console":r===me?"Wearable":r?pe:"Android"===(null==t?void 0:t.userAgentDataPlatform)&&(null!==(n=null==t?void 0:t.maxTouchPoints)&&void 0!==n?n:0)>0?600>Math.min(null!==(o=null==t?void 0:t.screenWidth)&&void 0!==o?o:0,null!==(i=null==t?void 0:t.screenHeight)&&void 0!==i?i:0)/(null!==(s=null==t?void 0:t.devicePixelRatio)&&void 0!==s?s:1)?pe:he:"Desktop";var o,i,s}(l,{userAgentDataPlatform:null==u||null===(n=u.userAgentData)||void 0===n?void 0:n.platform,maxTouchPoints:null==u?void 0:u.maxTouchPoints,screenWidth:null==i||null===(r=i.screen)||void 0===r?void 0:r.width,screenHeight:null==i||null===(o=i.screen)||void 0===o?void 0:o.height,devicePixelRatio:null==i?void 0:i.devicePixelRatio});return un[null!=t?t:"icontains"](e,[a])}(null===(t=e.conditions)||void 0===t?void 0:t.deviceTypes,null===(n=e.conditions)||void 0===n?void 0:n.deviceTypesMatchType)}const En=e=>cn("inProgressSurvey_",e),Bn={},Dn=(e,t)=>{const n=En(e);try{localStorage.setItem(n,JSON.stringify(t)),delete Bn[n]}catch(e){an.error("Error setting in-progress survey state in localStorage",e),Bn[n]=t}},jn=e=>{const t=En(e),n=Bn[t];if(n)return n;try{const e=localStorage.getItem(t);if(e)return JSON.parse(e)}catch(e){an.error("Error getting in-progress survey state from localStorage",e)}return null},Fn=e=>{const t=jn(e);return!ae(null==t?void 0:t.surveySubmissionId)},Hn=e=>{const t=En(e);delete Bn[t];try{localStorage.removeItem(t)}catch(e){an.error("Error clearing in-progress survey state from localStorage",e)}};function Ln(e,t=!1){const n=`PostHogSurvey-${e.id}`;return t?`.${n}`:n}function zn(e,t=kt,n){if(e===Tt)return{};switch(t){case"top_left":return{top:"0",left:"0",transform:"translate(30px, 30px)"};case"top_right":return{top:"0",right:"0",transform:"translate(-30px, 30px)"};case"top_center":return{top:"0",left:"50%",transform:"translate(-50%, 30px)"};case"middle_left":return{top:"50%",left:"0",transform:"translate(30px, -50%)"};case"middle_right":return{top:"50%",right:"0",transform:"translate(-30px, -50%)"};case"middle_center":return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};case wt:return{left:"30px"};case xt:return{left:"50%",transform:"translateX(-50%)"};default:return{right:e===_t&&n===bt?"60px":"30px"}}}const An=G("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:G("path",{d:"M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm146 272q66 0 121.5-35.5T682-393h-52q-23 40-63 61.5T480.5-310q-46.5 0-87-21T331-393h-53q26 61 81 96.5T480-261Zm0 181q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),Rn=G("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:G("path",{d:"M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm20 194h253v-49H354v49ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),On=G("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:G("path",{d:"M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm146.174 116Q413-417 358.5-379.5T278-280h53q22-42 62.173-65t87.5-23Q528-368 567.5-344.5T630-280h52q-25-63-79.826-100-54.826-37-122-37ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),Qn=G("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:G("path",{d:"M480-417q-67 0-121.5 37.5T278-280h404q-25-63-80-100t-122-37Zm-183-72 50-45 45 45 31-36-45-45 45-45-31-36-45 45-50-45-31 36 45 45-45 45 31 36Zm272 0 44-45 51 45 31-36-45-45 45-45-31-36-51 45-44-45-31 36 44 45-44 45 31 36ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142 0 241-99t99-241q0-142-99-241t-241-99q-142 0-241 99t-99 241q0 142 99 241t241 99Z"})}),Vn=G("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:G("path",{d:"M479.504-261Q537-261 585.5-287q48.5-26 78.5-72.4 6-11.6-.75-22.6-6.75-11-20.25-11H316.918Q303-393 296.5-382t-.5 22.6q30 46.4 78.5 72.4 48.5 26 105.004 26ZM347-578l27 27q7.636 8 17.818 8Q402-543 410-551q8-8 8-18t-8-18l-42-42q-8.8-9-20.9-9-12.1 0-21.1 9l-42 42q-8 7.636-8 17.818Q276-559 284-551q8 8 18 8t18-8l27-27Zm267 0 27 27q7.714 8 18 8t18-8q8-7.636 8-17.818Q685-579 677-587l-42-42q-8.8-9-20.9-9-12.1 0-21.1 9l-42 42q-8 7.714-8 18t8 18q7.636 8 17.818 8Q579-543 587-551l27-27ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),Un=G("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:G("path",{d:"M2 20h2c.55 0 1-.45 1-1v-9c0-.55-.45-1-1-1H2v11zm19.83-7.12c.11-.25.17-.52.17-.8V11c0-1.1-.9-2-2-2h-5.5l.92-4.65c.05-.22.02-.46-.08-.66-.23-.45-.52-.86-.88-1.22L14 2 7.59 8.41C7.21 8.79 7 9.3 7 9.83v7.84C7 18.95 8.05 20 9.34 20h8.11c.7 0 1.36-.37 1.72-.97l2.66-6.15z"})}),Zn=G("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:G("path",{d:"M22 4h-2c-.55 0-1 .45-1 1v9c0 .55.45 1 1 1h2V4zM2.17 11.12c-.11.25-.17.52-.17.8V13c0 1.1.9 2 2 2h5.5l-.92 4.65c-.05.22-.02.46.08.66.23.45.52.86.88 1.22L10 22l6.41-6.41c.38-.38.59-.89.59-1.42V6.34C17 5.05 15.95 4 14.66 4H6.55c-.7 0-1.36.37-1.72.97l-2.66 6.15z"})}),Gn=({fill:e="currentColor"}={})=>G("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:e,xmlns:"http://www.w3.org/2000/svg","aria-labelledby":"close-survey-title-adam",children:[G("title",{id:"close-survey-title",className:"adam-testing",children:"Close survey"}),G("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0.164752 0.164752C0.384422 -0.0549175 0.740578 -0.0549175 0.960248 0.164752L6 5.20451L11.0398 0.164752C11.2594 -0.0549175 11.6156 -0.0549175 11.8352 0.164752C12.0549 0.384422 12.0549 0.740578 11.8352 0.960248L6.79549 6L11.8352 11.0398C12.0549 11.2594 12.0549 11.6156 11.8352 11.8352C11.6156 12.0549 11.2594 12.0549 11.0398 11.8352L6 6.79549L0.960248 11.8352C0.740578 12.0549 0.384422 12.0549 0.164752 11.8352C-0.0549175 11.6156 -0.0549175 11.2594 0.164752 11.0398L5.20451 6L0.164752 0.960248C-0.0549175 0.740578 -0.0549175 0.384422 0.164752 0.164752Z",fill:e})]}),Wn=G("svg",{width:"80",height:"14",viewBox:"0 0 160 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[G("g",{"clip-path":"url(#ph-survey-logo-clip)",children:[G("path",{fill:"currentColor",d:"m50 23.34-.35-.05A4.5 4.5 0 0 1 47 21.97L35.56 10.1c-.3-.33-.86-.1-.86.35V27.5c0 .27.22.5.5.5h13.78c1.48 0 2.67-1.2 2.67-2.67v-.1a1.9 1.9 0 0 0-1.67-1.89zm-10.81.2a1.8 1.8 0 1 1 0-3.58 1.8 1.8 0 0 1 0 3.58"}),G("path",{fill:"#0054ff",d:"M.87 19.13a.5.5 0 0 0-.87.34v5.94a2.6 2.6 0 0 0 2.59 2.58H7.8a.5.5 0 0 0 .37-.84zM.86 8.4c-.3-.32-.86-.1-.86.36v6.73q0 .2.13.34l8.81 9.68 1.8 2.06v-8.82zM4.59.82A2.67 2.67 0 0 0 0 2.68v1.93q0 .4.27.69l10.47 10.95v-9.1z"}),G("path",{fill:"#ff5506",d:"M11.36 28h7.08a.5.5 0 0 0 .36-.85l-8.05-8.4v8.8l.23.28q.16.17.38.17m-.61-11.76 8.84 9.25 2.1 2.33q.1.11.27.14V18.7L10.75 7.15zm0-13.7v1.41a2 2 0 0 0 .55 1.28L21.96 16.2V7.65L15.32.8a2.67 2.67 0 0 0-4.57 1.71z"}),G("path",{fill:"#ffb70f",d:"M22.06 28h7.76a.5.5 0 0 0 .36-.86l-8.22-8.45v9.27l.09.02zM31 25.49l1.13 1.14c.32.31.85.09.85-.35v-7.3l-.49-.51L21.96 7.64v8.55zM22.52 5.73l9.62 9.89c.3.32.86.1.86-.35V7.46L26.56.82a2.67 2.67 0 0 0-4.59 1.84v1.7c0 .51.2 1 .57 1.37z"})]}),G("path",{fill:"currentColor",d:"M64.9 22.88c-.67 0-1.23-.56-1.23-1.24V5.24c0-.69.56-1.24 1.24-1.24h6.55c3.89 0 6.39 2.32 6.39 5.9 0 3.6-2.5 5.91-6.4 5.91h-3.53v5.83c0 .68-.56 1.24-1.24 1.24zm3.02-11.94c0 .68.55 1.23 1.23 1.23h1.88c1.6 0 2.58-.86 2.58-2.26s-.97-2.27-2.58-2.27h-1.88c-.68 0-1.23.55-1.23 1.23zM84.71 23.1c-4.18 0-7.14-2.97-7.14-7.02s2.96-7.01 7.14-7.01c4.14 0 7.14 2.97 7.14 7.01 0 4.05-3 7.01-7.14 7.01m-3.22-7.02c0 2.16 1.3 3.64 3.22 3.64 1.9 0 3.2-1.48 3.2-3.64s-1.3-3.64-3.2-3.64c-1.93 0-3.22 1.48-3.22 3.64m16.34 7.03a6.2 6.2 0 0 1-5.54-3.01c-.34-.57-.01-1.26.6-1.5l.77-.3c.7-.27 1.45.15 1.92.73a2.8 2.8 0 0 0 2.25 1.08c1.05 0 1.75-.51 1.75-1.27 0-2.13-7.17-.7-7.17-5.85 0-2.13 1.85-3.91 4.83-3.91 2.27 0 4.2.9 5.17 2.31.36.53.05 1.2-.54 1.44l-.85.35c-.68.29-1.45-.14-2-.63a2.5 2.5 0 0 0-1.64-.64c-.89 0-1.5.38-1.5.97 0 2.16 7.27.38 7.27 5.88 0 2.35-2.15 4.34-5.32 4.34m14.64-1.31c.04.57-.3 1.1-.86 1.2q-.6.1-1.27.11c-2.92 0-5.15-1.56-5.15-4.85v-5.66h-.91c-.69 0-1.24-.56-1.24-1.24v-.82c0-.68.55-1.23 1.24-1.23h.91v-2.7c0-.69.55-1.24 1.23-1.24h1.48c.68 0 1.24.55 1.24 1.23v2.7h2.04c.68 0 1.23.56 1.23 1.24v.82c0 .68-.55 1.24-1.23 1.24h-2.04v5.15c0 1.2.64 1.91 1.6 1.91.75 0 1.6.5 1.66 1.25zM125.5 5.23c0-.68.55-1.23 1.23-1.23h1.8c.68 0 1.23.55 1.23 1.23v16.41c0 .68-.55 1.24-1.23 1.24h-1.8c-.68 0-1.23-.56-1.23-1.24v-5.43c0-.68-.56-1.23-1.24-1.23h-5c-.67 0-1.23.55-1.23 1.23v5.43c0 .68-.55 1.24-1.23 1.24h-1.77c-.69 0-1.24-.56-1.24-1.24V5.24c0-.69.55-1.24 1.24-1.24h1.77c.68 0 1.23.55 1.23 1.23v4.87c0 .68.56 1.23 1.24 1.23h5c.67 0 1.23-.55 1.23-1.23zm12.87 17.87c-4.19 0-7.14-2.97-7.14-7.02s2.95-7.01 7.14-7.01c4.13 0 7.14 2.97 7.14 7.01 0 4.05-3 7.01-7.14 7.01m-3.22-7.02c0 2.16 1.29 3.64 3.22 3.64 1.9 0 3.2-1.48 3.2-3.64s-1.3-3.64-3.2-3.64c-1.93 0-3.22 1.48-3.22 3.64m17.17 6.37c-3.84 0-6.2-2.58-6.2-6.68s2.36-6.69 6.12-6.69c1.58 0 2.82.54 3.54 1.37 0-.64.52-1.15 1.16-1.15h1.5c.68 0 1.24.55 1.24 1.23V21.9c0 3.64-2.77 6.09-6.93 6.09-2.64 0-4.9-1.2-5.85-3.09-.31-.62.16-1.29.85-1.4l1.14-.17c.67-.11 1.29.4 1.78.85.5.46 1.26.7 2.08.7 1.85 0 3.06-1.04 3.06-2.55v-1.3c-.7.9-2.01 1.4-3.49 1.4m-2.36-6.68c0 2.02 1.18 3.31 3 3.31 1.86 0 3.04-1.29 3.04-3.31s-1.18-3.32-3.03-3.32c-1.83 0-3.01 1.3-3.01 3.32"}),G("defs",{children:G("clipPath",{id:"ph-survey-logo-clip",children:G("path",{fill:"#fff",d:"M0 0h51.67v28H0z"})})})]});function Kn({urlParams:e}){const t=e?Object.entries(e).map(([e,t])=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`).join("&"):"";return G("a",{href:"https://posthog.com/surveys"+(t?`?${t}`:""),target:"_blank",rel:"noopener",className:"footer-branding",children:["Survey by ",Wn]})}function Yn({text:e,submitDisabled:t,appearance:n,onSubmit:r,link:o,onPreviewSubmit:i,skipSubmitButton:s,canGoBack:u,onBack:l}){const{isPreviewMode:a}=dt($n),c=!!u&&!!l,d=!s&&G("button",{className:"form-submit",disabled:t,"aria-label":"Submit survey",type:"button",onClick(){var e;o&&(null===(e=window)||void 0===e||e.open(o)),a?null==i||i():r()},children:e});return G("div",{className:"bottom-section",children:[c?G("div",{className:"form-buttons form-buttons-with-back",children:[G("button",{className:"form-back",type:"button","aria-label":"Go to previous question",onClick:l,children:n.backButtonText||"Back"}),d]}):d,!n.whiteLabel&&G(Kn,{urlParams:{utm_source:"survey-footer"}})]})}function Jn({question:e,forceDisableHtml:t,htmlFor:n}){return G("div",{class:e.question||e.description?"question-header":"question-header question-header--empty",children:[G(e.type===Pt?"label":"h3",{className:"survey-question",htmlFor:n,children:e.question}),e.description&&Cn({component:k("p",{className:"survey-question-description"}),children:e.description,renderAsHtml:!t&&"text"!==e.descriptionContentType})]})}function Xn({onClick:e}){const{isPreviewMode:t}=dt($n);return G("button",{className:"form-cancel",onClick:e,disabled:t,"aria-label":"Close survey",type:"button",children:Gn({fill:"black"})})}function er({header:e,description:t,contentType:n,forceDisableHtml:r,appearance:o,onClose:i}){const{isPopup:s}=dt($n);return lt(()=>{const e=e=>{"Enter"!==e.key&&"Escape"!==e.key||(e.preventDefault(),i())};return Ut(window,"keydown",e),()=>{window.removeEventListener("keydown",e)}},[i]),G("div",{className:"thank-you-message",role:"status",tabIndex:0,"aria-atomic":"true",children:[s&&!0!==o.hideCancelButton&&G(Xn,{onClick:()=>i()}),G("h3",{className:"thank-you-message-header",children:e}),t&&Cn({component:k("p",{className:"thank-you-message-body"}),children:t,renderAsHtml:!r&&"text"!==n}),s&&G(Yn,{text:o.thankYouMessageCloseButtonText||"Close",submitDisabled:!1,appearance:o,onSubmit:()=>i()})]})}function tr({header:e,description:t,contentType:n,forceDisableHtml:r,appearance:o,onStart:i}){const{isPopup:s,onPreviewSubmit:u,onPopupSurveyDismissed:l}=dt($n);return G("div",{className:"intro-screen",role:"status",tabIndex:0,"aria-atomic":"true",children:[s&&!0!==o.hideCancelButton&&G(Xn,{onClick:()=>l()}),e&&G("h3",{className:"intro-screen-header",children:e}),t&&Cn({component:k("p",{className:"intro-screen-body"}),children:t,renderAsHtml:!r&&"text"!==n}),G(Yn,{text:o.introScreenButtonText||"Get started",submitDisabled:!1,appearance:o,onSubmit:i,onPreviewSubmit:()=>u(null)})]})}const nr=e=>oe(e)&&e.every(e=>ue(e));function rr({question:e,forceDisableHtml:t,appearance:n,onSubmit:r,onPreviewSubmit:o,displayQuestionIndex:i,initialValue:s,canGoBack:u,onBack:l}){const{isPreviewMode:a}=In(),c=at(null),[d,v]=ut(()=>ue(s)?s:""),p=null==n?void 0:n.disableAutofocus;lt(()=>{p||setTimeout(()=>{var e;a||null===(e=c.current)||void 0===e||e.focus()},100)},[a,p]);const h=`surveyQuestion${i}`,f=ct(()=>function(e,t,n){const r=e.trim();if(!n&&""===r)return"This field is required";if(""===r)return!1;if(t&&t.length>0)for(const e of t)switch(e.type){case X:var o;if(void 0!==e.value&&e.value>r.length)return null!==(o=e.errorMessage)&&void 0!==o?o:`Please enter at least ${e.value} characters`;break;case ee:var i;if(void 0!==e.value&&r.length>e.value)return null!==(i=e.errorMessage)&&void 0!==i?i:`Please enter no more than ${e.value} characters`}return!1}(d,e.validation,e.optional),[d,e.validation,e.optional]),y=He(e.validation,X),m=He(e.validation,ee),g=ct(()=>function(e,t){const n=1===e?void 0:e;return n&&t?`Enter ${n}-${t} characters`:n?`Enter at least ${n} ${1===n?"character":"characters"}`:t?`Maximum ${t} ${1===t?"character":"characters"}`:void 0}(y,m),[y,m]),b=()=>{f||r(d.trim())},w=()=>{f||o(d.trim())};return G(q,{children:[G("div",{className:"question-container",children:[G(Jn,{question:e,forceDisableHtml:t,htmlFor:h}),G("textarea",{ref:c,id:h,rows:4,placeholder:null==n?void 0:n.placeholder,minLength:y,maxLength:m,onInput(e){v(e.currentTarget.value),e.stopPropagation()},onKeyDown(e){e.stopPropagation(),"Enter"!==e.key||!e.metaKey&&!e.ctrlKey||f||(e.preventDefault(),a?w():b())},value:d}),g&&G("div",{className:"validation-hint",children:g})]}),G(Yn,{text:e.buttonText||"Submit",submitDisabled:!!f,appearance:n,onSubmit:b,onPreviewSubmit:w,canGoBack:u,onBack:l})]})}function or({question:e,forceDisableHtml:t,appearance:n,onSubmit:r,onPreviewSubmit:o,canGoBack:i,onBack:s}){return G(q,{children:[G("div",{className:"question-container",children:G(Jn,{question:e,forceDisableHtml:t})}),G(Yn,{text:e.buttonText||"Submit",submitDisabled:!1,link:e.link,appearance:n,onSubmit:()=>r("link clicked"),onPreviewSubmit:()=>o("link clicked"),canGoBack:i,onBack:s})]})}function ir({question:e,forceDisableHtml:t,displayQuestionIndex:n,appearance:r,onSubmit:o,onPreviewSubmit:i,initialValue:s,canGoBack:u,onBack:l}){var a;const c=e.scale,d=10===e.scale?0:1,[v,p]=ut(()=>ce(s)?s:oe(s)&&s.length>0&&ce(parseInt(s[0]))?parseInt(s[0]):ue(s)&&ce(parseInt(s))?parseInt(s):null),h="emoji"===e.display&&2===e.scale,{isPreviewMode:f}=In(),y=e=>f?i(e):o(e);return G(q,{children:[G("div",{className:"question-container",children:[G(Jn,{question:e,forceDisableHtml:t}),G("div",{className:"rating-section",children:[G("div",{className:"rating-options",children:["emoji"===e.display&&G("div",{className:"rating-options-emoji"+(h?" rating-options-emoji-2":""),children:null===(a=dr[e.scale])||void 0===a?void 0:a.map((t,r)=>G("button",{"aria-label":`Rate ${r+1}`,className:`ratings-emoji question-${n}-rating-${r} ${r+1===v?"rating-active":""}`,value:r+1,type:"button",onClick(){const t=r+1;p(t),e.skipSubmitButton&&y(t)},children:t},r))}),"number"===e.display&&G("div",{className:"rating-options-number",style:{gridTemplateColumns:`repeat(${c-d+1}, minmax(0, 1fr))`},children:vr(e.scale).map((t,o)=>G(sr,{displayQuestionIndex:n,active:v===t,appearance:r,num:t,setActiveNumber(t){p(t),e.skipSubmitButton&&y(t)}},o))})]}),!h&&G("div",{className:"rating-text",children:[G("div",{children:e.lowerBoundLabel}),G("div",{children:e.upperBoundLabel})]})]})]}),G(Yn,{text:e.buttonText||(null==r?void 0:r.submitButtonText)||"Submit",submitDisabled:le(v)&&!e.optional,appearance:r,onSubmit:()=>o(v),onPreviewSubmit:()=>i(v),skipSubmitButton:e.skipSubmitButton,canGoBack:u,onBack:l})]})}function sr({num:e,active:t,displayQuestionIndex:n,setActiveNumber:r}){return G("button",{"aria-label":`Rate ${e}`,className:`ratings-number question-${n}-rating-${e} ${t?"rating-active":""}`,type:"button",onClick(){r(e)},children:e})}function ur({question:e,forceDisableHtml:t,displayQuestionIndex:n,appearance:r,onSubmit:o,onPreviewSubmit:i,initialValue:s,canGoBack:u,onBack:l}){const a=at(null),c=ct(()=>(e=>{var t;if(!e.shuffleOptions)return e.choices;const n=[...e.choices],r=e.hasOpenChoice&&null!==(t=n.pop())&&void 0!==t?t:null,o=(i=n,(s=ln(n)).length>1&&i.every((e,t)=>e===s[t])?s.reverse():s);var i,s;return le(r)||o.push(r),o})(e),[e]),[d,v]=ut(()=>((e,t)=>ue(e)||nr(e)?e:t===It?null:[])(s,e.type)),[p,h]=ut(()=>((e,t)=>{if(ue(e)&&!t.includes(e))return{isSelected:!0,inputValue:e};if(nr(e)){const n=e.find(e=>!t.includes(e));if(n)return{isSelected:!0,inputValue:n}}return{isSelected:!1,inputValue:""}})(s,c)),{isPreviewMode:f}=In(),y=e.type===It,m=e.type===$t,g=e.skipSubmitButton&&y&&!e.hasOpenChoice,b=(e,t)=>{if(t){const e=!p.isSelected;return h(t=>Ne(Ne({},t),{},{isSelected:e,inputValue:e?t.inputValue:""})),y&&v(""),void(e&&setTimeout(()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.focus()},75))}if(y)return v(e),h(e=>Ne(Ne({},e),{},{isSelected:!1,inputValue:""})),void(g&&(o(e),f&&i(e)));m&&oe(d)&&(d.includes(e)?v(d.filter(t=>t!==e)):v([...d,e]))},w=e=>{e.stopPropagation();const t=e.currentTarget.value;h(e=>Ne(Ne({},e),{},{inputValue:t})),y&&v(t)},x=e=>{e.stopPropagation(),"Enter"!==e.key||k()||(e.preventDefault(),S()),"Escape"===e.key&&(e.preventDefault(),h(e=>Ne(Ne({},e),{},{isSelected:!1,inputValue:""})),y&&v(null))},k=()=>!(e.optional||!le(d)&&(!oe(d)||p.isSelected||0!==d.length)&&(!p.isSelected||""!==p.inputValue.trim())),S=()=>{p.isSelected&&m?oe(d)&&(f?i([...d,p.inputValue]):o([...d,p.inputValue])):f?i(d):o(d)};return G(q,{children:[G("div",{className:"question-container",children:[G(Jn,{question:e,forceDisableHtml:t}),G("fieldset",{className:"multiple-choice-options limit-height",children:[G("legend",{className:"sr-only",children:m?" Select all that apply":" Select one"}),c.map((t,r)=>{const o=!!e.hasOpenChoice&&r===e.choices.length-1,i=`surveyQuestion${n}Choice${r}`,s=`${i}Open`,u=o?p.isSelected:y?d===t:oe(d)&&d.includes(t);return G("label",{className:o?"choice-option-open":"",children:[G("div",{className:"response-choice",children:[G("input",{type:y?"radio":"checkbox",name:i,checked:u,onChange:()=>b(t,o),id:i,"aria-controls":s}),G("span",{children:o?`${t}:`:t})]}),o&&G("input",{type:"text",ref:a,id:s,name:`question${n}Open`,value:p.inputValue,onKeyDown:x,onInput:w,onClick(e){p.isSelected||b(t,!0),e.stopPropagation()},"aria-label":`${t} - please specify`})]},r)})]})]}),G(Yn,{text:e.buttonText||"Submit",submitDisabled:k(),appearance:r,onSubmit:S,onPreviewSubmit:S,skipSubmitButton:g,canGoBack:u,onBack:l})]})}const lr=[1,2,3,4,5],ar=[1,2,3,4,5,6,7],cr=[0,1,2,3,4,5,6,7,8,9,10],dr={2:[Un,Zn],3:[On,Rn,An],5:[Qn,On,Rn,An,Vn]};function vr(e){switch(e){case 5:default:return lr;case 7:return ar;case 10:return cr}}const pr=Vt("[Surveys]");function hr(e,t,n){var r;const o=e.questions[t],i=t+1;if(!(null===(r=o.branching)||void 0===r?void 0:r.type))return t===e.questions.length-1?Mt:i;if(o.branching.type===Mt)return Mt;if("specific_question"===o.branching.type){if(Number.isInteger(o.branching.index))return o.branching.index}else if("response_based"===o.branching.type){if(o.type===It){var s;let e=o.choices.indexOf(`${n}`);if(-1===e&&o.hasOpenChoice&&(e=o.choices.length-1),null===(s=o.branching)||void 0===s||null===(s=s.responseValues)||void 0===s?void 0:s.hasOwnProperty(e)){const t=o.branching.responseValues[e];if(Number.isInteger(t))return t;if(t===Mt)return Mt}}else if(o.type===Ct){var u;if(o.optional&&ae(n))return i===e.questions.length?Mt:i;if("number"!=typeof n||!Number.isInteger(n))throw new Error("The response type must be an integer");const t=function(e,t){if(2===t){if(1>e||e>2)throw new Error("The response must be in range 1-2");return 1===e?"positive":"negative"}if(3===t){if(1>e||e>3)throw new Error("The response must be in range 1-3");return 1===e?"negative":2===e?"neutral":"positive"}if(5===t){if(1>e||e>5)throw new Error("The response must be in range 1-5");return e>2?3===e?"neutral":"positive":"negative"}if(7===t){if(1>e||e>7)throw new Error("The response must be in range 1-7");return e>3?4===e?"neutral":"positive":"negative"}if(10===t){if(0>e||e>10)throw new Error("The response must be in range 0-10");return e>6?e>8?"promoters":"passives":"detractors"}throw new Error("The scale must be one of: 2, 3, 5, 7, 10")}(n,o.scale);if(null===(u=o.branching)||void 0===u||null===(u=u.responseValues)||void 0===u?void 0:u.hasOwnProperty(t)){const e=o.branching.responseValues[t];if(Number.isInteger(e))return e;if(e===Mt)return Mt}}return i}return pr.warn("Falling back to next question index due to unexpected branching type"),i}const fr=Vt("[SurveyTranslations]");function yr(e,t){const n=function(e){var t;return function({overrideLanguage:e,storedPersonProperties:t,locale:n},r){const o=Jt(e);if(o)return null==r||r.info(`Using override display language: ${o}`),o;const i=function(e){return e&&"object"==typeof e&&"language"in e?Jt(e.language):null}(t);if(i)return null==r||r.info(`Using person property language: ${i}`),i;const s=Jt(n);return s?(null==r||r.info(`Using detected locale: ${s}`),s):(null==r||r.info("No user language detected"),null)}({overrideLanguage:e.config.overrideLanguage,storedPersonProperties:null===(t=e.client)||void 0===t?void 0:t.kv.get("$stored_person_properties"),locale:"u">typeof navigator?navigator.language||navigator.userLanguage:void 0},fr)}(t);if(!n)return fr.info("No user language detected"),{survey:e,language:null};const r=nn(e,n,fr);return{survey:r.survey,language:r.matchedKey}}const mr="ph:show_survey_widget",gr="PHWidgetSurveyClickListener";function br(e,t){try{const n=e.getBoundingClientRect(),r=window.innerHeight,o=window.innerWidth;let i=n.left+n.width/2-t/2;i+t>o-20&&(i=o-t-20),20>i&&(i=20);const s=r-n.bottom,u=250>s&&n.top>s;return{position:"fixed",top:u?"auto":`${n.bottom+12}px`,left:`${i}px`,right:"auto",bottom:u?r-n.top+12+"px":"auto",zIndex:fn.zIndex}}catch(e){return an.warn("Failed to calculate trigger position:",e),null}}var wr=class{constructor(e){var t,n;this.bi=new Map,this.wi=new Map,this.ki=new Map,this.Si=new Map,this.xi=new Set,this.Ci=!1,this.Ii=null,this.Mi=!1,this.Ti=null,this.Ri=null,this.$i=null,this.Ai=!1,this.handlePageUnload=()=>{var e;const t=null===(e=this.Ei.client)||void 0===e?void 0:e.kv.get(W);if(t)for(const e of t)Fn(e)&&qn(e,this.Ei)},this.handlePopoverSurvey=(e,t,{resumeDelayFromActivation:n=!1}={})=>{var r,o,i,s,u,l,a;if(!(null===(r=this.Ei.client)||void 0===r?void 0:r.canCapture))return;const{survey:c,language:d}=this.Oi(e);this.Ii=d,this.$i=null,this.Pi=t;const v=this.Li(c,t);this.Fi(v.id);const{properties:p,initialResponses:h}=null!=t?t:{},f=!(!h||0>=Object.keys(h).length)&&this.Di(v,h,p,d);if(f&&!(null===(o=v.appearance)||void 0===o?void 0:o.displayThankYouMessage))return;this.Ni(v);let y={};if((null===(i=v.appearance)||void 0===i?void 0:i.position)===St&&(null===(s=v.appearance)||void 0===s?void 0:s.widgetSelector)){var m;const e=document.querySelector(v.appearance.widgetSelector);e&&(y=br(e,parseInt((null===(m=v.appearance)||void 0===m?void 0:m.maxWidth)||fn.maxWidth))||{})}const g=(null===(u=v.appearance)||void 0===u?void 0:u.surveyPopupDelaySeconds)||0,{shadow:b}=bn(v,this.Ei);this.Si.set(b,b.host);const w={posthog:this.Ei,survey:v,removeSurveyFromFocus:this.qi,properties:p,style:y,isSurveyCompleted:f,skipShownEvent:null==t?void 0:t.skipShownEvent,surveyLanguage:d};if(this.$i=w,0>=g)return this.Mi=!0,U(G(qr,Ne({},w)),b);const x=()=>{this.Mi=!0;const{survey:n,language:r}=this.Oi(e);this.Ii=r;const o=this.Li(n,t),i=Ne(Ne({},w),{},{survey:o,surveyLanguage:r});this.$i=i,U(G(qr,Ne(Ne({},i),{},{survey:Ne(Ne({},o),{},{appearance:Ne(Ne({},o.appearance),{},{surveyPopupDelaySeconds:0})})})),b)},k=()=>{var e;if(!(null===(e=this.Ei.client)||void 0===e?void 0:e.canCapture)||!this.ji(v))return an.info(`Survey ${v.id} no longer eligible when its display delay elapsed; not displaying`),this.qi(v);x()},S=n?null===(l=this.Ei.surveys)||void 0===l||null===(l=l._surveyEventReceiver)||void 0===l||null===(a=l.getActivationTimestamp)||void 0===a?void 0:a.call(l,v.id):void 0,q=ce(S)?Math.max(0,Date.now()-S):0,_=Math.max(0,1e3*g-q);if(0>=_)return k();const T=window.setTimeout(()=>{this.bi.delete(v.id),k()},_);this.bi.set(v.id,T)},this.Bi=e=>{var t;const{survey:n,language:r}=this.Oi(e),{shadow:o,isNewlyCreated:i}=bn(n,this.Ei);this.Si.set(o,o.host),(null===(t=e.appearance)||void 0===t?void 0:t.widgetType)===bt&&this.ki.set(e.id,e),i&&U(G(Tr,{posthog:this.Ei,survey:n,surveyLanguage:r},e.id),o)},this.zi=e=>{const t=this.wi.get(e);t&&(t.element.removeEventListener("click",t.listener),t.element.removeAttribute(gr),this.wi.delete(e),an.info(`Removed click listener for survey ${e}`))},this.Hi=e=>{this.Ui(e)||(this.Wi(e),this.zi(e.id))},this.Vi=e=>{this.Ui(e)||(this.Wi(e),this.ki.delete(e.id))},this.Ui=e=>{try{var t;const n=document.querySelector(Ln(e,!0));return!!(null==n||null===(t=n.shadowRoot)||void 0===t?void 0:t.querySelector(".ph-survey"))}catch(e){return!1}},this.Gi=(e,t)=>{const n=document.querySelector(t),r=this.wi.get(e.id);if(n){if(this.Bi(e),r){if(n===r.element)return;an.info(`Selector element changed for survey ${e.id}. Re-attaching listener.`),this.zi(e.id)}if(!n.hasAttribute(gr)){const t=t=>{var n,r;t.stopPropagation();const o=(null===(n=e.appearance)||void 0===n?void 0:n.position)===St?br(t.currentTarget,parseInt((null===(r=e.appearance)||void 0===r?void 0:r.maxWidth)||fn.maxWidth)):{};window.dispatchEvent(new CustomEvent(mr,{detail:{surveyId:e.id,position:o}}))};Ut(n,"click",t),n.setAttribute(gr,"true"),this.wi.set(e.id,{element:n,listener:t,survey:e}),an.info(`Attached click listener for feedback button survey ${e.id}`)}}else r&&this.Hi(e)},this.renderPopover=e=>{var t;if(!(null===(t=this.Ei.client)||void 0===t?void 0:t.canCapture))return;const{survey:n,language:r}=this.Oi(e),{shadow:o}=bn(n,this.Ei);this.Si.set(o,o.host),U(G(qr,{posthog:this.Ei,survey:n,removeSurveyFromFocus:this.qi,surveyLanguage:r}),o)},this.renderSurvey=(e,t,n)=>{var r;if(!(null===(r=this.Ei.client)||void 0===r?void 0:r.canCapture))return;const{survey:o,language:i}=this.Oi(e);let s=!1;this.Ei.config.prefillFromUrl&&(s=this.Qi(o,i,n)),U(G(qr,{posthog:this.Ei,survey:o,removeSurveyFromFocus:this.qi,isPopup:!1,properties:n,isSurveyCompleted:s,surveyLanguage:i}),t)},this.getActiveMatchingSurveys=(e,t=!1)=>{var n;null===(n=this.Ei.surveys)||void 0===n||n.getSurveys(t=>{e(t.filter(e=>this.ji(e)))},t)},this.callSurveysAndEvaluateDisplayLogic=(e=!1)=>{this.getActiveMatchingSurveys(e=>{var t;const n=null===(t=this.Ei.client)||void 0===t?void 0:t.canCapture,r=e.filter(e=>n&&(e.type===qt||e.type===_t)),o=new Set(r.map(e=>e.id));for(const e of Array.from(this.bi.keys()))o.has(e)||this.cancelSurvey(e);const i=this.Zi(r),s=new Set,u=new Set;i.forEach(e=>{if(e.type===_t){var t,n,r,o;if((null===(t=e.appearance)||void 0===t?void 0:t.widgetType)===bt)return u.add(e.id),void this.Bi(e);"selector"===(null===(n=e.appearance)||void 0===n?void 0:n.widgetType)&&(null===(r=e.appearance)||void 0===r?void 0:r.widgetSelector)&&(s.add(e.id),this.Gi(e,null===(o=e.appearance)||void 0===o?void 0:o.widgetSelector))}le(this.Ji)&&e.type===qt&&this.handlePopoverSurvey(e,void 0,{resumeDelayFromActivation:!0})}),this.wi.forEach(({survey:e})=>{s.has(e.id)||this.Hi(e)}),this.ki.forEach((e,t)=>{u.has(t)||this.Vi(e)})},e)},this.Ni=e=>{le(this.Ji)||an.error(`Survey ${this.Ji} already in focus. Cannot add survey ${e.id}.`),this.Ji=e.id},this.qi=e=>{this.Ji!==e.id&&an.error(`Survey ${e.id} is not in focus. Cannot remove survey ${e.id}.`),this.Fi(e.id),this.Ji=null,this.Ii=null,this.Mi=!1,this.$i=null,this.Pi=void 0,this.Wi(e)},this.Ei=e,this.Ji=null,this.Ti=()=>this.Ki(),Ut(window,"languagechange",this.Ti),this.Ri=null!==(t=null===(n=e.client)||void 0===n||null===(n=n.getExtension("featureFlagsCommon"))||void 0===n?void 0:n.onFeatureFlags(()=>this.Ki()))&&void 0!==t?t:null}Ki(){var e;if(le(this.Ji))return;const t=null===(e=this.Ei.client)||void 0===e?void 0:e.kv.get(W),n=null==t?void 0:t.find(e=>e.id===this.Ji);if(!n)return;const{survey:r,language:o}=this.Oi(n);if(o===this.Ii)return;if(this.Ii=o,!this.Mi)return;const i=this.Li(r,this.Pi),{shadow:s}=bn(i,this.Ei);U(G(qr,Ne(Ne({},this.$i),{},{posthog:this.Ei,survey:i,removeSurveyFromFocus:this.qi,surveyLanguage:o})),s)}Li(e,t){return(null==t?void 0:t.position)||(null==t?void 0:t.selector)?Ne(Ne({},e),{},{appearance:Ne(Ne(Ne({},e.appearance),t.position&&{position:t.position}),t.selector&&{widgetSelector:t.selector})}):e}Fi(e){const t=this.bi.get(e);t&&(clearTimeout(t),this.bi.delete(e))}cancelSurvey(e){this.bi.has(e)&&(an.info(`Cancelled pending survey ${e}`),this.Fi(e),this.Ji===e&&(this.Ji=null,this.Ii=null,this.Mi=!1,this.$i=null,this.Pi=void 0))}startAutomaticDisplay(){if(this.Ci||this.Xi||!1===this.Ei.config.automaticDisplay)return;this.Xi=()=>{};const e=function(e){let t;e.callSurveysAndEvaluateDisplayLogic(!0);const n=()=>{se(t)&&(t=setInterval(()=>{e.callSurveysAndEvaluateDisplayLogic(!1)},1e3))},r=()=>{se(t)||(clearInterval(t),t=void 0)};n();const o=()=>{document.hidden?r():(e.callSurveysAndEvaluateDisplayLogic(!1),n())};return Ut(document,"visibilitychange",o),()=>{r(),document.removeEventListener("visibilitychange",o)}}(this);this.Ci?e():this.Xi=e}clearInMemoryInProgressSurveyState(){(()=>{for(const e of Object.keys(Bn))delete Bn[e]})()}dispose(){var e;this.Ci=!0,null===(e=this.Xi)||void 0===e||e.call(this),this.Xi=void 0,this.Ti&&(window.removeEventListener("languagechange",this.Ti),this.Ti=null),this.Ri&&(this.Ri(),this.Ri=null),this.bi.forEach((e,t)=>this.Fi(t)),this.wi.forEach((e,t)=>this.zi(t)),this.Si.forEach((e,t)=>{U(null,t),null==e||e.remove()}),this.Si.clear(),this.ki.clear(),this.Ji=null}Zi(e){return e.sort((e,t)=>{var n,r;const o=Fn(e),i=Fn(t);if(o&&!i)return-1;if(!o&&i)return 1;const s=e.schedule===Nt,u=t.schedule===Nt;return s&&!u?1:!s&&u?-1:((null===(n=e.appearance)||void 0===n?void 0:n.surveyPopupDelaySeconds)||0)-((null===(r=t.appearance)||void 0===r?void 0:r.surveyPopupDelaySeconds)||0)})}Oi(e){return yr(e,this.Ei)}Qi(e,t,n){if(this.xi.has(e.id))return!1;const{params:r}=function(){const e={};let t=!1;const n=window.location.search.replace(/^\?/,"");if(!n)return{params:e,autoSubmit:t};const r=n.split("&");for(const n of r){const r=n.indexOf("=");if(0>=r)continue;let o,i;try{o=decodeURIComponent(n.slice(0,r)),i=decodeURIComponent(n.slice(r+1))}catch(e){continue}if("auto_submit"===o&&"true"===i){t=!0;continue}const s=o.match(/^q(\d+)$/);if(s){const t=parseInt(s[1],10);e[t]||(e[t]=[]),e[t].push(i)}}return{params:e,autoSubmit:t}}();if(0===Object.keys(r).length)return!1;an.info("[Survey Prefill] Detected URL prefill parameters");const o=this.Yi(e,r,t);return!!o&&(this.tr(e,o,n,t),this.xi.add(e.id),o.isSurveyCompleted)}tr(e,t,n,r){const{responses:o,submissionId:i,isSurveyCompleted:s,skippedResponses:u}=t;(Object.keys(u).length>0&&e.enable_partial_responses||s)&&xn({responses:s?o:u,survey:e,surveySubmissionId:i,posthog:this.Ei,isSurveyCompleted:s,properties:n,surveyLanguage:r})}Di(e,t,n,r){const o={};for(const[e,n]of Object.entries(t))o[parseInt(e)]=oe(n)?n.map(String):[String(n)];an.info("[Survey] Processing initial responses");const i=this.Yi(e,o,r);return!!i&&(this.tr(e,i,n,r),i.isSurveyCompleted)}Yi(e,t,n){try{const r=function(e,t){const n={};return e.questions.forEach((e,r)=>{if(!t[r]||!e.id)return;const o=t[r],i=Zt(e.id);try{switch(e.type){case It:{if(!e.choices||0===e.choices.length)return void Qt.warn(`[Survey Prefill] Question ${r} has no choices`);const t=parseInt(o[0],10);if(isNaN(t)||0>t||t>=e.choices.length)return void Qt.warn(`[Survey Prefill] Invalid choice index for q${r}: ${o[0]}`);n[i]=e.choices[t];break}case $t:{if(!e.choices||0===e.choices.length)return void Qt.warn(`[Survey Prefill] Question ${r} has no choices`);const t=o.map(e=>parseInt(e,10)).filter(t=>!isNaN(t)&&t>=0&&e.choices.length>t);if(0===t.length)return void Qt.warn(`[Survey Prefill] No valid choices for q${r}`);const s=[...new Set(t.map(t=>e.choices[t]))];t.length>s.length&&Qt.warn(`[Survey Prefill] Removed duplicate choices for q${r}`),n[i]=s;break}case Ct:{const t=parseInt(o[0],10),s=e.scale||10,u=10===s?0:1;if(isNaN(t)||u>t||t>s)return void Qt.warn(`[Survey Prefill] Invalid rating for q${r}: ${o[0]} (scale: ${u}-${s})`);n[i]=t;break}default:Qt.info(`[Survey Prefill] Question type ${e.type} does not support prefill`)}}catch(e){Qt.error(`[Survey Prefill] Error converting q${r}:`,e)}}),n}(e,t);if(0===Object.keys(r).length)return an.warn("[Survey Prefill] No valid responses after conversion"),null;const o=Ve(),{startQuestionIndex:i,skippedResponses:s,skippedIndices:u}=function(e,t,n){let r=0;const o={},i=[],s=e.questions.length+1;let u=0;for(;e.questions.length>r&&s>u&&(u++,t.includes(r));){const t=e.questions[r];if(!t||!("skipSubmitButton"in t)||!t.skipSubmitButton)break;if(t.id){const e=Zt(t.id);se(n[e])||(o[e]=n[e])}i.push(r);const s=hr(e,r,t.id?n[Zt(t.id)]:null);if(s===Mt)return{startQuestionIndex:e.questions.length,skippedResponses:o,skippedIndices:i};r=s}return{startQuestionIndex:r,skippedResponses:o,skippedIndices:i}}(e,Object.keys(t).map(e=>parseInt(e,10)).filter(t=>{const n=e.questions[t];return(null==n?void 0:n.id)&&!se(r[Zt(n.id)])}),r),l=i>=e.questions.length;return Dn(e,{surveySubmissionId:o,responses:r,lastQuestionIndex:i,questionOrder:_n(e.questions),visitedIndices:u,surveyLanguage:n}),an.info("[Survey Prefill] Stored prefilled responses in localStorage"),{responses:r,submissionId:o,startQuestionIndex:i,isSurveyCompleted:l,skippedResponses:s}}catch(e){return an.error("[Survey Prefill] Error handling prefill:",e),null}}er(e,t){var n;if(!e)return!0;const r=null===(n=this.Ei.client)||void 0===n?void 0:n.getExtension(K),o=!!(null==r?void 0:r.isFeatureEnabled(e,{send_event:!e.startsWith("survey-targeting-")}));let i=!0;t&&(i=(null==r?void 0:r.getFeatureFlag(e,{send_event:!1}))===t||"any"===t);const s=o&&i;return s||this.nr(e),s}nr(e){this.Ai||!1!==this.Ei.config.featureFlagEvaluation||(this.Ai=!0,an.warn(`Survey feature flag "${e}" evaluated to false because advanced_disable_feature_flags is set. PostHog creates an internal targeting flag for almost every survey, so no survey can display while flags are disabled. To keep surveys working, replace advanced_disable_feature_flags with advanced_only_evaluate_survey_feature_flags, which evaluates survey flags only.`))}ir(e){return!e.conditions||Mn(e,this.Ei)&&Nn(e)&&function(e){var t,n;return!(null===(t=e.conditions)||void 0===t?void 0:t.selector)||!!(null===(n=document)||void 0===n?void 0:n.querySelector(e.conditions.selector))}(e)}rr(e){var t;return Pn(e)?{satisfied:!0}:e.internal_targeting_flag_key&&function(e){var t;return"recurring"===e.schedule||(null!==(t=e.current_iteration)&&void 0!==t?t:0)>0}(e)&&!(null===(t=this.Ei.client)||void 0===t||null===(t=t.getExtension("featureFlagsCommon"))||void 0===t?void 0:t.hasLoadedFlags)?(this.nr(e.internal_targeting_flag_key),{satisfied:!1,reason:"Feature flags have not loaded yet; deferring internal targeting flag check"}):{satisfied:this.er(e.internal_targeting_flag_key)}}checkSurveyEligibility(e){var t,n;const r={eligible:!0,reason:void 0};if(!function(e){return!(!e.start_date||e.end_date)}(e))return r.eligible=!1,r.reason=`Survey is not running. It was completed on ${e.end_date}`,r;if(!vn.includes(e.type))return r.eligible=!1,r.reason=`Surveys of type ${e.type} are never eligible to be shown in the app`,r;const o=null===(t=e.conditions)||void 0===t?void 0:t.linkedFlagVariant;if(!this.er(e.linked_flag_key,o))return r.eligible=!1,r.reason=o?`Survey linked feature flag is not enabled for variant ${o}`:"Survey linked feature flag is not enabled",r;if(!this.er(e.targeting_flag_key))return r.eligible=!1,r.reason="Survey targeting feature flag is not enabled",r;const i=this.rr(e);var s;return i.satisfied?(e=>{let t=null;try{t=localStorage.getItem("lastSeenSurveyDate")}catch(e){an.error("localStorage error: "+e)}return function(e,t){if(!e||!t)return!0;const n="string"==typeof t?new Date(t):t,r=Math.abs((new Date).getTime()-n.getTime());return Math.ceil(r/864e5)>e}(e,t)})(null===(n=e.conditions)||void 0===n?void 0:n.seenSurveyWaitPeriodInDays)?((e=>{let t=null;try{t=localStorage.getItem(dn(e))}catch(e){an.error("localStorage error: "+e)}return!!t&&!Pn(e)})(e)&&(r.eligible=!1,r.reason="Survey has already been seen and it can't be activated again"),r):(r.eligible=!1,r.reason="Survey wait period has not passed",r):(r.eligible=!1,r.reason=null!==(s=i.reason)&&void 0!==s?s:"Survey internal targeting flag is not enabled and survey cannot activate repeatedly and survey is not in progress",r)}checkSurveyCaptureEligibility(){var e;return(null===(e=this.Ei.client)||void 0===e?void 0:e.canCapture)?{eligible:!0}:{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"}}checkSurveyDisplayEligibility(e){const t=this.checkSurveyCaptureEligibility();return t.eligible?this.checkSurveyEligibility(e):t}checkSurveyRenderability(e){const t=this.checkSurveyDisplayEligibility(e);return t.eligible&&!this.sr(e)?{eligible:!1,reason:"Survey event/action trigger has not been fired yet"}:t}sr(e){var t;if(!rn(e)&&!function(e){var t;return!!(null===(t=e.conditions)||void 0===t||null===(t=t.actions)||void 0===t||null===(t=t.values)||void 0===t?void 0:t.length)}(e))return!0;const n=null===(t=this.Ei.surveys)||void 0===t||null===(t=t._surveyEventReceiver)||void 0===t?void 0:t.getSurveys();return!!(null==n?void 0:n.includes(e.id))}ar(e){var t;return!(null===(t=e.feature_flag_keys)||void 0===t?void 0:t.length)||e.feature_flag_keys.every(({key:e,value:t})=>!e||!t||this.er(t))}ji(e){return this.checkSurveyEligibility(e).eligible&&this.ir(e)&&this.sr(e)&&this.ar(e)}Wi(e){try{const t=document.querySelector(Ln(e,!0));(null==t?void 0:t.shadowRoot)&&(U(null,t.shadowRoot),this.Si.delete(t.shadowRoot)),null==t||t.remove()}catch(t){an.warn(`Failed to remove survey ${e.id} from DOM:`,t)}}getTestAPI(){return{addSurveyToFocus:this.Ni,removeSurveyFromFocus:this.qi,surveyInFocus:this.Ji,surveyTimeouts:this.bi,handleWidget:this.Bi,handlePopoverSurvey:this.handlePopoverSurvey,manageWidgetSelectorListener:this.Gi,sortSurveysByAppearanceDelay:this.Zi.bind(this),checkFlags:this.ar.bind(this),isSurveyFeatureFlagEnabled:this.er.bind(this),onLanguageChange:this.Ki.bind(this),currentLanguage:this.Ii,surveyIsRendered:this.Mi}}};function xr({survey:e,removeSurveyFromFocus:t=()=>{},setSurveyVisible:n,isPreviewMode:r=!1,posthog:o}){lt(()=>{var i;if(r||!(null===(i=e.conditions)||void 0===i?void 0:i.url))return;const s=()=>{var r;const i=e.type===_t,s=Mn(e,o),u=(null===(r=e.appearance)||void 0===r?void 0:r.widgetType)===bt&&i;if(!s)return an.info(`Hiding survey ${e.id} because URL does not match`),n(!1),t(e);u&&(an.info(`Showing survey ${e.id} because it is a feedback button tab and URL matches`),n(!0))};Ut(window,"popstate",s),Ut(window,"hashchange",s);const u=window.history.pushState,l=window.history.replaceState;return window.history.pushState=function(...e){u.apply(this,e),s()},window.history.replaceState=function(...e){l.apply(this,e),s()},()=>{window.removeEventListener("popstate",s),window.removeEventListener("hashchange",s),window.history.pushState=u,window.history.replaceState=l}},[r,e,t,n,o])}const kr=200;function Sr(e="right"){switch(e){case"top":return{top:"0",left:"50%",transform:"translateX(-50%)"};case"left":return{top:"50%",left:"0",transform:"rotate(90deg) translateY(-100%)",transformOrigin:"left top"};case"bottom":return{bottom:"0",left:"50%",transform:"translateX(-50%)"};default:return{top:"50%",right:"0",transform:"rotate(-90deg) translateY(-100%)",transformOrigin:"right top"}}}function qr({survey:e,forceDisableHtml:t,posthog:n,style:r={},previewPageIndex:o,removeSurveyFromFocus:i=()=>{},isPopup:s=!0,onPreviewSubmit:u=()=>{},onPreviewBack:l=()=>{},onPopupSurveyDismissed:a=()=>{},onCloseConfirmationMessage:c=()=>{},properties:d,isSurveyCompleted:v,skipShownEvent:p,surveyLanguage:h}){var f,y,m,g,b,w,x,k,S,q,_,T;const P=at(null),I=Number.isInteger(o),{isPopupVisible:C,isSurveySent:M,hidePopupWithAnimation:N}=function(e,t,n,r,o,i,s,u,l){const[a,c]=ut(r||0===n||e.type===Tt),[d,v]=ut(!1),p=at(!1),h=()=>{const t=()=>{i&&o(e),c(!1)};if(p.current)return;const n=null==s?void 0:s.current;n?(p.current=!0,n.style.transition=`opacity ${kr}ms ease-out`,n.style.opacity="0",setTimeout(()=>{p.current=!1,t()},250)):t()},f=t=>{t.detail.surveyId===e.id&&h()};return lt(()=>{if(!t)return void an.error("usePopupVisibility hook called without a PostHog instance.");if(r)return;let o;const i=t=>{var n,r;if(t.detail.surveyId===e.id){if(!(null===(n=e.appearance)||void 0===n?void 0:n.displayThankYouMessage))return h();v(!0),(null===(r=e.appearance)||void 0===r?void 0:r.autoDisappear)&&(o&&clearTimeout(o),o=setTimeout(h,5e3))}},s=()=>{var n;if(Mn(e,t)){c(!0);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(e){}window.dispatchEvent(new Event("PHSurveyShown")),u||null===(n=t.client)||void 0===n||n.capture(Et,Ne(Ne({[Ft]:e.name,[jt]:e.id,[Ht]:e.current_iteration,[Lt]:e.current_iteration_start_date},l&&{[zt]:l}),{},{sessionRecordingUrl:Y(t)}))}};Ut(window,"PHSurveyClosed",f),Ut(window,"PHSurveySent",i);const a=n>0?setTimeout(s,n):void 0;return se(a)&&s(),()=>{se(a)||clearTimeout(a),se(o)||clearTimeout(o),window.removeEventListener("PHSurveyClosed",f),window.removeEventListener("PHSurveySent",i)}},[]),xr({survey:e,removeSurveyFromFocus:o,setSurveyVisible:c,isPreviewMode:r,posthog:t}),{isPopupVisible:a,isSurveySent:d,setIsPopupVisible:c,hidePopupWithAnimation:h}}(e,n,(null===(f=e.appearance)||void 0===f?void 0:f.surveyPopupDelaySeconds)?1e3*e.appearance.surveyPopupDelaySeconds:0,I,i,s,P,p,h),E=M||o===e.questions.length||!0===v,[B,D]=ut(!1),j=ct(()=>!!jn(e),[e]),F=!(!(null===(y=e.appearance)||void 0===y?void 0:y.introScreenHeader)&&!(null===(m=e.appearance)||void 0===m?void 0:m.introScreenDescription)),H=I?-1===o:!!(null===(g=e.appearance)||void 0===g?void 0:g.displayIntroScreen)&&F&&!B&&!j,L=ct(()=>{const t=jn(e),r=(null==t?void 0:t.surveySubmissionId)||Ve()||"";return{isPreviewMode:I,previewPageIndex:o,onPopupSurveyDismissed(){h?Sn(e,n,I,h):Sn(e,n,I),a()},isPopup:s||!1,surveySubmissionId:r,onPreviewSubmit:u,onPreviewBack:l,posthog:n,properties:d,surveyLanguage:h}},[I,o,s,n,e,a,u,l,d,h]);return C?G($n.Provider,{value:L,children:G("div",{className:"ph-survey",style:Ne(Ne({},zn(e.type,null===(b=e.appearance)||void 0===b?void 0:b.position,null===(w=e.appearance)||void 0===w?void 0:w.widgetType)),r),ref:P,children:E?G(er,{header:(null===(x=e.appearance)||void 0===x?void 0:x.thankYouMessageHeader)||"Thank you!",description:(null===(k=e.appearance)||void 0===k?void 0:k.thankYouMessageDescription)||"",forceDisableHtml:!!t,contentType:null===(S=e.appearance)||void 0===S?void 0:S.thankYouMessageDescriptionContentType,appearance:e.appearance||fn,onClose(){N(),c()}}):H?G(tr,{header:(null===(q=e.appearance)||void 0===q?void 0:q.introScreenHeader)||"",description:(null===(_=e.appearance)||void 0===_?void 0:_.introScreenDescription)||"",forceDisableHtml:!!t,contentType:null===(T=e.appearance)||void 0===T?void 0:T.introScreenDescriptionContentType,appearance:e.appearance||fn,onStart:()=>D(!0)}):G(_r,{survey:e,forceDisableHtml:!!t,posthog:n})})}):null}function _r({survey:e,forceDisableHtml:t,posthog:n}){var r,o;const i=ct(()=>{const t=jn(e);if(!t)return null;const n=ce(t.lastQuestionIndex);return!n||n&&t.lastQuestionIndex>=0&&e.questions.length>t.lastQuestionIndex?t:(Hn(e),null)},[e]),[s,u]=ut(()=>((null==i?void 0:i.responses)&&an.info("Survey is already in progress, filling in initial responses"),(null==i?void 0:i.responses)||{})),[l,a]=ut(!1),{previewPageIndex:c,onPopupSurveyDismissed:d,isPopup:v,onPreviewSubmit:p,onPreviewBack:h,surveySubmissionId:f,isPreviewMode:y,properties:m,surveyLanguage:g}=dt($n),[b,w]=ut(()=>{const t=null==i?void 0:i.lastQuestionIndex,n=ce(t)&&t>=0&&e.questions.length>t?t:0;return ce(c)&&c>=0?c:n}),[x,k]=ut(()=>{var t;return(null!==(t=null==i?void 0:i.visitedIndices)&&void 0!==t?t:[]).filter(t=>t>=0&&e.questions.length>t)}),[S,q]=ut(()=>{var t;const n=jn(e);return null!==(t=null==n?void 0:n.questionSnapshots)&&void 0!==t?t:{}}),_=ct(()=>_n(Tn(e,i)),[e.id,i]),T=ct(()=>{if(!_||new Set(_).size!==_.length)return Tn(e,i);const t=new Map(e.questions.map(e=>[e.id,e])),n=_.map(e=>t.get(e)).filter(e=>!!e);return n.length===_.length?n:e.questions},[_,e.questions,e,i]);lt(()=>{!y||se(c)||0>c||w(c)},[c,y]);const P=!!(null===(r=e.appearance)||void 0===r?void 0:r.allowGoBack)&&(y?(null!=c?c:0)>0:x.length>0),I=T.at(b);return I?G("form",{className:"survey-form",name:"surveyForm",children:[v&&!0!==(null===(o=e.appearance)||void 0===o?void 0:o.hideCancelButton)&&G(Xn,{onClick(){d()}}),G("div",{className:"survey-box","data-question-index":b,children:[l&&G("p",{role:"alert",children:"Your response could not be sent. Please try again later."}),Pr({question:I,forceDisableHtml:t,displayQuestionIndex:b,appearance:e.appearance||fn,onSubmit:t=>(({res:t,displayQuestionIndex:r,questionId:o})=>{var i;if(!n)return void an.error("onNextButtonClick called without a PostHog instance.");if(!(null===(i=n.client)||void 0===i?void 0:i.canCapture))return void a(!0);if(a(!1),!o)return void an.error("onNextButtonClick called without a questionId.");const{responses:l,questionSnapshots:c}=function({responses:e,questionSnapshots:t={}},n,r,o){return{responses:Ne(Ne({},e),{},{[Zt(n)]:r}),questionSnapshots:(null==o?void 0:o.id)?Ne(Ne({},t),{},{[o.id]:o.question}):t}}({responses:s,questionSnapshots:S},o,t,T[r]);u(l),q(c);const d=hr(e,r,t),v=d===Mt,p=[...x,r];if(v||(k(p),w(d),Dn(e,{surveySubmissionId:f,responses:l,lastQuestionIndex:d,questionOrder:_n(T),visitedIndices:p,surveyLanguage:g,questionSnapshots:c})),e.enable_partial_responses||v){const t=new Set(p.map(e=>{var t;return null===(t=T[e])||void 0===t?void 0:t.id}).filter(e=>!!e).map(e=>Zt(e))),r=Object.fromEntries(Object.entries(l).filter(([e])=>t.has(e)));xn({responses:r,survey:e,surveySubmissionId:f,isSurveyCompleted:v,posthog:n,properties:m,surveyLanguage:g,questionSnapshots:c})}})({res:t,displayQuestionIndex:b,questionId:I.id}),onPreviewSubmit:p,initialValue:I.id?s[Zt(I.id)]:void 0,canGoBack:P,onBack(){if(y)return void h();if(0===x.length)return;const t=x[x.length-1],n=x.slice(0,-1);k(n),w(t),Dn(e,{surveySubmissionId:f,responses:s,lastQuestionIndex:t,questionOrder:_n(T),visitedIndices:n,surveyLanguage:g,questionSnapshots:S})}})]})]}):null}function Tr({survey:e,forceDisableHtml:t,posthog:n,readOnly:r,surveyLanguage:o}){var i,s,u,l,a,c,d;const[v,p]=ut(!0),[h,f]=ut(!1),[y,m]=ut({}),g=at(void 0),b=()=>{var e;(h||!n||r||(null===(e=n.client)||void 0===e?void 0:e.canCapture))&&f(!h)};if(lt(()=>{var t;if(!n)return void an.error("FeedbackWidget called without a PostHog instance.");if(r)return;"tab"===(null===(t=e.appearance)||void 0===t?void 0:t.widgetType)&&m({top:"50%",bottom:"auto"});const o=t=>{var n;const r=t;(null===(n=r.detail)||void 0===n?void 0:n.surveyId)===e.id&&(an.info(`Received show event for feedback button survey ${e.id}`),m(r.detail.position||{}),b())};return Ut(window,mr,o),()=>{se(g.current)||(clearTimeout(g.current),g.current=void 0),window.removeEventListener(mr,o)}},[n,r,e.id,null===(i=e.appearance)||void 0===i?void 0:i.widgetType,null===(s=e.appearance)||void 0===s?void 0:s.widgetSelector,null===(u=e.appearance)||void 0===u?void 0:u.borderColor]),xr({survey:e,setSurveyVisible:p,posthog:n}),!v)return null;const w=()=>{e.schedule!==Nt&&p(!1),se(g.current)||clearTimeout(g.current),g.current=setTimeout(()=>{g.current=void 0,f(!1)},200)};return G(q,{children:["tab"===(null===(l=e.appearance)||void 0===l?void 0:l.widgetType)&&G("button",{className:"ph-survey-widget-tab "+("top"===(null===(a=e.appearance)||void 0===a?void 0:a.tabPosition)?"widget-tab-top":""),onClick:b,disabled:r,style:Sr(null===(c=e.appearance)||void 0===c?void 0:c.tabPosition),children:(null===(d=e.appearance)||void 0===d?void 0:d.widgetLabel)||""}),h&&G(qr,{posthog:n,survey:e,forceDisableHtml:t,style:y,onPopupSurveyDismissed:w,onCloseConfirmationMessage:w,surveyLanguage:o})]})}const Pr=({question:e,forceDisableHtml:t,displayQuestionIndex:n,appearance:r,onSubmit:o,onPreviewSubmit:i,initialValue:s,canGoBack:u,onBack:l})=>{const a={forceDisableHtml:t,appearance:r,onPreviewSubmit(e){i(e)},onSubmit(e){o(e)},initialValue:s,displayQuestionIndex:n,canGoBack:u,onBack:l};switch(e.type){case Pt:return k(rr,Ne(Ne({},a),{},{question:e,key:e.id}));case"link":return k(or,Ne(Ne({},a),{},{question:e,key:e.id}));case Ct:return k(ir,Ne(Ne({},a),{},{question:e,key:e.id}));case It:case $t:return k(ur,Ne(Ne({},a),{},{question:e,key:e.id}));default:return an.error(`Unsupported question type: ${e.type}`),null}};function $r(e){let t=!0;return{dispose(){if(t){t=!1;const n=e();n&&ie(n.then)&&n.then(void 0,()=>{})}}}}const Ir="u">typeof window?window:void 0,Cr="u">typeof globalThis?globalThis:Ir;null!=Cr&&Cr.XMLHttpRequest&&new Cr.XMLHttpRequest;const Mr="undefined"!=typeof globalThis?globalThis:Ir;Mr&&"undefined"==typeof self&&(Mr.self=Mr),Mr&&"undefined"==typeof File&&(Mr.File=function(){});const Nr=null!=Ir?Ir:{};Rt.DEBUG=!1,Rt.LIB_VERSION="1.444.2",Rt.LIB_NAME="web";var Er=Rt;Vt("[AutoCapture]");const Br=(e,t)=>{try{let n;return JSON.stringify(e,(e,t)=>{var r;return function(e){switch({}.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return function(e,t){try{return e instanceof t}catch(e){return!1}}(e,Error)}}(t)?(null!==(r=n)&&void 0!==r||(n=new WeakMap),n.has(t)||n.set(t,function(e){const t=Ne({},e);for(const n of["name","message","stack","cause","errors"])try{n in e&&(t[n]=e[n])}catch(e){}return t}(t)),n.get(t)):"bigint"==typeof t?t.toString():t},t)}catch(t){return function(e){var t;const n=[];return null!==(t=JSON.stringify(e,function(e,t){if("bigint"==typeof t)return t.toString();if("function"!=typeof t&&"symbol"!=typeof t){if(t instanceof Error)return{name:t.name,message:t.message,stack:t.stack};if(t&&"object"==typeof t){for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(n.includes(t))return"[Circular]";n.push(t)}return t}}))&&void 0!==t?t:"null"}(e)}},Dr=function(e,t="&"){let n,r;const o=[];return function(e,t){if(!ae(e))if(oe(e))e.forEach(t);else if((e=>e instanceof FormData)(e))e.forEach((e,n)=>t(e,n));else for(const n in e)ne.call(e,n)&&t(e[n],n)}(e,function(e,t){se(e)||se(t)||"undefined"===t||(n=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),r=encodeURIComponent(t),o[o.length]=r+"="+n)}),o.join(t)};ve(function*(e){const t=yield function(e){return Fe.apply(this,arguments)}(Br(e.data),Er.DEBUG,{rethrow:!0});if(!t)return e;const n=yield t.arrayBuffer();return Ne(Ne({},e),{},{lr:{contentType:"text/plain",body:n,estimatedSize:n.byteLength}})});var jr=class{constructor(e){this._instance=e}initialize(){}get(e){const t=this._instance.persistence;if("string"==typeof e)return null==t?void 0:t.get_property(e);const n={};for(const r of e){const e=null==t?void 0:t.get_property(r);se(e)||(n[r]=e)}return n}set(e,t){var n;null===(n=this._instance.persistence)||void 0===n||n.register("string"==typeof e?{[e]:t}:e)}remove(e){var t;null===(t=this._instance.persistence)||void 0===t||t.unregister(e)}},Fr=class{constructor(e){this.instance=e,this.$=Qt,this.kv=new jr(e),this.onSession=e=>$r(this.instance.onSessionId(t=>{try{e(t)}catch(e){this.$.error("Browser extension session listener failed",e)}})),this.onEvent=e=>$r(this.instance._addCaptureHook((t,n)=>{if(n)try{e({event:t,properties:n.properties})}catch(e){this.$.error("Browser extension event listener failed",e)}})),this.onRemoteConfig=e=>{const t=t=>{try{e(t)}catch(e){this.$.error("Browser extension remote config listener failed",e)}},n=this.instance.ur.on("extensionsRemoteConfig",t);return this.instance.cr&&t(this.instance.cr),$r(n)}}get logger(){return this.$}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return null!==(e=this.instance.get_property("$device_id"))&&void 0!==e?e:this.distinctId}get deviceId(){const e=this.instance.get_property("$device_id");return"string"==typeof e?e:void 0}get library(){return{name:Er.LIB_NAME,version:Er.LIB_VERSION}}get initialPersonProperties(){var e,t;return null!==(e=null===(t=this.instance.persistence)||void 0===t?void 0:t.get_initial_props())&&void 0!==e?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,n,r,o;const i=null===(e=this.instance.sessionManager)||void 0===e?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(t=null==i?void 0:i.sessionId)&&void 0!==t?t:"",windowId:null!==(n=null==i?void 0:i.windowId)&&void 0!==n?n:"",sessionStartTimestamp:null!==(r=null==i?void 0:i.sessionStartTimestamp)&&void 0!==r?r:0,lastActivityTimestamp:null!==(o=null==i?void 0:i.lastActivityTimestamp)&&void 0!==o?o:0}}catch(e){return{sessionId:"",windowId:"",sessionStartTimestamp:0,lastActivityTimestamp:0}}}get isOptedOut(){return this.instance.has_opted_out_capturing()}get canCapture(){return ie(this.instance.is_capturing)?this.instance.is_capturing():!this.isOptedOut}get projectToken(){return this.instance.config.token}getExtension(e){let t;switch(e){case"featureFlags":case K:t=this.instance.featureFlags;break;case"logs":t=this.instance.logs;break;case"surveys":t=this.instance.surveys;break;case"autocapture":t=this.instance.autocapture}return t}capture(e,t,n){if(!n)return void this.instance.capture(e,t);const r=Ne({timestamp:n.timestamp,uuid:n.uuid,$set:n.set,$set_once:n.setOnce},"unload"===n.delivery?{transport:"sendBeacon",send_instantly:!0}:{});this.instance.capture(e,t,r)}registerDynamicEventProperties(e){return $r(this.instance.dr(e))}sendRequest(e){var t=this;return ve(function*(e,n={}){var r;const o=null!==(r=n.target)&&void 0!==r?r:"api",i=n.query?((e,t,n=!0)=>{var r;const[o,i]=e.split("?"),s=Ne({},t),u=null!==(r=null==i?void 0:i.split("&").map(e=>{var t;const[r,o]=e.split("="),i=n&&null!==(t=s[r])&&void 0!==t?t:o;return delete s[r],`${r}=${i}`}))&&void 0!==r?r:[],l=Dr(s);return l&&u.push(l),u.length>0?`${o}?${u.join("&")}`:o})(e,n.query):e,s=t.instance.requestRouter.endpointFor(o,i),u={method:n.method,url:s,data:n.body,headers:n.headers,timeout:n.timeoutMs,fireCallbackOnDrop:!0,transport:n.transport,compression:n.compression,compressionFallback:"flags"===n.target&&"best-available"===n.compression?J.Base64:void 0,timestampMode:n.sentAt};return"api"===o&&"/i/v1/logs"===e&&(u.batchKey="logs"),"sendBeacon"===n.transport?(t.instance._send_request(u),{statusCode:202}):new Promise(e=>{u.callback=e,t.instance._send_request(u)})}).apply(this,arguments)}},Hr=class{constructor(e){this._instance=e}get(){var e,t,n,r;const o=null===(e=this._instance)||void 0===e?void 0:e.config;return{disableSurveys:!!(null==o?void 0:o.disable_surveys),cookielessMode:!!(null==o?void 0:o.cookieless_mode),advancedEnableSurveys:!!(null==o?void 0:o.advanced_enable_surveys),requestTimeoutMs:null!==(t=null==o?void 0:o.surveys_request_timeout_ms)&&void 0!==t?t:1e4,prefillFromUrl:!!(null==o||null===(n=o.surveys)||void 0===n?void 0:n.prefillFromUrl),automaticDisplay:!(null==o?void 0:o.disable_surveys_automatic_display),featureFlagEvaluation:!(null==o?void 0:o.advanced_disable_feature_flags),overrideLanguage:null==o?void 0:o.override_display_language,prepareStylesheet:null==o?void 0:o.prepare_external_dependency_stylesheet,get_current_url:null==o?void 0:o.get_current_url,uiHost:null===(r=this._instance)||void 0===r||null===(r=r.requestRouter)||void 0===r?void 0:r.endpointFor("ui","")}}getExtensions(){const e=null==Nr?void 0:Nr.__PosthogExtensions__;if(!e||!this._instance)return;const t=this._instance,{generateSurveys:n,loadExternalDependency:r}=e;return{generateSurveys:n?e=>n(t,e):void 0,loadExternalDependency:r?e=>r(t,"surveys",e):void 0}}onMatchingConditionsChanged(e){var t,n;const r=null===(t=this._instance)||void 0===t?void 0:t._addCaptureHook(t=>{"$pageview"!==t&&t!==Et&&t!==Bt&&t!==Dt||e()}),o=()=>e();Ut(Ir,"PHSurveyShown",o);let i=!1;const s=null===(n=this._instance)||void 0===n?void 0:n.onFeatureFlags(()=>{i&&e()});return i=!0,()=>{i=!1,null==r||r(),null==s||s(),null==Ir||Ir.removeEventListener("PHSurveyShown",o)}}};const Lr=new WeakMap,zr=(e,t)=>{const n=function(e){var t;const n=new Hr(e);if(!e)return{get config(){return n.get()}};if(null===(t=e.surveys)||void 0===t?void 0:t.getRenderContext)return e.surveys.getRenderContext();let r=Lr.get(e);return r||(r={client:new Fr(e),get config(){return n.get()},surveys:e.surveys},Lr.set(e,r)),r}(e);return n?function(e,t){if(typeof document>"u"||typeof window>"u")return;const n=new wr(e);return!1===e.config.automaticDisplay?(an.info("Surveys automatic display is disabled. Skipping call surveys and evaluate display logic."),n):!1===t?(an.info("There are no surveys to load or Surveys is disabled in the project settings."),n):(n.startAutomaticDisplay(),n)}(n,t):void 0};Nr.__PosthogExtensions__=Nr.__PosthogExtensions__||{},Nr.__PosthogExtensions__.generateSurveys=zr,Nr.extendPostHogWithSurveys=zr,e.default=zr,e.generateSurveys=zr}({});
|
|
2
2
|
//# sourceMappingURL=surveys.js.map
|