// Turner XMP, Release Build, © 2007 Turner Broadcasting System, Inc. A Time Warner Company.  File: xmp_playerapi, Version: 0.1.555.2010

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.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.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(Fd,Gd){this.type=Fd;this.playerPolicy=Gd;};xmp.AbstractPlayingPolicy.prototype.apply=function(Hd,Id){if(false===this.canApply(Id)){return true;}
try{this.validatePlatform(Hd.getName(),Id.getStreamingMode());}
catch(e){this.handleApplyError(Hd,Id,e,false);return false;}
var Jd=this.getApplyPolicy(Id);var Kd=Jd.media.length;for(var i=0;i<Kd;i++){try{var Ld=this.playerPolicy.getMediaType(Jd.media[i]);this.validateMedia(Jd.type,Jd.media[i],Ld);if(false===this.isPlayable(Ld,Id)){continue;}
this.playerPolicy.getLogger().debug("Applying playing policy \""+Jd.type+"\" to playable node.");this.setPolicy(Hd.getName(),Ld,Id);return true;}
catch(e2){var Md=this.handleApplyError(Hd,Id,e2,this.canFailover(Jd.type,Id,i,Jd.media));if(true===Md){continue;}
return false;}}
var Nd=[];try{Nd=this.playerPolicy.getSizes();}
catch(e3){}
throw new xmp.PlayingPolicyApplyError("Applying playing policy.",Nd,Jd,Id);};xmp.AbstractPlayingPolicy.prototype.getType=function(){return this.type;};xmp.AbstractPlayingPolicy.prototype.getApplyPolicy=function(Od){var Pd=this.playerPolicy.getSupportedPlatformBrowser(xmp.util.internals.BrowserDetect.OS,xmp.util.internals.BrowserDetect.browser);var Qd=Od.getStreamingMode();var Rd=this.playerPolicy.getPlaybackPriorityGroup(Pd.modes[Qd]);var Sd=xmp.util.internals.BrowserDetect.OS+"/"+xmp.util.internals.BrowserDetect.browser+((Qd&&Qd.length>0)?("/"+Qd):"");return{type:Sd,media:Rd};};xmp.AbstractPlayingPolicy.prototype.isPlayable=function(Td,Ud){if(false===this.validateMimeType(Td,Ud)){return false;}
return this.validateSize(Td,Ud);};xmp.AbstractPlayingPolicy.prototype.setupNode=function(Vd,Wd){if(!Wd.isUriAbsolute()){var Xd=Vd.streamingModes[Wd.getStreamingMode()];var Yd=Xd.url_mask;var Zd=[{name:xmp.HOST_PARAMETER,value:this.getHost(Vd,Xd)},{name:xmp.PATH_PARAMETER,value:Wd.getURI()},{name:xmp.SIZE_PARAMETER,value:this.getSize(Vd,Wd)}];for(var i=0;i<Zd.length;i++){Yd=Yd.replace(Zd[i].name,Zd[i].value);}
Wd.setMimeType(Vd.mimeType);Wd.setURI(Yd);this.playerPolicy.getLogger().debug("Setting up playable node URI from mask ("+Xd.url_mask+") and MIME type ("+Vd.mimeType+"). URI - "+Yd);}
Wd.setUriAbsolute(true);};xmp.AbstractPlayingPolicy.prototype.getSize=function($d,ae){var be="";if(true===this.urlMaskContainsSize($d,ae)){be=this.playerPolicy.getSizeFromPlayer(ae.getSizes());}
return be;};xmp.AbstractPlayingPolicy.prototype.getHost=function(ce,de){if(-1===de.url_mask.indexOf(xmp.HOST_PARAMETER)){return"";}
var ee=xmp.HOST_REL_NODE_PATH+"/"+ce.type+"/"+de.type;var fe=xmp.util.RootUrlProvider.getInstance().getRootUrl(ee);if(fe.length===0){throw new xmp.PlayingPolicyError("Retrieving host.","Unable to find \""+ce.type+"\" playing policy streaming host configuration for \""+de.type+"\".");}
return fe;};xmp.AbstractPlayingPolicy.prototype.validateMedia=function(ge,he,ie){if(!ie){throw new xmp.PlayingPolicyError("Validating media.","Invalid \""+ge+"\" playing policy media type \""+he+"\".");}};xmp.AbstractPlayingPolicy.prototype.setPolicy=function(je,ke,le){xmp.NativePlayerRegistry.validate(je,ke.mimeType);this.setupNode(ke,le);};xmp.AbstractPlayingPolicy.prototype.validateMimeType=function(me,ne){var oe=ne.getMimeTypes();var pe=oe.length;for(var i=0;i<pe;i++){if(me.mimeType===oe[i]){return true;}}
return false;};xmp.AbstractPlayingPolicy.prototype.validateSize=function(qe,re){if(false===this.urlMaskContainsSize(qe,re)){return true;}
return(this.playerPolicy.getSizeFromPlayer(re.getSizes()).length>0);};xmp.AbstractPlayingPolicy.prototype.urlMaskContainsSize=function(se,te){return(se.streamingModes[te.getStreamingMode()].url_mask.indexOf(xmp.SIZE_PARAMETER)!==-1);};xmp.AbstractPlayingPolicy.prototype.validateBootstrap=function(ue){};xmp.AbstractPlayingPolicy.prototype.validatePlatform=function(ve,we){var xe=this.playerPolicy.getSupportedPlatformBrowser(xmp.util.internals.BrowserDetect.OS,xmp.util.internals.BrowserDetect.browser);if(!xe||(we&&!xe.modes[we])){var ye=xmp.util.internals.BrowserDetect.OS+"/"+xmp.util.internals.BrowserDetect.browser+((we&&we.length>0)?("/"+we):"");throw new xmp.UnsupportedPlatformError(ve,"The platform \""+ye+"\" is unsupported.");}};xmp.AbstractPlayingPolicy.prototype.handleApplyError=function(ze,Ae,e,Be){if(true===this.playerPolicy.getFailover()&&true===Be){this.playerPolicy.getLogger().warn("\n\n"+e.message,e);return true;}
this.playerPolicy.getLogger().critical("\n\n"+e.message,e);ze.onError(Ae,e);return false;};xmp.AbstractPlayingPolicy.prototype.canApply=function(Ce){var De=Ce.getStreamingMode();return((De&&De.length>0)?true:false);};xmp.AbstractPlayingPolicy.prototype.canFailover=function(Ee,Fe,Ge,He){try{var Ie=He.length;for(var i=Ge+1;i<Ie;i++){var Je=this.playerPolicy.getMediaType(He[i]);this.validateMedia(Ee,He[i],Je);if(false===this.isPlayable(Je,Fe)){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(Ke,Le){var Me=xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath(Le).getInt(xmp.BANDWIDTH_SAMPLE_INTERVAL,-1);if(-1===Me.length){throw new xmp.BandwidthRecorderError("Initializing.","Missing bandwidth recorder sample interval.");}
this.player=Ke;this.logger=new xmp.util.internals.CategoryLogger('BandwidthRecorder');var Ne=new xmp.util.Callback(xmp.BANDWIDTH_RECORDER_SAMPLE_TIMER,this.onSample,this);this.sampleTimer=new xmp.util.Timer(xmp.BANDWIDTH_RECORDER_SAMPLE_TIMER,Me,-1,Ne);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(Oe,Pe){try{var Qe=this.player.getBufferingProgress();this.validateSample(Qe);var Re=this.initSampleTime();var Se=(Re-this.sampleStartTime);var Te=this.calcBandwidth(Se,Qe.bytesDownloaded);this.logBandwidth(Te,xmp.CURRENT_BANDWIDTH_LABEL,Qe.bytesDownloaded,"Downloaded Bytes");var Ue=(this.totalBytesDownloaded+Qe.bytesDownloaded);Te=this.calcBandwidth((this.totalDuration+Se),Ue);this.logBandwidth(Te,xmp.CUMULATIVE_BANDWIDTH_LABEL,Ue,"Cumulative Bytes");this.lastBytesDownloaded=Qe.bytesDownloaded;this.lastDuration=Se;if(100===Qe.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(Ve,b){try{var We=(Ve/1000);var x=((b*8)/1024);return(x/We);}
catch(e){var Xe=new xmp.BandwidthRecorderError("Calculating bandwidth.",e.message);Xe.setInnerError(e);throw Xe;}};xmp.BandwidthRecorder.prototype.logBandwidth=function(Ye,Ze,$e,af){try{var bf=Math.ceil(Ye)+"KB/sec";this.logger.info(Ze+":  "+bf+", "+af+":  "+$e);xmp.util.PlayerStats.getInstance().setValue(Ze,bf);}
catch(e){var cf=new xmp.BandwidthRecorderError("Logging bandwidth.",((e.rawMessage)?e.rawMessage:e.message));cf.setInnerError(e);throw cf;}};xmp.BandwidthRecorder.prototype.validateSample=function(df){if(!df){throw new xmp.BandwidthRecorderError("Validating sample.","Missing sample.");}
if(false===xmp.isDefined(df.bytesDownloaded)){throw new xmp.BandwidthRecorderError("Validating sample.","Missing bytes downloaded.");}};xmp.LAZY_PLAYING_POLICY="Lazy";xmp.VALIDATE_ON_BOOTSTRAP="ValidateOnBootstrap";xmp.LazyPlayingPolicy=function(ef){xmp.LazyPlayingPolicy.ctor.call(this,xmp.LAZY_PLAYING_POLICY,ef);};xmp.DERIVE_CLASS(xmp.AbstractPlayingPolicy,xmp.LazyPlayingPolicy);xmp.LazyPlayingPolicy.prototype.validateBootstrap=function(ff){try{xmp.NativePlayerRegistry.createGroup(xmp.VALIDATE_ON_BOOTSTRAP,ff);this.validatePlatform(xmp.VALIDATE_ON_BOOTSTRAP);var gf=this.playerPolicy.getBootstrapMedia();for(var i=0;i<gf.length;i++){xmp.NativePlayerRegistry.validate(xmp.VALIDATE_ON_BOOTSTRAP,gf[i].mimeType);}}
catch(e){this.playerPolicy.getLogger().fatal("\n\n"+e.message,e);if(e.plugIn){ff.onPlugInError(e);}
else if(true===(e instanceof xmp.UnsupportedPlatformError)){ff.onUnsupportedPlatformError(e);}}
finally{xmp.NativePlayerRegistry.destoryGroup(xmp.VALIDATE_ON_BOOTSTRAP);}};xmp.NativePlayerRegistry=function(){var hf={};var jf=new xmp.util.internals.CategoryLogger("NativePlayerRegistry");return{createGroup:function(kf,lf){if(hf[kf]!==null&&true===xmp.isDefined(hf[kf])){throw new xmp.NativePlayerError("Creating group.","A native player group already exists with the name \""+kf+"\".",null);}
var mf=xmp.PlayerPolicy.getSupportedPlatformBrowser(xmp.util.internals.BrowserDetect.OS,xmp.util.internals.BrowserDetect.browser);var nf=((mf)?xmp.PlayerPolicy.getNativePlayerGroup(mf.playersGroup):xmp.PlayerPolicy.getDefaultNativePlayerGroup());hf[kf]={owner:lf,template:nf,players:{}};jf.info("Created native player group \""+kf+"\".");},findPlayerByMimeType:function(of,pf){var qf=this.findGroup(of);var rf=qf.players[pf];if(rf){return rf;}
this.validate(of,pf);rf=qf.players[pf];if(rf){return rf;}
throw new xmp.NativePlayerNotFoundError("Finding player by mime type.","Unable to find native player for mime type \""+pf+"\".",of,pf);},findPlayerByType:function(sf,tf){var uf=this.findGroup(sf);for(var vf=xmp.MapIterator.create(uf.players);vf.hasNext();vf.next()){var wf=vf.currentValue();if(wf.getType()===tf){return wf;}}
throw new xmp.NativePlayerNotFoundError("Finding player by media type.","Unable to find native player for type \""+tf+"\".",sf,tf);},validate:function(xf,yf){var zf=this.findGroup(xf);var Af=zf.players[yf];if(Af){Af.validate(yf);return;}
var Bf=zf.template[yf];if(!Bf){throw new xmp.NativePlayerNotFoundError("Validating player.","Unable to find native player for mime type \""+yf+"\".  Missing native player group.",xf,yf);}
var Cf=Bf.length;var Df=null;for(var i=0;i<Cf;i++){try{Af=this.createNativePlayer(zf.owner,Bf[i]);Af.validate(yf);zf.players[yf]=Af;jf.info("Registered native player \""+Af.getType()+"\" for mime type \""+yf+"\" and group \""+xf+"\".");return;}
catch(e){jf.warn("\n\n"+e.message,e);if(i===0){Df=e;}
if(i===(Cf-1)){throw Df;}}}},destoryGroup:function(Ef){var Ff=this.findGroup(Ef);if(!Ff){return;}
for(var Gf=xmp.MapIterator.create(Ff.players);Gf.hasNext();Gf.next()){var Hf=Gf.currentValue();Hf.fini();}
hf[Ef]=null;jf.info("Destroyed native player group \""+Ef+"\".");},createNativePlayer:function(If,Jf){var Kf=xmp.getNamespacedMethod(Jf);return new Kf(If,Jf);},validateGroup:function(Lf,Mf){if(!Mf){throw new xmp.NativePlayerGroupNotFoundError("Validating native player group.","Invalid native player group \""+Lf+"\".",Lf);}},findGroup:function(Nf){var Of=hf[Nf];this.validateGroup(Nf,Of);return Of;}};}();xmp.NULL_PLAYER="Null";xmp.NULL_MIME_TYPE="application/x-null";xmp.NullPlayer=function(Pf,Qf){xmp.NullPlayer.ctor.call(this,xmp.NULL_PLAYER,null,Qf);};xmp.DERIVE_CLASS(xmp.AbstractNativePlayer,xmp.NullPlayer);xmp.NullPlayer.prototype.create=function(Rf){Rf.id=Rf.viewport.name;if(Rf.viewport&&Rf.viewport.getType()===xmp.DHTML_VIEWPORT){Rf.viewport.getNative().style.backgroundColor=xmp.BLACK_BACKGROUND_COLOR;Rf.viewport.getNative().innerHTML="";}
xmp.NullPlayer.base.create.call(this,Rf);};xmp.PlayerPolicy=function(){var Sf="/PlayerContexts/Global/PlayingPolicy";var Tf="PlayingPolicy/MediaTypes";var Uf="PlayingPolicy/PlugIns";var Vf="Strategy";var Wf="PlayingPolicy/Streaming Modes";var Xf="PlayingPolicy/Bootstrap Media";var Yf="PlayingPolicy/Supported Platforms";var Zf="PlayingPolicy/Playback Priority Groups";var $f="PlayingPolicy/Native Players";var ag="PlayingPolicy/Native Player Groups";var bg="PlayingPolicy/Playback Platforms";var cg="Streaming Modes";var dg="Players";var eg="Properties";var fg="mime-type";var gg="display-name";var hg="download-url";var ig="minimum-version";var jg="maximum-version";var kg="Failover";var lg="BasePlayer/PlayerSizes";var mg="PlugIns Overrides";return{initMediaTypes:function(){this.mediaTypes={};var ng=xmp.util.SettingsManager.getInstance().getGlobalContextNode();var og=ng.getNodeForPath(Tf);var pg=og.retrieveChildren();var qg=pg.length;for(var i=0;i<qg;i++){var rg=pg[i];var sg=rg.getString(fg,xmp.NO_DEFAULT_VALUE);this.validateMimeType(rg.getName(),sg);var tg={type:rg.getName(),mimeType:sg,streamingModes:{}};var ug=rg.getNodeForPath(cg);var vg=ug.retrieveKeys();var wg=vg.length;for(var j=0;j<wg;j++){var xg=this.getStreamingMode(tg.type,ug,vg[j]);tg.streamingModes[xg.type]=xg;}
this.mediaTypes[tg.type]=tg;}},initPlugins:function(){this.plugIns={};var yg=xmp.util.SettingsManager.getInstance().getGlobalContextNode();var zg=yg.getNodeForPath(Uf);var Ag=zg.retrieveChildren();var Bg=Ag.length;for(var i=0;i<Bg;i++){var Cg=Ag[i];var Dg={name:Cg.getName(),displayName:Cg.getString(gg,xmp.NO_DEFAULT_VALUE),minVersion:Cg.getString(ig,xmp.NO_DEFAULT_VALUE),maxVersion:Cg.getString(jg,xmp.NO_DEFAULT_VALUE),downloadUrl:Cg.getString(hg,xmp.NO_DEFAULT_VALUE),properties:{}};this.validatePlugIn(Dg);this.plugIns[Cg.getName()]=Dg;}},apply:function(Eg,Fg){this.init();return this.getStrategy().apply(Eg,Fg);},validateMimeType:function(Gg,Hg){if(!Hg){throw new xmp.InvalidMimeTypeError("Validating player policy media mime type.","NULL \""+Gg+"\" playing policy MIME type \""+Hg+"\".");}
if(Hg.length===0){throw new xmp.InvalidMimeTypeError("Validating player policy media mime type.","Missing \""+Gg+"\" playing policy MIME type \""+Hg+"\".");}},getStreamingMode:function(Ig,Jg,Kg){var Lg={type:Kg,url_mask:Jg.getString(Kg,xmp.NO_DEFAULT_VALUE)};this.validateStreamingMode(Ig,Lg);return Lg;},validateStreamingMode:function(Mg,Ng){if(false===this.isStreamingModeSupported(Ng.type)){throw new xmp.PlayingPolicyError("Validating streaming mode.","Invalid streaming mode "+Ng.type+" for media type "+Mg+".");}
if(Ng.url_mask.length===0){throw new xmp.PlayingPolicyError("Validating streaming mode.","Missing \""+Mg+"\" playing policy \""+Ng.type+"\" url mask.");}},getStrategy:function(){if(this.strategy===null){var Og=xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath(Sf);var Pg=Og.getString(Vf,xmp.NO_DEFAULT_VALUE);if(Pg.length===0){throw new xmp.PlayingPolicyError("Retrieving strategy.","Missing playing policy strategy.  Expected \"Lazy\".");}
this.strategy=xmp.PlayingPolicyFactory.createStrategy(Pg,this);this.getLogger().debug("Created player policy \""+Pg+"\" strategy.");}
return this.strategy;},getMediaType:function(Qg){return this.mediaTypes[Qg];},getPlugins:function(){this.init();return this.plugIns;},getPlugin:function(Rg){return this.getPlugins()[Rg];},validatePlugIn:function(Sg){if(Sg.displayName.length===0){throw new xmp.PlayingPolicyError("Validating plugin.","Missing plugin display name.");}
if(Sg.minVersion.length===0){throw new xmp.PlayingPolicyError("Validating plugin.","Missing plugin \""+Sg.displayName+"\" minimum version.");}
if(Sg.downloadUrl.length===0){throw new xmp.PlayingPolicyError("Validating plugin.","Missing plugin \""+Sg.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 Tg=xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath(Sf);this.failover=Tg.getBoolean(kg,false);}
return this.failover;},getSizes:function(){this.init();if(!this.playerSizes){this.initPlayerSizes();}
return this.playerSizes;},getSizeFromPlayer:function(Ug){this.init();var Vg=this.getSizes();var Wg=Vg.length;for(var i=0;i<Wg;i++){var Xg=Ug.length;for(var j=0;j<Xg;j++){if(Vg[i]===Ug[j]){return Vg[i];}}}
return"";},initPlayerSizes:function(){this.playerSizes=[];var Yg=xmp.util.SettingsManager.getInstance().getContextNode().getNodeForPath(lg);var Zg=Yg.retrieveKeys();var $g=Zg.length;if($g===0){throw new xmp.PlayingPolicyError("Validating player sizes.","Missing player sizes.");}
for(var i=0;i<$g;i++){var ah=Yg.getString(Zg[i],xmp.NO_DEFAULT_VALUE);if(ah.length===0){throw new xmp.PlayingPolicyError("Validating player size.","Missing player size.");}
this.playerSizes.push(ah);}},validateBootstrap:function(bh){this.init();this.getStrategy().validateBootstrap(bh);},initStreamingModes:function(){var ch=xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath(Wf);var dh=ch.retrieveKeys();var eh=dh.length;this.modes=[];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 streaming mode.","Missing mode.");}
this.modes.push(fh);}
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 gh=xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath(Xf);var hh=gh.retrieveKeys();var ih=hh.length;if(ih===0){throw new xmp.PlayingPolicyError("Validating bootstrap media.","Missing media.");}
this.bootstrapMedia=[];for(var i=0;i<ih;i++){var jh=gh.getString(hh[i],xmp.NO_DEFAULT_VALUE);var kh=this.getMediaType(jh);if(!kh){throw new xmp.PlayingPolicyError("Validating bootstrap media.","Invalid bootstrap media type \""+jh+"\".");}
this.bootstrapMedia.push(kh);}
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 lh=xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath($f);var mh=lh.retrieveChildren();var nh=mh.length;if(nh===0){throw new xmp.PlayingPolicyError("Validating native players.","Missing players.");}
this.nativePlayers=[];for(var i=0;i<nh;i++){var oh=mh[i];if(!xmp.getNamespacedMethod(oh.getName())){throw new xmp.PlayingPolicyError("Validating native player.","Invalid "+oh.getName()+" native player.");}
var ph=oh.retrieveKeys();var qh=ph.length;var rh={};for(var j=0;j<qh;j++){rh[ph[j]]=oh.getString(ph[j],xmp.NO_DEFAULT_VALUE);}
this.nativePlayers[oh.getName()]=rh;}},initNativePlayerGroups:function(){var sh=xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath(ag);var th=sh.retrieveChildren();var uh=th.length;if(uh===0){throw new xmp.PlayingPolicyError("Validating native player groups.","Missing groups.");}
this.nativePlayerGroups=[];for(var i=0;i<uh;i++){var vh=this.getDefaultNativePlayerGroup();var wh=th[i];var xh=wh.retrieveChildren();var yh=xh.length;if(yh===0){throw new xmp.PlayingPolicyError("Validating native player group mime types.","Missing "+wh.getName()+" mime types.");}
for(var j=0;j<yh;j++){var zh=xh[j].getString(fg,xmp.NO_DEFAULT_VALUE);if(zh.length===0){throw new xmp.PlayingPolicyError("Validating native player group mime type.","Missing \""+wh.getName()+"\" mime type.");}
if(false===this.isMimeTypeSupported(zh)){continue;}
var Ah=xh[j].getNodeForPath(dg);var Bh=Ah.retrieveKeys();var Ch=Bh.length;if(Ch===0){throw new xmp.PlayingPolicyError("Validating native player group mime type players.","Missing "+wh.getName()+" native player group \""+zh+"\" players.");}
var Dh=[];for(var k=0;k<Ch;k++){var Eh=Ah.getString(Bh[k],xmp.NO_DEFAULT_VALUE);if(Eh.length===0){throw new xmp.PlayingPolicyError("Validating native player group mime type player.","Missing "+wh.getName()+" native player group \""+zh+"\" player.");}
if(false===xmp.isDefined(this.getNativePlayerConfig(Eh))){throw new xmp.PlayingPolicyError("Validating native player group mime type player.","Invalid "+wh.getName()+" native player group \""+zh+"\" player \""+Eh+".");}
Dh.push(Eh);}
vh[zh]=Dh;}
this.nativePlayerGroups[wh.getName()]=vh;}},initSupportedPlatforms:function(){var Fh=xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath(Yf);var Gh=Fh.retrieveChildren();var Hh=Gh.length;if(Hh===0){throw new xmp.PlayingPolicyError("Validating supported platforms.","Missing platforms.");}
this.platforms={};for(var i=0;i<Hh;i++){var Ih=Gh[i];var Jh=Ih.retrieveKeys();var Kh=Jh.length;if(Kh===0){throw new xmp.PlayingPolicyError("Validating supported platform browsers.","Missing "+Ih.getName()+" browsers.");}
var Lh=[];for(var j=0;j<Kh;j++){var Mh=Ih.getString(Jh[j],xmp.NO_DEFAULT_VALUE);if(Mh.length===0){throw new xmp.PlayingPolicyError("Validating supported platform browser native player group.","Missing "+Ih.getName()+" platform \""+Jh[j]+"\" browser native player group.");}
if(false===xmp.isDefined(this.getNativePlayerGroup(Mh))){throw new xmp.PlayingPolicyError("Validating supported platform browser native player group.","Invalid "+Ih.getName()+" platform \""+Jh[j]+"\" browser native player group \""+Mh+"\".");}
Lh.push({name:Jh[j],playersGroup:Mh,modes:{}});}
if(xmp.util.internals.BrowserDetect.OS===Ih.getName()){this.initPlatformPlugInOverrides(Ih);}
this.platforms[Ih.getName()]=Lh;}},initPlaybackPriorityGroups:function(){var Nh=xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath(Zf);var Oh=Nh.retrieveChildren();var Ph=Oh.length;if(Ph===0){throw new xmp.PlayingPolicyError("Validating playback priority groups.","Missing groups.");}
this.playbackPriorityGroups=[];for(var i=0;i<Ph;i++){var Qh=Oh[i];var Rh=Qh.retrieveKeys();var Sh=Rh.length;if(Sh===0){throw new xmp.PlayingPolicyError("Validating playback priority group media.","Missing "+Qh.getName()+" media.");}
var Th=[];for(var j=0;j<Sh;j++){var Uh=Qh.getString(Rh[j],xmp.NO_DEFAULT_VALUE);if(Uh.length===0){throw new xmp.PlayingPolicyError("Validating playback priority group media.","Missing "+Qh.getName()+" media type.");}
if(false===xmp.isDefined(this.getMediaType(Uh))){throw new xmp.PlayingPolicyError("Validating playback priority group media.","Invalid "+Qh.getName()+" media type \""+Uh+"\".");}
Th.push(Uh);}
this.playbackPriorityGroups[Qh.getName()]=Th;}},initPlaybackPlatforms:function(){var Vh=xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath(bg);var Wh=Vh.retrieveChildren();var Xh=Wh.length;if(Xh===0){throw new xmp.PlayingPolicyError("Validating playback platforms.","Missing platforms.");}
for(var i=0;i<Xh;i++){var Yh=Wh[i];if(this.getSupportedPlatform(Yh.getName())===null){throw new xmp.PlayingPolicyError("Validating playback platform OS.","The "+Yh.getName()+"platform OS is not supported.");}
var Zh=Yh.retrieveChildren();var $h=Zh.length;if($h===0){throw new xmp.PlayingPolicyError("Validating playback platform browsers.","Missing "+Yh.getName()+" platform browsers.");}
for(var j=0;j<$h;j++){var ai=Zh[j];var bi=this.getSupportedPlatformBrowser(Yh.getName(),ai.getName());if(!bi){throw new xmp.PlayingPolicyError("Validating playback platform browser.","The "+Yh.getName()+" platform browser "+ai.getName()+" is not supported.");}
var ci=ai.retrieveKeys();var di=ci.length;if(di===0){throw new xmp.PlayingPolicyError("Validating playback platform browser streaming modes.","Missing "+Yh.getName()+" platform browser "+ai.getName()+" streaming modes.");}
for(var k=0;k<di;k++){if(false===this.isStreamingModeSupported(ci[k])){throw new xmp.PlayingPolicyError("Validating playback platform browser streaming mode.","Invalid "+Yh.getName()+" platform browser "+ai.getName()+" streaming mode "+ci[k]+".");}
var ei=ai.getString(ci[k],xmp.NO_DEFAULT_VALUE);if(ei.length===0){throw new xmp.PlayingPolicyError("Validating playback platform browser streaming mode priority group.","Missing "+Yh.getName()+" platform browser "+ai.getName()+" streaming mode "+ci[k]+" playback priority group.");}
if(false===xmp.isDefined(this.getPlaybackPriorityGroup(ei))){throw new xmp.PlayingPolicyError("Validating playback platform browser streaming mode priority group.","Invalid "+Yh.getName()+" platform browser "+ai.getName()+" streaming mode "+ci[k]+" playback priority group "+ei+".");}
bi.modes[ci[k]]=ei;}}}},initPlatformPlugInOverrides:function(fi){var gi=fi.getNodeForPath(mg);var hi=gi.retrieveChildren();var ii=hi.length;for(var i=0;i<ii;i++){var ji=hi[i];var ki=this.getPlugin(ji.getName());if(!ki){throw new xmp.PlayingPolicyError("Validating platform plugin override.","Invalid "+fi.getName()+" platform \""+ji.getName()+"\" plugin.");}
var li=ji.getString(ig,xmp.NO_DEFAULT_VALUE);if(li.length>0){ki.minVersion=li;}
var mi=ji.getString(jg,xmp.NO_DEFAULT_VALUE);if(mi.length>0){ki.maxVersion=mi;}
var ni=ji.getString(hg,xmp.NO_DEFAULT_VALUE);if(ni.length>0){ki.downloadUrl=ni;}}},getSupportedPlatform:function(oi){return this.platforms[oi];},getPlaybackPriorityGroup:function(pi){this.init();return this.playbackPriorityGroups[pi];},getSupportedPlatformBrowser:function(qi,ri){this.init();var si=this.getSupportedPlatform(qi);if(!si){return null;}
var ti=si.length;for(var i=0;i<ti;i++){if(ri===si[i].name){return si[i];}}
return null;},isStreamingModeSupported:function(ui){var vi=this.modes.length;for(var i=0;i<vi;i++){if(ui===this.modes[i]){return true;}}
return false;},isMimeTypeSupported:function(wi){this.init();for(var xi=xmp.MapIterator.create(this.mediaTypes);xi.hasNext();xi.next()){var yi=xi.currentValue();if(yi.mimeType===wi){return true;}}
return((this.getDefaultNativePlayerGroup()[wi])?true:false);},getNativePlayerConfig:function(zi){this.init();return this.nativePlayers[zi];},getNativePlayerGroup:function(Ai){this.init();return this.nativePlayerGroups[Ai];},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(Bi,Ci){if(Bi===xmp.LAZY_PLAYING_POLICY){return new xmp.LazyPlayingPolicy(Ci);}
throw new xmp.PlayingPolicyError("Creating playing policy strategy.","Unable to create playing policy strategy \""+Bi+"\".");}};}();xmp.BandwidthRecorderError=function(Di,Ei){xmp.BandwidthRecorderError.ctor.call(this,"BandwidthRecorderError",Di,Ei);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.BandwidthRecorderError);xmp.DHTMLObjectError=function(Fi,Gi){xmp.DHTMLObjectError.ctor.call(this,"DHTMLObjectError",Fi,Gi);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.DHTMLObjectError);xmp.InvalidMimeTypeError=function(Hi,Ii){xmp.InvalidMimeTypeError.ctor.call(this,"InvalidMimeTypeError",Hi,Ii);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.InvalidMimeTypeError);xmp.InvalidNativePlayerViewportError=function(Ji,Ki,Li){var Mi=[{label:"Native Player Type",text:Li.getType()},{label:"Native Player Name",text:Li.getName()}];xmp.InvalidNativePlayerViewportError.ctor.call(this,"InvalidNativePlayerViewportError",Ji,Ki,Mi);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.InvalidNativePlayerViewportError);xmp.InvalidPlayableNodeError=function(Ni,Oi){xmp.InvalidPlayableNodeError.ctor.call(this,"InvalidMimeTypeError",Ni,Oi);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.InvalidPlayableNodeError);xmp.InvalidPlugInVersionError=function(Pi,Qi,Ri){var Si="Invalid "+Qi.displayName+" version \""+Ri+"\".  Expected version is ";Si+=((parseInt(Qi.maxVersion,10)>0)?"between \""+Qi.minVersion+"\" and \""+Qi.maxVersion+"\".":"\""+Qi.minVersion+"\" or greater.");Si+="\n\nThe latest plugin can be downloaded at \""+Qi.downloadUrl+"\".";xmp.InvalidPlugInVersionError.ctor.call(this,"InvalidPlugInVersionError",Pi,Si,Qi);};xmp.DERIVE_CLASS(xmp.PlugInError,xmp.InvalidPlugInVersionError);xmp.MediaPlayerError=function(Ti,Ui){xmp.MediaPlayerError.ctor.call(this,"MediaPlayerError",Ti,Ui);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.MediaPlayerError);xmp.NativePlayerConnectionError=function(Vi,Wi,Xi,Yi){var Zi=[{label:"Native Player Type",text:((Xi)?Xi.getType():"")},{label:"Native Player Name",text:((Xi)?Xi.getName():"")}];if(Yi){Zi=Zi.concat(Yi);}
xmp.NativePlayerConnectionError.ctor.call(this,xmp.XmpErrorCodes.CRITICAL_PLAYER_CONNECTION,"NativePlayerConnectionError",Vi,Wi,Zi);};xmp.DERIVE_CLASS(xmp.CriticalException,xmp.NativePlayerConnectionError);xmp.NativePlayerError=function($i,aj,bj,cj){var dj=[];if(bj){dj.push({label:"Native Player Type",text:bj.getType()});dj.push({label:"Native Player Name",text:bj.getName()});}
if(cj){dj=dj.concat(cj);}
xmp.NativePlayerError.ctor.call(this,"NativePlayerError",$i,aj,dj);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.NativePlayerError);xmp.NativePlayerGroupNotFoundError=function(ej,fj,gj,hj){var ij=[{label:"Native Player Group",text:gj}];if(hj){ij=ij.concat(hj);}
xmp.NativePlayerGroupNotFoundError.ctor.call(this,xmp.XmpErrorCodes.FATAL_UNSPECIFIED_ERROR,"NativePlayerGroupNotFoundError",ej,fj,ij);};xmp.DERIVE_CLASS(xmp.FatalException,xmp.NativePlayerGroupNotFoundError);xmp.NativePlayerNotFoundError=function(jj,kj,lj,mj,nj){var oj=[{label:"Native Player Group",text:lj},{label:"MIME Type",text:mj}];if(nj){oj=oj.concat(nj);}
xmp.NativePlayerNotFoundError.ctor.call(this,xmp.XmpErrorCodes.FATAL_PLATFORM,"NativePlayerNotFoundError",jj,kj,oj);};xmp.DERIVE_CLASS(xmp.CriticalException,xmp.NativePlayerNotFoundError);xmp.NativePlayerUnsupportedError=function(pj,qj,rj){var sj=[{label:"Native Player Type",text:((rj)?rj.getType():"")},{label:"Native Player Name",text:((rj)?rj.getName():"")}];xmp.NativePlayerUnsupportedError.ctor.call(this,"NativePlayerUnsupportedError",pj,qj,sj);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.NativePlayerUnsupportedError);xmp.PlaybackModeError=function(tj,uj,vj){var wj=[{label:"Playback Mode",text:((vj)?vj.getName():"")}];xmp.PlaybackModeError.ctor.call(this,"PlaybackModeError",tj,uj,wj);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.PlaybackModeError);xmp.PlayingPolicyApplyError=function(xj,yj,zj,Aj){var Bj="Unable to apply playing policy to playable node.\n\nPlayer Sizes:              "+yj.join(", ")+"\n\nPolicy:"+"\n\n  Type:                     "+zj.type+"\n  Media:                   "+zj.media.join(", ")+"\n\nPlayable Node:"+"\n\n  Location:               "+Aj.getURI()+"\n  Streaming Mode:  "+Aj.getStreamingMode()+"\n  Mime Types:         "+Aj.getMimeTypes().join(", ")+"\n  Sizes:                   "+Aj.getSizes().join(", ");xmp.PlayingPolicyApplyError.ctor.call(this,"PlayingPolicyApplyError",xj,Bj);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.PlayingPolicyApplyError);xmp.PlayingPolicyError=function(Cj,Dj){xmp.PlayingPolicyError.ctor.call(this,"PlayingPolicyError",Cj,Dj);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.PlayingPolicyError);xmp.PlugInDisabledError=function(Ej,Fj,Gj){var Hj="The "+Fj.displayName+" is disabled or not associated with the \""+Gj+"\" MIME type.";xmp.PlugInDisabledError.ctor.call(this,"PlugInDisabledError",Ej,Hj,Fj);};xmp.DERIVE_CLASS(xmp.PlugInError,xmp.PlugInDisabledError);xmp.PlugInNotFoundError=function(Ij,Jj){var Kj=Jj.displayName+" not found.  \n\nThe plugin can be downloaded at \""+Jj.downloadUrl+"\".";xmp.PlugInNotFoundError.ctor.call(this,"PlugInNotFoundError",Ij,Kj,Jj);};xmp.DERIVE_CLASS(xmp.PlugInError,xmp.PlugInNotFoundError);xmp.ServiceError=function(Lj,Mj){xmp.ServiceError.ctor.call(this,"ServiceError",Lj,Mj);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.ServiceError);xmp.UnsupportedPlatformError=function(Nj,Oj){xmp.UnsupportedPlatformError.ctor.call(this,xmp.XmpErrorCodes.FATAL_PLATFORM,"UnsupportedPlatformError",Nj,Oj);};xmp.DERIVE_CLASS(xmp.FatalException,xmp.UnsupportedPlatformError);xmp.UnsupportedPlugInVersionError=function(Pj,Qj,Rj){var Sj="The "+Qj.displayName+" version \""+Rj+"\" is not supported.  Expected version is ";Sj+=((parseInt(Qj.maxVersion,10)>0)?"between \""+Qj.minVersion+"\" and \""+Qj.maxVersion+"\".":"\""+Qj.minVersion+"\" or greater.");Sj+="\n\nA supported plugin can be downloaded at \""+Qj.downloadUrl+"\".";xmp.UnsupportedPlugInVersionError.ctor.call(this,"UnsupportedPlugInVersionError",Pj,Sj,Qj);};xmp.DERIVE_CLASS(xmp.PlugInError,xmp.UnsupportedPlugInVersionError);xmp.DefaultPlaybackMode=function(Tj,Uj,Vj){xmp.DefaultPlaybackMode.ctor.call(this,Tj,Uj,Vj);};xmp.DERIVE_CLASS(xmp.PlaybackMode,xmp.DefaultPlaybackMode);xmp.DefaultPlaybackMode.prototype.open=function(Wj,Xj){this.changeMode(Wj,xmp.INIT,xmp.OPEN_OPERATION,Xj);};xmp.DefaultPlaybackMode.prototype.close=function(Yj){this.changeMode(Yj,xmp.FINI,xmp.CLOSE_OPERATION,null);};xmp.DefaultPlaybackMode.prototype.play=function(Zj){this.changeMode(Zj,xmp.PLAY,xmp.PLAY_OPERATION,null);};xmp.DefaultPlaybackMode.prototype.pause=function($j){this.changeMode($j,xmp.PAUSE,xmp.PAUSE_OPERATION,null);};xmp.DefaultPlaybackMode.prototype.stop=function(ak){this.changeMode(ak,xmp.STOP,xmp.STOP_OPERATION,null);};xmp.DefaultPlaybackMode.prototype.rewind=function(bk){this.changeMode(bk,xmp.REWIND,xmp.REWIND_OPERATION,null);};xmp.DefaultPlaybackMode.prototype.fastForward=function(ck){this.changeMode(ck,xmp.FAST_FORWARD,xmp.FAST_FORWARD_OPERATION,null);};xmp.DefaultPlaybackMode.prototype.seek=function(dk,ek){this.changeMode(dk,xmp.SEEKABLE,xmp.SEEK_OPERATION,ek);};xmp.DefaultPlaybackMode.prototype.ended=function(fk){this.changeMode(fk,xmp.ENDED,xmp.ENDED_OPERATION,null);};xmp.DefaultPlaybackMode.prototype.error=function(gk){this.changeMode(gk,xmp.ERRORS,xmp.ERROR_OPERATION,null);};xmp.DefaultPlaybackMode.prototype.isAvailable=function(hk,ik){try{return(true===this.canTransition(ik)||this.getPlayer(hk).isAvailable(ik));}
catch(e){this.handleError(hk,xmp.IS_AVAILABLE,e);}
return false;};xmp.DefaultPlaybackMode.prototype.getPosition=function(jk){try{return parseInt(this.getPlayer(jk).getPosition(),10);}
catch(e){this.handleError(jk,xmp.GET_POSITION,e);}
return 0;};xmp.DefaultPlaybackMode.prototype.getDuration=function(kk){try{return parseInt(this.getPlayer(kk).getDuration(),10);}
catch(e){this.handleError(kk,xmp.GET_DURATION,e);}
return 0;};xmp.DefaultPlaybackMode.prototype.getVolume=function(lk){try{return this.getPlayer(lk).getVolume();}
catch(e){this.handleError(lk,xmp.GET_VOLUME,e);}
return 0;};xmp.DefaultPlaybackMode.prototype.setVolume=function(mk,nk){try{this.getPlayer(mk).setVolume(nk);}
catch(e){this.handleError(mk,xmp.SET_VOLUME,e);}};xmp.DefaultPlaybackMode.prototype.getMute=function(ok){try{return this.getPlayer(ok).getMute();}
catch(e){this.handleError(ok,xmp.GET_MUTE,e);}
return false;};xmp.DefaultPlaybackMode.prototype.setMute=function(pk,qk){try{this.getPlayer(pk).setMute(qk);}
catch(e){this.handleError(pk,xmp.SET_MUTE,e);}};xmp.DefaultPlaybackMode.prototype.getFullscreen=function(rk){try{return this.getPlayer(rk).getFullscreen();}
catch(e){this.handleError(rk,xmp.GET_FULLSCREEN,e);}
return false;};xmp.DefaultPlaybackMode.prototype.setFullscreen=function(sk,tk){try{this.getPlayer(sk).setFullscreen(tk);}
catch(e){this.handleError(sk,xmp.SET_FULLSCREEN,e);}};xmp.DefaultPlaybackMode.prototype.getBufferingProgress=function(uk){try{return this.getPlayer(uk).getBufferingProgress();}
catch(e){this.handleError(uk,xmp.GET_BUFFERING_PROGRESS,e);}
return null;};xmp.DefaultPlaybackMode.prototype.handleError=function(vk,wk,e){var xk=e;if(false===(xk instanceof xmp.NativePlayerError)&&false===(xk instanceof xmp.NativePlayerUnsupportedError)){var yk="Delegating \""+wk.toLowerCase()+"\" operation to native player.";xk=new xmp.NativePlayerError(((e.context)?e.context:yk),((e.rawMessage)?e.rawMessage:e.message),this.getPlayer(vk),[{label:"Playback Mode",text:this.getName()}]);xk.setInnerError(e);}
throw xk;};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(zk,Ak,Bk){this.ended(zk);};xmp.EndedPlaybackMode.prototype.ended=function(Ck){try{this.getPlayer(Ck).ended();}
catch(e){this.handleError(Ck,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(Dk,Ek,Fk){this.error(Dk);};xmp.ErrorPlaybackMode.prototype.error=function(Gk){try{this.getPlayer(Gk).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(Hk,Ik,Jk){this.fastForward(Hk);};xmp.FastForwardPlaybackMode.prototype.fastForward=function(Kk){try{this.getPlayer(Kk).fastForward();}
catch(e){this.handleError(Kk,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(Lk,Mk,Nk){try{this.getPlayer(Lk).close();}
catch(e){this.handleError(Lk,xmp.CLOSE_OPERATION,e);}};xmp.FiniPlaybackMode.prototype.close=function(Ok){};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(Pk,Qk,Rk){try{this.getPlayer(Pk).open(Qk);}
catch(e){this.handleError(Pk,xmp.OPEN_OPERATION,e);}};xmp.InitPlaybackMode.prototype.open=function(Sk,Tk){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(Uk,Vk,Wk){this.play(Uk);};xmp.NormalPlaybackMode.prototype.play=function(Xk){try{this.getPlayer(Xk).play();}
catch(e){this.handleError(Xk,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(Yk,Zk,$k){this.pause(Yk);};xmp.PausePlaybackMode.prototype.pause=function(al){try{this.getPlayer(al).pause();}
catch(e){this.handleError(al,xmp.PAUSE_OPERATION,e);}};xmp.PlayerModeRegistry=function(){this.modes=[];var bl=[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<bl.length;i++){this.addMode(bl[i]);}};xmp.PlayerModeRegistry.prototype.addMode=function(cl){this.modes[cl.type]=cl;};xmp.PlayerModeRegistry.prototype.findMode=function(dl){var el=this.modes[dl];if(el!==null){return el;}
throw new xmp.PlaybackModeError("Finding playback mode.","Unable to find player mode \""+dl+"\".",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(fl,gl,hl){this.rewind(fl);};xmp.RewindPlaybackMode.prototype.rewind=function(il){try{this.getPlayer(il).rewind();}
catch(e){this.handleError(il,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(jl,kl,ll){this.seek(jl,kl);};xmp.SeekablePlaybackMode.prototype.seek=function(ml,nl){try{this.getPlayer(ml).seek(nl);}
catch(e){this.handleError(ml,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(ol,pl,ql){this.stop(ol);};xmp.StopPlaybackMode.prototype.stop=function(rl){try{this.getPlayer(rl).stop();}
catch(e){this.handleError(rl,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 sl=new xmp.ContextualUrlStrategy();return sl;};xmp.ContextualUrlStrategy.prototype.getName=function(){return'Contextual';};xmp.ContextualUrlStrategy.prototype.tryFailover=function(tl,ul,vl){if((!tl)||(!ul)||(!vl)){return false;}
if(vl instanceof xmp.NativePlayerConnectionError&&(this._mapStrategyNameToStrategyObject[this._getStrategyName(ul)].getName()!==this._defaultStrategy.getName())){this._setFailoverStrategy(ul,vl);ul.setURI(ul.getMetadata('originalUri','foo'));ul.setUriAbsolute(false);tl.open(ul);return true;}
return false;};xmp.ContextualUrlStrategy.prototype.buildUrlAsynch=function(wl,xl){var yl=new xmp.util.Callback('ContextualUrlStrategy',this._handleDelegateBuildUrlAsynch,this);yl.setMetadata('relayCb',xl);try{this._getStrategy(wl).buildUrlAsynch(wl,yl);}
catch(ex){this._logger.warn('Error calling buildUrlAsynch: '+ex);this._handleDelegateBuildUrlAsynch(yl,wl,ex);}};xmp.ContextualUrlStrategy.prototype._handleDelegateBuildUrlAsynch=function(zl,Al,Bl){var Cl=zl.getMetadata('relayCb',xmp.util.internals.MetadataMap.defaultObj);if(Bl!==null){this._setFailoverStrategy(Al,Bl);if(Bl.octoError){this._logger.warn('Trying again after fail over.');this.buildUrlAsynch(Al,Cl);return;}}
Cl.call(Al,Bl);};xmp.ContextualUrlStrategy.prototype._setFailoverStrategy=function(Dl,El){try{if(El instanceof xmp.PlugInError){return;}
var Fl=this._getStrategyName(Dl);this._logger.critical('Failing over for strategy: '+Fl,El);this._mapStrategyNameToStrategyObject[Fl]=this._defaultStrategy;}
catch(ex){this._logger.critical('Error setting failover strategy, setting all strategies to default: '+ex);for(var Gl=xmp.MapIterator.create(this._mapStrategyNameToStrategyObject);Gl.hasNext();Gl.next()){Gl.updateCurrentValue(this._defaultStrategy);}}};xmp.ContextualUrlStrategy.prototype._getStrategyName=function(Hl){var Il=Hl.getMimeType();if(!xmp.isNonEmptyString(Il)){throw new Error('No mime-type on playable node.');}
this._loadMimeTypeToUrlStrategyMap();var Jl=this._mapMimeTypeToUrlStrategy[Il];if(!xmp.isNonEmptyString(Jl)){Jl='Simple';this._mapMimeTypeToUrlStrategy[Il]=Jl;}
return Jl;};xmp.ContextualUrlStrategy.prototype._getStrategy=function(Kl){var Ll=this._getStrategyName(Kl);var Ml=this._mapStrategyNameToStrategyObject[Ll];if(typeof(Ml)==='undefined'){Ml=this._createStrategy(Ll);this._mapStrategyNameToStrategyObject[Ll]=Ml;}
if(this._logger.isInfoEnabled()){this._logger.info('For mime-type: '+Kl.getMimeType()+', requested strategy: '+Ll+', actual strategy: '+Ml.getName());}
return Ml;};xmp.ContextualUrlStrategy.prototype._createStrategy=function(Nl){if(Nl==='Simple'){return this._defaultStrategy;}
if(Nl==='Octoshape'){return new xmp.OctoshapeUrlStrategy();}
if(Nl==='OctoshapeConditional'){if(xmp.InternalUserDetection.getInstance().isInternal()&&xmp.OctoshapeUrlStrategy.canUse()){return new xmp.OctoshapeUrlStrategy();}
else{return this._defaultStrategy;}}
throw new Error('Unrecogonized URL strategy name: '+Nl);};xmp.ContextualUrlStrategy.prototype._loadMimeTypeToUrlStrategyMap=function(){if(this._mapMimeTypeToUrlStrategy!==null){return;}
this._mapMimeTypeToUrlStrategy={};this._mapStrategyNameToStrategyObject={};var Ol=xmp.util.SettingsManager.getInstance().getContextNode().getNodeForPath('UrlStrategies');var Pl=Ol.retrieveKeys();for(var i=0;i<Pl.length;i++){var Ql=Pl[i];var Rl=Ol.getString(Ql,'dummy');this._mapMimeTypeToUrlStrategy[Ql]=Rl;}};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(Sl){this._isInited=false;this._isInternal=false;this._primaryCheckResult=-1;try{var Tl=this._getPrefs();if(!Tl.getBoolean('do primary check',false)){this._logger.info('Primary check turned OFF, NOT an internal user.');this._finish(Sl,false);return;}
this._primaryCheckResult=this._isInternalPrimaryCheck();if(1===this._primaryCheckResult){if(Tl.getBoolean('do secondary check',false)){this._logger.info('Primary check returned true, and secondary check turned ON, doing secondary check.');this._checkResourceLoadedFromWeb(Sl);return;}
else{this._logger.info('Primary check returned true, and secondary check turned OFF, IS an internal user.');this._finish(Sl,true);return;}}
else{this._logger.info('Primary check returned: '+this._primaryCheckResult+', NOT an internal user.');this._finish(Sl,false);return;}}
catch(ex){this._logger.info('Error checking internal user.',ex);this._finish(Sl,false);}};xmp.InternalUserDetection.prototype._finish=function(Ul,Vl){this._isInternal=Vl;this._doAsynchCallback(Ul);};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 Wl=xmp.util.Cookie.read('adDEmas');if(xmp.isNonEmptyString(Wl)){var Xl=Wl.split('&');if(Xl.length>=5){cc=Xl[4];}}}
return cc;};xmp.InternalUserDetection.prototype._doAsynchCallback=function(Yl){this._isInited=true;Yl.callAsynch([]);};xmp.InternalUserDetection.prototype._checkResourceLoadedFromWeb=function(Zl){var $l=this._getPrefs();var am=$l.getString('rel url','dummy');var bm='internalUserCheckResource';this._isInternal=false;var cm=new xmp.util.Callback('InternalUserDetection._checkResourceLoadedFromWeb',this._onResourceLoadedFromWeb,this);cm.setMetadata('relayCb',Zl);xmp.net.AjaxRequestManager.getInstance().request(am,cm,bm,am,xmp.net.ContentTypes.TEXT,null);};xmp.InternalUserDetection.prototype._onResourceLoadedFromWeb=function(dm,em){var fm=dm.getMetadata('relayCb',xmp.util.internals.MetadataMap.defaultObj);this._isInited=true;this._isInternal=!em.isError();this._logger.info('Secondary check returned: '+this._isInternal+', user '+(this._isInternal?'IS':'is NOT')+' an internal user.');try{fm.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 gm=xmp.OctoshapeUrlStrategy._staticGetPrefs();var hm='{fn:function(){'+gm.getString('octo can use fn','return false;')+'}}';var im=xmp.net.AjaxRequestManager.getInstance()._parseJson(hm);xmp.OctoshapeUrlStrategy._canUseInternal=im.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(jm,km){if(this._octoException!==null){throw this._octoException;}
try{var lm=new xmp.util.Callback('OctoshapeUrlStrategy',this._handleTimer,this);lm.setMetadata('relayCb',km);lm.setMetadata('node',jm);this._doTimer(lm);}
catch(ex){this._octoException=ex;throw this._octoException;}};xmp.OctoshapeUrlStrategy.prototype._doTimer=function(mm){var nm=mm.getMetadata('node',xmp.util.internals.MetadataMap.defaultObj);var om=this._OCTO_POLL_INTERVAL;var pm=mm.getMetadata('octo_tries',0);var qm=this._getOctoStatus(pm);switch(qm){case this._OCTO_STATE_PLUGIN_INITIALIZING:case this._OCTO_STATE_STARTING:om=this._OCTO_POLL_INTERVAL;pm++;mm.setMetadata('octo_tries',pm);break;case this._OCTO_STATE_READY:om=this._OCTO_ASYNCH_INTERVAL;var rm=nm.getURI();var sm=nm.getBestId();var tm=this._getPrefs().getNodeForPath('url mapping');var um=tm.getString(sm,rm);rm=um;var vm=this._octoPlugin.getLink(rm,false);nm.setURI(vm);this._logger.info('Old URI: '+rm+', New Octoshape URI: '+vm);mm.setMetadata('octo_ready',true);break;default:throw new Error('Unexepected octoshape status: '+qm);}
if(this._logger.isDebugEnabled()){this._logger.debug('Node: '+nm.getBestId()+', timer duration: '+om+', tries: '+pm+', status: '+qm);}
xmp.util.Timer.doSimpleCallbackEx(om,mm);};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(wm){var xm=wm.getMetadata('relayCb',xmp.util.internals.MetadataMap.defaultObj);var ym=wm.getMetadata('node',xmp.util.internals.MetadataMap.defaultObj);var zm=wm.getMetadata('octo_ready',false);if(zm){xm.call(ym,null);}
else{try{this._doTimer(wm);}
catch(ex){this._octoException=ex;xm.call(ym,ex);}}};xmp.OctoshapeUrlStrategy.prototype._getOctoStatus=function(Am){if(Am>=this._OCTO_TRY_LIMIT){var Bm=new Error('Exceeded limit of attempts to start octoshape: '+this._OCTO_TRY_LIMIT);Bm.octoError=true;throw Bm;}
if(this._checkOctoPlugin(Am===(this._OCTO_TRY_LIMIT-1))){return this._octoPlugin.getStatus(true);}
else{return this._OCTO_STATE_PLUGIN_INITIALIZING;}};xmp.OctoshapeUrlStrategy.prototype._checkOctoPlugin=function(Cm){if(this._octoPlugin){return true;}
if(!this._octoPlugin){if(!(typeof(this._initializingOctoPlugin.getStatus)!=='undefined'&&typeof(this._initializingOctoPlugin.getLink)!=='undefined')){if(Cm){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 Dm=this._OCTO_MIME_TYPE+this._octoGroup+'-client';var Em=null;if(window.navigator&&window.navigator.mimeTypes&&window.navigator.mimeTypes.length){Em=window.navigator.mimeTypes[Dm];}
if(!Em){throw new xmp.PlugInNotFoundError(this._VALIDATE_OCTO,this._getPluginInfo());}
if(!Em.enabledPlugin){throw new xmp.PlugInDisabledError(this._VALIDATE_OCTO,this._getPluginInfo(),this._OCTO_MIME_TYPE);}
var Fm=window.document.createElement("DIV");window.document.body.appendChild(Fm);Fm.innerHTML='<object id="xmp_octoshapeclientobject" type="'+Dm+'" 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 Gm=xmp.PlayerPolicy;var Hm=Gm.getPlugins();var Im=Hm.Octoshape;if(!Im){var ex=new Error('Octoshape plugin incorrectly configured.');this._logger.fatal('Octoshape error',ex);throw ex;}
return Im;};xmp.SimpleUrlStrategy=function(){};xmp.SimpleUrlStrategy.prototype.getName=function(){return'Simple';};xmp.SimpleUrlStrategy.prototype.buildUrlAsynch=function(Jm,Km){Km.callAsynch([Jm,null]);};