1import{_ as e,f as t,g as n,m as r,yt as i}from"./vendor-nostr-B8luZNPL.js";var a=r(t),o=0,s=5,c=`bc`;function l(t){for(let[r,i]of[[n,0],[e,1]])try{let{prefix:e,words:n}=r.decode(t,90);if(e!==c)continue;let a=n[0];if(a!==i)continue;let o=r.fromWords(n.slice(1));return a===0&&o.length===20||o.length===32}catch{}return!1}function u(e){try{let t=a.decode(e);return t.length===21?t[0]===o||t[0]===s:!1}catch{return!1}}function d(e){return typeof e!=`string`||!e?!1:e.toLowerCase().startsWith(`${c}1`)?l(e):u(e)}var f=i.Point,p=`qpzry9x8gf2tvdw0s3jn54khce6mua7l`,m=(()=>{let e=new Int8Array(128).fill(-1);for(let t=0;t<32;t++)e[p.charCodeAt(t)]=t;return e})(),h=734539939;function g(e){let t=[996825010,642813549,513874426,1027748829,705979059],n=1;for(let r of e){let e=n>>>25;n=(n&33554431)<<5^r;for(let r=0;r<5;r++)e>>>r&1&&(n^=t[r])}return n}function _(e){let t=[];for(let n=0;n<e.length;n++)t.push(e.charCodeAt(n)>>>5);t.push(0);for(let n=0;n<e.length;n++)t.push(e.charCodeAt(n)&31);return t}function v(e,t){return g(_(e).concat(t))===h}function y(e){let t=0,n=0,r=[];for(let i of e){if(i<0||i>31)throw Error(`Silent payment address: invalid 5-bit value.`);for(t=t<<5|i,n+=5;n>=8;)n-=8,r.push(t>>>n&255)}if(n>=5)throw Error(`Silent payment address: non-canonical padding.`);if(t<<8-n&255)throw Error(`Silent payment address: non-zero padding bits.`);return Uint8Array.from(r)}function b(e){if(e.length!==33||e[0]!==2&&e[0]!==3)return!1;try{return f.fromBytes(e),!0}catch{return!1}}function x(e){if(typeof e!=`string`)return!1;let t=e.toLowerCase();return t.startsWith(`sp1`)||t.startsWith(`tsp1`)}function S(e){if(typeof e!=`string`||e.length===0)throw Error(`Silent payment address: empty string.`);if(e.length>1023)throw Error(`Silent payment address: too long.`);if(e.toLowerCase()!==e&&e.toUpperCase()!==e)throw Error(`Silent payment address: mixed case.`);let t=e.toLowerCase(),n=t.lastIndexOf(`1`);if(n<1)throw Error(`Silent payment address: missing separator.`);let r=t.slice(0,n),i=t.slice(n+1);if(i.length<7)throw Error(`Silent payment address: data part too short.`);let a;if(r===`sp`)a=`mainnet`;else if(r===`tsp`)a=`testnet`;else throw Error(`Silent payment address: unknown HRP "${r}".`);for(let e=0;e<r.length;e++){let t=r.charCodeAt(e);if(t<33||t>126)throw Error(`Silent payment address: HRP contains invalid character.`)}let o=[];for(let e=0;e<i.length;e++){let t=m[i.charCodeAt(e)];if(t===-1)throw Error(`Silent payment address: invalid character in data part.`);o.push(t)}if(!v(r,o))throw Error(`Silent payment address: invalid checksum.`);let s=o.slice(0,o.length-6),c=s[0];if(c>31)throw Error(`Silent payment address: invalid version.`);if(c===31)throw Error(`Silent payment address: reserved version 31.`);let l=y(s.slice(1));if(c===0){if(l.length!==66)throw Error(`Silent payment v0: data part must be exactly 66 bytes (got ${l.length}).`)}else if(l.length<66)throw Error(`Silent payment v${c}: data part must be at least 66 bytes (got ${l.length}).`);let u=l.slice(0,33),d=l.slice(33,66);if(!b(u))throw Error(`Silent payment address: scan key is not a valid compressed point.`);if(!b(d))throw Error(`Silent payment address: spend key is not a valid compressed point.`);return{hrp:r,network:a,version:c,scanPubKey:u,spendPubKey:d}}function C(e){try{return S(e),!0}catch{return!1}}export{d as i,x as n,C as r,S as t};
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.