@wcag-checkr/ci 1.0.0-rc.21 → 1.0.0-rc.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ import{c as C}from"./crash-reporter-Dc5lvxvY.js";const i="auditCache:",w=24*60*60*1e3;async function d(t){const e=new TextEncoder().encode(t),a=await crypto.subtle.digest("SHA-256",e);return Array.from(new Uint8Array(a)).map(n=>n.toString(16).padStart(2,"0")).join("")}async function k(t){const e=i+t,n=(await chrome.storage.local.get(e))[e];return!n||Date.now()-n.cachedAt>w?null:n}async function b(t){const e=i+t.lookupKey;await chrome.storage.local.set({[e]:t})}async function M(){const t=await chrome.storage.local.get(null),e=Object.keys(t).filter(a=>a.startsWith(i));e.length>0&&await chrome.storage.local.remove(e)}async function x(t){return d(JSON.stringify(t))}async function S(t){return d(JSON.stringify([...t??[]].sort()))}function O(t){return{...f,...t??{},enabledChecks:{...f.enabledChecks,...(t==null?void 0:t.enabledChecks)??{}}}}const f={enabled:!1,provider:"anthropic",apiKey:"",costCapUsd:5,model:"",enabledChecks:{altText:!0,headings:!0,sensory:!0,aria:!1,imageOfText:!0,colorOnlyMeaning:!0,genericLinkText:!0,wallOfText:!0,languageMismatch:!0},imageOfTextMaxImages:5,maxCandidatesPerCheck:10},A=C("ai-usage-log"),s="aiUsageLog",y=200;async function E(t){try{const e=await m();e.unshift(t),e.length>y&&(e.length=y),await chrome.storage.local.set({[s]:e})}catch(e){A.warn("failed to append ai usage entry",e)}}async function m(){try{const e=(await chrome.storage.local.get(s))[s];return Array.isArray(e)?e:[]}catch{return[]}}function T(t,e=10){const a=new Date,n=`${a.getUTCFullYear()}-${a.getUTCMonth()}`;let r=0,l=0,u=0;const c={};for(const o of t){r+=o.totalCostUsd,`${new Date(o.at).getUTCFullYear()}-${new Date(o.at).getUTCMonth()}`===n&&(l+=o.totalCostUsd,u++);for(const[g,h]of Object.entries(o.byCheck))h!=null&&(c[g]=(c[g]??0)+h)}return{totalSpentUsd:r,totalAudits:t.length,spentThisMonthUsd:l,auditsThisMonth:u,averageCostUsd:t.length===0?null:r/t.length,byCheck:c,recent:t.slice(0,e)}}async function D(t=10){const e=await m();return T(e,t)}async function _(){await chrome.storage.local.remove(s)}export{f as D,_ as a,S as b,M as c,b as d,E as e,k as g,x as h,D as l,O as m,d as s};