"use strict";(self.webpackChunkhhgDiscoverV1=self.webpackChunkhhgDiscoverV1||[]).push([[3734],{EE8p:function(e,t,n){n.r(t),n.d(t,{KEY_OF_TEXT_CHOICE_WITH_OTHER_FIELD:function(){return ek},Markdown:function(){return Markdown},PATHS:function(){return ex},SubotInline:function(){return SubotInline},SubotInlineIntentBase:function(){return e5},SubotInlineIntentBaseTarget:function(){return e6},SubotInlineRevampWithTheme:function(){return SubotInlineRevampWithTheme},SubotInlineVoucherLeftUI:function(){return SubotInlineVoucherLeftUI},TIME_RESET_RESEND_OTP:function(){return M.T},UserInfoForm:function(){return UserInfoForm},checkMobile:function(){return M.h},checkSyncDataOnFrisoCampaign:function(){return checkSyncDataOnFrisoCampaign},checkUntilFinished:function(){return M.c},clickAndOpenInNewTab:function(){return M.i},computeExtraSettingsForBot:function(){return computeExtraSettingsForBot$1},default:function(){return ContainerWithProvider},detectToSkipNodeStart:function(){return detectToSkipNodeStart},extractUnifiedAnswers:function(){return extractUnifiedAnswers},extractVoucherAnswers:function(){return extractVoucherAnswers},formatUrlWithEncrypedGa:function(){return M.j},getColorWithOpacity:function(){return getColorWithOpacity},getCurrentTotalDynamicScore:function(){return getCurrentTotalDynamicScore},getDynamicScore:function(){return getDynamicScore},getHelloSitesUrl:function(){return M.g},getHhgIdFromCookie:function(){return M.l},getPreviousStateFromStorage:function(){return getPreviousStateFromStorage},getSubotApiPath:function(){return getSubotApiPath},getSubotCookieId:function(){return M.d},getSubotInlineLogs:function(){return getSubotInlineLogs},getUserIdFromCookie:function(){return M.b},getUserInfoFromCookie:function(){return M.e},getWindowId:function(){return M.f},handleFrisoRedirecition:function(){return handleFrisoRedirecition},hexRgb:function(){return hexRgb},isFakeEmail:function(){return M.k},overrideParamsByQuery:function(){return M.o},replaceTextWithVariables:function(){return replaceTextWithVariables},saveSubotInlineLogs:function(){return saveSubotInlineLogs},ssoIntents:function(){return M.s},subotInlineClick:function(){return subotInlineClick$1},subotInlineFirstNode:function(){return subotInlineFirstNode$1},subotInlineImpression:function(){return subotInlineImpression$1},subotInlineMessage:function(){return subotInlineMessage$1}});var i,l,o,a,r,s,d,c,u,m,p,v,g,b,f,h=n("+OUp"),_=n.n(h),E=n("HG5m"),x=n("vEfc"),y=n("+u84"),w=n("JIJ2"),I=n("Sn6X"),S=n.n(I),C=n("KYiY"),O=n.n(C),k=n("d/ZZ"),N=n("gY0P"),T=n.n(N),M=n("6jXX"),A=n("8BcA"),$=n.n(A),P=n("xrdX"),B=n("vH4S"),L=n("xXM3"),j=n.n(L),R=n("cSIu"),U=n("wo9K"),D=n("O1Tr"),F=n("rBCA"),G=n("CL9C"),H=n("abax"),z=n("h4z8"),V=n("VLUI"),q=n("O/o9"),W=n("Wbba"),Y=n("s3Wo"),X=n.n(Y),K=n("2O1/"),J=n("hHL7"),Z=n("uzh1"),Q=n("iBNF"),ee=n("GOBr"),et=n("aHnw"),en=n("E+oP"),ei=n.n(en),el=n("wUmw"),eo=n("A9bs"),ea=n("GcSG"),er=n("uG5L"),es=n("gEnE"),ed=n("4BRW"),ec=n("964S"),eu=n("tuDO"),em=n("UcVs"),ep=n("D7zM"),ev=n("Xanp"),eg=n("fvfU"),eb=n("oOSY"),ef=n("YHQg"),eh=n("+YhV"),e_=n("U+Ez");n("NmYn");let eE=S().extend(O()),ex={POST_VERIFY_SMS_OTP:"sms/update-phone",POST_SEND_OTP:"sms/otp",POST_SEND_OTP_WHATSAPP:"whatsapp/otp",POST_VERIFY_OTP:"sms/verify",POST_VERIFY_OTP_WHATSAPP:"sms/verify-whatsapp",GET_LANDING_PAGE_FIRST_NODE:"landing_page/bot",GET_LANDING_PAGE_NEXT_NODE:"landing_page/messages",POST_LANDING_PAGE_IMPRESSION:"landing_page/impressions",POST_LANDING_PAGE_CLICK:"landing_page/clicks",GET_INLINE_FIRST_NODE:"bots",GET_INLINE_MESSAGE:"inline/messages",GET_INLINE_IMPRESSION:"inline/impressions",GET_INLINE_CLICK:"inline/clicks",GET_SUBOT_LOG:"log/bot/{botId}/{cookieId}/{accountId}?type={type}",POST_SUBOT_CREATE_LOG:"log/bot",FETCH_URL_DATA:"preview",GET_VOUCHER_QUANTITY:"vouchers/total_quantity?search={search}&client_id={clientId}"},ey={cached:{},clearCached:e=>{console.log(ey.cached),Object.keys(ey.cached).filter(t=>t.startsWith(e)).forEach(e=>{console.log(e),ey.cached[e]=void 0})},withCached:(e,t)=>(0,x._)(void 0,void 0,void 0,function*(){if("waitingTheFirstResponse"===ey.cached[e])return new Promise(t=>{let n=new Date().getTime(),i=setInterval(()=>{let l=new Date().getTime();l-n>3e3&&clearInterval(i),"object"==typeof ey.cached[e]&&(t(ey.cached[e]),clearInterval(i))},100)});if("object"==typeof ey.cached[e])return ey.cached[e];ey.cached[e]="waitingTheFirstResponse";try{let n=yield t();return ey.cached[e]=n,setTimeout(()=>{ey.cached[e]=void 0},18e5),n}catch(t){return ey.cached[e]=void 0,Promise.reject(t)}})},getSubotApiPath=(e,t)=>{let{subotApiUrl:n}=null===k.G||void 0===k.G?void 0:k.G.env,i=n.endsWith("frontend/api/")?n:n+"frontend/api/";return i+T()(e,Object.assign({},t))},subotInlineMessage$1=e=>(0,x._)(void 0,void 0,void 0,function*(){try{return yield(0,k.c)(getSubotApiPath(ex.GET_INLINE_MESSAGE),"POST",{data:e})}catch(e){}}),computeExtraSettingsForBot$1=e=>{var t;if((null==e?void 0:e._status)===1&&(null===(t=null==e?void 0:e._data)||void 0===t?void 0:t.extra_settings))try{let t=JSON.parse(e._data.extra_settings);"object"==typeof t?e._data.extra_settings=t:e._data.extra_settings={sync_data_friso_campaign:!1}}catch(t){e._data.extra_settings={sync_data_friso_campaign:!1}}return e},subotInlineFirstNode$1=e=>(0,x._)(void 0,void 0,void 0,function*(){try{let t=yield ey.withCached("SubotInlineFirstNode/"+e,()=>(0,x._)(void 0,void 0,void 0,function*(){let t=yield(0,k.c)(getSubotApiPath(ex.GET_INLINE_FIRST_NODE)+`/${e}`,"GET");return computeExtraSettingsForBot$1(t),t}));return t}catch(e){return null}}),subotInlineClick$1=e=>(0,x._)(void 0,void 0,void 0,function*(){try{return yield(0,k.c)(getSubotApiPath(ex.GET_INLINE_CLICK),"POST",{data:e})}catch(e){}}),subotInlineImpression$1=e=>(0,x._)(void 0,void 0,void 0,function*(){try{return yield(0,k.c)(getSubotApiPath(ex.GET_INLINE_IMPRESSION),"POST",{data:e})}catch(e){}}),calcAge=e=>{let t=$()(e),n=$()();return{birthDate:t,today:n,age:n.diff(t,"year")}},validateAge=(e,t,n)=>{let{birthDate:i,today:l}=calcAge(e);if(!n||!n.length)return!0;let o=l.diff(i,"M")/12;if(o<0||0===o&&l.date(){try{return e.dynamic_score||{}}catch(e){return{}}},getCurrentTotalDynamicScore=(e,t,n,i)=>{let l=getDynamicScore(e[0]);if(!t)return{};let o=e.findIndex(e=>e.id==t),a=e.reduce((e,a,r)=>{var s,d;if(r>o)return e;let c=n&&a.id===t?{action_id:n}:a._message,u=0,m=null===(s=a.actions)||void 0===s?void 0:s.find(e=>e.id===(null==c?void 0:c.action_id));u+=(null==m?void 0:m.score)||0;let p=void 0!==l[a.id],v=n&&a.id===t?i:null==c?void 0:c.form_submit_meta;if(p&&a.type===E.d.FORM&&v){let e=l[a.id].action_ids.map(e=>e.id),t=l[a.id].action_ids.map(e=>e.variableName),n=l[a.id].formula,i=null===(d=a.actions)||void 0===d?void 0:d.filter(t=>e.includes(t.id)),o=v.filter(e=>i.find(t=>t.key===e.key)&&(e.control===E.E[E.f.USER_SUBMIT_NUMBER]||e.control===E.E[E.f.USER_SUBMIT_DOB])),r=t.map((t,n)=>{let l=e[n],a=i.find(e=>e.id===l),r=o.find(e=>(null==a?void 0:a.key)===e.key&&(e.control===E.E[E.f.USER_SUBMIT_NUMBER]||e.control===E.E[E.f.USER_SUBMIT_DOB]));if(!r)return"";if(r.control===E.E[E.f.USER_SUBMIT_DOB]){let{age:e}=calcAge($()(r.value).toDate());return`var ${t} = ${e};`}return`var ${t} = ${r.value};`}).join("");try{let e=Function(`${r} return ${n}`)();isNaN(e)||(u+=Math.round(e))}catch(e){}}return e+u},0);return{current_total_dynamic_score:a}},replaceTextWithVariables=(e,t)=>{let n=getDynamicScore(t[0]);try{let i=t.filter(e=>e.type===E.d.FORM);Object.keys(n).forEach(t=>{var l,o,a;let r=i.find(e=>e.id===t),s=n[t].action_ids.map(e=>e.id),d=n[t].action_ids.map(e=>e.variableName),c=n[t].formula,u=null===(l=null==r?void 0:r.actions)||void 0===l?void 0:l.filter(e=>s.includes(e.id)),m=null===(a=null===(o=null==r?void 0:r._message)||void 0===o?void 0:o.form_submit_meta)||void 0===a?void 0:a.filter(e=>u.find(t=>t.key===e.key)&&(e.control===E.E[E.f.USER_SUBMIT_NUMBER]||e.control===E.E[E.f.USER_SUBMIT_DOB]));if(n[t].formula&&n[t].formula_result_name&&(null==m?void 0:m.length)){let i=d.map((e,t)=>{let n=s[t],i=u.find(e=>e.id===n),l=m.find(e=>(null==i?void 0:i.key)===e.key&&(e.control===E.E[E.f.USER_SUBMIT_NUMBER]||e.control===E.E[E.f.USER_SUBMIT_DOB]));return l?`var ${e} = ${l.value};`:""}).join(""),l=Function(`${i} return ${c}`)(),o=n[t].formula_result_name;if(!isNaN(l)&&e.includes(`{{var:${o}}}`)){let t=RegExp(`{{var:${o}}}`,"g");e=e.replace(t,String(Math.floor(100*l)/100))}}}),i.map(t=>{var n,i;null===(i=null===(n=t._message)||void 0===n?void 0:n.form_submit_meta)||void 0===i||i.map(t=>{let n=t.key,i=t.value,l=RegExp(`{{var:${n}}}`,"g");e=e.replace(l,i)})})}catch(e){console.log("[replaceTextWithVariables]",e)}return e},ew="a-f\\d",eI=`#?[${ew}]{3}[${ew}]?`,eS=`#?[${ew}]{6}([${ew}]{2})?`,eC=RegExp(`[^#${ew}]`,"gi"),eO=RegExp(`^${eI}$|^${eS}$`,"i");function hexRgb(e,t){if("string"!=typeof e||eC.test(e)||!eO.test(e))throw TypeError("Expected a valid hex string");e=e.replace(/^#/,"");let n=1;8===e.length&&(n=Number.parseInt(e.slice(6,8),16)/255,e=e.slice(0,6)),4===e.length&&(n=Number.parseInt(e.slice(3,4).repeat(2),16)/255,e=e.slice(0,3)),3===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]);let i=Number.parseInt(e,16),l="number"==typeof t.alpha?t.alpha:n;return[i>>16,i>>8&255,255&i,l]}let ek="other",eN="stateInlineSSO",getPreviousStateFromStorage=(e,{getParams:t})=>{try{if(!(0,M.b)())return null;let n=JSON.parse(localStorage.getItem(eN)||"");if((null==n?void 0:n.botId)===e&&n.listNodes&&n.activeId&&n.createdAt+18e5>Date.now()){localStorage.removeItem(eN);let e=n.listNodes.slice(-1)[0].position===E.c.SSO;if(e)return{listNodes:n.listNodes,activeId:n.activeId,params:Object.assign(Object.assign(Object.assign({},t()),n.params),{account_id:(0,M.b)()||null,cookie_id:(0,M.d)(n.params.cookie_id)})}}return null}catch(e){return null}},getSubotInlineLogs=e=>(0,x._)(void 0,void 0,void 0,function*(){var t,n;try{if(!e)return null;let i=yield(0,k.c)(getSubotApiPath(ex.GET_SUBOT_LOG,{botId:e.id,cookieId:(0,M.d)(),accountId:(0,M.b)()||"",type:"inline"}),"GET");if(!(null===(t=null==i?void 0:i._data)||void 0===t?void 0:t.data)||(null===(n=null==i?void 0:i._data)||void 0===n?void 0:n.type)!=="inline")return null;let l=JSON.parse(i._data.data),o=l.nodes,a="in_progress"===i._data.status,r="complete"===i._data.status;if(a||r)return{nodes:[e,...o],activeId:l.activeId,params:Object.assign(Object.assign({},l.params),{account_id:(0,M.b)()||l.params.account_id||null})};return null}catch(e){return null}}),getExtraLogsWithCarePath=()=>{try{let e=window.next,t=e.router.components["/[...slug]"].props.pageProps,n="services-connection"===t.template;if(!n)return{};return{project_id:"care-path",user_funnel:t.spotlight.additionalSlugActive||"",audience_name:t.spotlight.groupIdActive||""}}catch(e){return{}}},extractUnifiedAnswers=e=>{let t=e.filter(e=>"Unified Questions"===e.name),n=t.reduce((e,t)=>{var n,i,l,o,a,r,s,d,c,u,m,p,v,g,b,f,h,_,x,y,w;if(t.actions&&(null===(n=t._message)||void 0===n?void 0:n.action_id)&&(null===(i=t._message)||void 0===i?void 0:i.action_value)){let n=t._message.action_value;if(t.type===E.d.FORM){let n=["address","province","district","commune"],i=((null===(l=t._message)||void 0===l?void 0:l.form_submit_meta)||[]).filter(e=>!n.includes(e.control)),m=((null===(o=t._message)||void 0===o?void 0:o.form_submit_meta)||[]).filter(e=>n.includes(e.control)).reduce((e,t)=>(e[t.control]=t,e),{}),p=[null===(a=m.address)||void 0===a?void 0:a.value,null===(r=m.commune)||void 0===r?void 0:r.value,null===(s=m.district)||void 0===s?void 0:s.value,null===(d=m.province)||void 0===d?void 0:d.value].filter(Boolean).join(", ");p&&m.address?e.push({attribute:m.address.key,value:p,label_question:(null===(u=null===(c=t.intents)||void 0===c?void 0:c[0])||void 0===u?void 0:u.label)||""}):i.forEach(n=>{var i,l;e.push({attribute:n.key,value:n.value,label_question:(null===(l=null===(i=t.intents)||void 0===i?void 0:i[0])||void 0===l?void 0:l.label)||""})})}if(t.type===E.d.TEXT){if(t.is_multi_select){let n=Object.keys(t._message.selected_actions||{}),i=t.actions.filter(e=>e.label&&n.includes(e.id)).map(e=>e.label);n.length&&e.push({attribute:t.actions[0].key||"",value:i,label_question:(null===(p=null===(m=t.intents)||void 0===m?void 0:m[0])||void 0===p?void 0:p.label)||""})}else{let i=t._message.action_id,l=t.actions.find(e=>e.id===i),o=null==l?void 0:l.label,a=null===(b=null===(g=null===(v=t._message)||void 0===v?void 0:v.form_submit_meta)||void 0===g?void 0:g.find(e=>e.key===ek))||void 0===b?void 0:b.value,r=(null==l?void 0:l.type)===E.f.USER_CHOICE_TEXT_BY_INPUT;o&&i&&e.push({attribute:n,value:r&&a?a:o,label_question:(null===(h=null===(f=t.intents)||void 0===f?void 0:f[0])||void 0===h?void 0:h.label)||""})}}if(t.type===E.d.POLL){let n=t.id,i=(null===(x=null===(_=t._message)||void 0===_?void 0:_.current_polls)||void 0===x?void 0:x[n])||[],l=t.actions.filter(e=>e.label&&i.includes(e.id)).map(e=>e.label);i.length&&e.push({attribute:t.actions[0].key||"",value:l,label_question:(null===(w=null===(y=t.intents)||void 0===y?void 0:y[0])||void 0===w?void 0:w.label)||""})}}return e},[]);return n},extractVoucherAnswers=(e,t)=>{var n;try{if((null===(n=t.extra_settings)||void 0===n?void 0:n.subot_type)!=="ACUVUE")return;let i="",l="",o="",a="",r="",s={},d=(0,M.e)().email;if((e||[]).forEach(e=>{var t,n,c,u,m,p,v,g;let b=e._message;if(!b)return;let f=null===(t=e.actions)||void 0===t?void 0:t.find(e=>e.id===b.action_id);if("voucher_product"===b.action_value?i=(null==f?void 0:f.label)||"":"voucher_color"===b.action_value&&(l=(null==f?void 0:f.label)||""),e.type===E.d.FORM){let logicFind=e=>t=>t.key===e,e=null===(n=b.form_submit_meta)||void 0===n?void 0:n.find(logicFind("voucher_size")),t=null===(c=b.form_submit_meta)||void 0===c?void 0:c.find(logicFind("voucher_location")),f=null===(u=b.form_submit_meta)||void 0===u?void 0:u.find(logicFind("voucher_product")),h=null===(m=b.form_submit_meta)||void 0===m?void 0:m.find(logicFind("voucher_color")),_=null===(p=b.form_submit_meta)||void 0===p?void 0:p.find(e=>"email"===e.control),E=null===(v=b.form_submit_meta)||void 0===v?void 0:v.find(e=>"tel"===e.control);e&&(o=e.value),t&&(a=t.value),f&&(i=f.value),h&&(l=h.value),_&&(d=_.value),E&&(r=E.value),null===(g=b.form_submit_meta)||void 0===g||g.filter(e=>!["voucher_size","voucher_location","voucher_product","voucher_color","email","tel"].includes(e.control)).forEach(e=>{s[e.key]=e.value})}}),d)return Object.assign(Object.assign({},s),{email:d,voucherName:"ACUVUE\xae OASYS (1-DAY) WITH HYDRALUXE\xae"===i?i:i&&l&&o?`${i}|${l}|${o}`:"N/A",voucher_product:i||"N/A",voucher_location:a,voucher_size:o||"N/A",voucher_color:l||"N/A",phone:r})}catch(e){console.log("ExtractVoucherAnswer",e)}},saveSubotInlineLogs=({nodes:e,activeId:t,params:n,accountIdFromLogs:i})=>(0,x._)(void 0,void 0,void 0,function*(){try{let l="in_progress",o=e[e.length-1];(null==o?void 0:o.type)&&E.e.includes(o.type)&&(l="complete");let a=e.slice(1),r={activeId:t,params:n,nodes:a,tracking:Object.assign(Object.assign({},getExtraLogsWithCarePath()),{full_url:window.location.href}),unifiedAnswers:extractUnifiedAnswers(a),voucherAnswers:extractVoucherAnswers(a,e[0])};console.log("data.voucherAnswers",r.voucherAnswers);let s={cookie_id:(0,M.d)(),account_id:i||(0,M.b)()||null,bot_id:e[0].id,flow_uuid:e[0].flow_uuid,data:JSON.stringify(r),status:l,type:"inline",market:P.H[k.u]};yield(0,k.c)(getSubotApiPath(ex.POST_SUBOT_CREATE_LOG),"POST",{data:s})}catch(e){}}),getColorWithOpacity=(e,t)=>{try{let[n,i,l]=hexRgb(e,{format:"array"});return`rgba(${n}, ${i}, ${l}, ${t})`}catch(e){return}},detectToSkipNodeStart=(e,t,n)=>{if(!(null==e?void 0:e.subot_field_type))return[t,n];let i=n.find(e=>e.id==t),l=i&&i.hasOwnProperty("first_node");return l&&n.length>1?[n[1].id,n]:[t,n]},eT=(0,h.createContext)({activeId:"",params:{},listNodes:[],loading:!0,getParams:()=>({}),onNext:()=>null,onPrev:()=>null,onSubmit:()=>null,onStartOver:()=>null,onChange:()=>null,isShowFooter:!1,setIsShowFooter:()=>null,setLoading:()=>null,userInfo:null}),SubotInlineProvider=({children:e,articleLink:t,subotId:n,isFullContainer:i,bgColor:l,primaryColor:o,textColor:a,textButtonColor:r,bgContentColor:s,bgImgFullContainer:d,isDisabledAnimationOnMobile:c,onCloseMobile:u,userInfo:m,typeFormProps:p,customUrl:v,isMobile:g,locale:b})=>{let{formatMessage:f,action:{pushNotifications:E}}=(0,h.useContext)(k.T),I=(0,h.useRef)(null),S=(0,h.useRef)(null),[C,O]=(0,h.useState)(!0),[N,T]=(0,h.useState)(""),[A,$]=(0,h.useState)([]),[P,B]=(0,h.useState)(!1),[L,j]=(0,h.useState)({});(0,h.useEffect)(()=>{let e=l||"#e3f2ff",t=o||"#2d87f3",n=new Date().getTime(),i=setInterval(()=>{let l=I.current,o=new Date().getTime();l&&(eE.mutate(()=>{l.style.setProperty("--subot-inline-bg-color",e),l.style.setProperty("--subot-inline-primary-color",t),l.style.setProperty("--subot-inline-primary-color-hover",getColorWithOpacity(t,.9)||t),l.style.setProperty("--subot-inline-primary-color-100",getColorWithOpacity(t,.1)||"#e3f2ff"),l.style.setProperty("--subot-inline-primary-color-300",getColorWithOpacity(t,.3)||"#bcdeff"),a&&l.style.setProperty("--subot-inline-text-color",a),r&&l.style.setProperty("--subot-inline-text-button-color",r),s&&l.style.setProperty("--subot-inline-bg-content-color",s)}),clearInterval(i)),o-n>18e4&&clearInterval(i)},100);return()=>{clearInterval(i)}},[l,o,a,r,s]);let R=(0,h.useCallback)(()=>{let e=window.gaData,i=(v||window.location.origin+y.b)+((null===k.G||void 0===k.G?void 0:k.G.locale)==="tl-PH"?t.replace("fil/",""):t),l={bot_id:n,account_id:(0,M.b)()||null,action_id:"",action_value:"",cookie_id:(0,M.d)(),current_score:0,current_keys:[],current_selected:[],form_submit_meta:[],gtm_id:e?Object.keys(e)[0]:"",ga_client_id:w.A.get("_ga")||"",is_new:!1,mode:"inline",node_id:"",selected_actions:{},title_url:document.title||"",url:i.replace("http://localhost:6006","https://discover.hellobacsi.com").replace("http://localhost","https://discover.hellobacsi.com").replace("dev.","discover.").replace("staging.hellohealthgroup.com","discover.hellodoctor.com.ph").replace("https://hellohealthgroup.com","https://hellodoctor.com.ph"),window_id:(0,M.f)()};return(0,M.o)(l,null===k.G||void 0===k.G?void 0:k.G.router.query)},[]),U=(0,h.useCallback)(()=>{var e;null===(e=I.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"start",inline:"center"})},[]),D=(0,h.useCallback)((e,t=!0)=>(0,x._)(void 0,void 0,void 0,function*(){var n;if(!e||!e.url||!e.bot_id)return;let i="",l=[];O(!0);let o=yield subotInlineFirstNode$1(e.bot_id);(null==o?void 0:o._status)===1&&(i=null==o?void 0:o._data.id.toString(),l.push(null==o?void 0:o._data,null==o?void 0:o._data.first_node));let a=t?yield getSubotInlineLogs(l[0]):null;a&&(l=a.nodes,i=a.activeId,S.current=(null===(n=a.params)||void 0===n?void 0:n.account_id)||0);let r=getPreviousStateFromStorage(e.bot_id,{getParams:R});if(r&&r.params.action_id&&r.params.action_value){let e=yield subotInlineMessage$1(r.params);(null==e?void 0:e._status)===1&&(null==e?void 0:e._data.node)&&(i=null==e?void 0:e._data.node.id,(l=r.listNodes)[l.length-1]=null==e?void 0:e._data.node,saveSubotInlineLogs({nodes:l,activeId:i,params:r.params,accountIdFromLogs:S.current}),setTimeout(()=>{U()},100))}let s=(null==r?void 0:r.params)||(null==a?void 0:a.params)||e,[d,c]=detectToSkipNodeStart(l[0],i,l);O(!1),T(d),$(c),j(Object.assign(Object.assign({},e),s))}),[]),F=(0,h.useCallback)((e,t)=>{let i=document.querySelector(`.si-revamp-event-submission[data-bot-id="${n}"]`);i&&i.click();let l=N,o=[...A];if(null==t?void 0:t.node_id){let e=o.findIndex(({id:e})=>e==t.node_id);-1!==e&&(o[e]._message=Object.assign(Object.assign({},o[e]._message),t),o=[...o.slice(0,e+1)])}if(O(!0),e){let t=o.findIndex(({id:t})=>t==(null==e?void 0:e.id));if(-1===t)o=[...o,Object.assign({},e)];else{let n=Object.assign(Object.assign(Object.assign({},o[t]),e),{_message:Object.assign(Object.assign({},o[t]._message),null==e?void 0:e._message)});o=[...o.slice(0,t),Object.assign({},n),...o.slice(t+1)]}l=e.id}setTimeout(()=>{$(o),T(l),O(!1),saveSubotInlineLogs({nodes:o,activeId:l,params:L,accountIdFromLogs:S.current})},250)},[A,N]),G=(0,h.useCallback)(e=>(0,x._)(void 0,void 0,void 0,function*(){if(null==e?void 0:e.node_id){let t=Object.assign(Object.assign({},e),getCurrentTotalDynamicScore(A,N,e.action_id)),n=yield subotInlineMessage$1(t);if(O(!1),(null==n?void 0:n._status)===1){let e=null==n?void 0:n._data,{node:i}=e,l=(0,x.a)(e,["node"]),o=Object.assign(Object.assign({},i),{_message:Object.assign(Object.assign({},l),{node_id:i.id})});A.findIndex(e=>e.id===o.id),F(o,t);return}E({title:f({id:"notification.comment.somethingWrong"}),message:"",type:"danger"})}let t=A.find(e=>e.id==N),n=t&&t.hasOwnProperty("first_node");n&&(T(A[1].id.toString()),saveSubotInlineLogs({nodes:A,activeId:A[1].id.toString(),params:R(),accountIdFromLogs:S.current}))}),[F,A]),H=(0,h.useCallback)(()=>{let e=A.findIndex(({id:e})=>e==N);if(e&&-1!==e&&e>1){let t=A[e-1];T(t.id),saveSubotInlineLogs({nodes:A,activeId:t.id,params:L,accountIdFromLogs:S.current})}},[A,N]),z=(0,h.useCallback)(()=>{let e=R();D(e,!1);let t=A[0],n=A[1];saveSubotInlineLogs({nodes:[t,n],activeId:String(t.id),params:e,accountIdFromLogs:S.current})},[R,D,A]),V=(0,h.useCallback)(e=>{$(t=>e&&(null==e?void 0:e.node_id)&&(null==e?void 0:e.node_id)==N?t.map(t=>t.id===N?Object.assign(Object.assign({},t),{_message:t._message?Object.assign(Object.assign({},t._message),e):e}):t):t)},[N]);(0,h.useEffect)(()=>{if(w.A.get(y.G)){let e=R();D(e)}else(0,M.c)({condition:()=>!!w.A.get(y.G),finished:()=>{let e=R();D(e)}})},[]),(0,h.useEffect)(()=>{if(!A.length)return;let e=A.find(e=>e.id==N);e&&N||T(n+"")},[N,A]);let q=(0,h.useMemo)(()=>({activeId:N,params:L,listNodes:A,loading:C,setLoading:O,getParams:R,onNext:G,onPrev:H,onSubmit:F,onStartOver:z,onChange:V,isShowFooter:P,setIsShowFooter:B,isFullContainer:i,bgImgFullContainer:d,isDisabledAnimationOnMobile:c,onCloseMobile:u,userInfo:m,typeFormProps:p,isMobile:g,locale:b}),[N,G,H,F,V,z,P,L,A,C,O,R,i,c,u,m,d,p,g,b]);return A.length?_().createElement(eT.Provider,{value:q},_().createElement("div",{ref:I},e)):null},Close=e=>_().createElement("svg",Object.assign({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),_().createElement("path",{d:"M5.991 4.99a1 1 0 0 0-.697 1.717L10.587 12l-5.293 5.293a1 1 0 1 0 1.414 1.415L12 13.415l5.293 5.293a1 1 0 1 0 1.414-1.415L13.415 12l5.293-5.293a1 1 0 1 0-1.414-1.414L12 10.586 6.708 5.293a1 1 0 0 0-.717-.302",fill:"#595959"})),eM="480px",eA=F.A.div` position: relative; .si-inline-revamp-container { height: 80vh; max-height: ${eM}; display: flex; flex-direction: column; padding: 12px 8px 12px 12px; border-radius: 12px; background-size: cover; position: relative; border: 1px solid var(--subot-inline-primary-color-300); justify-content: center; background-color: var(--subot-inline-bg-content-color, #fff); position: absolute; top: 0; left: 0; right: 0; bottom: 0; &.si-typeform { display: block; padding: 0; border: 0; background: #fff !important; ${G.M.mbDown} { max-height: none; height: auto; } } } .si-container-placeholder { width: 100%; height: 80vh; max-height: ${eM}; pointer-events: none; } ${G.M.mbUp} { .si-inline-revamp-container { padding-right: 12px; } } .subot-inline-revamp-container { width: 100%; max-height: 100%; overflow-y: auto; padding-right: 8px; padding-bottom: 16px; position: relative; .si-voucher-left-ui { width: 100%; } .si-loading { position: absolute; top: 50%; left: 50%; z-index: 2; transform: translate(-50%, -50%); } &[data-show-footer='true'] { height: calc(100% - 72px); } ${G.M.mbUp} { &[data-show-footer='true'] { height: calc(100% - 56px); } } &::-webkit-scrollbar { width: 4px; height: 4px; } &::-webkit-scrollbar-track { background-color: transparent; } &::-webkit-scrollbar-thumb { background-color: var(--subot-inline-text-color, #8c8c8c); border-radius: 2px; outline: none; } } ${G.M.mbUp} { .si-container-placeholder { height: 550px; max-height: 550px; max-width: 100%; } .si-inline-revamp-container { height: 550px; max-height: 550px; max-width: 100%; padding: 48px; border-radius: 20px; &.si-full-container-config { &:not(.si-typeform) { height: 654px; max-height: 654px; & + .si-container-placeholder { height: 654px; max-height: 654px; } } } } .si-close-btn { display: none !important; } } ${G.M.mbDown} { .si-container-open { position: fixed; width: auto; height: auto; max-width: 100%; max-height: 100%; z-index: 999; border-radius: 0; padding-top: 60px; } .si-close-btn { top: 16px; right: 16px; position: absolute; border: 1px solid #e4e8ec; border-radius: 50%; width: 32px; height: 32px; padding: 3px; color: var(--subot-inline-text-color, rgb(89, 89, 89)); svg { display: block; } path { fill: currentColor; } } } `,e$=F.A.div` background-color: var(--subot-inline-bg-color); padding: 40px 0; font-family: Inter; ${G.M.mbUp} { padding: 80px 0; } .si-container { display: flex; align-items: stretch; gap: 16px; margin: 0 auto; flex-direction: column; ${G.M.mbUp} { flex-direction: row; gap: 30px; } &.si-typeform-container { flex-direction: column; .si-revamp-left, .si-revamp-right { max-width: none; } ${G.M.mbDown} { .si-revamp-right { height: 80vh; margin-left: -16px; margin-right: -16px; div, iframe { height: 100%; border-radius: 0; } } } } } .disclaimer-top { &.type-form { display: none; } ${G.M.mbDown} { &.subot-form { display: none; } } } .disclaimer-bottom { ${G.M.mbUp} { &.subot-form { display: none; } } } .si-revamp-right { max-width: 100%; .markdown { min-width: 0; word-break: break-word; a { color: var(--subot-inline-primary-color); &:hover { text-decoration: underline; } } } ${G.M.mbUp} { max-width: ${eM}; min-width: ${eM}; } ${G.M.tdUp} { max-width: 720px; min-width: 720px; } } .si-revamp-left { display: flex; gap: 24px; flex-direction: column; max-width: 490px; ${G.M.mbUp} { padding-top: 48px; } .si-image { width: 64px; flex-shrink: 0; } .si-headline { color: var(--subot-inline-text-color, #262626); font-size: 28px; font-style: normal; font-weight: 400; line-height: 1.2; letter-spacing: -0.616px; ${G.M.mbUp} { font-size: 40px; line-height: 48px; letter-spacing: -0.88px; } strong, b { font-weight: 600; } } } `,eP=F.A.div` margin-top: auto; .si-disclaimer { gap: 8px; display: inline-flex; align-items: center; cursor: pointer; } .si-disclaimer-desc { /* color: #262626; */ color: var(--subot-inline-text-color, #262626); font-size: 14px; font-weight: 600; line-height: 150%; letter-spacing: -0.07px; } .si-disclaimer-down { /* color: black; */ color: var(--subot-inline-text-color, black); } .si-disclaimer-expanded { font-size: 12px; /* color: #595959; */ color: var(--subot-inline-text-color, #595959); line-height: 1.4; padding-top: 8px; overflow: hidden; } `,ChevronDown=e=>_().createElement("svg",Object.assign({width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),_().createElement("path",{d:"M8 9.416 4.584 5.999A.73.73 0 0 0 3.52 6a.73.73 0 0 0 .007 1.07l3.953 3.95q.113.105.244.156a.8.8 0 0 0 .281.053q.15 0 .282-.053a.7.7 0 0 0 .235-.156l3.951-3.951a.73.73 0 0 0 .237-.528.72.72 0 0 0-.23-.52.73.73 0 0 0-1.062 0z",fill:"currentColor"})),Info=e=>_().createElement("svg",Object.assign({width:"20",height:"21",viewBox:"0 0 20 21",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),_().createElement("path",{d:"M9.996 14.5q.316 0 .535-.216a.72.72 0 0 0 .219-.534v-3.5a.73.73 0 0 0-.214-.534.72.72 0 0 0-.532-.216.73.73 0 0 0-.535.216.72.72 0 0 0-.219.534v3.5q0 .319.214.534a.72.72 0 0 0 .532.216m0-6.5q.316 0 .535-.214a.7.7 0 0 0 .219-.532.74.74 0 0 0-.214-.535.7.7 0 0 0-.532-.219.74.74 0 0 0-.535.214.7.7 0 0 0-.219.532q0 .316.214.535T9.996 8m.01 10.5a7.8 7.8 0 0 1-3.11-.625 8.1 8.1 0 0 1-2.552-1.719 8.1 8.1 0 0 1-1.719-2.551A7.8 7.8 0 0 1 2 10.491q0-1.657.625-3.106a8.07 8.07 0 0 1 4.27-4.26 7.8 7.8 0 0 1 3.114-.625 7.75 7.75 0 0 1 3.106.625q1.447.625 2.541 1.719a8.1 8.1 0 0 1 1.719 2.546A7.8 7.8 0 0 1 18 10.494a7.8 7.8 0 0 1-.625 3.11 8.1 8.1 0 0 1-1.719 2.552 8.1 8.1 0 0 1-2.546 1.719 7.8 7.8 0 0 1-3.104.625M10 17q2.709 0 4.604-1.896T16.5 10.5t-1.896-4.604T10 4Q7.291 4 5.396 5.896T3.5 10.5t1.896 4.604T10 17",fill:"#FE921D"})),Container$v=({className:e})=>{let[t,n]=(0,h.useState)(!1),{formatMessage:i}=(0,h.useContext)(k.T);return _().createElement(eP,{className:e},_().createElement("div",{className:"si-disclaimer",onClick:()=>n(!t)},_().createElement(Info,{className:"si-disclaimer-info-svg"}),_().createElement("span",{className:"si-disclaimer-desc"},i({id:"tools.disclaimer",defaultMessage:"Miễn trừ tr\xe1ch nhiệm"})),_().createElement(ChevronDown,{className:"si-disclaimer-down"})),_().createElement(D.P.div,{className:"si-disclaimer-expanded",animate:t?{height:"auto"}:{height:0},transition:{duration:.3}},i({id:"tool.subot.inline.disclaimer.content",defaultMessage:"C\xf4ng cụ n\xe0y kh\xf4ng cung cấp lời khuy\xean y tế m\xe0 chỉ d\xf9ng để cung cấp th\xf4ng tin. N\xf3 kh\xf4ng thay thế cho lời khuy\xean, chẩn đo\xe1n hoặc điều trị y tế chuy\xean nghiệp từ b\xe1c sĩ. Nếu bạn đang t\xecm phương ph\xe1p điều trị hay đang điều trị, đừng bỏ qua lời khuy\xean y tế từ b\xe1c sĩ chỉ v\xec một số th\xf4ng tin bạn đ\xe3 đọc tr\xean website của ch\xfang t\xf4i. Nếu bạn nghĩ rằng m\xecnh đang trong t\xecnh trạng khẩn cấp, h\xe3y li\xean hệ với b\xe1c sĩ ngay lập tức."})))};Container$v.displayName="SubotInlineDisclaimer";let useCurrentUrl=()=>{let{data:{locale:e,router:t}}=(0,h.useContext)(k.T),{asPath:n}=t||{},[i,l]=(0,h.useState)(()=>`${(0,M.g)(e,!1)}${y.b}${n}`);return(0,h.useEffect)(()=>{l(window.location.href)},[n]),i},useValidationMultiOption=()=>{let{formatMessage:e,action:{pushNotifications:t}}=(0,h.useContext)(k.T);return{validateSelectActions:(n,i,l)=>{if((null==i?void 0:i.multi_select_option)===E.g.EXACT_NUMBER&&n.length!==(null==i?void 0:i.from)){t({message:e({id:"multiSelectError.exactNumber",defaultMessage:"You must choose {from} answers."},{from:i.from}),type:"warning"});return}if((null==i?void 0:i.multi_select_option)===E.g.RANGE&&(n.length<(null==i?void 0:i.from)||n.length>(null==i?void 0:i.to))){t({title:"",message:e({id:"multiSelectError.range",defaultMessage:"You must choose from {from} to {to} answers (Ex: You must choose from 3 to 5 answers)"},{from:i.from,to:i.to}),type:"warning"});return}if(n.length)l();else{t({title:"",message:e({id:"multiSelectError.required",defaultMessage:"There is no answer!"}),type:"warning"});return}}}},eB=F.A.div` display: flex; margin-top: auto; flex-direction: row; justify-content: space-between; .si-footer-start-over { display: flex; gap: 8px; align-items: center; height: 40px; font-weight: 600; font-size: 14px; color: var(--subot-inline-text-color, #595959); cursor: pointer; transition: all 0.3s ease; text-align: left; :disabled { opacity: 0.6; pointer-events: none; } &:not(:disabled):hover { color: var(--subot-inline-primary-color); } } .si-footer-actions { gap: 16px; display: flex; } ${G.M.mbDown} { &[data-show-action='false'] { justify-content: center; padding: 12px 0; background-color: var(--subot-inline-bg-content-color, #f8f8f8); margin-left: -11px; margin-right: -7px; position: relative; bottom: -11px; border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; } .si-footer-actions { button { font-size: 0; width: 40px; height: 40px; border-radius: 50%; padding: 0; .mantine-Button-icon { margin: 0; position: absolute; } svg { margin-left: 0 !important; margin-right: 0 !important; } } } } `,ChevronLeft=e=>_().createElement("svg",Object.assign({width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),_().createElement("path",{d:"m7.988 8 3.417 3.417a.73.73 0 0 1 0 1.063.73.73 0 0 1-1.07-.007L6.385 8.52a.76.76 0 0 1-.208-.525q-.001-.15.05-.28a.7.7 0 0 1 .157-.236l3.951-3.951a.73.73 0 0 1 .528-.237q.292 0 .521.23a.73.73 0 0 1 0 1.062z",fill:"currentColor"})),ChevronRight$1=e=>_().createElement("svg",Object.assign({width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),_().createElement("path",{d:"M8.917 8 5.5 4.582a.73.73 0 0 1 0-1.063.73.73 0 0 1 1.07.007l3.95 3.954q.105.113.156.243a.8.8 0 0 1 .053.282q0 .15-.053.28a.7.7 0 0 1-.156.236l-3.95 3.951a.73.73 0 0 1-.528.236.72.72 0 0 1-.52-.23.73.73 0 0 1 0-1.062z",fill:"currentColor"})),ChevronRight=e=>_().createElement("svg",Object.assign({width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),_().createElement("path",{d:"M5.5 10q0 .25.031.5t.073.479a1 1 0 0 1-.052.583.66.66 0 0 1-.406.396.72.72 0 0 1-.573-.032.66.66 0 0 1-.365-.427 5 5 0 0 1-.156-.729A6 6 0 0 1 4 10q0-2.522 1.77-4.292 1.772-1.77 4.355-1.709l-.667-.666a.73.73 0 0 1 0-1.063.73.73 0 0 1 1.063 0l1.958 1.959q.23.228.23.52a.72.72 0 0 1-.23.521l-1.958 1.96a.68.68 0 0 1-.521.218.76.76 0 0 1-.52-.24.73.73 0 0 1 0-1.062l.645-.646q-1.959-.041-3.292 1.292T5.5 9.999m9 0q0-.25-.031-.5a9 9 0 0 0-.073-.48 1 1 0 0 1 .052-.594.73.73 0 0 1 .406-.406.66.66 0 0 1 .563 0q.27.125.354.417.105.375.166.76Q16 9.583 16 10q0 2.5-1.77 4.282-1.772 1.78-4.355 1.718l.667.667a.73.73 0 0 1 0 1.063.73.73 0 0 1-1.063 0l-1.958-1.96a.72.72 0 0 1-.23-.52q0-.293.23-.521l1.958-1.959a.73.73 0 0 1 1.063 0 .73.73 0 0 1 0 1.063l-.667.666q1.959.042 3.292-1.291Q14.5 11.873 14.5 9.999",fill:"currentColor"})),eL=_().createContext({value:{},setValue:()=>null}),NodeContextProvider=({children:e})=>{let[t,n]=(0,h.useState)({}),i=(0,h.useMemo)(()=>({value:t,setValue:n}),[t,n]);return _().createElement(eL.Provider,{value:i},e)},ej=[E.d.FORM],eR=[E.c.SSO],eU=[E.d.FINAL,E.d.FINAL_THANK_YOU,E.d.FINAL_STANDARD],Container$u=()=>{var e,t,n;let{formatMessage:i,action:{pushNotifications:l}}=(0,h.useContext)(k.T),o=useCurrentUrl(),{listNodes:a,activeId:r,isShowFooter:s,onNext:d,onPrev:c,params:u,onStartOver:m,loading:p}=(0,h.useContext)(eT),{value:v}=(0,h.useContext)(eL),g=useValidationMultiOption(),b=a[0],f=a.find(e=>e.id==r),x=null===(e=null==f?void 0:f.actions)||void 0===e?void 0:e.find(e=>e.type===E.f.USER_CHOICE_NEXT),y=null===(t=null==f?void 0:f.actions)||void 0===t?void 0:t.find(({type:e})=>e==E.f.POLL_BUTTON),w=null===(n=null==f?void 0:f.actions)||void 0===n?void 0:n.find(({type:e})=>e==E.f.ACTION_MULTIPLE_BUTTON),handleNextChoice=()=>{let e={node_id:f.id,action_id:null==x?void 0:x.id,action_value:null==x?void 0:x.key};d(Object.assign(Object.assign(Object.assign({},u),null==f?void 0:f._message),e))},handlePollSubmit=()=>{var e;let t={},n=(null===(e=null==v?void 0:v.form_submit_meta)||void 0===e?void 0:e.map(({action_id:e})=>e))||[];v.form_submit_meta&&v.form_submit_meta.length&&(t[f.id]=v.form_submit_meta.map(e=>e.action_id));let i=Object.assign(Object.assign({},v),{current_polls:t});g.validateSelectActions(n,f,()=>{d&&d(Object.assign(Object.assign(Object.assign({},u),null==f?void 0:f._message),i))})},handleMultipleSubmit=()=>{g.validateSelectActions(Object.keys((null==v?void 0:v.selected_actions)||{}),f,()=>{d&&d(Object.assign(Object.assign(Object.assign({},u),null==f?void 0:f._message),v))})};if(!s)return null;let I=a.find(e=>e.id==r),S=ej.includes((null==I?void 0:I.type)||"")||eR.includes((null==I?void 0:I.position)||""),C=!eU.includes((null==I?void 0:I.type)||"");return _().createElement(eB,{"data-show-action":C},_().createElement("button",{onClick:m,"data-event-category":"Service Connection","data-event-action":"Risk Screening Start Over","data-event-label":o,"data-bot-id":u.bot_id,className:"si-footer-start-over",disabled:!!((null==b?void 0:b.subot_field_type)&&r==(null==a?void 0:a[1].id))},_().createElement(ChevronRight,null)," ",_().createElement("span",null,i({id:"tool.subot.inline.start.over",defaultMessage:"Start over"}))),C&&_().createElement("div",{className:"si-footer-actions"},_().createElement(H.B,{size:"md",variant:"tertiary",onClick:c,"data-event-category":"Service Connection","data-event-action":"Risk Screening Back","data-event-label":o,"data-bot-id":u.bot_id,sx:{paddingLeft:16,paddingRight:16,borderRadius:8},styles:{root:{":not(:disabled)":{backgroundColor:"transparent !important","&:hover":{backgroundColor:"var(--subot-inline-text-button-color, #f7f9fc) !important"},color:"var(--subot-inline-text-color, #262626) !important"}}}},_().createElement(ChevronLeft,{style:{marginRight:10}}),i({id:"riskScreener.back",defaultMessage:"Back"})),_().createElement(H.B,{size:"md",onClick:()=>{var e;if((null==x?void 0:x.id)&&(null==x?void 0:x.key)){handleNextChoice();return}if(w){handleMultipleSubmit();return}if(y){handlePollSubmit();return}(null==f?void 0:f._message)&&(null===(e=f._message)||void 0===e?void 0:e.action_id)?d(Object.assign(Object.assign(Object.assign({},u),null==f?void 0:f._message),v)):l({title:"",message:i({id:"multiSelectError.required",defaultMessage:"There is no answer!"}),type:"warning"})},loading:!S&&p,disabled:S,"data-event-category":"Service Connection","data-event-action":"Risk Screening Continue","data-event-label":o,"data-bot-id":u.bot_id,sx:{paddingLeft:16,paddingRight:16,borderRadius:8},styles:{root:{":not(:disabled)":{backgroundColor:"var(--subot-inline-primary-color) !important","&:hover":{backgroundColor:"var(--subot-inline-primary-color-hover) !important"},color:"var(--subot-inline-text-button-color, #fff) !important"}}}},i({id:"riskScreener.next",defaultMessage:"Next"}),_().createElement(ChevronRight$1,{style:{marginLeft:10}}))))};Container$u.displayName="SubotInlineFooterContainer";let eD=F.A.div` sup { position: relative; top: -0.5em; font-size: 0.7em; } sub { position: relative; bottom: -0.5em; font-size: 0.7em; } ul { padding-left: 1.2em; list-style: inherit; } ol { padding-left: 1.2em; } img { display: block; max-width: 100%; margin: 1rem auto; } `,getMDInstance=()=>new z.F("full",{html:!0,linkTarget:"_blank"}),Markdown=e=>{var{children:t,className:n}=e,i=(0,x.a)(e,["children","className"]);let l=(0,h.useMemo)(()=>getMDInstance(),[]),o=j()(n,"markdown"),a=(0,h.useMemo)(()=>{let e=Object.assign({},i);return"string"==typeof t?e.dangerouslySetInnerHTML={__html:l.render(t)}:e.children=t,e},[t]);return _().createElement(eD,Object.assign({},a,{className:o}))},eF=F.A.div` display: flex; gap: 24px; `,eG=F.A.div` display: flex; gap: 24px; .si-review-by { gap: 12px; display: flex; color: var(--subot-inline-text-color, #595959); font-style: normal; font-weight: 400; } .si-review-by-avatar { width: 40px; max-width: 40px; height: 40px; img { width: 100%; height: 100%; border-radius: 100%; } } .si-review-by-name { font-size: 14px; line-height: 150%; letter-spacing: -0.07px; strong, b { font-weight: 600; } a { color: inherit; &:hover { color: var(--subot-inline-primary-color); } } } .si-review-by-branch { font-size: 12px; font-style: normal; font-weight: 400; line-height: 140%; margin-top: 4px; span + span { &:before { content: ' · '; } } } &[data-layout='horizontal'] { flex-wrap: wrap; gap: 0; .si-headline { width: calc(100% - 64px - 24px); padding-left: 24px; } .si-image { width: 64px; height: 64px; } .si-review-by { width: calc(100% - 88px); margin-left: 88px; } ${G.M.mbDown} { gap: 8px; .si-image { width: 48px; height: 48px; } .si-headline { width: calc(100% - 48px - 16px); padding-left: 8px; font-size: 26px; line-height: 34px; } .si-review-by { width: calc(100% - 20px); margin-left: 20px; .si-review-by-avatar { width: 32px; height: 32px; flex-shrink: 0; } } } } &[data-layout='vertical'] { flex-direction: column; } `,Container$t=({subotSettingData:e,layout:t="vertical"})=>{let n=e.reviewByAvatar&&e.reviewByName;return _().createElement(eF,null,_().createElement(eG,{"data-layout":t},e.inlineImage&&_().createElement("img",{loading:"lazy",alt:"Inline heading",className:"si-image",src:e.inlineImage}),e.inilneHeadline&&_().createElement("h2",{className:"si-headline"},_().createElement(Markdown,null,e.inilneHeadline)),n&&_().createElement("div",{className:"si-review-by"},_().createElement("div",{className:"si-review-by-avatar"},_().createElement("img",{loading:"lazy",src:e.reviewByAvatar,alt:e.reviewByName})),_().createElement("div",{className:"si-review-by-info"},_().createElement(Markdown,{className:"si-review-by-name"},e.reviewByName),_().createElement("p",{className:"si-review-by-branch"},[e.reviewBySpecialty,e.reviewByHospital].filter(Boolean).map((e,t)=>_().createElement("span",{key:t},e)))))))};Container$t.displayName="SubotInlineInfoSection";let eH=F.A.div` display: flex; align-items: flex-start; flex-direction: column; gap: 16px; > h2 { font-size: 20px; font-weight: 600; line-height: 150%; letter-spacing: -0.3px; /* color: #262626; */ color: var(--subot-inline-text-color, #262626); ${G.M.mbUp} { font-size: 24px; line-height: 130%; letter-spacing: -0.432px; } } .si-node-start-desc { /* color: #595959; */ color: var(--subot-inline-text-color, #595959); font-size: 16px; line-height: 24px; font-weight: 400; ${G.M.mbUp} { letter-spacing: -0.16px; } } &.si-acuvue-wrap { align-items: center; text-align: center; } `,ez=F.A.div` position: relative; .si-voucher-item { max-width: 150px; max-height: fit-content; margin: 0 auto; display: block; position: relative; } .si-voucher-in-stock { display: flex; flex-direction: row; justify-content: center; align-items: center; gap: 8px; position: relative; h3 { font-size: 48px; font-weight: 700; color: #2d87f3; line-height: 1.1; } img { width: 32px; max-height: fit-content; position: relative; top: 3px; } } .si-voucher-bg { pointer-events: none; position: absolute; width: 100%; height: auto; max-height: none; bottom: 0; left: 0; right: 0; } .si-voucher-total { color: #595959; font-size: 16px; line-height: 1.5; text-align: center; } .si-voucher-progress { width: 260px; background-color: #bcdeff; border-radius: 9px; padding: 1px; margin: 0 auto; margin-top: 30px; .si-voucher-progress--inner { height: 6px; border-radius: 8px; background-color: #2d87f3; } } `,SubotInlineVoucherLeftUI=({clientId:e,voucherAnswers:t})=>{let[n,i]=(0,h.useState)(0),[l,o]=(0,h.useState)(0);(0,h.useEffect)(()=>{(0,k.c)(getSubotApiPath(ex.GET_VOUCHER_QUANTITY,{search:(null==t?void 0:t.voucherName.split("|")[0])||"",clientId:e}),"GET").then(e=>{let t=null==e?void 0:e._data[0];t.total_quantity&&(i(t.total_quantity),o(t.total_in_stock))})},[null==t?void 0:t.voucherName]);let a=n?l/n*100:0;return n?_().createElement(ez,{className:"si-voucher-left-ui"},_().createElement("img",{src:W.C.getAssetPath("subot/voucher_bg.png"),alt:"",loading:"eager",className:"si-voucher-bg"}),_().createElement("img",{src:W.C.getAssetPath("subot/voucher_icon.png"),alt:"",loading:"eager",className:"si-voucher-item"}),_().createElement(B.Box,{className:"si-voucher-in-stock"},_().createElement("h3",null,l),_().createElement("img",{src:W.C.getAssetPath("subot/voucher_icon_small.png"),alt:"",loading:"eager"})),_().createElement(B.Box,{className:"si-voucher-progress"},_().createElement(B.Box,{className:"si-voucher-progress--inner",style:{width:`${a}%`}}))):null},Container$s=({node:e,onClickStart:t})=>{var n,i;let l=(0,h.useRef)(!1),{ref:o,inView:a}=(0,q.Wx)(),r=useCurrentUrl(),{params:s,getParams:d,onNext:c,setIsShowFooter:u,listNodes:m}=(0,h.useContext)(eT),p=m[0],v=null===(n=null==p?void 0:p.extra_settings)||void 0===n?void 0:n.subot_type;return(0,h.useMemo)(()=>{u(!1)},[]),(0,h.useEffect)(()=>{a&&!l.current&&(subotInlineImpression$1(d()),l.current=!0)},[a]),_().createElement(eH,{ref:o,className:j()({"si-acuvue-wrap":"ACUVUE"===v})},_().createElement("h2",null,e.inline_title),_().createElement("div",{className:"si-node-start-desc"},_().createElement(Markdown,null,e.inline_description)),"ACUVUE"===v&&_().createElement(SubotInlineVoucherLeftUI,{clientId:null===(i=p.extra_settings)||void 0===i?void 0:i.client_id,voucherAnswers:{email:"",voucherName:""}}),_().createElement(H.B,{onClick:()=>{let e=d();e.device_id=(0,M.h)(window.navigator.userAgent)?2:1,subotInlineClick$1(e),c(),null==t||t()},"data-event-category":"Service Connection","data-event-action":"Risk Screening Start","data-event-label":r,"data-bot-id":s.bot_id,rightIcon:_().createElement(V.A,{color:"var(--subot-inline-text-button-color, #fff)"}),styles:{root:{backgroundColor:"var(--subot-inline-primary-color) !important","&:hover":{backgroundColor:"var(--subot-inline-primary-color-hover) !important"},color:"var(--subot-inline-text-button-color, #fff) !important"}}},e.inline_start_button))};Container$s.displayName="SubotInlineNodeStartContainer";let eV=F.A.div``,eq=F.A.div` .si-intent-list { display: flex; gap: 12px; flex-direction: column; } &[data-intent-count='1'] { .si-bot-title { margin-bottom: 0; } } `,eW=F.A.div` .si-bot-title { gap: 6px; display: flex; align-items: flex-start; color: var(--subot-inline-text-color, #262626); font-weight: 600; margin-bottom: 24px; font-size: 18px; line-height: 28px; letter-spacing: -0.4px; img { display: block; } ${G.M.mbUp} { font-size: 22px; line-height: 32px; letter-spacing: -0.6px; } } &#si-intent-bot-title { ~ div { .si-bot-title { margin-bottom: 0; } } } `,eY=F.A.div` text-align: center; button { min-width: 230px; } .si-button-svg-icon { margin-right: 3px; } `,Download=e=>_().createElement("svg",Object.assign({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),_().createElement("g",{clipPath:"url(#clip0_608_1578)"},_().createElement("path",{d:"M19.5 18V21H4.5V18H3V21C3 21.3978 3.15804 21.7794 3.43934 22.0607C3.72064 22.342 4.10218 22.5 4.5 22.5H19.5C19.8978 22.5 20.2794 22.342 20.5607 22.0607C20.842 21.7794 21 21.3978 21 21V18H19.5Z",fill:"currentColor"}),_().createElement("path",{d:"M19.5 10.5L18.4425 9.4425L12.75 15.1275V1.5H11.25V15.1275L5.5575 9.4425L4.5 10.5L12 18L19.5 10.5Z",fill:"currentColor"})),_().createElement("defs",null,_().createElement("clipPath",{id:"clip0_608_1578"},_().createElement("rect",{width:"24",height:"24",fill:"white"})))),getLeadPath=(e,t)=>{let{leadApiUrl:n}=null===k.G||void 0===k.G?void 0:k.G.env;return n+T()(e,Object.assign({},t))},callApiWithLead=(e,t,n)=>(0,x._)(void 0,void 0,void 0,function*(){if(null==n?void 0:n.data){let e=w.A.get(K.d),t=w.A.get(y.G);if(!e){let t=(0,J.A)();e=t,w.A.set(K.d,t)}n.data.cookie_id=e,n.data.ga_client_id=t||""}return(0,k.c)(e,t,n)});$().extend(X());let saveLeadApi=e=>(0,x._)(void 0,void 0,void 0,function*(){let{first_name:t,last_name:n,address:i,dob:l,email:o,phone:a}=e||{};return yield callApiWithLead(getLeadPath("campaign/{campaignCode}/lead",{campaignCode:"lhdqxfoggwgskbb"}),"POST",{data:{url:window.location.href,title_article:document.title,referrer:"hlbs",meta:[{key:"first_name",value:t||"",control:"text"},{key:"last_name",value:n||"",control:"text"},{key:"due_date_dob",value:l,control:"due_date_dob"},{key:"province",value:((null==i?void 0:i.selectedProvince)||"").replace("Tỉnh ","").replace("Th\xe0nh phố ",""),control:"province"},{key:"email",value:o||"",control:"email"},{key:"phone",value:a||"",control:"tel"},{key:"address",value:i?[(null==i?void 0:i.selectedProvince)||"",(null==i?void 0:i.selectedDistrict)||"",(null==i?void 0:i.selectedWard)||"",(null==i?void 0:i.extraInfo)||""].join("; "):"",control:"text"}]}})}),checkSyncDataOnFrisoCampaign=(e,t)=>{var n,i,l,o,a,r,s,d,c;try{if(!(null===(n=e.extra_settings)||void 0===n?void 0:n.sync_data_friso_campaign)||!t)return;let u=E.E[E.f.USER_SUBMIT_NAME],m=E.E[E.f.USER_SUBMIT_EMAIL],p=E.E[E.f.USER_SUBMIT_DATE],v=E.E[E.f.USER_SUBMIT_OTP],g=E.E[E.f.USER_SUBMIT_PHONE],b=E.E[E.f.USER_SUBMIT_ADDRESS_PROVINCE],f=E.E[E.f.USER_SUBMIT_ADDRESS_DISTRICT],h=E.E[E.f.USER_SUBMIT_ADDRESS_COMMUNE],_=E.E[E.f.USER_SUBMIT_ADDRESS],x=(null===(i=t.find(e=>e.control===u))||void 0===i?void 0:i.value)||"",y=(null===(l=t.find(e=>e.control===m))||void 0===l?void 0:l.value)||"",w=(null===(o=t.find(e=>e.control===p))||void 0===o?void 0:o.value)||"",I=(null===(a=t.find(e=>e.control===v||e.control===g))||void 0===a?void 0:a.value)||"",S={selectedProvince:(null===(r=t.find(e=>e.control===b))||void 0===r?void 0:r.value)||"",selectedDistrict:(null===(s=t.find(e=>e.control===f))||void 0===s?void 0:s.value)||"",selectedWard:(null===(d=t.find(e=>e.control===h))||void 0===d?void 0:d.value)||"",extraInfo:(null===(c=t.find(e=>e.control===_))||void 0===c?void 0:c.value)||""};if(!x||!y||!w||!I||!S.selectedProvince||!S.selectedDistrict||!S.selectedWard||!S.extraInfo)return;let C=x.split(" "),O=C[C.length-1];C.pop();let k=C.join(" ");saveLeadApi({last_name:O,first_name:k,phone:I.replace("+84","0"),email:y,address:S,dob:w,term:!0})}catch(e){}},foundNodeFrisoForm=e=>{let t="",n="";return e.forEach(e=>{var i,l,o,a,r,s;let d=(null===(o=null===(l=null===(i=null==e?void 0:e._message)||void 0===i?void 0:i.form_submit_meta)||void 0===l?void 0:l.find(e=>e.control===E.E[E.f.USER_SUBMIT_OTP]||e.control===E.E[E.f.USER_SUBMIT_PHONE]))||void 0===o?void 0:o.value)||"",c=(null===(s=null===(r=null===(a=null==e?void 0:e._message)||void 0===a?void 0:a.form_submit_meta)||void 0===r?void 0:r.find(e=>e.control===E.E[E.f.USER_SUBMIT_DATE]))||void 0===s?void 0:s.value)||"";d&&c&&(t=d,n=c)}),{foundPhone:t,foundDate:n}},handleFrisoRedirecition=e=>{let{foundPhone:t,foundDate:n}=foundNodeFrisoForm(e);if(!t||!n)return;let i=$()(n),l=t.replace("+84","0"),o=i.isSameOrBefore($()()),a=i.format("YYYY-MM-DD");window.location.href=T()("https://zalo.me/s/3605814730108331998/?ver=1&source=hlbs&phone={phone}&dob={dob}&edd={edd}",Object.assign({phone:l},o?{dob:a}:{edd:a}))},Container$r=({intent:e})=>{var t;let{listNodes:n}=(0,h.useContext)(eT),i=(0,h.useMemo)(()=>e.url&&e.label&&(null==e?void 0:e.type)===E.N.BOT_MAIN_BUTTON?{"data-event-category":"Service Connection","data-event-action":`Risk Screening - ${e.label}`,"data-event-label":e.url}:{},[e]);if(!(null==e?void 0:e.label))return null;let l=null===(t=e.label)||void 0===t?void 0:t.startsWith(":download:");return _().createElement(eY,null,_().createElement(H.B,Object.assign({size:"md",color:"primary",onClick:()=>{var t;if(null===(t=e.url)||void 0===t?void 0:t.includes("{{.frisoRedirectUrl}}")){handleFrisoRedirecition(n);return}e.url&&(0,M.i)(e.url)}},i,{styles:{root:{backgroundColor:"var(--subot-inline-primary-color) !important","&:hover":{backgroundColor:"var(--subot-inline-primary-color-hover) !important"},color:"var(--subot-inline-text-button-color, #fff) !important"}}}),l&&_().createElement(Download,{width:"1em",height:"1em",className:"si-button-svg-icon"}),_().createElement(Markdown,null,e.label.replace(":download:",""))))};Container$r.displayName="SubotInlineIntentBotButton";let eX=F.A.div` img { display: block; width: auto; max-width: 100%; margin: 0 auto; } `,Container$q=({intent:e})=>e.url?_().createElement(eX,null,_().createElement("img",{loading:"lazy",src:e.url,alt:e.label})):null;Container$q.displayName="SubotInlineIntentBotImage";let Container$p=({intent:e,indexNumber:t})=>{let{listNodes:n}=(0,h.useContext)(eT),i=![E.N.SSO_INTENT].includes(null==e?void 0:e.type),l=[E.N.BOT_TEXT,E.N.BOT_MAIN_TITLE].includes(null==e?void 0:e.type),o=[E.N.BOT_BUTTON,E.N.BOT_RECALCULATE].includes(null==e?void 0:e.type),a=[E.N.BOT_IMAGE,E.N.BOT_MAIN_IMAGE].includes(null==e?void 0:e.type),r=(null==e?void 0:e.type)===E.N.BOT_MAIN_TITLE;return o?_().createElement(Container$r,{intent:e}):e?_().createElement(eW,{id:"si-intent-bot-title"},_().createElement("h3",{className:"si-bot-title","data-image":a},t&&_().createElement("span",{className:"si-bot-title-number"},t,"."),i&&l&&_().createElement(Markdown,null,r?replaceTextWithVariables(e.label||"",n):e.label),a&&_().createElement(Container$q,{intent:e}))):null};Container$p.displayName="SubotInlineIntentBotTitle";let Container$o=({intent:e})=>{let t=useCurrentUrl(),{listNodes:n,activeId:i,params:l}=(0,h.useContext)(eT),o=n.find(e=>e.id==i);if(!e.label||!o)return null;let a={"data-event-category":"Service Connection","data-event-action":e.label,"data-event-label":t,"data-bot-id":l.bot_id,"data-question-id":o.id};return _().createElement(B.Box,{style:{position:"absolute",zIndex:-1}},_().createElement("button",Object.assign({className:"si-revamp-event-submission"},a)))};Container$o.displayName="SubotInlineIntentBotEventSubmission";let eK=F.A.div` display: flex; padding: 8px 0; .si-related-article-category { font-weight: 700; font-size: 0.875em; line-height: 1.375em; letter-spacing: 0; color: #404040; margin-bottom: 4px; a { color: inherit; text-decoration: none; } } .si-related-article-thumbnail { height: 100px; margin: 0 16px 0 0; max-width: 100px; min-width: 100px; a, img { width: 100px; height: 100px; display: block; object-fit: cover; border-radius: 6px; } } .si-related-article-content { flex: 1; h3, h3 a { /* color: #262626 */ color: var(--subot-inline-text-color, #262626); font-size: 16px; letter-spacing: -0.2px; line-height: 24px; text-decoration: none; } } .si-related-article-review-by { display: flex; align-items: center; margin-top: 8px; a { display: block; } } .si-related-article-review-by-avatar { max-width: 24px; min-width: 24px; margin-right: 8px; img { height: 24px; width: 24px; border-radius: 100%; display: block; } } .si-related-article-review-by-name { p { color: #404040; margin: 0; font-size: 0.875em; line-height: 1.375em; letter-spacing: -0.2px; } } `,articleDataComputed=e=>{try{if(e.label&&e.label.includes("{")){let t=JSON.parse(e.label);if(t.meta){let e={};t.meta.map(({key:t,value:n})=>{t&&n&&(e[t]=n)}),t.meta=Object.assign({},e)}return Object.assign({},t)}return{}}catch(e){return{}}},Container$n=({intent:e})=>{var t,n,i,l;let o=(0,h.useMemo)(()=>articleDataComputed(e),[e,null==e?void 0:e.label]),{formatMessage:a}=(0,h.useContext)(k.T);return _().createElement(_().Fragment,null,!!(null==o?void 0:o.title)&&!!(null==o?void 0:o.thumbnail)&&!!(null==o?void 0:o.url)&&_().createElement(eK,null,_().createElement("div",{className:"si-related-article-thumbnail"},_().createElement("a",{href:o.url,target:"_blank","data-event-category":"Service Connection","data-event-action":"Risk Screening - Article Click","data-event-label":o.url,rel:"noreferrer"},_().createElement("img",{src:o.thumbnail,alt:o.title,loading:"lazy"}))),_().createElement("div",{className:"si-related-article-content"},(null===(t=o.meta)||void 0===t?void 0:t.category_name)&&_().createElement("p",{className:"si-related-article-category",style:{color:null===(n=o.meta)||void 0===n?void 0:n.category_text_color}},_().createElement("a",{href:o.meta.category_url,target:"_blank",rel:"noreferrer"},o.meta.category_name)),_().createElement("h3",null,_().createElement("a",{href:o.url,target:"_blank","data-event-category":"Service Connection","data-event-action":"Risk Screening - Article Click","data-event-label":o.url,rel:"noreferrer"},o.title)),(null===(i=o.meta)||void 0===i?void 0:i.reviewed_avatar_thumbnail)&&(null===(l=o.meta)||void 0===l?void 0:l.reviewed_display_name)&&_().createElement("div",{className:"si-related-article-review-by"},_().createElement("div",{className:"si-related-article-review-by-avatar"},_().createElement("a",{href:o.meta.reviewed_url,target:"_blank",rel:"noreferrer"},_().createElement("img",{src:o.meta.reviewed_avatar_thumbnail,alt:o.meta.reviewed_display_name}))),_().createElement("div",{className:"si-related-article-review-by-name"},_().createElement("p",null,a({id:"articleAuthor.title.medical",defaultMessage:"Medically reviewed by"})," ",_().createElement("strong",null,o.meta.reviewed_display_name)))))))};Container$n.displayName="SubotInlineIntentBotImage";let eJ=F.A.div` padding: 16px 0; & > .si-list-services { display: flex; gap: 8px; overflow: auto; } .si-title { margin-bottom: 24px; } .si-service-title { text-align: center; padding: 2px; } .image-wrapper { cursor: pointer; flex: 0 0 184px; > * { pointer-events: none; } } img { display: block; width: auto; max-width: 100%; cursor: pointer; height: auto; } .aspect-square { position: relative; &::before { content: ''; display: block; padding-top: 120%; } > * { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; } } `,eZ=F.A.div` margin-top: auto; border-radius: 12px; padding: 12px 16px; background-color: #fff8e2; margin-top: 24px; .si-disclaimer { gap: 8px; display: inline-flex; align-items: center; cursor: pointer; } .si-disclaimer-desc { color: #262626; /* color: var(--subot-inline-text-color, #262626); */ font-size: 16px; font-weight: 600; line-height: 150%; letter-spacing: -0.07px; } .si-disclaimer-down { color: black; } .si-disclaimer-expanded { font-size: 16px; color: #262626; /* color: var(--subot-inline-text-color, #262626); */ line-height: 1.4; overflow: hidden; padding-left: 32px; margin-top: 4px; } `,Container$m=({text:e})=>{let[t,n]=(0,h.useState)(!1),{formatMessage:i}=(0,h.useContext)(k.T);return e?_().createElement(eZ,null,_().createElement("div",{className:"si-disclaimer",onClick:()=>n(!t)},_().createElement(Info,{className:"si-disclaimer-info-svg"}),_().createElement("span",{className:"si-disclaimer-desc"},i({id:"tools.disclaimer",defaultMessage:"Miễn trừ tr\xe1ch nhiệm"})),_().createElement(ChevronDown,{className:"si-disclaimer-down"})),_().createElement(D.P.div,{className:"si-disclaimer-expanded",animate:t?{height:"auto"}:{height:0},transition:{duration:.3}},e)):null};Container$m.displayName="SubotInlineDisclaimer";let Container$l=({intent:e})=>{var t,n,i;let{formatMessage:l}=(0,h.useContext)(k.T),{encodedGaId:o}=function(){let[e,t]=(0,h.useState)(""),[n,i]=(0,h.useState)("");return(0,h.useEffect)(()=>{if(w.A.get(y.G)){let e=w.A.get(y.G);if(e){let n=btoa(e);t(n),i(e)}}else(0,M.c)({condition:()=>!!w.A.get(y.G),finished:()=>{let e=w.A.get(y.G);if(e){let n=btoa(e);t(n),i(e)}}})},[]),{encodedGaId:e,gaId:n}}(),handleOnClick=e=>{if(!e.url)return;let t=(0,M.j)(e.url,o);e.url&&(0,M.i)(t)},a=(0,h.useMemo)(()=>{try{return JSON.parse(e.label||"")||[]}catch(e){return[]}},[null==e?void 0:e.label]);if(!e.label||!a.length)return null;let r=null===(t=a[0])||void 0===t?void 0:t.disclaimer,s=null===(n=a[0])||void 0===n?void 0:n.sectionTitle;return _().createElement(eJ,null,_().createElement(Z.T,{size:"lg",weight:"semiBold",className:"si-title",color:"var(--subot-inline-text-color, #262626)"},(null===(i=null==s?void 0:s.trim)||void 0===i?void 0:i.call(s))||l({id:"tools.suggestedServices",defaultMessage:"Suggested services"})+":"),_().createElement("div",{className:"si-list-services"},a.map((e,t)=>_().createElement("div",{onClick:()=>handleOnClick(e),key:t,className:"image-wrapper",role:"presentation","data-event-category":"Service Connection","data-event-action":"Risk Screener Result Recommended Services","data-event-label":(0,M.j)((null==e?void 0:e.url)||"",o)},_().createElement(B.Box,{className:"aspect-square"},_().createElement("img",{loading:"lazy",src:e.feature,alt:e.feature,key:t})),e.title&&_().createElement(Z.T,{size:"p2",className:"si-service-title",color:"var(--subot-inline-text-color, #262626)"},e.title)))),r&&_().createElement(Container$m,{text:r}))};Container$l.displayName="SubotInlineIntentBotSuggestedService";let eQ=F.A.div` font-size: 16px; line-height: 24px; color: var(--subot-inline-text-color, #595959); font-weight: 400; ul, ol { li + li { margin-top: 12px; } } `,Container$k=({intent:e})=>{let{listNodes:t}=(0,h.useContext)(eT);if(!(null==e?void 0:e.label))return null;let n=(null==e?void 0:e.type)===E.N.BOT_MAIN_BODY;return _().createElement(eQ,{className:"si-bot-text"},_().createElement(Markdown,null,n?replaceTextWithVariables(e.label,t):null==e?void 0:e.label))};Container$k.displayName="SubotInlineIntentBotText";let e0=F.A.div` gap: 16px; display: flex; /* color: #262626; */ color: var(--subot-inline-text-color, #262626); max-width: 500px; margin: 0 auto; margin-top: 16px; img { width: 54px; min-width: 54px; height: 54px; } .si-sso-title { font-size: 16px; font-weight: 600; margin-bottom: 4px; } .si-sso-description { flex: 1; font-size: 14px; /* color: #595959; */ color: var(--subot-inline-text-color, #595959); line-height: 1.5; } `,Container$j=({intent:e})=>{let t=(()=>{try{return(null==e?void 0:e.label)?JSON.parse(null==e?void 0:e.label):{}}catch(e){return{}}})();return t&&t.title?_().createElement(e0,{id:"si-intent-sso"},_().createElement("img",{loading:"lazy",src:null==e?void 0:e.url,className:"icon",alt:""}),_().createElement("div",{className:"si-sso-content"},_().createElement("h3",{className:"si-sso-title"},t.title),_().createElement("div",{className:"si-sso-description"},t.description))):null};Container$j.displayName="SubotInlineIntentSSO";let e1=F.A.div` width: ${({width:e})=>e||"100%"}; padding: 4px; ${G.M.mbDown} { width: 100%; } `,e2=F.A.div` display: flex; .feature { width: 30%; .feature-wrapper { position: relative; display: block; overflow: hidden; width: 100%; padding-top: 66%; border-radius: ${Q.w.borderRadius}; .feature-img { position: absolute; top: 50%; left: 50%; width: 100%; min-width: 100%; height: auto; min-height: 100%; transform: translate(-50%, -50%); } } } .body { flex: 1; margin-left: 10px; line-height: 1.5; a { color: ${(null===(l=null===Q.w||void 0===Q.w?void 0:Q.w.colors)||void 0===l?void 0:l.gray800)||"#262626"}; text-decoration: none; } } `,Container$i=({intent:e})=>{let t=(0,h.useMemo)(()=>e.label.includes("{")?JSON.parse(e.label):{},[e.label]);return _().createElement(_().Fragment,null,!!Object.keys(t).length&&_().createElement(e1,null,_().createElement(e2,null,_().createElement("div",{className:"feature"},_().createElement("a",{href:null==t?void 0:t.url,className:"feature-wrapper"},_().createElement("img",{loading:"lazy",src:null==t?void 0:t.thumbnail,alt:null==t?void 0:t.title,className:"feature-img"}))),_().createElement("div",{className:"body"},_().createElement("a",{href:null==t?void 0:t.url},_().createElement("h5",{className:"title"},_().createElement(Markdown,null,null==t?void 0:t.title)))))))};Container$i.displayName="SubotInlineIntentUrl";let e6={[E.N.BOT_TEXT]:Container$k,[E.N.BOT_IMAGE]:Container$q,[E.N.BOT_BUTTON]:Container$r,[E.N.BOT_URL]:Container$i,[E.N.BOT_RECALCULATE]:Container$r,[E.N.BOT_MAIN_TITLE]:Container$p,[E.N.BOT_MAIN_IMAGE]:Container$q,[E.N.BOT_MAIN_BODY]:Container$k,[E.N.BOT_MAIN_BUTTON]:Container$r,[E.N.BOT_SUB_TITLE]:Container$k,[E.N.BOT_SUB_BODY]:Container$k,[E.N.BOT_RELATED_ARTICLE]:Container$n,[E.N.THANK_YOU_IMAGE]:Container$q,[E.N.THANK_YOU_TITLE]:Container$k,[E.N.THANK_YOU_BODY]:Container$k,[E.N.BOT_SUGGESTED_SERVICE]:Container$l,[E.N.BOT_BOOKING]:Container$r,[E.N.BOT_EVENT_SUBMISSION]:Container$o,[E.N.SSO_INTENT]:Container$j},e5=new Proxy(e6,{get:(e,t)=>e6[t]||(()=>ee.K?null:_().createElement("p",null,"SubotInlineIntentBase ",t))}),e3=[E.N.BOT_SUBMISSION,E.N.BOT_BACKGROUND_IMAGE],Container$h=({intents:e,indexNumber:t})=>{let n=e.filter(e=>!e3.includes(e.type||"")),i=n.find(e=>e.type===E.N.BOT_MAIN_TITLE),l=n.filter(e=>e.type!==E.N.BOT_MAIN_TITLE);return _().createElement(eq,{"data-intent-count":l.length+1},i&&_().createElement(Container$p,{intent:i,indexNumber:t}),!!l.length&&_().createElement("div",{className:"si-intent-list"},l.map(e=>{let t=(null==e?void 0:e.type)||"";if(e3.includes(t))return null;let n=e5[t];return n&&_().createElement(n,{key:e.id,intent:e})})))};Container$h.displayName="SubotInlineIntent";let Container$g=({node:e})=>{var t,n;let{setIsShowFooter:i,listNodes:l}=(0,h.useContext)(eT),o=l[0];if((0,h.useMemo)(()=>{i(!0)},[]),!e||!o)return null;let a=null===(t=o.extra_settings)||void 0===t?void 0:t.subot_type;return _().createElement(eV,{id:"si-node-final"},_().createElement(Container$h,{intents:e.intents||[]}),"ACUVUE"===a&&_().createElement(SubotInlineVoucherLeftUI,{clientId:null===(n=o.extra_settings)||void 0===n?void 0:n.client_id,voucherAnswers:extractVoucherAnswers(l,o)}))};Container$g.displayName="SubotinlineNodeFinal";let e4=0;function sendCompleteFlowEvent(e={}){let t=window.location.search.includes("itemId"),n=window.location.search.includes("resultId");n||t||function trackCustomEvent(e,t={}){let n=window.fbq;n?n("trackCustom",e,t):e4<3?(setTimeout(()=>trackCustomEvent(e,t),1e3),e4++):console.log("Unable to load Facebook Pixel")}("CompleteFlow",Object.assign({status:!0},e))}let e7=F.A.div` .wrap-main-intent { overflow: hidden; position: relative; &[data-hide='true'] { &::before { content: ''; position: absolute; bottom: 0; right: 0; display: block; width: 100%; height: 100px; background-image: linear-gradient(to bottom, transparent, white); cursor: pointer; } } } .wrap-main-button-intent { padding-top: 20px; padding-bottom: 0; display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; } .see-more-intent { /* color: #6cbef0; */ color: var(--subot-inline-text-color, #6cbef0); font-size: 16px; line-height: 24px; font-weight: 600; padding-top: 12px; cursor: pointer; display: block; } `;F.A.div` margin-top: 24px; border: 1px solid #ffecb6; border-radius: 16px; ${G.M.mbUp} { padding: 0 0 24px 0; } & > div { scale: 0.9; [data-tag='h5']::before { content: none; } } `;let e8=F.A.div` margin-top: 24px; padding: 12px 16px; border: 1px solid #e4e8ec; border-radius: 12px; background-color: #f7f9fc; padding-bottom: 8px; .si-sub-intent-expand { overflow: hidden; font-size: 12px; line-height: 18px; /* 150% */ margin-top: 8px; a, h1, h2, h3, h4, h5, h6, ul, ol, li { font-size: 12px; line-height: 18px; /* 150% */ } ul li + li, ol li + li { margin-top: 8px; } ol { list-style-type: decimal; } .si-bot-text { color: #595959; } } .si-sub-intent-title { color: #262626; /* color: var(--subot-inline-text-color, #262626); */ font-size: 16px; line-height: 24px; font-weight: 600; display: flex; align-items: center; gap: 8px; cursor: pointer; } /* > div:first-child { font-size: 16px; font-weight: 600; + div { margin-top: 16px; ${G.M.mbUp} { margin-top: 24px; } } ${G.M.mbUp} { font-size: 18px; } } */ `,References=e=>_().createElement("svg",Object.assign({width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),_().createElement("mask",{id:"mask0_2159_150362",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"20",height:"20"},_().createElement("rect",{width:"20",height:"20",fill:"#D9D9D9"})),_().createElement("g",{mask:"url(#mask0_2159_150362)"},_().createElement("path",{d:"M13.878 16.25a.35.35 0 0 0 .258-.11.35.35 0 0 0 .11-.259v-2.18a.35.35 0 0 0-.11-.257.35.35 0 0 0-.258-.111.35.35 0 0 0-.258.11.35.35 0 0 0-.111.259v2.179q0 .147.11.258.111.11.258.11m0-3.678q.15.008.26-.105a.37.37 0 0 0-.003-.523.36.36 0 0 0-.517 0 .35.35 0 0 0-.11.256.36.36 0 0 0 .112.259.35.35 0 0 0 .258.113M4.166 3.333v5.152-.024 8.205zm2.5 8.125h2.277q.182-.36.407-.668.226-.308.497-.582H6.666a.6.6 0 0 0-.445.18.6.6 0 0 0-.18.445q0 .266.18.445.18.18.445.18m0 3.333h1.69a4.7 4.7 0 0 1-.017-1.25H6.666a.6.6 0 0 0-.445.18.6.6 0 0 0-.18.446q0 .265.18.445t.445.18m-2.242 3.125q-.633 0-1.07-.437a1.45 1.45 0 0 1-.438-1.07V3.59q0-.63.438-1.068a1.45 1.45 0 0 1 1.068-.438h5.996q.305 0 .58.117a1.5 1.5 0 0 1 .482.322l3.497 3.497a1.5 1.5 0 0 1 .439 1.062V8.68a4 4 0 0 0-.608-.14 5 5 0 0 0-.642-.054V7.083h-3a.73.73 0 0 1-.534-.216.73.73 0 0 1-.216-.534v-3H4.422a.25.25 0 0 0-.176.08.25.25 0 0 0-.08.176v12.82q0 .097.08.177t.176.08h4.545q.182.36.411.668.23.308.51.582zm9.453-7.628q1.561 0 2.656 1.095t1.095 2.655-1.095 2.656-2.656 1.094-2.655-1.094-1.094-2.656 1.094-2.655 2.656-1.095",fill:"#6CBEF0"}))),SubInlineIntent=({subIntents:e})=>{let[t,n]=(0,h.useState)(!1),[i,...l]=e;return i?_().createElement(e8,null,_().createElement("div",{className:"si-sub-intent-title",onClick:()=>n(!t)},_().createElement(References,null),_().createElement("span",null,i.label),_().createElement(ChevronDown,{className:"si-chevron-down"})),_().createElement(D.P.div,{className:"si-sub-intent-expand",animate:t?{height:"auto"}:{height:0},transition:{duration:.3},"data-show":t},l.map(e=>{let t=(null==e?void 0:e.type)||"",n=e5[t];return n&&_().createElement(n,{key:e.id,intent:e})}))):null},Container$f=({node:e})=>{let t=(0,h.useRef)(null),{formatMessage:n}=(0,h.useContext)(k.T),{setIsShowFooter:i,listNodes:l}=(0,h.useContext)(eT),[o,a]=(0,h.useState)(!1);(0,h.useEffect)(()=>{var e;(null===(e=t.current)||void 0===e?void 0:e.offsetHeight)&&t.current.offsetHeight<=300&&a(!0)},[]);let r=l[0];console.log("botItem",typeof r);let s=e.intents||[],{mainIntents:d,subIntents:c,mainButtonIntents:u,bookingButtonIntents:m,relatedArticleIntents:p,suggestedServiceIntents:v,botSubmissionIntent:g}=(0,h.useMemo)(()=>{let e;let t=[],n=[],i=[],l=[],o=[],a=[],r=[];return s.forEach(s=>{switch(null==s?void 0:s.type){case E.N.BOT_MAIN_IMAGE:case E.N.BOT_MAIN_TITLE:case E.N.BOT_MAIN_BODY:t.push(s);break;case E.N.BOT_SUGGESTED_SERVICE:r.push(s);break;case E.N.BOT_MAIN_BUTTON:n.push(s);break;case E.N.BOT_BOOKING:i.push(s);break;case E.N.BOT_RECALCULATE:break;case E.N.BOT_SUB_TITLE:case E.N.BOT_SUB_BODY:l.push(s);break;case E.N.BOT_RELATED_ARTICLE:a.push(s);break;case E.N.BOT_RISK_SCREEN:o.push(s);break;case E.N.BOT_SUBMISSION:e=s}}),{mainIntents:t,subIntents:l,mainButtonIntents:n,bookingButtonIntents:i,screenerIntents:o,relatedArticleIntents:a.filter(e=>{var t;return null===(t=articleDataComputed(e))||void 0===t?void 0:t.title}),botSubmissionIntent:e,suggestedServiceIntents:r}},[]);return((0,h.useMemo)(()=>{i(!0)},[]),(0,h.useEffect)(()=>{(null==g?void 0:g.label)?sendCompleteFlowEvent({risk_level:g.label}):sendCompleteFlowEvent()},[]),e)?_().createElement(e7,{id:"si-node-final"},_().createElement(D.P.div,{ref:t,animate:o?{height:"auto"}:{height:300},transition:{duration:.3},className:"wrap-main-intent","data-hide":!o},_().createElement(Container$h,{intents:d})),!o&&_().createElement("span",{role:"presentation",className:"see-more-intent",onClick:()=>a(!0)},n({id:"articlePage.careEmbedding.seeMore",defaultMessage:"See more"})),_().createElement("div",{className:"wrap-main-button-intent"},[...u,...m].map(e=>{let t=e5[e.type||""];return t&&_().createElement(t,{key:e.id,intent:e})})),(null==v?void 0:v.length)>0&&_().createElement("div",null,v.map(e=>{let t=e5[e.type||""];return t&&_().createElement(t,{key:e.id,intent:e})})),(null==p?void 0:p.length)>0&&_().createElement("div",{style:{marginTop:24}},_().createElement(Z.T,{size:"lg",weight:"semiBold",color:"var(--subot-inline-text-color, #262626)"},n({id:"articlePage.relatedPostsSectionTitle",defaultMessage:"Related Articles"})),_().createElement("div",{style:{padding:"8px 0"}},p.map(e=>{let t=e5[e.type||""];return t&&_().createElement(t,{key:e.id,intent:e})}))),_().createElement(SubInlineIntent,{subIntents:c})):null};Container$f.displayName="SubotinlineNodeFinalStandard";let e9=F.A.div` .si-final-thank-action { text-align: center; } `,Container$e=({node:e})=>{let{params:t,onNext:n,setIsShowFooter:i}=(0,h.useContext)(eT);(0,h.useMemo)(()=>{i(!0)},[]);let l=(0,h.useMemo)(()=>{var t;let n=null===(t=null==e?void 0:e.actions)||void 0===t?void 0:t.find(({type:e})=>e===E.f.RESULT_BUTTON);return n||null},[null==e?void 0:e.actions]),o=(0,h.useCallback)(()=>{n&&n(Object.assign(Object.assign(Object.assign({},t),null==e?void 0:e._message),{action_id:null==l?void 0:l.id,action_value:null==l?void 0:l.key}))},[l]);return e?_().createElement(e9,{id:"si-node-final-thank-you"},_().createElement(Container$h,{intents:e.intents||[]}),l&&_().createElement("div",{className:"si-final-thank-action"},_().createElement(H.B,{size:"md",onClick:o},l.label))):null};Container$e.displayName="SubotinlineNodeFinal";var te={vn:[{name:"vn",child:"City"},{name:"City",child:"District"},{name:"District",child:"Ward"},{name:"Ward",child:"Postcode"},{name:"Postcode",child:""}],id:[{name:"id",child:"Province"},{name:"Province",child:"City"},{name:"City",child:"District"},{name:"District",child:"Village"},{name:"Village",child:"Postcode"},{name:"Postcode",child:""}],th:[{name:"th",child:"Province"},{name:"Province",child:"District"},{name:"District",child:"Sub-district"},{name:"Sub-district",child:"Postcode"},{name:"Postcode",child:""}],mm:[{name:"mm",child:"City"},{name:"City",child:"Postcode"},{name:"Postcode",child:""}],tw:[{name:"tw",child:"Country"},{name:"Country",child:"City"},{name:"City",child:"Postcode"},{name:"Postcode",child:""}],ph:[{name:"ph",child:"Region"},{name:"Region",child:"Province"},{name:"Province",child:"City"},{name:"City",child:"Barangay"},{name:"Barangay",child:"Postcode"},{name:"Postcode",child:""}],kh:[{name:"kh",child:"Province"},{name:"Province",child:"District"},{name:"District",child:"Sub-district"},{name:"Sub-district",child:"Postcode"},{name:"Postcode",child:""}],my:[{name:"my",child:"State"},{name:"State",child:"Sub-district"},{name:"Sub-district",child:"Location"},{name:"Location",child:"Postcode"},{name:"Postcode",child:""}],in:[{name:"in",child:"State"},{name:"State",child:"Sub-district"},{name:"Sub-district",child:"Location"},{name:"Location",child:"Postcode"},{name:"Postcode",child:""}]};let tt=(0,M.g)(k.u);function getLevelKey(e,t){return te[e][t-1].child||te.vn[t-1].child}function getDataFromLevelKey(e,t,n,i){let l={},o=[];fetch(tt+`/countries/${e}.json`).then(e=>e.json()).then(a=>{let r=a[e];r.forEach(e=>{let i="";e[t]&&!l[e[t]]&&(n&&n.key?e[n.key]===n.value&&(i=e[t]):i=e[t],i&&(l[e[t]]=!0,o.push(e[t])))}),i&&i(o)}).catch(e=>{console.log(e),i&&i([])})}let fnLogicSort=(e,t)=>{let n=e.replace("Tỉnh ","").replace("Th\xe0nh phố ","").replace("Quận ","").replace("Huyện ","").replace("Phường ","").replace("Thị x\xe3 ","").replace("Thị trấn ","").replace("X\xe3 ",""),i=t.replace("Tỉnh ","").replace("Th\xe0nh phố ","").replace("Quận ","").replace("Huyện ","").replace("Phường ","").replace("Thị x\xe3 ","").replace("Thị trấn ","").replace("X\xe3 ","");return n.localeCompare(i)},useAddressMultipleLevelData=e=>{let t=(e||"vn").toLowerCase(),n=getLevelKey(t,1),i=getLevelKey(t,2),l=getLevelKey(t,3),[o,a]=(0,h.useState)([]),[r,s]=(0,h.useState)([]),[d,c]=(0,h.useState)([]),[u,m]=(0,h.useState)(""),[p,v]=(0,h.useState)(""),[g,b]=(0,h.useState)("");return(0,h.useEffect)(()=>{getDataFromLevelKey(t,n,void 0,e=>{a(e.sort(fnLogicSort))})},[t,n]),(0,h.useEffect)(()=>{i&&getDataFromLevelKey(t,i,{key:n,value:u},e=>{s(e.sort(fnLogicSort))})},[t,n,i,u]),(0,h.useEffect)(()=>{l&&getDataFromLevelKey(t,l,{key:i,value:p},e=>{c(e.sort(fnLogicSort))})},[t,i,l,p]),{level1:o,level2:r,level3:d,setSelectedLevel1:m,setSelectedLevel2:v,setSelectedLevel3:b,selectedLevel1:u,selectedLevel2:p,selectedLevel3:g}},CheckCircleGreen=e=>_().createElement("svg",Object.assign({width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),_().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1.333 8A6.67 6.67 0 0 1 8 1.333 6.67 6.67 0 0 1 14.667 8 6.67 6.67 0 0 1 8 14.667 6.67 6.67 0 0 1 1.333 8m2.467.467 2.393 2.393c.26.26.687.26.94 0l5.06-5.06a.664.664 0 1 0-.94-.94L6.667 9.447 4.74 7.527a.664.664 0 1 0-.94.94",fill:"#00B16A"})),IconEdit=e=>_().createElement("svg",Object.assign({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),_().createElement("path",{d:"M19.1719 2C18.4481 2 17.7244 2.27562 17.1719 2.82812L16 4L20 8L21.1719 6.82812C22.2759 5.72412 22.2759 3.93313 21.1719 2.82812C20.6194 2.27562 19.8956 2 19.1719 2ZM14.5 5.5L3 17V21H7L18.5 9.5L14.5 5.5Z",fill:"#2685F1"})),InfoError=e=>_().createElement("svg",Object.assign({width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),_().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 1.333A6.67 6.67 0 0 0 1.333 8 6.67 6.67 0 0 0 8 14.667 6.67 6.67 0 0 0 14.667 8 6.67 6.67 0 0 0 8 1.333m0 7.334A.67.67 0 0 1 7.333 8V5.333c0-.366.3-.666.667-.666s.667.3.667.666V8c0 .367-.3.667-.667.667M7.333 10v1.333h1.334V10z",fill:"#F44D2C"}));var tn=(0,h.forwardRef)(({onFinish:e,onClick:t,isFinished:n,resendLabel:i,className:l},o)=>{let[a,r]=(0,h.useState)(M.T),s=(0,h.useRef)(),d=(0,h.useRef)(),{formatMessage:c}=(0,h.useContext)(k.T);d.current=e;let u=(0,h.useCallback)(()=>{let e=M.T;r(e),clearInterval(s.current),s.current=setInterval(()=>{var t;r(e-=1),0===e&&(null===(t=d.current)||void 0===t||t.call(d,!0),clearInterval(s.current))},1e3)},[]),m=(0,h.useCallback)(()=>{r(0),clearInterval(s.current)},[]);return(0,h.useImperativeHandle)(o,()=>({reset:u,cancel:m,isFinished:0===a})),(0,h.useEffect)(()=>(u(),()=>{clearInterval(s.current)}),[]),_().createElement("div",{className:l,onClick:t},i||c({id:"subot.resendOTP.button",defaultMessage:"Resend"}),a>0&&!n&&` (${a}s)`)});let ti=F.A.div` margin: 0 auto; background: #f7f9fc; border-radius: ${Q.w.borderRadius}; ${G.M.mbDown} { padding: 16px; } ${G.M.tdDown} { padding: 24px; } ${G.M.mbUp} { padding: 32px; } .user-info-form { .input-row { ${G.M.mbDown} { margin-bottom: 16px; } ${G.M.tdDown} { margin-bottom: 18px; } ${G.M.mbUp} { margin-bottom: 20px; } .address-dropdown > ul { z-index: 20000; max-height: 250px; overflow-y: auto; } &.error { margin-bottom: 0; } } label { display: block; margin-bottom: 6px; color: ${Q.w.colors.gray600}; font-size: 13px; font-weight: bold; } input[type='tel'], input[type='number'] { width: 100%; padding: 12px 16px; border: solid 1px ${Q.w.colors.gray200}; background: #fff; border-radius: ${Q.w.borderRadius}; &[disabled] { background-color: ${Q.w.colors.gray100}; } } input[type='number']::-webkit-inner-spin-button, input[type='number']::-webkit-outer-spin-button { -webkit-appearance: none; -moz-appearance: none; appearance: none; } button { width: 100%; } .error-message { display: block; padding-bottom: 20px; color: ${Q.w.colors.red700}; font-weight: ${Q.w.sizes.fwRegular}; } .submit-btn { padding: 12px 24px; background-color: ${Q.w.colors.primaryBase}; border-radius: ${Q.w.borderRadius}; color: #fff; cursor: pointer; font-size: 16px; font-weight: 700; line-height: 24px; transition: background-color 0.3s, border-color 0.3s; display: flex; justify-content: center; &:hover { background-color: ${Q.w.colors.primaryHover}; } &[disabled] { background-color: ${Q.w.colors.gray200}; color: #bfbfbf; cursor: not-allowed; } .spinner { margin-right: 20px; } } .submit-btn-row { ${G.M.mbUp} { margin-bottom: 16px; } ${G.M.tdDown} { margin-bottom: 14px; } ${G.M.mbDown} { margin-bottom: 12px; } .subot-checkbox { display: flex; align-items: flex-start; margin: 0; cursor: pointer; &__input { position: relative; display: block; overflow: hidden; width: 18px; height: 18px; box-sizing: border-box; padding: 0; margin-right: 10px; &:before { position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: flex; background-color: ${Q.w.colors.primaryBase}; background-image: url('data:image/svg+xml,'); background-position: center; background-repeat: no-repeat; background-size: 120%; content: ''; opacity: 0; transition: 0.3s all ease; } &:checked:before { opacity: 1; transition: 0.3s all ease; } } &__label { flex: 1; font-weight: 400; line-height: 1.4; } } } } `,tl=F.A.div` position: relative; .PhoneInputCountry { background-color: #f2f2f2; .PhoneInputCountrySelectArrow { display: none !important; } } .icon-edit-phone { width: 1em; height: 1em; position: absolute; right: 16px; top: 17px; cursor: pointer; path { fill: ${Q.w.colors.gray600}; } } `,Location=e=>_().createElement("svg",Object.assign({width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),_().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.167 7.72A5.83 5.83 0 0 1 10 1.889a5.83 5.83 0 0 1 5.833 5.833c0 3.475-3.683 8.267-5.191 10.092-.334.4-.942.4-1.275 0-1.517-1.825-5.2-6.617-5.2-10.092m3.75 0a2.084 2.084 0 1 0 4.168 0 2.084 2.084 0 0 0-4.168 0",fill:"#ADB3BC"})),to=F.A.div` display: flex; gap: 13px; svg { position: relative; top: 2px; min-width: 20px; } `,ta=(0,h.forwardRef)(function(e,t){var{label:n}=e,i=(0,x.a)(e,["label"]);return _().createElement(to,Object.assign({ref:t},i),_().createElement(Location,null),_().createElement("span",null,n))}),DeleteSvg=e=>_().createElement("svg",Object.assign({width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),_().createElement("path",{d:"M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16M4.293 4.293a1 1 0 0 1 1.414 0L8 6.586l2.293-2.293a1 1 0 1 1 1.414 1.414L9.414 8l2.293 2.293a1 1 0 0 1-1.414 1.414L8 9.414l-2.293 2.293a1 1 0 0 1-1.414-1.414L6.586 8 4.293 5.707a1 1 0 0 1 0-1.414",fill:"#BFBFBF"})),tr=["places"];(i=o||(o={})).HELLO_BAC_SI="VN",i.MARRY_BABY="VN",i.HELLO_SEHAT="ID",i.HELLO_KHUNMOR="TH",i.HELLO_DOKTOR="MY",i.HELLO_YISHI="TW",i.HELLO_KRUPET="KH",i.HELLO_SAYARWON="MM",i.HELLO_SWATHYA="IN",i.HELLO_DOCTOR="PH",i.HELLO_DOCTOR_FIL="PH";let ts={streetNumber:"street_number",street:"route",ward:"sublocality_level_1",district:"administrative_area_level_2",city:"locality",province:"administrative_area_level_1"},td=Object.keys(ts).concat(["address"]);var tc=(0,h.memo)(function({action:e,formError:t,control:n,initValue:i,onChange:l}){let o=null===k.G||void 0===k.G?void 0:k.G.locale,a=o.split("-")[1],{formatMessage:r}=(0,h.useContext)(k.T),[s,d]=(0,h.useState)(""),c=(0,h.useRef)(null),u=(0,h.useRef)(null),{predictions:m}=(0,er.u)(s,a);(0,h.useEffect)(()=>{c.current=document.createElement("div")},[]),(0,h.useEffect)(()=>{(null==i?void 0:i.address)&&d(i.address)},[]);let p=(0,h.useMemo)(()=>{let e=m.map(e=>({value:e.description,label:e.description,placeId:e.placeId}));return e},[m]),separateAddress=e=>{var t,n,i,l,o,a,r;let s=(null===(t=e.find(e=>e.types.includes(ts.streetNumber)))||void 0===t?void 0:t.long_name)||"",d=(null===(n=e.find(e=>e.types.includes(ts.street)))||void 0===n?void 0:n.long_name)||"",c=(null===(i=e.find(e=>e.types.includes(ts.ward)))||void 0===i?void 0:i.long_name)||"",u=(null===(l=e.find(e=>e.types.includes(ts.district)))||void 0===l?void 0:l.long_name)||"",m=(null===(o=e.find(e=>e.types.includes(ts.city)))||void 0===o?void 0:o.long_name)||"",p="";return m?p=(null===(r=e.find(e=>e.types.includes(ts.province)))||void 0===r?void 0:r.long_name)||"":m=(null===(a=e.find(e=>e.types.includes(ts.province)))||void 0===a?void 0:a.long_name)||"",{street:s.concat(" ",d),ward:c,district:u,city:m,province:p}},handleSelectAddress=(t,n)=>{if(n){let i=new window.google.maps.places.PlacesService(c.current);i.getDetails({placeId:n,language:er.a[a]},function(n,i){if((null==e?void 0:e.key)&&i===window.google.maps.places.PlacesServiceStatus.OK){let{city:i,district:o,province:a,street:r,ward:s}=separateAddress(n.address_components);l(e.key,{address:t,city:i,district:o,province:a,street:r,ward:s})}else console.error("Get place details failed")})}};return e.key?_().createElement("div",{className:"input-row input-google-address-row",ref:u},_().createElement(ea.LoadScript,{googleMapsApiKey:er.G,libraries:tr,loadingElement:_().createElement(_().Fragment,null)}),_().createElement("label",{htmlFor:e.key},e.label),_().createElement(el.xI,{name:e.key,control:n,rules:{required:!0},render:t=>{let{address:n=""}=t.field.value||{};return console.log("props",t),_().createElement(et.S,{data:p,icon:_().createElement(Location,null),itemComponent:ta,filter:()=>!0,searchable:!0,className:j()({isEmpty:0===p.length||1===p.length&&p[0].label===n}),onChange:t=>{console.log("newAddress",t);let n=p.find(e=>e.value===t);l(e.key,{address:t}),n&&t&&handleSelectAddress(t,n.placeId)},clearable:!0,styles:()=>({item:{"&":{paddingLeft:"16px"},"&[data-selected], &[data-selected]:hover":{color:"#262626",backgroundColor:"#f8f9fc"},"&:first-child":{display:"none"}},icon:{"&":{width:"auto",paddingLeft:"16px",paddingRight:"13px",zIndex:0}},input:{"&":{height:"50px",paddingLeft:"45px!important",paddingRight:"32px!important"}},itemsWrapper:{"&":{padding:"0"}},rightSection:{pointerEvents:"auto"}}),value:n,rightSection:n?_().createElement(DeleteSvg,{style:{cursor:"pointer"},className:"delete-icon",onClick:()=>{l(e.key,void 0),setTimeout(()=>{var e;let t=null===(e=u.current)||void 0===e?void 0:e.querySelector(".mantine-Select-input");null==t||t.focus()},200)}}):_().createElement(_().Fragment,null),placeholder:e.label,searchValue:s,onSearchChange:t=>{d(t),t||l(e.key,void 0)}})}}),t&&_().createElement("p",{className:"error-message"},r({id:"validation.error.requiredField",defaultMessage:"This field is required"}))):null});let tu=(0,es.s)(F.A.div` position: relative; .input-date { display: none; } `,"hhgcomp-subot-datepickerinput"),tm=F.A.div` margin: 0 auto; background: #f7f9fc; border-radius: ${Q.w.borderRadius}; ${G.M.mbDown} { padding: 16px; } ${G.M.tdDown} { padding: 24px; } ${G.M.mbUp} { padding: 32px; } .user-info-form { .input-google-address-row { .isEmpty { .mantine-Select-dropdown { display: none !important; } } .mantine-Select-dropdown { z-index: 1; } } .input-row { ${G.M.mbDown} { margin-bottom: 16px; } ${G.M.tdDown} { margin-bottom: 18px; } ${G.M.mbUp} { margin-bottom: 20px; } .address-dropdown > ul { z-index: 20000; max-height: 250px; overflow-y: auto; } &.input-row--otp { .PhoneInput { .PhoneInputCountry { background-color: #f2f2f2; } &.PhoneInput--readOnly { .PhoneInputInput { background-color: #f2f2f2; } } } .PhoneInputInput { padding: 12px 16px; border-left: 1px solid #d9d9d9; &[disabled] { background-color: ${Q.w.colors.gray100}; } } & > .error-message { top: -1em; position: relative; padding-top: 0; } } &.input-row--verify { &.verified-otp { input { margin-bottom: 0; :disabled { background-color: #f2f2f2; } } } &.error-verify-otp { input { margin-bottom: 0; border: 1px solid #e64728; } } .verify-success { display: flex; margin-top: 5px; align-items: center; svg { margin-right: 5px; } &-label { font-weight: 400; font-size: 14px; line-height: 22px; color: #009e5c; } } input { margin-bottom: 20px; } .error-message { margin-bottom: 20px; } } } label { display: block; margin-bottom: 6px; color: var(--subot-inline-text-color, ${Q.w.colors.gray600}); font-size: 13px; font-weight: bold; } input:not([type='checkbox']), input:not([type='radio']) { width: 100%; padding: 12px 16px; border: solid 1px ${Q.w.colors.gray200}; background: #fff; border-radius: ${Q.w.borderRadius}; } .mantine-Select-input { line-height: 1; height: auto !important; padding-right: 30px !important; } input[type='radio'] { position: relative; display: flex; width: 20px; height: 20px; align-items: center; justify-content: center; padding: 0; border-width: 2px; border-radius: 50%; } input[type='radio']:before { position: absolute; top: 50%; left: 50%; display: block; width: 10px; height: 10px; background-color: ${Q.w.colors.primaryBase}; border-radius: 50%; content: ''; opacity: 0; transform: translate(-50%, -50%); transition: 0.3s all ease; } input[type='checkbox']:checked, input[type='radio']:checked { border-color: ${Q.w.colors.primaryBase}; transition: 0.3s all ease; } input[type='checkbox']:checked:before, input[type='radio']:checked:before { opacity: 1; transition: 0.3s all ease; } ${tu.classSelector} { input { background-image: url(/svg/calendar.svg); background-position: right 14px center; background-repeat: no-repeat; } } button { width: 100%; } .radio-label { display: flex; align-items: center; justify-content: flex-start; margin-bottom: 0; cursor: pointer; input[type='radio'] { margin-right: 8px; } } .radio-group { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: flex-start; margin: -4px -16px; .radio-label { padding: 4px 16px; font-size: 14px; font-weight: 400; } } .error-message { display: block; padding-top: 10px; font-size: 14px; display: flex; align-items: center; color: ${Q.w.colors.red700}; font-weight: ${Q.w.sizes.fwRegular}; svg { margin-right: 5px; } } .submit-btn { padding: 12px 24px; background-color: ${Q.w.colors.primaryBase}; border-radius: ${Q.w.borderRadius}; color: #fff; cursor: pointer; font-size: 16px; font-weight: 700; line-height: 24px; transition: background-color 0.3s, border-color 0.3s; &:hover { background-color: ${Q.w.colors.primaryHover}; } &[disabled] { font-weight: ${Q.w.sizes.fwSemiBold}; background-color: rgb(242, 242, 242); color: rgb(140, 140, 140); } } .submit-btn-row { ${G.M.mbUp} { margin-bottom: 16px; } ${G.M.tdDown} { margin-bottom: 14px; } ${G.M.mbDown} { margin-bottom: 12px; } .subot-checkbox { display: flex; align-items: flex-start; margin: 0; cursor: pointer; &__label { flex: 1; font-weight: 400; line-height: 20px; padding-left: 28px; position: relative; &:before { position: absolute; top: 0; left: 0; width: 20px; height: 20px; border: 2px solid #8c8c8c; border-radius: 50%; content: ''; transition: 0.25s all linear; } &:after { content: ''; position: absolute; top: 5px; left: 5px; width: 10px; height: 10px; background-color: #2685f1; border-radius: 50%; opacity: 0; transition: 0.25s all linear; } } &__input { display: none; &:checked + .subot-checkbox__label { &:before { border-color: #2685f1; } &:after { opacity: 1; } } } } } .PhoneInput { .PhoneInputCountry { padding: 8px 15px; border: solid 1px ${Q.w.colors.gray200}; border-right: none; margin: 0; background-color: #fff; border-bottom-left-radius: 6px; border-top-left-radius: 6px; } .PhoneInputInput { padding-left: 0; border: solid 1px ${Q.w.colors.gray200}; border-left: none; margin: 0; border-bottom-left-radius: 0 !important; border-bottom-right-radius: 6px !important; border-top-left-radius: 0 !important; border-top-right-radius: 6px !important; } } .form-terms { margin-top: 20px; font-size: 13px; line-height: 1.4; color: var(--subot-inline-text-color, #595959); p { text-align: center; } a { color: var(--subot-inline-primary-color); text-align: center; text-decoration: none; } } .subot_input_date { --input-height: 46px; --input-max-width: 100%; input[type='text'] { padding: 0 !important; background-color: transparent !important; background-image: none !important; border: none !important; line-height: 0.5; } .input_date-input_container { background-color: #fff; &:focus-within, &.input_date-input_shrink { --input-padding-y: 5px; } } } } &.si-form-revamp { width: 100%; border-radius: 12px; background: var(--subot-inline-bg-content-color, #f7f9fc); padding: 24px !important; .user-info-form { .submit-btn { font-size: 14px; border-radius: 8px; padding: 8px 16px; &:not(:disabled) { color: var(--subot-inline-text-button-color, #fff); background-color: var(--subot-inline-primary-color); } &:not(:disabled):hover { background-color: var(--subot-inline-primary-color-hover); } } .submit-btn-row .subot-checkbox__label:after { background-color: var(--subot-inline-primary-color); } .submit-btn-row .subot-checkbox__input:checked + .subot-checkbox__label:before { border-color: var(--subot-inline-primary-color); } .address-dropdown { --dropdown-padding: 8px 18px 8px 16px; } button.btn-send-otp:not(:disabled) { color: var(--subot-inline-primary-color); &:hover { background-color: var(--subot-inline-primary-color-100); } } .address-dropdown { --dropdown-padding: 8px 18px 8px 16px; } } } `,tp=F.A.div` .wrapper-address-lever { display: flex; gap: 16px; justify-content: space-between; ${G.M.mbDown} { flex-direction: column; gap: 0; } .input-row { flex: 1; min-width: 0; .hide-label { display: none; } .address-dropdown > div { overflow: hidden; text-overflow: ellipsis; } .address-input { white-space: nowrap; } .show-placeholder { > div { span { color: ${Q.w.colors.gray400}; font-size: 16px; font-weight: 400; line-height: 24px; } } } } } `,getActionEmail=e=>e.find(({type:e})=>e===E.f.USER_SUBMIT_EMAIL),getActionName=e=>e.find(({type:e})=>e===E.f.USER_SUBMIT_NAME),getActionPhone=e=>e.find(({type:e})=>e===E.f.USER_SUBMIT_PHONE),getActionOtp=e=>e.find(({type:e})=>e===E.f.USER_SUBMIT_OTP),getActionOtpWhatsApp=e=>e.find(({type:e})=>e===E.f.USER_SUBMIT_WHATSAPP),getActionConfirm=e=>e.find(({type:e})=>e===E.f.USER_SUBMIT_CONFIRM),isControlOtp=e=>e===E.E[E.f.USER_SUBMIT_OTP]||e===E.E[E.f.USER_SUBMIT_WHATSAPP],isActionTypeOtp=e=>e===E.f.USER_SUBMIT_OTP||e===E.f.USER_SUBMIT_WHATSAPP,getTranslateVerifiedOtpMessages=()=>{let e=new Map;return e.set(ed.L.Vietnam,"Số điện thoại n\xe0y đ\xe3 được x\xe1c minh."),e.set(ed.L.PhilippinesEnglish,"This phone number has been verified."),e.set(ed.L.Cambodia,"លេខទូរស័ព្ទនេះត្រូវបានផ្ទៀងផ្ទាត់។"),e.set(ed.L.India,"इस फ़ोन नंबर की पुष्टि कर दी गई है."),e.set(ed.L.Indonesia,"Nomor telepon ini telah diverifikasi."),e.set(ed.L.Malaysia,"Nombor telefon ini telah disahkan."),e.set(ed.L.Myanmar,"ဤဖုန်းနံပါတ်ကို စစ်ဆေးပြီးပါပြီ။"),e.set(ed.L.Taiwan,"該電話號碼已經過驗證。"),e.set(ed.L.Thailand,"หมายเลขโทรศัพท์นี้ได้รับการตรวจสอบแล้ว"),e.set(ed.L.PhilippinesTagalog,"Na-verify na ang numero ng teleponong ito."),e},getTransPleaseVerifiedOtp=()=>{let e=new Map;return e.set(ed.L.Vietnam,"Vui l\xf2ng x\xe1c minh số điện thoại"),e.set(ed.L.PhilippinesEnglish,"Please verify your phone number"),e.set(ed.L.Cambodia,"សូមផ្ទៀងផ្ទាត់លេខទូរស័ព្ទរបស់អ្នក។"),e.set(ed.L.India,"कृपया अपना फ़ोन नंबर सत्यापित करें"),e.set(ed.L.Indonesia,"Harap verifikasi nomor telepon AndaNomor telepon ini telah diverifikasi."),e.set(ed.L.Malaysia,"Sila sahkan nombor telefon anda"),e.set(ed.L.Myanmar,"သင့်ဖုန်းနံပါတ်ကို အတည်ပြုပါ။"),e.set(ed.L.Taiwan,"請驗證您的電話號碼"),e.set(ed.L.Thailand,"กรุณาตรวจสอบหมายเลขโทรศัพท์ของคุณ"),e.set(ed.L.PhilippinesTagalog,"Paki-verify ang iyong numero ng telepono"),e},validateDateField=(e,t,n,i)=>{let l=n({id:"error.day.invalid",defaultMessage:"This date is not valid, please update."});if(!e)return n({id:"validation.error.requiredField",defaultMessage:"This field is required"});if("string"==typeof e){let n=e.split("/");return 3===n.length?l:!t||l}let o=$()(e);return o.isValid()?!i||i(e):l},tv={ERR_PHONE_VERIFIED:{id:"common.phone_verified",defaultMessage:"This phone number was verified"},ERR_OTP_EXPIRED:{id:"common.otp_expired",defaultMessage:"Your OTP has expired. Please request a new OTP."},ERR_INVALID_PHONE_NUMBER:{id:"common.phone_invalid",defaultMessage:"Invalid phone number"},ERR_OTP_INVALID:{id:"common.otp_invalid",defaultMessage:"Invalid OTP"},ERR_UNKNOWN:{id:"common.otp_unknow",defaultMessage:"Unknown error"}},tg=F.A.div` display: flex; align-items: center; > svg, > img { width: 24px; height: 24px; margin-right: 5px; border-radius: 2px; } > div { color: ${(null===(a=Q.w.colors)||void 0===a?void 0:a.gray800)||""}; white-space: nowrap; } `;(0,F.A)(eo.default)` display: flex; border: 1px solid ${(null===(r=Q.w.colors)||void 0===r?void 0:r.gray200)||""}; border-radius: ${null===Q.w||void 0===Q.w?void 0:Q.w.borderRadius}; .PhoneInputCountry { position: relative; padding: 12px 8px 12px 16px; border-right: 1px solid ${(null===(s=Q.w.colors)||void 0===s?void 0:s.gray200)||""}; background-color: ${(null===(d=Q.w.colors)||void 0===d?void 0:d.gray100)||""}; border-radius: 6px 0 0 6px; color: ${(null===(c=Q.w.colors)||void 0===c?void 0:c.gray800)||""}; .PhoneInputCountrySelect { position: absolute; top: 0; right: 0; bottom: 0; left: 0; opacity: 0; pointer-events: none; } .PhoneInputCountryIconImg { width: 24px; height: 16px; border-radius: 2px; object-fit: cover; object-position: center; } } .PhoneInputInput { padding: 0 16px; } &.has--error { border-color: ${Q.w.colors.red700||""}; } &.PhoneInput--focus { border-color: ${Q.w.colors.primaryBase||""}; box-shadow: 0px 0px 2px 2px #91caff; } `;let tb=(0,F.A)(eo.default)` &.PhoneInput { .PhoneInputCountry { padding: 10px; border: solid 1px ${Q.w.colors.gray200}; border-right: none; margin: 0; background-color: #f2f2f2; border-bottom-left-radius: 6px; border-top-left-radius: 6px; padding: 0 15px; .PhoneInputCountrySelectArrow { transform: rotate(0deg); display: flex; align-items: center; border: none; margin-left: 10px; width: auto; } } .PhoneInputInput { padding-left: 10px; border: solid 1px ${Q.w.colors.gray200}; margin: 0; width: 100%; padding: 12px 16px; background: #fff; border-bottom-left-radius: 0 !important; border-bottom-right-radius: 6px !important; border-top-left-radius: 0 !important; border-top-right-radius: 6px !important; } .PhoneInputCountrySelect { + .PhoneInputCountryIcon--border { border: none; box-shadow: none; } } &.PhoneInput--readOnly { .PhoneInputCountrySelect { pointer-events: none; } } } .PhoneInputCountryIcon { width: auto; height: auto; box-shadow: none; background-color: transparent; .PhoneInputCountryIconImg { width: 24px; height: 24px; } } `,FlagComponent=e=>{var t;let n="+("+(0,eo.getCountryCallingCode)(e.country)+")",i=null===(t=e.flagUrl)||void 0===t?void 0:t.replace("{XX}",e.country);return _().createElement(tg,null,_().createElement("img",{className:"PhoneInputCountryIconImg",alt:e.countryName,src:i,loading:"lazy"}),_().createElement("div",null,n))},PhoneInputWithCode=e=>_().createElement(tb,Object.assign({},e,{flagComponent:FlagComponent})),DOB=({action:e,trigger:t,control:n,locale:i,labelTuples:l,isSubmitting:o})=>{let{id:a,key:r,label:s,validated_message:d,validated_conditions:c}=null!=e?e:{},u=i||(null===k.G||void 0===k.G?void 0:k.G.locale),{formatMessage:m}=(0,h.useContext)(k.T);return _().createElement("div",{className:"input-row",key:a},_().createElement("label",{htmlFor:r},s),_().createElement(el.xI,{name:e.key,control:n,rules:{required:{value:!0,message:m({id:"validation.error.requiredField",defaultMessage:"This field is required"})},validate:{ageRange:e=>validateDateField(e,o,m,e=>validateAge(e,d||m({id:"validation.error.requiredAgeGroup",defaultMessage:"Sorry, your child is not in the required Age Group."}),(()=>{try{return JSON.parse(c)}catch(e){return[]}})()))}},render:({field:e,fieldState:n})=>{let{value:i,name:o,onChange:a}=e,r=(0,x.a)(e,["value","name","onChange"]),{error:s}=n,d=!!s;return _().createElement("div",null,_().createElement(tu,null,_().createElement(ec.I,Object.assign({},r,{defaultValue:i,onChange:e=>{a(e),t(o)},labelTuples:l,locale:u,error:d,className:"subot_input subot_input_date"}))),d&&_().createElement("p",{className:"error-message"},null==s?void 0:s.message))}}))},UserInfoForm=({className:e,style:t,actions:n,countryCode:i,callBack:l,formSubmitMeta:o,isFormRevamp:a,botId:r,nodeId:s,trackingSubmitBtn:d})=>{let c=(0,h.useRef)(),u=null===k.G||void 0===k.G?void 0:k.G.userInfo,m=null===k.G||void 0===k.G?void 0:k.G.locale,p=useCurrentUrl(),{formatMessage:v,action:{pushNotifications:g}}=(0,h.useContext)(k.T),b=useAddressMultipleLevelData(i),f=(0,h.useMemo)(()=>b.level1.map(e=>({label:e,value:e})),[b.level1]),w=(0,h.useMemo)(()=>b.level2.map(e=>({label:e,value:e})),[b.level2]),I=(0,h.useMemo)(()=>b.level3.map(e=>({label:e,value:e})),[b.level3]),[S,C]=(0,h.useState)(!1),[O,N]=(0,h.useState)(!1),[T,A]=(0,h.useState)(!1),[P,B]=(0,h.useState)(!1),[L,R]=(0,h.useState)(!1),U=getActionConfirm(n),D=getActionEmail(n),F=getActionName(n),G=getActionPhone(n),z=getActionOtpWhatsApp(n),V=getActionOtp(n)||z,q=!!U,W=!!(V||z),Y=(0,h.useMemo)(()=>{let e={},t=(0,M.e)();return(null==D?void 0:D.key)&&t.email&&!(0,M.k)(t.email)&&(e[D.key]=t.email),(null==F?void 0:F.key)&&(null==u?void 0:u.name)&&(e[F.key]=u.name),(null==G?void 0:G.key)&&(null==u?void 0:u.phone)&&(null==u?void 0:u.area_code)&&(e[G.key]=(null==u?void 0:u.area_code)+u.phone),(null==V?void 0:V.key)&&(null==u?void 0:u.phone)&&(e[V.key]=u.area_code+u.phone,e.otpPhoneNumber=u.area_code+u.phone),null==o||o.forEach(t=>{if(W&&isControlOtp(t.control)){e.otpPhoneNumber=t.value;return}e[t.key]=t.value,[E.E[E.f.USER_SUBMIT_DATE],E.E[E.f.USER_SUBMIT_DOB]].includes(t.control)&&(e[t.key]=$()(t.value,y.A).toDate())}),e.otpPhoneNumber&&R(!0),e},[]),X=(0,h.useMemo)(()=>r&&s?{"data-event-category":"Service Connection","data-event-action":"Risk Screening Send OTP","data-event-label":p,"data-bot-id":r,"data-question-id":s}:{},[r,s]),K=(0,h.useMemo)(()=>r&&s?{"data-event-category":"Service Connection","data-event-action":"Risk Screening Verify OTP","data-event-label":p,"data-bot-id":r,"data-question-id":s}:{},[r,s]),J=(0,h.useMemo)(()=>d||(r&&s?{"data-event-category":"Service Connection","data-event-action":"Risk Screening User Info Submit","data-event-label":p,"data-bot-id":r,"data-question-id":s}:{}),[r,s,JSON.stringify(d)]),Z=(0,h.useMemo)(()=>n.findIndex(e=>E.F.includes(e.type)),[n]),Q=(0,h.useMemo)(()=>n.find(e=>E.f.USER_SUBMIT_ADDRESS===e.type),[n]),ee=(0,h.useMemo)(()=>n.find(e=>E.f.USER_SUBMIT_ADDRESS_PROVINCE===e.type),[n]),en=(0,h.useMemo)(()=>n.find(e=>E.f.USER_SUBMIT_ADDRESS_DISTRICT===e.type),[n]),ea=(0,h.useMemo)(()=>n.find(e=>E.f.USER_SUBMIT_ADDRESS_COMMUNE===e.type),[n]),{labelInputDate:er}=(0,h.useMemo)(()=>{let{dateFormat:e}=(null===y.I||void 0===y.I?void 0:y.I[m])||y.I["vi-VN"];return{dateFormat:e,labelInputDate:e.split("/").map(e=>v(null===E.C||void 0===E.C?void 0:E.C[e]))}},[m,v]),es=E.E,{register:ep,handleSubmit:ev,watch:eg,formState:{errors:eb,isSubmitting:ef},control:eh,setValue:e_,setError:eE,clearErrors:ey,getValues:ew,trigger:eI}=(0,el.mN)({defaultValues:Y}),setSubmitData=e=>{let t=[];for(let i of n)if(i.key&&i.type!==E.f.USER_SUBMIT_CONFIRM&&i.type!==E.f.USER_SUBMIT_TERMS){if(i.type===E.f.USER_SUBMIT_GOOGLE_API_ADDRESS){let n=e[i.key];td.forEach(e=>{n[e]&&t.push({key:i.key,control:e,value:n[e]})})}else if(i.type===E.f.USER_SUBMIT_ADDRESS_PROVINCE||i.type===E.f.USER_SUBMIT_ADDRESS_DISTRICT||i.type===E.f.USER_SUBMIT_ADDRESS_COMMUNE)t.push({key:i.key,control:es[i.type]||"",value:e[i.key].label||""});else if(i.type===E.f.USER_SUBMIT_DOB||i.type===E.f.USER_SUBMIT_DATE){let n=e[i.key]||"",l=$()(n);l.isValid()&&t.push({key:i.key,control:es[i.type]||"",value:l.format(y.A)})}else isActionTypeOtp(i.type)?t.push({key:i.key,control:E.E[E.f.USER_SUBMIT_OTP],value:e.otpPhoneNumber}):i.type&&"bmi"===es[i.type]?t.push({key:i.key,control:"bmi-weight",value:e[`${i.key}-weight`]||""},{key:i.key,control:"bmi-height",value:e[`${i.key}-height`]||""}):t.push({key:i.key,control:es[i.type]||"",value:e[i.key]||""})}let i=n.filter(e=>e.type===E.f.USER_SUBMIT_SEND),o={action_id:i[0].id,action_value:i[0].key,form_submit_meta:t.filter(({control:e})=>{switch(e){case"confirm":case"submit":case"terms":case"":return!1;default:return!0}})};l(o)},eS=eg("confirm",!0),eC=eg("otpPhoneNumber",""),handleSelectedProvince=e=>(0,x._)(void 0,void 0,void 0,function*(){e&&e.value&&""!==e.value&&(b.setSelectedLevel1(e.value),e_("district",""),e_("commune",""))}),handleSelectedDistrict=e=>(0,x._)(void 0,void 0,void 0,function*(){e&&e.value&&""!==e.value&&(b.setSelectedLevel2(e.value),e_("commune",""))}),handleSendOTP=e=>(0,x._)(void 0,void 0,void 0,function*(){var t,i;e.preventDefault();let l=ew(),o=(0,eo.parsePhoneNumber)(l.otpPhoneNumber);if((null==o?void 0:o.nationalNumber)&&(null==o?void 0:o.countryCallingCode)){C(!0);try{let e=yield(0,k.c)(getSubotApiPath(z?ex.POST_SEND_OTP_WHATSAPP:ex.POST_SEND_OTP),"POST",{data:z?{phone_number:`+${o.countryCallingCode}${o.nationalNumber}`}:{phone_number:o.nationalNumber,area_code:`+${o.countryCallingCode}`}});C(!1);let{_status:l,_errorCode:a}=e;if(1===l){P&&(A(!1),c.current.reset()),B(!0),setTimeout(()=>{let e=document.querySelector(".input-otp-code");e&&(e.focus(),e.scrollIntoView({block:"center"}))},100);return}if(0===l){let e=getTranslateVerifiedOtpMessages();g({title:"",message:v(null==tv?void 0:tv[a])||e.get(m)||e.get(ed.L.PhilippinesEnglish),type:"success"}),ey((null===(t=getActionOtp(n))||void 0===t?void 0:t.key)||(null===(i=getActionOtpWhatsApp(n))||void 0===i?void 0:i.key)),ey("otpPhoneNumber"),R(!0);return}if((null==e?void 0:e._status)===-1){let{_messages:t}=e;c.current&&c.current.cancel(),g({title:"",message:t[0],type:"warning"});return}if(!e||(null==e?void 0:e._status)===0){c.current&&c.current.cancel(),showMessageSomethingWrong();return}}catch(e){C(!1),c.current&&c.current.cancel(),showMessageSomethingWrong()}}}),handleVerifyOTP=(e,t)=>(0,x._)(void 0,void 0,void 0,function*(){e.preventDefault(),N(!0);let n=ew(),i=(0,eo.parsePhoneNumber)(n.otpPhoneNumber);if(t.key&&i){try{let e=yield(0,k.c)(getSubotApiPath(z?ex.POST_VERIFY_OTP_WHATSAPP:ex.POST_VERIFY_OTP),"POST",{data:z?{code:n.otpCode,phone_number:`+${i.countryCallingCode}${i.nationalNumber}`}:{code:n.otpCode,phone_number:i.nationalNumber,area_code:`+${i.countryCallingCode}`}}),{_status:t,_messages:l}=e;if(1===t){g({title:"",message:l[0],type:"success"}),ey("otpCode"),R(!0),N(!1);return}throw Error(JSON.stringify(e))}catch(i){let e=JSON.parse(i.message),{_errorCode:t}=e||{},n=v(null==tv?void 0:tv[t])||v({id:"validation.error.validOTP"});g({title:"",message:n,type:"danger"}),eE("otpCode",{type:"custom",message:n})}N(!1)}}),showMessageSomethingWrong=()=>{g({title:"",message:v({id:"notification.comment.somethingWrong"}),type:"danger"})},renderFullAddressInput=()=>_().createElement(tp,null,Q&&_().createElement("div",{className:"input-row",key:Q.id},_().createElement("label",{htmlFor:Q.key},Q.label),_().createElement("input",Object.assign({id:Q.id,placeholder:Q.label},ep((null==Q?void 0:Q.key)||"",{required:!0}))),eb[(null==Q?void 0:Q.key)||""]&&_().createElement("p",{className:"error-message"},v({id:"validation.error.requiredField",defaultMessage:"This field is required"}))),_().createElement("div",{className:"wrapper-address-lever"},ee&&_().createElement("div",{className:"input-row",key:ee.id},_().createElement("label",{htmlFor:ee.key,className:Q?"hide-label":""},ee.label),_().createElement("div",{style:{background:"#fff"},className:"address-input"},_().createElement(el.xI,{name:ee.key||"",control:eh,rules:{required:!0},render:e=>{var t;return _().createElement(em.D,{id:ee.id,options:f,onChange:t=>{e.field.onChange(t),handleSelectedProvince(t)},value:e.field.value,placeholder:(null==ee?void 0:ee.label)||"",className:`address-dropdown ${(null===(t=e.field.value)||void 0===t?void 0:t.value)?"":"show-placeholder"}`})}})),eb[ee.key||""]&&_().createElement("p",{className:"error-message"},v({id:"validation.error.requiredField",defaultMessage:"This field is required"}))),en&&_().createElement("div",{className:"input-row",key:en.id},_().createElement("label",{htmlFor:en.key,className:Q?"hide-label":""},en.label),_().createElement("div",{style:{background:"#fff"},className:"address-input"},_().createElement(el.xI,{name:en.key||"",control:eh,rules:{required:!0},render:e=>{var t;return _().createElement(em.D,{id:en.id,options:w,onChange:t=>{e.field.onChange(t),handleSelectedDistrict(t)},value:e.field.value,placeholder:(null==en?void 0:en.label)||"",className:`address-dropdown ${(null===(t=e.field.value)||void 0===t?void 0:t.value)?"":"show-placeholder"}`})}})),eb[(null==en?void 0:en.key)||""]&&_().createElement("p",{className:"error-message"},v({id:"validation.error.requiredField",defaultMessage:"This field is required"}))),ea&&_().createElement("div",{className:"input-row",key:ea.id},_().createElement("label",{htmlFor:ea.key,className:Q?"hide-label":""},ea.label),_().createElement("div",{style:{background:"#fff"},className:"address-input"},_().createElement(el.xI,{name:ea.key||"",control:eh,rules:{required:!0},render:e=>{var t;return _().createElement(em.D,{id:ea.id,options:I,onChange:t=>{e.field.onChange(t)},value:e.field.value,placeholder:(null==ea?void 0:ea.label)||"",className:`address-dropdown ${(null===(t=e.field.value)||void 0===t?void 0:t.value)?"":"show-placeholder"}`})}})),eb[ea.key||""]&&_().createElement("p",{className:"error-message"},v({id:"validation.error.requiredField",defaultMessage:"This field is required"}))))),renderFormInput=(e,t)=>{var n;if(!e.key)return null;if(Z===t)return renderFullAddressInput();switch(e.type){case E.f.USER_SUBMIT_DROPDOWN:let l=e.url?e.url.split("\n"):[];return _().createElement("div",{className:"input-row",key:e.id},_().createElement("label",{htmlFor:e.key},e.label),_().createElement(el.xI,{key:e.key,control:eh,name:e.key,rules:{required:!0},render:({field:t})=>_().createElement(et.S,Object.assign({searchable:!0,data:l,placeholder:e.label},t,{withinPortal:!0,zIndex:1e3}))}),eb[e.key]&&_().createElement("p",{className:"error-message"},v({id:"validation.error.requiredField",defaultMessage:"This field is required"})));case E.f.USER_SUBMIT_EMAIL:return _().createElement("div",{className:"input-row",key:e.id},_().createElement("label",{htmlFor:e.key},e.label),_().createElement("input",Object.assign({id:e.id,placeholder:e.label},ep(e.key,{required:!0,pattern:/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/}))),eb[e.key]&&_().createElement("p",{className:"error-message"},v((null===(n=eb[e.key])||void 0===n?void 0:n.type)!=="pattern"?{id:"validation.error.requiredField",defaultMessage:"This field is required"}:{id:"validation.error.validEmail",defaultMessage:"Please enter a valid email address."})));case E.f.USER_SUBMIT_NAME:return _().createElement("div",{className:"input-row",key:e.id},_().createElement("label",{htmlFor:e.key},e.label),_().createElement("input",Object.assign({id:e.id,placeholder:e.label},ep(e.key,{required:!0}))),eb[e.key]&&_().createElement("p",{className:"error-message"},v({id:"validation.error.requiredField",defaultMessage:"This field is required"})));case E.f.USER_SUBMIT_PHONE:return _().createElement("div",{className:"input-row",key:e.id},_().createElement("label",{htmlFor:e.key},e.label),_().createElement(el.xI,{name:e.key,control:eh,rules:{required:!0,validate:e=>(0,eo.isPossiblePhoneNumber)(e)},render:({field:{onChange:t,value:n}})=>_().createElement(eo.default,{value:n,onChange:t,defaultCountry:i,id:e.id})}),eb[e.key]&&_().createElement("p",{className:"error-message"},v({id:"validation.error.validNumber",defaultMessage:"Please enter a valid number."})));case E.f.USER_SUBMIT_NUMBER:return _().createElement("div",{className:"input-row",key:e.id},_().createElement("label",{htmlFor:e.key},e.label),_().createElement("input",Object.assign({type:"number",id:e.id},ep(e.key,{required:!0}))),eb[e.key]&&_().createElement("p",{className:"error-message"},v({id:"validation.error.requiredField",defaultMessage:"This field is required"})));case E.f.USER_SUBMIT_DATE:return _().createElement("div",{className:"input-row",key:e.id},_().createElement("label",{htmlFor:e.key},e.label),_().createElement(el.xI,{name:e.key,control:eh,rules:{required:{value:!0,message:v({id:"validation.error.requiredField",defaultMessage:"This field is required"})},validate:{ageRange:e=>validateDateField(e,ef,v)}},render:({field:e,fieldState:t})=>{let{value:n,name:i,onChange:l}=e,o=(0,x.a)(e,["value","name","onChange"]),{error:a}=t,r=!!a;return _().createElement("div",null,_().createElement(tu,null,_().createElement(ec.I,Object.assign({},o,{defaultValue:n,onChange:e=>{l(e),eI(i)},labelTuples:er,locale:m,error:r,className:"subot_input subot_input_date"}))),r&&_().createElement("p",{className:"error-message"},null==a?void 0:a.message))}}));case E.f.USER_SUBMIT_BMI:return _().createElement("div",{key:e.id},_().createElement("div",{className:"input-row",key:`${e.id}-height`},_().createElement("label",{htmlFor:`${e.key}-height`},v({id:"home.bmi.input.height",defaultMessage:"Height"})),_().createElement("input",Object.assign({type:"number",id:`${e.id}-height`},ep(`${e.key}-height`,{required:!0}))),eb[`${e.key}-height`]&&_().createElement("p",{className:"error-message"},v({id:"validation.error.requiredField",defaultMessage:"This field is required"}))),_().createElement("div",{className:"input-row",key:`${e.id}-weight`},_().createElement("label",{htmlFor:`${e.key}-weight`},v({id:"home.bmi.input.weight",defaultMessage:"Weight"})),_().createElement("input",Object.assign({type:"number",id:`${e.id}-weight`},ep(`${e.key}-weight`,{required:!0}))),eb[`${e.key}-weight`]&&_().createElement("p",{className:"error-message"},v({id:"validation.error.requiredField",defaultMessage:"This field is required"}))));case E.f.USER_SUBMIT_GENDER:return _().createElement("div",{className:"input-row",key:e.id},_().createElement("label",null,e.label),_().createElement("div",{className:"radio-group"},_().createElement("label",{className:"radio-label"},_().createElement("input",Object.assign({},ep(e.key,{required:!0}),{value:"female",id:`${e.id}-female`,type:"radio"})),_().createElement("span",null,v({id:"gender.female",defaultMessage:"Female"}))),_().createElement("label",{className:"radio-label"},_().createElement("input",Object.assign({},ep(e.key,{required:!0}),{value:"male",id:`${e.id}-male`,type:"radio"})),_().createElement("span",null,v({id:"gender.male",defaultMessage:"Male"})))),eb[e.key]&&_().createElement("p",{className:"error-message"},v({id:"validation.error.requiredField",defaultMessage:"This field is required"})));case E.f.USER_SUBMIT_TEXT:return _().createElement("div",{className:"input-row",key:e.id},_().createElement("label",{htmlFor:e.key},e.label),_().createElement("input",Object.assign({id:e.id,placeholder:e.label},ep(e.key,{required:!0}))),eb[e.key]&&_().createElement("p",{className:"error-message"},v({id:"validation.error.requiredField",defaultMessage:"This field is required"})));case E.f.USER_SUBMIT_OTP:case E.f.USER_SUBMIT_WHATSAPP:return _().createElement("div",null,_().createElement("div",{className:"input-row input-row--otp"},_().createElement("label",{htmlFor:"otpPhoneNumber"},e.label),_().createElement(el.xI,{name:"otpPhoneNumber",control:eh,rules:{required:!0,validate:{valid:e=>(0,eo.isPossiblePhoneNumber)(e),notClickSentOTP:e=>(0,eo.isPossiblePhoneNumber)(e)&&L}},render:({field:{onChange:t,value:n}})=>{let l=!T&&P||S||L;return _().createElement(tl,null,_().createElement(PhoneInputWithCode,{value:n,onChange:t,defaultCountry:i,className:`input-row ${e.id}`,name:"otpPhoneNumber",disabled:l,placeholder:e.label,flagComponent:FlagComponent}),l&&_().createElement(IconEdit,{viewBox:"0 0 24 24",className:"icon-edit-phone",onClick:()=>{var e;e_("otpPhoneNumber",""),e_("otpCode",""),B(!1),R(!1),null===(e=c.current)||void 0===e||e.cancel()}}))}}),eb.otpPhoneNumber&&("notClickSentOTP"===eb.otpPhoneNumber.type?_().createElement("p",{className:"error-message"},getTransPleaseVerifiedOtp().get(m)):_().createElement("p",{className:"error-message"},v({id:"validation.error.validNumber",defaultMessage:"Please enter a valid number."}))),L?"":_().createElement(H.B,Object.assign({size:"sm",loading:S,disabled:!T&&P||S||!(0,eo.isPossiblePhoneNumber)(eC||""),onClick:handleSendOTP,variant:"ghost",className:"btn-send-otp"},X),P?_().createElement(tn,{ref:c,isFinished:T,onFinish:A}):_().createElement("span",null,v({id:"subot.sendOTP.button",defaultMessage:"Send OTP"})))),P&&_().createElement("div",{className:j()("input-row input-row--verify",{"verified-otp":L,"error-verify-otp":eb.otpCode})},_().createElement("label",{htmlFor:"otpCode"},"M\xe3 OTP"),_().createElement(el.xI,{name:"otpCode",control:eh,rules:{required:!0,pattern:/^[0-9]{0,6}$/},render:({field:{onChange:e,value:t}})=>_().createElement("input",{onChange:e,value:t,type:"tel",disabled:L,className:"input-otp-code"})}),(null==eb?void 0:eb.otpCode)&&_().createElement("p",{className:"error-message"},_().createElement(InfoError,null),eb.otpCode.message),L?_().createElement("div",{className:"verify-success"},_().createElement(CheckCircleGreen,null),_().createElement("span",{className:"verify-success-label"},v({id:"subot.verifyOTP.success.message",defaultMessage:"Verified successful"}))):_().createElement(eu.B,Object.assign({className:"submit-btn",size:a?"md":"lg",isLoading:O,isDisabled:!P,onClick:t=>handleVerifyOTP(t,e)},K),v({id:"subot.verifyOTP.button",defaultMessage:"Verify OTP"}))));case E.f.USER_SUBMIT_GOOGLE_API_ADDRESS:return _().createElement(tc,{action:e,control:eh,formError:eb[e.key],key:e.id,initValue:null==Y?void 0:Y[e.key],onChange:e_});case E.f.USER_SUBMIT_DOB:return _().createElement(DOB,{key:e.key,action:e,trigger:eI,control:eh,locale:m,labelTuples:er,isSubmitting:ef});default:return""}},renderFormSubmitAndTerms=e=>{switch(e.type){case E.f.USER_SUBMIT_CONFIRM:return _().createElement("div",{className:"submit-btn-row",key:e.id},_().createElement("label",{className:"subot-checkbox"},_().createElement("input",Object.assign({},ep("confirm"),{type:"checkbox",defaultChecked:!0,className:"subot-checkbox__input"})),_().createElement("span",{className:"subot-checkbox__label"},_().createElement(Markdown,null,e.label))));case E.f.USER_SUBMIT_SEND:return _().createElement("div",{className:"submit-btn-row",key:e.id},_().createElement("button",Object.assign({id:e.id,className:"submit-btn",type:"submit",disabled:!!q&&!eS},J,{"data-response-id":e.id}),e.label));case E.f.USER_SUBMIT_TERMS:return _().createElement("div",{className:"form-terms",key:e.id},_().createElement(Markdown,null,e.label));default:return""}};return _().createElement(tm,{className:e,style:t},_().createElement("form",{onSubmit:ev(e=>{(!W||L)&&(null==e||delete e.confirm,ei()(eb)&&setSubmitData(e))}),onFocus:e=>{let t=e.target;t&&t.scrollIntoView({block:"center",inline:"nearest",behavior:"auto"})},className:"user-info-form"},n.map((e,t)=>renderFormInput(e,t)),n.map(e=>renderFormSubmitAndTerms(e))))},tf=F.A.div` display: flex; flex-direction: column; gap: 24px; `,Container$d=({node:e,indexNumber:t})=>{var n;let i=null===k.G||void 0===k.G?void 0:k.G.locale,{params:l,listNodes:o,activeId:a,onSubmit:r,setIsShowFooter:s}=(0,h.useContext)(eT);return((0,h.useMemo)(()=>{s(!0)},[]),e)?_().createElement(tf,{id:"si-node-form"},_().createElement(Container$h,{intents:e.intents||[],indexNumber:t}),_().createElement(UserInfoForm,{isFormRevamp:!0,className:"si-form-revamp",actions:(null==e?void 0:e.actions)||[],formSubmitMeta:(null===(n=null==e?void 0:e._message)||void 0===n?void 0:n.form_submit_meta)||null,callBack:t=>(0,x._)(void 0,void 0,void 0,function*(){checkSyncDataOnFrisoCampaign(o[0],t.form_submit_meta);let n=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},l),e._message),t),getCurrentTotalDynamicScore(o,a,t.action_id,t.form_submit_meta)),{node_id:e.id}),i=yield subotInlineMessage$1(n);if((null==i?void 0:i._status)===1){let e=null==i?void 0:i._data,{node:l}=e,o=(0,x.a)(e,["node"]),a=Object.assign(Object.assign({},l),{_message:Object.assign(Object.assign({},o),{node_id:l.id})});r&&r(a,Object.assign(Object.assign({},n),t))}}),countryCode:(null==i?void 0:i.split("-")[1])||"PH",botId:l.bot_id,nodeId:null==e?void 0:e.id})):null};Container$d.displayName="subotInlineNodeForm";let th=F.A.div``,t_=F.A.div` display: flex; gap: 12px; flex-direction: column; &.si-two-columns { flex-wrap: wrap; gap: 16px; flex-direction: row; justify-content: center; margin-top: 24px; .si-action-img-choice { width: calc(50% - 8px); } ${G.M.mbUp} { gap: 32px; padding: 0 16px; .si-action-img-choice { width: calc(50% - 16px); } } } `,Checkbox=e=>_().createElement("svg",Object.assign({width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),_().createElement("path",{d:"M11 21c5.523 0 10-4.477 10-10S16.523 1 11 1 1 5.477 1 11s4.477 10 10 10Z",fill:"#2D87F3",stroke:"#2D87F3"}),_().createElement("path",{d:"M15.571 8 9.68 14 7 11.273",stroke:"#fff"})),tE=(0,es.s)(F.A.div` position: relative; z-index: 1; display: flex; width: 20px; height: 20px; align-items: center; justify-content: center; padding: 1px; transition: 0.2s linear all; .icon-checkbox { width: 20px; height: 20px; opacity: 0; ${({active:e})=>e&&"opacity: 1"}; transition: 0.25s all linear; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); } &:before { position: absolute; top: 50%; left: 50%; width: 20px; height: 20px; border: 2px solid ${({active:e})=>{var t;return e?"var(--subot-inline-primary-color)":`var(--subot-inline-text-color, ${(null===(t=null===Q.w||void 0===Q.w?void 0:Q.w.colors)||void 0===t?void 0:t.gray600)||"#8C8C8C"})`}}; border-radius: 50%; content: ''; transform: translate(-50%, -50%); transition: 0.25s all linear; } &:after { position: absolute; z-index: -1; top: 50%; left: 50%; width: 10px; height: 10px; background-color: var(--subot-inline-primary-color); border-radius: 50%; content: ''; opacity: 0; ${({active:e})=>e&&"opacity: 1"}; transform: translate(-50%, -50%); transition: 0.25s all linear; } `,"hhgcomp-subot-radioIcon"),tx=F.A.div` text-align: center; padding: 12px; border-radius: 8px; border: 1px solid #e4e8ec; position: relative; transition: all 0.3s ease; cursor: pointer; background-color: #fff; ${({active:e})=>e?"border-bottom: 3px solid var(--subot-inline-primary-color);":""}; &:hover { border-color: var(--subot-inline-primary-color); } ${tE.classSelector} { position: absolute; top: 16px; right: 16px; } .si-action-image-wrap { position: relative; width: 100%; padding-top: 67%; img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 8px; } &::before { content: ''; position: absolute; width: 28px; height: 28px; background-color: #fff; top: 0; right: 0; pointer-events: none; z-index: 1; border-bottom-left-radius: 8px; } } .si-label { padding-top: 12px; position: relative; } `,Container$c=({action:e,active:t,onChange:n,htmlType:i})=>{let l=useCurrentUrl(),{params:o}=(0,h.useContext)(eT);return _().createElement(tx,{className:"si-action-img-choice",onClick:()=>n&&n(e),active:!!t,"data-event-category":"Service Connection","data-event-action":"Risk Screening Answer Click","data-event-label":l,"data-bot-id":o.bot_id},_().createElement("div",{className:"si-action-image-wrap"},_().createElement("img",{loading:"lazy",src:null==e?void 0:e.url,alt:null==e?void 0:e.label})),(null==e?void 0:e.label)&&_().createElement("div",{className:"si-label"},_().createElement(Markdown,null,null==e?void 0:e.label)),_().createElement(tE,{active:!!t},"checkbox"===i&&_().createElement(Checkbox,{className:"icon-checkbox",viewBox:"0 0 22 22"})))};Container$c.displayName="SubotInlineActionImageChoice";let ty=F.A.div` text-align: center; margin-top: 24px; `,Container$b=({action:e,onChange:t})=>{let n=useCurrentUrl(),{params:i,activeId:l}=(0,h.useContext)(eT);return _().createElement(ty,null,_().createElement(H.B,{onClick:()=>t&&t(e),size:"lg","data-event-category":"Service Connection","data-event-action":"Risk Screening Sign Up for Result","data-event-label":n,"data-bot-id":i.bot_id,"data-event-question-id":l,styles:{root:{backgroundColor:"var(--subot-inline-primary-color) !important","&:hover":{backgroundColor:"var(--subot-inline-primary-color-hover) !important"},color:"var(--subot-inline-text-button-color, #fff) !important"}}},_().createElement(Markdown,null,null==e?void 0:e.label)))};Container$b.displayName="SubotInlineActionSSO";let tw=F.A.div` width: 100%; padding: 12px 16px; border-radius: 8px; /* border: 1px solid #e4e8ec; */ border: 1px solid var(--subot-inline-text-color, #e4e8ec); display: flex; align-items: center; cursor: pointer; gap: 12px; transition: all 0.3s ease; ${({active:e})=>e?` border-bottom: 3px solid var(--subot-inline-primary-color); background-color: var(--subot-inline-primary-color-100); `:""}; &:hover { background-color: var(--subot-inline-primary-color-100); border-bottom: 3px solid var(--subot-inline-primary-color); } .label { flex: 1; font-size: 16px; font-style: normal; font-weight: 400; line-height: 24px; letter-spacing: -0.16px; color: var(--subot-inline-text-color, #262626); } `,tI={input:{"&:focus":{borderColor:"var(--subot-inline-primary-color) !important",boxShadow:"0px 0px 0px 2px var(--subot-inline-primary-color-300) !important"}}},Container$a=({action:e,onChange:t,active:n,htmlType:i,formSubmitMeta:l})=>{let o=useCurrentUrl(),a=(0,h.useRef)(null),[r,s]=(0,h.useState)(""),{params:d}=(0,h.useContext)(eT),c=(null==e?void 0:e.type)===E.f.POLL_CHOICE_TEXT_BY_INPUT,u=(null==e?void 0:e.type)===E.f.USER_CHOICE_TEXT_BY_INPUT||c;return(0,h.useEffect)(()=>{var e,t;n&&(s((null===(e=null==l?void 0:l.find(e=>e.key===ek))||void 0===e?void 0:e.value)||""),null===(t=a.current)||void 0===t||t.focus())},[n,l]),_().createElement(_().Fragment,null,_().createElement(tw,{id:"si-action-text-choice",active:!!n,onClick:()=>null==t?void 0:t(e),"data-event-category":"Service Connection","data-event-action":"Risk Screening Answer Click","data-event-label":o,"data-bot-id":d.bot_id},_().createElement(tE,{active:!!n},"checkbox"===i&&_().createElement(Checkbox,{className:"icon-checkbox",viewBox:"0 0 22 22"})),_().createElement("div",{className:"label"},null==e?void 0:e.label)),u&&n&&_().createElement(B.Box,{px:"2px",style:{textAlign:"right"}},_().createElement(B.Textarea,{ref:a,placeholder:null==e?void 0:e.label,styles:tI,value:r,onChange:n=>{s(n.target.value),null==t||t(e,[{key:ek,control:"text",value:n.target.value,action_id:null==e?void 0:e.id}])},maxLength:360})))};Container$a.displayName="SubotInlineActionTextChoice";let tS=F.A.div``,Container$9=({action:e,onChange:t,active:n,htmlType:i})=>_().createElement(tS,null,_().createElement(Container$a,{active:!!n,action:e,onChange:e=>{e&&t&&t({key:null==e?void 0:e.key,control:E.E[null==e?void 0:e.type],value:"",action_id:null==e?void 0:e.id})},htmlType:i}));Container$9.displayName="SubotInlinePollChoice";let Container$8=({action:e,onChange:t,active:n,htmlType:i})=>_().createElement(Container$c,{active:!!n,action:e,onChange:e=>{e&&t&&t({key:null==e?void 0:e.key,control:E.E[null==e?void 0:e.type],value:"",action_id:null==e?void 0:e.id})},htmlType:i});Container$8.displayName="SubotInlinePollChoiceImage";let tC={[E.f.USER_CHOICE_TEXT]:Container$a,[E.f.USER_CHOICE_TEXT_BY_INPUT]:Container$a,[E.f.USER_CHOICE_IMAGE]:Container$c,[E.f.ACTION_SSO_REDIRECT]:Container$b,[E.f.POLL_CHOICE]:Container$9,[E.f.POLL_CHOICE_TEXT_BY_INPUT]:Container$a,[E.f.POLL_BUTTON]:()=>null,[E.f.POLL_CHOICE_IMAGE]:Container$8},tO=new Proxy(tC,{get:(e,t)=>tC[t]||(()=>ee.K?null:_().createElement("p",null,"SubotInlineRevampActionBase ",t))}),tk=[E.f.USER_CHOICE_NEXT],Container$7=({actions:e,value:t,onChange:n,htmlType:i,node_type:l,formSubmitMeta:o})=>{let a=(0,h.useMemo)(()=>!!(null==e?void 0:e.find(e=>e.type===E.f.POLL_CHOICE_IMAGE)),[e]),r=(0,h.useMemo)(()=>{switch(l){case E.d.IMAGE:case E.d.REACTION:return"si-two-columns";default:return a?"si-two-columns":""}},[l]);return(null==e?void 0:e.length)?_().createElement(t_,{id:"si-action",className:r},null==e?void 0:e.map(e=>{let l=e.type;if(tk.includes(l))return null;let a=tO[e.type];return a&&_().createElement(a,{key:e.id,action:e,onChange:n,active:null==t?void 0:t.includes(e.id),htmlType:i,formSubmitMeta:o})})):null};Container$7.displayName="SubotInlineAction";let Container$6=({node:e,indexNumber:t})=>{let{params:n,listNodes:i,activeId:l,onSubmit:o,setIsShowFooter:a,setLoading:r}=(0,h.useContext)(eT),{value:s,setValue:d}=(0,h.useContext)(eL);return((0,h.useMemo)(()=>{a(!0)},[]),(0,h.useEffect)(()=>{d((null==e?void 0:e._message)||{})},[]),e)?_().createElement(th,{id:"si-node-final"},_().createElement(Container$h,{intents:e.intents||[],indexNumber:t}),_().createElement(Container$7,{node_type:null==e?void 0:e.type,value:(null==s?void 0:s.action_id)?[null==s?void 0:s.action_id]:[],actions:null==e?void 0:e.actions,onChange:t=>(0,x._)(void 0,void 0,void 0,function*(){if(!t)return;d(Object.assign(Object.assign({},s),{action_id:null==t?void 0:t.id,action_value:null==t?void 0:t.key}));let a=Object.assign(Object.assign(Object.assign(Object.assign({},n),s),{node_id:e.id,action_id:null==t?void 0:t.id,action_value:null==t?void 0:t.key}),getCurrentTotalDynamicScore(i,l,t.id));r(!0);let c=yield subotInlineMessage$1(a);if(r(!1),(null==c?void 0:c._status)===1){let e=null==c?void 0:c._data,{node:t}=e,n=(0,x.a)(e,["node"]),i=Object.assign(Object.assign({},t),{_message:Object.assign(Object.assign({},n),{node_id:t.id})});o(i,a)}})})):null};Container$6.displayName="SubotinlineNodeImage";let tN=F.A.div` display: flex; flex-direction: column; padding-bottom: 16px; gap: 24px; `,Container$5=({node:e,indexNumber:t})=>{var n;let{setIsShowFooter:i,onChange:l}=(0,h.useContext)(eT),{value:o,setValue:a}=(0,h.useContext)(eL);(0,h.useMemo)(()=>{i(!0)},[]),(0,h.useEffect)(()=>{a((null==e?void 0:e._message)||{})},[]),(0,h.useEffect)(()=>()=>{a({})},[]);let r=(0,h.useMemo)(()=>{var t;let n=null===(t=null==e?void 0:e.actions)||void 0===t?void 0:t.find(({type:e})=>e==E.f.ACTION_MULTIPLE_BUTTON);return n||null},[null==e?void 0:e.actions]),s=(0,h.useMemo)(()=>(null==o?void 0:o.selected_actions)?Object.keys(null==o?void 0:o.selected_actions):[],[o,null==o?void 0:o.selected_actions]),d=null===(n=null==e?void 0:e.actions)||void 0===n?void 0:n.filter(e=>e.type!==E.f.ACTION_MULTIPLE_BUTTON);return _().createElement(tN,{id:"si-node-text"},_().createElement(Container$h,{intents:(null==e?void 0:e.intents)||[],indexNumber:t}),_().createElement(Container$7,{value:s,actions:d,onChange:(e,t)=>(0,x._)(void 0,void 0,void 0,function*(){var n,i;if(e){let s=JSON.parse(JSON.stringify(Object.assign(Object.assign({},o),{action_id:null==r?void 0:r.id,action_value:null==r?void 0:r.key,selected_actions:Object.assign({},null==o?void 0:o.selected_actions)})));if((null==e?void 0:e.type)===E.f.POLL_CHOICE_TEXT_BY_INPUT||(null==e?void 0:e.type)===E.f.USER_CHOICE_TEXT_BY_INPUT){let i=(null==s?void 0:s.selected_actions)&&e.id in s.selected_actions;i?t?s.form_submit_meta=t:(delete s.form_submit_meta,null===(n=s.selected_actions)||void 0===n||delete n[e.id]):(null==e?void 0:e.id)&&(s.selected_actions=Object.assign(Object.assign({},s.selected_actions),{[e.id]:e.key||""})),a(s),null==l||l(s);return}if(!(null===(i=s.selected_actions)||void 0===i?void 0:i[e.id])){s.selected_actions=Object.assign(Object.assign({},s.selected_actions),{[e.id]:e.key||""}),l&&l(s),a(s);return}if(s.selected_actions[e.id]){delete s.selected_actions[e.id],l&&l(s),a(s);return}}}),formSubmitMeta:null==o?void 0:o.form_submit_meta}))};Container$5.displayName="SubotInlineNodeMultipleContainer";let useDescriptionPollNode=({node:e})=>{let{formatMessage:t}=(0,h.useContext)(k.T),n=t({id:"multiSelectError.required",defaultMessage:"You must choose one options"});return(null==e?void 0:e.multi_select_option)===E.g.UNLIMITED&&(n=t({id:"multiSelectError.unlimited",defaultMessage:"You must choose at least one options"})),(null==e?void 0:e.multi_select_option)===E.g.RANGE&&(n=t({id:"multiSelectError.range",defaultMessage:"You must choose from {from} to {to} answers (Ex: You must choose from 3 to 5 answers)"},{from:e.from,to:e.to})),(null==e?void 0:e.multi_select_option)===E.g.EXACT_NUMBER&&(n=t({id:"multiSelectError.exactNumber",defaultMessage:"You must choose {from} answers."},{from:e.from})),n},tT=F.A.div` .si-poll-description { font-style: italic; margin-bottom: 16px; } `,Container$4=({node:e,indexNumber:t})=>{let{onChange:n,setIsShowFooter:i}=(0,h.useContext)(eT),{value:l,setValue:o}=(0,h.useContext)(eL),a=useDescriptionPollNode({node:e});(0,h.useMemo)(()=>{i(!0)},[]),(0,h.useEffect)(()=>{o((null==e?void 0:e._message)||{})},[]);let r=(0,h.useMemo)(()=>{var t;let n=null===(t=null==e?void 0:e.actions)||void 0===t?void 0:t.find(({type:e})=>e==E.f.POLL_BUTTON);return n||null},[null==e?void 0:e.actions]),s=(0,h.useMemo)(()=>(null==l?void 0:l.form_submit_meta)?null==l?void 0:l.form_submit_meta.map(({action_id:e})=>e):[],[l,null==l?void 0:l.form_submit_meta]);return(0,h.useEffect)(()=>{console.log("adfsafsdf"),o(null==e?void 0:e._message)},[]),_().createElement(tT,null,_().createElement(Container$h,{intents:e.intents||[],indexNumber:t}),_().createElement("p",{className:"si-poll-description"},a),_().createElement(Container$7,{node_type:null==e?void 0:e.type,value:s,actions:null==e?void 0:e.actions,onChange:(t,i)=>{var a,s,d,c,u,m,p;let v=JSON.parse(JSON.stringify(Object.assign(Object.assign({},l),{node_id:e.id,action_id:null==r?void 0:r.id,action_value:null==r?void 0:r.key,form_submit_meta:[...(null==l?void 0:l.form_submit_meta)||[]]})));if((null==t?void 0:t.type)===E.f.POLL_CHOICE_TEXT_BY_INPUT||(null==t?void 0:t.type)===E.f.USER_CHOICE_TEXT_BY_INPUT){let e=null===(a=v.form_submit_meta)||void 0===a?void 0:a.some(({action_id:e})=>e===t.id);e?v.form_submit_meta=void 0===i?null===(s=v.form_submit_meta)||void 0===s?void 0:s.filter(({action_id:e})=>e!==t.id):null===(d=v.form_submit_meta)||void 0===d?void 0:d.filter(({action_id:e})=>e!==t.id).concat(i):v.form_submit_meta=null===(c=v.form_submit_meta)||void 0===c?void 0:c.concat([{key:null==t?void 0:t.key,control:E.E[null==t?void 0:t.type]||"text",value:"",action_id:null==t?void 0:t.id}]),o(v),null==n||n(v);return}let g=null===(u=v.form_submit_meta)||void 0===u?void 0:u.some(({action_id:e})=>e===(null==t?void 0:t.action_id));g?v.form_submit_meta=null===(m=v.form_submit_meta)||void 0===m?void 0:m.filter(({action_id:e})=>e!==(null==t?void 0:t.action_id)):v.form_submit_meta=null===(p=v.form_submit_meta)||void 0===p?void 0:p.concat([t]),o(v),null==n||n(v)},formSubmitMeta:null==l?void 0:l.form_submit_meta}))};Container$4.displayName="SubotinlineNodePoll";let tM=F.A.div``,Container$3=({node:e})=>{let t=(0,h.useRef)(!1),{formatMessage:n,data:{userInfo:i}}=(0,h.useContext)(k.T),{params:l,setIsShowFooter:o,listNodes:a,activeId:r}=(0,h.useContext)(eT);(0,h.useMemo)(()=>{o(!0)},[]),(0,h.useEffect)(()=>{var n;let l=null===(n=null==e?void 0:e.actions)||void 0===n?void 0:n.find(e=>e.type===E.f.ACTION_SSO_REDIRECT);(null==i?void 0:i.id)&&l&&!t.current&&(t.current=!0,handleOnChange(l))},[null==i?void 0:i.id]);let{triggerLogin:s}=(0,ep.u)(),handleOnChange=t=>{if(l.bot_id&&t&&t.type===E.f.ACTION_SSO_REDIRECT){let n={params:Object.assign(Object.assign(Object.assign({},l),null==e?void 0:e._message),{action_id:null==t?void 0:t.id,action_value:null==t?void 0:t.key,mode:"inline"}),listNodes:a,activeId:r,createdAt:new Date().getTime(),botId:l.bot_id};localStorage.setItem(eN,JSON.stringify(n));let i=(0,ev.g)(window.location.href,{botItem:a[0]});i.searchParams.set("bot_id",String(l.bot_id)),i.searchParams.set("mode","inline"),i.searchParams.set("source","subot-inline");let o=i.href;(0,ep.I)()?s({returnUrl:o,source:"subot-inline"}):window.location.href=`${y.l}?returnUrl=${encodeURIComponent(o)}`}};return e?_().createElement(tM,{id:"si-node-final"},_().createElement(Container$h,{intents:[...(null==e?void 0:e.intents)||[],...(0,M.s)(n)]}),_().createElement(Container$7,{actions:null==e?void 0:e.actions,onChange:handleOnChange})):null};Container$3.displayName="SubotinlineNodeSSO";let tA=F.A.div` display: flex; flex-direction: column; padding-bottom: 16px; gap: 24px; `,Container$2=({node:e,indexNumber:t})=>{let{params:n,onSubmit:i,setIsShowFooter:l,listNodes:o,activeId:a,setLoading:r,onChange:s}=(0,h.useContext)(eT),{value:d,setValue:c}=(0,h.useContext)(eL);(0,h.useMemo)(()=>{l(!0)},[]),(0,h.useEffect)(()=>{c((null==e?void 0:e._message)||{})},[]),(0,h.useEffect)(()=>()=>{c({})},[]);let handleOnChangeNormal=t=>(0,x._)(void 0,void 0,void 0,function*(){let l=Object.assign(Object.assign(Object.assign(Object.assign({},n),d),{node_id:e.id,action_id:null==t?void 0:t.id,action_value:null==t?void 0:t.key,form_submit_meta:void 0}),getCurrentTotalDynamicScore(o,a,t.id));r(!0);let s=yield subotInlineMessage$1(l);if(r(!1),(null==s?void 0:s._status)===1){let e=null==s?void 0:s._data,{node:t}=e,n=(0,x.a)(e,["node"]),o=Object.assign(Object.assign({},t),{_message:Object.assign(Object.assign({},n),{node_id:t.id})});i(o,l)}});return _().createElement(tA,{id:"si-node-text"},_().createElement(Container$h,{intents:(null==e?void 0:e.intents)||[],indexNumber:t}),_().createElement(Container$7,{value:(null==d?void 0:d.action_id)?[null==d?void 0:d.action_id]:[],actions:null==e?void 0:e.actions,onChange:(e,t)=>(0,x._)(void 0,void 0,void 0,function*(){if(!e)return;let n=(null==e?void 0:e.type)===E.f.USER_CHOICE_TEXT_BY_INPUT||(null==e?void 0:e.type)===E.f.POLL_CHOICE_TEXT_BY_INPUT,i=Object.assign(Object.assign({},d),{action_id:null==e?void 0:e.id,action_value:null==e?void 0:e.key,form_submit_meta:t});if(n){c(i),null==s||s(i);return}delete i.form_submit_meta,c(i),handleOnChangeNormal(e)}),formSubmitMeta:null==d?void 0:d.form_submit_meta}))};Container$2.displayName="SubotInlineNodeTextContainer";let t$={TEXT:Container$2,IMAGE:Container$6,FORM:Container$d,FINAL_STANDARD:Container$f,FINAL:Container$g,FINAL_THANK_YOU:Container$e,SSO:Container$3,MULTIPLE:Container$5,POLL:Container$4},tP=new Proxy(t$,{get:(e,t)=>t$[t]||(()=>ee.K?null:_().createElement(_().Fragment,null,"SubotInlineNodeBase ",t))}),Container$1=({onClickStart:e})=>{var t;let{listNodes:n,activeId:i,isDisabledAnimationOnMobile:l}=(0,h.useContext)(eT),o=(0,h.useMemo)(()=>n.findIndex(e=>e.id==i),[n,i]),a=n[o];if(!a)return null;if(a.hasOwnProperty("first_node"))return l?_().createElement(Container$s,{node:a,onClickStart:e}):_().createElement(D.P.div,{key:a.id,initial:{opacity:0},animate:{opacity:1},transition:{y:{type:"spring",stiffness:300,damping:30},opacity:{duration:.2}}},_().createElement(Container$s,{node:a,onClickStart:e}));let r=E.d[a.type].valueOf(),s=null===(t=E.c[a.position])||void 0===t?void 0:t.valueOf(),d=a.position===E.c.SSO?tP[s]:tP[r];return a.is_multi_select&&a.type!==E.d.POLL&&(d=tP.MULTIPLE),_().createElement(D.P.div,{key:a.id,initial:{opacity:1,y:-300},animate:{opacity:1,y:0},transition:{y:{type:"spring",stiffness:300,damping:30},opacity:{duration:.2}}},_().createElement(d,{indexNumber:o,node:a}))};Container$1.displayName="SubotInlineNodeContainer";let TypeFormView=({typeFormProps:e,locale:t})=>{var n;let i;return(null==e?void 0:e.id)?_().createElement(B.Box,{component:"iframe",src:`https://${ee.K?"":"discover."}${P.y[t]}/typeform.html?id=${e.id}&${(n=e.params,i="",n&&(i=Object.keys(n).map(e=>e+"="+n[e]).join("&")),i)}`,width:"100%",height:"100%",sx:{display:"block",border:"none",borderRadius:"inherit"},allowFullScreen:!0}):null},tB={type:"spring",damping:25,stiffness:120},tL=(0,h.memo)(({loading:e,backgroundImage:t,isShowFooter:n,isFullContainer:i,isDisabledAnimationOnMobile:l,subotSettingData:o,onCloseMobile:a,bgImgFullContainer:r,typeFormProps:s})=>{let d=(0,h.useMemo)(()=>({backgroundImage:t?`url("${t}")`:void 0,backgroundRepeat:"no-repeat",backgroundPosition:"center"}),[t]),{isMobile:c,locale:u}=(0,h.useContext)(eT),[m,p]=(0,h.useState)(!1),v=s?"type-form":"subot-form";(0,h.useEffect)(()=>{m?document.body.classList.add("si-open-overflow"):document.body.classList.remove("si-open-overflow")},[m]),(0,h.useEffect)(()=>()=>{document.body.classList.remove("si-open-overflow")},[]);let g=m||l,b=_().createElement(eA,null,_().createElement(D.P.div,{style:d,layout:!0,transition:l?void 0:tB,className:j()("si-inline-revamp-container",{"si-container-open":g,"si-full-container-config":i,"si-typeform":!!s})},g&&!s&&_().createElement("button",{className:"si-close-btn",onClick:()=>{console.log("onClosemobile",a),p(!1),null==a||a()}},_().createElement(Close,null)),s&&u?_().createElement(TypeFormView,{locale:u,typeFormProps:s}):_().createElement(NodeContextProvider,null,_().createElement("div",{className:"subot-inline-revamp-container","data-show-footer":n},e&&!n&&_().createElement(U.L,{className:"si-loading"}),_().createElement(Container$1,{onClickStart:()=>{p(!0)}})),n&&_().createElement(Container$u,null))),_().createElement("div",{className:"si-container-placeholder"})),f=(0,h.useMemo)(()=>{if(r)return{backgroundImage:`url("${r}")`,backgroundSize:"cover",backgroundRepeat:"no-repeat",backgroundPosition:"center"}},[r]);return i?_().createElement(e$,{className:"si-container-fs",style:f},_().createElement(R.C,{className:`si-container ${s?"si-typeform-container":""}`},_().createElement("div",{className:"si-revamp-left"},_().createElement(Container$t,{layout:s&&u||c?"horizontal":"vertical",subotSettingData:o}),_().createElement(Container$v,{className:(0,B.clsx)(v,"disclaimer-top")})),_().createElement("div",{className:"si-revamp-right"},b),_().createElement(Container$v,{className:(0,B.clsx)(v,"disclaimer-bottom")}))):b});tL.displayName="SubotInlineRevampView";let Container=()=>{let{loading:e,listNodes:t,isShowFooter:n,activeId:i,isFullContainer:l,isDisabledAnimationOnMobile:o,onCloseMobile:a,userInfo:r,bgImgFullContainer:s,typeFormProps:d}=(0,h.useContext)(eT),c=(0,h.useMemo)(()=>{var e,n;let l=t.find(e=>e.id==i);return l?l.inline_background||(null===(n=null===(e=l.intents)||void 0===e?void 0:e.find(e=>e.type===E.N.BOT_BACKGROUND_IMAGE))||void 0===n?void 0:n.url):""},[t,i]),u=(0,h.useMemo)(()=>{let e=t[0];return{inlineImage:(null==e?void 0:e.inline_image)||"",inilneHeadline:(null==e?void 0:e.inline_headline)||"",reviewByAvatar:(null==e?void 0:e.inline_avatar)||"",reviewByName:(null==e?void 0:e.inline_review)||"",reviewBySpecialty:(null==e?void 0:e.inline_speciality)||"",reviewByHospital:(null==e?void 0:e.inline_hospital_name)||""}},[t[0]]);return void 0!==r&&t[0]?_().createElement(tL,Object.assign({},{loading:e,backgroundImage:c,bgImgFullContainer:s,isShowFooter:n,isFullContainer:l,isDisabledAnimationOnMobile:o,subotSettingData:u,onCloseMobile:a,typeFormProps:d})):null};Container.displayName="SubotInlineRevamp";let ContainerWithProvider=e=>_().createElement(SubotInlineProvider,Object.assign({},e,{subotId:Number(e.id)}),_().createElement(Container,null)),SubotInlineRevampWithTheme=e=>{var t,n,i,l,o,a,r,s,d,c,u,m,{onLoadFirstNode:p}=e,v=(0,x.a)(e,["onLoadFirstNode"]);let[g,b]=(0,h.useState)(null);return((0,h.useEffect)(()=>{(0,x._)(void 0,void 0,void 0,function*(){let e=yield Promise.resolve().then(function(){return nP}).then(e=>e.subotInlineFirstNode),t=yield e(v.id),n=(null==t?void 0:t._data)||null;b(n)})},[v.id]),(0,h.useEffect)(()=>{g&&(null==p||p(g))},[g,p]),g)?_().createElement(ContainerWithProvider,Object.assign({},v,{primaryColor:null===(n=null===(t=g.extra_settings)||void 0===t?void 0:t.inline_styles)||void 0===n?void 0:n.primary_color,textColor:null===(l=null===(i=g.extra_settings)||void 0===i?void 0:i.inline_styles)||void 0===l?void 0:l.text_color,textButtonColor:null===(a=null===(o=g.extra_settings)||void 0===o?void 0:o.inline_styles)||void 0===a?void 0:a.text_button_color,bgColor:null===(s=null===(r=g.extra_settings)||void 0===r?void 0:r.inline_styles)||void 0===s?void 0:s.container_bg_color,bgContentColor:null===(c=null===(d=g.extra_settings)||void 0===d?void 0:d.inline_styles)||void 0===c?void 0:c.content_bg_color,bgImgFullContainer:null===(m=null===(u=g.extra_settings)||void 0===u?void 0:u.inline_styles)||void 0===m?void 0:m.container_bg_image})):null},tj=(0,h.createContext)({activeId:"",params:{},nodes:[],getParams:()=>({}),trackingCommonInline:{}}),subotInlineClick=e=>(0,x._)(void 0,void 0,void 0,function*(){try{return yield(0,k.c)(getSubotApiPath(ex.GET_INLINE_CLICK),"POST",{data:e})}catch(e){}}),subotInlineImpression=e=>(0,x._)(void 0,void 0,void 0,function*(){try{return yield(0,k.c)(getSubotApiPath(ex.GET_INLINE_IMPRESSION),"POST",{data:e})}catch(e){}}),subotInlineMessage=e=>(0,x._)(void 0,void 0,void 0,function*(){try{return yield(0,k.c)(getSubotApiPath(ex.GET_INLINE_MESSAGE),"POST",{data:e})}catch(e){}}),computeExtraSettingsForBot=e=>{var t;if((null==e?void 0:e._status)===1&&(null===(t=null==e?void 0:e._data)||void 0===t?void 0:t.extra_settings))try{let t=JSON.parse(e._data.extra_settings);"object"==typeof t?e._data.extra_settings=t:e._data.extra_settings={sync_data_friso_campaign:!1}}catch(t){e._data.extra_settings={sync_data_friso_campaign:!1}}return e},subotInlineFirstNode=e=>(0,x._)(void 0,void 0,void 0,function*(){try{let t=yield(0,k.c)(getSubotApiPath(ex.GET_INLINE_FIRST_NODE)+`/${e}`,"GET");return computeExtraSettingsForBot(t),t}catch(e){}}),tR=F.A.div` margin-top: 2rem; .form { background-color: ${Q.w.colors.white||"#fff"}; } `,tU=F.A.div``,tD=F.A.div` margin-top: 1.25rem; `,tF=F.A.div` margin-bottom: 1rem; `,tG=F.A.div` font-weight: 400; font-size: 16px; line-height: 24px; color: #595959; font-style: italic; `,tH=(0,F.A)(eu.B)` position: relative; min-width: 180px; svg { path { stroke: currentColor; } } &:hover { svg { path { stroke: currentColor; } } } `,tz=F.A.div` display: flex; align-items: center; justify-content: center; `,tV=F.A.div` position: relative; overflow: ${({isMore:e})=>e?"unset":"hidden"}; max-height: ${({maxHeight:e})=>e?e+"px":"auto"}; margin-bottom: 8px; transition: 0.25s all linear; &:before { position: absolute; z-index: 1; top: 50%; right: 0; bottom: 0; left: 0; background-image: linear-gradient( to top, ${Q.w.colors.neutral50||"#F7F9FC"} 0%, transparent 100% ); content: ''; pointer-events: none; ${({isMore:e})=>e&&"opacity: 0;"} } `,tq=F.A.div` position: relative; padding: 32px 32px 16px; background-color: ${Q.w.colors.neutral50||"#F7F9FC"}; border-radius: ${Q.w.borderRadius}; ${G.M.tdDown} { padding: 24px 24px 16px; } ${G.M.mbDown} { padding: 16px; border-radius: 0px; } `,tW=F.A.div` padding: 12px 32px 32px; ${G.M.tdDown} { padding: 12px 24px 24px; } ${G.M.mbDown} { padding: 12px 16px 16px; } `,tY=F.A.div` border: 1px solid ${Q.w.colors.neutral100||"#E4E8EC"}; background-color: ${Q.w.colors.neutral50||"#F7F9FC"}; border-radius: ${Q.w.borderRadius}; ${G.M.mbDown} { border: none; } `,CheckboxIcon=e=>_().createElement("svg",Object.assign({width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),_().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 21C16.5228 21 21 16.5228 21 11C21 5.47715 16.5228 1 11 1C5.47715 1 1 5.47715 1 11C1 16.5228 5.47715 21 11 21Z",fill:"#2D87F3",stroke:"#2D87F3",strokeWidth:"2"}),_().createElement("path",{d:"M15.5714 8L9.67857 14L7 11.2727",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})),CheckIcon=e=>_().createElement("svg",Object.assign({width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),_().createElement("path",{d:"M13.3346 4L6.0013 11.3333L2.66797 8",stroke:"#737373",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})),LikeIcon=e=>_().createElement("svg",Object.assign({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),_().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.0521 5.70293L11.8834 2L12.6635 2.03149C12.6635 2.03149 13.5407 2.05593 14.4487 2.51311C15.3568 2.9703 16.375 4.04935 16.375 5.69552C16.375 6.76085 16.1102 7.83874 15.8458 8.67047H20.125C21.1497 8.67047 22 9.53063 22 10.5673V12.8847C22 13.1046 21.9497 13.3294 21.8462 13.533L18.6437 19.9571C18.3261 20.5939 17.6767 21 16.9701 21H8.875C7.85025 21 7 20.1398 7 19.1031V10.0579C7 9.50164 7.24299 8.97147 7.66284 8.61119L11.0521 5.70293ZM13.4432 4.15712C13.4125 4.15279 13.3784 4.14799 13.3263 4.1321L12.7422 6.73842L8.875 10.0579V19.1031H16.9701L20.125 12.7717V10.5673H13.0864L13.6357 9.25027C13.6357 9.25027 14.5 7.01241 14.5 5.69552C14.5 4.74112 14.1119 4.46257 13.6138 4.21176C13.5294 4.16929 13.4902 4.16376 13.4432 4.15712Z",fill:"#595959"}),_().createElement("path",{d:"M2 10.5C2 9.672 2.672 9 3.5 9C4.328 9 5 9.672 5 10.5V19.5C5 20.328 4.328 21 3.5 21C2.672 21 2 20.328 2 19.5V10.5Z",fill:"#595959"})),DislikeIcon=e=>_().createElement("svg",Object.assign({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),_().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.0521 17.2971L11.8834 21L12.6635 20.9685C12.6635 20.9685 13.5407 20.9441 14.4487 20.4869C15.3568 20.0297 16.375 18.9507 16.375 17.3045C16.375 16.2391 16.1102 15.1613 15.8458 14.3295H20.125C21.1497 14.3295 22 13.4694 22 12.4327V10.1153C22 9.89545 21.9497 9.6706 21.8462 9.467L18.6437 3.0429C18.3261 2.40607 17.6767 2 16.9701 2H8.875C7.85025 2 7 2.86016 7 3.89685V12.9421C7 13.4984 7.24299 14.0285 7.66284 14.3888L11.0521 17.2971ZM13.4432 18.8429C13.4125 18.8472 13.3784 18.852 13.3263 18.8679L12.7422 16.2616L8.875 12.9421V3.89685H16.9701L20.125 10.2283V12.4327H13.0864L13.6357 13.7497C13.6357 13.7497 14.5 15.9876 14.5 17.3045C14.5 18.2589 14.1119 18.5374 13.6138 18.7882C13.5294 18.8307 13.4902 18.8362 13.4432 18.8429Z",fill:"#595959"}),_().createElement("path",{d:"M2 12.5C2 13.328 2.672 14 3.5 14C4.328 14 5 13.328 5 12.5V3.5C5 2.672 4.328 2 3.5 2C2.672 2 2 2.672 2 3.5V12.5Z",fill:"#595959"})),ArrowDown=e=>_().createElement("svg",Object.assign({width:"10",height:"6",viewBox:"0 0 10 6",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),_().createElement("path",{d:"M1 1L5 5L9 1",stroke:"#595959",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})),ArrowLeft=e=>_().createElement("svg",Object.assign({width:"7",height:"10",viewBox:"0 0 7 10",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),_().createElement("path",{d:"M5.5 9L1.5 5L5.5 1",stroke:"#2D87F3",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})),ArrowRight=e=>_().createElement("svg",Object.assign({width:"7",height:"10",viewBox:"0 0 7 10",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),_().createElement("path",{d:"M1.5 9L5.5 5L1.5 1",stroke:"#2D87F3",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})),ArrowUp=e=>_().createElement("svg",Object.assign({width:"10",height:"6",viewBox:"0 0 10 6",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),_().createElement("path",{d:"M1 5L5 1L9 5",stroke:"#FC5D9A",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})),ChevronRightActive=e=>_().createElement("svg",Object.assign({width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),_().createElement("path",{d:"M6 12L10 8L6 4",stroke:"#2D87F3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})),RotateLeft=e=>_().createElement("svg",Object.assign({width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),_().createElement("g",{clipPath:"url(#clip0)"},_().createElement("path",{d:"M0.666626 2.6665V6.6665H4.66663",stroke:"#737373",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"}),_().createElement("path",{d:"M2.33996 10.0001C2.77222 11.227 3.59152 12.2802 4.6744 13.001C5.75728 13.7218 7.04508 14.0712 8.34377 13.9964C9.64246 13.9217 10.8817 13.4269 11.8747 12.5866C12.8677 11.7464 13.5608 10.6061 13.8494 9.3377C14.1381 8.06929 14.0067 6.74143 13.475 5.55419C12.9434 4.36696 12.0403 3.38466 10.9018 2.7553C9.76339 2.12595 8.45123 1.88364 7.16308 2.06487C5.87493 2.24611 4.68057 2.84108 3.75996 3.76013L0.666626 6.6668",stroke:"#737373",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})),_().createElement("defs",null,_().createElement("clipPath",{id:"clip0"},_().createElement("rect",{width:"16",height:"16",fill:"white"})))),tX=F.A.div` display: flex; align-items: center; justify-content: center; padding: 12px 24px; border: 1px solid ${Q.w.colors.neutral100||"#E4E8EC"}; background-color: ${Q.w.colors.white||"white"}; border-radius: 32px; cursor: pointer; transition: 0.25s all linear; svg { height: 16px; margin-right: 3px; } &:hover { background-color: ${Q.w.colors.neutral100}; } &.active { background-color: ${Q.w.colors.primaryActive}; color: ${Q.w.colors.white||"#fff"}; svg { stroke: ${Q.w.colors.white||"#fff"}; } } `,tK=F.A.div` padding: 12px 24px; border: 1px solid ${Q.w.colors.neutral100||"#E4E8EC"}; background-color: ${Q.w.colors.white||"white"}; border-radius: 32px; cursor: pointer; transition: 0.25s all linear; &.active { background-color: ${null===(u=Q.w.colors)||void 0===u?void 0:u.primaryActive}; color: ${Q.w.colors.white||"#fff"}; svg { stroke: ${Q.w.colors.white||"#fff"}; } } `,tJ=F.A.div` display: flex; align-items: center; padding: 16px 24px; border: 1px solid ${({active:e})=>e?Q.w.colors.primaryBase||"#2685F1":Q.w.colors.white||"#fff"}; background-color: ${Q.w.colors.white||"#fff"}; border-radius: ${Q.w.borderRadius}; cursor: pointer; transition: 0.25s all linear; .label { flex: 1; } .icon { position: relative; z-index: 0; display: flex; width: 24px; height: 24px; align-items: center; justify-content: center; padding: 1px; transition: 0.2s linear all; .icon-checkbox { width: 100%; height: 100%; opacity: 0; ${({active:e})=>e&&"opacity: 1"}; transition: 0.25s all linear; } &:before { position: absolute; top: 50%; left: 50%; width: 22px; height: 22px; border: 2px solid ${({active:e})=>e?Q.w.colors.primaryBase||"#2685F1":Q.w.colors.gray600||"#595959"}; border-radius: 50%; content: ''; transform: translate(-50%, -50%); transition: 0.25s all linear; } &:after { position: absolute; z-index: -1; top: 50%; left: 50%; width: 10px; height: 10px; background-color: ${Q.w.colors.primaryBase||"#2685F1"}; border-radius: 50%; content: ''; opacity: 0; ${({active:e})=>e&&"opacity: 1"}; transform: translate(-50%, -50%); transition: 0.25s all linear; } } &:hover { border-color: ${(null===(m=Q.w.colors)||void 0===m?void 0:m.primaryBase)||"#2685F1"}; .icon { &:before { border-color: ${(null===(p=Q.w.colors)||void 0===p?void 0:p.primaryBase)||"#2685F1"}; transition: 0.2s linear all; } } } ${G.M.tdDown} { padding: 16px 20px; } `,tZ=(0,F.A)(tJ)` position: relative; flex-wrap: wrap; padding: 16px; background-color: ${(null===(v=Q.w.colors)||void 0===v?void 0:v.white)||"#fff"}; .image-container { position: relative; overflow: hidden; width: 100%; padding-top: 67%; border-radius: 10px; .image { position: absolute; top: 50%; left: 50%; width: 100%; min-width: 100%; height: auto; min-height: 100%; transform: translate(-50%, -50%); } } .label { margin-top: 16px; } .icon { position: absolute; top: 1.75rem; right: 1.75rem; &:before { z-index: -1; background-color: #fff; } } ${G.M.tdDown} { padding: 12px; .label { margin-top: 12px; } .icon { top: 1.3rem; right: 1.3rem; } } ${G.M.tdDown} { padding: 8px; .label { margin-top: 8px; } .icon { top: 0.9rem; right: 0.9rem; } } `,tQ=F.A.div` display: flex; align-items: center; justify-content: flex-start; ${G.M.tdDown} { justify-content: center; } `,t0=F.A.div` textarea { background-color: ${(null===(g=Q.w.colors)||void 0===g?void 0:g.white)||"#fff"}; } `,t1=F.A.div` margin-top: 20px; color: ${(null===(b=Q.w.colors)||void 0===b?void 0:b.gray500)||"#737373"}; font-weight: 600; `,t2=F.A.div` position: relative; z-index: 0; display: flex; overflow: hidden; align-items: center; padding: 16px 20px; border-radius: ${Q.w.borderRadius}; .number { width: 32px; margin-right: 14px; font-weight: 600; } .content { flex: 1; } .icon { width: 16px; margin-left: 8px; } &:before { position: absolute; z-index: -1; top: 0; right: ${({percent:e})=>e?`${100-e}%`:"100%"}; bottom: 0; left: 0; background-color: ${({is_chosen:e})=>e?Q.w.colors.primary50||"#E3F2FF":Q.w.colors.neutral100||"#E4E8EC"}; content: ''; transition: 0.3s all linear; } &:after { position: absolute; z-index: -2; top: 0; right: 0; bottom: 0; left: 0; background-color: ${(null===(f=Q.w.colors)||void 0===f?void 0:f.white)||"#fff"}; content: ''; } ${G.M.mbDown} { padding: 6px 16px; } `,t6=F.A.div` width: ${({width:e})=>e||"100%"}; padding: 4px; &.item-image-container { padding: 16px; ${G.M.tdDown} { padding: 7.5px; } ${G.M.mbDown} { width: 50%; } } `,t5=F.A.div` display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: center; margin: -4px; &.list-container { margin: -16px; ${G.M.tdDown} { margin: -7.5px; } } &.review-container { margin: -8px; > div { padding: 8px; } } `,SubotInlineAction=({actions:e,value:t,onChange:n,htmlType:i,node_type:l,formSubmitMeta:o})=>{let a=(0,h.useMemo)(()=>{switch(l){case E.d.IMAGE:case E.d.REACTION:return"list-container";default:return""}},[l]);return _().createElement(_().Fragment,null,e&&!!(null==e?void 0:e.length)&&_().createElement(t5,{className:a},null==e?void 0:e.map(e=>{let l=t8[null==e?void 0:e.type];return l&&_().createElement(l,{key:e.id,action:e,onChange:n,active:null==t?void 0:t.includes(e.id),htmlType:i,formSubmitMeta:o})})))},t3=(0,F.A)(eu.B)` &:disabled { background-color: rgb(242, 242, 242); color: rgb(140, 140, 140); &:hover { border: 0; } } svg { path { stroke: currentColor; } } `,t4=(0,F.A)(t3)` &:disabled { background-color: rgb(242, 242, 242); color: rgb(140, 140, 140); &:hover { border: 0; } } svg { path { stroke: currentColor; } } `,t7=F.A.div` display: flex; align-items: center; justify-content: flex-end; padding: 16px 32px; border-top: 4px solid ${Q.w.colors.neutral100||"#E4E8EC"}; .mantine-Button-root { + .mantine-Button-root { margin-left: 8px; } } ${G.M.tdDown} { padding: 12px 24px; } ${G.M.mbDown} { padding: 12px 16px; } `,SubotInlineActionTextChoice=({action:e,onChange:t,active:n,htmlType:i,formSubmitMeta:l})=>{let{trackingCommonInline:o}=(0,h.useContext)(tj),a=(0,h.useRef)(null),[r,s]=(0,h.useState)(""),d=(null==e?void 0:e.type)===E.f.POLL_CHOICE_TEXT_BY_INPUT,c=(null==e?void 0:e.type)===E.f.USER_CHOICE_TEXT_BY_INPUT||d;return(0,h.useEffect)(()=>{var e,t;n&&(s((null===(e=null==l?void 0:l.find(e=>e.key===ek))||void 0===e?void 0:e.value)||""),null===(t=a.current)||void 0===t||t.focus())},[n,l]),_().createElement(t6,null,_().createElement(tJ,Object.assign({active:!!n,onClick:()=>null==t?void 0:t(e),className:"pointer-event-child-none"},o,{"data-response-id":null==e?void 0:e.id,"data-event-action":"Answer Click"}),_().createElement("div",{className:"label"},_().createElement(Markdown,null,null==e?void 0:e.label)),_().createElement("div",{className:"icon"},"checkbox"===i&&_().createElement(CheckboxIcon,{className:"icon-checkbox",viewBox:"0 0 22 22"}))),c&&n&&_().createElement(B.Box,{mt:"6px",style:{textAlign:"right"}},_().createElement(B.Textarea,{ref:a,placeholder:null==e?void 0:e.label,styles:{input:{paddingLeft:"24px",paddingRight:"24px",boxShadow:"none",":focus":{boxShadow:"none"}}},value:r,onChange:n=>{s(n.target.value),c&&(null==t||t(e,[{key:ek,control:E.E[null==e?void 0:e.type]||"text",value:n.target.value,action_id:e.id}]))},maxLength:360})))},SubotInlineActionImageChoice=({action:e,onChange:t,active:n,htmlType:i})=>{let{trackingCommonInline:l}=(0,h.useContext)(tj);return _().createElement(t6,{width:"45%",className:"item-image-container"},_().createElement(tZ,Object.assign({onClick:()=>t&&t(e),active:!!n},l,{"data-response-id":null==e?void 0:e.id,"data-event-action":"Answer Click"}),_().createElement("div",{className:"image-container"},_().createElement("img",{loading:"lazy",src:null==e?void 0:e.url,alt:null==e?void 0:e.label,className:"image"})),(null==e?void 0:e.label)&&_().createElement("div",{className:"label"},_().createElement(Markdown,null,null==e?void 0:e.label)),_().createElement("div",{className:"icon"},"checkbox"===i&&_().createElement(CheckboxIcon,{className:"icon-checkbox",viewBox:"0 0 22 22"}))))},SubotInlineTextArea=({action:e,value:t,onChange:n})=>_().createElement(t6,null,_().createElement(t0,null,_().createElement(eg.T,{placeholder:null==e?void 0:e.label,value:t&&"string"!=typeof t&&(null==t?void 0:t.value)?null==t?void 0:t.value:"",onChange:t=>{let i={key:null==e?void 0:e.key,control:E.E[null==e?void 0:e.type],value:t.target.value,action_id:null==e?void 0:e.id};n&&n(i)}}))),t8={"user-image":SubotInlineActionImageChoice,[E.f.USER_CHOICE_TEXT]:SubotInlineActionTextChoice,[E.f.USER_CHOICE_TEXT_BY_INPUT]:SubotInlineActionTextChoice,[E.f.USER_CHOICE_IMAGE]:SubotInlineActionImageChoice,[E.f.ACTION_SSO_REDIRECT]:({action:e,onChange:t})=>{let{trackingCommonInline:n}=(0,h.useContext)(tj);return _().createElement(t6,{width:"50%",style:{alignSelf:"center"}},_().createElement(t3,Object.assign({onClick:()=>t&&t(e),size:"lg",isBlock:!0},n,{className:"pointer-event-child-none","data-event-action":"Login Click","data-response-id":null==e?void 0:e.id}),_().createElement(Markdown,null,null==e?void 0:e.label)))},[E.f.POLL_CHOICE]:({active:e,action:t,onChange:n,htmlType:i,node_type:l})=>l===E.d.RESULT_POLL?_().createElement(t6,null,_().createElement(t2,{percent:(null==t?void 0:t.percent)||0,is_chosen:null==t?void 0:t.is_chosen},_().createElement("div",{className:"number"},null==t?void 0:t.percent,"%"),_().createElement("div",{className:"content"},null==t?void 0:t.label),_().createElement("div",{className:"icon"},(null==t?void 0:t.is_chosen)&&_().createElement(CheckIcon,{viewBox:"0 0 16 16"})))):_().createElement(SubotInlineActionTextChoice,{active:!!e,action:t,onChange:e=>{e&&n&&n({key:(null==e?void 0:e.key)||"",control:E.E[null==e?void 0:e.type],value:"",action_id:null==e?void 0:e.id})},htmlType:i}),[E.f.POLL_CHOICE_TEXT_BY_INPUT]:SubotInlineActionTextChoice,[E.f.POLL_CHOICE_IMAGE]:({active:e,action:t,onChange:n,htmlType:i,node_type:l})=>l===E.d.RESULT_POLL?_().createElement(t6,null,_().createElement(t2,{percent:(null==t?void 0:t.percent)||0,is_chosen:null==t?void 0:t.is_chosen},_().createElement("div",{className:"number"},null==t?void 0:t.percent,"%"),_().createElement("div",{className:"content"},null==t?void 0:t.label),_().createElement("div",{className:"icon"},(null==t?void 0:t.is_chosen)&&_().createElement(CheckIcon,{viewBox:"0 0 16 16"})))):_().createElement(SubotInlineActionImageChoice,{active:!!e,action:t,onChange:e=>{e&&n&&n({key:null==e?void 0:e.key,control:E.E[null==e?void 0:e.type],value:"",action_id:null==e?void 0:e.id})},htmlType:i}),[E.f.RATING_STAR]:({action:e,value:t,onChange:n})=>{var i,l;return _().createElement(t6,null,_().createElement(tQ,null,_().createElement(eb.A,{rating:t&&"string"!=typeof t&&(null==t?void 0:t.value)?parseInt(null==t?void 0:t.value):0,changeRating:t=>{let i={key:null==e?void 0:e.key,control:E.E[null==e?void 0:e.type],value:t.toString(),action_id:null==e?void 0:e.id};n&&n(i)},starHoverColor:null===(i=null===Q.w||void 0===Q.w?void 0:Q.w.colors)||void 0===i?void 0:i.yellow600,starRatedColor:null===(l=null===Q.w||void 0===Q.w?void 0:Q.w.colors)||void 0===l?void 0:l.yellow600,starDimension:"48"})))},[E.f.RATING_DESCRIPTION]:SubotInlineTextArea,[E.f.LIKE_CHOICE]:({action:e,active:t,onChange:n})=>_().createElement(t6,{width:"40%",className:"item-image-container"},_().createElement(tX,{className:j()(!!t&&"active"),onClick:()=>n&&n(e)},_().createElement(LikeIcon,{viewBox:"0 0 24 24"}),_().createElement(Markdown,null,null==e?void 0:e.label))),[E.f.DISLIKE_CHOICE]:({action:e,active:t,onChange:n})=>_().createElement(t6,{width:"40%",className:"item-image-container"},_().createElement(tX,{className:j()(!!t&&"active"),onClick:()=>n&&n(e)},_().createElement(DislikeIcon,{viewBox:"0 0 24 24"}),_().createElement(Markdown,null,null==e?void 0:e.label))),[E.f.REVIEW_CHOICE]:({active:e,action:t,onChange:n})=>_().createElement(t6,{width:"auto",className:"review-choice"},_().createElement(tK,{className:j()(!!e&&"active"),onClick:()=>n&&n({key:null==t?void 0:t.key,control:E.E[null==t?void 0:t.type],value:"",action_id:null==t?void 0:t.id})},_().createElement(Markdown,null,null==t?void 0:t.label))),[E.f.REVIEW_DESCRIPTION]:SubotInlineTextArea,[E.f.RESULT_BUTTON]:SubotInlineActionTextChoice,[E.f.POLL_RESULT]:({action:e})=>_().createElement(t6,null,_().createElement(t1,null,null==e?void 0:e.label))};var t9=(0,h.memo)(({onBack:e,onNext:t,hideBack:n,hideNext:i,nextText:l,backProps:o,nextProps:a})=>{var r,s,d;let{formatMessage:c}=(0,h.useContext)(k.T),{nodes:u,activeId:m,params:p,onNext:v,trackingCommonInline:g}=(0,h.useContext)(tj),b=u.find(e=>e.id==m),f=null===(r=null==b?void 0:b.actions)||void 0===r?void 0:r.find(e=>e.type===E.f.USER_CHOICE_NEXT),x=null===(s=null==b?void 0:b.actions)||void 0===s?void 0:s.find(e=>e.type===E.f.ACTION_MULTIPLE_BUTTON);return _().createElement(t7,null,!n&&_().createElement(t4,Object.assign({size:"md",color:"secondary",onClick:e},o,{className:j()("pointer-event-child-none",null==o?void 0:o.className)},g,{"data-event-action":"Back Click"}),_().createElement(ArrowLeft,{style:{marginRight:10}}),c({id:"riskScreener.back",defaultMessage:"Back"})),!i&&_().createElement(t3,Object.assign({size:"md",color:"primary",onClick:f?()=>{if(b&&f){let e={node_id:b.id,action_id:null==f?void 0:f.id,action_value:null==f?void 0:f.key};null==v||v(Object.assign(Object.assign(Object.assign({},p),e),b._message))}}:t},a,{className:j()("pointer-event-child-none",null==a?void 0:a.className)},g,{"data-event-action":"Answer Click","data-response-id":(null==x?void 0:x.id)||(null==f?void 0:f.id)||(null===(d=null==b?void 0:b._message)||void 0===d?void 0:d.action_id)}),l||c({id:"riskScreener.next",defaultMessage:"Next"}),_().createElement(ArrowRight,{style:{marginLeft:10}})))});let ne=F.A.h4` padding: 32px 0px 12px; border-bottom: 1px solid ${Q.w.colors.neutral100||"#E4E8EC"}; margin: 0px 32px; color: ${Q.w.colors.gray500||"#737373"}; font-size: 14px; font-weight: 700; line-height: 1.5; ${G.M.tdDown} { padding: 24px 0px 12px; margin: 0px 24px; } ${G.M.mbDown} { padding: 16px 0px 12px; margin: 0px 16px; } `;var nt=(0,h.memo)(()=>{let{formatMessage:e}=(0,h.useContext)(k.T),{nodes:t}=(0,h.useContext)(tj),n=(0,h.useMemo)(()=>{var e;return null===(e=t[0])||void 0===e?void 0:e.inline_headline},[t]);return _().createElement(ne,null,n||e({id:"subotInline.quote",defaultMessage:"HAVE TIME FOR A QUICK QUESTION?"}))});let nn=F.A.h3` margin-bottom: 0px; font-size: 22px; font-weight: bold; line-height: 1.45; ${G.M.tdDown} { font-size: 20px; } `,ni=(0,F.A)(eu.B)` &.bot-recalculate { svg { path { stroke: ${Q.w.colors.primaryBase||"#2685F1"} !important; } } &:hover { svg { path { stroke: #fff !important; } } } } `,nl=(0,F.A)(eu.B)` border: 2px solid transparent; `,no=F.A.div` display: flex; padding-top: 10px; padding-bottom: 10px; .icon { width: 64px; height: 64px; margin-right: 16px; object-fit: contain; object-position: center; } .content { flex: 1; .title { margin-top: 0; margin-bottom: 0; font-size: inherit; font-weight: 700; line-height: 1.4; } .description { color: ${Q.w.colors.gray700||"#404040"}; line-height: 1.4; } } ${G.M.mbDown} { .icon { width: 47px; height: 47px; margin-right: 16px; } .content { .title { font-size: 14px; } .description { font-size: 14px; } } } `;(0,F.A)(eu.B)``;let na=F.A.div` display: flex; align-items: flex-start; color: ${Q.w.colors.gray800||"#262626"}; font-size: 22px; font-weight: 700; letter-space: -0.6px; line-height: 1.45; .number { margin-right: 3px; } .title { flex: 1; } ${G.M.tdDown} { font-size: 20px; } ${G.M.mbDown} { font-size: 18px; } `,nr=F.A.div` display: flex; justify-content: center; `,ns=F.A.div``,nd=F.A.div` padding: 12px 16px; border: 1px solid ${Q.w.colors.gray200||"#D9D9D9"}; background-color: ${Q.w.colors.white||"#fff"}; border-radius: ${Q.w.borderRadius}; line-height: 1.5; `,nc=F.A.div` border: ${Q.w.colors.gray200||"#D9D9D9"}; background-color: ${Q.w.colors.white||"#FFF"}; border-radius: ${Q.w.borderRadius}; .intent-img { border-radius: ${Q.w.borderRadius}; &.has-label { border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; } } .intent-img-label { padding: 5px 10px; font-size: 0.8em; font-style: italic; font-weight: 400; } `,nu=F.A.div` display: flex; .feature { width: 30%; .feature-wrapper { position: relative; display: block; overflow: hidden; width: 100%; padding-top: 66%; border-radius: ${Q.w.borderRadius}; .feature-img { position: absolute; top: 50%; left: 50%; width: 100%; min-width: 100%; height: auto; min-height: 100%; transform: translate(-50%, -50%); } } } .body { flex: 1; margin-left: 10px; line-height: 1.5; a { color: ${Q.w.colors.gray800||"#262626"}; text-decoration: none; } } `,nm=F.A.div` display: flex; align-items: center; justify-content: space-between; padding: 20px 40px 20px 16px; background-color: #fff; border-radius: ${Q.w.borderRadius}; box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.04), 0px 0px 2px rgba(0, 0, 0, 0.06), 0px 0px 1px rgba(0, 0, 0, 0.04); .feature { display: block; overflow: hidden; width: 72px; height: 72px; margin-right: 16px; border-radius: ${Q.w.borderRadius}; img { width: 100%; height: 100%; object-fit: cover; object-position: center; } } .title-container { display: flex; flex: 1; align-items: center; justify-content: space-between; a { font-size: 16px; line-height: 1.5em; text-decoration: none; .title { padding: 0; color: #262626; font-size: inherit; line-height: inherit; } &.link { display: flex; align-items: center; justify-content: center; margin-left: 20px; color: #2d87f3; font-weight: 700; } } } @media screen and (max-width: 769px) { padding: 16px 12px; .feature { width: 50px; height: 50px; } .title-container { a { font-size: 13px; line-height: 20px; &.link { margin-left: 10px; } } } } `,np=F.A.div` display: flex; align-items: center; justify-content: center; `;F.A.div` padding: 16px; margin-top: 32px; margin-bottom: 32px; background-color: ${Q.w.colors.primary50||""}; border-radius: ${Q.w.borderRadius}; .item-grid { > div { box-shadow: none; } } .lp--affiliate-product { .arrow-left { left: -20px; } .arrow-right { right: -16px; } } .bullet-nav { bottom: -10px; } `;let nv=F.A.div` width: ${({width:e})=>e||"100%"}; padding: 8px; ${G.M.mbDown} { width: 100%; } `,ng=F.A.div` display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: center; margin: 0 -8px; `,nb=F.A.div` width: ${({width:e})=>e||"100%"}; padding: 4px; ${G.M.mbDown} { width: 100%; } `,nf=F.A.div` display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: center; margin: 0 -4px; `,nh=F.A.div` margin-top: 20px; `,SubotInlineIntent=({intents:e,indexNumber:t})=>{var n,i;let l=(0,h.useMemo)(()=>{let t=e&&e[0];return t||null},[]);return e.length?_().createElement(_().Fragment,null,l&&_().createElement(SubotInlineIntentBotTitle,{intent:l,indexNumber:t}),!!(null===(n=e.slice(1))||void 0===n?void 0:n.length)&&_().createElement(nh,null,_().createElement(nf,null,null===(i=e.slice(1))||void 0===i?void 0:i.map(e=>{let t=n_[null==e?void 0:e.type];return t&&_().createElement(t,{key:e.id,intent:e})})))):_().createElement(SubotInlineIntentBotTitle,{indexNumber:t})},SubotInlineIntentFinal=({intents:e})=>{let t=(0,h.useMemo)(()=>{let t=[],n=[],i=[];return null==e||e.map(e=>{switch(null==e?void 0:e.type){case E.N.BOT_MAIN_IMAGE:case E.N.BOT_MAIN_TITLE:case E.N.BOT_MAIN_BODY:case E.N.BOT_MAIN_BUTTON:case E.N.BOT_RECALCULATE:t.push(e);break;case E.N.BOT_SUB_TITLE:case E.N.BOT_SUB_BODY:n.push(e);break;default:i.push(e)}}),{mainIntents:t,subIntents:n,intents:i}},[]);if(!(null==e?void 0:e.length))return null;function renderIntent(e){let t=n_[null==e?void 0:e.type];return t?_().createElement(t,{key:e.id,intent:e}):null}return _().createElement(nf,null,_().createElement(nb,null,_().createElement(ng,null,t.mainIntents.map(renderIntent),t.subIntents.map(renderIntent),t.intents.map(renderIntent))))},SubotInlineIntentBotText=({intent:e})=>(null==e?void 0:e.label)?_().createElement(nb,null,_().createElement(nd,null,_().createElement(Markdown,null,null==e?void 0:e.label))):_().createElement(_().Fragment,null),SubotInlineIntentBotImage=({intent:e})=>{if(!e.url)return _().createElement(_().Fragment,null);let t=(()=>{try{return!!JSON.parse((null==e?void 0:e.label)||"")}catch(e){return!1}})();return _().createElement(nb,{width:"50%"},_().createElement(nc,null,_().createElement("img",{loading:"lazy",src:e.url,alt:e.label,className:`intent-img ${e.label&&"has-label"}`}),t&&_().createElement("h4",{className:"intent-img-label"},_().createElement(Markdown,null,e.label))))},SubotInlineIntentBotTitle=({intent:e,indexNumber:t})=>{let n=![E.N.SSO_INTENT].includes(null==e?void 0:e.type);return _().createElement(ns,null,_().createElement(na,null,t&&_().createElement("div",{className:"number"},t<10?`0${t}`:t,"."),n&&e&&[E.N.BOT_TEXT,E.N.BOT_BUTTON].includes(null==e?void 0:e.type)&&_().createElement(Markdown,{className:"title"},e.label)),e&&[E.N.BOT_IMAGE].includes(null==e?void 0:e.type)&&_().createElement(nr,null,_().createElement(SubotInlineIntentBotImage,{intent:e})))},SubotInlineIntentBotMainTitle=({intent:e})=>e.label&&"Sub title"!==e.label&&"Main title"!==e.label?_().createElement(nv,null,_().createElement(nn,null,_().createElement(Markdown,null,e.label))):null,SubotInlineIntentBotMainBody=({intent:e})=>e.label&&"Main body"!==e.label&&"Sub body"!==e.label?_().createElement(nv,null,_().createElement("div",{className:"intents__item markdown"},_().createElement(Markdown,null,e.label))):null,n_={[E.N.BOT_TEXT]:SubotInlineIntentBotText,[E.N.BOT_IMAGE]:SubotInlineIntentBotImage,[E.N.BOT_BUTTON]:({intent:e})=>{let{trackingCommonInline:t}=(0,h.useContext)(tj);return(null==e?void 0:e.label)?_().createElement(nb,{width:"60%"},_().createElement(nl,Object.assign({size:"lg",color:"primary",onClick:()=>{window.location.href=e.url},isBlock:!0},t,{"data-event-action":"Click CTA","data-response-id":e.id}),_().createElement(Markdown,null,null==e?void 0:e.label))):_().createElement(_().Fragment,null)},[E.N.BOT_URL]:({intent:e})=>{let t=(0,h.useMemo)(()=>e.label.includes("{")?JSON.parse(e.label):{},[e.label]);return _().createElement(_().Fragment,null,!!Object.keys(t).length&&_().createElement(nb,null,_().createElement(nu,null,_().createElement("div",{className:"feature"},_().createElement("a",{href:null==t?void 0:t.url,className:"feature-wrapper"},_().createElement("img",{loading:"lazy",src:null==t?void 0:t.thumbnail,alt:null==t?void 0:t.title,className:"feature-img"}))),_().createElement("div",{className:"body"},_().createElement("a",{href:null==t?void 0:t.url},_().createElement("h5",{className:"title"},_().createElement(Markdown,null,null==t?void 0:t.title)))))))},[E.N.BOT_RECALCULATE]:({intent:e})=>{let{onReset:t}=(0,h.useContext)(tj);return(null==e?void 0:e.label)?_().createElement(nb,{width:"auto",style:{justifyContent:"center",display:"flex"}},_().createElement(ni,{size:"lg",color:"secondary",onClick:()=>{t&&t()},icon:_().createElement(RotateLeft,null),className:"bot-recalculate"},_().createElement(Markdown,null,null==e?void 0:e.label))):_().createElement(_().Fragment,null)},[E.N.BOT_MAIN_TITLE]:SubotInlineIntentBotMainTitle,[E.N.BOT_MAIN_IMAGE]:({intent:e})=>e.url?_().createElement(nv,null,_().createElement(nc,null,_().createElement("img",{loading:"lazy",src:e.url,alt:e.label,className:`intent-img ${e.label&&"has-label"}`}),e.label&&_().createElement("h4",{className:"intent-img-label"},_().createElement(Markdown,null,e.label)))):_().createElement(_().Fragment,null),[E.N.BOT_MAIN_BODY]:SubotInlineIntentBotMainBody,[E.N.BOT_MAIN_BUTTON]:({intent:e})=>{let{trackingCommonInline:t}=(0,h.useContext)(tj);return e.label?_().createElement(nb,{width:"auto"},_().createElement(np,null,_().createElement(nl,Object.assign({size:"lg",color:"primary",onClick:()=>{window.location.href=e.url},className:"pointer-event-child-none"},t,{"data-event-action":"Click CTA","data-response-id":e.id}),_().createElement(Markdown,null,null==e?void 0:e.label)))):_().createElement(_().Fragment,null)},[E.N.BOT_SUB_TITLE]:SubotInlineIntentBotMainTitle,[E.N.BOT_SUB_BODY]:SubotInlineIntentBotMainBody,[E.N.BOT_LANDING_PAGE_URL]:SubotInlineIntentBotText,[E.N.BOT_LANDING_PAGE_BUTTON]:SubotInlineIntentBotText,[E.N.BOT_RISK_SCREEN]:({intent:e})=>{let{formatMessage:t}=(0,h.useContext)(k.T),n=(0,h.useMemo)(()=>e.label&&e.label.includes("{")?JSON.parse(e.label):{},[e,null==e?void 0:e.label]);return _().createElement(_().Fragment,null,!!(null==n?void 0:n.title)&&!!(null==n?void 0:n.thumbnail)&&!!(null==n?void 0:n.url)&&_().createElement(nv,null,_().createElement(nm,null,_().createElement("a",{href:null==n?void 0:n.url,className:"feature"},_().createElement("img",{loading:"lazy",src:null==n?void 0:n.thumbnail,alt:null==n?void 0:n.title})),_().createElement("div",{className:"title-container"},_().createElement("a",{href:null==n?void 0:n.url},_().createElement("h5",{className:"title"},null==n?void 0:n.title)),_().createElement("a",{href:null==n?void 0:n.url,className:"link"},t({id:"riskScreener.start",defaultMessage:"Start"}),_().createElement(ChevronRightActive,{style:{marginLeft:10}}))))))},[E.N.BOT_RELATED_ARTICLE]:({intent:e})=>{var t,n,i,l,o,a,r,s,d,c,u,m,p;let v=(0,h.useMemo)(()=>{if(e.label&&e.label.includes("{")){let t=JSON.parse(e.label);if(t.meta){let e={};t.meta.map(({key:t,value:n})=>{t&&n&&(e[t]=n)}),t.meta=Object.assign({},e)}return Object.assign({},t)}return{}},[e,null==e?void 0:e.label]);return _().createElement(_().Fragment,null,!!(null==v?void 0:v.title)&&!!(null==v?void 0:v.thumbnail)&&!!(null==v?void 0:v.url)&&!!(null==v?void 0:v.meta)&&!!(null===(t=null==v?void 0:v.meta)||void 0===t?void 0:t.post_modified)&&!!(null===(n=null==v?void 0:v.meta)||void 0===n?void 0:n.reviewed_display_name)&&!!(null===(i=null==v?void 0:v.meta)||void 0===i?void 0:i.reviewed_url)&&!!(null===(l=null==v?void 0:v.meta)||void 0===l?void 0:l.reviewed_avatar_thumbnail)&&!!(null===(o=null==v?void 0:v.meta)||void 0===o?void 0:o.category_url)&&!!(null===(a=null==v?void 0:v.meta)||void 0===a?void 0:a.category_name)&&_().createElement(nv,{width:"40%"},_().createElement(ef.d,{title:null==v?void 0:v.title,uploadTime:$()(null===(r=null==v?void 0:v.meta)||void 0===r?void 0:r.post_modified).format("DD/MM/YYYY"),authorName:null===(s=null==v?void 0:v.meta)||void 0===s?void 0:s.reviewed_display_name,authorLink:null===(d=null==v?void 0:v.meta)||void 0===d?void 0:d.reviewed_url,avatarImg:_().createElement("img",{loading:"lazy",src:null===(c=null==v?void 0:v.meta)||void 0===c?void 0:c.reviewed_avatar_thumbnail,alt:null===(u=null==v?void 0:v.meta)||void 0===u?void 0:u.reviewed_display_name}),categoryLink:null===(m=null==v?void 0:v.meta)||void 0===m?void 0:m.category_url,categoryName:null===(p=null==v?void 0:v.meta)||void 0===p?void 0:p.category_name,banner:_().createElement("img",{loading:"lazy",src:null==v?void 0:v.thumbnail,alt:null==v?void 0:v.title}),text:"",size:"sm",direction:"vertical"})))},[E.N.THANK_YOU_IMAGE]:({intent:e})=>e.url?_().createElement(nv,null,_().createElement(nc,null,_().createElement("img",{loading:"lazy",src:e.url,alt:e.label,className:`intent-img ${e.label&&"has-label"}`}),e.label&&_().createElement("h4",{className:"intent-img-label"},_().createElement(Markdown,null,e.label)))):_().createElement(_().Fragment,null),[E.N.THANK_YOU_TITLE]:({intent:e})=>e.label?_().createElement(nv,null,_().createElement(nn,null,_().createElement(Markdown,null,e.label))):_().createElement(_().Fragment,null),[E.N.THANK_YOU_BODY]:({intent:e})=>e.label?_().createElement(nv,null,_().createElement("div",{className:"intents__item markdown"},_().createElement(Markdown,null,e.label))):_().createElement(_().Fragment,null),[E.N.SSO_INTENT]:({intent:e})=>{let t=(()=>{try{return(null==e?void 0:e.label)?JSON.parse(null==e?void 0:e.label):{}}catch(e){return{}}})();return t&&t.title?_().createElement(nb,null,_().createElement(no,null,_().createElement("img",{loading:"lazy",src:null==e?void 0:e.url,className:"icon",alt:""}),_().createElement("div",{className:"content"},_().createElement("h3",{className:"title"},t.title),_().createElement("div",{className:"description"},null==t?void 0:t.description)))):_().createElement(_().Fragment,null)}},SubotInlineNodeFinal=({node:e})=>{var t,n;let{nodes:i}=(0,h.useContext)(tj),{formatMessage:l}=(0,h.useContext)(k.T),o=(0,h.useRef)(null),a=(0,h.useRef)(null),[r,s]=(0,h.useState)(350),[d,c]=(0,h.useState)(!0),[u,m]=(0,h.useState)(!1),p=(0,h.useCallback)(()=>{eE.measure(()=>{var e;if(a.current){let t=null===(e=a.current)||void 0===e?void 0:e.getBoundingClientRect().height;r&&r{eE.measure(()=>{a.current&&setTimeout(()=>{var e;let t=null===(e=a.current)||void 0===e?void 0:e.getBoundingClientRect().height;t&&r>t&&(c(!1),m(!1))},400)})},[]);let v=i[0],g=null===(t=null==v?void 0:v.extra_settings)||void 0===t?void 0:t.subot_type,b=(0,h.useMemo)(()=>{var t;return(null===(t=null==e?void 0:e.intents)||void 0===t?void 0:t.filter(e=>e.type===E.N.BOT_SUGGESTED_SERVICE))||[]},[]);return _().createElement(tq,null,_().createElement("div",{ref:o,className:"hhg-flag",style:{position:"absolute",top:-100,left:0,pointerEvents:"none"}}),_().createElement(tV,{maxHeight:r,isMore:u},_().createElement("div",{ref:a},_().createElement(SubotInlineIntentFinal,{intents:(null==e?void 0:e.intents)||[]}),b.length>0&&_().createElement("div",null,b.map(e=>{let t=e5[e.type||""];return t&&_().createElement(t,{key:e.id,intent:e})})))),d&&_().createElement(tz,null,_().createElement(tH,{size:"md",color:"secondary",onClick:p},u?_().createElement(_().Fragment,null,l({id:"subotInline.showLess",defaultMessage:"Show less"}),_().createElement(ArrowUp,{style:{marginLeft:10}})):_().createElement(_().Fragment,null,l({id:"subotInline.showMore",defaultMessage:"Show more"}),_().createElement(ArrowDown,{style:{marginLeft:10}})))),g===E.h.voucherAcuvue&&_().createElement(SubotInlineVoucherLeftUI,{clientId:null===(n=v.extra_settings)||void 0===n?void 0:n.client_id,voucherAnswers:extractVoucherAnswers(i,v)}))},nE=F.A.span` display: inline-block; margin-top: 20px; color: ${Q.w.colors.primaryBase||"#2D87F3"}; cursor: pointer; transition: 0.3 all ease; &:hover { color: ${Q.w.colors.primaryHover||"#2D87F3"}; } ${G.M.tdDown} { margin-top: 16px; } ${G.M.mbDown} { margin-top: 12px; } `,nx=F.A.div` max-width: 430px; margin-right: auto; margin-left: auto; `,ny=F.A.div` padding: 44px 16px 32px; background-color: ${Q.w.colors.neutral50||"#F7F9FC"}; border-radius: ${Q.w.borderRadius}; position: relative; text-align: center; ${G.M.tdDown} { padding: 36px 16px 24px; } ${G.M.mbDown} { padding: 16px; border-radius: 0px; } `,OTPInfoForm=({className:e,style:t,actions:n,countryCode:i,phoneNumber:l,areaCode:o,callBack:a})=>{let r=(0,h.useRef)(),[s,d]=(0,h.useState)(!1),[c,u]=(0,h.useState)(!1),[m,p]=(0,h.useState)(!1),[v,g]=(0,h.useState)(!1),{register:b,formState:{errors:f},control:y,trigger:w,getValues:I,setValue:S}=(0,el.mN)(),{formatMessage:C,action:{pushNotifications:O}}=(0,h.useContext)(k.T),handleSendOTP=e=>(0,x._)(void 0,void 0,void 0,function*(){var t;e.preventDefault();let i=I(),l=(0,eo.parsePhoneNumber)(i.phone||"");if((null==l?void 0:l.nationalNumber)&&(null==l?void 0:l.countryCallingCode)){u(!0);try{let e=yield(0,k.c)(getSubotApiPath(ex.POST_SEND_OTP),"POST",{data:{phone_number:l.nationalNumber,area_code:`+${l.countryCallingCode}`}});if(u(!1),(null==e?void 0:e._status)===1){v&&(d(!1),r.current.reset()),g(!0),setTimeout(()=>{let e=document.querySelector(".input-otp-code");e&&(e.focus(),e.scrollIntoView({block:"center"}))},100);return}if((null==e?void 0:e._status)===0&&(null===(t=null==e?void 0:e._messages)||void 0===t?void 0:t[0])==="This phone number was verified"){r.current&&r.current.cancel(),O({title:"",message:"Số điện thoại n\xe0y đ\xe3 được x\xe1c minh.",type:"success"});let e=n.find(e=>e.type===E.f.USER_SUBMIT_SEND);e&&a(e,i.phone);return}throw Error()}catch(e){u(!1),r.current&&r.current.cancel(),showMessageSomethingWrong()}}}),handleOnVerify=(e,t)=>(0,x._)(void 0,void 0,void 0,function*(){if(e.preventDefault(),p(!0),yield w(),ei()(f)){let e=I(),{number:n}=e,i=(0,eo.parsePhoneNumber)(e.phone||"");if((null==i?void 0:i.nationalNumber)&&(null==i?void 0:i.countryCallingCode))try{let l=yield(0,k.c)(getSubotApiPath(ex.POST_VERIFY_OTP),"POST",{data:{phone_number:i.nationalNumber,area_code:`+${i.countryCallingCode}`,code:n}});if(p(!1),(null==l?void 0:l._status)===1){O({title:"",message:C({id:"subot.verifyOTP.success.message"}),type:"success"}),a(t,e.phone);return}throw Error()}catch(e){O({title:"",message:C({id:"validation.error.validOTP"}),type:"danger"}),p(!1)}}else p(!1)}),showMessageSomethingWrong=()=>{O({title:"",message:C({id:"notification.comment.somethingWrong"}),type:"danger"})},renderFormInput=e=>{if(!e.key)return null;switch(e.type){case E.f.USER_SUBMIT_PHONE:return _().createElement("div",{className:"input-row",key:e.id},_().createElement("label",{htmlFor:e.key},e.label),_().createElement(el.xI,{name:e.key,control:y,rules:{required:!0,validate:e=>(0,eo.isPossiblePhoneNumber)(e)},render:({field:{onChange:t,value:n}})=>{let o=!s&&v||c;return _().createElement(tl,null,_().createElement(PhoneInputWithCode,{value:n,defaultValue:l,onChange:t,defaultCountry:i,id:e.id,className:`input-row ${e.id}`,name:e.key,disabled:o,flagComponent:FlagComponent,placeholder:e.label}),o&&_().createElement(IconEdit,{viewBox:"0 0 24 24",className:"icon-edit-phone",onClick:()=>{var e;t(""),g(!1),p(!1),null===(e=r.current)||void 0===e||e.cancel()}}),e.key&&f[e.key]&&_().createElement("p",{className:"error-message"},C({id:"validation.error.validNumber",defaultMessage:"Please enter a valid number."})),_().createElement("div",{className:"submit-btn-row",key:e.id},_().createElement(eu.B,{className:"submit-btn",size:"lg",onClick:handleSendOTP,isDisabled:!s&&v||c,isLoading:c},v?_().createElement(tn,{ref:r,isFinished:s,onFinish:d}):_().createElement("span",null,C({id:"subot.sendOTP.button",defaultMessage:"Send OTP"})))))}}));case E.f.USER_SUBMIT_NUMBER:if(!v)return"";return _().createElement("div",{className:"input-row",key:e.id},_().createElement("label",{htmlFor:e.key},e.label),_().createElement("input",Object.assign({type:"tel",id:e.id,placeholder:e.label},b(e.key,{required:!0,pattern:/^[0-9]{0,6}$/}),{className:"input-otp-code"})),f[e.key]&&_().createElement("p",{className:"error-message"},C({id:"validation.error.validOTP",defaultMessage:"Invalid OTP provided"})));default:return""}},renderFormSubmitAndTerms=e=>e.type===E.f.USER_SUBMIT_SEND&&v?_().createElement("div",{className:"submit-btn-row",key:e.id},_().createElement(eu.B,{className:"submit-btn",size:"lg",isDisabled:m,isLoading:m,onClick:t=>handleOnVerify(t,e)},e.label)):"";return(0,h.useEffect)(()=>{if(l){let e=n.find(e=>e.type===E.f.USER_SUBMIT_PHONE);e&&e.key&&S(e.key,`+${o}${l}`)}},[l,o]),_().createElement(ti,{className:e,style:t},_().createElement("form",{className:"user-info-form"},n.map(e=>renderFormInput(e)),n.map(e=>renderFormSubmitAndTerms(e))))},useVerifyPhoneNumber=()=>{let e=null===k.G||void 0===k.G?void 0:k.G.userInfo,[t,n]=(0,h.useState)(!1);return(0,h.useEffect)(()=>{(null==e?void 0:e.phone)&&e.phone_verified_at&&e.verify_phone_code&&n(!0)},[e]),t},nw={TEXT:({node:e,indexNumber:t})=>{let{formatMessage:n,action:{pushNotifications:i}}=(0,h.useContext)(k.T),{nodes:l,activeId:o,params:a,onSubmit:r,onPrev:s,onNext:d,onChange:c}=(0,h.useContext)(tj),[u,m]=(0,h.useState)((null==e?void 0:e._message)||{}),handleOnChangeNormal=t=>(0,x._)(void 0,void 0,void 0,function*(){let n=Object.assign(Object.assign(Object.assign(Object.assign({},a),u),{node_id:e.id,action_id:null==t?void 0:t.id,action_value:null==t?void 0:t.key}),getCurrentTotalDynamicScore(l,o,t.id));delete n.form_submit_meta;let i=yield subotInlineMessage(n);if((null==i?void 0:i._status)===1){let e=null==i?void 0:i._data,{node:t}=e,l=(0,x.a)(e,["node"]),o=Object.assign(Object.assign({},t),{_message:Object.assign(Object.assign({},l),{node_id:t.id})});r&&r(o,n)}});return _().createElement(tY,null,_().createElement(nt,null),_().createElement(tW,null,_().createElement(tU,null,_().createElement(SubotInlineIntent,{intents:(null==e?void 0:e.intents)||[],indexNumber:t})),_().createElement(tD,null,_().createElement(SubotInlineAction,{value:(null==u?void 0:u.action_id)?[null==u?void 0:u.action_id]:[],actions:null==e?void 0:e.actions,onChange:(e,t)=>(0,x._)(void 0,void 0,void 0,function*(){if(!e)return;let n=(null==e?void 0:e.type)===E.f.USER_CHOICE_TEXT_BY_INPUT||(null==e?void 0:e.type)===E.f.POLL_CHOICE_TEXT_BY_INPUT,i=Object.assign(Object.assign({},u),{action_id:null==e?void 0:e.id,action_value:null==e?void 0:e.key,form_submit_meta:t});if(n){m(i),null==c||c(i);return}delete i.form_submit_meta,m(i),handleOnChangeNormal(e)}),formSubmitMeta:null==u?void 0:u.form_submit_meta}))),_().createElement(t9,{onBack:()=>s&&s(),backProps:{isDisabled:!(1!==t)},onNext:()=>{let t=JSON.parse(JSON.stringify(Object.assign(Object.assign(Object.assign({},a),null==e?void 0:e._message),u)));if((null==u?void 0:u.action_id)&&(null==u?void 0:u.action_value)===ek){null==d||d(t);return}(null==u?void 0:u.action_id)&&(null==u?void 0:u.action_value)?(delete t.form_submit_meta,null==d||d(t)):i({title:"",message:n({id:"multiSelectError.required",defaultMessage:"There is no answer!"}),type:"warning"})}}))},IMAGE:({node:e,indexNumber:t})=>{let{formatMessage:n,action:{pushNotifications:i}}=(0,h.useContext)(k.T),{params:l,onSubmit:o,onPrev:a,onNext:r}=(0,h.useContext)(tj),[s,d]=(0,h.useState)((null==e?void 0:e._message)||{});return _().createElement(tY,null,_().createElement(nt,null),_().createElement(tW,null,_().createElement(tU,null,_().createElement(SubotInlineIntent,{intents:(null==e?void 0:e.intents)||[],indexNumber:t})),_().createElement(tD,null,_().createElement(SubotInlineAction,{node_type:null==e?void 0:e.type,value:(null==s?void 0:s.action_id)?[null==s?void 0:s.action_id]:[],actions:null==e?void 0:e.actions,onChange:t=>(0,x._)(void 0,void 0,void 0,function*(){if(t){d(Object.assign(Object.assign({},s),{action_id:null==t?void 0:t.id,action_value:null==t?void 0:t.key}));let n=Object.assign(Object.assign(Object.assign({},l),s),{node_id:e.id,action_id:null==t?void 0:t.id,action_value:null==t?void 0:t.key}),i=yield subotInlineMessage(n);if((null==i?void 0:i._status)===1){let e=null==i?void 0:i._data,{node:t}=e,l=(0,x.a)(e,["node"]),a=Object.assign(Object.assign({},t),{_message:Object.assign(Object.assign({},l),{node_id:t.id})});o&&o(a,n)}}})}))),_().createElement(t9,{onBack:()=>a&&a(),backProps:{isDisabled:!(1!==t)},onNext:()=>{var t;(null==e?void 0:e._message)&&(null===(t=e._message)||void 0===t?void 0:t.action_id)?r&&r(Object.assign(Object.assign(Object.assign({},l),s),null==e?void 0:e._message)):i({title:"",message:n({id:"multiSelectError.required",defaultMessage:"There is no answer!"}),type:"warning"})}}))},FORM:({node:e,indexNumber:t})=>{var n;let{data:{locale:i}}=(0,h.useContext)(k.T),{params:l,onPrev:o,onSubmit:a,trackingCommonInline:r,nodes:s,activeId:d}=(0,h.useContext)(tj);return _().createElement(tY,null,_().createElement(nt,null),_().createElement(tW,null,_().createElement(tU,null,_().createElement(SubotInlineIntent,{intents:(null==e?void 0:e.intents)||[],indexNumber:t})),_().createElement(tR,null,_().createElement(UserInfoForm,{botId:l.bot_id,nodeId:String(null==e?void 0:e.id),className:"form",actions:(null==e?void 0:e.actions)||[],formSubmitMeta:(null===(n=null==e?void 0:e._message)||void 0===n?void 0:n.form_submit_meta)||null,callBack:t=>(0,x._)(void 0,void 0,void 0,function*(){let n=yield subotInlineMessage(Object.assign(Object.assign(Object.assign(Object.assign({},l),e._message),t),getCurrentTotalDynamicScore(s,d,t.action_id,t.form_submit_meta)));if((null==n?void 0:n._status)===1){let i=null==n?void 0:n._data,{node:l}=i,o=(0,x.a)(i,["node"]),r=Object.assign(Object.assign({},l),{_message:Object.assign(Object.assign({},o),{node_id:l.id})});a&&a(r,Object.assign(Object.assign({},e._message),t))}}),countryCode:(null==i?void 0:i.split("-")[1])||"PH",trackingSubmitBtn:Object.assign(Object.assign({},r),{"data-event-action":"Submit"})}))),_().createElement(t9,{onBack:()=>o&&o(),backProps:{isDisabled:!(1!==t)},hideNext:!0}))},CONDITION:({node:e,indexNumber:t})=>{let{formatMessage:n,action:{pushNotifications:i}}=(0,h.useContext)(k.T),{params:l,onChange:o,onSubmit:a,onPrev:r,onNext:s,nodes:d,activeId:c}=(0,h.useContext)(tj),[u,m]=(0,h.useState)((null==e?void 0:e._message)||{}),handleOnChangeNormal=e=>(0,x._)(void 0,void 0,void 0,function*(){let t=Object.assign(Object.assign(Object.assign(Object.assign({},l),u),{action_id:null==e?void 0:e.id,action_value:null==e?void 0:e.key}),getCurrentTotalDynamicScore(d,c,e.id));delete t.form_submit_meta;let n=yield subotInlineMessage(t);if((null==n?void 0:n._status)===1){let e=null==n?void 0:n._data,{node:i}=e,l=(0,x.a)(e,["node"]),o=Object.assign(Object.assign({},i),{_message:Object.assign(Object.assign({},l),{node_id:i.id})});delete o._message.form_submit_meta,a&&a(o,t)}});return _().createElement(tY,null,_().createElement(nt,null),_().createElement(tW,null,_().createElement(tU,null,_().createElement(SubotInlineIntent,{intents:(null==e?void 0:e.intents)||[],indexNumber:t})),_().createElement(tD,null,_().createElement(SubotInlineAction,{value:(null==u?void 0:u.action_id)?[null==u?void 0:u.action_id]:[],actions:null==e?void 0:e.actions,onChange:(e,t)=>(0,x._)(void 0,void 0,void 0,function*(){if(!e)return;let n=(null==e?void 0:e.type)===E.f.USER_CHOICE_TEXT_BY_INPUT||(null==e?void 0:e.type)===E.f.POLL_CHOICE_TEXT_BY_INPUT,i=Object.assign(Object.assign({},u),{action_id:null==e?void 0:e.id,action_value:null==e?void 0:e.key,form_submit_meta:t});if(n){m(i),null==o||o(i);return}delete i.form_submit_meta,m(i),handleOnChangeNormal(e)}),formSubmitMeta:null==u?void 0:u.form_submit_meta}))),_().createElement(t9,{onBack:()=>r&&r(),backProps:{isDisabled:!(1!==t)},onNext:()=>{let t=JSON.parse(JSON.stringify(Object.assign(Object.assign(Object.assign({},l),null==e?void 0:e._message),u)));if((null==u?void 0:u.action_id)&&(null==u?void 0:u.action_value)===ek){null==s||s(t);return}(null==u?void 0:u.action_id)&&(null==u?void 0:u.action_value)?(delete t.form_submit_meta,null==s||s(t)):i({title:"",message:n({id:"multiSelectError.required",defaultMessage:"There is no answer!"}),type:"warning"})}}))},FINAL_STANDARD:SubotInlineNodeFinal,FINAL:SubotInlineNodeFinal,FINAL_THANK_YOU:({node:e})=>{var t;let{params:n,onNext:i}=(0,h.useContext)(tj),l=(0,h.useMemo)(()=>{var t;let n=null===(t=null==e?void 0:e.actions)||void 0===t?void 0:t.find(({type:e})=>e===E.f.RESULT_BUTTON);return n||null},[null==e?void 0:e.actions]),o=(0,h.useCallback)(()=>{i&&i(Object.assign(Object.assign(Object.assign({},n),null==e?void 0:e._message),{action_id:null==l?void 0:l.id,action_value:null==l?void 0:l.key}))},[l]);return _().createElement(ny,null,_().createElement(nx,null,null===(t=null==e?void 0:e.intents)||void 0===t?void 0:t.map(e=>{let t=n_[null==e?void 0:e.type];return t&&_().createElement(t,{key:e.id,intent:e})}),l&&_().createElement(nE,{onClick:o},null==l?void 0:l.label)))},SSO:({node:e,indexNumber:t})=>{let n=(0,h.useRef)(!1),{params:i,onPrev:l,nodes:o,activeId:a,userInfo:r}=(0,h.useContext)(tj);(0,h.useEffect)(()=>{var t;let i=null===(t=null==e?void 0:e.actions)||void 0===t?void 0:t.find(e=>e.type===E.f.ACTION_SSO_REDIRECT);(null==r?void 0:r.id)&&i&&!n.current&&(n.current=!0,handleOnChange(i))},[null==r?void 0:r.id]);let{formatMessage:s}=(0,h.useContext)(k.T),handleOnChange=t=>{if(t&&t.type===E.f.ACTION_SSO_REDIRECT){let n={params:Object.assign(Object.assign(Object.assign({},i),null==e?void 0:e._message),{action_id:null==t?void 0:t.id,action_value:null==t?void 0:t.key,mode:"inline"}),listNodes:o,activeId:a,createdAt:new Date().getTime(),botId:i.bot_id};localStorage.setItem(eN,JSON.stringify(n));let l=(0,ev.g)(window.location.href,{botItem:o[0]});l.searchParams.set("bot_id",String(i.bot_id)),l.searchParams.set("mode","inline"),l.searchParams.set("source","subot-inline");let r=l.href;(0,ep.I)()?ep.u.getState().triggerLogin({returnUrl:r,source:"subot-inline"}):window.location.href=`${y.l}?returnUrl=${encodeURIComponent(r)}`}};return _().createElement(tY,null,_().createElement(nt,null),_().createElement(tW,null,_().createElement(tU,null,_().createElement(SubotInlineIntent,{intents:[...(null==e?void 0:e.intents)||[],...(0,M.s)(s)],indexNumber:t})),_().createElement(tD,null,_().createElement(SubotInlineAction,{actions:null==e?void 0:e.actions,onChange:handleOnChange}))),_().createElement(t9,{onBack:()=>l&&l(),backProps:{isDisabled:!(1!==t)},hideNext:!0}))},MULTIPLE:({node:e,indexNumber:t})=>{let{params:n,onChange:i,onPrev:l,onNext:o}=(0,h.useContext)(tj),{formatMessage:a,action:{pushNotifications:r}}=(0,h.useContext)(k.T),[s,d]=(0,h.useState)((null==e?void 0:e._message)||{}),c=(0,h.useMemo)(()=>{var t;let n=null===(t=null==e?void 0:e.actions)||void 0===t?void 0:t.find(({type:e})=>e==E.f.ACTION_MULTIPLE_BUTTON);return n||null},[null==e?void 0:e.actions]),u=(0,h.useMemo)(()=>(null==s?void 0:s.selected_actions)?Object.keys(null==s?void 0:s.selected_actions):[],[s,null==s?void 0:s.selected_actions]),validateSelectActions=(t,n)=>{let i=Object.keys(t);if(i.length){if((null==e?void 0:e.multi_select_option)===E.g.RANGE&&i.length<(null==e?void 0:e.from)){r({title:"",message:a({id:"multiSelectError.range",defaultMessage:"You must choose from {from} to {to} answers (Ex: You must choose from 3 to 5 answers)"},{from:e.from,to:e.to}),type:"warning"});return}if((null==e?void 0:e.multi_select_option)===E.g.EXACT_NUMBER&&i.length!==(null==e?void 0:e.from)){r({message:a({id:"multiSelectError.exactNumber",defaultMessage:"You must choose {from} answers."},{from:e.from}),type:"warning"});return}n()}else{r({title:"",message:a({id:"multiSelectError.required",defaultMessage:"There is no answer!"}),type:"warning"});return}},m=(0,h.useCallback)(()=>{validateSelectActions((null==s?void 0:s.selected_actions)||{},()=>{o&&o(Object.assign(Object.assign(Object.assign(Object.assign({},n),null==e?void 0:e._message),s),{node_id:e.id}))})},[s,null==s?void 0:s.selected_actions,o]);return _().createElement(tY,null,_().createElement(nt,null),_().createElement(tW,null,_().createElement(tU,null,_().createElement(SubotInlineIntent,{intents:(null==e?void 0:e.intents)||[],indexNumber:t})),_().createElement(tD,null,_().createElement(SubotInlineAction,{value:u,actions:null==e?void 0:e.actions,onChange:(e,t)=>(0,x._)(void 0,void 0,void 0,function*(){var n,l;if(e){let o=JSON.parse(JSON.stringify(Object.assign(Object.assign({},s),{action_id:null==c?void 0:c.id,action_value:null==c?void 0:c.key,selected_actions:Object.assign({},null==s?void 0:s.selected_actions)})));if((null==e?void 0:e.type)===E.f.POLL_CHOICE_TEXT_BY_INPUT||(null==e?void 0:e.type)===E.f.USER_CHOICE_TEXT_BY_INPUT){let l=(null==o?void 0:o.selected_actions)&&e.id in o.selected_actions;l?t?o.form_submit_meta=t:(delete o.form_submit_meta,null===(n=o.selected_actions)||void 0===n||delete n[e.id]):(null==e?void 0:e.id)&&(o.selected_actions=Object.assign(Object.assign({},o.selected_actions),{[e.id]:e.key||""})),d(o),null==i||i(o);return}if(!(null===(l=o.selected_actions)||void 0===l?void 0:l[e.id])){o.selected_actions=Object.assign(Object.assign({},o.selected_actions),{[e.id]:e.key||""}),i&&i(o),d(o);return}if(o.selected_actions[e.id]){delete o.selected_actions[e.id],i&&i(o),d(o);return}}}),htmlType:"checkbox",formSubmitMeta:null==s?void 0:s.form_submit_meta}))),_().createElement(t9,{onBack:()=>l&&l(),backProps:{isDisabled:!(1!==t)},nextText:c?null==c?void 0:c.label:"",onNext:m}))},POLL:({node:e,indexNumber:t})=>{var n,i;let{params:l,onChange:o,onPrev:a,onNext:r}=(0,h.useContext)(tj),[s,d]=(0,h.useState)((null==e?void 0:e._message)||{}),c=useValidationMultiOption(),u=useDescriptionPollNode({node:e}),m=(0,h.useMemo)(()=>{var t;let n=null===(t=null==e?void 0:e.actions)||void 0===t?void 0:t.find(({type:e})=>e==E.f.POLL_BUTTON);return n||null},[null==e?void 0:e.actions]),handleOnChange=(t,n)=>{var i,l,a,r,c,u,p;let v=JSON.parse(JSON.stringify(Object.assign(Object.assign({},s),{node_id:e.id,action_id:null==m?void 0:m.id,action_value:null==m?void 0:m.key,form_submit_meta:[...(null==s?void 0:s.form_submit_meta)||[]]})));if((null==t?void 0:t.type)===E.f.POLL_CHOICE_TEXT_BY_INPUT||(null==t?void 0:t.type)===E.f.USER_CHOICE_TEXT_BY_INPUT){let e=null===(i=v.form_submit_meta)||void 0===i?void 0:i.some(({action_id:e})=>e===t.id);e?v.form_submit_meta=void 0===n?null===(l=v.form_submit_meta)||void 0===l?void 0:l.filter(({action_id:e})=>e!==t.id):null===(a=v.form_submit_meta)||void 0===a?void 0:a.filter(({action_id:e})=>e!==t.id).concat(n):v.form_submit_meta=null===(r=v.form_submit_meta)||void 0===r?void 0:r.concat([{key:null==t?void 0:t.key,control:E.E[null==t?void 0:t.type]||"text",value:"",action_id:null==t?void 0:t.id}]),d(v),null==o||o(v);return}let g=null===(c=v.form_submit_meta)||void 0===c?void 0:c.some(({action_id:e})=>e===(null==t?void 0:t.action_id));g?v.form_submit_meta=null===(u=v.form_submit_meta)||void 0===u?void 0:u.filter(({action_id:e})=>e!==(null==t?void 0:t.action_id)):v.form_submit_meta=null===(p=v.form_submit_meta)||void 0===p?void 0:p.concat([t]),d(v),null==o||o(v)},p=(0,h.useMemo)(()=>(null==s?void 0:s.form_submit_meta)?null==s?void 0:s.form_submit_meta.map(({action_id:e})=>e):[],[s,null==s?void 0:s.form_submit_meta]);return _().createElement(tY,null,_().createElement(nt,null),_().createElement(tW,null,_().createElement(tU,null,_().createElement(SubotInlineIntent,{intents:(null==e?void 0:e.intents)||[],indexNumber:t})),_().createElement(tG,null,u),_().createElement(tD,null,(null==e?void 0:e.actions)&&!!(null===(n=e.actions)||void 0===n?void 0:n.length)&&_().createElement(t5,null,null===(i=null==e?void 0:e.actions.filter(({type:e})=>e!==E.f.POLL_BUTTON))||void 0===i?void 0:i.map(e=>{let t=t8[null==e?void 0:e.type];return t&&_().createElement(t,{key:e.id,active:p.includes(e.id),action:e,onChange:handleOnChange,htmlType:"checkbox",formSubmitMeta:null==s?void 0:s.form_submit_meta})})))),_().createElement(t9,{onBack:()=>a&&a(),backProps:{isDisabled:!(1!==t)},nextText:m?null==m?void 0:m.label:"",onNext:()=>{let t={};s.form_submit_meta&&s.form_submit_meta.length&&(t[e.id]=s.form_submit_meta.map(e=>e.action_id));let n=Object.assign(Object.assign({},s),{current_polls:t});c.validateSelectActions(p,e,()=>{r&&r(Object.assign(Object.assign(Object.assign({},l),null==e?void 0:e._message),n))})}}))},RATING:({node:e,indexNumber:t})=>{var n,i;let{formatMessage:l,action:{pushNotifications:o}}=(0,h.useContext)(k.T),{params:a,onChange:r,onSubmit:s,onPrev:d,onNext:c}=(0,h.useContext)(tj),[u,m]=(0,h.useState)((null==e?void 0:e._message)||{}),[p,v]=(0,h.useState)(!1),g=(0,h.useMemo)(()=>{var t;let n=null===(t=null==e?void 0:e.actions)||void 0===t?void 0:t.find(({type:e})=>e===E.f.RATING_STAR);if(u.form_submit_meta&&n){let e=null==u?void 0:u.form_submit_meta.findIndex(({action_id:e})=>e===(null==n?void 0:n.id));if(-1!==e)return parseInt(null==u?void 0:u.form_submit_meta[e].value)}return 0},[null==u?void 0:u.form_submit_meta]),b=(0,h.useMemo)(()=>{var t;let n=null===(t=null==e?void 0:e.actions)||void 0===t?void 0:t.find(({type:e})=>e==E.f.RATING_BUTTON);return n||null},[]),handleOnChange=t=>(0,x._)(void 0,void 0,void 0,function*(){if(t){let n=Object.assign(Object.assign(Object.assign({},a),u),{node_id:e.id,action_id:null==b?void 0:b.id,action_value:null==b?void 0:b.key,form_submit_meta:(null==u?void 0:u.form_submit_meta)?[...null==u?void 0:u.form_submit_meta]:[]}),i=[...null==n?void 0:n.form_submit_meta],l=i.findIndex(({action_id:e})=>e===t.action_id);-1!==l?i[l]=Object.assign({},t):i.push(t),n.form_submit_meta=[...i],m(n),r&&r(n)}});return _().createElement(tY,null,_().createElement(nt,null),_().createElement(tW,null,_().createElement(tU,null,_().createElement(SubotInlineIntent,{intents:(null==e?void 0:e.intents)||[],indexNumber:t})),_().createElement(tD,null,(null==e?void 0:e.actions)&&!!(null===(n=e.actions)||void 0===n?void 0:n.length)&&_().createElement(t5,null,null===(i=null==e?void 0:e.actions.filter(({type:e})=>e!==E.f.RATING_BUTTON))||void 0===i?void 0:i.map(e=>{var t;let n=t8[null==e?void 0:e.type];return n&&_().createElement(n,{key:e.id,action:e,onChange:handleOnChange,value:u&&(null==u?void 0:u.form_submit_meta)&&(null===(t=u.form_submit_meta)||void 0===t?void 0:t.find(({action_id:t})=>t===e.id))})})))),_().createElement(t9,{onBack:()=>d&&d(),backProps:{isDisabled:!(1!==t)},nextText:b?null==b?void 0:b.label:"",onNext:()=>(0,x._)(void 0,void 0,void 0,function*(){if(!u.form_submit_meta||0===g){o({title:"",message:l({id:"multiSelectError.required",defaultMessage:"There is no answer!"}),type:"warning"});return}if(p)c&&c(Object.assign(Object.assign(Object.assign({},a),u),null==e?void 0:e._message));else{let t=Object.assign(Object.assign(Object.assign({},a),null==e?void 0:e._message),u),n=yield subotInlineMessage(t);if((null==n?void 0:n._status)===1){let e=null==n?void 0:n._data,{node:i}=e,l=(0,x.a)(e,["node"]),o=Object.assign(Object.assign({},i),{_message:Object.assign(Object.assign({},l),{node_id:i.id})});s&&s(o,t),v(!0)}}})}))},REACTION:({node:e,indexNumber:t})=>{let{formatMessage:n,action:{pushNotifications:i}}=(0,h.useContext)(k.T),{params:l,onSubmit:o,onPrev:a,onNext:r}=(0,h.useContext)(tj),[s,d]=(0,h.useState)((null==e?void 0:e._message)||{});return _().createElement(tY,null,_().createElement(nt,null),_().createElement(tW,null,_().createElement(tU,null,_().createElement(SubotInlineIntent,{intents:(null==e?void 0:e.intents)||[],indexNumber:t})),_().createElement(tD,null,_().createElement(SubotInlineAction,{value:(null==s?void 0:s.action_id)?[null==s?void 0:s.action_id]:[],actions:(null==e?void 0:e.actions)||[],onChange:t=>(0,x._)(void 0,void 0,void 0,function*(){if(t){d(Object.assign(Object.assign({},s),{action_id:null==t?void 0:t.id,action_value:null==t?void 0:t.key}));let n=Object.assign(Object.assign(Object.assign({},l),s),{node_id:e.id,action_id:null==t?void 0:t.id,action_value:null==t?void 0:t.key}),i=yield subotInlineMessage(n);if((null==i?void 0:i._status)===1){let e=null==i?void 0:i._data,{node:t}=e,l=(0,x.a)(e,["node"]),a=Object.assign(Object.assign({},t),{_message:Object.assign(Object.assign({},l),{node_id:t.id})});o&&o(a,n)}}})}))),_().createElement(t9,{onBack:()=>a&&a(),backProps:{isDisabled:!(1!==t)},onNext:()=>{var t;(null==e?void 0:e._message)&&(null===(t=e._message)||void 0===t?void 0:t.action_id)?r&&r(Object.assign(Object.assign(Object.assign({},l),s),null==e?void 0:e._message)):i({title:"",message:n({id:"multiSelectError.required",defaultMessage:"There is no answer!"}),type:"warning"})}}))},REVIEW:({node:e,indexNumber:t})=>{let{formatMessage:n,action:{pushNotifications:i}}=(0,h.useContext)(k.T),{params:l,onChange:o,onSubmit:a,onPrev:r,onNext:s}=(0,h.useContext)(tj),[d,c]=(0,h.useState)((null==e?void 0:e._message)||{}),[u,m]=(0,h.useState)(!1),p=(0,h.useMemo)(()=>{var t;return(null===(t=null==e?void 0:e.actions)||void 0===t?void 0:t.filter(({type:e})=>e===E.f.REVIEW_CHOICE))||[]},[null==e?void 0:e.actions]),v=(0,h.useMemo)(()=>{var t;return(null===(t=null==e?void 0:e.actions)||void 0===t?void 0:t.filter(({type:e})=>e===E.f.REVIEW_DESCRIPTION))||[]},[null==e?void 0:e.actions]),g=(0,h.useMemo)(()=>{var t;let n=null===(t=null==e?void 0:e.actions)||void 0===t?void 0:t.find(({type:e})=>e==E.f.REVIEW_BUTTON);return n||null},[null==e?void 0:e.actions]),b=(0,h.useMemo)(()=>(null==d?void 0:d.form_submit_meta)?null==d?void 0:d.form_submit_meta.map(({action_id:e})=>e).filter(e=>!!(null==p?void 0:p.map(({id:e})=>e).includes(e))):[],[d,null==d?void 0:d.form_submit_meta]),handleOnClick=t=>{if(t){let n=Object.assign(Object.assign(Object.assign({},l),d),{node_id:e.id,action_id:null==g?void 0:g.id,action_value:null==g?void 0:g.key,form_submit_meta:(null==d?void 0:d.form_submit_meta)?[...null==d?void 0:d.form_submit_meta]:[]}),i=[...null==n?void 0:n.form_submit_meta],a=i.findIndex(({action_id:e})=>e===t.action_id);-1!==a?i=[...i.slice(0,a),...i.slice(a+1)]:i.push(t),n.form_submit_meta=[...i],c(n),m(!1),o&&o(n)}},handleOnChange=t=>{if(t){let n=Object.assign(Object.assign(Object.assign({},l),d),{node_id:e.id,action_id:null==g?void 0:g.id,action_value:null==g?void 0:g.key,form_submit_meta:(null==d?void 0:d.form_submit_meta)?[...null==d?void 0:d.form_submit_meta]:[]}),i=[...null==n?void 0:n.form_submit_meta],a=i.findIndex(({action_id:e})=>e===t.action_id);-1!==a?i[a]=Object.assign({},t):i.push(t),n.form_submit_meta=[...i],c(n),m(!1),o&&o(n)}};return _().createElement(tY,null,_().createElement(nt,null),_().createElement(tW,null,_().createElement(tU,null,_().createElement(SubotInlineIntent,{intents:(null==e?void 0:e.intents)||[],indexNumber:t})),_().createElement(tD,null,!!p.length&&_().createElement(tF,null,_().createElement(t5,{className:"review-container"},p.map(e=>{var t;let n=t8[null==e?void 0:e.type];return n&&_().createElement(n,{key:e.id,action:e,onChange:handleOnClick,active:d&&!!(null===(t=null==d?void 0:d.form_submit_meta)||void 0===t?void 0:t.find(({action_id:t})=>t===e.id))||!1})}))),!!(null==v?void 0:v.length)&&_().createElement(t5,null,v.map(e=>{var t;let n=t8[null==e?void 0:e.type];return n&&_().createElement(n,{key:e.id,action:e,onChange:handleOnChange,value:d&&(null==d?void 0:d.form_submit_meta)&&(null===(t=d.form_submit_meta)||void 0===t?void 0:t.find(({action_id:t})=>t===e.id))})})))),_().createElement(t9,{onBack:()=>r&&r(),backProps:{isDisabled:!(1!==t)},nextText:g?null==g?void 0:g.label:"",onNext:()=>(0,x._)(void 0,void 0,void 0,function*(){var t;if(!(null===(t=null==e?void 0:e._message)||void 0===t?void 0:t.form_submit_meta)||!b.length){i({title:"",message:n({id:"multiSelectError.required",defaultMessage:"There is no answer!"}),type:"warning"});return}if(u)s&&s(Object.assign(Object.assign(Object.assign({},l),d),null==e?void 0:e._message));else{let t=Object.assign(Object.assign(Object.assign({},l),null==e?void 0:e._message),d),n=yield subotInlineMessage(t);if((null==n?void 0:n._status)===1){let e=null==n?void 0:n._data,{node:i}=e,l=(0,x.a)(e,["node"]),o=Object.assign(Object.assign({},i),{_message:Object.assign(Object.assign({},l),{node_id:i.id})});a&&a(o,t),m(!0)}}})}))},RESULT_POLL:({node:e})=>{var t,n;return _().createElement(tY,null,_().createElement(nt,null),_().createElement(tW,null,_().createElement(tU,null,_().createElement(SubotInlineIntent,{intents:(null==e?void 0:e.intents)||[]})),_().createElement(tD,null,(null==e?void 0:e.actions)&&!!(null===(t=e.actions)||void 0===t?void 0:t.length)&&_().createElement(t5,null,null===(n=null==e?void 0:e.actions.filter(({type:e})=>e!==E.f.POLL_BUTTON))||void 0===n?void 0:n.map(t=>{let n=t8[null==t?void 0:t.type];return n&&_().createElement(n,{key:t.id,action:t,htmlType:"checkbox",node_type:null==e?void 0:e.type})})))))},OTP:({node:e,indexNumber:t})=>{let{params:n,onPrev:i,onNext:l}=(0,h.useContext)(tj),o=null===k.G||void 0===k.G?void 0:k.G.userInfo,a=null===k.G||void 0===k.G?void 0:k.G.locale,[r,s]=(0,h.useState)((null==e?void 0:e._message)||{}),d=useVerifyPhoneNumber();return _().createElement(tY,null,_().createElement(nt,null),_().createElement(tW,null,_().createElement(tU,null,_().createElement(SubotInlineIntent,{intents:(null==e?void 0:e.intents)||[],indexNumber:t})),_().createElement(tD,null,_().createElement(OTPInfoForm,{phoneNumber:null==o?void 0:o.phone,verified:d,areaCode:null==o?void 0:o.area_code,callBack:(t,i)=>{var o;let a=null===(o=null==e?void 0:e.actions)||void 0===o?void 0:o.find(({type:e})=>e===E.f.USER_SUBMIT_PHONE);if(!t||!a)return;let d=[{key:String(a.key),control:E.E[E.f.USER_SUBMIT_PHONE],value:i}],c=Object.assign(Object.assign({},r),{form_submit_meta:d,action_id:null==t?void 0:t.id,action_value:null==t?void 0:t.key});s(c),l&&l(Object.assign(Object.assign(Object.assign({},n),c),null==e?void 0:e._message))},actions:(null==e?void 0:e.actions)||[],countryCode:(null==a?void 0:a.split("-")[1])||"PH"}))),_().createElement(t9,{onBack:()=>i&&i(),backProps:{isDisabled:!(1!==t)},hideNext:!0}))}},nI=(0,F.A)(eu.B)` margin-top: 24px; ${G.M.mbUp} { margin-top: 16px; } `,nS=F.A.div` margin-top: 24px; `,nC=(0,F.A)(eh.T)` text-align: center; ${G.M.mbUp} { text-align: left; } `,nO=(0,F.A)(e_.H)` text-align: center; margin-bottom: 8px; ${G.M.mbUp} { margin-bottom: 0; text-align: left; } `,nk=F.A.div` background-color: #ffffff; border-radius: 50%; width: 120px; height: 120px; object-fit: contain; overflow: hidden; flex-shrink: 0; img { width: 100%; height: 100%; object-fit: cover; } `,nN=F.A.div` flex-grow: 1; ${G.M.tdDown} { width: 100%; margin-left: 0; } `,nT=F.A.div` position: relative; display: flex; gap: 24px; ${G.M.mbDown} { flex-wrap: wrap; justify-content: center; } `,nM=F.A.div` position: relative; overflow: hidden; background-color: ${Q.w.colors.primary50}; padding: 32px; border-radius: ${Q.w.borderRadius}; background-image: url('/images/subot-bg-transparent.png'); background-size: contain; background-repeat: repeat-y; ${G.M.mbDown} { padding: 24px; } `,SubotInlineNodeStart=({node:e,setLoading:t})=>{let n=(0,h.useRef)({impress:!1}),i=null===k.G||void 0===k.G?void 0:k.G.userInfo,{params:l,onNext:o,trackingCommonInline:a,isMobile:r}=(0,h.useContext)(tj),handleOnClick=(e=!0)=>()=>{if(e){let e={cookie_id:l.cookie_id,window_id:l.window_id,bot_id:l.bot_id,title_url:l.title_url,url:l.url,gtm_id:l.gtm_id,ga_client_id:l.ga_client_id,device_id:(0,M.h)(window.navigator.userAgent)?2:1,account_id:l.account_id||(null==i?void 0:i.id)||null};subotInlineClick(e)}o&&o()};return((0,h.useEffect)(()=>{let inViewport=(e,t,i={})=>{if(window.IntersectionObserver&&!n.current.impress){let n=new IntersectionObserver((e,n)=>{e.forEach(e=>t(e,n))},i);n.observe(e)}},eventScrollImpress=()=>{n.current.element&&inViewport(n.current.element,(o,a)=>{if(!o.isIntersecting){n.current.impress&&(n.current.impress=!1);return}!n.current.impress&&(n.current.impress=!0,n.current.debounce&&clearTimeout(n.current.debounce),(null==e?void 0:e.inline_start_button)||t(!0),n.current.debounce=setTimeout(()=>{let t={cookie_id:l.cookie_id,window_id:l.window_id,bot_id:l.bot_id,title_url:l.title_url,url:l.url,gtm_id:l.gtm_id,ga_client_id:l.ga_client_id,device_id:(0,M.h)(window.navigator.userAgent)?2:1,account_id:l.account_id||(null==i?void 0:i.id)||null};t&&subotInlineImpression(t),(null==e?void 0:e.inline_start_button)||handleOnClick(!1)()},400),n.current.element&&(null==a||a.unobserve(n.current.element)))},{rootMargin:"1000px"})};return eventScrollImpress(),window.addEventListener("scroll",eventScrollImpress,{passive:!0}),()=>window.removeEventListener("scroll",eventScrollImpress)},[o]),e)?_().createElement(nM,null,_().createElement(nT,{ref:e=>n.current.element=e},e.inline_image&&_().createElement(nk,null,_().createElement("img",{loading:"lazy",src:e.inline_image,alt:""})),_().createElement(nN,null,e.inline_title||e.inline_headline?_().createElement(nO,{tag:"h3",fontWeight:"bold",color:Q.w.colors.secondaryBase},_().createElement(Markdown,null,e.inline_title||e.inline_headline)):null,e.inline_review&&_().createElement(nC,{size:"s4",color:Q.w.colors.gray600,as:"div"},_().createElement(Markdown,null,e.inline_review)),e.inline_start_button&&_().createElement(nI,Object.assign({size:"md",isBlock:r,onClick:handleOnClick(!0),className:"pointer-event-child-none"},a,{"data-event-action":"Start"}),e.inline_start_button))),_().createElement(nS,null,_().createElement(Markdown,null,e.inline_description))):null},nA=F.A.div` position: absolute; z-index: 2; top: 0; right: 0; bottom: 0; left: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: ${Q.w.colors.gray800}; opacity: 0; pointer-events: none; &:before { position: absolute; z-index: -1; top: 0; right: 0; bottom: 0; left: 0; background-color: ${Q.w.colors.neutral50||"#F7F9FC"}; content: ''; opacity: 1; } ${({isLoading:e})=>e&&" opacity: 1; pointer-events: auto; "}; `,n$=F.A.div` position: relative; z-index: 1; line-height: 1.5; transition: 0.25s all linear; margin-block: 16px; content-visibility: auto; contain-intrinsic-size: 500px; &.hhg-subot-style { min-height: 100px; } ${G.M.mbDown} { margin-right: -1rem; margin-left: -1rem; } `,SubotInline=({id:e,isMobile:t,articleLink:n,customUrl:i})=>{let l=useCurrentUrl(),o=(0,h.useRef)(null),a=(0,h.useRef)(null),[r,s]=(0,h.useState)(!0),[d,c]=(0,h.useState)({activeId:"",params:{},nodes:[],getParams:()=>({})}),u=null===k.G||void 0===k.G?void 0:k.G.userInfo,m=(0,h.useMemo)(()=>d.nodes.find(e=>e.id==d.activeId),[d.nodes,d.activeId]),p=(0,h.useMemo)(()=>({"data-event-category":"Subot","data-event-label":l,"data-bot-id":d.params.bot_id,"data-bot-type":"Inline","data-question-id":"string"==typeof(null==m?void 0:m.id)?null==m?void 0:m.id:null}),[m,l,d.params.bot_id]),v=(0,h.useCallback)(()=>{var t,l,o,a;let r=window.gaData,s=(i||window.location.origin+y.b)+("tl-PH"===k.G.locale?n.replace("fil/",""):n),d={bot_id:e,account_id:(null===(t=(0,M.e)())||void 0===t?void 0:t.id)||null,action_id:"",action_value:"",cookie_id:(0,M.d)(null===(o=null===(l=null===k.G||void 0===k.G?void 0:k.G.router)||void 0===l?void 0:l.query)||void 0===o?void 0:o.cookie_id),current_score:0,current_keys:[],current_selected:[],form_submit_meta:[],gtm_id:r?Object.keys(r)[0]:"",ga_client_id:w.A.get("_ga")||"",is_new:!1,mode:"inline",node_id:"",selected_actions:{},title_url:document.title||"",url:s.replace("http://localhost","https://discover.hellobacsi.com").replace("dev.","discover."),window_id:(0,M.f)()};return(0,M.o)(d,null===(a=null===k.G||void 0===k.G?void 0:k.G.router)||void 0===a?void 0:a.query)},[]),elementScrollIntoView=()=>{a.current&&a.current.scrollIntoView({behavior:"smooth",block:"start",inline:"start"})},onSubmit=(e,t)=>(0,x._)(void 0,void 0,void 0,function*(){let n=Object.assign(Object.assign({},d),{nodes:[...d.nodes]});if(t&&(null==t?void 0:t.node_id)){let e=n.nodes.findIndex(({id:e})=>e==t.node_id);-1!==e&&(n.nodes[e]._message=Object.assign(Object.assign({},n.nodes[e]._message),t),n.nodes=[...n.nodes.slice(0,e+1)])}if(s(!0),e){let t=n.nodes.findIndex(({id:t})=>t==(null==e?void 0:e.id));if(-1===t)n.nodes=[...n.nodes,Object.assign({},e)];else{let i=Object.assign(Object.assign(Object.assign({},n.nodes[t]),e),{_message:Object.assign(Object.assign({},n.nodes[t]._message),null==e?void 0:e._message)});n.nodes=[...n.nodes.slice(0,t),Object.assign({},i),...n.nodes.slice(t+1)]}n.activeId=e.id}setTimeout(()=>{c(n),s(!1),n.activeId&&saveSubotInlineLogs({nodes:n.nodes,activeId:n.activeId,params:n.params,accountIdFromLogs:o.current})},250),elementScrollIntoView()}),getFirstAPI=e=>(0,x._)(void 0,void 0,void 0,function*(){var t;if((null==e?void 0:e.url)&&(null==e?void 0:e.bot_id)){let n="",i=[];s(!0);let l=yield subotInlineFirstNode(e.bot_id);(null==l?void 0:l._status)===1&&(n=null==l?void 0:l._data.id.toString(),i.push(null==l?void 0:l._data,null==l?void 0:l._data.first_node));let a=yield getSubotInlineLogs(i[0]);if(a){let e=a.nodes[a.nodes.length-1],l=[E.d.FINAL,E.d.FINAL_THANK_YOU,E.d.FINAL_STANDARD].includes(e.type);l||(i=a.nodes,n=a.activeId,o.current=(null===(t=a.params)||void 0===t?void 0:t.account_id)||0)}let r=getPreviousStateFromStorage(e.bot_id,{getParams:v});if(r&&r.params.action_id&&r.params.action_value){let e=yield subotInlineMessage(r.params);(null==e?void 0:e._status)===1&&(null==e?void 0:e._data.node)&&(n=null==e?void 0:e._data.node.id,(i=r.listNodes)[i.length-1]=null==e?void 0:e._data.node,saveSubotInlineLogs({nodes:i,activeId:n,params:r.params,accountIdFromLogs:o.current}),setTimeout(()=>{elementScrollIntoView()},100))}let u=(null==r?void 0:r.params)||(null==a?void 0:a.params)||e,m=Object.assign(Object.assign({},d),{params:u,activeId:n,nodes:i});s(!1),c(m)}});return((0,h.useEffect)(()=>{var e;if(null===(e=null==d?void 0:d.nodes)||void 0===e?void 0:e.length)return console.log("Subot Already Loaded"),()=>void 0;if(w.A.get(y.G)){let e=v();getFirstAPI(e)}else(0,M.c)({condition:()=>!!w.A.get(y.G),finished:()=>{let e=v();getFirstAPI(e)}})},[]),d.nodes.length&&!d.nodes[0].inline_active)?null:_().createElement(tj.Provider,{value:Object.assign(Object.assign({},d),{isMobile:t,getParams:v,onChange:e=>{c(t=>{var n;if(e&&(null==e?void 0:e.node_id)&&(null==e?void 0:e.node_id)==(null==t?void 0:t.activeId)){let i=t.nodes.findIndex(({id:e})=>e==(null==t?void 0:t.activeId));if(-1!==i){let l=Object.assign(Object.assign({},t.nodes[i]),{_message:Object.assign(Object.assign({},null===(n=t.nodes[i])||void 0===n?void 0:n._message),e)});t.nodes[i]=l}}return Object.assign({},t)})},onSubmit,onPrev:()=>{var e;let t=Object.assign({},d),n=null===(e=null==t?void 0:t.nodes)||void 0===e?void 0:e.findIndex(({id:e})=>e==(null==t?void 0:t.activeId));if(n&&-1!==n&&n>1){let e=t.nodes[n-1];e&&(t.activeId=e.id)}elementScrollIntoView(),c(Object.assign({},t)),t.activeId&&saveSubotInlineLogs({nodes:t.nodes,activeId:t.activeId,params:t.params,accountIdFromLogs:o.current})},onNext:e=>(0,x._)(void 0,void 0,void 0,function*(){if(e&&(null==e?void 0:e.node_id)){let t=Object.assign(Object.assign({},e),getCurrentTotalDynamicScore(d.nodes,d.activeId,e.action_id)),n=yield subotInlineMessage(t);if(s(!1),(null==n?void 0:n._status)===1){let t=null==n?void 0:n._data,{node:i}=t,l=(0,x.a)(t,["node"]),o=Object.assign(Object.assign({},i),{_message:Object.assign(Object.assign({},l),{node_id:i.id})}),a=d.nodes.findIndex(({id:e})=>e===o.id);-1!==a?onSubmit(o):onSubmit(o,e);return}}let t=d.nodes.find(({id:e})=>e==(null==d?void 0:d.activeId));t&&!t.hasOwnProperty("type")&&(s(!0),d.nodes[0].id==(null==d?void 0:d.activeId)&&setTimeout(()=>{c(Object.assign(Object.assign({},d),{activeId:d.nodes[1].id.toString()})),s(!1),saveSubotInlineLogs({nodes:d.nodes,activeId:d.nodes[1].id.toString(),params:v(),accountIdFromLogs:o.current})},250))}),onReset:()=>{s(!0),c(e=>(e.nodes=e.nodes.slice(0,2),e.nodes[1]=Object.assign(Object.assign({},e.nodes[1]),{_message:void 0}),e.activeId=e.nodes[0].id.toString(),Object.assign({},e))),setTimeout(()=>{s(!1)},250),elementScrollIntoView()},trackingCommonInline:p,userInfo:u})},_().createElement(n$,{className:j()("hhg-subot",`hhg-subot-${e}`,!!d.nodes.length&&"hhg-subot-style")},!!d.nodes.length&&_().createElement(_().Fragment,null,_().createElement("div",{ref:a,className:"hhg-flag",style:{position:"absolute",top:-150,left:0,pointerEvents:"none"}}),_().createElement(nA,{isLoading:!!r},_().createElement(U.L,null),"Verifying..."),d.nodes.map((e,t)=>{if(e.id.toString()===(null==d?void 0:d.activeId)){if(!e.hasOwnProperty("type"))return _().createElement(SubotInlineNodeStart,{key:t.toString(),node:e,setLoading:s});{let n;return n=(null==e?void 0:e.position)===E.c.SSO?nw[E.c[null==e?void 0:e.position].valueOf()]:nw[E.d[null==e?void 0:e.type].valueOf()],e.is_multi_select&&e.type!==E.d.POLL&&(n=nw.MULTIPLE),n&&_().createElement(n,{key:t.toString(),indexNumber:t,node:e})}}return null}))))};var nP=Object.freeze({__proto__:null,default:ContainerWithProvider,SubotInlineRevampWithTheme:SubotInlineRevampWithTheme,UserInfoForm:UserInfoForm,Markdown:Markdown,hexRgb:hexRgb,SubotInlineVoucherLeftUI:SubotInlineVoucherLeftUI,SubotInline:SubotInline,overrideParamsByQuery:M.o,ssoIntents:M.s,checkUntilFinished:M.c,getHhgIdFromCookie:M.l,getSubotCookieId:M.d,getUserIdFromCookie:M.b,getUserInfoFromCookie:M.e,getWindowId:M.f,getHelloSitesUrl:M.g,checkMobile:M.h,clickAndOpenInNewTab:M.i,TIME_RESET_RESEND_OTP:M.T,isFakeEmail:M.k,formatUrlWithEncrypedGa:M.j,getSubotApiPath:getSubotApiPath,subotInlineMessage:subotInlineMessage$1,computeExtraSettingsForBot:computeExtraSettingsForBot$1,subotInlineFirstNode:subotInlineFirstNode$1,subotInlineClick:subotInlineClick$1,subotInlineImpression:subotInlineImpression$1,PATHS:ex,getPreviousStateFromStorage:getPreviousStateFromStorage,getSubotInlineLogs:getSubotInlineLogs,extractUnifiedAnswers:extractUnifiedAnswers,extractVoucherAnswers:extractVoucherAnswers,saveSubotInlineLogs:saveSubotInlineLogs,getColorWithOpacity:getColorWithOpacity,detectToSkipNodeStart:detectToSkipNodeStart,KEY_OF_TEXT_CHOICE_WITH_OTHER_FIELD:ek,SubotInlineIntentBaseTarget:e6,SubotInlineIntentBase:e5,checkSyncDataOnFrisoCampaign:checkSyncDataOnFrisoCampaign,handleFrisoRedirecition:handleFrisoRedirecition,getDynamicScore:getDynamicScore,getCurrentTotalDynamicScore:getCurrentTotalDynamicScore,replaceTextWithVariables:replaceTextWithVariables})}}]);