PageSourceSearch

https://www.qafilah.com/dist/client/assets/AramcoQafilah_SiteSearch-DZM4sx6m.js

js qafilah.com collected 2026-10-02 03:43:58 UTC 10,069 bytes, 1 lines download raw bytes

1import{r as l,j as e}from"./vendor-f5S74Hzf.js";import{q as te,cI as re,r as ae,ca as se,cc as le,cJ as ie,cr as F,cd as c,B as ne,cG as oe,cK as ce}from"./common-CHQtHwBh.js";import{u as ue}from"./shared/AramcoQafilah_Header/AramcoQafilah_SiteSearch-C4Hk9PwQ.js";import{T as C,aN as de,B as i,a3 as j,k as K,E as he,J as pe,K as me,aM as ge,H as xe,a2 as fe,j as be}from"./@chakra-ui/react-gJ6NaqAj.js";import"./html-react-parser-xE6q2Esb.js";import"./style-to-js-B6NqiOWy.js";import"./react-markdown-Bs7M-Au_.js";import"./devlop-Cl3hj7Sz.js";import"./micromark-util-decode-numeric-character-reference-CNs1qBpV.js";import"./micromark-util-decode-string-strjl-tx.js";import"./decode-named-character-reference-C3-224fz.js";import"./micromark-util-normalize-identifier-C9ANKk3v.js";import"./micromark-util-subtokenize-BC4BSQ9J.js";import"./micromark-util-chunked-DrRIdSP-.js";import"./micromark-util-combine-extensions-Bka6Sc1c.js";import"./micromark-factory-space-DRnmu9Gw.js";import"./micromark-util-character-hRuAkC1j.js";import"./micromark-core-commonmark-DkU5eqHe.js";import"./micromark-util-classify-character-DzqK33dx.js";import"./micromark-util-resolve-all-PQCKh0dx.js";import"./micromark-factory-destination-Cii3Ukc3.js";import"./micromark-factory-label-pk4cmpdi.js";import"./micromark-factory-title-cwTJpkI9.js";import"./micromark-factory-whitespace-DbSIwM2c.js";import"./mdast-util-to-string-C_aolqmU.js";import"./micromark-util-sanitize-uri-CaPxsR5P.js";import"./unist-util-visit-8_a2MF5S.js";import"./unist-util-visit-parents-B1S0AetN.js";import"./unist-util-is-BPZGFiMU.js";import"./remark-gfm-DBMNSnBZ.js";import"./swiper-BojwEeCi.js";import"./polished-VDK7He2T.js";import"./@babel/runtime-Bt6Ne3b9.js";import"./tailwind-merge-CPcsbTWB.js";import"./react-calendar-DqgCvrlm.js";import"./hoist-non-react-statics-BjaAnAum.js";import"./use-sidecar-BuciW2qi.js";import"./tslib-De9GV7Vy.js";import"./use-callback-ref-DBc0-MCP.js";import"./react-remove-scroll-BxC6qjtr.js";import"./react-remove-scroll-bar-DSTyrTd8.js";import"./react-style-singleton-76azCXWd.js";import"./aria-hidden-DQ5UC2Eg.js";const ct=({fields:h})=>{var H,N,B,M;const[o]=te(),{totalResultsCount:m,setTotalResultsCount:O}=l.useContext(re),[s,S]=l.useState(null),[I,Q]=l.useState(!1),[a,b]=l.useState(!1),[L,E]=l.useState(!1),{sitecoreContext:k}=ae(),G=k.custom.settings.searchRoot,{isMobileMenuOpen:q}=se(),P=((N=(H=k.route)==null?void 0:H.templateName)==null?void 0:N.toLowerCase())!=="bio page"?le(k):!0,w=l.useRef(null),$=((M=(B=h==null?void 0:h.resultsforXLabel)==null?void 0:B.value)==null?void 0:M.replace("{0}"," "))||"",J=ue(120),y=l.useRef(0),{searchQuery:u,setSearchQuery:X,categories:g,page:Y,handleSearch:R,handleCategorySelect:A,resetSearch:v,initialLoad:T,pageSize:z,loadMoreResults:U}=ie({searchRoot:G,defaultSort:"relevance",onResultsChange:(r,t)=>{S([...s&&!t?s:[],...r]);const n=s!=null&&s.length&&!t?s.length:0;y.current=n},onTotalResultsChange:O,onLoadingChange:Q}),_=Math.ceil(m/z),V=r=>{X(r.target.value)},W=r=>{r.key==="Enter"?E(!0):E(!1)};l.useEffect(()=>{s&&s.length>y.current&&s.length>0&&L&&setTimeout(()=>{const r=document.getElementById(`Card_site_search_result_${y.current}`);if(r instanceof HTMLElement){const t=r.querySelector("a");t instanceof HTMLElement&&t.focus(),r.scrollIntoView({behavior:"smooth",block:"center"})}},100)},[s,L]);const Z=r=>{r<1||r>_||U({newSearchQuery:u,pageNumber:r})},D=()=>{S([]),y.current=0,R({newSearchQuery:u,pageNumber:1,reset:!0,categories:g.map(r=>r.id||"")})};l.useEffect(()=>{const r=t=>{t.key==="Escape"&&(b(!1),v())};return a&&document.addEventListener("keydown",r),()=>{document.removeEventListener("keydown",r)}},[a,v]),l.useEffect(()=>(a?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[a]),l.useEffect(()=>{if(a&&w.current){const r=setTimeout(()=>{var t;(t=w.current)==null||t.focus()},100);return()=>clearTimeout(r)}},[a]),l.useEffect(()=>{const r=t=>{if(!a)return;const n='button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])',d=document.getElementById("search-overlay");if(!d)return;
1const p=d.querySelectorAll(n),x=p[0],f=p[p.length-1];t.key==="Tab"&&(t.shiftKey?document.activeElement===x&&(t.preventDefault(),f.focus()):document.activeElement===f&&(t.preventDefault(),x.focus()))};return a&&document.addEventListener("keydown",r),()=>{document.removeEventListener("keydown",r)}},[a]),l.useEffect(()=>{a&&u&&!T&&R({newSearchQuery:u,pageNumber:1,reset:!0,categories:g.map(r=>r.id||"")})},[g,a,u]);const ee=()=>{var r;return e.jsxs(de,{children:[e.jsx(i,{pos:"fixed",top:"0",left:"0",right:"0",zIndex:"9999",width:"100%",height:"100%",backgroundColor:"tints.dark.60",visibility:a?"visible":"hidden",opacity:a?1:0,transition:"all .75s ease-out",onClick:()=>{b(!1),v()}}),e.jsxs(i,{id:"search-overlay",role:"dialog","aria-modal":"true","aria-label":o("search.ariaLabels.searchOverlay"),pos:"fixed",top:"0",left:"0",right:"0",height:{base:"100dvh",lg:"auto"},backgroundColor:{base:"primary.gray",lg:"transparent"},maxHeight:"100dvh",width:"100vw",zIndex:"10000",visibility:a?"visible":"hidden",transition:"transform .6s ease-out,visibility .6s ease-out",transform:a?"translateY(0)":"translateY(-100%)",display:"flex",flexDirection:"column",pt:"xxl",overflow:"hidden",children:[e.jsx(i,{as:"header",position:"fixed",top:["md",null,null,"none"],left:"0",right:"0",zIndex:"1",width:"100%",height:["searchHeaderMobileHeight",null,null,"searchHeaderDesktopHeight"],display:"flex",alignItems:"center",justifyContent:"end",bgColor:"primary.gray",children:e.jsx(j,{display:"flex",alignItems:"center",justifyContent:"end",children:e.jsxs(K,{size:"lg",variant:"unstyled-w-hover-dark",onClick:()=>{b(!1),v()},"aria-labelledby":"close-search-button-text",display:"inline-flex",alignItems:"center",gap:"xxs",color:"primary.dark",children:[e.jsx(C,{id:"close-search-button-text",hidden:!0,children:o("search.ariaLabels.closeSearch")}),e.jsx(ne,{name:"close",fill:"currentColor",size:["lg",null,null,"sxl"]}),e.jsx(C,{size:["bodyS",null,null,"bodyL"],color:"primary.dark",children:o("search.close")})]})})}),e.jsxs(i,{as:"section",overflow:"auto",height:"100%",width:"100%",display:"flex",flexDirection:"column",children:[e.jsxs(i,{as:"form",role:"search","aria-labelledby":"search-submit-button-text",pt:["xs",null,null,"xxl"],display:"flex",flexDirection:"column",backgroundColor:"primary.gray",position:"relative",onSubmit:t=>{t.preventDefault(),D()},children:[e.jsxs(j,{children:[e.jsxs(he,{children:[e.jsx(C,{as:"label",htmlFor:"search-input-field",id:"search-input-text",className:"visually-hidden",children:o("search.ariaLabels.searchInput")}),e.jsx(pe,{id:"search-input-field",ref:w,placeholder:o("search.placeholder"),onChange:V,onKeyUp:W,value:u,variant:"search"}),e.jsx(me,{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",paddingRight:c("16px"),children:e.jsx(F,{color:"primary.dark",icon:"search",size:"lg",iconSize:c("32px"),variant:"unstyled-w-hover-dark",display:{base:"none",lg:"flex"},onClick:()=>D(),"aria-labelledby":"search-submit-button-text"})})]}),e.jsx(i,{role:"group","aria-label":o("search.ariaLabels.searchCategories"),pt:["md",null,null,"xxl"],pb:["xs",null,null,"md"],display:"flex",alignItems:"center",justifyContent:"center",gap:"md",children:(r=h==null?void 0:h.categoryTags)==null?void 0:r.map((t,n)=>{const d=t.fields;return e.jsx(K,{size:"lg",variant:g.includes(t)?"dark":"unstyled-w-hover-dark",onClick:()=>A(t),...!g.includes(t)&&{backgroundColor:"tints.black.10"},children:d.title.value},n)})})]}),I&&e.jsx(ge,{size:"sm",isIndeterminate:!0,position:"fixed",top:"0",left:"0",right:"0",zIndex:"9999",height:"6px",sx:{"& > div":{background:"linear-gradient(to right, rgba(32, 130, 184, 0.5) 0%, rgba(32, 130, 184, 1) 50%, rgba(32, 130, 184, 0.5) 100%)"},"& > div[data-indeterminate]":{background:"linear-gradient(to right, rgba(32, 130, 184, 0.5) 0%, rgba(32, 130, 184, 1) 50%, rgba(32, 130, 184, 0.5) 100%)"},backgroundColor:"rgba(32, 130, 184, 0.2)"}})]}),!T&&e.jsxs(i,{id:"search-results",role:"region","aria-label":o("search.ariaLabels.searchResults"),display:"flex",flexDirection:"column",flex:"1 1 auto",background:"primary.gray",pt:["xs",null,null,"xxl"],minHeight:"0",position:"relative",children:[e.jsx(i,{backgroundColor:"primary.white",children:e.jsxs(j,{backgroundColor:"primary.white",children:[e.jsxs(xe,{size:"h5",py:["lg",null,null,"xxl"],id:"search_results_heading",children:[m," ",$," '",u,"'"]}),e.jsx(fe,{display:"grid",gridTemplateColumns:["1fr",null,null,"repeat(2, 1fr)"],columnGap:"md",backgroundColor:"primary.white",pb:["xs",null,null,"xxl"],rowGap:["md",null,null,"xxl"],"aria-labelledby":"search_results_heading",children:s&&s.length>0&&s.map((t,n)=>{var d,p,x;return e.jsx(be,{id:`Card_site_search_result_${n}`,children:e.jsx(oe,{id:`search_result_${n}
1`,url:t.url||"",title:t.title||"",teaser:t.description,image:{url:((d=t.smallImage)==null?void 0:d.url)||"",alt:((p=t.smallImage)==null?void 0:p.alt)||""},topics:(x=t.topicTags)==null?void 0:x.map(f=>({id:f.id,title:f.title,theme:"default"})),date:t.date,aspectRatio:16/9,isDarkBgTheme:!1,variant:"search"})},n)})})]})}),e.jsx(i,{w:"100%",bgColor:"primary.white",mt:"auto",children:m>0&&_>1&&e.jsx(j,{bgColor:"white",py:["lg",null,null,"xxl"],children:e.jsx(i,{display:"flex",justifyContent:"center",alignItems:"center",children:e.jsx(ce,{totalResults:m,numberOfResults:z,page:Y,setPage:Z,loading:I,moduleId:"search-results",ariaDisabled:s?s.length>=m:!1})})})})]})]})]})]})};return e.jsxs("section",{"data-rendering":"SiteSearch",children:[e.jsx(C,{id:"search-submit-button-text",hidden:!0,children:o("search.ariaLabels.siteSearch")}),ee(),e.jsx(F,{icon:"search",size:"lg",variant:P&&J==="at-top"&&!q?"unstyled-w-hover-dark":"unstyled-w-hover-light",display:"flex","aria-labelledby":"search-submit-button-text",onClick:()=>b(!a),position:"relative",sx:{"& svg":{width:[c("32px"),null,null,c("28px")],height:[c("32px"),null,null,c("28px")]},padding:0,height:c("44px"),width:c("44px")}})]})};export{ct as default};

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.