var e={e690408e:{kty:`EC`,crv:`P-256`,x:`sUKjWXQOvPrUPvEYi3xRRuJxCq0wF1aha1Kv5DFWFbE`,y:`FRnqjcREduCl8y0d1E6fcKWzwBDP3HBQgv6tFx6CXus`}},t=`e690408e`,n=new Set([]),r=`recast-pro`;function i(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`)+`=`.repeat((4-e.length%4)%4),n=atob(t),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return r}async function a(e){let t=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(e));return[...new Uint8Array(t)].map(e=>e.toString(16).padStart(2,`0`)).join(``)}var o=new Map;function s(e,t){let n=o.get(e);return n||(n=crypto.subtle.importKey(`jwk`,t,{name:`ECDSA`,namedCurve:`P-256`},!1,[`verify`]),o.set(e,n)),n}function c(e){try{return JSON.parse(new TextDecoder().decode(i(e)))}catch{return null}}async function l(r){let i=r.trim(),a=i.indexOf(`.`);if(a<=0||a===i.length-1)return{valid:!1,reason:`format`};let o=c(i.slice(0,a));if(!o)return{valid:!1,reason:`format`};let l=o.kid??t,u=e[l];return u?d(i,{[l]:await s(l,u)},l,n):{valid:!1,reason:`signature`}}async function u(e,t){let n=e.trim(),a=n.indexOf(`.`);if(a<=0||a===n.length-1)return{valid:!1,reason:`format`};let o=n.slice(0,a),s=n.slice(a+1),l,u;try{l=i(s),u=new TextEncoder().encode(o)}catch{return{valid:!1,reason:`format`}}let d;try{d=await crypto.subtle.verify({name:`ECDSA`,hash:`SHA-256`},t,l,u)}catch{return{valid:!1,reason:`signature`}}if(!d)return{valid:!1,reason:`signature`};let f=c(o);return f?f.p===r?f.exp&&Date.now()/1e3>f.exp?{valid:!1,reason:`expired`,payload:f}:{valid:!0,payload:f}:{valid:!1,reason:`product`,payload:f}:{valid:!1,reason:`format`}}async function d(e,t,n,r=new Set){let i=e.trim(),o=i.indexOf(`.`);if(o<=0||o===i.length-1)return{valid:!1,reason:`format`};if(r.has(await a(i)))return{valid:!1,reason:`revoked`};let s=c(i.slice(0,o));if(!s)return{valid:!1,reason:`format`};let l=t[s.kid??n];return l?u(e,l):{valid:!1,reason:`signature`}}export{u as n,l as t};