PluginProbe
BeyondWords – AI audio for publishers / 4.6.0
BeyondWords – AI audio for publishers v4.6.0
7.2.0 7.1.0 trunk 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.1.0 4.1.1 4.1.2 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.3.0 4.4.0 4.5.0 4.5.1 4.6.0 4.6.1 4.6.2 All 44 releases
speechkit / build / 208.js

208.js in BeyondWords – AI audio for publishers 4.6.0, at build/208.js

1 lines 12.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (self.webpackChunkbeyondwords_wordpress_plugin=self.webpackChunkbeyondwords_wordpress_plugin||[]).push([[208],{2333:function(t,n,e){"use strict";e.d(n,{a:function(){return s},e:function(){return i},g:function(){return r}});var o=e(5756);const i=(0,o.e)(o.g.processed),s=(0,o.e)(o.g.processing),r=t=>t?new Date(t).valueOf():0},3208:function(t,n,e){"use strict";e.r(n),e.d(n,{getMiddleware:function(){return l}});var o=e(5756),i=(e(1978),e(8392)),s=e.n(i),r=e(2333);const c=(0,o.c)((t=>JSON.parse(t||'{"exp": 0}')),(([,t])=>{try{const n=window.atob(t||"");return/^\{.*exp.*}$/i.test(n)?n:null}catch(t){return null}}),(t=>t.split(".")||[]),String),u=t=>c(t).exp>(0,o.p)(Date.now()/1e3),l=({appReady:t,setParams:n,updatePlaylist:e,appDestroy:i})=>{let c,l=o.j;const a=t=>(i,s)=>{const{app:{podcasts:c}}=s(),u=(0,o.i)(t.media)&&t.media.length;if((0,r.e)(t.state)&&u){const n=(0,o.m)((0,o.o)(["media"],(0,o.h)(c)||{}),{media:[].concat(t.media),state:t.state,processing_at:t.processing_at});i(e([n]))}i(n({useStatusBox:(0,o.n)((0,r.e)(t.state)),podcastState:t.state}))},p=(t,n)=>async({error:e,result:i})=>{if(e)return;const{app:{podcasts:s}}=n(),c=(0,o.h)(s||[])||{};if((0,o.e)(c.podcast_id,i.podcast_id)&&(0,r.g)(i.updated_at)>(0,r.g)(c.processing_at)){if((0,r.e)(i.state))return t(a(await l()));t(a({state:i.state}))}},h=async(t,e,{getState:i,dispatch:h})=>{const{app:{apiKey:d,skBackendApi:f,initParams:g,wsToken:y,apiWriteKey:m,useStatusBox:v,podcastState:b}}=i(),{projectId:S,podcastId:w,externalId:A}=g;l=(({apiKey:t,skBackendApi:n,projectId:e,podcastId:i})=>async()=>{const{data:s}=await(0,o.k)({apiKey:t,skBackendApi:n,projectId:e,podcastId:i});return s})({apiKey:d,skBackendApi:f,projectId:S,podcastId:w||A}),!(0,r.e)(b)&&b||!(0,o.n)(v)||h(a(await l()));let k=y;if((0,o.n)(k)&&(0,o.n)(u(k))){const{data:t}=await(0,o.r)({skBackendApi:f,writeKey:m});k=t.token}k&&u(k)&&(0,o.n)((0,o.e)(k,y))&&h(n({wsToken:k})),c||(c=s().createConsumer(`wss://${(0,o.b)(f)}/cable?token=${k}`),c.subscriptions.create({channel:"Api::V1::ProjectChannel",id:S},{received:h(p),disconnected:()=>{c&&(0,o.d)(c.disconnect)&&(c.disconnect(),c=null)}}))};return(0,o.a)({[t]:h,[n]:async(t,n,e,i)=>{if((0,o.f)("useStatusBox",t)&&t.useStatusBox){if(i.app.useStatusBox)return;return h.apply(null,[(0,o.m)(t,{podcastState:o.g.processing}),n,e,i])}},[i]:()=>{c&&(0,o.d)(c.disconnect)&&(c.disconnect(),c=null)}})}},8392:function(t,n,e){var o,i;(function(){(function(){(function(){var t=[].slice;this.ActionCable={INTERNAL:{message_types:{welcome:"welcome",ping:"ping",confirmation:"confirm_subscription",rejection:"reject_subscription"},default_mount_path:"/cable",protocols:["actioncable-v1-json","actioncable-unsupported"]},WebSocket:window.WebSocket,logger:window.console,createConsumer:function(t){var n;return null==t&&(t=null!=(n=this.getConfig("url"))?n:this.INTERNAL.default_mount_path),new s.Consumer(this.createWebSocketURL(t))},getConfig:function(t){var n;return null!=(n=document.head.querySelector("meta[name='action-cable-"+t+"']"))?n.getAttribute("content"):void 0},createWebSocketURL:function(t){var n;return t&&!/^wss?:/i.test(t)?((n=document.createElement("a")).href=t,n.href=n.href,n.protocol=n.protocol.replace("http","ws"),n.href):t},startDebugging:function(){return this.debugging=!0},stopDebugging:function(){return this.debugging=null},log:function(){var n,e;if(n=1<=arguments.length?t.call(arguments,0):[],this.debugging)return n.push(Date.now()),(e=this.logger).log.apply(e,["[ActionCable]"].concat(t.call(n)))}}}).call(this)}).call(this);var s=this.ActionCable;(function(){(function(){s.ConnectionMonitor=function(){var t,n,e;function o(t){var n,e;this.connection=t,this.visibilityDidChange=(n=this.visibilityDidChange,e=this,function(){return n.apply(e,arguments)}),this.reconnectAttempts=0}return o.pollInterval={min:3,max:30},o.staleThreshold=6,o.prototype.start=function(){if(!this.isRunning())return this.startedAt=n(),delete this.stoppedAt,this.startPolling(),document.addEventListener("visibilitychange",this.visibilityDidChange),s.log("ConnectionMonitor started. pollInterval = "+this.getPollInterval()+" ms")},o.prototype.stop=function(){if(this.isRunning())return this.stoppedAt=n(),this.stopPolling(),document.removeEventListener("visibilitychange",this.visibilityDidChange),s.log("ConnectionMonitor stopped")},o.prototype.isRunning=function(){return null!=this.startedAt&&null==this.stoppedAt},o.prototype.recordPing=function(){return this.pingedAt=n()},o.prototype.recordConnect=function(){return this.reconnectAttempts=0,this.recordPing(),delete this.disconnectedAt,s.log("ConnectionMonitor recorded connect")},o.prototype.recordDisconnect=function(){return this.disconnectedAt=n(),s.log("ConnectionMonitor recorded disconnect")},o.prototype.startPolling=function(){return this.stopPolling(),this.poll()},o.prototype.stopPolling=function(){return clearTimeout(this.pollTimeout)},o.prototype.poll=function(){return this.pollTimeout=setTimeout((t=this,function(){return t.reconnectIfStale(),t.poll()}),this.getPollInterval());var t},o.prototype.getPollInterval=function(){var n,e,o,i;return o=(i=this.constructor.pollInterval).min,e=i.max,n=5*Math.log(this.reconnectAttempts+1),Math.round(1e3*t(n,o,e))},o.prototype.reconnectIfStale=function(){if(this.connectionIsStale())return s.log("ConnectionMonitor detected stale connection. reconnectAttempts = "+this.reconnectAttempts+", pollInterval = "+this.getPollInterval()+" ms, time disconnected = "+e(this.disconnectedAt)+" s, stale threshold = "+this.constructor.staleThreshold+" s"),this.reconnectAttempts++,this.disconnectedRecently()?s.log("ConnectionMonitor skipping reopening recent disconnect"):(s.log("ConnectionMonitor reopening"),this.connection.reopen())},o.prototype.connectionIsStale=function(){var t;return e(null!=(t=this.pingedAt)?t:this.startedAt)>this.constructor.staleThreshold},o.prototype.disconnectedRecently=function(){return this.disconnectedAt&&e(this.disconnectedAt)<this.constructor.staleThreshold},o.prototype.visibilityDidChange=function(){if("visible"===document.visibilityState)return setTimeout((t=this,function(){if(t.connectionIsStale()||!t.connection.isOpen())return s.log("ConnectionMonitor reopening stale connection on visibilitychange. visbilityState = "+document.visibilityState),t.connection.reopen()}),200);var t},n=function(){return(new Date).getTime()},e=function(t){return(n()-t)/1e3},t=function(t,n,e){return Math.max(n,Math.min(e,t))},o}()}).call(this),function(){var t,n,e,o,i,r=[].slice,c=[].indexOf||function(t){for(var n=0,e=this.length;n<e;n++)if(n in this&&this[n]===t)return n;return-1};o=s.INTERNAL,n=o.message_types,e=o.protocols,i=2<=e.length?r.call(e,0,t=e.length-1):(t=0,[]),e[t++],s.Connection=function(){function t(t){var n,e;this.consumer=t,this.open=(n=this.open,e=this,function(){return n.apply(e,arguments)}),this.subscriptions=this.consumer.subscriptions,this.monitor=new s.ConnectionMonitor(this),this.disconnected=!0}return t.reopenDelay=500,t.prototype.send=function(t){return!!this.isOpen()&&(this.webSocket.send(JSON.stringify(t)),!0)},t.prototype.open=function(){return this.isActive()?(s.log("Attempted to open WebSocket, but existing socket is "+this.getState()),!1):(s.log("Opening WebSocket, current state is "+this.getState()+", subprotocols: "+e),null!=this.webSocket&&this.uninstallEventHandlers(),this.webSocket=new s.WebSocket(this.consumer.url,e),this.installEventHandlers(),this.monitor.start(),!0)},t.prototype.close=function(t){var n;if((null!=t?t:{allowReconnect:!0}).allowReconnect||this.monitor.stop(),this.isActive())return null!=(n=this.webSocket)?n.close():void 0},t.prototype.reopen=function(){var t;if(s.log("Reopening WebSocket, current state is "+this.getState()),!this.isActive())return this.open();try{return this.close()}catch(n){return t=n,s.log("Failed to reopen WebSocket",t)}finally{s.log("Reopening WebSocket in "+this.constructor.reopenDelay+"ms"),setTimeout(this.open,this.constructor.reopenDelay)}},t.prototype.getProtocol=function(){var t;return null!=(t=this.webSocket)?t.protocol:void 0},t.prototype.isOpen=function(){return this.isState("open")},t.prototype.isActive=function(){return this.isState("open","connecting")},t.prototype.isProtocolSupported=function(){var t;return t=this.getProtocol(),c.call(i,t)>=0},t.prototype.isState=function(){var t,n;return n=1<=arguments.length?r.call(arguments,0):[],t=this.getState(),c.call(n,t)>=0},t.prototype.getState=function(){var t,n;for(n in WebSocket)if(WebSocket[n]===(null!=(t=this.webSocket)?t.readyState:void 0))return n.toLowerCase();return null},t.prototype.installEventHandlers=function(){var t,n;for(t in this.events)n=this.events[t].bind(this),this.webSocket["on"+t]=n},t.prototype.uninstallEventHandlers=function(){var t;for(t in this.events)this.webSocket["on"+t]=function(){}},t.prototype.events={message:function(t){var e,o,i;if(this.isProtocolSupported())switch(e=(i=JSON.parse(t.data)).identifier,o=i.message,i.type){case n.welcome:return this.monitor.recordConnect(),this.subscriptions.reload();case n.ping:return this.monitor.recordPing();case n.confirmation:return this.subscriptions.notify(e,"connected");case n.rejection:return this.subscriptions.reject(e);default:return this.subscriptions.notify(e,"received",o)}},open:function(){if(s.log("WebSocket onopen event, using '"+this.getProtocol()+"' subprotocol"),this.disconnected=!1,!this.isProtocolSupported())return s.log("Protocol is unsupported. Stopping monitor and disconnecting."),this.close({allowReconnect:!1})},close:function(t){if(s.log("WebSocket onclose event"),!this.disconnected)return this.disconnected=!0,this.monitor.recordDisconnect(),this.subscriptions.notifyAll("disconnected",{willAttemptReconnect:this.monitor.isRunning()})},error:function(){return s.log("WebSocket onerror event")}},t}()}.call(this),function(){var t=[].slice;s.Subscriptions=function(){function n(t){this.consumer=t,this.subscriptions=[]}return n.prototype.create=function(t,n){var e,o,i;return o="object"==typeof(e=t)?e:{channel:e},i=new s.Subscription(this.consumer,o,n),this.add(i)},n.prototype.add=function(t){return this.subscriptions.push(t),this.consumer.ensureActiveConnection(),this.notify(t,"initialized"),this.sendCommand(t,"subscribe"),t},n.prototype.remove=function(t){return this.forget(t),this.findAll(t.identifier).length||this.sendCommand(t,"unsubscribe"),t},n.prototype.reject=function(t){var n,e,o,i,s;for(i=[],n=0,e=(o=this.findAll(t)).length;n<e;n++)s=o[n],this.forget(s),this.notify(s,"rejected"),i.push(s);return i},n.prototype.forget=function(t){var n;return this.subscriptions=function(){var e,o,i,s;for(s=[],e=0,o=(i=this.subscriptions).length;e<o;e++)(n=i[e])!==t&&s.push(n);return s}.call(this),t},n.prototype.findAll=function(t){var n,e,o,i,s;for(i=[],n=0,e=(o=this.subscriptions).length;n<e;n++)(s=o[n]).identifier===t&&i.push(s);return i},n.prototype.reload=function(){var t,n,e,o,i;for(o=[],t=0,n=(e=this.subscriptions).length;t<n;t++)i=e[t],o.push(this.sendCommand(i,"subscribe"));return o},n.prototype.notifyAll=function(){var n,e,o,i,s,r,c;for(e=arguments[0],n=2<=arguments.length?t.call(arguments,1):[],r=[],o=0,i=(s=this.subscriptions).length;o<i;o++)c=s[o],r.push(this.notify.apply(this,[c,e].concat(t.call(n))));return r},n.prototype.notify=function(){var n,e,o,i,s,r,c;for(r=arguments[0],e=arguments[1],n=3<=arguments.length?t.call(arguments,2):[],s=[],o=0,i=(c="string"==typeof r?this.findAll(r):[r]).length;o<i;o++)r=c[o],s.push("function"==typeof r[e]?r[e].apply(r,n):void 0);return s},n.prototype.sendCommand=function(t,n){var e;return e=t.identifier,this.consumer.send({command:n,identifier:e})},n}()}.call(this),function(){s.Subscription=function(){var t;function n(n,e,o){this.consumer=n,null==e&&(e={}),this.identifier=JSON.stringify(e),t(this,o)}return n.prototype.perform=function(t,n){return null==n&&(n={}),n.action=t,this.send(n)},n.prototype.send=function(t){return this.consumer.send({command:"message",identifier:this.identifier,data:JSON.stringify(t)})},n.prototype.unsubscribe=function(){return this.consumer.subscriptions.remove(this)},t=function(t,n){var e,o;if(null!=n)for(e in n)o=n[e],t[e]=o;return t},n}()}.call(this),function(){s.Consumer=function(){function t(t){this.url=t,this.subscriptions=new s.Subscriptions(this),this.connection=new s.Connection(this)}return t.prototype.send=function(t){return this.connection.send(t)},t.prototype.connect=function(){return this.connection.open()},t.prototype.disconnect=function(){return this.connection.close({allowReconnect:!1})},t.prototype.ensureActiveConnection=function(){if(!this.connection.isActive())return this.connection.open()},t}()}.call(this)}).call(this),t.exports?t.exports=s:void 0===(i="function"==typeof(o=s)?o.call(n,e,n,t):o)||(t.exports=i)}).call(this)}}]);