(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2273],{76804:function(e,t,i){"use strict";i.r(t),i.d(t,{TIME_RESET_RESEND_OTP:function(){return g.T},checkMobile:function(){return g.f},checkUntilFinished:function(){return g.e},clickAndOpenInNewTab:function(){return g.h},formatUrlWithEncrypedGa:function(){return g.i},getHelloSitesUrl:function(){return g.g},getHhgIdFromCookie:function(){return g.k},getSubotCookieId:function(){return g.b},getUserIdFromCookie:function(){return g.a},getUserInfoFromCookie:function(){return g.c},getWindowId:function(){return g.d},isFakeEmail:function(){return g.j},overrideParamsByQuery:function(){return g.o},ssoIntents:function(){return g.s},KEY_OF_TEXT_CHOICE_WITH_OTHER_FIELD:function(){return _e},Markdown:function(){return tt},PATHS:function(){return re},SubotInline:function(){return ul},SubotInlineIntentBase:function(){return $t},SubotInlineIntentBaseTarget:function(){return At},SubotInlineRevampWithTheme:function(){return wn},SubotInlineVoucherLeftUI:function(){return rt},UserInfoForm:function(){return Li},checkSyncDataOnFrisoCampaign:function(){return bt},computeExtraSettingsForBot:function(){return ue},default:function(){return xn},detectToSkipNodeStart:function(){return Me},extractUnifiedAnswers:function(){return Se},extractVoucherAnswers:function(){return ke},getColorWithOpacity:function(){return Ce},getCurrentTotalDynamicScore:function(){return fe},getDynamicScore:function(){return be},getPreviousStateFromStorage:function(){return Ne},getSubotApiPath:function(){return de},getSubotInlineLogs:function(){return Oe},handleFrisoRedirecition:function(){return ft},hexRgb:function(){return we},replaceTextWithVariables:function(){return he},saveSubotInlineLogs:function(){return Te},subotInlineClick:function(){return ve},subotInlineFirstNode:function(){return me},subotInlineImpression:function(){return pe},subotInlineMessage:function(){return ce}});var n=i(67294),o=i(81588),l=i(22470),a=i(74533),r=i(60305),s=i(4149),d=i.n(s),c=i(71409),u=i.n(c),m=i(47440),v=i(47856),p=i.n(v),g=i(56794),b=i(90411),f=i.n(b),h=i(78577),_=i(94184),E=i.n(_),y=i(49678),x=i(75009),w=i(8971),N=i(93867),O=i(36308),I=i(32763),S=i(89927),k=i(95954),T=i(89370),C=i(91938),M=i(43077),B=i(43125),j=i(83917),P=i.n(j),R=i(26775),L=i(32886),U=i(83129),A=i(10917),$=i(65900),D=i(67128),F=i(41609),G=i.n(F),H=i(32439),z=i(18750),Z=i(37054),q=i(82159),V=i(78156),Y=i(86315),W=i(73999),X=i(57849),J=i(7974),K=i(43568),Q=i(22046),ee=i(8981),te=i(39503),ie=i(56430),ne=i(22398),oe=i(94044),le=(i(31304),i(34155));const ae=d().extend(u()),re={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}"},se={cached:{},clearCached:e=>{console.log(se.cached),Object.keys(se.cached).filter((t=>t.startsWith(e))).forEach((e=>{console.log(e),se.cached[e]=void 0}))},withCached:(e,t)=>(0,l.a)(void 0,void 0,void 0,(function*(){if("waitingTheFirstResponse"===se.cached[e])return new Promise((t=>{const i=(new Date).getTime(),n=setInterval((()=>{(new Date).getTime()-i>3e3&&clearInterval(n),"object"===typeof se.cached[e]&&(t(se.cached[e]),clearInterval(n))}),100)}));if("object"===typeof se.cached[e])return se.cached[e];se.cached[e]="waitingTheFirstResponse";try{const i=yield t();return se.cached[e]=i,setTimeout((()=>{se.cached[e]=void 0}),18e5),i}catch(i){return se.cached[e]=void 0,Promise.reject(i)}}))},de=(e,t)=>{const{subotApiUrl:i}=null===m.G||void 0===m.G?void 0:m.G.env;return(i.endsWith("frontend/api/")?i:i+"frontend/api/")+p()(e,Object.assign({},t))},ce=e=>(0,l.a)(void 0,void 0,void 0,(function*(){try{return yield(0,m.c)(de(re.GET_INLINE_MESSAGE),"POST",{data:e})}catch(t){}})),ue=e=>{var t;if(1===(null===e||void 0===e?void 0:e._status)&&(null===(t=null===e||void 0===e?void 0:e._data)||void 0===t?void 0:t.extra_settings))try{const t=JSON.parse(e._data.extra_settings);e._data.extra_settings="object"===typeof t?t:{sync_data_friso_campaign:!1}}catch(i){e._data.extra_settings={sync_data_friso_campaign:!1}}return e},me=e=>(0,l.a)(void 0,void 0,void 0,(function*(){try{return yield se.withCached("SubotInlineFirstNode/"+e,(()=>(0,l.a)(void 0,void 0,void 0,(function*(){const t=yield(0,m.c)(de(re.GET_INLINE_FIRST_NODE)+`/${e}`,"GET");return ue(t),t}))))}catch(t){return null}})),ve=e=>(0,l.a)(void 0,void 0,void 0,(function*(){try{return yield(0,m.c)(de(re.GET_INLINE_CLICK),"POST",{data:e})}catch(t){}})),pe=e=>(0,l.a)(void 0,void 0,void 0,(function*(){try{return yield(0,m.c)(de(re.GET_INLINE_IMPRESSION),"POST",{data:e})}catch(t){}})),ge=e=>{const t=f()(e),i=f()();return{birthDate:t,today:i,age:i.diff(t,"year")}},be=e=>{try{return e.dynamic_score||{}}catch(t){return{}}},fe=(e,t,i,n)=>{const l=be(e[0]);if(!t)return{};const a=e.findIndex((e=>e.id==t));return{current_total_dynamic_score:e.reduce(((e,r,s)=>{var d,c;if(s>a)return e;const u=r,m=i&&u.id===t?{action_id:i}:u._message;let v=0;const p=null===(d=u.actions)||void 0===d?void 0:d.find((e=>e.id===(null===m||void 0===m?void 0:m.action_id)));v+=(null===p||void 0===p?void 0:p.score)||0;const g="undefined"!==typeof l[u.id],b=i&&u.id===t?n:null===m||void 0===m?void 0:m.form_submit_meta;if(g&&u.type===o.d.FORM&&b){const e=l[u.id].action_ids.map((e=>e.id)),t=l[u.id].action_ids.map((e=>e.variableName)),i=l[u.id].formula,n=null===(c=u.actions)||void 0===c?void 0:c.filter((t=>e.includes(t.id))),a=b.filter((e=>n.find((t=>t.key===e.key))&&(e.control===o.E[o.f.USER_SUBMIT_NUMBER]||e.control===o.E[o.f.USER_SUBMIT_DOB]))),r=t.map(((t,i)=>{const l=e[i],r=n.find((e=>e.id===l)),s=a.find((e=>(null===r||void 0===r?void 0:r.key)===e.key&&(e.control===o.E[o.f.USER_SUBMIT_NUMBER]||e.control===o.E[o.f.USER_SUBMIT_DOB])));if(!s)return"";if(s.control===o.E[o.f.USER_SUBMIT_DOB]){const{age:e}=ge(f()(s.value).toDate());return`var ${t} = ${e};`}return`var ${t} = ${s.value};`})).join("");try{const e=new Function(`${r} return ${i}`)();isNaN(e)||(v+=Math.round(e))}catch(h){}}return e+v}),0)}},he=(e,t)=>{const i=be(t[0]);try{const n=t.filter((e=>e.type===o.d.FORM));Object.keys(i).forEach((t=>{var l,a,r;const s=n.find((e=>e.id===t)),d=i[t].action_ids.map((e=>e.id)),c=i[t].action_ids.map((e=>e.variableName)),u=i[t].formula,m=null===(l=null===s||void 0===s?void 0:s.actions)||void 0===l?void 0:l.filter((e=>d.includes(e.id))),v=null===(r=null===(a=null===s||void 0===s?void 0:s._message)||void 0===a?void 0:a.form_submit_meta)||void 0===r?void 0:r.filter((e=>m.find((t=>t.key===e.key))&&(e.control===o.E[o.f.USER_SUBMIT_NUMBER]||e.control===o.E[o.f.USER_SUBMIT_DOB])));if(i[t].formula&&i[t].formula_result_name&&(null===v||void 0===v?void 0:v.length)){const n=c.map(((e,t)=>{const i=d[t],n=m.find((e=>e.id===i)),l=v.find((e=>(null===n||void 0===n?void 0:n.key)===e.key&&(e.control===o.E[o.f.USER_SUBMIT_NUMBER]||e.control===o.E[o.f.USER_SUBMIT_DOB])));return l?`var ${e} = ${l.value};`:""})).join(""),l=new Function(`${n} return ${u}`)(),a=i[t].formula_result_name;if(!isNaN(l)&&e.includes(`{{var:${a}}}`)){const t=new RegExp(`{{var:${a}}}`,"g");e=e.replace(t,String(Math.floor(100*l)/100))}}})),n.map((t=>{var i,n;null===(n=null===(i=t._message)||void 0===i?void 0:i.form_submit_meta)||void 0===n||n.map((t=>{const i=t.key,n=t.value,o=new RegExp(`{{var:${i}}}`,"g");e=e.replace(o,n)}))}))}catch(n){console.log("[replaceTextWithVariables]",n)}return e},_e="other",Ee="stateInlineSSO",ye=new RegExp("[^#a-f\\d]","gi"),xe=new RegExp("^#?[a-f\\d]{3}[a-f\\d]?$|^#?[a-f\\d]{6}([a-f\\d]{2})?$","i");function we(e,t){if("string"!==typeof e||ye.test(e)||!xe.test(e))throw new TypeError("Expected a valid hex string");let i=1;8===(e=e.replace(/^#/,"")).length&&(i=Number.parseInt(e.slice(6,8),16)/255,e=e.slice(0,6)),4===e.length&&(i=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]);const n=Number.parseInt(e,16);return[n>>16,n>>8&255,255&n,"number"===typeof t.alpha?t.alpha:i]}const Ne=(e,{getParams:t})=>{try{if(!(0,g.a)())return null;const i=JSON.parse(localStorage.getItem(Ee)||""),n=18e5;if((null===i||void 0===i?void 0:i.botId)===e&&i.listNodes&&i.activeId&&i.createdAt+n>Date.now()){localStorage.removeItem(Ee);if(i.listNodes.slice(-1)[0].position===o.c.SSO)return{listNodes:i.listNodes,activeId:i.activeId,params:Object.assign(Object.assign(Object.assign({},t()),i.params),{account_id:(0,g.a)()||null,cookie_id:(0,g.b)(i.params.cookie_id)})}}return null}catch(i){return null}},Oe=e=>(0,l.a)(void 0,void 0,void 0,(function*(){var t,i;try{if(!e)return null;const n=yield(0,m.c)(de(re.GET_SUBOT_LOG,{botId:e.id,cookieId:(0,g.b)(),accountId:(0,g.a)()||"",type:"inline"}),"GET");if(!(null===(t=null===n||void 0===n?void 0:n._data)||void 0===t?void 0:t.data)||"inline"!==(null===(i=null===n||void 0===n?void 0:n._data)||void 0===i?void 0:i.type))return null;const o=JSON.parse(n._data.data),l=o.nodes,a="in_progress"===n._data.status,r="complete"===n._data.status;return a||r?{nodes:[e,...l],activeId:o.activeId,params:Object.assign(Object.assign({},o.params),{account_id:(0,g.a)()||o.params.account_id||null})}:null}catch(n){return null}})),Ie=()=>{try{const e=window.next.router.components["/[...slug]"].props.pageProps;return"services-connection"===e.template?{project_id:"care-path",user_funnel:e.spotlight.additionalSlugActive||"",audience_name:e.spotlight.groupIdActive||""}:{}}catch(e){return{}}},Se=e=>e.filter((e=>"Unified Questions"===e.name)).reduce(((e,t)=>{var i,n,l,a,r,s,d,c,u,m,v,p,g,b,f,h,_,E,y,x,w;if(t.actions&&(null===(i=t._message)||void 0===i?void 0:i.action_id)&&(null===(n=t._message)||void 0===n?void 0:n.action_value)){const i=t._message.action_value;if(t.type===o.d.FORM){const i=["address","province","district","commune"],n=((null===(l=t._message)||void 0===l?void 0:l.form_submit_meta)||[]).filter((e=>!i.includes(e.control))),o=((null===(a=t._message)||void 0===a?void 0:a.form_submit_meta)||[]).filter((e=>i.includes(e.control))).reduce(((e,t)=>(e[t.control]=t,e)),{}),v=[null===(r=o.address)||void 0===r?void 0:r.value,null===(s=o.commune)||void 0===s?void 0:s.value,null===(d=o.district)||void 0===d?void 0:d.value,null===(c=o.province)||void 0===c?void 0:c.value].filter(Boolean).join(", ");v&&o.address?e.push({attribute:o.address.key,value:v,label_question:(null===(m=null===(u=t.intents)||void 0===u?void 0:u[0])||void 0===m?void 0:m.label)||""}):n.forEach((i=>{var n,o;e.push({attribute:i.key,value:i.value,label_question:(null===(o=null===(n=t.intents)||void 0===n?void 0:n[0])||void 0===o?void 0:o.label)||""})}))}if(t.type===o.d.TEXT)if(t.is_multi_select){const i=Object.keys(t._message.selected_actions||{}),n=t.actions.filter((e=>e.label&&i.includes(e.id))).map((e=>e.label));i.length&&e.push({attribute:t.actions[0].key||"",value:n,label_question:(null===(p=null===(v=t.intents)||void 0===v?void 0:v[0])||void 0===p?void 0:p.label)||""})}else{const n=t._message.action_id,l=t.actions.find((e=>e.id===n)),a=null===l||void 0===l?void 0:l.label,r=null===(f=null===(b=null===(g=t._message)||void 0===g?void 0:g.form_submit_meta)||void 0===b?void 0:b.find((e=>e.key===_e)))||void 0===f?void 0:f.value,s=(null===l||void 0===l?void 0:l.type)===o.f.USER_CHOICE_TEXT_BY_INPUT;a&&n&&e.push({attribute:i,value:s&&r?r:a,label_question:(null===(_=null===(h=t.intents)||void 0===h?void 0:h[0])||void 0===_?void 0:_.label)||""})}if(t.type===o.d.POLL){const i=t.id,n=(null===(y=null===(E=t._message)||void 0===E?void 0:E.current_polls)||void 0===y?void 0:y[i])||[],o=t.actions.filter((e=>e.label&&n.includes(e.id))).map((e=>e.label));n.length&&e.push({attribute:t.actions[0].key||"",value:o,label_question:(null===(w=null===(x=t.intents)||void 0===x?void 0:x[0])||void 0===w?void 0:w.label)||""})}}return e}),[]),ke=(e,t)=>{var i;try{if("ACUVUE"!==(null===(i=t.extra_settings)||void 0===i?void 0:i.subot_type))return;let n="",l="",a="",r="",s="";const d={};let c=(0,g.c)().email;if((e||[]).forEach((e=>{var t,i,u,m,v,p,g,b;const f=e._message;if(!f)return;const h=null===(t=e.actions)||void 0===t?void 0:t.find((e=>e.id===f.action_id));if("voucher_product"===f.action_value?n=(null===h||void 0===h?void 0:h.label)||"":"voucher_color"===f.action_value&&(l=(null===h||void 0===h?void 0:h.label)||""),e.type===o.d.FORM){const e=e=>t=>t.key===e,t=null===(i=f.form_submit_meta)||void 0===i?void 0:i.find(e("voucher_size")),o=null===(u=f.form_submit_meta)||void 0===u?void 0:u.find(e("voucher_location")),h=null===(m=f.form_submit_meta)||void 0===m?void 0:m.find(e("voucher_product")),_=null===(v=f.form_submit_meta)||void 0===v?void 0:v.find(e("voucher_color")),E=null===(p=f.form_submit_meta)||void 0===p?void 0:p.find((e=>"email"===e.control)),y=null===(g=f.form_submit_meta)||void 0===g?void 0:g.find((e=>"tel"===e.control));t&&(a=t.value),o&&(r=o.value),h&&(n=h.value),_&&(l=_.value),E&&(c=E.value),y&&(s=y.value),null===(b=f.form_submit_meta)||void 0===b||b.filter((e=>!["voucher_size","voucher_location","voucher_product","voucher_color","email","tel"].includes(e.control))).forEach((e=>{d[e.key]=e.value}))}})),c)return Object.assign(Object.assign({},d),{email:c,voucherName:"ACUVUE\xae OASYS (1-DAY) WITH HYDRALUXE\xae"===n?n:n&&l&&a?`${n}|${l}|${a}`:"N/A",voucher_product:n||"N/A",voucher_location:r,voucher_size:a||"N/A",voucher_color:l||"N/A",phone:s})}catch(n){console.log("ExtractVoucherAnswer",n)}},Te=({nodes:e,activeId:t,params:i,accountIdFromLogs:n})=>(0,l.a)(void 0,void 0,void 0,(function*(){try{let l="in_progress";const a=e[e.length-1];(null===a||void 0===a?void 0:a.type)&&o.e.includes(a.type)&&(l="complete");const r=e.slice(1),s={activeId:t,params:i,nodes:r,tracking:Object.assign(Object.assign({},Ie()),{full_url:window.location.href}),unifiedAnswers:Se(r),voucherAnswers:ke(r,e[0])};console.log("data.voucherAnswers",s.voucherAnswers);const d={cookie_id:(0,g.b)(),account_id:n||(0,g.a)()||null,bot_id:e[0].id,flow_uuid:e[0].flow_uuid,data:JSON.stringify(s),status:l,type:"inline",market:h.f[m.u]};yield(0,m.c)(de(re.POST_SUBOT_CREATE_LOG),"POST",{data:d})}catch(l){}})),Ce=(e,t)=>{try{const[i,n,o]=we(e,{format:"array"});return`rgba(${i}, ${n}, ${o}, ${t})`}catch(i){return}},Me=(e,t,i)=>{if(!(null===e||void 0===e?void 0:e.subot_field_type))return[t,i];const n=i.find((e=>e.id==t));return n&&n.hasOwnProperty("first_node")&&i.length>1?[i[1].id,i]:[t,i]},Be=(0,n.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}),je=({children:e,articleLink:t,subotId:i,isFullContainer:o,bgColor:s,primaryColor:d,textColor:c,textButtonColor:u,bgContentColor:v,bgImgFullContainer:p,isDisabledAnimationOnMobile:b,onCloseMobile:f,userInfo:h,typeFormProps:_,customUrl:E,isMobile:y,locale:x})=>{const{formatMessage:w,action:{pushNotifications:N}}=(0,n.useContext)(m.T),O=(0,n.useRef)(null),I=(0,n.useRef)(null),[S,k]=(0,n.useState)(!0),[T,C]=(0,n.useState)(""),[M,B]=(0,n.useState)([]),[j,P]=(0,n.useState)(!1),[R,L]=(0,n.useState)({});(0,n.useEffect)((()=>{const e=s||"#e3f2ff",t=d||"#2d87f3",i=(new Date).getTime(),n=setInterval((()=>{const o=O.current,l=(new Date).getTime();o&&(ae.mutate((()=>{o.style.setProperty("--subot-inline-bg-color",e),o.style.setProperty("--subot-inline-primary-color",t),o.style.setProperty("--subot-inline-primary-color-hover",Ce(t,.9)||t),o.style.setProperty("--subot-inline-primary-color-100",Ce(t,.1)||"#e3f2ff"),o.style.setProperty("--subot-inline-primary-color-300",Ce(t,.3)||"#bcdeff"),c&&o.style.setProperty("--subot-inline-text-color",c),u&&o.style.setProperty("--subot-inline-text-button-color",u),v&&o.style.setProperty("--subot-inline-bg-content-color",v)})),clearInterval(n)),l-i>18e4&&clearInterval(n)}),100);return()=>{clearInterval(n)}}),[s,d,c,u,v]);const U=(0,n.useCallback)((()=>{const e=window.gaData,n=(E||window.location.origin+a.b)+("tl-PH"===(null===m.G||void 0===m.G?void 0:m.G.locale)?t.replace("fil/",""):t),o={bot_id:i,account_id:(0,g.a)()||null,action_id:"",action_value:"",cookie_id:(0,g.b)(),current_score:0,current_keys:[],current_selected:[],form_submit_meta:[],gtm_id:e?Object.keys(e)[0]:"",ga_client_id:r.Z.get("_ga")||"",is_new:!1,mode:"inline",node_id:"",selected_actions:{},title_url:document.title||"",url:n.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,g.d)()};return(0,g.o)(o,null===m.G||void 0===m.G?void 0:m.G.router.query)}),[]),A=(0,n.useCallback)((()=>{var e;null===(e=O.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"start",inline:"center"})}),[]),$=(0,n.useCallback)(((e,t=!0)=>(0,l.a)(void 0,void 0,void 0,(function*(){var i;if(!e||!e.url||!e.bot_id)return;let n="",o=[];k(!0);const l=yield me(e.bot_id);1===(null===l||void 0===l?void 0:l._status)&&(n=null===l||void 0===l?void 0:l._data.id.toString(),o.push(null===l||void 0===l?void 0:l._data,null===l||void 0===l?void 0:l._data.first_node));const a=t?yield Oe(o[0]):null;a&&(o=a.nodes,n=a.activeId,I.current=(null===(i=a.params)||void 0===i?void 0:i.account_id)||0);const r=Ne(e.bot_id,{getParams:U});if(r&&r.params.action_id&&r.params.action_value){const e=yield ce(r.params);1===(null===e||void 0===e?void 0:e._status)&&(null===e||void 0===e?void 0:e._data.node)&&(n=null===e||void 0===e?void 0:e._data.node.id,o=r.listNodes,o[o.length-1]=null===e||void 0===e?void 0:e._data.node,Te({nodes:o,activeId:n,params:r.params,accountIdFromLogs:I.current}),setTimeout((()=>{A()}),100))}const s=(null===r||void 0===r?void 0:r.params)||(null===a||void 0===a?void 0:a.params)||e,[d,c]=Me(o[0],n,o);k(!1),C(d),B(c),L(Object.assign(Object.assign({},e),s))}))),[]),D=(0,n.useCallback)(((e,t)=>{const n=document.querySelector(`.si-revamp-event-submission[data-bot-id="${i}"]`);n&&n.click();let o=T,l=[...M];if(null===t||void 0===t?void 0:t.node_id){const e=l.findIndex((({id:e})=>e==t.node_id));-1!==e&&(l[e]._message=Object.assign(Object.assign({},l[e]._message),t),l=[...l.slice(0,e+1)])}if(k(!0),e){const t=l.findIndex((({id:t})=>t==(null===e||void 0===e?void 0:e.id)));if(-1===t)l=[...l,Object.assign({},e)];else{const i=Object.assign(Object.assign(Object.assign({},l[t]),e),{_message:Object.assign(Object.assign({},l[t]._message),null===e||void 0===e?void 0:e._message)});l=[...l.slice(0,t),Object.assign({},i),...l.slice(t+1)]}o=e.id}setTimeout((()=>{B(l),C(o),k(!1),Te({nodes:l,activeId:o,params:R,accountIdFromLogs:I.current})}),250)}),[M,T]),F=(0,n.useCallback)((e=>(0,l.a)(void 0,void 0,void 0,(function*(){if(null===e||void 0===e?void 0:e.node_id){const t=Object.assign(Object.assign({},e),fe(M,T,e.action_id)),i=yield ce(t);if(k(!1),1===(null===i||void 0===i?void 0:i._status)){const e=null===i||void 0===i?void 0:i._data,{node:n}=e,o=(0,l._)(e,["node"]),a=Object.assign(Object.assign({},n),{_message:Object.assign(Object.assign({},o),{node_id:n.id})});M.findIndex((e=>e.id===a.id));return void D(a,t)}N({title:w({id:"notification.comment.somethingWrong"}),message:"",type:"danger"})}const t=M.find((e=>e.id==T));t&&t.hasOwnProperty("first_node")&&(C(M[1].id.toString()),Te({nodes:M,activeId:M[1].id.toString(),params:U(),accountIdFromLogs:I.current}))}))),[D,M]),G=(0,n.useCallback)((()=>{const e=M.findIndex((({id:e})=>e==T));if(e&&-1!==e&&e>1){const t=M[e-1];C(t.id),Te({nodes:M,activeId:t.id,params:R,accountIdFromLogs:I.current})}}),[M,T]),H=(0,n.useCallback)((()=>{const e=U();$(e,!1);const t=M[0],i=M[1];Te({nodes:[t,i],activeId:String(t.id),params:e,accountIdFromLogs:I.current})}),[U,$,M]),z=(0,n.useCallback)((e=>{B((t=>e&&(null===e||void 0===e?void 0:e.node_id)&&(null===e||void 0===e?void 0:e.node_id)==T?t.map((t=>{const i=t;return i.id===T?Object.assign(Object.assign({},t),{_message:i._message?Object.assign(Object.assign({},i._message),e):e}):t})):t))}),[T]);(0,n.useEffect)((()=>{if(r.Z.get(a.G)){const e=U();$(e)}else(0,g.e)({condition:()=>Boolean(r.Z.get(a.G)),finished:()=>{const e=U();$(e)}})}),[]),(0,n.useEffect)((()=>{if(!M.length)return;M.find((e=>e.id==T))&&T||C(i+"")}),[T,M]);const Z=(0,n.useMemo)((()=>({activeId:T,params:R,listNodes:M,loading:S,setLoading:k,getParams:U,onNext:F,onPrev:G,onSubmit:D,onStartOver:H,onChange:z,isShowFooter:j,setIsShowFooter:P,isFullContainer:o,bgImgFullContainer:p,isDisabledAnimationOnMobile:b,onCloseMobile:f,userInfo:h,typeFormProps:_,isMobile:y,locale:x})),[T,F,G,D,z,H,j,R,M,S,k,U,o,b,f,h,p,_,y,x]);return M.length?n.createElement(Be.Provider,{value:Z},n.createElement("div",{ref:O},e)):null},Pe=e=>n.createElement("svg",Object.assign({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),n.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"})),Re="480px",Le=N.Z.div` position: relative; .si-inline-revamp-container { height: 80vh; max-height: ${Re}; 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; ${O.M.mbDown} { max-height: none; height: auto; } } } .si-container-placeholder { width: 100%; height: 80vh; max-height: ${Re}; pointer-events: none; } ${O.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); } ${O.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; } } ${O.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; } } ${O.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; } } } `,Ue=N.Z.div` background-color: var(--subot-inline-bg-color); padding: 40px 0; font-family: Inter; ${O.M.mbUp} { padding: 80px 0; } .si-container { display: flex; align-items: stretch; gap: 16px; margin: 0 auto; flex-direction: column; ${O.M.mbUp} { flex-direction: row; gap: 30px; } &.si-typeform-container { flex-direction: column; .si-revamp-left, .si-revamp-right { max-width: none; } ${O.M.mbDown} { .si-revamp-right { height: 80vh; margin-left: -16px; margin-right: -16px; div, iframe { height: 100%; border-radius: 0; } } } } } .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; } } } ${O.M.mbUp} { max-width: ${Re}; min-width: ${Re}; } ${O.M.tdUp} { max-width: 720px; min-width: 720px; } } .si-revamp-left { display: flex; gap: 24px; flex-direction: column; max-width: 490px; ${O.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; ${O.M.mbUp} { font-size: 40px; line-height: 48px; letter-spacing: -0.88px; } strong, b { font-weight: 600; } } } `,Ae=N.Z.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; } `,$e=e=>n.createElement("svg",Object.assign({width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),n.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"})),De=e=>n.createElement("svg",Object.assign({width:"20",height:"21",viewBox:"0 0 20 21",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),n.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"})),Fe=()=>{const[e,t]=(0,n.useState)(!1),{formatMessage:i}=(0,n.useContext)(m.T);return n.createElement(Ae,null,n.createElement("div",{className:"si-disclaimer",onClick:()=>t(!e)},n.createElement(De,{className:"si-disclaimer-info-svg"}),n.createElement("span",{className:"si-disclaimer-desc"},i({id:"tools.disclaimer",defaultMessage:"Mi\u1ec5n tr\u1eeb tr\xe1ch nhi\u1ec7m"})),n.createElement($e,{className:"si-disclaimer-down"})),n.createElement(w.E.div,{className:"si-disclaimer-expanded",animate:e?{height:"auto"}:{height:0},transition:{duration:.3}},i({id:"tool.subot.inline.disclaimer.content",defaultMessage:"C\xf4ng c\u1ee5 n\xe0y kh\xf4ng cung c\u1ea5p l\u1eddi khuy\xean y t\u1ebf m\xe0 ch\u1ec9 d\xf9ng \u0111\u1ec3 cung c\u1ea5p th\xf4ng tin. N\xf3 kh\xf4ng thay th\u1ebf cho l\u1eddi khuy\xean, ch\u1ea9n \u0111o\xe1n ho\u1eb7c \u0111i\u1ec1u tr\u1ecb y t\u1ebf chuy\xean nghi\u1ec7p t\u1eeb b\xe1c s\u0129. N\u1ebfu b\u1ea1n \u0111ang t\xecm ph\u01b0\u01a1ng ph\xe1p \u0111i\u1ec1u tr\u1ecb hay \u0111ang \u0111i\u1ec1u tr\u1ecb, \u0111\u1eebng b\u1ecf qua l\u1eddi khuy\xean y t\u1ebf t\u1eeb b\xe1c s\u0129 ch\u1ec9 v\xec m\u1ed9t s\u1ed1 th\xf4ng tin b\u1ea1n \u0111\xe3 \u0111\u1ecdc tr\xean website c\u1ee7a ch\xfang t\xf4i. N\u1ebfu b\u1ea1n ngh\u0129 r\u1eb1ng m\xecnh \u0111ang trong t\xecnh tr\u1ea1ng kh\u1ea9n c\u1ea5p, h\xe3y li\xean h\u1ec7 v\u1edbi b\xe1c s\u0129 ngay l\u1eadp t\u1ee9c."})))};Fe.displayName="SubotInlineDisclaimer";const Ge=()=>{const{data:{locale:e,router:t}}=(0,n.useContext)(m.T),{asPath:i}=t||{},[o,l]=(0,n.useState)((()=>`${(0,g.g)(e,!1)}${a.b}${i}`));return(0,n.useEffect)((()=>{l(window.location.href)}),[i]),o},He=()=>{const{formatMessage:e,action:{pushNotifications:t}}=(0,n.useContext)(m.T);return{validateSelectActions:(i,n,l)=>{(null===n||void 0===n?void 0:n.multi_select_option)!==o.g.EXACT_NUMBER||i.length===(null===n||void 0===n?void 0:n.from)?(null===n||void 0===n?void 0:n.multi_select_option)===o.g.RANGE&&(i.length<(null===n||void 0===n?void 0:n.from)||i.length>(null===n||void 0===n?void 0:n.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:n.from,to:n.to}),type:"warning"}):i.length?l():t({title:"",message:e({id:"multiSelectError.required",defaultMessage:"There is no answer!"}),type:"warning"}):t({message:e({id:"multiSelectError.exactNumber",defaultMessage:"You must choose {from} answers."},{from:n.from}),type:"warning"})}}},ze=N.Z.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; } ${O.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; } } } } `,Ze=e=>n.createElement("svg",Object.assign({width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),n.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"})),qe=e=>n.createElement("svg",Object.assign({width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),n.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"})),Ve=e=>n.createElement("svg",Object.assign({width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),n.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"})),Ye=n.createContext({value:{},setValue:()=>null}),We=({children:e})=>{const[t,i]=(0,n.useState)({}),o=(0,n.useMemo)((()=>({value:t,setValue:i})),[t,i]);return n.createElement(Ye.Provider,{value:o},e)},Xe=[o.d.FORM],Je=[o.c.SSO],Ke=[o.d.FINAL,o.d.FINAL_THANK_YOU,o.d.FINAL_STANDARD],Qe=()=>{var e,t,i;const{formatMessage:l,action:{pushNotifications:a}}=(0,n.useContext)(m.T),r=Ge(),{listNodes:s,activeId:d,isShowFooter:c,onNext:u,onPrev:v,params:p,onStartOver:g,loading:b}=(0,n.useContext)(Be),{value:f}=(0,n.useContext)(Ye),h=He(),_=s[0],E=s.find((e=>e.id==d)),y=null===(e=null===E||void 0===E?void 0:E.actions)||void 0===e?void 0:e.find((e=>e.type===o.f.USER_CHOICE_NEXT)),x=null===(t=null===E||void 0===E?void 0:E.actions)||void 0===t?void 0:t.find((({type:e})=>e==o.f.POLL_BUTTON)),w=null===(i=null===E||void 0===E?void 0:E.actions)||void 0===i?void 0:i.find((({type:e})=>e==o.f.ACTION_MULTIPLE_BUTTON));if(!c)return null;const N=s.find((e=>e.id==d)),O=Xe.includes((null===N||void 0===N?void 0:N.type)||"")||Je.includes((null===N||void 0===N?void 0:N.position)||""),S=!Ke.includes((null===N||void 0===N?void 0:N.type)||"");return n.createElement(ze,{"data-show-action":S},n.createElement("button",{onClick:g,"data-event-category":"Service Connection","data-event-action":"Risk Screening Start Over","data-event-label":r,"data-bot-id":p.bot_id,className:"si-footer-start-over",disabled:Boolean((null===_||void 0===_?void 0:_.subot_field_type)&&d==(null===s||void 0===s?void 0:s[1].id))},n.createElement(Ve,null)," ",n.createElement("span",null,l({id:"tool.subot.inline.start.over",defaultMessage:"Start over"}))),S&&n.createElement("div",{className:"si-footer-actions"},n.createElement(I.B,{size:"md",variant:"tertiary",onClick:v,"data-event-category":"Service Connection","data-event-action":"Risk Screening Back","data-event-label":r,"data-bot-id":p.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"}}}},n.createElement(Ze,{style:{marginRight:10}}),l({id:"riskScreener.back",defaultMessage:"Back"})),n.createElement(I.B,{size:"md",onClick:()=>{var e;(null===y||void 0===y?void 0:y.id)&&(null===y||void 0===y?void 0:y.key)?(()=>{const e={node_id:E.id,action_id:null===y||void 0===y?void 0:y.id,action_value:null===y||void 0===y?void 0:y.key};u(Object.assign(Object.assign(Object.assign({},p),null===E||void 0===E?void 0:E._message),e))})():w?h.validateSelectActions(Object.keys((null===f||void 0===f?void 0:f.selected_actions)||{}),E,(()=>{u&&u(Object.assign(Object.assign(Object.assign({},p),null===E||void 0===E?void 0:E._message),f))})):x?(()=>{var e;const t={},i=(null===(e=null===f||void 0===f?void 0:f.form_submit_meta)||void 0===e?void 0:e.map((({action_id:e})=>e)))||[];f.form_submit_meta&&f.form_submit_meta.length&&(t[E.id]=f.form_submit_meta.map((e=>e.action_id)));const n=Object.assign(Object.assign({},f),{current_polls:t});h.validateSelectActions(i,E,(()=>{u&&u(Object.assign(Object.assign(Object.assign({},p),null===E||void 0===E?void 0:E._message),n))}))})():(null===E||void 0===E?void 0:E._message)&&(null===(e=E._message)||void 0===e?void 0:e.action_id)?u(Object.assign(Object.assign(Object.assign({},p),null===E||void 0===E?void 0:E._message),f)):a({title:"",message:l({id:"multiSelectError.required",defaultMessage:"There is no answer!"}),type:"warning"})},loading:!O&&b,disabled:O,"data-event-category":"Service Connection","data-event-action":"Risk Screening Continue","data-event-label":r,"data-bot-id":p.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"}}}},l({id:"riskScreener.next",defaultMessage:"Next"}),n.createElement(qe,{style:{marginLeft:10}}))))};Qe.displayName="SubotInlineFooterContainer";const et=N.Z.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; } `,tt=e=>{var{children:t,className:i}=e,o=(0,l._)(e,["children","className"]);const a=(0,n.useMemo)((()=>new S._("full",{html:!0,linkTarget:"_blank"})),[]),r=E()(i,"markdown"),s=(0,n.useMemo)((()=>{const e=Object.assign({},o);return"string"===typeof t?e.dangerouslySetInnerHTML={__html:a.render(t)}:e.children=t,e}),[t]);return n.createElement(et,Object.assign({},s,{className:r}))},it=N.Z.div` display: flex; gap: 24px; `,nt=N.Z.div` display: flex; gap: 24px; flex-direction: column; .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: ' · '; } } } /* · */ `,ot=({subotSettingData:e,layout:t="vertical"})=>{const i=e.reviewByAvatar&&e.reviewByName;return n.createElement(it,null,"horizontal"===t&&e.inlineImage&&n.createElement("div",{className:"si-image"},n.createElement("img",{loading:"lazy",alt:"Inline heading",src:e.inlineImage})),n.createElement(nt,null,e.inlineImage&&"vertical"===t&&n.createElement("img",{loading:"lazy",alt:"Inline heading",className:"si-image",src:e.inlineImage}),e.inilneHeadline&&n.createElement("h2",{className:"si-headline"},n.createElement(tt,null,e.inilneHeadline)),i&&n.createElement("div",{className:"si-review-by"},n.createElement("div",{className:"si-review-by-avatar"},n.createElement("img",{loading:"lazy",src:e.reviewByAvatar,alt:e.reviewByName})),n.createElement("div",{className:"si-review-by-info"},n.createElement(tt,{className:"si-review-by-name"},e.reviewByName),n.createElement("p",{className:"si-review-by-branch"},[e.reviewBySpecialty,e.reviewByHospital].filter(Boolean).map(((e,t)=>n.createElement("span",{key:t},e))))))))};ot.displayName="SubotInlineInfoSection";const lt=N.Z.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); ${O.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; ${O.M.mbUp} { letter-spacing: -0.16px; } } &.si-acuvue-wrap { align-items: center; text-align: center; } `,at=N.Z.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; } } `,rt=({clientId:e,voucherAnswers:t})=>{const[i,o]=(0,n.useState)(0),[l,a]=(0,n.useState)(0);(0,n.useEffect)((()=>{(0,m.c)(de(re.GET_VOUCHER_QUANTITY,{search:(null===t||void 0===t?void 0:t.voucherName.split("|")[0])||"",clientId:e}),"GET").then((e=>{const t=null===e||void 0===e?void 0:e._data[0];t.total_quantity&&(o(t.total_quantity),a(t.total_in_stock))}))}),[null===t||void 0===t?void 0:t.voucherName]);const r=i?l/i*100:0;return i?n.createElement(at,{className:"si-voucher-left-ui"},n.createElement("img",{src:B.C.getAssetPath("subot/voucher_bg.png"),alt:"",loading:"eager",className:"si-voucher-bg"}),n.createElement("img",{src:B.C.getAssetPath("subot/voucher_icon.png"),alt:"",loading:"eager",className:"si-voucher-item"}),n.createElement(C.x,{className:"si-voucher-in-stock"},n.createElement("h3",null,l),n.createElement("img",{src:B.C.getAssetPath("subot/voucher_icon_small.png"),alt:"",loading:"eager"})),n.createElement(C.x,{className:"si-voucher-progress"},n.createElement(C.x,{className:"si-voucher-progress--inner",style:{width:`${r}%`}}))):null},st=({node:e,onClickStart:t})=>{var i,o;const l=(0,n.useRef)(!1),{ref:a,inView:r}=(0,T.YD)(),s=Ge(),{params:d,getParams:c,onNext:u,setIsShowFooter:m,listNodes:v}=(0,n.useContext)(Be),p=v[0],b=null===(i=null===p||void 0===p?void 0:p.extra_settings)||void 0===i?void 0:i.subot_type;(0,n.useMemo)((()=>{m(!1)}),[]),(0,n.useEffect)((()=>{r&&!l.current&&(pe(c()),l.current=!0)}),[r]);return n.createElement(lt,{ref:a,className:E()({"si-acuvue-wrap":"ACUVUE"===b})},n.createElement("h2",null,e.inline_title),n.createElement("div",{className:"si-node-start-desc"},n.createElement(tt,null,e.inline_description)),"ACUVUE"===b&&n.createElement(rt,{clientId:null===(o=p.extra_settings)||void 0===o?void 0:o.client_id,voucherAnswers:{email:"",voucherName:""}}),n.createElement(I.B,{onClick:()=>{const e=c();e.device_id=(0,g.f)(window.navigator.userAgent)?2:1,ve(e),u(),null===t||void 0===t||t()},"data-event-category":"Service Connection","data-event-action":"Risk Screening Start","data-event-label":s,"data-bot-id":d.bot_id,rightIcon:n.createElement(k.Z,{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))};st.displayName="SubotInlineNodeStartContainer";const dt=N.Z.div``,ct=N.Z.div` .si-intent-list { display: flex; gap: 12px; flex-direction: column; } &[data-intent-count='1'] { .si-bot-title { margin-bottom: 0; } } `,ut=N.Z.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; } ${O.M.mbUp} { font-size: 22px; line-height: 32px; letter-spacing: -0.6px; } } &#si-intent-bot-title { ~ div { .si-bot-title { margin-bottom: 0; } } } `,mt=N.Z.div` text-align: center; button { min-width: 230px; } .si-button-svg-icon { margin-right: 3px; } `,vt=e=>n.createElement("svg",Object.assign({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),n.createElement("g",{clipPath:"url(#clip0_608_1578)"},n.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"}),n.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"})),n.createElement("defs",null,n.createElement("clipPath",{id:"clip0_608_1578"},n.createElement("rect",{width:"24",height:"24",fill:"white"})))),pt="campaign/{campaignCode}/lead";f().extend(P());const gt=e=>(0,l.a)(void 0,void 0,void 0,(function*(){const{first_name:t,last_name:i,address:n,dob:o,email:s,phone:d}=e||{};return yield(c=((e,t)=>{const{leadApiUrl:i}=null===m.G||void 0===m.G?void 0:m.G.env;return i+p()(e,Object.assign({},t))})(pt,{campaignCode:le.env.NEXT_PUBLIC_FRISO_COMPAIGN_CODE||"wufl4mh2vunsklq"}),u="POST",v={data:{url:window.location.href,title_article:document.title,referrer:"hlbs",meta:[{key:"first_name",value:t||"",control:"text"},{key:"last_name",value:i||"",control:"text"},{key:"due_date_dob",value:o,control:"due_date_dob"},{key:"province",value:((null===n||void 0===n?void 0:n.selectedProvince)||"").replace("T\u1ec9nh ","").replace("Th\xe0nh ph\u1ed1 ",""),control:"province"},{key:"email",value:s||"",control:"email"},{key:"phone",value:d||"",control:"tel"},{key:"address",value:n?[(null===n||void 0===n?void 0:n.selectedProvince)||"",(null===n||void 0===n?void 0:n.selectedDistrict)||"",(null===n||void 0===n?void 0:n.selectedWard)||"",(null===n||void 0===n?void 0:n.extraInfo)||""].join("; "):"",control:"text"}]}},(0,l.a)(void 0,void 0,void 0,(function*(){if(null===v||void 0===v?void 0:v.data){let e=r.Z.get(R.d);const t=r.Z.get(a.G);if(!e){const t=(0,L.Z)();e=t,r.Z.set(R.d,t)}v.data.cookie_id=e,v.data.ga_client_id=t||""}return(0,m.c)(c,u,v)})));var c,u,v})),bt=(e,t)=>{var i,n,l,a,r,s,d,c,u;try{if(!(null===(i=e.extra_settings)||void 0===i?void 0:i.sync_data_friso_campaign)||!t)return;const m=o.E[o.f.USER_SUBMIT_NAME],v=o.E[o.f.USER_SUBMIT_EMAIL],p=o.E[o.f.USER_SUBMIT_DATE],g=o.E[o.f.USER_SUBMIT_OTP],b=o.E[o.f.USER_SUBMIT_PHONE],f=o.E[o.f.USER_SUBMIT_ADDRESS_PROVINCE],h=o.E[o.f.USER_SUBMIT_ADDRESS_DISTRICT],_=o.E[o.f.USER_SUBMIT_ADDRESS_COMMUNE],E=o.E[o.f.USER_SUBMIT_ADDRESS],y=(null===(n=t.find((e=>e.control===m)))||void 0===n?void 0:n.value)||"",x=(null===(l=t.find((e=>e.control===v)))||void 0===l?void 0:l.value)||"",w=(null===(a=t.find((e=>e.control===p)))||void 0===a?void 0:a.value)||"",N=(null===(r=t.find((e=>e.control===g||e.control===b)))||void 0===r?void 0:r.value)||"",O={selectedProvince:(null===(s=t.find((e=>e.control===f)))||void 0===s?void 0:s.value)||"",selectedDistrict:(null===(d=t.find((e=>e.control===h)))||void 0===d?void 0:d.value)||"",selectedWard:(null===(c=t.find((e=>e.control===_)))||void 0===c?void 0:c.value)||"",extraInfo:(null===(u=t.find((e=>e.control===E)))||void 0===u?void 0:u.value)||""};if(!y||!x||!w||!N||!O.selectedProvince||!O.selectedDistrict||!O.selectedWard||!O.extraInfo)return;const I=y.split(" "),S=I[I.length-1];I.pop();const k=I.join(" ");gt({last_name:S,first_name:k,phone:N.replace("+84","0"),email:x,address:O,dob:w,term:!0})}catch(m){}},ft=e=>{const{foundPhone:t,foundDate:i}=(e=>{let t="",i="";return e.forEach((e=>{var n,l,a,r,s,d;const c=e,u=(null===(a=null===(l=null===(n=null===c||void 0===c?void 0:c._message)||void 0===n?void 0:n.form_submit_meta)||void 0===l?void 0:l.find((e=>e.control===o.E[o.f.USER_SUBMIT_OTP]||e.control===o.E[o.f.USER_SUBMIT_PHONE])))||void 0===a?void 0:a.value)||"",m=(null===(d=null===(s=null===(r=null===c||void 0===c?void 0:c._message)||void 0===r?void 0:r.form_submit_meta)||void 0===s?void 0:s.find((e=>e.control===o.E[o.f.USER_SUBMIT_DATE])))||void 0===d?void 0:d.value)||"";u&&m&&(t=u,i=m)})),{foundPhone:t,foundDate:i}})(e);if(!t||!i)return;const n=f()(i),l=t.replace("+84","0"),a=n.isSameOrBefore(f()()),r=n.format("YYYY-MM-DD");window.location.href=p()(le.env.NEXT_PUBLIC_FRISO_MINI_GAME_URL||"",Object.assign({phone:l},a?{dob:r}:{edd:r}))},ht=({intent:e})=>{var t;const{listNodes:i}=(0,n.useContext)(Be),l=(0,n.useMemo)((()=>e.url&&e.label&&(null===e||void 0===e?void 0:e.type)===o.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?void 0:e.label))return null;const a=null===(t=e.label)||void 0===t?void 0:t.startsWith(":download:");return n.createElement(mt,null,n.createElement(I.B,Object.assign({size:"md",color:"primary",onClick:()=>{var t;(null===(t=e.url)||void 0===t?void 0:t.includes("{{.frisoRedirectUrl}}"))?ft(i):e.url&&(0,g.h)(e.url)}},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"}}}),a&&n.createElement(vt,{width:"1em",height:"1em",className:"si-button-svg-icon"}),n.createElement(tt,null,e.label.replace(":download:",""))))};ht.displayName="SubotInlineIntentBotButton";const _t=N.Z.div` img { display: block; width: auto; max-width: 100%; margin: 0 auto; } `,Et=({intent:e})=>e.url?n.createElement(_t,null,n.createElement("img",{loading:"lazy",src:e.url,alt:e.label})):null;Et.displayName="SubotInlineIntentBotImage";const yt=({intent:e,indexNumber:t})=>{const{listNodes:i}=(0,n.useContext)(Be),l=![o.N.SSO_INTENT].includes(null===e||void 0===e?void 0:e.type),a=[o.N.BOT_TEXT,o.N.BOT_MAIN_TITLE].includes(null===e||void 0===e?void 0:e.type),r=[o.N.BOT_BUTTON,o.N.BOT_RECALCULATE].includes(null===e||void 0===e?void 0:e.type),s=[o.N.BOT_IMAGE,o.N.BOT_MAIN_IMAGE].includes(null===e||void 0===e?void 0:e.type),d=(null===e||void 0===e?void 0:e.type)===o.N.BOT_MAIN_TITLE;return r?n.createElement(ht,{intent:e}):e?n.createElement(ut,{id:"si-intent-bot-title"},n.createElement("h3",{className:"si-bot-title","data-image":s},t&&n.createElement("span",{className:"si-bot-title-number"},t,"."),l&&a&&n.createElement(tt,null,d?he(e.label||"",i):e.label),s&&n.createElement(Et,{intent:e}))):null};yt.displayName="SubotInlineIntentBotTitle";const xt=({intent:e})=>{const t=Ge(),{listNodes:i,activeId:o,params:l}=(0,n.useContext)(Be),a=i.find((e=>e.id==o));if(!e.label||!a)return null;const r={"data-event-category":"Service Connection","data-event-action":e.label,"data-event-label":t,"data-bot-id":l.bot_id,"data-question-id":a.id};return n.createElement(C.x,{style:{position:"absolute",zIndex:-1}},n.createElement("button",Object.assign({className:"si-revamp-event-submission"},r)))};xt.displayName="SubotInlineIntentBotEventSubmission";const wt=N.Z.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; } } `,Nt=e=>{try{if(e.label&&e.label.includes("{")){const t=JSON.parse(e.label);if(t.meta){const e={};t.meta.map((({key:t,value:i})=>{t&&i&&(e[t]=i)})),t.meta=Object.assign({},e)}return Object.assign({},t)}return{}}catch(t){return{}}},Ot=({intent:e})=>{var t,i,o,l;const a=(0,n.useMemo)((()=>Nt(e)),[e,null===e||void 0===e?void 0:e.label]),{formatMessage:r}=(0,n.useContext)(m.T);return n.createElement(n.Fragment,null,!!(null===a||void 0===a?void 0:a.title)&&!!(null===a||void 0===a?void 0:a.thumbnail)&&!!(null===a||void 0===a?void 0:a.url)&&n.createElement(wt,null,n.createElement("div",{className:"si-related-article-thumbnail"},n.createElement("a",{href:a.url,target:"_blank","data-event-category":"Service Connection","data-event-action":"Risk Screening - Article Click","data-event-label":a.url,rel:"noreferrer"},n.createElement("img",{src:a.thumbnail,alt:a.title,loading:"lazy"}))),n.createElement("div",{className:"si-related-article-content"},(null===(t=a.meta)||void 0===t?void 0:t.category_name)&&n.createElement("p",{className:"si-related-article-category",style:{color:null===(i=a.meta)||void 0===i?void 0:i.category_text_color}},n.createElement("a",{href:a.meta.category_url,target:"_blank",rel:"noreferrer"},a.meta.category_name)),n.createElement("h3",null,n.createElement("a",{href:a.url,target:"_blank","data-event-category":"Service Connection","data-event-action":"Risk Screening - Article Click","data-event-label":a.url,rel:"noreferrer"},a.title)),(null===(o=a.meta)||void 0===o?void 0:o.reviewed_avatar_thumbnail)&&(null===(l=a.meta)||void 0===l?void 0:l.reviewed_display_name)&&n.createElement("div",{className:"si-related-article-review-by"},n.createElement("div",{className:"si-related-article-review-by-avatar"},n.createElement("a",{href:a.meta.reviewed_url,target:"_blank",rel:"noreferrer"},n.createElement("img",{src:a.meta.reviewed_avatar_thumbnail,alt:a.meta.reviewed_display_name}))),n.createElement("div",{className:"si-related-article-review-by-name"},n.createElement("p",null,r({id:"articleAuthor.title.medical",defaultMessage:"Medically reviewed by"})," ",n.createElement("strong",null,a.meta.reviewed_display_name)))))))};Ot.displayName="SubotInlineIntentBotImage";const It=N.Z.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; } } `,St=N.Z.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; } `,kt=({text:e})=>{const[t,i]=(0,n.useState)(!1),{formatMessage:o}=(0,n.useContext)(m.T);return e?n.createElement(St,null,n.createElement("div",{className:"si-disclaimer",onClick:()=>i(!t)},n.createElement(De,{className:"si-disclaimer-info-svg"}),n.createElement("span",{className:"si-disclaimer-desc"},o({id:"tools.disclaimer",defaultMessage:"Mi\u1ec5n tr\u1eeb tr\xe1ch nhi\u1ec7m"})),n.createElement($e,{className:"si-disclaimer-down"})),n.createElement(w.E.div,{className:"si-disclaimer-expanded",animate:t?{height:"auto"}:{height:0},transition:{duration:.3}},e)):null};kt.displayName="SubotInlineDisclaimer";const Tt=({intent:e})=>{var t,i,o;const{formatMessage:l}=(0,n.useContext)(m.T),{encodedGaId:s}=function(){const[e,t]=(0,n.useState)(""),[i,o]=(0,n.useState)("");return(0,n.useEffect)((()=>{if(r.Z.get(a.G)){const e=r.Z.get(a.G);if(e){const i=btoa(e);t(i),o(e)}}else(0,g.e)({condition:()=>Boolean(r.Z.get(a.G)),finished:()=>{const e=r.Z.get(a.G);if(e){const i=btoa(e);t(i),o(e)}}})}),[]),{encodedGaId:e,gaId:i}}(),d=(0,n.useMemo)((()=>{try{return JSON.parse(e.label||"")||[]}catch(t){return[]}}),[null===e||void 0===e?void 0:e.label]);if(!e.label||!d.length)return null;const c=null===(t=d[0])||void 0===t?void 0:t.disclaimer,u=null===(i=d[0])||void 0===i?void 0:i.sectionTitle;return n.createElement(It,null,n.createElement(U.T,{size:"lg",weight:"semiBold",className:"si-title",color:"var(--subot-inline-text-color, #262626)"},(null===(o=null===u||void 0===u?void 0:u.trim)||void 0===o?void 0:o.call(u))||l({id:"tools.suggestedServices",defaultMessage:"Suggested services"})+":"),n.createElement("div",{className:"si-list-services"},d.map(((e,t)=>n.createElement("div",{onClick:()=>(e=>{if(!e.url)return;const t=(0,g.i)(e.url,s);e.url&&(0,g.h)(t)})(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,g.i)((null===e||void 0===e?void 0:e.url)||"",s)},n.createElement(C.x,{className:"aspect-square"},n.createElement("img",{loading:"lazy",src:e.feature,alt:e.feature,key:t})),e.title&&n.createElement(U.T,{size:"p2",className:"si-service-title",color:"var(--subot-inline-text-color, #262626)"},e.title))))),c&&n.createElement(kt,{text:c}))};Tt.displayName="SubotInlineIntentBotSuggestedService";const Ct=N.Z.div` font-size: 16px; line-height: 24px; color: var(--subot-inline-text-color, #595959); font-weight: 400; ul, ol { li + li { margin-top: 12px; } } `,Mt=({intent:e})=>{const{listNodes:t}=(0,n.useContext)(Be);if(!(null===e||void 0===e?void 0:e.label))return null;const i=(null===e||void 0===e?void 0:e.type)===o.N.BOT_MAIN_BODY;return n.createElement(Ct,{className:"si-bot-text"},n.createElement(tt,null,i?he(e.label,t):null===e||void 0===e?void 0:e.label))};Mt.displayName="SubotInlineIntentBotText";const Bt=N.Z.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; } `,jt=({intent:e})=>{const t=(()=>{try{return(null===e||void 0===e?void 0:e.label)?JSON.parse(null===e||void 0===e?void 0:e.label):{}}catch(t){return{}}})();return t&&t.title?n.createElement(Bt,{id:"si-intent-sso"},n.createElement("img",{loading:"lazy",src:null===e||void 0===e?void 0:e.url,className:"icon",alt:""}),n.createElement("div",{className:"si-sso-content"},n.createElement("h3",{className:"si-sso-title"},t.title),n.createElement("div",{className:"si-sso-description"},t.description))):null};var Pt;jt.displayName="SubotInlineIntentSSO";const Rt=N.Z.div` width: ${({width:e})=>e||"100%"}; padding: 4px; ${O.M.mbDown} { width: 100%; } `,Lt=N.Z.div` display: flex; .feature { width: 30%; .feature-wrapper { position: relative; display: block; overflow: hidden; width: 100%; padding-top: 66%; border-radius: ${A.r.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===(Pt=null===A.r||void 0===A.r?void 0:A.r.colors)||void 0===Pt?void 0:Pt.gray800)||"#262626"}; text-decoration: none; } } `,Ut=({intent:e})=>{const t=(0,n.useMemo)((()=>e.label.includes("{")?JSON.parse(e.label):{}),[e.label]);return n.createElement(n.Fragment,null,!!Object.keys(t).length&&n.createElement(Rt,null,n.createElement(Lt,null,n.createElement("div",{className:"feature"},n.createElement("a",{href:null===t||void 0===t?void 0:t.url,className:"feature-wrapper"},n.createElement("img",{loading:"lazy",src:null===t||void 0===t?void 0:t.thumbnail,alt:null===t||void 0===t?void 0:t.title,className:"feature-img"}))),n.createElement("div",{className:"body"},n.createElement("a",{href:null===t||void 0===t?void 0:t.url},n.createElement("h5",{className:"title"},n.createElement(tt,null,null===t||void 0===t?void 0:t.title)))))))};Ut.displayName="SubotInlineIntentUrl";const At={[o.N.BOT_TEXT]:Mt,[o.N.BOT_IMAGE]:Et,[o.N.BOT_BUTTON]:ht,[o.N.BOT_URL]:Ut,[o.N.BOT_RECALCULATE]:ht,[o.N.BOT_MAIN_TITLE]:yt,[o.N.BOT_MAIN_IMAGE]:Et,[o.N.BOT_MAIN_BODY]:Mt,[o.N.BOT_MAIN_BUTTON]:ht,[o.N.BOT_SUB_TITLE]:Mt,[o.N.BOT_SUB_BODY]:Mt,[o.N.BOT_RELATED_ARTICLE]:Ot,[o.N.THANK_YOU_IMAGE]:Et,[o.N.THANK_YOU_TITLE]:Mt,[o.N.THANK_YOU_BODY]:Mt,[o.N.BOT_SUGGESTED_SERVICE]:Tt,[o.N.BOT_BOOKING]:ht,[o.N.BOT_EVENT_SUBMISSION]:xt,[o.N.SSO_INTENT]:jt},$t=new Proxy(At,{get:(e,t)=>At[t]||(()=>$.y?null:n.createElement("p",null,"SubotInlineIntentBase ",t))}),Dt=[o.N.BOT_SUBMISSION,o.N.BOT_BACKGROUND_IMAGE],Ft=({intents:e,indexNumber:t})=>{const i=e.filter((e=>!Dt.includes(e.type||""))),l=i.find((e=>e.type===o.N.BOT_MAIN_TITLE)),a=i.filter((e=>e.type!==o.N.BOT_MAIN_TITLE));return n.createElement(ct,{"data-intent-count":a.length+1},l&&n.createElement(yt,{intent:l,indexNumber:t}),!!a.length&&n.createElement("div",{className:"si-intent-list"},a.map((e=>{const t=(null===e||void 0===e?void 0:e.type)||"";if(Dt.includes(t))return null;const i=$t[t];return i&&n.createElement(i,{key:e.id,intent:e})}))))};Ft.displayName="SubotInlineIntent";const Gt=({node:e})=>{var t,i;const{setIsShowFooter:o,listNodes:l}=(0,n.useContext)(Be),a=l[0];if((0,n.useMemo)((()=>{o(!0)}),[]),!e||!a)return null;const r=null===(t=a.extra_settings)||void 0===t?void 0:t.subot_type;return n.createElement(dt,{id:"si-node-final"},n.createElement(Ft,{intents:e.intents||[]}),"ACUVUE"===r&&n.createElement(rt,{clientId:null===(i=a.extra_settings)||void 0===i?void 0:i.client_id,voucherAnswers:ke(l,a)}))};Gt.displayName="SubotinlineNodeFinal";let Ht=0;function zt(e,t={}){const i=window.fbq;i?i("trackCustom",e,t):Ht<3?(setTimeout((()=>zt(e,t)),1e3),Ht++):console.log("Unable to load Facebook Pixel")}function Zt(e={}){const t=window.location.search.includes("itemId");window.location.search.includes("resultId")||t||zt("CompleteFlow",Object.assign({status:!0},e))}const qt=N.Z.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; } `;N.Z.div` margin-top: 24px; border: 1px solid #ffecb6; border-radius: 16px; ${O.M.mbUp} { padding: 0 0 24px 0; } & > div { scale: 0.9; [data-tag='h5']::before { content: none; } } `;const Vt=N.Z.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; ${O.M.mbUp} { margin-top: 24px; } } ${O.M.mbUp} { font-size: 18px; } } */ `,Yt=e=>n.createElement("svg",Object.assign({width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),n.createElement("mask",{id:"mask0_2159_150362",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"20",height:"20"},n.createElement("rect",{width:"20",height:"20",fill:"#D9D9D9"})),n.createElement("g",{mask:"url(#mask0_2159_150362)"},n.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"}))),Wt=({subIntents:e})=>{const[t,i]=(0,n.useState)(!1),[o,...l]=e;return o?n.createElement(Vt,null,n.createElement("div",{className:"si-sub-intent-title",onClick:()=>i(!t)},n.createElement(Yt,null),n.createElement("span",null,o.label),n.createElement($e,{className:"si-chevron-down"})),n.createElement(w.E.div,{className:"si-sub-intent-expand",animate:t?{height:"auto"}:{height:0},transition:{duration:.3},"data-show":t},l.map((e=>{const t=(null===e||void 0===e?void 0:e.type)||"",i=$t[t];return i&&n.createElement(i,{key:e.id,intent:e})})))):null},Xt=({node:e})=>{var t;const i=(0,n.useRef)(null),{formatMessage:l}=(0,n.useContext)(m.T),{setIsShowFooter:a,listNodes:r}=(0,n.useContext)(Be),[s,d]=(0,n.useState)(!1);(0,n.useEffect)((()=>{var e;(null===(e=i.current)||void 0===e?void 0:e.offsetHeight)&&i.current.offsetHeight<=300&&d(!0)}),[]);const c=r[0];console.log("botItem",typeof c);const u=e.intents||[],{mainIntents:v,subIntents:p,mainButtonIntents:g,bookingButtonIntents:b,relatedArticleIntents:f,suggestedServiceIntents:h,botSubmissionIntent:_}=(0,n.useMemo)((()=>{const e=[],t=[],i=[],n=[],l=[],a=[],r=[];let s;return u.forEach((d=>{switch(null===d||void 0===d?void 0:d.type){case o.N.BOT_MAIN_IMAGE:case o.N.BOT_MAIN_TITLE:case o.N.BOT_MAIN_BODY:e.push(d);break;case o.N.BOT_SUGGESTED_SERVICE:r.push(d);break;case o.N.BOT_MAIN_BUTTON:t.push(d);break;case o.N.BOT_BOOKING:i.push(d);break;case o.N.BOT_RECALCULATE:break;case o.N.BOT_SUB_TITLE:case o.N.BOT_SUB_BODY:n.push(d);break;case o.N.BOT_RELATED_ARTICLE:a.push(d);break;case o.N.BOT_RISK_SCREEN:l.push(d);break;case o.N.BOT_SUBMISSION:s=d}})),{mainIntents:e,subIntents:n,mainButtonIntents:t,bookingButtonIntents:i,screenerIntents:l,relatedArticleIntents:a.filter((e=>{var t;return null===(t=Nt(e))||void 0===t?void 0:t.title})),botSubmissionIntent:s,suggestedServiceIntents:r}}),[]);return(0,n.useMemo)((()=>{a(!0)}),[]),(0,n.useEffect)((()=>{const e=_;(null===e||void 0===e?void 0:e.label)?Zt({risk_level:e.label}):Zt()}),[]),e?n.createElement(qt,{id:"si-node-final"},n.createElement(w.E.div,{ref:i,animate:s?{height:"auto"}:{height:300},transition:{duration:.3},className:"wrap-main-intent","data-hide":!s},n.createElement(Ft,{intents:v})),!s&&n.createElement("span",{role:"presentation",className:"see-more-intent",onClick:()=>d(!0)},l({id:"articlePage.careEmbedding.seeMore",defaultMessage:"See more"})),n.createElement("div",{className:"wrap-main-button-intent"},null===(t=[...g,...b])||void 0===t?void 0:t.map((e=>{const t=$t[e.type||""];return t&&n.createElement(t,{key:e.id,intent:e})}))),(null===h||void 0===h?void 0:h.length)>0&&n.createElement("div",null,h.map((e=>{const t=$t[e.type||""];return t&&n.createElement(t,{key:e.id,intent:e})}))),(null===f||void 0===f?void 0:f.length)>0&&n.createElement("div",{style:{marginTop:24}},n.createElement(U.T,{size:"lg",weight:"semiBold",color:"var(--subot-inline-text-color, #262626)"},l({id:"articlePage.relatedPostsSectionTitle",defaultMessage:"Related Articles"})),n.createElement("div",{style:{padding:"8px 0"}},f.map((e=>{const t=$t[e.type||""];return t&&n.createElement(t,{key:e.id,intent:e})})))),n.createElement(Wt,{subIntents:p})):null};Xt.displayName="SubotinlineNodeFinalStandard";const Jt=N.Z.div` .si-final-thank-action { text-align: center; } `,Kt=({node:e})=>{const{params:t,onNext:i,setIsShowFooter:l}=(0,n.useContext)(Be);(0,n.useMemo)((()=>{l(!0)}),[]);const a=(0,n.useMemo)((()=>{var t;const i=null===(t=null===e||void 0===e?void 0:e.actions)||void 0===t?void 0:t.find((({type:e})=>e===o.f.RESULT_BUTTON));return i||null}),[null===e||void 0===e?void 0:e.actions]),r=(0,n.useCallback)((()=>{i&&i(Object.assign(Object.assign(Object.assign({},t),null===e||void 0===e?void 0:e._message),{action_id:null===a||void 0===a?void 0:a.id,action_value:null===a||void 0===a?void 0:a.key}))}),[a]);return e?n.createElement(Jt,{id:"si-node-final-thank-you"},n.createElement(Ft,{intents:e.intents||[]}),a&&n.createElement("div",{className:"si-final-thank-action"},n.createElement(I.B,{size:"md",onClick:r},a.label))):null};Kt.displayName="SubotinlineNodeFinal";var Qt={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:""}]};const ei=(0,g.g)(m.u);function ti(e,t){const i=Qt;return i[e][t-1].child||i.vn[t-1].child}function ii(e,t,i,n){const o={},l=[];fetch(ei+`/countries/${e}.json`).then((e=>e.json())).then((a=>{a[e].forEach((e=>{let n="";e[t]&&!o[e[t]]&&(i&&i.key?e[i.key]===i.value&&(n=e[t]):n=e[t],n&&(o[e[t]]=!0,l.push(e[t])))})),n&&n(l)})).catch((e=>{console.log(e),n&&n([])}))}const ni=(e,t)=>{const i=e.replace("T\u1ec9nh ","").replace("Th\xe0nh ph\u1ed1 ","").replace("Qu\u1eadn ","").replace("Huy\u1ec7n ","").replace("Ph\u01b0\u1eddng ","").replace("Th\u1ecb x\xe3 ","").replace("Th\u1ecb tr\u1ea5n ","").replace("X\xe3 ",""),n=t.replace("T\u1ec9nh ","").replace("Th\xe0nh ph\u1ed1 ","").replace("Qu\u1eadn ","").replace("Huy\u1ec7n ","").replace("Ph\u01b0\u1eddng ","").replace("Th\u1ecb x\xe3 ","").replace("Th\u1ecb tr\u1ea5n ","").replace("X\xe3 ","");return i.localeCompare(n)},oi=e=>n.createElement("svg",Object.assign({width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),n.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"})),li=e=>n.createElement("svg",Object.assign({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),n.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"})),ai=e=>n.createElement("svg",Object.assign({width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),n.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 ri=(0,n.forwardRef)((({onFinish:e,onClick:t,isFinished:i,resendLabel:o,className:l},a)=>{const[r,s]=(0,n.useState)(g.T),d=(0,n.useRef)(),c=(0,n.useRef)(),{formatMessage:u}=(0,n.useContext)(m.T);c.current=e;const v=(0,n.useCallback)((()=>{let e=g.T;s(e),clearInterval(d.current),d.current=setInterval((()=>{var t;e-=1,s(e),0===e&&(null===(t=c.current)||void 0===t||t.call(c,!0),clearInterval(d.current))}),1e3)}),[]),p=(0,n.useCallback)((()=>{s(0),clearInterval(d.current)}),[]);return(0,n.useImperativeHandle)(a,(()=>({reset:v,cancel:p,isFinished:0===r}))),(0,n.useEffect)((()=>(v(),()=>{clearInterval(d.current)})),[]),n.createElement("div",{className:l,onClick:t},o||u({id:"subot.resendOTP.button",defaultMessage:"Resend"}),r>0&&!i&&` (${r}s)`)}));const si=N.Z.div` margin: 0 auto; background: #f7f9fc; border-radius: ${A.r.borderRadius}; ${O.M.mbDown} { padding: 16px; } ${O.M.tdDown} { padding: 24px; } ${O.M.mbUp} { padding: 32px; } .user-info-form { .input-row { ${O.M.mbDown} { margin-bottom: 16px; } ${O.M.tdDown} { margin-bottom: 18px; } ${O.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: ${A.r.colors.gray600}; font-size: 13px; font-weight: bold; } input[type='tel'], input[type='number'] { width: 100%; padding: 12px 16px; border: solid 1px ${A.r.colors.gray200}; background: #fff; border-radius: ${A.r.borderRadius}; &[disabled] { background-color: ${A.r.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: ${A.r.colors.red700}; font-weight: ${A.r.sizes.fwRegular}; } .submit-btn { padding: 12px 24px; background-color: ${A.r.colors.primaryBase}; border-radius: ${A.r.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: ${A.r.colors.primaryHover}; } &[disabled] { background-color: ${A.r.colors.gray200}; color: #bfbfbf; cursor: not-allowed; } .spinner { margin-right: 20px; } } .submit-btn-row { ${O.M.mbUp} { margin-bottom: 16px; } ${O.M.tdDown} { margin-bottom: 14px; } ${O.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: ${A.r.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; } } } } `,di=N.Z.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: ${A.r.colors.gray600}; } } `,ci=e=>n.createElement("svg",Object.assign({width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),n.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"})),ui=N.Z.div` display: flex; gap: 13px; svg { position: relative; top: 2px; min-width: 20px; } `,mi=(0,n.forwardRef)((function(e,t){var{label:i}=e,o=(0,l._)(e,["label"]);return n.createElement(ui,Object.assign({ref:t},o),n.createElement(ci,null),n.createElement("span",null,i))})),vi=e=>n.createElement("svg",Object.assign({width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),n.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"})),pi=["places"];var gi;!function(e){e.HELLO_BAC_SI="VN",e.MARRY_BABY="VN",e.HELLO_SEHAT="ID",e.HELLO_KHUNMOR="TH",e.HELLO_DOKTOR="MY",e.HELLO_YISHI="TW",e.HELLO_KRUPET="KH",e.HELLO_SAYARWON="MM",e.HELLO_SWATHYA="IN",e.HELLO_DOCTOR="PH",e.HELLO_DOCTOR_FIL="PH"}(gi||(gi={}));const bi={streetNumber:"street_number",street:"route",ward:"sublocality_level_1",district:"administrative_area_level_2",city:"locality",province:"administrative_area_level_1"},fi=Object.keys(bi).concat(["address"]);var hi=(0,n.memo)((function({action:e,formError:t,control:i,initValue:o,onChange:l}){const a=(null===m.G||void 0===m.G?void 0:m.G.locale).split("-")[1],{formatMessage:r}=(0,n.useContext)(m.T),[s,d]=(0,n.useState)(""),c=(0,n.useRef)(null),u=(0,n.useRef)(null),{predictions:v}=(0,q.u)(s,a);(0,n.useEffect)((()=>{c.current=document.createElement("div")}),[]),(0,n.useEffect)((()=>{(null===o||void 0===o?void 0:o.address)&&d(o.address)}),[]);const p=(0,n.useMemo)((()=>v.map((e=>({value:e.description,label:e.description,placeId:e.placeId})))),[v]),g=(t,i)=>{if(i){new window.google.maps.places.PlacesService(c.current).getDetails({placeId:i,language:q.a[a]},(function(i,n){if((null===e||void 0===e?void 0:e.key)&&n===window.google.maps.places.PlacesServiceStatus.OK){const{city:n,district:o,province:a,street:r,ward:s}=(e=>{var t,i,n,o,l,a,r;const s=(null===(t=e.find((e=>e.types.includes(bi.streetNumber))))||void 0===t?void 0:t.long_name)||"",d=(null===(i=e.find((e=>e.types.includes(bi.street))))||void 0===i?void 0:i.long_name)||"",c=(null===(n=e.find((e=>e.types.includes(bi.ward))))||void 0===n?void 0:n.long_name)||"",u=(null===(o=e.find((e=>e.types.includes(bi.district))))||void 0===o?void 0:o.long_name)||"";let m=(null===(l=e.find((e=>e.types.includes(bi.city))))||void 0===l?void 0:l.long_name)||"",v="";return m?v=(null===(r=e.find((e=>e.types.includes(bi.province))))||void 0===r?void 0:r.long_name)||"":m=(null===(a=e.find((e=>e.types.includes(bi.province))))||void 0===a?void 0:a.long_name)||"",{street:s.concat(" ",d),ward:c,district:u,city:m,province:v}})(i.address_components);l(e.key,{address:t,city:n,district:o,province:a,street:r,ward:s})}else console.error("Get place details failed")}))}};return e.key?n.createElement("div",{className:"input-row input-google-address-row",ref:u},n.createElement(Z.LoadScript,{googleMapsApiKey:q.G,libraries:pi,loadingElement:n.createElement(n.Fragment,null)}),n.createElement("label",{htmlFor:e.key},e.label),n.createElement(H.Qr,{name:e.key,control:i,rules:{required:!0},render:t=>{const{address:i=""}=t.field.value||{};return console.log("props",t),n.createElement(D.S,{data:p,icon:n.createElement(ci,null),itemComponent:mi,filter:()=>!0,searchable:!0,className:E()({isEmpty:0===p.length||1===p.length&&p[0].label===i}),onChange:t=>{console.log("newAddress",t);const i=p.find((e=>e.value===t));l(e.key,{address:t}),i&&t&&g(t,i.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:i,rightSection:i?n.createElement(vi,{style:{cursor:"pointer"},className:"delete-icon",onClick:()=>{l(e.key,void 0),setTimeout((()=>{var e;const t=null===(e=u.current)||void 0===e?void 0:e.querySelector(".mantine-Select-input");null===t||void 0===t||t.focus()}),200)}}):n.createElement(n.Fragment,null),placeholder:e.label,searchValue:s,onSearchChange:t=>{d(t),t||l(e.key,void 0)}})}}),t&&n.createElement("p",{className:"error-message"},r({id:"validation.error.requiredField",defaultMessage:"This field is required"}))):null}));const _i=(0,V.Z)(N.Z.div` position: relative; .input-date { display: none; } `,"hhgcomp-subot-datepickerinput"),Ei=N.Z.div` margin: 0 auto; background: #f7f9fc; border-radius: ${A.r.borderRadius}; ${O.M.mbDown} { padding: 16px; } ${O.M.tdDown} { padding: 24px; } ${O.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 { ${O.M.mbDown} { margin-bottom: 16px; } ${O.M.tdDown} { margin-bottom: 18px; } ${O.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: ${A.r.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, ${A.r.colors.gray600}); font-size: 13px; font-weight: bold; } input:not([type='checkbox']), input:not([type='radio']) { width: 100%; padding: 12px 16px; border: solid 1px ${A.r.colors.gray200}; background: #fff; border-radius: ${A.r.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: ${A.r.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: ${A.r.colors.primaryBase}; transition: 0.3s all ease; } input[type='checkbox']:checked:before, input[type='radio']:checked:before { opacity: 1; transition: 0.3s all ease; } ${_i.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: ${A.r.colors.red700}; font-weight: ${A.r.sizes.fwRegular}; svg { margin-right: 5px; } } .submit-btn { padding: 12px 24px; background-color: ${A.r.colors.primaryBase}; border-radius: ${A.r.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: ${A.r.colors.primaryHover}; } &[disabled] { font-weight: ${A.r.sizes.fwSemiBold}; background-color: rgb(242, 242, 242); color: rgb(140, 140, 140); } } .submit-btn-row { ${O.M.mbUp} { margin-bottom: 16px; } ${O.M.tdDown} { margin-bottom: 14px; } ${O.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 ${A.r.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 ${A.r.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; } } } `,yi=N.Z.div` .wrapper-address-lever { display: flex; gap: 16px; justify-content: space-between; ${O.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: ${A.r.colors.gray400}; font-size: 16px; font-weight: 400; line-height: 24px; } } } } } `,xi=e=>e.find((({type:e})=>e===o.f.USER_SUBMIT_OTP)),wi=e=>e.find((({type:e})=>e===o.f.USER_SUBMIT_WHATSAPP)),Ni=(e,t,i,n)=>{let o=i({id:"error.day.invalid",defaultMessage:"This date is not valid, please update."});if(!e)return o=i({id:"validation.error.requiredField",defaultMessage:"This field is required"}),o;if("string"===typeof e){return 3===e.split("/").length?o:!t||o}return f()(e).isValid()?!n||n(e):o},Oi={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"}};var Ii,Si,ki,Ti,Ci;const Mi=N.Z.div` display: flex; align-items: center; > svg, > img { width: 24px; height: 24px; margin-right: 5px; border-radius: 2px; } > div { color: ${(null===(Ii=A.r.colors)||void 0===Ii?void 0:Ii.gray800)||""}; white-space: nowrap; } `;(0,N.Z)(z.default)` display: flex; border: 1px solid ${(null===(Si=A.r.colors)||void 0===Si?void 0:Si.gray200)||""}; border-radius: ${null===A.r||void 0===A.r?void 0:A.r.borderRadius}; .PhoneInputCountry { position: relative; padding: 12px 8px 12px 16px; border-right: 1px solid ${(null===(ki=A.r.colors)||void 0===ki?void 0:ki.gray200)||""}; background-color: ${(null===(Ti=A.r.colors)||void 0===Ti?void 0:Ti.gray100)||""}; border-radius: 6px 0 0 6px; color: ${(null===(Ci=A.r.colors)||void 0===Ci?void 0:Ci.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: ${A.r.colors.red700||""}; } &.PhoneInput--focus { border-color: ${A.r.colors.primaryBase||""}; box-shadow: 0px 0px 2px 2px #91caff; } `;const Bi=(0,N.Z)(z.default)` &.PhoneInput { .PhoneInputCountry { padding: 10px; border: solid 1px ${A.r.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 ${A.r.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; } } `,ji=e=>{var t;const i="+("+(0,z.getCountryCallingCode)(e.country)+")",o=null===(t=e.flagUrl)||void 0===t?void 0:t.replace("{XX}",e.country);return n.createElement(Mi,null,n.createElement("img",{className:"PhoneInputCountryIconImg",alt:e.countryName,src:o,loading:"lazy"}),n.createElement("div",null,i))},Pi=e=>n.createElement(Bi,Object.assign({},e,{flagComponent:ji})),Ri=({action:e,trigger:t,control:i,locale:o,labelTuples:a,isSubmitting:r})=>{const{id:s,key:d,label:c,validated_message:u,validated_conditions:v}=null!==e&&void 0!==e?e:{},p=o||(null===m.G||void 0===m.G?void 0:m.G.locale),{formatMessage:g}=(0,n.useContext)(m.T);return n.createElement("div",{className:"input-row",key:s},n.createElement("label",{htmlFor:d},c),n.createElement(H.Qr,{name:e.key,control:i,rules:{required:{value:!0,message:g({id:"validation.error.requiredField",defaultMessage:"This field is required"})},validate:{ageRange:e=>Ni(e,r,g,(e=>((e,t,i)=>{const{birthDate:n,today:o}=ge(e);if(!i||!i.length)return!0;const l=o.diff(n,"M")/12;if(l<0||0===l&&o.date(){try{return JSON.parse(v)}catch(e){return[]}})())))}},render:({field:e,fieldState:i})=>{const{value:o,name:r,onChange:s}=e,d=(0,l._)(e,["value","name","onChange"]),{error:c}=i,u=!!c;return n.createElement("div",null,n.createElement(_i,null,n.createElement(W.I,Object.assign({},d,{defaultValue:o,onChange:e=>{s(e),t(r)},labelTuples:a,locale:p,error:u,className:"subot_input subot_input_date"}))),u&&n.createElement("p",{className:"error-message"},null===c||void 0===c?void 0:c.message))}}))},Li=({className:e,style:t,actions:i,countryCode:r,callBack:s,formSubmitMeta:d,isFormRevamp:c,botId:u,nodeId:v,trackingSubmitBtn:p})=>{const b=(0,n.useRef)(),h=null===m.G||void 0===m.G?void 0:m.G.userInfo,_=null===m.G||void 0===m.G?void 0:m.G.locale,y=Ge(),{formatMessage:x,action:{pushNotifications:w}}=(0,n.useContext)(m.T),N=(e=>{const t=(e||"vn").toLowerCase(),i=ti(t,1),o=ti(t,2),l=ti(t,3),[a,r]=(0,n.useState)([]),[s,d]=(0,n.useState)([]),[c,u]=(0,n.useState)([]),[m,v]=(0,n.useState)(""),[p,g]=(0,n.useState)(""),[b,f]=(0,n.useState)("");return(0,n.useEffect)((()=>{ii(t,i,void 0,(e=>{r(e.sort(ni))}))}),[t,i]),(0,n.useEffect)((()=>{o&&ii(t,o,{key:i,value:m},(e=>{d(e.sort(ni))}))}),[t,i,o,m]),(0,n.useEffect)((()=>{l&&ii(t,l,{key:o,value:p},(e=>{u(e.sort(ni))}))}),[t,o,l,p]),{level1:a,level2:s,level3:c,setSelectedLevel1:v,setSelectedLevel2:g,setSelectedLevel3:f,selectedLevel1:m,selectedLevel2:p,selectedLevel3:b}})(r),O=(0,n.useMemo)((()=>N.level1.map((e=>({label:e,value:e})))),[N.level1]),S=(0,n.useMemo)((()=>N.level2.map((e=>({label:e,value:e})))),[N.level2]),k=(0,n.useMemo)((()=>N.level3.map((e=>({label:e,value:e})))),[N.level3]),[T,C]=(0,n.useState)(!1),[M,B]=(0,n.useState)(!1),[j,P]=(0,n.useState)(!1),[R,L]=(0,n.useState)(!1),[U,A]=(0,n.useState)(!1),$=(e=>e.find((({type:e})=>e===o.f.USER_SUBMIT_CONFIRM)))(i),F=(e=>e.find((({type:e})=>e===o.f.USER_SUBMIT_EMAIL)))(i),Z=(e=>e.find((({type:e})=>e===o.f.USER_SUBMIT_NAME)))(i),q=(e=>e.find((({type:e})=>e===o.f.USER_SUBMIT_PHONE)))(i),V=wi(i),K=xi(i)||V,Q=Boolean($),ee=Boolean(K||V),te=(0,n.useMemo)((()=>{const e={},t=(0,g.c)();return(null===F||void 0===F?void 0:F.key)&&t.email&&!(0,g.j)(t.email)&&(e[F.key]=t.email),(null===Z||void 0===Z?void 0:Z.key)&&(null===h||void 0===h?void 0:h.name)&&(e[Z.key]=h.name),(null===q||void 0===q?void 0:q.key)&&(null===h||void 0===h?void 0:h.phone)&&(null===h||void 0===h?void 0:h.area_code)&&(e[q.key]=(null===h||void 0===h?void 0:h.area_code)+h.phone),(null===K||void 0===K?void 0:K.key)&&(null===h||void 0===h?void 0:h.phone)&&(e[K.key]=h.area_code+h.phone,e.otpPhoneNumber=h.area_code+h.phone),null===d||void 0===d||d.forEach((t=>{ee&&(e=>e===o.E[o.f.USER_SUBMIT_OTP]||e===o.E[o.f.USER_SUBMIT_WHATSAPP])(t.control)?e.otpPhoneNumber=t.value:(e[t.key]=t.value,[o.E[o.f.USER_SUBMIT_DATE],o.E[o.f.USER_SUBMIT_DOB]].includes(t.control)&&(e[t.key]=f()(t.value,a.A).toDate()))})),e.otpPhoneNumber&&A(!0),e}),[]),ie=(0,n.useMemo)((()=>u&&v?{"data-event-category":"Service Connection","data-event-action":"Risk Screening Send OTP","data-event-label":y,"data-bot-id":u,"data-question-id":v}:{}),[u,v]),ne=(0,n.useMemo)((()=>u&&v?{"data-event-category":"Service Connection","data-event-action":"Risk Screening Verify OTP","data-event-label":y,"data-bot-id":u,"data-question-id":v}:{}),[u,v]),oe=(0,n.useMemo)((()=>p||(u&&v?{"data-event-category":"Service Connection","data-event-action":"Risk Screening User Info Submit","data-event-label":y,"data-bot-id":u,"data-question-id":v}:{})),[u,v,JSON.stringify(p)]),le=(0,n.useMemo)((()=>i.findIndex((e=>o.F.includes(e.type)))),[i]),ae=(0,n.useMemo)((()=>i.find((e=>o.f.USER_SUBMIT_ADDRESS===e.type))),[i]),se=(0,n.useMemo)((()=>i.find((e=>o.f.USER_SUBMIT_ADDRESS_PROVINCE===e.type))),[i]),ce=(0,n.useMemo)((()=>i.find((e=>o.f.USER_SUBMIT_ADDRESS_DISTRICT===e.type))),[i]),ue=(0,n.useMemo)((()=>i.find((e=>o.f.USER_SUBMIT_ADDRESS_COMMUNE===e.type))),[i]),{labelInputDate:me}=(0,n.useMemo)((()=>{const{dateFormat:e}=(null===a.I||void 0===a.I?void 0:a.I[_])||a.I["vi-VN"];return{dateFormat:e,labelInputDate:e.split("/").map((e=>x(null===o.C||void 0===o.C?void 0:o.C[e])))}}),[_,x]),ve=o.E,{register:pe,handleSubmit:ge,watch:be,formState:{errors:fe,isSubmitting:he},control:_e,setValue:Ee,setError:ye,clearErrors:xe,getValues:we,trigger:Ne}=(0,H.cI)({defaultValues:te}),Oe=be("confirm",!0),Ie=be("otpPhoneNumber",""),Se=e=>(0,l.a)(void 0,void 0,void 0,(function*(){var t,n;e.preventDefault();const o=we(),l=(0,z.parsePhoneNumber)(o.otpPhoneNumber);if((null===l||void 0===l?void 0:l.nationalNumber)&&(null===l||void 0===l?void 0:l.countryCallingCode)){C(!0);try{const e=yield(0,m.c)(de(V?re.POST_SEND_OTP_WHATSAPP:re.POST_SEND_OTP),"POST",{data:V?{phone_number:`+${l.countryCallingCode}${l.nationalNumber}`}:{phone_number:l.nationalNumber,area_code:`+${l.countryCallingCode}`}});C(!1);const{_status:o,_errorCode:a}=e;if(1===o)return R&&(P(!1),b.current.reset()),L(!0),void setTimeout((()=>{const e=document.querySelector(".input-otp-code");e&&(e.focus(),e.scrollIntoView({block:"center"}))}),100);if(0===o){const e=(()=>{const e=new Map;return e.set(Y.L.Vietnam,"S\u1ed1 \u0111i\u1ec7n tho\u1ea1i n\xe0y \u0111\xe3 \u0111\u01b0\u1ee3c x\xe1c minh."),e.set(Y.L.PhilippinesEnglish,"This phone number has been verified."),e.set(Y.L.Cambodia,"\u179b\u17c1\u1781\u1791\u17bc\u179a\u179f\u17d0\u1796\u17d2\u1791\u1793\u17c1\u17c7\u178f\u17d2\u179a\u17bc\u179c\u1794\u17b6\u1793\u1795\u17d2\u1791\u17c0\u1784\u1795\u17d2\u1791\u17b6\u178f\u17cb\u17d4"),e.set(Y.L.India,"\u0907\u0938 \u092b\u093c\u094b\u0928 \u0928\u0902\u092c\u0930 \u0915\u0940 \u092a\u0941\u0937\u094d\u091f\u093f \u0915\u0930 \u0926\u0940 \u0917\u0908 \u0939\u0948."),e.set(Y.L.Indonesia,"Nomor telepon ini telah diverifikasi."),e.set(Y.L.Malaysia,"Nombor telefon ini telah disahkan."),e.set(Y.L.Myanmar,"\u1024\u1016\u102f\u1014\u103a\u1038\u1014\u1036\u1015\u102b\u1010\u103a\u1000\u102d\u102f \u1005\u1005\u103a\u1006\u1031\u1038\u1015\u103c\u102e\u1038\u1015\u102b\u1015\u103c\u102e\u104b"),e.set(Y.L.Taiwan,"\u8a72\u96fb\u8a71\u865f\u78bc\u5df2\u7d93\u904e\u9a57\u8b49\u3002"),e.set(Y.L.Thailand,"\u0e2b\u0e21\u0e32\u0e22\u0e40\u0e25\u0e02\u0e42\u0e17\u0e23\u0e28\u0e31\u0e1e\u0e17\u0e4c\u0e19\u0e35\u0e49\u0e44\u0e14\u0e49\u0e23\u0e31\u0e1a\u0e01\u0e32\u0e23\u0e15\u0e23\u0e27\u0e08\u0e2a\u0e2d\u0e1a\u0e41\u0e25\u0e49\u0e27"),e.set(Y.L.PhilippinesTagalog,"Na-verify na ang numero ng teleponong ito."),e})();return w({title:"",message:x(null===Oi||void 0===Oi?void 0:Oi[a])||e.get(_)||e.get(Y.L.PhilippinesEnglish),type:"success"}),xe((null===(t=xi(i))||void 0===t?void 0:t.key)||(null===(n=wi(i))||void 0===n?void 0:n.key)),xe("otpPhoneNumber"),void A(!0)}if(-1===(null===e||void 0===e?void 0:e._status)){const{_messages:t}=e;return b.current&&b.current.cancel(),void w({title:"",message:t[0],type:"warning"})}if(!e||0===(null===e||void 0===e?void 0:e._status))return b.current&&b.current.cancel(),void ke()}catch(a){C(!1),b.current&&b.current.cancel(),ke()}}})),ke=()=>{w({title:"",message:x({id:"notification.comment.somethingWrong"}),type:"danger"})},Te=()=>n.createElement(yi,null,ae&&n.createElement("div",{className:"input-row",key:ae.id},n.createElement("label",{htmlFor:ae.key},ae.label),n.createElement("input",Object.assign({id:ae.id,placeholder:ae.label},pe((null===ae||void 0===ae?void 0:ae.key)||"",{required:!0}))),fe[(null===ae||void 0===ae?void 0:ae.key)||""]&&n.createElement("p",{className:"error-message"},x({id:"validation.error.requiredField",defaultMessage:"This field is required"}))),n.createElement("div",{className:"wrapper-address-lever"},se&&n.createElement("div",{className:"input-row",key:se.id},n.createElement("label",{htmlFor:se.key,className:ae?"hide-label":""},se.label),n.createElement("div",{style:{background:"#fff"},className:"address-input"},n.createElement(H.Qr,{name:se.key||"",control:_e,rules:{required:!0},render:e=>{var t;return n.createElement(J.D,{id:se.id,options:O,onChange:t=>{var i;e.field.onChange(t),i=t,(0,l.a)(void 0,void 0,void 0,(function*(){i&&i.value&&""!==i.value&&(N.setSelectedLevel1(i.value),Ee("district",""),Ee("commune",""))}))},value:e.field.value,placeholder:(null===se||void 0===se?void 0:se.label)||"",className:"address-dropdown "+((null===(t=e.field.value)||void 0===t?void 0:t.value)?"":"show-placeholder")})}})),fe[se.key||""]&&n.createElement("p",{className:"error-message"},x({id:"validation.error.requiredField",defaultMessage:"This field is required"}))),ce&&n.createElement("div",{className:"input-row",key:ce.id},n.createElement("label",{htmlFor:ce.key,className:ae?"hide-label":""},ce.label),n.createElement("div",{style:{background:"#fff"},className:"address-input"},n.createElement(H.Qr,{name:ce.key||"",control:_e,rules:{required:!0},render:e=>{var t;return n.createElement(J.D,{id:ce.id,options:S,onChange:t=>{var i;e.field.onChange(t),i=t,(0,l.a)(void 0,void 0,void 0,(function*(){i&&i.value&&""!==i.value&&(N.setSelectedLevel2(i.value),Ee("commune",""))}))},value:e.field.value,placeholder:(null===ce||void 0===ce?void 0:ce.label)||"",className:"address-dropdown "+((null===(t=e.field.value)||void 0===t?void 0:t.value)?"":"show-placeholder")})}})),fe[(null===ce||void 0===ce?void 0:ce.key)||""]&&n.createElement("p",{className:"error-message"},x({id:"validation.error.requiredField",defaultMessage:"This field is required"}))),ue&&n.createElement("div",{className:"input-row",key:ue.id},n.createElement("label",{htmlFor:ue.key,className:ae?"hide-label":""},ue.label),n.createElement("div",{style:{background:"#fff"},className:"address-input"},n.createElement(H.Qr,{name:ue.key||"",control:_e,rules:{required:!0},render:e=>{var t;return n.createElement(J.D,{id:ue.id,options:k,onChange:t=>{e.field.onChange(t)},value:e.field.value,placeholder:(null===ue||void 0===ue?void 0:ue.label)||"",className:"address-dropdown "+((null===(t=e.field.value)||void 0===t?void 0:t.value)?"":"show-placeholder")})}})),fe[ue.key||""]&&n.createElement("p",{className:"error-message"},x({id:"validation.error.requiredField",defaultMessage:"This field is required"}))))),Ce=(e,t)=>{var i;if(!e.key)return null;if(le===t)return Te();switch(e.type){case o.f.USER_SUBMIT_DROPDOWN:const t=e.url?e.url.split("\n"):[];return n.createElement("div",{className:"input-row",key:e.id},n.createElement("label",{htmlFor:e.key},e.label),n.createElement(H.Qr,{key:e.key,control:_e,name:e.key,rules:{required:!0},render:({field:i})=>n.createElement(D.S,Object.assign({searchable:!0,data:t,placeholder:e.label},i,{withinPortal:!0,zIndex:1e3}))}),fe[e.key]&&n.createElement("p",{className:"error-message"},x({id:"validation.error.requiredField",defaultMessage:"This field is required"})));case o.f.USER_SUBMIT_EMAIL:const a=/^(([^<>()[\]\\.,;:\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,}))$/;return n.createElement("div",{className:"input-row",key:e.id},n.createElement("label",{htmlFor:e.key},e.label),n.createElement("input",Object.assign({id:e.id,placeholder:e.label},pe(e.key,{required:!0,pattern:a}))),fe[e.key]&&n.createElement("p",{className:"error-message"},x("pattern"!==(null===(i=fe[e.key])||void 0===i?void 0:i.type)?{id:"validation.error.requiredField",defaultMessage:"This field is required"}:{id:"validation.error.validEmail",defaultMessage:"Please enter a valid email address."})));case o.f.USER_SUBMIT_NAME:return n.createElement("div",{className:"input-row",key:e.id},n.createElement("label",{htmlFor:e.key},e.label),n.createElement("input",Object.assign({id:e.id,placeholder:e.label},pe(e.key,{required:!0}))),fe[e.key]&&n.createElement("p",{className:"error-message"},x({id:"validation.error.requiredField",defaultMessage:"This field is required"})));case o.f.USER_SUBMIT_PHONE:return n.createElement("div",{className:"input-row",key:e.id},n.createElement("label",{htmlFor:e.key},e.label),n.createElement(H.Qr,{name:e.key,control:_e,rules:{required:!0,validate:e=>(0,z.isPossiblePhoneNumber)(e)},render:({field:{onChange:t,value:i}})=>n.createElement(z.default,{value:i,onChange:t,defaultCountry:r,id:e.id})}),fe[e.key]&&n.createElement("p",{className:"error-message"},x({id:"validation.error.validNumber",defaultMessage:"Please enter a valid number."})));case o.f.USER_SUBMIT_NUMBER:return n.createElement("div",{className:"input-row",key:e.id},n.createElement("label",{htmlFor:e.key},e.label),n.createElement("input",Object.assign({type:"number",id:e.id},pe(e.key,{required:!0}))),fe[e.key]&&n.createElement("p",{className:"error-message"},x({id:"validation.error.requiredField",defaultMessage:"This field is required"})));case o.f.USER_SUBMIT_DATE:return n.createElement("div",{className:"input-row",key:e.id},n.createElement("label",{htmlFor:e.key},e.label),n.createElement(H.Qr,{name:e.key,control:_e,rules:{required:{value:!0,message:x({id:"validation.error.requiredField",defaultMessage:"This field is required"})},validate:{ageRange:e=>Ni(e,he,x)}},render:({field:e,fieldState:t})=>{const{value:i,name:o,onChange:a}=e,r=(0,l._)(e,["value","name","onChange"]),{error:s}=t,d=!!s;return n.createElement("div",null,n.createElement(_i,null,n.createElement(W.I,Object.assign({},r,{defaultValue:i,onChange:e=>{a(e),Ne(o)},labelTuples:me,locale:_,error:d,className:"subot_input subot_input_date"}))),d&&n.createElement("p",{className:"error-message"},null===s||void 0===s?void 0:s.message))}}));case o.f.USER_SUBMIT_BMI:return n.createElement("div",{key:e.id},n.createElement("div",{className:"input-row",key:`${e.id}-weight`},n.createElement("label",{htmlFor:`${e.key}-weight`},x({id:"home.bmi.input.weight",defaultMessage:"Weight"})),n.createElement("input",Object.assign({type:"number",id:`${e.id}-weight`},pe(`${e.key}-weight`,{required:!0}))),fe[`${e.key}-weight`]&&n.createElement("p",{className:"error-message"},x({id:"validation.error.requiredField",defaultMessage:"This field is required"}))),n.createElement("div",{className:"input-row",key:`${e.id}-height`},n.createElement("label",{htmlFor:`${e.key}-height`},x({id:"home.bmi.input.height",defaultMessage:"Height"})),n.createElement("input",Object.assign({type:"number",id:`${e.id}-height`},pe(`${e.key}-height`,{required:!0}))),fe[`${e.key}-height`]&&n.createElement("p",{className:"error-message"},x({id:"validation.error.requiredField",defaultMessage:"This field is required"}))));case o.f.USER_SUBMIT_GENDER:return n.createElement("div",{className:"input-row",key:e.id},n.createElement("label",null,e.label),n.createElement("div",{className:"radio-group"},n.createElement("label",{className:"radio-label"},n.createElement("input",Object.assign({},pe(e.key,{required:!0}),{value:"female",id:`${e.id}-female`,type:"radio"})),n.createElement("span",null,x({id:"gender.female",defaultMessage:"Female"}))),n.createElement("label",{className:"radio-label"},n.createElement("input",Object.assign({},pe(e.key,{required:!0}),{value:"male",id:`${e.id}-male`,type:"radio"})),n.createElement("span",null,x({id:"gender.male",defaultMessage:"Male"})))),fe[e.key]&&n.createElement("p",{className:"error-message"},x({id:"validation.error.requiredField",defaultMessage:"This field is required"})));case o.f.USER_SUBMIT_TEXT:return n.createElement("div",{className:"input-row",key:e.id},n.createElement("label",{htmlFor:e.key},e.label),n.createElement("input",Object.assign({id:e.id,placeholder:e.label},pe(e.key,{required:!0}))),fe[e.key]&&n.createElement("p",{className:"error-message"},x({id:"validation.error.requiredField",defaultMessage:"This field is required"})));case o.f.USER_SUBMIT_OTP:case o.f.USER_SUBMIT_WHATSAPP:return n.createElement("div",null,n.createElement("div",{className:"input-row input-row--otp"},n.createElement("label",{htmlFor:"otpPhoneNumber"},e.label),n.createElement(H.Qr,{name:"otpPhoneNumber",control:_e,rules:{required:!0,validate:{valid:e=>(0,z.isPossiblePhoneNumber)(e),notClickSentOTP:e=>(0,z.isPossiblePhoneNumber)(e)&&U}},render:({field:{onChange:t,value:i}})=>{const o=!j&&R||T||U;return n.createElement(di,null,n.createElement(Pi,{value:i,onChange:t,defaultCountry:r,className:`input-row ${e.id}`,name:"otpPhoneNumber",disabled:o,placeholder:e.label,flagComponent:ji}),o&&n.createElement(li,{viewBox:"0 0 24 24",className:"icon-edit-phone",onClick:()=>{var e;Ee("otpPhoneNumber",""),Ee("otpCode",""),L(!1),A(!1),null===(e=b.current)||void 0===e||e.cancel()}}))}}),fe.otpPhoneNumber&&("notClickSentOTP"===fe.otpPhoneNumber.type?n.createElement("p",{className:"error-message"},(()=>{const e=new Map;return e.set(Y.L.Vietnam,"Vui l\xf2ng x\xe1c minh s\u1ed1 \u0111i\u1ec7n tho\u1ea1i"),e.set(Y.L.PhilippinesEnglish,"Please verify your phone number"),e.set(Y.L.Cambodia,"\u179f\u17bc\u1798\u1795\u17d2\u1791\u17c0\u1784\u1795\u17d2\u1791\u17b6\u178f\u17cb\u179b\u17c1\u1781\u1791\u17bc\u179a\u179f\u17d0\u1796\u17d2\u1791\u179a\u1794\u179f\u17cb\u17a2\u17d2\u1793\u1780\u17d4"),e.set(Y.L.India,"\u0915\u0943\u092a\u092f\u093e \u0905\u092a\u0928\u093e \u092b\u093c\u094b\u0928 \u0928\u0902\u092c\u0930 \u0938\u0924\u094d\u092f\u093e\u092a\u093f\u0924 \u0915\u0930\u0947\u0902"),e.set(Y.L.Indonesia,"Harap verifikasi nomor telepon AndaNomor telepon ini telah diverifikasi."),e.set(Y.L.Malaysia,"Sila sahkan nombor telefon anda"),e.set(Y.L.Myanmar,"\u101e\u1004\u1037\u103a\u1016\u102f\u1014\u103a\u1038\u1014\u1036\u1015\u102b\u1010\u103a\u1000\u102d\u102f \u1021\u1010\u100a\u103a\u1015\u103c\u102f\u1015\u102b\u104b"),e.set(Y.L.Taiwan,"\u8acb\u9a57\u8b49\u60a8\u7684\u96fb\u8a71\u865f\u78bc"),e.set(Y.L.Thailand,"\u0e01\u0e23\u0e38\u0e13\u0e32\u0e15\u0e23\u0e27\u0e08\u0e2a\u0e2d\u0e1a\u0e2b\u0e21\u0e32\u0e22\u0e40\u0e25\u0e02\u0e42\u0e17\u0e23\u0e28\u0e31\u0e1e\u0e17\u0e4c\u0e02\u0e2d\u0e07\u0e04\u0e38\u0e13"),e.set(Y.L.PhilippinesTagalog,"Paki-verify ang iyong numero ng telepono"),e})().get(_)):n.createElement("p",{className:"error-message"},x({id:"validation.error.validNumber",defaultMessage:"Please enter a valid number."}))),U?"":n.createElement(I.B,Object.assign({size:"sm",loading:T,disabled:!j&&R||T||!(0,z.isPossiblePhoneNumber)(Ie||""),onClick:Se,variant:"ghost",className:"btn-send-otp"},ie),R?n.createElement(ri,{ref:b,isFinished:j,onFinish:P}):n.createElement("span",null,x({id:"subot.sendOTP.button",defaultMessage:"Send OTP"})))),R&&n.createElement("div",{className:E()("input-row input-row--verify",{"verified-otp":U,"error-verify-otp":fe.otpCode})},n.createElement("label",{htmlFor:"otpCode"},"M\xe3 OTP"),n.createElement(H.Qr,{name:"otpCode",control:_e,rules:{required:!0,pattern:/^[0-9]{0,6}$/},render:({field:{onChange:e,value:t}})=>n.createElement("input",{onChange:e,value:t,type:"tel",disabled:U,className:"input-otp-code"})}),(null===fe||void 0===fe?void 0:fe.otpCode)&&n.createElement("p",{className:"error-message"},n.createElement(ai,null),fe.otpCode.message),U?n.createElement("div",{className:"verify-success"},n.createElement(oi,null),n.createElement("span",{className:"verify-success-label"},x({id:"subot.verifyOTP.success.message",defaultMessage:"Verified successful"}))):n.createElement(X.B,Object.assign({className:"submit-btn",size:c?"md":"lg",isLoading:M,isDisabled:!R,onClick:t=>((e,t)=>(0,l.a)(void 0,void 0,void 0,(function*(){e.preventDefault(),B(!0);const i=we(),n=(0,z.parsePhoneNumber)(i.otpPhoneNumber);if(t.key&&n){try{const e=yield(0,m.c)(de(V?re.POST_VERIFY_OTP_WHATSAPP:re.POST_VERIFY_OTP),"POST",{data:V?{code:i.otpCode,phone_number:`+${n.countryCallingCode}${n.nationalNumber}`}:{code:i.otpCode,phone_number:n.nationalNumber,area_code:`+${n.countryCallingCode}`}}),{_status:t,_messages:o}=e;if(1===t)return w({title:"",message:o[0],type:"success"}),xe("otpCode"),A(!0),void B(!1);throw new Error(JSON.stringify(e))}catch(o){const e=JSON.parse(o.message),{_errorCode:t}=e||{},i=x(null===Oi||void 0===Oi?void 0:Oi[t])||x({id:"validation.error.validOTP"});w({title:"",message:i,type:"danger"}),ye("otpCode",{type:"custom",message:i})}B(!1)}})))(t,e)},ne),x({id:"subot.verifyOTP.button",defaultMessage:"Verify OTP"}))));case o.f.USER_SUBMIT_GOOGLE_API_ADDRESS:return n.createElement(hi,{action:e,control:_e,formError:fe[e.key],key:e.id,initValue:null===te||void 0===te?void 0:te[e.key],onChange:Ee});case o.f.USER_SUBMIT_DOB:return n.createElement(Ri,{key:e.key,action:e,trigger:Ne,control:_e,locale:_,labelTuples:me,isSubmitting:he});default:return""}};return n.createElement(Ei,{className:e,style:t},n.createElement("form",{onSubmit:ge((e=>{ee&&!U||(null===e||void 0===e||delete e.confirm,G()(fe)&&(e=>{const t=[];for(const s of i)if(s.key&&s.type!==o.f.USER_SUBMIT_CONFIRM&&s.type!==o.f.USER_SUBMIT_TERMS)if(s.type===o.f.USER_SUBMIT_GOOGLE_API_ADDRESS){const i=e[s.key];fi.forEach((e=>{i[e]&&t.push({key:s.key,control:e,value:i[e]})}))}else if(s.type===o.f.USER_SUBMIT_ADDRESS_PROVINCE||s.type===o.f.USER_SUBMIT_ADDRESS_DISTRICT||s.type===o.f.USER_SUBMIT_ADDRESS_COMMUNE)t.push({key:s.key,control:ve[s.type]||"",value:e[s.key].label||""});else if(s.type===o.f.USER_SUBMIT_DOB||s.type===o.f.USER_SUBMIT_DATE){const i=e[s.key]||"",n=f()(i);n.isValid()&&t.push({key:s.key,control:ve[s.type]||"",value:n.format(a.A)})}else(n=s.type)===o.f.USER_SUBMIT_OTP||n===o.f.USER_SUBMIT_WHATSAPP?t.push({key:s.key,control:o.E[o.f.USER_SUBMIT_OTP],value:e.otpPhoneNumber}):s.type&&"bmi"===ve[s.type]?t.push({key:s.key,control:"bmi-weight",value:e[`${s.key}-weight`]||""},{key:s.key,control:"bmi-height",value:e[`${s.key}-height`]||""}):t.push({key:s.key,control:ve[s.type]||"",value:e[s.key]||""});var n;const l=i.filter((e=>e.type===o.f.USER_SUBMIT_SEND)),r={action_id:l[0].id,action_value:l[0].key,form_submit_meta:t.filter((({control:e})=>{switch(e){case"confirm":case"submit":case"terms":case"":return!1;default:return!0}}))};s(r)})(e))})),onFocus:e=>{const t=e.target;t&&t.scrollIntoView({block:"center",inline:"nearest",behavior:"auto"})},className:"user-info-form"},i.map(((e,t)=>Ce(e,t))),i.map((e=>(e=>{switch(e.type){case o.f.USER_SUBMIT_CONFIRM:return n.createElement("div",{className:"submit-btn-row",key:e.id},n.createElement("label",{className:"subot-checkbox"},n.createElement("input",Object.assign({},pe("confirm"),{type:"checkbox",defaultChecked:!0,className:"subot-checkbox__input"})),n.createElement("span",{className:"subot-checkbox__label"},n.createElement(tt,null,e.label))));case o.f.USER_SUBMIT_SEND:const t=!!Q&&!Oe;return n.createElement("div",{className:"submit-btn-row",key:e.id},n.createElement("button",Object.assign({id:e.id,className:"submit-btn",type:"submit",disabled:t},oe,{"data-response-id":e.id}),e.label));case o.f.USER_SUBMIT_TERMS:return n.createElement("div",{className:"form-terms",key:e.id},n.createElement(tt,null,e.label));default:return""}})(e)))))},Ui=N.Z.div` display: flex; flex-direction: column; gap: 24px; `,Ai=({node:e,indexNumber:t})=>{var i;const o=null===m.G||void 0===m.G?void 0:m.G.locale,{params:a,listNodes:r,activeId:s,onSubmit:d,setIsShowFooter:c}=(0,n.useContext)(Be);(0,n.useMemo)((()=>{c(!0)}),[]);return e?n.createElement(Ui,{id:"si-node-form"},n.createElement(Ft,{intents:e.intents||[],indexNumber:t}),n.createElement(Li,{isFormRevamp:!0,className:"si-form-revamp",actions:(null===e||void 0===e?void 0:e.actions)||[],formSubmitMeta:(null===(i=null===e||void 0===e?void 0:e._message)||void 0===i?void 0:i.form_submit_meta)||null,callBack:t=>(0,l.a)(void 0,void 0,void 0,(function*(){bt(r[0],t.form_submit_meta);const i=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},a),e._message),t),fe(r,s,t.action_id,t.form_submit_meta)),{node_id:e.id}),n=yield ce(i);if(1===(null===n||void 0===n?void 0:n._status)){const e=null===n||void 0===n?void 0:n._data,{node:o}=e,a=(0,l._)(e,["node"]),r=Object.assign(Object.assign({},o),{_message:Object.assign(Object.assign({},a),{node_id:o.id})});d&&d(r,Object.assign(Object.assign({},i),t))}})),countryCode:(null===o||void 0===o?void 0:o.split("-")[1])||"PH",botId:a.bot_id,nodeId:null===e||void 0===e?void 0:e.id})):null};Ai.displayName="subotInlineNodeForm";const $i=N.Z.div``,Di=N.Z.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); } ${O.M.mbUp} { gap: 32px; padding: 0 16px; .si-action-img-choice { width: calc(50% - 16px); } } } `,Fi=e=>n.createElement("svg",Object.assign({width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),n.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"}),n.createElement("path",{d:"M15.571 8 9.68 14 7 11.273",stroke:"#fff"})),Gi=(0,V.Z)(N.Z.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===A.r||void 0===A.r?void 0:A.r.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"),Hi=N.Z.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); } ${Gi.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; } `,zi=({action:e,active:t,onChange:i,htmlType:o})=>{const l=Ge(),{params:a}=(0,n.useContext)(Be);return n.createElement(Hi,{className:"si-action-img-choice",onClick:()=>i&&i(e),active:!!t,"data-event-category":"Service Connection","data-event-action":"Risk Screening Answer Click","data-event-label":l,"data-bot-id":a.bot_id},n.createElement("div",{className:"si-action-image-wrap"},n.createElement("img",{loading:"lazy",src:null===e||void 0===e?void 0:e.url,alt:null===e||void 0===e?void 0:e.label})),(null===e||void 0===e?void 0:e.label)&&n.createElement("div",{className:"si-label"},n.createElement(tt,null,null===e||void 0===e?void 0:e.label)),n.createElement(Gi,{active:!!t},"checkbox"===o&&n.createElement(Fi,{className:"icon-checkbox",viewBox:"0 0 22 22"})))};zi.displayName="SubotInlineActionImageChoice";const Zi=N.Z.div` text-align: center; margin-top: 24px; `,qi=({action:e,onChange:t})=>{const i=Ge(),{params:o,activeId:l}=(0,n.useContext)(Be);return n.createElement(Zi,null,n.createElement(I.B,{onClick:()=>t&&t(e),size:"lg","data-event-category":"Service Connection","data-event-action":"Risk Screening Sign Up for Result","data-event-label":i,"data-bot-id":o.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"}}},n.createElement(tt,null,null===e||void 0===e?void 0:e.label)))};qi.displayName="SubotInlineActionSSO";const Vi=N.Z.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?"\n border-bottom: 3px solid var(--subot-inline-primary-color);\n background-color: var(--subot-inline-primary-color-100);\n ":""}; &: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); } `,Yi={input:{"&:focus":{borderColor:"var(--subot-inline-primary-color) !important",boxShadow:"0px 0px 0px 2px var(--subot-inline-primary-color-300) !important"}}},Wi=({action:e,onChange:t,active:i,htmlType:l,formSubmitMeta:a})=>{const r=Ge(),s=(0,n.useRef)(null),[d,c]=(0,n.useState)(""),{params:u}=(0,n.useContext)(Be),m=(null===e||void 0===e?void 0:e.type)===o.f.POLL_CHOICE_TEXT_BY_INPUT,v=(null===e||void 0===e?void 0:e.type)===o.f.USER_CHOICE_TEXT_BY_INPUT||m;(0,n.useEffect)((()=>{var e,t;i&&(c((null===(e=null===a||void 0===a?void 0:a.find((e=>e.key===_e)))||void 0===e?void 0:e.value)||""),null===(t=s.current)||void 0===t||t.focus())}),[i,a]);return n.createElement(n.Fragment,null,n.createElement(Vi,{id:"si-action-text-choice",active:!!i,onClick:()=>null===t||void 0===t?void 0:t(e),"data-event-category":"Service Connection","data-event-action":"Risk Screening Answer Click","data-event-label":r,"data-bot-id":u.bot_id},n.createElement(Gi,{active:!!i},"checkbox"===l&&n.createElement(Fi,{className:"icon-checkbox",viewBox:"0 0 22 22"})),n.createElement("div",{className:"label"},null===e||void 0===e?void 0:e.label)),v&&i&&n.createElement(C.x,{px:"2px",style:{textAlign:"right"}},n.createElement(M.g,{ref:s,placeholder:null===e||void 0===e?void 0:e.label,styles:Yi,value:d,onChange:i=>{c(i.target.value),null===t||void 0===t||t(e,[{key:_e,control:"text",value:i.target.value,action_id:null===e||void 0===e?void 0:e.id}])},maxLength:360})))};Wi.displayName="SubotInlineActionTextChoice";const Xi=N.Z.div``,Ji=({action:e,onChange:t,active:i,htmlType:l})=>n.createElement(Xi,null,n.createElement(Wi,{active:!!i,action:e,onChange:e=>{e&&t&&t({key:null===e||void 0===e?void 0:e.key,control:o.E[null===e||void 0===e?void 0:e.type],value:"",action_id:null===e||void 0===e?void 0:e.id})},htmlType:l}));Ji.displayName="SubotInlinePollChoice";const Ki=({action:e,onChange:t,active:i,htmlType:l})=>n.createElement(zi,{active:!!i,action:e,onChange:e=>{e&&t&&t({key:null===e||void 0===e?void 0:e.key,control:o.E[null===e||void 0===e?void 0:e.type],value:"",action_id:null===e||void 0===e?void 0:e.id})},htmlType:l});Ki.displayName="SubotInlinePollChoiceImage";const Qi={[o.f.USER_CHOICE_TEXT]:Wi,[o.f.USER_CHOICE_TEXT_BY_INPUT]:Wi,[o.f.USER_CHOICE_IMAGE]:zi,[o.f.ACTION_SSO_REDIRECT]:qi,[o.f.POLL_CHOICE]:Ji,[o.f.POLL_CHOICE_TEXT_BY_INPUT]:Wi,[o.f.POLL_BUTTON]:()=>null,[o.f.POLL_CHOICE_IMAGE]:Ki},en=new Proxy(Qi,{get:(e,t)=>Qi[t]||(()=>$.y?null:n.createElement("p",null,"SubotInlineRevampActionBase ",t))}),tn=[o.f.USER_CHOICE_NEXT],nn=({actions:e,value:t,onChange:i,htmlType:l,node_type:a,formSubmitMeta:r})=>{const s=(0,n.useMemo)((()=>!!(null===e||void 0===e?void 0:e.find((e=>e.type===o.f.POLL_CHOICE_IMAGE)))),[e]),d=(0,n.useMemo)((()=>{switch(a){case o.d.IMAGE:case o.d.REACTION:return"si-two-columns";default:return s?"si-two-columns":""}}),[a]);return(null===e||void 0===e?void 0:e.length)?n.createElement(Di,{id:"si-action",className:d},null===e||void 0===e?void 0:e.map((e=>{const o=e.type;if(tn.includes(o))return null;const a=en[e.type];return a&&n.createElement(a,{key:e.id,action:e,onChange:i,active:null===t||void 0===t?void 0:t.includes(e.id),htmlType:l,formSubmitMeta:r})}))):null};nn.displayName="SubotInlineAction";const on=({node:e,indexNumber:t})=>{const{params:i,listNodes:o,activeId:a,onSubmit:r,setIsShowFooter:s,setLoading:d}=(0,n.useContext)(Be),{value:c,setValue:u}=(0,n.useContext)(Ye);(0,n.useMemo)((()=>{s(!0)}),[]),(0,n.useEffect)((()=>{u((null===e||void 0===e?void 0:e._message)||{})}),[]);return e?n.createElement($i,{id:"si-node-final"},n.createElement(Ft,{intents:e.intents||[],indexNumber:t}),n.createElement(nn,{node_type:null===e||void 0===e?void 0:e.type,value:(null===c||void 0===c?void 0:c.action_id)?[null===c||void 0===c?void 0:c.action_id]:[],actions:null===e||void 0===e?void 0:e.actions,onChange:t=>(0,l.a)(void 0,void 0,void 0,(function*(){if(!t)return;u(Object.assign(Object.assign({},c),{action_id:null===t||void 0===t?void 0:t.id,action_value:null===t||void 0===t?void 0:t.key}));const n=Object.assign(Object.assign(Object.assign(Object.assign({},i),c),{node_id:e.id,action_id:null===t||void 0===t?void 0:t.id,action_value:null===t||void 0===t?void 0:t.key}),fe(o,a,t.id));d(!0);const s=yield ce(n);if(d(!1),1===(null===s||void 0===s?void 0:s._status)){const e=null===s||void 0===s?void 0:s._data,{node:t}=e,i=(0,l._)(e,["node"]),o=Object.assign(Object.assign({},t),{_message:Object.assign(Object.assign({},i),{node_id:t.id})});r(o,n)}}))})):null};on.displayName="SubotinlineNodeImage";const ln=N.Z.div` display: flex; flex-direction: column; padding-bottom: 16px; gap: 24px; `,an=({node:e,indexNumber:t})=>{var i;const{setIsShowFooter:a,onChange:r}=(0,n.useContext)(Be),{value:s,setValue:d}=(0,n.useContext)(Ye);(0,n.useMemo)((()=>{a(!0)}),[]),(0,n.useEffect)((()=>{d((null===e||void 0===e?void 0:e._message)||{})}),[]),(0,n.useEffect)((()=>()=>{d({})}),[]);const c=(0,n.useMemo)((()=>{var t;const i=null===(t=null===e||void 0===e?void 0:e.actions)||void 0===t?void 0:t.find((({type:e})=>e==o.f.ACTION_MULTIPLE_BUTTON));return i||null}),[null===e||void 0===e?void 0:e.actions]),u=(0,n.useMemo)((()=>(null===s||void 0===s?void 0:s.selected_actions)?Object.keys(null===s||void 0===s?void 0:s.selected_actions):[]),[s,null===s||void 0===s?void 0:s.selected_actions]),m=null===(i=null===e||void 0===e?void 0:e.actions)||void 0===i?void 0:i.filter((e=>e.type!==o.f.ACTION_MULTIPLE_BUTTON));return n.createElement(ln,{id:"si-node-text"},n.createElement(Ft,{intents:(null===e||void 0===e?void 0:e.intents)||[],indexNumber:t}),n.createElement(nn,{value:u,actions:m,onChange:(e,t)=>(0,l.a)(void 0,void 0,void 0,(function*(){var i,n;if(e){const l=JSON.parse(JSON.stringify(Object.assign(Object.assign({},s),{action_id:null===c||void 0===c?void 0:c.id,action_value:null===c||void 0===c?void 0:c.key,selected_actions:Object.assign({},null===s||void 0===s?void 0:s.selected_actions)})));if((null===e||void 0===e?void 0:e.type)===o.f.POLL_CHOICE_TEXT_BY_INPUT||(null===e||void 0===e?void 0:e.type)===o.f.USER_CHOICE_TEXT_BY_INPUT){return(null===l||void 0===l?void 0:l.selected_actions)&&e.id in l.selected_actions?t?l.form_submit_meta=t:(delete l.form_submit_meta,null===(i=l.selected_actions)||void 0===i||delete i[e.id]):(null===e||void 0===e?void 0:e.id)&&(l.selected_actions=Object.assign(Object.assign({},l.selected_actions),{[e.id]:e.key||""})),d(l),void(null===r||void 0===r||r(l))}if(!(null===(n=l.selected_actions)||void 0===n?void 0:n[e.id]))return l.selected_actions=Object.assign(Object.assign({},l.selected_actions),{[e.id]:e.key||""}),r&&r(l),void d(l);if(l.selected_actions[e.id])return delete l.selected_actions[e.id],r&&r(l),void d(l)}})),formSubmitMeta:null===s||void 0===s?void 0:s.form_submit_meta}))};an.displayName="SubotInlineNodeMultipleContainer";const rn=({node:e})=>{const{formatMessage:t}=(0,n.useContext)(m.T);let i=t({id:"multiSelectError.required",defaultMessage:"You must choose one options"});return(null===e||void 0===e?void 0:e.multi_select_option)===o.g.UNLIMITED&&(i=t({id:"multiSelectError.unlimited",defaultMessage:"You must choose at least one options"})),(null===e||void 0===e?void 0:e.multi_select_option)===o.g.RANGE&&(i=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?void 0:e.multi_select_option)===o.g.EXACT_NUMBER&&(i=t({id:"multiSelectError.exactNumber",defaultMessage:"You must choose {from} answers."},{from:e.from})),i},sn=N.Z.div` .si-poll-description { font-style: italic; margin-bottom: 16px; } `,dn=({node:e,indexNumber:t})=>{const{onChange:i,setIsShowFooter:l}=(0,n.useContext)(Be),{value:a,setValue:r}=(0,n.useContext)(Ye),s=rn({node:e});(0,n.useMemo)((()=>{l(!0)}),[]),(0,n.useEffect)((()=>{r((null===e||void 0===e?void 0:e._message)||{})}),[]);const d=(0,n.useMemo)((()=>{var t;const i=null===(t=null===e||void 0===e?void 0:e.actions)||void 0===t?void 0:t.find((({type:e})=>e==o.f.POLL_BUTTON));return i||null}),[null===e||void 0===e?void 0:e.actions]),c=(0,n.useMemo)((()=>(null===a||void 0===a?void 0:a.form_submit_meta)?null===a||void 0===a?void 0:a.form_submit_meta.map((({action_id:e})=>e)):[]),[a,null===a||void 0===a?void 0:a.form_submit_meta]);return(0,n.useEffect)((()=>{console.log("adfsafsdf"),r(null===e||void 0===e?void 0:e._message)}),[]),n.createElement(sn,null,n.createElement(Ft,{intents:e.intents||[],indexNumber:t}),n.createElement("p",{className:"si-poll-description"},s),n.createElement(nn,{node_type:null===e||void 0===e?void 0:e.type,value:c,actions:null===e||void 0===e?void 0:e.actions,onChange:(t,n)=>{var l,s,c,u,m,v,p;const g=JSON.parse(JSON.stringify(Object.assign(Object.assign({},a),{node_id:e.id,action_id:null===d||void 0===d?void 0:d.id,action_value:null===d||void 0===d?void 0:d.key,form_submit_meta:[...(null===a||void 0===a?void 0:a.form_submit_meta)||[]]})));if((null===t||void 0===t?void 0:t.type)===o.f.POLL_CHOICE_TEXT_BY_INPUT||(null===t||void 0===t?void 0:t.type)===o.f.USER_CHOICE_TEXT_BY_INPUT){const e=null===(l=g.form_submit_meta)||void 0===l?void 0:l.some((({action_id:e})=>e===t.id));return g.form_submit_meta=e?"undefined"===typeof n?null===(s=g.form_submit_meta)||void 0===s?void 0:s.filter((({action_id:e})=>e!==t.id)):null===(c=g.form_submit_meta)||void 0===c?void 0:c.filter((({action_id:e})=>e!==t.id)).concat(n):null===(u=g.form_submit_meta)||void 0===u?void 0:u.concat([{key:null===t||void 0===t?void 0:t.key,control:o.E[null===t||void 0===t?void 0:t.type]||"text",value:"",action_id:null===t||void 0===t?void 0:t.id}]),r(g),void(null===i||void 0===i||i(g))}const b=null===(m=g.form_submit_meta)||void 0===m?void 0:m.some((({action_id:e})=>e===(null===t||void 0===t?void 0:t.action_id)));g.form_submit_meta=b?null===(v=g.form_submit_meta)||void 0===v?void 0:v.filter((({action_id:e})=>e!==(null===t||void 0===t?void 0:t.action_id))):null===(p=g.form_submit_meta)||void 0===p?void 0:p.concat([t]),r(g),null===i||void 0===i||i(g)},formSubmitMeta:null===a||void 0===a?void 0:a.form_submit_meta}))};dn.displayName="SubotinlineNodePoll";const cn=N.Z.div``,un=({node:e})=>{const t=(0,n.useRef)(!1),{formatMessage:i,data:{userInfo:l}}=(0,n.useContext)(m.T),{params:r,setIsShowFooter:s,listNodes:d,activeId:c}=(0,n.useContext)(Be);(0,n.useMemo)((()=>{s(!0)}),[]),(0,n.useEffect)((()=>{var i;const n=null===(i=null===e||void 0===e?void 0:e.actions)||void 0===i?void 0:i.find((e=>e.type===o.f.ACTION_SSO_REDIRECT));(null===l||void 0===l?void 0:l.id)&&n&&!t.current&&(t.current=!0,v(n))}),[null===l||void 0===l?void 0:l.id]);const{triggerLogin:u}=(0,K.u)(),v=t=>{if(r.bot_id&&t&&t.type===o.f.ACTION_SSO_REDIRECT){const i={params:Object.assign(Object.assign(Object.assign({},r),null===e||void 0===e?void 0:e._message),{action_id:null===t||void 0===t?void 0:t.id,action_value:null===t||void 0===t?void 0:t.key,mode:"inline"}),listNodes:d,activeId:c,createdAt:(new Date).getTime(),botId:r.bot_id};localStorage.setItem(Ee,JSON.stringify(i));const n=(0,Q.g)(window.location.href,{botItem:d[0]});n.searchParams.set("bot_id",String(r.bot_id)),n.searchParams.set("mode","inline"),n.searchParams.set("source","subot-inline");const o=n.href;(0,K.I)()?u({returnUrl:o,source:"subot-inline"}):window.location.href=`${a.j}?returnUrl=${encodeURIComponent(o)}`}};return e?n.createElement(cn,{id:"si-node-final"},n.createElement(Ft,{intents:[...(null===e||void 0===e?void 0:e.intents)||[],...(0,g.s)(i)]}),n.createElement(nn,{actions:null===e||void 0===e?void 0:e.actions,onChange:v})):null};un.displayName="SubotinlineNodeSSO";const mn=N.Z.div` display: flex; flex-direction: column; padding-bottom: 16px; gap: 24px; `,vn=({node:e,indexNumber:t})=>{const{params:i,onSubmit:a,setIsShowFooter:r,listNodes:s,activeId:d,setLoading:c,onChange:u}=(0,n.useContext)(Be),{value:m,setValue:v}=(0,n.useContext)(Ye);(0,n.useMemo)((()=>{r(!0)}),[]),(0,n.useEffect)((()=>{v((null===e||void 0===e?void 0:e._message)||{})}),[]),(0,n.useEffect)((()=>()=>{v({})}),[]);return n.createElement(mn,{id:"si-node-text"},n.createElement(Ft,{intents:(null===e||void 0===e?void 0:e.intents)||[],indexNumber:t}),n.createElement(nn,{value:(null===m||void 0===m?void 0:m.action_id)?[null===m||void 0===m?void 0:m.action_id]:[],actions:null===e||void 0===e?void 0:e.actions,onChange:(t,n)=>(0,l.a)(void 0,void 0,void 0,(function*(){if(!t)return;const r=(null===t||void 0===t?void 0:t.type)===o.f.USER_CHOICE_TEXT_BY_INPUT||(null===t||void 0===t?void 0:t.type)===o.f.POLL_CHOICE_TEXT_BY_INPUT,p=Object.assign(Object.assign({},m),{action_id:null===t||void 0===t?void 0:t.id,action_value:null===t||void 0===t?void 0:t.key,form_submit_meta:n});if(r)return v(p),void(null===u||void 0===u||u(p));delete p.form_submit_meta,v(p),(t=>{(0,l.a)(void 0,void 0,void 0,(function*(){const n=Object.assign(Object.assign(Object.assign(Object.assign({},i),m),{node_id:e.id,action_id:null===t||void 0===t?void 0:t.id,action_value:null===t||void 0===t?void 0:t.key,form_submit_meta:void 0}),fe(s,d,t.id));c(!0);const o=yield ce(n);if(c(!1),1===(null===o||void 0===o?void 0:o._status)){const e=null===o||void 0===o?void 0:o._data,{node:t}=e,i=(0,l._)(e,["node"]),r=Object.assign(Object.assign({},t),{_message:Object.assign(Object.assign({},i),{node_id:t.id})});a(r,n)}}))})(t)})),formSubmitMeta:null===m||void 0===m?void 0:m.form_submit_meta}))};vn.displayName="SubotInlineNodeTextContainer";const pn={TEXT:vn,IMAGE:on,FORM:Ai,FINAL_STANDARD:Xt,FINAL:Gt,FINAL_THANK_YOU:Kt,SSO:un,MULTIPLE:an,POLL:dn},gn=new Proxy(pn,{get:(e,t)=>pn[t]||(()=>$.y?null:n.createElement(n.Fragment,null,"SubotInlineNodeBase ",t))}),bn=({onClickStart:e})=>{var t;const{listNodes:i,activeId:l,isDisabledAnimationOnMobile:a}=(0,n.useContext)(Be),r=(0,n.useMemo)((()=>i.findIndex((e=>e.id==l))),[i,l]),s=i[r];if(!s)return null;if(s.hasOwnProperty("first_node"))return a?n.createElement(st,{node:s,onClickStart:e}):n.createElement(w.E.div,{key:s.id,initial:{opacity:0},animate:{opacity:1},transition:{y:{type:"spring",stiffness:300,damping:30},opacity:{duration:.2}}},n.createElement(st,{node:s,onClickStart:e}));const d=s,c=o.d[d.type].valueOf(),u=null===(t=o.c[d.position])||void 0===t?void 0:t.valueOf();let m=d.position===o.c.SSO?gn[u]:gn[c];return d.is_multi_select&&d.type!==o.d.POLL&&(m=gn.MULTIPLE),n.createElement(w.E.div,{key:d.id,initial:{opacity:1,y:-300},animate:{opacity:1,y:0},transition:{y:{type:"spring",stiffness:300,damping:30},opacity:{duration:.2}}},n.createElement(m,{indexNumber:r,node:d}))};function fn(e){let t="";return e&&(t=Object.keys(e).map((t=>t+"="+e[t])).join("&")),t}bn.displayName="SubotInlineNodeContainer";const hn=({typeFormProps:e,locale:t})=>(null===e||void 0===e?void 0:e.id)?n.createElement(C.x,{component:"iframe",src:`https://${$.y?"":"discover."}${h.v[t]}/typeform.html?id=${e.id}&${fn(e.params)}`,width:"100%",height:"100%",sx:{display:"block",border:"none",borderRadius:"inherit"},allowFullScreen:!0}):null,_n={type:"spring",damping:25,stiffness:120},En=(0,n.memo)((({loading:e,backgroundImage:t,isShowFooter:i,isFullContainer:o,isDisabledAnimationOnMobile:l,subotSettingData:a,onCloseMobile:r,bgImgFullContainer:s,typeFormProps:d})=>{const c=(0,n.useMemo)((()=>({backgroundImage:t?`url("${t}")`:void 0,backgroundRepeat:"no-repeat",backgroundPosition:"center"})),[t]),{isMobile:u,locale:m}=(0,n.useContext)(Be),[v,p]=(0,n.useState)(!1);(0,n.useEffect)((()=>{v?document.body.classList.add("si-open-overflow"):document.body.classList.remove("si-open-overflow")}),[v]),(0,n.useEffect)((()=>()=>{document.body.classList.remove("si-open-overflow")}),[]);const g=v||l,b=n.createElement(Le,null,n.createElement(w.E.div,{style:c,layout:!0,transition:l?void 0:_n,className:E()("si-inline-revamp-container",{"si-container-open":g,"si-full-container-config":o,"si-typeform":Boolean(d)})},g&&!d&&n.createElement("button",{className:"si-close-btn",onClick:()=>{console.log("onClosemobile",r),p(!1),null===r||void 0===r||r()}},n.createElement(Pe,null)),d&&m?n.createElement(hn,{locale:m,typeFormProps:d}):n.createElement(We,null,n.createElement("div",{className:"subot-inline-revamp-container","data-show-footer":i},e&&!i&&n.createElement(x.L,{className:"si-loading"}),n.createElement(bn,{onClickStart:()=>{p(!0)}})),i&&n.createElement(Qe,null))),n.createElement("div",{className:"si-container-placeholder"})),f=(0,n.useMemo)((()=>{if(s)return{backgroundImage:`url("${s}")`,backgroundSize:"cover",backgroundRepeat:"no-repeat",backgroundPosition:"center"}}),[s]);return o?n.createElement(Ue,{className:"si-container-fs",style:f},n.createElement(y.C,{className:"si-container "+(d?"si-typeform-container":"")},n.createElement("div",{className:"si-revamp-left"},n.createElement(ot,{layout:d&&m&&!u?"horizontal":"vertical",subotSettingData:a}),!d&&n.createElement(Fe,null)),n.createElement("div",{className:"si-revamp-right"},b),d&&n.createElement(Fe,null))):b}));En.displayName="SubotInlineRevampView";const yn=()=>{const{loading:e,listNodes:t,isShowFooter:i,activeId:l,isFullContainer:a,isDisabledAnimationOnMobile:r,onCloseMobile:s,userInfo:d,bgImgFullContainer:c,typeFormProps:u}=(0,n.useContext)(Be),m=(0,n.useMemo)((()=>{var e,i;const n=t.find((e=>e.id==l));return n?n.inline_background||(null===(i=null===(e=n.intents)||void 0===e?void 0:e.find((e=>e.type===o.N.BOT_BACKGROUND_IMAGE)))||void 0===i?void 0:i.url):""}),[t,l]),v=(0,n.useMemo)((()=>{const e=t[0];return{inlineImage:(null===e||void 0===e?void 0:e.inline_image)||"",inilneHeadline:(null===e||void 0===e?void 0:e.inline_headline)||"",reviewByAvatar:(null===e||void 0===e?void 0:e.inline_avatar)||"",reviewByName:(null===e||void 0===e?void 0:e.inline_review)||"",reviewBySpecialty:(null===e||void 0===e?void 0:e.inline_speciality)||"",reviewByHospital:(null===e||void 0===e?void 0:e.inline_hospital_name)||""}}),[t[0]]);if(void 0===d||!t[0])return null;const p={loading:e,backgroundImage:m,bgImgFullContainer:c,isShowFooter:i,isFullContainer:a,isDisabledAnimationOnMobile:r,subotSettingData:v,onCloseMobile:s,typeFormProps:u};return n.createElement(En,Object.assign({},p))};yn.displayName="SubotInlineRevamp";const xn=e=>n.createElement(je,Object.assign({},e,{subotId:Number(e.id)}),n.createElement(yn,null)),wn=e=>{var t,i,o,a,r,s,d,c,u,m,v,p;const[g,b]=(0,n.useState)(null);return(0,n.useEffect)((()=>{(0,l.a)(void 0,void 0,void 0,(function*(){const t=yield Promise.resolve().then((function(){return ml})).then((e=>e.subotInlineFirstNode)),i=yield t(e.id);b((null===i||void 0===i?void 0:i._data)||null)}))}),[e.id]),g?n.createElement(xn,Object.assign({},e,{primaryColor:null===(i=null===(t=g.extra_settings)||void 0===t?void 0:t.inline_styles)||void 0===i?void 0:i.primary_color,textColor:null===(a=null===(o=g.extra_settings)||void 0===o?void 0:o.inline_styles)||void 0===a?void 0:a.text_color,textButtonColor:null===(s=null===(r=g.extra_settings)||void 0===r?void 0:r.inline_styles)||void 0===s?void 0:s.text_button_color,bgColor:null===(c=null===(d=g.extra_settings)||void 0===d?void 0:d.inline_styles)||void 0===c?void 0:c.container_bg_color,bgContentColor:null===(m=null===(u=g.extra_settings)||void 0===u?void 0:u.inline_styles)||void 0===m?void 0:m.content_bg_color,bgImgFullContainer:null===(p=null===(v=g.extra_settings)||void 0===v?void 0:v.inline_styles)||void 0===p?void 0:p.container_bg_image})):null},Nn=(0,n.createContext)({activeId:"",params:{},nodes:[],getParams:()=>({}),trackingCommonInline:{}}),On=e=>(0,l.a)(void 0,void 0,void 0,(function*(){try{return yield(0,m.c)(de(re.GET_INLINE_MESSAGE),"POST",{data:e})}catch(t){}})),In=e=>(0,l.a)(void 0,void 0,void 0,(function*(){try{const t=yield(0,m.c)(de(re.GET_INLINE_FIRST_NODE)+`/${e}`,"GET");return(e=>{var t;if(1===(null===e||void 0===e?void 0:e._status)&&(null===(t=null===e||void 0===e?void 0:e._data)||void 0===t?void 0:t.extra_settings))try{const t=JSON.parse(e._data.extra_settings);e._data.extra_settings="object"===typeof t?t:{sync_data_friso_campaign:!1}}catch(i){e._data.extra_settings={sync_data_friso_campaign:!1}}})(t),t}catch(t){}})),Sn=N.Z.div` margin-top: 2rem; .form { background-color: ${A.r.colors.white||"#fff"}; } `,kn=N.Z.div``,Tn=N.Z.div` margin-top: 1.25rem; `,Cn=N.Z.div` margin-bottom: 1rem; `,Mn=N.Z.div` font-weight: 400; font-size: 16px; line-height: 24px; color: #595959; font-style: italic; `,Bn=(0,N.Z)(X.B)` position: relative; min-width: 180px; svg { path { stroke: currentColor; } } &:hover { svg { path { stroke: currentColor; } } } `,jn=N.Z.div` display: flex; align-items: center; justify-content: center; `,Pn=N.Z.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, ${A.r.colors.neutral50||"#F7F9FC"} 0%, transparent 100% ); content: ''; pointer-events: none; ${({isMore:e})=>e&&"opacity: 0;"} } `,Rn=N.Z.div` position: relative; padding: 32px 32px 16px; background-color: ${A.r.colors.neutral50||"#F7F9FC"}; border-radius: ${A.r.borderRadius}; ${O.M.tdDown} { padding: 24px 24px 16px; } ${O.M.mbDown} { padding: 16px; border-radius: 0px; } `,Ln=N.Z.div` padding: 12px 32px 32px; ${O.M.tdDown} { padding: 12px 24px 24px; } ${O.M.mbDown} { padding: 12px 16px 16px; } `,Un=N.Z.div` border: 1px solid ${A.r.colors.neutral100||"#E4E8EC"}; background-color: ${A.r.colors.neutral50||"#F7F9FC"}; border-radius: ${A.r.borderRadius}; ${O.M.mbDown} { border: none; } `,An=e=>n.createElement("svg",Object.assign({width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),n.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"}),n.createElement("path",{d:"M15.5714 8L9.67857 14L7 11.2727",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})),$n=e=>n.createElement("svg",Object.assign({width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),n.createElement("path",{d:"M13.3346 4L6.0013 11.3333L2.66797 8",stroke:"#737373",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})),Dn=e=>n.createElement("svg",Object.assign({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),n.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"}),n.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"})),Fn=e=>n.createElement("svg",Object.assign({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),n.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"}),n.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"})),Gn=e=>n.createElement("svg",Object.assign({width:"10",height:"6",viewBox:"0 0 10 6",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),n.createElement("path",{d:"M1 1L5 5L9 1",stroke:"#595959",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})),Hn=e=>n.createElement("svg",Object.assign({width:"7",height:"10",viewBox:"0 0 7 10",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),n.createElement("path",{d:"M5.5 9L1.5 5L5.5 1",stroke:"#2D87F3",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})),zn=e=>n.createElement("svg",Object.assign({width:"7",height:"10",viewBox:"0 0 7 10",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),n.createElement("path",{d:"M1.5 9L5.5 5L1.5 1",stroke:"#2D87F3",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})),Zn=e=>n.createElement("svg",Object.assign({width:"10",height:"6",viewBox:"0 0 10 6",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),n.createElement("path",{d:"M1 5L5 1L9 5",stroke:"#FC5D9A",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"})),qn=e=>n.createElement("svg",Object.assign({width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),n.createElement("path",{d:"M6 12L10 8L6 4",stroke:"#2D87F3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})),Vn=e=>n.createElement("svg",Object.assign({width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),n.createElement("g",{clipPath:"url(#clip0)"},n.createElement("path",{d:"M0.666626 2.6665V6.6665H4.66663",stroke:"#737373",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round"}),n.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"})),n.createElement("defs",null,n.createElement("clipPath",{id:"clip0"},n.createElement("rect",{width:"16",height:"16",fill:"white"}))));var Yn,Wn,Xn,Jn,Kn,Qn,eo;const to=N.Z.div` display: flex; align-items: center; justify-content: center; padding: 12px 24px; border: 1px solid ${A.r.colors.neutral100||"#E4E8EC"}; background-color: ${A.r.colors.white||"white"}; border-radius: 32px; cursor: pointer; transition: 0.25s all linear; svg { height: 16px; margin-right: 3px; } &:hover { background-color: ${A.r.colors.neutral100}; } &.active { background-color: ${A.r.colors.primaryActive}; color: ${A.r.colors.white||"#fff"}; svg { stroke: ${A.r.colors.white||"#fff"}; } } `,io=N.Z.div` padding: 12px 24px; border: 1px solid ${A.r.colors.neutral100||"#E4E8EC"}; background-color: ${A.r.colors.white||"white"}; border-radius: 32px; cursor: pointer; transition: 0.25s all linear; &.active { background-color: ${null===(Yn=A.r.colors)||void 0===Yn?void 0:Yn.primaryActive}; color: ${A.r.colors.white||"#fff"}; svg { stroke: ${A.r.colors.white||"#fff"}; } } `,no=N.Z.div` display: flex; align-items: center; padding: 16px 24px; border: 1px solid ${({active:e})=>e?A.r.colors.primaryBase||"#2685F1":A.r.colors.white||"#fff"}; background-color: ${A.r.colors.white||"#fff"}; border-radius: ${A.r.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?A.r.colors.primaryBase||"#2685F1":A.r.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: ${A.r.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===(Wn=A.r.colors)||void 0===Wn?void 0:Wn.primaryBase)||"#2685F1"}; .icon { &:before { border-color: ${(null===(Xn=A.r.colors)||void 0===Xn?void 0:Xn.primaryBase)||"#2685F1"}; transition: 0.2s linear all; } } } ${O.M.tdDown} { padding: 16px 20px; } `,oo=(0,N.Z)(no)` position: relative; flex-wrap: wrap; padding: 16px; background-color: ${(null===(Jn=A.r.colors)||void 0===Jn?void 0:Jn.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; } } ${O.M.tdDown} { padding: 12px; .label { margin-top: 12px; } .icon { top: 1.3rem; right: 1.3rem; } } ${O.M.tdDown} { padding: 8px; .label { margin-top: 8px; } .icon { top: 0.9rem; right: 0.9rem; } } `,lo=N.Z.div` display: flex; align-items: center; justify-content: flex-start; ${O.M.tdDown} { justify-content: center; } `,ao=N.Z.div` textarea { background-color: ${(null===(Kn=A.r.colors)||void 0===Kn?void 0:Kn.white)||"#fff"}; } `,ro=N.Z.div` margin-top: 20px; color: ${(null===(Qn=A.r.colors)||void 0===Qn?void 0:Qn.gray500)||"#737373"}; font-weight: 600; `,so=N.Z.div` position: relative; z-index: 0; display: flex; overflow: hidden; align-items: center; padding: 16px 20px; border-radius: ${A.r.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?A.r.colors.primary50||"#E3F2FF":A.r.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===(eo=A.r.colors)||void 0===eo?void 0:eo.white)||"#fff"}; content: ''; } ${O.M.mbDown} { padding: 6px 16px; } `,co=N.Z.div` width: ${({width:e})=>e||"100%"}; padding: 4px; &.item-image-container { padding: 16px; ${O.M.tdDown} { padding: 7.5px; } ${O.M.mbDown} { width: 50%; } } `,uo=N.Z.div` display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: center; margin: -4px; &.list-container { margin: -16px; ${O.M.tdDown} { margin: -7.5px; } } &.review-container { margin: -8px; > div { padding: 8px; } } `,mo=({actions:e,value:t,onChange:i,htmlType:l,node_type:a,formSubmitMeta:r})=>{const s=(0,n.useMemo)((()=>{switch(a){case o.d.IMAGE:case o.d.REACTION:return"list-container";default:return""}}),[a]);return n.createElement(n.Fragment,null,e&&!!(null===e||void 0===e?void 0:e.length)&&n.createElement(uo,{className:s},null===e||void 0===e?void 0:e.map((e=>{const o=_o[null===e||void 0===e?void 0:e.type];return o&&n.createElement(o,{key:e.id,action:e,onChange:i,active:null===t||void 0===t?void 0:t.includes(e.id),htmlType:l,formSubmitMeta:r})}))))},vo=(0,N.Z)(X.B)` &:disabled { background-color: rgb(242, 242, 242); color: rgb(140, 140, 140); &:hover { border: 0; } } svg { path { stroke: currentColor; } } `,po=(0,N.Z)(vo)` &:disabled { background-color: rgb(242, 242, 242); color: rgb(140, 140, 140); &:hover { border: 0; } } svg { path { stroke: currentColor; } } `,go=N.Z.div` display: flex; align-items: center; justify-content: flex-end; padding: 16px 32px; border-top: 4px solid ${A.r.colors.neutral100||"#E4E8EC"}; .mantine-Button-root { + .mantine-Button-root { margin-left: 8px; } } ${O.M.tdDown} { padding: 12px 24px; } ${O.M.mbDown} { padding: 12px 16px; } `,bo=({action:e,onChange:t,active:i,htmlType:l,formSubmitMeta:a})=>{const{trackingCommonInline:r}=(0,n.useContext)(Nn),s=(0,n.useRef)(null),[d,c]=(0,n.useState)(""),u=(null===e||void 0===e?void 0:e.type)===o.f.POLL_CHOICE_TEXT_BY_INPUT,m=(null===e||void 0===e?void 0:e.type)===o.f.USER_CHOICE_TEXT_BY_INPUT||u;return(0,n.useEffect)((()=>{var e,t;i&&(c((null===(e=null===a||void 0===a?void 0:a.find((e=>e.key===_e)))||void 0===e?void 0:e.value)||""),null===(t=s.current)||void 0===t||t.focus())}),[i,a]),n.createElement(co,null,n.createElement(no,Object.assign({active:!!i,onClick:()=>null===t||void 0===t?void 0:t(e),className:"pointer-event-child-none"},r,{"data-response-id":null===e||void 0===e?void 0:e.id,"data-event-action":"Answer Click"}),n.createElement("div",{className:"label"},n.createElement(tt,null,null===e||void 0===e?void 0:e.label)),n.createElement("div",{className:"icon"},"checkbox"===l&&n.createElement(An,{className:"icon-checkbox",viewBox:"0 0 22 22"}))),m&&i&&n.createElement(C.x,{mt:"6px",style:{textAlign:"right"}},n.createElement(M.g,{ref:s,placeholder:null===e||void 0===e?void 0:e.label,styles:{input:{paddingLeft:"24px",paddingRight:"24px",boxShadow:"none",":focus":{boxShadow:"none"}}},value:d,onChange:i=>{c(i.target.value),m&&(null===t||void 0===t||t(e,[{key:_e,control:o.E[null===e||void 0===e?void 0:e.type]||"text",value:i.target.value,action_id:e.id}]))},maxLength:360})))},fo=({action:e,onChange:t,active:i,htmlType:o})=>{const{trackingCommonInline:l}=(0,n.useContext)(Nn);return n.createElement(co,{width:"45%",className:"item-image-container"},n.createElement(oo,Object.assign({onClick:()=>t&&t(e),active:!!i},l,{"data-response-id":null===e||void 0===e?void 0:e.id,"data-event-action":"Answer Click"}),n.createElement("div",{className:"image-container"},n.createElement("img",{loading:"lazy",src:null===e||void 0===e?void 0:e.url,alt:null===e||void 0===e?void 0:e.label,className:"image"})),(null===e||void 0===e?void 0:e.label)&&n.createElement("div",{className:"label"},n.createElement(tt,null,null===e||void 0===e?void 0:e.label)),n.createElement("div",{className:"icon"},"checkbox"===o&&n.createElement(An,{className:"icon-checkbox",viewBox:"0 0 22 22"}))))},ho=({action:e,value:t,onChange:i})=>n.createElement(co,null,n.createElement(ao,null,n.createElement(ee.T,{placeholder:null===e||void 0===e?void 0:e.label,value:t&&"string"!==typeof t&&(null===t||void 0===t?void 0:t.value)?null===t||void 0===t?void 0:t.value:"",onChange:t=>{const n={key:null===e||void 0===e?void 0:e.key,control:o.E[null===e||void 0===e?void 0:e.type],value:t.target.value,action_id:null===e||void 0===e?void 0:e.id};i&&i(n)}}))),_o={"user-image":fo,[o.f.USER_CHOICE_TEXT]:bo,[o.f.USER_CHOICE_TEXT_BY_INPUT]:bo,[o.f.USER_CHOICE_IMAGE]:fo,[o.f.ACTION_SSO_REDIRECT]:({action:e,onChange:t})=>{const{trackingCommonInline:i}=(0,n.useContext)(Nn);return n.createElement(co,{width:"50%",style:{alignSelf:"center"}},n.createElement(vo,Object.assign({onClick:()=>t&&t(e),size:"lg",isBlock:!0},i,{className:"pointer-event-child-none","data-event-action":"Login Click","data-response-id":null===e||void 0===e?void 0:e.id}),n.createElement(tt,null,null===e||void 0===e?void 0:e.label)))},[o.f.POLL_CHOICE]:({active:e,action:t,onChange:i,htmlType:l,node_type:a})=>a===o.d.RESULT_POLL?n.createElement(co,null,n.createElement(so,{percent:(null===t||void 0===t?void 0:t.percent)||0,is_chosen:null===t||void 0===t?void 0:t.is_chosen},n.createElement("div",{className:"number"},null===t||void 0===t?void 0:t.percent,"%"),n.createElement("div",{className:"content"},null===t||void 0===t?void 0:t.label),n.createElement("div",{className:"icon"},(null===t||void 0===t?void 0:t.is_chosen)&&n.createElement($n,{viewBox:"0 0 16 16"})))):n.createElement(bo,{active:!!e,action:t,onChange:e=>{e&&i&&i({key:(null===e||void 0===e?void 0:e.key)||"",control:o.E[null===e||void 0===e?void 0:e.type],value:"",action_id:null===e||void 0===e?void 0:e.id})},htmlType:l}),[o.f.POLL_CHOICE_TEXT_BY_INPUT]:bo,[o.f.POLL_CHOICE_IMAGE]:({active:e,action:t,onChange:i,htmlType:l,node_type:a})=>a===o.d.RESULT_POLL?n.createElement(co,null,n.createElement(so,{percent:(null===t||void 0===t?void 0:t.percent)||0,is_chosen:null===t||void 0===t?void 0:t.is_chosen},n.createElement("div",{className:"number"},null===t||void 0===t?void 0:t.percent,"%"),n.createElement("div",{className:"content"},null===t||void 0===t?void 0:t.label),n.createElement("div",{className:"icon"},(null===t||void 0===t?void 0:t.is_chosen)&&n.createElement($n,{viewBox:"0 0 16 16"})))):n.createElement(fo,{active:!!e,action:t,onChange:e=>{e&&i&&i({key:null===e||void 0===e?void 0:e.key,control:o.E[null===e||void 0===e?void 0:e.type],value:"",action_id:null===e||void 0===e?void 0:e.id})},htmlType:l}),[o.f.RATING_STAR]:({action:e,value:t,onChange:i})=>{var l,a;return n.createElement(co,null,n.createElement(lo,null,n.createElement(te.Z,{rating:t&&"string"!==typeof t&&(null===t||void 0===t?void 0:t.value)?parseInt(null===t||void 0===t?void 0:t.value):0,changeRating:t=>{const n={key:null===e||void 0===e?void 0:e.key,control:o.E[null===e||void 0===e?void 0:e.type],value:t.toString(),action_id:null===e||void 0===e?void 0:e.id};i&&i(n)},starHoverColor:null===(l=null===A.r||void 0===A.r?void 0:A.r.colors)||void 0===l?void 0:l.yellow600,starRatedColor:null===(a=null===A.r||void 0===A.r?void 0:A.r.colors)||void 0===a?void 0:a.yellow600,starDimension:"48"})))},[o.f.RATING_DESCRIPTION]:ho,[o.f.LIKE_CHOICE]:({action:e,active:t,onChange:i})=>n.createElement(co,{width:"40%",className:"item-image-container"},n.createElement(to,{className:E()(!!t&&"active"),onClick:()=>i&&i(e)},n.createElement(Dn,{viewBox:"0 0 24 24"}),n.createElement(tt,null,null===e||void 0===e?void 0:e.label))),[o.f.DISLIKE_CHOICE]:({action:e,active:t,onChange:i})=>n.createElement(co,{width:"40%",className:"item-image-container"},n.createElement(to,{className:E()(!!t&&"active"),onClick:()=>i&&i(e)},n.createElement(Fn,{viewBox:"0 0 24 24"}),n.createElement(tt,null,null===e||void 0===e?void 0:e.label))),[o.f.REVIEW_CHOICE]:({active:e,action:t,onChange:i})=>n.createElement(co,{width:"auto",className:"review-choice"},n.createElement(io,{className:E()(!!e&&"active"),onClick:()=>i&&i({key:null===t||void 0===t?void 0:t.key,control:o.E[null===t||void 0===t?void 0:t.type],value:"",action_id:null===t||void 0===t?void 0:t.id})},n.createElement(tt,null,null===t||void 0===t?void 0:t.label))),[o.f.REVIEW_DESCRIPTION]:ho,[o.f.RESULT_BUTTON]:bo,[o.f.POLL_RESULT]:({action:e})=>n.createElement(co,null,n.createElement(ro,null,null===e||void 0===e?void 0:e.label))};var Eo=(0,n.memo)((({onBack:e,onNext:t,hideBack:i,hideNext:l,nextText:a,backProps:r,nextProps:s})=>{var d,c,u;const{formatMessage:v}=(0,n.useContext)(m.T),{nodes:p,activeId:g,params:b,onNext:f,trackingCommonInline:h}=(0,n.useContext)(Nn),_=p.find((e=>e.id==g)),y=null===(d=null===_||void 0===_?void 0:_.actions)||void 0===d?void 0:d.find((e=>e.type===o.f.USER_CHOICE_NEXT)),x=null===(c=null===_||void 0===_?void 0:_.actions)||void 0===c?void 0:c.find((e=>e.type===o.f.ACTION_MULTIPLE_BUTTON));return n.createElement(go,null,!i&&n.createElement(po,Object.assign({size:"md",color:"secondary",onClick:e},r,{className:E()("pointer-event-child-none",null===r||void 0===r?void 0:r.className)},h,{"data-event-action":"Back Click"}),n.createElement(Hn,{style:{marginRight:10}}),v({id:"riskScreener.back",defaultMessage:"Back"})),!l&&n.createElement(vo,Object.assign({size:"md",color:"primary",onClick:y?()=>{if(_&&y){const e={node_id:_.id,action_id:null===y||void 0===y?void 0:y.id,action_value:null===y||void 0===y?void 0:y.key};null===f||void 0===f||f(Object.assign(Object.assign(Object.assign({},b),e),_._message))}}:t},s,{className:E()("pointer-event-child-none",null===s||void 0===s?void 0:s.className)},h,{"data-event-action":"Answer Click","data-response-id":(null===x||void 0===x?void 0:x.id)||(null===y||void 0===y?void 0:y.id)||(null===(u=null===_||void 0===_?void 0:_._message)||void 0===u?void 0:u.action_id)}),a||v({id:"riskScreener.next",defaultMessage:"Next"}),n.createElement(zn,{style:{marginLeft:10}})))}));const yo=N.Z.h4` padding: 32px 0px 12px; border-bottom: 1px solid ${A.r.colors.neutral100||"#E4E8EC"}; margin: 0px 32px; color: ${A.r.colors.gray500||"#737373"}; font-size: 14px; font-weight: 700; line-height: 1.5; ${O.M.tdDown} { padding: 24px 0px 12px; margin: 0px 24px; } ${O.M.mbDown} { padding: 16px 0px 12px; margin: 0px 16px; } `;var xo=(0,n.memo)((()=>{const{formatMessage:e}=(0,n.useContext)(m.T),{nodes:t}=(0,n.useContext)(Nn),i=(0,n.useMemo)((()=>{var e;return null===(e=t[0])||void 0===e?void 0:e.inline_headline}),[t]);return n.createElement(yo,null,i||e({id:"subotInline.quote",defaultMessage:"HAVE TIME FOR A QUICK QUESTION?"}))}));const wo=N.Z.h3` margin-bottom: 0px; font-size: 22px; font-weight: bold; line-height: 1.45; ${O.M.tdDown} { font-size: 20px; } `,No=(0,N.Z)(X.B)` &.bot-recalculate { svg { path { stroke: ${A.r.colors.primaryBase||"#2685F1"} !important; } } &:hover { svg { path { stroke: #fff !important; } } } } `,Oo=(0,N.Z)(X.B)` border: 2px solid transparent; `,Io=N.Z.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: ${A.r.colors.gray700||"#404040"}; line-height: 1.4; } } ${O.M.mbDown} { .icon { width: 47px; height: 47px; margin-right: 16px; } .content { .title { font-size: 14px; } .description { font-size: 14px; } } } `;(0,N.Z)(X.B)``;const So=N.Z.div` display: flex; align-items: flex-start; color: ${A.r.colors.gray800||"#262626"}; font-size: 22px; font-weight: 700; letter-space: -0.6px; line-height: 1.45; .number { margin-right: 3px; } .title { flex: 1; } ${O.M.tdDown} { font-size: 20px; } ${O.M.mbDown} { font-size: 18px; } `,ko=N.Z.div` display: flex; justify-content: center; `,To=N.Z.div``,Co=N.Z.div` padding: 12px 16px; border: 1px solid ${A.r.colors.gray200||"#D9D9D9"}; background-color: ${A.r.colors.white||"#fff"}; border-radius: ${A.r.borderRadius}; line-height: 1.5; `,Mo=N.Z.div` border: ${A.r.colors.gray200||"#D9D9D9"}; background-color: ${A.r.colors.white||"#FFF"}; border-radius: ${A.r.borderRadius}; .intent-img { border-radius: ${A.r.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; } `,Bo=N.Z.div` display: flex; .feature { width: 30%; .feature-wrapper { position: relative; display: block; overflow: hidden; width: 100%; padding-top: 66%; border-radius: ${A.r.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: ${A.r.colors.gray800||"#262626"}; text-decoration: none; } } `,jo=N.Z.div` display: flex; align-items: center; justify-content: space-between; padding: 20px 40px 20px 16px; background-color: #fff; border-radius: ${A.r.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: ${A.r.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; } } } } `,Po=N.Z.div` display: flex; align-items: center; justify-content: center; `;N.Z.div` padding: 16px; margin-top: 32px; margin-bottom: 32px; background-color: ${A.r.colors.primary50||""}; border-radius: ${A.r.borderRadius}; .item-grid { > div { box-shadow: none; } } .lp--affiliate-product { .arrow-left { left: -20px; } .arrow-right { right: -16px; } } .bullet-nav { bottom: -10px; } `;const Ro=N.Z.div` width: ${({width:e})=>e||"100%"}; padding: 8px; ${O.M.mbDown} { width: 100%; } `,Lo=N.Z.div` display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: center; margin: 0 -8px; `,Uo=N.Z.div` width: ${({width:e})=>e||"100%"}; padding: 4px; ${O.M.mbDown} { width: 100%; } `,Ao=N.Z.div` display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: center; margin: 0 -4px; `,$o=N.Z.div` margin-top: 20px; `,Do=({intents:e,indexNumber:t})=>{var i,o;const l=(0,n.useMemo)((()=>{const t=e&&e[0];return t||null}),[]);return e.length?n.createElement(n.Fragment,null,l&&n.createElement(zo,{intent:l,indexNumber:t}),!!(null===(i=e.slice(1))||void 0===i?void 0:i.length)&&n.createElement($o,null,n.createElement(Ao,null,null===(o=e.slice(1))||void 0===o?void 0:o.map((e=>{const t=Vo[null===e||void 0===e?void 0:e.type];return t&&n.createElement(t,{key:e.id,intent:e})}))))):n.createElement(zo,{indexNumber:t})},Fo=({intents:e})=>{const t=(0,n.useMemo)((()=>{const t=[],i=[],n=[];return null===e||void 0===e||e.map((e=>{switch(null===e||void 0===e?void 0:e.type){case o.N.BOT_MAIN_IMAGE:case o.N.BOT_MAIN_TITLE:case o.N.BOT_MAIN_BODY:case o.N.BOT_MAIN_BUTTON:case o.N.BOT_RECALCULATE:t.push(e);break;case o.N.BOT_SUB_TITLE:case o.N.BOT_SUB_BODY:i.push(e);break;default:n.push(e)}})),{mainIntents:t,subIntents:i,intents:n}}),[]);if(!(null===e||void 0===e?void 0:e.length))return null;function i(e){const t=Vo[null===e||void 0===e?void 0:e.type];return t?n.createElement(t,{key:e.id,intent:e}):null}return n.createElement(Ao,null,n.createElement(Uo,null,n.createElement(Lo,null,t.mainIntents.map(i),t.subIntents.map(i),t.intents.map(i))))},Go=({intent:e})=>(null===e||void 0===e?void 0:e.label)?n.createElement(Uo,null,n.createElement(Co,null,n.createElement(tt,null,null===e||void 0===e?void 0:e.label))):n.createElement(n.Fragment,null),Ho=({intent:e})=>{if(!e.url)return n.createElement(n.Fragment,null);const t=(()=>{try{return Boolean(JSON.parse((null===e||void 0===e?void 0:e.label)||""))}catch(t){return!1}})();return n.createElement(Uo,{width:"50%"},n.createElement(Mo,null,n.createElement("img",{loading:"lazy",src:e.url,alt:e.label,className:`intent-img ${e.label&&"has-label"}`}),t&&n.createElement("h4",{className:"intent-img-label"},n.createElement(tt,null,e.label))))},zo=({intent:e,indexNumber:t})=>{const i=![o.N.SSO_INTENT].includes(null===e||void 0===e?void 0:e.type);return n.createElement(To,null,n.createElement(So,null,t&&n.createElement("div",{className:"number"},t<10?`0${t}`:t,"."),i&&e&&[o.N.BOT_TEXT,o.N.BOT_BUTTON].includes(null===e||void 0===e?void 0:e.type)&&n.createElement(tt,{className:"title"},e.label)),e&&[o.N.BOT_IMAGE].includes(null===e||void 0===e?void 0:e.type)&&n.createElement(ko,null,n.createElement(Ho,{intent:e})))},Zo=({intent:e})=>e.label&&"Sub title"!==e.label&&"Main title"!==e.label?n.createElement(Ro,null,n.createElement(wo,null,n.createElement(tt,null,e.label))):null,qo=({intent:e})=>e.label&&"Main body"!==e.label&&"Sub body"!==e.label?n.createElement(Ro,null,n.createElement("div",{className:"intents__item markdown"},n.createElement(tt,null,e.label))):null,Vo={[o.N.BOT_TEXT]:Go,[o.N.BOT_IMAGE]:Ho,[o.N.BOT_BUTTON]:({intent:e})=>{const{trackingCommonInline:t}=(0,n.useContext)(Nn);return(null===e||void 0===e?void 0:e.label)?n.createElement(Uo,{width:"60%"},n.createElement(Oo,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}),n.createElement(tt,null,null===e||void 0===e?void 0:e.label))):n.createElement(n.Fragment,null)},[o.N.BOT_URL]:({intent:e})=>{const t=(0,n.useMemo)((()=>e.label.includes("{")?JSON.parse(e.label):{}),[e.label]);return n.createElement(n.Fragment,null,!!Object.keys(t).length&&n.createElement(Uo,null,n.createElement(Bo,null,n.createElement("div",{className:"feature"},n.createElement("a",{href:null===t||void 0===t?void 0:t.url,className:"feature-wrapper"},n.createElement("img",{loading:"lazy",src:null===t||void 0===t?void 0:t.thumbnail,alt:null===t||void 0===t?void 0:t.title,className:"feature-img"}))),n.createElement("div",{className:"body"},n.createElement("a",{href:null===t||void 0===t?void 0:t.url},n.createElement("h5",{className:"title"},n.createElement(tt,null,null===t||void 0===t?void 0:t.title)))))))},[o.N.BOT_RECALCULATE]:({intent:e})=>{const{onReset:t}=(0,n.useContext)(Nn);return(null===e||void 0===e?void 0:e.label)?n.createElement(Uo,{width:"auto",style:{justifyContent:"center",display:"flex"}},n.createElement(No,{size:"lg",color:"secondary",onClick:()=>{t&&t()},icon:n.createElement(Vn,null),className:"bot-recalculate"},n.createElement(tt,null,null===e||void 0===e?void 0:e.label))):n.createElement(n.Fragment,null)},[o.N.BOT_MAIN_TITLE]:Zo,[o.N.BOT_MAIN_IMAGE]:({intent:e})=>e.url?n.createElement(Ro,null,n.createElement(Mo,null,n.createElement("img",{loading:"lazy",src:e.url,alt:e.label,className:`intent-img ${e.label&&"has-label"}`}),e.label&&n.createElement("h4",{className:"intent-img-label"},n.createElement(tt,null,e.label)))):n.createElement(n.Fragment,null),[o.N.BOT_MAIN_BODY]:qo,[o.N.BOT_MAIN_BUTTON]:({intent:e})=>{const{trackingCommonInline:t}=(0,n.useContext)(Nn);return e.label?n.createElement(Uo,{width:"auto"},n.createElement(Po,null,n.createElement(Oo,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}),n.createElement(tt,null,null===e||void 0===e?void 0:e.label)))):n.createElement(n.Fragment,null)},[o.N.BOT_SUB_TITLE]:Zo,[o.N.BOT_SUB_BODY]:qo,[o.N.BOT_LANDING_PAGE_URL]:Go,[o.N.BOT_LANDING_PAGE_BUTTON]:Go,[o.N.BOT_RISK_SCREEN]:({intent:e})=>{const{formatMessage:t}=(0,n.useContext)(m.T),i=(0,n.useMemo)((()=>e.label&&e.label.includes("{")?JSON.parse(e.label):{}),[e,null===e||void 0===e?void 0:e.label]);return n.createElement(n.Fragment,null,!!(null===i||void 0===i?void 0:i.title)&&!!(null===i||void 0===i?void 0:i.thumbnail)&&!!(null===i||void 0===i?void 0:i.url)&&n.createElement(Ro,null,n.createElement(jo,null,n.createElement("a",{href:null===i||void 0===i?void 0:i.url,className:"feature"},n.createElement("img",{loading:"lazy",src:null===i||void 0===i?void 0:i.thumbnail,alt:null===i||void 0===i?void 0:i.title})),n.createElement("div",{className:"title-container"},n.createElement("a",{href:null===i||void 0===i?void 0:i.url},n.createElement("h5",{className:"title"},null===i||void 0===i?void 0:i.title)),n.createElement("a",{href:null===i||void 0===i?void 0:i.url,className:"link"},t({id:"riskScreener.start",defaultMessage:"Start"}),n.createElement(qn,{style:{marginLeft:10}}))))))},[o.N.BOT_RELATED_ARTICLE]:({intent:e})=>{var t,i,o,l,a,r,s,d,c,u,m,v,p;const g=(0,n.useMemo)((()=>{if(e.label&&e.label.includes("{")){const t=JSON.parse(e.label);if(t.meta){const e={};t.meta.map((({key:t,value:i})=>{t&&i&&(e[t]=i)})),t.meta=Object.assign({},e)}return Object.assign({},t)}return{}}),[e,null===e||void 0===e?void 0:e.label]);return n.createElement(n.Fragment,null,!!(null===g||void 0===g?void 0:g.title)&&!!(null===g||void 0===g?void 0:g.thumbnail)&&!!(null===g||void 0===g?void 0:g.url)&&!!(null===g||void 0===g?void 0:g.meta)&&!!(null===(t=null===g||void 0===g?void 0:g.meta)||void 0===t?void 0:t.post_modified)&&!!(null===(i=null===g||void 0===g?void 0:g.meta)||void 0===i?void 0:i.reviewed_display_name)&&!!(null===(o=null===g||void 0===g?void 0:g.meta)||void 0===o?void 0:o.reviewed_url)&&!!(null===(l=null===g||void 0===g?void 0:g.meta)||void 0===l?void 0:l.reviewed_avatar_thumbnail)&&!!(null===(a=null===g||void 0===g?void 0:g.meta)||void 0===a?void 0:a.category_url)&&!!(null===(r=null===g||void 0===g?void 0:g.meta)||void 0===r?void 0:r.category_name)&&n.createElement(Ro,{width:"40%"},n.createElement(ie.T,{title:null===g||void 0===g?void 0:g.title,uploadTime:f()(null===(s=null===g||void 0===g?void 0:g.meta)||void 0===s?void 0:s.post_modified).format("DD/MM/YYYY"),authorName:null===(d=null===g||void 0===g?void 0:g.meta)||void 0===d?void 0:d.reviewed_display_name,authorLink:null===(c=null===g||void 0===g?void 0:g.meta)||void 0===c?void 0:c.reviewed_url,avatarImg:n.createElement("img",{loading:"lazy",src:null===(u=null===g||void 0===g?void 0:g.meta)||void 0===u?void 0:u.reviewed_avatar_thumbnail,alt:null===(m=null===g||void 0===g?void 0:g.meta)||void 0===m?void 0:m.reviewed_display_name}),categoryLink:null===(v=null===g||void 0===g?void 0:g.meta)||void 0===v?void 0:v.category_url,categoryName:null===(p=null===g||void 0===g?void 0:g.meta)||void 0===p?void 0:p.category_name,banner:n.createElement("img",{loading:"lazy",src:null===g||void 0===g?void 0:g.thumbnail,alt:null===g||void 0===g?void 0:g.title}),text:"",size:"sm",direction:"vertical"})))},[o.N.THANK_YOU_IMAGE]:({intent:e})=>e.url?n.createElement(Ro,null,n.createElement(Mo,null,n.createElement("img",{loading:"lazy",src:e.url,alt:e.label,className:`intent-img ${e.label&&"has-label"}`}),e.label&&n.createElement("h4",{className:"intent-img-label"},n.createElement(tt,null,e.label)))):n.createElement(n.Fragment,null),[o.N.THANK_YOU_TITLE]:({intent:e})=>e.label?n.createElement(Ro,null,n.createElement(wo,null,n.createElement(tt,null,e.label))):n.createElement(n.Fragment,null),[o.N.THANK_YOU_BODY]:({intent:e})=>e.label?n.createElement(Ro,null,n.createElement("div",{className:"intents__item markdown"},n.createElement(tt,null,e.label))):n.createElement(n.Fragment,null),[o.N.SSO_INTENT]:({intent:e})=>{const t=(()=>{try{return(null===e||void 0===e?void 0:e.label)?JSON.parse(null===e||void 0===e?void 0:e.label):{}}catch(t){return{}}})();return t&&t.title?n.createElement(Uo,null,n.createElement(Io,null,n.createElement("img",{loading:"lazy",src:null===e||void 0===e?void 0:e.url,className:"icon",alt:""}),n.createElement("div",{className:"content"},n.createElement("h3",{className:"title"},t.title),n.createElement("div",{className:"description"},null===t||void 0===t?void 0:t.description)))):n.createElement(n.Fragment,null)}},Yo=({node:e})=>{var t,i;const{nodes:l}=(0,n.useContext)(Nn),{formatMessage:a}=(0,n.useContext)(m.T),r=(0,n.useRef)(null),s=(0,n.useRef)(null),[d,c]=(0,n.useState)(350),[u,v]=(0,n.useState)(!0),[p,g]=(0,n.useState)(!1),b=(0,n.useCallback)((()=>{ae.measure((()=>{var e;if(s.current){const t=null===(e=s.current)||void 0===e?void 0:e.getBoundingClientRect().height;d&&d{ae.measure((()=>{s.current&&setTimeout((()=>{var e;const t=null===(e=s.current)||void 0===e?void 0:e.getBoundingClientRect().height;t&&d>t&&(v(!1),g(!1))}),400)}))}),[]);const f=l[0],h=null===(t=null===f||void 0===f?void 0:f.extra_settings)||void 0===t?void 0:t.subot_type,_=(0,n.useMemo)((()=>{var t;return(null===(t=null===e||void 0===e?void 0:e.intents)||void 0===t?void 0:t.filter((e=>e.type===o.N.BOT_SUGGESTED_SERVICE)))||[]}),[]);return n.createElement(Rn,null,n.createElement("div",{ref:r,className:"hhg-flag",style:{position:"absolute",top:-100,left:0,pointerEvents:"none"}}),n.createElement(Pn,{maxHeight:d,isMore:p},n.createElement("div",{ref:s},n.createElement(Fo,{intents:(null===e||void 0===e?void 0:e.intents)||[]}),_.length>0&&n.createElement("div",null,_.map((e=>{const t=$t[e.type||""];return t&&n.createElement(t,{key:e.id,intent:e})}))))),u&&n.createElement(jn,null,n.createElement(Bn,{size:"md",color:"secondary",onClick:b},p?n.createElement(n.Fragment,null,a({id:"subotInline.showLess",defaultMessage:"Show less"}),n.createElement(Zn,{style:{marginLeft:10}})):n.createElement(n.Fragment,null,a({id:"subotInline.showMore",defaultMessage:"Show more"}),n.createElement(Gn,{style:{marginLeft:10}})))),h===o.h.voucherAcuvue&&n.createElement(rt,{clientId:null===(i=f.extra_settings)||void 0===i?void 0:i.client_id,voucherAnswers:ke(l,f)}))},Wo=N.Z.span` display: inline-block; margin-top: 20px; color: ${A.r.colors.primaryBase||"#2D87F3"}; cursor: pointer; transition: 0.3 all ease; &:hover { color: ${A.r.colors.primaryHover||"#2D87F3"}; } ${O.M.tdDown} { margin-top: 16px; } ${O.M.mbDown} { margin-top: 12px; } `,Xo=N.Z.div` max-width: 430px; margin-right: auto; margin-left: auto; `,Jo=N.Z.div` padding: 44px 16px 32px; background-color: ${A.r.colors.neutral50||"#F7F9FC"}; border-radius: ${A.r.borderRadius}; position: relative; text-align: center; ${O.M.tdDown} { padding: 36px 16px 24px; } ${O.M.mbDown} { padding: 16px; border-radius: 0px; } `,Ko=({className:e,style:t,actions:i,countryCode:a,phoneNumber:r,areaCode:s,callBack:d})=>{const c=(0,n.useRef)(),[u,v]=(0,n.useState)(!1),[p,g]=(0,n.useState)(!1),[b,f]=(0,n.useState)(!1),[h,_]=(0,n.useState)(!1),{register:E,formState:{errors:y},control:x,trigger:w,getValues:N,setValue:O}=(0,H.cI)(),{formatMessage:I,action:{pushNotifications:S}}=(0,n.useContext)(m.T),k=e=>(0,l.a)(void 0,void 0,void 0,(function*(){var t;e.preventDefault();const n=N(),l=(0,z.parsePhoneNumber)(n.phone||"");if((null===l||void 0===l?void 0:l.nationalNumber)&&(null===l||void 0===l?void 0:l.countryCallingCode)){g(!0);try{const e=yield(0,m.c)(de(re.POST_SEND_OTP),"POST",{data:{phone_number:l.nationalNumber,area_code:`+${l.countryCallingCode}`}});if(g(!1),1===(null===e||void 0===e?void 0:e._status))return h&&(v(!1),c.current.reset()),_(!0),void setTimeout((()=>{const e=document.querySelector(".input-otp-code");e&&(e.focus(),e.scrollIntoView({block:"center"}))}),100);if(0===(null===e||void 0===e?void 0:e._status)&&"This phone number was verified"===(null===(t=null===e||void 0===e?void 0:e._messages)||void 0===t?void 0:t[0])){c.current&&c.current.cancel(),S({title:"",message:"S\u1ed1 \u0111i\u1ec7n tho\u1ea1i n\xe0y \u0111\xe3 \u0111\u01b0\u1ee3c x\xe1c minh.",type:"success"});const e=i.find((e=>e.type===o.f.USER_SUBMIT_SEND));return void(e&&d(e,n.phone))}throw new Error}catch(a){g(!1),c.current&&c.current.cancel(),T()}}})),T=()=>{S({title:"",message:I({id:"notification.comment.somethingWrong"}),type:"danger"})},C=e=>{switch(e.type){case o.f.USER_SUBMIT_SEND:return h?n.createElement("div",{className:"submit-btn-row",key:e.id},n.createElement(X.B,{className:"submit-btn",size:"lg",isDisabled:b,isLoading:b,onClick:t=>((e,t)=>(0,l.a)(void 0,void 0,void 0,(function*(){if(e.preventDefault(),f(!0),yield w(),G()(y)){const e=N(),{number:n}=e,o=(0,z.parsePhoneNumber)(e.phone||"");if(!(null===o||void 0===o?void 0:o.nationalNumber)||!(null===o||void 0===o?void 0:o.countryCallingCode))return;try{const i=yield(0,m.c)(de(re.POST_VERIFY_OTP),"POST",{data:{phone_number:o.nationalNumber,area_code:`+${o.countryCallingCode}`,code:n}});if(f(!1),1===(null===i||void 0===i?void 0:i._status))return S({title:"",message:I({id:"subot.verifyOTP.success.message"}),type:"success"}),void d(t,e.phone);throw new Error}catch(i){S({title:"",message:I({id:"validation.error.validOTP"}),type:"danger"}),f(!1)}}else f(!1)})))(t,e)},e.label)):"";default:return""}};return(0,n.useEffect)((()=>{if(r){const e=i.find((e=>e.type===o.f.USER_SUBMIT_PHONE));e&&e.key&&O(e.key,`+${s}${r}`)}}),[r,s]),n.createElement(si,{className:e,style:t},n.createElement("form",{className:"user-info-form"},i.map((e=>(e=>{if(!e.key)return null;switch(e.type){case o.f.USER_SUBMIT_PHONE:return n.createElement("div",{className:"input-row",key:e.id},n.createElement("label",{htmlFor:e.key},e.label),n.createElement(H.Qr,{name:e.key,control:x,rules:{required:!0,validate:e=>(0,z.isPossiblePhoneNumber)(e)},render:({field:{onChange:t,value:i}})=>{const o=!u&&h||p;return n.createElement(di,null,n.createElement(Pi,{value:i,defaultValue:r,onChange:t,defaultCountry:a,id:e.id,className:`input-row ${e.id}`,name:e.key,disabled:o,flagComponent:ji,placeholder:e.label}),o&&n.createElement(li,{viewBox:"0 0 24 24",className:"icon-edit-phone",onClick:()=>{var e;t(""),_(!1),f(!1),null===(e=c.current)||void 0===e||e.cancel()}}),e.key&&y[e.key]&&n.createElement("p",{className:"error-message"},I({id:"validation.error.validNumber",defaultMessage:"Please enter a valid number."})),n.createElement("div",{className:"submit-btn-row",key:e.id},n.createElement(X.B,{className:"submit-btn",size:"lg",onClick:k,isDisabled:!u&&h||p,isLoading:p},h?n.createElement(ri,{ref:c,isFinished:u,onFinish:v}):n.createElement("span",null,I({id:"subot.sendOTP.button",defaultMessage:"Send OTP"})))))}}));case o.f.USER_SUBMIT_NUMBER:return h?n.createElement("div",{className:"input-row",key:e.id},n.createElement("label",{htmlFor:e.key},e.label),n.createElement("input",Object.assign({type:"tel",id:e.id,placeholder:e.label},E(e.key,{required:!0,pattern:/^[0-9]{0,6}$/}),{className:"input-otp-code"})),y[e.key]&&n.createElement("p",{className:"error-message"},I({id:"validation.error.validOTP",defaultMessage:"Invalid OTP provided"}))):"";default:return""}})(e))),i.map((e=>C(e)))))},Qo={TEXT:({node:e,indexNumber:t})=>{const{formatMessage:i,action:{pushNotifications:a}}=(0,n.useContext)(m.T),{nodes:r,activeId:s,params:d,onSubmit:c,onPrev:u,onNext:v,onChange:p}=(0,n.useContext)(Nn),[g,b]=(0,n.useState)((null===e||void 0===e?void 0:e._message)||{});return n.createElement(Un,null,n.createElement(xo,null),n.createElement(Ln,null,n.createElement(kn,null,n.createElement(Do,{intents:(null===e||void 0===e?void 0:e.intents)||[],indexNumber:t})),n.createElement(Tn,null,n.createElement(mo,{value:(null===g||void 0===g?void 0:g.action_id)?[null===g||void 0===g?void 0:g.action_id]:[],actions:null===e||void 0===e?void 0:e.actions,onChange:(t,i)=>(0,l.a)(void 0,void 0,void 0,(function*(){if(!t)return;const n=(null===t||void 0===t?void 0:t.type)===o.f.USER_CHOICE_TEXT_BY_INPUT||(null===t||void 0===t?void 0:t.type)===o.f.POLL_CHOICE_TEXT_BY_INPUT,a=Object.assign(Object.assign({},g),{action_id:null===t||void 0===t?void 0:t.id,action_value:null===t||void 0===t?void 0:t.key,form_submit_meta:i});if(n)return b(a),void(null===p||void 0===p||p(a));delete a.form_submit_meta,b(a),(t=>{(0,l.a)(void 0,void 0,void 0,(function*(){const i=Object.assign(Object.assign(Object.assign(Object.assign({},d),g),{node_id:e.id,action_id:null===t||void 0===t?void 0:t.id,action_value:null===t||void 0===t?void 0:t.key}),fe(r,s,t.id));delete i.form_submit_meta;const n=yield On(i);if(1===(null===n||void 0===n?void 0:n._status)){const e=null===n||void 0===n?void 0:n._data,{node:t}=e,o=(0,l._)(e,["node"]),a=Object.assign(Object.assign({},t),{_message:Object.assign(Object.assign({},o),{node_id:t.id})});c&&c(a,i)}}))})(t)})),formSubmitMeta:null===g||void 0===g?void 0:g.form_submit_meta}))),n.createElement(Eo,{onBack:()=>u&&u(),backProps:{isDisabled:!(1!==t)},onNext:()=>{const t=JSON.parse(JSON.stringify(Object.assign(Object.assign(Object.assign({},d),null===e||void 0===e?void 0:e._message),g)));(null===g||void 0===g?void 0:g.action_id)&&(null===g||void 0===g?void 0:g.action_value)===_e?null===v||void 0===v||v(t):(null===g||void 0===g?void 0:g.action_id)&&(null===g||void 0===g?void 0:g.action_value)?(delete t.form_submit_meta,null===v||void 0===v||v(t)):a({title:"",message:i({id:"multiSelectError.required",defaultMessage:"There is no answer!"}),type:"warning"})}}))},IMAGE:({node:e,indexNumber:t})=>{const{formatMessage:i,action:{pushNotifications:o}}=(0,n.useContext)(m.T),{params:a,onSubmit:r,onPrev:s,onNext:d}=(0,n.useContext)(Nn),[c,u]=(0,n.useState)((null===e||void 0===e?void 0:e._message)||{});return n.createElement(Un,null,n.createElement(xo,null),n.createElement(Ln,null,n.createElement(kn,null,n.createElement(Do,{intents:(null===e||void 0===e?void 0:e.intents)||[],indexNumber:t})),n.createElement(Tn,null,n.createElement(mo,{node_type:null===e||void 0===e?void 0:e.type,value:(null===c||void 0===c?void 0:c.action_id)?[null===c||void 0===c?void 0:c.action_id]:[],actions:null===e||void 0===e?void 0:e.actions,onChange:t=>(0,l.a)(void 0,void 0,void 0,(function*(){if(t){u(Object.assign(Object.assign({},c),{action_id:null===t||void 0===t?void 0:t.id,action_value:null===t||void 0===t?void 0:t.key}));const i=Object.assign(Object.assign(Object.assign({},a),c),{node_id:e.id,action_id:null===t||void 0===t?void 0:t.id,action_value:null===t||void 0===t?void 0:t.key}),n=yield On(i);if(1===(null===n||void 0===n?void 0:n._status)){const e=null===n||void 0===n?void 0:n._data,{node:t}=e,o=(0,l._)(e,["node"]),a=Object.assign(Object.assign({},t),{_message:Object.assign(Object.assign({},o),{node_id:t.id})});r&&r(a,i)}}}))}))),n.createElement(Eo,{onBack:()=>s&&s(),backProps:{isDisabled:!(1!==t)},onNext:()=>{var t;(null===e||void 0===e?void 0:e._message)&&(null===(t=e._message)||void 0===t?void 0:t.action_id)?d&&d(Object.assign(Object.assign(Object.assign({},a),c),null===e||void 0===e?void 0:e._message)):o({title:"",message:i({id:"multiSelectError.required",defaultMessage:"There is no answer!"}),type:"warning"})}}))},FORM:({node:e,indexNumber:t})=>{var i;const{data:{locale:o}}=(0,n.useContext)(m.T),{params:a,onPrev:r,onSubmit:s,trackingCommonInline:d,nodes:c,activeId:u}=(0,n.useContext)(Nn);return n.createElement(Un,null,n.createElement(xo,null),n.createElement(Ln,null,n.createElement(kn,null,n.createElement(Do,{intents:(null===e||void 0===e?void 0:e.intents)||[],indexNumber:t})),n.createElement(Sn,null,n.createElement(Li,{botId:a.bot_id,nodeId:String(null===e||void 0===e?void 0:e.id),className:"form",actions:(null===e||void 0===e?void 0:e.actions)||[],formSubmitMeta:(null===(i=null===e||void 0===e?void 0:e._message)||void 0===i?void 0:i.form_submit_meta)||null,callBack:t=>(0,l.a)(void 0,void 0,void 0,(function*(){const i=yield On(Object.assign(Object.assign(Object.assign(Object.assign({},a),e._message),t),fe(c,u,t.action_id,t.form_submit_meta)));if(1===(null===i||void 0===i?void 0:i._status)){const n=null===i||void 0===i?void 0:i._data,{node:o}=n,a=(0,l._)(n,["node"]),r=Object.assign(Object.assign({},o),{_message:Object.assign(Object.assign({},a),{node_id:o.id})});s&&s(r,Object.assign(Object.assign({},e._message),t))}})),countryCode:(null===o||void 0===o?void 0:o.split("-")[1])||"PH",trackingSubmitBtn:Object.assign(Object.assign({},d),{"data-event-action":"Submit"})}))),n.createElement(Eo,{onBack:()=>r&&r(),backProps:{isDisabled:!(1!==t)},hideNext:!0}))},CONDITION:({node:e,indexNumber:t})=>{const{formatMessage:i,action:{pushNotifications:a}}=(0,n.useContext)(m.T),{params:r,onChange:s,onSubmit:d,onPrev:c,onNext:u,nodes:v,activeId:p}=(0,n.useContext)(Nn),[g,b]=(0,n.useState)((null===e||void 0===e?void 0:e._message)||{});return n.createElement(Un,null,n.createElement(xo,null),n.createElement(Ln,null,n.createElement(kn,null,n.createElement(Do,{intents:(null===e||void 0===e?void 0:e.intents)||[],indexNumber:t})),n.createElement(Tn,null,n.createElement(mo,{value:(null===g||void 0===g?void 0:g.action_id)?[null===g||void 0===g?void 0:g.action_id]:[],actions:null===e||void 0===e?void 0:e.actions,onChange:(e,t)=>(0,l.a)(void 0,void 0,void 0,(function*(){if(!e)return;const i=(null===e||void 0===e?void 0:e.type)===o.f.USER_CHOICE_TEXT_BY_INPUT||(null===e||void 0===e?void 0:e.type)===o.f.POLL_CHOICE_TEXT_BY_INPUT,n=Object.assign(Object.assign({},g),{action_id:null===e||void 0===e?void 0:e.id,action_value:null===e||void 0===e?void 0:e.key,form_submit_meta:t});if(i)return b(n),void(null===s||void 0===s||s(n));delete n.form_submit_meta,b(n),(e=>{(0,l.a)(void 0,void 0,void 0,(function*(){const t=Object.assign(Object.assign(Object.assign(Object.assign({},r),g),{action_id:null===e||void 0===e?void 0:e.id,action_value:null===e||void 0===e?void 0:e.key}),fe(v,p,e.id));delete t.form_submit_meta;const i=yield On(t);if(1===(null===i||void 0===i?void 0:i._status)){const e=null===i||void 0===i?void 0:i._data,{node:n}=e,o=(0,l._)(e,["node"]),a=Object.assign(Object.assign({},n),{_message:Object.assign(Object.assign({},o),{node_id:n.id})});delete a._message.form_submit_meta,d&&d(a,t)}}))})(e)})),formSubmitMeta:null===g||void 0===g?void 0:g.form_submit_meta}))),n.createElement(Eo,{onBack:()=>c&&c(),backProps:{isDisabled:!(1!==t)},onNext:()=>{const t=JSON.parse(JSON.stringify(Object.assign(Object.assign(Object.assign({},r),null===e||void 0===e?void 0:e._message),g)));(null===g||void 0===g?void 0:g.action_id)&&(null===g||void 0===g?void 0:g.action_value)===_e?null===u||void 0===u||u(t):(null===g||void 0===g?void 0:g.action_id)&&(null===g||void 0===g?void 0:g.action_value)?(delete t.form_submit_meta,null===u||void 0===u||u(t)):a({title:"",message:i({id:"multiSelectError.required",defaultMessage:"There is no answer!"}),type:"warning"})}}))},FINAL_STANDARD:Yo,FINAL:Yo,FINAL_THANK_YOU:({node:e})=>{var t;const{params:i,onNext:l}=(0,n.useContext)(Nn),a=(0,n.useMemo)((()=>{var t;const i=null===(t=null===e||void 0===e?void 0:e.actions)||void 0===t?void 0:t.find((({type:e})=>e===o.f.RESULT_BUTTON));return i||null}),[null===e||void 0===e?void 0:e.actions]),r=(0,n.useCallback)((()=>{l&&l(Object.assign(Object.assign(Object.assign({},i),null===e||void 0===e?void 0:e._message),{action_id:null===a||void 0===a?void 0:a.id,action_value:null===a||void 0===a?void 0:a.key}))}),[a]);return n.createElement(Jo,null,n.createElement(Xo,null,null===(t=null===e||void 0===e?void 0:e.intents)||void 0===t?void 0:t.map((e=>{const t=Vo[null===e||void 0===e?void 0:e.type];return t&&n.createElement(t,{key:e.id,intent:e})})),a&&n.createElement(Wo,{onClick:r},null===a||void 0===a?void 0:a.label)))},SSO:({node:e,indexNumber:t})=>{const i=(0,n.useRef)(!1),{params:l,onPrev:r,nodes:s,activeId:d,userInfo:c}=(0,n.useContext)(Nn);(0,n.useEffect)((()=>{var t;const n=null===(t=null===e||void 0===e?void 0:e.actions)||void 0===t?void 0:t.find((e=>e.type===o.f.ACTION_SSO_REDIRECT));(null===c||void 0===c?void 0:c.id)&&n&&!i.current&&(i.current=!0,v(n))}),[null===c||void 0===c?void 0:c.id]);const{formatMessage:u}=(0,n.useContext)(m.T),v=t=>{if(t&&t.type===o.f.ACTION_SSO_REDIRECT){const i={params:Object.assign(Object.assign(Object.assign({},l),null===e||void 0===e?void 0:e._message),{action_id:null===t||void 0===t?void 0:t.id,action_value:null===t||void 0===t?void 0:t.key,mode:"inline"}),listNodes:s,activeId:d,createdAt:(new Date).getTime(),botId:l.bot_id};localStorage.setItem(Ee,JSON.stringify(i));const n=(0,Q.g)(window.location.href,{botItem:s[0]});n.searchParams.set("bot_id",String(l.bot_id)),n.searchParams.set("mode","inline"),n.searchParams.set("source","subot-inline");const o=n.href;(0,K.I)()?K.u.getState().triggerLogin({returnUrl:o,source:"subot-inline"}):window.location.href=`${a.j}?returnUrl=${encodeURIComponent(o)}`}};return n.createElement(Un,null,n.createElement(xo,null),n.createElement(Ln,null,n.createElement(kn,null,n.createElement(Do,{intents:[...(null===e||void 0===e?void 0:e.intents)||[],...(0,g.s)(u)],indexNumber:t})),n.createElement(Tn,null,n.createElement(mo,{actions:null===e||void 0===e?void 0:e.actions,onChange:v}))),n.createElement(Eo,{onBack:()=>r&&r(),backProps:{isDisabled:!(1!==t)},hideNext:!0}))},MULTIPLE:({node:e,indexNumber:t})=>{const{params:i,onChange:a,onPrev:r,onNext:s}=(0,n.useContext)(Nn),{formatMessage:d,action:{pushNotifications:c}}=(0,n.useContext)(m.T),[u,v]=(0,n.useState)((null===e||void 0===e?void 0:e._message)||{}),p=(0,n.useMemo)((()=>{var t;const i=null===(t=null===e||void 0===e?void 0:e.actions)||void 0===t?void 0:t.find((({type:e})=>e==o.f.ACTION_MULTIPLE_BUTTON));return i||null}),[null===e||void 0===e?void 0:e.actions]),g=(0,n.useMemo)((()=>(null===u||void 0===u?void 0:u.selected_actions)?Object.keys(null===u||void 0===u?void 0:u.selected_actions):[]),[u,null===u||void 0===u?void 0:u.selected_actions]),b=(0,n.useCallback)((()=>{((t,i)=>{const n=Object.keys(t);n.length?(null===e||void 0===e?void 0:e.multi_select_option)===o.g.RANGE&&n.length<(null===e||void 0===e?void 0:e.from)?c({title:"",message:d({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"}):(null===e||void 0===e?void 0:e.multi_select_option)!==o.g.EXACT_NUMBER||n.length===(null===e||void 0===e?void 0:e.from)?i():c({message:d({id:"multiSelectError.exactNumber",defaultMessage:"You must choose {from} answers."},{from:e.from}),type:"warning"}):c({title:"",message:d({id:"multiSelectError.required",defaultMessage:"There is no answer!"}),type:"warning"})})((null===u||void 0===u?void 0:u.selected_actions)||{},(()=>{s&&s(Object.assign(Object.assign(Object.assign(Object.assign({},i),null===e||void 0===e?void 0:e._message),u),{node_id:e.id}))}))}),[u,null===u||void 0===u?void 0:u.selected_actions,s]);return n.createElement(Un,null,n.createElement(xo,null),n.createElement(Ln,null,n.createElement(kn,null,n.createElement(Do,{intents:(null===e||void 0===e?void 0:e.intents)||[],indexNumber:t})),n.createElement(Tn,null,n.createElement(mo,{value:g,actions:null===e||void 0===e?void 0:e.actions,onChange:(e,t)=>(0,l.a)(void 0,void 0,void 0,(function*(){var i,n;if(e){const l=JSON.parse(JSON.stringify(Object.assign(Object.assign({},u),{action_id:null===p||void 0===p?void 0:p.id,action_value:null===p||void 0===p?void 0:p.key,selected_actions:Object.assign({},null===u||void 0===u?void 0:u.selected_actions)})));if((null===e||void 0===e?void 0:e.type)===o.f.POLL_CHOICE_TEXT_BY_INPUT||(null===e||void 0===e?void 0:e.type)===o.f.USER_CHOICE_TEXT_BY_INPUT){return(null===l||void 0===l?void 0:l.selected_actions)&&e.id in l.selected_actions?t?l.form_submit_meta=t:(delete l.form_submit_meta,null===(i=l.selected_actions)||void 0===i||delete i[e.id]):(null===e||void 0===e?void 0:e.id)&&(l.selected_actions=Object.assign(Object.assign({},l.selected_actions),{[e.id]:e.key||""})),v(l),void(null===a||void 0===a||a(l))}if(!(null===(n=l.selected_actions)||void 0===n?void 0:n[e.id]))return l.selected_actions=Object.assign(Object.assign({},l.selected_actions),{[e.id]:e.key||""}),a&&a(l),void v(l);if(l.selected_actions[e.id])return delete l.selected_actions[e.id],a&&a(l),void v(l)}})),htmlType:"checkbox",formSubmitMeta:null===u||void 0===u?void 0:u.form_submit_meta}))),n.createElement(Eo,{onBack:()=>r&&r(),backProps:{isDisabled:!(1!==t)},nextText:p?null===p||void 0===p?void 0:p.label:"",onNext:b}))},POLL:({node:e,indexNumber:t})=>{var i,l;const{params:a,onChange:r,onPrev:s,onNext:d}=(0,n.useContext)(Nn),[c,u]=(0,n.useState)((null===e||void 0===e?void 0:e._message)||{}),m=He(),v=rn({node:e}),p=(0,n.useMemo)((()=>{var t;const i=null===(t=null===e||void 0===e?void 0:e.actions)||void 0===t?void 0:t.find((({type:e})=>e==o.f.POLL_BUTTON));return i||null}),[null===e||void 0===e?void 0:e.actions]),g=(t,i)=>{var n,l,a,s,d,m,v;const g=JSON.parse(JSON.stringify(Object.assign(Object.assign({},c),{node_id:e.id,action_id:null===p||void 0===p?void 0:p.id,action_value:null===p||void 0===p?void 0:p.key,form_submit_meta:[...(null===c||void 0===c?void 0:c.form_submit_meta)||[]]})));if((null===t||void 0===t?void 0:t.type)===o.f.POLL_CHOICE_TEXT_BY_INPUT||(null===t||void 0===t?void 0:t.type)===o.f.USER_CHOICE_TEXT_BY_INPUT){const e=null===(n=g.form_submit_meta)||void 0===n?void 0:n.some((({action_id:e})=>e===t.id));return g.form_submit_meta=e?"undefined"===typeof i?null===(l=g.form_submit_meta)||void 0===l?void 0:l.filter((({action_id:e})=>e!==t.id)):null===(a=g.form_submit_meta)||void 0===a?void 0:a.filter((({action_id:e})=>e!==t.id)).concat(i):null===(s=g.form_submit_meta)||void 0===s?void 0:s.concat([{key:null===t||void 0===t?void 0:t.key,control:o.E[null===t||void 0===t?void 0:t.type]||"text",value:"",action_id:null===t||void 0===t?void 0:t.id}]),u(g),void(null===r||void 0===r||r(g))}const b=null===(d=g.form_submit_meta)||void 0===d?void 0:d.some((({action_id:e})=>e===(null===t||void 0===t?void 0:t.action_id)));g.form_submit_meta=b?null===(m=g.form_submit_meta)||void 0===m?void 0:m.filter((({action_id:e})=>e!==(null===t||void 0===t?void 0:t.action_id))):null===(v=g.form_submit_meta)||void 0===v?void 0:v.concat([t]),u(g),null===r||void 0===r||r(g)},b=(0,n.useMemo)((()=>(null===c||void 0===c?void 0:c.form_submit_meta)?null===c||void 0===c?void 0:c.form_submit_meta.map((({action_id:e})=>e)):[]),[c,null===c||void 0===c?void 0:c.form_submit_meta]);return n.createElement(Un,null,n.createElement(xo,null),n.createElement(Ln,null,n.createElement(kn,null,n.createElement(Do,{intents:(null===e||void 0===e?void 0:e.intents)||[],indexNumber:t})),n.createElement(Mn,null,v),n.createElement(Tn,null,(null===e||void 0===e?void 0:e.actions)&&!!(null===(i=e.actions)||void 0===i?void 0:i.length)&&n.createElement(uo,null,null===(l=null===e||void 0===e?void 0:e.actions.filter((({type:e})=>e!==o.f.POLL_BUTTON)))||void 0===l?void 0:l.map((e=>{const t=_o[null===e||void 0===e?void 0:e.type];return t&&n.createElement(t,{key:e.id,active:b.includes(e.id),action:e,onChange:g,htmlType:"checkbox",formSubmitMeta:null===c||void 0===c?void 0:c.form_submit_meta})}))))),n.createElement(Eo,{onBack:()=>s&&s(),backProps:{isDisabled:!(1!==t)},nextText:p?null===p||void 0===p?void 0:p.label:"",onNext:()=>{const t={};c.form_submit_meta&&c.form_submit_meta.length&&(t[e.id]=c.form_submit_meta.map((e=>e.action_id)));const i=Object.assign(Object.assign({},c),{current_polls:t});m.validateSelectActions(b,e,(()=>{d&&d(Object.assign(Object.assign(Object.assign({},a),null===e||void 0===e?void 0:e._message),i))}))}}))},RATING:({node:e,indexNumber:t})=>{var i,a;const{formatMessage:r,action:{pushNotifications:s}}=(0,n.useContext)(m.T),{params:d,onChange:c,onSubmit:u,onPrev:v,onNext:p}=(0,n.useContext)(Nn),[g,b]=(0,n.useState)((null===e||void 0===e?void 0:e._message)||{}),[f,h]=(0,n.useState)(!1),_=(0,n.useMemo)((()=>{var t;const i=null===(t=null===e||void 0===e?void 0:e.actions)||void 0===t?void 0:t.find((({type:e})=>e===o.f.RATING_STAR));if(g.form_submit_meta&&i){const e=null===g||void 0===g?void 0:g.form_submit_meta.findIndex((({action_id:e})=>e===(null===i||void 0===i?void 0:i.id)));if(-1!==e)return parseInt(null===g||void 0===g?void 0:g.form_submit_meta[e].value)}return 0}),[null===g||void 0===g?void 0:g.form_submit_meta]),E=(0,n.useMemo)((()=>{var t;const i=null===(t=null===e||void 0===e?void 0:e.actions)||void 0===t?void 0:t.find((({type:e})=>e==o.f.RATING_BUTTON));return i||null}),[]),y=t=>(0,l.a)(void 0,void 0,void 0,(function*(){if(t){const i=Object.assign(Object.assign(Object.assign({},d),g),{node_id:e.id,action_id:null===E||void 0===E?void 0:E.id,action_value:null===E||void 0===E?void 0:E.key,form_submit_meta:(null===g||void 0===g?void 0:g.form_submit_meta)?[...null===g||void 0===g?void 0:g.form_submit_meta]:[]}),n=[...null===i||void 0===i?void 0:i.form_submit_meta],o=n.findIndex((({action_id:e})=>e===t.action_id));-1!==o?n[o]=Object.assign({},t):n.push(t),i.form_submit_meta=[...n],b(i),c&&c(i)}}));return n.createElement(Un,null,n.createElement(xo,null),n.createElement(Ln,null,n.createElement(kn,null,n.createElement(Do,{intents:(null===e||void 0===e?void 0:e.intents)||[],indexNumber:t})),n.createElement(Tn,null,(null===e||void 0===e?void 0:e.actions)&&!!(null===(i=e.actions)||void 0===i?void 0:i.length)&&n.createElement(uo,null,null===(a=null===e||void 0===e?void 0:e.actions.filter((({type:e})=>e!==o.f.RATING_BUTTON)))||void 0===a?void 0:a.map((e=>{var t;const i=_o[null===e||void 0===e?void 0:e.type];return i&&n.createElement(i,{key:e.id,action:e,onChange:y,value:g&&(null===g||void 0===g?void 0:g.form_submit_meta)&&(null===(t=g.form_submit_meta)||void 0===t?void 0:t.find((({action_id:t})=>t===e.id)))})}))))),n.createElement(Eo,{onBack:()=>v&&v(),backProps:{isDisabled:!(1!==t)},nextText:E?null===E||void 0===E?void 0:E.label:"",onNext:()=>(0,l.a)(void 0,void 0,void 0,(function*(){if(g.form_submit_meta&&0!==_)if(f)p&&p(Object.assign(Object.assign(Object.assign({},d),g),null===e||void 0===e?void 0:e._message));else{const t=Object.assign(Object.assign(Object.assign({},d),null===e||void 0===e?void 0:e._message),g),i=yield On(t);if(1===(null===i||void 0===i?void 0:i._status)){const e=null===i||void 0===i?void 0:i._data,{node:n}=e,o=(0,l._)(e,["node"]),a=Object.assign(Object.assign({},n),{_message:Object.assign(Object.assign({},o),{node_id:n.id})});u&&u(a,t),h(!0)}}else s({title:"",message:r({id:"multiSelectError.required",defaultMessage:"There is no answer!"}),type:"warning"})}))}))},REACTION:({node:e,indexNumber:t})=>{const{formatMessage:i,action:{pushNotifications:o}}=(0,n.useContext)(m.T),{params:a,onSubmit:r,onPrev:s,onNext:d}=(0,n.useContext)(Nn),[c,u]=(0,n.useState)((null===e||void 0===e?void 0:e._message)||{});return n.createElement(Un,null,n.createElement(xo,null),n.createElement(Ln,null,n.createElement(kn,null,n.createElement(Do,{intents:(null===e||void 0===e?void 0:e.intents)||[],indexNumber:t})),n.createElement(Tn,null,n.createElement(mo,{value:(null===c||void 0===c?void 0:c.action_id)?[null===c||void 0===c?void 0:c.action_id]:[],actions:(null===e||void 0===e?void 0:e.actions)||[],onChange:t=>(0,l.a)(void 0,void 0,void 0,(function*(){if(t){u(Object.assign(Object.assign({},c),{action_id:null===t||void 0===t?void 0:t.id,action_value:null===t||void 0===t?void 0:t.key}));const i=Object.assign(Object.assign(Object.assign({},a),c),{node_id:e.id,action_id:null===t||void 0===t?void 0:t.id,action_value:null===t||void 0===t?void 0:t.key}),n=yield On(i);if(1===(null===n||void 0===n?void 0:n._status)){const e=null===n||void 0===n?void 0:n._data,{node:t}=e,o=(0,l._)(e,["node"]),a=Object.assign(Object.assign({},t),{_message:Object.assign(Object.assign({},o),{node_id:t.id})});r&&r(a,i)}}}))}))),n.createElement(Eo,{onBack:()=>s&&s(),backProps:{isDisabled:!(1!==t)},onNext:()=>{var t;(null===e||void 0===e?void 0:e._message)&&(null===(t=e._message)||void 0===t?void 0:t.action_id)?d&&d(Object.assign(Object.assign(Object.assign({},a),c),null===e||void 0===e?void 0:e._message)):o({title:"",message:i({id:"multiSelectError.required",defaultMessage:"There is no answer!"}),type:"warning"})}}))},REVIEW:({node:e,indexNumber:t})=>{const{formatMessage:i,action:{pushNotifications:a}}=(0,n.useContext)(m.T),{params:r,onChange:s,onSubmit:d,onPrev:c,onNext:u}=(0,n.useContext)(Nn),[v,p]=(0,n.useState)((null===e||void 0===e?void 0:e._message)||{}),[g,b]=(0,n.useState)(!1),f=(0,n.useMemo)((()=>{var t;return(null===(t=null===e||void 0===e?void 0:e.actions)||void 0===t?void 0:t.filter((({type:e})=>e===o.f.REVIEW_CHOICE)))||[]}),[null===e||void 0===e?void 0:e.actions]),h=(0,n.useMemo)((()=>{var t;return(null===(t=null===e||void 0===e?void 0:e.actions)||void 0===t?void 0:t.filter((({type:e})=>e===o.f.REVIEW_DESCRIPTION)))||[]}),[null===e||void 0===e?void 0:e.actions]),_=(0,n.useMemo)((()=>{var t;const i=null===(t=null===e||void 0===e?void 0:e.actions)||void 0===t?void 0:t.find((({type:e})=>e==o.f.REVIEW_BUTTON));return i||null}),[null===e||void 0===e?void 0:e.actions]),E=(0,n.useMemo)((()=>(null===v||void 0===v?void 0:v.form_submit_meta)?null===v||void 0===v?void 0:v.form_submit_meta.map((({action_id:e})=>e)).filter((e=>!!(null===f||void 0===f?void 0:f.map((({id:e})=>e)).includes(e)))):[]),[v,null===v||void 0===v?void 0:v.form_submit_meta]),y=t=>{if(t){const i=Object.assign(Object.assign(Object.assign({},r),v),{node_id:e.id,action_id:null===_||void 0===_?void 0:_.id,action_value:null===_||void 0===_?void 0:_.key,form_submit_meta:(null===v||void 0===v?void 0:v.form_submit_meta)?[...null===v||void 0===v?void 0:v.form_submit_meta]:[]});let n=[...null===i||void 0===i?void 0:i.form_submit_meta];const o=n.findIndex((({action_id:e})=>e===t.action_id));-1!==o?n=[...n.slice(0,o),...n.slice(o+1)]:n.push(t),i.form_submit_meta=[...n],p(i),b(!1),s&&s(i)}},x=t=>{if(t){const i=Object.assign(Object.assign(Object.assign({},r),v),{node_id:e.id,action_id:null===_||void 0===_?void 0:_.id,action_value:null===_||void 0===_?void 0:_.key,form_submit_meta:(null===v||void 0===v?void 0:v.form_submit_meta)?[...null===v||void 0===v?void 0:v.form_submit_meta]:[]}),n=[...null===i||void 0===i?void 0:i.form_submit_meta],o=n.findIndex((({action_id:e})=>e===t.action_id));-1!==o?n[o]=Object.assign({},t):n.push(t),i.form_submit_meta=[...n],p(i),b(!1),s&&s(i)}};return n.createElement(Un,null,n.createElement(xo,null),n.createElement(Ln,null,n.createElement(kn,null,n.createElement(Do,{intents:(null===e||void 0===e?void 0:e.intents)||[],indexNumber:t})),n.createElement(Tn,null,!!f.length&&n.createElement(Cn,null,n.createElement(uo,{className:"review-container"},f.map((e=>{var t;const i=_o[null===e||void 0===e?void 0:e.type];return i&&n.createElement(i,{key:e.id,action:e,onChange:y,active:v&&!!(null===(t=null===v||void 0===v?void 0:v.form_submit_meta)||void 0===t?void 0:t.find((({action_id:t})=>t===e.id)))||!1})})))),!!(null===h||void 0===h?void 0:h.length)&&n.createElement(uo,null,h.map((e=>{var t;const i=_o[null===e||void 0===e?void 0:e.type];return i&&n.createElement(i,{key:e.id,action:e,onChange:x,value:v&&(null===v||void 0===v?void 0:v.form_submit_meta)&&(null===(t=v.form_submit_meta)||void 0===t?void 0:t.find((({action_id:t})=>t===e.id)))})}))))),n.createElement(Eo,{onBack:()=>c&&c(),backProps:{isDisabled:!(1!==t)},nextText:_?null===_||void 0===_?void 0:_.label:"",onNext:()=>(0,l.a)(void 0,void 0,void 0,(function*(){var t;if((null===(t=null===e||void 0===e?void 0:e._message)||void 0===t?void 0:t.form_submit_meta)&&E.length)if(g)u&&u(Object.assign(Object.assign(Object.assign({},r),v),null===e||void 0===e?void 0:e._message));else{const t=Object.assign(Object.assign(Object.assign({},r),null===e||void 0===e?void 0:e._message),v),i=yield On(t);if(1===(null===i||void 0===i?void 0:i._status)){const e=null===i||void 0===i?void 0:i._data,{node:n}=e,o=(0,l._)(e,["node"]),a=Object.assign(Object.assign({},n),{_message:Object.assign(Object.assign({},o),{node_id:n.id})});d&&d(a,t),b(!0)}}else a({title:"",message:i({id:"multiSelectError.required",defaultMessage:"There is no answer!"}),type:"warning"})}))}))},RESULT_POLL:({node:e})=>{var t,i;return n.createElement(Un,null,n.createElement(xo,null),n.createElement(Ln,null,n.createElement(kn,null,n.createElement(Do,{intents:(null===e||void 0===e?void 0:e.intents)||[]})),n.createElement(Tn,null,(null===e||void 0===e?void 0:e.actions)&&!!(null===(t=e.actions)||void 0===t?void 0:t.length)&&n.createElement(uo,null,null===(i=null===e||void 0===e?void 0:e.actions.filter((({type:e})=>e!==o.f.POLL_BUTTON)))||void 0===i?void 0:i.map((t=>{const i=_o[null===t||void 0===t?void 0:t.type];return i&&n.createElement(i,{key:t.id,action:t,htmlType:"checkbox",node_type:null===e||void 0===e?void 0:e.type})}))))))},OTP:({node:e,indexNumber:t})=>{const{params:i,onPrev:l,onNext:a}=(0,n.useContext)(Nn),r=null===m.G||void 0===m.G?void 0:m.G.userInfo,s=null===m.G||void 0===m.G?void 0:m.G.locale,[d,c]=(0,n.useState)((null===e||void 0===e?void 0:e._message)||{}),u=(()=>{const e=null===m.G||void 0===m.G?void 0:m.G.userInfo,[t,i]=(0,n.useState)(!1);return(0,n.useEffect)((()=>{(null===e||void 0===e?void 0:e.phone)&&e.phone_verified_at&&e.verify_phone_code&&i(!0)}),[e]),t})();return n.createElement(Un,null,n.createElement(xo,null),n.createElement(Ln,null,n.createElement(kn,null,n.createElement(Do,{intents:(null===e||void 0===e?void 0:e.intents)||[],indexNumber:t})),n.createElement(Tn,null,n.createElement(Ko,{phoneNumber:null===r||void 0===r?void 0:r.phone,verified:u,areaCode:null===r||void 0===r?void 0:r.area_code,callBack:(t,n)=>{var l;const r=null===(l=null===e||void 0===e?void 0:e.actions)||void 0===l?void 0:l.find((({type:e})=>e===o.f.USER_SUBMIT_PHONE));if(!t||!r)return;const s=[{key:String(r.key),control:o.E[o.f.USER_SUBMIT_PHONE],value:n}],u=Object.assign(Object.assign({},d),{form_submit_meta:s,action_id:null===t||void 0===t?void 0:t.id,action_value:null===t||void 0===t?void 0:t.key});c(u),a&&a(Object.assign(Object.assign(Object.assign({},i),u),null===e||void 0===e?void 0:e._message))},actions:(null===e||void 0===e?void 0:e.actions)||[],countryCode:(null===s||void 0===s?void 0:s.split("-")[1])||"PH"}))),n.createElement(Eo,{onBack:()=>l&&l(),backProps:{isDisabled:!(1!==t)},hideNext:!0}))}},el=(0,N.Z)(X.B)` margin-top: 24px; ${O.M.mbUp} { margin-top: 16px; } `,tl=N.Z.div` margin-top: 24px; `,il=(0,N.Z)(ne.T)` text-align: center; ${O.M.mbUp} { text-align: left; } `,nl=(0,N.Z)(oe.H)` text-align: center; margin-bottom: 8px; ${O.M.mbUp} { margin-bottom: 0; text-align: left; } `,ol=N.Z.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; } `,ll=N.Z.div` flex-grow: 1; ${O.M.tdDown} { width: 100%; margin-left: 0; } `,al=N.Z.div` position: relative; display: flex; gap: 24px; ${O.M.mbDown} { flex-wrap: wrap; justify-content: center; } `,rl=N.Z.div` position: relative; overflow: hidden; background-color: ${A.r.colors.primary50}; padding: 32px; border-radius: ${A.r.borderRadius}; background-image: url('/images/subot-bg-transparent.png'); background-size: contain; background-repeat: repeat-y; ${O.M.mbDown} { padding: 24px; } `,sl=({node:e,setLoading:t})=>{const i=(0,n.useRef)({impress:!1}),o=null===m.G||void 0===m.G?void 0:m.G.userInfo,{params:a,onNext:r,trackingCommonInline:s,isMobile:d}=(0,n.useContext)(Nn),c=(e=!0)=>()=>{if(e){const e={cookie_id:a.cookie_id,window_id:a.window_id,bot_id:a.bot_id,title_url:a.title_url,url:a.url,gtm_id:a.gtm_id,ga_client_id:a.ga_client_id,device_id:(0,g.f)(window.navigator.userAgent)?2:1,account_id:a.account_id||(null===o||void 0===o?void 0:o.id)||null};t=e,(0,l.a)(void 0,void 0,void 0,(function*(){try{return yield(0,m.c)(de(re.GET_INLINE_CLICK),"POST",{data:t})}catch(e){}}))}var t;r&&r()};return(0,n.useEffect)((()=>{const n=()=>{i.current.element&&((e,t,n={})=>{window.IntersectionObserver&&!i.current.impress&&new IntersectionObserver(((e,i)=>{e.forEach((e=>t(e,i)))}),n).observe(e)})(i.current.element,((n,r)=>{n.isIntersecting?i.current.impress||(i.current.impress=!0,i.current.debounce&&clearTimeout(i.current.debounce),(null===e||void 0===e?void 0:e.inline_start_button)||t(!0),i.current.debounce=setTimeout((()=>{const t={cookie_id:a.cookie_id,window_id:a.window_id,bot_id:a.bot_id,title_url:a.title_url,url:a.url,gtm_id:a.gtm_id,ga_client_id:a.ga_client_id,device_id:(0,g.f)(window.navigator.userAgent)?2:1,account_id:a.account_id||(null===o||void 0===o?void 0:o.id)||null};var i;t&&(i=t,(0,l.a)(void 0,void 0,void 0,(function*(){try{return yield(0,m.c)(de(re.GET_INLINE_IMPRESSION),"POST",{data:i})}catch(e){}}))),(null===e||void 0===e?void 0:e.inline_start_button)||c(!1)()}),400),i.current.element&&(null===r||void 0===r||r.unobserve(i.current.element))):i.current.impress&&(i.current.impress=!1)}),{rootMargin:"1000px"})};return n(),window.addEventListener("scroll",n,{passive:!0}),()=>window.removeEventListener("scroll",n)}),[r]),e?n.createElement(rl,null,n.createElement(al,{ref:e=>i.current.element=e},e.inline_image&&n.createElement(ol,null,n.createElement("img",{loading:"lazy",src:e.inline_image,alt:""})),n.createElement(ll,null,e.inline_title||e.inline_headline?n.createElement(nl,{tag:"h3",fontWeight:"bold",color:A.r.colors.secondaryBase},n.createElement(tt,null,e.inline_title||e.inline_headline)):null,e.inline_review&&n.createElement(il,{size:"s4",color:A.r.colors.gray600,as:"div"},n.createElement(tt,null,e.inline_review)),e.inline_start_button&&n.createElement(el,Object.assign({size:"md",isBlock:d,onClick:c(!0),className:"pointer-event-child-none"},s,{"data-event-action":"Start"}),e.inline_start_button))),n.createElement(tl,null,n.createElement(tt,null,e.inline_description))):null},dl=N.Z.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: ${A.r.colors.gray800}; opacity: 0; pointer-events: none; &:before { position: absolute; z-index: -1; top: 0; right: 0; bottom: 0; left: 0; background-color: ${A.r.colors.neutral50||"#F7F9FC"}; content: ''; opacity: 1; } ${({isLoading:e})=>e&&" opacity: 1; pointer-events: auto; "}; `,cl=N.Z.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; } ${O.M.mbDown} { margin-right: -1rem; margin-left: -1rem; } `,ul=({id:e,isMobile:t,articleLink:i,customUrl:s})=>{const d=Ge(),c=(0,n.useRef)(null),u=(0,n.useRef)(null),[v,p]=(0,n.useState)(!0),[b,f]=(0,n.useState)({activeId:"",params:{},nodes:[],getParams:()=>({})}),h=null===m.G||void 0===m.G?void 0:m.G.userInfo,_=(0,n.useMemo)((()=>b.nodes.find((e=>e.id==b.activeId))),[b.nodes,b.activeId]),y=(0,n.useMemo)((()=>({"data-event-category":"Subot","data-event-label":d,"data-bot-id":b.params.bot_id,"data-bot-type":"Inline","data-question-id":"string"===typeof(null===_||void 0===_?void 0:_.id)?null===_||void 0===_?void 0:_.id:null})),[_,d,b.params.bot_id]),w=(0,n.useCallback)((()=>{var t,n,o,l;const d=window.gaData,c=(s||window.location.origin+a.b)+("tl-PH"===m.G.locale?i.replace("fil/",""):i),u={bot_id:e,account_id:(null===(t=(0,g.c)())||void 0===t?void 0:t.id)||null,action_id:"",action_value:"",cookie_id:(0,g.b)(null===(o=null===(n=null===m.G||void 0===m.G?void 0:m.G.router)||void 0===n?void 0:n.query)||void 0===o?void 0:o.cookie_id),current_score:0,current_keys:[],current_selected:[],form_submit_meta:[],gtm_id:d?Object.keys(d)[0]:"",ga_client_id:r.Z.get("_ga")||"",is_new:!1,mode:"inline",node_id:"",selected_actions:{},title_url:document.title||"",url:c.replace("http://localhost","https://discover.hellobacsi.com").replace("dev.","discover."),window_id:(0,g.d)()};return(0,g.o)(u,null===(l=null===m.G||void 0===m.G?void 0:m.G.router)||void 0===l?void 0:l.query)}),[]),N=()=>{u.current&&u.current.scrollIntoView({behavior:"smooth",block:"start",inline:"start"})},O=(e,t)=>(0,l.a)(void 0,void 0,void 0,(function*(){const i=Object.assign(Object.assign({},b),{nodes:[...b.nodes]});if(t&&(null===t||void 0===t?void 0:t.node_id)){const e=i.nodes.findIndex((({id:e})=>e==t.node_id));-1!==e&&(i.nodes[e]._message=Object.assign(Object.assign({},i.nodes[e]._message),t),i.nodes=[...i.nodes.slice(0,e+1)])}if(p(!0),e){const t=i.nodes.findIndex((({id:t})=>t==(null===e||void 0===e?void 0:e.id)));if(-1===t)i.nodes=[...i.nodes,Object.assign({},e)];else{const n=Object.assign(Object.assign(Object.assign({},i.nodes[t]),e),{_message:Object.assign(Object.assign({},i.nodes[t]._message),null===e||void 0===e?void 0:e._message)});i.nodes=[...i.nodes.slice(0,t),Object.assign({},n),...i.nodes.slice(t+1)]}i.activeId=e.id}setTimeout((()=>{f(i),p(!1),i.activeId&&Te({nodes:i.nodes,activeId:i.activeId,params:i.params,accountIdFromLogs:c.current})}),250),N()})),I=e=>(0,l.a)(void 0,void 0,void 0,(function*(){var t;if((null===e||void 0===e?void 0:e.url)&&(null===e||void 0===e?void 0:e.bot_id)){let i="",n=[];p(!0);const l=yield In(e.bot_id);1===(null===l||void 0===l?void 0:l._status)&&(i=null===l||void 0===l?void 0:l._data.id.toString(),n.push(null===l||void 0===l?void 0:l._data,null===l||void 0===l?void 0:l._data.first_node));const a=yield Oe(n[0]);if(a){const e=a.nodes[a.nodes.length-1];[o.d.FINAL,o.d.FINAL_THANK_YOU,o.d.FINAL_STANDARD].includes(e.type)||(n=a.nodes,i=a.activeId,c.current=(null===(t=a.params)||void 0===t?void 0:t.account_id)||0)}const r=Ne(e.bot_id,{getParams:w});if(r&&r.params.action_id&&r.params.action_value){const e=yield On(r.params);1===(null===e||void 0===e?void 0:e._status)&&(null===e||void 0===e?void 0:e._data.node)&&(i=null===e||void 0===e?void 0:e._data.node.id,n=r.listNodes,n[n.length-1]=null===e||void 0===e?void 0:e._data.node,Te({nodes:n,activeId:i,params:r.params,accountIdFromLogs:c.current}),setTimeout((()=>{N()}),100))}const s=(null===r||void 0===r?void 0:r.params)||(null===a||void 0===a?void 0:a.params)||e,d=Object.assign(Object.assign({},b),{params:s,activeId:i,nodes:n});p(!1),f(d)}}));return(0,n.useEffect)((()=>{var e;if(null===(e=null===b||void 0===b?void 0:b.nodes)||void 0===e?void 0:e.length)return console.log("Subot Already Loaded"),()=>{};if(r.Z.get(a.G)){const e=w();I(e)}else(0,g.e)({condition:()=>Boolean(r.Z.get(a.G)),finished:()=>{const e=w();I(e)}})}),[]),b.nodes.length&&!b.nodes[0].inline_active?null:n.createElement(Nn.Provider,{value:Object.assign(Object.assign({},b),{isMobile:t,getParams:w,onChange:e=>{f((t=>{var i;if(e&&(null===e||void 0===e?void 0:e.node_id)&&(null===e||void 0===e?void 0:e.node_id)==(null===t||void 0===t?void 0:t.activeId)){const n=t.nodes.findIndex((({id:e})=>e==(null===t||void 0===t?void 0:t.activeId)));if(-1!==n){const o=Object.assign(Object.assign({},t.nodes[n]),{_message:Object.assign(Object.assign({},null===(i=t.nodes[n])||void 0===i?void 0:i._message),e)});t.nodes[n]=o}}return Object.assign({},t)}))},onSubmit:O,onPrev:()=>{var e;const t=Object.assign({},b),i=null===(e=null===t||void 0===t?void 0:t.nodes)||void 0===e?void 0:e.findIndex((({id:e})=>e==(null===t||void 0===t?void 0:t.activeId)));if(i&&-1!==i&&i>1){const e=t.nodes[i-1];e&&(t.activeId=e.id)}N(),f(Object.assign({},t)),t.activeId&&Te({nodes:t.nodes,activeId:t.activeId,params:t.params,accountIdFromLogs:c.current})},onNext:e=>(0,l.a)(void 0,void 0,void 0,(function*(){if(e&&(null===e||void 0===e?void 0:e.node_id)){const t=Object.assign(Object.assign({},e),fe(b.nodes,b.activeId,e.action_id)),i=yield On(t);if(p(!1),1===(null===i||void 0===i?void 0:i._status)){const t=null===i||void 0===i?void 0:i._data,{node:n}=t,o=(0,l._)(t,["node"]),a=Object.assign(Object.assign({},n),{_message:Object.assign(Object.assign({},o),{node_id:n.id})});return void(-1!==b.nodes.findIndex((({id:e})=>e===a.id))?O(a):O(a,e))}}const t=b.nodes.find((({id:e})=>e==(null===b||void 0===b?void 0:b.activeId)));t&&!t.hasOwnProperty("type")&&(p(!0),b.nodes[0].id==(null===b||void 0===b?void 0:b.activeId)&&setTimeout((()=>{f(Object.assign(Object.assign({},b),{activeId:b.nodes[1].id.toString()})),p(!1),Te({nodes:b.nodes,activeId:b.nodes[1].id.toString(),params:w(),accountIdFromLogs:c.current})}),250))})),onReset:()=>{p(!0),f((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((()=>{p(!1)}),250),N()},trackingCommonInline:y,userInfo:h})},n.createElement(cl,{className:E()("hhg-subot",`hhg-subot-${e}`,!!b.nodes.length&&"hhg-subot-style")},!!b.nodes.length&&n.createElement(n.Fragment,null,n.createElement("div",{ref:u,className:"hhg-flag",style:{position:"absolute",top:-150,left:0,pointerEvents:"none"}}),n.createElement(dl,{isLoading:!!v},n.createElement(x.L,null),"Verifying..."),b.nodes.map(((e,t)=>{if(e.id.toString()===(null===b||void 0===b?void 0:b.activeId)){if(e.hasOwnProperty("type")){let i;switch(null===e||void 0===e?void 0:e.position){case o.c.SSO:i=Qo[o.c[null===e||void 0===e?void 0:e.position].valueOf()];break;default:i=Qo[o.d[null===e||void 0===e?void 0:e.type].valueOf()]}return e.is_multi_select&&e.type!==o.d.POLL&&(i=Qo.MULTIPLE),i&&n.createElement(i,{key:t.toString(),indexNumber:t,node:e})}return n.createElement(sl,{key:t.toString(),node:e,setLoading:p})}return null})))))};var ml=Object.freeze({__proto__:null,default:xn,SubotInlineRevampWithTheme:wn,UserInfoForm:Li,Markdown:tt,hexRgb:we,SubotInlineVoucherLeftUI:rt,SubotInline:ul,overrideParamsByQuery:g.o,ssoIntents:g.s,checkUntilFinished:g.e,getHhgIdFromCookie:g.k,getSubotCookieId:g.b,getUserIdFromCookie:g.a,getUserInfoFromCookie:g.c,getWindowId:g.d,getHelloSitesUrl:g.g,checkMobile:g.f,clickAndOpenInNewTab:g.h,TIME_RESET_RESEND_OTP:g.T,isFakeEmail:g.j,formatUrlWithEncrypedGa:g.i,getSubotApiPath:de,subotInlineMessage:ce,computeExtraSettingsForBot:ue,subotInlineFirstNode:me,subotInlineClick:ve,subotInlineImpression:pe,PATHS:re,getPreviousStateFromStorage:Ne,getSubotInlineLogs:Oe,extractUnifiedAnswers:Se,extractVoucherAnswers:ke,saveSubotInlineLogs:Te,getColorWithOpacity:Ce,detectToSkipNodeStart:Me,KEY_OF_TEXT_CHOICE_WITH_OTHER_FIELD:_e,SubotInlineIntentBaseTarget:At,SubotInlineIntentBase:$t,checkSyncDataOnFrisoCampaign:bt,handleFrisoRedirecition:ft,getDynamicScore:be,getCurrentTotalDynamicScore:fe,replaceTextWithVariables:he})}}]);