1import{j as e}from"./jsx-runtime-BgjmLhhW.js";import{r as a}from"./index-BqkNX_XC.js";import{s as re,f as te}from"./generateReadableDate-CwmGI8_H-Bqz4Uw5l.js";import{m as se}from"./ClientOnly-vjwMHHPm-BqJfK8qh.js";import{$ as ae}from"./FaIcon-DTQallQy-Cfu02mpc.js";import{e as oe}from"./iconsColorConfig-DWXmO4aY-DCRMUg93.js";import{$ as ie,f as le}from"./Table-BWNz1BTu-BJ_zIGYo.js";import{D as ne,I as ce,w as de}from"./BuildQueryParams-Cjo2AjNM-BrfC2Buw.js";import{H as me}from"./Notification-CEe8adyL-S2ulUPgm.js";import{y as ue}from"./Button-D1BZXwDH-BDkMigXz.js";import"./index-DQ1x7BdZ-DBulPlol.js";import"./index-fN7hCOo3-DUOKOLJB.js";import"./_commonjsHelpers-BkfeUUK--CtUiGMfT.js";import"./config-CBjiZsYk-oYtWVIpX.js";import"./sanitiseHtml-BlsISXRY-CHTsGGBt.js";import"./adobe-tracking-map-FuYnSgXJ-nXOxFVsQ.js";import"./adobe-tracking-DpSHGK7T-QlveT4Bz.js";import"./keyboard-BZJvo5uC-D03dO0Qx.js";const pe=()=>e.jsx("div",{className:"oneds-load-indicator",children:e.jsxs("svg",{className:"aux-progress-ring","aria-hidden":"true",viewBox:"0 0 80 80",children:[e.jsx("circle",{className:"aux-progress-ring__background-circle",r:"38",cy:"40",cx:"40"}),e.jsx("circle",{className:"aux-progress-ring__circle",r:"38",cy:"40",cx:"40"})]})}),Ie=({glsBaseUrl:u,marketingServiceUrl:n,locale:p,siteId:B,userType:F,materialType:x,keyword:h,product:y,shareClass:g,productGroup:b,currency:f,language:v,country:j,additionalParams:k,sortCriteria:S,displayLimit:c="all",libraryBaseUrl:U,dateLabel:G="Date",titleLabel:P="Title",loadMoreLabel:E="Load more",showingCountLabel:R="Showing {visible} of {total} documents",isDraftMode:A=!1,documents:L,numFound:T,dataFetchedAt:_})=>{const H=a.useMemo(()=>ne({materialType:x,keyword:h,product:y,shareClass:g,productGroup:b,currency:f,language:v,country:j,additionalParams:k,sortCriteria:S}),[x,h,y,g,b,f,v,j,k,S]),o=L&&T!==void 0,[J,K,Q,V]=ce(u,o?"":H,o?{}:{siteId:B,locale:p,userType:F}),m=o?L:J,D=o?T:V,W=o?!1:K,Y=o?void 0:Q,[i,I]=a.useState(null),[l,M]=a.useState("none"),Z=a.useCallback(r=>{const s=r;if(i===s){const t=ie[l];M(t),t==="none"&&I(null)}else I(s),M("desc")},[i,l]),C=a.useMemo(()=>{if(!i||l==="none")return m;const r=[...m],s=l==="asc"?1:-1;return i==="date"?r.sort((t,d)=>(t.publicationDate-d.publicationDate)*s):r.sort((t,d)=>t.title.localeCompare(d.title,void 0,{sensitivity:"base"})*s),r},[m,i,l]),N=a.useMemo(()=>c==="all"?C:C.slice(0,c),[C,c]),q=a.useMemo(()=>N.map(r=>{var s,t;const d=re({timestamp:r.publicationDate,locale:p,timeZone:"UTC"}),X=`${u.replace(/\/varnish-api\/?$/,"").replace(/\/$/,"")}/gls-download/${r.dreReference.replace("documents/","literature/")}`,ee=te[(s=r.extension)==null?void 0:s.toLowerCase()]||"file";return{id:r.documentId,cells:{date:d,title:e.jsxs("a",{href:X,target:"_blank",rel:"noopener noreferrer",className:"oneds-table__link oneds-body-s",children:[e.jsx(se,{children:e.jsx(ae,{iconId:ee,className:"oneds-table__icon",color:oe.dark,marketingServiceUrl:n,width:"16px",height:"16px"})}),r.title,e.jsxs("span",{className:"sr-only",children:[((t=r.extension)==null?void 0:t.toUpperCase())||"Document",", opens in a new tab"]})]})}}}),[N,p,u,n]),w=c!=="all"&&D>c&&!!U,$=w?de({materialType:x,keyword:h,product:y,shareClass:g,productGroup:b,currency:f,language:v,country:j,additionalParams:k}):"",z=$?`?${$}`:"",O=w?`${U}${z}`:void 0;return W?e.jsx("div",{className:"oneds-simple-document-list__loading",children:e.jsx(pe,{})}):Y?A?e.jsx(me,{heading:"Failed to load documents",type:"error",marketingServiceUrl:n,children:"Unable to fetch document list."}):null:m.length===0?null:e.jsx("div",{className:"container-fluid",children:e.jsx("div",{className:"row",children:e.jsxs("div",{className:"oneds-simple-document-list",children:[_&&e.jsxs("time",{dateTime:_,className:"sr-only",children:["Data fetched at ",_]}),e.jsx(le,{columns:[{key:"date",label:G,sortable:!0},{key:"title",label:P,sortable:!0}],rows:q,sortColumn:i,sortDirection:l,onSort:Z,marketingServiceUrl:n}),w&&e.jsxs("div",{className:"oneds-simple-document-list__load-more",children:[e.jsx(ue,{appearance:"tertiary",color:"default",label:E,buttonLink:O,buttonIconVisible:!0,buttonIcon:"arrow-right",marketingServiceUrl:n}),e.jsx("span",{className:"oneds-simple-document-list__divider oneds-body-s",children:"|"}),e.jsx("span",{className:"oneds-simple-document-list__counter oneds-body-s","aria-live":"polite",children:R.replace("{visible}",String(N.length)).replace("{total}",String(D))})]})]})})})};export{Ie as SimpleDocumentList};
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.