1import{a as X,e as V,r as u,j as e}from"./vendor-react-B4BIr4_A.js";import{S as O}from"./app-BCfwVS8x.js";import{f as H}from"./eventsStore-DaNHU_lI.js";import{normalizzaCodice as g,codiceLeggibile as y,formaValida as F,verificaDocumento as S,ETICHETTE_TIPO as _,VERIFY_LENGTH as D,etichettaStampa as B,sha256Hex as G}from"./documentiVerificati-dR5cu-bD.js";import{L as R,aw as C,bx as L,by as w,aJ as Q,C as k,bg as W,F as Y,bz as q,aE as J,aF as Z,z as K,V as M,H as ee}from"./icone-sito-BiOTxGdK.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./crashBlackBox-NHteRanH.js";import"./evento-comune-FmQYl2SX.js";import"./vendor-firebase-AOn3Fvmd.js";import"./firebase-config-Dn2Tu_JL.js";import"./publicUrls-C1QEMgMu.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import"./emailTemplate-CZj6Czj1.js";import"./fondoRiferimento-ChLBv03J.js";import"./programmaPdf-IwHG3E72.js";import"./emailFactCards-PLh9byk8.js";function te(c){if(!c)return"";const s=new Date(c);return Number.isNaN(s.getTime())?"":s.toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"})}function I(c){const s=String(c&&(c.message||c.code)||"");return/too-many|resource-exhausted/i.test(s)?"busy":"error"}const ie=60;function se(c,s){const i=typeof window<"u"?window.location.origin:"https://www.climpact.it",l=["code,trace_link",...s.map(t=>`${t},${i}/site/data/trace/citations?c=${encodeURIComponent(t)}`)],h=new Blob([`${l.join(`\r 2`)}\r 3`],{type:"text/csv;charset=utf-8"}),a=URL.createObjectURL(h),d=document.createElement("a");d.href=a,d.download=`trace-report-${c}-citations.csv`,document.body.appendChild(d),d.click(),d.remove(),setTimeout(()=>URL.revokeObjectURL(a),1e3)}function ae({codice:c,c:s}){const i=Number(s.n)||0,l=Array.isArray(s.codes)?s.codes:[],h=`${i.toLocaleString("en-US")} ${i===1?"citation":"citations"}`;return e.jsxs("div",{className:"vc-cits",children:[e.jsxs("p",{className:"vc-label vc-cits-label",children:[e.jsx(M,{size:12,"aria-hidden":"true"})," Citations in this report",e.jsx("span",{className:"vc-cits-n",children:i.toLocaleString("en-US")})]}),s.status==="match"&&e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"vc-cits-stato",children:[e.jsx(C,{size:16,"aria-hidden":"true"}),e.jsxs("span",{children:["TRACE recorded the list of the ",h," in this report when it was issued, and the list matches its fingerprint. Open any of them in the citation database."]})]}),e.jsx("ul",{className:"vc-cits-elenco"+(l.length>ie?" is-lungo":""),"aria-label":`The ${h} in this report`,children:l.map(a=>e.jsx("li",{children:e.jsx("a",{className:"vc-cit",href:`/site/data/trace/citations?c=${encodeURIComponent(a)}`,title:`Open ${a} in the TRACE citation database`,children:a})},a))}),e.jsxs("div",{className:"vc-cits-piede",children:[e.jsxs("button",{type:"button",className:"site-btn site-btn-ghost vc-cits-csv",onClick:()=>se(c,l),children:[e.jsx(ee,{size:16,"aria-hidden":"true"})," Download the list (CSV)"]}),e.jsxs("p",{className:"vc-hint vc-cits-impronta",children:["SHA-256 of the list, one code per line in the order of the report:"," ",e.jsx("span",{className:"vc-code",children:s.sha256})]})]})]}),s.status==="mismatch"&&e.jsxs("div",{className:"vc-verdict vc-verdict-bad",role:"alert",children:[e.jsx(L,{size:20,"aria-hidden":"true"}),e.jsxs("div",{children:[e.jsx("p",{className:"vc-verdict-title",children:"The list of citations does not match its fingerprint."}),e.jsxs("p",{className:"vc-verdict-text",children:["TRACE recorded ",h," for this report, but the stored list is no longer the one fingerprinted when the report was issued, so it is not shown. The PDF itself is verified above, and it prints every citation it contains. Please write to [email protected]."]})]})]}),s.status==="missing"&&e.jsxs("div",{className:"vc-verdict vc-verdict-no",role:"status",children:[e.jsx(k,{size:20,"aria-hidden":"true"}),e.jsxs("div",{children:[e.jsx("p",{className:"vc-verdict-title",children:"The list of citations could not be read."}),e.jsxs("p",{className:"vc-verdict-text",children:["TRACE recorded ",h," for this report. Try again in a moment; the PDF itself prints every citation it contains."]})]})]})]})}function Ae(){const{code:c=""}=X(),s=V(),i=g(c),[l,h]=u.useState(y(i)),[a,d]=u.useState(i?"loading":"idle"),[t,j]=u.useState(null),[n,x]=u.useState(null),N=u.useRef(null);u.useEffect(()=>{c&&i&&i!==c&&s(`/verify/${i}`,{replace:!0})},[c,i,s]),u.useEffect(()=>{if(h(y(i)),x(null),!i){d("idle"),j(null);return}if(!F(i)){d("invalid"),j(null);return}let o=!0;return d("loading"),S(i).then(r=>{o&&(j(r),d(r&&r.valid?"valid":"invalid"))}).catch(r=>{o&&d(I(r))}),()=>{o=!1}},[i]);function $(o){o.preventDefault();const r=g(l);r&&s(`/verify/${r}`)}async function P(o){const r=o.target.files&&o.target.files[0];
3if(o.target.value="",!!r){x({nome:r.name,fase:"hashing"});try{const b=await G(new Uint8Array(await r.arrayBuffer()));x({nome:r.name,fase:"checking"});const v=await S(i,b);v&&v.valid&&v.file==="match"&&j(v),x({nome:r.name,fase:v&&v.file?v.file:"error"})}catch(b){x({nome:r.name,fase:I(b)})}}}const p=a==="valid"&&t,f=p&&t.context||{},z=p&&f.kind==="event"?H(f.startsAt||null,f.endsAt||null):"",T=p?te(t.issuedAt):"",U=g(l).length>0,E=p?_[t.kind]||"Document":"",m=p?t.fingerprint?n&&n.fase==="match"?"autentico":n&&n.fase==="mismatch"?"falso":"in-sospeso":"senza-impronta":"",A=n&&(n.fase==="hashing"||n.fase==="checking");return e.jsx(O,{tone:"dark",title:"Verify a document",noindex:!0,children:e.jsx("section",{className:"site-band vc-band",children:e.jsxs("div",{className:"site-wrap site-auth-wrap",children:[e.jsx("p",{className:"site-eyebrow",children:"Climpact documents"}),e.jsxs("h1",{className:"site-display",children:["Verify a",e.jsx("span",{className:"site-display-accent",children:"document."})]}),e.jsxs("p",{className:"site-lead vc-lead",children:["Every certificate, letter, form, programme, application and report that Climpact issues carries a"," ",D,"-character code and a QR code at the bottom of the page. The code tells you whether it matches a document we issued; the PDF itself tells you whether the one in your hands is that document. It is genuine only when both match."]}),e.jsxs("div",{className:"vc-card",children:[a==="loading"&&e.jsxs("p",{className:"vc-status",role:"status",children:[e.jsx(R,{size:16,className:"vc-spin","aria-hidden":"true"}),e.jsx("span",{children:"Checking the code..."})]}),p&&e.jsxs(e.Fragment,{children:[m==="autentico"&&e.jsxs("div",{className:"vc-verdict vc-verdict-ok",role:"status",children:[e.jsx(C,{size:20,"aria-hidden":"true"}),e.jsxs("div",{children:[e.jsx("p",{className:"vc-verdict-title",children:"Genuine document issued by Climpact."}),e.jsxs("p",{className:"vc-verdict-text",children:[n.nome," is identical, byte for byte, to the document we issued under this code."]})]})]}),m==="falso"&&e.jsxs("div",{className:"vc-verdict vc-verdict-bad",role:"alert",children:[e.jsx(L,{size:20,"aria-hidden":"true"}),e.jsxs("div",{children:[e.jsx("p",{className:"vc-verdict-title",children:"Not genuine."}),e.jsxs("p",{className:"vc-verdict-text",children:["The code is ours, but ",n.nome," is not the document we issued under it: it has been altered, or the code was copied onto another document. Do not rely on it."]})]})]}),m==="in-sospeso"&&e.jsxs("div",{className:"vc-verdict vc-verdict-no",role:"status",children:[e.jsx(w,{size:20,"aria-hidden":"true"}),e.jsxs("div",{children:[e.jsx("p",{className:"vc-verdict-title",children:"This code matches a document issued by Climpact."}),e.jsx("p",{className:"vc-verdict-text",children:"Now add the PDF you were given. A code can be copied onto another document; the file cannot: yours is genuine only if it is identical to the one we issued."})]})]}),m==="senza-impronta"&&e.jsxs("div",{className:"vc-verdict vc-verdict-no",role:"status",children:[e.jsx(w,{size:20,"aria-hidden":"true"}),e.jsxs("div",{children:[e.jsx("p",{className:"vc-verdict-title",children:"The code is ours."}),e.jsx("p",{className:"vc-verdict-text",children:"This document was issued before files were registered, so it cannot be checked file by file. Compare it line by line with the details below; if anything differs, do not rely on it and write to [email protected]."})]})]}),t.fingerprint&&m!=="autentico"&&e.jsxs("div",{className:"vc-file",children:[e.jsx("input",{ref:N,type:"file",accept:"application/pdf,.pdf",className:"vc-file-input",onChange:P,tabIndex:-1,"aria-hidden":"true"}),e.jsx("button",{type:"button",className:"site-btn vc-file-btn "+(m==="falso"?"site-btn-ghost":"site-btn-primary"),onClick:()=>N.current&&N.current.click(),disabled:A,children:A?e.jsxs(e.Fragment,{children:[e.jsx(R,{size:16,className:"vc-spin","aria-hidden":"true"})," Checking the file..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Q,{size:16,"aria-hidden":"true"})," ",m==="falso"?"Check another PDF":"Add the PDF"]})}),e.jsx("p",{className:"vc-hint",children:"The fingerprint of the file is computed on this device: the file itself is never uploaded. Only a printed copy? Ask for the PDF, or write to [email protected]."}),n&&(n.fase==="busy"||n.fase==="error"||n.fase==="unregistered")&&e.jsxs("div",{className:"vc-verdict vc-verdict-no vc-file-esito",role:"alert",children:[e.jsx(k,{size:20,"aria-hidden":"true"}),e.jsxs("div",{children:[e.jsx("p",{className:"vc-verdict-title",children:n.fase==="busy"?"Too many checks in a short time.":"The file could not be checked."}),e.jsx("p",{className:"vc-verdict-text",children:n.fase==="busy"?"Wait a few minutes and try again.":"Try again in a moment."})]})]})]}),(m==="autentico"||m==="senza-impronta")&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"vc-label vc-facts-label",children:"Registered under this code"}),e.jsxs("dl",{className:"vc-facts",children:[t.holder&&e.jsxs("div",{className:"vc-fact vc-fact-wide",children:[e.jsxs("dt",{children:[e.jsx(W,{size:12,"aria-hidden":"true"})," Issued to"]}),e.jsx("dd",{className:"vc-fact-big",children:t.holder})]}),e.jsxs("div",{className:"vc-fact vc-fact-wide",children:[e.jsxs("dt",{children:[e.jsx(Y,{size:12,"aria-hidden":"true"})," ",E]}),e.jsx("dd",{children:t.title||E})]}),f.title&&e.jsxs("div",{className:"vc-fact vc-fact-wide",children:[e.jsxs("dt",{children:[e.jsx(q,{size:12,"aria-hidden":"true"})," ",f.kind==="event"?"Event":"Context"]}),e.jsx("dd",{children:f.title})]}),z&&e.jsxs("div",{className:"vc-fact",children:[e.jsxs("dt",{children:[e.jsx(J,{size:12,"aria-hidden":"true"})," Event dates"]}),e.jsx("dd",{children:z})]}),t.kind==="certificate"&&e.jsxs("div",{className:"vc-fact",children:[e.jsxs("dt",{children:[e.jsx(C,{size:12,"aria-hidden":"true"})," Took part as"]}),e.jsx("dd",{children:t.role||"Attendee"})]}),T&&e.jsxs("div",{className:"vc-fact",children:[e.jsxs("dt",{children:[e.jsx(Z,{size:12,"aria-hidden":"true"})," Issued on"]}),e.jsx("dd",{children:T})]}),e.jsxs("div",{className:"vc-fact",children:[e.jsx("dt",{children:"Verification code"}),e.jsx("dd",{className:"vc-code",children:y(t.code)})]})]}),t.citations&&e.jsx(ae,{codice:t.code,c:t.citations})]})]}),a==="invalid"&&e.jsxs("div",{className:"vc-verdict vc-verdict-no",role:"alert",children:[e.jsx(w,{size:20,"aria-hidden":"true"}),e.jsxs("div",{children:[e.jsx("p",{className:"vc-verdict-title",children:t&&t.reason==="revoked"?"This document has been withdrawn.":"Not recognised."}),e.jsx("p",{className:"vc-verdict-text",children:t&&t.reason==="revoked"?"Climpact issued this document and later withdrew it. It is no longer valid.":F(i)?"No document issued by Climpact matches this code. Check that it was typed exactly as printed; if it was, do not rely on the document and write to [email protected].":`A code has ${D} letters and digits, printed after climpact.it/verify/ at the bottom of the document.`})]})]}),(a==="busy"||a==="error")&&e.jsxs("div",{className:"vc-verdict vc-verdict-no",role:"alert",children:[e.jsx(k,{size:20,"aria-hidden":"true"}),e.jsxs("div",{children:[e.jsx("p",{className:"vc-verdict-title",children:a==="busy"?"Too many checks in a short time.":"The check could not be completed."}),e.jsx("p",{className:"vc-verdict-text",children:a==="busy"?"Wait a few minutes and try again.":"Check the connection and try again in a moment."})]})]}),e.jsxs("form",{className:"vc-form",onSubmit:$,children:[e.jsx("label",{className:"vc-label",htmlFor:"vc-input",children:a==="idle"?"Verification code":"Check another code"}),e.jsxs("div",{className:"vc-row",children:[e.jsx("input",{id:"vc-input",type:"text",className:"vc-input",value:l,onCh
3ange:o=>h(o.target.value),placeholder:B("XXXXXXXXXXXX"),autoComplete:"off",autoCapitalize:"characters",spellCheck:"false",maxLength:80}),e.jsxs("button",{type:"submit",className:"site-btn site-btn-primary vc-submit",disabled:!U||a==="loading",children:[e.jsx(K,{size:16,"aria-hidden":"true"})," Verify"]})]}),e.jsx("p",{className:"vc-hint",children:"You can paste the full address printed on the document, or just the code."})]})]})]})})})}export{Ae 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.