@sprig-technologies/sprig-bundled 2.41.0 → 2.41.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/conversational-styles-41oiRRxR.cjs +1 -0
- package/dist/conversational-styles-Cw5d-ccF.js +4 -0
- package/dist/{conversational-ui-Dfwwfe2B.cjs → conversational-ui-CRdFUEdz.cjs} +2 -2
- package/dist/{conversational-ui-BMaVlQM7.js → conversational-ui-rjtdSFBb.js} +252 -241
- package/dist/{getAttributedUrl-BI712lA1.js → getAttributedUrl-BCuq8noY.js} +2 -2
- package/dist/{getAttributedUrl-CuAx8r1V.cjs → getAttributedUrl-WX6TIqnY.cjs} +1 -1
- package/dist/index-B4g9h0E3.js +706 -0
- package/dist/index-Ci7K6Rbp.cjs +1 -0
- package/dist/{index-DZZhe9UA.cjs → index-D2QLhKHZ.cjs} +2 -2
- package/dist/{index-YBebm7NT.js → index-Dm5Q2JaO.js} +3 -3
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{view-BHOd3THT.js → view-CocVngjw.js} +345 -344
- package/dist/view-rFRtvibL.cjs +1 -0
- package/package.json +1 -1
- package/dist/conversational-styles-BiL7hMhj.js +0 -4
- package/dist/conversational-styles-DlhTFTL6.cjs +0 -1
- package/dist/index-CEpl_fRY.cjs +0 -1
- package/dist/index-cT-GmgDY.js +0 -712
- package/dist/view-Btk1gSAI.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});exports.default='html,body,p,ol,ul,li,dl,dt,dd,blockquote,figure,fieldset,legend,textarea,pre,iframe,hr,h1,h2,h3,h4,h5,h6{margin:0;padding:0}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:400}button,input,select,textarea{margin:0}html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}ol,ul{padding-inline-start:1em}.ul-card-text__button{background-color:var(--theme);border-radius:3px;border:none;color:#fff;cursor:pointer;font-size:15px;font-weight:500;line-height:18px;padding:10.5px 21px}.ul-card-text__button:disabled,.ul-card-text__button.sprig-button-disabled{background-color:#0000001a;color:#0003}.ul-card-text__button:disabled>svg path,.ul-card-text__button.sprig-button-disabled>svg path{stroke:#0003}.ul-card-text__button.ul-button-inactive{background-color:#fff;color:#5d696f}.ul-card-skip__button{color:#00000080;background:none;border:none;font-size:15px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;cursor:pointer}.ul-card-button-group{align-items:center;display:flex;gap:15px;justify-content:center}.sprig-question-footer-container{align-items:center}.ul-card__button-checkmark{display:flex;align-items:center;gap:8px;padding:8px 16px;border-radius:8px;background-color:var(--theme);color:#fff}.ul-card__button-checkmark:disabled{background-color:var(--theme);opacity:.5;color:#fff}.ul-card__button-checkmark:disabled>svg path{stroke:#fff}.ul-conversational-ui{width:100%;height:100%;display:flex;flex-direction:column;min-height:500px;font-size:15px;position:relative}.conversational-close-btn{position:fixed;top:16px;right:16px;width:32px;height:32px;display:flex;align-items:center;justify-content:center;border-radius:50%;cursor:pointer;z-index:1000}.conversational-close-btn:hover{background:#ffffff80}.chat-container{flex:1;display:flex;flex-direction:column;align-items:center}.chat-messages{flex:1;padding:80px 20px 360px;display:flex;flex-direction:column;gap:10px;max-width:1000px;width:100%}.chat-message-no-response{font-style:italic;color:#666}.chat-bubble-container{display:flex;flex-direction:row;align-items:flex-start;width:100%;animation:fadeInUp .3s ease-out}.chat-left{align-self:flex-start;width:auto;justify-content:flex-start}.chat-right{align-self:flex-end;width:auto;justify-content:flex-end}.chat-avatar{width:32px;height:32px;border-radius:100%;flex-shrink:0}.chat-avatar-left{margin-right:10px}.chat-avatar-right{margin-left:10px}.chat-bubble{border-radius:20px;word-wrap:break-word;position:relative}.chat-bubble-left{background:#f9f9f8;border-radius:2px 24px 24px;padding:12px 16px;border:1px solid #e2e3e1}.chat-bubble-right{background:#fff;color:#333;border-radius:24px 2px 24px 24px;border:1px solid #cbcbcb}.chat-message-text{font-size:15px;line-height:1.4;margin:0;text-align:left}.chat-bubble-left .chat-message-text{color:#333}.chat-bubble-right .chat-message-text{color:#333;padding:12px 16px}.chat-card-container{padding:0;background:transparent;min-width:400px}.chat-thanks-card{background:transparent;box-shadow:none;text-align:center}.end-of-survey-text{text-align:center;color:#999;font-size:12px;margin-top:8px;font-weight:400}.answered-card{pointer-events:none;opacity:.7;position:relative}.answered-card:after{content:"";position:absolute;top:0;left:0;right:0;bottom:0;background:#ffffff4d;pointer-events:none;border-radius:inherit}.answered-card button,.answered-card input,.answered-card textarea,.answered-card select{pointer-events:none}.answered-card:not(.ul-card__consent-legal):not(.ul-card__text-url-prompt) .ul-card-button-group *{display:none}.sprig-question-footer-container{align-items:end;padding:8px 10px}.chat-card.ul-card--video .sprig-question-footer-container{flex-direction:row;justify-content:flex-end;align-items:center}.sprig-question-body{padding:10px 10px 0;overflow:unset}.ul-card-text__button{font-size:13px}@keyframes fadeInUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}.chat-bubble-container.chat-left.chat-no-avatar .chat-bubble{margin-left:42px}@media (max-width: 768px){.chat-messages{padding:16px}.chat-bubble-left{padding:10px 14px}.chat-right{width:100%}.chat-bubble-right{width:100%;max-width:286px}.chat-bubble-text-only{width:auto;min-width:60px;max-width:286px}.chat-avatar{width:28px;height:28px}.chat-avatar-left{margin-right:8px}.chat-avatar-right{margin-left:8px}.chat-card-container{min-width:0}.chat-card .choice,.chat-message-text{font-size:12px}.chat-bubble-container.chat-left.chat-no-avatar .chat-bubble{margin-left:36px}}.ul-card-vertical__button-wrapper{align-items:end}.ul-card-skip__button{padding:0 16px}.chat-card-container:has(.ul-card__matrix),.chat-card-container:has([class*=matrix]){min-width:600px;max-width:900px}.chat-card-container .ul-card--matrix_container{max-width:100%;overflow-x:auto}.chat-card-container .ul-card--matrix_grid{min-width:100%}@media (max-width: 768px){.sprig-header-label-container,.sprig-header-label,.choice{font-size:12px}.chat-card-container:has(.ul-card__matrix),.chat-card-container:has([class*=matrix]){min-width:0;max-width:100%;width:100%}.chat-card-container .ul-card--matrix_container{overflow-x:auto;-webkit-overflow-scrolling:touch}}.select-label{cursor:pointer;flex:1;overflow-wrap:anywhere;text-align:start}@media (max-width: 768px){.ul-conversational-ui .nps-number{font-size:12px;height:35px}.ul-conversational-ui .ul-card--nps__labels{font-size:12px}}.ul-card-rank__option{text-align:left}@media (max-width: 768px){.ul-card--rank__question-inner-container,.ul-card-rank__labels{font-size:12px}.ul-card-rank__option>span{font-size:12px}.ul-card-rank__option>select{font-size:12px}}.select-button{align-items:center;background-color:transparent;border-radius:8px;border:1px solid #0b2330;box-shadow:0 0 0 2px #c8cccc;cursor:pointer;display:flex;font-size:15px;justify-content:space-between;margin-bottom:8px;padding:4px 8px 4px 16px;width:100%}.select-button:hover{background-color:#f3f3f3}.select-button:active{background-color:#eee}.select-button span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select-button.select-button-placeholder{color:#b0b5b7}.select-button svg{flex-shrink:0}.select-list{position:relative;height:fit-content;padding:4px 0;z-index:100;background-color:#fff;border:1px solid #E2E3E1;box-shadow:0 16px 24px #0b23300d,0 4px 12px #0b233008;border-radius:8px;overflow-y:scroll;width:100%}.select-option{align-items:center;cursor:pointer;display:flex;font-size:15px;gap:16px;line-height:20px;padding:8px 16px}.select-option:hover{background-color:#f3f3f3}.ul-card-text{margin-top:2px;margin-bottom:3px;display:flex;flex-direction:column;justify-content:center;padding:0;width:100%}.ul-card-text__container{align-items:center;box-sizing:border-box;border-radius:3px;display:flex;justify-content:center;margin-bottom:12px;flex:1 0 100%}.ul-card-text__input--mobile{border:2px solid #e6e6e6;max-height:63px}.ul-card-text__input--desktop{border:1px solid #e6e6e6;max-height:150px}.ul-card-text__input{background:#fff;box-sizing:border-box;color:#343442;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;min-height:63px;overflow:auto;padding:8px;resize:none;width:100%;border-radius:3px;line-height:20px;overflow-wrap:break-word}.ul-card-text__input::placeholder{color:#6c6c6e80}.ul-card-text__input:focus{outline:none;background:#fff}.ul-card-text__input--desktop:hover:not(:focus){background-color:#fff}@media (max-width: 768px){.ul-card-text__input{font-size:12px}}.ul-card__text-url-prompt .sprig-question-body{padding:0}.ul-card__text-url-prompt .ul-card-button-group{padding:10px}@keyframes flashingDot{0%{background-color:#262136}50%,to{background-color:#f8f9fa}}.thinking-dots-container{display:flex;justify-content:center;align-items:flex-end;position:relative;width:18px;margin-top:.5em}.thinking-dot{position:relative;width:3px;height:3px;border-radius:5px;background-color:#262136;color:#262136;animation:flashingDot 1s infinite linear alternate;animation-delay:.5s}.thinking-dot:before,.thinking-dot:after{content:"";display:inline-block;position:absolute;top:0;width:3px;height:3px;border-radius:5px;background-color:#262136;color:#262136;animation:flashingDot 1s infinite alternate}.thinking-dot:before{left:-5px;animation-delay:0s}.thinking-dot:after{left:5px;animation-delay:1s}[id^=ul-card-video__player_recorder],[id^=ul-card-video__question_player]{width:100%;width:-moz-available;width:-webkit-fill-available;width:fill-available}.answered-card [id^=ul-card-video__player_recorder] .ul-control-panel{display:none!important}';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const t = 'html,body,p,ol,ul,li,dl,dt,dd,blockquote,figure,fieldset,legend,textarea,pre,iframe,hr,h1,h2,h3,h4,h5,h6{margin:0;padding:0}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:400}button,input,select,textarea{margin:0}html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}ol,ul{padding-inline-start:1em}.ul-card-text__button{background-color:var(--theme);border-radius:3px;border:none;color:#fff;cursor:pointer;font-size:15px;font-weight:500;line-height:18px;padding:10.5px 21px}.ul-card-text__button:disabled,.ul-card-text__button.sprig-button-disabled{background-color:#0000001a;color:#0003}.ul-card-text__button:disabled>svg path,.ul-card-text__button.sprig-button-disabled>svg path{stroke:#0003}.ul-card-text__button.ul-button-inactive{background-color:#fff;color:#5d696f}.ul-card-skip__button{color:#00000080;background:none;border:none;font-size:15px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;cursor:pointer}.ul-card-button-group{align-items:center;display:flex;gap:15px;justify-content:center}.sprig-question-footer-container{align-items:center}.ul-card__button-checkmark{display:flex;align-items:center;gap:8px;padding:8px 16px;border-radius:8px;background-color:var(--theme);color:#fff}.ul-card__button-checkmark:disabled{background-color:var(--theme);opacity:.5;color:#fff}.ul-card__button-checkmark:disabled>svg path{stroke:#fff}.ul-conversational-ui{width:100%;height:100%;display:flex;flex-direction:column;min-height:500px;font-size:15px;position:relative}.conversational-close-btn{position:fixed;top:16px;right:16px;width:32px;height:32px;display:flex;align-items:center;justify-content:center;border-radius:50%;cursor:pointer;z-index:1000}.conversational-close-btn:hover{background:#ffffff80}.chat-container{flex:1;display:flex;flex-direction:column;align-items:center}.chat-messages{flex:1;padding:80px 20px 360px;display:flex;flex-direction:column;gap:10px;max-width:1000px;width:100%}.chat-message-no-response{font-style:italic;color:#666}.chat-bubble-container{display:flex;flex-direction:row;align-items:flex-start;width:100%;animation:fadeInUp .3s ease-out}.chat-left{align-self:flex-start;width:auto;justify-content:flex-start}.chat-right{align-self:flex-end;width:auto;justify-content:flex-end}.chat-avatar{width:32px;height:32px;border-radius:100%;flex-shrink:0}.chat-avatar-left{margin-right:10px}.chat-avatar-right{margin-left:10px}.chat-bubble{border-radius:20px;word-wrap:break-word;position:relative}.chat-bubble-left{background:#f9f9f8;border-radius:2px 24px 24px;padding:12px 16px;border:1px solid #e2e3e1}.chat-bubble-right{background:#fff;color:#333;border-radius:24px 2px 24px 24px;border:1px solid #cbcbcb}.chat-message-text{font-size:15px;line-height:1.4;margin:0;text-align:left}.chat-bubble-left .chat-message-text{color:#333}.chat-bubble-right .chat-message-text{color:#333;padding:12px 16px}.chat-card-container{padding:0;background:transparent;min-width:400px}.chat-thanks-card{background:transparent;box-shadow:none;text-align:center}.end-of-survey-text{text-align:center;color:#999;font-size:12px;margin-top:8px;font-weight:400}.answered-card{pointer-events:none;opacity:.7;position:relative}.answered-card:after{content:"";position:absolute;top:0;left:0;right:0;bottom:0;background:#ffffff4d;pointer-events:none;border-radius:inherit}.answered-card button,.answered-card input,.answered-card textarea,.answered-card select{pointer-events:none}.answered-card:not(.ul-card__consent-legal):not(.ul-card__text-url-prompt) .ul-card-button-group *{display:none}.sprig-question-footer-container{align-items:end;padding:8px 10px}.chat-card.ul-card--video .sprig-question-footer-container{flex-direction:row;justify-content:flex-end;align-items:center}.sprig-question-body{padding:10px 10px 0;overflow:unset}.ul-card-text__button{font-size:13px}@keyframes fadeInUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}.chat-bubble-container.chat-left.chat-no-avatar .chat-bubble{margin-left:42px}@media (max-width: 768px){.chat-messages{padding:16px}.chat-bubble-left{padding:10px 14px}.chat-right{width:100%}.chat-bubble-right{width:100%;max-width:286px}.chat-bubble-text-only{width:auto;min-width:60px;max-width:286px}.chat-avatar{width:28px;height:28px}.chat-avatar-left{margin-right:8px}.chat-avatar-right{margin-left:8px}.chat-card-container{min-width:0}.chat-card .choice,.chat-message-text{font-size:12px}.chat-bubble-container.chat-left.chat-no-avatar .chat-bubble{margin-left:36px}}.ul-card-vertical__button-wrapper{align-items:end}.ul-card-skip__button{padding:0 16px}.chat-card-container:has(.ul-card__matrix),.chat-card-container:has([class*=matrix]){min-width:600px;max-width:900px}.chat-card-container .ul-card--matrix_container{max-width:100%;overflow-x:auto}.chat-card-container .ul-card--matrix_grid{min-width:100%}@media (max-width: 768px){.sprig-header-label-container,.sprig-header-label,.choice{font-size:12px}.chat-card-container:has(.ul-card__matrix),.chat-card-container:has([class*=matrix]){min-width:0;max-width:100%;width:100%}.chat-card-container .ul-card--matrix_container{overflow-x:auto;-webkit-overflow-scrolling:touch}}.select-label{cursor:pointer;flex:1;overflow-wrap:anywhere;text-align:start}@media (max-width: 768px){.ul-conversational-ui .nps-number{font-size:12px;height:35px}.ul-conversational-ui .ul-card--nps__labels{font-size:12px}}.ul-card-rank__option{text-align:left}@media (max-width: 768px){.ul-card--rank__question-inner-container,.ul-card-rank__labels{font-size:12px}.ul-card-rank__option>span{font-size:12px}.ul-card-rank__option>select{font-size:12px}}.select-button{align-items:center;background-color:transparent;border-radius:8px;border:1px solid #0b2330;box-shadow:0 0 0 2px #c8cccc;cursor:pointer;display:flex;font-size:15px;justify-content:space-between;margin-bottom:8px;padding:4px 8px 4px 16px;width:100%}.select-button:hover{background-color:#f3f3f3}.select-button:active{background-color:#eee}.select-button span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select-button.select-button-placeholder{color:#b0b5b7}.select-button svg{flex-shrink:0}.select-list{position:relative;height:fit-content;padding:4px 0;z-index:100;background-color:#fff;border:1px solid #E2E3E1;box-shadow:0 16px 24px #0b23300d,0 4px 12px #0b233008;border-radius:8px;overflow-y:scroll;width:100%}.select-option{align-items:center;cursor:pointer;display:flex;font-size:15px;gap:16px;line-height:20px;padding:8px 16px}.select-option:hover{background-color:#f3f3f3}.ul-card-text{margin-top:2px;margin-bottom:3px;display:flex;flex-direction:column;justify-content:center;padding:0;width:100%}.ul-card-text__container{align-items:center;box-sizing:border-box;border-radius:3px;display:flex;justify-content:center;margin-bottom:12px;flex:1 0 100%}.ul-card-text__input--mobile{border:2px solid #e6e6e6;max-height:63px}.ul-card-text__input--desktop{border:1px solid #e6e6e6;max-height:150px}.ul-card-text__input{background:#fff;box-sizing:border-box;color:#343442;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;min-height:63px;overflow:auto;padding:8px;resize:none;width:100%;border-radius:3px;line-height:20px;overflow-wrap:break-word}.ul-card-text__input::placeholder{color:#6c6c6e80}.ul-card-text__input:focus{outline:none;background:#fff}.ul-card-text__input--desktop:hover:not(:focus){background-color:#fff}@media (max-width: 768px){.ul-card-text__input{font-size:12px}}.ul-card__text-url-prompt .sprig-question-body{padding:0}.ul-card__text-url-prompt .ul-card-button-group{padding:10px}@keyframes flashingDot{0%{background-color:#262136}50%,to{background-color:#f8f9fa}}.thinking-dots-container{display:flex;justify-content:center;align-items:flex-end;position:relative;width:18px;margin-top:.5em}.thinking-dot{position:relative;width:3px;height:3px;border-radius:5px;background-color:#262136;color:#262136;animation:flashingDot 1s infinite linear alternate;animation-delay:.5s}.thinking-dot:before,.thinking-dot:after{content:"";display:inline-block;position:absolute;top:0;width:3px;height:3px;border-radius:5px;background-color:#262136;color:#262136;animation:flashingDot 1s infinite alternate}.thinking-dot:before{left:-5px;animation-delay:0s}.thinking-dot:after{left:5px;animation-delay:1s}[id^=ul-card-video__player_recorder],[id^=ul-card-video__question_player]{width:100%;width:-moz-available;width:-webkit-fill-available;width:fill-available}.answered-card [id^=ul-card-video__player_recorder] .ul-control-panel{display:none!important}';
|
|
2
|
+
export {
|
|
3
|
+
t as default
|
|
4
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./view-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./view-rFRtvibL.cjs"),Y=require("./index-D2QLhKHZ.cjs"),E=require("./getAttributedUrl-WX6TIqnY.cjs"),re="https://cdn.sprig.com",_={document:void 0,videojs:void 0},xe=n=>n+"-loading-spiner",Z="hidden",je=".m3u8",me="questionId",ve="ul-video-recorder-camera-off-button",ge="ul-recording-in-session",Ye=[{type:"link",content:`${re}/dependencies/videojs-record-4.5.0.min.css`},{type:"script",content:`${re}/dependencies/RecordRTC-5.6.2.js`},{type:"script",content:`${re}/dependencies/adapter.8.0.0.min.js`},{type:"script",content:`${re}/dependencies/videojs-record-4.5.0.min.js`},{type:"script",content:`${re}/userleap-web-upchunk-v2.2.2.js`}],Le=[{type:"link",content:`${re}/dependencies/video-js-7.18.0.min.css`},{type:"script",content:`${re}/dependencies/video-js-7.18.0.min.js`},{type:"style",content:`/* progress control styles */
|
|
2
2
|
.video-js .vjs-control {
|
|
3
3
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
|
|
4
4
|
}
|
|
@@ -655,4 +655,4 @@ span.ul-button-text {
|
|
|
655
655
|
.vjs-poster {
|
|
656
656
|
background-size: cover;
|
|
657
657
|
}
|
|
658
|
-
`}],Me="-video-player",Te="-secondary-video-player",_e="-video-recorder";let X,Ie;const te=async({event:n,apiBase:o,headers:t,visitorId:r,envId:i,metadata:s})=>{const d=T.document.documentElement;if(!r||!i)return;const u={event:`SDK - ${n}`,visitorId:r,environmentId:i,metadata:{...s||{},screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:d.clientWidth,clientHeight:d.clientHeight,location:window.location.href,language:navigator.language}};(await fetch(`${o}/sdk/1/visitors/${r}/analytics`,{method:"POST",cache:"no-cache",headers:t,body:JSON.stringify(u)})).ok||console.warn("[Sprig] (ERR-444) Failed to track analytics",n)},ne=async(n,o,t,r,i,s)=>{te({event:`Video Error ${o}`,apiBase:t,headers:r,visitorId:i,envId:s,metadata:{errorMessage:n.message}});const d=T.document.documentElement,u={screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:d.clientWidth,clientHeight:d.clientHeight,location:window.location.href,language:navigator.language},a={action:o,err:{message:n.message,stack:n.stack},meta:u,vid:i,envId:s};(await fetch(`${t}/sdk/1/errors`,{method:"POST",cache:"no-cache",headers:{...r,"userleap-platform":"video_recorder","x-ul-error":window.btoa(`userleap-${Date.now()}-error`)},body:JSON.stringify(a)})).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",n)},Ne=(n,o)=>{if(n.length===0)return o&&o();Promise.all(n.reduce((t,r)=>(t.push(((i,{type:s,content:d})=>new Promise(function(u,a){let m;s==="script"?(m=T.document.createElement("script"),m.src=d):s==="link"?(m=T.document.createElement("link"),m.rel="stylesheet",m.href=d,m.type="text/css"):(m=T.document.createElement("style"),m.innerHTML=d),m.onload=function(){u(d)},m.onerror=function(){a(d)},m.async=!1,m.id=btoa(d),i.appendChild(m)}))(T.document.head,r)),t),[])).then(()=>{T.videojs=T.document.defaultView.videojs,o&&o()}).catch(function(t){console.log(t+" failed to load")})},De=(n,o,t)=>{if(o==="start"&&(n.style.visibility="visible"),o==="none")n.style.visibility=Z;else if(o==="success")n.style.visibility=Z,n.innerHTML="Upload succeeded!";else{const r=Math.round(parseFloat(t));n.innerHTML=`Uploading <span class="ul-upload-progress-label__time">${r}%</span>`,n.style.background=`linear-gradient(to right, #E0E0EB 0%, #E0E0EB ${r}%, #FCFCFD ${r}%, #FCFCFD 100%)`}},he=(n,o)=>{const t=T.videojs(n.id());return t==null?void 0:t.payload[o]},Oe=(n,o)=>{const t=new(T.videojs.getComponent("Component"))(n);return t.addClass("ul-buttons-panel"),o.map(r=>{t.addChild(r)}),Ke(t),t},Ke=n=>{n.children().forEach(o=>{if(K[o.name_]){const t=le(K[o.name_],`ul-${K[o.name_]}`);o.el_.appendChild(t)}})},le=(n,o="")=>{const t=T.document.createElement("span");return t.className="ul-button-text",t.innerHTML=n,t.id=o,t},qe=(n,o,t,r,i=!1,s)=>{n.addClass("ul-video-player");const d=new(T.videojs.getComponent("Component"))(n);d.addClass("ul-control-panel"),n.progressBar=d.addChild("ProgressControl"),t&&n.src(t),n.audioPlayerPlaceholder=new(T.videojs.getComponent("Component"))(n),n.audioPlayerPlaceholder.addClass("ul-audio-recorder-placeholder");const u=t&&t.src?nn(t.src):null;!t||!i&&u?(n.audioPlayerPlaceholder.hide(),T.document.getElementById(`${n.id()}_html5_api`).style.height="100%",u&&n.poster(u)):(n.children()[0].classList.add("vjs-hidden"),T.document.getElementById(`${n.id()}_html5_api`).style.height="0px"),n.on("play",()=>{i||!t||u||Xe(n),s==null||s.play()}),n.on("pause",()=>{s==null||s.pause()}),n.on("seeked",()=>{s==null||s.currentTime(n.currentTime())}),n.on("ratechange",()=>{s==null||s.playbackRate(n.playbackRate())}),n.addChild(n.audioPlayerPlaceholder,{},1),d.addChild(o),n.addChild(d),r&&r(n)},Je=(n,o,t,r,i,s,d,u=!1)=>{Ie=Date.now();const a=de(o,{controls:!1,bigPlayButton:!1,fluid:!1,width:1280,height:720,playsinline:!0,plugins:{record:{audio:!0,video:{mandatory:{minWidth:1280,minHeight:720}},frameWidth:1280,frameHeight:720,maxLength:600,autoMuteDevice:!0}}});if(!a)return;a.payload=t;const{surveyId:m,questionId:y,responseGroupUid:c,visitorId:g,envId:k}=t;let C;const h=l=>{const p=ve,x=ve+"-audio-only";De(a.uploadProgressLabel,"none"),X&&X.startTime>=Ie&&X.abort();const B=T.document.getElementById("ul-camera-button");l?(a.children()[0].classList.add("vjs-hidden"),L.removeClass(p),L.addClass(x),B.innerHTML=K.TurnOnCamera,a.audioPlayerPlaceholder.removeClass("vjs-hidden"),C==null||C.getTracks().forEach(_=>{_.stop()}),window.navigator.mediaDevices.getUserMedia({video:!0,audio:!0}).then(_=>{C=_,_.getVideoTracks().forEach(N=>{N.enabled=!1}),a.record().onDeviceReady(_)}).catch(a.record().onDeviceError.bind(a.record()))):(C==null||C.getVideoTracks().forEach(_=>{_.enabled=!0}),a.children()[0].classList.remove("vjs-hidden"),a.record().getDevice(),L.removeClass(x),L.addClass(p),B.innerHTML=K.TurnOffCamera,a.audioPlayerPlaceholder.addClass("vjs-hidden"))},f=new(T.videojs.getComponent("Button"))(a,{clickHandler:()=>{f.hasClass(Z)||(te({event:"Video Delete Button Clicked",apiBase:r,headers:d,visitorId:g,envId:k,metadata:{questionId:y,responseGroupUid:c,surveyId:m}}),h(a.cameraOff),i(P.DELETE,{}),L.removeClass(Z),f.addClass(Z))}});f.addClass("ul-video-recorder-delete-button"),f.el_.appendChild(le(K.DeleteButton,"ul-delete-button"));const D=T.document.getElementById(o),M=()=>{D.classList.contains("vjs-fullscreen")&&a.cameraOff?D.style.display="table":D.style.display="flex"};M();const L=new(T.videojs.getComponent("Button"))(a,{clickHandler:()=>{a.record().isRecording()||(a.cameraOff=!a.cameraOff,te({event:"Video Camera Button Clicked",apiBase:r,headers:d,visitorId:t.visitorId,envId:t.envId,metadata:{questionId:y,responseGroupUid:c,surveyId:m,cameraOff:a.cameraOff}}),h(a.cameraOff),!f.hasClass(Z)&&f.addClass(Z),i(P.DELETE,{}),M())}});L.addClass(ve),L.el_.appendChild(le(K.TurnOffCamera,"ul-camera-button"));const I=new(T.videojs.getComponent("Button"))(a,{clickHandler:()=>{const l=T.document.getElementById("ul-recorder-toggle");if(a.record().isRecording())a.record().stop(),l&&(l.innerHTML=K.RecordButton),I.removeClass(ge),f.removeClass(Z);else{const p=T.document.getElementById("ul-recording-countdown-screen");if(p)p.remove(),l&&(l.innerHTML=K.RecordButton),h(a.cameraOff),i(P.DELETE,{}),L.removeClass(Z),f.addClass(Z),I.removeClass(ge),v.show();else{I.addClass(ge),v.hide(),L.addClass(Z),f.addClass(Z),l&&(l.innerHTML=K.StopButton);const x=T.document.createElement("div");x.id="ul-recording-countdown-screen",D.insertBefore(x,D.children[1]),x.style.height=`${D.offsetHeight}px`,Ue(a,3)}}}});I.addClass("ul-video-recorder-toggle-button"),I.el_.appendChild(le(K.RecordButton,"ul-recorder-toggle"));const $=T.document.createElement("p");$.style.visibility="hidden",$.className="ul-upload-progress-label",n.appendChild($),a.uploadProgressLabel=$;const A=Oe(a,[f,L,"PlayToggle",I,"FullscreenToggle"]),v=A.children().find(l=>l.name_==="FullscreenToggle");v.hasClass("vjs-disabled")&&v.hide();const b=A.children().find(l=>l.name_==="PlayToggle");b.hide(),f.addClass(Z),qe(a,A,s,!1,u),a.on("stopRecord",()=>{I.hide(),b.show(),v.show(),f.removeClass(Z)}),a.on("deviceReady",()=>{I.show(),b.hide(),f.addClass(Z)}),((l,p,x,B,_)=>{const{surveyId:N,responseGroupUid:H,visitorId:U,envId:q}=l.payload;l.on("deviceError",function(){console.warn("device error: ",l.deviceErrorCode),l.deviceErrorCode.message==="Permission denied"?(l.deviceButton.addClass("permission-denied"),x&&x(P.ERROR,{type:P.PERMISSION_DENIED}),te({event:"Video Permission Denied",apiBase:p,headers:_,visitorId:U,envId:q,metadata:{questionId:he(l,me),responseGroupUid:H,surveyId:N}})):(x&&x(P.ERROR,{type:P.OTHER}),ne(new Error(l.deviceErrorCode.message),"recorderDeviceError",p,_,U,q))}),l.on("error",function(Q,G){ne(G||l.error(),"recorderError",p,_,U,q)}),l.on("startRecord",function(Q,G){B(l.uploadProgressLabel,"none"),te({event:"Video Record Start",apiBase:p,headers:_,visitorId:U,envId:q,metadata:{questionId:he(l,me),responseGroupUid:H,surveyId:N}})}),l.on("finishRecord",async function(){B(l.uploadProgressLabel,"start",0);const Q=he(l,me);if(!N){const S="internal error: missing fields in payload";return x&&x(P.ERROR,{type:P.OTHER}),ne(new Error(S),"finishRecord",p,_,U,q),null}l.record().stopDevice();const G=l.cameraOff?P.MEDIA_TYPE_AUDIO:P.MEDIA_TYPE_VIDEO,J=W.v4();te({event:"Video Record Finish",apiBase:p,headers:_,visitorId:U,envId:q,metadata:{mediaRecordingUid:J,questionId:Q,responseGroupUid:H,surveyId:N,mediaType:G}});const ie={surveyId:N,updatedAt:new Date().toISOString(),mediaType:G,mediaRecordingUid:J};Q&&(ie.questionId=Q),H&&(ie.responseGroupUid=H),U&&(ie.visitorId=U);const j=await(async()=>{const S=await fetch(`${p}/2/environments/integrations/upload`,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(ie)});if(S.ok){const O=await S.json();return x&&x(P.UPLOAD_STARTED,{[P.UPLOAD_ID]:O.upload.id,[P.MEDIA_TYPE]:G,[P.MEDIA_RECORDING_UID]:J}),O.upload.url}return x&&x(P.ERROR,{type:P.OTHER,response:S}),ne(new Error("failed to get upload response with url"),"finishRecord",p,_,U,q),null})();j&&(X=T.document.defaultView.UpChunk.createUpload({endpoint:j,file:new T.document.defaultView.File([l.recordedData],`recording ${G} ${Date.now()}`),chunkSize:5120}),X.startTime=Date.now(),te({event:"Video Upload Start",apiBase:p,headers:_,visitorId:U,envId:q,metadata:{mediaRecordingUid:J,questionId:Q,responseGroupUid:H,surveyId:N,mediaType:G,url:j}}),X.on("error",S=>{B(l.uploadProgressLabel,"none"),x&&x(P.UPLOAD_FINISHED,{[P.MEDIA_RECORDING_UID]:J}),ne(S,"finishRecord",p,_,U,q)}),X.on("progress",S=>{x&&x(P.UPLOAD_PROGRESS,{[P.MEDIA_RECORDING_UID]:J,[P.UPLOAD_PROGRESS_PCT]:S.detail}),B(l.uploadProgressLabel,"progress",S.detail)}),X.on("success",()=>{B(l.uploadProgressLabel,"success"),x&&x(P.UPLOAD_FINISHED,{[P.MEDIA_RECORDING_UID]:J}),te({event:"Video Upload Success",apiBase:p,headers:_,visitorId:U,envId:q,metadata:{mediaRecordingUid:J,questionId:Q,responseGroupUid:H,surveyId:N,mediaType:G,url:j,elapsedMs:X.startTime&&Date.now()-X.startTime}})}))})})(a,r,i,De,d);const w=[{name:"microphone"}];!a.cameraOff&&w.push({name:"camera"}),Promise.all(w.map(l=>{var p;return(p=navigator==null?void 0:navigator.permissions)==null?void 0:p.query(l)})).then(l=>{l.reduce((p,x)=>p&x.state==="granted",!0)&&a&&(a.deviceButton&&a.deviceButton.hide(),a.record().getDevice())}).catch(l=>{})},Ue=(n,o=3)=>{const t=T.document.getElementById("ul-recording-countdown-screen");t&&o===0?(t.remove(),n.record().start()):t&&(t.innerHTML=`<span class='ul-countdown-text'>Recording in... ${o}</span>`,setTimeout(()=>{Ue(n,o-1)},1e3))},Ae=n=>{const o=T.document.createElement("div");return o.className="ul-video-container",o.appendChild((t=>{const r=T.document.createElement("div");return r.className="ul-video-player-loading",r.id=xe(t),["first","second","third","fourth"].map(i=>{const s=T.document.createElement("div");s.className=i,r.appendChild(s)}),r})(n)),o},be=(n,o)=>{const t=T.document.createElement("video");t.id=n,t.className="video-js vjs-default-skin ul-video-player-video";const r=T.document.createElement("p");r.className="vjs-no-js",r.innerHTML="To view this video please enable JavaScript, and consider upgrading to a web browser that";const i=T.document.createElement("a");return i.href="https://videojs.com/html5-video-support/",i.target="_blank",i.innerHTML="supports HTML5 video",r.appendChild(i),t.appendChild(r),o.appendChild(t),o},Xe=(n,o)=>{n.children()[0].classList.remove("vjs-hidden"),n.audioPlayerPlaceholder.hide(),T.document.getElementById(`${n.id()}_html5_api`).style.height="100%"},de=(n,o)=>T.document.getElementById(n)?o?T.videojs(n,o):T.videojs(n):(console.error(`Error in finding player element with ID, ${n}`),null),en=(n,o,t,r=!1,i="https://api.sprig.com",s=document,d=null,u=null)=>{T.document=s;const a=n+Me,m=Ae(a);return T.document.addEventListener("securitypolicyviolation",y=>{ne(new Error(`Voice & Video feature violates ${y.violatedDirective} web page CSP policies for the question player.`),"playerDeviceError",i,{})}),Ne(Le,()=>{T.document.getElementById(xe(a)).remove(),be(a,m);const y={playsinline:!0,playbackRates:[.5,1,1.5,2],fill:!0};try{const c=n+Te;be(c,m);const g=de(a,y),k=de(c,{muted:!0,...y});if(!g||!k)return;((f,D,M)=>{f.addClass(`ul${Te}`);const L=new(T.videojs.getComponent("Component"))(f);D&&f.src(D),f.addChild(L),M&&M(f)})(k,d,u),d||k.addClass(Z);const C=Oe(g,["PlaybackRateMenuButton","PlayToggle","FullscreenToggle"]),h=C.children().find(f=>f.name_==="FullscreenToggle");h.hasClass("vjs-disabled")&&h.hide(),qe(g,C,o,t,r,k)}catch(c){return void ne(new Error(`Error when creating video player object ${c}`),"playerDeviceError",i,{})}}),m},nn=n=>{if(!n)return null;const o=n.match(/https:\/\/stream.mux.com\/(.*)/);let t=o?o[1]:null;return t.includes(je)&&(t=t.replace(je,"")),t?`https://image.mux.com/${t}/thumbnail.jpg?time=0`:null},P={UPLOAD_STARTED:"upload.started",UPLOAD_PROGRESS:"upload.progress",UPLOAD_FINISHED:"upload.finished",DELETE:"delete",ERROR:"error",MEDIA_TYPE:"media.type",PERMISSION_DENIED:"permission_denied",OTHER:"other",UPLOAD_ID:"upload.id",UPLOAD_PROGRESS_PCT:"upload.progress.pct",MEDIA_RECORDING_UID:"media.recording.uid",MEDIA_TYPE_VIDEO:"video",MEDIA_TYPE_AUDIO:"audio"},K={PlaybackRateMenuButton:"Speed",PlayToggle:"Play",FullscreenToggle:"Expand",TurnOnCamera:"Turn on",TurnOffCamera:"Turn off",DeleteButton:"Delete",RecordButton:"Record",StopButton:"Stop",PauseButton:"Pause"},tn=({properties:n,surveyVideoUrl:o,questionId:t})=>{const r=`ul-card-video__question_player-q${t}`,{apiURL:i,viewDocument:s}=e.useConfig(d=>({apiURL:d.apiURL,viewDocument:d.viewDocument}));return e.u("div",{id:r,ref:d=>{if(d&&d.children.length===0&&!n.properties.hideRecordedPrompt){const u=en(r,{src:o,type:"application/x-mpegURL"},void 0,n.properties.mediaType===P.MEDIA_TYPE_AUDIO,i,s);d.appendChild(u)}}})},oe=({isDisabled:n,onClick:o,children:t})=>e.u(E.Button,{className:"ul-card__button-checkmark",disabled:n,onClick:o,type:"button",children:[e.u("svg",{fill:"none",height:"10",viewBox:"0 0 13 10",width:"13",xmlns:"http://www.w3.org/2000/svg",children:e.u("path",{d:"M11.5 1.5L4.5 8.5L1 5",stroke:"#ffffff",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})}),t||"Ok"]}),rn=({className:n,next:o,properties:t,questionId:r,type:i})=>{const{useMobileStyling:s,border:d}=e.useConfig(I=>({useMobileStyling:I.useMobileStyling,border:I.border})),[u,a]=e.h(!1),[m,y]=e.h(""),[c,g]=e.h(!1),k=t==null?void 0:t.collectName,C=(t==null?void 0:t.nameLabelText)||"Full Name",h=(t==null?void 0:t.consentText)||"I agree to the stated conditions",f=(t==null?void 0:t.submitButtonText)||"Submit",D=!!m.trim(),M=u&&(!k||D),L=(I,$=!1)=>{I.preventDefault(),I.stopPropagation();let A=null;if(!$){if(!M)return void g(!0);A={submitted:!0},k&&(A.name=m)}o({value:A,questionId:r,type:i},!!$||M)};return e.u("div",{className:e.cc(n,"ul-card__consent-legal","fade-in-transition"),children:e.u(E.MobileEmbedView,{embeddedType:"pdf",properties:t,children:e.u(E.QuestionBodyFooterContainer,{children:[e.u("div",{className:"sprig-stretch",children:[e.u(E.Option,{allowTextEntry:!1,border:d,error:c&&!u,id:"consent",isRadio:!1,isSelected:u,label:h,onUserInputChanged:({selected:I})=>{I!==u&&a(!u)},useMobileStyling:s}),k&&e.u("input",{"aria-label":C,"aria-placeholder":C,className:e.cc(e.getClasses("ul-consent-legal__name-input",s)),"data-gramm":"false",maxLength:250,name:"name",onBlur:I=>{I.currentTarget.style.borderColor=c&&!D?W.ERROR_BORDER_COLOR:W.DEFAULT_BORDER_COLOR},onFocus:I=>{I.currentTarget.style.borderColor=c&&!D?W.ERROR_BORDER_COLOR:d},onInput:I=>{I.preventDefault(),I.stopPropagation(),y(I.currentTarget.value)},placeholder:C,style:c&&!D?{borderColor:W.ERROR_BORDER_COLOR}:{},tabIndex:0,value:m})]}),e.u("div",{className:"ul-card__button-wrapper ul-card-vertical__button-wrapper",children:[e.u(oe,{isDisabled:!M,onClick:I=>L(new SubmitEvent(I.type)),children:e.getButtonText({buttonText:f})}),t.required===!1&&e.u("button",{className:"ul-card-skip__button",onClick:I=>L(new SubmitEvent(I.type),!0),children:e.getSkipButtonText(t)})]})]})})},r)},on=()=>{const{destroy:n,forceBrandedLogo:o}=e.useConfig(t=>({destroy:t.destroy,forceBrandedLogo:t.forceBrandedLogo}));return e.p(()=>{setTimeout(()=>{n(W.APP_ID)},o?4e3:2e3)},[n,o]),e.u("div",{className:"end-of-survey-text",children:"End of survey"})},sn=({activeValue:n,border:o,icon:t,enableCspTrustedTypes:r,isPressed:i,range:s,scaleLabelType:d,selectedValue:u,setSelectedValue:a,setActiveValue:m,setIsPressed:y,useMobileStyling:c,value:g,viewDocument:k})=>{const C=`option-${g}`,h=d==="number",f=d==="star",D=d==="smiley",M=h&&g===n||g===u,[L,I]=(()=>{const v=f&&u!==null&&g<=u;return f&&g<=n||D&&g===n||v||g===n||g===u?[o,i||v||g===u?1:.3]:["",1]})(),$=e.F(()=>{const v={borderColor:M?L:"",fillOpacity:M?"":I,zIndex:M?3:"auto",color:u===g?"#fff":""};return h?{...v,backgroundColor:u===g?L:""}:{...v,color:f||D||u===g?L:""}},[M,L,I,u,g,h,f,D]),A=e.F(()=>W.getHtml((({icon:v,scaleLabelType:b,value:w,selectedValue:l})=>{if(b==="smiley"&&w===l){let p=0;return v.replace(/black/g,()=>++p==1?"black":"white")}return v})({icon:t,scaleLabelType:d,value:g,selectedValue:u}),r),[r,t,d,u,g]);return e.u("button",{"aria-label":h?void 0:String(g),className:(()=>{switch(d){case"star":return e.cc(e.getClasses("likert-star",c),e.getClasses(`likert-star-${g}`,c));case"smiley":return e.cc(e.getClasses("likert-smiley",c),e.getClasses(`likert-smiley-${g}`,c));default:return g===s?e.cc(e.getClasses("likert-number",c),e.getClasses(`likert-number-${g}`,c),e.getClasses("likert-last-option",c)):e.cc(e.getClasses("likert-number",c),e.getClasses(`likert-number-${g}`,c))}})(),dangerouslySetInnerHTML:{__html:A},id:C,onClick:v=>{v.preventDefault(),v.stopPropagation(),a(g)},onKeyDown:v=>{var l,p;const b=k.querySelectorAll(`.likert-${d??"number"}`),w=g-1;v.key==="ArrowRight"?(l=b[w+1])==null||l.focus():v.key==="ArrowLeft"?(p=b[w-1])==null||p.focus():v.key!=="Enter"&&v.key!==" "||(v.preventDefault(),v.stopPropagation(),a(g))},onPointerDown:()=>y(!0),onPointerEnter:()=>m(g),onPointerLeave:()=>{m(-1),y(!1)},style:$,tabIndex:0})},an=({className:n,labels:o,next:t,properties:r,questionId:i,type:s})=>{const{border:d,useMobileStyling:u,viewDocument:a,enableCspTrustedTypes:m}=e.useConfig(b=>({border:b.border,useMobileStyling:b.useMobileStyling,viewDocument:b.viewDocument,enableCspTrustedTypes:b.enableCspTrustedTypes})),[y,c]=e.h(-1),[g,k]=e.h(!1),[C,h]=e.h(null),f=o&&o.left,D=o&&o.right;let M;const{range:L,scaleLabelType:I,ratingIcons:$}=r;L&&(M=Number(L));const A=M||5,v=b=>{var w,l;switch(I){case"star":return(w=$[0])==null?void 0:w.svg;case"smiley":return(l=$[b])==null?void 0:l.svg;default:return String(b+1)}};return e.u("form",{className:e.cc(n,"ul-card--likert","fade-in-transition"),children:e.u(E.MobileEmbedView,{properties:r,children:[e.u(E.QuestionBodyWrapper,{children:[e.u("div",{"aria-label":`Rating (1 - ${A})`,className:"ul-card--likert__numbers",role:"radiogroup",children:[...Array(A)].map((b,w)=>{const l=w+1;return e.u(sn,{activeValue:y,border:d,enableCspTrustedTypes:m,icon:v(w),isPressed:g,range:A,scaleLabelType:I,selectedValue:C,setActiveValue:c,setIsPressed:k,setSelectedValue:h,useMobileStyling:u,value:l,viewDocument:a},w)})}),e.u("div",{className:"ul-card--likert__labels",children:[e.u("span",{children:f}),e.u("span",{children:D})]})]}),e.u(E.QuestionBodyFooterContainer,{children:e.u(oe,{isDisabled:C===null&&r.required,onClick:()=>t({value:C,questionId:i,type:s},!0),children:e.getButtonText(r)})})]})},i)},ln=({columns:n,onSelect:o,options:t,selectedOptions:r})=>{const i=e._([]),{border:s,useMobileStyling:d}=e.useConfig(g=>({border:g.border,useMobileStyling:g.useMobileStyling})),u=t.findIndex(g=>r[g.id]===null),[a,m]=e.h(u),y=e.T((g,k)=>{o(g,k);const C=a+1,h=t[C];h&&r[h.id]===null&&m(C)},[o,t,r,a]),c=e.T((g,k)=>{const C=a===g;return e.u(e.Accordion,{animate:!0,header:k.label,isOpen:C,onClick:()=>{var h;return m(C&&!((h=window.UserLeap)!=null&&h.isMobileSDK)?-1:g)},ref:h=>{h&&(i.current[g]=h)},showHeaderCheck:r[k.id]!==null,children:e.u("div",{style:{paddingTop:"12px"},children:n.map(h=>e.u(E.Option,{allowTextEntry:!1,ariaLabel:`${k.label}-${h.label}`,border:s,error:!1,id:`${k.id}-${h.value}`,isRadio:!0,isSelected:r[k.id]===h.value,label:h.label,onUserInputChanged:()=>y(k.id,h.value),useMobileStyling:d},h.label))})},k.id)},[s,n,a,y,r,d]);return e.u("div",{children:t.map((g,k)=>c(k,g))})},dn=({className:n,next:o,options:t,properties:r,questionId:i,type:s,onSubmitButtonClick:d})=>{const u=r.matrixColumn,a=r.required,m=C=>{C.preventDefault(),C.stopPropagation(),o({value:c,questionId:i,type:s},!0),d&&d()},y=t.reduce((C,h)=>(C[h.id]=null,C),{}),[c,g]=e.h(y);return e.u("form",{className:e.cc(n,"ul-card__matrix","fade-in-transition"),id:"text-form",onSubmit:m,children:e.u(E.MobileEmbedView,{properties:r,children:[e.u(E.QuestionBodyWrapper,{children:e.u(ln,{columns:u,onSelect:(C,h)=>{g(f=>({...f,[C]:h}))},options:t,selectedOptions:c})}),e.u(E.QuestionBodyFooterContainer,{children:e.u(oe,{isDisabled:(k=c,a&&Object.values(k).every(C=>C==null)),onClick:()=>m(new SubmitEvent("submit")),children:e.getButtonText(r)})})]})},i);var k},He=({className:n,onSubmit:o,options:t=[],properties:r,questionId:i,type:s,showIndividualSubmit:d=!1,onSubmitButtonClick:u})=>{const{border:a,useMobileStyling:m}=e.useConfig(l=>({border:l.border,useMobileStyling:l.useMobileStyling})),y=t.reduce((l,p)=>(l[p.id]={isSelected:!1},l),{}),[c,g]=e.h(y),k=s==="multiplechoice",C=r.required,h=t.find(l=>{var p;return(p=l.optionProperties)==null?void 0:p.noneOfTheAbove}),f=l=>Object.entries(l).some(([p,x])=>{var N;const B=t.find(H=>`${H.id}`===p),_=x.userText===void 0||x.userText.trim()==="";return((N=B==null?void 0:B.optionProperties)==null?void 0:N.allowsTextEntry)&&_&&x.isSelected}),D=l=>Object.values(l).filter(p=>p.isSelected).length,M=r.minSelect&&r.minSelect>0&&r.maxSelectMode===E.MaxSelectModes.Range&&D(c)<r.minSelect&&(C||D(c)>0),L=l=>f(l)||C&&!D(l)||!(p=>{const{minSelect:x=0,maxSelect:B=1/0,maxSelectMode:_}=r,N=D(p);switch(_){case E.MaxSelectModes.Maximum:return N<=B;case E.MaxSelectModes.Range:return N===0||N>=x;default:return!0}})(l),I=Object.entries(c).some(([l,p])=>{var x,B;return p.isSelected&&((B=(x=t.find(_=>`${_.id}`===l))==null?void 0:x.optionProperties)==null?void 0:B.allowsTextEntry)}),$=d&&(!k||I),A=l=>{w(l.id,l.selected,l.userText,l.noneOfTheAbove)},v=l=>{var p;return(r==null?void 0:r.maxSelectMode)!==E.MaxSelectModes.Unlimited&&D(c)===(r==null?void 0:r.maxSelect)&&!((p=c[l])!=null&&p.isSelected)},b=()=>{o(c,!0),u&&u()},w=(l,p,x,B)=>{const _=Object.assign({},c);if((k||B)&&p)for(const N of Object.values(_))N.isSelected=!1,delete N.userText;else h&&!B&&c[h.id].isSelected&&(_[h.id].isSelected=!1);_[l]={isSelected:p,userText:x},g(_)};return e.u("form",{className:e.cc(n,"ul-card--multiple","fade-in-transition"),id:"text-form",onSubmit:b,children:e.u(E.MobileEmbedView,{properties:r,children:[e.u(E.QuestionBodyWrapper,{children:[r.isDropdown?e.u(E.Select,{disabledOptions:t.filter(l=>v(l.id)),dropdownFooter:M?e.u("div",{className:"ul-card__min-select-counter",style:{marginLeft:"16px"},children:[D(c),"/",r.minSelect]}):void 0,isMultiSelect:!k,multiselectText:r.dropdownMultiselectedText??"choices selected",onChange:l=>{const p={...c};for(const x of t)l.includes(x)?p[x.id].isSelected=!0:p[x.id].isSelected=!1;g(p)},options:t,placeholderText:r.dropdownPlaceholderText??(k?"Select choice":"Select choice(s)"),value:t.filter(l=>c[l.id].isSelected)}):e.u("div",{className:e.cc(e.getClasses("ul-card__choices",m)),role:k?"radiogroup":"group",children:[t.map(({id:l,label:p,value:x,optionProperties:B})=>{var q,Q;const _=`${l}`,{allowsTextEntry:N,noneOfTheAbove:H}={allowsTextEntry:!1,noneOfTheAbove:!1,...B};return e.u(E.Option,{allowTextEntry:N,border:a,disabled:v(_),error:(U=c,f(U)),id:_,isRadio:k,isSelected:!!((q=c[_])!=null&&q.isSelected),label:p,noneOfTheAbove:H,onUserInputChanged:A,promptText:"Please specify",text:(Q=c[l])==null?void 0:Q.userText,useMobileStyling:m,value:x},_);var U}),!!M&&e.u("div",{className:"ul-card__min-select-counter",children:[D(c),"/",r.minSelect]})]}),$&&e.u(E.LongformSubmitButton,{handleSubmit:b,isSubmitDisabled:L(c)})]}),e.u(E.QuestionBodyFooterContainer,{children:e.u(oe,{isDisabled:L(c),onClick:b,children:e.getButtonText(r)})})]})},i)},cn=n=>{const{questionId:o,type:t,next:r,options:i}=n;return e.u(He,{...n,onSubmit:(s,d)=>{const u=Object.entries(s).find(([,g])=>g.isSelected)||[void 0,void 0],[a,m]=u,y=i.find(g=>`${g.id}`===a),c=m!=null&&m.userText?{[a]:{userText:m.userText}}:null;r({value:y&&a?{[a]:y.value}:{},secondaryValue:c,questionId:o,type:t},d)}})},un=n=>{const{questionId:o,type:t,next:r}=n;return e.u(He,{...n,onSubmit:(i,s)=>{const d=Object.entries(i).reduce((a,[m,y])=>(a[m]=y.isSelected,a),{}),u=Object.entries(i).reduce((a,[m,y])=>{if(!y.userText)return a;const c=a||{};return c[m]={userText:y.userText},c},null);r({value:d,secondaryValue:u,questionId:o,type:t},s)}})},pn=({className:n,labels:o,properties:t,next:r,questionId:i,type:s})=>{const[d,u]=e.h(null),{border:a,useMobileStyling:m,viewDocument:y}=e.useConfig(k=>({border:k.border,useMobileStyling:k.useMobileStyling,viewDocument:k.viewDocument})),c=o&&o.left,g=o&&o.right;return e.u("form",{className:e.cc(n,"ul-card--nps","fade-in-transition"),children:e.u(E.MobileEmbedView,{properties:t,children:[e.u(E.QuestionBodyWrapper,{children:[e.u("div",{className:"ul-card--nps__numbers",children:[...Array(11)].map((k,C)=>e.u("button",{className:e.cc(e.getClasses("nps-number",m),e.getClasses(`nps-number-${C}`,m)),id:`option-${C}`,onClick:h=>{h.preventDefault(),h.stopPropagation(),u(C)},onKeyDown:h=>{var D,M;const f=y.querySelectorAll("button.nps-number");h.key==="ArrowRight"?(D=f[C+1])==null||D.focus():h.key==="ArrowLeft"?(M=f[C-1])==null||M.focus():h.key!=="Enter"&&h.key!==" "||(h.preventDefault(),h.stopPropagation(),u(C))},onPointerDown:h=>{h.currentTarget.style.zIndex="2",h.currentTarget.style.borderColor=a},onPointerLeave:h=>{h.currentTarget.style.zIndex="auto",h.currentTarget.style.borderColor=W.DEFAULT_BORDER_COLOR},style:d===C?{backgroundColor:a,color:"#fff"}:void 0,tabIndex:0,children:C},C))}),e.u("div",{className:"ul-card--nps__labels",children:[e.u("span",{children:c}),e.u("span",{children:g})]})]}),e.u(E.QuestionBodyFooterContainer,{children:e.u(oe,{isDisabled:d===null&&t.required,onClick:()=>r({value:d,questionId:i,type:s},!0),children:e.getButtonText(t)})})]})},i)},mn=({className:n,next:o,properties:t,questionId:r,type:i,onSubmitButtonClick:s})=>{const{border:d,useMobileStyling:u,update:a}=e.useConfig(f=>({border:f.border,useMobileStyling:f.useMobileStyling,update:f.update})),[m,y]=e.h(""),c=e._(null),g=m.trim(),k=t.required===!0&&!g,C=E.useAutoSize(c,()=>a()),h=t&&t.openTextPlaceholder?t.openTextPlaceholder:"";return e.u("form",{className:e.cc(n,"ul-card-text","fade-in-transition"),id:"text-form",children:e.u(E.MobileEmbedView,{properties:t,children:e.u("div",{className:"ul-card-text",children:[e.u(E.QuestionBodyWrapper,{children:[e.u("div",{className:"ul-card-text__container",children:e.u("textarea",{"aria-describedby":"ul-caption","aria-labelledby":"ul-question","aria-multiline":"true","aria-placeholder":h,className:e.cc(e.getClasses("ul-card-text__input",u)),"data-gramm":"false",maxLength:5e3,name:"text",onBlur:f=>{f.currentTarget.style.borderColor=W.DEFAULT_BORDER_COLOR},onChange:f=>{const{value:D}=f.currentTarget;C(),f.preventDefault(),f.stopPropagation(),y(D)},onFocus:f=>{f.currentTarget.style.borderColor=d},placeholder:h,ref:c,role:"textbox",tabIndex:0})}),t.footerHtml&&e.u(E.Html,{className:"footer",html:t.footerHtml})]}),e.u(E.QuestionBodyFooterContainer,{children:e.u(oe,{isDisabled:k,onClick:f=>{f.preventDefault(),f.stopPropagation();const D=t.required!==!0||g.length>0;o({value:m,questionId:r,type:i},D),s&&s()},children:e.getButtonText(t)})})]})})},r)},vn=({className:n,labels:o,next:t,properties:r,questionId:i,type:s,onSubmitButtonClick:d,options:u})=>{const a=e._(null),m=e._(0),y=e._(0),c=e._(null),g=e._(!1),k=e._([]),[C,h]=e.h(()=>(r==null?void 0:r.required)===!0),[f,D]=e.h(()=>u.map(j=>({...j,rank:null}))),M=e.F(()=>Array.from({length:u.length},(j,S)=>S+1),[u.length]),{useMobileStyling:L,isPreview:I,headers:$}=e.useConfig(j=>({useMobileStyling:j.useMobileStyling,isPreview:j.isPreview,headers:j.headers})),A=($==null?void 0:$["userleap-platform"])==="android",v=L&&!I&&!A,b=!v&&!A,w=(j,S)=>{D(O=>{const R=parseInt(S),F=O.map(V=>({...V}));F.some(V=>V.rank==null)&&F.forEach((V,se)=>V.rank=se+1);const Y=F.findIndex(V=>V.id===j);if(Y===-1)return O;const z=F[Y].rank;return R<z?F.forEach(V=>{V.id!==j&&V.rank>=R&&V.rank<z&&(V.rank=V.rank+1)}):R>z&&F.forEach(V=>{V.id!==j&&V.rank>z&&V.rank<=R&&(V.rank=V.rank-1)}),F[Y].rank=R,F.sort((V,se)=>V.rank-se.rank),H(),F})},l=(j,S)=>{for(let O=0;O<k.current.length;O++){const R=k.current[O];if(!R||R===c.current)continue;const F=R.getBoundingClientRect();if(j>=F.left&&j<=F.right&&S>=F.top&&S<=F.bottom)return{element:R,index:O}}return null},p=j=>S=>{if(!v)return;S.preventDefault(),S.stopPropagation(),g.current=!0,a.current=j;const O=S.touches[0];m.current=O.clientY,y.current=O.clientY;const R=S.currentTarget.closest(".ul-card-rank__option");R&&(c.current=R,R.classList.add("is-dragging"))},x=j=>{if(!v||!g.current||a.current===null)return;j.preventDefault(),j.stopPropagation();const S=j.touches[0];y.current=S.clientY;const O=y.current-m.current;c.current&&(c.current.style.transform=`translateY(${O}px)`,c.current.style.zIndex="1000"),k.current.forEach(F=>{F&&F!==c.current&&F.classList.remove("is-drop-target")});const R=l(S.clientX,S.clientY);R&&R.element.classList.add("is-drop-target")},B=j=>{if(!v||!g.current||a.current===null)return;j.preventDefault(),j.stopPropagation();const S=j.changedTouches[0],O=l(S.clientX,S.clientY);c.current&&(c.current.style.transform="",c.current.style.zIndex="",c.current.classList.remove("is-dragging")),k.current.forEach(R=>{R&&R.classList.remove("is-drop-target")}),O&&O.index!==a.current&&_(a.current,O.index),a.current=null,c.current=null,g.current=!1},_=(j,S)=>{D(O=>{const R=O.map(Y=>({...Y})),[F]=R.splice(j,1);return R.splice(S,0,F),R.forEach((Y,z)=>{Y.rank=z+1}),H(),R})},N=j=>{const S={};j.reduce((O,R)=>(O[R.id]=R.rank,O),S),t({value:S,questionId:i,type:s},!0)},H=()=>{h(!1)},{left:U,right:q}=o,Q=u.length,G=j=>{j.preventDefault(),j.currentTarget.classList.add("is-drop-target")},J=j=>{j.currentTarget.classList.remove("is-drop-target")},ie=j=>{a.current=null,j.currentTarget.classList.remove("is-dragging")};return e.u("form",{className:e.cc(n,"ul-card-rank","fade-in-transition"),onSubmit:j=>{j.preventDefault(),N(f),d&&d()},children:e.u(E.MobileEmbedView,{properties:r,children:A?e.u(e.g,{children:[e.u(E.QuestionBodyWrapper,{children:e.u("div",{className:"ul-card--rank__question-inner-container",children:[e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:["1 - ",U]})}),e.u("ol",{className:"ul-card-rank__list",children:f.map(({id:j,label:S,rank:O})=>e.u("li",{className:"ul-card-rank__option",children:[e.u("select",{"aria-label":`Rank for ${S}`,className:e.cc("ul-card-rank__select",O==null&&"ul-card-rank__select--placeholder"),name:`rank[${j}]`,onChange:R=>w(j,R.currentTarget.value),value:O??"",children:[O==null&&e.u("option",{className:"ul-card-rank__select-option",disabled:!0,value:"",children:"-"}),M.map(R=>e.u("option",{className:"ul-card-rank__select-option",value:R,children:R},`${R}-${i}`))]}),e.u("span",{children:S})]},j))}),e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:[Q," - ",q]})})]})}),e.u(E.QuestionBodyFooterContainer,{children:e.u("div",{className:"ul-card__button-wrapper",children:e.u(E.Button,{disabled:C,children:e.getButtonText(r)})})})]}):e.u(e.g,{children:[e.u(E.QuestionBodyWrapper,{children:e.u("div",{className:"ul-card--rank__question-inner-container",children:[e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:["1 - ",U]})}),e.u("ol",{className:"ul-card-rank__list",onDragOver:A?void 0:j=>{j.preventDefault(),j.dataTransfer&&(j.dataTransfer.dropEffect="move")},children:f.map(({id:j,label:S,rank:O},R)=>{return e.u("li",{className:"ul-card-rank__option",draggable:!!b||void 0,onDragEnd:b?ie:void 0,onDragEnter:b?G:void 0,onDragLeave:b?J:void 0,onDragStart:b?(Y=R,z=>{a.current=Y,z.dataTransfer&&(z.dataTransfer.effectAllowed="move",z.dataTransfer.setData("text/plain",String(Y)),z.currentTarget.classList.add("is-dragging"))}):void 0,onDrop:b?(F=R,z=>{var se,Ee;z.preventDefault(),z.currentTarget.classList.remove("is-drop-target");const V=a.current;a.current=null,(Ee=(se=z.currentTarget.closest(".ul-card-rank__list"))==null?void 0:se.querySelector(".is-dragging"))==null||Ee.classList.remove("is-dragging"),V!=null&&V!==F&&_(V,F)}):void 0,ref:z=>k.current[R]=z,children:[e.u("select",{"aria-label":`Rank for ${S}`,className:e.cc("ul-card-rank__select",O==null&&"ul-card-rank__select--placeholder"),name:`rank[${j}]`,onChange:z=>w(j,z.currentTarget.value),value:O??"",children:[O==null&&e.u("option",{className:"ul-card-rank__select-option",disabled:!0,value:"",children:"-"}),M.map(z=>e.u("option",{className:"ul-card-rank__select-option",value:z,children:z},z))]}),e.u("span",{children:S}),!A&&e.u("button",{"aria-label":`Drag ${S} to reorder`,className:"ul-card-rank__drag-btn",onTouchEnd:v?B:void 0,onTouchMove:v?x:void 0,onTouchStart:v?p(R):void 0,title:"Drag to reorder",type:"button",children:e.u("svg",{fill:"none",height:"17",viewBox:"0 0 16 17",width:"16",xmlns:"http://www.w3.org/2000/svg",children:e.u("path",{d:"M5.75 11.625C6.37132 11.625 6.875 12.1287 6.875 12.75C6.875 13.3713 6.37132 13.875 5.75 13.875C5.12868 13.875 4.625 13.3713 4.625 12.75C4.625 12.1287 5.12868 11.625 5.75 11.625ZM10.25 11.625C10.8713 11.625 11.375 12.1287 11.375 12.75C11.375 13.3713 10.8713 13.875 10.25 13.875C9.62868 13.875 9.125 13.3713 9.125 12.75C9.125 12.1287 9.62868 11.625 10.25 11.625ZM5.75 7.375C6.37132 7.375 6.875 7.87868 6.875 8.5C6.875 9.12132 6.37132 9.625 5.75 9.625C5.12868 9.625 4.625 9.12132 4.625 8.5C4.625 7.87868 5.12868 7.375 5.75 7.375ZM10.25 7.375C10.8713 7.375 11.375 7.87868 11.375 8.5C11.375 9.12132 10.8713 9.625 10.25 9.625C9.62868 9.625 9.125 9.12132 9.125 8.5C9.125 7.87868 9.62868 7.375 10.25 7.375ZM5.75 3.125C6.37132 3.125 6.875 3.62868 6.875 4.25C6.875 4.87132 6.37132 5.375 5.75 5.375C5.12868 5.375 4.625 4.87132 4.625 4.25C4.625 3.62868 5.12868 3.125 5.75 3.125ZM10.25 3.125C10.8713 3.125 11.375 3.62868 11.375 4.25C11.375 4.87132 10.8713 5.375 10.25 5.375C9.62868 5.375 9.125 4.87132 9.125 4.25C9.125 3.62868 9.62868 3.125 10.25 3.125Z",fill:"currentColor"})})})]},j);var F,Y})}),e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:[Q," - ",q]})})]})}),e.u(E.QuestionBodyFooterContainer,{children:e.u("div",{className:"ul-card__button-wrapper",children:e.u(E.Button,{disabled:C,children:e.getButtonText(r)})})})]})})},i)},fe=1,$e=2,Ve=3,ce=n=>n.type==="av_permission",Se=n=>n.type==="screen_permission",Fe=(n,o)=>n===void 0?fe:n?((t,r)=>!(ce(r)?r.permissionDescriptors:[]).includes("camera")||t.getVideoTracks().length>0)(n,o)?Ve:fe:$e,Re={avStream:null,currentPage:null,mediaRecordingUids:null,nextQuestion:()=>{},passthroughData:void 0,recordingMediaTypes:void 0,screenPermissionRequested:!1,type:void 0},ee=e.create(n=>({...Re,reset:()=>{n(Re)},updatePage:o=>{n(o)}}));function ye({currentPage:n,pages:o}){const{avStream:t,recordingMediaTypes:r,updatePage:i}=ee.getState(),{recorderEventEmitter:s}=e.useConfig.getState();s.emit("av.permission",{"permission.descriptors":n.permissionDescriptors,"stream.ready":(d,u)=>{if(t===d)return;let a=n;if(d&&!n.permissionDescriptors.includes("camera")){const m=o.indexOf(n),y=u!=null&&u.active?m+2:m+1;u!=null&&u.active&&r&&s.emit("begin.recording",{"recording.media.types":r,"start.recording.callback":c=>i({mediaRecordingUids:c})}),a=o[y]}i({currentPage:a,avStream:d})}})}function Ce({status:n}){const{nextQuestion:o,passthroughData:t,mediaRecordingUids:r,reset:i}=ee.getState(),{recorderEventEmitter:s,handleUploadUpdate:d,index:u}=e.useConfig.getState(),a={value:{taskStatus:n},type:"recordedtask",questionId:(t==null?void 0:t.questionId)||1};t&&s.emit("finish.task",{"begin.callback":m=>{d({mediaRecordingUid:m,isSubmitted:!0,progressPct:0,isComplete:!1})},"progress.callback":(m,y)=>{d({mediaRecordingUid:m,progressPct:y.detail,isSubmitted:!1,isComplete:!1})},"upload.callback":m=>{m&&d({mediaRecordingUid:m,isComplete:!0,isSubmitted:!0,progressPct:100})},"passthrough.data":t,"current.index":u,"task.response":a,"task.complete.callback":m=>{a.value.taskDurationMillisecond=m,r&&(a.value.mediaRecordingUids=r),i(),o(a)}})}function ke({pages:n,setIsRequestingPermission:o}){const{recorderEventEmitter:t,eventEmitFn:r}=e.useConfig.getState(),{updatePage:i,currentPage:s,recordingMediaTypes:d,screenPermissionRequested:u}=ee.getState();if(!s)return;const a=n.indexOf(s);switch(s.type){case"av_permission":{const m=u?a+2:a+1;return u&&d&&t.emit("begin.recording",{"recording.media.types":d,"start.recording.callback":y=>{i({mediaRecordingUids:y})}}),void i({currentPage:n[m]})}case"screen_permission":return void t.emit("screen.permission",{"screen.permission.requested":o,"stream.ready.callback":(m,y)=>{const c=y?n[a+1]:s;y&&d&&t.emit("begin.recording",{"recording.media.types":d,"start.recording.callback":g=>{i({captureStream:y,mediaRecordingUids:g})}}),i({currentPage:c,screenPermissionRequested:!0,captureStream:y})}});case"start_task":return r("recorded.task.start"),t.emit("recorded.task.start"),t.emit("start.task"),void i({currentPage:n[a+1],screenPermissionRequested:!0});case"complete_task":return}}const ze="ul-permission-graphics-container",Qe="ul-permission-body",Ge=e.cc(ze,"ul_recorded-task-inset-spacing"),ue=e.cc("ul-horizontal-button-container","ul-horizontal-button-container-left"),Ze=({richTextBody:n})=>e.u(E.Html,{className:"ul-rich-text-body",html:n,id:"ul-task-detail-container"}),pe=({required:n,skipButtonText:o,bottom:t=!1})=>n?null:e.u(E.Button,{className:e.cc(t&&"ul-skip-button-below","ul-button-inactive"),onClick:Ce.bind(null,{status:"abandoned"}),children:o||"Skip"}),we=n=>{const{avStream:o,captureStream:t,recordingMediaTypes:r,updatePage:i}=ee.getState(),s=(r==null?void 0:r.includes("audio"))||(r==null?void 0:r.includes("video"));e.p(()=>{const d=setInterval(()=>{s&&o&&!o.active?i({avStream:null,currentPage:n[0]}):t&&t.active||i({captureStream:void 0,currentPage:n[s?1:0]})},1e3);return()=>clearInterval(d)},[o,t,s,n,r,i])},gn=({content:n,pages:o,required:t})=>{const{buttonText:r,skipButtonText:i,taskDetail:s}=n;return we(o),e.u("div",{className:"ul-task-page",children:[s&&e.u(Ze,{richTextBody:s}),e.u("div",{className:ue,children:[e.u(E.Button,{onClick:ke.bind(null,{pages:o}),children:r}),e.u(pe,{required:t,skipButtonText:i})]})]},"start-task")},hn=({content:n,pages:o,properties:t})=>{const{buttonText:r,skipButtonText:i}=n;return we(o),e.u("div",{className:"ul-task-page",children:[n.taskDetail&&e.u(Ze,{richTextBody:n.taskDetail}),e.u(E.MobileEmbedView,{properties:t,children:e.u("div",{className:ue,children:[e.u(E.Button,{className:"ul-complete-task-button",onClick:Ce.bind(null,{status:"completed"}),children:r}),e.u(E.Button,{className:e.cc("ul-button-inactive"),onClick:Ce.bind(null,{status:"given.up"}),children:i})]})})]},"complete-task")},bn=({content:n,pages:o,required:t})=>{const{buttonText:r,skipButtonText:i}=n,[s]=e.useConfig(a=>[a.tabTitle]),[d,u]=e.h(!1);return e.u("div",{children:[e.u("div",{className:Ge,children:[e.u("p",{style:{marginTop:"auto"},children:n.selectTabText}),e.u("div",{className:"ul-select-tab-container",children:e.u("p",{className:Qe,children:s})})]}),e.u("div",{className:t?"":ue,children:[e.u(E.Button,{disabled:d,onClick:ke.bind(null,{pages:o,setIsRequestingPermission:u}),children:r}),e.u(pe,{required:t,skipButtonText:i})]})]})},fn=({content:n})=>e.u(E.Html,{className:e.cc(ze,"ul_permission_svg_container","ul_recorded-task-inset-spacing","ul-center-horizontally"),html:n.svg},"ul-permission-request-graphic"),yn=({content:n,pages:o,required:t})=>{const{permissionDeniedHeadline:r,permissionDeniedBody:i,skipButtonText:s,tryAgainButtonText:d}=n,u=ce(o[0])?o[0]:null;return e.p(()=>{const a=setInterval(()=>{u!==null&&ye({currentPage:u,pages:o})},1e3);return()=>clearInterval(a)},[u,o]),u?e.u("div",{children:[e.u("div",{className:Ge,children:e.u("p",{className:"ul-av-permission-denied-paragraph",children:[e.u("span",{className:"ul-av-permission-denied-headline",children:r}),e.u("span",{className:Qe,children:i})]})}),e.u("div",{className:ue,children:[e.u(E.Button,{onClick:ye.bind(null,{currentPage:u,pages:o}),children:d}),e.u(pe,{required:t,skipButtonText:s})]})]}):null},Cn=({stream:n})=>e.u("video",{autoPlay:!0,className:e.cc("ul_recorded-task-inset-spacing"),id:"ul-record-task-video-preview",muted:!0,ref:o=>{o&&(o.srcObject=n||null)}}),xn=({content:n,pages:o,required:t})=>{const{skipButtonText:r}=n,{avStream:i}=ee.getState();return we(o),e.u("div",{children:[e.u(Cn,{stream:i}),e.u("div",{className:"ul-vertical-button-container-center",children:[e.u(E.Button,{onClick:ke.bind(null,{pages:o}),children:n.buttonText}),e.u(pe,{bottom:!0,required:t,skipButtonText:r})]})]})},kn=({properties:n})=>{const{pages:o,required:t}=n,{avStream:r,currentPage:i}=ee.getState();if(i===void 0)return null;switch(i==null?void 0:i.type){case"av_permission":{const s=Fe(r,i);return s===fe?e.u(fn,{content:i}):s===$e?e.u(yn,{content:i,pages:o,required:t}):e.u(xn,{content:i,pages:o,required:t})}case"screen_permission":return e.u(bn,{content:i,pages:o,required:t});case"start_task":return e.u(gn,{content:i,pages:o,required:t});case"complete_task":return e.u(hn,{content:i,pages:o,properties:n});default:return null}},wn=({className:n,properties:o,next:t,questionId:r})=>{const i=e.useConfig(),{surveyId:s,responseGroupUid:d,userId:u}=i,a=ee(),{screenPermissionRequested:m}=a,y=ee(h=>h.avStream);let c=ee(h=>h.currentPage);c||(c=function({pages:h,userId:f,responseGroupUid:D,surveyId:M,questionId:L,next:I}){const{updatePage:$}=ee.getState(),{eventEmitFn:A,recorderEventEmitter:v}=e.useConfig.getState(),b={questionId:L,surveyId:M,visitorId:f,responseGroupUid:D};let w=0;v.emit("recorded.task.permission.screen"),A("recorded.task.permission.screen"),v.emit("permission.status",{"permission.status.callback":(p,x,B,_)=>{const N=h[w],{type:H}=N,U=["screen"];if(ce(N)){const{permissionDescriptors:q}=N,Q=q==null?void 0:q.includes("microphone"),G=q==null?void 0:q.includes("camera");Q&&U.push("audio"),G&&U.push("video"),(p!=null&&p.active&&!G||p!=null&&p.active&&x)&&w++}Se(h[w])&&B&&(w++,v.emit("begin.recording",{"recording.media.types":U,"start.recording.callback":q=>$({mediaRecordingUids:q})})),$({currentPage:h[w],avStream:p,screenPermissionRequested:B,nextQuestion:I,type:H,passthroughData:b,recordingMediaTypes:U,captureStream:_})}});const l=h[w];return l.type==="av_permission"&&ye({currentPage:l,pages:h}),l}({questionId:r,surveyId:s,next:h=>{t(h,!0)},pages:o.pages,responseGroupUid:d,userId:u}));let g=c.headline,k=c.captionText;const C=Fe(y,c);return Se(c)&&m&&(g=c.permissionDeniedHeadline,k=c.permissionDeniedCaptionText),ce(c)&&C===Ve&&(g=c.permissionGrantedHeadline,k=c.permissionGrantedCaptionText),e.u("div",{className:e.cc(n,"ul-center-horizontally","fade-in-transition"),children:[e.u(E.Header,{isRequired:o==null?void 0:o.required,message:g,properties:{captionText:k}}),e.u(E.QuestionBodyWrapper,{children:e.u(kn,{properties:o})})]})},En=({className:n,next:o,properties:t,questionId:r,type:i})=>{const{visitorAttributes:s,isLongFormSurvey:d}=e.useConfig(y=>({visitorAttributes:y.visitorAttributes,isLongFormSurvey:W.isLongFormSurvey(y.studyType)})),u=(y,c=!1)=>{o({value:c?{skipped:!0}:void 0,questionId:r,type:i},!0)},a=E.getAttributedUrl(t&&t.buttonUrl,s),m=d&&t.promptActionType===E.PromptActionTypeEnum.NO_BUTTON;return e.u("div",{className:e.cc(n,"ul-card__text-url-prompt","fade-in-transition"),children:e.u(E.MobileEmbedView,{properties:t,children:!m&&e.u("div",{children:e.u("div",{className:"ul-card-button-group",children:[e.u("a",{className:"ul-card-text__button ul-card__text-url-prompt-button",href:a,id:"ul-card-text__button",onClick:u,onKeyPress:y=>{y.key!=="Enter"&&y.key!==" "||o({value:void 0,questionId:r,type:i},!0)},rel:"noreferrer",role:a?"link":"button",tabIndex:0,target:"_blank",children:e.getButtonText(t)}),t.required===!1&&e.u("button",{className:"ul-card-skip__button",onClick:y=>u(0,!0),children:e.getSkipButtonText(t)})]})})})},r)},jn=({className:n,questionId:o})=>{const{border:t,destroy:r,endCard:i,forceBrandedLogo:s}=e.useConfig(a=>({border:a.border,destroy:a.destroy,endCard:a.endCard,forceBrandedLogo:a.forceBrandedLogo}));e.p(()=>{setTimeout(()=>{r(W.APP_ID)},s?4e3:2e3)},[r,s]);const d=i&&i.subheader?e.u("p",{className:"ul-caption",children:i.subheader}):null,u=i&&i.headline?i.headline:"";return e.u("div",{className:e.cc(n,"ul-card--thanks","fade-in-transition"),children:e.u("div",{children:e.u("div",{className:"ul-card--thanks-content",children:[e.u("div",{className:"ul-thanks-check",children:e.u("svg",{"aria-labelledby":"title",fill:"none",height:"99",viewBox:"0 0 81 99",width:"81",xmlns:"http://www.w3.org/2000/svg",children:[e.u("path",{clipRule:"evenodd",d:"M40.5 77C60.9345 77 77.5 60.4345 77.5 40C77.5 19.5655 60.9345 3 40.5 3C20.0655 3 3.5 19.5655 3.5 40C3.5 60.4345 20.0655 77 40.5 77ZM80.5 40C80.5 62.0914 62.5914 80 40.5 80C18.4086 80 0.5 62.0914 0.5 40C0.5 17.9086 18.4086 0 40.5 0C62.5914 0 80.5 17.9086 80.5 40Z",fill:t,fillRule:"evenodd"}),e.u("path",{clipRule:"evenodd",d:"M55.025 22.9046C55.6299 23.4705 55.6616 24.4198 55.0956 25.0247C54.8724 25.2634 54.6109 25.5285 54.3157 25.8277C52.2547 27.9168 48.5549 31.667 44.8135 39.6658C43.2818 42.9406 42.0864 45.8386 41.0823 48.2729C40.6539 49.3116 40.2603 50.2659 39.8902 51.129C39.287 52.5359 38.7248 53.7508 38.1744 54.625C37.8997 55.0613 37.5806 55.4905 37.2017 55.8245C36.8201 56.1607 36.2613 56.5 35.5457 56.5C34.6742 56.5 34.0892 55.9692 33.7774 55.6083C33.4502 55.2296 33.1752 54.7511 32.9396 54.301C32.7305 53.9013 32.5088 53.4367 32.2797 52.9565C32.2429 52.8794 32.2059 52.8019 32.1688 52.7243C31.8942 52.1499 31.5959 51.534 31.2537 50.8868C29.8886 48.305 27.8539 45.2878 24.2343 43.1382C23.522 42.7152 23.2875 41.7949 23.7105 41.0826C24.1335 40.3703 25.0539 40.1358 25.7662 40.5588C30.0556 43.1062 32.4149 46.6647 33.9058 49.4845C34.2776 50.1876 34.5973 50.8487 34.8753 51.4302C34.9147 51.5124 34.9529 51.5926 34.9902 51.6707C35.2222 52.1567 35.4164 52.5637 35.5978 52.9102C35.6151 52.9434 35.6321 52.9754 35.6485 53.0061C36.0565 52.3531 36.5341 51.3434 37.133 49.9468C37.4781 49.1418 37.8572 48.2229 38.2761 47.2074C39.2886 44.7532 40.5339 41.7347 42.0961 38.3948C46.0591 29.9221 50.0641 25.8648 52.1535 23.7482C52.4423 23.4556 52.6944 23.2002 52.9048 22.9753C53.4708 22.3703 54.42 22.3387 55.025 22.9046ZM35.1994 53.5892C35.1994 53.5892 35.2 53.5888 35.2012 53.5879C35.2 53.5889 35.1994 53.5893 35.1994 53.5892ZM36.0666 53.6682C36.0732 53.674 36.0765 53.6775 36.0765 53.6777C36.0765 53.678 36.0732 53.6751 36.0666 53.6682Z",fill:t,fillRule:"evenodd"}),e.u("path",{d:"M69.5 97C69.5 98.1046 56.2924 99 40 99C23.7076 99 10.5 98.1046 10.5 97C10.5 95.8954 23.7076 95 40 95C56.2924 95 69.5 95.8954 69.5 97Z",fill:"black",fillOpacity:"0.2"})]})}),e.u(E.Header,{message:u}),d]})})},o)},Tn=()=>e.u("div",{className:"thinking-dots-container",children:e.u("div",{className:"thinking-dot"})}),_n=({className:n})=>{const{uploadProgress:o}=e.useConfig(s=>({uploadProgress:s.uploadProgress}));let t,r;Object.values(o).filter(s=>s.isSubmitted).length>1?(t="Your responses are processing",r="Please keep this tab open until your responses are fully processed."):(t="Your response is processing",r="Please keep this tab open until your response is fully processed.");const i=Math.round(Math.min(99,...Object.values(o).filter(s=>s.isSubmitted).map(s=>s.progressPct||0)));return e.u("div",{className:e.cc(n,"ul-card--uploading","fade-in-transition"),children:[e.u("div",{"aria-busy":"true","aria-label":"Processing...","aria-live":"polite",className:"ul-loading-spinner-container",role:"progressbar",children:e.u("div",{className:"ul-loading-spinner",children:[e.u("div",{className:"first"}),e.u("div",{className:"second"}),e.u("div",{className:"third"}),e.u("div",{className:"fourth"})]})}),e.u(E.Header,{message:`${t} (${i}% complete)`}),e.u("p",{className:"ul-caption",children:r})]})},Be=0,Pe=1,In=({className:n,next:o,properties:t,questionId:r,type:i})=>{const s=`ul-card-video__player_recorder-q${r}`,{apiURL:d,envId:u,handleUploadUpdate:a,headers:m,responseGroupUid:y,surveyId:c,viewDocument:g,visitorId:k}=e.useConfig(b=>({apiURL:b.apiURL,envId:b.envId,handleUploadUpdate:b.handleUploadUpdate,headers:b.headers,responseGroupUid:b.responseGroupUid,surveyId:b.surveyId,viewDocument:b.viewDocument,visitorId:b.userId})),[C,h]=e.h(!1),[f,D]=e.h(null),[M,L]=e.h(null),[I,$]=e.h(Be),A=(b,w)=>{b===P.UPLOAD_STARTED?(D(w[P.UPLOAD_ID]),L(w[P.MEDIA_RECORDING_UID]),h(!0)):b===P.DELETE?(D(null),L(null),h(!1)):b===P.UPLOAD_PROGRESS?isNaN(w[P.UPLOAD_PROGRESS_PCT])?a({mediaRecordingUid:w[P.MEDIA_RECORDING_UID],isComplete:!0}):a({mediaRecordingUid:w[P.MEDIA_RECORDING_UID],progressPct:w[P.UPLOAD_PROGRESS_PCT]}):b===P.UPLOAD_FINISHED&&a({mediaRecordingUid:w[P.MEDIA_RECORDING_UID],isComplete:!0})},v=b=>{b.preventDefault(),b.stopPropagation(),document.getElementById(s)&&(w=>{const l=w+_e;if(T.document.getElementById(l)&&T.videojs){try{if(!T.videojs(l).record().stream)return}catch{return}T.videojs(l).record().stop(),T.videojs(l).record().stopDevice()}})(s),f&&M?(a({mediaRecordingUid:M,isSubmitted:!0}),o({value:{mediaRecordingUid:M},questionId:r,type:i},!0)):o({value:null,questionId:r,type:i},!0)};return e.u("form",{className:e.cc(n,"ul-card--video","fade-in-transition"),id:"ul-video-interview-form",children:[e.u(E.QuestionBodyWrapper,{children:[e.u("div",{id:"ul-question-player-container",style:{display:I===Be?"":"none"},children:e.u(E.MobileEmbedView,{properties:t,children:e.u("button",{className:"ul-video-btn ul-record-response-btn",onClick:b=>{b.preventDefault(),b.stopPropagation(),document.getElementById(s)&&(w=>{const l=de(w+Me);l==null||l.pause()})(s),$(Pe)}})})}),e.u("div",{style:{display:I===Pe?"block":"none"},children:e.u("div",{id:"ul-recorder-player-container",ref:b=>{if(b&&b.children.length===0){const w=((l,p={},x="https://api.userleap.com",B,_,N,H=!1,U=document)=>{T.document=U;const q=l+_e,Q=Ae(q);return T.document.addEventListener("securitypolicyviolation",G=>{ne(new Error(`Voice & Video feature violates ${G.violatedDirective} web page CSP policies for the recorder player.`),"recorderDeviceError",x,N,p.visitorId,p.envId)}),Ne(Le.concat(Ye),()=>{be(q,Q),T.document.getElementById(xe(q)).remove();try{Je(Q,q,p,x,B,_,N,H)}catch(G){return void ne(new Error(`Error when creating video recorder player object ${G}`),"recorderDeviceError",x,N,p.visitorId,p.envId)}}),Q})(s,{surveyId:c,responseGroupUid:y,questionId:r,visitorId:k,envId:u},d,A,void 0,{...m,"x-ul-video-recorder-origin":"sdk"},t.mediaType===P.MEDIA_TYPE_AUDIO,g);b.appendChild(w)}}})})]}),e.u(E.QuestionBodyFooterContainer,{children:[e.u(oe,{isDisabled:!!t.required&&!C,onClick:v,children:e.getButtonText(t)}),e.u("button",{className:"ul-card-text__button ul-button-inactive ul-card-skip__button",id:"ul-card-video__skip_button",onClick:v,style:{...t.required?{display:"none"}:{},...C?{display:"none"}:{}},children:e.getSkipButtonText(t)})]})]})},We=n=>n.type==="thanks"||n.type==="uploading",Dn=({card:n,avatars:o,isThinking:t,isCurrentQuestion:r,currentQuestionBubbleRef:i})=>{const s=(d=>"properties"in d.props&&d.props.properties&&"questionHtml"in d.props.properties&&d.props.properties.questionHtml?{content:d.props.properties.questionHtml,isHtml:!0}:"message"in d.props?{content:d.props.message,isHtml:!1}:{content:"Question",isHtml:!1})(n);return e.u(ae,{avatars:o,isLeft:!0,message:{id:`question-${n.name}`,type:"question",content:s.content},ref:r?i:null,children:t?e.u(Tn,{}):e.u(e.g,{children:[s.isHtml?e.u(E.Html,{className:"chat-message-text",html:s.content}):e.u("div",{className:"chat-message-text",children:s.content}),n.type==="videovoice"&&e.u(tn,{properties:n.props,questionId:n.name,surveyVideoUrl:n.props.properties.videoUrl})]})})},Sn=({card:n,avatars:o})=>{const t=(r=>{if(!("properties"in r.props)||!r.props.properties||typeof r.props.properties!="object")return null;const i=r.props.properties,s=[{key:"captionHtml",isHtml:!0},{key:"captionText",isHtml:!1},{key:"richTextBody",isHtml:!0},{key:"body",isHtml:!1}];for(const{key:d,isHtml:u}of s){const a=i[d];if(typeof a!="string")continue;const m=a.trim();if(m){if(u&&!m.replaceAll(/<[^>]*>/g,"").trim())continue;return{content:m,isHtml:u}}}return null})(n);return t?e.u(ae,{avatars:o,hideAvatar:!0,isLeft:!0,message:{id:`caption-${n.name}`,type:"question",content:t.content},children:t.isHtml?e.u(E.Html,{className:"chat-message-text",html:t.content}):e.u("div",{className:"chat-message-text",children:t.content})}):null},Rn=({card:n,userResponse:o,avatars:t})=>{const r=((i,s)=>{if(i.type==="open"&&s&&typeof s=="object"&&"value"in s)return s.value})(n,o);return e.u("div",{className:"chat-bubble-container chat-right",children:[e.u("div",{className:"chat-bubble chat-bubble-right chat-bubble-text-only",children:e.u("div",{className:"chat-message-text",children:r||e.u("div",{className:"chat-message-no-response",children:"No response"})})}),e.u("img",{alt:"User Avatar",className:"chat-avatar chat-avatar-right",srcSet:`${t.respondentAvatar["1x"]} 1x, ${t.respondentAvatar["2x"]} 2x`})]})},Bn=({card:n,avatars:o,isCurrentQuestion:t,currentQuestionBubbleRef:r})=>{const{endCard:i}=e.useConfig(s=>({endCard:s.endCard}));return e.u(e.g,{children:[e.u(ae,{avatars:o,isLeft:!0,message:{id:`thanks-${n.name}`,type:"question",content:(i==null?void 0:i.headline)??"Great! Thank you for your participation."},ref:t?r:null}),(i==null?void 0:i.subheader)&&e.u(ae,{avatars:o,hideAvatar:!0,isLeft:!0,message:{id:`caption-${n.name}`,type:"question",content:i.subheader}}),e.u(on,{})]})},Pn=({card:n,cardIndex:o,index:t,avatars:r,cardResponses:i,questionThinkingStates:s,startingQuestionIdx:d,currentQuestionBubbleRef:u,handleCardResponse:a})=>{const m=o===t,y=o<t,c=We(n);if(c)return e.u(Bn,{avatars:r,card:n,currentQuestionBubbleRef:u,isCurrentQuestion:m});const g=`${n.name}`,k=i.get(g),C=n.type==="open",h=s.get(g),f=o>(d??0)&&n.type!=="thanks"&&n.type!=="uploading"&&(h===!0||h===void 0);return e.u(e.wn.Fragment,{children:[e.u(Dn,{avatars:r,card:n,currentQuestionBubbleRef:u,isCurrentQuestion:m,isThinking:f}),!f&&e.u(Sn,{avatars:r,card:n}),y&&C?e.u(Rn,{avatars:r,card:n,userResponse:k}):(!y||!C)&&!f&&e.u(ae,{avatars:r,isLeft:!1,message:{id:`card-${n.name}`,type:"card",content:""},children:e.u("div",{className:"chat-card-container",children:e.u(Mn,{card:n,className:c?"chat-thanks-card":"chat-card",isAnswered:y,next:m?a:()=>{}})})})]},`question-card-${n.name}`)},ae=e.wn.forwardRef(({message:n,isLeft:o=!1,children:t,avatars:r,hideAvatar:i=!1},s)=>{const d=o?"chat-bubble-left":"chat-bubble-right";return e.u("div",{className:`chat-bubble-container ${o?"chat-left":"chat-right"}${o&&i?" chat-no-avatar":""}`,ref:s,children:[o&&!i&&e.u("img",{alt:"AI Avatar",className:"chat-avatar chat-avatar-left",srcSet:`${r.agentAvatar["1x"]} 1x, ${r.agentAvatar["2x"]} 2x`}),e.u("div",{className:`chat-bubble ${d}`,children:t||e.u("div",{className:"chat-message-text",children:n.content})}),!o&&!i&&e.u("img",{alt:"User Avatar",className:"chat-avatar chat-avatar-right",srcSet:`${r.respondentAvatar["1x"]} 1x, ${r.respondentAvatar["2x"]} 2x`})]})});ae.displayName="ChatBubble";const Ln=()=>{const n=e.useConfig(t=>t.close),o=e.F(()=>()=>n(W.APP_ID),[n]);return e.u("div",{"aria-label":"Close button",className:"conversational-close-btn",onClick:o,onKeyPress:t=>{t.key==="Enter"&&o()},role:"button",tabIndex:0,children:e.u("svg",{fill:"none",height:"16px",viewBox:"0 0 13 13",width:"16px",xmlns:"http://www.w3.org/2000/svg",children:e.u("path",{d:"M2.54964 1.78369L1.78369 2.54964L5.73405 6.5L1.78369 10.4504L2.54964 11.2163L6.5 7.26595L10.4504 11.2163L11.2163 10.4504L7.26595 6.5L11.2163 2.54964L10.4504 1.78369L6.5 5.73405L2.54964 1.78369Z",fill:"#262136"})})})},Mn=({card:n,next:o,className:t="",isAnswered:r=!1})=>{const i={className:r?`${t} answered-card`:t,next:r?()=>{}:o,questionId:n.name,type:n.type,isAnswered:r};switch(n.type){case"consentlegal":return e.u(rn,{...i,...n.props});case"likert":return e.u(an,{...i,...n.props});case"matrix":return e.u(dn,{...i,...n.props});case"multiplechoice":return e.u(cn,{...i,...n.props});case"multipleselect":return e.u(un,{...i,...n.props});case"nps":return e.u(pn,{...i,...n.props});case"aidynamicfollowup":case"open":return e.u(mn,{...i,type:n.type,...n.props});case"rankorder":return e.u(vn,{...i,...n.props});case"recordedtask":return e.u(wn,{...i,...n.props});case"texturlprompt":return e.u(En,{...i,...n.props});case"thanks":return e.u(jn,{...i,...n.props});case"uploading":return e.u(_n,{...i,...n.props});case"videovoice":return e.u(In,{...i,...n.props});default:return null}};exports.default=({cards:n,next:o,previousResponses:t})=>{const{cardResponses:r,setCardResponse:i}=(()=>{const[v,b]=e.h(new Map);return{cardResponses:v,setCardResponse:e.T((w,l)=>{b(p=>new Map(p).set(w,l))},[])}})(),{index:s,isLongFormSurvey:d,avatars:u,showSurveyBrand:a,forceBrandedLogo:m,marketingUrlLink:y,startingQuestionIdx:c,viewDocument:g,createDynamicQuestion:k,update:C}=e.useConfig(v=>({index:v.index,isLongFormSurvey:W.isLongFormSurvey(v.studyType),avatars:v.avatars,forceBrandedLogo:v.forceBrandedLogo,startingQuestionIdx:v.startingQuestionIdx,showSurveyBrand:v.showSurveyBrand,marketingUrlLink:e.buildMarketingUrl({marketingUrl:v.marketingUrl,slugName:v.slugName,surveyId:v.surveyId,forceBrandedLogo:v.forceBrandedLogo}),viewDocument:v.viewDocument,createDynamicQuestion:v.createDynamicQuestion,update:v.update})),{currentQuestionBubbleRef:h,scrollToCurrentQuestion:f}=(({viewDocument:v})=>{const b=e._(null),w=e.T(()=>{const l=v.querySelector(".ul-card-main-content");if(b.current&&l&&l instanceof HTMLElement){const p=b.current.offsetTop-l.offsetTop-16;l.scrollTo({top:Math.max(0,p),behavior:"smooth"})}},[]);return{currentQuestionBubbleRef:b,scrollToCurrentQuestion:w}})({viewDocument:g}),D=((v,b,w)=>{const[l,p]=e.h(new Map);return e.p(()=>{if(v.length>0&&b<v.length){const x=v[b],B=`${x.name}`;if(b<=(w??0)||We(x))return void p(H=>new Map(H).set(B,!1));const _=H=>H.type==="aidynamicfollowup";p(H=>{const U=!_(x)||!!x.props.loading;return new Map(H).set(B,U)});const N=setTimeout(()=>{p(H=>{const U=!!_(x)&&!!x.props.loading;return new Map(H).set(B,U)})},1e3);return()=>clearTimeout(N)}},[b,v,w]),l})(n,s,c),M=((v,b)=>{const[w,l]=e.h(()=>new Set([v]));return e.p(()=>{l(p=>new Set(p).add(v))},[v]),e.p(()=>{const p=b??0;p>0&&l(x=>{const B=new Set(x);for(let _=0;_<=p;_++)B.add(_);return B})},[b]),w})(s,c),L=e.F(()=>({...t,...e.buildReadableResponseMap(n.map((v,b)=>{var w,l;return{...v,value:b<s?((w=r.get(`${v.name}`))==null?void 0:w.value)??null:null,secondaryValue:b<s?((l=r.get(`${v.name}`))==null?void 0:l.secondaryValue)??null:null}}))}),[t,r,n,s]);e.useSetAllResponsesRaw(L);const I=e.pipeReadableResponsesIntoCards(n,L);e.p(()=>{requestAnimationFrame(()=>{f()}),C()},[s,f,D,C]);const $=e.T((v,b)=>{if(!b)return;const w=I[s];if(!w)return;const l=`${w.name}`;i(l,v);const p={...v,questionText:e.getProcessedQuestionText(w)};if(w.childId&&(p==null?void 0:p.value)!=null){const x=e.buildReadableResponseMap([w].map(B=>({...B,value:(p==null?void 0:p.value)??null,secondaryValue:(p==null?void 0:p.secondaryValue)??null})));k({parentQuestionId:w.name,parentResponseConfig:x})}o([p])},[I,s,o,i]),A=I.map((v,b)=>({card:v,cardIndex:b})).filter(({cardIndex:v})=>M.has(v));return e.u("div",{className:"conversational-ui ul-conversational-ui","data-testid":"ui-container",children:[!d&&e.u(Ln,{}),e.u("div",{className:"chat-container",children:e.u("div",{className:"chat-messages",children:A.map(({card:v,cardIndex:b})=>e.u(Pn,{avatars:u,card:v,cardIndex:b,cardResponses:r,currentQuestionBubbleRef:h,handleCardResponse:$,index:s,questionThinkingStates:D,startingQuestionIdx:c},`question-card-${v.name}`))})}),d&&e.u("div",{className:"long-form-question-footer-container-logo",children:a&&e.u(e.SprigBrandLogo,{forceBrandedLogo:m,marketingUrlLink:y})})]})};
|
|
658
|
+
`}],Me="-video-player",Te="-secondary-video-player",_e="-video-recorder";let X,Ie;const te=async({event:n,apiBase:o,headers:t,visitorId:r,envId:i,metadata:s})=>{const d=_.document.documentElement;if(!r||!i)return;const u={event:`SDK - ${n}`,visitorId:r,environmentId:i,metadata:{...s||{},screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:d.clientWidth,clientHeight:d.clientHeight,location:window.location.href,language:navigator.language}};(await fetch(`${o}/sdk/1/visitors/${r}/analytics`,{method:"POST",cache:"no-cache",headers:t,body:JSON.stringify(u)})).ok||console.warn("[Sprig] (ERR-444) Failed to track analytics",n)},ne=async(n,o,t,r,i,s)=>{te({event:`Video Error ${o}`,apiBase:t,headers:r,visitorId:i,envId:s,metadata:{errorMessage:n.message}});const d=_.document.documentElement,u={screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:d.clientWidth,clientHeight:d.clientHeight,location:window.location.href,language:navigator.language},a={action:o,err:{message:n.message,stack:n.stack},meta:u,vid:i,envId:s};(await fetch(`${t}/sdk/1/errors`,{method:"POST",cache:"no-cache",headers:{...r,"userleap-platform":"video_recorder","x-ul-error":window.btoa(`userleap-${Date.now()}-error`)},body:JSON.stringify(a)})).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",n)},Ne=(n,o)=>{if(n.length===0)return o&&o();Promise.all(n.reduce((t,r)=>(t.push(((i,{type:s,content:d})=>new Promise(function(u,a){let m;s==="script"?(m=_.document.createElement("script"),m.src=d):s==="link"?(m=_.document.createElement("link"),m.rel="stylesheet",m.href=d,m.type="text/css"):(m=_.document.createElement("style"),m.innerHTML=d),m.onload=function(){u(d)},m.onerror=function(){a(d)},m.async=!1,m.id=btoa(d),i.appendChild(m)}))(_.document.head,r)),t),[])).then(()=>{_.videojs=_.document.defaultView.videojs,o&&o()}).catch(function(t){console.log(t+" failed to load")})},De=(n,o,t)=>{if(o==="start"&&(n.style.visibility="visible"),o==="none")n.style.visibility=Z;else if(o==="success")n.style.visibility=Z,n.innerHTML="Upload succeeded!";else{const r=Math.round(parseFloat(t));n.innerHTML=`Uploading <span class="ul-upload-progress-label__time">${r}%</span>`,n.style.background=`linear-gradient(to right, #E0E0EB 0%, #E0E0EB ${r}%, #FCFCFD ${r}%, #FCFCFD 100%)`}},he=(n,o)=>{const t=_.videojs(n.id());return t==null?void 0:t.payload[o]},Oe=(n,o)=>{const t=new(_.videojs.getComponent("Component"))(n);return t.addClass("ul-buttons-panel"),o.map(r=>{t.addChild(r)}),Ke(t),t},Ke=n=>{n.children().forEach(o=>{if(J[o.name_]){const t=le(J[o.name_],`ul-${J[o.name_]}`);o.el_.appendChild(t)}})},le=(n,o="")=>{const t=_.document.createElement("span");return t.className="ul-button-text",t.innerHTML=n,t.id=o,t},qe=(n,o,t,r,i=!1,s)=>{n.addClass("ul-video-player");const d=new(_.videojs.getComponent("Component"))(n);d.addClass("ul-control-panel"),n.progressBar=d.addChild("ProgressControl"),t&&n.src(t),n.audioPlayerPlaceholder=new(_.videojs.getComponent("Component"))(n),n.audioPlayerPlaceholder.addClass("ul-audio-recorder-placeholder");const u=t&&t.src?nn(t.src):null;!t||!i&&u?(n.audioPlayerPlaceholder.hide(),_.document.getElementById(`${n.id()}_html5_api`).style.height="100%",u&&n.poster(u)):(n.children()[0].classList.add("vjs-hidden"),_.document.getElementById(`${n.id()}_html5_api`).style.height="0px"),n.on("play",()=>{i||!t||u||Xe(n),s==null||s.play()}),n.on("pause",()=>{s==null||s.pause()}),n.on("seeked",()=>{s==null||s.currentTime(n.currentTime())}),n.on("ratechange",()=>{s==null||s.playbackRate(n.playbackRate())}),n.addChild(n.audioPlayerPlaceholder,{},1),d.addChild(o),n.addChild(d),r&&r(n)},Je=(n,o,t,r,i,s,d,u=!1)=>{Ie=Date.now();const a=de(o,{controls:!1,bigPlayButton:!1,fluid:!1,width:1280,height:720,playsinline:!0,plugins:{record:{audio:!0,video:{mandatory:{minWidth:1280,minHeight:720}},frameWidth:1280,frameHeight:720,maxLength:600,autoMuteDevice:!0}}});if(!a)return;a.payload=t;const{surveyId:m,questionId:y,responseGroupUid:c,visitorId:g,envId:k}=t;let C;const h=l=>{const p=ve,x=ve+"-audio-only";De(a.uploadProgressLabel,"none"),X&&X.startTime>=Ie&&X.abort();const B=_.document.getElementById("ul-camera-button");l?(a.children()[0].classList.add("vjs-hidden"),N.removeClass(p),N.addClass(x),B.innerHTML=J.TurnOnCamera,a.audioPlayerPlaceholder.removeClass("vjs-hidden"),C==null||C.getTracks().forEach(T=>{T.stop()}),window.navigator.mediaDevices.getUserMedia({video:!0,audio:!0}).then(T=>{C=T,T.getVideoTracks().forEach(O=>{O.enabled=!1}),a.record().onDeviceReady(T)}).catch(a.record().onDeviceError.bind(a.record()))):(C==null||C.getVideoTracks().forEach(T=>{T.enabled=!0}),a.children()[0].classList.remove("vjs-hidden"),a.record().getDevice(),N.removeClass(x),N.addClass(p),B.innerHTML=J.TurnOffCamera,a.audioPlayerPlaceholder.addClass("vjs-hidden"))},f=new(_.videojs.getComponent("Button"))(a,{clickHandler:()=>{f.hasClass(Z)||(te({event:"Video Delete Button Clicked",apiBase:r,headers:d,visitorId:g,envId:k,metadata:{questionId:y,responseGroupUid:c,surveyId:m}}),h(a.cameraOff),i(M.DELETE,{}),N.removeClass(Z),f.addClass(Z))}});f.addClass("ul-video-recorder-delete-button"),f.el_.appendChild(le(J.DeleteButton,"ul-delete-button"));const D=_.document.getElementById(o),q=()=>{D.classList.contains("vjs-fullscreen")&&a.cameraOff?D.style.display="table":D.style.display="flex"};q();const N=new(_.videojs.getComponent("Button"))(a,{clickHandler:()=>{a.record().isRecording()||(a.cameraOff=!a.cameraOff,te({event:"Video Camera Button Clicked",apiBase:r,headers:d,visitorId:t.visitorId,envId:t.envId,metadata:{questionId:y,responseGroupUid:c,surveyId:m,cameraOff:a.cameraOff}}),h(a.cameraOff),!f.hasClass(Z)&&f.addClass(Z),i(M.DELETE,{}),q())}});N.addClass(ve),N.el_.appendChild(le(J.TurnOffCamera,"ul-camera-button"));const I=new(_.videojs.getComponent("Button"))(a,{clickHandler:()=>{const l=_.document.getElementById("ul-recorder-toggle");if(a.record().isRecording())a.record().stop(),l&&(l.innerHTML=J.RecordButton),I.removeClass(ge),f.removeClass(Z);else{const p=_.document.getElementById("ul-recording-countdown-screen");if(p)p.remove(),l&&(l.innerHTML=J.RecordButton),h(a.cameraOff),i(M.DELETE,{}),N.removeClass(Z),f.addClass(Z),I.removeClass(ge),v.show();else{I.addClass(ge),v.hide(),N.addClass(Z),f.addClass(Z),l&&(l.innerHTML=J.StopButton);const x=_.document.createElement("div");x.id="ul-recording-countdown-screen",D.insertBefore(x,D.children[1]),x.style.height=`${D.offsetHeight}px`,Ue(a,3)}}}});I.addClass("ul-video-recorder-toggle-button"),I.el_.appendChild(le(J.RecordButton,"ul-recorder-toggle"));const H=_.document.createElement("p");H.style.visibility="hidden",H.className="ul-upload-progress-label",n.appendChild(H),a.uploadProgressLabel=H;const A=Oe(a,[f,N,"PlayToggle",I,"FullscreenToggle"]),v=A.children().find(l=>l.name_==="FullscreenToggle");v.hasClass("vjs-disabled")&&v.hide();const b=A.children().find(l=>l.name_==="PlayToggle");b.hide(),f.addClass(Z),qe(a,A,s,!1,u),a.on("stopRecord",()=>{I.hide(),b.show(),v.show(),f.removeClass(Z)}),a.on("deviceReady",()=>{I.show(),b.hide(),f.addClass(Z)}),((l,p,x,B,T)=>{const{surveyId:O,responseGroupUid:G,visitorId:P,envId:L}=l.payload;l.on("deviceError",function(){console.warn("device error: ",l.deviceErrorCode),l.deviceErrorCode.message==="Permission denied"?(l.deviceButton.addClass("permission-denied"),x&&x(M.ERROR,{type:M.PERMISSION_DENIED}),te({event:"Video Permission Denied",apiBase:p,headers:T,visitorId:P,envId:L,metadata:{questionId:he(l,me),responseGroupUid:G,surveyId:O}})):(x&&x(M.ERROR,{type:M.OTHER}),ne(new Error(l.deviceErrorCode.message),"recorderDeviceError",p,T,P,L))}),l.on("error",function(F,Q){ne(Q||l.error(),"recorderError",p,T,P,L)}),l.on("startRecord",function(F,Q){B(l.uploadProgressLabel,"none"),te({event:"Video Record Start",apiBase:p,headers:T,visitorId:P,envId:L,metadata:{questionId:he(l,me),responseGroupUid:G,surveyId:O}})}),l.on("finishRecord",async function(){B(l.uploadProgressLabel,"start",0);const F=he(l,me);if(!O){const S="internal error: missing fields in payload";return x&&x(M.ERROR,{type:M.OTHER}),ne(new Error(S),"finishRecord",p,T,P,L),null}l.record().stopDevice();const Q=l.cameraOff?M.MEDIA_TYPE_AUDIO:M.MEDIA_TYPE_VIDEO,W=Y.v4();te({event:"Video Record Finish",apiBase:p,headers:T,visitorId:P,envId:L,metadata:{mediaRecordingUid:W,questionId:F,responseGroupUid:G,surveyId:O,mediaType:Q}});const ie={surveyId:O,updatedAt:new Date().toISOString(),mediaType:Q,mediaRecordingUid:W};F&&(ie.questionId=F),G&&(ie.responseGroupUid=G),P&&(ie.visitorId=P);const j=await(async()=>{const S=await fetch(`${p}/2/environments/integrations/upload`,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(ie)});if(S.ok){const U=await S.json();return x&&x(M.UPLOAD_STARTED,{[M.UPLOAD_ID]:U.upload.id,[M.MEDIA_TYPE]:Q,[M.MEDIA_RECORDING_UID]:W}),U.upload.url}return x&&x(M.ERROR,{type:M.OTHER,response:S}),ne(new Error("failed to get upload response with url"),"finishRecord",p,T,P,L),null})();j&&(X=_.document.defaultView.UpChunk.createUpload({endpoint:j,file:new _.document.defaultView.File([l.recordedData],`recording ${Q} ${Date.now()}`),chunkSize:5120}),X.startTime=Date.now(),te({event:"Video Upload Start",apiBase:p,headers:T,visitorId:P,envId:L,metadata:{mediaRecordingUid:W,questionId:F,responseGroupUid:G,surveyId:O,mediaType:Q,url:j}}),X.on("error",S=>{B(l.uploadProgressLabel,"none"),x&&x(M.UPLOAD_FINISHED,{[M.MEDIA_RECORDING_UID]:W}),ne(S,"finishRecord",p,T,P,L)}),X.on("progress",S=>{x&&x(M.UPLOAD_PROGRESS,{[M.MEDIA_RECORDING_UID]:W,[M.UPLOAD_PROGRESS_PCT]:S.detail}),B(l.uploadProgressLabel,"progress",S.detail)}),X.on("success",()=>{B(l.uploadProgressLabel,"success"),x&&x(M.UPLOAD_FINISHED,{[M.MEDIA_RECORDING_UID]:W}),te({event:"Video Upload Success",apiBase:p,headers:T,visitorId:P,envId:L,metadata:{mediaRecordingUid:W,questionId:F,responseGroupUid:G,surveyId:O,mediaType:Q,url:j,elapsedMs:X.startTime&&Date.now()-X.startTime}})}))})})(a,r,i,De,d);const w=[{name:"microphone"}];!a.cameraOff&&w.push({name:"camera"}),Promise.all(w.map(l=>{var p;return(p=navigator==null?void 0:navigator.permissions)==null?void 0:p.query(l)})).then(l=>{l.reduce((p,x)=>p&x.state==="granted",!0)&&a&&(a.deviceButton&&a.deviceButton.hide(),a.record().getDevice())}).catch(l=>{})},Ue=(n,o=3)=>{const t=_.document.getElementById("ul-recording-countdown-screen");t&&o===0?(t.remove(),n.record().start()):t&&(t.innerHTML=`<span class='ul-countdown-text'>Recording in... ${o}</span>`,setTimeout(()=>{Ue(n,o-1)},1e3))},Ae=n=>{const o=_.document.createElement("div");return o.className="ul-video-container",o.appendChild((t=>{const r=_.document.createElement("div");return r.className="ul-video-player-loading",r.id=xe(t),["first","second","third","fourth"].map(i=>{const s=_.document.createElement("div");s.className=i,r.appendChild(s)}),r})(n)),o},be=(n,o)=>{const t=_.document.createElement("video");t.id=n,t.className="video-js vjs-default-skin ul-video-player-video";const r=_.document.createElement("p");r.className="vjs-no-js",r.innerHTML="To view this video please enable JavaScript, and consider upgrading to a web browser that";const i=_.document.createElement("a");return i.href="https://videojs.com/html5-video-support/",i.target="_blank",i.innerHTML="supports HTML5 video",r.appendChild(i),t.appendChild(r),o.appendChild(t),o},Xe=(n,o)=>{n.children()[0].classList.remove("vjs-hidden"),n.audioPlayerPlaceholder.hide(),_.document.getElementById(`${n.id()}_html5_api`).style.height="100%"},de=(n,o)=>_.document.getElementById(n)?o?_.videojs(n,o):_.videojs(n):(console.error(`Error in finding player element with ID, ${n}`),null),en=(n,o,t,r=!1,i="https://api.sprig.com",s=document,d=null,u=null)=>{_.document=s;const a=n+Me,m=Ae(a);return _.document.addEventListener("securitypolicyviolation",y=>{ne(new Error(`Voice & Video feature violates ${y.violatedDirective} web page CSP policies for the question player.`),"playerDeviceError",i,{})}),Ne(Le,()=>{_.document.getElementById(xe(a)).remove(),be(a,m);const y={playsinline:!0,playbackRates:[.5,1,1.5,2],fill:!0};try{const c=n+Te;be(c,m);const g=de(a,y),k=de(c,{muted:!0,...y});if(!g||!k)return;((f,D,q)=>{f.addClass(`ul${Te}`);const N=new(_.videojs.getComponent("Component"))(f);D&&f.src(D),f.addChild(N),q&&q(f)})(k,d,u),d||k.addClass(Z);const C=Oe(g,["PlaybackRateMenuButton","PlayToggle","FullscreenToggle"]),h=C.children().find(f=>f.name_==="FullscreenToggle");h.hasClass("vjs-disabled")&&h.hide(),qe(g,C,o,t,r,k)}catch(c){return void ne(new Error(`Error when creating video player object ${c}`),"playerDeviceError",i,{})}}),m},nn=n=>{if(!n)return null;const o=n.match(/https:\/\/stream.mux.com\/(.*)/);let t=o?o[1]:null;return t.includes(je)&&(t=t.replace(je,"")),t?`https://image.mux.com/${t}/thumbnail.jpg?time=0`:null},M={UPLOAD_STARTED:"upload.started",UPLOAD_PROGRESS:"upload.progress",UPLOAD_FINISHED:"upload.finished",DELETE:"delete",ERROR:"error",MEDIA_TYPE:"media.type",PERMISSION_DENIED:"permission_denied",OTHER:"other",UPLOAD_ID:"upload.id",UPLOAD_PROGRESS_PCT:"upload.progress.pct",MEDIA_RECORDING_UID:"media.recording.uid",MEDIA_TYPE_VIDEO:"video",MEDIA_TYPE_AUDIO:"audio"},J={PlaybackRateMenuButton:"Speed",PlayToggle:"Play",FullscreenToggle:"Expand",TurnOnCamera:"Turn on",TurnOffCamera:"Turn off",DeleteButton:"Delete",RecordButton:"Record",StopButton:"Stop",PauseButton:"Pause"},tn=({properties:n,surveyVideoUrl:o,questionId:t})=>{const r=`ul-card-video__question_player-q${t}`,{apiURL:i,viewDocument:s}=e.useConfig(d=>({apiURL:d.apiURL,viewDocument:d.viewDocument}));return e.u("div",{id:r,ref:d=>{if(d&&d.children.length===0&&!n.properties.hideRecordedPrompt){const u=en(r,{src:o,type:"application/x-mpegURL"},void 0,n.properties.mediaType===M.MEDIA_TYPE_AUDIO,i,s);d.appendChild(u)}}})},oe=({isDisabled:n,onClick:o,children:t})=>e.u(E.Button,{className:"ul-card__button-checkmark",disabled:n,onClick:o,type:"button",children:[e.u("svg",{fill:"none",height:"10",viewBox:"0 0 13 10",width:"13",xmlns:"http://www.w3.org/2000/svg",children:e.u("path",{d:"M11.5 1.5L4.5 8.5L1 5",stroke:"#ffffff",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})}),t||"Ok"]}),rn=({className:n,next:o,properties:t,questionId:r,type:i})=>{const{useMobileStyling:s,border:d}=e.useConfig(I=>({useMobileStyling:I.useMobileStyling,border:I.border})),[u,a]=e.h(!1),[m,y]=e.h(""),[c,g]=e.h(!1),k=t==null?void 0:t.collectName,C=(t==null?void 0:t.nameLabelText)||"Full Name",h=(t==null?void 0:t.consentText)||"I agree to the stated conditions",f=(t==null?void 0:t.submitButtonText)||"Submit",D=!!m.trim(),q=u&&(!k||D),N=(I,H=!1)=>{I.preventDefault(),I.stopPropagation();let A=null;if(!H){if(!q)return void g(!0);A={submitted:!0},k&&(A.name=m)}o({value:A,questionId:r,type:i},!!H||q)};return e.u("div",{className:e.cc(n,"ul-card__consent-legal","fade-in-transition"),children:e.u(E.MobileEmbedView,{embeddedType:"pdf",properties:t,children:e.u(E.QuestionBodyFooterContainer,{children:[e.u("div",{className:"sprig-stretch",children:[e.u(E.Option,{allowTextEntry:!1,border:d,error:c&&!u,id:"consent",isRadio:!1,isSelected:u,label:h,onUserInputChanged:({selected:I})=>{I!==u&&a(!u)},useMobileStyling:s}),k&&e.u("input",{"aria-label":C,"aria-placeholder":C,className:e.cc(e.getClasses("ul-consent-legal__name-input",s)),"data-gramm":"false",maxLength:250,name:"name",onBlur:I=>{I.currentTarget.style.borderColor=c&&!D?Y.ERROR_BORDER_COLOR:Y.DEFAULT_BORDER_COLOR},onFocus:I=>{I.currentTarget.style.borderColor=c&&!D?Y.ERROR_BORDER_COLOR:d},onInput:I=>{I.preventDefault(),I.stopPropagation(),y(I.currentTarget.value)},placeholder:C,style:c&&!D?{borderColor:Y.ERROR_BORDER_COLOR}:{},tabIndex:0,value:m})]}),e.u("div",{className:"ul-card__button-wrapper ul-card-vertical__button-wrapper",children:[e.u(oe,{isDisabled:!q,onClick:I=>N(new SubmitEvent(I.type)),children:e.getButtonText({buttonText:f})}),t.required===!1&&e.u("button",{className:"ul-card-skip__button",onClick:I=>N(new SubmitEvent(I.type),!0),children:e.getSkipButtonText(t)})]})]})})},r)},on=()=>{const{destroy:n,forceBrandedLogo:o}=e.useConfig(t=>({destroy:t.destroy,forceBrandedLogo:t.forceBrandedLogo}));return e.p(()=>{setTimeout(()=>{n(Y.APP_ID)},o?4e3:2e3)},[n,o]),e.u("div",{className:"end-of-survey-text",children:"End of survey"})},sn=({activeValue:n,border:o,icon:t,enableCspTrustedTypes:r,isPressed:i,range:s,scaleLabelType:d,selectedValue:u,setSelectedValue:a,setActiveValue:m,setIsPressed:y,useMobileStyling:c,value:g,viewDocument:k})=>{const C=`option-${g}`,h=d==="number",f=d==="star",D=d==="smiley",q=h&&g===n||g===u,[N,I]=(()=>{const v=f&&u!==null&&g<=u;return f&&g<=n||D&&g===n||v||g===n||g===u?[o,i||v||g===u?1:.3]:["",1]})(),H=e.F(()=>{const v={borderColor:q?N:"",fillOpacity:q?"":I,zIndex:q?3:"auto",color:u===g?"#fff":""};return h?{...v,backgroundColor:u===g?N:""}:{...v,color:f||D||u===g?N:""}},[q,N,I,u,g,h,f,D]),A=e.F(()=>Y.getHtml((({icon:v,scaleLabelType:b,value:w,selectedValue:l})=>{if(b==="smiley"&&w===l){let p=0;return v.replace(/black/g,()=>++p==1?"black":"white")}return v})({icon:t,scaleLabelType:d,value:g,selectedValue:u}),r),[r,t,d,u,g]);return e.u("button",{"aria-label":h?void 0:String(g),className:(()=>{switch(d){case"star":return e.cc(e.getClasses("likert-star",c),e.getClasses(`likert-star-${g}`,c));case"smiley":return e.cc(e.getClasses("likert-smiley",c),e.getClasses(`likert-smiley-${g}`,c));default:return g===s?e.cc(e.getClasses("likert-number",c),e.getClasses(`likert-number-${g}`,c),e.getClasses("likert-last-option",c)):e.cc(e.getClasses("likert-number",c),e.getClasses(`likert-number-${g}`,c))}})(),dangerouslySetInnerHTML:{__html:A},id:C,onClick:v=>{v.preventDefault(),v.stopPropagation(),a(g)},onKeyDown:v=>{var l,p;const b=k.querySelectorAll(`.likert-${d??"number"}`),w=g-1;v.key==="ArrowRight"?(l=b[w+1])==null||l.focus():v.key==="ArrowLeft"?(p=b[w-1])==null||p.focus():v.key!=="Enter"&&v.key!==" "||(v.preventDefault(),v.stopPropagation(),a(g))},onPointerDown:()=>y(!0),onPointerEnter:()=>m(g),onPointerLeave:()=>{m(-1),y(!1)},style:H,tabIndex:0})},an=({className:n,labels:o,next:t,properties:r,questionId:i,type:s})=>{const{border:d,useMobileStyling:u,viewDocument:a,enableCspTrustedTypes:m}=e.useConfig(b=>({border:b.border,useMobileStyling:b.useMobileStyling,viewDocument:b.viewDocument,enableCspTrustedTypes:b.enableCspTrustedTypes})),[y,c]=e.h(-1),[g,k]=e.h(!1),[C,h]=e.h(null),f=o&&o.left,D=o&&o.right;let q;const{range:N,scaleLabelType:I,ratingIcons:H}=r;N&&(q=Number(N));const A=q||5,v=b=>{var w,l;switch(I){case"star":return(w=H[0])==null?void 0:w.svg;case"smiley":return(l=H[b])==null?void 0:l.svg;default:return String(b+1)}};return e.u("form",{className:e.cc(n,"ul-card--likert","fade-in-transition"),children:e.u(E.MobileEmbedView,{properties:r,children:[e.u(E.QuestionBodyWrapper,{children:[e.u("div",{"aria-label":`Rating (1 - ${A})`,className:"ul-card--likert__numbers",role:"radiogroup",children:[...Array(A)].map((b,w)=>{const l=w+1;return e.u(sn,{activeValue:y,border:d,enableCspTrustedTypes:m,icon:v(w),isPressed:g,range:A,scaleLabelType:I,selectedValue:C,setActiveValue:c,setIsPressed:k,setSelectedValue:h,useMobileStyling:u,value:l,viewDocument:a},w)})}),e.u("div",{className:"ul-card--likert__labels",children:[e.u("span",{children:f}),e.u("span",{children:D})]})]}),e.u(E.QuestionBodyFooterContainer,{children:e.u(oe,{isDisabled:C===null&&r.required,onClick:()=>t({value:C,questionId:i,type:s},!0),children:e.getButtonText(r)})})]})},i)},ln=({columns:n,onSelect:o,options:t,selectedOptions:r})=>{const i=e._([]),{border:s,useMobileStyling:d}=e.useConfig(g=>({border:g.border,useMobileStyling:g.useMobileStyling})),u=t.findIndex(g=>r[g.id]===null),[a,m]=e.h(u),y=e.T((g,k)=>{o(g,k);const C=a+1,h=t[C];h&&r[h.id]===null&&m(C)},[o,t,r,a]),c=e.T((g,k)=>{const C=a===g;return e.u(e.Accordion,{animate:!0,header:k.label,isOpen:C,onClick:()=>{var h;return m(C&&!((h=window.UserLeap)!=null&&h.isMobileSDK)?-1:g)},ref:h=>{h&&(i.current[g]=h)},showHeaderCheck:r[k.id]!==null,children:e.u("div",{style:{paddingTop:"12px"},children:n.map(h=>e.u(E.Option,{allowTextEntry:!1,ariaLabel:`${k.label}-${h.label}`,border:s,error:!1,id:`${k.id}-${h.value}`,isRadio:!0,isSelected:r[k.id]===h.value,label:h.label,onUserInputChanged:()=>y(k.id,h.value),useMobileStyling:d},h.label))})},k.id)},[s,n,a,y,r,d]);return e.u("div",{children:t.map((g,k)=>c(k,g))})},dn=({className:n,next:o,options:t,properties:r,questionId:i,type:s,onSubmitButtonClick:d})=>{const u=r.matrixColumn,a=r.required,m=C=>{C.preventDefault(),C.stopPropagation(),o({value:c,questionId:i,type:s},!0),d&&d()},y=t.reduce((C,h)=>(C[h.id]=null,C),{}),[c,g]=e.h(y);return e.u("form",{className:e.cc(n,"ul-card__matrix","fade-in-transition"),id:"text-form",onSubmit:m,children:e.u(E.MobileEmbedView,{properties:r,children:[e.u(E.QuestionBodyWrapper,{children:e.u(ln,{columns:u,onSelect:(C,h)=>{g(f=>({...f,[C]:h}))},options:t,selectedOptions:c})}),e.u(E.QuestionBodyFooterContainer,{children:e.u(oe,{isDisabled:(k=c,a&&Object.values(k).every(C=>C==null)),onClick:()=>m(new SubmitEvent("submit")),children:e.getButtonText(r)})})]})},i);var k},He=({className:n,onSubmit:o,options:t=[],properties:r,questionId:i,type:s,showIndividualSubmit:d=!1,onSubmitButtonClick:u})=>{const{border:a,useMobileStyling:m}=e.useConfig(l=>({border:l.border,useMobileStyling:l.useMobileStyling})),y=t.reduce((l,p)=>(l[p.id]={isSelected:!1},l),{}),[c,g]=e.h(y),k=s==="multiplechoice",C=r.required,h=t.find(l=>{var p;return(p=l.optionProperties)==null?void 0:p.noneOfTheAbove}),f=l=>Object.entries(l).some(([p,x])=>{var O;const B=t.find(G=>`${G.id}`===p),T=x.userText===void 0||x.userText.trim()==="";return((O=B==null?void 0:B.optionProperties)==null?void 0:O.allowsTextEntry)&&T&&x.isSelected}),D=l=>Object.values(l).filter(p=>p.isSelected).length,q=r.minSelect&&r.minSelect>0&&r.maxSelectMode===E.MaxSelectModes.Range&&D(c)<r.minSelect&&(C||D(c)>0),N=l=>f(l)||C&&!D(l)||!(p=>{const{minSelect:x=0,maxSelect:B=1/0,maxSelectMode:T}=r,O=D(p);switch(T){case E.MaxSelectModes.Maximum:return O<=B;case E.MaxSelectModes.Range:return O===0||O>=x;default:return!0}})(l),I=Object.entries(c).some(([l,p])=>{var x,B;return p.isSelected&&((B=(x=t.find(T=>`${T.id}`===l))==null?void 0:x.optionProperties)==null?void 0:B.allowsTextEntry)}),H=d&&(!k||I),A=l=>{w(l.id,l.selected,l.userText,l.noneOfTheAbove)},v=l=>{var p;return(r==null?void 0:r.maxSelectMode)!==E.MaxSelectModes.Unlimited&&D(c)===(r==null?void 0:r.maxSelect)&&!((p=c[l])!=null&&p.isSelected)},b=()=>{o(c,!0),u&&u()},w=(l,p,x,B)=>{const T=Object.assign({},c);if((k||B)&&p)for(const O of Object.values(T))O.isSelected=!1,delete O.userText;else h&&!B&&c[h.id].isSelected&&(T[h.id].isSelected=!1);T[l]={isSelected:p,userText:x},g(T)};return e.u("form",{className:e.cc(n,"ul-card--multiple","fade-in-transition"),id:"text-form",onSubmit:b,children:e.u(E.MobileEmbedView,{properties:r,children:[e.u(E.QuestionBodyWrapper,{children:[r.isDropdown?e.u(E.Select,{disabledOptions:t.filter(l=>v(l.id)),dropdownFooter:q?e.u("div",{className:"ul-card__min-select-counter",style:{marginLeft:"16px"},children:[D(c),"/",r.minSelect]}):void 0,isMultiSelect:!k,multiselectText:r.dropdownMultiselectedText??"choices selected",onChange:l=>{const p={...c};for(const x of t)l.includes(x)?p[x.id].isSelected=!0:p[x.id].isSelected=!1;g(p)},options:t,placeholderText:r.dropdownPlaceholderText??(k?"Select choice":"Select choice(s)"),value:t.filter(l=>c[l.id].isSelected)}):e.u("div",{className:e.cc(e.getClasses("ul-card__choices",m)),role:k?"radiogroup":"group",children:[t.map(({id:l,label:p,value:x,optionProperties:B})=>{var L,F;const T=`${l}`,{allowsTextEntry:O,noneOfTheAbove:G}={allowsTextEntry:!1,noneOfTheAbove:!1,...B};return e.u(E.Option,{allowTextEntry:O,border:a,disabled:v(T),error:(P=c,f(P)),id:T,isRadio:k,isSelected:!!((L=c[T])!=null&&L.isSelected),label:p,noneOfTheAbove:G,onUserInputChanged:A,promptText:"Please specify",text:(F=c[l])==null?void 0:F.userText,useMobileStyling:m,value:x},T);var P}),!!q&&e.u("div",{className:"ul-card__min-select-counter",children:[D(c),"/",r.minSelect]})]}),H&&e.u(E.LongformSubmitButton,{handleSubmit:b,isSubmitDisabled:N(c)})]}),e.u(E.QuestionBodyFooterContainer,{children:e.u(oe,{isDisabled:N(c),onClick:b,children:e.getButtonText(r)})})]})},i)},cn=n=>{const{questionId:o,type:t,next:r,options:i}=n;return e.u(He,{...n,onSubmit:(s,d)=>{const u=Object.entries(s).find(([,g])=>g.isSelected)||[void 0,void 0],[a,m]=u,y=i.find(g=>`${g.id}`===a),c=m!=null&&m.userText?{[a]:{userText:m.userText}}:null;r({value:y&&a?{[a]:y.value}:{},secondaryValue:c,questionId:o,type:t},d)}})},un=n=>{const{questionId:o,type:t,next:r}=n;return e.u(He,{...n,onSubmit:(i,s)=>{const d=Object.entries(i).reduce((a,[m,y])=>(a[m]=y.isSelected,a),{}),u=Object.entries(i).reduce((a,[m,y])=>{if(!y.userText)return a;const c=a||{};return c[m]={userText:y.userText},c},null);r({value:d,secondaryValue:u,questionId:o,type:t},s)}})},pn=({className:n,labels:o,properties:t,next:r,questionId:i,type:s})=>{const[d,u]=e.h(null),{border:a,useMobileStyling:m,viewDocument:y}=e.useConfig(k=>({border:k.border,useMobileStyling:k.useMobileStyling,viewDocument:k.viewDocument})),c=o&&o.left,g=o&&o.right;return e.u("form",{className:e.cc(n,"ul-card--nps","fade-in-transition"),children:e.u(E.MobileEmbedView,{properties:t,children:[e.u(E.QuestionBodyWrapper,{children:[e.u("div",{className:"ul-card--nps__numbers",children:[...Array(11)].map((k,C)=>e.u("button",{className:e.cc(e.getClasses("nps-number",m),e.getClasses(`nps-number-${C}`,m)),id:`option-${C}`,onClick:h=>{h.preventDefault(),h.stopPropagation(),u(C)},onKeyDown:h=>{var D,q;const f=y.querySelectorAll("button.nps-number");h.key==="ArrowRight"?(D=f[C+1])==null||D.focus():h.key==="ArrowLeft"?(q=f[C-1])==null||q.focus():h.key!=="Enter"&&h.key!==" "||(h.preventDefault(),h.stopPropagation(),u(C))},onPointerDown:h=>{h.currentTarget.style.zIndex="2",h.currentTarget.style.borderColor=a},onPointerLeave:h=>{h.currentTarget.style.zIndex="auto",h.currentTarget.style.borderColor=Y.DEFAULT_BORDER_COLOR},style:d===C?{backgroundColor:a,color:"#fff"}:void 0,tabIndex:0,children:C},C))}),e.u("div",{className:"ul-card--nps__labels",children:[e.u("span",{children:c}),e.u("span",{children:g})]})]}),e.u(E.QuestionBodyFooterContainer,{children:e.u(oe,{isDisabled:d===null&&t.required,onClick:()=>r({value:d,questionId:i,type:s},!0),children:e.getButtonText(t)})})]})},i)},mn=({className:n,next:o,properties:t,questionId:r,type:i,onSubmitButtonClick:s})=>{const{border:d,useMobileStyling:u,update:a}=e.useConfig(f=>({border:f.border,useMobileStyling:f.useMobileStyling,update:f.update})),[m,y]=e.h(""),c=e._(null),g=m.trim(),k=t.required===!0&&!g,C=E.useAutoSize(c,()=>a()),h=t&&t.openTextPlaceholder?t.openTextPlaceholder:"";return e.u("form",{className:e.cc(n,"ul-card-text","fade-in-transition"),id:"text-form",children:e.u(E.MobileEmbedView,{properties:t,children:e.u("div",{className:"ul-card-text",children:[e.u(E.QuestionBodyWrapper,{children:[e.u("div",{className:"ul-card-text__container",children:e.u("textarea",{"aria-describedby":"ul-caption","aria-labelledby":"ul-question","aria-multiline":"true","aria-placeholder":h,className:e.cc(e.getClasses("ul-card-text__input",u)),"data-gramm":"false",maxLength:5e3,name:"text",onBlur:f=>{f.currentTarget.style.borderColor=Y.DEFAULT_BORDER_COLOR},onChange:f=>{const{value:D}=f.currentTarget;C(),f.preventDefault(),f.stopPropagation(),y(D)},onFocus:f=>{f.currentTarget.style.borderColor=d},placeholder:h,ref:c,role:"textbox",tabIndex:0})}),t.footerHtml&&e.u(E.Html,{className:"footer",html:t.footerHtml})]}),e.u(E.QuestionBodyFooterContainer,{children:e.u(oe,{isDisabled:k,onClick:f=>{f.preventDefault(),f.stopPropagation();const D=t.required!==!0||g.length>0;o({value:m,questionId:r,type:i},D),s&&s()},children:e.getButtonText(t)})})]})})},r)},vn=({className:n,labels:o,next:t,properties:r,questionId:i,type:s,onSubmitButtonClick:d,options:u})=>{const a=e._(null),m=e._(0),y=e._(0),c=e._(null),g=e._(!1),k=e._([]),[C,h]=e.h(()=>(r==null?void 0:r.required)===!0),[f,D]=e.h(()=>u.map(j=>({...j,rank:null}))),q=e.F(()=>Array.from({length:u.length},(j,S)=>S+1),[u.length]),{useMobileStyling:N,isPreview:I,headers:H}=e.useConfig(j=>({useMobileStyling:j.useMobileStyling,isPreview:j.isPreview,headers:j.headers})),A=(H==null?void 0:H["userleap-platform"])==="android",v=N&&!I&&!A,b=!v&&!A,w=(j,S)=>{D(U=>{const R=parseInt(S),V=U.map($=>({...$}));V.some($=>$.rank==null)&&V.forEach(($,se)=>$.rank=se+1);const K=V.findIndex($=>$.id===j);if(K===-1)return U;const z=V[K].rank;return R<z?V.forEach($=>{$.id!==j&&$.rank>=R&&$.rank<z&&($.rank=$.rank+1)}):R>z&&V.forEach($=>{$.id!==j&&$.rank>z&&$.rank<=R&&($.rank=$.rank-1)}),V[K].rank=R,V.sort(($,se)=>$.rank-se.rank),G(),V})},l=(j,S)=>{for(let U=0;U<k.current.length;U++){const R=k.current[U];if(!R||R===c.current)continue;const V=R.getBoundingClientRect();if(j>=V.left&&j<=V.right&&S>=V.top&&S<=V.bottom)return{element:R,index:U}}return null},p=j=>S=>{if(!v)return;S.preventDefault(),S.stopPropagation(),g.current=!0,a.current=j;const U=S.touches[0];m.current=U.clientY,y.current=U.clientY;const R=S.currentTarget.closest(".ul-card-rank__option");R&&(c.current=R,R.classList.add("is-dragging"))},x=j=>{if(!v||!g.current||a.current===null)return;j.preventDefault(),j.stopPropagation();const S=j.touches[0];y.current=S.clientY;const U=y.current-m.current;c.current&&(c.current.style.transform=`translateY(${U}px)`,c.current.style.zIndex="1000"),k.current.forEach(V=>{V&&V!==c.current&&V.classList.remove("is-drop-target")});const R=l(S.clientX,S.clientY);R&&R.element.classList.add("is-drop-target")},B=j=>{if(!v||!g.current||a.current===null)return;j.preventDefault(),j.stopPropagation();const S=j.changedTouches[0],U=l(S.clientX,S.clientY);c.current&&(c.current.style.transform="",c.current.style.zIndex="",c.current.classList.remove("is-dragging")),k.current.forEach(R=>{R&&R.classList.remove("is-drop-target")}),U&&U.index!==a.current&&T(a.current,U.index),a.current=null,c.current=null,g.current=!1},T=(j,S)=>{D(U=>{const R=U.map(K=>({...K})),[V]=R.splice(j,1);return R.splice(S,0,V),R.forEach((K,z)=>{K.rank=z+1}),G(),R})},O=j=>{const S={};j.reduce((U,R)=>(U[R.id]=R.rank,U),S),t({value:S,questionId:i,type:s},!0)},G=()=>{h(!1)},{left:P,right:L}=o,F=u.length,Q=j=>{j.preventDefault(),j.currentTarget.classList.add("is-drop-target")},W=j=>{j.currentTarget.classList.remove("is-drop-target")},ie=j=>{a.current=null,j.currentTarget.classList.remove("is-dragging")};return e.u("form",{className:e.cc(n,"ul-card-rank","fade-in-transition"),onSubmit:j=>{j.preventDefault(),O(f),d&&d()},children:e.u(E.MobileEmbedView,{properties:r,children:A?e.u(e.g,{children:[e.u(E.QuestionBodyWrapper,{children:e.u("div",{className:"ul-card--rank__question-inner-container",children:[e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:["1 - ",P]})}),e.u("ol",{className:"ul-card-rank__list",children:f.map(({id:j,label:S,rank:U})=>e.u("li",{className:"ul-card-rank__option",children:[e.u("select",{"aria-label":`Rank for ${S}`,className:e.cc("ul-card-rank__select",U==null&&"ul-card-rank__select--placeholder"),name:`rank[${j}]`,onChange:R=>w(j,R.currentTarget.value),value:U??"",children:[U==null&&e.u("option",{className:"ul-card-rank__select-option",disabled:!0,value:"",children:"-"}),q.map(R=>e.u("option",{className:"ul-card-rank__select-option",value:R,children:R},`${R}-${i}`))]}),e.u("span",{children:S})]},j))}),e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:[F," - ",L]})})]})}),e.u(E.QuestionBodyFooterContainer,{children:e.u("div",{className:"ul-card__button-wrapper",children:e.u(E.Button,{disabled:C,children:e.getButtonText(r)})})})]}):e.u(e.g,{children:[e.u(E.QuestionBodyWrapper,{children:e.u("div",{className:"ul-card--rank__question-inner-container",children:[e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:["1 - ",P]})}),e.u("ol",{className:"ul-card-rank__list",onDragOver:A?void 0:j=>{j.preventDefault(),j.dataTransfer&&(j.dataTransfer.dropEffect="move")},children:f.map(({id:j,label:S,rank:U},R)=>{return e.u("li",{className:"ul-card-rank__option",draggable:!!b||void 0,onDragEnd:b?ie:void 0,onDragEnter:b?Q:void 0,onDragLeave:b?W:void 0,onDragStart:b?(K=R,z=>{a.current=K,z.dataTransfer&&(z.dataTransfer.effectAllowed="move",z.dataTransfer.setData("text/plain",String(K)),z.currentTarget.classList.add("is-dragging"))}):void 0,onDrop:b?(V=R,z=>{var se,Ee;z.preventDefault(),z.currentTarget.classList.remove("is-drop-target");const $=a.current;a.current=null,(Ee=(se=z.currentTarget.closest(".ul-card-rank__list"))==null?void 0:se.querySelector(".is-dragging"))==null||Ee.classList.remove("is-dragging"),$!=null&&$!==V&&T($,V)}):void 0,ref:z=>k.current[R]=z,children:[e.u("select",{"aria-label":`Rank for ${S}`,className:e.cc("ul-card-rank__select",U==null&&"ul-card-rank__select--placeholder"),name:`rank[${j}]`,onChange:z=>w(j,z.currentTarget.value),value:U??"",children:[U==null&&e.u("option",{className:"ul-card-rank__select-option",disabled:!0,value:"",children:"-"}),q.map(z=>e.u("option",{className:"ul-card-rank__select-option",value:z,children:z},z))]}),e.u("span",{children:S}),!A&&e.u("button",{"aria-label":`Drag ${S} to reorder`,className:"ul-card-rank__drag-btn",onTouchEnd:v?B:void 0,onTouchMove:v?x:void 0,onTouchStart:v?p(R):void 0,title:"Drag to reorder",type:"button",children:e.u("svg",{fill:"none",height:"17",viewBox:"0 0 16 17",width:"16",xmlns:"http://www.w3.org/2000/svg",children:e.u("path",{d:"M5.75 11.625C6.37132 11.625 6.875 12.1287 6.875 12.75C6.875 13.3713 6.37132 13.875 5.75 13.875C5.12868 13.875 4.625 13.3713 4.625 12.75C4.625 12.1287 5.12868 11.625 5.75 11.625ZM10.25 11.625C10.8713 11.625 11.375 12.1287 11.375 12.75C11.375 13.3713 10.8713 13.875 10.25 13.875C9.62868 13.875 9.125 13.3713 9.125 12.75C9.125 12.1287 9.62868 11.625 10.25 11.625ZM5.75 7.375C6.37132 7.375 6.875 7.87868 6.875 8.5C6.875 9.12132 6.37132 9.625 5.75 9.625C5.12868 9.625 4.625 9.12132 4.625 8.5C4.625 7.87868 5.12868 7.375 5.75 7.375ZM10.25 7.375C10.8713 7.375 11.375 7.87868 11.375 8.5C11.375 9.12132 10.8713 9.625 10.25 9.625C9.62868 9.625 9.125 9.12132 9.125 8.5C9.125 7.87868 9.62868 7.375 10.25 7.375ZM5.75 3.125C6.37132 3.125 6.875 3.62868 6.875 4.25C6.875 4.87132 6.37132 5.375 5.75 5.375C5.12868 5.375 4.625 4.87132 4.625 4.25C4.625 3.62868 5.12868 3.125 5.75 3.125ZM10.25 3.125C10.8713 3.125 11.375 3.62868 11.375 4.25C11.375 4.87132 10.8713 5.375 10.25 5.375C9.62868 5.375 9.125 4.87132 9.125 4.25C9.125 3.62868 9.62868 3.125 10.25 3.125Z",fill:"currentColor"})})})]},j);var V,K})}),e.u("div",{className:"ul-card-rank__labels",children:e.u("span",{children:[F," - ",L]})})]})}),e.u(E.QuestionBodyFooterContainer,{children:e.u("div",{className:"ul-card__button-wrapper",children:e.u(E.Button,{disabled:C,children:e.getButtonText(r)})})})]})})},i)},fe=1,$e=2,Ve=3,ce=n=>n.type==="av_permission",Se=n=>n.type==="screen_permission",Fe=(n,o)=>n===void 0?fe:n?((t,r)=>!(ce(r)?r.permissionDescriptors:[]).includes("camera")||t.getVideoTracks().length>0)(n,o)?Ve:fe:$e,Re={avStream:null,currentPage:null,mediaRecordingUids:null,nextQuestion:()=>{},passthroughData:void 0,recordingMediaTypes:void 0,screenPermissionRequested:!1,type:void 0},ee=e.create(n=>({...Re,reset:()=>{n(Re)},updatePage:o=>{n(o)}}));function ye({currentPage:n,pages:o}){const{avStream:t,recordingMediaTypes:r,updatePage:i}=ee.getState(),{recorderEventEmitter:s}=e.useConfig.getState();s.emit("av.permission",{"permission.descriptors":n.permissionDescriptors,"stream.ready":(d,u)=>{if(t===d)return;let a=n;if(d&&!n.permissionDescriptors.includes("camera")){const m=o.indexOf(n),y=u!=null&&u.active?m+2:m+1;u!=null&&u.active&&r&&s.emit("begin.recording",{"recording.media.types":r,"start.recording.callback":c=>i({mediaRecordingUids:c})}),a=o[y]}i({currentPage:a,avStream:d})}})}function Ce({status:n}){const{nextQuestion:o,passthroughData:t,mediaRecordingUids:r,reset:i}=ee.getState(),{recorderEventEmitter:s,handleUploadUpdate:d,index:u}=e.useConfig.getState(),a={value:{taskStatus:n},type:"recordedtask",questionId:(t==null?void 0:t.questionId)||1};t&&s.emit("finish.task",{"begin.callback":m=>{d({mediaRecordingUid:m,isSubmitted:!0,progressPct:0,isComplete:!1})},"progress.callback":(m,y)=>{d({mediaRecordingUid:m,progressPct:y.detail,isSubmitted:!1,isComplete:!1})},"upload.callback":m=>{m&&d({mediaRecordingUid:m,isComplete:!0,isSubmitted:!0,progressPct:100})},"passthrough.data":t,"current.index":u,"task.response":a,"task.complete.callback":m=>{a.value.taskDurationMillisecond=m,r&&(a.value.mediaRecordingUids=r),i(),o(a)}})}function ke({pages:n,setIsRequestingPermission:o}){const{recorderEventEmitter:t,eventEmitFn:r}=e.useConfig.getState(),{updatePage:i,currentPage:s,recordingMediaTypes:d,screenPermissionRequested:u}=ee.getState();if(!s)return;const a=n.indexOf(s);switch(s.type){case"av_permission":{const m=u?a+2:a+1;return u&&d&&t.emit("begin.recording",{"recording.media.types":d,"start.recording.callback":y=>{i({mediaRecordingUids:y})}}),void i({currentPage:n[m]})}case"screen_permission":return void t.emit("screen.permission",{"screen.permission.requested":o,"stream.ready.callback":(m,y)=>{const c=y?n[a+1]:s;y&&d&&t.emit("begin.recording",{"recording.media.types":d,"start.recording.callback":g=>{i({captureStream:y,mediaRecordingUids:g})}}),i({currentPage:c,screenPermissionRequested:!0,captureStream:y})}});case"start_task":return r("recorded.task.start"),t.emit("recorded.task.start"),t.emit("start.task"),void i({currentPage:n[a+1],screenPermissionRequested:!0});case"complete_task":return}}const ze="ul-permission-graphics-container",Qe="ul-permission-body",Ge=e.cc(ze,"ul_recorded-task-inset-spacing"),ue=e.cc("ul-horizontal-button-container","ul-horizontal-button-container-left"),Ze=({richTextBody:n})=>e.u(E.Html,{className:"ul-rich-text-body",html:n,id:"ul-task-detail-container"}),pe=({required:n,skipButtonText:o,bottom:t=!1})=>n?null:e.u(E.Button,{className:e.cc(t&&"ul-skip-button-below","ul-button-inactive"),onClick:Ce.bind(null,{status:"abandoned"}),children:o||"Skip"}),we=n=>{const{avStream:o,captureStream:t,recordingMediaTypes:r,updatePage:i}=ee.getState(),s=(r==null?void 0:r.includes("audio"))||(r==null?void 0:r.includes("video"));e.p(()=>{const d=setInterval(()=>{s&&o&&!o.active?i({avStream:null,currentPage:n[0]}):t&&t.active||i({captureStream:void 0,currentPage:n[s?1:0]})},1e3);return()=>clearInterval(d)},[o,t,s,n,r,i])},gn=({content:n,pages:o,required:t})=>{const{buttonText:r,skipButtonText:i,taskDetail:s}=n;return we(o),e.u("div",{className:"ul-task-page",children:[s&&e.u(Ze,{richTextBody:s}),e.u("div",{className:ue,children:[e.u(E.Button,{onClick:ke.bind(null,{pages:o}),children:r}),e.u(pe,{required:t,skipButtonText:i})]})]},"start-task")},hn=({content:n,pages:o,properties:t})=>{const{buttonText:r,skipButtonText:i}=n;return we(o),e.u("div",{className:"ul-task-page",children:[n.taskDetail&&e.u(Ze,{richTextBody:n.taskDetail}),e.u(E.MobileEmbedView,{properties:t,children:e.u("div",{className:ue,children:[e.u(E.Button,{className:"ul-complete-task-button",onClick:Ce.bind(null,{status:"completed"}),children:r}),e.u(E.Button,{className:e.cc("ul-button-inactive"),onClick:Ce.bind(null,{status:"given.up"}),children:i})]})})]},"complete-task")},bn=({content:n,pages:o,required:t})=>{const{buttonText:r,skipButtonText:i}=n,[s]=e.useConfig(a=>[a.tabTitle]),[d,u]=e.h(!1);return e.u("div",{children:[e.u("div",{className:Ge,children:[e.u("p",{style:{marginTop:"auto"},children:n.selectTabText}),e.u("div",{className:"ul-select-tab-container",children:e.u("p",{className:Qe,children:s})})]}),e.u("div",{className:t?"":ue,children:[e.u(E.Button,{disabled:d,onClick:ke.bind(null,{pages:o,setIsRequestingPermission:u}),children:r}),e.u(pe,{required:t,skipButtonText:i})]})]})},fn=({content:n})=>e.u(E.Html,{className:e.cc(ze,"ul_permission_svg_container","ul_recorded-task-inset-spacing","ul-center-horizontally"),html:n.svg},"ul-permission-request-graphic"),yn=({content:n,pages:o,required:t})=>{const{permissionDeniedHeadline:r,permissionDeniedBody:i,skipButtonText:s,tryAgainButtonText:d}=n,u=ce(o[0])?o[0]:null;return e.p(()=>{const a=setInterval(()=>{u!==null&&ye({currentPage:u,pages:o})},1e3);return()=>clearInterval(a)},[u,o]),u?e.u("div",{children:[e.u("div",{className:Ge,children:e.u("p",{className:"ul-av-permission-denied-paragraph",children:[e.u("span",{className:"ul-av-permission-denied-headline",children:r}),e.u("span",{className:Qe,children:i})]})}),e.u("div",{className:ue,children:[e.u(E.Button,{onClick:ye.bind(null,{currentPage:u,pages:o}),children:d}),e.u(pe,{required:t,skipButtonText:s})]})]}):null},Cn=({stream:n})=>e.u("video",{autoPlay:!0,className:e.cc("ul_recorded-task-inset-spacing"),id:"ul-record-task-video-preview",muted:!0,ref:o=>{o&&(o.srcObject=n||null)}}),xn=({content:n,pages:o,required:t})=>{const{skipButtonText:r}=n,{avStream:i}=ee.getState();return we(o),e.u("div",{children:[e.u(Cn,{stream:i}),e.u("div",{className:"ul-vertical-button-container-center",children:[e.u(E.Button,{onClick:ke.bind(null,{pages:o}),children:n.buttonText}),e.u(pe,{bottom:!0,required:t,skipButtonText:r})]})]})},kn=({properties:n})=>{const{pages:o,required:t}=n,{avStream:r,currentPage:i}=ee.getState();if(i===void 0)return null;switch(i==null?void 0:i.type){case"av_permission":{const s=Fe(r,i);return s===fe?e.u(fn,{content:i}):s===$e?e.u(yn,{content:i,pages:o,required:t}):e.u(xn,{content:i,pages:o,required:t})}case"screen_permission":return e.u(bn,{content:i,pages:o,required:t});case"start_task":return e.u(gn,{content:i,pages:o,required:t});case"complete_task":return e.u(hn,{content:i,pages:o,properties:n});default:return null}},wn=({className:n,properties:o,next:t,questionId:r})=>{const i=e.useConfig(),{surveyId:s,responseGroupUid:d,userId:u}=i,a=ee(),{screenPermissionRequested:m}=a,y=ee(h=>h.avStream);let c=ee(h=>h.currentPage);c||(c=function({pages:h,userId:f,responseGroupUid:D,surveyId:q,questionId:N,next:I}){const{updatePage:H}=ee.getState(),{eventEmitFn:A,recorderEventEmitter:v}=e.useConfig.getState(),b={questionId:N,surveyId:q,visitorId:f,responseGroupUid:D};let w=0;v.emit("recorded.task.permission.screen"),A("recorded.task.permission.screen"),v.emit("permission.status",{"permission.status.callback":(p,x,B,T)=>{const O=h[w],{type:G}=O,P=["screen"];if(ce(O)){const{permissionDescriptors:L}=O,F=L==null?void 0:L.includes("microphone"),Q=L==null?void 0:L.includes("camera");F&&P.push("audio"),Q&&P.push("video"),(p!=null&&p.active&&!Q||p!=null&&p.active&&x)&&w++}Se(h[w])&&B&&(w++,v.emit("begin.recording",{"recording.media.types":P,"start.recording.callback":L=>H({mediaRecordingUids:L})})),H({currentPage:h[w],avStream:p,screenPermissionRequested:B,nextQuestion:I,type:G,passthroughData:b,recordingMediaTypes:P,captureStream:T})}});const l=h[w];return l.type==="av_permission"&&ye({currentPage:l,pages:h}),l}({questionId:r,surveyId:s,next:h=>{t(h,!0)},pages:o.pages,responseGroupUid:d,userId:u}));let g=c.headline,k=c.captionText;const C=Fe(y,c);return Se(c)&&m&&(g=c.permissionDeniedHeadline,k=c.permissionDeniedCaptionText),ce(c)&&C===Ve&&(g=c.permissionGrantedHeadline,k=c.permissionGrantedCaptionText),e.u("div",{className:e.cc(n,"ul-center-horizontally","fade-in-transition"),children:[e.u(E.Header,{isRequired:o==null?void 0:o.required,message:g,properties:{captionText:k}}),e.u(E.QuestionBodyWrapper,{children:e.u(kn,{properties:o})})]})},En=({className:n,next:o,properties:t,questionId:r,type:i})=>{const{visitorAttributes:s,isLongFormSurvey:d}=e.useConfig(y=>({visitorAttributes:y.visitorAttributes,isLongFormSurvey:Y.isLongFormSurvey(y.studyType)})),u=(y,c=!1)=>{o({value:c?{skipped:!0}:void 0,questionId:r,type:i},!0)},a=E.getAttributedUrl(t&&t.buttonUrl,s),m=d&&t.promptActionType===E.PromptActionTypeEnum.NO_BUTTON;return e.u("div",{className:e.cc(n,"ul-card__text-url-prompt","fade-in-transition"),children:e.u(E.MobileEmbedView,{properties:t,children:!m&&e.u("div",{children:e.u("div",{className:"ul-card-button-group",children:[e.u("a",{className:"ul-card-text__button ul-card__text-url-prompt-button",href:a,id:"ul-card-text__button",onClick:u,onKeyPress:y=>{y.key!=="Enter"&&y.key!==" "||o({value:void 0,questionId:r,type:i},!0)},rel:"noreferrer",role:a?"link":"button",tabIndex:0,target:"_blank",children:e.getButtonText(t)}),t.required===!1&&e.u("button",{className:"ul-card-skip__button",onClick:y=>u(0,!0),children:e.getSkipButtonText(t)})]})})})},r)},jn=({className:n,questionId:o})=>{const{border:t,destroy:r,endCard:i,forceBrandedLogo:s}=e.useConfig(a=>({border:a.border,destroy:a.destroy,endCard:a.endCard,forceBrandedLogo:a.forceBrandedLogo}));e.p(()=>{setTimeout(()=>{r(Y.APP_ID)},s?4e3:2e3)},[r,s]);const d=i&&i.subheader?e.u("p",{className:"ul-caption",children:i.subheader}):null,u=i&&i.headline?i.headline:"";return e.u("div",{className:e.cc(n,"ul-card--thanks","fade-in-transition"),children:e.u("div",{children:e.u("div",{className:"ul-card--thanks-content",children:[e.u("div",{className:"ul-thanks-check",children:e.u("svg",{"aria-labelledby":"title",fill:"none",height:"99",viewBox:"0 0 81 99",width:"81",xmlns:"http://www.w3.org/2000/svg",children:[e.u("path",{clipRule:"evenodd",d:"M40.5 77C60.9345 77 77.5 60.4345 77.5 40C77.5 19.5655 60.9345 3 40.5 3C20.0655 3 3.5 19.5655 3.5 40C3.5 60.4345 20.0655 77 40.5 77ZM80.5 40C80.5 62.0914 62.5914 80 40.5 80C18.4086 80 0.5 62.0914 0.5 40C0.5 17.9086 18.4086 0 40.5 0C62.5914 0 80.5 17.9086 80.5 40Z",fill:t,fillRule:"evenodd"}),e.u("path",{clipRule:"evenodd",d:"M55.025 22.9046C55.6299 23.4705 55.6616 24.4198 55.0956 25.0247C54.8724 25.2634 54.6109 25.5285 54.3157 25.8277C52.2547 27.9168 48.5549 31.667 44.8135 39.6658C43.2818 42.9406 42.0864 45.8386 41.0823 48.2729C40.6539 49.3116 40.2603 50.2659 39.8902 51.129C39.287 52.5359 38.7248 53.7508 38.1744 54.625C37.8997 55.0613 37.5806 55.4905 37.2017 55.8245C36.8201 56.1607 36.2613 56.5 35.5457 56.5C34.6742 56.5 34.0892 55.9692 33.7774 55.6083C33.4502 55.2296 33.1752 54.7511 32.9396 54.301C32.7305 53.9013 32.5088 53.4367 32.2797 52.9565C32.2429 52.8794 32.2059 52.8019 32.1688 52.7243C31.8942 52.1499 31.5959 51.534 31.2537 50.8868C29.8886 48.305 27.8539 45.2878 24.2343 43.1382C23.522 42.7152 23.2875 41.7949 23.7105 41.0826C24.1335 40.3703 25.0539 40.1358 25.7662 40.5588C30.0556 43.1062 32.4149 46.6647 33.9058 49.4845C34.2776 50.1876 34.5973 50.8487 34.8753 51.4302C34.9147 51.5124 34.9529 51.5926 34.9902 51.6707C35.2222 52.1567 35.4164 52.5637 35.5978 52.9102C35.6151 52.9434 35.6321 52.9754 35.6485 53.0061C36.0565 52.3531 36.5341 51.3434 37.133 49.9468C37.4781 49.1418 37.8572 48.2229 38.2761 47.2074C39.2886 44.7532 40.5339 41.7347 42.0961 38.3948C46.0591 29.9221 50.0641 25.8648 52.1535 23.7482C52.4423 23.4556 52.6944 23.2002 52.9048 22.9753C53.4708 22.3703 54.42 22.3387 55.025 22.9046ZM35.1994 53.5892C35.1994 53.5892 35.2 53.5888 35.2012 53.5879C35.2 53.5889 35.1994 53.5893 35.1994 53.5892ZM36.0666 53.6682C36.0732 53.674 36.0765 53.6775 36.0765 53.6777C36.0765 53.678 36.0732 53.6751 36.0666 53.6682Z",fill:t,fillRule:"evenodd"}),e.u("path",{d:"M69.5 97C69.5 98.1046 56.2924 99 40 99C23.7076 99 10.5 98.1046 10.5 97C10.5 95.8954 23.7076 95 40 95C56.2924 95 69.5 95.8954 69.5 97Z",fill:"black",fillOpacity:"0.2"})]})}),e.u(E.Header,{message:u}),d]})})},o)},Tn=()=>e.u("div",{className:"thinking-dots-container",children:e.u("div",{className:"thinking-dot"})}),_n=({className:n})=>{const{uploadProgress:o}=e.useConfig(s=>({uploadProgress:s.uploadProgress}));let t,r;Object.values(o).filter(s=>s.isSubmitted).length>1?(t="Your responses are processing",r="Please keep this tab open until your responses are fully processed."):(t="Your response is processing",r="Please keep this tab open until your response is fully processed.");const i=Math.round(Math.min(99,...Object.values(o).filter(s=>s.isSubmitted).map(s=>s.progressPct||0)));return e.u("div",{className:e.cc(n,"ul-card--uploading","fade-in-transition"),children:[e.u("div",{"aria-busy":"true","aria-label":"Processing...","aria-live":"polite",className:"ul-loading-spinner-container",role:"progressbar",children:e.u("div",{className:"ul-loading-spinner",children:[e.u("div",{className:"first"}),e.u("div",{className:"second"}),e.u("div",{className:"third"}),e.u("div",{className:"fourth"})]})}),e.u(E.Header,{message:`${t} (${i}% complete)`}),e.u("p",{className:"ul-caption",children:r})]})},Be=0,Pe=1,In=({className:n,next:o,properties:t,questionId:r,type:i})=>{const s=`ul-card-video__player_recorder-q${r}`,{apiURL:d,envId:u,handleUploadUpdate:a,headers:m,responseGroupUid:y,surveyId:c,viewDocument:g,visitorId:k}=e.useConfig(b=>({apiURL:b.apiURL,envId:b.envId,handleUploadUpdate:b.handleUploadUpdate,headers:b.headers,responseGroupUid:b.responseGroupUid,surveyId:b.surveyId,viewDocument:b.viewDocument,visitorId:b.userId})),[C,h]=e.h(!1),[f,D]=e.h(null),[q,N]=e.h(null),[I,H]=e.h(Be),A=(b,w)=>{b===M.UPLOAD_STARTED?(D(w[M.UPLOAD_ID]),N(w[M.MEDIA_RECORDING_UID]),h(!0)):b===M.DELETE?(D(null),N(null),h(!1)):b===M.UPLOAD_PROGRESS?isNaN(w[M.UPLOAD_PROGRESS_PCT])?a({mediaRecordingUid:w[M.MEDIA_RECORDING_UID],isComplete:!0}):a({mediaRecordingUid:w[M.MEDIA_RECORDING_UID],progressPct:w[M.UPLOAD_PROGRESS_PCT]}):b===M.UPLOAD_FINISHED&&a({mediaRecordingUid:w[M.MEDIA_RECORDING_UID],isComplete:!0})},v=b=>{b.preventDefault(),b.stopPropagation(),document.getElementById(s)&&(w=>{const l=w+_e;if(_.document.getElementById(l)&&_.videojs){try{if(!_.videojs(l).record().stream)return}catch{return}_.videojs(l).record().stop(),_.videojs(l).record().stopDevice()}})(s),f&&q?(a({mediaRecordingUid:q,isSubmitted:!0}),o({value:{mediaRecordingUid:q},questionId:r,type:i},!0)):o({value:null,questionId:r,type:i},!0)};return e.u("form",{className:e.cc(n,"ul-card--video","fade-in-transition"),id:"ul-video-interview-form",children:[e.u(E.QuestionBodyWrapper,{children:[e.u("div",{id:"ul-question-player-container",style:{display:I===Be?"":"none"},children:e.u(E.MobileEmbedView,{properties:t,children:e.u("button",{className:"ul-video-btn ul-record-response-btn",onClick:b=>{b.preventDefault(),b.stopPropagation(),document.getElementById(s)&&(w=>{const l=de(w+Me);l==null||l.pause()})(s),H(Pe)}})})}),e.u("div",{style:{display:I===Pe?"block":"none"},children:e.u("div",{id:"ul-recorder-player-container",ref:b=>{if(b&&b.children.length===0){const w=((l,p={},x="https://api.userleap.com",B,T,O,G=!1,P=document)=>{_.document=P;const L=l+_e,F=Ae(L);return _.document.addEventListener("securitypolicyviolation",Q=>{ne(new Error(`Voice & Video feature violates ${Q.violatedDirective} web page CSP policies for the recorder player.`),"recorderDeviceError",x,O,p.visitorId,p.envId)}),Ne(Le.concat(Ye),()=>{be(L,F),_.document.getElementById(xe(L)).remove();try{Je(F,L,p,x,B,T,O,G)}catch(Q){return void ne(new Error(`Error when creating video recorder player object ${Q}`),"recorderDeviceError",x,O,p.visitorId,p.envId)}}),F})(s,{surveyId:c,responseGroupUid:y,questionId:r,visitorId:k,envId:u},d,A,void 0,{...m,"x-ul-video-recorder-origin":"sdk"},t.mediaType===M.MEDIA_TYPE_AUDIO,g);b.appendChild(w)}}})})]}),e.u(E.QuestionBodyFooterContainer,{children:[e.u(oe,{isDisabled:!!t.required&&!C,onClick:v,children:e.getButtonText(t)}),e.u("button",{className:"ul-card-text__button ul-button-inactive ul-card-skip__button",id:"ul-card-video__skip_button",onClick:v,style:{...t.required?{display:"none"}:{},...C?{display:"none"}:{}},children:e.getSkipButtonText(t)})]})]})},We=n=>n.type==="thanks"||n.type==="uploading",Dn=({card:n,avatars:o,isThinking:t,isCurrentQuestion:r,currentQuestionBubbleRef:i})=>{const s=(d=>"properties"in d.props&&d.props.properties&&"questionHtml"in d.props.properties&&d.props.properties.questionHtml?{content:d.props.properties.questionHtml,isHtml:!0}:"message"in d.props?{content:d.props.message,isHtml:!1}:{content:"Question",isHtml:!1})(n);return e.u(ae,{avatars:o,isLeft:!0,message:{id:`question-${n.name}`,type:"question",content:s.content},ref:r?i:null,children:t?e.u(Tn,{}):e.u(e.g,{children:[s.isHtml?e.u(E.Html,{className:"chat-message-text",html:s.content}):e.u("div",{className:"chat-message-text",children:s.content}),n.type==="videovoice"&&e.u(tn,{properties:n.props,questionId:n.name,surveyVideoUrl:n.props.properties.videoUrl})]})})},Sn=({card:n,avatars:o})=>{const t=(r=>{if(!("properties"in r.props)||!r.props.properties||typeof r.props.properties!="object")return null;const i=r.props.properties,s=[{key:"captionHtml",isHtml:!0},{key:"captionText",isHtml:!1},{key:"richTextBody",isHtml:!0},{key:"body",isHtml:!1}];for(const{key:d,isHtml:u}of s){const a=i[d];if(typeof a!="string")continue;const m=a.trim();if(m){if(u&&!m.replaceAll(/<[^>]*>/g,"").trim())continue;return{content:m,isHtml:u}}}return null})(n);return t?e.u(ae,{avatars:o,hideAvatar:!0,isLeft:!0,message:{id:`caption-${n.name}`,type:"question",content:t.content},children:t.isHtml?e.u(E.Html,{className:"chat-message-text",html:t.content}):e.u("div",{className:"chat-message-text",children:t.content})}):null},Rn=({card:n,userResponse:o,avatars:t})=>{const r=((i,s)=>{if(i.type==="open"&&s&&typeof s=="object"&&"value"in s)return s.value})(n,o);return e.u("div",{className:"chat-bubble-container chat-right",children:[e.u("div",{className:"chat-bubble chat-bubble-right chat-bubble-text-only",children:e.u("div",{className:"chat-message-text",children:r||e.u("div",{className:"chat-message-no-response",children:"No response"})})}),e.u("img",{alt:"User Avatar",className:"chat-avatar chat-avatar-right",srcSet:`${t.respondentAvatar["1x"]} 1x, ${t.respondentAvatar["2x"]} 2x`})]})},Bn=({card:n,avatars:o,isCurrentQuestion:t,currentQuestionBubbleRef:r})=>{const{endCard:i}=e.useConfig(s=>({endCard:s.endCard}));return e.u(e.g,{children:[e.u(ae,{avatars:o,isLeft:!0,message:{id:`thanks-${n.name}`,type:"question",content:(i==null?void 0:i.headline)??"Great! Thank you for your participation."},ref:t?r:null}),(i==null?void 0:i.subheader)&&e.u(ae,{avatars:o,hideAvatar:!0,isLeft:!0,message:{id:`caption-${n.name}`,type:"question",content:i.subheader}}),e.u(on,{})]})},Pn=({card:n,cardIndex:o,index:t,avatars:r,cardResponses:i,questionThinkingStates:s,startingQuestionIdx:d,currentQuestionBubbleRef:u,handleCardResponse:a})=>{const m=o===t,y=o<t,c=We(n);if(c)return e.u(Bn,{avatars:r,card:n,currentQuestionBubbleRef:u,isCurrentQuestion:m});const g=`${n.name}`,k=i.get(g),C=n.type==="open",h=s.get(g);if(n.type==="aidynamicfollowup"&&(n.props.loading===null||n.props.loading===void 0))return e.u(e.g,{});const f=o>(d??0)&&n.type!=="thanks"&&n.type!=="uploading"&&(h===!0||h===void 0);return e.u(e.wn.Fragment,{children:[e.u(Dn,{avatars:r,card:n,currentQuestionBubbleRef:u,isCurrentQuestion:m,isThinking:f}),!f&&e.u(Sn,{avatars:r,card:n}),y&&C?e.u(Rn,{avatars:r,card:n,userResponse:k}):(!y||!C)&&!f&&e.u(ae,{avatars:r,isLeft:!1,message:{id:`card-${n.name}`,type:"card",content:""},children:e.u("div",{className:"chat-card-container",children:e.u(Mn,{card:n,className:c?"chat-thanks-card":"chat-card",isAnswered:y,next:m?a:()=>{}})})})]},`question-card-${n.name}`)},ae=e.wn.forwardRef(({message:n,isLeft:o=!1,children:t,avatars:r,hideAvatar:i=!1},s)=>{const d=o?"chat-bubble-left":"chat-bubble-right";return e.u("div",{className:`chat-bubble-container ${o?"chat-left":"chat-right"}${o&&i?" chat-no-avatar":""}`,ref:s,children:[o&&!i&&e.u("img",{alt:"AI Avatar",className:"chat-avatar chat-avatar-left",srcSet:`${r.agentAvatar["1x"]} 1x, ${r.agentAvatar["2x"]} 2x`}),e.u("div",{className:`chat-bubble ${d}`,children:t||e.u("div",{className:"chat-message-text",children:n.content})}),!o&&!i&&e.u("img",{alt:"User Avatar",className:"chat-avatar chat-avatar-right",srcSet:`${r.respondentAvatar["1x"]} 1x, ${r.respondentAvatar["2x"]} 2x`})]})});ae.displayName="ChatBubble";const Ln=()=>{const n=e.useConfig(t=>t.close),o=e.F(()=>()=>n(Y.APP_ID),[n]);return e.u("div",{"aria-label":"Close button",className:"conversational-close-btn",onClick:o,onKeyPress:t=>{t.key==="Enter"&&o()},role:"button",tabIndex:0,children:e.u("svg",{fill:"none",height:"16px",viewBox:"0 0 13 13",width:"16px",xmlns:"http://www.w3.org/2000/svg",children:e.u("path",{d:"M2.54964 1.78369L1.78369 2.54964L5.73405 6.5L1.78369 10.4504L2.54964 11.2163L6.5 7.26595L10.4504 11.2163L11.2163 10.4504L7.26595 6.5L11.2163 2.54964L10.4504 1.78369L6.5 5.73405L2.54964 1.78369Z",fill:"#262136"})})})},Mn=({card:n,next:o,className:t="",isAnswered:r=!1})=>{const i={className:r?`${t} answered-card`:t,next:r?()=>{}:o,questionId:n.name,type:n.type,isAnswered:r};switch(n.type){case"consentlegal":return e.u(rn,{...i,...n.props});case"likert":return e.u(an,{...i,...n.props});case"matrix":return e.u(dn,{...i,...n.props});case"multiplechoice":return e.u(cn,{...i,...n.props});case"multipleselect":return e.u(un,{...i,...n.props});case"nps":return e.u(pn,{...i,...n.props});case"aidynamicfollowup":case"open":return e.u(mn,{...i,type:n.type,...n.props});case"rankorder":return e.u(vn,{...i,...n.props});case"recordedtask":return e.u(wn,{...i,...n.props});case"texturlprompt":return e.u(En,{...i,...n.props});case"thanks":return e.u(jn,{...i,...n.props});case"uploading":return e.u(_n,{...i,...n.props});case"videovoice":return e.u(In,{...i,...n.props});default:return null}};exports.default=({cards:n,next:o,previousResponses:t})=>{const{cardResponses:r,setCardResponse:i}=(()=>{const[v,b]=e.h(new Map);return{cardResponses:v,setCardResponse:e.T((w,l)=>{b(p=>new Map(p).set(w,l))},[])}})(),{index:s,isLongFormSurvey:d,avatars:u,showSurveyBrand:a,forceBrandedLogo:m,marketingUrlLink:y,startingQuestionIdx:c,viewDocument:g,createDynamicQuestion:k,update:C}=e.useConfig(v=>({index:v.index,isLongFormSurvey:Y.isLongFormSurvey(v.studyType),avatars:v.avatars,forceBrandedLogo:v.forceBrandedLogo,startingQuestionIdx:v.startingQuestionIdx,showSurveyBrand:v.showSurveyBrand,marketingUrlLink:e.buildMarketingUrl({marketingUrl:v.marketingUrl,slugName:v.slugName,surveyId:v.surveyId,forceBrandedLogo:v.forceBrandedLogo}),viewDocument:v.viewDocument,createDynamicQuestion:v.createDynamicQuestion,update:v.update})),{currentQuestionBubbleRef:h,scrollToCurrentQuestion:f}=(({viewDocument:v})=>{const b=e._(null),w=e.T(()=>{const l=v.querySelector(".ul-card-main-content");if(b.current&&l&&l instanceof HTMLElement){const p=b.current.offsetTop-l.offsetTop-16;l.scrollTo({top:Math.max(0,p),behavior:"smooth"})}},[]);return{currentQuestionBubbleRef:b,scrollToCurrentQuestion:w}})({viewDocument:g}),D=((v,b,w)=>{const[l,p]=e.h(new Map);return e.p(()=>{if(v.length>0&&b<v.length){const x=v[b],B=`${x.name}`,T=P=>P.type==="aidynamicfollowup",O=P=>{var L;if(b>0){const F=v[b-1];if(T(F)){const Q=`${F.name}`,W=!!((L=F.props)!=null&&L.loading);if(P.get(Q)!==W)return new Map(P).set(Q,W)}}return P};if(b<=(w??0)||We(x))return p(P=>O(new Map(P).set(B,!1)));p(P=>{const L=!T(x)||!!x.props.loading;return O(new Map(P).set(B,L))});const G=setTimeout(()=>{p(P=>{const L=!!T(x)&&!!x.props.loading;return O(new Map(P).set(B,L))})},1e3);return()=>clearTimeout(G)}},[b,v,w]),l})(n,s,c),q=((v,b)=>{const[w,l]=e.h(()=>new Set([v]));return e.p(()=>{l(p=>new Set(p).add(v))},[v]),e.p(()=>{const p=b??0;p>0&&l(x=>{const B=new Set(x);for(let T=0;T<=p;T++)B.add(T);return B})},[b]),w})(s,c),N=e.F(()=>({...t,...e.buildReadableResponseMap(n.map((v,b)=>{var w,l;return{...v,value:b<s?((w=r.get(`${v.name}`))==null?void 0:w.value)??null:null,secondaryValue:b<s?((l=r.get(`${v.name}`))==null?void 0:l.secondaryValue)??null:null}}))}),[t,r,n,s]);e.useSetAllResponsesRaw(N);const I=e.pipeReadableResponsesIntoCards(n,N);e.p(()=>{requestAnimationFrame(()=>{f()}),C()},[s,f,D,C]);const H=e.T((v,b)=>{if(!b)return;const w=I[s];if(!w)return;const l=`${w.name}`;i(l,v);const p={...v,questionText:e.getProcessedQuestionText(w)};if(w.childId&&(p==null?void 0:p.value)!=null){const x=e.buildReadableResponseMap([w].map(B=>({...B,value:(p==null?void 0:p.value)??null,secondaryValue:(p==null?void 0:p.secondaryValue)??null})));k({parentQuestionId:w.name,parentResponseConfig:x})}o([p])},[I,s,o,i]),A=I.map((v,b)=>({card:v,cardIndex:b})).filter(({cardIndex:v})=>q.has(v));return e.u("div",{className:"conversational-ui ul-conversational-ui","data-testid":"ui-container",children:[!d&&e.u(Ln,{}),e.u("div",{className:"chat-container",children:e.u("div",{className:"chat-messages",children:A.map(({card:v,cardIndex:b})=>e.u(Pn,{avatars:u,card:v,cardIndex:b,cardResponses:r,currentQuestionBubbleRef:h,handleCardResponse:H,index:s,questionThinkingStates:D,startingQuestionIdx:c},`question-card-${v.name}`))})}),d&&e.u("div",{className:"long-form-question-footer-container-logo",children:a&&e.u(e.SprigBrandLogo,{forceBrandedLogo:m,marketingUrlLink:y})})]})};
|