@cleartrip/talos-chat-ui 1.7.0-beta-260731-3.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ChatWindow/style.d.ts +1 -0
- package/dist/ChatWindow/style.d.ts.map +1 -1
- package/dist/talos-chat-ui.browser.cjs.js +1 -1
- package/dist/talos-chat-ui.browser.cjs.js.map +1 -1
- package/dist/talos-chat-ui.browser.esm.js +1 -1
- package/dist/talos-chat-ui.browser.esm.js.map +1 -1
- package/dist/talos-chat-ui.cjs.js +2 -1
- package/dist/talos-chat-ui.cjs.js.map +1 -1
- package/dist/talos-chat-ui.esm.js +2 -1
- package/dist/talos-chat-ui.esm.js.map +1 -1
- package/dist/talos-chat-ui.umd.js +2 -1
- package/dist/talos-chat-ui.umd.js.map +1 -1
- package/package.json +12 -12
|
@@ -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;AAExD,eAAO,MAAM,MAAM,UAAW,KAAK
|
|
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;AAExD,eAAO,MAAM,MAAM,UAAW,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4FlC,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e,t,n=require("tslib"),i=require("react/jsx-runtime"),r=require("react"),s=require("@cleartrip/ct-design-components"),o=require("@cleartrip/talos-use-chat-controller"),a=require("@cleartrip/talos-widget-types"),l=require("@cleartrip/talos-widget-manager"),c=require("@cleartrip/talos-general-utils"),u=require("@cleartrip/talos-sequential-reveal"),d=require("@cleartrip/talos-background-gradient"),h=require("@cleartrip/talos-use-native-actions"),g=require("uuid"),f=require("@cleartrip/talos-lottie"),p=require("@cleartrip/talos-animated-ticker"),x=require("@cleartrip/talos-horizontal-chip-menu"),C={camera:"image/*",gallery:".jpg,.jpeg,image/jpeg,.png,image/png",file:"application/pdf,.pdf"},_=function(e){var t=e.actions,o=s.useTheme(),a=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"}}}(o)},[o]),l=function(e,t){return"string"==typeof e?i.jsx("img",{src:e,alt:t,height:40,width:40}):e};return i.jsx(s.Box,n.__assign({boxSize:"tiny",horizontal:!0},{children:t.map(function(e){var t=e.label,r=e.onClick,o=e.onButtonClick,c=e.onChange,u=e.icon,d=e.inputType,h=e.isMultiple,g=e.useNativePicker;return i.jsxs(s.Box,n.__assign({boxSize:"micro",css:a.actionBox},{children:[l(u,t),i.jsx(s.Typography,n.__assign({variant:"L3"},{children:t})),d&&(g?i.jsx("button",{type:"button",onClick:o,style:a.hiddenInput,"aria-label":t}):i.jsx("input",n.__assign({type:"file",accept:C[d]},"camera"===d?{capture:"environment"}:{},{onClick:r,onChange:c,style:a.hiddenInput,"aria-label":t,multiple:h})))]}),t)})}))},m=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}}},v=function(e){var t=e.children,o=e.onClick,a=e.styleConfig,l=s.useTheme(),c=r.useMemo(function(){return m(l)},[l]),u=(a||{}).root;return i.jsx(s.Container,n.__assign({onClick:o,css:n.__assign(n.__assign({},c.headerAction),null==u?void 0:u.css)},{children:t}))},y=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"})}))]}))},S=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"})}))},b=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"})}))},k=function(){var e=g.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"})}))]}))},w="Get quick support 24/7",B=function(e){var t=s.useTheme(),o=e.showBackButton,a=void 0!==o&&o,l=e.showCross,c=void 0!==l&&l,u=e.showPreviousChat,d=void 0!==u&&u,h=e.title,g=void 0===h?w:h,f=e.showIcon,p=void 0===f||f,x=e.showNewChat,C=void 0!==x&&x,_=e.isScrolled,B=void 0!==_&&_,T=e.onBackButtonClick,E=e.onCrossClick,I=e.onPreviousChatClick,L=e.onNewChatClick,R=r.useMemo(function(){return m(t,B)},[t,B]);return i.jsxs(s.Container,n.__assign({css:R.root},{children:[i.jsxs(s.Box,n.__assign({boxSize:"tiny",horizontal:!0,css:{alignItems:"center"}},{children:[a&&i.jsx(v,n.__assign({onClick:T},{children:i.jsx(b,{})})),i.jsxs(s.Box,n.__assign({boxSize:"pico",horizontal:!0},{children:[p&&i.jsx(s.Container,n.__assign({css:R.iconContainer},{children:i.jsx(y,{})})),i.jsx(s.Typography,n.__assign({variant:"HM3",styleConfig:{css:R.title},lineClamp:1},{children:g}))]}))]})),i.jsxs(s.Box,n.__assign({boxSize:"tiny",horizontal:!0},{children:[d&&i.jsx(v,n.__assign({onClick:I},{children:i.jsx(j,{})})),C&&i.jsx(v,n.__assign({onClick:L},{children:i.jsx(k,{})})),c&&i.jsx(v,n.__assign({onClick:E},{children:i.jsx(S,{})}))]}))]}))},T=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]}}},E=function(e){var t=e.loaderText,a=void 0===t?"Processing your request":t,l=e.capability,c=void 0===l?o.ChatCapability.CONVERSATIONAL:l,u=s.useTheme(),d=r.useMemo(function(){return T(u)},[u]);return c===o.ChatCapability.SEARCH?i.jsxs(s.Container,n.__assign({css:d.root},{children:[i.jsx(f.Lottie,{lottieId:"AI_LOADER",autoPlay:!0,loop:!0,hasContainer:!0,height:"32px",width:"32px"}),i.jsx(s.Typography,n.__assign({variant:"B3"},{children:a}))]})):i.jsx(f.Lottie,{lottieId:"AI_LOADER",autoPlay:!0,loop:!0,hasContainer:!0,height:"32px",width:"32px"})},I=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"})}))},L=function(e){var t=e.isContextSummaryLoading,o=e.contextSummary,a=s.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)"}}}}}(a)},[a]);if(t)return i.jsxs(s.Box,n.__assign({boxSize:"pico",css:l.loadingContainer},{children:[i.jsx(s.Container,n.__assign({css:l.iconContainer},{children:i.jsx(s.Container,n.__assign({css:l.animatedIcon},{children:i.jsx(I,{})}))})),i.jsx(s.Typography,n.__assign({variant:"B2"},{children:"Updating search context..."}))]}));var u=(o||{}).data,d=void 0===u?{}:u,h=d.contextSummary,g=void 0===h?"Your search context has been updated":h,f=d.filterSummary,p=d.promptMessage,x=c.isEmpty(p)?"How can I help you further?":p;return i.jsx(s.Transition,n.__assign({type:"fade",timeout:400,in:!0},{children:i.jsxs(s.Box,n.__assign({boxSize:"micro",css:l.fadeIn},{children:[i.jsx(s.Typography,n.__assign({variant:"B4CAPS",color:"subheading"},{children:"CONTINUE SEARCHING FOR"})),i.jsxs(s.Container,{children:[i.jsx(s.Typography,n.__assign({variant:"HM4",componentNode:"span"},{children:g})),!c.isEmpty(f)&&i.jsxs(i.Fragment,{children:[i.jsx(s.Typography,n.__assign({variant:"HM4",componentNode:"span"},{children:"・"})),i.jsx(s.Typography,n.__assign({variant:"HM4",componentNode:"span"},{children:f}))]})]}),i.jsx(s.Typography,n.__assign({variant:"P2"},{children:x}))]}))}))},R={delay:3e3,height:40,animateInfinite:!0,duration:650},A={delay:2e3,animateInfinite:!0,duration:650,visibleCount:3,itemGap:12},F=function(e){var t,o,l,c,u=e.data,d=e.shouldHidePills,h=s.useTheme(),g=null!=u?u:{},f=g.heading,C=g.suggestions,_=void 0===C?[]:C,m=null!==(t=null==f?void 0:f.static)&&void 0!==t?t:[],v=null!==(o=null==f?void 0:f.ticker)&&void 0!==o?o:[],y=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"}}}(h)},[h]),j=Math.min(3,_.length),S=32*(l=j)+12*Math.max(0,l-1)+6,b=r.useMemo(function(){return v.map(function(e,t){return i.jsx(s.Typography,n.__assign({variant:"HD3",styleConfig:{css:y.headingTickerText}},{children:e.text}),"".concat(e.text,"-").concat(t))})},[v,y.headingTickerText]),k=r.useMemo(function(){return _.map(function(e){var t=function(e){return{data:{label:e.label},events:{onClick:[{type:a.ActionType.SEND_MESSAGE,payload:{message:e.label}}]}}}(e),n=t.data,r=t.events;return i.jsx(x.HorizontalChipItem,{data:n,events:r},e.id)})},[_]);return i.jsxs(s.Container,n.__assign({css:y.root},{children:[i.jsxs(s.Container,{children:[i.jsx(s.Container,n.__assign({css:y.greetingContainer},{children:i.jsx(s.Typography,n.__assign({variant:s.TypographyVariant.P1},{children:(c=(new Date).getHours(),c<12?"Good morning!":c<18?"Good afternoon!":"Good evening!")}))})),i.jsxs(s.Container,{children:[m.map(function(e,t){return i.jsx(s.Typography,n.__assign({variant:s.TypographyVariant.HD3},{children:e.text}),"".concat(e.text,"-").concat(t))}),i.jsx(p.AnimatedTicker,{elements:b,config:R})]})]}),!d&&i.jsx(p.AnimatedTicker,{elements:k,config:n.__assign(n.__assign({},A),{height:S})})]}))},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"})]}))})]}))},G=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"})]}))})]}))},H=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"})]}))]})]}))},M=r.forwardRef(function(e,t){var g,f=s.useTheme(),p=r.useMemo(function(){return function(e){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:"100px",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:"fixed",bottom:0,left:0,right:0,zIndex:10,pointerEvents:"none"},bgGradientLeft:{position:"absolute",bottom:0,left:0,zIndex:0,pointerEvents:"none"},bgGradientRight:{position:"absolute",bottom:0,right:0,zIndex:0,pointerEvents:"none"},inputContainer:{paddingLeft:e.spacing[4],paddingRight:e.spacing[4],paddingBottom:e.spacing[6],position:"absolute",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]}}}(f)},[f]),x=e.chatId,C=e.chatData,m=e.pageType,v=e.isInitialLoading,y=e.isReplyLoading,j=e.replyLoaderText,S=e.isTop,b=e.showNativeActions,k=e.isContextSummaryLoading,T=e.contextSummaryError,I=e.contextSummary,R=e.capability,A=e.sendMessage,M=e.onPreviousChatClick,P=e.onBackButtonClick,O=e.onClose,N=e.handleMediaPicked,U=e.scrollToBottomOnLoad,z=e.onStop,V=R===o.ChatCapability.SEARCH,W=V&&y,q=r.useState(""),Y=q[0],Z=q[1],X=r.useState(!1),K=X[0],J=X[1],Q=r.useState(!1),$=Q[0],ee=Q[1],te=r.useRef(null),ne=r.useRef([]),ie=r.useRef(null),re=r.useRef(null),se=r.useRef(null),oe=r.useRef(!1),ae=r.useRef(!1),le=o.usePresentation(),ce=le.hasPresented,ue=le.markPresented,de=null!=C?C:{},he=de.messages,ge=void 0===he?[]:he,fe=de.pageData,pe=de.status,xe=de.landingContent,Ce=c.isEmpty(ge)&&!v&&!c.isEmpty(xe),_e=y&&S,me=r.useRef(null),ve=r.useState(!1),ye=ve[0],je=ve[1],Se=r.useRef(null!==(g=null==ge?void 0:ge.length)&&void 0!==g?g:null),be=k||!c.isEmpty(I)||T;r.useEffect(function(){me.current=null,je(!1)},[x]),r.useEffect(function(){be&&(null!==me.current?ge.length>me.current&&je(!0):me.current=ge.length)},[be,ge.length]);var ke=m===o.ChatPageType.CHAT&&be&&!ye,we=fe||{},Be=we.title,Te=void 0===Be?w:Be,Ee=we.newChatEnabled,Ie=we.footerSlots,Le=void 0===Ie?[]:Ie,Re=r.useState(!1),Ae=Re[0],Fe=Re[1],De=r.useState(!1),Ge=De[0],He=De[1],Me=r.useMemo(function(){return m===o.ChatPageType.CHAT?V?"AI Search":w:Te},[m,Te]),Pe=o.useAppDispatch().dispatch,Oe=h.useNativeActions(),Ne=Oe.handleGalleryClick,Ue=Oe.handleCameraClick,ze=Oe.handleUploadChange;r.useEffect(function(){var e;ee(null!=b&&b),b&&(null===(e=te.current)||void 0===e||e.focus())},[b]),r.useEffect(function(){Fe(!v||!S)},[v,S]);var Ve=function(e){Z(e)},We=function(){var e=$;Pe({type:a.ActionType.SHOW_NATIVE_ACTIONS,payload:{isNativeActionsEnabled:!e}}),ee(function(e){return!e})},qe=function(){A(Y),Z(""),setTimeout(function(){var e;null===(e=te.current)||void 0===e||e.blur()},100)},Ye=function(){Ne(N)},Ze=function(){Ue(N)},Xe=function(e){ze(e,N)},Ke="iPhoneApp"===c.checkDeviceType(),Je=[{label:"Gallery",onClick:Ye,onButtonClick:Ye,onChange:Xe,icon:"https://rukmini-ct.flixcart.com/f_auto,q_auto/offermgmt-prod/chatbot/gallery.png",inputType:"gallery",isMultiple:!0,useNativePicker:Ke},{label:"Camera",onClick:Ze,onButtonClick:Ze,onChange:Xe,icon:"https://rukmini-ct.flixcart.com/f_auto,q_auto/offermgmt-prod/chatbot/camera-3d.png",inputType:"camera",useNativePicker:Ke},{label:"Files",onChange:Xe,icon:"https://rukmini-ct.flixcart.com/f_auto,q_auto/offermgmt-prod/chatbot/pdf-3d.png",inputType:"file"}],Qe=function(){var e;Ce?(null===(e=te.current)||void 0===e||e.focus(),J(!0)):Pe({type:a.ActionType.CREATE_NEW_CHAT})},$e=function(e){void 0===e&&(e="auto");var t=null==ie?void 0:ie.current;t&&t.scrollTo({top:t.scrollHeight,behavior:e})};r.useImperativeHandle(t,function(){return{scrollToBottom:$e}},[]);var et=r.useCallback(function(){var e,t,n,i=ie.current,r=re.current;if(i&&r){var s=-1;if(ge)for(var o=ge.length-1;o>=0;o--)if(ge[o].type===a.WidgetType.USER_MESSAGE){s=o;break}if(-1!==s){var l=ne.current[s];if(l){var c=0;for(o=s+1;o<(null!==(e=null==ge?void 0:ge.length)&&void 0!==e?e:0);o++){var u=ne.current[o];u&&(c+=u.offsetHeight)}V&&(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-l.offsetHeight-c);r.style.height="".concat(d,"px")}}else r.style.height="0px"}},[ge,ke]);r.useEffect(function(){if(m===o.ChatPageType.PREVIOUS_CHAT||U)return oe.current=!0,void $e();et();var e=-1;if(ge)for(var t=ge.length-1;t>=0;t--)if(ge[t].type===a.WidgetType.USER_MESSAGE){e=t;break}if(-1!==e){var n=ne.current[e];if(n){ae.current=!0,n.scrollIntoView({behavior:"smooth",block:"start"});var i=ie.current,r=function(){ae.current=!1};null==i||i.addEventListener("scrollend",r,{once:!0}),setTimeout(r,500)}}},[ge,m,et,U]),r.useEffect(function(){var e=ie.current;if(e){var t=new ResizeObserver(function(){m===o.ChatPageType.PREVIOUS_CHAT||U?oe.current&&$e():(ae.current||et(),(v||Se.current===(null==ge?void 0:ge.length))&&$e())});return t.observe(e),ne.current.forEach(function(e){e&&t.observe(e)}),se.current&&t.observe(se.current),function(){return t.disconnect()}}},[ge,et,m,U,ke]),r.useEffect(function(){var e=ie.current;if(e){var t=function(){He(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 tt=r.useMemo(function(){return m===o.ChatPageType.CHAT&&pe!==o.ChatStatus.CLOSED||pe===o.ChatStatus.ON_GOING},[m,pe]),nt=r.useMemo(function(){return pe===o.ChatStatus.CLOSED&&m===o.ChatPageType.CHAT},[m,pe]),it=r.useMemo(function(){return R===o.ChatCapability.SEARCH||Ee&&m!==o.ChatPageType.CHAT},[R,Ee,m]),rt=function(){J(!1)},st=function(){return tt?i.jsxs(s.Container,n.__assign({css:p.inputContainer},{children:[_e&&R===o.ChatCapability.SEARCH&&i.jsx(E,{capability:R,loaderText:j}),i.jsxs(s.Box,n.__assign({boxSize:"tiny"},{children:[i.jsx(s.AiChatInput,{rows:4,value:Y,onChange:Ve,placeholder:"Ask a question",onPrefixClick:We,showKeyboardIcon:$,onSubmit:qe,onBlur:rt,disableAction:y||v,prefix:V?i.jsx(H,{}):void 0,suffix:Y.length>0||W?void 0:i.jsx(i.Fragment,{}),isStreaming:W,onStop:z,ref:te}),$&&i.jsx(_,{actions:Je})]}))]})):null};return i.jsxs(i.Fragment,{children:[i.jsx(B,{showCross:m===o.ChatPageType.CHAT,onCrossClick:function(){null==O||O()},showPreviousChat:m===o.ChatPageType.CHAT,onPreviousChatClick:function(){null==M||M()},showBackButton:m===o.ChatPageType.PREVIOUS_CHAT,onBackButtonClick:function(){null==P||P()},showNewChat:it,onNewChatClick:Qe,showIcon:m===o.ChatPageType.CHAT,title:Me,isScrolled:Ge}),v&&S&&i.jsx(s.Box,n.__assign({boxSize:"tiny",css:n.__assign({},p.loadingContainer)},{children:i.jsx(s.Spinner,{variant:"thin",height:"54px",width:"54px",borderColor:f.color.border.link,trackColor:f.color.border.disabledDark})})),i.jsx(s.Box,n.__assign({boxSize:"tiny",css:p.chatContainer},{children:i.jsxs(s.Box,n.__assign({css:n.__assign(n.__assign({},p.animatedContainer),m===o.ChatPageType.CHAT&&!U&&!V&&{transform:Ae?"translateY(0)":"translateY(25%)",opacity:Ae?1:0}),boxSize:"tiny",ref:ie},{children:[!v&&(null==ge?void 0:ge.map(function(e,t){var r,o=e.id,c=e.type,d=e.chunks,h=e.metaData,g=void 0===h?{}:h,f=((r={})[a.WidgetType.USER_MESSAGE]=p.userMessageContainer,r),C=n.__assign(n.__assign({},g),{messageId:o,chatId:x,messageIndex:t,totalMessages:null==ge?void 0:ge.length,pageType:m}),_=!ce(x,o);return i.jsx(s.Container,n.__assign({css:n.__assign({},f[c]),ref:function(e){ne.current[t]=e}},{children:d.length>0&&i.jsx(u.SequentialReveal,n.__assign({animate:_,onComplete:function(){return ue(x,o)}},{children:d.map(function(e,t){var r,s=n.__assign(n.__assign(n.__assign({},null!==(r=e.metaData)&&void 0!==r?r:{}),C),{animate:_});return i.jsx(l.WidgetGenerator,n.__assign({},e,{metaData:s}),t)})}))}),"".concat(x,"_").concat(o))})),_e&&R===o.ChatCapability.CONVERSATIONAL&&i.jsx(E,{capability:R,loaderText:j}),m===o.ChatPageType.CHAT&&i.jsx(s.Container,{ref:re,css:{flexShrink:0}}),c.isEmpty(ge)&&!v&&xe&&i.jsx(F,{data:xe,shouldHidePills:ke||K||Y.length>=3}),ke&&i.jsx(s.Container,n.__assign({ref:se,css:{marginTop:"auto",paddingTop:"12px"}},{children:i.jsx(L,{contextSummary:I,isContextSummaryLoading:k,contextSummaryError:T})}))]}))})),V?i.jsx(d.BackgroundGradient,n.__assign({variant:W?d.BackgroundGradientVariant.PROCESSING:d.BackgroundGradientVariant.DEFAULT,styleConfig:{root:{css:p.bgGradient}}},{children:st()})):i.jsxs(i.Fragment,{children:[i.jsx(D,{style:p.bgGradientLeft}),i.jsx(G,{style:p.bgGradientRight})]}),!V&&st(),nt&&i.jsxs(s.Container,n.__assign({css:p.newChatContainer},{children:[i.jsx(s.Typography,n.__assign({variant:"P3",styleConfig:{css:p.chatClosedMessage}},{children:"This query has been closed, If you have a query regarding this trip, you can start a new chat."})),i.jsx(s.Button,n.__assign({variant:"contained",color:"primary",isFullWidth:!0,onClick:Qe},{children:"Start New Chat"}))]})),m===o.ChatPageType.PREVIOUS_CHAT&&i.jsx(s.Container,{children:null==Le?void 0:Le.map(function(e,t){var r=e.type,s=n.__rest(e,["type"]),o="".concat(r,"_").concat(t);return i.jsx(l.WidgetGenerator,n.__assign({type:r},s),o)})})]})}),P=r.memo(M),O=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"}}},N=function(){var e=s.useTheme(),t=r.useMemo(function(){return O(e)},[e]);return i.jsx(s.Container,n.__assign({css:t.shimmerContainer},{children:i.jsxs(s.Box,n.__assign({boxSize:"tiny"},{children:[i.jsx(s.Shimmer,{height:e.size[5],width:"120px"}),Array.from({length:3}).map(function(r,o){return i.jsxs(s.Box,n.__assign({boxSize:"nano",css:t.shimmerCard},{children:[i.jsx(s.Shimmer,{height:e.size[4],width:"150px"}),i.jsx(s.Shimmer,{height:e.size[4],width:"200px"})]}),o)})]}))}))};!function(e){e.ERROR="error",e.EMPTY="empty"}(e||(e={}));var U,z=((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),V=function(t){var l=t.variant,c=void 0===l?e.ERROR:l,u=s.useTheme(),d=r.useMemo(function(){return O(u)},[u]),h=o.useAppDispatch().dispatch;return i.jsx(s.Container,n.__assign({css:d.bodyContainer},{children:i.jsxs(s.Box,n.__assign({boxSize:"medium",css:d.errorContainer},{children:[i.jsx("img",{src:z[c].icon,alt:c,height:100,width:100}),i.jsxs(s.Box,n.__assign({boxSize:"small",css:d.labelContainer},{children:[i.jsx(s.Typography,n.__assign({variant:"HM3",styleConfig:{css:d.errorText}},{children:z[c].text})),i.jsx(s.Button,n.__assign({variant:"outline",onClick:function(){c===e.ERROR?h({type:a.ActionType.REFETCH_PREVIOUS_CHAT}):h({type:a.ActionType.CREATE_NEW_CHAT})},css:d.errorButton},{children:z[c].buttonLabel}))]}))]}))}))},W=r.memo(function(t){var c=t.chats,u=t.loading,d=void 0!==u&&u,h=t.onBack,g=t.previousChatError,f=null!=c?c:{},p=f.previousChats,x=void 0===p?[]:p,C=f.pageData,_=null!=C?C:{},m=_.newChatEnabled,v=_.chatCount,y=s.useTheme(),j=r.useMemo(function(){return O(y)},[y]),S=o.useAppDispatch().dispatch,b=r.useRef(null),k=r.useState(!1),w=k[0],T=k[1];r.useEffect(function(){var e=b.current;if(e){var t=function(){T(e.scrollTop>0)};return t(),e.addEventListener("scroll",t,{passive:!0}),function(){return e.removeEventListener("scroll",t)}}},[d,x.length]);return i.jsxs(s.Container,n.__assign({css:j.root},{children:[i.jsx(B,{showCross:!1,showPreviousChat:!1,showBackButton:!0,onBackButtonClick:h,title:"Past Conversations",showNewChat:m,onNewChatClick:function(){S({type:a.ActionType.CREATE_NEW_CHAT})},showIcon:!1,isScrolled:w}),d&&i.jsx(N,{}),!d&&(g?i.jsx(V,{variant:e.ERROR}):0===v?i.jsx(V,{variant:e.EMPTY}):null),!d&&x.length>0&&!!v&&v>0&&i.jsx(s.Box,n.__assign({boxSize:"medium",css:j.listContainer,ref:b},{children:x.map(function(e,t){var n=e.type,r=e.data,s="".concat(n,"_").concat(t);return i.jsx(l.WidgetGenerator,{type:n,data:r},s)})})),i.jsx(D,{style:j.bgGradientLeft}),i.jsx(G,{style:j.bgGradientRight})]}))}),q=function(e){var t=e.onClose,l=e.onBack,c=e.retry,u=s.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=o.useAppDispatch().dispatch,g=(null==c?void 0:c.kind)===o.ChatErrorKind.PREVIOUS;return i.jsxs(i.Fragment,{children:[i.jsx(B,{showBackButton:g,onBackButtonClick:l,showCross:!g,onCrossClick:t,showIcon:!1,title:""}),i.jsx(s.Container,n.__assign({css:d.bodyContainer},{children:i.jsxs(s.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(s.Box,n.__assign({boxSize:"small",css:d.labelContainer},{children:[i.jsx(s.Typography,n.__assign({variant:"HM3",styleConfig:{css:d.errorText}},{children:"Oops, we couldn't load the chat"})),i.jsx(s.Button,n.__assign({variant:"outline",onClick:function(){h({type:a.ActionType.RETRY_CHAT_ERROR})},css:d.errorButton},{children:"Try again"}))]}))]}))})),i.jsx(D,{style:d.bgGradientLeft}),i.jsx(G,{style:d.bgGradientRight})]})},Y=function(e){var t=e.loading,o=void 0!==t&&t,a=s.useTheme(),l=r.useMemo(function(){return T(a)},[a]);return o?i.jsxs(s.Container,n.__assign({css:l.initLoader},{children:[i.jsx(s.DottedLoader,{}),i.jsx(s.Typography,n.__assign({variant:"B3"},{children:"Getting ready"}))]})):null},Z=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"})}))},X=function(e){var t=e.onPrefixClick,a=e.onSuffixClick,l=e.sendMessage,c=e.isReplyLoading,u=void 0!==c&&c,d=e.capability,h=void 0===d?o.ChatCapability.CONVERSATIONAL:d,g=e.onStop,f=h===o.ChatCapability.SEARCH,p=f&&u,x=r.useState(""),C=x[0],_=x[1],m=r.useState(!1),y=m[0],j=m[1],b=r.useRef(null),k=s.useTheme(),w=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}}}(k)},[k]),B=r.useMemo(function(){return n.__assign({},y?w.headerActionCollapsed:{})},[y,w]),T=r.useMemo(function(){return n.__assign({},y?w.headerActionCollapsed:{})},[y,u,w]);return i.jsxs(s.ThemeProvider,{children:[u&&i.jsx(E,{capability:o.ChatCapability.SEARCH}),i.jsxs(s.Box,n.__assign({boxSize:"micro",horizontal:!0,css:w.root},{children:[!p&&i.jsx(v,n.__assign({onClick:t,styleConfig:{root:{css:n.__assign(n.__assign({},w.headerAction),B)}}},{children:i.jsx(Z,{})})),i.jsx(s.Container,n.__assign({css:w.inputWrapper},{children:i.jsx(s.AiChatInput,{ref:b,value:C,onChange:function(e){_(e)},onFocus:function(){j(!0)},onBlur:function(){j(!1)},onSubmit:function(){var e=C.trim();e&&!u&&(null==l||l(e),_(""),setTimeout(function(){var e;null===(e=b.current)||void 0===e||e.blur()},100))},disableAction:u,prefix:f?i.jsx(H,{}):void 0,suffix:C.length>0||p?void 0:i.jsx(i.Fragment,{}),isStreaming:p,onStop:g,placeholder:"Ask a question"})})),!p&&i.jsx(v,n.__assign({onClick:a,styleConfig:{root:{css:n.__assign(n.__assign({},w.headerAction),T)}}},{children:i.jsx(S,{})}))]}))]})},K=r.forwardRef(function(e,t){var a=e.onPrefixClick,l=e.onSuffixClick,c=e.sendMessage,u=e.isReplyLoading,h=e.visible,g=void 0===h||h,f=e.isInitialLoading,p=void 0!==f&&f,x=e.capability,C=e.onStop,_=s.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}}},[_]),v=x===o.ChatCapability.SEARCH&&u;return i.jsx(s.ThemeProvider,{children:i.jsx(s.Container,n.__assign({css:m.root},{children:i.jsx(s.Transition,n.__assign({type:"fade",timeout:400,appear:!0,mountOnEnter:!0,unmountOnExit:!0,in:g},{children:i.jsxs(s.Container,{children:[i.jsx(d.BackgroundGradient,{variant:v?d.BackgroundGradientVariant.PROCESSING:d.BackgroundGradientVariant.DEFAULT,styleConfig:{root:{css:m.backgroundGradient}}}),i.jsx(s.Transition,n.__assign({type:"slide",slideDirection:"up",timeout:400,appear:!0,mountOnEnter:!0,unmountOnExit:!0,in:g},{children:i.jsx(s.Container,n.__assign({css:m.content,ref:t},{children:p?i.jsx(Y,{loading:p}):i.jsx(X,{onPrefixClick:a,onSuffixClick:l,sendMessage:c,isReplyLoading:u,capability:x,onStop:C})}))}))]})}))}))})}),J=function(e){var t=e.visible,n=e.message,o=e.onDismiss,a=e.duration,l=void 0===a?3e3:a,c=s.useTheme(),u=r.useMemo(function(){return{toastContainer:{bottom:"100px"}}},[c]);return r.useEffect(function(){if(t){var e=setTimeout(function(){return null==o?void 0:o()},l+500);return function(){return clearTimeout(e)}}},[t,l,o]),t?i.jsx(s.Toast,{show:!0,text:n,isAutoClose:!0,closeTimeout:l,styleConfig:{toastContainer:{css:u.toastContainer}}}):null};exports.ChatSurfaceState=void 0,(U=exports.ChatSurfaceState||(exports.ChatSurfaceState={})).FLOATING="FLOATING",U.HYBRID="HYBRID",U.EXPANDED="EXPANDED";var Q,$,ee=function(e){void 0===e&&(e=exports.ChatSurfaceState.FLOATING);var t=this;this.listeners=new Set,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.snapshot={state:e,isReplyLoading:!1}},te=null,ne=function(){return te||(te=new ee),te},ie=r.createContext(null),re=function(){var e=r.useContext(ie);return null!=e?e:ne()},se=function(e){var t=re(),n=null!=e?e:t;return r.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getSnapshot)},oe=function(e,t){var n=se(e).state;r.useEffect(function(){if(n===exports.ChatSurfaceState.HYBRID&&"undefined"!=typeof window){var i=Date.now(),r=function(){return Date.now()-i<400},s=function(e){var n;return!(!e||!(null===(n=t.current)||void 0===n?void 0:n.contains(e)))},o=!1,a=function(e){o=!s(e.target)&&s(document.activeElement)},l=function(t){s(t.target)||(t.stopPropagation(),t.preventDefault(),r()||(o?o=!1:e.hideHybrid()))},c=function(e){r()&&(s(e.target)||(e.stopPropagation(),e.preventDefault()))},u={capture:!0};return document.addEventListener("pointerdown",a,u),document.addEventListener("mousedown",c,u),document.addEventListener("mouseup",c,u),document.addEventListener("click",l,u),function(){document.removeEventListener("pointerdown",a,u),document.removeEventListener("mousedown",c,u),document.removeEventListener("mouseup",c,u),document.removeEventListener("click",l,u)}}},[n,e,t])};exports.ChatUIStatusValue=void 0,(Q=exports.ChatUIStatusValue||(exports.ChatUIStatusValue={})).ONGOING="ongoing",Q.IDLE="idle",exports.ChatView=void 0,($=exports.ChatView||(exports.ChatView={})).CHAT="CHAT",$.PREVIOUS_CHATS="PREVIOUS_CHATS";exports.ChatSurfaceBridge=ee,exports.ChatSurfaceProvider=function(e){var t=e.children,s=e.bridge,o=e.initialState,a=r.useRef();return a.current||(a.current=null!=s?s:new ee(o)),i.jsx(ie.Provider,n.__assign({value:a.current},{children:t}))},exports.ChatUI=function(e){var t,u=e.open,d=void 0===u||u,h=e.onClose,g=e.network,f=e.protocol,p=e.triggerTracking,x=e.baseTrackingData,C=e.onChatStateChange,_=e.plugins,m=e.capability,v=void 0===m?o.ChatCapability.CONVERSATIONAL:m,y=s.useTheme(),j=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]),S=r.useRef(0),b=r.useRef(C);b.current=C;var k=v===o.ChatCapability.SEARCH,w=re(),B=se(w),T=r.useRef(null),E=r.useRef([]),I=r.useState(d),L=I[0],R=I[1];r.useEffect(function(){R(d)},[d]);var A=k?B.state===exports.ChatSurfaceState.EXPANDED:L;r.useEffect(function(){k&&d&&w.expand()},[k,d,w]),oe(w,T);var F=r.useCallback(function(){k?w.expand():R(!0)},[k,w]),D=r.useCallback(function(){k?w.collapse():(R(!1),null==h||h())},[k,w,h]),G=o.useChatController({network:g,triggerTracking:p,baseTrackingData:x,protocol:f,resolveMerge:l.mergeFor,plugins:_,capability:v,open:A,onOpenChatbot:F,onCloseChatbot:D,chatWindowRefs:E}),H=G.currentChatId,M=G.messages,O=G.chatStack,N=G.previousChats,U=G.previousChatLoading,z=G.previousChatError,V=G.isInitialLoading,Y=G.isInitialError,Z=G.retryInitialChat,X=G.toast,Q=G.hideToast,$=G.isNewChat,ee=G.isReplyLoading,te=G.replyLoaderText,ne=G.screenRefs,ie=G.showNativeActions,ae=G.chatService,le=G.isContextSummaryLoading,ce=G.contextSummary,ue=G.contextSummaryError,de=G.handleMediaPicked,he=G.dispatch,ge=G.dispatchAll,fe=G.getPreviousChats,pe=G.pushToChatStack,xe=G.sendMessage,Ce=G.stop,_e=G.hasPresented,me=G.markPresented,ve=G.handleBackButtonClick,ye=r.useRef(Ce);ye.current=Ce;var je=r.useCallback(function(){var e;k&&(null===(e=ye.current)||void 0===e||e.call(ye))},[k]),Se=r.useRef(B.state);r.useEffect(function(){var e=Se.current,t=B.state;Se.current=t,e===exports.ChatSurfaceState.HYBRID&&t===exports.ChatSurfaceState.FLOATING&&je()},[B.state,je]),r.useEffect(function(){k&&Y&&(B.state===exports.ChatSurfaceState.HYBRID&&he({type:a.ActionType.SHOW_TOAST,payload:{message:"Something went wrong. Please try again."}}),w.showFloating())},[k,Y,w]);var be=r.useRef(B.state);r.useEffect(function(){var e=be.current,t=B.state;be.current=t,k&&Y&&e===exports.ChatSurfaceState.FLOATING&&t===exports.ChatSurfaceState.HYBRID&&Z()},[k,B.state,Y,Z]);var ke=r.useRef(!1);r.useEffect(function(){k&&w.setReplyLoading(ee)},[k,ee,w]),r.useEffect(function(){if(A)return document.body.style.overflowY="hidden",function(){document.body.style.overflowY="auto",he({type:a.ActionType.SHOW_NATIVE_ACTIONS,payload:{isNativeActionsEnabled:!1}})}},[A]),r.useEffect(function(){A&&(ke.current=!0)},[A]),r.useEffect(function(){A&&!V&&H&&ke.current&&(ke.current=!1,he({type:a.ActionType.RAVEN_TRACKING,payload:{eventName:"u_ai_chat_pageload",eventData:{chat_history_flag:$?"new":"existing",chat_session_id:H}}}))},[A,V,H,$,he]),r.useEffect(function(){var e,t;if(k&&B.state!==exports.ChatSurfaceState.EXPANDED&&H){var n=null!==(t=null===(e=M[H])||void 0===e?void 0:e.messages)&&void 0!==t?t:[];n.forEach(function(e,t){ee&&t===n.length-1||me(H,e.id)})}},[k,B.state,M,H,ee,me]);var we=r.useMemo(function(){var e,t,n=H?M[H]:void 0;return n&&n.status!==o.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},[M,H]);r.useEffect(function(){var e;null===(e=b.current)||void 0===e||e.call(b,{status:we})},[we]),r.useLayoutEffect(function(){var e=S.current,t=O.length;if(S.current=t,!(t<=e||t<=1)){var n=ne.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})}}},[O.length]);var Be=function(){he({type:a.ActionType.RAVEN_TRACKING,payload:{eventName:"u_ai_chat_bot_close",eventData:{chat_session_id:H,action_name:"ask_ai_close_click"}}}),je(),k?w.collapse():(R(!1),null==h||h())},Te=function(){return n.__awaiter(void 0,void 0,void 0,function(){return n.__generator(this,function(e){return je(),pe({type:o.ChatPageType.PREVIOUS_CHAT_LISTING}),fe(),[2]})})},Ee=function(e,t,n){var r=e.type,s=e.id,a=e.retry,l=e.scrollToBottomOnLoad;switch(r){case o.ChatPageType.PREVIOUS_CHAT_LISTING:return i.jsx(W,{chats:N,loading:U,onBack:ve,previousChatError:z});case o.ChatPageType.CHAT_ERROR:return i.jsx(q,{onClose:Be,onBack:ve,retry:a});case o.ChatPageType.PREVIOUS_CHAT:case o.ChatPageType.CHAT:default:return i.jsx(P,{ref:function(e){E.current[n]=e},chatId:s||"",chatData:M[s||""],sendMessage:xe,onPreviousChatClick:Te,pageType:r,onBackButtonClick:ve,isInitialLoading:V,isReplyLoading:ee,replyLoaderText:te,isTop:t,onClose:Be,handleMediaPicked:de,showNativeActions:ie,scrollToBottomOnLoad:l,isContextSummaryLoading:le,contextSummary:ce,contextSummaryError:ue,capability:v,onStop:je})}},Ie=r.useMemo(function(){var e,t;return(H&&null!==(t=null===(e=M[H])||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===a.WidgetType.ACTION_HANDLER})})},[M,H]);return i.jsxs(i.Fragment,{children:[k&&i.jsx(J,{visible:!!X,message:null!==(t=null==X?void 0:X.message)&&void 0!==t?t:"",duration:null==X?void 0:X.duration,onDismiss:Q},null==X?void 0:X.id),k&&B.state!==exports.ChatSurfaceState.EXPANDED&&i.jsxs(i.Fragment,{children:[i.jsx(o.ChatDispatchProvider,n.__assign({dispatch:he,dispatchAll:ge,hasPresented:_e,markPresented:me},{children:Ie.map(function(e){var t,r=e.chunk,s=e.key,o=e.messageId,a=n.__assign(n.__assign({},null!==(t=r.metaData)&&void 0!==t?t:{}),{messageId:o,chatId:H,presentOnDispatch:!0});return i.jsx(l.WidgetGenerator,n.__assign({},r,{metaData:a}),s)})})),i.jsx(K,{ref:T,visible:B.state===exports.ChatSurfaceState.HYBRID,onPrefixClick:w.expand,onSuffixClick:w.hideHybrid,sendMessage:xe,isReplyLoading:ee,isInitialLoading:V,capability:v,onStop:je})]}),i.jsx(s.ThemeProvider,{children:i.jsx(s.BottomSheet,n.__assign({isOpen:A,onClose:Be,radius:"md",styleConfig:{bottomSheetContainer:{css:n.__assign(n.__assign({},j.sheetContainer.css),{height:function(){if(c.isServer())return"94vh";var e=.94*window.innerHeight;return"".concat(e,"px")}()})}},disablePortal:!0},{children:i.jsx(o.ChatNetworkProvider,n.__assign({chatService:ae},{children:i.jsx(o.ChatDispatchProvider,n.__assign({dispatch:he,dispatchAll:ge,hasPresented:_e,markPresented:me},{children:i.jsxs(s.Container,n.__assign({css:j.stackContainer},{children:[0===O.length&&V&&i.jsx(s.Container,n.__assign({css:j.loadingContainer},{children:i.jsx(s.Spinner,{variant:"thin",height:"54px",width:"54px",borderColor:y.color.border.link,trackColor:y.color.border.disabledDark})})),O.map(function(e,t){var r,o=t===O.length-1;return i.jsx(s.Container,n.__assign({ref:function(e){ne.current[t]=e},css:n.__assign(n.__assign({},j.screenWrapper),{visibility:o?"visible":"hidden"})},{children:Ee(e,o,t)}),"".concat(e.type,"_").concat(null!==(r=e.id)&&void 0!==r?r:t))})]}))}))}))}))})]})},exports.HybridChat=X,exports.HybridChatWindow=K,exports.getChatSurfaceBridge=ne,exports.useChatSurface=se,exports.useChatSurfaceBridge=re,exports.useHideOnBackgroundInteraction=oe;
|
|
1
|
+
"use strict";var e,t,n=require("tslib"),i=require("react/jsx-runtime"),r=require("react"),s=require("@cleartrip/ct-design-components"),o=require("@cleartrip/talos-use-chat-controller"),a=require("@cleartrip/talos-widget-types"),l=require("@cleartrip/talos-widget-manager"),c=require("@cleartrip/talos-general-utils"),u=require("@cleartrip/talos-sequential-reveal"),d=require("@cleartrip/talos-background-gradient"),h=require("@cleartrip/talos-use-native-actions"),g=require("uuid"),f=require("@cleartrip/talos-lottie"),p=require("@cleartrip/talos-animated-ticker"),x=require("@cleartrip/talos-horizontal-chip-menu"),C={camera:"image/*",gallery:".jpg,.jpeg,image/jpeg,.png,image/png",file:"application/pdf,.pdf"},_=function(e){var t=e.actions,o=s.useTheme(),a=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"}}}(o)},[o]),l=function(e,t){return"string"==typeof e?i.jsx("img",{src:e,alt:t,height:40,width:40}):e};return i.jsx(s.Box,n.__assign({boxSize:"tiny",horizontal:!0},{children:t.map(function(e){var t=e.label,r=e.onClick,o=e.onButtonClick,c=e.onChange,u=e.icon,d=e.inputType,h=e.isMultiple,g=e.useNativePicker;return i.jsxs(s.Box,n.__assign({boxSize:"micro",css:a.actionBox},{children:[l(u,t),i.jsx(s.Typography,n.__assign({variant:"L3"},{children:t})),d&&(g?i.jsx("button",{type:"button",onClick:o,style:a.hiddenInput,"aria-label":t}):i.jsx("input",n.__assign({type:"file",accept:C[d]},"camera"===d?{capture:"environment"}:{},{onClick:r,onChange:c,style:a.hiddenInput,"aria-label":t,multiple:h})))]}),t)})}))},m=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}}},v=function(e){var t=e.children,o=e.onClick,a=e.styleConfig,l=s.useTheme(),c=r.useMemo(function(){return m(l)},[l]),u=(a||{}).root;return i.jsx(s.Container,n.__assign({onClick:o,css:n.__assign(n.__assign({},c.headerAction),null==u?void 0:u.css)},{children:t}))},y=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"})}))]}))},S=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"})}))},b=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"})}))},k=function(){var e=g.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"})}))]}))},w="Get quick support 24/7",B=function(e){var t=s.useTheme(),o=e.showBackButton,a=void 0!==o&&o,l=e.showCross,c=void 0!==l&&l,u=e.showPreviousChat,d=void 0!==u&&u,h=e.title,g=void 0===h?w:h,f=e.showIcon,p=void 0===f||f,x=e.showNewChat,C=void 0!==x&&x,_=e.isScrolled,B=void 0!==_&&_,T=e.onBackButtonClick,E=e.onCrossClick,I=e.onPreviousChatClick,L=e.onNewChatClick,R=r.useMemo(function(){return m(t,B)},[t,B]);return i.jsxs(s.Container,n.__assign({css:R.root},{children:[i.jsxs(s.Box,n.__assign({boxSize:"tiny",horizontal:!0,css:{alignItems:"center"}},{children:[a&&i.jsx(v,n.__assign({onClick:T},{children:i.jsx(b,{})})),i.jsxs(s.Box,n.__assign({boxSize:"pico",horizontal:!0},{children:[p&&i.jsx(s.Container,n.__assign({css:R.iconContainer},{children:i.jsx(y,{})})),i.jsx(s.Typography,n.__assign({variant:"HM3",styleConfig:{css:R.title},lineClamp:1},{children:g}))]}))]})),i.jsxs(s.Box,n.__assign({boxSize:"tiny",horizontal:!0},{children:[d&&i.jsx(v,n.__assign({onClick:I},{children:i.jsx(j,{})})),C&&i.jsx(v,n.__assign({onClick:L},{children:i.jsx(k,{})})),c&&i.jsx(v,n.__assign({onClick:E},{children:i.jsx(S,{})}))]}))]}))},T=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]}}},E=function(e){var t=e.loaderText,a=void 0===t?"Processing your request":t,l=e.capability,c=void 0===l?o.ChatCapability.CONVERSATIONAL:l,u=s.useTheme(),d=r.useMemo(function(){return T(u)},[u]);return c===o.ChatCapability.SEARCH?i.jsxs(s.Container,n.__assign({css:d.root},{children:[i.jsx(f.Lottie,{lottieId:"AI_LOADER",autoPlay:!0,loop:!0,hasContainer:!0,height:"32px",width:"32px"}),i.jsx(s.Typography,n.__assign({variant:"B3"},{children:a}))]})):i.jsx(f.Lottie,{lottieId:"AI_LOADER",autoPlay:!0,loop:!0,hasContainer:!0,height:"32px",width:"32px"})},I=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"})}))},L=function(e){var t=e.isContextSummaryLoading,o=e.contextSummary,a=s.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)"}}}}}(a)},[a]);if(t)return i.jsxs(s.Box,n.__assign({boxSize:"pico",css:l.loadingContainer},{children:[i.jsx(s.Container,n.__assign({css:l.iconContainer},{children:i.jsx(s.Container,n.__assign({css:l.animatedIcon},{children:i.jsx(I,{})}))})),i.jsx(s.Typography,n.__assign({variant:"B2"},{children:"Updating search context..."}))]}));var u=(o||{}).data,d=void 0===u?{}:u,h=d.contextSummary,g=void 0===h?"Your search context has been updated":h,f=d.filterSummary,p=d.promptMessage,x=c.isEmpty(p)?"How can I help you further?":p;return i.jsx(s.Transition,n.__assign({type:"fade",timeout:400,in:!0},{children:i.jsxs(s.Box,n.__assign({boxSize:"micro",css:l.fadeIn},{children:[i.jsx(s.Typography,n.__assign({variant:"B4CAPS",color:"subheading"},{children:"CONTINUE SEARCHING FOR"})),i.jsxs(s.Container,{children:[i.jsx(s.Typography,n.__assign({variant:"HM4",componentNode:"span"},{children:g})),!c.isEmpty(f)&&i.jsxs(i.Fragment,{children:[i.jsx(s.Typography,n.__assign({variant:"HM4",componentNode:"span"},{children:"・"})),i.jsx(s.Typography,n.__assign({variant:"HM4",componentNode:"span"},{children:f}))]})]}),i.jsx(s.Typography,n.__assign({variant:"P2"},{children:x}))]}))}))},R={delay:3e3,height:40,animateInfinite:!0,duration:650},A={delay:2e3,animateInfinite:!0,duration:650,visibleCount:3,itemGap:12},F=function(e){var t,o,l,c,u=e.data,d=e.shouldHidePills,h=s.useTheme(),g=null!=u?u:{},f=g.heading,C=g.suggestions,_=void 0===C?[]:C,m=null!==(t=null==f?void 0:f.static)&&void 0!==t?t:[],v=null!==(o=null==f?void 0:f.ticker)&&void 0!==o?o:[],y=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"}}}(h)},[h]),j=Math.min(3,_.length),S=32*(l=j)+12*Math.max(0,l-1)+6,b=r.useMemo(function(){return v.map(function(e,t){return i.jsx(s.Typography,n.__assign({variant:"HD3",styleConfig:{css:y.headingTickerText}},{children:e.text}),"".concat(e.text,"-").concat(t))})},[v,y.headingTickerText]),k=r.useMemo(function(){return _.map(function(e){var t=function(e){return{data:{label:e.label},events:{onClick:[{type:a.ActionType.SEND_MESSAGE,payload:{message:e.label}}]}}}(e),n=t.data,r=t.events;return i.jsx(x.HorizontalChipItem,{data:n,events:r},e.id)})},[_]);return i.jsxs(s.Container,n.__assign({css:y.root},{children:[i.jsxs(s.Container,{children:[i.jsx(s.Container,n.__assign({css:y.greetingContainer},{children:i.jsx(s.Typography,n.__assign({variant:s.TypographyVariant.P1},{children:(c=(new Date).getHours(),c<12?"Good morning!":c<18?"Good afternoon!":"Good evening!")}))})),i.jsxs(s.Container,{children:[m.map(function(e,t){return i.jsx(s.Typography,n.__assign({variant:s.TypographyVariant.HD3},{children:e.text}),"".concat(e.text,"-").concat(t))}),i.jsx(p.AnimatedTicker,{elements:b,config:R})]})]}),!d&&i.jsx(p.AnimatedTicker,{elements:k,config:n.__assign(n.__assign({},A),{height:S})})]}))},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"})]}))})]}))},G=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"})]}))})]}))},H=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"})]}))]})]}))},M=r.forwardRef(function(e,t){var g,f=s.useTheme(),p=r.useMemo(function(){return function(e){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:"100px",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:0,pointerEvents:"none"},bgGradientRight:{position:"absolute",bottom:0,right:0,zIndex:0,pointerEvents:"none"},inputContainer:{paddingLeft:e.spacing[4],paddingRight:e.spacing[4],paddingBottom:e.spacing[6],position:"absolute",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]}}}(f)},[f]),x=e.chatId,C=e.chatData,m=e.pageType,v=e.isInitialLoading,y=e.isReplyLoading,j=e.replyLoaderText,S=e.isTop,b=e.showNativeActions,k=e.isContextSummaryLoading,T=e.contextSummaryError,I=e.contextSummary,R=e.capability,A=e.sendMessage,M=e.onPreviousChatClick,P=e.onBackButtonClick,O=e.onClose,N=e.handleMediaPicked,U=e.scrollToBottomOnLoad,z=e.onStop,V=R===o.ChatCapability.SEARCH,W=V&&y,q=r.useState(""),Y=q[0],Z=q[1],X=r.useState(!1),K=X[0],J=X[1],Q=r.useState(!1),$=Q[0],ee=Q[1],te=r.useRef(null),ne=r.useRef([]),ie=r.useRef(null),re=r.useRef(null),se=r.useRef(null),oe=r.useRef(!1),ae=r.useRef(!1),le=o.usePresentation(),ce=le.hasPresented,ue=le.markPresented,de=null!=C?C:{},he=de.messages,ge=void 0===he?[]:he,fe=de.pageData,pe=de.status,xe=de.landingContent,Ce=c.isEmpty(ge)&&!v&&!c.isEmpty(xe),_e=y&&S,me=r.useRef(null),ve=r.useState(!1),ye=ve[0],je=ve[1],Se=r.useRef(null!==(g=null==ge?void 0:ge.length)&&void 0!==g?g:null),be=k||!c.isEmpty(I)||T;r.useEffect(function(){me.current=null,je(!1)},[x]),r.useEffect(function(){be&&(null!==me.current?ge.length>me.current&&je(!0):me.current=ge.length)},[be,ge.length]);var ke=m===o.ChatPageType.CHAT&&be&&!ye,we=fe||{},Be=we.title,Te=void 0===Be?w:Be,Ee=we.newChatEnabled,Ie=we.footerSlots,Le=void 0===Ie?[]:Ie,Re=r.useState(!1),Ae=Re[0],Fe=Re[1],De=r.useState(!1),Ge=De[0],He=De[1],Me=r.useMemo(function(){return m===o.ChatPageType.CHAT?V?"AI Search":w:Te},[m,Te]),Pe=o.useAppDispatch().dispatch,Oe=h.useNativeActions(),Ne=Oe.handleGalleryClick,Ue=Oe.handleCameraClick,ze=Oe.handleUploadChange;r.useEffect(function(){var e;ee(null!=b&&b),b&&(null===(e=te.current)||void 0===e||e.focus())},[b]),r.useEffect(function(){Fe(!v||!S)},[v,S]);var Ve=function(e){Z(e)},We=function(){var e=$;Pe({type:a.ActionType.SHOW_NATIVE_ACTIONS,payload:{isNativeActionsEnabled:!e}}),ee(function(e){return!e})},qe=function(){A(Y),Z(""),setTimeout(function(){var e;null===(e=te.current)||void 0===e||e.blur()},100)},Ye=function(){Ne(N)},Ze=function(){Ue(N)},Xe=function(e){ze(e,N)},Ke="iPhoneApp"===c.checkDeviceType(),Je=[{label:"Gallery",onClick:Ye,onButtonClick:Ye,onChange:Xe,icon:"https://rukmini-ct.flixcart.com/f_auto,q_auto/offermgmt-prod/chatbot/gallery.png",inputType:"gallery",isMultiple:!0,useNativePicker:Ke},{label:"Camera",onClick:Ze,onButtonClick:Ze,onChange:Xe,icon:"https://rukmini-ct.flixcart.com/f_auto,q_auto/offermgmt-prod/chatbot/camera-3d.png",inputType:"camera",useNativePicker:Ke},{label:"Files",onChange:Xe,icon:"https://rukmini-ct.flixcart.com/f_auto,q_auto/offermgmt-prod/chatbot/pdf-3d.png",inputType:"file"}],Qe=function(){var e;Ce?(null===(e=te.current)||void 0===e||e.focus(),J(!0)):Pe({type:a.ActionType.CREATE_NEW_CHAT})},$e=function(e){void 0===e&&(e="auto");var t=null==ie?void 0:ie.current;t&&t.scrollTo({top:t.scrollHeight,behavior:e})};r.useImperativeHandle(t,function(){return{scrollToBottom:$e}},[]);var et=r.useCallback(function(){var e,t,n,i=ie.current,r=re.current;if(i&&r){var s=-1;if(ge)for(var o=ge.length-1;o>=0;o--)if(ge[o].type===a.WidgetType.USER_MESSAGE){s=o;break}if(-1!==s){var l=ne.current[s];if(l){var c=0;for(o=s+1;o<(null!==(e=null==ge?void 0:ge.length)&&void 0!==e?e:0);o++){var u=ne.current[o];u&&(c+=u.offsetHeight)}V&&(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-l.offsetHeight-c);r.style.height="".concat(d,"px")}}else r.style.height="0px"}},[ge,ke]);r.useEffect(function(){if(m===o.ChatPageType.PREVIOUS_CHAT||U)return oe.current=!0,void $e();et();var e=-1;if(ge)for(var t=ge.length-1;t>=0;t--)if(ge[t].type===a.WidgetType.USER_MESSAGE){e=t;break}if(-1!==e){var n=ne.current[e];if(n){ae.current=!0,n.scrollIntoView({behavior:"smooth",block:"start"});var i=ie.current,r=function(){ae.current=!1};null==i||i.addEventListener("scrollend",r,{once:!0}),setTimeout(r,500)}}},[ge,m,et,U]),r.useEffect(function(){var e=ie.current;if(e){var t=new ResizeObserver(function(){m===o.ChatPageType.PREVIOUS_CHAT||U?oe.current&&$e():(ae.current||et(),(v||Se.current===(null==ge?void 0:ge.length))&&$e())});return t.observe(e),ne.current.forEach(function(e){e&&t.observe(e)}),se.current&&t.observe(se.current),function(){return t.disconnect()}}},[ge,et,m,U,ke]),r.useEffect(function(){var e=ie.current;if(e){var t=function(){He(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 tt=r.useMemo(function(){return m===o.ChatPageType.CHAT&&pe!==o.ChatStatus.CLOSED||pe===o.ChatStatus.ON_GOING},[m,pe]),nt=r.useMemo(function(){return pe===o.ChatStatus.CLOSED&&m===o.ChatPageType.CHAT},[m,pe]),it=r.useMemo(function(){return R===o.ChatCapability.SEARCH||Ee&&m!==o.ChatPageType.CHAT},[R,Ee,m]),rt=function(){J(!1)},st=function(){return tt?i.jsxs(s.Container,n.__assign({css:p.inputContainer},{children:[_e&&R===o.ChatCapability.SEARCH&&i.jsx(E,{capability:R,loaderText:j}),i.jsxs(s.Box,n.__assign({boxSize:"tiny"},{children:[i.jsx(s.AiChatInput,{rows:4,value:Y,onChange:Ve,placeholder:"Ask a question",onPrefixClick:We,showKeyboardIcon:$,onSubmit:qe,onBlur:rt,disableAction:y||v,prefix:V?i.jsx(H,{}):void 0,suffix:Y.length>0||W?void 0:i.jsx(i.Fragment,{}),isStreaming:W,onStop:z,ref:te}),$&&i.jsx(_,{actions:Je})]}))]})):null};return i.jsxs(i.Fragment,{children:[i.jsx(B,{showCross:m===o.ChatPageType.CHAT,onCrossClick:function(){null==O||O()},showPreviousChat:m===o.ChatPageType.CHAT,onPreviousChatClick:function(){null==M||M()},showBackButton:m===o.ChatPageType.PREVIOUS_CHAT,onBackButtonClick:function(){null==P||P()},showNewChat:it,onNewChatClick:Qe,showIcon:m===o.ChatPageType.CHAT,title:Me,isScrolled:Ge}),v&&S&&i.jsx(s.Box,n.__assign({boxSize:"tiny",css:n.__assign({},p.loadingContainer)},{children:i.jsx(s.Spinner,{variant:"thin",height:"54px",width:"54px",borderColor:f.color.border.link,trackColor:f.color.border.disabledDark})})),i.jsx(s.Box,n.__assign({boxSize:"tiny",css:p.chatContainer},{children:i.jsxs(s.Box,n.__assign({css:n.__assign(n.__assign({},p.animatedContainer),m===o.ChatPageType.CHAT&&!U&&!V&&{transform:Ae?"translateY(0)":"translateY(25%)",opacity:Ae?1:0}),boxSize:"tiny",ref:ie},{children:[!v&&(null==ge?void 0:ge.map(function(e,t){var r,o=e.id,c=e.type,d=e.chunks,h=e.metaData,g=void 0===h?{}:h,f=((r={})[a.WidgetType.USER_MESSAGE]=p.userMessageContainer,r),C=n.__assign(n.__assign({},g),{messageId:o,chatId:x,messageIndex:t,totalMessages:null==ge?void 0:ge.length,pageType:m}),_=!ce(x,o);return i.jsx(s.Container,n.__assign({css:n.__assign({},f[c]),ref:function(e){ne.current[t]=e}},{children:d.length>0&&i.jsx(u.SequentialReveal,n.__assign({animate:_,onComplete:function(){return ue(x,o)}},{children:d.map(function(e,t){var r,s=n.__assign(n.__assign(n.__assign({},null!==(r=e.metaData)&&void 0!==r?r:{}),C),{animate:_});return i.jsx(l.WidgetGenerator,n.__assign({},e,{metaData:s}),t)})}))}),"".concat(x,"_").concat(o))})),_e&&R===o.ChatCapability.CONVERSATIONAL&&i.jsx(E,{capability:R,loaderText:j}),m===o.ChatPageType.CHAT&&i.jsx(s.Container,{ref:re,css:{flexShrink:0}}),c.isEmpty(ge)&&!v&&xe&&i.jsx(F,{data:xe,shouldHidePills:ke||K||Y.length>=3}),ke&&i.jsx(s.Container,n.__assign({ref:se,css:{marginTop:"auto",paddingTop:"12px"}},{children:i.jsx(L,{contextSummary:I,isContextSummaryLoading:k,contextSummaryError:T})}))]}))})),V?i.jsx(d.BackgroundGradient,n.__assign({variant:W?d.BackgroundGradientVariant.PROCESSING:d.BackgroundGradientVariant.DEFAULT,styleConfig:{root:{css:p.bgGradient}}},{children:st()})):i.jsxs(i.Fragment,{children:[i.jsx(D,{style:p.bgGradientLeft}),i.jsx(G,{style:p.bgGradientRight})]}),!V&&st(),nt&&i.jsxs(s.Container,n.__assign({css:p.newChatContainer},{children:[i.jsx(s.Typography,n.__assign({variant:"P3",styleConfig:{css:p.chatClosedMessage}},{children:"This query has been closed, If you have a query regarding this trip, you can start a new chat."})),i.jsx(s.Button,n.__assign({variant:"contained",color:"primary",isFullWidth:!0,onClick:Qe},{children:"Start New Chat"}))]})),m===o.ChatPageType.PREVIOUS_CHAT&&i.jsx(s.Container,{children:null==Le?void 0:Le.map(function(e,t){var r=e.type,s=n.__rest(e,["type"]),o="".concat(r,"_").concat(t);return i.jsx(l.WidgetGenerator,n.__assign({type:r},s),o)})})]})}),P=r.memo(M),O=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"}}},N=function(){var e=s.useTheme(),t=r.useMemo(function(){return O(e)},[e]);return i.jsx(s.Container,n.__assign({css:t.shimmerContainer},{children:i.jsxs(s.Box,n.__assign({boxSize:"tiny"},{children:[i.jsx(s.Shimmer,{height:e.size[5],width:"120px"}),Array.from({length:3}).map(function(r,o){return i.jsxs(s.Box,n.__assign({boxSize:"nano",css:t.shimmerCard},{children:[i.jsx(s.Shimmer,{height:e.size[4],width:"150px"}),i.jsx(s.Shimmer,{height:e.size[4],width:"200px"})]}),o)})]}))}))};!function(e){e.ERROR="error",e.EMPTY="empty"}(e||(e={}));var U,z=((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),V=function(t){var l=t.variant,c=void 0===l?e.ERROR:l,u=s.useTheme(),d=r.useMemo(function(){return O(u)},[u]),h=o.useAppDispatch().dispatch;return i.jsx(s.Container,n.__assign({css:d.bodyContainer},{children:i.jsxs(s.Box,n.__assign({boxSize:"medium",css:d.errorContainer},{children:[i.jsx("img",{src:z[c].icon,alt:c,height:100,width:100}),i.jsxs(s.Box,n.__assign({boxSize:"small",css:d.labelContainer},{children:[i.jsx(s.Typography,n.__assign({variant:"HM3",styleConfig:{css:d.errorText}},{children:z[c].text})),i.jsx(s.Button,n.__assign({variant:"outline",onClick:function(){c===e.ERROR?h({type:a.ActionType.REFETCH_PREVIOUS_CHAT}):h({type:a.ActionType.CREATE_NEW_CHAT})},css:d.errorButton},{children:z[c].buttonLabel}))]}))]}))}))},W=r.memo(function(t){var c=t.chats,u=t.loading,d=void 0!==u&&u,h=t.onBack,g=t.previousChatError,f=null!=c?c:{},p=f.previousChats,x=void 0===p?[]:p,C=f.pageData,_=null!=C?C:{},m=_.newChatEnabled,v=_.chatCount,y=s.useTheme(),j=r.useMemo(function(){return O(y)},[y]),S=o.useAppDispatch().dispatch,b=r.useRef(null),k=r.useState(!1),w=k[0],T=k[1];r.useEffect(function(){var e=b.current;if(e){var t=function(){T(e.scrollTop>0)};return t(),e.addEventListener("scroll",t,{passive:!0}),function(){return e.removeEventListener("scroll",t)}}},[d,x.length]);return i.jsxs(s.Container,n.__assign({css:j.root},{children:[i.jsx(B,{showCross:!1,showPreviousChat:!1,showBackButton:!0,onBackButtonClick:h,title:"Past Conversations",showNewChat:m,onNewChatClick:function(){S({type:a.ActionType.CREATE_NEW_CHAT})},showIcon:!1,isScrolled:w}),d&&i.jsx(N,{}),!d&&(g?i.jsx(V,{variant:e.ERROR}):0===v?i.jsx(V,{variant:e.EMPTY}):null),!d&&x.length>0&&!!v&&v>0&&i.jsx(s.Box,n.__assign({boxSize:"medium",css:j.listContainer,ref:b},{children:x.map(function(e,t){var n=e.type,r=e.data,s="".concat(n,"_").concat(t);return i.jsx(l.WidgetGenerator,{type:n,data:r},s)})})),i.jsx(D,{style:j.bgGradientLeft}),i.jsx(G,{style:j.bgGradientRight})]}))}),q=function(e){var t=e.onClose,l=e.onBack,c=e.retry,u=s.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=o.useAppDispatch().dispatch,g=(null==c?void 0:c.kind)===o.ChatErrorKind.PREVIOUS;return i.jsxs(i.Fragment,{children:[i.jsx(B,{showBackButton:g,onBackButtonClick:l,showCross:!g,onCrossClick:t,showIcon:!1,title:""}),i.jsx(s.Container,n.__assign({css:d.bodyContainer},{children:i.jsxs(s.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(s.Box,n.__assign({boxSize:"small",css:d.labelContainer},{children:[i.jsx(s.Typography,n.__assign({variant:"HM3",styleConfig:{css:d.errorText}},{children:"Oops, we couldn't load the chat"})),i.jsx(s.Button,n.__assign({variant:"outline",onClick:function(){h({type:a.ActionType.RETRY_CHAT_ERROR})},css:d.errorButton},{children:"Try again"}))]}))]}))})),i.jsx(D,{style:d.bgGradientLeft}),i.jsx(G,{style:d.bgGradientRight})]})},Y=function(e){var t=e.loading,o=void 0!==t&&t,a=s.useTheme(),l=r.useMemo(function(){return T(a)},[a]);return o?i.jsxs(s.Container,n.__assign({css:l.initLoader},{children:[i.jsx(s.DottedLoader,{}),i.jsx(s.Typography,n.__assign({variant:"B3"},{children:"Getting ready"}))]})):null},Z=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"})}))},X=function(e){var t=e.onPrefixClick,a=e.onSuffixClick,l=e.sendMessage,c=e.isReplyLoading,u=void 0!==c&&c,d=e.capability,h=void 0===d?o.ChatCapability.CONVERSATIONAL:d,g=e.onStop,f=h===o.ChatCapability.SEARCH,p=f&&u,x=r.useState(""),C=x[0],_=x[1],m=r.useState(!1),y=m[0],j=m[1],b=r.useRef(null),k=s.useTheme(),w=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}}}(k)},[k]),B=r.useMemo(function(){return n.__assign({},y?w.headerActionCollapsed:{})},[y,w]),T=r.useMemo(function(){return n.__assign({},y?w.headerActionCollapsed:{})},[y,u,w]);return i.jsxs(s.ThemeProvider,{children:[u&&i.jsx(E,{capability:o.ChatCapability.SEARCH}),i.jsxs(s.Box,n.__assign({boxSize:"micro",horizontal:!0,css:w.root},{children:[!p&&i.jsx(v,n.__assign({onClick:t,styleConfig:{root:{css:n.__assign(n.__assign({},w.headerAction),B)}}},{children:i.jsx(Z,{})})),i.jsx(s.Container,n.__assign({css:w.inputWrapper},{children:i.jsx(s.AiChatInput,{ref:b,value:C,onChange:function(e){_(e)},onFocus:function(){j(!0)},onBlur:function(){j(!1)},onSubmit:function(){var e=C.trim();e&&!u&&(null==l||l(e),_(""),setTimeout(function(){var e;null===(e=b.current)||void 0===e||e.blur()},100))},disableAction:u,prefix:f?i.jsx(H,{}):void 0,suffix:C.length>0||p?void 0:i.jsx(i.Fragment,{}),isStreaming:p,onStop:g,placeholder:"Ask a question"})})),!p&&i.jsx(v,n.__assign({onClick:a,styleConfig:{root:{css:n.__assign(n.__assign({},w.headerAction),T)}}},{children:i.jsx(S,{})}))]}))]})},K=r.forwardRef(function(e,t){var a=e.onPrefixClick,l=e.onSuffixClick,c=e.sendMessage,u=e.isReplyLoading,h=e.visible,g=void 0===h||h,f=e.isInitialLoading,p=void 0!==f&&f,x=e.capability,C=e.onStop,_=s.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}}},[_]),v=x===o.ChatCapability.SEARCH&&u;return i.jsx(s.ThemeProvider,{children:i.jsx(s.Container,n.__assign({css:m.root},{children:i.jsx(s.Transition,n.__assign({type:"fade",timeout:400,appear:!0,mountOnEnter:!0,unmountOnExit:!0,in:g},{children:i.jsxs(s.Container,{children:[i.jsx(d.BackgroundGradient,{variant:v?d.BackgroundGradientVariant.PROCESSING:d.BackgroundGradientVariant.DEFAULT,styleConfig:{root:{css:m.backgroundGradient}}}),i.jsx(s.Transition,n.__assign({type:"slide",slideDirection:"up",timeout:400,appear:!0,mountOnEnter:!0,unmountOnExit:!0,in:g},{children:i.jsx(s.Container,n.__assign({css:m.content,ref:t},{children:p?i.jsx(Y,{loading:p}):i.jsx(X,{onPrefixClick:a,onSuffixClick:l,sendMessage:c,isReplyLoading:u,capability:x,onStop:C})}))}))]})}))}))})}),J=function(e){var t=e.visible,n=e.message,o=e.onDismiss,a=e.duration,l=void 0===a?3e3:a,c=s.useTheme(),u=r.useMemo(function(){return{toastContainer:{bottom:"100px"}}},[c]);return r.useEffect(function(){if(t){var e=setTimeout(function(){return null==o?void 0:o()},l+500);return function(){return clearTimeout(e)}}},[t,l,o]),t?i.jsx(s.Toast,{show:!0,text:n,isAutoClose:!0,closeTimeout:l,styleConfig:{toastContainer:{css:u.toastContainer}}}):null};exports.ChatSurfaceState=void 0,(U=exports.ChatSurfaceState||(exports.ChatSurfaceState={})).FLOATING="FLOATING",U.HYBRID="HYBRID",U.EXPANDED="EXPANDED";var Q,$,ee=function(e){void 0===e&&(e=exports.ChatSurfaceState.FLOATING);var t=this;this.listeners=new Set,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.snapshot={state:e,isReplyLoading:!1}},te=null,ne=function(){return te||(te=new ee),te},ie=r.createContext(null),re=function(){var e=r.useContext(ie);return null!=e?e:ne()},se=function(e){var t=re(),n=null!=e?e:t;return r.useSyncExternalStore(n.subscribe,n.getSnapshot,n.getSnapshot)},oe=function(e,t){var n=se(e).state;r.useEffect(function(){if(n===exports.ChatSurfaceState.HYBRID&&"undefined"!=typeof window){var i=Date.now(),r=function(){return Date.now()-i<400},s=function(e){var n;return!(!e||!(null===(n=t.current)||void 0===n?void 0:n.contains(e)))},o=!1,a=function(e){o=!s(e.target)&&s(document.activeElement)},l=function(t){s(t.target)||(t.stopPropagation(),t.preventDefault(),r()||(o?o=!1:e.hideHybrid()))},c=function(e){r()&&(s(e.target)||(e.stopPropagation(),e.preventDefault()))},u={capture:!0};return document.addEventListener("pointerdown",a,u),document.addEventListener("mousedown",c,u),document.addEventListener("mouseup",c,u),document.addEventListener("click",l,u),function(){document.removeEventListener("pointerdown",a,u),document.removeEventListener("mousedown",c,u),document.removeEventListener("mouseup",c,u),document.removeEventListener("click",l,u)}}},[n,e,t])};exports.ChatUIStatusValue=void 0,(Q=exports.ChatUIStatusValue||(exports.ChatUIStatusValue={})).ONGOING="ongoing",Q.IDLE="idle",exports.ChatView=void 0,($=exports.ChatView||(exports.ChatView={})).CHAT="CHAT",$.PREVIOUS_CHATS="PREVIOUS_CHATS";exports.ChatSurfaceBridge=ee,exports.ChatSurfaceProvider=function(e){var t=e.children,s=e.bridge,o=e.initialState,a=r.useRef();return a.current||(a.current=null!=s?s:new ee(o)),i.jsx(ie.Provider,n.__assign({value:a.current},{children:t}))},exports.ChatUI=function(e){var t,u=e.open,d=void 0===u||u,h=e.onClose,g=e.network,f=e.protocol,p=e.triggerTracking,x=e.baseTrackingData,C=e.onChatStateChange,_=e.plugins,m=e.capability,v=void 0===m?o.ChatCapability.CONVERSATIONAL:m,y=s.useTheme(),j=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]),S=r.useRef(0),b=r.useRef(C);b.current=C;var k=v===o.ChatCapability.SEARCH,w=re(),B=se(w),T=r.useRef(null),E=r.useRef([]),I=r.useState(d),L=I[0],R=I[1];r.useEffect(function(){R(d)},[d]);var A=k?B.state===exports.ChatSurfaceState.EXPANDED:L;r.useEffect(function(){k&&d&&w.expand()},[k,d,w]),oe(w,T);var F=r.useCallback(function(){k?w.expand():R(!0)},[k,w]),D=r.useCallback(function(){k?w.collapse():(R(!1),null==h||h())},[k,w,h]),G=o.useChatController({network:g,triggerTracking:p,baseTrackingData:x,protocol:f,resolveMerge:l.mergeFor,plugins:_,capability:v,open:A,onOpenChatbot:F,onCloseChatbot:D,chatWindowRefs:E}),H=G.currentChatId,M=G.messages,O=G.chatStack,N=G.previousChats,U=G.previousChatLoading,z=G.previousChatError,V=G.isInitialLoading,Y=G.isInitialError,Z=G.retryInitialChat,X=G.toast,Q=G.hideToast,$=G.isNewChat,ee=G.isReplyLoading,te=G.replyLoaderText,ne=G.screenRefs,ie=G.showNativeActions,ae=G.chatService,le=G.isContextSummaryLoading,ce=G.contextSummary,ue=G.contextSummaryError,de=G.handleMediaPicked,he=G.dispatch,ge=G.dispatchAll,fe=G.getPreviousChats,pe=G.pushToChatStack,xe=G.sendMessage,Ce=G.stop,_e=G.hasPresented,me=G.markPresented,ve=G.handleBackButtonClick,ye=r.useRef(Ce);ye.current=Ce;var je=r.useCallback(function(){var e;k&&(null===(e=ye.current)||void 0===e||e.call(ye))},[k]),Se=r.useRef(B.state);r.useEffect(function(){var e=Se.current,t=B.state;Se.current=t,e===exports.ChatSurfaceState.HYBRID&&t===exports.ChatSurfaceState.FLOATING&&je()},[B.state,je]),r.useEffect(function(){k&&Y&&(B.state===exports.ChatSurfaceState.HYBRID&&he({type:a.ActionType.SHOW_TOAST,payload:{message:"Something went wrong. Please try again."}}),w.showFloating())},[k,Y,w]);var be=r.useRef(B.state);r.useEffect(function(){var e=be.current,t=B.state;be.current=t,k&&Y&&e===exports.ChatSurfaceState.FLOATING&&t===exports.ChatSurfaceState.HYBRID&&Z()},[k,B.state,Y,Z]);var ke=r.useRef(!1);r.useEffect(function(){k&&w.setReplyLoading(ee)},[k,ee,w]),r.useEffect(function(){if(A)return document.body.style.overflowY="hidden",function(){document.body.style.overflowY="auto",he({type:a.ActionType.SHOW_NATIVE_ACTIONS,payload:{isNativeActionsEnabled:!1}})}},[A]),r.useEffect(function(){A&&(ke.current=!0)},[A]),r.useEffect(function(){A&&!V&&H&&ke.current&&(ke.current=!1,he({type:a.ActionType.RAVEN_TRACKING,payload:{eventName:"u_ai_chat_pageload",eventData:{chat_history_flag:$?"new":"existing",chat_session_id:H}}}))},[A,V,H,$,he]),r.useEffect(function(){var e,t;if(k&&B.state!==exports.ChatSurfaceState.EXPANDED&&H){var n=null!==(t=null===(e=M[H])||void 0===e?void 0:e.messages)&&void 0!==t?t:[];n.forEach(function(e,t){ee&&t===n.length-1||me(H,e.id)})}},[k,B.state,M,H,ee,me]);var we=r.useMemo(function(){var e,t,n=H?M[H]:void 0;return n&&n.status!==o.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},[M,H]);r.useEffect(function(){var e;null===(e=b.current)||void 0===e||e.call(b,{status:we})},[we]),r.useLayoutEffect(function(){var e=S.current,t=O.length;if(S.current=t,!(t<=e||t<=1)){var n=ne.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})}}},[O.length]);var Be=function(){he({type:a.ActionType.RAVEN_TRACKING,payload:{eventName:"u_ai_chat_bot_close",eventData:{chat_session_id:H,action_name:"ask_ai_close_click"}}}),je(),k?w.collapse():(R(!1),null==h||h())},Te=function(){return n.__awaiter(void 0,void 0,void 0,function(){return n.__generator(this,function(e){return je(),pe({type:o.ChatPageType.PREVIOUS_CHAT_LISTING}),fe(),[2]})})},Ee=function(e,t,n){var r=e.type,s=e.id,a=e.retry,l=e.scrollToBottomOnLoad;switch(r){case o.ChatPageType.PREVIOUS_CHAT_LISTING:return i.jsx(W,{chats:N,loading:U,onBack:ve,previousChatError:z});case o.ChatPageType.CHAT_ERROR:return i.jsx(q,{onClose:Be,onBack:ve,retry:a});case o.ChatPageType.PREVIOUS_CHAT:case o.ChatPageType.CHAT:default:return i.jsx(P,{ref:function(e){E.current[n]=e},chatId:s||"",chatData:M[s||""],sendMessage:xe,onPreviousChatClick:Te,pageType:r,onBackButtonClick:ve,isInitialLoading:V,isReplyLoading:ee,replyLoaderText:te,isTop:t,onClose:Be,handleMediaPicked:de,showNativeActions:ie,scrollToBottomOnLoad:l,isContextSummaryLoading:le,contextSummary:ce,contextSummaryError:ue,capability:v,onStop:je})}},Ie=r.useMemo(function(){var e,t;return(H&&null!==(t=null===(e=M[H])||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===a.WidgetType.ACTION_HANDLER})})},[M,H]);return i.jsxs(i.Fragment,{children:[k&&i.jsx(J,{visible:!!X,message:null!==(t=null==X?void 0:X.message)&&void 0!==t?t:"",duration:null==X?void 0:X.duration,onDismiss:Q},null==X?void 0:X.id),k&&B.state!==exports.ChatSurfaceState.EXPANDED&&i.jsxs(i.Fragment,{children:[i.jsx(o.ChatDispatchProvider,n.__assign({dispatch:he,dispatchAll:ge,hasPresented:_e,markPresented:me},{children:Ie.map(function(e){var t,r=e.chunk,s=e.key,o=e.messageId,a=n.__assign(n.__assign({},null!==(t=r.metaData)&&void 0!==t?t:{}),{messageId:o,chatId:H,presentOnDispatch:!0});return i.jsx(l.WidgetGenerator,n.__assign({},r,{metaData:a}),s)})})),i.jsx(K,{ref:T,visible:B.state===exports.ChatSurfaceState.HYBRID,onPrefixClick:w.expand,onSuffixClick:w.hideHybrid,sendMessage:xe,isReplyLoading:ee,isInitialLoading:V,capability:v,onStop:je})]}),i.jsx(s.ThemeProvider,{children:i.jsx(s.BottomSheet,n.__assign({isOpen:A,onClose:Be,radius:"md",styleConfig:{bottomSheetContainer:{css:n.__assign(n.__assign({},j.sheetContainer.css),{height:function(){if(c.isServer())return"94vh";var e=.94*window.innerHeight;return"".concat(e,"px")}()})}},disablePortal:!0},{children:i.jsx(o.ChatNetworkProvider,n.__assign({chatService:ae},{children:i.jsx(o.ChatDispatchProvider,n.__assign({dispatch:he,dispatchAll:ge,hasPresented:_e,markPresented:me},{children:i.jsxs(s.Container,n.__assign({css:j.stackContainer},{children:[0===O.length&&V&&i.jsx(s.Container,n.__assign({css:j.loadingContainer},{children:i.jsx(s.Spinner,{variant:"thin",height:"54px",width:"54px",borderColor:y.color.border.link,trackColor:y.color.border.disabledDark})})),O.map(function(e,t){var r,o=t===O.length-1;return i.jsx(s.Container,n.__assign({ref:function(e){ne.current[t]=e},css:n.__assign(n.__assign({},j.screenWrapper),{visibility:o?"visible":"hidden"})},{children:Ee(e,o,t)}),"".concat(e.type,"_").concat(null!==(r=e.id)&&void 0!==r?r:t))})]}))}))}))}))})]})},exports.HybridChat=X,exports.HybridChatWindow=K,exports.getChatSurfaceBridge=ne,exports.useChatSurface=se,exports.useChatSurfaceBridge=re,exports.useHideOnBackgroundInteraction=oe;
|
|
2
2
|
//# sourceMappingURL=talos-chat-ui.browser.cjs.js.map
|