// Turner XMP, Release Build, © 2007 Turner Broadcasting System, Inc. A Time Warner Company.  File: xmp_playerapi, Version: 0.1.567.2163

xmp.PlaybackMode=function(aa,ba,ca){this.type=aa;this.name=ba;this.transitionTable=ca;};xmp.PlaybackMode.prototype.getName=function(){return this.name;};xmp.PlaybackMode.prototype.changeMode=function(da,ea,fa,ga){this.validateModeChange(da,ea,fa);da._changeState(ea,ga);};xmp.PlaybackMode.prototype.invalidOperation=function(ha,ia){throw new xmp.PlaybackModeError("Validating state operation.","Invalid mode operation.  The \""+this.name+"\" mode does not change or transition to a mode that supports the \""+ia.toLowerCase()+"\" operation.",this);};xmp.PlaybackMode.prototype.validateModeChange=function(ja,ka,la){if(false===this.isAvailable(ja,ka)){this.invalidOperation(ja,la);}};xmp.PlaybackMode.prototype.canTransition=function(ma){if(this.transitionTable===null){return false;}
for(var i=0;i<this.transitionTable.length;i++){if(this.transitionTable[i]===ma){return true;}}
return false;};xmp.PlaybackMode.prototype.getPlayer=function(na){return na._getPlayer();};xmp.PlaybackMode.prototype.open=function(oa,pa){};xmp.PlaybackMode.prototype.close=function(qa){};xmp.PlaybackMode.prototype.play=function(ra){};xmp.PlaybackMode.prototype.pause=function(sa){};xmp.PlaybackMode.prototype.stop=function(ta){};xmp.PlaybackMode.prototype.rewind=function(ua){};xmp.PlaybackMode.prototype.fastForward=function(va){};xmp.PlaybackMode.prototype.seek=function(wa,xa){};xmp.PlaybackMode.prototype.ended=function(ya){};xmp.PlaybackMode.prototype.error=function(za){};xmp.PlaybackMode.prototype.transition=function(Aa,Ba,Ca){};xmp.PlaybackMode.prototype.isAvailable=function(Da,Ea){return false;};xmp.PlaybackMode.prototype.getPosition=function(Fa){return 0;};xmp.PlaybackMode.prototype.getDuration=function(Ga){return 0;};xmp.PlaybackMode.prototype.getVolume=function(Ha){return 0;};xmp.PlaybackMode.prototype.setVolume=function(Ia,Ja){};xmp.PlaybackMode.prototype.getMute=function(Ka){return false;};xmp.PlaybackMode.prototype.setMute=function(La,Ma){};xmp.PlaybackMode.prototype.getFullscreen=function(Na){return false;};xmp.PlaybackMode.prototype.setFullscreen=function(Oa,Pa){};xmp.PlaybackMode.prototype.getBufferingProgress=function(Qa){return null;};xmp.PlugInError=function(Ra,Sa,Ta,Ua){xmp.PlugInError.ctor.call(this,xmp.XmpErrorCodes.FATAL_PLUGIN,Ra,Sa,Ta);this.plugIn=Ua;};xmp.DERIVE_CLASS(xmp.FatalException,xmp.PlugInError);xmp.MediaPlayer=function(Va,Wa){this.name=Va;this.defaultEventListener=Wa;this._logger=new xmp.util.internals.CategoryLogger('MediaPlayer');this._MEDIA_PLAYER_CONFIGURATION_PATH="/PlayerContexts/Global/Media Player";this._FULLSCREEN_ENABLED="Fullscreen Enabled";this.STRETCH_TO_FIT="Stretch To Fit";};xmp.MediaPlayer.prototype.name=null;xmp.MediaPlayer.prototype.defaultEventListener=null;xmp.MediaPlayer.prototype.init=function(){try{this._urlStrategy=xmp.ContextualUrlStrategy.create();this.registry=new xmp.PlayerModeRegistry();this.state=this.registry.findMode(xmp.FINI);this.viewManager=new xmp.ViewManager(this.name);xmp.NativePlayerRegistry.createGroup(this.name,this);this.player=xmp.NativePlayerRegistry.findPlayerByMimeType(this.name,xmp.NULL_MIME_TYPE);this.setViewportConfig(xmp.NULL_MIME_TYPE,xmp.DHTML_VIEWPORT);this.bandwidthRecorder=new xmp.BandwidthRecorder(this,this._MEDIA_PLAYER_CONFIGURATION_PATH);this.fullscreenEnabled=xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath(this._MEDIA_PLAYER_CONFIGURATION_PATH).getBoolean(this._FULLSCREEN_ENABLED,false);this.stretchToFit=xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath(this._MEDIA_PLAYER_CONFIGURATION_PATH).getBoolean(this.STRETCH_TO_FIT,false);this.listeners=[];this.mute=false;this.volume=0;this._addListener(this.defaultEventListener);if(!this.name||this.name.length===0){throw new xmp.MediaPlayerError("Validating media player name.","Invalid media player name.  Missing name.");}
if(this.name.indexOf(" ")!==-1){throw new xmp.MediaPlayerError("Validating media player name.","Invalid media player name.  Name cannot contain spaces.");}
this.listeners[0].onInitialized();}
catch(e){this._handleMethodError("Initializing.",e);}};xmp.MediaPlayer.prototype.fini=function(){try{this.close();this.viewManager.close();xmp.NativePlayerRegistry.destoryGroup(this.name);}
catch(e){this._handleMethodError("Fini.",e);}};xmp.MediaPlayer.prototype.setViewportConfig=function(Xa,Ya){try{xmp.validateArguments(arguments,[xmp.STRING_TYPE,xmp.STRING_TYPE],"MediaPlayer.setViewportConfig");if(false===xmp.PlayerPolicy.isMimeTypeSupported(Xa)){throw new xmp.InvalidMimeTypeError("Setting viewport configuration.","Invalid media player viewport MIME type \""+Xa+"\".");}
this.viewManager.setViewportConfig(Xa,Ya);}
catch(e){this._handleMethodError("Setting viewport configuration.",e);}};xmp.MediaPlayer.prototype.getViewport=function(){try{return new xmp.ViewportProxy(this.viewManager);}
catch(e){this._handleMethodError("Retrieving viewport.",e);}
return null;};xmp.MediaPlayer.prototype.open=function(Za){try{xmp.validateArguments(arguments,[xmp.OBJECT_TYPE],"MediaPlayer.open");this.node=Za;Za.setMetadata('originalUri',Za.getURI());if(false===xmp.PlayerPolicy.apply(this,Za)){return;}
this._validateNode(Za);if(false===this._initNativePlayer(Za)){this._handleNativePlayerReady(Za);}}
catch(e){this._handleMethodError("Opening.",e);}};xmp.MediaPlayer.prototype.close=function(){try{this._close();this.viewManager.close();this._setNullPlayer();}
catch(e){this._handleMethodError("Closing.",e);}};xmp.MediaPlayer.prototype.play=function(){try{this.state.play(this);}
catch(e){this._handleMethodError("Playing.",e);}};xmp.MediaPlayer.prototype.pause=function(){try{this.state.pause(this);}
catch(e){this._handleMethodError("Pausing.",e);}};xmp.MediaPlayer.prototype.stop=function(){try{this.state.stop(this);}
catch(e){this._handleMethodError("Stopping.",e);}};xmp.MediaPlayer.prototype.rewind=function(){try{this.state.rewind(this);}
catch(e){this._handleMethodError("Rewinding.",e);}};xmp.MediaPlayer.prototype.fastForward=function(){try{this.state.fastForward(this);}
catch(e){this._handleMethodError("Fast forwarding.",e);}};xmp.MediaPlayer.prototype.seek=function($a){try{xmp.validateArguments(arguments,[xmp.NUMBER_TYPE],"MediaPlayer.seek");this._validatePosition($a);this.state.seek(this,$a);}
catch(e){this._handleMethodError("Seeking.",e);}};xmp.MediaPlayer.prototype.isAvailable=function(ab){try{xmp.validateArguments(arguments,[xmp.STRING_TYPE],"MediaPlayer.isAvailable");return this.state.isAvailable(this,ab);}
catch(e){this._handleMethodError("Checking information or action available.",e);}
return false;};xmp.MediaPlayer.prototype.getPosition=function(){try{return this.state.getPosition(this);}
catch(e){this._handleMethodError("Retrieving position.",e);}
return 0;};xmp.MediaPlayer.prototype.getDuration=function(){try{return this.state.getDuration(this);}
catch(e){this._handleMethodError("Retrieving duration.",e);}
return 0;};xmp.MediaPlayer.prototype.setVolume=function(bb){try{xmp.validateArguments(arguments,[xmp.NUMBER_TYPE],"MediaPlayer.setVolume");this._validateVolume(bb);this.state.setVolume(this,bb);this.volume=this.state.getVolume(this);}
catch(e){this._handleMethodError("Setting volume.",e);}};xmp.MediaPlayer.prototype.getVolume=function(){try{return this.state.getVolume(this);}
catch(e){this._handleMethodError("Retrieving volume.",e);}
return 0;};xmp.MediaPlayer.prototype.setMute=function(cb){try{xmp.validateArguments(arguments,[xmp.BOOLEAN_TYPE],"MediaPlayer.setMute");this.state.setMute(this,cb);this.mute=this.state.getMute(this);}
catch(e){this._handleMethodError("Setting mute.",e);}};xmp.MediaPlayer.prototype.getMute=function(){try{return this.state.getMute(this);}
catch(e){this._handleMethodError("Retrieving mute.",e);}
return false;};xmp.MediaPlayer.prototype.setFullscreen=function(db){try{xmp.validateArguments(arguments,[xmp.BOOLEAN_TYPE],"MediaPlayer.setFullscreen");this.state.setFullscreen(this,db);}
catch(e){this._handleMethodError("Setting fullscreen.",e);}};xmp.MediaPlayer.prototype.getFullscreen=function(){try{return this.state.getFullscreen(this);}
catch(e){this._handleMethodError("Retrieving fullscreen.",e);}
return false;};xmp.MediaPlayer.prototype.getBufferingProgress=function(){try{return this.state.getBufferingProgress(this);}
catch(e){this._handleMethodError("Retrieving buffering progress.",e);}
return null;};xmp.MediaPlayer.prototype.addEventListener=function(eb){try{xmp.validateArguments(arguments,[xmp.OBJECT_TYPE],"MediaPlayer.addEventListener");this._addListener(eb);}
catch(e){this._handleMethodError("Adding event listener.",e);}};xmp.MediaPlayer.prototype._initNativePlayer=function(fb){try{this._close();var gb=fb.getMimeType();var hb=xmp.NativePlayerRegistry.findPlayerByMimeType(this.name,gb);if(!hb){throw new xmp.InvalidMimeTypeError("Initializing native player.","Unable to find native player for MIME type \""+gb+"\".");}
if(gb===xmp.MOCK_MIME_TYPE){this.player=hb;return false;}
var ib={player:hb,data:{group:this.name,viewport:null,volume:this.volume,mute:this.mute,node:fb,fullscreenEnabled:this.fullscreenEnabled,stretchToFit:this.stretchToFit}};if(false===this.viewManager.openViewport(this,this.name,fb.getMimeType(),ib)){if(hb.type!==this.player.type){hb.create({group:this.name,viewport:this.viewManager.getActiveViewport(),volume:this.volume,mute:this.mute,node:fb,fullscreenEnabled:this.fullscreenEnabled,stretchToFit:this.stretchToFit});this.player=hb;return true;}
return false;}
return true;}
catch(e){this._setNullPlayer();throw e;}
return false;};xmp.MediaPlayer.prototype.onNativePlayerStateChange=function(jb,kb){try{if(jb===xmp.OPEN){if(this.state.type===xmp.ERRORS||this.state.type===xmp.FINI){this._logger.debug("Ignoring native player \""+xmp.OPEN+"\" state change.  Media player is in an idle (closed) or error state.");return;}
this._notifyStateChange(jb,kb);this._notifyTimelineChange(this.state.getPosition(this),this.state.getDuration(this));this.state.play(this);return;}
else{if(jb===xmp.ENDED){this._notifyTimelineChange(this.state.getPosition(this),this.state.getDuration(this));this.state.ended(this);}
else if(jb===xmp.CONNECTING){this.bandwidthRecorder.start();}}
this._notifyStateChange(jb,kb);}
catch(e){this._handleError(e);}};xmp.MediaPlayer.prototype.onNativePlayerTrigger=function(lb,mb){};xmp.MediaPlayer.prototype.onNativePlayerError=function(e){this._handleError(e);};xmp.MediaPlayer.prototype.onNativePlayerTimelineChange=function(nb,ob){this._notifyTimelineChange(nb,ob);this._checkTimeLimit(nb,ob);};xmp.MediaPlayer.prototype.onNativePlayerCreated=function(pb,qb){if(this.state.type===xmp.ERRORS){return;}
this._logger.debug("Created \""+pb.getType()+"\" native player \""+pb.getName()+"\".");this._handleNativePlayerReady(qb.node);};xmp.MediaPlayer.prototype.onNativePlayerExecuteCommand=function(rb,sb){var tb=null;if(rb===xmp.PLAY){this.play();}
else if(rb===xmp.PAUSE){this.pause();}
else if(rb===xmp.STOP){this.stop();}
else if(rb===xmp.REWIND){this.rewind();}
else if(rb===xmp.FAST_FORWARD){this.fastForward();}
else if(rb===xmp.SEEKABLE){this.seek(parseInt(sb,10));}
else if(rb===xmp.IS_AVAILABLE){tb=this.isAvailable(sb);}
else if(rb===xmp.GET_POSITION){tb=this.getPosition();}
else if(rb===xmp.GET_DURATION){tb=this.getDuration();}
else if(rb===xmp.GET_VOLUME){tb=this.getVolume();}
else if(rb===xmp.SET_VOLUME){this.setVolume(parseInt(sb,10));}
else if(rb===xmp.GET_MUTE){tb=this.getMute();}
else if(rb===xmp.SET_MUTE){this.setMute(xmp.TRUE===sb);}
return tb;};xmp.MediaPlayer.prototype.onViewportOpened=function(ub,vb){vb.data.viewport=ub;vb.player.create(vb.data);this.player=vb.player;};xmp.MediaPlayer.prototype.onCreateViewport=function(wb,xb,yb,zb){return this.listeners[0].onCreateViewport(wb,xb,yb,zb);};xmp.MediaPlayer.prototype.onDestroyViewport=function(Ab,Bb){this.listeners[0].onDestroyViewport(Ab,Bb);};xmp.MediaPlayer.prototype.onViewportCreated=function(Cb,Db){if(this.state.type===xmp.ERRORS){return;}
if(Db===null){return;}
this._logger.debug("Created \""+Cb.getType()+"\" viewport.");this.viewManager.openViewport(this,this.name,Cb.mime_type,Db);};xmp.MediaPlayer.prototype.onViewportError=function(e){this._handleError(e);};xmp.MediaPlayer.prototype._handleMethodError=function(Eb,e){var Fb=e;if(false===(Fb instanceof xmp.MediaPlayerError)){Fb=new xmp.MediaPlayerError(((e.context)?e.context:Eb),((e.rawMessage)?e.rawMessage:e.message));Fb.setInnerError(e);}
this._handleError(Fb);};xmp.MediaPlayer.prototype._handleError=function(e){try{var Gb=((this.node)?this.node.getURI():"");if(Gb&&Gb.length>0&&(e instanceof xmp.util.internals.XMPError)){e.addExtendedInfo({label:"Url",text:Gb});}
var Hb="\n\n"+e.message;this._logger.debug(Hb);var Ib=new xmp.baseplayer.ApplicationError(e,'mediaPlayerError',e.context,[{label:"Url",text:Gb}]);if(!this.listeners||this.listeners.length===0){this._logAppError(Ib);xmp.handleFatalError(Ib);}
else{this._error();if(this._urlStrategy.tryFailover(this,this.node,e)){return;}
this._logAppError(Ib);for(var i=0;i<this.listeners.length;i++){this.listeners[i].onError(this.node,Ib);}}}
catch(e2){}};xmp.MediaPlayer.prototype._logAppError=function(Jb){if(Jb.getInnerError()instanceof xmp.NativePlayerConnectionError){this._logger.critical(Jb.message,Jb);}
else{this._logger.warn(Jb.message,Jb);}};xmp.MediaPlayer.prototype._validateNode=function(Kb){if(Kb===null){throw new xmp.InvalidPlayableNodeError("Validating playable node.","Invalid playable node.  Missing node.");}
var Lb=Kb.getMimeType();if(!Lb||Lb.length===0){throw new xmp.InvalidPlayableNodeError("Validating playable node mime type.","Invalid playable node.  Missing MIME type.");}
var Mb=Kb.getURI();if(!Mb||Mb.length===0){throw new xmp.InvalidPlayableNodeError("Validating playable node URI.","Invalid playable node.  Missing URI.");}
this._validateTimeLimit(Kb);};xmp.MediaPlayer.prototype._setNullPlayer=function(){try{var Nb=xmp.NativePlayerRegistry.findPlayerByMimeType(this.name,xmp.NULL_MIME_TYPE);if(this.viewManager.getActiveViewport()===null){this.viewManager.createViewport(this,this.name,xmp.NULL_MIME_TYPE,null);}
Nb.create({group:this.name,viewport:this.viewManager.getActiveViewport(),volume:0,mute:false,node:null,fullscreenEnabled:false,stretchToFit:false});this.player=Nb;}
catch(e){}};xmp.MediaPlayer.prototype._validateVolume=function(Ob){if(Ob<0||Ob>100){throw new xmp.util.internals.InvalidArgsError("Invalid volume \""+Ob+"\".  Valid values are 1 to 100.");}};xmp.MediaPlayer.prototype._validatePosition=function(Pb){var Qb=this.getDuration();if(Pb<0||Pb>Qb){throw new xmp.util.internals.InvalidArgsError("Invalid position \""+Pb+"\".  Valid values are 0 to "+Qb+" seconds.");}};xmp.MediaPlayer.prototype._addListener=function(Rb){this._validateListener(Rb);this.listeners.push(Rb);};xmp.MediaPlayer.prototype._validateListener=function(Sb){if(!Sb){throw new xmp.MediaPlayerError("Validating listener.","Invalid media player event listener.  NULL listener.");}
if(false===xmp.isDefined(Sb.onInitialized)){throw new xmp.MediaPlayerError("Validating listener.","Invalid media player event listener.  Missing \"onInitialized\" handler.");}
if(false===xmp.isDefined(Sb.onError)){throw new xmp.MediaPlayerError("Validating listener.","Invalid media player event listener.  Missing \"onError\" handler.");}
if(false===xmp.isDefined(Sb.onStateChange)){throw new xmp.MediaPlayerError("Validating listener.","Invalid media player event listener.  Missing \"onStateChange\" handler.");}
if(false===xmp.isDefined(Sb.onTimelineChange)){throw new xmp.MediaPlayerError("Validating listener.","Invalid media player event listener.  Missing \"onTimelineChange\" handler.");}
if(false===xmp.isDefined(Sb.onCreateViewport)){throw new xmp.MediaPlayerError("Validating listener.","Invalid media player event listener.  Missing \"onCreateViewport\" handler.");}
if(false===xmp.isDefined(Sb.onDestroyViewport)){throw new xmp.MediaPlayerError("Validating listener.","Invalid media player event listener.  Missing \"onDestroyViewport\" handler.");}
if(false===xmp.isDefined(Sb.onPlugInError)){throw new xmp.MediaPlayerError("Invalid media player event listener.  Missing \"onPlugInError\" handler.");}
if(false===xmp.isDefined(Sb.onUnsupportedPlatformError)){throw new xmp.MediaPlayerError("Invalid media player event listener.  Missing \"onUnsupportedPlatformError\" handler.");}};xmp.MediaPlayer.prototype._checkTimeLimit=function(Tb,Ub){this._validateTimeLimit(this.node);var Vb=this.node.getTimeLimitInSeconds();if(Vb!==xmp.NO_TIME_LIMIT&&Tb>=Vb){this.state.ended(this);this._notifyStateChange(xmp.ENDED,null);}};xmp.MediaPlayer.prototype._notifyTimelineChange=function(Wb,Xb){for(var i=0;i<this.listeners.length;i++){this.listeners[i].onTimelineChange(this.node,Wb,Xb);}};xmp.MediaPlayer.prototype._notifyStateChange=function(Yb,Zb){for(var i=0;i<this.listeners.length;i++){this.listeners[i].onStateChange(this.node,Yb,Zb);}};xmp.MediaPlayer.prototype.onError=function($b,e){this.node=$b;this._handleError(e);};xmp.MediaPlayer.prototype.onPlugInError=function(e){this._error();this.listeners[0].onPlugInError(e);};xmp.MediaPlayer.prototype.onUnsupportedPlatformError=function(e){this._error();this.listeners[0].onUnsupportedPlatformError(e);};xmp.MediaPlayer.prototype._changeState=function(ac,bc){var dc=this.registry.findMode(ac);dc.transition(this,bc,this.state);this._logger.debug("Changed/transitioned to \""+dc.getName()+"\" mode.");this.state=dc;};xmp.MediaPlayer.prototype._getPlayer=function(){return this.player;};xmp.MediaPlayer.prototype._validateTimeLimit=function(ec){var fc=ec.getTimeLimitInSeconds();if(false===xmp.isDefined(fc)){throw new xmp.InvalidPlayableNodeError("Invalid playable node.  Missing time limit.");}
if(fc!==xmp.NO_TIME_LIMIT&&fc<=0){throw new xmp.InvalidPlayableNodeError("Invalid playable node.  Invalid time limit \""+fc+"\". Expected values are "+xmp.NO_TIME_LIMIT+" and greater than 1 seconds.");}};xmp.MediaPlayer.prototype.getName=function(){return this.name;};xmp.MediaPlayer.prototype._error=function(){this.viewManager.hideOverlays(xmp.ALL_OVERLAYS);this.bandwidthRecorder.stop();this.state.error(this);this._setNullPlayer();};xmp.MediaPlayer.prototype._close=function(){this.bandwidthRecorder.stop();this.state.close(this);};xmp.MediaPlayer.prototype._handleNativePlayerReady=function(gc){this._urlStrategy.buildUrlAsynch(gc,new xmp.util.Callback('buildUrlAsynch',this._handleBuildUrlAsynch,this));};xmp.MediaPlayer.prototype._handleBuildUrlAsynch=function(hc,ic,jc){if(this.state.type===xmp.ERRORS){return;}
if(jc!==null){if(jc instanceof xmp.PlugInError){this.onPlugInError(jc);}
else{this.onError(ic,jc);xmp.handleFatalError(jc);}
return;}
this.state.open(this,ic);};xmp.MediaPlayerFactory=function(){};xmp.MediaPlayerFactory.createPlayer=function(kc,lc){return new xmp.MediaPlayer(kc,lc);};xmp.NATIVE_PLAYER_Z_INDEX=1;xmp.VERSION_DELIMITER=".";xmp.MOVETO_OPERATION="moveTo";xmp.ACTIVEX_VERSION_DETECTION_JSON="ActiveX Version Detection JSON";xmp.MOZILLA_VERSION_DETECTION_JSON="Mozilla Version Detection JSON";xmp.AbstractNativePlayer=function(mc,nc,oc){this.type=mc;this.listener=nc;this.configuration=oc;this.data=null;this.volume=0;this.mute=false;this.bufferingProgress={percent:0,bytesDownloaded:0,bytesTotal:0};this.opened=false;this.monitorTimer=null;this.logger=null;this.plugIns=null;};xmp.AbstractNativePlayer.prototype.open=function(pc){};xmp.AbstractNativePlayer.prototype.close=function(){this.opened=false;this.stopMonitor();this.bufferingProgress={percent:0,bytesDownloaded:0,bytesTotal:0};};xmp.AbstractNativePlayer.prototype.fini=function(){try{if(this.data===null){return;}
this.close();var qc=this.getNative();var rc=xmp.getDomParent(qc);rc.removeChild(qc);}
catch(e){}};xmp.AbstractNativePlayer.prototype.play=function(){this.startMonitor();};xmp.AbstractNativePlayer.prototype.pause=function(){this.stopMonitor();};xmp.AbstractNativePlayer.prototype.stop=function(){this.stopMonitor();};xmp.AbstractNativePlayer.prototype.rewind=function(){this.startMonitor();};xmp.AbstractNativePlayer.prototype.fastForward=function(){this.startMonitor();};xmp.AbstractNativePlayer.prototype.seek=function(sc){this.startMonitor();};xmp.AbstractNativePlayer.prototype.ended=function(){this.stopMonitor();};xmp.AbstractNativePlayer.prototype.error=function(){this.close();};xmp.AbstractNativePlayer.prototype.isAvailable=function(tc){return false;};xmp.AbstractNativePlayer.prototype.getPosition=function(){return 0;};xmp.AbstractNativePlayer.prototype.getDuration=function(){return 0;};xmp.AbstractNativePlayer.prototype.getVolume=function(){return this.volume;};xmp.AbstractNativePlayer.prototype.setVolume=function(uc){this.volume=uc;};xmp.AbstractNativePlayer.prototype.getMute=function(){return this.mute;};xmp.AbstractNativePlayer.prototype.setMute=function(vc){this.mute=vc;};xmp.AbstractNativePlayer.prototype.getFullscreen=function(){return false;};xmp.AbstractNativePlayer.prototype.setFullscreen=function(wc){var xc="The \"setFullscreen\" method is not supported.";if(false===this.isFullscreenEnabled()){xc="The \"setFullscreen\" method is not supported.  Fullscreen disabled.";}
throw new xmp.NativePlayerUnsupportedError("Invoking \"setFullscreen\" method.",xc,this);};xmp.AbstractNativePlayer.prototype.getBufferingProgress=function(){return this.bufferingProgress;};xmp.AbstractNativePlayer.prototype.moveTo=function(yc,zc,Ac,Bc){var Cc=((this.getNative().style.zIndex)?"z-Index: "+this.getNative().style.zIndex+";":"")+"left: "+xmp.getPixelUnits(yc)+"; top: "+xmp.getPixelUnits(zc)+"; width: "+xmp.getPixelUnits(Ac)+"; height: "+xmp.getPixelUnits(Bc);this.getNative().style.cssText=Cc;};xmp.AbstractNativePlayer.prototype.validate=function(Dc){this.plugIns=xmp.PlayerPolicy.getPlugins();this.onValidatePlugIn(Dc);};xmp.AbstractNativePlayer.prototype.onValidatePlugIn=function(Ec){};xmp.AbstractNativePlayer.prototype.onMonitorTimelineChange=function(Fc,Gc){};xmp.AbstractNativePlayer.prototype.setState=function(Hc,Ic){if(Hc===xmp.OPEN){this.opened=true;}
else if(Hc===xmp.BUFFERING){this.bufferingProgress=Ic;}
this.createTimer({object:this,id:"setState",interval:xmp.DEFAULT_TIMER_INTERVAL,handler:this.onSetState,context:{type:Hc,data:Ic}}).start();};xmp.AbstractNativePlayer.prototype.setError=function(Jc,e){this.stopMonitor();var Kc=e;if(false===(Kc instanceof xmp.NativePlayerError)&&false===(Kc instanceof xmp.NativePlayerConnectionError)){Kc=new xmp.NativePlayerError(((e.context)?e.context:Jc),((e.rawMessage)?e.rawMessage:e.message),this);Kc.setInnerError(e);}
this.createTimer({object:this,id:"setError",interval:xmp.DEFAULT_TIMER_INTERVAL,handler:this.onSetError,context:Kc}).start();};xmp.AbstractNativePlayer.prototype.setTrigger=function(Lc,Mc){this.createTimer({object:this,id:"setTrigger",interval:xmp.DEFAULT_TIMER_INTERVAL,handler:this.onSetTrigger,context:{name:Lc,data:Mc}}).start();};xmp.AbstractNativePlayer.prototype.setCreated=function(){this.data.viewport.setNativePlayer(this);this.createTimer({object:this,id:"setCreated",interval:xmp.DEFAULT_TIMER_INTERVAL,handler:this.onSetCreated,context:null}).start();};xmp.AbstractNativePlayer.prototype.executeCommand=function(Nc,Oc){return this.listener.onNativePlayerExecuteCommand(Nc,Oc);};xmp.AbstractNativePlayer.prototype.create=function(Pc){this.data=Pc;if(this.logger){this.logger=null;}
this.logger=new xmp.util.internals.CategoryLogger("Native Player ("+this.getName()+")");};xmp.AbstractNativePlayer.prototype.attach=function(Qc){this.data=Qc;};xmp.AbstractNativePlayer.prototype.getNative=function(){var Rc=xmp.findDomElement(this.data.id);if(!Rc){throw new xmp.NativePlayerError("Retrieving native player.","Unable to retrieve \""+this.type+"\" native player.",this);}
return Rc;};xmp.AbstractNativePlayer.prototype.getName=function(){return((this.data)?this.data.id:"");};xmp.AbstractNativePlayer.prototype.getType=function(){return this.type;};xmp.AbstractNativePlayer.prototype.getGroup=function(){return((this.data)?this.data.group:"");};xmp.AbstractNativePlayer.prototype.isFullscreenEnabled=function(){return((this.data)?this.data.fullscreenEnabled:false);};xmp.AbstractNativePlayer.prototype.startMonitor=function(){if(!this.monitorTimer){var Sc=this.getMonitorInterval();this.monitorTimer=this.createTimer({object:this,id:"timelineChange",interval:Sc,handler:this.onTimelineChange,context:null});this.monitorTimer.start();}};xmp.AbstractNativePlayer.prototype.stopMonitor=function(){if(this.monitorTimer){this.monitorTimer.stop();this.monitorTimer=null;}};xmp.AbstractNativePlayer.prototype.parseVersion=function(Tc){var Uc=Tc;var Vc=0;var Wc=-1;var Xc=-1;var Yc=-1;var Zc=Uc.indexOf(xmp.VERSION_DELIMITER);if(Zc!==-1){Vc=parseInt(Uc.substr(0,Zc),10);Uc=Uc.substr(Zc+1);Zc=Uc.indexOf(xmp.VERSION_DELIMITER);if(Zc!==-1){Wc=parseInt(Uc.substr(0,Zc),10);Uc=Uc.substr(Zc+1);Zc=Uc.indexOf(xmp.VERSION_DELIMITER);if(Zc!==-1){Xc=parseInt(Uc.substr(0,Zc),10);Uc=Uc.substr(Zc+1);if(Uc.length>0){Yc=parseInt(Uc,10);}}
else{Xc=parseInt(Uc,10);}}
else{Wc=parseInt(Uc,10);}}
else{Vc=parseInt(Uc,10);Vc=((true===isNaN(Vc))?-1:Vc);}
return{major:Vc,minor:Wc,revision:Xc,build:Yc};};xmp.AbstractNativePlayer.prototype.validatePlugInVersion=function($c,ad){var bd=$c+"PlugInVersion";xmp.util.PlayerStats.getInstance().setValue(bd,ad);var cd=this.parseVersion(ad);var dd=this.getPlugInInfo($c);var ed=this.parseVersion(dd.minVersion);var fd=this.parseVersion(dd.maxVersion);var gd=[{version:cd.major,minVersion:ed.major,maxVersion:fd.major},{version:cd.minor,minVersion:ed.minor,maxVersion:fd.minor},{version:cd.revision,minVersion:ed.revision,maxVersion:fd.revision},{version:cd.build,minVersion:ed.build,maxVersion:fd.build}];var hd=gd.length;for(var i=0;i<hd;i++){if((gd[i].version<gd[i].minVersion)){throw new xmp.InvalidPlugInVersionError("Validating native player plugin version.",dd,ad);}
if((gd[i].maxVersion!==-1)&&(gd[i].version>gd[i].maxVersion)){throw new xmp.UnsupportedPlugInVersionError("Validating native player plugin version.",dd,ad);}
if((gd[i].version!==gd[i].minVersion)&&(gd[i].version!==gd[i].maxVersion)){break;}}};xmp.AbstractNativePlayer.prototype.getPlugInInfo=function(jd){var kd=this.plugIns[jd];if(!kd){throw new xmp.NativePlayerError("Retrieving plugin info.","Unable to retrieve \""+jd+"\" plugin information.",this);}
return kd;};xmp.AbstractNativePlayer.prototype.createTimer=function(ld){var md=new xmp.util.Callback(ld.id,ld.handler,ld.object);md.setMetadata(xmp.CONTEXT,ld.context);return new xmp.util.Timer(ld.id,ld.interval,-1,md);};xmp.AbstractNativePlayer.prototype.onTimelineChange=function(nd,od){try{var pd=parseInt(this.getDuration(),10);var qd=((pd>0)?parseInt(this.getPosition(),10):0);this.onMonitorTimelineChange(qd,pd);this.listener.onNativePlayerTimelineChange(qd,pd);}
catch(e){this.setError("Forwarding timeline change to listener.",e);}};xmp.AbstractNativePlayer.prototype.onSetState=function(rd,sd){try{sd.stop();var td=rd.getMetadata(xmp.CONTEXT,{});this.listener.onNativePlayerStateChange(td.type,td.data);}
catch(e){this.setError("Forwarding state change notification to listener.",e);}};xmp.AbstractNativePlayer.prototype.onSetError=function(ud,vd){var wd=null;try{vd.stop();wd=ud.getMetadata(xmp.CONTEXT,{});this.listener.onNativePlayerError(wd);}
catch(e){var xd=((wd)?wd:e);xmp.handleFatalError(xd);}};xmp.AbstractNativePlayer.prototype.onSetTrigger=function(yd,zd){try{zd.stop();var Ad=yd.getMetadata(xmp.CONTEXT,{});this.listener.onNativePlayerTrigger(Ad.name,Ad.data);}
catch(e){this.setError("Forwarding trigger notification to listener.",e);}};xmp.AbstractNativePlayer.prototype.onSetCreated=function(Bd,Cd){try{Cd.stop();this.listener.onNativePlayerCreated(this,this.data);}
catch(e){this.setError("Forwarding created notification to listener.",e);}};xmp.AbstractNativePlayer.prototype.getCallbackMethod=function(Dd){return"xmp.NativePlayerRegistry.findPlayerByType( '"+this.data.group+"', '"+this.type+"' )."+Dd;};xmp.AbstractNativePlayer.prototype.getLogger=function(){return this.logger;};xmp.AbstractNativePlayer.prototype.isOpen=function(){return this.opened;};xmp.AbstractNativePlayer.prototype.getMonitorInterval=function(){return xmp.MONITOR_INTERVAL;};xmp.AbstractNativePlayer.prototype.getConfigProperty=function(Ed){return xmp.PlayerPolicy.getNativePlayerConfig(this.configuration)[Ed];};xmp.AbstractNativePlayer.prototype.getMonitorInterval=function(){return xmp.MONITOR_INTERVAL;};xmp.AbstractNativePlayer.prototype.getVersionFromString=function(Fd,Gd){var Hd=this.getConfigProperty(Fd);Hd=Hd.replace(/\{\{version\}\}/g,"\""+Gd+"\"");var Id='{getVersion:function(){'+Hd+'}}';var Jd=xmp.net.AjaxRequestManager.getInstance()._parseJson(Id);return Jd.getVersion();};xmp.PLATFORMS_NODE_PATH="/PlayerContexts/Global/PlayingPolicy/Platforms";xmp.HOST_REL_NODE_PATH="video";xmp.BROWSER_NODE_PATH="Browser";xmp.HOST_PARAMETER="{host}";xmp.PATH_PARAMETER="{path}";xmp.SIZE_PARAMETER="{size}";xmp.AbstractPlayingPolicy=function(Kd,Ld){this.type=Kd;this.playerPolicy=Ld;};xmp.AbstractPlayingPolicy.prototype.apply=function(Md,Nd){if(false===this.canApply(Nd)){return true;}
try{this.validatePlatform(Md.getName(),Nd.getStreamingMode());}
catch(e){this.handleApplyError(Md,Nd,e,false);return false;}
var Od=this.getApplyPolicy(Nd);var Pd=Od.media.length;for(var i=0;i<Pd;i++){try{var Qd=this.playerPolicy.getMediaType(Od.media[i]);this.validateMedia(Od.type,Od.media[i],Qd);if(false===this.isPlayable(Qd,Nd)){continue;}
this.playerPolicy.getLogger().debug("Applying playing policy \""+Od.type+"\" to playable node.");this.setPolicy(Md.getName(),Qd,Nd);return true;}
catch(e2){var Rd=this.handleApplyError(Md,Nd,e2,this.canFailover(Od.type,Nd,i,Od.media));if(true===Rd){continue;}
return false;}}
var Sd=[];try{Sd=this.playerPolicy.getSizes();}
catch(e3){}
throw new xmp.PlayingPolicyApplyError("Applying playing policy.",Sd,Od,Nd);};xmp.AbstractPlayingPolicy.prototype.getType=function(){return this.type;};xmp.AbstractPlayingPolicy.prototype.getApplyPolicy=function(Td){var Ud=this.playerPolicy.getSupportedPlatformBrowser(xmp.util.internals.BrowserDetect.OS,xmp.util.internals.BrowserDetect.browser);var Vd=Td.getStreamingMode();var Wd=this.playerPolicy.getPlaybackPriorityGroup(Ud.modes[Vd]);var Xd=xmp.util.internals.BrowserDetect.OS+"/"+xmp.util.internals.BrowserDetect.browser+((Vd&&Vd.length>0)?("/"+Vd):"");return{type:Xd,media:Wd};};xmp.AbstractPlayingPolicy.prototype.isPlayable=function(Yd,Zd){if(false===this.validateMimeType(Yd,Zd)){return false;}
return this.validateSize(Yd,Zd);};xmp.AbstractPlayingPolicy.prototype.setupNode=function($d,ae){if(!ae.isUriAbsolute()){var be=$d.streamingModes[ae.getStreamingMode()];var ce=be.url_mask;var de=[{name:xmp.HOST_PARAMETER,value:this.getHost($d,be)},{name:xmp.PATH_PARAMETER,value:ae.getURI()},{name:xmp.SIZE_PARAMETER,value:this.getSize($d,ae)}];for(var i=0;i<de.length;i++){ce=ce.replace(de[i].name,de[i].value);}
ae.setMimeType($d.mimeType);ae.setURI(ce);this.playerPolicy.getLogger().debug("Setting up playable node URI from mask ("+be.url_mask+") and MIME type ("+$d.mimeType+"). URI - "+ce);}
ae.setUriAbsolute(true);};xmp.AbstractPlayingPolicy.prototype.getSize=function(ee,fe){var ge="";if(true===this.urlMaskContainsSize(ee,fe)){ge=this.playerPolicy.getSizeFromPlayer(fe.getSizes());}
return ge;};xmp.AbstractPlayingPolicy.prototype.getHost=function(he,ie){if(-1===ie.url_mask.indexOf(xmp.HOST_PARAMETER)){return"";}
var je=xmp.HOST_REL_NODE_PATH+"/"+he.type+"/"+ie.type;var ke=xmp.util.RootUrlProvider.getInstance().getRootUrl(je);if(ke.length===0){throw new xmp.PlayingPolicyError("Retrieving host.","Unable to find \""+he.type+"\" playing policy streaming host configuration for \""+ie.type+"\".");}
return ke;};xmp.AbstractPlayingPolicy.prototype.validateMedia=function(le,me,ne){if(!ne){throw new xmp.PlayingPolicyError("Validating media.","Invalid \""+le+"\" playing policy media type \""+me+"\".");}};xmp.AbstractPlayingPolicy.prototype.setPolicy=function(oe,pe,qe){xmp.NativePlayerRegistry.validate(oe,pe.mimeType);this.setupNode(pe,qe);};xmp.AbstractPlayingPolicy.prototype.validateMimeType=function(re,se){var te=se.getMimeTypes();var ue=te.length;for(var i=0;i<ue;i++){if(re.mimeType===te[i]){return true;}}
return false;};xmp.AbstractPlayingPolicy.prototype.validateSize=function(ve,we){if(false===this.urlMaskContainsSize(ve,we)){return true;}
return(this.playerPolicy.getSizeFromPlayer(we.getSizes()).length>0);};xmp.AbstractPlayingPolicy.prototype.urlMaskContainsSize=function(xe,ye){return(xe.streamingModes[ye.getStreamingMode()].url_mask.indexOf(xmp.SIZE_PARAMETER)!==-1);};xmp.AbstractPlayingPolicy.prototype.validateBootstrap=function(ze){};xmp.AbstractPlayingPolicy.prototype.validatePlatform=function(Ae,Be){var Ce=this.playerPolicy.getSupportedPlatformBrowser(xmp.util.internals.BrowserDetect.OS,xmp.util.internals.BrowserDetect.browser);if(!Ce||(Be&&!Ce.modes[Be])){var De=xmp.util.internals.BrowserDetect.OS+"/"+xmp.util.internals.BrowserDetect.browser+((Be&&Be.length>0)?("/"+Be):"");throw new xmp.UnsupportedPlatformError(Ae,"The platform \""+De+"\" is unsupported.");}};xmp.AbstractPlayingPolicy.prototype.handleApplyError=function(Ee,Fe,e,Ge){if(true===this.playerPolicy.getFailover()&&true===Ge){this.playerPolicy.getLogger().warn("\n\n"+e.message,e);return true;}
this.playerPolicy.getLogger().critical("\n\n"+e.message,e);Ee.onError(Fe,e);return false;};xmp.AbstractPlayingPolicy.prototype.canApply=function(He){var Ie=He.getStreamingMode();return((Ie&&Ie.length>0)?true:false);};xmp.AbstractPlayingPolicy.prototype.canFailover=function(Je,Ke,Le,Me){try{var Ne=Me.length;for(var i=Le+1;i<Ne;i++){var Oe=this.playerPolicy.getMediaType(Me[i]);this.validateMedia(Je,Me[i],Oe);if(false===this.isPlayable(Oe,Ke)){continue;}
return true;}}
catch(e){}
return false;};xmp.BANDWIDTH_RECORDER_SAMPLE_TIMER="BandwidthRecorderSampleTimer";xmp.CURRENT_BANDWIDTH_LABEL="CurrentBandwidth";xmp.CUMULATIVE_BANDWIDTH_LABEL="CumulativeBandwidth";xmp.BANDWIDTH_SAMPLE_INTERVAL="Bandwidth Sample Interval";xmp.BandwidthRecorder=function(Pe,Qe){var Re=xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath(Qe).getInt(xmp.BANDWIDTH_SAMPLE_INTERVAL,-1);if(-1===Re.length){throw new xmp.BandwidthRecorderError("Initializing.","Missing bandwidth recorder sample interval.");}
this.player=Pe;this.logger=new xmp.util.internals.CategoryLogger('BandwidthRecorder');var Se=new xmp.util.Callback(xmp.BANDWIDTH_RECORDER_SAMPLE_TIMER,this.onSample,this);this.sampleTimer=new xmp.util.Timer(xmp.BANDWIDTH_RECORDER_SAMPLE_TIMER,Re,-1,Se);this.totalBytesDownloaded=0;this.totalDuration=0;this.reset();};xmp.BandwidthRecorder.prototype.start=function(){this.stop();this.sampleStartTime=this.initSampleTime();this.sampleTimer.start();};xmp.BandwidthRecorder.prototype.stop=function(){this.sampleTimer.stop();this.totalDuration+=this.lastDuration;this.totalBytesDownloaded+=this.lastBytesDownloaded;this.reset();};xmp.BandwidthRecorder.prototype.onSample=function(Te,Ue){try{var Ve=this.player.getBufferingProgress();this.validateSample(Ve);var We=this.initSampleTime();var Xe=(We-this.sampleStartTime);var Ye=this.calcBandwidth(Xe,Ve.bytesDownloaded);this.logBandwidth(Ye,xmp.CURRENT_BANDWIDTH_LABEL,Ve.bytesDownloaded,"Downloaded Bytes");var Ze=(this.totalBytesDownloaded+Ve.bytesDownloaded);Ye=this.calcBandwidth((this.totalDuration+Xe),Ze);this.logBandwidth(Ye,xmp.CUMULATIVE_BANDWIDTH_LABEL,Ze,"Cumulative Bytes");this.lastBytesDownloaded=Ve.bytesDownloaded;this.lastDuration=Xe;if(100===Ve.percent){this.stop();}}
catch(e){this.logger.warn("\n\n"+e.message);this.stop();}};xmp.BandwidthRecorder.prototype.reset=function(){this.sampleStartTime=0;this.lastBytesDownloaded=0;this.lastDuration=0;};xmp.BandwidthRecorder.prototype.initSampleTime=function(){return(new Date()).getTime();};xmp.BandwidthRecorder.prototype.calcBandwidth=function($e,b){try{var af=($e/1000);var x=((b*8)/1024);return(x/af);}
catch(e){var bf=new xmp.BandwidthRecorderError("Calculating bandwidth.",e.message);bf.setInnerError(e);throw bf;}};xmp.BandwidthRecorder.prototype.logBandwidth=function(cf,df,ef,ff){try{var gf=Math.ceil(cf)+"KB/sec";this.logger.info(df+":  "+gf+", "+ff+":  "+ef);xmp.util.PlayerStats.getInstance().setValue(df,gf);}
catch(e){var hf=new xmp.BandwidthRecorderError("Logging bandwidth.",((e.rawMessage)?e.rawMessage:e.message));hf.setInnerError(e);throw hf;}};xmp.BandwidthRecorder.prototype.validateSample=function(jf){if(!jf){throw new xmp.BandwidthRecorderError("Validating sample.","Missing sample.");}
if(false===xmp.isDefined(jf.bytesDownloaded)){throw new xmp.BandwidthRecorderError("Validating sample.","Missing bytes downloaded.");}};xmp.LAZY_PLAYING_POLICY="Lazy";xmp.VALIDATE_ON_BOOTSTRAP="ValidateOnBootstrap";xmp.LazyPlayingPolicy=function(kf){xmp.LazyPlayingPolicy.ctor.call(this,xmp.LAZY_PLAYING_POLICY,kf);};xmp.DERIVE_CLASS(xmp.AbstractPlayingPolicy,xmp.LazyPlayingPolicy);xmp.LazyPlayingPolicy.prototype.validateBootstrap=function(lf){try{xmp.NativePlayerRegistry.createGroup(xmp.VALIDATE_ON_BOOTSTRAP,lf);this.validatePlatform(xmp.VALIDATE_ON_BOOTSTRAP);var mf=this.playerPolicy.getBootstrapMedia();for(var i=0;i<mf.length;i++){xmp.NativePlayerRegistry.validate(xmp.VALIDATE_ON_BOOTSTRAP,mf[i].mimeType);}}
catch(e){this.playerPolicy.getLogger().fatal("\n\n"+e.message,e);if(e.plugIn){lf.onPlugInError(e);}
else if(true===(e instanceof xmp.UnsupportedPlatformError)){lf.onUnsupportedPlatformError(e);}}
finally{xmp.NativePlayerRegistry.destoryGroup(xmp.VALIDATE_ON_BOOTSTRAP);}};xmp.NativePlayerRegistry=function(){var nf={};var of=new xmp.util.internals.CategoryLogger("NativePlayerRegistry");return{createGroup:function(pf,qf){if(nf[pf]!==null&&true===xmp.isDefined(nf[pf])){throw new xmp.NativePlayerError("Creating group.","A native player group already exists with the name \""+pf+"\".",null);}
var rf=xmp.PlayerPolicy.getSupportedPlatformBrowser(xmp.util.internals.BrowserDetect.OS,xmp.util.internals.BrowserDetect.browser);var sf=((rf)?xmp.PlayerPolicy.getNativePlayerGroup(rf.playersGroup):xmp.PlayerPolicy.getDefaultNativePlayerGroup());nf[pf]={owner:qf,template:sf,players:{}};of.info("Created native player group \""+pf+"\".");},findPlayerByMimeType:function(tf,uf){var vf=this.findGroup(tf);var wf=vf.players[uf];if(wf){return wf;}
this.validate(tf,uf);wf=vf.players[uf];if(wf){return wf;}
throw new xmp.NativePlayerNotFoundError("Finding player by mime type.","Unable to find native player for mime type \""+uf+"\".",tf,uf);},findPlayerByType:function(xf,yf){var zf=this.findGroup(xf);for(var Af=xmp.MapIterator.create(zf.players);Af.hasNext();Af.next()){var Bf=Af.currentValue();if(Bf.getType()===yf){return Bf;}}
throw new xmp.NativePlayerNotFoundError("Finding player by media type.","Unable to find native player for type \""+yf+"\".",xf,yf);},validate:function(Cf,Df){var Ef=this.findGroup(Cf);var Ff=Ef.players[Df];if(Ff){Ff.validate(Df);return;}
var Gf=Ef.template[Df];if(!Gf){throw new xmp.NativePlayerNotFoundError("Validating player.","Unable to find native player for mime type \""+Df+"\".  Missing native player group.",Cf,Df);}
var Hf=Gf.length;var If=null;for(var i=0;i<Hf;i++){try{Ff=this.createNativePlayer(Ef.owner,Gf[i]);Ff.validate(Df);Ef.players[Df]=Ff;of.info("Registered native player \""+Ff.getType()+"\" for mime type \""+Df+"\" and group \""+Cf+"\".");return;}
catch(e){of.warn("\n\n"+e.message,e);if(i===0){If=e;}
if(i===(Hf-1)){throw If;}}}},destoryGroup:function(Jf){var Kf=this.findGroup(Jf);if(!Kf){return;}
for(var Lf=xmp.MapIterator.create(Kf.players);Lf.hasNext();Lf.next()){var Mf=Lf.currentValue();Mf.fini();}
nf[Jf]=null;of.info("Destroyed native player group \""+Jf+"\".");},createNativePlayer:function(Nf,Of){var Pf=xmp.getNamespacedMethod(Of);return new Pf(Nf,Of);},validateGroup:function(Qf,Rf){if(!Rf){throw new xmp.NativePlayerGroupNotFoundError("Validating native player group.","Invalid native player group \""+Qf+"\".",Qf);}},findGroup:function(Sf){var Tf=nf[Sf];this.validateGroup(Sf,Tf);return Tf;}};}();xmp.NULL_PLAYER="Null";xmp.NULL_MIME_TYPE="application/x-null";xmp.NullPlayer=function(Uf,Vf){xmp.NullPlayer.ctor.call(this,xmp.NULL_PLAYER,null,Vf);};xmp.DERIVE_CLASS(xmp.AbstractNativePlayer,xmp.NullPlayer);xmp.NullPlayer.prototype.create=function(Wf){Wf.id=Wf.viewport.name;if(Wf.viewport&&Wf.viewport.getType()===xmp.DHTML_VIEWPORT){Wf.viewport.getNative().style.backgroundColor=xmp.BLACK_BACKGROUND_COLOR;Wf.viewport.getNative().innerHTML="";}
xmp.NullPlayer.base.create.call(this,Wf);};xmp.PlayerPolicy=function(){var Xf="/PlayerContexts/Global/PlayingPolicy";var Yf="PlayingPolicy/MediaTypes";var Zf="PlayingPolicy/PlugIns";var $f="Strategy";var ag="PlayingPolicy/Streaming Modes";var bg="PlayingPolicy/Bootstrap Media";var cg="PlayingPolicy/Supported Platforms";var dg="PlayingPolicy/Playback Priority Groups";var eg="PlayingPolicy/Native Players";var fg="PlayingPolicy/Native Player Groups";var gg="PlayingPolicy/Playback Platforms";var hg="Streaming Modes";var ig="Players";var jg="Properties";var kg="mime-type";var lg="display-name";var mg="download-url";var ng="minimum-version";var og="maximum-version";var pg="Failover";var qg="BasePlayer/PlayerSizes";var rg="PlugIns Overrides";return{initMediaTypes:function(){this.mediaTypes={};var sg=xmp.util.SettingsManager.getInstance().getGlobalContextNode();var tg=sg.getNodeForPath(Yf);var ug=tg.retrieveChildren();var vg=ug.length;for(var i=0;i<vg;i++){var wg=ug[i];var xg=wg.getString(kg,xmp.NO_DEFAULT_VALUE);this.validateMimeType(wg.getName(),xg);var yg={type:wg.getName(),mimeType:xg,streamingModes:{}};var zg=wg.getNodeForPath(hg);var Ag=zg.retrieveKeys();var Bg=Ag.length;for(var j=0;j<Bg;j++){var Cg=this.getStreamingMode(yg.type,zg,Ag[j]);yg.streamingModes[Cg.type]=Cg;}
this.mediaTypes[yg.type]=yg;}},initPlugins:function(){this.plugIns={};var Dg=xmp.util.SettingsManager.getInstance().getGlobalContextNode();var Eg=Dg.getNodeForPath(Zf);var Fg=Eg.retrieveChildren();var Gg=Fg.length;for(var i=0;i<Gg;i++){var Hg=Fg[i];var Ig={name:Hg.getName(),displayName:Hg.getString(lg,xmp.NO_DEFAULT_VALUE),minVersion:Hg.getString(ng,xmp.NO_DEFAULT_VALUE),maxVersion:Hg.getString(og,xmp.NO_DEFAULT_VALUE),downloadUrl:Hg.getString(mg,xmp.NO_DEFAULT_VALUE),properties:{}};this.validatePlugIn(Ig);this.plugIns[Hg.getName()]=Ig;}},apply:function(Jg,Kg){this.init();return this.getStrategy().apply(Jg,Kg);},validateMimeType:function(Lg,Mg){if(!Mg){throw new xmp.InvalidMimeTypeError("Validating player policy media mime type.","NULL \""+Lg+"\" playing policy MIME type \""+Mg+"\".");}
if(Mg.length===0){throw new xmp.InvalidMimeTypeError("Validating player policy media mime type.","Missing \""+Lg+"\" playing policy MIME type \""+Mg+"\".");}},getStreamingMode:function(Ng,Og,Pg){var Qg={type:Pg,url_mask:Og.getString(Pg,xmp.NO_DEFAULT_VALUE)};this.validateStreamingMode(Ng,Qg);return Qg;},validateStreamingMode:function(Rg,Sg){if(false===this.isStreamingModeSupported(Sg.type)){throw new xmp.PlayingPolicyError("Validating streaming mode.","Invalid streaming mode "+Sg.type+" for media type "+Rg+".");}
if(Sg.url_mask.length===0){throw new xmp.PlayingPolicyError("Validating streaming mode.","Missing \""+Rg+"\" playing policy \""+Sg.type+"\" url mask.");}},getStrategy:function(){if(this.strategy===null){var Tg=xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath(Xf);var Ug=Tg.getString($f,xmp.NO_DEFAULT_VALUE);if(Ug.length===0){throw new xmp.PlayingPolicyError("Retrieving strategy.","Missing playing policy strategy.  Expected \"Lazy\".");}
this.strategy=xmp.PlayingPolicyFactory.createStrategy(Ug,this);this.getLogger().debug("Created player policy \""+Ug+"\" strategy.");}
return this.strategy;},getMediaType:function(Vg){return this.mediaTypes[Vg];},getPlugins:function(){this.init();return this.plugIns;},getPlugin:function(Wg){return this.getPlugins()[Wg];},validatePlugIn:function(Xg){if(Xg.displayName.length===0){throw new xmp.PlayingPolicyError("Validating plugin.","Missing plugin display name.");}
if(Xg.minVersion.length===0){throw new xmp.PlayingPolicyError("Validating plugin.","Missing plugin \""+Xg.displayName+"\" minimum version.");}
if(Xg.downloadUrl.length===0){throw new xmp.PlayingPolicyError("Validating plugin.","Missing plugin \""+Xg.displayName+"\" download url.");}},getLogger:function(){return this.logger;},init:function(){if(this.initialized&&true===this.initialized){return;}
this.initialized=true;this.strategy=null;this.logger=new xmp.util.internals.CategoryLogger('PlayerPolicy');xmp.util.PlayerStats.getInstance().setValue("OS",navigator.platform);xmp.util.PlayerStats.getInstance().setValue("Browser",navigator.userAgent);this.initStreamingModes();this.initMediaTypes();this.initBootstrapMedia();this.initPlugins();this.initNativePlayers();this.initNativePlayerGroups();this.initSupportedPlatforms();this.initPlaybackPriorityGroups();this.initPlaybackPlatforms();},getFailover:function(){if(!this.failover){var Yg=xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath(Xf);this.failover=Yg.getBoolean(pg,false);}
return this.failover;},getSizes:function(){this.init();if(!this.playerSizes){this.initPlayerSizes();}
return this.playerSizes;},getSizeFromPlayer:function(Zg){this.init();var $g=this.getSizes();var ah=$g.length;for(var i=0;i<ah;i++){var bh=Zg.length;for(var j=0;j<bh;j++){if($g[i]===Zg[j]){return $g[i];}}}
return"";},initPlayerSizes:function(){this.playerSizes=[];var ch=xmp.util.SettingsManager.getInstance().getContextNode().getNodeForPath(qg);var dh=ch.retrieveKeys();var eh=dh.length;if(eh===0){throw new xmp.PlayingPolicyError("Validating player sizes.","Missing player sizes.");}
for(var i=0;i<eh;i++){var fh=ch.getString(dh[i],xmp.NO_DEFAULT_VALUE);if(fh.length===0){throw new xmp.PlayingPolicyError("Validating player size.","Missing player size.");}
this.playerSizes.push(fh);}},validateBootstrap:function(gh){this.init();this.getStrategy().validateBootstrap(gh);},initStreamingModes:function(){var hh=xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath(ag);var ih=hh.retrieveKeys();var jh=ih.length;this.modes=[];for(var i=0;i<jh;i++){var kh=hh.getString(ih[i],xmp.NO_DEFAULT_VALUE);if(kh.length===0){throw new xmp.PlayingPolicyError("Validating streaming mode.","Missing mode.");}
this.modes.push(kh);}
return this.modes;},getStreamingModes:function(){this.init();if(!this.modes){throw new xmp.PlayingPolicyError("Retrieving streaming modes.","Missing modes.");}
if(this.modes.length===0){throw new xmp.PlayingPolicyError("Validating streaming modes.","Missing modes.");}
return this.modes;},initBootstrapMedia:function(){var lh=xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath(bg);var mh=lh.retrieveKeys();var nh=mh.length;if(nh===0){throw new xmp.PlayingPolicyError("Validating bootstrap media.","Missing media.");}
this.bootstrapMedia=[];for(var i=0;i<nh;i++){var oh=lh.getString(mh[i],xmp.NO_DEFAULT_VALUE);var ph=this.getMediaType(oh);if(!ph){throw new xmp.PlayingPolicyError("Validating bootstrap media.","Invalid bootstrap media type \""+oh+"\".");}
this.bootstrapMedia.push(ph);}
return this.bootstrapMedia;},getBootstrapMedia:function(){this.init();if(!this.bootstrapMedia){throw new xmp.PlayingPolicyError("Retrieving bootstrap media.","Missing media.");}
return this.bootstrapMedia;},initNativePlayers:function(){var qh=xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath(eg);var rh=qh.retrieveChildren();var sh=rh.length;if(sh===0){throw new xmp.PlayingPolicyError("Validating native players.","Missing players.");}
this.nativePlayers=[];for(var i=0;i<sh;i++){var th=rh[i];if(!xmp.getNamespacedMethod(th.getName())){throw new xmp.PlayingPolicyError("Validating native player.","Invalid "+th.getName()+" native player.");}
var uh=th.retrieveKeys();var vh=uh.length;var wh={};for(var j=0;j<vh;j++){wh[uh[j]]=th.getString(uh[j],xmp.NO_DEFAULT_VALUE);}
this.nativePlayers[th.getName()]=wh;}},initNativePlayerGroups:function(){var xh=xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath(fg);var yh=xh.retrieveChildren();var zh=yh.length;if(zh===0){throw new xmp.PlayingPolicyError("Validating native player groups.","Missing groups.");}
this.nativePlayerGroups=[];for(var i=0;i<zh;i++){var Ah=this.getDefaultNativePlayerGroup();var Bh=yh[i];var Ch=Bh.retrieveChildren();var Dh=Ch.length;if(Dh===0){throw new xmp.PlayingPolicyError("Validating native player group mime types.","Missing "+Bh.getName()+" mime types.");}
for(var j=0;j<Dh;j++){var Eh=Ch[j].getString(kg,xmp.NO_DEFAULT_VALUE);if(Eh.length===0){throw new xmp.PlayingPolicyError("Validating native player group mime type.","Missing \""+Bh.getName()+"\" mime type.");}
if(false===this.isMimeTypeSupported(Eh)){continue;}
var Fh=Ch[j].getNodeForPath(ig);var Gh=Fh.retrieveKeys();var Hh=Gh.length;if(Hh===0){throw new xmp.PlayingPolicyError("Validating native player group mime type players.","Missing "+Bh.getName()+" native player group \""+Eh+"\" players.");}
var Ih=[];for(var k=0;k<Hh;k++){var Jh=Fh.getString(Gh[k],xmp.NO_DEFAULT_VALUE);if(Jh.length===0){throw new xmp.PlayingPolicyError("Validating native player group mime type player.","Missing "+Bh.getName()+" native player group \""+Eh+"\" player.");}
if(false===xmp.isDefined(this.getNativePlayerConfig(Jh))){throw new xmp.PlayingPolicyError("Validating native player group mime type player.","Invalid "+Bh.getName()+" native player group \""+Eh+"\" player \""+Jh+".");}
Ih.push(Jh);}
Ah[Eh]=Ih;}
this.nativePlayerGroups[Bh.getName()]=Ah;}},initSupportedPlatforms:function(){var Kh=xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath(cg);var Lh=Kh.retrieveChildren();var Mh=Lh.length;if(Mh===0){throw new xmp.PlayingPolicyError("Validating supported platforms.","Missing platforms.");}
this.platforms={};for(var i=0;i<Mh;i++){var Nh=Lh[i];var Oh=Nh.retrieveKeys();var Ph=Oh.length;if(Ph===0){throw new xmp.PlayingPolicyError("Validating supported platform browsers.","Missing "+Nh.getName()+" browsers.");}
var Qh=[];for(var j=0;j<Ph;j++){var Rh=Nh.getString(Oh[j],xmp.NO_DEFAULT_VALUE);if(Rh.length===0){throw new xmp.PlayingPolicyError("Validating supported platform browser native player group.","Missing "+Nh.getName()+" platform \""+Oh[j]+"\" browser native player group.");}
if(false===xmp.isDefined(this.getNativePlayerGroup(Rh))){throw new xmp.PlayingPolicyError("Validating supported platform browser native player group.","Invalid "+Nh.getName()+" platform \""+Oh[j]+"\" browser native player group \""+Rh+"\".");}
Qh.push({name:Oh[j],playersGroup:Rh,modes:{}});}
if(xmp.util.internals.BrowserDetect.OS===Nh.getName()){this.initPlatformPlugInOverrides(Nh);}
this.platforms[Nh.getName()]=Qh;}},initPlaybackPriorityGroups:function(){var Sh=xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath(dg);var Th=Sh.retrieveChildren();var Uh=Th.length;if(Uh===0){throw new xmp.PlayingPolicyError("Validating playback priority groups.","Missing groups.");}
this.playbackPriorityGroups=[];for(var i=0;i<Uh;i++){var Vh=Th[i];var Wh=Vh.retrieveKeys();var Xh=Wh.length;if(Xh===0){throw new xmp.PlayingPolicyError("Validating playback priority group media.","Missing "+Vh.getName()+" media.");}
var Yh=[];for(var j=0;j<Xh;j++){var Zh=Vh.getString(Wh[j],xmp.NO_DEFAULT_VALUE);if(Zh.length===0){throw new xmp.PlayingPolicyError("Validating playback priority group media.","Missing "+Vh.getName()+" media type.");}
if(false===xmp.isDefined(this.getMediaType(Zh))){throw new xmp.PlayingPolicyError("Validating playback priority group media.","Invalid "+Vh.getName()+" media type \""+Zh+"\".");}
Yh.push(Zh);}
this.playbackPriorityGroups[Vh.getName()]=Yh;}},initPlaybackPlatforms:function(){var $h=xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath(gg);var ai=$h.retrieveChildren();var bi=ai.length;if(bi===0){throw new xmp.PlayingPolicyError("Validating playback platforms.","Missing platforms.");}
for(var i=0;i<bi;i++){var ci=ai[i];if(this.getSupportedPlatform(ci.getName())===null){throw new xmp.PlayingPolicyError("Validating playback platform OS.","The "+ci.getName()+"platform OS is not supported.");}
var di=ci.retrieveChildren();var ei=di.length;if(ei===0){throw new xmp.PlayingPolicyError("Validating playback platform browsers.","Missing "+ci.getName()+" platform browsers.");}
for(var j=0;j<ei;j++){var fi=di[j];var gi=this.getSupportedPlatformBrowser(ci.getName(),fi.getName());if(!gi){throw new xmp.PlayingPolicyError("Validating playback platform browser.","The "+ci.getName()+" platform browser "+fi.getName()+" is not supported.");}
var hi=fi.retrieveKeys();var ii=hi.length;if(ii===0){throw new xmp.PlayingPolicyError("Validating playback platform browser streaming modes.","Missing "+ci.getName()+" platform browser "+fi.getName()+" streaming modes.");}
for(var k=0;k<ii;k++){if(false===this.isStreamingModeSupported(hi[k])){throw new xmp.PlayingPolicyError("Validating playback platform browser streaming mode.","Invalid "+ci.getName()+" platform browser "+fi.getName()+" streaming mode "+hi[k]+".");}
var ji=fi.getString(hi[k],xmp.NO_DEFAULT_VALUE);if(ji.length===0){throw new xmp.PlayingPolicyError("Validating playback platform browser streaming mode priority group.","Missing "+ci.getName()+" platform browser "+fi.getName()+" streaming mode "+hi[k]+" playback priority group.");}
if(false===xmp.isDefined(this.getPlaybackPriorityGroup(ji))){throw new xmp.PlayingPolicyError("Validating playback platform browser streaming mode priority group.","Invalid "+ci.getName()+" platform browser "+fi.getName()+" streaming mode "+hi[k]+" playback priority group "+ji+".");}
gi.modes[hi[k]]=ji;}}}},initPlatformPlugInOverrides:function(ki){var li=ki.getNodeForPath(rg);var mi=li.retrieveChildren();var ni=mi.length;for(var i=0;i<ni;i++){var oi=mi[i];var pi=this.getPlugin(oi.getName());if(!pi){throw new xmp.PlayingPolicyError("Validating platform plugin override.","Invalid "+ki.getName()+" platform \""+oi.getName()+"\" plugin.");}
var qi=oi.getString(ng,xmp.NO_DEFAULT_VALUE);if(qi.length>0){pi.minVersion=qi;}
var ri=oi.getString(og,xmp.NO_DEFAULT_VALUE);if(ri.length>0){pi.maxVersion=ri;}
var si=oi.getString(mg,xmp.NO_DEFAULT_VALUE);if(si.length>0){pi.downloadUrl=si;}}},getSupportedPlatform:function(ti){return this.platforms[ti];},getPlaybackPriorityGroup:function(ui){this.init();return this.playbackPriorityGroups[ui];},getSupportedPlatformBrowser:function(vi,wi){this.init();var xi=this.getSupportedPlatform(vi);if(!xi){return null;}
var yi=xi.length;for(var i=0;i<yi;i++){if(wi===xi[i].name){return xi[i];}}
return null;},isStreamingModeSupported:function(zi){var Ai=this.modes.length;for(var i=0;i<Ai;i++){if(zi===this.modes[i]){return true;}}
return false;},isMimeTypeSupported:function(Bi){this.init();for(var Ci=xmp.MapIterator.create(this.mediaTypes);Ci.hasNext();Ci.next()){var Di=Ci.currentValue();if(Di.mimeType===Bi){return true;}}
return((this.getDefaultNativePlayerGroup()[Bi])?true:false);},getNativePlayerConfig:function(Ei){this.init();return this.nativePlayers[Ei];},getNativePlayerGroup:function(Fi){this.init();return this.nativePlayerGroups[Fi];},getDefaultNativePlayerGroup:function(){this.init();return{"application/x-null":["xmp.NullPlayer"],"application/x-dhtml":["xmp.DHTMLPlayer"],"application/xmp-mock":["xmp.MockNativePlayer"]};}};}();xmp.PlayingPolicyFactory=function(){return{createStrategy:function(Gi,Hi){if(Gi===xmp.LAZY_PLAYING_POLICY){return new xmp.LazyPlayingPolicy(Hi);}
throw new xmp.PlayingPolicyError("Creating playing policy strategy.","Unable to create playing policy strategy \""+Gi+"\".");}};}();xmp.BandwidthRecorderError=function(Ii,Ji){xmp.BandwidthRecorderError.ctor.call(this,"BandwidthRecorderError",Ii,Ji);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.BandwidthRecorderError);xmp.DHTMLObjectError=function(Ki,Li){xmp.DHTMLObjectError.ctor.call(this,"DHTMLObjectError",Ki,Li);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.DHTMLObjectError);xmp.InvalidMimeTypeError=function(Mi,Ni){xmp.InvalidMimeTypeError.ctor.call(this,"InvalidMimeTypeError",Mi,Ni);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.InvalidMimeTypeError);xmp.InvalidNativePlayerViewportError=function(Oi,Pi,Qi){var Ri=[{label:"Native Player Type",text:Qi.getType()},{label:"Native Player Name",text:Qi.getName()}];xmp.InvalidNativePlayerViewportError.ctor.call(this,"InvalidNativePlayerViewportError",Oi,Pi,Ri);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.InvalidNativePlayerViewportError);xmp.InvalidPlayableNodeError=function(Si,Ti){xmp.InvalidPlayableNodeError.ctor.call(this,"InvalidMimeTypeError",Si,Ti);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.InvalidPlayableNodeError);xmp.InvalidPlugInVersionError=function(Ui,Vi,Wi){var Xi="Invalid "+Vi.displayName+" version \""+Wi+"\".  Expected version is ";Xi+=((parseInt(Vi.maxVersion,10)>0)?"between \""+Vi.minVersion+"\" and \""+Vi.maxVersion+"\".":"\""+Vi.minVersion+"\" or greater.");Xi+="\n\nThe latest plugin can be downloaded at \""+Vi.downloadUrl+"\".";xmp.InvalidPlugInVersionError.ctor.call(this,"InvalidPlugInVersionError",Ui,Xi,Vi);};xmp.DERIVE_CLASS(xmp.PlugInError,xmp.InvalidPlugInVersionError);xmp.MediaPlayerError=function(Yi,Zi){xmp.MediaPlayerError.ctor.call(this,"MediaPlayerError",Yi,Zi);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.MediaPlayerError);xmp.NativePlayerConnectionError=function($i,aj,bj,cj){var dj=[{label:"Native Player Type",text:((bj)?bj.getType():"")},{label:"Native Player Name",text:((bj)?bj.getName():"")}];if(cj){dj=dj.concat(cj);}
xmp.NativePlayerConnectionError.ctor.call(this,xmp.XmpErrorCodes.CRITICAL_PLAYER_CONNECTION,"NativePlayerConnectionError",$i,aj,dj);};xmp.DERIVE_CLASS(xmp.CriticalException,xmp.NativePlayerConnectionError);xmp.NativePlayerError=function(ej,fj,gj,hj){var ij=[];if(gj){ij.push({label:"Native Player Type",text:gj.getType()});ij.push({label:"Native Player Name",text:gj.getName()});}
if(hj){ij=ij.concat(hj);}
xmp.NativePlayerError.ctor.call(this,"NativePlayerError",ej,fj,ij);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.NativePlayerError);xmp.NativePlayerGroupNotFoundError=function(jj,kj,lj,mj){var nj=[{label:"Native Player Group",text:lj}];if(mj){nj=nj.concat(mj);}
xmp.NativePlayerGroupNotFoundError.ctor.call(this,xmp.XmpErrorCodes.FATAL_UNSPECIFIED_ERROR,"NativePlayerGroupNotFoundError",jj,kj,nj);};xmp.DERIVE_CLASS(xmp.FatalException,xmp.NativePlayerGroupNotFoundError);xmp.NativePlayerNotFoundError=function(oj,pj,qj,rj,sj){var tj=[{label:"Native Player Group",text:qj},{label:"MIME Type",text:rj}];if(sj){tj=tj.concat(sj);}
xmp.NativePlayerNotFoundError.ctor.call(this,xmp.XmpErrorCodes.FATAL_PLATFORM,"NativePlayerNotFoundError",oj,pj,tj);};xmp.DERIVE_CLASS(xmp.CriticalException,xmp.NativePlayerNotFoundError);xmp.NativePlayerUnsupportedError=function(uj,vj,wj){var xj=[{label:"Native Player Type",text:((wj)?wj.getType():"")},{label:"Native Player Name",text:((wj)?wj.getName():"")}];xmp.NativePlayerUnsupportedError.ctor.call(this,"NativePlayerUnsupportedError",uj,vj,xj);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.NativePlayerUnsupportedError);xmp.PlaybackModeError=function(yj,zj,Aj){var Bj=[{label:"Playback Mode",text:((Aj)?Aj.getName():"")}];xmp.PlaybackModeError.ctor.call(this,"PlaybackModeError",yj,zj,Bj);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.PlaybackModeError);xmp.PlayingPolicyApplyError=function(Cj,Dj,Ej,Fj){var Gj="Unable to apply playing policy to playable node.\n\nPlayer Sizes:              "+Dj.join(", ")+"\n\nPolicy:"+"\n\n  Type:                     "+Ej.type+"\n  Media:                   "+Ej.media.join(", ")+"\n\nPlayable Node:"+"\n\n  Location:               "+Fj.getURI()+"\n  Streaming Mode:  "+Fj.getStreamingMode()+"\n  Mime Types:         "+Fj.getMimeTypes().join(", ")+"\n  Sizes:                   "+Fj.getSizes().join(", ");xmp.PlayingPolicyApplyError.ctor.call(this,"PlayingPolicyApplyError",Cj,Gj);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.PlayingPolicyApplyError);xmp.PlayingPolicyError=function(Hj,Ij){xmp.PlayingPolicyError.ctor.call(this,"PlayingPolicyError",Hj,Ij);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.PlayingPolicyError);xmp.PlugInDisabledError=function(Jj,Kj,Lj){var Mj="The "+Kj.displayName+" is disabled or not associated with the \""+Lj+"\" MIME type.";xmp.PlugInDisabledError.ctor.call(this,"PlugInDisabledError",Jj,Mj,Kj);};xmp.DERIVE_CLASS(xmp.PlugInError,xmp.PlugInDisabledError);xmp.PlugInNotFoundError=function(Nj,Oj){var Pj=Oj.displayName+" not found.  \n\nThe plugin can be downloaded at \""+Oj.downloadUrl+"\".";xmp.PlugInNotFoundError.ctor.call(this,"PlugInNotFoundError",Nj,Pj,Oj);};xmp.DERIVE_CLASS(xmp.PlugInError,xmp.PlugInNotFoundError);xmp.ServiceError=function(Qj,Rj){xmp.ServiceError.ctor.call(this,"ServiceError",Qj,Rj);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.ServiceError);xmp.UnsupportedPlatformError=function(Sj,Tj){xmp.UnsupportedPlatformError.ctor.call(this,xmp.XmpErrorCodes.FATAL_PLATFORM,"UnsupportedPlatformError",Sj,Tj);};xmp.DERIVE_CLASS(xmp.FatalException,xmp.UnsupportedPlatformError);xmp.UnsupportedPlugInVersionError=function(Uj,Vj,Wj){var Xj="The "+Vj.displayName+" version \""+Wj+"\" is not supported.  Expected version is ";Xj+=((parseInt(Vj.maxVersion,10)>0)?"between \""+Vj.minVersion+"\" and \""+Vj.maxVersion+"\".":"\""+Vj.minVersion+"\" or greater.");Xj+="\n\nA supported plugin can be downloaded at \""+Vj.downloadUrl+"\".";xmp.UnsupportedPlugInVersionError.ctor.call(this,"UnsupportedPlugInVersionError",Uj,Xj,Vj);};xmp.DERIVE_CLASS(xmp.PlugInError,xmp.UnsupportedPlugInVersionError);xmp.DefaultPlaybackMode=function(Yj,Zj,$j){xmp.DefaultPlaybackMode.ctor.call(this,Yj,Zj,$j);};xmp.DERIVE_CLASS(xmp.PlaybackMode,xmp.DefaultPlaybackMode);xmp.DefaultPlaybackMode.prototype.open=function(ak,bk){this.changeMode(ak,xmp.INIT,xmp.OPEN_OPERATION,bk);};xmp.DefaultPlaybackMode.prototype.close=function(ck){this.changeMode(ck,xmp.FINI,xmp.CLOSE_OPERATION,null);};xmp.DefaultPlaybackMode.prototype.play=function(dk){this.changeMode(dk,xmp.PLAY,xmp.PLAY_OPERATION,null);};xmp.DefaultPlaybackMode.prototype.pause=function(ek){this.changeMode(ek,xmp.PAUSE,xmp.PAUSE_OPERATION,null);};xmp.DefaultPlaybackMode.prototype.stop=function(fk){this.changeMode(fk,xmp.STOP,xmp.STOP_OPERATION,null);};xmp.DefaultPlaybackMode.prototype.rewind=function(gk){this.changeMode(gk,xmp.REWIND,xmp.REWIND_OPERATION,null);};xmp.DefaultPlaybackMode.prototype.fastForward=function(hk){this.changeMode(hk,xmp.FAST_FORWARD,xmp.FAST_FORWARD_OPERATION,null);};xmp.DefaultPlaybackMode.prototype.seek=function(ik,jk){this.changeMode(ik,xmp.SEEKABLE,xmp.SEEK_OPERATION,jk);};xmp.DefaultPlaybackMode.prototype.ended=function(kk){this.changeMode(kk,xmp.ENDED,xmp.ENDED_OPERATION,null);};xmp.DefaultPlaybackMode.prototype.error=function(lk){this.changeMode(lk,xmp.ERRORS,xmp.ERROR_OPERATION,null);};xmp.DefaultPlaybackMode.prototype.isAvailable=function(mk,nk){try{return(true===this.canTransition(nk)||this.getPlayer(mk).isAvailable(nk));}
catch(e){this.handleError(mk,xmp.IS_AVAILABLE,e);}
return false;};xmp.DefaultPlaybackMode.prototype.getPosition=function(ok){try{return parseInt(this.getPlayer(ok).getPosition(),10);}
catch(e){this.handleError(ok,xmp.GET_POSITION,e);}
return 0;};xmp.DefaultPlaybackMode.prototype.getDuration=function(pk){try{return parseInt(this.getPlayer(pk).getDuration(),10);}
catch(e){this.handleError(pk,xmp.GET_DURATION,e);}
return 0;};xmp.DefaultPlaybackMode.prototype.getVolume=function(qk){try{return this.getPlayer(qk).getVolume();}
catch(e){this.handleError(qk,xmp.GET_VOLUME,e);}
return 0;};xmp.DefaultPlaybackMode.prototype.setVolume=function(rk,sk){try{this.getPlayer(rk).setVolume(sk);}
catch(e){this.handleError(rk,xmp.SET_VOLUME,e);}};xmp.DefaultPlaybackMode.prototype.getMute=function(tk){try{return this.getPlayer(tk).getMute();}
catch(e){this.handleError(tk,xmp.GET_MUTE,e);}
return false;};xmp.DefaultPlaybackMode.prototype.setMute=function(uk,vk){try{this.getPlayer(uk).setMute(vk);}
catch(e){this.handleError(uk,xmp.SET_MUTE,e);}};xmp.DefaultPlaybackMode.prototype.getFullscreen=function(wk){try{return this.getPlayer(wk).getFullscreen();}
catch(e){this.handleError(wk,xmp.GET_FULLSCREEN,e);}
return false;};xmp.DefaultPlaybackMode.prototype.setFullscreen=function(xk,yk){try{this.getPlayer(xk).setFullscreen(yk);}
catch(e){this.handleError(xk,xmp.SET_FULLSCREEN,e);}};xmp.DefaultPlaybackMode.prototype.getBufferingProgress=function(zk){try{return this.getPlayer(zk).getBufferingProgress();}
catch(e){this.handleError(zk,xmp.GET_BUFFERING_PROGRESS,e);}
return null;};xmp.DefaultPlaybackMode.prototype.handleError=function(Ak,Bk,e){var Ck=e;if(false===(Ck instanceof xmp.NativePlayerError)&&false===(Ck instanceof xmp.NativePlayerUnsupportedError)){var Dk="Delegating \""+Bk.toLowerCase()+"\" operation to native player.";Ck=new xmp.NativePlayerError(((e.context)?e.context:Dk),((e.rawMessage)?e.rawMessage:e.message),this.getPlayer(Ak),[{label:"Playback Mode",text:this.getName()}]);Ck.setInnerError(e);}
throw Ck;};xmp.ENDED_PLAYBACK_STATE="EndedPlayback";xmp.ENDED="Ended";xmp.ENDED_OPERATION="Ended";xmp.EndedPlaybackMode=function(){xmp.EndedPlaybackMode.ctor.call(this,xmp.ENDED,xmp.ENDED_PLAYBACK_STATE,[xmp.FINI,xmp.ERRORS]);};xmp.DERIVE_CLASS(xmp.DefaultPlaybackMode,xmp.EndedPlaybackMode);xmp.EndedPlaybackMode.prototype.transition=function(Ek,Fk,Gk){this.ended(Ek);};xmp.EndedPlaybackMode.prototype.ended=function(Hk){try{this.getPlayer(Hk).ended();}
catch(e){this.handleError(Hk,xmp.ENDED_OPERATION,e);}};xmp.ERRORS_PLAYBACK_STATE="ErrorPlayback";xmp.ERRORS="Error";xmp.ERROR_OPERATION="Error";xmp.ErrorPlaybackMode=function(){xmp.ErrorPlaybackMode.ctor.call(this,xmp.ERRORS,xmp.ERRORS_PLAYBACK_STATE,[xmp.FINI]);};xmp.DERIVE_CLASS(xmp.DefaultPlaybackMode,xmp.ErrorPlaybackMode);xmp.ErrorPlaybackMode.prototype.transition=function(Ik,Jk,Kk){this.error(Ik);};xmp.ErrorPlaybackMode.prototype.error=function(Lk){try{this.getPlayer(Lk).error();}
catch(e){}};xmp.FAST_FORWARD_PLAYBACK_STATE="FastForwardPlayback";xmp.FAST_FORWARD="FastForward";xmp.FAST_FORWARD_OPERATION="FastForward";xmp.FastForwardPlaybackMode=function(){xmp.FastForwardPlaybackMode.ctor.call(this,xmp.FAST_FORWARD,xmp.FAST_FORWARD_PLAYBACK_STATE,[xmp.FINI,xmp.ENDED,xmp.ERRORS]);};xmp.DERIVE_CLASS(xmp.DefaultPlaybackMode,xmp.FastForwardPlaybackMode);xmp.FastForwardPlaybackMode.prototype.transition=function(Mk,Nk,Ok){this.fastForward(Mk);};xmp.FastForwardPlaybackMode.prototype.fastForward=function(Pk){try{this.getPlayer(Pk).fastForward();}
catch(e){this.handleError(Pk,xmp.FAST_FORWARD_OPERATION,e);}};xmp.FINI_PLAYBACK_STATE="FiniPlayback";xmp.FINI="Fini";xmp.CLOSE_OPERATION="Close";xmp.FiniPlaybackMode=function(){xmp.FiniPlaybackMode.ctor.call(this,xmp.FINI,xmp.FINI_PLAYBACK_STATE,[xmp.INIT,xmp.ERRORS]);};xmp.DERIVE_CLASS(xmp.DefaultPlaybackMode,xmp.FiniPlaybackMode);xmp.FiniPlaybackMode.prototype.transition=function(Qk,Rk,Sk){try{this.getPlayer(Qk).close();}
catch(e){this.handleError(Qk,xmp.CLOSE_OPERATION,e);}};xmp.FiniPlaybackMode.prototype.close=function(Tk){};xmp.INIT_PLAYBACK_STATE="InitPlayback";xmp.INIT="Init";xmp.OPEN_OPERATION="Open";xmp.InitPlaybackMode=function(){xmp.InitPlaybackMode.ctor.call(this,xmp.INIT,xmp.INIT_PLAYBACK_STATE,[xmp.FINI,xmp.PLAY,xmp.ENDED,xmp.ERRORS]);};xmp.DERIVE_CLASS(xmp.DefaultPlaybackMode,xmp.InitPlaybackMode);xmp.InitPlaybackMode.prototype.transition=function(Uk,Vk,Wk){try{this.getPlayer(Uk).open(Vk);}
catch(e){this.handleError(Uk,xmp.OPEN_OPERATION,e);}};xmp.InitPlaybackMode.prototype.open=function(Xk,Yk){throw new xmp.PlaybackModeError("Invoking state operation.","The \""+xmp.OPEN_OPERATION.toLowerCase()+"\" operation has already been executed.",this);};xmp.NORMAL_PLAYBACK_STATE="NormalPlayback";xmp.PLAY="Play";xmp.PLAY_OPERATION="Play";xmp.NormalPlaybackMode=function(){xmp.NormalPlaybackMode.ctor.call(this,xmp.PLAY,xmp.NORMAL_PLAYBACK_STATE,[xmp.FINI,xmp.ENDED,xmp.ERRORS]);};xmp.DERIVE_CLASS(xmp.DefaultPlaybackMode,xmp.NormalPlaybackMode);xmp.NormalPlaybackMode.prototype.transition=function(Zk,$k,al){this.play(Zk);};xmp.NormalPlaybackMode.prototype.play=function(bl){try{this.getPlayer(bl).play();}
catch(e){this.handleError(bl,xmp.PLAY_OPERATION,e);}};xmp.PAUSE_PLAYBACK_STATE="PausePlayback";xmp.PAUSE="Pause";xmp.PAUSE_OPERATION="Pause";xmp.PausePlaybackMode=function(){xmp.PausePlaybackMode.ctor.call(this,xmp.PAUSE,xmp.PAUSE_PLAYBACK_STATE,[xmp.FINI,xmp.ENDED,xmp.ERRORS]);};xmp.DERIVE_CLASS(xmp.DefaultPlaybackMode,xmp.PausePlaybackMode);xmp.PausePlaybackMode.prototype.transition=function(cl,dl,el){this.pause(cl);};xmp.PausePlaybackMode.prototype.pause=function(fl){try{this.getPlayer(fl).pause();}
catch(e){this.handleError(fl,xmp.PAUSE_OPERATION,e);}};xmp.PlayerModeRegistry=function(){this.modes=[];var gl=[new xmp.InitPlaybackMode(),new xmp.FiniPlaybackMode(),new xmp.PausePlaybackMode(),new xmp.NormalPlaybackMode(),new xmp.PausePlaybackMode(),new xmp.StopPlaybackMode(),new xmp.RewindPlaybackMode(),new xmp.FastForwardPlaybackMode(),new xmp.SeekablePlaybackMode(),new xmp.EndedPlaybackMode(),new xmp.ErrorPlaybackMode()];for(var i=0;i<gl.length;i++){this.addMode(gl[i]);}};xmp.PlayerModeRegistry.prototype.addMode=function(hl){this.modes[hl.type]=hl;};xmp.PlayerModeRegistry.prototype.findMode=function(il){var jl=this.modes[il];if(jl!==null){return jl;}
throw new xmp.PlaybackModeError("Finding playback mode.","Unable to find player mode \""+il+"\".",null);};xmp.REWIND_PLAYBACK_STATE="RewindPlayback";xmp.REWIND="Rewind";xmp.REWIND_OPERATION="Rewind";xmp.RewindPlaybackMode=function(){xmp.RewindPlaybackMode.ctor.call(this,xmp.REWIND,xmp.REWIND_PLAYBACK_STATE,[xmp.FINI,xmp.ENDED,xmp.ERRORS]);};xmp.DERIVE_CLASS(xmp.DefaultPlaybackMode,xmp.RewindPlaybackMode);xmp.RewindPlaybackMode.prototype.transition=function(kl,ll,ml){this.rewind(kl);};xmp.RewindPlaybackMode.prototype.rewind=function(nl){try{this.getPlayer(nl).rewind();}
catch(e){this.handleError(nl,xmp.REWIND_OPERATION,e);}};xmp.SEEKABLE_PLAYBACK_STATE="SeekablePlayback";xmp.SEEKABLE="Seekable";xmp.SEEK_OPERATION="Seek";xmp.SeekablePlaybackMode=function(){xmp.SeekablePlaybackMode.ctor.call(this,xmp.SEEKABLE,xmp.SEEKABLE_PLAYBACK_STATE,[xmp.FINI,xmp.ENDED,xmp.ERRORS]);};xmp.DERIVE_CLASS(xmp.DefaultPlaybackMode,xmp.SeekablePlaybackMode);xmp.SeekablePlaybackMode.prototype.transition=function(ol,pl,ql){this.seek(ol,pl);};xmp.SeekablePlaybackMode.prototype.seek=function(rl,sl){try{this.getPlayer(rl).seek(sl);}
catch(e){this.handleError(rl,xmp.SEEK_OPERATION,e);}};xmp.STOP_PLAYBACK_STATE="StopPlayback";xmp.STOP="Stop";xmp.STOP_OPERATION="Stop";xmp.StopPlaybackMode=function(){xmp.StopPlaybackMode.ctor.call(this,xmp.STOP,xmp.STOP_PLAYBACK_STATE,[xmp.FINI,xmp.ENDED,xmp.ERRORS]);};xmp.DERIVE_CLASS(xmp.DefaultPlaybackMode,xmp.StopPlaybackMode);xmp.StopPlaybackMode.prototype.transition=function(tl,ul,vl){this.stop(tl);};xmp.StopPlaybackMode.prototype.stop=function(wl){try{this.getPlayer(wl).stop();}
catch(e){this.handleError(wl,xmp.STOP_OPERATION,e);}};xmp.ContextualUrlStrategy=function(){this._logger=new xmp.util.internals.CategoryLogger('ContextualUrlStrategy');this._mapMimeTypeToUrlStrategy=null;this._mapStrategyNameToStrategyObject={};this._defaultStrategy=new xmp.SimpleUrlStrategy();xmp.util.SettingsManager.getInstance().addContextChangeListener(new xmp.util.Callback('ContextualUrlStrategy',this._handleContextChange,this));};xmp.ContextualUrlStrategy.create=function(){var xl=new xmp.ContextualUrlStrategy();return xl;};xmp.ContextualUrlStrategy.prototype.getName=function(){return'Contextual';};xmp.ContextualUrlStrategy.prototype.tryFailover=function(yl,zl,Al){if((!yl)||(!zl)||(!Al)){return false;}
if(Al instanceof xmp.NativePlayerConnectionError&&(this._mapStrategyNameToStrategyObject[this._getStrategyName(zl)].getName()!==this._defaultStrategy.getName())){this._setFailoverStrategy(zl,Al);zl.setURI(zl.getMetadata('originalUri','foo'));zl.setUriAbsolute(false);yl.open(zl);return true;}
return false;};xmp.ContextualUrlStrategy.prototype.buildUrlAsynch=function(Bl,Cl){var Dl=new xmp.util.Callback('ContextualUrlStrategy',this._handleDelegateBuildUrlAsynch,this);Dl.setMetadata('relayCb',Cl);try{this._getStrategy(Bl).buildUrlAsynch(Bl,Dl);}
catch(ex){this._logger.warn('Error calling buildUrlAsynch: '+ex);this._handleDelegateBuildUrlAsynch(Dl,Bl,ex);}};xmp.ContextualUrlStrategy.prototype._handleDelegateBuildUrlAsynch=function(El,Fl,Gl){var Hl=El.getMetadata('relayCb',xmp.util.internals.MetadataMap.defaultObj);if(Gl!==null){this._setFailoverStrategy(Fl,Gl);if(Gl.octoError){this._logger.warn('Trying again after fail over.');this.buildUrlAsynch(Fl,Hl);return;}}
Hl.call(Fl,Gl);};xmp.ContextualUrlStrategy.prototype._setFailoverStrategy=function(Il,Jl){try{if(Jl instanceof xmp.PlugInError){return;}
var Kl=this._getStrategyName(Il);this._logger.critical('Failing over for strategy: '+Kl,Jl);this._mapStrategyNameToStrategyObject[Kl]=this._defaultStrategy;}
catch(ex){this._logger.critical('Error setting failover strategy, setting all strategies to default: '+ex);for(var Ll=xmp.MapIterator.create(this._mapStrategyNameToStrategyObject);Ll.hasNext();Ll.next()){Ll.updateCurrentValue(this._defaultStrategy);}}};xmp.ContextualUrlStrategy.prototype._getStrategyName=function(Ml){var Nl=Ml.getMimeType();if(!xmp.isNonEmptyString(Nl)){throw new Error('No mime-type on playable node.');}
this._loadMimeTypeToUrlStrategyMap();var Ol=this._mapMimeTypeToUrlStrategy[Nl];if(!xmp.isNonEmptyString(Ol)){Ol='Simple';this._mapMimeTypeToUrlStrategy[Nl]=Ol;}
return Ol;};xmp.ContextualUrlStrategy.prototype._getStrategy=function(Pl){var Ql=this._getStrategyName(Pl);var Rl=this._mapStrategyNameToStrategyObject[Ql];if(typeof(Rl)==='undefined'){Rl=this._createStrategy(Ql);this._mapStrategyNameToStrategyObject[Ql]=Rl;}
if(this._logger.isInfoEnabled()){this._logger.info('For mime-type: '+Pl.getMimeType()+', requested strategy: '+Ql+', actual strategy: '+Rl.getName());}
return Rl;};xmp.ContextualUrlStrategy.prototype._createStrategy=function(Sl){if(Sl==='Simple'){return this._defaultStrategy;}
if(Sl==='Octoshape'){return new xmp.OctoshapeUrlStrategy();}
if(Sl==='OctoshapeConditional'){if(xmp.InternalUserDetection.getInstance().isInternal()&&xmp.OctoshapeUrlStrategy.canUse()){return new xmp.OctoshapeUrlStrategy();}
else{return this._defaultStrategy;}}
throw new Error('Unrecogonized URL strategy name: '+Sl);};xmp.ContextualUrlStrategy.prototype._loadMimeTypeToUrlStrategyMap=function(){if(this._mapMimeTypeToUrlStrategy!==null){return;}
this._mapMimeTypeToUrlStrategy={};this._mapStrategyNameToStrategyObject={};var Tl=xmp.util.SettingsManager.getInstance().getContextNode().getNodeForPath('UrlStrategies');var Ul=Tl.retrieveKeys();for(var i=0;i<Ul.length;i++){var Vl=Ul[i];var Wl=Tl.getString(Vl,'dummy');this._mapMimeTypeToUrlStrategy[Vl]=Wl;}};xmp.ContextualUrlStrategy.prototype._handleContextChange=function(){this._mapMimeTypeToUrlStrategy=null;};xmp.InternalUserDetection=function(){this._logger=new xmp.util.internals.CategoryLogger('InternalUserDetection');this._isInited=false;this._isInternal=false;this._primaryCheckResult=-1;};xmp.InternalUserDetection._instance=null;xmp.InternalUserDetection.getInstance=function(){if(xmp.InternalUserDetection._instance===null){xmp.InternalUserDetection._instance=new xmp.InternalUserDetection();}
return xmp.InternalUserDetection._instance;};xmp.InternalUserDetection.prototype.isInternal=function(){if(!this._isInited){throw new Error('InternalUserDetection not initialized.');}
return this._isInternal;};xmp.InternalUserDetection.prototype.init=function(Xl){this._isInited=false;this._isInternal=false;this._primaryCheckResult=-1;try{var Yl=this._getPrefs();if(!Yl.getBoolean('do primary check',false)){this._logger.info('Primary check turned OFF, NOT an internal user.');this._finish(Xl,false);return;}
this._primaryCheckResult=this._isInternalPrimaryCheck();if(1===this._primaryCheckResult){if(Yl.getBoolean('do secondary check',false)){this._logger.info('Primary check returned true, and secondary check turned ON, doing secondary check.');this._checkResourceLoadedFromWeb(Xl);return;}
else{this._logger.info('Primary check returned true, and secondary check turned OFF, IS an internal user.');this._finish(Xl,true);return;}}
else{this._logger.info('Primary check returned: '+this._primaryCheckResult+', NOT an internal user.');this._finish(Xl,false);return;}}
catch(ex){this._logger.info('Error checking internal user.',ex);this._finish(Xl,false);}};xmp.InternalUserDetection.prototype._finish=function(Zl,$l){this._isInternal=$l;this._doAsynchCallback(Zl);};xmp.InternalUserDetection.prototype._isInternalPrimaryCheck=function(){var cc=this._getCountryCode();if(!xmp.isNonEmptyString(cc)){return-1;}
if(cc==='***'){return 1;}
return 0;};xmp.InternalUserDetection.prototype._getCountryCode=function(){var cc='';if(xmp.util.Cookie.canUse()){var am=xmp.util.Cookie.read('adDEmas');if(xmp.isNonEmptyString(am)){var bm=am.split('&');if(bm.length>=5){cc=bm[4];}}}
return cc;};xmp.InternalUserDetection.prototype._doAsynchCallback=function(cm){this._isInited=true;cm.callAsynch([]);};xmp.InternalUserDetection.prototype._checkResourceLoadedFromWeb=function(dm){var em=this._getPrefs();var fm=em.getString('rel url','dummy');var gm='internalUserCheckResource';this._isInternal=false;var hm=new xmp.util.Callback('InternalUserDetection._checkResourceLoadedFromWeb',this._onResourceLoadedFromWeb,this);hm.setMetadata('relayCb',dm);xmp.net.AjaxRequestManager.getInstance().request(fm,hm,gm,fm,xmp.net.ContentTypes.TEXT,null);};xmp.InternalUserDetection.prototype._onResourceLoadedFromWeb=function(im,jm){var km=im.getMetadata('relayCb',xmp.util.internals.MetadataMap.defaultObj);this._isInited=true;this._isInternal=!jm.isError();this._logger.info('Secondary check returned: '+this._isInternal+', user '+(this._isInternal?'IS':'is NOT')+' an internal user.');try{km.call();}
catch(ex){this._logger.error('Error calling callback.',ex);}};xmp.InternalUserDetection.prototype._getPrefs=function(){return xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath('InternalUserCheck');};xmp.OctoshapeUrlStrategy=function(){this._logger=new xmp.util.internals.CategoryLogger('OctoshapeUrlStrategy');this._OCTO_MIME_TYPE='application/x-octoshapeplugin';this._VALIDATE_OCTO='ValidateOctoshape';this._OCTO_ASYNCH_INTERVAL=5;this._OCTO_POLL_INTERVAL=this._getPrefs().getInt('octo poll interval',2000);this._OCTO_TRY_LIMIT=this._getPrefs().getInt('octo try limit',8);this._OCTO_STATE_PLUGIN_INITIALIZING=-4500;this._OCTO_STATE_STARTING=1;this._OCTO_STATE_READY=2;this._octoGroup='';this._octoPlugin=null;this._initializingOctoPlugin=null;this._octoException=null;try{this._createOctoPlugin();}
catch(ex){this._initializingOctoPlugin=this._octoPlugin=null;this._octoException=ex;this._logger.warn('Error creating octoshape plugin: '+ex);}};xmp.OctoshapeUrlStrategy.canUse=function(){try{if(typeof(xmp.OctoshapeUrlStrategy._canUseInternal)==='undefined'){var lm=xmp.OctoshapeUrlStrategy._staticGetPrefs();var mm='{fn:function(){'+lm.getString('octo can use fn','return false;')+'}}';var nm=xmp.net.AjaxRequestManager.getInstance()._parseJson(mm);xmp.OctoshapeUrlStrategy._canUseInternal=nm.fn;}
return xmp.OctoshapeUrlStrategy._canUseInternal();}
catch(ex){xmp.util.internals.CategoryLogger.create('OctoshapeUrlStrategy').warn('Error calling canUse.',ex);return false;}};xmp.OctoshapeUrlStrategy.prototype.getName=function(){return'Octoshape';};xmp.OctoshapeUrlStrategy.prototype.buildUrlAsynch=function(om,pm){if(this._octoException!==null){throw this._octoException;}
try{var qm=new xmp.util.Callback('OctoshapeUrlStrategy',this._handleTimer,this);qm.setMetadata('relayCb',pm);qm.setMetadata('node',om);this._doTimer(qm);}
catch(ex){this._octoException=ex;throw this._octoException;}};xmp.OctoshapeUrlStrategy.prototype._doTimer=function(rm){var sm=rm.getMetadata('node',xmp.util.internals.MetadataMap.defaultObj);var tm=this._OCTO_POLL_INTERVAL;var um=rm.getMetadata('octo_tries',0);var vm=this._getOctoStatus(um);switch(vm){case this._OCTO_STATE_PLUGIN_INITIALIZING:case this._OCTO_STATE_STARTING:tm=this._OCTO_POLL_INTERVAL;um++;rm.setMetadata('octo_tries',um);break;case this._OCTO_STATE_READY:tm=this._OCTO_ASYNCH_INTERVAL;var wm=sm.getURI();var xm=sm.getBestId();var ym=this._getPrefs().getNodeForPath('url mapping');var zm=ym.getString(xm,wm);wm=zm;var Am=this._octoPlugin.getLink(wm,false);sm.setURI(Am);this._logger.info('Old URI: '+wm+', New Octoshape URI: '+Am);rm.setMetadata('octo_ready',true);break;default:throw new Error('Unexepected octoshape status: '+vm);}
if(this._logger.isDebugEnabled()){this._logger.debug('Node: '+sm.getBestId()+', timer duration: '+tm+', tries: '+um+', status: '+vm);}
xmp.util.Timer.doSimpleCallbackEx(tm,rm);};xmp.OctoshapeUrlStrategy._staticGetPrefs=function(){return xmp.util.SettingsManager.getInstance().getContextNode().getNodeForPath('UrlStrategies/Octoshape');};xmp.OctoshapeUrlStrategy.prototype._getPrefs=function(){return xmp.OctoshapeUrlStrategy._staticGetPrefs();};xmp.OctoshapeUrlStrategy.prototype._handleTimer=function(Bm){var Cm=Bm.getMetadata('relayCb',xmp.util.internals.MetadataMap.defaultObj);var Dm=Bm.getMetadata('node',xmp.util.internals.MetadataMap.defaultObj);var Em=Bm.getMetadata('octo_ready',false);if(Em){Cm.call(Dm,null);}
else{try{this._doTimer(Bm);}
catch(ex){this._octoException=ex;Cm.call(Dm,ex);}}};xmp.OctoshapeUrlStrategy.prototype._getOctoStatus=function(Fm){if(Fm>=this._OCTO_TRY_LIMIT){var Gm=new Error('Exceeded limit of attempts to start octoshape: '+this._OCTO_TRY_LIMIT);Gm.octoError=true;throw Gm;}
if(this._checkOctoPlugin(Fm===(this._OCTO_TRY_LIMIT-1))){return this._octoPlugin.getStatus(true);}
else{return this._OCTO_STATE_PLUGIN_INITIALIZING;}};xmp.OctoshapeUrlStrategy.prototype._checkOctoPlugin=function(Hm){if(this._octoPlugin){return true;}
if(!this._octoPlugin){if(!(typeof(this._initializingOctoPlugin.getStatus)!=='undefined'&&typeof(this._initializingOctoPlugin.getLink)!=='undefined')){if(Hm){throw new xmp.InvalidPlugInVersionError(this._VALIDATE_OCTO,this._getPluginInfo(),'out-of-date-version');}
else{return false;}}
this._octoPlugin=this._initializingOctoPlugin;return true;}};xmp.OctoshapeUrlStrategy.prototype._createOctoPlugin=function(){this._octoPlugin=null;this._initializingOctoPlugin=null;if(window.ActiveXObject){try{this._initializingOctoPlugin=new window.ActiveXObject('octoshapeplugin'+this._octoGroup+'.client');}
catch(ex){this._logger.info('Error creating Octoshape ActiveXObject',ex);this._initializingOctoPlugin=null;}}
else{var Im=this._OCTO_MIME_TYPE+this._octoGroup+'-client';var Jm=null;if(window.navigator&&window.navigator.mimeTypes&&window.navigator.mimeTypes.length){Jm=window.navigator.mimeTypes[Im];}
if(!Jm){throw new xmp.PlugInNotFoundError(this._VALIDATE_OCTO,this._getPluginInfo());}
if(!Jm.enabledPlugin){throw new xmp.PlugInDisabledError(this._VALIDATE_OCTO,this._getPluginInfo(),this._OCTO_MIME_TYPE);}
var Km=window.document.createElement("DIV");window.document.body.appendChild(Km);Km.innerHTML='<object id="xmp_octoshapeclientobject" type="'+Im+'" hidden="true"></object>';this._initializingOctoPlugin=window.document.getElementById('xmp_octoshapeclientobject');}
if(!this._initializingOctoPlugin){throw new xmp.PlugInNotFoundError(this._VALIDATE_OCTO,this._getPluginInfo());}};xmp.OctoshapeUrlStrategy.prototype._getPluginInfo=function(){var Lm=xmp.PlayerPolicy;var Mm=Lm.getPlugins();var Nm=Mm.Octoshape;if(!Nm){var ex=new Error('Octoshape plugin incorrectly configured.');this._logger.fatal('Octoshape error',ex);throw ex;}
return Nm;};xmp.SimpleUrlStrategy=function(){};xmp.SimpleUrlStrategy.prototype.getName=function(){return'Simple';};xmp.SimpleUrlStrategy.prototype.buildUrlAsynch=function(Om,Pm){Pm.callAsynch([Om,null]);};