userflow.js-self-hosted 0.1.1021329 → 0.1.1021425

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/DebuggerUI.js CHANGED
@@ -1,3 +1,3 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["flow-condition-types.js","userflow.js","vendor.core-js.js","vendor.phoenix.js","vendor.uuid.js","vendor.date-fns.js","vendor.babel.runtime.js","roots.js"])))=>i.map(i=>d[i]);
2
- import{r as i,R as e}from"./vendor.react.js";import{r as ue}from"./vendor.react-dom.js";import{u as P,U as Re}from"./client-context.js";import{d as ne,a as F,b as O,c as A,e as H,f as d,A as de,W as T,g as U,h as N,S as Ue,i as Ae,_ as Me,j as ke}from"./userflow.js";import{F as Ve}from"./Frame.js";import{S as He}from"./logomark.js";import{c as M,d as Be,e as re,g as Ee,h as I,i as qe,j as he,k as se,l as Ge,m as We,n as be,o as je,p as ze,q as L,a as D,r as Ye,s as ve,t as Xe,u as Ke,v as $e,w as Ze,x as Qe,y as Je,z as k,A as et,B as _e,C as tt,f as nt,D as rt,E as st,F as at,G as ot,H as lt,I as $,J as it}from"./vendor.fortawesome.pro-regular-svg-icons.js";import{a as ct,b as ut}from"./vendor.fortawesome.pro-solid-svg-icons.js";import{D as m}from"./stylesheets.js";import{o as g}from"./vendor.obj-str.js";import"./vendor.core-js.js";import{_ as ee,l as we}from"./vendor.lodash.js";import{F as G}from"./vendor.fortawesome.react-fontawesome.js";import{P as ye}from"./Popover.js";import"./vendor.react-day-picker.js";import{f as ae,p as dt,a as mt}from"./vendor.date-fns.js";import{a as j}from"./react-hooks.js";import{m as pt}from"./vendor.memoize-one.js";import{c as gt}from"./roots.js";import"./vendor.object-assign.js";import"./vendor.scheduler.js";import"./vendor.i18next.js";import"./vendor.babel.runtime.js";import"./vendor.react-i18next.js";import"./vendor.phoenix.js";import"./vendor.uuid.js";import"./iframe-reset.styl.js";import"./flow-condition-types.js";import"./vendor.fortawesome.fontawesome-svg-core.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},n=new Error().stack;n&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[n]="9b32e53e-e6e2-4c9a-b14c-dd1308c63f1b",t._sentryDebugIdIdentifier="sentry-dbid-9b32e53e-e6e2-4c9a-b14c-dd1308c63f1b")}catch{}})();const ft=new URL("debugger.css",import.meta.url).href,Ce=i.createContext(void 0),S=()=>i.useContext(Ce),Ne=i.createContext(null),oe=()=>i.useContext(Ne),xe=i.createContext({debuggerClientConditions:new Map,meta:void 0,buildId:void 0}),V=()=>i.useContext(xe),B={verifySetup:{name:"Verify setup",icon:M},checkAutoStart:{name:"Check auto-start",icon:Be},currentUser:{name:"Current user",icon:re}},Se=i.createContext(void 0),Et=({children:t})=>{const n=P(),[s,r]=i.useState(n.getSessionStorageState().debuggerApp?.selectedTab??"verifySetup");return i.useEffect(()=>{n.setSessionStorageState(a=>!a.debuggerApp||!a.debuggerApp.x?a:{...a,debuggerApp:{...a.debuggerApp,selectedTab:s}}),ne("Debugger Route changed to",s)},[s]),e.createElement(Se.Provider,{value:{debuggerRoute:s,setDebuggerRoute:r}},t)},le=()=>{const t=i.useContext(Se);if(t===void 0)throw new Error("useDebuggerRouteHandler must be used within a DebuggerRouteProvider");return{debuggerRoute:t.debuggerRoute,setDebuggerRoute:t.setDebuggerRoute}},ht=t=>{const n=i.useRef(null),s=oe();return i.useEffect(()=>{const r=s?.current,a=o=>{n.current&&!n.current.contains(o.target)&&t(o)};return document.addEventListener("mousedown",a),r?.contentDocument?.addEventListener("mousedown",a),()=>{document.removeEventListener("mousedown",a),r?.contentDocument?.removeEventListener("mousedown",a)}},[t,s,n]),n},bt=()=>e.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M18.4393 5.56066C18.158 5.27936 18 4.89782 18 4.5C18 4.10218 18.158 3.72064 18.4393 3.43934C18.7206 3.15804 19.1022 3 19.5 3C19.8978 3 20.2794 3.15804 20.5607 3.43934C20.842 3.72064 21 4.10218 21 4.5C21 4.89782 20.842 5.27936 20.5607 5.56066C20.2794 5.84196 19.8978 6 19.5 6C19.1022 6 18.7206 5.84196 18.4393 5.56066Z",fill:"#537388"}),e.createElement("path",{d:"M3.43934 5.56066C3.15804 5.27936 3 4.89782 3 4.5C3 4.10218 3.15804 3.72064 3.43934 3.43934C3.72064 3.15804 4.10218 3 4.5 3C4.89782 3 5.27936 3.15804 5.56066 3.43934C5.84196 3.72064 6 4.10218 6 4.5C6 4.89782 5.84196 5.27936 5.56066 5.56066C5.27936 5.84196 4.89782 6 4.5 6C4.10218 6 3.72064 5.84196 3.43934 5.56066Z",fill:"#537388"}),e.createElement("path",{d:"M10.9393 13.0607C10.658 12.7794 10.5 12.3978 10.5 12C10.5 11.6022 10.658 11.2206 10.9393 10.9393C11.2206 10.658 11.6022 10.5 12 10.5C12.3978 10.5 12.7794 10.658 13.0607 10.9393C13.342 11.2206 13.5 11.6022 13.5 12C13.5 12.3978 13.342 12.7794 13.0607 13.0607C12.7794 13.342 12.3978 13.5 12 13.5C11.6022 13.5 11.2206 13.342 10.9393 13.0607Z",fill:"#537388"}),e.createElement("path",{d:"M3.43934 20.5607C3.15804 20.2794 3 19.8978 3 19.5C3 19.1022 3.15804 18.7206 3.43934 18.4393C3.72064 18.158 4.10218 18 4.5 18C4.89782 18 5.27936 18.158 5.56066 18.4393C5.84196 18.7206 6 19.1022 6 19.5C6 19.8978 5.84196 20.2794 5.56066 20.5607C5.27936 20.842 4.89782 21 4.5 21C4.10218 21 3.72064 20.842 3.43934 20.5607Z",fill:"#537388"}),e.createElement("path",{d:"M3.43934 13.0607C3.15804 12.7794 3 12.3978 3 12C3 11.6022 3.15804 11.2206 3.43934 10.9393C3.72064 10.658 4.10218 10.5 4.5 10.5C4.89782 10.5 5.27936 10.658 5.56066 10.9393C5.84196 11.2206 6 11.6022 6 12C6 12.3978 5.84196 12.7794 5.56066 13.0607C5.27936 13.342 4.89782 13.5 4.5 13.5C4.10218 13.5 3.72064 13.342 3.43934 13.0607Z",fill:"#537388"}),e.createElement("path",{d:"M10.9393 5.56066C10.658 5.27936 10.5 4.89782 10.5 4.5C10.5 4.10218 10.658 3.72064 10.9393 3.43934C11.2206 3.15804 11.6022 3 12 3C12.3978 3 12.7794 3.15804 13.0607 3.43934C13.342 3.72064 13.5 4.10218 13.5 4.5C13.5 4.89782 13.342 5.27936 13.0607 5.56066C12.7794 5.84196 12.3978 6 12 6C11.6022 6 11.2206 5.84196 10.9393 5.56066Z",fill:"#537388"})),vt={prefix:"far",iconName:"custom-hand-pointer-slash",icon:[641,512,[],"???","M185.554191,59.5126699 C189.248662,26.0794907 217.382589,0 251.429,0 C287.979,0 317.715,30.056 317.715,67 L317.715,140.634 C338.128,137.776 359.183,144.576 374.31,160.263 C401.503,147.416 434.689,154.593 454.182,179.361 C497.375,162.727 544,195.156 544,242 L544,326 C544,330.296189 543.590626,334.580726 542.780274,338.796073 L495.999,302.221942 L495.999,242 C495.999,216.84 459.428,216.879 459.428,242 C459.428,250.836 452.265,258 443.428,258 L439.435556,258 L420.622383,243.291649 C420.588346,242.865584 420.571,242.434817 420.571,242 L420.571,221 C420.571,197.943344 389.858993,196.049429 384.724023,215.225903 L269.713,125.308981 L269.713,67 C269.713,41.84 233.142,41.88 233.142,67 L233.142,96.717359 L185.554191,59.5126699 Z M162.172457,223.995642 L233.142,279.479508 L233.142,308.493 C233.142,324.063 213.106,330.402 204.111,317.776 L176.985,279.697 C162.585,259.485 133.185,282.08 147.591,302.303 L257.303,456.303 C260.737,461.122 266.231,464 272,464 L450.285,464 C455.041109,464 459.427079,462.119816 462.713129,458.957818 L500.616335,488.590478 C488.331086,503.061811 470.146238,512 450.286,512 L272,512 C250.741,512 230.632,501.59 218.209,484.154 L108.51,330.153 C87.267,300.334 93.705,258.796 123.06,237.001 C134.952446,228.171597 148.664261,223.998532 162.172457,223.995642 Z M272.143,309.970422 L306.143,336.551563 L306.143,400 C306.143,408.837 299.875,416 292.143,416 L286.143,416 C278.41,416 272.143,408.837 272.143,400 L272.143,309.970422 Z M347.571,368.939901 L381.571,395.521042 L381.571,400 C381.571,408.837 375.303,416 367.571,416 L361.571,416 C353.839,416 347.571,408.837 347.571,400 L347.571,368.939901 Z M633.994211,471.020009 C640.904211,476.540009 642.014211,486.610009 636.494211,493.510009 L626.494211,506 C620.964211,512.890009 610.904211,514.010009 604.004211,508.490009 L6.00421069,40.9800088 C-0.895789309,35.4600088 -2.01578931,25.3900088 3.51421069,18.4900088 L13.5142107,6 C19.0342107,-0.899991212 29.1042107,-2.00999121 36.0042107,3.51000879 L633.994211,471.020009 Z"]},_t={CLICK:Ee,DISABLED:I,MOUSEDOWN:qe,NOT_CLICK:vt,NOT_DISABLED:M,NOT_PRESENT:he,PRESENT:se},wt={COMPLETED:M,NOT_COMPLETED:I,NOT_SEEN:he,ACTIVE:Ge,NOT_ACTIVE:We,SEEN:se},yt={CLICK:"is clicked",DISABLED:"is disabled",MOUSEDOWN:"has mouse down on it",NOT_CLICK:"is not clicked",NOT_DISABLED:"is not disabled",NOT_PRESENT:"is not present",PRESENT:"is present"};function Ct(t){return yt[t]}const Nt={COMPLETED:"completed",NOT_COMPLETED:"not completed",NOT_SEEN:"not seen",ACTIVE:"is currently active",NOT_ACTIVE:"is not currently active",SEEN:"seen"};function xt(t){return Nt[t]}function St(t,n){let s=(n||"").toLowerCase();return(t.eventTimeOperator===O.RELATIVE_BETWEEN?t.eventRelativeValue2:t.eventRelativeValue)!==1&&(s+="s"),t.eventTimeOperator!==O.RELATIVE_GT&&(s+=" ago"),s}function Tt(t){return(t.eventFrequencyOperator===A.BETWEEN?t.eventFrequencyValue2:t.eventFrequencyValue)===1?"time":"times"}const Ot={CURRENT_USER:"by current user in any company",CURRENT_USER_CURRENT_GROUP:"by current user in current company",CURRENT_GROUP:"by any user in current company"};function Dt(t){return Ot[t]}function It(t){if(!t)return"";switch(t){case A.BETWEEN:return"between";case A.EQ:return"exactly";case A.GTE:return"at least";case A.LTE:return"at most"}}function Ft(t){if(!t)return"";switch(t){case O.ANY:return"at any point in time";case O.RELATIVE_BETWEEN:return"between";case O.RELATIVE_GT:return"in the last";case O.RELATIVE_LT:return"more than"}}const Lt={1:"Lowest",2:"Low",3:"Medium",4:"High",5:"Highest"};function Pt(t){return`${Lt[t]||String(t)} priority`}function te(t,n){switch(t){case H.DAY:return n===1?"day":"days";case H.HOUR:return n===1?"hour":"hours";case H.MINUTE:return n===1?"minute":"minutes";case H.SECOND:return n===1?"second":"seconds"}}function me(t){switch(t){case"USER":return re;case"GROUP":return ze;case"GROUP_MEMBERSHIP":return je;case"EVENT":return be}}function Rt(t){const n=t.split("/");if(n.length===1)return["USER",t];switch(n[0]){case"group":return["GROUP",n[1]];case"group_membership":return["GROUP_MEMBERSHIP",n[1]];case"event":return["EVENT",n[1]]}return console.warn("parseAttributeDefinitionFqn: Invalid attribute definition FQN",t),["USER",t]}const Ut={[F.BANNER]:"banner",[F.CHECKLIST]:"checklist",[F.FLOW]:"flow",[F.EMBED]:"embed",[F.LAUNCHER]:"launcher",[F.RESOURCE_CENTER]:"resource center"};function At(t,{title:n,plural:s}={}){let r=Ut[t];return n&&(r=ee.upperFirst(r)),s&&(r+="s"),r}const Mt=["yyyy-MM-dd","yyyy/MM/dd","MM-dd yyyy","MM/dd yyyy","MM-dd-yyyy","MM/dd/yyyy","MM-dd","MM/dd","dd MMM yyyy","dd MMMM yyyy","MMM dd yyyy","MMMM dd yyyy","dd MMM","dd MMMM","MMM dd","MMMM dd"],kt=["hh:mmaaa","hh.mmaaa","hh:mm aaa","hh.mm aaa","HH:mm","HH.mm","hhaaa","hh aaa","HH"];for(const t of Mt)for(const n of kt);const Vt="d MMM yyyy";function pe(t){if(t==null)return"";const n=Bt?t.getMinutes()===0?"h aaa":"h:mm aaa":"HH:mm";return ae(t,Vt+", "+n)}function Ht(t){if(!t)return null;const n=dt(t,"yyyy-MM-dd",new Date);return isNaN(n.valueOf())?null:n}function ge(t){if(!t)return null;const n=mt(t);return isNaN(n.valueOf())?null:n}const Bt=Intl.DateTimeFormat(Intl.DateTimeFormat().resolvedOptions().locale,{hour:"numeric"}).resolvedOptions().hourCycle==="h12";var Te=(t=>(t.EVENT="EVENT",t.GROUP="GROUP",t.GROUP_MEMBERSHIP="GROUP_MEMBERSHIP",t.USER="USER",t))(Te||{});function fe(t){return({condition:n})=>{throw new Error(`conditionOperators.${n.operator}.${t} is not supported`)}}const Z={[d.ABSOLUTE_EQ]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"on")," ",e.createElement("span",{className:"nowrap text-bold"},J(t.value)))},[d.ABSOLUTE_GT]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"after")," ",e.createElement("span",{className:"nowrap text-bold"},J(t.value)))},[d.ABSOLUTE_LT]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"before")," ",e.createElement("span",{className:"nowrap text-bold"},J(t.value)))},[d.AND]:{Preview:fe("Preview")},[d.BETWEEN]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"is between")," ",e.createElement("b",null,t.value)," ",e.createElement("span",{className:"text-secondary"},"and")," ",e.createElement("b",null,t.value2))},[d.CONTAINS]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"contains")," ",e.createElement("b",null,t.value))},[d.EMPTY]:{Preview:()=>e.createElement("span",{className:"text-secondary"},"is empty")},[d.ENDS_WITH]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"ends with")," ",e.createElement("b",null,t.value))},[d.EQ]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"is")," ",e.createElement("b",null,t.dataType===de.FLOW&&t.value?e.createElement("span",null,t?.eventDisplayName??t.eventName):t.value))},[d.EXCLUDES_ALL]:{Preview:({condition:t})=>q(t,"does not include","all of")},[d.EXCLUDES_ANY]:{Preview:({condition:t})=>q(t,"does not include","at least one of")},[d.FALSE]:{Preview:()=>e.createElement("span",{className:"text-secondary"},"is false")},[d.GT]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"is greater than")," ",e.createElement("b",null,t.value))},[d.GTE]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"is greater than or equal to")," ",e.createElement("b",null,t.value))},[d.INCLUDES_ALL]:{Preview:({condition:t})=>q(t,"includes","all of")},[d.INCLUDES_ANY]:{Preview:({condition:t})=>q(t,"includes","at least one of")},[d.LT]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"is less than")," ",e.createElement("b",null,t.value))},[d.LTE]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"is less than or equal to")," ",e.createElement("b",null,t.value))},[d.NE]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"is not")," ",e.createElement("b",null,t.dataType===de.FLOW&&t.value?e.createElement("span",null," ",t?.eventDisplayName??t.eventName):t.value))},[d.NOT_CONTAINS]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"does not contain")," ",e.createElement("b",null,t.value))},[d.NOT_EMPTY]:{Preview:()=>e.createElement("span",{className:"text-secondary"},"has any value")},[d.NOT_REGEX]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"does not match")," ",e.createElement("b",null,t.value))},[d.OR]:{Preview:fe("Preview")},[d.REGEX]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"matches")," ",e.createElement("b",null,t.value))},[d.RELATIVE_EQ]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"exactly")," ",e.createElement("span",{className:"nowrap text-bold"},Q(t.value))," ",e.createElement("span",{className:"text-secondary"},"ago"))},[d.RELATIVE_GT]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"less than")," ",e.createElement("span",{className:"nowrap text-bold"},Q(t.value))," ",e.createElement("span",{className:"text-secondary"},"ago"))},[d.RELATIVE_LT]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"more than")," ",e.createElement("span",{className:"nowrap text-bold"},Q(t.value))," ",e.createElement("span",{className:"text-secondary"},"ago"))},[d.STARTS_WITH]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"starts with")," ",e.createElement("b",null,t.value))},[d.TRUE]:{Preview:()=>e.createElement("span",{className:"text-secondary"},"is true")},[d.URL]:{Preview:({condition:t})=>{const{urlPattern:n}=t;if(!n)return e.createElement("span",{className:"text-secondary"},"matches ...");const{includes:s,excludes:r}=n;return e.createElement(e.Fragment,null,s.length>0&&e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"matches")," ",s.map((a,o)=>e.createElement(e.Fragment,{key:o},o>0&&e.createElement("span",{className:"text-secondary"},", "),e.createElement("b",null,a)))),s.length>0&&r.length>0&&e.createElement("span",{className:"text-secondary"}," and "),r.length>0&&e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"does not match")," ",r.map((a,o)=>e.createElement(e.Fragment,{key:o},o>0&&e.createElement("span",{className:"text-secondary"},", "),e.createElement("b",null,a)))))}}};function qt(t){return parseInt(t,10)}function Q(t){if(!t)return"days";const n=qt(t);return isNaN(n)?"days":n+" "+(n===1?"day":"days")}function J(t){if(!t)return"";const n=Ht(t);return n?ae(n,"PP"):""}function q(t,n,s){const r=t.values||[];return e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},n+(r.length>1?" "+s:""))," ",r.map((a,o)=>e.createElement(e.Fragment,{key:o},o>0&&e.createElement("span",{className:"text-secondary"},", "),e.createElement("b",{key:o},a))))}const ie=t=>({"d-flex align-center":!0,"userflow-debugger-condition__item":!0,"userflow-debugger-condition__item__success":t===!0,"userflow-debugger-condition__item__danger":t===!1,"userflow-debugger-condition__item__intermediate":t===null}),ce=t=>t===!0?D:t===!1?I:L,Oe=(t,n)=>{const s=S();return i.useMemo(()=>{const o=(n?s?.hiddenCondition?.breakdown:s?.startCondition?.breakdown)?.find(l=>l.conditionId===t.id);return{classes:ie(o?.match),icon:ce(o?.match)}},[t,s,n])},W=t=>{const{condition:n,isHideCond:s}=t,{classes:r,icon:a}=Oe(n,s),o=n.type;if(o===N.CLAUSE)return e.createElement(Wt,{...t});const l=Ie[o];return e.createElement("div",{className:g(r)},e.createElement("span",{className:"d-flex gap-8 align-center userflow-debugger-condition__item__icon"},l.icon?e.createElement(m,{icon:l.icon({condition:n})}):null,e.createElement(l.Preview,{...t})),e.createElement(m,{dataAttrs:{"data-condition-status":"true"},icon:a}))},Gt=()=>{const t=S(),[n,s]=i.useState(!1),r=i.useMemo(()=>t?.hiddenCondition?.breakdown.find(o=>o.conditionId===t?.hiddenCondition?.condition.id),[t?.hiddenCondition]);return t?.hiddenCondition?.condition?e.createElement("div",{role:"button",className:g({"d-flex gap-8 flex-column margin-8":!0,"userflow-debugger-condition__clause":!0,"userflow-debugger-hide-condition__clause__success":r?.match===!0,"userflow-debugger-hide-condition__clause__danger":r?.match===!1,"userflow-debugger-hide-condition__clause__expanded":n}),onClick:a=>{s(!n),a.stopPropagation()}},e.createElement("div",{className:"d-flex gap-8 justify-space-between align-center"},e.createElement("span",null,"Termporarily hide flow"," ",e.createElement("span",{className:"userflow-debugger-info-text"},"Click to ",n?"collapse":"expand")),e.createElement(m,{icon:k})),n&&e.createElement(W,{isRoot:!0,isHideCond:!0,condition:t?.hiddenCondition?.condition})):null},Wt=({condition:t,isRoot:n=!1,isHideCond:s=!1})=>{const[r,a]=i.useState(!1),{classes:o,icon:l}=Oe(t,s);return n?e.createElement(e.Fragment,null,t.conditions.map((c,p)=>e.createElement(W,{isHideCond:s,key:p,condition:c}))):e.createElement("div",{role:"button",className:g({"d-flex flex-column gap-8":!0,"userflow-debugger-condition__clause":r,...r?{"userflow-debugger-condition__item__success__expanded":o["userflow-debugger-condition__item__success"],"userflow-debugger-condition__item__danger__expanded":o["userflow-debugger-condition__item__danger"],"userflow-debugger-condition__item__intermediate__expanded":o["userflow-debugger-condition__item__intermediate"]}:o}),onClick:c=>{a(!r),c.stopPropagation()}},e.createElement("div",{className:"d-flex justify-space-between align-center w-full"},e.createElement("span",{className:"d-flex gap-8 align-center"},e.createElement(m,{icon:et})," ",e.createElement("strong",null,"Logic Group")," ",e.createElement("span",{className:"userflow-debugger-info-text"},"Click to ",r?"collapse":"expand")),!r&&e.createElement(m,{dataAttrs:{"data-condition-status":"true"},icon:l})),r&&e.createElement(e.Fragment,null,t.conditions.map((c,p)=>e.createElement("div",{key:p,className:g({"userflow-debugger-condition__clause__operator__wrapper":!0})},p>0&&e.createElement("div",{className:g({"userflow-debugger-condition__clause__operator":!0})},e.createElement(De,{condition:t})),e.createElement(W,{isHideCond:s,condition:c})))))},De=({condition:t})=>{const n=t.operator;return n?e.createElement("span",{className:g({"userflow-debugger-condition__item__operator":!0,"userflow-debugger-condition__item__operator__and":n===d.AND,"userflow-debugger-condition__item__operator__or":n===d.OR})},n===d.AND&&"AND",n===d.OR&&"OR"):null},jt={[T.NONE]:I,[T.PENDING_SCHEDULE]:I,[T.SCHEDULED]:L,[T.FIRED]:D},zt=e.memo(()=>{const t=S(),{waitTimer:n}=t||{},s=t?.startCondition?.condition.waitTime,{ref:r,hovered:a,eventHandlers:o}=j();return!s||!n||n===T.NONE?null:e.createElement("div",{ref:r,...o,className:g({"d-flex align-center":!0,"userflow-debugger-condition__item":!0,"userflow-debugger-condition__item__danger":n===T.PENDING_SCHEDULE,"userflow-debugger-condition__item__intermediate":n===T.SCHEDULED,"userflow-debugger-condition__item__success":n===T.FIRED})},e.createElement("span",{className:"d-flex gap-8 align-center"},e.createElement(m,{icon:Ye}),e.createElement("span",null,"Wait ",e.createElement("strong",null,s)," seconds")),e.createElement(m,{dataAttrs:{"data-condition-status":"true"},icon:jt[n]}),e.createElement(z,{target:r,hovered:a&&n===T.PENDING_SCHEDULE},"Timer activates once all conditions are satisfied"))}),Yt=e.memo(()=>{const t=S(),[n,s]=i.useState(!1),{startFrequency:r,listFlowLatestVersion:a}=t||{startFrequency:{}};if(!r||!a?.startFrequency||a?.startFrequency===U.NEVER)return null;const{currentFlowIntervalThrottle:o,frequency:l,frequencyUsage:c}=r,p=ce(l),_=ie(l);if(a.startFrequency===U.ONCE||a.startFrequency===U.ONCE_PER_GROUP)return e.createElement("div",{className:g(_)},e.createElement("span",{className:"d-flex gap-8 align-center"},e.createElement(m,{icon:ve}),e.createElement("strong",null,"Once per user"," ",a.startFrequency===U.ONCE_PER_GROUP&&"per company")),e.createElement(m,{dataAttrs:{"data-condition-status":"true"},icon:p}));if(a.startFrequency===U.ALWAYS&&a.startIntervalValue&&a.startIntervalUnit)return e.createElement("div",{className:g({"d-flex align-center":!0,"userflow-debugger-condition__item":!0,"userflow-debugger-condition__item__success":o===!0,"userflow-debugger-condition__item__intermediate":o===!1})},e.createElement("span",null,"Every ",e.createElement("strong",null,a.startIntervalValue)," ",e.createElement("span",{className:"userflow-debugger-info-text"},te(a.startIntervalUnit,a.startIntervalValue)," ","apart")),e.createElement(m,{dataAttrs:{"data-condition-status":"true"},icon:o===!1?L:D}));if(a.startFrequency===U.MULTIPLE){const E=l===!0&&o===!0,h=l===!0&&o===!1,x=l===!1;return e.createElement("div",{className:g({"d-flex flex-column gap-8":!0,"userflow-debugger-condition__item":!0,"userflow-debugger-condition__clause":n,...n?{"userflow-debugger-condition-frequency__success__expanded":E,"userflow-debugger-condition-frequency__intermediate__expanded":h,"userflow-debugger-condition-frequency__danger__expanded":x}:{"userflow-debugger-condition-frequency__success":E,"userflow-debugger-condition-frequency__intermediate":h,"userflow-debugger-condition-frequency__danger":x}}),onClick:C=>{s(!n),C.stopPropagation()}},e.createElement("div",{className:"d-flex gap-8 justify-space-between"},e.createElement("div",{className:"d-flex gap-8 align-center"},e.createElement("strong",null,"Start multiple times")," ",e.createElement("span",{className:"userflow-debugger-info-text"},"Click to expand")),!n&&e.createElement(m,{dataAttrs:{"data-condition-status":"true"},icon:E?D:h?L:I})),n&&e.createElement(e.Fragment,null,e.createElement("div",{className:g(_)},e.createElement("span",null,e.createElement("strong",null,a.startLimit)," ",e.createElement("span",{className:"userflow-debugger-info-text"},"(started ",c," times)")),e.createElement(m,{dataAttrs:{"data-condition-status":"true"},icon:p})),a.startIntervalUnit&&a.startIntervalValue&&e.createElement("div",{className:g({"d-flex align-center":!0,"userflow-debugger-condition__item":!0,"userflow-debugger-condition__item__success":o===!0,"userflow-debugger-condition__item__intermediate":o===!1})},e.createElement("span",null,e.createElement("strong",null,a.startIntervalValue)," ",e.createElement("span",{className:"userflow-debugger-info-text"},te(a.startIntervalUnit,a.startIntervalValue)," ","apart")),e.createElement(m,{dataAttrs:{"data-condition-status":"true"},icon:o===!1?L:D}))))}return null}),Xt=()=>{const t=S(),{priority:n}=t||{};return n?.priority?e.createElement("div",{className:g({"d-flex align-center":!0,"userflow-debugger-condition__item":!0,"userflow-debugger-condition__item__priority":!0})},e.createElement("span",null,e.createElement("strong",null,Pt(n?.priority))," ",e.createElement("span",{className:"userflow-debugger-info-text"},"Click to learn more")),e.createElement("a",{href:"https://docs.userflow.com/docs/trouble/using-the-debugger#flow-trigger-precedence",target:"_blank",rel:"noreferrer noopener"},e.createElement(m,{icon:_e}))):null},Kt=()=>{const t=S(),{startFrequency:n}=t||{},{onlyIfNotCompleted:s}=n||{};return s==null?null:e.createElement("div",{className:g({"d-flex align-center":!0,"userflow-debugger-condition__item":!0,"userflow-debugger-condition__item__success":s===!0,"userflow-debugger-condition__item__danger":s===!1})},"Only if not completed",e.createElement(m,{icon:s===!0?D:I}))},$t=()=>{const t=S(),{startFrequency:n}=t||{},{hovered:s,eventHandlers:r,ref:a}=j();return!n||n?.scopeByGroup===null||n.scopeByGroup===void 0||n.scopeByGroup===!0?null:e.createElement("div",{ref:a,...r,className:g({"d-flex align-center margin-8":!0,"userflow-debugger-condition__item":!0,"userflow-debugger-condition__item__danger":!0})},"Constrain to current company",e.createElement(m,{icon:ce(n.scopeByGroup)}),e.createElement(z,{target:a,hovered:s},"User is not associated with a company"))},Zt=()=>{const t=S(),{startFrequency:n,listFlowLatestVersion:s}=t||{},{anyFlowIntervalThrottle:r}=n||{},{throttleUnit:a,throttleValue:o}=s||{};return r===null||a===null||o===null||a===void 0||o===void 0?null:e.createElement("div",{className:g({"d-flex align-center":!0,"userflow-debugger-condition__item":!0,"userflow-debugger-condition__item__success":r===!0,"userflow-debugger-condition__item__intermediate":r===!1})},e.createElement("span",null,"Atleast ",e.createElement("strong",null,s?.throttleValue)," ",te(a,o)," after any flow"),e.createElement(m,{dataAttrs:{"data-condition-status":"true"},icon:r===!0?D:L}))},Qt=e.memo(()=>{const{hovered:t,eventHandlers:n,ref:s}=j(),r=S(),{snoozed:a}=r||{},o=i.useMemo(()=>{if(a?.until)return ae(new Date(a.until),"MMM do, h:mm a")},[a?.until]);return a?e.createElement("div",{ref:s,...n,className:g({"d-flex align-center margin-8":!0,"userflow-debugger-condition__item":!0,"userflow-debugger-condition__item__intermediate":!0})},e.createElement("span",{className:"d-flex gap-8 align-center"},e.createElement(m,{icon:Xe}),e.createElement("span",null,"This flow is currently ",e.createElement("strong",null,"snoozed"))),e.createElement(m,{dataAttrs:{"data-condition-status":"true"},icon:L}),e.createElement(z,{target:s,hovered:t},"Snoozed until ",o)):null}),Ie={[N.PAGE]:{icon:()=>Ke,Preview:({condition:t})=>{const n=t.operator&&Z[t.operator];return e.createElement("span",null,"URL"," ",e.createElement("strong",null,n&&e.createElement(n.Preview,{condition:t})))}},[N.ATTRIBUTE]:{icon:({condition:t})=>{if(!t||!t.attributeName)return me(Te.EVENT);const[n]=Rt(t.attributeName);return me(n)},Preview:({condition:t})=>{const n=t.operator&&Z[t.operator];return e.createElement("span",null,e.createElement("strong",null,t.attributeDisplayName?t.attributeDisplayName:"Attribute")," ",e.createElement("span",{className:"userflow-debugger-info-text"},n&&e.createElement(n.Preview,{condition:t})))}},[N.SEGMENT]:{icon:()=>$e,Preview:({condition:t})=>{const{segment:n}=t;return e.createElement("span",null,e.createElement("strong",null,n?.subjectType===Ue.GROUP?"Company":"User")," ",e.createElement("span",{className:"text-secondary"},t.operator===d.FALSE?"is not in":"is in")," ",e.createElement("strong",null,n?.name||"Segment"))}},[N.ELEMENT]:{icon:({condition:t})=>t.elementState?_t[t.elementState]:Ze,Preview:({condition:t})=>e.createElement("span",null,"Element"," ",t.elementState&&e.createElement("strong",null,Ct(t.elementState)))},[N.INPUT_VALUE]:{icon:()=>Qe,Preview:({condition:t})=>{const n=t.operator&&Z[t.operator];return e.createElement("span",null,"The value of input"," ",e.createElement("strong",null,n&&e.createElement(n.Preview,{condition:t})))}},[N.FILLED_IN_INPUT]:{icon:()=>Je,Preview:()=>e.createElement("span",null,"User fills an input")},[N.FLOW]:{icon:({condition:t})=>t.flowState?wt[t.flowState]:se,Preview:({condition:t})=>t.flow?.type===F.SITE?null:e.createElement("span",null,t.flow?e.createElement(e.Fragment,null,At(t.flow.type,{title:!0})," ",e.createElement("strong",null,t.flow.name)):"Flow/checklist"," ",t.flowState&&xt(t.flowState))},[N.TIME]:{icon:()=>ve,Preview:({condition:t})=>{const n=t.value?ge(t.value):null,s=n&&e.createElement("strong",{style:{whiteSpace:"nowrap"}},pe(n)),r=t.value2?ge(t.value2):null,a=r&&e.createElement("strong",{style:{whiteSpace:"nowrap"}},pe(r));return s&&a?e.createElement("span",null,"Current time is between ",s," and ",a):s?e.createElement(e.Fragment,null,"Current time is after ",s):a?e.createElement(e.Fragment,null,"Current time is before ",a):e.createElement(e.Fragment,null,"Current time is ...")}},[N.EVENT]:{icon:()=>be,Preview:({condition:t})=>{const{ref:n,hovered:s,eventHandlers:r}=j();return e.createElement("div",{ref:n,...r},e.createElement("strong",null,t.eventDisplayName?t.eventDisplayName:"Event")," ",e.createElement("span",{className:"userflow-debugger-info-text"},It(t.eventFrequencyOperator))," ",e.createElement("strong",null,t.eventFrequencyValue),t.eventFrequencyOperator===A.BETWEEN&&e.createElement(e.Fragment,null," ",e.createElement("span",{className:"userflow-debugger-info-text"},"and")," ",e.createElement("strong",null,t.eventFrequencyValue2))," ",e.createElement("span",{className:"userflow-debugger-info-text"},Tt(t),","," ",Ft(t.eventTimeOperator)),t.eventTimeOperator!==O.ANY&&e.createElement(e.Fragment,null," ",e.createElement("strong",null,t.eventRelativeValue),t.eventTimeOperator===O.RELATIVE_BETWEEN&&e.createElement(e.Fragment,null," ",e.createElement("span",{className:"userflow-debugger-info-text"},"and")," ",e.createElement("strong",null,t.eventRelativeValue2))," ",e.createElement("span",{className:"userflow-debugger-info-text"},St(t,t.eventRelativeUnit))),t.eventActor&&t.eventActor!==Ae.CURRENT_USER?e.createElement(e.Fragment,null," ",e.createElement("strong",null,Dt(t.eventActor))):"",t.whereCondition&&s&&e.createElement(z,{hovered:!0,target:n},"Where ",e.createElement("br",null),e.createElement(Fe,{condition:t.whereCondition})))}},[N.ALWAYS_TRUE]:{icon:()=>D,Preview:()=>e.createElement("span",null,"Water is wet")},[N.CHECKLIST_TASK_CLICKED]:{icon:()=>Ee,Preview:()=>e.createElement("span",null,"Task is clicked")}},Fe=t=>e.createElement("div",null,t.condition.conditions.map((n,s)=>e.createElement("div",{key:n.id}," ",s===0?null:e.createElement("span",{className:"userflow-debugger-info-text"},t.condition.operator?.toLowerCase())," ",n.type==="ATTRIBUTE"&&Ie.ATTRIBUTE.Preview({condition:n,isRoot:!0,isHideCond:!1}),n.type==="CLAUSE"&&e.createElement(e.Fragment,null,"(",e.createElement(Fe,{condition:n}),")")))),z=({hovered:t,children:n,target:s})=>{const r=oe();return t?e.createElement(ye,{className:"userflow-debugger-popover",target:s.current,placement:"top",horizontalAlign:"center",verticalAlign:"center",document:r?.current?.contentDocument||void 0},n):null};class Jt extends e.PureComponent{constructor(n){super(n),this.rootRef=e.createRef(),this.optionsElRef=e.createRef(),this.input=null,this.popoverRef=e.createRef(),this.isMouseDown=!1,this.isCreateOpen=!1,this.setInput=s=>{this.input=s;const{inputRef:r}=this.props;r&&(typeof r=="function"?r(s):r.current=s)},this.onInputChange=s=>{s.stopPropagation();const{value:r}=s.target;r!==""&&this.openPopover();const a=this.memoizedFilterOptions(this.props.options,r);this.setState({inputValue:r,q:r,highlightedIndex:a.length>0?0:-1,createHighlighted:a.length===0}),r===""&&!this.props.noEmpty&&this.triggerOnChange(null),this.props.onSearchChange&&this.props.onSearchChange(r)},this.onPopoverPlacementChange=s=>this.setState({popoverPlacement:s}),this.onMouseDown=s=>{s.preventDefault(),this.isMouseDown=!0;const r=()=>{this.isMouseDown=!1,this.props.document?.removeEventListener("mouseup",r),document.body.removeEventListener("mouseup",r)};this.props.document?.addEventListener("mouseup",r),document.body.addEventListener("mouseup",r)},this.onFocus=s=>{this.input&&!this.props.noSearch&&this.input.select(),this.props.onFocus&&this.props.onFocus(s)},this.onBlur=s=>{this.isMouseDown||this.closePopover(),this.props.onBlur&&!this.isCreateOpen&&this.props.onBlur(s)},this.onClose=()=>{this.state.popoverOpen&&this.closePopover(),this.props.onClose&&this.props.onClose()},this.onTriggerClick=()=>{this.props.readOnly||this.props.disabled||(this.state.popoverOpen?this.closePopover():(this.input&&this.input.focus(),this.openPopover()))},this.onKeyDown=s=>{const{popoverOpen:r,highlightedIndex:a,createHighlighted:o}=this.state,l=this.getFilteredOptions(),c=l.length-1;switch(s.key){case"ArrowUp":s.preventDefault(),r&&(o?this.setState({highlightedIndex:c,createHighlighted:!1}):a>0&&this.setState({highlightedIndex:a-1}));break;case"ArrowDown":s.preventDefault(),r?this.props.onCreate&&(a===c||o)?this.setState({highlightedIndex:-1,createHighlighted:!0}):a<c&&this.setState({highlightedIndex:a+1}):this.props.noOpenOnDown||this.openPopover();break;case"Enter":if(r)if(s.preventDefault(),o&&!this.props.disableCreate)this.fireOnCreate();else{const p=l[a];p||!this.props.noEmpty?this.selectOption(p):!p&&this.props.hideOnEmpty&&this.props.onEnter&&this.props.onEnter()}else this.props.onEnter?this.props.onEnter():this.openPopover();break;case"Tab":r&&!this.props.ignoreTab&&this.selectOption(l[a]);break;case"Escape":r&&(s.preventDefault(),s.stopPropagation(),this.setState({popoverOpen:!1}));break}},this.selectOption=s=>{s===this.props.value?this.setState({popoverOpen:!1,inputValue:this.renderOptionText(s),q:""}):(this.setState({popoverOpen:!1,inputValue:"",q:""}),this.triggerOnChange(s))},this.highlightOption=s=>{this.setState({highlightedIndex:s,createHighlighted:!1})},this.highlightCreate=()=>{this.setState({highlightedIndex:-1,createHighlighted:!0})},this.fireOnCreate=()=>{const{onCreate:s}=this.props;if(s){this.isCreateOpen=!0;const r={q:ee.upperFirst(this.state.q),callback:a=>{this.isCreateOpen=!1,a!=null&&this.selectOption(a),this.input&&this.input.focus()}};s(r),this.closePopover()}},this.openPopover=()=>{if(!this.state.popoverOpen){const s=this.getFilteredOptions();let r=0,a=!1;if(s.length===0)r=-1,a=!0;else{const{value:o}=this.props,l=s.findIndex(c=>c===o);l!==-1&&(r=l)}this.setState({popoverOpen:!0,highlightedIndex:r,createHighlighted:a})}},this.memoizedFilterOptions=pt((s,r)=>(s=s||[],r?s.filter(a=>this.filter(a,r)):s)),this.state={inputValue:this.renderOptionText(n.value==null?null:n.value),q:"",popoverOpen:!1,popoverPlacement:null,highlightedIndex:-1,createHighlighted:!1}}componentDidUpdate(n,s){const{value:r}=this.props;if(r!==n.value){const a=this.renderOptionText(r??null);a!==this.state.inputValue&&this.setState({inputValue:a})}s.highlightedIndex!==this.state.highlightedIndex&&this.scrollHighlightedOptionIntoView()}render(){let n,s=!1;const{props:r}=this,a=this.state,o=a.popoverPlacement==="top"?"above":"below";if(a.popoverOpen&&this.rootRef.current){const c=this.getFilteredOptions();if(this.props.hideOnEmpty&&c.length===0)s=!0;else{let p;if(c.length>0){let _=null;p=c.reduce((E,h,x)=>{const C=this.getOptionGroup(h);C&&C!==_&&E.push(e.createElement("div",{key:"group:"+C,className:"combo-box__group-header"},C)),_=C;const u=["combo-box__option"];return x===a.highlightedIndex&&u.push("combo-box__option--highlighted"),this.props.optionClassName&&u.push(this.props.optionClassName),E.push(e.createElement(en,{key:this.getOptionKey(h,x),className:u.join(" "),option:h,idx:x,renderOptionText:r.renderOptionText,renderOptionItem:r.renderOptionItem,getOptionIcon:r.getOptionIcon,onClick:this.selectOption,onHover:this.highlightOption})),r.hasSeparatorAfter&&r.hasSeparatorAfter(h)&&E.push(e.createElement("div",{key:"sep-"+x,className:"combo-box__option-sep"})),E},[])}else r.loading?p=e.createElement("div",{className:"combo-box__no-results"},"Loading..."):p=e.createElement("div",{className:"combo-box__no-results"},"No matching ",r.nounPlural||"items");n=e.createElement(ye,{ref:this.popoverRef,className:"combo-box-popover"+(r.popoverNotch?"":` combo-box-popover--${o}`),noNotch:!r.popoverNotch,target:this.rootRef.current,forceDimension:!0,matchWidth:!0,minWidth:r.popoverMinWidth,onMouseDown:this.onMouseDown,onPlacementChange:this.onPopoverPlacementChange,document:r.document},e.createElement("div",{ref:this.optionsElRef,className:g({"combo-box__options":!0,"combo-box__options--with-create":!!r.onCreate})},p),r.onCreate&&e.createElement("div",{key:"create",className:g({"combo-box__option":!0,"combo-box__option--create":!0,"combo-box__option--highlighted":a.createHighlighted}),onClick:this.fireOnCreate,onMouseMove:this.highlightCreate},e.createElement("div",{className:"combo-box__create-icon"},e.createElement(G,{icon:tt})),e.createElement("div",{className:"combo-box__create-text"},"Create"," ",a.q===""?"new"+(r.noun?` ${r.noun}`:""):e.createElement("b",null,ee.upperFirst(a.inputValue)))))}}const l=["input-group","combo-box"];return a.popoverOpen&&!s&&(l.push("combo-box--open"),r.popoverNotch||l.push(`combo-box--with-popover-${o}`)),r.disabled&&l.push("input-group--disabled"),r.noSearch&&l.push("combo-box--no-search"),r.className&&l.push(r.className),e.createElement(e.Fragment,null,e.createElement("div",{className:l.join(" "),style:{width:r.width?r.width+"px":void 0},ref:this.rootRef,onClick:r.readOnly||r.disabled?void 0:()=>{this.input?.focus(),this.openPopover()}},r.childrenBefore,r.value&&r.getOptionIcon&&e.createElement("div",{className:"combobox__input-icon"},Pe(r.value,r.getOptionIcon)),e.createElement("input",{type:"text",className:r.inputClassName,name:r.name,value:a.inputValue,onChange:this.onInputChange,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onMouseDown:this.openPopover,placeholder:r.placeholder,readOnly:r.readOnly||r.noSearch,disabled:r.disabled,autoComplete:"off",ref:this.setInput,...r.inputHtmlAttributes}),!r.noTrigger&&e.createElement("div",{"data-testid":r.triggerTestId||"combo-box-trigger",className:"input-group__append input-group__trigger",onClick:this.onTriggerClick,onMouseDown:this.onMouseDown},e.createElement(G,{icon:nt})),r.onClose&&e.createElement("div",{className:"input-group__append input-group__trigger",onClick:this.onClose},e.createElement(G,{icon:rt})),r.childrenAfter),n)}scrollHighlightedOptionIntoView(){const n=this.optionsElRef.current;if(this.state.popoverOpen&&n){const s=n.querySelector(".combo-box__option--highlighted");if(s){const r=n.getBoundingClientRect(),a=s.getBoundingClientRect();a.top<r.top?n.scrollTop+=a.top-r.top:a.bottom>r.bottom&&(n.scrollTop+=a.bottom-r.bottom)}}}triggerOnChange(n){const{onChange:s}=this.props;s&&s(n)}closePopover(){this.setState({popoverOpen:!1,inputValue:this.renderOptionText(this.props.value==null?null:this.props.value),q:""})}renderOptionText(n){return n==null?"":Le(n,this.props.renderOptionText)}getFilteredOptions(){return this.memoizedFilterOptions(this.props.options,this.state.q)}filter(n,s){return this.props.filter?this.props.filter(n,s):this.renderOptionText(n).toLowerCase().includes(s.toLowerCase())}getOptionKey(n,s){return n&&n.id||s}getOptionGroup(n){return this.props.getOptionGroup?this.props.getOptionGroup(n):n&&n.group||null}}class en extends e.PureComponent{constructor(){super(...arguments),this.state={isOptionDisabled:!1},this.onClick=()=>{this.state.isOptionDisabled||this.props.onClick(this.props.option)},this.onHover=()=>{this.state.isOptionDisabled||this.props.onHover(this.props.idx)}}componentDidMount(){const n=this.props.option!==void 0&&typeof this.props.option=="object"&&this.props.option!==null&&"disabled"in this.props.option&&this.props.option.disabled===!0;this.setState({isOptionDisabled:n})}componentDidUpdate(){const n=this.props.option!==void 0&&typeof this.props.option=="object"&&this.props.option!==null&&"disabled"in this.props.option&&this.props.option.disabled===!0;this.setState({isOptionDisabled:n})}render(){const{isOptionDisabled:n}=this.state,{props:s}=this;return e.createElement("div",{className:g({[s.className]:!0,"combo-box__option--disabled":n}),onClick:this.onClick,onMouseMove:this.onHover},tn(s.option,s.renderOptionText,s.renderOptionItem,s.getOptionIcon))}}function Le(t,n){return n?n(t):typeof t=="string"||typeof t=="number"?t:t?t.name:"?"}function tn(t,n,s,r){if(s)return s(t);{let a=Le(t,n);return r?e.createElement("div",{className:"d-flex align-flex-start"},e.createElement("div",{className:"combobox__option-icon"},Pe(t,r)),e.createElement("div",{className:"flex-1"},a)):a}}function Pe(t,n){const s=n(t);return nn(s)?e.createElement(G,{icon:s}):s}function nn(t){return gt(t)&&"iconName"in t}const rn=({selectedFlow:t,setSelectedFlow:n,flows:s,debugAutoStartCondition:r})=>{const a=P(),o=oe();i.useEffect(()=>{if(!t)return;r(t.latestVersion);const c=()=>{r(t.latestVersion)};return a.on("private:checkSessionsAck",c),document.addEventListener("visibilitychange",c),()=>{a.off("private:checkSessionsAck",c),document.removeEventListener("visibilitychange",c)}},[t]);const l=i.useCallback(c=>{!c||t?.latestVersion?.id===c.latestVersion.id||n(c)},[t]);return e.createElement(e.Fragment,null,e.createElement("div",{className:"d-flex align-center justify-space-between"},e.createElement("div",{className:"d-flex justify-space-between align-center"},"Select Flow"),e.createElement(Jt,{className:"userflow-debugger__flow__selector",value:t,options:s,placeholder:"Select flow",document:o?.current?.contentDocument||void 0,onChange:l,renderOptionItem:c=>c.name})),e.createElement(sn,{selectedFlow:t,selectedFlowVersionsId:t?.latestVersion?.id}))},sn=({selectedFlowVersionsId:t,selectedFlow:n})=>{const s=P(),[r,a]=i.useState(!1),o=S(),l=o&&o?.activeFlow?.id===n?.id;return i.useEffect(()=>(a(!1),s.on("private:setFlowSession",c=>{a(c===t)}),()=>{s.off("private:setFlowSession",()=>a(!1))}),[t]),i.useEffect(()=>{l||a(!1)},[l]),o?.activeFlow===null?null:e.createElement(e.Fragment,null,o?.locale?.match===!1&&e.createElement("div",{className:g(ie(!1))},e.createElement("span",{className:"d-flex gap-8 align-center"},e.createElement(m,{icon:I}),e.createElement("span",null,"The flow will not auto start ",e.createElement("br",null)," ",e.createElement("b",null,"User locale (",o?.locale?.code,") is not enabled.")))),r?e.createElement("div",{className:g({"d-flex align-center fade-in":!0,"userflow-debugger-condition__item":!0,"userflow-debugger-condition__flow__status":!0})},e.createElement("span",{className:"d-flex align-center gap-8"},e.createElement(m,{icon:k}),e.createElement("span",null,"This flow ",e.createElement("strong",null,"just")," started"))):null,l&&!r&&e.createElement("div",{className:g({"userflow-debugger-condition__item":!0,"userflow-debugger-condition__flow__status":!0})},e.createElement("span",{className:"d-flex align-center gap-8"},e.createElement(m,{icon:k}),e.createElement("span",null,"This flow is currently active"))),!l&&o&&e.createElement("div",{className:g({"userflow-debugger-condition__item":!0,"userflow-debugger-condition__flow__status":!0})},e.createElement("span",{className:"d-flex gap-8 align-center"},e.createElement(m,{icon:k,size:16}),e.createElement("span",null,"Another flow is currently active"))))},an=t=>{const[n,s]=i.useState(document.visibilityState==="visible"),r=i.useRef(t);return i.useEffect(()=>{r.current=t},[t]),i.useEffect(()=>{const a=()=>{const o=document.visibilityState==="visible";s(o),r.current?.(o)};return document.addEventListener("visibilitychange",a),()=>{document.removeEventListener("visibilitychange",a)}},[]),n},on=({close:t})=>{const n=P(),s=i.useRef(null),[r,a]=i.useState(!!n.clientToken),[o,l]=i.useState(()=>{const f=n.getSessionStorageState(),v=f?.debuggerApp?.x,y=f?.debuggerApp?.y||50;return{x:v??(document.body.clientWidth?Number(document.body.clientWidth)-450:50),y}}),[c,p]=i.useState(!1),_=i.useRef(null),{meta:E}=V(),{debuggerRoute:h}=le(),[x,C]=i.useState(!1),u=i.useRef(null),w=i.useRef({mouseX:0,mouseY:0,elementX:0,elementY:0});i.useEffect(()=>{o&&n.setSessionStorageState(f=>({...f,debuggerApp:{...f.debuggerApp,x:o.x,y:o.y}}))},[o]),i.useEffect(()=>{if(!c)return;const f=y=>{const R=y.clientX-w.current.mouseX,Y=y.clientY-w.current.mouseY,X=Math.min(w.current.elementX+R,window.document.body.clientWidth-200),K=Math.max(w.current.elementY+Y,0);u.current||(u.current=requestAnimationFrame(()=>{l({x:X,y:K}),u.current=null}))},v=()=>{p(!1)};return document.addEventListener("mousemove",f),document.addEventListener("mouseup",v),()=>{document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",v),u.current&&(cancelAnimationFrame(u.current),u.current=null)}},[c,o]),i.useEffect(()=>{const f=()=>{l(y=>{const R=document.body.clientWidth-500,Y=document.body.clientHeight-100,X=Math.max(Math.min(y.x,R),0),K=Math.max(Math.min(y.y,Y),0);return{x:X,y:K}})},v=()=>{a(!!n.clientToken)};return window.addEventListener("resize",f),n.on("private:initialised",v),()=>{window.removeEventListener("resize",f),n.off("private:initialised",v)}},[]);const b=f=>{s.current&&(p(!0),f.preventDefault())};return e.createElement("div",{ref:s,style:{left:"0",top:"0",position:"absolute",willChange:"transform",transform:`translate3d(${o.x}px, ${o.y}px, 0)`,zIndex:1234620}},e.createElement("div",{onMouseDown:b,style:{height:"50px",cursor:"move",userSelect:"none",position:"absolute",width:"50px"}}),e.createElement(Ve,{title:"Debugger",stylesheet:ft,style:{borderRadius:"8px",width:"400px",height:h==="checkAutoStart"?"600px":r?"500px":"400px"},elRef:_,onStylesheetsLoad:C},e.createElement(Ne.Provider,{value:_},e.createElement("div",{className:"d-flex flex-column userflow-debugger-app",style:{visibility:x?"visible":"hidden"}},e.createElement("div",{className:"d-flex justify-space-between userflow-debugger-app__header"},e.createElement(bt,null),e.createElement("div",{className:"d-flex align-center userflow-debugger-app__title"},e.createElement(He,null),e.createElement("span",null,"Userflow debugger")),e.createElement("button",{role:"button",className:"userflow-debugger-app__close",onClick:()=>{n.getSessionStorageState().debuggerApp&&n.setSessionStorageState(f=>({...f,debuggerApp:null})),t()}},e.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M12.1836 4.49609L8.90234 7.77734L12.1562 11.0312C12.4297 11.2773 12.4297 11.6875 12.1562 11.9336C11.9102 12.207 11.5 12.207 11.2539 11.9336L7.97266 8.67969L4.71875 11.9336C4.47266 12.207 4.0625 12.207 3.81641 11.9336C3.54297 11.6875 3.54297 11.2773 3.81641 11.0039L7.07031 7.75L3.81641 4.49609C3.54297 4.25 3.54297 3.83984 3.81641 3.56641C4.0625 3.32031 4.47266 3.32031 4.74609 3.56641L8 6.84766L11.2539 3.59375C11.5 3.32031 11.9102 3.32031 12.1836 3.59375C12.4297 3.83984 12.4297 4.25 12.1836 4.49609Z",fill:"white"})))),e.createElement(ln,null),h==="verifySetup"&&e.createElement(cn,null),E?.endUser?.debuggerEnabled&&h==="checkAutoStart"&&e.createElement(un,null),h==="currentUser"&&e.createElement(dn,null)))))},ln=()=>{const t=P(),{meta:n}=V(),[s,r]=i.useState(!1),{debuggerRoute:a,setDebuggerRoute:o}=le(),l=t.isIdentified(),c=ht(()=>r(!1));return i.useEffect(()=>{n&&n?.endUser.debuggerEnabled===!1&&a==="checkAutoStart"&&o("verifySetup")},[n]),l?e.createElement("div",{ref:c},e.createElement("div",{className:"d-flex align-center justify-space-between userflow-debugger-menu",onClick:()=>r(!s)},e.createElement("div",{className:g({"d-flex align-center":!0,"userflow-debugger-menu__title":!0,"userflow-debugger-menu__title--open":s})},e.createElement(m,{icon:B[a].icon}),e.createElement("span",null,B[a].name)),e.createElement("button",{className:"userflow-debugger-menu__toggle"},e.createElement(m,{icon:st}))),s&&e.createElement("ul",{className:"userflow-debugger-menu__list"},Object.keys(B).map(p=>{if(!n?.endUser?.debuggerEnabled&&p==="checkAutoStart")return null;const _=B[p];return e.createElement("li",{key:p,className:"d-flex align-center userflow-debugger-app__item",onClick:()=>{o&&o(p),r(!1)}},e.createElement(m,{icon:_.icon}),_.name)}))):null},cn=()=>{const{meta:t,buildId:n}=V(),s=P(),[r,a]=i.useState(!!s.clientToken),o=i.useMemo(()=>s.isIdentified(),[s,t]),{setDebuggerRoute:l}=le();i.useEffect(()=>{const E=()=>{a(!!s.clientToken)};return s.on("private:initialised",E),()=>{s.off("private:initialised",E)}},[]);const c=i.useMemo(()=>{let E=$;const h={"d-flex flex-column gap-8":!0,"userflow-debugger-installation__step":!0};return r?(E=M,h["userflow-debugger-installation__step__success"]=!0):(E=it,h["userflow-debugger-installation__step__danger"]=!0),{icon:E,classes:h}},[r]),p=i.useMemo(()=>{let E=$;const h={"d-flex flex-column gap-8":!0,"userflow-debugger-installation__step":!0};return!r&&!o&&(E=$,h["userflow-debugger-installation__step__failed"]=!0),r&&!o&&(E=k,h["userflow-debugger-installation__step__warning"]=!0),r&&o&&(E=M,h["userflow-debugger-installation__step__success"]=!0),{icon:E,classes:h}},[r,o]),_=()=>o?t?.endUser.debuggerEnabled?e.createElement(e.Fragment,null,e.createElement("span",{className:"userflow-debugger-details"},t?.env.company.name),e.createElement("span",{className:"userflow-debugger-details"},t?.env.name)):e.createElement("div",{className:"userflow-debugger-details__access__denied"},"The"," ",e.createElement("button",{onClick:()=>l("currentUser")},"currently signed-in user")," ","does not have debugger access"):e.createElement(e.Fragment,null,e.createElement("span",{className:"userflow-debugger-details"},"Unknown company"),e.createElement("span",{className:"userflow-debugger-details"},"Unknown environment"));return e.createElement("div",{className:"space-evenly userflow-debugger-app__content"},e.createElement("div",{className:"userflow-debugger-installation__steps"},e.createElement("div",{className:g({"d-flex gap-8 flex-column":!0,"userflow-debugger-installation__step":!0,"userflow-debugger-installation__step__success":!0})},e.createElement(m,{icon:M,size:32}),"Userflow ",e.createElement("br",null),"installed"),e.createElement("div",{className:g(c.classes)},e.createElement(m,{icon:c.icon,size:32}),"Userflow ",e.createElement("br",null)," ",r?"":"not"," initialized"),e.createElement("div",{className:g(p.classes)},e.createElement(m,{icon:p.icon,size:32}),"User ",e.createElement("br",null)," ",o&&r?"":"not"," ","identified")),!r&&!o&&e.createElement("div",{className:g({"d-flex gap-8 flex-column":!0,"userflow-debugger-installation__not__initialized":!0})},"Remember to initialize Userflow by calling",e.createElement("div",null,"userflow.init('YOUR_USERFLOW_TOKEN')")),r&&e.createElement("div",{className:"d-flex gap-8 flex-column userflow-debugger-details__wrapper"},e.createElement("div",{className:"userflow-debugger-details__env__details"},e.createElement("div",{className:"d-flex gap-8 flex-column justify-space-around"},e.createElement(m,{size:20,icon:at}),e.createElement(m,{size:20,icon:ot})),e.createElement("div",{className:"d-flex flex-column align-flex-start gap-8"},_())),e.createElement("div",{className:"d-flex gap-8 align-center"},e.createElement(m,{size:20,icon:lt}),e.createElement("span",{className:"userflow-debugger-details"},s.getInitToken())),e.createElement("div",{className:"d-flex gap-8 align-center"},e.createElement(m,{size:20,icon:re}),e.createElement("span",{className:"userflow-debugger-details"},o?s.getIdentifiedUser()?.externalId:"User not identified"))),e.createElement("div",{className:"userflow-debugger-installation__version"},e.createElement("a",{href:"https://docs.userflow.com/docs/dev/userflow-js-installation",target:"_blank",rel:"noreferrer"},"Visit the Userflow Developer Docs for help")," ",e.createElement("br",null),"Userflow.js version 0.1.",n))},un=()=>{const t=P(),{debuggerClientConditions:n}=V(),[s,r]=i.useState(void 0),[a,o]=i.useState([]),[l,c]=i.useState(),p=i.useMemo(()=>{if(l?.startCondition?.match===!1||l?.hiddenCondition?.match===!0||l?.locale?.match===!1)return!1;const u=l?.startFrequency;return!(u&&(u.onlyIfNotCompleted===!1||u.scopeByGroup===!1||u.frequency===!1))},[l]);i.useEffect(()=>{_()},[]),an(u=>{u&&_()}),i.useEffect(()=>{s&&x(s.latestVersion)},[s]);const _=async()=>{C().then(u=>{if(u?.length&&(o(u),!s)){const w=t.getSessionStorageState()?.debuggerApp?.selectedFlowVersionId,b=u.find(f=>f.latestVersion.id===w);h(b??u[0])}})},E=we.debounce(async u=>{const w=[];for(const[v,y]of n.entries())w.push({conditionId:v,isTrue:y.isTrue});const b={kind:"DebugFlowAutostartCondition",flowVersionId:u.id,clientConditions:w},f=await t.send(b);c({...f,listFlowLatestVersion:u}),f.latestVersion?.id&&u.id!==f.latestVersion?.id&&(C().then(v=>{if(!v)return;o(v);const y=v?.find(R=>R.latestVersion.id===f.latestVersion?.id);y&&h(y)}),E(f.latestVersion))},300),h=u=>{r(u);const w=t.getSessionStorageState().debuggerApp;w&&w?.x&&t.setSessionStorageState(b=>({...b,debuggerApp:{...w,selectedFlowVersionId:u.latestVersion.id}}))},x=async u=>{n.forEach(b=>{b.untrack?.()}),n.clear();const{conditionTypes:w}=await Me(async()=>{const{conditionTypes:b}=await import("./flow-condition-types.js").then(f=>f.f);return{conditionTypes:b}},__vite__mapDeps([0,1,2,3,4,5,6,7]));for(const b of u.clientConditions){n.set(b.id,{condition:b,isTrue:null});const f=w[b.type];if(!f){console.error(`Unknown condition type ${b.type}`);continue}const v=n.get(b.id);v&&(v.untrack=f.track({sessionData:new ke([]),condition:b,callback:y=>{v.isTrue!==y&&(v.isTrue=y,E(u))}}))}},C=async()=>{try{return(await t.send({kind:"ListFlows",hasAutostartCondition:!0},{handlesRejection:!0})).flows?.filter(b=>b.type==="FLOW")}catch(u){u.code==="debugger_access_denied"&&ne("Access defined for List Flows");return}};return e.createElement("div",{className:"userflow-debugger-app__content"},e.createElement(Ce.Provider,{value:l},e.createElement(rn,{flows:a,selectedFlow:s,setSelectedFlow:h,debugAutoStartCondition:E}),e.createElement("div",{className:"d-flex flex-column gap-8 userflow-debugger-app__wrapper"},l?.startCondition?.condition&&e.createElement("div",null,e.createElement("div",{className:g({"d-flex gap-8 align-center":!0,"userflow-debugger-app__wrapper__passing":p,"userflow-debugger-app__wrapper__failed":!p})},e.createElement(m,{icon:p?ct:ut}),e.createElement("strong",null,"Auto-start conditions")),e.createElement("span",null,"These are"," ",e.createElement(De,{condition:l.startCondition.condition}),e.createElement("b",null,"-conditions"),", meaning"," ",l.startCondition.condition.type==="CLAUSE"&&l.startCondition.condition.operator==="AND"&&e.createElement(e.Fragment,null,"all conditions must pass for the flow to start."),l.startCondition?.condition.type==="CLAUSE"&&l.startCondition.condition.operator==="OR"&&e.createElement(e.Fragment,null,"only one condition must pass for the flow to start."))),l?.startCondition?.condition&&e.createElement(W,{isRoot:!0,isHideCond:!1,condition:l.startCondition.condition}),e.createElement(zt,null),e.createElement(Yt,null),e.createElement(Kt,null),e.createElement(Zt,null),e.createElement(Xt,null),e.createElement(Gt,null),e.createElement($t,null),e.createElement(Qt,null))))},dn=e.memo(()=>{const{meta:t,buildId:n}=V();if(!t)return null;const r="https://app.userflow.com/app/"+(t.env.primary?t.env.company.slug:`${t.env.company.slug}@${t.env.slug}`)+"/settings/debugger?external_id="+t.endUser.externalId;return e.createElement("div",{className:"d-flex flex-column space-evenly flex-1"},e.createElement("div",{className:"d-flex flex-column gap-8"},e.createElement("div",{className:"d-flex flex-column"},t.endUser.avatarUrl?e.createElement("img",{src:t.endUser.avatarUrl,className:"userflow-debugger-user__image"}):e.createElement("div",{className:"userflow-debugger-user__image"}),e.createElement("span",{className:"userflow-debugger-user__name"},t.endUser?.name||"Unknown name"),e.createElement("span",{className:"userflow-debugger-user__email"},t?.endUser?.email||"Unknown email address"),(!t.endUser.email||!t.endUser.name)&&e.createElement("span",{className:"userflow-debugger__external__id"},t.endUser.externalId)),!t.endUser.debuggerEnabled&&e.createElement(e.Fragment,null,e.createElement("div",{className:"userflow-debugger-user__info"},"This user doesn't have access to the Userflow debugger. You can grant access through the debugger settings in Userflow."),e.createElement("a",{className:"userflow-debugger-user__button",href:r,target:"_blank",rel:"noreferrer"},"Grant access in Userflow ",e.createElement(m,{icon:_e})))),e.createElement("div",{className:"userflow-debugger-installation__version"},e.createElement("a",{href:"https://docs.userflow.com/docs/dev/userflow-js-installation",target:"_blank",rel:"noreferrer"},"Visit the Userflow Developer Docs for help")," ",e.createElement("br",null),"Userflow.js version 0.1.",n))});class qn{constructor(n,s){this.client=n,this.buildId=s,this.debuggerClientConditions=new Map}mount(){if(this.container)throw new Error("UI has already been mounted");this.container=document.createElement("div"),this.container.id="userflow-debugger-ui",document.body.appendChild(this.container),ue.render(e.createElement(mn,{client:this.client,debuggerClientConditions:this.debuggerClientConditions,buildId:this.buildId,unmount:()=>this.unmount()}),this.container)}unmount(){this.container&&(ue.unmountComponentAtNode(this.container),document.body.contains(this.container)&&document.body.removeChild(this.container),this.client.unMountDebugger(),delete this.container)}}const mn=({client:t,debuggerClientConditions:n,buildId:s,unmount:r})=>{const[a,o]=i.useState(void 0),l=we.debounce(async()=>{try{const c=await t.send({kind:"GetCurrentEndUser"},{handlesRejection:!0});o(c)}catch(c){c.code==="debugger_access_denied"&&ne("debugger access denied"),o(void 0)}},300);return i.useEffect(()=>(l(),document.addEventListener("visibilitychange",l),t.on("private:identified",l),()=>{document.removeEventListener("visibilitychange",l),t.off("private:identified",l)}),[]),e.createElement(Re.Provider,{value:t},e.createElement(xe.Provider,{value:{meta:a,debuggerClientConditions:n,buildId:s}},e.createElement(Et,null,e.createElement(on,{close:r}))))};export{qn as DebuggerUI};
2
+ import{r as i,R as e}from"./vendor.react.js";import{r as ue}from"./vendor.react-dom.js";import{u as P,U as Re}from"./client-context.js";import{d as ne,a as F,b as O,c as A,e as H,f as d,A as de,W as T,g as U,h as N,S as Ue,i as Ae,_ as Me,j as ke}from"./userflow.js";import{F as Ve}from"./Frame.js";import{S as He}from"./logomark.js";import{c as M,d as Be,e as re,g as Ee,h as I,i as qe,j as he,k as se,l as Ge,m as We,n as be,o as je,p as ze,q as L,a as D,r as Ye,s as ve,t as Xe,u as Ke,v as $e,w as Ze,x as Qe,y as Je,z as k,A as et,B as _e,C as tt,f as nt,D as rt,E as st,F as at,G as ot,H as lt,I as $,J as it}from"./vendor.fortawesome.pro-regular-svg-icons.js";import{a as ct,b as ut}from"./vendor.fortawesome.pro-solid-svg-icons.js";import{D as m}from"./stylesheets.js";import{o as g}from"./vendor.obj-str.js";import"./vendor.core-js.js";import{_ as ee,l as we}from"./vendor.lodash.js";import{F as G}from"./vendor.fortawesome.react-fontawesome.js";import{P as ye}from"./Popover.js";import"./vendor.react-day-picker.js";import{f as ae,p as dt,a as mt}from"./vendor.date-fns.js";import{a as j}from"./react-hooks.js";import{m as pt}from"./vendor.memoize-one.js";import{c as gt}from"./roots.js";import"./vendor.object-assign.js";import"./vendor.scheduler.js";import"./vendor.i18next.js";import"./vendor.babel.runtime.js";import"./vendor.react-i18next.js";import"./vendor.phoenix.js";import"./vendor.uuid.js";import"./iframe-reset.styl.js";import"./flow-condition-types.js";import"./vendor.fortawesome.fontawesome-svg-core.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},n=new Error().stack;n&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[n]="6df85481-f3ce-4b87-88ea-ee78decf959b",t._sentryDebugIdIdentifier="sentry-dbid-6df85481-f3ce-4b87-88ea-ee78decf959b")}catch{}})();const ft=new URL("debugger.css",import.meta.url).href,Ce=i.createContext(void 0),S=()=>i.useContext(Ce),Ne=i.createContext(null),oe=()=>i.useContext(Ne),xe=i.createContext({debuggerClientConditions:new Map,meta:void 0,buildId:void 0}),V=()=>i.useContext(xe),B={verifySetup:{name:"Verify setup",icon:M},checkAutoStart:{name:"Check auto-start",icon:Be},currentUser:{name:"Current user",icon:re}},Se=i.createContext(void 0),Et=({children:t})=>{const n=P(),[s,r]=i.useState(n.getSessionStorageState().debuggerApp?.selectedTab??"verifySetup");return i.useEffect(()=>{n.setSessionStorageState(a=>!a.debuggerApp||!a.debuggerApp.x?a:{...a,debuggerApp:{...a.debuggerApp,selectedTab:s}}),ne("Debugger Route changed to",s)},[s]),e.createElement(Se.Provider,{value:{debuggerRoute:s,setDebuggerRoute:r}},t)},le=()=>{const t=i.useContext(Se);if(t===void 0)throw new Error("useDebuggerRouteHandler must be used within a DebuggerRouteProvider");return{debuggerRoute:t.debuggerRoute,setDebuggerRoute:t.setDebuggerRoute}},ht=t=>{const n=i.useRef(null),s=oe();return i.useEffect(()=>{const r=s?.current,a=o=>{n.current&&!n.current.contains(o.target)&&t(o)};return document.addEventListener("mousedown",a),r?.contentDocument?.addEventListener("mousedown",a),()=>{document.removeEventListener("mousedown",a),r?.contentDocument?.removeEventListener("mousedown",a)}},[t,s,n]),n},bt=()=>e.createElement("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M18.4393 5.56066C18.158 5.27936 18 4.89782 18 4.5C18 4.10218 18.158 3.72064 18.4393 3.43934C18.7206 3.15804 19.1022 3 19.5 3C19.8978 3 20.2794 3.15804 20.5607 3.43934C20.842 3.72064 21 4.10218 21 4.5C21 4.89782 20.842 5.27936 20.5607 5.56066C20.2794 5.84196 19.8978 6 19.5 6C19.1022 6 18.7206 5.84196 18.4393 5.56066Z",fill:"#537388"}),e.createElement("path",{d:"M3.43934 5.56066C3.15804 5.27936 3 4.89782 3 4.5C3 4.10218 3.15804 3.72064 3.43934 3.43934C3.72064 3.15804 4.10218 3 4.5 3C4.89782 3 5.27936 3.15804 5.56066 3.43934C5.84196 3.72064 6 4.10218 6 4.5C6 4.89782 5.84196 5.27936 5.56066 5.56066C5.27936 5.84196 4.89782 6 4.5 6C4.10218 6 3.72064 5.84196 3.43934 5.56066Z",fill:"#537388"}),e.createElement("path",{d:"M10.9393 13.0607C10.658 12.7794 10.5 12.3978 10.5 12C10.5 11.6022 10.658 11.2206 10.9393 10.9393C11.2206 10.658 11.6022 10.5 12 10.5C12.3978 10.5 12.7794 10.658 13.0607 10.9393C13.342 11.2206 13.5 11.6022 13.5 12C13.5 12.3978 13.342 12.7794 13.0607 13.0607C12.7794 13.342 12.3978 13.5 12 13.5C11.6022 13.5 11.2206 13.342 10.9393 13.0607Z",fill:"#537388"}),e.createElement("path",{d:"M3.43934 20.5607C3.15804 20.2794 3 19.8978 3 19.5C3 19.1022 3.15804 18.7206 3.43934 18.4393C3.72064 18.158 4.10218 18 4.5 18C4.89782 18 5.27936 18.158 5.56066 18.4393C5.84196 18.7206 6 19.1022 6 19.5C6 19.8978 5.84196 20.2794 5.56066 20.5607C5.27936 20.842 4.89782 21 4.5 21C4.10218 21 3.72064 20.842 3.43934 20.5607Z",fill:"#537388"}),e.createElement("path",{d:"M3.43934 13.0607C3.15804 12.7794 3 12.3978 3 12C3 11.6022 3.15804 11.2206 3.43934 10.9393C3.72064 10.658 4.10218 10.5 4.5 10.5C4.89782 10.5 5.27936 10.658 5.56066 10.9393C5.84196 11.2206 6 11.6022 6 12C6 12.3978 5.84196 12.7794 5.56066 13.0607C5.27936 13.342 4.89782 13.5 4.5 13.5C4.10218 13.5 3.72064 13.342 3.43934 13.0607Z",fill:"#537388"}),e.createElement("path",{d:"M10.9393 5.56066C10.658 5.27936 10.5 4.89782 10.5 4.5C10.5 4.10218 10.658 3.72064 10.9393 3.43934C11.2206 3.15804 11.6022 3 12 3C12.3978 3 12.7794 3.15804 13.0607 3.43934C13.342 3.72064 13.5 4.10218 13.5 4.5C13.5 4.89782 13.342 5.27936 13.0607 5.56066C12.7794 5.84196 12.3978 6 12 6C11.6022 6 11.2206 5.84196 10.9393 5.56066Z",fill:"#537388"})),vt={prefix:"far",iconName:"custom-hand-pointer-slash",icon:[641,512,[],"???","M185.554191,59.5126699 C189.248662,26.0794907 217.382589,0 251.429,0 C287.979,0 317.715,30.056 317.715,67 L317.715,140.634 C338.128,137.776 359.183,144.576 374.31,160.263 C401.503,147.416 434.689,154.593 454.182,179.361 C497.375,162.727 544,195.156 544,242 L544,326 C544,330.296189 543.590626,334.580726 542.780274,338.796073 L495.999,302.221942 L495.999,242 C495.999,216.84 459.428,216.879 459.428,242 C459.428,250.836 452.265,258 443.428,258 L439.435556,258 L420.622383,243.291649 C420.588346,242.865584 420.571,242.434817 420.571,242 L420.571,221 C420.571,197.943344 389.858993,196.049429 384.724023,215.225903 L269.713,125.308981 L269.713,67 C269.713,41.84 233.142,41.88 233.142,67 L233.142,96.717359 L185.554191,59.5126699 Z M162.172457,223.995642 L233.142,279.479508 L233.142,308.493 C233.142,324.063 213.106,330.402 204.111,317.776 L176.985,279.697 C162.585,259.485 133.185,282.08 147.591,302.303 L257.303,456.303 C260.737,461.122 266.231,464 272,464 L450.285,464 C455.041109,464 459.427079,462.119816 462.713129,458.957818 L500.616335,488.590478 C488.331086,503.061811 470.146238,512 450.286,512 L272,512 C250.741,512 230.632,501.59 218.209,484.154 L108.51,330.153 C87.267,300.334 93.705,258.796 123.06,237.001 C134.952446,228.171597 148.664261,223.998532 162.172457,223.995642 Z M272.143,309.970422 L306.143,336.551563 L306.143,400 C306.143,408.837 299.875,416 292.143,416 L286.143,416 C278.41,416 272.143,408.837 272.143,400 L272.143,309.970422 Z M347.571,368.939901 L381.571,395.521042 L381.571,400 C381.571,408.837 375.303,416 367.571,416 L361.571,416 C353.839,416 347.571,408.837 347.571,400 L347.571,368.939901 Z M633.994211,471.020009 C640.904211,476.540009 642.014211,486.610009 636.494211,493.510009 L626.494211,506 C620.964211,512.890009 610.904211,514.010009 604.004211,508.490009 L6.00421069,40.9800088 C-0.895789309,35.4600088 -2.01578931,25.3900088 3.51421069,18.4900088 L13.5142107,6 C19.0342107,-0.899991212 29.1042107,-2.00999121 36.0042107,3.51000879 L633.994211,471.020009 Z"]},_t={CLICK:Ee,DISABLED:I,MOUSEDOWN:qe,NOT_CLICK:vt,NOT_DISABLED:M,NOT_PRESENT:he,PRESENT:se},wt={COMPLETED:M,NOT_COMPLETED:I,NOT_SEEN:he,ACTIVE:Ge,NOT_ACTIVE:We,SEEN:se},yt={CLICK:"is clicked",DISABLED:"is disabled",MOUSEDOWN:"has mouse down on it",NOT_CLICK:"is not clicked",NOT_DISABLED:"is not disabled",NOT_PRESENT:"is not present",PRESENT:"is present"};function Ct(t){return yt[t]}const Nt={COMPLETED:"completed",NOT_COMPLETED:"not completed",NOT_SEEN:"not seen",ACTIVE:"is currently active",NOT_ACTIVE:"is not currently active",SEEN:"seen"};function xt(t){return Nt[t]}function St(t,n){let s=(n||"").toLowerCase();return(t.eventTimeOperator===O.RELATIVE_BETWEEN?t.eventRelativeValue2:t.eventRelativeValue)!==1&&(s+="s"),t.eventTimeOperator!==O.RELATIVE_GT&&(s+=" ago"),s}function Tt(t){return(t.eventFrequencyOperator===A.BETWEEN?t.eventFrequencyValue2:t.eventFrequencyValue)===1?"time":"times"}const Ot={CURRENT_USER:"by current user in any company",CURRENT_USER_CURRENT_GROUP:"by current user in current company",CURRENT_GROUP:"by any user in current company"};function Dt(t){return Ot[t]}function It(t){if(!t)return"";switch(t){case A.BETWEEN:return"between";case A.EQ:return"exactly";case A.GTE:return"at least";case A.LTE:return"at most"}}function Ft(t){if(!t)return"";switch(t){case O.ANY:return"at any point in time";case O.RELATIVE_BETWEEN:return"between";case O.RELATIVE_GT:return"in the last";case O.RELATIVE_LT:return"more than"}}const Lt={1:"Lowest",2:"Low",3:"Medium",4:"High",5:"Highest"};function Pt(t){return`${Lt[t]||String(t)} priority`}function te(t,n){switch(t){case H.DAY:return n===1?"day":"days";case H.HOUR:return n===1?"hour":"hours";case H.MINUTE:return n===1?"minute":"minutes";case H.SECOND:return n===1?"second":"seconds"}}function me(t){switch(t){case"USER":return re;case"GROUP":return ze;case"GROUP_MEMBERSHIP":return je;case"EVENT":return be}}function Rt(t){const n=t.split("/");if(n.length===1)return["USER",t];switch(n[0]){case"group":return["GROUP",n[1]];case"group_membership":return["GROUP_MEMBERSHIP",n[1]];case"event":return["EVENT",n[1]]}return console.warn("parseAttributeDefinitionFqn: Invalid attribute definition FQN",t),["USER",t]}const Ut={[F.BANNER]:"banner",[F.CHECKLIST]:"checklist",[F.FLOW]:"flow",[F.EMBED]:"embed",[F.LAUNCHER]:"launcher",[F.RESOURCE_CENTER]:"resource center"};function At(t,{title:n,plural:s}={}){let r=Ut[t];return n&&(r=ee.upperFirst(r)),s&&(r+="s"),r}const Mt=["yyyy-MM-dd","yyyy/MM/dd","MM-dd yyyy","MM/dd yyyy","MM-dd-yyyy","MM/dd/yyyy","MM-dd","MM/dd","dd MMM yyyy","dd MMMM yyyy","MMM dd yyyy","MMMM dd yyyy","dd MMM","dd MMMM","MMM dd","MMMM dd"],kt=["hh:mmaaa","hh.mmaaa","hh:mm aaa","hh.mm aaa","HH:mm","HH.mm","hhaaa","hh aaa","HH"];for(const t of Mt)for(const n of kt);const Vt="d MMM yyyy";function pe(t){if(t==null)return"";const n=Bt?t.getMinutes()===0?"h aaa":"h:mm aaa":"HH:mm";return ae(t,Vt+", "+n)}function Ht(t){if(!t)return null;const n=dt(t,"yyyy-MM-dd",new Date);return isNaN(n.valueOf())?null:n}function ge(t){if(!t)return null;const n=mt(t);return isNaN(n.valueOf())?null:n}const Bt=Intl.DateTimeFormat(Intl.DateTimeFormat().resolvedOptions().locale,{hour:"numeric"}).resolvedOptions().hourCycle==="h12";var Te=(t=>(t.EVENT="EVENT",t.GROUP="GROUP",t.GROUP_MEMBERSHIP="GROUP_MEMBERSHIP",t.USER="USER",t))(Te||{});function fe(t){return({condition:n})=>{throw new Error(`conditionOperators.${n.operator}.${t} is not supported`)}}const Z={[d.ABSOLUTE_EQ]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"on")," ",e.createElement("span",{className:"nowrap text-bold"},J(t.value)))},[d.ABSOLUTE_GT]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"after")," ",e.createElement("span",{className:"nowrap text-bold"},J(t.value)))},[d.ABSOLUTE_LT]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"before")," ",e.createElement("span",{className:"nowrap text-bold"},J(t.value)))},[d.AND]:{Preview:fe("Preview")},[d.BETWEEN]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"is between")," ",e.createElement("b",null,t.value)," ",e.createElement("span",{className:"text-secondary"},"and")," ",e.createElement("b",null,t.value2))},[d.CONTAINS]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"contains")," ",e.createElement("b",null,t.value))},[d.EMPTY]:{Preview:()=>e.createElement("span",{className:"text-secondary"},"is empty")},[d.ENDS_WITH]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"ends with")," ",e.createElement("b",null,t.value))},[d.EQ]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"is")," ",e.createElement("b",null,t.dataType===de.FLOW&&t.value?e.createElement("span",null,t?.eventDisplayName??t.eventName):t.value))},[d.EXCLUDES_ALL]:{Preview:({condition:t})=>q(t,"does not include","all of")},[d.EXCLUDES_ANY]:{Preview:({condition:t})=>q(t,"does not include","at least one of")},[d.FALSE]:{Preview:()=>e.createElement("span",{className:"text-secondary"},"is false")},[d.GT]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"is greater than")," ",e.createElement("b",null,t.value))},[d.GTE]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"is greater than or equal to")," ",e.createElement("b",null,t.value))},[d.INCLUDES_ALL]:{Preview:({condition:t})=>q(t,"includes","all of")},[d.INCLUDES_ANY]:{Preview:({condition:t})=>q(t,"includes","at least one of")},[d.LT]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"is less than")," ",e.createElement("b",null,t.value))},[d.LTE]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"is less than or equal to")," ",e.createElement("b",null,t.value))},[d.NE]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"is not")," ",e.createElement("b",null,t.dataType===de.FLOW&&t.value?e.createElement("span",null," ",t?.eventDisplayName??t.eventName):t.value))},[d.NOT_CONTAINS]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"does not contain")," ",e.createElement("b",null,t.value))},[d.NOT_EMPTY]:{Preview:()=>e.createElement("span",{className:"text-secondary"},"has any value")},[d.NOT_REGEX]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"does not match")," ",e.createElement("b",null,t.value))},[d.OR]:{Preview:fe("Preview")},[d.REGEX]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"matches")," ",e.createElement("b",null,t.value))},[d.RELATIVE_EQ]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"exactly")," ",e.createElement("span",{className:"nowrap text-bold"},Q(t.value))," ",e.createElement("span",{className:"text-secondary"},"ago"))},[d.RELATIVE_GT]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"less than")," ",e.createElement("span",{className:"nowrap text-bold"},Q(t.value))," ",e.createElement("span",{className:"text-secondary"},"ago"))},[d.RELATIVE_LT]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"more than")," ",e.createElement("span",{className:"nowrap text-bold"},Q(t.value))," ",e.createElement("span",{className:"text-secondary"},"ago"))},[d.STARTS_WITH]:{Preview:({condition:t})=>e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"starts with")," ",e.createElement("b",null,t.value))},[d.TRUE]:{Preview:()=>e.createElement("span",{className:"text-secondary"},"is true")},[d.URL]:{Preview:({condition:t})=>{const{urlPattern:n}=t;if(!n)return e.createElement("span",{className:"text-secondary"},"matches ...");const{includes:s,excludes:r}=n;return e.createElement(e.Fragment,null,s.length>0&&e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"matches")," ",s.map((a,o)=>e.createElement(e.Fragment,{key:o},o>0&&e.createElement("span",{className:"text-secondary"},", "),e.createElement("b",null,a)))),s.length>0&&r.length>0&&e.createElement("span",{className:"text-secondary"}," and "),r.length>0&&e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},"does not match")," ",r.map((a,o)=>e.createElement(e.Fragment,{key:o},o>0&&e.createElement("span",{className:"text-secondary"},", "),e.createElement("b",null,a)))))}}};function qt(t){return parseInt(t,10)}function Q(t){if(!t)return"days";const n=qt(t);return isNaN(n)?"days":n+" "+(n===1?"day":"days")}function J(t){if(!t)return"";const n=Ht(t);return n?ae(n,"PP"):""}function q(t,n,s){const r=t.values||[];return e.createElement(e.Fragment,null,e.createElement("span",{className:"text-secondary"},n+(r.length>1?" "+s:""))," ",r.map((a,o)=>e.createElement(e.Fragment,{key:o},o>0&&e.createElement("span",{className:"text-secondary"},", "),e.createElement("b",{key:o},a))))}const ie=t=>({"d-flex align-center":!0,"userflow-debugger-condition__item":!0,"userflow-debugger-condition__item__success":t===!0,"userflow-debugger-condition__item__danger":t===!1,"userflow-debugger-condition__item__intermediate":t===null}),ce=t=>t===!0?D:t===!1?I:L,Oe=(t,n)=>{const s=S();return i.useMemo(()=>{const o=(n?s?.hiddenCondition?.breakdown:s?.startCondition?.breakdown)?.find(l=>l.conditionId===t.id);return{classes:ie(o?.match),icon:ce(o?.match)}},[t,s,n])},W=t=>{const{condition:n,isHideCond:s}=t,{classes:r,icon:a}=Oe(n,s),o=n.type;if(o===N.CLAUSE)return e.createElement(Wt,{...t});const l=Ie[o];return e.createElement("div",{className:g(r)},e.createElement("span",{className:"d-flex gap-8 align-center userflow-debugger-condition__item__icon"},l.icon?e.createElement(m,{icon:l.icon({condition:n})}):null,e.createElement(l.Preview,{...t})),e.createElement(m,{dataAttrs:{"data-condition-status":"true"},icon:a}))},Gt=()=>{const t=S(),[n,s]=i.useState(!1),r=i.useMemo(()=>t?.hiddenCondition?.breakdown.find(o=>o.conditionId===t?.hiddenCondition?.condition.id),[t?.hiddenCondition]);return t?.hiddenCondition?.condition?e.createElement("div",{role:"button",className:g({"d-flex gap-8 flex-column margin-8":!0,"userflow-debugger-condition__clause":!0,"userflow-debugger-hide-condition__clause__success":r?.match===!0,"userflow-debugger-hide-condition__clause__danger":r?.match===!1,"userflow-debugger-hide-condition__clause__expanded":n}),onClick:a=>{s(!n),a.stopPropagation()}},e.createElement("div",{className:"d-flex gap-8 justify-space-between align-center"},e.createElement("span",null,"Termporarily hide flow"," ",e.createElement("span",{className:"userflow-debugger-info-text"},"Click to ",n?"collapse":"expand")),e.createElement(m,{icon:k})),n&&e.createElement(W,{isRoot:!0,isHideCond:!0,condition:t?.hiddenCondition?.condition})):null},Wt=({condition:t,isRoot:n=!1,isHideCond:s=!1})=>{const[r,a]=i.useState(!1),{classes:o,icon:l}=Oe(t,s);return n?e.createElement(e.Fragment,null,t.conditions.map((c,p)=>e.createElement(W,{isHideCond:s,key:p,condition:c}))):e.createElement("div",{role:"button",className:g({"d-flex flex-column gap-8":!0,"userflow-debugger-condition__clause":r,...r?{"userflow-debugger-condition__item__success__expanded":o["userflow-debugger-condition__item__success"],"userflow-debugger-condition__item__danger__expanded":o["userflow-debugger-condition__item__danger"],"userflow-debugger-condition__item__intermediate__expanded":o["userflow-debugger-condition__item__intermediate"]}:o}),onClick:c=>{a(!r),c.stopPropagation()}},e.createElement("div",{className:"d-flex justify-space-between align-center w-full"},e.createElement("span",{className:"d-flex gap-8 align-center"},e.createElement(m,{icon:et})," ",e.createElement("strong",null,"Logic Group")," ",e.createElement("span",{className:"userflow-debugger-info-text"},"Click to ",r?"collapse":"expand")),!r&&e.createElement(m,{dataAttrs:{"data-condition-status":"true"},icon:l})),r&&e.createElement(e.Fragment,null,t.conditions.map((c,p)=>e.createElement("div",{key:p,className:g({"userflow-debugger-condition__clause__operator__wrapper":!0})},p>0&&e.createElement("div",{className:g({"userflow-debugger-condition__clause__operator":!0})},e.createElement(De,{condition:t})),e.createElement(W,{isHideCond:s,condition:c})))))},De=({condition:t})=>{const n=t.operator;return n?e.createElement("span",{className:g({"userflow-debugger-condition__item__operator":!0,"userflow-debugger-condition__item__operator__and":n===d.AND,"userflow-debugger-condition__item__operator__or":n===d.OR})},n===d.AND&&"AND",n===d.OR&&"OR"):null},jt={[T.NONE]:I,[T.PENDING_SCHEDULE]:I,[T.SCHEDULED]:L,[T.FIRED]:D},zt=e.memo(()=>{const t=S(),{waitTimer:n}=t||{},s=t?.startCondition?.condition.waitTime,{ref:r,hovered:a,eventHandlers:o}=j();return!s||!n||n===T.NONE?null:e.createElement("div",{ref:r,...o,className:g({"d-flex align-center":!0,"userflow-debugger-condition__item":!0,"userflow-debugger-condition__item__danger":n===T.PENDING_SCHEDULE,"userflow-debugger-condition__item__intermediate":n===T.SCHEDULED,"userflow-debugger-condition__item__success":n===T.FIRED})},e.createElement("span",{className:"d-flex gap-8 align-center"},e.createElement(m,{icon:Ye}),e.createElement("span",null,"Wait ",e.createElement("strong",null,s)," seconds")),e.createElement(m,{dataAttrs:{"data-condition-status":"true"},icon:jt[n]}),e.createElement(z,{target:r,hovered:a&&n===T.PENDING_SCHEDULE},"Timer activates once all conditions are satisfied"))}),Yt=e.memo(()=>{const t=S(),[n,s]=i.useState(!1),{startFrequency:r,listFlowLatestVersion:a}=t||{startFrequency:{}};if(!r||!a?.startFrequency||a?.startFrequency===U.NEVER)return null;const{currentFlowIntervalThrottle:o,frequency:l,frequencyUsage:c}=r,p=ce(l),_=ie(l);if(a.startFrequency===U.ONCE||a.startFrequency===U.ONCE_PER_GROUP)return e.createElement("div",{className:g(_)},e.createElement("span",{className:"d-flex gap-8 align-center"},e.createElement(m,{icon:ve}),e.createElement("strong",null,"Once per user"," ",a.startFrequency===U.ONCE_PER_GROUP&&"per company")),e.createElement(m,{dataAttrs:{"data-condition-status":"true"},icon:p}));if(a.startFrequency===U.ALWAYS&&a.startIntervalValue&&a.startIntervalUnit)return e.createElement("div",{className:g({"d-flex align-center":!0,"userflow-debugger-condition__item":!0,"userflow-debugger-condition__item__success":o===!0,"userflow-debugger-condition__item__intermediate":o===!1})},e.createElement("span",null,"Every ",e.createElement("strong",null,a.startIntervalValue)," ",e.createElement("span",{className:"userflow-debugger-info-text"},te(a.startIntervalUnit,a.startIntervalValue)," ","apart")),e.createElement(m,{dataAttrs:{"data-condition-status":"true"},icon:o===!1?L:D}));if(a.startFrequency===U.MULTIPLE){const E=l===!0&&o===!0,h=l===!0&&o===!1,x=l===!1;return e.createElement("div",{className:g({"d-flex flex-column gap-8":!0,"userflow-debugger-condition__item":!0,"userflow-debugger-condition__clause":n,...n?{"userflow-debugger-condition-frequency__success__expanded":E,"userflow-debugger-condition-frequency__intermediate__expanded":h,"userflow-debugger-condition-frequency__danger__expanded":x}:{"userflow-debugger-condition-frequency__success":E,"userflow-debugger-condition-frequency__intermediate":h,"userflow-debugger-condition-frequency__danger":x}}),onClick:C=>{s(!n),C.stopPropagation()}},e.createElement("div",{className:"d-flex gap-8 justify-space-between"},e.createElement("div",{className:"d-flex gap-8 align-center"},e.createElement("strong",null,"Start multiple times")," ",e.createElement("span",{className:"userflow-debugger-info-text"},"Click to expand")),!n&&e.createElement(m,{dataAttrs:{"data-condition-status":"true"},icon:E?D:h?L:I})),n&&e.createElement(e.Fragment,null,e.createElement("div",{className:g(_)},e.createElement("span",null,e.createElement("strong",null,a.startLimit)," ",e.createElement("span",{className:"userflow-debugger-info-text"},"(started ",c," times)")),e.createElement(m,{dataAttrs:{"data-condition-status":"true"},icon:p})),a.startIntervalUnit&&a.startIntervalValue&&e.createElement("div",{className:g({"d-flex align-center":!0,"userflow-debugger-condition__item":!0,"userflow-debugger-condition__item__success":o===!0,"userflow-debugger-condition__item__intermediate":o===!1})},e.createElement("span",null,e.createElement("strong",null,a.startIntervalValue)," ",e.createElement("span",{className:"userflow-debugger-info-text"},te(a.startIntervalUnit,a.startIntervalValue)," ","apart")),e.createElement(m,{dataAttrs:{"data-condition-status":"true"},icon:o===!1?L:D}))))}return null}),Xt=()=>{const t=S(),{priority:n}=t||{};return n?.priority?e.createElement("div",{className:g({"d-flex align-center":!0,"userflow-debugger-condition__item":!0,"userflow-debugger-condition__item__priority":!0})},e.createElement("span",null,e.createElement("strong",null,Pt(n?.priority))," ",e.createElement("span",{className:"userflow-debugger-info-text"},"Click to learn more")),e.createElement("a",{href:"https://docs.userflow.com/docs/trouble/using-the-debugger#flow-trigger-precedence",target:"_blank",rel:"noreferrer noopener"},e.createElement(m,{icon:_e}))):null},Kt=()=>{const t=S(),{startFrequency:n}=t||{},{onlyIfNotCompleted:s}=n||{};return s==null?null:e.createElement("div",{className:g({"d-flex align-center":!0,"userflow-debugger-condition__item":!0,"userflow-debugger-condition__item__success":s===!0,"userflow-debugger-condition__item__danger":s===!1})},"Only if not completed",e.createElement(m,{icon:s===!0?D:I}))},$t=()=>{const t=S(),{startFrequency:n}=t||{},{hovered:s,eventHandlers:r,ref:a}=j();return!n||n?.scopeByGroup===null||n.scopeByGroup===void 0||n.scopeByGroup===!0?null:e.createElement("div",{ref:a,...r,className:g({"d-flex align-center margin-8":!0,"userflow-debugger-condition__item":!0,"userflow-debugger-condition__item__danger":!0})},"Constrain to current company",e.createElement(m,{icon:ce(n.scopeByGroup)}),e.createElement(z,{target:a,hovered:s},"User is not associated with a company"))},Zt=()=>{const t=S(),{startFrequency:n,listFlowLatestVersion:s}=t||{},{anyFlowIntervalThrottle:r}=n||{},{throttleUnit:a,throttleValue:o}=s||{};return r===null||a===null||o===null||a===void 0||o===void 0?null:e.createElement("div",{className:g({"d-flex align-center":!0,"userflow-debugger-condition__item":!0,"userflow-debugger-condition__item__success":r===!0,"userflow-debugger-condition__item__intermediate":r===!1})},e.createElement("span",null,"Atleast ",e.createElement("strong",null,s?.throttleValue)," ",te(a,o)," after any flow"),e.createElement(m,{dataAttrs:{"data-condition-status":"true"},icon:r===!0?D:L}))},Qt=e.memo(()=>{const{hovered:t,eventHandlers:n,ref:s}=j(),r=S(),{snoozed:a}=r||{},o=i.useMemo(()=>{if(a?.until)return ae(new Date(a.until),"MMM do, h:mm a")},[a?.until]);return a?e.createElement("div",{ref:s,...n,className:g({"d-flex align-center margin-8":!0,"userflow-debugger-condition__item":!0,"userflow-debugger-condition__item__intermediate":!0})},e.createElement("span",{className:"d-flex gap-8 align-center"},e.createElement(m,{icon:Xe}),e.createElement("span",null,"This flow is currently ",e.createElement("strong",null,"snoozed"))),e.createElement(m,{dataAttrs:{"data-condition-status":"true"},icon:L}),e.createElement(z,{target:s,hovered:t},"Snoozed until ",o)):null}),Ie={[N.PAGE]:{icon:()=>Ke,Preview:({condition:t})=>{const n=t.operator&&Z[t.operator];return e.createElement("span",null,"URL"," ",e.createElement("strong",null,n&&e.createElement(n.Preview,{condition:t})))}},[N.ATTRIBUTE]:{icon:({condition:t})=>{if(!t||!t.attributeName)return me(Te.EVENT);const[n]=Rt(t.attributeName);return me(n)},Preview:({condition:t})=>{const n=t.operator&&Z[t.operator];return e.createElement("span",null,e.createElement("strong",null,t.attributeDisplayName?t.attributeDisplayName:"Attribute")," ",e.createElement("span",{className:"userflow-debugger-info-text"},n&&e.createElement(n.Preview,{condition:t})))}},[N.SEGMENT]:{icon:()=>$e,Preview:({condition:t})=>{const{segment:n}=t;return e.createElement("span",null,e.createElement("strong",null,n?.subjectType===Ue.GROUP?"Company":"User")," ",e.createElement("span",{className:"text-secondary"},t.operator===d.FALSE?"is not in":"is in")," ",e.createElement("strong",null,n?.name||"Segment"))}},[N.ELEMENT]:{icon:({condition:t})=>t.elementState?_t[t.elementState]:Ze,Preview:({condition:t})=>e.createElement("span",null,"Element"," ",t.elementState&&e.createElement("strong",null,Ct(t.elementState)))},[N.INPUT_VALUE]:{icon:()=>Qe,Preview:({condition:t})=>{const n=t.operator&&Z[t.operator];return e.createElement("span",null,"The value of input"," ",e.createElement("strong",null,n&&e.createElement(n.Preview,{condition:t})))}},[N.FILLED_IN_INPUT]:{icon:()=>Je,Preview:()=>e.createElement("span",null,"User fills an input")},[N.FLOW]:{icon:({condition:t})=>t.flowState?wt[t.flowState]:se,Preview:({condition:t})=>t.flow?.type===F.SITE?null:e.createElement("span",null,t.flow?e.createElement(e.Fragment,null,At(t.flow.type,{title:!0})," ",e.createElement("strong",null,t.flow.name)):"Flow/checklist"," ",t.flowState&&xt(t.flowState))},[N.TIME]:{icon:()=>ve,Preview:({condition:t})=>{const n=t.value?ge(t.value):null,s=n&&e.createElement("strong",{style:{whiteSpace:"nowrap"}},pe(n)),r=t.value2?ge(t.value2):null,a=r&&e.createElement("strong",{style:{whiteSpace:"nowrap"}},pe(r));return s&&a?e.createElement("span",null,"Current time is between ",s," and ",a):s?e.createElement(e.Fragment,null,"Current time is after ",s):a?e.createElement(e.Fragment,null,"Current time is before ",a):e.createElement(e.Fragment,null,"Current time is ...")}},[N.EVENT]:{icon:()=>be,Preview:({condition:t})=>{const{ref:n,hovered:s,eventHandlers:r}=j();return e.createElement("div",{ref:n,...r},e.createElement("strong",null,t.eventDisplayName?t.eventDisplayName:"Event")," ",e.createElement("span",{className:"userflow-debugger-info-text"},It(t.eventFrequencyOperator))," ",e.createElement("strong",null,t.eventFrequencyValue),t.eventFrequencyOperator===A.BETWEEN&&e.createElement(e.Fragment,null," ",e.createElement("span",{className:"userflow-debugger-info-text"},"and")," ",e.createElement("strong",null,t.eventFrequencyValue2))," ",e.createElement("span",{className:"userflow-debugger-info-text"},Tt(t),","," ",Ft(t.eventTimeOperator)),t.eventTimeOperator!==O.ANY&&e.createElement(e.Fragment,null," ",e.createElement("strong",null,t.eventRelativeValue),t.eventTimeOperator===O.RELATIVE_BETWEEN&&e.createElement(e.Fragment,null," ",e.createElement("span",{className:"userflow-debugger-info-text"},"and")," ",e.createElement("strong",null,t.eventRelativeValue2))," ",e.createElement("span",{className:"userflow-debugger-info-text"},St(t,t.eventRelativeUnit))),t.eventActor&&t.eventActor!==Ae.CURRENT_USER?e.createElement(e.Fragment,null," ",e.createElement("strong",null,Dt(t.eventActor))):"",t.whereCondition&&s&&e.createElement(z,{hovered:!0,target:n},"Where ",e.createElement("br",null),e.createElement(Fe,{condition:t.whereCondition})))}},[N.ALWAYS_TRUE]:{icon:()=>D,Preview:()=>e.createElement("span",null,"Water is wet")},[N.CHECKLIST_TASK_CLICKED]:{icon:()=>Ee,Preview:()=>e.createElement("span",null,"Task is clicked")}},Fe=t=>e.createElement("div",null,t.condition.conditions.map((n,s)=>e.createElement("div",{key:n.id}," ",s===0?null:e.createElement("span",{className:"userflow-debugger-info-text"},t.condition.operator?.toLowerCase())," ",n.type==="ATTRIBUTE"&&Ie.ATTRIBUTE.Preview({condition:n,isRoot:!0,isHideCond:!1}),n.type==="CLAUSE"&&e.createElement(e.Fragment,null,"(",e.createElement(Fe,{condition:n}),")")))),z=({hovered:t,children:n,target:s})=>{const r=oe();return t?e.createElement(ye,{className:"userflow-debugger-popover",target:s.current,placement:"top",horizontalAlign:"center",verticalAlign:"center",document:r?.current?.contentDocument||void 0},n):null};class Jt extends e.PureComponent{constructor(n){super(n),this.rootRef=e.createRef(),this.optionsElRef=e.createRef(),this.input=null,this.popoverRef=e.createRef(),this.isMouseDown=!1,this.isCreateOpen=!1,this.setInput=s=>{this.input=s;const{inputRef:r}=this.props;r&&(typeof r=="function"?r(s):r.current=s)},this.onInputChange=s=>{s.stopPropagation();const{value:r}=s.target;r!==""&&this.openPopover();const a=this.memoizedFilterOptions(this.props.options,r);this.setState({inputValue:r,q:r,highlightedIndex:a.length>0?0:-1,createHighlighted:a.length===0}),r===""&&!this.props.noEmpty&&this.triggerOnChange(null),this.props.onSearchChange&&this.props.onSearchChange(r)},this.onPopoverPlacementChange=s=>this.setState({popoverPlacement:s}),this.onMouseDown=s=>{s.preventDefault(),this.isMouseDown=!0;const r=()=>{this.isMouseDown=!1,this.props.document?.removeEventListener("mouseup",r),document.body.removeEventListener("mouseup",r)};this.props.document?.addEventListener("mouseup",r),document.body.addEventListener("mouseup",r)},this.onFocus=s=>{this.input&&!this.props.noSearch&&this.input.select(),this.props.onFocus&&this.props.onFocus(s)},this.onBlur=s=>{this.isMouseDown||this.closePopover(),this.props.onBlur&&!this.isCreateOpen&&this.props.onBlur(s)},this.onClose=()=>{this.state.popoverOpen&&this.closePopover(),this.props.onClose&&this.props.onClose()},this.onTriggerClick=()=>{this.props.readOnly||this.props.disabled||(this.state.popoverOpen?this.closePopover():(this.input&&this.input.focus(),this.openPopover()))},this.onKeyDown=s=>{const{popoverOpen:r,highlightedIndex:a,createHighlighted:o}=this.state,l=this.getFilteredOptions(),c=l.length-1;switch(s.key){case"ArrowUp":s.preventDefault(),r&&(o?this.setState({highlightedIndex:c,createHighlighted:!1}):a>0&&this.setState({highlightedIndex:a-1}));break;case"ArrowDown":s.preventDefault(),r?this.props.onCreate&&(a===c||o)?this.setState({highlightedIndex:-1,createHighlighted:!0}):a<c&&this.setState({highlightedIndex:a+1}):this.props.noOpenOnDown||this.openPopover();break;case"Enter":if(r)if(s.preventDefault(),o&&!this.props.disableCreate)this.fireOnCreate();else{const p=l[a];p||!this.props.noEmpty?this.selectOption(p):!p&&this.props.hideOnEmpty&&this.props.onEnter&&this.props.onEnter()}else this.props.onEnter?this.props.onEnter():this.openPopover();break;case"Tab":r&&!this.props.ignoreTab&&this.selectOption(l[a]);break;case"Escape":r&&(s.preventDefault(),s.stopPropagation(),this.setState({popoverOpen:!1}));break}},this.selectOption=s=>{s===this.props.value?this.setState({popoverOpen:!1,inputValue:this.renderOptionText(s),q:""}):(this.setState({popoverOpen:!1,inputValue:"",q:""}),this.triggerOnChange(s))},this.highlightOption=s=>{this.setState({highlightedIndex:s,createHighlighted:!1})},this.highlightCreate=()=>{this.setState({highlightedIndex:-1,createHighlighted:!0})},this.fireOnCreate=()=>{const{onCreate:s}=this.props;if(s){this.isCreateOpen=!0;const r={q:ee.upperFirst(this.state.q),callback:a=>{this.isCreateOpen=!1,a!=null&&this.selectOption(a),this.input&&this.input.focus()}};s(r),this.closePopover()}},this.openPopover=()=>{if(!this.state.popoverOpen){const s=this.getFilteredOptions();let r=0,a=!1;if(s.length===0)r=-1,a=!0;else{const{value:o}=this.props,l=s.findIndex(c=>c===o);l!==-1&&(r=l)}this.setState({popoverOpen:!0,highlightedIndex:r,createHighlighted:a})}},this.memoizedFilterOptions=pt((s,r)=>(s=s||[],r?s.filter(a=>this.filter(a,r)):s)),this.state={inputValue:this.renderOptionText(n.value==null?null:n.value),q:"",popoverOpen:!1,popoverPlacement:null,highlightedIndex:-1,createHighlighted:!1}}componentDidUpdate(n,s){const{value:r}=this.props;if(r!==n.value){const a=this.renderOptionText(r??null);a!==this.state.inputValue&&this.setState({inputValue:a})}s.highlightedIndex!==this.state.highlightedIndex&&this.scrollHighlightedOptionIntoView()}render(){let n,s=!1;const{props:r}=this,a=this.state,o=a.popoverPlacement==="top"?"above":"below";if(a.popoverOpen&&this.rootRef.current){const c=this.getFilteredOptions();if(this.props.hideOnEmpty&&c.length===0)s=!0;else{let p;if(c.length>0){let _=null;p=c.reduce((E,h,x)=>{const C=this.getOptionGroup(h);C&&C!==_&&E.push(e.createElement("div",{key:"group:"+C,className:"combo-box__group-header"},C)),_=C;const u=["combo-box__option"];return x===a.highlightedIndex&&u.push("combo-box__option--highlighted"),this.props.optionClassName&&u.push(this.props.optionClassName),E.push(e.createElement(en,{key:this.getOptionKey(h,x),className:u.join(" "),option:h,idx:x,renderOptionText:r.renderOptionText,renderOptionItem:r.renderOptionItem,getOptionIcon:r.getOptionIcon,onClick:this.selectOption,onHover:this.highlightOption})),r.hasSeparatorAfter&&r.hasSeparatorAfter(h)&&E.push(e.createElement("div",{key:"sep-"+x,className:"combo-box__option-sep"})),E},[])}else r.loading?p=e.createElement("div",{className:"combo-box__no-results"},"Loading..."):p=e.createElement("div",{className:"combo-box__no-results"},"No matching ",r.nounPlural||"items");n=e.createElement(ye,{ref:this.popoverRef,className:"combo-box-popover"+(r.popoverNotch?"":` combo-box-popover--${o}`),noNotch:!r.popoverNotch,target:this.rootRef.current,forceDimension:!0,matchWidth:!0,minWidth:r.popoverMinWidth,onMouseDown:this.onMouseDown,onPlacementChange:this.onPopoverPlacementChange,document:r.document},e.createElement("div",{ref:this.optionsElRef,className:g({"combo-box__options":!0,"combo-box__options--with-create":!!r.onCreate})},p),r.onCreate&&e.createElement("div",{key:"create",className:g({"combo-box__option":!0,"combo-box__option--create":!0,"combo-box__option--highlighted":a.createHighlighted}),onClick:this.fireOnCreate,onMouseMove:this.highlightCreate},e.createElement("div",{className:"combo-box__create-icon"},e.createElement(G,{icon:tt})),e.createElement("div",{className:"combo-box__create-text"},"Create"," ",a.q===""?"new"+(r.noun?` ${r.noun}`:""):e.createElement("b",null,ee.upperFirst(a.inputValue)))))}}const l=["input-group","combo-box"];return a.popoverOpen&&!s&&(l.push("combo-box--open"),r.popoverNotch||l.push(`combo-box--with-popover-${o}`)),r.disabled&&l.push("input-group--disabled"),r.noSearch&&l.push("combo-box--no-search"),r.className&&l.push(r.className),e.createElement(e.Fragment,null,e.createElement("div",{className:l.join(" "),style:{width:r.width?r.width+"px":void 0},ref:this.rootRef,onClick:r.readOnly||r.disabled?void 0:()=>{this.input?.focus(),this.openPopover()}},r.childrenBefore,r.value&&r.getOptionIcon&&e.createElement("div",{className:"combobox__input-icon"},Pe(r.value,r.getOptionIcon)),e.createElement("input",{type:"text",className:r.inputClassName,name:r.name,value:a.inputValue,onChange:this.onInputChange,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,onMouseDown:this.openPopover,placeholder:r.placeholder,readOnly:r.readOnly||r.noSearch,disabled:r.disabled,autoComplete:"off",ref:this.setInput,...r.inputHtmlAttributes}),!r.noTrigger&&e.createElement("div",{"data-testid":r.triggerTestId||"combo-box-trigger",className:"input-group__append input-group__trigger",onClick:this.onTriggerClick,onMouseDown:this.onMouseDown},e.createElement(G,{icon:nt})),r.onClose&&e.createElement("div",{className:"input-group__append input-group__trigger",onClick:this.onClose},e.createElement(G,{icon:rt})),r.childrenAfter),n)}scrollHighlightedOptionIntoView(){const n=this.optionsElRef.current;if(this.state.popoverOpen&&n){const s=n.querySelector(".combo-box__option--highlighted");if(s){const r=n.getBoundingClientRect(),a=s.getBoundingClientRect();a.top<r.top?n.scrollTop+=a.top-r.top:a.bottom>r.bottom&&(n.scrollTop+=a.bottom-r.bottom)}}}triggerOnChange(n){const{onChange:s}=this.props;s&&s(n)}closePopover(){this.setState({popoverOpen:!1,inputValue:this.renderOptionText(this.props.value==null?null:this.props.value),q:""})}renderOptionText(n){return n==null?"":Le(n,this.props.renderOptionText)}getFilteredOptions(){return this.memoizedFilterOptions(this.props.options,this.state.q)}filter(n,s){return this.props.filter?this.props.filter(n,s):this.renderOptionText(n).toLowerCase().includes(s.toLowerCase())}getOptionKey(n,s){return n&&n.id||s}getOptionGroup(n){return this.props.getOptionGroup?this.props.getOptionGroup(n):n&&n.group||null}}class en extends e.PureComponent{constructor(){super(...arguments),this.state={isOptionDisabled:!1},this.onClick=()=>{this.state.isOptionDisabled||this.props.onClick(this.props.option)},this.onHover=()=>{this.state.isOptionDisabled||this.props.onHover(this.props.idx)}}componentDidMount(){const n=this.props.option!==void 0&&typeof this.props.option=="object"&&this.props.option!==null&&"disabled"in this.props.option&&this.props.option.disabled===!0;this.setState({isOptionDisabled:n})}componentDidUpdate(){const n=this.props.option!==void 0&&typeof this.props.option=="object"&&this.props.option!==null&&"disabled"in this.props.option&&this.props.option.disabled===!0;this.setState({isOptionDisabled:n})}render(){const{isOptionDisabled:n}=this.state,{props:s}=this;return e.createElement("div",{className:g({[s.className]:!0,"combo-box__option--disabled":n}),onClick:this.onClick,onMouseMove:this.onHover},tn(s.option,s.renderOptionText,s.renderOptionItem,s.getOptionIcon))}}function Le(t,n){return n?n(t):typeof t=="string"||typeof t=="number"?t:t?t.name:"?"}function tn(t,n,s,r){if(s)return s(t);{let a=Le(t,n);return r?e.createElement("div",{className:"d-flex align-flex-start"},e.createElement("div",{className:"combobox__option-icon"},Pe(t,r)),e.createElement("div",{className:"flex-1"},a)):a}}function Pe(t,n){const s=n(t);return nn(s)?e.createElement(G,{icon:s}):s}function nn(t){return gt(t)&&"iconName"in t}const rn=({selectedFlow:t,setSelectedFlow:n,flows:s,debugAutoStartCondition:r})=>{const a=P(),o=oe();i.useEffect(()=>{if(!t)return;r(t.latestVersion);const c=()=>{r(t.latestVersion)};return a.on("private:checkSessionsAck",c),document.addEventListener("visibilitychange",c),()=>{a.off("private:checkSessionsAck",c),document.removeEventListener("visibilitychange",c)}},[t]);const l=i.useCallback(c=>{!c||t?.latestVersion?.id===c.latestVersion.id||n(c)},[t]);return e.createElement(e.Fragment,null,e.createElement("div",{className:"d-flex align-center justify-space-between"},e.createElement("div",{className:"d-flex justify-space-between align-center"},"Select Flow"),e.createElement(Jt,{className:"userflow-debugger__flow__selector",value:t,options:s,placeholder:"Select flow",document:o?.current?.contentDocument||void 0,onChange:l,renderOptionItem:c=>c.name})),e.createElement(sn,{selectedFlow:t,selectedFlowVersionsId:t?.latestVersion?.id}))},sn=({selectedFlowVersionsId:t,selectedFlow:n})=>{const s=P(),[r,a]=i.useState(!1),o=S(),l=o&&o?.activeFlow?.id===n?.id;return i.useEffect(()=>(a(!1),s.on("private:setFlowSession",c=>{a(c===t)}),()=>{s.off("private:setFlowSession",()=>a(!1))}),[t]),i.useEffect(()=>{l||a(!1)},[l]),o?.activeFlow===null?null:e.createElement(e.Fragment,null,o?.locale?.match===!1&&e.createElement("div",{className:g(ie(!1))},e.createElement("span",{className:"d-flex gap-8 align-center"},e.createElement(m,{icon:I}),e.createElement("span",null,"The flow will not auto start ",e.createElement("br",null)," ",e.createElement("b",null,"User locale (",o?.locale?.code,") is not enabled.")))),r?e.createElement("div",{className:g({"d-flex align-center fade-in":!0,"userflow-debugger-condition__item":!0,"userflow-debugger-condition__flow__status":!0})},e.createElement("span",{className:"d-flex align-center gap-8"},e.createElement(m,{icon:k}),e.createElement("span",null,"This flow ",e.createElement("strong",null,"just")," started"))):null,l&&!r&&e.createElement("div",{className:g({"userflow-debugger-condition__item":!0,"userflow-debugger-condition__flow__status":!0})},e.createElement("span",{className:"d-flex align-center gap-8"},e.createElement(m,{icon:k}),e.createElement("span",null,"This flow is currently active"))),!l&&o&&e.createElement("div",{className:g({"userflow-debugger-condition__item":!0,"userflow-debugger-condition__flow__status":!0})},e.createElement("span",{className:"d-flex gap-8 align-center"},e.createElement(m,{icon:k,size:16}),e.createElement("span",null,"Another flow is currently active"))))},an=t=>{const[n,s]=i.useState(document.visibilityState==="visible"),r=i.useRef(t);return i.useEffect(()=>{r.current=t},[t]),i.useEffect(()=>{const a=()=>{const o=document.visibilityState==="visible";s(o),r.current?.(o)};return document.addEventListener("visibilitychange",a),()=>{document.removeEventListener("visibilitychange",a)}},[]),n},on=({close:t})=>{const n=P(),s=i.useRef(null),[r,a]=i.useState(!!n.clientToken),[o,l]=i.useState(()=>{const f=n.getSessionStorageState(),v=f?.debuggerApp?.x,y=f?.debuggerApp?.y||50;return{x:v??(document.body.clientWidth?Number(document.body.clientWidth)-450:50),y}}),[c,p]=i.useState(!1),_=i.useRef(null),{meta:E}=V(),{debuggerRoute:h}=le(),[x,C]=i.useState(!1),u=i.useRef(null),w=i.useRef({mouseX:0,mouseY:0,elementX:0,elementY:0});i.useEffect(()=>{o&&n.setSessionStorageState(f=>({...f,debuggerApp:{...f.debuggerApp,x:o.x,y:o.y}}))},[o]),i.useEffect(()=>{if(!c)return;const f=y=>{const R=y.clientX-w.current.mouseX,Y=y.clientY-w.current.mouseY,X=Math.min(w.current.elementX+R,window.document.body.clientWidth-200),K=Math.max(w.current.elementY+Y,0);u.current||(u.current=requestAnimationFrame(()=>{l({x:X,y:K}),u.current=null}))},v=()=>{p(!1)};return document.addEventListener("mousemove",f),document.addEventListener("mouseup",v),()=>{document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",v),u.current&&(cancelAnimationFrame(u.current),u.current=null)}},[c,o]),i.useEffect(()=>{const f=()=>{l(y=>{const R=document.body.clientWidth-500,Y=document.body.clientHeight-100,X=Math.max(Math.min(y.x,R),0),K=Math.max(Math.min(y.y,Y),0);return{x:X,y:K}})},v=()=>{a(!!n.clientToken)};return window.addEventListener("resize",f),n.on("private:initialised",v),()=>{window.removeEventListener("resize",f),n.off("private:initialised",v)}},[]);const b=f=>{s.current&&(p(!0),f.preventDefault())};return e.createElement("div",{ref:s,style:{left:"0",top:"0",position:"absolute",willChange:"transform",transform:`translate3d(${o.x}px, ${o.y}px, 0)`,zIndex:1234620}},e.createElement("div",{onMouseDown:b,style:{height:"50px",cursor:"move",userSelect:"none",position:"absolute",width:"50px"}}),e.createElement(Ve,{title:"Debugger",stylesheet:ft,style:{borderRadius:"8px",width:"400px",height:h==="checkAutoStart"?"600px":r?"500px":"400px"},elRef:_,onStylesheetsLoad:C},e.createElement(Ne.Provider,{value:_},e.createElement("div",{className:"d-flex flex-column userflow-debugger-app",style:{visibility:x?"visible":"hidden"}},e.createElement("div",{className:"d-flex justify-space-between userflow-debugger-app__header"},e.createElement(bt,null),e.createElement("div",{className:"d-flex align-center userflow-debugger-app__title"},e.createElement(He,null),e.createElement("span",null,"Userflow debugger")),e.createElement("button",{role:"button",className:"userflow-debugger-app__close",onClick:()=>{n.getSessionStorageState().debuggerApp&&n.setSessionStorageState(f=>({...f,debuggerApp:null})),t()}},e.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e.createElement("path",{d:"M12.1836 4.49609L8.90234 7.77734L12.1562 11.0312C12.4297 11.2773 12.4297 11.6875 12.1562 11.9336C11.9102 12.207 11.5 12.207 11.2539 11.9336L7.97266 8.67969L4.71875 11.9336C4.47266 12.207 4.0625 12.207 3.81641 11.9336C3.54297 11.6875 3.54297 11.2773 3.81641 11.0039L7.07031 7.75L3.81641 4.49609C3.54297 4.25 3.54297 3.83984 3.81641 3.56641C4.0625 3.32031 4.47266 3.32031 4.74609 3.56641L8 6.84766L11.2539 3.59375C11.5 3.32031 11.9102 3.32031 12.1836 3.59375C12.4297 3.83984 12.4297 4.25 12.1836 4.49609Z",fill:"white"})))),e.createElement(ln,null),h==="verifySetup"&&e.createElement(cn,null),E?.endUser?.debuggerEnabled&&h==="checkAutoStart"&&e.createElement(un,null),h==="currentUser"&&e.createElement(dn,null)))))},ln=()=>{const t=P(),{meta:n}=V(),[s,r]=i.useState(!1),{debuggerRoute:a,setDebuggerRoute:o}=le(),l=t.isIdentified(),c=ht(()=>r(!1));return i.useEffect(()=>{n&&n?.endUser.debuggerEnabled===!1&&a==="checkAutoStart"&&o("verifySetup")},[n]),l?e.createElement("div",{ref:c},e.createElement("div",{className:"d-flex align-center justify-space-between userflow-debugger-menu",onClick:()=>r(!s)},e.createElement("div",{className:g({"d-flex align-center":!0,"userflow-debugger-menu__title":!0,"userflow-debugger-menu__title--open":s})},e.createElement(m,{icon:B[a].icon}),e.createElement("span",null,B[a].name)),e.createElement("button",{className:"userflow-debugger-menu__toggle"},e.createElement(m,{icon:st}))),s&&e.createElement("ul",{className:"userflow-debugger-menu__list"},Object.keys(B).map(p=>{if(!n?.endUser?.debuggerEnabled&&p==="checkAutoStart")return null;const _=B[p];return e.createElement("li",{key:p,className:"d-flex align-center userflow-debugger-app__item",onClick:()=>{o&&o(p),r(!1)}},e.createElement(m,{icon:_.icon}),_.name)}))):null},cn=()=>{const{meta:t,buildId:n}=V(),s=P(),[r,a]=i.useState(!!s.clientToken),o=i.useMemo(()=>s.isIdentified(),[s,t]),{setDebuggerRoute:l}=le();i.useEffect(()=>{const E=()=>{a(!!s.clientToken)};return s.on("private:initialised",E),()=>{s.off("private:initialised",E)}},[]);const c=i.useMemo(()=>{let E=$;const h={"d-flex flex-column gap-8":!0,"userflow-debugger-installation__step":!0};return r?(E=M,h["userflow-debugger-installation__step__success"]=!0):(E=it,h["userflow-debugger-installation__step__danger"]=!0),{icon:E,classes:h}},[r]),p=i.useMemo(()=>{let E=$;const h={"d-flex flex-column gap-8":!0,"userflow-debugger-installation__step":!0};return!r&&!o&&(E=$,h["userflow-debugger-installation__step__failed"]=!0),r&&!o&&(E=k,h["userflow-debugger-installation__step__warning"]=!0),r&&o&&(E=M,h["userflow-debugger-installation__step__success"]=!0),{icon:E,classes:h}},[r,o]),_=()=>o?t?.endUser.debuggerEnabled?e.createElement(e.Fragment,null,e.createElement("span",{className:"userflow-debugger-details"},t?.env.company.name),e.createElement("span",{className:"userflow-debugger-details"},t?.env.name)):e.createElement("div",{className:"userflow-debugger-details__access__denied"},"The"," ",e.createElement("button",{onClick:()=>l("currentUser")},"currently signed-in user")," ","does not have debugger access"):e.createElement(e.Fragment,null,e.createElement("span",{className:"userflow-debugger-details"},"Unknown company"),e.createElement("span",{className:"userflow-debugger-details"},"Unknown environment"));return e.createElement("div",{className:"space-evenly userflow-debugger-app__content"},e.createElement("div",{className:"userflow-debugger-installation__steps"},e.createElement("div",{className:g({"d-flex gap-8 flex-column":!0,"userflow-debugger-installation__step":!0,"userflow-debugger-installation__step__success":!0})},e.createElement(m,{icon:M,size:32}),"Userflow ",e.createElement("br",null),"installed"),e.createElement("div",{className:g(c.classes)},e.createElement(m,{icon:c.icon,size:32}),"Userflow ",e.createElement("br",null)," ",r?"":"not"," initialized"),e.createElement("div",{className:g(p.classes)},e.createElement(m,{icon:p.icon,size:32}),"User ",e.createElement("br",null)," ",o&&r?"":"not"," ","identified")),!r&&!o&&e.createElement("div",{className:g({"d-flex gap-8 flex-column":!0,"userflow-debugger-installation__not__initialized":!0})},"Remember to initialize Userflow by calling",e.createElement("div",null,"userflow.init('YOUR_USERFLOW_TOKEN')")),r&&e.createElement("div",{className:"d-flex gap-8 flex-column userflow-debugger-details__wrapper"},e.createElement("div",{className:"userflow-debugger-details__env__details"},e.createElement("div",{className:"d-flex gap-8 flex-column justify-space-around"},e.createElement(m,{size:20,icon:at}),e.createElement(m,{size:20,icon:ot})),e.createElement("div",{className:"d-flex flex-column align-flex-start gap-8"},_())),e.createElement("div",{className:"d-flex gap-8 align-center"},e.createElement(m,{size:20,icon:lt}),e.createElement("span",{className:"userflow-debugger-details"},s.getInitToken())),e.createElement("div",{className:"d-flex gap-8 align-center"},e.createElement(m,{size:20,icon:re}),e.createElement("span",{className:"userflow-debugger-details"},o?s.getIdentifiedUser()?.externalId:"User not identified"))),e.createElement("div",{className:"userflow-debugger-installation__version"},e.createElement("a",{href:"https://docs.userflow.com/docs/dev/userflow-js-installation",target:"_blank",rel:"noreferrer"},"Visit the Userflow Developer Docs for help")," ",e.createElement("br",null),"Userflow.js version 0.1.",n))},un=()=>{const t=P(),{debuggerClientConditions:n}=V(),[s,r]=i.useState(void 0),[a,o]=i.useState([]),[l,c]=i.useState(),p=i.useMemo(()=>{if(l?.startCondition?.match===!1||l?.hiddenCondition?.match===!0||l?.locale?.match===!1)return!1;const u=l?.startFrequency;return!(u&&(u.onlyIfNotCompleted===!1||u.scopeByGroup===!1||u.frequency===!1))},[l]);i.useEffect(()=>{_()},[]),an(u=>{u&&_()}),i.useEffect(()=>{s&&x(s.latestVersion)},[s]);const _=async()=>{C().then(u=>{if(u?.length&&(o(u),!s)){const w=t.getSessionStorageState()?.debuggerApp?.selectedFlowVersionId,b=u.find(f=>f.latestVersion.id===w);h(b??u[0])}})},E=we.debounce(async u=>{const w=[];for(const[v,y]of n.entries())w.push({conditionId:v,isTrue:y.isTrue});const b={kind:"DebugFlowAutostartCondition",flowVersionId:u.id,clientConditions:w},f=await t.send(b);c({...f,listFlowLatestVersion:u}),f.latestVersion?.id&&u.id!==f.latestVersion?.id&&(C().then(v=>{if(!v)return;o(v);const y=v?.find(R=>R.latestVersion.id===f.latestVersion?.id);y&&h(y)}),E(f.latestVersion))},300),h=u=>{r(u);const w=t.getSessionStorageState().debuggerApp;w&&w?.x&&t.setSessionStorageState(b=>({...b,debuggerApp:{...w,selectedFlowVersionId:u.latestVersion.id}}))},x=async u=>{n.forEach(b=>{b.untrack?.()}),n.clear();const{conditionTypes:w}=await Me(async()=>{const{conditionTypes:b}=await import("./flow-condition-types.js").then(f=>f.f);return{conditionTypes:b}},__vite__mapDeps([0,1,2,3,4,5,6,7]));for(const b of u.clientConditions){n.set(b.id,{condition:b,isTrue:null});const f=w[b.type];if(!f){console.error(`Unknown condition type ${b.type}`);continue}const v=n.get(b.id);v&&(v.untrack=f.track({sessionData:new ke([]),condition:b,callback:y=>{v.isTrue!==y&&(v.isTrue=y,E(u))}}))}},C=async()=>{try{return(await t.send({kind:"ListFlows",hasAutostartCondition:!0},{handlesRejection:!0})).flows?.filter(b=>b.type==="FLOW")}catch(u){u.code==="debugger_access_denied"&&ne("Access defined for List Flows");return}};return e.createElement("div",{className:"userflow-debugger-app__content"},e.createElement(Ce.Provider,{value:l},e.createElement(rn,{flows:a,selectedFlow:s,setSelectedFlow:h,debugAutoStartCondition:E}),e.createElement("div",{className:"d-flex flex-column gap-8 userflow-debugger-app__wrapper"},l?.startCondition?.condition&&e.createElement("div",null,e.createElement("div",{className:g({"d-flex gap-8 align-center":!0,"userflow-debugger-app__wrapper__passing":p,"userflow-debugger-app__wrapper__failed":!p})},e.createElement(m,{icon:p?ct:ut}),e.createElement("strong",null,"Auto-start conditions")),e.createElement("span",null,"These are"," ",e.createElement(De,{condition:l.startCondition.condition}),e.createElement("b",null,"-conditions"),", meaning"," ",l.startCondition.condition.type==="CLAUSE"&&l.startCondition.condition.operator==="AND"&&e.createElement(e.Fragment,null,"all conditions must pass for the flow to start."),l.startCondition?.condition.type==="CLAUSE"&&l.startCondition.condition.operator==="OR"&&e.createElement(e.Fragment,null,"only one condition must pass for the flow to start."))),l?.startCondition?.condition&&e.createElement(W,{isRoot:!0,isHideCond:!1,condition:l.startCondition.condition}),e.createElement(zt,null),e.createElement(Yt,null),e.createElement(Kt,null),e.createElement(Zt,null),e.createElement(Xt,null),e.createElement(Gt,null),e.createElement($t,null),e.createElement(Qt,null))))},dn=e.memo(()=>{const{meta:t,buildId:n}=V();if(!t)return null;const r="https://app.userflow.com/app/"+(t.env.primary?t.env.company.slug:`${t.env.company.slug}@${t.env.slug}`)+"/settings/debugger?external_id="+t.endUser.externalId;return e.createElement("div",{className:"d-flex flex-column space-evenly flex-1"},e.createElement("div",{className:"d-flex flex-column gap-8"},e.createElement("div",{className:"d-flex flex-column"},t.endUser.avatarUrl?e.createElement("img",{src:t.endUser.avatarUrl,className:"userflow-debugger-user__image"}):e.createElement("div",{className:"userflow-debugger-user__image"}),e.createElement("span",{className:"userflow-debugger-user__name"},t.endUser?.name||"Unknown name"),e.createElement("span",{className:"userflow-debugger-user__email"},t?.endUser?.email||"Unknown email address"),(!t.endUser.email||!t.endUser.name)&&e.createElement("span",{className:"userflow-debugger__external__id"},t.endUser.externalId)),!t.endUser.debuggerEnabled&&e.createElement(e.Fragment,null,e.createElement("div",{className:"userflow-debugger-user__info"},"This user doesn't have access to the Userflow debugger. You can grant access through the debugger settings in Userflow."),e.createElement("a",{className:"userflow-debugger-user__button",href:r,target:"_blank",rel:"noreferrer"},"Grant access in Userflow ",e.createElement(m,{icon:_e})))),e.createElement("div",{className:"userflow-debugger-installation__version"},e.createElement("a",{href:"https://docs.userflow.com/docs/dev/userflow-js-installation",target:"_blank",rel:"noreferrer"},"Visit the Userflow Developer Docs for help")," ",e.createElement("br",null),"Userflow.js version 0.1.",n))});class qn{constructor(n,s){this.client=n,this.buildId=s,this.debuggerClientConditions=new Map}mount(){if(this.container)throw new Error("UI has already been mounted");this.container=document.createElement("div"),this.container.id="userflow-debugger-ui",document.body.appendChild(this.container),ue.render(e.createElement(mn,{client:this.client,debuggerClientConditions:this.debuggerClientConditions,buildId:this.buildId,unmount:()=>this.unmount()}),this.container)}unmount(){this.container&&(ue.unmountComponentAtNode(this.container),document.body.contains(this.container)&&document.body.removeChild(this.container),this.client.unMountDebugger(),delete this.container)}}const mn=({client:t,debuggerClientConditions:n,buildId:s,unmount:r})=>{const[a,o]=i.useState(void 0),l=we.debounce(async()=>{try{const c=await t.send({kind:"GetCurrentEndUser"},{handlesRejection:!0});o(c)}catch(c){c.code==="debugger_access_denied"&&ne("debugger access denied"),o(void 0)}},300);return i.useEffect(()=>(l(),document.addEventListener("visibilitychange",l),t.on("private:identified",l),()=>{document.removeEventListener("visibilitychange",l),t.off("private:identified",l)}),[]),e.createElement(Re.Provider,{value:t},e.createElement(xe.Provider,{value:{meta:a,debuggerClientConditions:n,buildId:s}},e.createElement(Et,null,e.createElement(on,{close:r}))))};export{qn as DebuggerUI};
3
3
  //# sourceMappingURL=DebuggerUI.js.map
package/SitePage.js CHANGED
@@ -1,2 +1,2 @@
1
- import{R as e,r as d}from"./vendor.react.js";import{U as W,u as A,i as L}from"./client-context.js";import{r as Y}from"./vendor.react-dom.js";import{B as O,L as _}from"./vendor.react-router-dom.js";import{A as z,u as T,S as k,a as Q,b as q}from"./AnnouncementEngagement.js";import{D as I,u as y,a as P,g as G}from"./stylesheets.js";import{i as J}from"./iframe-reset.styl.js";import{S as X,u as E,R as N}from"./TreeDoc.js";import{g as C}from"./flow-condition-types.js";import{f as Z,a as ee,b as D}from"./vendor.fortawesome.pro-regular-svg-icons.js";import{f as te}from"./vendor.fortawesome.pro-solid-svg-icons.js";import{d as oe}from"./userflow.js";import{P as ne}from"./Popover.js";import{o as se}from"./vendor.obj-str.js";import{m as re}from"./vendor.memoize-one.js";import"./vendor.core-js.js";import{u as ie}from"./react-hooks.js";import{S as le,a as H,u as $,b as R,d as B}from"./vendor.react-router.js";import{u as V}from"./vendor.react-i18next.js";import"./vendor.object-assign.js";import"./vendor.i18next.js";import"./vendor.babel.runtime.js";import"./vendor.scheduler.js";import"./vendor.history.js";import"./vendor.resolve-pathname.js";import"./vendor.value-equal.js";import"./vendor.tiny-invariant.js";import"./vendor.prop-types.js";import"./use-confetti.js";import"./vendor.canvas-confetti.js";import"./roots.js";import"./vendor.date-fns.js";import"./vendor.phoenix.js";import"./vendor.uuid.js";import"./vendor.lodash.js";import"./vendor.mini-create-react-context.js";import"./vendor.path-to-regexp.js";import"./vendor.react-is.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new Error().stack;t&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[t]="f0188087-d34c-46bd-a630-698b745b2a2a",o._sentryDebugIdIdentifier="sentry-dbid-f0188087-d34c-46bd-a630-698b745b2a2a")}catch{}})();const ae=new URL("popover.css",import.meta.url).href,ce=new URL("site.css",import.meta.url).href;class F extends e.PureComponent{constructor(){super(...arguments),this.rootRef=e.createRef(),this.isScrollingIntoView=!1,this.state={highlightedIdx:this.props.disableAutoHighlight?-1:0},this.onKeyDown=t=>{const{highlightedIdx:n}=this.state,{items:r}=this.props,s=()=>{t.stopPropagation(),t.preventDefault()};switch(t.key){case"ArrowUp":s(),n>0?this.setHighlighted(n-1):n===-1&&this.setHighlighted(r.length-1);break;case"ArrowDown":s(),n<r.length-1?this.setHighlighted(n+1):n===-1&&this.setHighlighted(0);break;case"Enter":s(),this.selectItem(r[n]);break}},this.selectItem=t=>{this.props.onSelect(t)},this.onItemHover=t=>{this.isScrollingIntoView||(this.setState({highlightedIdx:t}),this.props.onItemHighlighted?.(this.props.items[t]))},this.onMouseLeave=()=>{const{clearHoverOnMouseLeave:t,selectedItem:n,items:r}=this.props;if(t)if(n){const s=r.findIndex(i=>i===n);this.setState({highlightedIdx:s})}else this.setState({highlightedIdx:-1})},this.memoizedStyle=re(t=>t==null?{}:{maxHeight:t,overflowY:"auto"})}componentDidMount(){this.props.autoFocus&&this.rootRef.current.focus({preventScroll:!0}),this.props.forwardedRef&&this.rootRef.current&&(typeof this.props.forwardedRef=="function"?this.props.forwardedRef(this.rootRef.current):this.props.forwardedRef.current=this.rootRef.current)}render(){const t=this.state,{selectedItem:n,clearHoverOnMouseLeave:r}=this.props;return e.createElement("div",{ref:this.rootRef,className:"key-nav-list",style:this.memoizedStyle(this.props.maxHeight),onKeyDown:this.onKeyDown,onMouseLeave:r?this.onMouseLeave:void 0,tabIndex:0},this.props.items.map((s,i)=>e.createElement(me,{key:i,item:s,idx:i,className:se({"key-nav-list__item":!0,"key-nav-list__item--highlighted":i===t.highlightedIdx,"key-nav-list__item--selected":s===n}),renderContent:this.props.children,onClick:this.selectItem,onHover:this.onItemHover})))}scrollHighlightedItemIntoView(){const t=this.rootRef.current,n=t.querySelector(".key-nav-list__item--highlighted");if(n){this.isScrollingIntoView=!0,window.clearTimeout(this.isScrollingIntoViewTimeout),this.isScrollingIntoViewTimeout=window.setTimeout(()=>this.isScrollingIntoView=!1,250);const r=t.getBoundingClientRect(),s=n.getBoundingClientRect();s.top<r.top?t.scrollTop+=s.top-r.top:s.bottom>r.bottom&&(t.scrollTop+=s.bottom-r.bottom)}}setHighlighted(t){this.setState({highlightedIdx:t},this.scrollHighlightedItemIntoView),this.props.onItemHighlighted?.(this.props.items[t])}}class me extends e.PureComponent{constructor(){super(...arguments),this.onClick=()=>this.props.onClick(this.props.item),this.onHover=()=>this.props.onHover(this.props.idx)}render(){const{props:t}=this;return e.createElement("div",{className:t.className,onClick:this.onClick,onMouseMove:this.onHover},t.renderContent(t.item,t.idx))}}e.forwardRef((o,t)=>e.createElement(F,{...o,forwardedRef:t}));function ue({testid:o,buttonText:t,value:n,onChange:r,options:s,renderOption:i,disabled:a,buttonStyle:c,htmlAttributes:l,comparator:m,showCheckIcon:g=!0}){const p=d.useRef(null),[f,h]=d.useState(!1),w=()=>{h(!1),p.current&&p.current.focus()},v=({key:u})=>{if(u.length===1){u=u.toLowerCase();for(const S of s){const x=i(S);if(typeof x=="string"&&x.toLowerCase().startsWith(u)){r(S);return}}}};return e.createElement(e.Fragment,null,e.createElement("button",{ref:p,"data-testid":o,type:"button",className:`btn btn-dynamic-icon ${c||"btn--plain-blue"} btn--sm ${f&&!a?"btn--popover-open":""}`,onClick:()=>h(!f),disabled:a,onKeyDown:v,...l},t||i(n),e.createElement(I,{icon:Z})),f&&!a&&p.current&&e.createElement(ne,{target:p.current,matchMinWidth:!0,onDismiss:w},e.createElement(F,{items:s,onSelect:u=>{w(),r(u)},autoFocus:!0},u=>e.createElement("div",{className:"d-flex"},g&&e.createElement("div",{className:"mr-8",style:(m?m(u,n):u===n)?void 0:{visibility:"hidden"}},e.createElement(I,{icon:ee})),i(u)))))}function de(o){const t=o?new Date(o):new Date;let n=new Intl.DateTimeFormat(L.language,{weekday:"long",day:"numeric",month:"short",year:t.getFullYear()===new Date().getFullYear()?void 0:"numeric"}).format(t);return n.substring(0,1).toUpperCase()+n.substring(1)}class ot{constructor(t,n){this.client=t,this.selector=n}mount(){if(this.container)throw new Error("SiteRoute has already been mounted");const t=document.querySelector(this.selector);if(!t)throw new Error(`SitePage: No element found for selector ${this.selector}`);this.container=t,Y.render(e.createElement(O,null,e.createElement(W.Provider,{value:this.client},e.createElement(fe,null))),this.container)}}const fe=()=>{const o=A();y(window,J),y(window,ae);const{loaded:t}=y(window,ce),[n,r]=d.useState(null),[s,i]=d.useState(void 0),a=n?.locale.standardLocaleId||n?.version.theme.languageId;return d.useEffect(()=>{a&&L.changeLanguage(a)},[a]),d.useEffect(()=>{const c=l=>{oe("Received site session",l),o.featureFlagEnabled("cff_site")!==!1&&r(l)};return o.on("private:siteSession",c),()=>{o.off("private:siteSession",c)}},[o]),!n||!t?null:e.createElement(X.Provider,{value:n},e.createElement(z,{key:n.locale.standardLocaleId},e.createElement(le,null,e.createElement(H,{exact:!0,path:"/:locale/:announcementId"},e.createElement(M,null,e.createElement(pe,{key:n.locale.standardLocaleId}))),e.createElement(H,{path:"/:locale"},e.createElement(M,null,e.createElement(he,{key:n.locale.standardLocaleId,listScrollTop:s,onSaveScrollPosition:()=>{i(window.scrollY)}}))))))},M=({children:o})=>{const t=E(),n=P(t.version.theme),r=t.version.theme.siteLogoAsset?.assetUrl,s=t.version.site,i=b();if(!s)return null;const{headerText:a,headerDescription:c,logoUrl:l}=s;return e.createElement("div",{style:G(n),className:"userflow-site__announcements"},i?e.createElement("div",{className:"text-bolder userflow-site-preview-banner"},"PREVIEW"):null,e.createElement(we,{headerText:a,headerDescription:c,companyLogoSrc:r,logoUrl:l,localeDropdown:e.createElement(ge,null)}),o)},he=({listScrollTop:o,onSaveScrollPosition:t})=>{const{t:n}=V(),r=E(),{announcements:s,loading:i,loadingMore:a,error:c,truncated:l,loadMore:m,submitReaction:g,submitComment:p}=T(),f=d.useRef(!1);return d.useLayoutEffect(()=>{o!=null&&window.scrollTo(0,o)},[o]),d.useEffect(()=>{if(i||a||l)return;const h=()=>{if(f.current)return;const w=window.scrollY,v=window.innerHeight;document.documentElement.scrollHeight-(w+v)<=400&&(f.current=!0,m().finally(()=>{f.current=!1}))};return window.addEventListener("scroll",h),()=>window.removeEventListener("scroll",h)},[l,i,a,m]),c?e.createElement("div",{className:"userflow-site__announcement-content"},"Failed in loading announcements"):i?e.createElement("div",{className:"userflow-site__announcement-content"},e.createElement(k,{center:!0,fadeIn:!0})):e.createElement("div",{className:"userflow-site__announcement-content"},s.length>0?e.createElement("div",{className:"userflow-site__announcement-list"},s.map(h=>e.createElement(U,{expanded:!1,key:h.id,announcement:h,enableTitleLinks:r.version.site?.enableTitleLinks,onReactionChange:g,onCommentSubmit:p,onSaveScrollPosition:t})),a?e.createElement(k,{center:!0,fadeIn:!0}):null):null,s.length===0?e.createElement("h3",{className:"userflow-site-empty-state text-extra-bold"},L.exists("resource_center.no_announcements",{fallbackLng:[]})?n("resource_center.no_announcements"):n("resource_center.no_results_found")):null)},U=({announcement:o,expanded:t=!1,enableTitleLinks:n,onReactionChange:r,onCommentSubmit:s,onSaveScrollPosition:i})=>{const a=$(),c=j(),l=A(),m=E(),g=P(m.version.theme),p=b(),f=d.useRef(null),h=n&&!!c,w=ie(f,{once:!0,rootMargin:"100px",disabled:o.seen===!0}),v=K(`/${c}/${p?o.id:o.permalink}`);d.useEffect(()=>{w&&o.seen===!1&&l.send({kind:"MarkAnnouncementSeen",announcementId:o.id,versionId:o.versionId},{batch:!0})},[w,o,l]);const u=()=>{c&&(i?.(),a.push(v))};return e.createElement("div",{ref:f,className:"userflow-site__card"},e.createElement("div",null,e.createElement("span",{className:"text-small text-secondary"},de(o.time)),e.createElement("div",null,h?e.createElement(_,{to:v,className:"h2-like text-extra-bold"},o.title):e.createElement("h2",{className:"h2-like text-extra-bold"},o.title))),e.createElement(N,{doc:o.content,buttons:o.buttons,lookupAttribute:C(o.data)}),o.moreEnabled&&t?e.createElement(N,{doc:o.moreContent,buttons:o.moreButtons,lookupAttribute:C(o.data)}):null,e.createElement(Q,{announcement:t?{...o,moreEnabled:!1}:o,confettiColors:g.confettiColors,onReactionChange:r,onCommentSubmit:s,onMoreClick:t?void 0:u},!t&&o.moreEnabled&&e.createElement("div",{className:"userflowjs-announcement-more--modal"},e.createElement("button",{className:"userflowjs-tertiary-button",onClick:u},o.moreButtonText||"Read more",e.createElement("span",{className:"userflowjs-rtl-mirrored userflowjs-tertiary-button__icon"},e.createElement(I,{icon:te}))))))},pe=()=>{const o=E(),{announcementId:t}=R(),{submitReaction:n,submitComment:r}=T(),s=b(),i=j(),a=K(`/${i}`),{t:c}=V(),{loading:l,data:m,error:g}=q({message:{kind:"GetAnnouncement",announcementId:t,permalink:!s},skip:!t});return l?e.createElement(k,{center:!0,fadeIn:!0}):g||!m?.announcement?e.createElement("div",{className:"userflow-site__announcement-content"},e.createElement("div",{className:"d-flex gap-16 flex-column mt-24"},e.createElement(_,{to:a,className:"userflow-site-link-button userflow-site-home-back-button"},e.createElement(I,{icon:D}),o.version.site?.homeButtonText||"All Announcements"),e.createElement("div",{className:"userflow-site__card userflow-site__card--not-found"},e.createElement("h3",{className:"userflow-site__announcement-not-found text-extra-bold"},c("site.page_not_found"))))):e.createElement("div",{className:"userflow-site__announcement-content"},m?.announcement&&e.createElement("div",{className:"d-flex gap-16 flex-column mt-24"},e.createElement(_,{to:a,className:"userflow-site-link-button userflow-site-home-back-button"},e.createElement(I,{icon:D}),o.version.site?.homeButtonText||"All Announcements"),e.createElement(U,{expanded:!0,announcement:m.announcement,onReactionChange:n,onCommentSubmit:r})))},ge=()=>{const o=$(),t=E(),n=b(),r=B(),{announcementId:s}=R();if(t?.kind!=="site"||n)return null;const i=t.locales.find(l=>l.code===t.locale.standardLocaleId);if(t.locales.length===1&&t.locales[0].code===t.locale.standardLocaleId||t.locales.length===0||!i)return null;const c=l=>{const m=s?`/${l.code}/${s}`:`/${l.code}`;o.push(n?`${m}${r.search}`:m)};return e.createElement(ue,{buttonStyle:"userflow-site-locale-dropdown",value:i,options:t.locales,onChange:c,comparator:(l,m)=>l.code===m.code,renderOption:l=>l.name})},we=({companyLogoSrc:o,headerText:t,headerDescription:n,logoUrl:r,localeDropdown:s})=>e.createElement(e.Fragment,null,e.createElement("div",{className:"userflow-site-header-wrapper"},e.createElement("div",{className:"d-flex justify-space-between align-items-center userflow-site-logo-wrapper"},e.createElement("div",null,o?e.createElement(e.Fragment,null,r?e.createElement("a",{href:r,target:"_blank",rel:"noopener noreferrer"},e.createElement("img",{src:o,className:"userflow-site-logo"})):e.createElement("img",{src:o,className:"userflow-site-logo"})):null),s),e.createElement("div",{className:"userflow-site__announcements-heading"},e.createElement("h1",{className:"text-bold"},t),e.createElement("p",null,n)))),b=()=>E().draftMode,j=()=>{const o=E(),t=b(),{locale:n}=R();return t?n:n??o.locale.standardLocaleId},K=o=>{const t=b(),n=B();return t?`${o}${n.search}`:o};export{fe as SiteAnnouncementsWrapper,M as SiteContentWrapper,we as SiteHeader,U as SiteListItem,ot as SitePage};
1
+ import{R as e,r as h}from"./vendor.react.js";import{U as W,u as A,i as L}from"./client-context.js";import{r as Y}from"./vendor.react-dom.js";import{B as O,L as _}from"./vendor.react-router-dom.js";import{A as z,u as T,S as k,a as G,b as Q}from"./AnnouncementEngagement.js";import{D as I,u as S,a as $,g as q}from"./stylesheets.js";import{i as J}from"./iframe-reset.styl.js";import{S as X,u as E,R as N}from"./TreeDoc.js";import{g as C}from"./flow-condition-types.js";import{f as Z,a as ee,b as D}from"./vendor.fortawesome.pro-regular-svg-icons.js";import{f as te}from"./vendor.fortawesome.pro-solid-svg-icons.js";import{d as oe}from"./userflow.js";import{P as ne}from"./Popover.js";import{o as se}from"./vendor.obj-str.js";import{m as re}from"./vendor.memoize-one.js";import"./vendor.core-js.js";import{u as ie}from"./react-hooks.js";import{S as le,a as H,u as P,b as R,d as B}from"./vendor.react-router.js";import{u as V}from"./vendor.react-i18next.js";import"./vendor.object-assign.js";import"./vendor.i18next.js";import"./vendor.babel.runtime.js";import"./vendor.scheduler.js";import"./vendor.history.js";import"./vendor.resolve-pathname.js";import"./vendor.value-equal.js";import"./vendor.tiny-invariant.js";import"./vendor.prop-types.js";import"./use-confetti.js";import"./vendor.canvas-confetti.js";import"./roots.js";import"./vendor.date-fns.js";import"./vendor.phoenix.js";import"./vendor.uuid.js";import"./vendor.lodash.js";import"./vendor.mini-create-react-context.js";import"./vendor.path-to-regexp.js";import"./vendor.react-is.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new Error().stack;t&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[t]="0beaf200-09ed-4397-b3f2-a29c7017107a",o._sentryDebugIdIdentifier="sentry-dbid-0beaf200-09ed-4397-b3f2-a29c7017107a")}catch{}})();const ae=new URL("popover.css",import.meta.url).href,ce=new URL("site.css",import.meta.url).href;class F extends e.PureComponent{constructor(){super(...arguments),this.rootRef=e.createRef(),this.isScrollingIntoView=!1,this.state={highlightedIdx:this.props.disableAutoHighlight?-1:0},this.onKeyDown=t=>{const{highlightedIdx:n}=this.state,{items:r}=this.props,s=()=>{t.stopPropagation(),t.preventDefault()};switch(t.key){case"ArrowUp":s(),n>0?this.setHighlighted(n-1):n===-1&&this.setHighlighted(r.length-1);break;case"ArrowDown":s(),n<r.length-1?this.setHighlighted(n+1):n===-1&&this.setHighlighted(0);break;case"Enter":s(),this.selectItem(r[n]);break}},this.selectItem=t=>{this.props.onSelect(t)},this.onItemHover=t=>{this.isScrollingIntoView||(this.setState({highlightedIdx:t}),this.props.onItemHighlighted?.(this.props.items[t]))},this.onMouseLeave=()=>{const{clearHoverOnMouseLeave:t,selectedItem:n,items:r}=this.props;if(t)if(n){const s=r.findIndex(l=>l===n);this.setState({highlightedIdx:s})}else this.setState({highlightedIdx:-1})},this.memoizedStyle=re(t=>t==null?{}:{maxHeight:t,overflowY:"auto"})}componentDidMount(){this.props.autoFocus&&this.rootRef.current.focus({preventScroll:!0}),this.props.forwardedRef&&this.rootRef.current&&(typeof this.props.forwardedRef=="function"?this.props.forwardedRef(this.rootRef.current):this.props.forwardedRef.current=this.rootRef.current)}render(){const t=this.state,{selectedItem:n,clearHoverOnMouseLeave:r,items:s,getItemGroup:l}=this.props;let a=null;const m=s.reduce((i,c,f)=>{const u=l?l(c):null;return u&&u!==a&&i.push(e.createElement("div",{key:`group-${u}-${f}`,className:"key-nav-list__group-header"},u)),a=u,i.push(e.createElement(me,{key:f,item:c,idx:f,className:se({"key-nav-list__item":!0,"key-nav-list__item--highlighted":f===t.highlightedIdx,"key-nav-list__item--selected":c===n}),renderContent:this.props.children,onClick:this.selectItem,onHover:this.onItemHover})),i},[]);return e.createElement("div",{ref:this.rootRef,className:"key-nav-list",style:this.memoizedStyle(this.props.maxHeight),onKeyDown:this.onKeyDown,onMouseLeave:r?this.onMouseLeave:void 0,tabIndex:0},m)}scrollHighlightedItemIntoView(){const t=this.rootRef.current,n=t.querySelector(".key-nav-list__item--highlighted");if(n){this.isScrollingIntoView=!0,window.clearTimeout(this.isScrollingIntoViewTimeout),this.isScrollingIntoViewTimeout=window.setTimeout(()=>this.isScrollingIntoView=!1,250);const r=t.getBoundingClientRect(),s=n.getBoundingClientRect();s.top<r.top?t.scrollTop+=s.top-r.top:s.bottom>r.bottom&&(t.scrollTop+=s.bottom-r.bottom)}}setHighlighted(t){this.setState({highlightedIdx:t},this.scrollHighlightedItemIntoView),this.props.onItemHighlighted?.(this.props.items[t])}}class me extends e.PureComponent{constructor(){super(...arguments),this.onClick=()=>this.props.onClick(this.props.item),this.onHover=()=>this.props.onHover(this.props.idx)}render(){const{props:t}=this;return e.createElement("div",{className:t.className,onClick:this.onClick,onMouseMove:this.onHover},t.renderContent(t.item,t.idx))}}e.forwardRef((o,t)=>e.createElement(F,{...o,forwardedRef:t}));function ue({testid:o,buttonText:t,value:n,onChange:r,options:s,renderOption:l,disabled:a,buttonStyle:m,htmlAttributes:i,comparator:c,showCheckIcon:f=!0}){const u=h.useRef(null),[p,g]=h.useState(!1),w=()=>{g(!1),u.current&&u.current.focus()},v=({key:d})=>{if(d.length===1){d=d.toLowerCase();for(const y of s){const x=l(y);if(typeof x=="string"&&x.toLowerCase().startsWith(d)){r(y);return}}}};return e.createElement(e.Fragment,null,e.createElement("button",{ref:u,"data-testid":o,type:"button",className:`btn btn-dynamic-icon ${m||"btn--plain-blue"} btn--sm ${p&&!a?"btn--popover-open":""}`,onClick:()=>g(!p),disabled:a,onKeyDown:v,...i},t||l(n),e.createElement(I,{icon:Z})),p&&!a&&u.current&&e.createElement(ne,{target:u.current,matchMinWidth:!0,onDismiss:w},e.createElement(F,{items:s,onSelect:d=>{w(),r(d)},autoFocus:!0},d=>e.createElement("div",{className:"d-flex"},f&&e.createElement("div",{className:"mr-8",style:(c?c(d,n):d===n)?void 0:{visibility:"hidden"}},e.createElement(I,{icon:ee})),l(d)))))}function de(o){const t=o?new Date(o):new Date;let n=new Intl.DateTimeFormat(L.language,{weekday:"long",day:"numeric",month:"short",year:t.getFullYear()===new Date().getFullYear()?void 0:"numeric"}).format(t);return n.substring(0,1).toUpperCase()+n.substring(1)}class ot{constructor(t,n){this.client=t,this.selector=n}mount(){if(this.container)throw new Error("SiteRoute has already been mounted");const t=document.querySelector(this.selector);if(!t)throw new Error(`SitePage: No element found for selector ${this.selector}`);this.container=t,Y.render(e.createElement(O,null,e.createElement(W.Provider,{value:this.client},e.createElement(fe,null))),this.container)}}const fe=()=>{const o=A();S(window,J),S(window,ae);const{loaded:t}=S(window,ce),[n,r]=h.useState(null),[s,l]=h.useState(void 0),a=n?.locale.standardLocaleId||n?.version.theme.languageId;return h.useEffect(()=>{a&&L.changeLanguage(a)},[a]),h.useEffect(()=>{const m=i=>{oe("Received site session",i),o.featureFlagEnabled("cff_site")!==!1&&r(i)};return o.on("private:siteSession",m),()=>{o.off("private:siteSession",m)}},[o]),!n||!t?null:e.createElement(X.Provider,{value:n},e.createElement(z,{key:n.locale.standardLocaleId},e.createElement(le,null,e.createElement(H,{exact:!0,path:"/:locale/:announcementId"},e.createElement(M,null,e.createElement(pe,{key:n.locale.standardLocaleId}))),e.createElement(H,{path:"/:locale"},e.createElement(M,null,e.createElement(he,{key:n.locale.standardLocaleId,listScrollTop:s,onSaveScrollPosition:()=>{l(window.scrollY)}}))))))},M=({children:o})=>{const t=E(),n=$(t.version.theme),r=t.version.theme.siteLogoAsset?.assetUrl,s=t.version.site,l=b();if(!s)return null;const{headerText:a,headerDescription:m,logoUrl:i}=s;return e.createElement("div",{style:q(n),className:"userflow-site__announcements"},l?e.createElement("div",{className:"text-bolder userflow-site-preview-banner"},"PREVIEW"):null,e.createElement(we,{headerText:a,headerDescription:m,companyLogoSrc:r,logoUrl:i,localeDropdown:e.createElement(ge,null)}),o)},he=({listScrollTop:o,onSaveScrollPosition:t})=>{const{t:n}=V(),r=E(),{announcements:s,loading:l,loadingMore:a,error:m,truncated:i,loadMore:c,submitReaction:f,submitComment:u}=T(),p=h.useRef(!1);return h.useLayoutEffect(()=>{o!=null&&window.scrollTo(0,o)},[o]),h.useEffect(()=>{if(l||a||i)return;const g=()=>{if(p.current)return;const w=window.scrollY,v=window.innerHeight;document.documentElement.scrollHeight-(w+v)<=400&&(p.current=!0,c().finally(()=>{p.current=!1}))};return window.addEventListener("scroll",g),()=>window.removeEventListener("scroll",g)},[i,l,a,c]),m?e.createElement("div",{className:"userflow-site__announcement-content"},"Failed in loading announcements"):l?e.createElement("div",{className:"userflow-site__announcement-content"},e.createElement(k,{center:!0,fadeIn:!0})):e.createElement("div",{className:"userflow-site__announcement-content"},s.length>0?e.createElement("div",{className:"userflow-site__announcement-list"},s.map(g=>e.createElement(U,{expanded:!1,key:g.id,announcement:g,enableTitleLinks:r.version.site?.enableTitleLinks,onReactionChange:f,onCommentSubmit:u,onSaveScrollPosition:t})),a?e.createElement(k,{center:!0,fadeIn:!0}):null):null,s.length===0?e.createElement("h3",{className:"userflow-site-empty-state text-extra-bold"},L.exists("resource_center.no_announcements",{fallbackLng:[]})?n("resource_center.no_announcements"):n("resource_center.no_results_found")):null)},U=({announcement:o,expanded:t=!1,enableTitleLinks:n,onReactionChange:r,onCommentSubmit:s,onSaveScrollPosition:l})=>{const a=P(),m=j(),i=A(),c=E(),f=$(c.version.theme),u=b(),p=h.useRef(null),g=n&&!!m,w=ie(p,{once:!0,rootMargin:"100px",disabled:o.seen===!0}),v=K(`/${m}/${u?o.id:o.permalink}`);h.useEffect(()=>{w&&o.seen===!1&&i.send({kind:"MarkAnnouncementSeen",announcementId:o.id,versionId:o.versionId},{batch:!0})},[w,o,i]);const d=()=>{m&&(l?.(),a.push(v))};return e.createElement("div",{ref:p,className:"userflow-site__card"},e.createElement("div",null,e.createElement("span",{className:"text-small text-secondary"},de(o.time)),e.createElement("div",null,g?e.createElement(_,{to:v,className:"h2-like text-extra-bold"},o.title):e.createElement("h2",{className:"h2-like text-extra-bold"},o.title))),e.createElement(N,{doc:o.content,buttons:o.buttons,lookupAttribute:C(o.data)}),o.moreEnabled&&t?e.createElement(N,{doc:o.moreContent,buttons:o.moreButtons,lookupAttribute:C(o.data)}):null,e.createElement(G,{announcement:t?{...o,moreEnabled:!1}:o,confettiColors:f.confettiColors,onReactionChange:r,onCommentSubmit:s,onMoreClick:t?void 0:d},!t&&o.moreEnabled&&e.createElement("div",{className:"userflowjs-announcement-more--modal"},e.createElement("button",{className:"userflowjs-tertiary-button",onClick:d},o.moreButtonText||"Read more",e.createElement("span",{className:"userflowjs-rtl-mirrored userflowjs-tertiary-button__icon"},e.createElement(I,{icon:te}))))))},pe=()=>{const o=E(),{announcementId:t}=R(),{submitReaction:n,submitComment:r}=T(),s=b(),l=j(),a=K(`/${l}`),{t:m}=V(),{loading:i,data:c,error:f}=Q({message:{kind:"GetAnnouncement",announcementId:t,permalink:!s},skip:!t});return i?e.createElement(k,{center:!0,fadeIn:!0}):f||!c?.announcement?e.createElement("div",{className:"userflow-site__announcement-content"},e.createElement("div",{className:"d-flex gap-16 flex-column mt-24"},e.createElement(_,{to:a,className:"userflow-site-link-button userflow-site-home-back-button"},e.createElement(I,{icon:D}),o.version.site?.homeButtonText||"All Announcements"),e.createElement("div",{className:"userflow-site__card userflow-site__card--not-found"},e.createElement("h3",{className:"userflow-site__announcement-not-found text-extra-bold"},m("site.page_not_found"))))):e.createElement("div",{className:"userflow-site__announcement-content"},c?.announcement&&e.createElement("div",{className:"d-flex gap-16 flex-column mt-24"},e.createElement(_,{to:a,className:"userflow-site-link-button userflow-site-home-back-button"},e.createElement(I,{icon:D}),o.version.site?.homeButtonText||"All Announcements"),e.createElement(U,{expanded:!0,announcement:c.announcement,onReactionChange:n,onCommentSubmit:r})))},ge=()=>{const o=P(),t=E(),n=b(),r=B(),{announcementId:s}=R();if(t?.kind!=="site"||n)return null;const l=t.locales.find(i=>i.code===t.locale.standardLocaleId);if(t.locales.length===1&&t.locales[0].code===t.locale.standardLocaleId||t.locales.length===0||!l)return null;const m=i=>{const c=s?`/${i.code}/${s}`:`/${i.code}`;o.push(n?`${c}${r.search}`:c)};return e.createElement(ue,{buttonStyle:"userflow-site-locale-dropdown",value:l,options:t.locales,onChange:m,comparator:(i,c)=>i.code===c.code,renderOption:i=>i.name})},we=({companyLogoSrc:o,headerText:t,headerDescription:n,logoUrl:r,localeDropdown:s})=>e.createElement(e.Fragment,null,e.createElement("div",{className:"userflow-site-header-wrapper"},e.createElement("div",{className:"d-flex justify-space-between align-items-center userflow-site-logo-wrapper"},e.createElement("div",null,o?e.createElement(e.Fragment,null,r?e.createElement("a",{href:r,target:"_blank",rel:"noopener noreferrer"},e.createElement("img",{src:o,className:"userflow-site-logo"})):e.createElement("img",{src:o,className:"userflow-site-logo"})):null),s),e.createElement("div",{className:"userflow-site__announcements-heading"},e.createElement("h1",{className:"text-bold"},t),e.createElement("p",null,n)))),b=()=>E().draftMode,j=()=>{const o=E(),t=b(),{locale:n}=R();return t?n:n??o.locale.standardLocaleId},K=o=>{const t=b(),n=B();return t?`${o}${n.search}`:o};export{fe as SiteAnnouncementsWrapper,M as SiteContentWrapper,we as SiteHeader,U as SiteListItem,ot as SitePage};
2
2
  //# sourceMappingURL=SitePage.js.map
package/debugger.css CHANGED
@@ -25,6 +25,9 @@ body {
25
25
  .d-flex {
26
26
  display: flex;
27
27
  }
28
+ .d-grid {
29
+ display: grid;
30
+ }
28
31
  .d-inline-flex {
29
32
  display: inline-flex;
30
33
  }
package/hash.txt CHANGED
@@ -1 +1 @@
1
- cbd438f31190a3b67f20b568288512ad78a70b53
1
+ 04ff3385e16848914e0f4a2e5f7191bec086bb8a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "userflow.js-self-hosted",
3
- "version": "0.1.1021329",
3
+ "version": "0.1.1021425",
4
4
  "description": "Self-hosted version of Userflow.js",
5
5
  "main": "userflow.js"
6
6
  }
package/site.css CHANGED
@@ -595,6 +595,22 @@ ol ol {
595
595
  display: flex;
596
596
  align-items: center;
597
597
  }
598
+ .key-nav-list__group-header {
599
+ position: sticky;
600
+ top: 0;
601
+ background-color: #f4f8fb;
602
+ border-bottom: 1px solid #dfeaf1;
603
+ padding: 0.25rem 1rem;
604
+ font-size: 0.75rem;
605
+ font-weight: 600;
606
+ color: #537388;
607
+ }
608
+ .key-nav-list__group-header .text-transform--uppercase {
609
+ text-transform: uppercase;
610
+ }
611
+ .key-nav-list__group-header:not(:first-child) {
612
+ border-top: 1px solid #dfeaf1;
613
+ }
598
614
  .userflowjs-assistant-brain {
599
615
  width: 14px;
600
616
  height: 14px;
@@ -4250,6 +4266,9 @@ body {
4250
4266
  .d-flex {
4251
4267
  display: flex;
4252
4268
  }
4269
+ .d-grid {
4270
+ display: grid;
4271
+ }
4253
4272
  .d-inline-flex {
4254
4273
  display: inline-flex;
4255
4274
  }
package/userflow.js CHANGED
@@ -1,7 +1,7 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["ResourceCenterApp.js","vendor.react.js","vendor.core-js.js","vendor.object-assign.js","client-context.js","vendor.i18next.js","vendor.babel.runtime.js","vendor.react-i18next.js","flow-host.styl.js","TreeDoc.js","flow-condition-types.js","vendor.date-fns.js","roots.js","stylesheets.js","vendor.fortawesome.pro-regular-svg-icons.js","vendor.fortawesome.pro-solid-svg-icons.js","vendor.obj-str.js","use-selector-element-monitoring.js","Frame.js","vendor.react-dom.js","vendor.scheduler.js","iframe-reset.styl.js","use-window-resize.js","logomark.js","ChecklistUI.js","FlowChrome.js","use-confetti.js","vendor.canvas-confetti.js","AnnouncementEngagement.js","vendor.memoize-one.js","vendor.bignumber.js.js","use-element-rect.js","BannerApp.js","vendor.phoenix.js","vendor.uuid.js","SitePage.js","vendor.react-router-dom.js","vendor.react-router.js","vendor.prop-types.js","vendor.history.js","vendor.resolve-pathname.js","vendor.value-equal.js","vendor.tiny-invariant.js","vendor.mini-create-react-context.js","vendor.path-to-regexp.js","vendor.react-is.js","Popover.js","react-hooks.js","vendor.lodash.js","implicit-tracking.js","DebuggerUI.js","vendor.fortawesome.react-fontawesome.js","vendor.fortawesome.fontawesome-svg-core.js","vendor.react-day-picker.js","ui.js"])))=>i.map(i=>d[i]);
2
2
  import"./vendor.core-js.js";import{S as z}from"./vendor.phoenix.js";import{v as O}from"./vendor.uuid.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="61d9c9bb-9ebd-4da2-87c5-d9d37b48bfaf",t._sentryDebugIdIdentifier="sentry-dbid-61d9c9bb-9ebd-4da2-87c5-d9d37b48bfaf")}catch{}})();const J="modulepreload",Q=function(t){return new URL("./",import.meta.url).toString()+t},b={},T=function(e,s,n){let i=Promise.resolve();if(s&&s.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),u=a?.nonce||a?.getAttribute("nonce");i=Promise.allSettled(s.map(c=>{if(c=Q(c),c in b)return;b[c]=!0;const l=c.endsWith(".css"),g=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${g}`))return;const E=document.createElement("link");if(E.rel=l?"stylesheet":J,l||(E.as="script"),E.crossOrigin="",E.href=c,u&&E.setAttribute("nonce",u),document.head.appendChild(E),l)return new Promise((j,Y)=>{E.addEventListener("load",j),E.addEventListener("error",()=>Y(new Error(`Unable to preload CSS for ${c}`)))})}))}function r(a){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=a,window.dispatchEvent(u),!u.defaultPrevented)throw a}return i.then(a=>{for(const u of a||[])u.status==="rejected"&&r(u.reason);return e().catch(r)})};class h extends Error{constructor(e,s,n){super(e),Object.setPrototypeOf(this,h.prototype),this.name="UserflowError",this.code=s,this.humanMessage=n}}class x{constructor(e){this.type=e,this.testState={}}formatKey(e){return`userflow:${e}`}isSupported(){if(typeof window>"u")return!1;try{return window[this.type]!=null}catch{return!1}}getItem(e){return e=this.formatKey(e),this.isSupported()?window[this.type].getItem(e):null}setItem(e,s){e=this.formatKey(e);{if(!this.isSupported())return;window[this.type].setItem(e,s)}}removeItem(e){return e=this.formatKey(e),this.isSupported()?window[this.type].removeItem(e):void 0}clear(){return this.isSupported()?window[this.type].clear():void 0}}const w=new x("localStorage"),d=new x("sessionStorage");function ct(t){window.location.href=t}function m(){return window.location.href}function _(t){window.postMessage(t,window.origin)}function G(t){const e=n=>{if(n.source!==window||n.origin!==window.origin)return;const i=n.data;!i||typeof i!="object"||typeof i.kind!="string"||!i.kind.startsWith("userflow:")||t(i)===!0&&s()};window.addEventListener("message",e);const s=()=>window.removeEventListener("message",e);return s}function X(t){return new Promise(e=>{G(s=>{const n=t(s);return n?(e(n),!0):!1})})}const R=new Set;let D=!1;function Z(t){return q(),R.add(t),()=>{W(t)}}function W(t){R.delete(t)}function C(){R.forEach(t=>t())}function q(){if(D)return;D=!0;const{history:t}=window,e=s=>{const n=t[s];t[s]=(...i)=>{const r=n.apply(t,i);return C(),r}};window.__userflowStatePatched?(window.addEventListener("userflow:pushstate",()=>{C()}),window.addEventListener("userflow:replacestate",()=>{C()})):(e("pushState"),e("replaceState")),window.addEventListener("popstate",()=>{C()})}class ee{destroy(){this.unregisterOnMessage&&this.unregisterOnMessage()}postBuilderMessage(e){_({kind:"userflow:crxSendProxyMessage",direction:"targetToBuilder",message:e})}onBuilderMessage(e){return this.unregisterOnMessage=G(e),!1}async captureScreenshot(e,s,n,i){return _({kind:"userflow:crxScreenshot",x:e,y:s,width:n,height:i,devicePixelRatio:window.devicePixelRatio}),(await X(a=>a.kind==="userflow:crxScreenshotResult"?a:null)).imageDataUrl}}var k=(t=>(t.ACTION="ACTION",t.LAUNCHER_DEACTIVATED="LAUNCHER_DEACTIVATED",t.REPLACED="REPLACED",t.SNOOZED="SNOOZED",t.TOOLTIP_TARGET_MISSING="TOOLTIP_TARGET_MISSING",t.USERFLOWJS="USERFLOWJS",t.USER_CLOSED="USER_CLOSED",t))(k||{}),te=(t=>(t.POSITIVE="POSITIVE",t.NEUTRAL="NEUTRAL",t.NEGATIVE="NEGATIVE",t))(te||{}),se=(t=>(t.SECOND="SECOND",t.MINUTE="MINUTE",t.HOUR="HOUR",t.DAY="DAY",t))(se||{}),p=(t=>(t.ACTION="ACTION",t.DRAFT="DRAFT",t.LINK="LINK",t.LAUNCHER_SEEN="LAUNCHER_SEEN",t.RESOURCE_CENTER="RESOURCE_CENTER",t.USERFLOWJS="USERFLOWJS",t.ASSISTANT="ASSISTANT",t))(p||{}),ie=(t=>(t.LIKE="LIKE",t.DISLIKE="DISLIKE",t))(ie||{}),S=(t=>(t.STRING="STRING",t.BOOLEAN="BOOLEAN",t.NUMBER="NUMBER",t.DATETIME="DATETIME",t.LIST="LIST",t.RANDOM_AB="RANDOM_AB",t.RANDOM_NUMBER="RANDOM_NUMBER",t.CHECKLIST_TASK="CHECKLIST_TASK",t.FLOW="FLOW",t.FLOW_SESSION="FLOW_SESSION",t.FLOW_STEP="FLOW_STEP",t.FLOW_VERSION="FLOW_VERSION",t))(S||{}),U=(t=>(t.FLOW="FLOW",t.BANNER="BANNER",t.EMBED="EMBED",t.CHECKLIST="CHECKLIST",t.LAUNCHER="LAUNCHER",t.RESOURCE_CENTER="RESOURCE_CENTER",t.SITE="SITE",t))(U||{}),ne=(t=>(t.ALWAYS_TRUE="ALWAYS_TRUE",t.ATTRIBUTE="ATTRIBUTE",t.CHECKLIST_TASK_CLICKED="CHECKLIST_TASK_CLICKED",t.CLAUSE="CLAUSE",t.ELEMENT="ELEMENT",t.EVENT="EVENT",t.FILLED_IN_INPUT="FILLED_IN_INPUT",t.FLOW="FLOW",t.INPUT_VALUE="INPUT_VALUE",t.PAGE="PAGE",t.SEGMENT="SEGMENT",t.TIME="TIME",t))(ne||{}),re=(t=>(t.AUTO="AUTO",t.MANUAL="MANUAL",t))(re||{}),oe=(t=>(t.INPUT="INPUT",t))(oe||{}),ae=(t=>(t.ABSOLUTE_EQ="ABSOLUTE_EQ",t.ABSOLUTE_GT="ABSOLUTE_GT",t.ABSOLUTE_LT="ABSOLUTE_LT",t.AND="AND",t.BETWEEN="BETWEEN",t.CONTAINS="CONTAINS",t.EMPTY="EMPTY",t.ENDS_WITH="ENDS_WITH",t.EQ="EQ",t.EXCLUDES_ALL="EXCLUDES_ALL",t.EXCLUDES_ANY="EXCLUDES_ANY",t.FALSE="FALSE",t.GT="GT",t.GTE="GTE",t.INCLUDES_ALL="INCLUDES_ALL",t.INCLUDES_ANY="INCLUDES_ANY",t.LT="LT",t.LTE="LTE",t.NE="NE",t.NOT_CONTAINS="NOT_CONTAINS",t.NOT_EMPTY="NOT_EMPTY",t.NOT_REGEX="NOT_REGEX",t.OR="OR",t.REGEX="REGEX",t.RELATIVE_EQ="RELATIVE_EQ",t.RELATIVE_GT="RELATIVE_GT",t.RELATIVE_LT="RELATIVE_LT",t.STARTS_WITH="STARTS_WITH",t.TRUE="TRUE",t.URL="URL",t))(ae||{}),ce=(t=>(t.CLICK="CLICK",t.DISABLED="DISABLED",t.MOUSEDOWN="MOUSEDOWN",t.NOT_CLICK="NOT_CLICK",t.NOT_DISABLED="NOT_DISABLED",t.NOT_PRESENT="NOT_PRESENT",t.PRESENT="PRESENT",t))(ce||{}),le=(t=>(t.END_USER="END_USER",t.GROUP="GROUP",t))(le||{}),ue=(t=>(t.BETWEEN="BETWEEN",t.EQ="EQ",t.GTE="GTE",t.LTE="LTE",t))(ue||{}),he=(t=>(t.ANY="ANY",t.RELATIVE_BETWEEN="RELATIVE_BETWEEN",t.RELATIVE_GT="RELATIVE_GT",t.RELATIVE_LT="RELATIVE_LT",t))(he||{}),de=(t=>(t.CURRENT_USER="CURRENT_USER",t.CURRENT_USER_CURRENT_GROUP="CURRENT_USER_CURRENT_GROUP",t.CURRENT_GROUP="CURRENT_GROUP",t))(de||{}),fe=(t=>(t.ASSET="ASSET",t.CARTOON="CARTOON",t.NONE="NONE",t.URL="URL",t))(fe||{}),Ee=(t=>(t.INSIDE="INSIDE",t.OUTSIDE="OUTSIDE",t))(Ee||{}),Se=(t=>(t.TOP_LEFT="TOP_LEFT",t.TOP_CENTER="TOP_CENTER",t.TOP_RIGHT="TOP_RIGHT",t.BOTTOM_RIGHT="BOTTOM_RIGHT",t.BOTTOM_CENTER="BOTTOM_CENTER",t.BOTTOM_LEFT="BOTTOM_LEFT",t.CENTER="CENTER",t))(Se||{}),Te=(t=>(t.GOOGLE="GOOGLE",t.STANDARD="STANDARD",t))(Te||{}),ge=(t=>(t.DISMISS_FIRST_MENU_AFTER="DISMISS_FIRST_MENU_AFTER",t.DISMISS="DISMISS",t))(ge||{}),Ie=(t=>(t.DISMISS="DISMISS",t.NONE="NONE",t))(Ie||{}),we=(t=>(t.DEFAULT="DEFAULT",t.NARROW="NARROW",t.CHAINED_SQUARED="CHAINED_SQUARED",t.CHAINED_ROUNDED="CHAINED_ROUNDED",t.DOTTED="DOTTED",t.NUMBERED="NUMBERED",t))(we||{}),Ce=(t=>(t.TOP="TOP",t.BOTTOM="BOTTOM",t))(Ce||{}),me=(t=>(t.DEFAULT="DEFAULT",t.PLAINTEXT="PLAINTEXT",t.CUSTOM="CUSTOM",t))(me||{}),ke=(t=>(t.CHECKLIST_OVERRIDE="CHECKLIST_OVERRIDE",t.RESOURCE_CENTER_ONLY="RESOURCE_CENTER_ONLY",t.NONE="NONE",t))(ke||{}),Ue=(t=>(t.BUBBLE="BUBBLE",t.END="END",t.ERROR="ERROR",t.FLAG="FLAG",t))(Ue||{}),pe=(t=>(t.MANUAL="MANUAL",t.NONE="NONE",t.SYNTHETIC="SYNTHETIC",t))(pe||{}),Le=(t=>(t.BUBBLE="BUBBLE",t.HIDDEN="HIDDEN",t.MODAL="MODAL",t.TOOLTIP="TOOLTIP",t))(Le||{}),Ne=(t=>(t.ABOVE="ABOVE",t.BELOW="BELOW",t.LEFT="LEFT",t.RIGHT="RIGHT",t))(Ne||{}),_e=(t=>(t.CLOSE_FLOW="CLOSE_FLOW",t.EVAL_JS="EVAL_JS",t.GO_TO_STEP="GO_TO_STEP",t.NAVIGATE="NAVIGATE",t.SET_ATTRIBUTE="SET_ATTRIBUTE",t.SNOOZE="SNOOZE",t.START_FLOW="START_FLOW",t.TRACK_BUTTON_EVENT="TRACK_BUTTON_EVENT",t))(_e||{}),Ae=(t=>(t.NEW_TAB="NEW_TAB",t.SAME_TAB="SAME_TAB",t))(Ae||{}),Re=(t=>(t.SET="SET",t.SET_DATETIME="SET_DATETIME",t.SET_DATETIME_ONCE="SET_DATETIME_ONCE",t.SET_ONCE="SET_ONCE",t.ADD="ADD",t.SUBTRACT="SUBTRACT",t.APPEND="APPEND",t.PREPEND="PREPEND",t.REMOVE="REMOVE",t.UNSET="UNSET",t))(Re||{}),ve=(t=>(t.MULTILINE_TEXT="MULTILINE_TEXT",t.MULTIPLE_CHOICE="MULTIPLE_CHOICE",t.NPS="NPS",t.SCALE="SCALE",t.STARS="STARS",t.TEXT="TEXT",t))(ve||{}),A=(t=>(t.ACTION="ACTION",t.ANNOUNCEMENTS="ANNOUNCEMENTS",t.ASSISTANT="ASSISTANT",t.CHECKLIST="CHECKLIST",t.CONTACT="CONTACT",t.DIVIDER="DIVIDER",t.FLOWS="FLOWS",t.KNOWLEDGE_BASE="KNOWLEDGE_BASE",t.MESSAGE="MESSAGE",t.SUBPAGE="SUBPAGE",t))(A||{}),Oe=(t=>(t.CRISP="CRISP",t.CUSTOM="CUSTOM",t.FRESHCHAT="FRESHCHAT",t.HELPSCOUT="HELPSCOUT",t.HUBSPOT="HUBSPOT",t.INTERCOM="INTERCOM",t.ZENDESK="ZENDESK",t.ZENDESK_MESSENGER="ZENDESK_MESSENGER",t))(Oe||{}),be=(t=>(t.BUTTON="BUTTON",t.INPUT="INPUT",t))(be||{}),De=(t=>(t.EMAIL="EMAIL",t.PHONE="PHONE",t.CHAT="CHAT",t))(De||{}),ye=(t=>(t.SILENT="SILENT",t.BADGE="BADGE",t.POPOUT="POPOUT",t.MODAL="MODAL",t.TOAST="TOAST",t))(ye||{}),Me=(t=>(t.DEFAULT="DEFAULT",t.CUSTOM="CUSTOM",t.NONE="NONE",t))(Me||{}),Pe=(t=>(t.LAUNCHER_CLICK="LAUNCHER_CLICK",t.LAUNCHER_HOVER="LAUNCHER_HOVER",t.TARGET_CLICK="TARGET_CLICK",t.TARGET_HOVER="TARGET_HOVER",t.LAUNCHER_TARGET_CLICK="LAUNCHER_TARGET_CLICK",t.LAUNCHER_TARGET_HOVER="LAUNCHER_TARGET_HOVER",t))(Pe||{}),V=(t=>(t.ACTIVATE="ACTIVATE",t.DEACTIVATE="DEACTIVATE",t.NEVER="NEVER",t))(V||{}),Be=(t=>(t.AUTO="AUTO",t.TOP="TOP",t.RIGHT="RIGHT",t.BOTTOM="BOTTOM",t.LEFT="LEFT",t))(Be||{}),He=(t=>(t.START="START",t.CENTER="CENTER",t.END="END",t))(He||{}),xe=(t=>(t.PERCENT="PERCENT",t.PX="PX",t))(xe||{}),Ge=(t=>(t.BEACON="BEACON",t.BUTTON="BUTTON",t.HIDDEN="HIDDEN",t.ICON="ICON",t))(Ge||{}),We=(t=>(t.LAUNCHER="LAUNCHER",t.TARGET="TARGET",t))(We||{}),Ve=(t=>(t.BODY_FIRST="BODY_FIRST",t.BODY_LAST="BODY_LAST",t.ELEMENT_FIRST="ELEMENT_FIRST",t.ELEMENT_LAST="ELEMENT_LAST",t.ELEMENT_BEFORE="ELEMENT_BEFORE",t.ELEMENT_AFTER="ELEMENT_AFTER",t))(Ve||{}),Ke=(t=>(t.BODY_FIRST="BODY_FIRST",t.BODY_LAST="BODY_LAST",t.ELEMENT_FIRST="ELEMENT_FIRST",t.ELEMENT_LAST="ELEMENT_LAST",t.ELEMENT_BEFORE="ELEMENT_BEFORE",t.ELEMENT_AFTER="ELEMENT_AFTER",t))(Ke||{}),K=(t=>(t.CHECKLIST="CHECKLIST",t))(K||{}),Fe=(t=>(t.HIDE="HIDE",t.OTHERS="OTHERS",t))(Fe||{}),$e=(t=>(t.ALWAYS="ALWAYS",t.MULTIPLE="MULTIPLE",t.NEVER="NEVER",t.ONCE="ONCE",t.ONCE_PER_GROUP="ONCE_PER_GROUP",t))($e||{}),je=(t=>(t.NONE="NONE",t.PENDING_SCHEDULE="PENDING_SCHEDULE",t.SCHEDULED="SCHEDULED",t.FIRED="FIRED",t))(je||{}),Ye=(t=>(t.NONE="NONE",t.LIKE="LIKE",t.SCALE="SCALE",t))(Ye||{}),ze=(t=>(t.HIDE="HIDE",t.BLOCK="BLOCK",t.OTHERS="OTHERS",t))(ze||{});function Je(){return{customInputs:[],customNavigate:null,urlFilter:null,linkUrlDecorator:null,customScrollIntoView:null,scrollPadding:null,inferenceAttributeNames:["data-for","data-id","data-testid","data-test-id","for","id","name","placeholder","role"],inferenceAttributeFilters:{id:[t=>!t.match(/\d$/)],"data-id":[t=>!t.match(/\d$/)]},inferenceClassNameFilters:[t=>!t.startsWith("css-")],baseZIndex:1234500,evalJsDisabled:!1}}const f=Je();function y(t){return Array.isArray(t)||(t=t?[t]:[]),t=t.map(e=>typeof e=="string"?new RegExp(e):e),t}function lt(t,e){return t.every(s=>typeof s=="function"?s(e):s instanceof RegExp?s.test(e):!0)}function Qe(){let t=m();if(f.urlFilter){if(t=f.urlFilter(t),typeof t!="string")throw new h("Userflow.js: URL filter returned non-string value. Please check your userflow.setUrlFilter() implementation.");try{new URL(t)}catch(e){throw new h(`Userflow.js: URL filter returned an invalid URL. Please check your userflow.setUrlFilter() implementation.
3
3
  Returned URL: `+t+`
4
- Error message: `+e.message)}}return t}let F="";try{F=localStorage.getItem("debug")||""}catch{}const $=F.split(",").some(t=>t==="*"||t.startsWith("userflow:*")),o=v("log");o.group=v("group");o.groupCollapsed=v("groupCollapsed");o.groupEnd=function(){$&&console.groupEnd()};let L;function v(t){return function(e,...s){if($){const n=performance.now(),i=L?Math.round(n-L):0;L=n,console[t](`%cuserflow %c${e} %c+${i}ms`,"color:#1a57e6;","","color:#1a57e6;",...s)}}}const Xe=()=>T(()=>import("./ResourceCenterApp.js").then(t=>t.R),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]));function Ze(t){const s=t.version.checklist.tasks.length;return Math.max(0,s-t.taskCompletions.length)}class M{constructor(e){this.observers=new Set,this._value=e}get value(){return this._value}update(e){if(e!==this._value){this._value=e;for(const s of this.observers)s()}}observe(e){return this.observers.add(e),()=>this.observers.delete(e)}}const P=["page:before-change","page:change","turbo:before-cache","turbo:load","turbo:visit","turbolinks:before-cache","turbolinks:load","turbolinks:visit","livewire:navigated","livewire:navigating","livewire:update"],qe=()=>T(()=>import("./BannerApp.js"),__vite__mapDeps([32,1,2,3,4,5,6,7,16,13,14,15,10,11,12,9,8,17,19,20,18,21,31,22,33,34])),N="1021329",et=import.meta.url,B=50,tt=5*60*1e3,H="userflowClientState",I="userflowClientSiteId";class st{constructor(){this.clientToken=null,this.externalId=null,this.signature=null,this.groupId=null,this.groupSignature=null,this._socketStatus="disconnected",this.socket=null,this.channel=null,this.logrocketAppId=null,this.debounceInactiveDisconnectTimeout=void 0,this.inBatch=!1,this.endBatchTimeout=void 0,this.pushRateLimitMinute=0,this.pushRateLimitMinuteExpires=0,this.clientClock=1,this.serverClock=1,this.flowSession=null,this.flowSessionClock=0,this.checklistSession=null,this.checklistExpanded=!1,this.checklistExpandPending=!1,this.checklistSessionClock=0,this.bannerSession=null,this.resourceCenterSession=null,this.resourceCenterOpen=!1,this.resourceCenterLauncherHidden=null,this.siteSession=null,this.launcherSessions=[],this.activeLauncherFlowId=null,this.notifications=[],this.embedSessions=[],this.notificationIdCounter=0,this.sessionStorageState=null,this.clientContext=null,this.flushUrlChangeTimeout=void 0,this.onFirstIdentifyRun=!1,this.onFirstIdentifyTimeout=void 0,this.firstIdentifyCallback=null,this.ui=null,this.debuggerUI=null,this.debuggerMountInProgress=!1,this.unackedTasks=new Set,this.clientConditions=new Map,this.trackers=new Map,this.conditionWaitTimers=new Map,this.listeners=new Map,this.targetEnv=null,this.idempotencyKeysSeen=new Set,this.testUserIdentified=!1,this.cspIssueReported=!1,this.uiDisabled=!1,this.audio=null,this.audioReady=!1,this.pageTrackingDisabled=!1,this.refCounter=1,this.implicitTracking=null,this.initialMessagesQueue=[],this.onBuilderMessage=e=>(this.handleBuilderMessage(e),!1),this.handleBuilderMessage=async e=>{o(`builder ${e.kind} message received`,e);const s="idempotencyKey"in e&&typeof e.idempotencyKey=="string"?e.idempotencyKey:null;if(s&&this.idempotencyKeysSeen.has(s))return;const n=()=>{s&&this.idempotencyKeysSeen.add(s)};switch(e.kind){case"userflow:selectElement":{n(),this.getTargetEnv().postBuilderMessage({kind:"userflow:selectElementAck",idempotencyKey:e.idempotencyKey}),this.setSessionStorageState(i=>({...i,isTargetTab:!0,activeApp:"elementSelection",elementSelection:{mode:"select",elementType:e.elementType}}));return}case"userflow:selectElementCancel":{this.setSessionStorageState(i=>({...i,activeApp:null,elementSelection:null}));return}case"userflow:startFlowWithToken":{n(),this.getTargetEnv().postBuilderMessage({kind:"userflow:startFlowWithTokenAck",idempotencyKey:e.idempotencyKey}),this.setSessionStorageState(i=>({...i,isTargetTab:!0,activeApp:null,testStartConditionToken:void 0})),d.setItem("previewFlowId",e.flowId),e.testUser?this.identifyTestUser(e.testUser):this.resetTestUser(),e.testStartCondition?this.setSessionStorageState(i=>({...i,activeApp:"startConditionTesting",testStartConditionToken:e.token})):this.onceIdentified(()=>{if(this.startFlowWithToken(e.token),e.isResourceCenter){const i=()=>{const r=this.resourceCenterSession;r&&r.draftMode&&r.flow.id===e.flowId&&(this.openResourceCenter(),this.off("resourceCenterChanged",i))};this.on("resourceCenterChanged",i),i()}});return}case"userflow:testTracker":{n(),this.getTargetEnv().postBuilderMessage({kind:"userflow:testTrackerAck",idempotencyKey:e.idempotencyKey}),this.setSessionStorageState(i=>({...i,isTargetTab:!0})),e.testUser?this.identifyTestUser(e.testUser):this.resetTestUser(),this.setSessionStorageState(i=>({...i,activeApp:"trackerTesting",trackerTesting:{trackerName:e.trackerName,token:e.token,events:0}}));return}case"userflow:testTrackerCancel":{this.setSessionStorageState(i=>({...i,activeApp:null,trackerTesting:null}));return}case"userflow:startSmartFlow":{n(),this.getTargetEnv().postBuilderMessage({kind:"userflow:startSmartFlowAck",idempotencyKey:e.idempotencyKey}),this.setSessionStorageState(i=>({...i,isTargetTab:!0,activeApp:"smartFlowRecording",smartFlowRecording:{sessionId:e.sessionId,isRecording:!0,startUrl:e.startUrl||null}}));return}case"userflow:smartFlowCancel":{this.setSessionStorageState(i=>({...i,activeApp:null,smartFlowRecording:null}));return}case"userflow:smartFlowStartOverAck":return;case"userflow:smartFlowComplete":{this.setSessionStorageState(i=>({...i,activeApp:null,smartFlowRecording:null}));return}}},this.onUrlChange=()=>{this.externalId&&(window.clearTimeout(this.flushUrlChangeTimeout),this.flushUrlChangeTimeout=window.setTimeout(()=>this.flushUrlChange(),B))},this.onUserActivity=()=>this.ensureConnected(),this.mountSitePage=async(e,s)=>{d.setItem(I,s),o("mounting site page"),this.setResourceCenterLauncherHidden(!0);try{const{SitePage:n}=await T(async()=>{const{SitePage:r}=await import("./SitePage.js");return{SitePage:r}},__vite__mapDeps([35,1,2,3,4,5,6,7,19,20,36,37,38,39,40,41,42,43,44,45,28,16,13,14,15,10,11,12,26,27,21,9,46,29,47,48,33,34]));new n(this,e).mount(),o("site page mounted")}catch(n){console.error("Userflow: Failed to mount site page",n)}},this.remountIfNecessary=()=>{!this.ui?.container||document.contains(this.ui.container)||(o("remounting UI because container was missing"),this.remount())},o("constructor, build="+N),Z(this.onUrlChange),this.setTargetEnv(new ee),this.checkTestUserAtBoot(),this.toggleUI(),this.checkDebuggerSession();for(const e of P)document.addEventListener(e,this.remountIfNecessary)}get socketStatus(){return this._socketStatus}destroy(){o("destroy"),this.reset(),W(this.onUrlChange),this.destroyTargetEnv();for(const e of P)document.removeEventListener(e,this.remountIfNecessary)}setTargetEnv(e){this.destroyTargetEnv(),this.targetEnv=e,e.onBuilderMessage(this.onBuilderMessage)}destroyTargetEnv(){this.targetEnv&&(this.targetEnv.destroy(),this.targetEnv=null)}getTargetEnv(){if(!this.targetEnv)throw new h("Userflow.js: Cannot call getTargetEnv when protocol is not set");return this.targetEnv}setSessionStorageState(e){const s=e(this.getSessionStorageState());d.setItem(H,JSON.stringify(s)),this.sessionStorageState=s,this.toggleUI()}getSessionStorageState(){let e=this.sessionStorageState;if(!e){const s=d.getItem(H);if(s)try{e=JSON.parse(s)}catch(n){console.error("Userflow.js: Parse ElementSelectionState error:",n)}e||(e={testUser:null,activeApp:null,elementSelection:null,trackerTesting:null}),this.sessionStorageState=e}return e}checkTestUserAtBoot(){const e=this.getSessionStorageState().testUser;e&&(o("checkTestUserAtBoot identifying test user"),this.identifyTestUser(e))}async identifyTestUser(e){this.setSessionStorageState(i=>({...i,testUser:e})),this.reset(),this.init(e.clientToken),this.testUserIdentified=!0,this.externalId=e.id;const s=[this.identify(e.id,{name:e.name,email:e.email,signed_up_at:{set_once:new Date().toISOString(),data_type:"datetime"}},{signature:e.signature})],{group:n}=e;n&&(this.groupId=n.id,s.push(this.group(n.id,{name:n.name},{signature:n.signature}))),await Promise.all(s)}resetTestUser(){this.setSessionStorageState(e=>({...e,testUser:null}))}init(e){if(o("init",e),!e)throw new h("userflow.init() was called but missing Userflow.js Token");if(this.clientToken!==e){if(this.testUserIdentified){o("init() ignoring new token since a test user has been identified");return}this.clientToken&&(o("init() resetting due to new client token"),this.reset()),this.clientToken=e,this.emit("private:initialised")}}ensureInit(){if(!this.clientToken)throw new h("You must call userflow.init() first")}ensureIdentified(){if(this.ensureInit(),!this.externalId)throw new h("You must call userflow.identify() first");return this.externalId}ensureGroup(){if(this.ensureIdentified(),!this.groupId)throw new h("You must call userflow.group() first");return this.groupId}ensureConnected(){if(!this.clientToken||!this.externalId||(this.debounceInactiveDisconnect(),this.socket))return;this._socketStatus="connecting",o("connecting to socket");const e=/^ct_eu\d+_.+$/.test(this.clientToken)?"e.eu.":"e.";let s=f.serverEndpoint||e+"userflow.com";new URL(et).hostname==="js.getuserflow.com"&&s==="e.userflow.com"&&(s="e.getuserflow.com");const n="wss://"+s+"/end-users/"+this.clientToken+"/socket";this.socket=new z(n,{reconnectAfterMs:i=>[100,500,1e3,5e3][i-1]||1e4,timeout:20*1e3}),this.socket.connect(),this.socket.onOpen(()=>{o("socket opened")}),this.socket.onClose(()=>{this.emit("private:disconnect")}),this.socket.onError(i=>{console.log("Userflow.js socket error",i),this.reportCspIssue()}),this.channel=this.socket.channel(`end_users:${this.externalId}`,()=>this.makeChannelJoinPayload()),this.channel.join().receive("ok",i=>{typeof this.featureFlags>"u"&&this.clearInitialMessagesQueue(i.featureFlags),this.logrocketAppId=i.logrocketAppId,this.featureFlags=new Set(i.featureFlags),o("channel joined"),this._socketStatus!=="connected"&&(this._socketStatus="connected"),this.featureFlagEnabled("cff_implicit_events")===!0&&!this.implicitTracking&&this.startImplicitTracking(),!this.featureFlagEnabled("cff_implicit_events")&&this.implicitTracking&&(this.implicitTracking.stop(),this.implicitTracking=null)}).receive("error",i=>{["company_closed","invalid_client_token","invalid_user_external_id","incorrect_user_signature","rate_limit_exceeded","user_signature_required"].includes(i.code)?(console.error(`Userflow.js resetting due to: [${i.code}] ${i.message}`),this.reset(),this.clientToken=null):i.code==="invalid_protocol_version"?(console.error(`Userflow.js destroying due to: [${i.code}] ${i.message}`),this.destroy()):console.log("Userflow.js channel join error",i)}),this.channel.on("server_message",i=>this.handleServerMessage(i)),this.channel.on("server_error",i=>{console.log(`Userflow.js server error (${i.code}): ${i.message}`+(i.details&&i.details.length>0?`
4
+ Error message: `+e.message)}}return t}let F="";try{F=localStorage.getItem("debug")||""}catch{}const $=F.split(",").some(t=>t==="*"||t.startsWith("userflow:*")),o=v("log");o.group=v("group");o.groupCollapsed=v("groupCollapsed");o.groupEnd=function(){$&&console.groupEnd()};let L;function v(t){return function(e,...s){if($){const n=performance.now(),i=L?Math.round(n-L):0;L=n,console[t](`%cuserflow %c${e} %c+${i}ms`,"color:#1a57e6;","","color:#1a57e6;",...s)}}}const Xe=()=>T(()=>import("./ResourceCenterApp.js").then(t=>t.R),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]));function Ze(t){const s=t.version.checklist.tasks.length;return Math.max(0,s-t.taskCompletions.length)}class M{constructor(e){this.observers=new Set,this._value=e}get value(){return this._value}update(e){if(e!==this._value){this._value=e;for(const s of this.observers)s()}}observe(e){return this.observers.add(e),()=>this.observers.delete(e)}}const P=["page:before-change","page:change","turbo:before-cache","turbo:load","turbo:visit","turbolinks:before-cache","turbolinks:load","turbolinks:visit","livewire:navigated","livewire:navigating","livewire:update"],qe=()=>T(()=>import("./BannerApp.js"),__vite__mapDeps([32,1,2,3,4,5,6,7,16,13,14,15,10,11,12,9,8,17,19,20,18,21,31,22,33,34])),N="1021425",et=import.meta.url,B=50,tt=5*60*1e3,H="userflowClientState",I="userflowClientSiteId";class st{constructor(){this.clientToken=null,this.externalId=null,this.signature=null,this.groupId=null,this.groupSignature=null,this._socketStatus="disconnected",this.socket=null,this.channel=null,this.logrocketAppId=null,this.debounceInactiveDisconnectTimeout=void 0,this.inBatch=!1,this.endBatchTimeout=void 0,this.pushRateLimitMinute=0,this.pushRateLimitMinuteExpires=0,this.clientClock=1,this.serverClock=1,this.flowSession=null,this.flowSessionClock=0,this.checklistSession=null,this.checklistExpanded=!1,this.checklistExpandPending=!1,this.checklistSessionClock=0,this.bannerSession=null,this.resourceCenterSession=null,this.resourceCenterOpen=!1,this.resourceCenterLauncherHidden=null,this.siteSession=null,this.launcherSessions=[],this.activeLauncherFlowId=null,this.notifications=[],this.embedSessions=[],this.notificationIdCounter=0,this.sessionStorageState=null,this.clientContext=null,this.flushUrlChangeTimeout=void 0,this.onFirstIdentifyRun=!1,this.onFirstIdentifyTimeout=void 0,this.firstIdentifyCallback=null,this.ui=null,this.debuggerUI=null,this.debuggerMountInProgress=!1,this.unackedTasks=new Set,this.clientConditions=new Map,this.trackers=new Map,this.conditionWaitTimers=new Map,this.listeners=new Map,this.targetEnv=null,this.idempotencyKeysSeen=new Set,this.testUserIdentified=!1,this.cspIssueReported=!1,this.uiDisabled=!1,this.audio=null,this.audioReady=!1,this.pageTrackingDisabled=!1,this.refCounter=1,this.implicitTracking=null,this.initialMessagesQueue=[],this.onBuilderMessage=e=>(this.handleBuilderMessage(e),!1),this.handleBuilderMessage=async e=>{o(`builder ${e.kind} message received`,e);const s="idempotencyKey"in e&&typeof e.idempotencyKey=="string"?e.idempotencyKey:null;if(s&&this.idempotencyKeysSeen.has(s))return;const n=()=>{s&&this.idempotencyKeysSeen.add(s)};switch(e.kind){case"userflow:selectElement":{n(),this.getTargetEnv().postBuilderMessage({kind:"userflow:selectElementAck",idempotencyKey:e.idempotencyKey}),this.setSessionStorageState(i=>({...i,isTargetTab:!0,activeApp:"elementSelection",elementSelection:{mode:"select",elementType:e.elementType}}));return}case"userflow:selectElementCancel":{this.setSessionStorageState(i=>({...i,activeApp:null,elementSelection:null}));return}case"userflow:startFlowWithToken":{n(),this.getTargetEnv().postBuilderMessage({kind:"userflow:startFlowWithTokenAck",idempotencyKey:e.idempotencyKey}),this.setSessionStorageState(i=>({...i,isTargetTab:!0,activeApp:null,testStartConditionToken:void 0})),d.setItem("previewFlowId",e.flowId),e.testUser?this.identifyTestUser(e.testUser):this.resetTestUser(),e.testStartCondition?this.setSessionStorageState(i=>({...i,activeApp:"startConditionTesting",testStartConditionToken:e.token})):this.onceIdentified(()=>{if(this.startFlowWithToken(e.token),e.isResourceCenter){const i=()=>{const r=this.resourceCenterSession;r&&r.draftMode&&r.flow.id===e.flowId&&(this.openResourceCenter(),this.off("resourceCenterChanged",i))};this.on("resourceCenterChanged",i),i()}});return}case"userflow:testTracker":{n(),this.getTargetEnv().postBuilderMessage({kind:"userflow:testTrackerAck",idempotencyKey:e.idempotencyKey}),this.setSessionStorageState(i=>({...i,isTargetTab:!0})),e.testUser?this.identifyTestUser(e.testUser):this.resetTestUser(),this.setSessionStorageState(i=>({...i,activeApp:"trackerTesting",trackerTesting:{trackerName:e.trackerName,token:e.token,events:0}}));return}case"userflow:testTrackerCancel":{this.setSessionStorageState(i=>({...i,activeApp:null,trackerTesting:null}));return}case"userflow:startSmartFlow":{n(),this.getTargetEnv().postBuilderMessage({kind:"userflow:startSmartFlowAck",idempotencyKey:e.idempotencyKey}),this.setSessionStorageState(i=>({...i,isTargetTab:!0,activeApp:"smartFlowRecording",smartFlowRecording:{sessionId:e.sessionId,isRecording:!0,startUrl:e.startUrl||null}}));return}case"userflow:smartFlowCancel":{this.setSessionStorageState(i=>({...i,activeApp:null,smartFlowRecording:null}));return}case"userflow:smartFlowStartOverAck":return;case"userflow:smartFlowComplete":{this.setSessionStorageState(i=>({...i,activeApp:null,smartFlowRecording:null}));return}}},this.onUrlChange=()=>{this.externalId&&(window.clearTimeout(this.flushUrlChangeTimeout),this.flushUrlChangeTimeout=window.setTimeout(()=>this.flushUrlChange(),B))},this.onUserActivity=()=>this.ensureConnected(),this.mountSitePage=async(e,s)=>{d.setItem(I,s),o("mounting site page"),this.setResourceCenterLauncherHidden(!0);try{const{SitePage:n}=await T(async()=>{const{SitePage:r}=await import("./SitePage.js");return{SitePage:r}},__vite__mapDeps([35,1,2,3,4,5,6,7,19,20,36,37,38,39,40,41,42,43,44,45,28,16,13,14,15,10,11,12,26,27,21,9,46,29,47,48,33,34]));new n(this,e).mount(),o("site page mounted")}catch(n){console.error("Userflow: Failed to mount site page",n)}},this.remountIfNecessary=()=>{!this.ui?.container||document.contains(this.ui.container)||(o("remounting UI because container was missing"),this.remount())},o("constructor, build="+N),Z(this.onUrlChange),this.setTargetEnv(new ee),this.checkTestUserAtBoot(),this.toggleUI(),this.checkDebuggerSession();for(const e of P)document.addEventListener(e,this.remountIfNecessary)}get socketStatus(){return this._socketStatus}destroy(){o("destroy"),this.reset(),W(this.onUrlChange),this.destroyTargetEnv();for(const e of P)document.removeEventListener(e,this.remountIfNecessary)}setTargetEnv(e){this.destroyTargetEnv(),this.targetEnv=e,e.onBuilderMessage(this.onBuilderMessage)}destroyTargetEnv(){this.targetEnv&&(this.targetEnv.destroy(),this.targetEnv=null)}getTargetEnv(){if(!this.targetEnv)throw new h("Userflow.js: Cannot call getTargetEnv when protocol is not set");return this.targetEnv}setSessionStorageState(e){const s=e(this.getSessionStorageState());d.setItem(H,JSON.stringify(s)),this.sessionStorageState=s,this.toggleUI()}getSessionStorageState(){let e=this.sessionStorageState;if(!e){const s=d.getItem(H);if(s)try{e=JSON.parse(s)}catch(n){console.error("Userflow.js: Parse ElementSelectionState error:",n)}e||(e={testUser:null,activeApp:null,elementSelection:null,trackerTesting:null}),this.sessionStorageState=e}return e}checkTestUserAtBoot(){const e=this.getSessionStorageState().testUser;e&&(o("checkTestUserAtBoot identifying test user"),this.identifyTestUser(e))}async identifyTestUser(e){this.setSessionStorageState(i=>({...i,testUser:e})),this.reset(),this.init(e.clientToken),this.testUserIdentified=!0,this.externalId=e.id;const s=[this.identify(e.id,{name:e.name,email:e.email,signed_up_at:{set_once:new Date().toISOString(),data_type:"datetime"}},{signature:e.signature})],{group:n}=e;n&&(this.groupId=n.id,s.push(this.group(n.id,{name:n.name},{signature:n.signature}))),await Promise.all(s)}resetTestUser(){this.setSessionStorageState(e=>({...e,testUser:null}))}init(e){if(o("init",e),!e)throw new h("userflow.init() was called but missing Userflow.js Token");if(this.clientToken!==e){if(this.testUserIdentified){o("init() ignoring new token since a test user has been identified");return}this.clientToken&&(o("init() resetting due to new client token"),this.reset()),this.clientToken=e,this.emit("private:initialised")}}ensureInit(){if(!this.clientToken)throw new h("You must call userflow.init() first")}ensureIdentified(){if(this.ensureInit(),!this.externalId)throw new h("You must call userflow.identify() first");return this.externalId}ensureGroup(){if(this.ensureIdentified(),!this.groupId)throw new h("You must call userflow.group() first");return this.groupId}ensureConnected(){if(!this.clientToken||!this.externalId||(this.debounceInactiveDisconnect(),this.socket))return;this._socketStatus="connecting",o("connecting to socket");const e=/^ct_eu\d+_.+$/.test(this.clientToken)?"e.eu.":"e.";let s=f.serverEndpoint||e+"userflow.com";new URL(et).hostname==="js.getuserflow.com"&&s==="e.userflow.com"&&(s="e.getuserflow.com");const n="wss://"+s+"/end-users/"+this.clientToken+"/socket";this.socket=new z(n,{reconnectAfterMs:i=>[100,500,1e3,5e3][i-1]||1e4,timeout:20*1e3}),this.socket.connect(),this.socket.onOpen(()=>{o("socket opened")}),this.socket.onClose(()=>{this.emit("private:disconnect")}),this.socket.onError(i=>{console.log("Userflow.js socket error",i),this.reportCspIssue()}),this.channel=this.socket.channel(`end_users:${this.externalId}`,()=>this.makeChannelJoinPayload()),this.channel.join().receive("ok",i=>{typeof this.featureFlags>"u"&&this.clearInitialMessagesQueue(i.featureFlags),this.logrocketAppId=i.logrocketAppId,this.featureFlags=new Set(i.featureFlags),o("channel joined"),this._socketStatus!=="connected"&&(this._socketStatus="connected"),this.featureFlagEnabled("cff_implicit_events")===!0&&!this.implicitTracking&&this.startImplicitTracking(),!this.featureFlagEnabled("cff_implicit_events")&&this.implicitTracking&&(this.implicitTracking.stop(),this.implicitTracking=null)}).receive("error",i=>{["company_closed","invalid_client_token","invalid_user_external_id","incorrect_user_signature","rate_limit_exceeded","user_signature_required"].includes(i.code)?(console.error(`Userflow.js resetting due to: [${i.code}] ${i.message}`),this.reset(),this.clientToken=null):i.code==="invalid_protocol_version"?(console.error(`Userflow.js destroying due to: [${i.code}] ${i.message}`),this.destroy()):console.log("Userflow.js channel join error",i)}),this.channel.on("server_message",i=>this.handleServerMessage(i)),this.channel.on("server_error",i=>{console.log(`Userflow.js server error (${i.code}): ${i.message}`+(i.details&&i.details.length>0?`
5
5
  Details:
6
6
  `+i.details.map(r=>(r.path?`${r.path}: `:"")+r.message):""))})}async startImplicitTracking(){await T(()=>import("./implicit-tracking.js"),__vite__mapDeps([49,12,2,34,33])).then(e=>{this.implicitTracking=new e.ImplicitTracking(this),this.implicitTracking.start()}).catch(e=>o(`Implicit tracking failed to load ${e}`))}makeChannelJoinPayload(){let e;d.getItem(I)&&(e=new URL(m()).searchParams.get("announcement_id")||void 0);const n=this.buildClientContext();this.clientContext=n;const i={protocolVersion:2,userflowClientBuild:N,signature:this.signature,groupExternalId:this.groupId,groupSignature:this.groupSignature,flowSessionId:this.flowSession?.id||null,checklistSessionId:this.checklistSession?.id||null,bannerSessionId:this.bannerSession?.id||null,resourceCenterSessionId:this.resourceCenterSession?.id||null,siteSessionId:this.siteSession?.id||null,launchers:this.launcherSessions.map(r=>({flowId:r.flow.id})),trackers:Array.from(this.trackers.values()).map(r=>({flowId:r.tracker.flowId})),hasDraftSession:this.hasDraftSession(),clientConditions:Array.from(this.clientConditions.values()).map(r=>({conditionId:r.condition.id,isTrue:r.isTrue})),previewFlowId:d.getItem("previewFlowId"),announcementPreviewId:e,clientContext:n};return o("channel join payload",i),i}disconnect(){window.clearTimeout(this.debounceInactiveDisconnectTimeout),this.socket&&this.socket.disconnect(),this._socketStatus="disconnected",this.socket=null,this.channel=null}debounceInactiveDisconnect(){window.clearTimeout(this.debounceInactiveDisconnectTimeout),this.debounceInactiveDisconnectTimeout=window.setTimeout(()=>{if(this.hasDraftSession()||this.assistantMessageInProgress){this.debounceInactiveDisconnect();return}o("disconnecting from socket due to inactivity"),this.disconnect()},tt)}hasDraftSession(){return!!this.flowSession?.draftMode||!!this.checklistSession?.draftMode||!!this.bannerSession?.draftMode||!!this.resourceCenterSession?.draftMode||this.launcherSessions.some(e=>e.draftMode)}async send(e,{batch:s,endBatch:n,handlesRejection:i}={}){return(!this.inBatch||!["ToggleClientCondition","UpdateClientContext"].includes(e.kind))&&this.checkPushRateLimit(),this.ensureConnected(),s&&!this.inBatch&&(this.inBatch=!0,this.sendRaw({kind:"BeginBatch"})),this.inBatch&&(window.clearTimeout(this.endBatchTimeout),n?this.endBatch():this.endBatchTimeout=window.setTimeout(()=>{this.endBatch()},B)),this.sendRaw(e,{handlesRejection:i})}clearInitialMessagesQueue(e){if(this.initialMessagesQueue.length===0)return;const s=e.includes("cff_disable_page_views")===!0,n=e.includes("cff_implicit_events")===!1;for(const i of this.initialMessagesQueue){const{message:r,handlesRejection:a,resolve:u,reject:c}=i;if(n&&r.kind==="TrackRawEvent"){u("skipped due to disabled implicit events");continue}if(s&&(r.kind==="TrackEvent"&&r.name==="page_viewed"||r.kind==="TrackRawEvent"&&r.name==="page_viewed")){u("skipped due to disabled page views tracking");continue}this._sendToChannel(r,u,c,{handlesRejection:a})}this.initialMessagesQueue=[]}async sendRaw(e,{handlesRejection:s}={}){return typeof this.featureFlags>"u"?new Promise((n,i)=>{this.initialMessagesQueue.push({message:e,resolve:n,reject:i,handlesRejection:s})}):new Promise((n,i)=>{this._sendToChannel(e,n,i,{handlesRejection:s})})}_sendToChannel(e,s,n,{handlesRejection:i}={}){if(!this.channel){const c=`Userflow.js: send() should not be called if channel is not set. Message kind=${e.kind}`;if(i)throw Error(c);console.log(c,`
7
7
  Client message:`,e);return}o(`push ${e.kind} message`,e);const r=this.clientClock,a=()=>{this.serverClock=r,this.channel?.off("phx_error",u)},u=this.channel.on("phx_error",c=>{a();const l=`Userflow.js send ${e.kind} got phx_error`;this._socketStatus==="connected"&&console.log(l,`
package/vendor.core-js.js CHANGED
@@ -1,2 +1,2 @@
1
- (function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[e]="cf55a7c8-aa03-4213-826b-39d370c39618",r._sentryDebugIdIdentifier="sentry-dbid-cf55a7c8-aa03-4213-826b-39d370c39618")}catch{}})();var Ze=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};Ze.SENTRY_RELEASE={id:"85091e1ddc68d8f81aa6d5d6d32c749b67e15f56"};var F=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Yi(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var P=function(r){return r&&r.Math===Math&&r},f=P(typeof globalThis=="object"&&globalThis)||P(typeof window=="object"&&window)||P(typeof self=="object"&&self)||P(typeof F=="object"&&F)||P(typeof F=="object"&&F)||function(){return this}()||Function("return this")(),gr={},h=function(r){try{return!!r()}catch{return!0}},Qe=h,g=!Qe(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}),rt=h,Or=!rt(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")}),et=Or,B=Function.prototype.call,O=et?B.bind(B):function(){return B.apply(B,arguments)},fe={},se={}.propertyIsEnumerable,ye=Object.getOwnPropertyDescriptor,tt=ye&&!se.call({1:2},1);fe.f=tt?function(e){var t=ye(this,e);return!!t&&t.enumerable}:se;var de=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}},$e=Or,pe=Function.prototype,sr=pe.call,nt=$e&&pe.bind.bind(sr,sr),b=$e?nt:function(r){return function(){return sr.apply(r,arguments)}},be=b,at=be({}.toString),ot=be("".slice),q=function(r){return ot(at(r),8,-1)},it=b,vt=h,ut=q,H=Object,ct=it("".split),lt=vt(function(){return!H("z").propertyIsEnumerable(0)})?function(r){return ut(r)==="String"?ct(r,""):H(r)}:H,Sr=function(r){return r==null},ft=Sr,st=TypeError,he=function(r){if(ft(r))throw new st("Can't call method on "+r);return r},yt=lt,dt=he,Er=function(r){return yt(dt(r))},X=typeof document=="object"&&document.all,d=typeof X>"u"&&X!==void 0?function(r){return typeof r=="function"||r===X}:function(r){return typeof r=="function"},$t=d,_=function(r){return typeof r=="object"?r!==null:$t(r)},Z=f,pt=d,bt=function(r){return pt(r)?r:void 0},ge=function(r,e){return arguments.length<2?bt(Z[r]):Z[r]&&Z[r][e]},ht=b,Oe=ht({}.isPrototypeOf),gt=f,_r=gt.navigator,Dr=_r&&_r.userAgent,Se=Dr?String(Dr):"",Ee=f,Q=Se,Mr=Ee.process,Ar=Ee.Deno,Fr=Mr&&Mr.versions||Ar&&Ar.version,Br=Fr&&Fr.v8,$,W;Br&&($=Br.split("."),W=$[0]>0&&$[0]<4?1:+($[0]+$[1]));!W&&Q&&($=Q.match(/Edge\/(\d+)/),(!$||$[1]>=74)&&($=Q.match(/Chrome\/(\d+)/),$&&(W=+$[1])));var Te=W,Lr=Te,Ot=h,St=f,Et=St.String,we=!!Object.getOwnPropertySymbols&&!Ot(function(){var r=Symbol("symbol detection");return!Et(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&Lr&&Lr<41}),Tt=we,Ie=Tt&&!Symbol.sham&&typeof Symbol.iterator=="symbol",wt=ge,It=d,mt=Oe,Rt=Ie,Pt=Object,me=Rt?function(r){return typeof r=="symbol"}:function(r){var e=wt("Symbol");return It(e)&&mt(e.prototype,Pt(r))},Ct=String,Tr=function(r){try{return Ct(r)}catch{return"Object"}},jt=d,Nt=Tr,_t=TypeError,D=function(r){if(jt(r))return r;throw new _t(Nt(r)+" is not a function")},Dt=D,Mt=Sr,wr=function(r,e){var t=r[e];return Mt(t)?void 0:Dt(t)},rr=O,er=d,tr=_,At=TypeError,Ft=function(r,e){var t,n;if(e==="string"&&er(t=r.toString)&&!tr(n=rr(t,r))||er(t=r.valueOf)&&!tr(n=rr(t,r))||e!=="string"&&er(t=r.toString)&&!tr(n=rr(t,r)))return n;throw new At("Can't convert object to primitive value")},Re={exports:{}},Ur=f,Bt=Object.defineProperty,Ir=function(r,e){try{Bt(Ur,r,{value:e,configurable:!0,writable:!0})}catch{Ur[r]=e}return e},Lt=f,Ut=Ir,Gr="__core-js_shared__",xr=Re.exports=Lt[Gr]||Ut(Gr,{});(xr.versions||(xr.versions=[])).push({version:"3.39.0",mode:"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.39.0/LICENSE",source:"https://github.com/zloirock/core-js"});var mr=Re.exports,Kr=mr,Pe=function(r,e){return Kr[r]||(Kr[r]=e||{})},Gt=he,xt=Object,Kt=function(r){return xt(Gt(r))},Vt=b,kt=Kt,Wt=Vt({}.hasOwnProperty),S=Object.hasOwn||function(e,t){return Wt(kt(e),t)},zt=b,Yt=0,qt=Math.random(),Jt=zt(1 .toString),Ce=function(r){return"Symbol("+(r===void 0?"":r)+")_"+Jt(++Yt+qt,36)},Ht=f,Xt=Pe,Vr=S,Zt=Ce,Qt=we,rn=Ie,m=Ht.Symbol,nr=Xt("wks"),en=rn?m.for||m:m&&m.withoutSetter||Zt,E=function(r){return Vr(nr,r)||(nr[r]=Qt&&Vr(m,r)?m[r]:en("Symbol."+r)),nr[r]},tn=O,kr=_,Wr=me,nn=wr,an=Ft,on=E,vn=TypeError,un=on("toPrimitive"),cn=function(r,e){if(!kr(r)||Wr(r))return r;var t=nn(r,un),n;if(t){if(e===void 0&&(e="default"),n=tn(t,r,e),!kr(n)||Wr(n))return n;throw new vn("Can't convert object to primitive value")}return e===void 0&&(e="number"),an(r,e)},ln=cn,fn=me,je=function(r){var e=ln(r,"string");return fn(e)?e:e+""},sn=f,zr=_,yr=sn.document,yn=zr(yr)&&zr(yr.createElement),dn=function(r){return yn?yr.createElement(r):{}},$n=g,pn=h,bn=dn,Ne=!$n&&!pn(function(){return Object.defineProperty(bn("div"),"a",{get:function(){return 7}}).a!==7}),hn=g,gn=O,On=fe,Sn=de,En=Er,Tn=je,wn=S,In=Ne,Yr=Object.getOwnPropertyDescriptor;gr.f=hn?Yr:function(e,t){if(e=En(e),t=Tn(t),In)try{return Yr(e,t)}catch{}if(wn(e,t))return Sn(!gn(On.f,e,t),e[t])};var J={},mn=g,Rn=h,Pn=mn&&Rn(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42}),Cn=_,jn=String,Nn=TypeError,M=function(r){if(Cn(r))return r;throw new Nn(jn(r)+" is not an object")},_n=g,Dn=Ne,Mn=Pn,L=M,qr=je,An=TypeError,ar=Object.defineProperty,Fn=Object.getOwnPropertyDescriptor,or="enumerable",ir="configurable",vr="writable";J.f=_n?Mn?function(e,t,n){if(L(e),t=qr(t),L(n),typeof e=="function"&&t==="prototype"&&"value"in n&&vr in n&&!n[vr]){var a=Fn(e,t);a&&a[vr]&&(e[t]=n.value,n={configurable:ir in n?n[ir]:a[ir],enumerable:or in n?n[or]:a[or],writable:!1})}return ar(e,t,n)}:ar:function(e,t,n){if(L(e),t=qr(t),L(n),Dn)try{return ar(e,t,n)}catch{}if("get"in n||"set"in n)throw new An("Accessors not supported");return"value"in n&&(e[t]=n.value),e};var Bn=g,Ln=J,Un=de,_e=Bn?function(r,e,t){return Ln.f(r,e,Un(1,t))}:function(r,e,t){return r[e]=t,r},De={exports:{}},dr=g,Gn=S,Me=Function.prototype,xn=dr&&Object.getOwnPropertyDescriptor,Rr=Gn(Me,"name"),Kn=Rr&&function(){}.name==="something",Vn=Rr&&(!dr||dr&&xn(Me,"name").configurable),kn={EXISTS:Rr,PROPER:Kn,CONFIGURABLE:Vn},Wn=b,zn=d,$r=mr,Yn=Wn(Function.toString);zn($r.inspectSource)||($r.inspectSource=function(r){return Yn(r)});var Ae=$r.inspectSource,qn=f,Jn=d,Jr=qn.WeakMap,Hn=Jn(Jr)&&/native code/.test(String(Jr)),Xn=Pe,Zn=Ce,Hr=Xn("keys"),Qn=function(r){return Hr[r]||(Hr[r]=Zn(r))},Fe={},ra=Hn,Be=f,ea=_,ta=_e,ur=S,cr=mr,na=Qn,aa=Fe,Xr="Object already initialized",pr=Be.TypeError,oa=Be.WeakMap,z,N,Y,ia=function(r){return Y(r)?N(r):z(r,{})},va=function(r){return function(e){var t;if(!ea(e)||(t=N(e)).type!==r)throw new pr("Incompatible receiver, "+r+" required");return t}};if(ra||cr.state){var p=cr.state||(cr.state=new oa);p.get=p.get,p.has=p.has,p.set=p.set,z=function(r,e){if(p.has(r))throw new pr(Xr);return e.facade=r,p.set(r,e),e},N=function(r){return p.get(r)||{}},Y=function(r){return p.has(r)}}else{var I=na("state");aa[I]=!0,z=function(r,e){if(ur(r,I))throw new pr(Xr);return e.facade=r,ta(r,I,e),e},N=function(r){return ur(r,I)?r[I]:{}},Y=function(r){return ur(r,I)}}var ua={set:z,get:N,has:Y,enforce:ia,getterFor:va},Pr=b,ca=h,la=d,U=S,br=g,fa=kn.CONFIGURABLE,sa=Ae,Le=ua,ya=Le.enforce,da=Le.get,Zr=String,K=Object.defineProperty,$a=Pr("".slice),pa=Pr("".replace),ba=Pr([].join),ha=br&&!ca(function(){return K(function(){},"length",{value:8}).length!==8}),ga=String(String).split("String"),Oa=De.exports=function(r,e,t){$a(Zr(e),0,7)==="Symbol("&&(e="["+pa(Zr(e),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),t&&t.getter&&(e="get "+e),t&&t.setter&&(e="set "+e),(!U(r,"name")||fa&&r.name!==e)&&(br?K(r,"name",{value:e,configurable:!0}):r.name=e),ha&&t&&U(t,"arity")&&r.length!==t.arity&&K(r,"length",{value:t.arity});try{t&&U(t,"constructor")&&t.constructor?br&&K(r,"prototype",{writable:!1}):r.prototype&&(r.prototype=void 0)}catch{}var n=ya(r);return U(n,"source")||(n.source=ba(ga,typeof e=="string"?e:"")),r};Function.prototype.toString=Oa(function(){return la(this)&&da(this).source||sa(this)},"toString");var Sa=De.exports,Ea=d,Ta=J,wa=Sa,Ia=Ir,ma=function(r,e,t,n){n||(n={});var a=n.enumerable,o=n.name!==void 0?n.name:e;if(Ea(t)&&wa(t,o,n),n.global)a?r[e]=t:Ia(e,t);else{try{n.unsafe?r[e]&&(a=!0):delete r[e]}catch{}a?r[e]=t:Ta.f(r,e,{value:t,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return r},Ue={},Ra=Math.ceil,Pa=Math.floor,Ca=Math.trunc||function(e){var t=+e;return(t>0?Pa:Ra)(t)},ja=Ca,Ge=function(r){var e=+r;return e!==e||e===0?0:ja(e)},Na=Ge,_a=Math.max,Da=Math.min,Ma=function(r,e){var t=Na(r);return t<0?_a(t+e,0):Da(t,e)},Aa=Ge,Fa=Math.min,Ba=function(r){var e=Aa(r);return e>0?Fa(e,9007199254740991):0},La=Ba,xe=function(r){return La(r.length)},Ua=Er,Ga=Ma,xa=xe,Qr=function(r){return function(e,t,n){var a=Ua(e),o=xa(a);if(o===0)return!r&&-1;var i=Ga(n,o),v;if(r&&t!==t){for(;o>i;)if(v=a[i++],v!==v)return!0}else for(;o>i;i++)if((r||i in a)&&a[i]===t)return r||i||0;return!r&&-1}},Ka={includes:Qr(!0),indexOf:Qr(!1)},Va=b,lr=S,ka=Er,Wa=Ka.indexOf,za=Fe,re=Va([].push),Ya=function(r,e){var t=ka(r),n=0,a=[],o;for(o in t)!lr(za,o)&&lr(t,o)&&re(a,o);for(;e.length>n;)lr(t,o=e[n++])&&(~Wa(a,o)||re(a,o));return a},qa=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Ja=Ya,Ha=qa,Xa=Ha.concat("length","prototype");Ue.f=Object.getOwnPropertyNames||function(e){return Ja(e,Xa)};var Ke={};Ke.f=Object.getOwnPropertySymbols;var Za=ge,Qa=b,ro=Ue,eo=Ke,to=M,no=Qa([].concat),ao=Za("Reflect","ownKeys")||function(e){var t=ro.f(to(e)),n=eo.f;return n?no(t,n(e)):t},ee=S,oo=ao,io=gr,vo=J,uo=function(r,e,t){for(var n=oo(e),a=vo.f,o=io.f,i=0;i<n.length;i++){var v=n[i];!ee(r,v)&&!(t&&ee(t,v))&&a(r,v,o(e,v))}},co=h,lo=d,fo=/#|\.prototype\./,A=function(r,e){var t=yo[so(r)];return t===po?!0:t===$o?!1:lo(e)?co(e):!!e},so=A.normalize=function(r){return String(r).replace(fo,".").toLowerCase()},yo=A.data={},$o=A.NATIVE="N",po=A.POLYFILL="P",Ve=A,G=f,bo=gr.f,ho=_e,go=ma,Oo=Ir,So=uo,Eo=Ve,To=function(r,e){var t=r.target,n=r.global,a=r.stat,o,i,v,u,c,s;if(n?i=G:a?i=G[t]||Oo(t,{}):i=G[t]&&G[t].prototype,i)for(v in e){if(c=e[v],r.dontCallGetSet?(s=bo(i,v),u=s&&s.value):u=i[v],o=Eo(n?v:t+(a?".":"#")+v,r.forced),!o&&u!==void 0){if(typeof c==typeof u)continue;So(c,u)}(r.sham||u&&u.sham)&&ho(c,"sham",!0),go(i,v,c,r)}},ke={},te=D,wo=TypeError,Io=function(r){var e,t;this.promise=new r(function(n,a){if(e!==void 0||t!==void 0)throw new wo("Bad Promise constructor");e=n,t=a}),this.resolve=te(e),this.reject=te(t)};ke.f=function(r){return new Io(r)};var mo=function(r){try{return{error:!1,value:r()}}catch(e){return{error:!0,value:e}}},Ro=q,Po=b,Co=function(r){if(Ro(r)==="Function")return Po(r)},ne=Co,jo=D,No=Or,_o=ne(ne.bind),Do=function(r,e){return jo(r),e===void 0?r:No?_o(r,e):function(){return r.apply(e,arguments)}},We={},Mo=E,Ao=We,Fo=Mo("iterator"),Bo=Array.prototype,Lo=function(r){return r!==void 0&&(Ao.Array===r||Bo[Fo]===r)},Uo=E,Go=Uo("toStringTag"),ze={};ze[Go]="z";var xo=String(ze)==="[object z]",Ko=xo,Vo=d,V=q,ko=E,Wo=ko("toStringTag"),zo=Object,Yo=V(function(){return arguments}())==="Arguments",qo=function(r,e){try{return r[e]}catch{}},Jo=Ko?V:function(r){var e,t,n;return r===void 0?"Undefined":r===null?"Null":typeof(t=qo(e=zo(r),Wo))=="string"?t:Yo?V(e):(n=V(e))==="Object"&&Vo(e.callee)?"Arguments":n},Ho=Jo,ae=wr,Xo=Sr,Zo=We,Qo=E,ri=Qo("iterator"),Ye=function(r){if(!Xo(r))return ae(r,ri)||ae(r,"@@iterator")||Zo[Ho(r)]},ei=O,ti=D,ni=M,ai=Tr,oi=Ye,ii=TypeError,vi=function(r,e){var t=arguments.length<2?oi(r):e;if(ti(t))return ni(ei(t,r));throw new ii(ai(r)+" is not iterable")},ui=O,oe=M,ci=wr,li=function(r,e,t){var n,a;oe(r);try{if(n=ci(r,"return"),!n){if(e==="throw")throw t;return t}n=ui(n,r)}catch(o){a=!0,n=o}if(e==="throw")throw t;if(a)throw n;return oe(n),t},fi=Do,si=O,yi=M,di=Tr,$i=Lo,pi=xe,ie=Oe,bi=vi,hi=Ye,ve=li,gi=TypeError,k=function(r,e){this.stopped=r,this.result=e},ue=k.prototype,Oi=function(r,e,t){var n=t&&t.that,a=!!(t&&t.AS_ENTRIES),o=!!(t&&t.IS_RECORD),i=!!(t&&t.IS_ITERATOR),v=!!(t&&t.INTERRUPTED),u=fi(e,n),c,s,T,R,l,w,Cr,jr=function(y){return c&&ve(c,"normal",y),new k(!0,y)},Nr=function(y){return a?(yi(y),v?u(y[0],y[1],jr):u(y[0],y[1])):v?u(y,jr):u(y)};if(o)c=r.iterator;else if(i)c=r;else{if(s=hi(r),!s)throw new gi(di(r)+" is not iterable");if($i(s)){for(T=0,R=pi(r);R>T;T++)if(l=Nr(r[T]),l&&ie(ue,l))return l;return new k(!1)}c=bi(r,s)}for(w=o?r.next:c.next;!(Cr=si(w,c)).done;){try{l=Nr(Cr.value)}catch(y){ve(c,"throw",y)}if(typeof l=="object"&&l&&ie(ue,l))return l}return new k(!1)},Si=f,qe=Si.Promise,Ei=E,Je=Ei("iterator"),He=!1;try{var Ti=0,ce={next:function(){return{done:!!Ti++}},return:function(){He=!0}};ce[Je]=function(){return this},Array.from(ce,function(){throw 2})}catch{}var wi=function(r,e){try{if(!e&&!He)return!1}catch{return!1}var t=!1;try{var n={};n[Je]=function(){return{next:function(){return{done:t=!0}}}},r(n)}catch{}return t},C=f,Ii=Se,mi=q,x=function(r){return Ii.slice(0,r.length)===r},Ri=function(){return x("Bun/")?"BUN":x("Cloudflare-Workers")?"CLOUDFLARE":x("Deno/")?"DENO":x("Node.js/")?"NODE":C.Bun&&typeof Bun.version=="string"?"BUN":C.Deno&&typeof Deno.version=="object"?"DENO":mi(C.process)==="process"?"NODE":C.window&&C.document?"BROWSER":"REST"}(),Pi=f,j=qe,Ci=d,ji=Ve,Ni=Ae,_i=E,le=Ri,fr=Te;j&&j.prototype;var Di=_i("species"),hr=!1,Xe=Ci(Pi.PromiseRejectionEvent),Mi=ji("Promise",function(){var r=Ni(j),e=r!==String(j);if(!e&&fr===66)return!0;if(!fr||fr<51||!/native code/.test(r)){var t=new j(function(o){o(1)}),n=function(o){o(function(){},function(){})},a=t.constructor={};if(a[Di]=n,hr=t.then(function(){})instanceof n,!hr)return!0}return!e&&(le==="BROWSER"||le==="DENO")&&!Xe}),Ai={CONSTRUCTOR:Mi,REJECTION_EVENT:Xe,SUBCLASSING:hr},Fi=qe,Bi=wi,Li=Ai.CONSTRUCTOR,Ui=Li||!Bi(function(r){Fi.all(r).then(void 0,function(){})}),Gi=To,xi=O,Ki=D,Vi=ke,ki=mo,Wi=Oi,zi=Ui;Gi({target:"Promise",stat:!0,forced:zi},{allSettled:function(e){var t=this,n=Vi.f(t),a=n.resolve,o=n.reject,i=ki(function(){var v=Ki(t.resolve),u=[],c=0,s=1;Wi(e,function(T){var R=c++,l=!1;s++,xi(v,t,T).then(function(w){l||(l=!0,u[R]={status:"fulfilled",value:w},--s||a(u))},function(w){l||(l=!0,u[R]={status:"rejected",reason:w},--s||a(u))})}),--s||a(u)});return i.error&&o(i.value),n.promise}});export{F as c,Yi as g};
1
+ (function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=new Error().stack;e&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[e]="82c78e09-9bb7-4a84-9a04-475811ada455",r._sentryDebugIdIdentifier="sentry-dbid-82c78e09-9bb7-4a84-9a04-475811ada455")}catch{}})();var Ze=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};Ze.SENTRY_RELEASE={id:"9b2911967c30773009faf8252c7ebee1879852c0"};var F=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Yi(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var P=function(r){return r&&r.Math===Math&&r},f=P(typeof globalThis=="object"&&globalThis)||P(typeof window=="object"&&window)||P(typeof self=="object"&&self)||P(typeof F=="object"&&F)||P(typeof F=="object"&&F)||function(){return this}()||Function("return this")(),gr={},h=function(r){try{return!!r()}catch{return!0}},Qe=h,g=!Qe(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}),rt=h,Or=!rt(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")}),et=Or,B=Function.prototype.call,O=et?B.bind(B):function(){return B.apply(B,arguments)},fe={},se={}.propertyIsEnumerable,ye=Object.getOwnPropertyDescriptor,tt=ye&&!se.call({1:2},1);fe.f=tt?function(e){var t=ye(this,e);return!!t&&t.enumerable}:se;var $e=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}},de=Or,pe=Function.prototype,sr=pe.call,nt=de&&pe.bind.bind(sr,sr),b=de?nt:function(r){return function(){return sr.apply(r,arguments)}},be=b,at=be({}.toString),ot=be("".slice),q=function(r){return ot(at(r),8,-1)},it=b,vt=h,ut=q,H=Object,ct=it("".split),lt=vt(function(){return!H("z").propertyIsEnumerable(0)})?function(r){return ut(r)==="String"?ct(r,""):H(r)}:H,Sr=function(r){return r==null},ft=Sr,st=TypeError,he=function(r){if(ft(r))throw new st("Can't call method on "+r);return r},yt=lt,$t=he,Er=function(r){return yt($t(r))},X=typeof document=="object"&&document.all,$=typeof X>"u"&&X!==void 0?function(r){return typeof r=="function"||r===X}:function(r){return typeof r=="function"},dt=$,_=function(r){return typeof r=="object"?r!==null:dt(r)},Z=f,pt=$,bt=function(r){return pt(r)?r:void 0},ge=function(r,e){return arguments.length<2?bt(Z[r]):Z[r]&&Z[r][e]},ht=b,Oe=ht({}.isPrototypeOf),gt=f,_r=gt.navigator,Dr=_r&&_r.userAgent,Se=Dr?String(Dr):"",Ee=f,Q=Se,Mr=Ee.process,Ar=Ee.Deno,Fr=Mr&&Mr.versions||Ar&&Ar.version,Br=Fr&&Fr.v8,d,W;Br&&(d=Br.split("."),W=d[0]>0&&d[0]<4?1:+(d[0]+d[1]));!W&&Q&&(d=Q.match(/Edge\/(\d+)/),(!d||d[1]>=74)&&(d=Q.match(/Chrome\/(\d+)/),d&&(W=+d[1])));var Te=W,Lr=Te,Ot=h,St=f,Et=St.String,we=!!Object.getOwnPropertySymbols&&!Ot(function(){var r=Symbol("symbol detection");return!Et(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&Lr&&Lr<41}),Tt=we,Ie=Tt&&!Symbol.sham&&typeof Symbol.iterator=="symbol",wt=ge,It=$,mt=Oe,Rt=Ie,Pt=Object,me=Rt?function(r){return typeof r=="symbol"}:function(r){var e=wt("Symbol");return It(e)&&mt(e.prototype,Pt(r))},Ct=String,Tr=function(r){try{return Ct(r)}catch{return"Object"}},jt=$,Nt=Tr,_t=TypeError,D=function(r){if(jt(r))return r;throw new _t(Nt(r)+" is not a function")},Dt=D,Mt=Sr,wr=function(r,e){var t=r[e];return Mt(t)?void 0:Dt(t)},rr=O,er=$,tr=_,At=TypeError,Ft=function(r,e){var t,n;if(e==="string"&&er(t=r.toString)&&!tr(n=rr(t,r))||er(t=r.valueOf)&&!tr(n=rr(t,r))||e!=="string"&&er(t=r.toString)&&!tr(n=rr(t,r)))return n;throw new At("Can't convert object to primitive value")},Re={exports:{}},Ur=f,Bt=Object.defineProperty,Ir=function(r,e){try{Bt(Ur,r,{value:e,configurable:!0,writable:!0})}catch{Ur[r]=e}return e},Lt=f,Ut=Ir,Gr="__core-js_shared__",xr=Re.exports=Lt[Gr]||Ut(Gr,{});(xr.versions||(xr.versions=[])).push({version:"3.39.0",mode:"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.39.0/LICENSE",source:"https://github.com/zloirock/core-js"});var mr=Re.exports,Kr=mr,Pe=function(r,e){return Kr[r]||(Kr[r]=e||{})},Gt=he,xt=Object,Kt=function(r){return xt(Gt(r))},Vt=b,kt=Kt,Wt=Vt({}.hasOwnProperty),S=Object.hasOwn||function(e,t){return Wt(kt(e),t)},zt=b,Yt=0,qt=Math.random(),Jt=zt(1 .toString),Ce=function(r){return"Symbol("+(r===void 0?"":r)+")_"+Jt(++Yt+qt,36)},Ht=f,Xt=Pe,Vr=S,Zt=Ce,Qt=we,rn=Ie,m=Ht.Symbol,nr=Xt("wks"),en=rn?m.for||m:m&&m.withoutSetter||Zt,E=function(r){return Vr(nr,r)||(nr[r]=Qt&&Vr(m,r)?m[r]:en("Symbol."+r)),nr[r]},tn=O,kr=_,Wr=me,nn=wr,an=Ft,on=E,vn=TypeError,un=on("toPrimitive"),cn=function(r,e){if(!kr(r)||Wr(r))return r;var t=nn(r,un),n;if(t){if(e===void 0&&(e="default"),n=tn(t,r,e),!kr(n)||Wr(n))return n;throw new vn("Can't convert object to primitive value")}return e===void 0&&(e="number"),an(r,e)},ln=cn,fn=me,je=function(r){var e=ln(r,"string");return fn(e)?e:e+""},sn=f,zr=_,yr=sn.document,yn=zr(yr)&&zr(yr.createElement),$n=function(r){return yn?yr.createElement(r):{}},dn=g,pn=h,bn=$n,Ne=!dn&&!pn(function(){return Object.defineProperty(bn("div"),"a",{get:function(){return 7}}).a!==7}),hn=g,gn=O,On=fe,Sn=$e,En=Er,Tn=je,wn=S,In=Ne,Yr=Object.getOwnPropertyDescriptor;gr.f=hn?Yr:function(e,t){if(e=En(e),t=Tn(t),In)try{return Yr(e,t)}catch{}if(wn(e,t))return Sn(!gn(On.f,e,t),e[t])};var J={},mn=g,Rn=h,Pn=mn&&Rn(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42}),Cn=_,jn=String,Nn=TypeError,M=function(r){if(Cn(r))return r;throw new Nn(jn(r)+" is not an object")},_n=g,Dn=Ne,Mn=Pn,L=M,qr=je,An=TypeError,ar=Object.defineProperty,Fn=Object.getOwnPropertyDescriptor,or="enumerable",ir="configurable",vr="writable";J.f=_n?Mn?function(e,t,n){if(L(e),t=qr(t),L(n),typeof e=="function"&&t==="prototype"&&"value"in n&&vr in n&&!n[vr]){var a=Fn(e,t);a&&a[vr]&&(e[t]=n.value,n={configurable:ir in n?n[ir]:a[ir],enumerable:or in n?n[or]:a[or],writable:!1})}return ar(e,t,n)}:ar:function(e,t,n){if(L(e),t=qr(t),L(n),Dn)try{return ar(e,t,n)}catch{}if("get"in n||"set"in n)throw new An("Accessors not supported");return"value"in n&&(e[t]=n.value),e};var Bn=g,Ln=J,Un=$e,_e=Bn?function(r,e,t){return Ln.f(r,e,Un(1,t))}:function(r,e,t){return r[e]=t,r},De={exports:{}},$r=g,Gn=S,Me=Function.prototype,xn=$r&&Object.getOwnPropertyDescriptor,Rr=Gn(Me,"name"),Kn=Rr&&function(){}.name==="something",Vn=Rr&&(!$r||$r&&xn(Me,"name").configurable),kn={EXISTS:Rr,PROPER:Kn,CONFIGURABLE:Vn},Wn=b,zn=$,dr=mr,Yn=Wn(Function.toString);zn(dr.inspectSource)||(dr.inspectSource=function(r){return Yn(r)});var Ae=dr.inspectSource,qn=f,Jn=$,Jr=qn.WeakMap,Hn=Jn(Jr)&&/native code/.test(String(Jr)),Xn=Pe,Zn=Ce,Hr=Xn("keys"),Qn=function(r){return Hr[r]||(Hr[r]=Zn(r))},Fe={},ra=Hn,Be=f,ea=_,ta=_e,ur=S,cr=mr,na=Qn,aa=Fe,Xr="Object already initialized",pr=Be.TypeError,oa=Be.WeakMap,z,N,Y,ia=function(r){return Y(r)?N(r):z(r,{})},va=function(r){return function(e){var t;if(!ea(e)||(t=N(e)).type!==r)throw new pr("Incompatible receiver, "+r+" required");return t}};if(ra||cr.state){var p=cr.state||(cr.state=new oa);p.get=p.get,p.has=p.has,p.set=p.set,z=function(r,e){if(p.has(r))throw new pr(Xr);return e.facade=r,p.set(r,e),e},N=function(r){return p.get(r)||{}},Y=function(r){return p.has(r)}}else{var I=na("state");aa[I]=!0,z=function(r,e){if(ur(r,I))throw new pr(Xr);return e.facade=r,ta(r,I,e),e},N=function(r){return ur(r,I)?r[I]:{}},Y=function(r){return ur(r,I)}}var ua={set:z,get:N,has:Y,enforce:ia,getterFor:va},Pr=b,ca=h,la=$,U=S,br=g,fa=kn.CONFIGURABLE,sa=Ae,Le=ua,ya=Le.enforce,$a=Le.get,Zr=String,K=Object.defineProperty,da=Pr("".slice),pa=Pr("".replace),ba=Pr([].join),ha=br&&!ca(function(){return K(function(){},"length",{value:8}).length!==8}),ga=String(String).split("String"),Oa=De.exports=function(r,e,t){da(Zr(e),0,7)==="Symbol("&&(e="["+pa(Zr(e),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),t&&t.getter&&(e="get "+e),t&&t.setter&&(e="set "+e),(!U(r,"name")||fa&&r.name!==e)&&(br?K(r,"name",{value:e,configurable:!0}):r.name=e),ha&&t&&U(t,"arity")&&r.length!==t.arity&&K(r,"length",{value:t.arity});try{t&&U(t,"constructor")&&t.constructor?br&&K(r,"prototype",{writable:!1}):r.prototype&&(r.prototype=void 0)}catch{}var n=ya(r);return U(n,"source")||(n.source=ba(ga,typeof e=="string"?e:"")),r};Function.prototype.toString=Oa(function(){return la(this)&&$a(this).source||sa(this)},"toString");var Sa=De.exports,Ea=$,Ta=J,wa=Sa,Ia=Ir,ma=function(r,e,t,n){n||(n={});var a=n.enumerable,o=n.name!==void 0?n.name:e;if(Ea(t)&&wa(t,o,n),n.global)a?r[e]=t:Ia(e,t);else{try{n.unsafe?r[e]&&(a=!0):delete r[e]}catch{}a?r[e]=t:Ta.f(r,e,{value:t,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return r},Ue={},Ra=Math.ceil,Pa=Math.floor,Ca=Math.trunc||function(e){var t=+e;return(t>0?Pa:Ra)(t)},ja=Ca,Ge=function(r){var e=+r;return e!==e||e===0?0:ja(e)},Na=Ge,_a=Math.max,Da=Math.min,Ma=function(r,e){var t=Na(r);return t<0?_a(t+e,0):Da(t,e)},Aa=Ge,Fa=Math.min,Ba=function(r){var e=Aa(r);return e>0?Fa(e,9007199254740991):0},La=Ba,xe=function(r){return La(r.length)},Ua=Er,Ga=Ma,xa=xe,Qr=function(r){return function(e,t,n){var a=Ua(e),o=xa(a);if(o===0)return!r&&-1;var i=Ga(n,o),v;if(r&&t!==t){for(;o>i;)if(v=a[i++],v!==v)return!0}else for(;o>i;i++)if((r||i in a)&&a[i]===t)return r||i||0;return!r&&-1}},Ka={includes:Qr(!0),indexOf:Qr(!1)},Va=b,lr=S,ka=Er,Wa=Ka.indexOf,za=Fe,re=Va([].push),Ya=function(r,e){var t=ka(r),n=0,a=[],o;for(o in t)!lr(za,o)&&lr(t,o)&&re(a,o);for(;e.length>n;)lr(t,o=e[n++])&&(~Wa(a,o)||re(a,o));return a},qa=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Ja=Ya,Ha=qa,Xa=Ha.concat("length","prototype");Ue.f=Object.getOwnPropertyNames||function(e){return Ja(e,Xa)};var Ke={};Ke.f=Object.getOwnPropertySymbols;var Za=ge,Qa=b,ro=Ue,eo=Ke,to=M,no=Qa([].concat),ao=Za("Reflect","ownKeys")||function(e){var t=ro.f(to(e)),n=eo.f;return n?no(t,n(e)):t},ee=S,oo=ao,io=gr,vo=J,uo=function(r,e,t){for(var n=oo(e),a=vo.f,o=io.f,i=0;i<n.length;i++){var v=n[i];!ee(r,v)&&!(t&&ee(t,v))&&a(r,v,o(e,v))}},co=h,lo=$,fo=/#|\.prototype\./,A=function(r,e){var t=yo[so(r)];return t===po?!0:t===$o?!1:lo(e)?co(e):!!e},so=A.normalize=function(r){return String(r).replace(fo,".").toLowerCase()},yo=A.data={},$o=A.NATIVE="N",po=A.POLYFILL="P",Ve=A,G=f,bo=gr.f,ho=_e,go=ma,Oo=Ir,So=uo,Eo=Ve,To=function(r,e){var t=r.target,n=r.global,a=r.stat,o,i,v,u,c,s;if(n?i=G:a?i=G[t]||Oo(t,{}):i=G[t]&&G[t].prototype,i)for(v in e){if(c=e[v],r.dontCallGetSet?(s=bo(i,v),u=s&&s.value):u=i[v],o=Eo(n?v:t+(a?".":"#")+v,r.forced),!o&&u!==void 0){if(typeof c==typeof u)continue;So(c,u)}(r.sham||u&&u.sham)&&ho(c,"sham",!0),go(i,v,c,r)}},ke={},te=D,wo=TypeError,Io=function(r){var e,t;this.promise=new r(function(n,a){if(e!==void 0||t!==void 0)throw new wo("Bad Promise constructor");e=n,t=a}),this.resolve=te(e),this.reject=te(t)};ke.f=function(r){return new Io(r)};var mo=function(r){try{return{error:!1,value:r()}}catch(e){return{error:!0,value:e}}},Ro=q,Po=b,Co=function(r){if(Ro(r)==="Function")return Po(r)},ne=Co,jo=D,No=Or,_o=ne(ne.bind),Do=function(r,e){return jo(r),e===void 0?r:No?_o(r,e):function(){return r.apply(e,arguments)}},We={},Mo=E,Ao=We,Fo=Mo("iterator"),Bo=Array.prototype,Lo=function(r){return r!==void 0&&(Ao.Array===r||Bo[Fo]===r)},Uo=E,Go=Uo("toStringTag"),ze={};ze[Go]="z";var xo=String(ze)==="[object z]",Ko=xo,Vo=$,V=q,ko=E,Wo=ko("toStringTag"),zo=Object,Yo=V(function(){return arguments}())==="Arguments",qo=function(r,e){try{return r[e]}catch{}},Jo=Ko?V:function(r){var e,t,n;return r===void 0?"Undefined":r===null?"Null":typeof(t=qo(e=zo(r),Wo))=="string"?t:Yo?V(e):(n=V(e))==="Object"&&Vo(e.callee)?"Arguments":n},Ho=Jo,ae=wr,Xo=Sr,Zo=We,Qo=E,ri=Qo("iterator"),Ye=function(r){if(!Xo(r))return ae(r,ri)||ae(r,"@@iterator")||Zo[Ho(r)]},ei=O,ti=D,ni=M,ai=Tr,oi=Ye,ii=TypeError,vi=function(r,e){var t=arguments.length<2?oi(r):e;if(ti(t))return ni(ei(t,r));throw new ii(ai(r)+" is not iterable")},ui=O,oe=M,ci=wr,li=function(r,e,t){var n,a;oe(r);try{if(n=ci(r,"return"),!n){if(e==="throw")throw t;return t}n=ui(n,r)}catch(o){a=!0,n=o}if(e==="throw")throw t;if(a)throw n;return oe(n),t},fi=Do,si=O,yi=M,$i=Tr,di=Lo,pi=xe,ie=Oe,bi=vi,hi=Ye,ve=li,gi=TypeError,k=function(r,e){this.stopped=r,this.result=e},ue=k.prototype,Oi=function(r,e,t){var n=t&&t.that,a=!!(t&&t.AS_ENTRIES),o=!!(t&&t.IS_RECORD),i=!!(t&&t.IS_ITERATOR),v=!!(t&&t.INTERRUPTED),u=fi(e,n),c,s,T,R,l,w,Cr,jr=function(y){return c&&ve(c,"normal",y),new k(!0,y)},Nr=function(y){return a?(yi(y),v?u(y[0],y[1],jr):u(y[0],y[1])):v?u(y,jr):u(y)};if(o)c=r.iterator;else if(i)c=r;else{if(s=hi(r),!s)throw new gi($i(r)+" is not iterable");if(di(s)){for(T=0,R=pi(r);R>T;T++)if(l=Nr(r[T]),l&&ie(ue,l))return l;return new k(!1)}c=bi(r,s)}for(w=o?r.next:c.next;!(Cr=si(w,c)).done;){try{l=Nr(Cr.value)}catch(y){ve(c,"throw",y)}if(typeof l=="object"&&l&&ie(ue,l))return l}return new k(!1)},Si=f,qe=Si.Promise,Ei=E,Je=Ei("iterator"),He=!1;try{var Ti=0,ce={next:function(){return{done:!!Ti++}},return:function(){He=!0}};ce[Je]=function(){return this},Array.from(ce,function(){throw 2})}catch{}var wi=function(r,e){try{if(!e&&!He)return!1}catch{return!1}var t=!1;try{var n={};n[Je]=function(){return{next:function(){return{done:t=!0}}}},r(n)}catch{}return t},C=f,Ii=Se,mi=q,x=function(r){return Ii.slice(0,r.length)===r},Ri=function(){return x("Bun/")?"BUN":x("Cloudflare-Workers")?"CLOUDFLARE":x("Deno/")?"DENO":x("Node.js/")?"NODE":C.Bun&&typeof Bun.version=="string"?"BUN":C.Deno&&typeof Deno.version=="object"?"DENO":mi(C.process)==="process"?"NODE":C.window&&C.document?"BROWSER":"REST"}(),Pi=f,j=qe,Ci=$,ji=Ve,Ni=Ae,_i=E,le=Ri,fr=Te;j&&j.prototype;var Di=_i("species"),hr=!1,Xe=Ci(Pi.PromiseRejectionEvent),Mi=ji("Promise",function(){var r=Ni(j),e=r!==String(j);if(!e&&fr===66)return!0;if(!fr||fr<51||!/native code/.test(r)){var t=new j(function(o){o(1)}),n=function(o){o(function(){},function(){})},a=t.constructor={};if(a[Di]=n,hr=t.then(function(){})instanceof n,!hr)return!0}return!e&&(le==="BROWSER"||le==="DENO")&&!Xe}),Ai={CONSTRUCTOR:Mi,REJECTION_EVENT:Xe,SUBCLASSING:hr},Fi=qe,Bi=wi,Li=Ai.CONSTRUCTOR,Ui=Li||!Bi(function(r){Fi.all(r).then(void 0,function(){})}),Gi=To,xi=O,Ki=D,Vi=ke,ki=mo,Wi=Oi,zi=Ui;Gi({target:"Promise",stat:!0,forced:zi},{allSettled:function(e){var t=this,n=Vi.f(t),a=n.resolve,o=n.reject,i=ki(function(){var v=Ki(t.resolve),u=[],c=0,s=1;Wi(e,function(T){var R=c++,l=!1;s++,xi(v,t,T).then(function(w){l||(l=!0,u[R]={status:"fulfilled",value:w},--s||a(u))},function(w){l||(l=!0,u[R]={status:"rejected",reason:w},--s||a(u))})}),--s||a(u)});return i.error&&o(i.value),n.promise}});export{F as c,Yi as g};
2
2
  //# sourceMappingURL=vendor.core-js.js.map