!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("exsurge",[],e):"object"==typeof exports?exports.exsurge=e():t.exsurge=e()}(this,function(){return function(t){function e(n){if(i[n])return i[n].exports;var A=i[n]={exports:{},id:n,loaded:!1};return t[n].call(A.exports,A,A.exports,e),A.loaded=!0,A.exports}var i={};return e.m=t,e.c=i,e.p="",e(0)}([function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=i(1);Object.keys(n).forEach(function(t){"default"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var A=i(2);Object.keys(A).forEach(function(t){"default"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return A[t]}})});var s=i(3);Object.keys(s).forEach(function(t){"default"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return s[t]}})});var o=i(4);Object.keys(o).forEach(function(t){"default"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return o[t]}})});var a=i(6);Object.keys(a).forEach(function(t){"default"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return a[t]}})});var r=i(9);Object.keys(r).forEach(function(t){"default"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return r[t]}})});var u=i(8);Object.keys(u).forEach(function(t){"default"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return u[t]}})});var h=i(11);Object.keys(h).forEach(function(t){"default"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return h[t]}})});var l=i(10);if(Object.keys(l).forEach(function(t){"default"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return l[t]}})}),"undefined"!=typeof document){var c=Object.create(HTMLElement.prototype);c.createdCallback=function(){var t=new o.ChantContext;t.lyricTextFont="'Crimson Text', serif",t.lyricTextSize*=1.2,t.dropCapTextFont=t.lyricTextFont,t.annotationTextFont=t.lyricTextFont;var e=!0,i=this.getAttribute("use-drop-cap");"false"===i&&(e=!1);var n=l.Gabc.loadChantScore(t,this.innerText,e),A=this.getAttribute("annotation");A&&(n.annotation=new o.Annotation(t,A));var s=this,a=0,r=function(){var e=s.parentElement.clientWidth;a!==e&&(a=e,n.performLayout(t,function(){n.layoutChantLines(t,a,function(){s.innerHTML=n.createSvgFragment(t)})}))};r(),window.addEventListener?window.addEventListener("resize",r,!1):window.attachEvent&&window.attachEvent("onresize",r)},c.attachedCallback=function(){},document.registerElement=document.registerElement||function(){};document.registerElement("chant-visual",{prototype:c})}},function(t,e){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t){return t}function A(t){return c.ToDeviceIndependent(t,c.Centimeters)}function s(t){return c.ToDeviceIndependent(t,c.Millimeters)}function o(t){return c.ToDeviceIndependent(t,c.Inches)}function a(t){return c.FromDeviceIndependent(t,c.Centimeters)}function r(t){return c.FromDeviceIndependent(t,c.Millimeters)}function u(t){return c.FromDeviceIndependent(t,c.Inches)}function h(){function t(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return t()+t()}Object.defineProperty(e,"__esModule",{value:!0});var l=function(){function t(t,e){for(var i=0;i=this.x&&t.x<=this.x+this.width&&t.y>=this.y&&t.y<=this.y+this.height:this.x<=t.x&&this.x+this.width>=t.x+t.width&&this.y<=t.y&&this.y+this.height>=t.y+t.height}},{key:"union",value:function(t){var e=Math.max(this.x+this.width,t.x+t.width),i=Math.max(this.y+this.height,t.y+t.height);this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.width=e-this.x,this.height=i-this.y}}]),t}(),e.Margins=function(){function t(e,n,A,s){i(this,t),this.left="undefined"!=typeof e?e:0,this.top="undefined"!=typeof n?n:0,this.right="undefined"!=typeof A?A:0,this.bottom="undefined"!=typeof s?s:0}return l(t,[{key:"clone",value:function(){return new t(this.left,this.top,this.right,this.bottom)}},{key:"equals",value:function(t){return this.left===t.left&&this.top===t.top&&this.right===t.right&&this.bottom===t.bottom}}]),t}(),e.Size=function(){function t(e,n){i(this,t),this.width="undefined"!=typeof e?e:0,this.height="undefined"!=typeof n?n:0}return l(t,[{key:"clone",value:function(){return new t(this.width,this.height)}},{key:"equals",value:function(t){return this.width===t.width&&this.height===t.height}}]),t}(),e.Step={Do:0,Du:1,Re:2,Me:3,Mi:4,Fa:5,Fu:6,So:7,La:9,Te:10,Ti:11}),f=[0,0,1,1,2,3,3,4,4,5,6,6],d=[p.Do,p.Re,p.Mi,p.Fa,p.So,p.La,p.Ti];e.Pitch=function(){function t(e,n){i(this,t),this.step=e,this.octave=n}return l(t,[{key:"toInt",value:function(){return 12*this.octave+this.step}},{key:"isHigherThan",value:function(t){return this.toInt()>t.toInt()}},{key:"isLowerThan",value:function(t){return this.toInt()t;)t=d.length+t;return d[t%d.length]}}]),t}()},function(t,e,n){"use strict";function A(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e["default"]=t,e}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0}),e.Spanish=e.Latin=e.Language=void 0;var r=function(){function t(t,e){for(var i=0;i"}return r(t,[{key:"syllabify",value:function(t){var e=[];if("undefined"==typeof t||""===t)return e;for(var i=t.split(/[\s]+/),n=0,A=i.length;A>n;n++)e.push(this.syllabifyWord(i[n]));return e}}]),t}());e.Latin=function(t){function e(){a(this,e);var t=s(this,Object.getPrototypeOf(e).call(this,"Latin"));t.diphthongs=["ae","au","oe","aé","áu","oé"],t.possibleDiphthongs=t.diphthongs.concat(["ei","eu","ui","éi","éu","úi"]);var i=new Object;return i.huius=["hui","us"],i.cuius=["cui","us"],i.huic=["huic"],i.cui=["cui"],i.hui=["hui"],i.euge=["eu","ge"],i.seu=["seu"],t.vowels=["a","e","i","o","u","á","é","í","ó","ú","æ","œ","ǽ","y"],t.vowelsThatMightBeConsonants=["i","u"],t.muteConsonantsAndF=["b","c","d","g","p","t","f"],t.liquidConsonants=["l","r"],t}return o(e,t),r(e,[{key:"isVowel",value:function(t){for(var e=0,i=this.vowels.length;i>e;e++)if(this.vowels[e]===t)return!0;return!1}},{key:"isVowelThatMightBeConsonant",value:function(t){for(var e=0,i=this.vowelsThatMightBeConsonants.length;i>e;e++)if(this.vowelsThatMightBeConsonants[e]===t)return!0;return!1}},{key:"isVowelActingAsConsonant",value:function(t){return this.isVowelThatMightBeConsonant(t[0])&&this.isVowel(t[1])}},{key:"isMuteConsonantOrF",value:function(t){for(var e=0,i=this.muteConsonantsAndF.length;i>e;e++)if(this.muteConsonantsAndF[e]===t)return!0;return!1}},{key:"isLiquidConsonant",value:function(t){for(var e=0,i=this.liquidConsonants.length;i>e;e++)if(this.liquidConsonants[e]===t)return!0;return!1}},{key:"isDiphthong",value:function(t){for(var e=0,i=this.diphthongs.length;i>e;e++)if(this.diphthongs[e]===t)return!0;return!1}},{key:"isPossibleDiphthong",value:function(t){for(var e=0,i=this.possibleDiphthongs.length;i>e;e++)if(this.possibleDiphthongs[e]===t)return!0;return!1}},{key:"syllabifyWord",value:function(t){for(var e,i,n,A=[],s=!1,o=!1,a=t.toLowerCase(),r=0,u=function(e){s&&(A.push(t.substr(r,e)),r+=e),s=!1},h=0,l=a.length;l>h;h++){e=a[h],i="*",n=l>h+1,n&&(i=a[h+1]);var c=this.isVowel(e);"i"===e&&(0===h&&n&&this.isVowel(i)?c=!1:o&&n&&this.isVowel(i)&&(c=!1)),"-"===e?(s=!0,o=!1,u(h-r),r++):c?(s=!0,o&&!this.isDiphthong(a[h-1]+""+e)&&(u(h-r),s=!0),o=!0):n&&("q"===e&&"u"===i||"h"===i&&("c"===e||"p"===e||"t"===e)?(u(h-r),h++):o&&this.isVowel(i)?u(h-r):this.isMuteConsonantOrF(e)&&this.isLiquidConsonant(i)?u(h-r):s&&u(h+1-r),o=!1)}return s?A.push(t.substr(r)):r>0&&(A[A.length-1]+=t.substr(r)),A}},{key:"findVowelSegment",value:function(t,e){var i,n,A,s=t.toLowerCase();for(i=0,n=this.possibleDiphthongs.length;n>i;i++){var o=this.possibleDiphthongs[i];if(A=s.indexOf(o,e),A>=0)return{found:!0,startIndex:A,length:o.length}}for(i=0,n=this.vowels.length;n>i;i++)if(A=s.indexOf(this.vowels[i],e),A>=0)return this.isVowelActingAsConsonant(s.substr(A,2))&&++A,{found:!0,startIndex:A,length:1};return{found:!1,startIndex:-1,length:-1}}}]),e}(h),e.Spanish=function(t){function e(){a(this,e);var t=s(this,Object.getPrototypeOf(e).call(this,"Spanish"));return t.vowels=["a","e","i","o","u","y","á","é","í","ó","ú","ü"],t.weakVowels=["i","u","ü","y"],t.strongVowels=["a","e","o","á","é","í","ó","ú"],t.diphthongs=["ai","ei","oi","ui","ia","ie","io","iu","au","eu","ou","ua","ue","uo","ái","éi","ói","úi","iá","ié","ió","iú","áu","éu","óu","uá","ué","uó","üe","üi"],t.uDiphthongExceptions=["gue","gui","qua","que","qui","quo"],t}return o(e,t),r(e,[{key:"isVowel",value:function(t){for(var e=0,i=this.vowels.length;i>e;e++)if(this.vowels[e]===t)return!0;return!1}},{key:"isWeakVowel",value:function(t){for(var e=0,i=this.weakVowels.length;i>e;e++)if(this.weakVowels[e]===t)return!0;return!1}},{key:"isStrongVowel",value:function(t){for(var e=0,i=this.strongVowels.length;i>e;e++)if(this.strongVowels[e]===t)return!0;return!1}},{key:"isDiphthong",value:function(t){for(var e=0,i=this.diphthongs.length;i>e;e++)if(this.diphthongs[e]===t)return!0;return!1}},{key:"createSyllable",value:function(t){return t}},{key:"syllabifyWord",value:function(t){var e=[],n=!1,A=!1,s=!1,o=0;for(i=0;i0?e[e.length-1]+=t.substr(o):0===e.length&&e.push(this.createSyllable(t)),e}},{key:"findVowelSegment",value:function(t,e){var i,n,A,s=t.toLowerCase();for(i=0,n=this.diphthongs.length;n>i;i++){var o=this.diphthongs[i];if(A=s.indexOf(o,e),A>=0){if("u"===o[0]&&A>0){var a=t.substr(A-1,3).toLowerCase();for(j=0,endj=this.uDiphthongExceptions.length;ii;i++)if(A=s.indexOf(this.vowels[i],e),A>=0)return{found:!0,startIndex:A,length:1};return{found:!1,startIndex:-1,length:-1}}}]),e}(h)},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.Glyphs={None:{svgSrc:"",paths:[{type:"positive",data:""}],bounds:{x:0,y:0,width:0,height:0},origin:{x:0,y:0},align:"left"},AcuteAccent:{svgSrc:'',paths:[{type:"positive",data:"M4 0C-.614.52-.614.52-.803-3.182l60.768-108.422c4.52-7.182 10.543-13.67 18.075-13.67 5.27 0 14.31 1.264 23.346 7.793 7.53 5.223 8.803 11.752 8.803 16.975 0 3.917-.52 11.1-8.05 17.628L4 0z"}],bounds:{x:0,y:0,width:110.99200439453125,height:125.79399108886719},origin:{x:.8030000329017639,y:125.27399444580078},align:"left"},Stropha:{svgSrc:'',paths:[{type:"positive",data:"M1.22-73.438c4.165 13.02 12.238 27.084 24.217 42.188L49.657 0 34.812 27.344C18.666 55.47-.084 72.396-21.438 78.124c4.687-3.645 7.03-8.593 7.03-14.843 0-8.853-4.947-20.572-14.843-35.155L-48 0 1.22-73.438z"}],bounds:{x:0,y:0,width:97.65699768066406,height:151.56201171875},origin:{x:48,y:73.43800354003906},align:"left"},BeginningAscLiquescent:{svgSrc:'',paths:[{type:"positive",data:"M-50 43.688V-61c4.167 7.292 12.76 10.938 25.78 10.938 9.376 0 20.053-1.563 32.032-4.688C31.773-60.48 45.833-71.677 50-88.344v117.97C43.75 42.645 32.812 51.5 17.187 56.186-.52 61.398-15.886 64-28.906 64-42.97 64-50 57.23-50 43.687z"}],bounds:{x:0,y:0,width:100,height:152.343994140625},origin:{x:50,y:88.34400177001953},align:"left"},BeginningDesLiquescent:{svgSrc:'',paths:[{type:"positive",data:"M-50-56.03c0-13.022 7.03-19.532 21.094-19.532 13.02 0 28.385 2.604 46.093 7.812C32.813-63.583 43.75-54.73 50-41.187V76C45.833 59.854 31.77 48.656 7.812 42.406c-11.98-3.125-22.656-4.687-32.03-4.687-13.022 0-21.615 3.905-25.782 11.718v-105.47z"}],bounds:{x:0,y:0,width:100,height:151.56199645996094},origin:{x:50,y:75.56199645996094},align:"left"},CustosDescLong:{svgSrc:'',paths:[{type:"positive",data:"M39.063 273.472c5.73.52 7.29-6.25 4.687-20.312V-65.59c-13.542 2.083-24.22 5.468-32.03 10.156C3.905-50.226 0-43.714 0-35.904V71.91c5.73-5.21 10.677-8.594 14.844-10.157 5.73-1.562 12.24-2.343 19.53-2.343v196.875c0 11.458 1.563 17.187 4.688 17.187"}],bounds:{x:0,y:0,width:46.35300064086914,height:339.58197021484375},origin:{x:0,y:65.58999633789062},align:"left"},CustosDescShort:{svgSrc:'',paths:[{type:"positive",data:"M34.375 191.923c0 8.333 1.563 12.24 4.688 11.72 3.125-.522 4.687-7.033 4.687-19.533v-250c-13.542 2.084-24.22 5.47-32.03 10.157C3.905-50.525 0-44.015 0-36.203V71.61c5.73-5.208 10.677-8.593 14.844-10.156 5.73-1.562 12.24-2.344 19.53-2.344v132.813z"}],bounds:{x:0,y:0,width:43.75,height:270.0530090332031},origin:{x:0,y:65.88999938964844},align:"left"},CustosLong:{svgSrc:'',paths:[{type:"positive",data:"M39.063-269.562c5.73-.52 7.29 6.25 4.687 20.312V69.5c-13.542-2.083-24.22-5.47-32.03-10.156C3.905 54.134 0 47.624 0 39.812V-68c5.73 5.208 10.677 8.594 14.844 10.156 5.73 1.563 12.24 2.344 19.53 2.344v-196.875c0-11.458 1.563-17.187 4.688-17.187z"}],bounds:{x:0,y:0,width:46.35300064086914,height:339.5820007324219},origin:{x:0,y:270.0820007324219},align:"left"},CustosShort:{svgSrc:'',paths:[{type:"positive",data:"M34.375-188.125c0-8.333 1.563-12.24 4.688-11.72 3.125.522 4.687 7.033 4.687 19.532v250c-13.542-2.083-24.22-5.468-32.03-10.156C3.905 54.324 0 47.813 0 40V-67.813c5.73 5.21 10.677 8.594 14.844 10.157 5.73 1.562 12.24 2.344 19.53 2.343v-132.812z"}],bounds:{x:0,y:0,width:43.75,height:270.052001953125},origin:{x:0,y:200.36500549316406},align:"left"},DoClef:{svgSrc:'',paths:[{type:"positive",data:"M0 98.406V-97.688C0-118 5.99-134.275 17.97-146.516c11.978-12.24 27.603-18.36 46.874-18.36 10.937 0 19.53 3.126 25.78 9.376s9.376 14.583 9.376 25v107.813l-6.25-5.47c-4.167-3.645-10.287-7.42-18.36-11.327-8.072-3.907-16.796-5.86-26.17-5.86-11.46 0-21.486 4.427-30.08 13.282-8.593 8.854-12.89 19.53-12.89 32.03s4.297 23.308 12.89 32.423c8.594 9.115 18.62 13.672 30.08 13.672 9.374 0 18.098-1.822 26.17-5.468 8.073-3.646 14.193-7.292 18.36-10.938l6.25-6.25V132c0 9.896-3.125 18.1-9.375 24.61-6.25 6.51-14.844 9.765-25.78 9.765-19.272 0-34.897-6.25-46.876-18.75C5.99 135.125 0 118.72 0 98.405z"}],bounds:{x:0,y:0,width:100,height:331.2510070800781},origin:{x:0,y:164.87600708007812},align:"left"},FaClef:{svgSrc:'',paths:[{type:"positive",data:"M85.156-32v193.75c0 9.375-1.562 14.323-4.687 14.844-1.564 0-2.605-.52-3.126-1.563-.52-1.04-.782-2.603-.78-4.686V56.28c-8.335-8.332-19.793-12.5-34.376-12.5-17.71 0-31.77 3.907-42.188 11.72V-32c0-18.23 14.193-27.344 42.578-27.344 28.385 0 42.578 9.115 42.578 27.344zM98.438 93V-92.156c0-19.27 5.73-34.896 17.187-46.875 11.458-11.98 26.562-17.97 45.313-17.97 10.937 0 19.14 2.865 24.61 8.594 5.467 5.73 8.202 13.542 8.202 23.437v103.126l-5.47-4.687c-3.645-3.647-9.374-7.293-17.186-10.94-7.813-3.645-15.886-5.467-24.22-5.468-11.978 0-22.004 4.167-30.077 12.5-8.073 8.334-12.11 18.36-12.11 30.08 0 11.717 4.037 22.004 12.11 30.858s18.1 13.28 30.078 13.28c8.333 0 16.406-1.822 24.22-5.468 7.81-3.645 13.54-7.03 17.186-10.156l5.47-5.468V125.81c0 9.896-2.865 17.84-8.594 23.83-5.73 5.988-13.802 8.983-24.22 8.983-18.75 0-33.853-6.12-45.31-18.36-11.46-12.24-17.19-27.994-17.19-47.265z"}],bounds:{x:0,y:0,width:193.75201416015625,height:333.5950012207031},origin:{x:.001003265380859375,y:157.00100708007812},align:"left"},Flat:{svgSrc:'',paths:[{type:"positive",data:"M7.813-204.406c4.166 0 6.25 5.208 6.25 15.625L12.5-10.657C33.854 13.302 54.167 25.28 73.438 25.28c9.374 0 14.062-4.686 14.062-14.06 0-6.25-1.042-11.72-3.125-16.407-2.083-4.688-7.03-9.766-14.844-15.235-7.81-5.47-13.02-8.984-15.624-10.547L27.344-45.81V-80.97c17.187 0 33.073 4.82 47.656 14.454C89.583-56.88 96.875-47.376 96.875-38c0 67.708-.26 101.562-.78 101.563-38.543 0-69.532-12.24-92.97-36.72C0-52.322-1.042-123.936 0-188c0-10.937 2.604-16.406 7.813-16.406z"}],bounds:{x:0,y:0,width:97.91699981689453,height:267.968994140625},origin:{x:1.0420000553131104,y:204.406005859375},align:"left"},Mora:{svgSrc:'',paths:[{type:"positive",data:"M47.478-24c6.957 0 12.793 2.288 17.49 6.883C69.662-12.52 72-6.904 72-.267c0 6.64-2.337 12.352-7.033 17.118C60.27 21.618 54.435 24 47.477 24c-6.26 0-11.748-2.383-16.444-7.15C26.337 12.086 24 6.374 24-.265c0-6.638 2.337-12.255 7.033-16.85C35.73-21.713 41.217-24 47.478-24z"}],bounds:{x:0,y:0,width:48,height:48},origin:{x:-24,y:24},align:"left"},Natural:{svgSrc:'',paths:[{type:"positive",data:"M7.906-166.563c-2.864 0-5.614.52-8.218 1.563v13.28l.78 56.25.782 78.907v85.157c.52 3.646 2.604 5.73 6.25 6.25l23.438-3.906 23.437-3.907v29.69c0 42.186-.26 63.54-.78 64.06l6.25 2.345c1.04.52 2.082.78 3.124.78 2.603 0 4.947-1.3 7.03-3.905L67.656-71.25c-.52-2.604-2.083-3.906-4.687-3.906-7.814 0-17.19 1.04-28.126 3.125l-19.53 3.124.78-38.28V-165c-2.604-1.042-5.323-1.562-8.188-1.563zM55.938-40v71.875l-41.407 7.03c0-48.436.262-72.655.783-72.655L55.938-40z"}],bounds:{x:0,y:0,width:70.31100463867188,height:330.468994140625},origin:{x:.3120002746582031,y:166.56300354003906},align:"left"},OriscusAsc:{svgSrc:'',paths:[{type:"positive",data:"M50 30.25c0 12.5-3.125 21.354-9.375 26.562-3.125 2.605-7.813 3.907-14.063 3.907-3.125 0-5.99-.522-8.593-1.564-2.605-1.04-5.6-2.474-8.986-4.297C5.6 53.035 2.734 51.603.39 50.56c-2.343-1.04-5.338-2.474-8.984-4.296-3.646-1.823-6.77-3.256-9.375-4.297-2.603-1.043-5.468-1.564-8.593-1.564-6.25 0-10.937 1.563-14.062 4.688C-46.875 50.824-50 59.677-50 71.656v-106.25c0-13.02 3.125-21.875 9.375-26.562 3.125-2.604 7.813-3.906 14.063-3.907 3.125 0 5.99.52 8.593 1.563 2.605 1.042 5.73 2.474 9.376 4.297 3.646 1.823 6.51 2.995 8.594 3.516l10.938 5.468c6.25 3.126 11.458 4.69 15.624 4.69 6.25 0 10.938-1.564 14.063-4.69C46.875-55.426 50-64.02 50-76V30.25z"}],bounds:{x:0,y:0,width:100,height:147.656005859375},origin:{x:50,y:76},align:"left"},OriscusDes:{svgSrc:'',paths:[{type:"positive",data:"M-50 30.844v-106.25c0 11.458 3.125 20.052 9.375 25.78 3.125 3.126 7.813 4.69 14.063 4.688 4.687 0 13.41-3.255 26.17-9.765 12.762-6.51 21.746-9.766 26.954-9.766 6.25 0 10.938 1.303 14.063 3.907C46.875-55.874 50-47.02 50-34V72.25c0-11.98-3.125-20.833-9.375-26.563C37.5 42.563 32.812 41 26.562 41 21.875 41 13.023 44.385 0 51.156c-4.167 2.604-8.594 4.948-13.28 7.032-4.69 2.083-9.116 3.124-13.283 3.124-6.25 0-10.937-1.302-14.062-3.906C-46.875 52.198-50 43.344-50 30.844z"}],bounds:{x:0,y:0,width:100,height:147.656005859375},origin:{x:50,y:75.40599822998047},align:"left"},OriscusLiquescent:{svgSrc:'',paths:[{type:"positive",data:"M 19.05539,78.886528 C 20.242277,78.486807 21.532179,77.890297 22.925106,77.09701 24.317891,76.303653 26.700882,74.417241 30.074091,71.437777 33.447144,68.45824 36.523539,64.985185 39.303286,61.018598 42.082855,57.051975 44.562739,51.395765 46.742952,44.049969 48.922975,36.704172 50.01304,28.671032 50.013135,19.950525 L 50.013135,-34.225545 C 50.01304,-54.464261 42.07377,-64.583661 26.195289,-64.583768 20.248326,-64.583661 11.518758,-61.410372 0.00656131,-55.06389 -11.505742,-48.717218 -20.23531,-45.543929 -26.182179,-45.544024 -34.515109,-45.543929 -40.567968,-48.520405 -44.340791,-54.473441 -48.113613,-60.426286 -50.000025,-67.369373 -50.000025,-75.302702 L -50.000025,30.069925 C -50.000025,49.909039 -42.060754,59.828603 -26.182179,59.828615 -21.022584,59.828603 -12.38991,56.455465 -0.28412107,49.709203 11.821549,42.96294 20.648023,39.589803 26.195289,39.589803 29.368506,40.776762 30.361665,44.249817 29.17479,50.00897 27.987759,55.768122 26.00143,62.020829 23.215789,68.767116 z"}],bounds:{x:0,y:0,width:100,height:147.656005859375},origin:{x:50,y:75.40599822998047},align:"left"},PodatusLower:{svgSrc:'',paths:[{type:"positive",data:"M-4.688-30.28c22.396 0 34.636-.262 36.72-.782 5.728-1.563 8.593-5.21 8.593-10.938H50v97.656c0 2.604-1.302 4.167-3.906 4.688-5.21.52-21.355.78-48.438.78-23.958 0-38.54-.26-43.75-.78-2.604 0-3.906-1.302-3.906-3.906v-82.032c0-3.646 1.302-5.468 3.906-5.468h2.344c2.604.52 15.625.78 39.063.78z"}],bounds:{x:0,y:0,width:100,height:103.12399291992188},origin:{x:50,y:42},align:"left"},PodatusUpper:{svgSrc:'',paths:[{type:"positive",data:"M-46.094-63.78c13.542 0 24.61 2.473 33.203 7.42C-4.298-51.41 0-43.99 0-34.093V62h-9.375c0-10.938-2.604-19.14-7.812-24.61-5.21-5.468-14.844-8.203-28.907-8.202-18.23 0-33.333 4.166-45.312 12.5v-75.782c0-19.79 15.104-29.687 45.312-29.687z"}],bounds:{x:0,y:0,width:91.406005859375,height:125.78099822998047},origin:{x:91.406005859375,y:63.78099822998047},align:"right"},Porrectus1:{svgSrc:'',paths:[{type:"positive",data:"M233.594 162.875c-58.855 0-107.032-6.25-144.53-18.75C34.895 125.895-11.46 99.855-50 66V-52.75C-21.354-24.625 26.302 6.885 92.97 41.78 123.697 57.928 163.54 66 212.5 66c21.354 0 34.635-9.896 39.844-29.688V151.94c0 7.29-6.25 10.937-18.75 10.937z"}],bounds:{ x:0,y:0,width:302.343994140625,height:215.6269989013672},origin:{x:50,y:52.75},align:"left"},Porrectus2:{svgSrc:'',paths:[{type:"positive",data:"M309.375 259.375c-50.52 0-110.938-22.396-181.25-67.188C48.437 141.667-10.938 94.272-50 50V-68.75C0-3.125 60.417 52.083 131.25 96.875c58.333 36.98 110.677 58.854 157.03 65.625h7.033c16.145 0 26.822-9.896 32.03-29.688v114.844c0 7.812-5.99 11.72-17.968 11.72z"}],bounds:{x:0,y:0,width:377.3429870605469,height:328.1260070800781},origin:{x:50,y:68.75},align:"left"},Porrectus3:{svgSrc:'',paths:[{type:"positive",data:"M309.375 355.78c-48.96-16.666-109.115-55.468-180.47-116.405C79.428 198.23 19.793 134.687-50 48.75V-70C20 40 94.104 103.79 135.25 148.063 190 200 230 230 288.28 258.906c4.168 2.083 8.334 3.125 12.5 3.125 12.5 0 21.355-10.937 26.564-32.81v114.06c0 9.376-3.386 14.063-10.156 14.064-2.084 0-4.688-.522-7.813-1.563z"}],bounds:{x:0,y:0,width:377.343994140625,height:427.3450012207031},origin:{x:50,y:70},align:"left"},Porrectus4:{svgSrc:'',paths:[{type:"positive",data:"M350 453.438c-52.754-22.397-120-77.345-201.74-164.844C90.87 227.656 24.784 147.708-50 48.75V-70C-8.84-1.25 58.406 86.51 151.74 193.28c60.868 69.793 119.13 124.22 174.782 163.282 5.797 3.646 11.014 5.47 15.652 5.47 12.173 0 21.45-11.72 27.826-35.157V441.72c0 9.373-3.19 14.06-9.565 14.06-2.9 0-6.377-.78-10.435-2.342z"}],bounds:{x:0,y:0,width:420,height:525.780029296875},origin:{x:50,y:70},align:"left"},PunctumCavum:{svgSrc:'',paths:[{type:"positive",data:"M0-60.906c33.333 0 50 9.635 50 28.906v94.53C39.062 51.595 22.396 46.126 0 46.126s-39.063 5.47-50 16.406V-32c0-19.27 16.667-28.906 50-28.906z"},{type:"negative",data:"M.08-42.56c9.585.206 20.126.53 27.954 6.822 4.96 3.9 4.71 10.792 4.574 16.482v51.278C22.09 27.066 7.283 26.072.168 26.01c-7.72.23-21.895.935-32.616 4.674.04-19.197-.083-38.395.064-57.59.567-7.5 7.834-12.33 14.62-13.774 5.818-1.498 11.857-1.86 17.844-1.88z"}],bounds:{x:0,y:0,width:100,height:123.43799591064453},origin:{x:50,y:60.90599822998047},align:"left"},PunctumQuadratum:{svgSrc:'',paths:[{type:"positive",data:"M0-60.906c33.333 0 50 9.635 50 28.906v94.53C39.062 51.595 22.396 46.126 0 46.126s-39.063 5.47-50 16.406V-32c0-19.27 16.667-28.906 50-28.906z"}],bounds:{x:0,y:0,width:100,height:123.43799591064453},origin:{x:50,y:60.90599822998047},align:"left"},PunctumQuadratumAscLiquescent:{svgSrc:'',paths:[{type:"positive",data:"M-50 43.688V-61c4.167 7.292 12.76 10.938 25.78 10.938 9.376 0 20.053-1.563 32.032-4.688C31.773-60.48 45.833-71.677 50-88.344v117.97C43.75 42.645 32.812 51.5 17.187 56.186-.52 61.398-15.886 64-28.906 64-42.97 64-50 57.23-50 43.687z"}],bounds:{x:0,y:0,width:100,height:152.343994140625},origin:{x:50,y:88.34400177001953},align:"left"},PunctumQuadratumDesLiquescent:{svgSrc:'',paths:[{type:"positive",data:"M-50-56.03c0-13.022 7.03-19.532 21.094-19.532 13.02 0 28.385 2.604 46.093 7.812C32.813-63.583 43.75-54.73 50-41.187V76C45.833 59.854 31.77 48.656 7.812 42.406c-11.98-3.125-22.656-4.687-32.03-4.687-13.022 0-21.615 3.905-25.782 11.718v-105.47z"}],bounds:{x:0,y:0,width:100,height:151.56199645996094},origin:{x:50,y:75.56199645996094},align:"left"},PunctumInclinatum:{svgSrc:'',paths:[{type:"positive",data:"M0-75.78L50 0 0 75-50 0 0-75.78z"}],bounds:{x:0,y:0,width:100,height:150.77999877929688},origin:{x:50,y:75.77999877929688},align:"left"},PunctumInclinatumLiquescent:{svgSrc:'',paths:[{type:"positive",data:"M 0,-53.164062 35,-0.1171875 0,52.382812 -35,-0.1171875 0,-53.164062 z"}],bounds:{x:0,y:0,width:70,height:105.546},origin:{x:35,y:53.164062},align:"left"},Quilisma:{svgSrc:'',paths:[{type:"positive",data:"M-50 34.938V-51c5.73 20.833 13.02 31.25 21.875 31.25 7.813 0 12.5-15.625 14.063-46.875 3.645 12.5 6.9 21.224 9.765 26.172s6.9 7.422 12.11 7.422c5.208 0 9.374-14.324 12.5-42.97 5.73 22.917 10.677 34.375 14.843 34.375 5.73 0 10.677-15.885 14.844-47.656v100c0 17.707-3.125 26.56-9.375 26.56-4.688 0-9.115-5.988-13.28-17.968-2.085 21.875-8.074 32.813-17.97 32.813-7.813 0-16.146-7.292-25-21.875-4.688 20.312-10.677 30.47-17.97 30.47-5.207 0-9.244-2.605-12.108-7.814C-48.568 47.698-50 41.708-50 34.938z"}],bounds:{x:0,y:0,width:100,height:150},origin:{x:50,y:89.28199768066406},align:"left"},TerminatingAscLiquescent:{svgSrc:'',paths:[{type:"positive",data:"M-9.375 40.22c0-11.98-4.948-17.97-14.844-17.97-10.936 0-19.53 3.646-25.78 10.938v-53.126c0-6.77 2.604-12.76 7.813-17.968 5.208-5.21 10.677-8.594 16.406-10.157 2.603-.52 5.207-.78 7.81-.78 3.647 0 7.032.78 10.157 2.343C-2.603-43.896 0-39.73 0-34V73.03h-9.375V40.22z"}],bounds:{x:0,y:0,width:49.999000549316406,height:121.87299346923828},origin:{x:49.999000549316406,y:48.842994689941406},align:"right"},TerminatingDesLiquescent:{svgSrc:'',paths:[{type:"positive",data:"M-9.375-48.156V-80.97H0V26.845c0 5.73-2.604 9.896-7.813 12.5-3.125 1.562-6.51 2.343-10.156 2.343-2.603 0-5.207-.26-7.81-.78-5.73-1.563-11.2-4.95-16.407-10.157C-47.398 25.542-50 19.292-50 12v-52.344c6.25 7.292 14.844 10.938 25.78 10.938 9.897 0 14.845-6.25 14.845-18.75z"}],bounds:{x:0,y:0,width:50,height:122.65800476074219},origin:{x:50,y:80.97000122070312},align:"right"},VerticalEpisemaAbove:{svgSrc:'',paths:[{type:"positive",data:"M-8-80H8L4 0h-8l-4-80z"}],bounds:{x:0,y:0,width:16,height:80},origin:{x:8,y:80},align:"left"},VerticalEpisemaBelow:{svgSrc:'',paths:[{type:"positive",data:"M-8 80H8L4 0h-8l-4 80z"}],bounds:{x:0,y:0,width:16,height:80},origin:{x:8,y:0},align:"left"},VirgaLong:{svgSrc:'',paths:[{type:"positive",data:"M50-38v285.156c0 6.77-2.344 10.937-7.03 12.5-1.564 0-2.605-.78-3.126-2.344-.52-1.562-.782-10.156-.782-25.78V54.186C29.168 45.334 16.146 40.907 0 40.907c-22.917 0-39.583 5.208-50 15.624V-38c0-19.27 16.667-28.906 50-28.906S50-57.27 50-38z"}],bounds:{x:0,y:0,width:100,height:326.56201171875},origin:{x:50,y:66.90599822998047},align:"left"},VirgaShort:{svgSrc:'',paths:[{type:"positive",data:"M50-38v211.72c0 7.29-2.344 11.457-7.03 12.5-1.564 0-2.606-.783-3.126-2.345-.52-1.563-.782-10.156-.782-25.78V54.187C29.167 45.332 16.146 40.906 0 40.906c-22.917 0-39.583 5.21-50 15.625V-38c0-19.27 16.667-28.906 50-28.906S50-57.27 50-38z"}],bounds:{x:0,y:0,width:100,height:253.12600708007812},origin:{x:50,y:66.90599822998047},align:"left"},Virgula:{svgSrc:'',paths:[{type:"positive",data:"M8.178-55.66c0-22.137 12.092-33.2 36.287-33.2 11.835 0 23.53 5.66 35.108 16.98C91.15-60.547 96.94-41.766 96.94-15.534c0 53.515-31.646 87.487-94.937 101.895-2.048-2.06-3.077-5.146-3.077-9.273 0-1.03.247-1.8.76-2.316 42.71-19.027 64.075-41.678 64.075-67.92 0-11.322-2.325-20.326-6.945-27.016-4.62-6.69-9.52-11.052-14.676-13.11-5.147-2.048-11.836-3.85-20.07-5.403C12.81-39.707 8.18-45.37 8.18-55.66z"}],bounds:{x:0,y:0,width:98.01399993896484,height:175.2209930419922},origin:{x:1.0739939212799072,y:88.86000061035156},align:"left"}}},function(t,e,i){"use strict";function n(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function A(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e,i){this.symbol=t,this.startIndex=e,this.properties=i}Object.defineProperty(e,"__esModule",{value:!0}),e.ChantNotationElement=e.Annotation=e.DropCap=e.Lyric=e.LyricType=e.TextElement=e.CurlyBraceVisualizer=e.RoundBraceVisualizer=e.GlyphVisualizer=e.VirgaLineVisualizer=e.NeumeLineVisualizer=e.DividerLineVisualizer=e.ChantLayoutElement=e.ChantContext=e.TextMeasuringStrategy=e.QuickSvg=e.GlyphCode=void 0;var a=function k(t,e,i){null===t&&(t=Function.prototype);var n=Object.getOwnPropertyDescriptor(t,e);if(void 0===n){var A=Object.getPrototypeOf(t);return null===A?void 0:k(A,e,i)}if("value"in n)return n.value;var s=n.get;if(void 0!==s)return s.call(i)},r=function(){function t(t,e){for(var i=0;i"},parseFragment:function(t){var e=document.createElement("svg");if(t){var i=this.g();e.innerHTML=""+t.replace(/\n/,"").replace(/<(\w+)([^<]+?)\/>/g,"<$1$2>")+"";for(var n=0,A=e.firstChild.childNodes.length;A>n;n++)i.appendChild(e.firstChild.firstChild);return i}},translate:function(t,e,i){return t.setAttribute("transform","translate("+e+","+i+")"),t},scale:function(t,e,i){return t.setAttribute("transform","scale("+e+","+i+")"),t}},f=e.TextMeasuringStrategy={Svg:0,Canvas:1},d=(e.ChantContext=function(){function t(){var e=arguments.length<=0||void 0===arguments[0]?f.Svg:arguments[0];s(this,t),this.textMeasuringStrategy=e,this.defs={},this.lyricTextSize=16,this.lyricTextFont="'Palatino Linotype', 'Book Antiqua', Palatino, serif",this.lyricTextColor="#000",this.dropCapTextSize=64,this.dropCapTextFont=this.lyricTextFont,this.dropCapTextColor=this.lyricTextColor,this.annotationTextSize=13,this.annotationTextFont=this.lyricTextFont,this.annotationTextColor=this.lyricTextColor,this.glyphPunctumWidth=h.Glyphs.PunctumQuadratum.bounds.width,this.glyphPunctumHeight=h.Glyphs.PunctumQuadratum.bounds.height,this.glyphScaling=1/16,this.staffInterval=this.glyphPunctumWidth*this.glyphScaling,this.staffLineWeight=Math.round(this.glyphPunctumWidth*this.glyphScaling/8),this.neumeLineWeight=this.staffLineWeight,this.dividerLineWeight=this.neumeLineWeight,this.episemaLineWeight=this.neumeLineWeight,this.activeClef=null,this.neumeLineColor="#000",this.staffLineColor="#000",this.dividerLineColor="#000",this.defaultLanguage=new l.Latin,this.canvas=document.createElement("canvas"),this.canvasCtxt=this.canvas.getContext("2d");var i=window.devicePixelRatio||1,n=this.canvasCtxt.webkitBackingStorePixelRatio||this.canvasCtxt.mozBackingStorePixelRatio||this.canvasCtxt.msBackingStorePixelRatio||this.canvasCtxt.oBackingStorePixelRatio||this.canvasCtxt.backingStorePixelRatio||1;this.pixelRatio=i/n,this.canvasCtxt.setTransform(this.pixelRatio,0,0,this.pixelRatio,0,0),e===f.Svg&&(this.svgTextMeasurer=p.svg(1,1),this.svgTextMeasurer.setAttribute("id","TextMeasurer"),document.querySelector("body").appendChild(this.svgTextMeasurer));var A=new I(this,"-",Q.SingleSyllable);this.hyphenWidth=A.bounds.width,this.minLyricWordSpacing=this.hyphenWidth,this.intraNeumeSpacing=this.staffInterval/2,this.syllableConnector="-",this.drawGuides=!1,this.drawDebuggingBounds=!0,this.activeNotations=null,this.currNotationIndex=-1,this.condensingTolerance=.9,this.autoColor=!0,this.insertFontsInDoc()}return r(t,[{key:"calculateHeightFromStaffPosition",value:function(t){return-t*this.staffInterval}},{key:"insertFontsInDoc",value:function(){var t=document.getElementById("exsurge-fonts");null===t&&(t=document.createElement("style"),t.id="exsurge-fonts",t.appendChild(document.createTextNode("@font-face{font-family: 'Exsurge Characters';font-weight: normal;font-style: normal;src: url("+c+") format('opentype');}")),document.head.appendChild(t))}},{key:"findNextNeume",value:function(){if("undefined"==typeof this.currNotationIndex)throw"findNextNeume() called without a valid currNotationIndex set";for(var t=this.currNotationIndex+1;tr){var u=a;a=r,r=u}return o.bounds.x=0,o.bounds.y=a,o.bounds.width=t.dividerLineWeight,o.bounds.height=r-a,o.origin.x=o.bounds.width/2,o.origin.y=a,o}return A(e,t),r(e,[{key:"draw",value:function(t){var e=t.canvasCtxt;e.lineWidth=this.bounds.width,e.strokeStyle=t.dividerLineColor,e.beginPath(),e.moveTo(this.bounds.x-this.origin.x,this.bounds.y),e.lineTo(this.bounds.x-this.origin.x,this.bounds.y+this.bounds.height),e.stroke()}},{key:"createSvgFragment",value:function(t){return p.createFragment("rect",{x:this.bounds.x,y:this.bounds.y,width:t.dividerLineWeight,height:this.bounds.height,fill:t.dividerLineColor,"class":"dividerLine"})}}]),e}(d),e.NeumeLineVisualizer=function(t){function e(t,i,A,o){s(this,e);var a=n(this,Object.getPrototypeOf(e).call(this)),r=i.staffPosition,u=A.staffPosition;if(u>r){var h=r;r=u,u=h}var l=t.calculateHeightFromStaffPosition(r),c=0;return o&&(r-u===1&&Math.abs(r)%2===1&&u>-3&&u--,c+=t.glyphPunctumHeight*t.glyphScaling/2.2),c+=t.calculateHeightFromStaffPosition(u),a.bounds.x=0,a.bounds.y=l,a.bounds.width=t.neumeLineWeight,a.bounds.height=c-l,a.origin.x=0,a.origin.y=0,a}return A(e,t),r(e,[{key:"draw",value:function(t){var e=t.canvasCtxt;e.lineWidth=this.bounds.width,e.strokeStyle=t.neumeLineColor,e.beginPath();var i=this.bounds.x+this.bounds.width/2;e.moveTo(i,this.bounds.y),e.lineTo(i,this.bounds.y+this.bounds.height),e.stroke()}},{key:"createSvgFragment",value:function(t){return p.createFragment("rect",{x:this.bounds.x,y:this.bounds.y,width:t.neumeLineWeight,height:this.bounds.height,fill:t.neumeLineColor,"class":"neumeLine"})}}]),e}(d),e.VirgaLineVisualizer=function(t){function e(t,i){s(this,e);var A,o=n(this,Object.getPrototypeOf(e).call(this)),a=i.staffPosition,r=t.calculateHeightFromStaffPosition(a);return A=0===Math.abs(a%2)?r+1.8*t.staffInterval:r+2.7*t.staffInterval,o.bounds.x=0,o.bounds.y=r,o.bounds.width=t.neumeLineWeight,o.bounds.height=A-r,o.origin.x=0,o.origin.y=0,o}return A(e,t),r(e,[{key:"draw",value:function(t){var e=t.canvasCtxt;e.lineWidth=this.bounds.width,e.strokeStyle=t.neumeLineColor,e.beginPath(),e.moveTo(this.bounds.x,this.bounds.y),e.lineTo(this.bounds.x,this.bounds.y+this.bounds.height),e.stroke()}},{key:"createSvgFragment",value:function(t){return p.createFragment("rect",{x:this.bounds.x,y:this.bounds.y,width:t.neumeLineWeight,height:this.bounds.height,fill:t.neumeLineColor,"class":"neumeLine"})}}]),e}(d),e.GlyphVisualizer=function(t){function e(t,i){s(this,e);var A=n(this,Object.getPrototypeOf(e).call(this));return A.glyph=null,A.setGlyph(t,i),A}return A(e,t),r(e,[{key:"setGlyph",value:function(t,e){if(this.glyphCode!==e){if("undefined"==typeof e||null===e||""===e?this.glyphCode=g.None:this.glyphCode=e,this.glyph=h.Glyphs[this.glyphCode],!t.defs.hasOwnProperty(this.glyphCode)){var i=this.glyph.svgSrc;t.defs[this.glyphCode]=p.createFragment("g",{id:this.glyphCode,"class":"glyph",transform:"scale("+t.glyphScaling+")"},i)}this.align=this.glyph.align,this.origin.x=this.glyph.origin.x*t.glyphScaling,this.origin.y=this.glyph.origin.y*t.glyphScaling,this.bounds.x=0,this.bounds.y=-this.origin.y,this.bounds.width=this.glyph.bounds.width*t.glyphScaling,this.bounds.height=this.glyph.bounds.height*t.glyphScaling}}},{key:"setStaffPosition",value:function(t,e){this.bounds.y+=t.calculateHeightFromStaffPosition(e)}},{key:"draw",value:function(t){var e=t.canvasCtxt,i=this.bounds.x+this.origin.x,n=this.bounds.y+this.origin.y;e.translate(i,n),e.scale(t.glyphScaling,t.glyphScaling);for(var A=0;AA){var h=i;i=A,A=h}return r.isAbove=a,r.braceHeight=t.staffInterval/2,r.bounds=new u.Rect(i,o,A-i,r.braceHeight),r.origin.x=0,r.origin.y=0,r}return A(e,t),r(e,[{key:"createSvgFragment",value:function(t){var e=p.createFragment("path",{d:this.generatePathString(),stroke:t.neumeLineColor,"stroke-width":t.staffLineWeight+"px",fill:"none","class":"brace"});return this.acuteAccent?(e+=this.acuteAccent.createSvgFragment(t),p.createFragment("g",{"class":"accentedBrace"},e)):e}},{key:"generatePathString",value:function(){var t,e,i,n=this.bounds.x,A=this.bounds.right(),s=this.bounds.width;this.isAbove?(t=this.bounds.bottom(),e=s/6,i=-s/6):(t=this.bounds.y,e=s/6,i=s/6);var o=n+e,a=t+i,r=A-e,u=2;return"M "+n.toFixed(u)+" "+t.toFixed(u)+" C "+o.toFixed(u)+" "+a.toFixed(u)+" "+r.toFixed(u)+" "+a.toFixed(u)+" "+A.toFixed(u)+" "+t.toFixed(u)}}]),e}(d),e.CurlyBraceVisualizer=function(t){function e(t,i,A,o){var a=arguments.length<=4||void 0===arguments[4]?!0:arguments[4],r=arguments.length<=5||void 0===arguments[5]?!1:arguments[5];s(this,e);var h=n(this,Object.getPrototypeOf(e).call(this));if(i>A){var l=i;i=A,A=l}h.isAbove=a,h.braceHeight=t.staffInterval/2,a&&(o-=h.braceHeight);var c=new u.Rect(i,o,A-i,h.braceHeight);return r&&a&&(h.acuteAccent=new y(t,g.AcuteAccent),h.acuteAccent.bounds.x+=c.x+(A-i)/2,h.acuteAccent.bounds.y+=c.y-t.staffInterval/4,c.union(h.acuteAccent.bounds)),h.bounds=c,h.origin.x=0,h.origin.y=0,h}return A(e,t),r(e,[{key:"createSvgFragment",value:function(t){var e=p.createFragment("path",{d:this.generatePathString(),stroke:t.neumeLineColor,"stroke-width":t.staffLineWeight+"px",fill:"none","class":"brace"});return this.acuteAccent?(e+=this.acuteAccent.createSvgFragment(t),p.createFragment("g",{"class":"accentedBrace"},e)):e}},{key:"generatePathString",value:function(){var t,e,i=.6,n=this.bounds.x,A=this.bounds.right(),s=this.bounds.width;this.isAbove?(t=this.bounds.bottom(),e=-this.braceHeight):(t=this.bounds.y,e=this.braceHeight);var o=t+i*e,a=n+.25*s,r=t+(1-i)*e,u=n+.5*s,h=t+e,l=t+i*e,c=n+.75*s,g=t+(1-i)*e,p=2;return"M "+n.toFixed(p)+" "+t.toFixed(p)+" Q "+n.toFixed(p)+" "+o.toFixed(p)+" "+a.toFixed(p)+" "+r.toFixed(p)+" T "+u.toFixed(p)+" "+h.toFixed(p)+" M "+A.toFixed(p)+" "+t.toFixed(p)+" Q "+A.toFixed(p)+" "+l.toFixed(p)+" "+c.toFixed(p)+" "+g.toFixed(p)+" T "+u.toFixed(p)+" "+h.toFixed(p)}}]),e}(d),function(t,e){"undefined"!=typeof e&&null!==e||(e=""),this.text=t,this.properties=e}),v="*",b="_",m="^",C="%";o.createStackFrame=function(t,e){var i="";switch(t){case v:i="font-weight:bold;";break;case b:i="font-style:italic;";break;case m:i="fill:#f00;";break;case C:i="font-variant:small-caps;font-feature-settings:'smcp';-webkit-font-feature-settings:'smcp';"}return new o(t,e,i)};var G={"&":"&","<":"<",">":">"},w=e.TextElement=function(t){function e(t,i,A,o,a){s(this,e);var r=n(this,Object.getPrototypeOf(e).call(this));return r.bounds.x=0,r.bounds.y=0,r.bounds.width=0,r.bounds.height=0,r.origin.x=0,r.origin.y=0,r.fontFamily=A,r.fontSize=o,r.textAnchor=a,r.dominantBaseline="baseline",r.generateSpansFromText(t,i),r.recalculateMetrics(t),r}return A(e,t),r(e,[{key:"generateSpansFromText",value:function(t,e){if(this.text="",this.spans=[],"*"===e||"†"===e)return void this.spans.push(new B(e));for(var i=[],n=0,A=function(t,e){return t.Symbol===e},s=this,a=function(t,e){if(""!==t){s.text+=t;for(var n="",A=0;A0){n=i[i.length-1].startIndex,i.pop();continue}a(e.substring(n,u.index)),i.push(o.createStackFrame(h,u.index))}n=u.index+h.length}n=0&&(a+="italic "),r.properties.indexOf("font-variant:small-caps;")>=0&&(a+="small-caps "),r.properties.indexOf("font-weight:bold;")>=0&&(a+="bold "),a+=n,i.font=a;var h=i.measureText(u,this.bounds.x,this.bounds.y);if(A+=h.width,s+=u.length,s===e)break}return A}},{key:"recalculateMetrics",value:function(t){if(this.bounds.x=0,this.bounds.y=0,this.bounds.x=0,this.bounds.y=0,this.origin.x=0,t.textMeasuringStrategy===f.Svg){for(var e=''+this.createSvgFragment(t)+"",i=(new DOMParser).parseFromString(e,"application/xml");t.svgTextMeasurer.firstChild;)t.svgTextMeasurer.firstChild.remove();t.svgTextMeasurer.appendChild(t.svgTextMeasurer.ownerDocument.importNode(i.documentElement,!0).firstChild);var n=t.svgTextMeasurer.firstChild.getBBox();this.bounds.width=n.width,this.bounds.height=n.height,this.origin.y=-n.y}else t.textMeasuringStrategy===f.Canvas&&(this.bounds.width=this.measureSubstring(t),this.bounds.height=1.2*this.fontSize,this.origin.y=this.fontSize)}},{key:"getCssClasses",value:function(){return""}},{key:"getExtraStyleProperties",value:function(t){return""}},{key:"draw",value:function(t){var e=t.canvasCtxt;"middle"===this.textAnchor?e.textAlign="center":e.textAlign="start",e.font=this.fontSize+"px "+this.fontFamily;for(var i=0;i]/g,function(t){return G[t]})}}]),e}(d),Q=e.LyricType={SingleSyllable:0,BeginningSyllable:1,MiddleSyllable:2,EndingSyllable:3,Directive:4},I=e.Lyric=function(t){function e(t,i,A){s(this,e);var o=n(this,Object.getPrototypeOf(e).call(this,t,i,t.lyricTextFont,t.lyricTextSize,"start"));return o.originalText=i,"undefined"==typeof A||null===A||""===A?o.lyricType=Q.SingleSyllable:o.lyricType=A,o.centerStartIndex=-1,o.centerLength=i.length,o.needsConnector=!1,o.language=null,o}return A(e,t),r(e,[{key:"allowsConnector",value:function(){return this.lyricType===Q.BeginningSyllable||this.lyricType===Q.MiddleSyllable}},{key:"setNeedsConnector",value:function(t){t===!0?(this.needsConnector=!0,this.bounds.width=this.widthWithConnector,this.spans.length>0&&(this.spans[this.spans.length-1].text=this.lastSpanTextWithConnector)):(this.needsConnector=!1,this.bounds.width=this.widthWithoutConnector,this.spans.length>0&&(this.spans[this.spans.length-1].text=this.lastSpanText))}},{key:"generateSpansFromText",value:function(t,i){a(Object.getPrototypeOf(e.prototype),"generateSpansFromText",this).call(this,t,i),this.spans.length>0?(this.lastSpanText=this.spans[this.spans.length-1].text,this.lastSpanTextWithConnector=this.lastSpanText+t.syllableConnector):(this.lastSpanText="",this.lastSpanTextWithConnector="")}},{key:"recalculateMetrics",value:function(t){a(Object.getPrototypeOf(e.prototype),"recalculateMetrics",this).call(this,t),this.widthWithoutConnector=this.bounds.width,this.textWithConnector=this.text+t.syllableConnector,this.widthWithConnector=this.bounds.width+t.hyphenWidth;var i,n,A=this.language||t.defaultLanguage,s=this.widthWithoutConnector/2;if(this.centerStartIndex>=0&&(this.centerStartIndex>=this.text.length||this.centerLength<0||this.centerStartIndex+this.centerLength>this.text.length)&&(this.centerStartIndex=-1),0===this.text.length);else if(this.centerStartIndex>=0)t.textMeasuringStrategy===f.Svg?(i=t.svgTextMeasurer.firstChild.getSubStringLength(0,this.centerStartIndex),n=t.svgTextMeasurer.firstChild.getSubStringLength(0,this.centerStartIndex+this.centerLength)):t.textMeasuringStrategy===f.Canvas&&(i=this.measureSubstring(t,this.centerStartIndex),n=this.measureSubstring(t,this.centerStartIndex+this.centerLength)),s=i+(n-i)/2;else if(this.lyricType!==Q.Directive){var o=A.findVowelSegment(this.text,0);o.found===!0&&(t.textMeasuringStrategy===f.Svg?(i=t.svgTextMeasurer.firstChild.getSubStringLength(0,o.startIndex),n=t.svgTextMeasurer.firstChild.getSubStringLength(0,o.startIndex+o.length)):t.textMeasuringStrategy===f.Canvas&&(i=this.measureSubstring(t,o.startIndex),n=this.measureSubstring(t,o.startIndex+o.length)),s=i+(n-i)/2)}this.bounds.x=-s,this.bounds.y=0,this.origin.x=s,this.bounds.width=this.widthWithoutConnector, this.bounds.height=t.lyricTextSize}},{key:"generateDropCap",value:function(t){var e=new S(t,this.originalText.substring(0,1));return 1===this.originalText.length?(this.generateSpansFromText(t,t.syllableConnector),this.centerStartIndex=-1,this.lyricType=Q.SingleSyllable):(this.generateSpansFromText(t,this.originalText.substring(1)),this.centerStartIndex--),e}},{key:"getCssClasses",value:function(){var t="lyric ";return this.lyricType===Q.Directive&&(t+="directive "),t+a(Object.getPrototypeOf(e.prototype),"getCssClasses",this).call(this)}},{key:"getExtraStyleProperties",value:function(t){var i=a(Object.getPrototypeOf(e.prototype),"getExtraStyleProperties",this).call(this);return this.lyricType===Q.Directive&&t.autoColor===!0&&(i+="fill:#f00;"),i}},{key:"createSvgFragment",value:function(t){return this.spans.length>0&&(this.needsConnector?this.spans[this.spans.length-1].text=this.lastSpanTextWithConnector:this.spans[this.spans.length-1].text=this.lastSpanText),a(Object.getPrototypeOf(e.prototype),"createSvgFragment",this).call(this,t)}}]),e}(w),S=e.DropCap=function(t){function e(t,i){s(this,e);var A=n(this,Object.getPrototypeOf(e).call(this,t,i,t.dropCapTextFont,t.dropCapTextSize,"middle"));return A.padding=2*t.staffInterval,A}return A(e,t),r(e,[{key:"getCssClasses",value:function(){return"dropCap "+a(Object.getPrototypeOf(e.prototype),"getCssClasses",this).call(this)}}]),e}(w);e.Annotation=function(t){function e(t,i){s(this,e);var A=n(this,Object.getPrototypeOf(e).call(this,t,i,t.annotationTextFont,t.annotationTextSize,"middle"));return A.padding=t.staffInterval,A.dominantBaseline="hanging",A}return A(e,t),r(e,[{key:"getCssClasses",value:function(){return"annotation "+a(Object.getPrototypeOf(e.prototype),"getCssClasses",this).call(this)}}]),e}(w),e.ChantNotationElement=function(t){function e(){s(this,e);var t=n(this,Object.getPrototypeOf(e).call(this));return t.leadingSpace=0,t.trailingSpace=-1,t.keepWithNext=!1,t.needsLayout=!0,t.lyrics=[],t.score=null,t.line=null,t.visualizers=[],t}return A(e,t),r(e,[{key:"hasLyrics",value:function(){return 0!==this.lyrics.length}},{key:"getLyricLeft",value:function(t){return this.bounds.x+this.lyrics[t].bounds.x}},{key:"getAllLyricsLeft",value:function(){if(0===this.lyrics.length)return this.bounds.right();for(var t=Number.MAX_VALUE,e=0;e=this.notations.length)return this.needsLayout=!1,void(i&&setTimeout(function(){return i()},0));0===e&&(t.activeClef=this.startingClef);var A=(new Date).getTime()+50;do{var s=this.notations[e];s.needsLayout&&(t.currNotationIndex=e,s.performLayout(t)),e++}while(ee;e++)for(A=i[e],this.notationBounds.union(A.bounds),o=0;oe;e++){A=i[e];for(var s=this.notationBounds.y+this.notationBounds.height,o=0;o0?this.notationBounds.y+this.notationBounds.height+this.lyricLineBaselines[0]:this.notationBounds.y+this.notationBounds.height,this.score.dropCap.bounds.x=this.staffLeft/2,this.score.dropCap.bounds.y=u}null!==this.score.annotation&&(this.score.annotation.bounds.x=this.staffLeft/2,this.score.annotation.bounds.y=3*-t.staffInterval)}this.notationBounds.height+=t.lyricTextSize,this.bounds.x=0,this.bounds.y=this.notationBounds.y,this.bounds.width=this.notationBounds.right(),this.bounds.height=a,this.origin=new r.Point(this.staffLeft,-this.notationBounds.y)}},{key:"draw",value:function(t){var e=t.canvasCtxt;e.translate(this.bounds.x,this.bounds.y);var i,n,A=this.staffLeft,s=this.staffRight;for(e.lineWidth=Math.round(t.staffLineWeight),e.strokeStyle=t.staffLineWeight,i=-3;3>=i;i+=2)n=Math.round(t.staffInterval*i)+.5,e.beginPath(),e.moveTo(A,n),e.lineTo(s,n),e.stroke();for(i=0;ii;i++)a[i].draw(t);this.startingClef.draw(t),this.custos&&this.custos.draw(t),e.translate(-this.bounds.x,-this.bounds.y)}},{key:"createSvgFragment",value:function(t){var e,i="",n=this.staffLeft,A=this.staffRight;for(e=-3;3>=e;e+=2)i+=u.QuickSvg.createFragment("line",{x1:n,y1:t.staffInterval*e,x2:A,y2:t.staffInterval*e,stroke:t.staffLineColor,"stroke-width":t.staffLineWeight,"class":"staffLine"});for(e=0;ee;e++)i+=a[e].createSvgFragment(t);return this.custos&&(i+=this.custos.createSvgFragment(t)),u.QuickSvg.createFragment("g",{"class":"chantLine",transform:"translate("+this.bounds.x+","+this.bounds.y+")"},i)}},{key:"generateCurlyBraceDrawable",value:function(t,e,i,n,A){var s;s=A?-t.staffInterval/2:t.staffInterval/2;var o=.6,a=i-e,r=e,h=n+o*s,l=e+.25*a,c=n+(1-o)*s,g=e+.5*a,p=n+s,f=i,d=n+o*s,y=e+.75*a,B=n+(1-o)*s,v="M "+e+" "+n+" Q "+r+" "+h+" "+l+" "+c+" T "+g+" "+p+" M "+i+" "+n+" Q "+f+" "+d+" "+y+" "+B+" T "+g+" "+p;return u.QuickSvg.createFragment("path",{d:v,stroke:t.neumeLineColor,"stroke-width":t.neumeLineWeight+"px",fill:"none"})}},{key:"buildFromChantNotationIndex",value:function(t,e,i){var n=this.score.notations;if(this.notationsStartIndex=e,this.numNotationsOnLine=0,this.staffLeft=0,i>0?this.staffRight=i:this.staffRight=99999999,0===this.notationsStartIndex){var A=0;null!==this.score.dropCap&&(A=this.score.dropCap.bounds.width+2*this.score.dropCap.padding),null!==this.score.annotation&&(A=Math.max(A,this.score.annotation.bounds.width+4*this.score.annotation.padding)),this.staffLeft+=A}n[e].isClef&&(t.activeClef=n[e].clone(),e++,this.notationsStartIndex++),this.startingClef=t.activeClef.clone(),this.startingClef.performLayout(t),this.startingClef.bounds.x=this.staffLeft;var s,o,a=this.startingClef,r=null,u=null,g=this.staffRight-l.Glyphs.CustosLong.bounds.width*t.glyphScaling-4*t.intraNeumeSpacing,p=n.length-1;for(s=e;p>=s;s++){a.hasLyrics()&&(u=a),r=a,a=n[s];var f;f=s===p?this.staffRight:s===p-1?Math.max(g,this.staffRight-n[p].bounds.width):g;var d=this.positionNotationElement(t,u,r,a,f);if(d===!1){var y=a.notes&&a.notes.reduce(function(t,e,i){return t||e.braceEnd&&i+1||0},0),B=a.notes&&a.notes.reduce(function(t,e,i){return t||e.braceStart&&i+1||0},0);if(y&&(!B||B>y)){var v=n.slice(this.notationsStartIndex,s).reduceRight(function(t,e,i){if(-1===t&&e.notes){var n=e.notes.filter(function(t){return t.braceStart}).length,A=e.notes.filter(function(t){return t.braceEnd}).length;if(A)return-2;if(n)return i}return t},-1);v>0&&(this.numNotationsOnLine=v,s=v+this.notationsStartIndex)}for(o=s-1;o>this.notationsStartIndex;o--){var b=n[o];if(!(b.keepWithNext===!0||o===s-1&&a.isDivider))break;this.numNotationsOnLine--}break}if(a.chantLine=this,this.numNotationsOnLine++,a.isClef&&(t.activeClef=a),a.constructor===h.ChantLineBreak&&i>0){this.justify=a.justify;break}}for(s=this.notationsStartIndex+this.numNotationsOnLine;s=i?(this.staffRight=C.bounds.right(),this.justify=!1):this.notationsStartIndex+this.numNotationsOnLine===n.length&&(this.justify=!0,this.justify=C.isDivider&&(this.staffRight-C.bounds.right())/this.staffRight<.1),this.justify===!0&&this.justifyElements(),this.finishLayout(t)}},{key:"justifyElements",value:function(){var t,e=[],i=this.score.notations,n=this.notationsStartIndex+this.numNotationsOnLine,A=0;if(this.numNotationsOnLine>0){var s=i[n-1],o=null;for(t=n-1;t>=this.notationsStartIndex;t--)if(i[t].hasLyrics()){o=i[t];break}A=o?this.staffRight-Math.max(o.getAllLyricsRight(),s.bounds.right()+s.trailingSpace):this.staffRight-(s.bounds.right()+s.trailingSpace)}if(this.custos&&(A-=this.custos.bounds.width+this.custos.leadingSpace),!(0>=A)){var a=null,r=null,u=null;for(t=this.notationsStartIndex;n>t;t++)null!==r&&r.hasLyrics()&&(u=r),a=r,r=i[t],null!==a&&a.keepWithNext===!0||null!==u&&u.lyrics[0].allowsConnector()&&!u.lyrics[0].needsConnector||r.constructor!==h.ChantLineBreak&&e.push(r);if(0!==e.length){var l=0,c=A/e.length,g=0;for(t=this.notationsStartIndex;n>t;t++)r=i[t],g=5||-5>=A){var s=n+i.bounds.x-t.intraNeumeSpacing,o=n+i.bounds.x+i.bounds.width+t.intraNeumeSpacing;A-=A>0?(A-1)%2:(A+1)%2;var a=5*t.staffInterval;if(e.ledgerLines.length>0&&e.ledgerLines[e.ledgerLines.length-1].x2+a>=s){var r=(s-e.ledgerLines[e.ledgerLines.length-1].x2)/2;e.ledgerLines[e.ledgerLines.length-1].x2+=r,s-=r}o>e.staffRight&&(o=e.staffRight),e.ledgerLines.push({x1:s,x2:o,staffPosition:A})}},s=[],o=null,a=0,r=Number.MAX_VALUE,h=Number.MIN_VALUE,l=this.notationsStartIndex;n>l;l++)if(r=Math.min(r,i[l].bounds.y),h=Math.max(h,i[l].bounds.bottom()),i[l].constructor!==c.Custos){if(i[l].isNeume)for(var p=i[l],f=0;f0&&(v=p.bounds.x+B.bounds.x-(s[s.length-1].note.neume.bounds.x+s[s.length-1].bounds.right())),0===s.length||s[s.length-1].positionHint!==B.positionHint||s[s.length-1].terminating===!0||s[s.length-1].alignment===g.HorizontalEpisemaAlignment.Left||B.alignment===g.HorizontalEpisemaAlignment.Right||v>2*t.intraNeumeSpacing)s=[],s.push(B);else{var b;if(b=B.positionHint===g.MarkingPositionHint.Below?Math.max(B.bounds.y,s[s.length-1].bounds.y):Math.min(B.bounds.y,s[s.length-1].bounds.y),B.bounds.y!==b)B.bounds.y=b;else for(var m=0;m=d;d++)G=Math.min(G,i[d].bounds.y-w);else for(G=t.calculateHeightFromStaffPosition(-4),d=a;l>=d;d++)G=Math.max(G,i[d].bounds.y+w);var Q=!1;o.shape===g.BraceShape.RoundBrace?this.braces.push(new u.RoundBraceVisualizer(t,o.getAttachmentX(),y.braceEnd.getAttachmentX(),G,o.isAbove)):(o.shape===g.BraceShape.AccentedCurlyBrace&&(Q=!0),this.braces.push(new u.CurlyBraceVisualizer(t,o.getAttachmentX(),y.braceEnd.getAttachmentX(),G,o.isAbove,Q)))}}y.braceStart&&(o=y.braceStart,a=l),null!==o&&(o.isAbove?o.bounds.y=Math.min(o.bounds.y,y.bounds.y):o.bounds.y=Math.max(o.bounds.y,y.bounds.bottom()))}}else A(i[l]);null!==o&&(o=o),this.custos&&A(this.custos)}},{key:"positionNotationElement",value:function(t,e,i,n,A){var s;if(n.bounds.x=i.bounds.right()+i.trailingSpace,null===e){var o=n.bounds.right()+n.trailingSpace;for(s=0;sA)}if(n.hasLyrics()===!1){for(s=0;s1){var r=Number.MIN_VALUE,u=Number.MAX_VALUE,h=Number.MIN_VALUE;for(s=0;a>s;s++){if(su&&(n.bounds.x+=r-u,h+=r-u),n.bounds.right()c&&(n.bounds.x+=g+t.minLyricWordSpacing-c):g>c?n.bounds.x+=g-c:(e.lyrics[0].setNeedsConnector(!0),g=e.getLyricRight(0),g>c&&(n.bounds.x+=g-c)),n.bounds.right()+n.trailingSpace=t?Math.abs(t)%2===1?h.GlyphCode.CustosLong:h.GlyphCode.CustosShort:Math.abs(t)%2===1?h.GlyphCode.CustosDescLong:h.GlyphCode.CustosDescShort}}]),e}(h.ChantNotationElement),e.Divider=function(t){function e(){A(this,e);var t=s(this,Object.getPrototypeOf(e).call(this));return t.isDivider=!0,t.resetsAccidentals=!0,t}return o(e,t),e}(h.ChantNotationElement)),c=(e.QuarterBar=function(t){function e(){return A(this,e),s(this,Object.getPrototypeOf(e).apply(this,arguments))}return o(e,t),a(e,[{key:"performLayout",value:function(t){r(Object.getPrototypeOf(e.prototype),"performLayout",this).call(this,t),this.addVisualizer(new h.DividerLineVisualizer(t,2,4)),this.origin.x=this.bounds.width/2,this.finishLayout(t)}}]),e}(l),e.HalfBar=function(t){function e(){return A(this,e),s(this,Object.getPrototypeOf(e).apply(this,arguments))}return o(e,t),a(e,[{key:"performLayout",value:function(t){r(Object.getPrototypeOf(e.prototype),"performLayout",this).call(this,t),this.addVisualizer(new h.DividerLineVisualizer(t,-2,2)),this.origin.x=this.bounds.width/2,this.finishLayout(t)}}]),e}(l),e.FullBar=function(t){function e(){return A(this,e),s(this,Object.getPrototypeOf(e).apply(this,arguments))}return o(e,t),a(e,[{key:"performLayout",value:function(t){r(Object.getPrototypeOf(e.prototype),"performLayout",this).call(this,t),this.addVisualizer(new h.DividerLineVisualizer(t,-3,3)),this.origin.x=this.bounds.width/2,this.finishLayout(t)}}]),e}(l),e.DoubleBar=function(t){function e(){return A(this,e),s(this,Object.getPrototypeOf(e).apply(this,arguments))}return o(e,t),a(e,[{key:"performLayout",value:function(t){r(Object.getPrototypeOf(e.prototype),"performLayout",this).call(this,t);var i=new h.DividerLineVisualizer(t,-3,3);i.bounds.x=0,this.addVisualizer(i);var n=new h.DividerLineVisualizer(t,-3,3);n.bounds.x=2*t.intraNeumeSpacing,this.addVisualizer(n),this.origin.x=this.bounds.width/2,this.finishLayout(t)}}]),e}(l),e.AccidentalType={Flat:-1,Natural:0,Sharp:1});e.Accidental=function(t){function e(t,i){A(this,e);var n=s(this,Object.getPrototypeOf(e).call(this));return n.isAccidental=!0,n.keepWithNext=!0,n.staffPosition=t,n.accidentalType=i,n}return o(e,t),a(e,[{key:"performLayout",value:function(t){r(Object.getPrototypeOf(e.prototype),"performLayout",this).call(this,t),this.addVisualizer(this.createGlyphVisualizer(t)),this.finishLayout(t)}},{key:"createGlyphVisualizer",value:function(t){var e=h.GlyphCode.Flat;switch(this.accidentalType){case c.Natural:e=h.GlyphCode.Natural;break;case c.Sharp:e=h.GlyphCode.Sharp;break;default:e=h.GlyphCode.Flat}var i=new h.GlyphVisualizer(t,e);return i.setStaffPosition(t,this.staffPosition),i}},{key:"adjustStep",value:function(t){switch(this.accidentalType){case c.Flat:if(t===Step.Ti)return Step.Te;if(t===Step.Mi)return Step.Me;break;case c.Sharp:if(t===Step.Do)return Step.Du;if(t===Step.Fa)return Step.Fu;break;case c.Natural:if(t===Step.Te)return Step.Ti;if(t===Step.Me)return Step.Mi;if(t===Step.Du)return Step.Do;if(t===Step.Fu)return Step.Fa}return t}},{key:"applyToPitch",value:function(t){this.octave===t.octave&&(t.step=this.adjustStep(t.step))}}]),e}(h.ChantNotationElement),e.Virgula=function(t){function e(){A(this,e);var t=s(this,Object.getPrototypeOf(e).call(this));return t.resetsAccidentals=!1,t.staffPosition=3,t}return o(e,t),a(e,[{key:"performLayout",value:function(t){r(Object.getPrototypeOf(e.prototype),"performLayout",this).call(this,t);var i=new h.GlyphVisualizer(t,h.GlyphCode.Virgula);i.setStaffPosition(t,this.staffPosition),this.addVisualizer(i),this.origin.x=this.bounds.width/2,this.finishLayout(t)}}]),e}(l)},function(t,e,i){"use strict";function n(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e["default"]=t,e}function A(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),e.BracePoint=e.BraceAttachment=e.BraceShape=e.Mora=e.Ictus=e.HorizontalEpisema=e.HorizontalEpisemaAlignment=e.AcuteAccent=e.MarkingPositionHint=void 0;var a=function(){function t(t,e){for(var i=0;i<_\.'012345]*(?:\[[^\]]*\]?)*/g,y=/([ou])(b|cb|cba):([01])(?:([{}])|;(\d*(?:\.\d+)?)mm)/; e.Gabc=function(){function t(){A(this,t)}return s(t,null,[{key:"createMappingsFromSource",value:function(t,e){var i=this.splitWords(e);t.activeClef=r.Clef["default"]();var n=this.createMappingsFromWords(t,i,function(e){return t.activeClef=e});return n.length>0&&n[n.length-1].notations.length>0&&(n[n.length-1].notations[n[n.length-1].notations.length-1].trailingSpace=0),n}},{key:"diffDescriptorsAndNewWords",value:function(t,e){var i,n={};for(i=0;io&&(o=u[h],A=h-o+1,s=a-o+1)}r=u}if(0===o){var l=[];return t.length&&l.push(["-",t]),e.length&&l.push(["+",e]),l}return[].concat(this.diffDescriptorsAndNewWords(t.slice(0,A),e.slice(0,s)),[["=",e.slice(s,s+o)]],this.diffDescriptorsAndNewWords(t.slice(A+o),e.slice(s+o)))}},{key:"updateMappingsFromSource",value:function(t,e,i){e.pop();var n,A,s=this.splitWords(i),o=this.diffDescriptorsAndNewWords(e,s),a=0;t.activeClef=r.Clef["default"]();for(var u=0;u0&&e[e.length-1].notations.length>0&&(e[e.length-1].notations[e[e.length-1].notations.length-1].trailingSpace=0)}},{key:"createMappingsFromWords",value:function(t,e){for(var i=[],n=0;n=0){var u=o.indexOf("}");u>=0&&u>a?(r=u-a-1,o=o.substring(0,a)+o.substring(a+1,u)+o.substring(u+1,o.length)):a=-1}var h=this.makeLyric(t,o,i);a>=0&&(h.centerStartIndex=a,h.centerLength=r),n.push(h)}return n}},{key:"makeLyric",value:function(t,e,i){e.length>1&&"-"===e[e.length-1]&&(i===a.LyricType.EndingSyllable?i=a.LyricType.MiddleSyllable:i===a.LyricType.SingleSyllable&&(i=a.LyricType.BeginningSyllable),e=e.substring(0,e.length-1));var n=!1;e.length>1&&"_"===e[e.length-1]&&(n=!0,e=e.substring(0,e.length-1)),"*"!==e&&"†"!==e||(i=a.LyricType.Directive);var A=new a.Lyric(t,e,i);return A.elidesToNext=n,A}},{key:"parseNotations",value:function(t,e){var i=this;if(!e)return[new r.TextOnly];var n=[],A=[],s=-1,o=function(e){if(A.length>0){for(var o=i.createNeumesFromNotes(t,A,s),a=0;a1&&"+"===h[1]){var l=new c.Custos;l.staffPosition=this.gabcHeightToExsurgeHeight(e[0]),o(l)}else if(h.length>1&&("x"===h[1]||"y"===h[1]||"#"===h[1])){var g;switch(h[1]){case"y":g=c.AccidentalType.Natural;break;case"#":g=c.AccidentalType.Sharp;break;default:g=c.AccidentalType.Flat}var p=[];this.createNoteFromData(t,t.activeClef,h,p);var f=new c.Accidental(p[0].staffPosition,g);f.trailingSpace=2*t.intraNeumeSpacing,t.activeClef.activeAccidental=f,o(f)}else this.createNoteFromData(t,t.activeClef,h,A)}}return o(null),n}},{key:"createNeumesFromNotes",value:function(t,e,i){for(var n=[],A=0,s=0,o=function(i,o){var r,u=arguments.length<=2||void 0===arguments[2]?!0:arguments[2];if(r=o?s:u?s-1:s-2,!(0>r)){for(;r>=A;)i.addNote(e[A++]);return n.push(i),o===!1&&(s--,u===!1&&s--,i.keepWithNext=!0,i.trailingSpace=t.intraNeumeSpacing),a}},a={neume:function(){return new p.Punctum},handle:function(t,e){return t.shape===r.NoteShape.Virga?C:t.shape===r.NoteShape.Stropha?w:t.shape===r.NoteShape.Oriscus?l:t.shape===r.NoteShape.Inclinatum?h:t.shapeModifiers&r.NoteShapeModifiers.Cavum?o(new p.Punctum,!0):u}},u={neume:function(){return new p.Punctum},handle:function(t,e){return t.staffPosition>e.staffPosition?c:t.staffPositione.staffPosition?(e.shapeModifiers|=r.NoteShapeModifiers.Ascending,o(new p.PesQuassus,!0)):t.staffPositione.staffPosition?e.shape===r.NoteShape.Oriscus?B:b:t.staffPositione.staffPosition?d:o(new p.Clivis,!1)}},f={neume:function(){return new p.Climacus},handle:function(t,e){return t.shape!==r.NoteShape.Inclinatum?o(new p.Climacus,!1):H}},d={neume:function(){return new p.Porrectus},handle:function(t,e){return t.shape===r.NoteShape.Default&&t.staffPositione.staffPosition?k:o(new p.Torculus,!1)}},k={neume:function(){return new p.TorculusResupinus},handle:function(t,e){return t.shape===r.NoteShape.Default&&t.staffPosition0?e[s-1]:null,M=e[s];H=H.handle(M,L),s===e.length-1&&H!==a&&o(H.neume(),!0),s++}return n.length>0&&i>=0&&(n[n.length-1].trailingSpace=i,i>t.intraNeumeSpacing?n[n.length-1].keepWithNext=!1:n[n.length-1].keepWithNext=!0),n}},{key:"createNoteFromData",value:function(t,e,i,n){var A=new r.Note;if(i.length<1)throw"Invalid note data: "+i;if("-"===i[0]&&(A.liquescent=r.LiquescentType.InitioDebilis,i=i.substring(1)),i.length<1)throw"Invalid note data: "+i;var s=this.gabcHeightToExsurgePitch(e,i[0]);i[0]===i[0].toUpperCase()&&(A.shape=r.NoteShape.Inclinatum),A.staffPosition=this.gabcHeightToExsurgeHeight(i[0]),A.pitch=s;for(var a,u=n.length,l=A,c=1;c0&&(f=!0,p=Math.abs(A.staffPosition)%2===0?"1":"0"),a=new h.Mora(t,A),f&&"1"===p?a.positionHint=h.MarkingPositionHint.Above:f&&"0"===p&&(a.positionHint=h.MarkingPositionHint.Below),A.morae.push(a);break;case"_":var d=!1;for(a=new h.HorizontalEpisema(l);f;){if("0"===p)a.positionHint=h.MarkingPositionHint.Below;else if("1"===p)a.positionHint=h.MarkingPositionHint.Above;else if("2"===p)a.terminating=!0;else if("3"===p)a.alignment=h.HorizontalEpisemaAlignment.Left;else if("4"===p)a.alignment=h.HorizontalEpisemaAlignment.Center;else{if("5"!==p)break;a.alignment=h.HorizontalEpisemaAlignment.Right}a.alignment!==h.HorizontalEpisemaAlignment.Default&&a.positionHint!==h.MarkingPositionHint.Below&&(d=!0),c++,f=c+1=0&&n.length>0&&(l=n[--u]);break;case"'":a=new h.Ictus(t,A),f&&"1"===p?a.positionHint=h.MarkingPositionHint.Above:f&&"0"===p&&(a.positionHint=h.MarkingPositionHint.Below),A.ictus=a;break;case"r":f&&"1"===p?(A.acuteAccent=new h.AcuteAccent(t,A),c++):A.shapeModifiers|=r.NoteShapeModifiers.Cavum;break;case"s":A.shape===r.NoteShape.Stropha&&(n.push(A),A=new r.Note,u++),A.shape=r.NoteShape.Stropha;break;case"v":A.shape===r.NoteShape.Virga&&(n.push(A),A=new r.Note,u++),A.shape=r.NoteShape.Virga;break;case"w":A.shape=r.NoteShape.Quilisma;break;case"o":A.shape=r.NoteShape.Oriscus,f&&"<"===p?(A.shapeModifiers|=r.NoteShapeModifiers.Ascending,c++):f&&">"===p&&(A.shapeModifiers|=r.NoteShapeModifiers.Descending,c++);break;case"O":A.shape=r.NoteShape.Oriscus,f&&"<"===p?(A.shapeModifiers|=r.NoteShapeModifiers.Ascending|r.NoteShapeModifiers.Stemmed,c++):f&&">"===p?(A.shapeModifiers|=r.NoteShapeModifiers.Descending|r.NoteShapeModifiers.Stemmed,c++):A.shapeModifiers|=r.NoteShapeModifiers.Stemmed;break;case"~":A.shape===r.NoteShape.Inclinatum?A.liquescent|=r.LiquescentType.Small:A.shape===r.NoteShape.Oriscus?A.liquescent|=r.LiquescentType.Large:A.liquescent|=r.LiquescentType.Small;break;case"<":A.liquescent|=r.LiquescentType.Ascending;break;case">":A.liquescent|=r.LiquescentType.Descending;break;case"x":A.pitch.step===o.Step.Mi?A.pitch.step=o.Step.Me:A.pitch.step===o.Step.Ti&&(A.pitch.step=o.Step.Te);break;case"y":A.pitch.step===o.Step.Te?A.pitch.step=o.Step.Ti:A.pitch.step===o.Step.Me?A.pitch.step=o.Step.Mi:A.pitch.step===o.Step.Du?A.pitch.step=o.Step.Do:A.pitch.step===o.Step.Fu&&(A.pitch.step=o.Step.Fa);break;case"#":A.pitch.step===o.Step.Do?A.pitch.step=o.Step.Du:A.pitch.step===o.Step.Fa&&(A.pitch.step=o.Step.Fu);break;case"[":for(var y=++c;c1);if(A){var s=new h.NeumeLineVisualizer(this.ctxt,this.lastNote,t,this.lineIsHanging);this.neume.addVisualizer(s),s.bounds.x=Math.max(0,this.x-s.bounds.width),n||(this.x=s.bounds.x)}return n&&this.lastNote?t.bounds.x=this.x-t.bounds.width:(t.bounds.x=this.x,this.x+=t.bounds.width),this.neume.addVisualizer(t),this.lastNote=t,this.lineIsHanging=!1,this}},{key:"virgaAt",value:function(t){arguments.length<=1||void 0===arguments[1]?!0:arguments[1];this.noteAt(t,h.GlyphCode.PunctumQuadratum);var e=new h.VirgaLineVisualizer(this.ctxt,t);return this.x-=e.bounds.width,e.bounds.x=this.x,this.neume.addVisualizer(e),this.lastNote=t,this.lineIsHanging=!1,this}},{key:"advanceBy",value:function(t){return this.lastNote=null,this.lineIsHanging=!1,this.x+=t,this}},{key:"withLineEndingAt",value:function(t){if(null!==this.lastNote){var e=new h.NeumeLineVisualizer(this.ctxt,this.lastNote,t,!0);return this.neume.addVisualizer(e),this.x-=e.bounds.width,e.bounds.x=this.x,this.neume.addVisualizer(e),this.lastNote=t,this}}},{key:"withPodatus",value:function(t,e){var i,n;return t.liquescent===l.LiquescentType.InitioDebilis?(i=e.liquescent===l.LiquescentType.None?h.GlyphCode.PunctumQuadratum:h.GlyphCode.PunctumQuadratumDesLiquescent,n=h.GlyphCode.TerminatingDesLiquescent):e.liquescent&l.LiquescentType.Small?(n=h.GlyphCode.BeginningAscLiquescent,i=h.GlyphCode.TerminatingAscLiquescent):e.liquescent&l.LiquescentType.Ascending?(n=h.GlyphCode.PunctumQuadratum,i=h.GlyphCode.PunctumQuadratumAscLiquescent):e.liquescent&l.LiquescentType.Descending?(n=h.GlyphCode.PunctumQuadratum,i=h.GlyphCode.PunctumQuadratumDesLiquescent):(n=h.GlyphCode.PodatusLower,i=h.GlyphCode.PodatusUpper),t.shape===l.NoteShape.Quilisma&&(n=h.GlyphCode.Quilisma),this.noteAt(t,n).noteAt(e,i),this.lastNote=null,this}},{key:"withClivis",value:function(t,e){var i;return t.shape===l.NoteShape.Oriscus?this.noteAt(t,h.GlyphCode.OriscusDes,!1):this.lineFrom(e).noteAt(t,h.GlyphCode.PunctumQuadratum),i=e.liquescent&l.LiquescentType.Small?h.GlyphCode.TerminatingDesLiquescent:e.liquescent===l.LiquescentType.Ascending?h.GlyphCode.PunctumQuadratumAscLiquescent:e.liquescent===l.LiquescentType.Descending?h.GlyphCode.PunctumQuadratumDesLiquescent:h.GlyphCode.PunctumQuadratum,this.noteAt(e,i),this.lastNote=null,this}},{key:"withInclinati",value:function(t){for(var e=t[0].staffPosition,i=t[0].staffPosition,n=g.Glyphs.PunctumInclinatum.bounds.width*this.ctxt.glyphScaling,A=0;A0&&(this.x+=n*o),s.bounds.x=this.x,this.neume.addVisualizer(s)}return this}},{key:"withPorrectusSwash",value:function(t,e){var i=null!==this.lastNote&&(this.lineIsHanging||"right"===this.lastNote.glyphVisualizer.align||Math.abs(this.lastNote.staffPosition-t.staffPosition)>1);if(i){var n=new h.NeumeLineVisualizer(this.ctxt,this.lastNote,t,this.lineIsHanging);this.x=Math.max(0,this.x-n.bounds.width),n.bounds.x=this.x,this.neume.addVisualizer(n)}var A;switch(t.staffPosition-e.staffPosition){case 1:A=h.GlyphCode.Porrectus1;break;case 2:A=h.GlyphCode.Porrectus2;break;case 3:A=h.GlyphCode.Porrectus3;break;case 4:A=h.GlyphCode.Porrectus4;break;default:A=h.GlyphCode.None}return t.setGlyph(this.ctxt,A),t.bounds.x=this.x,e.setGlyph(this.ctxt,h.GlyphCode.None),this.x=t.bounds.right(),e.bounds.x=this.x-e.bounds.width,this.neume.addVisualizer(t),this.neume.addVisualizer(e),this.lastNote=e,this.lineIsHanging=!1,this}}]),t}(),f=e.Neume=function(t){function e(){var t=arguments.length<=0||void 0===arguments[0]?[]:arguments[0];o(this,e);var i=A(this,Object.getPrototypeOf(e).call(this));i.isNeume=!0,i.notes=t;for(var n=0;nn.staffPosition&&(i=h.GlyphCode.OriscusAsc)}}this.build(t).noteAt(n,i),this.finishLayout(t)}},{key:"resetDependencies",value:function(){this.notes[0].shapeModifiers&l.NoteShapeModifiers.Ascending||this.notes[0].shapeModifiers&l.NoteShapeModifiers.Descending||(this.needsLayout=!0)}}]),e}(f),e.PesQuassus=function(t){function e(){return o(this,e),A(this,Object.getPrototypeOf(e).apply(this,arguments))}return s(e,t),r(e,[{key:"performLayout",value:function(t){a(Object.getPrototypeOf(e.prototype),"performLayout",this).call(this,t);var i,n=this.notes[0],A=this.notes[1],s=n.staffPosition,o=A.staffPosition;i=n.shape===l.NoteShape.Oriscus?h.GlyphCode.OriscusAsc:h.GlyphCode.PunctumQuadratum;var r=this.build(t).noteAt(n,i);o-s===1?r.virgaAt(A):A.liquescent===l.LiquescentType.LargeDescending?r.noteAt(A,h.GlyphCode.PunctumQuadratumDesLiquescent).withLineEndingAt(n):r.noteAt(A,h.GlyphCode.PunctumQuadratum).withLineEndingAt(n),this.finishLayout(t)}}]),e}(f),e.PesSubpunctis=function(t){function e(){return o(this,e),A(this,Object.getPrototypeOf(e).apply(this,arguments))}return s(e,t),r(e,[{key:"performLayout",value:function(t){a(Object.getPrototypeOf(e.prototype),"performLayout",this).call(this,t),this.build(t).withPodatus(this.notes[0],this.notes[1]).advanceBy(t.intraNeumeSpacing/2).withInclinati(this.notes.slice(2)),this.finishLayout(t)}}]),e}(f),e.Podatus=function(t){function e(){return o(this,e),A(this,Object.getPrototypeOf(e).apply(this,arguments))}return s(e,t),r(e,[{key:"positionMarkings",value:function(){var t,e;for(e=0;e