New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@gobistories/gobi-web-integration

Package Overview
Dependencies
Maintainers
3
Versions
251
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gobistories/gobi-web-integration - npm Package Compare versions

Comparing version 1.6.4 to 1.6.5

test.html

2

dist/gobi-web-integration.js

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.gobi=e():t.gobi=e()}(window,function(){return function(n){var i={};function r(t){if(i[t])return i[t].exports;var e=i[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,r),e.l=!0,e.exports}return r.m=n,r.c=i,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=7)}([function(t,d,p){"use strict";(function(e){var t=p(2),n=setTimeout;function i(){}function o(t){if(!(this instanceof o))throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],u(t,this)}function r(n,i){for(;3===n._state;)n=n._value;0!==n._state?(n._handled=!0,o._immediateFn(function(){var t=1===n._state?i.onFulfilled:i.onRejected;if(null!==t){var e;try{e=t(n._value)}catch(t){return void a(i.promise,t)}s(i.promise,e)}else(1===n._state?s:a)(i.promise,n._value)})):n._deferreds.push(i)}function s(e,t){try{if(t===e)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var n=t.then;if(t instanceof o)return e._state=3,e._value=t,void c(e);if("function"==typeof n)return void u((i=n,r=t,function(){i.apply(r,arguments)}),e)}e._state=1,e._value=t,c(e)}catch(t){a(e,t)}var i,r}function a(t,e){t._state=2,t._value=e,c(t)}function c(t){2===t._state&&0===t._deferreds.length&&o._immediateFn(function(){t._handled||o._unhandledRejectionFn(t._value)});for(var e=0,n=t._deferreds.length;e<n;e++)r(t,t._deferreds[e]);t._deferreds=null}function l(t,e,n){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.promise=n}function u(t,e){var n=!1;try{t(function(t){n||(n=!0,s(e,t))},function(t){n||(n=!0,a(e,t))})}catch(t){if(n)return;n=!0,a(e,t)}}o.prototype.catch=function(t){return this.then(null,t)},o.prototype.then=function(t,e){var n=new this.constructor(i);return r(this,new l(t,e,n)),n},o.prototype.finally=t.a,o.all=function(e){return new o(function(i,r){if(!e||void 0===e.length)throw new TypeError("Promise.all accepts an array");var o=Array.prototype.slice.call(e);if(0===o.length)return i([]);var s=o.length;function a(e,t){try{if(t&&("object"==typeof t||"function"==typeof t)){var n=t.then;if("function"==typeof n)return void n.call(t,function(t){a(e,t)},r)}o[e]=t,0==--s&&i(o)}catch(t){r(t)}}for(var t=0;t<o.length;t++)a(t,o[t])})},o.resolve=function(e){return e&&"object"==typeof e&&e.constructor===o?e:new o(function(t){t(e)})},o.reject=function(n){return new o(function(t,e){e(n)})},o.race=function(r){return new o(function(t,e){for(var n=0,i=r.length;n<i;n++)r[n].then(t,e)})},o._immediateFn="function"==typeof e&&function(t){e(t)}||function(t){n(t,0)},o._unhandledRejectionFn=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)},d.a=o}).call(this,p(4).setImmediate)},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";e.a=function(e){var n=this.constructor;return this.then(function(t){return n.resolve(e()).then(function(){return t})},function(t){return n.resolve(e()).then(function(){return n.reject(t)})})}},function(t,e,n){},function(t,r,o){(function(t){var e=void 0!==t&&t||"undefined"!=typeof self&&self||window,n=Function.prototype.apply;function i(t,e){this._id=t,this._clearFn=e}r.setTimeout=function(){return new i(n.call(setTimeout,e,arguments),clearTimeout)},r.setInterval=function(){return new i(n.call(setInterval,e,arguments),clearInterval)},r.clearTimeout=r.clearInterval=function(t){t&&t.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(e,this._id)},r.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},r.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},r._unrefActive=r.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;0<=e&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},o(5),r.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,r.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,o(1))},function(t,e,n){(function(t,f){!function(n,i){"use strict";if(!n.setImmediate){var r,o,e,s,t,a=1,c={},l=!1,u=n.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(n);d=d&&d.setTimeout?d:n,r="[object process]"==={}.toString.call(n.process)?function(t){f.nextTick(function(){h(t)})}:function(){if(n.postMessage&&!n.importScripts){var t=!0,e=n.onmessage;return n.onmessage=function(){t=!1},n.postMessage("","*"),n.onmessage=e,t}}()?(s="setImmediate$"+Math.random()+"$",t=function(t){t.source===n&&"string"==typeof t.data&&0===t.data.indexOf(s)&&h(+t.data.slice(s.length))},n.addEventListener?n.addEventListener("message",t,!1):n.attachEvent("onmessage",t),function(t){n.postMessage(s+t,"*")}):n.MessageChannel?((e=new MessageChannel).port1.onmessage=function(t){h(t.data)},function(t){e.port2.postMessage(t)}):u&&"onreadystatechange"in u.createElement("script")?(o=u.documentElement,function(t){var e=u.createElement("script");e.onreadystatechange=function(){h(t),e.onreadystatechange=null,o.removeChild(e),e=null},o.appendChild(e)}):function(t){setTimeout(h,0,t)},d.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n<e.length;n++)e[n]=arguments[n+1];var i={callback:t,args:e};return c[a]=i,r(a),a++},d.clearImmediate=p}function p(t){delete c[t]}function h(t){if(l)setTimeout(h,0,t);else{var e=c[t];if(e){l=!0;try{!function(t){var e=t.callback,n=t.args;switch(n.length){case 0:e();break;case 1:e(n[0]);break;case 2:e(n[0],n[1]);break;case 3:e(n[0],n[1],n[2]);break;default:e.apply(i,n)}}(e)}finally{p(t),l=!1}}}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,n(1),n(6))},function(t,e){var n,i,r=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{i="function"==typeof clearTimeout?clearTimeout:s}catch(t){i=s}}();var c,l=[],u=!1,d=-1;function p(){u&&c&&(u=!1,c.length?l=c.concat(l):d=-1,l.length&&h())}function h(){if(!u){var t=a(p);u=!0;for(var e=l.length;e;){for(c=l,l=[];++d<e;)c&&c[d].run();d=-1,e=l.length}c=null,u=!1,function(e){if(i===clearTimeout)return clearTimeout(e);if((i===s||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}(t)}}function f(t,e){this.fun=t,this.array=e}function v(){}r.nextTick=function(t){var e=new Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];l.push(new f(t,e)),1!==l.length||u||a(h)},f.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=v,r.addListener=v,r.once=v,r.off=v,r.removeListener=v,r.removeAllListeners=v,r.emit=v,r.prependListener=v,r.prependOnceListener=v,r.listeners=function(t){return[]},r.binding=function(t){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(t){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},function(t,e,n){"use strict";n.r(e);n(3);var i=function(){function t(){this._eventsCallbacks={}}return t.prototype.on=function(t,e){this._eventsCallbacks.hasOwnProperty(t)||(this._eventsCallbacks[t]=[]);var n=this._eventsCallbacks[t];-1===n.indexOf(e)&&n.push(e)},t.prototype.off=function(t,e){"string"==typeof t?this._eventsCallbacks.hasOwnProperty(t)&&("function"==typeof e?this._removeCallback(t,e):this._eventsCallbacks[t]=[]):this._removeAllCallbacks()},t.prototype.emit=function(t,e,n){if(this._eventsCallbacks.hasOwnProperty(t))for(var i=this._eventsCallbacks[t],r=i.length,o=0;o<r;o++)i[o].call(n||this,e)},t.prototype._removeCallback=function(t,e){var n=this._eventsCallbacks[t],i=n.indexOf(e);-1<i&&n.splice(i,1)},t.prototype._removeAllCallbacks=function(){for(var t in this._eventsCallbacks)this._eventsCallbacks.hasOwnProperty(t)&&delete this._eventsCallbacks[t]},t}(),s=n(0);function a(){return(a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function c(t,e){for(var n,i=t.length,r=0;r<i;r++)(n=t[r]).className=e+n.className}function r(r){return new s.a(function(t,e){var n=new XMLHttpRequest,i="https://live.gobiapp.com/projector/player/storyModules/"+r;n.open("GET",i,!0),n.send(),n.onload=function(){this.status<400?t(JSON.parse(this.responseText)):e(Error("Module didn't load successfully; error code:"+n.statusText))},n.onerror=function(){e(Error("There was a network error."))}})}function l(t,e){if(e){var n=[];for(var i in t){var r=t[i],o=e[i];n.push(o?a(r,o):r)}return n}return t}function u(t){return t.map(function(t){return{title:t.title,avatarSrc:t.thumbnail,description:t.description,id:t.story_id}})}function o(t,e,n){var i=function(t){return n(t)};return t.addEventListener(e,i),function(){return t.removeEventListener(e,i)}}var d={scrollTop:0,bodyOverflow:"",htmlOverflow:"",disable:function(){this.isIOS?this.IOSDisable():this.classicDisable()},enable:function(){this.isIOS?this.IOSEnable():this.classicEnable()},classicDisable:function(){this.bodyOverflow=document.body.style.overflow,this.htmlOverflow=document.documentElement.style.overflow,document.documentElement.style.overflow="hidden",document.body.style.overflow="hidden"},classicEnable:function(){document.documentElement.style.overflow=this.htmlOverflow,document.body.style.overflow=this.bodyOverflow},IOSEnable:function(){document.documentElement.classList.remove("disabled-scroll"),document.body.classList.remove("disabled-scroll"),window.scrollTo(0,this.scrollTop)},IOSDisable:function(){this.scrollTop=window.pageYOffset,document.documentElement.classList.add("disabled-scroll"),document.body.classList.add("disabled-scroll")},isIOS:/iPad|iPhone|iPod/.test(navigator.userAgent)};function p(){return(p=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}var h=function(){function t(t){var n=this;this._defaultOptions={autoStart:!1,hideOverlay:!1,loop:!1,width:0,height:0,roundedCorners:!0,shadow:!0,checkViewPort:!0},this._eventEmitter=new i,this.on=this._eventEmitter.on.bind(this._eventEmitter),this.off=this._eventEmitter.off.bind(this._eventEmitter),this._removeIsOnScreenChecker=function(){},this._removeIsOutOfScreenChecker=function(){},this._options=p({},this._defaultOptions,t),this.el=this._createIframe(),this._options.container&&this._options.container.appendChild(this.el),window.addEventListener("message",function(t){if(n.el.contentWindow===t.source){var e=t.data;e.event&&(n._eventEmitter.emit(e.event,e.value,n),n._options.checkViewPort&&n._viewPortChecker(e.event))}})}return Object.defineProperty(t.prototype,"storyUrl",{get:function(){var n={autoStart:this._options.autoStart,addLooping:this._options.loop,hideOverlay:this._options.hideOverlay,roundedCorners:this._options.roundedCorners},t=Object.keys(n).map(function(t){var e=n[t];return encodeURIComponent(t)+"="+encodeURIComponent(e)}).join("&");return"https://live.gobiapp.com/next/story/id/"+this._options.storyName+"?"+t},enumerable:!0,configurable:!0}),t.prototype.load=function(t){p(this._options,t),this.el.src=this.storyUrl},t.prototype.play=function(){this._callPlayerMethod("play")},t.prototype.pause=function(){this._callPlayerMethod("pause")},t.prototype.reload=function(){this._callPlayerMethod("reset")},t.prototype.setMute=function(t){this._callPlayerMethod("setMute",t)},t.prototype.isInViewport=function(){var t=this.el.getBoundingClientRect(),e=window.innerHeight||document.documentElement.clientHeight,n=window.innerWidth||document.documentElement.clientWidth,i=.8*t.height,r=.8*t.width;return t.top>=0-i&&t.left>=0-r&&t.bottom<=e+i&&t.right<=n+r},t.prototype._callPlayerMethod=function(t,e){void 0===e&&(e=void 0),this._sendMessage({method:t,value:e})},t.prototype._sendMessage=function(t){var e=this.el.contentWindow;e&&e.postMessage(t,"*")},t.prototype._createIframe=function(){var t=document.createElement("iframe"),e=this._calculatePlayerSize();return t.src=this.storyUrl,t.width=e.width.toString(),t.height=e.height.toString(),t.frameBorder="0",t.scrolling="no",t.style.overflow="hidden",t.style.background="#000",t.style.border="0",this._options.shadow&&t.classList.add("gobi-player-shadow"),this._options.roundedCorners&&(t.style.borderRadius="10px"),t.setAttribute("allow","autoplay;"),t},t.prototype._viewPortChecker=function(t){switch(t){case"play":this._addIsOutOfScreenChecker();break;case"pause":this.isInViewport()&&(this._removeIsOnScreenChecker(),this._removeIsOutOfScreenChecker());break;case"ended":this._removeIsOnScreenChecker(),this._removeIsOutOfScreenChecker()}},t.prototype._addIsOutOfScreenChecker=function(){var t=this;this._removeIsOutOfScreenChecker(),this._removeIsOnScreenChecker(),this._removeIsOutOfScreenChecker=o(window,"scroll",function(){t.isInViewport()||(t.pause(),t._removeIsOutOfScreenChecker(),t._addIsOnScreenChecker())})},t.prototype._addIsOnScreenChecker=function(){var t=this;this._removeIsOnScreenChecker=o(window,"scroll",function(){t.isInViewport()&&(t.play(),t._removeIsOnScreenChecker(),t._addIsOutOfScreenChecker())})},t.prototype._calculatePlayerSize=function(){var t=612,e=1088;return this._options.width&&this._options.height?(t=this._options.width,e=this._options.height):this._options.width?e=(t=this._options.width)/.5625:this._options.height&&(t=.5625*(e=this._options.height)),{width:t,height:e}},t}(),f=function(t,e){return(f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function v(t,e){function n(){this.constructor=t}f(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var y=function(){function t(t){var o,e=this;this._listeners=[],this._eventEmitter=new i,this.on=this._eventEmitter.on.bind(this._eventEmitter),this.off=this._eventEmitter.off.bind(this._eventEmitter),this._avatarSrc="",this.el=this._createTemplate(),this._elems={title:this._getElem("title"),description:this._getElem("description"),avatar:this._getElem("avatar"),avatarContainer:this._getElem("avatarContainer")},this.id=t.id,this._title=t.title||"",this._description=t.description||"",this.avatarSrc=t.avatarSrc||"",t.avatarSrc||(o=this.id,new s.a(function(n,i){var r=new XMLHttpRequest,t="https://live.gobiapp.com/projector/player/stories/"+o;r.open("GET",t,!0),r.send(),r.onload=function(){if(this.status<400){var t=JSON.parse(this.responseText),e=t&&t.videos&&t.videos[0]&&t.videos[0].poster;n(e)}else i(Error("Error loading avatar for story "+o+" -- "+r.statusText))},r.onerror=function(){i(Error("Error xhr-ing avatar for storyId "+o))}})).then(function(t){e.avatarSrc=t}),this._color=t.color||"",this._addSelectEmitter(),"function"==typeof t.onSelect&&this._eventEmitter.on("select",t.onSelect),t.container&&t.container.appendChild(this.el)}return Object.defineProperty(t.prototype,"avatarSrc",{get:function(){return this._avatarSrc},set:function(t){this._avatarSrc=t,this._elems.avatar.style.backgroundImage="url("+t+")"},enumerable:!0,configurable:!0}),t.prototype.destroy=function(){this.el.parentElement&&this.el.parentElement.removeChild(this.el),this._eventEmitter.off();for(var t=this._listeners.length;t--;)this._listeners[t]()},t.prototype._addSelectEmitter=function(){for(var t=this,e=this.el.querySelectorAll("[data-select-area]"),n=function(){t._eventEmitter.emit("select",t)},i=e.length;i--;)this._listeners.push(o(e[i],"click",n))},t.prototype._getElem=function(t){var e="data-"+t,n=this.el.querySelector("["+e+"]");if(n)return n.removeAttribute(e),n;throw new Error("Story does not contain element with name:"+t)},t}(),m=function(n){function i(t){var e=n.call(this,t)||this;return e._selected=!1,t.titleColor&&(e._elems.title.style.color=t.titleColor),t.descriptionColor&&(e._elems.description.style.color=t.descriptionColor),t.titleSize&&(e._elems.title.style.fontSize=t.titleSize),t.descriptionSize&&(e._elems.description.style.fontSize=t.descriptionSize),t.avatarSize&&(e._elems.avatarContainer.style.width=t.avatarSize),e._selected=!!t.selected,e.title=e._title,e.description=e._description,e.color=e._color,e}return v(i,n),Object.defineProperty(i.prototype,"title",{get:function(){return this._title},set:function(t){this._title=t,this._elems.title.textContent=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"description",{get:function(){return this._description},set:function(t){this._description=t,this._elems.description.textContent=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"color",{get:function(){return this._color},set:function(t){this._color=t,this._elems.avatarContainer.style.borderColor=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"selected",{get:function(){return this._selected},set:function(t){t?this.el.classList.add("gobi-story--selected"):this.el.classList.remove("gobi-story--selected"),this._selected=t},enumerable:!0,configurable:!0}),i.prototype._createTemplate=function(){var t="gobi-story",e=document.createElement("div");return e.classList.add(t),e.innerHTML=i._HTML,c(e.querySelectorAll("*"),t+"__"),e},Object.defineProperty(i,"_HTML",{get:function(){return'<div class="avatar-container" data-select-area data-avatarContainer><div class="avatar" data-avatar></div></div><div class="title" data-title></div><div class="description" data-description></div>'},enumerable:!0,configurable:!0}),i}(y);function _(){return(_=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}var b=function(){function i(t){var e=this,n=_({},i._defaultOptions,t);this.el=this._createTemplate(),this._title=n.title,this.title=n.title,this._color=n.color,this._activeColor=n.activeColor,this.stories=this._createStories(n.stories,n),this._currentStory=this.stories[0],this._playerContainer=this.el.querySelector("[data-player]"),this.player=new h(_({storyName:this._currentStory.id,container:this._playerContainer},n.playerOptions)),this._playerContainer.style.maxWidth=Math.min(.53*window.innerHeight,350)+"px",window.addEventListener("resize",function(){e._playerContainer.style.maxWidth=Math.min(.53*window.innerHeight,350)+"px"}),this.currentStory=this._currentStory}return Object.defineProperty(i.prototype,"title",{get:function(){return this._title},set:function(t){var e=this.el.querySelector("[data-title]");e&&(this._title=t,e.textContent=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"currentStory",{get:function(){return this._currentStory},set:function(t){this._currentStory.color=this._color,this._currentStory.selected=!1,this._currentStory=t,this._currentStory.selected=!0,this._currentStory.color=this._activeColor,this.player.load({storyName:this._currentStory.id})},enumerable:!0,configurable:!0}),i.prototype.append=function(t){t.appendChild(this.el)},i.prototype.remove=function(){var t=this.el.parentElement;t&&t.removeChild(this.el)},i.prototype._createStories=function(t,e){var n=this,i=this.el.querySelector("[data-stories]");return t.map(function(t){return new m({id:t.id,container:i,avatarSrc:t.avatarSrc,title:t.title,description:t.description,titleColor:t.titleColor,descriptionColor:t.descriptionColor,color:n._color,titleSize:e.titleSize,avatarSize:e.avatarSize,descriptionSize:e.descriptionSize,onSelect:n._onStorySelect.bind(n)})})},i.prototype._onStorySelect=function(t){this.currentStory=t},i.prototype._createTemplate=function(){var t=document.createElement("div"),e="gobi-module";return t.classList.add(e),t.innerHTML=i._HTML,c(t.querySelectorAll("*"),e+"__"),t},Object.defineProperty(i,"_HTML",{get:function(){return'<div class="player-block"><div class="player" data-player></div></div><div class="stories-block"><div class="title" data-title></div><div class="stories" data-stories></div></div>'},enumerable:!0,configurable:!0}),i._defaultOptions={title:"",color:"",activeColor:"",playerOptions:{}},i}();function g(){return(g=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}var w=function(){function t(t){this._isOpen=!1,this._defaultOptions={classes:"",openers:""},this._eventEmitter=new i,this._listeners=[];var e=g({},this._defaultOptions,t);this.el=document.createElement("div"),this.el.className=e.classes,this.content=document.createElement("div"),this.content.className="gobi-popup__content",this.iframeContainer=document.createElement("div"),this.iframeContainer.className="gobi-popup__iframe-container",this._createTemplate(),this.player=e.player,this.appendPlayer(this.player),this.el.addEventListener("click",this._onDirectClickClose.bind(this)),this.content.addEventListener("click",this._onDirectClickClose.bind(this))}return Object.defineProperty(t.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!0,configurable:!0}),t.prototype.appendPlayer=function(t){this.player=t,this.iframeContainer.insertBefore(this.player.el,this.iframeContainer.lastElementChild)},t.prototype.open=function(){d.disable(),this.el.style.zIndex=(function(){for(var t=document.body.querySelectorAll("*"),e=1,n=0,i=t.length;i--;)e<(n=Number(window.getComputedStyle(t[i]).zIndex))&&(e=n);return e}()+1).toString(),this.el.classList.add("gobi-popup--active"),this._listeners.push(o(window,"keyup",this._onEscapeClose.bind(this))),this._isOpen=!0,this._eventEmitter.emit("open",this,this)},t.prototype.close=function(){this.el.style.zIndex="",this.el.classList.remove("gobi-popup--active"),this.el.style.padding="",d.enable(),this._removeListeners(),this.player.pause(),this._isOpen=!1,this._eventEmitter.emit("close",this,this)},t.prototype.on=function(t,e){this._eventEmitter.on(t,e)},t.prototype.off=function(t,e){this._eventEmitter.off(t,e)},t.prototype._removeListeners=function(){for(var t=this._listeners.length;t--;)this._listeners[t]()},t.prototype._createTemplate=function(){var t=document.createElement("button");t.className="gobi-popup__close-btn",t.addEventListener("click",this.close.bind(this)),this._calculatePlayerSize(),this.iframeContainer.appendChild(t),this.content.appendChild(this.iframeContainer),this.el.classList.add("gobi-popup"),this.el.appendChild(this.content),window.addEventListener("resize",this._calculatePlayerSize.bind(this))},t.prototype._onDirectClickClose=function(t){t.target===t.currentTarget&&this.close()},t.prototype._onEscapeClose=function(t){(void 0!==t.key?"Escape"===t.key||"Esc"===t.key:27===t.keyCode)&&this.close()},t.prototype._calculatePlayerSize=function(){var t,e,n=window.innerHeight-100,i=window.innerWidth;e=.5625<i/n?(t=.5625*n,n):(t=i)/.5625,this.iframeContainer.style.width=t+"px",this.iframeContainer.style.height=e+"px"},t}(),S=function(n){function i(t){var e=n.call(this,t)||this;return t.titleColor&&(e._elems.title.style.color=t.titleColor),t.descriptionColor&&(e._elems.description.style.color=t.descriptionColor),t.avatarSize&&(e._elems.avatarContainer.style.width=t.avatarSize),e.title=e._title,e.description=e._description,e.color=e._color,e}return v(i,n),Object.defineProperty(i.prototype,"title",{get:function(){return this._title},set:function(t){this._title=t,this._elems.title.textContent=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"description",{get:function(){return this._description},set:function(t){this._description=t,this._elems.description.textContent=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"color",{get:function(){return this._color},set:function(t){this._color=t,this._elems.avatarContainer.style.borderColor=t},enumerable:!0,configurable:!0}),i.prototype._createTemplate=function(){var t="gobi-popup-story",e=document.createElement("div");return e.classList.add(t),e.innerHTML=i._HTML,c(e.querySelectorAll("*"),t+"__"),e},Object.defineProperty(i,"_HTML",{get:function(){return'<div class="avatar-container" data-select-area data-avatarContainer><div class="avatar" data-avatar></div></div><div class="title" data-title></div><div class="description"><div class="description-text" data-description></div></div>'},enumerable:!0,configurable:!0}),i}(y);function O(){return(O=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}var C=function(){function o(t){this.el=this._createTemplate(t.verticalOrientation,!!t.wrap),this._title=t.title||"",this.title=this._title,this.stories=this._createStories(t.stories,t.color,t.avatarSize),this._currentStory=this.stories[0],this.player=new h(O({storyName:this.currentStory.id,checkViewPort:!1},t.playerOptions)),this.popup=new w({player:this.player}),t.container&&this.append(t.container)}return Object.defineProperty(o.prototype,"title",{get:function(){return this._title},set:function(t){var e=this.el.querySelector("[data-title]");e&&(this._title=t||"",e.textContent=this._title,e.style.display=this._title?"":"none")},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"currentStory",{get:function(){return this._currentStory},set:function(t){this._currentStory=t,this.player.load({storyName:this._currentStory.id})},enumerable:!0,configurable:!0}),o.prototype.append=function(t){document.body.appendChild(this.popup.el),t.appendChild(this.el)},o.prototype.remove=function(){var t=this.el.parentElement;t&&(document.body.removeChild(this.popup.el),t.removeChild(this.el),this.popup.close())},o.prototype._createStories=function(t,e,n){var i=this,r=this.el.querySelector("[data-stories]");return t.map(function(t){return new S({id:t.id,container:r,avatarSrc:t.avatarSrc,title:t.title,description:t.description,titleColor:t.titleColor,descriptionColor:t.descriptionColor,color:e,avatarSize:n,onSelect:i._onStorySelect.bind(i)})})},o.prototype._onStorySelect=function(t){this.currentStory=t,this.popup.open()},o.prototype._createTemplate=function(t,e){void 0===t&&(t=!1);var n=document.createElement("div"),i="gobi-popup-module";n.classList.add(i),n.innerHTML=o._HTML,c(n.querySelectorAll("*"),i+"__");var r=n.lastElementChild;return t?r.classList.add(i+"__stories--vertical"):r.classList.add(i+"__stories--horizontal"),e||r.classList.add(i+"__stories--no-wrap"),n},Object.defineProperty(o,"_HTML",{get:function(){return'<div class="title" data-title></div>\n <div class="stories" data-stories></div>'},enumerable:!0,configurable:!0}),o}();function E(){return(E=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}var T=function(){function c(t){this.load(t)}return c.prototype.load=function(s){var a=this;r(s.moduleId).then(function(t){var e=E({},c._defaultOptions,s),n=e.container,i=l(u(t),e.stories),r=window.innerWidth<768,o=a._initModules(e,i);window.innerWidth<768&&o.mobile.append(n),767<window.innerWidth&&o.desktop.append(n),window.addEventListener("resize",function(){window.innerWidth<768&&!r&&(o.desktop.remove(),o.mobile.append(n),r=!0),767<window.innerWidth&&r&&(o.mobile.remove(),o.desktop.append(n),r=!1)})})},c.prototype._initModules=function(t,e){return{desktop:new b({title:t.title,color:t.color,activeColor:t.activeColor,stories:e,playerOptions:t.playerOptions,titleSize:t.desktopStoryStyle.titleSize,avatarSize:t.desktopStoryStyle.avatarSize,descriptionSize:t.desktopStoryStyle.descriptionSize}),mobile:new C({title:t.title,color:t.activeColor,stories:e,playerOptions:t.playerOptions})}},c._defaultOptions={title:"",color:"#999999",activeColor:"#15d6ea",stories:[],desktopStoryStyle:{}},c}(),k=function(){function t(t){this.load(t)}return t.prototype.load=function(n){r(n.moduleId).then(function(t){var e=l(u(t),n.stories);new C({verticalOrientation:n.verticalOrientation,wrap:n.wrap,title:n.title,color:n.color,avatarSize:n.avatarSize,stories:e,playerOptions:n.playerOptions,container:n.container})})},t}();n.d(e,"Module",function(){return P}),n.d(e,"Player",function(){return j}),n.d(e,"MobileModule",function(){return I}),n.d(e,"MobileLayout",function(){return L});var P=T,j=h,I=k,L=C}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.gobi=e():t.gobi=e()}(window,function(){return function(n){var i={};function r(t){if(i[t])return i[t].exports;var e=i[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,r),e.l=!0,e.exports}return r.m=n,r.c=i,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=7)}([function(t,d,p){"use strict";(function(e){var t=p(2),n=setTimeout;function i(){}function o(t){if(!(this instanceof o))throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],u(t,this)}function r(n,i){for(;3===n._state;)n=n._value;0!==n._state?(n._handled=!0,o._immediateFn(function(){var t=1===n._state?i.onFulfilled:i.onRejected;if(null!==t){var e;try{e=t(n._value)}catch(t){return void a(i.promise,t)}s(i.promise,e)}else(1===n._state?s:a)(i.promise,n._value)})):n._deferreds.push(i)}function s(e,t){try{if(t===e)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var n=t.then;if(t instanceof o)return e._state=3,e._value=t,void c(e);if("function"==typeof n)return void u((i=n,r=t,function(){i.apply(r,arguments)}),e)}e._state=1,e._value=t,c(e)}catch(t){a(e,t)}var i,r}function a(t,e){t._state=2,t._value=e,c(t)}function c(t){2===t._state&&0===t._deferreds.length&&o._immediateFn(function(){t._handled||o._unhandledRejectionFn(t._value)});for(var e=0,n=t._deferreds.length;e<n;e++)r(t,t._deferreds[e]);t._deferreds=null}function l(t,e,n){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.promise=n}function u(t,e){var n=!1;try{t(function(t){n||(n=!0,s(e,t))},function(t){n||(n=!0,a(e,t))})}catch(t){if(n)return;n=!0,a(e,t)}}o.prototype.catch=function(t){return this.then(null,t)},o.prototype.then=function(t,e){var n=new this.constructor(i);return r(this,new l(t,e,n)),n},o.prototype.finally=t.a,o.all=function(e){return new o(function(i,r){if(!e||void 0===e.length)throw new TypeError("Promise.all accepts an array");var o=Array.prototype.slice.call(e);if(0===o.length)return i([]);var s=o.length;function a(e,t){try{if(t&&("object"==typeof t||"function"==typeof t)){var n=t.then;if("function"==typeof n)return void n.call(t,function(t){a(e,t)},r)}o[e]=t,0==--s&&i(o)}catch(t){r(t)}}for(var t=0;t<o.length;t++)a(t,o[t])})},o.resolve=function(e){return e&&"object"==typeof e&&e.constructor===o?e:new o(function(t){t(e)})},o.reject=function(n){return new o(function(t,e){e(n)})},o.race=function(r){return new o(function(t,e){for(var n=0,i=r.length;n<i;n++)r[n].then(t,e)})},o._immediateFn="function"==typeof e&&function(t){e(t)}||function(t){n(t,0)},o._unhandledRejectionFn=function(t){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)},d.a=o}).call(this,p(4).setImmediate)},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";e.a=function(e){var n=this.constructor;return this.then(function(t){return n.resolve(e()).then(function(){return t})},function(t){return n.resolve(e()).then(function(){return n.reject(t)})})}},function(t,e,n){},function(t,r,o){(function(t){var e=void 0!==t&&t||"undefined"!=typeof self&&self||window,n=Function.prototype.apply;function i(t,e){this._id=t,this._clearFn=e}r.setTimeout=function(){return new i(n.call(setTimeout,e,arguments),clearTimeout)},r.setInterval=function(){return new i(n.call(setInterval,e,arguments),clearInterval)},r.clearTimeout=r.clearInterval=function(t){t&&t.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(e,this._id)},r.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},r.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},r._unrefActive=r.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;0<=e&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},o(5),r.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,r.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,o(1))},function(t,e,n){(function(t,f){!function(n,i){"use strict";if(!n.setImmediate){var r,o,e,s,t,a=1,c={},l=!1,u=n.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(n);d=d&&d.setTimeout?d:n,r="[object process]"==={}.toString.call(n.process)?function(t){f.nextTick(function(){h(t)})}:function(){if(n.postMessage&&!n.importScripts){var t=!0,e=n.onmessage;return n.onmessage=function(){t=!1},n.postMessage("","*"),n.onmessage=e,t}}()?(s="setImmediate$"+Math.random()+"$",t=function(t){t.source===n&&"string"==typeof t.data&&0===t.data.indexOf(s)&&h(+t.data.slice(s.length))},n.addEventListener?n.addEventListener("message",t,!1):n.attachEvent("onmessage",t),function(t){n.postMessage(s+t,"*")}):n.MessageChannel?((e=new MessageChannel).port1.onmessage=function(t){h(t.data)},function(t){e.port2.postMessage(t)}):u&&"onreadystatechange"in u.createElement("script")?(o=u.documentElement,function(t){var e=u.createElement("script");e.onreadystatechange=function(){h(t),e.onreadystatechange=null,o.removeChild(e),e=null},o.appendChild(e)}):function(t){setTimeout(h,0,t)},d.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n<e.length;n++)e[n]=arguments[n+1];var i={callback:t,args:e};return c[a]=i,r(a),a++},d.clearImmediate=p}function p(t){delete c[t]}function h(t){if(l)setTimeout(h,0,t);else{var e=c[t];if(e){l=!0;try{!function(t){var e=t.callback,n=t.args;switch(n.length){case 0:e();break;case 1:e(n[0]);break;case 2:e(n[0],n[1]);break;case 3:e(n[0],n[1],n[2]);break;default:e.apply(i,n)}}(e)}finally{p(t),l=!1}}}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,n(1),n(6))},function(t,e){var n,i,r=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{i="function"==typeof clearTimeout?clearTimeout:s}catch(t){i=s}}();var c,l=[],u=!1,d=-1;function p(){u&&c&&(u=!1,c.length?l=c.concat(l):d=-1,l.length&&h())}function h(){if(!u){var t=a(p);u=!0;for(var e=l.length;e;){for(c=l,l=[];++d<e;)c&&c[d].run();d=-1,e=l.length}c=null,u=!1,function(e){if(i===clearTimeout)return clearTimeout(e);if((i===s||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}(t)}}function f(t,e){this.fun=t,this.array=e}function v(){}r.nextTick=function(t){var e=new Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];l.push(new f(t,e)),1!==l.length||u||a(h)},f.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=v,r.addListener=v,r.once=v,r.off=v,r.removeListener=v,r.removeAllListeners=v,r.emit=v,r.prependListener=v,r.prependOnceListener=v,r.listeners=function(t){return[]},r.binding=function(t){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(t){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},function(t,e,n){"use strict";n.r(e);n(3);var i=function(){function t(){this._eventsCallbacks={}}return t.prototype.on=function(t,e){this._eventsCallbacks.hasOwnProperty(t)||(this._eventsCallbacks[t]=[]);var n=this._eventsCallbacks[t];-1===n.indexOf(e)&&n.push(e)},t.prototype.off=function(t,e){"string"==typeof t?this._eventsCallbacks.hasOwnProperty(t)&&("function"==typeof e?this._removeCallback(t,e):this._eventsCallbacks[t]=[]):this._removeAllCallbacks()},t.prototype.emit=function(t,e,n){if(this._eventsCallbacks.hasOwnProperty(t))for(var i=this._eventsCallbacks[t],r=i.length,o=0;o<r;o++)i[o].call(n||this,e)},t.prototype._removeCallback=function(t,e){var n=this._eventsCallbacks[t],i=n.indexOf(e);-1<i&&n.splice(i,1)},t.prototype._removeAllCallbacks=function(){for(var t in this._eventsCallbacks)this._eventsCallbacks.hasOwnProperty(t)&&delete this._eventsCallbacks[t]},t}(),s=n(0);function a(){return(a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}function c(t,e){for(var n,i=t.length,r=0;r<i;r++)(n=t[r]).className=e+n.className}function r(r){return new s.a(function(t,e){var n=new XMLHttpRequest,i="https://live.gobiapp.com/projector/player/storyModules/"+r;n.open("GET",i,!0),n.send(),n.onload=function(){this.status<400?t(JSON.parse(this.responseText)):e(Error("Module didn't load successfully; error code:"+n.statusText))},n.onerror=function(){e(Error("There was a network error."))}})}function l(t,e){if(e){var n=[];for(var i in t){var r=t[i],o=e[i];n.push(o?a(r,o):r)}return n}return t}function u(t){return t.map(function(t){return{title:t.title,avatarSrc:t.thumbnail,description:t.description,id:t.story_id}})}function o(t,e,n){var i=function(t){return n(t)};return t.addEventListener(e,i),function(){return t.removeEventListener(e,i)}}var d={scrollTop:0,bodyOverflow:"",htmlOverflow:"",disable:function(){this.isIOS?this.IOSDisable():this.classicDisable()},enable:function(){this.isIOS?this.IOSEnable():this.classicEnable()},classicDisable:function(){this.bodyOverflow=document.body.style.overflow,this.htmlOverflow=document.documentElement.style.overflow,document.documentElement.style.overflow="hidden",document.body.style.overflow="hidden"},classicEnable:function(){document.documentElement.style.overflow=this.htmlOverflow,document.body.style.overflow=this.bodyOverflow},IOSEnable:function(){document.documentElement.classList.remove("disabled-scroll"),document.body.classList.remove("disabled-scroll"),window.scrollTo(0,this.scrollTop)},IOSDisable:function(){this.scrollTop=window.pageYOffset,document.documentElement.classList.add("disabled-scroll"),document.body.classList.add("disabled-scroll")},isIOS:/iPad|iPhone|iPod/.test(navigator.userAgent)};function p(){return(p=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}var h=function(){function t(t){var n=this;this._defaultOptions={autoStart:!1,hideOverlay:!1,loop:!1,width:0,height:0,roundedCorners:!0,shadow:!0,checkViewPort:!0},this._eventEmitter=new i,this.on=this._eventEmitter.on.bind(this._eventEmitter),this.off=this._eventEmitter.off.bind(this._eventEmitter),this._removeIsOnScreenChecker=function(){},this._removeIsOutOfScreenChecker=function(){},this._options=p({},this._defaultOptions,t),this.el=this._createIframe(),this._options.container&&this._options.container.appendChild(this.el),window.addEventListener("message",function(t){if(n.el.contentWindow===t.source){var e=t.data;e.event&&(n._eventEmitter.emit(e.event,e.value,n),n._options.checkViewPort&&n._viewPortChecker(e.event))}})}return Object.defineProperty(t.prototype,"storyUrl",{get:function(){var n={autoStart:this._options.autoStart,addLooping:this._options.loop,hideOverlay:this._options.hideOverlay,roundedCorners:this._options.roundedCorners},t=Object.keys(n).map(function(t){var e=n[t];return encodeURIComponent(t)+"="+encodeURIComponent(e)}).join("&");return"https://live.gobiapp.com/next/story/id/"+this._options.storyName+"?"+t},enumerable:!0,configurable:!0}),t.prototype.load=function(t){p(this._options,t),this.el.src=this.storyUrl},t.prototype.play=function(){this._callPlayerMethod("play")},t.prototype.pause=function(){this._callPlayerMethod("pause")},t.prototype.reload=function(){this._callPlayerMethod("reset")},t.prototype.setMute=function(t){this._callPlayerMethod("setMute",t)},t.prototype.isInViewport=function(){var t=this.el.getBoundingClientRect(),e=window.innerHeight||document.documentElement.clientHeight,n=window.innerWidth||document.documentElement.clientWidth,i=.8*t.height,r=.8*t.width;return t.top>=0-i&&t.left>=0-r&&t.bottom<=e+i&&t.right<=n+r},t.prototype._callPlayerMethod=function(t,e){void 0===e&&(e=void 0),this._sendMessage({method:t,value:e})},t.prototype._sendMessage=function(t){var e=this.el.contentWindow;e&&e.postMessage(t,"*")},t.prototype._createIframe=function(){var t=document.createElement("iframe"),e=this._calculatePlayerSize();return t.src=this.storyUrl,t.width=e.width.toString(),t.height=e.height.toString(),t.frameBorder="0",t.scrolling="no",t.style.overflow="hidden",t.style.background="#000",t.style.border="0",this._options.shadow&&t.classList.add("gobi-player-shadow"),this._options.roundedCorners&&(t.style.borderRadius="10px"),t.setAttribute("allow","autoplay;"),t},t.prototype._viewPortChecker=function(t){switch(t){case"play":this._addIsOutOfScreenChecker();break;case"pause":this.isInViewport()&&(this._removeIsOnScreenChecker(),this._removeIsOutOfScreenChecker());break;case"ended":this._removeIsOnScreenChecker(),this._removeIsOutOfScreenChecker()}},t.prototype._addIsOutOfScreenChecker=function(){var t=this;this._removeIsOutOfScreenChecker(),this._removeIsOnScreenChecker(),this._removeIsOutOfScreenChecker=o(window,"scroll",function(){t.isInViewport()||(t.pause(),t._removeIsOutOfScreenChecker(),t._addIsOnScreenChecker())})},t.prototype._addIsOnScreenChecker=function(){var t=this;this._removeIsOnScreenChecker=o(window,"scroll",function(){t.isInViewport()&&(t.play(),t._removeIsOnScreenChecker(),t._addIsOutOfScreenChecker())})},t.prototype._calculatePlayerSize=function(){var t=612,e=1088;return this._options.width&&this._options.height?(t=this._options.width,e=this._options.height):this._options.width?e=(t=this._options.width)/.5625:this._options.height&&(t=.5625*(e=this._options.height)),{width:t,height:e}},t}(),f=function(t,e){return(f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function v(t,e){function n(){this.constructor=t}f(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var y=function(){function t(t){var o,e=this;this._listeners=[],this._eventEmitter=new i,this.on=this._eventEmitter.on.bind(this._eventEmitter),this.off=this._eventEmitter.off.bind(this._eventEmitter),this._avatarSrc="",this.el=this._createTemplate(),this._elems={title:this._getElem("title"),description:this._getElem("description"),avatar:this._getElem("avatar"),avatarContainer:this._getElem("avatarContainer")},this.id=t.id,this._title=t.title||"",this._description=t.description||"",this.avatarSrc=t.avatarSrc||"",t.avatarSrc||(o=this.id,new s.a(function(n,i){var r=new XMLHttpRequest,t="https://live.gobiapp.com/projector/player/stories/"+o;r.open("GET",t,!0),r.send(),r.onload=function(){if(this.status<400){var t=JSON.parse(this.responseText),e=t&&t.videos&&t.videos[0]&&t.videos[0].poster;n(e)}else i(Error("Error loading avatar for story "+o+" -- "+r.statusText))},r.onerror=function(){i(Error("Error xhr-ing avatar for storyId "+o))}})).then(function(t){e.avatarSrc=t}),this._color=t.color||"",this._addSelectEmitter(),"function"==typeof t.onSelect&&this._eventEmitter.on("select",t.onSelect),t.container&&t.container.appendChild(this.el)}return Object.defineProperty(t.prototype,"avatarSrc",{get:function(){return this._avatarSrc},set:function(t){this._avatarSrc=t,this._elems.avatar.style.backgroundImage="url("+t+")"},enumerable:!0,configurable:!0}),t.prototype.destroy=function(){this.el.parentElement&&this.el.parentElement.removeChild(this.el),this._eventEmitter.off();for(var t=this._listeners.length;t--;)this._listeners[t]()},t.prototype._addSelectEmitter=function(){for(var t=this,e=this.el.querySelectorAll("[data-select-area]"),n=function(){t._eventEmitter.emit("select",t)},i=e.length;i--;)this._listeners.push(o(e[i],"click",n))},t.prototype._getElem=function(t){var e="data-"+t,n=this.el.querySelector("["+e+"]");if(n)return n.removeAttribute(e),n;throw new Error("Story does not contain element with name:"+t)},t}(),m=function(n){function i(t){var e=n.call(this,t)||this;return e._selected=!1,t.titleColor&&(e._elems.title.style.color=t.titleColor),t.descriptionColor&&(e._elems.description.style.color=t.descriptionColor),t.titleSize&&(e._elems.title.style.fontSize=t.titleSize),t.descriptionSize&&(e._elems.description.style.fontSize=t.descriptionSize),t.avatarSize&&(e._elems.avatarContainer.style.width=t.avatarSize),e._selected=!!t.selected,e.title=e._title,e.description=e._description,e.color=e._color,e}return v(i,n),Object.defineProperty(i.prototype,"title",{get:function(){return this._title},set:function(t){this._title=t,this._elems.title.textContent=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"description",{get:function(){return this._description},set:function(t){this._description=t,this._elems.description.textContent=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"color",{get:function(){return this._color},set:function(t){this._color=t,this._elems.avatarContainer.style.borderColor=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"selected",{get:function(){return this._selected},set:function(t){t?this.el.classList.add("gobi-story--selected"):this.el.classList.remove("gobi-story--selected"),this._selected=t},enumerable:!0,configurable:!0}),i.prototype._createTemplate=function(){var t="gobi-story",e=document.createElement("div");return e.classList.add(t),e.innerHTML=i._HTML,c(e.querySelectorAll("*"),t+"__"),e},Object.defineProperty(i,"_HTML",{get:function(){return'<div class="avatar-container" data-select-area data-avatarContainer><div class="avatar" data-avatar></div></div><div class="title" data-title></div><div class="description" data-description></div>'},enumerable:!0,configurable:!0}),i}(y);function _(){return(_=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}var b=function(){function i(t){var e=this,n=_({},i._defaultOptions,t);this.el=this._createTemplate(),this._title=n.title,this.title=n.title,this._color=n.color,this._activeColor=n.activeColor,this.stories=this._createStories(n.stories,n),this._currentStory=this.stories[0],this._playerContainer=this.el.querySelector("[data-player]"),this.player=new h(_({storyName:this._currentStory.id,container:this._playerContainer},n.playerOptions)),this._playerContainer.style.maxWidth=Math.min(.53*window.innerHeight,350)+"px",window.addEventListener("resize",function(){e._playerContainer.style.maxWidth=Math.min(.53*window.innerHeight,350)+"px"}),this.currentStory=this._currentStory}return Object.defineProperty(i.prototype,"title",{get:function(){return this._title},set:function(t){var e=this.el.querySelector("[data-title]");e&&(this._title=t,e.textContent=t)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"currentStory",{get:function(){return this._currentStory},set:function(t){this._currentStory.color=this._color,this._currentStory.selected=!1,this._currentStory=t,this._currentStory.selected=!0,this._currentStory.color=this._activeColor,this.player.load({storyName:this._currentStory.id})},enumerable:!0,configurable:!0}),i.prototype.append=function(t){t.appendChild(this.el)},i.prototype.remove=function(){var t=this.el.parentElement;t&&t.removeChild(this.el)},i.prototype._createStories=function(t,e){var n=this,i=this.el.querySelector("[data-stories]");return t.map(function(t){return new m({id:t.id,container:i,avatarSrc:t.avatarSrc,title:t.title,description:t.description,titleColor:t.titleColor,descriptionColor:t.descriptionColor,color:n._color,titleSize:e.titleSize,avatarSize:e.avatarSize,descriptionSize:e.descriptionSize,onSelect:n._onStorySelect.bind(n)})})},i.prototype._onStorySelect=function(t){this.currentStory=t},i.prototype._createTemplate=function(){var t=document.createElement("div"),e="gobi-module";return t.classList.add(e),t.innerHTML=i._HTML,c(t.querySelectorAll("*"),e+"__"),t},Object.defineProperty(i,"_HTML",{get:function(){return'<div class="player-block"><div class="player" data-player></div></div><div class="stories-block"><div class="title" data-title></div><div class="stories" data-stories></div></div>'},enumerable:!0,configurable:!0}),i._defaultOptions={title:"",color:"",activeColor:"",playerOptions:{}},i}();function w(){return(w=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}var g=function(){function t(t){this._isOpen=!1,this._defaultOptions={classes:"",openers:""},this._eventEmitter=new i,this._listeners=[];var e=w({},this._defaultOptions,t);this.el=document.createElement("div"),this.el.className=e.classes,this.content=document.createElement("div"),this.content.className="gobi-popup__content",this.iframeContainer=document.createElement("div"),this.iframeContainer.className="gobi-popup__iframe-container",this._createTemplate(),this.player=e.player,this.appendPlayer(this.player),this.el.addEventListener("click",this._onDirectClickClose.bind(this)),this.content.addEventListener("click",this._onDirectClickClose.bind(this))}return Object.defineProperty(t.prototype,"isOpen",{get:function(){return this._isOpen},enumerable:!0,configurable:!0}),t.prototype.appendPlayer=function(t){this.player=t,this.iframeContainer.insertBefore(this.player.el,this.iframeContainer.lastElementChild)},t.prototype.open=function(){d.disable(),this.el.style.zIndex=(function(){for(var t=document.body.querySelectorAll("*"),e=1,n=0,i=t.length;i--;)e<(n=Number(window.getComputedStyle(t[i]).zIndex))&&(e=n);return e}()+1).toString(),this.el.classList.add("gobi-popup--active"),this._listeners.push(o(window,"keyup",this._onEscapeClose.bind(this))),this._isOpen=!0,this._eventEmitter.emit("open",this,this)},t.prototype.close=function(){this.el.style.zIndex="",this.el.classList.remove("gobi-popup--active"),this.el.style.padding="",d.enable(),this._removeListeners(),this.player.pause(),this._isOpen=!1,this._eventEmitter.emit("close",this,this)},t.prototype.on=function(t,e){this._eventEmitter.on(t,e)},t.prototype.off=function(t,e){this._eventEmitter.off(t,e)},t.prototype._removeListeners=function(){for(var t=this._listeners.length;t--;)this._listeners[t]()},t.prototype._createTemplate=function(){var t=document.createElement("button");t.className="gobi-popup__close-btn",t.addEventListener("click",this.close.bind(this)),this._calculatePlayerSize(),this.iframeContainer.appendChild(t),this.content.appendChild(this.iframeContainer),this.el.classList.add("gobi-popup"),this.el.appendChild(this.content),window.addEventListener("resize",this._calculatePlayerSize.bind(this))},t.prototype._onDirectClickClose=function(t){t.target===t.currentTarget&&this.close()},t.prototype._onEscapeClose=function(t){(void 0!==t.key?"Escape"===t.key||"Esc"===t.key:27===t.keyCode)&&this.close()},t.prototype._calculatePlayerSize=function(){var t,e,n=window.innerHeight-100,i=window.innerWidth;e=.5625<i/n?(t=.5625*n,n):(t=i)/.5625,this.iframeContainer.style.width=t+"px",this.iframeContainer.style.height=e+"px"},t}(),S=function(n){function i(t){var e=n.call(this,t)||this;return t.titleColor&&(e._elems.title.style.color=t.titleColor),t.descriptionColor&&(e._elems.description.style.color=t.descriptionColor),t.avatarSize&&(e._elems.avatarContainer.style.width=t.avatarSize),e.title=e._title,e.description=e._description,e.color=e._color,e}return v(i,n),Object.defineProperty(i.prototype,"title",{get:function(){return this._title},set:function(t){this._title=t,this._elems.title.textContent=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"description",{get:function(){return this._description},set:function(t){this._description=t,this._elems.description.textContent=t},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"color",{get:function(){return this._color},set:function(t){this._color=t,this._elems.avatarContainer.style.borderColor=t},enumerable:!0,configurable:!0}),i.prototype._createTemplate=function(){var t="gobi-popup-story",e=document.createElement("div");return e.classList.add(t),e.innerHTML=i._HTML,c(e.querySelectorAll("*"),t+"__"),e},Object.defineProperty(i,"_HTML",{get:function(){return'<div class="avatar-container" data-select-area data-avatarContainer><div class="avatar" data-avatar></div></div><div class="title" data-title></div><div class="description"><div class="description-text" data-description></div></div>'},enumerable:!0,configurable:!0}),i}(y);function O(){return(O=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}var C=function(){function a(t){this.el=this._createTemplate(t.verticalOrientation,!!t.wrap),this._title=t.title||"",this.title=this._title,this.stories=this._createStories(t.stories,t.color,t.avatarSize),this._currentStory=this.stories[0],this.player=new h(O({storyName:this.currentStory.id,checkViewPort:!1},t.playerOptions)),this.popup=new g({player:this.player}),t.container&&this.append(t.container)}return Object.defineProperty(a.prototype,"title",{get:function(){return this._title},set:function(t){var e=this.el.querySelector("[data-title]");e&&(this._title=t||"",e.textContent=this._title,e.style.display=this._title?"":"none")},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"currentStory",{get:function(){return this._currentStory},set:function(t){this._currentStory=t,this.player.load({storyName:this._currentStory.id})},enumerable:!0,configurable:!0}),a.prototype.append=function(t){document.body.appendChild(this.popup.el),t.appendChild(this.el)},a.prototype.remove=function(){var t=this.el.parentElement;t&&(document.body.removeChild(this.popup.el),t.removeChild(this.el),this.popup.close())},a.prototype._createStories=function(t,e,n){var i=this,r=this.el.querySelector("[data-stories]");return t.map(function(t){return new S({id:t.id,container:r,avatarSrc:t.avatarSrc,title:t.title,description:t.description,titleColor:t.titleColor,descriptionColor:t.descriptionColor,color:e,avatarSize:n,onSelect:i._onStorySelect.bind(i)})})},a.prototype._onStorySelect=function(t){this.currentStory=t,this.popup.open()},a.prototype._createTemplate=function(t,e){void 0===t&&(t=!1);var n=document.createElement("div"),i="gobi-popup-module";n.classList.add(i),n.classList.add(i+"--hoverable"),n.innerHTML=a._HTML,c(n.querySelectorAll("*"),i+"__");var r=n.lastElementChild;function o(){n.classList.remove(i+"--hoverable"),s()}function s(){window.removeEventListener("touchstart",o),window.removeEventListener("mousemove",s)}return t?r.classList.add(i+"__stories--vertical"):r.classList.add(i+"__stories--horizontal"),e||r.classList.add(i+"__stories--no-wrap"),("ontouchstart"in window||navigator.maxTouchPoints)&&(window.addEventListener("touchstart",o),window.addEventListener("mousemove",s)),n},Object.defineProperty(a,"_HTML",{get:function(){return'<div class="title" data-title></div>\n <div class="stories" data-stories></div>'},enumerable:!0,configurable:!0}),a}();function E(){return(E=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}var T=function(){function c(t){this.load(t)}return c.prototype.load=function(s){var a=this;r(s.moduleId).then(function(t){var e=E({},c._defaultOptions,s),n=e.container,i=l(u(t),e.stories),r=window.innerWidth<768,o=a._initModules(e,i);window.innerWidth<768&&o.mobile.append(n),767<window.innerWidth&&o.desktop.append(n),window.addEventListener("resize",function(){window.innerWidth<768&&!r&&(o.desktop.remove(),o.mobile.append(n),r=!0),767<window.innerWidth&&r&&(o.mobile.remove(),o.desktop.append(n),r=!1)})})},c.prototype._initModules=function(t,e){return{desktop:new b({title:t.title,color:t.color,activeColor:t.activeColor,stories:e,playerOptions:t.playerOptions,titleSize:t.desktopStoryStyle.titleSize,avatarSize:t.desktopStoryStyle.avatarSize,descriptionSize:t.desktopStoryStyle.descriptionSize}),mobile:new C({title:t.title,color:t.activeColor,stories:e,playerOptions:t.playerOptions})}},c._defaultOptions={title:"",color:"#999999",activeColor:"#15d6ea",stories:[],desktopStoryStyle:{}},c}(),k=function(){function t(t){this.load(t)}return t.prototype.load=function(n){r(n.moduleId).then(function(t){var e=l(u(t),n.stories);new C({verticalOrientation:n.verticalOrientation,wrap:n.wrap,title:n.title,color:n.color,avatarSize:n.avatarSize,stories:e,playerOptions:n.playerOptions,container:n.container})})},t}();n.d(e,"Module",function(){return P}),n.d(e,"Player",function(){return j}),n.d(e,"MobileModule",function(){return I}),n.d(e,"MobileLayout",function(){return L});var P=T,j=h,I=k,L=C}])});
{
"name": "@gobistories/gobi-web-integration",
"version": "1.6.4",
"version": "1.6.5",
"description": "",

@@ -5,0 +5,0 @@ "main": "dist/gobi-web-integration.js",

@@ -98,2 +98,3 @@ import {addPrefixToClassName} from "@/utils/utils";

container.classList.add(classPrefix);
container.classList.add(classPrefix + '--hoverable');
container.innerHTML = MobileLayout._HTML;

@@ -111,2 +112,14 @@ addPrefixToClassName(container.querySelectorAll('*'), classPrefix + '__');

}
if (('ontouchstart' in window || navigator.maxTouchPoints)) {
window.addEventListener('touchstart', onTouch);
window.addEventListener('mousemove', removeListeners);
}
function onTouch() {
container.classList.remove(classPrefix + '--hoverable');
removeListeners();
}
function removeListeners() {
window.removeEventListener('touchstart', onTouch);
window.removeEventListener('mousemove', removeListeners);
}
return container;

@@ -113,0 +126,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc