sync/www/js/peertube.js

1 line
15 KiB
JavaScript
Raw Normal View History

2022-01-19 14:30:00 +00:00
(()=>{var e={991:function(e){e.exports=function(){"use strict";return function(){var e=Math.floor(1000001*Math.random()),t={};function n(e){return Array.isArray?Array.isArray(e):-1!=e.constructor.toString().indexOf("Array")}var r={},i=function(e){try{var n=JSON.parse(e.data);if("object"!=typeof n||null===n)throw"malformed"}catch(e){return}var i,o,s,a=e.source,u=e.origin;if("string"==typeof n.method){var c=n.method.split("::");2==c.length?(i=c[0],s=c[1]):s=n.method}if(void 0!==n.id&&(o=n.id),"string"==typeof s){var l=!1;if(t[u]&&t[u][i])for(var d=0;d<t[u][i].length;d++)if(t[u][i][d].win===a){t[u][i][d].handler(u,s,n),l=!0;break}if(!l&&t["*"]&&t["*"][i])for(d=0;d<t["*"][i].length;d++)if(t["*"][i][d].win===a){t["*"][i][d].handler(u,s,n);break}}else void 0!==o&&r[o]&&r[o](u,s,n)};return window.addEventListener?window.addEventListener("message",i,!1):window.attachEvent&&window.attachEvent("onmessage",i),{build:function(i){var o=function(e){if(i.debugOutput&&window.console&&window.console.log){try{"string"!=typeof e&&(e=JSON.stringify(e))}catch(e){}window.console.log("["+u+"] "+e)}};if(!window.postMessage)throw"jschannel cannot run this browser, no postMessage";if(!window.JSON||!window.JSON.stringify||!window.JSON.parse)throw"jschannel cannot run this browser, no JSON parsing/serialization";if("object"!=typeof i)throw"Channel build invoked without a proper object argument";if(!i.window||!i.window.postMessage)throw"Channel.build() called without a valid window argument";window===i.window&&o("target window is same as present window -- use at your own risk");var s,a=!1;if("string"==typeof i.origin&&("*"===i.origin?a=!0:null!==(s=i.origin.match(/^https?:\/\/(?:[-a-zA-Z0-9_\.])+(?::\d+)?/))&&(i.origin=s[0].toLowerCase(),a=!0)),!a)throw"Channel.build() called with an invalid origin";if(void 0!==i.scope){if("string"!=typeof i.scope)throw"scope, when specified, must be a string";if(i.scope.split("::").length>1)throw"scope may not contain double colons: '::'"}else i.scope="__default";var u=function(){for(var e="",t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",n=0;n<5;n++)e+=t.charAt(Math.floor(Math.random()*t.length));return e}(),c={},l={},d={},f=!1,h=[],p=[],g=function(e,t,s){if("function"==typeof i.gotMessageObserver)try{i.gotMessageObserver(e,s)}catch(e){o("gotMessageObserver() raised an exception: "+e.toString())}if(s.id&&t){d[s.id]={};var a=function(e,t,n){var r=!1,i=!1;return{origin:t,invoke:function(t,r){if(!d[e])throw"attempting to invoke a callback of a nonexistent transaction: "+e;for(var i=!1,o=0;o<n.length;o++)if(t===n[o]){i=!0;break}if(!i)throw"request supports no such callback '"+t+"'";v({id:e,callback:t,params:r})},error:function(t,n){if(i=!0,!d[e])throw"error called for nonexistent message: "+e;delete d[e],v({id:e,error:t,message:n})},complete:function(t){if(i=!0,!d[e])throw"complete called for nonexistent message: "+e;delete d[e],v({id:e,result:t})},delayReturn:function(e){return"boolean"==typeof e&&(r=!0===e),r},completed:function(){return i}}}(s.id,e,s.callbacks?s.callbacks:[]);if(c[t])try{if(s.callbacks&&n(s.callbacks)&&s.callbacks.length>0)for(var u=0;u<s.callbacks.length;u++){for(var f=s.callbacks[u],h=s.params,p=f.split("/"),g=0;g<p.length-1;g++){var y=p[g];"object"!=typeof h[y]&&(h[y]={}),h=h[y]}h[p[p.length-1]]=function(){var e=f;return function(t){return a.invoke(e,t)}}()}var m=c[t](a,s.params);a.delayReturn()||a.completed()||a.complete(m)}catch(e){var b="runtime_error",w=null;if("string"==typeof e?w=e:"object"==typeof e&&(e instanceof Error?(b=e.constructor.name,w=e.message):e&&n(e)&&2==e.length?(b=e[0],w=e[1]):"string"==typeof e.error&&(b=e.error,e.message?"string"==typeof e.message?w=e.message:e=e.message:w="")),null===w)try{void 0===(w=JSON.stringify(e))&&(w=e.toString())}catch(t){w=e.toString()}a.error(b,w)}else a.error("method_not_found","No method '"+t+"' was (yet) bound by the provider")}else s.id&&s.callback?l[s.id]&&l[s.id].callbacks&&l[s.id].callbacks[s.callback]?l[s.id].callbacks[s.callback](s.params):o("ignoring invalid callback, id:"+s.id+" ("+s.callback+")"):s.id?l[s.id]?(s.