@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.
@@ -90,5 +90,8 @@ export declare const styles: (theme: Theme, isSearch: boolean) => {
90
90
  textAlign: string;
91
91
  marginBottom: "16px";
92
92
  };
93
+ footerContainer: {
94
+ zIndex: number;
95
+ };
93
96
  };
94
97
  //# sourceMappingURL=style.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../packages/components/chat-ui/src/ChatWindow/style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AAIxD,eAAO,MAAM,MAAM,UAAW,KAAK,YAAY,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6FrD,CAAA"}
1
+ {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../packages/components/chat-ui/src/ChatWindow/style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AAIxD,eAAO,MAAM,MAAM,UAAW,KAAK,YAAY,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgGrD,CAAA"}
@@ -1,2 +1,2 @@
1
- "use strict";var e,t,n=require("tslib"),i=require("react/jsx-runtime"),r=require("react"),a=require("@cleartrip/ct-design-components"),s=require("@cleartrip/talos-use-chat-controller"),o=require("@cleartrip/talos-widget-types"),l=require("@cleartrip/talos-widget-manager"),c=require("@cleartrip/talos-constants"),u=require("@cleartrip/talos-sequential-reveal"),d=require("@cleartrip/talos-background-gradient"),h=require("@cleartrip/talos-use-native-actions"),f=require("@cleartrip/talos-general-utils"),p=require("uuid"),g=require("@cleartrip/talos-lottie"),_=require("@cleartrip/talos-animated-ticker"),C=require("@cleartrip/talos-horizontal-chip-menu"),x=require("@cleartrip/talos-icon"),m={camera:"image/*",gallery:".jpg,.jpeg,image/jpeg,.png,image/png",file:"application/pdf,.pdf"},v=function(e){var t=e.actions,s=a.useTheme(),o=r.useMemo(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"}}}(s)},[s]),l=function(e,t){return"string"==typeof e?i.jsx("img",{src:e,alt:t,height:40,width:40}):e};return i.jsx(a.Box,n.__assign({boxSize:"tiny",horizontal:!0},{children:t.map(function(e){var t=e.label,r=e.onClick,s=e.onButtonClick,c=e.onChange,u=e.icon,d=e.inputType,h=e.isMultiple,f=e.useNativePicker;return i.jsxs(a.Box,n.__assign({boxSize:"micro",css:o.actionBox},{children:[l(u,t),i.jsx(a.Typography,n.__assign({variant:"L3"},{children:t})),d&&(f?i.jsx("button",{type:"button",onClick:s,style:o.hiddenInput,"aria-label":t}):i.jsx("input",n.__assign({type:"file",accept:m[d]},"camera"===d?{capture:"environment"}:{},{onClick:r,onChange:c,style:o.hiddenInput,"aria-label":t,multiple:h})))]}),t)})}))},y=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}}},T=function(e){var t=e.children,s=e.onClick,o=e.styleConfig,l=a.useTheme(),c=r.useMemo(function(){return y(l)},[l]),u=(o||{}).root;return i.jsx(a.Container,n.__assign({onClick:s,css:n.__assign(n.__assign({},c.headerAction),null==u?void 0:u.css)},{children:t}))},E=function(){return i.jsxs("svg",n.__assign({xmlns:"http://www.w3.org/2000/svg",width:"21",height:"20",viewBox:"0 0 21 20",fill:"none"},{children:[i.jsx("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)"}),i.jsx("g",n.__assign({filter:"url(#filter0_f_3415_10691)"},{children:i.jsx("path",{d:"M9.56259 5.67664C10.0313 6.89539 11.8688 9.44538 15.4688 9.89538",stroke:"#F801B7","stroke-width":"0.588235"})})),i.jsx("g",n.__assign({filter:"url(#filter1_f_3415_10691)"},{children:i.jsx("path",{d:"M5.06265 11.3016C6.20015 11.6588 8.58015 13.0588 9.00015 15.8016",stroke:"#7801F8","stroke-width":"0.588235"})})),i.jsx("g",n.__assign({filter:"url(#filter2_f_3415_10691)"},{children:i.jsx("path",{d:"M8.71826 3.42688C8.15576 7.08313 5.84951 9.44563 2.24951 9.89563",stroke:"#FFD58C","stroke-width":"0.294118"})})),i.jsx("g",n.__assign({filter:"url(#filter3_f_3415_10691)"},{children:i.jsx("path",{d:"M15.4691 10.4581C11.8129 11.0206 9.4504 13.3269 9.0004 16.9269",stroke:"#FFD58C","stroke-width":"0.294118"})})),i.jsx("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)"}),i.jsx("g",n.__assign({filter:"url(#filter4_f_3415_10691)"},{children:i.jsx("path",{d:"M17.1917 1.99988C17.4 2.54154 18.2167 3.67488 19.8167 3.87488",stroke:"#F801B7","stroke-width":"0.220588"})})),i.jsx("g",n.__assign({filter:"url(#filter5_f_3415_10691)"},{children:i.jsx("path",{d:"M15.1913 4.49951C15.6969 4.65824 16.7547 5.28046 16.9413 6.49951",stroke:"#9937CA","stroke-width":"0.220588"})})),i.jsx("g",n.__assign({filter:"url(#filter6_f_3415_10691)"},{children:i.jsx("path",{d:"M16.8165 1.00061C16.5665 2.62561 15.5415 3.67561 13.9415 3.87561",stroke:"#FFD58C","stroke-width":"0.110294"})})),i.jsx("g",n.__assign({filter:"url(#filter7_f_3415_10691)"},{children:i.jsx("path",{d:"M19.817 4.12512C18.192 4.37512 17.142 5.40012 16.942 7.00012",stroke:"#FFD58C","stroke-width":"0.110294"})})),i.jsxs("defs",{children:[i.jsxs("filter",n.__assign({id:"filter0_f_3415_10691",x:"8.11162",y:"4.39457",width:"8.57017",height:"6.96915",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[i.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),i.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),i.jsx("feGaussianBlur",{stdDeviation:"0.588235",result:"effect1_foregroundBlur_3415_10691"})]})),i.jsxs("filter",n.__assign({id:"filter1_f_3415_10691",x:"3.79808",y:"9.84453",width:"6.66929",height:"7.17814",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[i.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),i.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),i.jsx("feGaussianBlur",{stdDeviation:"0.588235",result:"effect1_foregroundBlur_3415_10691"})]})),i.jsxs("filter",n.__assign({id:"filter2_f_3415_10691",x:"1.76067",y:"2.93395",width:"7.57353",height:"7.57814",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[i.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),i.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),i.jsx("feGaussianBlur",{stdDeviation:"0.235294",result:"effect1_foregroundBlur_3415_10691"})]})),i.jsxs("filter",n.__assign({id:"filter3_f_3415_10691",x:"8.38387",y:"9.84216",width:"7.57823",height:"7.5735",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[i.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),i.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),i.jsx("feGaussianBlur",{stdDeviation:"0.235294",result:"effect1_foregroundBlur_3415_10691"})]})),i.jsxs("filter",n.__assign({id:"filter4_f_3415_10691",x:"16.6475",y:"1.51915",width:"3.62396",height:"2.9064",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[i.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),i.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),i.jsx("feGaussianBlur",{stdDeviation:"0.220588",result:"effect1_foregroundBlur_3415_10691"})]})),i.jsxs("filter",n.__assign({id:"filter5_f_3415_10691",x:"14.7171",y:"3.95311",width:"2.77441",height:"3.0043",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[i.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),i.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),i.jsx("feGaussianBlur",{stdDeviation:"0.220588",result:"effect1_foregroundBlur_3415_10691"})]})),i.jsxs("filter",n.__assign({id:"filter6_f_3415_10691",x:"13.7582",y:"0.815717",width:"3.28928",height:"3.29105",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[i.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),i.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),i.jsx("feGaussianBlur",{stdDeviation:"0.0882353",result:"effect1_foregroundBlur_3415_10691"})]})),i.jsxs("filter",n.__assign({id:"filter7_f_3415_10691",x:"16.7108",y:"3.89409",width:"3.29105",height:"3.28934",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[i.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),i.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),i.jsx("feGaussianBlur",{stdDeviation:"0.0882353",result:"effect1_foregroundBlur_3415_10691"})]})),i.jsxs("linearGradient",n.__assign({id:"paint0_linear_3415_10691",x1:"9",y1:"1.17676",x2:"9",y2:"19.1768",gradientUnits:"userSpaceOnUse"},{children:[i.jsx("stop",{"stop-color":"#F0257E"}),i.jsx("stop",{offset:"1","stop-color":"#FE6C46"})]})),i.jsxs("linearGradient",n.__assign({id:"paint1_linear_3415_10691",x1:"16.9415",y1:"0",x2:"16.9415",y2:"8",gradientUnits:"userSpaceOnUse"},{children:[i.jsx("stop",{"stop-color":"#F0257E"}),i.jsx("stop",{offset:"1","stop-color":"#FE6C46"})]}))]})]}))},j=function(){return i.jsxs("svg",n.__assign({xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},{children:[i.jsx("mask",n.__assign({id:"mask0_2214_2441",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"20",height:"20"},{children:i.jsx("rect",{width:"20",height:"20",fill:"#D9D9D9"})})),i.jsx("g",n.__assign({mask:"url(#mask0_2214_2441)"},{children:i.jsx("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"})}))]}))},A=function(){return i.jsx("svg",n.__assign({xmlns:"http://www.w3.org/2000/svg",width:"20",height:"16",viewBox:"0 0 20 16",fill:"none"},{children:i.jsx("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"})}))},S=function(){return i.jsx("svg",n.__assign({xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},{children:i.jsx("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"})}))},I=function(){var e=p.v4();return i.jsxs("svg",n.__assign({xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},{children:[i.jsx("mask",n.__assign({id:e,style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"20",height:"20"},{children:i.jsx("rect",{width:"20",height:"20",fill:"#D9D9D9"})})),i.jsx("g",n.__assign({mask:"url(#".concat(e,")")},{children:i.jsx("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"})}))]}))},b="Get quick support 24/7",R=function(e){var t=a.useTheme(),s=e.showBackButton,o=void 0!==s&&s,l=e.showCross,c=void 0!==l&&l,u=e.showPreviousChat,d=void 0!==u&&u,h=e.title,f=void 0===h?b:h,p=e.showIcon,g=void 0===p||p,_=e.showNewChat,C=void 0!==_&&_,x=e.isScrolled,m=void 0!==x&&x,v=e.onBackButtonClick,R=e.onCrossClick,k=e.onPreviousChatClick,B=e.onNewChatClick,w=r.useMemo(function(){return y(t,m)},[t,m]);return i.jsxs(a.Container,n.__assign({css:w.root},{children:[i.jsxs(a.Box,n.__assign({boxSize:"tiny",horizontal:!0,css:{alignItems:"center"}},{children:[o&&i.jsx(T,n.__assign({onClick:v},{children:i.jsx(S,{})})),i.jsxs(a.Box,n.__assign({boxSize:"pico",horizontal:!0},{children:[g&&i.jsx(a.Container,n.__assign({css:w.iconContainer},{children:i.jsx(E,{})})),i.jsx(a.Typography,n.__assign({variant:"HM3",styleConfig:{css:w.title},lineClamp:1},{children:f}))]}))]})),i.jsxs(a.Box,n.__assign({boxSize:"tiny",horizontal:!0},{children:[d&&i.jsx(T,n.__assign({onClick:k},{children:i.jsx(j,{})})),C&&i.jsx(T,n.__assign({onClick:B},{children:i.jsx(I,{})})),c&&i.jsx(T,n.__assign({onClick:R},{children:i.jsx(A,{})}))]}))]}))},k=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]}}},B=function(e){var t=e.loaderText,o=void 0===t?"Processing your request":t,l=e.capability,c=void 0===l?s.ChatCapability.CONVERSATIONAL:l,u=a.useTheme(),d=r.useMemo(function(){return k(u)},[u]);return c===s.ChatCapability.SEARCH?i.jsxs(a.Container,n.__assign({css:d.root},{children:[i.jsx(g.Lottie,{lottieId:"AI_LOADER",autoPlay:!0,loop:!0,hasContainer:!0,height:"32px",width:"32px"}),i.jsx(a.Typography,n.__assign({variant:"B3"},{children:o}))]})):i.jsx(g.Lottie,{lottieId:"AI_LOADER",autoPlay:!0,loop:!0,hasContainer:!0,height:"32px",width:"32px"})},w=function(){return i.jsx("svg",n.__assign({xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},{children:i.jsx("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"})}))},N=function(e){var t=e.isContextSummaryLoading,s=e.contextSummary,o=a.useTheme(),l=r.useMemo(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)"}}}}}(o)},[o]);if(t)return i.jsxs(a.Box,n.__assign({boxSize:"pico",css:l.loadingContainer},{children:[i.jsx(a.Container,n.__assign({css:l.iconContainer},{children:i.jsx(a.Container,n.__assign({css:l.animatedIcon},{children:i.jsx(w,{})}))})),i.jsx(a.Typography,n.__assign({variant:"B2"},{children:"Updating search context..."}))]}));var c=(s||{}).data,u=void 0===c?{}:c,d=u.contextSummary,h=void 0===d?"Your search context has been updated":d,p=u.filterSummary,g=u.promptMessage,_=f.isEmpty(g)?"How can I help you further?":g;return i.jsx(a.Transition,n.__assign({type:"fade",timeout:400,in:!0},{children:i.jsxs(a.Box,n.__assign({boxSize:"micro",css:l.fadeIn},{children:[i.jsx(a.Typography,n.__assign({variant:"B4CAPS",color:"subheading"},{children:"CONTINUE SEARCHING FOR"})),i.jsxs(a.Container,{children:[i.jsx(a.Typography,n.__assign({variant:"HM4",componentNode:"span"},{children:h})),!f.isEmpty(p)&&i.jsxs(i.Fragment,{children:[i.jsx(a.Typography,n.__assign({variant:"HM4",componentNode:"span"},{children:"・"})),i.jsx(a.Typography,n.__assign({variant:"HM4",componentNode:"span"},{children:p}))]})]}),i.jsx(a.Typography,n.__assign({variant:"P2"},{children:_}))]}))}))},L={delay:3e3,height:40,animateInfinite:!0,duration:650},O={delay:2e3,animateInfinite:!0,duration:650,visibleCount:3,itemGap:12},F=function(e){var t,s,l,u,d=e.data,h=e.shouldHidePills,f=a.useTheme(),p=null!=d?d:{},g=p.heading,x=p.suggestions,m=void 0===x?[]:x,v=null!==(t=null==g?void 0:g.static)&&void 0!==t?t:[],y=null!==(s=null==g?void 0:g.ticker)&&void 0!==s?s:[],T=r.useMemo(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"}}}(f)},[f]),E=Math.min(3,m.length),j=32*(l=E)+12*Math.max(0,l-1)+6,A=r.useMemo(function(){return y.map(function(e,t){return i.jsx(a.Typography,n.__assign({variant:"HD3",styleConfig:{css:T.headingTickerText}},{children:e.text}),"".concat(e.text,"-").concat(t))})},[y,T.headingTickerText]),S=r.useMemo(function(){return m.map(function(e){var t=function(e){var t;return{data:{label:e.label},events:{onClick:[{type:o.ActionType.RAVEN_TRACKING,payload:{eventName:c.RAVEN_EVENT.U_UI_ACTION,eventData:(t={},t[c.RAVEN_ATTRIBUTE_KEY.ACTION_NAME]=c.RAVEN_ACTION.U_SUGGESTED_PROMPT_SELECTED,t[c.RAVEN_ATTRIBUTE_KEY.ACTION_TYPE]=c.RAVEN_ACTION_TYPE.CLICK,t[c.RAVEN_ATTRIBUTE_KEY.U_AGENT_PROMPT_SELECTED]=e.label,t)}},{type:o.ActionType.SEND_MESSAGE,payload:{message:e.label}}]}}}(e),n=t.data,r=t.events;return i.jsx(C.HorizontalChipItem,{data:n,events:r},e.id)})},[m]);return i.jsxs(a.Container,n.__assign({css:T.root},{children:[i.jsxs(a.Container,{children:[i.jsx(a.Container,n.__assign({css:T.greetingContainer},{children:i.jsx(a.Typography,n.__assign({variant:a.TypographyVariant.P1},{children:(u=(new Date).getHours(),u<12?"Good morning!":u<18?"Good afternoon!":"Good evening!")}))})),i.jsxs(a.Container,{children:[v.map(function(e,t){return i.jsx(a.Typography,n.__assign({variant:a.TypographyVariant.HD3},{children:e.text}),"".concat(e.text,"-").concat(t))}),i.jsx(_.AnimatedTicker,{elements:A,config:L})]})]}),!h&&i.jsx(_.AnimatedTicker,{elements:S,config:n.__assign(n.__assign({},O),{height:j})})]}))},D=function(e){return i.jsxs("svg",n.__assign({xmlns:"http://www.w3.org/2000/svg",width:"289",height:"160",viewBox:"0 0 289 160",fill:"none"},e,{children:[i.jsx("g",n.__assign({opacity:"0.7",filter:"url(#filter0_f_1771_46149)"},{children:i.jsx("ellipse",{cx:"94.5",cy:"123.5",rx:"114.5",ry:"43.5",fill:"#FFB8F9"})})),i.jsx("defs",{children:i.jsxs("filter",n.__assign({id:"filter0_f_1771_46149",x:"-100",y:"0",width:"389",height:"247",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[i.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),i.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),i.jsx("feGaussianBlur",{stdDeviation:"40",result:"effect1_foregroundBlur_1771_46149"})]}))})]}))},H=function(e){return i.jsxs("svg",n.__assign({xmlns:"http://www.w3.org/2000/svg",width:"299",height:"160",viewBox:"0 0 299 160",fill:"none"},e,{children:[i.jsx("g",n.__assign({opacity:"0.7",filter:"url(#filter0_f_1771_46148)"},{children:i.jsx("ellipse",{cx:"194.5",cy:"123.5",rx:"114.5",ry:"43.5",fill:"#FFB299"})})),i.jsx("defs",{children:i.jsxs("filter",n.__assign({id:"filter0_f_1771_46148",x:"0",y:"0",width:"389",height:"247",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[i.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),i.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),i.jsx("feGaussianBlur",{stdDeviation:"40",result:"effect1_foregroundBlur_1771_46148"})]}))})]}))},P=function(){return i.jsxs("svg",n.__assign({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[i.jsx("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"}),i.jsx("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"}),i.jsx("g",n.__assign({filter:"url(#filter0_f_3317_42725)"},{children:i.jsx("path",{d:"M17.959 2.33203C18.202 2.96389 19.1547 4.28593 21.0211 4.51923",stroke:"#FFE9E9",strokeWidth:"0.304968"})})),i.jsx("g",n.__assign({filter:"url(#filter1_f_3317_42725)"},{children:i.jsx("path",{d:"M15.625 5.25C16.2147 5.43516 17.4486 6.16098 17.6664 7.58301",stroke:"#E4CBFF",strokeWidth:"0.304968"})})),i.jsx("g",n.__assign({filter:"url(#filter2_f_3317_42725)"},{children:i.jsx("path",{d:"M17.5215 1.16797C17.2299 3.06354 16.0342 4.28837 14.1678 4.52167",stroke:"#FFD58C",strokeWidth:"0.152484"})})),i.jsx("g",n.__assign({filter:"url(#filter3_f_3317_42725)"},{children:i.jsx("path",{d:"M21.0195 4.8125C19.124 5.10413 17.8991 6.29979 17.6658 8.1662",stroke:"#BCB09C",strokeWidth:"0.152484"})})),i.jsxs("defs",{children:[i.jsxs("filter",n.__assign({id:"filter0_f_3317_42725",x:"17.2067",y:"1.66741",width:"4.44314",height:"3.61245",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB"},{children:[i.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),i.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),i.jsx("feGaussianBlur",{stdDeviation:"0.304968",result:"effect1_foregroundBlur_3317_42725"})]})),i.jsxs("filter",n.__assign({id:"filter1_f_3317_42725",x:"14.9694",y:"4.49553",width:"3.45767",height:"3.71987",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB"},{children:[i.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),i.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),i.jsx("feGaussianBlur",{stdDeviation:"0.304968",result:"effect1_foregroundBlur_3317_42725"})]})),i.jsxs("filter",n.__assign({id:"filter2_f_3317_42725",x:"13.9144",y:"0.912275",width:"3.92643",height:"3.92936",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB"},{children:[i.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),i.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),i.jsx("feGaussianBlur",{stdDeviation:"0.121987",result:"effect1_foregroundBlur_3317_42725"})]})),i.jsxs("filter",n.__assign({id:"filter3_f_3317_42725",x:"17.3462",y:"4.49235",width:"3.92887",height:"3.9274",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB"},{children:[i.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),i.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),i.jsx("feGaussianBlur",{stdDeviation:"0.121987",result:"effect1_foregroundBlur_3317_42725"})]}))]})]}))},G=r.forwardRef(function(e,t){var p,g=a.useTheme(),_=e.chatId,C=e.chatData,x=e.pageType,m=e.isInitialLoading,y=e.isReplyLoading,T=e.replyLoaderText,E=e.isTop,j=e.showNativeActions,A=e.isContextSummaryLoading,S=e.contextSummaryError,I=e.contextSummary,k=e.capability,w=e.sendMessage,L=e.onPreviousChatClick,O=e.onBackButtonClick,G=e.onClose,U=e.handleMediaPicked,V=e.scrollToBottomOnLoad,M=e.onStop,z=k===s.ChatCapability.SEARCH,Y=r.useMemo(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]}}}(g,z)},[g,z]),K=z&&y,q=r.useState(""),W=q[0],Z=q[1],X=r.useState(!1),Q=X[0],J=X[1],$=r.useState(!1),ee=$[0],te=$[1],ne=r.useRef(null),ie=r.useRef([]),re=r.useRef(null),ae=r.useRef(null),se=r.useRef(null),oe=r.useRef(!1),le=r.useRef(!1),ce=r.useRef(null),ue=s.usePresentation(),de=ue.hasPresented,he=ue.markPresented,fe=null!=C?C:{},pe=fe.messages,ge=void 0===pe?[]:pe,_e=fe.pageData,Ce=fe.status,xe=fe.landingContent,me=f.isEmpty(ge)&&!m&&!f.isEmpty(xe),ve=y&&E,ye=r.useRef(null),Te=r.useState(!1),Ee=Te[0],je=Te[1],Ae=r.useRef(null!==(p=null==ge?void 0:ge.length)&&void 0!==p?p:null),Se=A||!f.isEmpty(I)||S;r.useEffect(function(){ye.current=null,je(!1)},[_]),r.useEffect(function(){Se&&(null!==ye.current?ge.length>ye.current&&je(!0):ye.current=ge.length)},[Se,ge.length]);var Ie=x===s.ChatPageType.CHAT&&Se&&!Ee,be=_e||{},Re=be.title,ke=void 0===Re?b:Re,Be=be.newChatEnabled,we=be.footerSlots,Ne=void 0===we?[]:we,Le=r.useState(!1),Oe=Le[0],Fe=Le[1],De=r.useState(!1),He=De[0],Pe=De[1],Ge=r.useMemo(function(){return x===s.ChatPageType.CHAT?z?"AI Search":b:ke},[x,ke]),Ue=s.useAppDispatch().dispatch,Ve=h.useNativeActions(),Me=Ve.handleGalleryClick,ze=Ve.handleCameraClick,Ye=Ve.handleUploadChange;r.useEffect(function(){var e;te(null!=j&&j),j&&(null===(e=ne.current)||void 0===e||e.focus())},[j]),r.useEffect(function(){Fe(!m||!E)},[m,E]);var Ke=function(e){Z(e)},qe=function(){var e=ee;Ue({type:o.ActionType.SHOW_NATIVE_ACTIONS,payload:{isNativeActionsEnabled:!e}}),te(function(e){return!e})},We=function(){w(W),Z(""),setTimeout(function(){var e;null===(e=ne.current)||void 0===e||e.blur()},100)},Ze=function(){Me(U)},Xe=function(){ze(U)},Qe=function(e){Ye(e,U)},Je="iPhoneApp"===f.checkDeviceType(),$e=[{label:"Gallery",onClick:Ze,onButtonClick:Ze,onChange:Qe,icon:"https://rukmini-ct.flixcart.com/f_auto,q_auto/offermgmt-prod/chatbot/gallery.png",inputType:"gallery",isMultiple:!0,useNativePicker:Je},{label:"Camera",onClick:Xe,onButtonClick:Xe,onChange:Qe,icon:"https://rukmini-ct.flixcart.com/f_auto,q_auto/offermgmt-prod/chatbot/camera-3d.png",inputType:"camera",useNativePicker:Je},{label:"Files",onChange:Qe,icon:"https://rukmini-ct.flixcart.com/f_auto,q_auto/offermgmt-prod/chatbot/pdf-3d.png",inputType:"file"}],et=function(){var e;me?(null===(e=ne.current)||void 0===e||e.focus(),J(!0)):Ue({type:o.ActionType.CREATE_NEW_CHAT})},tt=function(e){void 0===e&&(e="auto");var t=null==re?void 0:re.current;t&&t.scrollTo({top:t.scrollHeight,behavior:e})};r.useImperativeHandle(t,function(){return{scrollToBottom:tt}},[]);var nt=r.useCallback(function(){var e,t,n,i=re.current,r=ae.current;if(i&&r){var a=-1;if(ge)for(var s=ge.length-1;s>=0;s--)if(ge[s].type===o.WidgetType.USER_MESSAGE){a=s;break}if(-1!==a){var l=ie.current[a];if(l){var c=0;for(s=a+1;s<(null!==(e=null==ge?void 0:ge.length)&&void 0!==e?e:0);s++){var u=ie.current[s];u&&(c+=u.offsetHeight)}z&&(c+=(null!==(n=null===(t=se.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"}},[ge,Ie]);r.useEffect(function(){if(x===s.ChatPageType.PREVIOUS_CHAT)return oe.current=!0,void tt();if(V){if(m)return;if(null===ce.current&&(ce.current=ge.length),ge.length<=ce.current)return oe.current=!0,void tt()}nt();var e=-1;if(ge)for(var t=ge.length-1;t>=0;t--)if(ge[t].type===o.WidgetType.USER_MESSAGE){e=t;break}if(-1!==e){var n=ie.current[e];if(n){le.current=!0,n.scrollIntoView({behavior:"smooth",block:"start"});var i=re.current,r=function(){le.current=!1};null==i||i.addEventListener("scrollend",r,{once:!0}),setTimeout(r,500)}}},[ge,x,nt,V,m]),r.useEffect(function(){var e=re.current;if(e){var t=new ResizeObserver(function(){var e=V&&(null===ce.current||ge.length<=ce.current);if(x===s.ChatPageType.PREVIOUS_CHAT||e)oe.current&&tt();else if(le.current||nt(),z&&(m||Ae.current===(null==ge?void 0:ge.length))){var t=ae.current;t&&(t.style.height="0px"),tt()}});return t.observe(e),ie.current.forEach(function(e){e&&t.observe(e)}),se.current&&t.observe(se.current),function(){return t.disconnect()}}},[ge,nt,x,V,Ie,z]),r.useEffect(function(){var e=re.current;if(e){var t=function(){Pe(e.scrollTop>0);var t=e.scrollHeight-e.scrollTop-e.clientHeight;oe.current=t<4};return t(),e.addEventListener("scroll",t,{passive:!0}),function(){return e.removeEventListener("scroll",t)}}},[]);var it=r.useMemo(function(){return x===s.ChatPageType.CHAT&&Ce!==s.ChatStatus.CLOSED||Ce===s.ChatStatus.ON_GOING},[x,Ce]),rt=r.useMemo(function(){return Ce===s.ChatStatus.CLOSED&&x===s.ChatPageType.CHAT},[x,Ce]),at=r.useMemo(function(){return k===s.ChatCapability.SEARCH||Be&&x!==s.ChatPageType.CHAT},[k,Be,x]),st=function(){J(!1)},ot=function(){return it?i.jsxs(a.Container,n.__assign({css:Y.inputContainer},{children:[ve&&k===s.ChatCapability.SEARCH&&i.jsx(B,{capability:k,loaderText:T}),i.jsxs(a.Box,n.__assign({boxSize:"tiny"},{children:[i.jsx(a.AiChatInput,{rows:4,value:W,onChange:Ke,placeholder:"Ask a question",onPrefixClick:qe,showKeyboardIcon:ee,onSubmit:We,onBlur:st,disableAction:y||m,prefix:z?i.jsx(P,{}):void 0,suffix:W.length>0||K?void 0:i.jsx(i.Fragment,{}),isStreaming:K,onStop:M,ref:ne}),ee&&i.jsx(v,{actions:$e})]}))]})):null};return i.jsxs(i.Fragment,{children:[i.jsx(R,{showCross:x===s.ChatPageType.CHAT,onCrossClick:function(){null==G||G()},showPreviousChat:x===s.ChatPageType.CHAT,onPreviousChatClick:function(){var e;Ue({type:o.ActionType.RAVEN_TRACKING,payload:{eventName:c.RAVEN_EVENT.U_UI_ACTION,eventData:(e={},e[c.RAVEN_ATTRIBUTE_KEY.ACTION_NAME]=c.RAVEN_ACTION.U_AGENT_HISTORY_BUTTON,e[c.RAVEN_ATTRIBUTE_KEY.ACTION_TYPE]=c.RAVEN_ACTION_TYPE.CLICK,e)}}),null==L||L()},showBackButton:x===s.ChatPageType.PREVIOUS_CHAT,onBackButtonClick:function(){null==O||O()},showNewChat:at,onNewChatClick:et,showIcon:x===s.ChatPageType.CHAT,title:Ge,isScrolled:He}),m&&E&&i.jsx(a.Box,n.__assign({boxSize:"tiny",css:n.__assign({},Y.loadingContainer)},{children:i.jsx(a.Spinner,{variant:"thin",height:"54px",width:"54px",borderColor:g.color.border.link,trackColor:g.color.border.disabledDark})})),i.jsx(a.Box,n.__assign({boxSize:"tiny",css:Y.chatContainer},{children:i.jsxs(a.Box,n.__assign({css:n.__assign(n.__assign({},Y.animatedContainer),x===s.ChatPageType.CHAT&&!V&&!z&&{transform:Oe?"translateY(0)":"translateY(25%)",opacity:Oe?1:0}),boxSize:"tiny",ref:re},{children:[!m&&(null==ge?void 0:ge.map(function(e,t){var r,s=e.id,c=e.type,d=e.chunks,h=e.metaData,f=void 0===h?{}:h,p=((r={})[o.WidgetType.USER_MESSAGE]=Y.userMessageContainer,r),g=n.__assign(n.__assign({},f),{messageId:s,chatId:_,messageIndex:t,totalMessages:null==ge?void 0:ge.length,pageType:x}),C=!de(_,s);return 0===d.length?null:i.jsx(a.Container,n.__assign({css:n.__assign({},p[c]),ref:function(e){ie.current[t]=e}},{children:d.length>0&&i.jsx(u.SequentialReveal,n.__assign({animate:C,onComplete:function(){return he(_,s)}},{children:d.map(function(e,t){var r,a=n.__assign(n.__assign(n.__assign({},null!==(r=e.metaData)&&void 0!==r?r:{}),g),{animate:C});return i.jsx(l.WidgetGenerator,n.__assign({},e,{metaData:a}),t)})}))}),"".concat(_,"_").concat(s))})),ve&&k===s.ChatCapability.CONVERSATIONAL&&i.jsx(B,{capability:k,loaderText:T}),x===s.ChatPageType.CHAT&&i.jsx(a.Container,{ref:ae,css:{flexShrink:0}}),f.isEmpty(ge)&&!m&&xe&&i.jsx(F,{data:xe,shouldHidePills:Ie||Q||W.length>=3}),Ie&&i.jsx(a.Container,n.__assign({ref:se,css:{marginTop:"auto",paddingTop:"12px"}},{children:i.jsx(N,{contextSummary:I,isContextSummaryLoading:A,contextSummaryError:S})}))]}))})),z?i.jsx(d.BackgroundGradient,n.__assign({variant:K?d.BackgroundGradientVariant.PROCESSING:d.BackgroundGradientVariant.DEFAULT,styleConfig:{root:{css:Y.bgGradient}}},{children:ot()})):i.jsxs(i.Fragment,{children:[i.jsx(D,{style:Y.bgGradientLeft}),i.jsx(H,{style:Y.bgGradientRight})]}),!z&&ot(),rt&&i.jsxs(a.Container,n.__assign({css:Y.newChatContainer},{children:[i.jsx(a.Typography,n.__assign({variant:"P3",styleConfig:{css:Y.chatClosedMessage}},{children:"This query has been closed, If you have a query regarding this trip, you can start a new chat."})),i.jsx(a.Button,n.__assign({variant:"contained",color:"primary",isFullWidth:!0,onClick:et},{children:"Start New Chat"}))]})),x===s.ChatPageType.PREVIOUS_CHAT&&i.jsx(a.Container,{children:null==Ne?void 0:Ne.map(function(e,t){var r=e.type,a=n.__rest(e,["type"]),s="".concat(r,"_").concat(t);return i.jsx(l.WidgetGenerator,n.__assign({type:r},a),s)})})]})}),U=r.memo(G),V=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"}}},M=function(){var e=a.useTheme(),t=r.useMemo(function(){return V(e)},[e]);return i.jsx(a.Container,n.__assign({css:t.shimmerContainer},{children:i.jsxs(a.Box,n.__assign({boxSize:"tiny"},{children:[i.jsx(a.Shimmer,{height:e.size[5],width:"120px"}),Array.from({length:3}).map(function(r,s){return i.jsxs(a.Box,n.__assign({boxSize:"nano",css:t.shimmerCard},{children:[i.jsx(a.Shimmer,{height:e.size[4],width:"150px"}),i.jsx(a.Shimmer,{height:e.size[4],width:"200px"})]}),s)})]}))}))};!function(e){e.ERROR="error",e.EMPTY="empty"}(e||(e={}));var z,Y=((t={})[e.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"},t[e.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"},t),K=function(t){var l=t.variant,c=void 0===l?e.ERROR:l,u=a.useTheme(),d=r.useMemo(function(){return V(u)},[u]),h=s.useAppDispatch().dispatch;return i.jsx(a.Container,n.__assign({css:d.bodyContainer},{children:i.jsxs(a.Box,n.__assign({boxSize:"medium",css:d.errorContainer},{children:[i.jsx("img",{src:Y[c].icon,alt:c,height:100,width:100}),i.jsxs(a.Box,n.__assign({boxSize:"small",css:d.labelContainer},{children:[i.jsx(a.Typography,n.__assign({variant:"HM3",styleConfig:{css:d.errorText}},{children:Y[c].text})),i.jsx(a.Button,n.__assign({variant:"outline",onClick:function(){c===e.ERROR?h({type:o.ActionType.REFETCH_PREVIOUS_CHAT}):h({type:o.ActionType.CREATE_NEW_CHAT})},css:d.errorButton},{children:Y[c].buttonLabel}))]}))]}))}))},q=r.memo(function(t){var c=t.chats,u=t.loading,d=void 0!==u&&u,h=t.onBack,f=t.previousChatError,p=null!=c?c:{},g=p.previousChats,_=void 0===g?[]:g,C=p.pageData,x=null!=C?C:{},m=x.newChatEnabled,v=x.chatCount,y=a.useTheme(),T=r.useMemo(function(){return V(y)},[y]),E=s.useAppDispatch().dispatch,j=r.useRef(null),A=r.useState(!1),S=A[0],I=A[1];r.useEffect(function(){var e=j.current;if(e){var t=function(){I(e.scrollTop>0)};return t(),e.addEventListener("scroll",t,{passive:!0}),function(){return e.removeEventListener("scroll",t)}}},[d,_.length]);return i.jsxs(a.Container,n.__assign({css:T.root},{children:[i.jsx(R,{showCross:!1,showPreviousChat:!1,showBackButton:!0,onBackButtonClick:h,title:"Past Conversations",showNewChat:m,onNewChatClick:function(){E({type:o.ActionType.CREATE_NEW_CHAT})},showIcon:!1,isScrolled:S}),d&&i.jsx(M,{}),!d&&(f?i.jsx(K,{variant:e.ERROR}):0===v?i.jsx(K,{variant:e.EMPTY}):null),!d&&_.length>0&&!!v&&v>0&&i.jsx(a.Box,n.__assign({boxSize:"medium",css:T.listContainer,ref:j},{children:_.map(function(e,t){var n=e.type,r=e.data,a="".concat(n,"_").concat(t);return i.jsx(l.WidgetGenerator,{type:n,data:r},a)})})),i.jsx(D,{style:T.bgGradientLeft}),i.jsx(H,{style:T.bgGradientRight})]}))}),W=function(e){var t=e.onClose,l=e.onBack,c=e.retry,u=a.useTheme(),d=r.useMemo(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"}}},[u]),h=s.useAppDispatch().dispatch,f=(null==c?void 0:c.kind)===s.ChatErrorKind.PREVIOUS;return i.jsxs(i.Fragment,{children:[i.jsx(R,{showBackButton:f,onBackButtonClick:l,showCross:!f,onCrossClick:t,showIcon:!1,title:""}),i.jsx(a.Container,n.__assign({css:d.bodyContainer},{children:i.jsxs(a.Box,n.__assign({boxSize:"medium",css:d.errorContainer},{children:[i.jsx("img",{src:"https://rukmini-ct.flixcart.com/f_auto,q_auto/offermgmt-prod/chatbot/3d-mug.png",alt:"error",height:100,width:100}),i.jsxs(a.Box,n.__assign({boxSize:"small",css:d.labelContainer},{children:[i.jsx(a.Typography,n.__assign({variant:"HM3",styleConfig:{css:d.errorText}},{children:"Oops, we couldn't load the chat"})),i.jsx(a.Button,n.__assign({variant:"outline",onClick:function(){h({type:o.ActionType.RETRY_CHAT_ERROR})},css:d.errorButton},{children:"Try again"}))]}))]}))})),i.jsx(D,{style:d.bgGradientLeft}),i.jsx(H,{style:d.bgGradientRight})]})},Z=function(e){var t=e.loading,s=void 0!==t&&t,o=a.useTheme(),l=r.useMemo(function(){return k(o)},[o]);return s?i.jsxs(a.Container,n.__assign({css:l.initLoader},{children:[i.jsx(a.DottedLoader,{}),i.jsx(a.Typography,n.__assign({variant:"B3"},{children:"Getting ready"}))]})):null},X=function(){return i.jsx("svg",n.__assign({xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},{children:i.jsx("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"})}))},Q=function(e){var t=e.onPrefixClick,l=e.onSuffixClick,u=e.sendMessage,d=e.isReplyLoading,h=void 0!==d&&d,f=e.capability,p=void 0===f?s.ChatCapability.CONVERSATIONAL:f,g=e.onStop,_=p===s.ChatCapability.SEARCH,C=_&&h,x=r.useState(""),m=x[0],v=x[1],y=r.useState(!1),E=y[0],j=y[1],S=r.useRef(null),I=a.useTheme(),b=r.useMemo(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}}}(I)},[I]),R=s.useAppDispatch().dispatch;r.useEffect(function(){var e;R({type:o.ActionType.RAVEN_TRACKING,payload:{eventName:c.RAVEN_EVENT.U_ASK_QUESTION_IMPRESSION,eventData:(e={},e[c.RAVEN_ATTRIBUTE_KEY.ACTION_TYPE]=c.RAVEN_ACTION_TYPE.IMPRESSION,e)}})},[]);var k=r.useMemo(function(){return n.__assign({},E?b.headerActionCollapsed:{})},[E,h,b]),w=r.useMemo(function(){return n.__assign({},E?b.headerActionCollapsed:{})},[E,h,b]);return i.jsxs(a.ThemeProvider,{children:[h&&i.jsx(B,{capability:s.ChatCapability.SEARCH}),i.jsxs(a.Box,n.__assign({boxSize:"micro",horizontal:!0,css:b.root},{children:[!C&&i.jsx(T,n.__assign({onClick:t,styleConfig:{root:{css:n.__assign(n.__assign({},b.headerAction),k)}}},{children:i.jsx(X,{})})),i.jsx(a.Container,n.__assign({css:b.inputWrapper},{children:i.jsx(a.AiChatInput,{ref:S,value:m,onChange:function(e){v(e)},onFocus:function(){var e;j(!0),R({type:o.ActionType.RAVEN_TRACKING,payload:{eventName:c.RAVEN_EVENT.U_UI_ACTION,eventData:(e={},e[c.RAVEN_ATTRIBUTE_KEY.ACTION_NAME]=c.RAVEN_ACTION.U_ASK_QUESTION_BUTTON,e[c.RAVEN_ATTRIBUTE_KEY.ACTION_TYPE]=c.RAVEN_ACTION_TYPE.CLICK,e)}})},onBlur:function(){j(!1)},onSubmit:function(){var e=m.trim();e&&!h&&(null==u||u(e),v(""),setTimeout(function(){var e;null===(e=S.current)||void 0===e||e.blur()},100))},disableAction:h,prefix:_?i.jsx(P,{}):void 0,suffix:m.length>0||C?void 0:i.jsx(i.Fragment,{}),isStreaming:C,onStop:g,placeholder:"Ask a question"})})),!C&&i.jsx(T,n.__assign({onClick:function(){return l(m)},styleConfig:{root:{css:n.__assign(n.__assign({},b.headerAction),w)}}},{children:i.jsx(A,{})}))]}))]})},J=r.forwardRef(function(e,t){var o=e.onPrefixClick,l=e.onSuffixClick,c=e.sendMessage,u=e.isReplyLoading,h=e.visible,f=void 0===h||h,p=e.isInitialLoading,g=void 0!==p&&p,_=e.capability,C=e.onStop,x=a.useTheme(),m=r.useMemo(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}}},[x]),v=_===s.ChatCapability.SEARCH&&u;return i.jsx(a.ThemeProvider,{children:i.jsx(a.Container,n.__assign({css:m.root},{children:i.jsx(a.Transition,n.__assign({type:"fade",timeout:400,appear:!0,mountOnEnter:!0,unmountOnExit:!0,in:f},{children:i.jsxs(a.Container,{children:[i.jsx(d.BackgroundGradient,{variant:v?d.BackgroundGradientVariant.PROCESSING:d.BackgroundGradientVariant.DEFAULT,styleConfig:{root:{css:m.backgroundGradient}}}),i.jsx(a.Transition,n.__assign({type:"slide",slideDirection:"up",timeout:400,appear:!0,mountOnEnter:!0,unmountOnExit:!0,in:f},{children:i.jsx(a.Container,n.__assign({css:m.content,ref:t},{children:g?i.jsx(Z,{loading:g}):i.jsx(Q,{onPrefixClick:o,onSuffixClick:l,sendMessage:c,isReplyLoading:u,capability:_,onStop:C})}))}))]})}))}))})}),$=function(e){var t=a.useTheme(),n=e.visible,s=e.message,o=e.type,l=e.onDismiss,c=e.duration,u=void 0===c?3e3:c,d=r.useMemo(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(r.useEffect(function(){if(n){var e=setTimeout(function(){return null==l?void 0:l()},u+500);return function(){return clearTimeout(e)}}},[n,u,l]),!n)return null;var h=o?i.jsx(x.Icon,{icon:o}):null;return i.jsx(a.Toast,{show:!0,text:s,isAutoClose:!0,prefixComponent:h,closeTimeout:u,styleConfig:{toastContainer:{css:d.toastContainer},prefixContainer:{css:d.prefixContainer}}})};exports.ChatSurfaceState=void 0,(z=exports.ChatSurfaceState||(exports.ChatSurfaceState={})).FLOATING="FLOATING",z.HYBRID="HYBRID",z.EXPANDED="EXPANDED";var ee,te,ne=function(e){void 0===e&&(e=exports.ChatSurfaceState.FLOATING);var t=this;this.listeners=new Set,this.handlers={},this.getSnapshot=function(){return t.snapshot},this.subscribe=function(e){return t.listeners.add(e),function(){t.listeners.delete(e)}},this.setSnapshot=function(e){var i=n.__assign(n.__assign({},t.snapshot),e);i.state===t.snapshot.state&&i.isReplyLoading===t.snapshot.isReplyLoading||(t.snapshot=i,t.listeners.forEach(function(e){return e()}))},this.showFloating=function(){return t.setSnapshot({state:exports.ChatSurfaceState.FLOATING})},this.showHybrid=function(){return t.setSnapshot({state:exports.ChatSurfaceState.HYBRID})},this.hideHybrid=function(){return t.setSnapshot({state:exports.ChatSurfaceState.FLOATING})},this.expand=function(){return t.setSnapshot({state:exports.ChatSurfaceState.EXPANDED})},this.collapse=function(){return t.setSnapshot({state:exports.ChatSurfaceState.HYBRID})},this.setState=function(e){return t.setSnapshot({state:e})},this.setReplyLoading=function(e){return t.setSnapshot({isReplyLoading:e})},this.setHandlers=function(e){t.handlers=e},this.clearHandlers=function(){t.handlers={}},this.openSearchFromFloatingPill=function(){var e,n;t.setSnapshot({state:exports.ChatSurfaceState.HYBRID}),null===(n=null===(e=t.handlers)||void 0===e?void 0:e.onFloatingPillClick)||void 0===n||n.call(e)},this.snapshot={state:e,isReplyLoading:!1}},ie=null,re=function(){return ie||(ie=new ne),ie},ae=r.createContext(null),se=function(){var e=r.useContext(ae);return null!=e?e:re()},oe=function(e){var t=se(),n=null!=e?e:t;return r.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getSnapshot)},le=function(e,t){var n=oe(e).state;r.useEffect(function(){if(n===exports.ChatSurfaceState.HYBRID&&"undefined"!=typeof window){var i=Date.now(),r=function(){return Date.now()-i<400},a=function(e){var n;return!(!e||!(null===(n=t.current)||void 0===n?void 0:n.contains(e)))},s=!1,o=function(e){s=!a(e.target)&&a(document.activeElement)},l=function(t){a(t.target)||(t.stopPropagation(),t.preventDefault(),r()||(s?s=!1:e.hideHybrid()))},c=function(e){r()&&(a(e.target)||(e.stopPropagation(),e.preventDefault()))},u={capture:!0};return document.addEventListener("pointerdown",o,u),document.addEventListener("mousedown",c,u),document.addEventListener("mouseup",c,u),document.addEventListener("click",l,u),function(){document.removeEventListener("pointerdown",o,u),document.removeEventListener("mousedown",c,u),document.removeEventListener("mouseup",c,u),document.removeEventListener("click",l,u)}}},[n,e,t])};exports.ChatUIStatusValue=void 0,(ee=exports.ChatUIStatusValue||(exports.ChatUIStatusValue={})).ONGOING="ongoing",ee.IDLE="idle",exports.ChatView=void 0,(te=exports.ChatView||(exports.ChatView={})).CHAT="CHAT",te.PREVIOUS_CHATS="PREVIOUS_CHATS";exports.ChatSurfaceBridge=ne,exports.ChatSurfaceProvider=function(e){var t=e.children,a=e.bridge,s=e.initialState,o=r.useRef();return o.current||(o.current=null!=a?a:new ne(s)),i.jsx(ae.Provider,n.__assign({value:o.current},{children:t}))},exports.ChatUI=function(e){var t,u=e.open,d=void 0===u||u,h=e.onClose,f=e.network,p=e.protocol,g=e.triggerTracking,_=e.baseTrackingData,C=e.onChatStateChange,x=e.plugins,m=e.capability,v=void 0===m?s.ChatCapability.CONVERSATIONAL:m,y=a.useTheme(),T=r.useMemo(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}}},[y]),E=r.useRef(0),j=r.useRef(C);j.current=C;var A=v===s.ChatCapability.SEARCH,S=se(),I=oe(S),b=r.useRef(null),R=r.useRef([]),k=r.useRef("800px"),B=r.useRef("800px"),w=r.useState(d),N=w[0],L=w[1];r.useEffect(function(){k.current="".concat(window.innerHeight,"px");var e=.94*window.innerHeight;B.current="".concat(e,"px")},[]),r.useEffect(function(){L(d)},[d]);var O=A?I.state===exports.ChatSurfaceState.EXPANDED:N;r.useEffect(function(){A&&d&&S.expand()},[A,d,S]),le(S,b);var F=r.useCallback(function(){A?S.expand():L(!0)},[A,S]),D=r.useCallback(function(){A?S.collapse():(L(!1),null==h||h())},[A,S,h]),H=s.useChatController({network:f,triggerTracking:g,baseTrackingData:_,protocol:p,resolveMerge:l.mergeFor,plugins:x,capability:v,open:O,onOpenChatbot:F,onCloseChatbot:D,chatWindowRefs:R}),P=H.currentChatId,G=H.messages,V=H.chatStack,M=H.previousChats,z=H.previousChatLoading,Y=H.previousChatError,K=H.isInitialLoading,Z=H.isInitialError,X=H.retryInitialChat,Q=H.toast,ee=H.hideToast,te=H.isNewChat,ne=H.isReplyLoading,ie=H.replyLoaderText,re=H.screenRefs,ae=H.showNativeActions,ce=H.chatService,ue=H.isContextSummaryLoading,de=H.contextSummary,he=H.contextSummaryError,fe=H.handleMediaPicked,pe=H.dispatch,ge=H.dispatchAll,_e=H.getPreviousChats,Ce=H.pushToChatStack,xe=H.sendMessage,me=H.stop,ve=H.hasPresented,ye=H.markPresented,Te=H.handleBackButtonClick,Ee=r.useRef(me);Ee.current=me;var je=r.useCallback(function(){var e;A&&(null===(e=Ee.current)||void 0===e||e.call(Ee))},[A]),Ae=r.useRef(I.state);r.useEffect(function(){var e=Ae.current,t=I.state;Ae.current=t,e===exports.ChatSurfaceState.HYBRID&&t===exports.ChatSurfaceState.FLOATING&&je()},[I.state,je]),r.useEffect(function(){A&&Z&&(I.state===exports.ChatSurfaceState.HYBRID&&pe({type:o.ActionType.SHOW_TOAST,payload:{message:"Something went wrong. Please try again."}}),S.showFloating())},[A,Z,S]);var Se=r.useRef(I.state);r.useEffect(function(){var e=Se.current,t=I.state;Se.current=t,A&&Z&&e===exports.ChatSurfaceState.FLOATING&&t===exports.ChatSurfaceState.HYBRID&&X()},[A,I.state,Z,X]);var Ie=r.useRef(!1),be=r.useCallback(function(){var e;pe({type:o.ActionType.RAVEN_TRACKING,payload:{eventName:c.RAVEN_EVENT.U_UI_ACTION,eventData:(e={},e[c.RAVEN_ATTRIBUTE_KEY.ACTION_NAME]=c.RAVEN_ACTION.U_OPEN_SEARCH,e[c.RAVEN_ATTRIBUTE_KEY.ACTION_TYPE]=c.RAVEN_ACTION_TYPE.CLICK,e)}})},[pe]);r.useEffect(function(){if(A)return S.setHandlers({onFloatingPillClick:be}),function(){return S.clearHandlers()}},[A,S,be]),r.useEffect(function(){A&&S.setReplyLoading(ne)},[A,ne,S]),r.useEffect(function(){if(O)return function(){pe({type:o.ActionType.SHOW_NATIVE_ACTIONS,payload:{isNativeActionsEnabled:!1}})}},[O]),r.useEffect(function(){O&&(Ie.current=!0)},[O]),r.useEffect(function(){var e;O&&!K&&P&&Ie.current&&(Ie.current=!1,pe({type:o.ActionType.RAVEN_TRACKING,payload:{eventName:c.RAVEN_EVENT.U_AI_CHAT_PAGELOAD,eventData:(e={},e[c.RAVEN_ATTRIBUTE_KEY.CHAT_HISTORY_FLAG]=te?"new":"existing",e[c.RAVEN_ATTRIBUTE_KEY.CHAT_SESSION_ID]=P,e)}}))},[O,K,P,te,pe]),r.useEffect(function(){var e,t;if(A&&I.state!==exports.ChatSurfaceState.EXPANDED&&P){var n=null!==(t=null===(e=G[P])||void 0===e?void 0:e.messages)&&void 0!==t?t:[];n.forEach(function(e,t){ne&&t===n.length-1||ye(P,e.id)})}},[A,I.state,G,P,ne,ye]);var Re=r.useMemo(function(){var e,t,n=P?G[P]:void 0;return n&&n.status!==s.ChatStatus.CLOSED&&(null!==(t=null===(e=n.messages)||void 0===e?void 0:e.length)&&void 0!==t?t:0)>1?exports.ChatUIStatusValue.ONGOING:exports.ChatUIStatusValue.IDLE},[G,P]);r.useEffect(function(){var e;null===(e=j.current)||void 0===e||e.call(j,{status:Re})},[Re]),r.useLayoutEffect(function(){var e=E.current,t=V.length;if(E.current=t,!(t<=e||t<=1)){var n=re.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})}}},[V.length]);var ke=function(){var e;pe({type:o.ActionType.RAVEN_TRACKING,payload:{eventName:c.RAVEN_EVENT.U_AI_CHAT_BOT_CLOSE,eventData:(e={},e[c.RAVEN_ATTRIBUTE_KEY.CHAT_SESSION_ID]=P,e[c.RAVEN_ATTRIBUTE_KEY.ACTION_NAME]=c.RAVEN_ATTRIBUTE_KEY.ASK_AI_CLOSE_CLICK,e)}}),je(),A?S.collapse():(L(!1),null==h||h())},Be=function(){return n.__awaiter(void 0,void 0,void 0,function(){return n.__generator(this,function(e){return je(),Ce({type:s.ChatPageType.PREVIOUS_CHAT_LISTING}),_e(),[2]})})},we=function(e,t,n){var r=e.type,a=e.id,o=e.retry,l=e.scrollToBottomOnLoad;switch(r){case s.ChatPageType.PREVIOUS_CHAT_LISTING:return i.jsx(q,{chats:M,loading:z,onBack:Te,previousChatError:Y});case s.ChatPageType.CHAT_ERROR:return i.jsx(W,{onClose:ke,onBack:Te,retry:o});case s.ChatPageType.PREVIOUS_CHAT:case s.ChatPageType.CHAT:default:return i.jsx(U,{ref:function(e){R.current[n]=e},chatId:a||"",chatData:G[a||""],sendMessage:xe,onPreviousChatClick:Be,pageType:r,onBackButtonClick:Te,isInitialLoading:K,isReplyLoading:ne,replyLoaderText:ie,isTop:t,onClose:ke,handleMediaPicked:fe,showNativeActions:ae,scrollToBottomOnLoad:l,isContextSummaryLoading:ue,contextSummary:de,contextSummaryError:he,capability:v,onStop:je})}},Ne=r.useMemo(function(){var e,t;return(P&&null!==(t=null===(e=G[P])||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===o.WidgetType.ACTION_HANDLER})})},[G,P]);return i.jsx(s.ChatNetworkProvider,n.__assign({chatService:ce},{children:i.jsxs(s.ChatDispatchProvider,n.__assign({dispatch:pe,dispatchAll:ge,hasPresented:ve,markPresented:ye},{children:[A&&i.jsx($,{visible:!!Q,message:null!==(t=null==Q?void 0:Q.message)&&void 0!==t?t:"",duration:null==Q?void 0:Q.duration,onDismiss:ee},null==Q?void 0:Q.id),A&&I.state!==exports.ChatSurfaceState.EXPANDED&&i.jsxs(i.Fragment,{children:[Ne.map(function(e){var t,r=e.chunk,a=e.key,s=e.messageId,o=n.__assign(n.__assign({},null!==(t=r.metaData)&&void 0!==t?t:{}),{messageId:s,chatId:P,presentOnDispatch:!0});return i.jsx(l.WidgetGenerator,n.__assign({},r,{metaData:o}),a)}),i.jsx(J,{ref:b,visible:I.state===exports.ChatSurfaceState.HYBRID,onPrefixClick:function(){var e;pe({type:o.ActionType.RAVEN_TRACKING,payload:{eventName:c.RAVEN_EVENT.U_UI_ACTION,eventData:(e={},e[c.RAVEN_ATTRIBUTE_KEY.ACTION_NAME]=c.RAVEN_ACTION.U_EXPAND_CHAT,e[c.RAVEN_ATTRIBUTE_KEY.ACTION_TYPE]=c.RAVEN_ACTION_TYPE.CLICK,e)}}),S.expand()},onSuffixClick:function(e){var t;pe({type:o.ActionType.RAVEN_TRACKING,payload:{eventName:c.RAVEN_EVENT.U_UI_ACTION,eventData:(t={},t[c.RAVEN_ATTRIBUTE_KEY.ACTION_NAME]=c.RAVEN_ACTION.U_CLOSE_CHAT,t[c.RAVEN_ATTRIBUTE_KEY.U_FHP_ASKQUESTION]=null!=e?e:"",t[c.RAVEN_ATTRIBUTE_KEY.ACTION_TYPE]=c.RAVEN_ACTION_TYPE.CLICK,t)}}),S.hideHybrid()},sendMessage:xe,isReplyLoading:ne,isInitialLoading:K,capability:v,onStop:je})]}),i.jsx(a.ThemeProvider,{children:i.jsx(a.BottomSheet,n.__assign({isOpen:O,onClose:ke,radius:"md",styleConfig:{bottomSheetContainer:{css:n.__assign(n.__assign({},T.sheetContainer.css),{height:B.current,maxHeight:"".concat(k.current," !important")})}}},{children:i.jsxs(a.Container,n.__assign({css:T.stackContainer},{children:[0===V.length&&K&&i.jsx(a.Container,n.__assign({css:T.loadingContainer},{children:i.jsx(a.Spinner,{variant:"thin",height:"54px",width:"54px",borderColor:y.color.border.link,trackColor:y.color.border.disabledDark})})),V.map(function(e,t){var r,s=t===V.length-1;return i.jsx(a.Container,n.__assign({ref:function(e){re.current[t]=e},css:n.__assign(n.__assign({},T.screenWrapper),{visibility:s?"visible":"hidden"})},{children:we(e,s,t)}),"".concat(e.type,"_").concat(null!==(r=e.id)&&void 0!==r?r:t))})]}))}))})]}))}))},exports.HybridChat=Q,exports.HybridChatWindow=J,exports.getChatSurfaceBridge=re,exports.useChatSurface=oe,exports.useChatSurfaceBridge=se,exports.useHideOnBackgroundInteraction=le;
1
+ "use strict";var e,t,n=require("tslib"),i=require("react/jsx-runtime"),r=require("react"),a=require("@cleartrip/ct-design-components"),s=require("@cleartrip/talos-use-chat-controller"),o=require("@cleartrip/talos-widget-types"),l=require("@cleartrip/talos-widget-manager"),c=require("@cleartrip/talos-constants"),u=require("@cleartrip/talos-sequential-reveal"),d=require("@cleartrip/talos-background-gradient"),h=require("@cleartrip/talos-use-native-actions"),f=require("@cleartrip/talos-general-utils"),p=require("uuid"),g=require("@cleartrip/talos-lottie"),_=require("@cleartrip/talos-animated-ticker"),C=require("@cleartrip/talos-horizontal-chip-menu"),x=require("@cleartrip/talos-icon"),m={camera:"image/*",gallery:".jpg,.jpeg,image/jpeg,.png,image/png",file:"application/pdf,.pdf"},v=function(e){var t=e.actions,s=a.useTheme(),o=r.useMemo(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"}}}(s)},[s]),l=function(e,t){return"string"==typeof e?i.jsx("img",{src:e,alt:t,height:40,width:40}):e};return i.jsx(a.Box,n.__assign({boxSize:"tiny",horizontal:!0},{children:t.map(function(e){var t=e.label,r=e.onClick,s=e.onButtonClick,c=e.onChange,u=e.icon,d=e.inputType,h=e.isMultiple,f=e.useNativePicker;return i.jsxs(a.Box,n.__assign({boxSize:"micro",css:o.actionBox},{children:[l(u,t),i.jsx(a.Typography,n.__assign({variant:"L3"},{children:t})),d&&(f?i.jsx("button",{type:"button",onClick:s,style:o.hiddenInput,"aria-label":t}):i.jsx("input",n.__assign({type:"file",accept:m[d]},"camera"===d?{capture:"environment"}:{},{onClick:r,onChange:c,style:o.hiddenInput,"aria-label":t,multiple:h})))]}),t)})}))},y=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}}},T=function(e){var t=e.children,s=e.onClick,o=e.styleConfig,l=a.useTheme(),c=r.useMemo(function(){return y(l)},[l]),u=(o||{}).root;return i.jsx(a.Container,n.__assign({onClick:s,css:n.__assign(n.__assign({},c.headerAction),null==u?void 0:u.css)},{children:t}))},E=function(){return i.jsxs("svg",n.__assign({xmlns:"http://www.w3.org/2000/svg",width:"21",height:"20",viewBox:"0 0 21 20",fill:"none"},{children:[i.jsx("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)"}),i.jsx("g",n.__assign({filter:"url(#filter0_f_3415_10691)"},{children:i.jsx("path",{d:"M9.56259 5.67664C10.0313 6.89539 11.8688 9.44538 15.4688 9.89538",stroke:"#F801B7","stroke-width":"0.588235"})})),i.jsx("g",n.__assign({filter:"url(#filter1_f_3415_10691)"},{children:i.jsx("path",{d:"M5.06265 11.3016C6.20015 11.6588 8.58015 13.0588 9.00015 15.8016",stroke:"#7801F8","stroke-width":"0.588235"})})),i.jsx("g",n.__assign({filter:"url(#filter2_f_3415_10691)"},{children:i.jsx("path",{d:"M8.71826 3.42688C8.15576 7.08313 5.84951 9.44563 2.24951 9.89563",stroke:"#FFD58C","stroke-width":"0.294118"})})),i.jsx("g",n.__assign({filter:"url(#filter3_f_3415_10691)"},{children:i.jsx("path",{d:"M15.4691 10.4581C11.8129 11.0206 9.4504 13.3269 9.0004 16.9269",stroke:"#FFD58C","stroke-width":"0.294118"})})),i.jsx("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)"}),i.jsx("g",n.__assign({filter:"url(#filter4_f_3415_10691)"},{children:i.jsx("path",{d:"M17.1917 1.99988C17.4 2.54154 18.2167 3.67488 19.8167 3.87488",stroke:"#F801B7","stroke-width":"0.220588"})})),i.jsx("g",n.__assign({filter:"url(#filter5_f_3415_10691)"},{children:i.jsx("path",{d:"M15.1913 4.49951C15.6969 4.65824 16.7547 5.28046 16.9413 6.49951",stroke:"#9937CA","stroke-width":"0.220588"})})),i.jsx("g",n.__assign({filter:"url(#filter6_f_3415_10691)"},{children:i.jsx("path",{d:"M16.8165 1.00061C16.5665 2.62561 15.5415 3.67561 13.9415 3.87561",stroke:"#FFD58C","stroke-width":"0.110294"})})),i.jsx("g",n.__assign({filter:"url(#filter7_f_3415_10691)"},{children:i.jsx("path",{d:"M19.817 4.12512C18.192 4.37512 17.142 5.40012 16.942 7.00012",stroke:"#FFD58C","stroke-width":"0.110294"})})),i.jsxs("defs",{children:[i.jsxs("filter",n.__assign({id:"filter0_f_3415_10691",x:"8.11162",y:"4.39457",width:"8.57017",height:"6.96915",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[i.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),i.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),i.jsx("feGaussianBlur",{stdDeviation:"0.588235",result:"effect1_foregroundBlur_3415_10691"})]})),i.jsxs("filter",n.__assign({id:"filter1_f_3415_10691",x:"3.79808",y:"9.84453",width:"6.66929",height:"7.17814",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[i.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),i.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),i.jsx("feGaussianBlur",{stdDeviation:"0.588235",result:"effect1_foregroundBlur_3415_10691"})]})),i.jsxs("filter",n.__assign({id:"filter2_f_3415_10691",x:"1.76067",y:"2.93395",width:"7.57353",height:"7.57814",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[i.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),i.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),i.jsx("feGaussianBlur",{stdDeviation:"0.235294",result:"effect1_foregroundBlur_3415_10691"})]})),i.jsxs("filter",n.__assign({id:"filter3_f_3415_10691",x:"8.38387",y:"9.84216",width:"7.57823",height:"7.5735",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[i.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),i.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),i.jsx("feGaussianBlur",{stdDeviation:"0.235294",result:"effect1_foregroundBlur_3415_10691"})]})),i.jsxs("filter",n.__assign({id:"filter4_f_3415_10691",x:"16.6475",y:"1.51915",width:"3.62396",height:"2.9064",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[i.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),i.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),i.jsx("feGaussianBlur",{stdDeviation:"0.220588",result:"effect1_foregroundBlur_3415_10691"})]})),i.jsxs("filter",n.__assign({id:"filter5_f_3415_10691",x:"14.7171",y:"3.95311",width:"2.77441",height:"3.0043",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[i.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),i.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),i.jsx("feGaussianBlur",{stdDeviation:"0.220588",result:"effect1_foregroundBlur_3415_10691"})]})),i.jsxs("filter",n.__assign({id:"filter6_f_3415_10691",x:"13.7582",y:"0.815717",width:"3.28928",height:"3.29105",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[i.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),i.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),i.jsx("feGaussianBlur",{stdDeviation:"0.0882353",result:"effect1_foregroundBlur_3415_10691"})]})),i.jsxs("filter",n.__assign({id:"filter7_f_3415_10691",x:"16.7108",y:"3.89409",width:"3.29105",height:"3.28934",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[i.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),i.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),i.jsx("feGaussianBlur",{stdDeviation:"0.0882353",result:"effect1_foregroundBlur_3415_10691"})]})),i.jsxs("linearGradient",n.__assign({id:"paint0_linear_3415_10691",x1:"9",y1:"1.17676",x2:"9",y2:"19.1768",gradientUnits:"userSpaceOnUse"},{children:[i.jsx("stop",{"stop-color":"#F0257E"}),i.jsx("stop",{offset:"1","stop-color":"#FE6C46"})]})),i.jsxs("linearGradient",n.__assign({id:"paint1_linear_3415_10691",x1:"16.9415",y1:"0",x2:"16.9415",y2:"8",gradientUnits:"userSpaceOnUse"},{children:[i.jsx("stop",{"stop-color":"#F0257E"}),i.jsx("stop",{offset:"1","stop-color":"#FE6C46"})]}))]})]}))},j=function(){return i.jsxs("svg",n.__assign({xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},{children:[i.jsx("mask",n.__assign({id:"mask0_2214_2441",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"20",height:"20"},{children:i.jsx("rect",{width:"20",height:"20",fill:"#D9D9D9"})})),i.jsx("g",n.__assign({mask:"url(#mask0_2214_2441)"},{children:i.jsx("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"})}))]}))},A=function(){return i.jsx("svg",n.__assign({xmlns:"http://www.w3.org/2000/svg",width:"20",height:"16",viewBox:"0 0 20 16",fill:"none"},{children:i.jsx("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"})}))},S=function(){return i.jsx("svg",n.__assign({xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},{children:i.jsx("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"})}))},I=function(){var e=p.v4();return i.jsxs("svg",n.__assign({xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},{children:[i.jsx("mask",n.__assign({id:e,style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"20",height:"20"},{children:i.jsx("rect",{width:"20",height:"20",fill:"#D9D9D9"})})),i.jsx("g",n.__assign({mask:"url(#".concat(e,")")},{children:i.jsx("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"})}))]}))},b="Get quick support 24/7",R=function(e){var t=a.useTheme(),s=e.showBackButton,o=void 0!==s&&s,l=e.showCross,c=void 0!==l&&l,u=e.showPreviousChat,d=void 0!==u&&u,h=e.title,f=void 0===h?b:h,p=e.showIcon,g=void 0===p||p,_=e.showNewChat,C=void 0!==_&&_,x=e.isScrolled,m=void 0!==x&&x,v=e.onBackButtonClick,R=e.onCrossClick,k=e.onPreviousChatClick,B=e.onNewChatClick,w=r.useMemo(function(){return y(t,m)},[t,m]);return i.jsxs(a.Container,n.__assign({css:w.root},{children:[i.jsxs(a.Box,n.__assign({boxSize:"tiny",horizontal:!0,css:{alignItems:"center"}},{children:[o&&i.jsx(T,n.__assign({onClick:v},{children:i.jsx(S,{})})),i.jsxs(a.Box,n.__assign({boxSize:"pico",horizontal:!0},{children:[g&&i.jsx(a.Container,n.__assign({css:w.iconContainer},{children:i.jsx(E,{})})),i.jsx(a.Typography,n.__assign({variant:"HM3",styleConfig:{css:w.title},lineClamp:1},{children:f}))]}))]})),i.jsxs(a.Box,n.__assign({boxSize:"tiny",horizontal:!0},{children:[d&&i.jsx(T,n.__assign({onClick:k},{children:i.jsx(j,{})})),C&&i.jsx(T,n.__assign({onClick:B},{children:i.jsx(I,{})})),c&&i.jsx(T,n.__assign({onClick:R},{children:i.jsx(A,{})}))]}))]}))},k=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]}}},B=function(e){var t=e.loaderText,o=void 0===t?"Processing your request":t,l=e.capability,c=void 0===l?s.ChatCapability.CONVERSATIONAL:l,u=a.useTheme(),d=r.useMemo(function(){return k(u)},[u]);return c===s.ChatCapability.SEARCH?i.jsxs(a.Container,n.__assign({css:d.root},{children:[i.jsx(g.Lottie,{lottieId:"AI_LOADER",autoPlay:!0,loop:!0,hasContainer:!0,height:"32px",width:"32px"}),i.jsx(a.Typography,n.__assign({variant:"B3"},{children:o}))]})):i.jsx(g.Lottie,{lottieId:"AI_LOADER",autoPlay:!0,loop:!0,hasContainer:!0,height:"32px",width:"32px"})},w=function(){return i.jsx("svg",n.__assign({xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},{children:i.jsx("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"})}))},N=function(e){var t=e.isContextSummaryLoading,s=e.contextSummary,o=a.useTheme(),l=r.useMemo(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)"}}}}}(o)},[o]);if(t)return i.jsxs(a.Box,n.__assign({boxSize:"pico",css:l.loadingContainer},{children:[i.jsx(a.Container,n.__assign({css:l.iconContainer},{children:i.jsx(a.Container,n.__assign({css:l.animatedIcon},{children:i.jsx(w,{})}))})),i.jsx(a.Typography,n.__assign({variant:"B2"},{children:"Updating search context..."}))]}));var c=(s||{}).data,u=void 0===c?{}:c,d=u.contextSummary,h=void 0===d?"Your search context has been updated":d,p=u.filterSummary,g=u.promptMessage,_=f.isEmpty(g)?"How can I help you further?":g;return i.jsx(a.Transition,n.__assign({type:"fade",timeout:400,in:!0},{children:i.jsxs(a.Box,n.__assign({boxSize:"micro",css:l.fadeIn},{children:[i.jsx(a.Typography,n.__assign({variant:"B4CAPS",color:"subheading"},{children:"CONTINUE SEARCHING FOR"})),i.jsxs(a.Container,{children:[i.jsx(a.Typography,n.__assign({variant:"HM4",componentNode:"span"},{children:h})),!f.isEmpty(p)&&i.jsxs(i.Fragment,{children:[i.jsx(a.Typography,n.__assign({variant:"HM4",componentNode:"span"},{children:"・"})),i.jsx(a.Typography,n.__assign({variant:"HM4",componentNode:"span"},{children:p}))]})]}),i.jsx(a.Typography,n.__assign({variant:"P2"},{children:_}))]}))}))},L={delay:3e3,height:40,animateInfinite:!0,duration:650},O={delay:2e3,animateInfinite:!0,duration:650,visibleCount:3,itemGap:12},F=function(e){var t,s,l,u,d=e.data,h=e.shouldHidePills,f=a.useTheme(),p=null!=d?d:{},g=p.heading,x=p.suggestions,m=void 0===x?[]:x,v=null!==(t=null==g?void 0:g.static)&&void 0!==t?t:[],y=null!==(s=null==g?void 0:g.ticker)&&void 0!==s?s:[],T=r.useMemo(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"}}}(f)},[f]),E=Math.min(3,m.length),j=32*(l=E)+12*Math.max(0,l-1)+6,A=r.useMemo(function(){return y.map(function(e,t){return i.jsx(a.Typography,n.__assign({variant:"HD3",styleConfig:{css:T.headingTickerText}},{children:e.text}),"".concat(e.text,"-").concat(t))})},[y,T.headingTickerText]),S=r.useMemo(function(){return m.map(function(e){var t=function(e){var t;return{data:{label:e.label},events:{onClick:[{type:o.ActionType.RAVEN_TRACKING,payload:{eventName:c.RAVEN_EVENT.U_UI_ACTION,eventData:(t={},t[c.RAVEN_ATTRIBUTE_KEY.ACTION_NAME]=c.RAVEN_ACTION.U_SUGGESTED_PROMPT_SELECTED,t[c.RAVEN_ATTRIBUTE_KEY.ACTION_TYPE]=c.RAVEN_ACTION_TYPE.CLICK,t[c.RAVEN_ATTRIBUTE_KEY.U_AGENT_PROMPT_SELECTED]=e.label,t)}},{type:o.ActionType.SEND_MESSAGE,payload:{message:e.label}}]}}}(e),n=t.data,r=t.events;return i.jsx(C.HorizontalChipItem,{data:n,events:r},e.id)})},[m]);return i.jsxs(a.Container,n.__assign({css:T.root},{children:[i.jsxs(a.Container,{children:[i.jsx(a.Container,n.__assign({css:T.greetingContainer},{children:i.jsx(a.Typography,n.__assign({variant:a.TypographyVariant.P1},{children:(u=(new Date).getHours(),u<12?"Good morning!":u<18?"Good afternoon!":"Good evening!")}))})),i.jsxs(a.Container,{children:[v.map(function(e,t){return i.jsx(a.Typography,n.__assign({variant:a.TypographyVariant.HD3},{children:e.text}),"".concat(e.text,"-").concat(t))}),i.jsx(_.AnimatedTicker,{elements:A,config:L})]})]}),!h&&i.jsx(_.AnimatedTicker,{elements:S,config:n.__assign(n.__assign({},O),{height:j})})]}))},D=function(e){return i.jsxs("svg",n.__assign({xmlns:"http://www.w3.org/2000/svg",width:"289",height:"160",viewBox:"0 0 289 160",fill:"none"},e,{children:[i.jsx("g",n.__assign({opacity:"0.7",filter:"url(#filter0_f_1771_46149)"},{children:i.jsx("ellipse",{cx:"94.5",cy:"123.5",rx:"114.5",ry:"43.5",fill:"#FFB8F9"})})),i.jsx("defs",{children:i.jsxs("filter",n.__assign({id:"filter0_f_1771_46149",x:"-100",y:"0",width:"389",height:"247",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[i.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),i.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),i.jsx("feGaussianBlur",{stdDeviation:"40",result:"effect1_foregroundBlur_1771_46149"})]}))})]}))},H=function(e){return i.jsxs("svg",n.__assign({xmlns:"http://www.w3.org/2000/svg",width:"299",height:"160",viewBox:"0 0 299 160",fill:"none"},e,{children:[i.jsx("g",n.__assign({opacity:"0.7",filter:"url(#filter0_f_1771_46148)"},{children:i.jsx("ellipse",{cx:"194.5",cy:"123.5",rx:"114.5",ry:"43.5",fill:"#FFB299"})})),i.jsx("defs",{children:i.jsxs("filter",n.__assign({id:"filter0_f_1771_46148",x:"0",y:"0",width:"389",height:"247",filterUnits:"userSpaceOnUse","color-interpolation-filters":"sRGB"},{children:[i.jsx("feFlood",{"flood-opacity":"0",result:"BackgroundImageFix"}),i.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),i.jsx("feGaussianBlur",{stdDeviation:"40",result:"effect1_foregroundBlur_1771_46148"})]}))})]}))},P=function(){return i.jsxs("svg",n.__assign({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[i.jsx("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"}),i.jsx("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"}),i.jsx("g",n.__assign({filter:"url(#filter0_f_3317_42725)"},{children:i.jsx("path",{d:"M17.959 2.33203C18.202 2.96389 19.1547 4.28593 21.0211 4.51923",stroke:"#FFE9E9",strokeWidth:"0.304968"})})),i.jsx("g",n.__assign({filter:"url(#filter1_f_3317_42725)"},{children:i.jsx("path",{d:"M15.625 5.25C16.2147 5.43516 17.4486 6.16098 17.6664 7.58301",stroke:"#E4CBFF",strokeWidth:"0.304968"})})),i.jsx("g",n.__assign({filter:"url(#filter2_f_3317_42725)"},{children:i.jsx("path",{d:"M17.5215 1.16797C17.2299 3.06354 16.0342 4.28837 14.1678 4.52167",stroke:"#FFD58C",strokeWidth:"0.152484"})})),i.jsx("g",n.__assign({filter:"url(#filter3_f_3317_42725)"},{children:i.jsx("path",{d:"M21.0195 4.8125C19.124 5.10413 17.8991 6.29979 17.6658 8.1662",stroke:"#BCB09C",strokeWidth:"0.152484"})})),i.jsxs("defs",{children:[i.jsxs("filter",n.__assign({id:"filter0_f_3317_42725",x:"17.2067",y:"1.66741",width:"4.44314",height:"3.61245",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB"},{children:[i.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),i.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),i.jsx("feGaussianBlur",{stdDeviation:"0.304968",result:"effect1_foregroundBlur_3317_42725"})]})),i.jsxs("filter",n.__assign({id:"filter1_f_3317_42725",x:"14.9694",y:"4.49553",width:"3.45767",height:"3.71987",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB"},{children:[i.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),i.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),i.jsx("feGaussianBlur",{stdDeviation:"0.304968",result:"effect1_foregroundBlur_3317_42725"})]})),i.jsxs("filter",n.__assign({id:"filter2_f_3317_42725",x:"13.9144",y:"0.912275",width:"3.92643",height:"3.92936",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB"},{children:[i.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),i.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),i.jsx("feGaussianBlur",{stdDeviation:"0.121987",result:"effect1_foregroundBlur_3317_42725"})]})),i.jsxs("filter",n.__assign({id:"filter3_f_3317_42725",x:"17.3462",y:"4.49235",width:"3.92887",height:"3.9274",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB"},{children:[i.jsx("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),i.jsx("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),i.jsx("feGaussianBlur",{stdDeviation:"0.121987",result:"effect1_foregroundBlur_3317_42725"})]}))]})]}))},G=r.forwardRef(function(e,t){var p,g=a.useTheme(),_=e.chatId,C=e.chatData,x=e.pageType,m=e.isInitialLoading,y=e.isReplyLoading,T=e.replyLoaderText,E=e.isTop,j=e.showNativeActions,A=e.isContextSummaryLoading,S=e.contextSummaryError,I=e.contextSummary,k=e.capability,w=e.sendMessage,L=e.onPreviousChatClick,O=e.onBackButtonClick,G=e.onClose,U=e.handleMediaPicked,V=e.scrollToBottomOnLoad,M=e.onStop,z=k===s.ChatCapability.SEARCH,Y=r.useMemo(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}}}(g,z)},[g,z]),K=z&&y,q=r.useState(""),W=q[0],Z=q[1],X=r.useState(!1),Q=X[0],J=X[1],$=r.useState(!1),ee=$[0],te=$[1],ne=r.useRef(null),ie=r.useRef([]),re=r.useRef(null),ae=r.useRef(null),se=r.useRef(null),oe=r.useRef(!1),le=r.useRef(!1),ce=r.useRef(null),ue=s.usePresentation(),de=ue.hasPresented,he=ue.markPresented,fe=null!=C?C:{},pe=fe.messages,ge=void 0===pe?[]:pe,_e=fe.pageData,Ce=fe.status,xe=fe.landingContent,me=f.isEmpty(ge)&&!m&&!f.isEmpty(xe),ve=y&&E,ye=r.useRef(null),Te=r.useState(!1),Ee=Te[0],je=Te[1],Ae=r.useRef(null!==(p=null==ge?void 0:ge.length)&&void 0!==p?p:null),Se=A||!f.isEmpty(I)||S;r.useEffect(function(){ye.current=null,je(!1)},[_]),r.useEffect(function(){Se&&(null!==ye.current?ge.length>ye.current&&je(!0):ye.current=ge.length)},[Se,ge.length]);var Ie=x===s.ChatPageType.CHAT&&Se&&!Ee,be=_e||{},Re=be.title,ke=void 0===Re?b:Re,Be=be.newChatEnabled,we=be.footerSlots,Ne=void 0===we?[]:we,Le=r.useState(!1),Oe=Le[0],Fe=Le[1],De=r.useState(!1),He=De[0],Pe=De[1],Ge=r.useMemo(function(){return x===s.ChatPageType.CHAT?z?"AI Search":b:ke},[x,ke]),Ue=s.useAppDispatch().dispatch,Ve=h.useNativeActions(),Me=Ve.handleGalleryClick,ze=Ve.handleCameraClick,Ye=Ve.handleUploadChange;r.useEffect(function(){var e;te(null!=j&&j),j&&(null===(e=ne.current)||void 0===e||e.focus())},[j]),r.useEffect(function(){Fe(!m||!E)},[m,E]);var Ke=function(e){Z(e)},qe=function(){var e=ee;Ue({type:o.ActionType.SHOW_NATIVE_ACTIONS,payload:{isNativeActionsEnabled:!e}}),te(function(e){return!e})},We=function(){w(W),Z(""),setTimeout(function(){var e;null===(e=ne.current)||void 0===e||e.blur()},100)},Ze=function(){Me(U)},Xe=function(){ze(U)},Qe=function(e){Ye(e,U)},Je="iPhoneApp"===f.checkDeviceType(),$e=[{label:"Gallery",onClick:Ze,onButtonClick:Ze,onChange:Qe,icon:"https://rukmini-ct.flixcart.com/f_auto,q_auto/offermgmt-prod/chatbot/gallery.png",inputType:"gallery",isMultiple:!0,useNativePicker:Je},{label:"Camera",onClick:Xe,onButtonClick:Xe,onChange:Qe,icon:"https://rukmini-ct.flixcart.com/f_auto,q_auto/offermgmt-prod/chatbot/camera-3d.png",inputType:"camera",useNativePicker:Je},{label:"Files",onChange:Qe,icon:"https://rukmini-ct.flixcart.com/f_auto,q_auto/offermgmt-prod/chatbot/pdf-3d.png",inputType:"file"}],et=function(){var e;me?(null===(e=ne.current)||void 0===e||e.focus(),J(!0)):Ue({type:o.ActionType.CREATE_NEW_CHAT})},tt=function(e){void 0===e&&(e="auto");var t=null==re?void 0:re.current;t&&t.scrollTo({top:t.scrollHeight,behavior:e})};r.useImperativeHandle(t,function(){return{scrollToBottom:tt}},[]);var nt=r.useCallback(function(){var e,t,n,i=re.current,r=ae.current;if(i&&r){var a=-1;if(ge)for(var s=ge.length-1;s>=0;s--)if(ge[s].type===o.WidgetType.USER_MESSAGE){a=s;break}if(-1!==a){var l=ie.current[a];if(l){var c=0;for(s=a+1;s<(null!==(e=null==ge?void 0:ge.length)&&void 0!==e?e:0);s++){var u=ie.current[s];u&&(c+=u.offsetHeight)}z&&(c+=(null!==(n=null===(t=se.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"}},[ge,Ie]);r.useEffect(function(){if(x===s.ChatPageType.PREVIOUS_CHAT)return oe.current=!0,void tt();if(V){if(m)return;if(null===ce.current&&(ce.current=ge.length),ge.length<=ce.current)return oe.current=!0,void tt()}nt();var e=-1;if(ge)for(var t=ge.length-1;t>=0;t--)if(ge[t].type===o.WidgetType.USER_MESSAGE){e=t;break}if(-1!==e){var n=ie.current[e];if(n){le.current=!0,n.scrollIntoView({behavior:"smooth",block:"start"});var i=re.current,r=function(){le.current=!1};null==i||i.addEventListener("scrollend",r,{once:!0}),setTimeout(r,500)}}},[ge,x,nt,V,m]),r.useEffect(function(){var e=re.current;if(e){var t=new ResizeObserver(function(){var e=V&&(null===ce.current||ge.length<=ce.current);if(x===s.ChatPageType.PREVIOUS_CHAT||e)oe.current&&tt();else if(le.current||nt(),z&&(m||Ae.current===(null==ge?void 0:ge.length))){var t=ae.current;t&&(t.style.height="0px"),tt()}});return t.observe(e),ie.current.forEach(function(e){e&&t.observe(e)}),se.current&&t.observe(se.current),function(){return t.disconnect()}}},[ge,nt,x,V,Ie,z]),r.useEffect(function(){var e=re.current;if(e){var t=function(){Pe(e.scrollTop>0);var t=e.scrollHeight-e.scrollTop-e.clientHeight;oe.current=t<4};return t(),e.addEventListener("scroll",t,{passive:!0}),function(){return e.removeEventListener("scroll",t)}}},[]);var it=r.useMemo(function(){return x===s.ChatPageType.CHAT&&Ce!==s.ChatStatus.CLOSED||Ce===s.ChatStatus.ON_GOING},[x,Ce]),rt=r.useMemo(function(){return Ce===s.ChatStatus.CLOSED&&x===s.ChatPageType.CHAT},[x,Ce]),at=r.useMemo(function(){return k===s.ChatCapability.SEARCH||Be&&x!==s.ChatPageType.CHAT},[k,Be,x]),st=function(){J(!1)},ot=function(){return it?i.jsxs(a.Container,n.__assign({css:Y.inputContainer},{children:[ve&&k===s.ChatCapability.SEARCH&&i.jsx(B,{capability:k,loaderText:T}),i.jsxs(a.Box,n.__assign({boxSize:"tiny"},{children:[i.jsx(a.AiChatInput,{rows:4,value:W,onChange:Ke,placeholder:"Ask a question",onPrefixClick:qe,showKeyboardIcon:ee,onSubmit:We,onBlur:st,disableAction:y||m,prefix:z?i.jsx(P,{}):void 0,suffix:W.length>0||K?void 0:i.jsx(i.Fragment,{}),isStreaming:K,onStop:M,ref:ne}),ee&&i.jsx(v,{actions:$e})]}))]})):null};return i.jsxs(i.Fragment,{children:[i.jsx(R,{showCross:x===s.ChatPageType.CHAT,onCrossClick:function(){null==G||G()},showPreviousChat:x===s.ChatPageType.CHAT,onPreviousChatClick:function(){var e;Ue({type:o.ActionType.RAVEN_TRACKING,payload:{eventName:c.RAVEN_EVENT.U_UI_ACTION,eventData:(e={},e[c.RAVEN_ATTRIBUTE_KEY.ACTION_NAME]=c.RAVEN_ACTION.U_AGENT_HISTORY_BUTTON,e[c.RAVEN_ATTRIBUTE_KEY.ACTION_TYPE]=c.RAVEN_ACTION_TYPE.CLICK,e)}}),null==L||L()},showBackButton:x===s.ChatPageType.PREVIOUS_CHAT,onBackButtonClick:function(){null==O||O()},showNewChat:at,onNewChatClick:et,showIcon:x===s.ChatPageType.CHAT,title:Ge,isScrolled:He}),m&&E&&i.jsx(a.Box,n.__assign({boxSize:"tiny",css:n.__assign({},Y.loadingContainer)},{children:i.jsx(a.Spinner,{variant:"thin",height:"54px",width:"54px",borderColor:g.color.border.link,trackColor:g.color.border.disabledDark})})),i.jsx(a.Box,n.__assign({boxSize:"tiny",css:Y.chatContainer},{children:i.jsxs(a.Box,n.__assign({css:n.__assign(n.__assign({},Y.animatedContainer),x===s.ChatPageType.CHAT&&!V&&!z&&{transform:Oe?"translateY(0)":"translateY(25%)",opacity:Oe?1:0}),boxSize:"tiny",ref:re},{children:[!m&&(null==ge?void 0:ge.map(function(e,t){var r,s=e.id,c=e.type,d=e.chunks,h=e.metaData,f=void 0===h?{}:h,p=((r={})[o.WidgetType.USER_MESSAGE]=Y.userMessageContainer,r),g=n.__assign(n.__assign({},f),{messageId:s,chatId:_,messageIndex:t,totalMessages:null==ge?void 0:ge.length,pageType:x}),C=!de(_,s);return 0===d.length?null:i.jsx(a.Container,n.__assign({css:n.__assign({},p[c]),ref:function(e){ie.current[t]=e}},{children:d.length>0&&i.jsx(u.SequentialReveal,n.__assign({animate:C,onComplete:function(){return he(_,s)}},{children:d.map(function(e,t){var r,a=n.__assign(n.__assign(n.__assign({},null!==(r=e.metaData)&&void 0!==r?r:{}),g),{animate:C});return i.jsx(l.WidgetGenerator,n.__assign({},e,{metaData:a}),t)})}))}),"".concat(_,"_").concat(s))})),ve&&k===s.ChatCapability.CONVERSATIONAL&&i.jsx(B,{capability:k,loaderText:T}),x===s.ChatPageType.CHAT&&i.jsx(a.Container,{ref:ae,css:{flexShrink:0}}),f.isEmpty(ge)&&!m&&xe&&i.jsx(F,{data:xe,shouldHidePills:Ie||Q||W.length>=3}),Ie&&i.jsx(a.Container,n.__assign({ref:se,css:{marginTop:"auto",paddingTop:"12px"}},{children:i.jsx(N,{contextSummary:I,isContextSummaryLoading:A,contextSummaryError:S})}))]}))})),z?i.jsx(d.BackgroundGradient,n.__assign({variant:K?d.BackgroundGradientVariant.PROCESSING:d.BackgroundGradientVariant.DEFAULT,styleConfig:{root:{css:Y.bgGradient}}},{children:ot()})):i.jsxs(i.Fragment,{children:[i.jsx(D,{style:Y.bgGradientLeft}),i.jsx(H,{style:Y.bgGradientRight})]}),!z&&ot(),rt&&i.jsxs(a.Container,n.__assign({css:Y.newChatContainer},{children:[i.jsx(a.Typography,n.__assign({variant:"P3",styleConfig:{css:Y.chatClosedMessage}},{children:"This query has been closed, If you have a query regarding this trip, you can start a new chat."})),i.jsx(a.Button,n.__assign({variant:"contained",color:"primary",isFullWidth:!0,onClick:et},{children:"Start New Chat"}))]})),x===s.ChatPageType.PREVIOUS_CHAT&&i.jsx(a.Container,n.__assign({css:Y.footerContainer},{children:null==Ne?void 0:Ne.map(function(e,t){var r=e.type,a=n.__rest(e,["type"]),s="".concat(r,"_").concat(t);return i.jsx(l.WidgetGenerator,n.__assign({type:r},a),s)})}))]})}),U=r.memo(G),V=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"}}},M=function(){var e=a.useTheme(),t=r.useMemo(function(){return V(e)},[e]);return i.jsx(a.Container,n.__assign({css:t.shimmerContainer},{children:i.jsxs(a.Box,n.__assign({boxSize:"tiny"},{children:[i.jsx(a.Shimmer,{height:e.size[5],width:"120px"}),Array.from({length:3}).map(function(r,s){return i.jsxs(a.Box,n.__assign({boxSize:"nano",css:t.shimmerCard},{children:[i.jsx(a.Shimmer,{height:e.size[4],width:"150px"}),i.jsx(a.Shimmer,{height:e.size[4],width:"200px"})]}),s)})]}))}))};!function(e){e.ERROR="error",e.EMPTY="empty"}(e||(e={}));var z,Y=((t={})[e.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"},t[e.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"},t),K=function(t){var l=t.variant,c=void 0===l?e.ERROR:l,u=a.useTheme(),d=r.useMemo(function(){return V(u)},[u]),h=s.useAppDispatch().dispatch;return i.jsx(a.Container,n.__assign({css:d.bodyContainer},{children:i.jsxs(a.Box,n.__assign({boxSize:"medium",css:d.errorContainer},{children:[i.jsx("img",{src:Y[c].icon,alt:c,height:100,width:100}),i.jsxs(a.Box,n.__assign({boxSize:"small",css:d.labelContainer},{children:[i.jsx(a.Typography,n.__assign({variant:"HM3",styleConfig:{css:d.errorText}},{children:Y[c].text})),i.jsx(a.Button,n.__assign({variant:"outline",onClick:function(){c===e.ERROR?h({type:o.ActionType.REFETCH_PREVIOUS_CHAT}):h({type:o.ActionType.CREATE_NEW_CHAT})},css:d.errorButton},{children:Y[c].buttonLabel}))]}))]}))}))},q=r.memo(function(t){var c=t.chats,u=t.loading,d=void 0!==u&&u,h=t.onBack,f=t.previousChatError,p=null!=c?c:{},g=p.previousChats,_=void 0===g?[]:g,C=p.pageData,x=null!=C?C:{},m=x.newChatEnabled,v=x.chatCount,y=a.useTheme(),T=r.useMemo(function(){return V(y)},[y]),E=s.useAppDispatch().dispatch,j=r.useRef(null),A=r.useState(!1),S=A[0],I=A[1];r.useEffect(function(){var e=j.current;if(e){var t=function(){I(e.scrollTop>0)};return t(),e.addEventListener("scroll",t,{passive:!0}),function(){return e.removeEventListener("scroll",t)}}},[d,_.length]);return i.jsxs(a.Container,n.__assign({css:T.root},{children:[i.jsx(R,{showCross:!1,showPreviousChat:!1,showBackButton:!0,onBackButtonClick:h,title:"Past Conversations",showNewChat:m,onNewChatClick:function(){E({type:o.ActionType.CREATE_NEW_CHAT})},showIcon:!1,isScrolled:S}),d&&i.jsx(M,{}),!d&&(f?i.jsx(K,{variant:e.ERROR}):0===v?i.jsx(K,{variant:e.EMPTY}):null),!d&&_.length>0&&!!v&&v>0&&i.jsx(a.Box,n.__assign({boxSize:"medium",css:T.listContainer,ref:j},{children:_.map(function(e,t){var n=e.type,r=e.data,a="".concat(n,"_").concat(t);return i.jsx(l.WidgetGenerator,{type:n,data:r},a)})})),i.jsx(D,{style:T.bgGradientLeft}),i.jsx(H,{style:T.bgGradientRight})]}))}),W=function(e){var t=e.onClose,l=e.onBack,c=e.retry,u=a.useTheme(),d=r.useMemo(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"}}},[u]),h=s.useAppDispatch().dispatch,f=(null==c?void 0:c.kind)===s.ChatErrorKind.PREVIOUS;return i.jsxs(i.Fragment,{children:[i.jsx(R,{showBackButton:f,onBackButtonClick:l,showCross:!f,onCrossClick:t,showIcon:!1,title:""}),i.jsx(a.Container,n.__assign({css:d.bodyContainer},{children:i.jsxs(a.Box,n.__assign({boxSize:"medium",css:d.errorContainer},{children:[i.jsx("img",{src:"https://rukmini-ct.flixcart.com/f_auto,q_auto/offermgmt-prod/chatbot/3d-mug.png",alt:"error",height:100,width:100}),i.jsxs(a.Box,n.__assign({boxSize:"small",css:d.labelContainer},{children:[i.jsx(a.Typography,n.__assign({variant:"HM3",styleConfig:{css:d.errorText}},{children:"Oops, we couldn't load the chat"})),i.jsx(a.Button,n.__assign({variant:"outline",onClick:function(){h({type:o.ActionType.RETRY_CHAT_ERROR})},css:d.errorButton},{children:"Try again"}))]}))]}))})),i.jsx(D,{style:d.bgGradientLeft}),i.jsx(H,{style:d.bgGradientRight})]})},Z=function(e){var t=e.loading,s=void 0!==t&&t,o=a.useTheme(),l=r.useMemo(function(){return k(o)},[o]);return s?i.jsxs(a.Container,n.__assign({css:l.initLoader},{children:[i.jsx(a.DottedLoader,{}),i.jsx(a.Typography,n.__assign({variant:"B3"},{children:"Getting ready"}))]})):null},X=function(){return i.jsx("svg",n.__assign({xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},{children:i.jsx("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"})}))},Q=function(e){var t=e.onPrefixClick,l=e.onSuffixClick,u=e.sendMessage,d=e.isReplyLoading,h=void 0!==d&&d,f=e.capability,p=void 0===f?s.ChatCapability.CONVERSATIONAL:f,g=e.onStop,_=p===s.ChatCapability.SEARCH,C=_&&h,x=r.useState(""),m=x[0],v=x[1],y=r.useState(!1),E=y[0],j=y[1],S=r.useRef(null),I=a.useTheme(),b=r.useMemo(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}}}(I)},[I]),R=s.useAppDispatch().dispatch;r.useEffect(function(){var e;R({type:o.ActionType.RAVEN_TRACKING,payload:{eventName:c.RAVEN_EVENT.U_ASK_QUESTION_IMPRESSION,eventData:(e={},e[c.RAVEN_ATTRIBUTE_KEY.ACTION_TYPE]=c.RAVEN_ACTION_TYPE.IMPRESSION,e)}})},[]);var k=r.useMemo(function(){return n.__assign({},E?b.headerActionCollapsed:{})},[E,h,b]),w=r.useMemo(function(){return n.__assign({},E?b.headerActionCollapsed:{})},[E,h,b]);return i.jsxs(a.ThemeProvider,{children:[h&&i.jsx(B,{capability:s.ChatCapability.SEARCH}),i.jsxs(a.Box,n.__assign({boxSize:"micro",horizontal:!0,css:b.root},{children:[!C&&i.jsx(T,n.__assign({onClick:t,styleConfig:{root:{css:n.__assign(n.__assign({},b.headerAction),k)}}},{children:i.jsx(X,{})})),i.jsx(a.Container,n.__assign({css:b.inputWrapper},{children:i.jsx(a.AiChatInput,{ref:S,value:m,onChange:function(e){v(e)},onFocus:function(){var e;j(!0),R({type:o.ActionType.RAVEN_TRACKING,payload:{eventName:c.RAVEN_EVENT.U_UI_ACTION,eventData:(e={},e[c.RAVEN_ATTRIBUTE_KEY.ACTION_NAME]=c.RAVEN_ACTION.U_ASK_QUESTION_BUTTON,e[c.RAVEN_ATTRIBUTE_KEY.ACTION_TYPE]=c.RAVEN_ACTION_TYPE.CLICK,e)}})},onBlur:function(){j(!1)},onSubmit:function(){var e=m.trim();e&&!h&&(null==u||u(e),v(""),setTimeout(function(){var e;null===(e=S.current)||void 0===e||e.blur()},100))},disableAction:h,prefix:_?i.jsx(P,{}):void 0,suffix:m.length>0||C?void 0:i.jsx(i.Fragment,{}),isStreaming:C,onStop:g,placeholder:"Ask a question"})})),!C&&i.jsx(T,n.__assign({onClick:function(){return l(m)},styleConfig:{root:{css:n.__assign(n.__assign({},b.headerAction),w)}}},{children:i.jsx(A,{})}))]}))]})},J=r.forwardRef(function(e,t){var o=e.onPrefixClick,l=e.onSuffixClick,c=e.sendMessage,u=e.isReplyLoading,h=e.visible,f=void 0===h||h,p=e.isInitialLoading,g=void 0!==p&&p,_=e.capability,C=e.onStop,x=a.useTheme(),m=r.useMemo(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}}},[x]),v=_===s.ChatCapability.SEARCH&&u;return i.jsx(a.ThemeProvider,{children:i.jsx(a.Container,n.__assign({css:m.root},{children:i.jsx(a.Transition,n.__assign({type:"fade",timeout:400,appear:!0,mountOnEnter:!0,unmountOnExit:!0,in:f},{children:i.jsxs(a.Container,{children:[i.jsx(d.BackgroundGradient,{variant:v?d.BackgroundGradientVariant.PROCESSING:d.BackgroundGradientVariant.DEFAULT,styleConfig:{root:{css:m.backgroundGradient}}}),i.jsx(a.Transition,n.__assign({type:"slide",slideDirection:"up",timeout:400,appear:!0,mountOnEnter:!0,unmountOnExit:!0,in:f},{children:i.jsx(a.Container,n.__assign({css:m.content,ref:t},{children:g?i.jsx(Z,{loading:g}):i.jsx(Q,{onPrefixClick:o,onSuffixClick:l,sendMessage:c,isReplyLoading:u,capability:_,onStop:C})}))}))]})}))}))})}),$=function(e){var t=a.useTheme(),n=e.visible,s=e.message,o=e.type,l=e.onDismiss,c=e.duration,u=void 0===c?3e3:c,d=r.useMemo(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(r.useEffect(function(){if(n){var e=setTimeout(function(){return null==l?void 0:l()},u+500);return function(){return clearTimeout(e)}}},[n,u,l]),!n)return null;var h=o?i.jsx(x.Icon,{icon:o}):null;return i.jsx(a.Toast,{show:!0,text:s,isAutoClose:!0,prefixComponent:h,closeTimeout:u,styleConfig:{toastContainer:{css:d.toastContainer},prefixContainer:{css:d.prefixContainer}}})};exports.ChatSurfaceState=void 0,(z=exports.ChatSurfaceState||(exports.ChatSurfaceState={})).FLOATING="FLOATING",z.HYBRID="HYBRID",z.EXPANDED="EXPANDED";var ee,te,ne=function(e){void 0===e&&(e=exports.ChatSurfaceState.FLOATING);var t=this;this.listeners=new Set,this.handlers={},this.getSnapshot=function(){return t.snapshot},this.subscribe=function(e){return t.listeners.add(e),function(){t.listeners.delete(e)}},this.setSnapshot=function(e){var i=n.__assign(n.__assign({},t.snapshot),e);i.state===t.snapshot.state&&i.isReplyLoading===t.snapshot.isReplyLoading||(t.snapshot=i,t.listeners.forEach(function(e){return e()}))},this.showFloating=function(){return t.setSnapshot({state:exports.ChatSurfaceState.FLOATING})},this.showHybrid=function(){return t.setSnapshot({state:exports.ChatSurfaceState.HYBRID})},this.hideHybrid=function(){return t.setSnapshot({state:exports.ChatSurfaceState.FLOATING})},this.expand=function(){return t.setSnapshot({state:exports.ChatSurfaceState.EXPANDED})},this.collapse=function(){return t.setSnapshot({state:exports.ChatSurfaceState.HYBRID})},this.setState=function(e){return t.setSnapshot({state:e})},this.setReplyLoading=function(e){return t.setSnapshot({isReplyLoading:e})},this.setHandlers=function(e){t.handlers=e},this.clearHandlers=function(){t.handlers={}},this.openSearchFromFloatingPill=function(){var e,n;t.setSnapshot({state:exports.ChatSurfaceState.HYBRID}),null===(n=null===(e=t.handlers)||void 0===e?void 0:e.onFloatingPillClick)||void 0===n||n.call(e)},this.snapshot={state:e,isReplyLoading:!1}},ie=null,re=function(){return ie||(ie=new ne),ie},ae=r.createContext(null),se=function(){var e=r.useContext(ae);return null!=e?e:re()},oe=function(e){var t=se(),n=null!=e?e:t;return r.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getSnapshot)},le=function(e,t){var n=oe(e).state;r.useEffect(function(){if(n===exports.ChatSurfaceState.HYBRID&&"undefined"!=typeof window){var i=Date.now(),r=function(){return Date.now()-i<400},a=function(e){var n;return!(!e||!(null===(n=t.current)||void 0===n?void 0:n.contains(e)))},s=!1,o=function(e){s=!a(e.target)&&a(document.activeElement)},l=function(t){a(t.target)||(t.stopPropagation(),t.preventDefault(),r()||(s?s=!1:e.hideHybrid()))},c=function(e){r()&&(a(e.target)||(e.stopPropagation(),e.preventDefault()))},u={capture:!0};return document.addEventListener("pointerdown",o,u),document.addEventListener("mousedown",c,u),document.addEventListener("mouseup",c,u),document.addEventListener("click",l,u),function(){document.removeEventListener("pointerdown",o,u),document.removeEventListener("mousedown",c,u),document.removeEventListener("mouseup",c,u),document.removeEventListener("click",l,u)}}},[n,e,t])};exports.ChatUIStatusValue=void 0,(ee=exports.ChatUIStatusValue||(exports.ChatUIStatusValue={})).ONGOING="ongoing",ee.IDLE="idle",exports.ChatView=void 0,(te=exports.ChatView||(exports.ChatView={})).CHAT="CHAT",te.PREVIOUS_CHATS="PREVIOUS_CHATS";exports.ChatSurfaceBridge=ne,exports.ChatSurfaceProvider=function(e){var t=e.children,a=e.bridge,s=e.initialState,o=r.useRef();return o.current||(o.current=null!=a?a:new ne(s)),i.jsx(ae.Provider,n.__assign({value:o.current},{children:t}))},exports.ChatUI=function(e){var t,u=e.open,d=void 0===u||u,h=e.onClose,f=e.network,p=e.protocol,g=e.triggerTracking,_=e.baseTrackingData,C=e.onChatStateChange,x=e.plugins,m=e.capability,v=void 0===m?s.ChatCapability.CONVERSATIONAL:m,y=a.useTheme(),T=r.useMemo(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}}},[y]),E=r.useRef(0),j=r.useRef(C);j.current=C;var A=v===s.ChatCapability.SEARCH,S=se(),I=oe(S),b=r.useRef(null),R=r.useRef([]),k=r.useRef("800px"),B=r.useRef("800px"),w=r.useState(d),N=w[0],L=w[1];r.useEffect(function(){k.current="".concat(window.innerHeight,"px");var e=.94*window.innerHeight;B.current="".concat(e,"px")},[]),r.useEffect(function(){L(d)},[d]);var O=A?I.state===exports.ChatSurfaceState.EXPANDED:N;r.useEffect(function(){A&&d&&S.expand()},[A,d,S]),le(S,b);var F=r.useCallback(function(){A?S.expand():L(!0)},[A,S]),D=r.useCallback(function(){A?S.collapse():(L(!1),null==h||h())},[A,S,h]),H=s.useChatController({network:f,triggerTracking:g,baseTrackingData:_,protocol:p,resolveMerge:l.mergeFor,plugins:x,capability:v,open:O,onOpenChatbot:F,onCloseChatbot:D,chatWindowRefs:R}),P=H.currentChatId,G=H.messages,V=H.chatStack,M=H.previousChats,z=H.previousChatLoading,Y=H.previousChatError,K=H.isInitialLoading,Z=H.isInitialError,X=H.retryInitialChat,Q=H.toast,ee=H.hideToast,te=H.isNewChat,ne=H.isReplyLoading,ie=H.replyLoaderText,re=H.screenRefs,ae=H.showNativeActions,ce=H.chatService,ue=H.isContextSummaryLoading,de=H.contextSummary,he=H.contextSummaryError,fe=H.handleMediaPicked,pe=H.dispatch,ge=H.dispatchAll,_e=H.getPreviousChats,Ce=H.pushToChatStack,xe=H.sendMessage,me=H.stop,ve=H.hasPresented,ye=H.markPresented,Te=H.handleBackButtonClick,Ee=r.useRef(me);Ee.current=me;var je=r.useCallback(function(){var e;A&&(null===(e=Ee.current)||void 0===e||e.call(Ee))},[A]),Ae=r.useRef(I.state);r.useEffect(function(){var e=Ae.current,t=I.state;Ae.current=t,e===exports.ChatSurfaceState.HYBRID&&t===exports.ChatSurfaceState.FLOATING&&je()},[I.state,je]),r.useEffect(function(){A&&Z&&(I.state===exports.ChatSurfaceState.HYBRID&&pe({type:o.ActionType.SHOW_TOAST,payload:{message:"Something went wrong. Please try again."}}),S.showFloating())},[A,Z,S]);var Se=r.useRef(I.state);r.useEffect(function(){var e=Se.current,t=I.state;Se.current=t,A&&Z&&e===exports.ChatSurfaceState.FLOATING&&t===exports.ChatSurfaceState.HYBRID&&X()},[A,I.state,Z,X]);var Ie=r.useRef(!1),be=r.useCallback(function(){var e;pe({type:o.ActionType.RAVEN_TRACKING,payload:{eventName:c.RAVEN_EVENT.U_UI_ACTION,eventData:(e={},e[c.RAVEN_ATTRIBUTE_KEY.ACTION_NAME]=c.RAVEN_ACTION.U_OPEN_SEARCH,e[c.RAVEN_ATTRIBUTE_KEY.ACTION_TYPE]=c.RAVEN_ACTION_TYPE.CLICK,e)}})},[pe]);r.useEffect(function(){if(A)return S.setHandlers({onFloatingPillClick:be}),function(){return S.clearHandlers()}},[A,S,be]),r.useEffect(function(){A&&S.setReplyLoading(ne)},[A,ne,S]),r.useEffect(function(){if(O)return function(){pe({type:o.ActionType.SHOW_NATIVE_ACTIONS,payload:{isNativeActionsEnabled:!1}})}},[O]),r.useEffect(function(){O&&(Ie.current=!0)},[O]),r.useEffect(function(){var e;O&&!K&&P&&Ie.current&&(Ie.current=!1,pe({type:o.ActionType.RAVEN_TRACKING,payload:{eventName:c.RAVEN_EVENT.U_AI_CHAT_PAGELOAD,eventData:(e={},e[c.RAVEN_ATTRIBUTE_KEY.CHAT_HISTORY_FLAG]=te?"new":"existing",e[c.RAVEN_ATTRIBUTE_KEY.CHAT_SESSION_ID]=P,e)}}))},[O,K,P,te,pe]),r.useEffect(function(){var e,t;if(A&&I.state!==exports.ChatSurfaceState.EXPANDED&&P){var n=null!==(t=null===(e=G[P])||void 0===e?void 0:e.messages)&&void 0!==t?t:[];n.forEach(function(e,t){ne&&t===n.length-1||ye(P,e.id)})}},[A,I.state,G,P,ne,ye]);var Re=r.useMemo(function(){var e,t,n=P?G[P]:void 0;return n&&n.status!==s.ChatStatus.CLOSED&&(null!==(t=null===(e=n.messages)||void 0===e?void 0:e.length)&&void 0!==t?t:0)>1?exports.ChatUIStatusValue.ONGOING:exports.ChatUIStatusValue.IDLE},[G,P]);r.useEffect(function(){var e;null===(e=j.current)||void 0===e||e.call(j,{status:Re})},[Re]),r.useLayoutEffect(function(){var e=E.current,t=V.length;if(E.current=t,!(t<=e||t<=1)){var n=re.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})}}},[V.length]);var ke=function(){var e;pe({type:o.ActionType.RAVEN_TRACKING,payload:{eventName:c.RAVEN_EVENT.U_AI_CHAT_BOT_CLOSE,eventData:(e={},e[c.RAVEN_ATTRIBUTE_KEY.CHAT_SESSION_ID]=P,e[c.RAVEN_ATTRIBUTE_KEY.ACTION_NAME]=c.RAVEN_ATTRIBUTE_KEY.ASK_AI_CLOSE_CLICK,e)}}),je(),A?S.collapse():(L(!1),null==h||h())},Be=function(){return n.__awaiter(void 0,void 0,void 0,function(){return n.__generator(this,function(e){return je(),Ce({type:s.ChatPageType.PREVIOUS_CHAT_LISTING}),_e(),[2]})})},we=function(e,t,n){var r=e.type,a=e.id,o=e.retry,l=e.scrollToBottomOnLoad;switch(r){case s.ChatPageType.PREVIOUS_CHAT_LISTING:return i.jsx(q,{chats:M,loading:z,onBack:Te,previousChatError:Y});case s.ChatPageType.CHAT_ERROR:return i.jsx(W,{onClose:ke,onBack:Te,retry:o});case s.ChatPageType.PREVIOUS_CHAT:case s.ChatPageType.CHAT:default:return i.jsx(U,{ref:function(e){R.current[n]=e},chatId:a||"",chatData:G[a||""],sendMessage:xe,onPreviousChatClick:Be,pageType:r,onBackButtonClick:Te,isInitialLoading:K,isReplyLoading:ne,replyLoaderText:ie,isTop:t,onClose:ke,handleMediaPicked:fe,showNativeActions:ae,scrollToBottomOnLoad:l,isContextSummaryLoading:ue,contextSummary:de,contextSummaryError:he,capability:v,onStop:je})}},Ne=r.useMemo(function(){var e,t;return(P&&null!==(t=null===(e=G[P])||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===o.WidgetType.ACTION_HANDLER})})},[G,P]);return i.jsx(s.ChatNetworkProvider,n.__assign({chatService:ce},{children:i.jsxs(s.ChatDispatchProvider,n.__assign({dispatch:pe,dispatchAll:ge,hasPresented:ve,markPresented:ye},{children:[A&&i.jsx($,{visible:!!Q,message:null!==(t=null==Q?void 0:Q.message)&&void 0!==t?t:"",duration:null==Q?void 0:Q.duration,onDismiss:ee},null==Q?void 0:Q.id),A&&I.state!==exports.ChatSurfaceState.EXPANDED&&i.jsxs(i.Fragment,{children:[Ne.map(function(e){var t,r=e.chunk,a=e.key,s=e.messageId,o=n.__assign(n.__assign({},null!==(t=r.metaData)&&void 0!==t?t:{}),{messageId:s,chatId:P,presentOnDispatch:!0});return i.jsx(l.WidgetGenerator,n.__assign({},r,{metaData:o}),a)}),i.jsx(J,{ref:b,visible:I.state===exports.ChatSurfaceState.HYBRID,onPrefixClick:function(){var e;pe({type:o.ActionType.RAVEN_TRACKING,payload:{eventName:c.RAVEN_EVENT.U_UI_ACTION,eventData:(e={},e[c.RAVEN_ATTRIBUTE_KEY.ACTION_NAME]=c.RAVEN_ACTION.U_EXPAND_CHAT,e[c.RAVEN_ATTRIBUTE_KEY.ACTION_TYPE]=c.RAVEN_ACTION_TYPE.CLICK,e)}}),S.expand()},onSuffixClick:function(e){var t;pe({type:o.ActionType.RAVEN_TRACKING,payload:{eventName:c.RAVEN_EVENT.U_UI_ACTION,eventData:(t={},t[c.RAVEN_ATTRIBUTE_KEY.ACTION_NAME]=c.RAVEN_ACTION.U_CLOSE_CHAT,t[c.RAVEN_ATTRIBUTE_KEY.U_FHP_ASKQUESTION]=null!=e?e:"",t[c.RAVEN_ATTRIBUTE_KEY.ACTION_TYPE]=c.RAVEN_ACTION_TYPE.CLICK,t)}}),S.hideHybrid()},sendMessage:xe,isReplyLoading:ne,isInitialLoading:K,capability:v,onStop:je})]}),i.jsx(a.ThemeProvider,{children:i.jsx(a.BottomSheet,n.__assign({isOpen:O,onClose:ke,radius:"md",styleConfig:{bottomSheetContainer:{css:n.__assign(n.__assign({},T.sheetContainer.css),{height:B.current,maxHeight:"".concat(k.current," !important")})}}},{children:i.jsxs(a.Container,n.__assign({css:T.stackContainer},{children:[0===V.length&&K&&i.jsx(a.Container,n.__assign({css:T.loadingContainer},{children:i.jsx(a.Spinner,{variant:"thin",height:"54px",width:"54px",borderColor:y.color.border.link,trackColor:y.color.border.disabledDark})})),V.map(function(e,t){var r,s=t===V.length-1;return i.jsx(a.Container,n.__assign({ref:function(e){re.current[t]=e},css:n.__assign(n.__assign({},T.screenWrapper),{visibility:s?"visible":"hidden"})},{children:we(e,s,t)}),"".concat(e.type,"_").concat(null!==(r=e.id)&&void 0!==r?r:t))})]}))}))})]}))}))},exports.HybridChat=Q,exports.HybridChatWindow=J,exports.getChatSurfaceBridge=re,exports.useChatSurface=oe,exports.useChatSurfaceBridge=se,exports.useHideOnBackgroundInteraction=le;
2
2
  //# sourceMappingURL=talos-chat-ui.browser.cjs.js.map