1import{o as e}from"./rolldown-runtime-ln9q81idz.js";import{a as t}from"../index.js";import{r as n}from"./context-he0y8lyzw.js";import{t as r}from"./jsx-runtime-msxpyqc77.js";import{t as i}from"./classnames-bsusz7cy3.js";import{a,i as o,n as s,o as c,r as l}from"./globalsearch-ogyvjduw9.js";import{l as u,s as d}from"./slug-m4vr7aruy.js";import{t as f}from"./uselargescreen-ef31qgpjj.js";import{n as p}from"./usepersistedinmemoryglobalstate-hi8va9knn.js";import{t as m}from"./sortby-o30bm6l59.js";import{t as h}from"./index.module-m9udg25ct.js";import{a as g,i as _,r as v}from"./schemas-o9237cn3e.js";var y=e(t(),1),b=e(i(),1),x=r();function S({internal:e,popularResources:t}){let{trackEvent:r}=(0,y.use)(n),[i,l]=p({q:``,category:[],product:[]},`global-full-search-params`),{q:u,category:d,product:m}=i,{searchResponses:g,trackSelection:_,fetchNextPage:v,hasNextPage:S}=o((0,y.useMemo)(()=>D(i,e),[i,e]),!0),E=g?.pages.flatMap(e=>e.hits)??[],O=g?.pages[0].facets,A=g?.pages[0].nbHits??0,[j,N]=(0,y.useState)(!1),P=f(),F=j&&!P,I=(0,y.useId)(),L=O&&Object.keys(O).length>0,R=h(e=>{e&&r(`Search - Full results submit query`,{})},s),z=e=>{l({...i,q:e}),R(e)};return(0,x.jsxs)(`div`,{className:`container grid grid-flow-dense gap-x-6 gap-y-5 lg:grid-cols-[13rem_1fr] xl:grid-cols-[18rem_1fr]`,children:[(0,x.jsxs)(`div`,{className:`lg:col-start-2 flex items-center gap-5 flex-wrap-reverse`,children:[(0,x.jsxs)(`button`,{className:(0,b.default)(`block lg:hidden btn btn-tertiary px-0 py-4 flex-none transition-colors`,!L&&`btn--disabled`),"aria-owns":I,onClick:()=>N(!j),disabled:!L,children:[(0,x.jsx)(`span`,{className:(0,b.default)(`fa mr-2.5`,F?`fa-arrow-left`:`fa-filter`)}),F?`Back`:`Filters`]}),(0,x.jsx)(a,{"aria-label":`Search Aha!`,autoFocus:!0,value:u,onChange:z,onSubmit:()=>r(`Search - Full results submit query`,{}),className:(0,b.default)(`flex-1`,F&&`invisible`),children:(0,x.jsx)(c,{placeholder:`Search Aha!`,className:`px-7 py-4 w-full rounded-full`})})]}),(0,x.jsx)(`div`,{className:(0,b.default)(`lg:block lg:col-start-1 lg:row-start-1 lg:row-span-2`,F?`block`:`hidden`),id:I,"aria-expanded":F,children:w([(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`p`,{className:`title-6 lg:hidden`,children:`Filters`}),(0,x.jsx)(`p`,{className:`title-6 hidden lg:block`,children:`Browse and filter`})]}),O?.category&&(0,x.jsx)(T,{heading:`Resource`,facetFilters:d,facets:O.category,facetOrdering:g?.pages[0].renderingContent?.facetOrdering?.values?.category,onCheckboxClick:e=>l({...i,category:C(d,e)})},`resource`),O?.product&&(0,x.jsx)(T,{heading:`Product`,facetFilters:m,facets:O.product,facetOrdering:g?.pages[0].renderingContent?.facetOrdering?.values?.product,onCheckboxClick:e=>l({...i,product:C(m,e)})},`product`)].filter(Boolean),(0,x.jsx)(`div`,{className:`h-px bg-gray-200 my-5`}))}),E.length>0?(0,x.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,x.jsxs)(`p`,{children:[(0,x.jsx)(`span`,{className:`text-sapphire-500 font-bold`,children:A}),` `,(0,x.jsx)(`span`,{className:`text-dark-800`,children:A===1?`result`:`results`})]}),E.map((e,t)=>(0,x.jsx)(k,{result:e,onClick:()=>{_(e.objectID,t),r(`Search - Full results click`,{})}},e.objectID)),S&&(0,x.jsxs)(`button`,{type:`button`,className:`btn btn-primary self-center`,onClick:()=>{v()},children:[`Show more `,(0,x.jsx)(`span`,{className:`fa fa-chevron-down`})]})]}):(0,x.jsx)(M,{popularResources:t,setQuery:z})]})}function C(e,t){let n=e.indexOf(t);return n===-1?[...e,t]:e.toSpliced(n,1)}function w(e,t){let n=[];return e.forEach(e=>{n.length&&n.push(t),n.push(e)}),n}function T({heading:e,facetFilters:t,facetOrdering:r,facets:i,onCheckboxClick:a}){let{trackEvent:o}=(0,y.use)(n),s=Object.keys(i);if(r){let{order:e,sortRemainingBy:t}=r;e&&t===`hidden`&&(s=s.filter(t=>e.includes(t))),e&&(s=m(s,t=>{let n=e.indexOf(t);return n===-1?1/0:n}))}return(0,x.jsxs)(`fieldset`,{className:`block w-[unset] mb-5`,children:[(0,x.jsx)(`legend`,{className:`title-5 mb-2`,children:e}),(0,x.jsx)(`div`,{className:`flex flex-col`,children:s.map(e=>(0,x.jsx)(E,{checked:t.includes(e),onChange:t=>{a(e),t.target.checked&&o(`Search - Full results use filter`,{filter_type:e})},label:e,count:i[e]},e))})]})}function E({checked:e,onChange:t,label:n,count:r}){let i=(0,y.useId)();return(0,x.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,x.jsxs)(`label`,{htmlFor:i,className:`title-6 py-2 grow flex items-center gap-2.5`,children:[(0,x.jsx)(`input`,{id:i,type:`checkbox`,checked:e,onChange:t}),n]}),(0,x.jsx)(l,{filled:e,children:r})]})}function D({q:e,category:t,product:n},r){let i=[t.map(e=>`category:${e}`),n.map(e=>`product:${e}`)].filter(e=>e.length>0);i.length===0&&(i=void 0);let a=!r&&!!e;return{query:e,facets:[`category`,`product`],facetFilters:i,attributesToHighlight:[`title`,`description`],attributesToSnippet:r?[`content:50`]:void 0,attributesToRetrieve:[`url`,`category`,`product`,`image`,`wistiaId`],hitsPerPage:e||i?20:0,analytics:a,clickAnalytics:a,analyticsTags:[`Full search`,t.length+n.length>0?`Filtered`:`Unfiltered`]}}var O=v({objectID:_(),url:g({protocol:/^https$/,hostname:/^(support|www)\.aha\.io$/}),category:_(),image:_().nullish(),wistiaId:_().nullish(),_highlightResult:v({title:v({value:_()}),description:v({value:_()})}),_snippetResult:v({content:v({value:_()})}).optional()});function k({result:e,onClick:t}){let{success:n,data:r,error:i}=O.safeParse(e);if(!n)return null;let a=r.url,o=r.category||`Website`;return(0,x.jsx)(A,{href:a,primaryText:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`p`,{dangerouslySetInnerHTML:{__html:r._highlightResult.title.value},className:`title-5 [&_mark]:text-sapphire-500 [&_mark]:bg-sapphire-10 m-0 mb-2`}),(0,x.jsx)(`p`,{dangerouslySetInnerHTML:{__html:r._highlightResult.description.value},className:`line-clamp-1 xl:line-clamp-2 [&_mark]:text-sapphire-500 [&_mark]:bg-sapphire-10 m-0 mb-2`}),r._snippetResult&&(0,x.jsx)(`p`,{dangerouslySetInnerHTML:{__html:r._snippetResult.content.value},className:`border-l-3 border-l-sapphire-500 pl-4 [&_mark]:text-sapphire-500 [&_mark]:bg-sapphire-10 my-2`})]}),category:o,onClick:t,image:r.image,isVideo:!!r.wistiaId})}function A({primaryText:e,category:t,image:n,isVideo:r,href:i,...a}){return(0,x.jsxs)(`a`,{className:`flex no-underline no-animated-line transition-colors border border-gray-200 hover:border-sapphire-500 focus:border-sapphire-500 rounded-lg overflow-hidden shadow-[0px_24px_24px_-24px_#767E861D] group`,href:i&&d(i),...a,children:[n&&(0,x.jsxs)(`div`,{className:`hidden md:block w-64 lg:w-72 xl:w-92 flex-none contain-strict relative`,children:[(0,x.jsx)(`img`,{src:n,alt:``,className:(0,b.default)(`size-full object-cover object-left`,r&&`brightness-75`),loading:`lazy`}),r&&(0,x.jsx)(`span`,{className:`absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 size-12 text-[48px] text-white fa fa-circle-play`})]}),(0,x.jsxs)(`div`,{className:`p-7 min-w-0`,children:[t&&(0,x.jsxs)(`p`,{className:`text-sm text-sapphire-500 font-bold flex gap-1.5 items-center mb-4`,children:[(0,x.jsx)(j,{category:t}),t]}
1),e,i&&(0,x.jsx)(`p`,{className:`line-clamp-1 m-0 overflow-hidden`,children:(0,x.jsx)(`span`,{className:`text-sm text-gray-600 animated-line group-hover:animated-line-hover`,children:new URL(i,u.siteUrl).href})})]})]})}function j({category:e}){return(0,x.jsx)(`img`,{src:{"AI prompt":`/assets/ai-prompt-fupa1c3zs.png`,Blog:`/assets/blog-q3ia19tza.png`,Event:`/assets/video-hxvab4j1y.png`,Guide:`/assets/guide-n45qj8sxx.png`,"Support article":`/assets/kb-ohqmqekwf.png`,Template:`/assets/guide-n45qj8sxx.png`,Video:`/assets/video-hxvab4j1y.png`}[e]??`/assets/website-f8of4v9mc.png`,className:`size-5`,alt:``})}function M({popularResources:e,setQuery:t}){return(0,x.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,x.jsx)(`p`,{className:`title-5 mt-5 mb-0`,children:`Popular resources`}),e.map(e=>e.slug?(0,x.jsx)(A,{primaryText:(0,x.jsx)(`p`,{className:`title-5 m-0 mb-2`,children:e.title}),category:e.category,href:e.slug},e.title):(0,x.jsx)(N,{resource:e,setQuery:t},e.title))]})}function N({resource:e,setQuery:t}){return(0,x.jsx)(A,{primaryText:(0,x.jsxs)(`p`,{className:`title-5 m-0`,children:[(0,x.jsx)(`span`,{className:`fa fa-search text-sapphire-500 mr-2`}),` `,e.title]}),onClick:()=>{t(e.title),document.documentElement.scrollTop=0},category:e.category})}var P={default:S};export{P as export_223bbb0e97f6};
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.