UNPKG

@sprig-technologies/sprig-browser

Version:

npm package for the sprig web sdk

1 lines 89.4 kB
"use strict";const U=require("./core-BwIy2OVb.cjs"),E=require("./metricsReporter-sMSDDeJU.cjs");var ge,x,ir,te,mt,ar,Qe,ur,ye={},lr=[],yn=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ne=Array.isArray;function G(e,t){for(var r in t)e[r]=t[r];return e}function cr(e){var t=e.parentNode;t&&t.removeChild(e)}function H(e,t,r){var o,n,s,i={};for(s in t)s=="key"?o=t[s]:s=="ref"?n=t[s]:i[s]=t[s];if(arguments.length>2&&(i.children=arguments.length>3?ge.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(s in e.defaultProps)i[s]===void 0&&(i[s]=e.defaultProps[s]);return me(e,i,o,n,null)}function me(e,t,r,o,n){var s={type:e,props:t,key:r,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:n??++ir,__i:-1,__u:0};return n==null&&x.vnode!=null&&x.vnode(s),s}function dr(){return{current:null}}function F(e){return e.children}function $(e,t){this.props=e,this.context=t}function le(e,t){if(t==null)return e.__?le(e.__,e.__i+1):null;for(var r;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?le(e):null}function pr(e){var t,r;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null){e.__e=e.__c.base=r.__e;break}return pr(e)}}function Ge(e){(!e.__d&&(e.__d=!0)&&te.push(e)&&!Ie.__r++||mt!==x.debounceRendering)&&((mt=x.debounceRendering)||ar)(Ie)}function Ie(){var e,t,r,o,n,s,i,u,a;for(te.sort(Qe);e=te.shift();)e.__d&&(t=te.length,o=void 0,s=(n=(r=e).__v).__e,u=[],a=[],(i=r.__P)&&((o=G({},n)).__v=n.__v+1,x.vnode&&x.vnode(o),tt(i,o,n,r.__n,i.ownerSVGElement!==void 0,32&n.__u?[s]:null,u,s??le(n),!!(32&n.__u),a),o.__.__k[o.__i]=o,mr(u,o,a),o.__e!=s&&pr(o)),te.length>t&&te.sort(Qe));Ie.__r=0}function _r(e,t,r,o,n,s,i,u,a,l,d){var c,f,p,C,m,v=o&&o.__k||lr,b=t.length;for(r.__d=a,function(_,k,w){var S,h,y,I,g,N=k.length,L=w.length,T=L,O=0;for(_.__k=[],S=0;S<N;S++)(h=_.__k[S]=(h=k[S])==null||typeof h=="boolean"||typeof h=="function"?null:typeof h=="string"||typeof h=="number"||typeof h=="bigint"||h.constructor==String?me(null,h,null,null,h):Ne(h)?me(F,{children:h},null,null,null):h.constructor===void 0&&h.__b>0?me(h.type,h.props,h.key,h.ref?h.ref:null,h.__v):h)!=null?(h.__=_,h.__b=_.__b+1,g=vn(h,w,I=S+O,T),h.__i=g,y=null,g!==-1&&(T--,(y=w[g])&&(y.__u|=131072)),y==null||y.__v===null?(g==-1&&O--,typeof h.type!="function"&&(h.__u|=65536)):g!==I&&(g===I+1?O++:g>I?T>N-I?O+=g-I:O--:O=g<I&&g==I-1?g-I:0,g!==S+O&&(h.__u|=65536))):(y=w[S])&&y.key==null&&y.__e&&(y.__e==_.__d&&(_.__d=le(y)),Ze(y,y,!1),w[S]=null,T--);if(T)for(S=0;S<L;S++)(y=w[S])!=null&&!(131072&y.__u)&&(y.__e==_.__d&&(_.__d=le(y)),Ze(y,y))}(r,t,v),a=r.__d,c=0;c<b;c++)(p=r.__k[c])!=null&&typeof p!="boolean"&&typeof p!="function"&&(f=p.__i===-1?ye:v[p.__i]||ye,p.__i=c,tt(e,p,f,n,s,i,u,a,l,d),C=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&rt(f.ref,null,p),d.push(p.ref,p.__c||C,p)),m==null&&C!=null&&(m=C),65536&p.__u||f.__k===p.__k?a=fr(p,a,e):typeof p.type=="function"&&p.__d!==void 0?a=p.__d:C&&(a=C.nextSibling),p.__d=void 0,p.__u&=-196609);r.__d=a,r.__e=m}function fr(e,t,r){var o,n;if(typeof e.type=="function"){for(o=e.__k,n=0;o&&n<o.length;n++)o[n]&&(o[n].__=e,t=fr(o[n],t,r));return t}return e.__e!=t&&(r.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function Z(e,t){return t=t||[],e==null||typeof e=="boolean"||(Ne(e)?e.some(function(r){Z(r,t)}):t.push(e)),t}function vn(e,t,r,o){var n=e.key,s=e.type,i=r-1,u=r+1,a=t[r];if(a===null||a&&n==a.key&&s===a.type)return r;if(o>(a==null||131072&a.__u?0:1))for(;i>=0||u<t.length;){if(i>=0){if((a=t[i])&&!(131072&a.__u)&&n==a.key&&s===a.type)return i;i--}if(u<t.length){if((a=t[u])&&!(131072&a.__u)&&n==a.key&&s===a.type)return u;u++}}return-1}function yt(e,t,r){t[0]==="-"?e.setProperty(t,r??""):e[t]=r==null?"":typeof r!="number"||yn.test(t)?r:r+"px"}function ke(e,t,r,o,n){var s;e:if(t==="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof o=="string"&&(e.style.cssText=o=""),o)for(t in o)r&&t in r||yt(e.style,t,"");if(r)for(t in r)o&&r[t]===o[t]||yt(e.style,t,r[t])}else if(t[0]==="o"&&t[1]==="n")s=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+s]=r,r?o?r.u=o.u:(r.u=Date.now(),e.addEventListener(t,s?ht:vt,s)):e.removeEventListener(t,s?ht:vt,s);else{if(n)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!=="width"&&t!=="height"&&t!=="href"&&t!=="list"&&t!=="form"&&t!=="tabIndex"&&t!=="download"&&t!=="rowSpan"&&t!=="colSpan"&&t!=="role"&&t in e)try{e[t]=r??"";break e}catch{}typeof r=="function"||(r==null||r===!1&&t[4]!=="-"?e.removeAttribute(t):e.setAttribute(t,r))}}function vt(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(x.event?x.event(e):e)}function ht(e){return this.l[e.type+!0](x.event?x.event(e):e)}function tt(e,t,r,o,n,s,i,u,a,l){var d,c,f,p,C,m,v,b,_,k,w,S,h,y,I,g=t.type;if(t.constructor!==void 0)return null;128&r.__u&&(a=!!(32&r.__u),s=[u=t.__e=r.__e]),(d=x.__b)&&d(t);e:if(typeof g=="function")try{if(b=t.props,_=(d=g.contextType)&&o[d.__c],k=d?_?_.props.value:d.__:o,r.__c?v=(c=t.__c=r.__c).__=c.__E:("prototype"in g&&g.prototype.render?t.__c=c=new g(b,k):(t.__c=c=new $(b,k),c.constructor=g,c.render=gn),_&&_.sub(c),c.props=b,c.state||(c.state={}),c.context=k,c.__n=o,f=c.__d=!0,c.__h=[],c._sb=[]),c.__s==null&&(c.__s=c.state),g.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=G({},c.__s)),G(c.__s,g.getDerivedStateFromProps(b,c.__s))),p=c.props,C=c.state,c.__v=t,f)g.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(g.getDerivedStateFromProps==null&&b!==p&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps(b,k),!c.__e&&(c.shouldComponentUpdate!=null&&c.shouldComponentUpdate(b,c.__s,k)===!1||t.__v===r.__v)){for(t.__v!==r.__v&&(c.props=b,c.state=c.__s,c.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.forEach(function(N){N&&(N.__=t)}),w=0;w<c._sb.length;w++)c.__h.push(c._sb[w]);c._sb=[],c.__h.length&&i.push(c);break e}c.componentWillUpdate!=null&&c.componentWillUpdate(b,c.__s,k),c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(p,C,m)})}if(c.context=k,c.props=b,c.__P=e,c.__e=!1,S=x.__r,h=0,"prototype"in g&&g.prototype.render){for(c.state=c.__s,c.__d=!1,S&&S(t),d=c.render(c.props,c.state,c.context),y=0;y<c._sb.length;y++)c.__h.push(c._sb[y]);c._sb=[]}else do c.__d=!1,S&&S(t),d=c.render(c.props,c.state,c.context),c.state=c.__s;while(c.__d&&++h<25);c.state=c.__s,c.getChildContext!=null&&(o=G(G({},o),c.getChildContext())),f||c.getSnapshotBeforeUpdate==null||(m=c.getSnapshotBeforeUpdate(p,C)),_r(e,Ne(I=d!=null&&d.type===F&&d.key==null?d.props.children:d)?I:[I],t,r,o,n,s,i,u,a,l),c.base=t.__e,t.__u&=-161,c.__h.length&&i.push(c),v&&(c.__E=c.__=null)}catch(N){t.__v=null,a||s!=null?(t.__e=u,t.__u|=a?160:32,s[s.indexOf(u)]=null):(t.__e=r.__e,t.__k=r.__k),x.__e(N,t,r)}else s==null&&t.__v===r.__v?(t.__k=r.__k,t.__e=r.__e):t.__e=hn(r.__e,t,r,o,n,s,i,a,l);(d=x.diffed)&&d(t)}function mr(e,t,r){t.__d=void 0;for(var o=0;o<r.length;o++)rt(r[o],r[++o],r[++o]);x.__c&&x.__c(t,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(s){s.call(n)})}catch(s){x.__e(s,n.__v)}})}function hn(e,t,r,o,n,s,i,u,a){var l,d,c,f,p,C,m,v=r.props,b=t.props,_=t.type;if(_==="svg"&&(n=!0),s!=null){for(l=0;l<s.length;l++)if((p=s[l])&&"setAttribute"in p==!!_&&(_?p.localName===_:p.nodeType===3)){e=p,s[l]=null;break}}if(e==null){if(_===null)return document.createTextNode(b);e=n?document.createElementNS("http://www.w3.org/2000/svg",_):document.createElement(_,b.is&&b),s=null,u=!1}if(_===null)v===b||u&&e.data===b||(e.data=b);else{if(s=s&&ge.call(e.childNodes),v=r.props||ye,!u&&s!=null)for(v={},l=0;l<e.attributes.length;l++)v[(p=e.attributes[l]).name]=p.value;for(l in v)p=v[l],l=="children"||(l=="dangerouslySetInnerHTML"?c=p:l==="key"||l in b||ke(e,l,null,p,n));for(l in b)p=b[l],l=="children"?f=p:l=="dangerouslySetInnerHTML"?d=p:l=="value"?C=p:l=="checked"?m=p:l==="key"||u&&typeof p!="function"||v[l]===p||ke(e,l,p,v[l],n);if(d)u||c&&(d.__html===c.__html||d.__html===e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(c&&(e.innerHTML=""),_r(e,Ne(f)?f:[f],t,r,o,n&&_!=="foreignObject",s,i,s?s[0]:r.__k&&le(r,0),u,a),s!=null)for(l=s.length;l--;)s[l]!=null&&cr(s[l]);u||(l="value",C!==void 0&&(C!==e[l]||_==="progress"&&!C||_==="option"&&C!==v[l])&&ke(e,l,C,v[l],!1),l="checked",m!==void 0&&m!==e[l]&&ke(e,l,m,v[l],!1))}return e}function rt(e,t,r){try{typeof e=="function"?e(t):e.current=t}catch(o){x.__e(o,r)}}function Ze(e,t,r){var o,n;if(x.unmount&&x.unmount(e),(o=e.ref)&&(o.current&&o.current!==e.__e||rt(o,null,t)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(s){x.__e(s,t)}o.base=o.__P=null,e.__c=void 0}if(o=e.__k)for(n=0;n<o.length;n++)o[n]&&Ze(o[n],t,r||typeof e.type!="function");r||e.__e==null||cr(e.__e),e.__=e.__e=e.__d=void 0}function gn(e,t,r){return this.constructor(e,r)}function ce(e,t,r){var o,n,s,i;x.__&&x.__(e,t),n=(o=typeof r=="function")?null:r&&r.__k||t.__k,s=[],i=[],tt(t,e=(!o&&r||t).__k=H(F,null,[e]),n||ye,ye,t.ownerSVGElement!==void 0,!o&&r?[r]:n?null:t.firstChild?ge.call(t.childNodes):null,s,!o&&r?r:n?n.__e:t.firstChild,o,i),mr(s,e,i)}function yr(e,t){ce(e,t,yr)}function bn(e,t,r){var o,n,s,i,u=G({},e.props);for(s in e.type&&e.type.defaultProps&&(i=e.type.defaultProps),t)s=="key"?o=t[s]:s=="ref"?n=t[s]:u[s]=t[s]===void 0&&i!==void 0?i[s]:t[s];return arguments.length>2&&(u.children=arguments.length>3?ge.call(arguments,2):r),me(e.type,u,o||e.key,n||e.ref,null)}function nt(e,t){var r={__c:t="__cC"+ur++,__:e,Consumer:function(o,n){return o.children(n)},Provider:function(o){var n,s;return this.getChildContext||(n=[],(s={})[t]=this,this.getChildContext=function(){return s},this.shouldComponentUpdate=function(i){this.props.value!==i.value&&n.some(function(u){u.__e=!0,Ge(u)})},this.sub=function(i){n.push(i);var u=i.componentWillUnmount;i.componentWillUnmount=function(){n.splice(n.indexOf(i),1),u&&u.call(i)}}),o.children}};return r.Provider.__=r.Consumer.contextType=r}ge=lr.slice,x={__e:function(e,t,r,o){for(var n,s,i;t=t.__;)if((n=t.__c)&&!n.__)try{if((s=n.constructor)&&s.getDerivedStateFromError!=null&&(n.setState(s.getDerivedStateFromError(e)),i=n.__d),n.componentDidCatch!=null&&(n.componentDidCatch(e,o||{}),i=n.__d),i)return n.__E=n}catch(u){e=u}throw e}},ir=0,$.prototype.setState=function(e,t){var r;r=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=G({},this.state),typeof e=="function"&&(e=e(G({},r),this.props)),e&&G(r,e),e!=null&&this.__v&&(t&&this._sb.push(t),Ge(this))},$.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ge(this))},$.prototype.render=F,te=[],ar=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Qe=function(e,t){return e.__v.__b-t.__v.__b},Ie.__r=0,ur=0;var Cn=0;function R(e,t,r,o,n,s){var i,u,a={};for(u in t)u=="ref"?i=t[u]:a[u]=t[u];var l={type:e,props:a,key:r,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--Cn,__i:-1,__u:0,__source:n,__self:s};if(typeof e=="function"&&(i=e.defaultProps))for(u in i)a[u]===void 0&&(a[u]=i[u]);return x.vnode&&x.vnode(l),l}var K,P,qe,gt,de=0,vr=[],we=[],bt=x.__b,Ct=x.__r,kt=x.diffed,wt=x.__c,St=x.unmount;function re(e,t){x.__h&&x.__h(P,e,de||t),de=0;var r=P.__H||(P.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({__V:we}),r.__[e]}function Y(e){return de=1,ot(br,e)}function ot(e,t,r){var o=re(K++,2);if(o.t=e,!o.__c&&(o.__=[r?r(t):br(void 0,t),function(u){var a=o.__N?o.__N[0]:o.__[0],l=o.t(a,u);a!==l&&(o.__N=[l,o.__[1]],o.__c.setState({}))}],o.__c=P,!P.u)){var n=function(u,a,l){if(!o.__c.__H)return!0;var d=o.__c.__H.__.filter(function(f){return f.__c});if(d.every(function(f){return!f.__N}))return!s||s.call(this,u,a,l);var c=!1;return d.forEach(function(f){if(f.__N){var p=f.__[0];f.__=f.__N,f.__N=void 0,p!==f.__[0]&&(c=!0)}}),!(!c&&o.__c.props===u)&&(!s||s.call(this,u,a,l))};P.u=!0;var s=P.shouldComponentUpdate,i=P.componentWillUpdate;P.componentWillUpdate=function(u,a,l){if(this.__e){var d=s;s=void 0,n(u,a,l),s=d}i&&i.call(this,u,a,l)},P.shouldComponentUpdate=n}return o.__N||o.__}function D(e,t){var r=re(K++,3);!x.__s&&at(r.__H,t)&&(r.__=e,r.i=t,P.__H.__h.push(r))}function _e(e,t){var r=re(K++,4);!x.__s&&at(r.__H,t)&&(r.__=e,r.i=t,P.__h.push(r))}function X(e){return de=5,ee(function(){return{current:e}},[])}function hr(e,t,r){de=6,_e(function(){return typeof e=="function"?(e(t()),function(){return e(null)}):e?(e.current=t(),function(){return e.current=null}):void 0},r==null?r:r.concat(e))}function ee(e,t){var r=re(K++,7);return at(r.__H,t)?(r.__V=e(),r.i=t,r.__h=e,r.__V):r.__}function ve(e,t){return de=8,ee(function(){return e},t)}function st(e){var t=P.context[e.__c],r=re(K++,9);return r.c=e,t?(r.__==null&&(r.__=!0,t.sub(P)),t.props.value):e.__}function it(e,t){x.useDebugValue&&x.useDebugValue(t?t(e):e)}function gr(){var e=re(K++,11);if(!e.__){for(var t=P.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var r=t.__m||(t.__m=[0,0]);e.__="P"+r[0]+"-"+r[1]++}return e.__}function kn(){for(var e;e=vr.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Se),e.__H.__h.forEach(Ke),e.__H.__h=[]}catch(t){e.__H.__h=[],x.__e(t,e.__v)}}x.__b=function(e){P=null,bt&&bt(e)},x.__r=function(e){Ct&&Ct(e),K=0;var t=(P=e.__c).__H;t&&(qe===P?(t.__h=[],P.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.__V=we,r.__N=r.i=void 0})):(t.__h.forEach(Se),t.__h.forEach(Ke),t.__h=[],K=0)),qe=P},x.diffed=function(e){kt&&kt(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(vr.push(t)!==1&&gt===x.requestAnimationFrame||((gt=x.requestAnimationFrame)||wn)(kn)),t.__H.__.forEach(function(r){r.i&&(r.__H=r.i),r.__V!==we&&(r.__=r.__V),r.i=void 0,r.__V=we})),qe=P=null},x.__c=function(e,t){t.some(function(r){try{r.__h.forEach(Se),r.__h=r.__h.filter(function(o){return!o.__||Ke(o)})}catch(o){t.some(function(n){n.__h&&(n.__h=[])}),t=[],x.__e(o,r.__v)}}),wt&&wt(e,t)},x.unmount=function(e){St&&St(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(o){try{Se(o)}catch(n){t=n}}),r.__H=void 0,t&&x.__e(t,r.__v))};var xt=typeof requestAnimationFrame=="function";function wn(e){var t,r=function(){clearTimeout(o),xt&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(r,100);xt&&(t=requestAnimationFrame(r))}function Se(e){var t=P,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),P=t}function Ke(e){var t=P;e.__c=e.__(),P=t}function at(e,t){return!e||e.length!==t.length||t.some(function(r,o){return r!==e[o]})}function br(e,t){return typeof t=="function"?t(e):t}function Cr(e,t){for(var r in t)e[r]=t[r];return e}function ze(e,t){for(var r in e)if(r!=="__source"&&!(r in t))return!0;for(var o in t)if(o!=="__source"&&e[o]!==t[o])return!0;return!1}function Ae(e){this.props=e}function kr(e,t){function r(n){var s=this.props.ref,i=s==n.ref;return!i&&s&&(s.call?s(null):s.current=null),t?!t(this.props,n)||!i:ze(this.props,n)}function o(n){return this.shouldComponentUpdate=r,H(e,n)}return o.displayName="Memo("+(e.displayName||e.name)+")",o.prototype.isReactComponent=!0,o.__f=!0,o}(Ae.prototype=new $).isPureReactComponent=!0,Ae.prototype.shouldComponentUpdate=function(e,t){return ze(this.props,e)||ze(this.state,t)};var Rt=x.__b;x.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Rt&&Rt(e)};var Sn=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function ut(e){function t(r){var o=Cr({},r);return delete o.ref,e(o,r.ref||null)}return t.$$typeof=Sn,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var It=function(e,t){return e==null?null:Z(Z(e).map(t))},wr={map:It,forEach:It,count:function(e){return e?Z(e).length:0},only:function(e){var t=Z(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:Z},xn=x.__e;x.__e=function(e,t,r,o){if(e.then){for(var n,s=t;s=s.__;)if((n=s.__c)&&n.__c)return t.__e==null&&(t.__e=r.__e,t.__k=r.__k),n.__c(e,t)}xn(e,t,r,o)};var At=x.unmount;function Sr(e,t,r){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(o){typeof o.__c=="function"&&o.__c()}),e.__c.__H=null),(e=Cr({},e)).__c!=null&&(e.__c.__P===r&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(o){return Sr(o,t,r)})),e}function xr(e,t,r){return e&&r&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(o){return xr(o,t,r)}),e.__c&&e.__c.__P===t&&(e.__e&&r.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=r)),e}function ue(){this.__u=0,this.t=null,this.__b=null}function Rr(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function Te(e){var t,r,o;function n(s){if(t||(t=e()).then(function(i){r=i.default||i},function(i){o=i}),o)throw o;if(!r)throw t;return H(r,s)}return n.displayName="Lazy",n.__f=!0,n}function ie(){this.u=null,this.o=null}x.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),At&&At(e)},(ue.prototype=new $).__c=function(e,t){var r=t.__c,o=this;o.t==null&&(o.t=[]),o.t.push(r);var n=Rr(o.__v),s=!1,i=function(){s||(s=!0,r.__R=null,n?n(u):u())};r.__R=i;var u=function(){if(!--o.__u){if(o.state.__a){var a=o.state.__a;o.__v.__k[0]=xr(a,a.__c.__P,a.__c.__O)}var l;for(o.setState({__a:o.__b=null});l=o.t.pop();)l.forceUpdate()}};o.__u++||32&t.__u||o.setState({__a:o.__b=o.__v.__k[0]}),e.then(i,i)},ue.prototype.componentWillUnmount=function(){this.t=[]},ue.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var r=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=Sr(this.__b,r,o.__O=o.__P)}this.__b=null}var n=t.__a&&H(F,null,e.fallback);return n&&(n.__u&=-33),[H(F,null,t.__a?null:e.children),n]};var Et=function(e,t,r){if(++r[1]===r[0]&&e.o.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.o.size))for(r=e.u;r;){for(;r.length>3;)r.pop()();if(r[1]<r[0])break;e.u=r=r[2]}};function Rn(e){return this.getChildContext=function(){return e.context},e.children}function In(e){var t=this,r=e.i;t.componentWillUnmount=function(){ce(null,t.l),t.l=null,t.i=null},t.i&&t.i!==r&&t.componentWillUnmount(),t.l||(t.i=r,t.l={nodeType:1,parentNode:r,childNodes:[],appendChild:function(o){this.childNodes.push(o),t.i.appendChild(o)},insertBefore:function(o,n){this.childNodes.push(o),t.i.appendChild(o)},removeChild:function(o){this.childNodes.splice(this.childNodes.indexOf(o)>>>1,1),t.i.removeChild(o)}}),ce(H(Rn,{context:t.context},e.__v),t.l)}function Ir(e,t){var r=H(In,{__v:e,i:t});return r.containerInfo=t,r}(ie.prototype=new $).__a=function(e){var t=this,r=Rr(t.__v),o=t.o.get(e);return o[0]++,function(n){var s=function(){t.props.revealOrder?(o.push(n),Et(t,e,o)):n()};r?r(s):s()}},ie.prototype.render=function(e){this.u=null,this.o=new Map;var t=Z(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var r=t.length;r--;)this.o.set(t[r],this.u=[1,0,this.u]);return e.children},ie.prototype.componentDidUpdate=ie.prototype.componentDidMount=function(){var e=this;this.o.forEach(function(t,r){Et(e,r,t)})};var Ar=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,An=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,En=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Ln=/[A-Z0-9]/g,Nn=typeof document<"u",Tn=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};function Er(e,t,r){return t.__k==null&&(t.textContent=""),ce(e,t),typeof r=="function"&&r(),e?e.__c:null}function Lr(e,t,r){return yr(e,t),typeof r=="function"&&r(),e?e.__c:null}$.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty($.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Lt=x.event;function Pn(){}function On(){return this.cancelBubble}function qn(){return this.defaultPrevented}x.event=function(e){return Lt&&(e=Lt(e)),e.persist=Pn,e.isPropagationStopped=On,e.isDefaultPrevented=qn,e.nativeEvent=e};var lt,Un={enumerable:!1,configurable:!0,get:function(){return this.class}},Nt=x.vnode;x.vnode=function(e){typeof e.type=="string"&&function(t){var r=t.props,o=t.type,n={};for(var s in r){var i=r[s];if(!(s==="value"&&"defaultValue"in r&&i==null||Nn&&s==="children"&&o==="noscript"||s==="class"||s==="className")){var u=s.toLowerCase();s==="defaultValue"&&"value"in r&&r.value==null?s="value":s==="download"&&i===!0?i="":u==="ondoubleclick"?s="ondblclick":u!=="onchange"||o!=="input"&&o!=="textarea"||Tn(r.type)?u==="onfocus"?s="onfocusin":u==="onblur"?s="onfocusout":En.test(s)?s=u:o.indexOf("-")===-1&&An.test(s)?s=s.replace(Ln,"-$&").toLowerCase():i===null&&(i=void 0):u=s="oninput",u==="oninput"&&n[s=u]&&(s="oninputCapture"),n[s]=i}}o=="select"&&n.multiple&&Array.isArray(n.value)&&(n.value=Z(r.children).forEach(function(a){a.props.selected=n.value.indexOf(a.props.value)!=-1})),o=="select"&&n.defaultValue!=null&&(n.value=Z(r.children).forEach(function(a){a.props.selected=n.multiple?n.defaultValue.indexOf(a.props.value)!=-1:n.defaultValue==a.props.value})),r.class&&!r.className?(n.class=r.class,Object.defineProperty(n,"className",Un)):(r.className&&!r.class||r.class&&r.className)&&(n.class=n.className=r.className),t.props=n}(e),e.$$typeof=Ar,Nt&&Nt(e)};var Tt=x.__r;x.__r=function(e){Tt&&Tt(e),lt=e.__c};var Pt=x.diffed;x.diffed=function(e){Pt&&Pt(e);var t=e.props,r=e.__e;r!=null&&e.type==="textarea"&&"value"in t&&t.value!==r.value&&(r.value=t.value==null?"":t.value),lt=null};var Nr={ReactCurrentDispatcher:{current:{readContext:function(e){return lt.__n[e.__c].props.value}}}};function Tr(e){return H.bind(null,e)}function be(e){return!!e&&e.$$typeof===Ar}function Pr(e){return be(e)&&e.type===F}function Or(e){return be(e)?bn.apply(null,arguments):e}function Ee(e){return!!e.__k&&(ce(null,e),!0)}function qr(e){return e&&(e.base||e.nodeType===1&&e)||null}var Ur=function(e,t){return e(t)},Vr=function(e,t){return e(t)},Mr=F;function ct(e){e()}function Hr(e){return e}function jr(){return[!1,ct]}var Dr=_e,Fr=be;function Br(e,t){var r=t(),o=Y({h:{__:r,v:t}}),n=o[0].h,s=o[1];return _e(function(){n.__=r,n.v=t,Ue(n)&&s({h:n})},[e,r,t]),D(function(){return Ue(n)&&s({h:n}),e(function(){Ue(n)&&s({h:n})})},[e]),r}function Ue(e){var t,r,o=e.v,n=e.__;try{var s=o();return!((t=n)===(r=s)&&(t!==0||1/t==1/r)||t!=t&&r!=r)}catch{return!0}}var $r={useState:Y,useId:gr,useReducer:ot,useEffect:D,useLayoutEffect:_e,useInsertionEffect:Dr,useTransition:jr,useDeferredValue:Hr,useSyncExternalStore:Br,startTransition:ct,useRef:X,useImperativeHandle:hr,useMemo:ee,useCallback:ve,useContext:st,useDebugValue:it,version:"17.0.2",Children:wr,render:Er,hydrate:Lr,unmountComponentAtNode:Ee,createPortal:Ir,createElement:H,createContext:nt,createFactory:Tr,cloneElement:Or,createRef:dr,Fragment:F,isValidElement:be,isElement:Fr,isFragment:Pr,findDOMNode:qr,Component:$,PureComponent:Ae,memo:kr,forwardRef:ut,flushSync:Vr,unstable_batchedUpdates:Ur,StrictMode:Mr,Suspense:ue,SuspenseList:ie,lazy:Te,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Nr};const Vn=Object.freeze(Object.defineProperty({__proto__:null,Children:wr,Component:$,Fragment:F,PureComponent:Ae,StrictMode:Mr,Suspense:ue,SuspenseList:ie,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Nr,cloneElement:Or,createContext:nt,createElement:H,createFactory:Tr,createPortal:Ir,createRef:dr,default:$r,findDOMNode:qr,flushSync:Vr,forwardRef:ut,hydrate:Lr,isElement:Fr,isFragment:Pr,isValidElement:be,lazy:Te,memo:kr,render:Er,startTransition:ct,unmountComponentAtNode:Ee,unstable_batchedUpdates:Ur,useCallback:ve,useContext:st,useDebugValue:it,useDeferredValue:Hr,useEffect:D,useErrorBoundary:function(e){var t=re(K++,10),r=Y();return t.__=e,P.componentDidCatch||(P.componentDidCatch=function(o,n){t.__&&t.__(o,n),r[1](o)}),[r[0],function(){r[1](void 0)}]},useId:gr,useImperativeHandle:hr,useInsertionEffect:Dr,useLayoutEffect:_e,useMemo:ee,useReducer:ot,useRef:X,useState:Y,useSyncExternalStore:Br,useTransition:jr,version:"17.0.2"},Symbol.toStringTag,{value:"Module"})),Ot=e=>{let t;const r=new Set,o=(i,u)=>{const a=typeof i=="function"?i(t):i;if(!Object.is(a,t)){const l=t;t=u??typeof a!="object"?a:Object.assign({},t,a),r.forEach(d=>d(t,l))}},n=()=>t,s={setState:o,getState:n,subscribe:i=>(r.add(i),()=>r.delete(i)),destroy:()=>r.clear()};return t=e(o,n,s),s};function Mn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Hn(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var r=function o(){return this instanceof o?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(o){var n=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(r,o,n.get?n:{enumerable:!0,get:function(){return e[o]}})}),r}var qt={exports:{}},Ve={};const Wr=Hn(Vn);var Ut,Vt,Mt,Ht,jt={exports:{}},Me={};function jn(){return Vt||(Vt=1,jt.exports=function(){if(Ut)return Me;Ut=1;var e=Wr,t=typeof Object.is=="function"?Object.is:function(a,l){return a===l&&(a!==0||1/a==1/l)||a!=a&&l!=l},r=e.useState,o=e.useEffect,n=e.useLayoutEffect,s=e.useDebugValue;function i(a){var l=a.getSnapshot;a=a.value;try{var d=l();return!t(a,d)}catch{return!0}}var u=typeof window>"u"||window.document===void 0||window.document.createElement===void 0?function(a,l){return l()}:function(a,l){var d=l(),c=r({inst:{value:d,getSnapshot:l}}),f=c[0].inst,p=c[1];return n(function(){f.value=d,f.getSnapshot=l,i(f)&&p({inst:f})},[a,d,l]),o(function(){return i(f)&&p({inst:f}),a(function(){i(f)&&p({inst:f})})},[a]),s(d),d};return Me.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,Me}()),jt.exports}var Dn=(Ht||(Ht=1,qt.exports=function(){if(Mt)return Ve;Mt=1;var e=Wr,t=jn(),r=typeof Object.is=="function"?Object.is:function(a,l){return a===l&&(a!==0||1/a==1/l)||a!=a&&l!=l},o=t.useSyncExternalStore,n=e.useRef,s=e.useEffect,i=e.useMemo,u=e.useDebugValue;return Ve.useSyncExternalStoreWithSelector=function(a,l,d,c,f){var p=n(null);if(p.current===null){var C={hasValue:!1,value:null};p.current=C}else C=p.current;p=i(function(){function v(S){if(!k){if(k=!0,b=S,S=c(S),f!==void 0&&C.hasValue){var h=C.value;if(f(h,S))return _=h}return _=S}if(h=_,r(b,S))return h;var y=c(S);return f!==void 0&&f(h,y)?h:(b=S,_=y)}var b,_,k=!1,w=d===void 0?null:d;return[function(){return v(l())},w===null?void 0:function(){return v(w())}]},[l,d,c,f]);var m=o(a,p[0],p[1]);return s(function(){C.hasValue=!0,C.value=m},[m]),u(m),m},Ve}()),qt.exports);const Fn=Mn(Dn),{useSyncExternalStoreWithSelector:Bn}=Fn,Dt=e=>{const t=typeof e=="function"?(o=>o?Ot(o):Ot)(e):e,r=(o,n)=>function(s,i=s.getState,u){const a=Bn(s.subscribe,s.getState,s.getServerState||s.getState,i,u);return it(a),a}(t,o,n);return Object.assign(r,t),r},Qr=e=>e?Dt(e):Dt;var Gr=(e=>(e.RIGHT="right",e.LEFT="left",e))(Gr||{});const He=e=>e!=null&&typeof e=="object"&&typeof Reflect.get(e,"taskStatus")=="string",Ft=e=>e!=null&&typeof e=="object"&&!Array.isArray(e)&&Object.values(e).every(t=>t===null||typeof t=="string"),Bt=e=>e!=null&&typeof e=="object"&&!Array.isArray(e)&&Object.values(e).every(t=>t===null||typeof t=="number"),$t=e=>Array.isArray(e)&&e.every(t=>Array.isArray(t)&&t.every(r=>{if(typeof r!="object"||r===null)return!1;const o=Reflect.get(r,"selected");return o==="left"||o==="right"||o===null})),Je=(e,t)=>{const{allowUndefined:r=!0,rejectBooleanRecord:o=!1}=t??{};if(e===void 0)return r;if(e===null||typeof e=="string"||typeof e=="number"||Array.isArray(e))return!0;if(typeof e=="object"&&e!==null){if(o){const n=Object.values(e);if(n.length>0&&n.every(s=>typeof s=="boolean"))return!1}return!0}return!1},Ye=(e,t)=>{var r;if(t===null)return null;if(e.type==="texturlprompt")return(o=>o===void 0||typeof o=="object"&&o!==null&&"skipped"in o)(t)?t:void 0;if(t===void 0)return null;if(e.type==="consentlegal")return typeof t=="object"&&"submitted"in t&&t.submitted===!0?t:null;if(e.type==="multipleselect"){const o=(r=e.props)==null?void 0:r.options;if(Array.isArray(o)&&(n=>typeof n=="object"&&n!==null&&!Array.isArray(n)&&Object.values(n).every(s=>typeof s=="boolean"))(t)){const n=t;return o.reduce((s,i)=>(n[String(i.id)]&&s.push(i.value),s),[])}}if(e.type==="multiplechoice"){if(typeof t=="object"&&t!==null&&!Array.isArray(t)){if(Object.keys(t).length===0)return null;const o=Object.values(t).find(n=>n!==!1&&n!==void 0);if(o!==void 0)return o}return Je(t,{allowUndefined:!1,rejectBooleanRecord:!0})?t:null}return Je(t,{allowUndefined:!1,rejectBooleanRecord:!0})?t:null},$n=/<piped-value\b([^>]*)>.*?<\/piped-value>/gis,Wt=["questionHtml","captionHtml","footerHtml","richTextBody"],Xe=e=>!!e.props&&typeof e.props=="object"&&"properties"in e.props,je=e=>!!e.props&&typeof e.props=="object"&&"options"in e.props&&Array.isArray(e.props.options),Qt=e=>["string","number"].includes(typeof e),Gt=e=>e.length===0?"":e.length===1?e[0]:e.join(", "),Wn=e=>{var r,o;const t=(n=>n!=null&&typeof n=="object"&&"value"in n)(e)?e.value:void 0;if(t!=null){if(e.type==="multipleselect"&&je(e)&&(n=>!!n&&typeof n=="object"&&!Array.isArray(n))(t)){const n=e.secondaryValue??null,s=e.props.options.filter(i=>t[String(i.id)]===!0).map(i=>{var u;return i.label+((u=n==null?void 0:n[String(i.id)])!=null&&u.userText?`: ${n[String(i.id)].userText}`:"")});return s.length?Gt(s):"No options selected"}if(e.type==="multiplechoice"&&typeof t=="object"&&t!==null){const n=Object.keys(t);if(n.length===0)return"No options selected";const s=e.secondaryValue??null,i=n[0];if(i){const u=e.props.options.find(a=>String(a.id)===i);return(u==null?void 0:u.label)+((r=s==null?void 0:s[i])!=null&&r.userText?`: ${(o=s==null?void 0:s[i])==null?void 0:o.userText}`:"")}}if(e.type==="matrix"&&je(e)&&(n=>{if(!Xe(n))return!1;const s=n.props.properties;return!!s&&typeof s=="object"&&"matrixColumn"in s})(e)){const n=e.props.options,s=e.props.properties.matrixColumn,i=[];for(const[u,a]of Object.entries(t)){const l=n.find(C=>String(C.id)===u),d=(l==null?void 0:l.label)??u,c=Qt(a)?String(a):JSON.stringify(a),f=s.find(C=>C.value===c),p=(f==null?void 0:f.label)??c;i.push(`${d}: ${p}`)}return i.join("; ")}if(e.type==="rankorder"&&je(e)){const n=e.props.options.reduce((i,u)=>(i[String(u.id)]=u.label,i),{}),s=[];for(const[i,u]of Object.entries(t)){const a=n[i];a&&(s[u-1]=a)}return Gt(s)}if(Qt(t)){const n=String(t).replaceAll(/[\u200B-\u200D\uFEFF]/g,"").trim();return n===""?void 0:n}try{return JSON.stringify(t)}catch{return String(t)}}},Zt=(e,t)=>{const r=new RegExp(`${t}="([^"]*)"`,"i").exec(e);return(r==null?void 0:r[1])??null},Qn=(e,t)=>{if(e==null)return e;let r=!1;const o=e.replace($n,(n,s)=>{r=!0;const i=Zt(s,"answer-id"),u=Zt(s,"fallback-text")??"";if(!i)return u;const a=i.startsWith("attr-")?i:Number(i);if(Object.hasOwn(t,a)){const l=t[a];return String(l)}return u});return r?o:e},et=(e,t)=>{const r={};if(t)for(const[o,n]of Object.entries(t))typeof n=="string"?r[`attr-${o}`]=n:n!=null&&(r[`attr-${o}`]=JSON.stringify(n));for(const o of e){const n=Wn(o);n!==void 0&&(r[o.name]=n)}return r},Gn=(e,t,r)=>{switch(t){case"videovoice":return!!(e!=null&&e.value);case"open":return!!r;case"multipleselect":return!!(r&&Object.keys(r).length);case"recordedtask":return r!==null&&typeof r=="object"&&"taskStatus"in r&&r.taskStatus==="completed";case"texturlprompt":return!e.value;case"consentlegal":case"nps":case"likert":return r!==null;case"multiplechoice":return r!==void 0;case"matrix":return!!(r&&Object.values(r).every(o=>o!==null));default:return!0}},Zr=(e,t)=>{if(t==="matrix"&&e&&typeof e=="object"){const r=Object.keys(e).length,o=Object.values(e).filter(n=>n!==null).length;return o>0&&o<r}return!1},Le=e=>e==null?"":typeof e=="object"?JSON.stringify(e):typeof e=="string"?e:String(e),ae={eq:(e,t)=>Number(e)===Number(t),neq:(e,t)=>!ae.eq(e,t),gt:(e,t)=>Number(e)>Number(t),gte:(e,t)=>Number(e)>=Number(t),lt:(e,t)=>Number(e)<Number(t),lte:(e,t)=>Number(e)<=Number(t),list_exact(e,t){if(!Array.isArray(e)||!Array.isArray(t))return!1;const r=(o,n)=>String(o).localeCompare(String(n));return e.slice().sort(r).join(",")===t.slice().sort(r).join(",")},list_all:(e,t)=>!(!Array.isArray(e)||!Array.isArray(t))&&!t.some(r=>!e.includes(r)),list_alo(e,t){if(!Array.isArray(t))return!1;const r=Array.isArray(e)?e:[e],o=new Set(r);return t.some(n=>o.has(n))},list_dni(e,t){if(!Array.isArray(t))return!1;const r=Array.isArray(e)?e:[e],o=new Set(r);return t.every(n=>!o.has(n))},contains(e,t){const r=Le(e).toLowerCase(),o=Le(t).toLowerCase();return r.includes(o)},notcontains:(e,t)=>!ae.contains(e,t)},dt=(e,t,r)=>r>0?t?e.length-3:e.length-2:t?e.length-2:e.length-1,he={eq:(e,t)=>e==t,neq:(e,t)=>!he.eq(e,t),gt:(e,t)=>Number(e)>Number(t),gte:(e,t)=>Number(e)>=Number(t),lt:(e,t)=>Number(e)<Number(t),lte:(e,t)=>Number(e)<=Number(t),list_exact(e,t){if(!Array.isArray(e)||!Array.isArray(t))return!1;const r=(o,n)=>String(o).localeCompare(String(n));return e.slice().sort(r).join(",")===t.slice().sort(r).join(",")},list_all:(e,t)=>!(!Array.isArray(e)||!Array.isArray(t))&&!t.some(r=>!e.includes(r)),list_alo(e,t){if(!Array.isArray(t))return!1;const r=Array.isArray(e)?e:[e],o=new Set(r);return t.some(n=>o.has(n))},list_dni(e,t){if(!Array.isArray(t))return!1;const r=Array.isArray(e)?e:[e],o=new Set(r);return t.every(n=>!o.has(n))},contains(e,t){const r=String(e??"").toLowerCase(),o=String(t??"").toLowerCase();return r.includes(o)},notcontains:(e,t)=>!he.contains(e,t)},Zn=e=>e in he,Pe=1,Kr=2,Kn=e=>{var o,n,s;switch(e.type){case"multipleselect":return e&&e.props&&e.props.options?e.props.options.length>13?e.props.options.map(i=>[i.value]):(t=e.props.options.map(i=>i.value),r=!e.props.properties.required,t.reduce((i,u)=>i.concat(i.map(a=>[...a,u])),[[]]).filter(i=>r||i.length>0)):null;case"multiplechoice":{if(!e||!e.props||!e.props.options)return null;const i=e.props.options.map(u=>u.value);return e.props.properties.required||i.push(void 0),i}case"matrix":{if(!((o=e==null?void 0:e.props)!=null&&o.options))return null;const i=e.props.properties.matrixColumn,u=e.props.options,a=u.reduce((d,c)=>(d[c.id]=null,d),{}),l=[{...a,[u[0].id]:i[0].value},u.reduce((d,c)=>(d[c.id]=i[0].value,d),{})];return e.props.properties.required||l.push(a),l}case"likert":{const i=Number((s=(n=e.props)==null?void 0:n.properties)==null?void 0:s.range)||5;return[...Array.from(new Array(i).keys()).map(a=>a+1),...e.props.properties.required?[]:[null]]}case"nps":return[0,1,2,3,4,5,6,7,8,9,10,...e.props.properties.required?[]:[null]];case"videovoice":case"open":return["1",...e.props.properties.required?[]:[""]];case"recordedtask":{const i=[{taskStatus:"completed"},{taskStatus:"given.up"}];return e.props.properties.required||i.push({taskStatus:"abandoned"}),i}case"texturlprompt":return[void 0,...e.props.properties.required?[]:[{skipped:!0}]];case"consentlegal":return[1,...e.props.properties.required?[]:[null]];default:return[1]}var t,r},zn=e=>typeof e=="object"&&e!==null&&"taskStatus"in e,Jn=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&"comparator"in e&&"questionIndex"in e,zr=(e,t)=>{const r=[];for(const o of e)Array.isArray(o)?r.push(...zr(o,t)):Jn(o)&&o.questionIndex===t&&r.push(o);return r},Yn=(e,t=[])=>t.reduce((r,o)=>{const{group:n,target:s}=o;if(!(n!=null&&n.length))return[...r];const i=zr(n,e).map(u=>{const{comparator:a,value:l}=u;return{comparator:a,target:s,value:l}});return[...r,...i]},[]),Jr=({cards:e,index:t,hasEndCard:r,allResponses:o,uploadProgress:n={},surveyVisitorAttributes:s={}})=>{var d;if(t>=e.length||t<0)return null;let i=t+1;const u=e[t].props.routingOptions||[];for(const c of u){if(!Yr(c))continue;const{group:f,target:p}=c;if(tn({group:f,allResponses:o,cards:e,surveyVisitorAttributes:s})){i=p===-1&&r?e.length-1:p;break}}const a=e.findIndex(c=>c.type==="uploading"),l=dt(e,r,a);for(;i!==null&&i!==-1&&i<=l;){const c=e[i],f=((d=c==null?void 0:c.props)==null?void 0:d.displayLogic)||[];if(f.length>0&&!pt({displayLogic:f,allResponses:o,cards:e,surveyVisitorAttributes:s})){i++;continue}if(c!=null&&c.parentId){const p=e.findIndex(C=>C.name===c.parentId);if(p>-1){const C=e[p],m=o[p],v=pe({comparator:"answered",type:C.type,response:m}),b=C.type==="matrix"&&pe({comparator:"partial",type:C.type,response:m});if(!(v||b)){i++;continue}}}break}return t>=l||i===-1||i!==null&&i>l?a>0&&Object.values(n).some(f=>f.isSubmitted&&!f.isComplete)?a:r?e.length-1:null:i===-1?null:i},Yr=e=>typeof e=="object"&&e!==null&&"group"in e,Xr=e=>e===Pe||e===Kr,Kt=({segment:e,allResponses:t,cards:r,surveyVisitorAttributes:o})=>Array.isArray(e)?en({segments:e,allResponses:t,cards:r,surveyVisitorAttributes:o}):!Xr(e)&&!!(n=>typeof n=="object"&&n!==null&&!Array.isArray(n)&&"comparator"in n)(e)&&(({rule:n,allResponses:s,cards:i,surveyVisitorAttributes:u})=>{if(n.questionIndex===void 0||typeof n.questionIndex=="number"&&n.questionIndex>=s.length)return!1;const a=(({rule:l,allResponses:d,cards:c,surveyVisitorAttributes:f})=>{if(l.questionIndex===void 0)return null;if(typeof(p=l.questionIndex)=="string"&&p.startsWith("attr-")){const m=(v=>v.slice(5))(l.questionIndex);return m in f?{response:f[m],type:"AttributeCheck"}:null}var p;const C=l.questionIndex;return{response:d[C],type:c[C].type}})({rule:n,allResponses:s,cards:i,surveyVisitorAttributes:u});return a!==null&&!!pe({comparator:n.comparator,response:a.response,type:a.type,value:n.value})})({rule:e,allResponses:t,cards:r,surveyVisitorAttributes:o}),en=({segments:e,allResponses:t,cards:r,surveyVisitorAttributes:o})=>{if(!e||e.length===0)return!1;let n=Kt({segment:e[0],allResponses:t,cards:r,surveyVisitorAttributes:o}),s=1;for(;s<e.length;){const i=e[s];if(!Xr(i)||(s+=1,s>=e.length))return!1;const u=Kt({segment:e[s],allResponses:t,cards:r,surveyVisitorAttributes:o});s+=1,n=i===Pe?n&&u:n||u}return n},pt=({displayLogic:e,allResponses:t,cards:r,surveyVisitorAttributes:o})=>e.some(n=>!!Yr(n)&&tn({group:n.group,allResponses:t,cards:r,surveyVisitorAttributes:o})),tn=({group:e,allResponses:t,cards:r,surveyVisitorAttributes:o})=>en({segments:e,allResponses:t,cards:r,surveyVisitorAttributes:o}),pe=({comparator:e,response:t,type:r,value:o})=>{if(r==="AttributeCheck")return((s,i,u)=>{const a=Le(i),l=Le(u),d=Number(i),c=Number(u),f=!Number.isNaN(d)&&a===String(d),p=!Number.isNaN(c)&&l===String(c),C=f&&p;switch(s){case"eq":return C?d===c:a.toLowerCase()===l.toLowerCase();case"neq":return C?d!==c:a.toLowerCase()!==l.toLowerCase();case"contains":case"notcontains":return ae[s](a,l);case"gt":case"gte":case"lt":case"lte":return C?ae[s](d,c):ae[s](a.localeCompare(l),0);case"list_exact":case"list_all":case"list_alo":case"list_dni":{const m=Array.isArray(i)?i:[i],v=Array.isArray(u)?u:[u];return ae[s](m,v)}default:return!1}})(e,t,o);if(!Je(t))return!1;const n=t;if(e==="answered")switch(r){case"texturlprompt":return n===void 0;case"consentlegal":return n&&(s=>s===null||s!==void 0&&typeof s=="object"&&"submitted"in s&&typeof s.submitted=="boolean")(n)&&n.submitted===!0;case"recordedtask":return He(n)&&n.taskStatus==="completed";case"likert":case"nps":return Number.isInteger(n);case"rankorder":return Bt(n)&&Object.values(n).every(s=>s!==null);case"matrix":return Ft(n)&&Object.values(n).every(s=>s!==null);case"maxdiff":return $t(n)&&n.every(s=>{if(!Array.isArray(s))return!1;const i=s.some(a=>a.selected==="left"),u=s.some(a=>a.selected==="right");return i&&u});case"multiplechoice":return!!n;case"multipleselect":return n&&Array.isArray(n)&&(n.length??0)>0;case"open":case"aidynamicstandalone":return typeof n=="string"&&!!n;case"videovoice":return(s=>s!=null&&typeof s=="object"&&"mediaRecordingUid"in s&&typeof s.mediaRecordingUid=="string")(n)&&!!n.mediaRecordingUid;default:return!1}if(e==="given_up")return r!=="recordedtask"||He(n)&&n.taskStatus==="given.up";if(e==="partial")return Zr(n,r);if(e==="skipped")switch(r){case"texturlprompt":return(s=>s!==null&&(s===void 0||typeof s=="object"))(n)&&!!(typeof n=="object"&&n!==null&&"skipped"in n&&n.skipped);case"consentlegal":case"likert":case"nps":case"videovoice":return n===null;case"recordedtask":return He(n)&&n.taskStatus==="abandoned";case"open":case"aidynamicstandalone":return n===null||typeof n=="string"&&n.length===0;case"multiplechoice":return n==null;case"multipleselect":return n===null||Array.isArray(n)&&n.length===0;case"matrix":return n===null||Ft(n)&&Object.values(n).every(s=>s===null);case"maxdiff":return n===null||!$t(n)||n.some(s=>{if(!Array.isArray(s))return!0;const i=s.some(a=>a.selected==="left"),u=s.some(a=>a.selected==="right");return!(i&&u)});case"rankorder":return n===null||Bt(n)&&Object.values(n).includes(null);default:return!1}return o!==void 0&&he[e](n,o)};var rn=(e=>(e.CONTINUE="CONTINUE",e.EXTERNAL="EXTERNAL",e.NO_BUTTON="NO_BUTTON",e))(rn||{}),J=(e=>(e.failure="failure",e.success="success",e.inFlight="inFlight",e))(J||{}),nn=(e=>(e.Unlimited="Unlimited",e.Maximum="Maximum",e.Range="Range",e))(nn||{});const Xn=e=>{var t,r,o,n,s,i,u,a,l;switch(e.type){case"rankorder":case"multipleselect":case"multiplechoice":return(r=(t=e==null?void 0:e.props)==null?void 0:t.options)==null?void 0:r.map(d=>d.label);case"nps":return"1-10";case"likert":return`1-${((n=(o=e==null?void 0:e.props)==null?void 0:o.properties)==null?void 0:n.range)??5}`;case"matrix":return{matrixColumns:(u=(i=(s=e==null?void 0:e.props)==null?void 0:s.properties)==null?void 0:i.matrixColumn)==null?void 0:u.map(d=>d.label),matrixRows:(l=(a=e==null?void 0:e.props)==null?void 0:a.options)==null?void 0:l.map(d=>d.label)};default:return}},eo=new Set(["rankorder","multipleselect","multiplechoice","matrix","likert","nps","open","aidynamicfollowup","aidynamicstandalone"]),zt=({cards:e,combinedReadableRawResponses:t,targetQuestionId:r,generateQuestionType:o})=>{let n=1,s=1;const i=e.reduce((u,a)=>{if(a.name>0&&eo.has(a.type)){if(r===a.name&&(s=n,o==="aidynamicstandalone"))return n++,u;if((a.type==="aidynamicfollowup"||a.type==="aidynamicstandalone")&&a.props.loading!==J.success)return u;const l="properties"in a.props&&a.props.properties&&"captionText"in a.props.properties?a.props.properties.captionText:void 0,d=(c=>c.type!=="uploading"&&c.type!=="thanks")(a)?{order:n++,question:a.props.message,questionDescription:l,questionType:a.type,response:t==null?void 0:t[a.name],options:Xn(a)}:{order:n++,questionType:a.type,response:t==null?void 0:t[a.name]};u.push(d)}return u},[]);return{targetQuestionOrder:s,questionsResponses:i}},Jt=e=>{var t;return"props"in e&&"loading"in e.props&&((t=e==null?void 0:e.props)==null?void 0:t.loading)!==void 0},De=(e,t,r)=>{let o=!1;const n=e.map(s=>s&&s.parentId===t?(o=!0,r(s)):s);return o?n:e},Fe=(e,t,r)=>{let o=!1;const n=e.map(s=>s&&s.name===t?(o=!0,r(s)):s);return o?n:e},Yt=e=>{const{props:t}=e;return t&&"message"in t&&"properties"in t?{...e,props:{...t,loading:J.inFlight}}:e},Xt=({isPreview:e,apiURL:t,envId:r,userId:o,headers:n})=>e?{url:`${t}/sdk/1/environments/${r}/dynamic-question-preview`,visitorIdHeader:"0"}:{url:`${t}/sdk/1/environments/${r}/visitors/${o}/dynamic-question`,visitorIdHeader:n["x-ul-visitor-id"]},to=(e,t)=>{const r=t[e];return typeof r!="number"?null:r},on=(e,t)=>Array.isArray(e)?e.map(r=>on(r,t)):(r=>typeof r=="object"&&r!==null&&!Array.isArray(r)&&"questionUid"in r)(e)?{...e,questionIndex:to(e.questionUid,t)}:e,ro=e=>e===Pe||e===Kr,er=({segment:e,allResponses:t,cards:r,currentIndex:o})=>Array.isArray(e)?sn({constraintGroup:e,allResponses:t,cards:r,currentIndex:o}):typeof e!="number"&&!!(n=>typeof n=="object"&&n!==null&&!Array.isArray(n)&&"questionIndex"in n)(e)&&(({constraint:n,allResponses:s,cards:i,currentIndex:u})=>{const{questionIndex:a}=n;if(a===null)return!1;if(!Object.hasOwn(s,a))return!(u>a)||n.comparisonType==="skipped";const l=i[a];return l!==void 0&&!!pe({comparator:n.comparisonType,response:s[a],type:l.type,value:n.value})})({constraint:e,allResponses:t,cards:r,currentIndex:o}),sn=({constraintGroup:e,allResponses:t,cards:r,currentIndex:o})=>{if(e.length===0)return!1;let n=er({segment:e[0],allResponses:t,cards:r,currentIndex:o}),s=1;for(;s<e.length;){const i=e[s];if(typeof i!="number"||!ro(i)||(s+=1,s>=e.length))return!1;const u=er({segment:e[s],allResponses:t,cards:r,currentIndex:o});s+=1,n=i===Pe?n&&u:n||u}return n},an=e=>e.length>0&&e.every(t=>t.quotaFilled||!t.quotaMatched),no=({quotas:e,quotaMessages:t})=>{if(e.length!==0)return e.every(r=>!r.quotaMatched)?t==null?void 0:t.disqualified:an(e)?t==null?void 0:t.filled:void 0},tr=e=>200+90*e+16*e,Be=new Set(["thanks","uploading"]),W=Qr()((e,t)=>({providerPersona:void 0,showProviderPersona:!1,addResponseGroupMeta:void 0,allResponses:[],allResponsesRaw:{},answers:void 0,apiURL:"",avatars:{agentAvatar:{"1x":"","2x":""},respondentAvatar:{"1x":"","2x":""}},border:"#2f2e2c",cards:[],cardIndexByName:{},quotaEndcardText:void 0,quotaMessages:void 0,quotas:[],close:async(r=U.APP_ID)=>{const o=t(),{fadeout:n,remove:s,trackHistory:i,studyType:u}=o;await n(r),$e(o)||i({event:"closed"}),E.breadcrumbsLogger.info("SurveyClosing",{surveyId:o.surveyId}),U.ConflictingWidgets.enable(),s({initiator:E.DismissReason.Closed,studyType:u})},configureExitOnOverlayClick:()=>{},customMetadata:{},destroy:async r=>{const{eventEmitFn:o,fadeout:n,remove:s,studyType:i,surveyId:u}=t();o("survey.complete",u),await n(r),U.ConflictingWidgets.enable(),s({initiator:E.DismissReason.Complete,studyType:i})},enableCspTrustedTypes:!1,endCard:{headline:""},envId:"",eventEmitFn:E.eventEmitter.emit.bind(E.eventEmitter),fadeout:async r=>{const{eventEmitFn:o,headers:n,viewDocument:s}=t();return E.shouldDirectEmbed(n)?Promise.resolve():(o(E.SprigEvent.SurveyFadingOut),new Promise(i=>{const u=s.getElementById(r);u?(u.addEventListener("transitionend",()=>{i()}),u.classList.remove("ul-app--visible")):i()}))},forceBrandedLogo:!1,frame:document.createElement("iframe"),handleClickEmbedButton:r=>{const{cards:o,eventEmitFn:n,index:s}=t();n(r,{qid:o[s].name,props:o[s].props}),e(()=>({hasViewedEmbed:!0}))},handleUploadUpdate:({mediaRecordingUid:r,isComplete:o,progressPct:n,isSubmitted:s})=>{var p,C,m;const{cards:i,destroy:u,index:a,uploadProgress:l}=t(),d=o||((p=l[r])==null?void 0:p.isComplete),c={...l,[r]:{progressPct:d?100:n||((C=l[r])==null?void 0:C.progressPct),isComplete:d,isSubmitted:s||((m=l[r])==null?void 0:m.isSubmitted)}};if(e({uploadProgress:c}),i[a].type!=="uploading")return;const f=Object.entries(l).every(([v,b])=>!b.isSubmitted||b.isComplete||r==v&&o);if(f&&a>=i.length-1)return u(U.APP_ID);e({index:f?a+1:a,uploadingCardViewed:!0})},hasViewedEmbed:!1,headers:{Authorization:"","Content-Type":"","userleap-platform":"web","x-ul-environment-id":"","x-ul-installation-method":"web-snippet","x-ul-sdk-version":"","x-ul-visitor-id":""},index:0,isConversationalUI:!1,isPreview:!1,layout:"default",marketingUrl:"https://sprig.com",meta:{ch:0,cw:0,l:"",mode:null,p:"",sh:0,sw:0},mode:void 0,next:r=>{const{allResponses:o,cards:n,eventEmitFn:s,index:i,quotaMessages:u,quotas:a,responseGroupUid:l,submit:d,trackHistory:c,uploadProgress:f,viewedCardCount:p}=t(),C=Array.isArray(r.data)?r.data:[r.data],m=Date.now(),v=[...n],b={response:[],responseGroupUid:l,questionIndex:i};let _=null;const k=o.slice(0);let w=i;C.forEach((I,g)=>{const N=Math.floor(I.questionId),L=v.findIndex(M=>M.name===N),T=L>=0?v[L]:v[i+g],O={value:I.value,questionId:N,answeredAt:m,...I.secondaryValue!==void 0&&{secondaryValue:I.secondaryValue},...I.questionText!==void 0&&{questionText:I.questionText}},j=O.value;(M=>M&&!Be.has(M.type))(T)&&(T.value=j,T.secondaryValue=O.secondaryValue||null),b.response.push(O);const V=L>=0?L:i+g;k[V]=Ye(T,j),V>w&&(w=V)}),_=Jr({cards:v,index:w,hasEndCard:!!r.endCard,uploadProgress:f,allResponses:k,surveyVisitorAttributes:t().surveyVisitorAttributes});const S=(({quotas:I,allResponses:g,cards:N,currentIndex:L})=>I.map(T=>T.quotaMatched?{...T,quotaMatched:sn({constraintGroup:T.constraintGroup,allResponses:g,cards:N,currentIndex:L})}:T))({quotas:a,allResponses:k,cards:v,currentIndex:_??w+1});if(an(S)){const I=v.findIndex(g=>g.type==="thanks");_=I>=0?I:null}e({allResponses:k,quotaEndcardText:no({quotas:S,quotaMessages:u}),quotas:S}),(_===null||Be.has(v[_].type))&&(b.completedAt=m);const h=d(b);if(_===null)return void r.completeSurvey();_&&!Be.has(v[_].type)&&h.finally(()=>{c({event:"seen",index:_})});const y=v[_];v[_]&&s&&s("survey.question",{qid:y.name,props:y.props}),e({cards:v,hasViewedEmbed:!1,index:_,viewedCardCount:p+1})},pendingRemoveIframeReason:null,previewKey:null,recorder:()=>{},recorderEventEmitter:E.eventEmitter,resolveTrackedPromise:()=>{const{removeIframeIfReady:r}=t();e(o=>({unresolvedRequestCount:o.unresolvedRequestCount-1})),r()},responseGroupUid:"",remove:({initiator:r,studyType:o})=>{const{eventEmitFn:n,removeIframeIfReady:s,surveyId:i}=t();e({pendingRemoveIframeReason:r,studyType:o}),n(E.SprigEvent.SurveyCloseRequested,{name:E.SprigEvent.SurveyCloseRequested,initiator:r,studyType:o,"survey.id":i}),s()},removeIframeIfReady:()=>{const{eventEmitFn:r,pendingRemoveIframeReason:o,unresolvedRequestCount:n,studyType:s,surveyId:i}=t();o&&n===0&&(r(E.SprigEvent.SurveyWillClose,{name:E.SprigEvent.SurveyWillClose,initiator:o,studyType:s,"survey.id":i}),e({pendingRemoveIframeReason:null,studyType:s}))},seen:async()=>{const{trackHistory:r}=t();return r({event:"seen",isNew:!0})},createDynamicStandaloneQuestion:async({questionId:r})=>{var f,p,C;let o=!1;if(e(m=>{const v=m.cards.find(b=>(b==null?void 0:b.name)===r);return!(v!=null&&v.name)||Jt(v)?m:(o=!0,{cards:Fe(m.cards,r,Yt)})}),!o)return;const n=t(),{targetQuestionOrder:s,questionsResponses:i}=zt({cards:n.cards,combinedReadableRawResponses:n.allResponsesRaw,targetQuestionId:r,generateQuestionType:"aidynamicstandalone"}),u={surveyId:n.surveyId,responseGroupUid:n.responseGroupUid,standaloneQuestionOrder:s,questionsResponses:i,standaloneQuestionId:r,customMe