var qe=Object.defineProperty;var Kt=Object.getOwnPropertySymbols;var Ue=Object.prototype.hasOwnProperty,$e=Object.prototype.propertyIsEnumerable;var Gt=(t,e,n)=>e in t?qe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Yt=(t,e)=>{for(var n in e||(e={}))Ue.call(e,n)&&Gt(t,n,e[n]);if(Kt)for(var n of Kt(e))$e.call(e,n)&&Gt(t,n,e[n]);return t};var _e=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var k=(t,e,n)=>new Promise((r,i)=>{var o=c=>{try{l(n.next(c))}catch(d){i(d)}},s=c=>{try{l(n.throw(c))}catch(d){i(d)}},l=c=>c.done?r(c.value):Promise.resolve(c.value).then(o,s);l((n=n.apply(t,e)).next())});var Gr=_e(j=>{(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var T=Uint8Array,ot=Uint16Array,He=Int32Array,fe=new T([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),de=new T([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),ze=new T([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),he=function(t,e){for(var n=new ot(31),r=0;r<31;++r)n[r]=e+=1<>1|(S&21845)<<1;W=(W&52428)>>2|(W&13107)<<2,W=(W&61680)>>4|(W&3855)<<4,Lt[S]=((W&65280)>>8|(W&255)<<8)>>1}var lt=function(t,e,n){for(var r=t.length,i=0,o=new ot(e);i>c]=d}else for(l=new ot(r),i=0;i>15-t[i]);return l},ht=new T(288);for(var S=0;S<144;++S)ht[S]=8;for(var S=144;S<256;++S)ht[S]=9;for(var S=256;S<280;++S)ht[S]=7;for(var S=280;S<288;++S)ht[S]=8;var ye=new T(32);for(var S=0;S<32;++S)ye[S]=5;var Ge=lt(ht,9,1),Ye=lt(ye,5,1),Ot=function(t){for(var e=t[0],n=1;ne&&(e=t[n]);return e},B=function(t,e,n){var r=e/8|0;return(t[r]|t[r+1]<<8)>>(e&7)&n},Ft=function(t,e){var n=e/8|0;return(t[n]|t[n+1]<<8|t[n+2]<<16)>>(e&7)},Qe=function(t){return(t+7)/8|0},be=function(t,e,n){return(e==null||e<0)&&(e=0),(n==null||n>t.length)&&(n=t.length),new T(t.subarray(e,n))},Ze=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],V=function(t,e,n){var r=new Error(e||Ze[t]);if(r.code=t,Error.captureStackTrace&&Error.captureStackTrace(r,V),!n)throw r;return r},je=function(t,e,n,r){var i=t.length,o=0;if(!i||e.f&&!e.l)return n||new T(0);var s=!n,l=s||e.i!=2,c=e.i;s&&(n=new T(i*3));var d=function(zt){var Wt=n.length;if(zt>Wt){var Xt=new T(Math.max(Wt*2,zt));Xt.set(n),n=Xt}},p=e.f||0,f=e.p||0,m=e.b||0,g=e.l,D=e.d,tt=e.m,G=e.n,pt=i*8;do{if(!g){p=B(t,f,1);var Y=B(t,f+1,3);if(f+=3,Y)if(Y==1)g=Ge,D=Ye,tt=9,G=5;else if(Y==2){var yt=B(t,f,31)+257,rt=B(t,f+10,15)+4,_=yt+B(t,f+5,31)+1;f+=14;for(var q=new T(_),ut=new T(19),N=0;N>4;if(P<16)q[N++]=P;else{var z=0,Q=0;for(P==16?(Q=3+B(t,f,3),f+=2,z=q[N-1]):P==17?(Q=3+B(t,f,7),f+=3):P==18&&(Q=11+B(t,f,127),f+=7);Q--;)q[N++]=z}}var u=q.subarray(0,yt),h=q.subarray(yt);tt=Ot(u),G=Ot(h),g=lt(u,tt,1),D=lt(h,G,1)}else V(1);else{var P=Qe(f)+4,et=t[P-4]|t[P-3]<<8,nt=P+et;if(nt>i){c&&V(0);break}l&&d(m+et),n.set(t.subarray(P,nt),m),e.b=m+=et,e.p=f=nt*8,e.f=p;continue}if(f>pt){c&&V(0);break}}l&&d(m+131072);for(var b=(1<>4;if(f+=z&15,f>pt){c&&V(0);break}if(z||V(2),v<256)n[m++]=v;else if(v==256){w=f,g=null;break}else{var C=v-254;if(v>264){var N=v-257,O=fe[N];C=B(t,f,(1<>4;R||V(3),f+=R&15;var h=Ke[F];if(F>3){var O=de[F];h+=Ft(t,f)&(1<pt){c&&V(0);break}l&&d(m+131072);var Z=m+C;if(m127)+(r>223)+(r>239);if(n+i>t.length)return{s:e,r:be(t,n-1)};i?i==3?(r=((r&15)<<18|(t[n++]&63)<<12|(t[n++]&63)<<6|t[n++]&63)-65536,e+=String.fromCharCode(55296|r>>10,56320|r&1023)):i&1?e+=String.fromCharCode((r&31)<<6|t[n++]&63):e+=String.fromCharCode((r&15)<<12|(t[n++]&63)<<6|t[n++]&63):e+=String.fromCharCode(r)}};function rn(t,e){var n;if(Rt)return Rt.decode(t);var r=nn(t),i=r.s,n=r.r;return n.length&&V(8),i}/*! (c) 2020 Andrea Giammarchi */const{parse:on,stringify:Qr}=JSON,{keys:sn}=Object,Et=String,an="string",Qt={},ge="object",un=(t,e)=>e,ln=t=>t instanceof Et?Et(t):t,cn=(t,e)=>typeof e===an?new Et(e):e,Ee=(t,e,n,r)=>{const i=[];for(let o=sn(n),{length:s}=o,l=0;l{const n=on(t,cn).map(ln),r=n[0],i=un,o=typeof r===ge&&r?Ee(n,new Set,r,i):r;return i.call({"":o},"",o)};function dn(t){const e=atob(t),n=e.length,r=new Uint8Array(n);for(let i=0;it.getAttribute("if-id")).filter(t=>t)}function yn(){const t=window.location.search;return new URLSearchParams(t).has("if-debug-mode")}function L(t,e){yn()&&console.log("[IF-DEBUG]",t,` `,e)}function Tt(t){return new Promise(e=>{setTimeout(e,t)})}function bn(t,e){return t.endsWith(e)?t.slice(0,t.length-e.length):t}function qt(t){return t.replace(/'/g,"\\'").replace(/"/g,'\\"')}function ve(t){return 200<=t&&t<=299}function J(t,e){return t.querySelector(e)}function x(t,e){return Array.from(t.querySelectorAll(e))}function ft(t,...e){for(const n of e){if(!t||!n||/\s/.test(n))return;t.classList.add(n)}}function vt(t,...e){for(const n of e){if(!t||!n||/\s/.test(n))return;t.classList.remove(n)}}function Bt(t,e){return window.getComputedStyle(t).getPropertyValue(e)}function Ut(t,e){return t.querySelector(`input[type='radio'][data-name='${qt(e)}']:checked`)}function gn(t){return function(e){return!!(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING)}}function En(t){return function(e){return!!(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING)}}function vn(t,e){const r=Array.from(document.querySelectorAll(e)).find(i=>t.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_FOLLOWING);return r||null}function Sn(t,e){const r=Array.from(document.querySelectorAll(e)).reverse().find(i=>t.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_PRECEDING);return r||null}function Cn(t,e){t.forEach(n=>{n&&n.removeAttribute(e)})}function xn(t){let e=[];function n(r){if(r.nodeType===Node.TEXT_NODE)e.push(r);else for(let i=0;i{var r,i,o,s;return n.nodeType===Node.TEXT_NODE&&e.nodeType===Node.TEXT_NODE&&((i=(r=n.textContent)==null?void 0:r.length)!=null?i:0)>((s=(o=e.textContent)==null?void 0:o.length)!=null?s:0)?n:e},document.createTextNode(""))}function bt(t,e,n,r={deDuplicateChangeEvents:!0}){if(!t)return;let i;const o=Array.isArray(e)?e:[e];for(const s of o)t.addEventListener(s,l=>{if(l.type==="change"&&i.type==="input"&&r.deDuplicateChangeEvents&&i.target===l.target&&l.timeStamp-i.timeStamp<5){i=l;return}return i=l,n(l)})}function $t(t,e){return x(t,`input[type='radio'][data-name='${qt(e)}']`)}function An(t,e){var n;vt(t,e),(n=t.parentElement)!=null&&n.hasAttribute("if-step")||vt(t.parentElement,e)}function On(t,e){var n;ft(t,e),(n=t.parentElement)!=null&&n.hasAttribute("if-step")||ft(t.parentElement,e)}function dt(t,...e){ft(t,...e);for(const n of t.children)n instanceof HTMLElement&&dt(n,...e)}function X(t,...e){vt(t,...e);for(const n of t.children)n instanceof HTMLElement&&X(n,...e)}function _t(t){const e=document.createElement("style");e.setAttribute("type","text/css"),e.innerHTML=t,document.head.appendChild(e)}function Fn(t,e,n){e?(t.forEach(r=>r.setAttribute("aria-disabled","true")),t.forEach(r=>r.classList.add(n))):(t.forEach(r=>r.removeAttribute("aria-disabled")),t.forEach(r=>r.classList.remove(n))),L("changed disabled button state")}function In(t,e){let n=Bt(t,"display");if(n==="none"&&(n=Bt(e,"display")),n==="none"&&(n="block"),t.setAttribute("data-if-display",n),t.getAttribute("if-id")===e.getAttribute("if-id")){t.style.opacity="1";return}t.style.opacity="0",t.style.display="none"}function kn(t,e){return k(this,null,function*(){yield Dn(t),Nn(e)})}function Dn(t){return k(this,null,function*(){const e=document.body.querySelector(`[if-id='${t.id}']`);e.style.transition="opacity 200ms ease-out",e.style.opacity="0",yield Tt(200),e.offsetHeight,e.style.display="none"})}function Nn(t){const e=document.body.querySelector(`[if-id='${t.id}']`);e.style.transition="opacity 200ms ease-in";const n=e.getAttribute("data-if-display");e.style.display=n||"block",e.offsetHeight,e.style.opacity="1"}function Jt(t,e){return t.querySelector(`[if-step][if-id='${e.id}']`)}function Pn(t){const e=J(t,"[if-step][if-id]"),n=e==null?void 0:e.getAttribute("if-id");if(!n)throw new Error("can't find id of first step element");return n}function Se(t,e){return t.querySelector(`[if-id='${e}']`)}function Ln(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ce={exports:{}};Ce.exports=function(t){if(typeof t!="string")throw new Error("Invalid input. Input must be a string");var e=t.match(/(\/?)(.+)\1([a-z]*)/i);if(!e)throw new Error("Invalid regular expression format.");var n=Array.from(new Set(e[3])).filter(function(r){return"gimsuy".includes(r)}).join("");return new RegExp(e[2],n)};var Rn=Ce.exports;const te=Ln(Rn);function st(t){return[...new Set(t)]}function Mt(t){var n;if(t.type==="radio group"){const r=Ut(document.body,t.name);return(n=r==null?void 0:r.value)!=null?n:""}const e=mt(document.body,t.id);return(e==null?void 0:e.value)||""}function ee(t,e){if(e.type!=="radio"&&e.type!=="checkbox")return!1;const n=t.querySelector(`[if-id='${e.id}']`);return(n==null?void 0:n.checked)||!1}function ct(t,e){return e.type==="radio group"?null:mt(t,e.id)}function gt(t,e){return e.map(n=>ct(t,n)).filter(n=>n)}function Tn(t,e){return st(gt(t,e))}function mt(t,e){return t.querySelector(`[if-id='${e}']`)}class Bn{add(e,n,r){if(typeof arguments[0]!="string")for(let i in arguments[0])this.add(i,arguments[0][i],arguments[1]);else(Array.isArray(e)?e:[e]).forEach(function(i){this[i]=this[i]||[],n&&this[i][r?"unshift":"push"](n)},this)}run(e,n){this[e]=this[e]||[],this[e].forEach(function(r){r.call(n&&n.context?n.context:n,n)})}}class Mn{constructor(e){this.jsep=e,this.registered={}}register(...e){e.forEach(n=>{if(typeof n!="object"||!n.name||!n.init)throw new Error("Invalid JSEP plugin format");this.registered[n.name]||(n.init(this.jsep),this.registered[n.name]=n)})}}class a{static get version(){return"1.3.9"}static toString(){return"JavaScript Expression Parser (JSEP) v"+a.version}static addUnaryOp(e){return a.max_unop_len=Math.max(e.length,a.max_unop_len),a.unary_ops[e]=1,a}static addBinaryOp(e,n,r){return a.max_binop_len=Math.max(e.length,a.max_binop_len),a.binary_ops[e]=n,r?a.right_associative.add(e):a.right_associative.delete(e),a}static addIdentifierChar(e){return a.additional_identifier_chars.add(e),a}static addLiteral(e,n){return a.literals[e]=n,a}static removeUnaryOp(e){return delete a.unary_ops[e],e.length===a.max_unop_len&&(a.max_unop_len=a.getMaxKeyLen(a.unary_ops)),a}static removeAllUnaryOps(){return a.unary_ops={},a.max_unop_len=0,a}static removeIdentifierChar(e){return a.additional_identifier_chars.delete(e),a}static removeBinaryOp(e){return delete a.binary_ops[e],e.length===a.max_binop_len&&(a.max_binop_len=a.getMaxKeyLen(a.binary_ops)),a.right_associative.delete(e),a}static removeAllBinaryOps(){return a.binary_ops={},a.max_binop_len=0,a}static removeLiteral(e){return delete a.literals[e],a}static removeAllLiterals(){return a.literals={},a}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(e){this.expr=e,this.index=0}static parse(e){return new a(e).parse()}static getMaxKeyLen(e){return Math.max(0,...Object.keys(e).map(n=>n.length))}static isDecimalDigit(e){return e>=48&&e<=57}static binaryPrecedence(e){return a.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!a.binary_ops[String.fromCharCode(e)]||a.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return a.isIdentifierStart(e)||a.isDecimalDigit(e)}throwError(e){const n=new Error(e+" at character "+this.index);throw n.index=this.index,n.description=e,n}runHook(e,n){if(a.hooks[e]){const r={context:this,node:n};return a.hooks.run(e,r),r.node}return n}searchHook(e){if(a.hooks[e]){const n={context:this};return a.hooks[e].find(function(r){return r.call(n.context,n),n.node}),n.node}}gobbleSpaces(){let e=this.code;for(;e===a.SPACE_CODE||e===a.TAB_CODE||e===a.LF_CODE||e===a.CR_CODE;)e=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");const e=this.gobbleExpressions(),n=e.length===1?e[0]:{type:a.COMPOUND,body:e};return this.runHook("after-all",n)}gobbleExpressions(e){let n=[],r,i;for(;this.index0;){if(a.binary_ops.hasOwnProperty(e)&&(!a.isIdentifierStart(this.code)||this.index+e.lengtho.right_a&&f.right_a?r>f.prec:r<=f.prec;for(;i.length>2&&p(i[i.length-2]);)l=i.pop(),n=i.pop().value,s=i.pop(),e={type:a.BINARY_EXP,operator:n,left:s,right:l},i.push(e);e=this.gobbleToken(),e||this.throwError("Expected expression after "+d),i.push(o,e)}for(c=i.length-1,e=i[c];c>1;)e={type:a.BINARY_EXP,operator:i[c-1].value,left:i[c-2],right:e},c-=2;return e}gobbleToken(){let e,n,r,i;if(this.gobbleSpaces(),i=this.searchHook("gobble-token"),i)return this.runHook("after-token",i);if(e=this.code,a.isDecimalDigit(e)||e===a.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===a.SQUOTE_CODE||e===a.DQUOTE_CODE)i=this.gobbleStringLiteral();else if(e===a.OBRACK_CODE)i=this.gobbleArray();else{for(n=this.expr.substr(this.index,a.max_unop_len),r=n.length;r>0;){if(a.unary_ops.hasOwnProperty(n)&&(!a.isIdentifierStart(this.code)||this.index+n.length=n.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}else if(o===a.COMMA_CODE){if(this.index++,i++,i!==n.length){if(e===a.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===a.CBRACK_CODE)for(let s=n.length;s":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},right_associative:new Set,additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"});a.max_unop_len=a.getMaxKeyLen(a.unary_ops);a.max_binop_len=a.getMaxKeyLen(a.binary_ops);const at=t=>new a(t).parse(),qn=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(a).filter(t=>!qn.includes(t)&&at[t]===void 0).forEach(t=>{at[t]=a[t]});at.Jsep=a;const Un="ConditionalExpression";var $n={name:"ternary",init(t){t.hooks.add("after-expression",function(n){if(n.node&&this.code===t.QUMARK_CODE){this.index++;const r=n.node,i=this.gobbleExpression();if(i||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===t.COLON_CODE){this.index++;const o=this.gobbleExpression();if(o||this.throwError("Expected expression"),n.node={type:Un,test:r,consequent:i,alternate:o},r.operator&&t.binary_ops[r.operator]<=.9){let s=r;for(;s.right.operator&&t.binary_ops[s.right.operator]<=.9;)s=s.right;n.node.test=s.right,s.right=n.node,n.node=r}}else this.throwError("Expected :")}})}};at.plugins.register($n);function xe(t,e){if(e.type==="input"){const n=t.inputs.find(r=>r.id===e.id);return n?Mt(n):""}else if(e.type==="variable"){const n=t.variables.find(r=>r.id===e.id);return n?n.value:""}return""}function K(t,e){return e.type==="freetext"?e.value:xe(t,e)}function we(t,e){return e.map(n=>K(t,n)).join("")}function _n(t,e){return e.map(n=>n.type==="freetext"?K(t,n):encodeURIComponent(K(t,n))).join("")}function Hn(t,e){const r=e.map(o=>{if(o.type==="freetext")return K(t,o);const s=K(t,o);return s||"0"}).join("").replace(/\s/g,"");at.addBinaryOp("**",11,!0);const i=at(r);return M(i)}function M(t){var e;if(t.type==="Compound")return 0;if(t.type==="Literal"&&Number.isNaN(t.raw))throw new Error("invalid math expression");if(t.type==="Literal"&&!Number.isNaN(t.raw))return Number(t.raw);if(t.type==="UnaryExpression"&&t.operator==="-")return-1*M(t.argument);if(t.type==="Identifier"){if(t.name==="e")return Math.E;if(t.name==="pi")return Math.PI}if(t.type==="BinaryExpression"){const n=M(t.left),r=M(t.right);if(t.operator==="+")return n+r;if(t.operator==="-")return n-r;if(t.operator==="*")return n*r;if(t.operator==="/")return n/r;if(t.operator==="%")return n%r;if(t.operator==="**")return Math.pow(n,r);throw L("invalid math expression operator",t.operator),new Error(`invalid math expression operator '${t.operator}'`)}if(t.type==="CallExpression"){const n=(e=t.arguments)!=null?e:[],r=t.callee.name;if(r==="sqrt"){if(n.length!==1)throw new Error("'sqrt' (square root) function can only have 1 argument");return Math.sqrt(M(n[0]))}if(r==="abs"){if(n.length!==1)throw new Error("'abs' (absolute) function can only have 1 argument");return Math.abs(M(n[0]))}if(r==="sin"){if(n.length!==1)throw new Error("'sin' (sine) function can only have 1 argument");return Math.sin(M(n[0]))}if(r==="cos"){if(n.length!==1)throw new Error("'cos' (cosine) function can only have 1 argument");return Math.cos(M(n[0]))}if(r==="max"){if(n.length===0)throw new Error("'max' (maximum) function must have at least 1 argument");return Math.max(...n.map(i=>M(i)))}if(r==="min"){if(n.length===0)throw new Error("'min' (minimum) function must have at least 1 argument");return Math.min(...n.map(i=>M(i)))}if(r==="avg"){if(n.length===0)throw new Error("'avg' (average) function must have at least 1 argument");return n.map(i=>M(i)).reduce((i,o)=>i+o,0)/n.length}throw L("invalid math function",r),new Error("invalid math function")}throw L("invalid math expression",t),new Error("invalid math expression")}function Ae(t,e){const n=Math.round(t/e)*e;return parseFloat(n.toFixed(zn(e)))}function zn(t){const e=t.toString();return e.includes(".")?e.split(".")[1].length:0}function ne(t,e){return t===e?!0:Math.abs(t-e)<1e-5}function St(t){for(const e of t.rule)if(Wn({condition:e,config:t.config,history:t.history,currentStepId:t.currentStepId}))return!0;return!1}function Wn(t){var e;for(const n of t.condition)if(((e=n.targetElement)==null?void 0:e.type)==="step"){if(!t.history||!t.currentStepId||!Kn(n,t.history,t.currentStepId))return!1}else if(!Xn(n,t.config))return!1;return!0}function Xn(t,e){if(t.function==="any other case")return!0;if(!t.targetElement||!t.function)return!1;const n=xe(e,t.targetElement),r=K(e,t.parameter),i=t.parameter2?K(e,t.parameter2):null;let o=!1;if(t.targetElement.type==="input"){const s=e.inputs.find(l=>{var c;return l.id===((c=t.targetElement)==null?void 0:c.id)});s&&(o=ee(document.body,s))}if(t.function==="is selected")return o;if(t.function==="is not selected")return!o;if(t.function==="is"&&t.parameter.type==="input"&&t.targetElement.type==="input"){const s=e.inputs.find(c=>{var d;return c.id===((d=t.targetElement)==null?void 0:d.id)}),l=e.inputs.find(c=>c.id===t.parameter.id);if(((s==null?void 0:s.type)==="radio group"||!(s!=null&&s.type))&&(l==null?void 0:l.type)==="radio")return ee(document.body,l)}if(t.function==="equals"||t.function==="is")return I(n)&&I(r)?ne(Number(n),Number(r)):n===r;if(t.function==="does not equal"||t.function==="is not")return I(n)&&I(r)?!ne(Number(n),Number(r)):n!==r;if(t.function==="contains")return n.includes(r);if(t.function==="does not contain")return!n.includes(r);if(t.function==="is empty")return!n.length;if(t.function==="is not empty")return!!n.length;if(t.function==="regexp match")try{return te(r.trim()).test(n)}catch(s){return console.error("invalid regular expression in Inputflow rule"),!0}if(t.function==="regexp no match")try{return!te(r.trim()).test(n)}catch(s){return console.error("invalid regular expression in Inputflow rule"),!0}return t.function==="greater than"?I(n)&&I(r)?Number(n)>Number(r):n>r:t.function==="greater than / equals"?I(n)&&I(r)?Number(n)>=Number(r):n>=r:t.function==="smaller than"?I(n)&&I(r)?Number(n)(?[0-9a-z!#$%&'*+-\\/=?^_`\\{|\\}~\\u{80}-\\u{10FFFF}]+(\\.[0-9a-z!#$%&'*+-\\/=?^_`\\{|\\}~\\u{80}-\\u{10FFFF}]+)*)|(?\"([\\x20-\\x21\\x23-\\x5B\\x5D-\\x7E\\u{80}-\\u{10FFFF}]|\\\\[\\x20-\\x7E])*\"))(?(?\\[((?[a-z0-9-]*[[a-z0-9]:[\\x21-\\x5A\\x5E-\\x7E]+))\\])|(?(?!.{256,})(([0-9a-z\\u{80}-\\u{10FFFF}]([0-9a-z-\\u{80}-\\u{10FFFF}]*[0-9a-z\\u{80}-\\u{10FFFF}])?))(\\.([0-9a-z\\u{80}-\\u{10FFFF}]([0-9a-z-\\u{80}-\\u{10FFFF}]*[0-9a-z\\u{80}-\\u{10FFFF}])?))+(?(?[0-9a-z!#$%&'*+-\\/=?^_`\\{|\\}~\\u{80}-\\u{10FFFF}]+(\\.[0-9a-z!#$%&'*+-\\/=?^_`\\{|\\}~\\u{80}-\\u{10FFFF}]+)*)|(?\"([\\x20-\\x21\\x23-\\x5B\\x5D-\\x7E\\u{80}-\\u{10FFFF}]|\\\\[\\x20-\\x7E])*\"))(?(?\\[((?[a-z0-9-]*[[a-z0-9]:[\\x21-\\x5A\\x5E-\\x7E]+))\\])|(?(?!.{256,})(([0-9a-z\\u{80}-\\u{10FFFF}]([0-9a-z-\\u{80}-\\u{10FFFF}]*[0-9a-z\\u{80}-\\u{10FFFF}])?))(\\.([0-9a-z\\u{80}-\\u{10FFFF}]([0-9a-z-\\u{80}-\\u{10FFFF}]*[0-9a-z\\u{80}-\\u{10FFFF}])?))+(?{var s;return o.block.id===((s=t.targetElement)==null?void 0:s.id)}):t.function==="has not been reached"?!(r||e.some(o=>{var s;return o.block.id===((s=t.targetElement)==null?void 0:s.id)})):!1}function re(t,e){for(const n of t)for(const r of n)if(r.function===e)return!0;return!1}function I(t){return!Number.isNaN(Number(t))}function ie(t,e){var o,s,l;const n=t.paths.filter(c=>c.sourceBlockId===e.id);if(L("outgoing paths",n),n.length===1){const c=n[0].targetBlockId;return(o=t.blocks.find(d=>d.id===c))!=null?o:null}const r=n.filter(c=>St({config:t,rule:c.rule}));L("Original true paths",r),r.reverse().sort((c,d)=>{const p=re(c.rule,"any other case"),f=re(d.rule,"any other case");return p&&!f?1:!p&&f?-1:0}),L("Sorted true paths",r),L("Chosen true path",r[0]);const i=(s=r[0])==null?void 0:s.targetBlockId;return(l=t.blocks.find(c=>c.id===i))!=null?l:null}function Oe(t){for(let e=0;e1&&(d=l.slice(1).join(";").trim());const p=document.createElement("span");p.setAttribute("if-show",c),p.innerText=d;const f=document.createTextNode(r.slice(0,i)),m=document.createTextNode(r.slice(o+1));t.replaceChild(m,n),t.insertBefore(p,m),t.insertBefore(f,p)}}const Gn=new Map;function $(t,e){const n=Gn.get(t)||x(document.body,`[if-show='${t}']`);for(const r of n)r.innerText!==e&&(r.innerText=e)}function oe(t,e,n){const r=e.reduce((i,o)=>(i[o.id]=o.value,i),{});t.push({block:n,variableState:r})}function Yn(t){return[...t].reverse().find(n=>n.block.type==="step")}function Qn(t){const e=t.closest("[if-step]");return e?Zn(e)?vn(t,"[if-element='error']"):Sn(t,"[if-element='error']"):null}function Zn(t){const e=t.querySelector("input[data-if-has-validation], select[data-if-has-validation], textarea[data-if-has-validation]"),n=t.querySelector("[if-element='error'");return!n||!e?!1:gn(n)(e)}function jn(t){let e=Bt(t,"display");e==="none"&&(e="inline-block"),t.dataset.ifDisplay=e,t.style.transition="opacity .3s ease-out",t.style.opacity="0",t.style.display="none"}function Fe(t){t.forEach(e=>{e.style.display="none",e.style.opacity="0",e.offsetHeight})}function Jn(t,e){e.forEach(n=>er(t,n))}function tr(t){t.forEach(e=>nr(e))}function er(t,e){if(!e.input)return;const n=t.inputs.find(l=>{var c;return l.id===((c=e.input)==null?void 0:c.id)});if(!n)return;let r=mt(document.body,e.input.id);if(n.type==="radio group"&&(r=document.body.querySelector(`input[type='radio'][data-name='${qt(n.name)}']`)),!r)return;const i=Qn(r);if(!i)return;const o=xn(i),s=wn(o);s.textContent=e.error,rr(i)}function nr(t){if(!t)return;const e=mt(document.body,t.id);e&&e.validity.valueMissing&&e.reportValidity()}function rr(t){const e=t.dataset.ifDisplay;t.style.display=e!=null?e:"inline-block",t.offsetHeight,t.style.opacity="1"}function se(t,e){const n=document.body.querySelector(`[if-id='${e.id}']`),r=x(n,"[if-element='error']"),i=t.validations.filter(l=>l.stepId===e.id);if(r.length||t.generalSettings.disableNextButtonOptions.isActive&&i.length){Fe(r);const l=Ie(t,i).reverse();return Jn(t,l),!l.length}const s=ke(t,e).reverse();return tr(s),!s.length}function ir(t,e){const n=document.body.querySelector(`[if-id='${e.id}']`),r=x(n,"[if-element='error']"),i=t.validations.filter(s=>s.stepId===e.id);return r.length||t.generalSettings.disableNextButtonOptions.isActive&&i.length?!Ie(t,i).length:!ke(t,e).length}function Ie(t,e){return e.filter(n=>!or(t,n))}function ke(t,e){const r=t.inputs.filter(i=>i.stepId===e.id).filter(i=>{const o=ct(document.body,i);return o?o.validity.valueMissing:!1});return r.sort((i,o)=>{const s=Se(document.body,e.id);if(!s)return 0;const l=ct(s,i),c=ct(s,o);return!l||!c?0:En(l)(c)?-1:1}),r}function or(t,e){return e.input?!St({config:t,rule:e.rule}):!0}function Vt(t,e){return t.toLocaleString(e.languageCode,{useGrouping:e.thousandsSeparator,minimumFractionDigits:e.decimalFormat==="fixed"?e.decimalPlaces:0,maximumFractionDigits:e.decimalPlaces})}function ae(t){if(t.mode==="default")return{languageCode:"en-US",decimalFormat:"variable",decimalPlaces:2,thousandsSeparator:!1};const e=Yt({},t.numberFormat);return e.languageCode=e.languageCode||"en-US",t.useWebsiteLanguageCode&&(e.languageCode=document.documentElement.lang||e.languageCode),e}function sr(t){const e={};return t.forEach(n=>{var r;return e[n.id]=(r=n.value)!=null?r:""}),e}function It(t,e){t.forEach(n=>{n.value!==e[n.id]&&(n.value=e[n.id])})}function ar(t,e={}){return t.type==="number"&&!t.value&&(t.value="0"),new Proxy(t,{set(n,r,i){if(r==="value"){if(n.type==="number"&&!i&&(i="0"),n.value===i)return!0;if(n.value=i,n.type==="number"&&e.numberDisplayFormat){const o=Vt(Number(n.value),e.numberDisplayFormat);$(n.name,o)}else $(n.name,i)}return!0}})}function ur(t,e){const n=t.querySelector(`input[data-name='${e.name}'][name='${e.name}'][readonly]`);if(n){n.value=e.value;return}const r=document.createElement("input");r.name=e.name,r.dataset.name=e.name,r.type=e.type,r.value=e.value,r.style.display="none",r.setAttribute("tabindex","-1"),r.setAttribute("readonly","true"),t.append(r)}function De(t,e){e.forEach(n=>lr(t,n))}function lr(t,e){e.rule.length&&!St({rule:e.rule,config:t})||cr(t,e.actions)}function cr(t,e){e.forEach(n=>fr(t,n))}function fr(t,e){const n=t.variables.find(i=>{var o;return i.id===((o=e.variable)==null?void 0:o.id)});if(!n)return;const r=K(t,e.parameter);if(n.type==="number"){const i=Number(n.value),o=Number(r);e.operation==="minus"?n.value=String(i-o):e.operation==="plus"?n.value=String(i+o):e.operation==="multiply by"?n.value=String(i*o):e.operation==="divide by"?n.value=String(i/o):e.operation==="plus %"?n.value=String(i+i*o/100):e.operation==="minus %"?n.value=String(i-i*o/100):e.operation==="set to"?e.formulaParameter.length===1&&e.formulaParameter[0].type==="freetext"&&e.formulaParameter[0].value==="vide"?n.value="vide":n.value=Hn(t,e.formulaParameter).toString():e.operation==="round to"&&o&&(n.value=String(Ae(i,o)))}else n.type==="text"&&(e.operation==="set to"?n.value=we(t,e.formulaParameter):e.operation==="append"&&(n.value+=r))}function kt(t){t.preventDefault(),t.stopImmediatePropagation()}function dr(t,e){window.location.href=hr(t,e.url)}function hr(t,e){let n=_n(t,e.baseUrl);if(!e.queryParams.length)return n;const r=e.queryParams.reduce((i,o)=>{const s=encodeURIComponent(o.key),l=encodeURIComponent(we(t,o.value));return`${i}${s}=${l}&`},"?");return n+bn(r,"&")}function mr(t,e){const n=t.calculations.filter(r=>r.blockId===e.id);De(t,n)}function Ne(t){const e=new FormData(t),n={};return t.querySelectorAll("input[data-name], select[data-name], textarea[data-name]").forEach(r=>{var s,l;const i=r,o=i.getAttribute("data-name");o&&(i.type==="checkbox"?n[o]=!!e.get(i.name):i.type==="radio"?n[o]=n[o]||((l=(s=Ut(t,o))==null?void 0:s.value)!=null?l:null):i.type==="number"||i.type==="range"?n[o]=Number(e.get(i.name)):n[o]=e.get(i.name))}),JSON.stringify(n)}function pr(t){x(t,"input[type='submit']").forEach(n=>{const r=n.getAttribute("data-wait");n.setAttribute("data-if-submit-button-text",n.value),r&&(n.value=r)})}function yr(t){x(t,"input[type='submit']").forEach(n=>{const r=n.getAttribute("data-if-submit-button-text");r&&(n.value=r)})}function br(t){return k(this,null,function*(){pr(t);const e=t.parentElement;(yield gr(t))?(J(e,".w-form-done").style.display="block",J(e,".w-form-fail").style.display="none",t.style.display="none"):J(e,".w-form-fail").style.display="block",yr(t)})}function gr(t){return k(this,null,function*(){try{return yield Er(t)}catch(e){return console.log(e),!1}})}function Er(t){return k(this,null,function*(){const e=t.getAttribute("action");return e?Le(e)?yield Sr(t):Cr(e)?yield vr(t):yield Pe(t):!1})}function Pe(t){return k(this,null,function*(){const e=Ne(t),n=t.getAttribute("action");if(!n)return!1;const i=yield fetch(n,{method:"POST",body:e,headers:{"Content-Type":"application/json"}});return ve(i.status)})}function vr(t){return k(this,null,function*(){return yield Pe(t)})}function Sr(t){return k(this,null,function*(){const e=Ne(t),n=t.getAttribute("action");if(!n)return!1;const r={method:"POST",body:e};Le(n)&&(r.headers=void 0);const i=yield fetch(n,r);return(yield i.json()).status==="success"&&ve(i.status)})}function Cr(t){return t.includes("make.com")}function Le(t){return t.includes("zapier")}function ue(t){return k(this,null,function*(){return new Promise((e,n)=>{const r=J(t,".w-form-done");if((r==null?void 0:r.style.display)&&(r==null?void 0:r.style.display)!=="none"){e(!0);return}const o=new MutationObserver(l=>{for(const c of l)if(c.type==="attributes"&&c.attributeName==="style"){const d=c.target;if(d.classList.contains("w-form-done")&&d.style.display&&d.style.display!=="none"){o.disconnect(),e(!0);break}if(d.classList.contains("w-form-fail")&&d.style.display&&d.style.display!=="none"){o.disconnect(),e(!1);break}}}),s={attributes:!0,childList:!1,subtree:!0};o.observe(t,s)})})}function xr(t){const e=getComputedStyle(E(t)).display,n=` .w-form form[if-id='${t}'] { display: ${e} !important; } .w-form form[if-id='${t}'] ~ .w-form-done { display: none !important; }`;return _t(n)}function wr(t,e,n){e.map(i=>{const o=n.find(s=>{var l;return s.id===((l=i.input)==null?void 0:l.id)});return o?o.type==="radio group"?$t(t,o.name)[0]:ct(t,o):null}).filter(i=>i).forEach(i=>i==null?void 0:i.setAttribute("data-if-has-validation","true"))}function Ar(t){let e=[],n=[];for(const r of t.conditionalStyles)St({rule:r.rule,config:t.config,history:t.history,currentStepId:t.currentStepId})?e.push(r):n.push(r);return{activeCs:e,inactiveCs:n}}function Or(t){const e=t.map(n=>n.id).join(",");document.body.setAttribute("data-if-active-conditional-styles",e)}function Fr(){var t,e;return(e=(t=document.body.getAttribute("data-if-active-conditional-styles"))==null?void 0:t.split(","))!=null?e:[]}function Ir(t){const e=t.map(n=>n.id).join(",");document.body.setAttribute("data-if-inactive-conditional-styles",e)}function kr(){var t,e;return(e=(t=document.body.getAttribute("data-if-inactive-conditional-styles"))==null?void 0:t.split(","))!=null?e:[]}function Dr(t){return _t(Nr(t))}function Nr(t){let e="";for(const n of t)e+=`${Pr(n)} `;return e}function Pr(t){let e="";for(const n of t.styles)if(n.elementSelection.customAttribute){if(n.type==="custom"){const r=`body[data-if-active-conditional-styles*="${t.id}"] [${n.elementSelection.customAttribute.name}="${n.elementSelection.customAttribute.value}"]`;e+=`${r} ${Lr(n)} `}else if(n.type==="visibility"){const r=`body[data-if-inactive-conditional-styles*="${t.id}"] [${n.elementSelection.customAttribute.name}="${n.elementSelection.customAttribute.value}"]`;e+=`${r} { display:none !important; } `}}return e}function Lr(t){return`{ ${t.styleName}:${t.styleValue} !important; }`}function Re(t,e){var r,i,o,s,l,c;let n={steps:[],inputs:[],variables:[]};for(const d of e)for(const p of d){if(((r=p.targetElement)==null?void 0:r.type)==="input"){const m=t.inputs.find(g=>{var D;return g.id===((D=p.targetElement)==null?void 0:D.id)});m&&n.inputs.push(m)}else if(((i=p.targetElement)==null?void 0:i.type)==="variable"){const m=t.variables.find(g=>{var D;return g.id===((D=p.targetElement)==null?void 0:D.id)});m&&n.variables.push(m)}else if(((o=p.targetElement)==null?void 0:o.type)==="step"){const m=t.blocks.find(g=>{var D;return g.type==="step"&&g.id===((D=p.targetElement)==null?void 0:D.id)});m&&n.steps.push(m)}const f=p.parameter.type!=="freetext"?p.parameter.id:null;if(((s=p.parameter)==null?void 0:s.type)==="input"){const m=t.inputs.find(g=>g.id===f);m&&n.inputs.push(m)}else if(((l=p.parameter)==null?void 0:l.type)==="variable"){const m=t.variables.find(g=>g.id===f);m&&n.variables.push(m)}else if(((c=p.parameter)==null?void 0:c.type)==="step"){const m=t.blocks.find(g=>g.type==="step"&&g.id===f);m&&n.steps.push(m)}}return Ct(n)}function Rr(t,e){let n={steps:[],inputs:[],variables:[]};for(const r of e){const i=Re(t,r);n.steps.push(...i.steps),n.inputs.push(...i.inputs),n.variables.push(...i.variables)}return Ct(n)}function Tr(t,e){let n=Re(t,e.rule);for(const r of e.actions){const i=t.variables.find(s=>{var l;return s.id===((l=r.variable)==null?void 0:l.id)});i&&n.variables.push(i);const o=[...r.formulaParameter];r.parameter&&o.push(r.parameter);for(const s of o)if(s.type==="input"){const l=s.id,c=t.inputs.find(d=>d.id===l);c&&n.inputs.push(c)}else if(s.type==="variable"){const l=s.id,c=t.variables.find(d=>d.id===l);c&&n.variables.push(c)}}return Ct(n)}function Br(t,e){let n={steps:[],inputs:[],variables:[]};for(const r of e){const i=Tr(t,r);n.steps.push(...i.steps),n.inputs.push(...i.inputs),n.variables.push(...i.variables)}return Ct(n)}function Ct(t){return t.inputs=st(t.inputs),t.variables=st(t.variables),t.steps=st(t.steps),t}function Te(t){const e=[];for(const n of t)if(n.type==="checkbox"||n.type==="radio"){const r=mt(document.body,n.id);if(!r)continue;e.push({input:n,value:r.checked})}else n.type==="number"||n.type==="range"?e.push({input:n,value:Number(Mt(n))}):e.push({input:n,value:Mt(n)});return e}function le(t,e){const n=t.inputs.filter(o=>o.stepId===e.id),r={step:{id:e.id,name:e.name,formId:e.formId},inputsWithValues:Te(n)};return xt("step-completed",r)}function Mr(t,e){const n={oldStep:{id:t.id,name:t.name,formId:t.formId},newStep:{id:e.id,name:e.name,formId:e.formId}};return xt("step-changed",n)}function Vr(t){var r;const e={formId:t,formName:(r=E(t).getAttribute("data-name"))!=null?r:""};return xt("form-ready",e)}function qr(t){var r;const e={form:{id:t.form.id,name:(r=E(t.form.id).getAttribute("data-name"))!=null?r:""},inputsWithValues:Te(t.inputs)};return xt("form-submitted",e)}function xt(t,e){return e.eventType=t,new CustomEvent(`inputflow-event[${t}]`,{bubbles:!0,cancelable:!0,detail:e})}function Ur(t,e,n){if(!e.some(s=>s.id===t.id))return 0;const r=new Map,i=new Set;function o(s){if(r.has(s.id))return r.get(s.id);if(i.has(s.id))return 0;i.add(s.id);const l=$r(s,e,n),c=!l.length||s.type==="step"&&_r(s),d=s.type!=="calculation"?1:0;let p;if(c)p=d;else{let f=0;for(const m of l)f=Math.max(f,o(m));p=d+f}return i.delete(s.id),r.set(s.id,p),p}return o(t)}function $r(t,e,n){return n.filter(s=>s.sourceBlockId===t.id).map(s=>s.targetBlockId).map(s=>e.find(l=>l.id===s)).filter(s=>s)}function _r(t){if(t.type!=="step")return!1;const e=document.body.querySelector(`[if-step][if-id='${t.id}']`);return!!(e!=null&&e.querySelector("[type='submit']"))}function Dt(t,e){if(t){Array.isArray(t)||(t=[t]);for(const n of t)n.style.setProperty("width",`${e*100}%`)}}function Nt(t,e,n){const r=J(U(t.formId),".w-form-done");if((r==null?void 0:r.style.getPropertyValue("display"))==="block")return 1;const i=Ur(t,e.blocks,e.paths),o=n.filter(s=>s.block.type==="step");return Ae(o.length/(o.length+i),1e-5)}function Pt(t,e,n){const r=n.active,i=n.completed;if(!e.length||!t)return;const o=x(document.body,"[if-element='progress-step']");if(!o.length)return;const s=J(U(t.formId),".w-form-done");if((s==null?void 0:s.style.getPropertyValue("display"))==="block"){Hr(o,n);return}const c=e.find(g=>g.connectedStepBlockIds.includes(t.id)),d=o.findIndex(g=>g.getAttribute("if-id")===(c==null?void 0:c.id));if(d===-1){o.forEach(g=>X(g,r,i));return}const p=o.slice(0,d),f=o[d],m=o.slice(d+1);p.forEach(g=>{dt(g,i),X(g,r)}),dt(f,r),X(f,i),m.forEach(g=>X(g,r,i))}function Hr(t,e){t.forEach(n=>{dt(n,e.completed),X(n,e.active)})}function zr(t,e){if(!e)return;const n=x(t,"input[type='radio']"),r=x(t,"input[type='checkbox']");[...n,...r].forEach(i=>ce(i,e)),n.forEach(i=>i.addEventListener("change",()=>{const o=i.getAttribute("data-name")||"";$t(t,o).forEach(l=>Me(l,e)),Be(i,e)})),r.forEach(i=>i.addEventListener("change",()=>ce(i,e)))}function ce(t,e){t.checked?Be(t,e):Me(t,e)}function Be(t,e){var n,r,i;if((n=t.parentElement)!=null&&n.classList.contains("w-checkbox")||(r=t.parentElement)!=null&&r.classList.contains("w-radio")){dt(t.parentElement,e);return}(i=t.parentElement)!=null&&i.hasAttribute("if-step")?ft(t,e):On(t,e)}function Me(t,e){var n,r;(n=t.parentElement)!=null&&n.classList.contains("w-checkbox")||(r=t.parentElement)!=null&&r.classList.contains("w-radio")?X(t.parentElement,e):An(t,e)}function Wr(t,e,n){if(!e.isActive)return()=>{};const r=e.style==="combo class"?e.disabledComboClass:"is-disabled-default";e.style==="default"&&_t(`.${r}:is([type='submit'],[if-element='button-next']){opacity:0.5!important;filter:grayscale(0.9)!important;cursor:not-allowed!important;}`);let i=null;return function(o){const s=ir(t,o);i!==s&&(i=s,Fn(n,!s,r))}}function Xr(t){return t?(t=t.toLowerCase(),t==="en"?{yes:"Yes",no:"No"}:t==="de"?{yes:"Ja",no:"Nein"}:t==="fr"?{yes:"Oui",no:"Non"}:t==="es"?{yes:"Sí",no:"No"}:t==="pt"?{yes:"Sim",no:"Não"}:t==="it"?{yes:"Sì",no:"No"}:t==="nl"?{yes:"Ja",no:"Nee"}:t==="pl"?{yes:"Tak",no:"Nie"}:t==="da"?{yes:"Ja",no:"Nej"}:t==="no"?{yes:"Ja",no:"Nei"}:t==="id"?{yes:"Ya",no:"Tidak"}:t==="ro"?{yes:"Da",no:"Nu"}:t==="sv"?{yes:"Ja",no:"Nej"}:t==="fi"?{yes:"Kyllä",no:"Ei"}:t==="et"?{yes:"Jah",no:"Ei"}:null):null}const Kr=pn(),y=Kr[0];k(j,null,function*(){var Q;if(!y)return;const t=yield mn(y);L("config",t);const e=Pn(E(y));let n=t.blocks.find(u=>u.id===e),r=[];r.push({block:n,variableState:sr(t.variables)});const i=x(E(y),"[if-step]"),o=Jt(E(y),n);i.forEach(u=>In(u,o));const s=gt(E(y),t.inputs);x(E(y),"[if-element='error']").forEach(u=>jn(u)),E(y).setAttribute("novalidate","true"),wr(E(y),t.validations,t.inputs),s.filter(u=>u.getAttribute("type")==="number").forEach(u=>{u.hasAttribute("step")||u.setAttribute("step","any")});const d=x(U(y),"[if-element='button-next']").filter(u=>u.getAttribute("type")!=="submit");d.forEach(u=>u.addEventListener("click",f)),x(E(y),"[if-element='button-next'][type='submit']").forEach(u=>u.addEventListener("click",()=>k(j,null,function*(){(yield ue(U(y)))&&f()})));function f(){if(!se(t,n))return;Y(),oe(r,t.variables,n);const h=le(t,n);E(y).dispatchEvent(h);let b=ie(t,n);for(;b&&b.type!=="step";)At(t,b),oe(r,t.variables,b),b=ie(t,b);b&&(L("variables",t.variables.map(A=>`${A.name}: '${A.value}'`)),it(b),H(),setTimeout(()=>{Y(),_(b)},200))}x(U(y),"[if-element='button-back']").forEach(u=>u.addEventListener("click",()=>{if(r.length<=1)return;const h=Yn(r),b=h.block;for(;r[r.length-1].block.id!==b.id;)r.pop();r.pop(),it(b),H(),It(t.variables,h.variableState),setTimeout(()=>{_(b)},200)})),x(U(y),"[if-element='button-reset']").forEach(u=>u.addEventListener("click",()=>{E(y).reset(),r=r.slice(0,1),it(r[0].block),It(t.variables,r[0].variableState),setTimeout(()=>{_(r[0].block),H(),s.forEach(h=>et(h))},200)}));const D=Br(t,t.calculations).inputs,G=st(D.map(u=>u.type==="radio"?u.groupName:u.type==="radio group"?u.name:null).filter(u=>u)).flatMap(u=>$t(E(y),u));st([...G,...gt(E(y),D)]).forEach(u=>bt(u,["input","change"],Y));function Y(){It(t.variables,r[r.length-1].variableState);const u=t.calculations.filter(h=>h.blockId===n.id);De(t,u)}Oe(U(y));const P=ae(t.generalSettings.numberDisplayFormat);bt(E(y),["input","change"],u=>{et(u.target)});function et(u){var b,A,w;const{name:h}=u.dataset;if(h)if(u.type==="number"||u.type==="range")u.value?$(h,Vt(Number(u.value),P)):$(h,"");else if(u.type==="checkbox"){const v=(b=document.documentElement.getAttribute("lang"))==null?void 0:b.toLowerCase().split("-")[0],C=Xr(v!=null?v:"");if(C){const{yes:O,no:R}=C;$(h,u.checked?O:R)}else $(h,u.checked?"✓":"–")}else if(u.type==="radio"&&!u.checked){const v=u.name,C=Ut((A=u.closest("form[if-id]"))!=null?A:document.body,v);$(h,(w=C==null?void 0:C.value)!=null?w:"")}else $(h,u.value)}t.variables=t.variables.map(u=>ar(u,{numberDisplayFormat:ae(t.generalSettings.numberDisplayFormat)})),t.variables.forEach(u=>{const h=u.type==="number"?Vt(Number(u.value),P):u.value;$(u.name,h)}),t.generalSettings.nextStepWithoutButtonClick&&t.inputs.filter(h=>h.type==="radio group").forEach(h=>{var R;const b=t.inputs.filter(F=>F.stepId===h.stepId),A=!!b.find(F=>F.type!=="radio"&&F.type!=="radio group"&&F.type!=="hidden"),w=b.filter(F=>F.type==="radio group").length>1,v=!!((R=Se(E(y),b[0].stepId))!=null&&R.querySelector("[type='submit']"));if(A||w||v){L("not auto next step:",{stepHasNoneRadioInputs:A,stepHasMultipleRadioGroups:w,stepHasSubmitButton:v});return}const C=gt(E(y),b.filter(F=>F.type==="radio"));let O=!1;C.forEach(F=>{F.addEventListener("keydown",Z=>{["ArrowRight","ArrowLeft","ArrowUp","ArrowDown"," "].includes(Z.key)&&(O=!0)})}),C.forEach(F=>{let Z=0;F.addEventListener("click",()=>k(j,null,function*(){if(Z=Date.now(),O){O=!1;return}yield Tt(150),L("auto next step",null),f()})),F.addEventListener("change",()=>k(j,null,function*(){if(!(Date.now()-Z<75)){if(O){O=!1;return}yield Tt(150),L("auto next step",null),f()}}))})});const nt=t.generalSettings.radioAndCheckboxActiveClass;nt&&zr(E(y),nt),(Q=E(y))==null||Q.addEventListener("submit",u=>k(j,null,function*(){if(!se(t,n)){kt(u);return}const b=Jt(E(y),n),A=!!(b!=null&&b.querySelector("[type='submit']")),w=!t.paths.some(C=>C.sourceBlockId===n.id);if(!A&&!w){f(),kt(u);return}t.variables.forEach(C=>ur(E(y),C));const v=!!(b!=null&&b.querySelector("[type='submit'][if-element='button-next']"));v&&xr(y),Cn(s,"required"),k(j,null,function*(){const C=yield ue(U(y));if(C&&!v&&(Dt(rt,Nt(n,t,r)),Pt(n,t.progressSteps,t.generalSettings.progressStepClasses)),C){const O=qr(t);E(y).dispatchEvent(O)}if(C&&w){const O=le(t,n);E(y).dispatchEvent(O)}}),E(y).hasAttribute("action")&&t.generalSettings.customActionUrlWithoutRedirect&&(kt(u),yield br(E(y)))})),x(document.body,"[if-element='progress-step']").forEach(u=>X(u,"is-active","is-completed")),Pt(n,t.progressSteps,t.generalSettings.progressStepClasses);const rt=x(document.body,"[if-element='progress-bar']");Dt(rt,Nt(n,t,r));const _=Wr(t,t.generalSettings.disableNextButtonOptions,[...d,...x(U(y),"[type='submit']")]);_(n),t.generalSettings.disableNextButtonOptions.isActive&&s.forEach(u=>{bt(u,"input",()=>_(n))}),Dr(t.conditionalStyles),H();const q=Rr(t,t.conditionalStyles.map(u=>u.rule)),ut=q.inputs.filter(u=>u.type==="radio group"),N=t.inputs.filter(u=>u.type==="radio"&&ut.some(h=>u.groupName===h.name));Tn(E(y),[...q.inputs,...N]).forEach(u=>{bt(u,["input","change"],()=>H())}),t.variables=t.variables.map(u=>q.variables.some(h=>u.id===h.id)?new Proxy(u,{set(h,b,A){if(b==="value"&&h.value!==A){const w=Reflect.set(h,b,A);return H(),w}return Reflect.set(h,b,A)}}):u);function H(){const u=Fr(),h=kr(),{activeCs:b,inactiveCs:A}=Ar({conditionalStyles:t.conditionalStyles,config:t,history:r,currentStepId:n.id});Or(b),Ir(A);for(const w of b)if(!u.includes(w.id))for(const v of w.styles){if(v.type!=="class"||!v.elementSelection.customAttribute)continue;const C=`[${v.elementSelection.customAttribute.name}="${v.elementSelection.customAttribute.value}"]`;x(document.body,C).forEach(R=>ft(R,v.className))}for(const w of A)if(!h.includes(w.id))for(const v of w.styles){if(v.type!=="class"||!v.elementSelection.customAttribute)continue;const C=`[${v.elementSelection.customAttribute.name}="${v.elementSelection.customAttribute.value}"]`;x(document.body,C).forEach(R=>vt(R,v.className))}}function At(u,h){h.type==="calculation"&&mr(u,h),h.type==="redirect"&&dr(u,h)}function it(u){kn(n,u),Fe(x(E(y),"[if-element='error']"));const h=Mr(n,u);E(y).dispatchEvent(h),n=u,Pt(n,t.progressSteps,t.generalSettings.progressStepClasses),Dt(rt,Nt(n,t,r))}const z=Vr(y);E(y).dispatchEvent(z),E(y).setAttribute("data-if-ready","true")})});export default Gr();