define("metaserver/static/js/modules/clean/user_education/react/user_education_effect",["require","exports","tslib","react","metaserver/static/js/modules/clean/user_education/user_education_interface","metaserver/static/js/modules/clean/user_education/user_education_client"],(function(e,t,i,n,s,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UserEducationEffect=t.RenderAtFps=void 0,n=i.__importDefault(n);class r{constructor(e,t){this.start=()=>{this.isRunning=!0;const e=this.thunk,t=this.fps;let i=-1,n=-1;const s=1e3/t,a=(e,t)=>{const i=Date.now(),r=i-(t||0);return r>s&&(e(),t=i-r%s),n=requestAnimationFrame(()=>a(e,t)),n};i=requestAnimationFrame(()=>a(e)),this.cleanup=()=>{cancelAnimationFrame(i),cancelAnimationFrame(n)}},this.stop=()=>{this.isRunning=!1,this.cleanup()},this.thunk=e,this.fps=t,this.cleanup=()=>{},this.isRunning=!1}}t.RenderAtFps=r;const c={bottom:0,height:0,left:0,right:0,top:-1e3,width:0};class o extends n.default.Component{constructor(e){super(e),this.isActive=!1,this.container=n.default.createRef()}activateElementObserver(){this.isActive=!0,this.updateRect(!0),this.startRectUpdateLoop()}deactivateElementObserver(){this.stopRectUpdateLoop(),this.isActive=!1,this.activeRect=c}componentDidMount(){a.UEClient.on(s.UEEffectChannel,this.handleUpdate,this),a.UEClient.send(s.UEEffectChannel,{type:s.UEEffectEventType.EffectReady,containerName:this.props.containerName,elementName:this.props.name}),a.UEClient.sendEvent(this.props.containerName,`${this.props.name}.componentDidMount`,{})}componentDidUpdate(){this.updateRect(!0)}shouldUpdateActiveRect(e){if(!this.activeRect)return!0;return!(this.activeRect.top===e.top&&this.activeRect.bottom===e.bottom&&this.activeRect.left===e.left&&this.activeRect.right===e.right&&this.activeRect.width===e.width&&this.activeRect.height===e.height)}updateRect(e){if(this.isActive&&this.container&&this.container.current instanceof Element){const t=this.container.current.getBoundingClientRect();t&&(e||this.shouldUpdateActiveRect(t))&&(this.activeRect=t,this.notifyRectUpdate())}}notifyRectUpdate(){this.isActive&&a.UEClient.send(s.UEEffectChannel,{type:s.UEEffectEventType.UpdateRect,containerName:this.props.containerName,elementName:this.props.name,rect:this.activeRect})}componentWillUnmount(){this.isActive&&(this.activeRect=Object.assign({},c),this.notifyRectUpdate(),this.deactivateElementObserver()),a.UEClient.removeListener(s.UEEffectChannel,this.handleUpdate,this)}startRectUpdateLoop(){this.sizeObserver||(this.sizeObserver=new r(this.updateRect.bind(this),o.RectUpdateFrequencyPerSec)),this.sizeObserver.isRunning||this.sizeObserver.start()}stopRectUpdateLoop(){this.sizeObserver&&this.sizeObserver.stop()}handleUpdate(e){e.containerName===this.props.containerName&&e.elementName===this.props.name&&(e.type===s.UEEffectEventType.Activate?this.activateElementObserver():e.type===s.UEEffectEventType.Deactivate&&this.deactivateElementObserver())}render(){const e="ue-effect-container uee-"+this.props.containerName+"-"+this.props.name;return this.props.useSpan?n.default.createElement("span",{ref:this.container,className:e},this.props.children):n.default.createElement("div",{ref:this.container,className:e},this.props.children)}}t.UserEducationEffect=o,o.displayName="UserEducationEffect",o.RectUpdateFrequencyPerSec=15})),define("metaserver/static/js/modules/clean/user_education/user_education_client",["require","exports","tslib","eventemitter3","metaserver/static/js/modules/clean/user_education/user_education_interface"],(function(e,t,i,n,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UEClient=t.UserEducationClient=void 0,n=i.__importDefault(n),window.ensemble&&!window.ensemble.eventEmitter&&(window.ensemble.eventEmitter=new n.default);const a=window.ensemble&&window.ensemble.eventEmitter?window.ensemble.eventEmitter:new n.default;class r{constructor(){this.controllerReady=!1,this.eventQueue=[],this.stepCallback={},this.globalCallbacks=[],this.on(s.UEStateChannel,this.handleUpdate,this)}init(){this._sendEvent({containerName:"UEClient",name:s.UEEventName.Subscribe,data:{}})}on(e,t,i){a.on(e,t,i)}removeListener(e,t,i){a.removeListener(e,t,i)}send(e,t){this._isUserEducationDisabled()||a.emit(e,t)}sendEvent(e,t,i={}){if(this._isUserEducationDisabled())return;const n={containerName:e,name:t,data:i};this.controllerReady?this._sendEvent(n):this.eventQueue.push(n)}_sendEvent(e){this._isUserEducationDisabled()||(this._shouldSendEventAsynchronously()?setTimeout(()=>this.send(s.UEEventChannel,e),0):this.send(s.UEEventChannel,e))}_isUserEducationDisabled(){return!window.ensemble}_shouldSendEventAsynchronously(){return!0}_registerCallbackForEducationStep(e,t,i){const n=this._getKeyForStepCallback(e,t);this.stepCallback[n]||(this.stepCallback[n]=[]),this.stepCallback[n].push(i)}registerCallbackForEducationStep(e,t,i){this._registerCallbackForEducationStep(e,t,i),this.sendEvent("UEClientCallback",s.UEEventName.Subscribe)}registerBulkCallbackForEducationStep(e,t){e.forEach(e=>{this._registerCallbackForEducationStep(e.moduleName,e.stepName,t)}),this.sendEvent("UEClientCallback",s.UEEventName.Subscribe)}registerForAllEducationSteps(e){this.globalCallbacks.push(e),this.sendEvent("UEClientCallback",s.UEEventName.Subscribe)}unregisterCallbackForEducationStep(e,t,i){this.unregisterBulkCallbackForEducationStep([{moduleName:e,stepName:t}],i)}unregisterBulkCallbackForEducationStep(e,t){e.forEach(e=>{const i=this._getKeyForStepCallback(e.moduleName,e.stepName);if(this.stepCallback[i]){-1!==this.stepCallback[i].indexOf(t)&&(this.stepCallback[i].splice(this.stepCallback[i].indexOf(t),1),0===this.stepCallback[i].length&&delete this.stepCallback[i])}})}unregisterForAllEducationSteps(e){const t=this.globalCallbacks.indexOf(e);-1!==t&&this.globalCallbacks.splice(t,1)}_getKeyForStepCallback(e,t){return`${e}.${t}`}handleUpdate(e){if(e.state!==s.UEStateType.Ready||this.controllerReady){if(e.state===s.UEStateType.ShowStep&&e.step&&e.step.name){const t=this._getKeyForStepCallback(e.moduleName,e.step.name);if(this.stepCallback[t]){for(const e of this.stepCallback[t])e();delete this.stepCallback[t]}for(const t of this.globalCallbacks)t(e)}}else for(this.controllerReady=!0;this.eventQueue.length>0;){const e=this.eventQueue.shift();e&&this._sendEvent(e)}}sendError(e){this.send(s.UEErrorChannel,e)}}t.UserEducationClient=r,t.UEClient=new r,t.UEClient.init()})),define("metaserver/static/js/modules/clean/user_education/user_education_interface",["require","exports"],(function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UEToolTipPointerPosition=t.UEEffectPosition=t.UEPulsarSize=t.UESpotlightSize=t.UEEffectType=t.UEErrorType=t.UEEffectEventType=t.UEStateType=t.UEEventName=t.UEErrorChannel=t.UEEffectChannel=t.UEStateChannel=t.UEEventChannel=void 0,t.UEEventChannel="UE.event",t.UEStateChannel="UE.state",t.UEEffectChannel="UE.effect",t.UEErrorChannel="UE.error",t.UEEventName={Subscribe:"Subscribe",NextClicked:"nextClicked",ExitOnboarding:"exitOnboarding",EffectResponded:"effectResponded",OverlayClicked:"overlayClicked"},(function(e){e.Ready="Ready",e.ShowStep="ShowStep",e.Finished="Finished"})(t.UEStateType||(t.UEStateType={})),(function(e){e.Activate="Activate",e.Deactivate="Deactivate",e.EffectReady="EffectReady",e.UpdateRect="UpdateRect"})(t.UEEffectEventType||(t.UEEffectEventType={})),(function(e){e.EFFECT_TARGET_NOT_FOUND="effect_target_not_found",e.REDIRECT_FAILED="redirect_failed"})(t.UEErrorType||(t.UEErrorType={})),(function(e){e[e.Spotlight=0]="Spotlight",e[e.Pulsar=1]="Pulsar",e[e.ToolTip=2]="ToolTip",e[e.Modal=3]="Modal"})(t.UEEffectType||(t.UEEffectType={})),(function(e){e[e.Small=1]="Small",e[e.Medium=2]="Medium",e[e.Large=3]="Large",e[e.XLarge=4]="XLarge"})(t.UESpotlightSize||(t.UESpotlightSize={})),t.UEPulsarSize=24,(function(e){e[e.Center=1]="Center",e[e.LeftCenter=2]="LeftCenter",e[e.RightCenter=3]="RightCenter"})(t.UEEffectPosition||(t.UEEffectPosition={})),(function(e){e[e.TopLeft=1]="TopLeft",e[e.TopRight=2]="TopRight",e[e.BottomLeft=3]="BottomLeft",e[e.BottomRight=4]="BottomRight"})(t.UEToolTipPointerPosition||(t.UEToolTipPointerPosition={}))})),define("metaserver/static/js/modules/clean/navigation",["require","exports","metaserver/static/js/modules/clean/referrer_cleansing_redirect","metaserver/static/js/modules/core/browser"],(function(e,t,i,n){"use strict";var s;function a(e){return e.metaKey||e.ctrlKey}Object.defineProperty(t,"__esModule",{value:!0}),t.navigationActionDispatcher=t.NavigationActionDispatcher=t.logAndNavigate=t.getNavigationMethod=t.isMetaKeyPressed=t.NavigationMethod=void 0,(function(e){e[e.REDIRECT=1]="REDIRECT",e[e.NEW_TAB=2]="NEW_TAB",e[e.UNSAFE_NEW_TAB=3]="UNSAFE_NEW_TAB"})(s=t.NavigationMethod||(t.NavigationMethod={})),t.isMetaKeyPressed=a,t.getNavigationMethod=function(e){return a(e)?s.NEW_TAB:s.REDIRECT},t.logAndNavigate=function(e,t,a=s.NEW_TAB){switch(a){case s.REDIRECT:return void(t?t().then(()=>n.redirect(e)):n.redirect(e));case s.NEW_TAB:n.open_tab(e);break;case s.UNSAFE_NEW_TAB:i.safe_open_tab_and_redirect(e)}t&&t()};class r{constructor(){this.specificHandlers={},this.genericHandlers=[]}dispatch(e){const t=this.specificHandlers[e.id];for(const i of(t||[]).concat(this.genericHandlers))if(i(e))return!0;return!1}handle(e,t){if(t&&t.actionId){const i=this.specificHandlers[t.actionId]||(this.specificHandlers[t.actionId]=[]),n=i.push(e);return()=>{i.splice(n-1,1)}}{const t=this.genericHandlers.push(e);return()=>{this.genericHandlers.splice(t-1,1)}}}}t.NavigationActionDispatcher=r,t.navigationActionDispatcher=new r})); //# sourceMappingURL=pkg-user-education-client.min.js-vflstYvbM.map