!function(){"use strict";function e(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function n(n){for(var o=1;o2&&(l.children=arguments.length>3?o.call(arguments,2):t),"function"==typeof e&&null!=e.defaultProps)for(a in e.defaultProps)void 0===l[a]&&(l[a]=e.defaultProps[a]);return x(e,l,r,i,null)}function x(e,n,t,o,a){var l={type:e,props:n,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==a?++i:a,__i:-1,__u:0};return null==a&&null!=r.vnode&&r.vnode(l),l}function S(e){return e.children}function k(e,n){this.props=e,this.context=n}function T(e,n){if(null==n)return e.__?T(e.__,e.__i+1):null;for(var t;nn&&a.sort(u));H.__r=0}function E(e,n,t,o,r,i,a,l,s,u,c){var d,p,v,_,h,m=o&&o.__k||g,b=n.length;for(t.__d=s,function(e,n,t){var o,r,i,a,l,s=n.length,u=t.length,c=u,d=0;for(e.__k=[],o=0;o0?x(r.type,r.props,r.key,r.ref?r.ref:null,r.__v):r)?(r.__=e,r.__b=e.__b+1,l=L(r,t,a=o+d,c),r.__i=l,i=null,-1!==l&&(c--,(i=t[l])&&(i.__u|=131072)),null==i||null===i.__v?(-1==l&&d--,"function"!=typeof r.type&&(r.__u|=65536)):l!==a&&(l===a+1?d++:l>a?c>s-a?d+=l-a:d--:d=l(null!=s&&0==(131072&s.__u)?1:0))for(;a>=0||l=0){if((s=n[a])&&0==(131072&s.__u)&&r==s.key&&i===s.type)return a;a--}if(l2&&(s.children=arguments.length>3?o.call(arguments,2):t),x(e.type,s,r||e.key,i||e.ref,null)}o=g.slice,r={__e:function(e,n,t,o){for(var r,i,a;n=n.__;)if((r=n.__c)&&!r.__)try{if((i=r.constructor)&&null!=i.getDerivedStateFromError&&(r.setState(i.getDerivedStateFromError(e)),a=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(e,o||{}),a=r.__d),a)return r.__E=r}catch(n){e=n}throw e}},i=0,k.prototype.setState=function(e,n){var t;t=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=b({},this.state),"function"==typeof e&&(e=e(b({},t),this.props)),e&&b(t,e),null!=e&&this.__v&&(n&&this._sb.push(n),P(this))},k.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),P(this))},k.prototype.render=S,a=[],s="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,u=function(e,n){return e.__v.__b-n.__v.__b},H.__r=0,c=0,function(e){e.Popover="popover",e.API="api",e.Widget="widget"}(d||(d={})),function(e){e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link"}(p||(p={})),function(e){e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question"}(v||(v={})),function(e){e.Once="once",e.Recurring="recurring",e.Always="always"}(_||(_={}));var j="undefined"!=typeof window?window:void 0,$="undefined"!=typeof globalThis?globalThis:j,U=Array.prototype.forEach,z=null==$?void 0:$.navigator,Y=null==$?void 0:$.document;null==$||$.location,null==$||$.fetch,null!=$&&$.XMLHttpRequest&&"withCredentials"in new $.XMLHttpRequest&&$.XMLHttpRequest,null==$||$.AbortController,null==z||z.userAgent;var G,X=null!=j?j:{};!function(e){e.GZipJS="gzip-js",e.Base64="base64"}(G||(G={}));var J=Array.isArray,K=Object.prototype.toString,ee=J||function(e){return"[object Array]"===K.call(e)},ne=e=>void 0===e,te=e=>null===e,oe=e=>"[object Number]"==K.call(e),re=e=>{var n={_log:function(n){if(j&&X.POSTHOG_DEBUG&&!ne(j.console)&&j.console){for(var t=("__rrweb_original__"in j.console[n]?j.console[n].__rrweb_original__:j.console[n]),o=arguments.length,r=new Array(o>1?o-1:0),i=1;i{n.error("You must initialize PostHog before calling ".concat(e))},createLogger:n=>re("".concat(e," ").concat(n))};return n},ie=re("[PostHog.js]").createLogger,ae=ie("[Stylesheet Loader]"),le=(e,n,t)=>{var o,r=e.createElement("style");return r.innerText=n,null!=t&&null!==(o=t.config)&&void 0!==o&&o.prepare_external_dependency_stylesheet&&(r=t.config.prepare_external_dependency_stylesheet(r)),r||(ae.error("prepare_external_dependency_stylesheet returned null"),null)},se=j,ue=Y,ce="seenSurvey_",de=ie("[Surveys]"),pe=2147483647;function ve(e){if("inherit"===e)return"inherit";var n='BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';return e?"".concat(e,", ").concat(n):"-apple-system, ".concat(n)}var _e=e=>"\n .survey-form, .thank-you-message {\n position: fixed;\n margin: 0px;\n bottom: 0px;\n color: black;\n font-weight: normal;\n font-family: ".concat(ve(null==e?void 0:e.fontFamily),";\n text-align: left;\n max-width: ").concat(parseInt((null==e?void 0:e.maxWidth)||"300"),"px;\n width: 100%;\n z-index: ").concat(parseInt((null==e?void 0:e.zIndex)||pe.toString()),";\n border: 1.5px solid ").concat((null==e?void 0:e.borderColor)||"#c9c6c6",";\n border-bottom: 0px;\n ").concat({left:"left: 30px;",right:"right: 30px;",center:"\n left: 50%;\n transform: translateX(-50%);\n "}[(null==e?void 0:e.position)||"right"]||"right: 30px;","\n flex-direction: column;\n background: ").concat((null==e?void 0:e.backgroundColor)||"#eeeded",";\n border-top-left-radius: 10px;\n border-top-right-radius: 10px;\n box-shadow: -6px 0 16px -8px rgb(0 0 0 / 8%), -9px 0 28px 0 rgb(0 0 0 / 5%), -12px 0 48px 16px rgb(0 0 0 / 3%);\n }\n\n .survey-box, .thank-you-message-container {\n padding: 20px 25px 10px;\n display: flex;\n flex-direction: column;\n border-radius: 10px;\n }\n\n .thank-you-message {\n text-align: center;\n }\n\n .form-submit[disabled] {\n opacity: ").concat((null==e?void 0:e.disabledButtonOpacity)||"0.6",";\n filter: grayscale(50%);\n cursor: not-allowed;\n }\n .survey-form textarea {\n color: #2d2d2d;\n font-size: 14px;\n font-family: ").concat(ve(null==e?void 0:e.fontFamily),";\n background: white;\n color: black;\n outline: none;\n padding-left: 10px;\n padding-right: 10px;\n padding-top: 10px;\n border-radius: 6px;\n border-color: ").concat((null==e?void 0:e.borderColor)||"#c9c6c6",";\n margin-top: 14px;\n width: 100%;\n box-sizing: border-box;\n }\n .survey-box:has(.survey-question:empty):not(:has(.survey-question-description)) textarea {\n margin-top: 0;\n }\n .form-submit {\n box-sizing: border-box;\n margin: 0;\n font-family: inherit;\n overflow: visible;\n text-transform: none;\n position: relative;\n display: inline-block;\n font-weight: 700;\n white-space: nowrap;\n text-align: center;\n border: 1.5px solid transparent;\n cursor: pointer;\n user-select: none;\n touch-action: manipulation;\n padding: 12px;\n font-size: 14px;\n border-radius: 6px;\n outline: 0;\n background: ").concat((null==e?void 0:e.submitButtonColor)||"black"," !important;\n text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.12);\n box-shadow: 0 2px 0 rgba(0, 0, 0, 0.045);\n width: 100%;\n }\n .form-cancel {\n display: flex;\n float: right;\n border: none;\n background: none;\n cursor: pointer;\n }\n .cancel-btn-wrapper {\n position: absolute;\n width: 35px;\n height: 35px;\n border-radius: 100%;\n top: 0;\n right: 0;\n transform: translate(50%, -50%);\n background: white;\n border: 1.5px solid ").concat((null==e?void 0:e.borderColor)||"#c9c6c6",";\n display: flex;\n justify-content: center;\n align-items: center;\n }\n .bolded { font-weight: 600; }\n .buttons {\n display: flex;\n justify-content: center;\n }\n .footer-branding {\n font-size: 11px;\n margin-top: 10px;\n text-align: center;\n display: flex;\n justify-content: center;\n gap: 4px;\n align-items: center;\n font-weight: 500;\n background: ").concat((null==e?void 0:e.backgroundColor)||"#eeeded",";\n text-decoration: none;\n backgroundColor: ").concat((null==e?void 0:e.backgroundColor)||"#eeeded",";\n color: ").concat(fe((null==e?void 0:e.backgroundColor)||"#eeeded"),";\n }\n .survey-question {\n font-weight: 500;\n font-size: 14px;\n background: ").concat((null==e?void 0:e.backgroundColor)||"#eeeded",";\n }\n .question-textarea-wrapper {\n display: flex;\n flex-direction: column;\n }\n .survey-question-description {\n font-size: 13px;\n padding-top: 5px;\n background: ").concat((null==e?void 0:e.backgroundColor)||"#eeeded",";\n }\n .ratings-number {\n font-size: 16px;\n font-weight: 600;\n padding: 8px 0px;\n border: none;\n }\n .ratings-number:hover {\n cursor: pointer;\n }\n .rating-options {\n margin-top: 14px;\n }\n .rating-options-number {\n display: grid;\n border-radius: 6px;\n overflow: hidden;\n border: 1.5px solid ").concat((null==e?void 0:e.borderColor)||"#c9c6c6",";\n }\n .rating-options-number > .ratings-number {\n border-right: 1px solid ").concat((null==e?void 0:e.borderColor)||"#c9c6c6",";\n }\n .rating-options-number > .ratings-number:last-of-type {\n border-right: 0px;\n }\n .rating-options-number .rating-active {\n background: ").concat((null==e?void 0:e.ratingButtonActiveColor)||"black",";\n }\n .rating-options-emoji {\n display: flex;\n justify-content: space-between;\n }\n .ratings-emoji {\n font-size: 16px;\n background-color: transparent;\n border: none;\n padding: 0px;\n }\n .ratings-emoji:hover {\n cursor: pointer;\n }\n .ratings-emoji.rating-active svg {\n fill: ").concat((null==e?void 0:e.ratingButtonActiveColor)||"black",";\n }\n .emoji-svg {\n fill: '#939393';\n }\n .rating-text {\n display: flex;\n flex-direction: row;\n font-size: 11px;\n justify-content: space-between;\n margin-top: 6px;\n background: ").concat((null==e?void 0:e.backgroundColor)||"#eeeded",";\n opacity: .60;\n }\n .limit-height {\n max-height: 300px;\n overflow: auto;\n scrollbar-width: thin;\n scrollbar-color: ").concat((null==e?void 0:e.borderColor)||"#c9c6c6"," ").concat((null==e?void 0:e.backgroundColor)||"#eeeded",";\n }\n .multiple-choice-options {\n margin-top: 13px;\n font-size: 14px;\n }\n .survey-box:has(.survey-question:empty):not(:has(.survey-question-description)) .multiple-choice-options {\n margin-top: 0;\n }\n .multiple-choice-options .choice-option {\n display: flex;\n align-items: center;\n gap: 4px;\n font-size: 13px;\n cursor: pointer;\n margin-bottom: 5px;\n position: relative;\n }\n .multiple-choice-options > .choice-option:last-of-type {\n margin-bottom: 0px;\n }\n .multiple-choice-options input {\n cursor: pointer;\n position: absolute;\n opacity: 0;\n }\n .choice-check {\n position: absolute;\n right: 10px;\n background: white;\n }\n .choice-check svg {\n display: none;\n }\n .multiple-choice-options .choice-option:hover .choice-check svg {\n display: inline-block;\n opacity: .25;\n }\n .multiple-choice-options input:checked + label + .choice-check svg {\n display: inline-block;\n opacity: 100% !important;\n }\n .multiple-choice-options input:checked + label {\n font-weight: bold;\n border: 1.5px solid rgba(0,0,0);\n }\n .multiple-choice-options input:checked + label input {\n font-weight: bold;\n }\n .multiple-choice-options label {\n width: 100%;\n cursor: pointer;\n padding: 10px;\n border: 1.5px solid rgba(0,0,0,.25);\n border-radius: 4px;\n background: white;\n }\n .multiple-choice-options .choice-option-open label {\n padding-right: 30px;\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n max-width: 100%;\n }\n .multiple-choice-options .choice-option-open label span {\n width: 100%;\n }\n .multiple-choice-options .choice-option-open input:disabled + label {\n opacity: 0.6;\n }\n .multiple-choice-options .choice-option-open label input {\n position: relative;\n opacity: 1;\n flex-grow: 1;\n border: 0;\n outline: 0;\n }\n .thank-you-message-body {\n margin-top: 6px;\n font-size: 14px;\n background: ").concat((null==e?void 0:e.backgroundColor)||"#eeeded",";\n }\n .thank-you-message-header {\n margin: 10px 0px 0px;\n background: ").concat((null==e?void 0:e.backgroundColor)||"#eeeded",";\n }\n .thank-you-message-container .form-submit {\n margin-top: 20px;\n margin-bottom: 10px;\n }\n .thank-you-message-countdown {\n margin-left: 6px;\n }\n .bottom-section {\n margin-top: 14px;\n }\n ").replace(/[\n\r\t]+/g," ").replace(/\s{2,}/g," ").trim();function he(e){if("#"===e[0]){var n=e.replace(/^#/,"");return"rgb("+parseInt(n.slice(0,2),16)+","+parseInt(n.slice(2,4),16)+","+parseInt(n.slice(4,6),16)+")"}return"rgb(255, 255, 255)"}function fe(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:me;"#"===n[0]&&(e=he(n)),n.startsWith("rgb")&&(e=n);var t={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}[n.toLowerCase()];if(t&&(e=he(t)),!e)return"black";var o=e.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);if(o){var r=parseInt(o[1]),i=parseInt(o[2]),a=parseInt(o[3]);return Math.sqrt(r*r*.299+i*i*.587+a*a*.114)>127.5?"black":"white"}return"black"}var ge={backgroundColor:"#eeeded",submitButtonColor:"black",submitButtonTextColor:"white",ratingButtonColor:"white",ratingButtonActiveColor:"black",borderColor:"#c9c6c6",placeholder:"Start typing...",whiteLabel:!1,displayThankYouMessage:!0,thankYouMessageHeader:"Thank you for your feedback!",position:"right"},me="#eeeded",ye=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0;r?(localStorage.setItem(ke(o),"true"),r.capture("survey sent",n(n({$survey_name:o.name,$survey_id:o.id,$survey_iteration:o.current_iteration,$survey_iteration_start_date:o.current_iteration_start_date,$survey_questions:o.questions.map(((e,n)=>({id:e.id,question:e.question,index:n}))),sessionRecordingUrl:null===(e=r.get_session_replay_url)||void 0===e?void 0:e.call(r)},t),{},{$set:{[Te(o,"responded")]:!0}})),se.dispatchEvent(new Event("PHSurveySent"))):de.error("[survey sent] event not captured, PostHog instance not found.")},be=(e,n,t)=>{var o;n?t||(n.capture("survey dismissed",{$survey_name:e.name,$survey_id:e.id,$survey_iteration:e.current_iteration,$survey_iteration_start_date:e.current_iteration_start_date,sessionRecordingUrl:null===(o=n.get_session_replay_url)||void 0===o?void 0:o.call(n),$set:{[Te(e,"dismissed")]:!0}}),localStorage.setItem(ke(e),"true"),se.dispatchEvent(new Event("PHSurveyClosed"))):de.error("[survey dismissed] event not captured, PostHog instance not found.")},Ce=e=>e.map((e=>({sort:Math.floor(10*Math.random()),value:e}))).sort(((e,n)=>e.sort-n.sort)).map((e=>e.value)),we=(e,n)=>e.length===n.length&&e.every(((e,t)=>e===n[t]))?n.reverse():n,xe=e=>e.appearance&&e.appearance.shuffleQuestions?we(e.questions,Ce(e.questions)):e.questions,Se=e=>{var n,t;return e.schedule===_.Always&&e.type===d.Widget||!(null===(n=e.conditions)||void 0===n||null===(t=n.events)||void 0===t||!t.repeatedActivation||!(e=>{var n,t,o,r,i,a;return null!=(null===(n=e.conditions)||void 0===n||null===(t=n.events)||void 0===t||null===(o=t.values)||void 0===o?void 0:o.length)&&(null===(r=e.conditions)||void 0===r||null===(i=r.events)||void 0===i||null===(a=i.values)||void 0===a?void 0:a.length)>0})(e))},ke=e=>{var n="".concat(ce).concat(e.id);return e.current_iteration&&e.current_iteration>0&&(n="".concat(ce).concat(e.id,"_").concat(e.current_iteration)),n},Te=(e,n)=>{var t="$survey_".concat(n,"/").concat(e.id);return e.current_iteration&&e.current_iteration>0&&(t="$survey_".concat(n,"/").concat(e.id,"/").concat(e.current_iteration)),t},qe=function(e,n){var t={__c:n="__cC"+c++,__:e,Consumer:function(e,n){return e.children(n)},Provider:function(e){var t,o;return this.getChildContext||(t=[],(o={})[n]=this,this.getChildContext=function(){return o},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&t.some((function(e){e.__e=!0,P(e)}))},this.sub=function(e){t.push(e);var n=e.componentWillUnmount;e.componentWillUnmount=function(){t.splice(t.indexOf(e),1),n&&n.call(e)}}),e.children}};return t.Provider.__=t.Consumer.contextType=t}({isPreviewMode:!1,previewPageIndex:0,onPopupSurveyDismissed:()=>{},isPopup:!0,onPreviewSubmit:()=>{}}),Pe=e=>{var{component:n,children:t,renderAsHtml:o,style:r}=e;return W(n,o?{dangerouslySetInnerHTML:{__html:t},style:r}:{children:t,style:r})},He={};function Ee(e,n,t){if(ee(e))if(U&&e.forEach===U)e.forEach(n,t);else if("length"in e&&e.length===+e.length)for(var o=0,r=e.length;o1?n-1:0),o=1;o{this.events[e]=this.events[e].filter((e=>e!==n))}}emit(e,n){for(var t of this.events[e]||[])t(n);for(var o of this.events["*"]||[])o(e,n)}}class Ae{constructor(e){t(this,"_debugEventEmitter",new Fe),t(this,"checkStep",((e,n)=>this.checkStepEvent(e,n)&&this.checkStepUrl(e,n)&&this.checkStepElement(e,n))),t(this,"checkStepEvent",((e,n)=>null==n||!n.event||(null==e?void 0:e.event)===(null==n?void 0:n.event))),this.instance=e,this.actionEvents=new Set,this.actionRegistry=new Set}init(){var e;if(!ne(null===(e=this.instance)||void 0===e?void 0:e._addCaptureHook)){var n;null===(n=this.instance)||void 0===n||n._addCaptureHook(((e,n)=>{this.on(e,n)}))}}register(e){var n,t;if(!ne(null===(n=this.instance)||void 0===n?void 0:n._addCaptureHook)&&(e.forEach((e=>{var n,t;null===(n=this.actionRegistry)||void 0===n||n.add(e),null===(t=e.steps)||void 0===t||t.forEach((e=>{var n;null===(n=this.actionEvents)||void 0===n||n.add((null==e?void 0:e.event)||"")}))})),null!==(t=this.instance)&&void 0!==t&&t.autocapture)){var o,r=new Set;e.forEach((e=>{var n;null===(n=e.steps)||void 0===n||n.forEach((e=>{null!=e&&e.selector&&r.add(null==e?void 0:e.selector)}))})),null===(o=this.instance)||void 0===o||o.autocapture.setElementSelectors(r)}}on(e,n){var t;null!=n&&0!=e.length&&(this.actionEvents.has(e)||this.actionEvents.has(null==n?void 0:n.event))&&this.actionRegistry&&(null===(t=this.actionRegistry)||void 0===t?void 0:t.size)>0&&this.actionRegistry.forEach((e=>{this.checkAction(n,e)&&this._debugEventEmitter.emit("actionCaptured",e.name)}))}_addActionHook(e){this.onAction("actionCaptured",(n=>e(n)))}checkAction(e,n){if(null==(null==n?void 0:n.steps))return!1;for(var t of n.steps)if(this.checkStep(e,t))return!0;return!1}onAction(e,n){return this._debugEventEmitter.on(e,n)}checkStepUrl(e,n){if(null!=n&&n.url){var t,o=null==e||null===(t=e.properties)||void 0===t?void 0:t.$current_url;if(!o||"string"!=typeof o)return!1;if(!Ae.matchString(o,null==n?void 0:n.url,(null==n?void 0:n.url_matching)||"contains"))return!1}return!0}static matchString(e,n,t){switch(t){case"regex":return!!j&&Le(e,n);case"exact":return n===e;case"contains":var o=Ae.escapeStringRegexp(n).replace(/_/g,".").replace(/%/g,".*");return Le(e,o);default:return!1}}static escapeStringRegexp(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}checkStepElement(e,n){if((null!=n&&n.href||null!=n&&n.tag_name||null!=n&&n.text)&&!this.getElementsList(e).some((e=>!(null!=n&&n.href&&!Ae.matchString(e.href||"",null==n?void 0:n.href,(null==n?void 0:n.href_matching)||"exact"))&&((null==n||!n.tag_name||e.tag_name===(null==n?void 0:n.tag_name))&&!(null!=n&&n.text&&!Ae.matchString(e.text||"",null==n?void 0:n.text,(null==n?void 0:n.text_matching)||"exact")&&!Ae.matchString(e.$el_text||"",null==n?void 0:n.text,(null==n?void 0:n.text_matching)||"exact"))))))return!1;if(null!=n&&n.selector){var t,o=null==e||null===(t=e.properties)||void 0===t?void 0:t.$element_selectors;if(!o)return!1;if(!o.includes(null==n?void 0:n.selector))return!1}return!0}getElementsList(e){return null==(null==e?void 0:e.properties.$elements)?[]:null==e?void 0:e.properties.$elements}}class De{constructor(e){this.instance=e,this.eventToSurveys=new Map,this.actionToSurveys=new Map}register(e){var n;ne(null===(n=this.instance)||void 0===n?void 0:n._addCaptureHook)||(this.setupEventBasedSurveys(e),this.setupActionBasedSurveys(e))}setupActionBasedSurveys(e){var n=e.filter((e=>{var n,t,o,r;return(null===(n=e.conditions)||void 0===n?void 0:n.actions)&&(null===(t=e.conditions)||void 0===t||null===(o=t.actions)||void 0===o||null===(r=o.values)||void 0===r?void 0:r.length)>0}));if(0!==n.length){if(null==this.actionMatcher){this.actionMatcher=new Ae(this.instance),this.actionMatcher.init();this.actionMatcher._addActionHook((e=>{this.onAction(e)}))}n.forEach((e=>{var n,t,o,r,i,a,l,s,u,c;e.conditions&&null!==(n=e.conditions)&&void 0!==n&&n.actions&&null!==(t=e.conditions)&&void 0!==t&&null!==(o=t.actions)&&void 0!==o&&o.values&&(null===(r=e.conditions)||void 0===r||null===(i=r.actions)||void 0===i||null===(a=i.values)||void 0===a?void 0:a.length)>0&&(null===(l=this.actionMatcher)||void 0===l||l.register(e.conditions.actions.values),null===(s=e.conditions)||void 0===s||null===(u=s.actions)||void 0===u||null===(c=u.values)||void 0===c||c.forEach((n=>{if(n&&n.name){var t=this.actionToSurveys.get(n.name);t&&t.push(e.id),this.actionToSurveys.set(n.name,t||[e.id])}})))}))}}setupEventBasedSurveys(e){var n;if(0!==e.filter((e=>{var n,t,o,r;return(null===(n=e.conditions)||void 0===n?void 0:n.events)&&(null===(t=e.conditions)||void 0===t||null===(o=t.events)||void 0===o||null===(r=o.values)||void 0===r?void 0:r.length)>0})).length){null===(n=this.instance)||void 0===n||n._addCaptureHook(((e,n)=>{this.onEvent(e,n)})),e.forEach((e=>{var n,t,o;null===(n=e.conditions)||void 0===n||null===(t=n.events)||void 0===t||null===(o=t.values)||void 0===o||o.forEach((n=>{if(n&&n.name){var t=this.eventToSurveys.get(n.name);t&&t.push(e.id),this.eventToSurveys.set(n.name,t||[e.id])}}))}))}}onEvent(e,n){var t,o,r=(null===(t=this.instance)||void 0===t||null===(o=t.persistence)||void 0===o?void 0:o.props[h])||[];if(De.SURVEY_SHOWN_EVENT_NAME==e&&n&&r.length>0){var i,a=null==n||null===(i=n.properties)||void 0===i?void 0:i.$survey_id;if(a){var l=r.indexOf(a);l>=0&&(r.splice(l,1),this._updateActivatedSurveys(r))}}else this.eventToSurveys.has(e)&&this._updateActivatedSurveys(r.concat(this.eventToSurveys.get(e)||[]))}onAction(e){var n,t,o=(null===(n=this.instance)||void 0===n||null===(t=n.persistence)||void 0===t?void 0:t.props[h])||[];this.actionToSurveys.has(e)&&this._updateActivatedSurveys(o.concat(this.actionToSurveys.get(e)||[]))}_updateActivatedSurveys(e){var n,t;null===(n=this.instance)||void 0===n||null===(t=n.persistence)||void 0===t||t.register({[h]:[...new Set(e)]})}getSurveys(){var e,n,t=null===(e=this.instance)||void 0===e||null===(n=e.persistence)||void 0===n?void 0:n.props[h];return t||[]}getEventToSurveys(){return this.eventToSurveys}_getActionMatcher(){return this.actionMatcher}}t(De,"SURVEY_SHOWN_EVENT_NAME","survey shown");var Ne={icontains:(e,n)=>e.some((e=>n.toLowerCase().includes(e.toLowerCase()))),not_icontains:(e,n)=>e.every((e=>!n.toLowerCase().includes(e.toLowerCase()))),regex:(e,n)=>e.some((e=>Le(n,e))),not_regex:(e,n)=>e.every((e=>!Le(n,e))),exact:(e,n)=>e.some((e=>n===e)),is_not:(e,n)=>e.every((e=>n!==e))};function Ie(e){var n,t,o;if(null===(n=e.conditions)||void 0===n||!n.url)return!0;var r=null==j||null===(t=j.location)||void 0===t?void 0:t.href;if(!r)return!1;var i,a=[e.conditions.url];return Ne[(i=null===(o=e.conditions)||void 0===o?void 0:o.urlMatchType,null!=i?i:"icontains")](a,r)}var Ve,Ze,Be,Oe,Re=0,Qe=[],We=[],je=r.__b,$e=r.__r,Ue=r.diffed,ze=r.__c,Ye=r.unmount;function Ge(e,n){r.__h&&r.__h(Ze,e,Re||n),Re=0;var t=Ze.__H||(Ze.__H={__:[],__h:[]});return e>=t.__.length&&t.__.push({__V:We}),t.__[e]}function Xe(e){return Re=1,function(e,n,t){var o=Ge(Ve++,2);if(o.t=e,!o.__c&&(o.__=[un(void 0,n),function(e){var n=o.__N?o.__N[0]:o.__[0],t=o.t(n,e);n!==t&&(o.__N=[t,o.__[1]],o.__c.setState({}))}],o.__c=Ze,!Ze.u)){var r=function(e,n,t){if(!o.__c.__H)return!0;var r=o.__c.__H.__.filter((function(e){return e.__c}));if(r.every((function(e){return!e.__N})))return!i||i.call(this,e,n,t);var a=!1;return r.forEach((function(e){if(e.__N){var n=e.__[0];e.__=e.__N,e.__N=void 0,n!==e.__[0]&&(a=!0)}})),!(!a&&o.__c.props===e)&&(!i||i.call(this,e,n,t))};Ze.u=!0;var i=Ze.shouldComponentUpdate,a=Ze.componentWillUpdate;Ze.componentWillUpdate=function(e,n,t){if(this.__e){var o=i;i=void 0,r(e,n,t),i=o}a&&a.call(this,e,n,t)},Ze.shouldComponentUpdate=r}return o.__N||o.__}(un,e)}function Je(e,n){var t=Ge(Ve++,3);!r.__s&&sn(t.__H,n)&&(t.__=e,t.i=n,Ze.__H.__h.push(t))}function Ke(e){return Re=5,en((function(){return{current:e}}),[])}function en(e,n){var t=Ge(Ve++,7);return sn(t.__H,n)?(t.__V=e(),t.i=n,t.__h=e,t.__V):t.__}function nn(e){var n=Ze.context[e.__c],t=Ge(Ve++,9);return t.c=e,n?(null==t.__&&(t.__=!0,n.sub(Ze)),n.props.value):e.__}function tn(){for(var e;e=Qe.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(an),e.__H.__h.forEach(ln),e.__H.__h=[]}catch(n){e.__H.__h=[],r.__e(n,e.__v)}}r.__b=function(e){Ze=null,je&&je(e)},r.__r=function(e){$e&&$e(e),Ve=0;var n=(Ze=e.__c).__H;n&&(Be===Ze?(n.__h=[],Ze.__h=[],n.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=We,e.__N=e.i=void 0}))):(n.__h.forEach(an),n.__h.forEach(ln),n.__h=[],Ve=0)),Be=Ze},r.diffed=function(e){Ue&&Ue(e);var n=e.__c;n&&n.__H&&(n.__H.__h.length&&(1!==Qe.push(n)&&Oe===r.requestAnimationFrame||((Oe=r.requestAnimationFrame)||rn)(tn)),n.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==We&&(e.__=e.__V),e.i=void 0,e.__V=We}))),Be=Ze=null},r.__c=function(e,n){n.some((function(e){try{e.__h.forEach(an),e.__h=e.__h.filter((function(e){return!e.__||ln(e)}))}catch(t){n.some((function(e){e.__h&&(e.__h=[])})),n=[],r.__e(t,e.__v)}})),ze&&ze(e,n)},r.unmount=function(e){Ye&&Ye(e);var n,t=e.__c;t&&t.__H&&(t.__H.__.forEach((function(e){try{an(e)}catch(e){n=e}})),t.__H=void 0,n&&r.__e(n,t.__v))};var on="function"==typeof requestAnimationFrame;function rn(e){var n,t=function(){clearTimeout(o),on&&cancelAnimationFrame(n),setTimeout(e)},o=setTimeout(t,100);on&&(n=requestAnimationFrame(t))}function an(e){var n=Ze,t=e.__c;"function"==typeof t&&(e.__c=void 0,t()),Ze=n}function ln(e){var n=Ze;e.__c=e.__(),Ze=n}function sn(e,n){return!e||e.length!==n.length||n.some((function(n,t){return n!==e[t]}))}function un(e,n){return"function"==typeof n?n(e):n}var cn=Y;function dn(e,n){var t,o=cn.createElement("div");o.className="PostHogWidget".concat(e.id);var r,i=o.attachShadow({mode:"open"}),a=(r=null===(t=e.appearance)||void 0===t?void 0:t.widgetColor,"\n .ph-survey-widget-tab {\n position: fixed;\n top: 50%;\n right: 0;\n background: ".concat(r||"#e0a045",";\n color: white;\n transform: rotate(-90deg) translate(0, -100%);\n transform-origin: right top;\n min-width: 40px;\n padding: 8px 12px;\n font-weight: 500;\n border-radius: 3px 3px 0 0;\n text-align: center;\n cursor: pointer;\n z-index: ").concat(pe,";\n }\n .ph-survey-widget-tab:hover {\n padding-bottom: 13px;\n }\n .ph-survey-widget-button {\n position: fixed;\n }\n ")),l=le(cn,a,n);return l&&i.append(l),cn.body.appendChild(o),i}var pn=0;function vn(e,n,t,o,i,a){var l,s,u={};for(s in n)"ref"==s?l=n[s]:u[s]=n[s];var c={type:e,props:u,key:t,ref:l,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--pn,__i:-1,__u:0,__source:i,__self:a};if("function"==typeof e&&(l=e.defaultProps))for(s in l)void 0===u[s]&&(u[s]=l[s]);return r.vnode&&r.vnode(c),c}var _n=vn("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:vn("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"})}),hn=vn("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:vn("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"})}),fn=vn("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:vn("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"})}),gn=vn("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:vn("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"})}),mn=vn("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:vn("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"})}),yn=vn("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:vn("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0.164752 0.164752C0.384422 -0.0549175 0.740578 -0.0549175 0.960248 0.164752L6 5.20451L11.0398 0.164752C11.2594 -0.0549175 11.6156 -0.0549175 11.8352 0.164752C12.0549 0.384422 12.0549 0.740578 11.8352 0.960248L6.79549 6L11.8352 11.0398C12.0549 11.2594 12.0549 11.6156 11.8352 11.8352C11.6156 12.0549 11.2594 12.0549 11.0398 11.8352L6 6.79549L0.960248 11.8352C0.740578 12.0549 0.384422 12.0549 0.164752 11.8352C-0.0549175 11.6156 -0.0549175 11.2594 0.164752 11.0398L5.20451 6L0.164752 0.960248C-0.0549175 0.740578 -0.0549175 0.384422 0.164752 0.164752Z",fill:"black"})}),bn=vn("svg",{width:"77",height:"14",viewBox:"0 0 77 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[vn("g",{"clip-path":"url(#clip0_2415_6911)",children:[vn("mask",{id:"mask0_2415_6911",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"77",height:"14",children:vn("path",{d:"M0.5 0H76.5V14H0.5V0Z",fill:"white"})}),vn("g",{mask:"url(#mask0_2415_6911)",children:[vn("path",{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",fill:"#1D4AFF"}),vn("path",{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",fill:"#F9BD2B"}),vn("path",{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",fill:"currentColor"}),vn("path",{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",fill:"#1D4AFF"}),vn("path",{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",fill:"#F54E00"}),vn("path",{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",fill:"currentColor"})]})]}),vn("defs",{children:vn("clipPath",{id:"clip0_2415_6911",children:vn("rect",{width:"76",height:"14",fill:"white",transform:"translate(0.5)"})})})]}),Cn=vn("svg",{width:"16",height:"12",viewBox:"0 0 16 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:vn("path",{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",fill:"currentColor"})});function wn(){return vn("a",{href:"https://posthog.com",target:"_blank",rel:"noopener",className:"footer-branding",children:["Survey by ",bn]})}function xn(e){var{text:n,submitDisabled:t,appearance:o,onSubmit:r,link:i,onPreviewSubmit:a}=e,{isPreviewMode:l,isPopup:s}=nn(qe),u=o.submitButtonTextColor||fe(o.submitButtonColor||ge.submitButtonColor);return vn("div",{className:"bottom-section",children:[vn("div",{className:"buttons",children:vn("button",{className:"form-submit",disabled:t,"aria-label":"Submit survey",type:"button",style:s?{color:u}:{},onClick:()=>{i&&(null==j||j.open(i)),l?null==a||a():r()},children:n})}),!o.whiteLabel&&vn(wn,{})]})}function Sn(e){var{question:n,description:t,descriptionContentType:o,backgroundColor:r,forceDisableHtml:i}=e,{isPopup:a}=nn(qe);return vn("div",{style:a?{backgroundColor:r||ge.backgroundColor}:{},children:[vn("div",{className:"survey-question",children:n}),t&&Pe({component:w("div",{className:"survey-question-description"}),children:t,renderAsHtml:!i&&"text"!==o})]})}function kn(e){var{onClick:n}=e,{isPreviewMode:t}=nn(qe);return vn("div",{className:"cancel-btn-wrapper",children:vn("button",{className:"form-cancel",onClick:n,disabled:t,"aria-label":"Close survey",role:"button",children:yn})})}function Tn(e){var{header:t,description:o,contentType:r,forceDisableHtml:i,appearance:a,onClose:l,styleOverrides:s}=e,u=fe(a.backgroundColor||ge.backgroundColor),{isPopup:c}=nn(qe);return vn("div",{className:"thank-you-message",style:n({},s),children:vn("div",{className:"thank-you-message-container",children:[c&&vn(kn,{onClick:()=>l()}),vn("h3",{className:"thank-you-message-header",style:{color:u},children:t}),o&&Pe({component:w("div",{className:"thank-you-message-body"}),children:o,renderAsHtml:!i&&"text"!==r,style:{color:u}}),c&&vn(xn,{text:a.thankYouMessageCloseButtonText||"Close",submitDisabled:!1,appearance:a,onSubmit:()=>l()})]})})}function qn(e){var n,t=Ke(null),[o,r]=Xe(null!==(n=e.defaultTextColor)&&void 0!==n?n:"black");return Je((()=>{if(t.current){var e=function(e){var n=se.getComputedStyle(e).backgroundColor;if("rgba(0, 0, 0, 0)"===n)return"black";var t=n.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);if(!t)return"black";var o=parseInt(t[1]),r=parseInt(t[2]),i=parseInt(t[3]);return Math.sqrt(o*o*.299+r*r*.587+i*i*.114)>127.5?"black":"white"}(t.current);r(e)}}),[e.appearance,e.forceUpdate]),{ref:t,textColor:o}}function Pn(e){var{question:n,forceDisableHtml:t,appearance:o,onSubmit:r,onPreviewSubmit:i}=e,[a,l]=Xe("");return vn("div",{children:[vn(Sn,{question:n.question,description:n.description,descriptionContentType:n.descriptionContentType,backgroundColor:o.backgroundColor,forceDisableHtml:t}),vn("textarea",{rows:4,placeholder:null==o?void 0:o.placeholder,onInput:e=>l(e.currentTarget.value)}),vn(xn,{text:n.buttonText||"Submit",submitDisabled:!a&&!n.optional,appearance:o,onSubmit:()=>r(a),onPreviewSubmit:()=>i(a)})]})}function Hn(e){var{question:n,forceDisableHtml:t,appearance:o,onSubmit:r,onPreviewSubmit:i}=e;return vn(S,{children:[vn(Sn,{question:n.question,description:n.description,descriptionContentType:n.descriptionContentType,forceDisableHtml:t}),vn(xn,{text:n.buttonText||"Submit",submitDisabled:!1,link:n.link,appearance:o,onSubmit:()=>r("link clicked"),onPreviewSubmit:()=>i("link clicked")})]})}function En(e){var{question:n,forceDisableHtml:t,displayQuestionIndex:o,appearance:r,onSubmit:i,onPreviewSubmit:a}=e,l=n.scale,s=10===n.scale?0:1,[u,c]=Xe(null);return vn(S,{children:[vn(Sn,{question:n.question,description:n.description,descriptionContentType:n.descriptionContentType,forceDisableHtml:t,backgroundColor:r.backgroundColor}),vn("div",{className:"rating-section",children:[vn("div",{className:"rating-options",children:["emoji"===n.display&&vn("div",{className:"rating-options-emoji",children:(3===n.scale?An:Dn).map(((e,n)=>{var t=n+1===u;return vn("button",{className:"ratings-emoji question-".concat(o,"-rating-").concat(n," ").concat(t?"rating-active":null),value:n+1,type:"button",onClick:()=>{c(n+1)},style:{fill:t?r.ratingButtonActiveColor:r.ratingButtonColor,borderColor:r.borderColor},children:e},n)}))}),"number"===n.display&&vn("div",{className:"rating-options-number",style:{gridTemplateColumns:"repeat(".concat(l-s+1,", minmax(0, 1fr))")},children:Zn(n.scale).map(((e,n)=>vn(Mn,{displayQuestionIndex:o,active:u===e,appearance:r,num:e,setActiveNumber:e=>{c(e)}},n)))})]}),vn("div",{className:"rating-text",children:[vn("div",{children:n.lowerBoundLabel}),vn("div",{children:n.upperBoundLabel})]})]}),vn(xn,{text:n.buttonText||(null==r?void 0:r.submitButtonText)||"Submit",submitDisabled:te(u)&&!n.optional,appearance:r,onSubmit:()=>i(u),onPreviewSubmit:()=>a(u)})]})}function Mn(e){var{num:n,active:t,displayQuestionIndex:o,appearance:r,setActiveNumber:i}=e,{textColor:a,ref:l}=qn({appearance:r,defaultTextColor:"black",forceUpdate:t});return vn("button",{ref:l,className:"ratings-number question-".concat(o,"-rating-").concat(n," ").concat(t?"rating-active":null),type:"button",onClick:()=>{i(n)},style:{color:a,backgroundColor:t?r.ratingButtonActiveColor:r.ratingButtonColor,borderColor:r.borderColor},children:n})}function Ln(e,n,t,o){if(o)return!1;if(te(e))return!0;if(ee(e)){if(!n&&0===e.length)return!0;if(n&&!t&&0===e.length)return!0}return!1}function Fn(e){var{question:n,forceDisableHtml:t,displayQuestionIndex:o,appearance:r,onSubmit:i,onPreviewSubmit:a}=e,l=Ke(null),s=en((()=>(e=>{if(!e.shuffleOptions)return e.choices;var n=e.choices,t="";e.hasOpenChoice&&(t=n.pop());var o=we(n,Ce(n));return e.hasOpenChoice&&(e.choices.push(t),o.push(t)),o})(n)),[n]),[u,c]=Xe(n.type===p.MultipleChoice?[]:null),[d,v]=Xe(!1),[_,h]=Xe(""),f=n.type===p.SingleChoice?"radio":"checkbox",g=(e,t)=>t?(v(!d),void(d||setTimeout((()=>{var e;return null===(e=l.current)||void 0===e?void 0:e.focus()}),0))):n.type===p.SingleChoice?(c(e),void v(!1)):void(n.type===p.MultipleChoice&&ee(u)&&(u.includes(e)?c(u.filter((n=>n!==e))):c([...u,e])));return vn("div",{children:[vn(Sn,{question:n.question,description:n.description,descriptionContentType:n.descriptionContentType,forceDisableHtml:t,backgroundColor:r.backgroundColor}),vn("div",{className:"multiple-choice-options limit-height",children:s.map(((e,t)=>{var r=!!n.hasOpenChoice&&t===n.choices.length-1,i="choice-option".concat(r?" choice-option-open":""),a=r?d:n.type===p.SingleChoice?u===e:ee(u)&&u.includes(e);return vn("div",{className:i,children:[vn("input",{type:f,id:"surveyQuestion".concat(o,"Choice").concat(t),name:"question".concat(o),checked:a,onClick:()=>g(e,r)}),vn("label",{htmlFor:"surveyQuestion".concat(o,"Choice").concat(t),style:{color:"black"},children:r?vn(S,{children:[vn("span",{children:[e,":"]}),vn("input",{type:"text",ref:l,id:"surveyQuestion".concat(o,"Choice").concat(t,"Open"),name:"question".concat(o),value:_,onInput:e=>{return t=e.currentTarget.value,h(t),void(n.type===p.SingleChoice&&c(t));var t},onClick:n=>{d||g(e,!0),n.stopPropagation()}})]}):e}),vn("span",{className:"choice-check",style:{color:"black"},children:Cn})]},t)}))}),vn(xn,{text:n.buttonText||"Submit",submitDisabled:Ln(u,d,_,!!n.optional),appearance:r,onSubmit:()=>{d&&n.type===p.MultipleChoice?ee(u)&&i([...u,_]):i(u)},onPreviewSubmit:()=>{d&&n.type===p.MultipleChoice?ee(u)&&a([...u,_]):a(u)}})]})}var An=[fn,hn,_n],Dn=[gn,fn,hn,_n,mn],Nn=[1,2,3,4,5],In=[1,2,3,4,5,6,7],Vn=[0,1,2,3,4,5,6,7,8,9,10];function Zn(e){switch(e){case 5:default:return Nn;case 7:return In;case 10:return Vn}}var Bn=ie("[Surveys]"),On=j,Rn=Y;function Qn(e){return".PostHogWidget".concat(e)}function Wn(e,n,t){var o,r=e.questions[n],i=n+1;if(null===(o=r.branching)||void 0===o||!o.type)return n===e.questions.length-1?v.End:i;if(r.branching.type===v.End)return v.End;if(r.branching.type===v.SpecificQuestion){if(Number.isInteger(r.branching.index))return r.branching.index}else if(r.branching.type===v.ResponseBased){if(r.type===p.SingleChoice){var a,l,s=r.choices.indexOf("".concat(t));if(null!==(a=r.branching)&&void 0!==a&&null!==(l=a.responseValues)&&void 0!==l&&l.hasOwnProperty(s)){var u=r.branching.responseValues[s];return Number.isInteger(u)?u:u===v.End?v.End:i}}else if(r.type===p.Rating){var c,d;if("number"!=typeof t||!Number.isInteger(t))throw new Error("The response type must be an integer");var _=function(e,n){if(3===n){if(e<1||e>3)throw new Error("The response must be in range 1-3");return 1===e?"negative":2===e?"neutral":"positive"}if(5===n){if(e<1||e>5)throw new Error("The response must be in range 1-5");return e<=2?"negative":3===e?"neutral":"positive"}if(7===n){if(e<1||e>7)throw new Error("The response must be in range 1-7");return e<=3?"negative":4===e?"neutral":"positive"}if(10===n){if(e<0||e>10)throw new Error("The response must be in range 0-10");return e<=6?"detractors":e<=8?"passives":"promoters"}throw new Error("The scale must be one of: 3, 5, 7, 10")}(t,r.scale);if(null!==(c=r.branching)&&void 0!==c&&null!==(d=c.responseValues)&&void 0!==d&&d.hasOwnProperty(_)){var h=r.branching.responseValues[_];return Number.isInteger(h)?h:h===v.End?v.End:i}}return i}return Bn.warn("Falling back to next question index due to unexpected branching type"),i}class jn{constructor(e){var o=this;t(this,"surveyTimeouts",new Map),t(this,"canShowNextEventBasedSurvey",(()=>{var e,n=Rn.querySelectorAll("div[class^=PostHogSurvey]");return!(n.length>0)||1===(null===(e=n[n.length-1].shadowRoot)||void 0===e?void 0:e.childElementCount)})),t(this,"handlePopoverSurvey",(e=>{var t,o=null===(t=e.conditions)||void 0===t?void 0:t.seenSurveyWaitPeriodInDays;if(((e,n)=>{if(!n||!e)return!0;var t=new Date,o=Math.abs(t.getTime()-new Date(e).getTime());return Math.ceil(o/864e5)>n})(localStorage.getItem("lastSeenSurveyDate"),o)){var r=(e=>!!localStorage.getItem(ke(e))&&!Se(e))(e);if(!r){var i;this.clearSurveyTimeout(e.id),this.addSurveyToFocus(e.id);var a=(null===(i=e.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds)||0,l=((e,n,t,o)=>{var r=ue.createElement("div");r.className="PostHogSurvey".concat(n);var i=r.attachShadow({mode:"open"});if(e){var a=le(ue,e,o);a&&i.appendChild(a)}return ue.body.appendChild(r),i})(_e(null==e?void 0:e.appearance),e.id,0,this.posthog);if(a<=0)return Q(vn(zn,{posthog:this.posthog,survey:e,removeSurveyFromFocus:this.removeSurveyFromFocus,isPopup:!0},"popover-survey"),l);var s=setTimeout((()=>{if(!Ie(e))return this.removeSurveyFromFocus(e.id);Q(vn(zn,{posthog:this.posthog,survey:n(n({},e),{},{appearance:n(n({},e.appearance),{},{surveyPopupDelaySeconds:0})}),removeSurveyFromFocus:this.removeSurveyFromFocus,isPopup:!0},"popover-survey"),l)}),1e3*a);this.surveyTimeouts.set(e.id,s)}}})),t(this,"handleWidget",(e=>{var n=dn(e,this.posthog),t=_e(e.appearance),o=le(Rn,t,this.posthog);o&&n.appendChild(o),Q(vn(Gn,{posthog:this.posthog,survey:e,removeSurveyFromFocus:this.removeSurveyFromFocus},"feedback-survey"),n)})),t(this,"handleWidgetSelector",(e=>{var n,t=(null===(n=e.appearance)||void 0===n?void 0:n.widgetSelector)&&Rn.querySelector(e.appearance.widgetSelector);if(t)if(0===Rn.querySelectorAll(".PostHogWidget".concat(e.id)).length)this.handleWidget(e);else if(1===Rn.querySelectorAll(".PostHogWidget".concat(e.id)).length&&!t.getAttribute("PHWidgetSurveyClickListener")){var o,r,i=null===(o=Rn.querySelector(Qn(e.id)))||void 0===o||null===(r=o.shadowRoot)||void 0===r?void 0:r.querySelector(".survey-form");Me(t,"click",(()=>{i&&(i.style.display="none"===i.style.display?"block":"none",Me(i,"PHSurveyClosed",(()=>{this.removeSurveyFromFocus(e.id),i.style.display="none"})))})),t.setAttribute("PHWidgetSurveyClickListener","true")}})),t(this,"canRenderSurvey",(e=>{var n={visible:!1};return e.end_date?(n.disabledReason="survey was completed on ".concat(e.end_date),n):e.type!=d.Popover?(n.disabledReason="Only Popover survey types can be rendered",n):!e.linked_flag_key||this.posthog.featureFlags.isFeatureEnabled(e.linked_flag_key)?!e.targeting_flag_key||this.posthog.featureFlags.isFeatureEnabled(e.targeting_flag_key)?!e.internal_targeting_flag_key||this.posthog.featureFlags.isFeatureEnabled(e.internal_targeting_flag_key)?(n.visible=!0,n):(n.disabledReason="internal targeting feature flag ".concat(e.internal_targeting_flag_key," is false"),n):(n.disabledReason="targeting feature flag ".concat(e.targeting_flag_key," is false"),n):(n.disabledReason="linked feature flag ".concat(e.linked_flag_key," is false"),n)})),t(this,"renderSurvey",((e,n)=>{Q(vn(zn,{posthog:this.posthog,survey:e,removeSurveyFromFocus:this.removeSurveyFromFocus,isPopup:!1},"popover-survey"),n)})),t(this,"callSurveysAndEvaluateDisplayLogic",(function(){var e,n=arguments.length>0&&void 0!==arguments[0]&&arguments[0];null===(e=o.posthog)||void 0===e||e.getActiveMatchingSurveys((e=>{var n=e.filter((e=>"api"!==e.type));o.sortSurveysByAppearanceDelay(n).forEach((e=>{if(te(o.surveyInFocus)){var n,t,r;if(e.type===d.Widget)"tab"===(null===(n=e.appearance)||void 0===n?void 0:n.widgetType)&&0===Rn.querySelectorAll(".PostHogWidget".concat(e.id)).length&&o.handleWidget(e),"selector"===(null===(t=e.appearance)||void 0===t?void 0:t.widgetType)&&null!==(r=e.appearance)&&void 0!==r&&r.widgetSelector&&o.handleWidgetSelector(e);e.type===d.Popover&&o.canShowNextEventBasedSurvey()&&o.handlePopoverSurvey(e)}}))}),n)})),t(this,"addSurveyToFocus",(e=>{te(this.surveyInFocus)||Bn.error("Survey ".concat([...this.surveyInFocus]," already in focus. Cannot add survey ").concat(e,".")),this.surveyInFocus=e})),t(this,"removeSurveyFromFocus",(e=>{this.surveyInFocus!==e&&Bn.error("Survey ".concat(e," is not in focus. Cannot remove survey ").concat(e,".")),this.clearSurveyTimeout(e),this.surveyInFocus=null})),this.posthog=e,this.surveyInFocus=null}clearSurveyTimeout(e){var n=this.surveyTimeouts.get(e);n&&(clearTimeout(n),this.surveyTimeouts.delete(e))}sortSurveysByAppearanceDelay(e){return e.sort(((e,n)=>{var t,o;return((null===(t=e.appearance)||void 0===t?void 0:t.surveyPopupDelaySeconds)||0)-((null===(o=n.appearance)||void 0===o?void 0:o.surveyPopupDelaySeconds)||0)}))}getTestAPI(){return{addSurveyToFocus:this.addSurveyToFocus,removeSurveyFromFocus:this.removeSurveyFromFocus,surveyInFocus:this.surveyInFocus,surveyTimeouts:this.surveyTimeouts,canShowNextEventBasedSurvey:this.canShowNextEventBasedSurvey,handleWidget:this.handleWidget,handlePopoverSurvey:this.handlePopoverSurvey,handleWidgetSelector:this.handleWidgetSelector,sortSurveysByAppearanceDelay:this.sortSurveysByAppearanceDelay}}}function $n(e){if(Rn&&On){var n=new jn(e);return n.callSurveysAndEvaluateDisplayLogic(!0),setInterval((()=>{n.callSurveysAndEvaluateDisplayLogic(!1)}),1e3),n}}function Un(e){var{survey:n,removeSurveyFromFocus:t,setSurveyVisible:o,isPreviewMode:r=!1}=e;Je((()=>{var e;if(!r&&null!==(e=n.conditions)&&void 0!==e&&e.url){var i=()=>{if(!Ie(n))return o(!1),t(n.id)};Me(On,"popstate",i),Me(On,"hashchange",i);var a=On.history.pushState,l=On.history.replaceState;return On.history.pushState=function(){for(var e=arguments.length,n=new Array(e),t=0;t{On.removeEventListener("popstate",i),On.removeEventListener("hashchange",i),On.history.pushState=a,On.history.replaceState=l}}}),[r,n,t,o])}function zn(e){var t,o,r,i,a,l,{survey:s,forceDisableHtml:u,posthog:c,style:d,previewPageIndex:p,removeSurveyFromFocus:v,isPopup:_,onPreviewSubmit:h=(()=>{}),onPopupSurveyDismissed:f=(()=>{}),onCloseConfirmationMessage:g=(()=>{})}=e,m=Number.isInteger(p),y=null!==(t=s.appearance)&&void 0!==t&&t.surveyPopupDelaySeconds?1e3*s.appearance.surveyPopupDelaySeconds:0,{isPopupVisible:b,isSurveySent:C,setIsPopupVisible:w}=function(e,n,t,o,r){var[i,a]=Xe(o||0===t),[l,s]=Xe(!1);return Je((()=>{if(n){if(!o){var i=()=>{r(e.id),a(!1)},l=()=>{var n,t;null!==(n=e.appearance)&&void 0!==n&&n.displayThankYouMessage?(s(!0),r(e.id),null!==(t=e.appearance)&&void 0!==t&&t.autoDisappear&&setTimeout((()=>{a(!1)}),5e3)):(r(e.id),a(!1))},u=()=>{var t;Ie(e)&&(a(!0),On.dispatchEvent(new Event("PHSurveyShown")),n.capture("survey shown",{$survey_name:e.name,$survey_id:e.id,$survey_iteration:e.current_iteration,$survey_iteration_start_date:e.current_iteration_start_date,sessionRecordingUrl:null===(t=n.get_session_replay_url)||void 0===t?void 0:t.call(n)}),localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString()),setTimeout((()=>{var n,t,o=null===(n=Rn.querySelector(Qn(e.id)))||void 0===n||null===(t=n.shadowRoot)||void 0===t?void 0:t.querySelector('textarea, input[type="text"]');o&&o.focus()}),100))};if(Me(On,"PHSurveyClosed",i),Me(On,"PHSurveySent",l),t>0){var c=setTimeout(u,t);return()=>{clearTimeout(c),On.removeEventListener("PHSurveyClosed",i),On.removeEventListener("PHSurveySent",l)}}return u(),()=>{On.removeEventListener("PHSurveyClosed",i),On.removeEventListener("PHSurveySent",l)}}}else Bn.error("usePopupVisibility hook called without a PostHog instance.")}),[]),Un({survey:e,removeSurveyFromFocus:r,setSurveyVisible:a,isPreviewMode:o}),{isPopupVisible:i,isSurveySent:l,setIsPopupVisible:a}}(s,c,y,m,v),x=C||p===s.questions.length,S=null!==(o=d)&&void 0!==o&&o.left&&oe(null===(r=d)||void 0===r?void 0:r.left)?{left:d.left-40}:{};return m&&((d=d||{}).left="unset",d.right="unset",d.transform="unset"),b?vn(qe.Provider,{value:{isPreviewMode:m,previewPageIndex:p,onPopupSurveyDismissed:()=>{be(s,c,m),f()},isPopup:_||!1,onPreviewSubmit:h},children:x?vn(Tn,{header:(null===(i=s.appearance)||void 0===i?void 0:i.thankYouMessageHeader)||"Thank you!",description:(null===(a=s.appearance)||void 0===a?void 0:a.thankYouMessageDescription)||"",forceDisableHtml:!!u,contentType:null===(l=s.appearance)||void 0===l?void 0:l.thankYouMessageDescriptionContentType,appearance:s.appearance||ge,styleOverrides:n(n({},d),S),onClose:()=>{w(!1),g()}}):vn(Yn,{survey:s,forceDisableHtml:!!u,posthog:c,styleOverrides:d})}):null}function Yn(e){var t,o,{survey:r,forceDisableHtml:i,posthog:a,styleOverrides:l}=e,s=fe((null===(t=r.appearance)||void 0===t?void 0:t.backgroundColor)||ge.backgroundColor),[u,c]=Xe({}),{previewPageIndex:d,onPopupSurveyDismissed:p,isPopup:_,onPreviewSubmit:h}=nn(qe),[f,g]=Xe(d||0),m=en((()=>xe(r)),[r]);Je((()=>{g(null!=d?d:0)}),[d]);return vn("form",{className:"survey-form",style:_?n({color:s,borderColor:null===(o=r.appearance)||void 0===o?void 0:o.borderColor},l):{},children:m.map(((e,t)=>{var o;return f===t&&vn("div",{className:"survey-box",style:_?{backgroundColor:(null===(o=r.appearance)||void 0===o?void 0:o.backgroundColor)||ge.backgroundColor}:{},children:[_&&vn(kn,{onClick:()=>{p()}}),Xn({question:e,forceDisableHtml:i,displayQuestionIndex:t,appearance:r.appearance||ge,onSubmit:o=>(e=>{var{res:t,displayQuestionIndex:o,questionId:i}=e;if(a)if(i){var l=function(e){return"$survey_response_".concat(e)}(i);c(n(n({},u),{},{[l]:t}));var s=Wn(r,o,t);s===v.End?ye(n(n({},u),{},{[l]:t}),r,a):g(s)}else Bn.error("onNextButtonClick called without a questionId.");else Bn.error("onNextButtonClick called without a PostHog instance.")})({res:o,displayQuestionIndex:t,questionId:e.id}),onPreviewSubmit:h})]})}))})}function Gn(e){var t,o,{survey:r,forceDisableHtml:i,posthog:a,readOnly:l,removeSurveyFromFocus:s}=e,[u,c]=Xe(!0),[d,p]=Xe(!1),[v,_]=Xe({}),h=Ke(null);if(Je((()=>{var e,t;if(a){if(!l){if("tab"===(null===(e=r.appearance)||void 0===e?void 0:e.widgetType)&&h.current){var o,i=h.current.getBoundingClientRect(),s={top:"50%",left:parseInt("".concat(i.right-360)),bottom:"auto",borderRadius:10,borderBottom:"1.5px solid ".concat((null===(o=r.appearance)||void 0===o?void 0:o.borderColor)||"#c9c6c6")};_(s)}if("selector"===(null===(t=r.appearance)||void 0===t?void 0:t.widgetType)){var u,c=null!==(u=Rn.querySelector(r.appearance.widgetSelector||""))&&void 0!==u?u:void 0;Me(c,"click",(e=>{var t,o=e.currentTarget.getBoundingClientRect(),i=On.innerHeight,a=On.innerWidth,l=parseInt((null===(t=r.appearance)||void 0===t?void 0:t.maxWidth)||"300"),s=o.left+o.width/2-l/2;s+l>a-20&&(s=a-l-20),s<20&&(s=20);var u=i-o.bottom,c=o.top,v=u<250&&c>u;_((e=>{var t;return n(n({},e),{},{position:"fixed",top:v?"auto":o.bottom+12+"px",left:s+"px",right:"auto",bottom:v?i-o.top+12+"px":"auto",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",borderBottom:"1.5px solid ".concat((null===(t=r.appearance)||void 0===t?void 0:t.borderColor)||"#c9c6c6"),borderRadius:"10px",zIndex:pe})})),p(!d),e.stopPropagation()})),null==c||c.setAttribute("PHWidgetSurveyClickListener","true")}}}else Bn.error("FeedbackWidget called without a PostHog instance.")}),[]),Un({survey:r,removeSurveyFromFocus:s,setSurveyVisible:c}),!u)return null;var f=()=>{p(!1)};return vn(S,{children:["tab"===(null===(t=r.appearance)||void 0===t?void 0:t.widgetType)&&vn("div",{className:"ph-survey-widget-tab",ref:h,onClick:()=>!l&&p(!d),style:{color:fe(r.appearance.widgetColor)},children:[vn("div",{className:"ph-survey-widget-tab-icon"}),(null===(o=r.appearance)||void 0===o?void 0:o.widgetLabel)||""]}),d&&vn(zn,{posthog:a,survey:r,forceDisableHtml:i,style:v,removeSurveyFromFocus:s,isPopup:!0,onPopupSurveyDismissed:f,onCloseConfirmationMessage:f},"feedback-widget-survey")]})}var Xn=e=>{var{question:t,forceDisableHtml:o,displayQuestionIndex:r,appearance:i,onSubmit:a,onPreviewSubmit:l}=e,s={[p.Open]:Pn,[p.Link]:Hn,[p.Rating]:En,[p.SingleChoice]:Fn,[p.MultipleChoice]:Fn},u={question:t,forceDisableHtml:o,appearance:i,onPreviewSubmit:e=>{l(e)},onSubmit:e=>{a(e)}},c={[p.Open]:{},[p.Link]:{},[p.Rating]:{displayQuestionIndex:r},[p.SingleChoice]:{displayQuestionIndex:r},[p.MultipleChoice]:{displayQuestionIndex:r}},d=s[t.type],v=n(n({},u),c[t.type]);return vn(d,n({},v))};X.__PosthogExtensions__=X.__PosthogExtensions__||{},X.__PosthogExtensions__.canActivateRepeatedly=Se,X.__PosthogExtensions__.generateSurveys=$n,X.extendPostHogWithSurveys=$n}(); //# sourceMappingURL=surveys.js.map