@cleartrip/talos-chat-ui 1.12.0 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ChatWindow/style.d.ts +3 -0
- package/dist/ChatWindow/style.d.ts.map +1 -1
- package/dist/talos-chat-ui.browser.cjs.js +1 -1
- package/dist/talos-chat-ui.browser.cjs.js.map +1 -1
- package/dist/talos-chat-ui.browser.esm.js +1 -1
- package/dist/talos-chat-ui.browser.esm.js.map +1 -1
- package/dist/talos-chat-ui.cjs.js +5 -2
- package/dist/talos-chat-ui.cjs.js.map +1 -1
- package/dist/talos-chat-ui.esm.js +5 -2
- package/dist/talos-chat-ui.esm.js.map +1 -1
- package/dist/talos-chat-ui.umd.js +5 -2
- package/dist/talos-chat-ui.umd.js.map +1 -1
- package/package.json +13 -13
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__rest as t,__awaiter as n,__generator as i}from"tslib";import{jsx as r,jsxs as o,Fragment as a}from"react/jsx-runtime";import{useMemo as l,forwardRef as c,useState as s,useRef as d,useEffect as u,useImperativeHandle as f,useCallback as h,memo as p,createContext as g,useContext as C,useSyncExternalStore as m,useLayoutEffect as v}from"react";import{useTheme as x,Box as _,Typography as y,Container as I,Transition as b,TypographyVariant as k,Spinner as S,Button as w,AiChatInput as E,Shimmer as A,DottedLoader as T,ThemeProvider as B,Toast as L,BottomSheet as R}from"@cleartrip/ct-design-components";import{ChatCapability as N,usePresentation as O,ChatPageType as F,useAppDispatch as D,ChatStatus as H,ChatErrorKind as G,useChatController as U,ChatNetworkProvider as P,ChatDispatchProvider as M}from"@cleartrip/talos-use-chat-controller";import{ActionType as z,WidgetType as V}from"@cleartrip/talos-widget-types";import{WidgetGenerator as Y,mergeFor as K}from"@cleartrip/talos-widget-manager";import{RAVEN_EVENT as W,RAVEN_ATTRIBUTE_KEY as j,RAVEN_ACTION as Z,RAVEN_ACTION_TYPE as q}from"@cleartrip/talos-constants";import{SequentialReveal as X}from"@cleartrip/talos-sequential-reveal";import{BackgroundGradient as Q,BackgroundGradientVariant as J}from"@cleartrip/talos-background-gradient";import{useNativeActions as $}from"@cleartrip/talos-use-native-actions";import{isEmpty as ee,checkDeviceType as te}from"@cleartrip/talos-general-utils";import{v4 as ne}from"uuid";import{Lottie as ie}from"@cleartrip/talos-lottie";import{AnimatedTicker as re}from"@cleartrip/talos-animated-ticker";import{HorizontalChipItem as oe}from"@cleartrip/talos-horizontal-chip-menu";import{Icon as ae}from"@cleartrip/talos-icon";var le,ce,se={camera:"image/*",gallery:".jpg,.jpeg,image/jpeg,.png,image/png",file:"application/pdf,.pdf"},de=function(t){var n=t.actions,i=x(),a=l(function(){return function(e){return{root:{position:"relative",zIndex:1},actionBox:{position:"relative",padding:e.spacing[3],borderRadius:e.border.radius[8],border:"1px solid ".concat(e.color.border.neutralShadowOpacity10),backgroundColor:e.color.background.neutral,flex:1,alignItems:"center",justifyContent:"center",cursor:"pointer"},hiddenInput:{position:"absolute",inset:0,width:"100%",height:"100%",opacity:0,cursor:"pointer"}}}(i)},[i]),c=function(e,t){return"string"==typeof e?r("img",{src:e,alt:t,height:40,width:40}):e};return r(_,e({boxSize:"tiny",horizontal:!0},{children:n.map(function(t){var n=t.label,i=t.onClick,l=t.onButtonClick,s=t.onChange,d=t.icon,u=t.inputType,f=t.isMultiple,h=t.useNativePicker;return o(_,e({boxSize:"micro",css:a.actionBox},{children:[c(d,n),r(y,e({variant:"L3"},{children:n})),u&&(h?r("button",{type:"button",onClick:l,style:a.hiddenInput,"aria-label":n}):r("input",e({type:"file",accept:se[u]},"camera"===u?{capture:"environment"}:{},{onClick:i,onChange:s,style:a.hiddenInput,"aria-label":n,multiple:f})))]}),n)})}))},ue=function(e,t){return void 0===t&&(t=!1),{root:{position:"sticky",top:0,zIndex:2,background:e.color.background.neutral,display:"flex",alignItems:"center",justifyContent:"space-between",borderRadius:"inherit",padding:e.spacing[4],boxShadow:t?e.elevation.bottomE2:e.elevation.bottomE1,transition:"box-shadow 200ms ease-out"},iconContainer:{width:e.size[5],height:e.size[5]},title:{background:"linear-gradient(79deg, #FF6F42 1.98%, #EE1C85 30.1%, #5E1EB8 90.59%)",backgroundClip:"text","-webkit-background-clip":"text","-webkit-text-fill-color":"transparent"},headerAction:{borderRadius:e.border.radius["50P"],border:"1px solid ".concat(e.color.border.disabledDark),display:"flex",alignItems:"center",justifyContent:"center",height:e.size[8],width:e.size[8],cursor:"pointer",flexShrink:0,background:e.color.background.neutral}}},fe=function(t){var n=t.children,i=t.onClick,o=t.styleConfig,a=x(),c=l(function(){return ue(a)},[a]),s=(o||{}).root;return r(I,e({onClick:i,css:e(e({},c.headerAction),null==s?void 0:s.css)},{children:n}))},he=function(){return o("svg",e({xmlns:"http://www.w3.org/2000/svg",width:"21",height:"20",viewBox:"0 0 21 20",fill:"none"},{children:[r("path",{d:"M8.43199 3.28636C8.58826 2.70596 9.41173 2.70596 9.56801 3.28636L9.85259 4.34331C10.5067 6.77256 12.4042 8.6701 14.8334 9.32417L15.8904 9.60875C16.4708 9.76502 16.4708 10.5885 15.8904 10.7448L14.8335 11.0293C12.4042 11.6834 10.5067 13.581 9.85259 16.0102L9.56801 17.0672C9.41173 17.6476 8.58826 17.6476 8.43199 17.0672L8.14741 16.0102C7.49334 13.581 5.5958 11.6834 3.16655 11.0293L2.1096 10.7448C1.5292 10.5885 1.5292 9.76502 2.1096 9.60875L3.16655 9.32417C5.5958 8.6701 7.49334 6.77256 8.14741 4.34331L8.43199 3.28636Z",fill:"url(#paint0_linear_3415_10691)"}),r("g",e({filter:"url(#filter0_f_3415_10691)"},{children:r("path",{d:"M9.56259 5.67664C10.0313 6.89539 11.8688 9.44538 15.4688 9.89538",stroke:"#F801B7","stroke-width":"0.588235"})})),r("g",e({filter:"url(#filter1_f_3415_10691)"},{children:r("path",{d:"M5.06265 11.3016C6.20015 11.6588 8.58015 13.0588 9.00015 15.8016",stroke:"#7801F8","stroke-width":"0.588235"})})),r("g",e({filter:"url(#filter2_f_3415_10691)"},{children:r("path",{d:"M8.71826 3.42688C8.15576 7.08313 5.84951 9.44563 2.24951 9.89563",stroke:"#FFD58C","stroke-width":"0.294118"})})),r("g",e({filter:"url(#filter3_f_3415_10691)"},{children:r("path",{d:"M15.4691 10.4581C11.8129 11.0206 9.4504 13.3269 9.0004 16.9269",stroke:"#FFD58C","stroke-width":"0.294118"})})),r("path",{d:"M16.7285 0.791102C16.7871 0.573452 17.0959 0.573451 17.1545 0.791101L17.3938 1.67987C17.6391 2.59084 18.3507 3.30242 19.2616 3.5477L20.1504 3.787C20.368 3.8456 20.368 4.1544 20.1504 4.213L19.2616 4.4523C18.3507 4.69758 17.6391 5.40916 17.3938 6.32013L17.1545 7.2089C17.0959 7.42655 16.7871 7.42655 16.7285 7.2089L16.4892 6.32013C16.2439 5.40916 15.5323 4.69758 14.6214 4.4523L13.7326 4.213C13.5149 4.1544 13.5149 3.8456 13.7326 3.787L14.6214 3.5477C15.5323 3.30242 16.2439 2.59084 16.4892 1.67987L16.7285 0.791102Z",fill:"url(#paint1_linear_3415_10691)"}),r("g",e({filter:"url(#filter4_f_3415_10691)"},{children:r("path",{d:"M17.1917 1.99988C17.4 2.54154 18.2167 3.67488 19.8167 3.87488",stroke:"#F801B7","stroke-width":"0.220588"})})),r("g",e({filter:"url(#filter5_f_3415_10691)"},{children:r("path",{d:"M15.1913 4.49951C15.6969 4.65824 16.7547 5.28046 16.9413 6.49951",stroke:"#9937CA","stroke-width":"0.220588"})})),r("g",e({filter:"url(#filter6_f_3415_10691)"},{children:r("path",{d:"M16.8165 1.00061C16.5665 2.62561 15.5415 3.67561 13.9415 3.87561",stroke:"#FFD58C","stroke-width":"0.110294"})})),r("g",e({filter:"url(#filter7_f_3415_10691)"},{children:r("path",{d:"M19.817 4.12512C18.192 4.37512 17.142 5.40012 16.942 7.00012",stroke:"#FFD58C","stroke-width":"0.110294"})})),o("defs",{children:[o("filter",e({id:"filter0_f_3415_10691",x:"8.11162",y:"4.39457",width:"8.57017",height:"6.96915",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[r("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),r("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),r("feGaussianBlur",{stdDeviation:"0.588235",result:"effect1_foregroundBlur_3415_10691"})]})),o("filter",e({id:"filter1_f_3415_10691",x:"3.79808",y:"9.84453",width:"6.66929",height:"7.17814",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[r("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),r("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),r("feGaussianBlur",{stdDeviation:"0.588235",result:"effect1_foregroundBlur_3415_10691"})]})),o("filter",e({id:"filter2_f_3415_10691",x:"1.76067",y:"2.93395",width:"7.57353",height:"7.57814",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[r("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),r("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),r("feGaussianBlur",{stdDeviation:"0.235294",result:"effect1_foregroundBlur_3415_10691"})]})),o("filter",e({id:"filter3_f_3415_10691",x:"8.38387",y:"9.84216",width:"7.57823",height:"7.5735",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[r("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),r("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),r("feGaussianBlur",{stdDeviation:"0.235294",result:"effect1_foregroundBlur_3415_10691"})]})),o("filter",e({id:"filter4_f_3415_10691",x:"16.6475",y:"1.51915",width:"3.62396",height:"2.9064",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[r("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),r("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),r("feGaussianBlur",{stdDeviation:"0.220588",result:"effect1_foregroundBlur_3415_10691"})]})),o("filter",e({id:"filter5_f_3415_10691",x:"14.7171",y:"3.95311",width:"2.77441",height:"3.0043",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[r("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),r("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),r("feGaussianBlur",{stdDeviation:"0.220588",result:"effect1_foregroundBlur_3415_10691"})]})),o("filter",e({id:"filter6_f_3415_10691",x:"13.7582",y:"0.815717",width:"3.28928",height:"3.29105",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[r("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),r("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),r("feGaussianBlur",{stdDeviation:"0.0882353",result:"effect1_foregroundBlur_3415_10691"})]})),o("filter",e({id:"filter7_f_3415_10691",x:"16.7108",y:"3.89409",width:"3.29105",height:"3.28934",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[r("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),r("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),r("feGaussianBlur",{stdDeviation:"0.0882353",result:"effect1_foregroundBlur_3415_10691"})]})),o("linearGradient",e({id:"paint0_linear_3415_10691",x1:"9",y1:"1.17676",x2:"9",y2:"19.1768",gradientUnits:"userSpaceOnUse"},{children:[r("stop",{"stop-color":"#F0257E"}),r("stop",{offset:"1","stop-color":"#FE6C46"})]})),o("linearGradient",e({id:"paint1_linear_3415_10691",x1:"16.9415",y1:"0",x2:"16.9415",y2:"8",gradientUnits:"userSpaceOnUse"},{children:[r("stop",{"stop-color":"#F0257E"}),r("stop",{offset:"1","stop-color":"#FE6C46"})]}))]})]}))},pe=function(){return o("svg",e({xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},{children:[r("mask",e({id:"mask0_2214_2441",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"20",height:"20"},{children:r("rect",{width:"20",height:"20",fill:"#D9D9D9"})})),r("g",e({mask:"url(#mask0_2214_2441)"},{children:r("path",{d:"M9.96778 16.6671C8.36736 16.6671 6.96299 16.1759 5.75465 15.1935C4.54632 14.2112 3.78347 12.9524 3.46611 11.4171C3.43194 11.2942 3.44424 11.1806 3.50299 11.0764C3.56174 10.9723 3.65576 10.9117 3.78507 10.8946C3.90049 10.8775 4.00306 10.9032 4.09278 10.9717C4.1825 11.04 4.24611 11.1372 4.28361 11.2633C4.58486 12.588 5.2643 13.681 6.32194 14.5421C7.37972 15.4032 8.595 15.8337 9.96778 15.8337C11.5928 15.8337 12.9713 15.2678 14.1032 14.1358C15.2351 13.0039 15.8011 11.6254 15.8011 10.0004C15.8011 8.37541 15.2351 6.99693 14.1032 5.86499C12.9713 4.73305 11.5928 4.16707 9.96778 4.16707C9.10556 4.16707 8.29521 4.34923 7.53674 4.71353C6.77812 5.07784 6.10875 5.57944 5.52861 6.21832H7.17944C7.29792 6.21832 7.39694 6.25812 7.47653 6.3377C7.55625 6.41728 7.59611 6.51638 7.59611 6.63499C7.59611 6.7536 7.55625 6.8527 7.47653 6.93228C7.39694 7.01186 7.29792 7.05166 7.17944 7.05166H4.80757C4.61424 7.05166 4.45368 6.98784 4.3259 6.8602C4.19826 6.73256 4.13444 6.572 4.13444 6.37853V4.00687C4.13444 3.88825 4.17424 3.78916 4.25382 3.70957C4.3334 3.62999 4.4325 3.5902 4.55111 3.5902C4.66972 3.5902 4.76882 3.62999 4.8484 3.70957C4.92799 3.78916 4.96778 3.88825 4.96778 4.00687V5.58061C5.61208 4.87325 6.36715 4.32194 7.23299 3.92666C8.09896 3.53138 9.01055 3.33374 9.96778 3.33374C10.8919 3.33374 11.7581 3.50763 12.5663 3.85541C13.3745 4.20318 14.0807 4.67916 14.6849 5.28332C15.289 5.88749 15.765 6.59367 16.1128 7.40187C16.4606 8.21006 16.6344 9.07624 16.6344 10.0004C16.6344 10.9246 16.4606 11.7908 16.1128 12.5989C15.765 13.4071 15.289 14.1133 14.6849 14.7175C14.0807 15.3217 13.3745 15.7976 12.5663 16.1454C11.7581 16.4932 10.8919 16.6671 9.96778 16.6671ZM10.4326 9.82728L12.9326 12.3273C13.0105 12.4053 13.0522 12.501 13.0576 12.6142C13.0628 12.7275 13.0212 12.8285 12.9326 12.9171C12.8438 13.0057 12.7456 13.05 12.6378 13.05C12.5299 13.05 12.4315 13.0057 12.3428 12.9171L9.80111 10.3754C9.72847 10.3028 9.67667 10.2277 9.64569 10.1502C9.61472 10.0728 9.59924 9.98923 9.59924 9.89936V6.25041C9.59924 6.1318 9.63903 6.0327 9.71861 5.95311C9.79819 5.87353 9.89729 5.83374 10.0159 5.83374C10.1345 5.83374 10.2336 5.87353 10.3132 5.95311C10.3928 6.0327 10.4326 6.1318 10.4326 6.25041V9.82728Z",fill:"#1C1B1F"})}))]}))},ge=function(){return r("svg",e({xmlns:"http://www.w3.org/2000/svg",width:"20",height:"16",viewBox:"0 0 20 16",fill:"none"},{children:r("path",{d:"M14.7802 2.5411C14.9677 2.35394 15.2716 2.35386 15.4589 2.5411C15.6463 2.72854 15.6464 3.03238 15.4589 3.21981L10.6787 8.00008L15.4589 12.7804C15.6463 12.9678 15.6463 13.2717 15.4589 13.4591C15.2715 13.6465 14.9677 13.6464 14.7802 13.4591L9.99996 8.67879L5.21968 13.4591C5.03226 13.6465 4.72842 13.6465 4.54097 13.4591C4.35374 13.2717 4.35382 12.9678 4.54097 12.7804L9.32125 8.00008L4.54097 3.21981C4.35353 3.03236 4.35353 2.72854 4.54097 2.5411C4.72842 2.35365 5.03224 2.35365 5.21968 2.5411L9.99996 7.32137L14.7802 2.5411Z",fill:"#1A1A1A"})}))},Ce=function(){return r("svg",e({xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},{children:r("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M10.3536 3.64645C10.1583 3.45118 9.84178 3.45118 9.64652 3.64645L5.64652 7.64645C5.45134 7.84171 5.45128 8.15824 5.64652 8.35348L9.64652 12.3535C9.84176 12.5487 10.1583 12.5487 10.3536 12.3535C10.5488 12.1582 10.5488 11.8417 10.3536 11.6464L6.70707 7.99996L10.3536 4.35348C10.5488 4.15822 10.5488 3.84171 10.3536 3.64645Z",fill:"#1A1A1A"})}))},me=function(){var t=ne();return o("svg",e({xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},{children:[r("mask",e({id:t,style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"20",height:"20"},{children:r("rect",{width:"20",height:"20",fill:"#D9D9D9"})})),r("g",e({mask:"url(#".concat(t,")")},{children:r("path",{d:"M4.68023 16.6671C4.29662 16.6671 3.97635 16.5386 3.7194 16.2817C3.46246 16.0247 3.33398 15.7044 3.33398 15.3208V4.67999C3.33398 4.29638 3.46246 3.9761 3.7194 3.71916C3.97635 3.46221 4.29662 3.33374 4.68023 3.33374H10.6625C10.8014 3.33374 10.9056 3.37784 10.975 3.46603C11.0445 3.55409 11.0792 3.64888 11.0792 3.75041C11.0792 3.85193 11.0436 3.94673 10.9725 4.03478C10.9016 4.12298 10.7966 4.16707 10.6577 4.16707H4.68023C4.5519 4.16707 4.43433 4.22047 4.32753 4.32728C4.22072 4.43409 4.16732 4.55166 4.16732 4.67999V15.3208C4.16732 15.4492 4.22072 15.5667 4.32753 15.6735C4.43433 15.7803 4.5519 15.8337 4.68023 15.8337H15.3211C15.4494 15.8337 15.567 15.7803 15.6738 15.6735C15.7806 15.5667 15.834 15.4492 15.834 15.3208V9.25832C15.834 9.11943 15.8781 9.01527 15.9663 8.94582C16.0543 8.87638 16.1491 8.84166 16.2507 8.84166C16.3522 8.84166 16.447 8.87638 16.535 8.94582C16.6232 9.01527 16.6673 9.11943 16.6673 9.25832V15.3208C16.6673 15.7044 16.5388 16.0247 16.2819 16.2817C16.025 16.5386 15.7047 16.6671 15.3211 16.6671H4.68023ZM8.33398 10.9939V10.0469C8.33398 9.86742 8.3703 9.69304 8.44294 9.52374C8.51558 9.35429 8.61225 9.20923 8.73294 9.08853L15.7875 2.03416C15.8793 1.94221 15.976 1.8786 16.0775 1.84332C16.1791 1.80804 16.2859 1.79041 16.3982 1.79041C16.5029 1.79041 16.6052 1.80804 16.705 1.84332C16.8049 1.8786 16.8954 1.93686 16.9767 2.01811L17.9029 2.91707C17.9916 3.00902 18.0588 3.11027 18.1048 3.22082C18.1508 3.33138 18.1738 3.44277 18.1738 3.55499C18.1738 3.66707 18.1569 3.77304 18.1232 3.87291C18.0895 3.97291 18.0268 4.06881 17.935 4.16061L10.8323 11.2633C10.7116 11.384 10.5666 11.4814 10.3973 11.5556C10.228 11.6299 10.0536 11.6671 9.87398 11.6671H9.00711C8.81364 11.6671 8.65308 11.6033 8.52544 11.4756C8.3978 11.348 8.33398 11.1874 8.33398 10.9939ZM9.16732 10.8337H10.0775L15.6321 5.27916L15.1769 4.82416L14.669 4.33686L9.16732 9.83853V10.8337Z",fill:"#1C1B1F"})}))]}))},ve="Get quick support 24/7",xe=function(t){var n=x(),i=t.showBackButton,a=void 0!==i&&i,c=t.showCross,s=void 0!==c&&c,d=t.showPreviousChat,u=void 0!==d&&d,f=t.title,h=void 0===f?ve:f,p=t.showIcon,g=void 0===p||p,C=t.showNewChat,m=void 0!==C&&C,v=t.isScrolled,b=void 0!==v&&v,k=t.onBackButtonClick,S=t.onCrossClick,w=t.onPreviousChatClick,E=t.onNewChatClick,A=l(function(){return ue(n,b)},[n,b]);return o(I,e({css:A.root},{children:[o(_,e({boxSize:"tiny",horizontal:!0,css:{alignItems:"center"}},{children:[a&&r(fe,e({onClick:k},{children:r(Ce,{})})),o(_,e({boxSize:"pico",horizontal:!0},{children:[g&&r(I,e({css:A.iconContainer},{children:r(he,{})})),r(y,e({variant:"HM3",styleConfig:{css:A.title},lineClamp:1},{children:h}))]}))]})),o(_,e({boxSize:"tiny",horizontal:!0},{children:[u&&r(fe,e({onClick:w},{children:r(pe,{})})),m&&r(fe,e({onClick:E},{children:r(me,{})})),s&&r(fe,e({onClick:S},{children:r(ge,{})}))]}))]}))},_e=function(e){return{root:{display:"flex",flexDirection:"column",gap:e.spacing[2],alignItems:"center",marginBottom:e.spacing[4],justifyContent:"center"},initLoader:{display:"flex",flexDirection:"column",gap:e.spacing[2],alignItems:"center",justifyContent:"center",paddingBottom:e.spacing[6]}}},ye=function(t){var n=t.loaderText,i=void 0===n?"Processing your request":n,a=t.capability,c=void 0===a?N.CONVERSATIONAL:a,s=x(),d=l(function(){return _e(s)},[s]);return c===N.SEARCH?o(I,e({css:d.root},{children:[r(ie,{lottieId:"AI_LOADER",autoPlay:!0,loop:!0,hasContainer:!0,height:"32px",width:"32px"}),r(y,e({variant:"B3"},{children:i}))]})):r(ie,{lottieId:"AI_LOADER",autoPlay:!0,loop:!0,hasContainer:!0,height:"32px",width:"32px"})},Ie=function(){return r("svg",e({xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},{children:r("path",{d:"M7.78931 1.5C11.2629 1.5 14.0791 4.31549 14.0793 7.78906C14.0793 9.32329 13.5293 10.7285 12.6165 11.8203L15.9602 15.165C16.1795 15.3847 16.1798 15.7404 15.9602 15.96C15.7407 16.1795 15.385 16.1793 15.1653 15.96L11.8206 12.6162C10.7288 13.529 9.32351 14.0791 7.78931 14.0791C4.31576 14.0789 1.50024 11.2627 1.50024 7.78906C1.50045 4.31564 4.31589 1.50024 7.78931 1.5ZM7.78931 2.625C4.93721 2.62524 2.62545 4.93696 2.62524 7.78906C2.62524 10.6413 4.93708 12.9539 7.78931 12.9541C10.6417 12.9541 12.9543 10.6415 12.9543 7.78906C12.9541 4.93681 10.6416 2.625 7.78931 2.625Z",fill:"#FF4F17"})}))},be=function(t){var n=t.isContextSummaryLoading,i=t.contextSummary,c=x(),s=l(function(){return function(e){return{root:{padding:e.spacing[4]},fadeIn:{animation:"contextSummaryFadeIn 0.4s ease-in","@keyframes contextSummaryFadeIn":{from:{opacity:0},to:{opacity:1}}},loadingContainer:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},iconContainer:{position:"relative",width:e.size[10],height:e.size[10]},animatedIcon:{display:"flex",position:"absolute",animation:"contextSummaryIconMove 2s ease-in-out infinite","@keyframes contextSummaryIconMove":{"0%":{transform:"translate(calc((40px - 100%) / 2), 0px)"},"25%":{transform:"translate(calc(40px - 100%), calc((40px - 100%) / 2))"},"50%":{transform:"translate(calc((40px - 100%) / 2), calc(40px - 100%))"},"75%":{transform:"translate(0px, calc((40px - 100%) / 2))"},"100%":{transform:"translate(calc((40px - 100%) / 2), 0px)"}}}}}(c)},[c]);if(n)return o(_,e({boxSize:"pico",css:s.loadingContainer},{children:[r(I,e({css:s.iconContainer},{children:r(I,e({css:s.animatedIcon},{children:r(Ie,{})}))})),r(y,e({variant:"B2"},{children:"Updating search context..."}))]}));var d=(i||{}).data,u=void 0===d?{}:d,f=u.contextSummary,h=void 0===f?"Your search context has been updated":f,p=u.filterSummary,g=u.promptMessage,C=ee(g)?"How can I help you further?":g;return r(b,e({type:"fade",timeout:400,in:!0},{children:o(_,e({boxSize:"micro",css:s.fadeIn},{children:[r(y,e({variant:"B4CAPS",color:"subheading"},{children:"CONTINUE SEARCHING FOR"})),o(I,{children:[r(y,e({variant:"HM4",componentNode:"span"},{children:h})),!ee(p)&&o(a,{children:[r(y,e({variant:"HM4",componentNode:"span"},{children:"・"})),r(y,e({variant:"HM4",componentNode:"span"},{children:p}))]})]}),r(y,e({variant:"P2"},{children:C}))]}))}))},ke={delay:3e3,height:40,animateInfinite:!0,duration:650},Se={delay:2e3,animateInfinite:!0,duration:650,visibleCount:3,itemGap:12},we=function(t){var n,i,a,c,s=t.data,d=t.shouldHidePills,u=x(),f=null!=s?s:{},h=f.heading,p=f.suggestions,g=void 0===p?[]:p,C=null!==(n=null==h?void 0:h.static)&&void 0!==n?n:[],m=null!==(i=null==h?void 0:h.ticker)&&void 0!==i?i:[],v=l(function(){return function(e){return{root:{display:"flex",flexDirection:"column",justifyContent:"space-between",flex:1},greetingContainer:{marginBottom:e.spacing[10]},headingTickerText:{background:"linear-gradient(90deg, #FF6F42 0%, #EE1C85 50%, #5E1EB8 100%)",backgroundClip:"text","-webkit-background-clip":"text","-webkit-text-fill-color":"transparent"}}}(u)},[u]),_=Math.min(3,g.length),b=32*(a=_)+12*Math.max(0,a-1)+6,S=l(function(){return m.map(function(t,n){return r(y,e({variant:"HD3",styleConfig:{css:v.headingTickerText}},{children:t.text}),"".concat(t.text,"-").concat(n))})},[m,v.headingTickerText]),w=l(function(){return g.map(function(e){var t=function(e){var t;return{data:{label:e.label},events:{onClick:[{type:z.RAVEN_TRACKING,payload:{eventName:W.U_UI_ACTION,eventData:(t={},t[j.ACTION_NAME]=Z.U_SUGGESTED_PROMPT_SELECTED,t[j.ACTION_TYPE]=q.CLICK,t[j.U_AGENT_PROMPT_SELECTED]=e.label,t)}},{type:z.SEND_MESSAGE,payload:{message:e.label}}]}}}(e),n=t.data,i=t.events;return r(oe,{data:n,events:i},e.id)})},[g]);return o(I,e({css:v.root},{children:[o(I,{children:[r(I,e({css:v.greetingContainer},{children:r(y,e({variant:k.P1},{children:(c=(new Date).getHours(),c<12?"Good morning!":c<18?"Good afternoon!":"Good evening!")}))})),o(I,{children:[C.map(function(t,n){return r(y,e({variant:k.HD3},{children:t.text}),"".concat(t.text,"-").concat(n))}),r(re,{elements:S,config:ke})]})]}),!d&&r(re,{elements:w,config:e(e({},Se),{height:b})})]}))},Ee=function(t){return o("svg",e({xmlns:"http://www.w3.org/2000/svg",width:"289",height:"160",viewBox:"0 0 289 160",fill:"none"},t,{children:[r("g",e({opacity:"0.7",filter:"url(#filter0_f_1771_46149)"},{children:r("ellipse",{cx:"94.5",cy:"123.5",rx:"114.5",ry:"43.5",fill:"#FFB8F9"})})),r("defs",{children:o("filter",e({id:"filter0_f_1771_46149",x:"-100",y:"0",width:"389",height:"247",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[r("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),r("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),r("feGaussianBlur",{stdDeviation:"40",result:"effect1_foregroundBlur_1771_46149"})]}))})]}))},Ae=function(t){return o("svg",e({xmlns:"http://www.w3.org/2000/svg",width:"299",height:"160",viewBox:"0 0 299 160",fill:"none"},t,{children:[r("g",e({opacity:"0.7",filter:"url(#filter0_f_1771_46148)"},{children:r("ellipse",{cx:"194.5",cy:"123.5",rx:"114.5",ry:"43.5",fill:"#FFB299"})})),r("defs",{children:o("filter",e({id:"filter0_f_1771_46148",x:"0",y:"0",width:"389",height:"247",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[r("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),r("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),r("feGaussianBlur",{stdDeviation:"40",result:"effect1_foregroundBlur_1771_46148"})]}))})]}))},Te=function(){return o("svg",e({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[r("path",{d:"M10.9229 5.33203C14.0106 5.33203 16.5136 7.83512 16.5137 10.9229C16.5137 12.2862 16.0247 13.5346 15.2139 14.5049L18.1865 17.4775C18.3817 17.6728 18.3818 17.9893 18.1865 18.1846C17.9913 18.3798 17.6748 18.3798 17.4795 18.1846L14.5068 15.2119C13.5363 16.0238 12.2872 16.5137 10.9229 16.5137C7.83512 16.5136 5.33203 14.0106 5.33203 10.9229C5.33208 7.83515 7.83515 5.33208 10.9229 5.33203ZM10.9229 6.33203C8.38743 6.33208 6.33208 8.38743 6.33203 10.9229C6.33203 13.4583 8.3874 15.5136 10.9229 15.5137C13.4583 15.5137 15.5137 13.4583 15.5137 10.9229C15.5136 8.3874 13.4583 6.33203 10.9229 6.33203Z",fill:"#808080"}),r("path",{d:"M17.3715 1.09371C17.4526 0.792808 17.8795 0.792809 17.9605 1.09372L18.108 1.64169C18.4471 2.90112 19.4309 3.88489 20.6903 4.224L21.2383 4.37153C21.5392 4.45255 21.5392 4.87948 21.2383 4.9605L20.6903 5.10804C19.4309 5.44714 18.4471 6.43091 18.108 7.69035L17.9605 8.23832C17.8795 8.53922 17.4526 8.53922 17.3715 8.23832L17.224 7.69035C16.8849 6.43091 15.9011 5.44714 14.6417 5.10804L14.0937 4.9605C13.7928 4.87948 13.7928 4.45255 14.0937 4.37153L14.6417 4.22399C15.9011 3.88489 16.8849 2.90112 17.224 1.64168L17.3715 1.09371Z",fill:"#808080"}),r("g",e({filter:"url(#filter0_f_3317_42725)"},{children:r("path",{d:"M17.959 2.33203C18.202 2.96389 19.1547 4.28593 21.0211 4.51923",stroke:"#FFE9E9",strokeWidth:"0.304968"})})),r("g",e({filter:"url(#filter1_f_3317_42725)"},{children:r("path",{d:"M15.625 5.25C16.2147 5.43516 17.4486 6.16098 17.6664 7.58301",stroke:"#E4CBFF",strokeWidth:"0.304968"})})),r("g",e({filter:"url(#filter2_f_3317_42725)"},{children:r("path",{d:"M17.5215 1.16797C17.2299 3.06354 16.0342 4.28837 14.1678 4.52167",stroke:"#FFD58C",strokeWidth:"0.152484"})})),r("g",e({filter:"url(#filter3_f_3317_42725)"},{children:r("path",{d:"M21.0195 4.8125C19.124 5.10413 17.8991 6.29979 17.6658 8.1662",stroke:"#BCB09C",strokeWidth:"0.152484"})})),o("defs",{children:[o("filter",e({id:"filter0_f_3317_42725",x:"17.2067",y:"1.66741",width:"4.44314",height:"3.61245",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB"},{children:[r("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),r("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),r("feGaussianBlur",{stdDeviation:"0.304968",result:"effect1_foregroundBlur_3317_42725"})]})),o("filter",e({id:"filter1_f_3317_42725",x:"14.9694",y:"4.49553",width:"3.45767",height:"3.71987",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB"},{children:[r("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),r("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),r("feGaussianBlur",{stdDeviation:"0.304968",result:"effect1_foregroundBlur_3317_42725"})]})),o("filter",e({id:"filter2_f_3317_42725",x:"13.9144",y:"0.912275",width:"3.92643",height:"3.92936",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB"},{children:[r("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),r("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),r("feGaussianBlur",{stdDeviation:"0.121987",result:"effect1_foregroundBlur_3317_42725"})]})),o("filter",e({id:"filter3_f_3317_42725",x:"17.3462",y:"4.49235",width:"3.92887",height:"3.9274",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB"},{children:[r("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),r("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),r("feGaussianBlur",{stdDeviation:"0.121987",result:"effect1_foregroundBlur_3317_42725"})]}))]})]}))},Be=c(function(n,i){var c,p=x(),g=n.chatId,C=n.chatData,m=n.pageType,v=n.isInitialLoading,b=n.isReplyLoading,k=n.replyLoaderText,A=n.isTop,T=n.showNativeActions,B=n.isContextSummaryLoading,L=n.contextSummaryError,R=n.contextSummary,G=n.capability,U=n.sendMessage,P=n.onPreviousChatClick,M=n.onBackButtonClick,K=n.onClose,ne=n.handleMediaPicked,ie=n.scrollToBottomOnLoad,re=n.onStop,oe=G===N.SEARCH,ae=l(function(){return function(e,t){return{userMessageContainer:{scrollMarginTop:e.spacing[3],display:"flex",justifyContent:"flex-end"},chatContainer:{flex:1,minHeight:0,overflowY:"auto",display:"flex",flexDirection:"column",position:"relative",zIndex:1},animatedContainer:{flex:1,minHeight:0,overflowY:"auto",display:"flex",flexDirection:"column",transition:"transform 800ms ease-out, opacity 800ms ease-out",paddingTop:e.spacing[6],paddingLeft:e.spacing[4],paddingRight:e.spacing[4],paddingBottom:"".concat(100,"px"),position:"relative",zIndex:1},loadingContainer:{flex:1,minHeight:0,overflowY:"auto",display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:1},bgGradient:{position:"relative",marginTop:-200,bottom:0,left:0,right:0,zIndex:10,pointerEvents:"none"},bgGradientLeft:{position:"absolute",bottom:0,left:0,zIndex:1,pointerEvents:"none"},bgGradientRight:{position:"absolute",bottom:0,right:0,zIndex:1,pointerEvents:"none"},inputContainer:{paddingLeft:e.spacing[4],paddingRight:e.spacing[4],paddingBottom:e.spacing[6],paddingTop:t?0:e.spacing[4],position:t?"absolute":"relative",zIndex:10,boxSizing:"border-box",width:"100%",bottom:0,pointerEvents:"auto"},newChatContainer:{paddingLeft:e.spacing[4],paddingRight:e.spacing[4],paddingTop:e.spacing[4],paddingBottom:e.spacing[6],backgroundColor:e.color.background.neutral,position:"relative",zIndex:1},chatClosedMessage:{textAlign:"center",marginBottom:e.spacing[4]}}}(p,oe)},[p,oe]),le=oe&&b,ce=s(""),se=ce[0],ue=ce[1],fe=s(!1),he=fe[0],pe=fe[1],ge=s(!1),Ce=ge[0],me=ge[1],_e=d(null),Ie=d([]),ke=d(null),Se=d(null),Be=d(null),Le=d(!1),Re=d(!1),Ne=d(null),Oe=O(),Fe=Oe.hasPresented,De=Oe.markPresented,He=null!=C?C:{},Ge=He.messages,Ue=void 0===Ge?[]:Ge,Pe=He.pageData,Me=He.status,ze=He.landingContent,Ve=ee(Ue)&&!v&&!ee(ze),Ye=b&&A,Ke=d(null),We=s(!1),je=We[0],Ze=We[1],qe=d(null!==(c=null==Ue?void 0:Ue.length)&&void 0!==c?c:null),Xe=B||!ee(R)||L;u(function(){Ke.current=null,Ze(!1)},[g]),u(function(){Xe&&(null!==Ke.current?Ue.length>Ke.current&&Ze(!0):Ke.current=Ue.length)},[Xe,Ue.length]);var Qe=m===F.CHAT&&Xe&&!je,Je=Pe||{},$e=Je.title,et=void 0===$e?ve:$e,tt=Je.newChatEnabled,nt=Je.footerSlots,it=void 0===nt?[]:nt,rt=s(!1),ot=rt[0],at=rt[1],lt=s(!1),ct=lt[0],st=lt[1],dt=l(function(){return m===F.CHAT?oe?"AI Search":ve:et},[m,et]),ut=D().dispatch,ft=$(),ht=ft.handleGalleryClick,pt=ft.handleCameraClick,gt=ft.handleUploadChange;u(function(){var e;me(null!=T&&T),T&&(null===(e=_e.current)||void 0===e||e.focus())},[T]),u(function(){at(!v||!A)},[v,A]);var Ct=function(e){ue(e)},mt=function(){var e=Ce;ut({type:z.SHOW_NATIVE_ACTIONS,payload:{isNativeActionsEnabled:!e}}),me(function(e){return!e})},vt=function(){U(se),ue(""),setTimeout(function(){var e;null===(e=_e.current)||void 0===e||e.blur()},100)},xt=function(){ht(ne)},_t=function(){pt(ne)},yt=function(e){gt(e,ne)},It="iPhoneApp"===te(),bt=[{label:"Gallery",onClick:xt,onButtonClick:xt,onChange:yt,icon:"https://rukmini-ct.flixcart.com/f_auto,q_auto/offermgmt-prod/chatbot/gallery.png",inputType:"gallery",isMultiple:!0,useNativePicker:It},{label:"Camera",onClick:_t,onButtonClick:_t,onChange:yt,icon:"https://rukmini-ct.flixcart.com/f_auto,q_auto/offermgmt-prod/chatbot/camera-3d.png",inputType:"camera",useNativePicker:It},{label:"Files",onChange:yt,icon:"https://rukmini-ct.flixcart.com/f_auto,q_auto/offermgmt-prod/chatbot/pdf-3d.png",inputType:"file"}],kt=function(){var e;Ve?(null===(e=_e.current)||void 0===e||e.focus(),pe(!0)):ut({type:z.CREATE_NEW_CHAT})},St=function(e){void 0===e&&(e="auto");var t=null==ke?void 0:ke.current;t&&t.scrollTo({top:t.scrollHeight,behavior:e})};f(i,function(){return{scrollToBottom:St}},[]);var wt=h(function(){var e,t,n,i=ke.current,r=Se.current;if(i&&r){var o=-1;if(Ue)for(var a=Ue.length-1;a>=0;a--)if(Ue[a].type===V.USER_MESSAGE){o=a;break}if(-1!==o){var l=Ie.current[o];if(l){var c=0;for(a=o+1;a<(null!==(e=null==Ue?void 0:Ue.length)&&void 0!==e?e:0);a++){var s=Ie.current[a];s&&(c+=s.offsetHeight)}oe&&(c+=(null!==(n=null===(t=Be.current)||void 0===t?void 0:t.offsetHeight)&&void 0!==n?n:0)+12);var d=Math.max(0,i.clientHeight-100-l.offsetHeight-c);r.style.height="".concat(d,"px")}}else r.style.height="0px"}},[Ue,Qe]);u(function(){if(m===F.PREVIOUS_CHAT)return Le.current=!0,void St();if(ie){if(v)return;if(null===Ne.current&&(Ne.current=Ue.length),Ue.length<=Ne.current)return Le.current=!0,void St()}wt();var e=-1;if(Ue)for(var t=Ue.length-1;t>=0;t--)if(Ue[t].type===V.USER_MESSAGE){e=t;break}if(-1!==e){var n=Ie.current[e];if(n){Re.current=!0,n.scrollIntoView({behavior:"smooth",block:"start"});var i=ke.current,r=function(){Re.current=!1};null==i||i.addEventListener("scrollend",r,{once:!0}),setTimeout(r,500)}}},[Ue,m,wt,ie,v]),u(function(){var e=ke.current;if(e){var t=new ResizeObserver(function(){var e=ie&&(null===Ne.current||Ue.length<=Ne.current);if(m===F.PREVIOUS_CHAT||e)Le.current&&St();else if(Re.current||wt(),oe&&(v||qe.current===(null==Ue?void 0:Ue.length))){var t=Se.current;t&&(t.style.height="0px"),St()}});return t.observe(e),Ie.current.forEach(function(e){e&&t.observe(e)}),Be.current&&t.observe(Be.current),function(){return t.disconnect()}}},[Ue,wt,m,ie,Qe,oe]),u(function(){var e=ke.current;if(e){var t=function(){st(e.scrollTop>0);var t=e.scrollHeight-e.scrollTop-e.clientHeight;Le.current=t<4};return t(),e.addEventListener("scroll",t,{passive:!0}),function(){return e.removeEventListener("scroll",t)}}},[]);var Et=l(function(){return m===F.CHAT&&Me!==H.CLOSED||Me===H.ON_GOING},[m,Me]),At=l(function(){return Me===H.CLOSED&&m===F.CHAT},[m,Me]),Tt=l(function(){return G===N.SEARCH||tt&&m!==F.CHAT},[G,tt,m]),Bt=function(){pe(!1)},Lt=function(){return Et?o(I,e({css:ae.inputContainer},{children:[Ye&&G===N.SEARCH&&r(ye,{capability:G,loaderText:k}),o(_,e({boxSize:"tiny"},{children:[r(E,{rows:4,value:se,onChange:Ct,placeholder:"Ask a question",onPrefixClick:mt,showKeyboardIcon:Ce,onSubmit:vt,onBlur:Bt,disableAction:b||v,prefix:oe?r(Te,{}):void 0,suffix:se.length>0||le?void 0:r(a,{}),isStreaming:le,onStop:re,ref:_e}),Ce&&r(de,{actions:bt})]}))]})):null};return o(a,{children:[r(xe,{showCross:m===F.CHAT,onCrossClick:function(){null==K||K()},showPreviousChat:m===F.CHAT,onPreviousChatClick:function(){var e;ut({type:z.RAVEN_TRACKING,payload:{eventName:W.U_UI_ACTION,eventData:(e={},e[j.ACTION_NAME]=Z.U_AGENT_HISTORY_BUTTON,e[j.ACTION_TYPE]=q.CLICK,e)}}),null==P||P()},showBackButton:m===F.PREVIOUS_CHAT,onBackButtonClick:function(){null==M||M()},showNewChat:Tt,onNewChatClick:kt,showIcon:m===F.CHAT,title:dt,isScrolled:ct}),v&&A&&r(_,e({boxSize:"tiny",css:e({},ae.loadingContainer)},{children:r(S,{variant:"thin",height:"54px",width:"54px",borderColor:p.color.border.link,trackColor:p.color.border.disabledDark})})),r(_,e({boxSize:"tiny",css:ae.chatContainer},{children:o(_,e({css:e(e({},ae.animatedContainer),m===F.CHAT&&!ie&&!oe&&{transform:ot?"translateY(0)":"translateY(25%)",opacity:ot?1:0}),boxSize:"tiny",ref:ke},{children:[!v&&(null==Ue?void 0:Ue.map(function(t,n){var i,o=t.id,a=t.type,l=t.chunks,c=t.metaData,s=void 0===c?{}:c,d=((i={})[V.USER_MESSAGE]=ae.userMessageContainer,i),u=e(e({},s),{messageId:o,chatId:g,messageIndex:n,totalMessages:null==Ue?void 0:Ue.length,pageType:m}),f=!Fe(g,o);return 0===l.length?null:r(I,e({css:e({},d[a]),ref:function(e){Ie.current[n]=e}},{children:l.length>0&&r(X,e({animate:f,onComplete:function(){return De(g,o)}},{children:l.map(function(t,n){var i,o=e(e(e({},null!==(i=t.metaData)&&void 0!==i?i:{}),u),{animate:f});return r(Y,e({},t,{metaData:o}),n)})}))}),"".concat(g,"_").concat(o))})),Ye&&G===N.CONVERSATIONAL&&r(ye,{capability:G,loaderText:k}),m===F.CHAT&&r(I,{ref:Se,css:{flexShrink:0}}),ee(Ue)&&!v&&ze&&r(we,{data:ze,shouldHidePills:Qe||he||se.length>=3}),Qe&&r(I,e({ref:Be,css:{marginTop:"auto",paddingTop:"12px"}},{children:r(be,{contextSummary:R,isContextSummaryLoading:B,contextSummaryError:L})}))]}))})),oe?r(Q,e({variant:le?J.PROCESSING:J.DEFAULT,styleConfig:{root:{css:ae.bgGradient}}},{children:Lt()})):o(a,{children:[r(Ee,{style:ae.bgGradientLeft}),r(Ae,{style:ae.bgGradientRight})]}),!oe&&Lt(),At&&o(I,e({css:ae.newChatContainer},{children:[r(y,e({variant:"P3",styleConfig:{css:ae.chatClosedMessage}},{children:"This query has been closed, If you have a query regarding this trip, you can start a new chat."})),r(w,e({variant:"contained",color:"primary",isFullWidth:!0,onClick:kt},{children:"Start New Chat"}))]})),m===F.PREVIOUS_CHAT&&r(I,{children:null==it?void 0:it.map(function(n,i){var o=n.type,a=t(n,["type"]),l="".concat(o,"_").concat(i);return r(Y,e({type:o},a),l)})})]})}),Le=p(Be),Re=function(e){return{root:{borderRadius:"inherit",display:"flex",flexDirection:"column",flex:1,minHeight:0},listContainer:{flex:1,minHeight:0,overflowY:"auto",position:"relative",zIndex:1},bgGradientLeft:{position:"absolute",bottom:0,left:0,zIndex:0,pointerEvents:"none"},bgGradientRight:{position:"absolute",bottom:0,right:0,zIndex:0,pointerEvents:"none"},shimmerContainer:{paddingTop:e.spacing[6],paddingBottom:e.spacing[6],paddingLeft:e.spacing[4],paddingRight:e.spacing[4]},shimmerCard:{border:"1px solid ".concat(e.color.border.disabledDark),borderRadius:e.border.radius[12],padding:e.spacing[3]},bodyContainer:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",flex:1},errorContainer:{maxWidth:"200px",alignItems:"center"},labelContainer:{alignItems:"center"},errorText:{textAlign:"center"},errorButton:{minWidth:"120px",background:"transparent"}}},Ne=function(){var t=x(),n=l(function(){return Re(t)},[t]);return r(I,e({css:n.shimmerContainer},{children:o(_,e({boxSize:"tiny"},{children:[r(A,{height:t.size[5],width:"120px"}),Array.from({length:3}).map(function(i,a){return o(_,e({boxSize:"nano",css:n.shimmerCard},{children:[r(A,{height:t.size[4],width:"150px"}),r(A,{height:t.size[4],width:"200px"})]}),a)})]}))}))};!function(e){e.ERROR="error",e.EMPTY="empty"}(le||(le={}));var Oe,Fe=((ce={})[le.ERROR]={icon:"https://rukmini-ct.flixcart.com/f_auto,q_auto/offermgmt-prod/chatbot/3d-mug.png",text:"Oops, we couldn't load the chat",buttonLabel:"Try again"},ce[le.EMPTY]={icon:"https://rukmini-ct.flixcart.com/f_auto,q_auto/offermgmt-prod/chatbot/chat-bubble.png",text:"No chats yet? Start your first one!",buttonLabel:"Start a new chat"},ce),De=function(t){var n=t.variant,i=void 0===n?le.ERROR:n,a=x(),c=l(function(){return Re(a)},[a]),s=D().dispatch;return r(I,e({css:c.bodyContainer},{children:o(_,e({boxSize:"medium",css:c.errorContainer},{children:[r("img",{src:Fe[i].icon,alt:i,height:100,width:100}),o(_,e({boxSize:"small",css:c.labelContainer},{children:[r(y,e({variant:"HM3",styleConfig:{css:c.errorText}},{children:Fe[i].text})),r(w,e({variant:"outline",onClick:function(){i===le.ERROR?s({type:z.REFETCH_PREVIOUS_CHAT}):s({type:z.CREATE_NEW_CHAT})},css:c.errorButton},{children:Fe[i].buttonLabel}))]}))]}))}))},He=p(function(t){var n=t.chats,i=t.loading,a=void 0!==i&&i,c=t.onBack,f=t.previousChatError,h=null!=n?n:{},p=h.previousChats,g=void 0===p?[]:p,C=h.pageData,m=null!=C?C:{},v=m.newChatEnabled,y=m.chatCount,b=x(),k=l(function(){return Re(b)},[b]),S=D().dispatch,w=d(null),E=s(!1),A=E[0],T=E[1];u(function(){var e=w.current;if(e){var t=function(){T(e.scrollTop>0)};return t(),e.addEventListener("scroll",t,{passive:!0}),function(){return e.removeEventListener("scroll",t)}}},[a,g.length]);return o(I,e({css:k.root},{children:[r(xe,{showCross:!1,showPreviousChat:!1,showBackButton:!0,onBackButtonClick:c,title:"Past Conversations",showNewChat:v,onNewChatClick:function(){S({type:z.CREATE_NEW_CHAT})},showIcon:!1,isScrolled:A}),a&&r(Ne,{}),!a&&(f?r(De,{variant:le.ERROR}):0===y?r(De,{variant:le.EMPTY}):null),!a&&g.length>0&&!!y&&y>0&&r(_,e({boxSize:"medium",css:k.listContainer,ref:w},{children:g.map(function(e,t){var n=e.type,i=e.data,o="".concat(n,"_").concat(t);return r(Y,{type:n,data:i},o)})})),r(Ee,{style:k.bgGradientLeft}),r(Ae,{style:k.bgGradientRight})]}))}),Ge=function(t){var n=t.onClose,i=t.onBack,c=t.retry,s=x(),d=l(function(){return{bodyContainer:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",flex:1},errorContainer:{maxWidth:"200px",alignItems:"center"},labelContainer:{alignItems:"center"},errorText:{textAlign:"center"},errorButton:{width:"120px",background:"transparent"},bgGradientLeft:{position:"absolute",bottom:0,left:0,zIndex:0,pointerEvents:"none"},bgGradientRight:{position:"absolute",bottom:0,right:0,zIndex:0,pointerEvents:"none"}}},[s]),u=D().dispatch,f=(null==c?void 0:c.kind)===G.PREVIOUS;return o(a,{children:[r(xe,{showBackButton:f,onBackButtonClick:i,showCross:!f,onCrossClick:n,showIcon:!1,title:""}),r(I,e({css:d.bodyContainer},{children:o(_,e({boxSize:"medium",css:d.errorContainer},{children:[r("img",{src:"https://rukmini-ct.flixcart.com/f_auto,q_auto/offermgmt-prod/chatbot/3d-mug.png",alt:"error",height:100,width:100}),o(_,e({boxSize:"small",css:d.labelContainer},{children:[r(y,e({variant:"HM3",styleConfig:{css:d.errorText}},{children:"Oops, we couldn't load the chat"})),r(w,e({variant:"outline",onClick:function(){u({type:z.RETRY_CHAT_ERROR})},css:d.errorButton},{children:"Try again"}))]}))]}))})),r(Ee,{style:d.bgGradientLeft}),r(Ae,{style:d.bgGradientRight})]})},Ue=function(t){var n=t.loading,i=void 0!==n&&n,a=x(),c=l(function(){return _e(a)},[a]);return i?o(I,e({css:c.initLoader},{children:[r(T,{}),r(y,e({variant:"B3"},{children:"Getting ready"}))]})):null},Pe=function(){return r("svg",e({xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},{children:r("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M9.57142 2.6001C9.35051 2.6001 9.17142 2.77918 9.17142 3.0001C9.17142 3.22101 9.35051 3.4001 9.57142 3.4001H12.0343L8.71716 6.71698C8.56095 6.87319 8.56094 7.12645 8.71714 7.28267C8.87335 7.43888 9.12661 7.43889 9.28283 7.28269L12.6 3.96574V6.42845C12.6 6.64936 12.7791 6.82845 13 6.82845C13.2209 6.82845 13.4 6.64936 13.4 6.42845V3.0001C13.4 2.77918 13.2209 2.6001 13 2.6001H9.57142ZM7.28285 8.717C7.12664 8.56079 6.87338 8.56078 6.71716 8.71698L3.39973 12.0342V9.57126C3.39973 9.35035 3.22065 9.17126 2.99973 9.17126C2.77882 9.17126 2.59973 9.35035 2.59973 9.57126V12.9998C2.59973 13.2207 2.77882 13.3998 2.99973 13.3998H6.42853C6.64944 13.3998 6.82853 13.2207 6.82853 12.9998C6.82853 12.7789 6.64944 12.5998 6.42853 12.5998H3.96546L7.28283 9.28269C7.43904 9.12648 7.43905 8.87322 7.28285 8.717Z",fill:"#1A1A1A"})}))},Me=function(t){var n=t.onPrefixClick,i=t.onSuffixClick,c=t.sendMessage,f=t.isReplyLoading,h=void 0!==f&&f,p=t.capability,g=void 0===p?N.CONVERSATIONAL:p,C=t.onStop,m=g===N.SEARCH,v=m&&h,y=s(""),b=y[0],k=y[1],S=s(!1),w=S[0],A=S[1],T=d(null),L=x(),R=l(function(){return function(e){return{root:{display:"flex",flexDirection:"row",alignItems:"center",width:"100%",paddingLeft:e.spacing[4],paddingRight:e.spacing[4],paddingBottom:e.spacing[6],maxWidth:"100vw",boxSizing:"border-box"},inputWrapper:{flex:1,minWidth:0},headerAction:{height:e.size[10],width:e.size[10],flexShrink:0,overflow:"hidden",opacity:1,transition:"width 0.2s ease, opacity 0.2s ease"},headerActionCollapsed:{width:0,opacity:0}}}(L)},[L]),O=D().dispatch;u(function(){var e;O({type:z.RAVEN_TRACKING,payload:{eventName:W.U_ASK_QUESTION_IMPRESSION,eventData:(e={},e[j.ACTION_TYPE]=q.IMPRESSION,e)}})},[]);var F=l(function(){return e({},w?R.headerActionCollapsed:{})},[w,h,R]),H=l(function(){return e({},w?R.headerActionCollapsed:{})},[w,h,R]);return o(B,{children:[h&&r(ye,{capability:N.SEARCH}),o(_,e({boxSize:"micro",horizontal:!0,css:R.root},{children:[!v&&r(fe,e({onClick:n,styleConfig:{root:{css:e(e({},R.headerAction),F)}}},{children:r(Pe,{})})),r(I,e({css:R.inputWrapper},{children:r(E,{ref:T,value:b,onChange:function(e){k(e)},onFocus:function(){var e;A(!0),O({type:z.RAVEN_TRACKING,payload:{eventName:W.U_UI_ACTION,eventData:(e={},e[j.ACTION_NAME]=Z.U_ASK_QUESTION_BUTTON,e[j.ACTION_TYPE]=q.CLICK,e)}})},onBlur:function(){A(!1)},onSubmit:function(){var e=b.trim();e&&!h&&(null==c||c(e),k(""),setTimeout(function(){var e;null===(e=T.current)||void 0===e||e.blur()},100))},disableAction:h,prefix:m?r(Te,{}):void 0,suffix:b.length>0||v?void 0:r(a,{}),isStreaming:v,onStop:C,placeholder:"Ask a question"})})),!v&&r(fe,e({onClick:function(){return i(b)},styleConfig:{root:{css:e(e({},R.headerAction),H)}}},{children:r(ge,{})}))]}))]})},ze=c(function(t,n){var i=t.onPrefixClick,a=t.onSuffixClick,c=t.sendMessage,s=t.isReplyLoading,d=t.visible,u=void 0===d||d,f=t.isInitialLoading,h=void 0!==f&&f,p=t.capability,g=t.onStop,C=x(),m=l(function(){return{root:{position:"fixed",bottom:0,left:0,right:0,width:"100%",zIndex:100},backgroundGradient:{position:"absolute",bottom:0,left:0,right:0,zIndex:0,pointerEvents:"none"},content:{position:"relative",zIndex:1}}},[C]),v=p===N.SEARCH&&s;return r(B,{children:r(I,e({css:m.root},{children:r(b,e({type:"fade",timeout:400,appear:!0,mountOnEnter:!0,unmountOnExit:!0,in:u},{children:o(I,{children:[r(Q,{variant:v?J.PROCESSING:J.DEFAULT,styleConfig:{root:{css:m.backgroundGradient}}}),r(b,e({type:"slide",slideDirection:"up",timeout:400,appear:!0,mountOnEnter:!0,unmountOnExit:!0,in:u},{children:r(I,e({css:m.content,ref:n},{children:h?r(Ue,{loading:h}):r(Me,{onPrefixClick:i,onSuffixClick:a,sendMessage:c,isReplyLoading:s,capability:p,onStop:g})}))}))]})}))}))})}),Ve=function(e){var t=x(),n=e.visible,i=e.message,o=e.type,a=e.onDismiss,c=e.duration,s=void 0===c?3e3:c,d=l(function(){return function(e){return{prefixContainer:{display:"flex",alignItems:"center",justifyContent:"center"},toastContainer:{gap:e.spacing[2],alignItems:"center",width:"fit-content",bottom:"100px",zIndex:100,whiteSpace:"nowrap"}}}(t)},[t]);if(u(function(){if(n){var e=setTimeout(function(){return null==a?void 0:a()},s+500);return function(){return clearTimeout(e)}}},[n,s,a]),!n)return null;var f=o?r(ae,{icon:o}):null;return r(L,{show:!0,text:i,isAutoClose:!0,prefixComponent:f,closeTimeout:s,styleConfig:{toastContainer:{css:d.toastContainer},prefixContainer:{css:d.prefixContainer}}})};!function(e){e.FLOATING="FLOATING",e.HYBRID="HYBRID",e.EXPANDED="EXPANDED"}(Oe||(Oe={}));var Ye,Ke,We=function(t){void 0===t&&(t=Oe.FLOATING);var n=this;this.listeners=new Set,this.handlers={},this.getSnapshot=function(){return n.snapshot},this.subscribe=function(e){return n.listeners.add(e),function(){n.listeners.delete(e)}},this.setSnapshot=function(t){var i=e(e({},n.snapshot),t);i.state===n.snapshot.state&&i.isReplyLoading===n.snapshot.isReplyLoading||(n.snapshot=i,n.listeners.forEach(function(e){return e()}))},this.showFloating=function(){return n.setSnapshot({state:Oe.FLOATING})},this.showHybrid=function(){return n.setSnapshot({state:Oe.HYBRID})},this.hideHybrid=function(){return n.setSnapshot({state:Oe.FLOATING})},this.expand=function(){return n.setSnapshot({state:Oe.EXPANDED})},this.collapse=function(){return n.setSnapshot({state:Oe.HYBRID})},this.setState=function(e){return n.setSnapshot({state:e})},this.setReplyLoading=function(e){return n.setSnapshot({isReplyLoading:e})},this.setHandlers=function(e){n.handlers=e},this.clearHandlers=function(){n.handlers={}},this.openSearchFromFloatingPill=function(){var e,t;n.setSnapshot({state:Oe.HYBRID}),null===(t=null===(e=n.handlers)||void 0===e?void 0:e.onFloatingPillClick)||void 0===t||t.call(e)},this.snapshot={state:t,isReplyLoading:!1}},je=null,Ze=function(){return je||(je=new We),je},qe=g(null),Xe=function(t){var n=t.children,i=t.bridge,o=t.initialState,a=d();return a.current||(a.current=null!=i?i:new We(o)),r(qe.Provider,e({value:a.current},{children:n}))},Qe=function(){var e=C(qe);return null!=e?e:Ze()},Je=function(e){var t=Qe(),n=null!=e?e:t;return m(n.subscribe,n.getSnapshot,n.getSnapshot)},$e=function(e,t){var n=Je(e).state;u(function(){if(n===Oe.HYBRID&&"undefined"!=typeof window){var i=Date.now(),r=function(){return Date.now()-i<400},o=function(e){var n;return!(!e||!(null===(n=t.current)||void 0===n?void 0:n.contains(e)))},a=!1,l=function(e){a=!o(e.target)&&o(document.activeElement)},c=function(t){o(t.target)||(t.stopPropagation(),t.preventDefault(),r()||(a?a=!1:e.hideHybrid()))},s=function(e){r()&&(o(e.target)||(e.stopPropagation(),e.preventDefault()))},d={capture:!0};return document.addEventListener("pointerdown",l,d),document.addEventListener("mousedown",s,d),document.addEventListener("mouseup",s,d),document.addEventListener("click",c,d),function(){document.removeEventListener("pointerdown",l,d),document.removeEventListener("mousedown",s,d),document.removeEventListener("mouseup",s,d),document.removeEventListener("click",c,d)}}},[n,e,t])};!function(e){e.ONGOING="ongoing",e.IDLE="idle"}(Ye||(Ye={})),function(e){e.CHAT="CHAT",e.PREVIOUS_CHATS="PREVIOUS_CHATS"}(Ke||(Ke={}));var et=function(t){var c,f=t.open,p=void 0===f||f,g=t.onClose,C=t.network,m=t.protocol,_=t.triggerTracking,y=t.baseTrackingData,b=t.onChatStateChange,k=t.plugins,w=t.capability,E=void 0===w?N.CONVERSATIONAL:w,A=x(),T=l(function(){return{sheetContainer:{css:{background:"linear-gradient(180deg, #FFF 20.72%, #FFF1ED 47.83%)"}},screenWrapper:{display:"flex",flexDirection:"column",position:"absolute",top:0,left:0,right:0,bottom:0,background:"linear-gradient(180deg, #FFF 20.72%, #FFF1ED 47.83%)",willChange:"transform"},stackContainer:{position:"relative",flex:1,minHeight:0,overflow:"hidden",borderRadius:"inherit"},loadingContainer:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:1}}},[A]),L=d(0),O=d(b);O.current=b;var D=E===N.SEARCH,G=Qe(),X=Je(G),Q=d(null),J=d([]),$=d("800px"),ee=d("800px"),te=s(p),ne=te[0],ie=te[1];u(function(){$.current="".concat(window.innerHeight,"px");var e=.94*window.innerHeight;ee.current="".concat(e,"px")},[]),u(function(){ie(p)},[p]);var re=D?X.state===Oe.EXPANDED:ne;u(function(){D&&p&&G.expand()},[D,p,G]),$e(G,Q);var oe=h(function(){D?G.expand():ie(!0)},[D,G]),ae=h(function(){D?G.collapse():(ie(!1),null==g||g())},[D,G,g]),le=U({network:C,triggerTracking:_,baseTrackingData:y,protocol:m,resolveMerge:K,plugins:k,capability:E,open:re,onOpenChatbot:oe,onCloseChatbot:ae,chatWindowRefs:J}),ce=le.currentChatId,se=le.messages,de=le.chatStack,ue=le.previousChats,fe=le.previousChatLoading,he=le.previousChatError,pe=le.isInitialLoading,ge=le.isInitialError,Ce=le.retryInitialChat,me=le.toast,ve=le.hideToast,xe=le.isNewChat,_e=le.isReplyLoading,ye=le.replyLoaderText,Ie=le.screenRefs,be=le.showNativeActions,ke=le.chatService,Se=le.isContextSummaryLoading,we=le.contextSummary,Ee=le.contextSummaryError,Ae=le.handleMediaPicked,Te=le.dispatch,Be=le.dispatchAll,Re=le.getPreviousChats,Ne=le.pushToChatStack,Fe=le.sendMessage,De=le.stop,Ue=le.hasPresented,Pe=le.markPresented,Me=le.handleBackButtonClick,Ke=d(De);Ke.current=De;var We=h(function(){var e;D&&(null===(e=Ke.current)||void 0===e||e.call(Ke))},[D]),je=d(X.state);u(function(){var e=je.current,t=X.state;je.current=t,e===Oe.HYBRID&&t===Oe.FLOATING&&We()},[X.state,We]),u(function(){D&&ge&&(X.state===Oe.HYBRID&&Te({type:z.SHOW_TOAST,payload:{message:"Something went wrong. Please try again."}}),G.showFloating())},[D,ge,G]);var Ze=d(X.state);u(function(){var e=Ze.current,t=X.state;Ze.current=t,D&&ge&&e===Oe.FLOATING&&t===Oe.HYBRID&&Ce()},[D,X.state,ge,Ce]);var qe=d(!1),Xe=h(function(){var e;Te({type:z.RAVEN_TRACKING,payload:{eventName:W.U_UI_ACTION,eventData:(e={},e[j.ACTION_NAME]=Z.U_OPEN_SEARCH,e[j.ACTION_TYPE]=q.CLICK,e)}})},[Te]);u(function(){if(D)return G.setHandlers({onFloatingPillClick:Xe}),function(){return G.clearHandlers()}},[D,G,Xe]),u(function(){D&&G.setReplyLoading(_e)},[D,_e,G]),u(function(){if(re)return function(){Te({type:z.SHOW_NATIVE_ACTIONS,payload:{isNativeActionsEnabled:!1}})}},[re]),u(function(){re&&(qe.current=!0)},[re]),u(function(){var e;re&&!pe&&ce&&qe.current&&(qe.current=!1,Te({type:z.RAVEN_TRACKING,payload:{eventName:W.U_AI_CHAT_PAGELOAD,eventData:(e={},e[j.CHAT_HISTORY_FLAG]=xe?"new":"existing",e[j.CHAT_SESSION_ID]=ce,e)}}))},[re,pe,ce,xe,Te]),u(function(){var e,t;if(D&&X.state!==Oe.EXPANDED&&ce){var n=null!==(t=null===(e=se[ce])||void 0===e?void 0:e.messages)&&void 0!==t?t:[];n.forEach(function(e,t){_e&&t===n.length-1||Pe(ce,e.id)})}},[D,X.state,se,ce,_e,Pe]);var et=l(function(){var e,t,n=ce?se[ce]:void 0;return n&&n.status!==H.CLOSED&&(null!==(t=null===(e=n.messages)||void 0===e?void 0:e.length)&&void 0!==t?t:0)>1?Ye.ONGOING:Ye.IDLE},[se,ce]);u(function(){var e;null===(e=O.current)||void 0===e||e.call(O,{status:et})},[et]),v(function(){var e=L.current,t=de.length;if(L.current=t,!(t<=e||t<=1)){var n=Ie.current[t-1];if(n){n.classList.add("chat-slide-in-from-right");n.addEventListener("animationend",function(){n.classList.remove("chat-slide-in-from-right")},{once:!0})}}},[de.length]);var tt=function(){var e;Te({type:z.RAVEN_TRACKING,payload:{eventName:W.U_AI_CHAT_BOT_CLOSE,eventData:(e={},e[j.CHAT_SESSION_ID]=ce,e[j.ACTION_NAME]=j.ASK_AI_CLOSE_CLICK,e)}}),We(),D?G.collapse():(ie(!1),null==g||g())},nt=function(){return n(void 0,void 0,void 0,function(){return i(this,function(e){return We(),Ne({type:F.PREVIOUS_CHAT_LISTING}),Re(),[2]})})},it=function(e,t,n){var i=e.type,o=e.id,a=e.retry,l=e.scrollToBottomOnLoad;switch(i){case F.PREVIOUS_CHAT_LISTING:return r(He,{chats:ue,loading:fe,onBack:Me,previousChatError:he});case F.CHAT_ERROR:return r(Ge,{onClose:tt,onBack:Me,retry:a});case F.PREVIOUS_CHAT:case F.CHAT:default:return r(Le,{ref:function(e){J.current[n]=e},chatId:o||"",chatData:se[o||""],sendMessage:Fe,onPreviousChatClick:nt,pageType:i,onBackButtonClick:Me,isInitialLoading:pe,isReplyLoading:_e,replyLoaderText:ye,isTop:t,onClose:tt,handleMediaPicked:Ae,showNativeActions:be,scrollToBottomOnLoad:l,isContextSummaryLoading:Se,contextSummary:we,contextSummaryError:Ee,capability:E,onStop:We})}},rt=l(function(){var e,t;return(ce&&null!==(t=null===(e=se[ce])||void 0===e?void 0:e.messages)&&void 0!==t?t:[]).flatMap(function(e){return e.chunks.map(function(t,n){return{chunk:t,key:"".concat(e.id,":").concat(n),messageId:e.id}}).filter(function(e){return e.chunk.type===V.ACTION_HANDLER})})},[se,ce]);return r(P,e({chatService:ke},{children:o(M,e({dispatch:Te,dispatchAll:Be,hasPresented:Ue,markPresented:Pe},{children:[D&&r(Ve,{visible:!!me,message:null!==(c=null==me?void 0:me.message)&&void 0!==c?c:"",duration:null==me?void 0:me.duration,onDismiss:ve},null==me?void 0:me.id),D&&X.state!==Oe.EXPANDED&&o(a,{children:[rt.map(function(t){var n,i=t.chunk,o=t.key,a=t.messageId,l=e(e({},null!==(n=i.metaData)&&void 0!==n?n:{}),{messageId:a,chatId:ce,presentOnDispatch:!0});return r(Y,e({},i,{metaData:l}),o)}),r(ze,{ref:Q,visible:X.state===Oe.HYBRID,onPrefixClick:function(){var e;Te({type:z.RAVEN_TRACKING,payload:{eventName:W.U_UI_ACTION,eventData:(e={},e[j.ACTION_NAME]=Z.U_EXPAND_CHAT,e[j.ACTION_TYPE]=q.CLICK,e)}}),G.expand()},onSuffixClick:function(e){var t;Te({type:z.RAVEN_TRACKING,payload:{eventName:W.U_UI_ACTION,eventData:(t={},t[j.ACTION_NAME]=Z.U_CLOSE_CHAT,t[j.U_FHP_ASKQUESTION]=null!=e?e:"",t[j.ACTION_TYPE]=q.CLICK,t)}}),G.hideHybrid()},sendMessage:Fe,isReplyLoading:_e,isInitialLoading:pe,capability:E,onStop:We})]}),r(B,{children:r(R,e({isOpen:re,onClose:tt,radius:"md",styleConfig:{bottomSheetContainer:{css:e(e({},T.sheetContainer.css),{height:ee.current,maxHeight:"".concat($.current," !important")})}}},{children:o(I,e({css:T.stackContainer},{children:[0===de.length&&pe&&r(I,e({css:T.loadingContainer},{children:r(S,{variant:"thin",height:"54px",width:"54px",borderColor:A.color.border.link,trackColor:A.color.border.disabledDark})})),de.map(function(t,n){var i,o=n===de.length-1;return r(I,e({ref:function(e){Ie.current[n]=e},css:e(e({},T.screenWrapper),{visibility:o?"visible":"hidden"})},{children:it(t,o,n)}),"".concat(t.type,"_").concat(null!==(i=t.id)&&void 0!==i?i:n))})]}))}))})]}))}))};export{We as ChatSurfaceBridge,Xe as ChatSurfaceProvider,Oe as ChatSurfaceState,et as ChatUI,Ye as ChatUIStatusValue,Ke as ChatView,Me as HybridChat,ze as HybridChatWindow,Ze as getChatSurfaceBridge,Je as useChatSurface,Qe as useChatSurfaceBridge,$e as useHideOnBackgroundInteraction};
|
|
1
|
+
import{__assign as e,__rest as t,__awaiter as n,__generator as i}from"tslib";import{jsx as r,jsxs as o,Fragment as a}from"react/jsx-runtime";import{useMemo as l,forwardRef as c,useState as s,useRef as d,useEffect as u,useImperativeHandle as f,useCallback as h,memo as p,createContext as g,useContext as C,useSyncExternalStore as m,useLayoutEffect as v}from"react";import{useTheme as x,Box as _,Typography as y,Container as I,Transition as b,TypographyVariant as k,Spinner as S,Button as w,AiChatInput as E,Shimmer as A,DottedLoader as T,ThemeProvider as B,Toast as L,BottomSheet as R}from"@cleartrip/ct-design-components";import{ChatCapability as N,usePresentation as O,ChatPageType as F,useAppDispatch as D,ChatStatus as H,ChatErrorKind as G,useChatController as U,ChatNetworkProvider as P,ChatDispatchProvider as M}from"@cleartrip/talos-use-chat-controller";import{ActionType as z,WidgetType as V}from"@cleartrip/talos-widget-types";import{WidgetGenerator as Y,mergeFor as K}from"@cleartrip/talos-widget-manager";import{RAVEN_EVENT as W,RAVEN_ATTRIBUTE_KEY as j,RAVEN_ACTION as Z,RAVEN_ACTION_TYPE as q}from"@cleartrip/talos-constants";import{SequentialReveal as X}from"@cleartrip/talos-sequential-reveal";import{BackgroundGradient as Q,BackgroundGradientVariant as J}from"@cleartrip/talos-background-gradient";import{useNativeActions as $}from"@cleartrip/talos-use-native-actions";import{isEmpty as ee,checkDeviceType as te}from"@cleartrip/talos-general-utils";import{v4 as ne}from"uuid";import{Lottie as ie}from"@cleartrip/talos-lottie";import{AnimatedTicker as re}from"@cleartrip/talos-animated-ticker";import{HorizontalChipItem as oe}from"@cleartrip/talos-horizontal-chip-menu";import{Icon as ae}from"@cleartrip/talos-icon";var le,ce,se={camera:"image/*",gallery:".jpg,.jpeg,image/jpeg,.png,image/png",file:"application/pdf,.pdf"},de=function(t){var n=t.actions,i=x(),a=l(function(){return function(e){return{root:{position:"relative",zIndex:1},actionBox:{position:"relative",padding:e.spacing[3],borderRadius:e.border.radius[8],border:"1px solid ".concat(e.color.border.neutralShadowOpacity10),backgroundColor:e.color.background.neutral,flex:1,alignItems:"center",justifyContent:"center",cursor:"pointer"},hiddenInput:{position:"absolute",inset:0,width:"100%",height:"100%",opacity:0,cursor:"pointer"}}}(i)},[i]),c=function(e,t){return"string"==typeof e?r("img",{src:e,alt:t,height:40,width:40}):e};return r(_,e({boxSize:"tiny",horizontal:!0},{children:n.map(function(t){var n=t.label,i=t.onClick,l=t.onButtonClick,s=t.onChange,d=t.icon,u=t.inputType,f=t.isMultiple,h=t.useNativePicker;return o(_,e({boxSize:"micro",css:a.actionBox},{children:[c(d,n),r(y,e({variant:"L3"},{children:n})),u&&(h?r("button",{type:"button",onClick:l,style:a.hiddenInput,"aria-label":n}):r("input",e({type:"file",accept:se[u]},"camera"===u?{capture:"environment"}:{},{onClick:i,onChange:s,style:a.hiddenInput,"aria-label":n,multiple:f})))]}),n)})}))},ue=function(e,t){return void 0===t&&(t=!1),{root:{position:"sticky",top:0,zIndex:2,background:e.color.background.neutral,display:"flex",alignItems:"center",justifyContent:"space-between",borderRadius:"inherit",padding:e.spacing[4],boxShadow:t?e.elevation.bottomE2:e.elevation.bottomE1,transition:"box-shadow 200ms ease-out"},iconContainer:{width:e.size[5],height:e.size[5]},title:{background:"linear-gradient(79deg, #FF6F42 1.98%, #EE1C85 30.1%, #5E1EB8 90.59%)",backgroundClip:"text","-webkit-background-clip":"text","-webkit-text-fill-color":"transparent"},headerAction:{borderRadius:e.border.radius["50P"],border:"1px solid ".concat(e.color.border.disabledDark),display:"flex",alignItems:"center",justifyContent:"center",height:e.size[8],width:e.size[8],cursor:"pointer",flexShrink:0,background:e.color.background.neutral}}},fe=function(t){var n=t.children,i=t.onClick,o=t.styleConfig,a=x(),c=l(function(){return ue(a)},[a]),s=(o||{}).root;return r(I,e({onClick:i,css:e(e({},c.headerAction),null==s?void 0:s.css)},{children:n}))},he=function(){return o("svg",e({xmlns:"http://www.w3.org/2000/svg",width:"21",height:"20",viewBox:"0 0 21 20",fill:"none"},{children:[r("path",{d:"M8.43199 3.28636C8.58826 2.70596 9.41173 2.70596 9.56801 3.28636L9.85259 4.34331C10.5067 6.77256 12.4042 8.6701 14.8334 9.32417L15.8904 9.60875C16.4708 9.76502 16.4708 10.5885 15.8904 10.7448L14.8335 11.0293C12.4042 11.6834 10.5067 13.581 9.85259 16.0102L9.56801 17.0672C9.41173 17.6476 8.58826 17.6476 8.43199 17.0672L8.14741 16.0102C7.49334 13.581 5.5958 11.6834 3.16655 11.0293L2.1096 10.7448C1.5292 10.5885 1.5292 9.76502 2.1096 9.60875L3.16655 9.32417C5.5958 8.6701 7.49334 6.77256 8.14741 4.34331L8.43199 3.28636Z",fill:"url(#paint0_linear_3415_10691)"}),r("g",e({filter:"url(#filter0_f_3415_10691)"},{children:r("path",{d:"M9.56259 5.67664C10.0313 6.89539 11.8688 9.44538 15.4688 9.89538",stroke:"#F801B7","stroke-width":"0.588235"})})),r("g",e({filter:"url(#filter1_f_3415_10691)"},{children:r("path",{d:"M5.06265 11.3016C6.20015 11.6588 8.58015 13.0588 9.00015 15.8016",stroke:"#7801F8","stroke-width":"0.588235"})})),r("g",e({filter:"url(#filter2_f_3415_10691)"},{children:r("path",{d:"M8.71826 3.42688C8.15576 7.08313 5.84951 9.44563 2.24951 9.89563",stroke:"#FFD58C","stroke-width":"0.294118"})})),r("g",e({filter:"url(#filter3_f_3415_10691)"},{children:r("path",{d:"M15.4691 10.4581C11.8129 11.0206 9.4504 13.3269 9.0004 16.9269",stroke:"#FFD58C","stroke-width":"0.294118"})})),r("path",{d:"M16.7285 0.791102C16.7871 0.573452 17.0959 0.573451 17.1545 0.791101L17.3938 1.67987C17.6391 2.59084 18.3507 3.30242 19.2616 3.5477L20.1504 3.787C20.368 3.8456 20.368 4.1544 20.1504 4.213L19.2616 4.4523C18.3507 4.69758 17.6391 5.40916 17.3938 6.32013L17.1545 7.2089C17.0959 7.42655 16.7871 7.42655 16.7285 7.2089L16.4892 6.32013C16.2439 5.40916 15.5323 4.69758 14.6214 4.4523L13.7326 4.213C13.5149 4.1544 13.5149 3.8456 13.7326 3.787L14.6214 3.5477C15.5323 3.30242 16.2439 2.59084 16.4892 1.67987L16.7285 0.791102Z",fill:"url(#paint1_linear_3415_10691)"}),r("g",e({filter:"url(#filter4_f_3415_10691)"},{children:r("path",{d:"M17.1917 1.99988C17.4 2.54154 18.2167 3.67488 19.8167 3.87488",stroke:"#F801B7","stroke-width":"0.220588"})})),r("g",e({filter:"url(#filter5_f_3415_10691)"},{children:r("path",{d:"M15.1913 4.49951C15.6969 4.65824 16.7547 5.28046 16.9413 6.49951",stroke:"#9937CA","stroke-width":"0.220588"})})),r("g",e({filter:"url(#filter6_f_3415_10691)"},{children:r("path",{d:"M16.8165 1.00061C16.5665 2.62561 15.5415 3.67561 13.9415 3.87561",stroke:"#FFD58C","stroke-width":"0.110294"})})),r("g",e({filter:"url(#filter7_f_3415_10691)"},{children:r("path",{d:"M19.817 4.12512C18.192 4.37512 17.142 5.40012 16.942 7.00012",stroke:"#FFD58C","stroke-width":"0.110294"})})),o("defs",{children:[o("filter",e({id:"filter0_f_3415_10691",x:"8.11162",y:"4.39457",width:"8.57017",height:"6.96915",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[r("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),r("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),r("feGaussianBlur",{stdDeviation:"0.588235",result:"effect1_foregroundBlur_3415_10691"})]})),o("filter",e({id:"filter1_f_3415_10691",x:"3.79808",y:"9.84453",width:"6.66929",height:"7.17814",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[r("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),r("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),r("feGaussianBlur",{stdDeviation:"0.588235",result:"effect1_foregroundBlur_3415_10691"})]})),o("filter",e({id:"filter2_f_3415_10691",x:"1.76067",y:"2.93395",width:"7.57353",height:"7.57814",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[r("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),r("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),r("feGaussianBlur",{stdDeviation:"0.235294",result:"effect1_foregroundBlur_3415_10691"})]})),o("filter",e({id:"filter3_f_3415_10691",x:"8.38387",y:"9.84216",width:"7.57823",height:"7.5735",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[r("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),r("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),r("feGaussianBlur",{stdDeviation:"0.235294",result:"effect1_foregroundBlur_3415_10691"})]})),o("filter",e({id:"filter4_f_3415_10691",x:"16.6475",y:"1.51915",width:"3.62396",height:"2.9064",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[r("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),r("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),r("feGaussianBlur",{stdDeviation:"0.220588",result:"effect1_foregroundBlur_3415_10691"})]})),o("filter",e({id:"filter5_f_3415_10691",x:"14.7171",y:"3.95311",width:"2.77441",height:"3.0043",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[r("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),r("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),r("feGaussianBlur",{stdDeviation:"0.220588",result:"effect1_foregroundBlur_3415_10691"})]})),o("filter",e({id:"filter6_f_3415_10691",x:"13.7582",y:"0.815717",width:"3.28928",height:"3.29105",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[r("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),r("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),r("feGaussianBlur",{stdDeviation:"0.0882353",result:"effect1_foregroundBlur_3415_10691"})]})),o("filter",e({id:"filter7_f_3415_10691",x:"16.7108",y:"3.89409",width:"3.29105",height:"3.28934",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[r("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),r("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),r("feGaussianBlur",{stdDeviation:"0.0882353",result:"effect1_foregroundBlur_3415_10691"})]})),o("linearGradient",e({id:"paint0_linear_3415_10691",x1:"9",y1:"1.17676",x2:"9",y2:"19.1768",gradientUnits:"userSpaceOnUse"},{children:[r("stop",{"stop-color":"#F0257E"}),r("stop",{offset:"1","stop-color":"#FE6C46"})]})),o("linearGradient",e({id:"paint1_linear_3415_10691",x1:"16.9415",y1:"0",x2:"16.9415",y2:"8",gradientUnits:"userSpaceOnUse"},{children:[r("stop",{"stop-color":"#F0257E"}),r("stop",{offset:"1","stop-color":"#FE6C46"})]}))]})]}))},pe=function(){return o("svg",e({xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},{children:[r("mask",e({id:"mask0_2214_2441",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"20",height:"20"},{children:r("rect",{width:"20",height:"20",fill:"#D9D9D9"})})),r("g",e({mask:"url(#mask0_2214_2441)"},{children:r("path",{d:"M9.96778 16.6671C8.36736 16.6671 6.96299 16.1759 5.75465 15.1935C4.54632 14.2112 3.78347 12.9524 3.46611 11.4171C3.43194 11.2942 3.44424 11.1806 3.50299 11.0764C3.56174 10.9723 3.65576 10.9117 3.78507 10.8946C3.90049 10.8775 4.00306 10.9032 4.09278 10.9717C4.1825 11.04 4.24611 11.1372 4.28361 11.2633C4.58486 12.588 5.2643 13.681 6.32194 14.5421C7.37972 15.4032 8.595 15.8337 9.96778 15.8337C11.5928 15.8337 12.9713 15.2678 14.1032 14.1358C15.2351 13.0039 15.8011 11.6254 15.8011 10.0004C15.8011 8.37541 15.2351 6.99693 14.1032 5.86499C12.9713 4.73305 11.5928 4.16707 9.96778 4.16707C9.10556 4.16707 8.29521 4.34923 7.53674 4.71353C6.77812 5.07784 6.10875 5.57944 5.52861 6.21832H7.17944C7.29792 6.21832 7.39694 6.25812 7.47653 6.3377C7.55625 6.41728 7.59611 6.51638 7.59611 6.63499C7.59611 6.7536 7.55625 6.8527 7.47653 6.93228C7.39694 7.01186 7.29792 7.05166 7.17944 7.05166H4.80757C4.61424 7.05166 4.45368 6.98784 4.3259 6.8602C4.19826 6.73256 4.13444 6.572 4.13444 6.37853V4.00687C4.13444 3.88825 4.17424 3.78916 4.25382 3.70957C4.3334 3.62999 4.4325 3.5902 4.55111 3.5902C4.66972 3.5902 4.76882 3.62999 4.8484 3.70957C4.92799 3.78916 4.96778 3.88825 4.96778 4.00687V5.58061C5.61208 4.87325 6.36715 4.32194 7.23299 3.92666C8.09896 3.53138 9.01055 3.33374 9.96778 3.33374C10.8919 3.33374 11.7581 3.50763 12.5663 3.85541C13.3745 4.20318 14.0807 4.67916 14.6849 5.28332C15.289 5.88749 15.765 6.59367 16.1128 7.40187C16.4606 8.21006 16.6344 9.07624 16.6344 10.0004C16.6344 10.9246 16.4606 11.7908 16.1128 12.5989C15.765 13.4071 15.289 14.1133 14.6849 14.7175C14.0807 15.3217 13.3745 15.7976 12.5663 16.1454C11.7581 16.4932 10.8919 16.6671 9.96778 16.6671ZM10.4326 9.82728L12.9326 12.3273C13.0105 12.4053 13.0522 12.501 13.0576 12.6142C13.0628 12.7275 13.0212 12.8285 12.9326 12.9171C12.8438 13.0057 12.7456 13.05 12.6378 13.05C12.5299 13.05 12.4315 13.0057 12.3428 12.9171L9.80111 10.3754C9.72847 10.3028 9.67667 10.2277 9.64569 10.1502C9.61472 10.0728 9.59924 9.98923 9.59924 9.89936V6.25041C9.59924 6.1318 9.63903 6.0327 9.71861 5.95311C9.79819 5.87353 9.89729 5.83374 10.0159 5.83374C10.1345 5.83374 10.2336 5.87353 10.3132 5.95311C10.3928 6.0327 10.4326 6.1318 10.4326 6.25041V9.82728Z",fill:"#1C1B1F"})}))]}))},ge=function(){return r("svg",e({xmlns:"http://www.w3.org/2000/svg",width:"20",height:"16",viewBox:"0 0 20 16",fill:"none"},{children:r("path",{d:"M14.7802 2.5411C14.9677 2.35394 15.2716 2.35386 15.4589 2.5411C15.6463 2.72854 15.6464 3.03238 15.4589 3.21981L10.6787 8.00008L15.4589 12.7804C15.6463 12.9678 15.6463 13.2717 15.4589 13.4591C15.2715 13.6465 14.9677 13.6464 14.7802 13.4591L9.99996 8.67879L5.21968 13.4591C5.03226 13.6465 4.72842 13.6465 4.54097 13.4591C4.35374 13.2717 4.35382 12.9678 4.54097 12.7804L9.32125 8.00008L4.54097 3.21981C4.35353 3.03236 4.35353 2.72854 4.54097 2.5411C4.72842 2.35365 5.03224 2.35365 5.21968 2.5411L9.99996 7.32137L14.7802 2.5411Z",fill:"#1A1A1A"})}))},Ce=function(){return r("svg",e({xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},{children:r("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M10.3536 3.64645C10.1583 3.45118 9.84178 3.45118 9.64652 3.64645L5.64652 7.64645C5.45134 7.84171 5.45128 8.15824 5.64652 8.35348L9.64652 12.3535C9.84176 12.5487 10.1583 12.5487 10.3536 12.3535C10.5488 12.1582 10.5488 11.8417 10.3536 11.6464L6.70707 7.99996L10.3536 4.35348C10.5488 4.15822 10.5488 3.84171 10.3536 3.64645Z",fill:"#1A1A1A"})}))},me=function(){var t=ne();return o("svg",e({xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},{children:[r("mask",e({id:t,style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"20",height:"20"},{children:r("rect",{width:"20",height:"20",fill:"#D9D9D9"})})),r("g",e({mask:"url(#".concat(t,")")},{children:r("path",{d:"M4.68023 16.6671C4.29662 16.6671 3.97635 16.5386 3.7194 16.2817C3.46246 16.0247 3.33398 15.7044 3.33398 15.3208V4.67999C3.33398 4.29638 3.46246 3.9761 3.7194 3.71916C3.97635 3.46221 4.29662 3.33374 4.68023 3.33374H10.6625C10.8014 3.33374 10.9056 3.37784 10.975 3.46603C11.0445 3.55409 11.0792 3.64888 11.0792 3.75041C11.0792 3.85193 11.0436 3.94673 10.9725 4.03478C10.9016 4.12298 10.7966 4.16707 10.6577 4.16707H4.68023C4.5519 4.16707 4.43433 4.22047 4.32753 4.32728C4.22072 4.43409 4.16732 4.55166 4.16732 4.67999V15.3208C4.16732 15.4492 4.22072 15.5667 4.32753 15.6735C4.43433 15.7803 4.5519 15.8337 4.68023 15.8337H15.3211C15.4494 15.8337 15.567 15.7803 15.6738 15.6735C15.7806 15.5667 15.834 15.4492 15.834 15.3208V9.25832C15.834 9.11943 15.8781 9.01527 15.9663 8.94582C16.0543 8.87638 16.1491 8.84166 16.2507 8.84166C16.3522 8.84166 16.447 8.87638 16.535 8.94582C16.6232 9.01527 16.6673 9.11943 16.6673 9.25832V15.3208C16.6673 15.7044 16.5388 16.0247 16.2819 16.2817C16.025 16.5386 15.7047 16.6671 15.3211 16.6671H4.68023ZM8.33398 10.9939V10.0469C8.33398 9.86742 8.3703 9.69304 8.44294 9.52374C8.51558 9.35429 8.61225 9.20923 8.73294 9.08853L15.7875 2.03416C15.8793 1.94221 15.976 1.8786 16.0775 1.84332C16.1791 1.80804 16.2859 1.79041 16.3982 1.79041C16.5029 1.79041 16.6052 1.80804 16.705 1.84332C16.8049 1.8786 16.8954 1.93686 16.9767 2.01811L17.9029 2.91707C17.9916 3.00902 18.0588 3.11027 18.1048 3.22082C18.1508 3.33138 18.1738 3.44277 18.1738 3.55499C18.1738 3.66707 18.1569 3.77304 18.1232 3.87291C18.0895 3.97291 18.0268 4.06881 17.935 4.16061L10.8323 11.2633C10.7116 11.384 10.5666 11.4814 10.3973 11.5556C10.228 11.6299 10.0536 11.6671 9.87398 11.6671H9.00711C8.81364 11.6671 8.65308 11.6033 8.52544 11.4756C8.3978 11.348 8.33398 11.1874 8.33398 10.9939ZM9.16732 10.8337H10.0775L15.6321 5.27916L15.1769 4.82416L14.669 4.33686L9.16732 9.83853V10.8337Z",fill:"#1C1B1F"})}))]}))},ve="Get quick support 24/7",xe=function(t){var n=x(),i=t.showBackButton,a=void 0!==i&&i,c=t.showCross,s=void 0!==c&&c,d=t.showPreviousChat,u=void 0!==d&&d,f=t.title,h=void 0===f?ve:f,p=t.showIcon,g=void 0===p||p,C=t.showNewChat,m=void 0!==C&&C,v=t.isScrolled,b=void 0!==v&&v,k=t.onBackButtonClick,S=t.onCrossClick,w=t.onPreviousChatClick,E=t.onNewChatClick,A=l(function(){return ue(n,b)},[n,b]);return o(I,e({css:A.root},{children:[o(_,e({boxSize:"tiny",horizontal:!0,css:{alignItems:"center"}},{children:[a&&r(fe,e({onClick:k},{children:r(Ce,{})})),o(_,e({boxSize:"pico",horizontal:!0},{children:[g&&r(I,e({css:A.iconContainer},{children:r(he,{})})),r(y,e({variant:"HM3",styleConfig:{css:A.title},lineClamp:1},{children:h}))]}))]})),o(_,e({boxSize:"tiny",horizontal:!0},{children:[u&&r(fe,e({onClick:w},{children:r(pe,{})})),m&&r(fe,e({onClick:E},{children:r(me,{})})),s&&r(fe,e({onClick:S},{children:r(ge,{})}))]}))]}))},_e=function(e){return{root:{display:"flex",flexDirection:"column",gap:e.spacing[2],alignItems:"center",marginBottom:e.spacing[4],justifyContent:"center"},initLoader:{display:"flex",flexDirection:"column",gap:e.spacing[2],alignItems:"center",justifyContent:"center",paddingBottom:e.spacing[6]}}},ye=function(t){var n=t.loaderText,i=void 0===n?"Processing your request":n,a=t.capability,c=void 0===a?N.CONVERSATIONAL:a,s=x(),d=l(function(){return _e(s)},[s]);return c===N.SEARCH?o(I,e({css:d.root},{children:[r(ie,{lottieId:"AI_LOADER",autoPlay:!0,loop:!0,hasContainer:!0,height:"32px",width:"32px"}),r(y,e({variant:"B3"},{children:i}))]})):r(ie,{lottieId:"AI_LOADER",autoPlay:!0,loop:!0,hasContainer:!0,height:"32px",width:"32px"})},Ie=function(){return r("svg",e({xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},{children:r("path",{d:"M7.78931 1.5C11.2629 1.5 14.0791 4.31549 14.0793 7.78906C14.0793 9.32329 13.5293 10.7285 12.6165 11.8203L15.9602 15.165C16.1795 15.3847 16.1798 15.7404 15.9602 15.96C15.7407 16.1795 15.385 16.1793 15.1653 15.96L11.8206 12.6162C10.7288 13.529 9.32351 14.0791 7.78931 14.0791C4.31576 14.0789 1.50024 11.2627 1.50024 7.78906C1.50045 4.31564 4.31589 1.50024 7.78931 1.5ZM7.78931 2.625C4.93721 2.62524 2.62545 4.93696 2.62524 7.78906C2.62524 10.6413 4.93708 12.9539 7.78931 12.9541C10.6417 12.9541 12.9543 10.6415 12.9543 7.78906C12.9541 4.93681 10.6416 2.625 7.78931 2.625Z",fill:"#FF4F17"})}))},be=function(t){var n=t.isContextSummaryLoading,i=t.contextSummary,c=x(),s=l(function(){return function(e){return{root:{padding:e.spacing[4]},fadeIn:{animation:"contextSummaryFadeIn 0.4s ease-in","@keyframes contextSummaryFadeIn":{from:{opacity:0},to:{opacity:1}}},loadingContainer:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},iconContainer:{position:"relative",width:e.size[10],height:e.size[10]},animatedIcon:{display:"flex",position:"absolute",animation:"contextSummaryIconMove 2s ease-in-out infinite","@keyframes contextSummaryIconMove":{"0%":{transform:"translate(calc((40px - 100%) / 2), 0px)"},"25%":{transform:"translate(calc(40px - 100%), calc((40px - 100%) / 2))"},"50%":{transform:"translate(calc((40px - 100%) / 2), calc(40px - 100%))"},"75%":{transform:"translate(0px, calc((40px - 100%) / 2))"},"100%":{transform:"translate(calc((40px - 100%) / 2), 0px)"}}}}}(c)},[c]);if(n)return o(_,e({boxSize:"pico",css:s.loadingContainer},{children:[r(I,e({css:s.iconContainer},{children:r(I,e({css:s.animatedIcon},{children:r(Ie,{})}))})),r(y,e({variant:"B2"},{children:"Updating search context..."}))]}));var d=(i||{}).data,u=void 0===d?{}:d,f=u.contextSummary,h=void 0===f?"Your search context has been updated":f,p=u.filterSummary,g=u.promptMessage,C=ee(g)?"How can I help you further?":g;return r(b,e({type:"fade",timeout:400,in:!0},{children:o(_,e({boxSize:"micro",css:s.fadeIn},{children:[r(y,e({variant:"B4CAPS",color:"subheading"},{children:"CONTINUE SEARCHING FOR"})),o(I,{children:[r(y,e({variant:"HM4",componentNode:"span"},{children:h})),!ee(p)&&o(a,{children:[r(y,e({variant:"HM4",componentNode:"span"},{children:"・"})),r(y,e({variant:"HM4",componentNode:"span"},{children:p}))]})]}),r(y,e({variant:"P2"},{children:C}))]}))}))},ke={delay:3e3,height:40,animateInfinite:!0,duration:650},Se={delay:2e3,animateInfinite:!0,duration:650,visibleCount:3,itemGap:12},we=function(t){var n,i,a,c,s=t.data,d=t.shouldHidePills,u=x(),f=null!=s?s:{},h=f.heading,p=f.suggestions,g=void 0===p?[]:p,C=null!==(n=null==h?void 0:h.static)&&void 0!==n?n:[],m=null!==(i=null==h?void 0:h.ticker)&&void 0!==i?i:[],v=l(function(){return function(e){return{root:{display:"flex",flexDirection:"column",justifyContent:"space-between",flex:1},greetingContainer:{marginBottom:e.spacing[10]},headingTickerText:{background:"linear-gradient(90deg, #FF6F42 0%, #EE1C85 50%, #5E1EB8 100%)",backgroundClip:"text","-webkit-background-clip":"text","-webkit-text-fill-color":"transparent"}}}(u)},[u]),_=Math.min(3,g.length),b=32*(a=_)+12*Math.max(0,a-1)+6,S=l(function(){return m.map(function(t,n){return r(y,e({variant:"HD3",styleConfig:{css:v.headingTickerText}},{children:t.text}),"".concat(t.text,"-").concat(n))})},[m,v.headingTickerText]),w=l(function(){return g.map(function(e){var t=function(e){var t;return{data:{label:e.label},events:{onClick:[{type:z.RAVEN_TRACKING,payload:{eventName:W.U_UI_ACTION,eventData:(t={},t[j.ACTION_NAME]=Z.U_SUGGESTED_PROMPT_SELECTED,t[j.ACTION_TYPE]=q.CLICK,t[j.U_AGENT_PROMPT_SELECTED]=e.label,t)}},{type:z.SEND_MESSAGE,payload:{message:e.label}}]}}}(e),n=t.data,i=t.events;return r(oe,{data:n,events:i},e.id)})},[g]);return o(I,e({css:v.root},{children:[o(I,{children:[r(I,e({css:v.greetingContainer},{children:r(y,e({variant:k.P1},{children:(c=(new Date).getHours(),c<12?"Good morning!":c<18?"Good afternoon!":"Good evening!")}))})),o(I,{children:[C.map(function(t,n){return r(y,e({variant:k.HD3},{children:t.text}),"".concat(t.text,"-").concat(n))}),r(re,{elements:S,config:ke})]})]}),!d&&r(re,{elements:w,config:e(e({},Se),{height:b})})]}))},Ee=function(t){return o("svg",e({xmlns:"http://www.w3.org/2000/svg",width:"289",height:"160",viewBox:"0 0 289 160",fill:"none"},t,{children:[r("g",e({opacity:"0.7",filter:"url(#filter0_f_1771_46149)"},{children:r("ellipse",{cx:"94.5",cy:"123.5",rx:"114.5",ry:"43.5",fill:"#FFB8F9"})})),r("defs",{children:o("filter",e({id:"filter0_f_1771_46149",x:"-100",y:"0",width:"389",height:"247",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[r("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),r("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),r("feGaussianBlur",{stdDeviation:"40",result:"effect1_foregroundBlur_1771_46149"})]}))})]}))},Ae=function(t){return o("svg",e({xmlns:"http://www.w3.org/2000/svg",width:"299",height:"160",viewBox:"0 0 299 160",fill:"none"},t,{children:[r("g",e({opacity:"0.7",filter:"url(#filter0_f_1771_46148)"},{children:r("ellipse",{cx:"194.5",cy:"123.5",rx:"114.5",ry:"43.5",fill:"#FFB299"})})),r("defs",{children:o("filter",e({id:"filter0_f_1771_46148",x:"0",y:"0",width:"389",height:"247",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[r("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),r("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),r("feGaussianBlur",{stdDeviation:"40",result:"effect1_foregroundBlur_1771_46148"})]}))})]}))},Te=function(){return o("svg",e({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[r("path",{d:"M10.9229 5.33203C14.0106 5.33203 16.5136 7.83512 16.5137 10.9229C16.5137 12.2862 16.0247 13.5346 15.2139 14.5049L18.1865 17.4775C18.3817 17.6728 18.3818 17.9893 18.1865 18.1846C17.9913 18.3798 17.6748 18.3798 17.4795 18.1846L14.5068 15.2119C13.5363 16.0238 12.2872 16.5137 10.9229 16.5137C7.83512 16.5136 5.33203 14.0106 5.33203 10.9229C5.33208 7.83515 7.83515 5.33208 10.9229 5.33203ZM10.9229 6.33203C8.38743 6.33208 6.33208 8.38743 6.33203 10.9229C6.33203 13.4583 8.3874 15.5136 10.9229 15.5137C13.4583 15.5137 15.5137 13.4583 15.5137 10.9229C15.5136 8.3874 13.4583 6.33203 10.9229 6.33203Z",fill:"#808080"}),r("path",{d:"M17.3715 1.09371C17.4526 0.792808 17.8795 0.792809 17.9605 1.09372L18.108 1.64169C18.4471 2.90112 19.4309 3.88489 20.6903 4.224L21.2383 4.37153C21.5392 4.45255 21.5392 4.87948 21.2383 4.9605L20.6903 5.10804C19.4309 5.44714 18.4471 6.43091 18.108 7.69035L17.9605 8.23832C17.8795 8.53922 17.4526 8.53922 17.3715 8.23832L17.224 7.69035C16.8849 6.43091 15.9011 5.44714 14.6417 5.10804L14.0937 4.9605C13.7928 4.87948 13.7928 4.45255 14.0937 4.37153L14.6417 4.22399C15.9011 3.88489 16.8849 2.90112 17.224 1.64168L17.3715 1.09371Z",fill:"#808080"}),r("g",e({filter:"url(#filter0_f_3317_42725)"},{children:r("path",{d:"M17.959 2.33203C18.202 2.96389 19.1547 4.28593 21.0211 4.51923",stroke:"#FFE9E9",strokeWidth:"0.304968"})})),r("g",e({filter:"url(#filter1_f_3317_42725)"},{children:r("path",{d:"M15.625 5.25C16.2147 5.43516 17.4486 6.16098 17.6664 7.58301",stroke:"#E4CBFF",strokeWidth:"0.304968"})})),r("g",e({filter:"url(#filter2_f_3317_42725)"},{children:r("path",{d:"M17.5215 1.16797C17.2299 3.06354 16.0342 4.28837 14.1678 4.52167",stroke:"#FFD58C",strokeWidth:"0.152484"})})),r("g",e({filter:"url(#filter3_f_3317_42725)"},{children:r("path",{d:"M21.0195 4.8125C19.124 5.10413 17.8991 6.29979 17.6658 8.1662",stroke:"#BCB09C",strokeWidth:"0.152484"})})),o("defs",{children:[o("filter",e({id:"filter0_f_3317_42725",x:"17.2067",y:"1.66741",width:"4.44314",height:"3.61245",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB"},{children:[r("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),r("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),r("feGaussianBlur",{stdDeviation:"0.304968",result:"effect1_foregroundBlur_3317_42725"})]})),o("filter",e({id:"filter1_f_3317_42725",x:"14.9694",y:"4.49553",width:"3.45767",height:"3.71987",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB"},{children:[r("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),r("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),r("feGaussianBlur",{stdDeviation:"0.304968",result:"effect1_foregroundBlur_3317_42725"})]})),o("filter",e({id:"filter2_f_3317_42725",x:"13.9144",y:"0.912275",width:"3.92643",height:"3.92936",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB"},{children:[r("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),r("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),r("feGaussianBlur",{stdDeviation:"0.121987",result:"effect1_foregroundBlur_3317_42725"})]})),o("filter",e({id:"filter3_f_3317_42725",x:"17.3462",y:"4.49235",width:"3.92887",height:"3.9274",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB"},{children:[r("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),r("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),r("feGaussianBlur",{stdDeviation:"0.121987",result:"effect1_foregroundBlur_3317_42725"})]}))]})]}))},Be=c(function(n,i){var c,p=x(),g=n.chatId,C=n.chatData,m=n.pageType,v=n.isInitialLoading,b=n.isReplyLoading,k=n.replyLoaderText,A=n.isTop,T=n.showNativeActions,B=n.isContextSummaryLoading,L=n.contextSummaryError,R=n.contextSummary,G=n.capability,U=n.sendMessage,P=n.onPreviousChatClick,M=n.onBackButtonClick,K=n.onClose,ne=n.handleMediaPicked,ie=n.scrollToBottomOnLoad,re=n.onStop,oe=G===N.SEARCH,ae=l(function(){return function(e,t){return{userMessageContainer:{scrollMarginTop:e.spacing[3],display:"flex",justifyContent:"flex-end"},chatContainer:{flex:1,minHeight:0,overflowY:"auto",display:"flex",flexDirection:"column",position:"relative",zIndex:1},animatedContainer:{flex:1,minHeight:0,overflowY:"auto",display:"flex",flexDirection:"column",transition:"transform 800ms ease-out, opacity 800ms ease-out",paddingTop:e.spacing[6],paddingLeft:e.spacing[4],paddingRight:e.spacing[4],paddingBottom:"".concat(100,"px"),position:"relative",zIndex:1},loadingContainer:{flex:1,minHeight:0,overflowY:"auto",display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:1},bgGradient:{position:"relative",marginTop:-200,bottom:0,left:0,right:0,zIndex:10,pointerEvents:"none"},bgGradientLeft:{position:"absolute",bottom:0,left:0,zIndex:1,pointerEvents:"none"},bgGradientRight:{position:"absolute",bottom:0,right:0,zIndex:1,pointerEvents:"none"},inputContainer:{paddingLeft:e.spacing[4],paddingRight:e.spacing[4],paddingBottom:e.spacing[6],paddingTop:t?0:e.spacing[4],position:t?"absolute":"relative",zIndex:10,boxSizing:"border-box",width:"100%",bottom:0,pointerEvents:"auto"},newChatContainer:{paddingLeft:e.spacing[4],paddingRight:e.spacing[4],paddingTop:e.spacing[4],paddingBottom:e.spacing[6],backgroundColor:e.color.background.neutral,position:"relative",zIndex:1},chatClosedMessage:{textAlign:"center",marginBottom:e.spacing[4]},footerContainer:{zIndex:2}}}(p,oe)},[p,oe]),le=oe&&b,ce=s(""),se=ce[0],ue=ce[1],fe=s(!1),he=fe[0],pe=fe[1],ge=s(!1),Ce=ge[0],me=ge[1],_e=d(null),Ie=d([]),ke=d(null),Se=d(null),Be=d(null),Le=d(!1),Re=d(!1),Ne=d(null),Oe=O(),Fe=Oe.hasPresented,De=Oe.markPresented,He=null!=C?C:{},Ge=He.messages,Ue=void 0===Ge?[]:Ge,Pe=He.pageData,Me=He.status,ze=He.landingContent,Ve=ee(Ue)&&!v&&!ee(ze),Ye=b&&A,Ke=d(null),We=s(!1),je=We[0],Ze=We[1],qe=d(null!==(c=null==Ue?void 0:Ue.length)&&void 0!==c?c:null),Xe=B||!ee(R)||L;u(function(){Ke.current=null,Ze(!1)},[g]),u(function(){Xe&&(null!==Ke.current?Ue.length>Ke.current&&Ze(!0):Ke.current=Ue.length)},[Xe,Ue.length]);var Qe=m===F.CHAT&&Xe&&!je,Je=Pe||{},$e=Je.title,et=void 0===$e?ve:$e,tt=Je.newChatEnabled,nt=Je.footerSlots,it=void 0===nt?[]:nt,rt=s(!1),ot=rt[0],at=rt[1],lt=s(!1),ct=lt[0],st=lt[1],dt=l(function(){return m===F.CHAT?oe?"AI Search":ve:et},[m,et]),ut=D().dispatch,ft=$(),ht=ft.handleGalleryClick,pt=ft.handleCameraClick,gt=ft.handleUploadChange;u(function(){var e;me(null!=T&&T),T&&(null===(e=_e.current)||void 0===e||e.focus())},[T]),u(function(){at(!v||!A)},[v,A]);var Ct=function(e){ue(e)},mt=function(){var e=Ce;ut({type:z.SHOW_NATIVE_ACTIONS,payload:{isNativeActionsEnabled:!e}}),me(function(e){return!e})},vt=function(){U(se),ue(""),setTimeout(function(){var e;null===(e=_e.current)||void 0===e||e.blur()},100)},xt=function(){ht(ne)},_t=function(){pt(ne)},yt=function(e){gt(e,ne)},It="iPhoneApp"===te(),bt=[{label:"Gallery",onClick:xt,onButtonClick:xt,onChange:yt,icon:"https://rukmini-ct.flixcart.com/f_auto,q_auto/offermgmt-prod/chatbot/gallery.png",inputType:"gallery",isMultiple:!0,useNativePicker:It},{label:"Camera",onClick:_t,onButtonClick:_t,onChange:yt,icon:"https://rukmini-ct.flixcart.com/f_auto,q_auto/offermgmt-prod/chatbot/camera-3d.png",inputType:"camera",useNativePicker:It},{label:"Files",onChange:yt,icon:"https://rukmini-ct.flixcart.com/f_auto,q_auto/offermgmt-prod/chatbot/pdf-3d.png",inputType:"file"}],kt=function(){var e;Ve?(null===(e=_e.current)||void 0===e||e.focus(),pe(!0)):ut({type:z.CREATE_NEW_CHAT})},St=function(e){void 0===e&&(e="auto");var t=null==ke?void 0:ke.current;t&&t.scrollTo({top:t.scrollHeight,behavior:e})};f(i,function(){return{scrollToBottom:St}},[]);var wt=h(function(){var e,t,n,i=ke.current,r=Se.current;if(i&&r){var o=-1;if(Ue)for(var a=Ue.length-1;a>=0;a--)if(Ue[a].type===V.USER_MESSAGE){o=a;break}if(-1!==o){var l=Ie.current[o];if(l){var c=0;for(a=o+1;a<(null!==(e=null==Ue?void 0:Ue.length)&&void 0!==e?e:0);a++){var s=Ie.current[a];s&&(c+=s.offsetHeight)}oe&&(c+=(null!==(n=null===(t=Be.current)||void 0===t?void 0:t.offsetHeight)&&void 0!==n?n:0)+12);var d=Math.max(0,i.clientHeight-100-l.offsetHeight-c);r.style.height="".concat(d,"px")}}else r.style.height="0px"}},[Ue,Qe]);u(function(){if(m===F.PREVIOUS_CHAT)return Le.current=!0,void St();if(ie){if(v)return;if(null===Ne.current&&(Ne.current=Ue.length),Ue.length<=Ne.current)return Le.current=!0,void St()}wt();var e=-1;if(Ue)for(var t=Ue.length-1;t>=0;t--)if(Ue[t].type===V.USER_MESSAGE){e=t;break}if(-1!==e){var n=Ie.current[e];if(n){Re.current=!0,n.scrollIntoView({behavior:"smooth",block:"start"});var i=ke.current,r=function(){Re.current=!1};null==i||i.addEventListener("scrollend",r,{once:!0}),setTimeout(r,500)}}},[Ue,m,wt,ie,v]),u(function(){var e=ke.current;if(e){var t=new ResizeObserver(function(){var e=ie&&(null===Ne.current||Ue.length<=Ne.current);if(m===F.PREVIOUS_CHAT||e)Le.current&&St();else if(Re.current||wt(),oe&&(v||qe.current===(null==Ue?void 0:Ue.length))){var t=Se.current;t&&(t.style.height="0px"),St()}});return t.observe(e),Ie.current.forEach(function(e){e&&t.observe(e)}),Be.current&&t.observe(Be.current),function(){return t.disconnect()}}},[Ue,wt,m,ie,Qe,oe]),u(function(){var e=ke.current;if(e){var t=function(){st(e.scrollTop>0);var t=e.scrollHeight-e.scrollTop-e.clientHeight;Le.current=t<4};return t(),e.addEventListener("scroll",t,{passive:!0}),function(){return e.removeEventListener("scroll",t)}}},[]);var Et=l(function(){return m===F.CHAT&&Me!==H.CLOSED||Me===H.ON_GOING},[m,Me]),At=l(function(){return Me===H.CLOSED&&m===F.CHAT},[m,Me]),Tt=l(function(){return G===N.SEARCH||tt&&m!==F.CHAT},[G,tt,m]),Bt=function(){pe(!1)},Lt=function(){return Et?o(I,e({css:ae.inputContainer},{children:[Ye&&G===N.SEARCH&&r(ye,{capability:G,loaderText:k}),o(_,e({boxSize:"tiny"},{children:[r(E,{rows:4,value:se,onChange:Ct,placeholder:"Ask a question",onPrefixClick:mt,showKeyboardIcon:Ce,onSubmit:vt,onBlur:Bt,disableAction:b||v,prefix:oe?r(Te,{}):void 0,suffix:se.length>0||le?void 0:r(a,{}),isStreaming:le,onStop:re,ref:_e}),Ce&&r(de,{actions:bt})]}))]})):null};return o(a,{children:[r(xe,{showCross:m===F.CHAT,onCrossClick:function(){null==K||K()},showPreviousChat:m===F.CHAT,onPreviousChatClick:function(){var e;ut({type:z.RAVEN_TRACKING,payload:{eventName:W.U_UI_ACTION,eventData:(e={},e[j.ACTION_NAME]=Z.U_AGENT_HISTORY_BUTTON,e[j.ACTION_TYPE]=q.CLICK,e)}}),null==P||P()},showBackButton:m===F.PREVIOUS_CHAT,onBackButtonClick:function(){null==M||M()},showNewChat:Tt,onNewChatClick:kt,showIcon:m===F.CHAT,title:dt,isScrolled:ct}),v&&A&&r(_,e({boxSize:"tiny",css:e({},ae.loadingContainer)},{children:r(S,{variant:"thin",height:"54px",width:"54px",borderColor:p.color.border.link,trackColor:p.color.border.disabledDark})})),r(_,e({boxSize:"tiny",css:ae.chatContainer},{children:o(_,e({css:e(e({},ae.animatedContainer),m===F.CHAT&&!ie&&!oe&&{transform:ot?"translateY(0)":"translateY(25%)",opacity:ot?1:0}),boxSize:"tiny",ref:ke},{children:[!v&&(null==Ue?void 0:Ue.map(function(t,n){var i,o=t.id,a=t.type,l=t.chunks,c=t.metaData,s=void 0===c?{}:c,d=((i={})[V.USER_MESSAGE]=ae.userMessageContainer,i),u=e(e({},s),{messageId:o,chatId:g,messageIndex:n,totalMessages:null==Ue?void 0:Ue.length,pageType:m}),f=!Fe(g,o);return 0===l.length?null:r(I,e({css:e({},d[a]),ref:function(e){Ie.current[n]=e}},{children:l.length>0&&r(X,e({animate:f,onComplete:function(){return De(g,o)}},{children:l.map(function(t,n){var i,o=e(e(e({},null!==(i=t.metaData)&&void 0!==i?i:{}),u),{animate:f});return r(Y,e({},t,{metaData:o}),n)})}))}),"".concat(g,"_").concat(o))})),Ye&&G===N.CONVERSATIONAL&&r(ye,{capability:G,loaderText:k}),m===F.CHAT&&r(I,{ref:Se,css:{flexShrink:0}}),ee(Ue)&&!v&&ze&&r(we,{data:ze,shouldHidePills:Qe||he||se.length>=3}),Qe&&r(I,e({ref:Be,css:{marginTop:"auto",paddingTop:"12px"}},{children:r(be,{contextSummary:R,isContextSummaryLoading:B,contextSummaryError:L})}))]}))})),oe?r(Q,e({variant:le?J.PROCESSING:J.DEFAULT,styleConfig:{root:{css:ae.bgGradient}}},{children:Lt()})):o(a,{children:[r(Ee,{style:ae.bgGradientLeft}),r(Ae,{style:ae.bgGradientRight})]}),!oe&&Lt(),At&&o(I,e({css:ae.newChatContainer},{children:[r(y,e({variant:"P3",styleConfig:{css:ae.chatClosedMessage}},{children:"This query has been closed, If you have a query regarding this trip, you can start a new chat."})),r(w,e({variant:"contained",color:"primary",isFullWidth:!0,onClick:kt},{children:"Start New Chat"}))]})),m===F.PREVIOUS_CHAT&&r(I,e({css:ae.footerContainer},{children:null==it?void 0:it.map(function(n,i){var o=n.type,a=t(n,["type"]),l="".concat(o,"_").concat(i);return r(Y,e({type:o},a),l)})}))]})}),Le=p(Be),Re=function(e){return{root:{borderRadius:"inherit",display:"flex",flexDirection:"column",flex:1,minHeight:0},listContainer:{flex:1,minHeight:0,overflowY:"auto",position:"relative",zIndex:1},bgGradientLeft:{position:"absolute",bottom:0,left:0,zIndex:0,pointerEvents:"none"},bgGradientRight:{position:"absolute",bottom:0,right:0,zIndex:0,pointerEvents:"none"},shimmerContainer:{paddingTop:e.spacing[6],paddingBottom:e.spacing[6],paddingLeft:e.spacing[4],paddingRight:e.spacing[4]},shimmerCard:{border:"1px solid ".concat(e.color.border.disabledDark),borderRadius:e.border.radius[12],padding:e.spacing[3]},bodyContainer:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",flex:1},errorContainer:{maxWidth:"200px",alignItems:"center"},labelContainer:{alignItems:"center"},errorText:{textAlign:"center"},errorButton:{minWidth:"120px",background:"transparent"}}},Ne=function(){var t=x(),n=l(function(){return Re(t)},[t]);return r(I,e({css:n.shimmerContainer},{children:o(_,e({boxSize:"tiny"},{children:[r(A,{height:t.size[5],width:"120px"}),Array.from({length:3}).map(function(i,a){return o(_,e({boxSize:"nano",css:n.shimmerCard},{children:[r(A,{height:t.size[4],width:"150px"}),r(A,{height:t.size[4],width:"200px"})]}),a)})]}))}))};!function(e){e.ERROR="error",e.EMPTY="empty"}(le||(le={}));var Oe,Fe=((ce={})[le.ERROR]={icon:"https://rukmini-ct.flixcart.com/f_auto,q_auto/offermgmt-prod/chatbot/3d-mug.png",text:"Oops, we couldn't load the chat",buttonLabel:"Try again"},ce[le.EMPTY]={icon:"https://rukmini-ct.flixcart.com/f_auto,q_auto/offermgmt-prod/chatbot/chat-bubble.png",text:"No chats yet? Start your first one!",buttonLabel:"Start a new chat"},ce),De=function(t){var n=t.variant,i=void 0===n?le.ERROR:n,a=x(),c=l(function(){return Re(a)},[a]),s=D().dispatch;return r(I,e({css:c.bodyContainer},{children:o(_,e({boxSize:"medium",css:c.errorContainer},{children:[r("img",{src:Fe[i].icon,alt:i,height:100,width:100}),o(_,e({boxSize:"small",css:c.labelContainer},{children:[r(y,e({variant:"HM3",styleConfig:{css:c.errorText}},{children:Fe[i].text})),r(w,e({variant:"outline",onClick:function(){i===le.ERROR?s({type:z.REFETCH_PREVIOUS_CHAT}):s({type:z.CREATE_NEW_CHAT})},css:c.errorButton},{children:Fe[i].buttonLabel}))]}))]}))}))},He=p(function(t){var n=t.chats,i=t.loading,a=void 0!==i&&i,c=t.onBack,f=t.previousChatError,h=null!=n?n:{},p=h.previousChats,g=void 0===p?[]:p,C=h.pageData,m=null!=C?C:{},v=m.newChatEnabled,y=m.chatCount,b=x(),k=l(function(){return Re(b)},[b]),S=D().dispatch,w=d(null),E=s(!1),A=E[0],T=E[1];u(function(){var e=w.current;if(e){var t=function(){T(e.scrollTop>0)};return t(),e.addEventListener("scroll",t,{passive:!0}),function(){return e.removeEventListener("scroll",t)}}},[a,g.length]);return o(I,e({css:k.root},{children:[r(xe,{showCross:!1,showPreviousChat:!1,showBackButton:!0,onBackButtonClick:c,title:"Past Conversations",showNewChat:v,onNewChatClick:function(){S({type:z.CREATE_NEW_CHAT})},showIcon:!1,isScrolled:A}),a&&r(Ne,{}),!a&&(f?r(De,{variant:le.ERROR}):0===y?r(De,{variant:le.EMPTY}):null),!a&&g.length>0&&!!y&&y>0&&r(_,e({boxSize:"medium",css:k.listContainer,ref:w},{children:g.map(function(e,t){var n=e.type,i=e.data,o="".concat(n,"_").concat(t);return r(Y,{type:n,data:i},o)})})),r(Ee,{style:k.bgGradientLeft}),r(Ae,{style:k.bgGradientRight})]}))}),Ge=function(t){var n=t.onClose,i=t.onBack,c=t.retry,s=x(),d=l(function(){return{bodyContainer:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",flex:1},errorContainer:{maxWidth:"200px",alignItems:"center"},labelContainer:{alignItems:"center"},errorText:{textAlign:"center"},errorButton:{width:"120px",background:"transparent"},bgGradientLeft:{position:"absolute",bottom:0,left:0,zIndex:0,pointerEvents:"none"},bgGradientRight:{position:"absolute",bottom:0,right:0,zIndex:0,pointerEvents:"none"}}},[s]),u=D().dispatch,f=(null==c?void 0:c.kind)===G.PREVIOUS;return o(a,{children:[r(xe,{showBackButton:f,onBackButtonClick:i,showCross:!f,onCrossClick:n,showIcon:!1,title:""}),r(I,e({css:d.bodyContainer},{children:o(_,e({boxSize:"medium",css:d.errorContainer},{children:[r("img",{src:"https://rukmini-ct.flixcart.com/f_auto,q_auto/offermgmt-prod/chatbot/3d-mug.png",alt:"error",height:100,width:100}),o(_,e({boxSize:"small",css:d.labelContainer},{children:[r(y,e({variant:"HM3",styleConfig:{css:d.errorText}},{children:"Oops, we couldn't load the chat"})),r(w,e({variant:"outline",onClick:function(){u({type:z.RETRY_CHAT_ERROR})},css:d.errorButton},{children:"Try again"}))]}))]}))})),r(Ee,{style:d.bgGradientLeft}),r(Ae,{style:d.bgGradientRight})]})},Ue=function(t){var n=t.loading,i=void 0!==n&&n,a=x(),c=l(function(){return _e(a)},[a]);return i?o(I,e({css:c.initLoader},{children:[r(T,{}),r(y,e({variant:"B3"},{children:"Getting ready"}))]})):null},Pe=function(){return r("svg",e({xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},{children:r("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M9.57142 2.6001C9.35051 2.6001 9.17142 2.77918 9.17142 3.0001C9.17142 3.22101 9.35051 3.4001 9.57142 3.4001H12.0343L8.71716 6.71698C8.56095 6.87319 8.56094 7.12645 8.71714 7.28267C8.87335 7.43888 9.12661 7.43889 9.28283 7.28269L12.6 3.96574V6.42845C12.6 6.64936 12.7791 6.82845 13 6.82845C13.2209 6.82845 13.4 6.64936 13.4 6.42845V3.0001C13.4 2.77918 13.2209 2.6001 13 2.6001H9.57142ZM7.28285 8.717C7.12664 8.56079 6.87338 8.56078 6.71716 8.71698L3.39973 12.0342V9.57126C3.39973 9.35035 3.22065 9.17126 2.99973 9.17126C2.77882 9.17126 2.59973 9.35035 2.59973 9.57126V12.9998C2.59973 13.2207 2.77882 13.3998 2.99973 13.3998H6.42853C6.64944 13.3998 6.82853 13.2207 6.82853 12.9998C6.82853 12.7789 6.64944 12.5998 6.42853 12.5998H3.96546L7.28283 9.28269C7.43904 9.12648 7.43905 8.87322 7.28285 8.717Z",fill:"#1A1A1A"})}))},Me=function(t){var n=t.onPrefixClick,i=t.onSuffixClick,c=t.sendMessage,f=t.isReplyLoading,h=void 0!==f&&f,p=t.capability,g=void 0===p?N.CONVERSATIONAL:p,C=t.onStop,m=g===N.SEARCH,v=m&&h,y=s(""),b=y[0],k=y[1],S=s(!1),w=S[0],A=S[1],T=d(null),L=x(),R=l(function(){return function(e){return{root:{display:"flex",flexDirection:"row",alignItems:"center",width:"100%",paddingLeft:e.spacing[4],paddingRight:e.spacing[4],paddingBottom:e.spacing[6],maxWidth:"100vw",boxSizing:"border-box"},inputWrapper:{flex:1,minWidth:0},headerAction:{height:e.size[10],width:e.size[10],flexShrink:0,overflow:"hidden",opacity:1,transition:"width 0.2s ease, opacity 0.2s ease"},headerActionCollapsed:{width:0,opacity:0}}}(L)},[L]),O=D().dispatch;u(function(){var e;O({type:z.RAVEN_TRACKING,payload:{eventName:W.U_ASK_QUESTION_IMPRESSION,eventData:(e={},e[j.ACTION_TYPE]=q.IMPRESSION,e)}})},[]);var F=l(function(){return e({},w?R.headerActionCollapsed:{})},[w,h,R]),H=l(function(){return e({},w?R.headerActionCollapsed:{})},[w,h,R]);return o(B,{children:[h&&r(ye,{capability:N.SEARCH}),o(_,e({boxSize:"micro",horizontal:!0,css:R.root},{children:[!v&&r(fe,e({onClick:n,styleConfig:{root:{css:e(e({},R.headerAction),F)}}},{children:r(Pe,{})})),r(I,e({css:R.inputWrapper},{children:r(E,{ref:T,value:b,onChange:function(e){k(e)},onFocus:function(){var e;A(!0),O({type:z.RAVEN_TRACKING,payload:{eventName:W.U_UI_ACTION,eventData:(e={},e[j.ACTION_NAME]=Z.U_ASK_QUESTION_BUTTON,e[j.ACTION_TYPE]=q.CLICK,e)}})},onBlur:function(){A(!1)},onSubmit:function(){var e=b.trim();e&&!h&&(null==c||c(e),k(""),setTimeout(function(){var e;null===(e=T.current)||void 0===e||e.blur()},100))},disableAction:h,prefix:m?r(Te,{}):void 0,suffix:b.length>0||v?void 0:r(a,{}),isStreaming:v,onStop:C,placeholder:"Ask a question"})})),!v&&r(fe,e({onClick:function(){return i(b)},styleConfig:{root:{css:e(e({},R.headerAction),H)}}},{children:r(ge,{})}))]}))]})},ze=c(function(t,n){var i=t.onPrefixClick,a=t.onSuffixClick,c=t.sendMessage,s=t.isReplyLoading,d=t.visible,u=void 0===d||d,f=t.isInitialLoading,h=void 0!==f&&f,p=t.capability,g=t.onStop,C=x(),m=l(function(){return{root:{position:"fixed",bottom:0,left:0,right:0,width:"100%",zIndex:100},backgroundGradient:{position:"absolute",bottom:0,left:0,right:0,zIndex:0,pointerEvents:"none"},content:{position:"relative",zIndex:1}}},[C]),v=p===N.SEARCH&&s;return r(B,{children:r(I,e({css:m.root},{children:r(b,e({type:"fade",timeout:400,appear:!0,mountOnEnter:!0,unmountOnExit:!0,in:u},{children:o(I,{children:[r(Q,{variant:v?J.PROCESSING:J.DEFAULT,styleConfig:{root:{css:m.backgroundGradient}}}),r(b,e({type:"slide",slideDirection:"up",timeout:400,appear:!0,mountOnEnter:!0,unmountOnExit:!0,in:u},{children:r(I,e({css:m.content,ref:n},{children:h?r(Ue,{loading:h}):r(Me,{onPrefixClick:i,onSuffixClick:a,sendMessage:c,isReplyLoading:s,capability:p,onStop:g})}))}))]})}))}))})}),Ve=function(e){var t=x(),n=e.visible,i=e.message,o=e.type,a=e.onDismiss,c=e.duration,s=void 0===c?3e3:c,d=l(function(){return function(e){return{prefixContainer:{display:"flex",alignItems:"center",justifyContent:"center"},toastContainer:{gap:e.spacing[2],alignItems:"center",width:"fit-content",bottom:"100px",zIndex:100,whiteSpace:"nowrap"}}}(t)},[t]);if(u(function(){if(n){var e=setTimeout(function(){return null==a?void 0:a()},s+500);return function(){return clearTimeout(e)}}},[n,s,a]),!n)return null;var f=o?r(ae,{icon:o}):null;return r(L,{show:!0,text:i,isAutoClose:!0,prefixComponent:f,closeTimeout:s,styleConfig:{toastContainer:{css:d.toastContainer},prefixContainer:{css:d.prefixContainer}}})};!function(e){e.FLOATING="FLOATING",e.HYBRID="HYBRID",e.EXPANDED="EXPANDED"}(Oe||(Oe={}));var Ye,Ke,We=function(t){void 0===t&&(t=Oe.FLOATING);var n=this;this.listeners=new Set,this.handlers={},this.getSnapshot=function(){return n.snapshot},this.subscribe=function(e){return n.listeners.add(e),function(){n.listeners.delete(e)}},this.setSnapshot=function(t){var i=e(e({},n.snapshot),t);i.state===n.snapshot.state&&i.isReplyLoading===n.snapshot.isReplyLoading||(n.snapshot=i,n.listeners.forEach(function(e){return e()}))},this.showFloating=function(){return n.setSnapshot({state:Oe.FLOATING})},this.showHybrid=function(){return n.setSnapshot({state:Oe.HYBRID})},this.hideHybrid=function(){return n.setSnapshot({state:Oe.FLOATING})},this.expand=function(){return n.setSnapshot({state:Oe.EXPANDED})},this.collapse=function(){return n.setSnapshot({state:Oe.HYBRID})},this.setState=function(e){return n.setSnapshot({state:e})},this.setReplyLoading=function(e){return n.setSnapshot({isReplyLoading:e})},this.setHandlers=function(e){n.handlers=e},this.clearHandlers=function(){n.handlers={}},this.openSearchFromFloatingPill=function(){var e,t;n.setSnapshot({state:Oe.HYBRID}),null===(t=null===(e=n.handlers)||void 0===e?void 0:e.onFloatingPillClick)||void 0===t||t.call(e)},this.snapshot={state:t,isReplyLoading:!1}},je=null,Ze=function(){return je||(je=new We),je},qe=g(null),Xe=function(t){var n=t.children,i=t.bridge,o=t.initialState,a=d();return a.current||(a.current=null!=i?i:new We(o)),r(qe.Provider,e({value:a.current},{children:n}))},Qe=function(){var e=C(qe);return null!=e?e:Ze()},Je=function(e){var t=Qe(),n=null!=e?e:t;return m(n.subscribe,n.getSnapshot,n.getSnapshot)},$e=function(e,t){var n=Je(e).state;u(function(){if(n===Oe.HYBRID&&"undefined"!=typeof window){var i=Date.now(),r=function(){return Date.now()-i<400},o=function(e){var n;return!(!e||!(null===(n=t.current)||void 0===n?void 0:n.contains(e)))},a=!1,l=function(e){a=!o(e.target)&&o(document.activeElement)},c=function(t){o(t.target)||(t.stopPropagation(),t.preventDefault(),r()||(a?a=!1:e.hideHybrid()))},s=function(e){r()&&(o(e.target)||(e.stopPropagation(),e.preventDefault()))},d={capture:!0};return document.addEventListener("pointerdown",l,d),document.addEventListener("mousedown",s,d),document.addEventListener("mouseup",s,d),document.addEventListener("click",c,d),function(){document.removeEventListener("pointerdown",l,d),document.removeEventListener("mousedown",s,d),document.removeEventListener("mouseup",s,d),document.removeEventListener("click",c,d)}}},[n,e,t])};!function(e){e.ONGOING="ongoing",e.IDLE="idle"}(Ye||(Ye={})),function(e){e.CHAT="CHAT",e.PREVIOUS_CHATS="PREVIOUS_CHATS"}(Ke||(Ke={}));var et=function(t){var c,f=t.open,p=void 0===f||f,g=t.onClose,C=t.network,m=t.protocol,_=t.triggerTracking,y=t.baseTrackingData,b=t.onChatStateChange,k=t.plugins,w=t.capability,E=void 0===w?N.CONVERSATIONAL:w,A=x(),T=l(function(){return{sheetContainer:{css:{background:"linear-gradient(180deg, #FFF 20.72%, #FFF1ED 47.83%)"}},screenWrapper:{display:"flex",flexDirection:"column",position:"absolute",top:0,left:0,right:0,bottom:0,background:"linear-gradient(180deg, #FFF 20.72%, #FFF1ED 47.83%)",willChange:"transform"},stackContainer:{position:"relative",flex:1,minHeight:0,overflow:"hidden",borderRadius:"inherit"},loadingContainer:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:1}}},[A]),L=d(0),O=d(b);O.current=b;var D=E===N.SEARCH,G=Qe(),X=Je(G),Q=d(null),J=d([]),$=d("800px"),ee=d("800px"),te=s(p),ne=te[0],ie=te[1];u(function(){$.current="".concat(window.innerHeight,"px");var e=.94*window.innerHeight;ee.current="".concat(e,"px")},[]),u(function(){ie(p)},[p]);var re=D?X.state===Oe.EXPANDED:ne;u(function(){D&&p&&G.expand()},[D,p,G]),$e(G,Q);var oe=h(function(){D?G.expand():ie(!0)},[D,G]),ae=h(function(){D?G.collapse():(ie(!1),null==g||g())},[D,G,g]),le=U({network:C,triggerTracking:_,baseTrackingData:y,protocol:m,resolveMerge:K,plugins:k,capability:E,open:re,onOpenChatbot:oe,onCloseChatbot:ae,chatWindowRefs:J}),ce=le.currentChatId,se=le.messages,de=le.chatStack,ue=le.previousChats,fe=le.previousChatLoading,he=le.previousChatError,pe=le.isInitialLoading,ge=le.isInitialError,Ce=le.retryInitialChat,me=le.toast,ve=le.hideToast,xe=le.isNewChat,_e=le.isReplyLoading,ye=le.replyLoaderText,Ie=le.screenRefs,be=le.showNativeActions,ke=le.chatService,Se=le.isContextSummaryLoading,we=le.contextSummary,Ee=le.contextSummaryError,Ae=le.handleMediaPicked,Te=le.dispatch,Be=le.dispatchAll,Re=le.getPreviousChats,Ne=le.pushToChatStack,Fe=le.sendMessage,De=le.stop,Ue=le.hasPresented,Pe=le.markPresented,Me=le.handleBackButtonClick,Ke=d(De);Ke.current=De;var We=h(function(){var e;D&&(null===(e=Ke.current)||void 0===e||e.call(Ke))},[D]),je=d(X.state);u(function(){var e=je.current,t=X.state;je.current=t,e===Oe.HYBRID&&t===Oe.FLOATING&&We()},[X.state,We]),u(function(){D&&ge&&(X.state===Oe.HYBRID&&Te({type:z.SHOW_TOAST,payload:{message:"Something went wrong. Please try again."}}),G.showFloating())},[D,ge,G]);var Ze=d(X.state);u(function(){var e=Ze.current,t=X.state;Ze.current=t,D&&ge&&e===Oe.FLOATING&&t===Oe.HYBRID&&Ce()},[D,X.state,ge,Ce]);var qe=d(!1),Xe=h(function(){var e;Te({type:z.RAVEN_TRACKING,payload:{eventName:W.U_UI_ACTION,eventData:(e={},e[j.ACTION_NAME]=Z.U_OPEN_SEARCH,e[j.ACTION_TYPE]=q.CLICK,e)}})},[Te]);u(function(){if(D)return G.setHandlers({onFloatingPillClick:Xe}),function(){return G.clearHandlers()}},[D,G,Xe]),u(function(){D&&G.setReplyLoading(_e)},[D,_e,G]),u(function(){if(re)return function(){Te({type:z.SHOW_NATIVE_ACTIONS,payload:{isNativeActionsEnabled:!1}})}},[re]),u(function(){re&&(qe.current=!0)},[re]),u(function(){var e;re&&!pe&&ce&&qe.current&&(qe.current=!1,Te({type:z.RAVEN_TRACKING,payload:{eventName:W.U_AI_CHAT_PAGELOAD,eventData:(e={},e[j.CHAT_HISTORY_FLAG]=xe?"new":"existing",e[j.CHAT_SESSION_ID]=ce,e)}}))},[re,pe,ce,xe,Te]),u(function(){var e,t;if(D&&X.state!==Oe.EXPANDED&&ce){var n=null!==(t=null===(e=se[ce])||void 0===e?void 0:e.messages)&&void 0!==t?t:[];n.forEach(function(e,t){_e&&t===n.length-1||Pe(ce,e.id)})}},[D,X.state,se,ce,_e,Pe]);var et=l(function(){var e,t,n=ce?se[ce]:void 0;return n&&n.status!==H.CLOSED&&(null!==(t=null===(e=n.messages)||void 0===e?void 0:e.length)&&void 0!==t?t:0)>1?Ye.ONGOING:Ye.IDLE},[se,ce]);u(function(){var e;null===(e=O.current)||void 0===e||e.call(O,{status:et})},[et]),v(function(){var e=L.current,t=de.length;if(L.current=t,!(t<=e||t<=1)){var n=Ie.current[t-1];if(n){n.classList.add("chat-slide-in-from-right");n.addEventListener("animationend",function(){n.classList.remove("chat-slide-in-from-right")},{once:!0})}}},[de.length]);var tt=function(){var e;Te({type:z.RAVEN_TRACKING,payload:{eventName:W.U_AI_CHAT_BOT_CLOSE,eventData:(e={},e[j.CHAT_SESSION_ID]=ce,e[j.ACTION_NAME]=j.ASK_AI_CLOSE_CLICK,e)}}),We(),D?G.collapse():(ie(!1),null==g||g())},nt=function(){return n(void 0,void 0,void 0,function(){return i(this,function(e){return We(),Ne({type:F.PREVIOUS_CHAT_LISTING}),Re(),[2]})})},it=function(e,t,n){var i=e.type,o=e.id,a=e.retry,l=e.scrollToBottomOnLoad;switch(i){case F.PREVIOUS_CHAT_LISTING:return r(He,{chats:ue,loading:fe,onBack:Me,previousChatError:he});case F.CHAT_ERROR:return r(Ge,{onClose:tt,onBack:Me,retry:a});case F.PREVIOUS_CHAT:case F.CHAT:default:return r(Le,{ref:function(e){J.current[n]=e},chatId:o||"",chatData:se[o||""],sendMessage:Fe,onPreviousChatClick:nt,pageType:i,onBackButtonClick:Me,isInitialLoading:pe,isReplyLoading:_e,replyLoaderText:ye,isTop:t,onClose:tt,handleMediaPicked:Ae,showNativeActions:be,scrollToBottomOnLoad:l,isContextSummaryLoading:Se,contextSummary:we,contextSummaryError:Ee,capability:E,onStop:We})}},rt=l(function(){var e,t;return(ce&&null!==(t=null===(e=se[ce])||void 0===e?void 0:e.messages)&&void 0!==t?t:[]).flatMap(function(e){return e.chunks.map(function(t,n){return{chunk:t,key:"".concat(e.id,":").concat(n),messageId:e.id}}).filter(function(e){return e.chunk.type===V.ACTION_HANDLER})})},[se,ce]);return r(P,e({chatService:ke},{children:o(M,e({dispatch:Te,dispatchAll:Be,hasPresented:Ue,markPresented:Pe},{children:[D&&r(Ve,{visible:!!me,message:null!==(c=null==me?void 0:me.message)&&void 0!==c?c:"",duration:null==me?void 0:me.duration,onDismiss:ve},null==me?void 0:me.id),D&&X.state!==Oe.EXPANDED&&o(a,{children:[rt.map(function(t){var n,i=t.chunk,o=t.key,a=t.messageId,l=e(e({},null!==(n=i.metaData)&&void 0!==n?n:{}),{messageId:a,chatId:ce,presentOnDispatch:!0});return r(Y,e({},i,{metaData:l}),o)}),r(ze,{ref:Q,visible:X.state===Oe.HYBRID,onPrefixClick:function(){var e;Te({type:z.RAVEN_TRACKING,payload:{eventName:W.U_UI_ACTION,eventData:(e={},e[j.ACTION_NAME]=Z.U_EXPAND_CHAT,e[j.ACTION_TYPE]=q.CLICK,e)}}),G.expand()},onSuffixClick:function(e){var t;Te({type:z.RAVEN_TRACKING,payload:{eventName:W.U_UI_ACTION,eventData:(t={},t[j.ACTION_NAME]=Z.U_CLOSE_CHAT,t[j.U_FHP_ASKQUESTION]=null!=e?e:"",t[j.ACTION_TYPE]=q.CLICK,t)}}),G.hideHybrid()},sendMessage:Fe,isReplyLoading:_e,isInitialLoading:pe,capability:E,onStop:We})]}),r(B,{children:r(R,e({isOpen:re,onClose:tt,radius:"md",styleConfig:{bottomSheetContainer:{css:e(e({},T.sheetContainer.css),{height:ee.current,maxHeight:"".concat($.current," !important")})}}},{children:o(I,e({css:T.stackContainer},{children:[0===de.length&&pe&&r(I,e({css:T.loadingContainer},{children:r(S,{variant:"thin",height:"54px",width:"54px",borderColor:A.color.border.link,trackColor:A.color.border.disabledDark})})),de.map(function(t,n){var i,o=n===de.length-1;return r(I,e({ref:function(e){Ie.current[n]=e},css:e(e({},T.screenWrapper),{visibility:o?"visible":"hidden"})},{children:it(t,o,n)}),"".concat(t.type,"_").concat(null!==(i=t.id)&&void 0!==i?i:n))})]}))}))})]}))}))};export{We as ChatSurfaceBridge,Xe as ChatSurfaceProvider,Oe as ChatSurfaceState,et as ChatUI,Ye as ChatUIStatusValue,Ke as ChatView,Me as HybridChat,ze as HybridChatWindow,Ze as getChatSurfaceBridge,Je as useChatSurface,Qe as useChatSurfaceBridge,$e as useHideOnBackgroundInteraction};
|
|
2
2
|
//# sourceMappingURL=talos-chat-ui.browser.esm.js.map
|