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.
cryptpad/www/common/media-tag.js

1 line
20 KiB
JavaScript

8 years ago
!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 i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},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=68)}([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 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}}(),o=n(5),u=n(3),a=n(4),c=function(){function e(){r(this,e)}return i(e,null,[{key:"findRequiredModuleIdentifiers",value:function(t){return o.logics().filter(function(n){return n.apply(t)&&!e.forbiddenIdentifiers.includes(n.identifier)}).map(function(e){return e.identifier})}},{key:"findFilterIdentifiersToRegister",value:function(t){return o.logics().filter(function(n){return n.apply(t)&&!e.forbiddenIdentifiers.includes(n.identifier)}).filter(function(e){return"filter"===e.type}).map(function(e){return e.identifier})}},{key:"findPluginIdentifiersToRegister",value:function(t){return o.logics().filter(function(n){return n.apply(t)&&!e.forbiddenIdentifiers.includes(n.identifier)}).filter(function(e){return"plugin"===e.type}).map(function(e){return e.identifier})}},{key:"searchLogicCollision",value:function(e){var t=e.filter(function(e){return a.plugins().find(function(t){return e.identifier===t.identifier})});return t.length>1?{modules:t}:null}},{key:"findModuleChain",value:function(t){var n=e.findRequiredModuleIdentifiers(t),r=n.map(function(e){var t=u.getFilter(e)||a.getPlugin(e);if(t)return t;throw new Error("Module "+e+" not found")}),i=e.searchLogicCollision(r);if(i){var o=i.modules.map(function(e){return e.identifier});throw new Error("Has collision between ["+o+"]'s logics")}return r}},{key:"startup",value:function(t){if(o.hasLogics()===!1)return void console.warn("Guidelines havn't logics ... The orchestrator cannot do anything !");var n=t.getId();e.chains[n]=e.findModuleChain(t),e.history[n]={identifiers:[e.findRequiredModuleIdentifiers(t)],cycles:{}},e.chains[n].length>0&&e.run(t)}},{key:"coherence",value:function(t){var n=t.getId(),r=e.history[n].identifiers.length-1;if(Object.keys(e.history[n].cycles).some(function(t){return e.history[n].cycles[t]>e.allowedCycles}))throw console.log(e.history[n]),new Error("Maximum cycles exceed "+e.history[n].cycles);var i=e.history[n].identifiers[r-1].every(function(t){return e.history[n].identifiers[r].includes(t)})||e.history[n].identifiers[r-1][0]===e.history[n].identifiers[r][0],o=e.history[n].identifiers[r][0];i&&(console.info('Chain has not evolved since the last module execution, the module "%s" is skipped',o),e.chains[n].shift())}},{key:"run",value:function(t){var n=t.getId();e.chains[n][0]?e.chains[n][0].startup(t):console.warn("Attempts to run a empty chain ...","History : ",e.history[n])}},{key:"chain",value:function(t){e.update(t),e.coherence(t),e.run(t)}},{key:"update",value:function(t){var n=t.getId(),r=e.chains[n].shift();e.findModuleChain(t).filter(function(t){return!e.chains[n].includes(t)}).forEach(function(t){e.chains[n].unshift(t)});var i=e.history[n].cycles[r.identifier];e.history[n].cycles[r.identifier]="number"==typeof i?i+1:1;var o=e.chains[n].map(function(e){return e.identifier});e.history[n].identifiers.push(o)}}]),e}();c.chains={},c.history={},c.allowedCycles=1,c.forbiddenIdentifiers=[],e.exports=c},,,function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("C