1import{r as e,U as o,l as r}from"./vendor-DLA_KchH.js";import{u as t,a as n}from"./useReports-CWu9lxg7.js";import{U as a,j as l,E as s,I as d}from"./index-D4KN-nyo.js";import"./useStandardData-CvVoNd35.js";import"./useApiData-cMoqmqfz.js";import"./useMockData-DhlK9Ued.js";import"./redux-vendor-Db6oaSHc.js";import"./utils-vendor-CcsuLBTu.js";function i({reportSlug:i=""}){const[u]=o(),c="true"===u.get("custom"),{report:p,loading:f,error:_}=n(i,{isCustomReport:c}),{PDFLink:m,loading:g,error:D}=(({report:o=null,useMockdata:r=!1}={})=>{const n=e.useMemo(()=>{var e,t,n;if(r)return{shouldFetch:!1,error:null};if(!o)return{shouldFetch:!1,error:a.CONTENT_LOAD_FAILED};if(!(null==(e=null==o?void 0:o.gated_content)?void 0:e.access_point_uuid))return{shouldFetch:!1,error:a.PERMISSION_DENIED};let s=null==(t=o.gated_content.downloadable_files)?void 0:t.find(e=>e.report_filename.toLowerCase().includes(".pdf"));return!s&&(null==(n=o.gated_content.downloadable_files)?void 0:n.length)>0&&(s=o.gated_content.downloadable_files[0],l.log("No PDF found, using first downloadable file:",s.report_filename)),s?(l.log(`Found file: ${s.report_filename} for access point: ${o.gated_content.access_point_uuid}`),{shouldFetch:!0,accessPointId:o.gated_content.access_point_uuid,fileName:s.report_filename,error:null}):(l.warn("No downloadable files found:",o.gated_content.downloadable_files),{shouldFetch:!1,error:a.CONTENT_NOT_FOUND})},[o,r]),{downloadUrl:s,loading:d,error:i}=t(n.accessPointId,n.fileName,n.shouldFetch),u=n.error||i;return{PDFLink:s,loading:!!n.shouldFetch&&d,error:u}})({report:p}),F=f||g,h=_||D;return h?r.jsx(s,{error:h,parent:"Report PDF Download"}):F?r.jsx(d,{}):m?void window.open(m,"_self"):r.jsx(s,{error:"PDF not available",parent:"Report PDF Download"})}export{i 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.