1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="f3251cb9-58e4-47a3-8ba9-39af00899533",e._sentryDebugIdIdentifier="sentry-dbid-f3251cb9-58e4-47a3-8ba9-39af00899533")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9611],{9611:(e,t,n)=>{n.d(t,{AiAssistantCopilotSection:()=>en});var r=n(26514),l=n(75834),o=n(78220),a=n(18878),s=n(28195),i=n(73662),u=n(95546),c=n(7570),d=n(20065),h=n(44964);let g="zk-chatbot",p=[385,485,585,685,785,885],f=p.map(e=>"â¬".concat(e)),m="Top 3",b="Eigen risico",x=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{coverageData:t,priorityOptions:n,userContext:r}=e,l=e=>{if(e===b)return f;if(e===m)return n&&0!==n.length?n.map(e=>e.label):[];if(t){let n=t.find(t=>t.label.toLowerCase()===e.toLowerCase());if(n)return n.values.map(e=>e.labelLong).filter(e=>e&&e.trim().length>0)}return[]};return{getAllOptions:()=>{let e=[b];if(t){let n=t.map(e=>e.label);e.push(...n)}return e.push(m),e},getOptionsForGroup:l,isValidOption:(e,t)=>l(e).some(e=>e.toLowerCase()===t.toLowerCase()),getGroupType:e=>e===b?"deductible":e===m?"priority":t&&t.find(t=>t.label.toLowerCase()===e.toLowerCase())?"coverage":null,getUserContext:()=>({postalCode:null==r?void 0:r.postalCode,gender:null==r?void 0:r.gender,dateOfBirth:null==r?void 0:r.dateOfBirth,partner:null==r?void 0:r.partner,children:null==r?void 0:r.children})}};var v=n(65367),C=n(95919),y=n(76719);function w(e){let t=(0,l.useRef)(e);return t.current=e,t}var j=n(85093),k=n(97184),A=n(30893),I=n(78591),S=n(21341);let E=e=>{let{size:t=34}=e;return(0,r.jsx)(c._V3,{src:"/icons/favicon-192x192.png",alt:"",width:"".concat(t,"px"),height:"".concat(t,"px"),flexShrink:0,borderRadius:"8px"})},R=()=>(0,r.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[(0,r.jsx)("circle",{cx:"12",cy:"5",r:"1.8",fill:"
1currentColor"}),(0,r.jsx)("circle",{cx:"12",cy:"12",r:"1.8",fill:"currentColor"}),(0,r.jsx)("circle",{cx:"12",cy:"19",r:"1.8",fill:"currentColor"})]}),T=e=>{let{onRestart:t}=e,{t:n}=(0,S.Bd)();return(0,r.jsxs)(c.son,{alignItems:"center",justifyContent:"space-between",gap:9,px:9,py:9,backgroundColor:"brand.secondary.5",borderTopRadius:"8px",children:[(0,r.jsxs)(c.son,{alignItems:"center",gap:6,minWidth:0,children:[(0,r.jsx)(E,{}),(0,r.jsx)(c.o5u,{variant:c.NQF.Normal,fontWeight:"bold",color:"white",mb:0,children:n("preferences:aiAssistant:chatTitle")})]}),(0,r.jsxs)(j.W,{placement:"bottom-end",autoSelect:!1,children:[(0,r.jsx)(k.I,{type:"button","aria-label":n("preferences:aiAssistant:menu:label"),color:"white",lineHeight:"0",padding:2,margin:-2,borderRadius:"4px",_hover:{opacity:.8},children:(0,r.jsx)(R,{})}),(0,r.jsx)(A.c,{minWidth:"auto",zIndex:"dropdown",children:(0,r.jsx)(I.D,{onClick:t,children:(0,r.jsx)(c.o5u,{variant:c.NQF.Small,color:"grey.7",mb:0,children:n("preferences:aiAssistant:menu:restart")})})})]})]})};var L=n(47288),z=n(10637),_=n(29984);let O=["p","br","strong","b","em","i","ul","ol","li","a","code","pre","blockquote","h1","h2","h3","h4","hr"],J=["href"],N=e=>{let{content:t}=e,n=(0,l.useRef)(null);return(0,l.useEffect)(()=>{let e=n.current;e&&(e.innerHTML=(e=>{let t=_.xI.parse(e,{async:!1,gfm:!0}),n=document.createElement("div");return n.innerHTML=z.A.sanitize(t,{ALLOWED_TAGS:O,ALLOWED_ATTR:J}),n.querySelectorAll("a").forEach(e=>{e.setAttribute("target","_blank"),e.setAttribute("rel","noopener noreferrer")}),n.innerHTML})(t))},[t]),(0,r.jsx)(L.az,{ref:n,color:"brand.secondary.7",sx:{"p, ul, ol":{marginBottom:2},"p:last-child, ul:last-child, ol:last-child":{marginBottom:0},"ul, ol":{paddingLeft:"1.5em"},ul:{listStyleType:"disc"},ol:{listStyleType:"decimal"},li:{marginBottom:1},a:{color:"brand.primary.5",textDecoration:"underline"},"code, pre":{fontFamily:"mono",fontSize:"0.9em",backgroundColor:"blackAlpha.100",borderRadius:"4px"},code:{paddingX:2},pre:{padding:4,overflowX:"auto",marginBottom:2},"pre code":{paddingX:0,backgroundColor:"transparent"},"h1, h2, h3, h4":{fontWeight:"bold",marginBottom:2},blockquote:{borderLeft:"3px solid",borderColor:"grey.3",paddingLeft:6,color:"grey.6"}}})},B=e=>{let{children:t}=e,{t:n}=(0,S.Bd)();return(0,r.jsxs)(c.son,{gap:9,alignItems:"flex-start",width:"100%",children:[(0,r.jsx)(E,{size:34}),(0,r.jsxs)(c.azJ,{flex:"1",minWidth:0,children:[(0,r.jsx)(c.o5u,{variant:c.NQF.Normal,fontWeight:"bold",color:"brand.secondary.7",mb:1,children:n("preferences:aiAssistant:chatTitle")}),t]})]})},H=e=>{var t;let{message:n,messages:o,agentId:a}=e,{copilotkit:s,executingToolCallIds:i}=(0,y.kr)(),u=(0,l.useCallback)(e=>s.subscribe({onRenderToolCallsChanged:e}).unsubscribe,[s]),c=(0,l.useCallback)(()=>s.renderToolCalls,[s]),d=(0,l.useSyncExternalStore)(u,c,c);return(null==(t=n.toolCalls)?void 0:t.length)?(0,r.jsx)(r.Fragment,{children:n.toolCalls.map(e=>{var t,n;let s=d.filter(t=>t.name===e.function.name),u=null!=(n=null!=(t=s.find(e=>e.agentId===a))?t:s.find(e=>!e.agentId))?n:s[0];if(!u)return null;let c=o.find(t=>"tool"===t.role&&t.toolCallId===e.id),h=u.render,g={name:e.function.name,toolCallId:e.id,args:(e=>{try{let t=JSON.parse(e);return"object"==typeof t&&null!==t?t:{}}catch(e){return{}}})(e.function.arguments)},p=c?{...g,status:"complete",result:c.content}:{...g,status:i.has(e.id)?"executing":"inProgress",result:void 0};return(0,r.jsx)(l.Fragment,{children:(0,r.jsx)(h,{...p})},e.id)})}):null},M=e=>{var t,n,l;let{message:o,messages:a,agentId:s}=e,i=!!(null==(t=o.content)?void 0:t.trim()),u=(0,r.jsx)(H,{message:o,messages:a,agentId:s});return i||(null==(n=o.toolCalls)?void 0:n.length)?i?(0,r.jsxs)(B,{children:[(0,r.jsx)(N,{content:null!=(l=o.content)?l:""}),u]}):u:null};var D=n(49905);let W=()=>(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:(0,r.jsx)("path",{d:"M3.4 20.4 21 12 3.4 3.6 3.39 10.13 15.5 12 3.39 13.87 3.4 20.4Z",fill:"currentColor",stroke:"currentColor",strokeWidth:"1",strokeLinejoin:"round"})}),F=e=>{let{onClick:t,disabled:n,...l}=e;return(0,r.jsx)(c.$nd,{type:"button",size:"sm",disabled:n,onClick:t&&(e=>t(e)),display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,alignSelf:"flex-end",width:"32px",height:"32px",minWidth:"32px",minHeight:"32px",px:0,borderRadius:"full",background:"transparent",color:"brand.secondary.5",sx:{svg:{color:"inherit"}},_hover:{background:"transparent",color:"brand.secondary.6"},_disabled:{opacity:.4,cursor:"default",background:"transparent !important",color:"brand.secondary.5"},...l,children:(0,r.jsx)(W,{})})},P=e=>{let{isRunning:t,onSubmitMessage:n}=e,{t:o}=(0,S.Bd)(),[a,s]=(0,l.useState)(""),i=(0,l.useRef)(null);(0,l.useEffect)(()=>{let e=i.current;e&&(e.style.height="auto",e.style.height="".concat(Math.min(e.scrollHeight,96),"px"))},[a]);let u=!t&&!!a.trim(),d=()=>{let e=a.trim();e&&!t&&(s(""),n(e))};return(0,r.jsxs)(c.son,{alignItems:"center",gap:4,backgroundColor:"white",borderRadius:"10px",px:4,py:2,children:[(0,r.jsx)(D.T,{ref:i,value:a,onChange:e=>s(e.target.value),onKeyDown:e=>{!e.nativeEvent.isComposing&&229!==e.keyCode&&("Enter"!==e.key||e.shiftKey||(e.preventDefault(),d()))},placeholder:o("preferences:aiAssistant:inputPlaceholder"),"aria-label":o("preferences:aiAssistant:inputPlaceholder"),rows:1,variant:"unstyled",resize:"none",minHeight:"24px",maxHeight:"".concat(96,"px"),overflowY:"auto",px:2,py:1}),(0,r.jsx)(F,{onClick:d,disabled:!u,"aria-label":o("preferences:aiAssistant:sendLabel")})]})},Q=e=>{let{agentId:t,suggestions:n,onSelectSuggestion:l}=e,{agent:o}=(0,u.fJ)({agentId:t});return o.messages.some(e=>"user"===e.role)||!n.length?null:(0,r.jsx)(c.son,{gap:6,flexWrap:"wrap",width:"100%",children:n.map(e=>(0,r.jsxs)(c.son,{as:"button",type:"button",flex:{base:"1 1 100%",md:"1 1 0"},minWidth:{base:"100%",md:"200px"},textAlign:"left",alignItems:"center",justifyContent:"space-between",gap:9,px:9,py:9,borderRadius:"6px",backgroundColor:"brand.secondary.5",color:"white",cursor:"pointer",transition:"background-color 0.15s ease-in-out",_hover:{backgroundColor:"brand.secondary.6"},onClick:()=>l(e),children:[(0,r.jsxs)(c.azJ,{minWidth:0,children:[(0,r.jsx)(c.o5u,{variant:c.NQF.Small,fontWeight:"bold",color:"white",mb:1,children:e.title}),(0,r.jsx)(c.o5u,{variant:c.NQF.ExtraSmall,color:"white",mb:0,children:e.message})]}),(0,r.jsx)(c.azJ,{flexShrink:0,children:(0,r.jsx)(c.Int,{iconName:"arrow-right",size:"sm",color:"white"})})]},e.title))})},G=e=>{let{message:t}=e,n=(e=>"string"==typeof e?e:e.map(e=>
1"text"===e.type?e.text:"").filter(Boolean).join("\n"))(t.content).trim();return n?(0,r.jsx)(c.son,{justifyContent:"flex-end",width:"100%",children:(0,r.jsx)(c.azJ,{maxWidth:"85%",backgroundColor:"brand.secondary.5",borderRadius:"10px",px:9,py:6,children:(0,r.jsx)(c.o5u,{variant:c.NQF.Normal,color:"white",mb:0,whiteSpace:"pre-wrap",children:n})})}):null};var Y=n(2318);function U(){let e=(0,Y._)(["\n @keyframes chatWorkingPulse {\n 0%,\n 80%,\n 100% {\n opacity: 0.25;\n transform: translateY(0);\n }\n 40% {\n opacity: 1;\n transform: translateY(-3px);\n }\n }\n width: 7px;\n height: 7px;\n border-radius: 9999px;\n animation: chatWorkingPulse 1.2s ease-in-out infinite;\n"]);return U=function(){return e},e}let K=(0,n(41193).default)(c.azJ)(U()),q=e=>{var t;let{isRunning:n,messages:o}=e,{t:a}=(0,S.Bd)(),[s,i]=(0,l.useState)(n);(0,l.useEffect)(()=>{if(n)return void i(!0);let e=setTimeout(()=>i(!1),400);return()=>clearTimeout(e)},[n]);let u=o[o.length-1],d=(null==u?void 0:u.role)==="assistant"&&!!(null==(t=u.content)?void 0:t.trim());return!s||d?null:(0,r.jsx)(B,{children:(0,r.jsxs)(c.son,{role:"status","aria-label":a("preferences:aiAssistant:working"),gap:2,alignItems:"center",height:"24px",color:"brand.secondary.5",children:[(0,r.jsx)(K,{backgroundColor:"currentColor"}),(0,r.jsx)(K,{backgroundColor:"currentColor",sx:{animationDelay:"0.15s"}}),(0,r.jsx)(K,{backgroundColor:"currentColor",sx:{animationDelay:"0.3s"}})]})})},V=()=>null,X=e=>{let{agentId:t,threadId:n,isRestoredThread:a}=e,{t:s}=(0,S.Bd)(),{copilotkit:i}=(0,y.kr)(),{agent:d}=(0,u.fJ)({agentId:t}),{suggestions:h}=(0,u.Pt)({agentId:t}),[g,p]=(0,l.useState)(a),{scrollRef:f,pinToBottom:m}=(()=>{let[e,t]=(0,l.useState)(null),n=(0,l.useRef)(!0),r=(0,l.useRef)(null),o=(0,l.useCallback)(()=>{n.current=!0,e&&(e.scrollTop=e.scrollHeight,r.current=e.scrollTop)},[e]);return(0,l.useEffect)(()=>{if(!e)return;n.current=!0;let t=()=>{n.current&&(e.scrollTop=e.scrollHeight,r.current=e.scrollTop)},l=()=>{let t=r.current;n.current&&null!==t&&1>=Math.abs(e.scrollTop-t)||(n.current=e.scrollHeight-e.scrollTop-e.clientHeight<40)};e.addEventListener("scroll",l,{passive:!0});let o=new ResizeObserver(t);Array.from(e.children).forEach(e=>o.observe(e));let a=new MutationObserver(e=>{e.forEach(e=>{e.addedNodes.forEach(e=>{e instanceof Element&&o.observe(e)})}),t()});return a.observe(e,{childList:!0}),t(),()=>{e.removeEventListener("scroll",l),o.disconnect(),a.disconnect()}},[e]),{scrollRef:t,pinToBottom:o}})();(0,l.useEffect)(()=>{if(d.threadId=n,!a)return;let e=!1,t=new AbortController;return d.abortController=t,(async()=>{try{await i.connectAgent({agent:d})}finally{e||p(!1)}})(),()=>{e=!0,t.abort(),d.detachActiveRun().catch(()=>void 0)}},[d,i,n,a]);let b=(0,l.useCallback)(e=>i.subscribe({onInterruptElementChanged:e}).unsubscribe,[i]),x=(0,l.useCallback)(()=>i.interruptElement,[i]),v=(0,l.useSyncExternalStore)(b,x,V),C=(0,l.useCallback)(async e=>{d.isRunning||(d.addMessage({id:(0,o.A)(),role:"user",content:e}),m(),await i.runAgent({agent:d}))},[d,i,m]),w=(0,l.useCallback)(e=>{C(e.message)},[C]),j=d.messages,k=d.isRunning,A=(e=>{let t=new Set;for(let a=0;a<e.length-1;a++){var n,r,l,o;let s=e[a],i=e[a+1];if("assistant"!==s.role||"assistant"!==i.role||s.id===i.id)continue;let u=null==(n=s.content)?void 0:n.trim();u&&!(null==(r=s.toolCalls)?void 0:r.length)&&(null==(l=i.toolCalls)?void 0:l.length)&&(null==(o=i.content)?void 0:o.trim())===u&&t.add(s.id)}return t})(j),I=!g&&!k&&h.length>0,E=(0,r.jsx)(P,{isRunning:k||g,onSubmitMessage:C}),R=(0,r.jsx)(Q,{agentId:t,suggestions:h,onSelectSuggestion:w});return 0!==j.length||g||a?(0,r.jsxs)(c.son,{direction:"column",height:"100%",width:"100%",children:[(0,r.jsx)(L.az,{ref:f,flex:"1",minHeight:0,overflowY:"auto",px:7,children:(0,r.jsxs)(c.BJc,{spacing:11,width:"100%",pt:9,pb:4,children:[j.map(e=>A.has(e.id)?null:"user"===e.role?(0,r.jsx)(G,{message:e},e.id):"assistant"===e.role?(0,r.jsx)(M,{message:e,messages:j,agentId:t},e.id):null),v,(0,r.jsx)(q,{isRunning:k,messages:j}),I&&R]})}),(0,r.jsx)(c.azJ,{backgroundColor:"brand.secondary.5",px:9,py:8,children:E})]}):(0,r.jsx)(r.Fragment,{children:(e=>{let{welcomeMessage:t,input:n,suggestionView:l}=e;return(0,r.jsxs)(c.son,{direction:"column",height:"100%",width:"100%",children:[(0,r.jsxs)(c.son,{direction:"column",flex:"1",minHeight:0,justifyContent:"center",gap:11,px:11,py:11,children:[t,l]}),(0,r.jsx)(c.azJ,{backgroundColor:"brand.secondary.5",px:9,py:8,children:n})]})})({welcomeMessage:(0,r.jsx)(c.o5u,{variant:c.NQF.H4,fontWeight:"medium",textAlign:"center",color:"brand.secondary.7",mb:0,children:s("preferences:aiAssistant:greeting")}
1),input:E,suggestionView:R})})},Z=e=>{let{isAiAssistantOpen:t,setIsAiAssistantOpen:n,coverageData:f,priorityOptions:j,userDetails:k,onFilterChange:A,onCtaRenderChange:I,sessionId:S,onSessionIdChange:E,isRestoredThread:R}=e,{t:L}=(0,d.Bd)(),{restartConversation:z,completeShowResults:_}=(e=>{var t,n,r,i,c,d,f,j,k,A;let{coverageData:I,priorityOptions:S,isAiAssistantOpen:E=!1,userDetails:R,suggestions:T,onFilterChange:L,onCtaRenderChange:z,sessionId:_,onSessionIdChange:O}=e,{userFilters:J,setUserFilters:N,userDetails:B,setUserDetails:H}=(0,a.P)(),{agent:M}=(0,u.fJ)({agentId:g}),[D,W]=(0,l.useState)(new Map),F={postalCode:null==R?void 0:R.postalCode,gender:null==R||null==(t=R.user)?void 0:t.gender,dateOfBirth:null==R||null==(n=R.user)?void 0:n.dateOfBirth,partner:null==R?void 0:R.partner,children:null==R?void 0:R.children},P=w(x({coverageData:I,priorityOptions:S,userContext:F})),Q=w(I),G=w(S),Y=w(D),U=w(J),K=w(N),q=w(H),V=w(M),X=w(_),Z=w(L),$=w(z),ee=w(O),et=(0,l.useRef)(null==B?void 0:B.chatId);(0,l.useEffect)(()=>{et.current=null==B?void 0:B.chatId},[null==B?void 0:B.chatId]),(0,l.useEffect)(()=>{E&&!et.current&&(et.current=_,H({chatId:_,chatStatus:"conversation_started"}))},[E,_,H]),(e=>{let{agentId:t,threadId:n,description:r,value:o}=e,{copilotkit:a}=(0,y.kr)(),{agent:s}=(0,u.fJ)({agentId:t}),i=(0,l.useMemo)(()=>"string"==typeof o?o:JSON.stringify(o),[o]),c=(0,l.useRef)(null);(0,l.useEffect)(()=>{c.current=null},[n]),(0,l.useEffect)(()=>{if(!a||i===c.current)return;let e=a.addContext({description:r,value:i,agentIds:[t]}),n=null==s?void 0:s.subscribe({onRunStartedEvent:()=>{c.current=i,a.removeContext(e)}});return()=>{null==n||n.unsubscribe(),a.removeContext(e)}},[a,s,t,r,i,n])})({agentId:g,threadId:_,description:"User personal details for insurance recommendations",value:{postalCode:null!=(c=F.postalCode)?c:null,gender:null!=(d=F.gender)?d:null,dateOfBirth:null!=(f=F.dateOfBirth)?f:null,partnerDateOfBirth:null!=(j=null==(r=F.partner)?void 0:r.dateOfBirth)?j:null,partnerGender:null!=(k=null==(i=F.partner)?void 0:i.gender)?k:null,children:(null!=(A=F.children)?A:[]).map(e=>{var t,n;return{dateOfBirth:null!=(t=e.dateOfBirth)?t:null,gender:null!=(n=e.gender)?n:null}})}});let en=M.messages.some(e=>"user"===e.role);(0,l.useEffect)(()=>{en&&(0,s.J2)("zkAiChatHasMessages",!0)},[en]);let er=D.size>0;(0,l.useEffect)(()=>{I&&S&&(!E||!er)&&W((e=>{let{userFilters:t,coverageData:n,priorityOptions:r}=e,l=new Map;if(t.deductible&&l.set(b,"â¬".concat(t.deductible)),t.coverage&&t.coverage.length>0&&n&&t.coverage.forEach(e=>{e.hasCoverage&&e.valueString&&l.set(e.filterName,e.valueString)}),t.priorities&&r&&r.length>0){let e=[];Object.entries(t.priorities).forEach(t=>{let[n,l]=t;if(l===v.I.High){let t=r.find(e=>e.value===n);t&&e.push(t.label)}}),e.length>0&&l.set(m,e.join(", "))}return l})({userFilters:J,coverageData:I,priorityOptions:S}))},[J,I,S,E,er]),(0,u.pi)(T?{suggestions:T,available:"always",consumerAgentId:g}:null,[T]);let el=(0,l.useCallback)(()=>{var e,t;let n=(0,o.A)();null==(e=V.current)||e.abortRun(),(0,s.J2)("zkAiChatCtaRender",!1),null==(t=$.current)||t.call($,!1),(0,s.J2)("zkAiChatHasMessages",!1),et.current=n,q.current({chatId:n,chatStatus:"conversation_started"}),ee.current(n)},[V,$,ee,q]);return(0,u.CJ)({name:"get_coverage_options",description:"Returns all available coverage option group names the user can configure.",parameters:h.Ik({}),handler:async()=>P.current.getAllOptions().join(", ")}),(0,u.CJ)({name:"get_options_within_group",description:"Returns available values for a specific coverage option group, marking the currently selected value.",parameters:h.Ik({group:h.Yj().describe("The option group name returned by get_coverage_options")}),handler:async e=>{let{group:t}=e,n=P.current.getOptionsForGroup(t);if(0===n.length){let e=P.current.getAllOptions().slice(0,5).join(", ");return'Group "'.concat(t,'" not found. Available groups: ').concat(e,"...")}let r=Y.current.get(t);return n.map(e=>r&&e===r?"".concat(e," â (SELECTED)"):e).join(", ")}}),(0,u.CJ)({name:"set_option",description:"Sets a specific option value for a coverage group and updates the user's filter selections.",parameters:h.Ik({group:h.Yj().describe("The option group name"),value:h.Yj().describe("The value to select within the group")}),handler:async e=>{var t;let n,{group:r,value:l}=e,o=P.current.getGroupType(r);if(!o)return'Group "'.concat(r,'" not found.');let a=U.current;switch(o){case"deductible":n=(e=>{let{value:t}=e,n=Number(t.replace("â¬","")),r=p.find(e=>e===n);return void 0===r?null:{deductible:r}}
1)({group:r,value:l});break;case"priority":n=(e=>{var t;let{value:n,userFilters:r,priorityOptions:l}=e;if(!l||0===l.length)return console.warn("â ï¸ Priority options not available"),null;let o=l.find(e=>e.label.toLowerCase()===n.toLowerCase());if(!o)return console.warn('â ï¸ Priority "'.concat(n,'" not found in priorityOptions')),null;let a=null!=(t=null==r?void 0:r.priorities)?t:{},s=Object.values(a).filter(e=>e===v.I.High).length<3?v.I.High:v.I.Medium;return{priorities:{...a,[o.value]:s}}})({group:r,value:l,userFilters:a,priorityOptions:G.current});break;case"coverage":n=(e=>{var t;let{value:n,userFilters:r,coverageData:l,group:o}=e,a=((e,t,n)=>{if(!n)return console.warn("â ï¸ Coverage data not available"),null;let r=n.find(t=>t.label.toLowerCase()===e.toLowerCase());if(!r)return console.warn('â ï¸ Coverage "'.concat(e,'" not found in coverageData')),null;let l=r.values.find(e=>{var n,r,l;return(null==(n=e.labelLong)?void 0:n.toLowerCase())===t.toLowerCase()||(null==(r=e.labelShort)?void 0:r.toLowerCase())===t.toLowerCase()||(null==(l=e.value)?void 0:l.toLowerCase())===t.toLowerCase()});return l?(0,C.Zw)(r,l):(console.warn('â ï¸ Value "'.concat(t,'" not found in coverage "').concat(e,'". Available values:'),r.values.map(e=>e.labelLong||e.labelShort)),null)})(o,n,l);if(!a)return null;let s=new Map((null!=(t=null==r?void 0:r.coverage)?t:[]).map(e=>[e.filterName,e]));return s.set(a.filterName,a),{coverage:[...s.values()]}})({group:r,value:l,userFilters:a,coverageData:Q.current})}if(!n)return'Could not set option "'.concat(l,'" for group "').concat(r,'".');let s={...a,...n};U.current=s;let i=new Map(Y.current);i.set(r,l),Y.current=i,W(i),K.current(s),null==(t=Z.current)||t.call(Z,s);let u=Array.from(i.entries()).map(e=>{let[t,n]=e;return"{ ".concat(t,": ").concat(n," }")}).join(", ");return"Option successfully set! Currently selected options: ".concat(u)}}),{selectedOptions:D,restartConversation:el,completeShowResults:(0,l.useCallback)(()=>{var e;let t=X.current;et.current||(et.current=t,q.current({chatId:t,chatStatus:"conversation_started"})),(0,s.J2)("zkAiChatCtaRender",!0),null==(e=$.current)||e.call($,!0)},[$,X,q])}})({coverageData:f,priorityOptions:j,isAiAssistantOpen:t,userDetails:k,suggestions:(0,l.useMemo)(()=>[{title:L("preferences:aiAssistant:suggestions:newInNetherlands:title"),message:L("preferences:aiAssistant:suggestions:newInNetherlands:message")},{title:L("preferences:aiAssistant:suggestions:turningEighteen:title"),message:L("preferences:aiAssistant:suggestions:turningEighteen:message")}],[L]),onFilterChange:A,onCtaRenderChange:I,sessionId:S,onSessionIdChange:E}),[O,J]=(0,l.useState)(!1),N=(0,l.useRef)(null);return((0,l.useEffect)(()=>{t&&J(!0)},[t]),(0,l.useEffect)(()=>{t&&N.current&&window.scrollTo({top:N.current.offsetTop-40,behavior:"smooth"})},[t]),(0,u.CJ)({name:"show_results",description:"Signals that all options are configured and shows the user a link to the personalised search results.",parameters:h.Ik({}),followUp:!0,handler:async()=>(_(),'The results card with the "Bekijk jouw resultaten" button is now displayed in the chat, directly below your closing message.'),render:e=>{let{status:t}=e,n="/zoekresultaten?chatId=".concat(encodeURIComponent(S));return"complete"!==t?(0,r.jsx)(r.Fragment,{}):(0,r.jsx)(c.azJ,{mt:3,children:(0,r.jsxs)(i.N,{href:n,"data-gtm-id":"AiAssistantShowResults",display:"inline-block",px:4,py:2,borderRadius:"6px",backgroundColor:"brand.primary.5",color:"white",fontWeight:"bold",_hover:{backgroundColor:"brand.primary.6",textDecoration:"none"},children:[L("preferences:aiAssistant:showResults")," â"]})})}},[S,L]),O)?(0,r.jsxs)(c.son,{ref:N,direction:"column",width:"100%",display:t?"flex":"none",gap:4,children:[(0,r.jsxs)(c.$nd,{"data-gtm-id":"SearchboxKnownHealthInsurance",className:"abtest-know-insurance-search-form-button",size:"sm",variant:"textLink",onClick:t?()=>{n(!1),(0,s.J2)("zkAiAssistantOpen",!1)}:()=>{n(!0),(0,s.J2)("zkAiAssistantOpen",!0)},mb:12,justifyContent:"flex-start",children:[(0,r.jsx)(c.Int,{iconName:t?"arrow-left":"arrow-right",display:"inline",mr:2,size:"sm"}),t?L("preferences:aiAssistant:insertManually"):L("preferences:aiAssistant:startHelp")]}),(0,r.jsxs)(c.azJ,{height:"520px",width:"100%",borderRadius:"8px",overflow:"hidden",backgroundColor:"brand.secondary.1",display:"flex",flexDirection:"column",children:[(0,r.jsx)(T,{onRestart:z}),(0,r.jsx)(c.azJ,{flex:"1",minHeight:0,children:(0,r.jsx)(u.cz,{agentId:g,threadId:S,hasExplicitThreadI
1d:R,children:(0,r.jsx)(X,{agentId:g,threadId:S,isRestoredThread:R})})})]}),(0,r.jsx)(c.o5u,{variant:c.NQF.Normal,textAlign:"center",color:"grey.6",mb:0,children:L("preferences:aiAssistant:disclaimer")})]}):null};var $=n(263);let ee=e=>{let{isAiAssistantOpen:t,setIsAiAssistantOpen:n,priorityOptions:l,onCtaRenderChange:o,sessionId:s,onSessionIdChange:i,isRestoredThread:u}=e,{coverageData:c,fetchSearchResults:d,fetchCoverageData:h}=(0,$.y)(),{userDetails:g}=(0,a.P)();return(0,r.jsx)(Z,{isAiAssistantOpen:t,setIsAiAssistantOpen:n,coverageData:c,priorityOptions:l,userDetails:g,onFilterChange:e=>{let t={userDetails:g,userFilters:e};d(t),h(t)},onCtaRenderChange:o,sessionId:s,onSessionIdChange:i,isRestoredThread:u})},et=e=>{let{runtimeUrl:t,children:n}=e,o=(0,l.useRef)(null);null===o.current&&(o.current=new y.Ji({runtimeUrl:t,runtimeTransport:"single"}));let a=o.current,[s,i]=(0,l.useState)(()=>new Set),[u,c]=(0,l.useState)(()=>a.runtimeConnectionStatus),[d,h]=(0,l.useState)(0);(0,l.useEffect)(()=>{let e=a.subscribe({onRuntimeConnectionStatusChanged:e=>{let{status:t}=e;return c(t)},onAgentsChanged:()=>h(e=>e+1),onToolExecutionStart:e=>{let{toolCallId:t}=e;i(e=>{if(e.has(t))return e;let n=new Set(e);return n.add(t),n})},onToolExecutionEnd:e=>{let{toolCallId:t}=e;i(e=>{if(!e.has(t))return e;let n=new Set(e);return n.delete(t),n})},onError:e=>{let{error:t,code:n}=e;"runtime_info_fetch_failed"!==n&&console.error("[CopilotKit] Error (".concat(n,"):"),t)}});return c(a.runtimeConnectionStatus),()=>e.unsubscribe()},[a]);let g=(0,l.useMemo)(()=>({copilotkit:a,executingToolCallIds:s}),[a,s,u,d]);return(0,r.jsx)(y.y6.Provider,{value:g,children:n})},en=e=>{let{userDetails:t}=(0,a.P)(),[n,i]=(0,l.useState)(()=>{var e;return null!=(e=null==t?void 0:t.chatId)?e:(0,o.A)()}),[u,c]=(0,l.useState)(()=>!!(null==t?void 0:t.chatId)&&!0===(0,s.Hd)("zkAiChatHasMessages")),d=(0,l.useCallback)(e=>{c(!1),i(e)},[]);return(0,r.jsx)(et,{runtimeUrl:"/agents-api/copilotkit",children:(0,r.jsx)(ee,{...e,sessionId:n,onSessionIdChange:d,isRestoredThread:u})},n)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.