(function(n){window.GalleryEventLogger=function(n){if(_.isNullOrUndefined(n))throw new Error("The options are not set.");this.options=n;this.videoEventTypes={started:"started",paused:"paused",finished:"finished"}};n.extend(GalleryEventLogger.prototype,{logVideoUserInteractionEvent:function(n){if(_.isNullOrUndefined(n)||_.isNullOrUndefined(n.eventType)||_.isNullOrUndefined(n.state)||_.isNullOrUndefined(n.state.currentTime)||_.isNullOrUndefined(n.state.duration))throw new Error("Event object schema is invalid.");if(_.isNullOrUndefined(this.videoEventTypes[n.eventType]))throw new Error("Event type '"+n.eventType+"' is not supported.");_.isNaN(n.state.duration)&&(n.state.duration=0);this._logEvent(this.options.recordVideoInteractionUrl,n)},logExternalLinkVisitEvent:function(n,t){if(_.isNullOrUndefined(n)||_.isNullOrUndefined(n.linkText))throw new Error("Event must have 'linkText' property.");this._logEvent(this.options.recordExternalLinkVisitUrl,n,t)},logDetailsPageVisitEvent:function(n){this._logEvent(this.options.recordDetailsPageVisitUrl,n)},logVirtualConferenceVisitEvent:function(n){this._logEvent(this.options.recordVirtualConferenceVisitUrl,n)},isSendBeaconSupported:function(){return!!navigator.sendBeacon},_logEvent:function(n,t,i){if(t=_.extend({galleryId:this.options.galleryId,itemName:this.options.itemName,email:currentUser.isAnonymous?"N/A":currentUser.email,url:window.location.href},t),_.isNullOrUndefined(t.itemName))throw new Error("The property 'itemName' is not provided.");var r=new FormData;r.append("eventJson",JSON.stringify(t));this.isSendBeaconSupported()?(r.append(appConfig.requestVerificationTokenFormFieldName,appConfig.requestVerificationToken),navigator.sendBeacon(n,r)):Backbone.invoke(n,r,{dontShowErrorAlert:!0,dontShowWaitCursor:!i,complete:i?function(){redirect(i)}:null})}})})(jQuery)