// Best-effort guess at whether a license permits commercial use (selling prints), // from its name/abbreviation or — preferably — its full license text. Returns // true / false / null (unknown). This is a hint only; the UI tells the user to // verify before selling, and it deliberately leans toward NOT sellable when // ambiguous (the safer error for "can I sell this?"). function inferCommercial(text) { if (!text) return null; const s = String(text).replace(/<[^>]*>/g, ' ').toLowerCase(); // Restrictive / non-commercial — checked first so it wins over stray "sell"s. if (/non-?commercial|personal use|community use|[-_\s]nc([-_\s]|$)|exclusive|standard digital file|all rights reserved|^\s*none\s*$|charge money|shall not[^.]*\bsell|not be sold/.test(s)) { return false; } // Clearly permissive (commercial use OK). NC variants are already excluded above. if (/cc0|public ?domain|creative commons|attribution|cc[-_\s]?by|^\s*mit\b|^\s*bsd\b|^\s*l?gpl\b|royalty[- ]free|commercial use (is )?(allowed|permitted)|may be sold/.test(s)) { return true; } return null; } module.exports = { inferCommercial };