1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5993],{65993:(e,t,r)=>{r.r(t),r.d(t,{default:()=>v});var a=r(37876),s=r(14232),o=r(68198),i=r(31777),l=r(10912),n=r(89099),h=r(39287),u=r(76178),g=r(12118),c=r(31257),d=r(25737),f=r(6266),p=r(39725);let b=8*p.CZ,w=e=>(0,d.A)(e,p.xJ),y=(e,t)=>{let{signal:r,queryBefore:a}=t;return new Promise(t=>{let s;if(r?.aborted)return void t("aborted");let o=e.getState().results.lastUpdated,i=!1,l=()=>{},n=e=>{i||(i=!0,clearTimeout(s),l(),t(e))};r?.addEventListener("abort",()=>n("aborted"),{once:!0}),l=e.subscribe(()=>{let{isFetching:t,lastUpdated:r}=e.getState().results;r!==o?n(null==r?"failed":"refetched"):t&&(clearTimeout(s),s=setTimeout(()=>n("stillLoading"),1e4))}),s=setTimeout(()=>n((0,f.A)(w(a),w(e.getState().query))?"unchanged":"notSearched"),b)})};var m=r(58440);let k={confirm:(e,t)=>{let{message:r}=e,{submit:s,cancel:o}=t;return(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{children:r}),(0,a.jsx)("button",{type:"button",onClick:()=>s({confirmed:!0}),children:"Yes"}),(0,a.jsx)("button",{type:"button",onClick:()=>o(),children:"No"})]})}},S=e=>{let t,r,l,d,f,p,b,{id:w,userInfoTags:S=[]}=e,v=(0,s.useRef)(null),[E,T]=(0,s.useState)(null),_=(0,i.d4)(e=>e.globals?.["conversational-ai-gateway-base-url"]),j=(0,i.d4)(e=>e.globals?.["mcp-server-url"]),x=(0,i.d4)(e=>e.globals?.["preview-mode?"]),C=(0,i.d4)(e=>
1e.globals?.["draft-mode?"]),N=(0,i.d4)(e=>e.globals?.brand?.name),P=(t=(0,i.wA)(),r=(0,i.Pj)(),(0,s.useCallback)(e=>{let a=Number(e.listingIndex)-1,s=r.getState(),{results:o}=s;if(o.isFetching)throw Error("The search results are still loading, try again shortly");let i=(0,g.jz)(s);if(!Number.isInteger(a)||a<0||a>=i.length)throw Error(`listingIndex must be between 1 and ${i.length}, the number of listings on the current page`);let l=i[a]["ad?"]?a+1:a,n=i[l];if(!n)throw Error(`The listing at position ${a+1} is an ad with no listing below it`);return t((0,u.Vy)(n)),{listingIndex:l+1,listingId:String(n.id),suggestedProperty:l>=(o.list||[]).length}},[t,r])),I=(l=(0,n.useRouter)(),d=(0,i.Pj)(),(0,s.useCallback)(()=>{let{property:e}=d.getState();if(!e?.virtualtours?.length)throw Error("No virtual tour available â this tool only works on the details page of a property with a 3D tour");return l.push("#/virtualtours/1",void 0,{shallow:!0,scroll:!1}),{ok:!0}},[l,d])),A=(0,s.useCallback)(()=>{if(null==w)throw Error("No current property â this tool only works on a property details page");return{propertyId:String(w)}},[w]),$=(f=(0,i.Pj)(),(0,s.useCallback)(()=>{let e=(0,g.Y5)(f.getState());if(!e)throw Error("No search has run on this page â this tool only works on the search results page");return{...e}},[f])),L=(()=>{let e=(0,i.wA)(),t=(0,i.Pj)(),{handleSubmitQuery:r}=(0,c.l)();return(0,s.useCallback)(async(a,s)=>{let o=String(a?.query??"").trim();if(o.length<2)throw Error('query must be a search phrase of at least 2 characters, e.g. "2 bed flats in Bath under 400k"');let{results:i,maps:l,query:n}=t.getState();if(i.isFetching)throw Error("The search results are still loading, try again shortly");l.activePins?.length>0&&e((0,u.wc)());let{submitted:h,reason:c,warning:d,criteriaText:f}=await r({query:o,signal:s?.signal});if(!h){if("superseded"===c)throw Error("The user changed the search while this was running â read the page again before answering");throw Error(d||`No search could be built from "${o}" â ask the user for a location, or for criteria that are easier to search on`)}let p=await y(t,{signal:s?.signal,queryBefore:n});if("failed"===p)throw Error(`The search for "${o}" did not return a results page â ask the user to try a different search`);if("notSearched"===p)throw Error(`The page did not run the search for "${o}" â ask the user to try a different search`);return"refetched"!==p&&"unchanged"!==p?{stillLoading:!0,criteria:f}:{...(0,g.Dg)(t.getState()),..."unchanged"===p&&{alreadyShowing:!0},...d&&{warning:d}}},[e,t,r])})(),q=(p=(0,i.wA)(),b=(0,i.Pj)(),(0,s.useCallback)(async(e,t)=>{let r=Number(e?.page),{results:a,query:s,maps:o}=b.getState();if(a.isFetching)throw Error("The search results are still loading, try again shortly");let i=(0,g.ou)(b.getState());if(!Number.isInteger(r)||r<1||r>i)throw Error(`page must be between 1 and ${i}, the number of pages this search has`);if(r===s.page)return{page:r,alreadyShowing:!0,...(0,g.Dg)(b.getState())};o.activePins?.length>0&&p((0,u.wc)()),p((0,m.LF)([{page:r}]));let l=await y(b,{signal:t?.signal,queryBefore:s});if("failed"===l)throw Error(`Page ${r} did not load â ask the user to try the search again`);if("notSearched"===l)throw Error(`The page did not move to page ${r} â ask the user to try the search again`);return"refetched"!==l?{page:r,stillLoading:!0}:{page:r,...(0,g.Dg)(b.getState())}},[p,b])),D=(0,o.RT)(E),F=D?.chatId,R=D?.sessionInfo?.chatSessionId,U=D?.connection==="connected";(e=>{let{chatId:t,chatSessionId:r,connected:a}=e,o=(0,i.wA)(),[l]=(0,n.useRouter)().asPath.split("?"),u=(0,s.useMemo)(()=>[{key:"currentUrl",value:l}],[l]);(0,s.useEffect)(()=>{a&&t&&o((0,h.CO)({chatId:t,chatSessionId:r,updates:u}))},[t,r,a,u,o])})({chatId:F,chatSessionId:R,connected:U});let z=S.join("|");(0,s.useEffect)(()=>{U&&E?.getSession()?.updateSession({...S.length>0&&{tags:{UserInfo:S}}})},[U,E,w,z]);let B=(0,s.useMemo)(()=>({highlight_listing:P,launch_virtual_tour:I,get_current_property_id:A,get_search_criteria:$,search_properties:L,update_view_parameters:q}),[P,I,A,$,L,q]);return x||C||"otm"!==N?null:(0,a.jsx)(o.iy,{debug:!0,ref:v,baseUrl:_,provider:"Azure",theme:"homes",dark:!1,sessionConfigProvider:()=>({application:"TestHarness",profile:"LocalDev",promptName:"basic-assistant",model:"gpt-realtime-2",mcpServerUrl:j}),clientTools:B,widgets:k,onFeedback:e=>console.log("feedback",e),onReady:e=>{console.log("session",e.getSession()),T(e)}})},v=e=>(0,a.jsx)(l.x,{recentSearchAction:"async",aiTextarea:!0,children:(0,a.jsx)(S,{...e})})}}]);
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.