/**
 * Minified by jsDelivr using Terser v5.37.0.
 * Original file: /npm/@tonaljs/chord-detect@4.9.1/dist/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(e,t)=>{for(var r in t)__defProp(e,r,{get:t[r],enumerable:!0})},__copyProps=(e,t,r,o)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let n of __getOwnPropNames(t))__hasOwnProp.call(e,n)||n===r||__defProp(e,n,{get:()=>t[n],enumerable:!(o=__getOwnPropDesc(t,n))||o.enumerable});return e},__toCommonJS=e=>__copyProps(__defProp({},"__esModule",{value:!0}),e),chord_detect_exports={};__export(chord_detect_exports,{default:()=>chord_detect_default,detect:()=>detect}),module.exports=__toCommonJS(chord_detect_exports);var import_chord_type=require("@tonaljs/chord-type"),import_pcset=require("@tonaljs/pcset"),import_pitch_note=require("@tonaljs/pitch-note"),namedSet=e=>{const t=e.reduce(((e,t)=>{const r=(0,import_pitch_note.note)(t).chroma;return void 0!==r&&(e[r]=e[r]||(0,import_pitch_note.note)(t).name),e}),{});return e=>t[e]};function detect(e,t={}){const r=e.map((e=>(0,import_pitch_note.note)(e).pc)).filter((e=>e));if(0===import_pitch_note.note.length)return[];return findMatches(r,1,t).filter((e=>e.weight)).sort(((e,t)=>t.weight-e.weight)).map((e=>e.name))}var BITMASK={anyThirds:384,perfectFifth:16,nonPerfectFifths:40,anySeventh:3},testChromaNumber=e=>t=>Boolean(t&e),hasAnyThird=testChromaNumber(BITMASK.anyThirds),hasPerfectFifth=testChromaNumber(BITMASK.perfectFifth),hasAnySeventh=testChromaNumber(BITMASK.anySeventh),hasNonPerfectFifth=testChromaNumber(BITMASK.nonPerfectFifths);function hasAnyThirdAndPerfectFifthAndAnySeventh(e){const t=parseInt(e.chroma,2);return hasAnyThird(t)&&hasPerfectFifth(t)&&hasAnySeventh(t)}function withPerfectFifth(e){const t=parseInt(e,2);return hasNonPerfectFifth(t)?e:(16|t).toString(2)}function findMatches(e,t,r){const o=e[0],n=(0,import_pitch_note.note)(o).chroma,c=namedSet(e),h=(0,import_pcset.modes)(e,!1),a=[];return h.forEach(((e,h)=>{const i=r.assumePerfectFifth&&withPerfectFifth(e);(0,import_chord_type.all)().filter((t=>r.assumePerfectFifth&&hasAnyThirdAndPerfectFifthAndAnySeventh(t)?t.chroma===i:t.chroma===e)).forEach((e=>{const r=e.aliases[0],i=c(h);h!==n?a.push({weight:.5*t,name:`${i}${r}/${o}`}):a.push({weight:1*t,name:`${i}${r}`})}))})),a}var chord_detect_default={detect:detect};
//# sourceMappingURL=/sm/f518b2ef81c0efd69990c4456f893710434ecc2d08434364b8bc669d8f89882f.map