posthog-js 1.316.0 → 1.317.0
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.es5.js.map +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/customizations.full.js +1 -1
- package/dist/element-inference.d.ts +21 -0
- package/dist/element-inference.js +2 -0
- package/dist/element-inference.js.map +1 -0
- package/dist/lazy-recorder.js +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/module.d.ts +12 -0
- package/dist/module.full.d.ts +12 -0
- package/dist/module.full.js +1 -1
- package/dist/module.full.js.map +1 -1
- package/dist/module.full.no-external.d.ts +12 -0
- 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.js.map +1 -1
- package/dist/module.no-external.d.ts +12 -0
- package/dist/module.no-external.js +1 -1
- package/dist/module.no-external.js.map +1 -1
- package/dist/posthog-recorder.js +1 -1
- package/dist/product-tours-preview.d.ts +12 -0
- package/dist/product-tours-preview.js +1 -1
- package/dist/product-tours-preview.js.map +1 -1
- package/dist/product-tours.js +1 -1
- package/dist/product-tours.js.map +1 -1
- package/dist/src/entrypoints/element-inference.es.d.ts +1 -0
- package/dist/src/entrypoints/product-tours.d.ts +2 -0
- package/dist/src/extensions/product-tours/element-inference.d.ts +30 -0
- package/dist/src/extensions/product-tours/index.d.ts +2 -0
- package/dist/src/extensions/product-tours/product-tours-utils.d.ts +2 -1
- package/dist/src/extensions/surveys.d.ts +2 -2
- package/dist/src/posthog-product-tours-types.d.ts +7 -0
- package/dist/src/utils/survey-branching.d.ts +11 -0
- package/dist/src/utils/survey-url-prefill.d.ts +7 -5
- package/dist/surveys-preview.d.ts +18 -1
- package/dist/surveys-preview.js +1 -1
- package/dist/surveys-preview.js.map +1 -1
- package/dist/surveys.js +1 -1
- package/dist/surveys.js.map +1 -1
- package/lib/package.json +5 -1
- package/lib/src/entrypoints/element-inference.es.d.ts +1 -0
- package/lib/src/entrypoints/element-inference.es.js +8 -0
- package/lib/src/entrypoints/element-inference.es.js.map +1 -0
- package/lib/src/entrypoints/product-tours.d.ts +2 -0
- package/lib/src/entrypoints/product-tours.js +5 -0
- package/lib/src/entrypoints/product-tours.js.map +1 -1
- package/lib/src/extensions/product-tours/components/ProductTourTooltip.js +5 -2
- package/lib/src/extensions/product-tours/components/ProductTourTooltip.js.map +1 -1
- package/lib/src/extensions/product-tours/components/ProductTourTooltipInner.js +1 -1
- package/lib/src/extensions/product-tours/components/ProductTourTooltipInner.js.map +1 -1
- package/lib/src/extensions/product-tours/element-inference.d.ts +30 -0
- package/lib/src/extensions/product-tours/element-inference.js +296 -0
- package/lib/src/extensions/product-tours/element-inference.js.map +1 -0
- package/lib/src/extensions/product-tours/index.d.ts +2 -0
- package/lib/src/extensions/product-tours/index.js +4 -1
- package/lib/src/extensions/product-tours/index.js.map +1 -1
- package/lib/src/extensions/product-tours/preview.js +1 -1
- package/lib/src/extensions/product-tours/preview.js.map +1 -1
- package/lib/src/extensions/product-tours/product-tours-utils.d.ts +2 -1
- package/lib/src/extensions/product-tours/product-tours-utils.js +12 -0
- package/lib/src/extensions/product-tours/product-tours-utils.js.map +1 -1
- package/lib/src/extensions/product-tours/product-tours.js +15 -31
- package/lib/src/extensions/product-tours/product-tours.js.map +1 -1
- package/lib/src/extensions/surveys.d.ts +2 -2
- package/lib/src/extensions/surveys.js +5 -94
- package/lib/src/extensions/surveys.js.map +1 -1
- package/lib/src/posthog-product-tours-types.d.ts +7 -0
- package/lib/src/posthog-product-tours-types.js.map +1 -1
- package/lib/src/utils/survey-branching.d.ts +11 -0
- package/lib/src/utils/survey-branching.js +106 -0
- package/lib/src/utils/survey-branching.js.map +1 -0
- package/lib/src/utils/survey-url-prefill.d.ts +7 -5
- package/lib/src/utils/survey-url-prefill.js +30 -18
- package/lib/src/utils/survey-url-prefill.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-tours-preview.js","sources":["../../../node_modules/.pnpm/preact@10.19.3/node_modules/preact/dist/preact.module.js","../src/utils/globals.ts","../../../node_modules/.pnpm/preact@10.19.3/node_modules/preact/hooks/dist/hooks.module.js","../src/extensions/surveys/icons.tsx","../src/extensions/product-tours/components/ProductTourSurveyStepInner.tsx","../src/posthog-product-tours-types.ts","../src/utils/logger.ts","../../core/dist/utils/type-utils.mjs","../src/extensions/utils/stylesheet-loader.ts","../src/utils/survey-utils.ts","../src/request.ts","../src/extensions/surveys/surveys-extension-utils.tsx","../src/extensions/product-tours/product-tours-utils.ts","../src/extensions/product-tours/components/ProductTourTooltipInner.tsx","../src/extensions/product-tours/preview.tsx"],"sourcesContent":["var n,l,u,t,i,o,r,f,e,c={},s=[],a=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,h=Array.isArray;function v(n,l){for(var u in l)n[u]=l[u];return n}function p(n){var l=n.parentNode;l&&l.removeChild(n)}function y(l,u,t){var i,o,r,f={};for(r in u)\"key\"==r?i=u[r]:\"ref\"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):t),\"function\"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return d(l,f,i,o,null)}function d(n,t,i,o,r){var f={type:n,props:t,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==r?++u:r,__i:-1,__u:0};return null==r&&null!=l.vnode&&l.vnode(f),f}function _(){return{current:null}}function g(n){return n.children}function b(n,l){this.props=n,this.context=l}function m(n,l){if(null==l)return n.__?m(n.__,n.__i+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return\"function\"==typeof n.type?m(n):null}function k(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return k(n)}}function w(n){(!n.__d&&(n.__d=!0)&&i.push(n)&&!x.__r++||o!==l.debounceRendering)&&((o=l.debounceRendering)||r)(x)}function x(){var n,u,t,o,r,e,c,s,a;for(i.sort(f);n=i.shift();)n.__d&&(u=i.length,o=void 0,e=(r=(t=n).__v).__e,s=[],a=[],(c=t.__P)&&((o=v({},r)).__v=r.__v+1,l.vnode&&l.vnode(o),L(c,o,r,t.__n,void 0!==c.ownerSVGElement,32&r.__u?[e]:null,s,null==e?m(r):e,!!(32&r.__u),a),o.__.__k[o.__i]=o,M(s,o,a),o.__e!=e&&k(o)),i.length>u&&i.sort(f));x.__r=0}function C(n,l,u,t,i,o,r,f,e,a,h){var v,p,y,d,_,g=t&&t.__k||s,b=l.length;for(u.__d=e,P(u,l,g),e=u.__d,v=0;v<b;v++)null!=(y=u.__k[v])&&\"boolean\"!=typeof y&&\"function\"!=typeof y&&(p=-1===y.__i?c:g[y.__i]||c,y.__i=v,L(n,y,p,i,o,r,f,e,a,h),d=y.__e,y.ref&&p.ref!=y.ref&&(p.ref&&z(p.ref,null,y),h.push(y.ref,y.__c||d,y)),null==_&&null!=d&&(_=d),65536&y.__u||p.__k===y.__k?e=S(y,e,n):\"function\"==typeof y.type&&void 0!==y.__d?e=y.__d:d&&(e=d.nextSibling),y.__d=void 0,y.__u&=-196609);u.__d=e,u.__e=_}function P(n,l,u){var t,i,o,r,f,e=l.length,c=u.length,s=c,a=0;for(n.__k=[],t=0;t<e;t++)null!=(i=n.__k[t]=null==(i=l[t])||\"boolean\"==typeof i||\"function\"==typeof i?null:\"string\"==typeof i||\"number\"==typeof i||\"bigint\"==typeof i||i.constructor==String?d(null,i,null,null,i):h(i)?d(g,{children:i},null,null,null):void 0===i.constructor&&i.__b>0?d(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i)?(i.__=n,i.__b=n.__b+1,f=H(i,u,r=t+a,s),i.__i=f,o=null,-1!==f&&(s--,(o=u[f])&&(o.__u|=131072)),null==o||null===o.__v?(-1==f&&a--,\"function\"!=typeof i.type&&(i.__u|=65536)):f!==r&&(f===r+1?a++:f>r?s>e-r?a+=f-r:a--:a=f<r&&f==r-1?f-r:0,f!==t+a&&(i.__u|=65536))):(o=u[t])&&null==o.key&&o.__e&&(o.__e==n.__d&&(n.__d=m(o)),N(o,o,!1),u[t]=null,s--);if(s)for(t=0;t<c;t++)null!=(o=u[t])&&0==(131072&o.__u)&&(o.__e==n.__d&&(n.__d=m(o)),N(o,o))}function S(n,l,u){var t,i;if(\"function\"==typeof n.type){for(t=n.__k,i=0;t&&i<t.length;i++)t[i]&&(t[i].__=n,l=S(t[i],l,u));return l}return n.__e!=l&&(u.insertBefore(n.__e,l||null),l=n.__e),l&&l.nextSibling}function $(n,l){return l=l||[],null==n||\"boolean\"==typeof n||(h(n)?n.some(function(n){$(n,l)}):l.push(n)),l}function H(n,l,u,t){var i=n.key,o=n.type,r=u-1,f=u+1,e=l[u];if(null===e||e&&i==e.key&&o===e.type)return u;if(t>(null!=e&&0==(131072&e.__u)?1:0))for(;r>=0||f<l.length;){if(r>=0){if((e=l[r])&&0==(131072&e.__u)&&i==e.key&&o===e.type)return r;r--}if(f<l.length){if((e=l[f])&&0==(131072&e.__u)&&i==e.key&&o===e.type)return f;f++}}return-1}function I(n,l,u){\"-\"===l[0]?n.setProperty(l,null==u?\"\":u):n[l]=null==u?\"\":\"number\"!=typeof u||a.test(l)?u:u+\"px\"}function T(n,l,u,t,i){var o;n:if(\"style\"===l)if(\"string\"==typeof u)n.style.cssText=u;else{if(\"string\"==typeof t&&(n.style.cssText=t=\"\"),t)for(l in t)u&&l in u||I(n.style,l,\"\");if(u)for(l in u)t&&u[l]===t[l]||I(n.style,l,u[l])}else if(\"o\"===l[0]&&\"n\"===l[1])o=l!==(l=l.replace(/(PointerCapture)$|Capture$/,\"$1\")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?t?u.u=t.u:(u.u=Date.now(),n.addEventListener(l,o?D:A,o)):n.removeEventListener(l,o?D:A,o);else{if(i)l=l.replace(/xlink(H|:h)/,\"h\").replace(/sName$/,\"s\");else if(\"width\"!==l&&\"height\"!==l&&\"href\"!==l&&\"list\"!==l&&\"form\"!==l&&\"tabIndex\"!==l&&\"download\"!==l&&\"rowSpan\"!==l&&\"colSpan\"!==l&&\"role\"!==l&&l in n)try{n[l]=null==u?\"\":u;break n}catch(n){}\"function\"==typeof u||(null==u||!1===u&&\"-\"!==l[4]?n.removeAttribute(l):n.setAttribute(l,u))}}function A(n){var u=this.l[n.type+!1];if(n.t){if(n.t<=u.u)return}else n.t=Date.now();return u(l.event?l.event(n):n)}function D(n){return this.l[n.type+!0](l.event?l.event(n):n)}function L(n,u,t,i,o,r,f,e,c,s){var a,p,y,d,_,m,k,w,x,P,S,$,H,I,T,A=u.type;if(void 0!==u.constructor)return null;128&t.__u&&(c=!!(32&t.__u),r=[e=u.__e=t.__e]),(a=l.__b)&&a(u);n:if(\"function\"==typeof A)try{if(w=u.props,x=(a=A.contextType)&&i[a.__c],P=a?x?x.props.value:a.__:i,t.__c?k=(p=u.__c=t.__c).__=p.__E:(\"prototype\"in A&&A.prototype.render?u.__c=p=new A(w,P):(u.__c=p=new b(w,P),p.constructor=A,p.render=O),x&&x.sub(p),p.props=w,p.state||(p.state={}),p.context=P,p.__n=i,y=p.__d=!0,p.__h=[],p._sb=[]),null==p.__s&&(p.__s=p.state),null!=A.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=v({},p.__s)),v(p.__s,A.getDerivedStateFromProps(w,p.__s))),d=p.props,_=p.state,p.__v=u,y)null==A.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(null==A.getDerivedStateFromProps&&w!==d&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(w,P),!p.__e&&(null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(w,p.__s,P)||u.__v===t.__v)){for(u.__v!==t.__v&&(p.props=w,p.state=p.__s,p.__d=!1),u.__e=t.__e,u.__k=t.__k,u.__k.forEach(function(n){n&&(n.__=u)}),S=0;S<p._sb.length;S++)p.__h.push(p._sb[S]);p._sb=[],p.__h.length&&f.push(p);break n}null!=p.componentWillUpdate&&p.componentWillUpdate(w,p.__s,P),null!=p.componentDidUpdate&&p.__h.push(function(){p.componentDidUpdate(d,_,m)})}if(p.context=P,p.props=w,p.__P=n,p.__e=!1,$=l.__r,H=0,\"prototype\"in A&&A.prototype.render){for(p.state=p.__s,p.__d=!1,$&&$(u),a=p.render(p.props,p.state,p.context),I=0;I<p._sb.length;I++)p.__h.push(p._sb[I]);p._sb=[]}else do{p.__d=!1,$&&$(u),a=p.render(p.props,p.state,p.context),p.state=p.__s}while(p.__d&&++H<25);p.state=p.__s,null!=p.getChildContext&&(i=v(v({},i),p.getChildContext())),y||null==p.getSnapshotBeforeUpdate||(m=p.getSnapshotBeforeUpdate(d,_)),C(n,h(T=null!=a&&a.type===g&&null==a.key?a.props.children:a)?T:[T],u,t,i,o,r,f,e,c,s),p.base=u.__e,u.__u&=-161,p.__h.length&&f.push(p),k&&(p.__E=p.__=null)}catch(n){u.__v=null,c||null!=r?(u.__e=e,u.__u|=c?160:32,r[r.indexOf(e)]=null):(u.__e=t.__e,u.__k=t.__k),l.__e(n,u,t)}else null==r&&u.__v===t.__v?(u.__k=t.__k,u.__e=t.__e):u.__e=j(t.__e,u,t,i,o,r,f,c,s);(a=l.diffed)&&a(u)}function M(n,u,t){u.__d=void 0;for(var i=0;i<t.length;i++)z(t[i],t[++i],t[++i]);l.__c&&l.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u)})}catch(n){l.__e(n,u.__v)}})}function j(l,u,t,i,o,r,f,e,s){var a,v,y,d,_,g,b,k=t.props,w=u.props,x=u.type;if(\"svg\"===x&&(o=!0),null!=r)for(a=0;a<r.length;a++)if((_=r[a])&&\"setAttribute\"in _==!!x&&(x?_.localName===x:3===_.nodeType)){l=_,r[a]=null;break}if(null==l){if(null===x)return document.createTextNode(w);l=o?document.createElementNS(\"http://www.w3.org/2000/svg\",x):document.createElement(x,w.is&&w),r=null,e=!1}if(null===x)k===w||e&&l.data===w||(l.data=w);else{if(r=r&&n.call(l.childNodes),k=t.props||c,!e&&null!=r)for(k={},a=0;a<l.attributes.length;a++)k[(_=l.attributes[a]).name]=_.value;for(a in k)_=k[a],\"children\"==a||(\"dangerouslySetInnerHTML\"==a?y=_:\"key\"===a||a in w||T(l,a,null,_,o));for(a in w)_=w[a],\"children\"==a?d=_:\"dangerouslySetInnerHTML\"==a?v=_:\"value\"==a?g=_:\"checked\"==a?b=_:\"key\"===a||e&&\"function\"!=typeof _||k[a]===_||T(l,a,_,k[a],o);if(v)e||y&&(v.__html===y.__html||v.__html===l.innerHTML)||(l.innerHTML=v.__html),u.__k=[];else if(y&&(l.innerHTML=\"\"),C(l,h(d)?d:[d],u,t,i,o&&\"foreignObject\"!==x,r,f,r?r[0]:t.__k&&m(t,0),e,s),null!=r)for(a=r.length;a--;)null!=r[a]&&p(r[a]);e||(a=\"value\",void 0!==g&&(g!==l[a]||\"progress\"===x&&!g||\"option\"===x&&g!==k[a])&&T(l,a,g,k[a],!1),a=\"checked\",void 0!==b&&b!==l[a]&&T(l,a,b,k[a],!1))}return l}function z(n,u,t){try{\"function\"==typeof n?n(u):n.current=u}catch(n){l.__e(n,t)}}function N(n,u,t){var i,o;if(l.unmount&&l.unmount(n),(i=n.ref)&&(i.current&&i.current!==n.__e||z(i,null,u)),null!=(i=n.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(n){l.__e(n,u)}i.base=i.__P=null,n.__c=void 0}if(i=n.__k)for(o=0;o<i.length;o++)i[o]&&N(i[o],u,t||\"function\"!=typeof n.type);t||null==n.__e||p(n.__e),n.__=n.__e=n.__d=void 0}function O(n,l,u){return this.constructor(n,u)}function q(u,t,i){var o,r,f,e;l.__&&l.__(u,t),r=(o=\"function\"==typeof i)?null:i&&i.__k||t.__k,f=[],e=[],L(t,u=(!o&&i||t).__k=y(g,null,[u]),r||c,c,void 0!==t.ownerSVGElement,!o&&i?[i]:r?null:t.firstChild?n.call(t.childNodes):null,f,!o&&i?i:r?r.__e:t.firstChild,o,e),M(f,u,e)}function B(n,l){q(n,l,B)}function E(l,u,t){var i,o,r,f,e=v({},l.props);for(r in l.type&&l.type.defaultProps&&(f=l.type.defaultProps),u)\"key\"==r?i=u[r]:\"ref\"==r?o=u[r]:e[r]=void 0===u[r]&&void 0!==f?f[r]:u[r];return arguments.length>2&&(e.children=arguments.length>3?n.call(arguments,2):t),d(l.type,e,i||l.key,o||l.ref,null)}function F(n,l){var u={__c:l=\"__cC\"+e++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n){var u,t;return this.getChildContext||(u=[],(t={})[l]=this,this.getChildContext=function(){return t},this.shouldComponentUpdate=function(n){this.props.value!==n.value&&u.some(function(n){n.__e=!0,w(n)})},this.sub=function(n){u.push(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u.splice(u.indexOf(n),1),l&&l.call(n)}}),n.children}};return u.Provider.__=u.Consumer.contextType=u}n=s.slice,l={__e:function(n,l,u,t){for(var i,o,r;l=l.__;)if((i=l.__c)&&!i.__)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(n)),r=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(n,t||{}),r=i.__d),r)return i.__E=i}catch(l){n=l}throw n}},u=0,t=function(n){return null!=n&&null==n.constructor},b.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=v({},this.state),\"function\"==typeof n&&(n=n(v({},u),this.props)),n&&v(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),w(this))},b.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),w(this))},b.prototype.render=g,i=[],r=\"function\"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,f=function(n,l){return n.__v.__b-l.__v.__b},x.__r=0,e=0;export{b as Component,g as Fragment,E as cloneElement,F as createContext,y as createElement,_ as createRef,y as h,B as hydrate,t as isValidElement,l as options,q as render,$ as toChildArray};\n//# sourceMappingURL=preact.module.js.map\n","import type { PostHog } from '../posthog-core'\nimport { SessionIdManager } from '../sessionid'\nimport {\n DeadClicksAutoCaptureConfig,\n ExternalIntegrationKind,\n Properties,\n RemoteConfig,\n SiteAppLoader,\n SessionStartReason,\n} from '../types'\nimport type {\n ConversationsRemoteConfig,\n GetMessagesResponse,\n GetTicketsOptions,\n GetTicketsResponse,\n MarkAsReadResponse,\n SendMessageResponse,\n UserProvidedTraits,\n} from '../posthog-conversations-types'\n// only importing types here, so won't affect the bundle\n// eslint-disable-next-line posthog-js/no-external-replay-imports\nimport type { SessionRecordingStatus, TriggerType } from '../extensions/replay/external/triggerMatching'\nimport { eventWithTime } from '../extensions/replay/types/rrweb-types'\nimport { ErrorTracking } from '@posthog/core'\n\n/*\n * Global helpers to protect access to browser globals in a way that is safer for different targets\n * like DOM, SSR, Web workers etc.\n *\n * NOTE: Typically we want the \"window\" but globalThis works for both the typical browser context as\n * well as other contexts such as the web worker context. Window is still exported for any bits that explicitly require it.\n * If in doubt - export the global you need from this file and use that as an optional value. This way the code path is forced\n * to handle the case where the global is not available.\n */\n\n// eslint-disable-next-line no-restricted-globals\nconst win: (Window & typeof globalThis) | undefined = typeof window !== 'undefined' ? window : undefined\n\nexport type AssignableWindow = Window &\n typeof globalThis & {\n /*\n * Main PostHog instance\n */\n posthog: any\n\n /*\n * This is our contract between (potentially) lazily loaded extensions and the SDK\n */\n __PosthogExtensions__?: PostHogExtensions\n\n /**\n * When loading remote config, we assign it to this global configuration\n * for ease of sharing it with the rest of the SDK\n */\n _POSTHOG_REMOTE_CONFIG?: Record<\n string,\n {\n config: RemoteConfig\n siteApps: SiteAppLoader[]\n }\n >\n\n /**\n * If this is set on the window, our logger will log to the console\n * for ease of debugging. Used for testing purposes only.\n *\n * @see {Config.DEBUG} from config.ts\n */\n POSTHOG_DEBUG: any\n\n // Exposed by the browser\n doNotTrack: any\n\n // See entrypoints/customizations.full.ts\n posthogCustomizations: any\n\n /**\n * This is a legacy way to expose these functions, but we still need to support it for backwards compatibility\n * Can be removed once we drop support for 1.161.1\n *\n * See entrypoints/exception-autocapture.ts\n *\n * @deprecated use `__PosthogExtensions__.errorWrappingFunctions` instead\n */\n posthogErrorWrappingFunctions: any\n\n /**\n * This is a legacy way to expose these functions, but we still need to support it for backwards compatibility\n * Can be removed once we drop support for 1.161.1\n *\n * See entrypoints/posthog-recorder.ts\n *\n * @deprecated use `__PosthogExtensions__.rrweb` instead\n */\n rrweb: any\n\n /**\n * This is a legacy way to expose these functions, but we still need to support it for backwards compatibility\n * Can be removed once we drop support for 1.161.1\n *\n * See entrypoints/posthog-recorder.ts\n *\n * @deprecated use `__PosthogExtensions__.rrwebConsoleRecord` instead\n */\n rrwebConsoleRecord: any\n\n /**\n * This is a legacy way to expose these functions, but we still need to support it for backwards compatibility\n * Can be removed once we drop support for 1.161.1\n *\n * See entrypoints/posthog-recorder.ts\n *\n * @deprecated use `__PosthogExtensions__.getRecordNetworkPlugin` instead\n */\n getRecordNetworkPlugin: any\n\n /**\n * This is a legacy way to expose these functions, but we still need to support it for backwards compatibility\n * Can be removed once we drop support for 1.161.1\n *\n * See entrypoints/web-vitals.ts\n *\n * @deprecated use `__PosthogExtensions__.postHogWebVitalsCallbacks` instead\n */\n postHogWebVitalsCallbacks: any\n\n /**\n * This is a legacy way to expose these functions, but we still need to support it for backwards compatibility\n * Can be removed once we drop support for 1.161.1\n *\n * See entrypoints/tracing-headers.ts\n *\n * @deprecated use `__PosthogExtensions__.postHogTracingHeadersPatchFns` instead\n */\n postHogTracingHeadersPatchFns: any\n\n /**\n * This is a legacy way to expose these functions, but we still need to support it for backwards compatibility\n * Can be removed once we drop support for 1.161.1\n *\n * See entrypoints/surveys.ts\n *\n * @deprecated use `__PosthogExtensions__.generateSurveys` instead\n */\n extendPostHogWithSurveys: any\n\n /*\n * These are used to handle our toolbar state.\n * @see {Toolbar} from extensions/toolbar.ts\n */\n ph_load_toolbar: any\n ph_load_editor: any\n ph_toolbar_state: any\n } & Record<`__$$ph_site_app_${string}`, any>\n\n/**\n * This is our contract between (potentially) lazily loaded extensions and the SDK\n * changes to this interface can be breaking changes for users of the SDK\n */\n\nexport type ExternalExtensionKind = 'intercom-integration' | 'crisp-chat-integration'\n\nexport type PostHogExtensionKind =\n | 'toolbar'\n | 'exception-autocapture'\n | 'web-vitals'\n | 'recorder'\n | 'lazy-recorder'\n | 'tracing-headers'\n | 'surveys'\n | 'conversations'\n | 'product-tours'\n | 'dead-clicks-autocapture'\n | 'remote-config'\n | ExternalExtensionKind\n\nexport interface LazyLoadedSessionRecordingInterface {\n start: (startReason?: SessionStartReason) => void\n stop: () => void\n sessionId: string\n status: SessionRecordingStatus\n onRRwebEmit: (rawEvent: eventWithTime) => void\n log: (message: string, level: 'log' | 'warn' | 'error') => void\n sdkDebugProperties: Properties\n overrideLinkedFlag: () => void\n overrideSampling: () => void\n overrideTrigger: (triggerType: TriggerType) => void\n isStarted: boolean\n tryAddCustomEvent(tag: string, payload: any): boolean\n}\n\nexport interface LazyLoadedDeadClicksAutocaptureInterface {\n start: (observerTarget: Node) => void\n stop: () => void\n}\n\nexport interface LazyLoadedConversationsInterface {\n // Widget control\n show: () => void\n hide: () => void\n isVisible: () => boolean\n\n // Lifecycle\n reset: () => void\n\n // API methods\n sendMessage: (message: string, userTraits?: UserProvidedTraits, newTicket?: boolean) => Promise<SendMessageResponse>\n getMessages: (ticketId?: string, after?: string) => Promise<GetMessagesResponse>\n markAsRead: (ticketId?: string) => Promise<MarkAsReadResponse>\n getTickets: (options?: GetTicketsOptions) => Promise<GetTicketsResponse>\n getCurrentTicketId: () => string | null\n getWidgetSessionId: () => string\n}\n\ninterface PostHogExtensions {\n loadExternalDependency?: (\n posthog: PostHog,\n kind: PostHogExtensionKind,\n callback: (error?: string | Event, event?: Event) => void\n ) => void\n\n loadSiteApp?: (posthog: PostHog, appUrl: string, callback: (error?: string | Event, event?: Event) => void) => void\n\n errorWrappingFunctions?: {\n wrapOnError: (captureFn: (props: ErrorTracking.ErrorProperties) => void) => () => void\n wrapUnhandledRejection: (captureFn: (props: ErrorTracking.ErrorProperties) => void) => () => void\n wrapConsoleError: (captureFn: (props: ErrorTracking.ErrorProperties) => void) => () => void\n }\n rrweb?: { record: any; version: string }\n rrwebPlugins?: { getRecordConsolePlugin: any; getRecordNetworkPlugin?: any }\n generateSurveys?: (posthog: PostHog, isSurveysEnabled: boolean) => any | undefined\n generateProductTours?: (posthog: PostHog, isEnabled: boolean) => any | undefined\n postHogWebVitalsCallbacks?: {\n onLCP: (metric: any) => void\n onCLS: (metric: any) => void\n onFCP: (metric: any) => void\n onINP: (metric: any) => void\n }\n tracingHeadersPatchFns?: {\n _patchFetch: (hostnames: string[], distinctId: string, sessionManager?: SessionIdManager) => () => void\n _patchXHR: (hostnames: string[], distinctId: string, sessionManager?: SessionIdManager) => () => void\n }\n initDeadClicksAutocapture?: (\n ph: PostHog,\n config: DeadClicksAutoCaptureConfig\n ) => LazyLoadedDeadClicksAutocaptureInterface\n integrations?: {\n [K in ExternalIntegrationKind]?: { start: (posthog: PostHog) => void; stop: () => void }\n }\n initSessionRecording?: (ph: PostHog) => LazyLoadedSessionRecordingInterface\n initConversations?: (config: ConversationsRemoteConfig, posthog: PostHog) => LazyLoadedConversationsInterface\n}\n\nconst global: typeof globalThis | undefined = typeof globalThis !== 'undefined' ? globalThis : win\n\n// React Native polyfills for posthog-js compatibility\nif (typeof self === 'undefined') {\n ;(global as any).self = global\n}\nif (typeof File === 'undefined') {\n ;(global as any).File = function () {}\n}\n\nexport const ArrayProto = Array.prototype\nexport const nativeForEach = ArrayProto.forEach\nexport const nativeIndexOf = ArrayProto.indexOf\n\nexport const navigator = global?.navigator\nexport const document = global?.document\nexport const location = global?.location\nexport const fetch = global?.fetch\nexport const XMLHttpRequest =\n global?.XMLHttpRequest && 'withCredentials' in new global.XMLHttpRequest() ? global.XMLHttpRequest : undefined\nexport const AbortController = global?.AbortController\nexport const userAgent = navigator?.userAgent\nexport const assignableWindow: AssignableWindow = win ?? ({} as any)\n\nexport { win as window }\n","import{options as n}from\"preact\";var t,r,u,i,o=0,f=[],c=[],e=n.__b,a=n.__r,v=n.diffed,l=n.__c,m=n.unmount;function d(t,u){n.__h&&n.__h(r,t,o||u),o=0;var i=r.__H||(r.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({__V:c}),i.__[t]}function h(n){return o=1,s(B,n)}function s(n,u,i){var o=d(t++,2);if(o.t=n,!o.__c&&(o.__=[i?i(u):B(void 0,u),function(n){var t=o.__N?o.__N[0]:o.__[0],r=o.t(t,n);t!==r&&(o.__N=[r,o.__[1]],o.__c.setState({}))}],o.__c=r,!r.u)){var f=function(n,t,r){if(!o.__c.__H)return!0;var u=o.__c.__H.__.filter(function(n){return n.__c});if(u.every(function(n){return!n.__N}))return!c||c.call(this,n,t,r);var i=!1;return u.forEach(function(n){if(n.__N){var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(i=!0)}}),!(!i&&o.__c.props===n)&&(!c||c.call(this,n,t,r))};r.u=!0;var c=r.shouldComponentUpdate,e=r.componentWillUpdate;r.componentWillUpdate=function(n,t,r){if(this.__e){var u=c;c=void 0,f(n,t,r),c=u}e&&e.call(this,n,t,r)},r.shouldComponentUpdate=f}return o.__N||o.__}function p(u,i){var o=d(t++,3);!n.__s&&z(o.__H,i)&&(o.__=u,o.i=i,r.__H.__h.push(o))}function y(u,i){var o=d(t++,4);!n.__s&&z(o.__H,i)&&(o.__=u,o.i=i,r.__h.push(o))}function _(n){return o=5,F(function(){return{current:n}},[])}function A(n,t,r){o=6,y(function(){return\"function\"==typeof n?(n(t()),function(){return n(null)}):n?(n.current=t(),function(){return n.current=null}):void 0},null==r?r:r.concat(n))}function F(n,r){var u=d(t++,7);return z(u.__H,r)?(u.__V=n(),u.i=r,u.__h=n,u.__V):u.__}function T(n,t){return o=8,F(function(){return n},t)}function q(n){var u=r.context[n.__c],i=d(t++,9);return i.c=n,u?(null==i.__&&(i.__=!0,u.sub(r)),u.props.value):n.__}function x(t,r){n.useDebugValue&&n.useDebugValue(r?r(t):t)}function P(n){var u=d(t++,10),i=h();return u.__=n,r.componentDidCatch||(r.componentDidCatch=function(n,t){u.__&&u.__(n,t),i[1](n)}),[i[0],function(){i[1](void 0)}]}function V(){var n=d(t++,11);if(!n.__){for(var u=r.__v;null!==u&&!u.__m&&null!==u.__;)u=u.__;var i=u.__m||(u.__m=[0,0]);n.__=\"P\"+i[0]+\"-\"+i[1]++}return n.__}function b(){for(var t;t=f.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(k),t.__H.__h.forEach(w),t.__H.__h=[]}catch(r){t.__H.__h=[],n.__e(r,t.__v)}}n.__b=function(n){r=null,e&&e(n)},n.__r=function(n){a&&a(n),t=0;var i=(r=n.__c).__H;i&&(u===r?(i.__h=[],r.__h=[],i.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=c,n.__N=n.i=void 0})):(i.__h.forEach(k),i.__h.forEach(w),i.__h=[],t=0)),u=r},n.diffed=function(t){v&&v(t);var o=t.__c;o&&o.__H&&(o.__H.__h.length&&(1!==f.push(o)&&i===n.requestAnimationFrame||((i=n.requestAnimationFrame)||j)(b)),o.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==c&&(n.__=n.__V),n.i=void 0,n.__V=c})),u=r=null},n.__c=function(t,r){r.some(function(t){try{t.__h.forEach(k),t.__h=t.__h.filter(function(n){return!n.__||w(n)})}catch(u){r.some(function(n){n.__h&&(n.__h=[])}),r=[],n.__e(u,t.__v)}}),l&&l(t,r)},n.unmount=function(t){m&&m(t);var r,u=t.__c;u&&u.__H&&(u.__H.__.forEach(function(n){try{k(n)}catch(n){r=n}}),u.__H=void 0,r&&n.__e(r,u.__v))};var g=\"function\"==typeof requestAnimationFrame;function j(n){var t,r=function(){clearTimeout(u),g&&cancelAnimationFrame(t),setTimeout(n)},u=setTimeout(r,100);g&&(t=requestAnimationFrame(r))}function k(n){var t=r,u=n.__c;\"function\"==typeof u&&(n.__c=void 0,u()),r=t}function w(n){var t=r;n.__c=n.__(),r=t}function z(n,t){return!n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function B(n,t){return\"function\"==typeof t?t(n):t}export{T as useCallback,q as useContext,x as useDebugValue,p as useEffect,P as useErrorBoundary,V as useId,A as useImperativeHandle,y as useLayoutEffect,F as useMemo,s as useReducer,_ as useRef,h as useState};\n//# sourceMappingURL=hooks.module.js.map\n","export const satisfiedEmoji = (\n <svg className=\"emoji-svg\" xmlns=\"http://www.w3.org/2000/svg\" height=\"48\" viewBox=\"0 -960 960 960\" width=\"48\">\n <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\" />\n </svg>\n)\nexport const neutralEmoji = (\n <svg className=\"emoji-svg\" xmlns=\"http://www.w3.org/2000/svg\" height=\"48\" viewBox=\"0 -960 960 960\" width=\"48\">\n <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\" />\n </svg>\n)\nexport const dissatisfiedEmoji = (\n <svg className=\"emoji-svg\" xmlns=\"http://www.w3.org/2000/svg\" height=\"48\" viewBox=\"0 -960 960 960\" width=\"48\">\n <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\" />\n </svg>\n)\nexport const veryDissatisfiedEmoji = (\n <svg className=\"emoji-svg\" xmlns=\"http://www.w3.org/2000/svg\" height=\"48\" viewBox=\"0 -960 960 960\" width=\"48\">\n <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\" />\n </svg>\n)\nexport const verySatisfiedEmoji = (\n <svg className=\"emoji-svg\" xmlns=\"http://www.w3.org/2000/svg\" height=\"48\" viewBox=\"0 -960 960 960\" width=\"48\">\n <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\" />\n </svg>\n)\nexport const cancelSVG = (\n <svg\n width=\"12\"\n height=\"12\"\n viewBox=\"0 0 12 12\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-labelledby=\"close-survey-title\"\n >\n <title id=\"close-survey-title\">Close survey</title>\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n 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\"\n fill=\"black\"\n />\n </svg>\n)\nexport const IconPosthogLogo = (\n <svg width=\"77\" height=\"14\" viewBox=\"0 0 77 14\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <g clip-path=\"url(#clip0_2415_6911)\">\n <mask\n id=\"mask0_2415_6911\"\n style={{ maskType: 'luminance' }}\n maskUnits=\"userSpaceOnUse\"\n x=\"0\"\n y=\"0\"\n width=\"77\"\n height=\"14\"\n >\n <path d=\"M0.5 0H76.5V14H0.5V0Z\" fill=\"white\" />\n </mask>\n <g mask=\"url(#mask0_2415_6911)\">\n <path\n d=\"M5.77226 8.02931C5.59388 8.37329 5.08474 8.37329 4.90634 8.02931L4.4797 7.20672C4.41155 7.07535 4.41155 6.9207 4.4797 6.78933L4.90634 5.96669C5.08474 5.62276 5.59388 5.62276 5.77226 5.96669L6.19893 6.78933C6.26709 6.9207 6.26709 7.07535 6.19893 7.20672L5.77226 8.02931ZM5.77226 12.6946C5.59388 13.0386 5.08474 13.0386 4.90634 12.6946L4.4797 11.872C4.41155 11.7406 4.41155 11.586 4.4797 11.4546L4.90634 10.632C5.08474 10.288 5.59388 10.288 5.77226 10.632L6.19893 11.4546C6.26709 11.586 6.26709 11.7406 6.19893 11.872L5.77226 12.6946Z\"\n fill=\"#1D4AFF\"\n />\n <path\n d=\"M0.5 10.9238C0.5 10.508 1.02142 10.2998 1.32637 10.5938L3.54508 12.7327C3.85003 13.0267 3.63405 13.5294 3.20279 13.5294H0.984076C0.716728 13.5294 0.5 13.3205 0.5 13.0627V10.9238ZM0.5 8.67083C0.5 8.79459 0.551001 8.91331 0.641783 9.00081L5.19753 13.3927C5.28831 13.4802 5.41144 13.5294 5.53982 13.5294H8.0421C8.47337 13.5294 8.68936 13.0267 8.3844 12.7327L1.32637 5.92856C1.02142 5.63456 0.5 5.84278 0.5 6.25854V8.67083ZM0.5 4.00556C0.5 4.12932 0.551001 4.24802 0.641783 4.33554L10.0368 13.3927C10.1276 13.4802 10.2508 13.5294 10.3791 13.5294H12.8814C13.3127 13.5294 13.5287 13.0267 13.2237 12.7327L1.32637 1.26329C1.02142 0.969312 0.5 1.17752 0.5 1.59327V4.00556ZM5.33931 4.00556C5.33931 4.12932 5.39033 4.24802 5.4811 4.33554L14.1916 12.7327C14.4965 13.0267 15.0179 12.8185 15.0179 12.4028V9.99047C15.0179 9.86671 14.9669 9.74799 14.8762 9.66049L6.16568 1.26329C5.86071 0.969307 5.33931 1.17752 5.33931 1.59327V4.00556ZM11.005 1.26329C10.7 0.969307 10.1786 1.17752 10.1786 1.59327V4.00556C10.1786 4.12932 10.2296 4.24802 10.3204 4.33554L14.1916 8.06748C14.4965 8.36148 15.0179 8.15325 15.0179 7.7375V5.3252C15.0179 5.20144 14.9669 5.08272 14.8762 4.99522L11.005 1.26329Z\"\n fill=\"#F9BD2B\"\n />\n <path\n d=\"M21.0852 10.981L16.5288 6.58843C16.2238 6.29443 15.7024 6.50266 15.7024 6.91841V13.0627C15.7024 13.3205 15.9191 13.5294 16.1865 13.5294H23.2446C23.5119 13.5294 23.7287 13.3205 23.7287 13.0627V12.5032C23.7287 12.2455 23.511 12.0396 23.2459 12.0063C22.4323 11.9042 21.6713 11.546 21.0852 10.981ZM18.0252 12.0365C17.5978 12.0365 17.251 11.7021 17.251 11.2901C17.251 10.878 17.5978 10.5436 18.0252 10.5436C18.4527 10.5436 18.7996 10.878 18.7996 11.2901C18.7996 11.7021 18.4527 12.0365 18.0252 12.0365Z\"\n fill=\"currentColor\"\n />\n <path\n d=\"M0.5 13.0627C0.5 13.3205 0.716728 13.5294 0.984076 13.5294H3.20279C3.63405 13.5294 3.85003 13.0267 3.54508 12.7327L1.32637 10.5938C1.02142 10.2998 0.5 10.508 0.5 10.9238V13.0627ZM5.33931 5.13191L1.32637 1.26329C1.02142 0.969306 0.5 1.17752 0.5 1.59327V4.00556C0.5 4.12932 0.551001 4.24802 0.641783 4.33554L5.33931 8.86412V5.13191ZM1.32637 5.92855C1.02142 5.63455 0.5 5.84278 0.5 6.25853V8.67083C0.5 8.79459 0.551001 8.91331 0.641783 9.00081L5.33931 13.5294V9.79717L1.32637 5.92855Z\"\n fill=\"#1D4AFF\"\n />\n <path\n d=\"M10.1787 5.3252C10.1787 5.20144 10.1277 5.08272 10.0369 4.99522L6.16572 1.26329C5.8608 0.969306 5.33936 1.17752 5.33936 1.59327V4.00556C5.33936 4.12932 5.39037 4.24802 5.48114 4.33554L10.1787 8.86412V5.3252ZM5.33936 13.5294H8.04214C8.47341 13.5294 8.6894 13.0267 8.38443 12.7327L5.33936 9.79717V13.5294ZM5.33936 5.13191V8.67083C5.33936 8.79459 5.39037 8.91331 5.48114 9.00081L10.1787 13.5294V9.99047C10.1787 9.86671 10.1277 9.74803 10.0369 9.66049L5.33936 5.13191Z\"\n fill=\"#F54E00\"\n />\n <path\n d=\"M29.375 11.6667H31.3636V8.48772H33.0249C34.8499 8.48772 36.0204 7.4443 36.0204 5.83052C36.0204 4.21681 34.8499 3.17334 33.0249 3.17334H29.375V11.6667ZM31.3636 6.84972V4.81136H32.8236C33.5787 4.81136 34.0318 5.19958 34.0318 5.83052C34.0318 6.4615 33.5787 6.84972 32.8236 6.84972H31.3636ZM39.618 11.7637C41.5563 11.7637 42.9659 10.429 42.9659 8.60905C42.9659 6.78905 41.5563 5.45438 39.618 5.45438C37.6546 5.45438 36.2701 6.78905 36.2701 8.60905C36.2701 10.429 37.6546 11.7637 39.618 11.7637ZM38.1077 8.60905C38.1077 7.63838 38.7118 6.97105 39.618 6.97105C40.5116 6.97105 41.1157 7.63838 41.1157 8.60905C41.1157 9.57972 40.5116 10.2471 39.618 10.2471C38.7118 10.2471 38.1077 9.57972 38.1077 8.60905ZM46.1482 11.7637C47.6333 11.7637 48.6402 10.8658 48.6402 9.81025C48.6402 7.33505 45.2294 8.13585 45.2294 7.16518C45.2294 6.8983 45.5189 6.72843 45.9342 6.72843C46.3622 6.72843 46.8782 6.98318 47.0418 7.54132L48.527 6.94678C48.2375 6.06105 47.1677 5.45438 45.8713 5.45438C44.4743 5.45438 43.6058 6.25518 43.6058 7.21372C43.6058 9.53118 46.9663 8.88812 46.9663 9.84665C46.9663 10.1864 46.6391 10.417 46.1482 10.417C45.4434 10.417 44.9525 9.94376 44.8015 9.3735L43.3164 9.93158C43.6436 10.8537 44.6001 11.7637 46.1482 11.7637ZM53.4241 11.606L53.2982 10.0651C53.0843 10.1743 52.8074 10.2106 52.5808 10.2106C52.1278 10.2106 51.8257 9.89523 51.8257 9.34918V7.03172H53.3612V5.55145H51.8257V3.78001H49.9755V5.55145H48.9687V7.03172H49.9755V9.57972C49.9755 11.06 51.0202 11.7637 52.3921 11.7637C52.7696 11.7637 53.122 11.7031 53.4241 11.606ZM59.8749 3.17334V6.47358H56.376V3.17334H54.3874V11.6667H56.376V8.11158H59.8749V11.6667H61.8761V3.17334H59.8749ZM66.2899 11.7637C68.2281 11.7637 69.6378 10.429 69.6378 8.60905C69.6378 6.78905 68.2281 5.45438 66.2899 5.45438C64.3265 5.45438 62.942 6.78905 62.942 8.60905C62.942 10.429 64.3265 11.7637 66.2899 11.7637ZM64.7796 8.60905C64.7796 7.63838 65.3837 6.97105 66.2899 6.97105C67.1835 6.97105 67.7876 7.63838 67.7876 8.60905C67.7876 9.57972 67.1835 10.2471 66.2899 10.2471C65.3837 10.2471 64.7796 9.57972 64.7796 8.60905ZM73.2088 11.4725C73.901 11.4725 74.5177 11.242 74.845 10.8416V11.424C74.845 12.1034 74.2786 12.5767 73.4102 12.5767C72.7935 12.5767 72.2523 12.2854 72.1642 11.788L70.4776 12.0428C70.7042 13.1955 71.925 13.972 73.4102 13.972C75.361 13.972 76.6574 12.8679 76.6574 11.2298V5.55145H74.8324V6.07318C74.4926 5.69705 73.9136 5.45438 73.171 5.45438C71.409 5.45438 70.3014 6.61918 70.3014 8.46345C70.3014 10.3077 71.409 11.4725 73.2088 11.4725ZM72.1012 8.46345C72.1012 7.55345 72.655 6.97105 73.5109 6.97105C74.3793 6.97105 74.9331 7.55345 74.9331 8.46345C74.9331 9.37345 74.3793 9.95585 73.5109 9.95585C72.655 9.95585 72.1012 9.37345 72.1012 8.46345Z\"\n fill=\"currentColor\"\n />\n </g>\n </g>\n <defs>\n <clipPath id=\"clip0_2415_6911\">\n <rect width=\"76\" height=\"14\" fill=\"white\" transform=\"translate(0.5)\" />\n </clipPath>\n </defs>\n </svg>\n)\nexport const checkSVG = (\n <svg width=\"16\" height=\"12\" viewBox=\"0 0 16 12\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M5.30769 10.6923L4.77736 11.2226C4.91801 11.3633 5.10878 11.4423 5.30769 11.4423C5.5066 11.4423 5.69737 11.3633 5.83802 11.2226L5.30769 10.6923ZM15.5303 1.53033C15.8232 1.23744 15.8232 0.762563 15.5303 0.46967C15.2374 0.176777 14.7626 0.176777 14.4697 0.46967L15.5303 1.53033ZM1.53033 5.85429C1.23744 5.56139 0.762563 5.56139 0.46967 5.85429C0.176777 6.14718 0.176777 6.62205 0.46967 6.91495L1.53033 5.85429ZM5.83802 11.2226L15.5303 1.53033L14.4697 0.46967L4.77736 10.162L5.83802 11.2226ZM0.46967 6.91495L4.77736 11.2226L5.83802 10.162L1.53033 5.85429L0.46967 6.91495Z\"\n fill=\"currentColor\"\n />\n </svg>\n)\n","import { h } from 'preact'\nimport { useState, useRef, useEffect } from 'preact/hooks'\nimport { ProductTourStep, ProductTourAppearance, ProductTourSurveyQuestion } from '../../../posthog-product-tours-types'\nimport { cancelSVG, IconPosthogLogo } from '../../surveys/icons'\nimport {\n dissatisfiedEmoji,\n neutralEmoji,\n satisfiedEmoji,\n veryDissatisfiedEmoji,\n verySatisfiedEmoji,\n} from '../../surveys/icons'\n\nexport interface ProductTourSurveyStepInnerProps {\n step: ProductTourStep\n appearance?: ProductTourAppearance\n stepIndex: number\n totalSteps: number\n onPrevious?: () => void\n onSubmit?: (response: string | number | null) => void\n onDismiss?: () => void\n}\n\nconst threeScaleEmojis = [dissatisfiedEmoji, neutralEmoji, satisfiedEmoji]\nconst fiveScaleEmojis = [veryDissatisfiedEmoji, dissatisfiedEmoji, neutralEmoji, satisfiedEmoji, verySatisfiedEmoji]\n\nfunction getScaleNumbers(scale: number): number[] {\n switch (scale) {\n case 5:\n return [1, 2, 3, 4, 5]\n case 10:\n return [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n default:\n return [1, 2, 3, 4, 5]\n }\n}\n\nfunction OpenTextInput({\n value,\n onChange,\n onSubmit,\n isInteractive,\n}: {\n value: string\n onChange: (text: string) => void\n onSubmit?: () => void\n isInteractive: boolean\n}): h.JSX.Element {\n const inputRef = useRef<HTMLTextAreaElement>(null)\n\n useEffect(() => {\n if (isInteractive) {\n setTimeout(() => inputRef.current?.focus(), 100)\n }\n }, [isInteractive])\n\n const handleKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Enter' && e.metaKey && isInteractive) {\n e.preventDefault()\n onSubmit?.()\n }\n }\n\n return (\n <textarea\n ref={inputRef}\n class=\"ph-tour-survey-textarea\"\n rows={3}\n placeholder=\"Your feedback (optional)...\"\n value={value}\n onInput={(e) => onChange((e.target as HTMLTextAreaElement).value)}\n onKeyDown={handleKeyDown}\n disabled={!isInteractive}\n style={isInteractive ? undefined : { cursor: 'default' }}\n />\n )\n}\n\nfunction RatingInput({\n survey,\n onSubmit,\n isInteractive,\n}: {\n survey: ProductTourSurveyQuestion\n onSubmit?: (rating: number) => void\n isInteractive: boolean\n}): h.JSX.Element {\n const [selectedRating, setSelectedRating] = useState<number | null>(null)\n const display = survey.display || 'emoji'\n const scale = survey.scale || 5\n\n const handleSelect = (rating: number) => {\n if (!isInteractive) {\n return\n }\n setSelectedRating(rating)\n // Auto-submit on selection for ratings\n onSubmit?.(rating)\n }\n\n if (display === 'emoji') {\n const emojis = scale === 3 ? threeScaleEmojis : fiveScaleEmojis\n return (\n <div class=\"ph-tour-survey-rating-container\">\n <div class=\"ph-tour-survey-rating-emoji\">\n {emojis.map((emoji, idx) => {\n const rating = idx + 1\n const isActive = selectedRating === rating\n return (\n <button\n key={idx}\n type=\"button\"\n class={`ph-tour-survey-emoji-button ${isActive ? 'ph-tour-survey-emoji-button--active' : ''}`}\n onClick={() => handleSelect(rating)}\n style={isInteractive ? undefined : { cursor: 'default' }}\n aria-label={`Rate ${rating}`}\n >\n {emoji}\n </button>\n )\n })}\n </div>\n {(survey.lowerBoundLabel || survey.upperBoundLabel) && (\n <div class=\"ph-tour-survey-rating-labels\">\n <span>{survey.lowerBoundLabel}</span>\n <span>{survey.upperBoundLabel}</span>\n </div>\n )}\n </div>\n )\n }\n\n // Number display\n const numbers = getScaleNumbers(scale)\n return (\n <div class=\"ph-tour-survey-rating-container\">\n <div\n class=\"ph-tour-survey-rating-numbers\"\n style={{ gridTemplateColumns: `repeat(${numbers.length}, minmax(0, 1fr))` }}\n >\n {numbers.map((num) => {\n const isActive = selectedRating === num\n return (\n <button\n key={num}\n type=\"button\"\n class={`ph-tour-survey-number-button ${isActive ? 'ph-tour-survey-number-button--active' : ''}`}\n onClick={() => handleSelect(num)}\n style={isInteractive ? undefined : { cursor: 'default' }}\n aria-label={`Rate ${num}`}\n >\n {num}\n </button>\n )\n })}\n </div>\n {(survey.lowerBoundLabel || survey.upperBoundLabel) && (\n <div class=\"ph-tour-survey-rating-labels\">\n <span>{survey.lowerBoundLabel}</span>\n <span>{survey.upperBoundLabel}</span>\n </div>\n )}\n </div>\n )\n}\n\nexport function ProductTourSurveyStepInner({\n step,\n appearance,\n stepIndex,\n totalSteps,\n onPrevious,\n onSubmit,\n onDismiss,\n}: ProductTourSurveyStepInnerProps): h.JSX.Element {\n const [textValue, setTextValue] = useState('')\n const survey = step.survey\n const whiteLabel = appearance?.whiteLabel ?? false\n const isFirstStep = stepIndex === 0\n const isOpenText = survey?.type === 'open'\n\n const isInteractive = !!(onPrevious || onSubmit || onDismiss)\n const cursorStyle = isInteractive ? undefined : { cursor: 'default' }\n\n const handleTextSubmit = () => {\n onSubmit?.(textValue.trim() || null)\n }\n\n if (!survey) {\n return <div />\n }\n\n return (\n <>\n <button class=\"ph-tour-dismiss\" onClick={onDismiss} aria-label=\"Close survey\" style={cursorStyle}>\n {cancelSVG}\n </button>\n\n <div class=\"ph-tour-survey-question\">{survey.questionText}</div>\n\n {isOpenText ? (\n <OpenTextInput\n value={textValue}\n onChange={setTextValue}\n onSubmit={handleTextSubmit}\n isInteractive={isInteractive}\n />\n ) : (\n <RatingInput survey={survey} onSubmit={onSubmit} isInteractive={isInteractive} />\n )}\n\n <div class=\"ph-tour-footer\">\n <span class=\"ph-tour-progress\">\n {stepIndex + 1} of {totalSteps}\n </span>\n\n <div class=\"ph-tour-buttons\">\n {!isFirstStep && (\n <button\n class=\"ph-tour-button ph-tour-button--secondary\"\n onClick={onPrevious}\n style={cursorStyle}\n >\n Back\n </button>\n )}\n {isOpenText && (\n <button\n class=\"ph-tour-button ph-tour-button--primary\"\n onClick={handleTextSubmit}\n style={cursorStyle}\n >\n Submit\n </button>\n )}\n </div>\n </div>\n\n {!whiteLabel && (\n <a\n href={isInteractive ? 'https://posthog.com/product-tours' : undefined}\n target={isInteractive ? '_blank' : undefined}\n rel={isInteractive ? 'noopener noreferrer' : undefined}\n class=\"ph-tour-branding\"\n style={isInteractive ? undefined : { cursor: 'default', pointerEvents: 'none' }}\n >\n Survey by {IconPosthogLogo}\n </a>\n )}\n </>\n )\n}\n","import { PropertyMatchType } from './types'\nimport { SurveyActionType, SurveyEventWithFilters } from './posthog-surveys-types'\n\nexport interface JSONContent {\n type?: string\n attrs?: Record<string, any>\n content?: JSONContent[]\n marks?: { type: string; attrs?: Record<string, any> }[]\n text?: string\n}\n\nexport type ProductTourStepType = 'element' | 'modal' | 'survey'\n\nexport type ProductTourSurveyQuestionType = 'open' | 'rating'\n\nexport interface ProductTourSurveyQuestion {\n type: ProductTourSurveyQuestionType\n questionText: string\n /** Rating display type - emoji or number */\n display?: 'emoji' | 'number'\n /** Rating scale - 3 or 5 for emoji, 5 or 10 for number */\n scale?: 3 | 5 | 10\n /** Label for low end of rating scale (e.g., \"Not likely\") */\n lowerBoundLabel?: string\n /** Label for high end of rating scale (e.g., \"Very likely\") */\n upperBoundLabel?: string\n}\n\nexport interface ProductTourStep {\n id: string\n type: ProductTourStepType\n selector?: string\n progressionTrigger: 'button' | 'click'\n content: JSONContent | null\n /** Inline survey question config - if present, this is a survey step */\n survey?: ProductTourSurveyQuestion\n /** ID of the auto-created survey for this step (set by backend) */\n linkedSurveyId?: string\n /** ID of the survey question (set by backend, used for event tracking) */\n linkedSurveyQuestionId?: string\n}\n\nexport interface ProductTourConditions {\n url?: string\n urlMatchType?: PropertyMatchType\n selector?: string\n autoShowDelaySeconds?: number\n events?: {\n values: SurveyEventWithFilters[]\n } | null\n cancelEvents?: {\n values: SurveyEventWithFilters[]\n } | null\n actions?: {\n values: SurveyActionType[]\n } | null\n}\n\nexport interface ProductTourAppearance {\n backgroundColor?: string\n textColor?: string\n buttonColor?: string\n borderRadius?: number\n buttonBorderRadius?: number\n borderColor?: string\n fontFamily?: string\n boxShadow?: string\n showOverlay?: boolean\n whiteLabel?: boolean\n}\n\nexport interface ProductTour {\n id: string\n name: string\n description?: string\n type: 'product_tour'\n auto_launch?: boolean\n start_date: string | null\n end_date: string | null\n current_iteration?: number\n conditions?: ProductTourConditions\n appearance?: ProductTourAppearance\n steps: ProductTourStep[]\n internal_targeting_flag_key?: string\n linked_flag_key?: string\n}\n\nexport type ProductTourCallback = (tours: ProductTour[], context?: { isLoaded: boolean; error?: string }) => void\n\nexport type ProductTourSelectorError = 'not_found' | 'multiple_matches' | 'not_visible'\n\nexport type ProductTourDismissReason =\n | 'user_clicked_skip'\n | 'user_clicked_outside'\n | 'escape_key'\n | 'element_unavailable'\n\nexport type ProductTourRenderReason = 'auto' | 'api' | 'trigger' | 'event'\n\nexport const DEFAULT_PRODUCT_TOUR_APPEARANCE: Required<ProductTourAppearance> = {\n backgroundColor: '#ffffff',\n textColor: '#1d1f27',\n buttonColor: '#1d1f27',\n borderRadius: 8,\n buttonBorderRadius: 6,\n borderColor: '#e5e7eb',\n fontFamily: 'system-ui',\n boxShadow: '0 4px 12px rgba(0, 0, 0, 0.15)',\n showOverlay: true,\n whiteLabel: false,\n}\n\nexport interface ShowTourOptions {\n reason?: ProductTourRenderReason\n enableStrictValidation?: boolean\n}\n","import Config from '../config'\nimport { isUndefined } from '@posthog/core'\nimport { assignableWindow, window } from './globals'\nimport type { Logger } from '@posthog/core'\n\ntype CreateLoggerOptions = {\n debugEnabled?: boolean\n}\n\ntype PosthogJsLogger = Omit<Logger, 'createLogger'> & {\n _log: (level: 'log' | 'warn' | 'error', ...args: any[]) => void\n uninitializedWarning: (methodName: string) => void\n createLogger: (prefix: string, options?: CreateLoggerOptions) => PosthogJsLogger\n}\n\nconst _createLogger = (prefix: string, { debugEnabled }: CreateLoggerOptions = {}): PosthogJsLogger => {\n const logger: PosthogJsLogger = {\n _log: (level: 'log' | 'warn' | 'error', ...args: any[]) => {\n if (\n window &&\n (Config.DEBUG || assignableWindow.POSTHOG_DEBUG || debugEnabled) &&\n !isUndefined(window.console) &&\n window.console\n ) {\n const consoleLog =\n '__rrweb_original__' in window.console[level]\n ? (window.console[level] as any)['__rrweb_original__']\n : window.console[level]\n\n // eslint-disable-next-line no-console\n consoleLog(prefix, ...args)\n }\n },\n\n info: (...args: any[]) => {\n logger._log('log', ...args)\n },\n\n warn: (...args: any[]) => {\n logger._log('warn', ...args)\n },\n\n error: (...args: any[]) => {\n logger._log('error', ...args)\n },\n\n critical: (...args: any[]) => {\n // Critical errors are always logged to the console\n // eslint-disable-next-line no-console\n console.error(prefix, ...args)\n },\n\n uninitializedWarning: (methodName: string) => {\n logger.error(`You must initialize PostHog before calling ${methodName}`)\n },\n\n createLogger: (additionalPrefix: string, options?: CreateLoggerOptions) =>\n _createLogger(`${prefix} ${additionalPrefix}`, options),\n }\n return logger\n}\n\nexport const logger = _createLogger('[PostHog.js]')\n\nexport const createLogger = logger.createLogger\n","import { knownUnsafeEditableEvent } from \"../types.mjs\";\nimport { includes } from \"./string-utils.mjs\";\nconst nativeIsArray = Array.isArray;\nconst ObjProto = Object.prototype;\nconst type_utils_hasOwnProperty = ObjProto.hasOwnProperty;\nconst type_utils_toString = ObjProto.toString;\nconst isArray = nativeIsArray || function(obj) {\n return '[object Array]' === type_utils_toString.call(obj);\n};\nconst isFunction = (x)=>'function' == typeof x;\nconst isNativeFunction = (x)=>isFunction(x) && -1 !== x.toString().indexOf('[native code]');\nconst isObject = (x)=>x === Object(x) && !isArray(x);\nconst isEmptyObject = (x)=>{\n if (isObject(x)) {\n for(const key in x)if (type_utils_hasOwnProperty.call(x, key)) return false;\n return true;\n }\n return false;\n};\nconst isUndefined = (x)=>void 0 === x;\nconst isString = (x)=>'[object String]' == type_utils_toString.call(x);\nconst isEmptyString = (x)=>isString(x) && 0 === x.trim().length;\nconst isNull = (x)=>null === x;\nconst isNullish = (x)=>isUndefined(x) || isNull(x);\nconst isNumber = (x)=>'[object Number]' == type_utils_toString.call(x);\nconst isBoolean = (x)=>'[object Boolean]' === type_utils_toString.call(x);\nconst isFormData = (x)=>x instanceof FormData;\nconst isFile = (x)=>x instanceof File;\nconst isPlainError = (x)=>x instanceof Error;\nconst isKnownUnsafeEditableEvent = (x)=>includes(knownUnsafeEditableEvent, x);\nfunction isPrimitive(value) {\n return null === value || 'object' != typeof value;\n}\nfunction isBuiltin(candidate, className) {\n return Object.prototype.toString.call(candidate) === `[object ${className}]`;\n}\nfunction isError(candidate) {\n switch(Object.prototype.toString.call(candidate)){\n case '[object Error]':\n case '[object Exception]':\n case '[object DOMException]':\n case '[object DOMError]':\n case '[object WebAssembly.Exception]':\n return true;\n default:\n return isInstanceOf(candidate, Error);\n }\n}\nfunction isErrorEvent(event) {\n return isBuiltin(event, 'ErrorEvent');\n}\nfunction isEvent(candidate) {\n return !isUndefined(Event) && isInstanceOf(candidate, Event);\n}\nfunction isPlainObject(candidate) {\n return isBuiltin(candidate, 'Object');\n}\nfunction isInstanceOf(candidate, base) {\n try {\n return candidate instanceof base;\n } catch {\n return false;\n }\n}\nconst yesLikeValues = [\n true,\n 'true',\n 1,\n '1',\n 'yes'\n];\nconst isYesLike = (val)=>includes(yesLikeValues, val);\nconst noLikeValues = [\n false,\n 'false',\n 0,\n '0',\n 'no'\n];\nconst isNoLike = (val)=>includes(noLikeValues, val);\nexport { type_utils_hasOwnProperty as hasOwnProperty, isArray, isBoolean, isBuiltin, isEmptyObject, isEmptyString, isError, isErrorEvent, isEvent, isFile, isFormData, isFunction, isKnownUnsafeEditableEvent, isNativeFunction, isNoLike, isNull, isNullish, isNumber, isObject, isPlainError, isPlainObject, isPrimitive, isString, isUndefined, isYesLike, noLikeValues, yesLikeValues };\n","import { PostHog } from '../../posthog-core'\nimport { createLogger } from '../../utils/logger'\n\nconst logger = createLogger('[Stylesheet Loader]')\n\nexport const prepareStylesheet = (document: Document, innerText: string, posthog?: PostHog) => {\n // Forcing the existence of `document` requires this function to be called in a browser environment\n let stylesheet: HTMLStyleElement | null = document.createElement('style')\n stylesheet.innerText = innerText\n\n if (posthog?.config?.prepare_external_dependency_stylesheet) {\n stylesheet = posthog.config.prepare_external_dependency_stylesheet(stylesheet)\n }\n\n if (!stylesheet) {\n logger.error('prepare_external_dependency_stylesheet returned null')\n return null\n }\n\n return stylesheet\n}\n","import { DisplaySurveyOptions, DisplaySurveyType, Survey, SurveyType } from '../posthog-surveys-types'\nimport { createLogger } from '../utils/logger'\n\nexport const SURVEY_LOGGER = createLogger('[Surveys]')\n\nexport function isSurveyRunning(survey: Survey): boolean {\n return !!(survey.start_date && !survey.end_date)\n}\n\nexport function doesSurveyActivateByEvent(survey: Pick<Survey, 'conditions'>): boolean {\n return !!survey.conditions?.events?.values?.length\n}\n\nexport function doesSurveyActivateByAction(survey: Pick<Survey, 'conditions'>): boolean {\n return !!survey.conditions?.actions?.values?.length\n}\n\nexport const SURVEY_SEEN_PREFIX = 'seenSurvey_'\nexport const SURVEY_IN_PROGRESS_PREFIX = 'inProgressSurvey_'\nexport const SURVEY_ABANDONED_PREFIX = 'abandonedSurvey_'\n\nexport const getSurveyInteractionProperty = (\n survey: Pick<Survey, 'id' | 'current_iteration'>,\n action: 'responded' | 'dismissed'\n): string => {\n let surveyProperty = `$survey_${action}/${survey.id}`\n if (survey.current_iteration && survey.current_iteration > 0) {\n surveyProperty = `$survey_${action}/${survey.id}/${survey.current_iteration}`\n }\n\n return surveyProperty\n}\n\nconst getSurveyStorageKey = (prefix: string, survey: Pick<Survey, 'id' | 'current_iteration'>): string => {\n let key = `${prefix}${survey.id}`\n if (survey.current_iteration && survey.current_iteration > 0) {\n key = `${prefix}${survey.id}_${survey.current_iteration}`\n }\n return key\n}\n\nexport const getSurveySeenKey = (survey: Pick<Survey, 'id' | 'current_iteration'>): string => {\n return getSurveyStorageKey(SURVEY_SEEN_PREFIX, survey)\n}\n\nexport const getSurveyAbandonedKey = (survey: Pick<Survey, 'id' | 'current_iteration'>): string => {\n return getSurveyStorageKey(SURVEY_ABANDONED_PREFIX, survey)\n}\n\nexport const setSurveySeenOnLocalStorage = (survey: Pick<Survey, 'id' | 'current_iteration'>) => {\n const isSurveySeen = localStorage.getItem(getSurveySeenKey(survey))\n // if survey is already seen, no need to set it again\n if (isSurveySeen) {\n return\n }\n\n localStorage.setItem(getSurveySeenKey(survey), 'true')\n}\n\n// These surveys are relevant for the getActiveMatchingSurveys method. They are used to\n// display surveys in our customer's application. Any new in-app survey type should be added here.\nexport const IN_APP_SURVEY_TYPES = [SurveyType.Popover, SurveyType.Widget, SurveyType.API]\n\nexport const DEFAULT_DISPLAY_SURVEY_OPTIONS: DisplaySurveyOptions = {\n ignoreConditions: false,\n ignoreDelay: false,\n displayType: DisplaySurveyType.Popover,\n}\n","import { each, find } from './utils'\nimport Config from './config'\nimport { Compression, RequestWithOptions, RequestResponse } from './types'\nimport { formDataToQuery } from './utils/request-utils'\n\nimport { logger } from './utils/logger'\nimport { AbortController, fetch, navigator, XMLHttpRequest } from './utils/globals'\nimport { gzipSync, strToU8 } from 'fflate'\n\nimport { _base64Encode } from './utils/encode-utils'\n\n// eslint-disable-next-line compat/compat\nexport const SUPPORTS_REQUEST = !!XMLHttpRequest || !!fetch\n\nconst CONTENT_TYPE_PLAIN = 'text/plain'\nconst CONTENT_TYPE_JSON = 'application/json'\nconst CONTENT_TYPE_FORM = 'application/x-www-form-urlencoded'\nconst SIXTY_FOUR_KILOBYTES = 64 * 1024\n/*\n fetch will fail if we request keepalive with a body greater than 64kb\n sets the threshold lower than that so that\n any overhead doesn't push over the threshold after checking here\n*/\nconst KEEP_ALIVE_THRESHOLD = SIXTY_FOUR_KILOBYTES * 0.8\ntype EncodedBody = {\n contentType: string\n body: string | BlobPart\n estimatedSize: number\n}\n\n/**\n * Extends a URL with additional query parameters\n * @param url - The URL to extend\n * @param params - The parameters to add\n * @param replace - When true (default), new params overwrite existing ones with same key. When false, existing params are preserved.\n * @returns The URL with extended parameters\n */\nexport const extendURLParams = (url: string, params: Record<string, any>, replace: boolean = true): string => {\n const [baseUrl, search] = url.split('?')\n const newParams = { ...params }\n\n const updatedSearch =\n search?.split('&').map((pair) => {\n const [key, origValue] = pair.split('=')\n const value = replace ? (newParams[key] ?? origValue) : origValue\n delete newParams[key]\n return `${key}=${value}`\n }) ?? []\n\n const remaining = formDataToQuery(newParams)\n if (remaining) {\n updatedSearch.push(remaining)\n }\n\n return `${baseUrl}?${updatedSearch.join('&')}`\n}\n\nexport const jsonStringify = (data: any, space?: string | number): string => {\n // With plain JSON.stringify, we get an exception when a property is a BigInt. This has caused problems for some users,\n // see https://github.com/PostHog/posthog-js/issues/1440\n // To work around this, we convert BigInts to strings before stringifying the data. This is not ideal, as we lose\n // information that this was originally a number, but given ClickHouse doesn't support BigInts, the customer\n // would not be able to operate on these numerically anyway.\n return JSON.stringify(data, (_, value) => (typeof value === 'bigint' ? value.toString() : value), space)\n}\n\nconst encodeToDataString = (data: string | Record<string, any>): string => {\n return 'data=' + encodeURIComponent(typeof data === 'string' ? data : jsonStringify(data))\n}\n\nconst encodePostData = ({ data, compression }: RequestWithOptions): EncodedBody | undefined => {\n if (!data) {\n return\n }\n\n if (compression === Compression.GZipJS) {\n const gzipData = gzipSync(strToU8(jsonStringify(data)), { mtime: 0 })\n const blob = new Blob([gzipData], { type: CONTENT_TYPE_PLAIN })\n return {\n contentType: CONTENT_TYPE_PLAIN,\n body: blob,\n estimatedSize: blob.size,\n }\n }\n\n if (compression === Compression.Base64) {\n const b64data = _base64Encode(jsonStringify(data))\n const encodedBody = encodeToDataString(b64data)\n\n return {\n contentType: CONTENT_TYPE_FORM,\n body: encodedBody,\n estimatedSize: new Blob([encodedBody]).size,\n }\n }\n\n const jsonBody = jsonStringify(data)\n return {\n contentType: CONTENT_TYPE_JSON,\n body: jsonBody,\n estimatedSize: new Blob([jsonBody]).size,\n }\n}\n\nconst xhr = (options: RequestWithOptions) => {\n const req = new XMLHttpRequest!()\n req.open(options.method || 'GET', options.url, true)\n const { contentType, body } = encodePostData(options) ?? {}\n\n each(options.headers, function (headerValue, headerName) {\n req.setRequestHeader(headerName, headerValue)\n })\n\n if (contentType) {\n req.setRequestHeader('Content-Type', contentType)\n }\n\n if (options.timeout) {\n req.timeout = options.timeout\n }\n if (!options.disableXHRCredentials) {\n // send the ph_optout cookie\n // withCredentials cannot be modified until after calling .open on Android and Mobile Safari\n req.withCredentials = true\n }\n req.onreadystatechange = () => {\n // XMLHttpRequest.DONE == 4, except in safari 4\n if (req.readyState === 4) {\n const response: RequestResponse = {\n statusCode: req.status,\n text: req.responseText,\n }\n if (req.status === 200) {\n try {\n response.json = JSON.parse(req.responseText)\n } catch {\n // logger.error(e)\n }\n }\n\n options.callback?.(response)\n }\n }\n req.send(body)\n}\n\nconst _fetch = (options: RequestWithOptions) => {\n const { contentType, body, estimatedSize } = encodePostData(options) ?? {}\n\n // eslint-disable-next-line compat/compat\n const headers = new Headers()\n each(options.headers, function (headerValue, headerName) {\n headers.append(headerName, headerValue)\n })\n\n if (contentType) {\n headers.append('Content-Type', contentType)\n }\n\n const url = options.url\n let aborter: { signal: any; timeout: ReturnType<typeof setTimeout> } | null = null\n\n if (AbortController) {\n const controller = new AbortController()\n aborter = {\n signal: controller.signal,\n timeout: setTimeout(() => controller.abort(), options.timeout),\n }\n }\n\n fetch!(url, {\n method: options?.method || 'GET',\n headers,\n // if body is greater than 64kb, then fetch with keepalive will error\n // see 8:10:5 at https://fetch.spec.whatwg.org/#http-network-or-cache-fetch,\n // but we do want to set keepalive sometimes as it can help with success\n // when e.g. a page is being closed\n // so let's get the best of both worlds and only set keepalive for POST requests\n // where the body is less than 64kb\n // NB this is fetch keepalive and not http keepalive\n keepalive: options.method === 'POST' && (estimatedSize || 0) < KEEP_ALIVE_THRESHOLD,\n body,\n signal: aborter?.signal,\n ...options.fetchOptions,\n })\n .then((response) => {\n return response.text().then((responseText) => {\n const res: RequestResponse = {\n statusCode: response.status,\n text: responseText,\n }\n\n if (response.status === 200) {\n try {\n res.json = JSON.parse(responseText)\n } catch (e) {\n logger.error(e)\n }\n }\n\n options.callback?.(res)\n })\n })\n .catch((error) => {\n logger.error(error)\n options.callback?.({ statusCode: 0, text: error })\n })\n .finally(() => (aborter ? clearTimeout(aborter.timeout) : null))\n\n return\n}\n\nconst _sendBeacon = (options: RequestWithOptions) => {\n // beacon documentation https://w3c.github.io/beacon/\n // beacons format the message and use the type property\n\n const url = extendURLParams(options.url, {\n beacon: '1',\n })\n\n try {\n const { contentType, body } = encodePostData(options) ?? {}\n // sendBeacon requires a blob so we convert it\n const sendBeaconBody = typeof body === 'string' ? new Blob([body], { type: contentType }) : body\n navigator!.sendBeacon!(url, sendBeaconBody)\n } catch {\n // send beacon is a best-effort, fire-and-forget mechanism on page unload,\n // we don't want to throw errors here\n }\n}\n\nconst AVAILABLE_TRANSPORTS: {\n transport: RequestWithOptions['transport']\n method: (options: RequestWithOptions) => void\n}[] = []\n\n// We add the transports in order of preference\nif (fetch) {\n AVAILABLE_TRANSPORTS.push({\n transport: 'fetch',\n method: _fetch,\n })\n}\n\nif (XMLHttpRequest) {\n AVAILABLE_TRANSPORTS.push({\n transport: 'XHR',\n method: xhr,\n })\n}\n\nif (navigator?.sendBeacon) {\n AVAILABLE_TRANSPORTS.push({\n transport: 'sendBeacon',\n method: _sendBeacon,\n })\n}\n\n// This is the entrypoint. It takes care of sanitizing the options and then calls the appropriate request method.\nexport const request = (_options: RequestWithOptions) => {\n // Clone the options so we don't modify the original object\n const options = { ..._options }\n options.timeout = options.timeout || 60000\n\n options.url = extendURLParams(options.url, {\n _: new Date().getTime().toString(),\n ver: Config.LIB_VERSION,\n compression: options.compression,\n })\n\n const transport = options.transport ?? 'fetch'\n\n const availableTransports = AVAILABLE_TRANSPORTS.filter(\n (t) => !options.disableTransport || !t.transport || !options.disableTransport.includes(t.transport)\n )\n\n const transportMethod =\n find(availableTransports, (t) => t.transport === transport)?.method ?? availableTransports[0].method\n\n if (!transportMethod) {\n throw new Error('No available transport method')\n }\n\n transportMethod(options)\n}\n","import { VNode, cloneElement, createContext, type JSX } from 'preact'\nimport { PostHog } from '../../posthog-core'\nimport {\n MultipleSurveyQuestion,\n Survey,\n SurveyAppearance,\n SurveyEventName,\n SurveyEventProperties,\n SurveyPosition,\n SurveyQuestion,\n SurveySchedule,\n SurveyType,\n SurveyWidgetType,\n} from '../../posthog-surveys-types'\nimport { document as _document, window as _window, userAgent } from '../../utils/globals'\nimport {\n getSurveyInteractionProperty,\n getSurveySeenKey,\n getSurveyAbandonedKey,\n SURVEY_LOGGER as logger,\n setSurveySeenOnLocalStorage,\n SURVEY_IN_PROGRESS_PREFIX,\n} from '../../utils/survey-utils'\nimport { isArray, isNullish } from '@posthog/core'\n\nimport { detectDeviceType } from '@posthog/core'\nimport { propertyComparisons } from '../../utils/property-utils'\nimport { PropertyMatchType } from '../../types'\nimport { prepareStylesheet } from '../utils/stylesheet-loader'\n// We cast the types here which is dangerous but protected by the top level generateSurveys call\nconst window = _window as Window & typeof globalThis\nconst document = _document as Document\nimport surveyStyles from './survey.css'\nimport { useContext } from 'preact/hooks'\n\nexport function getFontFamily(fontFamily?: string): string {\n if (fontFamily === 'inherit') {\n return 'inherit'\n }\n\n const defaultFontStack =\n 'BlinkMacSystemFont, \"Inter\", \"Segoe UI\", \"Roboto\", Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"'\n return fontFamily ? `${fontFamily}, ${defaultFontStack}` : `-apple-system, ${defaultFontStack}`\n}\n\nexport function getSurveyResponseKey(questionId: string) {\n return `$survey_response_${questionId}`\n}\n\nconst BLACK_TEXT_COLOR = '#020617' // Maps out to text-slate-950 from tailwind colors. Intended for text use outside interactive elements like buttons\n\n// Keep in sync with defaultSurveyAppearance on the main app\nexport const defaultSurveyAppearance = {\n fontFamily: 'inherit',\n backgroundColor: '#eeeded',\n submitButtonColor: 'black',\n submitButtonTextColor: 'white',\n ratingButtonColor: 'white',\n ratingButtonActiveColor: 'black',\n borderColor: '#c9c6c6',\n placeholder: 'Start typing...',\n whiteLabel: false,\n displayThankYouMessage: true,\n thankYouMessageHeader: 'Thank you for your feedback!',\n position: SurveyPosition.Right,\n widgetType: SurveyWidgetType.Tab,\n widgetLabel: 'Feedback',\n widgetColor: 'black',\n zIndex: '2147483647',\n disabledButtonOpacity: '0.6',\n maxWidth: '300px',\n textSubtleColor: '#939393',\n boxPadding: '20px 24px',\n boxShadow: '0 4px 12px rgba(0, 0, 0, 0.15)',\n borderRadius: '10px',\n shuffleQuestions: false,\n surveyPopupDelaySeconds: undefined,\n // Not customizable atm\n outlineColor: 'rgba(59, 130, 246, 0.8)',\n inputBackground: 'white',\n inputTextColor: BLACK_TEXT_COLOR,\n scrollbarThumbColor: 'var(--ph-survey-border-color)',\n scrollbarTrackColor: 'var(--ph-survey-background-color)',\n} as const\n\nexport const addSurveyCSSVariablesToElement = (\n element: HTMLElement,\n type: SurveyType,\n appearance?: SurveyAppearance | null\n) => {\n const effectiveAppearance = { ...defaultSurveyAppearance, ...appearance }\n const hostStyle = element.style\n\n const surveyHasBottomBorder =\n ![SurveyPosition.Center, SurveyPosition.Left, SurveyPosition.Right].includes(effectiveAppearance.position) ||\n (type === SurveyType.Widget && appearance?.widgetType === SurveyWidgetType.Tab)\n\n hostStyle.setProperty('--ph-survey-font-family', getFontFamily(effectiveAppearance.fontFamily))\n hostStyle.setProperty('--ph-survey-box-padding', effectiveAppearance.boxPadding)\n hostStyle.setProperty('--ph-survey-max-width', effectiveAppearance.maxWidth)\n hostStyle.setProperty('--ph-survey-z-index', effectiveAppearance.zIndex)\n hostStyle.setProperty('--ph-survey-border-color', effectiveAppearance.borderColor)\n // Non-bottom surveys or tab surveys have the border bottom\n if (surveyHasBottomBorder) {\n hostStyle.setProperty('--ph-survey-border-radius', effectiveAppearance.borderRadius)\n hostStyle.setProperty('--ph-survey-border-bottom', '1.5px solid var(--ph-survey-border-color)')\n } else {\n hostStyle.setProperty('--ph-survey-border-bottom', 'none')\n hostStyle.setProperty(\n '--ph-survey-border-radius',\n `${effectiveAppearance.borderRadius} ${effectiveAppearance.borderRadius} 0 0`\n )\n }\n hostStyle.setProperty('--ph-survey-background-color', effectiveAppearance.backgroundColor)\n hostStyle.setProperty('--ph-survey-box-shadow', effectiveAppearance.boxShadow)\n hostStyle.setProperty('--ph-survey-disabled-button-opacity', effectiveAppearance.disabledButtonOpacity)\n hostStyle.setProperty('--ph-survey-submit-button-color', effectiveAppearance.submitButtonColor)\n hostStyle.setProperty(\n '--ph-survey-submit-button-text-color',\n appearance?.submitButtonTextColor || getContrastingTextColor(effectiveAppearance.submitButtonColor)\n )\n hostStyle.setProperty('--ph-survey-rating-bg-color', effectiveAppearance.ratingButtonColor)\n hostStyle.setProperty('--ph-survey-rating-active-bg-color', effectiveAppearance.ratingButtonActiveColor)\n // Active rating text is always auto-calculated for contrast with active background\n hostStyle.setProperty(\n '--ph-survey-rating-active-text-color',\n getContrastingTextColor(effectiveAppearance.ratingButtonActiveColor)\n )\n // Primary text color: use override if provided, otherwise auto-calculate from background\n hostStyle.setProperty(\n '--ph-survey-text-primary-color',\n appearance?.textColor || getContrastingTextColor(effectiveAppearance.backgroundColor)\n )\n hostStyle.setProperty('--ph-survey-text-subtle-color', effectiveAppearance.textSubtleColor)\n hostStyle.setProperty('--ph-widget-color', effectiveAppearance.widgetColor)\n hostStyle.setProperty('--ph-widget-text-color', getContrastingTextColor(effectiveAppearance.widgetColor))\n hostStyle.setProperty('--ph-widget-z-index', effectiveAppearance.zIndex)\n\n // Use user-provided inputBackground (or deprecated inputBackgroundColor for backwards compat)\n // Fallback to internal default, with slight adjustment for white backgrounds\n const userInputBg = appearance?.inputBackground || appearance?.inputBackgroundColor\n let inputBgColor = userInputBg || effectiveAppearance.inputBackground\n if (!userInputBg && effectiveAppearance.backgroundColor === 'white') {\n inputBgColor = '#f8f8f8'\n }\n hostStyle.setProperty('--ph-survey-input-background', inputBgColor)\n // Input text color applies to both text inputs and inactive rating buttons\n const inputTextColor = appearance?.inputTextColor || getContrastingTextColor(inputBgColor)\n hostStyle.setProperty('--ph-survey-input-text-color', inputTextColor)\n hostStyle.setProperty('--ph-survey-rating-text-color', inputTextColor)\n hostStyle.setProperty('--ph-survey-scrollbar-thumb-color', effectiveAppearance.scrollbarThumbColor)\n hostStyle.setProperty('--ph-survey-scrollbar-track-color', effectiveAppearance.scrollbarTrackColor)\n hostStyle.setProperty('--ph-survey-outline-color', effectiveAppearance.outlineColor)\n}\n\nfunction nameToHex(name: string) {\n return {\n aliceblue: '#f0f8ff',\n antiquewhite: '#faebd7',\n aqua: '#00ffff',\n aquamarine: '#7fffd4',\n azure: '#f0ffff',\n beige: '#f5f5dc',\n bisque: '#ffe4c4',\n black: '#000000',\n blanchedalmond: '#ffebcd',\n blue: '#0000ff',\n blueviolet: '#8a2be2',\n brown: '#a52a2a',\n burlywood: '#deb887',\n cadetblue: '#5f9ea0',\n chartreuse: '#7fff00',\n chocolate: '#d2691e',\n coral: '#ff7f50',\n cornflowerblue: '#6495ed',\n cornsilk: '#fff8dc',\n crimson: '#dc143c',\n cyan: '#00ffff',\n darkblue: '#00008b',\n darkcyan: '#008b8b',\n darkgoldenrod: '#b8860b',\n darkgray: '#a9a9a9',\n darkgreen: '#006400',\n darkkhaki: '#bdb76b',\n darkmagenta: '#8b008b',\n darkolivegreen: '#556b2f',\n darkorange: '#ff8c00',\n darkorchid: '#9932cc',\n darkred: '#8b0000',\n darksalmon: '#e9967a',\n darkseagreen: '#8fbc8f',\n darkslateblue: '#483d8b',\n darkslategray: '#2f4f4f',\n darkturquoise: '#00ced1',\n darkviolet: '#9400d3',\n deeppink: '#ff1493',\n deepskyblue: '#00bfff',\n dimgray: '#696969',\n dodgerblue: '#1e90ff',\n firebrick: '#b22222',\n floralwhite: '#fffaf0',\n forestgreen: '#228b22',\n fuchsia: '#ff00ff',\n gainsboro: '#dcdcdc',\n ghostwhite: '#f8f8ff',\n gold: '#ffd700',\n goldenrod: '#daa520',\n gray: '#808080',\n green: '#008000',\n greenyellow: '#adff2f',\n honeydew: '#f0fff0',\n hotpink: '#ff69b4',\n 'indianred ': '#cd5c5c',\n indigo: '#4b0082',\n ivory: '#fffff0',\n khaki: '#f0e68c',\n lavender: '#e6e6fa',\n lavenderblush: '#fff0f5',\n lawngreen: '#7cfc00',\n lemonchiffon: '#fffacd',\n lightblue: '#add8e6',\n lightcoral: '#f08080',\n lightcyan: '#e0ffff',\n lightgoldenrodyellow: '#fafad2',\n lightgrey: '#d3d3d3',\n lightgreen: '#90ee90',\n lightpink: '#ffb6c1',\n lightsalmon: '#ffa07a',\n lightseagreen: '#20b2aa',\n lightskyblue: '#87cefa',\n lightslategray: '#778899',\n lightsteelblue: '#b0c4de',\n lightyellow: '#ffffe0',\n lime: '#00ff00',\n limegreen: '#32cd32',\n linen: '#faf0e6',\n magenta: '#ff00ff',\n maroon: '#800000',\n mediumaquamarine: '#66cdaa',\n mediumblue: '#0000cd',\n mediumorchid: '#ba55d3',\n mediumpurple: '#9370d8',\n mediumseagreen: '#3cb371',\n mediumslateblue: '#7b68ee',\n mediumspringgreen: '#00fa9a',\n mediumturquoise: '#48d1cc',\n mediumvioletred: '#c71585',\n midnightblue: '#191970',\n mintcream: '#f5fffa',\n mistyrose: '#ffe4e1',\n moccasin: '#ffe4b5',\n navajowhite: '#ffdead',\n navy: '#000080',\n oldlace: '#fdf5e6',\n olive: '#808000',\n olivedrab: '#6b8e23',\n orange: '#ffa500',\n orangered: '#ff4500',\n orchid: '#da70d6',\n palegoldenrod: '#eee8aa',\n palegreen: '#98fb98',\n paleturquoise: '#afeeee',\n palevioletred: '#d87093',\n papayawhip: '#ffefd5',\n peachpuff: '#ffdab9',\n peru: '#cd853f',\n pink: '#ffc0cb',\n plum: '#dda0dd',\n powderblue: '#b0e0e6',\n purple: '#800080',\n red: '#ff0000',\n rosybrown: '#bc8f8f',\n royalblue: '#4169e1',\n saddlebrown: '#8b4513',\n salmon: '#fa8072',\n sandybrown: '#f4a460',\n seagreen: '#2e8b57',\n seashell: '#fff5ee',\n sienna: '#a0522d',\n silver: '#c0c0c0',\n skyblue: '#87ceeb',\n slateblue: '#6a5acd',\n slategray: '#708090',\n snow: '#fffafa',\n springgreen: '#00ff7f',\n steelblue: '#4682b4',\n tan: '#d2b48c',\n teal: '#008080',\n thistle: '#d8bfd8',\n tomato: '#ff6347',\n turquoise: '#40e0d0',\n violet: '#ee82ee',\n wheat: '#f5deb3',\n white: '#ffffff',\n whitesmoke: '#f5f5f5',\n yellow: '#ffff00',\n yellowgreen: '#9acd32',\n }[name.toLowerCase()]\n}\n\nexport function hex2rgb(c: string): string {\n if (c.startsWith('#')) {\n let hexColor = c.replace(/^#/, '')\n // Handle 3-character shorthand (e.g., #111 -> #111111, #abc -> #aabbcc)\n if (/^[0-9A-Fa-f]{3}$/.test(hexColor)) {\n hexColor = hexColor[0] + hexColor[0] + hexColor[1] + hexColor[1] + hexColor[2] + hexColor[2]\n }\n if (!/^[0-9A-Fa-f]{6}$/.test(hexColor)) {\n return 'rgb(255, 255, 255)'\n }\n const r = parseInt(hexColor.slice(0, 2), 16)\n const g = parseInt(hexColor.slice(2, 4), 16)\n const b = parseInt(hexColor.slice(4, 6), 16)\n return `rgb(${r},${g},${b})`\n }\n return 'rgb(255, 255, 255)'\n}\n\nexport function hexToRgba(hex: string, opacity: number): string {\n const rgb = hex2rgb(hex)\n const match = rgb.match(/^rgb\\((\\d+),(\\d+),(\\d+)\\)$/)\n if (!match) {\n return hex\n }\n return `rgba(${match[1]}, ${match[2]}, ${match[3]}, ${opacity})`\n}\n\nexport function getContrastingTextColor(color: string = defaultSurveyAppearance.backgroundColor) {\n let rgb\n if (color[0] === '#') {\n rgb = hex2rgb(color)\n }\n if (color.startsWith('rgb')) {\n rgb = color\n }\n // otherwise it's a color name\n const nameColorToHex = nameToHex(color)\n if (nameColorToHex) {\n rgb = hex2rgb(nameColorToHex)\n }\n if (!rgb) {\n return BLACK_TEXT_COLOR\n }\n const colorMatch = rgb.match(/^rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)(?:,\\s*(\\d+(?:\\.\\d+)?))?\\)$/)\n if (colorMatch) {\n const r = parseInt(colorMatch[1])\n const g = parseInt(colorMatch[2])\n const b = parseInt(colorMatch[3])\n const hsp = Math.sqrt(0.299 * (r * r) + 0.587 * (g * g) + 0.114 * (b * b))\n return hsp > 127.5 ? BLACK_TEXT_COLOR : 'white'\n }\n return BLACK_TEXT_COLOR\n}\n\nexport function getSurveyStylesheet(posthog?: PostHog) {\n const stylesheet = prepareStylesheet(document, typeof surveyStyles === 'string' ? surveyStyles : '', posthog)\n stylesheet?.setAttribute('data-ph-survey-style', 'true')\n return stylesheet\n}\n\nexport const retrieveSurveyShadow = (\n survey: Pick<Survey, 'id' | 'appearance' | 'type'>,\n posthog?: PostHog,\n element?: Element\n) => {\n const widgetClassName = getSurveyContainerClass(survey)\n const existingDiv = document.querySelector(`.${widgetClassName}`)\n\n if (existingDiv && existingDiv.shadowRoot) {\n return {\n shadow: existingDiv.shadowRoot,\n isNewlyCreated: false,\n }\n }\n\n // If it doesn't exist, create it\n const div = document.createElement('div')\n addSurveyCSSVariablesToElement(div, survey.type, survey.appearance)\n div.className = widgetClassName\n const shadow = div.attachShadow({ mode: 'open' })\n const stylesheet = getSurveyStylesheet(posthog)\n if (stylesheet) {\n const existingStylesheet = shadow.querySelector('style')\n if (existingStylesheet) {\n shadow.removeChild(existingStylesheet)\n }\n shadow.appendChild(stylesheet)\n }\n ;(element ? element : document.body).appendChild(div)\n return {\n shadow,\n isNewlyCreated: true,\n }\n}\n\ninterface SendSurveyEventArgs {\n responses: Record<string, string | number | string[] | null>\n survey: Survey\n surveySubmissionId: string\n isSurveyCompleted: boolean\n posthog?: PostHog\n}\n\nconst getSurveyResponseValue = (responses: Record<string, string | number | string[] | null>, questionId?: string) => {\n if (!questionId) {\n return null\n }\n const response = responses[getSurveyResponseKey(questionId)]\n if (isArray(response)) {\n return [...response]\n }\n return response\n}\n\nexport const sendSurveyEvent = ({\n responses,\n survey,\n surveySubmissionId,\n posthog,\n isSurveyCompleted,\n}: SendSurveyEventArgs) => {\n if (!posthog) {\n logger.error('[survey sent] event not captured, PostHog instance not found.')\n return\n }\n setSurveySeenOnLocalStorage(survey)\n posthog.capture(SurveyEventName.SENT, {\n [SurveyEventProperties.SURVEY_NAME]: survey.name,\n [SurveyEventProperties.SURVEY_ID]: survey.id,\n [SurveyEventProperties.SURVEY_ITERATION]: survey.current_iteration,\n [SurveyEventProperties.SURVEY_ITERATION_START_DATE]: survey.current_iteration_start_date,\n [SurveyEventProperties.SURVEY_QUESTIONS]: survey.questions.map((question) => ({\n id: question.id,\n question: question.question,\n response: getSurveyResponseValue(responses, question.id),\n })),\n [SurveyEventProperties.SURVEY_SUBMISSION_ID]: surveySubmissionId,\n [SurveyEventProperties.SURVEY_COMPLETED]: isSurveyCompleted,\n sessionRecordingUrl: posthog.get_session_replay_url?.(),\n ...responses,\n $set: {\n [getSurveyInteractionProperty(survey, 'responded')]: true,\n },\n })\n if (isSurveyCompleted) {\n // Only dispatch PHSurveySent if the survey is completed, as that removes the survey from focus\n window.dispatchEvent(new CustomEvent('PHSurveySent', { detail: { surveyId: survey.id } }))\n clearInProgressSurveyState(survey)\n }\n}\n\nconst _surveyHasResponses = (inProgressSurvey: InProgressSurveyState | null) => {\n return Object.values(inProgressSurvey?.responses || {}).filter((resp) => !isNullish(resp)).length > 0\n}\n\nconst _buildSurveyEventProperties = (\n survey: Survey,\n inProgressSurvey: InProgressSurveyState | null,\n posthog: PostHog\n) => ({\n [SurveyEventProperties.SURVEY_NAME]: survey.name,\n [SurveyEventProperties.SURVEY_ID]: survey.id,\n [SurveyEventProperties.SURVEY_ITERATION]: survey.current_iteration,\n [SurveyEventProperties.SURVEY_ITERATION_START_DATE]: survey.current_iteration_start_date,\n [SurveyEventProperties.SURVEY_PARTIALLY_COMPLETED]: _surveyHasResponses(inProgressSurvey),\n sessionRecordingUrl: posthog.get_session_replay_url?.(),\n ...inProgressSurvey?.responses,\n [SurveyEventProperties.SURVEY_SUBMISSION_ID]: inProgressSurvey?.surveySubmissionId,\n [SurveyEventProperties.SURVEY_QUESTIONS]: survey.questions.map((question) => ({\n id: question.id,\n question: question.question,\n response: getSurveyResponseValue(inProgressSurvey?.responses || {}, question.id),\n })),\n})\n\nexport const dismissedSurveyEvent = (survey: Survey, posthog?: PostHog, readOnly?: boolean) => {\n if (!posthog) {\n logger.error('[survey dismissed] event not captured, PostHog instance not found.')\n return\n }\n if (readOnly) {\n return\n }\n\n const inProgressSurvey = getInProgressSurveyState(survey)\n posthog.capture(SurveyEventName.DISMISSED, {\n ..._buildSurveyEventProperties(survey, inProgressSurvey, posthog),\n $set: {\n [getSurveyInteractionProperty(survey, 'dismissed')]: true,\n },\n })\n clearInProgressSurveyState(survey)\n setSurveySeenOnLocalStorage(survey)\n window.dispatchEvent(new CustomEvent('PHSurveyClosed', { detail: { surveyId: survey.id } }))\n}\n\nexport const sendSurveyAbandonedEvent = (survey: Survey, posthog?: PostHog) => {\n if (!posthog) {\n logger.error('[survey abandoned] event not captured, PostHog instance not found.')\n return\n }\n\n const abandonedKey = getSurveyAbandonedKey(survey)\n try {\n if (localStorage.getItem(abandonedKey) === 'true') {\n return\n }\n } catch {\n // localStorage not available\n return\n }\n\n const inProgressSurvey = getInProgressSurveyState(survey)\n if (!inProgressSurvey) {\n return\n }\n\n try {\n localStorage.setItem(abandonedKey, 'true')\n } catch {\n // localStorage not available\n }\n\n posthog.capture(SurveyEventName.ABANDONED, _buildSurveyEventProperties(survey, inProgressSurvey, posthog), {\n transport: 'sendBeacon',\n })\n}\n\n// Use the Fisher-yates algorithm to shuffle this array\n// https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle\nexport const shuffle = (array: any[]) => {\n return array\n .map((a) => ({ sort: Math.floor(Math.random() * 10), value: a }))\n .sort((a, b) => a.sort - b.sort)\n .map((a) => a.value)\n}\n\nconst reverseIfUnshuffled = (unshuffled: any[], shuffled: any[]): any[] => {\n if (unshuffled.length === shuffled.length && unshuffled.every((val, index) => val === shuffled[index])) {\n return shuffled.reverse()\n }\n\n return shuffled\n}\n\nexport const getDisplayOrderChoices = (question: MultipleSurveyQuestion): string[] => {\n if (!question.shuffleOptions) {\n return question.choices\n }\n\n const displayOrderChoices = question.choices\n let openEndedChoice = ''\n if (question.hasOpenChoice) {\n // if the question has an open-ended choice, its always the last element in the choices array.\n openEndedChoice = displayOrderChoices.pop()!\n }\n\n const shuffledOptions = reverseIfUnshuffled(displayOrderChoices, shuffle(displayOrderChoices))\n\n if (question.hasOpenChoice) {\n question.choices.push(openEndedChoice)\n shuffledOptions.push(openEndedChoice)\n }\n\n return shuffledOptions\n}\n\nexport const getDisplayOrderQuestions = (survey: Survey): SurveyQuestion[] => {\n if (!survey.appearance || !survey.appearance.shuffleQuestions || survey.enable_partial_responses) {\n return survey.questions\n }\n\n return reverseIfUnshuffled(survey.questions, shuffle(survey.questions))\n}\n\nexport const hasEvents = (survey: Pick<Survey, 'conditions'>): boolean => {\n return survey.conditions?.events?.values?.length != undefined && survey.conditions?.events?.values?.length > 0\n}\n\nexport const canActivateRepeatedly = (\n survey: Pick<Survey, 'schedule' | 'conditions' | 'id' | 'current_iteration'>\n): boolean => {\n return (\n !!(survey.conditions?.events?.repeatedActivation && hasEvents(survey)) ||\n survey.schedule === SurveySchedule.Always ||\n isSurveyInProgress(survey)\n )\n}\n\n/**\n * getSurveySeen checks local storage for the surveySeen Key a\n * and overrides this value if the survey can be repeatedly activated by its events.\n * @param survey\n */\nexport const getSurveySeen = (survey: Survey): boolean => {\n const surveySeen = localStorage.getItem(getSurveySeenKey(survey))\n if (surveySeen) {\n // if a survey has already been seen,\n // we will override it with the event repeated activation value.\n return !canActivateRepeatedly(survey)\n }\n\n return false\n}\n\nconst LAST_SEEN_SURVEY_DATE_KEY = 'lastSeenSurveyDate'\n\nexport const hasWaitPeriodPassed = (waitPeriodInDays: number | undefined): boolean => {\n const lastSeenSurveyDate = localStorage.getItem(LAST_SEEN_SURVEY_DATE_KEY)\n if (!waitPeriodInDays || !lastSeenSurveyDate) {\n return true\n }\n\n const today = new Date()\n const diff = Math.abs(today.getTime() - new Date(lastSeenSurveyDate).getTime())\n const diffDaysFromToday = Math.ceil(diff / (1000 * 3600 * 24))\n return diffDaysFromToday > waitPeriodInDays\n}\n\ninterface SurveyContextProps {\n isPreviewMode: boolean\n previewPageIndex: number | undefined\n onPopupSurveyDismissed: () => void\n isPopup: boolean\n onPreviewSubmit: (res: string | string[] | number | null) => void\n surveySubmissionId: string\n}\n\nexport const SurveyContext = createContext<SurveyContextProps>({\n isPreviewMode: false,\n previewPageIndex: 0,\n onPopupSurveyDismissed: () => {},\n isPopup: true,\n onPreviewSubmit: () => {},\n surveySubmissionId: '',\n})\n\nexport const useSurveyContext = () => {\n return useContext(SurveyContext)\n}\n\ninterface RenderProps {\n component: VNode<{ className: string }>\n children: string\n renderAsHtml?: boolean\n style?: JSX.CSSProperties\n}\n\nexport const renderChildrenAsTextOrHtml = ({ component, children, renderAsHtml, style }: RenderProps) => {\n return renderAsHtml\n ? cloneElement(component, {\n dangerouslySetInnerHTML: { __html: children },\n style,\n })\n : cloneElement(component, {\n children,\n style,\n })\n}\n\nfunction defaultMatchType(matchType?: PropertyMatchType): PropertyMatchType {\n return matchType ?? 'icontains'\n}\n\n// use urlMatchType to validate url condition, fallback to contains for backwards compatibility\nexport function doesSurveyUrlMatch(survey: Pick<Survey, 'conditions'>): boolean {\n if (!survey.conditions?.url) {\n return true\n }\n // if we dont know the url, assume it is not a match\n const href = window?.location?.href\n if (!href) {\n return false\n }\n const targets = [survey.conditions.url]\n const matchType = defaultMatchType(survey.conditions?.urlMatchType)\n return propertyComparisons[matchType](targets, [href])\n}\n\nexport function doesSurveyDeviceTypesMatch(survey: Survey): boolean {\n if (!survey.conditions?.deviceTypes || survey.conditions?.deviceTypes.length === 0) {\n return true\n }\n // if we dont know the device type, assume it is not a match\n if (!userAgent) {\n return false\n }\n\n const deviceType = detectDeviceType(userAgent)\n return propertyComparisons[defaultMatchType(survey.conditions?.deviceTypesMatchType)](\n survey.conditions.deviceTypes,\n [deviceType]\n )\n}\n\nexport function doesSurveyMatchSelector(survey: Survey): boolean {\n if (!survey.conditions?.selector) {\n return true\n }\n return !!document?.querySelector(survey.conditions.selector)\n}\n\ninterface InProgressSurveyState {\n surveySubmissionId: string\n lastQuestionIndex: number\n responses: Record<string, string | number | string[] | null>\n}\n\nconst getInProgressSurveyStateKey = (survey: Pick<Survey, 'id' | 'current_iteration'>): string => {\n let key = `${SURVEY_IN_PROGRESS_PREFIX}${survey.id}`\n if (survey.current_iteration && survey.current_iteration > 0) {\n key = `${SURVEY_IN_PROGRESS_PREFIX}${survey.id}_${survey.current_iteration}`\n }\n return key\n}\n\nexport const setInProgressSurveyState = (\n survey: Pick<Survey, 'id' | 'current_iteration'>,\n state: InProgressSurveyState\n): void => {\n try {\n localStorage.setItem(getInProgressSurveyStateKey(survey), JSON.stringify(state))\n } catch (e) {\n logger.error('Error setting in-progress survey state in localStorage', e)\n }\n}\n\nexport const getInProgressSurveyState = (\n survey: Pick<Survey, 'id' | 'current_iteration'>\n): InProgressSurveyState | null => {\n try {\n const stateString = localStorage.getItem(getInProgressSurveyStateKey(survey))\n if (stateString) {\n return JSON.parse(stateString) as InProgressSurveyState\n }\n } catch (e) {\n logger.error('Error getting in-progress survey state from localStorage', e)\n }\n return null\n}\n\nexport const isSurveyInProgress = (survey: Pick<Survey, 'id' | 'current_iteration'>): boolean => {\n const state = getInProgressSurveyState(survey)\n return !isNullish(state?.surveySubmissionId)\n}\n\nexport const clearInProgressSurveyState = (survey: Pick<Survey, 'id' | 'current_iteration'>): void => {\n try {\n localStorage.removeItem(getInProgressSurveyStateKey(survey))\n } catch (e) {\n logger.error('Error clearing in-progress survey state from localStorage', e)\n }\n}\n\nexport function getSurveyContainerClass(survey: Pick<Survey, 'id'>, asSelector = false): string {\n const className = `PostHogSurvey-${survey.id}`\n return asSelector ? `.${className}` : className\n}\n","import {\n ProductTourAppearance,\n ProductTourSelectorError,\n DEFAULT_PRODUCT_TOUR_APPEARANCE,\n} from '../../posthog-product-tours-types'\nimport { prepareStylesheet } from '../utils/stylesheet-loader'\nimport { document as _document, window as _window } from '../../utils/globals'\nimport { getFontFamily, getContrastingTextColor, hexToRgba } from '../surveys/surveys-extension-utils'\n\nimport productTourStyles from './product-tour.css'\n\nconst document = _document as Document\nconst window = _window as Window & typeof globalThis\n\nexport function getProductTourStylesheet(): HTMLStyleElement | null {\n const stylesheet = prepareStylesheet(document, typeof productTourStyles === 'string' ? productTourStyles : '')\n stylesheet?.setAttribute('data-ph-product-tour-style', 'true')\n return stylesheet\n}\n\nexport interface ElementFindResult {\n element: HTMLElement | null\n error: ProductTourSelectorError | null\n matchCount: number\n}\n\nexport function findElementBySelector(selector: string): ElementFindResult {\n try {\n const elements = document.querySelectorAll(selector)\n\n if (elements.length === 0) {\n return { element: null, error: 'not_found', matchCount: 0 }\n }\n\n const element = elements[0] as HTMLElement\n\n if (!isElementVisible(element)) {\n return { element: null, error: 'not_visible', matchCount: elements.length }\n }\n\n if (elements.length > 1) {\n return { element, error: 'multiple_matches', matchCount: elements.length }\n }\n\n return { element, error: null, matchCount: 1 }\n } catch {\n return { element: null, error: 'not_found', matchCount: 0 }\n }\n}\n\nexport function isElementVisible(element: HTMLElement): boolean {\n const style = window.getComputedStyle(element)\n\n if (style.display === 'none' || style.visibility === 'hidden' || style.opacity === '0') {\n return false\n }\n\n const rect = element.getBoundingClientRect()\n if (rect.width === 0 || rect.height === 0) {\n return false\n }\n\n return true\n}\n\nexport function getElementMetadata(element: HTMLElement): {\n tag: string\n id: string | undefined\n classes: string | undefined\n text: string | undefined\n} {\n return {\n tag: element.tagName,\n id: element.id || undefined,\n classes: element.className || undefined,\n text: element.innerText?.slice(0, 100) || undefined,\n }\n}\n\nexport type TooltipPosition = 'top' | 'bottom' | 'left' | 'right'\n\nexport interface PositionResult {\n top: number\n left: number\n position: TooltipPosition\n}\n\nconst TOOLTIP_MARGIN = 12\nconst TOOLTIP_WIDTH = 320\nconst TOOLTIP_HEIGHT_ESTIMATE = 180\n\nexport function calculateTooltipPosition(targetRect: DOMRect): PositionResult {\n const viewportWidth = window.innerWidth\n const viewportHeight = window.innerHeight\n\n const spaceBelow = viewportHeight - targetRect.bottom\n const spaceLeft = targetRect.left\n const spaceRight = viewportWidth - targetRect.right\n\n let position: TooltipPosition\n let top: number\n let left: number\n\n if (spaceRight >= TOOLTIP_WIDTH + TOOLTIP_MARGIN) {\n position = 'right'\n top = targetRect.top + targetRect.height / 2 - TOOLTIP_HEIGHT_ESTIMATE / 2\n left = targetRect.right + TOOLTIP_MARGIN\n } else if (spaceLeft >= TOOLTIP_WIDTH + TOOLTIP_MARGIN) {\n position = 'left'\n top = targetRect.top + targetRect.height / 2 - TOOLTIP_HEIGHT_ESTIMATE / 2\n left = targetRect.left - TOOLTIP_WIDTH - TOOLTIP_MARGIN\n } else if (spaceBelow >= TOOLTIP_HEIGHT_ESTIMATE + TOOLTIP_MARGIN) {\n position = 'bottom'\n top = targetRect.bottom + TOOLTIP_MARGIN\n left = targetRect.left + targetRect.width / 2 - TOOLTIP_WIDTH / 2\n } else {\n position = 'top'\n top = targetRect.top - TOOLTIP_HEIGHT_ESTIMATE - TOOLTIP_MARGIN\n left = targetRect.left + targetRect.width / 2 - TOOLTIP_WIDTH / 2\n }\n\n return { top, left, position }\n}\n\nexport function getSpotlightStyle(targetRect: DOMRect, padding: number = 8): Record<string, string> {\n return {\n top: `${targetRect.top - padding}px`,\n left: `${targetRect.left - padding}px`,\n width: `${targetRect.width + padding * 2}px`,\n height: `${targetRect.height + padding * 2}px`,\n }\n}\n\nexport function addProductTourCSSVariablesToElement(element: HTMLElement, appearance?: ProductTourAppearance): void {\n const merged = { ...DEFAULT_PRODUCT_TOUR_APPEARANCE, ...appearance }\n const style = element.style\n\n // User-customizable variables\n style.setProperty('--ph-tour-background-color', merged.backgroundColor)\n style.setProperty('--ph-tour-text-color', merged.textColor)\n style.setProperty('--ph-tour-button-color', merged.buttonColor)\n style.setProperty('--ph-tour-border-radius', `${merged.borderRadius}px`)\n style.setProperty('--ph-tour-button-border-radius', `${merged.buttonBorderRadius}px`)\n style.setProperty('--ph-tour-border-color', merged.borderColor)\n style.setProperty('--ph-tour-font-family', getFontFamily(merged.fontFamily))\n\n // Derived colors\n style.setProperty('--ph-tour-text-secondary-color', hexToRgba(merged.textColor, 0.6))\n style.setProperty('--ph-tour-branding-text-color', getContrastingTextColor(merged.backgroundColor))\n style.setProperty('--ph-tour-button-text-color', getContrastingTextColor(merged.buttonColor))\n style.setProperty('--ph-tour-box-shadow', merged.boxShadow)\n style.setProperty('--ph-tour-overlay-color', merged.showOverlay ? 'rgba(0, 0, 0, 0.5)' : 'transparent')\n\n // Internal styling variables (not customizable)\n style.setProperty('--ph-tour-button-secondary-color', 'transparent')\n style.setProperty('--ph-tour-button-secondary-text-color', merged.textColor)\n style.setProperty('--ph-tour-max-width', '320px')\n style.setProperty('--ph-tour-padding', '16px')\n}\n\nexport function renderTipTapContent(content: any): string {\n if (!content) {\n return ''\n }\n\n if (typeof content === 'string') {\n return escapeHtml(content)\n }\n\n if (content.type === 'text') {\n let text = escapeHtml(content.text || '')\n\n if (content.marks) {\n for (const mark of content.marks) {\n switch (mark.type) {\n case 'bold':\n text = `<strong>${text}</strong>`\n break\n case 'italic':\n text = `<em>${text}</em>`\n break\n case 'underline':\n text = `<u>${text}</u>`\n break\n case 'strike':\n text = `<s>${text}</s>`\n break\n }\n }\n }\n\n return text\n }\n\n const children = content.content?.map(renderTipTapContent).join('') || ''\n\n switch (content.type) {\n case 'doc':\n return children\n case 'paragraph':\n return `<p>${children}</p>`\n case 'heading': {\n const level = content.attrs?.level || 1\n return `<h${level}>${children}</h${level}>`\n }\n case 'bulletList':\n return `<ul>${children}</ul>`\n case 'orderedList':\n return `<ol>${children}</ol>`\n case 'listItem':\n return `<li>${children}</li>`\n case 'hardBreak':\n return '<br>'\n default:\n return children\n }\n}\n\nexport function normalizeUrl(url: string): string {\n return url.endsWith('/') ? url.slice(0, -1) : url\n}\n\nfunction escapeHtml(text: string): string {\n const div = document.createElement('div')\n div.textContent = text\n return div.innerHTML\n}\n","import { h } from 'preact'\nimport { ProductTourStep, ProductTourAppearance } from '../../../posthog-product-tours-types'\nimport { renderTipTapContent } from '../product-tours-utils'\nimport { IconPosthogLogo, cancelSVG } from '../../surveys/icons'\n\nexport interface ProductTourTooltipInnerProps {\n step: ProductTourStep\n appearance?: ProductTourAppearance\n stepIndex: number\n totalSteps: number\n onNext?: () => void\n onPrevious?: () => void\n onDismiss?: () => void\n}\n\nexport function ProductTourTooltipInner({\n step,\n appearance,\n stepIndex,\n totalSteps,\n onNext,\n onPrevious,\n onDismiss,\n}: ProductTourTooltipInnerProps): h.JSX.Element {\n const whiteLabel = appearance?.whiteLabel ?? false\n const isLastStep = stepIndex >= totalSteps - 1\n const isFirstStep = stepIndex === 0\n const showNextButton = step.progressionTrigger === 'button' || step.type === 'modal'\n\n const isInteractive = !!(onNext || onPrevious || onDismiss)\n const cursorStyle = isInteractive ? undefined : { cursor: 'default' }\n\n return (\n <>\n <button class=\"ph-tour-dismiss\" onClick={onDismiss} aria-label=\"Close tour\" style={cursorStyle}>\n {cancelSVG}\n </button>\n\n <div class=\"ph-tour-content\" dangerouslySetInnerHTML={{ __html: renderTipTapContent(step.content) }} />\n\n <div class=\"ph-tour-footer\">\n <span class=\"ph-tour-progress\">\n {stepIndex + 1} of {totalSteps}\n </span>\n\n <div class=\"ph-tour-buttons\">\n {!isFirstStep && (\n <button\n class=\"ph-tour-button ph-tour-button--secondary\"\n onClick={onPrevious}\n style={cursorStyle}\n >\n Back\n </button>\n )}\n {showNextButton && (\n <button class=\"ph-tour-button ph-tour-button--primary\" onClick={onNext} style={cursorStyle}>\n {isLastStep ? 'Done' : 'Next'}\n </button>\n )}\n </div>\n </div>\n\n {!whiteLabel && (\n <a\n href={isInteractive ? 'https://posthog.com/product-tours' : undefined}\n target={isInteractive ? '_blank' : undefined}\n rel={isInteractive ? 'noopener noreferrer' : undefined}\n class=\"ph-tour-branding\"\n style={isInteractive ? undefined : { cursor: 'default', pointerEvents: 'none' }}\n >\n Tour by {IconPosthogLogo}\n </a>\n )}\n </>\n )\n}\n","import { render, JSX } from 'preact'\n\nimport { ProductTourStep, ProductTourAppearance } from '../../posthog-product-tours-types'\nimport { document as _document } from '../../utils/globals'\nimport { ProductTourSurveyStepInner } from './components/ProductTourSurveyStepInner'\nimport { ProductTourTooltipInner } from './components/ProductTourTooltipInner'\nimport { getProductTourStylesheet, addProductTourCSSVariablesToElement } from './product-tours-utils'\n\nconst document = _document as Document\n\nexport interface RenderProductTourPreviewOptions {\n step: ProductTourStep\n appearance?: ProductTourAppearance\n parentElement: HTMLElement\n stepIndex?: number\n totalSteps?: number\n style?: JSX.CSSProperties\n}\n\nexport function renderProductTourPreview({\n step,\n appearance,\n parentElement,\n stepIndex = 0,\n totalSteps = 1,\n style,\n}: RenderProductTourPreviewOptions): void {\n parentElement.innerHTML = ''\n\n const shadowHost = document.createElement('div')\n addProductTourCSSVariablesToElement(shadowHost, appearance)\n parentElement.appendChild(shadowHost)\n const shadow = shadowHost.attachShadow({ mode: 'open' })\n\n const stylesheet = getProductTourStylesheet()\n if (stylesheet) {\n shadow.appendChild(stylesheet)\n }\n\n const renderTarget = document.createElement('div')\n shadow.appendChild(renderTarget)\n\n const isSurveyStep = step.type === 'survey'\n const tooltipClass = isSurveyStep ? 'ph-tour-tooltip ph-tour-survey-step' : 'ph-tour-tooltip'\n\n render(\n <div class=\"ph-tour-container\">\n <div class={tooltipClass} style={{ position: 'relative', animation: 'none', ...style }}>\n {isSurveyStep ? (\n <ProductTourSurveyStepInner\n step={step}\n appearance={appearance}\n stepIndex={stepIndex}\n totalSteps={totalSteps}\n />\n ) : (\n <ProductTourTooltipInner\n step={step}\n appearance={appearance}\n stepIndex={stepIndex}\n totalSteps={totalSteps}\n />\n )}\n </div>\n </div>,\n renderTarget\n )\n}\n"],"names":["c","s","a","win","window","undefined","global","globalThis","self","File","navigator","document","location","fetch","XMLHttpRequest","AbortController","userAgent","t","r","u","i","assignableWindow","o","f","e","n","__b","__r","v","diffed","l","__c","m","unmount","d","__h","__H","__","length","push","__V","h","B","__N","setState","filter","every","call","this","forEach","props","shouldComponentUpdate","componentWillUpdate","__e","_","z","F","current","b","shift","__P","k","w","__v","requestAnimationFrame","j","some","g","clearTimeout","cancelAnimationFrame","setTimeout","satisfiedEmoji","_jsx","className","xmlns","height","viewBox","width","children","neutralEmoji","dissatisfiedEmoji","veryDissatisfiedEmoji","verySatisfiedEmoji","cancelSVG","_jsxs","fill","id","IconPosthogLogo","style","maskType","maskUnits","x","y","mask","transform","threeScaleEmojis","fiveScaleEmojis","OpenTextInput","_ref","value","onChange","onSubmit","isInteractive","inputRef","useRef","__s","useEffect","_inputRef$current","focus","ref","class","rows","placeholder","onInput","target","onKeyDown","key","metaKey","preventDefault","disabled","cursor","RatingInput","_ref2","survey","selectedRating","setSelectedRating","useState","display","scale","handleSelect","rating","map","emoji","idx","type","onClick","lowerBoundLabel","upperBoundLabel","numbers","getScaleNumbers","gridTemplateColumns","num","ProductTourSurveyStepInner","_ref3","_appearance$whiteLabe","step","appearance","stepIndex","totalSteps","onPrevious","onDismiss","textValue","setTextValue","whiteLabel","isFirstStep","isOpenText","cursorStyle","handleTextSubmit","trim","_Fragment","questionText","href","rel","pointerEvents","DEFAULT_PRODUCT_TOUR_APPEARANCE","backgroundColor","textColor","buttonColor","borderRadius","buttonBorderRadius","borderColor","fontFamily","boxShadow","showOverlay","_createLogger","prefix","_temp","debugEnabled","logger","_log","level","POSTHOG_DEBUG","isUndefined","console","consoleLog","_len","arguments","args","Array","_key","info","_len2","_key2","warn","_len3","_key3","error","_len4","_key4","critical","_len5","_key5","uninitializedWarning","methodName","createLogger","additionalPrefix","options","prepareStylesheet","innerText","posthog","stylesheet","createElement","sendBeacon","BLACK_TEXT_COLOR","defaultSurveyAppearance","hex2rgb","startsWith","hexColor","replace","test","parseInt","slice","getContrastingTextColor","color","rgb","nameColorToHex","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","honeydew","hotpink","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgrey","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen","toLowerCase","colorMatch","match","Math","sqrt","createContext","isPreviewMode","previewPageIndex","onPopupSurveyDismissed","isPopup","onPreviewSubmit","surveySubmissionId","_document","addProductTourCSSVariablesToElement","element","hex","opacity","merged","_extends","setProperty","defaultFontStack","getFontFamily","renderTipTapContent","content","_content$content","escapeHtml","text","marks","mark","join","_content$attrs","attrs","div","textContent","innerHTML","ProductTourTooltipInner","onNext","isLastStep","showNextButton","progressionTrigger","dangerouslySetInnerHTML","__html","renderProductTourPreview","parentElement","shadowHost","appendChild","shadow","attachShadow","mode","productTourStyles","setAttribute","getProductTourStylesheet","renderTarget","isSurveyStep","render","position","animation"],"mappings":"wNACa,oBAWAA,EAAgC,CAAA,EAChCC,EAAY,GACZC,EACZ,qoCAd2B,sCAAA,uoBAML,8EAFK,sFAAA,qIAEL,gTAFK,oeAEL,qEAAA,iFAAA,mxCAJO,iBAFF,kyDASF,sGATE,gzGCmC5B,IAAMC,EAAkE,oBAAXC,OAAyBA,YAASC,EAyNzFC,EAA8D,oBAAfC,WAA6BA,WAAaJ,EAG3E,oBAATK,OACLF,EAAeE,KAAOF,GAER,oBAATG,OACLH,EAAeG,KAAO,WAAa,GAOlC,IAAMC,EAAkB,MAANJ,OAAM,EAANA,EAAQI,UACpBC,EAAiB,MAANL,OAAM,EAANA,EAAQK,SACF,MAANL,GAAAA,EAAQM,SACL,MAANN,GAAAA,EAAQO,YAEzBP,GAAAA,EAAQQ,gBAAkB,oBAAqB,IAAIR,EAAOQ,gBAAmBR,EAAOQ,eACnD,MAANR,GAAAA,EAAQS,gBACL,MAATL,GAAAA,EAAWM,UAC7B,IChRHC,EAGAC,EAGAC,EAiBAC,EDyPSC,EAAqClB,QAAAA,EAAQ,CAAA,ECvQtDmB,EAAc,EAGdC,EAAoB,GAEpBvB,EAAQ,GAERwB,EAAgBC,EAApBC,IACIxB,EAAkBuB,EAAtBE,IACIC,EAAeH,EAAQI,OACvBC,EAAYL,EAAhBM,IACIC,EAAmBP,EAAQQ,QAqG/B,SAASC,GAAajB,EAAO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8B,GAAwBrT,GAOE,IAPD+C,KACrCA,EAAIC,WACJA,EAAUsQ,cACVA,EAAarQ,UACbA,EAAY,EAACC,WACbA,EAAa,EAAC5D,MACdA,GAC8BU,EAC9BsT,EAAcT,UAAY,GAE1B,IAAMU,EAAa9Y,GAASwM,cAAc,OAC1CuK,GAAoC+B,EAAYvQ,GAChDsQ,EAAcE,YAAYD,GAC1B,IAAME,EAASF,EAAWG,aAAa,CAAEC,KAAM,SAEzC3M,EFpBH,WACH,IAAMA,EAAaH,GAAkBpM,GAAkDmZ,IAEvF,OADU,MAAV5M,GAAAA,EAAY6M,aAAa,6BAA8B,QAChD7M,CACX,CEgBuB8M,GACf9M,GACAyM,EAAOD,YAAYxM,GAGvB,IAAM+M,EAAetZ,GAASwM,cAAc,OAC5CwM,EAAOD,YAAYO,GAEnB,IAAMC,EAA6B,WAAdjR,EAAKX,KAG1B6R,EACI3V,GAAA,MAAA,CAAKsC,MAAM,oBAAmBhC,SAC1BN,GAAA,MAAA,CAAKsC,MAJQoT,EAAe,sCAAwC,kBAI1C1U,MAAKuS,EAAA,CAAIqC,SAAU,WAAYC,UAAW,QAAW7U,GAAQV,SAE/EN,GADH0V,EACIpR,GAOAkQ,GAP0B,CACvB/P,KAAMA,EACNC,WAAYA,EACZC,UAAWA,EACXC,WAAYA,QAY5B6Q,EAER","x_google_ignoreList":[0,2]}
|
|
1
|
+
{"version":3,"file":"product-tours-preview.js","sources":["../../../node_modules/.pnpm/preact@10.19.3/node_modules/preact/dist/preact.module.js","../src/utils/globals.ts","../../../node_modules/.pnpm/preact@10.19.3/node_modules/preact/hooks/dist/hooks.module.js","../src/extensions/surveys/icons.tsx","../src/extensions/product-tours/components/ProductTourSurveyStepInner.tsx","../../../node_modules/.pnpm/dompurify@3.3.1/node_modules/dompurify/dist/purify.es.mjs","../src/posthog-product-tours-types.ts","../src/utils/logger.ts","../../core/dist/utils/type-utils.mjs","../src/extensions/utils/stylesheet-loader.ts","../src/utils/survey-utils.ts","../src/request.ts","../src/extensions/surveys/surveys-extension-utils.tsx","../src/extensions/product-tours/product-tours-utils.ts","../src/extensions/product-tours/components/ProductTourTooltipInner.tsx","../src/extensions/product-tours/preview.tsx"],"sourcesContent":["var n,l,u,t,i,o,r,f,e,c={},s=[],a=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,h=Array.isArray;function v(n,l){for(var u in l)n[u]=l[u];return n}function p(n){var l=n.parentNode;l&&l.removeChild(n)}function y(l,u,t){var i,o,r,f={};for(r in u)\"key\"==r?i=u[r]:\"ref\"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):t),\"function\"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return d(l,f,i,o,null)}function d(n,t,i,o,r){var f={type:n,props:t,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==r?++u:r,__i:-1,__u:0};return null==r&&null!=l.vnode&&l.vnode(f),f}function _(){return{current:null}}function g(n){return n.children}function b(n,l){this.props=n,this.context=l}function m(n,l){if(null==l)return n.__?m(n.__,n.__i+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return\"function\"==typeof n.type?m(n):null}function k(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return k(n)}}function w(n){(!n.__d&&(n.__d=!0)&&i.push(n)&&!x.__r++||o!==l.debounceRendering)&&((o=l.debounceRendering)||r)(x)}function x(){var n,u,t,o,r,e,c,s,a;for(i.sort(f);n=i.shift();)n.__d&&(u=i.length,o=void 0,e=(r=(t=n).__v).__e,s=[],a=[],(c=t.__P)&&((o=v({},r)).__v=r.__v+1,l.vnode&&l.vnode(o),L(c,o,r,t.__n,void 0!==c.ownerSVGElement,32&r.__u?[e]:null,s,null==e?m(r):e,!!(32&r.__u),a),o.__.__k[o.__i]=o,M(s,o,a),o.__e!=e&&k(o)),i.length>u&&i.sort(f));x.__r=0}function C(n,l,u,t,i,o,r,f,e,a,h){var v,p,y,d,_,g=t&&t.__k||s,b=l.length;for(u.__d=e,P(u,l,g),e=u.__d,v=0;v<b;v++)null!=(y=u.__k[v])&&\"boolean\"!=typeof y&&\"function\"!=typeof y&&(p=-1===y.__i?c:g[y.__i]||c,y.__i=v,L(n,y,p,i,o,r,f,e,a,h),d=y.__e,y.ref&&p.ref!=y.ref&&(p.ref&&z(p.ref,null,y),h.push(y.ref,y.__c||d,y)),null==_&&null!=d&&(_=d),65536&y.__u||p.__k===y.__k?e=S(y,e,n):\"function\"==typeof y.type&&void 0!==y.__d?e=y.__d:d&&(e=d.nextSibling),y.__d=void 0,y.__u&=-196609);u.__d=e,u.__e=_}function P(n,l,u){var t,i,o,r,f,e=l.length,c=u.length,s=c,a=0;for(n.__k=[],t=0;t<e;t++)null!=(i=n.__k[t]=null==(i=l[t])||\"boolean\"==typeof i||\"function\"==typeof i?null:\"string\"==typeof i||\"number\"==typeof i||\"bigint\"==typeof i||i.constructor==String?d(null,i,null,null,i):h(i)?d(g,{children:i},null,null,null):void 0===i.constructor&&i.__b>0?d(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i)?(i.__=n,i.__b=n.__b+1,f=H(i,u,r=t+a,s),i.__i=f,o=null,-1!==f&&(s--,(o=u[f])&&(o.__u|=131072)),null==o||null===o.__v?(-1==f&&a--,\"function\"!=typeof i.type&&(i.__u|=65536)):f!==r&&(f===r+1?a++:f>r?s>e-r?a+=f-r:a--:a=f<r&&f==r-1?f-r:0,f!==t+a&&(i.__u|=65536))):(o=u[t])&&null==o.key&&o.__e&&(o.__e==n.__d&&(n.__d=m(o)),N(o,o,!1),u[t]=null,s--);if(s)for(t=0;t<c;t++)null!=(o=u[t])&&0==(131072&o.__u)&&(o.__e==n.__d&&(n.__d=m(o)),N(o,o))}function S(n,l,u){var t,i;if(\"function\"==typeof n.type){for(t=n.__k,i=0;t&&i<t.length;i++)t[i]&&(t[i].__=n,l=S(t[i],l,u));return l}return n.__e!=l&&(u.insertBefore(n.__e,l||null),l=n.__e),l&&l.nextSibling}function $(n,l){return l=l||[],null==n||\"boolean\"==typeof n||(h(n)?n.some(function(n){$(n,l)}):l.push(n)),l}function H(n,l,u,t){var i=n.key,o=n.type,r=u-1,f=u+1,e=l[u];if(null===e||e&&i==e.key&&o===e.type)return u;if(t>(null!=e&&0==(131072&e.__u)?1:0))for(;r>=0||f<l.length;){if(r>=0){if((e=l[r])&&0==(131072&e.__u)&&i==e.key&&o===e.type)return r;r--}if(f<l.length){if((e=l[f])&&0==(131072&e.__u)&&i==e.key&&o===e.type)return f;f++}}return-1}function I(n,l,u){\"-\"===l[0]?n.setProperty(l,null==u?\"\":u):n[l]=null==u?\"\":\"number\"!=typeof u||a.test(l)?u:u+\"px\"}function T(n,l,u,t,i){var o;n:if(\"style\"===l)if(\"string\"==typeof u)n.style.cssText=u;else{if(\"string\"==typeof t&&(n.style.cssText=t=\"\"),t)for(l in t)u&&l in u||I(n.style,l,\"\");if(u)for(l in u)t&&u[l]===t[l]||I(n.style,l,u[l])}else if(\"o\"===l[0]&&\"n\"===l[1])o=l!==(l=l.replace(/(PointerCapture)$|Capture$/,\"$1\")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?t?u.u=t.u:(u.u=Date.now(),n.addEventListener(l,o?D:A,o)):n.removeEventListener(l,o?D:A,o);else{if(i)l=l.replace(/xlink(H|:h)/,\"h\").replace(/sName$/,\"s\");else if(\"width\"!==l&&\"height\"!==l&&\"href\"!==l&&\"list\"!==l&&\"form\"!==l&&\"tabIndex\"!==l&&\"download\"!==l&&\"rowSpan\"!==l&&\"colSpan\"!==l&&\"role\"!==l&&l in n)try{n[l]=null==u?\"\":u;break n}catch(n){}\"function\"==typeof u||(null==u||!1===u&&\"-\"!==l[4]?n.removeAttribute(l):n.setAttribute(l,u))}}function A(n){var u=this.l[n.type+!1];if(n.t){if(n.t<=u.u)return}else n.t=Date.now();return u(l.event?l.event(n):n)}function D(n){return this.l[n.type+!0](l.event?l.event(n):n)}function L(n,u,t,i,o,r,f,e,c,s){var a,p,y,d,_,m,k,w,x,P,S,$,H,I,T,A=u.type;if(void 0!==u.constructor)return null;128&t.__u&&(c=!!(32&t.__u),r=[e=u.__e=t.__e]),(a=l.__b)&&a(u);n:if(\"function\"==typeof A)try{if(w=u.props,x=(a=A.contextType)&&i[a.__c],P=a?x?x.props.value:a.__:i,t.__c?k=(p=u.__c=t.__c).__=p.__E:(\"prototype\"in A&&A.prototype.render?u.__c=p=new A(w,P):(u.__c=p=new b(w,P),p.constructor=A,p.render=O),x&&x.sub(p),p.props=w,p.state||(p.state={}),p.context=P,p.__n=i,y=p.__d=!0,p.__h=[],p._sb=[]),null==p.__s&&(p.__s=p.state),null!=A.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=v({},p.__s)),v(p.__s,A.getDerivedStateFromProps(w,p.__s))),d=p.props,_=p.state,p.__v=u,y)null==A.getDerivedStateFromProps&&null!=p.componentWillMount&&p.componentWillMount(),null!=p.componentDidMount&&p.__h.push(p.componentDidMount);else{if(null==A.getDerivedStateFromProps&&w!==d&&null!=p.componentWillReceiveProps&&p.componentWillReceiveProps(w,P),!p.__e&&(null!=p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(w,p.__s,P)||u.__v===t.__v)){for(u.__v!==t.__v&&(p.props=w,p.state=p.__s,p.__d=!1),u.__e=t.__e,u.__k=t.__k,u.__k.forEach(function(n){n&&(n.__=u)}),S=0;S<p._sb.length;S++)p.__h.push(p._sb[S]);p._sb=[],p.__h.length&&f.push(p);break n}null!=p.componentWillUpdate&&p.componentWillUpdate(w,p.__s,P),null!=p.componentDidUpdate&&p.__h.push(function(){p.componentDidUpdate(d,_,m)})}if(p.context=P,p.props=w,p.__P=n,p.__e=!1,$=l.__r,H=0,\"prototype\"in A&&A.prototype.render){for(p.state=p.__s,p.__d=!1,$&&$(u),a=p.render(p.props,p.state,p.context),I=0;I<p._sb.length;I++)p.__h.push(p._sb[I]);p._sb=[]}else do{p.__d=!1,$&&$(u),a=p.render(p.props,p.state,p.context),p.state=p.__s}while(p.__d&&++H<25);p.state=p.__s,null!=p.getChildContext&&(i=v(v({},i),p.getChildContext())),y||null==p.getSnapshotBeforeUpdate||(m=p.getSnapshotBeforeUpdate(d,_)),C(n,h(T=null!=a&&a.type===g&&null==a.key?a.props.children:a)?T:[T],u,t,i,o,r,f,e,c,s),p.base=u.__e,u.__u&=-161,p.__h.length&&f.push(p),k&&(p.__E=p.__=null)}catch(n){u.__v=null,c||null!=r?(u.__e=e,u.__u|=c?160:32,r[r.indexOf(e)]=null):(u.__e=t.__e,u.__k=t.__k),l.__e(n,u,t)}else null==r&&u.__v===t.__v?(u.__k=t.__k,u.__e=t.__e):u.__e=j(t.__e,u,t,i,o,r,f,c,s);(a=l.diffed)&&a(u)}function M(n,u,t){u.__d=void 0;for(var i=0;i<t.length;i++)z(t[i],t[++i],t[++i]);l.__c&&l.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u)})}catch(n){l.__e(n,u.__v)}})}function j(l,u,t,i,o,r,f,e,s){var a,v,y,d,_,g,b,k=t.props,w=u.props,x=u.type;if(\"svg\"===x&&(o=!0),null!=r)for(a=0;a<r.length;a++)if((_=r[a])&&\"setAttribute\"in _==!!x&&(x?_.localName===x:3===_.nodeType)){l=_,r[a]=null;break}if(null==l){if(null===x)return document.createTextNode(w);l=o?document.createElementNS(\"http://www.w3.org/2000/svg\",x):document.createElement(x,w.is&&w),r=null,e=!1}if(null===x)k===w||e&&l.data===w||(l.data=w);else{if(r=r&&n.call(l.childNodes),k=t.props||c,!e&&null!=r)for(k={},a=0;a<l.attributes.length;a++)k[(_=l.attributes[a]).name]=_.value;for(a in k)_=k[a],\"children\"==a||(\"dangerouslySetInnerHTML\"==a?y=_:\"key\"===a||a in w||T(l,a,null,_,o));for(a in w)_=w[a],\"children\"==a?d=_:\"dangerouslySetInnerHTML\"==a?v=_:\"value\"==a?g=_:\"checked\"==a?b=_:\"key\"===a||e&&\"function\"!=typeof _||k[a]===_||T(l,a,_,k[a],o);if(v)e||y&&(v.__html===y.__html||v.__html===l.innerHTML)||(l.innerHTML=v.__html),u.__k=[];else if(y&&(l.innerHTML=\"\"),C(l,h(d)?d:[d],u,t,i,o&&\"foreignObject\"!==x,r,f,r?r[0]:t.__k&&m(t,0),e,s),null!=r)for(a=r.length;a--;)null!=r[a]&&p(r[a]);e||(a=\"value\",void 0!==g&&(g!==l[a]||\"progress\"===x&&!g||\"option\"===x&&g!==k[a])&&T(l,a,g,k[a],!1),a=\"checked\",void 0!==b&&b!==l[a]&&T(l,a,b,k[a],!1))}return l}function z(n,u,t){try{\"function\"==typeof n?n(u):n.current=u}catch(n){l.__e(n,t)}}function N(n,u,t){var i,o;if(l.unmount&&l.unmount(n),(i=n.ref)&&(i.current&&i.current!==n.__e||z(i,null,u)),null!=(i=n.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(n){l.__e(n,u)}i.base=i.__P=null,n.__c=void 0}if(i=n.__k)for(o=0;o<i.length;o++)i[o]&&N(i[o],u,t||\"function\"!=typeof n.type);t||null==n.__e||p(n.__e),n.__=n.__e=n.__d=void 0}function O(n,l,u){return this.constructor(n,u)}function q(u,t,i){var o,r,f,e;l.__&&l.__(u,t),r=(o=\"function\"==typeof i)?null:i&&i.__k||t.__k,f=[],e=[],L(t,u=(!o&&i||t).__k=y(g,null,[u]),r||c,c,void 0!==t.ownerSVGElement,!o&&i?[i]:r?null:t.firstChild?n.call(t.childNodes):null,f,!o&&i?i:r?r.__e:t.firstChild,o,e),M(f,u,e)}function B(n,l){q(n,l,B)}function E(l,u,t){var i,o,r,f,e=v({},l.props);for(r in l.type&&l.type.defaultProps&&(f=l.type.defaultProps),u)\"key\"==r?i=u[r]:\"ref\"==r?o=u[r]:e[r]=void 0===u[r]&&void 0!==f?f[r]:u[r];return arguments.length>2&&(e.children=arguments.length>3?n.call(arguments,2):t),d(l.type,e,i||l.key,o||l.ref,null)}function F(n,l){var u={__c:l=\"__cC\"+e++,__:n,Consumer:function(n,l){return n.children(l)},Provider:function(n){var u,t;return this.getChildContext||(u=[],(t={})[l]=this,this.getChildContext=function(){return t},this.shouldComponentUpdate=function(n){this.props.value!==n.value&&u.some(function(n){n.__e=!0,w(n)})},this.sub=function(n){u.push(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u.splice(u.indexOf(n),1),l&&l.call(n)}}),n.children}};return u.Provider.__=u.Consumer.contextType=u}n=s.slice,l={__e:function(n,l,u,t){for(var i,o,r;l=l.__;)if((i=l.__c)&&!i.__)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(n)),r=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(n,t||{}),r=i.__d),r)return i.__E=i}catch(l){n=l}throw n}},u=0,t=function(n){return null!=n&&null==n.constructor},b.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=v({},this.state),\"function\"==typeof n&&(n=n(v({},u),this.props)),n&&v(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),w(this))},b.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),w(this))},b.prototype.render=g,i=[],r=\"function\"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,f=function(n,l){return n.__v.__b-l.__v.__b},x.__r=0,e=0;export{b as Component,g as Fragment,E as cloneElement,F as createContext,y as createElement,_ as createRef,y as h,B as hydrate,t as isValidElement,l as options,q as render,$ as toChildArray};\n//# sourceMappingURL=preact.module.js.map\n","import type { PostHog } from '../posthog-core'\nimport { SessionIdManager } from '../sessionid'\nimport {\n DeadClicksAutoCaptureConfig,\n ExternalIntegrationKind,\n Properties,\n RemoteConfig,\n SiteAppLoader,\n SessionStartReason,\n} from '../types'\nimport type {\n ConversationsRemoteConfig,\n GetMessagesResponse,\n GetTicketsOptions,\n GetTicketsResponse,\n MarkAsReadResponse,\n SendMessageResponse,\n UserProvidedTraits,\n} from '../posthog-conversations-types'\n// only importing types here, so won't affect the bundle\n// eslint-disable-next-line posthog-js/no-external-replay-imports\nimport type { SessionRecordingStatus, TriggerType } from '../extensions/replay/external/triggerMatching'\nimport { eventWithTime } from '../extensions/replay/types/rrweb-types'\nimport { ErrorTracking } from '@posthog/core'\n\n/*\n * Global helpers to protect access to browser globals in a way that is safer for different targets\n * like DOM, SSR, Web workers etc.\n *\n * NOTE: Typically we want the \"window\" but globalThis works for both the typical browser context as\n * well as other contexts such as the web worker context. Window is still exported for any bits that explicitly require it.\n * If in doubt - export the global you need from this file and use that as an optional value. This way the code path is forced\n * to handle the case where the global is not available.\n */\n\n// eslint-disable-next-line no-restricted-globals\nconst win: (Window & typeof globalThis) | undefined = typeof window !== 'undefined' ? window : undefined\n\nexport type AssignableWindow = Window &\n typeof globalThis & {\n /*\n * Main PostHog instance\n */\n posthog: any\n\n /*\n * This is our contract between (potentially) lazily loaded extensions and the SDK\n */\n __PosthogExtensions__?: PostHogExtensions\n\n /**\n * When loading remote config, we assign it to this global configuration\n * for ease of sharing it with the rest of the SDK\n */\n _POSTHOG_REMOTE_CONFIG?: Record<\n string,\n {\n config: RemoteConfig\n siteApps: SiteAppLoader[]\n }\n >\n\n /**\n * If this is set on the window, our logger will log to the console\n * for ease of debugging. Used for testing purposes only.\n *\n * @see {Config.DEBUG} from config.ts\n */\n POSTHOG_DEBUG: any\n\n // Exposed by the browser\n doNotTrack: any\n\n // See entrypoints/customizations.full.ts\n posthogCustomizations: any\n\n /**\n * This is a legacy way to expose these functions, but we still need to support it for backwards compatibility\n * Can be removed once we drop support for 1.161.1\n *\n * See entrypoints/exception-autocapture.ts\n *\n * @deprecated use `__PosthogExtensions__.errorWrappingFunctions` instead\n */\n posthogErrorWrappingFunctions: any\n\n /**\n * This is a legacy way to expose these functions, but we still need to support it for backwards compatibility\n * Can be removed once we drop support for 1.161.1\n *\n * See entrypoints/posthog-recorder.ts\n *\n * @deprecated use `__PosthogExtensions__.rrweb` instead\n */\n rrweb: any\n\n /**\n * This is a legacy way to expose these functions, but we still need to support it for backwards compatibility\n * Can be removed once we drop support for 1.161.1\n *\n * See entrypoints/posthog-recorder.ts\n *\n * @deprecated use `__PosthogExtensions__.rrwebConsoleRecord` instead\n */\n rrwebConsoleRecord: any\n\n /**\n * This is a legacy way to expose these functions, but we still need to support it for backwards compatibility\n * Can be removed once we drop support for 1.161.1\n *\n * See entrypoints/posthog-recorder.ts\n *\n * @deprecated use `__PosthogExtensions__.getRecordNetworkPlugin` instead\n */\n getRecordNetworkPlugin: any\n\n /**\n * This is a legacy way to expose these functions, but we still need to support it for backwards compatibility\n * Can be removed once we drop support for 1.161.1\n *\n * See entrypoints/web-vitals.ts\n *\n * @deprecated use `__PosthogExtensions__.postHogWebVitalsCallbacks` instead\n */\n postHogWebVitalsCallbacks: any\n\n /**\n * This is a legacy way to expose these functions, but we still need to support it for backwards compatibility\n * Can be removed once we drop support for 1.161.1\n *\n * See entrypoints/tracing-headers.ts\n *\n * @deprecated use `__PosthogExtensions__.postHogTracingHeadersPatchFns` instead\n */\n postHogTracingHeadersPatchFns: any\n\n /**\n * This is a legacy way to expose these functions, but we still need to support it for backwards compatibility\n * Can be removed once we drop support for 1.161.1\n *\n * See entrypoints/surveys.ts\n *\n * @deprecated use `__PosthogExtensions__.generateSurveys` instead\n */\n extendPostHogWithSurveys: any\n\n /*\n * These are used to handle our toolbar state.\n * @see {Toolbar} from extensions/toolbar.ts\n */\n ph_load_toolbar: any\n ph_load_editor: any\n ph_toolbar_state: any\n } & Record<`__$$ph_site_app_${string}`, any>\n\n/**\n * This is our contract between (potentially) lazily loaded extensions and the SDK\n * changes to this interface can be breaking changes for users of the SDK\n */\n\nexport type ExternalExtensionKind = 'intercom-integration' | 'crisp-chat-integration'\n\nexport type PostHogExtensionKind =\n | 'toolbar'\n | 'exception-autocapture'\n | 'web-vitals'\n | 'recorder'\n | 'lazy-recorder'\n | 'tracing-headers'\n | 'surveys'\n | 'conversations'\n | 'product-tours'\n | 'dead-clicks-autocapture'\n | 'remote-config'\n | ExternalExtensionKind\n\nexport interface LazyLoadedSessionRecordingInterface {\n start: (startReason?: SessionStartReason) => void\n stop: () => void\n sessionId: string\n status: SessionRecordingStatus\n onRRwebEmit: (rawEvent: eventWithTime) => void\n log: (message: string, level: 'log' | 'warn' | 'error') => void\n sdkDebugProperties: Properties\n overrideLinkedFlag: () => void\n overrideSampling: () => void\n overrideTrigger: (triggerType: TriggerType) => void\n isStarted: boolean\n tryAddCustomEvent(tag: string, payload: any): boolean\n}\n\nexport interface LazyLoadedDeadClicksAutocaptureInterface {\n start: (observerTarget: Node) => void\n stop: () => void\n}\n\nexport interface LazyLoadedConversationsInterface {\n // Widget control\n show: () => void\n hide: () => void\n isVisible: () => boolean\n\n // Lifecycle\n reset: () => void\n\n // API methods\n sendMessage: (message: string, userTraits?: UserProvidedTraits, newTicket?: boolean) => Promise<SendMessageResponse>\n getMessages: (ticketId?: string, after?: string) => Promise<GetMessagesResponse>\n markAsRead: (ticketId?: string) => Promise<MarkAsReadResponse>\n getTickets: (options?: GetTicketsOptions) => Promise<GetTicketsResponse>\n getCurrentTicketId: () => string | null\n getWidgetSessionId: () => string\n}\n\ninterface PostHogExtensions {\n loadExternalDependency?: (\n posthog: PostHog,\n kind: PostHogExtensionKind,\n callback: (error?: string | Event, event?: Event) => void\n ) => void\n\n loadSiteApp?: (posthog: PostHog, appUrl: string, callback: (error?: string | Event, event?: Event) => void) => void\n\n errorWrappingFunctions?: {\n wrapOnError: (captureFn: (props: ErrorTracking.ErrorProperties) => void) => () => void\n wrapUnhandledRejection: (captureFn: (props: ErrorTracking.ErrorProperties) => void) => () => void\n wrapConsoleError: (captureFn: (props: ErrorTracking.ErrorProperties) => void) => () => void\n }\n rrweb?: { record: any; version: string }\n rrwebPlugins?: { getRecordConsolePlugin: any; getRecordNetworkPlugin?: any }\n generateSurveys?: (posthog: PostHog, isSurveysEnabled: boolean) => any | undefined\n generateProductTours?: (posthog: PostHog, isEnabled: boolean) => any | undefined\n postHogWebVitalsCallbacks?: {\n onLCP: (metric: any) => void\n onCLS: (metric: any) => void\n onFCP: (metric: any) => void\n onINP: (metric: any) => void\n }\n tracingHeadersPatchFns?: {\n _patchFetch: (hostnames: string[], distinctId: string, sessionManager?: SessionIdManager) => () => void\n _patchXHR: (hostnames: string[], distinctId: string, sessionManager?: SessionIdManager) => () => void\n }\n initDeadClicksAutocapture?: (\n ph: PostHog,\n config: DeadClicksAutoCaptureConfig\n ) => LazyLoadedDeadClicksAutocaptureInterface\n integrations?: {\n [K in ExternalIntegrationKind]?: { start: (posthog: PostHog) => void; stop: () => void }\n }\n initSessionRecording?: (ph: PostHog) => LazyLoadedSessionRecordingInterface\n initConversations?: (config: ConversationsRemoteConfig, posthog: PostHog) => LazyLoadedConversationsInterface\n}\n\nconst global: typeof globalThis | undefined = typeof globalThis !== 'undefined' ? globalThis : win\n\n// React Native polyfills for posthog-js compatibility\nif (typeof self === 'undefined') {\n ;(global as any).self = global\n}\nif (typeof File === 'undefined') {\n ;(global as any).File = function () {}\n}\n\nexport const ArrayProto = Array.prototype\nexport const nativeForEach = ArrayProto.forEach\nexport const nativeIndexOf = ArrayProto.indexOf\n\nexport const navigator = global?.navigator\nexport const document = global?.document\nexport const location = global?.location\nexport const fetch = global?.fetch\nexport const XMLHttpRequest =\n global?.XMLHttpRequest && 'withCredentials' in new global.XMLHttpRequest() ? global.XMLHttpRequest : undefined\nexport const AbortController = global?.AbortController\nexport const userAgent = navigator?.userAgent\nexport const assignableWindow: AssignableWindow = win ?? ({} as any)\n\nexport { win as window }\n","import{options as n}from\"preact\";var t,r,u,i,o=0,f=[],c=[],e=n.__b,a=n.__r,v=n.diffed,l=n.__c,m=n.unmount;function d(t,u){n.__h&&n.__h(r,t,o||u),o=0;var i=r.__H||(r.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({__V:c}),i.__[t]}function h(n){return o=1,s(B,n)}function s(n,u,i){var o=d(t++,2);if(o.t=n,!o.__c&&(o.__=[i?i(u):B(void 0,u),function(n){var t=o.__N?o.__N[0]:o.__[0],r=o.t(t,n);t!==r&&(o.__N=[r,o.__[1]],o.__c.setState({}))}],o.__c=r,!r.u)){var f=function(n,t,r){if(!o.__c.__H)return!0;var u=o.__c.__H.__.filter(function(n){return n.__c});if(u.every(function(n){return!n.__N}))return!c||c.call(this,n,t,r);var i=!1;return u.forEach(function(n){if(n.__N){var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(i=!0)}}),!(!i&&o.__c.props===n)&&(!c||c.call(this,n,t,r))};r.u=!0;var c=r.shouldComponentUpdate,e=r.componentWillUpdate;r.componentWillUpdate=function(n,t,r){if(this.__e){var u=c;c=void 0,f(n,t,r),c=u}e&&e.call(this,n,t,r)},r.shouldComponentUpdate=f}return o.__N||o.__}function p(u,i){var o=d(t++,3);!n.__s&&z(o.__H,i)&&(o.__=u,o.i=i,r.__H.__h.push(o))}function y(u,i){var o=d(t++,4);!n.__s&&z(o.__H,i)&&(o.__=u,o.i=i,r.__h.push(o))}function _(n){return o=5,F(function(){return{current:n}},[])}function A(n,t,r){o=6,y(function(){return\"function\"==typeof n?(n(t()),function(){return n(null)}):n?(n.current=t(),function(){return n.current=null}):void 0},null==r?r:r.concat(n))}function F(n,r){var u=d(t++,7);return z(u.__H,r)?(u.__V=n(),u.i=r,u.__h=n,u.__V):u.__}function T(n,t){return o=8,F(function(){return n},t)}function q(n){var u=r.context[n.__c],i=d(t++,9);return i.c=n,u?(null==i.__&&(i.__=!0,u.sub(r)),u.props.value):n.__}function x(t,r){n.useDebugValue&&n.useDebugValue(r?r(t):t)}function P(n){var u=d(t++,10),i=h();return u.__=n,r.componentDidCatch||(r.componentDidCatch=function(n,t){u.__&&u.__(n,t),i[1](n)}),[i[0],function(){i[1](void 0)}]}function V(){var n=d(t++,11);if(!n.__){for(var u=r.__v;null!==u&&!u.__m&&null!==u.__;)u=u.__;var i=u.__m||(u.__m=[0,0]);n.__=\"P\"+i[0]+\"-\"+i[1]++}return n.__}function b(){for(var t;t=f.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(k),t.__H.__h.forEach(w),t.__H.__h=[]}catch(r){t.__H.__h=[],n.__e(r,t.__v)}}n.__b=function(n){r=null,e&&e(n)},n.__r=function(n){a&&a(n),t=0;var i=(r=n.__c).__H;i&&(u===r?(i.__h=[],r.__h=[],i.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=c,n.__N=n.i=void 0})):(i.__h.forEach(k),i.__h.forEach(w),i.__h=[],t=0)),u=r},n.diffed=function(t){v&&v(t);var o=t.__c;o&&o.__H&&(o.__H.__h.length&&(1!==f.push(o)&&i===n.requestAnimationFrame||((i=n.requestAnimationFrame)||j)(b)),o.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==c&&(n.__=n.__V),n.i=void 0,n.__V=c})),u=r=null},n.__c=function(t,r){r.some(function(t){try{t.__h.forEach(k),t.__h=t.__h.filter(function(n){return!n.__||w(n)})}catch(u){r.some(function(n){n.__h&&(n.__h=[])}),r=[],n.__e(u,t.__v)}}),l&&l(t,r)},n.unmount=function(t){m&&m(t);var r,u=t.__c;u&&u.__H&&(u.__H.__.forEach(function(n){try{k(n)}catch(n){r=n}}),u.__H=void 0,r&&n.__e(r,u.__v))};var g=\"function\"==typeof requestAnimationFrame;function j(n){var t,r=function(){clearTimeout(u),g&&cancelAnimationFrame(t),setTimeout(n)},u=setTimeout(r,100);g&&(t=requestAnimationFrame(r))}function k(n){var t=r,u=n.__c;\"function\"==typeof u&&(n.__c=void 0,u()),r=t}function w(n){var t=r;n.__c=n.__(),r=t}function z(n,t){return!n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function B(n,t){return\"function\"==typeof t?t(n):t}export{T as useCallback,q as useContext,x as useDebugValue,p as useEffect,P as useErrorBoundary,V as useId,A as useImperativeHandle,y as useLayoutEffect,F as useMemo,s as useReducer,_ as useRef,h as useState};\n//# sourceMappingURL=hooks.module.js.map\n","export const satisfiedEmoji = (\n <svg className=\"emoji-svg\" xmlns=\"http://www.w3.org/2000/svg\" height=\"48\" viewBox=\"0 -960 960 960\" width=\"48\">\n <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\" />\n </svg>\n)\nexport const neutralEmoji = (\n <svg className=\"emoji-svg\" xmlns=\"http://www.w3.org/2000/svg\" height=\"48\" viewBox=\"0 -960 960 960\" width=\"48\">\n <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\" />\n </svg>\n)\nexport const dissatisfiedEmoji = (\n <svg className=\"emoji-svg\" xmlns=\"http://www.w3.org/2000/svg\" height=\"48\" viewBox=\"0 -960 960 960\" width=\"48\">\n <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\" />\n </svg>\n)\nexport const veryDissatisfiedEmoji = (\n <svg className=\"emoji-svg\" xmlns=\"http://www.w3.org/2000/svg\" height=\"48\" viewBox=\"0 -960 960 960\" width=\"48\">\n <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\" />\n </svg>\n)\nexport const verySatisfiedEmoji = (\n <svg className=\"emoji-svg\" xmlns=\"http://www.w3.org/2000/svg\" height=\"48\" viewBox=\"0 -960 960 960\" width=\"48\">\n <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\" />\n </svg>\n)\nexport const cancelSVG = (\n <svg\n width=\"12\"\n height=\"12\"\n viewBox=\"0 0 12 12\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-labelledby=\"close-survey-title\"\n >\n <title id=\"close-survey-title\">Close survey</title>\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n 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\"\n fill=\"black\"\n />\n </svg>\n)\nexport const IconPosthogLogo = (\n <svg width=\"77\" height=\"14\" viewBox=\"0 0 77 14\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <g clip-path=\"url(#clip0_2415_6911)\">\n <mask\n id=\"mask0_2415_6911\"\n style={{ maskType: 'luminance' }}\n maskUnits=\"userSpaceOnUse\"\n x=\"0\"\n y=\"0\"\n width=\"77\"\n height=\"14\"\n >\n <path d=\"M0.5 0H76.5V14H0.5V0Z\" fill=\"white\" />\n </mask>\n <g mask=\"url(#mask0_2415_6911)\">\n <path\n d=\"M5.77226 8.02931C5.59388 8.37329 5.08474 8.37329 4.90634 8.02931L4.4797 7.20672C4.41155 7.07535 4.41155 6.9207 4.4797 6.78933L4.90634 5.96669C5.08474 5.62276 5.59388 5.62276 5.77226 5.96669L6.19893 6.78933C6.26709 6.9207 6.26709 7.07535 6.19893 7.20672L5.77226 8.02931ZM5.77226 12.6946C5.59388 13.0386 5.08474 13.0386 4.90634 12.6946L4.4797 11.872C4.41155 11.7406 4.41155 11.586 4.4797 11.4546L4.90634 10.632C5.08474 10.288 5.59388 10.288 5.77226 10.632L6.19893 11.4546C6.26709 11.586 6.26709 11.7406 6.19893 11.872L5.77226 12.6946Z\"\n fill=\"#1D4AFF\"\n />\n <path\n d=\"M0.5 10.9238C0.5 10.508 1.02142 10.2998 1.32637 10.5938L3.54508 12.7327C3.85003 13.0267 3.63405 13.5294 3.20279 13.5294H0.984076C0.716728 13.5294 0.5 13.3205 0.5 13.0627V10.9238ZM0.5 8.67083C0.5 8.79459 0.551001 8.91331 0.641783 9.00081L5.19753 13.3927C5.28831 13.4802 5.41144 13.5294 5.53982 13.5294H8.0421C8.47337 13.5294 8.68936 13.0267 8.3844 12.7327L1.32637 5.92856C1.02142 5.63456 0.5 5.84278 0.5 6.25854V8.67083ZM0.5 4.00556C0.5 4.12932 0.551001 4.24802 0.641783 4.33554L10.0368 13.3927C10.1276 13.4802 10.2508 13.5294 10.3791 13.5294H12.8814C13.3127 13.5294 13.5287 13.0267 13.2237 12.7327L1.32637 1.26329C1.02142 0.969312 0.5 1.17752 0.5 1.59327V4.00556ZM5.33931 4.00556C5.33931 4.12932 5.39033 4.24802 5.4811 4.33554L14.1916 12.7327C14.4965 13.0267 15.0179 12.8185 15.0179 12.4028V9.99047C15.0179 9.86671 14.9669 9.74799 14.8762 9.66049L6.16568 1.26329C5.86071 0.969307 5.33931 1.17752 5.33931 1.59327V4.00556ZM11.005 1.26329C10.7 0.969307 10.1786 1.17752 10.1786 1.59327V4.00556C10.1786 4.12932 10.2296 4.24802 10.3204 4.33554L14.1916 8.06748C14.4965 8.36148 15.0179 8.15325 15.0179 7.7375V5.3252C15.0179 5.20144 14.9669 5.08272 14.8762 4.99522L11.005 1.26329Z\"\n fill=\"#F9BD2B\"\n />\n <path\n d=\"M21.0852 10.981L16.5288 6.58843C16.2238 6.29443 15.7024 6.50266 15.7024 6.91841V13.0627C15.7024 13.3205 15.9191 13.5294 16.1865 13.5294H23.2446C23.5119 13.5294 23.7287 13.3205 23.7287 13.0627V12.5032C23.7287 12.2455 23.511 12.0396 23.2459 12.0063C22.4323 11.9042 21.6713 11.546 21.0852 10.981ZM18.0252 12.0365C17.5978 12.0365 17.251 11.7021 17.251 11.2901C17.251 10.878 17.5978 10.5436 18.0252 10.5436C18.4527 10.5436 18.7996 10.878 18.7996 11.2901C18.7996 11.7021 18.4527 12.0365 18.0252 12.0365Z\"\n fill=\"currentColor\"\n />\n <path\n d=\"M0.5 13.0627C0.5 13.3205 0.716728 13.5294 0.984076 13.5294H3.20279C3.63405 13.5294 3.85003 13.0267 3.54508 12.7327L1.32637 10.5938C1.02142 10.2998 0.5 10.508 0.5 10.9238V13.0627ZM5.33931 5.13191L1.32637 1.26329C1.02142 0.969306 0.5 1.17752 0.5 1.59327V4.00556C0.5 4.12932 0.551001 4.24802 0.641783 4.33554L5.33931 8.86412V5.13191ZM1.32637 5.92855C1.02142 5.63455 0.5 5.84278 0.5 6.25853V8.67083C0.5 8.79459 0.551001 8.91331 0.641783 9.00081L5.33931 13.5294V9.79717L1.32637 5.92855Z\"\n fill=\"#1D4AFF\"\n />\n <path\n d=\"M10.1787 5.3252C10.1787 5.20144 10.1277 5.08272 10.0369 4.99522L6.16572 1.26329C5.8608 0.969306 5.33936 1.17752 5.33936 1.59327V4.00556C5.33936 4.12932 5.39037 4.24802 5.48114 4.33554L10.1787 8.86412V5.3252ZM5.33936 13.5294H8.04214C8.47341 13.5294 8.6894 13.0267 8.38443 12.7327L5.33936 9.79717V13.5294ZM5.33936 5.13191V8.67083C5.33936 8.79459 5.39037 8.91331 5.48114 9.00081L10.1787 13.5294V9.99047C10.1787 9.86671 10.1277 9.74803 10.0369 9.66049L5.33936 5.13191Z\"\n fill=\"#F54E00\"\n />\n <path\n d=\"M29.375 11.6667H31.3636V8.48772H33.0249C34.8499 8.48772 36.0204 7.4443 36.0204 5.83052C36.0204 4.21681 34.8499 3.17334 33.0249 3.17334H29.375V11.6667ZM31.3636 6.84972V4.81136H32.8236C33.5787 4.81136 34.0318 5.19958 34.0318 5.83052C34.0318 6.4615 33.5787 6.84972 32.8236 6.84972H31.3636ZM39.618 11.7637C41.5563 11.7637 42.9659 10.429 42.9659 8.60905C42.9659 6.78905 41.5563 5.45438 39.618 5.45438C37.6546 5.45438 36.2701 6.78905 36.2701 8.60905C36.2701 10.429 37.6546 11.7637 39.618 11.7637ZM38.1077 8.60905C38.1077 7.63838 38.7118 6.97105 39.618 6.97105C40.5116 6.97105 41.1157 7.63838 41.1157 8.60905C41.1157 9.57972 40.5116 10.2471 39.618 10.2471C38.7118 10.2471 38.1077 9.57972 38.1077 8.60905ZM46.1482 11.7637C47.6333 11.7637 48.6402 10.8658 48.6402 9.81025C48.6402 7.33505 45.2294 8.13585 45.2294 7.16518C45.2294 6.8983 45.5189 6.72843 45.9342 6.72843C46.3622 6.72843 46.8782 6.98318 47.0418 7.54132L48.527 6.94678C48.2375 6.06105 47.1677 5.45438 45.8713 5.45438C44.4743 5.45438 43.6058 6.25518 43.6058 7.21372C43.6058 9.53118 46.9663 8.88812 46.9663 9.84665C46.9663 10.1864 46.6391 10.417 46.1482 10.417C45.4434 10.417 44.9525 9.94376 44.8015 9.3735L43.3164 9.93158C43.6436 10.8537 44.6001 11.7637 46.1482 11.7637ZM53.4241 11.606L53.2982 10.0651C53.0843 10.1743 52.8074 10.2106 52.5808 10.2106C52.1278 10.2106 51.8257 9.89523 51.8257 9.34918V7.03172H53.3612V5.55145H51.8257V3.78001H49.9755V5.55145H48.9687V7.03172H49.9755V9.57972C49.9755 11.06 51.0202 11.7637 52.3921 11.7637C52.7696 11.7637 53.122 11.7031 53.4241 11.606ZM59.8749 3.17334V6.47358H56.376V3.17334H54.3874V11.6667H56.376V8.11158H59.8749V11.6667H61.8761V3.17334H59.8749ZM66.2899 11.7637C68.2281 11.7637 69.6378 10.429 69.6378 8.60905C69.6378 6.78905 68.2281 5.45438 66.2899 5.45438C64.3265 5.45438 62.942 6.78905 62.942 8.60905C62.942 10.429 64.3265 11.7637 66.2899 11.7637ZM64.7796 8.60905C64.7796 7.63838 65.3837 6.97105 66.2899 6.97105C67.1835 6.97105 67.7876 7.63838 67.7876 8.60905C67.7876 9.57972 67.1835 10.2471 66.2899 10.2471C65.3837 10.2471 64.7796 9.57972 64.7796 8.60905ZM73.2088 11.4725C73.901 11.4725 74.5177 11.242 74.845 10.8416V11.424C74.845 12.1034 74.2786 12.5767 73.4102 12.5767C72.7935 12.5767 72.2523 12.2854 72.1642 11.788L70.4776 12.0428C70.7042 13.1955 71.925 13.972 73.4102 13.972C75.361 13.972 76.6574 12.8679 76.6574 11.2298V5.55145H74.8324V6.07318C74.4926 5.69705 73.9136 5.45438 73.171 5.45438C71.409 5.45438 70.3014 6.61918 70.3014 8.46345C70.3014 10.3077 71.409 11.4725 73.2088 11.4725ZM72.1012 8.46345C72.1012 7.55345 72.655 6.97105 73.5109 6.97105C74.3793 6.97105 74.9331 7.55345 74.9331 8.46345C74.9331 9.37345 74.3793 9.95585 73.5109 9.95585C72.655 9.95585 72.1012 9.37345 72.1012 8.46345Z\"\n fill=\"currentColor\"\n />\n </g>\n </g>\n <defs>\n <clipPath id=\"clip0_2415_6911\">\n <rect width=\"76\" height=\"14\" fill=\"white\" transform=\"translate(0.5)\" />\n </clipPath>\n </defs>\n </svg>\n)\nexport const checkSVG = (\n <svg width=\"16\" height=\"12\" viewBox=\"0 0 16 12\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M5.30769 10.6923L4.77736 11.2226C4.91801 11.3633 5.10878 11.4423 5.30769 11.4423C5.5066 11.4423 5.69737 11.3633 5.83802 11.2226L5.30769 10.6923ZM15.5303 1.53033C15.8232 1.23744 15.8232 0.762563 15.5303 0.46967C15.2374 0.176777 14.7626 0.176777 14.4697 0.46967L15.5303 1.53033ZM1.53033 5.85429C1.23744 5.56139 0.762563 5.56139 0.46967 5.85429C0.176777 6.14718 0.176777 6.62205 0.46967 6.91495L1.53033 5.85429ZM5.83802 11.2226L15.5303 1.53033L14.4697 0.46967L4.77736 10.162L5.83802 11.2226ZM0.46967 6.91495L4.77736 11.2226L5.83802 10.162L1.53033 5.85429L0.46967 6.91495Z\"\n fill=\"currentColor\"\n />\n </svg>\n)\n","import { h } from 'preact'\nimport { useState, useRef, useEffect } from 'preact/hooks'\nimport { ProductTourStep, ProductTourAppearance, ProductTourSurveyQuestion } from '../../../posthog-product-tours-types'\nimport { cancelSVG, IconPosthogLogo } from '../../surveys/icons'\nimport {\n dissatisfiedEmoji,\n neutralEmoji,\n satisfiedEmoji,\n veryDissatisfiedEmoji,\n verySatisfiedEmoji,\n} from '../../surveys/icons'\n\nexport interface ProductTourSurveyStepInnerProps {\n step: ProductTourStep\n appearance?: ProductTourAppearance\n stepIndex: number\n totalSteps: number\n onPrevious?: () => void\n onSubmit?: (response: string | number | null) => void\n onDismiss?: () => void\n}\n\nconst threeScaleEmojis = [dissatisfiedEmoji, neutralEmoji, satisfiedEmoji]\nconst fiveScaleEmojis = [veryDissatisfiedEmoji, dissatisfiedEmoji, neutralEmoji, satisfiedEmoji, verySatisfiedEmoji]\n\nfunction getScaleNumbers(scale: number): number[] {\n switch (scale) {\n case 5:\n return [1, 2, 3, 4, 5]\n case 10:\n return [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n default:\n return [1, 2, 3, 4, 5]\n }\n}\n\nfunction OpenTextInput({\n value,\n onChange,\n onSubmit,\n isInteractive,\n}: {\n value: string\n onChange: (text: string) => void\n onSubmit?: () => void\n isInteractive: boolean\n}): h.JSX.Element {\n const inputRef = useRef<HTMLTextAreaElement>(null)\n\n useEffect(() => {\n if (isInteractive) {\n setTimeout(() => inputRef.current?.focus(), 100)\n }\n }, [isInteractive])\n\n const handleKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Enter' && e.metaKey && isInteractive) {\n e.preventDefault()\n onSubmit?.()\n }\n }\n\n return (\n <textarea\n ref={inputRef}\n class=\"ph-tour-survey-textarea\"\n rows={3}\n placeholder=\"Your feedback (optional)...\"\n value={value}\n onInput={(e) => onChange((e.target as HTMLTextAreaElement).value)}\n onKeyDown={handleKeyDown}\n disabled={!isInteractive}\n style={isInteractive ? undefined : { cursor: 'default' }}\n />\n )\n}\n\nfunction RatingInput({\n survey,\n onSubmit,\n isInteractive,\n}: {\n survey: ProductTourSurveyQuestion\n onSubmit?: (rating: number) => void\n isInteractive: boolean\n}): h.JSX.Element {\n const [selectedRating, setSelectedRating] = useState<number | null>(null)\n const display = survey.display || 'emoji'\n const scale = survey.scale || 5\n\n const handleSelect = (rating: number) => {\n if (!isInteractive) {\n return\n }\n setSelectedRating(rating)\n // Auto-submit on selection for ratings\n onSubmit?.(rating)\n }\n\n if (display === 'emoji') {\n const emojis = scale === 3 ? threeScaleEmojis : fiveScaleEmojis\n return (\n <div class=\"ph-tour-survey-rating-container\">\n <div class=\"ph-tour-survey-rating-emoji\">\n {emojis.map((emoji, idx) => {\n const rating = idx + 1\n const isActive = selectedRating === rating\n return (\n <button\n key={idx}\n type=\"button\"\n class={`ph-tour-survey-emoji-button ${isActive ? 'ph-tour-survey-emoji-button--active' : ''}`}\n onClick={() => handleSelect(rating)}\n style={isInteractive ? undefined : { cursor: 'default' }}\n aria-label={`Rate ${rating}`}\n >\n {emoji}\n </button>\n )\n })}\n </div>\n {(survey.lowerBoundLabel || survey.upperBoundLabel) && (\n <div class=\"ph-tour-survey-rating-labels\">\n <span>{survey.lowerBoundLabel}</span>\n <span>{survey.upperBoundLabel}</span>\n </div>\n )}\n </div>\n )\n }\n\n // Number display\n const numbers = getScaleNumbers(scale)\n return (\n <div class=\"ph-tour-survey-rating-container\">\n <div\n class=\"ph-tour-survey-rating-numbers\"\n style={{ gridTemplateColumns: `repeat(${numbers.length}, minmax(0, 1fr))` }}\n >\n {numbers.map((num) => {\n const isActive = selectedRating === num\n return (\n <button\n key={num}\n type=\"button\"\n class={`ph-tour-survey-number-button ${isActive ? 'ph-tour-survey-number-button--active' : ''}`}\n onClick={() => handleSelect(num)}\n style={isInteractive ? undefined : { cursor: 'default' }}\n aria-label={`Rate ${num}`}\n >\n {num}\n </button>\n )\n })}\n </div>\n {(survey.lowerBoundLabel || survey.upperBoundLabel) && (\n <div class=\"ph-tour-survey-rating-labels\">\n <span>{survey.lowerBoundLabel}</span>\n <span>{survey.upperBoundLabel}</span>\n </div>\n )}\n </div>\n )\n}\n\nexport function ProductTourSurveyStepInner({\n step,\n appearance,\n stepIndex,\n totalSteps,\n onPrevious,\n onSubmit,\n onDismiss,\n}: ProductTourSurveyStepInnerProps): h.JSX.Element {\n const [textValue, setTextValue] = useState('')\n const survey = step.survey\n const whiteLabel = appearance?.whiteLabel ?? false\n const isFirstStep = stepIndex === 0\n const isOpenText = survey?.type === 'open'\n\n const isInteractive = !!(onPrevious || onSubmit || onDismiss)\n const cursorStyle = isInteractive ? undefined : { cursor: 'default' }\n\n const handleTextSubmit = () => {\n onSubmit?.(textValue.trim() || null)\n }\n\n if (!survey) {\n return <div />\n }\n\n return (\n <>\n <button class=\"ph-tour-dismiss\" onClick={onDismiss} aria-label=\"Close survey\" style={cursorStyle}>\n {cancelSVG}\n </button>\n\n <div class=\"ph-tour-survey-question\">{survey.questionText}</div>\n\n {isOpenText ? (\n <OpenTextInput\n value={textValue}\n onChange={setTextValue}\n onSubmit={handleTextSubmit}\n isInteractive={isInteractive}\n />\n ) : (\n <RatingInput survey={survey} onSubmit={onSubmit} isInteractive={isInteractive} />\n )}\n\n <div class=\"ph-tour-footer\">\n <span class=\"ph-tour-progress\">\n {stepIndex + 1} of {totalSteps}\n </span>\n\n <div class=\"ph-tour-buttons\">\n {!isFirstStep && (\n <button\n class=\"ph-tour-button ph-tour-button--secondary\"\n onClick={onPrevious}\n style={cursorStyle}\n >\n Back\n </button>\n )}\n {isOpenText && (\n <button\n class=\"ph-tour-button ph-tour-button--primary\"\n onClick={handleTextSubmit}\n style={cursorStyle}\n >\n Submit\n </button>\n )}\n </div>\n </div>\n\n {!whiteLabel && (\n <a\n href={isInteractive ? 'https://posthog.com/product-tours' : undefined}\n target={isInteractive ? '_blank' : undefined}\n rel={isInteractive ? 'noopener noreferrer' : undefined}\n class=\"ph-tour-branding\"\n style={isInteractive ? undefined : { cursor: 'default', pointerEvents: 'none' }}\n >\n Survey by {IconPosthogLogo}\n </a>\n )}\n </>\n )\n}\n","/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */\n\nconst {\n entries,\n setPrototypeOf,\n isFrozen,\n getPrototypeOf,\n getOwnPropertyDescriptor\n} = Object;\nlet {\n freeze,\n seal,\n create\n} = Object; // eslint-disable-line import/no-mutable-exports\nlet {\n apply,\n construct\n} = typeof Reflect !== 'undefined' && Reflect;\nif (!freeze) {\n freeze = function freeze(x) {\n return x;\n };\n}\nif (!seal) {\n seal = function seal(x) {\n return x;\n };\n}\nif (!apply) {\n apply = function apply(func, thisArg) {\n for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n args[_key - 2] = arguments[_key];\n }\n return func.apply(thisArg, args);\n };\n}\nif (!construct) {\n construct = function construct(Func) {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n return new Func(...args);\n };\n}\nconst arrayForEach = unapply(Array.prototype.forEach);\nconst arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);\nconst arrayPop = unapply(Array.prototype.pop);\nconst arrayPush = unapply(Array.prototype.push);\nconst arraySplice = unapply(Array.prototype.splice);\nconst stringToLowerCase = unapply(String.prototype.toLowerCase);\nconst stringToString = unapply(String.prototype.toString);\nconst stringMatch = unapply(String.prototype.match);\nconst stringReplace = unapply(String.prototype.replace);\nconst stringIndexOf = unapply(String.prototype.indexOf);\nconst stringTrim = unapply(String.prototype.trim);\nconst objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);\nconst regExpTest = unapply(RegExp.prototype.test);\nconst typeErrorCreate = unconstruct(TypeError);\n/**\n * Creates a new function that calls the given function with a specified thisArg and arguments.\n *\n * @param func - The function to be wrapped and called.\n * @returns A new function that calls the given function with a specified thisArg and arguments.\n */\nfunction unapply(func) {\n return function (thisArg) {\n if (thisArg instanceof RegExp) {\n thisArg.lastIndex = 0;\n }\n for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {\n args[_key3 - 1] = arguments[_key3];\n }\n return apply(func, thisArg, args);\n };\n}\n/**\n * Creates a new function that constructs an instance of the given constructor function with the provided arguments.\n *\n * @param func - The constructor function to be wrapped and called.\n * @returns A new function that constructs an instance of the given constructor function with the provided arguments.\n */\nfunction unconstruct(Func) {\n return function () {\n for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n args[_key4] = arguments[_key4];\n }\n return construct(Func, args);\n };\n}\n/**\n * Add properties to a lookup table\n *\n * @param set - The set to which elements will be added.\n * @param array - The array containing elements to be added to the set.\n * @param transformCaseFunc - An optional function to transform the case of each element before adding to the set.\n * @returns The modified set with added elements.\n */\nfunction addToSet(set, array) {\n let transformCaseFunc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : stringToLowerCase;\n if (setPrototypeOf) {\n // Make 'in' and truthy checks like Boolean(set.constructor)\n // independent of any properties defined on Object.prototype.\n // Prevent prototype setters from intercepting set as a this value.\n setPrototypeOf(set, null);\n }\n let l = array.length;\n while (l--) {\n let element = array[l];\n if (typeof element === 'string') {\n const lcElement = transformCaseFunc(element);\n if (lcElement !== element) {\n // Config presets (e.g. tags.js, attrs.js) are immutable.\n if (!isFrozen(array)) {\n array[l] = lcElement;\n }\n element = lcElement;\n }\n }\n set[element] = true;\n }\n return set;\n}\n/**\n * Clean up an array to harden against CSPP\n *\n * @param array - The array to be cleaned.\n * @returns The cleaned version of the array\n */\nfunction cleanArray(array) {\n for (let index = 0; index < array.length; index++) {\n const isPropertyExist = objectHasOwnProperty(array, index);\n if (!isPropertyExist) {\n array[index] = null;\n }\n }\n return array;\n}\n/**\n * Shallow clone an object\n *\n * @param object - The object to be cloned.\n * @returns A new object that copies the original.\n */\nfunction clone(object) {\n const newObject = create(null);\n for (const [property, value] of entries(object)) {\n const isPropertyExist = objectHasOwnProperty(object, property);\n if (isPropertyExist) {\n if (Array.isArray(value)) {\n newObject[property] = cleanArray(value);\n } else if (value && typeof value === 'object' && value.constructor === Object) {\n newObject[property] = clone(value);\n } else {\n newObject[property] = value;\n }\n }\n }\n return newObject;\n}\n/**\n * This method automatically checks if the prop is function or getter and behaves accordingly.\n *\n * @param object - The object to look up the getter function in its prototype chain.\n * @param prop - The property name for which to find the getter function.\n * @returns The getter function found in the prototype chain or a fallback function.\n */\nfunction lookupGetter(object, prop) {\n while (object !== null) {\n const desc = getOwnPropertyDescriptor(object, prop);\n if (desc) {\n if (desc.get) {\n return unapply(desc.get);\n }\n if (typeof desc.value === 'function') {\n return unapply(desc.value);\n }\n }\n object = getPrototypeOf(object);\n }\n function fallbackValue() {\n return null;\n }\n return fallbackValue;\n}\n\nconst html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'search', 'section', 'select', 'shadow', 'slot', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']);\nconst svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'enterkeyhint', 'exportparts', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'inputmode', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'part', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);\nconst svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']);\n// List of SVG elements that are disallowed by default.\n// We still need to know them so that we can do namespace\n// checks properly in case one wants to add them to\n// allow-list.\nconst svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']);\nconst mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover', 'mprescripts']);\n// Similarly to SVG, we want to know all MathML elements,\n// even those that we disallow by default.\nconst mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);\nconst text = freeze(['#text']);\n\nconst html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'exportparts', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inert', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'part', 'pattern', 'placeholder', 'playsinline', 'popover', 'popovertarget', 'popovertargetaction', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'slot', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'wrap', 'xmlns', 'slot']);\nconst svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'amplitude', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'exponent', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'intercept', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'mask-type', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'slope', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'tablevalues', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);\nconst mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);\nconst xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);\n\n// eslint-disable-next-line unicorn/better-regex\nconst MUSTACHE_EXPR = seal(/\\{\\{[\\w\\W]*|[\\w\\W]*\\}\\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode\nconst ERB_EXPR = seal(/<%[\\w\\W]*|[\\w\\W]*%>/gm);\nconst TMPLIT_EXPR = seal(/\\$\\{[\\w\\W]*/gm); // eslint-disable-line unicorn/better-regex\nconst DATA_ATTR = seal(/^data-[\\-\\w.\\u00B7-\\uFFFF]+$/); // eslint-disable-line no-useless-escape\nconst ARIA_ATTR = seal(/^aria-[\\-\\w]+$/); // eslint-disable-line no-useless-escape\nconst IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\\-]+(?:[^a-z+.\\-:]|$))/i // eslint-disable-line no-useless-escape\n);\nconst IS_SCRIPT_OR_DATA = seal(/^(?:\\w+script|data):/i);\nconst ATTR_WHITESPACE = seal(/[\\u0000-\\u0020\\u00A0\\u1680\\u180E\\u2000-\\u2029\\u205F\\u3000]/g // eslint-disable-line no-control-regex\n);\nconst DOCTYPE_NAME = seal(/^html$/i);\nconst CUSTOM_ELEMENT = seal(/^[a-z][.\\w]*(-[.\\w]+)+$/i);\n\nvar EXPRESSIONS = /*#__PURE__*/Object.freeze({\n __proto__: null,\n ARIA_ATTR: ARIA_ATTR,\n ATTR_WHITESPACE: ATTR_WHITESPACE,\n CUSTOM_ELEMENT: CUSTOM_ELEMENT,\n DATA_ATTR: DATA_ATTR,\n DOCTYPE_NAME: DOCTYPE_NAME,\n ERB_EXPR: ERB_EXPR,\n IS_ALLOWED_URI: IS_ALLOWED_URI,\n IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA,\n MUSTACHE_EXPR: MUSTACHE_EXPR,\n TMPLIT_EXPR: TMPLIT_EXPR\n});\n\n/* eslint-disable @typescript-eslint/indent */\n// https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType\nconst NODE_TYPE = {\n element: 1,\n attribute: 2,\n text: 3,\n cdataSection: 4,\n entityReference: 5,\n // Deprecated\n entityNode: 6,\n // Deprecated\n progressingInstruction: 7,\n comment: 8,\n document: 9,\n documentType: 10,\n documentFragment: 11,\n notation: 12 // Deprecated\n};\nconst getGlobal = function getGlobal() {\n return typeof window === 'undefined' ? null : window;\n};\n/**\n * Creates a no-op policy for internal use only.\n * Don't export this function outside this module!\n * @param trustedTypes The policy factory.\n * @param purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix).\n * @return The policy created (or null, if Trusted Types\n * are not supported or creating the policy failed).\n */\nconst _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {\n if (typeof trustedTypes !== 'object' || typeof trustedTypes.createPolicy !== 'function') {\n return null;\n }\n // Allow the callers to control the unique policy name\n // by adding a data-tt-policy-suffix to the script element with the DOMPurify.\n // Policy creation with duplicate names throws in Trusted Types.\n let suffix = null;\n const ATTR_NAME = 'data-tt-policy-suffix';\n if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {\n suffix = purifyHostElement.getAttribute(ATTR_NAME);\n }\n const policyName = 'dompurify' + (suffix ? '#' + suffix : '');\n try {\n return trustedTypes.createPolicy(policyName, {\n createHTML(html) {\n return html;\n },\n createScriptURL(scriptUrl) {\n return scriptUrl;\n }\n });\n } catch (_) {\n // Policy creation failed (most likely another DOMPurify script has\n // already run). Skip creating the policy, as this will only cause errors\n // if TT are enforced.\n console.warn('TrustedTypes policy ' + policyName + ' could not be created.');\n return null;\n }\n};\nconst _createHooksMap = function _createHooksMap() {\n return {\n afterSanitizeAttributes: [],\n afterSanitizeElements: [],\n afterSanitizeShadowDOM: [],\n beforeSanitizeAttributes: [],\n beforeSanitizeElements: [],\n beforeSanitizeShadowDOM: [],\n uponSanitizeAttribute: [],\n uponSanitizeElement: [],\n uponSanitizeShadowNode: []\n };\n};\nfunction createDOMPurify() {\n let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();\n const DOMPurify = root => createDOMPurify(root);\n DOMPurify.version = '3.3.1';\n DOMPurify.removed = [];\n if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {\n // Not running in a browser, provide a factory function\n // so that you can pass your own Window\n DOMPurify.isSupported = false;\n return DOMPurify;\n }\n let {\n document\n } = window;\n const originalDocument = document;\n const currentScript = originalDocument.currentScript;\n const {\n DocumentFragment,\n HTMLTemplateElement,\n Node,\n Element,\n NodeFilter,\n NamedNodeMap = window.NamedNodeMap || window.MozNamedAttrMap,\n HTMLFormElement,\n DOMParser,\n trustedTypes\n } = window;\n const ElementPrototype = Element.prototype;\n const cloneNode = lookupGetter(ElementPrototype, 'cloneNode');\n const remove = lookupGetter(ElementPrototype, 'remove');\n const getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');\n const getChildNodes = lookupGetter(ElementPrototype, 'childNodes');\n const getParentNode = lookupGetter(ElementPrototype, 'parentNode');\n // As per issue #47, the web-components registry is inherited by a\n // new document created via createHTMLDocument. As per the spec\n // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)\n // a new empty registry is used when creating a template contents owner\n // document, so we use that as our parent document to ensure nothing\n // is inherited.\n if (typeof HTMLTemplateElement === 'function') {\n const template = document.createElement('template');\n if (template.content && template.content.ownerDocument) {\n document = template.content.ownerDocument;\n }\n }\n let trustedTypesPolicy;\n let emptyHTML = '';\n const {\n implementation,\n createNodeIterator,\n createDocumentFragment,\n getElementsByTagName\n } = document;\n const {\n importNode\n } = originalDocument;\n let hooks = _createHooksMap();\n /**\n * Expose whether this browser supports running the full DOMPurify.\n */\n DOMPurify.isSupported = typeof entries === 'function' && typeof getParentNode === 'function' && implementation && implementation.createHTMLDocument !== undefined;\n const {\n MUSTACHE_EXPR,\n ERB_EXPR,\n TMPLIT_EXPR,\n DATA_ATTR,\n ARIA_ATTR,\n IS_SCRIPT_OR_DATA,\n ATTR_WHITESPACE,\n CUSTOM_ELEMENT\n } = EXPRESSIONS;\n let {\n IS_ALLOWED_URI: IS_ALLOWED_URI$1\n } = EXPRESSIONS;\n /**\n * We consider the elements and attributes below to be safe. Ideally\n * don't add any new ones but feel free to remove unwanted ones.\n */\n /* allowed element names */\n let ALLOWED_TAGS = null;\n const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);\n /* Allowed attribute names */\n let ALLOWED_ATTR = null;\n const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);\n /*\n * Configure how DOMPurify should handle custom elements and their attributes as well as customized built-in elements.\n * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)\n * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)\n * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.\n */\n let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {\n tagNameCheck: {\n writable: true,\n configurable: false,\n enumerable: true,\n value: null\n },\n attributeNameCheck: {\n writable: true,\n configurable: false,\n enumerable: true,\n value: null\n },\n allowCustomizedBuiltInElements: {\n writable: true,\n configurable: false,\n enumerable: true,\n value: false\n }\n }));\n /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */\n let FORBID_TAGS = null;\n /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */\n let FORBID_ATTR = null;\n /* Config object to store ADD_TAGS/ADD_ATTR functions (when used as functions) */\n const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, {\n tagCheck: {\n writable: true,\n configurable: false,\n enumerable: true,\n value: null\n },\n attributeCheck: {\n writable: true,\n configurable: false,\n enumerable: true,\n value: null\n }\n }));\n /* Decide if ARIA attributes are okay */\n let ALLOW_ARIA_ATTR = true;\n /* Decide if custom data attributes are okay */\n let ALLOW_DATA_ATTR = true;\n /* Decide if unknown protocols are okay */\n let ALLOW_UNKNOWN_PROTOCOLS = false;\n /* Decide if self-closing tags in attributes are allowed.\n * Usually removed due to a mXSS issue in jQuery 3.0 */\n let ALLOW_SELF_CLOSE_IN_ATTR = true;\n /* Output should be safe for common template engines.\n * This means, DOMPurify removes data attributes, mustaches and ERB\n */\n let SAFE_FOR_TEMPLATES = false;\n /* Output should be safe even for XML used within HTML and alike.\n * This means, DOMPurify removes comments when containing risky content.\n */\n let SAFE_FOR_XML = true;\n /* Decide if document with <html>... should be returned */\n let WHOLE_DOCUMENT = false;\n /* Track whether config is already set on this instance of DOMPurify. */\n let SET_CONFIG = false;\n /* Decide if all elements (e.g. style, script) must be children of\n * document.body. By default, browsers might move them to document.head */\n let FORCE_BODY = false;\n /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html\n * string (or a TrustedHTML object if Trusted Types are supported).\n * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead\n */\n let RETURN_DOM = false;\n /* Decide if a DOM `DocumentFragment` should be returned, instead of a html\n * string (or a TrustedHTML object if Trusted Types are supported) */\n let RETURN_DOM_FRAGMENT = false;\n /* Try to return a Trusted Type object instead of a string, return a string in\n * case Trusted Types are not supported */\n let RETURN_TRUSTED_TYPE = false;\n /* Output should be free from DOM clobbering attacks?\n * This sanitizes markups named with colliding, clobberable built-in DOM APIs.\n */\n let SANITIZE_DOM = true;\n /* Achieve full DOM Clobbering protection by isolating the namespace of named\n * properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules.\n *\n * HTML/DOM spec rules that enable DOM Clobbering:\n * - Named Access on Window (§7.3.3)\n * - DOM Tree Accessors (§3.1.5)\n * - Form Element Parent-Child Relations (§4.10.3)\n * - Iframe srcdoc / Nested WindowProxies (§4.8.5)\n * - HTMLCollection (§4.2.10.2)\n *\n * Namespace isolation is implemented by prefixing `id` and `name` attributes\n * with a constant string, i.e., `user-content-`\n */\n let SANITIZE_NAMED_PROPS = false;\n const SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';\n /* Keep element content when removing element? */\n let KEEP_CONTENT = true;\n /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead\n * of importing it into a new Document and returning a sanitized copy */\n let IN_PLACE = false;\n /* Allow usage of profiles like html, svg and mathMl */\n let USE_PROFILES = {};\n /* Tags to ignore content of when KEEP_CONTENT is true */\n let FORBID_CONTENTS = null;\n const DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']);\n /* Tags that are safe for data: URIs */\n let DATA_URI_TAGS = null;\n const DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);\n /* Attributes safe for values like \"javascript:\" */\n let URI_SAFE_ATTRIBUTES = null;\n const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']);\n const MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';\n const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';\n const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';\n /* Document namespace */\n let NAMESPACE = HTML_NAMESPACE;\n let IS_EMPTY_INPUT = false;\n /* Allowed XHTML+XML namespaces */\n let ALLOWED_NAMESPACES = null;\n const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);\n let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);\n let HTML_INTEGRATION_POINTS = addToSet({}, ['annotation-xml']);\n // Certain elements are allowed in both SVG and HTML\n // namespace. We need to specify them explicitly\n // so that they don't get erroneously deleted from\n // HTML namespace.\n const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']);\n /* Parsing of strict XHTML documents */\n let PARSER_MEDIA_TYPE = null;\n const SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];\n const DEFAULT_PARSER_MEDIA_TYPE = 'text/html';\n let transformCaseFunc = null;\n /* Keep a reference to config to pass to hooks */\n let CONFIG = null;\n /* Ideally, do not touch anything below this line */\n /* ______________________________________________ */\n const formElement = document.createElement('form');\n const isRegexOrFunction = function isRegexOrFunction(testValue) {\n return testValue instanceof RegExp || testValue instanceof Function;\n };\n /**\n * _parseConfig\n *\n * @param cfg optional config literal\n */\n // eslint-disable-next-line complexity\n const _parseConfig = function _parseConfig() {\n let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n if (CONFIG && CONFIG === cfg) {\n return;\n }\n /* Shield configuration object from tampering */\n if (!cfg || typeof cfg !== 'object') {\n cfg = {};\n }\n /* Shield configuration object from prototype pollution */\n cfg = clone(cfg);\n PARSER_MEDIA_TYPE =\n // eslint-disable-next-line unicorn/prefer-includes\n SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;\n // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.\n transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase;\n /* Set configuration parameters */\n ALLOWED_TAGS = objectHasOwnProperty(cfg, 'ALLOWED_TAGS') ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;\n ALLOWED_ATTR = objectHasOwnProperty(cfg, 'ALLOWED_ATTR') ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;\n ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, 'ALLOWED_NAMESPACES') ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;\n URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, 'ADD_URI_SAFE_ATTR') ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES;\n DATA_URI_TAGS = objectHasOwnProperty(cfg, 'ADD_DATA_URI_TAGS') ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS;\n FORBID_CONTENTS = objectHasOwnProperty(cfg, 'FORBID_CONTENTS') ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;\n FORBID_TAGS = objectHasOwnProperty(cfg, 'FORBID_TAGS') ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : clone({});\n FORBID_ATTR = objectHasOwnProperty(cfg, 'FORBID_ATTR') ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : clone({});\n USE_PROFILES = objectHasOwnProperty(cfg, 'USE_PROFILES') ? cfg.USE_PROFILES : false;\n ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true\n ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true\n ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false\n ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; // Default true\n SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false\n SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false; // Default true\n WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false\n RETURN_DOM = cfg.RETURN_DOM || false; // Default false\n RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false\n RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false\n FORCE_BODY = cfg.FORCE_BODY || false; // Default false\n SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true\n SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false\n KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true\n IN_PLACE = cfg.IN_PLACE || false; // Default false\n IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;\n NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;\n MATHML_TEXT_INTEGRATION_POINTS = cfg.MATHML_TEXT_INTEGRATION_POINTS || MATHML_TEXT_INTEGRATION_POINTS;\n HTML_INTEGRATION_POINTS = cfg.HTML_INTEGRATION_POINTS || HTML_INTEGRATION_POINTS;\n CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};\n if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {\n CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;\n }\n if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {\n CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;\n }\n if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === 'boolean') {\n CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;\n }\n if (SAFE_FOR_TEMPLATES) {\n ALLOW_DATA_ATTR = false;\n }\n if (RETURN_DOM_FRAGMENT) {\n RETURN_DOM = true;\n }\n /* Parse profile info */\n if (USE_PROFILES) {\n ALLOWED_TAGS = addToSet({}, text);\n ALLOWED_ATTR = [];\n if (USE_PROFILES.html === true) {\n addToSet(ALLOWED_TAGS, html$1);\n addToSet(ALLOWED_ATTR, html);\n }\n if (USE_PROFILES.svg === true) {\n addToSet(ALLOWED_TAGS, svg$1);\n addToSet(ALLOWED_ATTR, svg);\n addToSet(ALLOWED_ATTR, xml);\n }\n if (USE_PROFILES.svgFilters === true) {\n addToSet(ALLOWED_TAGS, svgFilters);\n addToSet(ALLOWED_ATTR, svg);\n addToSet(ALLOWED_ATTR, xml);\n }\n if (USE_PROFILES.mathMl === true) {\n addToSet(ALLOWED_TAGS, mathMl$1);\n addToSet(ALLOWED_ATTR, mathMl);\n addToSet(ALLOWED_ATTR, xml);\n }\n }\n /* Merge configuration parameters */\n if (cfg.ADD_TAGS) {\n if (typeof cfg.ADD_TAGS === 'function') {\n EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;\n } else {\n if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {\n ALLOWED_TAGS = clone(ALLOWED_TAGS);\n }\n addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);\n }\n }\n if (cfg.ADD_ATTR) {\n if (typeof cfg.ADD_ATTR === 'function') {\n EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;\n } else {\n if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {\n ALLOWED_ATTR = clone(ALLOWED_ATTR);\n }\n addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);\n }\n }\n if (cfg.ADD_URI_SAFE_ATTR) {\n addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);\n }\n if (cfg.FORBID_CONTENTS) {\n if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {\n FORBID_CONTENTS = clone(FORBID_CONTENTS);\n }\n addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);\n }\n if (cfg.ADD_FORBID_CONTENTS) {\n if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {\n FORBID_CONTENTS = clone(FORBID_CONTENTS);\n }\n addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc);\n }\n /* Add #text in case KEEP_CONTENT is set to true */\n if (KEEP_CONTENT) {\n ALLOWED_TAGS['#text'] = true;\n }\n /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */\n if (WHOLE_DOCUMENT) {\n addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);\n }\n /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */\n if (ALLOWED_TAGS.table) {\n addToSet(ALLOWED_TAGS, ['tbody']);\n delete FORBID_TAGS.tbody;\n }\n if (cfg.TRUSTED_TYPES_POLICY) {\n if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== 'function') {\n throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a \"createHTML\" hook.');\n }\n if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== 'function') {\n throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook.');\n }\n // Overwrite existing TrustedTypes policy.\n trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;\n // Sign local variables required by `sanitize`.\n emptyHTML = trustedTypesPolicy.createHTML('');\n } else {\n // Uninitialized policy, attempt to initialize the internal dompurify policy.\n if (trustedTypesPolicy === undefined) {\n trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);\n }\n // If creating the internal policy succeeded sign internal variables.\n if (trustedTypesPolicy !== null && typeof emptyHTML === 'string') {\n emptyHTML = trustedTypesPolicy.createHTML('');\n }\n }\n // Prevent further manipulation of configuration.\n // Not available in IE8, Safari 5, etc.\n if (freeze) {\n freeze(cfg);\n }\n CONFIG = cfg;\n };\n /* Keep track of all possible SVG and MathML tags\n * so that we can perform the namespace checks\n * correctly. */\n const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);\n const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);\n /**\n * @param element a DOM element whose namespace is being checked\n * @returns Return false if the element has a\n * namespace that a spec-compliant parser would never\n * return. Return true otherwise.\n */\n const _checkValidNamespace = function _checkValidNamespace(element) {\n let parent = getParentNode(element);\n // In JSDOM, if we're inside shadow DOM, then parentNode\n // can be null. We just simulate parent in this case.\n if (!parent || !parent.tagName) {\n parent = {\n namespaceURI: NAMESPACE,\n tagName: 'template'\n };\n }\n const tagName = stringToLowerCase(element.tagName);\n const parentTagName = stringToLowerCase(parent.tagName);\n if (!ALLOWED_NAMESPACES[element.namespaceURI]) {\n return false;\n }\n if (element.namespaceURI === SVG_NAMESPACE) {\n // The only way to switch from HTML namespace to SVG\n // is via <svg>. If it happens via any other tag, then\n // it should be killed.\n if (parent.namespaceURI === HTML_NAMESPACE) {\n return tagName === 'svg';\n }\n // The only way to switch from MathML to SVG is via`\n // svg if parent is either <annotation-xml> or MathML\n // text integration points.\n if (parent.namespaceURI === MATHML_NAMESPACE) {\n return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);\n }\n // We only allow elements that are defined in SVG\n // spec. All others are disallowed in SVG namespace.\n return Boolean(ALL_SVG_TAGS[tagName]);\n }\n if (element.namespaceURI === MATHML_NAMESPACE) {\n // The only way to switch from HTML namespace to MathML\n // is via <math>. If it happens via any other tag, then\n // it should be killed.\n if (parent.namespaceURI === HTML_NAMESPACE) {\n return tagName === 'math';\n }\n // The only way to switch from SVG to MathML is via\n // <math> and HTML integration points\n if (parent.namespaceURI === SVG_NAMESPACE) {\n return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];\n }\n // We only allow elements that are defined in MathML\n // spec. All others are disallowed in MathML namespace.\n return Boolean(ALL_MATHML_TAGS[tagName]);\n }\n if (element.namespaceURI === HTML_NAMESPACE) {\n // The only way to switch from SVG to HTML is via\n // HTML integration points, and from MathML to HTML\n // is via MathML text integration points\n if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {\n return false;\n }\n if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {\n return false;\n }\n // We disallow tags that are specific for MathML\n // or SVG and should never appear in HTML namespace\n return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);\n }\n // For XHTML and XML documents that support custom namespaces\n if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) {\n return true;\n }\n // The code should never reach this place (this means\n // that the element somehow got namespace that is not\n // HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES).\n // Return false just in case.\n return false;\n };\n /**\n * _forceRemove\n *\n * @param node a DOM node\n */\n const _forceRemove = function _forceRemove(node) {\n arrayPush(DOMPurify.removed, {\n element: node\n });\n try {\n // eslint-disable-next-line unicorn/prefer-dom-node-remove\n getParentNode(node).removeChild(node);\n } catch (_) {\n remove(node);\n }\n };\n /**\n * _removeAttribute\n *\n * @param name an Attribute name\n * @param element a DOM node\n */\n const _removeAttribute = function _removeAttribute(name, element) {\n try {\n arrayPush(DOMPurify.removed, {\n attribute: element.getAttributeNode(name),\n from: element\n });\n } catch (_) {\n arrayPush(DOMPurify.removed, {\n attribute: null,\n from: element\n });\n }\n element.removeAttribute(name);\n // We void attribute values for unremovable \"is\" attributes\n if (name === 'is') {\n if (RETURN_DOM || RETURN_DOM_FRAGMENT) {\n try {\n _forceRemove(element);\n } catch (_) {}\n } else {\n try {\n element.setAttribute(name, '');\n } catch (_) {}\n }\n }\n };\n /**\n * _initDocument\n *\n * @param dirty - a string of dirty markup\n * @return a DOM, filled with the dirty markup\n */\n const _initDocument = function _initDocument(dirty) {\n /* Create a HTML document */\n let doc = null;\n let leadingWhitespace = null;\n if (FORCE_BODY) {\n dirty = '<remove></remove>' + dirty;\n } else {\n /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */\n const matches = stringMatch(dirty, /^[\\r\\n\\t ]+/);\n leadingWhitespace = matches && matches[0];\n }\n if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) {\n // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)\n dirty = '<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body>' + dirty + '</body></html>';\n }\n const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;\n /*\n * Use the DOMParser API by default, fallback later if needs be\n * DOMParser not work for svg when has multiple root element.\n */\n if (NAMESPACE === HTML_NAMESPACE) {\n try {\n doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);\n } catch (_) {}\n }\n /* Use createHTMLDocument in case DOMParser is not available */\n if (!doc || !doc.documentElement) {\n doc = implementation.createDocument(NAMESPACE, 'template', null);\n try {\n doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;\n } catch (_) {\n // Syntax error if dirtyPayload is invalid xml\n }\n }\n const body = doc.body || doc.documentElement;\n if (dirty && leadingWhitespace) {\n body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);\n }\n /* Work on whole document or just its body */\n if (NAMESPACE === HTML_NAMESPACE) {\n return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];\n }\n return WHOLE_DOCUMENT ? doc.documentElement : body;\n };\n /**\n * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.\n *\n * @param root The root element or node to start traversing on.\n * @return The created NodeIterator\n */\n const _createNodeIterator = function _createNodeIterator(root) {\n return createNodeIterator.call(root.ownerDocument || root, root,\n // eslint-disable-next-line no-bitwise\n NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION, null);\n };\n /**\n * _isClobbered\n *\n * @param element element to check for clobbering attacks\n * @return true if clobbered, false if safe\n */\n const _isClobbered = function _isClobbered(element) {\n return element instanceof HTMLFormElement && (typeof element.nodeName !== 'string' || typeof element.textContent !== 'string' || typeof element.removeChild !== 'function' || !(element.attributes instanceof NamedNodeMap) || typeof element.removeAttribute !== 'function' || typeof element.setAttribute !== 'function' || typeof element.namespaceURI !== 'string' || typeof element.insertBefore !== 'function' || typeof element.hasChildNodes !== 'function');\n };\n /**\n * Checks whether the given object is a DOM node.\n *\n * @param value object to check whether it's a DOM node\n * @return true is object is a DOM node\n */\n const _isNode = function _isNode(value) {\n return typeof Node === 'function' && value instanceof Node;\n };\n function _executeHooks(hooks, currentNode, data) {\n arrayForEach(hooks, hook => {\n hook.call(DOMPurify, currentNode, data, CONFIG);\n });\n }\n /**\n * _sanitizeElements\n *\n * @protect nodeName\n * @protect textContent\n * @protect removeChild\n * @param currentNode to check for permission to exist\n * @return true if node was killed, false if left alive\n */\n const _sanitizeElements = function _sanitizeElements(currentNode) {\n let content = null;\n /* Execute a hook if present */\n _executeHooks(hooks.beforeSanitizeElements, currentNode, null);\n /* Check if element is clobbered or can clobber */\n if (_isClobbered(currentNode)) {\n _forceRemove(currentNode);\n return true;\n }\n /* Now let's check the element's type and name */\n const tagName = transformCaseFunc(currentNode.nodeName);\n /* Execute a hook if present */\n _executeHooks(hooks.uponSanitizeElement, currentNode, {\n tagName,\n allowedTags: ALLOWED_TAGS\n });\n /* Detect mXSS attempts abusing namespace confusion */\n if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\\w!]/g, currentNode.innerHTML) && regExpTest(/<[/\\w!]/g, currentNode.textContent)) {\n _forceRemove(currentNode);\n return true;\n }\n /* Remove any occurrence of processing instructions */\n if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {\n _forceRemove(currentNode);\n return true;\n }\n /* Remove any kind of possibly harmful comments */\n if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(/<[/\\w]/g, currentNode.data)) {\n _forceRemove(currentNode);\n return true;\n }\n /* Remove element if anything forbids its presence */\n if (!(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName])) {\n /* Check if we have a custom element to handle */\n if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {\n if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {\n return false;\n }\n if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {\n return false;\n }\n }\n /* Keep content except for bad-listed elements */\n if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {\n const parentNode = getParentNode(currentNode) || currentNode.parentNode;\n const childNodes = getChildNodes(currentNode) || currentNode.childNodes;\n if (childNodes && parentNode) {\n const childCount = childNodes.length;\n for (let i = childCount - 1; i >= 0; --i) {\n const childClone = cloneNode(childNodes[i], true);\n childClone.__removalCount = (currentNode.__removalCount || 0) + 1;\n parentNode.insertBefore(childClone, getNextSibling(currentNode));\n }\n }\n }\n _forceRemove(currentNode);\n return true;\n }\n /* Check whether element has a valid namespace */\n if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {\n _forceRemove(currentNode);\n return true;\n }\n /* Make sure that older browsers don't get fallback-tag mXSS */\n if ((tagName === 'noscript' || tagName === 'noembed' || tagName === 'noframes') && regExpTest(/<\\/no(script|embed|frames)/i, currentNode.innerHTML)) {\n _forceRemove(currentNode);\n return true;\n }\n /* Sanitize element content to be template-safe */\n if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {\n /* Get the element's text content */\n content = currentNode.textContent;\n arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {\n content = stringReplace(content, expr, ' ');\n });\n if (currentNode.textContent !== content) {\n arrayPush(DOMPurify.removed, {\n element: currentNode.cloneNode()\n });\n currentNode.textContent = content;\n }\n }\n /* Execute a hook if present */\n _executeHooks(hooks.afterSanitizeElements, currentNode, null);\n return false;\n };\n /**\n * _isValidAttribute\n *\n * @param lcTag Lowercase tag name of containing element.\n * @param lcName Lowercase attribute name.\n * @param value Attribute value.\n * @return Returns true if `value` is valid, otherwise false.\n */\n // eslint-disable-next-line complexity\n const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {\n /* Make sure attribute cannot clobber */\n if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {\n return false;\n }\n /* Allow valid data-* attributes: At least one character after \"-\"\n (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)\n XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)\n We don't need to check the value; it's always URI safe. */\n if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)) ; else if (EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {\n if (\n // First condition does a very basic check if a) it's basically a valid custom element tagname AND\n // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck\n // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck\n _isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName, lcTag)) ||\n // Alternative, second condition checks if it's an `is`-attribute, AND\n // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck\n lcName === 'is' && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))) ; else {\n return false;\n }\n /* Check value is safe. First, is attr inert? If so, is safe */\n } else if (URI_SAFE_ATTRIBUTES[lcName]) ; else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if ((lcName === 'src' || lcName === 'xlink:href' || lcName === 'href') && lcTag !== 'script' && stringIndexOf(value, 'data:') === 0 && DATA_URI_TAGS[lcTag]) ; else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if (value) {\n return false;\n } else ;\n return true;\n };\n /**\n * _isBasicCustomElement\n * checks if at least one dash is included in tagName, and it's not the first char\n * for more sophisticated checking see https://github.com/sindresorhus/validate-element-name\n *\n * @param tagName name of the tag of the node to sanitize\n * @returns Returns true if the tag name meets the basic criteria for a custom element, otherwise false.\n */\n const _isBasicCustomElement = function _isBasicCustomElement(tagName) {\n return tagName !== 'annotation-xml' && stringMatch(tagName, CUSTOM_ELEMENT);\n };\n /**\n * _sanitizeAttributes\n *\n * @protect attributes\n * @protect nodeName\n * @protect removeAttribute\n * @protect setAttribute\n *\n * @param currentNode to sanitize\n */\n const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {\n /* Execute a hook if present */\n _executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);\n const {\n attributes\n } = currentNode;\n /* Check if we have attributes; if not we might have a text node */\n if (!attributes || _isClobbered(currentNode)) {\n return;\n }\n const hookEvent = {\n attrName: '',\n attrValue: '',\n keepAttr: true,\n allowedAttributes: ALLOWED_ATTR,\n forceKeepAttr: undefined\n };\n let l = attributes.length;\n /* Go backwards over all attributes; safely remove bad ones */\n while (l--) {\n const attr = attributes[l];\n const {\n name,\n namespaceURI,\n value: attrValue\n } = attr;\n const lcName = transformCaseFunc(name);\n const initValue = attrValue;\n let value = name === 'value' ? initValue : stringTrim(initValue);\n /* Execute a hook if present */\n hookEvent.attrName = lcName;\n hookEvent.attrValue = value;\n hookEvent.keepAttr = true;\n hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set\n _executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);\n value = hookEvent.attrValue;\n /* Full DOM Clobbering protection via namespace isolation,\n * Prefix id and name attributes with `user-content-`\n */\n if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) {\n // Remove the attribute with this value\n _removeAttribute(name, currentNode);\n // Prefix the value and later re-create the attribute with the sanitized value\n value = SANITIZE_NAMED_PROPS_PREFIX + value;\n }\n /* Work around a security issue with comments inside attributes */\n if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\\/(style|title|textarea)/i, value)) {\n _removeAttribute(name, currentNode);\n continue;\n }\n /* Make sure we cannot easily use animated hrefs, even if animations are allowed */\n if (lcName === 'attributename' && stringMatch(value, 'href')) {\n _removeAttribute(name, currentNode);\n continue;\n }\n /* Did the hooks approve of the attribute? */\n if (hookEvent.forceKeepAttr) {\n continue;\n }\n /* Did the hooks approve of the attribute? */\n if (!hookEvent.keepAttr) {\n _removeAttribute(name, currentNode);\n continue;\n }\n /* Work around a security issue in jQuery 3.0 */\n if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\\/>/i, value)) {\n _removeAttribute(name, currentNode);\n continue;\n }\n /* Sanitize attribute content to be template-safe */\n if (SAFE_FOR_TEMPLATES) {\n arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {\n value = stringReplace(value, expr, ' ');\n });\n }\n /* Is `value` valid for this attribute? */\n const lcTag = transformCaseFunc(currentNode.nodeName);\n if (!_isValidAttribute(lcTag, lcName, value)) {\n _removeAttribute(name, currentNode);\n continue;\n }\n /* Handle attributes that require Trusted Types */\n if (trustedTypesPolicy && typeof trustedTypes === 'object' && typeof trustedTypes.getAttributeType === 'function') {\n if (namespaceURI) ; else {\n switch (trustedTypes.getAttributeType(lcTag, lcName)) {\n case 'TrustedHTML':\n {\n value = trustedTypesPolicy.createHTML(value);\n break;\n }\n case 'TrustedScriptURL':\n {\n value = trustedTypesPolicy.createScriptURL(value);\n break;\n }\n }\n }\n }\n /* Handle invalid data-* attribute set by try-catching it */\n if (value !== initValue) {\n try {\n if (namespaceURI) {\n currentNode.setAttributeNS(namespaceURI, name, value);\n } else {\n /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. \"x-schema\". */\n currentNode.setAttribute(name, value);\n }\n if (_isClobbered(currentNode)) {\n _forceRemove(currentNode);\n } else {\n arrayPop(DOMPurify.removed);\n }\n } catch (_) {\n _removeAttribute(name, currentNode);\n }\n }\n }\n /* Execute a hook if present */\n _executeHooks(hooks.afterSanitizeAttributes, currentNode, null);\n };\n /**\n * _sanitizeShadowDOM\n *\n * @param fragment to iterate over recursively\n */\n const _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {\n let shadowNode = null;\n const shadowIterator = _createNodeIterator(fragment);\n /* Execute a hook if present */\n _executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);\n while (shadowNode = shadowIterator.nextNode()) {\n /* Execute a hook if present */\n _executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);\n /* Sanitize tags and elements */\n _sanitizeElements(shadowNode);\n /* Check attributes next */\n _sanitizeAttributes(shadowNode);\n /* Deep shadow DOM detected */\n if (shadowNode.content instanceof DocumentFragment) {\n _sanitizeShadowDOM(shadowNode.content);\n }\n }\n /* Execute a hook if present */\n _executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);\n };\n // eslint-disable-next-line complexity\n DOMPurify.sanitize = function (dirty) {\n let cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n let body = null;\n let importedNode = null;\n let currentNode = null;\n let returnNode = null;\n /* Make sure we have a string to sanitize.\n DO NOT return early, as this will return the wrong type if\n the user has requested a DOM object rather than a string */\n IS_EMPTY_INPUT = !dirty;\n if (IS_EMPTY_INPUT) {\n dirty = '<!-->';\n }\n /* Stringify, in case dirty is an object */\n if (typeof dirty !== 'string' && !_isNode(dirty)) {\n if (typeof dirty.toString === 'function') {\n dirty = dirty.toString();\n if (typeof dirty !== 'string') {\n throw typeErrorCreate('dirty is not a string, aborting');\n }\n } else {\n throw typeErrorCreate('toString is not a function');\n }\n }\n /* Return dirty HTML if DOMPurify cannot run */\n if (!DOMPurify.isSupported) {\n return dirty;\n }\n /* Assign config vars */\n if (!SET_CONFIG) {\n _parseConfig(cfg);\n }\n /* Clean up removed elements */\n DOMPurify.removed = [];\n /* Check if dirty is correctly typed for IN_PLACE */\n if (typeof dirty === 'string') {\n IN_PLACE = false;\n }\n if (IN_PLACE) {\n /* Do some early pre-sanitization to avoid unsafe root nodes */\n if (dirty.nodeName) {\n const tagName = transformCaseFunc(dirty.nodeName);\n if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {\n throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place');\n }\n }\n } else if (dirty instanceof Node) {\n /* If dirty is a DOM element, append to an empty document to avoid\n elements being stripped by the parser */\n body = _initDocument('<!---->');\n importedNode = body.ownerDocument.importNode(dirty, true);\n if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === 'BODY') {\n /* Node is already a body, use as is */\n body = importedNode;\n } else if (importedNode.nodeName === 'HTML') {\n body = importedNode;\n } else {\n // eslint-disable-next-line unicorn/prefer-dom-node-append\n body.appendChild(importedNode);\n }\n } else {\n /* Exit directly if we have nothing to do */\n if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT &&\n // eslint-disable-next-line unicorn/prefer-includes\n dirty.indexOf('<') === -1) {\n return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;\n }\n /* Initialize the document to work on */\n body = _initDocument(dirty);\n /* Check we have a DOM node from the data */\n if (!body) {\n return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : '';\n }\n }\n /* Remove first element node (ours) if FORCE_BODY is set */\n if (body && FORCE_BODY) {\n _forceRemove(body.firstChild);\n }\n /* Get node iterator */\n const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);\n /* Now start iterating over the created document */\n while (currentNode = nodeIterator.nextNode()) {\n /* Sanitize tags and elements */\n _sanitizeElements(currentNode);\n /* Check attributes next */\n _sanitizeAttributes(currentNode);\n /* Shadow DOM detected, sanitize it */\n if (currentNode.content instanceof DocumentFragment) {\n _sanitizeShadowDOM(currentNode.content);\n }\n }\n /* If we sanitized `dirty` in-place, return it. */\n if (IN_PLACE) {\n return dirty;\n }\n /* Return sanitized string or DOM */\n if (RETURN_DOM) {\n if (RETURN_DOM_FRAGMENT) {\n returnNode = createDocumentFragment.call(body.ownerDocument);\n while (body.firstChild) {\n // eslint-disable-next-line unicorn/prefer-dom-node-append\n returnNode.appendChild(body.firstChild);\n }\n } else {\n returnNode = body;\n }\n if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {\n /*\n AdoptNode() is not used because internal state is not reset\n (e.g. the past names map of a HTMLFormElement), this is safe\n in theory but we would rather not risk another attack vector.\n The state that is cloned by importNode() is explicitly defined\n by the specs.\n */\n returnNode = importNode.call(originalDocument, returnNode, true);\n }\n return returnNode;\n }\n let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;\n /* Serialize doctype if allowed */\n if (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {\n serializedHTML = '<!DOCTYPE ' + body.ownerDocument.doctype.name + '>\\n' + serializedHTML;\n }\n /* Sanitize final string template-safe */\n if (SAFE_FOR_TEMPLATES) {\n arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {\n serializedHTML = stringReplace(serializedHTML, expr, ' ');\n });\n }\n return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;\n };\n DOMPurify.setConfig = function () {\n let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _parseConfig(cfg);\n SET_CONFIG = true;\n };\n DOMPurify.clearConfig = function () {\n CONFIG = null;\n SET_CONFIG = false;\n };\n DOMPurify.isValidAttribute = function (tag, attr, value) {\n /* Initialize shared config vars if necessary. */\n if (!CONFIG) {\n _parseConfig({});\n }\n const lcTag = transformCaseFunc(tag);\n const lcName = transformCaseFunc(attr);\n return _isValidAttribute(lcTag, lcName, value);\n };\n DOMPurify.addHook = function (entryPoint, hookFunction) {\n if (typeof hookFunction !== 'function') {\n return;\n }\n arrayPush(hooks[entryPoint], hookFunction);\n };\n DOMPurify.removeHook = function (entryPoint, hookFunction) {\n if (hookFunction !== undefined) {\n const index = arrayLastIndexOf(hooks[entryPoint], hookFunction);\n return index === -1 ? undefined : arraySplice(hooks[entryPoint], index, 1)[0];\n }\n return arrayPop(hooks[entryPoint]);\n };\n DOMPurify.removeHooks = function (entryPoint) {\n hooks[entryPoint] = [];\n };\n DOMPurify.removeAllHooks = function () {\n hooks = _createHooksMap();\n };\n return DOMPurify;\n}\nvar purify = createDOMPurify();\n\nexport { purify as default };\n//# sourceMappingURL=purify.es.mjs.map\n","import { PropertyMatchType } from './types'\nimport { SurveyActionType, SurveyEventWithFilters } from './posthog-surveys-types'\nimport type { InferredSelector } from './extensions/product-tours/element-inference'\n\nexport interface JSONContent {\n type?: string\n attrs?: Record<string, any>\n content?: JSONContent[]\n marks?: { type: string; attrs?: Record<string, any> }[]\n text?: string\n}\n\nexport type ProductTourStepType = 'element' | 'modal' | 'survey'\n\nexport type ProductTourSurveyQuestionType = 'open' | 'rating'\n\nexport interface ProductTourSurveyQuestion {\n type: ProductTourSurveyQuestionType\n questionText: string\n /** Rating display type - emoji or number */\n display?: 'emoji' | 'number'\n /** Rating scale - 3 or 5 for emoji, 5 or 10 for number */\n scale?: 3 | 5 | 10\n /** Label for low end of rating scale (e.g., \"Not likely\") */\n lowerBoundLabel?: string\n /** Label for high end of rating scale (e.g., \"Very likely\") */\n upperBoundLabel?: string\n}\n\nexport interface ProductTourStep {\n id: string\n type: ProductTourStepType\n selector?: string\n progressionTrigger: 'button' | 'click'\n content: JSONContent | null\n /** Pre-rendered HTML content from the editor. If present, SDK should use this instead of rendering from JSONContent. */\n contentHtml?: string\n /** Inline survey question config - if present, this is a survey step */\n survey?: ProductTourSurveyQuestion\n /** ID of the auto-created survey for this step (set by backend) */\n linkedSurveyId?: string\n /** ID of the survey question (set by backend, used for event tracking) */\n linkedSurveyQuestionId?: string\n /** Enhanced element data for more reliable lookup at runtime */\n inferenceData?: InferredSelector\n /** Maximum tooltip width in pixels (defaults to 320px) */\n maxWidth?: number\n}\n\nexport interface ProductTourConditions {\n url?: string\n urlMatchType?: PropertyMatchType\n selector?: string\n autoShowDelaySeconds?: number\n events?: {\n values: SurveyEventWithFilters[]\n } | null\n cancelEvents?: {\n values: SurveyEventWithFilters[]\n } | null\n actions?: {\n values: SurveyActionType[]\n } | null\n}\n\nexport interface ProductTourAppearance {\n backgroundColor?: string\n textColor?: string\n buttonColor?: string\n borderRadius?: number\n buttonBorderRadius?: number\n borderColor?: string\n fontFamily?: string\n boxShadow?: string\n showOverlay?: boolean\n whiteLabel?: boolean\n}\n\nexport interface ProductTour {\n id: string\n name: string\n description?: string\n type: 'product_tour'\n auto_launch?: boolean\n start_date: string | null\n end_date: string | null\n current_iteration?: number\n conditions?: ProductTourConditions\n appearance?: ProductTourAppearance\n steps: ProductTourStep[]\n internal_targeting_flag_key?: string\n linked_flag_key?: string\n}\n\nexport type ProductTourCallback = (tours: ProductTour[], context?: { isLoaded: boolean; error?: string }) => void\n\nexport type ProductTourSelectorError = 'not_found' | 'multiple_matches' | 'not_visible'\n\nexport type ProductTourDismissReason =\n | 'user_clicked_skip'\n | 'user_clicked_outside'\n | 'escape_key'\n | 'element_unavailable'\n\nexport type ProductTourRenderReason = 'auto' | 'api' | 'trigger' | 'event'\n\nexport const DEFAULT_PRODUCT_TOUR_APPEARANCE: Required<ProductTourAppearance> = {\n backgroundColor: '#ffffff',\n textColor: '#1d1f27',\n buttonColor: '#1d1f27',\n borderRadius: 8,\n buttonBorderRadius: 6,\n borderColor: '#e5e7eb',\n fontFamily: 'system-ui',\n boxShadow: '0 4px 12px rgba(0, 0, 0, 0.15)',\n showOverlay: true,\n whiteLabel: false,\n}\n\nexport interface ShowTourOptions {\n reason?: ProductTourRenderReason\n enableStrictValidation?: boolean\n}\n","import Config from '../config'\nimport { isUndefined } from '@posthog/core'\nimport { assignableWindow, window } from './globals'\nimport type { Logger } from '@posthog/core'\n\ntype CreateLoggerOptions = {\n debugEnabled?: boolean\n}\n\ntype PosthogJsLogger = Omit<Logger, 'createLogger'> & {\n _log: (level: 'log' | 'warn' | 'error', ...args: any[]) => void\n uninitializedWarning: (methodName: string) => void\n createLogger: (prefix: string, options?: CreateLoggerOptions) => PosthogJsLogger\n}\n\nconst _createLogger = (prefix: string, { debugEnabled }: CreateLoggerOptions = {}): PosthogJsLogger => {\n const logger: PosthogJsLogger = {\n _log: (level: 'log' | 'warn' | 'error', ...args: any[]) => {\n if (\n window &&\n (Config.DEBUG || assignableWindow.POSTHOG_DEBUG || debugEnabled) &&\n !isUndefined(window.console) &&\n window.console\n ) {\n const consoleLog =\n '__rrweb_original__' in window.console[level]\n ? (window.console[level] as any)['__rrweb_original__']\n : window.console[level]\n\n // eslint-disable-next-line no-console\n consoleLog(prefix, ...args)\n }\n },\n\n info: (...args: any[]) => {\n logger._log('log', ...args)\n },\n\n warn: (...args: any[]) => {\n logger._log('warn', ...args)\n },\n\n error: (...args: any[]) => {\n logger._log('error', ...args)\n },\n\n critical: (...args: any[]) => {\n // Critical errors are always logged to the console\n // eslint-disable-next-line no-console\n console.error(prefix, ...args)\n },\n\n uninitializedWarning: (methodName: string) => {\n logger.error(`You must initialize PostHog before calling ${methodName}`)\n },\n\n createLogger: (additionalPrefix: string, options?: CreateLoggerOptions) =>\n _createLogger(`${prefix} ${additionalPrefix}`, options),\n }\n return logger\n}\n\nexport const logger = _createLogger('[PostHog.js]')\n\nexport const createLogger = logger.createLogger\n","import { knownUnsafeEditableEvent } from \"../types.mjs\";\nimport { includes } from \"./string-utils.mjs\";\nconst nativeIsArray = Array.isArray;\nconst ObjProto = Object.prototype;\nconst type_utils_hasOwnProperty = ObjProto.hasOwnProperty;\nconst type_utils_toString = ObjProto.toString;\nconst isArray = nativeIsArray || function(obj) {\n return '[object Array]' === type_utils_toString.call(obj);\n};\nconst isFunction = (x)=>'function' == typeof x;\nconst isNativeFunction = (x)=>isFunction(x) && -1 !== x.toString().indexOf('[native code]');\nconst isObject = (x)=>x === Object(x) && !isArray(x);\nconst isEmptyObject = (x)=>{\n if (isObject(x)) {\n for(const key in x)if (type_utils_hasOwnProperty.call(x, key)) return false;\n return true;\n }\n return false;\n};\nconst isUndefined = (x)=>void 0 === x;\nconst isString = (x)=>'[object String]' == type_utils_toString.call(x);\nconst isEmptyString = (x)=>isString(x) && 0 === x.trim().length;\nconst isNull = (x)=>null === x;\nconst isNullish = (x)=>isUndefined(x) || isNull(x);\nconst isNumber = (x)=>'[object Number]' == type_utils_toString.call(x);\nconst isBoolean = (x)=>'[object Boolean]' === type_utils_toString.call(x);\nconst isFormData = (x)=>x instanceof FormData;\nconst isFile = (x)=>x instanceof File;\nconst isPlainError = (x)=>x instanceof Error;\nconst isKnownUnsafeEditableEvent = (x)=>includes(knownUnsafeEditableEvent, x);\nfunction isPrimitive(value) {\n return null === value || 'object' != typeof value;\n}\nfunction isBuiltin(candidate, className) {\n return Object.prototype.toString.call(candidate) === `[object ${className}]`;\n}\nfunction isError(candidate) {\n switch(Object.prototype.toString.call(candidate)){\n case '[object Error]':\n case '[object Exception]':\n case '[object DOMException]':\n case '[object DOMError]':\n case '[object WebAssembly.Exception]':\n return true;\n default:\n return isInstanceOf(candidate, Error);\n }\n}\nfunction isErrorEvent(event) {\n return isBuiltin(event, 'ErrorEvent');\n}\nfunction isEvent(candidate) {\n return !isUndefined(Event) && isInstanceOf(candidate, Event);\n}\nfunction isPlainObject(candidate) {\n return isBuiltin(candidate, 'Object');\n}\nfunction isInstanceOf(candidate, base) {\n try {\n return candidate instanceof base;\n } catch {\n return false;\n }\n}\nconst yesLikeValues = [\n true,\n 'true',\n 1,\n '1',\n 'yes'\n];\nconst isYesLike = (val)=>includes(yesLikeValues, val);\nconst noLikeValues = [\n false,\n 'false',\n 0,\n '0',\n 'no'\n];\nconst isNoLike = (val)=>includes(noLikeValues, val);\nexport { type_utils_hasOwnProperty as hasOwnProperty, isArray, isBoolean, isBuiltin, isEmptyObject, isEmptyString, isError, isErrorEvent, isEvent, isFile, isFormData, isFunction, isKnownUnsafeEditableEvent, isNativeFunction, isNoLike, isNull, isNullish, isNumber, isObject, isPlainError, isPlainObject, isPrimitive, isString, isUndefined, isYesLike, noLikeValues, yesLikeValues };\n","import { PostHog } from '../../posthog-core'\nimport { createLogger } from '../../utils/logger'\n\nconst logger = createLogger('[Stylesheet Loader]')\n\nexport const prepareStylesheet = (document: Document, innerText: string, posthog?: PostHog) => {\n // Forcing the existence of `document` requires this function to be called in a browser environment\n let stylesheet: HTMLStyleElement | null = document.createElement('style')\n stylesheet.innerText = innerText\n\n if (posthog?.config?.prepare_external_dependency_stylesheet) {\n stylesheet = posthog.config.prepare_external_dependency_stylesheet(stylesheet)\n }\n\n if (!stylesheet) {\n logger.error('prepare_external_dependency_stylesheet returned null')\n return null\n }\n\n return stylesheet\n}\n","import { DisplaySurveyOptions, DisplaySurveyType, Survey, SurveyType } from '../posthog-surveys-types'\nimport { createLogger } from '../utils/logger'\n\nexport const SURVEY_LOGGER = createLogger('[Surveys]')\n\nexport function isSurveyRunning(survey: Survey): boolean {\n return !!(survey.start_date && !survey.end_date)\n}\n\nexport function doesSurveyActivateByEvent(survey: Pick<Survey, 'conditions'>): boolean {\n return !!survey.conditions?.events?.values?.length\n}\n\nexport function doesSurveyActivateByAction(survey: Pick<Survey, 'conditions'>): boolean {\n return !!survey.conditions?.actions?.values?.length\n}\n\nexport const SURVEY_SEEN_PREFIX = 'seenSurvey_'\nexport const SURVEY_IN_PROGRESS_PREFIX = 'inProgressSurvey_'\nexport const SURVEY_ABANDONED_PREFIX = 'abandonedSurvey_'\n\nexport const getSurveyInteractionProperty = (\n survey: Pick<Survey, 'id' | 'current_iteration'>,\n action: 'responded' | 'dismissed'\n): string => {\n let surveyProperty = `$survey_${action}/${survey.id}`\n if (survey.current_iteration && survey.current_iteration > 0) {\n surveyProperty = `$survey_${action}/${survey.id}/${survey.current_iteration}`\n }\n\n return surveyProperty\n}\n\nconst getSurveyStorageKey = (prefix: string, survey: Pick<Survey, 'id' | 'current_iteration'>): string => {\n let key = `${prefix}${survey.id}`\n if (survey.current_iteration && survey.current_iteration > 0) {\n key = `${prefix}${survey.id}_${survey.current_iteration}`\n }\n return key\n}\n\nexport const getSurveySeenKey = (survey: Pick<Survey, 'id' | 'current_iteration'>): string => {\n return getSurveyStorageKey(SURVEY_SEEN_PREFIX, survey)\n}\n\nexport const getSurveyAbandonedKey = (survey: Pick<Survey, 'id' | 'current_iteration'>): string => {\n return getSurveyStorageKey(SURVEY_ABANDONED_PREFIX, survey)\n}\n\nexport const setSurveySeenOnLocalStorage = (survey: Pick<Survey, 'id' | 'current_iteration'>) => {\n const isSurveySeen = localStorage.getItem(getSurveySeenKey(survey))\n // if survey is already seen, no need to set it again\n if (isSurveySeen) {\n return\n }\n\n localStorage.setItem(getSurveySeenKey(survey), 'true')\n}\n\n// These surveys are relevant for the getActiveMatchingSurveys method. They are used to\n// display surveys in our customer's application. Any new in-app survey type should be added here.\nexport const IN_APP_SURVEY_TYPES = [SurveyType.Popover, SurveyType.Widget, SurveyType.API]\n\nexport const DEFAULT_DISPLAY_SURVEY_OPTIONS: DisplaySurveyOptions = {\n ignoreConditions: false,\n ignoreDelay: false,\n displayType: DisplaySurveyType.Popover,\n}\n","import { each, find } from './utils'\nimport Config from './config'\nimport { Compression, RequestWithOptions, RequestResponse } from './types'\nimport { formDataToQuery } from './utils/request-utils'\n\nimport { logger } from './utils/logger'\nimport { AbortController, fetch, navigator, XMLHttpRequest } from './utils/globals'\nimport { gzipSync, strToU8 } from 'fflate'\n\nimport { _base64Encode } from './utils/encode-utils'\n\n// eslint-disable-next-line compat/compat\nexport const SUPPORTS_REQUEST = !!XMLHttpRequest || !!fetch\n\nconst CONTENT_TYPE_PLAIN = 'text/plain'\nconst CONTENT_TYPE_JSON = 'application/json'\nconst CONTENT_TYPE_FORM = 'application/x-www-form-urlencoded'\nconst SIXTY_FOUR_KILOBYTES = 64 * 1024\n/*\n fetch will fail if we request keepalive with a body greater than 64kb\n sets the threshold lower than that so that\n any overhead doesn't push over the threshold after checking here\n*/\nconst KEEP_ALIVE_THRESHOLD = SIXTY_FOUR_KILOBYTES * 0.8\ntype EncodedBody = {\n contentType: string\n body: string | BlobPart\n estimatedSize: number\n}\n\n/**\n * Extends a URL with additional query parameters\n * @param url - The URL to extend\n * @param params - The parameters to add\n * @param replace - When true (default), new params overwrite existing ones with same key. When false, existing params are preserved.\n * @returns The URL with extended parameters\n */\nexport const extendURLParams = (url: string, params: Record<string, any>, replace: boolean = true): string => {\n const [baseUrl, search] = url.split('?')\n const newParams = { ...params }\n\n const updatedSearch =\n search?.split('&').map((pair) => {\n const [key, origValue] = pair.split('=')\n const value = replace ? (newParams[key] ?? origValue) : origValue\n delete newParams[key]\n return `${key}=${value}`\n }) ?? []\n\n const remaining = formDataToQuery(newParams)\n if (remaining) {\n updatedSearch.push(remaining)\n }\n\n return `${baseUrl}?${updatedSearch.join('&')}`\n}\n\nexport const jsonStringify = (data: any, space?: string | number): string => {\n // With plain JSON.stringify, we get an exception when a property is a BigInt. This has caused problems for some users,\n // see https://github.com/PostHog/posthog-js/issues/1440\n // To work around this, we convert BigInts to strings before stringifying the data. This is not ideal, as we lose\n // information that this was originally a number, but given ClickHouse doesn't support BigInts, the customer\n // would not be able to operate on these numerically anyway.\n return JSON.stringify(data, (_, value) => (typeof value === 'bigint' ? value.toString() : value), space)\n}\n\nconst encodeToDataString = (data: string | Record<string, any>): string => {\n return 'data=' + encodeURIComponent(typeof data === 'string' ? data : jsonStringify(data))\n}\n\nconst encodePostData = ({ data, compression }: RequestWithOptions): EncodedBody | undefined => {\n if (!data) {\n return\n }\n\n if (compression === Compression.GZipJS) {\n const gzipData = gzipSync(strToU8(jsonStringify(data)), { mtime: 0 })\n const blob = new Blob([gzipData], { type: CONTENT_TYPE_PLAIN })\n return {\n contentType: CONTENT_TYPE_PLAIN,\n body: blob,\n estimatedSize: blob.size,\n }\n }\n\n if (compression === Compression.Base64) {\n const b64data = _base64Encode(jsonStringify(data))\n const encodedBody = encodeToDataString(b64data)\n\n return {\n contentType: CONTENT_TYPE_FORM,\n body: encodedBody,\n estimatedSize: new Blob([encodedBody]).size,\n }\n }\n\n const jsonBody = jsonStringify(data)\n return {\n contentType: CONTENT_TYPE_JSON,\n body: jsonBody,\n estimatedSize: new Blob([jsonBody]).size,\n }\n}\n\nconst xhr = (options: RequestWithOptions) => {\n const req = new XMLHttpRequest!()\n req.open(options.method || 'GET', options.url, true)\n const { contentType, body } = encodePostData(options) ?? {}\n\n each(options.headers, function (headerValue, headerName) {\n req.setRequestHeader(headerName, headerValue)\n })\n\n if (contentType) {\n req.setRequestHeader('Content-Type', contentType)\n }\n\n if (options.timeout) {\n req.timeout = options.timeout\n }\n if (!options.disableXHRCredentials) {\n // send the ph_optout cookie\n // withCredentials cannot be modified until after calling .open on Android and Mobile Safari\n req.withCredentials = true\n }\n req.onreadystatechange = () => {\n // XMLHttpRequest.DONE == 4, except in safari 4\n if (req.readyState === 4) {\n const response: RequestResponse = {\n statusCode: req.status,\n text: req.responseText,\n }\n if (req.status === 200) {\n try {\n response.json = JSON.parse(req.responseText)\n } catch {\n // logger.error(e)\n }\n }\n\n options.callback?.(response)\n }\n }\n req.send(body)\n}\n\nconst _fetch = (options: RequestWithOptions) => {\n const { contentType, body, estimatedSize } = encodePostData(options) ?? {}\n\n // eslint-disable-next-line compat/compat\n const headers = new Headers()\n each(options.headers, function (headerValue, headerName) {\n headers.append(headerName, headerValue)\n })\n\n if (contentType) {\n headers.append('Content-Type', contentType)\n }\n\n const url = options.url\n let aborter: { signal: any; timeout: ReturnType<typeof setTimeout> } | null = null\n\n if (AbortController) {\n const controller = new AbortController()\n aborter = {\n signal: controller.signal,\n timeout: setTimeout(() => controller.abort(), options.timeout),\n }\n }\n\n fetch!(url, {\n method: options?.method || 'GET',\n headers,\n // if body is greater than 64kb, then fetch with keepalive will error\n // see 8:10:5 at https://fetch.spec.whatwg.org/#http-network-or-cache-fetch,\n // but we do want to set keepalive sometimes as it can help with success\n // when e.g. a page is being closed\n // so let's get the best of both worlds and only set keepalive for POST requests\n // where the body is less than 64kb\n // NB this is fetch keepalive and not http keepalive\n keepalive: options.method === 'POST' && (estimatedSize || 0) < KEEP_ALIVE_THRESHOLD,\n body,\n signal: aborter?.signal,\n ...options.fetchOptions,\n })\n .then((response) => {\n return response.text().then((responseText) => {\n const res: RequestResponse = {\n statusCode: response.status,\n text: responseText,\n }\n\n if (response.status === 200) {\n try {\n res.json = JSON.parse(responseText)\n } catch (e) {\n logger.error(e)\n }\n }\n\n options.callback?.(res)\n })\n })\n .catch((error) => {\n logger.error(error)\n options.callback?.({ statusCode: 0, text: error })\n })\n .finally(() => (aborter ? clearTimeout(aborter.timeout) : null))\n\n return\n}\n\nconst _sendBeacon = (options: RequestWithOptions) => {\n // beacon documentation https://w3c.github.io/beacon/\n // beacons format the message and use the type property\n\n const url = extendURLParams(options.url, {\n beacon: '1',\n })\n\n try {\n const { contentType, body } = encodePostData(options) ?? {}\n // sendBeacon requires a blob so we convert it\n const sendBeaconBody = typeof body === 'string' ? new Blob([body], { type: contentType }) : body\n navigator!.sendBeacon!(url, sendBeaconBody)\n } catch {\n // send beacon is a best-effort, fire-and-forget mechanism on page unload,\n // we don't want to throw errors here\n }\n}\n\nconst AVAILABLE_TRANSPORTS: {\n transport: RequestWithOptions['transport']\n method: (options: RequestWithOptions) => void\n}[] = []\n\n// We add the transports in order of preference\nif (fetch) {\n AVAILABLE_TRANSPORTS.push({\n transport: 'fetch',\n method: _fetch,\n })\n}\n\nif (XMLHttpRequest) {\n AVAILABLE_TRANSPORTS.push({\n transport: 'XHR',\n method: xhr,\n })\n}\n\nif (navigator?.sendBeacon) {\n AVAILABLE_TRANSPORTS.push({\n transport: 'sendBeacon',\n method: _sendBeacon,\n })\n}\n\n// This is the entrypoint. It takes care of sanitizing the options and then calls the appropriate request method.\nexport const request = (_options: RequestWithOptions) => {\n // Clone the options so we don't modify the original object\n const options = { ..._options }\n options.timeout = options.timeout || 60000\n\n options.url = extendURLParams(options.url, {\n _: new Date().getTime().toString(),\n ver: Config.LIB_VERSION,\n compression: options.compression,\n })\n\n const transport = options.transport ?? 'fetch'\n\n const availableTransports = AVAILABLE_TRANSPORTS.filter(\n (t) => !options.disableTransport || !t.transport || !options.disableTransport.includes(t.transport)\n )\n\n const transportMethod =\n find(availableTransports, (t) => t.transport === transport)?.method ?? availableTransports[0].method\n\n if (!transportMethod) {\n throw new Error('No available transport method')\n }\n\n transportMethod(options)\n}\n","import { VNode, cloneElement, createContext, type JSX } from 'preact'\nimport { PostHog } from '../../posthog-core'\nimport {\n MultipleSurveyQuestion,\n Survey,\n SurveyAppearance,\n SurveyEventName,\n SurveyEventProperties,\n SurveyPosition,\n SurveyQuestion,\n SurveySchedule,\n SurveyType,\n SurveyWidgetType,\n} from '../../posthog-surveys-types'\nimport { document as _document, window as _window, userAgent } from '../../utils/globals'\nimport {\n getSurveyInteractionProperty,\n getSurveySeenKey,\n getSurveyAbandonedKey,\n SURVEY_LOGGER as logger,\n setSurveySeenOnLocalStorage,\n SURVEY_IN_PROGRESS_PREFIX,\n} from '../../utils/survey-utils'\nimport { isArray, isNullish } from '@posthog/core'\n\nimport { detectDeviceType } from '@posthog/core'\nimport { propertyComparisons } from '../../utils/property-utils'\nimport { PropertyMatchType } from '../../types'\nimport { prepareStylesheet } from '../utils/stylesheet-loader'\n// We cast the types here which is dangerous but protected by the top level generateSurveys call\nconst window = _window as Window & typeof globalThis\nconst document = _document as Document\nimport surveyStyles from './survey.css'\nimport { useContext } from 'preact/hooks'\n\nexport function getFontFamily(fontFamily?: string): string {\n if (fontFamily === 'inherit') {\n return 'inherit'\n }\n\n const defaultFontStack =\n 'BlinkMacSystemFont, \"Inter\", \"Segoe UI\", \"Roboto\", Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"'\n return fontFamily ? `${fontFamily}, ${defaultFontStack}` : `-apple-system, ${defaultFontStack}`\n}\n\nexport function getSurveyResponseKey(questionId: string) {\n return `$survey_response_${questionId}`\n}\n\nconst BLACK_TEXT_COLOR = '#020617' // Maps out to text-slate-950 from tailwind colors. Intended for text use outside interactive elements like buttons\n\n// Keep in sync with defaultSurveyAppearance on the main app\nexport const defaultSurveyAppearance = {\n fontFamily: 'inherit',\n backgroundColor: '#eeeded',\n submitButtonColor: 'black',\n submitButtonTextColor: 'white',\n ratingButtonColor: 'white',\n ratingButtonActiveColor: 'black',\n borderColor: '#c9c6c6',\n placeholder: 'Start typing...',\n whiteLabel: false,\n displayThankYouMessage: true,\n thankYouMessageHeader: 'Thank you for your feedback!',\n position: SurveyPosition.Right,\n widgetType: SurveyWidgetType.Tab,\n widgetLabel: 'Feedback',\n widgetColor: 'black',\n zIndex: '2147483647',\n disabledButtonOpacity: '0.6',\n maxWidth: '300px',\n textSubtleColor: '#939393',\n boxPadding: '20px 24px',\n boxShadow: '0 4px 12px rgba(0, 0, 0, 0.15)',\n borderRadius: '10px',\n shuffleQuestions: false,\n surveyPopupDelaySeconds: undefined,\n // Not customizable atm\n outlineColor: 'rgba(59, 130, 246, 0.8)',\n inputBackground: 'white',\n inputTextColor: BLACK_TEXT_COLOR,\n scrollbarThumbColor: 'var(--ph-survey-border-color)',\n scrollbarTrackColor: 'var(--ph-survey-background-color)',\n} as const\n\nexport const addSurveyCSSVariablesToElement = (\n element: HTMLElement,\n type: SurveyType,\n appearance?: SurveyAppearance | null\n) => {\n const effectiveAppearance = { ...defaultSurveyAppearance, ...appearance }\n const hostStyle = element.style\n\n const surveyHasBottomBorder =\n ![SurveyPosition.Center, SurveyPosition.Left, SurveyPosition.Right].includes(effectiveAppearance.position) ||\n (type === SurveyType.Widget && appearance?.widgetType === SurveyWidgetType.Tab)\n\n hostStyle.setProperty('--ph-survey-font-family', getFontFamily(effectiveAppearance.fontFamily))\n hostStyle.setProperty('--ph-survey-box-padding', effectiveAppearance.boxPadding)\n hostStyle.setProperty('--ph-survey-max-width', effectiveAppearance.maxWidth)\n hostStyle.setProperty('--ph-survey-z-index', effectiveAppearance.zIndex)\n hostStyle.setProperty('--ph-survey-border-color', effectiveAppearance.borderColor)\n // Non-bottom surveys or tab surveys have the border bottom\n if (surveyHasBottomBorder) {\n hostStyle.setProperty('--ph-survey-border-radius', effectiveAppearance.borderRadius)\n hostStyle.setProperty('--ph-survey-border-bottom', '1.5px solid var(--ph-survey-border-color)')\n } else {\n hostStyle.setProperty('--ph-survey-border-bottom', 'none')\n hostStyle.setProperty(\n '--ph-survey-border-radius',\n `${effectiveAppearance.borderRadius} ${effectiveAppearance.borderRadius} 0 0`\n )\n }\n hostStyle.setProperty('--ph-survey-background-color', effectiveAppearance.backgroundColor)\n hostStyle.setProperty('--ph-survey-box-shadow', effectiveAppearance.boxShadow)\n hostStyle.setProperty('--ph-survey-disabled-button-opacity', effectiveAppearance.disabledButtonOpacity)\n hostStyle.setProperty('--ph-survey-submit-button-color', effectiveAppearance.submitButtonColor)\n hostStyle.setProperty(\n '--ph-survey-submit-button-text-color',\n appearance?.submitButtonTextColor || getContrastingTextColor(effectiveAppearance.submitButtonColor)\n )\n hostStyle.setProperty('--ph-survey-rating-bg-color', effectiveAppearance.ratingButtonColor)\n hostStyle.setProperty('--ph-survey-rating-active-bg-color', effectiveAppearance.ratingButtonActiveColor)\n // Active rating text is always auto-calculated for contrast with active background\n hostStyle.setProperty(\n '--ph-survey-rating-active-text-color',\n getContrastingTextColor(effectiveAppearance.ratingButtonActiveColor)\n )\n // Primary text color: use override if provided, otherwise auto-calculate from background\n hostStyle.setProperty(\n '--ph-survey-text-primary-color',\n appearance?.textColor || getContrastingTextColor(effectiveAppearance.backgroundColor)\n )\n hostStyle.setProperty('--ph-survey-text-subtle-color', effectiveAppearance.textSubtleColor)\n hostStyle.setProperty('--ph-widget-color', effectiveAppearance.widgetColor)\n hostStyle.setProperty('--ph-widget-text-color', getContrastingTextColor(effectiveAppearance.widgetColor))\n hostStyle.setProperty('--ph-widget-z-index', effectiveAppearance.zIndex)\n\n // Use user-provided inputBackground (or deprecated inputBackgroundColor for backwards compat)\n // Fallback to internal default, with slight adjustment for white backgrounds\n const userInputBg = appearance?.inputBackground || appearance?.inputBackgroundColor\n let inputBgColor = userInputBg || effectiveAppearance.inputBackground\n if (!userInputBg && effectiveAppearance.backgroundColor === 'white') {\n inputBgColor = '#f8f8f8'\n }\n hostStyle.setProperty('--ph-survey-input-background', inputBgColor)\n // Input text color applies to both text inputs and inactive rating buttons\n const inputTextColor = appearance?.inputTextColor || getContrastingTextColor(inputBgColor)\n hostStyle.setProperty('--ph-survey-input-text-color', inputTextColor)\n hostStyle.setProperty('--ph-survey-rating-text-color', inputTextColor)\n hostStyle.setProperty('--ph-survey-scrollbar-thumb-color', effectiveAppearance.scrollbarThumbColor)\n hostStyle.setProperty('--ph-survey-scrollbar-track-color', effectiveAppearance.scrollbarTrackColor)\n hostStyle.setProperty('--ph-survey-outline-color', effectiveAppearance.outlineColor)\n}\n\nfunction nameToHex(name: string) {\n return {\n aliceblue: '#f0f8ff',\n antiquewhite: '#faebd7',\n aqua: '#00ffff',\n aquamarine: '#7fffd4',\n azure: '#f0ffff',\n beige: '#f5f5dc',\n bisque: '#ffe4c4',\n black: '#000000',\n blanchedalmond: '#ffebcd',\n blue: '#0000ff',\n blueviolet: '#8a2be2',\n brown: '#a52a2a',\n burlywood: '#deb887',\n cadetblue: '#5f9ea0',\n chartreuse: '#7fff00',\n chocolate: '#d2691e',\n coral: '#ff7f50',\n cornflowerblue: '#6495ed',\n cornsilk: '#fff8dc',\n crimson: '#dc143c',\n cyan: '#00ffff',\n darkblue: '#00008b',\n darkcyan: '#008b8b',\n darkgoldenrod: '#b8860b',\n darkgray: '#a9a9a9',\n darkgreen: '#006400',\n darkkhaki: '#bdb76b',\n darkmagenta: '#8b008b',\n darkolivegreen: '#556b2f',\n darkorange: '#ff8c00',\n darkorchid: '#9932cc',\n darkred: '#8b0000',\n darksalmon: '#e9967a',\n darkseagreen: '#8fbc8f',\n darkslateblue: '#483d8b',\n darkslategray: '#2f4f4f',\n darkturquoise: '#00ced1',\n darkviolet: '#9400d3',\n deeppink: '#ff1493',\n deepskyblue: '#00bfff',\n dimgray: '#696969',\n dodgerblue: '#1e90ff',\n firebrick: '#b22222',\n floralwhite: '#fffaf0',\n forestgreen: '#228b22',\n fuchsia: '#ff00ff',\n gainsboro: '#dcdcdc',\n ghostwhite: '#f8f8ff',\n gold: '#ffd700',\n goldenrod: '#daa520',\n gray: '#808080',\n green: '#008000',\n greenyellow: '#adff2f',\n honeydew: '#f0fff0',\n hotpink: '#ff69b4',\n 'indianred ': '#cd5c5c',\n indigo: '#4b0082',\n ivory: '#fffff0',\n khaki: '#f0e68c',\n lavender: '#e6e6fa',\n lavenderblush: '#fff0f5',\n lawngreen: '#7cfc00',\n lemonchiffon: '#fffacd',\n lightblue: '#add8e6',\n lightcoral: '#f08080',\n lightcyan: '#e0ffff',\n lightgoldenrodyellow: '#fafad2',\n lightgrey: '#d3d3d3',\n lightgreen: '#90ee90',\n lightpink: '#ffb6c1',\n lightsalmon: '#ffa07a',\n lightseagreen: '#20b2aa',\n lightskyblue: '#87cefa',\n lightslategray: '#778899',\n lightsteelblue: '#b0c4de',\n lightyellow: '#ffffe0',\n lime: '#00ff00',\n limegreen: '#32cd32',\n linen: '#faf0e6',\n magenta: '#ff00ff',\n maroon: '#800000',\n mediumaquamarine: '#66cdaa',\n mediumblue: '#0000cd',\n mediumorchid: '#ba55d3',\n mediumpurple: '#9370d8',\n mediumseagreen: '#3cb371',\n mediumslateblue: '#7b68ee',\n mediumspringgreen: '#00fa9a',\n mediumturquoise: '#48d1cc',\n mediumvioletred: '#c71585',\n midnightblue: '#191970',\n mintcream: '#f5fffa',\n mistyrose: '#ffe4e1',\n moccasin: '#ffe4b5',\n navajowhite: '#ffdead',\n navy: '#000080',\n oldlace: '#fdf5e6',\n olive: '#808000',\n olivedrab: '#6b8e23',\n orange: '#ffa500',\n orangered: '#ff4500',\n orchid: '#da70d6',\n palegoldenrod: '#eee8aa',\n palegreen: '#98fb98',\n paleturquoise: '#afeeee',\n palevioletred: '#d87093',\n papayawhip: '#ffefd5',\n peachpuff: '#ffdab9',\n peru: '#cd853f',\n pink: '#ffc0cb',\n plum: '#dda0dd',\n powderblue: '#b0e0e6',\n purple: '#800080',\n red: '#ff0000',\n rosybrown: '#bc8f8f',\n royalblue: '#4169e1',\n saddlebrown: '#8b4513',\n salmon: '#fa8072',\n sandybrown: '#f4a460',\n seagreen: '#2e8b57',\n seashell: '#fff5ee',\n sienna: '#a0522d',\n silver: '#c0c0c0',\n skyblue: '#87ceeb',\n slateblue: '#6a5acd',\n slategray: '#708090',\n snow: '#fffafa',\n springgreen: '#00ff7f',\n steelblue: '#4682b4',\n tan: '#d2b48c',\n teal: '#008080',\n thistle: '#d8bfd8',\n tomato: '#ff6347',\n turquoise: '#40e0d0',\n violet: '#ee82ee',\n wheat: '#f5deb3',\n white: '#ffffff',\n whitesmoke: '#f5f5f5',\n yellow: '#ffff00',\n yellowgreen: '#9acd32',\n }[name.toLowerCase()]\n}\n\nexport function hex2rgb(c: string): string {\n if (c.startsWith('#')) {\n let hexColor = c.replace(/^#/, '')\n // Handle 3-character shorthand (e.g., #111 -> #111111, #abc -> #aabbcc)\n if (/^[0-9A-Fa-f]{3}$/.test(hexColor)) {\n hexColor = hexColor[0] + hexColor[0] + hexColor[1] + hexColor[1] + hexColor[2] + hexColor[2]\n }\n if (!/^[0-9A-Fa-f]{6}$/.test(hexColor)) {\n return 'rgb(255, 255, 255)'\n }\n const r = parseInt(hexColor.slice(0, 2), 16)\n const g = parseInt(hexColor.slice(2, 4), 16)\n const b = parseInt(hexColor.slice(4, 6), 16)\n return `rgb(${r},${g},${b})`\n }\n return 'rgb(255, 255, 255)'\n}\n\nexport function hexToRgba(hex: string, opacity: number): string {\n const rgb = hex2rgb(hex)\n const match = rgb.match(/^rgb\\((\\d+),(\\d+),(\\d+)\\)$/)\n if (!match) {\n return hex\n }\n return `rgba(${match[1]}, ${match[2]}, ${match[3]}, ${opacity})`\n}\n\nexport function getContrastingTextColor(color: string = defaultSurveyAppearance.backgroundColor) {\n let rgb\n if (color[0] === '#') {\n rgb = hex2rgb(color)\n }\n if (color.startsWith('rgb')) {\n rgb = color\n }\n // otherwise it's a color name\n const nameColorToHex = nameToHex(color)\n if (nameColorToHex) {\n rgb = hex2rgb(nameColorToHex)\n }\n if (!rgb) {\n return BLACK_TEXT_COLOR\n }\n const colorMatch = rgb.match(/^rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)(?:,\\s*(\\d+(?:\\.\\d+)?))?\\)$/)\n if (colorMatch) {\n const r = parseInt(colorMatch[1])\n const g = parseInt(colorMatch[2])\n const b = parseInt(colorMatch[3])\n const hsp = Math.sqrt(0.299 * (r * r) + 0.587 * (g * g) + 0.114 * (b * b))\n return hsp > 127.5 ? BLACK_TEXT_COLOR : 'white'\n }\n return BLACK_TEXT_COLOR\n}\n\nexport function getSurveyStylesheet(posthog?: PostHog) {\n const stylesheet = prepareStylesheet(document, typeof surveyStyles === 'string' ? surveyStyles : '', posthog)\n stylesheet?.setAttribute('data-ph-survey-style', 'true')\n return stylesheet\n}\n\nexport const retrieveSurveyShadow = (\n survey: Pick<Survey, 'id' | 'appearance' | 'type'>,\n posthog?: PostHog,\n element?: Element\n) => {\n const widgetClassName = getSurveyContainerClass(survey)\n const existingDiv = document.querySelector(`.${widgetClassName}`)\n\n if (existingDiv && existingDiv.shadowRoot) {\n return {\n shadow: existingDiv.shadowRoot,\n isNewlyCreated: false,\n }\n }\n\n // If it doesn't exist, create it\n const div = document.createElement('div')\n addSurveyCSSVariablesToElement(div, survey.type, survey.appearance)\n div.className = widgetClassName\n const shadow = div.attachShadow({ mode: 'open' })\n const stylesheet = getSurveyStylesheet(posthog)\n if (stylesheet) {\n const existingStylesheet = shadow.querySelector('style')\n if (existingStylesheet) {\n shadow.removeChild(existingStylesheet)\n }\n shadow.appendChild(stylesheet)\n }\n ;(element ? element : document.body).appendChild(div)\n return {\n shadow,\n isNewlyCreated: true,\n }\n}\n\ninterface SendSurveyEventArgs {\n responses: Record<string, string | number | string[] | null>\n survey: Survey\n surveySubmissionId: string\n isSurveyCompleted: boolean\n posthog?: PostHog\n}\n\nconst getSurveyResponseValue = (responses: Record<string, string | number | string[] | null>, questionId?: string) => {\n if (!questionId) {\n return null\n }\n const response = responses[getSurveyResponseKey(questionId)]\n if (isArray(response)) {\n return [...response]\n }\n return response\n}\n\nexport const sendSurveyEvent = ({\n responses,\n survey,\n surveySubmissionId,\n posthog,\n isSurveyCompleted,\n}: SendSurveyEventArgs) => {\n if (!posthog) {\n logger.error('[survey sent] event not captured, PostHog instance not found.')\n return\n }\n setSurveySeenOnLocalStorage(survey)\n posthog.capture(SurveyEventName.SENT, {\n [SurveyEventProperties.SURVEY_NAME]: survey.name,\n [SurveyEventProperties.SURVEY_ID]: survey.id,\n [SurveyEventProperties.SURVEY_ITERATION]: survey.current_iteration,\n [SurveyEventProperties.SURVEY_ITERATION_START_DATE]: survey.current_iteration_start_date,\n [SurveyEventProperties.SURVEY_QUESTIONS]: survey.questions.map((question) => ({\n id: question.id,\n question: question.question,\n response: getSurveyResponseValue(responses, question.id),\n })),\n [SurveyEventProperties.SURVEY_SUBMISSION_ID]: surveySubmissionId,\n [SurveyEventProperties.SURVEY_COMPLETED]: isSurveyCompleted,\n sessionRecordingUrl: posthog.get_session_replay_url?.(),\n ...responses,\n $set: {\n [getSurveyInteractionProperty(survey, 'responded')]: true,\n },\n })\n if (isSurveyCompleted) {\n // Only dispatch PHSurveySent if the survey is completed, as that removes the survey from focus\n window.dispatchEvent(new CustomEvent('PHSurveySent', { detail: { surveyId: survey.id } }))\n clearInProgressSurveyState(survey)\n }\n}\n\nconst _surveyHasResponses = (inProgressSurvey: InProgressSurveyState | null) => {\n return Object.values(inProgressSurvey?.responses || {}).filter((resp) => !isNullish(resp)).length > 0\n}\n\nconst _buildSurveyEventProperties = (\n survey: Survey,\n inProgressSurvey: InProgressSurveyState | null,\n posthog: PostHog\n) => ({\n [SurveyEventProperties.SURVEY_NAME]: survey.name,\n [SurveyEventProperties.SURVEY_ID]: survey.id,\n [SurveyEventProperties.SURVEY_ITERATION]: survey.current_iteration,\n [SurveyEventProperties.SURVEY_ITERATION_START_DATE]: survey.current_iteration_start_date,\n [SurveyEventProperties.SURVEY_PARTIALLY_COMPLETED]: _surveyHasResponses(inProgressSurvey),\n sessionRecordingUrl: posthog.get_session_replay_url?.(),\n ...inProgressSurvey?.responses,\n [SurveyEventProperties.SURVEY_SUBMISSION_ID]: inProgressSurvey?.surveySubmissionId,\n [SurveyEventProperties.SURVEY_QUESTIONS]: survey.questions.map((question) => ({\n id: question.id,\n question: question.question,\n response: getSurveyResponseValue(inProgressSurvey?.responses || {}, question.id),\n })),\n})\n\nexport const dismissedSurveyEvent = (survey: Survey, posthog?: PostHog, readOnly?: boolean) => {\n if (!posthog) {\n logger.error('[survey dismissed] event not captured, PostHog instance not found.')\n return\n }\n if (readOnly) {\n return\n }\n\n const inProgressSurvey = getInProgressSurveyState(survey)\n posthog.capture(SurveyEventName.DISMISSED, {\n ..._buildSurveyEventProperties(survey, inProgressSurvey, posthog),\n $set: {\n [getSurveyInteractionProperty(survey, 'dismissed')]: true,\n },\n })\n clearInProgressSurveyState(survey)\n setSurveySeenOnLocalStorage(survey)\n window.dispatchEvent(new CustomEvent('PHSurveyClosed', { detail: { surveyId: survey.id } }))\n}\n\nexport const sendSurveyAbandonedEvent = (survey: Survey, posthog?: PostHog) => {\n if (!posthog) {\n logger.error('[survey abandoned] event not captured, PostHog instance not found.')\n return\n }\n\n const abandonedKey = getSurveyAbandonedKey(survey)\n try {\n if (localStorage.getItem(abandonedKey) === 'true') {\n return\n }\n } catch {\n // localStorage not available\n return\n }\n\n const inProgressSurvey = getInProgressSurveyState(survey)\n if (!inProgressSurvey) {\n return\n }\n\n try {\n localStorage.setItem(abandonedKey, 'true')\n } catch {\n // localStorage not available\n }\n\n posthog.capture(SurveyEventName.ABANDONED, _buildSurveyEventProperties(survey, inProgressSurvey, posthog), {\n transport: 'sendBeacon',\n })\n}\n\n// Use the Fisher-yates algorithm to shuffle this array\n// https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle\nexport const shuffle = (array: any[]) => {\n return array\n .map((a) => ({ sort: Math.floor(Math.random() * 10), value: a }))\n .sort((a, b) => a.sort - b.sort)\n .map((a) => a.value)\n}\n\nconst reverseIfUnshuffled = (unshuffled: any[], shuffled: any[]): any[] => {\n if (unshuffled.length === shuffled.length && unshuffled.every((val, index) => val === shuffled[index])) {\n return shuffled.reverse()\n }\n\n return shuffled\n}\n\nexport const getDisplayOrderChoices = (question: MultipleSurveyQuestion): string[] => {\n if (!question.shuffleOptions) {\n return question.choices\n }\n\n const displayOrderChoices = question.choices\n let openEndedChoice = ''\n if (question.hasOpenChoice) {\n // if the question has an open-ended choice, its always the last element in the choices array.\n openEndedChoice = displayOrderChoices.pop()!\n }\n\n const shuffledOptions = reverseIfUnshuffled(displayOrderChoices, shuffle(displayOrderChoices))\n\n if (question.hasOpenChoice) {\n question.choices.push(openEndedChoice)\n shuffledOptions.push(openEndedChoice)\n }\n\n return shuffledOptions\n}\n\nexport const getDisplayOrderQuestions = (survey: Survey): SurveyQuestion[] => {\n if (!survey.appearance || !survey.appearance.shuffleQuestions || survey.enable_partial_responses) {\n return survey.questions\n }\n\n return reverseIfUnshuffled(survey.questions, shuffle(survey.questions))\n}\n\nexport const hasEvents = (survey: Pick<Survey, 'conditions'>): boolean => {\n return survey.conditions?.events?.values?.length != undefined && survey.conditions?.events?.values?.length > 0\n}\n\nexport const canActivateRepeatedly = (\n survey: Pick<Survey, 'schedule' | 'conditions' | 'id' | 'current_iteration'>\n): boolean => {\n return (\n !!(survey.conditions?.events?.repeatedActivation && hasEvents(survey)) ||\n survey.schedule === SurveySchedule.Always ||\n isSurveyInProgress(survey)\n )\n}\n\n/**\n * getSurveySeen checks local storage for the surveySeen Key a\n * and overrides this value if the survey can be repeatedly activated by its events.\n * @param survey\n */\nexport const getSurveySeen = (survey: Survey): boolean => {\n const surveySeen = localStorage.getItem(getSurveySeenKey(survey))\n if (surveySeen) {\n // if a survey has already been seen,\n // we will override it with the event repeated activation value.\n return !canActivateRepeatedly(survey)\n }\n\n return false\n}\n\nconst LAST_SEEN_SURVEY_DATE_KEY = 'lastSeenSurveyDate'\n\nexport const hasWaitPeriodPassed = (waitPeriodInDays: number | undefined): boolean => {\n const lastSeenSurveyDate = localStorage.getItem(LAST_SEEN_SURVEY_DATE_KEY)\n if (!waitPeriodInDays || !lastSeenSurveyDate) {\n return true\n }\n\n const today = new Date()\n const diff = Math.abs(today.getTime() - new Date(lastSeenSurveyDate).getTime())\n const diffDaysFromToday = Math.ceil(diff / (1000 * 3600 * 24))\n return diffDaysFromToday > waitPeriodInDays\n}\n\ninterface SurveyContextProps {\n isPreviewMode: boolean\n previewPageIndex: number | undefined\n onPopupSurveyDismissed: () => void\n isPopup: boolean\n onPreviewSubmit: (res: string | string[] | number | null) => void\n surveySubmissionId: string\n}\n\nexport const SurveyContext = createContext<SurveyContextProps>({\n isPreviewMode: false,\n previewPageIndex: 0,\n onPopupSurveyDismissed: () => {},\n isPopup: true,\n onPreviewSubmit: () => {},\n surveySubmissionId: '',\n})\n\nexport const useSurveyContext = () => {\n return useContext(SurveyContext)\n}\n\ninterface RenderProps {\n component: VNode<{ className: string }>\n children: string\n renderAsHtml?: boolean\n style?: JSX.CSSProperties\n}\n\nexport const renderChildrenAsTextOrHtml = ({ component, children, renderAsHtml, style }: RenderProps) => {\n return renderAsHtml\n ? cloneElement(component, {\n dangerouslySetInnerHTML: { __html: children },\n style,\n })\n : cloneElement(component, {\n children,\n style,\n })\n}\n\nfunction defaultMatchType(matchType?: PropertyMatchType): PropertyMatchType {\n return matchType ?? 'icontains'\n}\n\n// use urlMatchType to validate url condition, fallback to contains for backwards compatibility\nexport function doesSurveyUrlMatch(survey: Pick<Survey, 'conditions'>): boolean {\n if (!survey.conditions?.url) {\n return true\n }\n // if we dont know the url, assume it is not a match\n const href = window?.location?.href\n if (!href) {\n return false\n }\n const targets = [survey.conditions.url]\n const matchType = defaultMatchType(survey.conditions?.urlMatchType)\n return propertyComparisons[matchType](targets, [href])\n}\n\nexport function doesSurveyDeviceTypesMatch(survey: Survey): boolean {\n if (!survey.conditions?.deviceTypes || survey.conditions?.deviceTypes.length === 0) {\n return true\n }\n // if we dont know the device type, assume it is not a match\n if (!userAgent) {\n return false\n }\n\n const deviceType = detectDeviceType(userAgent)\n return propertyComparisons[defaultMatchType(survey.conditions?.deviceTypesMatchType)](\n survey.conditions.deviceTypes,\n [deviceType]\n )\n}\n\nexport function doesSurveyMatchSelector(survey: Survey): boolean {\n if (!survey.conditions?.selector) {\n return true\n }\n return !!document?.querySelector(survey.conditions.selector)\n}\n\ninterface InProgressSurveyState {\n surveySubmissionId: string\n lastQuestionIndex: number\n responses: Record<string, string | number | string[] | null>\n}\n\nconst getInProgressSurveyStateKey = (survey: Pick<Survey, 'id' | 'current_iteration'>): string => {\n let key = `${SURVEY_IN_PROGRESS_PREFIX}${survey.id}`\n if (survey.current_iteration && survey.current_iteration > 0) {\n key = `${SURVEY_IN_PROGRESS_PREFIX}${survey.id}_${survey.current_iteration}`\n }\n return key\n}\n\nexport const setInProgressSurveyState = (\n survey: Pick<Survey, 'id' | 'current_iteration'>,\n state: InProgressSurveyState\n): void => {\n try {\n localStorage.setItem(getInProgressSurveyStateKey(survey), JSON.stringify(state))\n } catch (e) {\n logger.error('Error setting in-progress survey state in localStorage', e)\n }\n}\n\nexport const getInProgressSurveyState = (\n survey: Pick<Survey, 'id' | 'current_iteration'>\n): InProgressSurveyState | null => {\n try {\n const stateString = localStorage.getItem(getInProgressSurveyStateKey(survey))\n if (stateString) {\n return JSON.parse(stateString) as InProgressSurveyState\n }\n } catch (e) {\n logger.error('Error getting in-progress survey state from localStorage', e)\n }\n return null\n}\n\nexport const isSurveyInProgress = (survey: Pick<Survey, 'id' | 'current_iteration'>): boolean => {\n const state = getInProgressSurveyState(survey)\n return !isNullish(state?.surveySubmissionId)\n}\n\nexport const clearInProgressSurveyState = (survey: Pick<Survey, 'id' | 'current_iteration'>): void => {\n try {\n localStorage.removeItem(getInProgressSurveyStateKey(survey))\n } catch (e) {\n logger.error('Error clearing in-progress survey state from localStorage', e)\n }\n}\n\nexport function getSurveyContainerClass(survey: Pick<Survey, 'id'>, asSelector = false): string {\n const className = `PostHogSurvey-${survey.id}`\n return asSelector ? `.${className}` : className\n}\n","import DOMPurify from 'dompurify'\n\nimport {\n ProductTourAppearance,\n ProductTourSelectorError,\n ProductTourStep,\n DEFAULT_PRODUCT_TOUR_APPEARANCE,\n} from '../../posthog-product-tours-types'\nimport { prepareStylesheet } from '../utils/stylesheet-loader'\nimport { document as _document, window as _window } from '../../utils/globals'\nimport { getFontFamily, getContrastingTextColor, hexToRgba } from '../surveys/surveys-extension-utils'\n\nimport productTourStyles from './product-tour.css'\n\nconst document = _document as Document\nconst window = _window as Window & typeof globalThis\n\nexport function getProductTourStylesheet(): HTMLStyleElement | null {\n const stylesheet = prepareStylesheet(document, typeof productTourStyles === 'string' ? productTourStyles : '')\n stylesheet?.setAttribute('data-ph-product-tour-style', 'true')\n return stylesheet\n}\n\nexport interface ElementFindResult {\n element: HTMLElement | null\n error: ProductTourSelectorError | null\n matchCount: number\n}\n\nexport function findElementBySelector(selector: string): ElementFindResult {\n try {\n const elements = document.querySelectorAll(selector)\n\n if (elements.length === 0) {\n return { element: null, error: 'not_found', matchCount: 0 }\n }\n\n const element = elements[0] as HTMLElement\n\n if (!isElementVisible(element)) {\n return { element: null, error: 'not_visible', matchCount: elements.length }\n }\n\n if (elements.length > 1) {\n return { element, error: 'multiple_matches', matchCount: elements.length }\n }\n\n return { element, error: null, matchCount: 1 }\n } catch {\n return { element: null, error: 'not_found', matchCount: 0 }\n }\n}\n\nexport function isElementVisible(element: HTMLElement): boolean {\n const style = window.getComputedStyle(element)\n\n if (style.display === 'none' || style.visibility === 'hidden' || style.opacity === '0') {\n return false\n }\n\n const rect = element.getBoundingClientRect()\n if (rect.width === 0 || rect.height === 0) {\n return false\n }\n\n return true\n}\n\nexport function getElementMetadata(element: HTMLElement): {\n tag: string\n id: string | undefined\n classes: string | undefined\n text: string | undefined\n} {\n return {\n tag: element.tagName,\n id: element.id || undefined,\n classes: element.className || undefined,\n text: element.innerText?.slice(0, 100) || undefined,\n }\n}\n\nexport type TooltipPosition = 'top' | 'bottom' | 'left' | 'right'\n\nexport interface PositionResult {\n top: number\n left: number\n position: TooltipPosition\n}\n\nconst TOOLTIP_MARGIN = 12\nconst TOOLTIP_WIDTH = 320\nconst TOOLTIP_HEIGHT_ESTIMATE = 180\n\nexport function calculateTooltipPosition(targetRect: DOMRect): PositionResult {\n const viewportWidth = window.innerWidth\n const viewportHeight = window.innerHeight\n\n const spaceBelow = viewportHeight - targetRect.bottom\n const spaceLeft = targetRect.left\n const spaceRight = viewportWidth - targetRect.right\n\n let position: TooltipPosition\n let top: number\n let left: number\n\n if (spaceRight >= TOOLTIP_WIDTH + TOOLTIP_MARGIN) {\n position = 'right'\n top = targetRect.top + targetRect.height / 2 - TOOLTIP_HEIGHT_ESTIMATE / 2\n left = targetRect.right + TOOLTIP_MARGIN\n } else if (spaceLeft >= TOOLTIP_WIDTH + TOOLTIP_MARGIN) {\n position = 'left'\n top = targetRect.top + targetRect.height / 2 - TOOLTIP_HEIGHT_ESTIMATE / 2\n left = targetRect.left - TOOLTIP_WIDTH - TOOLTIP_MARGIN\n } else if (spaceBelow >= TOOLTIP_HEIGHT_ESTIMATE + TOOLTIP_MARGIN) {\n position = 'bottom'\n top = targetRect.bottom + TOOLTIP_MARGIN\n left = targetRect.left + targetRect.width / 2 - TOOLTIP_WIDTH / 2\n } else {\n position = 'top'\n top = targetRect.top - TOOLTIP_HEIGHT_ESTIMATE - TOOLTIP_MARGIN\n left = targetRect.left + targetRect.width / 2 - TOOLTIP_WIDTH / 2\n }\n\n return { top, left, position }\n}\n\nexport function getSpotlightStyle(targetRect: DOMRect, padding: number = 8): Record<string, string> {\n return {\n top: `${targetRect.top - padding}px`,\n left: `${targetRect.left - padding}px`,\n width: `${targetRect.width + padding * 2}px`,\n height: `${targetRect.height + padding * 2}px`,\n }\n}\n\nexport function addProductTourCSSVariablesToElement(element: HTMLElement, appearance?: ProductTourAppearance): void {\n const merged = { ...DEFAULT_PRODUCT_TOUR_APPEARANCE, ...appearance }\n const style = element.style\n\n // User-customizable variables\n style.setProperty('--ph-tour-background-color', merged.backgroundColor)\n style.setProperty('--ph-tour-text-color', merged.textColor)\n style.setProperty('--ph-tour-button-color', merged.buttonColor)\n style.setProperty('--ph-tour-border-radius', `${merged.borderRadius}px`)\n style.setProperty('--ph-tour-button-border-radius', `${merged.buttonBorderRadius}px`)\n style.setProperty('--ph-tour-border-color', merged.borderColor)\n style.setProperty('--ph-tour-font-family', getFontFamily(merged.fontFamily))\n\n // Derived colors\n style.setProperty('--ph-tour-text-secondary-color', hexToRgba(merged.textColor, 0.6))\n style.setProperty('--ph-tour-branding-text-color', getContrastingTextColor(merged.backgroundColor))\n style.setProperty('--ph-tour-button-text-color', getContrastingTextColor(merged.buttonColor))\n style.setProperty('--ph-tour-box-shadow', merged.boxShadow)\n style.setProperty('--ph-tour-overlay-color', merged.showOverlay ? 'rgba(0, 0, 0, 0.5)' : 'transparent')\n\n // Internal styling variables (not customizable)\n style.setProperty('--ph-tour-button-secondary-color', 'transparent')\n style.setProperty('--ph-tour-button-secondary-text-color', merged.textColor)\n style.setProperty('--ph-tour-max-width', '320px')\n style.setProperty('--ph-tour-padding', '16px')\n}\n\nexport function renderTipTapContent(content: any): string {\n if (!content) {\n return ''\n }\n\n if (typeof content === 'string') {\n return escapeHtml(content)\n }\n\n if (content.type === 'text') {\n let text = escapeHtml(content.text || '')\n\n if (content.marks) {\n for (const mark of content.marks) {\n switch (mark.type) {\n case 'bold':\n text = `<strong>${text}</strong>`\n break\n case 'italic':\n text = `<em>${text}</em>`\n break\n case 'underline':\n text = `<u>${text}</u>`\n break\n case 'strike':\n text = `<s>${text}</s>`\n break\n }\n }\n }\n\n return text\n }\n\n const children = content.content?.map(renderTipTapContent).join('') || ''\n\n switch (content.type) {\n case 'doc':\n return children\n case 'paragraph':\n return `<p>${children}</p>`\n case 'heading': {\n const level = content.attrs?.level || 1\n return `<h${level}>${children}</h${level}>`\n }\n case 'bulletList':\n return `<ul>${children}</ul>`\n case 'orderedList':\n return `<ol>${children}</ol>`\n case 'listItem':\n return `<li>${children}</li>`\n case 'hardBreak':\n return '<br>'\n default:\n return children\n }\n}\n\nexport function normalizeUrl(url: string): string {\n return url.endsWith('/') ? url.slice(0, -1) : url\n}\n\nfunction escapeHtml(text: string): string {\n const div = document.createElement('div')\n div.textContent = text\n return div.innerHTML\n}\n\nexport function getStepHtml(step: ProductTourStep): string {\n if (step.contentHtml) {\n return DOMPurify.sanitize(step.contentHtml, {\n ADD_TAGS: ['iframe'],\n ADD_ATTR: ['allowfullscreen', 'frameborder', 'referrerpolicy'],\n })\n }\n\n // backwards compat, will be deprecated\n return renderTipTapContent(step.content)\n}\n","import { h } from 'preact'\nimport { ProductTourStep, ProductTourAppearance } from '../../../posthog-product-tours-types'\nimport { getStepHtml } from '../product-tours-utils'\nimport { IconPosthogLogo, cancelSVG } from '../../surveys/icons'\n\nexport interface ProductTourTooltipInnerProps {\n step: ProductTourStep\n appearance?: ProductTourAppearance\n stepIndex: number\n totalSteps: number\n onNext?: () => void\n onPrevious?: () => void\n onDismiss?: () => void\n}\n\nexport function ProductTourTooltipInner({\n step,\n appearance,\n stepIndex,\n totalSteps,\n onNext,\n onPrevious,\n onDismiss,\n}: ProductTourTooltipInnerProps): h.JSX.Element {\n const whiteLabel = appearance?.whiteLabel ?? false\n const isLastStep = stepIndex >= totalSteps - 1\n const isFirstStep = stepIndex === 0\n const showNextButton = step.progressionTrigger === 'button' || step.type === 'modal'\n\n const isInteractive = !!(onNext || onPrevious || onDismiss)\n const cursorStyle = isInteractive ? undefined : { cursor: 'default' }\n\n return (\n <>\n <button class=\"ph-tour-dismiss\" onClick={onDismiss} aria-label=\"Close tour\" style={cursorStyle}>\n {cancelSVG}\n </button>\n\n <div class=\"ph-tour-content\" dangerouslySetInnerHTML={{ __html: getStepHtml(step) }} />\n\n <div class=\"ph-tour-footer\">\n <span class=\"ph-tour-progress\">\n {stepIndex + 1} of {totalSteps}\n </span>\n\n <div class=\"ph-tour-buttons\">\n {!isFirstStep && (\n <button\n class=\"ph-tour-button ph-tour-button--secondary\"\n onClick={onPrevious}\n style={cursorStyle}\n >\n Back\n </button>\n )}\n {showNextButton && (\n <button class=\"ph-tour-button ph-tour-button--primary\" onClick={onNext} style={cursorStyle}>\n {isLastStep ? 'Done' : 'Next'}\n </button>\n )}\n </div>\n </div>\n\n {!whiteLabel && (\n <a\n href={isInteractive ? 'https://posthog.com/product-tours' : undefined}\n target={isInteractive ? '_blank' : undefined}\n rel={isInteractive ? 'noopener noreferrer' : undefined}\n class=\"ph-tour-branding\"\n style={isInteractive ? undefined : { cursor: 'default', pointerEvents: 'none' }}\n >\n Tour by {IconPosthogLogo}\n </a>\n )}\n </>\n )\n}\n","import { render, JSX } from 'preact'\n\nimport { ProductTourStep, ProductTourAppearance } from '../../posthog-product-tours-types'\nimport { document as _document } from '../../utils/globals'\nimport { ProductTourSurveyStepInner } from './components/ProductTourSurveyStepInner'\nimport { ProductTourTooltipInner } from './components/ProductTourTooltipInner'\nimport { getProductTourStylesheet, addProductTourCSSVariablesToElement } from './product-tours-utils'\n\nconst document = _document as Document\n\nexport interface RenderProductTourPreviewOptions {\n step: ProductTourStep\n appearance?: ProductTourAppearance\n parentElement: HTMLElement\n stepIndex?: number\n totalSteps?: number\n style?: JSX.CSSProperties\n}\n\nexport function renderProductTourPreview({\n step,\n appearance,\n parentElement,\n stepIndex = 0,\n totalSteps = 1,\n style,\n}: RenderProductTourPreviewOptions): void {\n parentElement.innerHTML = ''\n\n const shadowHost = document.createElement('div')\n addProductTourCSSVariablesToElement(shadowHost, appearance)\n parentElement.appendChild(shadowHost)\n const shadow = shadowHost.attachShadow({ mode: 'open' })\n\n const stylesheet = getProductTourStylesheet()\n if (stylesheet) {\n shadow.appendChild(stylesheet)\n }\n\n const renderTarget = document.createElement('div')\n shadow.appendChild(renderTarget)\n\n const isSurveyStep = step.type === 'survey'\n const tooltipClass = isSurveyStep ? 'ph-tour-tooltip ph-tour-survey-step' : 'ph-tour-tooltip'\n\n render(\n <div class=\"ph-tour-container\">\n <div\n class={tooltipClass}\n style={{\n position: 'relative',\n animation: 'none',\n ...(step.maxWidth && { width: `${step.maxWidth}px`, maxWidth: `${step.maxWidth}px` }),\n ...style,\n }}\n >\n {isSurveyStep ? (\n <ProductTourSurveyStepInner\n step={step}\n appearance={appearance}\n stepIndex={stepIndex}\n totalSteps={totalSteps}\n />\n ) : (\n <ProductTourTooltipInner\n step={step}\n appearance={appearance}\n stepIndex={stepIndex}\n totalSteps={totalSteps}\n />\n )}\n </div>\n </div>,\n renderTarget\n )\n}\n"],"names":["c","s","a","win","window","undefined","global","globalThis","self","File","navigator","document","location","fetch","XMLHttpRequest","AbortController","userAgent","t","r","u","i","assignableWindow","o","f","e","n","__b","__r","v","diffed","l","__c","m","unmount","d","__h","__H","__","length","push","__V","h","B","__N","setState","filter","every","call","this","forEach","props","shouldComponentUpdate","componentWillUpdate","__e","_","z","F","current","b","shift","__P","k","w","__v","requestAnimationFrame","j","some","g","clearTimeout","cancelAnimationFrame","setTimeout","satisfiedEmoji","_jsx","className","xmlns","height","viewBox","width","children","neutralEmoji","dissatisfiedEmoji","veryDissatisfiedEmoji","verySatisfiedEmoji","cancelSVG","_jsxs","fill","id","IconPosthogLogo","style","maskType","maskUnits","x","y","mask","transform","threeScaleEmojis","fiveScaleEmojis","OpenTextInput","_ref","value","onChange","onSubmit","isInteractive","inputRef","useRef","__s","useEffect","_inputRef$current","focus","ref","class","rows","placeholder","onInput","target","onKeyDown","key","metaKey","preventDefault","disabled","cursor","RatingInput","_ref2","survey","selectedRating","setSelectedRating","useState","display","scale","handleSelect","rating","map","emoji","idx","type","onClick","lowerBoundLabel","upperBoundLabel","numbers","getScaleNumbers","gridTemplateColumns","num","ProductTourSurveyStepInner","_ref3","_appearance$whiteLabe","step","appearance","stepIndex","totalSteps","onPrevious","onDismiss","textValue","setTextValue","whiteLabel","isFirstStep","isOpenText","cursorStyle","handleTextSubmit","trim","_Fragment","questionText","href","rel","pointerEvents","entries","setPrototypeOf","isFrozen","getPrototypeOf","getOwnPropertyDescriptor","Object","freeze","seal","create","apply","construct","Reflect","func","thisArg","_len","arguments","args","Array","_key","Func","_len2","_key2","arrayForEach","unapply","prototype","arrayLastIndexOf","lastIndexOf","arrayPop","pop","arrayPush","arraySplice","splice","stringToLowerCase","String","toLowerCase","stringToString","toString","stringMatch","match","stringReplace","replace","stringIndexOf","indexOf","stringTrim","objectHasOwnProperty","hasOwnProperty","regExpTest","RegExp","test","typeErrorCreate","TypeError","_len4","_key4","lastIndex","_len3","_key3","addToSet","set","array","transformCaseFunc","element","lcElement","cleanArray","index","clone","object","newObject","property","isArray","constructor","lookupGetter","prop","desc","get","DEFAULT_PRODUCT_TOUR_APPEARANCE","backgroundColor","textColor","buttonColor","borderRadius","buttonBorderRadius","borderColor","fontFamily","boxShadow","showOverlay","_createLogger","prefix","_temp","debugEnabled","logger","_log","level","POSTHOG_DEBUG","isUndefined","console","consoleLog","info","warn","error","critical","_len5","_key5","uninitializedWarning","methodName","createLogger","additionalPrefix","options","prepareStylesheet","innerText","posthog","stylesheet","createElement","sendBeacon","BLACK_TEXT_COLOR","defaultSurveyAppearance","hex2rgb","startsWith","hexColor","parseInt","slice","getContrastingTextColor","color","rgb","nameColorToHex","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","honeydew","hotpink","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgrey","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen","colorMatch","Math","sqrt","createContext","isPreviewMode","previewPageIndex","onPopupSurveyDismissed","isPopup","onPreviewSubmit","surveySubmissionId","_document","addProductTourCSSVariablesToElement","hex","opacity","merged","_extends","setProperty","defaultFontStack","getFontFamily","renderTipTapContent","content","_content$content","escapeHtml","text","marks","mark","join","_content$attrs","attrs","div","textContent","innerHTML","getStepHtml","contentHtml","DOMPurify","sanitize","ADD_TAGS","ADD_ATTR","ProductTourTooltipInner","onNext","isLastStep","showNextButton","progressionTrigger","dangerouslySetInnerHTML","__html","renderProductTourPreview","parentElement","shadowHost","appendChild","shadow","attachShadow","mode","productTourStyles","setAttribute","getProductTourStylesheet","renderTarget","isSurveyStep","render","position","animation","maxWidth"],"mappings":"wNACa,oBAWAA,EAAgC,CAAA,EAChCC,EAAY,GACZC,EACZ,qoCAd2B,sCAAA,uoBAML,8EAFK,sFAAA,qIAEL,gTAFK,oeAEL,qEAAA,iFAAA,mxCAJO,iBAFF,kyDASF,sGATE,gzGCmC5B,IAAMC,EAAkE,oBAAXC,OAAyBA,YAASC,EAyNzFC,EAA8D,oBAAfC,WAA6BA,WAAaJ,EAG3E,oBAATK,OACLF,EAAeE,KAAOF,GAER,oBAATG,OACLH,EAAeG,KAAO,WAAa,GAOlC,IAAMC,EAAkB,MAANJ,OAAM,EAANA,EAAQI,UACpBC,EAAiB,MAANL,OAAM,EAANA,EAAQK,SACF,MAANL,GAAAA,EAAQM,SACL,MAANN,GAAAA,EAAQO,YAEzBP,GAAAA,EAAQQ,gBAAkB,oBAAqB,IAAIR,EAAOQ,gBAAmBR,EAAOQ,eACnD,MAANR,GAAAA,EAAQS,gBACL,MAATL,GAAAA,EAAWM,UAC7B,IChRHC,EAGAC,EAGAC,EAiBAC,EDyPSC,EAAqClB,QAAAA,EAAQ,CAAA,ECvQtDmB,EAAc,EAGdC,EAAoB,GAEpBvB,EAAQ,GAERwB,EAAgBC,EAApBC,IACIxB,EAAkBuB,EAAtBE,IACIC,EAAeH,EAAQI,OACvBC,EAAYL,EAAhBM,IACIC,EAAmBP,EAAQQ,QAqG/B,SAASC,GAAajB,EAAOE,GACxBM,EAAeU,KAClBV,EAAAU,IAAcjB,EAAkBD,EAAOK,GAAeH,GAEvDG,EAAc,EAOd,IAAMF,EACLF,EAAgBkB,MACflB,EAAgBkB,IAAW,CAC3BC,GAAO,GACPF,IAAiB,KAMnB,OAHIlB,GAASG,EAAKiB,GAAOC,QACxBlB,EAAAiB,GAAYE,KAAK,CAAEC,IAAexC,IAE5BoB,EAAAiB,GAAYpB,EACnB,CAKM,SAASwB,GAAShB,G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