1import{j as i}from"./jsx-runtime-BgjmLhhW.js";import{y as x}from"./page-card-D5JTnOKL.js";import{r as c}from"./index-BqkNX_XC.js";import{s as D}from"./config-CBjiZsYk-oYtWVIpX.js";import{i as $}from"./content-type-model-DfcDF4vP.js";import{v}from"./LoadSkeletonCard-Ccblb3fU-EmZmQDJx.js";import{H as I}from"./Notification-LtqrAxb8-BkaR9_ot.js";import{u as j}from"./useScreenSize-DtlQefRJ-Cll4q4yh.js";import"./generateReadableDate-CwmGI8_H-Bqz4Uw5l.js";import"./index-DQ1x7BdZ-DBulPlol.js";import"./ClientOnly-vjwMHHPm-BqJfK8qh.js";import"./FaIcon-DTQallQy-Cfu02mpc.js";import"./iconsColorConfig-DWXmO4aY-DCRMUg93.js";import"./adobeEvent-CzOHUpT4-CQULBfuG.js";import"./adobe-tracking-map-FuYnSgXJ-nXOxFVsQ.js";import"./adobe-tracking-DpSHGK7T-QlveT4Bz.js";import"./sanitiseHtml-BlsISXRY-CHTsGGBt.js";import"./_commonjsHelpers-BkfeUUK--CtUiGMfT.js";import"./breakpoints-BFMC4mhA.js";const k=(t,n,e)=>{const[p,u]=c.useState(null),[d,l]=c.useState(!1),[f,s]=c.useState();return c.useEffect(()=>{if(!n)return;l(!0),s(void 0);const a=new URLSearchParams;a.append("dreReference",n),a.append("rows","1"),e.siteId&&a.append("siteId",e.siteId),e.locale&&a.append("locale",e.locale),e.userType&&a.append("userType",e.userType);const h=`${t.endsWith("/")?t:`${t}/`}${D}?${a.toString()}`;fetch(h,{method:"POST"}).then(r=>r.json()).then(r=>{r.searchDocuments&&r.searchDocuments.length>0?u(r.searchDocuments[0]):s(new Error("Document not found"))}).catch(r=>{s(r)}).finally(()=>{l(!1)})},[t,n,e?.siteId,e?.locale,e?.userType]),[p,d,f]},Q=t=>{const{marketingServiceUrl:n,glsBaseUrl:e,showSummary:p=!0,showExtension:u=!0,showMaterialType:d=!1,headingSize:l="s",ueAttributes:f={},bgColor:s="white",adobeTrackingLinkForPage:a,openInNewTab:h=!0,isDraftMode:r=!1,translations:g,dataFetchedAt:y}=t,m="documentData"in t&&!!t.documentData,T=j(!1),[w,S,b]=k(e,m?"":t.documentReference,m?{}:{siteId:t.siteId,locale:t.locale,userType:t.userType}),o=m?t.documentData:w;if(!m){if(S)return i.jsx(v,{numberOfCards:1,screenSize:T});if(b)return r?i.jsx(I,{heading:"Failed to load document",type:"error",marketingServiceUrl:n,children:"Unable to fetch document data."}):null}return o?i.jsxs(i.Fragment,{children:[y&&i.jsxs("time",{dateTime:y,className:"sr-only",children:["Data fetched at ",y]}),i.jsx(x,{title:o.title,summary:o.description,documentType:o.extension,materialType:o.materialType,showExtension:u,showMaterialType:d,publicationDate:o.publicationDate,link:`${e.replace(/\/varnish-api\/?$/,"").replace(/\/$/,"")}/gls-download/${o.dreReference.replace("documents/","literature/")}`,showImage:!1,showSummary:p,headingSize:l,ueAttributes:f,bgColor:s,marketingServiceUrl:n,contentType:$.Text,adobeTrackingLinkForPage:a,openInNewTab:h,translations:g})]}):null};export{Q as DocumentCard};
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.