text: /*!
   * wavesurfer.js elan plugin 4.0.1 (2020-10-19)
   * https://github.com/katspaugh/wavesurfer.js
   * @license BSD-3-Clause
   */
  !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("elan",[],t):"object"==typeof exports?exports.elan=t():(e.WaveSurfer=e.WaveSurfer||{},e.WaveSurfer.elan=t())}(this,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="localhost:8080/dist/plugin/",n(n.s=1)}([,function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=function(){function e(t,n){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.Types={ALIGNABLE_ANNOTATION:"ALIGNABLE_ANNOTATION",REF_ANNOTATION:"REF_ANNOTATION"},this.data=null,this.params=t,this.container="string"==typeof t.container?document.querySelector(t.container):t.container,!this.container)throw Error("No container for ELAN")}return a(e,null,[{key:"create",value:function(t){return{name:"elan",deferInit:!(!t||!t.deferInit)&&t.deferInit,params:t,instance:e}}}]),a(e,[{key:"init",value:function(){this.bindClick(),this.params.url&&this.load(this.params.url)}},{key:"destroy",value:function(){this.container.removeEventListener("click",this._onClick),this.container.removeChild(this.table)}},{key:"load",value:function(e){var t=this;this.loadXML(e,(function(e){t.data=t.parseElan(e),t.render(),t.fireEvent("ready",t.data)}))}},{key:"loadXML",value:function(e,t){var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="document",n.send(),n.addEventListener("load",(function(e){t&&t(e.target.responseXML)}))}},{key:"parseElan",value:function(e){var t=this,n=Array.prototype.forEach,r=Array.prototype.map,a={media:{},timeOrder:{},tiers:[],annotations:{},alignableAnnotations:[]},i=e.querySelector("HEADER"),o="milliseconds"==i.getAttribute("TIME_UNITS"),u=i.querySelector("MEDIA_DESCRIPTOR");a.media.url=u.getAttribute("MEDIA_URL"),a.media.type=u.getAttribute("MIME_TYPE");var l=e.querySelectorAll("TIME_ORDER TIME_SLOT"),c={};return n.call(l,(function(e){var t=parseFloat(e.getAttribute("TIME_VALUE"));o&&(t=Math.round(100*t)/1e5),c[e.getAttribute("TIME_SLOT_ID")]=t})),a.tiers=r.call(e.querySelectorAll("TIER"),(function(e){return{id:e.getAttribute("TIER_ID"),linguisticTypeRef:e.getAttribute("LINGUISTIC_TYPE_REF"),defaultLocale:e.getAttribute("DEFAULT_LOCALE"),annotations:r.call(e.querySelectorAll("REF_ANNOTATION, ALIGNABLE_ANNOTATION"),(function(e){var n={type:e.nodeName,id:e.getAttribute("ANNOTATION_ID"),ref:e.getAttribute("ANNOTATION_REF"),value:e.querySelector("ANNOTATION_VALUE").textContent.trim()};return t.Types.ALIGNABLE_ANNOTATION==n.type&&(n.start=c[e.getAttribute("TIME_SLOT_REF1")],n.end=c[e.getAttribute("TIME_SLOT_REF2")],a.alignableAnnotations.push(n)),a.annotations[n.id]=n,n}))}})),a.tiers.forEach((function(e){e.annotations.forEach((function(e){null!=e.ref&&(e.reference=a.annotations[e.ref])}))})),a.alignableAnnotations.sort((function(e,t){var n=e.start-t.start;return 0==n&&(n=t.end-e.end),n})),a.length=a.alignableAnnotations.length,a}},{key:"render",value:function(){var e=this,t=this.data.tiers;this.params.tiers&&(t=t.filter((function(t){return t.id in e.params.tiers})));var n={},r={};t.forEach((function(t,a){t.annotations.forEach((function(t){t.reference&&t.reference.type==e.Types.ALIGNABLE_ANNOTATION&&(t.reference.id in n||(n[t.ref]={}),n[t.ref][a]=t,r[a]=!0)}))})),r=Object.keys(r).sort(),this.renderedAlignable=this.data.alignableAnnotations.filter((function(e){return n[e.id]}));var a=this.table=document.createElement("table");a.className="wavesurfer-annotations";var i=document.createElement("thead"),o=document.createElement("tr");i.appendChild(o),a.appendChild(i);var u=document.createElement("th");u.textContent="Time",u.className="wavesurfer-time",o.appendChild(u),r.forEach((function(n){var r=t[n],a=document.createElement("th");a.className="wavesurfer-tier-"+r.id,a.textContent=r.id,e.params.tiers&&(a.style.width=e.params.tiers[r.id]),o.appendChild(a)}));var l=document.createElement("tbody");a.appendChild(l),this.renderedAlignable.forEach((function(e){var a=document.createElement("tr");a.id="wavesurfer-alignable-"+e.id,l.appendChild(a);var i=document.createElement("td");i.className="wavesurfer-time",i.textContent=e.start.toFixed(1)+"–"+e.end.toFixed(1),a.appendChild(i);var o=n[e.id];r.forEach((function(n){var r=t[n],i=document.createElement("td"),u=o[n];u&&(i.id="wavesurfer-annotation-"+u.id,i.dataset.ref=e.id,i.dataset.start=e.start,i.dataset.end=e.end,i.textContent=u.value),i.className="wavesurfer-tier-"+r.id,a.appendChild(i)}))})),this.container.innerHTML="",this.container.appendChild(a)}},{key:"bindClick",value:function(){var e=this;this._onClick=function(t){var n=t.target.dataset.ref;if(null!=n){var r=e.data.annotations[n];r&&e.fireEvent("select",r.start,r.end)}},this.container.addEventListener("click",this._onClick)}},{key:"getRenderedAnnotation",value:function(e){var t;return this.renderedAlignable.some((function(n){return n.start<=e&&n.end>=e&&(t=n,!0)})),t}},{key:"getAnnotationNode",value:function(e){return document.getElementById("wavesurfer-alignable-"+e.id)}}]),e}();t.default=i,e.exports=t.default}])}));
  //# sourceMappingURL=wavesurfer.elan.min.js.map