You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
58 KiB
JavaScript
1 line
58 KiB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.MediaTag=t():e.MediaTag=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=63)}([function(e,t,n){"use strict";var r={IMAGE:"image",AUDIO:"audio",VIDEO:"video",PDF:"pdf",DASH:"dash",DOWNLOAD:"download",CRYPTO:"crypto",CLEAR_KEY:"clear-key",MEDIA_OBJECT:"media-object"};e.exports=r},function(e,t,n){"use strict";var r={MATCHER:"matcher",RENDERER:"renderer",FILTER:"filter",SANITIZER:"sanitizer"};e.exports=r},function(e,t,n){"use strict";function r(e){if(e instanceof Array){var t=[];return e.forEach(function(e){if(e.mediaObject)t.push(e.mediaObject);else{new c(e,r.processingEngine).mediaObjects.forEach(function(e){t.push(r.processingEngine.start(e))})}}),t}new c(e,r.processingEngine).mediaObjects.forEach(function(e){r.processingEngine.start(e)})}var o=n(31),i=n(33),u=n(34),a=n(35),c=n(36);r.pluginStore=r.pluginStore||new u,r.uriStore=r.uriStore||new a("../plugins"),r.processingEngine=r.processingEngine||new o(r.pluginStore),r.matchingEngine=r.matchingEngine||new i(r.pluginStore,r.uriStore),r.loadingEngine=null,e.exports=r},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(1),c=n(5),s=n(6),f=function(e){function t(e,n){r(this,t);var i=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,a.MATCHER,c.ANY));return i.targetType=n,i}return i(t,e),u(t,[{key:"getTargetType",value:function(){return this.targetType}}]),t}(s);e.exports=f},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=n(1),a=n(5),c=n(6),s=function(e){function t(e){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,u.RENDERER,a.ONCE))}return i(t,e),t}(c);e.exports=s},function(e,t,n){"use strict";var r={EVERY:"every",ANY:"any",ONCE:"once"};e.exports=r},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(t,n,o){r(this,e),this.identifier=t,this.type=n,this.occurrence=o}return o(e,[{key:"getIdentifier",value:function(){if(this.identifier)return this.identifier;throw new Error("Plugin has not identifier")}},{key:"getType",value:function(){if(this.type)return this.type;throw new Error("Plugin has no type")}},{key:"start",value:function(e){return this.process(e)}}]),e}();e.exports=i},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(11),c=n(0),s=n(8),f=function(e){function t(){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,c.CRYPTO))}return i(t,e),u(t,[{key:"process",value:function(e){var n=e.getAttribute("data-crypto-key"),r=/\w+:/.exec(n);if(null===r)throw new Error("No algorithm scheme found in data-crypto-key");var o=r[0],i=o.replace(":",""),u=n.replace(o,"");if(e.setAttribute("data-crypto-key",u),!t.functionStore.isStored(i))throw new Error("Algorithm "+i+" is not registered");t.functionStore.get(i)(e)}}]),t}(a);f.functionStore=f.functionStore||new s,f.mediaTypes=[],f.setAllowedMediaTypes=function(e){f.mediaTypes=e},f.getAllowedMediaTypes=function(){return f.mediaTypes},f.addAllowedMediaType=function(e){f.mediaTypes.push(e)},f.addAllAllowedMediaTypes=function(e){e.forEach(function(e){f.addAllowedMediaType(e)})},f.removeAllowedMediaType=function(e){var t=f.mediaTypes.indexOf(e);t>=0&&f.mediaTypes.splice(t,1)},f.removeAllAllowedMediaTypes=function(e){e.forEach(function(e){f.removeAllowedMediaType(e)})},f.isAllowedMediaType=function(e){return f.mediaTypes.some(function(t){return t===e})},e.exports=f},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(){r(this,e),this.map={}}return o(e,[{key:"isStored",value:function(e){return!!this.get(e)}},{key:"store",value:function(e,t){this.isStored(e)&&console.warn('The key "'+e+'" is already registered, the content will be overwritten.'),this.map[e]=t}},{key:"unstore",value:function(e){if(!1!==this.isStored(e)){var t=this.map[e];return delete this.map[e],t}console.warn('The key "'+e+'" not exists in this manager')}},{key:"get",value:function(e){return this.map[e]}},{key:"keys",value:function(){return Object.keys(this.map)}},{key:"values",value:function(){var e=this;return this.keys().map(function(t){return e.get(t)})}}]),e}();e.exports=i},function(e,t,n){"use strict";var r=n(16),o=n(15);e.exports=function(e,t){t.mediaObjects.forEach(function(e){r(e)}),t.activeMediaObject=e,o(e)}},,function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=n(1),a=n(5),c=n(6),s=function(e){function t(e){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,u.FILTER,a.ANY))}return i(t,e),t}(c);e.exports=s},,function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(t){r(this,e),this.truth=t}return o(e,[{key:"is",value:function(e){if(this.truth===e)return this;throw new Error("Assertion fail on : "+this.truth+" is "+e)}},{key:"not",value:function(e){if(this.truth!==e)return this;throw new Error("Assertion fail on : "+this.truth+" is not "+e)}}],[{key:"that",value:function(t){return new e(t)}}]),e}();e.exports=i},function(e,t,n){"use strict";var r={ALLOWED:0,REQUIRED:1,FORBIDDEN:2};e.exports=r},function(e,t,n){"use strict";e.exports=function(e){e.element.style.display="block";var t=!0,n=!1,r=void 0;try{for(var o,i=e.hookedFns.children()[Symbol.iterator]();!(t=(o=i.next()).done);t=!0){o.value.style.display="block"}}catch(e){n=!0,r=e}finally{try{!t&&i.return&&i.return()}finally{if(n)throw r}}}},function(e,t,n){"use strict";e.exports=function(e){e.element.style.display="none";var t=!0,n=!1,r=void 0;try{for(var o,i=e.hookedFns.children()[Symbol.iterator]();!(t=(o=i.next()).done);t=!0){o.value.style.display="none"}}catch(e){n=!0,r=e}finally{try{!t&&i.return&&i.return()}finally{if(n)throw r}}}},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(t){var n=this;r(this,e),Object.keys(t.attributes).forEach(function(e){n[t.attributes[e].name]=t.attributes[e].value})}return o(e,[{key:"getAttribute",value:function(e){return this[e]}},{key:"setAttribute",value:function(e,t){this[e]=t}},{key:"removeAttribute",value:function(e){delete this[e]}},{key:"hasAttributes",value:function(){return Object.keys(this)>0}}]),e}();e.exports=i},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u={PluginExists:function(e){function t(e){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,'Plugin with same "'+e.identifier+'" identifier found.'))}return i(t,e),t}(Error),TypeNotFound:function(e){function t(){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"Media Tag could not find the content type of an instance.}."))}return i(t,e),t}(Error),FilterExists:function(e){function t(e){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,'Filter with same "'+e.identifier+' identifier found."'))}return i(t,e),t}(Error),FetchFail:function(e){function t(e){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,'Could not fetch "'+e.url+'", received "'+e.status+": "+e.statusText+'".'))}return i(t,e),t}(Error),InvalidCryptoKey:function(e){function t(){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"Invalid cryptographic key."))}return i(t,e),t}(Error),InvalidCryptoLib:function(e){function t(){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"Invalid cryptographic algorithm name."))}return i(t,e),t}(Error),FailedCrypto:function(e){function t(e){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"Failed to decrypt file"+(e&&e.message?" "+e.message:"")+"."))}return i(t,e),t}(Error)};e.exports=u},function(e,t,n){"use strict";var r=n(21),o=n(43),i=n(44),u=n(45),a=n(46),c=n(47),s=n(48),f=n(7),l=n(49),p=n(50);r.pluginStore.store(new o),r.pluginStore.store(new i),r.pluginStore.store(new u),r.pluginStore.store(new a),r.pluginStore.store(new c),r.pluginStore.store(new s),r.pluginStore.store(new f),r.pluginStore.store(new l),r.pluginStore.store(new p);var y=n(51),h=n(52);f.functionStore.store("salsa20poly1305",y),f.functionStore.store("cryptpad",h);var b=new s("<p> MediaTag cannot find a plugin able to renderer your content </p>","Download");r.processingEngine.setDefaultPlugin(b),r.CryptoFilter=f;var d=["image/png","image/jpeg","image/jpg","image/gif","audio/mp3","audio/ogg","audio/wav","audio/webm","video/mp4","video/ogg","video/webm","application/pdf","application/dash+xml","download"];r.CryptoFilter.setAllowedMediaTypes(d);var v=n(53),g=(n(14),n(0),new v);r.PdfPlugin=a,r.PdfPlugin.viewer="/pdfjs/web/viewer.html",r.processingEngine.configure(g),e.exports=r},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=n(1),a=n(5),c=n(6),s=function(e){function t(e){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,u.SANITIZER,a.EVERY))}return i(t,e),t}(c);e.exports=s},function(e,t,n){"use strict";var r=n(22),o=n(23),i=n(24),u=n(25),a=n(26),c=n(27),s=n(28),f=n(29),l=n(30),p=n(2);p.pluginStore.store(new r),p.pluginStore.store(new o),p.pluginStore.store(new i),p.pluginStore.store(new u),p.pluginStore.store(new a),p.pluginStore.store(new c),p.pluginStore.store(new s),p.pluginStore.store(new f),p.pluginStore.store(new l),e.exports=p},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(0),c=n(1),s=n(3),f=function(e){function t(){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,a.IMAGE,c.RENDERER))}return i(t,e),u(t,[{key:"process",value:function(e){var t=/^png|jpg|jpeg|gif|svg[+]xml$/,n=/^image[\/](png|jpeg|gif|svg[+]xml)$/;return e.hasAttribute("src")&&"image"===e.getType()&&null!==t.exec(e.getExtension())&&null!==n.exec(e.getMimeType())}}]),t}(s);e.exports=f},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(0),c=n(1),s=n(3),f=function(e){function t(){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,a.AUDIO,c.RENDERER))}return i(t,e),u(t,[{key:"process",value:function(e){var t=/^mp3|ogg|webm|wav|mpeg$/,n=/^audio[\/](mp3|ogg|webm|wav|mpeg)$/;return e.hasAttribute("src")&&"audio"===e.getType()&&null!==t.exec(e.getExtension())&&null!==n.exec(e.getMimeType())}}]),t}(s);e.exports=f},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(0),c=n(1),s=n(3),f=function(e){function t(){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,a.VIDEO,c.RENDERER))}return i(t,e),u(t,[{key:"process",value:function(e){var t=/^mp4|ogg|webm$/,n=/^video[\/](mp4|ogg|webm)$/;return e.hasAttribute("src")&&"video"===e.getType()&&null!==t.exec(e.getExtension())&&null!==n.exec(e.getMimeType())}}]),t}(s);e.exports=f},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(0),c=n(1),s=n(3),f=function(e){function t(){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,a.PDF,c.RENDERER))}return i(t,e),u(t,[{key:"process",value:function(e){var t=/^pdf$/,n=/^application[\/]pdf$/;return e.hasAttribute("src")&&"application"===e.getType()&&null!==t.exec(e.getExtension())&&null!==n.exec(e.getMimeType())}}]),t}(s);e.exports=f},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(0),c=n(1),s=n(3),f=function(e){function t(){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,a.DASH,c.RENDERER))}return i(t,e),u(t,[{key:"process",value:function(e){var t=/^dash[+]xml$/,n=/^application[\/]dash[+]xml$/;return e.hasAttribute("src")&&"application"===e.getType()&&null!==t.exec(e.getExtension())&&null!==n.exec(e.getMimeType())}}]),t}(s);e.exports=f},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(0),c=n(1),s=n(3),f=function(e){function t(){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,a.DOWNLOAD,c.RENDERER))}return i(t,e),u(t,[{key:"process",value:function(e){return e.hasAttribute("src")&&"download"===e.getType()}}]),t}(s);e.exports=f},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(0),c=n(1),s=n(3),f=function(e){function t(){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,a.CRYPTO,c.FILTER))}return i(t,e),u(t,[{key:"process",value:function(e){return e.hasAttribute("data-crypto-key")}}]),t}(s);e.exports=f},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(0),c=n(1),s=n(3),f=function(e){function t(){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,a.CLEAR_KEY,c.FILTER))}return i(t,e),u(t,[{key:"process",value:function(e){return e.hasAttribute("data-clear-key")}}]),t}(s);e.exports=f},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(0),c=n(1),s=n(3),f=function(e){function t(){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,a.MEDIA_OBJECT,c.SANITIZER))}return i(t,e),u(t,[{key:"process",value:function(e){return e.hasAttribute("src")&&e.hasAttribute("data-type")}}]),t}(s);e.exports=f},function(e,t,n){"use strict";function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var i=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(13),a=n(1),c=n(32),s=n(14),f=function(){function e(t){o(this,e),u.that(t).not(void 0),this.pluginStore=t,this.stacks={},this.snapshots={},this.stats=[],this.defaultPlugin=null}return i(e,[{key:"configure",value:function(e){this.configuration=e}},{key:"start",value:function(e){e.state="processing",this.routine(e),this.run(e)}},{key:"run",value:function(e){var t=this.stackTop(e);if(!t)return e.state="processed",e;if(this.configuration)if(this.configuration.getPermission(t.identifier)===s.FORBIDDEN){var n=this.stats[e.getId()];n.skipped||(n.skipped=[]),n.skipped.push(t.identifier),this.return(e)}else t.process(e);else t.process(e)}},{key:"routine",value:function(e){this.fill(e),this.snapshot(e),this.check(e)}},{key:"snapshot",value:function(e){var t=e.getId();if(this.stacks[t]){var n=[];this.stacks[t].forEach(function(e){var t={};t.identifier=e.getIdentifier(),t.type=e.getType(),n.push(t)}),this.snapshots[t]?this.snapshots[t].push({stack:n}):this.snapshots[t]=[{stack:n}]}else this.snapshots[t]=[]}},{key:"fill",value:function(e){var t=e.getId(),n=this.pluginStore.getPlugins(a.MATCHER),o=n.filter(function(t){return t.process(e)}),i=o.map(function(e){return e.getIdentifier()}),u=this.pluginStore.values(),s=u.filter(function(e){return e.type!==a.MATCHER&&i.includes(e.identifier)}),f=c.filterByOccurrencies(s),l=this.substack(e,f);if(this.stacks[t]){var p;(p=this.stacks[t]).push.apply(p,r(l))}else this.stacks[t]=l}},{key:"substack",value:function(e,t){var n=this,r=[];return t.once.forEach(function(t){n.configuration&&n.configuration.getPermission(t.identifier)===s.FORBIDDEN?n.skip(e,t):n.isStacked(e,t)||r.push(t)}),t.any.forEach(function(t){n.configuration&&n.configuration.getPermission(t.identifier)===s.FORBIDDEN?n.skip(e,t):n.isStacked(e,t)||r.push(t)}),t.every.forEach(function(t){n.configuration&&n.configuration.getPermission(t.identifier)===s.FORBIDDEN?n.skip(e,t):r.push(t)}),r}},{key:"skip",value:function(e,t){var n=this.stats[e.getId()];n?n.skipped||(n.skipped=[]):n={skipped:[]},n.skipped.push(t.identifier)}},{key:"unstack",value:function(e){var t=e.getId();return this.stacks[t]?this.stacks[t].pop():null}},{key:"stackTop",value:function(e){var t=e.getId();return this.stacks[t]?this.stacks[t][this.stacks[t].length-1]:null}},{key:"check",value:function(t){var n=t.getId();if(this.stacks[n].length>=e.STACK_LIMIT)throw console.error(this.snapshots[n]),new Error("Plugin stack size exceed");if(this.snapshots[n].length>=e.SNAPSHOT_LIMIT)throw console.error(this.snapshots[n]),new Error("Plugin snapshots size exceed");var r=0;if(this.stacks[n].forEach(function(e){e.type===a.RENDERER&&r++}),r>1)throw console.error(this.snapshots[n]),new Error("More of one renderer in the stack");if(0===this.stacks[n].length&&!this.stats[n][a.RENDERER]){if(!this.defaultPlugin)throw new Error("No default plugin assignated");this.stacks[n].unshift(this.defaultPlugin)}}},{key:"return",value:function(e){var t=e.getId(),n=this.unstack(e);if(n){try{this.stats[t]||(this.stats[t]={}),this.stats[t][n.type]?this.stats[t][n.type]+=1:this.stats[t][n.type]=1}catch(e){console.error(e,this.snapshots[t])}0===this.stacks[t].length&&n.type===a.RENDERER?this.run(e):n.type!==a.SANITIZER&&this.fill(e),this.snapshot(e),this.check(e),this.run(e)}}},{key:"process",value:function(e){var t=e.getId(),n=this.stacks[t].length,r=this.stacks[t][n-1];if(!r)throw console.log(this.stacks),new Error("Impossible to run a undefined plugin");r.process(e)}},{key:"isStacked",value:function(e,t){var n=e.getId();return!(!this.stacks[n]||!this.stacks[n].includes(t))}},{key:"setDefaultPlugin",value:function(e){this.defaultPlugin=e}}]),e}();f.STACK_LIMIT=100,f.SNAPSHOT_LIMIT=100,e.exports=f},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(){r(this,e)}return o(e,null,[{key:"filterByOccurrence",value:function(e,t){return e.filter(function(e){return e.occurrence===t})}},{key:"filterByOccurrencies",value:function(e){var t={once:[],any:[],every:[]},n=!0,r=!1,o=void 0;try{for(var i,u=e[Symbol.iterator]();!(n=(i=u.next()).done);n=!0){var a=i.value;t[a.occurrence]?t[a.occurrence].push(a):t[a.occurrence]=Array.of(a)}}catch(e){r=!0,o=e}finally{try{!n&&u.return&&u.return()}finally{if(r)throw o}}return t}}]),e}();e.exports=i},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(13),u=n(1),a=function(){function e(t,n){r(this,e),i.that(t).not(void 0),i.that(n).not(void 0),this.pluginStore=t,this.uriStore=n}return o(e,[{key:"start",value:function(e){var t=this,n=this.pluginStore.getPlugins(u.MATCHER),r=n.filter(function(t){return t.process(e)}),o=r.map(function(e){return e.getIdentifier()}),i={};return o.forEach(function(e){if(!t.uriStore)throw new Error("No map registrated for the matching engine");var n=t.uriStore.get(e);if(void 0===n)throw new Error("No uri related to identifier : "+e);i[e]=n}),i}}]),e}();e.exports=a},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function e(t,n,r){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,n);if(void 0===o){var i=Object.getPrototypeOf(t);return null===i?void 0:e(i,n,r)}if("value"in o)return o.value;var u=o.get;if(void 0!==u)return u.call(r)},c=n(8),s=function(e){function t(){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),u(t,[{key:"getPlugins",value:function(e){return this.values().filter(function(t){return t.type===e})}},{key:"store",value:function(e){a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"store",this).call(this,[e.identifier,e.type],e)}},{key:"unstore",value:function(e){if(!1!==t.isStored([e.identifier,e.type]))return a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"unstore",this).call(this,[e.identifier,e.type]);console.warn('The key "'+[e.identifier,e.type]+'" not exists in this manager')}}]),t}(c);e.exports=s},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function e(t,n,r){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,n);if(void 0===o){var i=Object.getPrototypeOf(t);return null===i?void 0:e(i,n,r)}if("value"in o)return o.value;var u=o.get;if(void 0!==u)return u.call(r)},c=n(8),s=function(e){function t(e){r(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.targetDirectory=e,n}return i(t,e),u(t,[{key:"store",value:function(e,n){var r=this.targetDirectory+"/"+n+"s/"+e;a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"store",this).call(this,e,r)}},{key:"unstore",value:function(e){return a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"unstore",this).call(this,e)}}]),t}(c);e.exports=s},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(37),u=n(17),a=n(41),c=function(){function e(t,n){var o=this;r(this,e),this.mediaTagElement=t,this.processingEngine=n;var c=new u(t),s=c.getAttribute("sources")||c.getAttribute("srcs");if(s){var f=this.extractSourceObjects(s),l=this.extractMediaElements(f);this.mediaElements=l,this.mediaElements.forEach(function(e){o.mediaTagElement.appendChild(e)}),this.mediaObjects=this.createMediaObjects(l),i.activate(this.mediaObjects[0],this)}else{var p=new a(t);this.mediaObjects=[p],this.activeMediaObject=this.mediaObjects[0]}}return o(e,[{key:"extractSourceObjects",value:function(e){return JSON.parse(e)}},{key:"extractMediaElements",value:function(e){var t=this,n=[];return e.forEach(function(e){n.push(t.extractMediaElement(e))}),n}},{key:"extractMediaElement",value:function(e){var t=document.createElement("media");return Object.keys(e).forEach(function(n){t.setAttribute(n,e[n])}),t}},{key:"createMediaObjects",value:function(e){var t=[];return e.forEach(function(e){var n=new a(e);t.push(n)}),t}}]),e}();e.exports=c},function(e,t,n){"use strict";var r={clear:n(38),show:n(15),hide:n(16),upgrade:n(39),downgrade:n(40),activate:n(9)};e.exports=r},function(e,t,n){"use strict";e.exports=function(e){e.clearContents()}},function(e,t,n){"use strict";var r=n(9);e.exports=function(e){var t=e.mediaObjects.indexOf(e.activeMediaObject);t<e.mediaObjects.length&&r(e.mediaObjects[t+1],e)}},function(e,t,n){"use strict";var r=n(9);e.exports=function(e){var t=e.mediaObjects.indexOf(e.activeMediaObject);t>0&&r(e.mediaObjects[t-1],e)}},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(17),u=n(42),a=function(){function e(t){r(this,e),this.id=e.uid(),this.element=t,this.state="idle",this.attributesObject=new i(t);var n=u.parse(this.attributesObject),o=!0,a=!1,c=void 0;try{for(var s,f=Object.keys(n)[Symbol.iterator]();!(o=(s=f.next()).done);o=!0){var l=s.value;this[l]=n[l]}}catch(e){a=!0,c=e}finally{try{!o&&f.return&&f.return()}finally{if(a)throw c}}this.hookedFns={hasChildNodes:t.hasChildNodes.bind(t),removeChild:t.removeChild.bind(t),getLastChild:function(){return t.lastChild},appendChild:t.appendChild.bind(t),children:function(){return t.children}}}return o(e,[{key:"setProperties",value:function(e){for(var t in e){if(this[t])throw new Error("The property "+t+" already exists in this MediaObject !");this[t]=e[t]}}},{key:"getId",value:function(){return this.id}},{key:"getAttribute",value:function(e){return this.attributesObject[e]}},{key:"setAttribute",value:function(e,t){this.attributesObject[e]=t}},{key:"removeAttribute",value:function(e){delete this.attributesObject[e]}},{key:"getAllDataAttrKeys",value:function(){return Object.keys(this.attributesObject).filter(function(e){return e.startsWith("data-attr")})}},{key:"getExtension",value:function(){return this.extension}},{key:"getMimeType",value:function(){return this.mime}},{key:"hasAttribute",value:function(e){return e in this.attributesObject}},{key:"getType",value:function(){return this.type}},{key:"getSource",value:function(){return this.src}},{key:"getSources",value:function(){return this.sources}},{key:"clearContents",value:function(){for(;this.hookedFns.hasChildNodes();)this.hookedFns.removeChild(this.hookedFns.getLastChild())}},{key:"replaceContents",value:function(e){var t=this;this.clearContents(),e.forEach(function(e){return t.hookedFns.appendChild(e)})}},{key:"utilsSetAllDataAttributes",value:function(e){var t=this;this.getAllDataAttrKeys().forEach(function(n){return e.setAttribute(n.substr(10),t.getAttribute(n))})}},{key:"utilsPassAllDataAttributes",value:function(e){var t=this;this.getAllDataAttrKeys().forEach(function(n){return e.setAttribute(n,t.getAttribute(n))})}}]),e}();a.uid=function(e){return function(){return e++}}(0),a.attributesObject=function(e){var t={};if(e.hasAttributes()){var n=e.attributes;Object.keys(n).forEach(function(e){var r=n[e];t[r.name]=r.value})}return t.hasAttribute=function(e){return t[e]},t},e.exports=a},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(){r(this,e)}return o(e,null,[{key:"extension",value:function(e){var t=e.getAttribute("data-type");if(t)return t.split("/")[1]}},{key:"type",value:function(e){var t=e.getAttribute("data-type");if(t)return t.split("/")[0]}},{key:"mime",value:function(e){return e.getAttribute("data-type")}},{key:"protocol",value:function(e){var t=e.getAttribute("src").split("://");return t.length>1?t[0]:window.location.protocol}},{key:"hostname",value:function(e){var t=e.getAttribute("src").split("://");return t.length>1?t[1].split("/")[0]:window.location.hostname}},{key:"source",value:function(e){return e.getAttribute("src")}},{key:"schemes",value:function(e){return/\w+:/.exec(e.getAttribute("src"))}},{key:"sources",value:function(e){var t=e.getAttribute("sources")||e.getAttribute("srcs");return t?JSON.parse(t):null}},{key:"actions",value:function(e){var t=e.getAttribute("actions");return t?JSON.parse(t):null}},{key:"parse",value:function(t){return{protocol:e.protocol(t),hostname:e.hostname(t),src:e.source(t),type:e.type(t),extension:e.extension(t),mime:e.mime(t),sources:e.sources(t),actions:e.actions(t)}}}]),e}();e.exports=i},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(4),c=n(0),s=n(2),f=function(e){function t(){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,c.IMAGE))}return i(t,e),u(t,[{key:"process",value:function(e){var t=document.createElement("img");t.setAttribute("src",e.getAttribute("src")),e.utilsSetAllDataAttributes(t),e.replaceContents([t]),s.processingEngine.return(e)}}]),t}(a);e.exports=f},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(4),c=n(0),s=n(2),f=function(e){function t(){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,c.AUDIO))}return i(t,e),u(t,[{key:"process",value:function(e){var t=document.createElement("audio");t.setAttribute("src",e.getAttribute("src")),t.setAttribute("controls",!0),e.utilsSetAllDataAttributes(t),e.replaceContents([t]),s.processingEngine.return(e)}}]),t}(a);e.exports=f},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(4),c=n(0),s=n(2),f=function(e){function t(){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,c.VIDEO))}return i(t,e),u(t,[{key:"process",value:function(e){var t=document.createElement("video");t.setAttribute("src",e.getAttribute("src")),t.setAttribute("controls",!0),e.utilsSetAllDataAttributes(t),e.replaceContents([t]),s.processingEngine.return(e)}}]),t}(a);e.exports=f},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(4),c=n(0),s=n(2),f={PDFJS:"pdfjs",DEFAULT:"default"},l=function(e){function t(){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,c.PDF))}return i(t,e),u(t,[{key:"process",value:function(e){var n=e.name||e.metadata&&e.metadata.name,r=e.getAttribute("src")+"#"+window.encodeURIComponent(n),o=document.createElement("iframe");switch(e.getAttribute("data-attr-width")||o.setAttribute("width","100%"),e.getAttribute("data-attr-height")||o.setAttribute("height",document.body.scrollHeight),t.viewer||(t.mode=f.DEFAULT),t.mode){case f.PDFJS:var i=t.viewer+"?file="+r,u=new XMLHttpRequest;u.onload=function(){u.status<400?o.src=i:(console.warn("The pdfjs viewer has not been found ...\n\t\t\t\t\t\t\tThe browser viewer will be used by default"),o.src=""+r)},u.open("HEAD",i,!0),u.send();break;default:o.src=""+r}e.utilsSetAllDataAttributes(o),e.replaceContents([o]),o.onload=function(){s.processingEngine.return(e)}}}]),t}(a);l.viewer=null,l.mode=f.PDFJS,e.exports=l},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(4),c=n(0),s=n(2),f=function(e){function t(){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,c.DASH))}return i(t,e),u(t,[{key:"process",value:function(e){var t=document.createElement("video"),n=new shaka.Player(t),r=e.getAttribute("id"),o=e.getAttribute("key");if(r&&o){var i='{"'+r+'": "'+o+'"}',u=JSON.parse(i);n.configure({drm:{clearKeys:u}})}t.setAttribute("controls",!0),e.utilsSetAllDataAttributes(t),e.replaceContents([t]),n.load(e.getAttribute("src")).then(function(){}),s.processingEngine.return(e)}}]),t}(a);e.exports=f},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(4),c=n(0),s=n(2),f=function(e){function t(e,n){r(this,t);var i=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,c.DOWNLOAD));return i.message=e,i.buttonMessage=n||"Download",i}return i(t,e),u(t,[{key:"process",value:function(e){var t=document.createElement("button");t.innerHTML=this.buttonMessage,t.onclick=function(){var t=new XMLHttpRequest,n=e.getAttribute("src");t.open("GET",n,!0),t.responseType="blob",t.onload=function(){var n=t.response;if(n)if(e.name)saveAs(n,e.name);else if(e.getAttribute("data-attr-type")){var r=e.getAttribute("data-attr-type"),o=r.split("/"),i=new File([n],"download."+(o[1]||"txt"),{type:r});saveAs(i)}else saveAs(n)},t.send()},e.utilsSetAllDataAttributes(t),e.replaceContents([t]),s.processingEngine.return(e)}}]),t}(a);e.exports=f},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(11),c=n(0),s=n(2),f=function(e){function t(){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,c.CLEAR_KEY))}return i(t,e),u(t,[{key:"process",value:function(e){var t=e.getAttribute("data-clear-key"),n=t.substring(0,32),r=t.substring(33,65);e.setAttribute("id",n),e.setAttribute("key",r),e.removeAttribute("data-clear-key"),s.processingEngine.return(e)}}]),t}(a);e.exports=f},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var u=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(20),c=n(0),s=n(2),f=function(e){function t(){return r(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,c.MEDIA_OBJECT))}return i(t,e),u(t,[{key:"process",value:function(e){s.processingEngine.return(e)}}]),t}(a);e.exports=f},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){s.isAllowedMediaType(t.type)&&(e.setAttribute("data-type",t.type),e.type=t.type,e.extension=t.extension,e.mime=t.mime)}function i(e){var t=e.getAttribute("src"),n=e.getAttribute("data-crypto-key"),r=f.getKeyFromStr(n),i=new XMLHttpRequest;i.open("GET",t,!0),i.responseType="arraybuffer",i.onload=function(){var t=i.response;if(t){var n=new Uint8Array(t),u=f.decrypt(n,r),a=l.getBlobUrl(u,e.getMimeType()),s=new Event("decryption");s.blob=new Blob([u],{type:e.getMimeType()}),window.document.dispatchEvent(s),e.setAttribute("src",a),e.removeAttribute("data-crypto-key"),e.hasAttribute("data-type")||o(e,{type:"image",extension:"png",mime:"image/png"}),c.processingEngine.return(e)}},i.send(null)}var u=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(18),c=n(2),s=n(7),f=function(){function e(){r(this,e)}return u(e,null,[{key:"slice",value:function(e){return Array.prototype.slice.call(e)}},{key:"getRandomKeyStr",value:function(){var t=e.Nacl,n=t.randomBytes(18);return t.util.encodeBase64(n)}},{key:"getKeyFromStr",value:function(t){var n=e.Nacl;return n.hash(n.util.decodeBase64(t)).subarray(32,64)}},{key:"encrypt",value:function(t,n){var r=t,o=e.Nacl.randomBytes(24),i=e.Nacl.secretbox(r,o,n);if(i)return new Uint8Array(e.slice(o).concat(e.slice(i)));throw new Error}},{key:"decrypt",value:function(t,n){if(t.length<24)throw new Error;var r=e.slice,o=e.Nacl,i=new Uint8Array(r(t).slice(0,24)),u=new Uint8Array(r(t).slice(24)),a=o.secretbox.open(u,i,n);if(a)return a;throw new Error("Decrypted file in undefined")}}]),e}();f.Nacl=window.nacl;var l=function(){function e(){r(this,e)}return u(e,null,[{key:"getArrayBuffer",value:function(e){return fetch(e).then(function(e){if(e.ok)return e.arrayBuffer();throw new a.FetchFails}).then(function(e){return e})}},{key:"createUrl",value:function(e){return window.URL.createObjectURL(e)}},{key:"getBlobUrl",value:function(e,t){return window.URL.createObjectURL(new Blob([e],{type:t}))}},{key:"getDataUrl",value:function(e,t){return"data:"+t+";base64,"+f.Nacl.util.encodeBase64(e)}}]),e}();e.exports=i},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){var n=t.type.split("/"),r=t.type,o=n[0],i=n[1];s.isAllowedMediaType(r)?(e.setAttribute("data-type",t.type),e.type=o,e.extension=i,e.mime=r):console.log("Not allowed metadata, allowed ones are : ",s.getAllowedMediaTypes()),e.name=t.name,e.setAttribute("data-attr-type",t.type)}function i(e){var t=e.getAttribute("src"),n=e.getAttribute("data-crypto-key"),r=f.getKeyFromStr(n),i=new XMLHttpRequest,u=[t,n].join(""),a=function(t){var n=new Event("decryption");n.metadata=t.metadata,o(e,t.metadata);var r=t.content,i=l.getBlobUrl(r,e.getMimeType());n.blob=new Blob([r],{type:e.getMimeType()}),n.metadata=t.metadata,s.addAllowedMediaType("audio/mpeg"),e.setAttribute("src",i),e.removeAttribute("data-crypto-key"),/audio\/(mp3|ogg|wav|webm|mpeg)/.test(t.metadata.type)||/application\/pdf/.test(t.metadata.type)||/video\//.test(t.metadata.type)||/image\/(png|jpeg|jpg|gif)/.test(t.metadata.type)||(t.metadata.type="download"),o(e,t.metadata),n.callback=function(t){c.processingEngine.return(e),"function"==typeof t&&t(e)},window.document.dispatchEvent(n)},p=c.__Cryptpad_Cache=c.__Cryptpad_Cache||{};if(p[u])return setTimeout(function(){a(p[u])});i.open("GET",t,!0),i.responseType="arraybuffer";var y=function(e){var t=new Event("decryptionError");t.message="string"==typeof e?e:e.message,window.document.dispatchEvent(t)};i.onload=function(){if(/^4/.test(""+this.status))return y("XHR_ERROR",this.status);var e=i.response;if(e){var t=new Uint8Array(e);f.decrypt(t,r,function(e,t){if(e)return y(e);p[u]=t,a(t)})}},i.send(null)}var u=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(18),c=n(2),s=n(7),f=function(){function e(){r(this,e)}return u(e,null,[{key:"createNonce",value:function(){return new Uint8Array(new Array(24).fill(0))}},{key:"increment",value:function(e){for(var t=e.length;t-- >1;){if("number"!=typeof e[t])throw new Error("E_UNSAFE_TYPE");if(e[t]>255)throw new Error("E_OUT_OF_BOUNDS");if(255!==e[t])return void e[t]++;if(e[t]=0,0===t)throw new Error("E_NONCE_TOO_LARGE")}}},{key:"encodePrefix",value:function(e){return[65280,255].map(function(t,n){return(e&t)>>8*(1-n)})}},{key:"decodePrefix",value:function(e){return e[0]<<8|e[1]}},{key:"joinChunks",value:function(e){return new Blob(e)}},{key:"slice",value:function(e){return Array.prototype.slice.call(e)}},{key:"getRandomKeyStr",value:function(){var e=window.nacl,t=e.randomBytes(18);return e.util.encodeBase64(t)}},{key:"getKeyFromStr",value:function(e){return window.nacl.util.decodeBase64(e)}},{key:"encrypt",value:function(){}},{key:"decrypt",value:function(t,n,r){var o=window.nacl,i=function(e){var n=new Event("decryptionProgress");n.percent=e/t.length*100,window.document.dispatchEvent(n)},u=e.createNonce(),a=0,c=t.subarray(0,2),s=e.decodePrefix(c),f={metadata:void 0},l=new Uint8Array(t.subarray(2,2+s)),p=o.secretbox.open(l,u,n);e.increment(u);try{f.metadata=JSON.parse(o.util.encodeUTF8(p))}catch(e){return r("E_METADATA_DECRYPTION")}if(!f.metadata)return r("NO_METADATA");var y=function(r){setTimeout(function(){var c=131088*a+2+s,f=c+131088;a++;var l=new Uint8Array(t.subarray(c,f)),p=o.secretbox.open(l,u,n);if(e.increment(u),!p)return void r("DECRYPTION_FAILURE");i(Math.min(f,t.length)),r(void 0,p)})},h=[];!function n(){y(function(o,i){return o?setTimeout(function(){r(o)}):i?2+s+131088*a<=t.length?(h.push(i),n()):(h.push(i),f.content=e.joinChunks(h),r(void 0,f)):void r("UNEXPECTED_ENDING")})}()}}]),e}(),l=function(){function e(){r(this,e)}return u(e,null,[{key:"getArrayBuffer",value:function(e){return fetch(e).then(function(e){if(e.ok)return e.arrayBuffer();throw new a.FetchFails}).then(function(e){return e})}},{key:"createUrl",value:function(e){return window.URL.createObjectURL(e)}},{key:"getBlobUrl",value:function(e,t){return window.URL.createObjectURL(new Blob([e],{type:t}))}},{key:"getDataUrl",value:function(e,t){return"data:"+t+";base64,"+window.nacl.util.encodeBase64(e)}}]),e}();e.exports=i},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(t){r(this,e),this.data=t||{}}return o(e,[{key:"getPermission",value:function(e){return this.data[e]}},{key:"setPermission",value:function(e,t){this.data[e]=t}},{key:"getData",value:function(){return this.data}}]),e}();e.exports=i},,,,,,,,,,function(e,t,n){e.exports=n(19)}])}); |