diff --git a/amd/build/adapter.min.js b/amd/build/adapter.min.js index ea027ffc..cfb7c56e 100644 --- a/amd/build/adapter.min.js +++ b/amd/build/adapter.min.js @@ -1,3 +1,2 @@ -!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.adapter=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g=14393&&a.indexOf("?transport=udp")===-1}),delete a.url,a.urls=e?d[0]:d,!!d.length}})}function g(a,b){var c={codecs:[],headerExtensions:[],fecMechanisms:[]},d=function(a,b){a=parseInt(a,10);for(var c=0;c0;g--)this._iceGatherers.push(new a.RTCIceGatherer({iceServers:c.iceServers,gatherPolicy:c.iceTransportPolicy}));else c.iceCandidatePoolSize=0;this._config=c,this.transceivers=[],this._sdpSessionId=k.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1};n.prototype.onicecandidate=null,n.prototype.onaddstream=null,n.prototype.ontrack=null,n.prototype.onremovestream=null,n.prototype.onsignalingstatechange=null,n.prototype.oniceconnectionstatechange=null,n.prototype.onconnectionstatechange=null,n.prototype.onicegatheringstatechange=null,n.prototype.onnegotiationneeded=null,n.prototype.ondatachannel=null,n.prototype._dispatchEvent=function(a,b){this._isClosed||(this.dispatchEvent(b),"function"==typeof this["on"+a]&&this["on"+a](b))},n.prototype._emitGatheringStateChange=function(){var a=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",a)},n.prototype.getConfiguration=function(){return this._config},n.prototype.getLocalStreams=function(){return this.localStreams},n.prototype.getRemoteStreams=function(){return this.remoteStreams},n.prototype._createTransceiver=function(a,b){var c=this.transceivers.length>0,d={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:a,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,associatedRemoteMediaStreams:[],wantReceive:!0};if(this.usingBundle&&c)d.iceTransport=this.transceivers[0].iceTransport,d.dtlsTransport=this.transceivers[0].dtlsTransport;else{var e=this._createIceAndDtlsTransports();d.iceTransport=e.iceTransport,d.dtlsTransport=e.dtlsTransport}return b||this.transceivers.push(d),d},n.prototype.addTrack=function(b,c){if(this._isClosed)throw j("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var d=this.transceivers.find(function(a){return a.track===b});if(d)throw j("InvalidAccessError","Track already exists.");for(var e,f=0;f=15025)a.getTracks().forEach(function(b){c.addTrack(b,a)});else{var d=a.clone();a.getTracks().forEach(function(a,b){var c=d.getTracks()[b];a.addEventListener("enabled",function(a){c.enabled=a.enabled})}),d.getTracks().forEach(function(a){c.addTrack(a,d)})}},n.prototype.removeTrack=function(b){if(this._isClosed)throw j("InvalidStateError","Attempted to call removeTrack on a closed peerconnection.");if(!(b instanceof a.RTCRtpSender))throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");var c=this.transceivers.find(function(a){return a.rtpSender===b});if(!c)throw j("InvalidAccessError","Sender was not created by this connection.");var d=c.stream;c.rtpSender.stop(),c.rtpSender=null,c.track=null,c.stream=null;var e=this.transceivers.map(function(a){return a.stream});e.indexOf(d)===-1&&this.localStreams.indexOf(d)>-1&&this.localStreams.splice(this.localStreams.indexOf(d),1),this._maybeFireNegotiationNeeded()},n.prototype.removeStream=function(a){var b=this;a.getTracks().forEach(function(a){var c=b.getSenders().find(function(b){return b.track===a});c&&b.removeTrack(c)})},n.prototype.getSenders=function(){return this.transceivers.filter(function(a){return!!a.rtpSender}).map(function(a){return a.rtpSender})},n.prototype.getReceivers=function(){return this.transceivers.filter(function(a){return!!a.rtpReceiver}).map(function(a){return a.rtpReceiver})},n.prototype._createIceGatherer=function(b,c){var d=this;if(c&&b>0)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var e=new a.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(e,"state",{value:"new",writable:!0}),this.transceivers[b].bufferedCandidateEvents=[],this.transceivers[b].bufferCandidates=function(a){var c=!a.candidate||0===Object.keys(a.candidate).length;e.state=c?"completed":"gathering",null!==d.transceivers[b].bufferedCandidateEvents&&d.transceivers[b].bufferedCandidateEvents.push(a)},e.addEventListener("localcandidate",this.transceivers[b].bufferCandidates),e},n.prototype._gather=function(b,c){var d=this,e=this.transceivers[c].iceGatherer;if(!e.onlocalcandidate){var f=this.transceivers[c].bufferedCandidateEvents;this.transceivers[c].bufferedCandidateEvents=null,e.removeEventListener("localcandidate",this.transceivers[c].bufferCandidates),e.onlocalcandidate=function(a){if(!(d.usingBundle&&c>0)){var f=new Event("icecandidate");f.candidate={sdpMid:b,sdpMLineIndex:c};var g=a.candidate,h=!g||0===Object.keys(g).length;if(h)"new"!==e.state&&"gathering"!==e.state||(e.state="completed");else{"new"===e.state&&(e.state="gathering"),g.component=1,g.ufrag=e.getLocalParameters().usernameFragment;var i=k.writeCandidate(g);f.candidate=Object.assign(f.candidate,k.parseCandidate(i)),f.candidate.candidate=i,f.candidate.toJSON=function(){return{candidate:f.candidate.candidate,sdpMid:f.candidate.sdpMid,sdpMLineIndex:f.candidate.sdpMLineIndex,usernameFragment:f.candidate.usernameFragment}}}var j=k.getMediaSections(d.localDescription.sdp);h?j[f.candidate.sdpMLineIndex]+="a=end-of-candidates\r\n":j[f.candidate.sdpMLineIndex]+="a="+f.candidate.candidate+"\r\n",d.localDescription.sdp=k.getDescription(d.localDescription.sdp)+j.join("");var l=d.transceivers.every(function(a){return a.iceGatherer&&"completed"===a.iceGatherer.state});"gathering"!==d.iceGatheringState&&(d.iceGatheringState="gathering",d._emitGatheringStateChange()),h||d._dispatchEvent("icecandidate",f),l&&(d._dispatchEvent("icecandidate",new Event("icecandidate")),d.iceGatheringState="complete",d._emitGatheringStateChange())}},a.setTimeout(function(){f.forEach(function(a){e.onlocalcandidate(a)})},0)}},n.prototype._createIceAndDtlsTransports=function(){var b=this,c=new a.RTCIceTransport(null);c.onicestatechange=function(){b._updateIceConnectionState(),b._updateConnectionState()};var d=new a.RTCDtlsTransport(c);return d.ondtlsstatechange=function(){b._updateConnectionState()},d.onerror=function(){Object.defineProperty(d,"state",{value:"failed",writable:!0}),b._updateConnectionState()},{iceTransport:c,dtlsTransport:d}},n.prototype._disposeIceAndDtlsTransports=function(a){var b=this.transceivers[a].iceGatherer;b&&(delete b.onlocalcandidate,delete this.transceivers[a].iceGatherer);var c=this.transceivers[a].iceTransport;c&&(delete c.onicestatechange,delete this.transceivers[a].iceTransport);var d=this.transceivers[a].dtlsTransport;d&&(delete d.ondtlsstatechange,delete d.onerror,delete this.transceivers[a].dtlsTransport)},n.prototype._transceive=function(a,c,d){var e=g(a.localCapabilities,a.remoteCapabilities);c&&a.rtpSender&&(e.encodings=a.sendEncodingParameters,e.rtcp={cname:k.localCName,compound:a.rtcpParameters.compound},a.recvEncodingParameters.length&&(e.rtcp.ssrc=a.recvEncodingParameters[0].ssrc),a.rtpSender.send(e)),d&&a.rtpReceiver&&e.codecs.length>0&&("video"===a.kind&&a.recvEncodingParameters&&b<15019&&a.recvEncodingParameters.forEach(function(a){delete a.rtx}),a.recvEncodingParameters.length?e.encodings=a.recvEncodingParameters:e.encodings=[{}],e.rtcp={compound:a.rtcpParameters.compound},a.rtcpParameters.cname&&(e.rtcp.cname=a.rtcpParameters.cname),a.sendEncodingParameters.length&&(e.rtcp.ssrc=a.sendEncodingParameters[0].ssrc),a.rtpReceiver.receive(e))},n.prototype.setLocalDescription=function(a){var b=this;if(["offer","answer"].indexOf(a.type)===-1)return Promise.reject(j("TypeError",'Unsupported type "'+a.type+'"'));if(!h("setLocalDescription",a.type,b.signalingState)||b._isClosed)return Promise.reject(j("InvalidStateError","Can not set local "+a.type+" in state "+b.signalingState));var c,d;if("offer"===a.type)c=k.splitSections(a.sdp),d=c.shift(),c.forEach(function(a,c){var d=k.parseRtpParameters(a);b.transceivers[c].localCapabilities=d}),b.transceivers.forEach(function(a,c){b._gather(a.mid,c)});else if("answer"===a.type){c=k.splitSections(b.remoteDescription.sdp),d=c.shift();var e=k.matchPrefix(d,"a=ice-lite").length>0;c.forEach(function(a,c){var f=b.transceivers[c],h=f.iceGatherer,i=f.iceTransport,j=f.dtlsTransport,l=f.localCapabilities,m=f.remoteCapabilities,n=k.isRejected(a)&&0===k.matchPrefix(a,"a=bundle-only").length;if(!n&&!f.rejected){var o=k.getIceParameters(a,d),p=k.getDtlsParameters(a,d);e&&(p.role="server"),b.usingBundle&&0!==c||(b._gather(f.mid,c),"new"===i.state&&i.start(h,o,e?"controlling":"controlled"),"new"===j.state&&j.start(p));var q=g(l,m);b._transceive(f,q.codecs.length>0,!1)}})}return b.localDescription={type:a.type,sdp:a.sdp},"offer"===a.type?b._updateSignalingState("have-local-offer"):b._updateSignalingState("stable"),Promise.resolve()},n.prototype.setRemoteDescription=function(d){var e=this;if(["offer","answer"].indexOf(d.type)===-1)return Promise.reject(j("TypeError",'Unsupported type "'+d.type+'"'));if(!h("setRemoteDescription",d.type,e.signalingState)||e._isClosed)return Promise.reject(j("InvalidStateError","Can not set remote "+d.type+" in state "+e.signalingState));var f={};e.remoteStreams.forEach(function(a){f[a.id]=a});var g=[],n=k.splitSections(d.sdp),o=n.shift(),p=k.matchPrefix(o,"a=ice-lite").length>0,q=k.matchPrefix(o,"a=group:BUNDLE ").length>0;e.usingBundle=q;var r=k.matchPrefix(o,"a=ice-options:")[0];return r?e.canTrickleIceCandidates=r.substr(14).split(" ").indexOf("trickle")>=0:e.canTrickleIceCandidates=!1,n.forEach(function(h,j){var m=k.splitLines(h),n=k.getKind(h),r=k.isRejected(h)&&0===k.matchPrefix(h,"a=bundle-only").length,s=m[0].substr(2).split(" ")[2],t=k.getDirection(h,o),u=k.parseMsid(h),v=k.getMid(h)||k.generateIdentifier();if("application"===n&&"DTLS/SCTP"===s||r)return void(e.transceivers[j]={mid:v,kind:n,rejected:!0});!r&&e.transceivers[j]&&e.transceivers[j].rejected&&(e.transceivers[j]=e._createTransceiver(n,!0));var w,x,y,z,A,B,C,D,E,F,G,H=k.parseRtpParameters(h);r||(F=k.getIceParameters(h,o),G=k.getDtlsParameters(h,o),G.role="client"),C=k.parseRtpEncodingParameters(h);var I=k.parseRtcpParameters(h),J=k.matchPrefix(h,"a=end-of-candidates",o).length>0,K=k.matchPrefix(h,"a=candidate:").map(function(a){return k.parseCandidate(a)}).filter(function(a){return 1===a.component});if(("offer"===d.type||"answer"===d.type)&&!r&&q&&j>0&&e.transceivers[j]&&(e._disposeIceAndDtlsTransports(j),e.transceivers[j].iceGatherer=e.transceivers[0].iceGatherer,e.transceivers[j].iceTransport=e.transceivers[0].iceTransport,e.transceivers[j].dtlsTransport=e.transceivers[0].dtlsTransport,e.transceivers[j].rtpSender&&e.transceivers[j].rtpSender.setTransport(e.transceivers[0].dtlsTransport),e.transceivers[j].rtpReceiver&&e.transceivers[j].rtpReceiver.setTransport(e.transceivers[0].dtlsTransport)),"offer"!==d.type||r)"answer"!==d.type||r||(w=e.transceivers[j],x=w.iceGatherer,y=w.iceTransport,z=w.dtlsTransport,A=w.rtpReceiver,B=w.sendEncodingParameters,D=w.localCapabilities,e.transceivers[j].recvEncodingParameters=C,e.transceivers[j].remoteCapabilities=H,e.transceivers[j].rtcpParameters=I,K.length&&"new"===y.state&&(!p&&!J||q&&0!==j?K.forEach(function(a){i(w.iceTransport,a)}):y.setRemoteCandidates(K)),q&&0!==j||("new"===y.state&&y.start(x,F,"controlling"),"new"===z.state&&z.start(G)),e._transceive(w,"sendrecv"===t||"recvonly"===t,"sendrecv"===t||"sendonly"===t),!A||"sendrecv"!==t&&"sendonly"!==t?delete w.rtpReceiver:(E=A.track,u?(f[u.stream]||(f[u.stream]=new a.MediaStream),c(E,f[u.stream]),g.push([E,A,f[u.stream]])):(f["default"]||(f["default"]=new a.MediaStream),c(E,f["default"]),g.push([E,A,f["default"]]))));else{w=e.transceivers[j]||e._createTransceiver(n),w.mid=v,w.iceGatherer||(w.iceGatherer=e._createIceGatherer(j,q)),K.length&&"new"===w.iceTransport.state&&(!J||q&&0!==j?K.forEach(function(a){i(w.iceTransport,a)}):w.iceTransport.setRemoteCandidates(K)),D=a.RTCRtpReceiver.getCapabilities(n),b<15019&&(D.codecs=D.codecs.filter(function(a){return"rtx"!==a.name})),B=w.sendEncodingParameters||[{ssrc:1001*(2*j+2)}];var L=!1;if("sendrecv"===t||"sendonly"===t){if(L=!w.rtpReceiver,A=w.rtpReceiver||new a.RTCRtpReceiver(w.dtlsTransport,n),L){var M;E=A.track,u&&"-"===u.stream||(u?(f[u.stream]||(f[u.stream]=new a.MediaStream,Object.defineProperty(f[u.stream],"id",{get:function(){return u.stream}})),Object.defineProperty(E,"id",{get:function(){return u.track}}),M=f[u.stream]):(f["default"]||(f["default"]=new a.MediaStream),M=f["default"])),M&&(c(E,M),w.associatedRemoteMediaStreams.push(M)),g.push([E,A,M])}}else w.rtpReceiver&&w.rtpReceiver.track&&(w.associatedRemoteMediaStreams.forEach(function(a){var b=a.getTracks().find(function(a){return a.id===w.rtpReceiver.track.id});b&&l(b,a)}),w.associatedRemoteMediaStreams=[]);w.localCapabilities=D,w.remoteCapabilities=H,w.rtpReceiver=A,w.rtcpParameters=I,w.sendEncodingParameters=B,w.recvEncodingParameters=C,e._transceive(e.transceivers[j],!1,L)}}),void 0===e._dtlsRole&&(e._dtlsRole="offer"===d.type?"active":"passive"),e.remoteDescription={type:d.type,sdp:d.sdp},"offer"===d.type?e._updateSignalingState("have-remote-offer"):e._updateSignalingState("stable"),Object.keys(f).forEach(function(b){var c=f[b];if(c.getTracks().length){if(e.remoteStreams.indexOf(c)===-1){e.remoteStreams.push(c);var d=new Event("addstream");d.stream=c,a.setTimeout(function(){e._dispatchEvent("addstream",d)})}g.forEach(function(a){var b=a[0],d=a[1];c.id===a[2].id&&m(e,b,d,[c])})}}),g.forEach(function(a){a[2]||m(e,a[0],a[1],[])}),a.setTimeout(function(){e&&e.transceivers&&e.transceivers.forEach(function(a){a.iceTransport&&"new"===a.iceTransport.state&&a.iceTransport.getRemoteCandidates().length>0&&(console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"),a.iceTransport.addRemoteCandidate({}))})},4e3),Promise.resolve()},n.prototype.close=function(){this.transceivers.forEach(function(a){a.iceTransport&&a.iceTransport.stop(),a.dtlsTransport&&a.dtlsTransport.stop(),a.rtpSender&&a.rtpSender.stop(),a.rtpReceiver&&a.rtpReceiver.stop()}),this._isClosed=!0,this._updateSignalingState("closed")},n.prototype._updateSignalingState=function(a){this.signalingState=a;var b=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",b)},n.prototype._maybeFireNegotiationNeeded=function(){var b=this;"stable"===this.signalingState&&this.needNegotiation!==!0&&(this.needNegotiation=!0,a.setTimeout(function(){if(b.needNegotiation){b.needNegotiation=!1;var a=new Event("negotiationneeded");b._dispatchEvent("negotiationneeded",a)}},0))},n.prototype._updateIceConnectionState=function(){var a,b={"new":0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach(function(a){b[a.iceTransport.state]++}),a="new",b.failed>0?a="failed":b.checking>0?a="checking":b.disconnected>0?a="disconnected":b["new"]>0?a="new":b.connected>0?a="connected":b.completed>0&&(a="completed"),a!==this.iceConnectionState){this.iceConnectionState=a;var c=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",c)}},n.prototype._updateConnectionState=function(){var a,b={"new":0,closed:0,connecting:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach(function(a){b[a.iceTransport.state]++,b[a.dtlsTransport.state]++}),b.connected+=b.completed,a="new",b.failed>0?a="failed":b.connecting>0?a="connecting":b.disconnected>0?a="disconnected":b["new"]>0?a="new":b.connected>0&&(a="connected"),a!==this.connectionState){this.connectionState=a;var c=new Event("connectionstatechange");this._dispatchEvent("connectionstatechange",c)}},n.prototype.createOffer=function(){var c=this;if(c._isClosed)return Promise.reject(j("InvalidStateError","Can not call createOffer after close"));var d=c.transceivers.filter(function(a){return"audio"===a.kind}).length,f=c.transceivers.filter(function(a){return"video"===a.kind}).length,g=arguments[0];if(g){if(g.mandatory||g.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");void 0!==g.offerToReceiveAudio&&(d=g.offerToReceiveAudio===!0?1:g.offerToReceiveAudio===!1?0:g.offerToReceiveAudio),void 0!==g.offerToReceiveVideo&&(f=g.offerToReceiveVideo===!0?1:g.offerToReceiveVideo===!1?0:g.offerToReceiveVideo)}for(c.transceivers.forEach(function(a){"audio"===a.kind?(d--,d<0&&(a.wantReceive=!1)):"video"===a.kind&&(f--,f<0&&(a.wantReceive=!1))});d>0||f>0;)d>0&&(c._createTransceiver("audio"),d--),f>0&&(c._createTransceiver("video"),f--);var h=k.writeSessionBoilerplate(c._sdpSessionId,c._sdpSessionVersion++);c.transceivers.forEach(function(d,e){var f=d.track,g=d.kind,h=d.mid||k.generateIdentifier();d.mid=h,d.iceGatherer||(d.iceGatherer=c._createIceGatherer(e,c.usingBundle));var i=a.RTCRtpSender.getCapabilities(g);b<15019&&(i.codecs=i.codecs.filter(function(a){return"rtx"!==a.name})),i.codecs.forEach(function(a){"H264"===a.name&&void 0===a.parameters["level-asymmetry-allowed"]&&(a.parameters["level-asymmetry-allowed"]="1"),d.remoteCapabilities&&d.remoteCapabilities.codecs&&d.remoteCapabilities.codecs.forEach(function(b){a.name.toLowerCase()===b.name.toLowerCase()&&a.clockRate===b.clockRate&&(a.preferredPayloadType=b.payloadType)})}),i.headerExtensions.forEach(function(a){var b=d.remoteCapabilities&&d.remoteCapabilities.headerExtensions||[];b.forEach(function(b){a.uri===b.uri&&(a.id=b.id)})});var j=d.sendEncodingParameters||[{ssrc:1001*(2*e+1)}];f&&b>=15019&&"video"===g&&!j[0].rtx&&(j[0].rtx={ssrc:j[0].ssrc+1}),d.wantReceive&&(d.rtpReceiver=new a.RTCRtpReceiver(d.dtlsTransport,g)),d.localCapabilities=i,d.sendEncodingParameters=j}),"max-compat"!==c._config.bundlePolicy&&(h+="a=group:BUNDLE "+c.transceivers.map(function(a){return a.mid}).join(" ")+"\r\n"),h+="a=ice-options:trickle\r\n",c.transceivers.forEach(function(a,b){h+=e(a,a.localCapabilities,"offer",a.stream,c._dtlsRole),h+="a=rtcp-rsize\r\n",!a.iceGatherer||"new"===c.iceGatheringState||0!==b&&c.usingBundle||(a.iceGatherer.getLocalCandidates().forEach(function(a){a.component=1,h+="a="+k.writeCandidate(a)+"\r\n"}),"completed"===a.iceGatherer.state&&(h+="a=end-of-candidates\r\n"))});var i=new a.RTCSessionDescription({type:"offer",sdp:h});return Promise.resolve(i)},n.prototype.createAnswer=function(){var c=this;if(c._isClosed)return Promise.reject(j("InvalidStateError","Can not call createAnswer after close"));if("have-remote-offer"!==c.signalingState&&"have-local-pranswer"!==c.signalingState)return Promise.reject(j("InvalidStateError","Can not call createAnswer in signalingState "+c.signalingState));var d=k.writeSessionBoilerplate(c._sdpSessionId,c._sdpSessionVersion++);c.usingBundle&&(d+="a=group:BUNDLE "+c.transceivers.map(function(a){return a.mid}).join(" ")+"\r\n");var f=k.getMediaSections(c.remoteDescription.sdp).length;c.transceivers.forEach(function(a,h){if(!(h+1>f)){if(a.rejected)return"application"===a.kind?d+="m=application 0 DTLS/SCTP 5000\r\n":"audio"===a.kind?d+="m=audio 0 UDP/TLS/RTP/SAVPF 0\r\na=rtpmap:0 PCMU/8000\r\n":"video"===a.kind&&(d+="m=video 0 UDP/TLS/RTP/SAVPF 120\r\na=rtpmap:120 VP8/90000\r\n"),void(d+="c=IN IP4 0.0.0.0\r\na=inactive\r\na=mid:"+a.mid+"\r\n");if(a.stream){var i;"audio"===a.kind?i=a.stream.getAudioTracks()[0]:"video"===a.kind&&(i=a.stream.getVideoTracks()[0]),i&&b>=15019&&"video"===a.kind&&!a.sendEncodingParameters[0].rtx&&(a.sendEncodingParameters[0].rtx={ssrc:a.sendEncodingParameters[0].ssrc+1})}var j=g(a.localCapabilities,a.remoteCapabilities),k=j.codecs.filter(function(a){return"rtx"===a.name.toLowerCase()}).length;!k&&a.sendEncodingParameters[0].rtx&&delete a.sendEncodingParameters[0].rtx,d+=e(a,j,"answer",a.stream,c._dtlsRole),a.rtcpParameters&&a.rtcpParameters.reducedSize&&(d+="a=rtcp-rsize\r\n")}});var h=new a.RTCSessionDescription({type:"answer",sdp:d});return Promise.resolve(h)},n.prototype.addIceCandidate=function(a){var b,c=this;return a&&void 0===a.sdpMLineIndex&&!a.sdpMid?Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")):new Promise(function(d,e){if(!c.remoteDescription)return e(j("InvalidStateError","Can not add ICE candidate without a remote description"));if(a&&""!==a.candidate){var f=a.sdpMLineIndex;if(a.sdpMid)for(var g=0;g0?k.parseCandidate(a.candidate):{};if("tcp"===l.protocol&&(0===l.port||9===l.port))return d();if(l.component&&1!==l.component)return d();if((0===f||f>0&&h.iceTransport!==c.transceivers[0].iceTransport)&&!i(h.iceTransport,l))return e(j("OperationError","Can not add ICE candidate"));var m=a.candidate.trim();0===m.indexOf("a=")&&(m=m.substr(2)),b=k.getMediaSections(c.remoteDescription.sdp),b[f]+="a="+(l.type?m:"end-of-candidates")+"\r\n",c.remoteDescription.sdp=k.getDescription(c.remoteDescription.sdp)+b.join("")}else for(var n=0;n0?"m="+a:a).trim()+"\r\n"})},d.getDescription=function(a){var b=d.splitSections(a);return b&&b[0]},d.getMediaSections=function(a){var b=d.splitSections(a);return b.shift(),b},d.matchPrefix=function(a,b){return d.splitLines(a).filter(function(a){return 0===a.indexOf(b)})},d.parseCandidate=function(a){var b;b=0===a.indexOf("a=candidate:")?a.substring(12).split(" "):a.substring(10).split(" ");for(var c={foundation:b[0],component:parseInt(b[1],10),protocol:b[2].toLowerCase(),priority:parseInt(b[3],10),ip:b[4],port:parseInt(b[5],10),type:b[7]},d=8;d0?b[0].split("/")[1]:"sendrecv",uri:b[1]}},d.writeExtmap=function(a){return"a=extmap:"+(a.id||a.preferredId)+(a.direction&&"sendrecv"!==a.direction?"/"+a.direction:"")+" "+a.uri+"\r\n"},d.parseFmtp=function(a){for(var b,c={},d=a.substr(a.indexOf(" ")+1).split(";"),e=0;e-1?(c.attribute=a.substr(b+1,d-b-1),c.value=a.substr(d+1)):c.attribute=a.substr(b+1),c},d.getMid=function(a){var b=d.matchPrefix(a,"a=mid:")[0];if(b)return b.substr(6)},d.parseFingerprint=function(a){var b=a.substr(14).split(" ");return{algorithm:b[0].toLowerCase(),value:b[1]}},d.getDtlsParameters=function(a,b){var c=d.matchPrefix(a+b,"a=fingerprint:");return{role:"auto",fingerprints:c.map(d.parseFingerprint)}},d.writeDtlsParameters=function(a,b){var c="a=setup:"+b+"\r\n";return a.fingerprints.forEach(function(a){c+="a=fingerprint:"+a.algorithm+" "+a.value+"\r\n"}),c},d.getIceParameters=function(a,b){var c=d.splitLines(a);c=c.concat(d.splitLines(b));var e={usernameFragment:c.filter(function(a){return 0===a.indexOf("a=ice-ufrag:")})[0].substr(12),password:c.filter(function(a){return 0===a.indexOf("a=ice-pwd:")})[0].substr(10)};return e},d.writeIceParameters=function(a){return"a=ice-ufrag:"+a.usernameFragment+"\r\na=ice-pwd:"+a.password+"\r\n"},d.parseRtpParameters=function(a){for(var b={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},c=d.splitLines(a),e=c[0].split(" "),f=3;f0?"9":"0",c+=" UDP/TLS/RTP/SAVPF ",c+=b.codecs.map(function(a){return void 0!==a.preferredPayloadType?a.preferredPayloadType:a.payloadType}).join(" ")+"\r\n",c+="c=IN IP4 0.0.0.0\r\n",c+="a=rtcp:9 IN IP4 0.0.0.0\r\n",b.codecs.forEach(function(a){c+=d.writeRtpMap(a),c+=d.writeFmtp(a),c+=d.writeRtcpFb(a)});var e=0;return b.codecs.forEach(function(a){a.maxptime>e&&(e=a.maxptime)}),e>0&&(c+="a=maxptime:"+e+"\r\n"),c+="a=rtcp-mux\r\n",b.headerExtensions&&b.headerExtensions.forEach(function(a){c+=d.writeExtmap(a)}),c},d.parseRtpEncodingParameters=function(a){var b,c=[],e=d.parseRtpParameters(a),f=e.fecMechanisms.indexOf("RED")!==-1,g=e.fecMechanisms.indexOf("ULPFEC")!==-1,h=d.matchPrefix(a,"a=ssrc:").map(function(a){return d.parseSsrcMedia(a)}).filter(function(a){return"cname"===a.attribute}),i=h.length>0&&h[0].ssrc,j=d.matchPrefix(a,"a=ssrc-group:FID").map(function(a){var b=a.substr(17).split(" ");return b.map(function(a){return parseInt(a,10)})});j.length>0&&j[0].length>1&&j[0][0]===i&&(b=j[0][1]),e.codecs.forEach(function(a){if("RTX"===a.name.toUpperCase()&&a.parameters.apt){var d={ssrc:i,codecPayloadType:parseInt(a.parameters.apt,10)};i&&b&&(d.rtx={ssrc:b}),c.push(d),f&&(d=JSON.parse(JSON.stringify(d)),d.fec={ssrc:b,mechanism:g?"red+ulpfec":"red"},c.push(d))}}),0===c.length&&i&&c.push({ssrc:i});var k=d.matchPrefix(a,"b=");return k.length&&(k=0===k[0].indexOf("b=TIAS:")?parseInt(k[0].substr(7),10):0===k[0].indexOf("b=AS:")?1e3*parseInt(k[0].substr(5),10)*.95-16e3:void 0,c.forEach(function(a){a.maxBitrate=k})),c},d.parseRtcpParameters=function(a){var b={},c=d.matchPrefix(a,"a=ssrc:").map(function(a){return d.parseSsrcMedia(a)}).filter(function(a){return"cname"===a.attribute})[0];c&&(b.cname=c.value,b.ssrc=c.ssrc);var e=d.matchPrefix(a,"a=rtcp-rsize");b.reducedSize=e.length>0,b.compound=0===e.length;var f=d.matchPrefix(a,"a=rtcp-mux");return b.mux=f.length>0,b},d.parseMsid=function(a){var b,c=d.matchPrefix(a,"a=msid:");if(1===c.length)return b=c[0].substr(7).split(" "),{stream:b[0],track:b[1]};var e=d.matchPrefix(a,"a=ssrc:").map(function(a){return d.parseSsrcMedia(a)}).filter(function(a){return"msid"===a.attribute});return e.length>0?(b=e[0].value.split(" "),{stream:b[0],track:b[1]}):void 0},d.generateSessionId=function(){return Math.random().toString().substr(2,21)},d.writeSessionBoilerplate=function(a,b){var c,e=void 0!==b?b:2;return c=a?a:d.generateSessionId(),"v=0\r\no=thisisadapterortc "+c+" "+e+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},d.writeMediaSection=function(a,b,c,e){var f=d.writeRtpDescription(a.kind,b);if(f+=d.writeIceParameters(a.iceGatherer.getLocalParameters()),f+=d.writeDtlsParameters(a.dtlsTransport.getLocalParameters(),"offer"===c?"actpass":"active"),f+="a=mid:"+a.mid+"\r\n",f+=a.direction?"a="+a.direction+"\r\n":a.rtpSender&&a.rtpReceiver?"a=sendrecv\r\n":a.rtpSender?"a=sendonly\r\n":a.rtpReceiver?"a=recvonly\r\n":"a=inactive\r\n",a.rtpSender){var g="msid:"+e.id+" "+a.rtpSender.track.id+"\r\n";f+="a="+g,f+="a=ssrc:"+a.sendEncodingParameters[0].ssrc+" "+g,a.sendEncodingParameters[0].rtx&&(f+="a=ssrc:"+a.sendEncodingParameters[0].rtx.ssrc+" "+g,f+="a=ssrc-group:FID "+a.sendEncodingParameters[0].ssrc+" "+a.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return f+="a=ssrc:"+a.sendEncodingParameters[0].ssrc+" cname:"+d.localCName+"\r\n",a.rtpSender&&a.sendEncodingParameters[0].rtx&&(f+="a=ssrc:"+a.sendEncodingParameters[0].rtx.ssrc+" cname:"+d.localCName+"\r\n"),f},d.getDirection=function(a,b){for(var c=d.splitLines(a),e=0;e0&&arguments[0]instanceof a.MediaStreamTrack){var c,d,e,f=arguments[0];return b.getSenders().forEach(function(a){a.track===f&&(c?e=!0:c=a)}),b.getReceivers().forEach(function(a){return a.track===f&&(d?e=!0:d=a),a.track===f}),e||c&&d?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):c?c.getStats():d?d.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return g.apply(b,arguments)}}}},shimSourceObject:function(a){var b=a&&a.URL;"object"==typeof a&&(!a.HTMLMediaElement||"srcObject"in a.HTMLMediaElement.prototype||Object.defineProperty(a.HTMLMediaElement.prototype,"srcObject",{get:function(){return this._srcObject},set:function(a){var c=this;return this._srcObject=a,this.src&&b.revokeObjectURL(this.src),a?(this.src=b.createObjectURL(a),a.addEventListener("addtrack",function(){c.src&&b.revokeObjectURL(c.src),c.src=b.createObjectURL(a)}),void a.addEventListener("removetrack",function(){c.src&&b.revokeObjectURL(c.src),c.src=b.createObjectURL(a)})):void(this.src="")}}))},shimAddTrackRemoveTrackWithNative:function(a){a.RTCPeerConnection.prototype.getLocalStreams=function(){var a=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(function(b){return a._shimmedLocalStreams[b][0]})};var b=a.RTCPeerConnection.prototype.addTrack;a.RTCPeerConnection.prototype.addTrack=function(a,c){if(!c)return b.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var d=b.apply(this,arguments);return this._shimmedLocalStreams[c.id]?this._shimmedLocalStreams[c.id].indexOf(d)===-1&&this._shimmedLocalStreams[c.id].push(d):this._shimmedLocalStreams[c.id]=[c,d],d};var c=a.RTCPeerConnection.prototype.addStream;a.RTCPeerConnection.prototype.addStream=function(a){var b=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},a.getTracks().forEach(function(a){var c=b.getSenders().find(function(b){return b.track===a});if(c)throw new DOMException("Track already exists.","InvalidAccessError")});var d=b.getSenders();c.apply(this,arguments);var e=b.getSenders().filter(function(a){return d.indexOf(a)===-1});this._shimmedLocalStreams[a.id]=[a].concat(e)};var d=a.RTCPeerConnection.prototype.removeStream;a.RTCPeerConnection.prototype.removeStream=function(a){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[a.id],d.apply(this,arguments)};var e=a.RTCPeerConnection.prototype.removeTrack;a.RTCPeerConnection.prototype.removeTrack=function(a){var b=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},a&&Object.keys(this._shimmedLocalStreams).forEach(function(c){var d=b._shimmedLocalStreams[c].indexOf(a);d!==-1&&b._shimmedLocalStreams[c].splice(d,1),1===b._shimmedLocalStreams[c].length&&delete b._shimmedLocalStreams[c]}),e.apply(this,arguments)}},shimAddTrackRemoveTrack:function(a){function b(a,b){var c=b.sdp;return Object.keys(a._reverseStreams||[]).forEach(function(b){var d=a._reverseStreams[b],e=a._streams[d.id];c=c.replace(new RegExp(e.id,"g"),d.id)}),new RTCSessionDescription({type:b.type,sdp:c})}function c(a,b){var c=b.sdp;return Object.keys(a._reverseStreams||[]).forEach(function(b){var d=a._reverseStreams[b],e=a._streams[d.id];c=c.replace(new RegExp(d.id,"g"),e.id)}),new RTCSessionDescription({type:b.type,sdp:c})}var d=f.detectBrowser(a);if(a.RTCPeerConnection.prototype.addTrack&&d.version>=65)return this.shimAddTrackRemoveTrackWithNative(a);var e=a.RTCPeerConnection.prototype.getLocalStreams;a.RTCPeerConnection.prototype.getLocalStreams=function(){var a=this,b=e.apply(this);return a._reverseStreams=a._reverseStreams||{},b.map(function(b){return a._reverseStreams[b.id]})};var g=a.RTCPeerConnection.prototype.addStream;a.RTCPeerConnection.prototype.addStream=function(b){var c=this;if(c._streams=c._streams||{},c._reverseStreams=c._reverseStreams||{},b.getTracks().forEach(function(a){var b=c.getSenders().find(function(b){return b.track===a});if(b)throw new DOMException("Track already exists.","InvalidAccessError")}),!c._reverseStreams[b.id]){var d=new a.MediaStream(b.getTracks());c._streams[b.id]=d,c._reverseStreams[d.id]=b,b=d}g.apply(c,[b])};var h=a.RTCPeerConnection.prototype.removeStream;a.RTCPeerConnection.prototype.removeStream=function(a){var b=this;b._streams=b._streams||{},b._reverseStreams=b._reverseStreams||{},h.apply(b,[b._streams[a.id]||a]),delete b._reverseStreams[b._streams[a.id]?b._streams[a.id].id:a.id],delete b._streams[a.id]},a.RTCPeerConnection.prototype.addTrack=function(b,c){var d=this;if("closed"===d.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var e=[].slice.call(arguments,1);if(1!==e.length||!e[0].getTracks().find(function(a){return a===b}))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");var f=d.getSenders().find(function(a){return a.track===b});if(f)throw new DOMException("Track already exists.","InvalidAccessError");d._streams=d._streams||{},d._reverseStreams=d._reverseStreams||{};var g=d._streams[c.id];if(g)g.addTrack(b),Promise.resolve().then(function(){d.dispatchEvent(new Event("negotiationneeded"))});else{var h=new a.MediaStream([b]);d._streams[c.id]=h,d._reverseStreams[h.id]=c,d.addStream(h)}return d.getSenders().find(function(a){return a.track===b})},["createOffer","createAnswer"].forEach(function(c){var d=a.RTCPeerConnection.prototype[c];a.RTCPeerConnection.prototype[c]=function(){var a=this,c=arguments,e=arguments.length&&"function"==typeof arguments[0];return e?d.apply(a,[function(d){var e=b(a,d);c[0].apply(null,[e])},function(a){c[1]&&c[1].apply(null,a)},arguments[2]]):d.apply(a,arguments).then(function(c){return b(a,c)})}});var i=a.RTCPeerConnection.prototype.setLocalDescription;a.RTCPeerConnection.prototype.setLocalDescription=function(){var a=this;return arguments.length&&arguments[0].type?(arguments[0]=c(a,arguments[0]),i.apply(a,arguments)):i.apply(a,arguments)};var j=Object.getOwnPropertyDescriptor(a.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(a.RTCPeerConnection.prototype,"localDescription",{get:function(){var a=this,c=j.get.apply(this);return""===c.type?c:b(a,c)}}),a.RTCPeerConnection.prototype.removeTrack=function(a){var b=this;if("closed"===b.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!a._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");var c=a._pc===b;if(!c)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");b._streams=b._streams||{};var d;Object.keys(b._streams).forEach(function(c){var e=b._streams[c].getTracks().find(function(b){return a.track===b});e&&(d=b._streams[c])}),d&&(1===d.getTracks().length?b.removeStream(b._reverseStreams[d.id]):d.removeTrack(a.track),b.dispatchEvent(new Event("negotiationneeded")))}},shimPeerConnection:function(a){var b=f.detectBrowser(a);if(!a.RTCPeerConnection&&a.webkitRTCPeerConnection)a.RTCPeerConnection=function(b,c){return g("PeerConnection"),b&&b.iceTransportPolicy&&(b.iceTransports=b.iceTransportPolicy),new a.webkitRTCPeerConnection(b,c)},a.RTCPeerConnection.prototype=a.webkitRTCPeerConnection.prototype,a.webkitRTCPeerConnection.generateCertificate&&Object.defineProperty(a.RTCPeerConnection,"generateCertificate",{get:function(){return a.webkitRTCPeerConnection.generateCertificate}});else{var c=a.RTCPeerConnection;a.RTCPeerConnection=function(a,b){if(a&&a.iceServers){for(var d=[],e=0;e0&&"function"==typeof a)return d.apply(this,arguments);if(0===d.length&&(0===arguments.length||"function"!=typeof arguments[0]))return d.apply(this,[]);var g=function(a){var b={},c=a.result();return c.forEach(function(a){var c={id:a.id,timestamp:a.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[a.type]||a.type};a.names().forEach(function(b){c[b]=a.stat(b)}),b[c.id]=c}),b},h=function(a){return new Map(Object.keys(a).map(function(b){return[b,a[b]]}))};if(arguments.length>=2){var i=function(a){f[1](h(g(a)))};return d.apply(this,[i,arguments[0]])}return new Promise(function(a,b){d.apply(e,[function(b){a(h(g(b)))},b])}).then(b,c)},b.version<51&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(b){var c=a.RTCPeerConnection.prototype[b];a.RTCPeerConnection.prototype[b]=function(){var a=arguments,b=this,d=new Promise(function(d,e){c.apply(b,[a[0],d,e])});return a.length<2?d:d.then(function(){a[1].apply(null,[])},function(b){a.length>=3&&a[2].apply(null,[b])})}}),b.version<52&&["createOffer","createAnswer"].forEach(function(b){var c=a.RTCPeerConnection.prototype[b];a.RTCPeerConnection.prototype[b]=function(){var a=this;if(arguments.length<1||1===arguments.length&&"object"==typeof arguments[0]){var b=1===arguments.length?arguments[0]:void 0;return new Promise(function(d,e){c.apply(a,[d,e,b])})}return c.apply(this,arguments)}}),["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(b){var c=a.RTCPeerConnection.prototype[b];a.RTCPeerConnection.prototype[b]=function(){return arguments[0]=new("addIceCandidate"===b?a.RTCIceCandidate:a.RTCSessionDescription)(arguments[0]),c.apply(this,arguments)}});var e=a.RTCPeerConnection.prototype.addIceCandidate;a.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?e.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())}}}},{"../utils.js":14,"./getusermedia":6}],6:[function(a,b,c){"use strict";var d=a("../utils.js"),e=d.log;b.exports=function(a){var b=d.detectBrowser(a),c=a&&a.navigator,f=function(a){if("object"!=typeof a||a.mandatory||a.optional)return a;var b={};return Object.keys(a).forEach(function(c){if("require"!==c&&"advanced"!==c&&"mediaSource"!==c){var d="object"==typeof a[c]?a[c]:{ideal:a[c]};void 0!==d.exact&&"number"==typeof d.exact&&(d.min=d.max=d.exact);var e=function(a,b){return a?a+b.charAt(0).toUpperCase()+b.slice(1):"deviceId"===b?"sourceId":b};if(void 0!==d.ideal){b.optional=b.optional||[];var f={};"number"==typeof d.ideal?(f[e("min",c)]=d.ideal,b.optional.push(f),f={},f[e("max",c)]=d.ideal,b.optional.push(f)):(f[e("",c)]=d.ideal,b.optional.push(f))}void 0!==d.exact&&"number"!=typeof d.exact?(b.mandatory=b.mandatory||{},b.mandatory[e("",c)]=d.exact):["min","max"].forEach(function(a){void 0!==d[a]&&(b.mandatory=b.mandatory||{},b.mandatory[e(a,c)]=d[a])})}}),a.advanced&&(b.optional=(b.optional||[]).concat(a.advanced)),b},g=function(a,d){if(b.version>=61)return d(a);if(a=JSON.parse(JSON.stringify(a)),a&&"object"==typeof a.audio){var g=function(a,b,c){b in a&&!(c in a)&&(a[c]=a[b],delete a[b])};a=JSON.parse(JSON.stringify(a)),g(a.audio,"autoGainControl","googAutoGainControl"),g(a.audio,"noiseSuppression","googNoiseSuppression"),a.audio=f(a.audio)}if(a&&"object"==typeof a.video){var h=a.video.facingMode;h=h&&("object"==typeof h?h:{ideal:h});var i=b.version<66;if(h&&("user"===h.exact||"environment"===h.exact||"user"===h.ideal||"environment"===h.ideal)&&(!c.mediaDevices.getSupportedConstraints||!c.mediaDevices.getSupportedConstraints().facingMode||i)){delete a.video.facingMode;var j;if("environment"===h.exact||"environment"===h.ideal?j=["back","rear"]:"user"!==h.exact&&"user"!==h.ideal||(j=["front"]),j)return c.mediaDevices.enumerateDevices().then(function(b){b=b.filter(function(a){return"videoinput"===a.kind});var c=b.find(function(a){return j.some(function(b){return a.label.toLowerCase().indexOf(b)!==-1})});return!c&&b.length&&j.indexOf("back")!==-1&&(c=b[b.length-1]),c&&(a.video.deviceId=h.exact?{exact:c.deviceId}:{ideal:c.deviceId}),a.video=f(a.video),e("chrome: "+JSON.stringify(a)),d(a)})}a.video=f(a.video)}return e("chrome: "+JSON.stringify(a)),d(a)},h=function(a){return{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[a.name]||a.name,message:a.message,constraint:a.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}},i=function(a,b,d){g(a,function(a){c.webkitGetUserMedia(a,b,function(a){d&&d(h(a))})})};c.getUserMedia=i;var j=function(a){return new Promise(function(b,d){c.getUserMedia(a,b,d)})};if(c.mediaDevices||(c.mediaDevices={getUserMedia:j,enumerateDevices:function(){return new Promise(function(b){var c={audio:"audioinput",video:"videoinput"};return a.MediaStreamTrack.getSources(function(a){b(a.map(function(a){return{label:a.label,kind:c[a.kind],deviceId:a.id,groupId:""}}))})})},getSupportedConstraints:function(){return{deviceId:!0,echoCancellation:!0,facingMode:!0,frameRate:!0,height:!0,width:!0}}}),c.mediaDevices.getUserMedia){var k=c.mediaDevices.getUserMedia.bind(c.mediaDevices);c.mediaDevices.getUserMedia=function(a){return g(a,function(a){return k(a).then(function(b){if(a.audio&&!b.getAudioTracks().length||a.video&&!b.getVideoTracks().length)throw b.getTracks().forEach(function(a){a.stop()}),new DOMException("","NotFoundError");return b},function(a){return Promise.reject(h(a))})})}}else c.mediaDevices.getUserMedia=function(a){return j(a)};"undefined"==typeof c.mediaDevices.addEventListener&&(c.mediaDevices.addEventListener=function(){e("Dummy mediaDevices.addEventListener called.")}),"undefined"==typeof c.mediaDevices.removeEventListener&&(c.mediaDevices.removeEventListener=function(){e("Dummy mediaDevices.removeEventListener called.")})}},{"../utils.js":14}],7:[function(a,b,c){"use strict";var d=a("sdp"),e=a("./utils");b.exports={shimRTCIceCandidate:function(a){if(a.RTCIceCandidate&&!(a.RTCIceCandidate&&"foundation"in a.RTCIceCandidate.prototype)){var b=a.RTCIceCandidate;a.RTCIceCandidate=function(a){if("object"==typeof a&&a.candidate&&0===a.candidate.indexOf("a=")&&(a=JSON.parse(JSON.stringify(a)),a.candidate=a.candidate.substr(2)),a.candidate&&a.candidate.length){var c=new b(a),e=d.parseCandidate(a.candidate),f=Object.assign(c,e);return f.toJSON=function(){return{candidate:f.candidate,sdpMid:f.sdpMid,sdpMLineIndex:f.sdpMLineIndex,usernameFragment:f.usernameFragment}},f}return new b(a)},a.RTCIceCandidate.prototype=b.prototype,e.wrapPeerConnectionEvent(a,"icecandidate",function(b){return b.candidate&&Object.defineProperty(b,"candidate",{value:new a.RTCIceCandidate(b.candidate),writable:"false"}),b})}},shimCreateObjectURL:function(a){var b=a&&a.URL;if("object"==typeof a&&a.HTMLMediaElement&&"srcObject"in a.HTMLMediaElement.prototype&&b.createObjectURL&&b.revokeObjectURL){var c=b.createObjectURL.bind(b),d=b.revokeObjectURL.bind(b),f=new Map,g=0;b.createObjectURL=function(a){if("getTracks"in a){var b="polyblob:"+ ++g;return f.set(b,a),e.deprecated("URL.createObjectURL(stream)","elem.srcObject = stream"),b}return c(a)},b.revokeObjectURL=function(a){d(a),f["delete"](a)};var h=Object.getOwnPropertyDescriptor(a.HTMLMediaElement.prototype,"src");Object.defineProperty(a.HTMLMediaElement.prototype,"src",{get:function(){return h.get.apply(this)},set:function(a){return this.srcObject=f.get(a)||null,h.set.apply(this,[a])}});var i=a.HTMLMediaElement.prototype.setAttribute;a.HTMLMediaElement.prototype.setAttribute=function(){return 2===arguments.length&&"src"===(""+arguments[0]).toLowerCase()&&(this.srcObject=f.get(arguments[1])||null),i.apply(this,arguments)}}},shimMaxMessageSize:function(a){if(!a.RTCSctpTransport&&a.RTCPeerConnection){var b=e.detectBrowser(a);"sctp"in a.RTCPeerConnection.prototype||Object.defineProperty(a.RTCPeerConnection.prototype,"sctp",{get:function(){return"undefined"==typeof this._sctp?null:this._sctp}});var c=function(a){var b=d.splitSections(a.sdp);return b.shift(),b.some(function(a){var b=d.parseMLine(a);return b&&"application"===b.kind&&b.protocol.indexOf("SCTP")!==-1})},f=function(a){var b=a.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===b||b.length<2)return-1;var c=parseInt(b[1],10);return c!==c?-1:c},g=function(a){var c=65536;return"firefox"===b.browser&&(c=b.version<57?a===-1?16384:2147483637:b.version<60?57===b.version?65535:65536:2147483637),c},h=function(a,c){var e=65536;"firefox"===b.browser&&57===b.version&&(e=65535);var f=d.matchPrefix(a.sdp,"a=max-message-size:");return f.length>0?e=parseInt(f[0].substr(19),10):"firefox"===b.browser&&c!==-1&&(e=2147483637),e},i=a.RTCPeerConnection.prototype.setRemoteDescription;a.RTCPeerConnection.prototype.setRemoteDescription=function(){var a=this;if(a._sctp=null,c(arguments[0])){var b,d=f(arguments[0]),e=g(d),j=h(arguments[0],d);b=0===e&&0===j?Number.POSITIVE_INFINITY:0===e||0===j?Math.max(e,j):Math.min(e,j);var k={};Object.defineProperty(k,"maxMessageSize",{get:function(){return b}}),a._sctp=k}return i.apply(a,arguments)}}},shimSendThrowTypeError:function(a){function b(a,b){var c=a.send;a.send=function(){var d=arguments[0],e=d.length||d.size||d.byteLength;if("open"===a.readyState&&b.sctp&&e>b.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+b.sctp.maxMessageSize+" bytes)"); -return c.apply(a,arguments)}}if(a.RTCPeerConnection&&"createDataChannel"in a.RTCPeerConnection.prototype){var c=a.RTCPeerConnection.prototype.createDataChannel;a.RTCPeerConnection.prototype.createDataChannel=function(){var a=this,d=c.apply(a,arguments);return b(d,a),d},e.wrapPeerConnectionEvent(a,"datachannel",function(a){return b(a.channel,a.target),a})}}}},{"./utils":14,sdp:2}],8:[function(a,b,c){"use strict";var d=a("../utils"),e=a("./filtericeservers"),f=a("rtcpeerconnection-shim");b.exports={shimGetUserMedia:a("./getusermedia"),shimPeerConnection:function(a){var b=d.detectBrowser(a);if(a.RTCIceGatherer&&(a.RTCIceCandidate||(a.RTCIceCandidate=function(a){return a}),a.RTCSessionDescription||(a.RTCSessionDescription=function(a){return a}),b.version<15025)){var c=Object.getOwnPropertyDescriptor(a.MediaStreamTrack.prototype,"enabled");Object.defineProperty(a.MediaStreamTrack.prototype,"enabled",{set:function(a){c.set.call(this,a);var b=new Event("enabled");b.enabled=a,this.dispatchEvent(b)}})}!a.RTCRtpSender||"dtmf"in a.RTCRtpSender.prototype||Object.defineProperty(a.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=new a.RTCDtmfSender(this):"video"===this.track.kind&&(this._dtmf=null)),this._dtmf}}),a.RTCDtmfSender&&!a.RTCDTMFSender&&(a.RTCDTMFSender=a.RTCDtmfSender);var g=f(a,b.version);a.RTCPeerConnection=function(a){return a&&a.iceServers&&(a.iceServers=e(a.iceServers)),new g(a)},a.RTCPeerConnection.prototype=g.prototype},shimReplaceTrack:function(a){!a.RTCRtpSender||"replaceTrack"in a.RTCRtpSender.prototype||(a.RTCRtpSender.prototype.replaceTrack=a.RTCRtpSender.prototype.setTrack)}}},{"../utils":14,"./filtericeservers":9,"./getusermedia":10,"rtcpeerconnection-shim":1}],9:[function(a,b,c){"use strict";var d=a("../utils");b.exports=function(a,b){var c=!1;return a=JSON.parse(JSON.stringify(a)),a.filter(function(a){if(a&&(a.urls||a.url)){var e=a.urls||a.url;a.url&&!a.urls&&d.deprecated("RTCIceServer.url","RTCIceServer.urls");var f="string"==typeof e;return f&&(e=[e]),e=e.filter(function(a){var d=0===a.indexOf("turn:")&&a.indexOf("transport=udp")!==-1&&a.indexOf("turn:[")===-1&&!c;return d?(c=!0,!0):0===a.indexOf("stun:")&&b>=14393&&a.indexOf("?transport=udp")===-1}),delete a.url,a.urls=f?e[0]:e,!!e.length}})}},{"../utils":14}],10:[function(a,b,c){"use strict";b.exports=function(a){var b=a&&a.navigator,c=function(a){return{name:{PermissionDeniedError:"NotAllowedError"}[a.name]||a.name,message:a.message,constraint:a.constraint,toString:function(){return this.name}}},d=b.mediaDevices.getUserMedia.bind(b.mediaDevices);b.mediaDevices.getUserMedia=function(a){return d(a)["catch"](function(a){return Promise.reject(c(a))})}}},{}],11:[function(a,b,c){"use strict";var d=a("../utils");b.exports={shimGetUserMedia:a("./getusermedia"),shimOnTrack:function(a){"object"!=typeof a||!a.RTCPeerConnection||"ontrack"in a.RTCPeerConnection.prototype||Object.defineProperty(a.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(a){this._ontrack&&(this.removeEventListener("track",this._ontrack),this.removeEventListener("addstream",this._ontrackpoly)),this.addEventListener("track",this._ontrack=a),this.addEventListener("addstream",this._ontrackpoly=function(a){a.stream.getTracks().forEach(function(b){var c=new Event("track");c.track=b,c.receiver={track:b},c.transceiver={receiver:c.receiver},c.streams=[a.stream],this.dispatchEvent(c)}.bind(this))}.bind(this))}}),"object"==typeof a&&a.RTCTrackEvent&&"receiver"in a.RTCTrackEvent.prototype&&!("transceiver"in a.RTCTrackEvent.prototype)&&Object.defineProperty(a.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})},shimSourceObject:function(a){"object"==typeof a&&(!a.HTMLMediaElement||"srcObject"in a.HTMLMediaElement.prototype||Object.defineProperty(a.HTMLMediaElement.prototype,"srcObject",{get:function(){return this.mozSrcObject},set:function(a){this.mozSrcObject=a}}))},shimPeerConnection:function(a){var b=d.detectBrowser(a);if("object"==typeof a&&(a.RTCPeerConnection||a.mozRTCPeerConnection)){a.RTCPeerConnection||(a.RTCPeerConnection=function(c,d){if(b.version<38&&c&&c.iceServers){for(var e=[],f=0;f55&&"autoGainControl"in c.mediaDevices.getSupportedConstraints())){var l=function(a,b,c){b in a&&!(c in a)&&(a[c]=a[b],delete a[b])},m=c.mediaDevices.getUserMedia.bind(c.mediaDevices);if(c.mediaDevices.getUserMedia=function(a){return"object"==typeof a&&"object"==typeof a.audio&&(a=JSON.parse(JSON.stringify(a)),l(a.audio,"autoGainControl","mozAutoGainControl"),l(a.audio,"noiseSuppression","mozNoiseSuppression")),m(a)},f&&f.prototype.getSettings){var n=f.prototype.getSettings;f.prototype.getSettings=function(){var a=n.apply(this,arguments);return l(a,"mozAutoGainControl","autoGainControl"),l(a,"mozNoiseSuppression","noiseSuppression"),a}}if(f&&f.prototype.applyConstraints){var o=f.prototype.applyConstraints;f.prototype.applyConstraints=function(a){return"audio"===this.kind&&"object"==typeof a&&(a=JSON.parse(JSON.stringify(a)),l(a,"autoGainControl","mozAutoGainControl"),l(a,"noiseSuppression","mozNoiseSuppression")),o.apply(this,[a])}}}c.getUserMedia=function(a,e,f){return b.version<44?h(a,e,f):(d.deprecated("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),void c.mediaDevices.getUserMedia(a).then(e,f))}}},{"../utils":14}],13:[function(a,b,c){"use strict";var d=a("../utils");b.exports={shimLocalStreamsAPI:function(a){if("object"==typeof a&&a.RTCPeerConnection){if("getLocalStreams"in a.RTCPeerConnection.prototype||(a.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),"getStreamById"in a.RTCPeerConnection.prototype||(a.RTCPeerConnection.prototype.getStreamById=function(a){var b=null;return this._localStreams&&this._localStreams.forEach(function(c){c.id===a&&(b=c)}),this._remoteStreams&&this._remoteStreams.forEach(function(c){c.id===a&&(b=c)}),b}),!("addStream"in a.RTCPeerConnection.prototype)){var b=a.RTCPeerConnection.prototype.addTrack;a.RTCPeerConnection.prototype.addStream=function(a){this._localStreams||(this._localStreams=[]),this._localStreams.indexOf(a)===-1&&this._localStreams.push(a);var c=this;a.getTracks().forEach(function(d){b.call(c,d,a)})},a.RTCPeerConnection.prototype.addTrack=function(a,c){return c&&(this._localStreams?this._localStreams.indexOf(c)===-1&&this._localStreams.push(c):this._localStreams=[c]),b.call(this,a,c)}}"removeStream"in a.RTCPeerConnection.prototype||(a.RTCPeerConnection.prototype.removeStream=function(a){this._localStreams||(this._localStreams=[]);var b=this._localStreams.indexOf(a);if(b!==-1){this._localStreams.splice(b,1);var c=this,d=a.getTracks();this.getSenders().forEach(function(a){d.indexOf(a.track)!==-1&&c.removeTrack(a)})}})}},shimRemoteStreamsAPI:function(a){"object"==typeof a&&a.RTCPeerConnection&&("getRemoteStreams"in a.RTCPeerConnection.prototype||(a.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),"onaddstream"in a.RTCPeerConnection.prototype||Object.defineProperty(a.RTCPeerConnection.prototype,"onaddstream",{get:function(){return this._onaddstream},set:function(a){var b=this;this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=a),this.addEventListener("track",this._onaddstreampoly=function(a){a.streams.forEach(function(a){if(b._remoteStreams||(b._remoteStreams=[]),!(b._remoteStreams.indexOf(a)>=0)){b._remoteStreams.push(a);var c=new Event("addstream");c.stream=a,b.dispatchEvent(c)}})})}}))},shimCallbacksAPI:function(a){if("object"==typeof a&&a.RTCPeerConnection){var b=a.RTCPeerConnection.prototype,c=b.createOffer,d=b.createAnswer,e=b.setLocalDescription,f=b.setRemoteDescription,g=b.addIceCandidate;b.createOffer=function(a,b){var d=arguments.length>=2?arguments[2]:arguments[0],e=c.apply(this,[d]);return b?(e.then(a,b),Promise.resolve()):e},b.createAnswer=function(a,b){var c=arguments.length>=2?arguments[2]:arguments[0],e=d.apply(this,[c]);return b?(e.then(a,b),Promise.resolve()):e};var h=function(a,b,c){var d=e.apply(this,[a]);return c?(d.then(b,c),Promise.resolve()):d};b.setLocalDescription=h,h=function(a,b,c){var d=f.apply(this,[a]);return c?(d.then(b,c),Promise.resolve()):d},b.setRemoteDescription=h,h=function(a,b,c){var d=g.apply(this,[a]);return c?(d.then(b,c),Promise.resolve()):d},b.addIceCandidate=h}},shimGetUserMedia:function(a){var b=a&&a.navigator;b.getUserMedia||(b.webkitGetUserMedia?b.getUserMedia=b.webkitGetUserMedia.bind(b):b.mediaDevices&&b.mediaDevices.getUserMedia&&(b.getUserMedia=function(a,c,d){b.mediaDevices.getUserMedia(a).then(c,d)}.bind(b)))},shimRTCIceServerUrls:function(a){var b=a.RTCPeerConnection;a.RTCPeerConnection=function(a,c){if(a&&a.iceServers){for(var e=[],f=0;f=c&&parseInt(d[c],10)}function e(a,b,c){if(a.RTCPeerConnection){var d=a.RTCPeerConnection.prototype,e=d.addEventListener;d.addEventListener=function(a,d){if(a!==b)return e.apply(this,arguments);var f=function(a){d(c(a))};return this._eventMap=this._eventMap||{},this._eventMap[d]=f,e.apply(this,[a,f])};var f=d.removeEventListener;d.removeEventListener=function(a,c){if(a!==b||!this._eventMap||!this._eventMap[c])return f.apply(this,arguments);var d=this._eventMap[c];return delete this._eventMap[c],f.apply(this,[a,d])},Object.defineProperty(d,"on"+b,{get:function(){return this["_on"+b]},set:function(a){this["_on"+b]&&(this.removeEventListener(b,this["_on"+b]),delete this["_on"+b]),a&&this.addEventListener(b,this["_on"+b]=a)},enumerable:!0,configurable:!0})}}var f=!0,g=!0;b.exports={extractVersion:d,wrapPeerConnectionEvent:e,disableLog:function(a){return"boolean"!=typeof a?new Error("Argument type: "+typeof a+". Please use a boolean."):(f=a,a?"adapter.js logging disabled":"adapter.js logging enabled")},disableWarnings:function(a){return"boolean"!=typeof a?new Error("Argument type: "+typeof a+". Please use a boolean."):(g=!a,"adapter.js deprecation warnings "+(a?"disabled":"enabled"))},log:function(){if("object"==typeof window){if(f)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}},deprecated:function(a,b){g&&console.warn(a+" is deprecated, please use "+b+" instead.")},detectBrowser:function(a){var b=a&&a.navigator,c={};if(c.browser=null,c.version=null,"undefined"==typeof a||!a.navigator)return c.browser="Not a browser.",c;if(b.mozGetUserMedia)c.browser="firefox",c.version=d(b.userAgent,/Firefox\/(\d+)\./,1);else if(b.webkitGetUserMedia)c.browser="chrome",c.version=d(b.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(b.mediaDevices&&b.userAgent.match(/Edge\/(\d+).(\d+)$/))c.browser="edge",c.version=d(b.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!a.RTCPeerConnection||!b.userAgent.match(/AppleWebKit\/(\d+)\./))return c.browser="Not a supported browser.",c;c.browser="safari",c.version=d(b.userAgent,/AppleWebKit\/(\d+)\./,1)}return c}}},{}]},{},[3])(3)}); \ No newline at end of file +function _typeof(e){if("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator){_typeof=function(e){return typeof e}}else{_typeof=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e}}return _typeof(e)}(function(e){if("object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module){module.exports=e()}else if("function"==typeof define&&define.amd){define ("filter_poodll/adapter",[],e)}else{var t;if("undefined"!=typeof window){t=window}else if("undefined"!=typeof global){t=global}else if("undefined"!=typeof self){t=self}else{t=this}t.adapter=e()}})(function(){return function c(d,e,t){function r(i,o){if(!e[i]){if(!d[i]){var s="function"==typeof require&&require;if(!o&&s)return s(i,!0);if(n)return n(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=e[i]={exports:{}};d[i][0].call(p.exports,function(t){var e=d[i][1][t];return r(e?e:t)},p,p.exports,c,d,e,t)}return e[i].exports}for(var n="function"==typeof require&&require,a=0;at){e.recvEncodingParameters.forEach(function(e){delete e.rtx})}if(e.recvEncodingParameters.length){n.encodings=e.recvEncodingParameters}else{n.encodings=[{}]}n.rtcp={compound:e.rtcpParameters.compound};if(e.rtcpParameters.cname){n.rtcp.cname=e.rtcpParameters.cname}if(e.sendEncodingParameters.length){n.rtcp.ssrc=e.sendEncodingParameters[0].ssrc}e.rtpReceiver.receive(n)}};h.prototype.setLocalDescription=function(e){var t=this;if(-1===["offer","answer"].indexOf(e.type)){return Promise.reject(c("TypeError","Unsupported type \""+e.type+"\""))}if(!o("setLocalDescription",e.type,t.signalingState)||t._isClosed){return Promise.reject(c("InvalidStateError","Can not set local "+e.type+" in state "+t.signalingState))}var r,a;if("offer"===e.type){r=d.splitSections(e.sdp);a=r.shift();r.forEach(function(e,r){var a=d.parseRtpParameters(e);t.transceivers[r].localCapabilities=a});t.transceivers.forEach(function(e,r){t._gather(e.mid,r)})}else if("answer"===e.type){r=d.splitSections(t.remoteDescription.sdp);a=r.shift();var n=0t){M.codecs=M.codecs.filter(function(e){return"rtx"!==e.name})}_=R.sendEncodingParameters||[{ssrc:1001*(2*c+2)}];var U=!1;if("sendrecv"===u||"sendonly"===u){U=!R.rtpReceiver;b=R.rtpReceiver||new e.RTCRtpReceiver(R.dtlsTransport,h);if(U){var G;L=b.track;if(T&&"-"===T.stream){}else if(T){if(!n[T.stream]){n[T.stream]=new e.MediaStream;Object.defineProperty(n[T.stream],"id",{get:function get(){return T.stream}})}Object.defineProperty(L,"id",{get:function get(){return T.track}});G=n[T.stream]}else{if(!n.default){n.default=new e.MediaStream}G=n.default}if(G){p(L,G);R.associatedRemoteMediaStreams.push(G)}i.push([L,b,G])}}else if(R.rtpReceiver&&R.rtpReceiver.track){R.associatedRemoteMediaStreams.forEach(function(e){var t=e.getTracks().find(function(e){return e.id===R.rtpReceiver.track.id});if(t){m(t,e)}});R.associatedRemoteMediaStreams=[]}R.localCapabilities=M;R.remoteCapabilities=I;R.rtpReceiver=b;R.rtcpParameters=j;R.sendEncodingParameters=_;R.recvEncodingParameters=x;a._transceive(a.transceivers[c],!1,U)}else if("answer"===r.type&&!v){R=a.transceivers[c];P=R.iceGatherer;E=R.iceTransport;k=R.dtlsTransport;b=R.rtpReceiver;_=R.sendEncodingParameters;M=R.localCapabilities;a.transceivers[c].recvEncodingParameters=x;a.transceivers[c].remoteCapabilities=I;a.transceivers[c].rtcpParameters=j;if(A.length&&"new"===E.state){if((f||O)&&(!C||0===c)){E.setRemoteCandidates(A)}else{A.forEach(function(e){s(R.iceTransport,e)})}}if(!C||0===c){if("new"===E.state){E.start(P,D,"controlling")}if("new"===k.state){k.start(w)}}a._transceive(R,"sendrecv"===u||"recvonly"===u,"sendrecv"===u||"sendonly"===u);if(b&&("sendrecv"===u||"sendonly"===u)){L=b.track;if(T){if(!n[T.stream]){n[T.stream]=new e.MediaStream}p(L,n[T.stream]);i.push([L,b,n[T.stream]])}else{if(!n.default){n.default=new e.MediaStream}p(L,n.default);i.push([L,b,n.default])}}else{delete R.rtpReceiver}}});if(a._dtlsRole===void 0){a._dtlsRole="offer"===r.type?"active":"passive"}a.remoteDescription={type:r.type,sdp:r.sdp};if("offer"===r.type){a._updateSignalingState("have-remote-offer")}else{a._updateSignalingState("stable")}Object.keys(n).forEach(function(t){var r=n[t];if(r.getTracks().length){if(-1===a.remoteStreams.indexOf(r)){a.remoteStreams.push(r);var o=new Event("addstream");o.stream=r;e.setTimeout(function(){a._dispatchEvent("addstream",o)})}i.forEach(function(e){var t=e[0],n=e[1];if(r.id!==e[2].id){return}l(a,t,n,[r])})}});i.forEach(function(e){if(e[2]){return}l(a,e[0],e[1],[])});e.setTimeout(function(){if(!(a&&a.transceivers)){return}a.transceivers.forEach(function(e){if(e.iceTransport&&"new"===e.iceTransport.state&&0n){e.wantReceive=!1}}else if("video"===e.kind){i--;if(0>i){e.wantReceive=!1}}});while(0t){c.codecs=c.codecs.filter(function(e){return"rtx"!==e.name})}c.codecs.forEach(function(e){if("H264"===e.name&&e.parameters["level-asymmetry-allowed"]===void 0){e.parameters["level-asymmetry-allowed"]="1"}if(a.remoteCapabilities&&a.remoteCapabilities.codecs){a.remoteCapabilities.codecs.forEach(function(t){if(e.name.toLowerCase()===t.name.toLowerCase()&&e.clockRate===t.clockRate){e.preferredPayloadType=t.payloadType}})}});c.headerExtensions.forEach(function(e){var t=a.remoteCapabilities&&a.remoteCapabilities.headerExtensions||[];t.forEach(function(t){if(e.uri===t.uri){e.id=t.id}})});var p=a.sendEncodingParameters||[{ssrc:1001*(2*n+1)}];if(i){if(15019<=t&&"video"===o&&!p[0].rtx){p[0].rtx={ssrc:p[0].ssrc+1}}}if(a.wantReceive){a.rtpReceiver=new e.RTCRtpReceiver(a.dtlsTransport,o)}a.localCapabilities=c;a.sendEncodingParameters=p});if("max-compat"!==r._config.bundlePolicy){s+="a=group:BUNDLE "+r.transceivers.map(function(e){return e.mid}).join(" ")+"\r\n"}s+="a=ice-options:trickle\r\n";r.transceivers.forEach(function(e,t){s+=a(e,e.localCapabilities,"offer",e.stream,r._dtlsRole);s+="a=rtcp-rsize\r\n";if(e.iceGatherer&&"new"!==r.iceGatheringState&&(0===t||!r.usingBundle)){e.iceGatherer.getLocalCandidates().forEach(function(e){e.component=1;s+="a="+d.writeCandidate(e)+"\r\n"});if("completed"===e.iceGatherer.state){s+="a=end-of-candidates\r\n"}}});var p=new e.RTCSessionDescription({type:"offer",sdp:s});return Promise.resolve(p)};h.prototype.createAnswer=function(){var r=this;if(r._isClosed){return Promise.reject(c("InvalidStateError","Can not call createAnswer after close"))}if(!("have-remote-offer"===r.signalingState||"have-local-pranswer"===r.signalingState)){return Promise.reject(c("InvalidStateError","Can not call createAnswer in signalingState "+r.signalingState))}var n=d.writeSessionBoilerplate(r._sdpSessionId,r._sdpSessionVersion++);if(r.usingBundle){n+="a=group:BUNDLE "+r.transceivers.map(function(e){return e.mid}).join(" ")+"\r\n"}var o=d.getMediaSections(r.remoteDescription.sdp).length;r.transceivers.forEach(function(e,s){if(s+1>o){return}if(e.rejected){if("application"===e.kind){n+="m=application 0 DTLS/SCTP 5000\r\n"}else if("audio"===e.kind){n+="m=audio 0 UDP/TLS/RTP/SAVPF 0\r\na=rtpmap:0 PCMU/8000\r\n"}else if("video"===e.kind){n+="m=video 0 UDP/TLS/RTP/SAVPF 120\r\na=rtpmap:120 VP8/90000\r\n"}n+="c=IN IP4 0.0.0.0\r\na=inactive\r\na=mid:"+e.mid+"\r\n";return}if(e.stream){var c;if("audio"===e.kind){c=e.stream.getAudioTracks()[0]}else if("video"===e.kind){c=e.stream.getVideoTracks()[0]}if(c){if(15019<=t&&"video"===e.kind&&!e.sendEncodingParameters[0].rtx){e.sendEncodingParameters[0].rtx={ssrc:e.sendEncodingParameters[0].ssrc+1}}}}var d=i(e.localCapabilities,e.remoteCapabilities),p=d.codecs.filter(function(e){return"rtx"===e.name.toLowerCase()}).length;if(!p&&e.sendEncodingParameters[0].rtx){delete e.sendEncodingParameters[0].rtx}n+=a(e,d,"answer",e.stream,r._dtlsRole);if(e.rtcpParameters&&e.rtcpParameters.reducedSize){n+="a=rtcp-rsize\r\n"}});var s=new e.RTCSessionDescription({type:"answer",sdp:n});return Promise.resolve(s)};h.prototype.addIceCandidate=function(e){var t=this,r;if(e&&!(e.sdpMLineIndex!==void 0||e.sdpMid)){return Promise.reject(new TypeError("sdpMLineIndex or sdpMid required"))}return new Promise(function(a,n){if(!t.remoteDescription){return n(c("InvalidStateError","Can not add ICE candidate without a remote description"))}else if(!e||""===e.candidate){for(var o=0;on){n=e.maxptime}});if(0t.version){["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){var r=e.RTCPeerConnection.prototype[t];e.RTCPeerConnection.prototype[t]=function(){var e=arguments,t=this,a=new Promise(function(a,n){r.apply(t,[e[0],a,n])});if(2>e.length){return a}return a.then(function(){e[1].apply(null,[])},function(t){if(3<=e.length){e[2].apply(null,[t])}})}})}if(52>t.version){["createOffer","createAnswer"].forEach(function(t){var r=e.RTCPeerConnection.prototype[t];e.RTCPeerConnection.prototype[t]=function(){var e=this;if(1>arguments.length||1===arguments.length&&"object"===_typeof(arguments[0])){var t=1===arguments.length?arguments[0]:void 0;return new Promise(function(a,n){r.apply(e,[a,n,t])})}return r.apply(this,arguments)}})}["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){var r=e.RTCPeerConnection.prototype[t];e.RTCPeerConnection.prototype[t]=function(){arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]);return r.apply(this,arguments)}});var o=e.RTCPeerConnection.prototype.addIceCandidate;e.RTCPeerConnection.prototype.addIceCandidate=function(){if(!arguments[0]){if(arguments[1]){arguments[1].apply(null)}return Promise.resolve()}return o.apply(this,arguments)}}}},{"../utils.js":14,"./getusermedia":6}],6:[function(e,t){'use strict';var r=e("../utils.js"),a=r.log;t.exports=function(e){var t=r.detectBrowser(e),n=e&&e.navigator,i=function(e){if("object"!==_typeof(e)||e.mandatory||e.optional){return e}var t={};Object.keys(e).forEach(function(a){if("require"===a||"advanced"===a||"mediaSource"===a){return}var n="object"===_typeof(e[a])?e[a]:{ideal:e[a]};if(n.exact!==void 0&&"number"==typeof n.exact){n.min=n.max=n.exact}var r=function(e,t){if(e){return e+t.charAt(0).toUpperCase()+t.slice(1)}return"deviceId"===t?"sourceId":t};if(n.ideal!==void 0){t.optional=t.optional||[];var i={};if("number"==typeof n.ideal){i[r("min",a)]=n.ideal;t.optional.push(i);i={};i[r("max",a)]=n.ideal;t.optional.push(i)}else{i[r("",a)]=n.ideal;t.optional.push(i)}}if(n.exact!==void 0&&"number"!=typeof n.exact){t.mandatory=t.mandatory||{};t.mandatory[r("",a)]=n.exact}else{["min","max"].forEach(function(e){if(n[e]!==void 0){t.mandatory=t.mandatory||{};t.mandatory[r(e,a)]=n[e]}})}});if(e.advanced){t.optional=(t.optional||[]).concat(e.advanced)}return t},o=function(e,r){if(61<=t.version){return r(e)}e=JSON.parse(JSON.stringify(e));if(e&&"object"===_typeof(e.audio)){var o=function(e,t,r){if(t in e&&!(r in e)){e[r]=e[t];delete e[t]}};e=JSON.parse(JSON.stringify(e));o(e.audio,"autoGainControl","googAutoGainControl");o(e.audio,"noiseSuppression","googNoiseSuppression");e.audio=i(e.audio)}if(e&&"object"===_typeof(e.video)){var s=e.video.facingMode;s=s&&("object"===_typeof(s)?s:{ideal:s});var c=66>t.version;if(s&&("user"===s.exact||"environment"===s.exact||"user"===s.ideal||"environment"===s.ideal)&&!(n.mediaDevices.getSupportedConstraints&&n.mediaDevices.getSupportedConstraints().facingMode&&!c)){delete e.video.facingMode;var p;if("environment"===s.exact||"environment"===s.ideal){p=["back","rear"]}else if("user"===s.exact||"user"===s.ideal){p=["front"]}if(p){return n.mediaDevices.enumerateDevices().then(function(t){t=t.filter(function(e){return"videoinput"===e.kind});var n=t.find(function(e){return p.some(function(t){return-1!==e.label.toLowerCase().indexOf(t)})});if(!n&&t.length&&-1!==p.indexOf("back")){n=t[t.length-1]}if(n){e.video.deviceId=s.exact?{exact:n.deviceId}:{ideal:n.deviceId}}e.video=i(e.video);a("chrome: "+JSON.stringify(e));return r(e)})}}e.video=i(e.video)}a("chrome: "+JSON.stringify(e));return r(e)},s=function(t){return{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[t.name]||t.name,message:t.message,constraint:t.constraintName,toString:function toString(){return this.name+(this.message&&": ")+this.message}}};n.getUserMedia=function getUserMedia_(e,t,r){o(e,function(e){n.webkitGetUserMedia(e,t,function(t){if(r){r(s(t))}})})};var c=function(e){return new Promise(function(t,r){n.getUserMedia(e,t,r)})};if(!n.mediaDevices){n.mediaDevices={getUserMedia:c,enumerateDevices:function enumerateDevices(){return new Promise(function(t){var r={audio:"audioinput",video:"videoinput"};return e.MediaStreamTrack.getSources(function(e){t(e.map(function(e){return{label:e.label,kind:r[e.kind],deviceId:e.id,groupId:""}}))})})},getSupportedConstraints:function getSupportedConstraints(){return{deviceId:!0,echoCancellation:!0,facingMode:!0,frameRate:!0,height:!0,width:!0}}}}if(!n.mediaDevices.getUserMedia){n.mediaDevices.getUserMedia=function(e){return c(e)}}else{var d=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(e){return o(e,function(e){return d(e).then(function(t){if(e.audio&&!t.getAudioTracks().length||e.video&&!t.getVideoTracks().length){t.getTracks().forEach(function(e){e.stop()});throw new DOMException("","NotFoundError")}return t},function(t){return Promise.reject(s(t))})})}}if("undefined"==typeof n.mediaDevices.addEventListener){n.mediaDevices.addEventListener=function(){a("Dummy mediaDevices.addEventListener called.")}}if("undefined"==typeof n.mediaDevices.removeEventListener){n.mediaDevices.removeEventListener=function(){a("Dummy mediaDevices.removeEventListener called.")}}}},{"../utils.js":14}],7:[function(e,t){'use strict';var r=e("sdp"),a=e("./utils");t.exports={shimRTCIceCandidate:function shimRTCIceCandidate(t){if(!t.RTCIceCandidate||t.RTCIceCandidate&&"foundation"in t.RTCIceCandidate.prototype){return}var n=t.RTCIceCandidate;t.RTCIceCandidate=function(e){if("object"===_typeof(e)&&e.candidate&&0===e.candidate.indexOf("a=")){e=JSON.parse(JSON.stringify(e));e.candidate=e.candidate.substr(2)}if(e.candidate&&e.candidate.length){var t=new n(e),a=r.parseCandidate(e.candidate),i=Object.assign(t,a);i.toJSON=function(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}};return i}return new n(e)};t.RTCIceCandidate.prototype=n.prototype;a.wrapPeerConnectionEvent(t,"icecandidate",function(r){if(r.candidate){Object.defineProperty(r,"candidate",{value:new t.RTCIceCandidate(r.candidate),writable:"false"})}return r})},shimCreateObjectURL:function shimCreateObjectURL(e){var t=e&&e.URL;if(!("object"===_typeof(e)&&e.HTMLMediaElement&&"srcObject"in e.HTMLMediaElement.prototype&&t.createObjectURL&&t.revokeObjectURL)){return}var r=t.createObjectURL.bind(t),n=t.revokeObjectURL.bind(t),i=new Map,o=0;t.createObjectURL=function(e){if("getTracks"in e){var t="polyblob:"+ ++o;i.set(t,e);a.deprecated("URL.createObjectURL(stream)","elem.srcObject = stream");return t}return r(e)};t.revokeObjectURL=function(e){n(e);i.delete(e)};var s=Object.getOwnPropertyDescriptor(e.HTMLMediaElement.prototype,"src");Object.defineProperty(e.HTMLMediaElement.prototype,"src",{get:function get(){return s.get.apply(this)},set:function set(e){this.srcObject=i.get(e)||null;return s.set.apply(this,[e])}});var c=e.HTMLMediaElement.prototype.setAttribute;e.HTMLMediaElement.prototype.setAttribute=function(){if(2===arguments.length&&"src"===(""+arguments[0]).toLowerCase()){this.srcObject=i.get(arguments[1])||null}return c.apply(this,arguments)}},shimMaxMessageSize:function shimMaxMessageSize(e){if(e.RTCSctpTransport||!e.RTCPeerConnection){return}var t=a.detectBrowser(e);if(!("sctp"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get:function get(){return"undefined"==typeof this._sctp?null:this._sctp}})}var n=function(e){var t=r.splitSections(e.sdp);t.shift();return t.some(function(e){var t=r.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")})},i=function(e){var t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||2>t.length){return-1}var r=parseInt(t[1],10);return r!==r?-1:r},o=function(e){var r=65536;if("firefox"===t.browser){if(57>t.version){if(-1===e){r=16384}else{r=2147483637}}else if(60>t.version){r=57===t.version?65535:65536}else{r=2147483637}}return r},s=function(e,a){var n=65536;if("firefox"===t.browser&&57===t.version){n=65535}var i=r.matchPrefix(e.sdp,"a=max-message-size:");if(0t.sctp.maxMessageSize){throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)")}return r.apply(e,arguments)}}var r=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){var e=this,a=r.apply(e,arguments);t(a,e);return a};a.wrapPeerConnectionEvent(e,"datachannel",function(r){t(r.channel,r.target);return r})}}},{"./utils":14,sdp:2}],8:[function(e,t){'use strict';var r=e("../utils"),a=e("./filtericeservers"),n=e("rtcpeerconnection-shim");t.exports={shimGetUserMedia:e("./getusermedia"),shimPeerConnection:function shimPeerConnection(e){var t=r.detectBrowser(e);if(e.RTCIceGatherer){if(!e.RTCIceCandidate){e.RTCIceCandidate=function(e){return e}}if(!e.RTCSessionDescription){e.RTCSessionDescription=function(e){return e}}if(15025>t.version){var i=Object.getOwnPropertyDescriptor(e.MediaStreamTrack.prototype,"enabled");Object.defineProperty(e.MediaStreamTrack.prototype,"enabled",{set:function set(e){i.set.call(this,e);var t=new Event("enabled");t.enabled=e;this.dispatchEvent(t)}})}}if(e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get:function get(){if(this._dtmf===void 0){if("audio"===this.track.kind){this._dtmf=new e.RTCDtmfSender(this)}else if("video"===this.track.kind){this._dtmf=null}}return this._dtmf}})}if(e.RTCDtmfSender&&!e.RTCDTMFSender){e.RTCDTMFSender=e.RTCDtmfSender}var o=n(e,t.version);e.RTCPeerConnection=function(e){if(e&&e.iceServers){e.iceServers=a(e.iceServers)}return new o(e)};e.RTCPeerConnection.prototype=o.prototype},shimReplaceTrack:function shimReplaceTrack(e){if(e.RTCRtpSender&&!("replaceTrack"in e.RTCRtpSender.prototype)){e.RTCRtpSender.prototype.replaceTrack=e.RTCRtpSender.prototype.setTrack}}}},{"../utils":14,"./filtericeservers":9,"./getusermedia":10,"rtcpeerconnection-shim":1}],9:[function(e,t){'use strict';var r=e("../utils");t.exports=function(e,t){var a=!1;e=JSON.parse(JSON.stringify(e));return e.filter(function(e){if(e&&(e.urls||e.url)){var n=e.urls||e.url;if(e.url&&!e.urls){r.deprecated("RTCIceServer.url","RTCIceServer.urls")}var i="string"==typeof n;if(i){n=[n]}n=n.filter(function(e){var r=0===e.indexOf("turn:")&&-1!==e.indexOf("transport=udp")&&-1===e.indexOf("turn:[")&&!a;if(r){a=!0;return!0}return 0===e.indexOf("stun:")&&14393<=t&&-1===e.indexOf("?transport=udp")});delete e.url;e.urls=i?n[0]:n;return!!n.length}})}},{"../utils":14}],10:[function(e,t){'use strict';t.exports=function(e){var t=e&&e.navigator,r=function(t){return{name:{PermissionDeniedError:"NotAllowedError"}[t.name]||t.name,message:t.message,constraint:t.constraint,toString:function toString(){return this.name}}},a=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(e){return a(e).catch(function(t){return Promise.reject(r(t))})}}},{}],11:[function(e,t){'use strict';var r=e("../utils");t.exports={shimGetUserMedia:e("./getusermedia"),shimOnTrack:function shimOnTrack(e){if("object"===_typeof(e)&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get:function get(){return this._ontrack},set:function set(e){if(this._ontrack){this.removeEventListener("track",this._ontrack);this.removeEventListener("addstream",this._ontrackpoly)}this.addEventListener("track",this._ontrack=e);this.addEventListener("addstream",this._ontrackpoly=function(t){t.stream.getTracks().forEach(function(e){var r=new Event("track");r.track=e;r.receiver={track:e};r.transceiver={receiver:r.receiver};r.streams=[t.stream];this.dispatchEvent(r)}.bind(this))}.bind(this))}})}if("object"===_typeof(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)){Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function get(){return{receiver:this.receiver}}})}},shimSourceObject:function shimSourceObject(e){if("object"===_typeof(e)){if(e.HTMLMediaElement&&!("srcObject"in e.HTMLMediaElement.prototype)){Object.defineProperty(e.HTMLMediaElement.prototype,"srcObject",{get:function get(){return this.mozSrcObject},set:function set(e){this.mozSrcObject=e}})}}},shimPeerConnection:function shimPeerConnection(e){var t=r.detectBrowser(e);if("object"!==_typeof(e)||!(e.RTCPeerConnection||e.mozRTCPeerConnection)){return}if(!e.RTCPeerConnection){e.RTCPeerConnection=function(r,a){if(38>t.version){if(r&&r.iceServers){for(var n=[],o=0,s;ot.version){a=n(a)}if(53>t.version&&!r){try{a.forEach(function(e){e.type=o[e.type]||e.type})}catch(t){if("TypeError"!==t.name){throw t}a.forEach(function(e,t){a.set(t,Object.assign({},e,{type:o[e.type]||e.type}))})}}return a}).then(r,a)}},shimSenderGetStats:function shimSenderGetStats(e){if(!("object"===_typeof(e)&&e.RTCPeerConnection&&e.RTCRtpSender)){return}if(e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype){return}var t=e.RTCPeerConnection.prototype.getSenders;if(t){e.RTCPeerConnection.prototype.getSenders=function(){var e=this,r=t.apply(e,[]);r.forEach(function(t){t._pc=e});return r}}var r=e.RTCPeerConnection.prototype.addTrack;if(r){e.RTCPeerConnection.prototype.addTrack=function(){var e=r.apply(this,arguments);e._pc=this;return e}}e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}},shimReceiverGetStats:function shimReceiverGetStats(e){if(!("object"===_typeof(e)&&e.RTCPeerConnection&&e.RTCRtpSender)){return}if(e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype){return}var t=e.RTCPeerConnection.prototype.getReceivers;if(t){e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,r=t.apply(e,[]);r.forEach(function(t){t._pc=e});return r}}r.wrapPeerConnectionEvent(e,"track",function(t){t.receiver._pc=t.srcElement;return t});e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}},shimRemoveStream:function shimRemoveStream(e){if(!e.RTCPeerConnection||"removeStream"in e.RTCPeerConnection.prototype){return}e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;r.deprecated("removeStream","removeTrack");this.getSenders().forEach(function(r){if(r.track&&-1!==e.getTracks().indexOf(r.track)){t.removeTrack(r)}})}},shimRTCDataChannel:function shimRTCDataChannel(e){if(e.DataChannel&&!e.RTCDataChannel){e.RTCDataChannel=e.DataChannel}}}},{"../utils":14,"./getusermedia":12}],12:[function(e,t){'use strict';var r=e("../utils"),a=r.log;t.exports=function(e){var t=r.detectBrowser(e),n=e&&e.navigator,i=e&&e.MediaStreamTrack,o=function(t){return{name:{InternalError:"NotReadableError",NotSupportedError:"TypeError",PermissionDeniedError:"NotAllowedError",SecurityError:"NotAllowedError"}[t.name]||t.name,message:{"The operation is insecure.":"The request is not allowed by the user agent or the platform in the current context."}[t.message]||t.message,constraint:t.constraint,toString:function toString(){return this.name+(this.message&&": ")+this.message}}},s=function(e,r,i){var s=function(e){if("object"!==_typeof(e)||e.require){return e}var t=[];Object.keys(e).forEach(function(a){if("require"===a||"advanced"===a||"mediaSource"===a){return}var n=e[a]="object"===_typeof(e[a])?e[a]:{ideal:e[a]};if(n.min!==void 0||n.max!==void 0||n.exact!==void 0){t.push(a)}if(n.exact!==void 0){if("number"==typeof n.exact){n.min=n.max=n.exact}else{e[a]=n.exact}delete n.exact}if(n.ideal!==void 0){e.advanced=e.advanced||[];var r={};if("number"==typeof n.ideal){r[a]={min:n.ideal,max:n.ideal}}else{r[a]=n.ideal}e.advanced.push(r);delete n.ideal;if(!Object.keys(n).length){delete e[a]}}});if(t.length){e.require=t}return e};e=JSON.parse(JSON.stringify(e));if(38>t.version){a("spec: "+JSON.stringify(e));if(e.audio){e.audio=s(e.audio)}if(e.video){e.video=s(e.video)}a("ff37: "+JSON.stringify(e))}return n.mozGetUserMedia(e,r,function(t){i(o(t))})},c=function(e){return new Promise(function(t,r){s(e,t,r)})};if(!n.mediaDevices){n.mediaDevices={getUserMedia:c,addEventListener:function addEventListener(){},removeEventListener:function removeEventListener(){}}}n.mediaDevices.enumerateDevices=n.mediaDevices.enumerateDevices||function(){return new Promise(function(e){e([{kind:"audioinput",deviceId:"default",label:"",groupId:""},{kind:"videoinput",deviceId:"default",label:"",groupId:""}])})};if(41>t.version){var d=n.mediaDevices.enumerateDevices.bind(n.mediaDevices);n.mediaDevices.enumerateDevices=function(){return d().then(void 0,function(t){if("NotFoundError"===t.name){return[]}throw t})}}if(49>t.version){var p=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(e){return p(e).then(function(t){if(e.audio&&!t.getAudioTracks().length||e.video&&!t.getVideoTracks().length){t.getTracks().forEach(function(e){e.stop()});throw new DOMException("The object can not be found here.","NotFoundError")}return t},function(t){return Promise.reject(o(t))})}}if(!(55t.version){return s(e,a,i)}r.deprecated("navigator.getUserMedia","navigator.mediaDevices.getUserMedia");n.mediaDevices.getUserMedia(e).then(a,i)}}},{"../utils":14}],13:[function(e,t){'use strict';var r=e("../utils");t.exports={shimLocalStreamsAPI:function shimLocalStreamsAPI(e){if("object"!==_typeof(e)||!e.RTCPeerConnection){return}if(!("getLocalStreams"in e.RTCPeerConnection.prototype)){e.RTCPeerConnection.prototype.getLocalStreams=function(){if(!this._localStreams){this._localStreams=[]}return this._localStreams}}if(!("getStreamById"in e.RTCPeerConnection.prototype)){e.RTCPeerConnection.prototype.getStreamById=function(e){var t=null;if(this._localStreams){this._localStreams.forEach(function(r){if(r.id===e){t=r}})}if(this._remoteStreams){this._remoteStreams.forEach(function(r){if(r.id===e){t=r}})}return t}}if(!("addStream"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){if(!this._localStreams){this._localStreams=[]}if(-1===this._localStreams.indexOf(e)){this._localStreams.push(e)}var r=this;e.getTracks().forEach(function(a){t.call(r,a,e)})};e.RTCPeerConnection.prototype.addTrack=function(e,r){if(r){if(!this._localStreams){this._localStreams=[r]}else if(-1===this._localStreams.indexOf(r)){this._localStreams.push(r)}}return t.call(this,e,r)}}if(!("removeStream"in e.RTCPeerConnection.prototype)){e.RTCPeerConnection.prototype.removeStream=function(e){if(!this._localStreams){this._localStreams=[]}var t=this._localStreams.indexOf(e);if(-1===t){return}this._localStreams.splice(t,1);var r=this,a=e.getTracks();this.getSenders().forEach(function(e){if(-1!==a.indexOf(e.track)){r.removeTrack(e)}})}}},shimRemoteStreamsAPI:function shimRemoteStreamsAPI(e){if("object"!==_typeof(e)||!e.RTCPeerConnection){return}if(!("getRemoteStreams"in e.RTCPeerConnection.prototype)){e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}}if(!("onaddstream"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get:function get(){return this._onaddstream},set:function set(e){var t=this;if(this._onaddstream){this.removeEventListener("addstream",this._onaddstream);this.removeEventListener("track",this._onaddstreampoly)}this.addEventListener("addstream",this._onaddstream=e);this.addEventListener("track",this._onaddstreampoly=function(r){r.streams.forEach(function(e){if(!t._remoteStreams){t._remoteStreams=[]}if(0<=t._remoteStreams.indexOf(e)){return}t._remoteStreams.push(e);var r=new Event("addstream");r.stream=e;t.dispatchEvent(r)})})}})}},shimCallbacksAPI:function shimCallbacksAPI(e){if("object"!==_typeof(e)||!e.RTCPeerConnection){return}var t=e.RTCPeerConnection.prototype,r=t.createOffer,a=t.createAnswer,n=t.setLocalDescription,i=t.setRemoteDescription,o=t.addIceCandidate;t.createOffer=function(e,t){var a=2<=arguments.length?arguments[2]:arguments[0],n=r.apply(this,[a]);if(!t){return n}n.then(e,t);return Promise.resolve()};t.createAnswer=function(e,t){var r=2<=arguments.length?arguments[2]:arguments[0],n=a.apply(this,[r]);if(!t){return n}n.then(e,t);return Promise.resolve()};var s=function(e,t,r){var a=n.apply(this,[e]);if(!r){return a}a.then(t,r);return Promise.resolve()};t.setLocalDescription=s;s=function(e,t,r){var a=i.apply(this,[e]);if(!r){return a}a.then(t,r);return Promise.resolve()};t.setRemoteDescription=s;s=function(e,t,r){var a=o.apply(this,[e]);if(!r){return a}a.then(t,r);return Promise.resolve()};t.addIceCandidate=s},shimGetUserMedia:function shimGetUserMedia(e){var t=e&&e.navigator;if(!t.getUserMedia){if(t.webkitGetUserMedia){t.getUserMedia=t.webkitGetUserMedia.bind(t)}else if(t.mediaDevices&&t.mediaDevices.getUserMedia){t.getUserMedia=function(e,r,a){t.mediaDevices.getUserMedia(e).then(r,a)}.bind(t)}}},shimRTCIceServerUrls:function shimRTCIceServerUrls(e){var t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,a){if(e&&e.iceServers){for(var n=[],o=0,s;o=r&&parseInt(a[r],10)}t.exports={extractVersion:r,wrapPeerConnectionEvent:function(e,t,r){if(!e.RTCPeerConnection){return}var a=e.RTCPeerConnection.prototype,n=a.addEventListener;a.addEventListener=function(e,a){if(e!==t){return n.apply(this,arguments)}var i=function(t){a(r(t))};this._eventMap=this._eventMap||{};this._eventMap[a]=i;return n.apply(this,[e,i])};var i=a.removeEventListener;a.removeEventListener=function(e,r){if(e!==t||!this._eventMap||!this._eventMap[r]){return i.apply(this,arguments)}var a=this._eventMap[r];delete this._eventMap[r];return i.apply(this,[e,a])};Object.defineProperty(a,"on"+t,{get:function get(){return this["_on"+t]},set:function set(e){if(this["_on"+t]){this.removeEventListener(t,this["_on"+t]);delete this["_on"+t]}if(e){this.addEventListener(t,this["_on"+t]=e)}},enumerable:!0,configurable:!0})},disableLog:function disableLog(e){if("boolean"!=typeof e){return new Error("Argument type: "+_typeof(e)+". Please use a boolean.")}a=e;return e?"adapter.js logging disabled":"adapter.js logging enabled"},disableWarnings:function disableWarnings(e){if("boolean"!=typeof e){return new Error("Argument type: "+_typeof(e)+". Please use a boolean.")}n=!e;return"adapter.js deprecation warnings "+(e?"disabled":"enabled")},log:function log(){if("object"===("undefined"==typeof window?"undefined":_typeof(window))){if(a){return}if("undefined"!=typeof console&&"function"==typeof console.log){console.log.apply(console,arguments)}}},deprecated:function deprecated(e,t){if(!n){return}console.warn(e+" is deprecated, please use "+t+" instead.")},detectBrowser:function detectBrowser(e){var t=e&&e.navigator,a={};a.browser=null;a.version=null;if("undefined"==typeof e||!e.navigator){a.browser="Not a browser.";return a}if(t.mozGetUserMedia){a.browser="firefox";a.version=r(t.userAgent,/Firefox\/(\d+)\./,1)}else if(t.webkitGetUserMedia){a.browser="chrome";a.version=r(t.userAgent,/Chrom(e|ium)\/(\d+)\./,2)}else if(t.mediaDevices&&t.userAgent.match(/Edge\/(\d+).(\d+)$/)){a.browser="edge";a.version=r(t.userAgent,/Edge\/(\d+).(\d+)$/,2)}else if(e.RTCPeerConnection&&t.userAgent.match(/AppleWebKit\/(\d+)\./)){a.browser="safari";a.version=r(t.userAgent,/AppleWebKit\/(\d+)\./,1)}else{a.browser="Not a supported browser.";return a}return a}}},{}]},{},[3])(3)}); +//# sourceMappingURL=adapter.min.js.map diff --git a/amd/build/anim_fbars.min.js b/amd/build/anim_fbars.min.js index 21cb5c3e..125197bc 100644 --- a/amd/build/anim_fbars.min.js +++ b/amd/build/anim_fbars.min.js @@ -1 +1,2 @@ -define(["jquery","core/log"],function(a,b){"use strict";return b.debug("anim_freq bars: initialising"),{analyser:null,cvs:null,cvsctx:null,clone:function(){return a.extend(!0,{},this)},init:function(a,b){this.cvs=b,this.cvsctx=b.getContext("2d"),this.analyser=a},clear:function(){this.cvsctx.clearRect(0,0,this.cvs.width,this.cvs.height)},start:function(){this.analyser.core.fftSize=256;var a=this.analyser.core.frequencyBinCount,b=new Uint8Array(a),c=this.cvs.width,d=this.cvs.height,e=this.cvsctx,f=this.analyser;this.clear();var g=function(){requestAnimationFrame(g);if(f.theinterval){f.core.getByteFrequencyData(b),e.clearRect(0,0,c,d);for(var h,i=c/a*2.5,j=0,k=0;k0){var l=b[a-1];128!=l&&(g.sounddetected=!0)}for(var m=0;m0){var m=b[a-1];128!=m&&(g.sounddetected=!0)}for(var n=0;n'),d=b.width()/4;d.toFixed(),b.empty();for(var e=0;e
');b.append(g)}b.append(c)},playBars:function(b,c){var d=this;console.log(b,c,d.fetchCurrent());var e=a(".poodll_fresh_wave"),f=a(".poodll_fresh_progress_bar"),g=e.width()/4;e.attr("data-ct",b).attr("data-duration",c),g.toFixed();var h=document.querySelectorAll(".poodll_fresh_point");console.log(h);for(var i=0;i"),d=b.width()/4;d.toFixed();b.empty();for(var e=0;e
");b.append(f)}b.append(c)},playBars:function playBars(b,c){var d=this;console.log(b,c,d.fetchCurrent());var e=a(".poodll_fresh_wave"),f=a(".poodll_fresh_progress_bar"),g=e.width()/4;e.attr("data-ct",b).attr("data-duration",c);g.toFixed();var h=document.querySelectorAll(".poodll_fresh_point");console.log(h);for(var j=0;jd.fetchCurrent()){console.log(d.fetchCurrent());j(k)}};k()},pauseBars:function pauseBars(){},setDrawParam:function setDrawParam(a,b){this.drawparams[a]=b},clear:function clear(){this.context.clearRect(this.startx,this.starty,this.barwidth,this.barheight)},fetchCurrent:function fetchCurrent(){return 0},stop:function stop(){this.enabled=!1;this.clear()},stopthere:function stopthere(){this.enabled=!1},start:function start(){this.clear();this.enabled=!0;var a=this;this.context.textAlign=this.drawparams.textAlign;this.context.font=this.drawparams.font;var b=this.drawparams.textColor,c=function(){if(!a.enabled){return}a.clear();a.context.fillStyle=a.drawparams.barColor;a.context.fillRect(a.startx,a.starty,a.fetchCurrent()*a.barwidth,a.barheight);var b=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;b(c)};c()}}}); +//# sourceMappingURL=anim_progress_bar_fresh.min.js.map diff --git a/amd/build/anim_progress_radial.min.js b/amd/build/anim_progress_radial.min.js index 8c16f5ca..0d1efdc7 100644 --- a/amd/build/anim_progress_radial.min.js +++ b/amd/build/anim_progress_radial.min.js @@ -1 +1,2 @@ -define(["jquery","core/log"],function(a,b){"use strict";return b.debug("Radial Progress: initialising"),{playcanvas:null,context:null,x:null,y:null,currenttime:0,enabled:!1,showpercent:!1,drawparams:{lineWidth:10,barColor:"#ad2323",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:10,shadowColor:"#fff",font:"18px Arial",textAlign:"center",textBaseline:"middle"},clone:function(){return a.extend(!0,{},this)},init:function(a,b,c){this.playcanvas=a.get(0),this.x=this.playcanvas.width/2,this.y=this.playcanvas.height/2,this.context=this.playcanvas.getContext("2d"),c&&(this.showpercent=c),c&&this.setDrawParam("barColor",b)},setDrawParam:function(a,b){this.drawparams[a]=b},clear:function(){this.context.clearRect(0,0,this.playcanvas.width,this.playcanvas.height)},fetchCurrent:function(){return 0},stop:function(){this.enabled=!1},start:function(){this.clear(),this.enabled=!0;var a=this;this.context.lineWidth=this.drawparams.lineWidth,this.context.strokeStyle=this.drawparams.barColor,this.context.setLineDash([]),this.context.shadowOffsetX=this.drawparams.shadowOffsetX,this.context.shadowOffsetY=this.drawparams.shadowOffsetY,this.context.shadowBlur=this.drawparams.shadowBlur,this.context.shadowColor=this.drawparams.shadowColor,this.context.font=this.drawparams.font,this.context.textAlign=this.drawparams.textAlign,this.context.textBaseline=this.drawparams.textBaseline;var b=function(){if(a.enabled){a.clear();var c=Math.min(a.x,a.y)-a.context.lineWidth,d=!1,e=2*Math.PI,f=Math.PI/2,g=a.fetchCurrent();a.context.beginPath(),a.context.arc(a.x,a.y,c,-f,e*g-f,d),a.showpercent&&a.context.fillText(parseInt(100*g)+"%",a.x,a.y),a.context.stroke();var h=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;h(b)}};b()}}}); \ No newline at end of file +define ("filter_poodll/anim_progress_radial",["jquery","core/log"],function(a,b){"use strict";b.debug("Radial Progress: initialising");return{playcanvas:null,context:null,x:null,y:null,currenttime:0,enabled:!1,showpercent:!1,drawparams:{lineWidth:10,barColor:"#ad2323",shadowOffsetX:0,shadowOffsetY:0,shadowBlur:10,shadowColor:"#fff",font:"18px Arial",textAlign:"center",textBaseline:"middle"},clone:function clone(){return a.extend(!0,{},this)},init:function init(a,b,c){this.playcanvas=a.get(0);this.x=this.playcanvas.width/2;this.y=this.playcanvas.height/2;this.context=this.playcanvas.getContext("2d");if(c){this.showpercent=c}if(c){this.setDrawParam("barColor",b)}},setDrawParam:function setDrawParam(a,b){this.drawparams[a]=b},clear:function clear(){this.context.clearRect(0,0,this.playcanvas.width,this.playcanvas.height)},fetchCurrent:function fetchCurrent(){return 0},stop:function stop(){this.enabled=!1},start:function start(){this.clear();this.enabled=!0;var a=this;this.context.lineWidth=this.drawparams.lineWidth;this.context.strokeStyle=this.drawparams.barColor;this.context.setLineDash([]);this.context.shadowOffsetX=this.drawparams.shadowOffsetX;this.context.shadowOffsetY=this.drawparams.shadowOffsetY;this.context.shadowBlur=this.drawparams.shadowBlur;this.context.shadowColor=this.drawparams.shadowColor;this.context.font=this.drawparams.font;this.context.textAlign=this.drawparams.textAlign;this.context.textBaseline=this.drawparams.textBaseline;var b=function(){if(!a.enabled){return}a.clear();var c=Math.min(a.x,a.y)-a.context.lineWidth,d=2*Math.PI,e=Math.PI/2,f=a.fetchCurrent();a.context.beginPath();a.context.arc(a.x,a.y,c,-e,d*f-e,!1);if(a.showpercent){a.context.fillText(parseInt(100*f)+"%",a.x,a.y)}a.context.stroke();var g=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;g(b)};b()}}}); +//# sourceMappingURL=anim_progress_radial.min.js.map diff --git a/amd/build/anim_ripple.min.js b/amd/build/anim_ripple.min.js index e61f4d6b..9f33e5a3 100644 --- a/amd/build/anim_ripple.min.js +++ b/amd/build/anim_ripple.min.js @@ -1 +1,2 @@ -define(["jquery","core/log"],function(a,b){"use strict";return b.debug("anim_ripple: initialising"),{analyser:null,cvs:null,cvsctx:null,drawparams:{rippleColor:"#0",lineWidth:2},clone:function(){return a.extend(!0,{},this)},init:function(a,b){this.cvs=b,this.cvsctx=b.getContext("2d"),this.analyser=a},setDrawParam:function(a,b){this.drawparams[a]=b},clear:function(){this.cvsctx.clearRect(0,0,this.cvs.width,this.cvs.height)},start:function(){this.analyser.core.fftSize=2048;var a=this.analyser.core.fftSize,b=new Uint8Array(a),c=this.cvs.width,d=this.cvs.height,e=this.cvsctx,f=this.analyser;this.clear();var g=this,h=function(){requestAnimationFrame(h);if(f.theinterval){f.core.getByteTimeDomainData(b),e.clearRect(0,0,c,d),e.lineWidth=g.drawparams.lineWidth,e.setLineDash([15,5]),e.strokeStyle=g.drawparams.rippleColor,e.beginPath();var i=100;if(a>0)var j=1+a/5;for(var k=0;kl;l++){a.cvsctx.fillText(f[f.length-l],d/4*(l%4)+d/8,5>l?o:3*o)}};g()}}}); +//# sourceMappingURL=anim_words.min.js.map diff --git a/amd/build/audioanalyser.min.js b/amd/build/audioanalyser.min.js index 589e9ecf..fe59ee4b 100644 --- a/amd/build/audioanalyser.min.js +++ b/amd/build/audioanalyser.min.js @@ -1 +1,2 @@ -define(["jquery","core/log"],function(a,b){"use strict";return b.debug("audioanalyser: initialising"),{acontext:null,core:null,freq_data:null,wav_data:null,theinterval:null,clone:function(){return a.extend(!0,{},this)},clear:function(){clearInterval(this.theinterval),this.theinterval=null},init:function(a){this.theinterval&&this.clear(),this.acontext=a,this.core=this.acontext.createAnalyser()},start:function(){this.theinterval&&this.clear();var a=this.core.frequencyBinCount;this.freq_data=new Uint8Array(a),this.wav_data=new Uint8Array(a);var b=this;this.theinterval=setInterval(function(){b.process_recent_data(b)},2e3)},process_recent_data:function(a){a.core.getByteTimeDomainData(a.wav_data),a.wav_event(a.wav_data),a.core.getByteFrequencyData(a.freq_data),a.freq_event(a.freq_data)},wav_event:function(a){},freq_event:function(a){}}}); \ No newline at end of file +define ("filter_poodll/audioanalyser",["jquery","core/log"],function(a,b){"use strict";b.debug("audioanalyser: initialising");return{acontext:null,core:null,freq_data:null,wav_data:null,theinterval:null,clone:function clone(){return a.extend(!0,{},this)},clear:function clear(){clearInterval(this.theinterval);this.theinterval=null},init:function init(a){if(this.theinterval){this.clear()}this.acontext=a;this.core=this.acontext.createAnalyser()},start:function start(){if(this.theinterval){this.clear()}var a=this.core.frequencyBinCount;this.freq_data=new Uint8Array(a);this.wav_data=new Uint8Array(a);var b=this;this.theinterval=setInterval(function(){b.process_recent_data(b)},2e3)},process_recent_data:function process_recent_data(a){a.core.getByteTimeDomainData(a.wav_data);a.wav_event(a.wav_data);a.core.getByteFrequencyData(a.freq_data);a.freq_event(a.freq_data)},wav_event:function wav_event(){},freq_event:function freq_event(){}}}); +//# sourceMappingURL=audioanalyser.min.js.map diff --git a/amd/build/dlg_devicesettings.min.js b/amd/build/dlg_devicesettings.min.js index bdc8b417..b64e9880 100644 --- a/amd/build/dlg_devicesettings.min.js +++ b/amd/build/dlg_devicesettings.min.js @@ -1 +1,2 @@ -define(["jquery","core/log","filter_poodll/dlg_poodll"],function(a,b,c){return b.debug("Device settings dialog: initialising"),{dlg:null,pmr:null,instanceprops:null,dlgbox:null,mediatype:null,init:function(a,b){this.dlg=c.clone(),this.dlg.setHeader("settings"),this.pmr=a,this.instanceprops=b,this.mediatype=b.config.mediatype},clone:function(){return a.extend(!0,{},this)},fetch_dialogue_box:function(){return this.dlg.fetch_dialogue_box("settings")},set_dialogue_box:function(a){this.dlgbox=a,this.dlg.set_dialogue_box(a)},open:function(){var a=this;this.instanceprops;navigator.mediaDevices.enumerateDevices().then(function(b){var c=[],d=[];b.forEach(function(a){switch(a.kind){case"audioinput":c.push(a);break;case"videoinput":d.push(a)}});var e='
Audio: '+a.makeSelect(c,"audio")+"
",f='
Video: '+a.makeSelect(d,"video")+"
",g='
';g+="video"==a.mediatype?e+"
"+f:e,g+="
",a.dlg.setContent(g),a.registerEvents(),"video"==a.instanceprops.config.mediatype&&(a.dlg.onclose=function(){a.resetVideoUserInterface()}),a.dlg.open()})["catch"](function(a){b.debug(a)})},registerEvents:function(){var a=this,b=this.instanceprops,c=b.controlbar.preview[0];c&&c.pause(),b.mediaRecorder&&b.mediaRecorder.stop(),this.dlgbox.find(".select_settings_audio").change(function(){a.instanceprops.useraudiodeviceid=this.value}),this.dlgbox.find(".select_settings_video").change(function(){a.instanceprops.uservideodeviceid=this.value})},resetVideoUserInterface:function(){var a=this.instanceprops,c=(a.controlbar.preview[0],this.pmr),d=c.fetch_video_constraints(a);c.tidy_old_stream(a.controlbarid),navigator.mediaDevices.getUserMedia(d).then(function(b){c.restream_preview_video_player(a.controlbarid,b)})["catch"](function(a){b.debug("location 4567"),b.debug(a)})},makeSelect:function(a,b){if(1==a.length&&""==a[0].label)return"
No devices available yet.
";switch(b){case"audio":var c=this.instanceprops.useraudiodeviceid;break;case"video":var c=this.instanceprops.uservideodeviceid}var d='"}}}); \ No newline at end of file +define ("filter_poodll/dlg_devicesettings",["jquery","core/log","filter_poodll/dlg_poodll"],function(a,b,c){b.debug("Device settings dialog: initialising");return{dlg:null,pmr:null,instanceprops:null,dlgbox:null,mediatype:null,init:function init(a,b){this.dlg=c.clone();this.dlg.setHeader("settings");this.pmr=a;this.instanceprops=b;this.mediatype=b.config.mediatype},clone:function clone(){return a.extend(!0,{},this)},fetch_dialogue_box:function fetch_dialogue_box(){return this.dlg.fetch_dialogue_box("settings")},set_dialogue_box:function set_dialogue_box(a){this.dlgbox=a;this.dlg.set_dialogue_box(a)},open:function open(){var a=this,c=this.instanceprops;navigator.mediaDevices.enumerateDevices().then(function(b){var c=[],d=[];b.forEach(function(a){switch(a.kind){case"audioinput":c.push(a);break;case"videoinput":d.push(a);break;}});var e="
Audio: "+a.makeSelect(c,"audio")+"
",f="
Video: "+a.makeSelect(d,"video")+"
",g="
";if("video"==a.mediatype){g+=e+"
"+f}else{g+=e}g+="
";a.dlg.setContent(g);a.registerEvents();if("video"==a.instanceprops.config.mediatype){a.dlg.onclose=function(){a.resetVideoUserInterface()}}a.dlg.open()}).catch(function(a){b.debug(a)})},registerEvents:function registerEvents(){var a=this,b=this.instanceprops,c=b.controlbar.preview[0];if(c){c.pause()}if(b.mediaRecorder){b.mediaRecorder.stop()}this.dlgbox.find(".select_settings_audio").change(function(){a.instanceprops.useraudiodeviceid=this.value});this.dlgbox.find(".select_settings_video").change(function(){a.instanceprops.uservideodeviceid=this.value})},resetVideoUserInterface:function resetVideoUserInterface(){var a=this.instanceprops,c=a.controlbar.preview[0],d=this.pmr,e=d.fetch_video_constraints(a);d.tidy_old_stream(a.controlbarid);navigator.mediaDevices.getUserMedia(e).then(function(b){d.restream_preview_video_player(a.controlbarid,b)}).catch(function(a){b.debug("location 4567");b.debug(a)})},makeSelect:function makeSelect(a,b){if(1==a.length&&""==a[0].label){return"
No devices available yet.
"}switch(b){case"audio":var c=this.instanceprops.useraudiodeviceid;break;case"video":var c=this.instanceprops.uservideodeviceid;}var d="";return d}}}); +//# sourceMappingURL=dlg_devicesettings.min.js.map diff --git a/amd/build/dlg_download.min.js b/amd/build/dlg_download.min.js index 45aa267a..92a8d61d 100644 --- a/amd/build/dlg_download.min.js +++ b/amd/build/dlg_download.min.js @@ -1 +1,2 @@ -define(["jquery","core/log","filter_poodll/dlg_poodll","filter_poodll/utils_amd"],function(a,b,c,d){return b.debug("download dialog: initialising"),{dlg:null,instanceprops:null,pmr:null,dlgbox:null,init:function(a,b){this.dlg=c.clone(),this.dlg.setHeader("Download"),this.instanceprops=b,this.pmr=a},clone:function(){return a.extend(!0,{},this)},fetch_blob_url:function(){var a=d.simpleConcatenateBlobs(this.instanceprops.blobs,this.instanceprops.blobs[0].type),b=URL.createObjectURL(a);return b},fetch_dialogue_box:function(){return this.dlg.fetch_dialogue_box("download")},set_dialogue_box:function(a){this.dlgbox=a,this.dlg.set_dialogue_box(a)},open:function(){var a=this,b=this.instanceprops,c="",e=(new Date).toISOString().replace(/[^0-9]/g,""),f=b.config.mediatype+"_"+e;d.doConcatenateBlobs(this.instanceprops.blobs,function(b){switch(b.type){case"audio/wav":case"audio/pcm":c=".wav";break;case"audio/ogg":c=".ogg";break;case"audio/webm":case"video/webm":c=".webm";break;default:var d=b.type.split("/");d.length>1&&(c="."+d[1])}f+=c;var e=URL.createObjectURL(b),g=M.util.get_string("recui_downloadfile","filter_poodll"),h='
';h+=''+g+"",h+="
",a.dlg.setContent(h),a.registerEvents(),a.dlg.open()})},registerEvents:function(){}}}); \ No newline at end of file +define ("filter_poodll/dlg_download",["jquery","core/log","filter_poodll/dlg_poodll","filter_poodll/utils_amd"],function(a,b,c,d){b.debug("download dialog: initialising");return{dlg:null,instanceprops:null,pmr:null,dlgbox:null,init:function init(a,b){this.dlg=c.clone();this.dlg.setHeader("Download");this.instanceprops=b;this.pmr=a},clone:function clone(){return a.extend(!0,{},this)},fetch_blob_url:function fetch_blob_url(){var a=d.simpleConcatenateBlobs(this.instanceprops.blobs,this.instanceprops.blobs[0].type),b=URL.createObjectURL(a);return b},fetch_dialogue_box:function fetch_dialogue_box(){return this.dlg.fetch_dialogue_box("download")},set_dialogue_box:function set_dialogue_box(a){this.dlgbox=a;this.dlg.set_dialogue_box(a)},open:function open(){var a=this,b=this.instanceprops,c="",e=new Date().toISOString().replace(/[^0-9]/g,""),f=b.config.mediatype+"_"+e;d.doConcatenateBlobs(this.instanceprops.blobs,function(b){switch(b.type){case"audio/wav":case"audio/pcm":c=".wav";break;case"audio/ogg":c=".ogg";break;case"audio/webm":case"video/webm":c=".webm";break;default:var d=b.type.split("/");if(1";h+=""+g+"";h+="";a.dlg.setContent(h);a.registerEvents();a.dlg.open()})},registerEvents:function registerEvents(){}}}); +//# sourceMappingURL=dlg_download.min.js.map diff --git a/amd/build/dlg_errordisplay.min.js b/amd/build/dlg_errordisplay.min.js index 2c34b501..1a34d187 100644 --- a/amd/build/dlg_errordisplay.min.js +++ b/amd/build/dlg_errordisplay.min.js @@ -1 +1,2 @@ -define(["jquery","core/log","filter_poodll/dlg_poodll"],function(a,b,c){return b.debug("Error display dialog: initialising"),{dlg:null,instanceprops:null,dlgbox:null,init:function(a){this.dlg=c.clone(),this.dlg.setHeader("Error"),this.instanceprops=a},clone:function(){return a.extend(!0,{},this)},fetch_dialogue_box:function(){return this.dlg.fetch_dialogue_box("errors")},set_dialogue_box:function(a){this.dlgbox=a,this.dlg.set_dialogue_box(a)},open:function(a){var b=this,c=(this.instanceprops,'
'),d=a;a.name&&(d=M.util.get_string("recui_media"+a.name.toLowerCase(),"filter_poodll")),c+=""+d+"",c+="
",b.dlg.setContent(c),b.registerEvents(),b.dlg.open()},registerEvents:function(){}}}); \ No newline at end of file +define ("filter_poodll/dlg_errordisplay",["jquery","core/log","filter_poodll/dlg_poodll"],function(a,b,c){b.debug("Error display dialog: initialising");return{dlg:null,instanceprops:null,dlgbox:null,init:function init(a){this.dlg=c.clone();this.dlg.setHeader("Error");this.instanceprops=a},clone:function clone(){return a.extend(!0,{},this)},fetch_dialogue_box:function fetch_dialogue_box(){return this.dlg.fetch_dialogue_box("errors")},set_dialogue_box:function set_dialogue_box(a){this.dlgbox=a;this.dlg.set_dialogue_box(a)},open:function open(a){var b=this,c=this.instanceprops,d="
",e=a;if(a.name){e=M.util.get_string("recui_media"+a.name.toLowerCase(),"filter_poodll")}d+=""+e+"";d+="
";b.dlg.setContent(d);b.registerEvents();b.dlg.open()},registerEvents:function registerEvents(){}}}); +//# sourceMappingURL=dlg_errordisplay.min.js.map diff --git a/amd/build/dlg_poodll.min.js b/amd/build/dlg_poodll.min.js index 677494ef..35bfa871 100644 --- a/amd/build/dlg_poodll.min.js +++ b/amd/build/dlg_poodll.min.js @@ -1 +1,2 @@ -define(["jquery","jqueryui","core/log"],function(a,b,c){"use strict";return c.debug("Poodll Dialog: initialising"),{dlgbox:null,headertext:"",init:function(){},clone:function(){return a.extend(!0,{},this)},setHeader:function(a){this.headertext=a},setContent:function(a){this.clear(),this.dlgbox.append(a)},clear:function(){this.dlgbox.children().last().remove()},open:function(){this.dlgbox.toggle("slide",{direction:"left"},400)},close:function(){var a=this;this.dlgbox.toggle("slide",{direction:"left",complete:a.onclose},400)},onclose:function(){},test:function(){c.debug("hio")},fetch_dialogue_box:function(a){var b='
';return b+='
',b+='
'+this.headertext+"
",b+='
'},set_dialogue_box:function(a){this.dlgbox=a;var b=this;a.find(".poodll_close_modal").click(function(){b.close()})}}}); \ No newline at end of file +define ("filter_poodll/dlg_poodll",["jquery","jqueryui","core/log"],function(a,b,c){"use strict";c.debug("Poodll Dialog: initialising");return{dlgbox:null,headertext:"",init:function init(){},clone:function clone(){return a.extend(!0,{},this)},setHeader:function setHeader(a){this.headertext=a},setContent:function setContent(a){this.clear();this.dlgbox.append(a)},clear:function clear(){this.dlgbox.children().last().remove()},open:function open(){this.dlgbox.toggle("slide",{direction:"left"},400)},close:function close(){var a=this;this.dlgbox.toggle("slide",{direction:"left",complete:a.onclose},400)},onclose:function onclose(){},test:function test(){c.debug("hio")},fetch_dialogue_box:function fetch_dialogue_box(a){var b="
";b+="
";b+="
"+this.headertext+"
";b+="
";return b},set_dialogue_box:function set_dialogue_box(a){this.dlgbox=a;var b=this;a.find(".poodll_close_modal").click(function(){b.close()})}}}); +//# sourceMappingURL=dlg_poodll.min.js.map diff --git a/amd/build/drawingboard.min.js b/amd/build/drawingboard.min.js index 05417608..932d1739 100644 --- a/amd/build/drawingboard.min.js +++ b/amd/build/drawingboard.min.js @@ -1 +1,2 @@ -define([],function(){var a={};a.Board=function(b,c){if(this.opts=$.extend({},a.Board.defaultOpts,c),this.ev=new a.Utils.MicroEvent,this.id=b,this.$el=$(document.getElementById(b)),!this.$el.length)return!1;var d='
';return this.opts.controlsPosition.indexOf("bottom")>-1?d+='
':d='
'+d,this.$el.addClass("drawing-board").append(d),this.dom={$canvasWrapper:this.$el.find(".drawing-board-canvas-wrapper"),$canvas:this.$el.find(".drawing-board-canvas"),$cursor:this.$el.find(".drawing-board-cursor"),$controls:this.$el.find(".drawing-board-controls")},$.each(["left","right","center"],$.proxy(function(a,b){if(this.opts.controlsPosition.indexOf(b)>-1)return this.dom.$controls.attr("data-align",b),!1},this)),this.canvas=this.dom.$canvas.get(0),this.ctx=this.canvas&&this.canvas.getContext&&this.canvas.getContext("2d")?this.canvas.getContext("2d"):null,this.color=this.opts.color,this.ctx?(this.storage=this._getStorage(),this.initHistory(),this.reset({webStorage:!1,history:!1,background:!1}),this.initControls(),this.resize(),this.reset({webStorage:!1,history:!0,background:!0}),this.restoreWebStorage(),this.initDropEvents(),void this.initDrawEvents()):(this.opts.errorMessage&&this.$el.html(this.opts.errorMessage),!1)},a.Board.defaultOpts={controls:["Color","DrawingMode","Size","Navigation"],controlsPosition:"top left",color:"#000000",size:1,background:"#fff",eraserColor:"background",webStorage:"session",droppable:!1,enlargeYourContainer:!1,errorMessage:'

It seems you use an obsolete browser. Update it to start drawing.

'},a.Board.prototype={reset:function(a){a=$.extend({color:this.opts.color,size:this.opts.size,webStorage:!0,history:!0,background:!1},a),this.setMode("pencil"),a.background&&this.resetBackground(this.opts.background,!1),a.color&&this.setColor(a.color),a.size&&(this.ctx.lineWidth=a.size),this.ctx.lineCap="round",this.ctx.lineJoin="round",a.webStorage&&this.saveWebStorage(),a.history&&this.saveHistory(),this.blankCanvas=this.getImg(),this.ev.trigger("board:reset",a)},resetBackground:function(b,c){b=b||this.opts.background,c="undefined"==typeof c||c;var d=a.Utils.isColor(b),e=this.getMode();this.setMode("pencil"),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.width),d?(this.ctx.fillStyle=b,this.ctx.fillRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height)):b&&this.setImg(b),this.setMode(e),c&&this.saveHistory()},resize:function(){this.dom.$controls.toggleClass("drawing-board-controls-hidden",!this.controls||!this.controls.length);var b,c,d=[this.$el.width(),a.Utils.boxBorderWidth(this.$el),a.Utils.boxBorderWidth(this.dom.$canvasWrapper,!0,!0)],e=[this.$el.height(),a.Utils.boxBorderHeight(this.$el),this.dom.$controls.height(),a.Utils.boxBorderHeight(this.dom.$controls,!1,!0),a.Utils.boxBorderHeight(this.dom.$canvasWrapper,!0,!0)],f=function(a,b){b=b||1;for(var c=a[0],d=1;d30;)this.history.values.shift(),this.history.position--;0!==this.history.position&&this.history.position0&&n.push(a.Utils.pixelAt(c,m[e]-1,m[f])),m[e]0&&n.push(a.Utils.pixelAt(c,m[e],m[f]-1)),m[f]10&&this.isMouseHovering){this.dom.$cursor.css({width:this.ctx.lineWidth+"px",height:this.ctx.lineWidth+"px"});var b=a.Utils.tpl("translateX({{x}}px) translateY({{y}}px)",{x:this.coords.current.x-this.ctx.lineWidth/2,y:this.coords.current.y-this.ctx.lineWidth/2});this.dom.$cursor.css({transform:b,"-webkit-transform":b,"-ms-transform":b}),this.dom.$cursor.removeClass("drawing-board-utils-hidden")}else this.dom.$cursor.addClass("drawing-board-utils-hidden");if(this.isDrawing){var c=this._getMidInputCoords(this.coords.current);this.ctx.beginPath(),this.ctx.moveTo(c.x,c.y),this.ctx.quadraticCurveTo(this.coords.old.x,this.coords.old.y,this.coords.oldMid.x,this.coords.oldMid.y),this.ctx.stroke(),this.coords.old=this.coords.current,this.coords.oldMid=c}window.requestAnimationFrame&&requestAnimationFrame($.proxy(function(){this.draw()},this))},_onInputStart:function(a,b){this.coords.current=this.coords.old=b,this.coords.oldMid=this._getMidInputCoords(b),this.isDrawing=!0,window.requestAnimationFrame||this.draw(),this.ev.trigger("board:startDrawing",{e:a,coords:b}),a.preventDefault()},_onInputMove:function(a,b){this.coords.current=b,this.ev.trigger("board:drawing",{e:a,coords:b}),window.requestAnimationFrame||this.draw(),a.preventDefault()},_onInputStop:function(a,b){!this.isDrawing||a.touches&&0!==a.touches.length||(this.isDrawing=!1,this.saveWebStorage(),this.saveHistory(),this.ev.trigger("board:stopDrawing",{e:a,coords:b}),this.ev.trigger("board:userAction"),a.preventDefault())},_onMouseOver:function(a,b){this.isMouseHovering=!0,this.coords.old=this._getInputCoords(a),this.coords.oldMid=this._getMidInputCoords(this.coords.old),this.ev.trigger("board:mouseOver",{e:a,coords:b})},_onMouseOut:function(a,b){this.isMouseHovering=!1,this.ev.trigger("board:mouseOut",{e:a,coords:b})},_getInputCoords:function(a){a=a.originalEvent?a.originalEvent:a;var b,c;return a.touches&&1==a.touches.length?(b=a.touches[0].pageX,c=a.touches[0].pageY):(b=a.pageX,c=a.pageY),{x:b-this.dom.$canvas.offset().left,y:c-this.dom.$canvas.offset().top}},_getMidInputCoords:function(a){return{x:this.coords.old.x+a.x>>1,y:this.coords.old.y+a.y>>1}}},a.Control=function(a,b){return this.board=a,this.opts=$.extend({},this.defaults,b),this.$el=$(document.createElement("div")).addClass("drawing-board-control"),this.name&&this.$el.addClass("drawing-board-control-"+this.name),this.board.ev.bind("board:reset",$.proxy(this.onBoardReset,this)),this.initialize.apply(this,arguments),this},a.Control.prototype={name:"",defaults:{},initialize:function(){},addToBoard:function(){this.board.addControl(this)},onBoardReset:function(a){}},a.Control.extend=function(a,b){var c,d=this;c=a&&a.hasOwnProperty("constructor")?a.constructor:function(){return d.apply(this,arguments)},$.extend(c,d,b);var e=function(){this.constructor=c};return e.prototype=d.prototype,c.prototype=new e,a&&$.extend(c.prototype,a),c.__super__=d.prototype,c},a.Control.Color=a.Control.extend({name:"colors",initialize:function(){this.initTemplate();var a=this;this.$el.on("click",".drawing-board-control-colors-picker",function(b){var c=$(this).attr("data-color");a.board.setColor(c),a.$el.find(".drawing-board-control-colors-current").css("background-color",c).attr("data-color",c),a.board.ev.trigger("color:changed",c),a.$el.find(".drawing-board-control-colors-rainbows").addClass("drawing-board-utils-hidden"),b.preventDefault()}),this.$el.on("click",".drawing-board-control-colors-current",function(b){a.$el.find(".drawing-board-control-colors-rainbows").toggleClass("drawing-board-utils-hidden"),b.preventDefault()}),$("body").on("click",function(b){var c=$(b.target),d=c.hasClass("drawing-board-control-colors-current")?c:c.closest(".drawing-board-control-colors-current"),e=a.$el.find(".drawing-board-control-colors-current"),f=a.$el.find(".drawing-board-control-colors-rainbows");d.length&&d.get(0)===e.get(0)||f.hasClass("drawing-board-utils-hidden")||f.addClass("drawing-board-utils-hidden")})},initTemplate:function(){var b='
{{rainbows}}
',c='
',d="";$.each([.75,.5,.25],$.proxy(function(b,e){var f=0,g=null;for(d+='
',.25==e&&(g=this._rgba(0,0,0,1)),.5==e&&(g=this._rgba(150,150,150,1)),.75==e&&(g=this._rgba(255,255,255,1)),d+=a.Utils.tpl(c,{color:g.toString()});f<=330;)d+=a.Utils.tpl(c,{color:this._hsl2Rgba(this._hsl(f-60,1,e)).toString()}),f+=30;d+="
"},this)),this.$el.append($(a.Utils.tpl(b,{color:this.board.color,rainbows:d}))),this.$el.find(".drawing-board-control-colors-rainbows").addClass("drawing-board-utils-hidden")},onBoardReset:function(a){this.board.setColor(this.$el.find(".drawing-board-control-colors-current").attr("data-color"))},_rgba:function(a,b,c,d){return{r:a,g:b,b:c,a:d,toString:function(){return"rgba("+a+", "+b+", "+c+", "+d+")"}}},_hsl:function(a,b,c){return{h:a,s:b,l:c,toString:function(){return"hsl("+a+", "+100*b+"%, "+100*c+"%)"}}},_hex2Rgba:function(a){var b=parseInt(a.substring(1),16);return this._rgba(b>>16,b>>8&255,255&b,1)},_hsl2Rgba:function(a){function b(a,b,c){return c<0&&(c+=1),c>1&&(c-=1),c<1/6?a+6*(b-a)*c:c<.5?b:c<2/3?a+(b-a)*(2/3-c)*6:a}var c,d,e,f=a.h/360,g=a.s,h=a.l;if(0===g)c=d=e=h;else{var i=h<.5?h*(1+g):h+g-h*g,j=2*h-i;c=Math.floor(255*b(j,i,f+1/3)),d=Math.floor(255*b(j,i,f)),e=Math.floor(255*b(j,i,f-1/3))}return this._rgba(c,d,e,1)}}),a.Control.DrawingMode=a.Control.extend({name:"drawingmode",defaults:{pencil:!0,eraser:!0,filler:!0},initialize:function(){this.prevMode=this.board.getMode(),$.each(["pencil","eraser","filler"],$.proxy(function(a,b){this.opts[b]&&this.$el.append('')},this)),this.$el.on("click","button[data-mode]",$.proxy(function(a){var b=$(a.currentTarget).attr("data-mode"),c=this.board.getMode();c!==b&&(this.prevMode=c);var d=c===b?this.prevMode:b;this.board.setMode(d),a.preventDefault()},this)),this.board.ev.bind("board:mode",$.proxy(function(a){this.toggleButtons(a)},this)),this.toggleButtons(this.board.getMode())},toggleButtons:function(a){this.$el.find("button[data-mode]").each(function(b,c){var d=$(c);d.toggleClass("active",a===d.attr("data-mode"))})}}),a.Control.Navigation=a.Control.extend({name:"navigation",defaults:{back:!0,forward:!0,reset:!0},initialize:function(){var a="";if(this.opts.back&&(a+=''),this.opts.forward&&(a+=''),this.opts.reset&&(a+=''),this.$el.append(a),this.opts.back){var b=this.$el.find(".drawing-board-control-navigation-back");this.board.ev.bind("historyNavigation",$.proxy(function(a){1===a?b.attr("disabled","disabled"):b.removeAttr("disabled")},this)),this.$el.on("click",".drawing-board-control-navigation-back",$.proxy(function(a){this.board.goBackInHistory(),a.preventDefault()},this))}if(this.opts.forward){var c=this.$el.find(".drawing-board-control-navigation-forward");this.board.ev.bind("historyNavigation",$.proxy(function(a){a===this.board.history.values.length?c.attr("disabled","disabled"):c.removeAttr("disabled")},this)),this.$el.on("click",".drawing-board-control-navigation-forward",$.proxy(function(a){this.board.goForthInHistory(),a.preventDefault()},this))}this.opts.reset&&this.$el.on("click",".drawing-board-control-navigation-reset",$.proxy(function(a){this.board.reset({background:!0}),a.preventDefault()},this))}}),a.Control.Size=a.Control.extend({name:"size",defaults:{type:"auto",dropdownValues:[1,3,6,10,20,30,40,50]},types:["dropdown","range"],initialize:function(){"auto"==this.opts.type&&(this.opts.type=this._iHasRangeInput()?"range":"dropdown");var a=$.inArray(this.opts.type,this.types)>-1&&this["_"+this.opts.type+"Template"]();if(!a)return!1;this.val=this.board.opts.size,this.$el.append($(a)),this.$el.attr("data-drawing-board-type",this.opts.type),this.updateView();var b=this;"range"==this.opts.type&&this.$el.on("change",".drawing-board-control-size-range-input",function(a){b.val=$(this).val(),b.updateView(),b.board.ev.trigger("size:changed",b.val),a.preventDefault()}),"dropdown"==this.opts.type&&(this.$el.on("click",".drawing-board-control-size-dropdown-current",$.proxy(function(a){this.$el.find(".drawing-board-control-size-dropdown").toggleClass("drawing-board-utils-hidden")},this)),this.$el.on("click","[data-size]",function(a){b.val=parseInt($(this).attr("data-size"),0),b.updateView(),b.board.ev.trigger("size:changed",b.val),a.preventDefault()}))},_rangeTemplate:function(){var b='
';return a.Utils.tpl(b,{size:this.board.opts.size})},_dropdownTemplate:function(){var b='
    ';return $.each(this.opts.dropdownValues,function(c,d){b+=a.Utils.tpl('
  • ',{size:d})}),b+="
"},onBoardReset:function(a){this.updateView()},updateView:function(){var a=this.val;if(this.board.ctx.lineWidth=a,this.$el.find(".drawing-board-control-size-range-current, .drawing-board-control-size-dropdown-current span").css({width:a+"px",height:a+"px",borderRadius:a+"px",marginLeft:-1*a/2+"px",marginTop:-1*a/2+"px"}),this.$el.find(".drawing-board-control-inner").attr("title",a),"dropdown"==this.opts.type){var b=null;$.each(this.opts.dropdownValues,function(c,d){(null===b||Math.abs(d-a)'),this.$el.on("click",".drawing-board-control-download-button",$.proxy(function(a){this.board.downloadImg(),a.preventDefault()},this))}}),a.Utils={},a.Utils.tpl=function(){"use strict";var a,b="{{",c="}}",d="[a-z0-9_][\\.a-z0-9_]*",e=new RegExp(b+"\\s*("+d+")\\s*"+c,"gi");return function(b,c){return b.replace(e,function(b,d){for(var e=d.split("."),f=e.length,g=c,h=0;h=0;g--)f+=parseInt(a.css(e[g]).replace("px",""),10);return f},a.Utils.boxBorderWidth=function(b,c,d){return a.Utils._boxBorderSize(b,c,d,"width")},a.Utils.boxBorderHeight=function(b,c,d){return a.Utils._boxBorderSize(b,c,d,"height")},a.Utils.isColor=function(a){return!(!a||!a.length)&&(/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(a)||$.inArray(a.substring(0,3),["rgb","hsl"])!==-1)},a.Utils.RGBToInt=function(a,b,c){var d=0;return d|=(255&a)<<16,d|=(255&b)<<8,d|=255&c},a.Utils.pixelAt=function(b,c,d){var e=4*(d*b.width+c),f=a.Utils.RGBToInt(b.data[e],b.data[e+1],b.data[e+2]);return[e,c,d,f]},function(){for(var a=["ms","moz","webkit","o"],b=0;b
";if(-1";else d="
"+d;this.$el.addClass("drawing-board").append(d);this.dom={$canvasWrapper:this.$el.find(".drawing-board-canvas-wrapper"),$canvas:this.$el.find(".drawing-board-canvas"),$cursor:this.$el.find(".drawing-board-cursor"),$controls:this.$el.find(".drawing-board-controls")};$.each(["left","right","center"],$.proxy(function(a,b){if(-1It seems you use an obsolete browser. Update it to start drawing.

"};a.Board.prototype={reset:function reset(a){a=$.extend({color:this.opts.color,size:this.opts.size,webStorage:!0,history:!0,background:!1},a);this.setMode("pencil");if(a.background)this.resetBackground(this.opts.background,!1);if(a.color)this.setColor(a.color);if(a.size)this.ctx.lineWidth=a.size;this.ctx.lineCap="round";this.ctx.lineJoin="round";if(a.webStorage)this.saveWebStorage();if(a.history)this.saveHistory();this.blankCanvas=this.getImg();this.ev.trigger("board:reset",a)},resetBackground:function resetBackground(b,c){b=b||this.opts.background;c="undefined"!=typeof c?c:!0;var d=a.Utils.isColor(b),e=this.getMode();this.setMode("pencil");this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.width);if(d){this.ctx.fillStyle=b;this.ctx.fillRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height)}else if(b)this.setImg(b);this.setMode(e);if(c)this.saveHistory()},resize:function resize(){this.dom.$controls.toggleClass("drawing-board-controls-hidden",!this.controls||!this.controls.length);var b,c,d=[this.$el.width(),a.Utils.boxBorderWidth(this.$el),a.Utils.boxBorderWidth(this.dom.$canvasWrapper,!0,!0)],e=[this.$el.height(),a.Utils.boxBorderHeight(this.$el),this.dom.$controls.height(),a.Utils.boxBorderHeight(this.dom.$controls,!1,!0),a.Utils.boxBorderHeight(this.dom.$canvasWrapper,!0,!0)],f=this,g=function(a,b){b=b||1;for(var c=a[0],d=1;d>1,y:this.coords.old.y+a.y>>1}}};a.Control=function(a,b){this.board=a;this.opts=$.extend({},this.defaults,b);this.$el=$(document.createElement("div")).addClass("drawing-board-control");if(this.name)this.$el.addClass("drawing-board-control-"+this.name);this.board.ev.bind("board:reset",$.proxy(this.onBoardReset,this));this.initialize.apply(this,arguments);return this};a.Control.prototype={name:"",defaults:{},initialize:function initialize(){},addToBoard:function addToBoard(){this.board.addControl(this)},onBoardReset:function onBoardReset(){}};a.Control.extend=function(a,b){var c=this,d;if(a&&a.hasOwnProperty("constructor")){d=a.constructor}else{d=function(){return c.apply(this,arguments)}}$.extend(d,c,b);var e=function(){this.constructor=d};e.prototype=c.prototype;d.prototype=new e;if(a)$.extend(d.prototype,a);d.__super__=c.prototype;return d};a.Control.Color=a.Control.extend({name:"colors",initialize:function initialize(){this.initTemplate();var a=this;this.$el.on("click",".drawing-board-control-colors-picker",function(b){var c=$(this).attr("data-color");a.board.setColor(c);a.$el.find(".drawing-board-control-colors-current").css("background-color",c).attr("data-color",c);a.board.ev.trigger("color:changed",c);a.$el.find(".drawing-board-control-colors-rainbows").addClass("drawing-board-utils-hidden");b.preventDefault()});this.$el.on("click",".drawing-board-control-colors-current",function(b){a.$el.find(".drawing-board-control-colors-rainbows").toggleClass("drawing-board-utils-hidden");b.preventDefault()});$("body").on("click",function(b){var c=$(b.target),d=c.hasClass("drawing-board-control-colors-current")?c:c.closest(".drawing-board-control-colors-current"),e=a.$el.find(".drawing-board-control-colors-current"),f=a.$el.find(".drawing-board-control-colors-rainbows");if((!d.length||d.get(0)!==e.get(0))&&!f.hasClass("drawing-board-utils-hidden"))f.addClass("drawing-board-utils-hidden")})},initTemplate:function initTemplate(){var b="
",c="";$.each([.75,.5,.25],$.proxy(function(d,e){var f=0,g=null;c+="
";if(.25==e)g=this._rgba(0,0,0,1);if(.5==e)g=this._rgba(150,150,150,1);if(.75==e)g=this._rgba(255,255,255,1);c+=a.Utils.tpl(b,{color:g.toString()});while(330>=f){c+=a.Utils.tpl(b,{color:this._hsl2Rgba(this._hsl(f-60,1,e)).toString()});f+=30}c+="
"},this));this.$el.append($(a.Utils.tpl("
{{rainbows}}
",{color:this.board.color,rainbows:c})));this.$el.find(".drawing-board-control-colors-rainbows").addClass("drawing-board-utils-hidden")},onBoardReset:function onBoardReset(){this.board.setColor(this.$el.find(".drawing-board-control-colors-current").attr("data-color"))},_rgba:function _rgba(c,d,e,b){return{r:c,g:d,b:e,a:b,toString:function toString(){return"rgba("+c+", "+d+", "+e+", "+b+")"}}},_hsl:function _hsl(a,b,c){return{h:a,s:b,l:c,toString:function toString(){return"hsl("+a+", "+100*b+"%, "+100*c+"%)"}}},_hex2Rgba:function _hex2Rgba(a){var b=parseInt(a.substring(1),16);return this._rgba(b>>16,255&b>>8,255&b,1)},_hsl2Rgba:function _hsl2Rgba(a){var d=a.h/360,e=a.s,f=a.l,h,i,j;function c(a,b,c){if(0>c)c+=1;if(1f?f*(1+e):f+e-f*e,l=2*f-k;h=Math.floor(255*c(l,k,d+1/3));i=Math.floor(255*c(l,k,d));j=Math.floor(255*c(l,k,d-1/3))}return this._rgba(h,i,j,1)}});a.Control.DrawingMode=a.Control.extend({name:"drawingmode",defaults:{pencil:!0,eraser:!0,filler:!0},initialize:function initialize(){this.prevMode=this.board.getMode();$.each(["pencil","eraser","filler"],$.proxy(function(a,b){if(this.opts[b]){this.$el.append("")}},this));this.$el.on("click","button[data-mode]",$.proxy(function(a){var b=$(a.currentTarget).attr("data-mode"),c=this.board.getMode();if(c!==b)this.prevMode=c;var d=c===b?this.prevMode:b;this.board.setMode(d);a.preventDefault()},this));this.board.ev.bind("board:mode",$.proxy(function(a){this.toggleButtons(a)},this));this.toggleButtons(this.board.getMode())},toggleButtons:function toggleButtons(a){this.$el.find("button[data-mode]").each(function(b,c){var d=$(c);d.toggleClass("active",a===d.attr("data-mode"))})}});a.Control.Navigation=a.Control.extend({name:"navigation",defaults:{back:!0,forward:!0,reset:!0},initialize:function initialize(){var a="";if(this.opts.back)a+="";if(this.opts.forward)a+="";if(this.opts.reset)a+="";this.$el.append(a);if(this.opts.back){var b=this.$el.find(".drawing-board-control-navigation-back");this.board.ev.bind("historyNavigation",$.proxy(function(a){if(1===a)b.attr("disabled","disabled");else b.removeAttr("disabled")},this));this.$el.on("click",".drawing-board-control-navigation-back",$.proxy(function(a){this.board.goBackInHistory();a.preventDefault()},this))}if(this.opts.forward){var c=this.$el.find(".drawing-board-control-navigation-forward");this.board.ev.bind("historyNavigation",$.proxy(function(a){if(a===this.board.history.values.length)c.attr("disabled","disabled");else c.removeAttr("disabled")},this));this.$el.on("click",".drawing-board-control-navigation-forward",$.proxy(function(a){this.board.goForthInHistory();a.preventDefault()},this))}if(this.opts.reset){this.$el.on("click",".drawing-board-control-navigation-reset",$.proxy(function(a){this.board.reset({background:!0});a.preventDefault()},this))}}});a.Control.Size=a.Control.extend({name:"size",defaults:{type:"auto",dropdownValues:[1,3,6,10,20,30,40,50]},types:["dropdown","range"],initialize:function initialize(){if("auto"==this.opts.type)this.opts.type=this._iHasRangeInput()?"range":"dropdown";var a=-1<$.inArray(this.opts.type,this.types)?this["_"+this.opts.type+"Template"]():!1;if(!a)return!1;this.val=this.board.opts.size;this.$el.append($(a));this.$el.attr("data-drawing-board-type",this.opts.type);this.updateView();var b=this;if("range"==this.opts.type){this.$el.on("change",".drawing-board-control-size-range-input",function(a){b.val=$(this).val();b.updateView();b.board.ev.trigger("size:changed",b.val);a.preventDefault()})}if("dropdown"==this.opts.type){this.$el.on("click",".drawing-board-control-size-dropdown-current",$.proxy(function(){this.$el.find(".drawing-board-control-size-dropdown").toggleClass("drawing-board-utils-hidden")},this));this.$el.on("click","[data-size]",function(a){b.val=parseInt($(this).attr("data-size"),0);b.updateView();b.board.ev.trigger("size:changed",b.val);a.preventDefault()})}},_rangeTemplate:function _rangeTemplate(){return a.Utils.tpl("
",{size:this.board.opts.size})},_dropdownTemplate:function _dropdownTemplate(){var b="
    ";$.each(this.opts.dropdownValues,function(c,d){b+=a.Utils.tpl("
  • ",{size:d})});b+="
";return b},onBoardReset:function onBoardReset(){this.updateView()},updateView:function updateView(){var a=this.val;this.board.ctx.lineWidth=a;this.$el.find(".drawing-board-control-size-range-current, .drawing-board-control-size-dropdown-current span").css({width:a+"px",height:a+"px",borderRadius:a+"px",marginLeft:-1*a/2+"px",marginTop:-1*a/2+"px"});this.$el.find(".drawing-board-control-inner").attr("title",a);if("dropdown"==this.opts.type){var b=null;$.each(this.opts.dropdownValues,function(c,d){if(null===b||Math.abs(d-a)");this.$el.on("click",".drawing-board-control-download-button",$.proxy(function(a){this.board.downloadImg();a.preventDefault()},this))}});a.Utils={};a.Utils.tpl=function(){"use strict";var a=/{{\s*([a-z0-9_][\.a-z0-9_]*)\s*}}/gi,b;return function(c,d){return c.replace(a,function(a,c){var e=c.split("."),f=e.length,g=d,h=0;for(;h0?".front":"div:first-child":"autostrict"==h.front&&(h.front="div:first-child"),"auto"==h.back?h.back=g.find(".back").length>0?".back":"div:first-child + div":"autostrict"==h.back&&(h.back="div:first-child + div"),g.data("reverse",h.reverse),g.data("axis",h.axis),g.data("front",h.front),g.data("back",h.back);var i="rotate"+("x"==h.axis.toLowerCase()?"x":"y"),j=2*g["outer"+("rotatex"==i?"Height":"Width")]();g.find(g.data("back")).css({transform:i+"("+(h.reverse?"180deg":"-180deg")+")"}),g.css({perspective:j,position:"relative"});var k=h.speed/1e3||.5,l=g.find(h.front).add(h.back,g);if(h.forceHeight?l.outerHeight(g.height()):h.autoSize&&l.css({height:"100%"}),h.forceWidth?l.outerWidth(g.width()):h.autoSize&&l.css({width:"100%"}),l.css({"backface-visibility":"hidden","transform-style":"preserve-3d",position:"absolute","z-index":"1"}),l.find("*").css({"backface-visibility":"hidden"}),g.find(g.data("back")).css({transform:i+"("+(h.reverse?"180deg":"-180deg")+")","z-index":"0"}),(window.chrome||window.Intl&&Intl.v8BreakIterator)&&"CSS"in window&&g.css({"-webkit-transform-style":"preserve-3d"}),setTimeout(function(){l.css({transition:"all "+k+"s ease-out"}),void 0!==f&&f.call(this)},20),"click"==h.trigger.toLowerCase())g.on(a.fn.tap?"tap.flip":"click.flip",function(d){d||(d=window.event),g.find(a(d.target).closest('button, a, input[type="submit"]')).length||(g.data("flipped")?c(g):b(g))});else if("hover"==h.trigger.toLowerCase()){var m=function(){g.off("mouseleave.flip"),b(g),setTimeout(function(){g.on("mouseleave.flip",n),g.is(":hover")||c(g)},h.speed+150)},n=function(){c(g)};g.on("mouseenter.flip",m),g.on("mouseleave.flip",n)}}else"toggle"==d&&(d=!g.data("flipped")),d?b(g,f):c(g,f)}),this};var e=function(b,c){var d=!1;if(void 0!==b.axis&&a(this).data("axis")!=b.axis.toLowerCase()&&(a(this).data("axis",b.axis.toLowerCase()),d=!0),void 0!==b.reverse&&a(this).data("reverse")!=b.reverse&&(a(this).data("reverse",b.reverse),d=!0),d){var e=a(this).find(a(this).data("front")).add(a(this).data("back"),a(this)),f=e.css("transition");e.css({transition:"none"});var g="rotate"+a(this).data("axis");a(this).data("flipped")?a(this).find(a(this).data("front")).css({transform:g+(a(this).data("reverse")?"(-180deg)":"(180deg)"),"z-index":"0"}):a(this).find(a(this).data("back")).css({transform:g+"("+(a(this).data("reverse")?"180deg":"-180deg")+")","z-index":"0"}),setTimeout(function(){e.css({transition:f}),c.call(this)}.bind(this),0)}else setTimeout(c.bind(this),0)}}); \ No newline at end of file +(function(a){if("function"==typeof define&&define.amd){define ("filter_poodll/jquery.flip",["jquery"],a)}else{a(jQuery)}})(function(a){var b=function(b,c){b.data("flipped",!0);var e="rotate"+b.data("axis");b.find(b.data("front")).css({transform:e+(b.data("reverse")?"(-180deg)":"(180deg)"),"z-index":"0"});b.find(b.data("back")).css({transform:e+"(0deg)","z-index":"1"});b.one(d(),function(){a(this).trigger("flip:done");if(c!==void 0){c.call(this)}})},c=function(b,c){b.data("flipped",!1);var e="rotate"+b.data("axis");b.find(b.data("front")).css({transform:e+"(0deg)","z-index":"1"});b.find(b.data("back")).css({transform:e+(b.data("reverse")?"(180deg)":"(-180deg)"),"z-index":"0"});b.one(d(),function(){a(this).trigger("flip:done");if(c!==void 0){c.call(this)}})},d=function(){var a,b=document.createElement("fakeelement"),c={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(a in c){if(b.style[a]!==void 0){return c[a]}}};a.fn.flip=function(d,f){if("function"==typeof d){f=d}this.each(function(){var g=a(this);if(d!==void 0&&("boolean"==typeof d||"string"==typeof d)){if("toggle"==d){d=!g.data("flipped")}if(d){b(g,f)}else{c(g,f)}}else if(!g.data("initiated")){g.data("initiated",!0);var h=a.extend({axis:"y",reverse:!1,trigger:"click",speed:500,forceHeight:!1,forceWidth:!1,autoSize:!0,front:"auto",back:"auto"},d);if("auto"==h.front){h.front=0b;b++)if(b in this&&this[b]===a)return b;return-1};h=a("./actions"),i=a("./bindEvents"),k=a("./math"),l=a("./shapes"),j=l.createShape,q=l.shapeToJSON,e=l.JSONToShape,m=a("./canvasRenderer").renderShapeToContext,n=a("./svgRenderer").renderShapeToSVG,o=a("./renderSnapshotToImage"),p=a("./renderSnapshotToSVG"),g=a("../tools/Pencil"),r=a("./util"),d="infinite",b.exports=f=function(){function a(a,b){this.setImageSize=s(this.setImageSize,this);var c,e;e=null,c=null,a instanceof HTMLElement?(c=a,e=b):e=a,this.opts=e||{},this.config={zoomMin:e.zoomMin||.2,zoomMax:e.zoomMax||4,zoomStep:e.zoomStep||.2},this.colors={primary:e.primaryColor||"#000",secondary:e.secondaryColor||"#fff",background:e.backgroundColor||"transparent"},this.watermarkImage=e.watermarkImage,this.watermarkScale=e.watermarkScale||1,this.backgroundCanvas=document.createElement("canvas"),this.backgroundCtx=this.backgroundCanvas.getContext("2d"),this.canvas=document.createElement("canvas"),this.canvas.style["background-color"]="transparent",this.buffer=document.createElement("canvas"),this.buffer.style["background-color"]="transparent",this.ctx=this.canvas.getContext("2d"),this.bufferCtx=this.buffer.getContext("2d"),this.backingScale=r.getBackingScale(this.ctx),this.backgroundShapes=e.backgroundShapes||[],this._shapesInProgress=[],this.shapes=[],this.undoStack=[],this.redoStack=[],this.isDragging=!1,this.position={x:0,y:0},this.scale=1,this.setTool(new this.opts.tools[0](this)),this.width=e.imageSize.width||d,this.height=e.imageSize.height||d,this.setZoom(this.scale),e.snapshot&&this.loadSnapshot(e.snapshot),this.isBound=!1,c&&this.bindToElement(c),this.respondToSizeChange=function(){}}return a.prototype.bindToElement=function(a){var b,c;return this.containerEl?void console.warn("Trying to bind Literally Canvas to a DOM element more than once is unsupported."):(this.containerEl=a,this._unsubscribeEvents=i(this,this.containerEl,this.opts.keyboardShortcuts),this.containerEl.style["background-color"]=this.colors.background,this.containerEl.appendChild(this.backgroundCanvas),this.containerEl.appendChild(this.canvas),this.isBound=!0,c=function(a){return function(){return a.keepPanInImageBounds(),a.repaintAllLayers()}}(this),this.respondToSizeChange=r.matchElementSize(this.containerEl,[this.backgroundCanvas,this.canvas],this.backingScale,c),this.watermarkImage&&(this.watermarkImage.onload=function(a){return function(){return a.repaintLayer("background")}}(this)),null!=(b=this.tool)&&b.didBecomeActive(this),c())},a.prototype._teardown=function(){var a;return null!=(a=this.tool)&&a.willBecomeInactive(this),"function"==typeof this._unsubscribeEvents&&this._unsubscribeEvents(),this.tool=null,this.containerEl=null,this.isBound=!1},a.prototype.trigger=function(a,b){return this.canvas.dispatchEvent(new CustomEvent(a,{detail:b})),null},a.prototype.on=function(a,b){var c;return c=function(a){return b(a.detail)},this.canvas.addEventListener(a,c),function(b){return function(){return b.canvas.removeEventListener(a,c)}}(this)},a.prototype.getRenderScale=function(){return this.scale*this.backingScale},a.prototype.clientCoordsToDrawingCoords=function(a,b){return{x:(a*this.backingScale-this.position.x)/this.getRenderScale(),y:(b*this.backingScale-this.position.y)/this.getRenderScale()}},a.prototype.drawingCoordsToClientCoords=function(a,b){return{x:a*this.getRenderScale()+this.position.x,y:b*this.getRenderScale()+this.position.y}},a.prototype.setImageSize=function(a,b){return this.width=a||d,this.height=b||d,this.keepPanInImageBounds(),this.repaintAllLayers(),this.trigger("imageSizeChange",{width:this.width,height:this.height})},a.prototype.setTool=function(a){var b;return this.isBound&&null!=(b=this.tool)&&b.willBecomeInactive(this),this.tool=a,this.trigger("toolChange",{tool:a}),this.isBound?this.tool.didBecomeActive(this):void 0},a.prototype.setShapesInProgress=function(a){return this._shapesInProgress=a},a.prototype.pointerDown=function(a,b){var c;return c=this.clientCoordsToDrawingCoords(a,b),this.tool.usesSimpleAPI?(this.tool.begin(c.x,c.y,this),this.isDragging=!0,this.trigger("drawStart",{tool:this.tool})):(this.isDragging=!0,this.trigger("lc-pointerdown",{tool:this.tool,x:c.x,y:c.y,rawX:a,rawY:b}))},a.prototype.pointerMove=function(a,b){return r.requestAnimationFrame(function(c){return function(){var d,e;return d=c.clientCoordsToDrawingCoords(a,b),(null!=(e=c.tool)?e.usesSimpleAPI:0)?c.isDragging?(c.tool["continue"](d.x,d.y,c),c.trigger("drawContinue",{tool:c.tool})):void 0:c.isDragging?c.trigger("lc-pointerdrag",{tool:c.tool,x:d.x,y:d.y,rawX:a,rawY:b}):c.trigger("lc-pointermove",{tool:c.tool,x:d.x,y:d.y,rawX:a,rawY:b})}}(this))},a.prototype.pointerUp=function(a,b){var c;return c=this.clientCoordsToDrawingCoords(a,b),this.tool.usesSimpleAPI?this.isDragging?(this.tool.end(c.x,c.y,this),this.isDragging=!1,this.trigger("drawEnd",{tool:this.tool})):void 0:(this.isDragging=!1,this.trigger("lc-pointerup",{tool:this.tool,x:c.x,y:c.y,rawX:a,rawY:b}))},a.prototype.setColor=function(a,b){if(this.colors[a]=b,this.isBound){switch(a){case"background":this.containerEl.style.backgroundColor=this.colors.background,this.repaintLayer("background");break;case"primary":this.repaintLayer("main");break;case"secondary":this.repaintLayer("main")}return this.trigger(a+"ColorChange",this.colors[a]),"background"===a?this.trigger("drawingChange"):void 0}},a.prototype.getColor=function(a){return this.colors[a]},a.prototype.saveShape=function(a,b,c){return null==b&&(b=!0),null==c&&(c=null),c||(c=this.shapes.length?this.shapes[this.shapes.length-1].id:null),this.execute(new h.AddShapeAction(this,a,c)),b&&this.trigger("shapeSave",{shape:a,previousShapeId:c}),this.trigger("drawingChange")},a.prototype.pan=function(a,b){return this.setPan(this.position.x-a,this.position.y-b)},a.prototype.keepPanInImageBounds=function(){var a,b,c,e;return b=this.getRenderScale(),a=this.position,c=a.x,e=a.y,this.width!==d&&(c=this.canvas.width>this.width*b?(this.canvas.width-this.width*b)/2:Math.max(Math.min(0,c),this.canvas.width-this.width*b)),this.height!==d&&(e=this.canvas.height>this.height*b?(this.canvas.height-this.height*b)/2:Math.max(Math.min(0,e),this.canvas.height-this.height*b)),this.position={x:c,y:e}},a.prototype.setPan=function(a,b){return this.position={x:a,y:b},this.keepPanInImageBounds(),this.repaintAllLayers(),this.trigger("pan",{x:this.position.x,y:this.position.y})},a.prototype.zoom=function(a){var b;return b=this.scale+a,b=Math.max(b,this.config.zoomMin),b=Math.min(b,this.config.zoomMax),b=Math.round(100*b)/100,this.setZoom(b)},a.prototype.setZoom=function(a){var b;return b=this.scale,this.scale=a,this.position.x=k.scalePositionScalar(this.position.x,this.canvas.width,b,this.scale),this.position.y=k.scalePositionScalar(this.position.y,this.canvas.height,b,this.scale),this.keepPanInImageBounds(),this.repaintAllLayers(),this.trigger("zoom",{oldScale:b,newScale:this.scale})},a.prototype.setWatermarkImage=function(a){return this.watermarkImage=a,r.addImageOnload(a,function(a){return function(){return a.repaintLayer("background")}}(this)),a.width?this.repaintLayer("background"):void 0},a.prototype.repaintAllLayers=function(){var a,b,c,d;for(d=["background","main"],a=0,c=d.length;c>a;a++)b=d[a],this.repaintLayer(b);return null},a.prototype.repaintLayer=function(a,b){var c;if(null==b&&(b="main"===a),this.isBound){switch(a){case"background":this.backgroundCtx.clearRect(0,0,this.backgroundCanvas.width,this.backgroundCanvas.height),c=function(a){return function(){return a.repaintLayer("background")}}(this),this.watermarkImage&&this._renderWatermark(this.backgroundCtx,!0,c),this.draw(this.backgroundShapes,this.backgroundCtx,c);break;case"main":c=function(a){return function(){return a.repaintLayer("main",!0)}}(this),b&&(this.buffer.width=this.canvas.width,this.buffer.height=this.canvas.height,this.bufferCtx.clearRect(0,0,this.buffer.width,this.buffer.height),this.draw(this.shapes,this.bufferCtx,c)),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.canvas.width>0&&this.canvas.height>0&&(this.ctx.fillStyle="#ccc",this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height),this.clipped(function(a){return function(){return a.ctx.clearRect(0,0,a.canvas.width,a.canvas.height),a.ctx.drawImage(a.buffer,0,0)}}(this),this.ctx),this.clipped(function(a){return function(){return a.transformed(function(){var b,c,d,e,f;for(d=a._shapesInProgress,e=[],b=0,c=d.length;c>b;b++)f=d[b],e.push(m(a.ctx,f,{bufferCtx:a.bufferCtx,shouldOnlyDrawLatest:!0}));return e},a.ctx,a.bufferCtx)}}(this),this.ctx,this.bufferCtx))}return this.trigger("repaint",{layerKey:a})}},a.prototype._renderWatermark=function(a,b,c){return null==b&&(b=!0),this.watermarkImage.width?(a.save(),a.translate(a.canvas.width/2,a.canvas.height/2),a.scale(this.watermarkScale,this.watermarkScale),b&&a.scale(this.backingScale,this.backingScale),a.drawImage(this.watermarkImage,-this.watermarkImage.width/2,-this.watermarkImage.height/2),a.restore()):void(this.watermarkImage.onload=c)},a.prototype.drawShapeInProgress=function(a){return this.repaintLayer("main",!1),this.clipped(function(b){return function(){return b.transformed(function(){return m(b.ctx,a,{bufferCtx:b.bufferCtx,shouldOnlyDrawLatest:!0})},b.ctx,b.bufferCtx)}}(this),this.ctx,this.bufferCtx)},a.prototype.draw=function(a,b,c){var d;if(a.length)return d=function(d){return function(){var d,e,f,g;for(f=[],d=0,e=a.length;e>d;d++)g=a[d],f.push(m(b,g,{retryCallback:c}));return f}}(this),this.clipped(function(a){return function(){return a.transformed(d,b)}}(this),b)},a.prototype.clipped=function(){var a,b,c,e,f,g,h,i,j,k,l,m;for(c=arguments[0],a=2<=arguments.length?t.call(arguments,1):[],l=this.width===d?0:this.position.x,m=this.height===d?0:this.position.y,k=function(){switch(this.width){case d:return this.canvas.width;default:return this.width*this.getRenderScale()}}.call(this),e=function(){switch(this.height){case d:return this.canvas.height;default:return this.height*this.getRenderScale()}}.call(this),f=0,h=a.length;h>f;f++)b=a[f],b.save(),b.beginPath(),b.rect(l,m,k,e),b.clip();for(c(),j=[],g=0,i=a.length;i>g;g++)b=a[g],j.push(b.restore());return j},a.prototype.transformed=function(){var a,b,c,d,e,f,g,h,i;for(c=arguments[0],a=2<=arguments.length?t.call(arguments,1):[],d=0,f=a.length;f>d;d++)b=a[d],b.save(),b.translate(Math.floor(this.position.x),Math.floor(this.position.y)),i=this.getRenderScale(),b.scale(i,i);for(c(),h=[],e=0,g=a.length;g>e;e++)b=a[e],h.push(b.restore());return h},a.prototype.clear=function(a){var b,c;return null==a&&(a=!0),c=this.shapes,b=[],this.setShapesInProgress([]),this.execute(new h.ClearAction(this,c,b)),this.repaintLayer("main"),a&&this.trigger("clear",null),this.trigger("drawingChange",{})},a.prototype.execute=function(a){return this.undoStack.push(a),a["do"](),this.redoStack=[]},a.prototype.undo=function(){var a;if(this.undoStack.length)return a=this.undoStack.pop(),a.undo(),this.redoStack.push(a),this.trigger("undo",{action:a}),this.trigger("drawingChange",{})},a.prototype.redo=function(){var a;if(this.redoStack.length)return a=this.redoStack.pop(),this.undoStack.push(a),a["do"](),this.trigger("redo",{action:a}),this.trigger("drawingChange",{})},a.prototype.canUndo=function(){return!!this.undoStack.length},a.prototype.canRedo=function(){return!!this.redoStack.length},a.prototype.getPixel=function(a,b){var c,d;return c=this.drawingCoordsToClientCoords(a,b),d=this.ctx.getImageData(c.x,c.y,1,1).data,d[3]?"rgb("+d[0]+", "+d[1]+", "+d[2]+")":null},a.prototype.getContentBounds=function(){return r.getBoundingRect(this.shapes.concat(this.backgroundShapes).map(function(a){return a.getBoundingRect()}),this.width===d?0:this.width,this.height===d?0:this.height)},a.prototype.getDefaultImageRect=function(a,b){var c;return null==a&&(a={width:0,height:0}),null==b&&(b={top:0,right:0,bottom:0,left:0}),r.getDefaultImageRect(function(){var a,b,d,e;for(d=this.shapes.concat(this.backgroundShapes),e=[],a=0,b=d.length;b>a;a++)c=d[a],e.push(c.getBoundingRect(this.ctx));return e}.call(this),a,b)},a.prototype.getImage=function(a){return null==a&&(a={}),null==a.includeWatermark&&(a.includeWatermark=!0),null==a.scaleDownRetina&&(a.scaleDownRetina=!0),null==a.scale&&(a.scale=1),a.scaleDownRetina||(a.scale*=this.backingScale),a.includeWatermark&&(a.watermarkImage=this.watermarkImage,a.watermarkScale=this.watermarkScale,a.scaleDownRetina||(a.watermarkScale*=this.backingScale)),o(this.getSnapshot(),a)},a.prototype.canvasForExport=function(){return this.repaintAllLayers(),r.combineCanvases(this.backgroundCanvas,this.canvas)},a.prototype.canvasWithBackground=function(a){return r.combineCanvases(a,this.canvasForExport())},a.prototype.getSnapshot=function(a){var b,c,d,e,f,g;for(null==a&&(a=null),null==a&&(a=["shapes","imageSize","colors","position","scale","backgroundShapes"]),g={},e=["colors","position","scale"],b=0,d=e.length;d>b;b++)c=e[b],u.call(a,c)>=0&&(g[c]=this[c]);return u.call(a,"shapes")>=0&&(g.shapes=function(){var a,b,c,d;for(c=this.shapes,d=[],a=0,b=c.length;b>a;a++)f=c[a],d.push(q(f));return d}.call(this)),u.call(a,"backgroundShapes")>=0&&(g.backgroundShapes=function(){var a,b,c,d;for(c=this.backgroundShapes,d=[],a=0,b=c.length;b>a;a++)f=c[a],d.push(q(f));return d}.call(this)),u.call(a,"imageSize")>=0&&(g.imageSize={width:this.width,height:this.height}),g},a.prototype.getSnapshotJSON=function(){return console.warn("lc.getSnapshotJSON() is deprecated. use JSON.stringify(lc.getSnapshot()) instead."),JSON.stringify(this.getSnapshot())},a.prototype.getSVGString=function(a){return null==a&&(a={}),p(this.getSnapshot(),a)},a.prototype.loadSnapshot=function(a){var b,c,d,f,g,i,j,k,l,m;if(a){if(a.colors)for(i=["primary","secondary","background"],b=0,f=i.length;f>b;b++)d=i[b],this.setColor(d,a.colors[d]);if(a.shapes)for(this.shapes=[],j=a.shapes,c=0,g=j.length;g>c;c++)m=j[c],l=e(m),l&&this.execute(new h.AddShapeAction(this,l));return a.backgroundShapes&&(this.backgroundShapes=function(){var b,c,d,f;for(d=a.backgroundShapes,f=[],b=0,c=d.length;c>b;b++)k=d[b],f.push(e(k));return f}()),a.imageSize&&(this.width=a.imageSize.width,this.height=a.imageSize.height),a.position&&(this.position=a.position),a.scale&&(this.scale=a.scale),this.repaintAllLayers(),this.trigger("snapshotLoad"),this.trigger("drawingChange",{})}},a.prototype.loadSnapshotJSON=function(a){return console.warn("lc.loadSnapshotJSON() is deprecated. use lc.loadSnapshot(JSON.parse(snapshot)) instead."),this.loadSnapshot(JSON.parse(a))},a}()},{"../tools/Pencil":48,"./actions":7,"./bindEvents":8,"./canvasRenderer":9,"./math":14,"./renderSnapshotToImage":15,"./renderSnapshotToSVG":16,"./shapes":17,"./svgRenderer":18,"./util":19}],6:[function(a,b,c){var d,e,f,g;a("./fontmetrics.js"),g=function(a){var b,c,d,e,f,g,h,i;for(c=a.split(" "),d=0,f=0,g=c.length;g>f;f++)e=c[f],h=parseInt(e.replace("px",""),10),isNaN(h)||(d=h);if(!d)throw"Font size not found";return i=a.substring(c[0].length+1).replace("bold ","").replace("italic ","").replace("underline ",""),b=i,{fontSize:d,fontFamily:b}},f=function(a,b,c){var d,e,f,g,h,i,j,k,l,m;if(!b.length)return["",""];for(e=0,i=0,j=0,m=!1;;)if(e+=1,f=e>=b.length,h=!f&&b[e].match(/\s/),g=h||f,l=b.substring(0,e),d=!c||a.measureTextWidth(l).width<=c,d&&(j=e),g&&m&&(m=!1,d&&(i=e)),m=!h,f||!d){if(d)return[b,""];if(i>0){for(k=i+1;kd;d++)if(l=m[d],i=f(a,l,c),h=i[0],k=i[1],h)for(;h;)g.push(h),j=f(a,k,c),h=j[0],k=j[1];else g.push(l);return g},d=function(){function a(a,b,c,d,f){var h,i,j;this.text=b,this.font=c,this.forcedWidth=d,this.forcedHeight=f,j=g(this.font),h=j.fontFamily,i=j.fontSize,a.font=this.font,a.textBaseline="baseline",this.emDashWidth=a.measureTextWidth("—",i,h).width,this.caratWidth=a.measureTextWidth("|",i,h).width,this.lines=e(a,this.text,this.forcedWidth),this.metricses=this.lines.map(function(b){return function(c){return a.measureText2(c||"X",i,b.font)}}(this)),this.metrics={ascent:Math.max.apply(Math,this.metricses.map(function(a){var b;return b=a.ascent})),descent:Math.max.apply(Math,this.metricses.map(function(a){var b;return b=a.descent})),fontsize:Math.max.apply(Math,this.metricses.map(function(a){var b;return b=a.fontsize})),leading:Math.max.apply(Math,this.metricses.map(function(a){var b;return b=a.leading})),width:Math.max.apply(Math,this.metricses.map(function(a){var b;return b=a.width})),height:Math.max.apply(Math,this.metricses.map(function(a){var b;return b=a.height})),bounds:{minx:Math.min.apply(Math,this.metricses.map(function(a){var b;return b=a.bounds,b.minx})),miny:Math.min.apply(Math,this.metricses.map(function(a){var b;return b=a.bounds,b.miny})),maxx:Math.max.apply(Math,this.metricses.map(function(a){var b;return b=a.bounds,b.maxx})),maxy:Math.max.apply(Math,this.metricses.map(function(a){var b;return b=a.bounds,b.maxy}))}},this.boundingBoxWidth=Math.ceil(this.metrics.width)}return a.prototype.draw=function(a,b,c){var d,e,f,g,h,i;for(a.textBaseline="top",a.font=this.font,d=0,h=this.lines,i=[],e=0,f=h.length;f>e;e++)g=h[e],a.fillText(g,b,c+d*this.metrics.leading),i.push(d+=1);return i},a.prototype.getWidth=function(a){return null==a&&(a=!1),this.forcedWidth?this.forcedWidth:a?this.metrics.bounds.maxx+this.caratWidth:this.metrics.bounds.maxx},a.prototype.getHeight=function(){return this.forcedHeight||this.metrics.leading*this.lines.length},a}(),b.exports=d},{"./fontmetrics.js":11}],7:[function(a,b,c){var d,e;e=function(){function a(a,b,c){this.lc=a,this.oldShapes=b,this.newShapes=c}return a.prototype["do"]=function(){return this.lc.shapes=this.newShapes,this.lc.repaintLayer("main")},a.prototype.undo=function(){return this.lc.shapes=this.oldShapes,this.lc.repaintLayer("main")},a}(),d=function(){function a(a,b,c){this.lc=a,this.shape=b,this.previousShapeId=null!=c?c:null}return a.prototype["do"]=function(){var a,b,c,d,e,f;if(this.lc.shapes.length&&this.lc.shapes[this.lc.shapes.length-1].id!==this.previousShapeId&&null!==this.previousShapeId){for(d=[],a=!1,e=this.lc.shapes,b=0,c=e.length;c>b;b++)f=e[b],d.push(f),f.id===this.previousShapeId&&(d.push(this.shape),a=!0);a||d.push(this.shape),this.lc.shapes=d}else this.lc.shapes.push(this.shape);return this.lc.repaintLayer("main")},a.prototype.undo=function(){var a,b,c,d,e;if(this.lc.shapes[this.lc.shapes.length-1].id===this.shape.id)this.lc.shapes.pop();else{for(c=[],d=this.lc.shapes,a=0,b=d.length;b>a;a++)e=d[a],e.id!==this.shape.id&&c.push(e);lc.shapes=c}return this.lc.repaintLayer("main")},a}(),b.exports={ClearAction:e,AddShapeAction:d}},{}],8:[function(a,b,c){var d,e,f,g;f=function(a,b){var c,d,e;return d=b.changedTouches[0].clientX,e=b.changedTouches[0].clientY,c=a.getBoundingClientRect(),[d-c.left,e-c.top]},g=function(a,b){var c;return c=a.getBoundingClientRect(),{left:b.clientX-c.left,top:b.clientY-c.top}},e=function(a){return null!=a.buttons?1===a.buttons:a.which>0},b.exports=d=function(a,b,c){var d,e,h,i,j,k;return null==c&&(c=!1),k=[],e=function(c){return function(c){var d;return c.preventDefault(),d=g(b,c),a.pointerMove(d.left,d.top)}}(this),h=function(c){return function(c){var d;return c.preventDefault(),b.onselectstart=function(){return!0},d=g(b,c),a.pointerUp(d.left,d.top),document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",h),b.addEventListener("mousemove",e)}}(this),b.addEventListener("mousedown",function(c){return function(c){var d,f;if("canvas"===c.target.tagName.toLowerCase())return d=!0,c.preventDefault(),b.onselectstart=function(){return!1},f=g(b,c),a.pointerDown(f.left,f.top),b.removeEventListener("mousemove",e),document.addEventListener("mousemove",e),document.addEventListener("mouseup",h)}}(this)),j=function(c){return c.preventDefault(),a.pointerMove.apply(a,f(b,c))},i=function(c){return c.preventDefault(),a.pointerUp.apply(a,f(b,c)),document.removeEventListener("touchmove",j),document.removeEventListener("touchend",i),document.removeEventListener("touchcancel",i)},b.addEventListener("touchstart",function(c){return"canvas"===c.target.tagName.toLowerCase()?(c.preventDefault(),1===c.touches.length?(a.pointerDown.apply(a,f(b,c)),document.addEventListener("touchmove",j),document.addEventListener("touchend",i),document.addEventListener("touchcancel",i)):a.pointerMove.apply(a,f(b,c))):void 0}),c&&(console.warn("Keyboard panning is deprecated."),d=function(b){switch(b.keyCode){case 37:a.pan(-10,0);break;case 38:a.pan(0,-10);break;case 39:a.pan(10,0);break;case 40:a.pan(0,10)}return a.repaintAllLayers()},document.addEventListener("keydown",d),k.push(function(){return document.removeEventListener(d)})),function(){var a,b,c,d;for(d=[],b=0,c=k.length;c>b;b++)a=k[b],d.push(a());return d}}},{}],9:[function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n;j=a("./lineEndCapShapes"),n={},e=function(a,b,c){return n[a]={drawFunc:b,drawLatestFunc:c}},k=function(){},m=function(a,b,c){var d;if(null==c&&(c={}),null==c.shouldIgnoreUnsupportedShapes&&(c.shouldIgnoreUnsupportedShapes=!1),null==c.retryCallback&&(c.retryCallback=k),null==c.shouldOnlyDrawLatest&&(c.shouldOnlyDrawLatest=!1),null==c.bufferCtx&&(c.bufferCtx=null),d=c.bufferCtx,n[b.className])return c.shouldOnlyDrawLatest&&n[b.className].drawLatestFunc?n[b.className].drawLatestFunc(a,d,b,c.retryCallback):n[b.className].drawFunc(a,b,c.retryCallback);if(c.shouldIgnoreUnsupportedShapes)return console.warn("Can't render shape of type "+b.className+" to canvas");throw"Can't render shape of type "+b.className+" to canvas"},l=function(a,b,c){return m(a.getContext("2d"),b,c)},e("Rectangle",function(a,b){var c,d;return c=b.x,d=b.y,b.strokeWidth%2!==0&&(c+=.5,d+=.5),a.fillStyle=b.fillColor,a.fillRect(c,d,b.width,b.height),a.lineWidth=b.strokeWidth,a.strokeStyle=b.strokeColor,a.strokeRect(c,d,b.width,b.height)}),e("Ellipse",function(a,b){var c,d,e,f;return a.save(),f=Math.floor(b.width/2),e=Math.floor(b.height/2),c=b.x+f,d=b.y+e,a.translate(c,d),a.scale(1,Math.abs(b.height/b.width)),a.beginPath(),a.arc(0,0,Math.abs(f),0,2*Math.PI),a.closePath(),a.restore(),a.fillStyle=b.fillColor,a.fill(),a.lineWidth=b.strokeWidth,a.strokeStyle=b.strokeColor,a.stroke()}),e("SelectionBox",function(){var a;return a=function(a,b,c){var d,e;return d=b.x,e=b.y,0!==c?(a.fillStyle="#fff",a.fillRect(d,e,c,c),a.strokeStyle="#000",a.strokeRect(d,e,c,c)):void 0},function(b,c){return a(b,c.getTopLeftHandleRect(),c.handleSize),a(b,c.getTopRightHandleRect(),c.handleSize),a(b,c.getBottomLeftHandleRect(),c.handleSize),a(b,c.getBottomRightHandleRect(),c.handleSize),c.backgroundColor&&(b.fillStyle=c.backgroundColor,b.fillRect(c._br.x-c.margin,c._br.y-c.margin,c._br.width+2*c.margin,c._br.height+2*c.margin)),b.lineWidth=1,b.strokeStyle="#000",b.setLineDash([2,4]),b.strokeRect(c._br.x-c.margin,c._br.y-c.margin,c._br.width+2*c.margin,c._br.height+2*c.margin),b.setLineDash([])}}()),e("Image",function(a,b,c){return b.image.width?1===b.scale?a.drawImage(b.image,b.x,b.y):a.drawImage(b.image,b.x,b.y,b.image.width*b.scale,b.image.height*b.scale):c?b.image.onload=c:void 0}),e("Line",function(a,b){var c,d,e,f,g;if(b.x1!==b.x2||b.y1!==b.y2)return d=b.x1,e=b.x2,f=b.y1,g=b.y2,b.strokeWidth%2!==0&&(d+=.5,e+=.5,f+=.5,g+=.5),a.lineWidth=b.strokeWidth,a.strokeStyle=b.color,a.lineCap=b.capStyle,b.dash&&a.setLineDash(b.dash),a.beginPath(),a.moveTo(d,f),a.lineTo(e,g),a.stroke(),b.dash&&a.setLineDash([]),c=Math.max(2.2*b.strokeWidth,5),b.endCapShapes[0]&&j[b.endCapShapes[0]].drawToCanvas(a,d,f,Math.atan2(f-g,d-e),c,b.color),b.endCapShapes[1]?j[b.endCapShapes[1]].drawToCanvas(a,e,g,Math.atan2(g-f,e-d),c,b.color):void 0}),d=function(a,b,c,d){var e,f,g,h;if(null==c&&(c=!1),null==d&&(d="round"),b.length){for(a.lineCap=d,a.strokeStyle=b[0].color,a.lineWidth=b[0].size,a.beginPath(),b[0].size%2===0?a.moveTo(b[0].x,b[0].y):a.moveTo(b[0].x+.5,b[0].y+.5),h=b.slice(1),e=0,f=h.length;f>e;e++)g=h[e],b[0].size%2===0?a.lineTo(g.x,g.y):a.lineTo(g.x+.5,g.y+.5);return c?a.closePath():void 0}},h=function(a,b){return d(a,b.smoothedPoints),a.stroke()},i=function(a,b,c){var e,f,g;return c.tail?(g=c.smoothedPoints.length-c.segmentSize*c.tailSize,f=g<2*c.segmentSize?0:g,e=g+c.segmentSize+1,d(b,c.smoothedPoints.slice(f,e)),b.stroke()):(d(b,c.smoothedPoints),b.stroke())},e("LinePath",h,i),f=function(a,b){return a.save(),a.globalCompositeOperation="destination-out",h(a,b),a.restore()},g=function(a,b,c){return a.save(),a.globalCompositeOperation="destination-out",b.save(),b.globalCompositeOperation="destination-out",i(a,b,c),a.restore(),b.restore()},e("ErasedLinePath",f,g),e("Text",function(a,b){return b.renderer||b._makeRenderer(a),a.fillStyle=b.color,b.renderer.draw(a,b.x,b.y)}),e("Polygon",function(a,b){return a.fillStyle=b.fillColor,d(a,b.points,b.isClosed,"butt"),a.fill(),a.stroke()}),b.exports={defineCanvasRenderer:e,renderShapeToCanvas:l,renderShapeToContext:m}},{"./lineEndCapShapes":12}],10:[function(a,b,c){"use strict";b.exports={imageURLPrefix:"lib/img",primaryColor:"hsla(0, 0%, 0%, 1)",secondaryColor:"hsla(0, 0%, 100%, 1)",backgroundColor:"transparent",strokeWidths:[1,2,5,10,20,30],defaultStrokeWidth:5,toolbarPosition:"top",keyboardShortcuts:!1,imageSize:{width:"infinite",height:"infinite"},backgroundShapes:[],watermarkImage:null,watermarkScale:1,zoomMin:.2,zoomMax:4,zoomStep:.2,snapshot:null,onInit:function(){},tools:[a("../tools/Pencil"),a("../tools/Eraser"),a("../tools/Line"),a("../tools/Rectangle"),a("../tools/Ellipse"),a("../tools/Text"),a("../tools/Polygon"),a("../tools/Pan"),a("../tools/Eyedropper")]}},{"../tools/Ellipse":43,"../tools/Eraser":44,"../tools/Eyedropper":45,"../tools/Line":46,"../tools/Pan":47,"../tools/Pencil":48,"../tools/Polygon":49,"../tools/Rectangle":50,"../tools/Text":52}],11:[function(a,b,c){"use strict";!function(){if(!document.defaultView.getComputedStyle)throw"ERROR: 'document.defaultView.getComputedStyle' not found. This library only works in browsers that can report computed CSS values.";CanvasRenderingContext2D.prototype.measureTextWidth=CanvasRenderingContext2D.prototype.measureText;var a=function(a,b){return document.defaultView.getComputedStyle(a,null).getPropertyValue(b)};CanvasRenderingContext2D.prototype.measureText2=function(b,c,d){var e=this.measureTextWidth(b),f=!/\S/.test(b);e.fontsize=c;var g=document.createElement("div");g.style.position="absolute",g.style.opacity=0,g.style.font=d,g.innerHTML=b+"
"+b,document.body.appendChild(g),e.leading=1.2*c;var h=a(g,"height");if(h=h.replace("px",""),h>=2*c&&(e.leading=h/2|0),document.body.removeChild(g),f)e.ascent=0,e.descent=0,e.bounds={minx:0,maxx:e.width,miny:0,maxy:0},e.height=0;else{var i=document.createElement("canvas"),j=100;i.width=e.width+j,i.height=3*c,i.style.opacity=1,i.style.font=d;var k=i.getContext("2d");k.font=d;var l=i.width,m=i.height,n=m/2;k.fillStyle="white",k.fillRect(-1,-1,l+2,m+2),k.fillStyle="black",k.fillText(b,j/2,n);for(var o=k.getImageData(0,0,l,m).data,p=0,q=4*l,r=o.length;++p0&&255===o[p];);var t=p/q|0;for(p=0;r>p&&255===o[p];)p+=q,p>=r&&(p=p-r+4);var u=p%q/4|0,v=1;for(p=r-3;p>=0&&255===o[p];)p-=q,0>p&&(p=r-3-4*v++);var w=p%q/4+1|0;e.ascent=n-s,e.descent=t-n,e.bounds={minx:u-j/2,maxx:w-j/2,miny:0,maxy:t-s},e.height=1+(t-s)}return e}}()},{}],12:[function(a,b,c){b.exports={arrow:function(){var a;return a=function(a,b,c,d,e){return[{x:a+Math.cos(c+Math.PI/2)*d/2,y:b+Math.sin(c+Math.PI/2)*d/2},{x:a+Math.cos(c)*e,y:b+Math.sin(c)*e},{x:a+Math.cos(c-Math.PI/2)*d/2,y:b+Math.sin(c-Math.PI/2)*d/2}]},{drawToCanvas:function(b,c,d,e,f,g,h){var i;return null==h&&(h=0),h=h||f,b.fillStyle=g,b.lineWidth=0,b.strokeStyle="transparent",b.beginPath(),i=a(c,d,e,f,h),b.moveTo(i[0].x,i[0].y),b.lineTo(i[1].x,i[1].y),b.lineTo(i[2].x,i[2].y),b.fill()},svg:function(b,c,d,e,f,g){var h;return null==g&&(g=0),g=g||e,h=a(b,c,d,e,g),""}}}()}},{}],13:[function(a,b,c){var d,e,f;f={},e=function(a){return f=a},d=function(a){var b;return b=f[a],b||a},b.exports={localize:e,_:d}},{}],14:[function(a,b,c){var d,e,f,g,h,i;d=a("./shapes").Point,i=a("./util"),f={},f.toPoly=function(a){var b,c,d,f,h,i,j;for(i=[],j=[],c=0,b=0,d=a.length;d>b;b++)h=a[b],f=g(h,e(a,c)),i=i.concat([f[0]]),j=[f[1]].concat(j),c+=1;return i.concat(j)},e=function(a,b){var c;return a.length<3&&(c={x:0,y:0}),c=0===b?e(a,b+1):b===a.length-1?e(a,b-1):f.diff(a[b-1],a[b+1])},f.diff=function(a,b){return{x:b.x-a.x,y:b.y-a.y}},h=function(a){var b;return b=f.len(a),{x:a.x/b,y:a.y/b}},g=function(a,b){return b=h(b),b.x=b.x*a.size/2,b.y=b.y*a.size/2,[{x:a.x-b.y,y:a.y+b.x,color:a.color},{x:a.x+b.y,y:a.y-b.x,color:a.color}]},f.len=function(a){return Math.sqrt(Math.pow(a.x,2)+Math.pow(a.y,2))},f.scalePositionScalar=function(a,b,c,d){var e,f;return f=b*c,e=b*d,a+(f-e)/2},b.exports=f},{"./shapes":17,"./util":19}],15:[function(a,b,c){var d,e,f,g;g=a("./util"),e=a("./shapes").JSONToShape,d="infinite",f=function(a,b,c){return b.width?(a.save(),a.translate(a.canvas.width/2,a.canvas.height/2),a.scale(c,c),a.drawImage(b,-b.width/2,-b.height/2),a.restore()):void 0},b.exports=function(a,b){var c,h,i,j,k,l,m,n;return null==b&&(b={}),null==b.scale&&(b.scale=1),l=function(){var b,c,d,f;for(d=a.shapes,f=[],b=0,c=d.length;c>b;b++)k=d[b],f.push(e(k));return f}(),h=[],a.backgroundShapes&&(h=function(){var b,c,d,f;for(d=a.backgroundShapes,f=[],b=0,c=d.length;c>b;b++)k=d[b],f.push(e(k));return f}()),null==b.margin&&(b.margin={top:0,right:0,bottom:0,left:0}),j=a.imageSize||{width:d,height:d},i=a.colors||{background:"transparent"},c=l.concat(h),m=document.createElement("canvas"),n=m.getContext("2d"),b.rect?(b.rect.x-=b.margin.left,b.rect.y-=b.margin.top,b.rect.width+=b.margin.left+b.margin.right,b.rect.height+=b.margin.top+b.margin.bottom):b.rect=g.getDefaultImageRect(function(){var a,b,d;for(d=[],a=0,b=c.length;b>a;a++)k=c[a],d.push(k.getBoundingRect(n));return d}(),j,b.margin),m.width=b.rect.width*b.scale,m.height=b.rect.height*b.scale,n.fillStyle=i.background,n.fillRect(0,0,m.width,m.height),b.rect.width&&b.rect.height?(b.watermarkImage&&f(n,b.watermarkImage,b.watermarkScale),g.combineCanvases(m,g.renderShapes(h,b.rect,b.scale),g.renderShapes(l,b.rect,b.scale))):null}},{"./shapes":17,"./util":19}],16:[function(a,b,c){ -var d,e,f;f=a("./util"),e=a("./shapes").JSONToShape,d="infinite",b.exports=function(a,b){var c,g,h,i,j,k,l,m;return null==b&&(b={}),m=function(){var b,c,d,f;for(d=a.shapes,f=[],b=0,c=d.length;c>b;b++)l=d[b],f.push(e(l));return f}(),g=[],a.backgroundShapes&&(g=function(){var b,c,d,f;for(d=a.backgroundShapes,f=[],b=0,c=d.length;c>b;b++)l=d[b],f.push(e(l));return f}()),null==b.margin&&(b.margin={top:0,right:0,bottom:0,left:0}),k=a.imageSize||{width:d,height:d},h=a.colors||{background:"transparent"},c=m.concat(g),j=document.createElement("canvas"),i=j.getContext("2d"),b.rect?(b.rect.x-=b.margin.left,b.rect.y-=b.margin.top,b.rect.width+=b.margin.left+b.margin.right,b.rect.height+=b.margin.top+b.margin.bottom):b.rect=f.getDefaultImageRect(function(){var a,b,d;for(d=[],a=0,b=c.length;b>a;a++)l=c[a],d.push(l.getBoundingRect(i));return d}(),k,b.margin),LC.renderShapesToSVG(g.concat(m),b.rect,h.background)}},{"./shapes":17,"./util":19}],17:[function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y;y=a("./util"),f=a("./TextRenderer"),q=a("./lineEndCapShapes"),s=a("./canvasRenderer"),n=s.defineCanvasRenderer,u=s.renderShapeToContext,t=a("./svgRenderer"),o=t.defineSVGRenderer,v=t.renderShapeToSVG,x={},p=function(a,b){var c,d,e,f,g,h,i,j;c=function(a,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q){return b.constructor.call(this,a,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q),this},c.prototype.className=a,c.fromJSON=b.fromJSON,b.draw&&(g=b.draw,h=b.draw||function(a,b,c){return this.draw(a,b,c)},d=function(a,b,c){return g.call(b,a,c)},e=function(a,b,c,d){return h.call(c,a,b,d)},delete b.draw,b.drawLatest&&delete b.drawLatest,n(a,d,e)),b.toSVG&&(i=b.toSVG,j=function(a){return i.call(a)},delete b.toSVG,o(a,j)),c.prototype.draw=function(a,b){return u(a,this,{retryCallback:b})},c.prototype.drawLatest=function(a,b,c){return u(a,this,{retryCallback:c,bufferCtx:b,shouldOnlyDrawLatest:!0})},c.prototype.toSVG=function(){return v(this)};for(f in b)"fromJSON"!==f&&(c.prototype[f]=b[f]);return x[a]=c,c},m=function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q){var r;return r=new x[a](b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q),r.id=y.getGUID(),r},d=function(a){var b,c,d,e;return b=a.className,c=a.data,d=a.id,b in x?(e=x[b].fromJSON(c),e?(d&&(e.id=d),e):(console.log("Unreadable shape:",b,c),null)):(console.log("Unknown shape:",b,c),null)},w=function(a){return{className:a.className,data:a.toJSON(),id:a.id}},l=function(a,b){return b?l(i(i(k(a))),b-1):a},k=function(a){var b,c,d,e,f;for(a=[a[0]].concat(a).concat(y.last(a)),f=[],b=0,e=0,c=a.length;c>e;e++)d=a[e],f[2*b]=d,a[b+1]&&(f[2*b+1]=j(d,a[b+1])),b+=1;return f},i=function(a){var b,c,d,e,f;for(b=[],c=0,f=0,d=a.length;d>f;f++)e=a[f],a[c+1]&&(b[c]=j(e,a[c+1])),c+=1;return b},j=function(a,b){return m("Point",{x:a.x+(b.x-a.x)/2,y:a.y+(b.y-a.y)/2,size:a.size+(b.size-a.size)/2,color:a.color})},p("Image",{constructor:function(a){return null==a&&(a={}),this.x=a.x||0,this.y=a.y||0,this.scale=a.scale||1,this.image=a.image||null},getBoundingRect:function(){return{x:this.x,y:this.y,width:this.image.width*this.scale,height:this.image.height*this.scale}},toJSON:function(){return{x:this.x,y:this.y,imageSrc:this.image.src,imageObject:this.image,scale:this.scale}},fromJSON:function(a){var b,c;return b=null,(null!=(c=a.imageObject)?c.width:void 0)?b=a.imageObject:(b=new Image,b.src=a.imageSrc),m("Image",{x:a.x,y:a.y,image:b,scale:a.scale})},move:function(a){return null==a&&(a={}),this.x=this.x-a.xDiff,this.y=this.y-a.yDiff},setUpperLeft:function(a){return null==a&&(a={}),this.x=a.x,this.y=a.y}}),p("Rectangle",{constructor:function(a){return null==a&&(a={}),this.x=a.x||0,this.y=a.y||0,this.width=a.width||0,this.height=a.height||0,this.strokeWidth=a.strokeWidth||1,this.strokeColor=a.strokeColor||"black",this.fillColor=a.fillColor||"transparent"},getBoundingRect:function(){return{x:this.x-this.strokeWidth/2,y:this.y-this.strokeWidth/2,width:this.width+this.strokeWidth,height:this.height+this.strokeWidth}},toJSON:function(){return{x:this.x,y:this.y,width:this.width,height:this.height,strokeWidth:this.strokeWidth,strokeColor:this.strokeColor,fillColor:this.fillColor}},fromJSON:function(a){return m("Rectangle",a)},move:function(a){return null==a&&(a={}),this.x=this.x-a.xDiff,this.y=this.y-a.yDiff},setUpperLeft:function(a){return null==a&&(a={}),this.x=a.x,this.y=a.y}}),p("Ellipse",{constructor:function(a){return null==a&&(a={}),this.x=a.x||0,this.y=a.y||0,this.width=a.width||0,this.height=a.height||0,this.strokeWidth=a.strokeWidth||1,this.strokeColor=a.strokeColor||"black",this.fillColor=a.fillColor||"transparent"},getBoundingRect:function(){return{x:this.x-this.strokeWidth/2,y:this.y-this.strokeWidth/2,width:this.width+this.strokeWidth,height:this.height+this.strokeWidth}},toJSON:function(){return{x:this.x,y:this.y,width:this.width,height:this.height,strokeWidth:this.strokeWidth,strokeColor:this.strokeColor,fillColor:this.fillColor}},fromJSON:function(a){return m("Ellipse",a)},move:function(a){return null==a&&(a={}),this.x=this.x-a.xDiff,this.y=this.y-a.yDiff},setUpperLeft:function(a){return null==a&&(a={}),this.x=a.x,this.y=a.y}}),p("Line",{constructor:function(a){return null==a&&(a={}),this.x1=a.x1||0,this.y1=a.y1||0,this.x2=a.x2||0,this.y2=a.y2||0,this.strokeWidth=a.strokeWidth||1,this.color=a.color||"black",this.capStyle=a.capStyle||"round",this.endCapShapes=a.endCapShapes||[null,null],this.dash=a.dash||null},getBoundingRect:function(){return{x:Math.min(this.x1,this.x2)-this.strokeWidth/2,y:Math.min(this.y1,this.y2)-this.strokeWidth/2,width:Math.abs(this.x2-this.x1)+this.strokeWidth/2,height:Math.abs(this.y2-this.y1)+this.strokeWidth/2}},toJSON:function(){return{x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2,strokeWidth:this.strokeWidth,color:this.color,capStyle:this.capStyle,dash:this.dash,endCapShapes:this.endCapShapes}},fromJSON:function(a){return m("Line",a)},move:function(a){return null==a&&(a={}),this.x1=this.x1-a.xDiff,this.y1=this.y1-a.yDiff,this.x2=this.x2-a.xDiff,this.y2=this.y2-a.yDiff},setUpperLeft:function(a){var b,c,d;return null==a&&(a={}),b=this.getBoundingRect(),c=b.x-a.x,d=b.y-a.y,this.move({xDiff:c,yDiff:d})}}),h=function(a){var b,c,d,e,f;if(!a.length)return!1;for(f=a[0].size,b=a[0].color,e=0,c=a.length;c>e;e++)if(d=a[e],d.size===f&&d.color===b||console.log(f,b,d.size,d.color),d.size!==f||d.color!==b)return!1;return!0},g=function(a,b){var c,e,f,g,h;return e=null,b.points?e=function(){var a,e,f,g;for(f=b.points,g=[],e=0,a=f.length;a>e;e++)c=f[e],g.push(d(c));return g}():b.pointCoordinatePairs&&(e=function(){var a,c,e,f,i;for(e=b.pointCoordinatePairs,i=[],c=0,a=e.length;a>c;c++)f=e[c],g=f[0],h=f[1],i.push(d({className:"Point",data:{x:g,y:h,size:b.pointSize,color:b.pointColor,smooth:b.smooth}}));return i}()),f=null,b.smoothedPointCoordinatePairs&&(f=function(){var a,c,e,f,i;for(e=b.smoothedPointCoordinatePairs,i=[],c=0,a=e.length;a>c;c++)f=e[c],g=f[0],h=f[1],i.push(d({className:"Point",data:{x:g,y:h,size:b.pointSize,color:b.pointColor,smooth:b.smooth}}));return i}()),e[0]?m(a,{points:e,smoothedPoints:f,order:b.order,tailSize:b.tailSize,smooth:b.smooth}):null},r={constructor:function(a){var b,c,d,e,f;if(null==a&&(a={}),d=a.points||[],this.order=a.order||3,this.tailSize=a.tailSize||3,this.smooth=!("smooth"in a)||a.smooth,this.segmentSize=Math.pow(2,this.order),this.sampleSize=this.tailSize+1,a.smoothedPoints)return this.points=a.points,this.smoothedPoints=a.smoothedPoints;for(this.points=[],f=[],e=0,b=d.length;b>e;e++)c=d[e],f.push(this.addPoint(c));return f},getBoundingRect:function(){return y.getBoundingRect(this.points.map(function(a){return{x:a.x-a.size/2,y:a.y-a.size/2,width:a.size,height:a.size}}))},toJSON:function(){var a,b;return h(this.points)?{order:this.order,tailSize:this.tailSize,smooth:this.smooth,pointCoordinatePairs:function(){var a,c,d,e;for(d=this.points,e=[],c=0,a=d.length;a>c;c++)b=d[c],e.push([b.x,b.y]);return e}.call(this),smoothedPointCoordinatePairs:function(){var a,c,d,e;for(d=this.smoothedPoints,e=[],c=0,a=d.length;a>c;c++)b=d[c],e.push([b.x,b.y]);return e}.call(this),pointSize:this.points[0].size,pointColor:this.points[0].color}:{order:this.order,tailSize:this.tailSize,smooth:this.smooth,points:function(){var b,c,d,e;for(d=this.points,e=[],c=0,b=d.length;b>c;c++)a=d[c],e.push(w(a));return e}.call(this)}},fromJSON:function(a){return g("LinePath",a)},addPoint:function(a){return this.points.push(a),this.smooth?!this.smoothedPoints||this.points.lengthe;e++)c=d[e],c.move(a);return this.points=this.smoothedPoints},setUpperLeft:function(a){var b,c,d;return null==a&&(a={}),b=this.getBoundingRect(),c=b.x-a.x,d=b.y-a.y,this.move({xDiff:c,yDiff:d})}},e=p("LinePath",r),p("ErasedLinePath",{constructor:r.constructor,toJSON:r.toJSON,addPoint:r.addPoint,getBoundingRect:r.getBoundingRect,fromJSON:function(a){return g("ErasedLinePath",a)}}),p("Point",{constructor:function(a){return null==a&&(a={}),this.x=a.x||0,this.y=a.y||0,this.size=a.size||0,this.color=a.color||""},getBoundingRect:function(){return{x:this.x-this.size/2,y:this.y-this.size/2,width:this.size,height:this.size}},toJSON:function(){return{x:this.x,y:this.y,size:this.size,color:this.color}},fromJSON:function(a){return m("Point",a)},move:function(a){return null==a&&(a={}),this.x=this.x-a.xDiff,this.y=this.y-a.yDiff},setUpperLeft:function(a){return null==a&&(a={}),this.x=a.x,this.y=a.y}}),p("Polygon",{constructor:function(a){var b,c,d,e,f;for(null==a&&(a={}),this.points=a.points,this.fillColor=a.fillColor||"white",this.strokeColor=a.strokeColor||"black",this.strokeWidth=a.strokeWidth,this.dash=a.dash||null,null==a.isClosed&&(a.isClosed=!0),this.isClosed=a.isClosed,e=this.points,f=[],d=0,b=e.length;b>d;d++)c=e[d],c.color=this.strokeColor,f.push(c.size=this.strokeWidth);return f},addPoint:function(a,b){return this.points.push(LC.createShape("Point",{x:a,y:b}))},getBoundingRect:function(){return y.getBoundingRect(this.points.map(function(a){return a.getBoundingRect()}))},toJSON:function(){return{strokeWidth:this.strokeWidth,fillColor:this.fillColor,strokeColor:this.strokeColor,dash:this.dash,isClosed:this.isClosed,pointCoordinatePairs:this.points.map(function(a){return[a.x,a.y]})}},fromJSON:function(a){return a.points=a.pointCoordinatePairs.map(function(b){var c,d;return c=b[0],d=b[1],m("Point",{x:c,y:d,size:a.strokeWidth,color:a.strokeColor})}),m("Polygon",a)},move:function(a){var b,c,d,e,f;for(null==a&&(a={}),e=this.points,f=[],d=0,b=e.length;b>d;d++)c=e[d],f.push(c.move(a));return f},setUpperLeft:function(a){var b,c,d;return null==a&&(a={}),b=this.getBoundingRect(),c=b.x-a.x,d=b.y-a.y,this.move({xDiff:c,yDiff:d})}}),p("Text",{constructor:function(a){return null==a&&(a={}),this.x=a.x||0,this.y=a.y||0,this.v=a.v||0,this.text=a.text||"",this.color=a.color||"black",this.font=a.font||"18px sans-serif",this.forcedWidth=a.forcedWidth||null,this.forcedHeight=a.forcedHeight||null},_makeRenderer:function(a){return a.lineHeight=1.2,this.renderer=new f(a,this.text,this.font,this.forcedWidth,this.forcedHeight),this.v<1?(console.log("repairing baseline"),this.v=1,this.x-=this.renderer.metrics.bounds.minx,this.y-=this.renderer.metrics.leading-this.renderer.metrics.descent):void 0},setText:function(a){return this.text=a,this.renderer=null},setFont:function(a){return this.font=a,this.renderer=null},setPosition:function(a,b){return this.x=a,this.y=b},setSize:function(a,b){return this.forcedWidth=Math.max(a,0),this.forcedHeight=Math.max(b,0),this.renderer=null},enforceMaxBoundingRect:function(a){var b,c,d;return b=this.getBoundingRect(a.ctx),d={x:-a.position.x/a.scale,y:-a.position.y/a.scale,width:a.canvas.width/a.scale,height:a.canvas.height/a.scale},b.x+b.width>d.x+d.width?(c=b.x-d.x,this.forcedWidth=d.width-c-10,this.renderer=null):void 0},getBoundingRect:function(a,b){if(null==b&&(b=!1),!this.renderer){if(!a)throw"Must pass ctx if text hasn't been rendered yet";this._makeRenderer(a)}return{x:Math.floor(this.x),y:Math.floor(this.y),width:Math.ceil(this.renderer.getWidth(!0)),height:Math.ceil(this.renderer.getHeight())}},toJSON:function(){return{x:this.x,y:this.y,text:this.text,color:this.color,font:this.font,forcedWidth:this.forcedWidth,forcedHeight:this.forcedHeight,v:this.v}},fromJSON:function(a){return m("Text",a)},move:function(a){return null==a&&(a={}),this.x=this.x-a.xDiff,this.y=this.y-a.yDiff},setUpperLeft:function(a){return null==a&&(a={}),this.x=a.x,this.y=a.y}}),p("SelectionBox",{constructor:function(a){return null==a&&(a={}),this.shape=a.shape,null!=a.handleSize?this.handleSize=a.handleSize:this.handleSize=10,this.margin=4,this.backgroundColor=a.backgroundColor||null,this._br=this.shape.getBoundingRect(a.ctx)},toJSON:function(){return{shape:w(this.shape),backgroundColor:this.backgroundColor}},fromJSON:function(a){var b,c,e,f;return f=a.shape,c=a.handleSize,e=a.margin,b=a.backgroundColor,m("SelectionBox",{shape:d(f),backgroundColor:b})},getTopLeftHandleRect:function(){return{x:this._br.x-this.handleSize-this.margin,y:this._br.y-this.handleSize-this.margin,width:this.handleSize,height:this.handleSize}},getBottomLeftHandleRect:function(){return{x:this._br.x-this.handleSize-this.margin,y:this._br.y+this._br.height+this.margin,width:this.handleSize,height:this.handleSize}},getTopRightHandleRect:function(){return{x:this._br.x+this._br.width+this.margin,y:this._br.y-this.handleSize-this.margin,width:this.handleSize,height:this.handleSize}},getBottomRightHandleRect:function(){return{x:this._br.x+this._br.width+this.margin,y:this._br.y+this._br.height+this.margin,width:this.handleSize,height:this.handleSize}},getBoundingRect:function(){return{x:this._br.x-this.margin,y:this._br.y-this.margin,width:this._br.width+2*this.margin,height:this._br.height+2*this.margin}}}),b.exports={defineShape:p,createShape:m,JSONToShape:d,shapeToJSON:w}},{"./TextRenderer":6,"./canvasRenderer":9,"./lineEndCapShapes":12,"./svgRenderer":18,"./util":19}],18:[function(a,b,c){var d,e,f,g;e=a("./lineEndCapShapes"),g={},d=function(a,b){return g[a]=b},f=function(a,b){if(null==b&&(b={}),null==b.shouldIgnoreUnsupportedShapes&&(b.shouldIgnoreUnsupportedShapes=!1),g[a.className])return g[a.className](a);if(b.shouldIgnoreUnsupportedShapes)return console.warn("Can't render shape of type "+a.className+" to SVG"),"";throw"Can't render shape of type "+a.className+" to SVG"},d("Rectangle",function(a){var b,c,d,e,f,g,h,i;return e=a.x,h=a.y,f=a.x+a.width,i=a.y+a.height,d=Math.min(e,f),g=Math.min(h,i),c=Math.max(e,f)-d,b=Math.max(h,i)-g,a.strokeWidth%2!==0&&(d+=.5,g+=.5),""}),d("SelectionBox",function(a){return""}),d("Ellipse",function(a){var b,c,d,e;return e=Math.floor(a.width/2),d=Math.floor(a.height/2),b=a.x+e,c=a.y+d,""}),d("Image",function(a){return""}),d("Line",function(a){var b,c,d,f,g,h,i;return d=a.dash?"stroke-dasharray='"+a.dash.join(", ")+"'":"",c="",b=Math.max(2.2*a.strokeWidth,5),f=a.x1,g=a.x2,h=a.y1,i=a.y2,a.strokeWidth%2!==0&&(f+=.5,g+=.5,h+=.5,i+=.5),a.endCapShapes[0]&&(c+=e[a.endCapShapes[0]].svg(f,h,Math.atan2(h-i,f-g),b,a.color)),a.endCapShapes[1]&&(c+=e[a.endCapShapes[1]].svg(g,i,Math.atan2(i-h,g-f),b,a.color))," "+c+" "}),d("LinePath",function(a){return""}),d("ErasedLinePath",function(a){return""}),d("Polygon",function(a){return a.isClosed?"":" "}),d("Text",function(a){var b,c,d;return d=a.forcedWidth?"width='"+a.forcedWidth+"px'":"",b=a.forcedHeight?"height='"+a.forcedHeight+"px'":"",c=a.text.split(/\r\n|\r|\n/g),a.renderer&&(c=a.renderer.lines)," "+c.map(function(b){return function(b,c){var d;return d=0===c?0:"1.2em"," "+b+" "}}(this)).join("")+" "}),b.exports={defineSVGRenderer:d,renderShapeToSVG:f}},{"./lineEndCapShapes":12}],19:[function(a,b,c){var d,e,f,g,h=[].slice;f=Array.prototype.slice,d=a("./canvasRenderer").renderShapeToContext,e=a("./svgRenderer").renderShapeToSVG,g={addImageOnload:function(a,b){var c;return c=a.onload,a.onload=function(){return"function"==typeof c&&c(),b()},a},last:function(a,b){return null==b&&(b=null),b?f.call(a,Math.max(a.length-b,0)):a[a.length-1]},classSet:function(a){var b,c;b=[];for(c in a)a[c]&&b.push(c);return b.join(" ")},matchElementSize:function(a,b,c,d){var e;return null==d&&(d=function(){}),e=function(e){return function(){var e,f,g;for(f=0,g=b.length;g>f;f++)e=b[f],e.style.width=a.offsetWidth+"px",e.style.height=a.offsetHeight+"px",null!=e.width&&(e.setAttribute("width",e.offsetWidth*c),e.setAttribute("height",e.offsetHeight*c));return d()}}(this),a.addEventListener("resize",e),window.addEventListener("resize",e),window.addEventListener("orientationchange",e),e(),e},combineCanvases:function(){var a,b,c,d,e,f,g,i;for(c=1<=arguments.length?h.call(arguments,0):[],a=document.createElement("canvas"),a.width=c[0].width,a.height=c[0].height,e=0,g=c.length;g>e;e++)b=c[e],a.width=Math.max(b.width,a.width),a.height=Math.max(b.height,a.height);for(d=a.getContext("2d"),f=0,i=c.length;i>f;f++)b=c[f],d.drawImage(b,0,0);return a},renderShapes:function(a,b,c,e){var f,g,h,i;for(null==c&&(c=1),null==e&&(e=null),e=e||document.createElement("canvas"),e.width=b.width*c,e.height=b.height*c,f=e.getContext("2d"),f.translate(-b.x*c,-b.y*c),f.scale(c,c),g=0,h=a.length;h>g;g++)i=a[g],d(f,i);return e},renderShapesToSVG:function(a,b,c){var d,f,g,h;return g=b.x,h=b.y,f=b.width,d=b.height,(" "+a.map(e).join("")+" ").replace(/(\r\n|\n|\r)/gm,"")},getBoundingRect:function(a,b,c){var d,e,f,g,h,i,j;if(!a.length)return{x:0,y:0,width:b,height:c};for(h=a[0].x,i=a[0].y,f=a[0].x+a[0].width,g=a[0].y+a[0].height,d=0,e=a.length;e>d;d++)j=a[d],h=Math.floor(Math.min(j.x,h)),i=Math.floor(Math.min(j.y,i)),f=Math.ceil(Math.max(f,j.x+j.width)),g=Math.ceil(Math.max(g,j.y+j.height));return h=b?0:h,i=c?0:i,f=b||f,g=c||g,{x:h,y:i,width:f-h,height:g-i}},getDefaultImageRect:function(a,b,c){var d,e,f;return null==b&&(b={width:0,height:0}),null==c&&(c={top:0,right:0,bottom:0,left:0}),f=b.width,d=b.height,e=g.getBoundingRect(a,"infinite"===f?0:f,"infinite"===d?0:d),e.x-=c.left,e.y-=c.top,e.width+=c.left+c.right,e.height+=c.top+c.bottom,e},getBackingScale:function(a){return null==window.devicePixelRatio?1:window.devicePixelRatio>1?window.devicePixelRatio:1},requestAnimationFrame:(window.requestAnimationFrame||window.setTimeout).bind(window),getGUID:function(){var a;return a=function(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)},function(){return a()+a()+"-"+a()+"-"+a()+"-"+a()+"-"+a()+a()+a()}}(),requestAnimationFrame:function(a){return window.requestAnimationFrame?window.requestAnimationFrame(a):window.webkitRequestAnimationFrame?window.webkitRequestAnimationFrame(a):window.mozRequestAnimationFrame?window.mozRequestAnimationFrame(a):setTimeout(a,0)},cancelAnimationFrame:function(a){return window.cancelAnimationFrame?window.cancelAnimationFrame(a):window.webkitCancelRequestAnimationFrame?window.webkitCancelRequestAnimationFrame(a):window.webkitCancelAnimationFrame?window.webkitCancelAnimationFrame(a):window.mozCancelAnimationFrame?window.mozCancelAnimationFrame(a):clearTimeout(a)}},b.exports=g},{"./canvasRenderer":9,"./svgRenderer":18}],20:[function(a,b,c){"use strict";!function(){function a(a,b){b=b||{bubbles:!1,cancelable:!1,detail:void 0};var c=document.createEvent("CustomEvent");return c.initCustomEvent(a,b.bubbles,b.cancelable,b.detail),c}a.prototype=window.CustomEvent.prototype,window.CustomEvent=a}()},{}],21:[function(a,b,c){"use strict";var d=!1;CanvasRenderingContext2D.prototype.setLineDash||(CanvasRenderingContext2D.prototype.setLineDash=function(){d||(console.warn("context2D.setLineDash is a no-op in this browser."),d=!0)}),b.exports=null},{}],22:[function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x;a("./ie_customevent"),a("./ie_setLineDash"),d=a("./core/LiterallyCanvas"),j=a("./core/defaultOptions"),g=a("./core/canvasRenderer"),v=a("./core/svgRenderer"),u=a("./core/shapes"),x=a("./core/util"),r=a("./core/renderSnapshotToImage"),s=a("./core/renderSnapshotToSVG"),p=a("./core/localization").localize,e=a("./reactGUI/LiterallyCanvas"),n=a("./reactGUI/initDOM"),a("./optionsStyles/font"),a("./optionsStyles/stroke-width"),a("./optionsStyles/line-options-and-stroke-width"),a("./optionsStyles/polygon-and-stroke-width"),a("./optionsStyles/stroke-or-fill"),a("./optionsStyles/null"),l=a("./optionsStyles/optionsStyles").defineOptionsStyle,h={snapshotToShapes:function(a){var b,c,d,e,f;for(d=a.shapes,e=[],b=0,c=d.length;c>b;b++)f=d[b],e.push(u.JSONToShape(f));return e},snapshotJSONToShapes:function(a){return h.snapshotToShapes(JSON.parse(a))}},f=a("./tools/base"),w={Pencil:a("./tools/Pencil"),Eraser:a("./tools/Eraser"),Line:a("./tools/Line"),Rectangle:a("./tools/Rectangle"),Ellipse:a("./tools/Ellipse"),Text:a("./tools/Text"),Polygon:a("./tools/Polygon"),Pan:a("./tools/Pan"),Eyedropper:a("./tools/Eyedropper"),SelectShape:a("./tools/SelectShape"),Tool:f.Tool,ToolWithStroke:f.ToolWithStroke},k=j.tools,i=j.imageURLPrefix,t=function(a){return i=a,j.imageURLPrefix=a},m=function(b,c){var d,e,f,g,h;null==c&&(c={});for(g in j)g in c||(c[g]=j[g]);for(h=b.children,e=0,f=h.length;f>e;e++)d=h[e],b.removeChild(d);return a("./reactGUI/initDOM")(b,c)},o=function(a,b){var c,e,f;return f=a.className,-1===[" "," "].join(a.className).indexOf(" literally ")&&(a.className=a.className+" literally"),a.className=a.className+" toolbar-hidden",c=document.createElement("div"),c.className="lc-drawing",a.appendChild(c),e=new d(c,b),e.teardown=function(){var b,c,d,g;for(e._teardown(),g=a.children,c=0,d=g.length;d>c;c++)b=g[c],a.removeChild(b);return a.className=f},"onInit"in b&&b.onInit(e),e},q=function(a){return a.fn.literallycanvas=function(a){return null==a&&(a={}),this.each(function(b){return function(b,c){return c.literallycanvas=m(c,a)}}(this)),this}},"undefined"!=typeof window&&(window.LC={init:m},window.$&&q(window.$)),b.exports={init:m,registerJQueryPlugin:q,util:x,tools:w,setDefaultImageURLPrefix:t,defaultTools:k,defineOptionsStyle:l,LiterallyCanvasReactComponent:e,defineShape:u.defineShape,createShape:u.createShape,JSONToShape:u.JSONToShape,shapeToJSON:u.shapeToJSON,defineCanvasRenderer:g.defineCanvasRenderer,renderShapeToContext:g.renderShapeToContext,renderShapeToCanvas:g.renderShapeToCanvas,renderShapesToCanvas:x.renderShapes,defineSVGRenderer:v.defineSVGRenderer,renderShapeToSVG:v.renderShapeToSVG,renderShapesToSVG:x.renderShapesToSVG,snapshotToShapes:h.snapshotToShapes,snapshotJSONToShapes:h.snapshotJSONToShapes,renderSnapshotToImage:r,renderSnapshotToSVG:s,localize:p}},{"./core/LiterallyCanvas":5,"./core/canvasRenderer":9,"./core/defaultOptions":10,"./core/localization":13,"./core/renderSnapshotToImage":15,"./core/renderSnapshotToSVG":16,"./core/shapes":17,"./core/svgRenderer":18,"./core/util":19,"./ie_customevent":20,"./ie_setLineDash":21,"./optionsStyles/font":23,"./optionsStyles/line-options-and-stroke-width":24,"./optionsStyles/null":25,"./optionsStyles/optionsStyles":26,"./optionsStyles/polygon-and-stroke-width":27,"./optionsStyles/stroke-or-fill":28,"./optionsStyles/stroke-width":29,"./reactGUI/LiterallyCanvas":32,"./reactGUI/initDOM":42,"./tools/Ellipse":43,"./tools/Eraser":44,"./tools/Eyedropper":45,"./tools/Line":46,"./tools/Pan":47,"./tools/Pencil":48,"./tools/Polygon":49,"./tools/Rectangle":50,"./tools/SelectShape":51,"./tools/Text":52,"./tools/base":53}],23:[function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;for(h=a("../reactGUI/React-shim"),l=a("./optionsStyles").defineOptionsStyle,k=a("../core/localization")._,i=[["Arial",'Arial,"Helvetica Neue",Helvetica,sans-serif'],["Arial Black",'"Arial Black","Arial Bold",Gadget,sans-serif'],["Arial Narrow",'"Arial Narrow",Arial,sans-serif'],["Gill Sans",'"Gill Sans","Gill Sans MT",Calibri,sans-serif'],["Helvetica",'"Helvetica Neue",Helvetica,Arial,sans-serif'],["Impact",'Impact,Haettenschweiler,"Franklin Gothic Bold",Charcoal,"Helvetica Inserat","Bitstream Vera Sans Bold","Arial Black",sans-serif'],["Tahoma","Tahoma,Verdana,Segoe,sans-serif"],["Trebuchet MS",'"Trebuchet MS","Lucida Grande","Lucida Sans Unicode","Lucida Sans",Tahoma,sans-serif'],["Verdana","Verdana,Geneva,sans-serif"]].map(function(a){var b,c;return b=a[0],c=a[1],{name:k(b),value:c}}),j=[["Baskerville",'Baskerville,"Baskerville Old Face","Hoefler Text",Garamond,"Times New Roman",serif'],["Garamond",'Garamond,Baskerville,"Baskerville Old Face","Hoefler Text","Times New Roman",serif'],["Georgia",'Georgia,Times,"Times New Roman",serif'],["Hoefler Text",'"Hoefler Text","Baskerville Old Face",Garamond,"Times New Roman",serif'],["Lucida Bright",'"Lucida Bright",Georgia,serif'],["Palatino",'Palatino,"Palatino Linotype","Palatino LT STD","Book Antiqua",Georgia,serif'],["Times New Roman",'TimesNewRoman,"Times New Roman",Times,Baskerville,Georgia,serif']].map(function(a){var b,c;return b=a[0],c=a[1],{name:k(b),value:c}}),f=[["Consolas/Monaco",'Consolas,monaco,"Lucida Console",monospace'],["Courier New",'"Courier New",Courier,"Lucida Sans Typewriter","Lucida Typewriter",monospace'],["Lucida Sans Typewriter",'"Lucida Sans Typewriter","Lucida Console",monaco,"Bitstream Vera Sans Mono",monospace']].map(function(a){var b,c;return b=a[0],c=a[1],{name:k(b),value:c}}),g=[["Copperplate",'Copperplate,"Copperplate Gothic Light",fantasy'],["Papyrus","Papyrus,fantasy"],["Script",'"Brush Script MT",cursive']].map(function(a){var b,c;return b=a[0],c=a[1],{name:k(b),value:c}}),d=[[k("Sans Serif"),i],[k("Serif"),j],[k("Monospace"),f],[k("Other"),g]],e={},m=0,p=i.length;p>m;m++)v=i[m],u=v.name,z=v.value,e[u]=z;for(n=0,q=j.length;q>n;n++)w=j[n],u=w.name,z=w.value,e[u]=z;for(o=0,r=f.length;r>o;o++)x=f[o],u=x.name,z=x.value,e[u]=z;for(t=0,s=g.length;s>t;t++)y=g[t],u=y.name,z=y.value,e[u]=z;l("font",h.createClass({displayName:"FontOptions",getInitialState:function(){return{isItalic:!1,isBold:!1,fontName:"Helvetica",fontSizeIndex:4}},getFontSizes:function(){return[9,10,12,14,18,24,36,48,64,72,96,144,288]},updateTool:function(a){var b,c,d;null==a&&(a={});for(d in this.state)d in a||(a[d]=this.state[d]);return b=this.getFontSizes()[a.fontSizeIndex],c=[],a.isItalic&&c.push("italic"),a.isBold&&c.push("bold"),c.push(b+"px"),c.push(e[a.fontName]),this.props.lc.tool.font=c.join(" "),this.props.lc.trigger("setFont",c.join(" "))},handleFontSize:function(a){var b;return b={fontSizeIndex:a.target.value},this.setState(b),this.updateTool(b)},handleFontFamily:function(a){var b;return b={fontName:a.target.selectedOptions[0].innerHTML},this.setState(b),this.updateTool(b)},handleItalic:function(a){var b;return b={isItalic:!this.state.isItalic},this.setState(b),this.updateTool(b)},handleBold:function(a){var b;return b={isBold:!this.state.isBold},this.setState(b),this.updateTool(b)},componentDidMount:function(){return this.updateTool()},render:function(){var a,b,c,e,f,g,i,j,l,m;return f=this.props.lc,j=h.DOM,b=j.div,c=j.input,l=j.select,i=j.option,a=j.br,e=j.label,m=j.span,g=j.optgroup,b({className:"lc-font-settings"},l({value:this.state.fontSizeIndex,onChange:this.handleFontSize},this.getFontSizes().map(function(a){return function(a,b){return i({value:b,key:b},a+"px")}}(this))),l({value:this.state.fontName,onChange:this.handleFontFamily},d.map(function(a){return function(a){var b,c;return c=a[0],b=a[1],g({key:c,label:c},b.map(function(a,b){return i({value:a.name,key:b},a.name)}))}}(this))),m({},e({htmlFor:"italic"},k("italic")),c({type:"checkbox",id:"italic",checked:this.state.isItalic,onChange:this.handleItalic})),m({},e({htmlFor:"bold"},k("bold")),c({type:"checkbox",id:"bold",checked:this.state.isBold,onChange:this.handleBold})))}})),b.exports={}},{"../core/localization":13,"../reactGUI/React-shim":35,"./optionsStyles":26}],24:[function(a,b,c){var d,e,f,g,h;d=a("../reactGUI/React-shim"),h=a("./optionsStyles").defineOptionsStyle,e=d.createFactory(a("../reactGUI/StrokeWidthPicker")),g=a("../reactGUI/createSetStateOnEventMixin"),f=a("../core/util").classSet,h("line-options-and-stroke-width",d.createClass({displayName:"LineOptionsAndStrokeWidth",getState:function(){return{strokeWidth:this.props.tool.strokeWidth,isDashed:this.props.tool.isDashed,hasEndArrow:this.props.tool.hasEndArrow}},getInitialState:function(){return this.getState()},mixins:[g("toolChange")],render:function(){var a,b,c,g,h,i,j,k,l,m;return i=d.DOM,c=i.div,m=i.ul,h=i.li,g=i.img,k=function(a){return function(){return a.props.tool.isDashed=!a.props.tool.isDashed,a.setState(a.getState())}}(this),l=function(a){return function(){return a.props.tool.hasEndArrow=!a.props.tool.hasEndArrow,a.setState(a.getState())}}(this),b=f({"square-toolbar-button":!0,selected:this.state.isDashed}),a=f({"square-toolbar-button":!0,selected:this.state.hasEndArrow}),j={"float":"left",margin:1},c({},c({className:b,onClick:k,style:j},g({src:this.props.imageURLPrefix+"/dashed-line.png"})),c({className:a,onClick:l,style:j},g({src:this.props.imageURLPrefix+"/line-with-arrow.png"})),e({tool:this.props.tool,lc:this.props.lc}))}})),b.exports={}},{"../core/util":19,"../reactGUI/React-shim":35,"../reactGUI/StrokeWidthPicker":37,"../reactGUI/createSetStateOnEventMixin":40,"./optionsStyles":26}],25:[function(a,b,c){var d,e;d=a("../reactGUI/React-shim"),e=a("./optionsStyles").defineOptionsStyle,e("null",d.createClass({displayName:"NoOptions",render:function(){return d.DOM.div()}})),b.exports={}},{"../reactGUI/React-shim":35,"./optionsStyles":26}],26:[function(a,b,c){var d,e,f;d=a("../reactGUI/React-shim"),f={},e=function(a,b){return f[a]=d.createFactory(b)},b.exports={optionsStyles:f,defineOptionsStyle:e}},{"../reactGUI/React-shim":35}],27:[function(a,b,c){var d,e,f,g;d=a("../reactGUI/React-shim"),g=a("./optionsStyles").defineOptionsStyle,e=d.createFactory(a("../reactGUI/StrokeWidthPicker")),f=a("../reactGUI/createSetStateOnEventMixin"),g("polygon-and-stroke-width",d.createClass({displayName:"PolygonAndStrokeWidth",getState:function(){return{strokeWidth:this.props.tool.strokeWidth,inProgress:!1}},getInitialState:function(){return this.getState()},mixins:[f("toolChange")],componentDidMount:function(){var a,b,c; -return c=[],this.unsubscribe=function(a){return function(){var a,b,d,e;for(e=[],b=0,d=c.length;d>b;b++)a=c[b],e.push(a());return e}}(this),b=function(a){return function(){return a.state.inProgress?void 0:a.setState({inProgress:!0})}}(this),a=function(a){return function(){return a.setState({inProgress:!1})}}(this),c.push(this.props.lc.on("lc-polygon-started",b)),c.push(this.props.lc.on("lc-polygon-stopped",a))},componentWillUnmount:function(){return this.unsubscribe()},render:function(){var a,b,c,f,g,h,i,j;return c=this.props.lc,j=d.DOM,a=j.div,b=j.img,h=function(a){return function(){return c.trigger("lc-polygon-finishopen")}}(this),g=function(a){return function(){return c.trigger("lc-polygon-finishclosed")}}(this),f=function(a){return function(){return c.trigger("lc-polygon-cancel")}}(this),i={},this.state.inProgress||(i={display:"none"}),a({},a({className:"polygon-toolbar horz-toolbar",style:i},a({className:"square-toolbar-button",onClick:h},b({src:this.props.imageURLPrefix+"/polygon-open.png"})),a({className:"square-toolbar-button",onClick:g},b({src:this.props.imageURLPrefix+"/polygon-closed.png"})),a({className:"square-toolbar-button",onClick:f},b({src:this.props.imageURLPrefix+"/polygon-cancel.png"}))),a({},e({tool:this.props.tool,lc:this.props.lc})))}})),b.exports={}},{"../reactGUI/React-shim":35,"../reactGUI/StrokeWidthPicker":37,"../reactGUI/createSetStateOnEventMixin":40,"./optionsStyles":26}],28:[function(a,b,c){"use strict";var d=a("../reactGUI/React-shim"),e=a("./optionsStyles"),f=e.defineOptionsStyle,g=a("../reactGUI/createSetStateOnEventMixin"),h=a("../core/localization")._;f("stroke-or-fill",d.createClass({displayName:"StrokeOrFillPicker",getState:function(){return{strokeOrFill:"stroke"}},getInitialState:function(){return this.getState()},mixins:[g("toolChange")],onChange:function(a){"stroke-or-fill-stroke"==a.target.id?this.props.lc.tool.strokeOrFill="stroke":this.props.lc.tool.strokeOrFill="fill",this.setState(this.getState())},render:function(){var a=this.props.lc;return d.createElement("form",null,d.createElement("span",null," ",h("Color to change:")," "),d.createElement("span",null,d.createElement("input",{type:"radio",name:"stroke-or-fill",value:"stroke",id:"stroke-or-fill-stroke",onChange:this.onChange,checked:"stroke"==a.tool.strokeOrFill}),d.createElement("label",{htmlFor:"stroke-or-fill-stroke",className:"label"}," ",h("stroke"))),d.createElement("span",null,d.createElement("input",{type:"radio",name:"stroke-or-fill",value:"fill",id:"stroke-or-fill-fill",onChange:this.onChange,checked:"fill"==a.tool.strokeOrFill}),d.createElement("label",{htmlFor:"stroke-or-fill-fill",className:"label"}," ",h("fill"))))}})),b.exports={}},{"../core/localization":13,"../reactGUI/React-shim":35,"../reactGUI/createSetStateOnEventMixin":40,"./optionsStyles":26}],29:[function(a,b,c){var d,e;e=a("./optionsStyles").defineOptionsStyle,d=a("../reactGUI/StrokeWidthPicker"),e("stroke-width",d),b.exports={}},{"../reactGUI/StrokeWidthPicker":37,"./optionsStyles":26}],30:[function(a,b,c){var d,e,f,g,h;e=a("./React-shim"),h=a("./createSetStateOnEventMixin"),f=a("../core/localization")._,g=a("../core/util").classSet,d=e.createClass({displayName:"ClearButton",getState:function(){return{isEnabled:this.props.lc.canUndo()}},getInitialState:function(){return this.getState()},mixins:[h("drawingChange")],render:function(){var a,b,c,d;return b=e.DOM.div,c=this.props.lc,a=g({"lc-clear":!0,"toolbar-button":!0,"fat-button":!0,disabled:!this.state.isEnabled}),d=c.canUndo()?function(a){return function(){return c.clear()}}(this):function(){},b({className:a,onClick:d},f("Clear"))}}),b.exports=d},{"../core/localization":13,"../core/util":19,"./React-shim":35,"./createSetStateOnEventMixin":40}],31:[function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o;g=a("./React-shim"),f=a("react-addons-pure-render-mixin"),n=a("../core/util"),j=n.classSet,o=n.requestAnimationFrame,i=n.cancelAnimationFrame,h=a("../core/localization")._,m=function(a){var b,c,d,e;return"transparent"===a?{hue:0,sat:0,light:0,alpha:0}:"hsla"!==(null!=a?a.substring(0,4):void 0)?null:(c=a.indexOf("("),e=a.indexOf(")"),d=a.substring(c+1,e-c+4),b=function(){var b,c,e,f;for(e=d.split(","),f=[],b=0,c=e.length;c>b;b++)a=e[b],f.push(a.trim());return f}(),{hue:parseInt(b[0],10),sat:parseInt(b[1].substring(0,b[1].length-1),10),light:parseInt(b[2].substring(0,b[2].length-1),10),alpha:parseFloat(b[3])})},k=function(a){var b,c,d,e;return c=a.hue,e=a.sat,d=a.light,b=a.alpha,"hsla("+c+", "+e+"%, "+d+"%, "+b+")"},l=function(a){var b,c,d;return b=a.hue,d=a.sat,c=a.light,"hsl("+b+", "+d+"%, "+c+"%)"},d=g.createFactory(g.createClass({displayName:"ColorGrid",mixins:[f],render:function(){var a;return(a=g.DOM.div)({},this.props.rows.map(function(b){return function(c,d){return a({className:"color-row",key:d,style:{width:20*c.length}},c.map(function(c,d){var e,f,g,h,i,l,m,n;return i=c.hue,m=c.sat,l=c.light,e=c.alpha,g=k(c),h="hsl("+i+", "+m+"%, "+l+"%)",f=j({"color-cell":!0,selected:b.props.selectedColor===g}),n=function(a){return b.props.onChange(c,g),a.stopPropagation(),a.preventDefault()},a({className:f,onTouchStart:n,onTouchMove:n,onClick:n,style:{backgroundColor:h},key:d})}))}}(this)))}})),e=g.createClass({displayName:"ColorWell",mixins:[f],getInitialState:function(){var a,b;return a=this.props.lc.colors[this.props.colorName],b=m(a),null==b&&(b={}),null==b.alpha&&(b.alpha=1),null==b.sat&&(b.sat=100),null==b.hue&&(b.hue=0),null==b.light&&(b.light=50),{colorString:a,alpha:b.alpha,sat:0===b.sat?100:b.sat,isPickerVisible:!1,hsla:b}},componentDidMount:function(){return this.unsubscribe=this.props.lc.on(this.props.colorName+"ColorChange",function(a){return function(){var b;return b=a.props.lc.colors[a.props.colorName],a.setState({colorString:b}),a.setHSLAFromColorString(b)}}(this))},componentWillUnmount:function(){return this.unsubscribe()},setHSLAFromColorString:function(a){var b;return b=m(a),b?this.setState({hsla:b,alpha:b.alpha,sat:b.sat}):this.setState({hsla:null,alpha:1,sat:100})},closePicker:function(){return this.setState({isPickerVisible:!1})},togglePicker:function(){var a,b;return a=!this.state.isPickerVisible,b=a&&0===this.state.sat,this.setHSLAFromColorString(this.state.colorString),this.setState({isPickerVisible:a,sat:b?100:this.state.sat})},setColor:function(a){return this.setState({colorString:a}),this.setHSLAFromColorString(a),this.props.lc.setColor(this.props.colorName,a)},setAlpha:function(a){var b;return this.setState({alpha:a}),this.state.hsla?(b=this.state.hsla,b.alpha=a,this.setState({hsla:b}),this.setColor(k(b))):void 0},setSat:function(a){var b;if(this.setState({sat:a}),isNaN(a))throw"SAT";return this.state.hsla?(b=this.state.hsla,b.sat=a,this.setState({hsla:b}),this.setColor(k(b))):void 0},render:function(){var a,b,c,d;return d=g.DOM,b=d.div,c=d.label,a=d.br,b({className:j({"color-well":!0,open:this.state.isPickerVisible}),onMouseLeave:this.closePicker,style:{"float":"left",textAlign:"center"}},c({"float":"left"},this.props.label),a({}),b({className:j({"color-well-color-container":!0,selected:this.state.isPickerVisible}),style:{backgroundColor:"white"},onClick:this.togglePicker},b({className:"color-well-checker color-well-checker-top-left"}),b({className:"color-well-checker color-well-checker-bottom-right",style:{left:"50%",top:"50%"}}),b({className:"color-well-color",style:{backgroundColor:this.state.colorString}}," ")),this.renderPicker())},renderPicker:function(){var a,b,c,e,f,i,j,k,l,m,n,o,p;if(l=g.DOM,a=l.div,i=l.label,e=l.input,!this.state.isPickerVisible)return null;for(o=function(b){return function(b){return a({className:"color-row label",key:b,style:{lineHeight:"20px",height:16}},b)}}(this),n=function(b){return function(){var c;return c=b.props.lc.opts.imageURLPrefix+"/checkerboard-8x8.png",a({className:"color-row",key:"color",style:{position:"relative",backgroundImage:"url("+c+")",backgroundRepeat:"repeat",height:24}},a({style:{position:"absolute",top:0,right:0,bottom:0,left:0,backgroundColor:b.state.colorString}}))}}(this),p=[],p.push(function(){var a,b;for(b=[],c=a=0;100>=a;c=a+=10)b.push({hue:0,sat:0,light:c,alpha:this.state.alpha});return b}.call(this)),m=[0,30,60,90,120,150,180,210,240,270,300,330],f=0,j=m.length;j>f;f++)b=m[f],p.push(function(){var a,d;for(d=[],c=a=10;90>=a;c=a+=8)d.push({hue:b,sat:this.state.sat,light:c,alpha:this.state.alpha});return d}.call(this));return k=function(a){return function(b,c){return a.setColor(c)}}(this),a({className:"color-picker-popup"},n(),o(h("alpha")),e({type:"range",min:0,max:1,step:.01,value:this.state.alpha,onChange:function(a){return function(b){return a.setAlpha(parseFloat(b.target.value))}}(this)}),o(h("saturation")),e({type:"range",min:0,max:100,value:this.state.sat,max:100,onChange:function(a){return function(b){return a.setSat(parseInt(b.target.value,10))}}(this)}),d({rows:p,selectedColor:this.state.colorString,onChange:k}))}}),b.exports=e},{"../core/localization":13,"../core/util":19,"./React-shim":35,"react-addons-pure-render-mixin":2}],32:[function(a,b,c){"use strict";var d=a("../reactGUI/React-shim"),e=a("../reactGUI/ReactDOM-shim"),f=e.findDOMNode,g=a("../core/util"),h=g.classSet,i=a("./Picker"),j=a("./Options"),k=a("./createToolButton"),l=a("../core/LiterallyCanvas"),m=a("../core/defaultOptions");a("../optionsStyles/font"),a("../optionsStyles/stroke-width"),a("../optionsStyles/line-options-and-stroke-width"),a("../optionsStyles/polygon-and-stroke-width"),a("../optionsStyles/null");var n=d.createClass({displayName:"CanvasContainer",shouldComponentUpdate:function(){return!1},render:function(){return d.createElement("div",{key:"literallycanvas",className:"lc-drawing with-gui"})}}),o=d.createClass({displayName:"LiterallyCanvas",getDefaultProps:function(){return m},bindToModel:function(){var a=f(this.canvas);this.props,this.lc.bindToElement(a),"function"==typeof this.lc.opts.onInit&&this.lc.opts.onInit(this.lc)},componentWillMount:function(){var a=this;this.lc||(this.props.lc?this.lc=this.props.lc:this.lc=new l(this.props),this.toolButtonComponents=this.lc.opts.tools.map(function(b){return k(new b(a.lc))}))},componentDidMount:function(){this.lc.isBound||this.bindToModel()},componentWillUnmount:function(){this.lc&&this.lc._teardown()},render:function(){var a=this,b=this.lc,c=this.toolButtonComponents,e=(this.props,this.lc.opts),f=e.imageURLPrefix,g=e.toolbarPosition,k={lc:b,toolButtonComponents:c,imageURLPrefix:f},l=h({"toolbar-at-top":"top"===g,"toolbar-at-bottom":"bottom"===g,"toolbar-hidden":"hidden"===g});return d.createElement("div",{className:"literally "+l},d.createElement(n,{ref:function(b){return a.canvas=b}}),d.createElement(i,k),d.createElement(j,{lc:b,imageURLPrefix:f}))}});b.exports=o},{"../core/LiterallyCanvas":5,"../core/defaultOptions":10,"../core/util":19,"../optionsStyles/font":23,"../optionsStyles/line-options-and-stroke-width":24,"../optionsStyles/null":25,"../optionsStyles/polygon-and-stroke-width":27,"../optionsStyles/stroke-width":29,"../reactGUI/React-shim":35,"../reactGUI/ReactDOM-shim":36,"./Options":33,"./Picker":34,"./createToolButton":41}],33:[function(a,b,c){var d,e,f,g;e=a("./React-shim"),f=a("./createSetStateOnEventMixin"),g=a("../optionsStyles/optionsStyles").optionsStyles,d=e.createClass({displayName:"Options",getState:function(){var a;return{style:null!=(a=this.props.lc.tool)?a.optionsStyle:void 0,tool:this.props.lc.tool}},getInitialState:function(){return this.getState()},mixins:[f("toolChange")],renderBody:function(){var a;return a=""+this.state.style,g[a]&&g[a]({lc:this.props.lc,tool:this.state.tool,imageURLPrefix:this.props.imageURLPrefix})},render:function(){var a;return(a=e.DOM.div)({className:"lc-options horz-toolbar"},this.renderBody())}}),b.exports=d},{"../optionsStyles/optionsStyles":26,"./React-shim":35,"./createSetStateOnEventMixin":40}],34:[function(a,b,c){var d,e,f,g,h,i,j,k;h=a("./React-shim"),d=h.createFactory(a("./ClearButton")),i=h.createFactory(a("./UndoRedoButtons")),j=h.createFactory(a("./ZoomButtons")),k=a("../core/localization")._,f=h.createFactory(a("./ColorWell")),e=h.createFactory(h.createClass({displayName:"ColorPickers",render:function(){var a,b;return b=this.props.lc,(a=h.DOM.div)({className:"lc-color-pickers"},f({lc:b,colorName:"primary",label:k("stroke")}),f({lc:b,colorName:"secondary",label:k("fill")}),f({lc:b,colorName:"background",label:k("bg")}))}})),g=h.createClass({displayName:"Picker",getInitialState:function(){return{selectedToolIndex:0}},renderBody:function(){var a,b,c,f,g;return a=h.DOM.div,f=this.props,g=f.toolButtonComponents,c=f.lc,b=f.imageURLPrefix,a({className:"lc-picker-contents"},g.map(function(a){return function(d,e){return d({lc:c,imageURLPrefix:b,key:e,isSelected:e===a.state.selectedToolIndex,onSelect:function(b){return c.setTool(b),a.setState({selectedToolIndex:e})}})}}(this)),g.length%2!==0?a({className:"toolbar-button thin-button disabled"}):void 0,a({style:{position:"absolute",bottom:0,left:0,right:0}},e({lc:this.props.lc}),i({lc:c,imageURLPrefix:b}),j({lc:c,imageURLPrefix:b}),d({lc:c})))},render:function(){var a;return(a=h.DOM.div)({className:"lc-picker"},this.renderBody())}}),b.exports=g},{"../core/localization":13,"./ClearButton":30,"./ColorWell":31,"./React-shim":35,"./UndoRedoButtons":38,"./ZoomButtons":39}],35:[function(a,b,c){var d;try{d=a("react")}catch(e){d=window.React}if(null==d)throw"Can't find React";b.exports=d},{react:"react"}],36:[function(a,b,c){var d;try{d=a("react-dom")}catch(e){d=window.ReactDOM}if(null==d)try{d=a("react")}catch(f){d=window.React}if(null==d)throw"Can't find ReactDOM";b.exports=d},{react:"react","react-dom":"react-dom"}],37:[function(a,b,c){var d,e,f;d=a("./React-shim"),f=a("../reactGUI/createSetStateOnEventMixin"),e=a("../core/util").classSet,b.exports=d.createClass({displayName:"StrokeWidthPicker",getState:function(a){return null==a&&(a=this.props.tool),{strokeWidth:a.strokeWidth}},getInitialState:function(){return this.getState()},mixins:[f("toolDidUpdateOptions")],componentWillReceiveProps:function(a){return this.setState(this.getState(a.tool))},render:function(){var a,b,c,f,g,h,i;return f=d.DOM,i=f.ul,c=f.li,h=f.svg,a=f.circle,b=f.div,g=this.props.lc.opts.strokeWidths,b({},g.map(function(c){return function(d,f){var g,i;return g=e({"square-toolbar-button":!0,selected:d===c.state.strokeWidth}),i=28,b({key:d},b({className:g,onClick:function(){return c.props.lc.trigger("setStrokeWidth",d)}},h({width:i-2,height:i-2,viewPort:"0 0 "+d+" "+d,version:"1.1",xmlns:"http://www.w3.org/2000/svg"},a({cx:Math.ceil(i/2-1),cy:Math.ceil(i/2-1),r:d/2}))))}}(this)))}})},{"../core/util":19,"../reactGUI/createSetStateOnEventMixin":40,"./React-shim":35}],38:[function(a,b,c){var d,e,f,g,h,i,j;d=a("./React-shim"),i=a("./createSetStateOnEventMixin"),h=a("../core/util").classSet,j=function(a){return d.createClass({displayName:"undo"===a?"UndoButton":"RedoButton",getState:function(){return{isEnabled:function(){switch(!1){case"undo"!==a:return this.props.lc.canUndo();case"redo"!==a:return this.props.lc.canRedo()}}.call(this)}},getInitialState:function(){return this.getState()},mixins:[i("drawingChange")],render:function(){var b,c,e,f,g,i,j,k,l,m,n;return j=d.DOM,c=j.div,f=j.img,k=this.props,g=k.lc,e=k.imageURLPrefix,n="undo"===a?"Undo":"Redo",b="lc-"+a+" "+h({"toolbar-button":!0,"thin-button":!0,disabled:!this.state.isEnabled}),i=function(){switch(!1){case!!this.state.isEnabled:return function(){};case"undo"!==a:return function(){return g.undo()};case"redo"!==a:return function(){return g.redo()}}}.call(this),l=e+"/"+a+".png",m={backgroundImage:"url("+l+")"},c({className:b,onClick:i,title:n,style:m})}})},f=d.createFactory(j("undo")),e=d.createFactory(j("redo")),g=d.createClass({displayName:"UndoRedoButtons",render:function(){var a;return(a=d.DOM.div)({className:"lc-undo-redo"},f(this.props),e(this.props))}}),b.exports=g},{"../core/util":19,"./React-shim":35,"./createSetStateOnEventMixin":40}],39:[function(a,b,c){var d,e,f,g,h,i,j;d=a("./React-shim"),i=a("./createSetStateOnEventMixin"),h=a("../core/util").classSet,j=function(a){return d.createClass({displayName:"in"===a?"ZoomInButton":"ZoomOutButton",getState:function(){return{isEnabled:function(){switch(!1){case"in"!==a:return this.props.lc.scalethis.props.lc.config.zoomMin}}.call(this)}},getInitialState:function(){return this.getState()},mixins:[i("zoom")],render:function(){var b,c,e,f,g,i,j,k,l,m,n;return j=d.DOM,c=j.div,f=j.img,k=this.props,g=k.lc,e=k.imageURLPrefix,n="in"===a?"Zoom in":"Zoom out",b="lc-zoom-"+a+" "+h({"toolbar-button":!0,"thin-button":!0,disabled:!this.state.isEnabled}),i=function(){switch(!1){case!!this.state.isEnabled:return function(){};case"in"!==a:return function(){return g.zoom(g.config.zoomStep)};case"out"!==a:return function(){return g.zoom(-g.config.zoomStep)}}}.call(this),l=e+"/zoom-"+a+".png",m={backgroundImage:"url("+l+")"},c({className:b,onClick:i,title:n,style:m})}})},g=d.createFactory(j("out")),f=d.createFactory(j("in")),e=d.createClass({displayName:"ZoomButtons",render:function(){var a;return(a=d.DOM.div)({className:"lc-zoom"},g(this.props),f(this.props))}}),b.exports=e},{"../core/util":19,"./React-shim":35,"./createSetStateOnEventMixin":40}],40:[function(a,b,c){var d,e;d=a("./React-shim"),b.exports=e=function(a){return{componentDidMount:function(){return this.unsubscribe=this.props.lc.on(a,function(a){return function(){return a.setState(a.getState())}}(this))},componentWillUnmount:function(){return this.unsubscribe()}}}},{"./React-shim":35}],41:[function(a,b,c){var d,e,f,g;d=a("./React-shim"),f=a("../core/util").classSet,e=a("../core/localization")._,g=function(a){var b,c;return b=a.name,c=a.iconName,d.createFactory(d.createClass({displayName:b,getDefaultProps:function(){return{isSelected:!1,lc:null}},componentWillMount:function(){return this.props.isSelected?this.props.lc.setTool(a):void 0},render:function(){var g,h,i,j,k,l,m,n,o;return m=d.DOM,h=m.div,j=m.img,n=this.props,i=n.imageURLPrefix,k=n.isSelected,l=n.onSelect,g=f({"lc-pick-tool":!0,"toolbar-button":!0,"thin-button":!0,selected:k}),o=i+"/"+c+".png",h({className:g,style:{backgroundImage:"url("+o+")"},onClick:function(){return l(a)},title:e(b)})}}))},b.exports=g},{"../core/localization":13,"../core/util":19,"./React-shim":35}],42:[function(a,b,c){"use strict";function d(a,b){var c=a.className,d=new g(b);return f.render(e.createElement(h,{lc:d}),a),d.teardown=function(){d._teardown();for(var b=0;bc;c++)a=b[c],e.push(a());return e}}(this),b.push(a.on("lc-pointerdown",function(b){return function(c){var d,e;return d=c.rawX,e=c.rawY,b.oldPosition=a.position,b.pointerStart={x:d,y:e}}}(this))),b.push(a.on("lc-pointerdrag",function(b){return function(c){var d,e,f;return e=c.rawX,f=c.rawY,d={x:(e-b.pointerStart.x)*a.backingScale,y:(f-b.pointerStart.y)*a.backingScale},a.setPan(b.oldPosition.x+d.x,b.oldPosition.y+d.y)}}(this)))},b.prototype.willBecomeInactive=function(a){return this.unsubscribe()},b}(e)},{"../core/shapes":17,"./base":53}],48:[function(a,b,c){var d,e,f,g=function(a,b){function c(){this.constructor=a}for(var d in b)h.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},h={}.hasOwnProperty;e=a("./base").ToolWithStroke,f=a("../core/shapes").createShape,b.exports=d=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return g(b,a),b.prototype.name="Pencil",b.prototype.iconName="pencil",b.prototype.eventTimeThreshold=10,b.prototype.begin=function(a,b,c){return this.color=c.getColor("primary"),this.currentShape=this.makeShape(),this.currentShape.addPoint(this.makePoint(a,b,c)),this.lastEventTime=Date.now()},b.prototype["continue"]=function(a,b,c){var d;return d=Date.now()-this.lastEventTime,d>this.eventTimeThreshold?(this.lastEventTime+=d,this.currentShape.addPoint(this.makePoint(a,b,c)),c.drawShapeInProgress(this.currentShape)):void 0},b.prototype.end=function(a,b,c){return c.saveShape(this.currentShape),this.currentShape=void 0},b.prototype.makePoint=function(a,b,c){return f("Point",{x:a,y:b,size:this.strokeWidth,color:this.color})},b.prototype.makeShape=function(){return f("LinePath")},b}(e)},{"../core/shapes":17,"./base":53}],49:[function(a,b,c){var d,e,f,g=function(a,b){function c(){this.constructor=a}for(var d in b)h.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},h={}.hasOwnProperty;e=a("./base").ToolWithStroke,f=a("../core/shapes").createShape,b.exports=d=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return g(b,a),b.prototype.name="Polygon",b.prototype.iconName="polygon",b.prototype.usesSimpleAPI=!1,b.prototype.didBecomeActive=function(a){var c,d,e,f,g,h,i;return b.__super__.didBecomeActive.call(this,a),i=[],this.polygonUnsubscribe=function(a){return function(){var a,b,c,d;for(d=[],b=0,c=i.length;c>b;b++)a=i[b],d.push(a());return d}}(this),this.points=null,this.maybePoint=null,e=function(b){return function(){return b._getWillFinish()?b._close(a):(a.trigger("lc-polygon-started"),b.points?b.points.push(b.maybePoint):b.points=[b.maybePoint],b.maybePoint={x:b.maybePoint.x,y:b.maybePoint.y},a.setShapesInProgress(b._getShapes(a)),a.repaintLayer("main"))}}(this),d=function(b){return function(c){var d,e;return d=c.x,e=c.y,b.maybePoint?(b.maybePoint.x=d,b.maybePoint.y=e,a.setShapesInProgress(b._getShapes(a)),a.repaintLayer("main")):void 0}}(this),c=function(b){return function(c){var d,e;return d=c.x,e=c.y,b.maybePoint={x:d,y:e},a.setShapesInProgress(b._getShapes(a)),a.repaintLayer("main")}}(this),h=function(b){return function(){return b.maybePoint={x:1/0,y:1/0},b._close(a)}}(this),g=function(b){return function(){return b.maybePoint=b.points[0],b._close(a)}}(this),f=function(b){return function(){return b._cancel(a)}}(this),i.push(a.on("drawingChange",function(b){return function(){return b._cancel(a)}}(this))),i.push(a.on("lc-pointerdown",c)),i.push(a.on("lc-pointerdrag",d)),i.push(a.on("lc-pointermove",d)),i.push(a.on("lc-pointerup",e)),i.push(a.on("lc-polygon-finishopen",h)),i.push(a.on("lc-polygon-finishclosed",g)),i.push(a.on("lc-polygon-cancel",f))},b.prototype.willBecomeInactive=function(a){return b.__super__.willBecomeInactive.call(this,a),(this.points||this.maybePoint)&&this._cancel(a),this.polygonUnsubscribe()},b.prototype._getArePointsClose=function(a,b){return Math.abs(a.x-b.x)+Math.abs(a.y-b.y)<10},b.prototype._getWillClose=function(){return!!(this.points&&this.points.length>1&&this.maybePoint)&&this._getArePointsClose(this.points[0],this.maybePoint)},b.prototype._getWillFinish=function(){return!!(this.points&&this.points.length>1&&this.maybePoint)&&(this._getArePointsClose(this.points[0],this.maybePoint)||this._getArePointsClose(this.points[this.points.length-1],this.maybePoint))},b.prototype._cancel=function(a){return a.trigger("lc-polygon-stopped"),this.maybePoint=null,this.points=null,a.setShapesInProgress([]),a.repaintLayer("main")},b.prototype._close=function(a){return a.trigger("lc-polygon-stopped"),a.setShapesInProgress([]),this.points.length>2&&a.saveShape(this._getShape(a,!1)),this.maybePoint=null,this.points=null},b.prototype._getShapes=function(a,b){var c;return null==b&&(b=!0),c=this._getShape(a,b),c?[c]:[]},b.prototype._getShape=function(a,b){var c;return null==b&&(b=!0),c=[],this.points&&(c=c.concat(this.points)),!b&&c.length<3?null:(b&&this.maybePoint&&c.push(this.maybePoint),c.length>1?f("Polygon",{isClosed:this._getWillClose(),strokeColor:a.getColor("primary"),fillColor:a.getColor("secondary"),strokeWidth:this.strokeWidth,points:c.map(function(a){return f("Point",a)})}):null)},b.prototype.optionsStyle="polygon-and-stroke-width",b}(e)},{"../core/shapes":17,"./base":53}],50:[function(a,b,c){var d,e,f,g=function(a,b){function c(){this.constructor=a}for(var d in b)h.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},h={}.hasOwnProperty;e=a("./base").ToolWithStroke,f=a("../core/shapes").createShape,b.exports=d=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return g(b,a),b.prototype.name="Rectangle",b.prototype.iconName="rectangle",b.prototype.begin=function(a,b,c){return this.currentShape=f("Rectangle",{x:a,y:b,strokeWidth:this.strokeWidth,strokeColor:c.getColor("primary"),fillColor:c.getColor("secondary")})},b.prototype["continue"]=function(a,b,c){return this.currentShape.width=a-this.currentShape.x,this.currentShape.height=b-this.currentShape.y,c.drawShapeInProgress(this.currentShape)},b.prototype.end=function(a,b,c){return c.saveShape(this.currentShape)},b}(e)},{"../core/shapes":17,"./base":53}],51:[function(a,b,c){var d,e,f,g=function(a,b){function c(){this.constructor=a}for(var d in b)h.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},h={}.hasOwnProperty;e=a("./base").Tool,f=a("../core/shapes").createShape,b.exports=d=function(a){function b(a){this.selectCanvas=document.createElement("canvas"),this.selectCanvas.style["background-color"]="transparent",this.selectCtx=this.selectCanvas.getContext("2d")}return g(b,a),b.prototype.name="SelectShape",b.prototype.usesSimpleAPI=!1,b.prototype.didBecomeActive=function(a){var b,c,d,e;return e=[],this._selectShapeUnsubscribe=function(a){return function(){var a,b,c,d;for(d=[],b=0,c=e.length;c>b;b++)a=e[b],d.push(a());return d}}(this),b=function(b){return function(c){var d,e,g,h;return g=c.x,h=c.y,b.didDrag=!1,e=b._getPixel(g,h,a,b.selectCtx),b.selectedShape=a.shapes[e],null!=b.selectedShape?(a.trigger("shapeSelected",{selectedShape:b.selectedShape}),a.setShapesInProgress([b.selectedShape,f("SelectionBox",{shape:b.selectedShape,handleSize:0})]),a.repaintLayer("main"),d=b.selectedShape.getBoundingRect(),b.dragOffset={x:g-d.x,y:h-d.y}):void 0}}(this),c=function(b){return function(c){var d,e;return d=c.x,e=c.y,null!=b.selectedShape?(b.didDrag=!0,b.selectedShape.setUpperLeft({x:d-b.dragOffset.x,y:e-b.dragOffset.y}),a.setShapesInProgress([b.selectedShape,f("SelectionBox",{shape:b.selectedShape,handleSize:0})]),a.repaintLayer("main")):void 0}}(this),d=function(b){return function(c){var d,e;return d=c.x,e=c.y,b.didDrag?(b.didDrag=!1,a.trigger("shapeMoved",{shape:b.selectedShape}),a.trigger("drawingChange",{}),a.repaintLayer("main"),b._drawSelectCanvas(a)):void 0}}(this),e.push(a.on("lc-pointerdown",b)),e.push(a.on("lc-pointerdrag",c)),e.push(a.on("lc-pointerup",d)),this._drawSelectCanvas(a)},b.prototype.willBecomeInactive=function(a){return this._selectShapeUnsubscribe(),a.setShapesInProgress([])},b.prototype._drawSelectCanvas=function(a){var b;return this.selectCanvas.width=a.canvas.width,this.selectCanvas.height=a.canvas.height,this.selectCtx.clearRect(0,0,this.selectCanvas.width,this.selectCanvas.height),b=a.shapes.map(function(a){return function(b,c){return f("SelectionBox",{shape:b,handleSize:0,backgroundColor:"#"+a._intToHex(c)})}}(this)),a.draw(b,this.selectCtx)},b.prototype._intToHex=function(a){return("000000"+a.toString(16)).slice(-6)},b.prototype._getPixel=function(a,b,c,d){var e,f;return e=c.drawingCoordsToClientCoords(a,b),f=d.getImageData(e.x,e.y,1,1).data,f[3]?parseInt(this._rgbToHex(f[0],f[1],f[2]),16):null},b.prototype._componentToHex=function(a){var b;return b=a.toString(16),("0"+b).slice(-2)},b.prototype._rgbToHex=function(a,b,c){return""+this._componentToHex(a)+this._componentToHex(b)+this._componentToHex(c)},b}(e)},{"../core/shapes":17,"./base":53}],52:[function(a,b,c){var d,e,f,g,h=function(a,b){function c(){this.constructor=a}for(var d in b)i.call(b,d)&&(a[d]=b[d]); -return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},i={}.hasOwnProperty;e=a("./base").Tool,f=a("../core/shapes").createShape,g=function(a,b){return!(a.xb.x+b.width)&&!(a.y>b.y+b.height)))},b.exports=d=function(a){function b(){this.text="",this.font="bold 18px sans-serif",this.currentShape=null,this.currentShapeState=null,this.initialShapeBoundingRect=null,this.dragAction=null,this.didDrag=!1}return h(b,a),b.prototype.name="Text",b.prototype.iconName="text",b.prototype.didBecomeActive=function(a){var b,c,d;return c=[],this.unsubscribe=function(a){return function(){var a,b,d,e;for(e=[],b=0,d=c.length;d>b;b++)a=c[b],e.push(a());return e}}(this),b=function(b){return function(){return b._ensureNotEditing(a),b._clearCurrentShape(a),a.repaintLayer("main")}}(this),d=function(b){return function(){return b._updateInputEl(a)}}(this),c.push(a.on("drawingChange",b)),c.push(a.on("zoom",d)),c.push(a.on("imageSizeChange",d)),c.push(a.on("snapshotLoad",function(b){return function(){return b._clearCurrentShape(a),a.repaintLayer("main")}}(this))),c.push(a.on("primaryColorChange",function(b){return function(c){return b.currentShape?(b.currentShape.color=c,b._updateInputEl(a),a.repaintLayer("main")):void 0}}(this))),c.push(a.on("setFont",function(b){return function(c){return b.currentShape?(b.font=c,b.currentShape.setFont(c),b._setShapesInProgress(a),b._updateInputEl(a),a.repaintLayer("main")):void 0}}(this)))},b.prototype.willBecomeInactive=function(a){return this.currentShape&&(this._ensureNotEditing(a),this.commit(a)),this.unsubscribe()},b.prototype.setText=function(a){return this.text=a},b.prototype._ensureNotEditing=function(a){return"editing"===this.currentShapeState?this._exitEditingState(a):void 0},b.prototype._clearCurrentShape=function(a){return this.currentShape=null,this.initialShapeBoundingRect=null,this.currentShapeState=null,a.setShapesInProgress([])},b.prototype.commit=function(a){return this.currentShape.text&&a.saveShape(this.currentShape),this._clearCurrentShape(a),a.repaintLayer("main")},b.prototype._getSelectionShape=function(a,b){return null==b&&(b=null),f("SelectionBox",{shape:this.currentShape,ctx:a,backgroundColor:b})},b.prototype._setShapesInProgress=function(a){switch(this.currentShapeState){case"selected":return a.setShapesInProgress([this._getSelectionShape(a.ctx),this.currentShape]);case"editing":return a.setShapesInProgress([this._getSelectionShape(a.ctx,"#fff")]);default:return a.setShapesInProgress([this.currentShape])}},b.prototype.begin=function(a,b,c){var d,e,h,i;return this.dragAction="none",this.didDrag=!1,"selected"===this.currentShapeState||"editing"===this.currentShapeState?(d=this.currentShape.getBoundingRect(c.ctx),i=this._getSelectionShape(c.ctx),h=i.getBoundingRect(),e={x:a,y:b},g(e,d)&&(this.dragAction="move"),g(e,i.getBottomRightHandleRect())&&(this.dragAction="resizeBottomRight"),g(e,i.getTopLeftHandleRect())&&(this.dragAction="resizeTopLeft"),g(e,i.getBottomLeftHandleRect())&&(this.dragAction="resizeBottomLeft"),g(e,i.getTopRightHandleRect())&&(this.dragAction="resizeTopRight"),"none"===this.dragAction&&"editing"===this.currentShapeState&&(this.dragAction="stop-editing",this._exitEditingState(c))):(this.color=c.getColor("primary"),this.currentShape=f("Text",{x:a,y:b,text:this.text,color:this.color,font:this.font,v:1}),this.dragAction="place",this.currentShapeState="selected"),"none"===this.dragAction?void this.commit(c):(this.initialShapeBoundingRect=this.currentShape.getBoundingRect(c.ctx),this.dragOffset={x:a-this.initialShapeBoundingRect.x,y:b-this.initialShapeBoundingRect.y},this._setShapesInProgress(c),c.repaintLayer("main"))},b.prototype["continue"]=function(a,b,c){var d,e,f;if("none"!==this.dragAction){switch(d=this.initialShapeBoundingRect,f=d.x+d.width,e=d.y+d.height,this.dragAction){case"place":this.currentShape.x=a,this.currentShape.y=b,this.didDrag=!0;break;case"move":this.currentShape.x=a-this.dragOffset.x,this.currentShape.y=b-this.dragOffset.y,this.didDrag=!0;break;case"resizeBottomRight":this.currentShape.setSize(a-(this.dragOffset.x-this.initialShapeBoundingRect.width)-d.x,b-(this.dragOffset.y-this.initialShapeBoundingRect.height)-d.y);break;case"resizeTopLeft":this.currentShape.setSize(f-a+this.dragOffset.x,e-b+this.dragOffset.y),this.currentShape.setPosition(a-this.dragOffset.x,b-this.dragOffset.y);break;case"resizeBottomLeft":this.currentShape.setSize(f-a+this.dragOffset.x,b-(this.dragOffset.y-this.initialShapeBoundingRect.height)-d.y),this.currentShape.setPosition(a-this.dragOffset.x,this.currentShape.y);break;case"resizeTopRight":this.currentShape.setSize(a-(this.dragOffset.x-this.initialShapeBoundingRect.width)-d.x,e-b+this.dragOffset.y),this.currentShape.setPosition(this.currentShape.x,b-this.dragOffset.y)}return this._setShapesInProgress(c),c.repaintLayer("main"),this._updateInputEl(c)}},b.prototype.end=function(a,b,c){return this.currentShape?(this.currentShape.setSize(this.currentShape.forcedWidth,0),"selected"===this.currentShapeState&&("place"===this.dragAction||"move"===this.dragAction&&!this.didDrag)&&this._enterEditingState(c),this._setShapesInProgress(c),c.repaintLayer("main"),this._updateInputEl(c)):void 0},b.prototype._enterEditingState=function(a){var b;if(this.currentShapeState="editing",this.inputEl)throw"State error";return this.inputEl=document.createElement("textarea"),this.inputEl.className="text-tool-input",this.inputEl.style.position="absolute",this.inputEl.style.transformOrigin="0px 0px",this.inputEl.style.backgroundColor="transparent",this.inputEl.style.border="none",this.inputEl.style.outline="none",this.inputEl.style.margin="0",this.inputEl.style.padding="4px",this.inputEl.style.zIndex="1000",this.inputEl.style.overflow="hidden",this.inputEl.style.resize="none",this.inputEl.value=this.currentShape.text,this.inputEl.addEventListener("mousedown",function(a){return a.stopPropagation()}),this.inputEl.addEventListener("touchstart",function(a){return a.stopPropagation()}),b=function(b){return function(c){return b.currentShape.setText(c.target.value),b.currentShape.enforceMaxBoundingRect(a),b._setShapesInProgress(a),a.repaintLayer("main"),b._updateInputEl(a),c.stopPropagation()}}(this),this.inputEl.addEventListener("keydown",function(b){return function(){return b._updateInputEl(a,!0)}}(this)),this.inputEl.addEventListener("keyup",b),this.inputEl.addEventListener("change",b),this._updateInputEl(a),a.containerEl.appendChild(this.inputEl),this.inputEl.focus(),this._setShapesInProgress(a)},b.prototype._exitEditingState=function(a){return this.currentShapeState="selected",a.containerEl.removeChild(this.inputEl),this.inputEl=null,this._setShapesInProgress(a),a.repaintLayer("main")},b.prototype._updateInputEl=function(a,b){var c,d;return null==b&&(b=!1),this.inputEl?(c=this.currentShape.getBoundingRect(a.ctx,!0),this.inputEl.style.font=this.currentShape.font,this.inputEl.style.color=this.currentShape.color,this.inputEl.style.left=a.position.x/a.backingScale+c.x*a.scale-4+"px",this.inputEl.style.top=a.position.y/a.backingScale+c.y*a.scale-4+"px",b&&!this.currentShape.forcedWidth?this.inputEl.style.width=c.width+10+this.currentShape.renderer.emDashWidth+"px":this.inputEl.style.width=c.width+12+"px",b?this.inputEl.style.height=c.height+10+this.currentShape.renderer.metrics.leading+"px":this.inputEl.style.height=c.height+10+"px",d="scale("+a.scale+")",this.inputEl.style.transform=d,this.inputEl.style.webkitTransform=d,this.inputEl.style.MozTransform=d,this.inputEl.style.msTransform=d,this.inputEl.style.OTransform=d):void 0},b.prototype.optionsStyle="font",b}(e)},{"../core/shapes":17,"./base":53}],53:[function(a,b,c){var d,e,f,g=function(a,b){function c(){this.constructor=a}for(var d in b)h.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},h={}.hasOwnProperty;f={},f.Tool=d=function(){function a(){}return a.prototype.name=null,a.prototype.iconName=null,a.prototype.usesSimpleAPI=!0,a.prototype.begin=function(a,b,c){},a.prototype["continue"]=function(a,b,c){},a.prototype.end=function(a,b,c){},a.prototype.optionsStyle=null,a.prototype.didBecomeActive=function(a){},a.prototype.willBecomeInactive=function(a){},a}(),f.ToolWithStroke=e=function(a){function b(a){this.strokeWidth=a.opts.defaultStrokeWidth}return g(b,a),b.prototype.optionsStyle="stroke-width",b.prototype.didBecomeActive=function(a){var b;return b=[],this.unsubscribe=function(a){return function(){var a,c,d,e;for(e=[],c=0,d=b.length;d>c;c++)a=b[c],e.push(a());return e}}(this),b.push(a.on("setStrokeWidth",function(b){return function(c){return b.strokeWidth=c,a.trigger("toolDidUpdateOptions")}}(this)))},b.prototype.willBecomeInactive=function(a){return this.unsubscribe()},b}(d),b.exports=f},{}]},{},[22])(22)}); \ No newline at end of file +function _defineProperty(e,t,o){if(t in e){Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0})}else{e[t]=o}return e}function _typeof(e){if("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator){_typeof=function(e){return typeof e}}else{_typeof=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e}}return _typeof(e)}!function(o){if("object"==("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module)module.exports=o();else if("function"==typeof define&&define.amd)define ("filter_poodll/literallycanvas",[],o);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.LC=o()}}(function(){return function p(d,e,t){function a(o,r){if(!e[o]){if(!d[o]){var i="function"==typeof require&&require;if(!r&&i)return i(o,!0);if(n)return n(o,!0);var s=new Error("Cannot find module '"+o+"'");throw s.code="MODULE_NOT_FOUND",s}var l=e[o]={exports:{}};d[o][0].call(l.exports,function(e){var t=d[o][1][e];return a(t?t:e)},l,l.exports,p,d,e,t)}return e[o].exports}for(var n="function"==typeof require&&require,o=0;ot;t++){if(t in this&&this[t]===o)return t}return-1};w=n("./actions"),P=n("./bindEvents"),_=n("./math"),E=n("./shapes"),R=E.createShape,O=E.shapeToJSON,b=E.JSONToShape,I=n("./canvasRenderer").renderShapeToContext,T=n("./svgRenderer").renderShapeToSVG,L=n("./renderSnapshotToImage"),z=n("./renderSnapshotToSVG"),C=n("../tools/Pencil"),N=n("./util"),k="infinite",t.exports=e=function(){function e(o,t){this.setImageSize=W(this.setImageSize,this);var e,a;a=null,e=null,o instanceof HTMLElement?(e=o,a=t):a=o,this.opts=a||{},this.config={zoomMin:a.zoomMin||.2,zoomMax:a.zoomMax||4,zoomStep:a.zoomStep||.2},this.colors={primary:a.primaryColor||"#000",secondary:a.secondaryColor||"#fff",background:a.backgroundColor||"transparent"},this.watermarkImage=a.watermarkImage,this.watermarkScale=a.watermarkScale||1,this.backgroundCanvas=document.createElement("canvas"),this.backgroundCtx=this.backgroundCanvas.getContext("2d"),this.canvas=document.createElement("canvas"),this.canvas.style["background-color"]="transparent",this.buffer=document.createElement("canvas"),this.buffer.style["background-color"]="transparent",this.ctx=this.canvas.getContext("2d"),this.bufferCtx=this.buffer.getContext("2d"),this.backingScale=N.getBackingScale(this.ctx),this.backgroundShapes=a.backgroundShapes||[],this._shapesInProgress=[],this.shapes=[],this.undoStack=[],this.redoStack=[],this.isDragging=!1,this.position={x:0,y:0},this.scale=1,this.setTool(new this.opts.tools[0](this)),this.width=a.imageSize.width||k,this.height=a.imageSize.height||k,this.setZoom(this.scale),a.snapshot&&this.loadSnapshot(a.snapshot),this.isBound=!1,e&&this.bindToElement(e),this.respondToSizeChange=function(){}}return e.prototype.bindToElement=function(o){var t,a;return this.containerEl?void console.warn("Trying to bind Literally Canvas to a DOM element more than once is unsupported."):(this.containerEl=o,this._unsubscribeEvents=P(this,this.containerEl,this.opts.keyboardShortcuts),this.containerEl.style["background-color"]=this.colors.background,this.containerEl.appendChild(this.backgroundCanvas),this.containerEl.appendChild(this.canvas),this.isBound=!0,a=function(e){return function(){return e.keepPanInImageBounds(),e.repaintAllLayers()}}(this),this.respondToSizeChange=N.matchElementSize(this.containerEl,[this.backgroundCanvas,this.canvas],this.backingScale,a),this.watermarkImage&&(this.watermarkImage.onload=function(e){return function(){return e.repaintLayer("background")}}(this)),null!=(t=this.tool)&&t.didBecomeActive(this),a())},e.prototype._teardown=function(){var e;return null!=(e=this.tool)&&e.willBecomeInactive(this),"function"==typeof this._unsubscribeEvents&&this._unsubscribeEvents(),this.tool=null,this.containerEl=null,this.isBound=!1},e.prototype.trigger=function(o,t){return this.canvas.dispatchEvent(new CustomEvent(o,{detail:t})),null},e.prototype.on=function(o,a){var t;return t=function(e){return a(e.detail)},this.canvas.addEventListener(o,t),function(a){return function(){return a.canvas.removeEventListener(o,t)}}(this)},e.prototype.getRenderScale=function(){return this.scale*this.backingScale},e.prototype.clientCoordsToDrawingCoords=function(o,t){return{x:(o*this.backingScale-this.position.x)/this.getRenderScale(),y:(t*this.backingScale-this.position.y)/this.getRenderScale()}},e.prototype.drawingCoordsToClientCoords=function(o,t){return{x:o*this.getRenderScale()+this.position.x,y:t*this.getRenderScale()+this.position.y}},e.prototype.setImageSize=function(o,t){return this.width=o||k,this.height=t||k,this.keepPanInImageBounds(),this.repaintAllLayers(),this.trigger("imageSizeChange",{width:this.width,height:this.height})},e.prototype.setTool=function(o){var t;return this.isBound&&null!=(t=this.tool)&&t.willBecomeInactive(this),this.tool=o,this.trigger("toolChange",{tool:o}),this.isBound?this.tool.didBecomeActive(this):void 0},e.prototype.setShapesInProgress=function(e){return this._shapesInProgress=e},e.prototype.pointerDown=function(o,t){var e;return e=this.clientCoordsToDrawingCoords(o,t),this.tool.usesSimpleAPI?(this.tool.begin(e.x,e.y,this),this.isDragging=!0,this.trigger("drawStart",{tool:this.tool})):(this.isDragging=!0,this.trigger("lc-pointerdown",{tool:this.tool,x:e.x,y:e.y,rawX:o,rawY:t}))},e.prototype.pointerMove=function(o,t){return N.requestAnimationFrame(function(e){return function(){var a,n;return a=e.clientCoordsToDrawingCoords(o,t),(null!=(n=e.tool)?n.usesSimpleAPI:0)?e.isDragging?(e.tool["continue"](a.x,a.y,e),e.trigger("drawContinue",{tool:e.tool})):void 0:e.isDragging?e.trigger("lc-pointerdrag",{tool:e.tool,x:a.x,y:a.y,rawX:o,rawY:t}):e.trigger("lc-pointermove",{tool:e.tool,x:a.x,y:a.y,rawX:o,rawY:t})}}(this))},e.prototype.pointerUp=function(o,t){var e;return e=this.clientCoordsToDrawingCoords(o,t),this.tool.usesSimpleAPI?this.isDragging?(this.tool.end(e.x,e.y,this),this.isDragging=!1,this.trigger("drawEnd",{tool:this.tool})):void 0:(this.isDragging=!1,this.trigger("lc-pointerup",{tool:this.tool,x:e.x,y:e.y,rawX:o,rawY:t}))},e.prototype.setColor=function(o,t){if(this.colors[o]=t,this.isBound){switch(o){case"background":this.containerEl.style.backgroundColor=this.colors.background,this.repaintLayer("background");break;case"primary":this.repaintLayer("main");break;case"secondary":this.repaintLayer("main");}return this.trigger(o+"ColorChange",this.colors[o]),"background"===o?this.trigger("drawingChange"):void 0}},e.prototype.getColor=function(e){return this.colors[e]},e.prototype.saveShape=function(o,t,a){return null==t&&(t=!0),null==a&&(a=null),a||(a=this.shapes.length?this.shapes[this.shapes.length-1].id:null),this.execute(new w.AddShapeAction(this,o,a)),t&&this.trigger("shapeSave",{shape:o,previousShapeId:a}),this.trigger("drawingChange")},e.prototype.pan=function(o,t){return this.setPan(this.position.x-o,this.position.y-t)},e.prototype.keepPanInImageBounds=function(){var o,a,i,s;return a=this.getRenderScale(),o=this.position,i=o.x,s=o.y,this.width!==k&&(i=this.canvas.width>this.width*a?(this.canvas.width-this.width*a)/2:Math.max(Math.min(0,i),this.canvas.width-this.width*a)),this.height!==k&&(s=this.canvas.height>this.height*a?(this.canvas.height-this.height*a)/2:Math.max(Math.min(0,s),this.canvas.height-this.height*a)),this.position={x:i,y:s}},e.prototype.setPan=function(o,t){return this.position={x:o,y:t},this.keepPanInImageBounds(),this.repaintAllLayers(),this.trigger("pan",{x:this.position.x,y:this.position.y})},e.prototype.zoom=function(o){var t;return t=this.scale+o,t=Math.max(t,this.config.zoomMin),t=Math.min(t,this.config.zoomMax),t=Math.round(100*t)/100,this.setZoom(t)},e.prototype.setZoom=function(o){var t;return t=this.scale,this.scale=o,this.position.x=_.scalePositionScalar(this.position.x,this.canvas.width,t,this.scale),this.position.y=_.scalePositionScalar(this.position.y,this.canvas.height,t,this.scale),this.keepPanInImageBounds(),this.repaintAllLayers(),this.trigger("zoom",{oldScale:t,newScale:this.scale})},e.prototype.setWatermarkImage=function(e){return this.watermarkImage=e,N.addImageOnload(e,function(e){return function(){return e.repaintLayer("background")}}(this)),e.width?this.repaintLayer("background"):void 0},e.prototype.repaintAllLayers=function(){var o,a,r,s;for(s=["background","main"],o=0,r=s.length;r>o;o++){a=s[o],this.repaintLayer(a)}return null},e.prototype.repaintLayer=function(o,t){var a;if(null==t&&(t="main"===o),this.isBound){switch(o){case"background":this.backgroundCtx.clearRect(0,0,this.backgroundCanvas.width,this.backgroundCanvas.height),a=function(e){return function(){return e.repaintLayer("background")}}(this),this.watermarkImage&&this._renderWatermark(this.backgroundCtx,!0,a),this.draw(this.backgroundShapes,this.backgroundCtx,a);break;case"main":a=function(e){return function(){return e.repaintLayer("main",!0)}}(this),t&&(this.buffer.width=this.canvas.width,this.buffer.height=this.canvas.height,this.bufferCtx.clearRect(0,0,this.buffer.width,this.buffer.height),this.draw(this.shapes,this.bufferCtx,a)),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),0t;t++){d=l[t],p.push(I(a.ctx,d,{bufferCtx:a.bufferCtx,shouldOnlyDrawLatest:!0}))}return p},a.ctx,a.bufferCtx)}}(this),this.ctx,this.bufferCtx));}return this.trigger("repaint",{layerKey:o})}},e.prototype._renderWatermark=function(o,t,a){return null==t&&(t=!0),this.watermarkImage.width?(o.save(),o.translate(o.canvas.width/2,o.canvas.height/2),o.scale(this.watermarkScale,this.watermarkScale),t&&o.scale(this.backingScale,this.backingScale),o.drawImage(this.watermarkImage,-this.watermarkImage.width/2,-this.watermarkImage.height/2),o.restore()):void(this.watermarkImage.onload=a)},e.prototype.drawShapeInProgress=function(o){return this.repaintLayer("main",!1),this.clipped(function(t){return function(){return t.transformed(function(){return I(t.ctx,o,{bufferCtx:t.bufferCtx,shouldOnlyDrawLatest:!0})},t.ctx,t.bufferCtx)}}(this),this.ctx,this.bufferCtx)},e.prototype.draw=function(a,r,e){var o;if(a.length)return o=function(){return function(){var t,n,l,p;for(l=[],t=0,n=a.length;n>t;t++){p=a[t],l.push(I(r,p,{retryCallback:e}))}return l}}(this),this.clipped(function(e){return function(){return e.transformed(o,r)}}(this),r)},e.prototype.clipped=function(){var i,d,g,m,y,f,x,b,C,w,v,P;for(g=arguments[0],i=2<=arguments.length?S.call(arguments,1):[],v=this.width===k?0:this.position.x,P=this.height===k?0:this.position.y,w=function(){switch(this.width){case k:return this.canvas.width;default:return this.width*this.getRenderScale();}}.call(this),m=function(){switch(this.height){case k:return this.canvas.height;default:return this.height*this.getRenderScale();}}.call(this),y=0,x=i.length;x>y;y++){d=i[y],d.save(),d.beginPath(),d.rect(v,P,w,m),d.clip()}for(g(),C=[],f=0,b=i.length;b>f;f++){d=i[f],C.push(d.restore())}return C},e.prototype.transformed=function(){var l,p,d,c,g,u,m,y,f;for(d=arguments[0],l=2<=arguments.length?S.call(arguments,1):[],c=0,u=l.length;u>c;c++){p=l[c],p.save(),p.translate(Math.floor(this.position.x),Math.floor(this.position.y)),f=this.getRenderScale(),p.scale(f,f)}for(d(),y=[],g=0,m=l.length;m>g;g++){p=l[g],y.push(p.restore())}return y},e.prototype.clear=function(o){var a,r;return null==o&&(o=!0),r=this.shapes,a=[],this.setShapesInProgress([]),this.execute(new w.ClearAction(this,r,a)),this.repaintLayer("main"),o&&this.trigger("clear",null),this.trigger("drawingChange",{})},e.prototype.execute=function(e){return this.undoStack.push(e),e["do"](),this.redoStack=[]},e.prototype.undo=function(){var e;if(this.undoStack.length)return e=this.undoStack.pop(),e.undo(),this.redoStack.push(e),this.trigger("undo",{action:e}),this.trigger("drawingChange",{})},e.prototype.redo=function(){var e;if(this.redoStack.length)return e=this.redoStack.pop(),this.undoStack.push(e),e["do"](),this.trigger("redo",{action:e}),this.trigger("drawingChange",{})},e.prototype.canUndo=function(){return!!this.undoStack.length},e.prototype.canRedo=function(){return!!this.redoStack.length},e.prototype.getPixel=function(o,t){var e,a;return e=this.drawingCoordsToClientCoords(o,t),a=this.ctx.getImageData(e.x,e.y,1,1).data,a[3]?"rgb("+a[0]+", "+a[1]+", "+a[2]+")":null},e.prototype.getContentBounds=function(){return N.getBoundingRect(this.shapes.concat(this.backgroundShapes).map(function(e){return e.getBoundingRect()}),this.width===k?0:this.width,this.height===k?0:this.height)},e.prototype.getDefaultImageRect=function(o,a){var s;return null==o&&(o={width:0,height:0}),null==a&&(a={top:0,right:0,bottom:0,left:0}),N.getDefaultImageRect(function(){var o,a,n,l;for(n=this.shapes.concat(this.backgroundShapes),l=[],o=0,a=n.length;a>o;o++){s=n[o],l.push(s.getBoundingRect(this.ctx))}return l}.call(this),o,a)},e.prototype.getImage=function(e){return null==e&&(e={}),null==e.includeWatermark&&(e.includeWatermark=!0),null==e.scaleDownRetina&&(e.scaleDownRetina=!0),null==e.scale&&(e.scale=1),e.scaleDownRetina||(e.scale*=this.backingScale),e.includeWatermark&&(e.watermarkImage=this.watermarkImage,e.watermarkScale=this.watermarkScale,e.scaleDownRetina||(e.watermarkScale*=this.backingScale)),L(this.getSnapshot(),e)},e.prototype.canvasForExport=function(){return this.repaintAllLayers(),N.combineCanvases(this.backgroundCanvas,this.canvas)},e.prototype.canvasWithBackground=function(e){return N.combineCanvases(e,this.canvasForExport())},e.prototype.getSnapshot=function(a){var l,p,d,c,h,g;for(null==a&&(a=null),null==a&&(a=["shapes","imageSize","colors","position","scale","backgroundShapes"]),g={},c=["colors","position","scale"],l=0,d=c.length;d>l;l++){p=c[l],0<=v.call(a,p)&&(g[p]=this[p])}return 0<=v.call(a,"shapes")&&(g.shapes=function(){var o,a,r,s;for(r=this.shapes,s=[],o=0,a=r.length;a>o;o++){h=r[o],s.push(O(h))}return s}.call(this)),0<=v.call(a,"backgroundShapes")&&(g.backgroundShapes=function(){var o,a,r,s;for(r=this.backgroundShapes,s=[],o=0,a=r.length;a>o;o++){h=r[o],s.push(O(h))}return s}.call(this)),0<=v.call(a,"imageSize")&&(g.imageSize={width:this.width,height:this.height}),g},e.prototype.getSnapshotJSON=function(){return console.warn("lc.getSnapshotJSON() is deprecated. use JSON.stringify(lc.getSnapshot()) instead."),JSON.stringify(this.getSnapshot())},e.prototype.getSVGString=function(e){return null==e&&(e={}),z(this.getSnapshot(),e)},e.prototype.loadSnapshot=function(a){var t,r,d,g,m,y,S,f,x,k;if(a){if(a.colors)for(y=["primary","secondary","background"],t=0,g=y.length;g>t;t++){d=y[t],this.setColor(d,a.colors[d])}if(a.shapes)for(this.shapes=[],S=a.shapes,r=0,m=S.length;m>r;r++){k=S[r],x=b(k),x&&this.execute(new w.AddShapeAction(this,x))}return a.backgroundShapes&&(this.backgroundShapes=function(){var t,r,s,l;for(s=a.backgroundShapes,l=[],t=0,r=s.length;r>t;t++){f=s[t],l.push(b(f))}return l}()),a.imageSize&&(this.width=a.imageSize.width,this.height=a.imageSize.height),a.position&&(this.position=a.position),a.scale&&(this.scale=a.scale),this.repaintAllLayers(),this.trigger("snapshotLoad"),this.trigger("drawingChange",{})}},e.prototype.loadSnapshotJSON=function(e){return console.warn("lc.loadSnapshotJSON() is deprecated. use lc.loadSnapshot(JSON.parse(snapshot)) instead."),this.loadSnapshot(JSON.parse(e))},e}()},{"../tools/Pencil":48,"./actions":7,"./bindEvents":8,"./canvasRenderer":9,"./math":14,"./renderSnapshotToImage":15,"./renderSnapshotToSVG":16,"./shapes":17,"./svgRenderer":18,"./util":19}],6:[function(a,t){var e,p,d,c;a("./fontmetrics.js"),c=function(l){var t,p,d,c,g,u,m,y;for(p=l.split(" "),d=0,g=0,u=p.length;u>g;g++){c=p[g],m=parseInt(c.replace("px",""),10),isNaN(m)||(d=m)}if(!d)throw"Font size not found";return y=l.substring(p[0].length+1).replace("bold ","").replace("italic ","").replace("underline ",""),t=y,{fontSize:d,fontFamily:t}},d=function(d,t,e){var n,g,m,y,S,f,x,k,b,C;if(!t.length)return["",""];for(g=0,f=0,x=0,C=!1;;){if(g+=1,m=g>=t.length,S=!m&&t[g].match(/\s/),y=S||m,b=t.substring(0,g),n=e?d.measureTextWidth(b).width<=e:!0,n&&(x=g),y&&C&&(C=!1,n&&(f=g)),C=!S,m||!n){if(n)return[t,""];if(0n;n++){if(k=b[n],S=d(o,k,e),y=S[0],x=S[1],y)for(;y;){m.push(y),f=d(o,x,e),y=f[0],x=f[1]}else m.push(k)}return m},e=function(){function e(r,t,e,n,i){var o,s,d;this.text=t,this.font=e,this.forcedWidth=n,this.forcedHeight=i,d=c(this.font),o=d.fontFamily,s=d.fontSize,r.font=this.font,r.textBaseline="baseline",this.emDashWidth=r.measureTextWidth("\u2014",s,o).width,this.caratWidth=r.measureTextWidth("|",s,o).width,this.lines=p(r,this.text,this.forcedWidth),this.metricses=this.lines.map(function(t){return function(e){return r.measureText2(e||"X",s,t.font)}}(this)),this.metrics={ascent:Math.max.apply(Math,this.metricses.map(function(o){var t;return t=o.ascent})),descent:Math.max.apply(Math,this.metricses.map(function(o){var t;return t=o.descent})),fontsize:Math.max.apply(Math,this.metricses.map(function(o){var t;return t=o.fontsize})),leading:Math.max.apply(Math,this.metricses.map(function(o){var t;return t=o.leading})),width:Math.max.apply(Math,this.metricses.map(function(o){var t;return t=o.width})),height:Math.max.apply(Math,this.metricses.map(function(o){var t;return t=o.height})),bounds:{minx:Math.min.apply(Math,this.metricses.map(function(o){var t;return t=o.bounds,t.minx})),miny:Math.min.apply(Math,this.metricses.map(function(o){var t;return t=o.bounds,t.miny})),maxx:Math.max.apply(Math,this.metricses.map(function(o){var t;return t=o.bounds,t.maxx})),maxy:Math.max.apply(Math,this.metricses.map(function(o){var t;return t=o.bounds,t.maxy}))}},this.boundingBoxWidth=Math.ceil(this.metrics.width)}return e.prototype.draw=function(l,t,e){var n,p,d,c,g,u;for(l.textBaseline="top",l.font=this.font,n=0,g=this.lines,u=[],p=0,d=g.length;d>p;p++){c=g[p],l.fillText(c,t,e+n*this.metrics.leading),u.push(n+=1)}return u},e.prototype.getWidth=function(e){return null==e&&(e=!1),this.forcedWidth?this.forcedWidth:e?this.metrics.bounds.maxx+this.caratWidth:this.metrics.bounds.maxx},e.prototype.getHeight=function(){return this.forcedHeight||this.metrics.leading*this.lines.length},e}(),t.exports=e},{"./fontmetrics.js":11}],7:[function(o,t){var e,a;a=function(){function e(o,t,e){this.lc=o,this.oldShapes=t,this.newShapes=e}return e.prototype["do"]=function(){return this.lc.shapes=this.newShapes,this.lc.repaintLayer("main")},e.prototype.undo=function(){return this.lc.shapes=this.oldShapes,this.lc.repaintLayer("main")},e}(),e=function(){function e(o,t,e){this.lc=o,this.shape=t,this.previousShapeId=null!=e?e:null}return e.prototype["do"]=function(){var a,s,l,p,d,c;if(this.lc.shapes.length&&this.lc.shapes[this.lc.shapes.length-1].id!==this.previousShapeId&&null!==this.previousShapeId){for(p=[],a=!1,d=this.lc.shapes,s=0,l=d.length;l>s;s++){c=d[s],p.push(c),c.id===this.previousShapeId&&(p.push(this.shape),a=!0)}a||p.push(this.shape),this.lc.shapes=p}else this.lc.shapes.push(this.shape);return this.lc.repaintLayer("main")},e.prototype.undo=function(){var o,a,s,l,p;if(this.lc.shapes[this.lc.shapes.length-1].id===this.shape.id)this.lc.shapes.pop();else{for(s=[],l=this.lc.shapes,o=0,a=l.length;a>o;o++){p=l[o],p.id!==this.shape.id&&s.push(p)}lc.shapes=s}return this.lc.repaintLayer("main")},e}(),t.exports={ClearAction:a,AddShapeAction:e}},{}],8:[function(a,t){var e,n,p,l;p=function(o,t){var e,a,s;return a=t.changedTouches[0].clientX,s=t.changedTouches[0].clientY,e=o.getBoundingClientRect(),[a-e.left,s-e.top]},l=function(o,t){var e;return e=o.getBoundingClientRect(),{left:t.clientX-e.left,top:t.clientY-e.top}},n=function(e){return null!=e.buttons?1===e.buttons:0a;a++){o=m[a],s.push(o())}return s}}},{}],9:[function(n,t){var g,e,m,y,S,f,x,k,b,C,w;x=n("./lineEndCapShapes"),w={},e=function(o,t,e){return w[o]={drawFunc:t,drawLatestFunc:e}},k=function(){},C=function(o,t,e){var a;if(null==e&&(e={}),null==e.shouldIgnoreUnsupportedShapes&&(e.shouldIgnoreUnsupportedShapes=!1),null==e.retryCallback&&(e.retryCallback=k),null==e.shouldOnlyDrawLatest&&(e.shouldOnlyDrawLatest=!1),null==e.bufferCtx&&(e.bufferCtx=null),a=e.bufferCtx,w[t.className])return e.shouldOnlyDrawLatest&&w[t.className].drawLatestFunc?w[t.className].drawLatestFunc(o,a,t,e.retryCallback):w[t.className].drawFunc(o,t,e.retryCallback);if(e.shouldIgnoreUnsupportedShapes)return console.warn("Can't render shape of type "+t.className+" to canvas");throw"Can't render shape of type "+t.className+" to canvas"},b=function(o,t,e){return C(o.getContext("2d"),t,e)},e("Rectangle",function(o,t){var e,a;return e=t.x,a=t.y,0!=t.strokeWidth%2&&(e+=.5,a+=.5),o.fillStyle=t.fillColor,o.fillRect(e,a,t.width,t.height),o.lineWidth=t.strokeWidth,o.strokeStyle=t.strokeColor,o.strokeRect(e,a,t.width,t.height)}),e("Ellipse",function(a,t){var e,s,l,p;return a.save(),p=Math.floor(t.width/2),l=Math.floor(t.height/2),e=t.x+p,s=t.y+l,a.translate(e,s),a.scale(1,Math.abs(t.height/t.width)),a.beginPath(),a.arc(0,0,Math.abs(p),0,2*Math.PI),a.closePath(),a.restore(),a.fillStyle=t.fillColor,a.fill(),a.lineWidth=t.strokeWidth,a.strokeStyle=t.strokeColor,a.stroke()}),e("SelectionBox",function(){var o;return o=function(t,o,e){var a,n;return a=o.x,n=o.y,0!==e?(t.fillStyle="#fff",t.fillRect(a,n,e,e),t.strokeStyle="#000",t.strokeRect(a,n,e,e)):void 0},function(t,e){return o(t,e.getTopLeftHandleRect(),e.handleSize),o(t,e.getTopRightHandleRect(),e.handleSize),o(t,e.getBottomLeftHandleRect(),e.handleSize),o(t,e.getBottomRightHandleRect(),e.handleSize),e.backgroundColor&&(t.fillStyle=e.backgroundColor,t.fillRect(e._br.x-e.margin,e._br.y-e.margin,e._br.width+2*e.margin,e._br.height+2*e.margin)),t.lineWidth=1,t.strokeStyle="#000",t.setLineDash([2,4]),t.strokeRect(e._br.x-e.margin,e._br.y-e.margin,e._br.width+2*e.margin,e._br.height+2*e.margin),t.setLineDash([])}}()),e("Image",function(o,t,e){return t.image.width?1===t.scale?o.drawImage(t.image,t.x,t.y):o.drawImage(t.image,t.x,t.y,t.image.width*t.scale,t.image.height*t.scale):e?t.image.onload=e:void 0}),e("Line",function(a,t){var e,l,p,d,c;if(t.x1!==t.x2||t.y1!==t.y2)return l=t.x1,p=t.x2,d=t.y1,c=t.y2,0!=t.strokeWidth%2&&(l+=.5,p+=.5,d+=.5,c+=.5),a.lineWidth=t.strokeWidth,a.strokeStyle=t.color,a.lineCap=t.capStyle,t.dash&&a.setLineDash(t.dash),a.beginPath(),a.moveTo(l,d),a.lineTo(p,c),a.stroke(),t.dash&&a.setLineDash([]),e=Math.max(2.2*t.strokeWidth,5),t.endCapShapes[0]&&x[t.endCapShapes[0]].drawToCanvas(a,l,d,Math.atan2(d-c,l-p),e,t.color),t.endCapShapes[1]?x[t.endCapShapes[1]].drawToCanvas(a,p,c,Math.atan2(c-d,p-l),e,t.color):void 0}),g=function(i,t,e,l){var p,d,c,h;if(null==e&&(e=!1),null==l&&(l="round"),t.length){for(i.lineCap=l,i.strokeStyle=t[0].color,i.lineWidth=t[0].size,i.beginPath(),0==t[0].size%2?i.moveTo(t[0].x,t[0].y):i.moveTo(t[0].x+.5,t[0].y+.5),h=t.slice(1),p=0,d=h.length;d>p;p++){c=h[p],0==t[0].size%2?i.lineTo(c.x,c.y):i.lineTo(c.x+.5,c.y+.5)}return e?i.closePath():void 0}},S=function(o,t){return g(o,t.smoothedPoints),o.stroke()},f=function(a,t,e){var n,i,l;return e.tail?(l=e.smoothedPoints.length-e.segmentSize*e.tailSize,i=l<2*e.segmentSize?0:l,n=l+e.segmentSize+1,g(t,e.smoothedPoints.slice(i,n)),t.stroke()):(g(t,e.smoothedPoints),t.stroke())},e("LinePath",S,f),m=function(o,t){return o.save(),o.globalCompositeOperation="destination-out",S(o,t),o.restore()},y=function(o,t,e){return o.save(),o.globalCompositeOperation="destination-out",t.save(),t.globalCompositeOperation="destination-out",f(o,t,e),o.restore(),t.restore()},e("ErasedLinePath",m,y),e("Text",function(o,t){return t.renderer||t._makeRenderer(o),o.fillStyle=t.color,t.renderer.draw(o,t.x,t.y)}),e("Polygon",function(o,t){return o.fillStyle=t.fillColor,g(o,t.points,t.isClosed,"butt"),o.fill(),o.stroke()}),t.exports={defineCanvasRenderer:e,renderShapeToCanvas:b,renderShapeToContext:C}},{"./lineEndCapShapes":12}],10:[function(o,t){"use strict";t.exports={imageURLPrefix:"lib/img",primaryColor:"hsla(0, 0%, 0%, 1)",secondaryColor:"hsla(0, 0%, 100%, 1)",backgroundColor:"transparent",strokeWidths:[1,2,5,10,20,30],defaultStrokeWidth:5,toolbarPosition:"top",keyboardShortcuts:!1,imageSize:{width:"infinite",height:"infinite"},backgroundShapes:[],watermarkImage:null,watermarkScale:1,zoomMin:.2,zoomMax:4,zoomStep:.2,snapshot:null,onInit:function onInit(){},tools:[o("../tools/Pencil"),o("../tools/Eraser"),o("../tools/Line"),o("../tools/Rectangle"),o("../tools/Ellipse"),o("../tools/Text"),o("../tools/Polygon"),o("../tools/Pan"),o("../tools/Eyedropper")]}},{"../tools/Ellipse":43,"../tools/Eraser":44,"../tools/Eyedropper":45,"../tools/Line":46,"../tools/Pan":47,"../tools/Pencil":48,"../tools/Polygon":49,"../tools/Rectangle":50,"../tools/Text":52}],11:[function(){"use strict";!function(){if(!document.defaultView.getComputedStyle)throw"ERROR: 'document.defaultView.getComputedStyle' not found. This library only works in browsers that can report computed CSS values.";CanvasRenderingContext2D.prototype.measureTextWidth=CanvasRenderingContext2D.prototype.measureText;var l=function(t,o){return document.defaultView.getComputedStyle(t,null).getPropertyValue(o)};CanvasRenderingContext2D.prototype.measureText2=function(t,e,n){var i=this.measureTextWidth(t),r=!/\S/.test(t);i.fontsize=e;var o=document.createElement("div");o.style.position="absolute",o.style.opacity=0,o.style.font=n,o.innerHTML=t+"
"+t,document.body.appendChild(o),i.leading=1.2*e;var s=l(o,"height");if(s=s.replace("px",""),s>=2*e&&(i.leading=0|s/2),document.body.removeChild(o),r)i.ascent=0,i.descent=0,i.bounds={minx:0,maxx:i.width,miny:0,maxy:0},i.height=0;else{var b=document.createElement("canvas");b.width=i.width+100,b.height=3*e,b.style.opacity=1,b.style.font=n;var h=b.getContext("2d");h.font=n;var c=b.width,u=b.height,p=u/2;h.fillStyle="white",h.fillRect(-1,-1,c+2,u+2),h.fillStyle="black",h.fillText(t,50,p);for(var d=h.getImageData(0,0,c,u).data,f=0,C=4*c,m=d.length;++ff&&255===d[f];){f+=C,f>=m&&(f=f-m+4)}var v=0|f%C/4,x=1;for(f=m-3;0<=f&&255===d[f];){f-=C,0>f&&(f=m-3-4*x++)}var P=0|f%C/4+1;i.ascent=p-y,i.descent=S-p,i.bounds={minx:v-50,maxx:P-50,miny:0,maxy:S-y},i.height=1+(S-y)}return i}}()},{}],12:[function(o,t){t.exports={arrow:function(){var l;return l=function(t,o,e,a,n){return[{x:t+Math.cos(e+Math.PI/2)*a/2,y:o+Math.sin(e+Math.PI/2)*a/2},{x:t+Math.cos(e)*n,y:o+Math.sin(e)*n},{x:t+Math.cos(e-Math.PI/2)*a/2,y:o+Math.sin(e-Math.PI/2)*a/2}]},{drawToCanvas:function drawToCanvas(t,e,n,i,r,o,s){var p;return null==s&&(s=0),s=s||r,t.fillStyle=o,t.lineWidth=0,t.strokeStyle="transparent",t.beginPath(),p=l(e,n,i,r,s),t.moveTo(p[0].x,p[0].y),t.lineTo(p[1].x,p[1].y),t.lineTo(p[2].x,p[2].y),t.fill()},svg:function svg(t,e,n,i,r,o){var p;return null==o&&(o=0),o=o||i,p=l(t,e,n,i,o),""}}}()}},{}],13:[function(a,t){var e,n,s;s={},n=function(e){return s=e},e=function(o){var t;return t=s[o],t||o},t.exports={localize:n,_:e}},{}],14:[function(n,t){var e,r,l,p,d,c;e=n("./shapes").Point,c=n("./util"),l={},l.toPoly=function(s){var t,d,c,g,u,m,y;for(m=[],y=[],d=0,t=0,c=s.length;c>t;t++){u=s[t],g=p(u,r(s,d)),m=m.concat([g[0]]),y=[g[1]].concat(y),d+=1}return m.concat(y)},r=function r(o,t){var e;return 3>o.length&&(e={x:0,y:0}),e=0===t?r(o,t+1):t===o.length-1?r(o,t-1):l.diff(o[t-1],o[t+1])},l.diff=function(o,t){return{x:t.x-o.x,y:t.y-o.y}},d=function(o){var t;return t=l.len(o),{x:o.x/t,y:o.y/t}},p=function(o,t){return t=d(t),t.x=t.x*o.size/2,t.y=t.y*o.size/2,[{x:o.x-t.y,y:o.y+t.x,color:o.color},{x:o.x+t.y,y:o.y-t.x,color:o.color}]},l.len=function(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))},l.scalePositionScalar=function(a,t,e,n){var i,s;return s=t*e,i=t*n,a+(s-i)/2},t.exports=l},{"./shapes":17,"./util":19}],15:[function(a,t){var g,n,m,y;y=a("./util"),n=a("./shapes").JSONToShape,g="infinite",m=function(o,t,e){return t.width?(o.save(),o.translate(o.canvas.width/2,o.canvas.height/2),o.scale(e,e),o.drawImage(t,-t.width/2,-t.height/2),o.restore()):void 0},t.exports=function(r,t){var o,i,s,S,f,x,k,b;return null==t&&(t={}),null==t.scale&&(t.scale=1),x=function(){var t,a,s,l;for(s=r.shapes,l=[],t=0,a=s.length;a>t;t++){f=s[t],l.push(n(f))}return l}(),i=[],r.backgroundShapes&&(i=function(){var t,a,s,l;for(s=r.backgroundShapes,l=[],t=0,a=s.length;a>t;t++){f=s[t],l.push(n(f))}return l}()),null==t.margin&&(t.margin={top:0,right:0,bottom:0,left:0}),S=r.imageSize||{width:g,height:g},s=r.colors||{background:"transparent"},o=x.concat(i),k=document.createElement("canvas"),b=k.getContext("2d"),t.rect?(t.rect.x-=t.margin.left,t.rect.y-=t.margin.top,t.rect.width+=t.margin.left+t.margin.right,t.rect.height+=t.margin.top+t.margin.bottom):t.rect=y.getDefaultImageRect(function(){var a,n,r;for(r=[],a=0,n=o.length;n>a;a++){f=o[a],r.push(f.getBoundingRect(b))}return r}(),S,t.margin),k.width=t.rect.width*t.scale,k.height=t.rect.height*t.scale,b.fillStyle=s.background,b.fillRect(0,0,k.width,k.height),t.rect.width&&t.rect.height?(t.watermarkImage&&m(b,t.watermarkImage,t.watermarkScale),y.combineCanvases(k,y.renderShapes(i,t.rect,t.scale),y.renderShapes(x,t.rect,t.scale))):null}},{"./shapes":17,"./util":19}],16:[function(a,t){var d,n,g;g=a("./util"),n=a("./shapes").JSONToShape,d="infinite",t.exports=function(r,t){var o,i,m,y,S,f,x,k;return null==t&&(t={}),k=function(){var t,a,s,l;for(s=r.shapes,l=[],t=0,a=s.length;a>t;t++){x=s[t],l.push(n(x))}return l}(),i=[],r.backgroundShapes&&(i=function(){var t,a,s,l;for(s=r.backgroundShapes,l=[],t=0,a=s.length;a>t;t++){x=s[t],l.push(n(x))}return l}()),null==t.margin&&(t.margin={top:0,right:0,bottom:0,left:0}),f=r.imageSize||{width:d,height:d},m=r.colors||{background:"transparent"},o=k.concat(i),S=document.createElement("canvas"),y=S.getContext("2d"),t.rect?(t.rect.x-=t.margin.left,t.rect.y-=t.margin.top,t.rect.width+=t.margin.left+t.margin.right,t.rect.height+=t.margin.top+t.margin.bottom):t.rect=g.getDefaultImageRect(function(){var a,n,r;for(r=[],a=0,n=o.length;n>a;a++){x=o[a],r.push(x.getBoundingRect(y))}return r}(),f,t.margin),LC.renderShapesToSVG(i.concat(k),t.rect,m.background)}},{"./shapes":17,"./util":19}],17:[function(n,t){var u,e,P,R,_,E,I,T,L,z,O,N,W,B,D,U,A,M,F,G,H,J;J=n("./util"),P=n("./TextRenderer"),B=n("./lineEndCapShapes"),U=n("./canvasRenderer"),O=U.defineCanvasRenderer,M=U.renderShapeToContext,A=n("./svgRenderer"),N=A.defineSVGRenderer,F=A.renderShapeToSVG,H={},W=function(p,y){var e,t,d,c,g,u,m,S;e=function(e,t,n,i,r,o,s,a,h,l,c,u,p,d,S,g){return y.constructor.call(this,e,t,n,i,r,o,s,a,h,l,c,u,p,d,S,g),this},e.prototype.className=p,e.fromJSON=y.fromJSON,y.draw&&(g=y.draw,u=y.draw||function(o,t,e){return this.draw(o,t,e)},t=function(o,t,e){return g.call(t,o,e)},d=function(o,t,e,a){return u.call(e,o,t,a)},delete y.draw,y.drawLatest&&delete y.drawLatest,O(p,t,d)),y.toSVG&&(m=y.toSVG,S=function(e){return m.call(e)},delete y.toSVG,N(p,S)),e.prototype.draw=function(o,t){return M(o,this,{retryCallback:t})},e.prototype.drawLatest=function(o,t,e){return M(o,this,{retryCallback:e,bufferCtx:t,shouldOnlyDrawLatest:!0})},e.prototype.toSVG=function(){return F(this)};for(c in y){"fromJSON"!==c&&(e.prototype[c]=y[c])}return H[p]=e,e},z=function(p,t,e,n,i,r,o,s,a,h,l,c,u,S,d,f,g){var m;return m=new H[p](t,e,n,i,r,o,s,a,h,l,c,u,S,d,f,g),m.id=J.getGUID(),m},u=function(o){var t,a,s,l;return t=o.className,a=o.data,s=o.id,t in H?(l=H[t].fromJSON(a),l?(s&&(l.id=s),l):(console.log("Unreadable shape:",t,a),null)):(console.log("Unknown shape:",t,a),null)},G=function(e){return{className:e.className,data:e.toJSON(),id:e.id}},L=function u(o,t){return t?L(E(E(T(o))),t-1):o},T=function(a){var s,l,p,d,c;for(a=[a[0]].concat(a).concat(J.last(a)),c=[],s=0,d=0,l=a.length;l>d;d++){p=a[d],c[2*s]=p,a[s+1]&&(c[2*s+1]=I(p,a[s+1])),s+=1}return c},E=function(a){var t,s,l,p,d;for(t=[],s=0,d=0,l=a.length;l>d;d++){p=a[d],a[s+1]&&(t[s]=I(p,a[s+1])),s+=1}return t},I=function(o,t){return z("Point",{x:o.x+(t.x-o.x)/2,y:o.y+(t.y-o.y)/2,size:o.size+(t.size-o.size)/2,color:o.color})},W("Image",{constructor:function constructor(e){return null==e&&(e={}),this.x=e.x||0,this.y=e.y||0,this.scale=e.scale||1,this.image=e.image||null},getBoundingRect:function getBoundingRect(){return{x:this.x,y:this.y,width:this.image.width*this.scale,height:this.image.height*this.scale}},toJSON:function toJSON(){return{x:this.x,y:this.y,imageSrc:this.image.src,imageObject:this.image,scale:this.scale}},fromJSON:function fromJSON(o){var t,a;return t=null,(null!=(a=o.imageObject)?a.width:void 0)?t=o.imageObject:(t=new Image,t.src=o.imageSrc),z("Image",{x:o.x,y:o.y,image:t,scale:o.scale})},move:function move(e){return null==e&&(e={}),this.x=this.x-e.xDiff,this.y=this.y-e.yDiff},setUpperLeft:function setUpperLeft(e){return null==e&&(e={}),this.x=e.x,this.y=e.y}}),W("Rectangle",{constructor:function constructor(e){return null==e&&(e={}),this.x=e.x||0,this.y=e.y||0,this.width=e.width||0,this.height=e.height||0,this.strokeWidth=e.strokeWidth||1,this.strokeColor=e.strokeColor||"black",this.fillColor=e.fillColor||"transparent"},getBoundingRect:function getBoundingRect(){return{x:this.x-this.strokeWidth/2,y:this.y-this.strokeWidth/2,width:this.width+this.strokeWidth,height:this.height+this.strokeWidth}},toJSON:function toJSON(){return{x:this.x,y:this.y,width:this.width,height:this.height,strokeWidth:this.strokeWidth,strokeColor:this.strokeColor,fillColor:this.fillColor}},fromJSON:function fromJSON(e){return z("Rectangle",e)},move:function move(e){return null==e&&(e={}),this.x=this.x-e.xDiff,this.y=this.y-e.yDiff},setUpperLeft:function setUpperLeft(e){return null==e&&(e={}),this.x=e.x,this.y=e.y}}),W("Ellipse",{constructor:function constructor(e){return null==e&&(e={}),this.x=e.x||0,this.y=e.y||0,this.width=e.width||0,this.height=e.height||0,this.strokeWidth=e.strokeWidth||1,this.strokeColor=e.strokeColor||"black",this.fillColor=e.fillColor||"transparent"},getBoundingRect:function getBoundingRect(){return{x:this.x-this.strokeWidth/2,y:this.y-this.strokeWidth/2,width:this.width+this.strokeWidth,height:this.height+this.strokeWidth}},toJSON:function toJSON(){return{x:this.x,y:this.y,width:this.width,height:this.height,strokeWidth:this.strokeWidth,strokeColor:this.strokeColor,fillColor:this.fillColor}},fromJSON:function fromJSON(e){return z("Ellipse",e)},move:function move(e){return null==e&&(e={}),this.x=this.x-e.xDiff,this.y=this.y-e.yDiff},setUpperLeft:function setUpperLeft(e){return null==e&&(e={}),this.x=e.x,this.y=e.y}}),W("Line",{constructor:function constructor(e){return null==e&&(e={}),this.x1=e.x1||0,this.y1=e.y1||0,this.x2=e.x2||0,this.y2=e.y2||0,this.strokeWidth=e.strokeWidth||1,this.color=e.color||"black",this.capStyle=e.capStyle||"round",this.endCapShapes=e.endCapShapes||[null,null],this.dash=e.dash||null},getBoundingRect:function getBoundingRect(){return{x:Math.min(this.x1,this.x2)-this.strokeWidth/2,y:Math.min(this.y1,this.y2)-this.strokeWidth/2,width:Math.abs(this.x2-this.x1)+this.strokeWidth/2,height:Math.abs(this.y2-this.y1)+this.strokeWidth/2}},toJSON:function toJSON(){return{x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2,strokeWidth:this.strokeWidth,color:this.color,capStyle:this.capStyle,dash:this.dash,endCapShapes:this.endCapShapes}},fromJSON:function fromJSON(e){return z("Line",e)},move:function move(e){return null==e&&(e={}),this.x1=this.x1-e.xDiff,this.y1=this.y1-e.yDiff,this.x2=this.x2-e.xDiff,this.y2=this.y2-e.yDiff},setUpperLeft:function setUpperLeft(o){var a,r,s;return null==o&&(o={}),a=this.getBoundingRect(),r=a.x-o.x,s=a.y-o.y,this.move({xDiff:r,yDiff:s})}}),_=function(a){var t,s,l,p,d;if(!a.length)return!1;for(d=a[0].size,t=a[0].color,p=0,s=a.length;s>p;p++){if(l=a[p],l.size===d&&l.color===t||console.log(d,t,l.size,l.color),l.size!==d||l.color!==t)return!1}return!0},R=function(i,l){var e,t,p,d,c;return t=null,l.points?t=function(){var a,n,i,p;for(i=l.points,p=[],n=0,a=i.length;a>n;n++){e=i[n],p.push(u(e))}return p}():l.pointCoordinatePairs&&(t=function(){var e,a,i,s,p;for(i=l.pointCoordinatePairs,p=[],a=0,e=i.length;e>a;a++){s=i[a],d=s[0],c=s[1],p.push(u({className:"Point",data:{x:d,y:c,size:l.pointSize,color:l.pointColor,smooth:l.smooth}}))}return p}()),p=null,l.smoothedPointCoordinatePairs&&(p=function(){var e,a,i,s,p;for(i=l.smoothedPointCoordinatePairs,p=[],a=0,e=i.length;e>a;a++){s=i[a],d=s[0],c=s[1],p.push(u({className:"Point",data:{x:d,y:c,size:l.pointSize,color:l.pointColor,smooth:l.smooth}}))}return p}()),t[0]?z(i,{points:t,smoothedPoints:p,order:l.order,tailSize:l.tailSize,smooth:l.smooth}):null},D={constructor:function constructor(a){var s,l,p,d,c;if(null==a&&(a={}),p=a.points||[],this.order=a.order||3,this.tailSize=a.tailSize||3,this.smooth="smooth"in a?a.smooth:!0,this.segmentSize=Math.pow(2,this.order),this.sampleSize=this.tailSize+1,a.smoothedPoints)return this.points=a.points,this.smoothedPoints=a.smoothedPoints;for(this.points=[],c=[],d=0,s=p.length;s>d;d++){l=p[d],c.push(this.addPoint(l))}return c},getBoundingRect:function getBoundingRect(){return J.getBoundingRect(this.points.map(function(e){return{x:e.x-e.size/2,y:e.y-e.size/2,width:e.size,height:e.size}}))},toJSON:function toJSON(){var o,a;return _(this.points)?{order:this.order,tailSize:this.tailSize,smooth:this.smooth,pointCoordinatePairs:function(){var e,o,s,l;for(s=this.points,l=[],o=0,e=s.length;e>o;o++){a=s[o],l.push([a.x,a.y])}return l}.call(this),smoothedPointCoordinatePairs:function(){var e,o,s,l;for(s=this.smoothedPoints,l=[],o=0,e=s.length;e>o;o++){a=s[o],l.push([a.x,a.y])}return l}.call(this),pointSize:this.points[0].size,pointColor:this.points[0].color}:{order:this.order,tailSize:this.tailSize,smooth:this.smooth,points:function(){var t,a,s,l;for(s=this.points,l=[],a=0,t=s.length;t>a;a++){o=s[a],l.push(G(o))}return l}.call(this)}},fromJSON:function fromJSON(e){return R("LinePath",e)},addPoint:function addPoint(e){return this.points.push(e),this.smooth?!this.smoothedPoints||this.points.lengthp;p++){s=l[p],s.move(o)}return this.points=this.smoothedPoints},setUpperLeft:function setUpperLeft(o){var a,r,s;return null==o&&(o={}),a=this.getBoundingRect(),r=a.x-o.x,s=a.y-o.y,this.move({xDiff:r,yDiff:s})}},e=W("LinePath",D),W("ErasedLinePath",{constructor:D.constructor,toJSON:D.toJSON,addPoint:D.addPoint,getBoundingRect:D.getBoundingRect,fromJSON:function fromJSON(e){return R("ErasedLinePath",e)}}),W("Point",{constructor:function constructor(e){return null==e&&(e={}),this.x=e.x||0,this.y=e.y||0,this.size=e.size||0,this.color=e.color||""},getBoundingRect:function getBoundingRect(){return{x:this.x-this.size/2,y:this.y-this.size/2,width:this.size,height:this.size}},toJSON:function toJSON(){return{x:this.x,y:this.y,size:this.size,color:this.color}},fromJSON:function fromJSON(e){return z("Point",e)},move:function move(e){return null==e&&(e={}),this.x=this.x-e.xDiff,this.y=this.y-e.yDiff},setUpperLeft:function setUpperLeft(e){return null==e&&(e={}),this.x=e.x,this.y=e.y}}),W("Polygon",{constructor:function constructor(a){var s,l,p,d,c;for(null==a&&(a={}),this.points=a.points,this.fillColor=a.fillColor||"white",this.strokeColor=a.strokeColor||"black",this.strokeWidth=a.strokeWidth,this.dash=a.dash||null,null==a.isClosed&&(a.isClosed=!0),this.isClosed=a.isClosed,d=this.points,c=[],p=0,s=d.length;s>p;p++){l=d[p],l.color=this.strokeColor,c.push(l.size=this.strokeWidth)}return c},addPoint:function addPoint(o,t){return this.points.push(LC.createShape("Point",{x:o,y:t}))},getBoundingRect:function getBoundingRect(){return J.getBoundingRect(this.points.map(function(e){return e.getBoundingRect()}))},toJSON:function toJSON(){return{strokeWidth:this.strokeWidth,fillColor:this.fillColor,strokeColor:this.strokeColor,dash:this.dash,isClosed:this.isClosed,pointCoordinatePairs:this.points.map(function(e){return[e.x,e.y]})}},fromJSON:function fromJSON(o){return o.points=o.pointCoordinatePairs.map(function(t){var e,a;return e=t[0],a=t[1],z("Point",{x:e,y:a,size:o.strokeWidth,color:o.strokeColor})}),z("Polygon",o)},move:function move(a){var s,l,p,d,c;for(null==a&&(a={}),d=this.points,c=[],p=0,s=d.length;s>p;p++){l=d[p],c.push(l.move(a))}return c},setUpperLeft:function setUpperLeft(o){var a,r,s;return null==o&&(o={}),a=this.getBoundingRect(),r=a.x-o.x,s=a.y-o.y,this.move({xDiff:r,yDiff:s})}}),W("Text",{constructor:function constructor(e){return null==e&&(e={}),this.x=e.x||0,this.y=e.y||0,this.v=e.v||0,this.text=e.text||"",this.color=e.color||"black",this.font=e.font||"18px sans-serif",this.forcedWidth=e.forcedWidth||null,this.forcedHeight=e.forcedHeight||null},_makeRenderer:function _makeRenderer(e){return e.lineHeight=1.2,this.renderer=new P(e,this.text,this.font,this.forcedWidth,this.forcedHeight),1>this.v?(console.log("repairing baseline"),this.v=1,this.x-=this.renderer.metrics.bounds.minx,this.y-=this.renderer.metrics.leading-this.renderer.metrics.descent):void 0},setText:function setText(e){return this.text=e,this.renderer=null},setFont:function setFont(e){return this.font=e,this.renderer=null},setPosition:function setPosition(o,t){return this.x=o,this.y=t},setSize:function setSize(o,t){return this.forcedWidth=Math.max(o,0),this.forcedHeight=Math.max(t,0),this.renderer=null},enforceMaxBoundingRect:function enforceMaxBoundingRect(o){var t,a,r;return t=this.getBoundingRect(o.ctx),r={x:-o.position.x/o.scale,y:-o.position.y/o.scale,width:o.canvas.width/o.scale,height:o.canvas.height/o.scale},t.x+t.width>r.x+r.width?(a=t.x-r.x,this.forcedWidth=r.width-a-10,this.renderer=null):void 0},getBoundingRect:function getBoundingRect(o,t){if(null==t&&(t=!1),!this.renderer){if(!o)throw"Must pass ctx if text hasn't been rendered yet";this._makeRenderer(o)}return{x:Math.floor(this.x),y:Math.floor(this.y),width:Math.ceil(this.renderer.getWidth(!0)),height:Math.ceil(this.renderer.getHeight())}},toJSON:function toJSON(){return{x:this.x,y:this.y,text:this.text,color:this.color,font:this.font,forcedWidth:this.forcedWidth,forcedHeight:this.forcedHeight,v:this.v}},fromJSON:function fromJSON(e){return z("Text",e)},move:function move(e){return null==e&&(e={}),this.x=this.x-e.xDiff,this.y=this.y-e.yDiff},setUpperLeft:function setUpperLeft(e){return null==e&&(e={}),this.x=e.x,this.y=e.y}}),W("SelectionBox",{constructor:function constructor(e){return null==e&&(e={}),this.shape=e.shape,null!=e.handleSize?this.handleSize=e.handleSize:this.handleSize=10,this.margin=4,this.backgroundColor=e.backgroundColor||null,this._br=this.shape.getBoundingRect(e.ctx)},toJSON:function toJSON(){return{shape:G(this.shape),backgroundColor:this.backgroundColor}},fromJSON:function fromJSON(a){var t,i,s,l;return l=a.shape,i=a.handleSize,s=a.margin,t=a.backgroundColor,z("SelectionBox",{shape:u(l),backgroundColor:t})},getTopLeftHandleRect:function getTopLeftHandleRect(){return{x:this._br.x-this.handleSize-this.margin,y:this._br.y-this.handleSize-this.margin,width:this.handleSize,height:this.handleSize}},getBottomLeftHandleRect:function getBottomLeftHandleRect(){return{x:this._br.x-this.handleSize-this.margin,y:this._br.y+this._br.height+this.margin,width:this.handleSize,height:this.handleSize}},getTopRightHandleRect:function getTopRightHandleRect(){return{x:this._br.x+this._br.width+this.margin,y:this._br.y-this.handleSize-this.margin,width:this.handleSize,height:this.handleSize}},getBottomRightHandleRect:function getBottomRightHandleRect(){return{x:this._br.x+this._br.width+this.margin,y:this._br.y+this._br.height+this.margin,width:this.handleSize,height:this.handleSize}},getBoundingRect:function getBoundingRect(){return{x:this._br.x-this.margin,y:this._br.y-this.margin,width:this._br.width+2*this.margin,height:this._br.height+2*this.margin}}}),t.exports={defineShape:W,createShape:z,JSONToShape:u,shapeToJSON:G}},{"./TextRenderer":6,"./canvasRenderer":9,"./lineEndCapShapes":12,"./svgRenderer":18,"./util":19}],18:[function(a,t){var e,l,n,p;l=a("./lineEndCapShapes"),p={},e=function(o,t){return p[o]=t},n=function(o,t){if(null==t&&(t={}),null==t.shouldIgnoreUnsupportedShapes&&(t.shouldIgnoreUnsupportedShapes=!1),p[o.className])return p[o.className](o);if(t.shouldIgnoreUnsupportedShapes)return console.warn("Can't render shape of type "+o.className+" to SVG"),"";throw"Can't render shape of type "+o.className+" to SVG"},e("Rectangle",function(l){var t,p,d,c,g,u,m,y;return c=l.x,m=l.y,g=l.x+l.width,y=l.y+l.height,d=Math.min(c,g),u=Math.min(m,y),p=Math.max(c,g)-d,t=Math.max(m,y)-u,0!=l.strokeWidth%2&&(d+=.5,u+=.5),""}),e("SelectionBox",function(){return""}),e("Ellipse",function(o){var t,a,s,l;return l=Math.floor(o.width/2),s=Math.floor(o.height/2),t=o.x+l,a=o.y+s,""}),e("Image",function(e){return""}),e("Line",function(r){var t,p,d,c,g,u,m;return d=r.dash?"stroke-dasharray='"+r.dash.join(", ")+"'":"",p="",t=Math.max(2.2*r.strokeWidth,5),c=r.x1,g=r.x2,u=r.y1,m=r.y2,0!=r.strokeWidth%2&&(c+=.5,g+=.5,u+=.5,m+=.5),r.endCapShapes[0]&&(p+=l[r.endCapShapes[0]].svg(c,u,Math.atan2(u-m,c-g),t,r.color)),r.endCapShapes[1]&&(p+=l[r.endCapShapes[1]].svg(g,m,Math.atan2(m-u,g-c),t,r.color))," "+p+" "}),e("LinePath",function(e){return""}),e("ErasedLinePath",function(){return""}),e("Polygon",function(e){return e.isClosed?"":" "}),e("Text",function(o){var t,a,r;return r=o.forcedWidth?"width='"+o.forcedWidth+"px'":"",t=o.forcedHeight?"height='"+o.forcedHeight+"px'":"",a=o.text.split(/\r\n|\r|\n/g),o.renderer&&(a=o.renderer.lines)," "+a.map(function(){return function(t,e){var a;return a=0===e?0:"1.2em"," "+t+" "}}(this)).join("")+" "}),t.exports={defineSVGRenderer:e,renderShapeToSVG:n}},{"./lineEndCapShapes":12}],19:[function(n,t){var e,l,p,d,c,h=[].slice;d=Array.prototype.slice,l=n("./canvasRenderer").renderShapeToContext,p=n("./svgRenderer").renderShapeToSVG,c=(e={addImageOnload:function addImageOnload(o,t){var e;return e=o.onload,o.onload=function(){return"function"==typeof e&&e(),t()},o},last:function last(o,t){return null==t&&(t=null),t?d.call(o,Math.max(o.length-t,0)):o[o.length-1]},classSet:function classSet(o){var t,a;t=[];for(a in o){o[a]&&t.push(a)}return t.join(" ")},matchElementSize:function matchElementSize(a,t,e,n){var o;return null==n&&(n=function(){}),o=function(){return function(){var i,l,p;for(l=0,p=t.length;p>l;l++){i=t[l],i.style.width=a.offsetWidth+"px",i.style.height=a.offsetHeight+"px",null!=i.width&&(i.setAttribute("width",i.offsetWidth*e),i.setAttribute("height",i.offsetHeight*e))}return n()}}(this),a.addEventListener("resize",o),window.addEventListener("resize",o),window.addEventListener("orientationchange",o),o(),o},combineCanvases:function combineCanvases(){var a,l,p,d,c,g,u,m;for(p=1<=arguments.length?h.call(arguments,0):[],a=document.createElement("canvas"),a.width=p[0].width,a.height=p[0].height,c=0,u=p.length;u>c;c++){l=p[c],a.width=Math.max(l.width,a.width),a.height=Math.max(l.height,a.height)}for(d=a.getContext("2d"),g=0,m=p.length;m>g;g++){l=p[g],d.drawImage(l,0,0)}return a},renderShapes:function renderShapes(i,t,e,p){var d,c,g,u;for(null==e&&(e=1),null==p&&(p=null),p=p||document.createElement("canvas"),p.width=t.width*e,p.height=t.height*e,d=p.getContext("2d"),d.translate(-t.x*e,-t.y*e),d.scale(e,e),c=0,g=i.length;g>c;c++){u=i[c],l(d,u)}return p},renderShapesToSVG:function renderShapesToSVG(r,t,e){var n,l,d,c;return d=t.x,c=t.y,l=t.width,n=t.height,(" "+r.map(p).join("")+" ").replace(/(\r\n|\n|\r)/gm,"")},getBoundingRect:function getBoundingRect(p,t,e){var n,d,c,g,u,m,y;if(!p.length)return{x:0,y:0,width:t,height:e};for(u=p[0].x,m=p[0].y,c=p[0].x+p[0].width,g=p[0].y+p[0].height,n=0,d=p.length;d>n;n++){y=p[n],u=Math.floor(Math.min(y.x,u)),m=Math.floor(Math.min(y.y,m)),c=Math.ceil(Math.max(c,y.x+y.width)),g=Math.ceil(Math.max(g,y.y+y.height))}return u=t?0:u,m=e?0:m,c=t||c,g=e||g,{x:u,y:m,width:c-u,height:g-m}},getDefaultImageRect:function getDefaultImageRect(a,t,s){var l,p,d;return null==t&&(t={width:0,height:0}),null==s&&(s={top:0,right:0,bottom:0,left:0}),d=t.width,l=t.height,p=c.getBoundingRect(a,"infinite"===d?0:d,"infinite"===l?0:l),p.x-=s.left,p.y-=s.top,p.width+=s.left+s.right,p.height+=s.top+s.bottom,p},getBackingScale:function getBackingScale(){return null==window.devicePixelRatio?1:1t;t++){d=l[t],p.push(M.JSONToShape(d))}return p},snapshotJSONToShapes:function snapshotJSONToShapes(e){return _.snapshotToShapes(JSON.parse(e))}},n=C("./tools/base"),G={Pencil:C("./tools/Pencil"),Eraser:C("./tools/Eraser"),Line:C("./tools/Line"),Rectangle:C("./tools/Rectangle"),Ellipse:C("./tools/Ellipse"),Text:C("./tools/Text"),Polygon:C("./tools/Polygon"),Pan:C("./tools/Pan"),Eyedropper:C("./tools/Eyedropper"),SelectShape:C("./tools/SelectShape"),Tool:n.Tool,ToolWithStroke:n.ToolWithStroke},T=I.tools,E=I.imageURLPrefix,A=function(e){return E=e,I.imageURLPrefix=e},z=function(t,e){var l,p,d,c,h;null==e&&(e={});for(c in I){c in e||(e[c]=I[c])}for(h=t.children,p=0,d=h.length;d>p;p++){l=h[p],t.removeChild(l)}return C("./reactGUI/initDOM")(t,e)},N=function(a,t){var e,l,p;return p=a.className,-1===[" "," "].join(a.className).indexOf(" literally ")&&(a.className=a.className+" literally"),a.className=a.className+" toolbar-hidden",e=document.createElement("div"),e.className="lc-drawing",a.appendChild(e),l=new P(e,t),l.teardown=function(){var t,o,r,d;for(l._teardown(),d=a.children,o=0,r=d.length;r>o;o++){t=d[o],a.removeChild(t)}return a.className=p},"onInit"in t&&t.onInit(l),l},B=function(e){return e.fn.literallycanvas=function(o){return null==o&&(o={}),this.each(function(){return function(t,e){return e.literallycanvas=z(e,o)}}(this)),this}},"undefined"!=typeof window&&(window.LC={init:z},window.$&&B(window.$)),t.exports={init:z,registerJQueryPlugin:B,util:H,tools:G,setDefaultImageURLPrefix:A,defaultTools:T,defineOptionsStyle:L,LiterallyCanvasReactComponent:e,defineShape:M.defineShape,createShape:M.createShape,JSONToShape:M.JSONToShape,shapeToJSON:M.shapeToJSON,defineCanvasRenderer:R.defineCanvasRenderer,renderShapeToContext:R.renderShapeToContext,renderShapeToCanvas:R.renderShapeToCanvas,renderShapesToCanvas:H.renderShapes,defineSVGRenderer:F.defineSVGRenderer,renderShapeToSVG:F.renderShapeToSVG,renderShapesToSVG:H.renderShapesToSVG,snapshotToShapes:_.snapshotToShapes,snapshotJSONToShapes:_.snapshotJSONToShapes,renderSnapshotToImage:D,renderSnapshotToSVG:U,localize:W}},{"./core/LiterallyCanvas":5,"./core/canvasRenderer":9,"./core/defaultOptions":10,"./core/localization":13,"./core/renderSnapshotToImage":15,"./core/renderSnapshotToSVG":16,"./core/shapes":17,"./core/svgRenderer":18,"./core/util":19,"./ie_customevent":20,"./ie_setLineDash":21,"./optionsStyles/font":23,"./optionsStyles/line-options-and-stroke-width":24,"./optionsStyles/null":25,"./optionsStyles/optionsStyles":26,"./optionsStyles/polygon-and-stroke-width":27,"./optionsStyles/stroke-or-fill":28,"./optionsStyles/stroke-width":29,"./reactGUI/LiterallyCanvas":32,"./reactGUI/initDOM":42,"./tools/Ellipse":43,"./tools/Eraser":44,"./tools/Eyedropper":45,"./tools/Line":46,"./tools/Pan":47,"./tools/Pencil":48,"./tools/Polygon":49,"./tools/Rectangle":50,"./tools/SelectShape":51,"./tools/Text":52,"./tools/base":53}],23:[function(n,t){var R,_,e,E,I,T,L,z,O,N,W,B,D,U,A,M,F,G,H,J,V,q,j;for(I=n("../reactGUI/React-shim"),O=n("./optionsStyles").defineOptionsStyle,z=n("../core/localization")._,T=[["Arial","Arial,\"Helvetica Neue\",Helvetica,sans-serif"],["Arial Black","\"Arial Black\",\"Arial Bold\",Gadget,sans-serif"],["Arial Narrow","\"Arial Narrow\",Arial,sans-serif"],["Gill Sans","\"Gill Sans\",\"Gill Sans MT\",Calibri,sans-serif"],["Helvetica","\"Helvetica Neue\",Helvetica,Arial,sans-serif"],["Impact","Impact,Haettenschweiler,\"Franklin Gothic Bold\",Charcoal,\"Helvetica Inserat\",\"Bitstream Vera Sans Bold\",\"Arial Black\",sans-serif"],["Tahoma","Tahoma,Verdana,Segoe,sans-serif"],["Trebuchet MS","\"Trebuchet MS\",\"Lucida Grande\",\"Lucida Sans Unicode\",\"Lucida Sans\",Tahoma,sans-serif"],["Verdana","Verdana,Geneva,sans-serif"]].map(function(o){var t,a;return t=o[0],a=o[1],{name:z(t),value:a}}),L=[["Baskerville","Baskerville,\"Baskerville Old Face\",\"Hoefler Text\",Garamond,\"Times New Roman\",serif"],["Garamond","Garamond,Baskerville,\"Baskerville Old Face\",\"Hoefler Text\",\"Times New Roman\",serif"],["Georgia","Georgia,Times,\"Times New Roman\",serif"],["Hoefler Text","\"Hoefler Text\",\"Baskerville Old Face\",Garamond,\"Times New Roman\",serif"],["Lucida Bright","\"Lucida Bright\",Georgia,serif"],["Palatino","Palatino,\"Palatino Linotype\",\"Palatino LT STD\",\"Book Antiqua\",Georgia,serif"],["Times New Roman","TimesNewRoman,\"Times New Roman\",Times,Baskerville,Georgia,serif"]].map(function(o){var t,a;return t=o[0],a=o[1],{name:z(t),value:a}}),e=[["Consolas/Monaco","Consolas,monaco,\"Lucida Console\",monospace"],["Courier New","\"Courier New\",Courier,\"Lucida Sans Typewriter\",\"Lucida Typewriter\",monospace"],["Lucida Sans Typewriter","\"Lucida Sans Typewriter\",\"Lucida Console\",monaco,\"Bitstream Vera Sans Mono\",monospace"]].map(function(o){var t,a;return t=o[0],a=o[1],{name:z(t),value:a}}),E=[["Copperplate","Copperplate,\"Copperplate Gothic Light\",fantasy"],["Papyrus","Papyrus,fantasy"],["Script","\"Brush Script MT\",cursive"]].map(function(o){var t,a;return t=o[0],a=o[1],{name:z(t),value:a}}),R=[[z("Sans Serif"),T],[z("Serif"),L],[z("Monospace"),e],[z("Other"),E]],_={},N=0,D=T.length;D>N;N++){H=T[N],G=H.name,j=H.value,_[G]=j}for(W=0,U=L.length;U>W;W++){J=L[W],G=J.name,j=J.value,_[G]=j}for(B=0,A=e.length;A>B;B++){V=e[B],G=V.name,j=V.value,_[G]=j}for(F=0,M=E.length;M>F;F++){q=E[F],G=q.name,j=q.value,_[G]=j}O("font",I.createClass({displayName:"FontOptions",getInitialState:function getInitialState(){return{isItalic:!1,isBold:!1,fontName:"Helvetica",fontSizeIndex:4}},getFontSizes:function getFontSizes(){return[9,10,12,14,18,24,36,48,64,72,96,144,288]},updateTool:function updateTool(o){var a,r,s;null==o&&(o={});for(s in this.state){s in o||(o[s]=this.state[s])}return a=this.getFontSizes()[o.fontSizeIndex],r=[],o.isItalic&&r.push("italic"),o.isBold&&r.push("bold"),r.push(a+"px"),r.push(_[o.fontName]),this.props.lc.tool.font=r.join(" "),this.props.lc.trigger("setFont",r.join(" "))},handleFontSize:function handleFontSize(o){var t;return t={fontSizeIndex:o.target.value},this.setState(t),this.updateTool(t)},handleFontFamily:function handleFontFamily(o){var t;return t={fontName:o.target.selectedOptions[0].innerHTML},this.setState(t),this.updateTool(t)},handleItalic:function handleItalic(){var t;return t={isItalic:!this.state.isItalic},this.setState(t),this.updateTool(t)},handleBold:function handleBold(){var t;return t={isBold:!this.state.isBold},this.setState(t),this.updateTool(t)},componentDidMount:function componentDidMount(){return this.updateTool()},render:function render(){var a,i,d,c,g,m,y,S,f,x;return g=this.props.lc,S=I.DOM,i=S.div,d=S.input,f=S.select,y=S.option,a=S.br,c=S.label,x=S.span,m=S.optgroup,i({className:"lc-font-settings"},f({value:this.state.fontSizeIndex,onChange:this.handleFontSize},this.getFontSizes().map(function(){return function(o,t){return y({value:t,key:t},o+"px")}}(this))),f({value:this.state.fontName,onChange:this.handleFontFamily},R.map(function(){return function(o){var t,a;return a=o[0],t=o[1],m({key:a,label:a},t.map(function(o,t){return y({value:o.name,key:t},o.name)}))}}(this))),x({},c({htmlFor:"italic"},z("italic")),d({type:"checkbox",id:"italic",checked:this.state.isItalic,onChange:this.handleItalic})),x({},c({htmlFor:"bold"},z("bold")),d({type:"checkbox",id:"bold",checked:this.state.isBold,onChange:this.handleBold})))}})),t.exports={}},{"../core/localization":13,"../reactGUI/React-shim":35,"./optionsStyles":26}],24:[function(n,t){var d,g,m,e,l;d=n("../reactGUI/React-shim"),l=n("./optionsStyles").defineOptionsStyle,g=d.createFactory(n("../reactGUI/StrokeWidthPicker")),e=n("../reactGUI/createSetStateOnEventMixin"),m=n("../core/util").classSet,l("line-options-and-stroke-width",d.createClass({displayName:"LineOptionsAndStrokeWidth",getState:function getState(){return{strokeWidth:this.props.tool.strokeWidth,isDashed:this.props.tool.isDashed,hasEndArrow:this.props.tool.hasEndArrow}},getInitialState:function getInitialState(){return this.getState()},mixins:[e("toolChange")],render:function render(){var o,r,i,y,S,f,x,k,b,C;return f=d.DOM,i=f.div,C=f.ul,S=f.li,y=f.img,k=function(e){return function(){return e.props.tool.isDashed=!e.props.tool.isDashed,e.setState(e.getState())}}(this),b=function(e){return function(){return e.props.tool.hasEndArrow=!e.props.tool.hasEndArrow,e.setState(e.getState())}}(this),r=m({"square-toolbar-button":!0,selected:this.state.isDashed}),o=m({"square-toolbar-button":!0,selected:this.state.hasEndArrow}),x={float:"left",margin:1},i({},i({className:r,onClick:k,style:x},y({src:this.props.imageURLPrefix+"/dashed-line.png"})),i({className:o,onClick:b,style:x},y({src:this.props.imageURLPrefix+"/line-with-arrow.png"})),g({tool:this.props.tool,lc:this.props.lc}))}})),t.exports={}},{"../core/util":19,"../reactGUI/React-shim":35,"../reactGUI/StrokeWidthPicker":37,"../reactGUI/createSetStateOnEventMixin":40,"./optionsStyles":26}],25:[function(o,t){var e,a;e=o("../reactGUI/React-shim"),a=o("./optionsStyles").defineOptionsStyle,a("null",e.createClass({displayName:"NoOptions",render:function render(){return e.DOM.div()}})),t.exports={}},{"../reactGUI/React-shim":35,"./optionsStyles":26}],26:[function(a,t){var n,e,s;n=a("../reactGUI/React-shim"),s={},e=function(o,t){return s[o]=n.createFactory(t)},t.exports={optionsStyles:s,defineOptionsStyle:e}},{"../reactGUI/React-shim":35}],27:[function(a,t){var p,d,e,n;p=a("../reactGUI/React-shim"),n=a("./optionsStyles").defineOptionsStyle,d=p.createFactory(a("../reactGUI/StrokeWidthPicker")),e=a("../reactGUI/createSetStateOnEventMixin"),n("polygon-and-stroke-width",p.createClass({displayName:"PolygonAndStrokeWidth",getState:function getState(){return{strokeWidth:this.props.tool.strokeWidth,inProgress:!1}},getInitialState:function getInitialState(){return this.getState()},mixins:[e("toolChange")],componentDidMount:function componentDidMount(){var o,a,s;return s=[],this.unsubscribe=function(){return function(){var o,a,n,l;for(l=[],a=0,n=s.length;n>a;a++){o=s[a],l.push(o())}return l}}(this),a=function(e){return function(){return e.state.inProgress?void 0:e.setState({inProgress:!0})}}(this),o=function(e){return function(){return e.setState({inProgress:!1})}}(this),s.push(this.props.lc.on("lc-polygon-started",a)),s.push(this.props.lc.on("lc-polygon-stopped",o))},componentWillUnmount:function componentWillUnmount(){return this.unsubscribe()},render:function render(){var r,i,c,g,u,m,y,S;return c=this.props.lc,S=p.DOM,r=S.div,i=S.img,m=function(){return function(){return c.trigger("lc-polygon-finishopen")}}(this),u=function(){return function(){return c.trigger("lc-polygon-finishclosed")}}(this),g=function(){return function(){return c.trigger("lc-polygon-cancel")}}(this),y={},this.state.inProgress||(y={display:"none"}),r({},r({className:"polygon-toolbar horz-toolbar",style:y},r({className:"square-toolbar-button",onClick:m},i({src:this.props.imageURLPrefix+"/polygon-open.png"})),r({className:"square-toolbar-button",onClick:u},i({src:this.props.imageURLPrefix+"/polygon-closed.png"})),r({className:"square-toolbar-button",onClick:g},i({src:this.props.imageURLPrefix+"/polygon-cancel.png"}))),r({},d({tool:this.props.tool,lc:this.props.lc})))}})),t.exports={}},{"../reactGUI/React-shim":35,"../reactGUI/StrokeWidthPicker":37,"../reactGUI/createSetStateOnEventMixin":40,"./optionsStyles":26}],28:[function(n,t){"use strict";var e=n("../reactGUI/React-shim"),i=n("./optionsStyles"),r=i.defineOptionsStyle,o=n("../reactGUI/createSetStateOnEventMixin"),s=n("../core/localization")._;r("stroke-or-fill",e.createClass({displayName:"StrokeOrFillPicker",getState:function getState(){return{strokeOrFill:"stroke"}},getInitialState:function getInitialState(){return this.getState()},mixins:[o("toolChange")],onChange:function onChange(e){"stroke-or-fill-stroke"==e.target.id?this.props.lc.tool.strokeOrFill="stroke":this.props.lc.tool.strokeOrFill="fill",this.setState(this.getState())},render:function render(){var o=this.props.lc;return e.createElement("form",null,e.createElement("span",null," ",s("Color to change:")," "),e.createElement("span",null,e.createElement("input",{type:"radio",name:"stroke-or-fill",value:"stroke",id:"stroke-or-fill-stroke",onChange:this.onChange,checked:"stroke"==o.tool.strokeOrFill}),e.createElement("label",{htmlFor:"stroke-or-fill-stroke",className:"label"}," ",s("stroke"))),e.createElement("span",null,e.createElement("input",{type:"radio",name:"stroke-or-fill",value:"fill",id:"stroke-or-fill-fill",onChange:this.onChange,checked:"fill"==o.tool.strokeOrFill}),e.createElement("label",{htmlFor:"stroke-or-fill-fill",className:"label"}," ",s("fill"))))}})),t.exports={}},{"../core/localization":13,"../reactGUI/React-shim":35,"../reactGUI/createSetStateOnEventMixin":40,"./optionsStyles":26}],29:[function(o,t){var e,a;a=o("./optionsStyles").defineOptionsStyle,e=o("../reactGUI/StrokeWidthPicker"),a("stroke-width",e),t.exports={}},{"../reactGUI/StrokeWidthPicker":37,"./optionsStyles":26}],30:[function(n,t){var e,l,p,d,c;l=n("./React-shim"),c=n("./createSetStateOnEventMixin"),p=n("../core/localization")._,d=n("../core/util").classSet,e=l.createClass({displayName:"ClearButton",getState:function getState(){return{isEnabled:this.props.lc.canUndo()}},getInitialState:function getInitialState(){return this.getState()},mixins:[c("drawingChange")],render:function render(){var o,a,r,s;return a=l.DOM.div,r=this.props.lc,o=d({"lc-clear":!0,"toolbar-button":!0,"fat-button":!0,disabled:!this.state.isEnabled}),s=r.canUndo()?function(){return function(){return r.clear()}}(this):function(){},a({className:o,onClick:s},p("Clear"))}}),t.exports=e},{"../core/localization":13,"../core/util":19,"./React-shim":35,"./createSetStateOnEventMixin":40}],31:[function(n,t){var m,e,g,y,S,x,k,b,C,w,v,P;y=n("./React-shim"),g=n("react-addons-pure-render-mixin"),v=n("../core/util"),k=v.classSet,P=v.requestAnimationFrame,x=v.cancelAnimationFrame,S=n("../core/localization")._,w=function(a){var o,s,l,p;return"transparent"===a?{hue:0,sat:0,light:0,alpha:0}:"hsla"!==(null!=a?a.substring(0,4):void 0)?null:(s=a.indexOf("("),p=a.indexOf(")"),l=a.substring(s+1,p-s+4),o=function(){var t,i,s,p;for(s=l.split(","),p=[],t=0,i=s.length;i>t;t++){a=s[t],p.push(a.trim())}return p}(),{hue:parseInt(o[0],10),sat:parseInt(o[1].substring(0,o[1].length-1),10),light:parseInt(o[2].substring(0,o[2].length-1),10),alpha:parseFloat(o[3])})},b=function(o){var t,a,s,l;return a=o.hue,l=o.sat,s=o.light,t=o.alpha,"hsla("+a+", "+l+"%, "+s+"%, "+t+")"},C=function(o){var t,a,r;return t=o.hue,r=o.sat,a=o.light,"hsl("+t+", "+r+"%, "+a+"%)"},m=y.createFactory(y.createClass({displayName:"ColorGrid",mixins:[g],render:function render(){var l;return(l=y.DOM.div)({},this.props.rows.map(function(c){return function(e,t){return l({className:"color-row",key:t,style:{width:20*e.length}},e.map(function(e,t){var n,i,g,m,y,S,f,x;return y=e.hue,f=e.sat,S=e.light,n=e.alpha,g=b(e),m="hsl("+y+", "+f+"%, "+S+"%)",i=k({"color-cell":!0,selected:c.props.selectedColor===g}),x=function(o){return c.props.onChange(e,g),o.stopPropagation(),o.preventDefault()},l({className:i,onTouchStart:x,onTouchMove:x,onClick:x,style:{backgroundColor:m},key:t})}))}}(this)))}})),e=y.createClass({displayName:"ColorWell",mixins:[g],getInitialState:function getInitialState(){var o,a;return o=this.props.lc.colors[this.props.colorName],a=w(o),null==a&&(a={}),null==a.alpha&&(a.alpha=1),null==a.sat&&(a.sat=100),null==a.hue&&(a.hue=0),null==a.light&&(a.light=50),{colorString:o,alpha:a.alpha,sat:0===a.sat?100:a.sat,isPickerVisible:!1,hsla:a}},componentDidMount:function componentDidMount(){return this.unsubscribe=this.props.lc.on(this.props.colorName+"ColorChange",function(o){return function(){var t;return t=o.props.lc.colors[o.props.colorName],o.setState({colorString:t}),o.setHSLAFromColorString(t)}}(this))},componentWillUnmount:function componentWillUnmount(){return this.unsubscribe()},setHSLAFromColorString:function setHSLAFromColorString(o){var t;return t=w(o),t?this.setState({hsla:t,alpha:t.alpha,sat:t.sat}):this.setState({hsla:null,alpha:1,sat:100})},closePicker:function closePicker(){return this.setState({isPickerVisible:!1})},togglePicker:function togglePicker(){var o,a;return o=!this.state.isPickerVisible,a=o&&0===this.state.sat,this.setHSLAFromColorString(this.state.colorString),this.setState({isPickerVisible:o,sat:a?100:this.state.sat})},setColor:function setColor(e){return this.setState({colorString:e}),this.setHSLAFromColorString(e),this.props.lc.setColor(this.props.colorName,e)},setAlpha:function setAlpha(o){var t;return this.setState({alpha:o}),this.state.hsla?(t=this.state.hsla,t.alpha=o,this.setState({hsla:t}),this.setColor(b(t))):void 0},setSat:function setSat(o){var t;if(this.setState({sat:o}),isNaN(o))throw"SAT";return this.state.hsla?(t=this.state.hsla,t.sat=o,this.setState({hsla:t}),this.setColor(b(t))):void 0},render:function render(){var o,a,r,s;return s=y.DOM,a=s.div,r=s.label,o=s.br,a({className:k({"color-well":!0,open:this.state.isPickerVisible}),onMouseLeave:this.closePicker,style:{float:"left",textAlign:"center"}},r({float:"left"},this.props.label),o({}),a({className:k({"color-well-color-container":!0,selected:this.state.isPickerVisible}),style:{backgroundColor:"white"},onClick:this.togglePicker},a({className:"color-well-checker color-well-checker-top-left"}),a({className:"color-well-checker color-well-checker-bottom-right",style:{left:"50%",top:"50%"}}),a({className:"color-well-color",style:{backgroundColor:this.state.colorString}}," ")),this.renderPicker())},renderPicker:function renderPicker(){var a,i,s,x,k,b,C,w,v,P,R,_,E,I;if(P=y.DOM,i=P.div,C=P.label,k=P.input,!this.state.isPickerVisible)return null;for(E=function(){return function(t){return i({className:"color-row label",key:t,style:{lineHeight:"20px",height:16}},t)}}(this),_=function(t){return function(){var e;return e=t.props.lc.opts.imageURLPrefix+"/checkerboard-8x8.png",i({className:"color-row",key:"color",style:{position:"relative",backgroundImage:"url("+e+")",backgroundRepeat:"repeat",height:24}},i({style:{position:"absolute",top:0,right:0,bottom:0,left:0,backgroundColor:t.state.colorString}}))}}(this),I=[],I.push(function(){var o,a;for(a=[],x=o=0;100>=o;x=o+=10){a.push({hue:0,sat:0,light:x,alpha:this.state.alpha})}return a}.call(this)),R=[0,30,60,90,120,150,180,210,240,270,300,330],b=0,w=R.length;w>b;b++){s=R[b],I.push(function(){var e,o;for(o=[],x=e=10;90>=e;x=e+=8){o.push({hue:s,sat:this.state.sat,light:x,alpha:this.state.alpha})}return o}.call(this))}return v=function(o){return function(t,e){return o.setColor(e)}}(this),i({className:"color-picker-popup"},_(),E(S("alpha")),k({type:"range",min:0,max:1,step:.01,value:this.state.alpha,onChange:function(o){return function(t){return o.setAlpha(parseFloat(t.target.value))}}(this)}),E(S("saturation")),k((a={type:"range",min:0,max:100,value:this.state.sat},_defineProperty(a,"max",100),_defineProperty(a,"onChange",function(o){return function(t){return o.setSat(parseInt(t.target.value,10))}}(this)),a)),m({rows:I,selectedColor:this.state.colorString,onChange:v}))}}),t.exports=e},{"../core/localization":13,"../core/util":19,"./React-shim":35,"react-addons-pure-render-mixin":2}],32:[function(n,t){"use strict";var g=n("../reactGUI/React-shim"),e=n("../reactGUI/ReactDOM-shim"),r=e.findDOMNode,o=n("../core/util"),i=o.classSet,a=n("./Picker"),h=n("./Options"),s=n("./createToolButton"),l=n("../core/LiterallyCanvas"),c=n("../core/defaultOptions");n("../optionsStyles/font"),n("../optionsStyles/stroke-width"),n("../optionsStyles/line-options-and-stroke-width"),n("../optionsStyles/polygon-and-stroke-width"),n("../optionsStyles/null");var p=g.createClass({displayName:"CanvasContainer",shouldComponentUpdate:function shouldComponentUpdate(){return!1},render:function render(){return g.createElement("div",{key:"literallycanvas",className:"lc-drawing with-gui"})}}),d=g.createClass({displayName:"LiterallyCanvas",getDefaultProps:function getDefaultProps(){return c},bindToModel:function bindToModel(){var e=r(this.canvas);this.props;this.lc.bindToElement(e),"function"==typeof this.lc.opts.onInit&&this.lc.opts.onInit(this.lc)},componentWillMount:function componentWillMount(){var o=this;this.lc||(this.props.lc?this.lc=this.props.lc:this.lc=new l(this.props),this.toolButtonComponents=this.lc.opts.tools.map(function(t){return s(new t(o.lc))}))},componentDidMount:function componentDidMount(){this.lc.isBound||this.bindToModel()},componentWillUnmount:function componentWillUnmount(){this.lc&&this.lc._teardown()},render:function render(){var l=this,t=this.lc,e=this.toolButtonComponents,n=(this.props,this.lc.opts),r=n.imageURLPrefix,o=n.toolbarPosition,s=i({"toolbar-at-top":"top"===o,"toolbar-at-bottom":"bottom"===o,"toolbar-hidden":"hidden"===o});return g.createElement("div",{className:"literally "+s},g.createElement(p,{ref:function ref(t){return l.canvas=t}}),g.createElement(a,{lc:t,toolButtonComponents:e,imageURLPrefix:r}),g.createElement(h,{lc:t,imageURLPrefix:r}))}});t.exports=d},{"../core/LiterallyCanvas":5,"../core/defaultOptions":10,"../core/util":19,"../optionsStyles/font":23,"../optionsStyles/line-options-and-stroke-width":24,"../optionsStyles/null":25,"../optionsStyles/polygon-and-stroke-width":27,"../optionsStyles/stroke-width":29,"../reactGUI/React-shim":35,"../reactGUI/ReactDOM-shim":36,"./Options":33,"./Picker":34,"./createToolButton":41}],33:[function(a,t){var e,n,l,p;n=a("./React-shim"),l=a("./createSetStateOnEventMixin"),p=a("../optionsStyles/optionsStyles").optionsStyles,e=n.createClass({displayName:"Options",getState:function getState(){var e;return{style:null!=(e=this.props.lc.tool)?e.optionsStyle:void 0,tool:this.props.lc.tool}},getInitialState:function getInitialState(){return this.getState()},mixins:[l("toolChange")],renderBody:function renderBody(){var e;return e=""+this.state.style,p[e]&&p[e]({lc:this.props.lc,tool:this.state.tool,imageURLPrefix:this.props.imageURLPrefix})},render:function render(){var e;return(e=n.DOM.div)({className:"lc-options horz-toolbar"},this.renderBody())}}),t.exports=e},{"../optionsStyles/optionsStyles":26,"./React-shim":35,"./createSetStateOnEventMixin":40}],34:[function(n,t){var p,d,g,e,u,m,y,S;u=n("./React-shim"),p=u.createFactory(n("./ClearButton")),m=u.createFactory(n("./UndoRedoButtons")),y=u.createFactory(n("./ZoomButtons")),S=n("../core/localization")._,g=u.createFactory(n("./ColorWell")),d=u.createFactory(u.createClass({displayName:"ColorPickers",render:function render(){var o,a;return a=this.props.lc,(o=u.DOM.div)({className:"lc-color-pickers"},g({lc:a,colorName:"primary",label:S("stroke")}),g({lc:a,colorName:"secondary",label:S("fill")}),g({lc:a,colorName:"background",label:S("bg")}))}})),e=u.createClass({displayName:"Picker",getInitialState:function getInitialState(){return{selectedToolIndex:0}},renderBody:function renderBody(){var a,l,c,r,i;return a=u.DOM.div,r=this.props,i=r.toolButtonComponents,c=r.lc,l=r.imageURLPrefix,a({className:"lc-picker-contents"},i.map(function(o){return function(e,t){return e({lc:c,imageURLPrefix:l,key:t,isSelected:t===o.state.selectedToolIndex,onSelect:function onSelect(a){return c.setTool(a),o.setState({selectedToolIndex:t})}})}}(this)),0!=i.length%2?a({className:"toolbar-button thin-button disabled"}):void 0,a({style:{position:"absolute",bottom:0,left:0,right:0}},d({lc:this.props.lc}),m({lc:c,imageURLPrefix:l}),y({lc:c,imageURLPrefix:l}),p({lc:c})))},render:function render(){var e;return(e=u.DOM.div)({className:"lc-picker"},this.renderBody())}}),t.exports=e},{"../core/localization":13,"./ClearButton":30,"./ColorWell":31,"./React-shim":35,"./UndoRedoButtons":38,"./ZoomButtons":39}],35:[function(o,t){var e;try{e=o("react")}catch(t){e=window.React}if(null==e)throw"Can't find React";t.exports=e},{react:"react"}],36:[function(o,t){var e;try{e=o("react-dom")}catch(t){e=window.ReactDOM}if(null==e)try{e=o("react")}catch(t){e=window.React}if(null==e)throw"Can't find ReactDOM";t.exports=e},{react:"react","react-dom":"react-dom"}],37:[function(a,t){var l,p,e;l=a("./React-shim"),e=a("../reactGUI/createSetStateOnEventMixin"),p=a("../core/util").classSet,t.exports=l.createClass({displayName:"StrokeWidthPicker",getState:function getState(e){return null==e&&(e=this.props.tool),{strokeWidth:e.strokeWidth}},getInitialState:function getInitialState(){return this.getState()},mixins:[e("toolDidUpdateOptions")],componentWillReceiveProps:function componentWillReceiveProps(e){return this.setState(this.getState(e.tool))},render:function render(){var r,d,i,c,g,u,m;return c=l.DOM,m=c.ul,i=c.li,u=c.svg,r=c.circle,d=c.div,g=this.props.lc.opts.strokeWidths,d({},g.map(function(e){return function(t){var o,a;return o=p({"square-toolbar-button":!0,selected:t===e.state.strokeWidth}),a=28,d({key:t},d({className:o,onClick:function onClick(){return e.props.lc.trigger("setStrokeWidth",t)}},u({width:a-2,height:a-2,viewPort:"0 0 "+t+" "+t,version:"1.1",xmlns:"http://www.w3.org/2000/svg"},r({cx:Math.ceil(a/2-1),cy:Math.ceil(a/2-1),r:t/2}))))}}(this)))}})},{"../core/util":19,"../reactGUI/createSetStateOnEventMixin":40,"./React-shim":35}],38:[function(n,t){var g,e,p,d,m,c,u;g=n("./React-shim"),c=n("./createSetStateOnEventMixin"),m=n("../core/util").classSet,u=function(a){return g.createClass({displayName:"undo"===a?"UndoButton":"RedoButton",getState:function getState(){return{isEnabled:function(){switch(!1){case"undo"!==a:return this.props.lc.canUndo();case"redo"!==a:return this.props.lc.canRedo();}}.call(this)}},getInitialState:function getInitialState(){return this.getState()},mixins:[c("drawingChange")],render:function render(){var t,i,y,S,f,x,k,b,C,w,v;return k=g.DOM,i=k.div,S=k.img,b=this.props,f=b.lc,y=b.imageURLPrefix,v="undo"===a?"Undo":"Redo",t="lc-"+a+" "+m({"toolbar-button":!0,"thin-button":!0,disabled:!this.state.isEnabled}),x=function(){switch(!1){case!!this.state.isEnabled:return function(){};case"undo"!==a:return function(){return f.undo()};case"redo"!==a:return function(){return f.redo()};}}.call(this),C=y+"/"+a+".png",w={backgroundImage:"url("+C+")"},i({className:t,onClick:x,title:v,style:w})}})},p=g.createFactory(u("undo")),e=g.createFactory(u("redo")),d=g.createClass({displayName:"UndoRedoButtons",render:function render(){var o;return(o=g.DOM.div)({className:"lc-undo-redo"},p(this.props),e(this.props))}}),t.exports=d},{"../core/util":19,"./React-shim":35,"./createSetStateOnEventMixin":40}],39:[function(n,t){var g,e,p,d,m,c,u;g=n("./React-shim"),c=n("./createSetStateOnEventMixin"),m=n("../core/util").classSet,u=function(a){return g.createClass({displayName:"in"===a?"ZoomInButton":"ZoomOutButton",getState:function getState(){return{isEnabled:function(){switch(!1){case"in"!==a:return this.props.lc.scalethis.props.lc.config.zoomMin;}}.call(this)}},getInitialState:function getInitialState(){return this.getState()},mixins:[c("zoom")],render:function render(){var t,i,y,S,f,x,k,b,C,w,v;return k=g.DOM,i=k.div,S=k.img,b=this.props,f=b.lc,y=b.imageURLPrefix,v="in"===a?"Zoom in":"Zoom out",t="lc-zoom-"+a+" "+m({"toolbar-button":!0,"thin-button":!0,disabled:!this.state.isEnabled}),x=function(){switch(!1){case!!this.state.isEnabled:return function(){};case"in"!==a:return function(){return f.zoom(f.config.zoomStep)};case"out"!==a:return function(){return f.zoom(-f.config.zoomStep)};}}.call(this),C=y+"/zoom-"+a+".png",w={backgroundImage:"url("+C+")"},i({className:t,onClick:x,title:v,style:w})}})},d=g.createFactory(u("out")),p=g.createFactory(u("in")),e=g.createClass({displayName:"ZoomButtons",render:function render(){var e;return(e=g.DOM.div)({className:"lc-zoom"},d(this.props),p(this.props))}}),t.exports=e},{"../core/util":19,"./React-shim":35,"./createSetStateOnEventMixin":40}],40:[function(o,t){var e,a;e=o("./React-shim"),t.exports=a=function(e){return{componentDidMount:function componentDidMount(){return this.unsubscribe=this.props.lc.on(e,function(e){return function(){return e.setState(e.getState())}}(this))},componentWillUnmount:function componentWillUnmount(){return this.unsubscribe()}}}},{"./React-shim":35}],41:[function(a,t){var g,m,y,e;g=a("./React-shim"),y=a("../core/util").classSet,m=a("../core/localization")._,e=function(o){var t,r;return t=o.name,r=o.iconName,g.createFactory(g.createClass({displayName:t,getDefaultProps:function getDefaultProps(){return{isSelected:!1,lc:null}},componentWillMount:function componentWillMount(){return this.props.isSelected?this.props.lc.setTool(o):void 0},render:function render(){var e,n,i,S,x,k,b,C,w;return b=g.DOM,n=b.div,S=b.img,C=this.props,i=C.imageURLPrefix,x=C.isSelected,k=C.onSelect,e=y({"lc-pick-tool":!0,"toolbar-button":!0,"thin-button":!0,selected:x}),w=i+"/"+r+".png",n({className:e,style:{backgroundImage:"url("+w+")"},onClick:function onClick(){return k(o)},title:m(t)})}}))},t.exports=e},{"../core/localization":13,"../core/util":19,"./React-shim":35}],42:[function(n,t){"use strict";function e(a,t){var p=a.className,n=new o(t);return r.render(l.createElement(s,{lc:n}),a),n.teardown=function(){n._teardown();for(var t=0;ta;a++){e=o[a],l.push(e())}return l}}(this),o.push(a.on("lc-pointerdown",function(t){return function(e){var o,n;return o=e.rawX,n=e.rawY,t.oldPosition=a.position,t.pointerStart={x:o,y:n}}}(this))),o.push(a.on("lc-pointerdrag",function(t){return function(e){var n,s,l;return s=e.rawX,l=e.rawY,n={x:(s-t.pointerStart.x)*a.backingScale,y:(l-t.pointerStart.y)*a.backingScale},a.setPan(t.oldPosition.x+n.x,t.oldPosition.y+n.y)}}(this)))},t.prototype.willBecomeInactive=function(){return this.unsubscribe()},t}(l)},{"../core/shapes":17,"./base":53}],48:[function(n,t){var e,l,p,d=function(o,t){function e(){this.constructor=o}for(var a in t){s.call(t,a)&&(o[a]=t[a])}return e.prototype=t.prototype,o.prototype=new e,o.__super__=t.prototype,o},s={}.hasOwnProperty;l=n("./base").ToolWithStroke,p=n("../core/shapes").createShape,t.exports=e=function(o){function t(){return t.__super__.constructor.apply(this,arguments)}return d(t,o),t.prototype.name="Pencil",t.prototype.iconName="pencil",t.prototype.eventTimeThreshold=10,t.prototype.begin=function(o,t,e){return this.color=e.getColor("primary"),this.currentShape=this.makeShape(),this.currentShape.addPoint(this.makePoint(o,t,e)),this.lastEventTime=Date.now()},t.prototype["continue"]=function(o,t,e){var a;return a=Date.now()-this.lastEventTime,a>this.eventTimeThreshold?(this.lastEventTime+=a,this.currentShape.addPoint(this.makePoint(o,t,e)),e.drawShapeInProgress(this.currentShape)):void 0},t.prototype.end=function(o,t,e){return e.saveShape(this.currentShape),this.currentShape=void 0},t.prototype.makePoint=function(o,t){return p("Point",{x:o,y:t,size:this.strokeWidth,color:this.color})},t.prototype.makeShape=function(){return p("LinePath")},t}(l)},{"../core/shapes":17,"./base":53}],49:[function(n,t){var e,l,p,d=function(o,t){function e(){this.constructor=o}for(var a in t){s.call(t,a)&&(o[a]=t[a])}return e.prototype=t.prototype,o.prototype=new e,o.__super__=t.prototype,o},s={}.hasOwnProperty;l=n("./base").ToolWithStroke,p=n("../core/shapes").createShape,t.exports=e=function(o){function l(){return l.__super__.constructor.apply(this,arguments)}return d(l,o),l.prototype.name="Polygon",l.prototype.iconName="polygon",l.prototype.usesSimpleAPI=!1,l.prototype.didBecomeActive=function(p){var e,t,d,c,g,u,m;return l.__super__.didBecomeActive.call(this,p),m=[],this.polygonUnsubscribe=function(){return function(){var o,a,r,s;for(s=[],a=0,r=m.length;r>a;a++){o=m[a],s.push(o())}return s}}(this),this.points=null,this.maybePoint=null,d=function(t){return function(){return t._getWillFinish()?t._close(p):(p.trigger("lc-polygon-started"),t.points?t.points.push(t.maybePoint):t.points=[t.maybePoint],t.maybePoint={x:t.maybePoint.x,y:t.maybePoint.y},p.setShapesInProgress(t._getShapes(p)),p.repaintLayer("main"))}}(this),t=function(t){return function(e){var o,a;return o=e.x,a=e.y,t.maybePoint?(t.maybePoint.x=o,t.maybePoint.y=a,p.setShapesInProgress(t._getShapes(p)),p.repaintLayer("main")):void 0}}(this),e=function(t){return function(e){var o,a;return o=e.x,a=e.y,t.maybePoint={x:o,y:a},p.setShapesInProgress(t._getShapes(p)),p.repaintLayer("main")}}(this),u=function(t){return function(){return t.maybePoint={x:1/0,y:1/0},t._close(p)}}(this),g=function(t){return function(){return t.maybePoint=t.points[0],t._close(p)}}(this),c=function(t){return function(){return t._cancel(p)}}(this),m.push(p.on("drawingChange",function(t){return function(){return t._cancel(p)}}(this))),m.push(p.on("lc-pointerdown",e)),m.push(p.on("lc-pointerdrag",t)),m.push(p.on("lc-pointermove",t)),m.push(p.on("lc-pointerup",d)),m.push(p.on("lc-polygon-finishopen",u)),m.push(p.on("lc-polygon-finishclosed",g)),m.push(p.on("lc-polygon-cancel",c))},l.prototype.willBecomeInactive=function(e){return l.__super__.willBecomeInactive.call(this,e),(this.points||this.maybePoint)&&this._cancel(e),this.polygonUnsubscribe()},l.prototype._getArePointsClose=function(o,t){return 10>Math.abs(o.x-t.x)+Math.abs(o.y-t.y)},l.prototype._getWillClose=function(){return this.points&&1a.length?null:(t&&this.maybePoint&&a.push(this.maybePoint),1a;a++){o=l[a],s.push(o())}return s}}(this),t=function(t){return function(e){var n,l,d,c;return d=e.x,c=e.y,t.didDrag=!1,l=t._getPixel(d,c,o,t.selectCtx),t.selectedShape=o.shapes[l],null!=t.selectedShape?(o.trigger("shapeSelected",{selectedShape:t.selectedShape}),o.setShapesInProgress([t.selectedShape,p("SelectionBox",{shape:t.selectedShape,handleSize:0})]),o.repaintLayer("main"),n=t.selectedShape.getBoundingRect(),t.dragOffset={x:d-n.x,y:c-n.y}):void 0}}(this),a=function(t){return function(e){var a,n;return a=e.x,n=e.y,null!=t.selectedShape?(t.didDrag=!0,t.selectedShape.setUpperLeft({x:a-t.dragOffset.x,y:n-t.dragOffset.y}),o.setShapesInProgress([t.selectedShape,p("SelectionBox",{shape:t.selectedShape,handleSize:0})]),o.repaintLayer("main")):void 0}}(this),s=function(t){return function(e){var a,n;return a=e.x,n=e.y,t.didDrag?(t.didDrag=!1,o.trigger("shapeMoved",{shape:t.selectedShape}),o.trigger("drawingChange",{}),o.repaintLayer("main"),t._drawSelectCanvas(o)):void 0}}(this),l.push(o.on("lc-pointerdown",t)),l.push(o.on("lc-pointerdrag",a)),l.push(o.on("lc-pointerup",s)),this._drawSelectCanvas(o)},t.prototype.willBecomeInactive=function(e){return this._selectShapeUnsubscribe(),e.setShapesInProgress([])},t.prototype._drawSelectCanvas=function(o){var t;return this.selectCanvas.width=o.canvas.width,this.selectCanvas.height=o.canvas.height,this.selectCtx.clearRect(0,0,this.selectCanvas.width,this.selectCanvas.height),t=o.shapes.map(function(o){return function(t,e){return p("SelectionBox",{shape:t,handleSize:0,backgroundColor:"#"+o._intToHex(e)})}}(this)),o.draw(t,this.selectCtx)},t.prototype._intToHex=function(e){return("000000"+e.toString(16)).slice(-6)},t.prototype._getPixel=function(a,t,e,n){var i,s;return i=e.drawingCoordsToClientCoords(a,t),s=n.getImageData(i.x,i.y,1,1).data,s[3]?parseInt(this._rgbToHex(s[0],s[1],s[2]),16):null},t.prototype._componentToHex=function(o){var t;return t=o.toString(16),("0"+t).slice(-2)},t.prototype._rgbToHex=function(o,t,e){return""+this._componentToHex(o)+this._componentToHex(t)+this._componentToHex(e)},t}(l)},{"../core/shapes":17,"./base":53}],52:[function(n,t){var e,l,p,d,c=function(o,t){function e(){this.constructor=o}for(var n in t){a.call(t,n)&&(o[n]=t[n])}return e.prototype=t.prototype,o.prototype=new e,o.__super__=t.prototype,o},a={}.hasOwnProperty;l=n("./base").Tool,p=n("../core/shapes").createShape,d=function(o,t){return o.xt.x+t.width?!1:!(o.y>t.y+t.height)},t.exports=e=function(o){function t(){this.text="",this.font="bold 18px sans-serif",this.currentShape=null,this.currentShapeState=null,this.initialShapeBoundingRect=null,this.dragAction=null,this.didDrag=!1}return c(t,o),t.prototype.name="Text",t.prototype.iconName="text",t.prototype.didBecomeActive=function(o){var t,a,r;return a=[],this.unsubscribe=function(){return function(){var o,n,s,l;for(l=[],n=0,s=a.length;s>n;n++){o=a[n],l.push(o())}return l}}(this),t=function(t){return function(){return t._ensureNotEditing(o),t._clearCurrentShape(o),o.repaintLayer("main")}}(this),r=function(t){return function(){return t._updateInputEl(o)}}(this),a.push(o.on("drawingChange",t)),a.push(o.on("zoom",r)),a.push(o.on("imageSizeChange",r)),a.push(o.on("snapshotLoad",function(t){return function(){return t._clearCurrentShape(o),o.repaintLayer("main")}}(this))),a.push(o.on("primaryColorChange",function(t){return function(e){return t.currentShape?(t.currentShape.color=e,t._updateInputEl(o),o.repaintLayer("main")):void 0}}(this))),a.push(o.on("setFont",function(t){return function(e){return t.currentShape?(t.font=e,t.currentShape.setFont(e),t._setShapesInProgress(o),t._updateInputEl(o),o.repaintLayer("main")):void 0}}(this)))},t.prototype.willBecomeInactive=function(e){return this.currentShape&&(this._ensureNotEditing(e),this.commit(e)),this.unsubscribe()},t.prototype.setText=function(e){return this.text=e},t.prototype._ensureNotEditing=function(e){return"editing"===this.currentShapeState?this._exitEditingState(e):void 0},t.prototype._clearCurrentShape=function(e){return this.currentShape=null,this.initialShapeBoundingRect=null,this.currentShapeState=null,e.setShapesInProgress([])},t.prototype.commit=function(e){return this.currentShape.text&&e.saveShape(this.currentShape),this._clearCurrentShape(e),e.repaintLayer("main")},t.prototype._getSelectionShape=function(o,t){return null==t&&(t=null),p("SelectionBox",{shape:this.currentShape,ctx:o,backgroundColor:t})},t.prototype._setShapesInProgress=function(e){switch(this.currentShapeState){case"selected":return e.setShapesInProgress([this._getSelectionShape(e.ctx),this.currentShape]);case"editing":return e.setShapesInProgress([this._getSelectionShape(e.ctx,"#fff")]);default:return e.setShapesInProgress([this.currentShape]);}},t.prototype.begin=function(o,t,e){var n,s,l,c;return this.dragAction="none",this.didDrag=!1,"selected"===this.currentShapeState||"editing"===this.currentShapeState?(n=this.currentShape.getBoundingRect(e.ctx),c=this._getSelectionShape(e.ctx),l=c.getBoundingRect(),s={x:o,y:t},d(s,n)&&(this.dragAction="move"),d(s,c.getBottomRightHandleRect())&&(this.dragAction="resizeBottomRight"),d(s,c.getTopLeftHandleRect())&&(this.dragAction="resizeTopLeft"),d(s,c.getBottomLeftHandleRect())&&(this.dragAction="resizeBottomLeft"),d(s,c.getTopRightHandleRect())&&(this.dragAction="resizeTopRight"),"none"===this.dragAction&&"editing"===this.currentShapeState&&(this.dragAction="stop-editing",this._exitEditingState(e))):(this.color=e.getColor("primary"),this.currentShape=p("Text",{x:o,y:t,text:this.text,color:this.color,font:this.font,v:1}),this.dragAction="place",this.currentShapeState="selected"),"none"===this.dragAction?void this.commit(e):(this.initialShapeBoundingRect=this.currentShape.getBoundingRect(e.ctx),this.dragOffset={x:o-this.initialShapeBoundingRect.x,y:t-this.initialShapeBoundingRect.y},this._setShapesInProgress(e),e.repaintLayer("main"))},t.prototype["continue"]=function(a,t,e){var n,s,l;if("none"!==this.dragAction){switch(n=this.initialShapeBoundingRect,l=n.x+n.width,s=n.y+n.height,this.dragAction){case"place":this.currentShape.x=a,this.currentShape.y=t,this.didDrag=!0;break;case"move":this.currentShape.x=a-this.dragOffset.x,this.currentShape.y=t-this.dragOffset.y,this.didDrag=!0;break;case"resizeBottomRight":this.currentShape.setSize(a-(this.dragOffset.x-this.initialShapeBoundingRect.width)-n.x,t-(this.dragOffset.y-this.initialShapeBoundingRect.height)-n.y);break;case"resizeTopLeft":this.currentShape.setSize(l-a+this.dragOffset.x,s-t+this.dragOffset.y),this.currentShape.setPosition(a-this.dragOffset.x,t-this.dragOffset.y);break;case"resizeBottomLeft":this.currentShape.setSize(l-a+this.dragOffset.x,t-(this.dragOffset.y-this.initialShapeBoundingRect.height)-n.y),this.currentShape.setPosition(a-this.dragOffset.x,this.currentShape.y);break;case"resizeTopRight":this.currentShape.setSize(a-(this.dragOffset.x-this.initialShapeBoundingRect.width)-n.x,s-t+this.dragOffset.y),this.currentShape.setPosition(this.currentShape.x,t-this.dragOffset.y);}return this._setShapesInProgress(e),e.repaintLayer("main"),this._updateInputEl(e)}},t.prototype.end=function(o,t,e){return this.currentShape?(this.currentShape.setSize(this.currentShape.forcedWidth,0),"selected"===this.currentShapeState&&("place"===this.dragAction||"move"===this.dragAction&&!this.didDrag)&&this._enterEditingState(e),this._setShapesInProgress(e),e.repaintLayer("main"),this._updateInputEl(e)):void 0},t.prototype._enterEditingState=function(o){var t;if(this.currentShapeState="editing",this.inputEl)throw"State error";return this.inputEl=document.createElement("textarea"),this.inputEl.className="text-tool-input",this.inputEl.style.position="absolute",this.inputEl.style.transformOrigin="0px 0px",this.inputEl.style.backgroundColor="transparent",this.inputEl.style.border="none",this.inputEl.style.outline="none",this.inputEl.style.margin="0",this.inputEl.style.padding="4px",this.inputEl.style.zIndex="1000",this.inputEl.style.overflow="hidden",this.inputEl.style.resize="none",this.inputEl.value=this.currentShape.text,this.inputEl.addEventListener("mousedown",function(e){return e.stopPropagation()}),this.inputEl.addEventListener("touchstart",function(e){return e.stopPropagation()}),t=function(t){return function(e){return t.currentShape.setText(e.target.value),t.currentShape.enforceMaxBoundingRect(o),t._setShapesInProgress(o),o.repaintLayer("main"),t._updateInputEl(o),e.stopPropagation()}}(this),this.inputEl.addEventListener("keydown",function(t){return function(){return t._updateInputEl(o,!0)}}(this)),this.inputEl.addEventListener("keyup",t),this.inputEl.addEventListener("change",t),this._updateInputEl(o),o.containerEl.appendChild(this.inputEl),this.inputEl.focus(),this._setShapesInProgress(o)},t.prototype._exitEditingState=function(e){return this.currentShapeState="selected",e.containerEl.removeChild(this.inputEl),this.inputEl=null,this._setShapesInProgress(e),e.repaintLayer("main")},t.prototype._updateInputEl=function(o,t){var a,r;return null==t&&(t=!1),this.inputEl?(a=this.currentShape.getBoundingRect(o.ctx,!0),this.inputEl.style.font=this.currentShape.font,this.inputEl.style.color=this.currentShape.color,this.inputEl.style.left=o.position.x/o.backingScale+a.x*o.scale-4+"px",this.inputEl.style.top=o.position.y/o.backingScale+a.y*o.scale-4+"px",t&&!this.currentShape.forcedWidth?this.inputEl.style.width=a.width+10+this.currentShape.renderer.emDashWidth+"px":this.inputEl.style.width=a.width+12+"px",t?this.inputEl.style.height=a.height+10+this.currentShape.renderer.metrics.leading+"px":this.inputEl.style.height=a.height+10+"px",r="scale("+o.scale+")",this.inputEl.style.transform=r,this.inputEl.style.webkitTransform=r,this.inputEl.style.MozTransform=r,this.inputEl.style.msTransform=r,this.inputEl.style.OTransform=r):void 0},t.prototype.optionsStyle="font",t}(l)},{"../core/shapes":17,"./base":53}],53:[function(n,t){var e,l,p,d=function(o,t){function e(){this.constructor=o}for(var a in t){s.call(t,a)&&(o[a]=t[a])}return e.prototype=t.prototype,o.prototype=new e,o.__super__=t.prototype,o},s={}.hasOwnProperty;p={},p.Tool=e=function(){function e(){}return e.prototype.name=null,e.prototype.iconName=null,e.prototype.usesSimpleAPI=!0,e.prototype.begin=function(){},e.prototype["continue"]=function(){},e.prototype.end=function(){},e.prototype.optionsStyle=null,e.prototype.didBecomeActive=function(){},e.prototype.willBecomeInactive=function(){},e}(),p.ToolWithStroke=l=function(o){function t(e){this.strokeWidth=e.opts.defaultStrokeWidth}return d(t,o),t.prototype.optionsStyle="stroke-width",t.prototype.didBecomeActive=function(o){var a;return a=[],this.unsubscribe=function(){return function(){var e,o,s,l;for(l=[],o=0,s=a.length;s>o;o++){e=a[o],l.push(e())}return l}}(this),a.push(o.on("setStrokeWidth",function(t){return function(e){return t.strokeWidth=e,o.trigger("toolDidUpdateOptions")}}(this)))},t.prototype.willBecomeInactive=function(){return this.unsubscribe()},t}(e),t.exports=p},{}]},{},[22])(22)}); +//# sourceMappingURL=literallycanvas.min.js.map diff --git a/amd/build/literallycanvas_amd.min.js b/amd/build/literallycanvas_amd.min.js index 22885d9f..e6b5126e 100644 --- a/amd/build/literallycanvas_amd.min.js +++ b/amd/build/literallycanvas_amd.min.js @@ -1 +1,2 @@ -define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/uploader","filter_poodll/react_amd","filter_poodll/literallycanvas"],function(a,b,c,d,e,f){"use strict";return b.debug("Filter PoodLL: literallycanvas.js initialising"),{instanceprops:[],loadliterallycanvas:function(b){var c="#amdopts_"+b.recorderid,e=a(c).get(0);e&&(b=JSON.parse(e.value),this.config=b,a(c).remove());var g="#"+b.recorderid+"_literally",h=a(g)[0],i=4,j=.2;if(b.whiteboardnozoom>0&&(i=1,j=1),b.backgroundimage){var k=a("#"+b.recorderid+"_separate-background-image")[0],l=new Image;l.src=k.src,l.crossOrigin="Anonymous";var m=f.createShape("Image",{x:0,y:0,image:l,scale:1}),n=f.init(h,{imageURLPrefix:b.imageurlprefix,backgroundColor:b.backgroundcolor,backgroundShapes:[m],recorderid:b.recorderid,zoomMax:i,zoomMin:j})}else var n=f.init(h,{imageURLPrefix:b.imageurlprefix,backgroundColor:b.backgroundcolor,recorderid:b.recorderid,zoomMax:i,zoomMin:j});b.lc=n;var o=b.vectordata;o&&(0!=o.indexOf('{"shapes"')&&0!=o.indexOf('{"colors"')||n.loadSnapshot(JSON.parse(o))),b.uploader=d.clone(),b.uploader.init(g,b),this.instanceprops[b.recorderid]=b,this.registerEvents(b.recorderid)},registerEvents:function(b){var d=this.instanceprops[b];d.autosave?d.lc.on("drawingChange",function(){var e=a("#"+b+"_messages")[0],f=a("#"+b+"_btn_upload_whiteboard")[0];if(e){f&&(f.disabled=!1),e.innerHTML="";var g=c.timeouthandles[b];g&&clearTimeout(g),c.timeouthandles[b]=setTimeout(function(){c.WhiteboardUploadHandler(b,d.lc,d,d.uploader)},d.autosave)}}):d.lc.on("drawingChange",function(){var c=a("#"+b+"_messages");c&&(c.innerHTML="File has not been saved.")});var e="#"+b+"_btn_upload_whiteboard",f=a(e);f&&(d.autosave?f.click(function(){c.WhiteboardUploadHandler(b,d.lc,d,d.uploader)}):f.click(function(){var a=c.getCvs(b,d.lc,d);c.pokeVectorData(b,d.lc,d),d.uploader.uploadFile(a.toDataURL(),"image")}))}}}); \ No newline at end of file +define ("filter_poodll/literallycanvas_amd",["jquery","core/log","filter_poodll/utils_amd","filter_poodll/uploader","filter_poodll/react_amd","filter_poodll/literallycanvas"],function(a,b,c,d,e,f){"use strict";b.debug("Filter PoodLL: literallycanvas.js initialising");return{instanceprops:[],loadliterallycanvas:function loadliterallycanvas(b){var c="#amdopts_"+b.recorderid,e=a(c).get(0);if(e){b=JSON.parse(e.value);this.config=b;a(c).remove()}var g="#"+b.recorderid+"_literally",h=a(g)[0],i=4,j=.2;if(0';return document.writeln(b),b},__dhtmlLoadLibrary:function(a){var b=document.createElement("script");return this.__setAttr(b,"type","text/javascript"),this.__setAttr(b,"src",a),document.getElementsByTagName("head")[0].appendChild(b),b},__getqueryurl:function(a,b){var c=a.split("?");if(a=c[0],1==c.length)return{url:a,flashvars:"",query:""};var d=this.__parseQuery(c[1]),e="",f="",g=new RegExp("\\+","g");for(var h in d)if(""!=h&&null!=h){var i=d[h];"lzr"!=h&&"lzt"!=h&&"debug"!=h&&"profile"!=h&&"lzbacktrace"!=h&&"lzconsoledebug"!=h&&"lzdebug"!=h&&"lzkrank"!=h&&"lzprofile"!=h&&"lzcopyresources"!=h&&"fb"!=h&&"sourcelocators"!=h&&"_canvas_debug"!=h&&"lzsourceannotations"!=h||(e+=h+"="+i+"&"),b&&null==window[h]&&(window[h]=unescape(i.replace(g," "))),f+=h+"="+i+"&"}return e=e.substr(0,e.length-1),f=f.substr(0,f.length-1),{url:a,flashvars:f,query:e}},__parseQuery:function(a){if(a.indexOf("=")!=-1){for(var b=a.split("&"),c={},d=0;d0;){var a=this._setCanvasAttributeQ.pop();this.setCanvasAttribute(a[0],a[1],a[2])}},_ready:function(a){if(this.loaded=!0,this._callmethod){for(var b=0;b1)return parseFloat(c[1])},searchOSVersion:function(a){var b=a.indexOf(this.osversionSearchString);if(b!=-1)return parseFloat(a.substring(b+this.osversionSearchString.length+1))},dataBrowser:[{string:navigator.userAgent,subString:"iPhone",identity:"iPhone",versionSearch:"WebKit"},{string:navigator.userAgent,subString:"Chrome",identity:"Chrome"},{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.vendor,subString:"Apple",identity:"Safari",versionSearch:"WebKit"},{prop:window.opera,identity:"Opera"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.userAgent,subString:"Iceweasel",versionSearch:"Iceweasel",identity:"Firefox"},{string:navigator.vendor,subString:"Camino",identity:"Camino"},{string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE",osversionSearch:"Windows NT"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],dataOS:[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.userAgent,subString:"iPhone",identity:"iPhone/iPod"},{string:navigator.platform,subString:"Linux",identity:"Linux"}]},_callMethodSWF:function(a){return this.loaded?lz.embed.dojo.comm[this._id].callMethod(a):(this._callmethod||(this._callmethod=[]),void this._callmethod.push(a))},_broadcastMethod:function(a){var b=[].slice.call(arguments,1);for(var c in lz.embed.applications){var d=lz.embed.applications[c];d[a]&&d[a].apply(d,b)}},setCanvasAttribute:function(a,b,c){lz.embed._broadcastMethod("setCanvasAttribute",a,b,c)},callMethod:function(a){lz.embed._broadcastMethod("callMethod",a)},_getAppendDiv:function(a,b){var c=b?b:a+"Container",d=document.getElementById(c);return d||(document.writeln('
'),d=document.getElementById(c)),d},_getSWFDiv:function(){return lz.embed.dojo.obj[this._id].get()},_sendMouseWheel:function(a){null!=a&&this.callMethod("lz.Keys.__mousewheelEvent("+a+")")},_gotFocus:function(){lz.embed._broadcastMethod("_sendAllKeysUp")},_sendAllKeysUpSWF:function(){this.callMethod("lz.Keys.__allKeysUp()")},_sendAllKeysUpDHTML:function(){lz.Keys&&lz.Keys.__allKeysUp&&lz.Keys.__allKeysUp()},_sendPercLoad:function(a){this.onloadstatus&&"function"==typeof this.onloadstatus&&this.onloadstatus(a)},attachEventHandler:function(a,b,c,d,e){if(c&&d&&"function"==typeof c[d]){var f=a+b+c+d,g=this._handlers[f];if(null!=g)if(g instanceof Array){for(var h=g.length-1;h>=0;--h)if(g[h].$e===a&&g[h].$c===c)return}else if(g.$e===a&&g.$c===c)return;var i=function(){var a=window.event?[window.event]:[].slice.call(arguments,0);e&&a.push(e),c[d].apply(c,a)};return i.$e=a,i.$c=c,null!=g?g instanceof Array?g.push(i):g=[g,i]:g=i,this._handlers[f]=g,a.addEventListener?(a.addEventListener(b,i,!1),!0):a.attachEvent?a.attachEvent("on"+b,i):void 0}},removeEventHandler:function(a,b,c,d){var e,f=a+b+c+d,g=this._handlers[f];if(null!=g)if(g instanceof Array)for(var h=g.length-1;h>=0;--h)g[h].$e===a&&g[h].$c===c&&(e=g[h],g.splice(h,1),0==g.length&&delete this._handlers[f]);else g.$e===a&&g.$c===c&&(e=g,delete this._handlers[f]);if(e)return a.removeEventListener?(a.removeEventListener(b,e,!1),!0):a.detachEvent?a.detachEvent("on"+b,e):void 0},_handlers:{},_cleanupHandlers:function(){lz.embed._handlers={}},getAbsolutePosition:function(a){var b,c=null,d={};if((!lz.embed.browser.isFirefox||a!=document.body)&&a.getBoundingClientRect){b=a.getBoundingClientRect();var e=document.documentElement.scrollTop||document.body.scrollTop,f=document.documentElement.scrollLeft||document.body.scrollLeft;return{x:Math.floor(b.left+f),y:Math.floor(b.top+e)}}if(document.getBoxObjectFor)b=document.getBoxObjectFor(a),d={x:b.x,y:b.y};else{if(d={x:a.offsetLeft,y:a.offsetTop},c=a.offsetParent,c!=a)for(;c;)d.x+=c.offsetLeft,d.y+=c.offsetTop,c=c.offsetParent;if(lz.embed.browser.isSafari&&document.defaultView&&document.defaultView.getComputedStyle)var g=document.defaultView.getComputedStyle(a,"");(lz.embed.browser.isOpera||lz.embed.browser.isSafari&&g&&"absolute"==g.position)&&(d.y-=document.body.offsetTop)}if(!a.parentNode)return d;for(c=a.parentNode;c&&"BODY"!=c.tagName&&"HTML"!=c.tagName;){if(d.x-=c.scrollLeft,d.y-=c.scrollTop,!c.parentNode)return d;c=c.parentNode}return d},CSSDimension:function(a,b){var c=a;if(isNaN(a)){if(a.indexOf("%")==a.length-1&&!isNaN(a.substring(0,a.length-1)))return a;c=0}else a===1/0?c=-1>>>1:a===-(1/0)&&(c=~(-1>>>1));return c+(b?b:"px")}},lz.embed.browser.init(),lz.embed.attachEventHandler(window,"beforeunload",lz.embed,"_cleanupHandlers"),lz.embed.attachEventHandler(window,"focus",lz.embed,"_gotFocus"),lz.embed.browser.isIE&&lz.embed.attachEventHandler(window,"activate",lz.embed,"_gotFocus");try{lzOptions&&(lzOptions.dhtmlKeyboardControl&&alert("WARNING: this page uses lzOptions.dhtmlKeyboardControl. Please use the cancelkeyboardcontrol embed argument for lz.embed.dhtml() instead."),lzOptions.ServerRoot&&alert("WARNING: this page uses lzOptions.ServerRoot. Please use the second argument of lz.embed.lfc() instead."))}catch(e){}return lz.embed.dojo=function(){},lz.embed.dojo={defaults:{flash8:null,ready:!1,visible:!0,width:500,height:400,bgcolor:"#ffffff",allowfullscreen:!1,wmode:"window",flashvars:"",minimumVersion:8,id:"flashObject",appenddiv:null},obj:{},comm:{},_loadedListeners:[],_loadedListenerScopes:[],_installingListeners:[],_installingListenerScopes:[],setSwf:function(a,b){if(null!=a){var c={};for(var d in this.defaults){var e=a[d];null!=e?c[d]=e:c[d]=this.defaults[d]}null!=b&&(this.minimumVersion=b),this._initialize(c)}},addLoadedListener:function(a,b){this._loadedListeners.push(a),this._loadedListenerScopes.push(b)},addInstallingListener:function(a,b){this._installingListeners.push(a),this._installingListenerScopes.push(b)},loaded:function(a){var b=lz.embed.dojo;if(b._isinstaller&&(top.location=top.location+""),b.info.installing=!1,b.ready=!0,b._loadedListeners.length>0)for(var c=0;c0)for(var b=0;b'),document.writeln("Function VBGetSwfVer(i)"),document.writeln(" on error resume next"),document.writeln(" Dim swControl, swVersion"),document.writeln(" swVersion = 0"),document.writeln(' set swControl = CreateObject("ShockwaveFlash.ShockwaveFlash." + CStr(i))'),document.writeln(" if (IsObject(swControl)) then"),document.writeln(' swVersion = swControl.GetVariable("$version")'),document.writeln(" end if"),document.writeln(" VBGetSwfVer = swVersion"),document.writeln("End Function"),document.writeln("")),this._detectVersion(),this._detectCommunicationVersion()},lz.embed.dojo.Info.prototype={version:-1,versionMajor:-1,versionMinor:-1,versionRevision:-1,capable:!1,commVersion:8,installing:!1,isVersionOrAbove:function(a,b,c){return c=parseFloat("."+c),this.versionMajor>=a&&this.versionMinor>=b&&this.versionRevision>=c},_detectVersion:function(){for(var a,b=lz.embed.browser.isIE,c=25;c>0;c--){if(a=b?VBGetSwfVer(c):this._JSFlashInfo(c),a==-1)return void(this.capable=!1);if(0!=a){var d;if(b){var e=a.split(" "),f=e[1];d=f.split(",")}else d=a.split(".");this.versionMajor=d[0],this.versionMinor=d[1],this.versionRevision=d[2];var g=this.versionMajor+"."+this.versionRevision;this.version=parseFloat(g),this.capable=!0;break}}},_JSFlashInfo:function(a){if(null!=navigator.plugins&&navigator.plugins.length>0&&(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"])){var b=navigator.plugins["Shockwave Flash 2.0"]?" 2.0":"",c=navigator.plugins["Shockwave Flash"+b].description,d=c.split(" "),e=d[2].split("."),f=e[0],g=e[1];if(""!=d[3])var h=d[3].split("r");else var h=d[4].split("r");var i=h[1]>0?h[1]:0,j=f+"."+g+"."+i;return j}return-1},_detectCommunicationVersion:function(){if(0==this.capable)return void(this.commVersion=null)}},lz.embed.dojo.Embed=function(a){this.properties=a,this.properties.width||(this.properties.width="100%"),this.properties.height||(this.properties.height="100%"),this.properties.bgcolor||(this.properties.bgcolor="#ffffff"),this.properties.visible||(this.properties.visible=!0)},lz.embed.dojo.Embed.prototype={protocol:function(){switch(window.location.protocol){case"https:":return"https";default:return"http"}},__getCSSValue:function(a){return a&&a.length&&a.indexOf("%")!=-1?"100%":a+"px"},write:function(a,b){var c="";c+="width: "+this.__getCSSValue(this.properties.width)+";",c+="height: "+this.__getCSSValue(this.properties.height)+";",0==this.properties.visible&&(c+="position: absolute; ",c+="z-index: 10000; ",c+="top: -1000px; ",c+="left: -1000px; ");var d,e,f=lz.embed;a>f.dojo.version&&(b=!0),e=this.properties.flash8;var g=this.properties.flashvars,h=this.properties.flashvars;if(b){var i=escape(window.location);document.title=document.title.slice(0,47)+" - Flash Player Installation";var j=escape(document.title);g+="&MMredirectURL="+i+"&MMplayerType=ActiveX&MMdoctitle="+j,h+="&MMredirectURL="+i+"&MMplayerType=PlugIn"}d=f.browser.isIE?' ':'';var k=this.properties.id+"Container",l=this.properties.appenddiv;l?(l.innerHTML=d,l.setAttribute("style",c)):(d='
'+d+"
",document.writeln(d))},get:function(){try{var a=document.getElementById(this.properties.id+"")}catch(b){}return a},setVisible:function(a){var b=document.getElementById(this.properties.id+"Container");1==a?b.style.visibility="visible":(b.style.position="absolute",b.style.x="-1000px",b.style.y="-1000px",b.style.visibility="hidden")},center:function(){var a=(this.properties.width,this.properties.height,0),b=0,c=document.getElementById(this.properties.id+"Container");c.style.top=b+"px",c.style.left=a+"px"}},lz.embed.dojo.Communicator=function(a){this._id=a},lz.embed.dojo.Communicator.prototype={_addExternalInterfaceCallback:function(a,b){var c=lz.embed.dojo,d=function(){for(var d=[],e=0;e","g"),">"),a=a.replace("\\","&custom_backslash;&custom_backslash;"),a=a.replace(RegExp("\\n","g"),"\\n"),a=a.replace(RegExp("\\r","g"),"\\r"),a=a.replace(RegExp("\\f","g"),"\\f"),a=a.replace(RegExp("\\0","g"),"\\0"),a=a.replace(RegExp("\\'","g"),"\\'"),a=a.replace(RegExp('\\"',"g"),'\\"')},_decodeData:function($1){return null==$1||"undefined"==typeof $1?$1:($1=$1.replace(RegExp("\\&custom_lt\\;","g"),"<"),$1=$1.replace(RegExp("\\&custom_gt\\;","g"),">"),$1=eval('"'+$1+'"'))},_chunkArgumentData:function(a,b,c){for(var d=lz.embed.dojo.obj[c].get(),e=Math.ceil(a.length/1024),f=0;f'+i+""+b+"")}},_chunkReturnData:function(a){for(var b=lz.embed.dojo.obj[a].get(),c=b.getReturnLength(),d=[],e=0;e'+e+"");f='""'==f||"''"==f?"":f.substring(1,f.length-1),d.push(f)}var g=d.join("");return g},_execFlash:function(a,b,c){var d=lz.embed.dojo.obj[c].get();d.startExec(),d.setNumberArguments(b.length);for(var e=0;ea.info.versionMajor||!a.info.isVersionOrAbove(8,0,0)))},install:function(){var a=lz.embed.dojo;a.info.installing=!0,a.installing();var b=a.obj[this._id].properties,c=b.flash8,d=c.indexOf("swf7");d!=-1&&(a._tempurl=c,c=c.substring(0,d+3)+"8"+c.substring(d+4,c.length),b.flash8=c);var d=c.indexOf("swf9");if(d!=-1&&(a._tempurl=c,c=c.substring(0,d+3)+"8"+c.substring(d+4,c.length),b.flash8=c),a.ready=!1,0==a.info.capable){a._isinstaller=!0;var e=new a.Embed(b);e.write(a.minimumVersion)}else if(a.info.isVersionOrAbove(6,0,65)){var e=new a.Embed(b);e.write(a.minimumVersion,!0),e.setVisible(!0),e.center()}else alert("This content requires a more recent version of the Macromedia Flash Player."),window.location="http://www.macromedia.com/go/getflashplayer"},_onInstallStatus:function(a){"Download.Complete"==a?lz.embed.browser.isIE&&(top.location=top.location+""):"Download.Cancelled"==a?(alert("This content requires a more recent version of the Macromedia Flash Player."),window.location="http://www.macromedia.com/go/getflashplayer"):"Download.Failed"==a&&(alert("There was an error downloading the Flash Player update. Please try again later, or visit macromedia.com to download the latest version of the Flash plugin."),window.location="http://www.macromedia.com/go/getflashplayer")}},lz.embed.dojo.info=new lz.embed.dojo.Info,lz.embed.iframemanager={__counter:0,__frames:{},__namebyid:{},__loading:{},__callqueue:{},__calljsqueue:{},__sendmouseevents:{},__hidenativecontextmenu:{},__selectionbookmarks:{},create:function(a,b,c,d,e,f){var g="__lz"+lz.embed.iframemanager.__counter++,h='javascript:""',i='lz.embed.iframemanager.__gotload("'+g+'")';if(null!=b&&"null"!=b&&""!=b||(b=g),lz.embed.iframemanager.__namebyid[g]=b,null!=d&&"undefined"!=d||(d=document.body),document.all){var j="";var m=document.createElement("div");lz.embed.__setAttr(m,"id",i+"Container");a.appendChild(m);m.innerHTML=l;var c=document.getElementById(i)}else{var c=document.createElement("iframe");lz.embed.__setAttr(c,"name",t);lz.embed.__setAttr(c,"src",o);lz.embed.__setAttr(c,"id",i);lz.embed.__setAttr(c,"onload",d);if(!0!=n){lz.embed.__setAttr(c,"scrolling","no")}this.appendTo(c,a)}if(c){this.__finishCreate(i,e,t,n,a,r,s)}else{this.__callqueue[i]=[["__finishCreate",i,e,t,n,a,r,s]];setTimeout("lz.embed.iframemanager.__checkiframe(\""+i+"\")",10)}return i+""},__checkiframe:function __checkiframe(e){var t=document.getElementById(e);if(t){var n=lz.embed.iframemanager.__callqueue[e];delete lz.embed.iframemanager.__callqueue[e];lz.embed.iframemanager.__playQueue(n)}else{setTimeout("lz.embed.iframemanager.__checkiframe(\""+e+"\")",10)}},__playQueue:function __playQueue(e){for(var t=lz.embed.iframemanager,n=0;nlz.embed.browser.version){if(""==top.location.search){lz.embed.history._form.action=t;top.document.location.lzaddr.history=lz.embed.history._history.toString();lz.embed.history._skip=!0;lz.embed.history._form.submit();lz.embed.history._skip=!1}}else{var a=document.createEvent("MouseEvents");a.initEvent("click",!0,!0);var r=document.createElement("a");r.href=t;r.dispatchEvent(a)}}else{top.location.hash=t;lz.embed.history._parse(e+"")}}return!0},get:function get(){var e="";if(lz.embed.browser.isIE){if(lz.embed.history._iframe){var t=lz.embed.history._iframe.contentDocument||lz.embed.history._iframe.contentWindow.document;e=t.location.hash}}else{e=top.location.href}var n=e.indexOf("#");if(-1!=n){return e.substring(n+1)}return""},_parse:function _parse(e){var t=lz.embed.history;if(0==e.length){return}for(var n=0,a=lz.embed.history._apps.length,r;n'},test:function(){console.log(c.init())},fetch_dialogue_box:function(a){return'

Poodll Dialogue box

'}}}); \ No newline at end of file +define ("filter_poodll/modal_dialogue",["jquery","core/log","filter_poodll/dlg_devicesettings"],function(a,b,c){"use strict";b.debug("Modal Progress: initialising");return{init:function init(){},fetch_icon:function fetch_icon(a){return"
"},test:function test(){console.log(c.init())},fetch_dialogue_box:function fetch_dialogue_box(a){return"

Poodll Dialogue box

"}}}); +//# sourceMappingURL=modal_dialogue.min.js.map diff --git a/amd/build/msr_helper_stereoaudio.min.js b/amd/build/msr_helper_stereoaudio.min.js index 58ec8baf..b8355f25 100644 --- a/amd/build/msr_helper_stereoaudio.min.js +++ b/amd/build/msr_helper_stereoaudio.min.js @@ -1 +1,2 @@ -define(["jquery","core/log"],function(a,b){"use strict";return b.debug("PoodLL Stereo Audio Recorder Helper: initialising"),{scriptprocessornode:null,requestDataInvoked:!1,recordingLength:0,isPaused:!1,deviceSampleRate:48e3,leftchannel:[],rightchannel:[],recording:!1,volume:null,audioInput:null,context:null,sampleRate:0,mimeType:0,isPCM:!1,numChannels:1,msr:null,audioctx:null,mediaStream:null,volumeGainNode:null,clone:function(){return a.extend(!0,{},this)},init:function(a,b,c){this.msr=a,this.audioctx=c,this.mediaStream=b,this.deviceSampleRate=c.sampleRate,this.sampleRate=a.sampleRate||this.deviceSampleRate,this.mimeType=a.mimeType||"audio/wav",this.isPCM=this.mimeType.indexOf("audio/pcm")>-1,this.numChannels=a.audioChannels||2,this.misc()},misc:function(){var a=this,b=this.audioctx;this.volumeGainNode=b.createGain();var c=this.volumeGainNode;this.audioInput=b.createMediaStreamSource(this.mediaStream);var d=this.audioInput;d.connect(c);var e=this.msr.bufferSize||2048;0===this.msr.bufferSize&&(e=0);var f=null;if(b.createJavaScriptNode)f=b.createJavaScriptNode(e,this.numChannels,this.numChannels);else{if(!b.createScriptProcessor)throw"WebAudio API has no support on this browser.";f=b.createScriptProcessor(e,this.numChannels,this.numChannels)}this.bufferSize=f.bufferSize,this.requestDataInvoked=!1,this.scriptprocessornode=f,1===this.numChannels&&console.debug("All right-channels are skipped."),this.isPaused=!1,f.onaudioprocess=function(b){if(a.recording&&!a.requestDataInvoked&&!a.isPaused){var c=b.inputBuffer.getChannelData(0);if(a.leftchannel.push(new Float32Array(c)),2===a.numChannels){var d=b.inputBuffer.getChannelData(1);a.rightchannel.push(new Float32Array(d))}a.recordingLength+=a.bufferSize}},c.connect(this.msr.audioanalyser.core),this.msr.audioanalyser.core.connect(f),f.connect(b.destination)},record:function(){this.recording=!0,this.leftchannel.length=this.rightchannel.length=0,this.recordingLength=0},requestData:function(){if(!this.isPaused){if(0===this.recordingLength)return void(this.requestDataInvoked=!1);this.requestDataInvoked=!0;var a=this.leftchannel.slice(0),b=this.rightchannel.slice(0),c=this.recordingLength;this.leftchannel.length=this.rightchannel.length=[],this.recordingLength=0,this.requestDataInvoked=!1;var d=this.mergeBuffers(a,c),e=d;if(2===this.numChannels){var f=this.mergeBuffers(b,c);this.interleaved=this.interleave(d,f)}if(this.isPCM){var g=new Blob([this.convertoFloat32ToInt16(e)],{type:"audio/pcm"});return void this.msr.ondataavailable(g)}var h=new ArrayBuffer(44+2*e.length),i=new DataView(h);this.writeUTFBytes(i,0,"RIFF"),i.setUint32(4,44+2*e.length-8,!0),this.writeUTFBytes(i,8,"WAVE"),this.writeUTFBytes(i,12,"fmt "),i.setUint32(16,16,!0),i.setUint16(20,1,!0),i.setUint16(22,this.numChannels,!0),i.setUint32(24,this.sampleRate,!0),i.setUint32(28,this.sampleRate*this.numChannels*2,!0),i.setUint16(32,2*this.numChannels,!0),i.setUint16(34,16,!0),this.writeUTFBytes(i,36,"data"),i.setUint32(40,2*e.length,!0);for(var j=e.length,k=44,l=1,m=0;m .poodll_save-recording").hide(),a("#"+b+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(a){},fetch_status_bar:function(a){var b='
00:00:00
';return b},fetch_preview_audio:function(a){var b='';return b},fetch_preview_video:function(a){var b='';return b},fetch_resource_audio:function(a){var b='';return b},fetch_resource_video:function(a){var b='';return b},fetch_uploader_skin:function(a,b){var c=this.fetch_instanceprops(a),d=g.clone();return d.init(c.config,b,c.controlbar.progresscanvas,c.controlbar.timer),d},onMediaError:function(a){console.error("media error",a)},onMediaSuccess_video:function(a){var b=this.fetch_instanceprops(a);b.uploader.Output(""),this.set_visual_mode("recordmode",a),b.controlbar.preview.attr("src",null),b.timer.reset(),b.timer.start(),this.update_status(a)},onMediaSuccess_audio:function(a){var b=this.fetch_instanceprops(a);b.uploader.Output(""),this.set_visual_mode("recordmode",a),b.timer.reset(),b.timer.start(),this.update_status(a)},handle_timer_update:function(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time()),0==b.timer.seconds&&b.timer.initseconds>0&&b.controlbar.stopbutton.click()},update_status:function(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time())},set_visual_mode:function(a,b){var c=this,d=this.fetch_instanceprops(b);switch(a){case"recordmode":d.controlbar.progress.hide(),c.disable_button(d.controlbar.startbutton),c.disable_button(d.controlbar.playbutton),d.controlbar.resumebutton.hide(),c.enable_button(d.controlbar.stopbutton),c.disable_button(d.controlbar.savebutton),d.controlbar.pausebutton.show(),c.enable_button(d.controlbar.pausebutton),d.controlbar.preview.addClass("poodll_recording"),d.controlbar.status.addClass("poodll_recording"),"audio"==d.config.mediatype&&d.controlbar.preview.hide(),d.controlbar.status.show();break;case"playingmode":c.disable_button(d.controlbar.playbutton),c.enable_button(d.controlbar.stopbutton),c.disable_button(d.controlbar.startbutton),c.disable_button(d.controlbar.savebutton),d.controlbar.progresscanvas.show();break;case"previewmode":c.enable_button(d.controlbar.playbutton),c.disable_button(d.controlbar.pausebutton),c.disable_button(d.controlbar.stopbutton),c.uploaded||(c.enable_button(d.controlbar.startbutton),c.enable_button(d.controlbar.savebutton)),d.controlbar.resumebutton.hide(),d.controlbar.pausebutton.show(),d.controlbar.preview.removeClass("poodll_recording"),d.controlbar.status.removeClass("poodll_recording"),d.controlbar.timer.html("00:00:00"),d.controlbar.progress.show(),d.controlbar.progresscanvas.hide(),d.controlbar.status.hide();break;case"pausedmode":c.enable_button(d.controlbar.resumebutton),c.enable_button(d.controlbar.savebutton),d.controlbar.preview.removeClass("poodll_recording"),d.controlbar.status.removeClass("poodll_recording");break;case"uploadingmode":c.disable_button(d.controlbar.startbutton),d.controlbar.progresscanvas.show()}},insert_controlbar_video:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"video");return e},insert_controlbar_audio:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"audio");return e},prepare_controlbar:function(b,c,d,e,f){var g=this.fetch_instanceprops(c),h=g.config.media_skin_style,i="video"==f?"poodll_mediarecorder_video":"poodll_mediarecorder_audio",j="poodll_mediarecorder_size_auto";switch(g.config.size){case"small":j="poodll_mediarecorder_size_small";break;case"big":j="poodll_mediarecorder_size_big";break;case"auto":j="poodll_mediarecorder_size_auto"}var k=this.pmr.fetch_strings(),l=g.showupload?"inline-block":"none",m='
';m+='
',m+=this.devsettings.fetch_dialogue_box(),m+=g.downloaddialog.fetch_dialogue_box(),m+=g.errordialog.fetch_dialogue_box(),m+='
';var n=this.fetch_status_bar("standard");m+=n,m+='
',m+='
',m+='',m+="
",m+=d,m+='
',m+='",m+='",m+='",m+=' ",m+=' ",m+='",m+="
",m+="
",m+="
",a(b).prepend(m);var o={settingsdialog:a("#"+c+" .poodll_dialogue_box_settings"),downloaddialog:a("#"+c+" .poodll_dialogue_box_download"),errorsdialog:a("#"+c+" .poodll_dialogue_box_errors"),settingsicon:a("#"+c+" .settingsicon"),progresscanvas:a("#"+c+" .hp_range"),progress:a("#"+c+" .hp_slide"),timer:a("#"+c+" .hp_timer"),status:a("#"+c+" .poodll_status_standard"),preview:a("#"+c+" .poodll_preview_standard"),startbutton:a("#"+c+" .poodll_start-recording_standard"),stopbutton:a("#"+c+" .poodll_stop-recording_standard"),pausebutton:a("#"+c+" .poodll_pause-recording_standard"),resumebutton:a("#"+c+" .poodll_resume-recording_standard"),playbutton:a("#"+c+" .poodll_play-recording_standard"),savebutton:a("#"+c+" .poodll_save-recording_standard")};return g.downloaddialog.set_dialogue_box(o.downloaddialog),g.errordialog.set_dialogue_box(o.errorsdialog),this.devsettings.set_dialogue_box(o.settingsdialog),o},register_controlbar_events_video:function(a,b){return this.register_controlbar_events_audio(a,b)},register_controlbar_events_audio:function(b,c){var d=this,e=this.pmr,g=this.fetch_instanceprops(c),h=f.clone();h.init(g.controlbar.progresscanvas),g.controlbar.settingsicon.click(function(){d.uploaded?g.downloaddialog.open():d.devsettings.open()}),g.controlbar.startbutton.click(function(){e.do_start_audio(g,b)}),g.controlbar.stopbutton.click(function(){var a=g.controlbar.preview;a&&a.get(0)&&a.get(0).pause(),e.do_stop_audio(g),g.timer.stop(),g.timer.reset(),d.update_status(c),h.stop(),d.set_visual_mode("previewmode",c)}),g.controlbar.pausebutton.click(function(){this.disabled=!0,a(this).hide(),g.controlbar.resumebutton.show(),e.do_pause_audio(g),g.timer.pause(),d.update_status(c),d.set_visual_mode("pausedmode",c)}),g.controlbar.resumebutton.click(function(){e.do_resume_audio(g),g.timer.resume(),d.update_status(c),d.set_visual_mode("recordmode",c)}),g.controlbar.playbutton.click(function(){g.controlbar.preview.on("timeupdate",function(){if(!this.paused){var a=this.currentTime;g.controlbar.timer.html(g.timer.fetch_display_time(a))}});var a=g.controlbar.preview.get(0);e.do_play_audio(g,a),d.set_visual_mode("playingmode",c),h.clear(),h.fetchCurrent=function(){var a=g.controlbar.preview.prop("currentTime"),b=g.controlbar.preview.prop("duration");return isFinite(b)||(b=g.timer.finalseconds),a/b},h.start()}),g.controlbar.savebutton.click(function(){return d.disable_button(this),g.blobs&&g.blobs.length>0?(e.do_save_audio(g),d.uploaded=!0,d.set_visual_mode("uploadingmode",c)):g.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll")),!1}),window.onbeforeunload=function(){d.enable_button(g.controlbar.startbutton);var a=g.controlbar.preview;a&&a.get(0)&&a.get(0).pause()}},enable_button:function(b){a(b).attr("disabled",!1),a(b).removeClass("pmr_disabled")},disable_button:function(b){a(b).attr("disabled",!0),a(b).addClass("pmr_disabled")}}}); \ No newline at end of file +define ("filter_poodll/poodll_basemediaskin",["jquery","jqueryui","core/log","filter_poodll/utils_amd","filter_poodll/dlg_devicesettings","filter_poodll/anim_progress_bar","filter_poodll/upskin_bar"],function(a,b,c,d,e,f,g){"use strict";c.debug("PoodLL Base Skin: initialising");return{instanceprops:null,pmr:null,uploaded:!1,devsettings:null,clone:function clone(){return a.extend(!0,{},this)},init:function init(a,b){this.instanceprops=a;this.pmr=b;this.devsettings=e.clone();this.devsettings.init(b,a)},fetch_instanceprops:function fetch_instanceprops(){return this.instanceprops},onUploadSuccess:function onUploadSuccess(b){a("#"+b+" > .poodll_save-recording").hide();a("#"+b+" > .poodll_savedsuccessfully").show()},onUploadFailure:function onUploadFailure(){},fetch_status_bar:function fetch_status_bar(a){return"
00:00:00
"},fetch_preview_audio:function fetch_preview_audio(a){return""},fetch_preview_video:function fetch_preview_video(a){return""},fetch_resource_audio:function fetch_resource_audio(a){return""},fetch_resource_video:function fetch_resource_video(a){return""},fetch_uploader_skin:function fetch_uploader_skin(a,b){var c=this.fetch_instanceprops(a),d=g.clone();d.init(c.config,b,c.controlbar.progresscanvas,c.controlbar.timer);return d},onMediaError:function onMediaError(a){console.error("media error",a)},onMediaSuccess_video:function onMediaSuccess_video(a){var b=this.fetch_instanceprops(a);b.uploader.Output("");this.set_visual_mode("recordmode",a);b.controlbar.preview.attr("src",null);b.timer.reset();b.timer.start();this.update_status(a)},onMediaSuccess_audio:function onMediaSuccess_audio(a){var b=this.fetch_instanceprops(a);b.uploader.Output("");this.set_visual_mode("recordmode",a);b.timer.reset();b.timer.start();this.update_status(a)},handle_timer_update:function handle_timer_update(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time());if(0==b.timer.seconds&&0";m+="
";m+=this.devsettings.fetch_dialogue_box();m+=g.downloaddialog.fetch_dialogue_box();m+=g.errordialog.fetch_dialogue_box();m+="
";var n=this.fetch_status_bar("standard");m+=n;m+="
";m+="
";m+="";m+="
";m+=d,m+="
";m+="";m+="";m+="";m+=" ";m+=" ";m+="";m+="
";m+="
";m+="";a(b).prepend(m);var o={settingsdialog:a("#"+c+" .poodll_dialogue_box_settings"),downloaddialog:a("#"+c+" .poodll_dialogue_box_download"),errorsdialog:a("#"+c+" .poodll_dialogue_box_errors"),settingsicon:a("#"+c+" .settingsicon"),progresscanvas:a("#"+c+" .hp_range"),progress:a("#"+c+" .hp_slide"),timer:a("#"+c+" .hp_timer"),status:a("#"+c+" .poodll_status_standard"),preview:a("#"+c+" .poodll_preview_standard"),startbutton:a("#"+c+" .poodll_start-recording_standard"),stopbutton:a("#"+c+" .poodll_stop-recording_standard"),pausebutton:a("#"+c+" .poodll_pause-recording_standard"),resumebutton:a("#"+c+" .poodll_resume-recording_standard"),playbutton:a("#"+c+" .poodll_play-recording_standard"),savebutton:a("#"+c+" .poodll_save-recording_standard")};g.downloaddialog.set_dialogue_box(o.downloaddialog);g.errordialog.set_dialogue_box(o.errorsdialog);this.devsettings.set_dialogue_box(o.settingsdialog);return o},register_controlbar_events_video:function register_controlbar_events_video(a,b){return this.register_controlbar_events_audio(a,b)},register_controlbar_events_audio:function register_controlbar_events_audio(b,c){var d=this,e=this.pmr,g=this.fetch_instanceprops(c),h=f.clone();h.init(g.controlbar.progresscanvas);g.controlbar.settingsicon.click(function(){if(!d.uploaded){d.devsettings.open()}else{g.downloaddialog.open()}});g.controlbar.startbutton.click(function(){e.do_start_audio(g,b)});g.controlbar.stopbutton.click(function(){var a=g.controlbar.preview;if(a&&a.get(0)){a.get(0).pause()}e.do_stop_audio(g);g.timer.stop();g.timer.reset();d.update_status(c);h.stop();d.set_visual_mode("previewmode",c)});g.controlbar.pausebutton.click(function(){this.disabled=!0;a(this).hide();g.controlbar.resumebutton.show();e.do_pause_audio(g);g.timer.pause();d.update_status(c);d.set_visual_mode("pausedmode",c)});g.controlbar.resumebutton.click(function(){e.do_resume_audio(g);g.timer.resume();d.update_status(c);d.set_visual_mode("recordmode",c)});g.controlbar.playbutton.click(function(){g.controlbar.preview.on("timeupdate",function(){if(!this.paused){var a=this.currentTime;g.controlbar.timer.html(g.timer.fetch_display_time(a))}});var a=g.controlbar.preview.get(0);e.do_play_audio(g,a);d.set_visual_mode("playingmode",c);h.clear();h.fetchCurrent=function(){var a=g.controlbar.preview.prop("currentTime"),b=g.controlbar.preview.prop("duration");if(!isFinite(b)){b=g.timer.finalseconds}return a/b};h.start()});g.controlbar.savebutton.click(function(){d.disable_button(this);if(g.blobs&&0 .poodll_save-recording").hide(),a("#"+b+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(a){},fetch_status_bar:function(a){var b='
00:00:00
';return b},fetch_preview_audio:function(a){var b='';return b},fetch_preview_video:function(a){var b='';return b},fetch_resource_audio:function(a){var b="";return b},fetch_resource_video:function(a){var b="";return b},fetch_uploader_skin:function(a,b){var c=this.fetch_instanceprops(a),d=g.clone();return d.init(c.config,b,c.controlbar.bmr_progresscanvas,c.controlbar.status),d},onMediaError:function(a){console.error("media error",a)},onMediaSuccess_video:function(a){var b=this.fetch_instanceprops(a);b.uploader.Output(""),this.set_visual_mode("recordmode",a),b.timer.reset(),b.timer.start(),this.update_status(a)},onMediaSuccess_audio:function(a){var b=this.fetch_instanceprops(a);b.uploader.Output(""),b.controlbar.preview.attr("src",null),this.set_visual_mode("recordmode",a),b.timer.reset(),b.timer.start(),this.update_status(a)},handle_timer_update:function(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time()),0==b.timer.seconds&&b.timer.initseconds>0&&b.controlbar.stopbutton.click()},update_status:function(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time())},set_visual_mode:function(a,b){var c=this,d=this.fetch_instanceprops(b);switch(this.visualmode=a,a){case"recordmode":c.disable_button(d.controlbar.startbutton),c.show_element(d.controlbar.startbutton),c.hide_element(d.controlbar.bmr_progresscanvas),c.enable_button(d.controlbar.pausebutton),c.show_element(d.controlbar.pausebutton),c.disable_button(d.controlbar.playbutton),c.hide_element(d.controlbar.resumebutton),c.enable_button(d.controlbar.stopbutton),c.disable_button(d.controlbar.savebutton),d.controlbar.preview.addClass("poodll_recording"),d.controlbar.status.addClass("poodll_recording"),"audio"==d.config.mediatype&&c.hide_element(d.controlbar.preview);break;case"previewmode":c.disable_button(d.controlbar.stopbutton),c.enable_button(d.controlbar.playbutton),c.disable_button(d.controlbar.pausebutton),c.enable_button(d.controlbar.savebutton),d.controlbar.status.html(d.timer.fetch_display_time(d.timer.finalSeconds)),c.show_element(d.controlbar.startbutton),c.disable_button(d.controlbar.resumebutton),c.hide_element(d.controlbar.resumebutton),c.hide_element(d.controlbar.bmr_progresscanvas),c.uploaded||(c.enable_button(d.controlbar.startbutton),c.enable_button(d.controlbar.savebutton)),c.show_element(d.controlbar.pausebutton),d.controlbar.preview.removeClass("poodll_recording"),d.controlbar.status.removeClass("poodll_recording"),"audio"==d.config.mediatype&&c.show_element(d.controlbar.preview),c.enable_button(d.controlbar.playbutton);break;case"playmode":d.controlbar.status.html("00:00:00"),c.disable_button(d.controlbar.playbutton),c.enable_button(d.controlbar.stopbutton),c.disable_button(d.controlbar.startbutton),c.disable_button(d.controlbar.resumebutton),c.disable_button(d.controlbar.playbutton),c.show_element(d.controlbar.bmr_progresscanvas),c.show_element(d.controlbar.startbutton),c.hide_element(d.controlbar.resumebutton);break;case"pausedmode":c.disable_button(d.controlbar.pausebutton),c.hide_element(d.controlbar.startbutton),c.show_element(d.controlbar.resumebutton),c.enable_button(d.controlbar.resumebutton),c.enable_button(d.controlbar.savebutton),d.controlbar.preview.removeClass("poodll_recording"),d.controlbar.status.removeClass("poodll_recording");break;case"uploadmode":c.disable_button(d.controlbar.savebutton),c.disable_button(d.controlbar.startbutton),c.show_element(d.controlbar.bmr_progresscanvas)}},insert_controlbar_video:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"video");return e},insert_controlbar_audio:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"audio");return e},prepare_controlbar:function(b,c,d,e,f){var g=this.fetch_instanceprops(c),h=g.config.media_skin_style,i="poodll_mediarecorder_size_auto";switch(g.config.size){case"small":i="poodll_mediarecorder_size_small";break;case"big":i="poodll_mediarecorder_size_big";break;case"auto":i="poodll_mediarecorder_size_auto"}var j=this.pmr.fetch_strings(),k=g.showupload?"":"hide",l="video"==f?"fa-video-camera":"fa-microphone",m="video"==f?"poodll_mediarecorder_video":"poodll_mediarecorder_audio",n='
';n+='
',n+='',n+='
',n+='
',n+='';var o=this.fetch_status_bar("bmr");n+=o,n+="
",n+=d,n+='
',n+='',n+=' ',n+='',n+='',n+=' ',n+='",n+="
",n+=this.devsettings.fetch_dialogue_box(),n+=g.downloaddialog.fetch_dialogue_box(),n+=g.errordialog.fetch_dialogue_box(),n+="
",n+="
",a(b).prepend(n);var p={poodll_recording_alert:a("#"+c+" .poodll-alert-recording"),bmr_progresscanvas:a("#"+c+" .bmr_range"),settingsdialog:a("#"+c+" .poodll_dialogue_box_settings"),downloaddialog:a("#"+c+" .poodll_dialogue_box_download"),errorsdialog:a("#"+c+" .poodll_dialogue_box_errors"),settingsicon:a("#"+c+" .settingsicon"),status:a("#"+c+" .poodll_status_bmr"),preview:a("#"+c+" .poodll_preview_bmr"),startbutton:a("#"+c+" .poodll_start-recording_bmr"),stopbutton:a("#"+c+" .poodll_stop-recording_bmr"),pausebutton:a("#"+c+" .poodll_pause-recording_bmr"),resumebutton:a("#"+c+" .poodll_resume-recording_bmr"),playbutton:a("#"+c+" .poodll_play-recording_bmr"),savebutton:a("#"+c+" .poodll_save-recording_bmr")};return g.downloaddialog.set_dialogue_box(p.downloaddialog),g.errordialog.set_dialogue_box(p.errorsdialog),this.devsettings.set_dialogue_box(p.settingsdialog),p},register_controlbar_events_video:function(a,b){return this.register_controlbar_events_audio(a,b)},register_controlbar_events_audio:function(a,b){var c=this,d=this.pmr,e=this.fetch_instanceprops(b);e.controlbar.settingsicon.click(function(){c.uploaded?e.downloaddialog.open():c.devsettings.open()});var g=f.clone();g.init(e.controlbar.bmr_progresscanvas),e.controlbar.startbutton.click(function(){d.do_start_audio(e,a)}),e.controlbar.stopbutton.click(function(){d.do_stop_audio(e);var a=e.controlbar.preview;a&&a.get(0)&&a.get(0).pause(),e.timer.stop(),c.update_status(b),c.set_visual_mode("previewmode",b)}),e.controlbar.pausebutton.click(function(){d.do_pause_audio(e),e.timer.pause(),c.update_status(b),c.set_visual_mode("pausedmode",b)}),e.controlbar.resumebutton.click(function(){d.do_resume_audio(e),e.timer.resume(),c.update_status(b),c.set_visual_mode("recordmode",b)}),e.controlbar.preview.on("timeupdate",function(){if("playmode"==c.visualmode){var a=this.currentTime;e.controlbar.status.html(e.timer.fetch_display_time(a))}}),e.controlbar.playbutton.click(function(){var a=e.controlbar.preview.get(0);d.do_play_audio(e,a),c.set_visual_mode("playmode",b),g.clear(),g.fetchCurrent=function(){var a=e.controlbar.preview.prop("currentTime"),b=e.controlbar.preview.prop("duration");return isFinite(b)||(b=e.timer.finalseconds),a/b},g.start()}),e.controlbar.savebutton.click(function(){return e.blobs&&e.blobs.length>0?(c.set_visual_mode("uploadmode",b),d.do_save_audio(e),c.uploaded=!0):e.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll")),!1}),window.onbeforeunload=function(){c.enable_button(e.controlbar.startbutton);var a=e.controlbar.preview;a&&a.get(0)&&(a.get(0).pause(),a.get(0).controls=!1)}},show_element:function(b){a(b).removeClass("hide"),a(b).show()},hide_element:function(b){a(b).addClass("hide"),a(b).hide()},enable_button:function(b){a(b).attr("disabled",!1),a(b).removeClass("bmr_disabled")},disable_button:function(b){a(b).attr("disabled",!0),a(b).addClass("bmr_disabled")}}}); \ No newline at end of file +define ("filter_poodll/poodll_bmrmediaskin",["jquery","jqueryui","core/log","filter_poodll/utils_amd","filter_poodll/dlg_devicesettings","filter_poodll/anim_progress_bar","filter_poodll/upskin_bar"],function(a,b,c,d,e,f,g){"use strict";c.debug("PoodLL BMR Skin: initialising");return{instanceprops:null,pmr:null,uploaded:!1,devsettings:null,clone:function clone(){return a.extend(!0,{},this)},init:function init(a,b){this.instanceprops=a;this.pmr=b;this.devsettings=e.clone();this.devsettings.init(b,a)},fetch_instanceprops:function fetch_instanceprops(){return this.instanceprops},onUploadSuccess:function onUploadSuccess(b){a("#"+b+" > .poodll_save-recording").hide();a("#"+b+" > .poodll_savedsuccessfully").show()},onUploadFailure:function onUploadFailure(){},fetch_status_bar:function fetch_status_bar(a){return"
00:00:00
"},fetch_preview_audio:function fetch_preview_audio(a){return""},fetch_preview_video:function fetch_preview_video(a){return""},fetch_resource_audio:function fetch_resource_audio(){return""},fetch_resource_video:function fetch_resource_video(){return""},fetch_uploader_skin:function fetch_uploader_skin(a,b){var c=this.fetch_instanceprops(a),d=g.clone();d.init(c.config,b,c.controlbar.bmr_progresscanvas,c.controlbar.status);return d},onMediaError:function onMediaError(a){console.error("media error",a)},onMediaSuccess_video:function onMediaSuccess_video(a){var b=this.fetch_instanceprops(a);b.uploader.Output("");this.set_visual_mode("recordmode",a);b.timer.reset();b.timer.start();this.update_status(a)},onMediaSuccess_audio:function onMediaSuccess_audio(a){var b=this.fetch_instanceprops(a);b.uploader.Output("");b.controlbar.preview.attr("src",null);this.set_visual_mode("recordmode",a);b.timer.reset();b.timer.start();this.update_status(a)},handle_timer_update:function handle_timer_update(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time());if(0==b.timer.seconds&&0";n+="
";n+="";n+="
";n+="
";n+="";var o=this.fetch_status_bar("bmr");n+=o;n+="
";n+=d,n+="
";n+="";n+=" ";n+="";n+="";n+=" ";n+="";n+="
";n+=this.devsettings.fetch_dialogue_box();n+=g.downloaddialog.fetch_dialogue_box();n+=g.errordialog.fetch_dialogue_box();n+="
";n+="";a(b).prepend(n);var p={poodll_recording_alert:a("#"+c+" .poodll-alert-recording"),bmr_progresscanvas:a("#"+c+" .bmr_range"),settingsdialog:a("#"+c+" .poodll_dialogue_box_settings"),downloaddialog:a("#"+c+" .poodll_dialogue_box_download"),errorsdialog:a("#"+c+" .poodll_dialogue_box_errors"),settingsicon:a("#"+c+" .settingsicon"),status:a("#"+c+" .poodll_status_bmr"),preview:a("#"+c+" .poodll_preview_bmr"),startbutton:a("#"+c+" .poodll_start-recording_bmr"),stopbutton:a("#"+c+" .poodll_stop-recording_bmr"),pausebutton:a("#"+c+" .poodll_pause-recording_bmr"),resumebutton:a("#"+c+" .poodll_resume-recording_bmr"),playbutton:a("#"+c+" .poodll_play-recording_bmr"),savebutton:a("#"+c+" .poodll_save-recording_bmr")};g.downloaddialog.set_dialogue_box(p.downloaddialog);g.errordialog.set_dialogue_box(p.errorsdialog);this.devsettings.set_dialogue_box(p.settingsdialog);return p},register_controlbar_events_video:function register_controlbar_events_video(a,b){return this.register_controlbar_events_audio(a,b)},register_controlbar_events_audio:function register_controlbar_events_audio(a,b){var c=this,d=this.pmr,e=this.fetch_instanceprops(b);e.controlbar.settingsicon.click(function(){if(!c.uploaded){c.devsettings.open()}else{e.downloaddialog.open()}});var g=f.clone();g.init(e.controlbar.bmr_progresscanvas);e.controlbar.startbutton.click(function(){d.do_start_audio(e,a)});e.controlbar.stopbutton.click(function(){d.do_stop_audio(e);var a=e.controlbar.preview;if(a&&a.get(0)){a.get(0).pause()}e.timer.stop();c.update_status(b);c.set_visual_mode("previewmode",b)});e.controlbar.pausebutton.click(function(){d.do_pause_audio(e);e.timer.pause();c.update_status(b);c.set_visual_mode("pausedmode",b)});e.controlbar.resumebutton.click(function(){d.do_resume_audio(e);e.timer.resume();c.update_status(b);c.set_visual_mode("recordmode",b)});e.controlbar.preview.on("timeupdate",function(){if("playmode"!=c.visualmode){return}var a=this.currentTime;e.controlbar.status.html(e.timer.fetch_display_time(a))});e.controlbar.playbutton.click(function(){var a=e.controlbar.preview.get(0);d.do_play_audio(e,a);c.set_visual_mode("playmode",b);g.clear();g.fetchCurrent=function(){var a=e.controlbar.preview.prop("currentTime"),b=e.controlbar.preview.prop("duration");if(!isFinite(b)){b=e.timer.finalseconds}return a/b};g.start()});e.controlbar.savebutton.click(function(){if(e.blobs&&0 .poodll_save-recording").hide(),a("#"+d+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(a){b.debug("from poodllmediarecorder: uploadfailure")},fetch_status_bar:function(a){var b='
00:00:00
';return b},fetch_preview_audio:function(a){var b='';return b},fetch_preview_video:function(a){var b='';return b},fetch_resource_audio:function(a){var b='';return b},fetch_resource_video:function(a){var b='';return b},onMediaError:function(a){console.error("media error",a)},onMediaSuccess_video:function(a){var b=this.fetch_instanceprops(a);b.controlbar.stopbutton.attr("disabled",!1),b.controlbar.pausebutton.attr("disabled",!1),b.controlbar.savebutton.attr("disabled",!1)},onMediaSuccess_audio:function(a){var b=this.fetch_instanceprops(a);b.controlbar.preview.attr("src",null),b.controlbar.stopbutton.attr("disabled",!1),b.controlbar.pausebutton.attr("disabled",!1),b.controlbar.savebutton.attr("disabled",!1)},handle_timer_update:function(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time()),0==b.timer.seconds&&b.timer.initseconds>0&&b.controlbar.stopbutton.click()},update_status:function(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time())},set_visual_mode:function(a,b){var c=this.fetch_instanceprops(b);switch(a){case"recordmode":c.controlbar.preview.addClass("poodll_recording"),c.controlbar.status.addClass("poodll_recording"),"audio"==c.config.mediatype&&c.controlbar.preview.addClass("hide"),c.controlbar.status.removeClass("hide");break;case"previewmode":c.controlbar.preview.removeClass("poodll_recording"),c.controlbar.status.removeClass("poodll_recording");break;case"pausedmode":c.controlbar.preview.removeClass("poodll_recording"),c.controlbar.status.removeClass("poodll_recording")}},insert_controlbar_audio:function(b,c,d,e){var f=this.fetch_instanceprops(c),g=f.config.media_skin_style,h="poodll_mediarecorder_size_auto";switch(f.config.size){case"small":h="poodll_mediarecorder_size_small";break;case"big":h="poodll_mediarecorder_size_big";break;case"auto":h="poodll_mediarecorder_size_auto"}var i='
',j=this.fetch_status_bar("burntrose");i+=j,i+=d,i+='',i+='',i+='',i+=' ',i+=' ',i+=' ',i+=' ',i+=' ',i+=' ',i+='',i+='',i+='',i+="
",a(b).prepend(i);var k={status:a("#"+c+" .poodll_status_burntrose"),preview:a("#"+c+" .poodll_preview_burntrose"),startbutton:a("#"+c+" .poodll_start-recording"),stopbutton:a("#"+c+" .poodll_stop-recording"),pausebutton:a("#"+c+" .poodll_pause-recording"),resumebutton:a("#"+c+" .poodll_resume-recording"),play1:a("#"+c+" .poodll_play-recording"),playbutton:a("#"+c+" > .poodll_playsave"),save1:a("#"+c+" .poodll_savebtn"),savebutton:a("#"+c+" .poodll_save-recording_burntrose"),savesuccess:a("#"+c+" .poodll_savedsuccessfully"),playermic:a("#"+c+" .poodll_mic"),recordmic:a("#"+c+" .poodll_recmic"),resumemic:a("#"+c+" .poodll_resume_mic")};return k},insert_controlbar_video:function(b,c,d,e){var f=this.fetch_instanceprops(c),g=f.config.media_skin_style,h="poodll_mediarecorder_size_auto";switch(f.config.size){case"small":h="poodll_mediarecorder_size_small";break;case"big":h="poodll_mediarecorder_size_big";break;case"auto":h="poodll_mediarecorder_size_auto"}var i='
',j=this.fetch_status_bar("burntrose");i+=j,i+=d,i+='
',i+='',i+='',i+='',i+=' ',i+=' ',i+=' ',i+=' ',i+=' ',i+=' ',i+='',i+='',i+='',i+="
",i+="
",a(b).prepend(i);var k={status:a("#"+c+" > .poodll_status_burntrose"),preview:a("#"+c+" > .poodll_preview_burntrose"),startbutton:a("#"+c+" > .poodll_start-recording"),stopbutton:a("#"+c+" > .poodll_stop-recording"),pausebutton:a("#"+c+" > .poodll_pause-recording"),resumebutton:a("#"+c+" > .poodll_resume-recording"),play1:a("#"+c+" > .poodll_play-recording"),playbutton:a("#"+c+" > .poodll_playsave"),save1:a("#"+c+" > .poodll_savebtn"),savebutton:a("#"+c+" > .poodll_save-recording_burntrose"),savesuccess:a("#"+c+" > .poodll_savedsuccessfully"),playermic:a("#"+c+"> .poodll_mic"),recordmic:a("#"+c+"> .poodll_recmic"),resumemic:a("#"+c+"> .poodll_resume_mic")};return k},register_controlbar_events_video:function(a,b){return this.register_controlbar_events_audio(a,b)},register_controlbar_events_audio:function(b,c){var d=this,e=this.pmr,f=this.fetch_instanceprops(c);f.controlbar.startbutton.click(function(){this.disabled=!1,a("#"+f.config.widgetid+"_messages").text(""),e.do_start_audio(f,b),f.controlbar.playermic.hide(),f.controlbar.recordmic.show(),f.controlbar.playbutton.hide(),f.controlbar.play1.hide(),f.controlbar.pausebutton.show(),f.controlbar.pausebutton.attr("disabled",!1),f.controlbar.startbutton.hide(),f.controlbar.stopbutton.show(),f.controlbar.stopbutton.attr("disabled",!1),f.controlbar.savebutton.hide(),f.controlbar.savesuccess.hide(),f.controlbar.save1.show(),d.set_visual_mode("recordmode",c),f.timer.reset(),f.timer.start(),d.update_status(c)}),f.controlbar.stopbutton.click(function(){this.disabled=!1,f.controlbar.stopbutton.hide(),f.controlbar.startbutton.show(),f.controlbar.startbutton.attr("disabled",!1),f.controlbar.resumebutton.hide(),f.controlbar.pausebutton.hide(),f.controlbar.play1.hide(),f.controlbar.playbutton.show(),f.controlbar.save1.hide(),f.controlbar.savesuccess.hide(),f.controlbar.savebutton.show(),f.controlbar.resumemic.hide(),f.controlbar.recordmic.hide(),f.controlbar.playermic.show(),e.do_stop_audio(f);var a=f.controlbar.preview;a&&a.get(0)&&a.get(0).pause(),d.set_visual_mode("previewmode",c),f.timer.stop(),d.update_status(c),f.uploaded||f.controlbar.startbutton.attr("disabled",!1)}),f.controlbar.pausebutton.click(function(){this.disabled=!0,a(this).hide(),f.controlbar.resumebutton.show(),e.do_pause_audio(f),f.controlbar.resumebutton.attr("disabled",!1),d.set_visual_mode("pausedmode",c),f.timer.pause(),d.update_status(c),f.controlbar.recordmic.hide(),f.controlbar.resumemic.show()}),f.controlbar.resumebutton.click(function(){this.disabled=!0,a(this).hide(),f.controlbar.pausebutton.show(),e.do_resume_audio(f),f.controlbar.pausebutton.attr("disabled",!1),d.set_visual_mode("recordmode",c),f.timer.resume(),d.update_status(c),f.controlbar.resumemic.hide(),f.controlbar.recordmic.show()}),f.controlbar.playbutton.click(function(){this.disabled=!1;var a=f.controlbar.preview.get(0);return a.currentTime>0&&!a.paused?(a.pause(),void(a.currentTime=0)):(e.do_play_audio(f,a),void f.controlbar.startbutton.show())}),f.controlbar.savebutton.click(function(){return this.disabled=!1,f.blobs&&f.blobs.length>0?(e.do_save_audio(f),f.uploaded=!0,f.controlbar.startbutton.attr("disabled",!0)):f.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll")),!1}),window.onbeforeunload=function(){f.controlbar.startbutton.attr("disabled",!1);var a=f.controlbar.preview;a&&a.get(0)&&a.get(0).pause()}}}}); \ No newline at end of file +define ("filter_poodll/poodll_burntrosemediaskin",["jquery","core/log","filter_poodll/utils_amd"],function(a,b){"use strict";b.debug("PoodLL Burnt Rose Skin: initialising");return{instanceprops:null,pmr:null,clone:function clone(){return a.extend(!0,{},this)},init:function init(a,b){this.instanceprops=a;this.pmr=b},fetch_instanceprops:function fetch_instanceprops(){return this.instanceprops},onUploadSuccess:function onUploadSuccess(c){b.debug("from poodllmediarecorder: uploadsuccess");var d="filter_poodll_controlbar_"+c;a("#"+d+" > .poodll_save-recording").hide();a("#"+d+" > .poodll_savedsuccessfully").show()},onUploadFailure:function onUploadFailure(){b.debug("from poodllmediarecorder: uploadfailure")},fetch_status_bar:function fetch_status_bar(a){return"
00:00:00
"},fetch_preview_audio:function fetch_preview_audio(a){return""},fetch_preview_video:function fetch_preview_video(a){return""},fetch_resource_audio:function fetch_resource_audio(a){return""},fetch_resource_video:function fetch_resource_video(a){return""},onMediaError:function onMediaError(a){console.error("media error",a)},onMediaSuccess_video:function onMediaSuccess_video(a){var b=this.fetch_instanceprops(a);b.controlbar.stopbutton.attr("disabled",!1);b.controlbar.pausebutton.attr("disabled",!1);b.controlbar.savebutton.attr("disabled",!1)},onMediaSuccess_audio:function onMediaSuccess_audio(a){var b=this.fetch_instanceprops(a);b.controlbar.preview.attr("src",null);b.controlbar.stopbutton.attr("disabled",!1);b.controlbar.pausebutton.attr("disabled",!1);b.controlbar.savebutton.attr("disabled",!1)},handle_timer_update:function handle_timer_update(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time());if(0==b.timer.seconds&&0",i=this.fetch_status_bar("burntrose");h+=i,h+=d,h+="";h+="";h+="";h+=" ";h+=" ";h+=" ";h+=" ";h+=" ";h+=" ";h+="";h+="";h+="";h+="";a(b).prepend(h);var j={status:a("#"+c+" .poodll_status_burntrose"),preview:a("#"+c+" .poodll_preview_burntrose"),startbutton:a("#"+c+" .poodll_start-recording"),stopbutton:a("#"+c+" .poodll_stop-recording"),pausebutton:a("#"+c+" .poodll_pause-recording"),resumebutton:a("#"+c+" .poodll_resume-recording"),play1:a("#"+c+" .poodll_play-recording"),playbutton:a("#"+c+" > .poodll_playsave"),save1:a("#"+c+" .poodll_savebtn"),savebutton:a("#"+c+" .poodll_save-recording_burntrose"),savesuccess:a("#"+c+" .poodll_savedsuccessfully"),playermic:a("#"+c+" .poodll_mic"),recordmic:a("#"+c+" .poodll_recmic"),resumemic:a("#"+c+" .poodll_resume_mic")};return j},insert_controlbar_video:function insert_controlbar_video(b,c,d){var e=this.fetch_instanceprops(c),f=e.config.media_skin_style,g="poodll_mediarecorder_size_auto";switch(e.config.size){case"small":g="poodll_mediarecorder_size_small";break;case"big":g="poodll_mediarecorder_size_big";break;case"auto":g="poodll_mediarecorder_size_auto";}var h="
",i=this.fetch_status_bar("burntrose");h+=i,h+=d,h+="
";h+="";h+="";h+="";h+=" ";h+=" ";h+=" ";h+=" ";h+=" ";h+=" ";h+="";h+="";h+="";h+="
";h+="
";a(b).prepend(h);var j={status:a("#"+c+" > .poodll_status_burntrose"),preview:a("#"+c+" > .poodll_preview_burntrose"),startbutton:a("#"+c+" > .poodll_start-recording"),stopbutton:a("#"+c+" > .poodll_stop-recording"),pausebutton:a("#"+c+" > .poodll_pause-recording"),resumebutton:a("#"+c+" > .poodll_resume-recording"),play1:a("#"+c+" > .poodll_play-recording"),playbutton:a("#"+c+" > .poodll_playsave"),save1:a("#"+c+" > .poodll_savebtn"),savebutton:a("#"+c+" > .poodll_save-recording_burntrose"),savesuccess:a("#"+c+" > .poodll_savedsuccessfully"),playermic:a("#"+c+"> .poodll_mic"),recordmic:a("#"+c+"> .poodll_recmic"),resumemic:a("#"+c+"> .poodll_resume_mic")};return j},register_controlbar_events_video:function register_controlbar_events_video(a,b){return this.register_controlbar_events_audio(a,b)},register_controlbar_events_audio:function register_controlbar_events_audio(b,c){var d=this,e=this.pmr,f=this.fetch_instanceprops(c);f.controlbar.startbutton.click(function(){this.disabled=!1;a("#"+f.config.widgetid+"_messages").text("");e.do_start_audio(f,b);f.controlbar.playermic.hide();f.controlbar.recordmic.show();f.controlbar.playbutton.hide();f.controlbar.play1.hide();f.controlbar.pausebutton.show();f.controlbar.pausebutton.attr("disabled",!1);f.controlbar.startbutton.hide();f.controlbar.stopbutton.show();f.controlbar.stopbutton.attr("disabled",!1);f.controlbar.savebutton.hide();f.controlbar.savesuccess.hide();f.controlbar.save1.show();d.set_visual_mode("recordmode",c);f.timer.reset();f.timer.start();d.update_status(c)});f.controlbar.stopbutton.click(function(){this.disabled=!1;f.controlbar.stopbutton.hide();f.controlbar.startbutton.show();f.controlbar.startbutton.attr("disabled",!1);f.controlbar.resumebutton.hide();f.controlbar.pausebutton.hide();f.controlbar.play1.hide();f.controlbar.playbutton.show();f.controlbar.save1.hide();f.controlbar.savesuccess.hide();f.controlbar.savebutton.show();f.controlbar.resumemic.hide();f.controlbar.recordmic.hide();f.controlbar.playermic.show();e.do_stop_audio(f);var a=f.controlbar.preview;if(a&&a.get(0)){a.get(0).pause()}d.set_visual_mode("previewmode",c);f.timer.stop();d.update_status(c);if(!f.uploaded){f.controlbar.startbutton.attr("disabled",!1)}});f.controlbar.pausebutton.click(function(){this.disabled=!0;a(this).hide();f.controlbar.resumebutton.show();e.do_pause_audio(f);f.controlbar.resumebutton.attr("disabled",!1);d.set_visual_mode("pausedmode",c);f.timer.pause();d.update_status(c);f.controlbar.recordmic.hide();f.controlbar.resumemic.show()});f.controlbar.resumebutton.click(function(){this.disabled=!0;a(this).hide();f.controlbar.pausebutton.show();e.do_resume_audio(f);f.controlbar.pausebutton.attr("disabled",!1);d.set_visual_mode("recordmode",c);f.timer.resume();d.update_status(c);f.controlbar.resumemic.hide();f.controlbar.recordmic.show()});f.controlbar.playbutton.click(function(){this.disabled=!1;var a=f.controlbar.preview.get(0);if(0 .poodll_save-recording").hide(),a("#"+b+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(a){},fetch_status_bar:function(a){var b='
';return b},fetch_preview_audio:function(a){var b='';return b},fetch_model_audio:function(){var a='';return a},fetch_preview_video:function(a){var b='';return b},fetch_resource_audio:function(a){var b='';return b},fetch_resource_video:function(a){var b='';return b},fetch_uploader_skin:function(a,b){return!1},fetch_ding_player:function(){var a="fluencybuilder",b='';return b},onMediaError:function(a){console.error("media error",a)},onMediaSuccess_video:function(a){var b=this.fetch_instanceprops(a);this.highlight_button("bwrapper_start-recording",a),b.uploader.Output(""),b.timer.reset(),b.timer.start(),this.update_status(a),b.controlbar.stopbutton.attr("disabled",!1),b.controlbar.savebutton.attr("disabled",!1)},onMediaSuccess_audio:function(a){var b=this.fetch_instanceprops(a);b.controlbar.checkplayer.attr("src",null),this.pmr.do_pause_audio(b)},handle_timer_update:function(a){var b=this.fetch_instanceprops(a);this.update_status(a),0==b.timer.seconds&&b.timer.initseconds>0&&b.controlbar.stoprecbutton.click()},update_status:function(a){},insert_controlbar_video:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"video");return e},insert_controlbar_audio:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"audio");return e},prepare_controlbar:function(b,c,d,e,f){var g=this.fetch_instanceprops(c),h=g.config.media_skin_style,i="video"==f?"poodll_mediarecorder_video":"poodll_mediarecorder_audio",e=e.replace("@@RESOURCEURL@@",g.config.resource),j=this.fetch_model_audio();j=j.replace("@@MODELURL@@",g.config.resource2);var k=this.fetch_ding_player(),l=this.fetch_status_bar("fluencybuilder"),m="poodll_mediarecorder_size_auto";switch(g.config.size){case"small":m="poodll_mediarecorder_size_small";break;case"big":m="poodll_mediarecorder_size_big";break;case"auto":m="poodll_mediarecorder_size_auto"}var n='
';n+='
',n+='
',n+=l,n+=k,n+=j,n+=d,n+=e,n+='
',n+='
',n+='
',n+='",n+='',n+='",n+='",n+="
",a(b).prepend(n);var o={status:a("#"+c+" .poodll_status_fluencybuilder"),dingplayer:a("#"+c+" .poodll_dingplayer_fluencybuilder"),modelplayer:a("#"+c+" .poodll_modelplayer_fluencybuilder"),resourceplayer:a("#"+c+" .poodll_resourceplayer_fluencybuilder"),checkplayer:a("#"+c+" .poodll_checkplayer_fluencybuilder"),resourcebutton:a("#"+c+" .poodll_play-resource_fluencybuilder"),startbutton:a("#"+c+" .poodll_start-recording_fluencybuilder"),stoprecbutton:a("#"+c+" .poodll_stop-recording_fluencybuilder"),stopbutton:a("#"+c+" .poodll_stop-playing_fluencybuilder"),playbutton:a("#"+c+" .poodll_play-recording_fluencybuilder"),playmodelbutton:a("#"+c+" .poodll_play-model_fluencybuilder"),savebutton:a("#"+c+" .poodll_save-recording_fluencybuilder"),resourcewrapper:a("#"+c+" .bwrapper_play-resource"),startrecwrapper:a("#"+c+" .bwrapper_start-recording"),playmodelwrapper:a("#"+c+" .bwrapper_play-model")};return o},register_controlbar_events_video:function(a,b){return this.register_controlbar_events_audio(a,b)},play_ding:function(a,b){var c=this.fetch_instanceprops(b);switch(c.controlbar.dingplayer[0].play(),a){case"click_start":c.controlbar.startbutton.click();break;case"click_play":c.controlbar.playmodelbutton.click();break;case"show_dialog":alert("dialog");break;default:c.controlbar.dingplayer[0].onended=null}},highlight_button:function(b,c){var d=a("#"+c+" .fb_bwrapper");a(d).each(function(c){a(this).hasClass(b)?(a(this).removeClass("mod_fluencybuilder_autobutton_inactive"),a(this).addClass("mod_fluencybuilder_autobutton_active")):(a(this).removeClass("mod_fluencybuilder_autobutton_active"),a(this).addClass("mod_fluencybuilder_autobutton_inactive"))})},warmup_recorder:function(b,c){var d=this.fetch_instanceprops(b);this.pmr.warmup_context(d),this.pmr.warmup_preview(d),this.pmr.do_start_audio(d,c);var e=d.controlbar.modelplayer.get(0),f=d.controlbar.dingplayer.get(0),g=d.controlbar.resourceplayer.get(0);if(!d.warmedup)try{g.play(),f.play(),e.play(),g.pause(),f.pause(),e.pause()}catch(h){}var i=M.cfg.wwwroot+"/filter/poodll/ding.mp3";a(e).attr("src",d.config.resource2),a(f).attr("src",i),a(g).attr("src",d.config.resource),d.warmedup=!0},register_controlbar_events_audio:function(a,b){var c=this,d=this.pmr,e=this.fetch_instanceprops(b);e.controlbar.resourceplayer.on("ended",function(){e.warmedup&&c.play_ding("click_start",b)}),e.controlbar.modelplayer.on("ended",function(){c.highlight_button("",b)}),e.controlbar.startbutton.click(function(){d.do_resume_audio(e),c.highlight_button("bwrapper_start-recording",b),e.uploader.Output(""),e.timer.reset(),e.timer.start(),c.update_status(b),e.controlbar.stopbutton.attr("disabled",!1),e.controlbar.savebutton.attr("disabled",!1)}),e.controlbar.stoprecbutton.click(function(){d.do_stop_audio(e),c.play_ding("click_play",b),e.timer.stop(),c.update_status(b)}),e.controlbar.stopbutton.click(function(){c.highlight_button("none",b),e.timer.stop(),c.update_status(b)}),e.controlbar.playmodelbutton.click(function(){var a=e.controlbar.modelplayer.get(0);a.play(),c.highlight_button("bwrapper_play-model",b)}),e.controlbar.playbutton.click(function(){var a=e.controlbar.checkplayer.get(0);d.do_play_audio(e,a)}),e.controlbar.resourcebutton.click(function(){c.warmup_recorder(b,a),c.disable_button(this);var d=e.controlbar.resourceplayer.get(0);d.play(),c.highlight_button("bwrapper_play-resource",b)}),e.controlbar.savebutton.click(function(){return c.disable_button(this),e.blobs&&e.blobs.length>0?(d.do_save_audio(e),c.uploaded=!0,c.disable_button(e.controlbar.startbutton)):e.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll")),!1}),window.onbeforeunload=function(){c.enable_button(e.controlbar.startbutton);var a=e.controlbar.checkplayer;a&&a.get(0)&&a.get(0).pause()}},enable_button:function(b){a(b).prop("disabled",!1)},disable_button:function(b){a(b).prop("disabled",!0)},show_button:function(a){a.show()},hide_button:function(a){a.hide()}}}); \ No newline at end of file +define ("filter_poodll/poodll_fbmediaskin",["jquery","core/log","filter_poodll/utils_amd"],function(a,b){"use strict";b.debug("PoodLL Fluencybuilder Skin: initialising");return{instanceprops:null,pmr:null,uploaded:!1,clone:function clone(){return a.extend(!0,{},this)},init:function init(a,b){this.instanceprops=a;this.instanceprops.warmedup=!1;this.pmr=b},fetch_instanceprops:function fetch_instanceprops(){return this.instanceprops},onUploadSuccess:function onUploadSuccess(b){a("#"+b+" > .poodll_save-recording").hide();a("#"+b+" > .poodll_savedsuccessfully").show()},onUploadFailure:function onUploadFailure(){},fetch_status_bar:function fetch_status_bar(a){return"
"},fetch_preview_audio:function fetch_preview_audio(a){return""},fetch_model_audio:function fetch_model_audio(){var a="";return a},fetch_preview_video:function fetch_preview_video(a){return""},fetch_resource_audio:function fetch_resource_audio(a){var b="";return b},fetch_resource_video:function fetch_resource_video(a){return""},fetch_uploader_skin:function fetch_uploader_skin(){return!1},fetch_ding_player:function fetch_ding_player(){var a="";return a},onMediaError:function onMediaError(a){console.error("media error",a)},onMediaSuccess_video:function onMediaSuccess_video(a){var b=this.fetch_instanceprops(a);this.highlight_button("bwrapper_start-recording",a);b.uploader.Output("");b.timer.reset();b.timer.start();this.update_status(a);b.controlbar.stopbutton.attr("disabled",!1);b.controlbar.savebutton.attr("disabled",!1)},onMediaSuccess_audio:function onMediaSuccess_audio(a){var b=this.fetch_instanceprops(a);b.controlbar.checkplayer.attr("src",null);this.pmr.do_pause_audio(b)},handle_timer_update:function handle_timer_update(a){var b=this.fetch_instanceprops(a);this.update_status(a);if(0==b.timer.seconds&&0";n+="
";n+="
";n+=l,n+=k,n+=j,n+=d,n+=e,n+="
";n+="
";n+="
";n+="";n+="";n+="";n+="";n+="
";a(b).prepend(n);var o={status:a("#"+c+" .poodll_status_fluencybuilder"),dingplayer:a("#"+c+" .poodll_dingplayer_fluencybuilder"),modelplayer:a("#"+c+" .poodll_modelplayer_fluencybuilder"),resourceplayer:a("#"+c+" .poodll_resourceplayer_fluencybuilder"),checkplayer:a("#"+c+" .poodll_checkplayer_fluencybuilder"),resourcebutton:a("#"+c+" .poodll_play-resource_fluencybuilder"),startbutton:a("#"+c+" .poodll_start-recording_fluencybuilder"),stoprecbutton:a("#"+c+" .poodll_stop-recording_fluencybuilder"),stopbutton:a("#"+c+" .poodll_stop-playing_fluencybuilder"),playbutton:a("#"+c+" .poodll_play-recording_fluencybuilder"),playmodelbutton:a("#"+c+" .poodll_play-model_fluencybuilder"),savebutton:a("#"+c+" .poodll_save-recording_fluencybuilder"),resourcewrapper:a("#"+c+" .bwrapper_play-resource"),startrecwrapper:a("#"+c+" .bwrapper_start-recording"),playmodelwrapper:a("#"+c+" .bwrapper_play-model")};return o},register_controlbar_events_video:function register_controlbar_events_video(a,b){return this.register_controlbar_events_audio(a,b)},play_ding:function play_ding(a,b){var c=this.fetch_instanceprops(b);c.controlbar.dingplayer[0].play();switch(a){case"click_start":c.controlbar.startbutton.click();break;case"click_play":c.controlbar.playmodelbutton.click();break;case"show_dialog":alert("dialog");break;default:c.controlbar.dingplayer[0].onended=null;}},highlight_button:function highlight_button(b,c){var d=a("#"+c+" .fb_bwrapper");a(d).each(function(){if(a(this).hasClass(b)){a(this).removeClass("mod_fluencybuilder_autobutton_inactive");a(this).addClass("mod_fluencybuilder_autobutton_active")}else{a(this).removeClass("mod_fluencybuilder_autobutton_active");a(this).addClass("mod_fluencybuilder_autobutton_inactive")}})},warmup_recorder:function warmup_recorder(b,c){var d=this.fetch_instanceprops(b);this.pmr.warmup_context(d);this.pmr.warmup_preview(d);this.pmr.do_start_audio(d,c);var e=d.controlbar.modelplayer.get(0),f=d.controlbar.dingplayer.get(0),g=d.controlbar.resourceplayer.get(0);if(!d.warmedup){try{g.play();f.play();e.play();g.pause();f.pause();e.pause()}catch(a){}}var h=M.cfg.wwwroot+"/filter/poodll/ding.mp3";a(e).attr("src",d.config.resource2);a(f).attr("src",h);a(g).attr("src",d.config.resource);d.warmedup=!0},register_controlbar_events_audio:function register_controlbar_events_audio(a,b){var c=this,d=this.pmr,e=this.fetch_instanceprops(b);e.controlbar.resourceplayer.on("ended",function(){if(e.warmedup){c.play_ding("click_start",b)}});e.controlbar.modelplayer.on("ended",function(){c.highlight_button("",b)});e.controlbar.startbutton.click(function(){d.do_resume_audio(e);c.highlight_button("bwrapper_start-recording",b);e.uploader.Output("");e.timer.reset();e.timer.start();c.update_status(b);e.controlbar.stopbutton.attr("disabled",!1);e.controlbar.savebutton.attr("disabled",!1)});e.controlbar.stoprecbutton.click(function(){d.do_stop_audio(e);c.play_ding("click_play",b);e.timer.stop();c.update_status(b)});e.controlbar.stopbutton.click(function(){c.highlight_button("none",b);e.timer.stop();c.update_status(b)});e.controlbar.playmodelbutton.click(function(){var a=e.controlbar.modelplayer.get(0);a.play();c.highlight_button("bwrapper_play-model",b)});e.controlbar.playbutton.click(function(){var a=e.controlbar.checkplayer.get(0);d.do_play_audio(e,a)});e.controlbar.resourcebutton.click(function(){c.warmup_recorder(b,a);c.disable_button(this);var d=e.controlbar.resourceplayer.get(0);d.play();c.highlight_button("bwrapper_play-resource",b)});e.controlbar.savebutton.click(function(){c.disable_button(this);if(e.blobs&&0"+M.util.get_string("recui_save","filter_poodll")+"";a(b).append(k);var l=f.widgetid+"_adc",m='';a(b).prepend(m),g.uploader=d.clone(),g.uploader.init(b,f),e.embed[f.widgetid].setCanvasAttribute("audiodatacontrol",l),g.savebutton=a("#"+j),g.audiodatacontrol=a("#"+l),this.registerevents(f.widgetid)},registerevents:function(a){var b=this.fetch_instance_props(a);b.audioblob=!1,b.savebutton.click(function(){var a=atob(b.audiodatacontrol.val()),c=a&&a.length>0;if(!c&&!b.audioblob)return b.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll")),!1;if(!b.audioblob&&c){for(var d=[],f=0;f"+M.util.get_string("recui_save","filter_poodll")+"";a(b).append(k);var l=f.widgetid+"_adc";a(b).prepend("");g.uploader=d.clone();g.uploader.init(b,f);e.embed[f.widgetid].setCanvasAttribute("audiodatacontrol",l);g.savebutton=a("#"+j);g.audiodatacontrol=a("#"+l);this.registerevents(f.widgetid)},registerevents:function registerevents(a){var b=this.fetch_instance_props(a);b.audioblob=!1;b.savebutton.click(function(){var a=atob(b.audiodatacontrol.val()),c=a&&0 .poodll_save-recording").hide(),a("#"+b+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(a){},fetch_status_bar:function(a){var b='
00:00:00
';return b},fetch_preview_audio:function(a){var b='';return b},fetch_preview_video:function(a){var b='';return b},fetch_resource_audio:function(a){var b="";return b},fetch_resource_video:function(a){var b="";return b},fetch_uploader_skin:function(a,b){var c=this.fetch_instanceprops(),d=i.clone();return d.init(c.config,b,c.controlbar.bmr_progresscanvas,c.controlbar.status),d},onMediaError:function(a){console.error("media error",a)},onMediaSuccess_video:function(a){var b=this.fetch_instanceprops();b.uploader.Output(""),this.set_visual_mode("recordmode",a),b.timer.reset(),b.timer.start(),this.update_status(a)},onMediaSuccess_audio:function(a){var b=this.fetch_instanceprops();b.uploader.Output(""),b.controlbar.preview.attr("src",null),this.set_visual_mode("recordmode",a),this.therecanim.start(),b.timer.reset(),b.timer.start(),this.update_status(a)},handle_timer_update:function(a){var b=this.fetch_instanceprops();b.controlbar.status.html(b.timer.fetch_display_time()),0==b.timer.seconds&&b.timer.initseconds>0&&b.controlbar.startbutton.hasClass("poodll_in_progress")&&b.controlbar.startbutton.click()},update_status:function(a){var b=this.fetch_instanceprops();b.controlbar.status.html(b.timer.fetch_display_time())},set_visual_mode:function(a,b){var c=this,d=this.fetch_instanceprops();switch(this.visualmode=a,a){case"initmode":d.controlbar.statusText.text("Ready to record"),d.controlbar.status.html("00:00:00"),d.controlbar.stoprecbutton.attr("class","poodll_stop-recording_fresh poodll_fresh_stop_btn bmr_disabled"),d.controlbar.startbutton.attr("class","poodll_start-recording_fresh poodll_fresh_main_btn"),d.controlbar.playbutton.attr("class","poodll_play-recording_fresh poodll_fresh_play_btn bmr_disabled"),c.disable_button(d.controlbar.savebutton),c.disable_button(d.controlbar.recordAgain);break;case"recordmode":d.controlbar.statusText.text("Recording.."),c.enable_button(d.controlbar.startbutton),c.show_element(d.controlbar.startbutton),c.hide_element(d.controlbar.bmr_progresscanvas),c.enable_button(d.controlbar.pausebutton),c.show_element(d.controlbar.pausebutton),c.disable_button(d.controlbar.playbutton),c.hide_element(d.controlbar.resumebutton),c.enable_button(d.controlbar.stoprecbutton),c.disable_button(d.controlbar.savebutton),c.disable_button(d.controlbar.recordAgain),d.controlbar.preview.addClass("poodll_recording"),d.controlbar.status.addClass("poodll_recording"),d.controlbar.preview.removeClass("poodll_playing"),d.controlbar.status.removeClass("poodll_playing"),d.controlbar.startbutton.addClass("poodll_in_progress").removeClass("poodll_resume_button"),d.controlbar.playbutton.removeClass("poodll_play_special poodll_play_green"),"audio"==d.config.mediatype&&c.hide_element(d.controlbar.preview),d.controlbar.root.removeClass("poodll_controllbar_playmode");break;case"previewmode":d.controlbar.statusText.text("Ready to Play"),c.disable_button(d.controlbar.stoprecbutton),c.disable_button(d.controlbar.startbutton),c.enable_button(d.controlbar.playbutton),c.disable_button(d.controlbar.pausebutton),d.controlbar.status.html(d.timer.fetch_display_time(d.timer.finalSeconds)),c.show_element(d.controlbar.startbutton),c.disable_button(d.controlbar.resumebutton),c.hide_element(d.controlbar.resumebutton),c.hide_element(d.controlbar.bmr_progresscanvas),c.uploaded?(c.disable_button(d.controlbar.savebutton),c.disable_button(d.controlbar.recordAgain)):(c.enable_button(d.controlbar.savebutton),c.enable_button(d.controlbar.recordAgain)),c.show_element(d.controlbar.pausebutton),d.controlbar.preview.removeClass("poodll_recording"),d.controlbar.status.removeClass("poodll_recording"),d.controlbar.preview.removeClass("poodll_playing"),d.controlbar.status.removeClass("poodll_playing"),d.controlbar.startbutton.removeClass("poodll_in_progress"),d.controlbar.playbutton.addClass("poodll_play_green").removeClass("poodll_play_special").removeClass("poodll_play_pause").removeClass("poodll_stop_green"),"audio"==d.config.mediatype&&c.show_element(d.controlbar.preview),c.enable_button(d.controlbar.playbutton),d.controlbar.root.removeClass("poodll_controllbar_playmode poodll_controllbar_pausemode");break;case"playmode":d.controlbar.statusText.text("Playing"),d.controlbar.status.html("00:00:00"),c.enable_button(d.controlbar.stoprecbutton),c.enable_button(d.controlbar.pausebutton),c.disable_button(d.controlbar.startbutton),c.disable_button(d.controlbar.resumebutton),c.disable_button(d.controlbar.savebutton),c.disable_button(d.controlbar.recordAgain),c.show_element(d.controlbar.bmr_progresscanvas),d.controlbar.playbutton.removeClass("poodll_play_green").removeClass("poodll_play_special").addClass("poodll_stop_green"),d.controlbar.preview.addClass("poodll_playing"),d.controlbar.status.addClass("poodll_playing"),c.show_element(d.controlbar.startbutton),c.hide_element(d.controlbar.resumebutton),d.controlbar.root.addClass("poodll_controllbar_playmode").removeClass("poodll_controllbar_pausemode");break;case"pausedmode":d.controlbar.statusText.text("Paused"),c.show_element(d.controlbar.resumebutton),c.enable_button(d.controlbar.resumebutton),c.enable_button(d.controlbar.savebutton),d.controlbar.preview.removeClass("poodll_recording"),d.controlbar.status.removeClass("poodll_recording"),d.controlbar.startbutton.removeClass("poodll_in_progress").addClass("poodll_resume_button"),d.controlbar.playbutton.removeClass("poodll_play_green").removeClass("poodll_play_pause"),d.controlbar.root.addClass("poodll_controllbar_pausemode");break;case"uploadmode":d.controlbar.statusText.text("Uploading"),c.disable_button(d.controlbar.savebutton),c.disable_button(d.controlbar.recordAgain),c.disable_button(d.controlbar.startbutton),c.show_element(d.controlbar.bmr_progresscanvas),d.controlbar.root.removeClass("poodll_controllbar_playmode poodll_controllbar_pausemode")}},insert_controlbar_video:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"video");return e},insert_controlbar_audio:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"audio");return e},prepare_controlbar:function(b,c,d,e,f){var g=this.fetch_instanceprops(),h=g.config.media_skin_style,i="poodll_mediarecorder_size_auto";switch(g.config.size){case"small":i="poodll_mediarecorder_size_small";break;case"big":i="poodll_mediarecorder_size_big";break;case"auto":i="poodll_mediarecorder_size_auto"}var j=this.pmr.fetch_strings(),k="video"==f?"poodll_mediarecorder_video":"poodll_mediarecorder_audio",l='
';l+='
',l+='',l+='
',l+='
';var m=this.fetch_status_bar("fresh");l+=m,l+="
",l+='
'+j.recui_readytorecord+'
",l+=d,l+="
",l+=this.devsettings.fetch_dialogue_box(),l+=g.downloaddialog.fetch_dialogue_box(),l+=g.errordialog.fetch_dialogue_box(),l+="
",l+="
",a(b).prepend(l);var n={poodll_recording_alert:a("#"+c+" .poodll-alert-recording"),bmr_progresscanvas:a("#"+c+" .fresh_range"),settingsdialog:a("#"+c+" .poodll_dialogue_box_settings"),downloaddialog:a("#"+c+" .poodll_dialogue_box_download"),errorsdialog:a("#"+c+" .poodll_dialogue_box_errors"),settingsicon:a("#"+c+" .settingsicon"),status:a("#"+c+" .poodll_status_fresh"),statusText:a("#"+c+" .poodll_fresh_txt_control"),preview:a("#"+c+" .poodll_preview_fresh"),startbutton:a("#"+c+" .poodll_start-recording_fresh"),stoprecbutton:a("#"+c+" .poodll_stop-recording_fresh"),pausebutton:a("#"+c+" .poodll_pause-recording_fresh"),resumebutton:a("#"+c+" .poodll_resume-recording_fresh"),playbutton:a("#"+c+" .poodll_play-recording_fresh"),stopbutton:a("#"+c+" .poodll_stop-playing-recording_fresh"),savebutton:a("#"+c+" .poodll_save-recording_fresh"),recordAgain:a("#"+c+" .poodll_fresh_record_btn"),playcanvas:a("#"+c+"_playcanvas"),root:a("#"+c)};return g.downloaddialog.set_dialogue_box(n.downloaddialog),g.errordialog.set_dialogue_box(n.errorsdialog),this.devsettings.set_dialogue_box(n.settingsdialog),n},register_controlbar_events_video:function(a,b){return this.register_controlbar_events_audio(a,b)},register_controlbar_events_audio:function(b,c){var d=this,e=this.pmr,h=this.fetch_instanceprops();h.controlbar.settingsicon.click(function(){d.uploaded?h.downloaddialog.open():d.devsettings.open()});var i=f.clone();i.init(h.controlbar.bmr_progresscanvas),i.readyBars();var j=g.clone();j.init(h.audioanalyser,h.controlbar.playcanvas.get(0)),h.controlbar.startbutton.click(function(){if(a(this).hasClass("poodll_in_progress")){e.do_stop_audio(h);var f=h.controlbar.preview;f&&f.get(0)&&f.get(0).pause(),j.clear(),h.timer.stop(),d.update_status(c),d.set_visual_mode("previewmode",c)}else a(this).hasClass("poodll_resume_button")?(e.do_resume_audio(h),h.timer.resume(),d.update_status(c),d.set_visual_mode("recordmode",c)):(d.therecanim=j,e.do_start_audio(h,b))}),h.controlbar.recordAgain.click(function(){e.do_stop_audio(h),d.update_status(c),d.set_visual_mode("initmode",c)}),h.controlbar.stoprecbutton.click(function(){e.do_stop_audio(h);var a=h.controlbar.preview;a&&a.get(0)&&a.get(0).pause(),j.clear(),h.timer.stop(),d.update_status(c),d.set_visual_mode("previewmode",c)}),h.controlbar.pausebutton.click(function(){e.do_pause_audio(h);var a=h.controlbar.preview;a&&a.get(0)&&(a.get(0).pause(),a.get(0).controls=!1),console.log("PAUSE"),h.timer.pause(),d.update_status(c),d.set_visual_mode("pausedmode",c)}),h.controlbar.resumebutton.click(function(){e.do_resume_audio(h),h.timer.resume(),d.update_status(c),d.set_visual_mode("recordmode",c)}),h.controlbar.preview.on("timeupdate",function(){if("playmode"==d.visualmode){var a=this.currentTime;h.controlbar.status.html(h.timer.fetch_display_time(a))}}),h.controlbar.stopbutton.click(function(){e.do_stop_audio(h);var a=h.controlbar.preview;a&&a.get(0)&&a.get(0).pause(),j.clear(),h.timer.stop(),d.update_status(c),d.set_visual_mode("previewmode",c)}),h.controlbar.playbutton.click(function(){if(a(this).hasClass("poodll_play_pause")){var b=h.controlbar.preview.get(0);e.do_stopplay_audio(h,b),e.do_stop_audio(h),h.timer.pause(),d.update_status(c),d.set_visual_mode("pausedmode",c)}else if(a(this).hasClass("poodll_stop_green")){e.do_stop_audio(h);var b=h.controlbar.preview;b&&b.get(0)&&b.get(0).pause(),j.clear(),h.timer.stop(),d.update_status(c),d.set_visual_mode("previewmode",c)}else{var b=h.controlbar.preview.get(0);e.do_play_audio(h,b),d.set_visual_mode("playmode",c),i.clear(),i.fetchCurrent=function(){var a=h.controlbar.preview.prop("currentTime"),b=h.controlbar.preview.prop("duration");return isFinite(b)||(b=h.timer.finalseconds),a/b},i.start();var f=h.controlbar.preview.prop("currentTime"),g=h.controlbar.preview.prop("duration");i.playBars(f,g)}}),h.controlbar.savebutton.click(function(){return h.blobs&&h.blobs.length>0?(d.set_visual_mode("uploadmode",c),e.do_save_audio(h),d.uploaded=!0):h.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll")),!1}),window.onbeforeunload=function(){d.enable_button(h.controlbar.startbutton);var a=h.controlbar.preview;a&&a.get(0)&&(a.get(0).pause(),a.get(0).controls=!1)}},show_element:function(b){a(b).show()},hide_element:function(b){a(b).hide()},enable_button:function(b){a(b).attr("disabled",!1),a(b).removeClass("bmr_disabled")},disable_button:function(b){a(b).attr("disabled",!0),a(b).addClass("bmr_disabled")}}}); \ No newline at end of file +define ("filter_poodll/poodll_freshmediaskin",["jquery","jqueryui","core/log","filter_poodll/utils_amd","filter_poodll/dlg_devicesettings","filter_poodll/anim_progress_bar_fresh","filter_poodll/anim_hwave_fresh","filter_poodll/anim_hwave_timer","filter_poodll/upskin_text"],function(a,b,c,d,e,f,g,h,i){"use strict";c.debug("PoodLL BMR Skin: initialising");return{instanceprops:null,pmr:null,uploaded:!1,devsettings:null,therecanim:null,clone:function clone(){return a.extend(!0,{},this)},init:function init(a,b){this.instanceprops=a;this.pmr=b;this.devsettings=e.clone();this.devsettings.init(b,a)},fetch_instanceprops:function fetch_instanceprops(){return this.instanceprops},onUploadSuccess:function onUploadSuccess(b){a("#"+b+" > .poodll_save-recording").hide();a("#"+b+" > .poodll_savedsuccessfully").show()},onUploadFailure:function onUploadFailure(){},fetch_status_bar:function fetch_status_bar(a){return"
00:00:00
"},fetch_preview_audio:function fetch_preview_audio(a){return""},fetch_preview_video:function fetch_preview_video(a){return""},fetch_resource_audio:function fetch_resource_audio(){return""},fetch_resource_video:function fetch_resource_video(){return""},fetch_uploader_skin:function fetch_uploader_skin(a,b){var c=this.fetch_instanceprops(),d=i.clone();d.init(c.config,b,c.controlbar.bmr_progresscanvas,c.controlbar.status);return d},onMediaError:function onMediaError(a){console.error("media error",a)},onMediaSuccess_video:function onMediaSuccess_video(a){var b=this.fetch_instanceprops();b.uploader.Output("");this.set_visual_mode("recordmode",a);b.timer.reset();b.timer.start();this.update_status(a)},onMediaSuccess_audio:function onMediaSuccess_audio(a){var b=this.fetch_instanceprops();b.uploader.Output("");b.controlbar.preview.attr("src",null);this.set_visual_mode("recordmode",a);this.therecanim.start();b.timer.reset();b.timer.start();this.update_status(a)},handle_timer_update:function handle_timer_update(){var a=this.fetch_instanceprops();a.controlbar.status.html(a.timer.fetch_display_time());if(0==a.timer.seconds&&0";m+="
";m+="";m+="
";m+="
";var n=this.fetch_status_bar("fresh");m+=n;m+="
";m+="
"+j.recui_readytorecord+"
";m+=d;m+="
";m+=this.devsettings.fetch_dialogue_box();m+=g.downloaddialog.fetch_dialogue_box();m+=g.errordialog.fetch_dialogue_box();m+="
";m+="";a(b).prepend(m);var o={poodll_recording_alert:a("#"+c+" .poodll-alert-recording"),bmr_progresscanvas:a("#"+c+" .fresh_range"),settingsdialog:a("#"+c+" .poodll_dialogue_box_settings"),downloaddialog:a("#"+c+" .poodll_dialogue_box_download"),errorsdialog:a("#"+c+" .poodll_dialogue_box_errors"),settingsicon:a("#"+c+" .settingsicon"),status:a("#"+c+" .poodll_status_fresh"),statusText:a("#"+c+" .poodll_fresh_txt_control"),preview:a("#"+c+" .poodll_preview_fresh"),startbutton:a("#"+c+" .poodll_start-recording_fresh"),stoprecbutton:a("#"+c+" .poodll_stop-recording_fresh"),pausebutton:a("#"+c+" .poodll_pause-recording_fresh"),resumebutton:a("#"+c+" .poodll_resume-recording_fresh"),playbutton:a("#"+c+" .poodll_play-recording_fresh"),stopbutton:a("#"+c+" .poodll_stop-playing-recording_fresh"),savebutton:a("#"+c+" .poodll_save-recording_fresh"),recordAgain:a("#"+c+" .poodll_fresh_record_btn"),playcanvas:a("#"+c+"_playcanvas"),root:a("#"+c)};g.downloaddialog.set_dialogue_box(o.downloaddialog);g.errordialog.set_dialogue_box(o.errorsdialog);this.devsettings.set_dialogue_box(o.settingsdialog);return o},register_controlbar_events_video:function register_controlbar_events_video(a,b){return this.register_controlbar_events_audio(a,b)},register_controlbar_events_audio:function register_controlbar_events_audio(b,c){var d=this,e=this.pmr,h=this.fetch_instanceprops();h.controlbar.settingsicon.click(function(){if(!d.uploaded){d.devsettings.open()}else{h.downloaddialog.open()}});var i=f.clone();i.init(h.controlbar.bmr_progresscanvas);i.readyBars();var j=g.clone();j.init(h.audioanalyser,h.controlbar.playcanvas.get(0));h.controlbar.startbutton.click(function(){if(a(this).hasClass("poodll_in_progress")){e.do_stop_audio(h);var f=h.controlbar.preview;if(f&&f.get(0)){f.get(0).pause()}j.clear();h.timer.stop();d.update_status(c);d.set_visual_mode("previewmode",c)}else if(a(this).hasClass("poodll_resume_button")){e.do_resume_audio(h);h.timer.resume();d.update_status(c);d.set_visual_mode("recordmode",c)}else{d.therecanim=j;e.do_start_audio(h,b)}});h.controlbar.recordAgain.click(function(){e.do_stop_audio(h);d.update_status(c);d.set_visual_mode("initmode",c)});h.controlbar.stoprecbutton.click(function(){e.do_stop_audio(h);var a=h.controlbar.preview;if(a&&a.get(0)){a.get(0).pause()}j.clear();h.timer.stop();d.update_status(c);d.set_visual_mode("previewmode",c)});h.controlbar.pausebutton.click(function(){e.do_pause_audio(h);var a=h.controlbar.preview;if(a&&a.get(0)){a.get(0).pause();a.get(0).controls=!1}console.log("PAUSE");h.timer.pause();d.update_status(c);d.set_visual_mode("pausedmode",c)});h.controlbar.resumebutton.click(function(){e.do_resume_audio(h);h.timer.resume();d.update_status(c);d.set_visual_mode("recordmode",c)});h.controlbar.preview.on("timeupdate",function(){if("playmode"!=d.visualmode){return}var a=this.currentTime;h.controlbar.status.html(h.timer.fetch_display_time(a))});h.controlbar.stopbutton.click(function(){e.do_stop_audio(h);var a=h.controlbar.preview;if(a&&a.get(0)){a.get(0).pause()}j.clear();h.timer.stop();d.update_status(c);d.set_visual_mode("previewmode",c)});h.controlbar.playbutton.click(function(){if(a(this).hasClass("poodll_play_pause")){var b=h.controlbar.preview.get(0);e.do_stopplay_audio(h,b);e.do_stop_audio(h);h.timer.pause();d.update_status(c);d.set_visual_mode("pausedmode",c)}else if(a(this).hasClass("poodll_stop_green")){e.do_stop_audio(h);var b=h.controlbar.preview;if(b&&b.get(0)){b.get(0).pause()}j.clear();h.timer.stop();d.update_status(c);d.set_visual_mode("previewmode",c)}else{var b=h.controlbar.preview.get(0);e.do_play_audio(h,b);d.set_visual_mode("playmode",c);i.clear();i.fetchCurrent=function(){var a=h.controlbar.preview.prop("currentTime"),b=h.controlbar.preview.prop("duration");if(!isFinite(b)){b=h.timer.finalseconds}return a/b};i.start();var f=h.controlbar.preview.prop("currentTime"),g=h.controlbar.preview.prop("duration");i.playBars(f,g)}});h.controlbar.savebutton.click(function(){if(h.blobs&&0 .poodll_save-recording").hide(),a("#"+b+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(a){},fetch_status_bar:function(a){var b='
00:00:00
';return b},fetch_preview_audio:function(a){var b='';return b},fetch_preview_video:function(a){var b='';return b},fetch_resource_audio:function(a){var b='';return b},fetch_resource_video:function(a){var b='';return b},fetch_uploader_skin:function(a,b){return!1},onMediaError:function(a){console.error("media error",a)},onMediaSuccess_video:function(a){this.fetch_instanceprops(a);this.set_visual_mode("recordingmode",a)},onMediaSuccess_audio:function(a){var b=this.fetch_instanceprops(a);b.controlbar.preview.attr("src",null),b.uploader.Output(""),this.therecanim.start(),b.timer.reset(),b.timer.start(),this.update_status(a),this.set_visual_mode("recordingmode",a)},handle_timer_update:function(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time()),0==b.timer.seconds&&b.timer.initseconds>0&&b.controlbar.stopbutton.click()},update_status:function(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time())},set_visual_mode:function(a,b){var c=this,d=this.fetch_instanceprops(b);switch(a){case"startmode":c.enable_button(d.controlbar.startbutton),c.disable_button(d.controlbar.playbutton),c.disable_button(d.controlbar.stopbutton),d.showupload?c.disable_button(d.controlbar.savebutton):d.controlbar.savebutton.hide(),c.disable_button(d.controlbar.restartbutton);break;case"recordingmode":c.enable_button(d.controlbar.stopbutton),c.disable_button(d.controlbar.startbutton),c.disable_button(d.controlbar.playbutton),d.showupload?c.disable_button(d.controlbar.savebutton):d.controlbar.savebutton.hide(),c.disable_button(d.controlbar.restartbutton),"video"==d.config.mediatype&&d.controlbar.preview.removeClass("hide");break;case"previewmode":d.showupload?(d.controlbar.savebutton.removeClass("hide"),d.controlbar.savebutton.removeClass("pmr_disabled"),d.controlbar.savebutton.attr("disabled",!1)):(d.controlbar.savebutton.hide(),"video"==d.config.mediatype&&d.controlbar.preview.addClass("hide")),d.uploaded||(c.enable_button(d.controlbar.startbutton),c.enable_button(d.controlbar.restartbutton)),c.enable_button(d.controlbar.stopbutton),c.enable_button(d.controlbar.playbutton);break;case"playingmode":c.enable_button(d.controlbar.stopbutton),"video"==d.config.mediatype&&(c.enable_button(d.controlbar.preview),d.controlbar.preview.removeClass("hide")),c.disable_button(d.controlbar.startbutton),c.disable_button(d.controlbar.playbutton),c.disable_button(d.controlbar.restartbutton)}},insert_controlbar_video:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"video");return e},insert_controlbar_audio:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"audio");return e},prepare_controlbar:function(b,c,d,e,f){var g=this.fetch_instanceprops(c),h=g.config.media_skin_style,i="video"==f?"poodll_mediarecorder_video":"poodll_mediarecorder_audio",j="poodll_mediarecorder_size_auto";switch(g.config.size){case"small":j="poodll_mediarecorder_size_small";break;case"big":j="poodll_mediarecorder_size_big";break;case"auto":j="poodll_mediarecorder_size_auto"}var k=this.pmr.fetch_strings(),l='
';l+='
',l+=this.devsettings.fetch_dialogue_box(),l+=g.downloaddialog.fetch_dialogue_box(),l+=g.errordialog.fetch_dialogue_box(),l+='
';var m=this.fetch_status_bar("gold");l+=m,l+=d,l+='
',l+=' width="250" height="250">',l+='',l+='',l+='',l+=' ',l+='",l+="
",a(b).prepend(l);var n={settingsdialog:a("#"+c+" .poodll_dialogue_box_settings"),downloaddialog:a("#"+c+" .poodll_dialogue_box_download"),errorsdialog:a("#"+c+" .poodll_dialogue_box_errors"),settingsicon:a("#"+c+" .settingsicon"),status:a("#"+c+" .poodll_status_gold"),preview:a("#"+c+" .poodll_preview_gold"),startbutton:a("#"+c+" .poodll_start-recording_gold"),stopbutton:a("#"+c+" .poodll_stop-recording_gold"),stopplayingbutton:a("#"+c+" .poodll_stop-playing_gold"),playbutton:a("#"+c+" .poodll_play-recording_gold"),savebutton:a("#"+c+" .poodll_save-recording_gold"),restartbutton:a("#"+c+" .poodll_restart_gold"),playcanvas:a("#"+c+"_playcanvas")};return g.downloaddialog.set_dialogue_box(n.downloaddialog),g.errordialog.set_dialogue_box(n.errorsdialog),this.devsettings.set_dialogue_box(n.settingsdialog),n},register_controlbar_events_video:function(a,b){return this.register_controlbar_events_audio(a,b)},register_controlbar_events_audio:function(b,c){var d=this,j=this.pmr,k=this.fetch_instanceprops(c);this.set_visual_mode("startmode",c);var l=e.clone();l.init(k.controlbar.playcanvas);var m=null;switch(k.config.recanim){case"hwave":m=f.clone();break;case"fbars":m=g.clone();break;case"ripple":m=h.clone();break;case"words":m=i.clone();break;default:k.config.recanim="ripple";var m=h.clone()}m.init(k.audioanalyser,k.controlbar.playcanvas.get(0)),k.controlbar.settingsicon.click(function(){d.uploaded?k.downloaddialog.open():d.devsettings.open()}),"video"==k.config.mediatype&&k.controlbar.preview.addClass("hide"),k.controlbar.preview.click(function(){console.log("clicked preview"),a(this).addClass("hide"),a(k.controlbar.stopbutton).trigger("click"),a(this).hasClass("recorded")?a(this).removeClass("recorded"):a(this).addClass("recorded")}),k.controlbar.startbutton.click(function(){d.therecanim=m,j.do_start_audio(k,b)}),k.controlbar.restartbutton.click(function(){d.set_visual_mode("startmode",c)}),k.controlbar.stopbutton.click(function(){j.do_stop_audio(k);var a=k.controlbar.preview.get(0);a.pause(),m.clear(),l.stop(),k.timer.stop(),d.update_status(c),d.set_visual_mode("previewmode",c)}),k.controlbar.playbutton.click(function(){"video"==k.config.mediatype&&a(k.controlbar.preview).hasClass("recorder")&&(a(k.controlbar.preview).removeClass("recorder"),a(k.controlbar.preview).removeClass("hide"));var b=k.controlbar.preview.get(0);j.do_play_audio(k,b),l.clear(),l.fetchCurrent=function(){var a=k.controlbar.preview.prop("currentTime"),b=k.controlbar.preview.prop("duration");return isFinite(b)||(b=k.timer.finalseconds),a/b},l.start(),d.set_visual_mode("playingmode",c)}),k.controlbar.savebutton.click(function(){return k.blobs&&k.blobs.length>0?(j.do_save_audio(k),k.uploaded=!0,d.disable_button(k.controlbar.startbutton)):k.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll")),d.set_visual_mode("previewmode",c),!1}),window.onbeforeunload=function(){d.enable_button(k.controlbar.startbutton);var a=k.controlbar.preview;a&&a.get(0)&&a.get(0).pause()}},enable_button:function(b){a(b).attr("disabled",!1),a(b).removeClass("pmr_disabled")},disable_button:function(b){a(b).attr("disabled",!0),a(b).addClass("pmr_disabled")}}}); \ No newline at end of file +define ("filter_poodll/poodll_goldmediaskin",["jquery","jqueryui","core/log","filter_poodll/utils_amd","filter_poodll/anim_progress_radial","filter_poodll/anim_hwave","filter_poodll/anim_fbars","filter_poodll/anim_ripple","filter_poodll/anim_words","filter_poodll/speech_poodll","filter_poodll/dlg_devicesettings"],function(a,b,c,d,e,f,g,h,i,j,k){"use strict";c.debug("PoodLL Gold Skin: initialising");return{instanceprops:null,pmr:null,devsettings:null,therecanim:null,clone:function clone(){return a.extend(!0,{},this)},init:function init(a,b){this.instanceprops=a;this.pmr=b;this.devsettings=k.clone();this.devsettings.init(b,a)},fetch_instanceprops:function fetch_instanceprops(){return this.instanceprops},onUploadSuccess:function onUploadSuccess(b){a("#"+b+" > .poodll_save-recording").hide();a("#"+b+" > .poodll_savedsuccessfully").show()},onUploadFailure:function onUploadFailure(){},fetch_status_bar:function fetch_status_bar(a){return"
00:00:00
"},fetch_preview_audio:function fetch_preview_audio(a){return""},fetch_preview_video:function fetch_preview_video(a){return""},fetch_resource_audio:function fetch_resource_audio(a){return""},fetch_resource_video:function fetch_resource_video(a){return""},fetch_uploader_skin:function fetch_uploader_skin(){return!1},onMediaError:function onMediaError(a){console.error("media error",a)},onMediaSuccess_video:function onMediaSuccess_video(a){this.fetch_instanceprops(a);this.set_visual_mode("recordingmode",a)},onMediaSuccess_audio:function onMediaSuccess_audio(a){var b=this.fetch_instanceprops(a);b.controlbar.preview.attr("src",null);b.uploader.Output("");this.therecanim.start();b.timer.reset();b.timer.start();this.update_status(a);this.set_visual_mode("recordingmode",a)},handle_timer_update:function handle_timer_update(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time());if(0==b.timer.seconds&&0";k+="
";k+=this.devsettings.fetch_dialogue_box();k+=g.downloaddialog.fetch_dialogue_box();k+=g.errordialog.fetch_dialogue_box();k+="
";var l=this.fetch_status_bar("gold");k+=l,k+=d,k+="
";k+=" width=\"250\" height=\"250\">";k+="";k+="";k+="";k+=" ";k+="";k+="
";a(b).prepend(k);var m={settingsdialog:a("#"+c+" .poodll_dialogue_box_settings"),downloaddialog:a("#"+c+" .poodll_dialogue_box_download"),errorsdialog:a("#"+c+" .poodll_dialogue_box_errors"),settingsicon:a("#"+c+" .settingsicon"),status:a("#"+c+" .poodll_status_gold"),preview:a("#"+c+" .poodll_preview_gold"),startbutton:a("#"+c+" .poodll_start-recording_gold"),stopbutton:a("#"+c+" .poodll_stop-recording_gold"),stopplayingbutton:a("#"+c+" .poodll_stop-playing_gold"),playbutton:a("#"+c+" .poodll_play-recording_gold"),savebutton:a("#"+c+" .poodll_save-recording_gold"),restartbutton:a("#"+c+" .poodll_restart_gold"),playcanvas:a("#"+c+"_playcanvas")};g.downloaddialog.set_dialogue_box(m.downloaddialog);g.errordialog.set_dialogue_box(m.errorsdialog);this.devsettings.set_dialogue_box(m.settingsdialog);return m},register_controlbar_events_video:function register_controlbar_events_video(a,b){return this.register_controlbar_events_audio(a,b)},register_controlbar_events_audio:function register_controlbar_events_audio(b,c){var d=this,j=this.pmr,k=this.fetch_instanceprops(c);this.set_visual_mode("startmode",c);var l=e.clone();l.init(k.controlbar.playcanvas);var m=null;switch(k.config.recanim){case"hwave":m=f.clone();break;case"fbars":m=g.clone();break;case"ripple":m=h.clone();break;case"words":m=i.clone();break;default:k.config.recanim="ripple";var m=h.clone();}m.init(k.audioanalyser,k.controlbar.playcanvas.get(0));k.controlbar.settingsicon.click(function(){if(!d.uploaded){d.devsettings.open()}else{k.downloaddialog.open()}});if("video"==k.config.mediatype){k.controlbar.preview.addClass("hide")}k.controlbar.preview.click(function(){console.log("clicked preview");a(this).addClass("hide");a(k.controlbar.stopbutton).trigger("click");if(a(this).hasClass("recorded")){a(this).removeClass("recorded")}else{a(this).addClass("recorded")}});k.controlbar.startbutton.click(function(){d.therecanim=m;j.do_start_audio(k,b)});k.controlbar.restartbutton.click(function(){d.set_visual_mode("startmode",c)});k.controlbar.stopbutton.click(function(){j.do_stop_audio(k);var a=k.controlbar.preview.get(0);a.pause();m.clear();l.stop();k.timer.stop();d.update_status(c);d.set_visual_mode("previewmode",c)});k.controlbar.playbutton.click(function(){if("video"==k.config.mediatype){if(a(k.controlbar.preview).hasClass("recorder")){a(k.controlbar.preview).removeClass("recorder");a(k.controlbar.preview).removeClass("hide")}}var b=k.controlbar.preview.get(0);j.do_play_audio(k,b);l.clear();l.fetchCurrent=function(){var a=k.controlbar.preview.prop("currentTime"),b=k.controlbar.preview.prop("duration");if(!isFinite(b)){b=k.timer.finalseconds}return a/b};l.start();d.set_visual_mode("playingmode",c)});k.controlbar.savebutton.click(function(){if(k.blobs&&00&&(b.debug("playing type:"+d.blobs[0].type),c.doConcatenateBlobs(d.blobs,function(a){var b=URL.createObjectURL(a);e.src=b,e.controls=!0,e.volume=d.previewvolume,e.play()}),a(e).bind("ended",function(){d.controlbar.stopbutton.click()}))},do_play_video:function(a){},do_save_audio:function(a){a.blobs&&a.blobs.length>0&&(c.doConcatenateBlobs(a.blobs,function(b){a.uploader.uploadBlob(b,a.blobs[0].type)}),a.uploaded=!0,a.controlbar.startbutton.attr("disabled",!0))},do_save_video:function(a){},do_stop_audio:function(a){a.mediaRecorder.resume(),a.mediaRecorder.stop(),a.config.speechevents&&a.speechrec.supports_browser()&&a.speechrec.stop();var b={};b.type="recording",b.action="stopped",a.config.hermes.postMessage(b)},do_stop_video:function(a){},do_pause_audio:function(a){a.mediaRecorder.resume(),a.mediaRecorder.pause()},do_pause_video:function(a){},do_resume_audio:function(a){a.mediaRecorder.resume()},do_resume_video:function(a){},fetch_video_constraints:function(a){var b={audio:!c.is_opera()&&!c.is_edge(),video:!0};if(a.uservideodeviceid){var d=a.uservideodeviceid.valueOf(),e={deviceId:d?{exact:d}:void 0};b.video=e}if(a.useraudiodeviceid){var f=a.useraudiodeviceid.valueOf(),e={deviceId:f?{exact:f}:void 0};b.audio=e}return b},fetch_audio_constraints:function(a){var b={audio:!0};if(c.is_safari()&&!a.useraudiodeviceid,1,c.is_safari()&&!a.useraudiodeviceid&&(a.audiomimetype="audio/wav"),a.useraudiodeviceid){var d={deviceId:a.useraudiodeviceid};b.audio=d}return b},register_events_audio:function(a){var b=this,c=this.fetch_instanceprops(a),d=this.skins[a],e=function(e){b.laststream[a]=e;var f="auto";c.config.hasOwnProperty("encoder")&&(f=c.config.encoder),c.mediaRecorder=i,c.mediaRecorder.init(e,c.audioctx,c.audioanalyser,c.config.mediatype,f),c.mediaRecorder.mimeType=c.audiomimetype,c.mediaRecorder.audioChannels=1,c.mediaRecorder.start(c.timeinterval,c.audioctx),c.mediaRecorder.ondataavailable=function(a){c.blobs.push(a)};var g={};g.type="recording",g.action="started",c.config.hermes.postMessage(g),c.config.speechevents&&c.speechrec.supports_browser()&&c.speechrec.start(),d.onMediaSuccess_audio(a)};d.register_controlbar_events_audio(e,a)},register_events_video:function(a){var b=this,c=this.fetch_instanceprops(a),d=this.skins[a],e=function(e){b.restream_preview_video_player(a,e);var f="auto";c.config.hasOwnProperty("encoder")&&(f=c.config.encoder),c.mediaRecorder=i,c.mediaRecorder.init(e,c.audioctx,c.audioanalyser,c.config.mediatype,f),"mediarec"===c.videorecordertype&&(c.mediaRecorder.recorderType=MediaRecorderWrapper),c.mediaRecorder.videoWidth=c.videocapturewidth,c.mediaRecorder.videoHeight=c.videocaptureheight,c.mediaRecorder.start(c.timeinterval),c.mediaRecorder.ondataavailable=function(a){c.blobs.push(a)};var g={};g.type="recording",g.action="started",c.config.hermes.postMessage(g),c.config.speechevents&&c.speechrec.supports_browser()&&c.speechrec.start(),d.onMediaSuccess_video(a)};d.register_controlbar_events_video(e,a)},tidy_old_stream:function(a){this.laststream[a]&&this.laststream[a].getTracks().forEach(function(a){a.stop()})},restream_preview_video_player:function(a,b){this.laststream[a]=b,this.init_video_preview(a),c.is_android()&&navigator.mediaDevices.enumerateDevices()},init_video_preview:function(a){var c=this.fetch_instanceprops(a),d=c.controlbar.preview[0];d.srcObject=this.laststream[a],d.controls=!1,d.volume=0;var e=d.play();void 0!==e&&e.then(function(){})["catch"](function(a){b.debug("location: init_video_preview"),b.debug(a)})},update_status:function(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time())},fetch_controlbar_audio:function(a,b,c,d){var e=(this.fetch_instanceprops(b),this.fetch_skin(b)),f=e.insert_controlbar_audio(a,b,c,d);return f},fetch_controlbar_video:function(a,b,c,d){var e=(this.fetch_instanceprops(b),this.fetch_skin(b)),f=e.insert_controlbar_video(a,b,c,d);return f},fetch_strings:function(){var b=[],c=["record","play","pause","continue","stop","save","restart","testmic","upload","recordagain","readytorecord","downloadfile"];return a.each(c,function(a,c){b["recui_"+c]=M.util.get_string("recui_"+c,"filter_poodll"),(b["recui_"+c].indexOf(",filter_poodll]]")>1||""==b["recui_"+c])&&(b["recui_"+c]=c)}),b}}}); \ No newline at end of file +define ("filter_poodll/poodll_mediarecorder",["jquery","core/log","filter_poodll/utils_amd","filter_poodll/adapter","filter_poodll/uploader","filter_poodll/hermes","filter_poodll/timer","filter_poodll/audioanalyser","filter_poodll/msr_poodll","filter_poodll/dlg_errordisplay","filter_poodll/dlg_download","filter_poodll/speech_poodll","filter_poodll/poodll_mediaskins"],function(a,b,c,d,e,f,g,h,i,j,k,l,m){"use strict";b.debug("PoodLL Media Recorder: initialising");return{instanceprops:[],skins:[],laststream:[],fetch_instanceprops:function fetch_instanceprops(a){return this.instanceprops[a]},fetch_skin:function fetch_skin(a){return this.skins[a]},is_ios:function is_ios(){return c.is_ios()},supports_current_browser:function supports_current_browser(a){var d=0==M.cfg.wwwroot.indexOf("https:")||0==M.cfg.wwwroot.indexOf("http://localhost");if(!d){return!1}if("audio"!=a.mediatype&&"video"!=a.mediatype){return!1}var e=c.can_html5_record(a.mediatype);if(e){b.debug("PoodLL Media Recorder: supports this browser")}return e},xxxxsupports_current_browser:function xxxxsupports_current_browser(a){if("audio"!=a.mediatype&&"video"!=a.mediatype){return!1}var d=0==M.cfg.wwwroot.indexOf("https:")||0==M.cfg.wwwroot.indexOf("http://localhost");if(d&&navigator&&navigator.mediaDevices&&navigator.mediaDevices.getUserMedia){var e=!1;switch(a.mediatype){case"audio":if(c.is_safari()&&!c.is_ios()&&!a.html5ondsafari){e=!1}else{e=!0}break;case"video":var f=-1!==c.is_edge()&&(!!navigator.msSaveBlob||!!navigator.msSaveOrOpenBlob),g=c.is_safari();if(!f&&!g){e=!0}}if(e){b.debug("PoodLL Media Recorder: supports this browser")}return e}else{return!1}},embed:function embed(a,c){var d=this,h="filter_poodll_controlbar_"+c.widgetid;this.init_instance_props(h);var i=this.fetch_instanceprops(h);i.config=c;i.controlbarid=h;if(c.hideupload){i.showupload=!1}else{i.showupload=!0}i.timeinterval=c.media_timeinterval;i.audiomimetype=c.media_audiomimetype;i.videorecordertype=c.media_videorecordertype;i.videocaptureheight=c.media_videocaptureheight;i.errordialog=j.clone();i.errordialog.init(i);i.downloaddialog=k.clone();i.downloaddialog.init(this,i);i.config.hermes=f.clone();i.config.hermes.init(c.id,c.allowedURL,c.iframeembed);var l=this.init_skin(h,i.config.media_skin,i);if(c.speechevents&&i.speechrec.supports_browser()){if(!c.language){c.language="en-US"}i.speechrec.init(i.config.language);i.speechrec.onfinalspeechcapture=function(a){i.config.hermes.postMessage({type:"speech",capturedspeech:a});if(l.hasOwnProperty("onfinalspeechcapture")){l.onfinalspeechcapture(a)}}}i.config.onuploadsuccess=function(a){d.onUploadSuccess(a,l)};i.config.onuploadfailure=function(a){d.onUploadFailure(a,l)};switch(c.mediatype){case"audio":var m=l.fetch_preview_audio(c.media_skin),n=l.fetch_resource_audio(c.media_skin);i.controlbar=this.fetch_controlbar_audio(a,h,m,n);i.uploader=e.clone();var o=l.fetch_uploader_skin(i.controlbarid,a);i.uploader.init(a,c,o);this.register_events_audio(h);if("upload"==i.config.media_skin||"warning"==i.config.media_skin){break}navigator.mediaDevices.getUserMedia({audio:!0}).then(function(){b.debug("successfully forced permissions and got user media")}).catch(function(a){b.debug("location 9998");b.debug(a);i.errordialog.open(a)});break;case"video":var m=l.fetch_preview_video(c.media_skin),n=l.fetch_resource_video(c.media_skin);i.controlbar=this.fetch_controlbar_video(a,h,m,n);i.uploader=e.clone();var o=l.fetch_uploader_skin(i.controlbarid,a);i.uploader.init(a,c,o);this.register_events_video(h);if("upload"==i.config.media_skin||"warning"==i.config.media_skin){break}navigator.mediaDevices.getUserMedia({audio:!0,video:!0}).then(function(a){d.restream_preview_video_player(h,a)}).catch(function(a){b.debug("location 9999");b.debug(a)});break;}i.timer=g.clone();i.timer.init(i.config.timelimit,function(){l.handle_timer_update(h)});l.handle_timer_update(h);return l},init_instance_props:function init_instance_props(a){this.instanceprops[a]={};this.instanceprops[a].recorded_index=0;this.instanceprops[a].mediaRecorder=null;this.instanceprops[a].blobs=[];this.instanceprops[a].timeinterval=5e3;this.instanceprops[a].audiomimetype="audio/webm";this.instanceprops[a].videorecordertype="auto";this.instanceprops[a].videocapturewidth=320;this.instanceprops[a].videocaptureheight=240;this.instanceprops[a].controlbar="";this.instanceprops[a].previewvolume=1;this.instanceprops[a].timer={};this.instanceprops[a].timer={};this.instanceprops[a].showupload=!0;this.instanceprops[a].uploader={};this.instanceprops[a].uploaded=!1;this.instanceprops[a].useraudiodeviceid=!1;this.instanceprops[a].uservideodeviceid=!1;this.instanceprops[a].devices=[];var c=window.AudioContext||window.webkitAudioContext||!1;if("undefined"==typeof window.poodllmediarecorder_actx){var d=new c;window.poodllmediarecorder_actx=d;window.poodllmediarecorder_actx_cnt=1}else if(6==window.poodllmediarecorder_actx_cnt){var d=window.poodllmediarecorder_actx;b.debug("More than 6 contexts, reusing first one. visualizations might go weird")}else{var d=new c;window.poodllmediarecorder_actx_cnt+=1}this.instanceprops[a].audioctx=d;var e=h.clone();e.init(d);this.instanceprops[a].audioanalyser=e;this.instanceprops[a].previewstillcold=!0;this.instanceprops[a].speechrec=l.clone()},init_skin:function init_skin(a,b,c){this.skins[a]=m.fetch_skin_clone(b);this.skins[a].init(c,this);return this.skins[a]},onUploadSuccess:function onUploadSuccess(a,c){b.debug("from poodllmediarecorder: uploadsuccess");c.onUploadSuccess("filter_poodll_controlbar_"+a)},onUploadFailure:function onUploadFailure(a,c){b.debug("from poodllmediarecorder: uploadfailure");c.onUploadFailure("filter_poodll_controlbar_"+a);c.fetch_instanceprops().downloaddialog.open(c.pmr,c.instanceprops)},onMediaError:function onMediaError(a,c){c.errordialog.open(a);b.error("media error",a)},captureUserMedia:function captureUserMedia(a,b,c){navigator.mediaDevices.getUserMedia(a).then(b).catch(c)},warmup_context:function warmup_context(a){var b=a.audioctx;if("suspended"==b.state){b.resume()}var c=b.createBuffer(1,1,22050),d=b.createBufferSource();d.buffer=c;d.connect(b.destination);d.start(0)},warmup_preview:function warmup_preview(a){var c=a.controlbar.preview;if(a.previewstillcold&&c&&c.get(0)){var d=a.controlbar.preview[0].play();if(d!==void 0){d.then(function(){}).catch(function(a){b.debug(a)})}a.previewstillcold=!1}},do_start_audio:function do_start_audio(a,b){var c=this;this.warmup_context(a);this.warmup_preview(a);a.blobs=[];switch(a.config.mediatype){case"audio":var d=this.fetch_audio_constraints(a);break;case"video":var d=this.fetch_video_constraints(a);}this.tidy_old_stream(a.controlbarid);this.captureUserMedia(d,b,function(b){c.onMediaError(b,a)})},do_start_video:function do_start_video(){},do_stopplay_audio:function do_stopplay_audio(a,b){b.pause()},do_play_audio:function do_play_audio(d,e){if(d.blobs&&0'+M.util.get_string("recui_openrecorderapp","filter_poodll")+"";a(b).prepend(e)},insert_audio_button:function(b,c){var d=this.fetch_instance_props(c),e=''+M.util.get_string("recui_openrecorderapp","filter_poodll")+"";a(b).prepend(e)},insert_upload_button:function(b,c){var d=this.fetch_instance_props(c),e=''+M.util.get_string("recui_uploadafile","filter_poodll")+"";a(b).prepend(e)},confirm_s3_arrival:function(a){var b=this.fetch_instance_props(a),c=new XMLHttpRequest,d=b.config,e=d.wwwroot+"/filter/poodll/poodllfilelib.php",f="datatype=confirmarrival";f+="&mediatype="+d.mediatype,f+="&filename="+d.filename,c.open("POST",e,!0),c.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),c.setRequestHeader("Cache-Control","no-cache"),c.setRequestHeader("Content-length",f.length),c.setRequestHeader("Connection","close"),c.addEventListener("load",function(){c.response&&c.response.indexOf(d.filename)>0?(b.uploader.pokeFilename(d.filename,b.uploader),b.uploader.postprocess_s3_upload(b.uploader),b.uploader.Output(M.util.get_string("recui_uploadsuccess","filter_poodll")),b.uploader.doCallback(b.uploader,d.filename)):setTimeout(function(){c.open("POST",e,!0),c.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),c.setRequestHeader("Cache-Control","no-cache"),c.setRequestHeader("Content-length",f.length),c.setRequestHeader("Connection","close"),c.send(f)},2e3)}),c.send(f)}}}); \ No newline at end of file +define ("filter_poodll/poodll_mobilerecorder",["jquery","core/log","filter_poodll/utils_amd","filter_poodll/uploader","filter_poodll/poodll_uploadrecorder"],function(a,b,c,d,e){"use strict";b.debug("PoodLL Mobile Recorder: initialising");return{instanceprops:[],fetch_instance_props:function fetch_instance_props(a){return this.instanceprops[a]},init_instance_props:function init_instance_props(a){this.instanceprops[a]={config:null,uploader:null,linkid:null}},supports_current_browser:function supports_current_browser(a){if("audio"!=a.mediatype&&"video"!=a.mediatype){return!1}var b=c.is_ios();return b},embed:function embed(a,b){this.init_instance_props(b.widgetid);var c=this.fetch_instance_props(b.widgetid);c.config=b;c.uploader=d.clone();c.uploader.init(a,b);c.linkid="filter_poodll_mobilerecorder_link_"+b.widgetid;switch(b.mediatype){case"audio":this.insert_upload_button(a,b.widgetid);if(1==b.showmobile){this.insert_audio_button(a,b.widgetid)}break;case"video":this.insert_upload_button(a,b.widgetid);if(1==b.showmobile){this.insert_video_button(a,b.widgetid)}break;}this.register_events(a,b.widgetid);return!0},register_events:function register_events(b,c){var d=this.fetch_instance_props(c),f=d.config,g=this;a("#"+d.linkid).on("mousedown touchstart",function(){g.confirm_s3_arrival(c);d.uploader.Output(M.util.get_string("recui_awaitingconfirmation","filter_poodll"))});a("#"+d.linkid+"_uploadafile").on("mousedown touchstart",function(){a(b).empty();e.embed(b,f)})},insert_video_button:function insert_video_button(b,c){var d=this.fetch_instance_props(c),e=""+M.util.get_string("recui_openrecorderapp","filter_poodll")+"";a(b).prepend(e)},insert_audio_button:function insert_audio_button(b,c){var d=this.fetch_instance_props(c),e=""+M.util.get_string("recui_openrecorderapp","filter_poodll")+"";a(b).prepend(e)},insert_upload_button:function insert_upload_button(b,c){var d=this.fetch_instance_props(c),e=""+M.util.get_string("recui_uploadafile","filter_poodll")+"";a(b).prepend(e)},confirm_s3_arrival:function confirm_s3_arrival(a){var b=this.fetch_instance_props(a),c=new XMLHttpRequest,d=b.config,e=d.wwwroot+"/filter/poodll/poodllfilelib.php",f="datatype=confirmarrival";f+="&mediatype="+d.mediatype;f+="&filename="+d.filename;c.open("POST",e,!0);c.setRequestHeader("Content-Type","application/x-www-form-urlencoded");c.setRequestHeader("Cache-Control","no-cache");c.setRequestHeader("Content-length",f.length);c.setRequestHeader("Connection","close");c.addEventListener("load",function(){if(c.response&&0 .poodll_save-recording").hide(),a("#"+b+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(a){},fetch_status_bar:function(a){var b='
00:00:00
';return b},fetch_preview_audio:function(a){var b='';return b},fetch_preview_video:function(a){var b='';return b},fetch_resource_audio:function(a){var b='';return b},fetch_resource_video:function(a){var b='';return b},onMediaError:function(a){console.error("media error",a)},onMediaSuccess_video:function(a){var b=this.fetch_instanceprops();b.uploader.Output(""),b.timer.reset(),b.timer.start(),this.update_status(a),this.set_visual_mode("recordingmode",a)},onMediaSuccess_audio:function(a){var b=this.fetch_instanceprops();b.controlbar.preview.attr("src",null),b.uploader.Output(""),this.therecanim.start(),b.timer.reset(),b.timer.start(),this.update_status(a),this.set_visual_mode("recordingmode",a)},handle_timer_update:function(a){var b=this.fetch_instanceprops();this.therecanim.displaytime=b.timer.fetch_display_time(),this.update_status(a),0==b.timer.seconds&&b.timer.initseconds>0&&b.controlbar.stopbutton.click()},update_status:function(a){var b=this.fetch_instanceprops();b.controlbar.status.html(b.timer.fetch_display_time())},fetch_uploader_skin:function(a,b){var c=this.fetch_instanceprops(),d=e.clone();return d.init(c.config,b,c.controlbar.uploadcanvas,c.controlbar.uploadmessages),d.setDrawParam("lineWidth",2),d.setDrawParam("font","14px Arial"),d},set_visual_mode:function(a,b){var c=this,d=this.fetch_instanceprops();switch(a){case"readymode":d.controlbar.status.show(),c.enable_button(d.controlbar.startbutton),c.disable_button(d.controlbar.finishedbutton),c.disable_button(d.controlbar.stopbutton),d.controlbar.uploadcanvas.hide(),c.therecanim.setDrawParam("wavColor","#CCCCCC"),c.therecanim.clear(),"video"==d.config.mediatype?(d.controlbar.playcanvas.hide(),d.controlbar.preview.show()):(d.controlbar.playcanvas.show(),d.controlbar.preview.hide());break;case"recordingmode":c.enable_button(d.controlbar.stopbutton),c.disable_button(d.controlbar.startbutton),"video"==d.config.mediatype?(d.controlbar.playcanvas.hide(),d.controlbar.preview.show()):(d.controlbar.playcanvas.show(),d.controlbar.preview.hide()),d.controlbar.uploadcanvas.hide(),c.therecanim.setDrawParam("wavColor","#FF0000"),c.therecanim.clear(),d.controlbar.status.show();break;case"aftermode":c.disable_button(d.controlbar.startbutton),c.disable_button(d.controlbar.stopbutton),c.therecanim.setDrawParam("wavColor","#CCCCCC"),c.therecanim.clear(),d.controlbar.playcanvas.hide(),"video"==d.config.mediatype&&d.controlbar.preview.hide(),d.controlbar.uploadcanvas.show(),d.controlbar.status.show()}},insert_controlbar_video:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"video");return e},insert_controlbar_audio:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"audio");return e},prepare_controlbar:function(b,c,d,e,f){var g=this.fetch_instanceprops(),h=g.config.media_skin_style,i="video"==f?"poodll_mediarecorder_video":"poodll_mediarecorder_audio",j=this.pmr.fetch_strings(),k=j.recui_record,l=(j.recui_testmic,j.recui_stop),m=this.fetch_status_bar("once"),n='
';n+='
',n+=this.devsettings.fetch_dialogue_box(),n+=g.downloaddialog.fetch_dialogue_box(),n+=g.errordialog.fetch_dialogue_box(),n+='
',n+=d,n+='
',n+='',n+=m,n+='",n+='",n+="audio"==f?'':'',n+='
',n+="
",a(b).prepend(n);var o={settingsdialog:a("#"+c+" .poodll_dialogue_box_settings"),downloaddialog:a("#"+c+" .poodll_dialogue_box_download"),errorsdialog:a("#"+c+" .poodll_dialogue_box_errors"),settingsicon:a("#"+c+" .settingsicon"),status:a("#"+c+" .poodll_status_once"),preview:a("#"+c+" .poodll_preview_once"),startbutton:a("#"+c+" .poodll_start-recording_once"),stopbutton:a("#"+c+" .poodll_stop-recording_once"),playcanvas:a("#"+c+"_playcanvas"),uploadcanvas:a("#"+c+"_uploadcanvas"),uploadmessages:a("#"+c+" .poodll_uploadmessages_once")};return g.downloaddialog.set_dialogue_box(o.downloaddialog),g.errordialog.set_dialogue_box(o.errorsdialog),this.devsettings.set_dialogue_box(o.settingsdialog),o},register_controlbar_events_video:function(a,b){return this.register_controlbar_events_audio(a,b)},register_controlbar_events_audio:function(a,b){var c=this,d=this.pmr,e=this.fetch_instanceprops();e.config.recanim="hwave_mic";var g=f.clone();c.therecanim=g,g.init(e.audioanalyser,e.controlbar.playcanvas.get(0)),this.set_visual_mode("readymode",b),e.controlbar.settingsicon.click(function(){c.uploaded?e.downloaddialog.open():c.devsettings.open()}),e.controlbar.startbutton.click(function(){e.config.hermes.enable(),e.timer.enable(),d.do_start_audio(e,a)}),e.controlbar.stopbutton.click(function(){d.do_stop_audio(e),g.clear(),e.timer.stop(),c.update_status(b);var a=function(){e.blobs&&e.blobs.length>0?(d.do_save_audio(e),e.uploaded=!0,c.disable_button(e.controlbar.startbutton)):setTimeout(a,200)};setTimeout(a,200),c.set_visual_mode("aftermode",b)}),window.onbeforeunload=function(){}},enable_button:function(b){a(b).attr("disabled",!1),a(b).removeClass("pmr_disabled")},disable_button:function(b){a(b).attr("disabled",!0),a(b).addClass("pmr_disabled")}}}); \ No newline at end of file +define ("filter_poodll/poodll_oncemediaskin",["jquery","jqueryui","core/log","filter_poodll/utils_amd","filter_poodll/upskin_radial","filter_poodll/anim_hwave_mic","filter_poodll/dlg_devicesettings"],function(a,b,c,d,e,f,g){"use strict";c.debug("PoodLL Once Recorder Skin: initialising");return{instanceprops:null,pmr:null,devsettings:null,therecanim:null,clone:function clone(){return a.extend(!0,{},this)},init:function init(a,b){this.instanceprops=a;this.pmr=b;this.devsettings=g.clone();this.devsettings.init(b,a)},fetch_instanceprops:function fetch_instanceprops(){return this.instanceprops},onUploadSuccess:function onUploadSuccess(b){a("#"+b+" > .poodll_save-recording").hide();a("#"+b+" > .poodll_savedsuccessfully").show()},onUploadFailure:function onUploadFailure(){},fetch_status_bar:function fetch_status_bar(a){return"
00:00:00
"},fetch_preview_audio:function fetch_preview_audio(a){return""},fetch_preview_video:function fetch_preview_video(a){return""},fetch_resource_audio:function fetch_resource_audio(a){return""},fetch_resource_video:function fetch_resource_video(a){return""},onMediaError:function onMediaError(a){console.error("media error",a)},onMediaSuccess_video:function onMediaSuccess_video(a){var b=this.fetch_instanceprops();b.uploader.Output("");b.timer.reset();b.timer.start();this.update_status(a);this.set_visual_mode("recordingmode",a)},onMediaSuccess_audio:function onMediaSuccess_audio(a){var b=this.fetch_instanceprops();b.controlbar.preview.attr("src",null);b.uploader.Output("");this.therecanim.start();b.timer.reset();b.timer.start();this.update_status(a);this.set_visual_mode("recordingmode",a)},handle_timer_update:function handle_timer_update(a){var b=this.fetch_instanceprops();this.therecanim.displaytime=b.timer.fetch_display_time();this.update_status(a);if(0==b.timer.seconds&&0";o+="
";o+=this.devsettings.fetch_dialogue_box();o+=g.downloaddialog.fetch_dialogue_box();o+=g.errordialog.fetch_dialogue_box();o+="
";o+=d,o+="
";o+="";o+=n,o+="";o+="";if("audio"==f){o+=""}else{o+=""}o+="
";o+="
";a(b).prepend(o);var p={settingsdialog:a("#"+c+" .poodll_dialogue_box_settings"),downloaddialog:a("#"+c+" .poodll_dialogue_box_download"),errorsdialog:a("#"+c+" .poodll_dialogue_box_errors"),settingsicon:a("#"+c+" .settingsicon"),status:a("#"+c+" .poodll_status_once"),preview:a("#"+c+" .poodll_preview_once"),startbutton:a("#"+c+" .poodll_start-recording_once"),stopbutton:a("#"+c+" .poodll_stop-recording_once"),playcanvas:a("#"+c+"_playcanvas"),uploadcanvas:a("#"+c+"_uploadcanvas"),uploadmessages:a("#"+c+" .poodll_uploadmessages_once")};g.downloaddialog.set_dialogue_box(p.downloaddialog);g.errordialog.set_dialogue_box(p.errorsdialog);this.devsettings.set_dialogue_box(p.settingsdialog);return p},register_controlbar_events_video:function register_controlbar_events_video(a,b){return this.register_controlbar_events_audio(a,b)},register_controlbar_events_audio:function register_controlbar_events_audio(a,b){var c=this,d=this.pmr,e=this.fetch_instanceprops();e.config.recanim="hwave_mic";var g=f.clone();c.therecanim=g;g.init(e.audioanalyser,e.controlbar.playcanvas.get(0));this.set_visual_mode("readymode",b);e.controlbar.settingsicon.click(function(){if(!c.uploaded){c.devsettings.open()}else{e.downloaddialog.open()}});e.controlbar.startbutton.click(function(){e.config.hermes.enable();e.timer.enable();d.do_start_audio(e,a)});e.controlbar.stopbutton.click(function(){d.do_stop_audio(e);g.clear();e.timer.stop();c.update_status(b);var a=function(){if(e.blobs&&0 .poodll_save-recording").hide(),a("#"+b+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(a){},fetch_status_bar:function(a){var b='
00:00:00
';return b},fetch_preview_audio:function(a){var b='';return b},fetch_preview_video:function(a){var b='';return b},fetch_resource_audio:function(a){var b='';return b},fetch_resource_video:function(a){var b='';return b},fetch_uploader_skin:function(a,b){var c=this.fetch_instanceprops(a),d=h.clone();return d.init(c.config,b,c.controlbar.progresscanvas,c.controlbar.timer),d},onMediaError:function(a){console.error("media error",a)},onMediaSuccess_video:function(a){var b=this.fetch_instanceprops(a);b.uploader.Output(""),this.set_visual_mode("recordmode",a),b.timer.reset(),b.timer.start(),this.update_status(a),this.stage="recorded"},onMediaSuccess_audio:function(a){var b=this.fetch_instanceprops(a);b.uploader.Output(""),this.set_visual_mode("recordmode",a),b.timer.reset(),b.timer.start(),this.update_status(a),b.controlbar.preview.attr("src",null),this.stage="recorded"},handle_timer_update:function(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time()),0==b.timer.seconds&&b.timer.initseconds>0&&b.controlbar.stoprecbutton.click()},update_status:function(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time())},set_visual_mode:function(b,c){var d=this,e=this.fetch_instanceprops(c);switch(b){case"recordmode":e.controlbar.progress.hide(),e.controlbar.preview.addClass("poodll_recording"),e.controlbar.status.addClass("poodll_recording"),"audio"==e.config.mediatype&&e.controlbar.preview.addClass("hide"),e.controlbar.status.removeClass("hide"),d.disable_button(this),d.disable_button(e.controlbar.playbutton),e.controlbar.playbutton.show(),d.disable_button(e.controlbar.stopbutton),e.controlbar.stopbutton.hide(),d.disable_button(e.controlbar.savebutton),e.controlbar.savebutton.show(),d.enable_button(e.controlbar.stoprecbutton),e.controlbar.stoprecbutton.show(),e.controlbar.startbutton.hide();break;case"previewmode":e.controlbar.playbutton.hide(),d.enable_button(e.controlbar.stopbutton),e.controlbar.stopbutton.show(),d.disable_button(e.controlbar.startbutton),e.controlbar.startbutton.show(),d.disable_button(e.controlbar.resumebutton),e.controlbar.resumebutton.hide(),d.disable_button(e.controlbar.playbutton),e.controlbar.preview.removeClass("poodll_recording"),e.controlbar.status.removeClass("poodll_recording"),"audio"==e.config.mediatype?e.controlbar.preview.removeClass("hide"):e.controlbar.status.removeClass("hide"),e.controlbar.status.addClass("hide"),e.controlbar.progresscanvas.hasClass("hide")&&(e.controlbar.progresscanvas.removeClass("hide"),e.controlbar.progresscanvas.show()),a(this).hasClass("played")||(a(this).addClass("played"),e.controlbar.steptwo.empty(),e.controlbar.steptwo.append('').hide().fadeIn(1e3));break;case"pausedmode":d.enable_button(e.controlbar.startbutton),e.controlbar.startbutton.show(),d.enable_button(e.controlbar.playbutton),e.controlbar.playbutton.show(),d.disable_button(e.controlbar.savebutton),e.controlbar.savebutton.show(),e.controlbar.preview.removeClass("poodll_recording"),e.controlbar.status.removeClass("poodll_recording"),e.controlbar.stoprecbutton.hide(),e.controlbar.timer.html("00:00:00"),e.controlbar.status.addClass("hide"),e.controlbar.progress.show(),e.controlbar.stepone.empty(),e.controlbar.stepone.append('').hide().fadeIn(1e3),d.disable_button(e.controlbar.stoprecbutton);break;case"stopplayingmode":d.uploaded||(d.enable_button(e.controlbar.savebutton),d.enable_button(e.controlbar.startbutton)),e.controlbar.progresscanvas.hasClass("hide")||(e.controlbar.timer.html("00:00:00"),e.controlbar.progresscanvas.addClass("hide"),e.controlbar.progresscanvas.hide()),e.controlbar.stopbutton.hide(),e.controlbar.playbutton.show(),e.controlbar.startbutton.show(),d.enable_button(e.controlbar.playbutton),d.disable_button(e.controlbar.stopbutton);break;case"uploadmode":d.disable_button(e.controlbar.startbutton),e.controlbar.progresscanvas.removeClass("hide"),e.controlbar.progresscanvas.show();break;case"savemode":d.disable_button(e.controlbar.savebutton),e.controlbar.stepthree.empty(),e.controlbar.stepthree.append('').hide().fadeIn(1e3)}},insert_controlbar_video:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"video");return e},insert_controlbar_audio:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"audio");return e},prepare_controlbar:function(b,c,d,e,f){var g=this.fetch_instanceprops(c),h=g.config.media_skin_style,i="video"==f?"poodll_mediarecorder_video":"poodll_mediarecorder_audio",j="poodll_mediarecorder_size_auto";switch(g.config.size){case"small":j="poodll_mediarecorder_size_small";break;case"big":j="poodll_mediarecorder_size_big";break;case"auto":j="poodll_mediarecorder_size_auto"}var k=this.pmr.fetch_strings(),l='
';l+='",a(b).prepend(l);var n={settingsdialog:a("#"+c+" .poodll_dialogue_box_settings"),downloaddialog:a("#"+c+" .poodll_dialogue_box_download"),errorsdialog:a("#"+c+" .poodll_dialogue_box_errors"),settingsicon:a("#"+c+" .settingsicon"),stepone:a("#"+c+" .step-1"),steptwo:a("#"+c+" .step-2"),stepthree:a("#"+c+" .step-3"),progresscanvas:a("#"+c+" .hp_range"),progress:a("#"+c+" .hp_slide"),timer:a("#"+c+" .hp_timer"),status:a("#"+c+" .poodll_status_onetwothree"),preview:a("#"+c+" .poodll_preview_onetwothree"),startbutton:a("#"+c+" .poodll_start-recording_onetwothree"),stoprecbutton:a("#"+c+" .poodll_stop-recording_onetwothree"),stopbutton:a("#"+c+" .poodll_stop-playing_onetwothree"),pausebutton:a("#"+c+" .poodll_pause-recording_onetwothree"),resumebutton:a("#"+c+" .poodll_resume-recording_onetwothree"),playbutton:a("#"+c+" .poodll_play-recording_onetwothree"),savebutton:a("#"+c+" .poodll_save-recording_onetwothree")};return g.downloaddialog.set_dialogue_box(n.downloaddialog),g.errordialog.set_dialogue_box(n.errorsdialog),this.devsettings.set_dialogue_box(n.settingsdialog),n},register_controlbar_events_video:function(a,b){return this.register_controlbar_events_audio(a,b)},register_controlbar_events_audio:function(a,b){var d=this,f=this.pmr,g=this.stage,h=this.fetch_instanceprops(b),i=e.clone();i.init(h.controlbar.progresscanvas),h.controlbar.settingsicon.click(function(){d.uploaded?h.downloaddialog.open():d.devsettings.open()}),h.controlbar.startbutton.click(function(){f.do_start_audio(h,a)}),h.controlbar.stoprecbutton.click(function(){f.do_stop_audio(h),d.set_visual_mode("pausedmode",b),h.timer.stop(),h.timer.reset(),d.update_status(b)}),h.controlbar.stopbutton.click(function(){d.set_visual_mode("stopplayingmode",b);var a=h.controlbar.preview.get(0);f.do_stopplay_audio(h,a),i.stop()}),h.controlbar.playbutton.click(function(){h.controlbar.preview.on("timeupdate",function(){var a=this.currentTime;h.controlbar.timer.html(h.timer.fetch_display_time(a))});var a=h.controlbar.preview.get(0);f.do_play_audio(h,a),d.set_visual_mode("previewmode",b),g="played",i.clear(),i.fetchCurrent=function(){var a=h.controlbar.preview.prop("currentTime"),b=h.controlbar.preview.prop("duration");return isFinite(b)||(b=h.timer.finalseconds),a/b},i.start()}),h.controlbar.savebutton.click(function(){return d.set_visual_mode("savemode",b),c.debug("save"),h.blobs&&h.blobs.length>0?(f.do_save_audio(h),d.uploaded=!0,d.set_visual_mode("uploadmode",b),g="saved"):h.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll")),!1}),window.onbeforeunload=function(){d.enable_button(h.controlbar.startbutton);var a=h.controlbar.preview;a&&a.get(0)&&a.get(0).pause()}},enable_button:function(b){a(b).attr("disabled",!1),a(b).removeClass("pmr_disabled")},disable_button:function(b){a(b).attr("disabled",!0),a(b).addClass("pmr_disabled")}}}); \ No newline at end of file +define ("filter_poodll/poodll_onetwothreemediaskin",["jquery","jqueryui","core/log","filter_poodll/utils_amd","filter_poodll/anim_progress_bar","filter_poodll/speech_poodll","filter_poodll/dlg_devicesettings","filter_poodll/upskin_bar"],function(a,b,c,d,e,f,g,h){"use strict";c.debug("PoodLL One Two Three Skin: initialising");return{instanceprops:null,pmr:null,stage:"none",uploaded:!1,devsettings:null,clone:function clone(){return a.extend(!0,{},this)},init:function init(a,b){this.instanceprops=a;this.pmr=b;this.devsettings=g.clone();this.devsettings.init(b,a)},fetch_instanceprops:function fetch_instanceprops(){return this.instanceprops},onUploadSuccess:function onUploadSuccess(b){a("#"+b+" > .poodll_save-recording").hide();a("#"+b+" > .poodll_savedsuccessfully").show()},onUploadFailure:function onUploadFailure(){},fetch_status_bar:function fetch_status_bar(a){return"
00:00:00
"},fetch_preview_audio:function fetch_preview_audio(a){return""},fetch_preview_video:function fetch_preview_video(a){return""},fetch_resource_audio:function fetch_resource_audio(a){return""},fetch_resource_video:function fetch_resource_video(a){return""},fetch_uploader_skin:function fetch_uploader_skin(a,b){var c=this.fetch_instanceprops(a),d=h.clone();d.init(c.config,b,c.controlbar.progresscanvas,c.controlbar.timer);return d},onMediaError:function onMediaError(a){console.error("media error",a)},onMediaSuccess_video:function onMediaSuccess_video(a){var b=this.fetch_instanceprops(a);b.uploader.Output("");this.set_visual_mode("recordmode",a);b.timer.reset();b.timer.start();this.update_status(a);this.stage="recorded"},onMediaSuccess_audio:function onMediaSuccess_audio(a){var b=this.fetch_instanceprops(a);b.uploader.Output("");this.set_visual_mode("recordmode",a);b.timer.reset();b.timer.start();this.update_status(a);b.controlbar.preview.attr("src",null);this.stage="recorded"},handle_timer_update:function handle_timer_update(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time());if(0==b.timer.seconds&&0").hide().fadeIn(1e3)}break;case"pausedmode":d.enable_button(e.controlbar.startbutton);e.controlbar.startbutton.show();d.enable_button(e.controlbar.playbutton);e.controlbar.playbutton.show();d.disable_button(e.controlbar.savebutton);e.controlbar.savebutton.show();e.controlbar.preview.removeClass("poodll_recording");e.controlbar.status.removeClass("poodll_recording");e.controlbar.stoprecbutton.hide();e.controlbar.timer.html("00:00:00");e.controlbar.status.addClass("hide");e.controlbar.progress.show();e.controlbar.stepone.empty();e.controlbar.stepone.append("").hide().fadeIn(1e3);d.disable_button(e.controlbar.stoprecbutton);break;case"stopplayingmode":if(!d.uploaded){d.enable_button(e.controlbar.savebutton);d.enable_button(e.controlbar.startbutton)}if(!e.controlbar.progresscanvas.hasClass("hide")){e.controlbar.timer.html("00:00:00");e.controlbar.progresscanvas.addClass("hide");e.controlbar.progresscanvas.hide()}e.controlbar.stopbutton.hide();e.controlbar.playbutton.show();e.controlbar.startbutton.show();d.enable_button(e.controlbar.playbutton);d.disable_button(e.controlbar.stopbutton);break;case"uploadmode":d.disable_button(e.controlbar.startbutton);e.controlbar.progresscanvas.removeClass("hide");e.controlbar.progresscanvas.show();break;case"savemode":d.disable_button(e.controlbar.savebutton);e.controlbar.stepthree.empty();e.controlbar.stepthree.append("").hide().fadeIn(1e3);break;}},insert_controlbar_video:function insert_controlbar_video(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"video");return e},insert_controlbar_audio:function insert_controlbar_audio(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"audio");return e},prepare_controlbar:function prepare_controlbar(b,c,d,e,f){var g=this.fetch_instanceprops(c),h=g.config.media_skin_style,i="video"==f?"poodll_mediarecorder_video":"poodll_mediarecorder_audio",j="poodll_mediarecorder_size_auto";switch(g.config.size){case"small":j="poodll_mediarecorder_size_small";break;case"big":j="poodll_mediarecorder_size_big";break;case"auto":j="poodll_mediarecorder_size_auto";}var k=this.pmr.fetch_strings(),l="
";l+="
";l+="
";var m=this.fetch_status_bar("onetwothree");l+=m,l+="
";l+="
";l+=d,l+="
";l+=" ";l+="";l+="";l+=" ";l+=" ";l+="";l+="";l+="
";l+="
";l+="

"+k.recui_record+"

";l+="

"+k.recui_play+"

";l+="

"+k.recui_save+"

";l+="
";l+="
";l+="
";l+=this.devsettings.fetch_dialogue_box();l+=g.downloaddialog.fetch_dialogue_box();l+=g.errordialog.fetch_dialogue_box();l+="
";a(b).prepend(l);var n={settingsdialog:a("#"+c+" .poodll_dialogue_box_settings"),downloaddialog:a("#"+c+" .poodll_dialogue_box_download"),errorsdialog:a("#"+c+" .poodll_dialogue_box_errors"),settingsicon:a("#"+c+" .settingsicon"),stepone:a("#"+c+" .step-1"),steptwo:a("#"+c+" .step-2"),stepthree:a("#"+c+" .step-3"),progresscanvas:a("#"+c+" .hp_range"),progress:a("#"+c+" .hp_slide"),timer:a("#"+c+" .hp_timer"),status:a("#"+c+" .poodll_status_onetwothree"),preview:a("#"+c+" .poodll_preview_onetwothree"),startbutton:a("#"+c+" .poodll_start-recording_onetwothree"),stoprecbutton:a("#"+c+" .poodll_stop-recording_onetwothree"),stopbutton:a("#"+c+" .poodll_stop-playing_onetwothree"),pausebutton:a("#"+c+" .poodll_pause-recording_onetwothree"),resumebutton:a("#"+c+" .poodll_resume-recording_onetwothree"),playbutton:a("#"+c+" .poodll_play-recording_onetwothree"),savebutton:a("#"+c+" .poodll_save-recording_onetwothree")};g.downloaddialog.set_dialogue_box(n.downloaddialog);g.errordialog.set_dialogue_box(n.errorsdialog);this.devsettings.set_dialogue_box(n.settingsdialog);return n},register_controlbar_events_video:function register_controlbar_events_video(a,b){return this.register_controlbar_events_audio(a,b)},register_controlbar_events_audio:function register_controlbar_events_audio(a,b){var d=this,f=this.pmr,g=this.stage,h=this.fetch_instanceprops(b),i=e.clone();i.init(h.controlbar.progresscanvas);h.controlbar.settingsicon.click(function(){if(!d.uploaded){d.devsettings.open()}else{h.downloaddialog.open()}});h.controlbar.startbutton.click(function(){f.do_start_audio(h,a)});h.controlbar.stoprecbutton.click(function(){f.do_stop_audio(h);d.set_visual_mode("pausedmode",b);h.timer.stop();h.timer.reset();d.update_status(b)});h.controlbar.stopbutton.click(function(){d.set_visual_mode("stopplayingmode",b);var a=h.controlbar.preview.get(0);f.do_stopplay_audio(h,a);i.stop()});h.controlbar.playbutton.click(function(){h.controlbar.preview.on("timeupdate",function(){var a=this.currentTime;h.controlbar.timer.html(h.timer.fetch_display_time(a))});var a=h.controlbar.preview.get(0);f.do_play_audio(h,a);d.set_visual_mode("previewmode",b);g="played";i.clear();i.fetchCurrent=function(){var a=h.controlbar.preview.prop("currentTime"),b=h.controlbar.preview.prop("duration");if(!isFinite(b)){b=h.timer.finalseconds}return a/b};i.start()});h.controlbar.savebutton.click(function(){d.set_visual_mode("savemode",b);c.debug("save");if(h.blobs&&000:00:00
';return b},fetch_preview_audio:function(a){var b='';return b},fetch_preview_video:function(a){return this.fetch_preview_audio(a)},fetch_resource_audio:function(a){var b='';return b},fetch_resource_video:function(a){return this.fetch_resource_audio(a)},onfinalspeechcapture:function(a){this.just_stop()},onMediaError:function(a){console.error("media error",a)},onMediaSuccess_video:function(a){this.fetch_instanceprops();this.set_visual_mode("startbuttonrecording",a)},onMediaSuccess_audio:function(a){var b=this.fetch_instanceprops(a);b.controlbar.preview.attr("src",null),b.uploader.Output(""),this.therecanim.start(),b.timer.reset(),b.timer.start(),this.update_status(a),this.set_visual_mode("startbuttonrecording",a)},handle_timer_update:function(a){var b=this.fetch_instanceprops();b.controlbar.status.html(b.timer.fetch_display_time()),0==b.timer.seconds&&b.timer.initseconds>0&&this.stop_and_upload(a)},update_status:function(a){var b=this.fetch_instanceprops();b.controlbar.status.html(b.timer.fetch_display_time())},fetch_uploader_skin:function(a,b){var c=this.fetch_instanceprops(),d=f.clone();return d.init(c.config,b,c.controlbar.playcanvas,c.controlbar.status),d},set_button_style:function(b){var c=["testbuttonready","testbuttonrecording","startbuttonready","startbuttoncountdown","startbuttonrecording","uploading","allfinished"];a.each(c,function(b,c){a(".poodll_mediarecorderbox_push").removeClass("poodll_mediarecorder_push_"+c),a(".poodll_mediarecorderbox_push").removeClass("push_canclick")}),a(".poodll_mediarecorderbox_push").addClass("poodll_mediarecorder_push_"+b),"testbuttonready"!=b&&"startbuttonready"!=b||a(".poodll_mediarecorderbox_push").addClass("push_canclick")},set_visual_mode:function(a){var b=this,c=this.fetch_instanceprops();this.buttonmode=a;var d={};d.type="recorderstatus",d.status=a,c.config.hermes.postMessage(d);var e='';switch(a){case"startbuttonready":c.controlbar.thecaption.text(b.strings.recui_pushtospeak),c.controlbar.thecaption.show(),c.controlbar.playcanvas.hide(),c.controlbar.status.hide(),c.controlbar.settingsicon.hide(),b.set_button_style(a);break;case"startbuttonrecording":c.controlbar.thecaption.hide(),c.controlbar.playcanvas.show(),b.set_button_style(a),c.controlbar.status.hide();break;case"uploading":c.controlbar.thecaption.html(e),c.controlbar.thecaption.show(),c.controlbar.playcanvas.hide(),b.set_button_style(a),c.controlbar.status.hide();break;case"allfinished":c.controlbar.thecaption.text("Finished"),c.controlbar.thecaption.show(),c.controlbar.playcanvas.hide(),c.controlbar.status.hide(),b.set_button_style(a)}},insert_controlbar_video:function(a,b,c,d){return this.prepare_controlbar_audio(a,b,c,d)},insert_controlbar_audio:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"audio");return e},prepare_controlbar:function(b,c,d,e,f){var g=this.fetch_instanceprops(),h=g.config.media_skin_style,i="poodll_mediarecorder_audio",j=this.fetch_status_bar("push"),k='
';k+='
',k+=this.devsettings.fetch_dialogue_box(),k+=g.downloaddialog.fetch_dialogue_box(),k+=g.errordialog.fetch_dialogue_box(),k+='
',k+=d,k+='
',k+='',k+='',k+='',k+='',k+=j,k+="
",a(b).prepend(k);var l={settingsdialog:a("#"+c+" .poodll_dialogue_box_settings"),downloaddialog:a("#"+c+" .poodll_dialogue_box_download"),errorsdialog:a("#"+c+" .poodll_dialogue_box_errors"),settingsicon:a("#"+c+" .settingsicon"),status:a("#"+c+" .poodll_status_push"),preview:a("#"+c+" .poodll_preview_push"),bigbutton:a("#"+c+".poodll_mediarecorderbox_push"),playcanvas:a("#"+c+"_playcanvas"),thecaption:a("#"+c+"_caption"),themicicon:a("#"+c+"_micicon"),stopbutton:a("#"+c+" .poodll_mediarecorder_bogusstopbutton_push"),startbutton:a("#"+c+" .poodll_mediarecorder_bogusstartbutton_push")};return g.downloaddialog.set_dialogue_box(l.downloaddialog),g.errordialog.set_dialogue_box(l.errorsdialog),this.devsettings.set_dialogue_box(l.settingsdialog),l},register_controlbar_events_video:function(a,b){return this.register_controlbar_events_audio(a,b)},register_controlbar_events_audio:function(b,d){var e=this,f=this.pmr,h=this.fetch_instanceprops();h.config.recanim="hwave_mic";var i=g.clone();e.therecanim=i,i.init(h.audioanalyser,h.controlbar.playcanvas.get(0)),this.set_visual_mode("startbuttonready"),h.controlbar.bigbutton.click(function(g){c.debug(g.target);var i=!1;if((g.target===e||a(g.target).hasClass("style-holder")||a(g.target).hasClass("poodll_mediarecorderbox_push")||a(g.target).hasClass("poodll_mediarecorder_caption_push")||a(g.target).hasClass("poodll_mediarecorder_playcanvas_push"))&&(i=!0),i)switch(e.buttonmode){case"startbuttonready":var j={};j.type="recorderstatus",j.status="startbuttonrecording",h.config.hermes.postMessage(j),h.timer.disable(),f.do_start_audio(h,b),e.set_visual_mode("startbuttonrecording");break;case"startbuttonrecording":e.just_stop(d);break;case"oldstartbuttonready":var k=function(){var a=(new Date).getTime(),c=a-l;if(c>m)h.timer.enable(),f.do_start_audio(h,b);else{var d=!1;if(n<0&&c>0?d=m/1e3:n<1e3&&c>1e3?d=m/1e3-1:n<2e3&&c>2e3&&(d=m/1e3-2),d){var e={};e.type="countdownstatus",e.status=d,h.config.hermes.postMessage(e)}n=c,setTimeout(k,100)}};h.config.hermes.enable(),e.set_visual_mode("startbuttoncountdown");var l=(new Date).getTime(),m=3e3,n=-1;setTimeout(k,100);break;case"stopbutton":e.stop_and_upload()}}),h.controlbar.settingsicon.click(function(a){c.debug("we no proapagato"),a.stopPropagation(),e.uploaded?h.downloaddialog.open():e.devsettings.open()}),window.onbeforeunload=function(){}},just_stop:function(){var a=this.pmr,b=this.fetch_instanceprops(),c=this.therecanim;b.mediaRecorder&&a.do_stop_audio(b),c.clear(),b.config.hermes.enable(),this.set_visual_mode("startbuttonready")},stop_and_upload:function(a){var b=this,c=this.pmr,d=this.fetch_instanceprops(),e=b.therecanim;c.do_stop_audio(d),e.clear(),d.timer.stop(),b.update_status(a);var f=function(){d.blobs&&d.blobs.length>0?(c.do_save_audio(d),d.uploaded=!0):setTimeout(f,200)};setTimeout(f,200),b.set_visual_mode("uploading")},enable_button:function(b){a(b).attr("disabled",!1),a(b).removeClass("pmr_disabled")},disable_button:function(b){a(b).attr("disabled",!0),a(b).addClass("pmr_disabled")}}}); \ No newline at end of file +define ("filter_poodll/poodll_pushmediaskin",["jquery","jqueryui","core/log","filter_poodll/utils_amd","filter_poodll/upskin_radial","filter_poodll/upskin_bar","filter_poodll/anim_hwave_mic","filter_poodll/dlg_devicesettings"],function(a,b,c,d,e,f,g,h){"use strict";c.debug("PoodLL Push Skin: initialising");return{instanceprops:null,pmr:null,devsettings:null,therecanim:null,buttonmode:null,strings:null,clone:function clone(){return a.extend(!0,{},this)},init:function init(a,b){this.instanceprops=a;this.pmr=b;this.devsettings=h.clone();this.devsettings.init(b,a);this.strings=this.pmr.fetch_strings();this.strings.recui_pushtospeak=M.util.get_string("recui_pushtospeak","filter_poodll")},fetch_instanceprops:function fetch_instanceprops(){return this.instanceprops},onUploadSuccess:function onUploadSuccess(a){this.set_visual_mode("allfinished",a)},onUploadFailure:function onUploadFailure(){},fetch_status_bar:function fetch_status_bar(a){return"
00:00:00
"},fetch_preview_audio:function fetch_preview_audio(a){return""},fetch_preview_video:function fetch_preview_video(a){return this.fetch_preview_audio(a)},fetch_resource_audio:function fetch_resource_audio(a){return""},fetch_resource_video:function fetch_resource_video(a){return this.fetch_resource_audio(a)},onfinalspeechcapture:function onfinalspeechcapture(){this.just_stop()},onMediaError:function onMediaError(a){console.error("media error",a)},onMediaSuccess_video:function onMediaSuccess_video(a){this.fetch_instanceprops();this.set_visual_mode("startbuttonrecording",a)},onMediaSuccess_audio:function onMediaSuccess_audio(a){var b=this.fetch_instanceprops(a);b.controlbar.preview.attr("src",null);b.uploader.Output("");this.therecanim.start();b.timer.reset();b.timer.start();this.update_status(a);this.set_visual_mode("startbuttonrecording",a)},handle_timer_update:function handle_timer_update(a){var b=this.fetch_instanceprops();b.controlbar.status.html(b.timer.fetch_display_time());if(0==b.timer.seconds&&0");c.controlbar.thecaption.show();c.controlbar.playcanvas.hide();b.set_button_style(a);c.controlbar.status.hide();break;case"allfinished":c.controlbar.thecaption.text("Finished");c.controlbar.thecaption.show();c.controlbar.playcanvas.hide();c.controlbar.status.hide();b.set_button_style(a);break;}},insert_controlbar_video:function insert_controlbar_video(a,b,c,d){return this.prepare_controlbar_audio(a,b,c,d)},insert_controlbar_audio:function insert_controlbar_audio(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"audio");return e},prepare_controlbar:function prepare_controlbar(b,c,d){var e=this.fetch_instanceprops(),f=e.config.media_skin_style,g=this.fetch_status_bar("push"),h="
";h+="
";h+=this.devsettings.fetch_dialogue_box();h+=e.downloaddialog.fetch_dialogue_box();h+=e.errordialog.fetch_dialogue_box();h+="
";h+=d,h+="
";h+="";h+="";h+="";h+="";h+=g,h+="
";a(b).prepend(h);var i={settingsdialog:a("#"+c+" .poodll_dialogue_box_settings"),downloaddialog:a("#"+c+" .poodll_dialogue_box_download"),errorsdialog:a("#"+c+" .poodll_dialogue_box_errors"),settingsicon:a("#"+c+" .settingsicon"),status:a("#"+c+" .poodll_status_push"),preview:a("#"+c+" .poodll_preview_push"),bigbutton:a("#"+c+".poodll_mediarecorderbox_push"),playcanvas:a("#"+c+"_playcanvas"),thecaption:a("#"+c+"_caption"),themicicon:a("#"+c+"_micicon"),stopbutton:a("#"+c+" .poodll_mediarecorder_bogusstopbutton_push"),startbutton:a("#"+c+" .poodll_mediarecorder_bogusstartbutton_push")};e.downloaddialog.set_dialogue_box(i.downloaddialog);e.errordialog.set_dialogue_box(i.errorsdialog);this.devsettings.set_dialogue_box(i.settingsdialog);return i},register_controlbar_events_video:function register_controlbar_events_video(a,b){return this.register_controlbar_events_audio(a,b)},register_controlbar_events_audio:function register_controlbar_events_audio(b,d){var f=this,h=this.pmr,i=this.fetch_instanceprops();i.config.recanim="hwave_mic";var e=g.clone();f.therecanim=e;e.init(i.audioanalyser,i.controlbar.playcanvas.get(0));this.set_visual_mode("startbuttonready");i.controlbar.bigbutton.click(function(g){c.debug(g.target);var e=!1;if(g.target===f||a(g.target).hasClass("style-holder")||a(g.target).hasClass("poodll_mediarecorderbox_push")||a(g.target).hasClass("poodll_mediarecorder_caption_push")||a(g.target).hasClass("poodll_mediarecorder_playcanvas_push")){e=!0}if(!e){return}switch(f.buttonmode){case"startbuttonready":var j={};j.type="recorderstatus";j.status="startbuttonrecording";i.config.hermes.postMessage(j);i.timer.disable();h.do_start_audio(i,b);f.set_visual_mode("startbuttonrecording");break;case"startbuttonrecording":f.just_stop(d);break;case"oldstartbuttonready":var k=function(){var a=new Date().getTime(),c=a-l;if(c>m){i.timer.enable();h.do_start_audio(i,b)}else{var d=!1;if(0>n&&0n&&1e3n&&2e36&&(b.setRegion(a-11,0,3,6),b.setRegion(0,a-11,6,3)),b},this.getECBlocksForLevel=function(a){return this.ecBlocks[a.ordinal()]}}function f(){return new Array(new e(1,new Array,new d(7,new c(1,19)),new d(10,new c(1,16)),new d(13,new c(1,13)),new d(17,new c(1,9))),new e(2,new Array(6,18),new d(10,new c(1,34)),new d(16,new c(1,28)),new d(22,new c(1,22)),new d(28,new c(1,16))),new e(3,new Array(6,22),new d(15,new c(1,55)),new d(26,new c(1,44)),new d(18,new c(2,17)),new d(22,new c(2,13))),new e(4,new Array(6,26),new d(20,new c(1,80)),new d(18,new c(2,32)),new d(26,new c(2,24)),new d(16,new c(4,9))),new e(5,new Array(6,30),new d(26,new c(1,108)),new d(24,new c(2,43)),new d(18,new c(2,15),new c(2,16)),new d(22,new c(2,11),new c(2,12))),new e(6,new Array(6,34),new d(18,new c(2,68)),new d(16,new c(4,27)),new d(24,new c(4,19)),new d(28,new c(4,15))),new e(7,new Array(6,22,38),new d(20,new c(2,78)),new d(18,new c(4,31)),new d(18,new c(2,14),new c(4,15)),new d(26,new c(4,13),new c(1,14))),new e(8,new Array(6,24,42),new d(24,new c(2,97)),new d(22,new c(2,38),new c(2,39)),new d(22,new c(4,18),new c(2,19)),new d(26,new c(4,14),new c(2,15))),new e(9,new Array(6,26,46),new d(30,new c(2,116)),new d(22,new c(3,36),new c(2,37)),new d(20,new c(4,16),new c(4,17)),new d(24,new c(4,12),new c(4,13))),new e(10,new Array(6,28,50),new d(18,new c(2,68),new c(2,69)),new d(26,new c(4,43),new c(1,44)),new d(24,new c(6,19),new c(2,20)),new d(28,new c(6,15),new c(2,16))),new e(11,new Array(6,30,54),new d(20,new c(4,81)),new d(30,new c(1,50),new c(4,51)),new d(28,new c(4,22),new c(4,23)),new d(24,new c(3,12),new c(8,13))),new e(12,new Array(6,32,58),new d(24,new c(2,92),new c(2,93)),new d(22,new c(6,36),new c(2,37)),new d(26,new c(4,20),new c(6,21)),new d(28,new c(7,14),new c(4,15))),new e(13,new Array(6,34,62),new d(26,new c(4,107)),new d(22,new c(8,37),new c(1,38)),new d(24,new c(8,20),new c(4,21)),new d(22,new c(12,11),new c(4,12))),new e(14,new Array(6,26,46,66),new d(30,new c(3,115),new c(1,116)),new d(24,new c(4,40),new c(5,41)),new d(20,new c(11,16),new c(5,17)),new d(24,new c(11,12),new c(5,13))),new e(15,new Array(6,26,48,70),new d(22,new c(5,87),new c(1,88)),new d(24,new c(5,41),new c(5,42)),new d(30,new c(5,24),new c(7,25)),new d(24,new c(11,12),new c(7,13))),new e(16,new Array(6,26,50,74),new d(24,new c(5,98),new c(1,99)),new d(28,new c(7,45),new c(3,46)),new d(24,new c(15,19),new c(2,20)),new d(30,new c(3,15),new c(13,16))),new e(17,new Array(6,30,54,78),new d(28,new c(1,107),new c(5,108)),new d(28,new c(10,46),new c(1,47)),new d(28,new c(1,22),new c(15,23)),new d(28,new c(2,14),new c(17,15))),new e(18,new Array(6,30,56,82),new d(30,new c(5,120),new c(1,121)),new d(26,new c(9,43),new c(4,44)),new d(28,new c(17,22),new c(1,23)),new d(28,new c(2,14),new c(19,15))),new e(19,new Array(6,30,58,86),new d(28,new c(3,113),new c(4,114)),new d(26,new c(3,44),new c(11,45)),new d(26,new c(17,21),new c(4,22)),new d(26,new c(9,13),new c(16,14))),new e(20,new Array(6,34,62,90),new d(28,new c(3,107),new c(5,108)),new d(26,new c(3,41),new c(13,42)),new d(30,new c(15,24),new c(5,25)),new d(28,new c(15,15),new c(10,16))),new e(21,new Array(6,28,50,72,94),new d(28,new c(4,116),new c(4,117)),new d(26,new c(17,42)),new d(28,new c(17,22),new c(6,23)),new d(30,new c(19,16),new c(6,17))),new e(22,new Array(6,26,50,74,98),new d(28,new c(2,111),new c(7,112)),new d(28,new c(17,46)),new d(30,new c(7,24),new c(16,25)),new d(24,new c(34,13))),new e(23,new Array(6,30,54,74,102),new d(30,new c(4,121),new c(5,122)),new d(28,new c(4,47),new c(14,48)),new d(30,new c(11,24),new c(14,25)),new d(30,new c(16,15),new c(14,16))),new e(24,new Array(6,28,54,80,106),new d(30,new c(6,117),new c(4,118)),new d(28,new c(6,45),new c(14,46)),new d(30,new c(11,24),new c(16,25)),new d(30,new c(30,16),new c(2,17))),new e(25,new Array(6,32,58,84,110),new d(26,new c(8,106),new c(4,107)),new d(28,new c(8,47),new c(13,48)),new d(30,new c(7,24),new c(22,25)),new d(30,new c(22,15),new c(13,16))),new e(26,new Array(6,30,58,86,114),new d(28,new c(10,114),new c(2,115)),new d(28,new c(19,46),new c(4,47)),new d(28,new c(28,22),new c(6,23)),new d(30,new c(33,16),new c(4,17))),new e(27,new Array(6,34,62,90,118),new d(30,new c(8,122),new c(4,123)),new d(28,new c(22,45),new c(3,46)),new d(30,new c(8,23),new c(26,24)),new d(30,new c(12,15),new c(28,16))),new e(28,new Array(6,26,50,74,98,122),new d(30,new c(3,117),new c(10,118)),new d(28,new c(3,45),new c(23,46)),new d(30,new c(4,24),new c(31,25)),new d(30,new c(11,15),new c(31,16))),new e(29,new Array(6,30,54,78,102,126),new d(30,new c(7,116),new c(7,117)),new d(28,new c(21,45),new c(7,46)),new d(30,new c(1,23),new c(37,24)),new d(30,new c(19,15),new c(26,16))),new e(30,new Array(6,26,52,78,104,130),new d(30,new c(5,115),new c(10,116)),new d(28,new c(19,47),new c(10,48)),new d(30,new c(15,24),new c(25,25)),new d(30,new c(23,15),new c(25,16))),new e(31,new Array(6,30,56,82,108,134),new d(30,new c(13,115),new c(3,116)),new d(28,new c(2,46),new c(29,47)),new d(30,new c(42,24),new c(1,25)),new d(30,new c(23,15),new c(28,16))),new e(32,new Array(6,34,60,86,112,138),new d(30,new c(17,115)),new d(28,new c(10,46),new c(23,47)),new d(30,new c(10,24),new c(35,25)),new d(30,new c(19,15),new c(35,16))),new e(33,new Array(6,30,58,86,114,142),new d(30,new c(17,115),new c(1,116)),new d(28,new c(14,46),new c(21,47)),new d(30,new c(29,24),new c(19,25)),new d(30,new c(11,15),new c(46,16))),new e(34,new Array(6,34,62,90,118,146),new d(30,new c(13,115),new c(6,116)),new d(28,new c(14,46),new c(23,47)),new d(30,new c(44,24),new c(7,25)),new d(30,new c(59,16),new c(1,17))),new e(35,new Array(6,30,54,78,102,126,150),new d(30,new c(12,121),new c(7,122)),new d(28,new c(12,47),new c(26,48)),new d(30,new c(39,24),new c(14,25)),new d(30,new c(22,15),new c(41,16))),new e(36,new Array(6,24,50,76,102,128,154),new d(30,new c(6,121),new c(14,122)),new d(28,new c(6,47),new c(34,48)),new d(30,new c(46,24),new c(10,25)),new d(30,new c(2,15),new c(64,16))),new e(37,new Array(6,28,54,80,106,132,158),new d(30,new c(17,122),new c(4,123)),new d(28,new c(29,46),new c(14,47)),new d(30,new c(49,24),new c(10,25)),new d(30,new c(24,15),new c(46,16))),new e(38,new Array(6,32,58,84,110,136,162),new d(30,new c(4,122),new c(18,123)),new d(28,new c(13,46),new c(32,47)),new d(30,new c(48,24),new c(14,25)),new d(30,new c(42,15),new c(32,16))),new e(39,new Array(6,26,54,82,110,138,166),new d(30,new c(20,117),new c(4,118)),new d(28,new c(40,47),new c(7,48)),new d(30,new c(43,24),new c(22,25)),new d(30,new c(10,15),new c(67,16))),new e(40,new Array(6,30,58,86,114,142,170),new d(30,new c(19,118),new c(6,119)),new d(28,new c(18,47),new c(31,48)),new d(30,new c(34,24),new c(34,25)),new d(30,new c(20,15),new c(61,16))))}function g(a,b,c,d,e,f,h,i,j){this.a11=a,this.a12=d,this.a13=h,this.a21=b,this.a22=e,this.a23=i,this.a31=c,this.a32=f,this.a33=j,this.transformPoints1=function(a){for(var b=a.length,c=this.a11,d=this.a12,e=this.a13,f=this.a21,g=this.a22,h=this.a23,i=this.a31,j=this.a32,k=this.a33,l=0;lMath.abs(c-a);if(e){var f=a;a=b,b=f,f=c,c=d,d=f}for(var g=Math.abs(c-a),h=Math.abs(d-b),i=-g>>1,j=b0){if(n==d)break;n+=j,i-=g}}var s=c-a,t=d-b;return Math.sqrt(s*s+t*t)},this.sizeOfBlackWhiteBlackRunBothWays=function(a,b,c,d){var e=this.sizeOfBlackWhiteBlackRun(a,b,c,d),f=1,g=a-(c-a);g<0?(f=a/(a-g),g=0):g>=R.width&&(f=(R.width-1-a)/(g-a),g=R.width-1);var h=Math.floor(b-(d-b)*f);return f=1,h<0?(f=b/(b-h),h=0):h>=R.height&&(f=(R.height-1-b)/(h-b),h=R.height-1),g=Math.floor(a+(g-a)*f),e+=this.sizeOfBlackWhiteBlackRun(a,b,g,h),e-1},this.calculateModuleSizeOneWay=function(a,b){var c=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(a.X),Math.floor(a.Y),Math.floor(b.X),Math.floor(b.Y)),d=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(b.X),Math.floor(b.Y),Math.floor(a.X),Math.floor(a.Y));return isNaN(c)?d/7:isNaN(d)?c/7:(c+d)/14},this.calculateModuleSize=function(a,b,c){return(this.calculateModuleSizeOneWay(a,b)+this.calculateModuleSizeOneWay(a,c))/2},this.distance=function(a,b){var c=a.X-b.X,d=a.Y-b.Y;return Math.sqrt(c*c+d*d)},this.computeDimension=function(a,b,c,d){var e=Math.round(this.distance(a,b)/d),f=Math.round(this.distance(a,c)/d),g=(e+f>>1)+7;switch(3&g){case 0:g++;break;case 2:g--;break;case 3:throw"Error"}return g},this.findAlignmentInRegion=function(a,b,c,d){var e=Math.floor(d*a),f=Math.max(0,b-e),g=Math.min(R.width-1,b+e);if(g-f<3*a)throw"Error";var h=Math.max(0,c-e),i=Math.min(R.height-1,c+e),j=new E(this.image,f,h,g-f,i-h,a,this.resultPointCallback);return j.find()},this.createTransform=function(a,b,c,d,e){var f,h,i,j,k=e-3.5;null!=d?(f=d.X,h=d.Y,i=j=k-3):(f=b.X-a.X+c.X,h=b.Y-a.Y+c.Y,i=j=k);var l=g.quadrilateralToQuadrilateral(3.5,3.5,k,3.5,i,j,3.5,k,a.X,a.Y,b.X,b.Y,f,h,c.X,c.Y);return l},this.sampleGrid=function(a,b,c){var d=G;return d.sampleGrid3(a,c,b)},this.processFinderPatternInfo=function(a){var b=a.TopLeft,c=a.TopRight,d=a.BottomLeft,f=this.calculateModuleSize(b,c,d);if(f<1)throw"Error";var g=this.computeDimension(b,c,d,f),i=e.getProvisionalVersionForDimension(g),j=i.DimensionForVersion-7,k=null;if(i.AlignmentPatternCenters.length>0)for(var l=c.X-b.X+d.X,m=c.Y-b.Y+d.Y,n=1-3/j,o=Math.floor(b.X+n*(l-b.X)),p=Math.floor(b.Y+n*(m-b.Y)),q=4;q<=16;q<<=1){k=this.findAlignmentInRegion(f,o,p,q);break}var r,s=this.createTransform(b,c,d,k,g),t=this.sampleGrid(this.image,s,g);return r=null==k?new Array(d,b,c):new Array(d,b,c,k),new h(t,r)},this.detect=function(){var a=(new C).findFinderPattern(this.image);return this.processFinderPatternInfo(a)}}function j(a){this.errorCorrectionLevel=k.forBits(a>>3&3),this.dataMask=7&a,this.__defineGetter__("ErrorCorrectionLevel",function(){return this.errorCorrectionLevel}),this.__defineGetter__("DataMask",function(){return this.dataMask}),this.GetHashCode=function(){return this.errorCorrectionLevel.ordinal()<<3|this.dataMask},this.Equals=function(a){var b=a;return this.errorCorrectionLevel==b.errorCorrectionLevel&&this.dataMask==b.dataMask}}function k(a,b,c){this.ordinal_Renamed_Field=a,this.bits=b,this.name=c,this.__defineGetter__("Bits",function(){return this.bits}),this.__defineGetter__("Name",function(){return this.name}),this.ordinal=function(){return this.ordinal_Renamed_Field}}function l(a,b){if(b||(b=a),a<1||b<1)throw"Both dimensions must be greater than 0";this.width=a,this.height=b;var c=a>>5;0!=(31&a)&&c++,this.rowSize=c,this.bits=new Array(c*b);for(var d=0;d>5);return 0!=(1&z(this.bits[c],31&a))},this.set_Renamed=function(a,b){var c=b*this.rowSize+(a>>5);this.bits[c]|=1<<(31&a)},this.flip=function(a,b){var c=b*this.rowSize+(a>>5);this.bits[c]^=1<<(31&a)},this.clear=function(){for(var a=this.bits.length,b=0;bthis.height||e>this.width)throw"The region must fit inside the matrix";for(var g=b;g>5)]|=1<<(31&i)}}function m(a,b){this.numDataCodewords=a,this.codewords=b,this.__defineGetter__("NumDataCodewords",function(){return this.numDataCodewords}),this.__defineGetter__("Codewords",function(){return this.codewords})}function n(a){var b=a.Dimension;if(b<21||1!=(3&b))throw"Error BitMatrixParser";this.bitMatrix=a,this.parsedVersion=null,this.parsedFormatInfo=null,this.copyBit=function(a,b,c){return this.bitMatrix.get_Renamed(a,b)?c<<1|1:c<<1},this.readFormatInformation=function(){if(null!=this.parsedFormatInfo)return this.parsedFormatInfo;for(var a=0,b=0;b<6;b++)a=this.copyBit(b,8,a);a=this.copyBit(7,8,a),a=this.copyBit(8,8,a),a=this.copyBit(8,7,a);for(var c=5;c>=0;c--)a=this.copyBit(8,c,a);if(this.parsedFormatInfo=j.decodeFormatInformation(a),null!=this.parsedFormatInfo)return this.parsedFormatInfo;var d=this.bitMatrix.Dimension;a=0;for(var e=d-8,b=d-1;b>=e;b--)a=this.copyBit(b,8,a);for(var c=d-7;c>2;if(b<=6)return e.getVersionForNumber(b);for(var c=0,d=a-11,f=5;f>=0;f--)for(var g=a-9;g>=d;g--)c=this.copyBit(g,f,c);if(this.parsedVersion=e.decodeVersionInformation(c),null!=this.parsedVersion&&this.parsedVersion.DimensionForVersion==a)return this.parsedVersion;c=0;for(var g=5;g>=0;g--)for(var f=a-9;f>=d;f--)c=this.copyBit(g,f,c);if(this.parsedVersion=e.decodeVersionInformation(c),null!=this.parsedVersion&&this.parsedVersion.DimensionForVersion==a)return this.parsedVersion;throw"Error readVersion"},this.readCodewords=function(){var a=this.readFormatInformation(),b=this.readVersion(),c=P.forReference(a.DataMask),d=this.bitMatrix.Dimension;c.unmaskBitMatrix(this.bitMatrix,d);for(var e=b.buildFunctionPattern(),f=!0,g=new Array(b.TotalCodewords),h=0,i=0,j=0,k=d-1;k>0;k-=2){6==k&&k--;for(var l=0;l=Math.floor(c/2);){var k=e,l=g,m=i;if(e=f,g=h,i=j,e.Zero)throw"r_{i-1} was zero";f=k;for(var n=this.field.Zero,o=e.getCoefficient(e.Degree),p=this.field.inverse(o);f.Degree>=e.Degree&&!f.Zero;){var q=f.Degree-e.Degree,r=this.field.multiply(f.getCoefficient(f.Degree),p);n=n.addOrSubtract(this.field.buildMonomial(q,r)),f=f.addOrSubtract(e.multiplyByMonomial(q,r))}h=n.multiply1(g).addOrSubtract(l),j=n.multiply1(i).addOrSubtract(m)}var s=j.getCoefficient(0);if(0==s)throw"ReedSolomonException sigmaTilde(0) was zero";var t=this.field.inverse(s),u=j.multiply2(t),v=f.multiply2(t);return new Array(u,v)},this.findErrorLocations=function(a){var b=a.Degree;if(1==b)return new Array(a.getCoefficient(1));for(var c=new Array(b),d=0,e=1;e<256&&d1&&0==b[0]){for(var d=1;dd.length){var e=c;c=d,d=e}for(var f=new Array(d.length),g=d.length-c.length,h=0;h=a.Degree&&!c.Zero;){var f=c.Degree-a.Degree,g=this.field.multiply(c.getCoefficient(c.Degree),e),h=a.multiplyByMonomial(f,g),i=this.field.buildMonomial(f,g);b=b.addOrSubtract(i),c=c.addOrSubtract(h)}return new Array(b,c)}}function y(a){this.expTable=new Array(256),this.logTable=new Array(256);for(var b=1,c=0;c<256;c++)this.expTable[c]=b,b<<=1,b>=256&&(b^=a);for(var c=0;c<255;c++)this.logTable[this.expTable[c]]=c;var d=new Array(1);d[0]=0,this.zero=new x(this,new Array(d));var e=new Array(1);e[0]=1,this.one=new x(this,new Array(e)),this.__defineGetter__("Zero",function(){return this.zero}),this.__defineGetter__("One",function(){return this.one}),this.buildMonomial=function(a,b){if(a<0)throw"System.ArgumentException";if(0==b)return this.zero;for(var c=new Array(a+1),d=0;d=0?a>>b:(a>>b)+(2<<~b)}function A(a,b,c){this.x=a,this.y=b,this.count=1,this.estimatedModuleSize=c,this.__defineGetter__("EstimatedModuleSize",function(){return this.estimatedModuleSize}),this.__defineGetter__("Count",function(){return this.count}),this.__defineGetter__("X",function(){return this.x}),this.__defineGetter__("Y",function(){return this.y}),this.incrementCount=function(){this.count++},this.aboutEquals=function(a,b,c){if(Math.abs(b-this.y)<=a&&Math.abs(c-this.x)<=a){var d=Math.abs(a-this.estimatedModuleSize);return d<=1||d/this.estimatedModuleSize<=1}return!1}}function B(a){this.bottomLeft=a[0],this.topLeft=a[1],this.topRight=a[2],this.__defineGetter__("BottomLeft",function(){return this.bottomLeft}),this.__defineGetter__("TopLeft",function(){return this.topLeft}),this.__defineGetter__("TopRight",function(){return this.topRight})}function C(){this.image=null,this.possibleCenters=[],this.hasSkipped=!1,this.crossCheckStateCount=new Array(0,0,0,0,0),this.resultPointCallback=null,this.__defineGetter__("CrossCheckStateCount",function(){return this.crossCheckStateCount[0]=0,this.crossCheckStateCount[1]=0,this.crossCheckStateCount[2]=0,this.crossCheckStateCount[3]=0,this.crossCheckStateCount[4]=0,this.crossCheckStateCount}),this.foundPatternCross=function(a){for(var b=0,c=0;c<5;c++){var d=a[c];if(0==d)return!1;b+=d}if(b<7)return!1;var e=Math.floor((b<=0&&e[b+h*R.width];)g[2]++,h--;if(h<0)return NaN;for(;h>=0&&!e[b+h*R.width]&&g[1]<=c;)g[1]++,h--;if(h<0||g[1]>c)return NaN;for(;h>=0&&e[b+h*R.width]&&g[0]<=c;)g[0]++,h--;if(g[0]>c)return NaN;for(h=a+1;h=c)return NaN;for(;h=c)return NaN;var i=g[0]+g[1]+g[2]+g[3]+g[4];return 5*Math.abs(i-d)>=2*d?NaN:this.foundPatternCross(g)?this.centerFromEnd(g,h):NaN},this.crossCheckHorizontal=function(a,b,c,d){for(var e=this.image,f=R.width,g=this.CrossCheckStateCount,h=a;h>=0&&e[h+b*R.width];)g[2]++,h--;if(h<0)return NaN;for(;h>=0&&!e[h+b*R.width]&&g[1]<=c;)g[1]++,h--;if(h<0||g[1]>c)return NaN;for(;h>=0&&e[h+b*R.width]&&g[0]<=c;)g[0]++,h--;if(g[0]>c)return NaN;for(h=a+1;h=c)return NaN;for(;h=c)return NaN;var i=g[0]+g[1]+g[2]+g[3]+g[4];return 5*Math.abs(i-d)>=d?NaN:this.foundPatternCross(g)?this.centerFromEnd(g,h):NaN},this.handlePossibleCenter=function(a,b,c){var d=a[0]+a[1]+a[2]+a[3]+a[4],e=this.centerFromEnd(a,c),f=this.crossCheckVertical(b,Math.floor(e),a[2],d);if(!isNaN(f)&&(e=this.crossCheckHorizontal(Math.floor(e),Math.floor(f),a[2],d),!isNaN(e))){for(var g=d/7,h=!1,i=this.possibleCenters.length,j=0;j3){for(var b=0,c=0,d=0;d=0;d--){var i=this.possibleCenters[d];Math.abs(i.EstimatedModuleSize-f)>h&&this.possibleCenters.splice(d,1)}}return this.possibleCenters.length>3&&this.possibleCenters.sort(function(a,b){return a.count>b.count?-1:a.count=V){if(null!=b)return this.hasSkipped=!0,Math.floor((Math.abs(b.X-d.X)-Math.abs(b.Y-d.Y))/2);b=d}}return 0},this.haveMultiplyConfirmedCenters=function(){for(var a=0,b=0,c=this.possibleCenters.length,d=0;d=V&&(a++,b+=e.EstimatedModuleSize)}if(a<3)return!1;for(var f=b/c,g=0,d=0;dg[2]&&(h+=l-g[2]-e,j=d-1)}else{do j++;while(j=c)return!1;return!0},this.crossCheckVertical=function(a,b,c,d){var e=this.image,f=R.height,g=this.crossCheckStateCount;g[0]=0,g[1]=0,g[2]=0;for(var h=a;h>=0&&e[b+h*R.width]&&g[1]<=c;)g[1]++,h--;if(h<0||g[1]>c)return NaN;for(;h>=0&&!e[b+h*R.width]&&g[0]<=c;)g[0]++,h--;if(g[0]>c)return NaN;for(h=a+1;hc)return NaN;for(;hc)return NaN;var i=g[0]+g[1]+g[2];return 5*Math.abs(i-d)>=2*d?NaN:this.foundPatternCross(g)?this.centerFromEnd(g,h):NaN},this.handlePossibleCenter=function(a,b,c){var d=a[0]+a[1]+a[2],e=this.centerFromEnd(a,c),f=this.crossCheckVertical(b,Math.floor(e),2*a[1],d);if(!isNaN(f)){for(var g=(a[0]+a[1]+a[2])/3,h=this.possibleCenters.length,i=0;i>1),h=new Array(0,0,0),i=0;i>1:-(i+1>>1));h[0]=0,h[1]=0,h[2]=0;for(var k=b;k=10&&b<=26?this.dataLengthMode=1:b>=27&&b<=40&&(this.dataLengthMode=2),this.getNextBits=function(a){var b=0;if(a>this.bitPointer-a+1,this.bitPointer-=a,b}if(a>8-(a-(this.bitPointer+1)),this.bitPointer=this.bitPointer-a%8,this.bitPointer<0&&(this.bitPointer=8+this.bitPointer),b}if(a>8-(a-(this.bitPointer+1+8));return b=g+h+i,this.bitPointer=this.bitPointer-(a-8)%8,this.bitPointer<0&&(this.bitPointer=8+this.bitPointer),b}return 0},this.NextMode=function(){return this.blockPointer>this.blocks.length-this.numErrorCorrectionCode-2?0:this.getNextBits(4)},this.getDataLength=function(a){for(var b=0;;){if(a>>b==1)break;b++}return this.getNextBits(R.sizeOfDataLengthInfo[this.dataLengthMode][b])},this.getRomanAndFigureString=function(a){var b=a,c=0,d="",e=new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":");do if(b>1){c=this.getNextBits(11);var f=Math.floor(c/45),g=c%45;d+=e[f],d+=e[g],b-=2}else 1==b&&(c=this.getNextBits(6),d+=e[c],b-=1);while(b>0);return d},this.getFigureString=function(a){var b=a,c=0,d="";do b>=3?(c=this.getNextBits(10),c<100&&(d+="0"),c<10&&(d+="0"),b-=3):2==b?(c=this.getNextBits(7),c<10&&(d+="0"),b-=2):1==b&&(c=this.getNextBits(4),b-=1),d+=c;while(b>0);return d},this.get8bitByteArray=function(a){var b=a,c=0,d=new Array;do c=this.getNextBits(8),d.push(c),b--;while(b>0);return d},this.getKanjiString=function(a){var b=a,c=0,d="";do{c=this.getNextBits(13);var e=c%192,f=c/192,g=(f<<8)+e,h=0;h=g+33088<=40956?g+33088:g+49472,d+=String.fromCharCode(h),b--}while(b>0);return d},this.parseECIValue=function(){var a=0,b=this.getNextBits(8);if(0==(128&b)&&(a=127&b),128==(192&b)){var c=this.getNextBits(8);a=(63&b)<<8|c}if(192==(224&b)){var d=this.getNextBits(8);a=(31&b)<<16|d}return a},this.__defineGetter__("DataByte",function(){for(var a=new Array,b=1,c=2,d=4,e=7,f=8;;){var g=this.NextMode();if(0==g){if(a.length>0)break;throw"Empty data block"}if(g!=b&&g!=c&&g!=d&&g!=f&&g!=e)throw"Invalid mode: "+g+" in (block:"+this.blockPointer+" bit:"+this.bitPointer+")";if(g==e)var h=this.parseECIValue();else{var i=this.getDataLength(g);if(i<1)throw"Invalid data length: "+i;switch(g){case b:for(var j=this.getFigureString(i),k=new Array(j.length),l=0;lc||h<-1||h>d)throw"Error.checkAndNudgePoints ";e=!1,g==-1?(b[f]=0,e=!0):g==c&&(b[f]=c-1,e=!0),h==-1?(b[f+1]=0,e=!0):h==d&&(b[f+1]=d-1,e=!0)}e=!0;for(var f=b.length-2;f>=0&&e;f-=2){var g=Math.floor(b[f]),h=Math.floor(b[f+1]);if(g<-1||g>c||h<-1||h>d)throw"Error.checkAndNudgePoints ";e=!1,g==-1?(b[f]=0,e=!0):g==c&&(b[f]=c-1,e=!0),h==-1?(b[f+1]=0,e=!0):h==d&&(b[f+1]=d-1,e=!0)}},G.sampleGrid3=function(a,b,c){for(var d=new l(b),e=new Array(b<<1),f=0;f>1)+.5,e[i+1]=h;c.transformPoints1(e),G.checkAndNudgePoints(a,e);try{for(var i=0;i>1,f)}}catch(k){throw"Error.checkAndNudgePoints"}}return d},G.sampleGridx=function(a,b,c,d,e,f,h,i,j,k,l,m,n,o,p,q,r,s){var t=g.quadrilateralToQuadrilateral(c,d,e,f,h,i,j,k,l,m,n,o,p,q,r,s);return G.sampleGrid3(a,b,t)},e.VERSION_DECODE_INFO=new Array(31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017),e.VERSIONS=f(),e.getVersionForNumber=function(a){if(a<1||a>40)throw"ArgumentException";return e.VERSIONS[a-1]},e.getProvisionalVersionForDimension=function(a){if(a%4!=1)throw"Error getProvisionalVersionForDimension";try{return e.getVersionForNumber(a-17>>2)}catch(b){throw"Error getVersionForNumber"}},e.decodeVersionInformation=function(a){for(var b=4294967295,c=0,d=0;d=O.length)throw"ArgumentException";return O[a]};var K=new k(0,1,"L"),L=new k(1,0,"M"),M=new k(2,3,"Q"),N=new k(3,2,"H"),O=new Array(L,K,N,M);m.getDataBlocks=function(a,b,c){if(a.length!=b.TotalCodewords)throw"ArgumentException";for(var d=b.getECBlocksForLevel(c),e=0,f=d.getECBlocks(),g=0;g=0;){var q=h[p].codewords.length;if(q==o)break;p--}p++;for(var r=o-d.ECCodewordsPerBlock,s=0,g=0;g7)throw"System.ArgumentException";return P.DATA_MASKS[a]},P.DATA_MASKS=new Array(new o,new p,new q,new r,new s,new t,new u,new v),y.QR_CODE_FIELD=new y(285),y.DATA_MATRIX_FIELD=new y(301),y.addOrSubtract=function(a,b){return a^b};var Q={};Q.rsDecoder=new w(y.QR_CODE_FIELD),Q.correctErrors=function(a,b){for(var c=a.length,d=new Array(c),e=0;ee[i][h][1]&&(e[i][h][1]=l)}}for(var m=new Array(b),n=0;n=g&&h>=i?(e=a[0],d=a[1],f=a[2]):i>=h&&i>=g?(e=a[1],d=a[0],f=a[2]):(e=a[2],d=a[0],f=a[1]),c(d,e,f)<0){var j=d;d=f,f=j}a[0]=d,a[1]=e,a[2]=f},{startWebCam:function(a){R.startWebCam(a)},stopWebCam:function(a){R.stopWebCam()},startScan:function(a){R.startScan(a)},stopScan:function(a){R.stopScan()},setCallback:function(a){R.callback=a},decode:function(a){R.decode(a)}}}); \ No newline at end of file +define ("filter_poodll/poodll_qrscanner",["jquery","core/log"],function(e,t){"use strict";t.debug("poodll_qrscanner is now loaded");var P={checkAndNudgePoints:function(e,t){for(var i=I.width,o=I.height,r=!0,a=0;an||n>i||-1>d||d>o){throw"Error.checkAndNudgePoints "}r=!1;if(-1==n){t[a]=0;r=!0}else if(n==i){t[a]=i-1;r=!0}if(-1==d){t[a+1]=0;r=!0}else if(d==o){t[a+1]=o-1;r=!0}}r=!0;for(var a=t.length-2;0<=a&&r;a-=2){var n=Math.floor(t[a]),d=Math.floor(t[a+1]);if(-1>n||n>i||-1>d||d>o){throw"Error.checkAndNudgePoints "}r=!1;if(-1==n){t[a]=0;r=!0}else if(n==i){t[a]=i-1;r=!0}if(-1==d){t[a+1]=0;r=!0}else if(d==o){t[a+1]=o-1;r=!0}}}};P.sampleGrid3=function(e,t,i){for(var o=new c(t),r=Array(t<<1),a=0;a>1)+.5;r[s+1]=d}i.transformPoints1(r);P.checkAndNudgePoints(e,r);try{for(var s=0,l;s>1,a)}}catch(e){throw"Error.checkAndNudgePoints"}}return o};P.sampleGridx=function(e,t,i,o,r,n,d,s,l,c,f,g,u,h,m,b,C,_){var p=a.quadrilateralToQuadrilateral(i,o,r,n,d,s,l,c,f,g,u,h,m,b,C,_);return P.sampleGrid3(e,t,p)};function i(e,t){this.count=e;this.dataCodewords=t;this.__defineGetter__("Count",function(){return this.count});this.__defineGetter__("DataCodewords",function(){return this.dataCodewords})}function o(e,t,i){this.ecCodewordsPerBlock=e;if(i)this.ecBlocks=[t,i];else this.ecBlocks=Array(t);this.__defineGetter__("ECCodewordsPerBlock",function(){return this.ecCodewordsPerBlock});this.__defineGetter__("TotalECCodewords",function(){return this.ecCodewordsPerBlock*this.NumBlocks});this.__defineGetter__("NumBlocks",function(){for(var e=0,t=0;te||40>2)}catch(e){throw"Error getVersionForNumber"}};r.decodeVersionInformation=function(e){for(var t=4294967295,o=0,a=0,n;a=t){return this.getVersionForNumber(o)}return null};function a(e,t,i,o,r,n,d,s,l){this.a11=e;this.a12=o;this.a13=d;this.a21=t;this.a22=r;this.a23=s;this.a31=i;this.a32=n;this.a33=l;this.transformPoints1=function(e){for(var t=e.length,o=this.a11,r=this.a12,a=this.a13,n=this.a21,d=this.a22,s=this.a23,l=this.a31,c=this.a32,f=this.a33,g=0;gMath.abs(i-e);if(r){var a=e;e=t;t=a;a=i;i=o;o=a}for(var n=Math.abs(i-e),d=Math.abs(o-t),s=-n>>1,l=tn){a=e/(e-n);n=0}else if(n>=I.width){a=(I.width-1-e)/(n-e);n=I.width-1}var d=Math.floor(t-(o-t)*a);a=1;if(0>d){a=t/(t-d);d=0}else if(d>=I.height){a=(I.height-1-t)/(d-t);d=I.height-1}n=Math.floor(e+(n-e)*a);r+=this.sizeOfBlackWhiteBlackRun(e,t,n,d);return r-1};this.calculateModuleSizeOneWay=function(e,t){var i=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(e.X),Math.floor(e.Y),Math.floor(t.X),Math.floor(t.Y)),o=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.X),Math.floor(t.Y),Math.floor(e.X),Math.floor(e.Y));if(isNaN(i)){return o/7}if(isNaN(o)){return i/7}return(i+o)/14};this.calculateModuleSize=function(e,t,i){return(this.calculateModuleSizeOneWay(e,t)+this.calculateModuleSizeOneWay(e,i))/2};this.distance=function(e,t){var i=e.X-t.X,o=e.Y-t.Y;return Math.sqrt(i*i+o*o)};this.computeDimension=function(e,t,i,o){var r=Math.round(this.distance(e,t)/o),a=Math.round(this.distance(e,i)/o),n=(r+a>>1)+7;switch(3&n){case 0:n++;break;case 2:n--;break;case 3:throw"Error";}return n};this.findAlignmentInRegion=function(e,t,i,o){var r=Math.floor(o*e),a=Math.max(0,t-r),n=Math.min(I.width-1,t+r);if(n-a<3*e){throw"Error"}var d=Math.max(0,i-r),s=Math.min(I.height-1,i+r),l=new k(this.image,a,d,n-a,s-d,e,this.resultPointCallback);return l.find()};this.createTransform=function(e,t,i,o,r){var n=r-3.5,d,s,l,c;if(null!=o){d=o.X;s=o.Y;l=c=n-3}else{d=t.X-e.X+i.X;s=t.Y-e.Y+i.Y;l=c=n}var f=a.quadrilateralToQuadrilateral(3.5,3.5,n,3.5,l,c,3.5,n,e.X,e.Y,t.X,t.Y,d,s,i.X,i.Y);return f};this.sampleGrid=function(e,t,i){return P.sampleGrid3(e,i,t)};this.processFinderPatternInfo=function(e){var t=e.TopLeft,o=e.TopRight,a=e.BottomLeft,d=this.calculateModuleSize(t,o,a);if(1>d){throw"Error"}var s=this.computeDimension(t,o,a,d),l=r.getProvisionalVersionForDimension(s),c=l.DimensionForVersion-7,f=null;if(0=C;C<<=1){f=this.findAlignmentInRegion(d,m,b,C);break}}var _=this.createTransform(t,o,a,f,s),p=this.sampleGrid(this.image,_,s),k;if(null==f){k=[a,t,o]}else{k=[a,t,o,f]}return new n(p,k)};this.detect=function(){var e=new _().findFinderPattern(this.image);return this.processFinderPatternInfo(e)}}var S=[[21522,0],[20773,1],[24188,2],[23371,3],[17913,4],[16590,5],[20375,6],[19104,7],[30660,8],[29427,9],[32170,10],[30877,11],[26159,12],[25368,13],[27713,14],[26998,15],[5769,16],[5054,17],[7399,18],[6608,19],[1890,20],[597,21],[3340,22],[2107,23],[13663,24],[12392,25],[16177,26],[14854,27],[9396,28],[8579,29],[11994,30],[11245,31]],B=[0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4];function s(e){this.errorCorrectionLevel=l.forBits(3&e>>3);this.dataMask=7&e;this.__defineGetter__("ErrorCorrectionLevel",function(){return this.errorCorrectionLevel});this.__defineGetter__("DataMask",function(){return this.dataMask});this.GetHashCode=function(){return this.errorCorrectionLevel.ordinal()<<3|this.dataMask};this.Equals=function(e){var t=e;return this.errorCorrectionLevel==t.errorCorrectionLevel&&this.dataMask==t.dataMask}}s.numBitsDiffering=function(e,t){e^=t;return B[15&e]+B[15&m(e,4)]+B[15&m(e,8)]+B[15&m(e,12)]+B[15&m(e,16)]+B[15&m(e,20)]+B[15&m(e,24)]+B[15&m(e,28)]};s.decodeFormatInformation=function(e){var t=s.doDecodeFormatInformation(e);if(null!=t){return t}return s.doDecodeFormatInformation(e^21522)};s.doDecodeFormatInformation=function(e){for(var t=4294967295,o=0,r=0;r=t){return new s(o)}return null};function l(e,t,i){this.ordinal_Renamed_Field=e;this.bits=t;this.name=i;this.__defineGetter__("Bits",function(){return this.bits});this.__defineGetter__("Name",function(){return this.name});this.ordinal=function(){return this.ordinal_Renamed_Field}}l.forBits=function(e){if(0>e||e>=D.length){throw"ArgumentException"}return D[e]};var E=new l(0,1,"L"),x=new l(1,0,"M"),M=new l(2,3,"Q"),y=new l(3,2,"H"),D=[x,E,y,M];function c(e,t){if(!t)t=e;if(1>e||1>t){throw"Both dimensions must be greater than 0"}this.width=e;this.height=t;var o=e>>5;if(0!=(31&e)){o++}this.rowSize=o;this.bits=Array(o*t);for(var r=0;r>5);return 0!=(1&m(this.bits[i],31&e))};this.set_Renamed=function(e,t){var i=t*this.rowSize+(e>>5);this.bits[i]|=1<<(31&e)};this.flip=function(e,t){var i=t*this.rowSize+(e>>5);this.bits[i]^=1<<(31&e)};this.clear=function(){for(var e=this.bits.length,t=0;tt||0>e){throw"Left and top must be nonnegative"}if(1>o||1>i){throw"Height and width must be at least 1"}var r=e+i,a=t+o;if(a>this.height||r>this.width){throw"The region must fit inside the matrix"}for(var n=t,d;n>5)]|=1<<(31&s)}}}}function f(e,t){this.numDataCodewords=e;this.codewords=t;this.__defineGetter__("NumDataCodewords",function(){return this.numDataCodewords});this.__defineGetter__("Codewords",function(){return this.codewords})}f.getDataBlocks=function(e,t,o){if(e.length!=t.TotalCodewords){throw"ArgumentException"}for(var r=t.getECBlocksForLevel(o),a=0,n=r.getECBlocks(),d=0;dt||1!=(3&t)){throw"Error BitMatrixParser"}this.bitMatrix=e;this.parsedVersion=null;this.parsedFormatInfo=null;this.copyBit=function(e,t,i){return this.bitMatrix.get_Renamed(e,t)?1|i<<1:i<<1};this.readFormatInformation=function(){if(null!=this.parsedFormatInfo){return this.parsedFormatInfo}for(var e=0,t=0;6>t;t++){e=this.copyBit(t,8,e)}e=this.copyBit(7,8,e);e=this.copyBit(8,8,e);e=this.copyBit(8,7,e);for(var o=5;0<=o;o--){e=this.copyBit(8,o,e)}this.parsedFormatInfo=s.decodeFormatInformation(e);if(null!=this.parsedFormatInfo){return this.parsedFormatInfo}var r=this.bitMatrix.Dimension;e=0;for(var t=r-1;t>=r-8;t--){e=this.copyBit(t,8,e)}for(var o=r-7;o>2;if(6>=t){return r.getVersionForNumber(t)}for(var o=0,a=e-11,n=5;0<=n;n--){for(var d=e-9;d>=a;d--){o=this.copyBit(d,n,o)}}this.parsedVersion=r.decodeVersionInformation(o);if(null!=this.parsedVersion&&this.parsedVersion.DimensionForVersion==e){return this.parsedVersion}o=0;for(var d=5;0<=d;d--){for(var n=e-9;n>=a;n--){o=this.copyBit(d,n,o)}}this.parsedVersion=r.decodeVersionInformation(o);if(null!=this.parsedVersion&&this.parsedVersion.DimensionForVersion==e){return this.parsedVersion}throw"Error readVersion"};this.readCodewords=function(){var e=this.readFormatInformation(),t=this.readVersion(),o=v.forReference(e.DataMask),r=this.bitMatrix.Dimension;o.unmaskBitMatrix(this.bitMatrix,r);for(var a=t.buildFunctionPattern(),n=!0,d=Array(t.TotalCodewords),s=0,l=0,c=0,f=r-1;0h;h++){if(!a.get_Renamed(f-h,u)){c++;l<<=1;if(this.bitMatrix.get_Renamed(f-h,u)){l|=1}if(8==c){d[s++]=l;c=0;l=0}}}}n^=!0}if(s!=t.TotalCodewords){throw"Error readCodewords"}return d}}var v={};v.forReference=function(e){if(0>e||7r.length){var a=o;o=r;r=a}for(var n=Array(r.length),d=r.length-o.length,s=0;se){throw"System.ArgumentException"}if(0==t){return this.field.Zero}for(var o=this.coefficients.length,r=Array(o+e),a=0;a=e.Degree&&!i.Zero){var a=i.Degree-e.Degree,n=this.field.multiply(i.getCoefficient(i.Degree),r),d=e.multiplyByMonomial(a,n),s=this.field.buildMonomial(a,n);t=t.addOrSubtract(s);i=i.addOrSubtract(d)}return[t,i]}}function h(e){this.expTable=Array(256);this.logTable=Array(256);for(var t=1,o=0;256>o;o++){this.expTable[o]=t;t<<=1;if(256<=t){t^=e}}for(var o=0;255>o;o++){this.logTable[this.expTable[o]]=o}var r=[,];r[0]=0;this.zero=new u(this,Array(r));var a=[,];a[0]=1;this.one=new u(this,Array(a));this.__defineGetter__("Zero",function(){return this.zero});this.__defineGetter__("One",function(){return this.one});this.buildMonomial=function(e,t){if(0>e){throw"System.ArgumentException"}if(0==t){return this.zero}for(var o=Array(e+1),r=0;rC){throw"ReedSolomonException Bad error location"}e[C]=h.addOrSubtract(e[C],b[a])}};this.runEuclideanAlgorithm=function(e,i,o){if(e.Degree=Math.floor(o/2)){var h=d,m=c,C=g;d=l;c=f;g=u;if(d.Zero){throw"r_{i-1} was zero"}l=h;var _=this.field.Zero,p=d.getCoefficient(d.Degree),k=this.field.inverse(p);while(l.Degree>=d.Degree&&!l.Zero){var w=l.Degree-d.Degree,P=this.field.multiply(l.getCoefficient(l.Degree),k);_=_.addOrSubtract(this.field.buildMonomial(w,P));l=l.addOrSubtract(d.multiplyByMonomial(w,P))}f=_.multiply1(c).addOrSubtract(m);u=_.multiply1(g).addOrSubtract(C)}var S=u.getCoefficient(0);if(0==S){throw"ReedSolomonException sigmaTilde(0) was zero"}var B=this.field.inverse(S),M=u.multiply2(B),E=l.multiply2(B);return[M,E]};this.findErrorLocations=function(t){var o=t.Degree;if(1==o){return Array(t.getCoefficient(1))}for(var r=Array(o),a=0,n=1;256>n&&aa[l][s][1])a[l][s][1]=g}}}}for(var u=Array(t),h=0;h>t;else return(e>>t)+(2<<~t)}var R=8,G=2;I.orderBestPatterns=function(e){function t(e,t){var i=e.X-t.X,o=e.Y-t.Y;return Math.sqrt(i*i+o*o)}function i(e,t,i){var o=t.x,r=t.y;return(i.x-o)*(e.y-r)-(i.y-r)*(e.x-o)}var o=t(e[0],e[1]),r=t(e[1],e[2]),a=t(e[0],e[2]),n,d,s;if(r>=o&&r>=a){d=e[0];n=e[1];s=e[2]}else if(a>=r&&a>=o){d=e[1];n=e[0];s=e[2]}else{d=e[2];n=e[0];s=e[1]}if(0>i(n,d,s)){var l=n;n=s;s=l}e[0]=n;e[1]=d;e[2]=s};function b(e,t,i){this.x=e;this.y=t;this.count=1;this.estimatedModuleSize=i;this.__defineGetter__("EstimatedModuleSize",function(){return this.estimatedModuleSize});this.__defineGetter__("Count",function(){return this.count});this.__defineGetter__("X",function(){return this.x});this.__defineGetter__("Y",function(){return this.y});this.incrementCount=function(){this.count++};this.aboutEquals=function(e,t,i){if(Math.abs(t-this.y)<=e&&Math.abs(i-this.x)<=e){var o=Math.abs(e-this.estimatedModuleSize);return 1>=o||1>=o/this.estimatedModuleSize}return!1}}function C(e){this.bottomLeft=e[0];this.topLeft=e[1];this.topRight=e[2];this.__defineGetter__("BottomLeft",function(){return this.bottomLeft});this.__defineGetter__("TopLeft",function(){return this.topLeft});this.__defineGetter__("TopRight",function(){return this.topRight})}function _(){this.image=null;this.possibleCenters=[];this.hasSkipped=!1;this.crossCheckStateCount=[0,0,0,0,0];this.resultPointCallback=null;this.__defineGetter__("CrossCheckStateCount",function(){this.crossCheckStateCount[0]=0;this.crossCheckStateCount[1]=0;this.crossCheckStateCount[2]=0;this.crossCheckStateCount[3]=0;this.crossCheckStateCount[4]=0;return this.crossCheckStateCount});this.foundPatternCross=function(e){for(var t=0,o=0,r;5>o;o++){r=e[o];if(0==r){return!1}t+=r}if(7>t){return!1}var a=Math.floor((t<s){return NaN}while(0<=s&&!a[t+s*I.width]&&d[1]<=o){d[1]++;s--}if(0>s||d[1]>o){return NaN}while(0<=s&&a[t+s*I.width]&&d[0]<=o){d[0]++;s--}if(d[0]>o){return NaN}s=e+1;while(s=o){return NaN}while(s=o){return NaN}var l=d[0]+d[1]+d[2]+d[3]+d[4];if(5*Math.abs(l-r)>=2*r){return NaN}return this.foundPatternCross(d)?this.centerFromEnd(d,s):NaN};this.crossCheckHorizontal=function(e,t,i,o){var r=this.image,a=I.width,n=this.CrossCheckStateCount,d=e;while(0<=d&&r[d+t*I.width]){n[2]++;d--}if(0>d){return NaN}while(0<=d&&!r[d+t*I.width]&&n[1]<=i){n[1]++;d--}if(0>d||n[1]>i){return NaN}while(0<=d&&r[d+t*I.width]&&n[0]<=i){n[0]++;d--}if(n[0]>i){return NaN}d=e+1;while(d=i){return NaN}while(d=i){return NaN}var s=n[0]+n[1]+n[2]+n[3]+n[4];if(5*Math.abs(s-o)>=o){return NaN}return this.foundPatternCross(n)?this.centerFromEnd(n,d):NaN};this.handlePossibleCenter=function(e,t,i){var o=e[0]+e[1]+e[2]+e[3]+e[4],r=this.centerFromEnd(e,i),a=this.crossCheckVertical(t,Math.floor(r),e[2],o);if(!isNaN(a)){r=this.crossCheckHorizontal(Math.floor(r),Math.floor(a),e[2],o);if(!isNaN(r)){for(var n=o/7,d=!1,s=this.possibleCenters.length,l=0,c;le){throw"Couldn't find enough finder patterns (found "+e+")"}if(3s){this.possibleCenters.splice(r,1)}}}if(3t.count){return-1}if(e.count=e){return 0}for(var t=null,o=0,r;o=G){if(null==t){t=r}else{this.hasSkipped=!0;return Math.floor((Math.abs(t.X-r.X)-Math.abs(t.Y-r.Y))/2)}}}return 0};this.haveMultiplyConfirmedCenters=function(){for(var e=0,t=0,o=this.possibleCenters.length,r=0,a;r=G){e++;t+=a.EstimatedModuleSize}}if(3>e){return!1}for(var n=t/o,d=0,r=0;rn[2]){d+=f-n[2]-r;l=o-1}}}else{do{l++}while(l=o||1>=o/this.estimatedModuleSize}return!1}}function k(e,t,o,r,a,n,d){this.image=e;this.possibleCenters=[];this.startX=t;this.startY=o;this.width=r;this.height=a;this.moduleSize=n;this.crossCheckStateCount=[0,0,0];this.resultPointCallback=d;this.centerFromEnd=function(e,t){return t-e[2]-e[1]/2};this.foundPatternCross=function(e){for(var t=this.moduleSize,o=0;3>o;o++){if(Math.abs(t-e[o])>=t/2){return!1}}return!0};this.crossCheckVertical=function(e,t,o,r){var a=this.image,n=I.height,d=this.crossCheckStateCount;d[0]=0;d[1]=0;d[2]=0;var s=e;while(0<=s&&a[t+s*I.width]&&d[1]<=o){d[1]++;s--}if(0>s||d[1]>o){return NaN}while(0<=s&&!a[t+s*I.width]&&d[0]<=o){d[0]++;s--}if(d[0]>o){return NaN}s=e+1;while(so){return NaN}while(so){return NaN}var l=d[0]+d[1]+d[2];if(5*Math.abs(l-r)>=2*r){return NaN}return this.foundPatternCross(d)?this.centerFromEnd(d,s):NaN};this.handlePossibleCenter=function(e,t,i){var o=e[0]+e[1]+e[2],r=this.centerFromEnd(e,i),a=this.crossCheckVertical(t,Math.floor(r),2*e[1],o);if(!isNaN(a)){for(var n=(e[0]+e[1]+e[2])/3,d=this.possibleCenters.length,s=0,l;s>1)+(0==(1&s)?s+1>>1:-(s+1>>1));d[0]=0;d[1]=0;d[2]=0;var c=t;while(c=t)this.dataLengthMode=0;else if(10<=t&&26>=t)this.dataLengthMode=1;else if(27<=t&&40>=t)this.dataLengthMode=2;this.getNextBits=function(e){var t=0;if(e>this.bitPointer-e+1;this.bitPointer-=e;return t}else if(e>8-(e-(this.bitPointer+1));this.bitPointer=this.bitPointer-e%8;if(0>this.bitPointer){this.bitPointer=8+this.bitPointer}return t}else if(e>8-(e-(this.bitPointer+1+8));t=d+s+l;this.bitPointer=this.bitPointer-(e-8)%8;if(0>this.bitPointer){this.bitPointer=8+this.bitPointer}return t}else{return 0}};this.NextMode=function(){if(this.blockPointer>this.blocks.length-this.numErrorCorrectionCode-2)return 0;else return this.getNextBits(4)};this.getDataLength=function(e){var t=0;while(!0){if(1==e>>t)break;t++}return this.getNextBits(I.sizeOfDataLengthInfo[this.dataLengthMode][t])};this.getRomanAndFigureString=function(e){var t=e,i=0,o="",r=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];do{if(1i)o+="0";if(10>i)o+="0";t-=3}else if(2==t){i=this.getNextBits(7);if(10>i)o+="0";t-=2}else if(1==t){i=this.getNextBits(4);t-=1}o+=i}while(0=n+33088){d=n+33088}else{d=n+49472}o+=String.fromCharCode(d);t--}while(0s)throw"Invalid data length: "+s;switch(n){case t:for(var l=this.getFigureString(s),c=Array(l.length),f=0;f .poodll_save-recording").hide(),a("#"+b+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(a){},fetch_status_bar:function(a){var b='
00:00:00
';return b},fetch_preview_audio:function(a){var b='';return b},fetch_preview_video:function(a){return this.fetch_preview_audio(a)},fetch_resource_audio:function(a){var b='';return b},fetch_resource_video:function(a){return this.fetch_resource_audio(a)},onMediaError:function(a){console.error("media error",a)},onMediaSuccess_video:function(a){this.fetch_instanceprops(a);this.set_visual_mode("recordingmode",a)},onMediaSuccess_audio:function(a){var b=this.fetch_instanceprops(a);b.controlbar.preview.attr("src",null),b.uploader.Output(""),this.therecanim.start(),b.timer.reset(),b.timer.start(),this.update_status(a),this.set_visual_mode("recordingmode",a)},handle_timer_update:function(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time()),0==b.timer.seconds&&b.timer.initseconds>0&&b.controlbar.stopbutton.click()},update_status:function(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time())},fetch_uploader_skin:function(a,b){var c=this.fetch_instanceprops(a),d=e.clone();return d.init(c.config,b,c.controlbar.playcanvas,c.controlbar.status),d},set_visual_mode:function(a,b){var c=this,d=this.fetch_instanceprops(b);switch(a){case"startmode":d.controlbar.status.hide(),c.disable_button(d.controlbar.startbutton),c.enable_button(d.controlbar.testbutton),c.disable_button(d.controlbar.stopbutton),c.therecanim.clear();break;case"readymode":d.controlbar.status.hide(),c.enable_button(d.controlbar.startbutton),c.disable_button(d.controlbar.testbutton),c.disable_button(d.controlbar.stopbutton),c.therecanim.clear();break;case"recordingmode":"1"==d.config.allowearlyexit&&d.timer.enabled&&c.enable_button(d.controlbar.stopbutton),c.disable_button(d.controlbar.startbutton),d.controlbar.status.hide();break;case"aftermode":c.disable_button(d.controlbar.startbutton),c.disable_button(d.controlbar.stopbutton),d.controlbar.status.show()}},insert_controlbar_video:function(a,b,c,d){return this.prepare_controlbar_audio(a,b,c,d)},insert_controlbar_audio:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"audio");return e},prepare_controlbar:function(b,c,d,e,f){var g=this.fetch_instanceprops(c),h=g.config.media_skin_style,i="poodll_mediarecorder_audio",j=(this.pmr.fetch_strings(),M.util.get_string("recui_startactivity","filter_poodll")),k=M.util.get_string("recui_testmic","filter_poodll"),l=M.util.get_string("recui_stop","filter_poodll"),m=this.fetch_status_bar("readaloud"),n='
';n+='
',n+=this.devsettings.fetch_dialogue_box(),n+=g.downloaddialog.fetch_dialogue_box(),n+=g.errordialog.fetch_dialogue_box(),n+='
',n+=d,n+='
',n+='',n+='",n+='",n+='",n+=m,n+="
",a(b).prepend(n);var o={settingsdialog:a("#"+c+" .poodll_dialogue_box_settings"),downloaddialog:a("#"+c+" .poodll_dialogue_box_download"),errorsdialog:a("#"+c+" .poodll_dialogue_box_errors"),settingsicon:a("#"+c+" .settingsicon"),status:a("#"+c+" .poodll_status_readaloud"),preview:a("#"+c+" .poodll_preview_readaloud"),startbutton:a("#"+c+" .poodll_start-recording_readaloud"),testbutton:a("#"+c+" .poodll_test-recording_readaloud"),stopbutton:a("#"+c+" .poodll_stop-recording_readaloud"),playcanvas:a("#"+c+"_playcanvas")};return g.downloaddialog.set_dialogue_box(o.downloaddialog),g.errordialog.set_dialogue_box(o.errorsdialog),this.devsettings.set_dialogue_box(o.settingsdialog),o},register_controlbar_events_video:function(a,b){return this.register_controlbar_events_audio(a,b)},register_controlbar_events_audio:function(a,b){var c=this,d=this.pmr,e=this.fetch_instanceprops(b);e.config.recanim="hwave_mic";var g=f.clone();c.therecanim=g,g.init(e.audioanalyser,e.controlbar.playcanvas.get(0)),this.set_visual_mode("startmode",b),e.controlbar.testbutton.click(function(){e.config.hermes.disable(),e.timer.disable();var f=function(){d.do_stop_audio(e),g.clear(),g.sounddetected&&c.set_visual_mode("readymode",b)};d.do_start_audio(e,a),setTimeout(f,4e3)}),e.controlbar.settingsicon.click(function(){c.uploaded?e.downloaddialog.open():c.devsettings.open()}),e.controlbar.startbutton.click(function(){e.config.hermes.enable(),e.timer.enable(),d.do_start_audio(e,a)}),e.controlbar.stopbutton.click(function(){d.do_stop_audio(e),g.clear(),e.timer.stop(),c.update_status(b);var a=function(){e.blobs&&e.blobs.length>0?(d.do_save_audio(e),e.uploaded=!0,c.disable_button(e.controlbar.startbutton)):setTimeout(a,200)};setTimeout(a,200),c.set_visual_mode("aftermode",b)}),window.onbeforeunload=function(){}},enable_button:function(b){a(b).attr("disabled",!1),a(b).removeClass("pmr_disabled")},disable_button:function(b){a(b).attr("disabled",!0),a(b).addClass("pmr_disabled")}}}); \ No newline at end of file +define ("filter_poodll/poodll_readaloudmediaskin",["jquery","jqueryui","core/log","filter_poodll/utils_amd","filter_poodll/upskin_radial","filter_poodll/anim_hwave_mic","filter_poodll/dlg_devicesettings"],function(a,b,c,d,e,f,g){"use strict";c.debug("PoodLL Read Aloud Skin: initialising");return{instanceprops:null,pmr:null,devsettings:null,therecanim:null,clone:function clone(){return a.extend(!0,{},this)},init:function init(a,b){this.instanceprops=a;this.pmr=b;this.devsettings=g.clone();this.devsettings.init(b,a)},fetch_instanceprops:function fetch_instanceprops(){return this.instanceprops},onUploadSuccess:function onUploadSuccess(b){a("#"+b+" > .poodll_save-recording").hide();a("#"+b+" > .poodll_savedsuccessfully").show()},onUploadFailure:function onUploadFailure(){},fetch_status_bar:function fetch_status_bar(a){return"
00:00:00
"},fetch_preview_audio:function fetch_preview_audio(a){return""},fetch_preview_video:function fetch_preview_video(a){return this.fetch_preview_audio(a)},fetch_resource_audio:function fetch_resource_audio(a){return""},fetch_resource_video:function fetch_resource_video(a){return this.fetch_resource_audio(a)},onMediaError:function onMediaError(a){console.error("media error",a)},onMediaSuccess_video:function onMediaSuccess_video(a){this.fetch_instanceprops(a);this.set_visual_mode("recordingmode",a)},onMediaSuccess_audio:function onMediaSuccess_audio(a){var b=this.fetch_instanceprops(a);b.controlbar.preview.attr("src",null);b.uploader.Output("");this.therecanim.start();b.timer.reset();b.timer.start();this.update_status(a);this.set_visual_mode("recordingmode",a)},handle_timer_update:function handle_timer_update(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time());if(0==b.timer.seconds&&0";l+="
";l+=this.devsettings.fetch_dialogue_box();l+=e.downloaddialog.fetch_dialogue_box();l+=e.errordialog.fetch_dialogue_box();l+="
";l+=d,l+="
";l+="";l+="";l+="";l+="";l+=k,l+="
";a(b).prepend(l);var m={settingsdialog:a("#"+c+" .poodll_dialogue_box_settings"),downloaddialog:a("#"+c+" .poodll_dialogue_box_download"),errorsdialog:a("#"+c+" .poodll_dialogue_box_errors"),settingsicon:a("#"+c+" .settingsicon"),status:a("#"+c+" .poodll_status_readaloud"),preview:a("#"+c+" .poodll_preview_readaloud"),startbutton:a("#"+c+" .poodll_start-recording_readaloud"),testbutton:a("#"+c+" .poodll_test-recording_readaloud"),stopbutton:a("#"+c+" .poodll_stop-recording_readaloud"),playcanvas:a("#"+c+"_playcanvas")};e.downloaddialog.set_dialogue_box(m.downloaddialog);e.errordialog.set_dialogue_box(m.errorsdialog);this.devsettings.set_dialogue_box(m.settingsdialog);return m},register_controlbar_events_video:function register_controlbar_events_video(a,b){return this.register_controlbar_events_audio(a,b)},register_controlbar_events_audio:function register_controlbar_events_audio(a,b){var c=this,d=this.pmr,e=this.fetch_instanceprops(b);e.config.recanim="hwave_mic";var g=f.clone();c.therecanim=g;g.init(e.audioanalyser,e.controlbar.playcanvas.get(0));this.set_visual_mode("startmode",b);e.controlbar.testbutton.click(function(){e.config.hermes.disable();e.timer.disable();d.do_start_audio(e,a);setTimeout(function testover(){d.do_stop_audio(e);g.clear();if(g.sounddetected){c.set_visual_mode("readymode",b)}},4e3)});e.controlbar.settingsicon.click(function(){if(!c.uploaded){c.devsettings.open()}else{e.downloaddialog.open()}});e.controlbar.startbutton.click(function(){e.config.hermes.enable();e.timer.enable();d.do_start_audio(e,a)});e.controlbar.stopbutton.click(function(){d.do_stop_audio(e);g.clear();e.timer.stop();c.update_status(b);var a=function(){if(e.blobs&&000:00:00';return b},fetch_preview_audio:function(a){var b='';return b},fetch_preview_video:function(a){return this.fetch_preview_audio(a)},fetch_resource_audio:function(a){var b='';return b},fetch_resource_video:function(a){return this.fetch_resource_audio(a)},onMediaError:function(a){console.error("media error",a)},onMediaSuccess_video:function(a){this.fetch_instanceprops(a);this.set_visual_mode("startbuttonrecording",a)},onMediaSuccess_audio:function(a){var b=this.fetch_instanceprops(a);b.controlbar.preview.attr("src",null),b.uploader.Output(""),this.therecanim.start(),b.timer.reset(),b.timer.start(),this.update_status(a),"testbuttonrecording"!=this.buttonmode&&this.set_visual_mode("startbuttonrecording",a)},handle_timer_update:function(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time()),0==b.timer.seconds&&b.timer.initseconds>0&&this.process_recording_stop(a)},update_status:function(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time())},fetch_uploader_skin:function(a,b){var c=this.fetch_instanceprops(a),d=f.clone();return d.init(c.config,b,c.controlbar.playcanvas,c.controlbar.status),d},set_button_style:function(b){var c=["testbuttonready","testbuttonrecording","startbuttonready","startbuttoncountdown","startbuttonrecording","uploading","allfinished"];a.each(c,function(b,c){a(".poodll_mediarecorderbox_readseed").removeClass("poodll_mediarecorder_readseed_"+c),a(".poodll_mediarecorderbox_readseed").removeClass("readseed_canclick")}),a(".poodll_mediarecorderbox_readseed").addClass("poodll_mediarecorder_readseed_"+b),"testbuttonready"!=b&&"startbuttonready"!=b||a(".poodll_mediarecorderbox_readseed").addClass("readseed_canclick")},set_visual_mode:function(a,b){var c=this,d=this.fetch_instanceprops(b);this.buttonmode=a;var e={};switch(e.type="recorderstatus",e.status=a,d.config.hermes.postMessage(e),a){case"testbuttonready":d.controlbar.status.hide(),d.controlbar.thecaption.text("SPEAK"),d.controlbar.thecaption.show(),d.controlbar.playcanvas.hide(),c.set_button_style(a);break;case"testbuttonrecording":d.controlbar.thecaption.hide(),d.controlbar.playcanvas.show(),c.set_button_style(a);break;case"startbuttonready":d.controlbar.thecaption.text("START"),d.controlbar.thecaption.show(),d.controlbar.playcanvas.hide(),c.set_button_style(a);break;case"startbuttoncountdown":d.controlbar.thecaption.text("----------"),d.controlbar.thecaption.show(),d.controlbar.playcanvas.hide(),c.set_button_style(a);break;case"startbuttonrecording":if(d.controlbar.playcanvas.show(),"1"==d.config.allowearlyexit&&d.timer.enabled){var f=M.util.get_string("recui_clicktofinish","filter_poodll");d.controlbar.thecaption.text(f),d.controlbar.thecaption.show()}else d.controlbar.thecaption.hide();c.set_button_style(a);break;case"uploading":var g='';d.controlbar.thecaption.html(g),d.controlbar.thecaption.show(),d.controlbar.playcanvas.hide(),c.set_button_style(a),d.controlbar.status.show();break;case"allfinished":d.controlbar.thecaption.text("Finished"),d.controlbar.thecaption.show(),d.controlbar.playcanvas.hide(),d.controlbar.status.hide(),c.set_button_style(a)}},insert_controlbar_video:function(a,b,c,d){return this.prepare_controlbar_audio(a,b,c,d)},insert_controlbar_audio:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"audio");return e},prepare_controlbar:function(b,c,d,e,f){var g=this.fetch_instanceprops(c),h=g.config.media_skin_style,i="poodll_mediarecorder_audio",j=(this.pmr.fetch_strings(),M.util.get_string("recui_startactivity","filter_poodll"),M.util.get_string("recui_testmic","filter_poodll"),M.util.get_string("recui_stop","filter_poodll"),this.fetch_status_bar("readseed")),k='
';k+='
',k+=this.devsettings.fetch_dialogue_box(),k+=g.downloaddialog.fetch_dialogue_box(),k+=g.errordialog.fetch_dialogue_box(),k+='
',k+=d,k+='
',k+='',k+='',k+='',k+='',k+=j,k+="
",a(b).prepend(k);var l={settingsdialog:a("#"+c+" .poodll_dialogue_box_settings"),downloaddialog:a("#"+c+" .poodll_dialogue_box_download"),errorsdialog:a("#"+c+" .poodll_dialogue_box_errors"),settingsicon:a("#"+c+" .settingsicon"),status:a("#"+c+" .poodll_status_readseed"),preview:a("#"+c+" .poodll_preview_readseed"),bigbutton:a("#"+c+".poodll_mediarecorderbox_readseed"),playcanvas:a("#"+c+"_playcanvas"),thecaption:a("#"+c+"_caption"),stopbutton:a("#"+c+" .poodll_mediarecorder_bogusstopbutton_readseed"),startbutton:a("#"+c+" .poodll_mediarecorder_bogusstartbutton_readseed")};return g.downloaddialog.set_dialogue_box(l.downloaddialog),g.errordialog.set_dialogue_box(l.errorsdialog),this.devsettings.set_dialogue_box(l.settingsdialog),l},register_controlbar_events_video:function(a,b){return this.register_controlbar_events_audio(a,b)},register_controlbar_events_audio:function(b,d){var e=this,f=this.pmr,h=this.fetch_instanceprops(d);h.config.recanim="hwave_mic";var i=g.clone();e.therecanim=i,i.init(h.audioanalyser,h.controlbar.playcanvas.get(0)),this.set_visual_mode("testbuttonready",d),h.controlbar.bigbutton.click(function(c){if(c.target===this||a(c.target).hasClass("poodll_mediarecorder_caption_readseed")||a(c.target).hasClass("poodll_mediarecorder_playcanvas_readseed"))switch(e.buttonmode){case"testbuttonready":var g={};g.type="recorderstatus",g.status="testbuttonrecording",h.config.hermes.postMessage(g),h.config.hermes.disable(),h.timer.disable();var j=function(){if(h.mediaRecorder&&f.do_stop_audio(h),i.clear(),h.config.hermes.enable(),i.sounddetected)e.set_visual_mode("startbuttonready",d);else{var a={};a.type="recorderstatus",a.status="testrecordingfailed",h.config.hermes.postMessage(a),e.set_visual_mode("testbuttonready",d)}};f.do_start_audio(h,b),setTimeout(j,4e3),e.set_visual_mode("testbuttonrecording",d);break;case"startbuttonready":var k=function(){var a=(new Date).getTime(),c=a-l;if(c>m)h.timer.enable(),f.do_start_audio(h,b);else{var d=!1;if(n<0&&c>0?d=m/1e3:n<1e3&&c>1e3?d=m/1e3-1:n<2e3&&c>2e3&&(d=m/1e3-2),d){var e={};e.type="countdownstatus",e.status=d,h.config.hermes.postMessage(e)}n=c,setTimeout(k,100)}};h.config.hermes.enable(),e.set_visual_mode("startbuttoncountdown",d);var l=(new Date).getTime(),m=3e3,n=-1;setTimeout(k,100);break;case"startbuttonrecording":"1"==h.config.allowearlyexit&&h.timer.enabled&&e.process_recording_stop(d);break;case"stopbutton":e.process_recording_stop()}}),h.controlbar.settingsicon.click(function(a){c.debug("we no proapagato"),a.stopPropagation(),e.uploaded?h.downloaddialog.open():e.devsettings.open()}),window.onbeforeunload=function(){}},process_recording_stop:function(a){var b=this,c=this.pmr,d=this.fetch_instanceprops(a),e=b.therecanim;c.do_stop_audio(d),e.clear(),d.timer.stop(),b.update_status(a);var f=function(){d.blobs&&d.blobs.length>0?(c.do_save_audio(d),d.uploaded=!0):setTimeout(f,200)};setTimeout(f,200),b.set_visual_mode("uploading",a)},enable_button:function(b){a(b).attr("disabled",!1),a(b).removeClass("pmr_disabled")},disable_button:function(b){a(b).attr("disabled",!0),a(b).addClass("pmr_disabled")}}}); \ No newline at end of file +define ("filter_poodll/poodll_readseedmediaskin",["jquery","jqueryui","core/log","filter_poodll/utils_amd","filter_poodll/upskin_radial","filter_poodll/upskin_bar","filter_poodll/anim_hwave_mic","filter_poodll/dlg_devicesettings"],function(a,b,c,d,e,f,g,h){"use strict";c.debug("PoodLL Read Seed Skin: initialising");return{instanceprops:null,pmr:null,devsettings:null,therecanim:null,buttonmode:null,clone:function clone(){return a.extend(!0,{},this)},init:function init(a,b){this.instanceprops=a;this.pmr=b;this.devsettings=h.clone();this.devsettings.init(b,a)},fetch_instanceprops:function fetch_instanceprops(){return this.instanceprops},onUploadSuccess:function onUploadSuccess(a){this.set_visual_mode("allfinished",a)},onUploadFailure:function onUploadFailure(){},fetch_status_bar:function fetch_status_bar(a){return"
00:00:00
"},fetch_preview_audio:function fetch_preview_audio(a){return""},fetch_preview_video:function fetch_preview_video(a){return this.fetch_preview_audio(a)},fetch_resource_audio:function fetch_resource_audio(a){return""},fetch_resource_video:function fetch_resource_video(a){return this.fetch_resource_audio(a)},onMediaError:function onMediaError(a){console.error("media error",a)},onMediaSuccess_video:function onMediaSuccess_video(a){this.fetch_instanceprops(a);this.set_visual_mode("startbuttonrecording",a)},onMediaSuccess_audio:function onMediaSuccess_audio(a){var b=this.fetch_instanceprops(a);b.controlbar.preview.attr("src",null);b.uploader.Output("");this.therecanim.start();b.timer.reset();b.timer.start();this.update_status(a);if("testbuttonrecording"!=this.buttonmode){this.set_visual_mode("startbuttonrecording",a)}},handle_timer_update:function handle_timer_update(a){var b=this.fetch_instanceprops(a);b.controlbar.status.html(b.timer.fetch_display_time());if(0==b.timer.seconds&&0");d.controlbar.thecaption.show();d.controlbar.playcanvas.hide();c.set_button_style(a);d.controlbar.status.show();break;case"allfinished":d.controlbar.thecaption.text("Finished");d.controlbar.thecaption.show();d.controlbar.playcanvas.hide();d.controlbar.status.hide();c.set_button_style(a);break;}},insert_controlbar_video:function insert_controlbar_video(a,b,c,d){return this.prepare_controlbar_audio(a,b,c,d)},insert_controlbar_audio:function insert_controlbar_audio(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"audio");return e},prepare_controlbar:function prepare_controlbar(b,c,d){var e=this.fetch_instanceprops(c),f=e.config.media_skin_style,g=this.pmr.fetch_strings(),h=M.util.get_string("recui_startactivity","filter_poodll"),i=M.util.get_string("recui_testmic","filter_poodll"),j=M.util.get_string("recui_stop","filter_poodll"),k=this.fetch_status_bar("readseed"),l="
";l+="
";l+=this.devsettings.fetch_dialogue_box();l+=e.downloaddialog.fetch_dialogue_box();l+=e.errordialog.fetch_dialogue_box();l+="
";l+=d,l+="
";l+="";l+="";l+="";l+="";l+=k;l+="
";a(b).prepend(l);var m={settingsdialog:a("#"+c+" .poodll_dialogue_box_settings"),downloaddialog:a("#"+c+" .poodll_dialogue_box_download"),errorsdialog:a("#"+c+" .poodll_dialogue_box_errors"),settingsicon:a("#"+c+" .settingsicon"),status:a("#"+c+" .poodll_status_readseed"),preview:a("#"+c+" .poodll_preview_readseed"),bigbutton:a("#"+c+".poodll_mediarecorderbox_readseed"),playcanvas:a("#"+c+"_playcanvas"),thecaption:a("#"+c+"_caption"),stopbutton:a("#"+c+" .poodll_mediarecorder_bogusstopbutton_readseed"),startbutton:a("#"+c+" .poodll_mediarecorder_bogusstartbutton_readseed")};e.downloaddialog.set_dialogue_box(m.downloaddialog);e.errordialog.set_dialogue_box(m.errorsdialog);this.devsettings.set_dialogue_box(m.settingsdialog);return m},register_controlbar_events_video:function register_controlbar_events_video(a,b){return this.register_controlbar_events_audio(a,b)},register_controlbar_events_audio:function register_controlbar_events_audio(b,d){var f=this,h=this.pmr,i=this.fetch_instanceprops(d);i.config.recanim="hwave_mic";var e=g.clone();f.therecanim=e;e.init(i.audioanalyser,i.controlbar.playcanvas.get(0));this.set_visual_mode("testbuttonready",d);i.controlbar.bigbutton.click(function(c){if(c.target!==this&&!a(c.target).hasClass("poodll_mediarecorder_caption_readseed")&&!a(c.target).hasClass("poodll_mediarecorder_playcanvas_readseed")){return}switch(f.buttonmode){case"testbuttonready":var g={};g.type="recorderstatus";g.status="testbuttonrecording";i.config.hermes.postMessage(g);i.config.hermes.disable();i.timer.disable();var j=function(){if(i.mediaRecorder){h.do_stop_audio(i)}e.clear();i.config.hermes.enable();if(e.sounddetected){f.set_visual_mode("startbuttonready",d)}else{i.config.hermes.postMessage({type:"recorderstatus",status:"testrecordingfailed"});f.set_visual_mode("testbuttonready",d)}};h.do_start_audio(i,b);setTimeout(j,4e3);f.set_visual_mode("testbuttonrecording",d);break;case"startbuttonready":var k=function(){var a=new Date().getTime(),c=a-l;if(c>m){i.timer.enable();h.do_start_audio(i,b)}else{var d=!1;if(0>n&&0n&&1e3n&&2e3a.flashonandroid&&e){return!1}else{if("audio"!=a.mediatype&&"video"!=a.mediatype){return!1}b.debug("PoodLL Red5 Recorder: supports this browser");return!0}},embed:function embed(b,c){switch(c.mediatype){case"video":var d=a.parseJSON(c.red5video_widgetjson);break;case"audio":default:var d=a.parseJSON(c.red5audio_widgetjson);}e.embed.swf(d)}}}); +//# sourceMappingURL=poodll_red5recorder.min.js.map diff --git a/amd/build/poodll_scenariomediaskin.min.js b/amd/build/poodll_scenariomediaskin.min.js index 0ca7e2ea..4c316553 100644 --- a/amd/build/poodll_scenariomediaskin.min.js +++ b/amd/build/poodll_scenariomediaskin.min.js @@ -1 +1,2 @@ -define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/upskin_bar"],function(a,b,c,d){"use strict";return b.debug("PoodLL Scenario Skin: initialising"),{instanceprops:null,pmr:null,uploaded:!1,recorded:!1,played:!1,mustResetResourcePlayer:!1,clone:function(){return a.extend(!0,{},this)},init:function(a,b){this.instanceprops=a,this.pmr=b},fetch_instanceprops:function(){return this.instanceprops},onUploadSuccess:function(b){a("#"+b+" > .poodll_save-recording").hide(),a("#"+b+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(a){},fetch_status_bar:function(a){var b='
';return b},fetch_preview_audio:function(a){var b='';return b},fetch_preview_video:function(a){var b='';return b},fetch_resource_audio:function(a){var b='';return b},fetch_resource_video:function(a){var b='';return b},fetch_uploader_skin:function(a,b){var c=this.fetch_instanceprops(a),e=d.clone();return e.init(c.config,b,c.controlbar.split_progresscanvas,c.controlbar.status),e},onMediaError:function(a){console.error("media error",a)},onMediaSuccess_video:function(a){var b=this.fetch_instanceprops(a);b.controlbar.stopbutton.attr("disabled",!1),b.controlbar.savebutton.attr("disabled",!1)},onMediaSuccess_audio:function(a){var b=this.fetch_instanceprops(a);b.controlbar.checkplayer.attr("src",null),b.controlbar.stopbutton.attr("disabled",!1),b.controlbar.savebutton.attr("disabled",!1)},handle_timer_update:function(a){if(this.played||this.recorded){var b=this.fetch_instanceprops(a),c=M.util.get_string("recui_recording","filter_poodll");this.update_status(a,c+b.timer.fetch_display_time()),0==b.timer.seconds&&b.timer.initseconds>0&&b.controlbar.stopbutton.click()}},update_status:function(a,b){var c=this.fetch_instanceprops(a);c.controlbar.status.html(b)},set_visual_mode:function(a,b){var c=this;switch(a){case"recordingmode":c.disable_button(b.controlbar.resourceplaybutton),b.controlbar.resourceplaybutton.empty(),b.controlbar.resourceplaybutton.html(''),b.controlbar.resourceplaybutton.addClass("poodll_mediarecorderholder_scenario_recordcolor"),b.controlbar.status.addClass("poodll_mediarecorderholder_scenario_recordcolor"),c.handle_timer_update(b.controlbarid),c.enable_button(b.controlbar.stopbutton);break;case"resourceplayingmode":c.disable_button(b.controlbar.resourceplaybutton),c.disable_button(b.controlbar.stopbutton);break;case"neverrecordedmode":b.controlbar.resourceplaybutton.empty(),b.controlbar.resourceplaybutton.html('

Start

'),c.enable_button(b.controlbar.resourceplaybutton),c.disable_button(b.controlbar.stopbutton),this.update_status(b.controlbarid,M.util.get_string("recui_ready","filter_poodll"));break;case"allstoppedmode":c.disable_button(b.controlbar.resourceplaybutton),c.disable_button(b.controlbar.stopbutton),b.controlbar.resourceplaybutton.empty(),b.controlbar.resourceplaybutton.html(''),b.controlbar.resourceplaybutton.removeClass("poodll_mediarecorderholder_scenario_recordcolor"),b.controlbar.status.removeClass("poodll_mediarecorderholder_scenario_recordcolor"),this.update_status(b.controlbarid,M.util.get_string("recui_finished","filter_poodll"))}},insert_controlbar_video:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"video");return e},insert_controlbar_audio:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"audio");return e},prepare_controlbar:function(b,c,d,e,f){var g=this.fetch_instanceprops(c),h=g.config.media_skin_style,i="video"==f?"poodll_mediarecorder_video":"poodll_mediarecorder_audio";e=e.replace("@@RESOURCEURL@@",g.config.resource);var j=this.pmr.fetch_strings(),k='
';k+='
',k+='
',k+=d,k+=e,k+='',k+=' ',k+=' ',k+='
",k+='
',k+='
',k+='';var l=this.fetch_status_bar("scenario");k+=l,k+="
",k+="
",a(b).append(k);var m='',n='
'+m+"
",o="
";a(".qtext").prepend(o),a(".qtext").prepend(n);var p={scenario_progresscanvas:a("#"+c+" .scenario_range"),marker:a("#"+c+" .marker"),resourceplayer:a("#"+c+" .poodll_resourceplayer_scenario"),checkplayer:a("#"+c+" .poodll_checkplayer_scenario"),stopbutton:a("#"+c+" .poodll_stop-recording_scenario"),resourcestopbutton:a("#"+c+" .poodll_stop-resource_scenario"),startbutton:a("#"+c+" .poodll_start-recording_scenario"),playbackbutton:a("#"+c+" .poodll_playback-recording_scenario"),stopplaybackbutton:a("#"+c+" .poodll_stopplayback-recording_scenario"),savebutton:a("#"+c+" .poodll_save-recording_scenario"),resourceplaybutton:a(".poodll_mediarecorder_button_scenario.poodll_play-resource_scenario"),status:a(".poodll_status_scenario")};return p},register_controlbar_events_video:function(a,b){return this.register_controlbar_events_audio(a,b)},do_callback:function(b){switch(b[1]){case"filesubmitted":var c=document.getElementById(b[3]);null==c&&(c=parent.document.getElementById(b[3])),c&&(c.value=b[2]),a("#responseform input[name=next]").attr("disabled",!1)}},register_controlbar_events_audio:function(b,c){var d=this,e=this.pmr,f=this.fetch_instanceprops(c);this.set_visual_mode("neverrecordedmode",f),f.config.callbackjs=d.do_callback,a("#responseform input[name=next]").attr("disabled",!0),f.controlbar.startbutton.click(function(){e.do_start_audio(f,b),d.recorded=!0,f.timer.reset(),f.timer.start(),d.set_visual_mode("recordingmode",f)}),f.controlbar.stopbutton.click(function(){d.do_stop_resource(f),e.do_stop_audio(f),d.disable_button(this),setTimeout(function(){f.controlbar.savebutton.click()},100),f.timer.stop(),d.set_visual_mode("allstoppedmode",f)}),f.controlbar.resourceplaybutton.click(function(){navigator.mediaDevices.getUserMedia({audio:!0}).then(function(a){f.controlbar.startbutton.trigger("click"),d.played=!0,""!=f.config.resource&&d.do_play_resource(f)})["catch"](function(a){alert(a)})}),f.controlbar.resourcestopbutton.click(function(){d.do_stop_resource(f),d.recorded?d.set_visual_mode("allstoppedmode",f):d.set_visual_mode("neverrecordedmode",f)}),f.controlbar.savebutton.click(function(){return d.disable_button(this),f.blobs&&f.blobs.length>0?(e.do_save_audio(f),d.uploaded=!0,d.disable_button(f.controlbar.startbutton)):f.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll")),!1})},set_completion:function(a,b){return},do_stop_resource:function(a){console.log("stopped the resource");var b=a.controlbar.resourceplayer.get(0);if(b.pause(),b.currentTime=0,a.mustResetResourcePlayer){a.mustResetResourcePlayer=!1,b.src=a.config.resource;b.load()}},do_play_resource:function(a){var b=a.controlbar.resourceplayer.get(0);b.play(),b.currentTime=0},enable_button:function(b){a(b).attr("disabled",!1),a(b).removeClass("pmr_disabled")},disable_button:function(b){a(b).attr("disabled",!0),a(b).addClass("pmr_disabled")}}}); \ No newline at end of file +define ("filter_poodll/poodll_scenariomediaskin",["jquery","core/log","filter_poodll/utils_amd","filter_poodll/upskin_bar"],function(a,b,c,d){"use strict";b.debug("PoodLL Scenario Skin: initialising");return{instanceprops:null,pmr:null,uploaded:!1,recorded:!1,played:!1,mustResetResourcePlayer:!1,clone:function clone(){return a.extend(!0,{},this)},init:function init(a,b){this.instanceprops=a;this.pmr=b},fetch_instanceprops:function fetch_instanceprops(){return this.instanceprops},onUploadSuccess:function onUploadSuccess(b){a("#"+b+" > .poodll_save-recording").hide();a("#"+b+" > .poodll_savedsuccessfully").show()},onUploadFailure:function onUploadFailure(){},fetch_status_bar:function fetch_status_bar(a){return"
"},fetch_preview_audio:function fetch_preview_audio(a){return""},fetch_preview_video:function fetch_preview_video(a){return""},fetch_resource_audio:function fetch_resource_audio(a){return""},fetch_resource_video:function fetch_resource_video(a){return""},fetch_uploader_skin:function fetch_uploader_skin(a,b){var c=this.fetch_instanceprops(a),e=d.clone();e.init(c.config,b,c.controlbar.split_progresscanvas,c.controlbar.status);return e},onMediaError:function onMediaError(a){console.error("media error",a)},onMediaSuccess_video:function onMediaSuccess_video(a){var b=this.fetch_instanceprops(a);b.controlbar.stopbutton.attr("disabled",!1);b.controlbar.savebutton.attr("disabled",!1)},onMediaSuccess_audio:function onMediaSuccess_audio(a){var b=this.fetch_instanceprops(a);b.controlbar.checkplayer.attr("src",null);b.controlbar.stopbutton.attr("disabled",!1);b.controlbar.savebutton.attr("disabled",!1)},handle_timer_update:function handle_timer_update(a){if(!this.played&&!this.recorded){return}var b=this.fetch_instanceprops(a),c=M.util.get_string("recui_recording","filter_poodll");this.update_status(a,c+b.timer.fetch_display_time());if(0==b.timer.seconds&&0");b.controlbar.resourceplaybutton.addClass("poodll_mediarecorderholder_scenario_recordcolor");b.controlbar.status.addClass("poodll_mediarecorderholder_scenario_recordcolor");c.handle_timer_update(b.controlbarid);c.enable_button(b.controlbar.stopbutton);break;case"resourceplayingmode":c.disable_button(b.controlbar.resourceplaybutton);c.disable_button(b.controlbar.stopbutton);break;case"neverrecordedmode":b.controlbar.resourceplaybutton.empty();b.controlbar.resourceplaybutton.html("

Start

");c.enable_button(b.controlbar.resourceplaybutton);c.disable_button(b.controlbar.stopbutton);this.update_status(b.controlbarid,M.util.get_string("recui_ready","filter_poodll"));break;case"allstoppedmode":c.disable_button(b.controlbar.resourceplaybutton);c.disable_button(b.controlbar.stopbutton);b.controlbar.resourceplaybutton.empty();b.controlbar.resourceplaybutton.html("");b.controlbar.resourceplaybutton.removeClass("poodll_mediarecorderholder_scenario_recordcolor");b.controlbar.status.removeClass("poodll_mediarecorderholder_scenario_recordcolor");this.update_status(b.controlbarid,M.util.get_string("recui_finished","filter_poodll"));break;}},insert_controlbar_video:function insert_controlbar_video(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"video");return e},insert_controlbar_audio:function insert_controlbar_audio(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"audio");return e},prepare_controlbar:function prepare_controlbar(b,c,d,e,f){var g=this.fetch_instanceprops(c),h=g.config.media_skin_style,i="video"==f?"poodll_mediarecorder_video":"poodll_mediarecorder_audio";e=e.replace("@@RESOURCEURL@@",g.config.resource);var j=this.pmr.fetch_strings(),k="
";k+="
";k+="
";k+=d,k+=e,k+="";k+=" ";k+=" ";k+="
";k+="
";k+="
";k+="";var l=this.fetch_status_bar("scenario");k+=l;k+="
";k+="
";a(b).append(k);a(".qtext").prepend("
");a(".qtext").prepend("
");var m={scenario_progresscanvas:a("#"+c+" .scenario_range"),marker:a("#"+c+" .marker"),resourceplayer:a("#"+c+" .poodll_resourceplayer_scenario"),checkplayer:a("#"+c+" .poodll_checkplayer_scenario"),stopbutton:a("#"+c+" .poodll_stop-recording_scenario"),resourcestopbutton:a("#"+c+" .poodll_stop-resource_scenario"),startbutton:a("#"+c+" .poodll_start-recording_scenario"),playbackbutton:a("#"+c+" .poodll_playback-recording_scenario"),stopplaybackbutton:a("#"+c+" .poodll_stopplayback-recording_scenario"),savebutton:a("#"+c+" .poodll_save-recording_scenario"),resourceplaybutton:a(".poodll_mediarecorder_button_scenario.poodll_play-resource_scenario"),status:a(".poodll_status_scenario")};return m},register_controlbar_events_video:function register_controlbar_events_video(a,b){return this.register_controlbar_events_audio(a,b)},do_callback:function do_callback(b){switch(b[1]){case"filesubmitted":var c=document.getElementById(b[3]);if(null==c){c=parent.document.getElementById(b[3])}if(c){c.value=b[2]}a("#responseform input[name=next]").attr("disabled",!1);}},register_controlbar_events_audio:function register_controlbar_events_audio(b,c){var d=this,e=this.pmr,f=this.fetch_instanceprops(c);this.set_visual_mode("neverrecordedmode",f);f.config.callbackjs=d.do_callback;a("#responseform input[name=next]").attr("disabled",!0);f.controlbar.startbutton.click(function(){e.do_start_audio(f,b);d.recorded=!0;f.timer.reset();f.timer.start();d.set_visual_mode("recordingmode",f)});f.controlbar.stopbutton.click(function(){d.do_stop_resource(f);e.do_stop_audio(f);d.disable_button(this);setTimeout(function(){f.controlbar.savebutton.click()},100);f.timer.stop();d.set_visual_mode("allstoppedmode",f)});f.controlbar.resourceplaybutton.click(function(){navigator.mediaDevices.getUserMedia({audio:!0}).then(function(){f.controlbar.startbutton.trigger("click");d.played=!0;if(""!=f.config.resource){d.do_play_resource(f)}}).catch(function(a){alert(a)})});f.controlbar.resourcestopbutton.click(function(){d.do_stop_resource(f);if(d.recorded){d.set_visual_mode("allstoppedmode",f)}else{d.set_visual_mode("neverrecordedmode",f)}});f.controlbar.savebutton.click(function(){d.disable_button(this);if(f.blobs&&0 .poodll_save-recording").hide(),a("#"+b+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(a){},fetch_status_bar:function(a){var b='
';return b},fetch_preview_audio:function(a){var b='';return b},fetch_preview_video:function(a){var b='';return b},fetch_resource_audio:function(a){var b='';return b},fetch_resource_video:function(a){var b='';return b},fetch_uploader_skin:function(a,b){return!1},onMediaError:function(a){console.error("media error",a)},onMediaSuccess_video:function(a){var b=this.fetch_instanceprops(a);this.recorded=!0,this.do_play_resource(b),b.controlbar.resourceplayer.bind("ended",function(){b.controlbar.stopbutton.click()}),self.set_visual_mode("recordingmode",b)},onMediaSuccess_audio:function(a){var b=this.fetch_instanceprops(a);b.controlbar.checkplayer.attr("src",null),this.recorded=!0,this.do_play_resource(b),b.controlbar.resourceplayer.bind("ended",function(){b.controlbar.stopbutton.click()}),self.set_visual_mode("recordingmode",b)},handle_timer_update:function(a){var b=this.fetch_instanceprops(a);this.update_status(a),0==b.timer.seconds&&b.timer.initseconds>0&&b.controlbar.stopbutton.click()},update_status:function(a){},set_visual_mode:function(a,b){var c=this;switch(a){case"recordingmode":c.disable_button(b.controlbar.startbutton),b.controlbar.startbutton.hide(),c.disable_button(b.controlbar.stopplaybackbutton),b.controlbar.stopplaybackbutton.hide(),c.disable_button(b.controlbar.resourcestopbutton),b.controlbar.resourcestopbutton.hide(),c.enable_button(b.controlbar.stopbutton),b.controlbar.stopbutton.show(),c.disable_button(b.controlbar.playbackbutton),b.controlbar.playbackbutton.show(),c.disable_button(b.controlbar.resourceplaybutton),b.controlbar.resourceplaybutton.show();break;case"resourceplayingmode":c.disable_button(b.controlbar.stopbutton),b.controlbar.stopbutton.hide(),c.disable_button(b.controlbar.playbackbutton),b.controlbar.playbackbutton.hide(),c.disable_button(b.controlbar.resourceplaybutton),b.controlbar.resourceplaybutton.hide(),c.disable_button(b.controlbar.startbutton),b.controlbar.startbutton.show(),c.disable_button(b.controlbar.stopplaybackbutton),b.controlbar.stopplaybackbutton.show(),c.enable_button(b.controlbar.resourcestopbutton),b.controlbar.resourcestopbutton.show();break;case"playingbackmode":c.disable_button(b.controlbar.stopbutton),b.controlbar.stopbutton.hide(),c.disable_button(b.controlbar.playbackbutton),b.controlbar.playbackbutton.hide(),c.disable_button(b.controlbar.resourcestopbutton),b.controlbar.resourcestopbutton.hide(),c.disable_button(b.controlbar.startbutton),b.controlbar.startbutton.show(),c.enable_button(b.controlbar.stopplaybackbutton),b.controlbar.stopplaybackbutton.show(),c.disable_button(b.controlbar.resourceplaybutton),b.controlbar.resourceplaybutton.show();break;case"neverrecordedmode":c.disable_button(b.controlbar.stopbutton),b.controlbar.stopbutton.hide(),c.disable_button(b.controlbar.stopplaybackbutton),b.controlbar.stopplaybackbutton.hide(),c.disable_button(b.controlbar.resourcestopbutton),b.controlbar.resourcestopbutton.hide(),c.enable_button(b.controlbar.startbutton),b.controlbar.startbutton.show(),c.disable_button(b.controlbar.playbackbutton),b.controlbar.playbackbutton.show(),c.enable_button(b.controlbar.resourceplaybutton),b.controlbar.resourceplaybutton.show();break;case"allstoppedmode":c.disable_button(b.controlbar.stopbutton),b.controlbar.stopbutton.hide(),c.disable_button(b.controlbar.stopplaybackbutton),b.controlbar.stopplaybackbutton.hide(),c.disable_button(b.controlbar.resourcestopbutton),b.controlbar.resourcestopbutton.hide(),c.enable_button(b.controlbar.startbutton),b.controlbar.startbutton.show(),c.enable_button(b.controlbar.playbackbutton),b.controlbar.playbackbutton.show(),c.enable_button(b.controlbar.resourceplaybutton),b.controlbar.resourceplaybutton.show()}},insert_controlbar_video:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"video");return e},insert_controlbar_audio:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"audio");return e},prepare_controlbar:function(b,c,d,e,f){var g=this.fetch_instanceprops(c),h=g.config.media_skin_style,i="video"==f?"poodll_mediarecorder_video":"poodll_mediarecorder_audio";e=e.replace("@@RESOURCEURL@@",g.config.resource);var j="poodll_mediarecorder_size_auto";switch(g.config.size){case"small":j="poodll_mediarecorder_size_small";break;case"big":j="poodll_mediarecorder_size_big";break;case"auto":j="poodll_mediarecorder_size_auto"}var k=(this.pmr.fetch_strings(),'
');k+='
',k+='
';var l=this.fetch_status_bar("shadow");k+=l,k+=d,k+=e,k+='',k+='',k+='',k+='',k+=' ',k+=' ',k+='',k+="
",a(b).prepend(k);var m={marker:a("#"+c+" .marker"),status:a("#"+c+" .poodll_status_shadow"),resourceplayer:a("#"+c+" .poodll_resourceplayer_shadow"),checkplayer:a("#"+c+" .poodll_checkplayer_shadow"),resourceplaybutton:a("#"+c+" .poodll_play-resource_shadow"),resourcestopbutton:a("#"+c+" .poodll_stop-resource_shadow"),startbutton:a("#"+c+" .poodll_start-recording_shadow"),stopbutton:a("#"+c+" .poodll_stop-recording_shadow"),playbackbutton:a("#"+c+" .poodll_playback-recording_shadow"),stopplaybackbutton:a("#"+c+" .poodll_stopplayback-recording_shadow"),savebutton:a("#"+c+" .poodll_save-recording_shadow")};return m},register_controlbar_events_video:function(a,b){return this.register_controlbar_events_audio(a,b)},register_controlbar_events_audio:function(a,b){var c=this,d=this.pmr,e=this.fetch_instanceprops(b);e.controlbar.startbutton.click(function(){d.do_start_audio(e,a)}),e.controlbar.stopbutton.click(function(){d.do_stop_audio(e),c.disable_button(this);var a=e.controlbar.resourceplayer;a&&a.get(0)&&a.get(0).pause(),c.set_visual_mode("allstoppedmode",e),c.do_stop_resource(e)}),e.controlbar.playbackbutton.click(function(){c.disable_button(this),e.controlbar.marker.show();var a=e.controlbar.resourceplayer.get(0);d.do_play_audio(e,a),e.mustResetResourcePlayer=!0,e.controlbar.resourceplayer.bind("ended",function(){c.set_visual_mode("allstoppedmode",e)}),c.set_visual_mode("playingbackmode",e),c.set_completion(!0,e)}),e.controlbar.stopplaybackbutton.click(function(){c.do_stop_resource(e),c.set_visual_mode("allstoppedmode",e)}),e.controlbar.resourceplaybutton.click(function(){c.do_play_resource(e),e.controlbar.resourceplayer.bind("ended",function(){c.recorded?c.set_visual_mode("allstoppedmode",e):c.set_visual_mode("neverrecordedmode",e)}),c.set_visual_mode("resourceplayingmode",e)}),e.controlbar.resourcestopbutton.click(function(){c.do_stop_resource(e),c.recorded?c.set_visual_mode("allstoppedmode",e):c.set_visual_mode("neverrecordedmode",e)}),e.controlbar.savebutton.click(function(){return c.disable_button(this),e.blobs&&e.blobs.length>0?(d.do_save_audio(e),c.uploaded=!0,c.disable_button(e.controlbar.startbutton)):e.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll")),!1}),window.onbeforeunload=function(){c.enable_button(e.controlbar.startbutton);var a=e.controlbar.checkplayer;a&&a.get(0)&&a.get(0).pause()}},set_completion:function(a,b){return},do_stop_resource:function(a){console.log("stopped the resource");var b=a.controlbar.resourceplayer.get(0);if(b.pause(),b.currentTime=0,a.mustResetResourcePlayer){a.mustResetResourcePlayer=!1,b.src=a.config.resource;b.load()}},do_play_resource:function(a){var b=a.controlbar.resourceplayer.get(0);b.play(),b.currentTime=0},enable_button:function(b){a(b).attr("disabled",!1),a(b).removeClass("pmr_disabled")},disable_button:function(b){a(b).attr("disabled",!0),a(b).addClass("pmr_disabled")}}}); \ No newline at end of file +define ("filter_poodll/poodll_shadowmediaskin",["jquery","core/log","filter_poodll/utils_amd"],function(a,b){"use strict";b.debug("PoodLL Shadow Skin: initialising");return{instanceprops:null,pmr:null,uploaded:!1,recorded:!1,mustResetResourcePlayer:!1,clone:function clone(){return a.extend(!0,{},this)},init:function init(a,b){this.instanceprops=a;this.pmr=b},fetch_instanceprops:function fetch_instanceprops(){return this.instanceprops},onUploadSuccess:function onUploadSuccess(b){a("#"+b+" > .poodll_save-recording").hide();a("#"+b+" > .poodll_savedsuccessfully").show()},onUploadFailure:function onUploadFailure(){},fetch_status_bar:function fetch_status_bar(a){return"
"},fetch_preview_audio:function fetch_preview_audio(a){return""},fetch_preview_video:function fetch_preview_video(a){return""},fetch_resource_audio:function fetch_resource_audio(a){return""},fetch_resource_video:function fetch_resource_video(a){return""},fetch_uploader_skin:function fetch_uploader_skin(){return!1},onMediaError:function onMediaError(a){console.error("media error",a)},onMediaSuccess_video:function onMediaSuccess_video(a){var b=this.fetch_instanceprops(a);this.recorded=!0;this.do_play_resource(b);b.controlbar.resourceplayer.bind("ended",function(){b.controlbar.stopbutton.click()});self.set_visual_mode("recordingmode",b)},onMediaSuccess_audio:function onMediaSuccess_audio(a){var b=this.fetch_instanceprops(a);b.controlbar.checkplayer.attr("src",null);this.recorded=!0;this.do_play_resource(b);b.controlbar.resourceplayer.bind("ended",function(){b.controlbar.stopbutton.click()});self.set_visual_mode("recordingmode",b)},handle_timer_update:function handle_timer_update(a){var b=this.fetch_instanceprops(a);this.update_status(a);if(0==b.timer.seconds&&0";l+="
";l+="
";var m=this.fetch_status_bar("shadow");l+=m,l+=d,l+=e,l+="";l+="";l+="";l+="";l+=" ";l+=" ";l+="
";l+="
";a(b).prepend(l);var n={marker:a("#"+c+" .marker"),status:a("#"+c+" .poodll_status_shadow"),resourceplayer:a("#"+c+" .poodll_resourceplayer_shadow"),checkplayer:a("#"+c+" .poodll_checkplayer_shadow"),resourceplaybutton:a("#"+c+" .poodll_play-resource_shadow"),resourcestopbutton:a("#"+c+" .poodll_stop-resource_shadow"),startbutton:a("#"+c+" .poodll_start-recording_shadow"),stopbutton:a("#"+c+" .poodll_stop-recording_shadow"),playbackbutton:a("#"+c+" .poodll_playback-recording_shadow"),stopplaybackbutton:a("#"+c+" .poodll_stopplayback-recording_shadow"),savebutton:a("#"+c+" .poodll_save-recording_shadow")};return n},register_controlbar_events_video:function register_controlbar_events_video(a,b){return this.register_controlbar_events_audio(a,b)},register_controlbar_events_audio:function register_controlbar_events_audio(a,b){var c=this,d=this.pmr,e=this.fetch_instanceprops(b);e.controlbar.startbutton.click(function(){d.do_start_audio(e,a)});e.controlbar.stopbutton.click(function(){d.do_stop_audio(e);c.disable_button(this);var a=e.controlbar.resourceplayer;if(a&&a.get(0)){a.get(0).pause()}c.set_visual_mode("allstoppedmode",e);c.do_stop_resource(e)});e.controlbar.playbackbutton.click(function(){c.disable_button(this);e.controlbar.marker.show();var a=e.controlbar.resourceplayer.get(0);d.do_play_audio(e,a);e.mustResetResourcePlayer=!0;e.controlbar.resourceplayer.bind("ended",function(){c.set_visual_mode("allstoppedmode",e)});c.set_visual_mode("playingbackmode",e);c.set_completion(!0,e)});e.controlbar.stopplaybackbutton.click(function(){c.do_stop_resource(e);c.set_visual_mode("allstoppedmode",e)});e.controlbar.resourceplaybutton.click(function(){c.do_play_resource(e);e.controlbar.resourceplayer.bind("ended",function(){if(c.recorded){c.set_visual_mode("allstoppedmode",e)}else{c.set_visual_mode("neverrecordedmode",e)}});c.set_visual_mode("resourceplayingmode",e)});e.controlbar.resourcestopbutton.click(function(){c.do_stop_resource(e);if(c.recorded){c.set_visual_mode("allstoppedmode",e)}else{c.set_visual_mode("neverrecordedmode",e)}});e.controlbar.savebutton.click(function(){c.disable_button(this);if(e.blobs&&0';g+='
',g+='",g+='",g+='",a(b).prepend(g)},register_events:function(b){var c=this.fetch_instance_props(b);c.config;e.set("swfURL",M.cfg.wwwroot+"/filter/poodll/3rdparty/webcam/webcam.swf"),e.attach("#"+c.htmlthings.camera),a("#"+c.htmlthings.savebutton).on("click",function(a){if(c.imagefile){var b="image/jpeg",d=c.uploader.dataURItoBlob(c.imagefile,b);c.uploader.uploadFile(d,b)}else c.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll"))}),a("#"+c.htmlthings.cancelbutton).on("click",function(b){c.imagefile=!1,a("#"+c.htmlthings.preview).addClass("hide").html(""),a("#"+c.htmlthings.camera).removeClass("hide")}),a("#"+c.htmlthings.snapbutton).on("click",function(b){e.snap(function(b){c.imagefile=b,a("#"+c.htmlthings.preview).html('').removeClass("hide"),a("#"+c.htmlthings.camera).addClass("hide")})})}}}); \ No newline at end of file +define ("filter_poodll/poodll_snapshotrecorder",["jquery","core/log","filter_poodll/utils_amd","filter_poodll/uploader","filter_poodll/webcam"],function(a,b,c,d,e){"use strict";b.debug("PoodLL Snapshot Recorder: initialising");return{instanceprops:[],fetch_instance_props:function fetch_instance_props(a){return this.instanceprops[a]},init_instance_props:function init_instance_props(a){this.instanceprops[a]={imagefile:!1,htmlthings:"",config:null,uploader:null}},supports_current_browser:function supports_current_browser(a){var d=c.is_ios();if(d){return!1}else{if("snapshot"!=a.mediatype){return!1}b.debug("PoodLL Snapshot Recorder: supports this browser");return!0}},embed:function embed(a,b){this.init_instance_props(b.widgetid);var c=this.fetch_instance_props(b.widgetid);c.config=b;c.uploader=d.clone();c.uploader.init(a,b);this.insert_controls(a,b.widgetid);this.register_events(b.widgetid)},insert_controls:function insert_controls(b,c){var d=this.fetch_instance_props(c),e=d.config,f={camera:e.widgetid+"_poodll_snapshot_camera",preview:e.widgetid+"_poodll_snapshot_preview",snapbutton:e.widgetid+"_poodll_take-snapshot",savebutton:e.widgetid+"_poodll_save-snapshot",cancelbutton:e.widgetid+"_poodll_cancel-snapshot"};d.htmlthings=f;var g="
";g+="
";g+="";g+="";g+="";a(b).prepend(g)},register_events:function register_events(b){var c=this.fetch_instance_props(b),d=c.config;e.set("swfURL",M.cfg.wwwroot+"/filter/poodll/3rdparty/webcam/webcam.swf");e.attach("#"+c.htmlthings.camera);a("#"+c.htmlthings.savebutton).on("click",function(){if(c.imagefile){var a=c.uploader.dataURItoBlob(c.imagefile,"image/jpeg");c.uploader.uploadFile(a,"image/jpeg")}else{c.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll"))}});a("#"+c.htmlthings.cancelbutton).on("click",function(){c.imagefile=!1;a("#"+c.htmlthings.preview).addClass("hide").html("");a("#"+c.htmlthings.camera).removeClass("hide")});a("#"+c.htmlthings.snapbutton).on("click",function(){e.snap(function(b){c.imagefile=b;a("#"+c.htmlthings.preview).html("").removeClass("hide");a("#"+c.htmlthings.camera).addClass("hide")})})}}}); +//# sourceMappingURL=poodll_snapshotrecorder.min.js.map diff --git a/amd/build/poodll_splitmediaskin.min.js b/amd/build/poodll_splitmediaskin.min.js index a6c5b304..42ad2227 100644 --- a/amd/build/poodll_splitmediaskin.min.js +++ b/amd/build/poodll_splitmediaskin.min.js @@ -1 +1,2 @@ -define(["jquery","core/log","filter_poodll/utils_amd","filter_poodll/upskin_bar"],function(a,b,c,d){"use strict";return b.debug("PoodLL split Skin: initialising"),{instanceprops:null,pmr:null,uploaded:!1,recorded:!1,played:!1,mustResetResourcePlayer:!1,clone:function(){return a.extend(!0,{},this)},init:function(a,b){this.instanceprops=a,this.pmr=b},fetch_instanceprops:function(){return this.instanceprops},onUploadSuccess:function(b){a("#"+b+" > .poodll_save-recording").hide(),a("#"+b+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(a){},fetch_status_bar:function(a){var b='
';return b},fetch_preview_audio:function(a){var b='';return b},fetch_preview_video:function(a){var b='';return b},fetch_resource_audio:function(a){var b='';return b},fetch_resource_video:function(a){var b='';return b},fetch_uploader_skin:function(a,b){var c=this.fetch_instanceprops(a),e=d.clone();return e.init(c.config,b,c.controlbar.split_progresscanvas,c.controlbar.status),e},onMediaError:function(a){console.error("media error",a)},onMediaSuccess_video:function(a){var b=this.fetch_instanceprops(a);b.controlbar.stopbutton.attr("disabled",!1),b.controlbar.savebutton.attr("disabled",!1)},onMediaSuccess_audio:function(a){var b=this.fetch_instanceprops(a);b.controlbar.checkplayer.attr("src",null),b.controlbar.stopbutton.attr("disabled",!1),b.controlbar.savebutton.attr("disabled",!1)},handle_timer_update:function(a){if(this.played||this.recorded){var b=this.fetch_instanceprops(a),c=M.util.get_string("recui_recording","filter_poodll");this.update_status(a,c+b.timer.fetch_display_time()),0==b.timer.seconds&&b.timer.initseconds>0&&b.controlbar.stopbutton.click()}},update_status:function(a,b){var c=this.fetch_instanceprops(a);c.controlbar.status.html(b)},set_visual_mode:function(a,b){var c=this;switch(a){case"recordingmode":c.disable_button(b.controlbar.resourceplaybutton),b.controlbar.resourceplaybutton.empty(),b.controlbar.resourceplaybutton.html(''),b.controlbar.resourceplaybutton.addClass("poodll_mediarecorderholder_split_recordcolor"),b.controlbar.status.addClass("poodll_mediarecorderholder_split_recordcolor"),c.handle_timer_update(b.controlbarid),c.enable_button(b.controlbar.stopbutton);break;case"resourceplayingmode":c.disable_button(b.controlbar.resourceplaybutton),c.disable_button(b.controlbar.stopbutton);break;case"neverrecordedmode":b.controlbar.resourceplaybutton.empty(),b.controlbar.resourceplaybutton.html('

Start

'),c.enable_button(b.controlbar.resourceplaybutton),c.disable_button(b.controlbar.stopbutton),this.update_status(b.controlbarid,M.util.get_string("recui_ready","filter_poodll"));break;case"allstoppedmode":c.disable_button(b.controlbar.resourceplaybutton),c.disable_button(b.controlbar.stopbutton),b.controlbar.resourceplaybutton.empty(),b.controlbar.resourceplaybutton.html(''),b.controlbar.resourceplaybutton.removeClass("poodll_mediarecorderholder_split_recordcolor"),b.controlbar.status.removeClass("poodll_mediarecorderholder_split_recordcolor"),this.update_status(b.controlbarid,M.util.get_string("recui_finished","filter_poodll"))}},insert_controlbar_video:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"video");return e},insert_controlbar_audio:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"audio");return e},prepare_controlbar:function(b,c,d,e,f){var g=this.fetch_instanceprops(c),h=g.config.media_skin_style,i="video"==f?"poodll_mediarecorder_video":"poodll_mediarecorder_audio";e=e.replace("@@RESOURCEURL@@",g.config.resource);var j=this.pmr.fetch_strings(),k='
';k+='
',k+='
',k+=d,k+=e,k+='',k+=' ',k+=' ',k+='
",k+='
',k+='
',k+='';var l=this.fetch_status_bar("split");k+=l,k+="
",k+="
",a(b).append(k);var m='',n='
'+m+"
",o="
";a(".qtext").prepend(o),a(".qtext").prepend(n);var p={split_progresscanvas:a("#"+c+" .split_range"),marker:a("#"+c+" .marker"),resourceplayer:a("#"+c+" .poodll_resourceplayer_split"),checkplayer:a("#"+c+" .poodll_checkplayer_split"),stopbutton:a("#"+c+" .poodll_stop-recording_split"),resourcestopbutton:a("#"+c+" .poodll_stop-resource_split"),startbutton:a("#"+c+" .poodll_start-recording_split"),playbackbutton:a("#"+c+" .poodll_playback-recording_split"),stopplaybackbutton:a("#"+c+" .poodll_stopplayback-recording_split"),savebutton:a("#"+c+" .poodll_save-recording_split"),resourceplaybutton:a(".poodll_mediarecorder_button_split.poodll_play-resource_split"),status:a(".poodll_status_split")};return p},register_controlbar_events_video:function(a,b){return this.register_controlbar_events_audio(a,b)},do_callback:function(b){switch(b[1]){case"filesubmitted":var c=document.getElementById(b[3]);null==c&&(c=parent.document.getElementById(b[3])),c&&(c.value=b[2]),a("#responseform input[name=next]").attr("disabled",!1)}},register_controlbar_events_audio:function(b,c){var d=this,e=this.pmr,f=this.fetch_instanceprops(c);this.set_visual_mode("neverrecordedmode",f),f.config.callbackjs=d.do_callback,a("#responseform input[name=next]").attr("disabled",!0),f.controlbar.startbutton.click(function(){e.do_start_audio(f,b),d.recorded=!0,f.timer.reset(),f.timer.start(),d.set_visual_mode("recordingmode",f)}),f.controlbar.stopbutton.click(function(){d.do_stop_resource(f),e.do_stop_audio(f),d.disable_button(this),setTimeout(function(){f.controlbar.savebutton.click()},100),f.timer.stop(),d.set_visual_mode("allstoppedmode",f)}),f.controlbar.resourceplaybutton.click(function(){navigator.mediaDevices.getUserMedia({audio:!0}).then(function(a){f.controlbar.startbutton.trigger("click"),d.played=!0,""!=f.config.resource&&d.do_play_resource(f)})["catch"](function(a){alert(a)})}),f.controlbar.resourcestopbutton.click(function(){d.do_stop_resource(f),d.recorded?d.set_visual_mode("allstoppedmode",f):d.set_visual_mode("neverrecordedmode",f)}),f.controlbar.savebutton.click(function(){return d.disable_button(this),f.blobs&&f.blobs.length>0?(e.do_save_audio(f),d.uploaded=!0,d.disable_button(f.controlbar.startbutton)):f.uploader.Output(M.util.get_string("recui_nothingtosaveerror","filter_poodll")),!1})},set_completion:function(a,b){return},do_stop_resource:function(a){console.log("stopped the resource");var b=a.controlbar.resourceplayer.get(0);if(b.pause(),b.currentTime=0,a.mustResetResourcePlayer){a.mustResetResourcePlayer=!1,b.src=a.config.resource;b.load()}},do_play_resource:function(a){var b=a.controlbar.resourceplayer.get(0);b.play(),b.currentTime=0},enable_button:function(b){a(b).attr("disabled",!1),a(b).removeClass("pmr_disabled")},disable_button:function(b){a(b).attr("disabled",!0),a(b).addClass("pmr_disabled")}}}); \ No newline at end of file +define ("filter_poodll/poodll_splitmediaskin",["jquery","core/log","filter_poodll/utils_amd","filter_poodll/upskin_bar"],function(a,b,c,d){"use strict";b.debug("PoodLL split Skin: initialising");return{instanceprops:null,pmr:null,uploaded:!1,recorded:!1,played:!1,mustResetResourcePlayer:!1,clone:function clone(){return a.extend(!0,{},this)},init:function init(a,b){this.instanceprops=a;this.pmr=b},fetch_instanceprops:function fetch_instanceprops(){return this.instanceprops},onUploadSuccess:function onUploadSuccess(b){a("#"+b+" > .poodll_save-recording").hide();a("#"+b+" > .poodll_savedsuccessfully").show()},onUploadFailure:function onUploadFailure(){},fetch_status_bar:function fetch_status_bar(a){return"
"},fetch_preview_audio:function fetch_preview_audio(a){return""},fetch_preview_video:function fetch_preview_video(a){return""},fetch_resource_audio:function fetch_resource_audio(a){return""},fetch_resource_video:function fetch_resource_video(a){return""},fetch_uploader_skin:function fetch_uploader_skin(a,b){var c=this.fetch_instanceprops(a),e=d.clone();e.init(c.config,b,c.controlbar.split_progresscanvas,c.controlbar.status);return e},onMediaError:function onMediaError(a){console.error("media error",a)},onMediaSuccess_video:function onMediaSuccess_video(a){var b=this.fetch_instanceprops(a);b.controlbar.stopbutton.attr("disabled",!1);b.controlbar.savebutton.attr("disabled",!1)},onMediaSuccess_audio:function onMediaSuccess_audio(a){var b=this.fetch_instanceprops(a);b.controlbar.checkplayer.attr("src",null);b.controlbar.stopbutton.attr("disabled",!1);b.controlbar.savebutton.attr("disabled",!1)},handle_timer_update:function handle_timer_update(a){if(!this.played&&!this.recorded){return}var b=this.fetch_instanceprops(a),c=M.util.get_string("recui_recording","filter_poodll");this.update_status(a,c+b.timer.fetch_display_time());if(0==b.timer.seconds&&0");b.controlbar.resourceplaybutton.addClass("poodll_mediarecorderholder_split_recordcolor");b.controlbar.status.addClass("poodll_mediarecorderholder_split_recordcolor");c.handle_timer_update(b.controlbarid);c.enable_button(b.controlbar.stopbutton);break;case"resourceplayingmode":c.disable_button(b.controlbar.resourceplaybutton);c.disable_button(b.controlbar.stopbutton);break;case"neverrecordedmode":b.controlbar.resourceplaybutton.empty();b.controlbar.resourceplaybutton.html("

Start

");c.enable_button(b.controlbar.resourceplaybutton);c.disable_button(b.controlbar.stopbutton);this.update_status(b.controlbarid,M.util.get_string("recui_ready","filter_poodll"));break;case"allstoppedmode":c.disable_button(b.controlbar.resourceplaybutton);c.disable_button(b.controlbar.stopbutton);b.controlbar.resourceplaybutton.empty();b.controlbar.resourceplaybutton.html("");b.controlbar.resourceplaybutton.removeClass("poodll_mediarecorderholder_split_recordcolor");b.controlbar.status.removeClass("poodll_mediarecorderholder_split_recordcolor");this.update_status(b.controlbarid,M.util.get_string("recui_finished","filter_poodll"));break;}},insert_controlbar_video:function insert_controlbar_video(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"video");return e},insert_controlbar_audio:function insert_controlbar_audio(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"audio");return e},prepare_controlbar:function prepare_controlbar(b,c,d,e,f){var g=this.fetch_instanceprops(c),h=g.config.media_skin_style,i="video"==f?"poodll_mediarecorder_video":"poodll_mediarecorder_audio";e=e.replace("@@RESOURCEURL@@",g.config.resource);var j=this.pmr.fetch_strings(),k="
";k+="
";k+="
";k+=d,k+=e,k+="";k+=" ";k+=" ";k+="
";k+="
";k+="
";k+="";var l=this.fetch_status_bar("split");k+=l;k+="
";k+="
";a(b).append(k);a(".qtext").prepend("
");a(".qtext").prepend("
");var m={split_progresscanvas:a("#"+c+" .split_range"),marker:a("#"+c+" .marker"),resourceplayer:a("#"+c+" .poodll_resourceplayer_split"),checkplayer:a("#"+c+" .poodll_checkplayer_split"),stopbutton:a("#"+c+" .poodll_stop-recording_split"),resourcestopbutton:a("#"+c+" .poodll_stop-resource_split"),startbutton:a("#"+c+" .poodll_start-recording_split"),playbackbutton:a("#"+c+" .poodll_playback-recording_split"),stopplaybackbutton:a("#"+c+" .poodll_stopplayback-recording_split"),savebutton:a("#"+c+" .poodll_save-recording_split"),resourceplaybutton:a(".poodll_mediarecorder_button_split.poodll_play-resource_split"),status:a(".poodll_status_split")};return m},register_controlbar_events_video:function register_controlbar_events_video(a,b){return this.register_controlbar_events_audio(a,b)},do_callback:function do_callback(b){switch(b[1]){case"filesubmitted":var c=document.getElementById(b[3]);if(null==c){c=parent.document.getElementById(b[3])}if(c){c.value=b[2]}a("#responseform input[name=next]").attr("disabled",!1);}},register_controlbar_events_audio:function register_controlbar_events_audio(b,c){var d=this,e=this.pmr,f=this.fetch_instanceprops(c);this.set_visual_mode("neverrecordedmode",f);f.config.callbackjs=d.do_callback;a("#responseform input[name=next]").attr("disabled",!0);f.controlbar.startbutton.click(function(){e.do_start_audio(f,b);d.recorded=!0;f.timer.reset();f.timer.start();d.set_visual_mode("recordingmode",f)});f.controlbar.stopbutton.click(function(){d.do_stop_resource(f);e.do_stop_audio(f);d.disable_button(this);setTimeout(function(){f.controlbar.savebutton.click()},100);f.timer.stop();d.set_visual_mode("allstoppedmode",f)});f.controlbar.resourceplaybutton.click(function(){navigator.mediaDevices.getUserMedia({audio:!0}).then(function(){f.controlbar.startbutton.trigger("click");d.played=!0;if(""!=f.config.resource){d.do_play_resource(f)}}).catch(function(a){alert(a)})});f.controlbar.resourcestopbutton.click(function(){d.do_stop_resource(f);if(d.recorded){d.set_visual_mode("allstoppedmode",f)}else{d.set_visual_mode("neverrecordedmode",f)}});f.controlbar.savebutton.click(function(){d.disable_button(this);if(f.blobs&&0 .poodll_save-recording").hide(),a("#"+b+" > .poodll_savedsuccessfully").show()},onUploadFailure:function(a){},onMediaSuccess_video:function(a){},onMediaSuccess_audio:function(a){},insert_controlbar_video:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"video");return e},insert_controlbar_audio:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"audio");return e},register_controlbar_events_video:function(a,b){return this.register_events(b)},register_controlbar_events_audio:function(a,b){return this.register_events(b)},fetch_instance_props:function(){return this.instanceprops},prepare_controlbar:function(b,c,e,f,g){var h=this.fetch_instance_props(),i="";switch(g){case"video":i="video/webm,video/ogg,video/mp4,video/x-m4v,video/*";break;case"snapshot":case"image":i="image/*";case"audio":var j=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream;i=j?"video/*":"audio/*";default:i=""}if(d.is_ios()||d.is_android())var k=M.util.get_string("recui_recordorchoose","filter_poodll");else var k=M.util.get_string("recui_choosefile","filter_poodll");var l=h.config.media_skin_style,m="video"==g?"poodll_mediarecorder_video":"poodll_mediarecorder_audio",n='
';if(n+='
',n+=h.errordialog.fetch_dialogue_box(),n+='
',"audio"==g)var o=250,p=50;else var o=130,p=210;n+='
',n+='
',n+='',n+='",n+="
",n+='
',n+="
",a(b).prepend(n);var q={errorsdialog:a("#"+c+" .poodll_dialogue_box_errors"),filebutton:a("#"+c+"_poodllfileselect"),startbutton:a("#"+c+"_p_btn"),uploadcanvas:a("#"+c+"_uploadcanvas"),uploadmessages:a("#"+c+" .poodll_uploadmessages_once")};return h.errordialog.set_dialogue_box(q.errorsdialog),q},register_events:function(a){var b=this,c=(this.pmr,this.fetch_instance_props());c.config.hermes.enable(),c.controlbar.filebutton.on("change",function(a){var d=a.target.files||a.dataTransfer.files;b.FileSelectHandler(d,c.uploader),f.turnoff_dragdrop(),c.controlbar.filebutton.off("change"),c.controlbar.filebutton.attr("disabled",!0)}),f.init(c.controlbar.uploadcanvas,this.FileSelectHandler,c)},FileSelectHandler:function(a,b){for(var c,d=0;c=a[d];d++)b.uploadBlob(c,c.type)}}}); \ No newline at end of file +define ("filter_poodll/poodll_uploadmediaskin",["jquery","jqueryui","core/log","filter_poodll/utils_amd","filter_poodll/upskin_radial","filter_poodll/util_dragdrop"],function(a,b,c,d,e,f){"use strict";c.debug("PoodLL Upload Media skin: initialising");return{instanceprops:null,pmr:null,clone:function clone(){return a.extend(!0,{},this)},init:function init(a,b){this.instanceprops=a;this.pmr=b},fetch_status_bar:function fetch_status_bar(){return""},fetch_preview_audio:function fetch_preview_audio(){return""},fetch_preview_video:function fetch_preview_video(){return""},fetch_resource_audio:function fetch_resource_audio(){return""},fetch_resource_video:function fetch_resource_video(){return""},fetch_uploader_skin:function fetch_uploader_skin(a,b){var c=this.fetch_instance_props(),d=e.clone();d.init(c.config,b,c.controlbar.uploadcanvas,c.controlbar.uploadmessages);d.setDrawParam("lineWidth",2);d.setDrawParam("font","14px Arial");return d},handle_timer_update:function handle_timer_update(){},onUploadSuccess:function onUploadSuccess(b){a("#"+b+" > .poodll_save-recording").hide();a("#"+b+" > .poodll_savedsuccessfully").show()},onUploadFailure:function onUploadFailure(){},onMediaSuccess_video:function onMediaSuccess_video(){},onMediaSuccess_audio:function onMediaSuccess_audio(){},insert_controlbar_video:function insert_controlbar_video(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"video");return e},insert_controlbar_audio:function insert_controlbar_audio(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"audio");return e},register_controlbar_events_video:function register_controlbar_events_video(a,b){return this.register_events(b)},register_controlbar_events_audio:function register_controlbar_events_audio(a,b){return this.register_events(b)},fetch_instance_props:function fetch_instance_props(){return this.instanceprops},prepare_controlbar:function prepare_controlbar(b,c,e,f,g){var h=this.fetch_instance_props(),i="";switch(g){case"video":i="video/webm,video/ogg,video/mp4,video/x-m4v,video/*";break;case"snapshot":case"image":i="image/*";case"audio":var j=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream;if(j){i="video/*"}else{i="audio/*"}default:i="";}if(d.is_ios()||d.is_android()){var k=M.util.get_string("recui_recordorchoose","filter_poodll")}else{var k=M.util.get_string("recui_choosefile","filter_poodll")}var l=h.config.media_skin_style,m="video"==g?"poodll_mediarecorder_video":"poodll_mediarecorder_audio",n="
";n+="
";n+=h.errordialog.fetch_dialogue_box();n+="
";if("audio"==g){var o=250,p=50}else{var o=130,p=210}n+="
";n+="
";n+="";n+="";n+="
";n+="
";n+="
";a(b).prepend(n);var q={errorsdialog:a("#"+c+" .poodll_dialogue_box_errors"),filebutton:a("#"+c+"_poodllfileselect"),startbutton:a("#"+c+"_p_btn"),uploadcanvas:a("#"+c+"_uploadcanvas"),uploadmessages:a("#"+c+" .poodll_uploadmessages_once")};h.errordialog.set_dialogue_box(q.errorsdialog);return q},register_events:function register_events(){var a=this,b=this.pmr,c=this.fetch_instance_props();c.config.hermes.enable();c.controlbar.filebutton.on("change",function(b){var d=b.target.files||b.dataTransfer.files;a.FileSelectHandler(d,c.uploader);f.turnoff_dragdrop();c.controlbar.filebutton.off("change");c.controlbar.filebutton.attr("disabled",!0)});f.init(c.controlbar.uploadcanvas,this.FileSelectHandler,c)},FileSelectHandler:function FileSelectHandler(a,b){for(var c=0,d;d=a[c];c++){b.uploadBlob(d,d.type)}}}}); +//# sourceMappingURL=poodll_uploadmediaskin.min.js.map diff --git a/amd/build/poodll_uploadrecorder.min.js b/amd/build/poodll_uploadrecorder.min.js index 02dbb4c7..504821c9 100644 --- a/amd/build/poodll_uploadrecorder.min.js +++ b/amd/build/poodll_uploadrecorder.min.js @@ -1 +1,2 @@ -define(["jquery","core/log","filter_poodll/uploader"],function(a,b,c){"use strict";return b.debug("PoodLL Upload Recorder: initialising"),{config:null,instanceprops:[],fetch_instance_props:function(a){return this.instanceprops[a]},init_instance_props:function(a){var b={};b.config=null,b.uploader=null,this.instanceprops[a]=b},supports_current_browser:function(a){return!0},embed:function(a,b){this.init_instance_props(b.widgetid);var d=this.fetch_instance_props(b.widgetid);d.config=b,d.uploader=c.clone(),d.uploader.init(a,b),this.insert_controls(a,b.widgetid),this.register_events(b.widgetid)},insert_controls:function(b,c){var d=this.fetch_instance_props(c),e="",f=d.config;switch(f.mediatype){case"video":e="video/*";break;case"snapshot":case"image":e="image/*";case"audio":var g=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream;e=g?"video/*":"audio/*";default:e=""}var h='
';h+='',h+='",h+="
",a(b).prepend(h)},register_events:function(b){var c=this;a("#"+b+"_poodllfileselect").on("change",function(a){c.FileSelectHandler(a,b)})},FileSelectHandler:function(a,b){for(var c,d=this.fetch_instance_props(b),e=a.target.files||a.dataTransfer.files,f=0;c=e[f];f++)d.uploader.uploadBlob(c,c.type)},ParseFile:function(a,b){var c=this.fetch_instance_props(b),d="",e=new FileReader;e.onloadend=function(b){d=b.target.result,c.uploader.uploadFile(d,a.type)},e.readAsDataURL(a)}}}); \ No newline at end of file +define ("filter_poodll/poodll_uploadrecorder",["jquery","core/log","filter_poodll/uploader"],function(a,b,c){"use strict";b.debug("PoodLL Upload Recorder: initialising");return{config:null,instanceprops:[],fetch_instance_props:function fetch_instance_props(a){return this.instanceprops[a]},init_instance_props:function init_instance_props(a){this.instanceprops[a]={config:null,uploader:null}},supports_current_browser:function supports_current_browser(){return!0},embed:function embed(a,b){this.init_instance_props(b.widgetid);var d=this.fetch_instance_props(b.widgetid);d.config=b;d.uploader=c.clone();d.uploader.init(a,b);this.insert_controls(a,b.widgetid);this.register_events(b.widgetid)},insert_controls:function insert_controls(b,c){var d=this.fetch_instance_props(c),e="",f=d.config;switch(f.mediatype){case"video":e="video/*";break;case"snapshot":case"image":e="image/*";case"audio":var g=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream;if(g){e="video/*"}else{e="audio/*"}default:e="";}var h="
";h+="";h+="";h+="
";a(b).prepend(h)},register_events:function register_events(b){var c=this;a("#"+b+"_poodllfileselect").on("change",function(a){c.FileSelectHandler(a,b)})},FileSelectHandler:function FileSelectHandler(a,b){for(var c=this.fetch_instance_props(b),d=a.target.files||a.dataTransfer.files,e=0,f;f=d[e];e++){c.uploader.uploadBlob(f,f.type)}},ParseFile:function ParseFile(a,b){var c=this.fetch_instance_props(b),d="",e=new FileReader;e.onloadend=function(b){d=b.target.result;c.uploader.uploadFile(d,a.type)};e.readAsDataURL(a)}}}); +//# sourceMappingURL=poodll_uploadrecorder.min.js.map diff --git a/amd/build/poodll_warningmediaskin.min.js b/amd/build/poodll_warningmediaskin.min.js index e04839f9..36f3aa6e 100644 --- a/amd/build/poodll_warningmediaskin.min.js +++ b/amd/build/poodll_warningmediaskin.min.js @@ -1 +1,2 @@ -define(["jquery","jqueryui","core/log","filter_poodll/utils_amd"],function(a,b,c,d){"use strict";return c.debug("PoodLL Warning Media skin: initialising"),{instanceprops:null,pmr:null,clone:function(){return a.extend(!0,{},this)},init:function(a,b){this.instanceprops=a,this.pmr=b},fetch_status_bar:function(a){var b="";return b},fetch_preview_audio:function(a){var b="";return b},fetch_preview_video:function(a){var b="";return b},fetch_resource_audio:function(a){var b="";return b},fetch_resource_video:function(a){var b="";return b},fetch_uploader_skin:function(a,b){return!1},handle_timer_update:function(a){},onUploadSuccess:function(a){},onUploadFailure:function(a){},onMediaSuccess_video:function(a){},onMediaSuccess_audio:function(a){},insert_controlbar_video:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"video");return e},insert_controlbar_audio:function(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"audio");return e},register_controlbar_events_video:function(a,b){return this.register_events(b)},register_controlbar_events_audio:function(a,b){return this.register_events(b)},fetch_instance_props:function(){return this.instanceprops},prepare_controlbar:function(b,c,d,e,f){var g=this.fetch_instance_props();switch(f){case"audio":case"video":default:var h=M.util.get_string("recui_unsupportedbrowser","filter_poodll")}var i=g.config.media_skin_style,j="video"==f?"poodll_mediarecorder_video":"poodll_mediarecorder_audio",k='
';k+='
',k+='
',k+='
'+h+"
",k+="
",a(b).prepend(k);var l={};return l},register_events:function(a){}}}); \ No newline at end of file +define ("filter_poodll/poodll_warningmediaskin",["jquery","jqueryui","core/log","filter_poodll/utils_amd"],function(a,b,c){"use strict";c.debug("PoodLL Warning Media skin: initialising");return{instanceprops:null,pmr:null,clone:function clone(){return a.extend(!0,{},this)},init:function init(a,b){this.instanceprops=a;this.pmr=b},fetch_status_bar:function fetch_status_bar(){return""},fetch_preview_audio:function fetch_preview_audio(){return""},fetch_preview_video:function fetch_preview_video(){return""},fetch_resource_audio:function fetch_resource_audio(){return""},fetch_resource_video:function fetch_resource_video(){return""},fetch_uploader_skin:function fetch_uploader_skin(){return!1},handle_timer_update:function handle_timer_update(){},onUploadSuccess:function onUploadSuccess(){},onUploadFailure:function onUploadFailure(){},onMediaSuccess_video:function onMediaSuccess_video(){},onMediaSuccess_audio:function onMediaSuccess_audio(){},insert_controlbar_video:function insert_controlbar_video(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"video");return e},insert_controlbar_audio:function insert_controlbar_audio(a,b,c,d){var e=this.prepare_controlbar(a,b,c,d,"audio");return e},register_controlbar_events_video:function register_controlbar_events_video(a,b){return this.register_events(b)},register_controlbar_events_audio:function register_controlbar_events_audio(a,b){return this.register_events(b)},fetch_instance_props:function fetch_instance_props(){return this.instanceprops},prepare_controlbar:function prepare_controlbar(b,c,d,e,f){var g=this.fetch_instance_props();switch(f){case"audio":case"video":default:var h=M.util.get_string("recui_unsupportedbrowser","filter_poodll");}var i=g.config.media_skin_style,j="video"==f?"poodll_mediarecorder_video":"poodll_mediarecorder_audio",k="
";k+="
";k+="
";k+="
"+h+"
";k+="
";a(b).prepend(k);return{}},register_events:function register_events(){}}}); +//# sourceMappingURL=poodll_warningmediaskin.min.js.map diff --git a/amd/build/poodllrecorder.min.js b/amd/build/poodllrecorder.min.js index 3b2ad82a..ee7ecbc0 100644 --- a/amd/build/poodllrecorder.min.js +++ b/amd/build/poodllrecorder.min.js @@ -1 +1,2 @@ -define(["jquery","core/log","filter_poodll/poodll_flashrecorder","filter_poodll/poodll_mediarecorder","filter_poodll/poodll_uploadrecorder","filter_poodll/poodll_mobilerecorder","filter_poodll/poodll_flashsnapshotrecorder","filter_poodll/poodll_snapshotrecorder","filter_poodll/poodll_red5recorder"],function(a,b,c,d,e,f,g,h,i){"use strict";return b.debug("PoodLL Recorder: initialising"),{init:function(j){var k="#amdopts_"+j.widgetid,l=a(k).get(0);if(!l)return void b.debug("PoodLL Recorder: No config found on page. Giving up.");this.config=JSON.parse(l.value),a(k).remove(),this.config.wwwroot=M.cfg.wwwroot,this.config.sesskey=M.cfg.sesskey;var m=this.config.selector;if(!m)return void b.debug("unable to fetch element with selector:"+this.config.selector);for(var n=!1,o=0;o8&&11>=x),A=32,B=String.fromCharCode(A),C=n.topLevelTypes,D={beforeInput:{phasedRegistrationNames:{bubbled:t({onBeforeInput:null}),captured:t({onBeforeInputCapture:null})},dependencies:[C.topCompositionEnd,C.topKeyPress,C.topTextInput,C.topPaste]},compositionEnd:{phasedRegistrationNames:{bubbled:t({onCompositionEnd:null}),captured:t({onCompositionEndCapture:null})},dependencies:[C.topBlur,C.topCompositionEnd,C.topKeyDown,C.topKeyPress,C.topKeyUp,C.topMouseDown]},compositionStart:{phasedRegistrationNames:{bubbled:t({onCompositionStart:null}),captured:t({onCompositionStartCapture:null})},dependencies:[C.topBlur,C.topCompositionStart,C.topKeyDown,C.topKeyPress,C.topKeyUp,C.topMouseDown]},compositionUpdate:{phasedRegistrationNames:{bubbled:t({onCompositionUpdate:null}),captured:t({onCompositionUpdateCapture:null})},dependencies:[C.topBlur,C.topCompositionUpdate,C.topKeyDown,C.topKeyPress,C.topKeyUp,C.topMouseDown]}},E=!1,F=null,G={eventTypes:D,extractEvents:function(a,b,c,d,e){return[j(a,b,c,d,e),m(a,b,c,d,e)]}};b.exports=G},{100:100,104:104,144:144,15:15,163:163,19:19,20:20}],4:[function(a,b,c){"use strict";function d(a,b){return a+b.charAt(0).toUpperCase()+b.substring(1)}var e={animationIterationCount:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,stopOpacity:!0,strokeDashoffset:!0,strokeOpacity:!0,strokeWidth:!0},f=["Webkit","ms","Moz","O"];Object.keys(e).forEach(function(a){f.forEach(function(b){e[d(b,a)]=e[a]})});var g={background:{backgroundAttachment:!0,backgroundColor:!0,backgroundImage:!0,backgroundPositionX:!0,backgroundPositionY:!0,backgroundRepeat:!0},backgroundPosition:{backgroundPositionX:!0,backgroundPositionY:!0},border:{borderWidth:!0,borderStyle:!0,borderColor:!0},borderBottom:{borderBottomWidth:!0,borderBottomStyle:!0,borderBottomColor:!0},borderLeft:{borderLeftWidth:!0,borderLeftStyle:!0,borderLeftColor:!0},borderRight:{borderRightWidth:!0,borderRightStyle:!0,borderRightColor:!0},borderTop:{borderTopWidth:!0,borderTopStyle:!0,borderTopColor:!0},font:{fontStyle:!0,fontVariant:!0,fontWeight:!0,fontSize:!0,lineHeight:!0,fontFamily:!0},outline:{outlineWidth:!0,outlineStyle:!0,outlineColor:!0}},h={isUnitlessNumber:e,shorthandPropertyExpansions:g};b.exports=h},{}],5:[function(a,b,c){"use strict";var d=a(4),e=a(144),f=a(76),g=(a(146),a(116)),h=a(157),i=a(165),j=(a(168),i(function(a){return h(a)})),k=!1,l="cssFloat";if(e.canUseDOM){var m=document.createElement("div").style;try{m.font=""}catch(n){k=!0}void 0===document.documentElement.style.cssFloat&&(l="styleFloat")}var o={createMarkupForStyles:function(a){var b="";for(var c in a)if(a.hasOwnProperty(c)){var d=a[c];null!=d&&(b+=j(c)+":",b+=g(c,d)+";")}return b||null},setValueForStyles:function(a,b){var c=a.style;for(var e in b)if(b.hasOwnProperty(e)){var f=g(e,b[e]);if("float"===e&&(e=l),f)c[e]=f;else{var h=k&&d.shorthandPropertyExpansions[e];if(h)for(var i in h)c[i]="";else c[e]=""}}}};f.measureMethods(o,"CSSPropertyOperations",{setValueForStyles:"setValueForStyles"}),b.exports=o},{116:116,144:144,146:146,157:157,165:165,168:168,4:4,76:76}],6:[function(a,b,c){"use strict";function d(){this._callbacks=null,this._contexts=null}var e=a(25),f=a(24),g=a(158);f(d.prototype,{enqueue:function(a,b){this._callbacks=this._callbacks||[],this._contexts=this._contexts||[],this._callbacks.push(a),this._contexts.push(b)},notifyAll:function(){var a=this._callbacks,b=this._contexts;if(a){a.length!==b.length?g(!1):void 0,this._callbacks=null,this._contexts=null;for(var c=0;c8));var J=!1;v.canUseDOM&&(J=z("input")&&(!("documentMode"in document)||document.documentMode>9));var K={get:function(){return H.get.call(this)},set:function(a){G=""+a,H.set.call(this,a)}},L={eventTypes:D,extractEvents:function(a,b,c,e,f){var g,h;if(d(b)?I?g=i:h=j:A(b)?J?g=n:(g=p,h=o):q(b)&&(g=r),g){var k=g(a,b,c);if(k){var l=x.getPooled(D.change,k,e,f);return l.type="change",u.accumulateTwoPhaseDispatches(l),l}}h&&h(a,b,c)}};b.exports=L},{102:102,125:125,130:130,131:131,144:144,15:15,16:16,163:163,19:19,93:93}],8:[function(a,b,c){"use strict";var d=0,e={createReactRootIndex:function(){return d++}};b.exports=e},{}],9:[function(a,b,c){"use strict";function d(a,b,c){var d=c>=a.childNodes.length?null:a.childNodes.item(c);a.insertBefore(b,d)}var e=a(12),f=a(72),g=a(76),h=a(135),i=a(136),j=a(158),k={dangerouslyReplaceNodeWithMarkup:e.dangerouslyReplaceNodeWithMarkup,updateTextContent:i,processUpdates:function(a,b){for(var c,g=null,k=null,l=0;lb||a.hasOverloadedBooleanValue&&b===!1}var f=a(10),g=a(76),h=a(133),i=(a(168),/^[a-zA-Z_][\w\.\-]*$/),j={},k={},l={createMarkupForID:function(a){return f.ID_ATTRIBUTE_NAME+"="+h(a)},setAttributeForID:function(a,b){a.setAttribute(f.ID_ATTRIBUTE_NAME,b)},createMarkupForProperty:function(a,b){var c=f.properties.hasOwnProperty(a)?f.properties[a]:null;if(c){if(e(c,b))return"";var d=c.attributeName;return c.hasBooleanValue||c.hasOverloadedBooleanValue&&b===!0?d+'=""':d+"="+h(b)}return f.isCustomAttribute(a)?null==b?"":a+"="+h(b):null},createMarkupForCustomAttribute:function(a,b){return d(a)&&null!=b?a+"="+h(b):""},setValueForProperty:function(a,b,c){var d=f.properties.hasOwnProperty(b)?f.properties[b]:null;if(d){var g=d.mutationMethod;if(g)g(a,c);else if(e(d,c))this.deleteValueForProperty(a,b);else if(d.mustUseAttribute){var h=d.attributeName,i=d.attributeNamespace;i?a.setAttributeNS(i,h,""+c):d.hasBooleanValue||d.hasOverloadedBooleanValue&&c===!0?a.setAttribute(h,""):a.setAttribute(h,""+c)}else{var j=d.propertyName;d.hasSideEffects&&""+a[j]==""+c||(a[j]=c)}}else f.isCustomAttribute(b)&&l.setValueForAttribute(a,b,c)},setValueForAttribute:function(a,b,c){d(b)&&(null==c?a.removeAttribute(b):a.setAttribute(b,""+c))},deleteValueForProperty:function(a,b){var c=f.properties.hasOwnProperty(b)?f.properties[b]:null;if(c){var d=c.mutationMethod;if(d)d(a,void 0);else if(c.mustUseAttribute)a.removeAttribute(c.attributeName);else{var e=c.propertyName,g=f.getDefaultValueForProperty(a.nodeName,e);c.hasSideEffects&&""+a[e]===g||(a[e]=g)}}else f.isCustomAttribute(b)&&a.removeAttribute(b)}};g.measureMethods(l,"DOMPropertyOperations",{setValueForProperty:"setValueForProperty",setValueForAttribute:"setValueForAttribute",deleteValueForProperty:"deleteValueForProperty"}),b.exports=l},{10:10,133:133,168:168,76:76}],12:[function(a,b,c){"use strict";function d(a){return a.substring(1,a.indexOf(" "))}var e=a(144),f=a(149),g=a(150),h=a(154),i=a(158),j=/^(<[^ \/>]+)/,k="data-danger-index",l={dangerouslyRenderMarkup:function(a){e.canUseDOM?void 0:i(!1);for(var b,c={},l=0;l-1?void 0:g(!1),!j.plugins[c]){b.extractEvents?void 0:g(!1),j.plugins[c]=b;var d=b.eventTypes;for(var f in d)e(d[f],b,f)?void 0:g(!1)}}}function e(a,b,c){j.eventNameDispatchConfigs.hasOwnProperty(c)?g(!1):void 0,j.eventNameDispatchConfigs[c]=a;var d=a.phasedRegistrationNames;if(d){for(var e in d)if(d.hasOwnProperty(e)){var h=d[e];f(h,b,c)}return!0}return!!a.registrationName&&(f(a.registrationName,b,c),!0)}function f(a,b,c){j.registrationNameModules[a]?g(!1):void 0,j.registrationNameModules[a]=b,j.registrationNameDependencies[a]=b.eventTypes[c].dependencies}var g=a(158),h=null,i={},j={plugins:[],eventNameDispatchConfigs:{},registrationNameModules:{},registrationNameDependencies:{},injectEventPluginOrder:function(a){h?g(!1):void 0,h=Array.prototype.slice.call(a),d()},injectEventPluginsByName:function(a){var b=!1;for(var c in a)if(a.hasOwnProperty(c)){var e=a[c];i.hasOwnProperty(c)&&i[c]===e||(i[c]?g(!1):void 0,i[c]=e,b=!0)}b&&d()},getPluginModuleForEvent:function(a){var b=a.dispatchConfig;if(b.registrationName)return j.registrationNameModules[b.registrationName]||null;for(var c in b.phasedRegistrationNames)if(b.phasedRegistrationNames.hasOwnProperty(c)){var d=j.registrationNameModules[b.phasedRegistrationNames[c]];if(d)return d}return null},_resetEventPlugins:function(){h=null;for(var a in i)i.hasOwnProperty(a)&&delete i[a];j.plugins.length=0;var b=j.eventNameDispatchConfigs;for(var c in b)b.hasOwnProperty(c)&&delete b[c];var d=j.registrationNameModules;for(var e in d)d.hasOwnProperty(e)&&delete d[e]}};b.exports=j},{158:158}],18:[function(a,b,c){"use strict";function d(a){return a===q.topMouseUp||a===q.topTouchEnd||a===q.topTouchCancel}function e(a){return a===q.topMouseMove||a===q.topTouchMove}function f(a){return a===q.topMouseDown||a===q.topTouchStart}function g(a,b,c,d){var e=a.type||"unknown-event";a.currentTarget=p.Mount.getNode(d),b?n.invokeGuardedCallbackWithCatch(e,c,a,d):n.invokeGuardedCallback(e,c,a,d),a.currentTarget=null}function h(a,b){var c=a._dispatchListeners,d=a._dispatchIDs;if(Array.isArray(c))for(var e=0;ea&&c[a]===e[a];a++);var g=d-a;for(b=1;g>=b&&c[d-b]===e[f-b];b++);var h=b>1?1-b:void 0;return this._fallbackText=e.slice(a,h),this._fallbackText}}),e.addPoolingTo(d),b.exports=d},{128:128,24:24,25:25}],21:[function(a,b,c){"use strict";var d,e=a(10),f=a(144),g=e.injection.MUST_USE_ATTRIBUTE,h=e.injection.MUST_USE_PROPERTY,i=e.injection.HAS_BOOLEAN_VALUE,j=e.injection.HAS_SIDE_EFFECTS,k=e.injection.HAS_NUMERIC_VALUE,l=e.injection.HAS_POSITIVE_NUMERIC_VALUE,m=e.injection.HAS_OVERLOADED_BOOLEAN_VALUE;if(f.canUseDOM){var n=document.implementation;d=n&&n.hasFeature&&n.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")}var o={isCustomAttribute:RegExp.prototype.test.bind(/^(data|aria)-[a-z_][a-z\d_.\-]*$/),Properties:{accept:null,acceptCharset:null,accessKey:null,action:null,allowFullScreen:g|i,allowTransparency:g,alt:null,async:i,autoComplete:null,autoPlay:i,capture:g|i,cellPadding:null,cellSpacing:null,charSet:g,challenge:g,checked:h|i,classID:g,className:d?g:h,cols:g|l,colSpan:null,content:null,contentEditable:null,contextMenu:g,controls:h|i,coords:null,crossOrigin:null,data:null,dateTime:g,"default":i,defer:i,dir:null,disabled:g|i,download:m,draggable:null,encType:null,form:g,formAction:g,formEncType:g,formMethod:g,formNoValidate:i,formTarget:g,frameBorder:g,headers:null,height:g,hidden:g|i,high:null,href:null,hrefLang:null,htmlFor:null,httpEquiv:null,icon:null,id:h,inputMode:g,integrity:null,is:g,keyParams:g,keyType:g,kind:null,label:null,lang:null,list:g,loop:h|i,low:null,manifest:g,marginHeight:null,marginWidth:null,max:null,maxLength:g,media:g,mediaGroup:null,method:null,min:null,minLength:g,multiple:h|i,muted:h|i,name:null,nonce:g,noValidate:i,open:i,optimum:null,pattern:null,placeholder:null,poster:null,preload:null,radioGroup:null,readOnly:h|i,rel:null,required:i,reversed:i,role:g,rows:g|l,rowSpan:null,sandbox:null,scope:null,scoped:i,scrolling:null,seamless:g|i,selected:h|i,shape:null,size:g|l,sizes:g,span:l,spellCheck:null,src:null,srcDoc:h,srcLang:null,srcSet:g,start:k,step:null,style:null,summary:null,tabIndex:null,target:null,title:null,type:null,useMap:null,value:h|j,width:g,wmode:g,wrap:null,about:g,datatype:g,inlist:g,prefix:g,property:g,resource:g,"typeof":g,vocab:g,autoCapitalize:null,autoCorrect:null,autoSave:null,color:null,itemProp:g,itemScope:g|i,itemType:g,itemID:g,itemRef:g,results:null,security:g,unselectable:g},DOMAttributeNames:{acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv"},DOMPropertyNames:{autoCapitalize:"autocapitalize",autoComplete:"autocomplete",autoCorrect:"autocorrect",autoFocus:"autofocus",autoPlay:"autoplay",autoSave:"autosave",encType:"encoding",hrefLang:"hreflang",radioGroup:"radiogroup",spellCheck:"spellcheck",srcDoc:"srcdoc",srcSet:"srcset"}};b.exports=o},{10:10,144:144}],22:[function(a,b,c){"use strict";var d=a(68),e=a(88),f={linkState:function(a){return new d(this.state[a],e.createStateKeySetter(this,a))}};b.exports=f},{68:68,88:88}],23:[function(a,b,c){"use strict";function d(a){null!=a.checkedLink&&null!=a.valueLink?j(!1):void 0}function e(a){d(a),null!=a.value||null!=a.onChange?j(!1):void 0}function f(a){d(a),null!=a.checked||null!=a.onChange?j(!1):void 0}function g(a){if(a){var b=a.getName();if(b)return" Check the render method of `"+b+"`."}return""}var h=a(80),i=a(79),j=a(158),k=(a(168),{button:!0,checkbox:!0,image:!0,hidden:!0,radio:!0,reset:!0,submit:!0}),l={value:function(a,b,c){return!a[b]||k[a.type]||a.onChange||a.readOnly||a.disabled?null:new Error("You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`.")},checked:function(a,b,c){return!a[b]||a.onChange||a.readOnly||a.disabled?null:new Error("You provided a `checked` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultChecked`. Otherwise, set either `onChange` or `readOnly`.")},onChange:h.func},m={},n={checkPropTypes:function(a,b,c){for(var d in l){if(l.hasOwnProperty(d))var e=l[d](b,d,a,i.prop);e instanceof Error&&!(e.message in m)&&(m[e.message]=!0,g(c))}},getValue:function(a){return a.valueLink?(e(a),a.valueLink.value):a.value},getChecked:function(a){return a.checkedLink?(f(a),a.checkedLink.value):a.checked},executeOnChange:function(a,b){return a.valueLink?(e(a),a.valueLink.requestChange(b.target.value)):a.checkedLink?(f(a),a.checkedLink.requestChange(b.target.checked)):a.onChange?a.onChange.call(void 0,b):void 0}};b.exports=n},{158:158,168:168,79:79,80:80}],24:[function(a,b,c){"use strict";function d(a,b){if(null==a)throw new TypeError("Object.assign target cannot be null or undefined");for(var c=Object(a),d=Object.prototype.hasOwnProperty,e=1;e=0||null!=b.is}function q(a){o(a),this._tag=a.toLowerCase(),this._renderedChildren=null,this._previousStyle=null,this._previousStyleCopy=null,this._rootNodeID=null,this._wrapperState=null,this._topLevelWrapper=null,this._nodeWithLegacyProperties=null}var r=a(2),s=a(5),t=a(10),u=a(11),v=a(15),w=a(28),x=a(35),y=a(41),z=a(46),A=a(47),B=a(48),C=a(52),D=a(70),E=a(71),F=a(76),G=a(92),H=a(24),I=a(114),J=a(118),K=a(158),L=(a(130),a(163)),M=a(135),N=a(136),O=(a(166),a(141),a(168),w.deleteListener),P=w.listenTo,Q=w.registrationNameModules,R={string:!0,number:!0},S=L({children:null}),T=L({style:null}),U=L({__html:null}),V=1,W={topAbort:"abort",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topSeeked:"seeked",topSeeking:"seeking",topStalled:"stalled",topSuspend:"suspend",topTimeUpdate:"timeupdate",topVolumeChange:"volumechange",topWaiting:"waiting"},X={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},Y={listing:!0,pre:!0,textarea:!0},Z=(H({menuitem:!0},X),/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/),$={},_={}.hasOwnProperty;q.displayName="ReactDOMComponent",q.Mixin={construct:function(a){this._currentElement=a},mountComponent:function(a,b,c){this._rootNodeID=a;var d=this._currentElement.props;switch(this._tag){case"iframe":case"img":case"form":case"video":case"audio":this._wrapperState={listeners:null},b.getReactMountReady().enqueue(l,this);break;case"button":d=y.getNativeProps(this,d,c);break;case"input":z.mountWrapper(this,d,c),d=z.getNativeProps(this,d,c);break;case"option":A.mountWrapper(this,d,c),d=A.getNativeProps(this,d,c);break;case"select":B.mountWrapper(this,d,c),d=B.getNativeProps(this,d,c),c=B.processChildContext(this,d,c);break;case"textarea":C.mountWrapper(this,d,c),d=C.getNativeProps(this,d,c)}i(this,d);var e;if(b.useCreateElement){var f=c[D.ownerDocumentContextKey],g=f.createElement(this._currentElement.type);u.setAttributeForID(g,this._rootNodeID),D.getID(g),this._updateDOMProperties({},d,b,g),this._createInitialChildren(b,d,c,g),e=g}else{var h=this._createOpenTagMarkupAndPutListeners(b,d),j=this._createContentMarkup(b,d,c);e=!j&&X[this._tag]?h+"/>":h+">"+j+""}switch(this._tag){case"input":b.getReactMountReady().enqueue(m,this);case"button":case"select":case"textarea":d.autoFocus&&b.getReactMountReady().enqueue(r.focusDOMComponent,this)}return e},_createOpenTagMarkupAndPutListeners:function(a,b){var c="<"+this._currentElement.type;for(var d in b)if(b.hasOwnProperty(d)){var e=b[d];if(null!=e)if(Q.hasOwnProperty(d))e&&j(this._rootNodeID,d,e,a);else{d===T&&(e&&(e=this._previousStyleCopy=H({},b.style)),e=s.createMarkupForStyles(e));var f=null;null!=this._tag&&p(this._tag,b)?d!==S&&(f=u.createMarkupForCustomAttribute(d,e)):f=u.createMarkupForProperty(d,e),f&&(c+=" "+f)}}if(a.renderToStaticMarkup)return c;var g=u.createMarkupForID(this._rootNodeID);return c+" "+g},_createContentMarkup:function(a,b,c){var d="",e=b.dangerouslySetInnerHTML;if(null!=e)null!=e.__html&&(d=e.__html);else{var f=R[typeof b.children]?b.children:null,g=null!=f?null:b.children;if(null!=f)d=J(f);else if(null!=g){var h=this.mountChildren(g,a,c);d=h.join("")}}return Y[this._tag]&&"\n"===d.charAt(0)?"\n"+d:d},_createInitialChildren:function(a,b,c,d){var e=b.dangerouslySetInnerHTML;if(null!=e)null!=e.__html&&M(d,e.__html);else{var f=R[typeof b.children]?b.children:null,g=null!=f?null:b.children;if(null!=f)N(d,f);else if(null!=g)for(var h=this.mountChildren(g,a,c),i=0;ib.end?(c=b.end,d=b.start):(c=b.start,d=b.end),e.moveToElementText(a),e.moveStart("character",c),e.setEndPoint("EndToStart",e),e.moveEnd("character",d-c),e.select()}function h(a,b){if(window.getSelection){var c=window.getSelection(),d=a[k()].length,e=Math.min(b.start,d),f="undefined"==typeof b.end?e:Math.min(b.end,d);if(!c.extend&&e>f){var g=f;f=e,e=g}var h=j(a,e),i=j(a,f);if(h&&i){var l=document.createRange();l.setStart(h.node,h.offset),c.removeAllRanges(),e>f?(c.addRange(l),c.extend(i.node,i.offset)):(l.setEnd(i.node,i.offset),c.addRange(l))}}}var i=a(144),j=a(127),k=a(128),l=i.canUseDOM&&"selection"in document&&!("getSelection"in window),m={getOffsets:l?e:f,setOffsets:l?g:h};b.exports=m},{127:127,128:128,144:144}],50:[function(a,b,c){"use strict";var d=a(54),e=a(86),f=a(94);d.inject();var g={renderToString:e.renderToString,renderToStaticMarkup:e.renderToStaticMarkup,version:f};b.exports=g},{54:54,86:86,94:94}],51:[function(a,b,c){"use strict";var d=a(9),e=a(11),f=a(35),g=a(70),h=a(24),i=a(118),j=a(136),k=(a(141),function(a){});h(k.prototype,{construct:function(a){this._currentElement=a,this._stringText=""+a,this._rootNodeID=null,this._mountIndex=0},mountComponent:function(a,b,c){if(this._rootNodeID=a,b.useCreateElement){var d=c[g.ownerDocumentContextKey],f=d.createElement("span");return e.setAttributeForID(f,a),g.getID(f),j(f,this._stringText),f}var h=i(this._stringText);return b.renderToStaticMarkup?h:""+h+""},receiveComponent:function(a,b){if(a!==this._currentElement){this._currentElement=a;var c=""+a;if(c!==this._stringText){this._stringText=c;var e=g.getNode(this._rootNodeID);d.updateTextContent(e,c)}}},unmountComponent:function(){f.unmountIDFromEnvironment(this._rootNodeID)}}),b.exports=k},{11:11,118:118,136:136,141:141,24:24,35:35,70:70,9:9}],52:[function(a,b,c){"use strict";function d(){this._rootNodeID&&k.updateWrapper(this)}function e(a){var b=this._currentElement.props,c=f.executeOnChange(b,a);return h.asap(d,this),c}var f=a(23),g=a(45),h=a(93),i=a(24),j=a(158),k=(a(168),{getNativeProps:function(a,b,c){null!=b.dangerouslySetInnerHTML?j(!1):void 0;var d=i({},b,{defaultValue:void 0,value:void 0,children:a._wrapperState.initialValue,onChange:a._wrapperState.onChange});return d},mountWrapper:function(a,b){var c=b.defaultValue,d=b.children;null!=d&&(null!=c?j(!1):void 0,Array.isArray(d)&&(d.length<=1?void 0:j(!1),d=d[0]),c=""+d),null==c&&(c="");var g=f.getValue(b);a._wrapperState={initialValue:""+(null!=g?g:c),onChange:e.bind(a)}},updateWrapper:function(a){var b=a._currentElement.props,c=f.getValue(b);null!=c&&g.updatePropertyByID(a._rootNodeID,"value",""+c)}});b.exports=k},{158:158,168:168,23:23,24:24,45:45,93:93}],53:[function(a,b,c){"use strict";function d(){this.reinitializeTransaction()}var e=a(93),f=a(110),g=a(24),h=a(150),i={initialize:h,close:function(){m.isBatchingUpdates=!1}},j={initialize:h,close:e.flushBatchedUpdates.bind(e)},k=[j,i];g(d.prototype,f.Mixin,{getTransactionWrappers:function(){return k}});var l=new d,m={isBatchingUpdates:!1,batchedUpdates:function(a,b,c,d,e,f){var g=m.isBatchingUpdates;m.isBatchingUpdates=!0,g?a(b,c,d,e,f):l.perform(a,null,b,c,d,e,f)}};b.exports=m},{110:110,150:150,24:24,93:93}],54:[function(a,b,c){"use strict";function d(){z||(z=!0,r.EventEmitter.injectReactEventListener(q),r.EventPluginHub.injectEventPluginOrder(h),r.EventPluginHub.injectInstanceHandle(s),r.EventPluginHub.injectMount(t),r.EventPluginHub.injectEventPluginsByName({SimpleEventPlugin:x,EnterLeaveEventPlugin:i,ChangeEventPlugin:f,SelectEventPlugin:v,BeforeInputEventPlugin:e}),r.NativeComponent.injectGenericComponentClass(o),r.NativeComponent.injectTextComponentClass(p),r.Class.injectMixin(l),r.DOMProperty.injectDOMPropertyConfig(k),r.DOMProperty.injectDOMPropertyConfig(y),r.EmptyComponent.injectEmptyComponent("noscript"),r.Updates.injectReconcileTransaction(u),r.Updates.injectBatchingStrategy(n),r.RootIndex.injectCreateReactRootIndex(j.canUseDOM?g.createReactRootIndex:w.createReactRootIndex),r.Component.injectEnvironment(m))}var e=a(3),f=a(7),g=a(8),h=a(13),i=a(14),j=a(144),k=a(21),l=a(27),m=a(35),n=a(53),o=a(42),p=a(51),q=a(61),r=a(63),s=a(65),t=a(70),u=a(81),v=a(96),w=a(97),x=a(98),y=a(95),z=!1;b.exports={inject:d}},{13:13,14:14,144:144,21:21,27:27,3:3,35:35,42:42,51:51,53:53,61:61,63:63,65:65,7:7,70:70,8:8,81:81,95:95,96:96,97:97,98:98}],55:[function(a,b,c){"use strict";var d=a(39),e=a(24),f=(a(114),"function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103),g={key:!0,ref:!0,__self:!0,__source:!0},h=function(a,b,c,d,e,g,h){var i={$$typeof:f,type:a,key:b,ref:c,props:h,_owner:g};return i};h.createElement=function(a,b,c){var e,f={},i=null,j=null,k=null,l=null;if(null!=b){j=void 0===b.ref?null:b.ref,i=void 0===b.key?null:""+b.key,k=void 0===b.__self?null:b.__self,l=void 0===b.__source?null:b.__source;for(e in b)b.hasOwnProperty(e)&&!g.hasOwnProperty(e)&&(f[e]=b[e])}var m=arguments.length-2;if(1===m)f.children=c;else if(m>1){for(var n=Array(m),o=0;m>o;o++)n[o]=arguments[o+2];f.children=n}if(a&&a.defaultProps){var p=a.defaultProps;for(e in p)"undefined"==typeof f[e]&&(f[e]=p[e])}return h(a,i,j,k,l,d.current,f)},h.createFactory=function(a){var b=h.createElement.bind(null,a);return b.type=a,b},h.cloneAndReplaceKey=function(a,b){var c=h(a.type,b,a.ref,a._self,a._source,a._owner,a.props);return c},h.cloneAndReplaceProps=function(a,b){var c=h(a.type,a.key,a.ref,a._self,a._source,a._owner,b);return c},h.cloneElement=function(a,b,c){var f,i=e({},a.props),j=a.key,k=a.ref,l=a._self,m=a._source,n=a._owner;if(null!=b){void 0!==b.ref&&(k=b.ref,n=d.current),void 0!==b.key&&(j=""+b.key);for(f in b)b.hasOwnProperty(f)&&!g.hasOwnProperty(f)&&(i[f]=b[f])}var o=arguments.length-2;if(1===o)i.children=c;else if(o>1){for(var p=Array(o),q=0;o>q;q++)p[q]=arguments[q+2];i.children=p}return h(a.type,j,k,l,m,n,i)},h.isValidElement=function(a){return"object"==typeof a&&null!==a&&a.$$typeof===f},b.exports=h},{114:114,24:24,39:39}],56:[function(a,b,c){"use strict";function d(){if(l.current){var a=l.current.getName();if(a)return" Check the render method of `"+a+"`."}return""}function e(a,b){a._store&&!a._store.validated&&null==a.key&&(a._store.validated=!0,f("uniqueKey",a,b))}function f(a,b,c){var e=d();if(!e){var f="string"==typeof c?c:c.displayName||c.name;f&&(e=" Check the top-level render call using <"+f+">.")}var g=o[a]||(o[a]={});if(g[e])return null;g[e]=!0;var h={parentOrOwner:e,url:" See https://fb.me/react-warning-keys for more information.",childOwner:null};return b&&b._owner&&b._owner!==l.current&&(h.childOwner=" It was passed a child from "+b._owner.getName()+"."),h}function g(a,b){if("object"==typeof a)if(Array.isArray(a))for(var c=0;c=g;g++)if(e(a,g)&&e(b,g))d=g;else if(a.charAt(g)!==b.charAt(g))break;var h=a.substr(0,d);return f(h)?void 0:m(!1),h}function k(a,b,c,d,e,f){a=a||"",b=b||"",a===b?m(!1):void 0;var j=g(b,a);j||g(a,b)?void 0:m(!1);for(var k=0,l=j?h:i,n=a;;n=l(n,b)){var o;if(e&&n===a||f&&n===b||(o=c(n,j,d)),o===!1||n===b)break;k++1){var b=a.indexOf(n,1);return b>-1?a.substr(0,b):a}return null},traverseEnterLeave:function(a,b,c,d,e){var f=j(a,b);f!==a&&k(a,f,c,d,!1,!0),f!==b&&k(f,b,c,e,!0,!1)},traverseTwoPhase:function(a,b,c){a&&(k("",a,b,c,!0,!1),k(a,"",b,c,!1,!0))},traverseTwoPhaseSkipTarget:function(a,b,c){a&&(k("",a,b,c,!0,!0),k(a,"",b,c,!0,!0))},traverseAncestors:function(a,b,c){k("",a,b,c,!0,!1)},getFirstCommonAncestorID:j,_getNextDescendantID:i,isAncestorIDOf:g,SEPARATOR:n};b.exports=q},{158:158,84:84}],66:[function(a,b,c){"use strict";var d={remove:function(a){a._reactInternalInstance=void 0},get:function(a){return a._reactInternalInstance},has:function(a){return void 0!==a._reactInternalInstance},set:function(a,b){a._reactInternalInstance=b}};b.exports=d},{}],67:[function(a,b,c){"use strict";var d=a(32),e=a(34),f=a(33),g=a(43),h=a(55),i=(a(56),a(80)),j=a(94),k=a(24),l=a(132),m=h.createElement,n=h.createFactory,o=h.cloneElement,p={Children:{map:d.map,forEach:d.forEach,count:d.count,toArray:d.toArray,only:l},Component:e,createElement:m,cloneElement:o,isValidElement:h.isValidElement,PropTypes:i,createClass:f.createClass,createFactory:n,createMixin:function(a){return a},DOM:g,version:j,__spread:k};b.exports=p},{132:132,24:24,32:32,33:33,34:34,43:43,55:55,56:56,80:80,94:94}],68:[function(a,b,c){"use strict";function d(a,b){this.value=a,this.requestChange=b}function e(a){var b={value:"undefined"==typeof a?f.PropTypes.any.isRequired:a.isRequired,requestChange:f.PropTypes.func.isRequired};return f.PropTypes.shape(b)}var f=a(26);d.PropTypes={link:e},b.exports=d},{26:26}],69:[function(a,b,c){"use strict";var d=a(113),e=/\/?>/,f={CHECKSUM_ATTR_NAME:"data-react-checksum",addChecksumToMarkup:function(a){var b=d(a);return a.replace(e," "+f.CHECKSUM_ATTR_NAME+'="'+b+'"$&')},canReuseMarkup:function(a,b){var c=b.getAttribute(f.CHECKSUM_ATTR_NAME);c=c&&parseInt(c,10);var e=d(a);return e===c}};b.exports=f},{113:113}],70:[function(a,b,c){"use strict";function d(a,b){for(var c=Math.min(a.length,b.length),d=0;c>d;d++)if(a.charAt(d)!==b.charAt(d))return d;return a.length===b.length?-1:c}function e(a){return a?a.nodeType===Q?a.documentElement:a.firstChild:null}function f(a){var b=e(a);return b&&Y.getID(b)}function g(a){var b=h(a);if(b)if(O.hasOwnProperty(b)){var c=O[b];c!==a&&(l(c,b)?K(!1):void 0,O[b]=a)}else O[b]=a;return b}function h(a){return a&&a.getAttribute&&a.getAttribute(N)||""}function i(a,b){var c=h(a);c!==b&&delete O[c],a.setAttribute(N,b),O[b]=a}function j(a){return O.hasOwnProperty(a)&&l(O[a],a)||(O[a]=Y.findReactNodeByID(a)),O[a]}function k(a){var b=A.get(a)._rootNodeID;return y.isNullComponentID(b)?null:(O.hasOwnProperty(b)&&l(O[b],b)||(O[b]=Y.findReactNodeByID(b)),O[b])}function l(a,b){if(a){h(a)!==b?K(!1):void 0;var c=Y.findReactContainerForID(b);if(c&&I(c,a))return!0}return!1}function m(a){delete O[a]}function n(a){var b=O[a];return!(!b||!l(b,a))&&void(W=b)}function o(a){W=null,z.traverseAncestors(a,n);var b=W;return W=null,b}function p(a,b,c,d,e,f){w.useCreateElement&&(f=G({},f),c.nodeType===Q?f[S]=c:f[S]=c.ownerDocument);var g=D.mountComponent(a,b,d,f);a._renderedComponent._topLevelWrapper=a,Y._mountImageIntoNode(g,c,e,d)}function q(a,b,c,d,e){var f=F.ReactReconcileTransaction.getPooled(d);f.perform(p,null,a,b,c,f,d,e),F.ReactReconcileTransaction.release(f)}function r(a,b){for(D.unmountComponent(a),b.nodeType===Q&&(b=b.documentElement);b.lastChild;)b.removeChild(b.lastChild)}function s(a){var b=f(a);return!!b&&b!==z.getReactRootIDFromNodeID(b)}function t(a){for(;a&&a.parentNode!==a;a=a.parentNode)if(1===a.nodeType){var b=h(a);if(b){var c,d=z.getReactRootIDFromNodeID(b),e=a;do if(c=h(e),e=e.parentNode,null==e)return null;while(c!==d);if(e===U[d])return a}}return null}var u=a(10),v=a(28),w=(a(39),a(44)),x=a(55),y=a(58),z=a(65),A=a(66),B=a(69),C=a(76),D=a(82),E=a(92),F=a(93),G=a(24),H=a(151),I=a(147),J=a(129),K=a(158),L=a(135),M=a(138),N=(a(141),a(168),u.ID_ATTRIBUTE_NAME),O={},P=1,Q=9,R=11,S="__ReactMount_ownerDocument$"+Math.random().toString(36).slice(2),T={},U={},V=[],W=null,X=function(){};X.prototype.isReactComponent={},X.prototype.render=function(){return this.props};var Y={TopLevelWrapper:X,_instancesByReactRootID:T,scrollMonitor:function(a,b){b()},_updateRootComponent:function(a,b,c,d){return Y.scrollMonitor(c,function(){E.enqueueElementInternal(a,b),d&&E.enqueueCallbackInternal(a,d)}),a},_registerComponent:function(a,b){!b||b.nodeType!==P&&b.nodeType!==Q&&b.nodeType!==R?K(!1):void 0,v.ensureScrollValueMonitoring();var c=Y.registerContainer(b);return T[c]=a,c},_renderNewRootComponent:function(a,b,c,d){var e=J(a,null),f=Y._registerComponent(e,b);return F.batchedUpdates(q,e,f,b,c,d),e},renderSubtreeIntoContainer:function(a,b,c,d){return null==a||null==a._reactInternalInstance?K(!1):void 0,Y._renderSubtreeIntoContainer(a,b,c,d)},_renderSubtreeIntoContainer:function(a,b,c,d){x.isValidElement(b)?void 0:K(!1);var g=new x(X,null,null,null,null,null,b),i=T[f(c)];if(i){var j=i._currentElement,k=j.props;if(M(k,b)){var l=i._renderedComponent.getPublicInstance(),m=d&&function(){d.call(l)};return Y._updateRootComponent(i,g,c,m),l}Y.unmountComponentAtNode(c)}var n=e(c),o=n&&!!h(n),p=s(c),q=o&&!i&&!p,r=Y._renderNewRootComponent(g,c,q,null!=a?a._reactInternalInstance._processChildContext(a._reactInternalInstance._context):H)._renderedComponent.getPublicInstance();return d&&d.call(r),r},render:function(a,b,c){return Y._renderSubtreeIntoContainer(null,a,b,c)},registerContainer:function(a){var b=f(a);return b&&(b=z.getReactRootIDFromNodeID(b)),b||(b=z.createReactRootID()),U[b]=a,b},unmountComponentAtNode:function(a){!a||a.nodeType!==P&&a.nodeType!==Q&&a.nodeType!==R?K(!1):void 0;var b=f(a),c=T[b];if(!c){var d=(s(a),h(a));return d&&d===z.getReactRootIDFromNodeID(d),!1}return F.batchedUpdates(r,c,a),delete T[b],delete U[b],!0},findReactContainerForID:function(a){var b=z.getReactRootIDFromNodeID(a),c=U[b];return c},findReactNodeByID:function(a){var b=Y.findReactContainerForID(a);return Y.findComponentRoot(b,a)},getFirstReactDOM:function(a){return t(a)},findComponentRoot:function(a,b){var c=V,d=0,e=o(b)||a;for(c[0]=e.firstChild,c.length=1;d>"}var s=a(55),t=a(78),u=a(150),v=a(126),w="<>",x={array:e("array"),bool:e("boolean"),func:e("function"),number:e("number"),object:e("object"),string:e("string"),any:f(),arrayOf:g,element:h(),instanceOf:i,node:m(),objectOf:k,oneOf:j,oneOfType:l,shape:n};b.exports=x},{126:126,150:150,55:55,78:78}],81:[function(a,b,c){"use strict";function d(a){this.reinitializeTransaction(),this.renderToStaticMarkup=!1,this.reactMountReady=e.getPooled(null),this.useCreateElement=!a&&h.useCreateElement}var e=a(6),f=a(25),g=a(28),h=a(44),i=a(64),j=a(110),k=a(24),l={initialize:i.getSelectionInformation,close:i.restoreSelection},m={initialize:function(){var a=g.isEnabled();return g.setEnabled(!1),a},close:function(a){g.setEnabled(a)}},n={initialize:function(){this.reactMountReady.reset()},close:function(){this.reactMountReady.notifyAll()}},o=[l,m,n],p={getTransactionWrappers:function(){return o},getReactMountReady:function(){return this.reactMountReady},destructor:function(){e.release(this.reactMountReady),this.reactMountReady=null}};k(d.prototype,j.Mixin,p),f.addPoolingTo(d),b.exports=d},{110:110,24:24,25:25,28:28,44:44,6:6,64:64}],82:[function(a,b,c){"use strict";function d(){e.attachRefs(this,this._currentElement)}var e=a(83),f={mountComponent:function(a,b,c,e){var f=a.mountComponent(b,c,e);return a._currentElement&&null!=a._currentElement.ref&&c.getReactMountReady().enqueue(d,a),f},unmountComponent:function(a){e.detachRefs(a,a._currentElement),a.unmountComponent()},receiveComponent:function(a,b,c,f){var g=a._currentElement;if(b!==g||f!==a._context){var h=e.shouldUpdateRefs(g,b);h&&e.detachRefs(a,g),a.receiveComponent(b,c,f),h&&a._currentElement&&null!=a._currentElement.ref&&c.getReactMountReady().enqueue(d,a)}},performUpdateIfNecessary:function(a,b){a.performUpdateIfNecessary(b)}};b.exports=f},{83:83}],83:[function(a,b,c){"use strict";function d(a,b,c){"function"==typeof a?a(b.getPublicInstance()):f.addComponentAsRefTo(b,a,c)}function e(a,b,c){"function"==typeof a?a(null):f.removeComponentAsRefFrom(b,a,c)}var f=a(75),g={};g.attachRefs=function(a,b){if(null!==b&&b!==!1){var c=b.ref;null!=c&&d(c,a,b._owner)}},g.shouldUpdateRefs=function(a,b){var c=null===a||a===!1,d=null===b||b===!1;return c||d||b._owner!==a._owner||b.ref!==a.ref},g.detachRefs=function(a,b){if(null!==b&&b!==!1){var c=b.ref;null!=c&&e(c,a,b._owner)}},b.exports=g},{75:75}],84:[function(a,b,c){"use strict";var d={injectCreateReactRootIndex:function(a){e.createReactRootIndex=a}},e={createReactRootIndex:null,injection:d};b.exports=e},{}],85:[function(a,b,c){"use strict";var d={isBatchingUpdates:!1,batchedUpdates:function(a){}};b.exports=d},{}],86:[function(a,b,c){"use strict";function d(a){g.isValidElement(a)?void 0:o(!1);var b;try{l.injection.injectBatchingStrategy(j);var c=h.createReactRootID();return b=k.getPooled(!1),b.perform(function(){var d=n(a,null),e=d.mountComponent(c,b,m);return i.addChecksumToMarkup(e)},null)}finally{k.release(b),l.injection.injectBatchingStrategy(f)}}function e(a){g.isValidElement(a)?void 0:o(!1);var b;try{l.injection.injectBatchingStrategy(j);var c=h.createReactRootID();return b=k.getPooled(!0),b.perform(function(){var d=n(a,null);return d.mountComponent(c,b,m)},null)}finally{k.release(b),l.injection.injectBatchingStrategy(f)}}var f=a(53),g=a(55),h=a(65),i=a(69),j=a(85),k=a(87),l=a(93),m=a(151),n=a(129),o=a(158);b.exports={renderToString:d,renderToStaticMarkup:e}},{129:129,151:151,158:158,53:53,55:55,65:65,69:69,85:85,87:87,93:93}],87:[function(a,b,c){"use strict";function d(a){this.reinitializeTransaction(),this.renderToStaticMarkup=a,this.reactMountReady=f.getPooled(null),this.useCreateElement=!1}var e=a(25),f=a(6),g=a(110),h=a(24),i=a(150),j={initialize:function(){this.reactMountReady.reset()},close:i},k=[j],l={getTransactionWrappers:function(){return k},getReactMountReady:function(){return this.reactMountReady},destructor:function(){f.release(this.reactMountReady),this.reactMountReady=null}};h(d.prototype,g.Mixin,l),e.addPoolingTo(d),b.exports=d},{110:110,150:150,24:24,25:25,6:6}],88:[function(a,b,c){"use strict";function d(a,b){var c={};return function(d){c[b]=d,a.setState(c)}}var e={createStateSetter:function(a,b){return function(c,d,e,f,g,h){var i=b.call(a,c,d,e,f,g,h);i&&a.setState(i)}},createStateKeySetter:function(a,b){var c=a.__keySetters||(a.__keySetters={});return c[b]||(c[b]=d(a,b))}};e.Mixin={createStateSetter:function(a){return e.createStateSetter(this,a)},createStateKeySetter:function(a){return e.createStateKeySetter(this,a)}},b.exports=e},{}],89:[function(a,b,c){"use strict";var d=a(120),e={getChildMapping:function(a){return a?d(a):a},mergeChildMappings:function(a,b){function c(c){return b.hasOwnProperty(c)?b[c]:a[c]}a=a||{},b=b||{};var d={},e=[];for(var f in a)b.hasOwnProperty(f)?e.length&&(d[f]=e,e=[]):e.push(f);var g,h={};for(var i in b){if(d.hasOwnProperty(i))for(g=0;gc;c++){var d=r[c],e=d._pendingCallbacks;if(d._pendingCallbacks=null,n.performUpdateIfNecessary(d,a.reconcileTransaction),e)for(var f=0;fd;){for(;dd;d++)c+=b+=a.charCodeAt(d);return b%=e,c%=e,b|c<<16}var e=65521;b.exports=d},{}],114:[function(a,b,c){"use strict";var d=!1;b.exports=d},{}],115:[function(a,b,c){"use strict";function d(a,b){var c=f.mergeProps(b,a.props);return!c.hasOwnProperty(h)&&a.props.hasOwnProperty(h)&&(c.children=a.props.children),e.createElement(a.type,c)}var e=a(55),f=a(77),g=a(163),h=(a(168),g({children:null}));b.exports=d},{163:163,168:168,55:55,77:77}],116:[function(a,b,c){"use strict";function d(a,b){var c=null==b||"boolean"==typeof b||""===b;if(c)return"";var d=isNaN(b);return d||0===b||f.hasOwnProperty(a)&&f[a]?""+b:("string"==typeof b&&(b=b.trim()),b+"px")}var e=a(4),f=e.isUnitlessNumber;b.exports=d},{4:4}],117:[function(a,b,c){"use strict";function d(a,b,c,d,e){return e}a(24),a(168),b.exports=d},{168:168,24:24}],118:[function(a,b,c){"use strict";function d(a){return f[a]}function e(a){return(""+a).replace(g,d)}var f={"&":"&",">":">","<":"<",'"':""","'":"'"},g=/[&><"']/g;b.exports=e},{}],119:[function(a,b,c){"use strict";function d(a){return null==a?null:1===a.nodeType?a:e.has(a)?f.getNodeFromInstance(a):(null!=a.render&&"function"==typeof a.render?g(!1):void 0,void g(!1))}var e=(a(39),a(66)),f=a(70),g=a(158);a(168),b.exports=d},{158:158,168:168,39:39,66:66,70:70}],120:[function(a,b,c){"use strict";function d(a,b,c){var d=a,e=void 0===d[c];e&&null!=b&&(d[c]=b)}function e(a){if(null==a)return a;var b={};return f(a,d,b),b}var f=a(139);a(168),b.exports=e},{139:139,168:168}],121:[function(a,b,c){"use strict";var d=function(a,b,c){Array.isArray(a)?a.forEach(b,c):a&&b.call(c,a)};b.exports=d},{}],122:[function(a,b,c){"use strict";function d(a){var b,c=a.keyCode;return"charCode"in a?(b=a.charCode,0===b&&13===c&&(b=13)):b=c,b>=32||13===b?b:0}b.exports=d},{}],123:[function(a,b,c){"use strict";function d(a){if(a.key){var b=f[a.key]||a.key;if("Unidentified"!==b)return b}if("keypress"===a.type){var c=e(a);return 13===c?"Enter":String.fromCharCode(c)}return"keydown"===a.type||"keyup"===a.type?g[a.keyCode]||"Unidentified":""}var e=a(122),f={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},g={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"};b.exports=d},{122:122}],124:[function(a,b,c){"use strict";function d(a){var b=this,c=b.nativeEvent;if(c.getModifierState)return c.getModifierState(a);var d=f[a];return!!d&&!!c[d]}function e(a){return d}var f={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};b.exports=e},{}],125:[function(a,b,c){"use strict";function d(a){var b=a.target||a.srcElement||window;return 3===b.nodeType?b.parentNode:b}b.exports=d},{}],126:[function(a,b,c){"use strict";function d(a){var b=a&&(e&&a[e]||a[f]);return"function"==typeof b?b:void 0}var e="function"==typeof Symbol&&Symbol.iterator,f="@@iterator";b.exports=d},{}],127:[function(a,b,c){"use strict";function d(a){for(;a&&a.firstChild;)a=a.firstChild;return a}function e(a){for(;a;){if(a.nextSibling)return a.nextSibling;a=a.parentNode}}function f(a,b){for(var c=d(a),f=0,g=0;c;){if(3===c.nodeType){if(g=f+c.textContent.length,b>=f&&g>=b)return{node:c,offset:b-f};f=g}c=d(e(c))}}b.exports=f},{}],128:[function(a,b,c){"use strict";function d(){return!f&&e.canUseDOM&&(f="textContent"in document.documentElement?"textContent":"innerText"),f}var e=a(144),f=null;b.exports=d},{144:144}],129:[function(a,b,c){"use strict";function d(a){return"function"==typeof a&&"undefined"!=typeof a.prototype&&"function"==typeof a.prototype.mountComponent&&"function"==typeof a.prototype.receiveComponent}function e(a){var b;if(null===a||a===!1)b=new g(e);else if("object"==typeof a){var c=a;!c||"function"!=typeof c.type&&"string"!=typeof c.type?j(!1):void 0,b="string"==typeof c.type?h.createInternalComponent(c):d(c.type)?new c.type(c):new k}else"string"==typeof a||"number"==typeof a?b=h.createInstanceForText(a):j(!1);return b.construct(a),b._mountIndex=0,b._mountImage=null,b}var f=a(38),g=a(57),h=a(73),i=a(24),j=a(158),k=(a(168),function(){});i(k.prototype,f.Mixin,{_instantiateReactComponent:e}),b.exports=e},{158:158,168:168,24:24,38:38,57:57,73:73}],130:[function(a,b,c){"use strict";function d(a,b){if(!f.canUseDOM||b&&!("addEventListener"in document))return!1;var c="on"+a,d=c in document;if(!d){var g=document.createElement("div");g.setAttribute(c,"return;"),d="function"==typeof g[c]}return!d&&e&&"wheel"===a&&(d=document.implementation.hasFeature("Events.wheel","3.0")),d}var e,f=a(144);f.canUseDOM&&(e=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0),b.exports=d},{144:144}],131:[function(a,b,c){"use strict";function d(a){var b=a&&a.nodeName&&a.nodeName.toLowerCase();return b&&("input"===b&&e[a.type]||"textarea"===b)}var e={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};b.exports=d},{}],132:[function(a,b,c){"use strict";function d(a){return e.isValidElement(a)?void 0:f(!1),a}var e=a(55),f=a(158);b.exports=d},{158:158,55:55}],133:[function(a,b,c){"use strict";function d(a){return'"'+e(a)+'"'}var e=a(118);b.exports=d},{118:118}],134:[function(a,b,c){"use strict";var d=a(70);b.exports=d.renderSubtreeIntoContainer},{70:70}],135:[function(a,b,c){"use strict";var d=a(144),e=/^[ \r\n\t\f]/,f=/<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/,g=function(a,b){a.innerHTML=b};if("undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction&&(g=function(a,b){MSApp.execUnsafeLocalFunction(function(){a.innerHTML=b})}),d.canUseDOM){var h=document.createElement("div");h.innerHTML=" ",""===h.innerHTML&&(g=function(a,b){if(a.parentNode&&a.parentNode.replaceChild(a,a),e.test(b)||"<"===b[0]&&f.test(b)){a.innerHTML=String.fromCharCode(65279)+b;var c=a.firstChild;1===c.data.length?a.removeChild(c):c.deleteData(0,1)}else a.innerHTML=b})}b.exports=g},{144:144}],136:[function(a,b,c){"use strict";var d=a(144),e=a(118),f=a(135),g=function(a,b){a.textContent=b};d.canUseDOM&&("textContent"in document.documentElement||(g=function(a,b){f(a,e(b))})),b.exports=g},{118:118,135:135,144:144}],137:[function(a,b,c){"use strict";function d(a,b,c){return!e(a.props,b)||!e(a.state,c)}var e=a(166);b.exports=d},{166:166}],138:[function(a,b,c){"use strict";function d(a,b){var c=null===a||a===!1,d=null===b||b===!1;if(c||d)return c===d;var e=typeof a,f=typeof b;return"string"===e||"number"===e?"string"===f||"number"===f:"object"===f&&a.type===b.type&&a.key===b.key}b.exports=d},{}],139:[function(a,b,c){"use strict";function d(a){return p[a]}function e(a,b){return a&&null!=a.key?g(a.key):b.toString(36)}function f(a){return(""+a).replace(q,d)}function g(a){return"$"+f(a)}function h(a,b,c,d){var f=typeof a;if(("undefined"===f||"boolean"===f)&&(a=null),null===a||"string"===f||"number"===f||j.isValidElement(a))return c(d,a,""===b?n+e(a,0):b),1;var i,k,p=0,q=""===b?n:b+o;if(Array.isArray(a))for(var r=0;r-1}};b.exports=e},{158:158}],143:[function(a,b,c){"use strict";var d=a(150),e={listen:function(a,b,c){return a.addEventListener?(a.addEventListener(b,c,!1),{remove:function(){a.removeEventListener(b,c,!1)}}):a.attachEvent?(a.attachEvent("on"+b,c),{remove:function(){a.detachEvent("on"+b,c)}}):void 0},capture:function(a,b,c){return a.addEventListener?(a.addEventListener(b,c,!0),{remove:function(){a.removeEventListener(b,c,!0)}}):{remove:d}},registerDefault:function(){}};b.exports=e},{150:150}],144:[function(a,b,c){"use strict";var d=!("undefined"==typeof window||!window.document||!window.document.createElement),e={canUseDOM:d,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:d&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:d&&!!window.screen,isInWorker:!d};b.exports=e},{}],145:[function(a,b,c){"use strict";function d(a){return a.replace(e,function(a,b){return b.toUpperCase()})}var e=/-(.)/g;b.exports=d},{}],146:[function(a,b,c){"use strict";function d(a){return e(a.replace(f,"ms-"))}var e=a(145),f=/^-ms-/;b.exports=d},{145:145}],147:[function(a,b,c){"use strict";function d(a,b){var c=!0;a:for(;c;){var d=a,f=b;if(c=!1,d&&f){if(d===f)return!0;if(e(d))return!1;if(e(f)){a=d,b=f.parentNode,c=!0;continue a}return d.contains?d.contains(f):!!d.compareDocumentPosition&&!!(16&d.compareDocumentPosition(f))}return!1}}var e=a(160);b.exports=d},{160:160}],148:[function(a,b,c){"use strict";function d(a){return!!a&&("object"==typeof a||"function"==typeof a)&&"length"in a&&!("setInterval"in a)&&"number"!=typeof a.nodeType&&(Array.isArray(a)||"callee"in a||"item"in a)}function e(a){return d(a)?Array.isArray(a)?a.slice():f(a):[a]}var f=a(167);b.exports=e},{167:167}],149:[function(a,b,c){"use strict";function d(a){var b=a.match(k);return b&&b[1].toLowerCase()}function e(a,b){var c=j;j?void 0:i(!1);var e=d(a),f=e&&h(e);if(f){c.innerHTML=f[1]+a+f[2];for(var k=f[0];k--;)c=c.lastChild}else c.innerHTML=a;var l=c.getElementsByTagName("script");l.length&&(b?void 0:i(!1),g(l).forEach(b));for(var m=g(c.childNodes);c.lastChild;)c.removeChild(c.lastChild);return m}var f=a(144),g=a(148),h=a(154),i=a(158),j=f.canUseDOM?document.createElement("div"):null,k=/^\s*<(\w+)/;b.exports=e},{144:144,148:148,154:154,158:158}],150:[function(a,b,c){"use strict";function d(a){return function(){return a}}function e(){}e.thatReturns=d,e.thatReturnsFalse=d(!1),e.thatReturnsTrue=d(!0),e.thatReturnsNull=d(null),e.thatReturnsThis=function(){return this},e.thatReturnsArgument=function(a){return a},b.exports=e},{}],151:[function(a,b,c){"use strict";var d={};b.exports=d},{}],152:[function(a,b,c){"use strict";function d(a){try{a.focus()}catch(b){}}b.exports=d},{}],153:[function(a,b,c){"use strict";function d(){if("undefined"==typeof document)return null;try{return document.activeElement||document.body}catch(a){return document.body}}b.exports=d},{}],154:[function(a,b,c){"use strict";function d(a){return g?void 0:f(!1),m.hasOwnProperty(a)||(a="*"),h.hasOwnProperty(a)||("*"===a?g.innerHTML="":g.innerHTML="<"+a+">",h[a]=!g.firstChild),h[a]?m[a]:null}var e=a(144),f=a(158),g=e.canUseDOM?document.createElement("div"):null,h={},i=[1,'"],j=[1,"","
"],k=[3,"","
"],l=[1,'',""],m={"*":[1,"?
","
"],area:[1,"",""],col:[2,"","
"],legend:[1,"
","
"],param:[1,"",""],tr:[2,"","
"],optgroup:i,option:i,caption:j,colgroup:j,tbody:j,tfoot:j,thead:j,td:k,th:k},n=["circle","clipPath","defs","ellipse","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","text","tspan"];n.forEach(function(a){m[a]=l,h[a]=!0}),b.exports=d},{144:144,158:158}],155:[function(a,b,c){"use strict";function d(a){return a===window?{x:window.pageXOffset||document.documentElement.scrollLeft,y:window.pageYOffset||document.documentElement.scrollTop}:{x:a.scrollLeft,y:a.scrollTop}}b.exports=d},{}],156:[function(a,b,c){"use strict";function d(a){return a.replace(e,"-$1").toLowerCase()}var e=/([A-Z])/g;b.exports=d},{}],157:[function(a,b,c){"use strict";function d(a){return e(a).replace(f,"-ms-")}var e=a(156),f=/^ms-/;b.exports=d},{156:156}],158:[function(a,b,c){"use strict";var d=function(a,b,c,d,e,f,g,h){if(!a){var i;if(void 0===b)i=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var j=[c,d,e,f,g,h],k=0;i=new Error("Invariant Violation: "+b.replace(/%s/g,function(){return j[k++]}))}throw i.framesToPop=1,i}};b.exports=d},{}],159:[function(a,b,c){"use strict";function d(a){return!(!a||!("function"==typeof Node?a instanceof Node:"object"==typeof a&&"number"==typeof a.nodeType&&"string"==typeof a.nodeName))}b.exports=d},{}],160:[function(a,b,c){"use strict";function d(a){return e(a)&&3==a.nodeType}var e=a(159);b.exports=d},{159:159}],161:[function(a,b,c){"use strict";function d(a){a||(a="");var b,c=arguments.length;if(c>1)for(var d=1;c>d;d++)b=arguments[d],b&&(a=(a?a+" ":"")+b);return a}b.exports=d},{}],162:[function(a,b,c){"use strict";var d=a(158),e=function(a){var b,c={};a instanceof Object&&!Array.isArray(a)?void 0:d(!1);for(b in a)a.hasOwnProperty(b)&&(c[b]=b);return c};b.exports=e},{158:158}],163:[function(a,b,c){"use strict";var d=function(a){var b;for(b in a)if(a.hasOwnProperty(b))return b;return null};b.exports=d},{}],164:[function(a,b,c){"use strict";function d(a,b,c){if(!a)return null;var d={};for(var f in a)e.call(a,f)&&(d[f]=b.call(c,a[f],f,a));return d}var e=Object.prototype.hasOwnProperty;b.exports=d},{}],165:[function(a,b,c){"use strict";function d(a){var b={};return function(c){return b.hasOwnProperty(c)||(b[c]=a.call(this,c)),b[c]}}b.exports=d},{}],166:[function(a,b,c){"use strict";function d(a,b){if(a===b)return!0;if("object"!=typeof a||null===a||"object"!=typeof b||null===b)return!1;var c=Object.keys(a),d=Object.keys(b);if(c.length!==d.length)return!1;for(var f=e.bind(b),g=0;gf;f++)d[f]=a[f];return d}var e=a(158);b.exports=d},{158:158}],168:[function(a,b,c){"use strict";var d=a(150),e=d;b.exports=e},{150:150}]},{},[1])(1)}); \ No newline at end of file +function _typeof(e){if("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator){_typeof=function(e){return typeof e}}else{_typeof=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e}}return _typeof(e)}!function(n){if("object"==("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module)module.exports=n();else if("function"==typeof define&&define.amd)define ("filter_poodll/react-with-addons",[],n);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.React=n()}}(function(){return function d(p,e,t){function r(o,a){if(!e[o]){if(!p[o]){var i="function"==typeof require&&require;if(!a&&i)return i(o,!0);if(n)return n(o,!0);var s=new Error("Cannot find module '"+o+"'");throw s.code="MODULE_NOT_FOUND",s}var u=e[o]={exports:{}};p[o][0].call(u.exports,function(t){var e=p[o][1][t];return r(e?e:t)},u,u.exports,d,p,e,t)}return e[o].exports}for(var n="function"==typeof require&&require,o=0;o=parseInt(t.version(),10)}function r(t){return(t.ctrlKey||t.altKey||t.metaKey)&&!(t.ctrlKey&&t.altKey)}function I(t){switch(t){case M.topCompositionStart:return N.compositionStart;case M.topCompositionEnd:return N.compositionEnd;case M.topCompositionUpdate:return N.compositionUpdate;}}function a(n,e){return n===M.topKeyDown&&e.keyCode===b}function i(n,e){switch(n){case M.topKeyUp:return-1!==C.indexOf(e.keyCode);case M.topKeyDown:return e.keyCode!==b;case M.topKeyPress:case M.topMouseDown:case M.topBlur:return!0;default:return!1;}}function o(n){var e=n.detail;return"object"==_typeof(e)&&"data"in e?e.data:null}function s(s,e,t,n,r){var u,g;if(E?u=I(s):O?i(s,n)&&(u=N.compositionEnd):a(s,n)&&(u=N.compositionStart),!u)return null;D&&(O||u!==N.compositionStart?u===N.compositionEnd&&O&&(g=O.getData()):O=h.getPooled(e));var y=m.getPooled(u,t,n,r);if(g)y.data=g;else{var p=o(n);null!==p&&(y.data=p)}return f.accumulateTwoPhaseDispatches(y),y}function u(a,e){switch(a){case M.topCompositionEnd:return o(e);case M.topKeyPress:var t=e.which;return t!==P?null:(k=!0,T);case M.topTextInput:var n=e.data;return n===T&&k?null:n;default:return null;}}function l(o,e){if(O){if(o===M.topCompositionEnd||i(o,e)){var t=O.getData();return h.release(O),O=null,t}return null}switch(o){case M.topPaste:return null;case M.topKeyPress:return e.which&&!r(e)?String.fromCharCode(e.which):null;case M.topCompositionEnd:return D?null:e.data;default:return null;}}function p(d,e,t,n,r){var o;if(o=v?u(d,n):l(d,n),!o)return null;var p=g.getPooled(N.beforeInput,t,n,r);return p.data=o,f.accumulateTwoPhaseDispatches(p),p}var d=n(15),f=n(19),c=n(144),h=n(20),m=n(100),g=n(104),y=n(163),C=[9,13,27,32],b=229,E=c.canUseDOM&&"CompositionEvent"in window,_=null;c.canUseDOM&&"documentMode"in document&&(_=document.documentMode);var v=c.canUseDOM&&"TextEvent"in window&&!_&&!t(),D=c.canUseDOM&&(!E||_&&8<_&&11>=_),P=32,T=String.fromCharCode(32),M=d.topLevelTypes,N={beforeInput:{phasedRegistrationNames:{bubbled:y({onBeforeInput:null}),captured:y({onBeforeInputCapture:null})},dependencies:[M.topCompositionEnd,M.topKeyPress,M.topTextInput,M.topPaste]},compositionEnd:{phasedRegistrationNames:{bubbled:y({onCompositionEnd:null}),captured:y({onCompositionEndCapture:null})},dependencies:[M.topBlur,M.topCompositionEnd,M.topKeyDown,M.topKeyPress,M.topKeyUp,M.topMouseDown]},compositionStart:{phasedRegistrationNames:{bubbled:y({onCompositionStart:null}),captured:y({onCompositionStartCapture:null})},dependencies:[M.topBlur,M.topCompositionStart,M.topKeyDown,M.topKeyPress,M.topKeyUp,M.topMouseDown]},compositionUpdate:{phasedRegistrationNames:{bubbled:y({onCompositionUpdate:null}),captured:y({onCompositionUpdateCapture:null})},dependencies:[M.topBlur,M.topCompositionUpdate,M.topKeyDown,M.topKeyPress,M.topKeyUp,M.topMouseDown]}},k=!1,O=null;e.exports={eventTypes:N,extractEvents:function extractEvents(a,e,t,n,r){return[s(a,e,t,n,r),p(a,e,t,n,r)]}}},{100:100,104:104,144:144,15:15,163:163,19:19,20:20}],4:[function(n,e){"use strict";function d(n,e){return n+e.charAt(0).toUpperCase()+e.substring(1)}var r={animationIterationCount:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,stopOpacity:!0,strokeDashoffset:!0,strokeOpacity:!0,strokeWidth:!0},t=["Webkit","ms","Moz","O"];Object.keys(r).forEach(function(n){t.forEach(function(e){r[d(e,n)]=r[n]})});e.exports={isUnitlessNumber:r,shorthandPropertyExpansions:{background:{backgroundAttachment:!0,backgroundColor:!0,backgroundImage:!0,backgroundPositionX:!0,backgroundPositionY:!0,backgroundRepeat:!0},backgroundPosition:{backgroundPositionX:!0,backgroundPositionY:!0},border:{borderWidth:!0,borderStyle:!0,borderColor:!0},borderBottom:{borderBottomWidth:!0,borderBottomStyle:!0,borderBottomColor:!0},borderLeft:{borderLeftWidth:!0,borderLeftStyle:!0,borderLeftColor:!0},borderRight:{borderRightWidth:!0,borderRightStyle:!0,borderRightColor:!0},borderTop:{borderTopWidth:!0,borderTopStyle:!0,borderTopColor:!0},font:{fontStyle:!0,fontVariant:!0,fontWeight:!0,fontSize:!0,lineHeight:!0,fontFamily:!0},outline:{outlineWidth:!0,outlineStyle:!0,outlineColor:!0}}}},{}],5:[function(n,e){"use strict";var t=n(4),r=n(144),o=n(76),m=(n(146),n(116)),a=n(157),i=n(165),s=(n(168),i(function(t){return a(t)})),l=!1,f="cssFloat";if(r.canUseDOM){var u=document.createElement("div").style;try{u.font=""}catch(e){l=!0}void 0===document.documentElement.style.cssFloat&&(f="styleFloat")}var d={createMarkupForStyles:function createMarkupForStyles(o){var e="";for(var a in o){if(o.hasOwnProperty(a)){var n=o[a];null!=n&&(e+=s(a)+":",e+=m(a,n)+";")}}return e||null},setValueForStyles:function setValueForStyles(r,e){var d=r.style;for(var n in e){if(e.hasOwnProperty(n)){var i=m(n,e[n]);if("float"==n&&(n=f),i)d[n]=i;else{var a=l&&t.shorthandPropertyExpansions[n];if(a)for(var p in a){d[p]=""}else d[n]=""}}}}};o.measureMethods(d,"CSSPropertyOperations",{setValueForStyles:"setValueForStyles"}),e.exports=d},{116:116,144:144,146:146,157:157,165:165,168:168,4:4,76:76}],6:[function(n,e){"use strict";function t(){this._callbacks=null,this._contexts=null}var r=n(25),o=n(24),a=n(158);o(t.prototype,{enqueue:function enqueue(n,e){this._callbacks=this._callbacks||[],this._contexts=this._contexts||[],this._callbacks.push(n),this._contexts.push(e)},notifyAll:function notifyAll(){var o=this._callbacks,e=this._contexts;if(o){o.length!==e.length?a(!1):void 0,this._callbacks=null,this._contexts=null;for(var t=0;t=o.childNodes.length?null:o.childNodes.item(t);o.insertBefore(e,n)}var r=n(12),o=n(72),a=n(76),d=n(135),p=n(136),s=n(158),i={dangerouslyReplaceNodeWithMarkup:r.dangerouslyReplaceNodeWithMarkup,updateTextContent:p,processUpdates:function processUpdates(a,e){for(var u,l=null,y=null,C=0;C=c.hasBooleanValue+c.hasNumericValue+c.hasOverloadedBooleanValue?void 0:r(!1),i.hasOwnProperty(l)){var f=i[l];c.attributeName=f}n.hasOwnProperty(l)&&(c.attributeNamespace=n[l]),s.hasOwnProperty(l)&&(c.propertyName=s[l]),u.hasOwnProperty(l)&&(c.mutationMethod=u[l]),g.properties[l]=c}}},a={},g={ID_ATTRIBUTE_NAME:"data-reactid",properties:{},getPossibleStandardName:null,_isCustomAttributeFunctions:[],isCustomAttribute:function isCustomAttribute(o){for(var e=0,r;ee||n.hasOverloadedBooleanValue&&!1===e}var f=n(10),t=n(76),o=n(133),r=(n(168),/^[a-zA-Z_][\w\.\-]*$/),a={},i={},c={createMarkupForID:function createMarkupForID(t){return f.ID_ATTRIBUTE_NAME+"="+o(t)},setAttributeForID:function setAttributeForID(n,e){n.setAttribute(f.ID_ATTRIBUTE_NAME,e)},createMarkupForProperty:function createMarkupForProperty(a,e){var t=f.properties.hasOwnProperty(a)?f.properties[a]:null;if(t){if(m(t,e))return"";var n=t.attributeName;return t.hasBooleanValue||t.hasOverloadedBooleanValue&&!0===e?n+"=\"\"":n+"="+o(e)}return f.isCustomAttribute(a)?null==e?"":a+"="+o(e):null},createMarkupForCustomAttribute:function createMarkupForCustomAttribute(n,e){return d(n)&&null!=e?n+"="+o(e):""},setValueForProperty:function setValueForProperty(o,e,t){var n=f.properties.hasOwnProperty(e)?f.properties[e]:null;if(n){var r=n.mutationMethod;if(r)r(o,t);else if(m(n,t))this.deleteValueForProperty(o,e);else if(n.mustUseAttribute){var a=n.attributeName,d=n.attributeNamespace;d?o.setAttributeNS(d,a,""+t):n.hasBooleanValue||n.hasOverloadedBooleanValue&&!0===t?o.setAttribute(a,""):o.setAttribute(a,""+t)}else{var i=n.propertyName;n.hasSideEffects&&""+o[i]==""+t||(o[i]=t)}}else f.isCustomAttribute(e)&&c.setValueForAttribute(o,e,t)},setValueForAttribute:function setValueForAttribute(o,e,t){d(e)&&(null==t?o.removeAttribute(e):o.setAttribute(e,""+t))},deleteValueForProperty:function deleteValueForProperty(a,e){var t=f.properties.hasOwnProperty(e)?f.properties[e]:null;if(t){var n=t.mutationMethod;if(n)n(a,void 0);else if(t.mustUseAttribute)a.removeAttribute(t.attributeName);else{var r=t.propertyName,o=f.getDefaultValueForProperty(a.nodeName,r);t.hasSideEffects&&""+a[r]===o||(a[r]=o)}}else f.isCustomAttribute(e)&&a.removeAttribute(e)}};t.measureMethods(c,"DOMPropertyOperations",{setValueForProperty:"setValueForProperty",setValueForAttribute:"setValueForAttribute",deleteValueForProperty:"deleteValueForProperty"}),e.exports=c},{10:10,133:133,168:168,76:76}],12:[function(n,e){"use strict";function d(t){return t.substring(1,t.indexOf(" "))}var r=n(144),o=n(149),a=n(150),i=n(154),u=n(158),t=/^(<[^ \/>]+)/;e.exports={dangerouslyRenderMarkup:function dangerouslyRenderMarkup(s){r.canUseDOM?void 0:u(!1);for(var e,l={},n=0;nd&&s[d]===r[d];d++){}var a=n-d;for(p=1;a>=p&&s[n-p]===r[o-p];p++){}var i=1":i+">"+u+""}switch(this._tag){case"input":e.getReactMountReady().enqueue(p,this);case"button":case"select":case"textarea":s.autoFocus&&e.getReactMountReady().enqueue(m.focusDOMComponent,this);}return c},_createOpenTagMarkupAndPutListeners:function _createOpenTagMarkupAndPutListeners(d,e){var t="<"+this._currentElement.type;for(var p in e){if(e.hasOwnProperty(p)){var r=e[p];if(null!=r)if(B.hasOwnProperty(p))r&&u(this._rootNodeID,p,r,d);else{p===K&&(r&&(r=this._previousStyleCopy=I({},e.style)),r=g.createMarkupForStyles(r));var s=null;null!=this._tag&&f(this._tag,e)?p!==j&&(s=C.createMarkupForCustomAttribute(p,r)):s=C.createMarkupForProperty(p,r),s&&(t+=" "+s)}}}if(d.renderToStaticMarkup)return t;var l=C.createMarkupForID(this._rootNodeID);return t+" "+l},_createContentMarkup:function _createContentMarkup(d,e,t){var n="",p=e.dangerouslySetInnerHTML;if(null!=p)null!=p.__html&&(n=p.__html);else{var o=W[_typeof(e.children)]?e.children:null,a=null!=o?null:e.children;if(null!=o)n=O(o);else if(null!=a){var i=this.mountChildren(a,d,t);n=i.join("")}}return G[this._tag]&&"\n"===n.charAt(0)?"\n"+n:n},_createInitialChildren:function _createInitialChildren(d,e,t,n){var r=e.dangerouslySetInnerHTML;if(null!=r)null!=r.__html&&L(n,r.__html);else{var o=W[_typeof(e.children)]?e.children:null,a=null!=o?null:e.children;if(null!=o)U(n,o);else if(null!=a)for(var i=this.mountChildren(a,d,t),p=0;pc){var f=c;c=r,r=f}var i=m(d,r),u=m(d,c);if(i&&u){var s=document.createRange();s.setStart(i.node,i.offset),t.removeAllRanges(),r>c?(t.addRange(s),t.extend(u.node,u.offset)):(s.setEnd(u.node,u.offset),t.addRange(s))}}}var a=n(144),m=n(127),l=n(128),i=a.canUseDOM&&"selection"in document&&!("getSelection"in window),p={getOffsets:i?t:o,setOffsets:i?function(a,e){var t,d,i=document.selection.createRange().duplicate();"undefined"==typeof e.end?(t=e.start,d=t):e.start>e.end?(t=e.end,d=e.start):(t=e.start,d=e.end),i.moveToElementText(a),i.moveStart("character",t),i.setEndPoint("EndToStart",i),i.moveEnd("character",d-t),i.select()}:r};e.exports=p},{127:127,128:128,144:144}],50:[function(n,e){"use strict";var t=n(54),r=n(86),o=n(94);t.inject();var a={renderToString:r.renderToString,renderToStaticMarkup:r.renderToStaticMarkup,version:o};e.exports=a},{54:54,86:86,94:94}],51:[function(n,e){"use strict";var t=n(9),d=n(11),o=n(35),p=n(70),r=n(24),i=n(118),s=n(136),a=(n(141),function(){});r(a.prototype,{construct:function construct(t){this._currentElement=t,this._stringText=""+t,this._rootNodeID=null,this._mountIndex=0},mountComponent:function mountComponent(o,e,t){if(this._rootNodeID=o,e.useCreateElement){var n=t[p.ownerDocumentContextKey],r=n.createElement("span");return d.setAttributeForID(r,o),p.getID(r),s(r,this._stringText),r}var a=i(this._stringText);return e.renderToStaticMarkup?a:""+a+""},receiveComponent:function receiveComponent(r){if(r!==this._currentElement){this._currentElement=r;var e=""+r;if(e!==this._stringText){this._stringText=e;var n=p.getNode(this._rootNodeID);t.updateTextContent(n,e)}}},unmountComponent:function unmountComponent(){o.unmountIDFromEnvironment(this._rootNodeID)}}),e.exports=a},{11:11,118:118,136:136,141:141,24:24,35:35,70:70,9:9}],52:[function(n,e){"use strict";function d(){this._rootNodeID&&t.updateWrapper(this)}function p(r){var e=this._currentElement.props,t=o.executeOnChange(e,r);return a.asap(d,this),t}var o=n(23),r=n(45),a=n(93),i=n(24),s=n(158),t=(n(168),{getNativeProps:function getNativeProps(n,e){null!=e.dangerouslySetInnerHTML?s(!1):void 0;var t=i({},e,{defaultValue:void 0,value:void 0,children:n._wrapperState.initialValue,onChange:n._wrapperState.onChange});return t},mountWrapper:function mountWrapper(a,e){var t=e.defaultValue,d=e.children;null!=d&&(null!=t?s(!1):void 0,Array.isArray(d)&&(1>=d.length?void 0:s(!1),d=d[0]),t=""+d),null==t&&(t="");var u=o.getValue(e);a._wrapperState={initialValue:""+(null!=u?u:t),onChange:p.bind(a)}},updateWrapper:function updateWrapper(a){var e=a._currentElement.props,t=o.getValue(e);null!=t&&r.updatePropertyByID(a._rootNodeID,"value",""+t)}});e.exports=t},{158:158,168:168,23:23,24:24,45:45,93:93}],53:[function(n,e){"use strict";function t(){this.reinitializeTransaction()}var r=n(93),o=n(110),a=n(24),i=n(150),s={initialize:i,close:r.flushBatchedUpdates.bind(r)},u=[s,{initialize:i,close:function close(){p.isBatchingUpdates=!1}}];a(t.prototype,o.Mixin,{getTransactionWrappers:function getTransactionWrappers(){return u}});var l=new t,p={isBatchingUpdates:!1,batchedUpdates:function batchedUpdates(d,e,t,n,r,o){var a=p.isBatchingUpdates;p.isBatchingUpdates=!0,a?d(e,t,n,r,o):l.perform(d,null,e,t,n,r,o)}};e.exports=p},{110:110,150:150,24:24,93:93}],54:[function(n,e){"use strict";function t(){D||(D=!0,m.EventEmitter.injectReactEventListener(v),m.EventPluginHub.injectEventPluginOrder(i),m.EventPluginHub.injectInstanceHandle(g),m.EventPluginHub.injectMount(y),m.EventPluginHub.injectEventPluginsByName({SimpleEventPlugin:_,EnterLeaveEventPlugin:u,ChangeEventPlugin:o,SelectEventPlugin:b,BeforeInputEventPlugin:r}),m.NativeComponent.injectGenericComponentClass(f),m.NativeComponent.injectTextComponentClass(h),m.Class.injectMixin(c),m.DOMProperty.injectDOMPropertyConfig(l),m.DOMProperty.injectDOMPropertyConfig(x),m.EmptyComponent.injectEmptyComponent("noscript"),m.Updates.injectReconcileTransaction(C),m.Updates.injectBatchingStrategy(d),m.RootIndex.injectCreateReactRootIndex(s.canUseDOM?a.createReactRootIndex:E.createReactRootIndex),m.Component.injectEnvironment(p))}var r=n(3),o=n(7),a=n(8),i=n(13),u=n(14),s=n(144),l=n(21),c=n(27),p=n(35),d=n(53),f=n(42),h=n(51),v=n(61),m=n(63),g=n(65),y=n(70),C=n(81),b=n(96),E=n(97),_=n(98),x=n(95),D=!1;e.exports={inject:t}},{13:13,14:14,144:144,21:21,27:27,3:3,35:35,42:42,51:51,53:53,61:61,63:63,65:65,7:7,70:70,8:8,81:81,95:95,96:96,97:97,98:98}],55:[function(n,e){"use strict";var m=n(39),r=n(24),d=(n(114),"function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103),p={key:!0,ref:!0,__self:!0,__source:!0},i=function(a,e,t,n,r,o,i){return{$$typeof:d,type:a,key:e,ref:t,props:i,_owner:o}};i.createElement=function(r,e,t){var n,u={},a=null,g=null,y=null,C=null;if(null!=e){g=void 0===e.ref?null:e.ref,a=void 0===e.key?null:""+e.key,y=void 0===e.__self?null:e.__self,C=void 0===e.__source?null:e.__source;for(n in e){e.hasOwnProperty(n)&&!p.hasOwnProperty(n)&&(u[n]=e[n])}}var b=arguments.length-2;if(1==b)u.children=t;else if(1f;f++){d[f]=arguments[f+2]}u.children=d}if(r&&r.defaultProps){var E=r.defaultProps;for(n in E){"undefined"==typeof u[n]&&(u[n]=E[n])}}return i(r,a,g,y,C,m.current,u)},i.createFactory=function(n){var e=i.createElement.bind(null,n);return e.type=n,e},i.cloneAndReplaceKey=function(o,e){var t=i(o.type,e,o.ref,o._self,o._source,o._owner,o.props);return t},i.cloneAndReplaceProps=function(o,e){var t=i(o.type,o.key,o.ref,o._self,o._source,o._owner,e);return t},i.cloneElement=function(o,e,t){var n,u=r({},o.props),s=o.key,g=o.ref,y=o._self,C=o._source,d=o._owner;if(null!=e){void 0!==e.ref&&(g=e.ref,d=m.current),void 0!==e.key&&(s=""+e.key);for(n in e){e.hasOwnProperty(n)&&!p.hasOwnProperty(n)&&(u[n]=e[n])}}var b=arguments.length-2;if(1==b)u.children=t;else if(1E;E++){h[E]=arguments[E+2]}u.children=h}return i(o.type,s,g,y,C,d,u)},i.isValidElement=function(t){return"object"==_typeof(t)&&null!==t&&t.$$typeof===d},e.exports=i},{114:114,24:24,39:39}],56:[function(n,e){"use strict";function g(){if(l.current){var t=l.current.getName();if(t)return" Check the render method of `"+t+"`."}return""}function y(n,e){n._store&&!n._store.validated&&null==n.key&&(n._store.validated=!0,o("uniqueKey",n,e))}function o(r,e,t){var n=g();if(!n){var d="string"==typeof t?t:t.displayName||t.name;d&&(n=" Check the top-level render call using <"+d+">.")}var a=c[r]||(c[r]={});if(a[n])return null;a[n]=!0;var i={parentOrOwner:n,url:" See https://fb.me/react-warning-keys for more information.",childOwner:null};return e&&e._owner&&e._owner!==l.current&&(i.childOwner=" It was passed a child from "+e._owner.getName()+"."),i}function t(o,e){if("object"==_typeof(o))if(Array.isArray(o))for(var t=0,d;t=d;d++){if(m(a,d)&&m(e,d))n=d;else if(a.charAt(d)!==e.charAt(d))break}var p=a.substr(0,n);return o(p)?void 0:y(!1),p}function l(d,s,m,n,r,o){d=d||"",s=s||"",d===s?y(!1):void 0;var a=g(s,d);a||g(d,s)?void 0:y(!1);for(var l=0,C=a?i:u,b=d;;b=C(b,s)){var E;if(r&&b===d||o&&b===s||(E=m(b,a,n)),!1===E||b===s)break;l++/,i={CHECKSUM_ATTR_NAME:"data-react-checksum",addChecksumToMarkup:function addChecksumToMarkup(n){var e=d(n);return n.replace(r," "+i.CHECKSUM_ATTR_NAME+"=\""+e+"\"$&")},canReuseMarkup:function canReuseMarkup(r,e){var t=e.getAttribute(i.CHECKSUM_ATTR_NAME);t=t&&parseInt(t,10);var a=d(r);return a===t}};e.exports=i},{113:113}],70:[function(n,e){"use strict";function d(o,e){for(var t=Math.min(o.length,e.length),n=0;t>n;n++){if(o.charAt(n)!==e.charAt(n))return n}return o.length===e.length?-1:t}function j(t){return t?t.nodeType===w?t.documentElement:t.firstChild:null}function o(n){var e=j(n);return e&&W.getID(e)}function a(t){return t&&t.getAttribute&&t.getAttribute(k)||""}function r(o,e){if(o){a(o)!==e?R(!1):void 0;var t=W.findReactContainerForID(e);if(t&&N(t,o))return!0}return!1}function i(n){var e=O[n];return e&&r(e,n)?void(V=e):!1}function p(n){V=null,C.traverseAncestors(n,i);var e=V;return V=null,e}function s(d,e,t,n,r,o){h.useCreateElement&&(o=P({},o),t.nodeType===w?o[A]=t:o[A]=t.ownerDocument);var p=x.mountComponent(d,e,n,o);d._renderedComponent._topLevelWrapper=d,W._mountImageIntoNode(p,t,r,n)}function u(d,e,t,n,r){var o=D.ReactReconcileTransaction.getPooled(n);o.perform(s,null,d,e,t,o,n,r),D.ReactReconcileTransaction.release(o)}function l(n,e){for(x.unmountComponent(n),e.nodeType===w&&(e=e.documentElement);e.lastChild;){e.removeChild(e.lastChild)}}function m(n){var e=o(n);return e?e!==C.getReactRootIDFromNodeID(e):!1}function t(d){for(;d&&d.parentNode!==d;d=d.parentNode){if(1===d.nodeType){var i=a(d);if(i){var t,p=C.getReactRootIDFromNodeID(i),r=d;do{if(t=a(r),r=r.parentNode,null==r)return null}while(t!==p);if(r===U[p])return d}}}return null}var c=n(10),f=n(28),h=(n(39),n(44)),y=n(55),g=n(58),C=n(65),b=n(66),E=n(69),_=n(76),x=n(82),v=n(92),D=n(93),P=n(24),T=n(151),N=n(147),M=n(129),R=n(158),S=n(135),I=n(138),k=(n(141),n(168),c.ID_ATTRIBUTE_NAME),O={},w=9,A="__ReactMount_ownerDocument$"+Math.random().toString(36).slice(2),L={},U={},F=[],V=null,B=function(){};B.prototype.isReactComponent={},B.prototype.render=function(){return this.props};var W={TopLevelWrapper:B,_instancesByReactRootID:L,scrollMonitor:function scrollMonitor(n,e){e()},_updateRootComponent:function _updateRootComponent(o,e,t,n){return W.scrollMonitor(t,function(){v.enqueueElementInternal(o,e),n&&v.enqueueCallbackInternal(o,n)}),o},_registerComponent:function _registerComponent(o,e){!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11?R(!1):void 0,f.ensureScrollValueMonitoring();var t=W.registerContainer(e);return L[t]=o,t},_renderNewRootComponent:function _renderNewRootComponent(d,e,t,n){var r=M(d,null),o=W._registerComponent(r,e);return D.batchedUpdates(u,r,o,e,t,n),r},renderSubtreeIntoContainer:function renderSubtreeIntoContainer(o,e,t,n){return null==o||null==o._reactInternalInstance?R(!1):void 0,W._renderSubtreeIntoContainer(o,e,t,n)},_renderSubtreeIntoContainer:function _renderSubtreeIntoContainer(u,e,t,n){y.isValidElement(e)?void 0:R(!1);var r=new y(B,null,null,null,null,null,e),i=L[o(t)];if(i){var s=i._currentElement,l=s.props;if(I(l,e)){var c=i._renderedComponent.getPublicInstance(),p=n&&function(){n.call(c)};return W._updateRootComponent(i,r,t,p),c}W.unmountComponentAtNode(t)}var d=j(t),f=d&&!!a(d),h=m(t),C=W._renderNewRootComponent(r,t,f&&!i&&!h,null!=u?u._reactInternalInstance._processChildContext(u._reactInternalInstance._context):T)._renderedComponent.getPublicInstance();return n&&n.call(C),C},render:function render(o,e,t){return W._renderSubtreeIntoContainer(null,o,e,t)},registerContainer:function registerContainer(n){var e=o(n);return e&&(e=C.getReactRootIDFromNodeID(e)),e||(e=C.createReactRootID()),U[e]=n,e},unmountComponentAtNode:function unmountComponentAtNode(d){!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11?R(!1):void 0;var e=o(d),t=L[e];if(!t){var n=(m(d),a(d));return n&&n===C.getReactRootIDFromNodeID(n),!1}return D.batchedUpdates(l,t,d),delete L[e],delete U[e],!0},findReactContainerForID:function findReactContainerForID(o){var e=C.getReactRootIDFromNodeID(o),t=U[e];return t},findReactNodeByID:function findReactNodeByID(n){var e=W.findReactContainerForID(n);return W.findComponentRoot(e,n)},getFirstReactDOM:function getFirstReactDOM(n){return t(n)},findComponentRoot:function findComponentRoot(d,e){var t=F,n=0,s=p(e)||d;for(t[0]=s.firstChild,t.length=1;n>"}var i=n(55),c=n(78),o=n(150),s=n(126),m="<>",r={array:t("array"),bool:t("boolean"),func:t("function"),number:t("number"),object:t("object"),string:t("string"),any:function(){return a(o.thatReturns(null))}(),arrayOf:function(n){function e(e,t,d,r,o){var a=e[t];if(!Array.isArray(a)){var i=c[r],p=f(a);return new Error("Invalid "+i+" `"+o+"` of type "+("`"+p+"` supplied to `"+d+"`, expected an array."))}for(var s=0,u;st;t++){var p=m[t],r=p._pendingCallbacks;if(p._pendingCallbacks=null,d.performUpdateIfNecessary(p,i.reconcileTransaction),r)for(var o=0;o=document.documentMode,f={select:{phasedRegistrationNames:{bubbled:p({onSelect:null}),captured:p({onSelectCapture:null})},dependencies:[l.topBlur,l.topContextMenu,l.topFocus,l.topKeyDown,l.topMouseDown,l.topMouseUp,l.topSelectionChange]}},m=null,h=null,v=null,P=!1,T=!1,N=p({onSelect:null});e.exports={eventTypes:f,extractEvents:function extractEvents(o,e,t,n,r){if(!T)return null;switch(o){case l.topFocus:(u(e)||"true"===e.contentEditable)&&(m=e,h=t,v=null);break;case l.topBlur:m=null,h=null,v=null;break;case l.topMouseDown:P=!0;break;case l.topContextMenu:case l.topMouseUp:return P=!1,D(n,r);case l.topSelectionChange:if(c)break;case l.topKeyDown:case l.topKeyUp:return D(n,r);}return null},didPutListener:function didPutListener(n,e){e===N&&(T=!0)}}},{102:102,131:131,144:144,15:15,153:153,163:163,166:166,19:19,64:64}],97:[function(n,e){"use strict";var t=Math.pow(2,53);e.exports={createReactRootIndex:function createReactRootIndex(){return Math.ceil(Math.random()*9007199254740992)}}},{}],98:[function(n,e){"use strict";var t=n(15),T=n(143),N=n(19),o=n(70),a=n(99),i=n(102),s=n(103),u=n(105),l=n(106),p=n(101),d=n(107),c=n(108),f=n(109),h=n(150),m=n(122),g=n(158),r=n(163),y=t.topLevelTypes,C={abort:{phasedRegistrationNames:{bubbled:r({onAbort:!0}),captured:r({onAbortCapture:!0})}},blur:{phasedRegistrationNames:{bubbled:r({onBlur:!0}),captured:r({onBlurCapture:!0})}},canPlay:{phasedRegistrationNames:{bubbled:r({onCanPlay:!0}),captured:r({onCanPlayCapture:!0})}},canPlayThrough:{phasedRegistrationNames:{bubbled:r({onCanPlayThrough:!0}),captured:r({onCanPlayThroughCapture:!0})}},click:{phasedRegistrationNames:{bubbled:r({onClick:!0}),captured:r({onClickCapture:!0})}},contextMenu:{phasedRegistrationNames:{bubbled:r({onContextMenu:!0}),captured:r({onContextMenuCapture:!0})}},copy:{phasedRegistrationNames:{bubbled:r({onCopy:!0}),captured:r({onCopyCapture:!0})}},cut:{phasedRegistrationNames:{bubbled:r({onCut:!0}),captured:r({onCutCapture:!0})}},doubleClick:{phasedRegistrationNames:{bubbled:r({onDoubleClick:!0}),captured:r({onDoubleClickCapture:!0})}},drag:{phasedRegistrationNames:{bubbled:r({onDrag:!0}),captured:r({onDragCapture:!0})}},dragEnd:{phasedRegistrationNames:{bubbled:r({onDragEnd:!0}),captured:r({onDragEndCapture:!0})}},dragEnter:{phasedRegistrationNames:{bubbled:r({onDragEnter:!0}),captured:r({onDragEnterCapture:!0})}},dragExit:{phasedRegistrationNames:{bubbled:r({onDragExit:!0}),captured:r({onDragExitCapture:!0})}},dragLeave:{phasedRegistrationNames:{bubbled:r({onDragLeave:!0}),captured:r({onDragLeaveCapture:!0})}},dragOver:{phasedRegistrationNames:{bubbled:r({onDragOver:!0}),captured:r({onDragOverCapture:!0})}},dragStart:{phasedRegistrationNames:{bubbled:r({onDragStart:!0}),captured:r({onDragStartCapture:!0})}},drop:{phasedRegistrationNames:{bubbled:r({onDrop:!0}),captured:r({onDropCapture:!0})}},durationChange:{phasedRegistrationNames:{bubbled:r({onDurationChange:!0}),captured:r({onDurationChangeCapture:!0})}},emptied:{phasedRegistrationNames:{bubbled:r({onEmptied:!0}),captured:r({onEmptiedCapture:!0})}},encrypted:{phasedRegistrationNames:{bubbled:r({onEncrypted:!0}),captured:r({onEncryptedCapture:!0})}},ended:{phasedRegistrationNames:{bubbled:r({onEnded:!0}),captured:r({onEndedCapture:!0})}},error:{phasedRegistrationNames:{bubbled:r({onError:!0}),captured:r({onErrorCapture:!0})}},focus:{phasedRegistrationNames:{bubbled:r({onFocus:!0}),captured:r({onFocusCapture:!0})}},input:{phasedRegistrationNames:{bubbled:r({onInput:!0}),captured:r({onInputCapture:!0})}},keyDown:{phasedRegistrationNames:{bubbled:r({onKeyDown:!0}),captured:r({onKeyDownCapture:!0})}},keyPress:{phasedRegistrationNames:{bubbled:r({onKeyPress:!0}),captured:r({onKeyPressCapture:!0})}},keyUp:{phasedRegistrationNames:{bubbled:r({onKeyUp:!0}),captured:r({onKeyUpCapture:!0})}},load:{phasedRegistrationNames:{bubbled:r({onLoad:!0}),captured:r({onLoadCapture:!0})}},loadedData:{phasedRegistrationNames:{bubbled:r({onLoadedData:!0}),captured:r({onLoadedDataCapture:!0})}},loadedMetadata:{phasedRegistrationNames:{bubbled:r({onLoadedMetadata:!0}),captured:r({onLoadedMetadataCapture:!0})}},loadStart:{phasedRegistrationNames:{bubbled:r({onLoadStart:!0}),captured:r({onLoadStartCapture:!0})}},mouseDown:{phasedRegistrationNames:{bubbled:r({onMouseDown:!0}),captured:r({onMouseDownCapture:!0})}},mouseMove:{phasedRegistrationNames:{bubbled:r({onMouseMove:!0}),captured:r({onMouseMoveCapture:!0})}},mouseOut:{phasedRegistrationNames:{bubbled:r({onMouseOut:!0}),captured:r({onMouseOutCapture:!0})}},mouseOver:{phasedRegistrationNames:{bubbled:r({onMouseOver:!0}),captured:r({onMouseOverCapture:!0})}},mouseUp:{phasedRegistrationNames:{bubbled:r({onMouseUp:!0}),captured:r({onMouseUpCapture:!0})}},paste:{phasedRegistrationNames:{bubbled:r({onPaste:!0}),captured:r({onPasteCapture:!0})}},pause:{phasedRegistrationNames:{bubbled:r({onPause:!0}),captured:r({onPauseCapture:!0})}},play:{phasedRegistrationNames:{bubbled:r({onPlay:!0}),captured:r({onPlayCapture:!0})}},playing:{phasedRegistrationNames:{bubbled:r({onPlaying:!0}),captured:r({onPlayingCapture:!0})}},progress:{phasedRegistrationNames:{bubbled:r({onProgress:!0}),captured:r({onProgressCapture:!0})}},rateChange:{phasedRegistrationNames:{bubbled:r({onRateChange:!0}),captured:r({onRateChangeCapture:!0})}},reset:{phasedRegistrationNames:{bubbled:r({onReset:!0}),captured:r({onResetCapture:!0})}},scroll:{phasedRegistrationNames:{bubbled:r({onScroll:!0}),captured:r({onScrollCapture:!0})}},seeked:{phasedRegistrationNames:{bubbled:r({onSeeked:!0}),captured:r({onSeekedCapture:!0})}},seeking:{phasedRegistrationNames:{bubbled:r({onSeeking:!0}),captured:r({onSeekingCapture:!0})}},stalled:{phasedRegistrationNames:{bubbled:r({onStalled:!0}),captured:r({onStalledCapture:!0})}},submit:{phasedRegistrationNames:{bubbled:r({onSubmit:!0}),captured:r({onSubmitCapture:!0})}},suspend:{phasedRegistrationNames:{bubbled:r({onSuspend:!0}),captured:r({onSuspendCapture:!0})}},timeUpdate:{phasedRegistrationNames:{bubbled:r({onTimeUpdate:!0}),captured:r({onTimeUpdateCapture:!0})}},touchCancel:{phasedRegistrationNames:{bubbled:r({onTouchCancel:!0}),captured:r({onTouchCancelCapture:!0})}},touchEnd:{phasedRegistrationNames:{bubbled:r({onTouchEnd:!0}),captured:r({onTouchEndCapture:!0})}},touchMove:{phasedRegistrationNames:{bubbled:r({onTouchMove:!0}),captured:r({onTouchMoveCapture:!0})}},touchStart:{phasedRegistrationNames:{bubbled:r({onTouchStart:!0}),captured:r({onTouchStartCapture:!0})}},volumeChange:{phasedRegistrationNames:{bubbled:r({onVolumeChange:!0}),captured:r({onVolumeChangeCapture:!0})}},waiting:{phasedRegistrationNames:{bubbled:r({onWaiting:!0}),captured:r({onWaitingCapture:!0})}},wheel:{phasedRegistrationNames:{bubbled:r({onWheel:!0}),captured:r({onWheelCapture:!0})}}},b={topAbort:C.abort,topBlur:C.blur,topCanPlay:C.canPlay,topCanPlayThrough:C.canPlayThrough,topClick:C.click,topContextMenu:C.contextMenu,topCopy:C.copy,topCut:C.cut,topDoubleClick:C.doubleClick,topDrag:C.drag,topDragEnd:C.dragEnd,topDragEnter:C.dragEnter,topDragExit:C.dragExit,topDragLeave:C.dragLeave,topDragOver:C.dragOver,topDragStart:C.dragStart,topDrop:C.drop,topDurationChange:C.durationChange,topEmptied:C.emptied,topEncrypted:C.encrypted,topEnded:C.ended,topError:C.error,topFocus:C.focus,topInput:C.input,topKeyDown:C.keyDown,topKeyPress:C.keyPress,topKeyUp:C.keyUp,topLoad:C.load,topLoadedData:C.loadedData,topLoadedMetadata:C.loadedMetadata,topLoadStart:C.loadStart,topMouseDown:C.mouseDown,topMouseMove:C.mouseMove,topMouseOut:C.mouseOut,topMouseOver:C.mouseOver,topMouseUp:C.mouseUp,topPaste:C.paste,topPause:C.pause,topPlay:C.play,topPlaying:C.playing,topProgress:C.progress,topRateChange:C.rateChange,topReset:C.reset,topScroll:C.scroll,topSeeked:C.seeked,topSeeking:C.seeking,topStalled:C.stalled,topSubmit:C.submit,topSuspend:C.suspend,topTimeUpdate:C.timeUpdate,topTouchCancel:C.touchCancel,topTouchEnd:C.touchEnd,topTouchMove:C.touchMove,topTouchStart:C.touchStart,topVolumeChange:C.volumeChange,topWaiting:C.waiting,topWheel:C.wheel};for(var E in b){b[E].dependencies=[E]}var _=r({onClick:null}),x={};e.exports={eventTypes:C,extractEvents:function extractEvents(h,e,t,n,r){var o=b[h];if(!o)return null;var E;switch(h){case y.topAbort:case y.topCanPlay:case y.topCanPlayThrough:case y.topDurationChange:case y.topEmptied:case y.topEncrypted:case y.topEnded:case y.topError:case y.topInput:case y.topLoad:case y.topLoadedData:case y.topLoadedMetadata:case y.topLoadStart:case y.topPause:case y.topPlay:case y.topPlaying:case y.topProgress:case y.topRateChange:case y.topReset:case y.topSeeked:case y.topSeeking:case y.topStalled:case y.topSubmit:case y.topSuspend:case y.topTimeUpdate:case y.topVolumeChange:case y.topWaiting:E=i;break;case y.topKeyPress:if(0===m(n))return null;case y.topKeyDown:case y.topKeyUp:E=u;break;case y.topBlur:case y.topFocus:E=s;break;case y.topClick:if(2===n.button)return null;case y.topContextMenu:case y.topDoubleClick:case y.topMouseDown:case y.topMouseMove:case y.topMouseOut:case y.topMouseOver:case y.topMouseUp:E=l;break;case y.topDrag:case y.topDragEnd:case y.topDragEnter:case y.topDragExit:case y.topDragLeave:case y.topDragOver:case y.topDragStart:case y.topDrop:E=p;break;case y.topTouchCancel:case y.topTouchEnd:case y.topTouchMove:case y.topTouchStart:E=d;break;case y.topScroll:E=c;break;case y.topWheel:E=f;break;case y.topCopy:case y.topCut:case y.topPaste:E=a;}E?void 0:g(!1);var _=E.getPooled(o,t,n,r);return N.accumulateTwoPhaseDispatches(_),_},didPutListener:function didPutListener(n,e){if(e===_){var t=o.getNode(n);x[n]||(x[n]=T.listen(t,"click",h))}},willDeleteListener:function willDeleteListener(n,e){e===_&&(x[n].remove(),delete x[n])}}},{101:101,102:102,103:103,105:105,106:106,107:107,108:108,109:109,122:122,143:143,15:15,150:150,158:158,163:163,19:19,70:70,99:99}],99:[function(n,e){"use strict";function t(o,e,t,n){a.call(this,o,e,t,n)}var a=n(102);a.augmentClass(t,{clipboardData:function clipboardData(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),e.exports=t},{102:102}],100:[function(n,e){"use strict";function t(o,e,t,n){a.call(this,o,e,t,n)}var a=n(102);a.augmentClass(t,{data:null}),e.exports=t},{102:102}],101:[function(n,e){"use strict";function t(o,e,t,n){a.call(this,o,e,t,n)}var a=n(106);a.augmentClass(t,{dataTransfer:null}),e.exports=t},{106:106}],102:[function(n,e){"use strict";function t(d,e,t,n){this.dispatchConfig=d,this.dispatchMarker=e,this.nativeEvent=t,this.target=n,this.currentTarget=n;var r=this.constructor.Interface;for(var o in r){if(r.hasOwnProperty(o)){var a=r[o];a?this[o]=a(t):this[o]=t[o]}}var i=null!=t.defaultPrevented?t.defaultPrevented:!1===t.returnValue;i?this.isDefaultPrevented=p.thatReturnsTrue:this.isDefaultPrevented=p.thatReturnsFalse,this.isPropagationStopped=p.thatReturnsFalse}var d=n(25),o=n(24),p=n(150),r=(n(168),{type:null,currentTarget:p.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function timeStamp(t){return t.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null});o(t.prototype,{preventDefault:function preventDefault(){this.defaultPrevented=!0;var t=this.nativeEvent;t&&(t.preventDefault?t.preventDefault():t.returnValue=!1,this.isDefaultPrevented=p.thatReturnsTrue)},stopPropagation:function stopPropagation(){var t=this.nativeEvent;t&&(t.stopPropagation?t.stopPropagation():t.cancelBubble=!0,this.isPropagationStopped=p.thatReturnsTrue)},persist:function persist(){this.isPersistent=p.thatReturnsTrue},isPersistent:p.thatReturnsFalse,destructor:function destructor(){var n=this.constructor.Interface;for(var e in n){this[e]=null}this.dispatchConfig=null,this.dispatchMarker=null,this.nativeEvent=null}}),t.Interface=r,t.augmentClass=function(a,e){var t=this,n=Object.create(t.prototype);o(n,a.prototype),a.prototype=n,a.prototype.constructor=a,a.Interface=o({},t.Interface,e),a.augmentClass=t.augmentClass,d.addPoolingTo(a,d.fourArgumentPooler)},d.addPoolingTo(t,d.fourArgumentPooler),e.exports=t},{150:150,168:168,24:24,25:25}],103:[function(n,e){"use strict";function t(o,e,t,n){a.call(this,o,e,t,n)}var a=n(108);a.augmentClass(t,{relatedTarget:null}),e.exports=t},{108:108}],104:[function(n,e){"use strict";function t(o,e,t,n){a.call(this,o,e,t,n)}var a=n(102);a.augmentClass(t,{data:null}),e.exports=t},{102:102}],105:[function(n,e){"use strict";function t(o,e,t,n){d.call(this,o,e,t,n)}var d=n(108),o=n(122),r=n(123),a=n(124);d.augmentClass(t,{key:r,location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:a,charCode:function charCode(t){return"keypress"===t.type?o(t):0},keyCode:function keyCode(t){return"keydown"===t.type||"keyup"===t.type?t.keyCode:0},which:function which(t){return"keypress"===t.type?o(t):"keydown"===t.type||"keyup"===t.type?t.keyCode:0}}),e.exports=t},{108:108,122:122,123:123,124:124}],106:[function(n,e){"use strict";function t(o,e,t,n){d.call(this,o,e,t,n)}var d=n(108),o=n(111),r=n(124);d.augmentClass(t,{screenX:null,screenY:null,clientX:null,clientY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:r,button:function button(n){var e=n.button;return"which"in n?e:2===e?2:4===e?1:0},buttons:null,relatedTarget:function relatedTarget(t){return t.relatedTarget||(t.fromElement===t.srcElement?t.toElement:t.fromElement)},pageX:function pageX(t){return"pageX"in t?t.pageX:t.clientX+o.currentScrollLeft},pageY:function pageY(t){return"pageY"in t?t.pageY:t.clientY+o.currentScrollTop}}),e.exports=t},{108:108,111:111,124:124}],107:[function(n,e){"use strict";function t(o,e,t,n){d.call(this,o,e,t,n)}var d=n(108),o=n(124);d.augmentClass(t,{touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:o}),e.exports=t},{108:108,124:124}],108:[function(n,e){"use strict";function t(o,e,t,n){d.call(this,o,e,t,n)}var d=n(102),o=n(125);d.augmentClass(t,{view:function view(r){if(r.view)return r.view;var e=o(r);if(null!=e&&e.window===e)return e;var t=e.ownerDocument;return t?t.defaultView||t.parentWindow:window},detail:function detail(t){return t.detail||0}}),e.exports=t},{102:102,125:125}],109:[function(n,e){"use strict";function t(o,e,t,n){a.call(this,o,e,t,n)}var a=n(106);a.augmentClass(t,{deltaX:function deltaX(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function deltaY(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:null,deltaMode:null}),e.exports=t},{106:106}],110:[function(n,e){"use strict";var d=n(158),t={Mixin:{reinitializeTransaction:function reinitializeTransaction(){this.transactionWrappers=this.getTransactionWrappers(),this.wrapperInitData?this.wrapperInitData.length=0:this.wrapperInitData=[],this._isInTransaction=!1},_isInTransaction:!1,getTransactionWrappers:null,isInTransaction:function isInTransaction(){return!!this._isInTransaction},perform:function perform(r,e,t,n,o,a,i,p){this.isInTransaction()?d(!1):void 0;var s,u;try{this._isInTransaction=!0,s=!0,this.initializeAll(0),u=r.call(e,t,n,o,a,i,p),s=!1}finally{try{if(s)try{this.closeAll(0)}catch(e){}else this.closeAll(0)}finally{this._isInTransaction=!1}}return u},initializeAll:function initializeAll(o){for(var e=this.transactionWrappers,a=o,d;as;){for(;ss;s++){p+=e+=o.charCodeAt(s)}return e%=d,p%=d,e|p<<16}var d=65521;e.exports=t},{}],114:[function(n,e){"use strict";e.exports=!1},{}],115:[function(n,e){"use strict";var r=n(55),o=n(77),t=n(163),a=(n(168),t({children:null}));e.exports=function(d,e){var t=o.mergeProps(e,d.props);return!t.hasOwnProperty(a)&&d.props.hasOwnProperty(a)&&(t.children=d.props.children),r.createElement(d.type,t)}},{163:163,168:168,55:55,77:77}],116:[function(n,e){"use strict";function t(a,e){var d=null==e||"boolean"==typeof e||""===e;if(d)return"";var n=isNaN(e);return n||0===e||o.hasOwnProperty(a)&&o[a]?""+e:("string"==typeof e&&(e=e.trim()),e+"px")}var r=n(4),o=r.isUnitlessNumber;e.exports=t},{4:4}],117:[function(n,e){"use strict";function t(a,e,t,n,r){return r}n(24),n(168);e.exports=t},{168:168,24:24}],118:[function(n,e){"use strict";function t(t){return o[t]}var o={"&":"&",">":">","<":"<",'"':""","'":"'"},r=/[&><"']/g;e.exports=function(n){return(""+n).replace(r,t)}},{}],119:[function(n,e){"use strict";var t=(n(39),n(66)),o=n(70),r=n(158);n(168);e.exports=function(n){return null==n?null:1===n.nodeType?n:t.has(n)?o.getNodeFromInstance(n):(null!=n.render&&"function"==typeof n.render?r(!1):void 0,void r(!1))}},{158:158,168:168,39:39,66:66,70:70}],120:[function(n,e){"use strict";function o(a,e,t){var n=a,r=void 0===n[t];r&&null!=e&&(n[t]=e)}var r=n(139);n(168);e.exports=function(n){if(null==n)return n;var e={};return r(n,o,e),e}},{139:139,168:168}],121:[function(n,e){"use strict";e.exports=function r(o,e,t){Array.isArray(o)?o.forEach(e,t):o&&e.call(t,o)}},{}],122:[function(n,e){"use strict";function t(o){var e,r=o.keyCode;return"charCode"in o?(e=o.charCode,0===e&&13===r&&(e=13)):e=r,32<=e||13===e?e:0}e.exports=t},{}],123:[function(n,e){"use strict";var t=n(122),o={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},r={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"};e.exports=function(a){if(a.key){var e=o[a.key]||a.key;if("Unidentified"!==e)return e}if("keypress"===a.type){var d=t(a);return 13===d?"Enter":String.fromCharCode(d)}return"keydown"===a.type||"keyup"===a.type?r[a.keyCode]||"Unidentified":""}},{122:122}],124:[function(n,e){"use strict";function t(a){var e=this,t=e.nativeEvent;if(t.getModifierState)return t.getModifierState(a);var n=o[a];return n?!!t[n]:!1}var o={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};e.exports=function(){return t}},{}],125:[function(n,e){"use strict";e.exports=function(n){var e=n.target||n.srcElement||window;return 3===e.nodeType?e.parentNode:e}},{}],126:[function(n,e){"use strict";var r="function"==typeof Symbol&&Symbol.iterator;e.exports=function(n){var e=n&&(r&&n[r]||n["@@iterator"]);return"function"==typeof e?e:void 0}},{}],127:[function(n,e){"use strict";function d(t){for(;t&&t.firstChild;){t=t.firstChild}return t}function r(t){for(;t;){if(t.nextSibling)return t.nextSibling;t=t.parentNode}}function t(o,e){for(var t=d(o),p=0,s=0;t;){if(3===t.nodeType){if(s=p+t.textContent.length,e>=p&&s>=e)return{node:t,offset:e-p};p=s}t=d(r(t))}}e.exports=t},{}],128:[function(n,e){"use strict";function t(){return!o&&r.canUseDOM&&(o="textContent"in document.documentElement?"textContent":"innerText"),o}var r=n(144),o=null;e.exports=t},{144:144}],129:[function(n,e){"use strict";function t(t){return"function"==typeof t&&"undefined"!=typeof t.prototype&&"function"==typeof t.prototype.mountComponent&&"function"==typeof t.prototype.receiveComponent}function r(o){var e;if(null===o||!1===o)e=new a(r);else if("object"==_typeof(o)){var i=o;!i||"function"!=typeof i.type&&"string"!=typeof i.type?p(!1):void 0,e="string"==typeof i.type?d.createInternalComponent(i):t(i.type)?new i.type(i):new s}else"string"==typeof o||"number"==typeof o?e=d.createInstanceForText(o):p(!1);return e.construct(o),e._mountIndex=0,e._mountImage=null,e}var o=n(38),a=n(57),d=n(73),i=n(24),p=n(158),s=(n(168),function(){});i(s.prototype,o.Mixin,{_instantiateReactComponent:r}),e.exports=r},{158:158,168:168,24:24,38:38,57:57,73:73}],130:[function(n,e){"use strict";function t(o,e){if(!p.canUseDOM||e&&!("addEventListener"in document))return!1;var t="on"+o,n=t in document;if(!n){var a=document.createElement("div");a.setAttribute(t,"return;"),n="function"==typeof a[t]}return!n&&d&&"wheel"===o&&(n=document.implementation.hasFeature("Events.wheel","3.0")),n}var d,p=n(144);p.canUseDOM&&(d=document.implementation&&document.implementation.hasFeature&&!0!==document.implementation.hasFeature("","")),e.exports=t},{144:144}],131:[function(n,e){"use strict";var r={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};e.exports=function(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e&&("input"===e&&r[n.type]||"textarea"===e)}},{}],132:[function(n,e){"use strict";var t=n(55),o=n(158);e.exports=function(n){return t.isValidElement(n)?void 0:o(!1),n}},{158:158,55:55}],133:[function(n,e){"use strict";var t=n(118);e.exports=function(n){return"\""+t(n)+"\""}},{118:118}],134:[function(n,e){"use strict";var t=n(70);e.exports=t.renderSubtreeIntoContainer},{70:70}],135:[function(n,e){"use strict";var t=n(144),r=/^[ \r\n\t\f]/,o=/<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/,a=function(n,e){n.innerHTML=e};if("undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction&&(a=function(n,e){MSApp.execUnsafeLocalFunction(function(){n.innerHTML=e})}),t.canUseDOM){var d=document.createElement("div");d.innerHTML=" ",""===d.innerHTML&&(a=function(a,e){if(a.parentNode&&a.parentNode.replaceChild(a,a),r.test(e)||"<"===e[0]&&o.test(e)){a.innerHTML=String.fromCharCode(65279)+e;var t=a.firstChild;1===t.data.length?a.removeChild(t):t.deleteData(0,1)}else a.innerHTML=e})}e.exports=a},{144:144}],136:[function(n,e){"use strict";var t=n(144),r=n(118),o=n(135),a=function(n,e){n.textContent=e};t.canUseDOM&&("textContent"in document.documentElement||(a=function(n,e){o(n,r(e))})),e.exports=a},{118:118,135:135,144:144}],137:[function(n,e){"use strict";var r=n(166);e.exports=function(o,e,t){return!r(o.props,e)||!r(o.state,t)}},{166:166}],138:[function(n,e){"use strict";function t(d,e){var t=null===d||!1===d,n=null===e||!1===e;if(t||n)return t==n;var r=_typeof(d),o=_typeof(e);return"string"===r||"number"===r?"string"===o||"number"===o:"object"===o&&d.type===e.type&&d.key===e.key}e.exports=t},{}],139:[function(n,e){"use strict";function t(t){return s[t]}function x(n,e){return n&&null!=n.key?a(n.key):e.toString(36)}function o(n){return(""+n).replace(c,t)}function a(t){return"$"+o(t)}function i(o,h,t,n){var r=_typeof(o);if(("undefined"===r||"boolean"===r)&&(o=null),null===o||"string"===r||"number"===r||u.isValidElement(o))return t(n,o,""===h?d+x(o,0):h),1;var D,P,T=0,N=""===h?d:h+f;if(Array.isArray(o))for(var m=0;m",""],s=[1,"","
"],u=[3,"","
"],l=[1,"",""],p={"*":[1,"?
","
"],area:[1,"",""],col:[2,"","
"],legend:[1,"
","
"],param:[1,"",""],tr:[2,"","
"],optgroup:i,option:i,caption:s,colgroup:s,tbody:s,tfoot:s,thead:s,td:u,th:u};["circle","clipPath","defs","ellipse","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","text","tspan"].forEach(function(t){p[t]=l,a[t]=!0}),e.exports=function(t){return r?void 0:o(!1),p.hasOwnProperty(t)||(t="*"),a.hasOwnProperty(t)||("*"===t?r.innerHTML="":r.innerHTML="<"+t+">",a[t]=!r.firstChild),a[t]?p[t]:null}},{144:144,158:158}],155:[function(n,e){"use strict";e.exports=function(t){return t===window?{x:window.pageXOffset||document.documentElement.scrollLeft,y:window.pageYOffset||document.documentElement.scrollTop}:{x:t.scrollLeft,y:t.scrollTop}}},{}],156:[function(n,e){"use strict";var t=/([A-Z])/g;e.exports=function(n){return n.replace(t,"-$1").toLowerCase()}},{}],157:[function(n,e){"use strict";var t=n(156),o=/^ms-/;e.exports=function(n){return t(n).replace(o,"-ms-")}},{156:156}],158:[function(n,e){"use strict";e.exports=function r(r,e,t,n,d,o,a,i){if(!r){var p;if(void 0===e)p=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var u=[t,n,d,o,a,i],l=0;p=new Error("Invariant Violation: "+e.replace(/%s/g,function(){return u[l++]}))}throw p.framesToPop=1,p}}},{}],159:[function(n,e){"use strict";function t(t){return!(!t||!("function"==typeof Node?t instanceof Node:"object"==_typeof(t)&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName))}e.exports=t},{}],160:[function(n,e){"use strict";var t=n(159);e.exports=function(n){return t(n)&&3==n.nodeType}},{159:159}],161:[function(n,e){"use strict";function t(o){o||(o="");var a,d=arguments.length;if(1n;n++){a=arguments[n],a&&(o=(o?o+" ":"")+a)}return o}e.exports=t},{}],162:[function(n,e){"use strict";var o=n(158);e.exports=function o(r){var e,a={};r instanceof Object&&!Array.isArray(r)?void 0:o(!1);for(e in r){r.hasOwnProperty(e)&&(a[e]=e)}return a}},{158:158}],163:[function(n,e){"use strict";e.exports=function r(n){for(var e in n){if(n.hasOwnProperty(e))return e}return null}},{}],164:[function(n,e){"use strict";function t(o,e,t){if(!o)return null;var n={};for(var r in o){d.call(o,r)&&(n[r]=e.call(t,o[r],r,o))}return n}var d=Object.prototype.hasOwnProperty;e.exports=t},{}],165:[function(n,e){"use strict";e.exports=function(o){var e={};return function(t){return e.hasOwnProperty(t)||(e[t]=o.call(this,t)),e[t]}}},{}],166:[function(n,e){"use strict";function t(o,e){if(o===e)return!0;if("object"!=_typeof(o)||null===o||"object"!=_typeof(e)||null===e)return!1;var t=Object.keys(o),n=Object.keys(e);if(t.length!==n.length)return!1;for(var d=r.bind(e),a=0;ao;o++){t[o]=n[o]}return t}var d=n(158);e.exports=t},{158:158}],168:[function(n,e){"use strict";var t=n(150);e.exports=t},{150:150}]},{},[1])(1)}); +//# sourceMappingURL=react-with-addons.min.js.map diff --git a/amd/build/react_amd.min.js b/amd/build/react_amd.min.js index 4e2b7700..68f9cffa 100644 --- a/amd/build/react_amd.min.js +++ b/amd/build/react_amd.min.js @@ -1 +1,2 @@ -define(["jquery","core/log","filter_poodll/react-with-addons"],function(a,b,c){"use strict";return b.debug("Filter PoodLL: revealjs initialising"),window.React=c,{}}); \ No newline at end of file +define ("filter_poodll/react_amd",["jquery","core/log","filter_poodll/react-with-addons"],function(a,b,c){"use strict";b.debug("Filter PoodLL: revealjs initialising");window.React=c;return{}}); +//# sourceMappingURL=react_amd.min.js.map diff --git a/amd/build/responsiveiframe.min.js b/amd/build/responsiveiframe.min.js index 9e6ae0de..b1916087 100644 --- a/amd/build/responsiveiframe.min.js +++ b/amd/build/responsiveiframe.min.js @@ -1 +1,2 @@ -define(["jquery","core/log"],function(a,b){"use strict";return b.debug("responsive iframe initialising"),{defheight:150,defwidth:300,init:function(b){var c=a("#"+b.iframeid);if(0==c.length&&(c=a("#"+b.iframeid,window.parent.document)),c.length>0){var d={currentheight:this.defheight,currentwidth:this.defwidth,theiframe:c,thisref:this};this._iframeResize(d)}},_iframeResize:function(a){var b=a.theiframe;if(b&&!(b.length<1)){var c=b[0].contentWindow.document.body.scrollHeight,d=b[0].contentWindow.document.body.scrollWidth;c==a.currentheight&&d==a.currentwidth||(b.attr("height",c+"px"),b.attr("width",d+"px")),a.currentheight=c,a.currentwidth=d,setTimeout(a.thisref._iframeResize,100,a)}}}}); \ No newline at end of file +define ("filter_poodll/responsiveiframe",["jquery","core/log"],function(a,b){"use strict";b.debug("responsive iframe initialising");return{defheight:150,defwidth:300,init:function init(b){var c=a("#"+b.iframeid);if(0==c.length){c=a("#"+b.iframeid,window.parent.document)}if(0b.length){return}var c=b[0].contentWindow.document.body.scrollHeight,d=b[0].contentWindow.document.body.scrollWidth;if(c!=a.currentheight||d!=a.currentwidth){b.attr("height",c+"px");b.attr("width",d+"px")}a.currentheight=c;a.currentwidth=d;setTimeout(a.thisref._iframeResize,100,a)}}}); +//# sourceMappingURL=responsiveiframe.min.js.map diff --git a/amd/build/speech_browser.min.js b/amd/build/speech_browser.min.js index 0a60d37d..98c73994 100644 --- a/amd/build/speech_browser.min.js +++ b/amd/build/speech_browser.min.js @@ -1 +1,2 @@ -define(["jquery","core/log"],function(a,b){"use strict";return b.debug("speech_browser: initialising"),{recognition:null,recognizing:!1,ignore_onend:!1,final_transcript:"",start_timestamp:0,lang:"en-US",clone:function(){return a.extend(!0,{},this)},init:function(a){var b=b||webkitSpeechRecognition;this.recognition=new b,this.recognition.continuous=!0,this.recognition.interimResults=!0,this.lang=a?a:"en-US",this.register_events()},set_grammar:function(a){var b=b||webkitSpeechGrammarList;if(b){var c=new b;c.addFromString(a,1),this.recognition.grammars=c}},start:function(){this.recognizing||(this.recognizing=!0,this.final_transcript="",this.recognition.lang=this.lang,this.recognition.start(),this.ignore_onend=!1,this.start_timestamp=Date.now())},stop:function(){this.recognizing=!1,this.recognition.stop()},register_events:function(){var a=this.recognition,c=this;a.onstart=function(){c.recognizing=!0},a.onerror=function(a){"no-speech"==a.error&&(b.debug("info_no_speech"),c.ignore_onend=!0),"audio-capture"==a.error&&(b.debug("info_no_microphone"),c.ignore_onend=!0),"not-allowed"==a.error&&(a.timeStamp-c.start_timestamp<100?b.debug("info_blocked"):b.debug("info_denied"),c.ignore_onend=!0)},a.onend=function(){0!=c.recognizing&&(c.ignore_onend?c.recognizing=!1:a.start())},a.onresult=function(a){for(var b="",d=a.resultIndex;da.timeStamp-c.start_timestamp){b.debug("info_blocked")}else{b.debug("info_denied")}c.ignore_onend=!0}};a.onend=function(){if(!1==c.recognizing){return}if(c.ignore_onend){c.recognizing=!1}else{a.start()}};a.onresult=function(a){for(var b="",d=a.resultIndex;dthis.csslinks.indexOf(b.CSSLINK)){this.csslinks.push(b.CSSLINK);this.injectcss(b.CSSLINK)}}if(b.CSSUPLOAD){if(0>this.csslinks.indexOf(b.CSSUPLOAD)){this.csslinks.push(b.CSSUPLOAD);this.injectcss(b.CSSUPLOAD)}}if(b.CSSCUSTOM){if(0>this.csslinks.indexOf(b.CSSCUSTOM)){this.csslinks.push(b.CSSCUSTOM);this.injectcss(b.CSSCUSTOM)}}if("undefined"!=typeof b.TEMPLATEID){require(["filter_poodll_d"+b.TEMPLATEID],function(a){a(b)})}}}}); +//# sourceMappingURL=template_amd.min.js.map diff --git a/amd/build/template_presets_amd.min.js b/amd/build/template_presets_amd.min.js index be588369..582dd248 100644 --- a/amd/build/template_presets_amd.min.js +++ b/amd/build/template_presets_amd.min.js @@ -1 +1,2 @@ -define(["jquery","core/log"],function(a,b){"use strict";return b.debug("Filter Poodll Presets initialising"),{presetdata:!1,dataitems:["name","key","version","instructions","showatto","showplayers","requirecss","requirejs","shim","defaults","amd","body","bodyend","script","style","dataset","datasetvars","alternate","alternateend"],fetchcontrols:function(a){var b={};return b.name=document.getElementById("id_s_filter_poodll_templatename_"+a),b.key=document.getElementById("id_s_filter_poodll_templatekey_"+a),b.version=document.getElementById("id_s_filter_poodll_templateversion_"+a),b.instructions=document.getElementById("id_s_filter_poodll_templateinstructions_"+a),b.showatto=document.getElementById("id_s_filter_poodll_template_showatto_"+a),b.showplayers=document.getElementById("id_s_filter_poodll_template_showplayers_"+a),b.requirecss=document.getElementById("id_s_filter_poodll_templaterequire_css_"+a),b.requirejs=document.getElementById("id_s_filter_poodll_templaterequire_js_"+a),b.shim=document.getElementById("id_s_filter_poodll_templaterequire_js_shim_"+a),b.defaults=document.getElementById("id_s_filter_poodll_templatedefaults_"+a),b.amd=document.getElementById("id_s_filter_poodll_template_amd_"+a),b.body=document.getElementById("id_s_filter_poodll_template_"+a),b.bodyend=document.getElementById("id_s_filter_poodll_templateend_"+a),b.script=document.getElementById("id_s_filter_poodll_templatescript_"+a),b.style=document.getElementById("id_s_filter_poodll_templatestyle_"+a),b.dataset=document.getElementById("id_s_filter_poodll_dataset_"+a),b.datasetvars=document.getElementById("id_s_filter_poodll_datasetvars_"+a),b.alternate=document.getElementById("id_s_filter_poodll_templatealternate_"+a),b.alternateend=document.getElementById("id_s_filter_poodll_templatealternate_end_"+a),b.presetdata=document.getElementById("id_s_filter_poodll_presetdata_"+a),b},fetchjsonbundle:function(b,c){var d={};a.each(this.dataitems,function(a,b){d[b]=c[b].value});var e=JSON.stringify(d);return e},exportbundle:function(a){var b=this.fetchcontrols(a);if(""!=b.key.value){var c=this.fetchjsonbundle(a,b),d=document.createElement("a");if(d.setAttribute("href","data:text/json;charset=utf-8,"+encodeURIComponent(c)),d.setAttribute("download",b.key.value+".txt"),document.createEvent){var e=document.createEvent("MouseEvents");e.initEvent("click",!0,!0),d.dispatchEvent(e)}else d.click()}},populateform:function(b,c,d){var e=this.fetchcontrols(b);(c||d)&&(0==c&&d||(d=this.presetdata),a.each(this.dataitems,function(a,b){if(d[c].hasOwnProperty(b)){if("cleartemplate"!=d[c].key||"key"!=b&&"name"!=b)var f=d[c][b];else var f="";e[b].value=f}else switch(b){case"amd":case"showplayers":case"showatto":e[b].value=0;break;default:e[b].value=""}}))},dopopulate:function(a,b){this.populateform(a,0,new Array(b))},init:function(b){if(!this.presetdata){var c="#id_s_filter_poodll_presetdata_"+b.templateindex,d=a(c).get(0);this.presetdata=JSON.parse(d.value),a(c).remove()}var e=this;a("select[name='filter_poodll/presets']").change(function(){e.populateform(b.templateindex,a(this).val())});var f="#id_s_filter_poodll_dragdropsquare_"+b.templateindex;a(f).on("click",function(){e.exportbundle(b.templateindex)}),a(f).on("dragover",function(b){b.preventDefault(),b.stopPropagation(),a(this).addClass("filter_poodll_dragging")}),a(f).on("dragleave",function(b){b.preventDefault(),b.stopPropagation(),a(this).removeClass("filter_poodll_dragging")}),a(f).on("drop",function(c){c.preventDefault();var d=c.originalEvent.dataTransfer.files;if(d.length){var f=d[0];if(f){var g=new FileReader;g.onload=function(a){var c=a.target.result,d=JSON.parse(c);d.key&&e.dopopulate(b.templateindex,d)},g.readAsText(f)}else alert("Failed to load file")}a(this).removeClass("filter_poodll_dragging")})}}}); \ No newline at end of file +define ("filter_poodll/template_presets_amd",["jquery","core/log"],function(a,b){"use strict";b.debug("Filter Poodll Presets initialising");return{presetdata:!1,dataitems:["name","key","version","instructions","showatto","showplayers","requirecss","requirejs","shim","defaults","amd","body","bodyend","script","style","dataset","datasetvars","alternate","alternateend"],fetchcontrols:function fetchcontrols(a){var b={name:document.getElementById("id_s_filter_poodll_templatename_"+a),key:document.getElementById("id_s_filter_poodll_templatekey_"+a),version:document.getElementById("id_s_filter_poodll_templateversion_"+a),instructions:document.getElementById("id_s_filter_poodll_templateinstructions_"+a),showatto:document.getElementById("id_s_filter_poodll_template_showatto_"+a),showplayers:document.getElementById("id_s_filter_poodll_template_showplayers_"+a),requirecss:document.getElementById("id_s_filter_poodll_templaterequire_css_"+a),requirejs:document.getElementById("id_s_filter_poodll_templaterequire_js_"+a),shim:document.getElementById("id_s_filter_poodll_templaterequire_js_shim_"+a),defaults:document.getElementById("id_s_filter_poodll_templatedefaults_"+a),amd:document.getElementById("id_s_filter_poodll_template_amd_"+a),body:document.getElementById("id_s_filter_poodll_template_"+a),bodyend:document.getElementById("id_s_filter_poodll_templateend_"+a),script:document.getElementById("id_s_filter_poodll_templatescript_"+a),style:document.getElementById("id_s_filter_poodll_templatestyle_"+a),dataset:document.getElementById("id_s_filter_poodll_dataset_"+a),datasetvars:document.getElementById("id_s_filter_poodll_datasetvars_"+a),alternate:document.getElementById("id_s_filter_poodll_templatealternate_"+a),alternateend:document.getElementById("id_s_filter_poodll_templatealternate_end_"+a),presetdata:document.getElementById("id_s_filter_poodll_presetdata_"+a)};return b},fetchjsonbundle:function fetchjsonbundle(b,c){var d={};a.each(this.dataitems,function(a,b){d[b]=c[b].value});var e=JSON.stringify(d);return e},exportbundle:function exportbundle(a){var b=this.fetchcontrols(a);if(""==b.key.value){return}var c=this.fetchjsonbundle(a,b),d=document.createElement("a");d.setAttribute("href","data:text/json;charset=utf-8,"+encodeURIComponent(c));d.setAttribute("download",b.key.value+".txt");if(document.createEvent){var e=document.createEvent("MouseEvents");e.initEvent("click",!0,!0);d.dispatchEvent(e)}else{d.click()}},populateform:function populateform(b,c,d){var e=this.fetchcontrols(b);if(!c&&!d){return}if(!(0==c&&d)){d=this.presetdata}a.each(this.dataitems,function(a,b){if(d[c].hasOwnProperty(b)){if("cleartemplate"==d[c].key&&("key"==b||"name"==b)){var f=""}else{var f=d[c][b]}e[b].value=f}else{switch(b){case"amd":case"showplayers":case"showatto":e[b].value=0;break;default:e[b].value="";}}})},dopopulate:function dopopulate(a,b){this.populateform(a,0,Array(b))},init:function init(b){if(!this.presetdata){var c="#id_s_filter_poodll_presetdata_"+b.templateindex,d=a(c).get(0);this.presetdata=JSON.parse(d.value);a(c).remove()}var e=this;a("select[name='filter_poodll/presets']").change(function(){debugger;e.populateform(b.templateindex,a(this).val())});var f="#id_s_filter_poodll_dragdropsquare_"+b.templateindex;a(f).on("click",function(){e.exportbundle(b.templateindex)});a(f).on("dragover",function(b){b.preventDefault();b.stopPropagation();a(this).addClass("filter_poodll_dragging")});a(f).on("dragleave",function(b){b.preventDefault();b.stopPropagation();a(this).removeClass("filter_poodll_dragging")});a(f).on("drop",function(c){c.preventDefault();var d=c.originalEvent.dataTransfer.files;if(d.length){var g=d[0];if(g){var f=new FileReader;f.onload=function(a){var c=a.target.result,d=JSON.parse(c);if(d.key){e.dopopulate(b.templateindex,d)}};f.readAsText(g)}else{alert("Failed to load file")}}a(this).removeClass("filter_poodll_dragging")})}}}); +//# sourceMappingURL=template_presets_amd.min.js.map diff --git a/amd/build/timer.min.js b/amd/build/timer.min.js index 90661c11..ffe171b3 100644 --- a/amd/build/timer.min.js +++ b/amd/build/timer.min.js @@ -1 +1,2 @@ -define(["jquery","core/log"],function(a,b){"use strict";return b.debug("Timer: initialising"),{increment:1,initseconds:0,seconds:0,finalseconds:0,intervalhandle:null,callback:null,enabled:!1,clone:function(){return a.extend(!0,{},this)},init:function(a,b){this.initseconds=parseInt(a),this.seconds=parseInt(a),this.callback=b,this.enabled=!0},start:function(){if(this.enabled){var a=this;this.finalseconds=0,this.initseconds>0?this.increment=-1:this.increment=1,this.intervalhandle=this.customSetInterval(function(){a.seconds=a.seconds+a.increment,a.finalseconds=a.finalseconds+1,a.callback()},1e3)}},customSetInterval:function(a,b){function c(){var g=Date.now(),h=g-d;d=g,e=b+e-h,f.id=setTimeout(c,e),a()}var d=Date.now(),e=b,f={};return f.id=setTimeout(c,b),f},disable:function(){this.enabled=!1},enable:function(){this.enabled=!0},fetch_display_time:function(a){a||(a=this.seconds);var b="00"+parseInt(a/3600);b=b.substr(b.length-2,2);var c="00"+parseInt(a/60);c=c.substr(c.length-2,2);var d="00"+parseInt(a%60);d=d.substr(d.length-2,2);var e=b+":"+c+":"+d;return e},stop:function(){clearTimeout(this.intervalhandle.id)},reset:function(){this.seconds=this.initseconds},pause:function(){this.increment=0},resume:function(){this.initseconds>0?this.increment=-1:this.increment=1}}}); \ No newline at end of file +define ("filter_poodll/timer",["jquery","core/log"],function(a,b){"use strict";b.debug("Timer: initialising");return{increment:1,initseconds:0,seconds:0,finalseconds:0,intervalhandle:null,callback:null,enabled:!1,clone:function clone(){return a.extend(!0,{},this)},init:function init(a,b){this.initseconds=parseInt(a);this.seconds=parseInt(a);this.callback=b;this.enabled=!0},start:function start(){if(!this.enabled){return}var a=this;this.finalseconds=0;if(00){var g={};return g.id=d.config.id,g.type="error",g.code=f.returnCode,g.message=f.returnMessage,void d.config.hermes.postMessage(g)}d.config.allowedURL=f.allowedURL,d.config.posturl=f.postURL,d.config.filename=f.filename,d.config.s3filename=f.s3filename,d.config.s3root=f.s3root,d.config.cloudfilename=f.shortfilename,d.config.cloudroot=f.shortroot}else b.debug("error:"+f.message)}else b.debug("Not 200 response:"+c.status)};var e="wstoken="+this.config.wstoken+"&wsfunction="+a+"&moodlewsrestformat="+this.config.moodlewsrestformat+"&mediatype="+this.config.mediatype+"&parent="+this.config.parent+"&appid="+this.config.appid+"&owner="+this.config.owner+"®ion="+this.config.region+"&expiredays="+this.config.expiredays+"&transcode="+this.config.transcode+"&transcoder="+this.config.transcoder+"&transcribe="+this.config.transcribe+"&subtitle="+this.config.subtitle+"&transcribelanguage="+this.config.language+"&transcribevocab="+this.config.transcribevocab+"¬ificationurl="+this.config.notificationurl+"&sourcemimetype="+this.config.sourcemimetype,f=M.cfg.wwwroot+"/webservice/rest/server.php";c.open("POST",f,!0),c.setRequestHeader("Cache-Control","no-cache"),c.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),c.send(e)},uploadBlob:function(a,b){this.uploadFile(a,b)},extractFilename:function(a){var b="success",c=a.indexOf(b);if(c<1)return!1;var d=a.indexOf(""),e=a.substring(c+b.length,d);return e},fetchFileExtension:function(a){var b="";switch(a){case"image/jpeg":b="jpg";break;case"image/png":b="png";break;case"audio/wav":b="wav";break;case"audio/ogg":b="ogg";break;case"video/quicktime":b="mov";break;case"audio/mpeg3":b="mp3";break;case"audio/mp3":b="mp3";break;case"audio/webm":b="webm";break;case"audio/x-mpeg-3":b="mp3";break;case"audio/3gpp":b="3gpp";break;case"video/mpeg3":b="3gpp";break;case"video/mp4":b="mp4";break;case"video/webm":b="webm";break;case"video/ogg":b="ogg"}return b},pokeFilename:function(c,d){var e="";return"undefined"!=typeof d.config.updatecontrol&&""!==d.config.updatecontrol&&(e=a('[id="'+d.config.updatecontrol+'"]')),e.length<1&&(e=a('[id="'+d.config.updatecontrol+'"]',window.parent.document)),e.length>0?(e.get(0).value=c,e.trigger("change"),!0):(b.debug("upload failed #2"),d.upskin.showMessage(M.util.get_string("recui_uploaderror","filter_poodll"),"recui_uploaderror"),!1)},alertRecorderSuccess:function(a){this.config.hasOwnProperty("onuploadsuccess")&&this.config.onuploadsuccess(a)},alertRecorderFailure:function(a){this.config.hasOwnProperty("onuploadfailure")&&this.config.onuploadfailure(a)},completeAfterProcessing:function(c,d,e){this.upskin.showMessage(M.util.get_string("recui_awaitingconversion","filter_poodll"),"recui_awaitingconversion"),c.config.iframeembed&&(d=c.config.s3root+c.config.s3filename);var f={};f.type="awaitingprocessing",f.mediaurl=d,f.mediafilename=c.config.s3filename,f.sourcefilename=c.config.sourcefilename,f.sourcemimetype=c.config.sourcemimetype,f.s3root=c.config.s3root,f.id=c.config.id,f.updatecontrol=c.config.updatecontrol,c.config.transcribe&&(f.transcripturl=d+".txt",f.transcriptfilename=c.config.s3filename+".txt"),c.config.hermes.postMessage(f);var g=this;a.ajax({url:c.config.s3root+c.config.s3filename,method:"HEAD",cache:!1,error:function(){b.debug("403 errors are normal here, till the file arrives back from conversion"),setTimeout(function(){g.completeAfterProcessing(c,d,e+500)},e)},success:function(a,b,f){switch(f.status){case 200:g.doUploadCompleteCallback(c,d);break;default:setTimeout(function(){g.completeAfterProcessing(c,d,e+500)},e)}}})},doUploadCompleteCallback:function(a,b){a.config.iframeembed&&(b=a.config.s3root+a.config.s3filename);var c=new Array;if(c[0]=a.config.widgetid,c[1]="filesubmitted",c[2]=b,c[3]=a.config.updatecontrol,c[4]=a.config.s3filename,this.upskin.showMessage(M.util.get_string("recui_uploadsuccess","filter_poodll"),"recui_uploadsuccess"),a.config.iframeembed){var d={};d.type="filesubmitted",d.mediaurl=a.config.s3root+a.config.s3filename,d.mediafilename=a.config.s3filename,d.sourcefilename=a.config.sourcefilename,d.sourcemimetype=a.config.sourcemimetype,d.s3root=a.config.s3root,d.id=a.config.id,d.updatecontrol=a.config.updatecontrol,a.config.transcribe&&(d.transcripturl=a.config.s3root+a.config.s3filename+".txt",d.transcriptfilename=a.config.s3filename+".txt"),a.config.hermes.postMessage(d)}else a.config.callbackjs&&""!=a.config.callbackjs?"function"==typeof a.config.callbackjs?a.config.callbackjs(c):this.executeFunctionByName(a.config.callbackjs,window,c):a.pokeFilename(b,a)},postProcessUpload:function(c,d){var e=c.currentTarget;if(4==e.readyState)if(d.upskin.deactivateProgressSession(),a(window).off("beforeunload",this.preventPrematureLeaving),200==e.status){var f=d.config.filename;if(f||(f=d.extractFilename(e.responseText)),!f)return b.debug("upload failed #1"),void b.debug(e);d.config.iframeembed?this.completeAfterProcessing(d,f,1e3):this.doUploadCompleteCallback(d,f),this.alertRecorderSuccess(d.config.widgetid)}else b.debug("upload failed #3"),b.debug(e),d.upskin.showMessage(M.util.get_string("recui_uploaderror","filter_poodll"),"recui_uploaderror"),this.alertRecorderFailure(d.config.widgetid)},preventPrematureLeaving:function(){return M.util.get_string("recui_waitwaitstilluploading","filter_poodll")},uploadFile:function(b,c){var d=new XMLHttpRequest,e=this.config,f=this,g=this.fetchFileExtension(c);"undefined"==typeof e.iframeembed&&(e.iframeembed=!1);var h=e.using_s3;if(this.upskin.initProgressSession(d),a(window).on("beforeunload",this.preventPrematureLeaving),this.upskin.showMessage(M.util.get_string("recui_uploading","filter_poodll"),"recui_uploading"),f.config.sourcemimetype=c,f.config.sourcefilename=f.config.s3filename,d.onreadystatechange=function(a){h&&4===this.readyState&&(e.iframeembed?f.update_filenames(f,g):f.postprocess_s3_upload(f)),f.postProcessUpload(a,f)},h)d.open("put",e.posturl,!0),d.setRequestHeader("Content-Type","application/octet-stream"),d.send(b);else if(b instanceof Blob){var i=new window.FileReader;i.readAsDataURL(b),i.onloadend=function(){var a=i.result,b="datatype=uploadfile";b+="¶mone="+encodeURIComponent(a),b+="¶mtwo="+g,b+="¶mthree="+e.mediatype,b+="&requestid="+e.widgetid,b+="&contextid="+e.p2,b+="&component="+e.p3,b+="&filearea="+e.p4,b+="&itemid="+e.p5,d.open("POST",e.posturl,!0),d.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),d.setRequestHeader("Cache-Control","no-cache"),d.send(b)}}else{var j="datatype=uploadfile";j+="¶mone="+encodeURIComponent(b),j+="¶mtwo="+g,j+="¶mthree="+e.mediatype,j+="&requestid="+e.widgetid,j+="&contextid="+e.p2,j+="&component="+e.p3,j+="&filearea="+e.p4,j+="&itemid="+e.p5,d.open("POST",e.posturl,!0),d.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),d.setRequestHeader("Cache-Control","no-cache"),d.send(j)}},update_filenames:function(a,b){var c=a.config;switch(c.mediatype){case"audio":a.config.sourcefilename=c.s3filename.replace(".mp3","."+b),c.transcode||(a.config.s3filename=a.config.sourcefilename,a.config.cloudfilename=a.config.s3filename);break;case"video":a.config.sourcefilename=c.s3filename.replace(".mp4","."+b),c.transcode||(a.config.s3filename=a.config.sourcefilename)}},postprocess_s3_upload:function(a){var b=a.config;const c=new FormData;c.append("datatype","handles3upload"),c.append("contextid",b.p2),c.append("component",b.p3),c.append("filearea",b.p4),c.append("itemid",b.p5),c.append("filename",b.filename),c.append("mediatype",b.mediatype),navigator.sendBeacon||(navigator.sendBeacon=function(a,b){window.fetch(a,{method:"POST",body:b,credentials:"include"})}),navigator.sendBeacon(M.cfg.wwwroot+"/filter/poodll/poodllfilelib.php",c)},executeFunctionByName:function(a,b,c){for(var d=a.split("."),e=d.pop(),f=0;f");if(1>b){return!1}var c=a.indexOf(""),d=a.substring(b+"success".length,c);return d},fetchFileExtension:function fetchFileExtension(a){var b="";switch(a){case"image/jpeg":b="jpg";break;case"image/png":b="png";break;case"audio/wav":b="wav";break;case"audio/ogg":b="ogg";break;case"video/quicktime":b="mov";break;case"audio/mpeg3":b="mp3";break;case"audio/mp3":b="mp3";break;case"audio/webm":b="webm";break;case"audio/x-mpeg-3":b="mp3";break;case"audio/3gpp":b="3gpp";break;case"video/mpeg3":b="3gpp";break;case"video/mp4":b="mp4";break;case"video/webm":b="webm";break;case"video/ogg":b="ogg";break;}return b},pokeFilename:function pokeFilename(c,d){var e="";if("undefined"!=typeof d.config.updatecontrol&&""!==d.config.updatecontrol){e=a("[id=\""+d.config.updatecontrol+"\"]")}if(1>e.length){e=a("[id=\""+d.config.updatecontrol+"\"]",window.parent.document)}if(0 0 indicates an error\n if (payloadobject.returnCode > 0) {\n //We alert the iframe host that something did not go right\n var messageObject = {};\n messageObject.id = that.config.id;\n messageObject.type = \"error\";\n messageObject.code = payloadobject.returnCode;\n messageObject.message = payloadobject.returnMessage;\n that.config.hermes.postMessage(messageObject);\n return;\n //if all good, then lets do the embed\n } else {\n that.config.allowedURL = payloadobject.allowedURL;\n that.config.posturl = payloadobject.postURL;\n that.config.filename = payloadobject.filename;\n that.config.s3filename = payloadobject.s3filename;\n that.config.s3root = payloadobject.s3root;\n that.config.cloudfilename = payloadobject.shortfilename;\n that.config.cloudroot = payloadobject.shortroot;\n }\n\n } else {\n log.debug('error:' + payloadobject.message);\n\n }\n } else {\n log.debug('Not 200 response:' + xhr.status);\n }\n }\n };\n\n //log.debug(params);\n var xhrparams = \"wstoken=\" + this.config.wstoken\n + \"&wsfunction=\" + functionname\n + \"&moodlewsrestformat=\" + this.config.moodlewsrestformat\n + \"&mediatype=\" + this.config.mediatype\n + '&parent=' + this.config.parent\n + '&appid=' + this.config.appid\n + '&owner=' + this.config.owner\n + '®ion=' + this.config.region\n + '&expiredays=' + this.config.expiredays\n + '&transcode=' + this.config.transcode\n + '&transcoder=' + this.config.transcoder\n + '&transcribe=' + this.config.transcribe\n + '&subtitle=' + this.config.subtitle\n + '&transcribelanguage=' + this.config.language\n + '&transcribevocab=' + this.config.transcribevocab\n + '¬ificationurl=' + this.config.notificationurl\n + '&sourcemimetype=' + this.config.sourcemimetype;\n\n var serverurl = M.cfg.wwwroot + \"/webservice/rest/server.php\";\n xhr.open(\"POST\", serverurl, true);\n xhr.setRequestHeader(\"Cache-Control\", \"no-cache\");\n xhr.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded\");\n xhr.send(xhrparams);\n },\n\n uploadBlob: function (blob, filetype) {\n this.uploadFile(blob, filetype);\n return;\n },\n //extract filename from the text returned as response to upload\n extractFilename: function (returntext) {\n var searchkey = \"success\";\n var start = returntext.indexOf(searchkey);\n if (start < 1) {\n return false;\n }\n var end = returntext.indexOf(\"\");\n var filename = returntext.substring(start + (searchkey.length), end);\n return filename;\n },\n\n //fetch file extension from the filetype\n fetchFileExtension: function (filetype) {\n var ext = \"\";\n //Might need more mimetypes than this, and 3gpp maynot work\n switch (filetype) {\n case \"image/jpeg\":\n ext = \"jpg\";\n break;\n case \"image/png\":\n ext = \"png\";\n break;\n case \"audio/wav\":\n ext = \"wav\";\n break;\n case \"audio/ogg\":\n ext = \"ogg\";\n break;\n case \"video/quicktime\":\n ext = \"mov\";\n break;\n case \"audio/mpeg3\":\n ext = \"mp3\";\n break;\n case \"audio/mp3\":\n ext = \"mp3\";\n break;\n case \"audio/webm\":\n ext = \"webm\";\n break;\n case \"audio/x-mpeg-3\":\n ext = \"mp3\";\n break;\n case \"audio/3gpp\":\n ext = \"3gpp\";\n break;\n case \"video/mpeg3\":\n ext = \"3gpp\";\n break;\n case \"video/mp4\":\n ext = \"mp4\";\n break;\n case \"video/webm\":\n ext = \"webm\";\n break;\n case \"video/ogg\":\n ext = \"ogg\";\n break;\n }\n return ext;\n },\n\n pokeFilename: function (filename, uploader) {\n\n var upc = '';\n if (typeof uploader.config.updatecontrol !== 'undefined' && uploader.config.updatecontrol !== '') {\n upc = $('[id=\"' + uploader.config.updatecontrol + '\"]');\n //the code below used to work until odd chars in question id annoyed jquery 3\n //upc = $('#' + uploader.config.updatecontrol);\n }\n if (upc.length < 1) {\n upc = $('[id=\"' + uploader.config.updatecontrol + '\"]', window.parent.document);\n }\n if (upc.length > 0) {\n upc.get(0).value = filename;\n } else {\n log.debug('upload failed #2');\n uploader.upskin.showMessage(M.util.get_string('recui_uploaderror', 'filter_poodll'), 'recui_uploaderror');\n return false;\n }\n upc.trigger('change');\n return true;\n },\n\n alertRecorderSuccess: function (widgetid) {\n if (this.config.hasOwnProperty('onuploadsuccess')) {\n this.config.onuploadsuccess(widgetid);\n }\n },\n\n alertRecorderFailure: function (widgetid) {\n if (this.config.hasOwnProperty('onuploadfailure')) {\n this.config.onuploadfailure(widgetid);\n }\n },\n\n //We can detect conversion by pinging the s3 out filename\n //this is only done in the iFrame\n completeAfterProcessing: function (uploader, filename, waitms) {\n\n //alert the skin that we are awaiting processing\n this.upskin.showMessage(M.util.get_string('recui_awaitingconversion', 'filter_poodll'), 'recui_awaitingconversion');\n\n //this will always be true ...\n if (uploader.config.iframeembed) {\n filename = uploader.config.s3root + uploader.config.s3filename;\n }\n\n //We alert the iframe host that a file is now awaiting conversion\n var messageObject = {};\n messageObject.type = \"awaitingprocessing\";\n messageObject.mediaurl = filename;\n messageObject.mediafilename = uploader.config.s3filename;\n messageObject.sourcefilename = uploader.config.sourcefilename;\n messageObject.sourcemimetype = uploader.config.sourcemimetype;\n messageObject.s3root = uploader.config.s3root;\n messageObject.id = uploader.config.id;\n messageObject.updatecontrol = uploader.config.updatecontrol;\n if (uploader.config.transcribe) {\n messageObject.transcripturl = filename + '.txt';\n messageObject.transcriptfilename = uploader.config.s3filename + '.txt';\n }\n uploader.config.hermes.postMessage(messageObject);\n\n //we commence a series of ping and retries until the recorded file is available\n var that = this;\n $.ajax({\n url: uploader.config.s3root + uploader.config.s3filename,\n method: 'HEAD',\n cache: false,\n error: function () {\n //We get here if its a 404 or 403. So settimout here and wait for file to arrive\n //we increment the timeout period each time to prevent bottlenecks\n log.debug('403 errors are normal here, till the file arrives back from conversion');\n setTimeout(function () {\n that.completeAfterProcessing(uploader, filename, waitms + 500);\n }, waitms);\n },\n success: function (data, textStatus, xhr) {\n switch (xhr.status) {\n case 200:\n that.doUploadCompleteCallback(uploader, filename);\n break;\n default:\n setTimeout(function () {\n that.completeAfterProcessing(uploader, filename, waitms + 500);\n }, waitms);\n }\n\n }\n });\n },\n\n doUploadCompleteCallback: function (uploader, filename) {\n\n //in the case of an iframeembed we need a full URL not just a filename\n if (uploader.config.iframeembed) {\n filename = uploader.config.s3root + uploader.config.s3filename;\n }\n\n //For callbackjs and for postmessage we need an array of stuff\n var callbackObject = new Array();\n callbackObject[0] = uploader.config.widgetid;\n callbackObject[1] = \"filesubmitted\";\n callbackObject[2] = filename;\n callbackObject[3] = uploader.config.updatecontrol;\n callbackObject[4] = uploader.config.s3filename;\n\n //alert the skin that we were successful\n this.upskin.showMessage(M.util.get_string('recui_uploadsuccess', 'filter_poodll'), 'recui_uploadsuccess');\n\n //invoke callbackjs if we have one, otherwise just update the control(default behav.)\n if (!uploader.config.iframeembed) {\n if (uploader.config.callbackjs && uploader.config.callbackjs != '') {\n if (typeof(uploader.config.callbackjs) === 'function') {\n uploader.config.callbackjs(callbackObject);\n } else {\n //this was the old rubbish way, where the callback was a function name\n this.executeFunctionByName(uploader.config.callbackjs, window, callbackObject);\n }\n } else {\n //by default we just poke the filename\n uploader.pokeFilename(filename, uploader);\n }\n } else {\n //in the case of an iframeembed we will also post a message to the host, they can choose to handle it or not\n //The callback object above scan prob. be phased out. But not all integrations will use iframes either.\n var messageObject = {};\n messageObject.type = \"filesubmitted\";\n messageObject.mediaurl = uploader.config.s3root + uploader.config.s3filename;\n messageObject.mediafilename = uploader.config.s3filename;\n messageObject.sourcefilename = uploader.config.sourcefilename;\n messageObject.sourcemimetype = uploader.config.sourcemimetype;\n messageObject.s3root = uploader.config.s3root;\n messageObject.id = uploader.config.id;\n messageObject.updatecontrol = uploader.config.updatecontrol;\n if (uploader.config.transcribe) {\n messageObject.transcripturl = uploader.config.s3root + uploader.config.s3filename + '.txt';\n messageObject.transcriptfilename = uploader.config.s3filename + '.txt';\n }\n\n uploader.config.hermes.postMessage(messageObject);\n }\n },\n\n //after an upload handle the filename poke and callback call\n postProcessUpload: function (e, uploader) {\n var xhr = e.currentTarget;\n if (xhr.readyState == 4) {\n\n uploader.upskin.deactivateProgressSession();\n\n //deactivate premature leaving\n $(window).off('beforeunload', this.preventPrematureLeaving);\n\n if (xhr.status == 200) {\n var filename = uploader.config.filename;\n if (!filename) {\n filename = uploader.extractFilename(xhr.responseText);\n }\n if (!filename) {\n log.debug('upload failed #1');\n log.debug(xhr);\n return;\n }\n\n //Alert any listeners about the upload complete\n //in an iframeembed we only do this after conversion is complete. so we run a poll to check compl.\n //in standard Moodle we have a placeholder file to deal with any slow conversions. so we don't poll\n if (uploader.config.iframeembed) {\n this.completeAfterProcessing(uploader, filename, 1000);\n } else {\n this.doUploadCompleteCallback(uploader, filename);\n }\n\n //alert the recorder that this was successful\n this.alertRecorderSuccess(uploader.config.widgetid);\n\n } else {\n log.debug('upload failed #3');\n log.debug(xhr);\n uploader.upskin.showMessage(M.util.get_string('recui_uploaderror', 'filter_poodll'), 'recui_uploaderror');\n\n //alert the recorder that this failed\n this.alertRecorderFailure(uploader.config.widgetid);\n\n } //end of if status 200\n }//end of if ready state 4\n\n },\n\n preventPrematureLeaving: function(){\n return M.util.get_string('recui_waitwaitstilluploading', 'filter_poodll');\n },\n\n // upload Media file to wherever\n uploadFile: function (filedata, sourcemimetype) {\n\n var xhr = new XMLHttpRequest();\n var config = this.config;\n var uploader = this;\n\n //get the file extension from the filetype\n var sourceext = this.fetchFileExtension(sourcemimetype);\n\n //is this an iframe embed\n if (typeof config.iframeembed == 'undefined') {\n config.iframeembed = false;\n }\n\n //are we using s3\n var using_s3 = config.using_s3;\n\n //Handle UI display of this upload\n this.upskin.initProgressSession(xhr);\n\n //Add a page unload check ..\n $(window).on('beforeunload', this.preventPrematureLeaving);\n\n //alert user that we are now uploading\n this.upskin.showMessage(M.util.get_string('recui_uploading', 'filter_poodll'), 'recui_uploading');\n\n //init sourcemimetype and sourcefilename\n uploader.config.sourcemimetype = sourcemimetype;\n uploader.config.sourcefilename = uploader.config.s3filename;\n\n xhr.onreadystatechange = function (e) {\n if (using_s3 && this.readyState === 4) {\n if (config.iframeembed) {\n uploader.update_filenames(uploader, sourceext);\n } else {\n //ping Moodle and inform that we have a new file\n uploader.postprocess_s3_upload(uploader);\n }\n }\n uploader.postProcessUpload(e, uploader);\n\n };\n\n if (using_s3) {\n xhr.open(\"put\", config.posturl, true);\n xhr.setRequestHeader(\"Content-Type\", 'application/octet-stream');\n xhr.send(filedata);\n } else {\n\n //We NEED to redo this bit of code ..\n //its duplicating!!!\n if (!(filedata instanceof Blob)) {\n var params = \"datatype=uploadfile\";\n //We must URI encode the filedata, because otherwise the \"+\" characters get turned into spaces\n //spent hours tracking that down ...justin 20121012\n params += \"¶mone=\" + encodeURIComponent(filedata);\n params += \"¶mtwo=\" + sourceext;\n params += \"¶mthree=\" + config.mediatype;\n params += \"&requestid=\" + config.widgetid;\n params += \"&contextid=\" + config.p2;\n params += \"&component=\" + config.p3;\n params += \"&filearea=\" + config.p4;\n params += \"&itemid=\" + config.p5;\n\n xhr.open(\"POST\", config.posturl, true);\n xhr.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded\");\n xhr.setRequestHeader(\"Cache-Control\", \"no-cache\");\n //xhr.setRequestHeader(\"Content-length\", params.length);\n //xhr.setRequestHeader(\"Connection\", \"close\");\n xhr.send(params);\n } else {\n //we have to base64 string the blob before sending it\n var reader = new window.FileReader();\n reader.readAsDataURL(filedata);\n reader.onloadend = function () {\n var base64filedata = reader.result;\n //log.debug(params);\n var params = \"datatype=uploadfile\";\n //We must URI encode the filedata, because otherwise the \"+\" characters get turned into spaces\n //spent hours tracking that down ...justin 20121012\n params += \"¶mone=\" + encodeURIComponent(base64filedata);\n params += \"¶mtwo=\" + sourceext;\n params += \"¶mthree=\" + config.mediatype;\n params += \"&requestid=\" + config.widgetid;\n params += \"&contextid=\" + config.p2;\n params += \"&component=\" + config.p3;\n params += \"&filearea=\" + config.p4;\n params += \"&itemid=\" + config.p5;\n\n xhr.open(\"POST\", config.posturl, true);\n xhr.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded\");\n xhr.setRequestHeader(\"Cache-Control\", \"no-cache\");\n // xhr.setRequestHeader(\"Content-length\", params.length);\n // xhr.setRequestHeader(\"Connection\", \"close\");\n xhr.send(params);\n };//end of fileread on load end\n }//end of if blob\n }//end of if using_s3\n },\n\n update_filenames: function (uploader, sourceext) {\n var config = uploader.config;\n\n //now its a bit hacky, but\n // only now do we know the true final file extension (ext) and mimetype of unconv. media\n // so we want to save that and if the user is NOT transcoding,\n //we want to change the s3filename from the default mp4/mp3 to whatever the mimetype inidicates, ie sourceext\n\n switch (config.mediatype) {\n case 'audio':\n //source info\n uploader.config.sourcefilename = config.s3filename.replace('.mp3', '.' + sourceext);\n if (!config.transcode) {\n uploader.config.s3filename = uploader.config.sourcefilename;\n //do we need this, I think its old and noone uses it.\n uploader.config.cloudfilename = uploader.config.s3filename;\n }\n break;\n case 'video':\n uploader.config.sourcefilename = config.s3filename.replace('.mp4', '.' + sourceext);\n if (!config.transcode) {\n uploader.config.s3filename = uploader.config.sourcefilename;\n }\n break;\n }\n },\n\n postprocess_s3_upload: function (uploader) {\n var config = uploader.config;\n const formData = new FormData();\n formData.append(\"datatype\", \"handles3upload\");\n formData.append(\"contextid\", config.p2);\n formData.append(\"component\", config.p3);\n formData.append(\"filearea\", config.p4);\n formData.append(\"itemid\", config.p5);\n formData.append(\"filename\", config.filename);\n formData.append(\"mediatype\", config.mediatype);\n //navigator beacon polyfill\n if (!navigator.sendBeacon) {\n navigator.sendBeacon = function (url, thedata) {\n window.fetch(url, {method: 'POST', body: thedata, credentials: 'include'});\n };\n }\n //we use navigator beacon over xhr because there are times believe it or not, when a page load happens and that kills\n //the request. causing lost files\n navigator.sendBeacon(M.cfg.wwwroot + '/filter/poodll/poodllfilelib.php', formData);\n return;\n\n /*\n var xhr = new XMLHttpRequest();\n var that = this;\n\n //lets do a little error checking\n //if its a self signed error or rotten permissions on poodllfilelib.php we might error here.\n xhr.onreadystatechange = function(){\n if(this.readyState===4){\n if(xhr.status!=200){\n that.upskin.showMessage('Post Process s3 Upload Error:' + xhr.status, 'recui_uploaderror');\n $('#' + that.config.widgetid + '_messages').show();\n }\n }\n };\n\n //log.debug(params);\n var params = \"datatype=handles3upload\";\n params += \"&contextid=\" + config.p2;\n params += \"&component=\" + config.p3;\n params += \"&filearea=\" + config.p4;\n params += \"&itemid=\" + config.p5;\n params += \"&filename=\" + config.filename;\n params += \"&mediatype=\" + config.mediatype;\n\n xhr.open(\"POST\",M.cfg.wwwroot + '/filter/poodll/poodllfilelib.php', true);\n xhr.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded\");\n xhr.setRequestHeader(\"Cache-Control\", \"no-cache\");\n xhr.send(params);\n */\n\n },\n\n //function to call the callback function with arguments\n executeFunctionByName: function (functionName, context, args) {\n\n //var args = Array.prototype.slice.call(arguments).splice(2);\n var namespaces = functionName.split(\".\");\n var func = namespaces.pop();\n for (var i = 0; i < namespaces.length; i++) {\n context = context[namespaces[i]];\n }\n return context[func].call(this, args);\n },\n\n dataURItoBlob: function (dataURI, mimetype) {\n var byteString = atob(dataURI.split(',')[1]);\n var ab = new ArrayBuffer(byteString.length);\n var ia = new Uint8Array(ab);\n for (var i = 0; i < byteString.length; i++) {\n ia[i] = byteString.charCodeAt(i);\n }\n return new Blob([ab], {type: mimetype});\n },//end of dataURItoBlob\n\n //some recorder skins call this directly, so we just pass it through to the upskin\n Output: function (msg) {\n this.upskin.showMessage(msg, 'recorderskinmsg');\n }\n };//end of returned object\n});//total end\n"],"file":"uploader.min.js"} \ No newline at end of file +{"version":3,"sources":["../src/uploader.js"],"names":["define","$","log","upskin_plain","debug","config","clone","extend","init","element","upskin","initControls","registerEvents","that","hermes","on","fetchNewUploadDetails","xhr","XMLHttpRequest","onreadystatechange","readyState","status","payload","responseText","payloadobject","JSON","parse","returnCode","messageObject","id","type","code","message","returnMessage","postMessage","allowedURL","posturl","postURL","filename","s3filename","s3root","cloudfilename","shortfilename","cloudroot","shortroot","xhrparams","wstoken","moodlewsrestformat","mediatype","parent","appid","owner","region","expiredays","transcode","transcoder","transcribe","subtitle","language","transcribevocab","notificationurl","sourcemimetype","serverurl","M","cfg","wwwroot","open","setRequestHeader","send","uploadBlob","blob","filetype","uploadFile","extractFilename","returntext","start","indexOf","end","substring","length","fetchFileExtension","ext","pokeFilename","uploader","upc","updatecontrol","window","document","get","value","showMessage","util","get_string","trigger","alertRecorderSuccess","widgetid","hasOwnProperty","onuploadsuccess","alertRecorderFailure","onuploadfailure","completeAfterProcessing","waitms","iframeembed","mediaurl","mediafilename","sourcefilename","transcripturl","transcriptfilename","ajax","url","method","cache","error","setTimeout","success","data","textStatus","doUploadCompleteCallback","callbackObject","callbackjs","executeFunctionByName","postProcessUpload","e","currentTarget","deactivateProgressSession","off","preventPrematureLeaving","filedata","sourceext","using_s3","initProgressSession","update_filenames","postprocess_s3_upload","Blob","params","encodeURIComponent","p2","p3","p4","p5","reader","FileReader","readAsDataURL","onloadend","base64filedata","result","replace","formData","FormData","append","navigator","sendBeacon","thedata","fetch","body","credentials","functionName","context","args","namespaces","split","func","pop","i","call","dataURItoBlob","dataURI","mimetype","byteString","atob","ab","ArrayBuffer","ia","Uint8Array","charCodeAt","Output","msg"],"mappings":"AACAA,OAAM,0BAAC,CAAC,QAAD,CAAW,UAAX,CAAuB,4BAAvB,CAAD,CAAuD,SAAUC,CAAV,CAAaC,CAAb,CAAkBC,CAAlB,CAAgC,CAEzF,aAEAD,CAAG,CAACE,KAAJ,CAAU,kCAAV,EAEA,MAAO,CAEHC,MAAM,CAAE,IAFL,CAKHC,KAAK,CAAE,gBAAY,CACf,MAAOL,CAAAA,CAAC,CAACM,MAAF,IAAe,EAAf,CAAmB,IAAnB,CACV,CAPE,CASHC,IAAI,CAAE,cAAUC,CAAV,CAAmBJ,CAAnB,CAA2BK,CAA3B,CAAmC,CACrC,KAAKL,MAAL,CAAcA,CAAd,CACA,GAAIK,CAAJ,CAAY,CACR,KAAKA,MAAL,CAAcA,CACjB,CAFD,IAEO,CACH,KAAKA,MAAL,CAAcP,CAAY,CAACG,KAAb,EAAd,CACA,KAAKI,MAAL,CAAYF,IAAZ,CAAiBH,CAAjB,CAAyBI,CAAzB,OACH,CACD,KAAKC,MAAL,CAAYC,YAAZ,GACA,KAAKC,cAAL,EACH,CAnBE,CAqBHA,cAAc,CAAE,yBAAY,CACxB,GAAIC,CAAAA,CAAI,CAAG,IAAX,CAED,GAAG,KAAKR,MAAL,CAAYS,MAAf,CAAuB,CAClB,KAAKT,MAAL,CAAYS,MAAZ,CAAmBC,EAAnB,CAAsB,kBAAtB,CAA0C,UAAa,CACnDF,CAAI,CAACG,qBAAL,EACH,CAFD,CAGJ,CACH,CA7BE,CA+BHA,qBAAqB,CAAE,gCAAY,IAO3BC,CAAAA,CAAG,CAAG,GAAIC,CAAAA,cAPiB,CAQ3BL,CAAI,CAAG,IARoB,CAW/BI,CAAG,CAACE,kBAAJ,CAAyB,UAAa,CAClC,GAAwB,CAApB,QAAKC,UAAT,CAA2B,CACvB,GAAkB,GAAd,EAAAH,CAAG,CAACI,MAAR,CAAuB,IAGfC,CAAAA,CAAO,CAAGL,CAAG,CAACM,YAHC,CAIfC,CAAa,CAAGC,IAAI,CAACC,KAAL,CAAWJ,CAAX,CAJD,CAKnB,GAAIE,CAAJ,CAAmB,CAGf,GAA+B,CAA3B,CAAAA,CAAa,CAACG,UAAlB,CAAkC,CAE9B,GAAIC,CAAAA,CAAa,CAAG,CACNC,EADM,CACDhB,CAAI,CAACR,MAAL,CAAYwB,EADX,CAENC,IAFM,CAEC,OAFD,CAGNC,IAHM,CAGCP,CAAa,CAACG,UAHf,CAINK,OAJM,CAIIR,CAAa,CAACS,aAJlB,CAApB,CAKApB,CAAI,CAACR,MAAL,CAAYS,MAAZ,CAAmBoB,WAAnB,CAA+BN,CAA/B,CAGH,CAVD,IAUO,CACHf,CAAI,CAACR,MAAL,CAAY8B,UAAZ,CAAyBX,CAAa,CAACW,UAAvC,CACAtB,CAAI,CAACR,MAAL,CAAY+B,OAAZ,CAAsBZ,CAAa,CAACa,OAApC,CACAxB,CAAI,CAACR,MAAL,CAAYiC,QAAZ,CAAuBd,CAAa,CAACc,QAArC,CACAzB,CAAI,CAACR,MAAL,CAAYkC,UAAZ,CAAyBf,CAAa,CAACe,UAAvC,CACA1B,CAAI,CAACR,MAAL,CAAYmC,MAAZ,CAAqBhB,CAAa,CAACgB,MAAnC,CACA3B,CAAI,CAACR,MAAL,CAAYoC,aAAZ,CAA4BjB,CAAa,CAACkB,aAA1C,CACA7B,CAAI,CAACR,MAAL,CAAYsC,SAAZ,CAAwBnB,CAAa,CAACoB,SACzC,CAEJ,CAvBD,IAuBO,CACH1C,CAAG,CAACE,KAAJ,CAAU,SAAWoB,CAAa,CAACQ,OAAnC,CAEH,CACJ,CAhCD,IAgCO,CACH9B,CAAG,CAACE,KAAJ,CAAU,oBAAsBa,CAAG,CAACI,MAApC,CACH,CACJ,CACJ,CAtCD,CAX+B,GAoD3BwB,CAAAA,CAAS,CAAG,WAAa,KAAKxC,MAAL,CAAYyC,OAAzB,CACV,cADU,oCAEV,sBAFU,CAEe,KAAKzC,MAAL,CAAY0C,kBAF3B,CAGV,aAHU,CAGM,KAAK1C,MAAL,CAAY2C,SAHlB,CAIV,UAJU,CAIG,KAAK3C,MAAL,CAAY4C,MAJf,CAKV,SALU,CAKE,KAAK5C,MAAL,CAAY6C,KALd,CAMV,SANU,CAME,KAAK7C,MAAL,CAAY8C,KANd,CAOV,UAPU,CAOG,KAAK9C,MAAL,CAAY+C,MAPf,CAQV,cARU,CAQO,KAAK/C,MAAL,CAAYgD,UARnB,CASV,aATU,CASM,KAAKhD,MAAL,CAAYiD,SATlB,CAUV,cAVU,CAUO,KAAKjD,MAAL,CAAYkD,UAVnB,CAWV,cAXU,CAWO,KAAKlD,MAAL,CAAYmD,UAXnB,CAYV,YAZU,CAYK,KAAKnD,MAAL,CAAYoD,QAZjB,CAaV,sBAbU,CAae,KAAKpD,MAAL,CAAYqD,QAb3B,CAcV,mBAdU,CAcY,KAAKrD,MAAL,CAAYsD,eAdxB,CAeV,mBAfU,CAeY,KAAKtD,MAAL,CAAYuD,eAfxB,CAgBV,kBAhBU,CAgBW,KAAKvD,MAAL,CAAYwD,cApER,CAsE3BC,CAAS,CAAGC,CAAC,CAACC,GAAF,CAAMC,OAAN,CAAgB,6BAtED,CAuE/BhD,CAAG,CAACiD,IAAJ,CAAS,MAAT,CAAiBJ,CAAjB,KACA7C,CAAG,CAACkD,gBAAJ,CAAqB,eAArB,CAAsC,UAAtC,EACAlD,CAAG,CAACkD,gBAAJ,CAAqB,cAArB,CAAqC,mCAArC,EACAlD,CAAG,CAACmD,IAAJ,CAASvB,CAAT,CACH,CA1GE,CA4GHwB,UAAU,CAAE,oBAAUC,CAAV,CAAgBC,CAAhB,CAA0B,CAClC,KAAKC,UAAL,CAAgBF,CAAhB,CAAsBC,CAAtB,CAEH,CA/GE,CAiHHE,eAAe,CAAE,yBAAUC,CAAV,CAAsB,IAE/BC,CAAAA,CAAK,CAAGD,CAAU,CAACE,OAAX,qBAFuB,CAGnC,GAAY,CAAR,CAAAD,CAAJ,CAAe,CACX,QACH,CALkC,GAM/BE,CAAAA,CAAG,CAAGH,CAAU,CAACE,OAAX,CAAmB,aAAnB,CANyB,CAO/BtC,CAAQ,CAAGoC,CAAU,CAACI,SAAX,CAAqBH,CAAK,CAAI,oBAAUI,MAAxC,CAAiDF,CAAjD,CAPoB,CAQnC,MAAOvC,CAAAA,CACV,CA1HE,CA6HH0C,kBAAkB,CAAE,4BAAUT,CAAV,CAAoB,CACpC,GAAIU,CAAAA,CAAG,CAAG,EAAV,CAEA,OAAQV,CAAR,EACI,IAAK,YAAL,CACIU,CAAG,CAAG,KAAN,CACA,MACJ,IAAK,WAAL,CACIA,CAAG,CAAG,KAAN,CACA,MACJ,IAAK,WAAL,CACIA,CAAG,CAAG,KAAN,CACA,MACJ,IAAK,WAAL,CACIA,CAAG,CAAG,KAAN,CACA,MACJ,IAAK,iBAAL,CACIA,CAAG,CAAG,KAAN,CACA,MACJ,IAAK,aAAL,CACIA,CAAG,CAAG,KAAN,CACA,MACJ,IAAK,WAAL,CACIA,CAAG,CAAG,KAAN,CACA,MACJ,IAAK,YAAL,CACIA,CAAG,CAAG,MAAN,CACA,MACJ,IAAK,gBAAL,CACIA,CAAG,CAAG,KAAN,CACA,MACJ,IAAK,YAAL,CACIA,CAAG,CAAG,MAAN,CACA,MACJ,IAAK,aAAL,CACIA,CAAG,CAAG,MAAN,CACA,MACJ,IAAK,WAAL,CACIA,CAAG,CAAG,KAAN,CACA,MACJ,IAAK,YAAL,CACIA,CAAG,CAAG,MAAN,CACA,MACJ,IAAK,WAAL,CACIA,CAAG,CAAG,KAAN,CACA,MA1CR,CA4CA,MAAOA,CAAAA,CACV,CA7KE,CA+KHC,YAAY,CAAE,sBAAU5C,CAAV,CAAoB6C,CAApB,CAA8B,CAExC,GAAIC,CAAAA,CAAG,CAAG,EAAV,CACA,GAA6C,WAAzC,QAAOD,CAAAA,CAAQ,CAAC9E,MAAT,CAAgBgF,aAAvB,EAA0F,EAAlC,GAAAF,CAAQ,CAAC9E,MAAT,CAAgBgF,aAA5E,CAAkG,CAC9FD,CAAG,CAAGnF,CAAC,CAAC,SAAUkF,CAAQ,CAAC9E,MAAT,CAAgBgF,aAA1B,CAA0C,KAA3C,CAGV,CACD,GAAiB,CAAb,CAAAD,CAAG,CAACL,MAAR,CAAoB,CAChBK,CAAG,CAAGnF,CAAC,CAAC,SAAUkF,CAAQ,CAAC9E,MAAT,CAAgBgF,aAA1B,CAA0C,KAA3C,CAAiDC,MAAM,CAACrC,MAAP,CAAcsC,QAA/D,CACV,CACD,GAAiB,CAAb,CAAAH,CAAG,CAACL,MAAR,CAAoB,CAChBK,CAAG,CAACI,GAAJ,CAAQ,CAAR,EAAWC,KAAX,CAAmBnD,CACtB,CAFD,IAEO,CACHpC,CAAG,CAACE,KAAJ,CAAU,kBAAV,EACA+E,CAAQ,CAACzE,MAAT,CAAgBgF,WAAhB,CAA4B3B,CAAC,CAAC4B,IAAF,CAAOC,UAAP,CAAkB,mBAAlB,CAAuC,eAAvC,CAA5B,CAAqF,mBAArF,EACA,QACH,CACDR,CAAG,CAACS,OAAJ,CAAY,QAAZ,EACA,QACH,CAnME,CAqMHC,oBAAoB,CAAE,8BAAUC,CAAV,CAAoB,CACtC,GAAI,KAAK1F,MAAL,CAAY2F,cAAZ,CAA2B,iBAA3B,CAAJ,CAAmD,CAC/C,KAAK3F,MAAL,CAAY4F,eAAZ,CAA4BF,CAA5B,CACH,CACJ,CAzME,CA2MHG,oBAAoB,CAAE,8BAAUH,CAAV,CAAoB,CACtC,GAAI,KAAK1F,MAAL,CAAY2F,cAAZ,CAA2B,iBAA3B,CAAJ,CAAmD,CAC/C,KAAK3F,MAAL,CAAY8F,eAAZ,CAA4BJ,CAA5B,CACH,CACJ,CA/ME,CAmNHK,uBAAuB,CAAE,iCAAUjB,CAAV,CAAoB7C,CAApB,CAA8B+D,CAA9B,CAAsC,CAG3D,KAAK3F,MAAL,CAAYgF,WAAZ,CAAwB3B,CAAC,CAAC4B,IAAF,CAAOC,UAAP,CAAkB,0BAAlB,CAA8C,eAA9C,CAAxB,CAAwF,0BAAxF,EAGA,GAAIT,CAAQ,CAAC9E,MAAT,CAAgBiG,WAApB,CAAiC,CAC7BhE,CAAQ,CAAG6C,CAAQ,CAAC9E,MAAT,CAAgBmC,MAAhB,CAAyB2C,CAAQ,CAAC9E,MAAT,CAAgBkC,UACvD,CAGD,GAAIX,CAAAA,CAAa,CAAG,CACNE,IADM,CACC,oBADD,CAENyE,QAFM,CAEKjE,CAFL,CAGNkE,aAHM,CAGUrB,CAAQ,CAAC9E,MAAT,CAAgBkC,UAH1B,CAINkE,cAJM,CAIWtB,CAAQ,CAAC9E,MAAT,CAAgBoG,cAJ3B,CAKN5C,cALM,CAKWsB,CAAQ,CAAC9E,MAAT,CAAgBwD,cAL3B,CAMNrB,MANM,CAMG2C,CAAQ,CAAC9E,MAAT,CAAgBmC,MANnB,CAONX,EAPM,CAODsD,CAAQ,CAAC9E,MAAT,CAAgBwB,EAPf,CAQNwD,aARM,CAQUF,CAAQ,CAAC9E,MAAT,CAAgBgF,aAR1B,CAApB,CASA,GAAIF,CAAQ,CAAC9E,MAAT,CAAgBmD,UAApB,CAAgC,CAC5B5B,CAAa,CAAC8E,aAAd,CAA8BpE,CAAQ,CAAG,MAAzC,CACAV,CAAa,CAAC+E,kBAAd,CAAmCxB,CAAQ,CAAC9E,MAAT,CAAgBkC,UAAhB,CAA6B,MACnE,CACD4C,CAAQ,CAAC9E,MAAT,CAAgBS,MAAhB,CAAuBoB,WAAvB,CAAmCN,CAAnC,EAGA,GAAIf,CAAAA,CAAI,CAAG,IAAX,CACAZ,CAAC,CAAC2G,IAAF,CAAO,CACHC,GAAG,CAAE1B,CAAQ,CAAC9E,MAAT,CAAgBmC,MAAhB,CAAyB2C,CAAQ,CAAC9E,MAAT,CAAgBkC,UAD3C,CAEHuE,MAAM,CAAE,MAFL,CAGHC,KAAK,GAHF,CAIHC,KAAK,CAAE,gBAAY,CAGf9G,CAAG,CAACE,KAAJ,CAAU,wEAAV,EACA6G,UAAU,CAAC,UAAY,CACnBpG,CAAI,CAACuF,uBAAL,CAA6BjB,CAA7B,CAAuC7C,CAAvC,CAAiD+D,CAAM,CAAG,GAA1D,CACH,CAFS,CAEPA,CAFO,CAGb,CAXE,CAYHa,OAAO,CAAE,iBAAUC,CAAV,CAAgBC,CAAhB,CAA4BnG,CAA5B,CAAiC,CACtC,OAAQA,CAAG,CAACI,MAAZ,EACI,IAAK,IAAL,CACIR,CAAI,CAACwG,wBAAL,CAA8BlC,CAA9B,CAAwC7C,CAAxC,EACA,MACJ,QACI2E,UAAU,CAAC,UAAY,CACnBpG,CAAI,CAACuF,uBAAL,CAA6BjB,CAA7B,CAAuC7C,CAAvC,CAAiD+D,CAAM,CAAG,GAA1D,CACH,CAFS,CAEPA,CAFO,CAAV,CALR,CAUH,CAvBE,CAAP,CAyBH,CAxQE,CA0QHgB,wBAAwB,CAAE,kCAAUlC,CAAV,CAAoB7C,CAApB,CAA8B,CAGpD,GAAI6C,CAAQ,CAAC9E,MAAT,CAAgBiG,WAApB,CAAiC,CAC7BhE,CAAQ,CAAG6C,CAAQ,CAAC9E,MAAT,CAAgBmC,MAAhB,CAAyB2C,CAAQ,CAAC9E,MAAT,CAAgBkC,UACvD,CAGD,GAAI+E,CAAAA,CAAc,GAAlB,CACAA,CAAc,CAAC,CAAD,CAAd,CAAoBnC,CAAQ,CAAC9E,MAAT,CAAgB0F,QAApC,CACAuB,CAAc,CAAC,CAAD,CAAd,CAAoB,eAApB,CACAA,CAAc,CAAC,CAAD,CAAd,CAAoBhF,CAApB,CACAgF,CAAc,CAAC,CAAD,CAAd,CAAoBnC,CAAQ,CAAC9E,MAAT,CAAgBgF,aAApC,CACAiC,CAAc,CAAC,CAAD,CAAd,CAAoBnC,CAAQ,CAAC9E,MAAT,CAAgBkC,UAApC,CAGA,KAAK7B,MAAL,CAAYgF,WAAZ,CAAwB3B,CAAC,CAAC4B,IAAF,CAAOC,UAAP,CAAkB,qBAAlB,CAAyC,eAAzC,CAAxB,CAAmF,qBAAnF,EAGA,GAAI,CAACT,CAAQ,CAAC9E,MAAT,CAAgBiG,WAArB,CAAkC,CAC9B,GAAInB,CAAQ,CAAC9E,MAAT,CAAgBkH,UAAhB,EAA4D,EAA9B,EAAApC,CAAQ,CAAC9E,MAAT,CAAgBkH,UAAlD,CAAoE,CAChE,GAA2C,UAAvC,QAAOpC,CAAAA,CAAQ,CAAC9E,MAAT,CAAgBkH,UAA3B,CAAuD,CACnDpC,CAAQ,CAAC9E,MAAT,CAAgBkH,UAAhB,CAA2BD,CAA3B,CACH,CAFD,IAEO,CAEH,KAAKE,qBAAL,CAA2BrC,CAAQ,CAAC9E,MAAT,CAAgBkH,UAA3C,CAAuDjC,MAAvD,CAA+DgC,CAA/D,CACH,CACJ,CAPD,IAOO,CAEHnC,CAAQ,CAACD,YAAT,CAAsB5C,CAAtB,CAAgC6C,CAAhC,CACH,CACJ,CAZD,IAYO,CAGH,GAAIvD,CAAAA,CAAa,CAAG,CACNE,IADM,CACC,eADD,CAENyE,QAFM,CAEKpB,CAAQ,CAAC9E,MAAT,CAAgBmC,MAAhB,CAAyB2C,CAAQ,CAAC9E,MAAT,CAAgBkC,UAF9C,CAGNiE,aAHM,CAGUrB,CAAQ,CAAC9E,MAAT,CAAgBkC,UAH1B,CAINkE,cAJM,CAIWtB,CAAQ,CAAC9E,MAAT,CAAgBoG,cAJ3B,CAKN5C,cALM,CAKWsB,CAAQ,CAAC9E,MAAT,CAAgBwD,cAL3B,CAMNrB,MANM,CAMG2C,CAAQ,CAAC9E,MAAT,CAAgBmC,MANnB,CAONX,EAPM,CAODsD,CAAQ,CAAC9E,MAAT,CAAgBwB,EAPf,CAQNwD,aARM,CAQUF,CAAQ,CAAC9E,MAAT,CAAgBgF,aAR1B,CAApB,CASA,GAAIF,CAAQ,CAAC9E,MAAT,CAAgBmD,UAApB,CAAgC,CAC5B5B,CAAa,CAAC8E,aAAd,CAA8BvB,CAAQ,CAAC9E,MAAT,CAAgBmC,MAAhB,CAAyB2C,CAAQ,CAAC9E,MAAT,CAAgBkC,UAAzC,CAAsD,MAApF,CACAX,CAAa,CAAC+E,kBAAd,CAAmCxB,CAAQ,CAAC9E,MAAT,CAAgBkC,UAAhB,CAA6B,MACnE,CAED4C,CAAQ,CAAC9E,MAAT,CAAgBS,MAAhB,CAAuBoB,WAAvB,CAAmCN,CAAnC,CACH,CACJ,CA5TE,CA+TH6F,iBAAiB,CAAE,2BAAUC,CAAV,CAAavC,CAAb,CAAuB,CACtC,GAAIlE,CAAAA,CAAG,CAAGyG,CAAC,CAACC,aAAZ,CACA,GAAsB,CAAlB,EAAA1G,CAAG,CAACG,UAAR,CAAyB,CAErB+D,CAAQ,CAACzE,MAAT,CAAgBkH,yBAAhB,GAGA3H,CAAC,CAACqF,MAAD,CAAD,CAAUuC,GAAV,CAAc,cAAd,CAA8B,KAAKC,uBAAnC,EAEA,GAAkB,GAAd,EAAA7G,CAAG,CAACI,MAAR,CAAuB,CACnB,GAAIiB,CAAAA,CAAQ,CAAG6C,CAAQ,CAAC9E,MAAT,CAAgBiC,QAA/B,CACA,GAAI,CAACA,CAAL,CAAe,CACXA,CAAQ,CAAG6C,CAAQ,CAACV,eAAT,CAAyBxD,CAAG,CAACM,YAA7B,CACd,CACD,GAAI,CAACe,CAAL,CAAe,CACXpC,CAAG,CAACE,KAAJ,CAAU,kBAAV,EACAF,CAAG,CAACE,KAAJ,CAAUa,CAAV,EACA,MACH,CAKD,GAAIkE,CAAQ,CAAC9E,MAAT,CAAgBiG,WAApB,CAAiC,CAC7B,KAAKF,uBAAL,CAA6BjB,CAA7B,CAAuC7C,CAAvC,CAAiD,GAAjD,CACH,CAFD,IAEO,CACH,KAAK+E,wBAAL,CAA8BlC,CAA9B,CAAwC7C,CAAxC,CACH,CAGD,KAAKwD,oBAAL,CAA0BX,CAAQ,CAAC9E,MAAT,CAAgB0F,QAA1C,CAEH,CAvBD,IAuBO,CACH7F,CAAG,CAACE,KAAJ,CAAU,kBAAV,EACAF,CAAG,CAACE,KAAJ,CAAUa,CAAV,EACAkE,CAAQ,CAACzE,MAAT,CAAgBgF,WAAhB,CAA4B3B,CAAC,CAAC4B,IAAF,CAAOC,UAAP,CAAkB,mBAAlB,CAAuC,eAAvC,CAA5B,CAAqF,mBAArF,EAGA,KAAKM,oBAAL,CAA0Bf,CAAQ,CAAC9E,MAAT,CAAgB0F,QAA1C,CAEH,CACJ,CAEJ,CA1WE,CA4WH+B,uBAAuB,CAAE,kCAAU,CAC/B,MAAO/D,CAAAA,CAAC,CAAC4B,IAAF,CAAOC,UAAP,CAAkB,8BAAlB,CAAkD,eAAlD,CACV,CA9WE,CAiXHpB,UAAU,CAAE,oBAAUuD,CAAV,CAAoBlE,CAApB,CAAoC,IAExC5C,CAAAA,CAAG,CAAG,GAAIC,CAAAA,cAF8B,CAGxCb,CAAM,CAAG,KAAKA,MAH0B,CAIxC8E,CAAQ,CAAG,IAJ6B,CAOxC6C,CAAS,CAAG,KAAKhD,kBAAL,CAAwBnB,CAAxB,CAP4B,CAU5C,GAAiC,WAA7B,QAAOxD,CAAAA,CAAM,CAACiG,WAAlB,CAA8C,CAC1CjG,CAAM,CAACiG,WAAP,GACH,CAGD,GAAI2B,CAAAA,CAAQ,CAAG5H,CAAM,CAAC4H,QAAtB,CAGA,KAAKvH,MAAL,CAAYwH,mBAAZ,CAAgCjH,CAAhC,EAGAhB,CAAC,CAACqF,MAAD,CAAD,CAAUvE,EAAV,CAAa,cAAb,CAA6B,KAAK+G,uBAAlC,EAGA,KAAKpH,MAAL,CAAYgF,WAAZ,CAAwB3B,CAAC,CAAC4B,IAAF,CAAOC,UAAP,CAAkB,iBAAlB,CAAqC,eAArC,CAAxB,CAA+E,iBAA/E,EAGAT,CAAQ,CAAC9E,MAAT,CAAgBwD,cAAhB,CAAiCA,CAAjC,CACAsB,CAAQ,CAAC9E,MAAT,CAAgBoG,cAAhB,CAAiCtB,CAAQ,CAAC9E,MAAT,CAAgBkC,UAAjD,CAEAtB,CAAG,CAACE,kBAAJ,CAAyB,SAAUuG,CAAV,CAAa,CAClC,GAAIO,CAAQ,EAAwB,CAApB,QAAK7G,UAArB,CAAuC,CACnC,GAAIf,CAAM,CAACiG,WAAX,CAAwB,CACpBnB,CAAQ,CAACgD,gBAAT,CAA0BhD,CAA1B,CAAoC6C,CAApC,CACH,CAFD,IAEO,CAEH7C,CAAQ,CAACiD,qBAAT,CAA+BjD,CAA/B,CACH,CACJ,CACDA,CAAQ,CAACsC,iBAAT,CAA2BC,CAA3B,CAA8BvC,CAA9B,CAEH,CAXD,CAaA,GAAI8C,CAAJ,CAAc,CACVhH,CAAG,CAACiD,IAAJ,CAAS,KAAT,CAAgB7D,CAAM,CAAC+B,OAAvB,KACAnB,CAAG,CAACkD,gBAAJ,CAAqB,cAArB,CAAqC,0BAArC,EACAlD,CAAG,CAACmD,IAAJ,CAAS2D,CAAT,CACH,CAJD,IAIO,CAIH,GAAI,EAAEA,CAAQ,WAAYM,CAAAA,IAAtB,CAAJ,CAAiC,CAC7B,GAAIC,CAAAA,CAAM,CAAG,qBAAb,CAGAA,CAAM,EAAI,aAAeC,kBAAkB,CAACR,CAAD,CAA3C,CACAO,CAAM,EAAI,aAAeN,CAAzB,CACAM,CAAM,EAAI,eAAiBjI,CAAM,CAAC2C,SAAlC,CACAsF,CAAM,EAAI,cAAgBjI,CAAM,CAAC0F,QAAjC,CACAuC,CAAM,EAAI,cAAgBjI,CAAM,CAACmI,EAAjC,CACAF,CAAM,EAAI,cAAgBjI,CAAM,CAACoI,EAAjC,CACAH,CAAM,EAAI,aAAejI,CAAM,CAACqI,EAAhC,CACAJ,CAAM,EAAI,WAAajI,CAAM,CAACsI,EAA9B,CAEA1H,CAAG,CAACiD,IAAJ,CAAS,MAAT,CAAiB7D,CAAM,CAAC+B,OAAxB,KACAnB,CAAG,CAACkD,gBAAJ,CAAqB,cAArB,CAAqC,mCAArC,EACAlD,CAAG,CAACkD,gBAAJ,CAAqB,eAArB,CAAsC,UAAtC,EAGAlD,CAAG,CAACmD,IAAJ,CAASkE,CAAT,CACH,CAnBD,IAmBO,CAEH,GAAIM,CAAAA,CAAM,CAAG,GAAItD,CAAAA,MAAM,CAACuD,UAAxB,CACAD,CAAM,CAACE,aAAP,CAAqBf,CAArB,EACAa,CAAM,CAACG,SAAP,CAAmB,UAAY,IACvBC,CAAAA,CAAc,CAAGJ,CAAM,CAACK,MADD,CAGvBX,CAAM,CAAG,qBAHc,CAM3BA,CAAM,EAAI,aAAeC,kBAAkB,CAACS,CAAD,CAA3C,CACAV,CAAM,EAAI,aAAeN,CAAzB,CACAM,CAAM,EAAI,eAAiBjI,CAAM,CAAC2C,SAAlC,CACAsF,CAAM,EAAI,cAAgBjI,CAAM,CAAC0F,QAAjC,CACAuC,CAAM,EAAI,cAAgBjI,CAAM,CAACmI,EAAjC,CACAF,CAAM,EAAI,cAAgBjI,CAAM,CAACoI,EAAjC,CACAH,CAAM,EAAI,aAAejI,CAAM,CAACqI,EAAhC,CACAJ,CAAM,EAAI,WAAajI,CAAM,CAACsI,EAA9B,CAEA1H,CAAG,CAACiD,IAAJ,CAAS,MAAT,CAAiB7D,CAAM,CAAC+B,OAAxB,KACAnB,CAAG,CAACkD,gBAAJ,CAAqB,cAArB,CAAqC,mCAArC,EACAlD,CAAG,CAACkD,gBAAJ,CAAqB,eAArB,CAAsC,UAAtC,EAGAlD,CAAG,CAACmD,IAAJ,CAASkE,CAAT,CACH,CACJ,CACJ,CACJ,CAndE,CAqdHH,gBAAgB,CAAE,0BAAUhD,CAAV,CAAoB6C,CAApB,CAA+B,CAC7C,GAAI3H,CAAAA,CAAM,CAAG8E,CAAQ,CAAC9E,MAAtB,CAOA,OAAQA,CAAM,CAAC2C,SAAf,EACI,IAAK,OAAL,CAEImC,CAAQ,CAAC9E,MAAT,CAAgBoG,cAAhB,CAAiCpG,CAAM,CAACkC,UAAP,CAAkB2G,OAAlB,CAA0B,MAA1B,CAAkC,IAAMlB,CAAxC,CAAjC,CACA,GAAI,CAAC3H,CAAM,CAACiD,SAAZ,CAAuB,CACnB6B,CAAQ,CAAC9E,MAAT,CAAgBkC,UAAhB,CAA6B4C,CAAQ,CAAC9E,MAAT,CAAgBoG,cAA7C,CAEAtB,CAAQ,CAAC9E,MAAT,CAAgBoC,aAAhB,CAAgC0C,CAAQ,CAAC9E,MAAT,CAAgBkC,UACnD,CACD,MACJ,IAAK,OAAL,CACI4C,CAAQ,CAAC9E,MAAT,CAAgBoG,cAAhB,CAAiCpG,CAAM,CAACkC,UAAP,CAAkB2G,OAAlB,CAA0B,MAA1B,CAAkC,IAAMlB,CAAxC,CAAjC,CACA,GAAI,CAAC3H,CAAM,CAACiD,SAAZ,CAAuB,CACnB6B,CAAQ,CAAC9E,MAAT,CAAgBkC,UAAhB,CAA6B4C,CAAQ,CAAC9E,MAAT,CAAgBoG,cAChD,CACD,MAfR,CAiBH,CA9eE,CAgfH2B,qBAAqB,CAAE,+BAAUjD,CAAV,CAAoB,IACnC9E,CAAAA,CAAM,CAAG8E,CAAQ,CAAC9E,MADiB,CAEjC8I,CAAQ,CAAG,GAAIC,CAAAA,QAFkB,CAGvCD,CAAQ,CAACE,MAAT,CAAgB,UAAhB,CAA4B,gBAA5B,EACAF,CAAQ,CAACE,MAAT,CAAgB,WAAhB,CAA6BhJ,CAAM,CAACmI,EAApC,EACAW,CAAQ,CAACE,MAAT,CAAgB,WAAhB,CAA6BhJ,CAAM,CAACoI,EAApC,EACAU,CAAQ,CAACE,MAAT,CAAgB,UAAhB,CAA4BhJ,CAAM,CAACqI,EAAnC,EACAS,CAAQ,CAACE,MAAT,CAAgB,QAAhB,CAA0BhJ,CAAM,CAACsI,EAAjC,EACAQ,CAAQ,CAACE,MAAT,CAAgB,UAAhB,CAA4BhJ,CAAM,CAACiC,QAAnC,EACA6G,CAAQ,CAACE,MAAT,CAAgB,WAAhB,CAA6BhJ,CAAM,CAAC2C,SAApC,EAEA,GAAI,CAACsG,SAAS,CAACC,UAAf,CAA2B,CACvBD,SAAS,CAACC,UAAV,CAAuB,SAAU1C,CAAV,CAAe2C,CAAf,CAAwB,CAC3ClE,MAAM,CAACmE,KAAP,CAAa5C,CAAb,CAAkB,CAACC,MAAM,CAAE,MAAT,CAAiB4C,IAAI,CAAEF,CAAvB,CAAgCG,WAAW,CAAE,SAA7C,CAAlB,CACH,CACJ,CAGDL,SAAS,CAACC,UAAV,CAAqBxF,CAAC,CAACC,GAAF,CAAMC,OAAN,CAAgB,kCAArC,CAAyEkF,CAAzE,CAiCH,CAniBE,CAsiBH3B,qBAAqB,CAAE,+BAAUoC,CAAV,CAAwBC,CAAxB,CAAiCC,CAAjC,CAAuC,CAK1D,OAFIC,CAAAA,CAAU,CAAGH,CAAY,CAACI,KAAb,CAAmB,GAAnB,CAEjB,CADIC,CAAI,CAAGF,CAAU,CAACG,GAAX,EACX,CAASC,CAAC,CAAG,CAAb,CAAgBA,CAAC,CAAGJ,CAAU,CAAChF,MAA/B,CAAuCoF,CAAC,EAAxC,CAA4C,CACxCN,CAAO,CAAGA,CAAO,CAACE,CAAU,CAACI,CAAD,CAAX,CACpB,CACD,MAAON,CAAAA,CAAO,CAACI,CAAD,CAAP,CAAcG,IAAd,CAAmB,IAAnB,CAAyBN,CAAzB,CACV,CA/iBE,CAijBHO,aAAa,CAAE,uBAAUC,CAAV,CAAmBC,CAAnB,CAA6B,CAIxC,OAHIC,CAAAA,CAAU,CAAGC,IAAI,CAACH,CAAO,CAACN,KAAR,CAAc,GAAd,EAAmB,CAAnB,CAAD,CAGrB,CAFIU,CAAE,CAAG,GAAIC,CAAAA,WAAJ,CAAgBH,CAAU,CAACzF,MAA3B,CAET,CADI6F,CAAE,CAAG,GAAIC,CAAAA,UAAJ,CAAeH,CAAf,CACT,CAASP,CAAC,CAAG,CAAb,CAAgBA,CAAC,CAAGK,CAAU,CAACzF,MAA/B,CAAuCoF,CAAC,EAAxC,CAA4C,CACxCS,CAAE,CAACT,CAAD,CAAF,CAAQK,CAAU,CAACM,UAAX,CAAsBX,CAAtB,CACX,CACD,MAAO,IAAI9B,CAAAA,IAAJ,CAAS,CAACqC,CAAD,CAAT,CAAe,CAAC5I,IAAI,CAAEyI,CAAP,CAAf,CACV,CAzjBE,CA4jBHQ,MAAM,CAAE,gBAAUC,CAAV,CAAe,CACnB,KAAKtK,MAAL,CAAYgF,WAAZ,CAAwBsF,CAAxB,CAA6B,iBAA7B,CACH,CA9jBE,CAgkBV,CAtkBK,CAAN","sourcesContent":["/* jshint ignore:start */\ndefine(['jquery', 'core/log', 'filter_poodll/upskin_plain'], function ($, log, upskin_plain) {\n\n \"use strict\"; // jshint ;_;\n\n log.debug('Universal Uploader: initialising');\n\n return {\n\n config: null,\n\n //for making multiple instances\n clone: function () {\n return $.extend(true, {}, this);\n },\n\n init: function (element, config, upskin) {\n this.config = config;\n if (upskin) {\n this.upskin = upskin;\n } else {\n this.upskin = upskin_plain.clone();\n this.upskin.init(config, element, false, false);\n }\n this.upskin.initControls();\n this.registerEvents();\n },\n\n registerEvents: function () {\n var that = this;\n //whteboard does not have a hermes\n if(this.config.hermes) {\n this.config.hermes.on('fetch_upload_url', function (e) {\n that.fetchNewUploadDetails();\n });\n }\n },\n\n fetchNewUploadDetails: function () {\n\n //The REST API we are calling\n var functionname = 'local_cpapi_fetch_upload_details';\n\n //fetch the Posturl. We need this.\n //set up our ajax request\n var xhr = new XMLHttpRequest();\n var that = this;\n\n //set up our handler for the response\n xhr.onreadystatechange = function (e) {\n if (this.readyState === 4) {\n if (xhr.status == 200) {\n\n //get a yes or forgetit or tryagain\n var payload = xhr.responseText;\n var payloadobject = JSON.parse(payload);\n if (payloadobject) {\n\n //returnCode > 0 indicates an error\n if (payloadobject.returnCode > 0) {\n //We alert the iframe host that something did not go right\n var messageObject = {};\n messageObject.id = that.config.id;\n messageObject.type = \"error\";\n messageObject.code = payloadobject.returnCode;\n messageObject.message = payloadobject.returnMessage;\n that.config.hermes.postMessage(messageObject);\n return;\n //if all good, then lets do the embed\n } else {\n that.config.allowedURL = payloadobject.allowedURL;\n that.config.posturl = payloadobject.postURL;\n that.config.filename = payloadobject.filename;\n that.config.s3filename = payloadobject.s3filename;\n that.config.s3root = payloadobject.s3root;\n that.config.cloudfilename = payloadobject.shortfilename;\n that.config.cloudroot = payloadobject.shortroot;\n }\n\n } else {\n log.debug('error:' + payloadobject.message);\n\n }\n } else {\n log.debug('Not 200 response:' + xhr.status);\n }\n }\n };\n\n //log.debug(params);\n var xhrparams = \"wstoken=\" + this.config.wstoken\n + \"&wsfunction=\" + functionname\n + \"&moodlewsrestformat=\" + this.config.moodlewsrestformat\n + \"&mediatype=\" + this.config.mediatype\n + '&parent=' + this.config.parent\n + '&appid=' + this.config.appid\n + '&owner=' + this.config.owner\n + '®ion=' + this.config.region\n + '&expiredays=' + this.config.expiredays\n + '&transcode=' + this.config.transcode\n + '&transcoder=' + this.config.transcoder\n + '&transcribe=' + this.config.transcribe\n + '&subtitle=' + this.config.subtitle\n + '&transcribelanguage=' + this.config.language\n + '&transcribevocab=' + this.config.transcribevocab\n + '¬ificationurl=' + this.config.notificationurl\n + '&sourcemimetype=' + this.config.sourcemimetype;\n\n var serverurl = M.cfg.wwwroot + \"/webservice/rest/server.php\";\n xhr.open(\"POST\", serverurl, true);\n xhr.setRequestHeader(\"Cache-Control\", \"no-cache\");\n xhr.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded\");\n xhr.send(xhrparams);\n },\n\n uploadBlob: function (blob, filetype) {\n this.uploadFile(blob, filetype);\n return;\n },\n //extract filename from the text returned as response to upload\n extractFilename: function (returntext) {\n var searchkey = \"success\";\n var start = returntext.indexOf(searchkey);\n if (start < 1) {\n return false;\n }\n var end = returntext.indexOf(\"\");\n var filename = returntext.substring(start + (searchkey.length), end);\n return filename;\n },\n\n //fetch file extension from the filetype\n fetchFileExtension: function (filetype) {\n var ext = \"\";\n //Might need more mimetypes than this, and 3gpp maynot work\n switch (filetype) {\n case \"image/jpeg\":\n ext = \"jpg\";\n break;\n case \"image/png\":\n ext = \"png\";\n break;\n case \"audio/wav\":\n ext = \"wav\";\n break;\n case \"audio/ogg\":\n ext = \"ogg\";\n break;\n case \"video/quicktime\":\n ext = \"mov\";\n break;\n case \"audio/mpeg3\":\n ext = \"mp3\";\n break;\n case \"audio/mp3\":\n ext = \"mp3\";\n break;\n case \"audio/webm\":\n ext = \"webm\";\n break;\n case \"audio/x-mpeg-3\":\n ext = \"mp3\";\n break;\n case \"audio/3gpp\":\n ext = \"3gpp\";\n break;\n case \"video/mpeg3\":\n ext = \"3gpp\";\n break;\n case \"video/mp4\":\n ext = \"mp4\";\n break;\n case \"video/webm\":\n ext = \"webm\";\n break;\n case \"video/ogg\":\n ext = \"ogg\";\n break;\n }\n return ext;\n },\n\n pokeFilename: function (filename, uploader) {\n\n var upc = '';\n if (typeof uploader.config.updatecontrol !== 'undefined' && uploader.config.updatecontrol !== '') {\n upc = $('[id=\"' + uploader.config.updatecontrol + '\"]');\n //the code below used to work until odd chars in question id annoyed jquery 3\n //upc = $('#' + uploader.config.updatecontrol);\n }\n if (upc.length < 1) {\n upc = $('[id=\"' + uploader.config.updatecontrol + '\"]', window.parent.document);\n }\n if (upc.length > 0) {\n upc.get(0).value = filename;\n } else {\n log.debug('upload failed #2');\n uploader.upskin.showMessage(M.util.get_string('recui_uploaderror', 'filter_poodll'), 'recui_uploaderror');\n return false;\n }\n upc.trigger('change');\n return true;\n },\n\n alertRecorderSuccess: function (widgetid) {\n if (this.config.hasOwnProperty('onuploadsuccess')) {\n this.config.onuploadsuccess(widgetid);\n }\n },\n\n alertRecorderFailure: function (widgetid) {\n if (this.config.hasOwnProperty('onuploadfailure')) {\n this.config.onuploadfailure(widgetid);\n }\n },\n\n //We can detect conversion by pinging the s3 out filename\n //this is only done in the iFrame\n completeAfterProcessing: function (uploader, filename, waitms) {\n\n //alert the skin that we are awaiting processing\n this.upskin.showMessage(M.util.get_string('recui_awaitingconversion', 'filter_poodll'), 'recui_awaitingconversion');\n\n //this will always be true ...\n if (uploader.config.iframeembed) {\n filename = uploader.config.s3root + uploader.config.s3filename;\n }\n\n //We alert the iframe host that a file is now awaiting conversion\n var messageObject = {};\n messageObject.type = \"awaitingprocessing\";\n messageObject.mediaurl = filename;\n messageObject.mediafilename = uploader.config.s3filename;\n messageObject.sourcefilename = uploader.config.sourcefilename;\n messageObject.sourcemimetype = uploader.config.sourcemimetype;\n messageObject.s3root = uploader.config.s3root;\n messageObject.id = uploader.config.id;\n messageObject.updatecontrol = uploader.config.updatecontrol;\n if (uploader.config.transcribe) {\n messageObject.transcripturl = filename + '.txt';\n messageObject.transcriptfilename = uploader.config.s3filename + '.txt';\n }\n uploader.config.hermes.postMessage(messageObject);\n\n //we commence a series of ping and retries until the recorded file is available\n var that = this;\n $.ajax({\n url: uploader.config.s3root + uploader.config.s3filename,\n method: 'HEAD',\n cache: false,\n error: function () {\n //We get here if its a 404 or 403. So settimout here and wait for file to arrive\n //we increment the timeout period each time to prevent bottlenecks\n log.debug('403 errors are normal here, till the file arrives back from conversion');\n setTimeout(function () {\n that.completeAfterProcessing(uploader, filename, waitms + 500);\n }, waitms);\n },\n success: function (data, textStatus, xhr) {\n switch (xhr.status) {\n case 200:\n that.doUploadCompleteCallback(uploader, filename);\n break;\n default:\n setTimeout(function () {\n that.completeAfterProcessing(uploader, filename, waitms + 500);\n }, waitms);\n }\n\n }\n });\n },\n\n doUploadCompleteCallback: function (uploader, filename) {\n\n //in the case of an iframeembed we need a full URL not just a filename\n if (uploader.config.iframeembed) {\n filename = uploader.config.s3root + uploader.config.s3filename;\n }\n\n //For callbackjs and for postmessage we need an array of stuff\n var callbackObject = new Array();\n callbackObject[0] = uploader.config.widgetid;\n callbackObject[1] = \"filesubmitted\";\n callbackObject[2] = filename;\n callbackObject[3] = uploader.config.updatecontrol;\n callbackObject[4] = uploader.config.s3filename;\n\n //alert the skin that we were successful\n this.upskin.showMessage(M.util.get_string('recui_uploadsuccess', 'filter_poodll'), 'recui_uploadsuccess');\n\n //invoke callbackjs if we have one, otherwise just update the control(default behav.)\n if (!uploader.config.iframeembed) {\n if (uploader.config.callbackjs && uploader.config.callbackjs != '') {\n if (typeof(uploader.config.callbackjs) === 'function') {\n uploader.config.callbackjs(callbackObject);\n } else {\n //this was the old rubbish way, where the callback was a function name\n this.executeFunctionByName(uploader.config.callbackjs, window, callbackObject);\n }\n } else {\n //by default we just poke the filename\n uploader.pokeFilename(filename, uploader);\n }\n } else {\n //in the case of an iframeembed we will also post a message to the host, they can choose to handle it or not\n //The callback object above scan prob. be phased out. But not all integrations will use iframes either.\n var messageObject = {};\n messageObject.type = \"filesubmitted\";\n messageObject.mediaurl = uploader.config.s3root + uploader.config.s3filename;\n messageObject.mediafilename = uploader.config.s3filename;\n messageObject.sourcefilename = uploader.config.sourcefilename;\n messageObject.sourcemimetype = uploader.config.sourcemimetype;\n messageObject.s3root = uploader.config.s3root;\n messageObject.id = uploader.config.id;\n messageObject.updatecontrol = uploader.config.updatecontrol;\n if (uploader.config.transcribe) {\n messageObject.transcripturl = uploader.config.s3root + uploader.config.s3filename + '.txt';\n messageObject.transcriptfilename = uploader.config.s3filename + '.txt';\n }\n\n uploader.config.hermes.postMessage(messageObject);\n }\n },\n\n //after an upload handle the filename poke and callback call\n postProcessUpload: function (e, uploader) {\n var xhr = e.currentTarget;\n if (xhr.readyState == 4) {\n\n uploader.upskin.deactivateProgressSession();\n\n //deactivate premature leaving\n $(window).off('beforeunload', this.preventPrematureLeaving);\n\n if (xhr.status == 200) {\n var filename = uploader.config.filename;\n if (!filename) {\n filename = uploader.extractFilename(xhr.responseText);\n }\n if (!filename) {\n log.debug('upload failed #1');\n log.debug(xhr);\n return;\n }\n\n //Alert any listeners about the upload complete\n //in an iframeembed we only do this after conversion is complete. so we run a poll to check compl.\n //in standard Moodle we have a placeholder file to deal with any slow conversions. so we don't poll\n if (uploader.config.iframeembed) {\n this.completeAfterProcessing(uploader, filename, 1000);\n } else {\n this.doUploadCompleteCallback(uploader, filename);\n }\n\n //alert the recorder that this was successful\n this.alertRecorderSuccess(uploader.config.widgetid);\n\n } else {\n log.debug('upload failed #3');\n log.debug(xhr);\n uploader.upskin.showMessage(M.util.get_string('recui_uploaderror', 'filter_poodll'), 'recui_uploaderror');\n\n //alert the recorder that this failed\n this.alertRecorderFailure(uploader.config.widgetid);\n\n } //end of if status 200\n }//end of if ready state 4\n\n },\n\n preventPrematureLeaving: function(){\n return M.util.get_string('recui_waitwaitstilluploading', 'filter_poodll');\n },\n\n // upload Media file to wherever\n uploadFile: function (filedata, sourcemimetype) {\n\n var xhr = new XMLHttpRequest();\n var config = this.config;\n var uploader = this;\n\n //get the file extension from the filetype\n var sourceext = this.fetchFileExtension(sourcemimetype);\n\n //is this an iframe embed\n if (typeof config.iframeembed == 'undefined') {\n config.iframeembed = false;\n }\n\n //are we using s3\n var using_s3 = config.using_s3;\n\n //Handle UI display of this upload\n this.upskin.initProgressSession(xhr);\n\n //Add a page unload check ..\n $(window).on('beforeunload', this.preventPrematureLeaving);\n\n //alert user that we are now uploading\n this.upskin.showMessage(M.util.get_string('recui_uploading', 'filter_poodll'), 'recui_uploading');\n\n //init sourcemimetype and sourcefilename\n uploader.config.sourcemimetype = sourcemimetype;\n uploader.config.sourcefilename = uploader.config.s3filename;\n\n xhr.onreadystatechange = function (e) {\n if (using_s3 && this.readyState === 4) {\n if (config.iframeembed) {\n uploader.update_filenames(uploader, sourceext);\n } else {\n //ping Moodle and inform that we have a new file\n uploader.postprocess_s3_upload(uploader);\n }\n }\n uploader.postProcessUpload(e, uploader);\n\n };\n\n if (using_s3) {\n xhr.open(\"put\", config.posturl, true);\n xhr.setRequestHeader(\"Content-Type\", 'application/octet-stream');\n xhr.send(filedata);\n } else {\n\n //We NEED to redo this bit of code ..\n //its duplicating!!!\n if (!(filedata instanceof Blob)) {\n var params = \"datatype=uploadfile\";\n //We must URI encode the filedata, because otherwise the \"+\" characters get turned into spaces\n //spent hours tracking that down ...justin 20121012\n params += \"¶mone=\" + encodeURIComponent(filedata);\n params += \"¶mtwo=\" + sourceext;\n params += \"¶mthree=\" + config.mediatype;\n params += \"&requestid=\" + config.widgetid;\n params += \"&contextid=\" + config.p2;\n params += \"&component=\" + config.p3;\n params += \"&filearea=\" + config.p4;\n params += \"&itemid=\" + config.p5;\n\n xhr.open(\"POST\", config.posturl, true);\n xhr.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded\");\n xhr.setRequestHeader(\"Cache-Control\", \"no-cache\");\n //xhr.setRequestHeader(\"Content-length\", params.length);\n //xhr.setRequestHeader(\"Connection\", \"close\");\n xhr.send(params);\n } else {\n //we have to base64 string the blob before sending it\n var reader = new window.FileReader();\n reader.readAsDataURL(filedata);\n reader.onloadend = function () {\n var base64filedata = reader.result;\n //log.debug(params);\n var params = \"datatype=uploadfile\";\n //We must URI encode the filedata, because otherwise the \"+\" characters get turned into spaces\n //spent hours tracking that down ...justin 20121012\n params += \"¶mone=\" + encodeURIComponent(base64filedata);\n params += \"¶mtwo=\" + sourceext;\n params += \"¶mthree=\" + config.mediatype;\n params += \"&requestid=\" + config.widgetid;\n params += \"&contextid=\" + config.p2;\n params += \"&component=\" + config.p3;\n params += \"&filearea=\" + config.p4;\n params += \"&itemid=\" + config.p5;\n\n xhr.open(\"POST\", config.posturl, true);\n xhr.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded\");\n xhr.setRequestHeader(\"Cache-Control\", \"no-cache\");\n // xhr.setRequestHeader(\"Content-length\", params.length);\n // xhr.setRequestHeader(\"Connection\", \"close\");\n xhr.send(params);\n };//end of fileread on load end\n }//end of if blob\n }//end of if using_s3\n },\n\n update_filenames: function (uploader, sourceext) {\n var config = uploader.config;\n\n //now its a bit hacky, but\n // only now do we know the true final file extension (ext) and mimetype of unconv. media\n // so we want to save that and if the user is NOT transcoding,\n //we want to change the s3filename from the default mp4/mp3 to whatever the mimetype inidicates, ie sourceext\n\n switch (config.mediatype) {\n case 'audio':\n //source info\n uploader.config.sourcefilename = config.s3filename.replace('.mp3', '.' + sourceext);\n if (!config.transcode) {\n uploader.config.s3filename = uploader.config.sourcefilename;\n //do we need this, I think its old and noone uses it.\n uploader.config.cloudfilename = uploader.config.s3filename;\n }\n break;\n case 'video':\n uploader.config.sourcefilename = config.s3filename.replace('.mp4', '.' + sourceext);\n if (!config.transcode) {\n uploader.config.s3filename = uploader.config.sourcefilename;\n }\n break;\n }\n },\n\n postprocess_s3_upload: function (uploader) {\n var config = uploader.config;\n const formData = new FormData();\n formData.append(\"datatype\", \"handles3upload\");\n formData.append(\"contextid\", config.p2);\n formData.append(\"component\", config.p3);\n formData.append(\"filearea\", config.p4);\n formData.append(\"itemid\", config.p5);\n formData.append(\"filename\", config.filename);\n formData.append(\"mediatype\", config.mediatype);\n //navigator beacon polyfill\n if (!navigator.sendBeacon) {\n navigator.sendBeacon = function (url, thedata) {\n window.fetch(url, {method: 'POST', body: thedata, credentials: 'include'});\n };\n }\n //we use navigator beacon over xhr because there are times believe it or not, when a page load happens and that kills\n //the request. causing lost files\n navigator.sendBeacon(M.cfg.wwwroot + '/filter/poodll/poodllfilelib.php', formData);\n return;\n\n /*\n var xhr = new XMLHttpRequest();\n var that = this;\n\n //lets do a little error checking\n //if its a self signed error or rotten permissions on poodllfilelib.php we might error here.\n xhr.onreadystatechange = function(){\n if(this.readyState===4){\n if(xhr.status!=200){\n that.upskin.showMessage('Post Process s3 Upload Error:' + xhr.status, 'recui_uploaderror');\n $('#' + that.config.widgetid + '_messages').show();\n }\n }\n };\n\n //log.debug(params);\n var params = \"datatype=handles3upload\";\n params += \"&contextid=\" + config.p2;\n params += \"&component=\" + config.p3;\n params += \"&filearea=\" + config.p4;\n params += \"&itemid=\" + config.p5;\n params += \"&filename=\" + config.filename;\n params += \"&mediatype=\" + config.mediatype;\n\n xhr.open(\"POST\",M.cfg.wwwroot + '/filter/poodll/poodllfilelib.php', true);\n xhr.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded\");\n xhr.setRequestHeader(\"Cache-Control\", \"no-cache\");\n xhr.send(params);\n */\n\n },\n\n //function to call the callback function with arguments\n executeFunctionByName: function (functionName, context, args) {\n\n //var args = Array.prototype.slice.call(arguments).splice(2);\n var namespaces = functionName.split(\".\");\n var func = namespaces.pop();\n for (var i = 0; i < namespaces.length; i++) {\n context = context[namespaces[i]];\n }\n return context[func].call(this, args);\n },\n\n dataURItoBlob: function (dataURI, mimetype) {\n var byteString = atob(dataURI.split(',')[1]);\n var ab = new ArrayBuffer(byteString.length);\n var ia = new Uint8Array(ab);\n for (var i = 0; i < byteString.length; i++) {\n ia[i] = byteString.charCodeAt(i);\n }\n return new Blob([ab], {type: mimetype});\n },//end of dataURItoBlob\n\n //some recorder skins call this directly, so we just pass it through to the upskin\n Output: function (msg) {\n this.upskin.showMessage(msg, 'recorderskinmsg');\n }\n };//end of returned object\n});//total end\n"],"file":"uploader.min.js"} \ No newline at end of file diff --git a/amd/build/upskin_bar.min.js b/amd/build/upskin_bar.min.js index e59827ff..9a3e7059 100644 --- a/amd/build/upskin_bar.min.js +++ b/amd/build/upskin_bar.min.js @@ -1 +1,2 @@ -define(["jquery","core/log","filter_poodll/anim_progress_bar"],function(a,b,c){"use strict";return b.debug("upskin_bar: initialising"),{element:null,cvs:null,percent:0,progressbar:null,messagearea:null,clone:function(){return a.extend(!0,{},this)},init:function(a,b,d,e){this.config=a,this.element=b,this.cvs=d,this.progressbar=c.clone(),this.messagearea=e},initControls:function(){var a=this;this.progressbar.init(this.cvs,"#BCCCCC"),this.progressbar.fetchCurrent=function(){return a.percent}},initProgressSession:function(a){var b=this;b.percent=0;var c=M.util.get_string("recui_uploading","filter_poodll");a.upload.addEventListener("progress",function(a){a.lengthComputable&&(b.percent=a.loaded/a.total,b.showMessage(c+"("+Math.floor(100*b.percent)+"%)"))}),this.progressbar.start()},deactivateProgressSession:function(){this.progressbar.stopthere(),b.debug("deactivating session")},showMessage:function(a,b){this.messagearea.html(a)}}}); \ No newline at end of file +define ("filter_poodll/upskin_bar",["jquery","core/log","filter_poodll/anim_progress_bar"],function(a,b,c){"use strict";b.debug("upskin_bar: initialising");return{element:null,cvs:null,percent:0,progressbar:null,messagearea:null,clone:function clone(){return a.extend(!0,{},this)},init:function init(a,b,d,e){this.config=a;this.element=b;this.cvs=d;this.progressbar=c.clone();this.messagearea=e},initControls:function initControls(){var a=this;this.progressbar.init(this.cvs,"#BCCCCC");this.progressbar.fetchCurrent=function(){return a.percent}},initProgressSession:function initProgressSession(a){var b=this;b.percent=0;var c=M.util.get_string("recui_uploading","filter_poodll");a.upload.addEventListener("progress",function(a){if(a.lengthComputable){b.percent=a.loaded/a.total;b.showMessage(c+"("+Math.floor(100*b.percent)+"%)")}});this.progressbar.start()},deactivateProgressSession:function deactivateProgressSession(){this.progressbar.stopthere();b.debug("deactivating session")},showMessage:function showMessage(a){this.messagearea.html(a)}}}); +//# sourceMappingURL=upskin_bar.min.js.map diff --git a/amd/build/upskin_plain.min.js b/amd/build/upskin_plain.min.js index 5b140dac..198e01ba 100644 --- a/amd/build/upskin_plain.min.js +++ b/amd/build/upskin_plain.min.js @@ -1 +1,2 @@ -define(["jquery","core/log"],function(a,b){"use strict";return b.debug("upskin_plain: initialising"),{element:null,cvs:null,cvsctx:null,clone:function(){return a.extend(!0,{},this)},init:function(a,b,c,d){this.config=a,this.element=b,this.cvs=c,this.messagearea=d},initControls:function(){var b=this.config.media_skin_style,c='

';c+='
',a(this.element).append(c)},initProgressSession:function(b){var c=!1,d=a("#"+this.config.widgetid+"_progress");if(d.length){var e=d.get(0);c=e.firstChild,null===c&&(c=e.appendChild(document.createElement("p"))),c.className="",c.style.display="block",c.style.backgroundPosition="100% 0",b.upload.addEventListener("progress",function(a){var b=parseInt(100-a.loaded/a.total*100);c.style.backgroundPosition=b+"% 0"})}},deactivateProgressSession:function(){},showMessage:function(b,c){var d=a("#"+this.config.widgetid+"_messages");d.text(b)}}}); \ No newline at end of file +define ("filter_poodll/upskin_plain",["jquery","core/log"],function(a,b){"use strict";b.debug("upskin_plain: initialising");return{element:null,cvs:null,cvsctx:null,clone:function clone(){return a.extend(!0,{},this)},init:function init(a,b,c,d){this.config=a;this.element=b;this.cvs=c;this.messagearea=d},initControls:function initControls(){var b=this.config.media_skin_style,c="

";c+="
";a(this.element).append(c)},initProgressSession:function initProgressSession(b){var c=!1,d=a("#"+this.config.widgetid+"_progress");if(d.length){var e=d.get(0);c=e.firstChild;if(null===c){c=e.appendChild(document.createElement("p"))}c.className="";c.style.display="block";c.style.backgroundPosition="100% 0";b.upload.addEventListener("progress",function(a){var b=parseInt(100-100*(a.loaded/a.total));c.style.backgroundPosition=b+"% 0"})}},deactivateProgressSession:function deactivateProgressSession(){},showMessage:function showMessage(b){var c=a("#"+this.config.widgetid+"_messages");c.text(b)}}}); +//# sourceMappingURL=upskin_plain.min.js.map diff --git a/amd/build/upskin_radial.min.js b/amd/build/upskin_radial.min.js index bc0b8f61..5a212cae 100644 --- a/amd/build/upskin_radial.min.js +++ b/amd/build/upskin_radial.min.js @@ -1 +1,2 @@ -define(["jquery","core/log","filter_poodll/anim_progress_radial"],function(a,b,c){"use strict";return b.debug("upskin_bar: initialising"),{element:null,cvs:null,percent:0,progressradial:null,messagearea:null,clone:function(){return a.extend(!0,{},this)},init:function(a,b,d,e){this.config=a,this.element=b,this.cvs=d,this.progressradial=c.clone(),this.messagearea=e},setDrawParam:function(a,b){this.progressradial.setDrawParam(a,b)},initControls:function(){var a=this,b=!0;this.progressradial.init(this.cvs,"#93c47d",b),this.progressradial.fetchCurrent=function(){return a.percent}},initProgressSession:function(a){var b=this;b.percent=0;var c=M.util.get_string("recui_uploading","filter_poodll");a.upload.addEventListener("progress",function(a){a.lengthComputable&&(b.percent=a.loaded/a.total,b.showMessage(c+"("+Math.floor(100*b.percent)+"%)"))}),this.progressradial.start()},deactivateProgressSession:function(){this.progressradial.stop(),b.debug("deactivating session")},showMessage:function(a,b){switch(b){case"recui_awaitingconversion":break;default:this.messagearea.html(a)}}}}); \ No newline at end of file +define ("filter_poodll/upskin_radial",["jquery","core/log","filter_poodll/anim_progress_radial"],function(a,b,c){"use strict";b.debug("upskin_bar: initialising");return{element:null,cvs:null,percent:0,progressradial:null,messagearea:null,clone:function clone(){return a.extend(!0,{},this)},init:function init(a,b,d,e){this.config=a;this.element=b;this.cvs=d;this.progressradial=c.clone();this.messagearea=e},setDrawParam:function setDrawParam(a,b){this.progressradial.setDrawParam(a,b)},initControls:function initControls(){var a=this;this.progressradial.init(this.cvs,"#93c47d",!0);this.progressradial.fetchCurrent=function(){return a.percent}},initProgressSession:function initProgressSession(a){var b=this;b.percent=0;var c=M.util.get_string("recui_uploading","filter_poodll");a.upload.addEventListener("progress",function(a){if(a.lengthComputable){b.percent=a.loaded/a.total;b.showMessage(c+"("+Math.floor(100*b.percent)+"%)")}});this.progressradial.start()},deactivateProgressSession:function deactivateProgressSession(){this.progressradial.stop();b.debug("deactivating session")},showMessage:function showMessage(a,b){switch(b){case"recui_awaitingconversion":break;default:this.messagearea.html(a);}}}}); +//# sourceMappingURL=upskin_radial.min.js.map diff --git a/amd/build/upskin_text.min.js b/amd/build/upskin_text.min.js index f09e30f4..1aceb6bf 100644 --- a/amd/build/upskin_text.min.js +++ b/amd/build/upskin_text.min.js @@ -1 +1,2 @@ -define(["jquery","core/log"],function(a,b){"use strict";return b.debug("upskin_text: initialising"),{element:null,cvs:null,cvsctx:null,clone:function(){return a.extend(!0,{},this)},init:function(a,b,c,d){this.config=a,this.element=b,this.cvs=c,this.messagearea=d},initControls:function(){},initProgressSession:function(a){var b=this;b.percent=0;var c=M.util.get_string("recui_uploading","filter_poodll");a.upload.addEventListener("progress",function(a){a.lengthComputable&&(b.percent=a.loaded/a.total,b.showMessage(c+"("+Math.floor(100*b.percent)+"%)"))})},deactivateProgressSession:function(){b.debug("deactivating session")},showMessage:function(a,b){this.messagearea.html(a)}}}); \ No newline at end of file +define ("filter_poodll/upskin_text",["jquery","core/log"],function(a,b){"use strict";b.debug("upskin_text: initialising");return{element:null,cvs:null,cvsctx:null,clone:function clone(){return a.extend(!0,{},this)},init:function init(a,b,c,d){this.config=a;this.element=b;this.cvs=c;this.messagearea=d},initControls:function initControls(){},initProgressSession:function initProgressSession(a){var b=this;b.percent=0;var c=M.util.get_string("recui_uploading","filter_poodll");a.upload.addEventListener("progress",function(a){if(a.lengthComputable){b.percent=a.loaded/a.total;b.showMessage(c+"("+Math.floor(100*b.percent)+"%)")}})},deactivateProgressSession:function deactivateProgressSession(){b.debug("deactivating session")},showMessage:function showMessage(a){this.messagearea.html(a)}}}); +//# sourceMappingURL=upskin_text.min.js.map diff --git a/amd/build/util_dragdrop.min.js b/amd/build/util_dragdrop.min.js index fe3132e0..729aecf9 100644 --- a/amd/build/util_dragdrop.min.js +++ b/amd/build/util_dragdrop.min.js @@ -1 +1,2 @@ -define(["jquery","jqueryui","core/log"],function(a,b,c){"use strict";return c.debug("Poodll util drag drop: initialising"),{theelement:!1,uploadfunction:!1,uploader:!1,started:!1,filebutton:!1,init:function(a,b,d){this.theelement=a,this.uploadfunction=b,this.uploader=d.uploader,this.filebutton=d.controlbar.filebutton,this.supports_dragdrop(a)?(c.debug("registering drag drop"),this.register_dragdrop(),this.do_visuals()):c.debug("drag drop not supported")},clone:function(){return a.extend(!0,{},this)},supports_dragdrop:function(a){return"draggable"in a||"ondragstart"in a&&"ondrop"in a},do_visuals:function(){this.theelement.addClass("poodll-can-do-drag-drop")},turnoff_dragdrop:function(){this.theelement&&(this.theelement.removeClass("poodll-can-do-drag-drop"),this.theelement.removeClass("is-poodll-drag-over"),this.theelement.off("drag dragstart dragend dragover dragenter dragleave drop"),this.theelement.on("drag dragstart dragend dragover dragenter dragleave drop",function(a){a.preventDefault(),a.stopPropagation()}))},register_dragdrop:function(){var a=this;this.theelement.on("drag dragstart dragend dragover dragenter dragleave drop",function(b){b.preventDefault(),b.stopPropagation(),a.started}).on("dragover dragenter",function(){a.theelement.addClass("is-poodll-drag-over")}).on("dragleave dragend drop",function(){a.theelement.removeClass("is-poodll-drag-over")}).on("drop",function(b){if(!a.started){var c=b.originalEvent.dataTransfer.files;a.uploadfunction(c,a.uploader),a.turnoff_dragdrop(),a.filebutton.off("change"),a.filebutton.attr("disabled",!0),a.started=!0}})}}}); \ No newline at end of file +define ("filter_poodll/util_dragdrop",["jquery","jqueryui","core/log"],function(a,b,c){"use strict";c.debug("Poodll util drag drop: initialising");return{theelement:!1,uploadfunction:!1,uploader:!1,started:!1,filebutton:!1,init:function init(a,b,d){this.theelement=a;this.uploadfunction=b;this.uploader=d.uploader;this.filebutton=d.controlbar.filebutton;if(this.supports_dragdrop(a)){c.debug("registering drag drop");this.register_dragdrop();this.do_visuals()}else{c.debug("drag drop not supported")}},clone:function clone(){return a.extend(!0,{},this)},supports_dragdrop:function supports_dragdrop(a){return"draggable"in a||"ondragstart"in a&&"ondrop"in a},do_visuals:function do_visuals(){this.theelement.addClass("poodll-can-do-drag-drop")},turnoff_dragdrop:function turnoff_dragdrop(){if(!this.theelement){return}this.theelement.removeClass("poodll-can-do-drag-drop");this.theelement.removeClass("is-poodll-drag-over");this.theelement.off("drag dragstart dragend dragover dragenter dragleave drop");this.theelement.on("drag dragstart dragend dragover dragenter dragleave drop",function(a){a.preventDefault();a.stopPropagation()})},register_dragdrop:function register_dragdrop(){var a=this;this.theelement.on("drag dragstart dragend dragover dragenter dragleave drop",function(b){b.preventDefault();b.stopPropagation();if(a.started){}}).on("dragover dragenter",function(){a.theelement.addClass("is-poodll-drag-over")}).on("dragleave dragend drop",function(){a.theelement.removeClass("is-poodll-drag-over")}).on("drop",function(b){if(a.started){return}var c=b.originalEvent.dataTransfer.files;a.uploadfunction(c,a.uploader);a.turnoff_dragdrop();a.filebutton.off("change");a.filebutton.attr("disabled",!0);a.started=!0})}}}); +//# sourceMappingURL=util_dragdrop.min.js.map diff --git a/amd/build/utils_amd.min.js b/amd/build/utils_amd.min.js index a8cd1905..bc24a01d 100644 --- a/amd/build/utils_amd.min.js +++ b/amd/build/utils_amd.min.js @@ -1 +1,2 @@ -define(["jquery","core/log"],function(a,b){"use strict";return b.debug("Filter PoodLL: utils initialising"),{timeouthandles:[],WhiteboardUploadHandler:function(b,c,d,e){var f=a("#"+b+"_btn_upload_whiteboard")[0];f.disabled=!0,clearTimeout(this.timeouthandles[b]);var g=this.getCvs(b,c,d);this.pokeVectorData(b,c,d),e.uploadFile(g.toDataURL(),"image")},getCvs:function(a,b){if(0==a.indexOf("drawingboard_"))var c=b.canvas;else var c=b.canvasForExport();return c},escapeColon:function(a){return a.replace(/:/,"\\:")},pokeVectorData:function(c,d,e){var f="";f=0==c.indexOf("drawingboard_")?JSON.stringify(d.history,null,2):JSON.stringify(d.getSnapshot()),"undefined"!=typeof e.vectorcontrol&&""!==e.vectorcontrol&&(a("#"+this.escapeColon(e.vectorcontrol)).val(f),b.debug("Vectorcontrol:"+e.vectorcontrol))},_concatenateWavBlobs:function(a,b){for(var c=[],d=0,e=0,f=a.length,g=0;g-1},is_chrome:function(){var a=window.chrome,b=window.navigator,c=b.vendor,d=b.userAgent.indexOf("OPR")>-1,e=b.userAgent.indexOf("Edge")>-1,f=b.userAgent.match("CriOS");return!!f||null!==a&&"undefined"!=typeof a&&"Google Inc."===c&&d===!1&&e===!1},is_safari:function(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)},is_ios:function(){return/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream},is_opera:function(){return"undefined"!=typeof opera&&navigator.userAgent&&navigator.userAgent.indexOf("OPR/")!==-1},is_android:function(){var a=window.navigator.userAgent,b=a.indexOf("android")>-1||a.indexOf("Android")>-1;return b},is_ie:function(){var a=!1,b=window.navigator.userAgent,c=b.indexOf("MSIE "),d=b.indexOf("Trident/"),e=b.indexOf("Edge/");return(c>-1||d>-1||e>-1)&&(a=!0),a},parseQueryString:function(a){var b={};return a.replace(new RegExp("([^?=&]+)(=([^&]*))?","g"),function(a,c,d,e){b[c]=e}),b}}}); \ No newline at end of file +define ("filter_poodll/utils_amd",["jquery","core/log"],function(a,b){"use strict";b.debug("Filter PoodLL: utils initialising");return{timeouthandles:[],WhiteboardUploadHandler:function WhiteboardUploadHandler(b,c,d,e){var f=a("#"+b+"_btn_upload_whiteboard")[0];f.disabled=!0;clearTimeout(this.timeouthandles[b]);var g=this.getCvs(b,c,d);this.pokeVectorData(b,c,d);e.uploadFile(g.toDataURL(),"image")},getCvs:function getCvs(a,b){if(0==a.indexOf("drawingboard_")){var c=b.canvas}else{var c=b.canvasForExport()}return c},escapeColon:function escapeColon(a){return a.replace(/:/,"\\:")},pokeVectorData:function pokeVectorData(c,d,e){var f="";if(0==c.indexOf("drawingboard_")){f=JSON.stringify(d.history,null,2)}else{f=JSON.stringify(d.getSnapshot())}if("undefined"!=typeof e.vectorcontrol&&""!==e.vectorcontrol){a("#"+this.escapeColon(e.vectorcontrol)).val(f);b.debug("Vectorcontrol:"+e.vectorcontrol)}},_concatenateWavBlobs:function _concatenateWavBlobs(a,b){for(var c=[],d=0,e=0,f=a.length,g=0;g-1&&this.hooks[a].splice(c,1)}else this.hooks[a]=[]},dispatch:function(){var d=arguments[0].replace(/^on/i,"").toLowerCase(),e=Array.prototype.slice.call(arguments,1);if(this.hooks[d]&&this.hooks[d].length){for(var f=0,g=this.hooks[d].length;fERROR: the Webcam.js Flash fallback does not work from local disk. Please run it from a web server.';if(!this.detectFlash())return this.dispatch("error",new b("Adobe Flash Player not found. Please install from get.adobe.com/flashplayer and try again.")),'

'+this.params.flashNotDetectedText+"

";if(!d){for(var e="",f=document.getElementsByTagName("script"),g=0,h=f.length;g'},getMovie:function(){if(!this.loaded)return this.dispatch("error",new b("Flash Movie is not loaded yet"));var a=document.getElementById("webcam_movie_obj");return a&&a._snap||(a=document.getElementById("webcam_movie_embed")),a||this.dispatch("error",new b("Cannot locate Flash movie in DOM")),a},freeze:function(){var a=this,b=this.params;this.preview_active&&this.unfreeze();var c=this.params.width/this.params.dest_width,d=this.params.height/this.params.dest_height;this.unflip();var e=b.crop_width||b.dest_width,f=b.crop_height||b.dest_height,g=document.createElement("canvas");g.width=e,g.height=f;var h=g.getContext("2d");this.preview_canvas=g,this.preview_context=h,1==c&&1==d||(g.style.webkitTransformOrigin="0px 0px",g.style.mozTransformOrigin="0px 0px",g.style.msTransformOrigin="0px 0px",g.style.oTransformOrigin="0px 0px",g.style.transformOrigin="0px 0px",g.style.webkitTransform="scaleX("+c+") scaleY("+d+")",g.style.mozTransform="scaleX("+c+") scaleY("+d+")",g.style.msTransform="scaleX("+c+") scaleY("+d+")",g.style.oTransform="scaleX("+c+") scaleY("+d+")",g.style.transform="scaleX("+c+") scaleY("+d+")"),this.snap(function(){g.style.position="relative",g.style.left=""+a.container.scrollLeft+"px",g.style.top=""+a.container.scrollTop+"px",a.container.insertBefore(g,a.peg),a.container.style.overflow="hidden",a.preview_active=!0},g)},unfreeze:function(){this.preview_active&&(this.container.removeChild(this.preview_canvas),delete this.preview_context,delete this.preview_canvas,this.preview_active=!1,this.flip())},flip:function(){if(this.params.flip_horiz){var a=this.container.style;a.webkitTransform="scaleX(-1)",a.mozTransform="scaleX(-1)",a.msTransform="scaleX(-1)",a.oTransform="scaleX(-1)",a.transform="scaleX(-1)",a.filter="FlipH",a.msFilter="FlipH"}},unflip:function(){if(this.params.flip_horiz){var a=this.container.style;a.webkitTransform="scaleX(1)",a.mozTransform="scaleX(1)",a.msTransform="scaleX(1)",a.oTransform="scaleX(1)",a.transform="scaleX(1)",a.filter="",a.msFilter=""}},savePreview:function(a,b){var c=this.params,d=this.preview_canvas,e=this.preview_context;if(b){var f=b.getContext("2d");f.drawImage(d,0,0)}a(b?null:d.toDataURL("image/"+c.image_format,c.jpeg_quality/100),d,e),this.params.unfreeze_snap&&this.unfreeze()},snap:function(a,b){var d=this.params;if(!this.loaded)return this.dispatch("error",new c("Webcam is not loaded yet"));if(!a)return this.dispatch("error",new c("Please provide a callback function or canvas to snap()"));if(this.preview_active)return this.savePreview(a,b),null;var e=document.createElement("canvas");e.width=this.params.dest_width,e.height=this.params.dest_height;var f=e.getContext("2d");this.params.flip_horiz&&(f.translate(d.dest_width,0),f.scale(-1,1));var g=function(){if(this.src&&this.width&&this.height&&f.drawImage(this,0,0,d.dest_width,d.dest_height),d.crop_width&&d.crop_height){var c=document.createElement("canvas");c.width=d.crop_width,c.height=d.crop_height;var g=c.getContext("2d");g.drawImage(e,Math.floor(d.dest_width/2-d.crop_width/2),Math.floor(d.dest_height/2-d.crop_height/2),d.crop_width,d.crop_height,0,0,d.crop_width,d.crop_height),f=g,e=c}if(b){var h=b.getContext("2d");h.drawImage(e,0,0)}a(b?null:e.toDataURL("image/"+d.image_format,d.jpeg_quality/100),e,f)};if(this.userMedia)f.drawImage(this.video,0,0,this.params.dest_width,this.params.dest_height),g();else{var h=this.getMovie()._snap(),i=new Image;i.onload=g,i.src="data:image/"+this.params.image_format+";base64,"+h}return null},configure:function(a){a||(a="camera"),this.getMovie()._configure(a)},flashNotify:function(a,c){switch(a){case"flashLoadComplete":this.loaded=!0,this.dispatch("load");break;case"cameraLive":this.live=!0,this.dispatch("live");break;case"error":this.dispatch("error",new b(c))}},b64ToUint6:function(a){return a>64&&a<91?a-65:a>96&&a<123?a-71:a>47&&a<58?a+4:43===a?62:47===a?63:0},base64DecToArr:function(a,b){for(var c,d,e=a.replace(/[^A-Za-z0-9\+\/]/g,""),f=e.length,g=b?Math.ceil((3*f+1>>2)/b)*b:3*f+1>>2,h=new Uint8Array(g),i=0,j=0,k=0;k>>(16>>>c&24)&255;i=0}return h},upload:function(a,b,c){var d=this.params.upload_name||"webcam",f="";if(!a.match(/^data\:image\/(\w+)/))throw"Cannot locate image format in Data URI";f=RegExp.$1;var g=a.replace(/^data\:image\/\w+\;base64\,/,""),h=new XMLHttpRequest;h.open("POST",b,!0),h.upload&&h.upload.addEventListener&&h.upload.addEventListener("progress",function(a){if(a.lengthComputable){var b=a.loaded/a.total;e.dispatch("uploadProgress",b,a)}},!1);var i=this;h.onload=function(){c&&c.apply(i,[h.status,h.responseText,h.statusText]),e.dispatch("uploadComplete",h.status,h.responseText,h.statusText)};var j=new Blob([this.base64DecToArr(g)],{type:"image/"+f}),k=new FormData;k.append(d,j,d+"."+f.replace(/e/,"")),h.send(k)}};e.init(),"function"==typeof define&&define.amd?define(function(){return e}):"object"==typeof module&&module.exports?module.exports=e:a.Webcam=e}(window); \ No newline at end of file +function _typeof(a){if("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator){_typeof=function(a){return typeof a}}else{_typeof=function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a}}return _typeof(a)}(function(b){var e;function c(){var a=Error.apply(this,arguments);a.name=this.name="FlashError";this.stack=a.stack;this.message=a.message}function d(){var a=Error.apply(this,arguments);a.name=this.name="WebcamError";this.stack=a.stack;this.message=a.message}IntermediateInheritor=function IntermediateInheritor(){};IntermediateInheritor.prototype=Error.prototype;c.prototype=new IntermediateInheritor;d.prototype=new IntermediateInheritor;var f={version:"1.0.15",protocol:location.protocol.match(/https/i)?"https":"http",loaded:!1,live:!1,userMedia:!0,params:{width:0,height:0,dest_width:0,dest_height:0,image_format:"jpeg",jpeg_quality:90,enable_flash:!0,force_flash:!1,flip_horiz:!1,fps:30,upload_name:"webcam",constraints:null,swfURL:"",flashNotDetectedText:"ERROR: No Adobe Flash Player detected. Webcam.js relies on Flash for browsers that do not support getUserMedia (like yours).",noInterfaceFoundText:"No supported webcam interface found.",unfreeze_snap:!0},errors:{FlashError:c,WebcamError:d},hooks:{},init:function init(){var a=this;this.mediaDevices=navigator.mediaDevices&&navigator.mediaDevices.getUserMedia?navigator.mediaDevices:navigator.mozGetUserMedia||navigator.webkitGetUserMedia?{getUserMedia:function getUserMedia(b){return new Promise(function(c,d){(navigator.mozGetUserMedia||navigator.webkitGetUserMedia).call(navigator,b,c,d)})}}:null;b.URL=b.URL||b.webkitURL||b.mozURL||b.msURL;this.userMedia=this.userMedia&&!!this.mediaDevices&&!!b.URL;if(navigator.userAgent.match(/Firefox\D+(\d+)/)){if(21>parseInt(RegExp.$1,10))this.userMedia=null}if(this.userMedia){b.addEventListener("beforeunload",function(){a.reset()})}},attach:function attach(g){if("string"==typeof g){g=document.getElementById(g)||document.querySelector(g)}if(!g){return this.dispatch("error",new d("Could not locate DOM element to attach to."))}this.container=g;g.innerHTML="";var j=document.createElement("div");g.appendChild(j);this.peg=j;if(!this.params.width)this.params.width=g.offsetWidth;if(!this.params.height)this.params.height=g.offsetHeight;if(!this.params.width||!this.params.height){return this.dispatch("error",new d("No width and/or height for webcam. Please call set() first, or attach to a visible element."))}if(!this.params.dest_width)this.params.dest_width=this.params.width;if(!this.params.dest_height)this.params.dest_height=this.params.height;this.userMedia=e===void 0?this.userMedia:e;if(this.params.force_flash){e=this.userMedia;this.userMedia=null}if("number"!=typeof this.params.fps)this.params.fps=30;var i=this.params.width/this.params.dest_width,k=this.params.height/this.params.dest_height;if(this.userMedia){var o=document.createElement("video");o.setAttribute("autoplay","autoplay");o.style.width=""+this.params.dest_width+"px";o.style.height=""+this.params.dest_height+"px";if(1!=i||1!=k){g.style.overflow="hidden";o.style.webkitTransformOrigin="0px 0px";o.style.mozTransformOrigin="0px 0px";o.style.msTransformOrigin="0px 0px";o.style.oTransformOrigin="0px 0px";o.style.transformOrigin="0px 0px";o.style.webkitTransform="scaleX("+i+") scaleY("+k+")";o.style.mozTransform="scaleX("+i+") scaleY("+k+")";o.style.msTransform="scaleX("+i+") scaleY("+k+")";o.style.oTransform="scaleX("+i+") scaleY("+k+")";o.style.transform="scaleX("+i+") scaleY("+k+")"}g.appendChild(o);this.video=o;var n=this;this.mediaDevices.getUserMedia({audio:!1,video:this.params.constraints||{mandatory:{minWidth:this.params.dest_width,minHeight:this.params.dest_height}}}).then(function(a){o.onloadedmetadata=function(){n.stream=a;n.loaded=!0;n.live=!0;n.dispatch("load");n.dispatch("live");n.flip()};o.srcObject=a||a}).catch(function(a){if(n.params.enable_flash&&n.detectFlash()){setTimeout(function(){n.params.force_flash=1;n.attach(g)},1)}else{n.dispatch("error",a)}})}else if(this.params.enable_flash&&this.detectFlash()){b.Webcam=f;var h=document.createElement("div");h.innerHTML=this.getSWFHTML();g.appendChild(h)}else{this.dispatch("error",new d(this.params.noInterfaceFoundText))}if(this.params.crop_width&&this.params.crop_height){var l=Math.floor(this.params.crop_width*i),c=Math.floor(this.params.crop_height*k);g.style.width=""+l+"px";g.style.height=""+c+"px";g.style.overflow="hidden";g.scrollLeft=Math.floor(this.params.width/2-l/2);g.scrollTop=Math.floor(this.params.height/2-c/2)}else{g.style.width=""+this.params.width+"px";g.style.height=""+this.params.height+"px"}},reset:function reset(){if(this.preview_active)this.unfreeze();this.unflip();if(this.userMedia){if(this.stream){if(this.stream.getVideoTracks){var a=this.stream.getVideoTracks();if(a&&a[0]&&a[0].stop)a[0].stop()}else if(this.stream.stop){this.stream.stop()}}delete this.stream;delete this.video}if(!0!==this.userMedia){this.getMovie()._releaseCamera()}if(this.container){this.container.innerHTML="";delete this.container}this.loaded=!1;this.live=!1},set:function set(){if(1==arguments.length){for(var a in arguments[0]){this.params[a]=arguments[0][a]}}else{this.params[arguments[0]]=arguments[1]}},on:function on(a,b){a=a.replace(/^on/i,"").toLowerCase();if(!this.hooks[a])this.hooks[a]=[];this.hooks[a].push(b)},off:function off(b,c){b=b.replace(/^on/i,"").toLowerCase();if(this.hooks[b]){if(c){var d=this.hooks[b].indexOf(c);if(-1ERROR: the Webcam.js Flash fallback does not work from local disk. Please run it from a web server."}if(!this.detectFlash()){this.dispatch("error",new c("Adobe Flash Player not found. Please install from get.adobe.com/flashplayer and try again."));return"

"+this.params.flashNotDetectedText+"

"}if(!d){for(var e="",f=document.getElementsByTagName("script"),g=0,j=f.length,k;g";return a},getMovie:function getMovie(){if(!this.loaded)return this.dispatch("error",new c("Flash Movie is not loaded yet"));var a=document.getElementById("webcam_movie_obj");if(!a||!a._snap)a=document.getElementById("webcam_movie_embed");if(!a)this.dispatch("error",new c("Cannot locate Flash movie in DOM"));return a},freeze:function freeze(){var b=this,c=this.params;if(this.preview_active)this.unfreeze();var d=this.params.width/this.params.dest_width,a=this.params.height/this.params.dest_height;this.unflip();var e=c.crop_width||c.dest_width,f=c.crop_height||c.dest_height,g=document.createElement("canvas");g.width=e;g.height=f;var h=g.getContext("2d");this.preview_canvas=g;this.preview_context=h;if(1!=d||1!=a){g.style.webkitTransformOrigin="0px 0px";g.style.mozTransformOrigin="0px 0px";g.style.msTransformOrigin="0px 0px";g.style.oTransformOrigin="0px 0px";g.style.transformOrigin="0px 0px";g.style.webkitTransform="scaleX("+d+") scaleY("+a+")";g.style.mozTransform="scaleX("+d+") scaleY("+a+")";g.style.msTransform="scaleX("+d+") scaleY("+a+")";g.style.oTransform="scaleX("+d+") scaleY("+a+")";g.style.transform="scaleX("+d+") scaleY("+a+")"}this.snap(function(){g.style.position="relative";g.style.left=""+b.container.scrollLeft+"px";g.style.top=""+b.container.scrollTop+"px";b.container.insertBefore(g,b.peg);b.container.style.overflow="hidden";b.preview_active=!0},g)},unfreeze:function unfreeze(){if(this.preview_active){this.container.removeChild(this.preview_canvas);delete this.preview_context;delete this.preview_canvas;this.preview_active=!1;this.flip()}},flip:function flip(){if(this.params.flip_horiz){var a=this.container.style;a.webkitTransform="scaleX(-1)";a.mozTransform="scaleX(-1)";a.msTransform="scaleX(-1)";a.oTransform="scaleX(-1)";a.transform="scaleX(-1)";a.filter="FlipH";a.msFilter="FlipH"}},unflip:function unflip(){if(this.params.flip_horiz){var a=this.container.style;a.webkitTransform="scaleX(1)";a.mozTransform="scaleX(1)";a.msTransform="scaleX(1)";a.oTransform="scaleX(1)";a.transform="scaleX(1)";a.filter="";a.msFilter=""}},savePreview:function savePreview(b,c){var d=this.params,a=this.preview_canvas,e=this.preview_context;if(c){var f=c.getContext("2d");f.drawImage(a,0,0)}b(c?null:a.toDataURL("image/"+d.image_format,d.jpeg_quality/100),a,e);if(this.params.unfreeze_snap)this.unfreeze()},snap:function snap(b,c){var e=this,f=this.params;if(!this.loaded)return this.dispatch("error",new d("Webcam is not loaded yet"));if(!b)return this.dispatch("error",new d("Please provide a callback function or canvas to snap()"));if(this.preview_active){this.savePreview(b,c);return null}var g=document.createElement("canvas");g.width=this.params.dest_width;g.height=this.params.dest_height;var i=g.getContext("2d");if(this.params.flip_horiz){i.translate(f.dest_width,0);i.scale(-1,1)}var a=function(){if(this.src&&this.width&&this.height){i.drawImage(this,0,0,f.dest_width,f.dest_height)}if(f.crop_width&&f.crop_height){var d=document.createElement("canvas");d.width=f.crop_width;d.height=f.crop_height;var a=d.getContext("2d");a.drawImage(g,Math.floor(f.dest_width/2-f.crop_width/2),Math.floor(f.dest_height/2-f.crop_height/2),f.crop_width,f.crop_height,0,0,f.crop_width,f.crop_height);i=a;g=d}if(c){var e=c.getContext("2d");e.drawImage(g,0,0)}b(c?null:g.toDataURL("image/"+f.image_format,f.jpeg_quality/100),g,i)};if(this.userMedia){i.drawImage(this.video,0,0,this.params.dest_width,this.params.dest_height);a()}else{var j=this.getMovie()._snap(),h=new Image;h.onload=a;h.src="data:image/"+this.params.image_format+";base64,"+j}return null},configure:function configure(a){if(!a)a="camera";this.getMovie()._configure(a)},flashNotify:function flashNotify(a,b){switch(a){case"flashLoadComplete":this.loaded=!0;this.dispatch("load");break;case"cameraLive":this.live=!0;this.dispatch("live");break;case"error":this.dispatch("error",new c(b));break;default:break;}},b64ToUint6:function b64ToUint6(a){return 64a?a-65:96a?a-71:47a?a+4:43===a?62:47===a?63:0},base64DecToArr:function base64DecToArr(b,d){for(var e=b.replace(/[^A-Za-z0-9\+\/]/g,""),a=e.length,f=d?Math.ceil((3*a+1>>2)/d)*d:3*a+1>>2,g=new Uint8Array(f),i,j,k=0,m=0,p=0;pi&&m>>(24&16>>>i)}k=0}}return g},upload:function upload(b,c,d){var a=this.params.upload_name||"webcam",e="";if(b.match(/^data\:image\/(\w+)/))e=RegExp.$1;else throw"Cannot locate image format in Data URI";var g=b.replace(/^data\:image\/\w+\;base64\,/,""),j=new XMLHttpRequest;j.open("POST",c,!0);if(j.upload&&j.upload.addEventListener){j.upload.addEventListener("progress",function(a){if(a.lengthComputable){var b=a.loaded/a.total;f.dispatch("uploadProgress",b,a)}},!1)}var k=this;j.onload=function(){if(d)d.apply(k,[j.status,j.responseText,j.statusText]);f.dispatch("uploadComplete",j.status,j.responseText,j.statusText)};var m=new Blob([this.base64DecToArr(g)],{type:"image/"+e}),h=new FormData;h.append(a,m,a+"."+e.replace(/e/,""));j.send(h)}};f.init();if("function"==typeof define&&define.amd){define ("filter_poodll/webcam",function(){return f})}else if("object"===("undefined"==typeof module?"undefined":_typeof(module))&&module.exports){module.exports=f}else{b.Webcam=f}})(window); +//# sourceMappingURL=webcam.min.js.map