jsmediatags
Advanced tools
Comparing version 3.6.2 to 3.7.0
@@ -27,2 +27,5 @@ 'use strict'; | ||
getByteAt(offset) { | ||
if (offset >= this._array.length) { | ||
throw new Error("Offset " + offset + " hasn't been loaded yet."); | ||
} | ||
return this._array[offset]; | ||
@@ -29,0 +32,0 @@ } |
@@ -70,3 +70,3 @@ /** | ||
// TypedArrays don't support concat. | ||
if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView(dataA)) { | ||
if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView && ArrayBuffer.isView(dataA)) { | ||
// $FlowIssue - flow thinks dataAandB is a string but it's not | ||
@@ -73,0 +73,0 @@ var dataAandB = new dataA.constructor(dataA.length + dataB.length); |
@@ -194,4 +194,7 @@ 'use strict'; | ||
var frames = {}; | ||
while (offset < end) { | ||
var frameHeaderSize = this._getFrameHeaderSize(id3header); | ||
// console.log('header', id3header); | ||
while ( | ||
// we should be able to read at least the frame header | ||
offset < end - frameHeaderSize) { | ||
var header = this._readFrameHeader(data, offset, id3header); | ||
@@ -210,2 +213,3 @@ var frameId = header.id; | ||
// console.log(offset, frameId, header.size + header.headerSize, flags && flags.format.unsynchronisation); | ||
// advance data offset to the next frame data | ||
@@ -266,5 +270,18 @@ offset += header.headerSize + header.size; | ||
static _getFrameHeaderSize(id3header) { | ||
var major = id3header.major; | ||
if (major == 2) { | ||
return 6; | ||
} else if (major == 3 || major == 4) { | ||
return 10; | ||
} else { | ||
return 0; | ||
} | ||
} | ||
static _readFrameHeader(data, offset, id3header) { | ||
var major = id3header.major; | ||
var flags = null; | ||
var frameHeaderSize = this._getFrameHeaderSize(id3header); | ||
@@ -275,3 +292,2 @@ switch (major) { | ||
var frameSize = data.getInteger24At(offset + 3, true); | ||
var frameHeaderSize = 6; | ||
break; | ||
@@ -282,3 +298,2 @@ | ||
var frameSize = data.getLongAt(offset + 4, true); | ||
var frameHeaderSize = 10; | ||
break; | ||
@@ -289,3 +304,2 @@ | ||
var frameSize = data.getSynchsafeInteger32At(offset + 4); | ||
var frameHeaderSize = 10; | ||
break; | ||
@@ -419,3 +433,3 @@ } | ||
for (var i = 0; i < result.entryCount; i++) { | ||
var childId = StringUtils.readNullTerminatedString(data.getBytesAt(offset, length)); | ||
var childId = StringUtils.readNullTerminatedString(data.getBytesAt(offset, length - (offset - originalOffset))); | ||
result.childElementIds.push(childId.toString()); | ||
@@ -508,2 +522,13 @@ offset += childId.bytesReadCount; | ||
frameReaderFunctions['UFID'] = function readLyricsFrame(offset, length, data, flags, id3header) { | ||
var ownerIdentifier = StringUtils.readNullTerminatedString(data.getBytesAt(offset, length)); | ||
offset += ownerIdentifier.bytesReadCount; | ||
var identifier = data.getBytesAt(offset, length - ownerIdentifier.bytesReadCount); | ||
return { | ||
ownerIdentifier: ownerIdentifier.toString(), | ||
identifier: identifier | ||
}; | ||
}; | ||
function getTextEncoding(bite) { | ||
@@ -510,0 +535,0 @@ var charset; |
@@ -230,3 +230,6 @@ /** | ||
var frame = [].concat(bin(id), size, frameFlags, flags && flags.format.data_length_indicator && noFlagsDataLength ? getSynchsafeInteger32(noFlagsDataLength) : [], data); | ||
this._frames[id] = frame; | ||
if (!this._frames[id]) { | ||
this._frames[id] = []; | ||
} | ||
this._frames[id].push(frame); | ||
this._addData(this._nextFrameOffset, frame); | ||
@@ -298,3 +301,5 @@ | ||
if (this._frames.hasOwnProperty(frameId)) { | ||
size += this._frames[frameId].length; | ||
for (var i = 0, frame; frame = this._frames[frameId][i]; i++) { | ||
size += frame.length; | ||
} | ||
} | ||
@@ -301,0 +306,0 @@ } |
@@ -102,5 +102,11 @@ 'use strict'; | ||
_getFrameData(frames, ids) { | ||
var frame; | ||
for (var i = 0, id; id = ids[i]; i++) { | ||
if (id in frames) { | ||
return frames[id].data; | ||
if (frames[id] instanceof Array) { | ||
frame = frames[id][0]; | ||
} else { | ||
frame = frames[id]; | ||
} | ||
return frame.data; | ||
} | ||
@@ -107,0 +113,0 @@ } |
@@ -240,3 +240,3 @@ 'use strict'; | ||
if (typeof process !== "undefined") { | ||
if (typeof process !== "undefined" && !process.browser) { | ||
Config.addFileReader(NodeFileReader); | ||
@@ -243,0 +243,0 @@ } |
@@ -263,4 +263,8 @@ 'use strict'; | ||
_isWebWorker() { | ||
return typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope; | ||
} | ||
_createXHRObject() { | ||
if (typeof window === "undefined") { | ||
if (typeof window === "undefined" && !this._isWebWorker()) { | ||
// $FlowIssue - flow is not able to recognize this module. | ||
@@ -270,4 +274,4 @@ return new (require("xhr2").XMLHttpRequest)(); | ||
if (window.XMLHttpRequest) { | ||
return new window.XMLHttpRequest(); | ||
if (typeof XMLHttpRequest !== "undefined") { | ||
return new XMLHttpRequest(); | ||
} | ||
@@ -274,0 +278,0 @@ |
@@ -1,19 +0,19 @@ | ||
(function(x){"object"===typeof exports&&"undefined"!==typeof module?module.exports=x():"function"===typeof define&&define.amd?define([],x):("undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:this).jsmediatags=x()})(function(){return function f(n,q,g){function m(c,a){if(!q[c]){if(!n[c]){var d="function"==typeof require&&require;if(!a&&d)return d(c,!0);if(e)return e(c,!0);d=Error("Cannot find module '"+c+"'");throw d.code="MODULE_NOT_FOUND",d;}d=q[c]= | ||
{exports:{}};n[c][0].call(d.exports,function(a){var d=n[c][1][a];return m(d?d:a)},d,d.exports,f,n,q,g)}return q[c].exports}for(var e="function"==typeof require&&require,b=0;b<g.length;b++)m(g[b]);return m}({1:[function(f,n,q){},{}],2:[function(f,n,q){n.exports=XMLHttpRequest},{}],3:[function(f,n,q){function g(e,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);e.prototype=Object.create(b&&b.prototype,{constructor:{value:e, | ||
enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(e,b):e.__proto__=b)}var m=function(){function e(b,c){for(var a=0;a<c.length;a++){var d=c[a];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(b,d.key,d)}}return function(b,c,a){c&&e(b.prototype,c);a&&e(b,a);return b}}();f=function(e){function b(c){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");var a;a=Object.getPrototypeOf(b).call(this); | ||
if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");a=!a||"object"!==typeof a&&"function"!==typeof a?this:a;a._array=c;a._size=c.length;a._isInitialized=!0;return a}g(b,e);m(b,[{key:"init",value:function(c){setTimeout(c.onSuccess,0)}},{key:"loadRange",value:function(c,a){setTimeout(a.onSuccess,0)}},{key:"getByteAt",value:function(c){return this._array[c]}}],[{key:"canReadFile",value:function(c){return Array.isArray(c)||"function"===typeof Buffer&&Buffer.isBuffer(c)}}]); | ||
return b}(f("./MediaFileReader"));n.exports=f},{"./MediaFileReader":10}],4:[function(f,n,q){function g(b,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);b.prototype=Object.create(c&&c.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(b,c):b.__proto__=c)}var m=function(){function b(c,a){for(var d=0;d<a.length;d++){var b=a[d];b.enumerable=b.enumerable|| | ||
!1;b.configurable=!0;"value"in b&&(b.writable=!0);Object.defineProperty(c,b.key,b)}}return function(c,a,d){a&&b(c.prototype,a);d&&b(c,d);return c}}(),e=f("./ChunkedFileData");f=function(b){function c(a){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");var d;d=Object.getPrototypeOf(c).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");d=!d||"object"!==typeof d&&"function"!==typeof d?this:d;d._blob=a;d._fileData= | ||
new e;return d}g(c,b);m(c,[{key:"_init",value:function(a){this._size=this._blob.size;setTimeout(a.onSuccess,1)}},{key:"loadRange",value:function(a,d){var c=this,h=(this._blob.slice||this._blob.mozSlice||this._blob.webkitSlice).call(this._blob,a[0],a[1]+1),b=new FileReader;b.onloadend=function(h){h=new Uint8Array(b.result);c._fileData.addData(a[0],h);d.onSuccess()};b.onerror=b.onabort=function(a){if(d.onError)d.onError({type:"blob",info:b.error})};b.readAsArrayBuffer(h)}},{key:"getByteAt",value:function(a){return this._fileData.getByteAt(a)}}], | ||
[{key:"canReadFile",value:function(a){return"undefined"!==typeof Blob&&a instanceof Blob||"undefined"!==typeof File&&a instanceof File}}]);return c}(f("./MediaFileReader"));n.exports=f},{"./ChunkedFileData":5,"./MediaFileReader":10}],5:[function(f,n,q){var g=function(){function f(e,b){for(var c=0;c<b.length;c++){var a=b[c];a.enumerable=a.enumerable||!1;a.configurable=!0;"value"in a&&(a.writable=!0);Object.defineProperty(e,a.key,a)}}return function(e,b,c){b&&f(e.prototype,b);c&&f(e,c);return e}}(); | ||
f=function(){function f(){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");this._fileData=[]}g(f,null,[{key:"NOT_FOUND",get:function(){return-1}}]);g(f,[{key:"addData",value:function(e,b){var c=e+b.length-1,a=this._getChunkRange(e,c);if(-1===a.startIx)this._fileData.splice(a.insertIx||0,0,{offset:e,data:b});else{var d=this._fileData[a.startIx],k=this._fileData[a.endIx],c=c<k.offset+k.data.length-1,h={offset:Math.min(e,d.offset),data:b};e>d.offset&&(d=this._sliceData(d.data, | ||
0,e-d.offset),h.data=this._concatData(d,b));c&&(d=this._sliceData(h.data,0,k.offset-h.offset),h.data=this._concatData(d,k.data));this._fileData.splice(a.startIx,a.endIx-a.startIx+1,h)}}},{key:"_concatData",value:function(e,b){if("undefined"!==typeof ArrayBuffer&&ArrayBuffer.isView(e)){var c=new e.constructor(e.length+b.length);c.set(e,0);c.set(b,e.length);return c}return e.concat(b)}},{key:"_sliceData",value:function(e,b,c){return e.slice?e.slice(b,c):e.subarray(b,c)}},{key:"_getChunkRange",value:function(e, | ||
b){for(var c=-1,a=-1,d=0,k=0;k<this._fileData.length;k++,d=k){var h=this._fileData[k].offset,t=h+this._fileData[k].data.length;if(b<h-1)break;if(e<=t+1&&b>=h-1){c=k;break}}if(-1===c)return{startIx:-1,endIx:-1,insertIx:d};for(k=c;k<this._fileData.length&&!(h=this._fileData[k].offset,t=h+this._fileData[k].data.length,b>=h-1&&(a=k),b<=t+1);k++);-1===a&&(a=c);return{startIx:c,endIx:a}}},{key:"hasDataRange",value:function(e,b){for(var c=0;c<this._fileData.length;c++){var a=this._fileData[c];if(b<a.offset)break; | ||
if(e>=a.offset&&b<a.offset+a.data.length)return!0}return!1}},{key:"getByteAt",value:function(e){for(var b,c=0;c<this._fileData.length;c++){var a=this._fileData[c].offset,d=a+this._fileData[c].data.length-1;if(e>=a&&e<=d){b=this._fileData[c];break}}if(b)return b.data[e-b.offset];throw Error("Offset "+e+" hasn't been loaded yet.");}}]);return f}();n.exports=f},{}],6:[function(f,n,q){function g(b,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+ | ||
typeof c);b.prototype=Object.create(c&&c.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(b,c):b.__proto__=c)}var m=function(){function b(b,a){for(var d=0;d<a.length;d++){var k=a[d];k.enumerable=k.enumerable||!1;k.configurable=!0;"value"in k&&(k.writable=!0);Object.defineProperty(b,k.key,k)}}return function(c,a,d){a&&b(c.prototype,a);d&&b(c,d);return c}}();q=f("./MediaTagReader");f("./MediaFileReader");f=function(b){function c(){if(!(this instanceof | ||
c))throw new TypeError("Cannot call a class as a function");var a=Object.getPrototypeOf(c).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?this:a}g(c,b);m(c,[{key:"_loadData",value:function(a,d){var b=a.getSize();a.loadRange([b-128,b-1],d)}},{key:"_parseData",value:function(a,d){var b=a.getSize()-128,h=a.getStringWithCharsetAt(b+3,30).toString(),c=a.getStringWithCharsetAt(b+33, | ||
30).toString(),w=a.getStringWithCharsetAt(b+63,30).toString(),v=a.getStringWithCharsetAt(b+93,4).toString(),u=a.getByteAt(b+97+28),p=a.getByteAt(b+97+29);if(0==u&&0!=p)var u="1.1",l=a.getStringWithCharsetAt(b+97,28).toString();else u="1.0",l=a.getStringWithCharsetAt(b+97,30).toString(),p=0;b=a.getByteAt(b+97+30);h={type:"ID3",version:u,tags:{title:h,artist:c,album:w,year:v,comment:l,genre:255>b?e[b]:""}};p&&(h.tags.track=p);return h}}],[{key:"getTagIdentifierByteRange",value:function(){return{offset:-128, | ||
length:128}}},{key:"canReadTagFormat",value:function(a){return"TAG"===String.fromCharCode.apply(String,a.slice(0,3))}}]);return c}(q);var e="Blues;Classic Rock;Country;Dance;Disco;Funk;Grunge;Hip-Hop;Jazz;Metal;New Age;Oldies;Other;Pop;R&B;Rap;Reggae;Rock;Techno;Industrial;Alternative;Ska;Death Metal;Pranks;Soundtrack;Euro-Techno;Ambient;Trip-Hop;Vocal;Jazz+Funk;Fusion;Trance;Classical;Instrumental;Acid;House;Game;Sound Clip;Gospel;Noise;AlternRock;Bass;Soul;Punk;Space;Meditative;Instrumental Pop;Instrumental Rock;Ethnic;Gothic;Darkwave;Techno-Industrial;Electronic;Pop-Folk;Eurodance;Dream;Southern Rock;Comedy;Cult;Gangsta;Top 40;Christian Rap;Pop/Funk;Jungle;Native American;Cabaret;New Wave;Psychadelic;Rave;Showtunes;Trailer;Lo-Fi;Tribal;Acid Punk;Acid Jazz;Polka;Retro;Musical;Rock & Roll;Hard Rock;Folk;Folk-Rock;National Folk;Swing;Fast Fusion;Bebob;Latin;Revival;Celtic;Bluegrass;Avantgarde;Gothic Rock;Progressive Rock;Psychedelic Rock;Symphonic Rock;Slow Rock;Big Band;Chorus;Easy Listening;Acoustic;Humour;Speech;Chanson;Opera;Chamber Music;Sonata;Symphony;Booty Bass;Primus;Porn Groove;Satire;Slow Jam;Club;Tango;Samba;Folklore;Ballad;Power Ballad;Rhythmic Soul;Freestyle;Duet;Punk Rock;Drum Solo;Acapella;Euro-House;Dance Hall".split(";"); | ||
n.exports=f},{"./MediaFileReader":10,"./MediaTagReader":11}],7:[function(f,n,q){function g(a){var d;switch(a){case 0:d="iso-8859-1";break;case 1:d="utf-16";break;case 2:d="utf-16be";break;case 3:d="utf-8"}return d}function m(a,d,b,c){c=b.getStringWithCharsetAt(a+1,d-1,c);a=b.getStringWithCharsetAt(a+1+c.bytesReadCount,d-1-c.bytesReadCount);return{user_description:c.toString(),data:a.toString()}}var e=function(){function a(d,h){for(var b=0;b<h.length;b++){var c=h[b];c.enumerable=c.enumerable||!1;c.configurable= | ||
!0;"value"in c&&(c.writable=!0);Object.defineProperty(d,c.key,c)}}return function(d,b,c){b&&a(d.prototype,b);c&&a(d,c);return d}}();f("./MediaFileReader");var b=f("./StringUtils"),c=f("./ArrayFileReader"),a={BUF:"Recommended buffer size",CNT:"Play counter",COM:"Comments",CRA:"Audio encryption",CRM:"Encrypted meta frame",ETC:"Event timing codes",EQU:"Equalization",GEO:"General encapsulated object",IPL:"Involved people list",LNK:"Linked information",MCI:"Music CD Identifier",MLL:"MPEG location lookup table", | ||
(function(v){"object"===typeof exports&&"undefined"!==typeof module?module.exports=v():"function"===typeof define&&define.amd?define([],v):("undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:this).jsmediatags=v()})(function(){return function f(p,q,l){function m(b,a){if(!q[b]){if(!p[b]){var d="function"==typeof require&&require;if(!a&&d)return d(b,!0);if(e)return e(b,!0);a=Error("Cannot find module '"+b+"'");throw a.code="MODULE_NOT_FOUND",a;}a=q[b]= | ||
{exports:{}};p[b][0].call(a.exports,function(a){var d=p[b][1][a];return m(d?d:a)},a,a.exports,f,p,q,l)}return q[b].exports}for(var e="function"==typeof require&&require,c=0;c<l.length;c++)m(l[c]);return m}({1:[function(f,p,q){},{}],2:[function(f,p,q){p.exports=XMLHttpRequest},{}],3:[function(f,p,q){function l(e,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);e.prototype=Object.create(c&&c.prototype,{constructor:{value:e, | ||
enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(e,c):e.__proto__=c)}var m=function(){function e(c,b){for(var a=0;a<b.length;a++){var d=b[a];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(c,d.key,d)}}return function(c,b,a){b&&e(c.prototype,b);a&&e(c,a);return c}}();f=function(e){function c(b){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");var a=Object.getPrototypeOf(c).call(this); | ||
if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");a=!a||"object"!==typeof a&&"function"!==typeof a?this:a;a._array=b;a._size=b.length;a._isInitialized=!0;return a}l(c,e);m(c,[{key:"init",value:function(b){setTimeout(b.onSuccess,0)}},{key:"loadRange",value:function(b,a){setTimeout(a.onSuccess,0)}},{key:"getByteAt",value:function(b){if(b>=this._array.length)throw Error("Offset "+b+" hasn't been loaded yet.");return this._array[b]}}],[{key:"canReadFile",value:function(b){return Array.isArray(b)|| | ||
"function"===typeof Buffer&&Buffer.isBuffer(b)}}]);return c}(f("./MediaFileReader"));p.exports=f},{"./MediaFileReader":10}],4:[function(f,p,q){function l(c,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);c.prototype=Object.create(b&&b.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(c,b):c.__proto__=b)}var m=function(){function c(b,a){for(var d= | ||
0;d<a.length;d++){var c=a[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(b,c.key,c)}}return function(b,a,d){a&&c(b.prototype,a);d&&c(b,d);return b}}(),e=f("./ChunkedFileData");f=function(c){function b(a){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");var d=Object.getPrototypeOf(b).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");d=!d||"object"!==typeof d&& | ||
"function"!==typeof d?this:d;d._blob=a;d._fileData=new e;return d}l(b,c);m(b,[{key:"_init",value:function(a){this._size=this._blob.size;setTimeout(a.onSuccess,1)}},{key:"loadRange",value:function(a,d){var c=this,h=(this._blob.slice||this._blob.mozSlice||this._blob.webkitSlice).call(this._blob,a[0],a[1]+1),b=new FileReader;b.onloadend=function(h){h=new Uint8Array(b.result);c._fileData.addData(a[0],h);d.onSuccess()};b.onerror=b.onabort=function(a){if(d.onError)d.onError({type:"blob",info:b.error})}; | ||
b.readAsArrayBuffer(h)}},{key:"getByteAt",value:function(a){return this._fileData.getByteAt(a)}}],[{key:"canReadFile",value:function(a){return"undefined"!==typeof Blob&&a instanceof Blob||"undefined"!==typeof File&&a instanceof File}}]);return b}(f("./MediaFileReader"));p.exports=f},{"./ChunkedFileData":5,"./MediaFileReader":10}],5:[function(f,p,q){var l=function(){function f(e,c){for(var b=0;b<c.length;b++){var a=c[b];a.enumerable=a.enumerable||!1;a.configurable=!0;"value"in a&&(a.writable=!0);Object.defineProperty(e, | ||
a.key,a)}}return function(e,c,b){c&&f(e.prototype,c);b&&f(e,b);return e}}();f=function(){function f(){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");this._fileData=[]}l(f,null,[{key:"NOT_FOUND",get:function(){return-1}}]);l(f,[{key:"addData",value:function(e,c){var b=e+c.length-1,a=this._getChunkRange(e,b);if(-1===a.startIx)this._fileData.splice(a.insertIx||0,0,{offset:e,data:c});else{var d=this._fileData[a.startIx],g=this._fileData[a.endIx];b=b<g.offset+g.data.length- | ||
1;var h={offset:Math.min(e,d.offset),data:c};e>d.offset&&(e=this._sliceData(d.data,0,e-d.offset),h.data=this._concatData(e,c));b&&(e=this._sliceData(h.data,0,g.offset-h.offset),h.data=this._concatData(e,g.data));this._fileData.splice(a.startIx,a.endIx-a.startIx+1,h)}}},{key:"_concatData",value:function(e,c){if("undefined"!==typeof ArrayBuffer&&ArrayBuffer.isView&&ArrayBuffer.isView(e)){var b=new e.constructor(e.length+c.length);b.set(e,0);b.set(c,e.length);return b}return e.concat(c)}},{key:"_sliceData", | ||
value:function(e,c,b){return e.slice?e.slice(c,b):e.subarray(c,b)}},{key:"_getChunkRange",value:function(e,c){for(var b,a,d=-1,g=-1,h=0,k=0;k<this._fileData.length;k++,h=k){a=this._fileData[k].offset;b=a+this._fileData[k].data.length;if(c<a-1)break;if(e<=b+1&&c>=a-1){d=k;break}}if(-1===d)return{startIx:-1,endIx:-1,insertIx:h};for(k=d;k<this._fileData.length&&!(a=this._fileData[k].offset,b=a+this._fileData[k].data.length,c>=a-1&&(g=k),c<=b+1);k++);-1===g&&(g=d);return{startIx:d,endIx:g}}},{key:"hasDataRange", | ||
value:function(e,c){for(var b=0;b<this._fileData.length;b++){var a=this._fileData[b];if(c<a.offset)break;if(e>=a.offset&&c<a.offset+a.data.length)return!0}return!1}},{key:"getByteAt",value:function(e){for(var c,b=0;b<this._fileData.length;b++){var a=this._fileData[b].offset,d=a+this._fileData[b].data.length-1;if(e>=a&&e<=d){c=this._fileData[b];break}}if(c)return c.data[e-c.offset];throw Error("Offset "+e+" hasn't been loaded yet.");}}]);return f}();p.exports=f},{}],6:[function(f,p,q){function l(c, | ||
b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);c.prototype=Object.create(b&&b.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(c,b):c.__proto__=b)}var m=function(){function c(c,a){for(var d=0;d<a.length;d++){var b=a[d];b.enumerable=b.enumerable||!1;b.configurable=!0;"value"in b&&(b.writable=!0);Object.defineProperty(c,b.key,b)}}return function(b, | ||
a,d){a&&c(b.prototype,a);d&&c(b,d);return b}}();q=f("./MediaTagReader");f("./MediaFileReader");f=function(c){function b(){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");var a=Object.getPrototypeOf(b).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?this:a}l(b,c);m(b,[{key:"_loadData",value:function(a,d){var b=a.getSize();a.loadRange([b-128,b-1], | ||
d)}},{key:"_parseData",value:function(a,d){var b=a.getSize()-128,c=a.getStringWithCharsetAt(b+3,30).toString(),k=a.getStringWithCharsetAt(b+33,30).toString(),t=a.getStringWithCharsetAt(b+63,30).toString(),u=a.getStringWithCharsetAt(b+93,4).toString();var r=a.getByteAt(b+97+28);d=a.getByteAt(b+97+29);if(0==r&&0!=d){var n="1.1";r=a.getStringWithCharsetAt(b+97,28).toString()}else n="1.0",r=a.getStringWithCharsetAt(b+97,30).toString(),d=0;a=a.getByteAt(b+97+30);a={type:"ID3",version:n,tags:{title:c,artist:k, | ||
album:t,year:u,comment:r,genre:255>a?e[a]:""}};d&&(a.tags.track=d);return a}}],[{key:"getTagIdentifierByteRange",value:function(){return{offset:-128,length:128}}},{key:"canReadTagFormat",value:function(a){return"TAG"===String.fromCharCode.apply(String,a.slice(0,3))}}]);return b}(q);var e="Blues;Classic Rock;Country;Dance;Disco;Funk;Grunge;Hip-Hop;Jazz;Metal;New Age;Oldies;Other;Pop;R&B;Rap;Reggae;Rock;Techno;Industrial;Alternative;Ska;Death Metal;Pranks;Soundtrack;Euro-Techno;Ambient;Trip-Hop;Vocal;Jazz+Funk;Fusion;Trance;Classical;Instrumental;Acid;House;Game;Sound Clip;Gospel;Noise;AlternRock;Bass;Soul;Punk;Space;Meditative;Instrumental Pop;Instrumental Rock;Ethnic;Gothic;Darkwave;Techno-Industrial;Electronic;Pop-Folk;Eurodance;Dream;Southern Rock;Comedy;Cult;Gangsta;Top 40;Christian Rap;Pop/Funk;Jungle;Native American;Cabaret;New Wave;Psychadelic;Rave;Showtunes;Trailer;Lo-Fi;Tribal;Acid Punk;Acid Jazz;Polka;Retro;Musical;Rock & Roll;Hard Rock;Folk;Folk-Rock;National Folk;Swing;Fast Fusion;Bebob;Latin;Revival;Celtic;Bluegrass;Avantgarde;Gothic Rock;Progressive Rock;Psychedelic Rock;Symphonic Rock;Slow Rock;Big Band;Chorus;Easy Listening;Acoustic;Humour;Speech;Chanson;Opera;Chamber Music;Sonata;Symphony;Booty Bass;Primus;Porn Groove;Satire;Slow Jam;Club;Tango;Samba;Folklore;Ballad;Power Ballad;Rhythmic Soul;Freestyle;Duet;Punk Rock;Drum Solo;Acapella;Euro-House;Dance Hall".split(";"); | ||
p.exports=f},{"./MediaFileReader":10,"./MediaTagReader":11}],7:[function(f,p,q){function l(a){switch(a){case 0:var d="iso-8859-1";break;case 1:d="utf-16";break;case 2:d="utf-16be";break;case 3:d="utf-8"}return d}function m(a,d,b,c){c=b.getStringWithCharsetAt(a+1,d-1,c);a=b.getStringWithCharsetAt(a+1+c.bytesReadCount,d-1-c.bytesReadCount);return{user_description:c.toString(),data:a.toString()}}var e=function(){function a(a,d){for(var b=0;b<d.length;b++){var c=d[b];c.enumerable=c.enumerable||!1;c.configurable= | ||
!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(d,b,c){b&&a(d.prototype,b);c&&a(d,c);return d}}();f("./MediaFileReader");var c=f("./StringUtils"),b=f("./ArrayFileReader"),a={BUF:"Recommended buffer size",CNT:"Play counter",COM:"Comments",CRA:"Audio encryption",CRM:"Encrypted meta frame",ETC:"Event timing codes",EQU:"Equalization",GEO:"General encapsulated object",IPL:"Involved people list",LNK:"Linked information",MCI:"Music CD Identifier",MLL:"MPEG location lookup table", | ||
PIC:"Attached picture",POP:"Popularimeter",REV:"Reverb",RVA:"Relative volume adjustment",SLT:"Synchronized lyric/text",STC:"Synced tempo codes",TAL:"Album/Movie/Show title",TBP:"BPM (Beats Per Minute)",TCM:"Composer",TCO:"Content type",TCR:"Copyright message",TDA:"Date",TDY:"Playlist delay",TEN:"Encoded by",TFT:"File type",TIM:"Time",TKE:"Initial key",TLA:"Language(s)",TLE:"Length",TMT:"Media type",TOA:"Original artist(s)/performer(s)",TOF:"Original filename",TOL:"Original Lyricist(s)/text writer(s)", | ||
@@ -26,53 +26,54 @@ TOR:"Original release year",TOT:"Original album/Movie/Show title",TP1:"Lead artist(s)/Lead performer(s)/Soloist(s)/Performing group",TP2:"Band/Orchestra/Accompaniment",TP3:"Conductor/Performer refinement",TP4:"Interpreted, remixed, or otherwise modified by",TPA:"Part of a set",TPB:"Publisher",TRC:"ISRC (International Standard Recording Code)",TRD:"Recording dates",TRK:"Track number/Position in set",TSI:"Size",TSS:"Software/hardware and settings used for encoding",TT1:"Content group description",TT2:"Title/Songname/Content description", | ||
TPE4:"Interpreted, remixed, or otherwise modified by",TPOS:"Part of a set",TPRO:"Produced notice",TPUB:"Publisher",TRCK:"Track number/Position in set",TRDA:"Recording dates",TRSN:"Internet radio station name",TRSO:"Internet radio station owner",TSOA:"Album sort order",TSOP:"Performer sort order",TSOT:"Title sort order",TSIZ:"Size",TSRC:"ISRC (international standard recording code)",TSSE:"Software/Hardware and settings used for encoding",TSST:"Set subtitle",TYER:"Year",TXXX:"User defined text information frame", | ||
UFID:"Unique file identifier",USER:"Terms of use",USLT:"Unsychronized lyric/text transcription",WCOM:"Commercial information",WCOP:"Copyright/Legal information",WOAF:"Official audio file webpage",WOAR:"Official artist/performer webpage",WOAS:"Official audio source webpage",WORS:"Official internet radio station homepage",WPAY:"Payment",WPUB:"Publishers official webpage",WXXX:"User defined URL link frame"};f=function(){function b(){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function"); | ||
}e(b,null,[{key:"getFrameReaderFunction",value:function(a){return a in d?d[a]:"T"===a[0]?d["T*"]:"W"===a[0]?d["W*"]:null}},{key:"readFrames",value:function(a,d,c,k,e){for(var l={};a<d;){var f=this._readFrameHeader(c,a,k),r=f.id;if(!r)break;var m=f.flags,g=f.size,n=a+f.headerSize,q=c;a+=f.headerSize+f.size;if(!e||-1!==e.indexOf(r)){if("MP3e"===r||"\x00MP3"===r||"\x00\x00MP"===r||" MP3"===r)break;m&&m.format.unsynchronisation&&(q=this.getUnsyncFileReader(q,n,g),n=0,g=q.getSize());m&&m.format.data_length_indicator&& | ||
(n+=4,g-=4);m=(f=b.getFrameReaderFunction(r))?f.apply(this,[n,g,q,m,k]):null;n=this._getFrameDescription(r);g={id:r,size:g,description:n,data:m};r in l?(l[r].id&&(l[r]=[l[r]]),l[r].push(g)):l[r]=g}}return l}},{key:"_readFrameHeader",value:function(a,d,b){b=b.major;var h=null;switch(b){case 2:var c=a.getStringAt(d,3),k=a.getInteger24At(d+3,!0),e=6;break;case 3:c=a.getStringAt(d,4);k=a.getLongAt(d+4,!0);e=10;break;case 4:c=a.getStringAt(d,4),k=a.getSynchsafeInteger32At(d+4),e=10}if(c==String.fromCharCode(0, | ||
0,0)||c==String.fromCharCode(0,0,0,0))c="";c&&2<b&&(h=this._readFrameFlags(a,d+8));return{id:c||"",size:k||0,headerSize:e||0,flags:h}}},{key:"_readFrameFlags",value:function(a,d){return{message:{tag_alter_preservation:a.isBitSetAt(d,6),file_alter_preservation:a.isBitSetAt(d,5),read_only:a.isBitSetAt(d,4)},format:{grouping_identity:a.isBitSetAt(d+1,7),compression:a.isBitSetAt(d+1,3),encryption:a.isBitSetAt(d+1,2),unsynchronisation:a.isBitSetAt(d+1,1),data_length_indicator:a.isBitSetAt(d+1,0)}}}},{key:"_getFrameDescription", | ||
value:function(d){return d in a?a[d]:"Unknown"}},{key:"getUnsyncFileReader",value:function(a,d,b){a=a.getBytesAt(d,b);for(d=0;d<a.length-1;d++)255===a[d]&&0===a[d+1]&&a.splice(d+1,1);return new c(a)}}]);return b}();var d={APIC:function(a,d,b,c,e){c=a;var p=g(b.getByteAt(a));switch(e&&e.major){case 2:e=b.getStringAt(a+1,3);a+=4;break;case 3:case 4:e=b.getStringWithCharsetAt(a+1,d-1);a+=1+e.bytesReadCount;break;default:throw Error("Couldn't read ID3v2 major version.");}var l=b.getByteAt(a,1),l=k[l], | ||
p=b.getStringWithCharsetAt(a+1,d-(a-c)-1,p);a+=1+p.bytesReadCount;return{format:e.toString(),type:l,description:p.toString(),data:b.getBytesAt(a,c+d-a)}},CHAP:function(a,d,c,k,e){k=a;var p={},l=b.readNullTerminatedString(c.getBytesAt(a,d));p.id=l.toString();a+=l.bytesReadCount;p.startTime=c.getLongAt(a,!0);a+=4;p.endTime=c.getLongAt(a,!0);a+=4;p.startOffset=c.getLongAt(a,!0);a+=4;p.endOffset=c.getLongAt(a,!0);a+=4;p.subFrames=this.readFrames(a,a+(d-(a-k)),c,e);return p},CTOC:function(a,d,c,k,e){k= | ||
a;var p={childElementIds:[]},l=b.readNullTerminatedString(c.getBytesAt(a,d));p.id=l.toString();a+=l.bytesReadCount;p.topLevel=c.isBitSetAt(a,1);p.ordered=c.isBitSetAt(a,0);a++;p.entryCount=c.getByteAt(a);a++;for(l=0;l<p.entryCount;l++){var f=b.readNullTerminatedString(c.getBytesAt(a,d));p.childElementIds.push(f.toString());a+=f.bytesReadCount}p.subFrames=this.readFrames(a,a+(d-(a-k)),c,e);return p},COMM:function(a,d,b,c,k){var e=a,l=g(b.getByteAt(a));c=b.getStringAt(a+1,3);k=b.getStringWithCharsetAt(a+ | ||
4,d-4,l);a+=4+k.bytesReadCount;a=b.getStringWithCharsetAt(a,e+d-a,l);return{language:c,short_description:k.toString(),text:a.toString()}}};d.COM=d.COMM;d.PIC=function(a,b,c,k,e){return d.APIC(a,b,c,k,e)};d.PCNT=function(a,d,b,c,k){return b.getLongAt(a,!1)};d.CNT=d.PCNT;d["T*"]=function(a,d,b,c,k){c=g(b.getByteAt(a));return b.getStringWithCharsetAt(a+1,d-1,c).toString()};d.TXXX=function(a,d,b,c,k){c=g(b.getByteAt(a));return m(a,d,b,c)};d["W*"]=function(a,d,b,c,k){c=g(b.getByteAt(a));return void 0!== | ||
c?m(a,d,b,c):b.getStringWithCharsetAt(a,d,c).toString()};d.TCON=function(a,b,c,k){return d["T*"].apply(this,arguments).replace(/^\(\d+\)/,"")};d.TCO=d.TCON;d.USLT=function(a,d,b,c,k){var e=a,l=g(b.getByteAt(a));c=b.getStringAt(a+1,3);k=b.getStringWithCharsetAt(a+4,d-4,l);a+=4+k.bytesReadCount;a=b.getStringWithCharsetAt(a,e+d-a,l);return{language:c,descriptor:k.toString(),lyrics:a.toString()}};d.ULT=d.USLT;var k="Other;32x32 pixels 'file icon' (PNG only);Other file icon;Cover (front);Cover (back);Leaflet page;Media (e.g. label side of CD);Lead artist/lead performer/soloist;Artist/performer;Conductor;Band/Orchestra;Composer;Lyricist/text writer;Recording Location;During recording;During performance;Movie/video screen capture;A bright coloured fish;Illustration;Band/artist logotype;Publisher/Studio logotype".split(";"); | ||
n.exports=f},{"./ArrayFileReader":3,"./MediaFileReader":10,"./StringUtils":12}],8:[function(f,n,q){function g(b,a){if("function"!==typeof a&&null!==a)throw new TypeError("Super expression must either be null or a function, not "+typeof a);b.prototype=Object.create(a&&a.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}});a&&(Object.setPrototypeOf?Object.setPrototypeOf(b,a):b.__proto__=a)}var m=function(){function b(a,d){for(var c=0;c<d.length;c++){var h=d[c];h.enumerable=h.enumerable|| | ||
!1;h.configurable=!0;"value"in h&&(h.writable=!0);Object.defineProperty(a,h.key,h)}}return function(a,d,k){d&&b(a.prototype,d);k&&b(a,k);return a}}();q=f("./MediaTagReader");f("./MediaFileReader");var e=f("./ID3v2FrameReader");f=function(c){function a(){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");var d=Object.getPrototypeOf(a).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!d||"object"!== | ||
typeof d&&"function"!==typeof d?this:d}g(a,c);m(a,[{key:"_loadData",value:function(a,b){a.loadRange([6,9],{onSuccess:function(){a.loadRange([0,10+a.getSynchsafeInteger32At(6)-1],b)},onError:b.onError})}},{key:"_parseData",value:function(a,c){var h=0,f=a.getByteAt(h+3);if(4<f)return{type:"ID3",version:">2.4",tags:{}};var g=a.getByteAt(h+4),m=a.isBitSetAt(h+5,7),u=a.isBitSetAt(h+5,6),p=a.isBitSetAt(h+5,5),l=a.getSynchsafeInteger32At(h+6),h=h+10;if(u)var n=a.getLongAt(h,!0),h=h+(n+4);f={type:"ID3",version:"2."+ | ||
f+"."+g,major:f,revision:g,flags:{unsynchronisation:m,extended_header:u,experimental_indicator:p,footer_present:!1},size:l,tags:{}};if(c)var r=this._expandShortcutTags(c);g=l+10;f.flags.unsynchronisation&&(a=e.getUnsyncFileReader(a,h,l),h=0,g=a.getSize());var h=e.readFrames(h,g,a,f,r),q;for(q in b)b.hasOwnProperty(q)&&(l=this._getFrameData(h,b[q]))&&(f.tags[q]=l);for(var y in h)h.hasOwnProperty(y)&&(f.tags[y]=h[y]);return f}},{key:"_getFrameData",value:function(a,b){for(var c=0,e;e=b[c];c++)if(e in | ||
a)return a[e].data}},{key:"getShortcuts",value:function(){return b}}],[{key:"getTagIdentifierByteRange",value:function(){return{offset:0,length:10}}},{key:"canReadTagFormat",value:function(a){return"ID3"===String.fromCharCode.apply(String,a.slice(0,3))}}]);return a}(q);var b={title:["TIT2","TT2"],artist:["TPE1","TP1"],album:["TALB","TAL"],year:["TYER","TYE"],comment:["COMM","COM"],track:["TRCK","TRK"],genre:["TCON","TCO"],picture:["APIC","PIC"],lyrics:["USLT","ULT"]};n.exports=f},{"./ID3v2FrameReader":7, | ||
"./MediaFileReader":10,"./MediaTagReader":11}],9:[function(f,n,q){function g(a,d){if("function"!==typeof d&&null!==d)throw new TypeError("Super expression must either be null or a function, not "+typeof d);a.prototype=Object.create(d&&d.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});d&&(Object.setPrototypeOf?Object.setPrototypeOf(a,d):a.__proto__=d)}var m=function(){function a(a,b){for(var c=0;c<b.length;c++){var e=b[c];e.enumerable=e.enumerable||!1;e.configurable=!0; | ||
"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}();q=f("./MediaTagReader");f("./MediaFileReader");f=function(a){function d(){if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");var a=Object.getPrototypeOf(d).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?this:a}g(d,a);m(d, | ||
[{key:"_loadData",value:function(a,b){var d=this;a.loadRange([0,16],{onSuccess:function(){d._loadAtom(a,0,"",b)},onError:b.onError})}},{key:"_loadAtom",value:function(a,b,d,c){if(b>=a.getSize())c.onSuccess();else{var e=this,f=a.getLongAt(b,!0);if(0==f||isNaN(f))c.onSuccess();else{var p=a.getStringAt(b+4,4);if(this._isContainerAtom(p)){"meta"==p&&(b+=4);var l=(d?d+".":"")+p;"moov.udta.meta.ilst"===l?a.loadRange([b,b+f],c):a.loadRange([b+8,b+8+8],{onSuccess:function(){e._loadAtom(a,b+8,l,c)},onError:c.onError})}else a.loadRange([b+ | ||
f,b+f+8],{onSuccess:function(){e._loadAtom(a,b+f,d,c)},onError:c.onError})}}}},{key:"_isContainerAtom",value:function(a){return 0<=["moov","udta","meta","ilst"].indexOf(a)}},{key:"_canReadAtom",value:function(a){return"----"!==a}},{key:"_parseData",value:function(a,b){var d={};b=this._expandShortcutTags(b);this._readAtom(d,a,0,a.getSize(),b);for(var e in c)if(c.hasOwnProperty(e)){var f=d[c[e]];f&&(d[e]="track"===e?f.data.track:f.data)}return{type:"MP4",ftyp:a.getStringAt(8,4),version:a.getLongAt(12, | ||
!0),tags:d}}},{key:"_readAtom",value:function(a,b,d,c,e,f,p){p=void 0===p?"":p+" ";for(var l=d;l<d+c;){var g=b.getLongAt(l,!0);if(0==g)break;var m=b.getStringAt(l+4,4);if(this._isContainerAtom(m)){"meta"==m&&(l+=4);this._readAtom(a,b,l+8,g-8,e,(f?f+".":"")+m,p);break}(!e||0<=e.indexOf(m))&&"moov.udta.meta.ilst"===f&&this._canReadAtom(m)&&(a[m]=this._readMetadataAtom(b,l));l+=g}}},{key:"_readMetadataAtom",value:function(a,d){var c=a.getLongAt(d,!0),f=a.getStringAt(d+4,4),g=a.getInteger24At(d+16+1, | ||
!0),g=e[g],m;if("trkn"==f)m={track:a.getByteAt(d+16+11),total:a.getByteAt(d+16+13)};else if("disk"==f)m={disk:a.getByteAt(d+16+11),total:a.getByteAt(d+16+13)};else{var p=d+24,l=c-24;"covr"===f&&"uint8"===g&&(g="jpeg");switch(g){case "text":m=a.getStringWithCharsetAt(p,l,"utf-8").toString();break;case "uint8":m=a.getShortAt(p,!1);break;case "int":case "uint":m=("int"==g?1==l?a.getSByteAt:2==l?a.getSShortAt:4==l?a.getSLongAt:a.getLongAt:1==l?a.getByteAt:2==l?a.getShortAt:a.getLongAt).call(a,p+(8==l? | ||
4:0),!0);break;case "jpeg":case "png":m={format:"image/"+g,data:a.getBytesAt(p,l)}}}return{id:f,size:c,description:b[f]||"Unknown",data:m}}},{key:"getShortcuts",value:function(){return c}}],[{key:"getTagIdentifierByteRange",value:function(){return{offset:0,length:16}}},{key:"canReadTagFormat",value:function(a){return"ftyp"===String.fromCharCode.apply(String,a.slice(4,8))}}]);return d}(q);var e={0:"uint8",1:"text",13:"jpeg",14:"png",21:"int",22:"uint"},b={"\u00a9alb":"Album","\u00a9ART":"Artist",aART:"Album Artist", | ||
"\u00a9day":"Release Date","\u00a9nam":"Title","\u00a9gen":"Genre",gnre:"Genre",trkn:"Track Number","\u00a9wrt":"Composer","\u00a9too":"Encoding Tool","\u00a9enc":"Encoded By",cprt:"Copyright",covr:"Cover Art","\u00a9grp":"Grouping",keyw:"Keywords","\u00a9lyr":"Lyrics","\u00a9cmt":"Comment",tmpo:"Tempo",cpil:"Compilation",disk:"Disc Number",tvsh:"TV Show Name",tven:"TV Episode ID",tvsn:"TV Season",tves:"TV Episode",tvnn:"TV Network",desc:"Description",ldes:"Long Description",sonm:"Sort Name",soar:"Sort Artist", | ||
soaa:"Sort Album",soco:"Sort Composer",sosn:"Sort Show",purd:"Purchase Date",pcst:"Podcast",purl:"Podcast URL",catg:"Category",hdvd:"HD Video",stik:"Media Type",rtng:"Content Rating",pgap:"Gapless Playback",apID:"Purchase Account",sfID:"Country Code",atID:"Artist ID",cnID:"Catalog ID",plID:"Collection ID",geID:"Genre ID","xid ":"Vendor Information",flvr:"Codec Flavor"},c={title:"\u00a9nam",artist:"\u00a9ART",album:"\u00a9alb",year:"\u00a9day",comment:"\u00a9cmt",track:"trkn",genre:"\u00a9gen",picture:"covr", | ||
lyrics:"\u00a9lyr"};n.exports=f},{"./MediaFileReader":10,"./MediaTagReader":11}],10:[function(f,n,q){var g=function(){function e(b,c){for(var a=0;a<c.length;a++){var d=c[a];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(b,d.key,d)}}return function(b,c,a){c&&e(b.prototype,c);a&&e(b,a);return b}}(),m=f("./StringUtils");f=function(){function e(){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this._isInitialized=!1; | ||
this._size=0}g(e,[{key:"init",value:function(b){var c=this;if(this._isInitialized)setTimeout(b.onSuccess,1);else return this._init({onSuccess:function(){c._isInitialized=!0;b.onSuccess()},onError:b.onError})}},{key:"_init",value:function(b){throw Error("Must implement init function");}},{key:"loadRange",value:function(b,c){throw Error("Must implement loadRange function");}},{key:"getSize",value:function(){if(!this._isInitialized)throw Error("init() must be called first.");return this._size}},{key:"getByteAt", | ||
value:function(b){throw Error("Must implement getByteAt function");}},{key:"getBytesAt",value:function(b,c){for(var a=Array(c),d=0;d<c;d++)a[d]=this.getByteAt(b+d);return a}},{key:"isBitSetAt",value:function(b,c){return 0!=(this.getByteAt(b)&1<<c)}},{key:"getSByteAt",value:function(b){b=this.getByteAt(b);return 127<b?b-256:b}},{key:"getShortAt",value:function(b,c){var a=c?(this.getByteAt(b)<<8)+this.getByteAt(b+1):(this.getByteAt(b+1)<<8)+this.getByteAt(b);0>a&&(a+=65536);return a}},{key:"getSShortAt", | ||
value:function(b,c){var a=this.getShortAt(b,c);return 32767<a?a-65536:a}},{key:"getLongAt",value:function(b,c){var a=this.getByteAt(b),d=this.getByteAt(b+1),e=this.getByteAt(b+2),f=this.getByteAt(b+3),a=c?(((a<<8)+d<<8)+e<<8)+f:(((f<<8)+e<<8)+d<<8)+a;0>a&&(a+=4294967296);return a}},{key:"getSLongAt",value:function(b,c){var a=this.getLongAt(b,c);return 2147483647<a?a-4294967296:a}},{key:"getInteger24At",value:function(b,c){var a=this.getByteAt(b),d=this.getByteAt(b+1),e=this.getByteAt(b+2),a=c?((a<< | ||
8)+d<<8)+e:((e<<8)+d<<8)+a;0>a&&(a+=16777216);return a}},{key:"getStringAt",value:function(b,c){for(var a=[],d=b,e=0;d<b+c;d++,e++)a[e]=String.fromCharCode(this.getByteAt(d));return a.join("")}},{key:"getStringWithCharsetAt",value:function(b,c,a){b=this.getBytesAt(b,c);switch((a||"").toLowerCase()){case "utf-16":case "utf-16le":case "utf-16be":a=m.readUTF16String(b,"utf-16be"===a);break;case "utf-8":a=m.readUTF8String(b);break;default:a=m.readNullTerminatedString(b)}return a}},{key:"getCharAt",value:function(b){return String.fromCharCode(this.getByteAt(b))}}, | ||
{key:"getSynchsafeInteger32At",value:function(b){var c=this.getByteAt(b),a=this.getByteAt(b+1),d=this.getByteAt(b+2);return this.getByteAt(b+3)&127|(d&127)<<7|(a&127)<<14|(c&127)<<21}}],[{key:"canReadFile",value:function(b){throw Error("Must implement canReadFile function");}}]);return e}();n.exports=f},{"./StringUtils":12}],11:[function(f,n,q){var g=function(){function f(e,b){for(var c=0;c<b.length;c++){var a=b[c];a.enumerable=a.enumerable||!1;a.configurable=!0;"value"in a&&(a.writable=!0);Object.defineProperty(e, | ||
a.key,a)}}return function(e,b,c){b&&f(e.prototype,b);c&&f(e,c);return e}}();f("./MediaFileReader");f=function(){function f(e){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");this._mediaFileReader=e;this._tags=null}g(f,[{key:"setTagsToRead",value:function(e){this._tags=e;return this}},{key:"read",value:function(e){var b=this;this._mediaFileReader.init({onSuccess:function(){b._loadData(b._mediaFileReader,{onSuccess:function(){try{var c=b._parseData(b._mediaFileReader, | ||
b._tags)}catch(a){if(e.onError){e.onError({type:"parseData",info:a.message});return}}e.onSuccess(c)},onError:e.onError})},onError:e.onError})}},{key:"getShortcuts",value:function(){return{}}},{key:"_loadData",value:function(e,b){throw Error("Must implement _loadData function");}},{key:"_parseData",value:function(e,b){throw Error("Must implement _parseData function");}},{key:"_expandShortcutTags",value:function(e){if(!e)return null;for(var b=[],c=this.getShortcuts(),a=0,d;d=e[a];a++)b=b.concat(c[d]|| | ||
[d]);return b}}],[{key:"getTagIdentifierByteRange",value:function(){throw Error("Must implement");}},{key:"canReadTagFormat",value:function(e){throw Error("Must implement");}}]);return f}();n.exports=f},{"./MediaFileReader":10}],12:[function(f,n,q){var g=function(){function e(b,c){for(var a=0;a<c.length;a++){var d=c[a];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(b,d.key,d)}}return function(b,c,a){c&&e(b.prototype,c);a&&e(b,a);return b}}(),m=function(){function e(b, | ||
c){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this._value=b;this.bytesReadCount=c;this.length=b.length}g(e,[{key:"toString",value:function(){return this._value}}]);return e}();n.exports={readUTF16String:function(e,b,c){var a=0,d=1,f=0;c=Math.min(c||e.length,e.length);254==e[0]&&255==e[1]?(b=!0,a=2):255==e[0]&&254==e[1]&&(b=!1,a=2);b&&(d=0,f=1);b=[];for(var h=0;a<c;h++){var g=e[a+d],n=(g<<8)+e[a+f],a=a+2;if(0==n)break;else 216>g||224<=g?b[h]=String.fromCharCode(n): | ||
(g=(e[a+d]<<8)+e[a+f],a+=2,b[h]=String.fromCharCode(n,g))}return new m(b.join(""),a)},readUTF8String:function(e,b){var c=0;b=Math.min(b||e.length,e.length);239==e[0]&&187==e[1]&&191==e[2]&&(c=3);for(var a=[],d=0;c<b;d++){var f=e[c++];if(0==f)break;else if(128>f)a[d]=String.fromCharCode(f);else if(194<=f&&224>f){var h=e[c++];a[d]=String.fromCharCode(((f&31)<<6)+(h&63))}else if(224<=f&&240>f){var h=e[c++],g=e[c++];a[d]=String.fromCharCode(((f&255)<<12)+((h&63)<<6)+(g&63))}else if(240<=f&&245>f){var h= | ||
e[c++],g=e[c++],n=e[c++],f=((f&7)<<18)+((h&63)<<12)+((g&63)<<6)+(n&63)-65536;a[d]=String.fromCharCode((f>>10)+55296,(f&1023)+56320)}}return new m(a.join(""),c)},readNullTerminatedString:function(e,b){var c=[];b=b||e.length;for(var a=0;a<b;){var d=e[a++];if(0==d)break;c[a-1]=String.fromCharCode(d)}return new m(c.join(""),a)}}},{}],13:[function(f,n,q){function g(b,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);b.prototype= | ||
Object.create(c&&c.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(b,c):b.__proto__=c)}var m=function(){function b(b,a){for(var d=0;d<a.length;d++){var e=a[d];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(b,e.key,e)}}return function(c,a,d){a&&b(c.prototype,a);d&&b(c,d);return c}}(),e=f("./ChunkedFileData");q=function(b){function c(a){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function"); | ||
var b;b=Object.getPrototypeOf(c).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");b=!b||"object"!==typeof b&&"function"!==typeof b?this:b;b._url=a;b._fileData=new e;return b}g(c,b);m(c,[{key:"_init",value:function(a){c._config.avoidHeadRequests?this._fetchSizeWithGetRequest(a):this._fetchSizeWithHeadRequest(a)}},{key:"_fetchSizeWithHeadRequest",value:function(a){var b=this;this._makeXHRRequest("HEAD",null,{onSuccess:function(c){(c=b._parseContentLength(c))? | ||
(b._size=c,a.onSuccess()):b._fetchSizeWithGetRequest(a)},onError:a.onError})}},{key:"_fetchSizeWithGetRequest",value:function(a){var b=this,c=this._roundRangeToChunkMultiple([0,0]);this._makeXHRRequest("GET",c,{onSuccess:function(c){var e=b._parseContentRange(c);c=b._getXhrResponseContent(c);if(e){if(null==e.instanceLength){b._fetchEntireFile(a);return}b._size=e.instanceLength}else b._size=c.length;b._fileData.addData(0,c);a.onSuccess()},onError:a.onError})}},{key:"_fetchEntireFile",value:function(a){var b= | ||
this;this._makeXHRRequest("GET",null,{onSuccess:function(c){c=b._getXhrResponseContent(c);b._size=c.length;b._fileData.addData(0,c);a.onSuccess()},onError:a.onError})}},{key:"_getXhrResponseContent",value:function(a){return a.responseBody||a.responseText||""}},{key:"_parseContentLength",value:function(a){a=this._getResponseHeader(a,"Content-Length");return null==a?a:parseInt(a,10)}},{key:"_parseContentRange",value:function(a){if(a=this._getResponseHeader(a,"Content-Range")){var b=a.match(/bytes (\d+)-(\d+)\/(?:(\d+)|\*)/i); | ||
if(!b)throw Error("FIXME: Unknown Content-Range syntax: ",a);return{firstBytePosition:parseInt(b[1],10),lastBytePosition:parseInt(b[2],10),instanceLength:b[3]?parseInt(b[3],10):null}}return null}},{key:"loadRange",value:function(a,b){var c=this;c._fileData.hasDataRange(a[0],Math.min(c._size,a[1]))?setTimeout(b.onSuccess,1):(a=this._roundRangeToChunkMultiple(a),a[1]=Math.min(c._size,a[1]),this._makeXHRRequest("GET",a,{onSuccess:function(e){e=c._getXhrResponseContent(e);c._fileData.addData(a[0],e); | ||
b.onSuccess()},onError:b.onError}))}},{key:"_roundRangeToChunkMultiple",value:function(a){return[a[0],a[0]+1024*Math.ceil((a[1]-a[0]+1)/1024)-1]}},{key:"_makeXHRRequest",value:function(a,b,e){var f=this._createXHRObject(),g=function(){if(200===f.status||206===f.status)e.onSuccess(f);else if(e.onError)e.onError({type:"xhr",info:"Unexpected HTTP status "+f.status+".",xhr:f});f=null};"undefined"!==typeof f.onload?(f.onload=g,f.onerror=function(){if(e.onError)e.onError({type:"xhr",info:"Generic XHR error, check xhr object.", | ||
xhr:f})}):f.onreadystatechange=function(){4===f.readyState&&g()};c._config.timeoutInSec&&(f.timeout=1E3*c._config.timeoutInSec,f.ontimeout=function(){if(e.onError)e.onError({type:"xhr",info:"Timeout after "+f.timeout/1E3+"s. Use jsmediatags.Config.setXhrTimeout to override.",xhr:f})});f.open(a,this._url);f.overrideMimeType("text/plain; charset=x-user-defined");b&&this._setRequestHeader(f,"Range","bytes="+b[0]+"-"+b[1]);this._setRequestHeader(f,"If-Modified-Since","Sat, 01 Jan 1970 00:00:00 GMT"); | ||
f.send(null)}},{key:"_setRequestHeader",value:function(a,b,e){0>c._config.disallowedXhrHeaders.indexOf(b.toLowerCase())&&a.setRequestHeader(b,e)}},{key:"_hasResponseHeader",value:function(a,b){var c=a.getAllResponseHeaders();if(!c)return!1;for(var c=c.split("\r\n"),e=[],f=0;f<c.length;f++)e[f]=c[f].split(":")[0].toLowerCase();return 0<=e.indexOf(b.toLowerCase())}},{key:"_getResponseHeader",value:function(a,b){return this._hasResponseHeader(a,b)?a.getResponseHeader(b):null}},{key:"getByteAt",value:function(a){return this._fileData.getByteAt(a).charCodeAt(0)& | ||
255}},{key:"_createXHRObject",value:function(){if("undefined"===typeof window)return new (f("xhr2").XMLHttpRequest);if(window.XMLHttpRequest)return new window.XMLHttpRequest;throw Error("XMLHttpRequest is not supported");}}],[{key:"canReadFile",value:function(a){return"string"===typeof a&&/^[a-z]+:\/\//i.test(a)}},{key:"setConfig",value:function(a){for(var b in a)a.hasOwnProperty(b)&&(this._config[b]=a[b]);a=this._config.disallowedXhrHeaders;for(b=0;b<a.length;b++)a[b]=a[b].toLowerCase()}}]);return c}(f("./MediaFileReader")); | ||
q._config={avoidHeadRequests:!1,disallowedXhrHeaders:[],timeoutInSec:30};n.exports=q},{"./ChunkedFileData":5,"./MediaFileReader":10,xhr2:2}],14:[function(f,n,q){function g(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function m(a,b){var c=0>a.offset&&(-a.offset>b||0<a.offset+a.length);return!(0<=a.offset&&a.offset+a.length>=b||c)}var e=function(){function a(b,c){for(var d=0;d<c.length;d++){var e=c[d];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&& | ||
(e.writable=!0);Object.defineProperty(b,e.key,e)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}();f("./MediaFileReader");q=f("./NodeFileReader");var b=f("./XhrFileReader"),c=f("./BlobFileReader"),a=f("./ArrayFileReader");f("./MediaTagReader");var d=f("./ID3v1TagReader"),k=f("./ID3v2TagReader");f=f("./MP4TagReader");var h=[],t=[],w=function(){function a(b){g(this,a);this._file=b}e(a,[{key:"setTagsToRead",value:function(a){this._tagsToRead=a;return this}},{key:"setFileReader",value:function(a){this._fileReader= | ||
a;return this}},{key:"setTagReader",value:function(a){this._tagReader=a;return this}},{key:"read",value:function(a){var b=new (this._getFileReader())(this._file),c=this;b.init({onSuccess:function(){c._getTagReader(b,{onSuccess:function(d){(new d(b)).setTagsToRead(c._tagsToRead).read(a)},onError:a.onError})},onError:a.onError})}},{key:"_getFileReader",value:function(){return this._fileReader?this._fileReader:this._findFileReader()}},{key:"_findFileReader",value:function(){for(var a=0;a<h.length;a++)if(h[a].canReadFile(this._file))return h[a]; | ||
throw Error("No suitable file reader found for ",this._file);}},{key:"_getTagReader",value:function(a,b){if(this._tagReader){var c=this._tagReader;setTimeout(function(){b.onSuccess(c)},1)}else this._findTagReader(a,b)}},{key:"_findTagReader",value:function(a,b){for(var c=[],d=[],e=a.getSize(),f=0;f<t.length;f++){var g=t[f].getTagIdentifierByteRange();m(g,e)&&(0<=g.offset&&g.offset<e/2||0>g.offset&&g.offset<-e/2?c.push(t[f]):d.push(t[f]))}var h=!1,f={onSuccess:function(){if(h){for(var c=0;c<t.length;c++){var d= | ||
t[c].getTagIdentifierByteRange();if(m(d,e)){try{var f=a.getBytesAt(0<=d.offset?d.offset:d.offset+e,d.length)}catch(g){if(b.onError){b.onError({type:"fileReader",info:g.message});return}}if(t[c].canReadTagFormat(f)){b.onSuccess(t[c]);return}}}if(b.onError)b.onError({type:"tagFormat",info:"No suitable tag reader found"})}else h=!0},onError:b.onError};this._loadTagIdentifierRanges(a,c,f);this._loadTagIdentifierRanges(a,d,f)}},{key:"_loadTagIdentifierRanges",value:function(a,b,c){if(0===b.length)setTimeout(c.onSuccess, | ||
1);else{for(var d=[Number.MAX_VALUE,0],e=a.getSize(),f=0;f<b.length;f++){var g=b[f].getTagIdentifierByteRange(),h=0<=g.offset?g.offset:g.offset+e,g=h+g.length-1;d[0]=Math.min(h,d[0]);d[1]=Math.max(g,d[1])}a.loadRange(d,c)}}}]);return a}(),v=function(){function a(){g(this,a)}e(a,null,[{key:"addFileReader",value:function(b){h.push(b);return a}},{key:"addTagReader",value:function(b){t.push(b);return a}},{key:"removeTagReader",value:function(b){b=t.indexOf(b);0<=b&&t.splice(b,1);return a}},{key:"EXPERIMENTAL_avoidHeadRequests", | ||
value:function(){b.setConfig({avoidHeadRequests:!0})}},{key:"setDisallowedXhrHeaders",value:function(a){b.setConfig({disallowedXhrHeaders:a})}},{key:"setXhrTimeoutInSec",value:function(a){b.setConfig({timeoutInSec:a})}}]);return a}();v.addFileReader(b).addFileReader(c).addFileReader(a).addTagReader(k).addTagReader(d).addTagReader(f);"undefined"!==typeof process&&v.addFileReader(q);n.exports={read:function(a,b){(new w(a)).read(b)},Reader:w,Config:v}},{"./ArrayFileReader":3,"./BlobFileReader":4,"./ID3v1TagReader":6, | ||
"./ID3v2TagReader":8,"./MP4TagReader":9,"./MediaFileReader":10,"./MediaTagReader":11,"./NodeFileReader":1,"./XhrFileReader":13}]},{},[14])(14)}); | ||
UFID:"Unique file identifier",USER:"Terms of use",USLT:"Unsychronized lyric/text transcription",WCOM:"Commercial information",WCOP:"Copyright/Legal information",WOAF:"Official audio file webpage",WOAR:"Official artist/performer webpage",WOAS:"Official audio source webpage",WORS:"Official internet radio station homepage",WPAY:"Payment",WPUB:"Publishers official webpage",WXXX:"User defined URL link frame"};f=function(){function c(){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function"); | ||
}e(c,null,[{key:"getFrameReaderFunction",value:function(a){return a in d?d[a]:"T"===a[0]?d["T*"]:"W"===a[0]?d["W*"]:null}},{key:"readFrames",value:function(a,d,b,h,g){for(var k={},e=this._getFrameHeaderSize(h);a<d-e;){var t=this._readFrameHeader(b,a,h),n=t.id;if(!n)break;var r=t.flags,f=t.size,u=a+t.headerSize,m=b;a+=t.headerSize+t.size;if(!g||-1!==g.indexOf(n)){if("MP3e"===n||"\x00MP3"===n||"\x00\x00MP"===n||" MP3"===n)break;r&&r.format.unsynchronisation&&(m=this.getUnsyncFileReader(m,u,f),u=0,f= | ||
m.getSize());r&&r.format.data_length_indicator&&(u+=4,f-=4);r=(t=c.getFrameReaderFunction(n))?t.apply(this,[u,f,m,r,h]):null;u=this._getFrameDescription(n);f={id:n,size:f,description:u,data:r};n in k?(k[n].id&&(k[n]=[k[n]]),k[n].push(f)):k[n]=f}}return k}},{key:"_getFrameHeaderSize",value:function(a){a=a.major;return 2==a?6:3==a||4==a?10:0}},{key:"_readFrameHeader",value:function(a,d,b){var c=b.major,h=null;b=this._getFrameHeaderSize(b);switch(c){case 2:var g=a.getStringAt(d,3);var k=a.getInteger24At(d+ | ||
3,!0);break;case 3:g=a.getStringAt(d,4);k=a.getLongAt(d+4,!0);break;case 4:g=a.getStringAt(d,4),k=a.getSynchsafeInteger32At(d+4)}if(g==String.fromCharCode(0,0,0)||g==String.fromCharCode(0,0,0,0))g="";g&&2<c&&(h=this._readFrameFlags(a,d+8));return{id:g||"",size:k||0,headerSize:b||0,flags:h}}},{key:"_readFrameFlags",value:function(a,d){return{message:{tag_alter_preservation:a.isBitSetAt(d,6),file_alter_preservation:a.isBitSetAt(d,5),read_only:a.isBitSetAt(d,4)},format:{grouping_identity:a.isBitSetAt(d+ | ||
1,7),compression:a.isBitSetAt(d+1,3),encryption:a.isBitSetAt(d+1,2),unsynchronisation:a.isBitSetAt(d+1,1),data_length_indicator:a.isBitSetAt(d+1,0)}}}},{key:"_getFrameDescription",value:function(d){return d in a?a[d]:"Unknown"}},{key:"getUnsyncFileReader",value:function(a,d,c){a=a.getBytesAt(d,c);for(d=0;d<a.length-1;d++)255===a[d]&&0===a[d+1]&&a.splice(d+1,1);return new b(a)}}]);return c}();var d={APIC:function(a,d,b,c,e){c=a;var h=l(b.getByteAt(a));switch(e&&e.major){case 2:e=b.getStringAt(a+1, | ||
3);a+=4;break;case 3:case 4:e=b.getStringWithCharsetAt(a+1,d-1);a+=1+e.bytesReadCount;break;default:throw Error("Couldn't read ID3v2 major version.");}var k=b.getByteAt(a,1);k=g[k];h=b.getStringWithCharsetAt(a+1,d-(a-c)-1,h);a+=1+h.bytesReadCount;return{format:e.toString(),type:k,description:h.toString(),data:b.getBytesAt(a,c+d-a)}},CHAP:function(a,d,b,g,e){g=a;var h={},k=c.readNullTerminatedString(b.getBytesAt(a,d));h.id=k.toString();a+=k.bytesReadCount;h.startTime=b.getLongAt(a,!0);a+=4;h.endTime= | ||
b.getLongAt(a,!0);a+=4;h.startOffset=b.getLongAt(a,!0);a+=4;h.endOffset=b.getLongAt(a,!0);a+=4;h.subFrames=this.readFrames(a,a+(d-(a-g)),b,e);return h},CTOC:function(a,d,b,g,e){g=a;var h={childElementIds:[]},k=c.readNullTerminatedString(b.getBytesAt(a,d));h.id=k.toString();a+=k.bytesReadCount;h.topLevel=b.isBitSetAt(a,1);h.ordered=b.isBitSetAt(a,0);a++;h.entryCount=b.getByteAt(a);a++;for(k=0;k<h.entryCount;k++){var f=c.readNullTerminatedString(b.getBytesAt(a,d-(a-g)));h.childElementIds.push(f.toString()); | ||
a+=f.bytesReadCount}h.subFrames=this.readFrames(a,a+(d-(a-g)),b,e);return h},COMM:function(a,d,b,c,g){var h=a,e=l(b.getByteAt(a));c=b.getStringAt(a+1,3);g=b.getStringWithCharsetAt(a+4,d-4,e);a+=4+g.bytesReadCount;a=b.getStringWithCharsetAt(a,h+d-a,e);return{language:c,short_description:g.toString(),text:a.toString()}}};d.COM=d.COMM;d.PIC=function(a,b,c,g,e){return d.APIC(a,b,c,g,e)};d.PCNT=function(a,d,b,c,g){return b.getLongAt(a,!1)};d.CNT=d.PCNT;d["T*"]=function(a,d,b,c,g){c=l(b.getByteAt(a));return b.getStringWithCharsetAt(a+ | ||
1,d-1,c).toString()};d.TXXX=function(a,d,b,c,g){c=l(b.getByteAt(a));return m(a,d,b,c)};d["W*"]=function(a,d,b,c,g){c=l(b.getByteAt(a));return void 0!==c?m(a,d,b,c):b.getStringWithCharsetAt(a,d,c).toString()};d.TCON=function(a,b,c,g){return d["T*"].apply(this,arguments).replace(/^\(\d+\)/,"")};d.TCO=d.TCON;d.USLT=function(a,d,b,c,g){var h=a,e=l(b.getByteAt(a));c=b.getStringAt(a+1,3);g=b.getStringWithCharsetAt(a+4,d-4,e);a+=4+g.bytesReadCount;a=b.getStringWithCharsetAt(a,h+d-a,e);return{language:c, | ||
descriptor:g.toString(),lyrics:a.toString()}};d.ULT=d.USLT;d.UFID=function(a,d,b,g,e){g=c.readNullTerminatedString(b.getBytesAt(a,d));a+=g.bytesReadCount;a=b.getBytesAt(a,d-g.bytesReadCount);return{ownerIdentifier:g.toString(),identifier:a}};var g="Other;32x32 pixels 'file icon' (PNG only);Other file icon;Cover (front);Cover (back);Leaflet page;Media (e.g. label side of CD);Lead artist/lead performer/soloist;Artist/performer;Conductor;Band/Orchestra;Composer;Lyricist/text writer;Recording Location;During recording;During performance;Movie/video screen capture;A bright coloured fish;Illustration;Band/artist logotype;Publisher/Studio logotype".split(";"); | ||
p.exports=f},{"./ArrayFileReader":3,"./MediaFileReader":10,"./StringUtils":12}],8:[function(f,p,q){function l(b,a){if("function"!==typeof a&&null!==a)throw new TypeError("Super expression must either be null or a function, not "+typeof a);b.prototype=Object.create(a&&a.prototype,{constructor:{value:b,enumerable:!1,writable:!0,configurable:!0}});a&&(Object.setPrototypeOf?Object.setPrototypeOf(b,a):b.__proto__=a)}var m=function(){function b(a,d){for(var b=0;b<d.length;b++){var c=d[b];c.enumerable=c.enumerable|| | ||
!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(a,d,c){d&&b(a.prototype,d);c&&b(a,c);return a}}();q=f("./MediaTagReader");f("./MediaFileReader");var e=f("./ID3v2FrameReader");f=function(b){function a(){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");var d=Object.getPrototypeOf(a).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!d||"object"!== | ||
typeof d&&"function"!==typeof d?this:d}l(a,b);m(a,[{key:"_loadData",value:function(a,b){a.loadRange([6,9],{onSuccess:function(){a.loadRange([0,10+a.getSynchsafeInteger32At(6)-1],b)},onError:b.onError})}},{key:"_parseData",value:function(a,b){var d,g=0,f=a.getByteAt(g+3);if(4<f)return{type:"ID3",version:">2.4",tags:{}};var m=a.getByteAt(g+4),r=a.isBitSetAt(g+5,7),n=a.isBitSetAt(g+5,6),x=a.isBitSetAt(g+5,5),l=a.getSynchsafeInteger32At(g+6);g+=10;if(n){var p=a.getLongAt(g,!0);g+=p+4}f={type:"ID3",version:"2."+ | ||
f+"."+m,major:f,revision:m,flags:{unsynchronisation:r,extended_header:n,experimental_indicator:x,footer_present:!1},size:l,tags:{}};b&&(d=this._expandShortcutTags(b));b=l+10;f.flags.unsynchronisation&&(a=e.getUnsyncFileReader(a,g,l),g=0,b=a.getSize());a=e.readFrames(g,b,a,f,d);for(var q in c)c.hasOwnProperty(q)&&(d=this._getFrameData(a,c[q]))&&(f.tags[q]=d);for(var w in a)a.hasOwnProperty(w)&&(f.tags[w]=a[w]);return f}},{key:"_getFrameData",value:function(a,b){for(var d=0,c;c=b[d];d++)if(c in a)return a= | ||
a[c]instanceof Array?a[c][0]:a[c],a.data}},{key:"getShortcuts",value:function(){return c}}],[{key:"getTagIdentifierByteRange",value:function(){return{offset:0,length:10}}},{key:"canReadTagFormat",value:function(a){return"ID3"===String.fromCharCode.apply(String,a.slice(0,3))}}]);return a}(q);var c={title:["TIT2","TT2"],artist:["TPE1","TP1"],album:["TALB","TAL"],year:["TYER","TYE"],comment:["COMM","COM"],track:["TRCK","TRK"],genre:["TCON","TCO"],picture:["APIC","PIC"],lyrics:["USLT","ULT"]};p.exports= | ||
f},{"./ID3v2FrameReader":7,"./MediaFileReader":10,"./MediaTagReader":11}],9:[function(f,p,q){function l(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var m=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable|| | ||
!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}();q=f("./MediaTagReader");f("./MediaFileReader");f=function(a){function d(){if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");var a=Object.getPrototypeOf(d).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a? | ||
this:a}l(d,a);m(d,[{key:"_loadData",value:function(a,b){var c=this;a.loadRange([0,16],{onSuccess:function(){c._loadAtom(a,0,"",b)},onError:b.onError})}},{key:"_loadAtom",value:function(a,b,c,d){if(b>=a.getSize())d.onSuccess();else{var g=this,e=a.getLongAt(b,!0);if(0==e||isNaN(e))d.onSuccess();else{var h=a.getStringAt(b+4,4);if(this._isContainerAtom(h)){"meta"==h&&(b+=4);var f=(c?c+".":"")+h;"moov.udta.meta.ilst"===f?a.loadRange([b,b+e],d):a.loadRange([b+8,b+8+8],{onSuccess:function(){g._loadAtom(a, | ||
b+8,f,d)},onError:d.onError})}else a.loadRange([b+e,b+e+8],{onSuccess:function(){g._loadAtom(a,b+e,c,d)},onError:d.onError})}}}},{key:"_isContainerAtom",value:function(a){return 0<=["moov","udta","meta","ilst"].indexOf(a)}},{key:"_canReadAtom",value:function(a){return"----"!==a}},{key:"_parseData",value:function(a,c){var d={};c=this._expandShortcutTags(c);this._readAtom(d,a,0,a.getSize(),c);for(var e in b)b.hasOwnProperty(e)&&(c=d[b[e]])&&(d[e]="track"===e?c.data.track:c.data);return{type:"MP4",ftyp:a.getStringAt(8, | ||
4),version:a.getLongAt(12,!0),tags:d}}},{key:"_readAtom",value:function(a,b,c,d,e,f,n){n=void 0===n?"":n+" ";for(var g=c;g<c+d;){var h=b.getLongAt(g,!0);if(0==h)break;var k=b.getStringAt(g+4,4);if(this._isContainerAtom(k)){"meta"==k&&(g+=4);this._readAtom(a,b,g+8,h-8,e,(f?f+".":"")+k,n);break}(!e||0<=e.indexOf(k))&&"moov.udta.meta.ilst"===f&&this._canReadAtom(k)&&(a[k]=this._readMetadataAtom(b,g));g+=h}}},{key:"_readMetadataAtom",value:function(a,b){var d=a.getLongAt(b,!0),g=a.getStringAt(b+4,4), | ||
h=a.getInteger24At(b+16+1,!0);h=e[h];if("trkn"==g)var f={track:a.getByteAt(b+16+11),total:a.getByteAt(b+16+13)};else if("disk"==g)f={disk:a.getByteAt(b+16+11),total:a.getByteAt(b+16+13)};else{b+=24;var n=d-24;"covr"===g&&"uint8"===h&&(h="jpeg");switch(h){case "text":f=a.getStringWithCharsetAt(b,n,"utf-8").toString();break;case "uint8":f=a.getShortAt(b,!1);break;case "int":case "uint":f=("int"==h?1==n?a.getSByteAt:2==n?a.getSShortAt:4==n?a.getSLongAt:a.getLongAt:1==n?a.getByteAt:2==n?a.getShortAt: | ||
a.getLongAt).call(a,b+(8==n?4:0),!0);break;case "jpeg":case "png":f={format:"image/"+h,data:a.getBytesAt(b,n)}}}return{id:g,size:d,description:c[g]||"Unknown",data:f}}},{key:"getShortcuts",value:function(){return b}}],[{key:"getTagIdentifierByteRange",value:function(){return{offset:0,length:16}}},{key:"canReadTagFormat",value:function(a){return"ftyp"===String.fromCharCode.apply(String,a.slice(4,8))}}]);return d}(q);var e={0:"uint8",1:"text",13:"jpeg",14:"png",21:"int",22:"uint"},c={"\u00a9alb":"Album", | ||
"\u00a9ART":"Artist",aART:"Album Artist","\u00a9day":"Release Date","\u00a9nam":"Title","\u00a9gen":"Genre",gnre:"Genre",trkn:"Track Number","\u00a9wrt":"Composer","\u00a9too":"Encoding Tool","\u00a9enc":"Encoded By",cprt:"Copyright",covr:"Cover Art","\u00a9grp":"Grouping",keyw:"Keywords","\u00a9lyr":"Lyrics","\u00a9cmt":"Comment",tmpo:"Tempo",cpil:"Compilation",disk:"Disc Number",tvsh:"TV Show Name",tven:"TV Episode ID",tvsn:"TV Season",tves:"TV Episode",tvnn:"TV Network",desc:"Description",ldes:"Long Description", | ||
sonm:"Sort Name",soar:"Sort Artist",soaa:"Sort Album",soco:"Sort Composer",sosn:"Sort Show",purd:"Purchase Date",pcst:"Podcast",purl:"Podcast URL",catg:"Category",hdvd:"HD Video",stik:"Media Type",rtng:"Content Rating",pgap:"Gapless Playback",apID:"Purchase Account",sfID:"Country Code",atID:"Artist ID",cnID:"Catalog ID",plID:"Collection ID",geID:"Genre ID","xid ":"Vendor Information",flvr:"Codec Flavor"},b={title:"\u00a9nam",artist:"\u00a9ART",album:"\u00a9alb",year:"\u00a9day",comment:"\u00a9cmt", | ||
track:"trkn",genre:"\u00a9gen",picture:"covr",lyrics:"\u00a9lyr"};p.exports=f},{"./MediaFileReader":10,"./MediaTagReader":11}],10:[function(f,p,q){var l=function(){function e(c,b){for(var a=0;a<b.length;a++){var d=b[a];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(c,d.key,d)}}return function(c,b,a){b&&e(c.prototype,b);a&&e(c,a);return c}}(),m=f("./StringUtils");f=function(){function e(){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function"); | ||
this._isInitialized=!1;this._size=0}l(e,[{key:"init",value:function(c){var b=this;if(this._isInitialized)setTimeout(c.onSuccess,1);else return this._init({onSuccess:function(){b._isInitialized=!0;c.onSuccess()},onError:c.onError})}},{key:"_init",value:function(c){throw Error("Must implement init function");}},{key:"loadRange",value:function(c,b){throw Error("Must implement loadRange function");}},{key:"getSize",value:function(){if(!this._isInitialized)throw Error("init() must be called first.");return this._size}}, | ||
{key:"getByteAt",value:function(c){throw Error("Must implement getByteAt function");}},{key:"getBytesAt",value:function(c,b){for(var a=Array(b),d=0;d<b;d++)a[d]=this.getByteAt(c+d);return a}},{key:"isBitSetAt",value:function(c,b){return 0!=(this.getByteAt(c)&1<<b)}},{key:"getSByteAt",value:function(c){c=this.getByteAt(c);return 127<c?c-256:c}},{key:"getShortAt",value:function(c,b){c=b?(this.getByteAt(c)<<8)+this.getByteAt(c+1):(this.getByteAt(c+1)<<8)+this.getByteAt(c);0>c&&(c+=65536);return c}}, | ||
{key:"getSShortAt",value:function(c,b){c=this.getShortAt(c,b);return 32767<c?c-65536:c}},{key:"getLongAt",value:function(c,b){var a=this.getByteAt(c),d=this.getByteAt(c+1),e=this.getByteAt(c+2);c=this.getByteAt(c+3);b=b?(((a<<8)+d<<8)+e<<8)+c:(((c<<8)+e<<8)+d<<8)+a;0>b&&(b+=4294967296);return b}},{key:"getSLongAt",value:function(c,b){c=this.getLongAt(c,b);return 2147483647<c?c-4294967296:c}},{key:"getInteger24At",value:function(c,b){var a=this.getByteAt(c),d=this.getByteAt(c+1);c=this.getByteAt(c+ | ||
2);b=b?((a<<8)+d<<8)+c:((c<<8)+d<<8)+a;0>b&&(b+=16777216);return b}},{key:"getStringAt",value:function(c,b){for(var a=[],d=c,e=0;d<c+b;d++,e++)a[e]=String.fromCharCode(this.getByteAt(d));return a.join("")}},{key:"getStringWithCharsetAt",value:function(c,b,a){c=this.getBytesAt(c,b);switch((a||"").toLowerCase()){case "utf-16":case "utf-16le":case "utf-16be":a=m.readUTF16String(c,"utf-16be"===a);break;case "utf-8":a=m.readUTF8String(c);break;default:a=m.readNullTerminatedString(c)}return a}},{key:"getCharAt", | ||
value:function(c){return String.fromCharCode(this.getByteAt(c))}},{key:"getSynchsafeInteger32At",value:function(c){var b=this.getByteAt(c),a=this.getByteAt(c+1),d=this.getByteAt(c+2);return this.getByteAt(c+3)&127|(d&127)<<7|(a&127)<<14|(b&127)<<21}}],[{key:"canReadFile",value:function(c){throw Error("Must implement canReadFile function");}}]);return e}();p.exports=f},{"./StringUtils":12}],11:[function(f,p,q){var l=function(){function f(e,c){for(var b=0;b<c.length;b++){var a=c[b];a.enumerable=a.enumerable|| | ||
!1;a.configurable=!0;"value"in a&&(a.writable=!0);Object.defineProperty(e,a.key,a)}}return function(e,c,b){c&&f(e.prototype,c);b&&f(e,b);return e}}();f("./MediaFileReader");f=function(){function f(e){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");this._mediaFileReader=e;this._tags=null}l(f,[{key:"setTagsToRead",value:function(e){this._tags=e;return this}},{key:"read",value:function(e){var c=this;this._mediaFileReader.init({onSuccess:function(){c._loadData(c._mediaFileReader, | ||
{onSuccess:function(){try{var b=c._parseData(c._mediaFileReader,c._tags)}catch(a){if(e.onError){e.onError({type:"parseData",info:a.message});return}}e.onSuccess(b)},onError:e.onError})},onError:e.onError})}},{key:"getShortcuts",value:function(){return{}}},{key:"_loadData",value:function(e,c){throw Error("Must implement _loadData function");}},{key:"_parseData",value:function(e,c){throw Error("Must implement _parseData function");}},{key:"_expandShortcutTags",value:function(e){if(!e)return null;for(var c= | ||
[],b=this.getShortcuts(),a=0,d;d=e[a];a++)c=c.concat(b[d]||[d]);return c}}],[{key:"getTagIdentifierByteRange",value:function(){throw Error("Must implement");}},{key:"canReadTagFormat",value:function(e){throw Error("Must implement");}}]);return f}();p.exports=f},{"./MediaFileReader":10}],12:[function(f,p,q){var l=function(){function e(c,b){for(var a=0;a<b.length;a++){var d=b[a];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(c,d.key,d)}}return function(c, | ||
b,a){b&&e(c.prototype,b);a&&e(c,a);return c}}(),m=function(){function e(c,b){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this._value=c;this.bytesReadCount=b;this.length=c.length}l(e,[{key:"toString",value:function(){return this._value}}]);return e}();p.exports={readUTF16String:function(e,c,b){var a=0,d=1,g=0;b=Math.min(b||e.length,e.length);254==e[0]&&255==e[1]?(c=!0,a=2):255==e[0]&&254==e[1]&&(c=!1,a=2);c&&(d=0,g=1);c=[];for(var h=0;a<b;h++){var f=e[a+d],l=(f<< | ||
8)+e[a+g];a+=2;if(0==l)break;else 216>f||224<=f?c[h]=String.fromCharCode(l):(f=(e[a+d]<<8)+e[a+g],a+=2,c[h]=String.fromCharCode(l,f))}return new m(c.join(""),a)},readUTF8String:function(e,c){var b=0;c=Math.min(c||e.length,e.length);239==e[0]&&187==e[1]&&191==e[2]&&(b=3);for(var a=[],d=0;b<c;d++){var g=e[b++];if(0==g)break;else if(128>g)a[d]=String.fromCharCode(g);else if(194<=g&&224>g){var f=e[b++];a[d]=String.fromCharCode(((g&31)<<6)+(f&63))}else if(224<=g&&240>g){f=e[b++];var k=e[b++];a[d]=String.fromCharCode(((g& | ||
255)<<12)+((f&63)<<6)+(k&63))}else if(240<=g&&245>g){f=e[b++];k=e[b++];var l=e[b++];k=((g&7)<<18)+((f&63)<<12)+((k&63)<<6)+(l&63)-65536;a[d]=String.fromCharCode((k>>10)+55296,(k&1023)+56320)}}return new m(a.join(""),b)},readNullTerminatedString:function(e,c){var b=[];c=c||e.length;for(var a=0;a<c;){var d=e[a++];if(0==d)break;b[a-1]=String.fromCharCode(d)}return new m(b.join(""),a)}}},{}],13:[function(f,p,q){function l(c,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+ | ||
typeof b);c.prototype=Object.create(b&&b.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(c,b):c.__proto__=b)}var m=function(){function c(b,a){for(var c=0;c<a.length;c++){var e=a[c];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(b,e.key,e)}}return function(b,a,d){a&&c(b.prototype,a);d&&c(b,d);return b}}(),e=f("./ChunkedFileData");q=function(c){function b(a){if(!(this instanceof | ||
b))throw new TypeError("Cannot call a class as a function");var c=Object.getPrototypeOf(b).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");c=!c||"object"!==typeof c&&"function"!==typeof c?this:c;c._url=a;c._fileData=new e;return c}l(b,c);m(b,[{key:"_init",value:function(a){b._config.avoidHeadRequests?this._fetchSizeWithGetRequest(a):this._fetchSizeWithHeadRequest(a)}},{key:"_fetchSizeWithHeadRequest",value:function(a){var b=this;this._makeXHRRequest("HEAD", | ||
null,{onSuccess:function(c){(c=b._parseContentLength(c))?(b._size=c,a.onSuccess()):b._fetchSizeWithGetRequest(a)},onError:a.onError})}},{key:"_fetchSizeWithGetRequest",value:function(a){var b=this,c=this._roundRangeToChunkMultiple([0,0]);this._makeXHRRequest("GET",c,{onSuccess:function(c){var d=b._parseContentRange(c);c=b._getXhrResponseContent(c);if(d){if(null==d.instanceLength){b._fetchEntireFile(a);return}b._size=d.instanceLength}else b._size=c.length;b._fileData.addData(0,c);a.onSuccess()},onError:a.onError})}}, | ||
{key:"_fetchEntireFile",value:function(a){var b=this;this._makeXHRRequest("GET",null,{onSuccess:function(c){c=b._getXhrResponseContent(c);b._size=c.length;b._fileData.addData(0,c);a.onSuccess()},onError:a.onError})}},{key:"_getXhrResponseContent",value:function(a){return a.responseBody||a.responseText||""}},{key:"_parseContentLength",value:function(a){a=this._getResponseHeader(a,"Content-Length");return null==a?a:parseInt(a,10)}},{key:"_parseContentRange",value:function(a){if(a=this._getResponseHeader(a, | ||
"Content-Range")){var b=a.match(/bytes (\d+)-(\d+)\/(?:(\d+)|\*)/i);if(!b)throw Error("FIXME: Unknown Content-Range syntax: ",a);return{firstBytePosition:parseInt(b[1],10),lastBytePosition:parseInt(b[2],10),instanceLength:b[3]?parseInt(b[3],10):null}}return null}},{key:"loadRange",value:function(a,b){var c=this;c._fileData.hasDataRange(a[0],Math.min(c._size,a[1]))?setTimeout(b.onSuccess,1):(a=this._roundRangeToChunkMultiple(a),a[1]=Math.min(c._size,a[1]),this._makeXHRRequest("GET",a,{onSuccess:function(d){d= | ||
c._getXhrResponseContent(d);c._fileData.addData(a[0],d);b.onSuccess()},onError:b.onError}))}},{key:"_roundRangeToChunkMultiple",value:function(a){return[a[0],a[0]+1024*Math.ceil((a[1]-a[0]+1)/1024)-1]}},{key:"_makeXHRRequest",value:function(a,c,e){var d=this._createXHRObject(),f=function(){if(200===d.status||206===d.status)e.onSuccess(d);else if(e.onError)e.onError({type:"xhr",info:"Unexpected HTTP status "+d.status+".",xhr:d});d=null};"undefined"!==typeof d.onload?(d.onload=f,d.onerror=function(){if(e.onError)e.onError({type:"xhr", | ||
info:"Generic XHR error, check xhr object.",xhr:d})}):d.onreadystatechange=function(){4===d.readyState&&f()};b._config.timeoutInSec&&(d.timeout=1E3*b._config.timeoutInSec,d.ontimeout=function(){if(e.onError)e.onError({type:"xhr",info:"Timeout after "+d.timeout/1E3+"s. Use jsmediatags.Config.setXhrTimeout to override.",xhr:d})});d.open(a,this._url);d.overrideMimeType("text/plain; charset=x-user-defined");c&&this._setRequestHeader(d,"Range","bytes="+c[0]+"-"+c[1]);this._setRequestHeader(d,"If-Modified-Since", | ||
"Sat, 01 Jan 1970 00:00:00 GMT");d.send(null)}},{key:"_setRequestHeader",value:function(a,c,e){0>b._config.disallowedXhrHeaders.indexOf(c.toLowerCase())&&a.setRequestHeader(c,e)}},{key:"_hasResponseHeader",value:function(a,b){a=a.getAllResponseHeaders();if(!a)return!1;a=a.split("\r\n");for(var c=[],d=0;d<a.length;d++)c[d]=a[d].split(":")[0].toLowerCase();return 0<=c.indexOf(b.toLowerCase())}},{key:"_getResponseHeader",value:function(a,b){return this._hasResponseHeader(a,b)?a.getResponseHeader(b): | ||
null}},{key:"getByteAt",value:function(a){return this._fileData.getByteAt(a).charCodeAt(0)&255}},{key:"_isWebWorker",value:function(){return"undefined"!==typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope}},{key:"_createXHRObject",value:function(){if("undefined"===typeof window&&!this._isWebWorker())return new (f("xhr2").XMLHttpRequest);if("undefined"!==typeof XMLHttpRequest)return new XMLHttpRequest;throw Error("XMLHttpRequest is not supported");}}],[{key:"canReadFile",value:function(a){return"string"=== | ||
typeof a&&/^[a-z]+:\/\//i.test(a)}},{key:"setConfig",value:function(a){for(var b in a)a.hasOwnProperty(b)&&(this._config[b]=a[b]);a=this._config.disallowedXhrHeaders;for(b=0;b<a.length;b++)a[b]=a[b].toLowerCase()}}]);return b}(f("./MediaFileReader"));q._config={avoidHeadRequests:!1,disallowedXhrHeaders:[],timeoutInSec:30};p.exports=q},{"./ChunkedFileData":5,"./MediaFileReader":10,xhr2:2}],14:[function(f,p,q){function l(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function"); | ||
}function m(a,b){var c=0>a.offset&&(-a.offset>b||0<a.offset+a.length);return!(0<=a.offset&&a.offset+a.length>=b||c)}var e=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}();f("./MediaFileReader");q=f("./NodeFileReader");var c=f("./XhrFileReader"),b=f("./BlobFileReader"),a=f("./ArrayFileReader");f("./MediaTagReader"); | ||
var d=f("./ID3v1TagReader"),g=f("./ID3v2TagReader");f=f("./MP4TagReader");var h=[],k=[],t=function(){function a(b){l(this,a);this._file=b}e(a,[{key:"setTagsToRead",value:function(a){this._tagsToRead=a;return this}},{key:"setFileReader",value:function(a){this._fileReader=a;return this}},{key:"setTagReader",value:function(a){this._tagReader=a;return this}},{key:"read",value:function(a){var b=new (this._getFileReader())(this._file),c=this;b.init({onSuccess:function(){c._getTagReader(b,{onSuccess:function(d){(new d(b)).setTagsToRead(c._tagsToRead).read(a)}, | ||
onError:a.onError})},onError:a.onError})}},{key:"_getFileReader",value:function(){return this._fileReader?this._fileReader:this._findFileReader()}},{key:"_findFileReader",value:function(){for(var a=0;a<h.length;a++)if(h[a].canReadFile(this._file))return h[a];throw Error("No suitable file reader found for ",this._file);}},{key:"_getTagReader",value:function(a,b){if(this._tagReader){var c=this._tagReader;setTimeout(function(){b.onSuccess(c)},1)}else this._findTagReader(a,b)}},{key:"_findTagReader", | ||
value:function(a,b){for(var c=[],d=[],e=a.getSize(),f=0;f<k.length;f++){var g=k[f].getTagIdentifierByteRange();m(g,e)&&(0<=g.offset&&g.offset<e/2||0>g.offset&&g.offset<-e/2?c.push(k[f]):d.push(k[f]))}var h=!1;f={onSuccess:function(){if(h){for(var c=0;c<k.length;c++){var d=k[c].getTagIdentifierByteRange();if(m(d,e)){try{var f=a.getBytesAt(0<=d.offset?d.offset:d.offset+e,d.length)}catch(y){if(b.onError){b.onError({type:"fileReader",info:y.message});return}}if(k[c].canReadTagFormat(f)){b.onSuccess(k[c]); | ||
return}}}if(b.onError)b.onError({type:"tagFormat",info:"No suitable tag reader found"})}else h=!0},onError:b.onError};this._loadTagIdentifierRanges(a,c,f);this._loadTagIdentifierRanges(a,d,f)}},{key:"_loadTagIdentifierRanges",value:function(a,b,c){if(0===b.length)setTimeout(c.onSuccess,1);else{for(var d=[Number.MAX_VALUE,0],e=a.getSize(),f=0;f<b.length;f++){var g=b[f].getTagIdentifierByteRange(),h=0<=g.offset?g.offset:g.offset+e;g=h+g.length-1;d[0]=Math.min(h,d[0]);d[1]=Math.max(g,d[1])}a.loadRange(d, | ||
c)}}}]);return a}(),u=function(){function a(){l(this,a)}e(a,null,[{key:"addFileReader",value:function(b){h.push(b);return a}},{key:"addTagReader",value:function(b){k.push(b);return a}},{key:"removeTagReader",value:function(b){b=k.indexOf(b);0<=b&&k.splice(b,1);return a}},{key:"EXPERIMENTAL_avoidHeadRequests",value:function(){c.setConfig({avoidHeadRequests:!0})}},{key:"setDisallowedXhrHeaders",value:function(a){c.setConfig({disallowedXhrHeaders:a})}},{key:"setXhrTimeoutInSec",value:function(a){c.setConfig({timeoutInSec:a})}}]); | ||
return a}();u.addFileReader(c).addFileReader(b).addFileReader(a).addTagReader(g).addTagReader(d).addTagReader(f);"undefined"===typeof process||process.browser||u.addFileReader(q);p.exports={read:function(a,b){(new t(a)).read(b)},Reader:t,Config:u}},{"./ArrayFileReader":3,"./BlobFileReader":4,"./ID3v1TagReader":6,"./ID3v2TagReader":8,"./MP4TagReader":9,"./MediaFileReader":10,"./MediaTagReader":11,"./NodeFileReader":1,"./XhrFileReader":13}]},{},[14])(14)}); |
{ | ||
"name": "jsmediatags", | ||
"version": "3.6.2", | ||
"version": "3.7.0", | ||
"description": "Media Tags Reader (ID3, MP4)", | ||
@@ -39,3 +39,3 @@ "author": { | ||
"dependencies": { | ||
"xhr2": "~0.1.3" | ||
"xhr2": "^0.1.4" | ||
}, | ||
@@ -52,6 +52,6 @@ "devDependencies": { | ||
"jest-cli": "~12.0.2", | ||
"browserify": "~13.0.0", | ||
"browserify": "~14.4.0", | ||
"watchify": "~3.7.0", | ||
"babelify": "~7.3.0", | ||
"google-closure-compiler": "20160315.2.0" | ||
"google-closure-compiler": "20170626.0.0" | ||
}, | ||
@@ -58,0 +58,0 @@ "scripts": { |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
238893
4947
Updatedxhr2@^0.1.4