/**
 * almond 0.2.5 Copyright (c) 2011-2012, The Dojo Foundation All Rights Reserved.
 * Available via the MIT or new BSD license.
 * see: http://github.com/jrburke/almond for details
 */

/*!
 * jQuery JavaScript Library v1.8.0
 * http://jquery.com/
 *
 * Includes Sizzle.js
 * http://sizzlejs.com/
 *
 * Copyright 2012 jQuery Foundation and other contributors
 * Released under the MIT license
 * http://jquery.org/license
 *
 * Date: Thu Aug 09 2012 16:24:48 GMT-0400 (Eastern Daylight Time)
 */

/*!
 * Sizzle CSS Selector Engine
 *  Copyright 2012 jQuery Foundation and other contributors
 *  Released under the MIT license
 *  http://sizzlejs.com/
 */

// > http://underscorejs.org
// > (c) 2009-2013 Jeremy Ashkenas, DocumentCloud Inc.
// > Underscore may be freely distributed under the MIT license.

//     (c) 2010-2012 Jeremy Ashkenas, DocumentCloud Inc.
//     Backbone may be freely distributed under the MIT license.
//     For all details and documentation:
//     http://backbonejs.org

/*
 Copyright 2011 Abdulla Abdurakhmanov
 Original sources are available at https://code.google.com/p/x2js/

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 */

/*!
 *
 * Copyright 2009-2012 Kris Kowal under the terms of the MIT
 * license found at http://github.com/kriskowal/q/raw/master/LICENSE
 *
 * With parts by Tyler Close
 * Copyright 2007-2009 Tyler Close under the terms of the MIT X license found
 * at http://www.opensource.org/licenses/mit-license.html
 * Forked at ref_send.js version: 2009-05-11
 *
 * With parts by Mark Miller
 * Copyright (C) 2011 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

// moment.js
// version : 2.0.0
// author : Tim Wood
// license : MIT
// momentjs.com

/*

Copyright (C) 2011 by Yehuda Katz

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

*/

/**
 * @license RequireJS text 2.0.5 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
 * Available via the MIT or new BSD license.
 * see: http://github.com/requirejs/text for details
 */

/** @license
 *
 * SoundManager 2: JavaScript Sound for the Web
 * ----------------------------------------------
 * http://schillmania.com/projects/soundmanager2/
 *
 * Copyright (c) 2007, Scott Schiller. All rights reserved.
 * Code provided under the BSD License:
 * http://schillmania.com/projects/soundmanager2/license.txt
 *
 * V2.97a.20120318
 */

/*
 ### jQuery XML to JSON Plugin v1.1 - 2008-07-01 ###
 * http://www.fyneworks.com/ - diego@fyneworks.com
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 ###
 Website: http://www.fyneworks.com/jquery/xml-to-json/
*/

/* ===================================================
 * bootstrap-transition.js v2.2.0
 * http://twitter.github.com/bootstrap/javascript.html#transitions
 * ===================================================
 * Copyright 2012 Twitter, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ========================================================== */

/* =========================================================
 * bootstrap-modal.js v2.0.4
 * http://twitter.github.com/bootstrap/javascript.html#modals
 * =========================================================
 * Copyright 2012 Twitter, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ========================================================= */

/**
 * Copyright (c) 2011 Felix Gnass [fgnass at neteye dot de]
 * Licensed under the MIT license
 */

/* ============================================================
 * bootstrap-button.js v2.0.4
 * http://twitter.github.com/bootstrap/javascript.html#buttons
 * ============================================================
 * Copyright 2012 Twitter, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ============================================================ */

/* ============================================================
 * bootstrap-dropdown.js v2.0.4
 * http://twitter.github.com/bootstrap/javascript.html#dropdowns
 * ============================================================
 * Copyright 2012 Twitter, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ============================================================ */

/* ===========================================================
 * bootstrap-tooltip.js v2.0.4
 * http://twitter.github.com/bootstrap/javascript.html#tooltips
 * Inspired by the original jQuery.tipsy by Jason Frame
 * ===========================================================
 * Copyright 2012 Twitter, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ========================================================== */

/**
 * Copyright 2013 Craig Campbell
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Mousetrap is a simple keyboard shortcut library for Javascript with
 * no external dependencies
 *
 * @version 1.3.2
 * @url craig.is/killing/mice
 */

/*
 *  jssha256 version 0.1  -  Copyright 2006 B. Poettering
 *
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU General Public License as
 *  published by the Free Software Foundation; either version 2 of the
 *  License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 *  02111-1307 USA
 */

/*
 * HTML5 Sortable jQuery Plugin
 * http://farhadi.ir/projects/html5sortable
 * 
 * Copyright 2012, Ali Farhadi
 * Released under the MIT license.
 */

/*
Copyright 2012 Igor Vaynberg

Version: @@ver@@ Timestamp: @@timestamp@@

This software is licensed under the Apache License, Version 2.0 (the "Apache License") or the GNU
General Public License version 2 (the "GPL License"). You may choose either license to govern your
use of this software only upon the condition that you accept all of the terms of either the Apache
License or the GPL License.

You may obtain a copy of the Apache License and the GPL License at:

    http://www.apache.org/licenses/LICENSE-2.0
    http://www.gnu.org/licenses/gpl-2.0.html

Unless required by applicable law or agreed to in writing, software distributed under the
Apache License or the GPL Licesnse is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the Apache License and the GPL License for
the specific language governing permissions and limitations under the Apache License and the GPL License.
*/

/*!	SWFObject v2.2 <http://code.google.com/p/swfobject/> 
	is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 
*/

/**
 * @preserve FastClick: polyfill to remove click delays on browsers with touch UIs.
 *
 * @version 0.4.6
 * @codingstandard ftlabs-jsv2
 * @copyright The Financial Times Limited [All Rights Reserved]
 * @license MIT License (see LICENSE.txt)
 */

function X2JS(e,t,i){function n(e){var t=e.localName;return null==t&&(t=e.baseName),(null==t||""==t)&&(t=e.nodeName),t}function a(e){return e.prefix}function s(e){return"string"==typeof e?e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/\//g,"&#x2F;"):e}function r(e){return e.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#x27;/g,"'").replace(/&#x2F;/g,"/")}function l(s){if(s.nodeType==w.DOCUMENT_NODE){var o,c,d,h=s.firstChild;
for(c=0,d=s.childNodes.length;d>c;c+=1)if(s.childNodes[c].nodeType!==w.COMMENT_NODE){h=s.childNodes[c];break}if(i)o=l(h);else{o={};var u=n(h);o[u]=l(h)}return o}if(s.nodeType==w.ELEMENT_NODE){var o={};o.__cnt=0;for(var p=s.childNodes,f=0;p.length>f;f++){var h=p.item(f),u=n(h);if(o.__cnt++,null==o[u])o[u]=l(h),o[u+"_asArray"]=Array(1),o[u+"_asArray"][0]=o[u];else{if(null!=o[u]&&!(o[u]instanceof Array)){var m=o[u];o[u]=[],o[u][0]=m,o[u+"_asArray"]=o[u]}for(var g=0;null!=o[u][g];)g++;o[u][g]=l(h)}}for(var v=0;s.attributes.length>v;v++){var y=s.attributes.item(v);
o.__cnt++;for(var x=y.value,k=0,S=e.length;S>k;k++){var C=e[k];C.test.call(this,y.value)&&(x=C.converter.call(this,y.value))}o[t+y.name]=x}var _=a(s);return null!=_&&""!=_&&(o.__cnt++,o.__prefix=_),1==o.__cnt&&null!=o["#text"]&&(o=o["#text"]),null!=o["#text"]&&(o.__text=o["#text"],b&&(o.__text=r(o.__text)),delete o["#text"],delete o["#text_asArray"]),null!=o["#cdata-section"]&&(o.__cdata=o["#cdata-section"],delete o["#cdata-section"],delete o["#cdata-section_asArray"]),(null!=o.__text||null!=o.__cdata)&&(o.toString=function(){return(null!=this.__text?this.__text:"")+(null!=this.__cdata?this.__cdata:"")
}),o}return s.nodeType==w.TEXT_NODE||s.nodeType==w.CDATA_SECTION_NODE?s.nodeValue:s.nodeType==w.COMMENT_NODE?null:void 0}function o(e,t,i,n){var a="<"+(null!=e&&null!=e.__prefix?e.__prefix+":":"")+t;if(null!=i)for(var s=0;i.length>s;s++){var r=i[s],l=e[r];a+=" "+r.substr(1)+"='"+l+"'"}return a+=n?"/>":">"}function c(e,t){return"</"+(null!=e.__prefix?e.__prefix+":":"")+t+">"}function d(e,t){return-1!==e.indexOf(t,e.length-t.length)}function h(e,t){return d(""+t,"_asArray")||0==(""+t).indexOf("_")||e[t]instanceof Function?!0:!1
}function u(e){var t=0;if(e instanceof Object)for(var i in e)h(e,i)||t++;return t}function p(e){var t=[];if(e instanceof Object)for(var i in e)-1==(""+i).indexOf("__")&&0==(""+i).indexOf("_")&&t.push(i);return t}function f(e){var t="";return null!=e.__cdata&&(t+="<![CDATA["+e.__cdata+"]]>"),null!=e.__text&&(t+=b?s(e.__text):e.__text),t}function m(e){var t="";return e instanceof Object?t+=f(e):null!=e&&(t+=b?s(e):e),t}function g(e,t,i){var n="";if(0==e.length)n+=o(e,t,i,!0);else for(var a=0;e.length>a;a++)n+=o(e[a],t,p(e[a]),!1),n+=v(e[a]),n+=c(e[a],t);
return n}function v(e){var t="",i=u(e);if(i>0)for(var n in e)if(!h(e,n)){var a=e[n],s=p(a);if(null==a||void 0==a)t+=o(a,n,s,!0);else if(a instanceof Object)if(a instanceof Array)t+=g(a,n,s);else{var r=u(a);r>0||null!=a.__text||null!=a.__cdata?(t+=o(a,n,s,!1),t+=v(a),t+=c(a,n)):t+=o(a,n,s,!0)}else t+=o(a,n,s,!1),t+=m(a),t+=c(a,n)}return t+=m(e)}(null===t||void 0===t)&&(t="_"),(null===i||void 0===i)&&(i=!1);var y="1.0.11",b=!1,w={ELEMENT_NODE:1,TEXT_NODE:3,CDATA_SECTION_NODE:4,COMMENT_NODE:8,DOCUMENT_NODE:9};
this.parseXmlString=function(e){var t;if(window.DOMParser){var i=new window.DOMParser;t=i.parseFromString(e,"text/xml")}else 0==e.indexOf("<?")&&(e=e.substr(e.indexOf("?>")+2)),t=new ActiveXObject("Microsoft.XMLDOM"),t.async="false",t.loadXML(e);return t},this.xml2json=function(e){return l(e)},this.xml_str2json=function(e){var t=this.parseXmlString(e);return this.xml2json(t)},this.json2xml_str=function(e){return v(e)},this.json2xml=function(e){var t=this.json2xml_str(e);return this.parseXmlString(t)
},this.getVersion=function(){return y},this.escapeMode=function(e){b=e}}function encode64(e){var t,i,n,a,s,r="",l="",o="",c=0;do t=e.charCodeAt(c++),i=e.charCodeAt(c++),l=e.charCodeAt(c++),n=t>>2,a=(3&t)<<4|i>>4,s=(15&i)<<2|l>>6,o=63&l,isNaN(i)?s=o=64:isNaN(l)&&(o=64),r=r+b64array.charAt(n)+b64array.charAt(a)+b64array.charAt(s)+b64array.charAt(o),t=i=l="",n=a=s=o="";while(e.length>c);return r}function decode64(e){var t,i,n,a,s,r="",l="",o="",c=0,d=/[^A-Za-z0-9\+\/\=]/g;d.exec(e)&&alert("There were invalid base64 characters in the input text.\nValid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='\nExpect errors in decoding."),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");
do n=b64array.indexOf(e.charAt(c++)),a=b64array.indexOf(e.charAt(c++)),s=b64array.indexOf(e.charAt(c++)),o=b64array.indexOf(e.charAt(c++)),t=n<<2|a>>4,i=(15&a)<<4|s>>2,l=(3&s)<<6|o,r+=String.fromCharCode(t),64!=s&&(r+=String.fromCharCode(i)),64!=o&&(r+=String.fromCharCode(l)),t=i=l="",n=a=s=o="";while(e.length>c);return unescape(r)}function string_to_array(e){for(var t=e.length,i=Array(t),n=0;t>n;n++)i[n]=e.charCodeAt(n);return i}function array_to_hex_string(e){for(var t="",i=0;e.length>i;i++)t+=SHA256_hexchars[e[i]>>4]+SHA256_hexchars[15&e[i]];
return t}function array_to_string(e){for(var t="",i=0;e.length>i;i++)t+=String.fromCharCode(e[i]);return t}function SHA256_init(){SHA256_H=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],SHA256_buf=[],SHA256_len=0}function SHA256_write(e){SHA256_buf="string"==typeof e?SHA256_buf.concat(string_to_array(e)):SHA256_buf.concat(e);for(var t=0;SHA256_buf.length>=t+64;t+=64)SHA256_Hash_Byte_Block(SHA256_H,SHA256_buf.slice(t,t+64));SHA256_buf=SHA256_buf.slice(t),SHA256_len+=e.length
}function SHA256_finalize(){if(SHA256_buf[SHA256_buf.length]=128,SHA256_buf.length>56){for(var e=SHA256_buf.length;64>e;e++)SHA256_buf[e]=0;SHA256_Hash_Byte_Block(SHA256_H,SHA256_buf),SHA256_buf.length=0}for(var e=SHA256_buf.length;59>e;e++)SHA256_buf[e]=0;SHA256_buf[59]=255&SHA256_len>>>29,SHA256_buf[60]=255&SHA256_len>>>21,SHA256_buf[61]=255&SHA256_len>>>13,SHA256_buf[62]=255&SHA256_len>>>5,SHA256_buf[63]=255&SHA256_len<<3,SHA256_Hash_Byte_Block(SHA256_H,SHA256_buf);for(var t=Array(32),e=0;8>e;e++)t[4*e+0]=SHA256_H[e]>>>24,t[4*e+1]=255&SHA256_H[e]>>16,t[4*e+2]=255&SHA256_H[e]>>8,t[4*e+3]=255&SHA256_H[e];
return delete SHA256_H,delete SHA256_buf,delete SHA256_len,t}function SHA256_hash(e){var t;return SHA256_init(),SHA256_write(e),t=SHA256_finalize(),array_to_hex_string(t)}function HMAC_SHA256_init(e){HMAC_SHA256_key="string"==typeof e?string_to_array(e):[].concat(e),HMAC_SHA256_key.length>64&&(SHA256_init(),SHA256_write(HMAC_SHA256_key),HMAC_SHA256_key=SHA256_finalize());for(var t=HMAC_SHA256_key.length;64>t;t++)HMAC_SHA256_key[t]=0;for(var t=0;64>t;t++)HMAC_SHA256_key[t]^=54;SHA256_init(),SHA256_write(HMAC_SHA256_key)
}function HMAC_SHA256_write(e){SHA256_write(e)}function HMAC_SHA256_finalize(){for(var e=SHA256_finalize(),t=0;64>t;t++)HMAC_SHA256_key[t]^=106;SHA256_init(),SHA256_write(HMAC_SHA256_key),SHA256_write(e);for(var t=0;64>t;t++)HMAC_SHA256_key[t]=0;return delete HMAC_SHA256_key,SHA256_finalize()}function HMAC_SHA256_MAC(e,t){var i;return HMAC_SHA256_init(e),HMAC_SHA256_write(t),i=HMAC_SHA256_finalize(),array_to_hex_string(i)}function SHA256_sigma0(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function SHA256_sigma1(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10
}function SHA256_Sigma0(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function SHA256_Sigma1(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function SHA256_Ch(e,t,i){return i^e&(t^i)}function SHA256_Maj(e,t,i){return e&t^i&(e^t)}function SHA256_Hash_Word_Block(e,t){for(var i=16;64>i;i++)t[i]=4294967295&SHA256_sigma1(t[i-2])+t[i-7]+SHA256_sigma0(t[i-15])+t[i-16];for(var n=[].concat(e),i=0;64>i;i++){var a=n[7]+SHA256_Sigma1(n[4])+SHA256_Ch(n[4],n[5],n[6])+SHA256_K[i]+t[i],s=SHA256_Sigma0(n[0])+SHA256_Maj(n[0],n[1],n[2]);
n.pop(),n.unshift(4294967295&a+s),n[4]=4294967295&n[4]+a}for(var i=0;8>i;i++)e[i]=4294967295&e[i]+n[i]}function SHA256_Hash_Byte_Block(e,t){for(var i=Array(16),n=0;16>n;n++)i[n]=t[4*n+0]<<24|t[4*n+1]<<16|t[4*n+2]<<8|t[4*n+3];SHA256_Hash_Word_Block(e,i)}function FastClick(e){var t,i=this;if(this.trackingClick=!1,this.trackingClickStart=0,this.targetElement=null,this.touchStartX=0,this.touchStartY=0,this.lastTouchIdentifier=0,this.layer=e,!e||!e.nodeType)throw new TypeError("Layer must be a document node");
this.onClick=function(){FastClick.prototype.onClick.apply(i,arguments)},this.onTouchStart=function(){FastClick.prototype.onTouchStart.apply(i,arguments)},this.onTouchMove=function(){FastClick.prototype.onTouchMove.apply(i,arguments)},this.onTouchEnd=function(){FastClick.prototype.onTouchEnd.apply(i,arguments)},this.onTouchCancel=function(){FastClick.prototype.onTouchCancel.apply(i,arguments)},void 0!==window.ontouchstart&&(e.addEventListener("click",this.onClick,!0),e.addEventListener("touchstart",this.onTouchStart,!1),e.addEventListener("touchmove",this.onTouchMove,!1),e.addEventListener("touchend",this.onTouchEnd,!1),e.addEventListener("touchcancel",this.onTouchCancel,!1),Event.prototype.stopImmediatePropagation||(e.removeEventListener=function(t,i,n){var a=Node.prototype.removeEventListener;
"click"===t?a.call(e,t,i.hijacked||i,n):a.call(e,t,i,n)},e.addEventListener=function(t,i,n){var a=Node.prototype.addEventListener;"click"===t?a.call(e,t,i.hijacked||(i.hijacked=function(e){e.propagationStopped||i(e)}),n):a.call(e,t,i,n)}),"function"==typeof e.onclick&&(t=e.onclick,e.addEventListener("click",function(e){t(e)},!1),e.onclick=null))}var requirejs,require,define;(function(e){function t(e,t){return v.call(e,t)}function i(e,t){var i,n,a,s,r,l,o,c,d,h,u=t&&t.split("/"),p=m.map,f=p&&p["*"]||{};
if(e&&"."===e.charAt(0))if(t){for(u=u.slice(0,u.length-1),e=u.concat(e.split("/")),c=0;e.length>c;c+=1)if(h=e[c],"."===h)e.splice(c,1),c-=1;else if(".."===h){if(1===c&&(".."===e[2]||".."===e[0]))break;c>0&&(e.splice(c-1,2),c-=2)}e=e.join("/")}else 0===e.indexOf("./")&&(e=e.substring(2));if((u||f)&&p){for(i=e.split("/"),c=i.length;c>0;c-=1){if(n=i.slice(0,c).join("/"),u)for(d=u.length;d>0;d-=1)if(a=p[u.slice(0,d).join("/")],a&&(a=a[n])){s=a,r=c;break}if(s)break;!l&&f&&f[n]&&(l=f[n],o=c)}!s&&l&&(s=l,r=o),s&&(i.splice(0,r,s),e=i.join("/"))
}return e}function n(t,i){return function(){return d.apply(e,y.call(arguments,0).concat([t,i]))}}function a(e){return function(t){return i(t,e)}}function s(e){return function(t){p[e]=t}}function r(i){if(t(f,i)){var n=f[i];delete f[i],g[i]=!0,c.apply(e,n)}if(!t(p,i)&&!t(g,i))throw Error("No "+i);return p[i]}function l(e){var t,i=e?e.indexOf("!"):-1;return i>-1&&(t=e.substring(0,i),e=e.substring(i+1,e.length)),[t,e]}function o(e){return function(){return m&&m.config&&m.config[e]||{}}}var c,d,h,u,p={},f={},m={},g={},v=Object.prototype.hasOwnProperty,y=[].slice;
h=function(e,t){var n,s=l(e),o=s[0];return e=s[1],o&&(o=i(o,t),n=r(o)),o?e=n&&n.normalize?n.normalize(e,a(t)):i(e,t):(e=i(e,t),s=l(e),o=s[0],e=s[1],o&&(n=r(o))),{f:o?o+"!"+e:e,n:e,pr:o,p:n}},u={require:function(e){return n(e)},exports:function(e){var t=p[e];return t!==void 0?t:p[e]={}},module:function(e){return{id:e,uri:"",exports:p[e],config:o(e)}}},c=function(i,a,l,o){var c,d,m,v,y,b,w=[];if(o=o||i,"function"==typeof l){for(a=!a.length&&l.length?["require","exports","module"]:a,y=0;a.length>y;y+=1)if(v=h(a[y],o),d=v.f,"require"===d)w[y]=u.require(i);
else if("exports"===d)w[y]=u.exports(i),b=!0;else if("module"===d)c=w[y]=u.module(i);else if(t(p,d)||t(f,d)||t(g,d))w[y]=r(d);else{if(!v.p)throw Error(i+" missing "+d);v.p.load(v.n,n(o,!0),s(d),{}),w[y]=p[d]}m=l.apply(p[i],w),i&&(c&&c.exports!==e&&c.exports!==p[i]?p[i]=c.exports:m===e&&b||(p[i]=m))}else i&&(p[i]=l)},requirejs=require=d=function(t,i,n,a,s){return"string"==typeof t?u[t]?u[t](i):r(h(t,i).f):(t.splice||(m=t,i.splice?(t=i,i=n,n=null):t=e),i=i||function(){},"function"==typeof n&&(n=a,a=s),a?c(e,t,i,n):setTimeout(function(){c(e,t,i,n)
},4),d)},d.config=function(e){return m=e,m.deps&&d(m.deps,m.callback),d},define=function(e,i,n){i.splice||(n=i,i=[]),t(p,e)||t(f,e)||(f[e]=[e,i,n])},define.amd={jQuery:!0}})(),define("libs/require/almond-0.2.5",function(){}),require.config({baseUrl:"js",templatePathPrefix:"app/",paths:{text:"libs/require/text-2.0.5",hb:"libs/require/hb-precompile",templates:"../templates",jquery:"libs/jquery/jquery-1.8.0",xml2json:"libs/jquery/jquery.xml2json",sortable:"libs/jquery/jquery.sortable",select2:"libs/select2-3.2",underscore:"libs/underscore-1.4.4",backbone:"libs/backbone-0.9.2",handlebars:"libs/handlebars-1.0.0",modernizr:"libs/modernizr-2.6.2-css3dtransform",moment:"libs/moment-2.0.0",base64:"libs/base64",sha256:"libs/jssha256-0.1",soundmanagerdefer:"libs/soundmanager/soundmanager2-defer",soundmanager:"libs/soundmanager/soundmanager2-nodebug",jwplayer:"libs/jwplayer-6.5",swfobject:"libs/swfobject-2.2",spincore:"libs/spin-1.2.5",spin:"libs/jquery/jquery.spin",fastclick:"libs/fastclick-0.4.6",mousetrap:"libs/mousetrap-1.3.2",dash:"libs/dash/dash",dijon:"libs/dash/dijon",objectiron:"libs/dash/objectiron",q:"libs/dash/q",x2js:"libs/dash/x2js-1.0.11",transition:"libs/bootstrap/bootstrap-transition",button:"libs/bootstrap/bootstrap-button",tooltip:"libs/bootstrap/bootstrap-tooltip",dropdown:"libs/bootstrap/bootstrap-dropdown",modal:"libs/bootstrap/bootstrap-modal"},shim:{underscore:[],backbone:["jquery","underscore"],handlebars:{exports:"Handlebars"},hb:["handlebars"],xml2json:["jquery"],sortable:["jquery"],select2:["jquery"],modernizr:[],moment:[],base64:[],sha256:[],soundmanagerdefer:[],soundmanager:["soundmanagerdefer"],jwplayer:[],swfobject:[],spincore:[],spin:["jquery","spincore"],dijon:[],objectiron:[],q:[],x2js:[],dash:["jquery","dijon","objectiron","q","x2js"],transition:["jquery"],button:["jquery"],dropdown:["jquery"],modal:["jquery"],tooltip:["jquery"]}}),define("config",function(){}),function(e,t){function i(e){var t=ft[e]={};
return X.each(e.split(tt),function(e,i){t[i]=!0}),t}function n(e,i,n){if(n===t&&1===e.nodeType){var a="data-"+i.replace(gt,"-$1").toLowerCase();if(n=e.getAttribute(a),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:mt.test(n)?X.parseJSON(n):n}catch(s){}X.data(e,i,n)}else n=t}return n}function a(e){var t;for(t in e)if(("data"!==t||!X.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function s(){return!1}function r(){return!0}function l(e){return!e||!e.parentNode||11===e.parentNode.nodeType
}function o(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}function c(e,t,i){if(t=t||0,X.isFunction(t))return X.grep(e,function(e,n){var a=!!t.call(e,n,e);return a===i});if(t.nodeType)return X.grep(e,function(e){return e===t===i});if("string"==typeof t){var n=X.grep(e,function(e){return 1===e.nodeType});if(Rt.test(t))return X.filter(t,n,!i);t=X.filter(t,n)}return X.grep(e,function(e){return X.inArray(e,t)>=0===i})}function d(e){var t=qt.split("|"),i=e.createDocumentFragment();if(i.createElement)for(;t.length;)i.createElement(t.pop());
return i}function h(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function u(e,t){if(1===t.nodeType&&X.hasData(e)){var i,n,a,s=X._data(e),r=X._data(t,s),l=s.events;if(l){delete r.handle,r.events={};for(i in l)for(n=0,a=l[i].length;a>n;n++)X.event.add(t,i,l[i][n])}r.data&&(r.data=X.extend({},r.data))}}function p(e,t){var i;1===t.nodeType&&(t.clearAttributes&&t.clearAttributes(),t.mergeAttributes&&t.mergeAttributes(e),i=t.nodeName.toLowerCase(),"object"===i?(t.parentNode&&(t.outerHTML=e.outerHTML),X.support.html5Clone&&e.innerHTML&&!X.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===i&&Kt.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===i?t.selected=e.defaultSelected:"input"===i||"textarea"===i?t.defaultValue=e.defaultValue:"script"===i&&t.text!==e.text&&(t.text=e.text),t.removeAttribute(X.expando))
}function f(e){return e.getElementsByTagName!==t?e.getElementsByTagName("*"):e.querySelectorAll!==t?e.querySelectorAll("*"):[]}function m(e){Kt.test(e.type)&&(e.defaultChecked=e.checked)}function g(e,t){if(t in e)return t;for(var i=t.charAt(0).toUpperCase()+t.slice(1),n=t,a=gi.length;a--;)if(t=gi[a]+i,t in e)return t;return n}function v(e,t){return e=t||e,"none"===X.css(e,"display")||!X.contains(e.ownerDocument,e)}function y(e,t){for(var i,n,a=[],s=0,r=e.length;r>s;s++)i=e[s],i.style&&(a[s]=X._data(i,"olddisplay"),t?(a[s]||"none"!==i.style.display||(i.style.display=""),""===i.style.display&&v(i)&&(a[s]=X._data(i,"olddisplay",k(i.nodeName)))):(n=ii(i,"display"),a[s]||"none"===n||X._data(i,"olddisplay",n)));
for(s=0;r>s;s++)i=e[s],i.style&&(t&&"none"!==i.style.display&&""!==i.style.display||(i.style.display=t?a[s]||"":"none"));return e}function b(e,t,i){var n=ci.exec(t);return n?Math.max(0,n[1]-(i||0))+(n[2]||"px"):t}function w(e,t,i,n){for(var a=i===(n?"border":"content")?4:"width"===t?1:0,s=0;4>a;a+=2)"margin"===i&&(s+=X.css(e,i+mi[a],!0)),n?("content"===i&&(s-=parseFloat(ii(e,"padding"+mi[a]))||0),"margin"!==i&&(s-=parseFloat(ii(e,"border"+mi[a]+"Width"))||0)):(s+=parseFloat(ii(e,"padding"+mi[a]))||0,"padding"!==i&&(s+=parseFloat(ii(e,"border"+mi[a]+"Width"))||0));
return s}function x(e,t,i){var n="width"===t?e.offsetWidth:e.offsetHeight,a=!0,s=X.support.boxSizing&&"border-box"===X.css(e,"boxSizing");if(0>=n){if(n=ii(e,t),(0>n||null==n)&&(n=e.style[t]),di.test(n))return n;a=s&&(X.support.boxSizingReliable||n===e.style[t]),n=parseFloat(n)||0}return n+w(e,t,i||(s?"border":"content"),a)+"px"}function k(e){if(ui[e])return ui[e];var t=X("<"+e+">").appendTo(j.body),i=t.css("display");return t.remove(),("none"===i||""===i)&&(ni=j.body.appendChild(ni||X.extend(j.createElement("iframe"),{frameBorder:0,width:0,height:0})),ai&&ni.createElement||(ai=(ni.contentWindow||ni.contentDocument).document,ai.write("<!doctype html><html><body>"),ai.close()),t=ai.body.appendChild(ai.createElement(e)),i=ii(t,"display"),j.body.removeChild(ni)),ui[e]=i,i
}function S(e,t,i,n){var a;if(X.isArray(t))X.each(t,function(t,a){i||bi.test(e)?n(e,a):S(e+"["+("object"==typeof a?t:"")+"]",a,i,n)});else if(i||"object"!==X.type(t))n(e,t);else for(a in t)S(e+"["+a+"]",t[a],i,n)}function C(e){return function(t,i){"string"!=typeof t&&(i=t,t="*");var n,a,s,r=t.toLowerCase().split(tt),l=0,o=r.length;if(X.isFunction(i))for(;o>l;l++)n=r[l],s=/^\+/.test(n),s&&(n=n.substr(1)||"*"),a=e[n]=e[n]||[],a[s?"unshift":"push"](i)}}function _(e,i,n,a,s,r){s=s||i.dataTypes[0],r=r||{},r[s]=!0;
for(var l,o=e[s],c=0,d=o?o.length:0,h=e===Oi;d>c&&(h||!l);c++)l=o[c](i,n,a),"string"==typeof l&&(!h||r[l]?l=t:(i.dataTypes.unshift(l),l=_(e,i,n,a,l,r)));return!h&&l||r["*"]||(l=_(e,i,n,a,"*",r)),l}function A(e,i){var n,a,s=X.ajaxSettings.flatOptions||{};for(n in i)i[n]!==t&&((s[n]?e:a||(a={}))[n]=i[n]);a&&X.extend(!0,e,a)}function I(e,i,n){var a,s,r,l,o=e.contents,c=e.dataTypes,d=e.responseFields;for(s in d)s in n&&(i[d[s]]=n[s]);for(;"*"===c[0];)c.shift(),a===t&&(a=e.mimeType||i.getResponseHeader("content-type"));
if(a)for(s in o)if(o[s]&&o[s].test(a)){c.unshift(s);break}if(c[0]in n)r=c[0];else{for(s in n){if(!c[0]||e.converters[s+" "+c[0]]){r=s;break}l||(l=s)}r=r||l}return r?(r!==c[0]&&c.unshift(r),n[r]):t}function T(e,t){var i,n,a,s,r=e.dataTypes.slice(),l=r[0],o={},c=0;if(e.dataFilter&&(t=e.dataFilter(t,e.dataType)),r[1])for(i in e.converters)o[i.toLowerCase()]=e.converters[i];for(;a=r[++c];)if("*"!==a){if("*"!==l&&l!==a){if(i=o[l+" "+a]||o["* "+a],!i)for(n in o)if(s=n.split(" "),s[1]===a&&(i=o[l+" "+s[0]]||o["* "+s[0]])){i===!0?i=o[n]:o[n]!==!0&&(a=s[0],r.splice(c--,0,a));
break}if(i!==!0)if(i&&e["throws"])t=i(t);else try{t=i(t)}catch(d){return{state:"parsererror",error:i?d:"No conversion from "+l+" to "+a}}}l=a}return{state:"success",data:t}}function M(){try{return new e.XMLHttpRequest}catch(t){}}function P(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}function D(){return setTimeout(function(){Wi=t},0),Wi=X.now()}function L(e,t){X.each(t,function(t,i){for(var n=(Xi[t]||[]).concat(Xi["*"]),a=0,s=n.length;s>a;a++)if(n[a].call(e,t,i))return})}function E(e,t,i){var n,a=0,s=Qi.length,r=X.Deferred().always(function(){delete l.elem
}),l=function(){for(var t=Wi||D(),i=Math.max(0,o.startTime+o.duration-t),n=1-(i/o.duration||0),a=0,s=o.tweens.length;s>a;a++)o.tweens[a].run(n);return r.notifyWith(e,[o,n,i]),1>n&&s?i:(r.resolveWith(e,[o]),!1)},o=r.promise({elem:e,props:X.extend({},t),opts:X.extend(!0,{specialEasing:{}},i),originalProperties:t,originalOptions:i,startTime:Wi||D(),duration:i.duration,tweens:[],createTween:function(t,i){var n=X.Tween(e,o.opts,t,i,o.opts.specialEasing[t]||o.opts.easing);return o.tweens.push(n),n},stop:function(t){for(var i=0,n=t?o.tweens.length:0;n>i;i++)o.tweens[i].run(1);
return t?r.resolveWith(e,[o,t]):r.rejectWith(e,[o,t]),this}}),c=o.props;for(N(c,o.opts.specialEasing);s>a;a++)if(n=Qi[a].call(o,e,c,o.opts))return n;return L(o,c),X.isFunction(o.opts.start)&&o.opts.start.call(e,o),X.fx.timer(X.extend(l,{anim:o,queue:o.opts.queue,elem:e})),o.progress(o.opts.progress).done(o.opts.done,o.opts.complete).fail(o.opts.fail).always(o.opts.always)}function N(e,t){var i,n,a,s,r;for(i in e)if(n=X.camelCase(i),a=t[n],s=e[i],X.isArray(s)&&(a=s[1],s=e[i]=s[0]),i!==n&&(e[n]=s,delete e[i]),r=X.cssHooks[n],r&&"expand"in r){s=r.expand(s),delete e[n];
for(i in s)i in e||(e[i]=s[i],t[i]=a)}else t[n]=a}function O(e,t,i){var n,a,s,r,l,o,c,d,h=this,u=e.style,p={},f=[],m=e.nodeType&&v(e);i.queue||(c=X._queueHooks(e,"fx"),null==c.unqueued&&(c.unqueued=0,d=c.empty.fire,c.empty.fire=function(){c.unqueued||d()}),c.unqueued++,h.always(function(){h.always(function(){c.unqueued--,X.queue(e,"fx").length||c.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(i.overflow=[u.overflow,u.overflowX,u.overflowY],"inline"===X.css(e,"display")&&"none"===X.css(e,"float")&&(X.support.inlineBlockNeedsLayout&&"inline"!==k(e.nodeName)?u.zoom=1:u.display="inline-block")),i.overflow&&(u.overflow="hidden",X.support.shrinkWrapBlocks||h.done(function(){u.overflow=i.overflow[0],u.overflowX=i.overflow[1],u.overflowY=i.overflow[2]
}));for(n in t)if(s=t[n],Ji.exec(s)){if(delete t[n],s===(m?"hide":"show"))continue;f.push(n)}if(r=f.length)for(l=X._data(e,"fxshow")||X._data(e,"fxshow",{}),m?X(e).show():h.done(function(){X(e).hide()}),h.done(function(){var t;X.removeData(e,"fxshow",!0);for(t in p)X.style(e,t,p[t])}),n=0;r>n;n++)a=f[n],o=h.createTween(a,m?l[a]:0),p[a]=l[a]||X.style(e,a),a in l||(l[a]=o.start,m&&(o.end=o.start,o.start="width"===a||"height"===a?1:0))}function R(e,t,i,n,a){return new R.prototype.init(e,t,i,n,a)}function B(e,t){for(var i,n={height:e},a=0;4>a;a+=2-t)i=mi[a],n["margin"+i]=n["padding"+i]=e;
return t&&(n.opacity=n.width=e),n}function $(e){return X.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}var q,V,j=e.document,F=e.location,U=e.navigator,H=e.jQuery,z=e.$,W=Array.prototype.push,Y=Array.prototype.slice,J=Array.prototype.indexOf,K=Object.prototype.toString,G=Object.prototype.hasOwnProperty,Q=String.prototype.trim,X=function(e,t){return new X.fn.init(e,t,q)},Z=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,et=/\S/,tt=/\s+/,it=et.test(" ")?/^[\s\xA0]+|[\s\xA0]+$/g:/^\s+|\s+$/g,nt=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,at=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,st=/^[\],:{}\s]*$/,rt=/(?:^|:|,)(?:\s*\[)+/g,lt=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,ot=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,ct=/^-ms-/,dt=/-([\da-z])/gi,ht=function(e,t){return(t+"").toUpperCase()
},ut=function(){j.addEventListener?(j.removeEventListener("DOMContentLoaded",ut,!1),X.ready()):"complete"===j.readyState&&(j.detachEvent("onreadystatechange",ut),X.ready())},pt={};X.fn=X.prototype={constructor:X,init:function(e,i,n){var a,s,r;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if("string"==typeof e){if(a="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:nt.exec(e),!a||!a[1]&&i)return!i||i.jquery?(i||n).find(e):this.constructor(i).find(e);
if(a[1])return i=i instanceof X?i[0]:i,r=i&&i.nodeType?i.ownerDocument||i:j,e=X.parseHTML(a[1],r,!0),at.test(a[1])&&X.isPlainObject(i)&&this.attr.call(e,i,!0),X.merge(this,e);if(s=j.getElementById(a[2]),s&&s.parentNode){if(s.id!==a[2])return n.find(e);this.length=1,this[0]=s}return this.context=j,this.selector=e,this}return X.isFunction(e)?n.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),X.makeArray(e,this))},selector:"",jquery:"1.8.0",length:0,size:function(){return this.length
},toArray:function(){return Y.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e,t,i){var n=X.merge(this.constructor(),e);return n.prevObject=this,n.context=this.context,"find"===t?n.selector=this.selector+(this.selector?" ":"")+i:t&&(n.selector=this.selector+"."+t+"("+i+")"),n},each:function(e,t){return X.each(this,e,t)},ready:function(e){return X.ready.promise().done(e),this},eq:function(e){return e=+e,-1===e?this.slice(e):this.slice(e,e+1)
},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(Y.apply(this,arguments),"slice",Y.call(arguments).join(","))},map:function(e){return this.pushStack(X.map(this,function(t,i){return e.call(t,i,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:W,sort:[].sort,splice:[].splice},X.fn.init.prototype=X.fn,X.extend=X.fn.extend=function(){var e,i,n,a,s,r,l=arguments[0]||{},o=1,c=arguments.length,d=!1;for("boolean"==typeof l&&(d=l,l=arguments[1]||{},o=2),"object"==typeof l||X.isFunction(l)||(l={}),c===o&&(l=this,--o);c>o;o++)if(null!=(e=arguments[o]))for(i in e)n=l[i],a=e[i],l!==a&&(d&&a&&(X.isPlainObject(a)||(s=X.isArray(a)))?(s?(s=!1,r=n&&X.isArray(n)?n:[]):r=n&&X.isPlainObject(n)?n:{},l[i]=X.extend(d,r,a)):a!==t&&(l[i]=a));
return l},X.extend({noConflict:function(t){return e.$===X&&(e.$=z),t&&e.jQuery===X&&(e.jQuery=H),X},isReady:!1,readyWait:1,holdReady:function(e){e?X.readyWait++:X.ready(!0)},ready:function(e){if(e===!0?!--X.readyWait:!X.isReady){if(!j.body)return setTimeout(X.ready,1);X.isReady=!0,e!==!0&&--X.readyWait>0||(V.resolveWith(j,[X]),X.fn.trigger&&X(j).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===X.type(e)},isArray:Array.isArray||function(e){return"array"===X.type(e)},isWindow:function(e){return null!=e&&e==e.window
},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":pt[K.call(e)]||"object"},isPlainObject:function(e){if(!e||"object"!==X.type(e)||e.nodeType||X.isWindow(e))return!1;try{if(e.constructor&&!G.call(e,"constructor")&&!G.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(i){return!1}var n;for(n in e);return n===t||G.call(e,n)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,i){var n;
return e&&"string"==typeof e?("boolean"==typeof t&&(i=t,t=0),t=t||j,(n=at.exec(e))?[t.createElement(n[1])]:(n=X.buildFragment([e],t,i?null:[]),X.merge([],(n.cacheable?X.clone(n.fragment):n.fragment).childNodes))):null},parseJSON:function(i){return i&&"string"==typeof i?(i=X.trim(i),e.JSON&&e.JSON.parse?e.JSON.parse(i):st.test(i.replace(lt,"@").replace(ot,"]").replace(rt,""))?Function("return "+i)():(X.error("Invalid JSON: "+i),t)):null},parseXML:function(i){var n,a;if(!i||"string"!=typeof i)return null;
try{e.DOMParser?(a=new DOMParser,n=a.parseFromString(i,"text/xml")):(n=new ActiveXObject("Microsoft.XMLDOM"),n.async="false",n.loadXML(i))}catch(s){n=t}return n&&n.documentElement&&!n.getElementsByTagName("parsererror").length||X.error("Invalid XML: "+i),n},noop:function(){},globalEval:function(t){t&&et.test(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(ct,"ms-").replace(dt,ht)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toUpperCase()===t.toUpperCase()
},each:function(e,i,n){var a,s=0,r=e.length,l=r===t||X.isFunction(e);if(n)if(l){for(a in e)if(i.apply(e[a],n)===!1)break}else for(;r>s&&i.apply(e[s++],n)!==!1;);else if(l){for(a in e)if(i.call(e[a],a,e[a])===!1)break}else for(;r>s&&i.call(e[s],s,e[s++])!==!1;);return e},trim:Q?function(e){return null==e?"":Q.call(e)}:function(e){return null==e?"":(""+e).replace(it,"")},makeArray:function(e,t){var i,n=t||[];return null!=e&&(i=X.type(e),null==e.length||"string"===i||"function"===i||"regexp"===i||X.isWindow(e)?W.call(n,e):X.merge(n,e)),n
},inArray:function(e,t,i){var n;if(t){if(J)return J.call(t,e,i);for(n=t.length,i=i?0>i?Math.max(0,n+i):i:0;n>i;i++)if(i in t&&t[i]===e)return i}return-1},merge:function(e,i){var n=i.length,a=e.length,s=0;if("number"==typeof n)for(;n>s;s++)e[a++]=i[s];else for(;i[s]!==t;)e[a++]=i[s++];return e.length=a,e},grep:function(e,t,i){var n,a=[],s=0,r=e.length;for(i=!!i;r>s;s++)n=!!t(e[s],s),i!==n&&a.push(e[s]);return a},map:function(e,i,n){var a,s,r=[],l=0,o=e.length,c=e instanceof X||o!==t&&"number"==typeof o&&(o>0&&e[0]&&e[o-1]||0===o||X.isArray(e));
if(c)for(;o>l;l++)a=i(e[l],l,n),null!=a&&(r[r.length]=a);else for(s in e)a=i(e[s],s,n),null!=a&&(r[r.length]=a);return r.concat.apply([],r)},guid:1,proxy:function(e,i){var n,a,s;return"string"==typeof i&&(n=e[i],i=e,e=n),X.isFunction(e)?(a=Y.call(arguments,2),s=function(){return e.apply(i,a.concat(Y.call(arguments)))},s.guid=e.guid=e.guid||s.guid||X.guid++,s):t},access:function(e,i,n,a,s,r,l){var o,c=null==n,d=0,h=e.length;if(n&&"object"==typeof n){for(d in n)X.access(e,i,d,n[d],1,r,a);s=1}else if(a!==t){if(o=l===t&&X.isFunction(a),c&&(o?(o=i,i=function(e,t,i){return o.call(X(e),i)
}):(i.call(e,a),i=null)),i)for(;h>d;d++)i(e[d],n,o?a.call(e[d],d,i(e[d],n)):a,l);s=1}return s?e:c?i.call(e):h?i(e[0],n):r},now:function(){return(new Date).getTime()}}),X.ready.promise=function(t){if(!V)if(V=X.Deferred(),"complete"===j.readyState||"loading"!==j.readyState&&j.addEventListener)setTimeout(X.ready,1);else if(j.addEventListener)j.addEventListener("DOMContentLoaded",ut,!1),e.addEventListener("load",X.ready,!1);else{j.attachEvent("onreadystatechange",ut),e.attachEvent("onload",X.ready);var i=!1;
try{i=null==e.frameElement&&j.documentElement}catch(n){}i&&i.doScroll&&function a(){if(!X.isReady){try{i.doScroll("left")}catch(e){return setTimeout(a,50)}X.ready()}}()}return V.promise(t)},X.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(e,t){pt["[object "+t+"]"]=t.toLowerCase()}),q=X(j);var ft={};X.Callbacks=function(e){e="string"==typeof e?ft[e]||i(e):X.extend({},e);var n,a,s,r,l,o,c=[],d=!e.once&&[],h=function(t){for(n=e.memory&&t,a=!0,o=r||0,r=0,l=c.length,s=!0;c&&l>o;o++)if(c[o].apply(t[0],t[1])===!1&&e.stopOnFalse){n=!1;
break}s=!1,c&&(d?d.length&&h(d.shift()):n?c=[]:u.disable())},u={add:function(){if(c){var t=c.length;(function i(t){X.each(t,function(t,n){!X.isFunction(n)||e.unique&&u.has(n)?n&&n.length&&i(n):c.push(n)})})(arguments),s?l=c.length:n&&(r=t,h(n))}return this},remove:function(){return c&&X.each(arguments,function(e,t){for(var i;(i=X.inArray(t,c,i))>-1;)c.splice(i,1),s&&(l>=i&&l--,o>=i&&o--)}),this},has:function(e){return X.inArray(e,c)>-1},empty:function(){return c=[],this},disable:function(){return c=d=n=t,this
},disabled:function(){return!c},lock:function(){return d=t,n||u.disable(),this},locked:function(){return!d},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],!c||a&&!d||(s?d.push(t):h(t)),this},fire:function(){return u.fireWith(this,arguments),this},fired:function(){return!!a}};return u},X.extend({Deferred:function(e){var t=[["resolve","done",X.Callbacks("once memory"),"resolved"],["reject","fail",X.Callbacks("once memory"),"rejected"],["notify","progress",X.Callbacks("memory")]],i="pending",n={state:function(){return i
},always:function(){return a.done(arguments).fail(arguments),this},then:function(){var e=arguments;return X.Deferred(function(i){X.each(t,function(t,n){var s=n[0],r=e[t];a[n[1]](X.isFunction(r)?function(){var e=r.apply(this,arguments);e&&X.isFunction(e.promise)?e.promise().done(i.resolve).fail(i.reject).progress(i.notify):i[s+"With"](this===a?i:this,[e])}:i[s])}),e=null}).promise()},promise:function(e){return"object"==typeof e?X.extend(e,n):n}},a={};return n.pipe=n.then,X.each(t,function(e,s){var r=s[2],l=s[3];
n[s[1]]=r.add,l&&r.add(function(){i=l},t[1^e][2].disable,t[2][2].lock),a[s[0]]=r.fire,a[s[0]+"With"]=r.fireWith}),n.promise(a),e&&e.call(a,a),a},when:function(e){var t,i,n,a=0,s=Y.call(arguments),r=s.length,l=1!==r||e&&X.isFunction(e.promise)?r:0,o=1===l?e:X.Deferred(),c=function(e,i,n){return function(a){i[e]=this,n[e]=arguments.length>1?Y.call(arguments):a,n===t?o.notifyWith(i,n):--l||o.resolveWith(i,n)}};if(r>1)for(t=Array(r),i=Array(r),n=Array(r);r>a;a++)s[a]&&X.isFunction(s[a].promise)?s[a].promise().done(c(a,n,s)).fail(o.reject).progress(c(a,i,t)):--l;
return l||o.resolveWith(n,s),o.promise()}}),X.support=function(){var i,n,a,s,r,l,o,c,d,h,u,p=j.createElement("div");if(p.setAttribute("className","t"),p.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=p.getElementsByTagName("*"),a=p.getElementsByTagName("a")[0],a.style.cssText="top:1px;float:left;opacity:.5",!n||!n.length||!a)return{};s=j.createElement("select"),r=s.appendChild(j.createElement("option")),l=p.getElementsByTagName("input")[0],i={leadingWhitespace:3===p.firstChild.nodeType,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(a.getAttribute("style")),hrefNormalized:"/a"===a.getAttribute("href"),opacity:/^0.5/.test(a.style.opacity),cssFloat:!!a.style.cssFloat,checkOn:"on"===l.value,optSelected:r.selected,getSetAttribute:"t"!==p.className,enctype:!!j.createElement("form").enctype,html5Clone:"<:nav></:nav>"!==j.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===j.compatMode,submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},l.checked=!0,i.noCloneChecked=l.cloneNode(!0).checked,s.disabled=!0,i.optDisabled=!r.disabled;
try{delete p.test}catch(f){i.deleteExpando=!1}if(!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",u=function(){i.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick"),p.detachEvent("onclick",u)),l=j.createElement("input"),l.value="t",l.setAttribute("type","radio"),i.radioValue="t"===l.value,l.setAttribute("checked","checked"),l.setAttribute("name","t"),p.appendChild(l),o=j.createDocumentFragment(),o.appendChild(p.lastChild),i.checkClone=o.cloneNode(!0).cloneNode(!0).lastChild.checked,i.appendChecked=l.checked,o.removeChild(l),o.appendChild(p),p.attachEvent)for(d in{submit:!0,change:!0,focusin:!0})c="on"+d,h=c in p,h||(p.setAttribute(c,"return;"),h="function"==typeof p[c]),i[d+"Bubbles"]=h;
return X(function(){var n,a,s,r,l="padding:0;margin:0;border:0;display:block;overflow:hidden;",o=j.getElementsByTagName("body")[0];o&&(n=j.createElement("div"),n.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",o.insertBefore(n,o.firstChild),a=j.createElement("div"),n.appendChild(a),a.innerHTML="<table><tr><td></td><td>t</td></tr></table>",s=a.getElementsByTagName("td"),s[0].style.cssText="padding:0;margin:0;border:0;display:none",h=0===s[0].offsetHeight,s[0].style.display="",s[1].style.display="none",i.reliableHiddenOffsets=h&&0===s[0].offsetHeight,a.innerHTML="",a.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",i.boxSizing=4===a.offsetWidth,i.doesNotIncludeMarginInBodyOffset=1!==o.offsetTop,e.getComputedStyle&&(i.pixelPosition="1%"!==(e.getComputedStyle(a,null)||{}).top,i.boxSizingReliable="4px"===(e.getComputedStyle(a,null)||{width:"4px"}).width,r=j.createElement("div"),r.style.cssText=a.style.cssText=l,r.style.marginRight=r.style.width="0",a.style.width="1px",a.appendChild(r),i.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),a.style.zoom!==t&&(a.innerHTML="",a.style.cssText=l+"width:1px;padding:1px;display:inline;zoom:1",i.inlineBlockNeedsLayout=3===a.offsetWidth,a.style.display="block",a.style.overflow="visible",a.innerHTML="<div></div>",a.firstChild.style.width="5px",i.shrinkWrapBlocks=3!==a.offsetWidth,n.style.zoom=1),o.removeChild(n),n=a=s=r=null)
}),o.removeChild(p),n=a=s=r=l=o=p=null,i}();var mt=/^(?:\{.*\}|\[.*\])$/,gt=/([A-Z])/g;X.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(X.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?X.cache[e[X.expando]]:e[X.expando],!!e&&!a(e)},data:function(e,i,n,a){if(X.acceptData(e)){var s,r,l=X.expando,o="string"==typeof i,c=e.nodeType,d=c?X.cache:e,h=c?e[l]:e[l]&&l;if(h&&d[h]&&(a||d[h].data)||!o||n!==t)return h||(c?e[l]=h=X.deletedIds.pop()||++X.uuid:h=l),d[h]||(d[h]={},c||(d[h].toJSON=X.noop)),("object"==typeof i||"function"==typeof i)&&(a?d[h]=X.extend(d[h],i):d[h].data=X.extend(d[h].data,i)),s=d[h],a||(s.data||(s.data={}),s=s.data),n!==t&&(s[X.camelCase(i)]=n),o?(r=s[i],null==r&&(r=s[X.camelCase(i)])):r=s,r
}},removeData:function(e,t,i){if(X.acceptData(e)){var n,s,r,l=e.nodeType,o=l?X.cache:e,c=l?e[X.expando]:X.expando;if(o[c]){if(t&&(n=i?o[c]:o[c].data)){X.isArray(t)||(t in n?t=[t]:(t=X.camelCase(t),t=t in n?[t]:t.split(" ")));for(s=0,r=t.length;r>s;s++)delete n[t[s]];if(!(i?a:X.isEmptyObject)(n))return}(i||(delete o[c].data,a(o[c])))&&(l?X.cleanData([e],!0):X.support.deleteExpando||o!=o.window?delete o[c]:o[c]=null)}}},_data:function(e,t,i){return X.data(e,t,i,!0)},acceptData:function(e){var t=e.nodeName&&X.noData[e.nodeName.toLowerCase()];
return!t||t!==!0&&e.getAttribute("classid")===t}}),X.fn.extend({data:function(e,i){var a,s,r,l,o,c=this[0],d=0,h=null;if(e===t){if(this.length&&(h=X.data(c),1===c.nodeType&&!X._data(c,"parsedAttrs"))){for(r=c.attributes,o=r.length;o>d;d++)l=r[d].name,0===l.indexOf("data-")&&(l=X.camelCase(l.substring(5)),n(c,l,h[l]));X._data(c,"parsedAttrs",!0)}return h}return"object"==typeof e?this.each(function(){X.data(this,e)}):(a=e.split(".",2),a[1]=a[1]?"."+a[1]:"",s=a[1]+"!",X.access(this,function(i){return i===t?(h=this.triggerHandler("getData"+s,[a[0]]),h===t&&c&&(h=X.data(c,e),h=n(c,e,h)),h===t&&a[1]?this.data(a[0]):h):(a[1]=i,this.each(function(){var t=X(this);
t.triggerHandler("setData"+s,a),X.data(this,e,i),t.triggerHandler("changeData"+s,a)}),t)},null,i,arguments.length>1,null,!1))},removeData:function(e){return this.each(function(){X.removeData(this,e)})}}),X.extend({queue:function(e,i,n){var a;return e?(i=(i||"fx")+"queue",a=X._data(e,i),n&&(!a||X.isArray(n)?a=X._data(e,i,X.makeArray(n)):a.push(n)),a||[]):t},dequeue:function(e,t){t=t||"fx";var i=X.queue(e,t),n=i.shift(),a=X._queueHooks(e,t),s=function(){X.dequeue(e,t)};"inprogress"===n&&(n=i.shift()),n&&("fx"===t&&i.unshift("inprogress"),delete a.stop,n.call(e,s,a)),!i.length&&a&&a.empty.fire()
},_queueHooks:function(e,t){var i=t+"queueHooks";return X._data(e,i)||X._data(e,i,{empty:X.Callbacks("once memory").add(function(){X.removeData(e,t+"queue",!0),X.removeData(e,i,!0)})})}}),X.fn.extend({queue:function(e,i){var n=2;return"string"!=typeof e&&(i=e,e="fx",n--),n>arguments.length?X.queue(this[0],e):i===t?this:this.each(function(){var t=X.queue(this,e,i);X._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&X.dequeue(this,e)})},dequeue:function(e){return this.each(function(){X.dequeue(this,e)
})},delay:function(e,t){return e=X.fx?X.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,i){var n=setTimeout(t,e);i.stop=function(){clearTimeout(n)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,i){var n,a=1,s=X.Deferred(),r=this,l=this.length,o=function(){--a||s.resolveWith(r,[r])};for("string"!=typeof e&&(i=e,e=t),e=e||"fx";l--;)(n=X._data(r[l],e+"queueHooks"))&&n.empty&&(a++,n.empty.add(o));return o(),s.promise(i)}});var vt,yt,bt,wt=/[\t\r\n]/g,xt=/\r/g,kt=/^(?:button|input)$/i,St=/^(?:button|input|object|select|textarea)$/i,Ct=/^a(?:rea|)$/i,_t=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,At=X.support.getSetAttribute;
X.fn.extend({attr:function(e,t){return X.access(this,X.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){X.removeAttr(this,e)})},prop:function(e,t){return X.access(this,X.prop,e,t,arguments.length>1)},removeProp:function(e){return e=X.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(i){}})},addClass:function(e){var t,i,n,a,s,r,l;if(X.isFunction(e))return this.each(function(t){X(this).addClass(e.call(this,t,this.className))});if(e&&"string"==typeof e)for(t=e.split(tt),i=0,n=this.length;n>i;i++)if(a=this[i],1===a.nodeType)if(a.className||1!==t.length){for(s=" "+a.className+" ",r=0,l=t.length;l>r;r++)~s.indexOf(" "+t[r]+" ")||(s+=t[r]+" ");
a.className=X.trim(s)}else a.className=e;return this},removeClass:function(e){var i,n,a,s,r,l,o;if(X.isFunction(e))return this.each(function(t){X(this).removeClass(e.call(this,t,this.className))});if(e&&"string"==typeof e||e===t)for(i=(e||"").split(tt),l=0,o=this.length;o>l;l++)if(a=this[l],1===a.nodeType&&a.className){for(n=(" "+a.className+" ").replace(wt," "),s=0,r=i.length;r>s;s++)for(;n.indexOf(" "+i[s]+" ")>-1;)n=n.replace(" "+i[s]+" "," ");a.className=e?X.trim(n):""}return this},toggleClass:function(e,t){var i=typeof e,n="boolean"==typeof t;
return X.isFunction(e)?this.each(function(i){X(this).toggleClass(e.call(this,i,this.className,t),t)}):this.each(function(){if("string"===i)for(var a,s=0,r=X(this),l=t,o=e.split(tt);a=o[s++];)l=n?l:!r.hasClass(a),r[l?"addClass":"removeClass"](a);else("undefined"===i||"boolean"===i)&&(this.className&&X._data(this,"__className__",this.className),this.className=this.className||e===!1?"":X._data(this,"__className__")||"")})},hasClass:function(e){for(var t=" "+e+" ",i=0,n=this.length;n>i;i++)if(1===this[i].nodeType&&(" "+this[i].className+" ").replace(wt," ").indexOf(t)>-1)return!0;
return!1},val:function(e){var i,n,a,s=this[0];{if(arguments.length)return a=X.isFunction(e),this.each(function(n){var s,r=X(this);1===this.nodeType&&(s=a?e.call(this,n,r.val()):e,null==s?s="":"number"==typeof s?s+="":X.isArray(s)&&(s=X.map(s,function(e){return null==e?"":e+""})),i=X.valHooks[this.type]||X.valHooks[this.nodeName.toLowerCase()],i&&"set"in i&&i.set(this,s,"value")!==t||(this.value=s))});if(s)return i=X.valHooks[s.type]||X.valHooks[s.nodeName.toLowerCase()],i&&"get"in i&&(n=i.get(s,"value"))!==t?n:(n=s.value,"string"==typeof n?n.replace(xt,""):null==n?"":n)
}}}),X.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,i,n,a,s=e.selectedIndex,r=[],l=e.options,o="select-one"===e.type;if(0>s)return null;for(i=o?s:0,n=o?s+1:l.length;n>i;i++)if(a=l[i],!(!a.selected||(X.support.optDisabled?a.disabled:null!==a.getAttribute("disabled"))||a.parentNode.disabled&&X.nodeName(a.parentNode,"optgroup"))){if(t=X(a).val(),o)return t;r.push(t)}return o&&!r.length&&l.length?X(l[s]).val():r
},set:function(e,t){var i=X.makeArray(t);return X(e).find("option").each(function(){this.selected=X.inArray(X(this).val(),i)>=0}),i.length||(e.selectedIndex=-1),i}}},attrFn:{},attr:function(e,i,n,a){var s,r,l,o=e.nodeType;if(e&&3!==o&&8!==o&&2!==o)return a&&X.isFunction(X.fn[i])?X(e)[i](n):e.getAttribute===t?X.prop(e,i,n):(l=1!==o||!X.isXMLDoc(e),l&&(i=i.toLowerCase(),r=X.attrHooks[i]||(_t.test(i)?yt:vt)),n!==t?null===n?(X.removeAttr(e,i),t):r&&"set"in r&&l&&(s=r.set(e,n,i))!==t?s:(e.setAttribute(i,""+n),n):r&&"get"in r&&l&&null!==(s=r.get(e,i))?s:(s=e.getAttribute(i),null===s?t:s))
},removeAttr:function(e,t){var i,n,a,s,r=0;if(t&&1===e.nodeType)for(n=t.split(tt);n.length>r;r++)a=n[r],a&&(i=X.propFix[a]||a,s=_t.test(a),s||X.attr(e,a,""),e.removeAttribute(At?a:i),s&&i in e&&(e[i]=!1))},attrHooks:{type:{set:function(e,t){if(kt.test(e.nodeName)&&e.parentNode)X.error("type property can't be changed");else if(!X.support.radioValue&&"radio"===t&&X.nodeName(e,"input")){var i=e.value;return e.setAttribute("type",t),i&&(e.value=i),t}}},value:{get:function(e,t){return vt&&X.nodeName(e,"button")?vt.get(e,t):t in e?e.value:null
},set:function(e,i,n){return vt&&X.nodeName(e,"button")?vt.set(e,i,n):(e.value=i,t)}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,i,n){var a,s,r,l=e.nodeType;if(e&&3!==l&&8!==l&&2!==l)return r=1!==l||!X.isXMLDoc(e),r&&(i=X.propFix[i]||i,s=X.propHooks[i]),n!==t?s&&"set"in s&&(a=s.set(e,n,i))!==t?a:e[i]=n:s&&"get"in s&&null!==(a=s.get(e,i))?a:e[i]
},propHooks:{tabIndex:{get:function(e){var i=e.getAttributeNode("tabindex");return i&&i.specified?parseInt(i.value,10):St.test(e.nodeName)||Ct.test(e.nodeName)&&e.href?0:t}}}}),yt={get:function(e,i){var n,a=X.prop(e,i);return a===!0||"boolean"!=typeof a&&(n=e.getAttributeNode(i))&&n.nodeValue!==!1?i.toLowerCase():t},set:function(e,t,i){var n;return t===!1?X.removeAttr(e,i):(n=X.propFix[i]||i,n in e&&(e[n]=!0),e.setAttribute(i,i.toLowerCase())),i}},At||(bt={name:!0,id:!0,coords:!0},vt=X.valHooks.button={get:function(e,i){var n;
return n=e.getAttributeNode(i),n&&(bt[i]?""!==n.value:n.specified)?n.value:t},set:function(e,t,i){var n=e.getAttributeNode(i);return n||(n=j.createAttribute(i),e.setAttributeNode(n)),n.value=t+""}},X.each(["width","height"],function(e,i){X.attrHooks[i]=X.extend(X.attrHooks[i],{set:function(e,n){return""===n?(e.setAttribute(i,"auto"),n):t}})}),X.attrHooks.contenteditable={get:vt.get,set:function(e,t,i){""===t&&(t="false"),vt.set(e,t,i)}}),X.support.hrefNormalized||X.each(["href","src","width","height"],function(e,i){X.attrHooks[i]=X.extend(X.attrHooks[i],{get:function(e){var n=e.getAttribute(i,2);
return null===n?t:n}})}),X.support.style||(X.attrHooks.style={get:function(e){return e.style.cssText.toLowerCase()||t},set:function(e,t){return e.style.cssText=""+t}}),X.support.optSelected||(X.propHooks.selected=X.extend(X.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),X.support.enctype||(X.propFix.enctype="encoding"),X.support.checkOn||X.each(["radio","checkbox"],function(){X.valHooks[this]={get:function(e){return null===e.getAttribute("value")?"on":e.value
}}}),X.each(["radio","checkbox"],function(){X.valHooks[this]=X.extend(X.valHooks[this],{set:function(e,i){return X.isArray(i)?e.checked=X.inArray(X(e).val(),i)>=0:t}})});var It=/^(?:textarea|input|select)$/i,Tt=/^([^\.]*|)(?:\.(.+)|)$/,Mt=/(?:^|\s)hover(\.\S+|)\b/,Pt=/^key/,Dt=/^(?:mouse|contextmenu)|click/,Lt=/^(?:focusinfocus|focusoutblur)$/,Et=function(e){return X.event.special.hover?e:e.replace(Mt,"mouseenter$1 mouseleave$1")};X.event={add:function(e,i,n,a,s){var r,l,o,c,d,h,u,p,f,m,g;if(3!==e.nodeType&&8!==e.nodeType&&i&&n&&(r=X._data(e))){for(n.handler&&(f=n,n=f.handler,s=f.selector),n.guid||(n.guid=X.guid++),o=r.events,o||(r.events=o={}),l=r.handle,l||(r.handle=l=function(e){return X===t||e&&X.event.triggered===e.type?t:X.event.dispatch.apply(l.elem,arguments)
},l.elem=e),i=X.trim(Et(i)).split(" "),c=0;i.length>c;c++)d=Tt.exec(i[c])||[],h=d[1],u=(d[2]||"").split(".").sort(),g=X.event.special[h]||{},h=(s?g.delegateType:g.bindType)||h,g=X.event.special[h]||{},p=X.extend({type:h,origType:d[1],data:a,handler:n,guid:n.guid,selector:s,namespace:u.join(".")},f),m=o[h],m||(m=o[h]=[],m.delegateCount=0,g.setup&&g.setup.call(e,a,u,l)!==!1||(e.addEventListener?e.addEventListener(h,l,!1):e.attachEvent&&e.attachEvent("on"+h,l))),g.add&&(g.add.call(e,p),p.handler.guid||(p.handler.guid=n.guid)),s?m.splice(m.delegateCount++,0,p):m.push(p),X.event.global[h]=!0;
e=null}},global:{},remove:function(e,t,i,n,a){var s,r,l,o,c,d,h,u,p,f,m,g=X.hasData(e)&&X._data(e);if(g&&(u=g.events)){for(t=X.trim(Et(t||"")).split(" "),s=0;t.length>s;s++)if(r=Tt.exec(t[s])||[],l=o=r[1],c=r[2],l){for(p=X.event.special[l]||{},l=(n?p.delegateType:p.bindType)||l,f=u[l]||[],d=f.length,c=c?RegExp("(^|\\.)"+c.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null,h=0;f.length>h;h++)m=f[h],!a&&o!==m.origType||i&&i.guid!==m.guid||c&&!c.test(m.namespace)||n&&n!==m.selector&&("**"!==n||!m.selector)||(f.splice(h--,1),m.selector&&f.delegateCount--,p.remove&&p.remove.call(e,m));
0===f.length&&d!==f.length&&(p.teardown&&p.teardown.call(e,c,g.handle)!==!1||X.removeEvent(e,l,g.handle),delete u[l])}else for(l in u)X.event.remove(e,l+t[s],i,n,!0);X.isEmptyObject(u)&&(delete g.handle,X.removeData(e,"events",!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(i,n,a,s){if(!a||3!==a.nodeType&&8!==a.nodeType){var r,l,o,c,d,h,u,p,f,m,g=i.type||i,v=[];if(!Lt.test(g+X.event.triggered)&&(g.indexOf("!")>=0&&(g=g.slice(0,-1),l=!0),g.indexOf(".")>=0&&(v=g.split("."),g=v.shift(),v.sort()),a&&!X.event.customEvent[g]||X.event.global[g]))if(i="object"==typeof i?i[X.expando]?i:new X.Event(g,i):new X.Event(g),i.type=g,i.isTrigger=!0,i.exclusive=l,i.namespace=v.join("."),i.namespace_re=i.namespace?RegExp("(^|\\.)"+v.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,h=0>g.indexOf(":")?"on"+g:"",a){if(i.result=t,i.target||(i.target=a),n=null!=n?X.makeArray(n):[],n.unshift(i),u=X.event.special[g]||{},!u.trigger||u.trigger.apply(a,n)!==!1){if(f=[[a,u.bindType||g]],!s&&!u.noBubble&&!X.isWindow(a)){for(m=u.delegateType||g,c=Lt.test(m+g)?a:a.parentNode,d=a;c;c=c.parentNode)f.push([c,m]),d=c;
d===(a.ownerDocument||j)&&f.push([d.defaultView||d.parentWindow||e,m])}for(o=0;f.length>o&&!i.isPropagationStopped();o++)c=f[o][0],i.type=f[o][1],p=(X._data(c,"events")||{})[i.type]&&X._data(c,"handle"),p&&p.apply(c,n),p=h&&c[h],p&&X.acceptData(c)&&p.apply(c,n)===!1&&i.preventDefault();return i.type=g,s||i.isDefaultPrevented()||u._default&&u._default.apply(a.ownerDocument,n)!==!1||"click"===g&&X.nodeName(a,"a")||!X.acceptData(a)||h&&a[g]&&("focus"!==g&&"blur"!==g||0!==i.target.offsetWidth)&&!X.isWindow(a)&&(d=a[h],d&&(a[h]=null),X.event.triggered=g,a[g](),X.event.triggered=t,d&&(a[h]=d)),i.result
}}else{r=X.cache;for(o in r)r[o].events&&r[o].events[g]&&X.event.trigger(i,n,r[o].handle.elem,!0)}}},dispatch:function(i){i=X.event.fix(i||e.event);var n,a,s,r,l,o,c,d,h,u,p=(X._data(this,"events")||{})[i.type]||[],f=p.delegateCount,m=[].slice.call(arguments),g=!i.exclusive&&!i.namespace,v=X.event.special[i.type]||{},y=[];if(m[0]=i,i.delegateTarget=this,!v.preDispatch||v.preDispatch.call(this,i)!==!1){if(f&&(!i.button||"click"!==i.type))for(r=X(this),r.context=this,s=i.target;s!=this;s=s.parentNode||this)if(s.disabled!==!0||"click"!==i.type){for(o={},d=[],r[0]=s,n=0;f>n;n++)h=p[n],u=h.selector,o[u]===t&&(o[u]=r.is(u)),o[u]&&d.push(h);
d.length&&y.push({elem:s,matches:d})}for(p.length>f&&y.push({elem:this,matches:p.slice(f)}),n=0;y.length>n&&!i.isPropagationStopped();n++)for(c=y[n],i.currentTarget=c.elem,a=0;c.matches.length>a&&!i.isImmediatePropagationStopped();a++)h=c.matches[a],(g||!i.namespace&&!h.namespace||i.namespace_re&&i.namespace_re.test(h.namespace))&&(i.data=h.data,i.handleObj=h,l=((X.event.special[h.origType]||{}).handle||h.handler).apply(c.elem,m),l!==t&&(i.result=l,l===!1&&(i.preventDefault(),i.stopPropagation())));
return v.postDispatch&&v.postDispatch.call(this,i),i.result}},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,i){var n,a,s,r=i.button,l=i.fromElement;
return null==e.pageX&&null!=i.clientX&&(n=e.target.ownerDocument||j,a=n.documentElement,s=n.body,e.pageX=i.clientX+(a&&a.scrollLeft||s&&s.scrollLeft||0)-(a&&a.clientLeft||s&&s.clientLeft||0),e.pageY=i.clientY+(a&&a.scrollTop||s&&s.scrollTop||0)-(a&&a.clientTop||s&&s.clientTop||0)),!e.relatedTarget&&l&&(e.relatedTarget=l===e.target?i.toElement:l),e.which||r===t||(e.which=1&r?1:2&r?3:4&r?2:0),e}},fix:function(e){if(e[X.expando])return e;var t,i,n=e,a=X.event.fixHooks[e.type]||{},s=a.props?this.props.concat(a.props):this.props;
for(e=X.Event(n),t=s.length;t;)i=s[--t],e[i]=n[i];return e.target||(e.target=n.srcElement||j),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,a.filter?a.filter(e,n):e},special:{ready:{setup:X.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(e,t,i){X.isWindow(this)&&(this.onbeforeunload=i)},teardown:function(e,t){this.onbeforeunload===t&&(this.onbeforeunload=null)}}},simulate:function(e,t,i,n){var a=X.extend(new X.Event,i,{type:e,isSimulated:!0,originalEvent:{}});
n?X.event.trigger(a,null,t):X.event.dispatch.call(t,a),a.isDefaultPrevented()&&i.preventDefault()}},X.event.handle=X.event.dispatch,X.removeEvent=j.removeEventListener?function(e,t,i){e.removeEventListener&&e.removeEventListener(t,i,!1)}:function(e,i,n){var a="on"+i;e.detachEvent&&(e[a]===t&&(e[a]=null),e.detachEvent(a,n))},X.Event=function(e,i){return this instanceof X.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?r:s):this.type=e,i&&X.extend(this,i),this.timeStamp=e&&e.timeStamp||X.now(),this[X.expando]=!0,t):new X.Event(e,i)
},X.Event.prototype={preventDefault:function(){this.isDefaultPrevented=r;var e=this.originalEvent;e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=r;var e=this.originalEvent;e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=r,this.stopPropagation()},isDefaultPrevented:s,isPropagationStopped:s,isImmediatePropagationStopped:s},X.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){X.event.special[e]={delegateType:t,bindType:t,handle:function(e){var i,n=this,a=e.relatedTarget,s=e.handleObj;
return s.selector,(!a||a!==n&&!X.contains(n,a))&&(e.type=s.origType,i=s.handler.apply(this,arguments),e.type=t),i}}}),X.support.submitBubbles||(X.event.special.submit={setup:function(){return X.nodeName(this,"form")?!1:(X.event.add(this,"click._submit keypress._submit",function(e){var i=e.target,n=X.nodeName(i,"input")||X.nodeName(i,"button")?i.form:t;n&&!X._data(n,"_submit_attached")&&(X.event.add(n,"submit._submit",function(e){e._submit_bubble=!0}),X._data(n,"_submit_attached",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&X.event.simulate("submit",this.parentNode,e,!0))
},teardown:function(){return X.nodeName(this,"form")?!1:(X.event.remove(this,"._submit"),t)}}),X.support.changeBubbles||(X.event.special.change={setup:function(){return It.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(X.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),X.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),X.event.simulate("change",this,e,!0)
})),!1):(X.event.add(this,"beforeactivate._change",function(e){var t=e.target;It.test(t.nodeName)&&!X._data(t,"_change_attached")&&(X.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||X.event.simulate("change",this.parentNode,e,!0)}),X._data(t,"_change_attached",!0))}),t)},handle:function(e){var i=e.target;return this!==i||e.isSimulated||e.isTrigger||"radio"!==i.type&&"checkbox"!==i.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return X.event.remove(this,"._change"),It.test(this.nodeName)
}}),X.support.focusinBubbles||X.each({focus:"focusin",blur:"focusout"},function(e,t){var i=0,n=function(e){X.event.simulate(t,e.target,X.event.fix(e),!0)};X.event.special[t]={setup:function(){0===i++&&j.addEventListener(e,n,!0)},teardown:function(){0===--i&&j.removeEventListener(e,n,!0)}}}),X.fn.extend({on:function(e,i,n,a,r){var l,o;if("object"==typeof e){"string"!=typeof i&&(n=n||i,i=t);for(o in e)this.on(o,i,n,e[o],r);return this}if(null==n&&null==a?(a=i,n=i=t):null==a&&("string"==typeof i?(a=n,n=t):(a=n,n=i,i=t)),a===!1)a=s;
else if(!a)return this;return 1===r&&(l=a,a=function(e){return X().off(e),l.apply(this,arguments)},a.guid=l.guid||(l.guid=X.guid++)),this.each(function(){X.event.add(this,e,a,n,i)})},one:function(e,t,i,n){return this.on(e,t,i,n,1)},off:function(e,i,n){var a,r;if(e&&e.preventDefault&&e.handleObj)return a=e.handleObj,X(e.delegateTarget).off(a.namespace?a.origType+"."+a.namespace:a.origType,a.selector,a.handler),this;if("object"==typeof e){for(r in e)this.off(r,i,e[r]);return this}return(i===!1||"function"==typeof i)&&(n=i,i=t),n===!1&&(n=s),this.each(function(){X.event.remove(this,e,n,i)
})},bind:function(e,t,i){return this.on(e,null,t,i)},unbind:function(e,t){return this.off(e,null,t)},live:function(e,t,i){return X(this.context).on(e,this.selector,t,i),this},die:function(e,t){return X(this.context).off(e,this.selector||"**",t),this},delegate:function(e,t,i,n){return this.on(t,e,i,n)},undelegate:function(e,t,i){return 1==arguments.length?this.off(e,"**"):this.off(t,e||"**",i)},trigger:function(e,t){return this.each(function(){X.event.trigger(e,t,this)})},triggerHandler:function(e,i){return this[0]?X.event.trigger(e,i,this[0],!0):t
},toggle:function(e){var t=arguments,i=e.guid||X.guid++,n=0,a=function(i){var a=(X._data(this,"lastToggle"+e.guid)||0)%n;return X._data(this,"lastToggle"+e.guid,a+1),i.preventDefault(),t[a].apply(this,arguments)||!1};for(a.guid=i;t.length>n;)t[n++].guid=i;return this.click(a)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),X.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){X.fn[t]=function(e,i){return null==i&&(i=e,e=null),arguments.length>0?this.on(t,null,e,i):this.trigger(t)
},Pt.test(t)&&(X.event.fixHooks[t]=X.event.keyHooks),Dt.test(t)&&(X.event.fixHooks[t]=X.event.mouseHooks)}),function(e,t){function i(e,t,i,n){for(var a=0,s=t.length;s>a;a++)st(e,t[a],i,n)}function n(e,t,n,a,s,r){var l,o=rt.setFilters[t.toLowerCase()];return o||st.error(t),(e||!(l=s))&&i(e||"*",a,l=[],s),l.length>0?o(l,n,r):[]}function a(e,a,s,r,l){for(var o,c,d,h,u,p,f,m,g=0,v=l.length,y=H.POS,b=RegExp("^"+y.source+"(?!"+C+")","i"),w=function(){for(var e=1,i=arguments.length-2;i>e;e++)arguments[e]===t&&(o[e]=t)
};v>g;g++){for(y.exec(""),e=l[g],h=[],d=0,u=r;o=y.exec(e);)m=y.lastIndex=o.index+o[0].length,m>d&&(f=e.slice(d,o.index),d=m,p=[a],N.test(f)&&(u&&(p=u),u=r),(c=V.test(f))&&(f=f.slice(0,-5).replace(N,"$&*")),o.length>1&&o[0].replace(b,w),u=n(f,o[1],o[2],p,u,c));u?(h=h.concat(u),(f=e.slice(d))&&")"!==f?N.test(f)?i(f,h,s,r):st(f,a,s,r?r.concat(u):u):k.apply(s,h)):st(e,a,s,r)}return 1===v?s:st.uniqueSort(s)}function s(e,t,i){for(var n,a,s,r=[],l=0,o=R.exec(e),c=!o.pop()&&!o.pop(),d=c&&e.match(O)||[""],h=rt.preFilter,u=rt.filter,p=!i&&t!==m;null!=(a=d[l])&&c;l++)for(r.push(n=[]),p&&(a=" "+a);a;){c=!1,(o=N.exec(a))&&(a=a.slice(o[0].length),c=n.push({part:o.pop().replace(E," "),captures:o}));
for(s in u)!(o=H[s].exec(a))||h[s]&&!(o=h[s](o,t,i))||(a=a.slice(o.shift().length),c=n.push({part:s,captures:o}));if(!c)break}return c||st.error(e),r}function r(e,t,i){var n=t.dir,a=w++;return e||(e=function(e){return e===i}),t.first?function(t,i){for(;t=t[n];)if(1===t.nodeType)return e(t,i)&&t}:function(t,i){for(var s,r=a+"."+h,l=r+"."+d;t=t[n];)if(1===t.nodeType){if((s=t[S])===l)return t.sizset;if("string"==typeof s&&0===s.indexOf(r)){if(t.sizset)return t}else{if(t[S]=l,e(t,i))return t.sizset=!0,t;
t.sizset=!1}}}}function l(e,t){return e?function(i,n){var a=t(i,n);return a&&e(a===!0?i:a,n)}:t}function o(e,t,i){for(var n,a,s=0;n=e[s];s++)rt.relative[n.part]?a=r(a,rt.relative[n.part],t):(n.captures.push(t,i),a=l(a,rt.filter[n.part].apply(null,n.captures)));return a}function c(e){return function(t,i){for(var n,a=0;n=e[a];a++)if(n(t,i))return!0;return!1}}var d,h,u,p,f,m=e.document,g=m.documentElement,v="undefined",y=!1,b=!0,w=0,x=[].slice,k=[].push,S=("sizcache"+Math.random()).replace(".",""),C="[\\x20\\t\\r\\n\\f]",_="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",A=_.replace("w","w#"),I="([*^$|!~]?=)",T="\\["+C+"*("+_+")"+C+"*(?:"+I+C+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+A+")|)|)"+C+"*\\]",M=":("+_+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|((?:[^,]|\\\\,|(?:,(?=[^\\[]*\\]))|(?:,(?=[^\\(]*\\))))*))\\)|)",P=":(nth|eq|gt|lt|first|last|even|odd)(?:\\((\\d*)\\)|)(?=[^-]|$)",D=C+"*([\\x20\\t\\r\\n\\f>+~])"+C+"*",L="(?=[^\\x20\\t\\r\\n\\f])(?:\\\\.|"+T+"|"+M.replace(2,7)+"|[^\\\\(),])+",E=RegExp("^"+C+"+|((?:^|[^\\\\])(?:\\\\.)*)"+C+"+$","g"),N=RegExp("^"+D),O=RegExp(L+"?(?="+C+"*,|$)","g"),R=RegExp("^(?:(?!,)(?:(?:^|,)"+C+"*"+L+")*?|"+C+"*(.*?))(\\)|$)"),B=RegExp(L.slice(19,-6)+"\\x20\\t\\r\\n\\f>+~])+|"+D,"g"),$=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,q=/[\x20\t\r\n\f]*[+~]/,V=/:not\($/,j=/h\d/i,F=/input|select|textarea|button/i,U=/\\(?!\\)/g,H={ID:RegExp("^#("+_+")"),CLASS:RegExp("^\\.("+_+")"),NAME:RegExp("^\\[name=['\"]?("+_+")['\"]?\\]"),TAG:RegExp("^("+_.replace("[-","[-\\*")+")"),ATTR:RegExp("^"+T),PSEUDO:RegExp("^"+M),CHILD:RegExp("^:(only|nth|last|first)-child(?:\\("+C+"*(even|odd|(([+-]|)(\\d*)n|)"+C+"*(?:([+-]|)"+C+"*(\\d+)|))"+C+"*\\)|)","i"),POS:RegExp(P,"ig"),needsContext:RegExp("^"+C+"*[>+~]|"+P,"i")},z={},W=[],Y={},J=[],K=function(e){return e.sizzleFilter=!0,e
},G=function(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}},Q=function(e){return function(t){var i=t.nodeName.toLowerCase();return("input"===i||"button"===i)&&t.type===e}},Z=function(e){var t=!1,i=m.createElement("div");try{t=e(i)}catch(n){}return i=null,t},et=Z(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return"boolean"!==t&&"string"!==t}),tt=Z(function(e){e.id=S+0,e.innerHTML="<a name='"+S+"'></a><div name='"+S+"'></div>",g.insertBefore(e,g.firstChild);
var t=m.getElementsByName&&m.getElementsByName(S).length===2+m.getElementsByName(S+0).length;return f=!m.getElementById(S),g.removeChild(e),t}),it=Z(function(e){return e.appendChild(m.createComment("")),0===e.getElementsByTagName("*").length}),nt=Z(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==v&&"#"===e.firstChild.getAttribute("href")}),at=Z(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",e.getElementsByClassName&&0!==e.getElementsByClassName("e").length?(e.lastChild.className="e",1!==e.getElementsByClassName("e").length):!1
}),st=function(e,t,i,n){i=i||[],t=t||m;var a,s,r,l,o=t.nodeType;if(1!==o&&9!==o)return[];if(!e||"string"!=typeof e)return i;if(r=ot(t),!r&&!n&&(a=$.exec(e)))if(l=a[1]){if(9===o){if(s=t.getElementById(l),!s||!s.parentNode)return i;if(s.id===l)return i.push(s),i}else if(t.ownerDocument&&(s=t.ownerDocument.getElementById(l))&&ct(t,s)&&s.id===l)return i.push(s),i}else{if(a[2])return k.apply(i,x.call(t.getElementsByTagName(e),0)),i;if((l=a[3])&&at&&t.getElementsByClassName)return k.apply(i,x.call(t.getElementsByClassName(l),0)),i
}return ut(e,t,i,n,r)},rt=st.selectors={cacheLength:50,match:H,order:["ID","TAG"],attrHandle:{},createPseudo:K,find:{ID:f?function(e,t,i){if(typeof t.getElementById!==v&&!i){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}}:function(e,i,n){if(typeof i.getElementById!==v&&!n){var a=i.getElementById(e);return a?a.id===e||typeof a.getAttributeNode!==v&&a.getAttributeNode("id").value===e?[a]:t:[]}},TAG:it?function(e,i){return typeof i.getElementsByTagName!==v?i.getElementsByTagName(e):t}:function(e,t){var i=t.getElementsByTagName(e);
if("*"===e){for(var n,a=[],s=0;n=i[s];s++)1===n.nodeType&&a.push(n);return a}return i}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(U,""),e[3]=(e[4]||e[5]||"").replace(U,""),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1]?(e[2]||st.error(e[0]),e[3]=+(e[3]?e[4]+(e[5]||1):2*("even"===e[2]||"odd"===e[2])),e[4]=+(e[6]+e[7]||"odd"===e[2])):e[2]&&st.error(e[0]),e
},PSEUDO:function(e){var t,i=e[4];return H.CHILD.test(e[0])?null:(i&&(t=R.exec(i))&&t.pop()&&(e[0]=e[0].slice(0,t[0].length-i.length-1),i=t[0].slice(0,-1)),e.splice(2,3,i||e[3]),e)}},filter:{ID:f?function(e){return e=e.replace(U,""),function(t){return t.getAttribute("id")===e}}:function(e){return e=e.replace(U,""),function(t){var i=typeof t.getAttributeNode!==v&&t.getAttributeNode("id");return i&&i.value===e}},TAG:function(e){return"*"===e?function(){return!0}:(e=e.replace(U,"").toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e
})},CLASS:function(e){var t=z[e];return t||(t=z[e]=RegExp("(^|"+C+")"+e+"("+C+"|$)"),W.push(e),W.length>rt.cacheLength&&delete z[W.shift()]),function(e){return t.test(e.className||typeof e.getAttribute!==v&&e.getAttribute("class")||"")}},ATTR:function(e,t,i){return t?function(n){var a=st.attr(n,e),s=a+"";if(null==a)return"!="===t;switch(t){case"=":return s===i;case"!=":return s!==i;case"^=":return i&&0===s.indexOf(i);case"*=":return i&&s.indexOf(i)>-1;case"$=":return i&&s.substr(s.length-i.length)===i;
case"~=":return(" "+s+" ").indexOf(i)>-1;case"|=":return s===i||s.substr(0,i.length+1)===i+"-"}}:function(t){return null!=st.attr(t,e)}},CHILD:function(e,t,i,n){if("nth"===e){var a=w++;return function(e){var t,s,r=0,l=e;if(1===i&&0===n)return!0;if(t=e.parentNode,t&&(t[S]!==a||!e.sizset)){for(l=t.firstChild;l&&(1!==l.nodeType||(l.sizset=++r,l!==e));l=l.nextSibling);t[S]=a}return s=e.sizset-n,0===i?0===s:0===s%i&&s/i>=0}}return function(t){var i=t;switch(e){case"only":case"first":for(;i=i.previousSibling;)if(1===i.nodeType)return!1;
if("first"===e)return!0;i=t;case"last":for(;i=i.nextSibling;)if(1===i.nodeType)return!1;return!0}}},PSEUDO:function(e,t,i,n){var a=rt.pseudos[e]||rt.pseudos[e.toLowerCase()];return a||st.error("unsupported pseudo: "+e),a.sizzleFilter?a(t,i,n):a}},pseudos:{not:K(function(e,t,i){var n=ht(e.replace(E,"$1"),t,i);return function(e){return!n(e)}}),enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected
},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},parent:function(e){return!rt.pseudos.empty(e)},empty:function(e){var t;for(e=e.firstChild;e;){if(e.nodeName>"@"||3===(t=e.nodeType)||4===t)return!1;e=e.nextSibling}return!0},contains:K(function(e){return function(t){return(t.textContent||t.innerText||dt(t)).indexOf(e)>-1}}),has:K(function(e){return function(t){return st(e,t).length>0}}),header:function(e){return j.test(e.nodeName)},text:function(e){var t,i;return"input"===e.nodeName.toLowerCase()&&"text"===(t=e.type)&&(null==(i=e.getAttribute("type"))||i.toLowerCase()===t)
},radio:G("radio"),checkbox:G("checkbox"),file:G("file"),password:G("password"),image:G("image"),submit:Q("submit"),reset:Q("reset"),button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},input:function(e){return F.test(e.nodeName)},focus:function(e){var t=e.ownerDocument;return!(e!==t.activeElement||t.hasFocus&&!t.hasFocus()||!e.type&&!e.href)},active:function(e){return e===e.ownerDocument.activeElement}},setFilters:{first:function(e,t,i){return i?e.slice(1):[e[0]]
},last:function(e,t,i){var n=e.pop();return i?e:[n]},even:function(e,t,i){for(var n=[],a=i?1:0,s=e.length;s>a;a+=2)n.push(e[a]);return n},odd:function(e,t,i){for(var n=[],a=i?0:1,s=e.length;s>a;a+=2)n.push(e[a]);return n},lt:function(e,t,i){return i?e.slice(+t):e.slice(0,+t)},gt:function(e,t,i){return i?e.slice(0,+t+1):e.slice(+t+1)},eq:function(e,t,i){var n=e.splice(+t,1);return i?e:n}}};rt.setFilters.nth=rt.setFilters.eq,rt.filters=rt.pseudos,nt||(rt.attrHandle={href:function(e){return e.getAttribute("href",2)
},type:function(e){return e.getAttribute("type")}}),tt&&(rt.order.push("NAME"),rt.find.NAME=function(e,i){return typeof i.getElementsByName!==v?i.getElementsByName(e):t}),at&&(rt.order.splice(1,0,"CLASS"),rt.find.CLASS=function(e,i,n){return typeof i.getElementsByClassName===v||n?t:i.getElementsByClassName(e)});try{x.call(g.childNodes,0)[0].nodeType}catch(lt){x=function(e){for(var t,i=[];t=this[e];e++)i.push(t);return i}}var ot=st.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1
},ct=st.contains=g.compareDocumentPosition?function(e,t){return!!(16&e.compareDocumentPosition(t))}:g.contains?function(e,t){var i=9===e.nodeType?e.documentElement:e,n=t.parentNode;return e===n||!!(n&&1===n.nodeType&&i.contains&&i.contains(n))}:function(e,t){for(;t=t.parentNode;)if(t===e)return!0;return!1},dt=st.getText=function(e){var t,i="",n=0,a=e.nodeType;if(a){if(1===a||9===a||11===a){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)i+=dt(e)}else if(3===a||4===a)return e.nodeValue
}else for(;t=e[n];n++)i+=dt(t);return i};st.attr=function(e,t){var i,n=ot(e);return n||(t=t.toLowerCase()),rt.attrHandle[t]?rt.attrHandle[t](e):et||n?e.getAttribute(t):(i=e.getAttributeNode(t),i?"boolean"==typeof e[t]?e[t]?t:null:i.specified?i.value:null:null)},st.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},[0,0].sort(function(){return b=0}),g.compareDocumentPosition?u=function(e,t){return e===t?(y=!0,0):(e.compareDocumentPosition&&t.compareDocumentPosition?4&e.compareDocumentPosition(t):e.compareDocumentPosition)?-1:1
}:(u=function(e,t){if(e===t)return y=!0,0;if(e.sourceIndex&&t.sourceIndex)return e.sourceIndex-t.sourceIndex;var i,n,a=[],s=[],r=e.parentNode,l=t.parentNode,o=r;if(r===l)return p(e,t);if(!r)return-1;if(!l)return 1;for(;o;)a.unshift(o),o=o.parentNode;for(o=l;o;)s.unshift(o),o=o.parentNode;i=a.length,n=s.length;for(var c=0;i>c&&n>c;c++)if(a[c]!==s[c])return p(a[c],s[c]);return c===i?p(e,s[c],-1):p(a[c],t,1)},p=function(e,t,i){if(e===t)return i;for(var n=e.nextSibling;n;){if(n===t)return-1;n=n.nextSibling
}return 1}),st.uniqueSort=function(e){var t,i=1;if(u&&(y=b,e.sort(u),y))for(;t=e[i];i++)t===e[i-1]&&e.splice(i--,1);return e};var ht=st.compile=function(e,t,i){var n,a,r,l=Y[e];if(l&&l.context===t)return l;for(a=s(e,t,i),r=0;n=a[r];r++)a[r]=o(n,t,i);return l=Y[e]=c(a),l.context=t,l.runs=l.dirruns=0,J.push(e),J.length>rt.cacheLength&&delete Y[J.shift()],l};st.matches=function(e,t){return st(e,null,null,t)},st.matchesSelector=function(e,t){return st(t,null,null,[e]).length>0};var ut=function(e,t,i,n,s){e=e.replace(E,"$1");
var r,l,o,c,u,p,f,m,g,v=e.match(O),y=e.match(B),b=t.nodeType;if(H.POS.test(e))return a(e,t,i,n,v);if(n)r=x.call(n,0);else if(v&&1===v.length){if(y.length>1&&9===b&&!s&&(v=H.ID.exec(y[0]))){if(t=rt.find.ID(v[1],t,s)[0],!t)return i;e=e.slice(y.shift().length)}for(m=(v=q.exec(y[0]))&&!v.index&&t.parentNode||t,g=y.pop(),p=g.split(":not")[0],o=0,c=rt.order.length;c>o;o++)if(f=rt.order[o],v=H[f].exec(p)){if(r=rt.find[f]((v[1]||"").replace(U,""),m,s),null==r)continue;p===g&&(e=e.slice(0,e.length-g.length)+p.replace(H[f],""),e||k.apply(i,x.call(r,0)));
break}}if(e)for(l=ht(e,t,s),h=l.dirruns++,null==r&&(r=rt.find.TAG("*",q.test(e)&&t.parentNode||t)),o=0;u=r[o];o++)d=l.runs++,l(u,t)&&i.push(u);return i};m.querySelectorAll&&function(){var e,t=ut,i=/'|\\/g,n=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,a=[],s=[":active"],r=g.matchesSelector||g.mozMatchesSelector||g.webkitMatchesSelector||g.oMatchesSelector||g.msMatchesSelector;Z(function(e){e.innerHTML="<select><option selected></option></select>",e.querySelectorAll("[selected]").length||a.push("\\["+C+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||a.push(":checked")
}),Z(function(e){e.innerHTML="<p test=''></p>",e.querySelectorAll("[test^='']").length&&a.push("[*^$]="+C+"*(?:\"\"|'')"),e.innerHTML="<input type='hidden'>",e.querySelectorAll(":enabled").length||a.push(":enabled",":disabled")}),a=a.length&&RegExp(a.join("|")),ut=function(e,n,s,r,l){if(!(r||l||a&&a.test(e)))if(9===n.nodeType)try{return k.apply(s,x.call(n.querySelectorAll(e),0)),s}catch(o){}else if(1===n.nodeType&&"object"!==n.nodeName.toLowerCase()){var c=n.getAttribute("id"),d=c||S,h=q.test(e)&&n.parentNode||n;
c?d=d.replace(i,"\\$&"):n.setAttribute("id",d);try{return k.apply(s,x.call(h.querySelectorAll(e.replace(O,"[id='"+d+"'] $&")),0)),s}catch(o){}finally{c||n.removeAttribute("id")}}return t(e,n,s,r,l)},r&&(Z(function(t){e=r.call(t,"div");try{r.call(t,"[test!='']:sizzle"),s.push(rt.match.PSEUDO)}catch(i){}}),s=RegExp(s.join("|")),st.matchesSelector=function(t,i){if(i=i.replace(n,"='$1']"),!(ot(t)||s.test(i)||a&&a.test(i)))try{var l=r.call(t,i);if(l||e||t.document&&11!==t.document.nodeType)return l}catch(o){}return st(i,null,null,[t]).length>0
})}(),st.attr=X.attr,X.find=st,X.expr=st.selectors,X.expr[":"]=X.expr.pseudos,X.unique=st.uniqueSort,X.text=st.getText,X.isXMLDoc=st.isXML,X.contains=st.contains}(e);var Nt=/Until$/,Ot=/^(?:parents|prev(?:Until|All))/,Rt=/^.[^:#\[\.,]*$/,Bt=X.expr.match.needsContext,$t={children:!0,contents:!0,next:!0,prev:!0};X.fn.extend({find:function(e){var t,i,n,a,s,r,l=this;if("string"!=typeof e)return X(e).filter(function(){for(t=0,i=l.length;i>t;t++)if(X.contains(l[t],this))return!0});for(r=this.pushStack("","find",e),t=0,i=this.length;i>t;t++)if(n=r.length,X.find(e,this[t],r),t>0)for(a=n;r.length>a;a++)for(s=0;n>s;s++)if(r[s]===r[a]){r.splice(a--,1);
break}return r},has:function(e){var t,i=X(e,this),n=i.length;return this.filter(function(){for(t=0;n>t;t++)if(X.contains(this,i[t]))return!0})},not:function(e){return this.pushStack(c(this,e,!1),"not",e)},filter:function(e){return this.pushStack(c(this,e,!0),"filter",e)},is:function(e){return!!e&&("string"==typeof e?Bt.test(e)?X(e,this.context).index(this[0])>=0:X.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){for(var i,n=0,a=this.length,s=[],r=Bt.test(e)||"string"!=typeof e?X(e,t||this.context):0;a>n;n++)for(i=this[n];i&&i.ownerDocument&&i!==t&&11!==i.nodeType;){if(r?r.index(i)>-1:X.find.matchesSelector(i,e)){s.push(i);
break}i=i.parentNode}return s=s.length>1?X.unique(s):s,this.pushStack(s,"closest",e)},index:function(e){return e?"string"==typeof e?X.inArray(this[0],X(e)):X.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(e,t){var i="string"==typeof e?X(e,t):X.makeArray(e&&e.nodeType?[e]:e),n=X.merge(this.get(),i);return this.pushStack(l(i[0])||l(n[0])?n:X.unique(n))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),X.fn.andSelf=X.fn.addBack,X.each({parent:function(e){var t=e.parentNode;
return t&&11!==t.nodeType?t:null},parents:function(e){return X.dir(e,"parentNode")},parentsUntil:function(e,t,i){return X.dir(e,"parentNode",i)},next:function(e){return o(e,"nextSibling")},prev:function(e){return o(e,"previousSibling")},nextAll:function(e){return X.dir(e,"nextSibling")},prevAll:function(e){return X.dir(e,"previousSibling")},nextUntil:function(e,t,i){return X.dir(e,"nextSibling",i)},prevUntil:function(e,t,i){return X.dir(e,"previousSibling",i)},siblings:function(e){return X.sibling((e.parentNode||{}).firstChild,e)
},children:function(e){return X.sibling(e.firstChild)},contents:function(e){return X.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:X.merge([],e.childNodes)}},function(e,t){X.fn[e]=function(i,n){var a=X.map(this,t,i);return Nt.test(e)||(n=i),n&&"string"==typeof n&&(a=X.filter(n,a)),a=this.length>1&&!$t[e]?X.unique(a):a,this.length>1&&Ot.test(e)&&(a=a.reverse()),this.pushStack(a,e,Y.call(arguments).join(","))}}),X.extend({filter:function(e,t,i){return i&&(e=":not("+e+")"),1===t.length?X.find.matchesSelector(t[0],e)?[t[0]]:[]:X.find.matches(e,t)
},dir:function(e,i,n){for(var a=[],s=e[i];s&&9!==s.nodeType&&(n===t||1!==s.nodeType||!X(s).is(n));)1===s.nodeType&&a.push(s),s=s[i];return a},sibling:function(e,t){for(var i=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&i.push(e);return i}});var qt="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",Vt=/ jQuery\d+="(?:null|\d+)"/g,jt=/^\s+/,Ft=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,Ut=/<([\w:]+)/,Ht=/<tbody/i,zt=/<|&#?\w+;/,Wt=/<(?:script|style|link)/i,Yt=/<(?:script|object|embed|option|style)/i,Jt=RegExp("<(?:"+qt+")[\\s/>]","i"),Kt=/^(?:checkbox|radio)$/,Gt=/checked\s*(?:[^=]|=\s*.checked.)/i,Qt=/\/(java|ecma)script/i,Xt=/^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,Zt={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},ei=d(j),ti=ei.appendChild(j.createElement("div"));
Zt.optgroup=Zt.option,Zt.tbody=Zt.tfoot=Zt.colgroup=Zt.caption=Zt.thead,Zt.th=Zt.td,X.support.htmlSerialize||(Zt._default=[1,"X<div>","</div>"]),X.fn.extend({text:function(e){return X.access(this,function(e){return e===t?X.text(this):this.empty().append((this[0]&&this[0].ownerDocument||j).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(X.isFunction(e))return this.each(function(t){X(this).wrapAll(e.call(this,t))});if(this[0]){var t=X(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstChild&&1===e.firstChild.nodeType;)e=e.firstChild;
return e}).append(this)}return this},wrapInner:function(e){return X.isFunction(e)?this.each(function(t){X(this).wrapInner(e.call(this,t))}):this.each(function(){var t=X(this),i=t.contents();i.length?i.wrapAll(e):t.append(e)})},wrap:function(e){var t=X.isFunction(e);return this.each(function(i){X(this).wrapAll(t?e.call(this,i):e)})},unwrap:function(){return this.parent().each(function(){X.nodeName(this,"body")||X(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType)&&this.appendChild(e)
})},prepend:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType)&&this.insertBefore(e,this.firstChild)})},before:function(){if(!l(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this)});if(arguments.length){var e=X.clean(arguments);return this.pushStack(X.merge(e,this),"before",this.selector)}},after:function(){if(!l(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this.nextSibling)
});if(arguments.length){var e=X.clean(arguments);return this.pushStack(X.merge(this,e),"after",this.selector)}},remove:function(e,t){for(var i,n=0;null!=(i=this[n]);n++)(!e||X.filter(e,[i]).length)&&(t||1!==i.nodeType||(X.cleanData(i.getElementsByTagName("*")),X.cleanData([i])),i.parentNode&&i.parentNode.removeChild(i));return this},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)for(1===e.nodeType&&X.cleanData(e.getElementsByTagName("*"));e.firstChild;)e.removeChild(e.firstChild);return this
},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return X.clone(this,e,t)})},html:function(e){return X.access(this,function(e){var i=this[0]||{},n=0,a=this.length;if(e===t)return 1===i.nodeType?i.innerHTML.replace(Vt,""):t;if(!("string"!=typeof e||Wt.test(e)||!X.support.htmlSerialize&&Jt.test(e)||!X.support.leadingWhitespace&&jt.test(e)||Zt[(Ut.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(Ft,"<$1></$2>");try{for(;a>n;n++)i=this[n]||{},1===i.nodeType&&(X.cleanData(i.getElementsByTagName("*")),i.innerHTML=e);
i=0}catch(s){}}i&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){return l(this[0])?this.length?this.pushStack(X(X.isFunction(e)?e():e),"replaceWith",e):this:X.isFunction(e)?this.each(function(t){var i=X(this),n=i.html();i.replaceWith(e.call(this,t,n))}):("string"!=typeof e&&(e=X(e).detach()),this.each(function(){var t=this.nextSibling,i=this.parentNode;X(this).remove(),t?X(t).before(e):X(i).append(e)}))},detach:function(e){return this.remove(e,!0)},domManip:function(e,i,n){e=[].concat.apply([],e);
var a,s,r,l,o=0,c=e[0],d=[],u=this.length;if(!X.support.checkClone&&u>1&&"string"==typeof c&&Gt.test(c))return this.each(function(){X(this).domManip(e,i,n)});if(X.isFunction(c))return this.each(function(a){var s=X(this);e[0]=c.call(this,a,i?s.html():t),s.domManip(e,i,n)});if(this[0]){if(a=X.buildFragment(e,this,d),r=a.fragment,s=r.firstChild,1===r.childNodes.length&&(r=s),s)for(i=i&&X.nodeName(s,"tr"),l=a.cacheable||u-1;u>o;o++)n.call(i&&X.nodeName(this[o],"table")?h(this[o],"tbody"):this[o],o===l?r:X.clone(r,!0,!0));
r=s=null,d.length&&X.each(d,function(e,t){t.src?X.ajax?X.ajax({url:t.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):X.error("no ajax"):X.globalEval((t.text||t.textContent||t.innerHTML||"").replace(Xt,"")),t.parentNode&&t.parentNode.removeChild(t)})}return this}}),X.buildFragment=function(e,i,n){var a,s,r,l=e[0];return i=i||j,i=(i[0]||i).ownerDocument||i[0]||i,i.createDocumentFragment===t&&(i=j),!(1===e.length&&"string"==typeof l&&512>l.length&&i===j&&"<"===l.charAt(0))||Yt.test(l)||!X.support.checkClone&&Gt.test(l)||!X.support.html5Clone&&Jt.test(l)||(s=!0,a=X.fragments[l],r=a!==t),a||(a=i.createDocumentFragment(),X.clean(e,i,a,n),s&&(X.fragments[l]=r&&a)),{fragment:a,cacheable:s}
},X.fragments={},X.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){X.fn[e]=function(i){var n,a=0,s=[],r=X(i),l=r.length,o=1===this.length&&this[0].parentNode;if((null==o||o&&11===o.nodeType&&1===o.childNodes.length)&&1===l)return r[t](this[0]),this;for(;l>a;a++)n=(a>0?this.clone(!0):this).get(),X(r[a])[t](n),s=s.concat(n);return this.pushStack(s,e,r.selector)}}),X.extend({clone:function(e,t,i){var n,a,s,r;if(X.support.html5Clone||X.isXMLDoc(e)||!Jt.test("<"+e.nodeName+">")?r=e.cloneNode(!0):(ti.innerHTML=e.outerHTML,ti.removeChild(r=ti.firstChild)),!(X.support.noCloneEvent&&X.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||X.isXMLDoc(e)))for(p(e,r),n=f(e),a=f(r),s=0;n[s];++s)a[s]&&p(n[s],a[s]);
if(t&&(u(e,r),i))for(n=f(e),a=f(r),s=0;n[s];++s)u(n[s],a[s]);return n=a=null,r},clean:function(e,i,n,a){var s,r,l,o,c,h,u,p,f,g,v,y=0,b=[];for(i&&i.createDocumentFragment!==t||(i=j),r=i===j&&ei;null!=(l=e[y]);y++)if("number"==typeof l&&(l+=""),l){if("string"==typeof l)if(zt.test(l)){for(r=r||d(i),u=u||r.appendChild(i.createElement("div")),l=l.replace(Ft,"<$1></$2>"),o=(Ut.exec(l)||["",""])[1].toLowerCase(),c=Zt[o]||Zt._default,h=c[0],u.innerHTML=c[1]+l+c[2];h--;)u=u.lastChild;if(!X.support.tbody)for(p=Ht.test(l),f="table"!==o||p?"<table>"!==c[1]||p?[]:u.childNodes:u.firstChild&&u.firstChild.childNodes,s=f.length-1;s>=0;--s)X.nodeName(f[s],"tbody")&&!f[s].childNodes.length&&f[s].parentNode.removeChild(f[s]);
!X.support.leadingWhitespace&&jt.test(l)&&u.insertBefore(i.createTextNode(jt.exec(l)[0]),u.firstChild),l=u.childNodes,u=r.lastChild}else l=i.createTextNode(l);l.nodeType?b.push(l):b=X.merge(b,l)}if(u&&(r.removeChild(u),l=u=r=null),!X.support.appendChecked)for(y=0;null!=(l=b[y]);y++)X.nodeName(l,"input")?m(l):l.getElementsByTagName!==t&&X.grep(l.getElementsByTagName("input"),m);if(n)for(g=function(e){return!e.type||Qt.test(e.type)?a?a.push(e.parentNode?e.parentNode.removeChild(e):e):n.appendChild(e):t
},y=0;null!=(l=b[y]);y++)X.nodeName(l,"script")&&g(l)||(n.appendChild(l),l.getElementsByTagName!==t&&(v=X.grep(X.merge([],l.getElementsByTagName("script")),g),b.splice.apply(b,[y+1,0].concat(v)),y+=v.length));return b},cleanData:function(e,t){for(var i,n,a,s,r=0,l=X.expando,o=X.cache,c=X.support.deleteExpando,d=X.event.special;null!=(a=e[r]);r++)if((t||X.acceptData(a))&&(n=a[l],i=n&&o[n])){if(i.events)for(s in i.events)d[s]?X.event.remove(a,s):X.removeEvent(a,s,i.handle);o[n]&&(delete o[n],c?delete a[l]:a.removeAttribute?a.removeAttribute(l):a[l]=null,X.deletedIds.push(n))
}}}),function(){var e,t;X.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||0>e.indexOf("compatible")&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e=X.uaMatch(U.userAgent),t={},e.browser&&(t[e.browser]=!0,t.version=e.version),t.webkit&&(t.safari=!0),X.browser=t,X.sub=function(){function e(t,i){return new e.fn.init(t,i)}X.extend(!0,e,this),e.superclass=this,e.fn=e.prototype=this(),e.fn.constructor=e,e.sub=this.sub,e.fn.init=function(i,n){return n&&n instanceof X&&!(n instanceof e)&&(n=e(n)),X.fn.init.call(this,i,n,t)
},e.fn.init.prototype=e.fn;var t=e(j);return e}}();var ii,ni,ai,si=/alpha\([^)]*\)/i,ri=/opacity=([^)]*)/,li=/^(top|right|bottom|left)$/,oi=/^margin/,ci=RegExp("^("+Z+")(.*)$","i"),di=RegExp("^("+Z+")(?!px)[a-z%]+$","i"),hi=RegExp("^([-+])=("+Z+")","i"),ui={},pi={position:"absolute",visibility:"hidden",display:"block"},fi={letterSpacing:0,fontWeight:400,lineHeight:1},mi=["Top","Right","Bottom","Left"],gi=["Webkit","O","Moz","ms"],vi=X.fn.toggle;X.fn.extend({css:function(e,i){return X.access(this,function(e,i,n){return n!==t?X.style(e,i,n):X.css(e,i)
},e,i,arguments.length>1)},show:function(){return y(this,!0)},hide:function(){return y(this)},toggle:function(e,t){var i="boolean"==typeof e;return X.isFunction(e)&&X.isFunction(t)?vi.apply(this,arguments):this.each(function(){(i?e:v(this))?X(this).show():X(this).hide()})}}),X.extend({cssHooks:{opacity:{get:function(e,t){if(t){var i=ii(e,"opacity");return""===i?"1":i}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":X.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,i,n,a){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var s,r,l,o=X.camelCase(i),c=e.style;
if(i=X.cssProps[o]||(X.cssProps[o]=g(c,o)),l=X.cssHooks[i]||X.cssHooks[o],n===t)return l&&"get"in l&&(s=l.get(e,!1,a))!==t?s:c[i];if(r=typeof n,"string"===r&&(s=hi.exec(n))&&(n=(s[1]+1)*s[2]+parseFloat(X.css(e,i)),r="number"),!(null==n||"number"===r&&isNaN(n)||("number"!==r||X.cssNumber[o]||(n+="px"),l&&"set"in l&&(n=l.set(e,n,a))===t)))try{c[i]=n}catch(d){}}},css:function(e,i,n,a){var s,r,l,o=X.camelCase(i);return i=X.cssProps[o]||(X.cssProps[o]=g(e.style,o)),l=X.cssHooks[i]||X.cssHooks[o],l&&"get"in l&&(s=l.get(e,!0,a)),s===t&&(s=ii(e,i)),"normal"===s&&i in fi&&(s=fi[i]),n||a!==t?(r=parseFloat(s),n||X.isNumeric(r)?r||0:s):s
},swap:function(e,t,i){var n,a,s={};for(a in t)s[a]=e.style[a],e.style[a]=t[a];n=i.call(e);for(a in t)e.style[a]=s[a];return n}}),e.getComputedStyle?ii=function(e,t){var i,n,a,s,r=getComputedStyle(e,null),l=e.style;return r&&(i=r[t],""!==i||X.contains(e.ownerDocument.documentElement,e)||(i=X.style(e,t)),di.test(i)&&oi.test(t)&&(n=l.width,a=l.minWidth,s=l.maxWidth,l.minWidth=l.maxWidth=l.width=i,i=r.width,l.width=n,l.minWidth=a,l.maxWidth=s)),i}:j.documentElement.currentStyle&&(ii=function(e,t){var i,n,a=e.currentStyle&&e.currentStyle[t],s=e.style;
return null==a&&s&&s[t]&&(a=s[t]),di.test(a)&&!li.test(t)&&(i=s.left,n=e.runtimeStyle&&e.runtimeStyle.left,n&&(e.runtimeStyle.left=e.currentStyle.left),s.left="fontSize"===t?"1em":a,a=s.pixelLeft+"px",s.left=i,n&&(e.runtimeStyle.left=n)),""===a?"auto":a}),X.each(["height","width"],function(e,i){X.cssHooks[i]={get:function(e,n,a){return n?0!==e.offsetWidth||"none"!==ii(e,"display")?x(e,i,a):X.swap(e,pi,function(){return x(e,i,a)}):t},set:function(e,t,n){return b(e,t,n?w(e,i,n,X.support.boxSizing&&"border-box"===X.css(e,"boxSizing")):0)
}}}),X.support.opacity||(X.cssHooks.opacity={get:function(e,t){return ri.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var i=e.style,n=e.currentStyle,a=X.isNumeric(t)?"alpha(opacity="+100*t+")":"",s=n&&n.filter||i.filter||"";i.zoom=1,t>=1&&""===X.trim(s.replace(si,""))&&i.removeAttribute&&(i.removeAttribute("filter"),n&&!n.filter)||(i.filter=si.test(s)?s.replace(si,a):s+" "+a)}}),X(function(){X.support.reliableMarginRight||(X.cssHooks.marginRight={get:function(e,i){return X.swap(e,{display:"inline-block"},function(){return i?ii(e,"marginRight"):t
})}}),!X.support.pixelPosition&&X.fn.position&&X.each(["top","left"],function(e,t){X.cssHooks[t]={get:function(e,i){if(i){var n=ii(e,t);return di.test(n)?X(e).position()[t]+"px":n}}}})}),X.expr&&X.expr.filters&&(X.expr.filters.hidden=function(e){return 0===e.offsetWidth&&0===e.offsetHeight||!X.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||ii(e,"display"))},X.expr.filters.visible=function(e){return!X.expr.filters.hidden(e)}),X.each({margin:"",padding:"",border:"Width"},function(e,t){X.cssHooks[e+t]={expand:function(i){var n,a="string"==typeof i?i.split(" "):[i],s={};
for(n=0;4>n;n++)s[e+mi[n]+t]=a[n]||a[n-2]||a[0];return s}},oi.test(e)||(X.cssHooks[e+t].set=b)});var yi=/%20/g,bi=/\[\]$/,wi=/\r?\n/g,xi=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,ki=/^(?:select|textarea)/i;X.fn.extend({serialize:function(){return X.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?X.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ki.test(this.nodeName)||xi.test(this.type))
}).map(function(e,t){var i=X(this).val();return null==i?null:X.isArray(i)?X.map(i,function(e){return{name:t.name,value:e.replace(wi,"\r\n")}}):{name:t.name,value:i.replace(wi,"\r\n")}}).get()}}),X.param=function(e,i){var n,a=[],s=function(e,t){t=X.isFunction(t)?t():null==t?"":t,a[a.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(i===t&&(i=X.ajaxSettings&&X.ajaxSettings.traditional),X.isArray(e)||e.jquery&&!X.isPlainObject(e))X.each(e,function(){s(this.name,this.value)});else for(n in e)S(n,e[n],i,s);
return a.join("&").replace(yi,"+")};var Si,Ci,_i=/#.*$/,Ai=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Ii=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,Ti=/^(?:GET|HEAD)$/,Mi=/^\/\//,Pi=/\?/,Di=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,Li=/([?&])_=[^&]*/,Ei=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Ni=X.fn.load,Oi={},Ri={},Bi=["*/"]+["*"];try{Si=F.href}catch($i){Si=j.createElement("a"),Si.href="",Si=Si.href}Ci=Ei.exec(Si.toLowerCase())||[],X.fn.load=function(e,i,n){if("string"!=typeof e&&Ni)return Ni.apply(this,arguments);
if(!this.length)return this;var a,s,r,l=this,o=e.indexOf(" ");return o>=0&&(a=e.slice(o,e.length),e=e.slice(0,o)),X.isFunction(i)?(n=i,i=t):"object"==typeof i&&(s="POST"),X.ajax({url:e,type:s,dataType:"html",data:i,complete:function(e,t){n&&l.each(n,r||[e.responseText,t,e])}}).done(function(e){r=arguments,l.html(a?X("<div>").append(e.replace(Di,"")).find(a):e)}),this},X.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,t){X.fn[t]=function(e){return this.on(t,e)
}}),X.each(["get","post"],function(e,i){X[i]=function(e,n,a,s){return X.isFunction(n)&&(s=s||a,a=n,n=t),X.ajax({type:i,url:e,data:n,success:a,dataType:s})}}),X.extend({getScript:function(e,i){return X.get(e,t,i,"script")},getJSON:function(e,t,i){return X.get(e,t,i,"json")},ajaxSetup:function(e,t){return t?A(e,X.ajaxSettings):(t=e,e=X.ajaxSettings),A(e,t),e},ajaxSettings:{url:Si,isLocal:Ii.test(Ci[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":Bi},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":X.parseJSON,"text xml":X.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:C(Oi),ajaxTransport:C(Ri),ajax:function(e,i){function n(e,i,n,r){var c,h,y,b,x,S=i;
2!==w&&(w=2,o&&clearTimeout(o),l=t,s=r||"",k.readyState=e>0?4:0,n&&(b=I(u,k,n)),e>=200&&300>e||304===e?(u.ifModified&&(x=k.getResponseHeader("Last-Modified"),x&&(X.lastModified[a]=x),x=k.getResponseHeader("Etag"),x&&(X.etag[a]=x)),304===e?(S="notmodified",c=!0):(c=T(u,b),S=c.state,h=c.data,y=c.error,c=!y)):(y=S,(!S||e)&&(S="error",0>e&&(e=0))),k.status=e,k.statusText=""+(i||S),c?m.resolveWith(p,[h,S,k]):m.rejectWith(p,[k,S,y]),k.statusCode(v),v=t,d&&f.trigger("ajax"+(c?"Success":"Error"),[k,u,c?h:y]),g.fireWith(p,[k,S]),d&&(f.trigger("ajaxComplete",[k,u]),--X.active||X.event.trigger("ajaxStop")))
}"object"==typeof e&&(i=e,e=t),i=i||{};var a,s,r,l,o,c,d,h,u=X.ajaxSetup({},i),p=u.context||u,f=p!==u&&(p.nodeType||p instanceof X)?X(p):X.event,m=X.Deferred(),g=X.Callbacks("once memory"),v=u.statusCode||{},y={},b={},w=0,x="canceled",k={readyState:0,setRequestHeader:function(e,t){if(!w){var i=e.toLowerCase();e=b[i]=b[i]||e,y[e]=t}return this},getAllResponseHeaders:function(){return 2===w?s:null},getResponseHeader:function(e){var i;if(2===w){if(!r)for(r={};i=Ai.exec(s);)r[i[1].toLowerCase()]=i[2];
i=r[e.toLowerCase()]}return i===t?null:i},overrideMimeType:function(e){return w||(u.mimeType=e),this},abort:function(e){return e=e||x,l&&l.abort(e),n(0,e),this}};if(m.promise(k),k.success=k.done,k.error=k.fail,k.complete=g.add,k.statusCode=function(e){if(e){var t;if(2>w)for(t in e)v[t]=[v[t],e[t]];else t=e[k.status],k.always(t)}return this},u.url=((e||u.url)+"").replace(_i,"").replace(Mi,Ci[1]+"//"),u.dataTypes=X.trim(u.dataType||"*").toLowerCase().split(tt),null==u.crossDomain&&(c=Ei.exec(u.url.toLowerCase()),u.crossDomain=!(!c||c[1]==Ci[1]&&c[2]==Ci[2]&&(c[3]||("http:"===c[1]?80:443))==(Ci[3]||("http:"===Ci[1]?80:443)))),u.data&&u.processData&&"string"!=typeof u.data&&(u.data=X.param(u.data,u.traditional)),_(Oi,u,i,k),2===w)return k;
if(d=u.global,u.type=u.type.toUpperCase(),u.hasContent=!Ti.test(u.type),d&&0===X.active++&&X.event.trigger("ajaxStart"),!u.hasContent&&(u.data&&(u.url+=(Pi.test(u.url)?"&":"?")+u.data,delete u.data),a=u.url,u.cache===!1)){var S=X.now(),C=u.url.replace(Li,"$1_="+S);u.url=C+(C===u.url?(Pi.test(u.url)?"&":"?")+"_="+S:"")}(u.data&&u.hasContent&&u.contentType!==!1||i.contentType)&&k.setRequestHeader("Content-Type",u.contentType),u.ifModified&&(a=a||u.url,X.lastModified[a]&&k.setRequestHeader("If-Modified-Since",X.lastModified[a]),X.etag[a]&&k.setRequestHeader("If-None-Match",X.etag[a])),k.setRequestHeader("Accept",u.dataTypes[0]&&u.accepts[u.dataTypes[0]]?u.accepts[u.dataTypes[0]]+("*"!==u.dataTypes[0]?", "+Bi+"; q=0.01":""):u.accepts["*"]);
for(h in u.headers)k.setRequestHeader(h,u.headers[h]);if(u.beforeSend&&(u.beforeSend.call(p,k,u)===!1||2===w))return k.abort();x="abort";for(h in{success:1,error:1,complete:1})k[h](u[h]);if(l=_(Ri,u,i,k)){k.readyState=1,d&&f.trigger("ajaxSend",[k,u]),u.async&&u.timeout>0&&(o=setTimeout(function(){k.abort("timeout")},u.timeout));try{w=1,l.send(y,n)}catch(A){if(!(2>w))throw A;n(-1,A)}}else n(-1,"No Transport");return k},active:0,lastModified:{},etag:{}});var qi=[],Vi=/\?/,ji=/(=)\?(?=&|$)|\?\?/,Fi=X.now();
X.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=qi.pop()||X.expando+"_"+Fi++;return this[e]=!0,e}}),X.ajaxPrefilter("json jsonp",function(i,n,a){var s,r,l,o=i.data,c=i.url,d=i.jsonp!==!1,h=d&&ji.test(c),u=d&&!h&&"string"==typeof o&&!(i.contentType||"").indexOf("application/x-www-form-urlencoded")&&ji.test(o);return"jsonp"===i.dataTypes[0]||h||u?(s=i.jsonpCallback=X.isFunction(i.jsonpCallback)?i.jsonpCallback():i.jsonpCallback,r=e[s],h?i.url=c.replace(ji,"$1"+s):u?i.data=o.replace(ji,"$1"+s):d&&(i.url+=(Vi.test(c)?"&":"?")+i.jsonp+"="+s),i.converters["script json"]=function(){return l||X.error(s+" was not called"),l[0]
},i.dataTypes[0]="json",e[s]=function(){l=arguments},a.always(function(){e[s]=r,i[s]&&(i.jsonpCallback=n.jsonpCallback,qi.push(s)),l&&X.isFunction(r)&&r(l[0]),l=r=t}),"script"):t}),X.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){return X.globalEval(e),e}}}),X.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)
}),X.ajaxTransport("script",function(e){if(e.crossDomain){var i,n=j.head||j.getElementsByTagName("head")[0]||j.documentElement;return{send:function(a,s){i=j.createElement("script"),i.async="async",e.scriptCharset&&(i.charset=e.scriptCharset),i.src=e.url,i.onload=i.onreadystatechange=function(e,a){(a||!i.readyState||/loaded|complete/.test(i.readyState))&&(i.onload=i.onreadystatechange=null,n&&i.parentNode&&n.removeChild(i),i=t,a||s(200,"success"))},n.insertBefore(i,n.firstChild)},abort:function(){i&&i.onload(0,1)
}}}});var Ui,Hi=e.ActiveXObject?function(){for(var e in Ui)Ui[e](0,1)}:!1,zi=0;X.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&M()||P()}:M,function(e){X.extend(X.support,{ajax:!!e,cors:!!e&&"withCredentials"in e})}(X.ajaxSettings.xhr()),X.support.ajax&&X.ajaxTransport(function(i){if(!i.crossDomain||X.support.cors){var n;return{send:function(a,s){var r,l,o=i.xhr();if(i.username?o.open(i.type,i.url,i.async,i.username,i.password):o.open(i.type,i.url,i.async),i.xhrFields)for(l in i.xhrFields)o[l]=i.xhrFields[l];
i.mimeType&&o.overrideMimeType&&o.overrideMimeType(i.mimeType),i.crossDomain||a["X-Requested-With"]||(a["X-Requested-With"]="XMLHttpRequest");try{for(l in a)o.setRequestHeader(l,a[l])}catch(c){}o.send(i.hasContent&&i.data||null),n=function(e,a){var l,c,d,h,u;try{if(n&&(a||4===o.readyState))if(n=t,r&&(o.onreadystatechange=X.noop,Hi&&delete Ui[r]),a)4!==o.readyState&&o.abort();else{l=o.status,d=o.getAllResponseHeaders(),h={},u=o.responseXML,u&&u.documentElement&&(h.xml=u);try{h.text=o.responseText}catch(e){}try{c=o.statusText
}catch(p){c=""}l||!i.isLocal||i.crossDomain?1223===l&&(l=204):l=h.text?200:404}}catch(f){a||s(-1,f)}h&&s(l,c,h,d)},i.async?4===o.readyState?setTimeout(n,0):(r=++zi,Hi&&(Ui||(Ui={},X(e).unload(Hi)),Ui[r]=n),o.onreadystatechange=n):n()},abort:function(){n&&n(0,1)}}}});var Wi,Yi,Ji=/^(?:toggle|show|hide)$/,Ki=RegExp("^(?:([-+])=|)("+Z+")([a-z%]*)$","i"),Gi=/queueHooks$/,Qi=[O],Xi={"*":[function(e,t){var i,n,a,s=this.createTween(e,t),r=Ki.exec(t),l=s.cur(),o=+l||0,c=1;if(r){if(i=+r[2],n=r[3]||(X.cssNumber[e]?"":"px"),"px"!==n&&o){o=X.css(s.elem,e,!0)||i||1;
do a=c=c||".5",o/=c,X.style(s.elem,e,o+n),c=s.cur()/l;while(1!==c&&c!==a)}s.unit=n,s.start=o,s.end=r[1]?o+(r[1]+1)*i:i}return s}]};X.Animation=X.extend(E,{tweener:function(e,t){X.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");for(var i,n=0,a=e.length;a>n;n++)i=e[n],Xi[i]=Xi[i]||[],Xi[i].unshift(t)},prefilter:function(e,t){t?Qi.unshift(e):Qi.push(e)}}),X.Tween=R,R.prototype={constructor:R,init:function(e,t,i,n,a,s){this.elem=e,this.prop=i,this.easing=a||"swing",this.options=t,this.start=this.now=this.cur(),this.end=n,this.unit=s||(X.cssNumber[i]?"":"px")
},cur:function(){var e=R.propHooks[this.prop];return e&&e.get?e.get(this):R.propHooks._default.get(this)},run:function(e){var t,i=R.propHooks[this.prop];return this.pos=t=X.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration),this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),i&&i.set?i.set(this):R.propHooks._default.set(this),this}},R.prototype.init.prototype=R.prototype,R.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=X.css(e.elem,e.prop,!1,""),t&&"auto"!==t?t:0):e.elem[e.prop]
},set:function(e){X.fx.step[e.prop]?X.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[X.cssProps[e.prop]]||X.cssHooks[e.prop])?X.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},R.propHooks.scrollTop=R.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},X.each(["toggle","show","hide"],function(e,t){var i=X.fn[t];X.fn[t]=function(n,a,s){return null==n||"boolean"==typeof n||!e&&X.isFunction(n)&&X.isFunction(a)?i.apply(this,arguments):this.animate(B(t,!0),n,a,s)
}}),X.fn.extend({fadeTo:function(e,t,i,n){return this.filter(v).css("opacity",0).show().end().animate({opacity:t},e,i,n)},animate:function(e,t,i,n){var a=X.isEmptyObject(e),s=X.speed(t,i,n),r=function(){var t=E(this,X.extend({},e),s);a&&t.stop(!0)};return a||s.queue===!1?this.each(r):this.queue(s.queue,r)},stop:function(e,i,n){var a=function(e){var t=e.stop;delete e.stop,t(n)};return"string"!=typeof e&&(n=i,i=e,e=t),i&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,i=null!=e&&e+"queueHooks",s=X.timers,r=X._data(this);
if(i)r[i]&&r[i].stop&&a(r[i]);else for(i in r)r[i]&&r[i].stop&&Gi.test(i)&&a(r[i]);for(i=s.length;i--;)s[i].elem!==this||null!=e&&s[i].queue!==e||(s[i].anim.stop(n),t=!1,s.splice(i,1));(t||!n)&&X.dequeue(this,e)})}}),X.each({slideDown:B("show"),slideUp:B("hide"),slideToggle:B("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){X.fn[e]=function(e,i,n){return this.animate(t,e,i,n)}}),X.speed=function(e,t,i){var n=e&&"object"==typeof e?X.extend({},e):{complete:i||!i&&t||X.isFunction(e)&&e,duration:e,easing:i&&t||t&&!X.isFunction(t)&&t};
return n.duration=X.fx.off?0:"number"==typeof n.duration?n.duration:n.duration in X.fx.speeds?X.fx.speeds[n.duration]:X.fx.speeds._default,(null==n.queue||n.queue===!0)&&(n.queue="fx"),n.old=n.complete,n.complete=function(){X.isFunction(n.old)&&n.old.call(this),n.queue&&X.dequeue(this,n.queue)},n},X.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},X.timers=[],X.fx=R.prototype.init,X.fx.tick=function(){for(var e,t=X.timers,i=0;t.length>i;i++)e=t[i],e()||t[i]!==e||t.splice(i--,1);
t.length||X.fx.stop()},X.fx.timer=function(e){e()&&X.timers.push(e)&&!Yi&&(Yi=setInterval(X.fx.tick,X.fx.interval))},X.fx.interval=13,X.fx.stop=function(){clearInterval(Yi),Yi=null},X.fx.speeds={slow:600,fast:200,_default:400},X.fx.step={},X.expr&&X.expr.filters&&(X.expr.filters.animated=function(e){return X.grep(X.timers,function(t){return e===t.elem}).length});var Zi=/^(?:body|html)$/i;X.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){X.offset.setOffset(this,e,t)
});var i,n,a,s,r,l,o,c,d,h,u=this[0],p=u&&u.ownerDocument;if(p)return(a=p.body)===u?X.offset.bodyOffset(u):(n=p.documentElement,X.contains(n,u)?(i=u.getBoundingClientRect(),s=$(p),r=n.clientTop||a.clientTop||0,l=n.clientLeft||a.clientLeft||0,o=s.pageYOffset||n.scrollTop,c=s.pageXOffset||n.scrollLeft,d=i.top+o-r,h=i.left+c-l,{top:d,left:h}):{top:0,left:0})},X.offset={bodyOffset:function(e){var t=e.offsetTop,i=e.offsetLeft;return X.support.doesNotIncludeMarginInBodyOffset&&(t+=parseFloat(X.css(e,"marginTop"))||0,i+=parseFloat(X.css(e,"marginLeft"))||0),{top:t,left:i}
},setOffset:function(e,t,i){var n=X.css(e,"position");"static"===n&&(e.style.position="relative");var a,s,r=X(e),l=r.offset(),o=X.css(e,"top"),c=X.css(e,"left"),d=("absolute"===n||"fixed"===n)&&X.inArray("auto",[o,c])>-1,h={},u={};d?(u=r.position(),a=u.top,s=u.left):(a=parseFloat(o)||0,s=parseFloat(c)||0),X.isFunction(t)&&(t=t.call(e,i,l)),null!=t.top&&(h.top=t.top-l.top+a),null!=t.left&&(h.left=t.left-l.left+s),"using"in t?t.using.call(e,h):r.css(h)}},X.fn.extend({position:function(){if(this[0]){var e=this[0],t=this.offsetParent(),i=this.offset(),n=Zi.test(t[0].nodeName)?{top:0,left:0}:t.offset();
return i.top-=parseFloat(X.css(e,"marginTop"))||0,i.left-=parseFloat(X.css(e,"marginLeft"))||0,n.top+=parseFloat(X.css(t[0],"borderTopWidth"))||0,n.left+=parseFloat(X.css(t[0],"borderLeftWidth"))||0,{top:i.top-n.top,left:i.left-n.left}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent||j.body;e&&!Zi.test(e.nodeName)&&"static"===X.css(e,"position");)e=e.offsetParent;return e||j.body})}}),X.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,i){var n=/Y/.test(i);
X.fn[e]=function(a){return X.access(this,function(e,a,s){var r=$(e);return s===t?r?i in r?r[i]:r.document.documentElement[a]:e[a]:(r?r.scrollTo(n?X(r).scrollLeft():s,n?s:X(r).scrollTop()):e[a]=s,t)},e,a,arguments.length,null)}}),X.each({Height:"height",Width:"width"},function(e,i){X.each({padding:"inner"+e,content:i,"":"outer"+e},function(n,a){X.fn[a]=function(a,s){var r=arguments.length&&(n||"boolean"!=typeof a),l=n||(a===!0||s===!0?"margin":"border");return X.access(this,function(i,n,a){var s;return X.isWindow(i)?i.document.documentElement["client"+e]:9===i.nodeType?(s=i.documentElement,Math.max(i.body["scroll"+e],s["scroll"+e],i.body["offset"+e],s["offset"+e],s["client"+e])):a===t?X.css(i,n,a,l):X.style(i,n,a,l)
},i,r?a:t,r)}})}),e.jQuery=e.$=X,"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return X})}(window),function(){var e=this,t=e._,i={},n=Array.prototype,a=Object.prototype,s=Function.prototype,r=n.push,l=n.slice,o=n.concat,c=a.toString,d=a.hasOwnProperty,h=n.forEach,u=n.map,p=n.reduce,f=n.reduceRight,m=n.filter,g=n.every,v=n.some,y=n.indexOf,b=n.lastIndexOf,w=Array.isArray,x=Object.keys,k=s.bind,S=function(e){return e instanceof S?e:this instanceof S?(this._wrapped=e,void 0):new S(e)
};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=S),exports._=S):e._=S,S.VERSION="1.4.4";var C=S.each=S.forEach=function(e,t,n){if(null!=e)if(h&&e.forEach===h)e.forEach(t,n);else if(e.length===+e.length){for(var a=0,s=e.length;s>a;a++)if(t.call(n,e[a],a,e)===i)return}else for(var r in e)if(S.has(e,r)&&t.call(n,e[r],r,e)===i)return};S.map=S.collect=function(e,t,i){var n=[];return null==e?n:u&&e.map===u?e.map(t,i):(C(e,function(e,a,s){n[n.length]=t.call(i,e,a,s)
}),n)};var _="Reduce of empty array with no initial value";S.reduce=S.foldl=S.inject=function(e,t,i,n){var a=arguments.length>2;if(null==e&&(e=[]),p&&e.reduce===p)return n&&(t=S.bind(t,n)),a?e.reduce(t,i):e.reduce(t);if(C(e,function(e,s,r){a?i=t.call(n,i,e,s,r):(i=e,a=!0)}),!a)throw new TypeError(_);return i},S.reduceRight=S.foldr=function(e,t,i,n){var a=arguments.length>2;if(null==e&&(e=[]),f&&e.reduceRight===f)return n&&(t=S.bind(t,n)),a?e.reduceRight(t,i):e.reduceRight(t);var s=e.length;if(s!==+s){var r=S.keys(e);
s=r.length}if(C(e,function(l,o,c){o=r?r[--s]:--s,a?i=t.call(n,i,e[o],o,c):(i=e[o],a=!0)}),!a)throw new TypeError(_);return i},S.find=S.detect=function(e,t,i){var n;return A(e,function(e,a,s){return t.call(i,e,a,s)?(n=e,!0):void 0}),n},S.filter=S.select=function(e,t,i){var n=[];return null==e?n:m&&e.filter===m?e.filter(t,i):(C(e,function(e,a,s){t.call(i,e,a,s)&&(n[n.length]=e)}),n)},S.reject=function(e,t,i){return S.filter(e,function(e,n,a){return!t.call(i,e,n,a)},i)},S.every=S.all=function(e,t,n){t||(t=S.identity);
var a=!0;return null==e?a:g&&e.every===g?e.every(t,n):(C(e,function(e,s,r){return(a=a&&t.call(n,e,s,r))?void 0:i}),!!a)};var A=S.some=S.any=function(e,t,n){t||(t=S.identity);var a=!1;return null==e?a:v&&e.some===v?e.some(t,n):(C(e,function(e,s,r){return a||(a=t.call(n,e,s,r))?i:void 0}),!!a)};S.contains=S.include=function(e,t){return null==e?!1:y&&e.indexOf===y?-1!=e.indexOf(t):A(e,function(e){return e===t})},S.invoke=function(e,t){var i=l.call(arguments,2),n=S.isFunction(t);return S.map(e,function(e){return(n?t:e[t]).apply(e,i)
})},S.pluck=function(e,t){return S.map(e,function(e){return e[t]})},S.where=function(e,t,i){return S.isEmpty(t)?i?null:[]:S[i?"find":"filter"](e,function(e){for(var i in t)if(t[i]!==e[i])return!1;return!0})},S.findWhere=function(e,t){return S.where(e,t,!0)},S.max=function(e,t,i){if(!t&&S.isArray(e)&&e[0]===+e[0]&&65535>e.length)return Math.max.apply(Math,e);if(!t&&S.isEmpty(e))return-1/0;var n={computed:-1/0,value:-1/0};return C(e,function(e,a,s){var r=t?t.call(i,e,a,s):e;r>=n.computed&&(n={value:e,computed:r})
}),n.value},S.min=function(e,t,i){if(!t&&S.isArray(e)&&e[0]===+e[0]&&65535>e.length)return Math.min.apply(Math,e);if(!t&&S.isEmpty(e))return 1/0;var n={computed:1/0,value:1/0};return C(e,function(e,a,s){var r=t?t.call(i,e,a,s):e;n.computed>r&&(n={value:e,computed:r})}),n.value},S.shuffle=function(e){var t,i=0,n=[];return C(e,function(e){t=S.random(i++),n[i-1]=n[t],n[t]=e}),n};var I=function(e){return S.isFunction(e)?e:function(t){return t[e]}};S.sortBy=function(e,t,i){var n=I(t);return S.pluck(S.map(e,function(e,t,a){return{value:e,index:t,criteria:n.call(i,e,t,a)}
}).sort(function(e,t){var i=e.criteria,n=t.criteria;if(i!==n){if(i>n||void 0===i)return 1;if(n>i||void 0===n)return-1}return e.index<t.index?-1:1}),"value")};var T=function(e,t,i,n){var a={},s=I(t||S.identity);return C(e,function(t,r){var l=s.call(i,t,r,e);n(a,l,t)}),a};S.groupBy=function(e,t,i){return T(e,t,i,function(e,t,i){(S.has(e,t)?e[t]:e[t]=[]).push(i)})},S.countBy=function(e,t,i){return T(e,t,i,function(e,t){S.has(e,t)||(e[t]=0),e[t]++})},S.sortedIndex=function(e,t,i,n){i=null==i?S.identity:I(i);
for(var a=i.call(n,t),s=0,r=e.length;r>s;){var l=s+r>>>1;a>i.call(n,e[l])?s=l+1:r=l}return s},S.toArray=function(e){return e?S.isArray(e)?l.call(e):e.length===+e.length?S.map(e,S.identity):S.values(e):[]},S.size=function(e){return null==e?0:e.length===+e.length?e.length:S.keys(e).length},S.first=S.head=S.take=function(e,t,i){return null==e?void 0:null==t||i?e[0]:l.call(e,0,t)},S.initial=function(e,t,i){return l.call(e,0,e.length-(null==t||i?1:t))},S.last=function(e,t,i){return null==e?void 0:null==t||i?e[e.length-1]:l.call(e,Math.max(e.length-t,0))
},S.rest=S.tail=S.drop=function(e,t,i){return l.call(e,null==t||i?1:t)},S.compact=function(e){return S.filter(e,S.identity)};var M=function(e,t,i){return C(e,function(e){S.isArray(e)?t?r.apply(i,e):M(e,t,i):i.push(e)}),i};S.flatten=function(e,t){return M(e,t,[])},S.without=function(e){return S.difference(e,l.call(arguments,1))},S.uniq=S.unique=function(e,t,i,n){S.isFunction(t)&&(n=i,i=t,t=!1);var a=i?S.map(e,i,n):e,s=[],r=[];return C(a,function(i,n){(t?n&&r[r.length-1]===i:S.contains(r,i))||(r.push(i),s.push(e[n]))
}),s},S.union=function(){return S.uniq(o.apply(n,arguments))},S.intersection=function(e){var t=l.call(arguments,1);return S.filter(S.uniq(e),function(e){return S.every(t,function(t){return S.indexOf(t,e)>=0})})},S.difference=function(e){var t=o.apply(n,l.call(arguments,1));return S.filter(e,function(e){return!S.contains(t,e)})},S.zip=function(){for(var e=l.call(arguments),t=S.max(S.pluck(e,"length")),i=Array(t),n=0;t>n;n++)i[n]=S.pluck(e,""+n);return i},S.object=function(e,t){if(null==e)return{};
for(var i={},n=0,a=e.length;a>n;n++)t?i[e[n]]=t[n]:i[e[n][0]]=e[n][1];return i},S.indexOf=function(e,t,i){if(null==e)return-1;var n=0,a=e.length;if(i){if("number"!=typeof i)return n=S.sortedIndex(e,t),e[n]===t?n:-1;n=0>i?Math.max(0,a+i):i}if(y&&e.indexOf===y)return e.indexOf(t,i);for(;a>n;n++)if(e[n]===t)return n;return-1},S.lastIndexOf=function(e,t,i){if(null==e)return-1;var n=null!=i;if(b&&e.lastIndexOf===b)return n?e.lastIndexOf(t,i):e.lastIndexOf(t);for(var a=n?i:e.length;a--;)if(e[a]===t)return a;
return-1},S.range=function(e,t,i){1>=arguments.length&&(t=e||0,e=0),i=arguments[2]||1;for(var n=Math.max(Math.ceil((t-e)/i),0),a=0,s=Array(n);n>a;)s[a++]=e,e+=i;return s},S.bind=function(e,t){if(e.bind===k&&k)return k.apply(e,l.call(arguments,1));var i=l.call(arguments,2);return function(){return e.apply(t,i.concat(l.call(arguments)))}},S.partial=function(e){var t=l.call(arguments,1);return function(){return e.apply(this,t.concat(l.call(arguments)))}},S.bindAll=function(e){var t=l.call(arguments,1);
return 0===t.length&&(t=S.functions(e)),C(t,function(t){e[t]=S.bind(e[t],e)}),e},S.memoize=function(e,t){var i={};return t||(t=S.identity),function(){var n=t.apply(this,arguments);return S.has(i,n)?i[n]:i[n]=e.apply(this,arguments)}},S.delay=function(e,t){var i=l.call(arguments,2);return setTimeout(function(){return e.apply(null,i)},t)},S.defer=function(e){return S.delay.apply(S,[e,1].concat(l.call(arguments,1)))},S.throttle=function(e,t){var i,n,a,s,r=0,l=function(){r=new Date,a=null,s=e.apply(i,n)
};return function(){var o=new Date,c=t-(o-r);return i=this,n=arguments,0>=c?(clearTimeout(a),a=null,r=o,s=e.apply(i,n)):a||(a=setTimeout(l,c)),s}},S.debounce=function(e,t,i){var n,a;return function(){var s=this,r=arguments,l=function(){n=null,i||(a=e.apply(s,r))},o=i&&!n;return clearTimeout(n),n=setTimeout(l,t),o&&(a=e.apply(s,r)),a}},S.once=function(e){var t,i=!1;return function(){return i?t:(i=!0,t=e.apply(this,arguments),e=null,t)}},S.wrap=function(e,t){return function(){var i=[e];return r.apply(i,arguments),t.apply(this,i)
}},S.compose=function(){var e=arguments;return function(){for(var t=arguments,i=e.length-1;i>=0;i--)t=[e[i].apply(this,t)];return t[0]}},S.after=function(e,t){return 0>=e?t():function(){return 1>--e?t.apply(this,arguments):void 0}},S.keys=x||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var t=[];for(var i in e)S.has(e,i)&&(t[t.length]=i);return t},S.values=function(e){var t=[];for(var i in e)S.has(e,i)&&t.push(e[i]);return t},S.pairs=function(e){var t=[];for(var i in e)S.has(e,i)&&t.push([i,e[i]]);
return t},S.invert=function(e){var t={};for(var i in e)S.has(e,i)&&(t[e[i]]=i);return t},S.functions=S.methods=function(e){var t=[];for(var i in e)S.isFunction(e[i])&&t.push(i);return t.sort()},S.extend=function(e){return C(l.call(arguments,1),function(t){if(t)for(var i in t)e[i]=t[i]}),e},S.pick=function(e){var t={},i=o.apply(n,l.call(arguments,1));return C(i,function(i){i in e&&(t[i]=e[i])}),t},S.omit=function(e){var t={},i=o.apply(n,l.call(arguments,1));for(var a in e)S.contains(i,a)||(t[a]=e[a]);
return t},S.defaults=function(e){return C(l.call(arguments,1),function(t){if(t)for(var i in t)null==e[i]&&(e[i]=t[i])}),e},S.clone=function(e){return S.isObject(e)?S.isArray(e)?e.slice():S.extend({},e):e},S.tap=function(e,t){return t(e),e};var P=function(e,t,i,n){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return e===t;e instanceof S&&(e=e._wrapped),t instanceof S&&(t=t._wrapped);var a=c.call(e);if(a!=c.call(t))return!1;switch(a){case"[object String]":return e==t+"";case"[object Number]":return e!=+e?t!=+t:0==e?1/e==1/t:e==+t;
case"[object Date]":case"[object Boolean]":return+e==+t;case"[object RegExp]":return e.source==t.source&&e.global==t.global&&e.multiline==t.multiline&&e.ignoreCase==t.ignoreCase}if("object"!=typeof e||"object"!=typeof t)return!1;for(var s=i.length;s--;)if(i[s]==e)return n[s]==t;i.push(e),n.push(t);var r=0,l=!0;if("[object Array]"==a){if(r=e.length,l=r==t.length)for(;r--&&(l=P(e[r],t[r],i,n)););}else{var o=e.constructor,d=t.constructor;if(o!==d&&!(S.isFunction(o)&&o instanceof o&&S.isFunction(d)&&d instanceof d))return!1;
for(var h in e)if(S.has(e,h)&&(r++,!(l=S.has(t,h)&&P(e[h],t[h],i,n))))break;if(l){for(h in t)if(S.has(t,h)&&!r--)break;l=!r}}return i.pop(),n.pop(),l};S.isEqual=function(e,t){return P(e,t,[],[])},S.isEmpty=function(e){if(null==e)return!0;if(S.isArray(e)||S.isString(e))return 0===e.length;for(var t in e)if(S.has(e,t))return!1;return!0},S.isElement=function(e){return!(!e||1!==e.nodeType)},S.isArray=w||function(e){return"[object Array]"==c.call(e)},S.isObject=function(e){return e===Object(e)},C(["Arguments","Function","String","Number","Date","RegExp"],function(e){S["is"+e]=function(t){return c.call(t)=="[object "+e+"]"
}}),S.isArguments(arguments)||(S.isArguments=function(e){return!(!e||!S.has(e,"callee"))}),S.isFunction=function(e){return"function"==typeof e},S.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},S.isNaN=function(e){return S.isNumber(e)&&e!=+e},S.isBoolean=function(e){return e===!0||e===!1||"[object Boolean]"==c.call(e)},S.isNull=function(e){return null===e},S.isUndefined=function(e){return void 0===e},S.has=function(e,t){return d.call(e,t)},S.noConflict=function(){return e._=t,this
},S.identity=function(e){return e},S.times=function(e,t,i){for(var n=Array(e),a=0;e>a;a++)n[a]=t.call(i,a);return n},S.random=function(e,t){return null==t&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))};var D={escape:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","/":"&#x2F;"}};D.unescape=S.invert(D.escape);var L={escape:RegExp("["+S.keys(D.escape).join("")+"]","g"),unescape:RegExp("("+S.keys(D.unescape).join("|")+")","g")};S.each(["escape","unescape"],function(e){S[e]=function(t){return null==t?"":(""+t).replace(L[e],function(t){return D[e][t]
})}}),S.result=function(e,t){if(null==e)return null;var i=e[t];return S.isFunction(i)?i.call(e):i},S.mixin=function(e){C(S.functions(e),function(t){var i=S[t]=e[t];S.prototype[t]=function(){var e=[this._wrapped];return r.apply(e,arguments),B.call(this,i.apply(S,e))}})};var E=0;S.uniqueId=function(e){var t=++E+"";return e?e+t:t},S.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var N=/(.)^/,O={"'":"'","\\":"\\","\r":"r","\n":"n","	":"t","\u2028":"u2028","\u2029":"u2029"},R=/\\|'|\r|\n|\t|\u2028|\u2029/g;
S.template=function(e,t,i){var n;i=S.defaults({},i,S.templateSettings);var a=RegExp([(i.escape||N).source,(i.interpolate||N).source,(i.evaluate||N).source].join("|")+"|$","g"),s=0,r="__p+='";e.replace(a,function(t,i,n,a,l){return r+=e.slice(s,l).replace(R,function(e){return"\\"+O[e]}),i&&(r+="'+\n((__t=("+i+"))==null?'':_.escape(__t))+\n'"),n&&(r+="'+\n((__t=("+n+"))==null?'':__t)+\n'"),a&&(r+="';\n"+a+"\n__p+='"),s=l+t.length,t}),r+="';\n",i.variable||(r="with(obj||{}){\n"+r+"}\n"),r="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+r+"return __p;\n";
try{n=Function(i.variable||"obj","_",r)}catch(l){throw l.source=r,l}if(t)return n(t,S);var o=function(e){return n.call(this,e,S)};return o.source="function("+(i.variable||"obj")+"){\n"+r+"}",o},S.chain=function(e){return S(e).chain()};var B=function(e){return this._chain?S(e).chain():e};S.mixin(S),C(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=n[e];S.prototype[e]=function(){var i=this._wrapped;return t.apply(i,arguments),"shift"!=e&&"splice"!=e||0!==i.length||delete i[0],B.call(this,i)
}}),C(["concat","join","slice"],function(e){var t=n[e];S.prototype[e]=function(){return B.call(this,t.apply(this._wrapped,arguments))}}),S.extend(S.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this),define("underscore",function(){}),function(){var e,t=this,i=t.Backbone,n=Array.prototype.slice,a=Array.prototype.splice;e="undefined"!=typeof exports?exports:t.Backbone={},e.VERSION="0.9.2";var s=t._;s||void 0===require||(s=require("underscore"));
var r=t.jQuery||t.Zepto||t.ender;e.setDomLibrary=function(e){r=e},e.noConflict=function(){return t.Backbone=i,this},e.emulateHTTP=!1,e.emulateJSON=!1;var l=/\s+/,o=e.Events={on:function(e,t,i){var n,a,s,r,o;if(!t)return this;for(e=e.split(l),n=this._callbacks||(this._callbacks={});a=e.shift();)o=n[a],s=o?o.tail:{},s.next=r={},s.context=i,s.callback=t,n[a]={tail:r,next:o?o.next:s};return this},off:function(e,t,i){var n,a,r,o,c,d;if(a=this._callbacks){if(!(e||t||i))return delete this._callbacks,this;
for(e=e?e.split(l):s.keys(a);n=e.shift();)if(r=a[n],delete a[n],r&&(t||i))for(o=r.tail;(r=r.next)!==o;)c=r.callback,d=r.context,(t&&c!==t||i&&d!==i)&&this.on(n,c,d);return this}},trigger:function(e){var t,i,a,s,r,o,c;if(!(a=this._callbacks))return this;for(o=a.all,e=e.split(l),c=n.call(arguments,1);t=e.shift();){if(i=a[t])for(s=i.tail;(i=i.next)!==s;)i.callback.apply(i.context||this,c);if(i=o)for(s=i.tail,r=[t].concat(c);(i=i.next)!==s;)i.callback.apply(i.context||this,r)}return this}};o.bind=o.on,o.unbind=o.off;
var c=e.Model=function(e,t){var i;e||(e={}),t&&t.parse&&(e=this.parse(e)),(i=A(this,"defaults"))&&(e=s.extend({},i,e)),t&&t.collection&&(this.collection=t.collection),this.attributes={},this._escapedAttributes={},this.cid=s.uniqueId("c"),this.changed={},this._silent={},this._pending={},this.set(e,{silent:!0}),this.changed={},this._silent={},this._pending={},this._previousAttributes=s.clone(this.attributes),this.initialize.apply(this,arguments)};s.extend(c.prototype,o,{changed:null,_silent:null,_pending:null,idAttribute:"id",initialize:function(){},toJSON:function(){return s.clone(this.attributes)
},get:function(e){return this.attributes[e]},escape:function(e){var t;if(t=this._escapedAttributes[e])return t;var i=this.get(e);return this._escapedAttributes[e]=s.escape(null==i?"":""+i)},has:function(e){return null!=this.get(e)},set:function(e,t,i){var n,a,r;if(s.isObject(e)||null==e?(n=e,i=t):(n={},n[e]=t),i||(i={}),!n)return this;if(n instanceof c&&(n=n.attributes),i.unset)for(a in n)n[a]=void 0;if(!this._validate(n,i))return!1;this.idAttribute in n&&(this.id=n[this.idAttribute]);var l=i.changes={},o=this.attributes,d=this._escapedAttributes,h=this._previousAttributes||{};
for(a in n)r=n[a],(!s.isEqual(o[a],r)||i.unset&&s.has(o,a))&&(delete d[a],(i.silent?this._silent:l)[a]=!0),i.unset?delete o[a]:o[a]=r,s.isEqual(h[a],r)&&s.has(o,a)==s.has(h,a)?(delete this.changed[a],delete this._pending[a]):(this.changed[a]=r,i.silent||(this._pending[a]=!0));return i.silent||this.change(i),this},unset:function(e,t){return(t||(t={})).unset=!0,this.set(e,null,t)},clear:function(e){return(e||(e={})).unset=!0,this.set(s.clone(this.attributes),e)},fetch:function(t){t=t?s.clone(t):{};
var i=this,n=t.success;return t.success=function(e,a,s){return i.set(i.parse(e,s),t)?(n&&n(i,e),void 0):!1},t.error=e.wrapError(t.error,i,t),(this.sync||e.sync).call(this,"read",this,t)},save:function(t,i,n){var a,r;if(s.isObject(t)||null==t?(a=t,n=i):(a={},a[t]=i),n=n?s.clone(n):{},n.wait){if(!this._validate(a,n))return!1;r=s.clone(this.attributes)}var l=s.extend({},n,{silent:!0});if(a&&!this.set(a,n.wait?l:n))return!1;var o=this,c=n.success;n.success=function(e,t,i){var r=o.parse(e,i);return n.wait&&(delete n.wait,r=s.extend(a||{},r)),o.set(r,n)?(c?c(o,e):o.trigger("sync",o,e,n),void 0):!1
},n.error=e.wrapError(n.error,o,n);var d=this.isNew()?"create":"update",h=(this.sync||e.sync).call(this,d,this,n);return n.wait&&this.set(r,l),h},destroy:function(t){t=t?s.clone(t):{};var i=this,n=t.success,a=function(){i.trigger("destroy",i,i.collection,t)};if(this.isNew())return a(),!1;t.success=function(e){t.wait&&a(),n?n(i,e):i.trigger("sync",i,e,t)},t.error=e.wrapError(t.error,i,t);var r=(this.sync||e.sync).call(this,"delete",this,t);return t.wait||a(),r},url:function(){var e=A(this,"urlRoot")||A(this.collection,"url")||I();
return this.isNew()?e:e+("/"==e.charAt(e.length-1)?"":"/")+encodeURIComponent(this.id)},parse:function(e){return e},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return null==this.id},change:function(e){e||(e={});var t=this._changing;this._changing=!0;for(var i in this._silent)this._pending[i]=!0;var n=s.extend({},e.changes,this._silent);this._silent={};for(var i in n)this.trigger("change:"+i,this,this.get(i),e);if(t)return this;for(;!s.isEmpty(this._pending);){this._pending={},this.trigger("change",this,e);
for(var i in this.changed)this._pending[i]||this._silent[i]||delete this.changed[i];this._previousAttributes=s.clone(this.attributes)}return this._changing=!1,this},hasChanged:function(e){return arguments.length?s.has(this.changed,e):!s.isEmpty(this.changed)},changedAttributes:function(e){if(!e)return this.hasChanged()?s.clone(this.changed):!1;var t,i=!1,n=this._previousAttributes;for(var a in e)s.isEqual(n[a],t=e[a])||((i||(i={}))[a]=t);return i},previous:function(e){return arguments.length&&this._previousAttributes?this._previousAttributes[e]:null
},previousAttributes:function(){return s.clone(this._previousAttributes)},isValid:function(){return!this.validate(this.attributes)},_validate:function(e,t){if(t.silent||!this.validate)return!0;e=s.extend({},this.attributes,e);var i=this.validate(e,t);return i?(t&&t.error?t.error(this,i,t):this.trigger("error",this,i,t),!1):!0}});var d=e.Collection=function(e,t){t||(t={}),t.model&&(this.model=t.model),t.comparator&&(this.comparator=t.comparator),this._reset(),this.initialize.apply(this,arguments),e&&this.reset(e,{silent:!0,parse:t.parse})
};s.extend(d.prototype,o,{model:c,initialize:function(){},toJSON:function(e){return this.map(function(t){return t.toJSON(e)})},add:function(e,t){var i,n,r,l,o,c,d={},h={},u=[];for(t||(t={}),e=s.isArray(e)?e.slice():[e],i=0,r=e.length;r>i;i++){if(!(l=e[i]=this._prepareModel(e[i],t)))throw Error("Can't add an invalid model to a collection");o=l.cid,c=l.id,d[o]||this._byCid[o]||null!=c&&(h[c]||this._byId[c])?u.push(i):d[o]=h[c]=l}for(i=u.length;i--;)e.splice(u[i],1);for(i=0,r=e.length;r>i;i++)(l=e[i]).on("all",this._onModelEvent,this),this._byCid[l.cid]=l,null!=l.id&&(this._byId[l.id]=l);
if(this.length+=r,n=null!=t.at?t.at:this.models.length,a.apply(this.models,[n,0].concat(e)),this.comparator&&this.sort({silent:!0}),t.silent)return this;for(i=0,r=this.models.length;r>i;i++)d[(l=this.models[i]).cid]&&(t.index=i,l.trigger("add",l,this,t));return this},remove:function(e,t){var i,n,a,r;for(t||(t={}),e=s.isArray(e)?e.slice():[e],i=0,n=e.length;n>i;i++)r=this.getByCid(e[i])||this.get(e[i]),r&&(delete this._byId[r.id],delete this._byCid[r.cid],a=this.indexOf(r),this.models.splice(a,1),this.length--,t.silent||(t.index=a,r.trigger("remove",r,this,t)),this._removeReference(r));
return this},push:function(e,t){return e=this._prepareModel(e,t),this.add(e,t),e},pop:function(e){var t=this.at(this.length-1);return this.remove(t,e),t},unshift:function(e,t){return e=this._prepareModel(e,t),this.add(e,s.extend({at:0},t)),e},shift:function(e){var t=this.at(0);return this.remove(t,e),t},get:function(e){return null==e?void 0:this._byId[null!=e.id?e.id:e]},getByCid:function(e){return e&&this._byCid[e.cid||e]},at:function(e){return this.models[e]},where:function(e){return s.isEmpty(e)?[]:this.filter(function(t){for(var i in e)if(e[i]!==t.get(i))return!1;
return!0})},sort:function(e){if(e||(e={}),!this.comparator)throw Error("Cannot sort a set without a comparator");var t=s.bind(this.comparator,this);return 1==this.comparator.length?this.models=this.sortBy(t):this.models.sort(t),e.silent||this.trigger("reset",this,e),this},pluck:function(e){return s.map(this.models,function(t){return t.get(e)})},reset:function(e,t){e||(e=[]),t||(t={});for(var i=0,n=this.models.length;n>i;i++)this._removeReference(this.models[i]);return this._reset(),this.add(e,s.extend({silent:!0},t)),t.silent||this.trigger("reset",this,t),this
},fetch:function(t){t=t?s.clone(t):{},void 0===t.parse&&(t.parse=!0);var i=this,n=t.success;return t.success=function(e,a,s){i[t.add?"add":"reset"](i.parse(e,s),t),n&&n(i,e)},t.error=e.wrapError(t.error,i,t),(this.sync||e.sync).call(this,"read",this,t)},create:function(e,t){var i=this;if(t=t?s.clone(t):{},e=this._prepareModel(e,t),!e)return!1;t.wait||i.add(e,t);var n=t.success;return t.success=function(a,s){t.wait&&i.add(a,t),n?n(a,s):a.trigger("sync",e,s,t)},e.save(null,t),e},parse:function(e){return e
},chain:function(){return s(this.models).chain()},_reset:function(){this.length=0,this.models=[],this._byId={},this._byCid={}},_prepareModel:function(e,t){if(t||(t={}),e instanceof c)e.collection||(e.collection=this);else{var i=e;t.collection=this,e=new this.model(i,t),e._validate(e.attributes,t)||(e=!1)}return e},_removeReference:function(e){this==e.collection&&delete e.collection,e.off("all",this._onModelEvent,this)},_onModelEvent:function(e,t,i,n){("add"!=e&&"remove"!=e||i==this)&&("destroy"==e&&this.remove(t,n),t&&e==="change:"+t.idAttribute&&(delete this._byId[t.previous(t.idAttribute)],this._byId[t.id]=t),this.trigger.apply(this,arguments))
}});var h=["forEach","each","map","reduce","reduceRight","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","sortBy","sortedIndex","toArray","size","first","initial","rest","last","without","indexOf","shuffle","lastIndexOf","isEmpty","groupBy"];s.each(h,function(e){d.prototype[e]=function(){return s[e].apply(s,[this.models].concat(s.toArray(arguments)))}});var u=e.Router=function(e){e||(e={}),e.routes&&(this.routes=e.routes),this._bindRoutes(),this.initialize.apply(this,arguments)
},p=/:\w+/g,f=/\*\w+/g,m=/[-[\]{}()+?.,\\^$|#\s]/g;s.extend(u.prototype,o,{initialize:function(){},route:function(t,i,n){return e.history||(e.history=new g),s.isRegExp(t)||(t=this._routeToRegExp(t)),n||(n=this[i]),e.history.route(t,s.bind(function(a){var s=this._extractParameters(t,a);n&&n.apply(this,s),this.trigger.apply(this,["route:"+i].concat(s)),e.history.trigger("route",this,i,s)},this)),this},navigate:function(t,i){e.history.navigate(t,i)},_bindRoutes:function(){if(this.routes){var e=[];for(var t in this.routes)e.unshift([t,this.routes[t]]);
for(var i=0,n=e.length;n>i;i++)this.route(e[i][0],e[i][1],this[e[i][1]])}},_routeToRegExp:function(e){return e=e.replace(m,"\\$&").replace(p,"([^/]+)").replace(f,"(.*?)"),RegExp("^"+e+"$")},_extractParameters:function(e,t){return e.exec(t).slice(1)}});var g=e.History=function(){this.handlers=[],s.bindAll(this,"checkUrl")},v=/^[#\/]/,y=/msie [\w.]+/;g.started=!1,s.extend(g.prototype,o,{interval:50,getHash:function(e){var t=e?e.location:window.location,i=t.href.match(/#(.*)$/);return i?i[1]:""},getFragment:function(e,t){if(null==e)if(this._hasPushState||t){e=window.location.pathname;
var i=window.location.search;i&&(e+=i)}else e=this.getHash();return e.indexOf(this.options.root)||(e=e.substr(this.options.root.length)),e.replace(v,"")},start:function(e){if(g.started)throw Error("Backbone.history has already been started");g.started=!0,this.options=s.extend({},{root:"/"},this.options,e),this._wantsHashChange=this.options.hashChange!==!1,this._wantsPushState=!!this.options.pushState,this._hasPushState=!!(this.options.pushState&&window.history&&window.history.pushState);var t=this.getFragment(),i=document.documentMode,n=y.exec(navigator.userAgent.toLowerCase())&&(!i||7>=i);
n&&(this.iframe=r('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo("body")[0].contentWindow,this.navigate(t)),this._hasPushState?r(window).bind("popstate",this.checkUrl):this._wantsHashChange&&"onhashchange"in window&&!n?r(window).bind("hashchange",this.checkUrl):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),this.fragment=t;var a=window.location,l=a.pathname==this.options.root;return this._wantsHashChange&&this._wantsPushState&&!this._hasPushState&&!l?(this.fragment=this.getFragment(null,!0),window.location.replace(this.options.root+"#"+this.fragment),!0):(this._wantsPushState&&this._hasPushState&&l&&a.hash&&(this.fragment=this.getHash().replace(v,""),window.history.replaceState({},document.title,a.protocol+"//"+a.host+this.options.root+this.fragment)),this.options.silent?void 0:this.loadUrl())
},stop:function(){r(window).unbind("popstate",this.checkUrl).unbind("hashchange",this.checkUrl),clearInterval(this._checkUrlInterval),g.started=!1},route:function(e,t){this.handlers.unshift({route:e,callback:t})},checkUrl:function(){var e=this.getFragment();return e==this.fragment&&this.iframe&&(e=this.getFragment(this.getHash(this.iframe))),e==this.fragment?!1:(this.iframe&&this.navigate(e),this.loadUrl()||this.loadUrl(this.getHash()),void 0)},loadUrl:function(e){var t=this.fragment=this.getFragment(e),i=s.any(this.handlers,function(e){return e.route.test(t)?(e.callback(t),!0):void 0
});return i},navigate:function(e,t){if(!g.started)return!1;t&&t!==!0||(t={trigger:t});var i=(e||"").replace(v,"");this.fragment!=i&&(this._hasPushState?(0!=i.indexOf(this.options.root)&&(i=this.options.root+i),this.fragment=i,window.history[t.replace?"replaceState":"pushState"]({},document.title,i)):this._wantsHashChange?(this.fragment=i,this._updateHash(window.location,i,t.replace),this.iframe&&i!=this.getFragment(this.getHash(this.iframe))&&(t.replace||this.iframe.document.open().close(),this._updateHash(this.iframe.location,i,t.replace))):window.location.assign(this.options.root+e),t.trigger&&this.loadUrl(e))
},_updateHash:function(e,t,i){i?e.replace((""+e).replace(/(javascript:|#).*$/,"")+"#"+t):e.hash=t}});var b=e.View=function(e){this.cid=s.uniqueId("view"),this._configure(e||{}),this._ensureElement(),this.initialize.apply(this,arguments),this.delegateEvents()},w=/^(\S+)\s*(.*)$/,x=["model","collection","el","id","attributes","className","tagName"];s.extend(b.prototype,o,{tagName:"div",$:function(e){return this.$el.find(e)},initialize:function(){},render:function(){return this},remove:function(){return this.$el.remove(),this
},make:function(e,t,i){var n=document.createElement(e);return t&&r(n).attr(t),i&&r(n).html(i),n},setElement:function(e,t){return this.$el&&this.undelegateEvents(),this.$el=e instanceof r?e:r(e),this.el=this.$el[0],t!==!1&&this.delegateEvents(),this},delegateEvents:function(e){if(e||(e=A(this,"events"))){this.undelegateEvents();for(var t in e){var i=e[t];if(s.isFunction(i)||(i=this[e[t]]),!i)throw Error('Method "'+e[t]+'" does not exist');var n=t.match(w),a=n[1],r=n[2];i=s.bind(i,this),a+=".delegateEvents"+this.cid,""===r?this.$el.bind(a,i):this.$el.delegate(r,a,i)
}}},undelegateEvents:function(){this.$el.unbind(".delegateEvents"+this.cid)},_configure:function(e){this.options&&(e=s.extend({},this.options,e));for(var t=0,i=x.length;i>t;t++){var n=x[t];e[n]&&(this[n]=e[n])}this.options=e},_ensureElement:function(){if(this.el)this.setElement(this.el,!1);else{var e=A(this,"attributes")||{};this.id&&(e.id=this.id),this.className&&(e["class"]=this.className),this.setElement(this.make(this.tagName,e),!1)}}});var k=function(e,t){var i=_(this,e,t);return i.extend=this.extend,i
};c.extend=d.extend=u.extend=b.extend=k;var S={create:"POST",update:"PUT","delete":"DELETE",read:"GET"};e.sync=function(t,i,n){var a=S[t];n||(n={});var l={type:a,dataType:"json"};return n.url||(l.url=A(i,"url")||I()),void 0!==n.data||!i||"create"!=t&&"update"!=t||(l.contentType="application/json",l.data=JSON.stringify(i.toJSON())),e.emulateJSON&&(l.contentType="application/x-www-form-urlencoded",l.data=l.data?{model:l.data}:{}),e.emulateHTTP&&("PUT"===a||"DELETE"===a)&&(e.emulateJSON&&(l.data._method=a),l.type="POST",l.beforeSend=function(e){e.setRequestHeader("X-HTTP-Method-Override",a)
}),"GET"===l.type||e.emulateJSON||(l.processData=!1),r.ajax(s.extend(l,n))},e.wrapError=function(e,t,i){return function(n,a){a=n===t?a:n,e?e(t,a,i):t.trigger("error",t,a,i)}};var C=function(){},_=function(e,t,i){var n;return n=t&&t.hasOwnProperty("constructor")?t.constructor:function(){return e.apply(this,arguments)},s.extend(n,e),C.prototype=e.prototype,n.prototype=new C,t&&s.extend(n.prototype,t),i&&s.extend(n,i),n.prototype.constructor=n,n.__super__=e.prototype,n},A=function(e,t){return e&&e[t]?s.isFunction(e[t])?e[t]():e[t]:null
},I=function(){throw Error('A "url" property or function must be specified')}}.call(this),define("backbone",function(){}),define("plex/base/control/Dispatcher",["backbone"],function(){return _.clone(Backbone.Events)}),define("plex/base/control/utils/BrowserDetect",[],function(){var e={init:function(){this.browser=this.searchString(this.dataBrowser)||"Unknown Browser",this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"Unknown Version",this.OS=this.searchString(this.dataOS)||"Unknown OS"
},searchString:function(e){for(var t=0;e.length>t;t++){var i=e[t].string,n=e[t].prop;if(this.versionSearchString=e[t].versionSearch||e[t].identity,i){if(-1!=i.indexOf(e[t].subString))return e[t].identity}else if(n)return e[t].identity}},searchVersion:function(e){var t=e.indexOf(this.versionSearchString);if(-1!=t)return parseFloat(e.substring(t+this.versionSearchString.length+1))},dataBrowser:[{string:navigator.userAgent,subString:"Chrome",identity:"Chrome"},{string:navigator.vendor,subString:"Apple",identity:"Safari",versionSearch:"Version"},{prop:window.opera,identity:"Opera",versionSearch:"Version"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.userAgent,subString:"MSIE",identity:"Internet Explorer",versionSearch:"MSIE"},{string:navigator.userAgent,subString:"WiiU",identity:"Wii U"}],dataOS:[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.userAgent,subString:"iPhone",identity:"iOS"},{string:navigator.userAgent,subString:"iPad",identity:"iOS"},{string:navigator.userAgent,subString:"Android",identity:"Android"},{string:navigator.platform,subString:"Linux",identity:"Linux"}]};
return e.init(),e}),define("plex/base/control/utils/LocalStorageUtil",[],function(){function e(e,i,n){var a=n.storage?n.storage:t(n.session);return a?(d?i(a,n):e(a,n),void 0):(n.callback&&n.callback(),void 0)}function t(e){var t;return t=d?e?chrome.storage.sync:chrome.storage.local:e?window.sessionStorage:window.localStorage}function i(e,t){var i=t.key;try{t.callback(e.getItem(i))}catch(n){t.callback()}}function n(e,t){e.setItem(t.key,t.value),t.callback&&t.callback()}function a(e,t){e.removeItem(t.key),t.callback&&t.callback()
}function s(e,t){e.clear(),t.callback&&t.callback()}function r(e,t){var i=t.key;e.get(i,function(e){t.callback(e[i])})}function l(e,t){var i={};i[t.key]=t.value,e.set(i,t.callback)}function o(e,t){e.remove(t.key,t.callback)}function c(e,t){e.clear(t.callback)}var d="object"==typeof chrome&&chrome.storage;return{storage:function(e){return t(e)},get:function(t){e(i,r,t)},set:function(t){e(n,l,t)},remove:function(t){e(a,o,t)},clear:function(t){e(s,c,t)}}}),define("plex/base/model/LocalStorageModel",["plex/base/control/utils/LocalStorageUtil","jquery","backbone"],function(e,t){var i=Backbone.Model.extend({populated:!1,storage:e.storage(),save:function(t,i,n){var a,s=_.isFunction(this.storageKey)?this.storageKey():this.storageKey;
_.isObject(t)||null===t?(a=t,n=i):(a={},a[t]=i),n=n?_.clone(n):{},n.error=Backbone.wrapError(n.error,this,n),this.set(a,n);var r=JSON.stringify(this.toJSON());return e.set({storage:this.storage,key:s,value:r}),n.success&&n.success(this,!0),this},populate:function(e){return this.populated?this:this.fetch(e)},fetch:function(t){var i=_.isFunction(this.storageKey)?this.storageKey():this.storageKey;return t=t?_.clone(t):{},t.error=Backbone.wrapError(t.error,this,t),e.get({storage:this.storage,key:i,callback:_.bind(function(e){e?(this.populated=!0,this.set(this.parse(e),t),t.success&&t.success(this,e)):t.error(this,"Failed to get model from localStorage.")
},this)}),this},parse:function(e){return t.parseJSON(e)},destroy:function(t){var i=_.isFunction(this.storageKey)?this.storageKey():this.storageKey;return t=t?_.clone(t):{},t.error=Backbone.wrapError(t.error,this,t),e.remove({storage:this.storage,key:i,callback:_.bind(function(){this.trigger("destroy",this,this.collection,t),t.success&&t.success(this)},this)}),this}});return i}),define("plex/base/model/SettingsModel",["plex/base/control/utils/BrowserDetect","plex/base/model/LocalStorageModel"],function(e,t){var i=navigator.language||navigator.userLanguage||"en";
i=i.split("-")[0];var n=t.extend({storageKey:"settings",plexPassSettings:["dashboardMyLibraryEnabled","dashboardOnDeckEnabled","dashboardRecentlyAddedEnabled","dashboardChannelsEnabled","dashboardSharedLibrariesEnabled","dashboardAnnouncementsEnabled","dashboardNowPlayingEnabled","dashboardQueueEnabled","dashboardRecommendationsEnabled","dashboardMyLibraryPriority","dashboardOnDeckPriority","dashboardRecentlyAddedPriority","dashboardChannelsPriority","dashboardSharedLibrariesPriority","dashboardAnnouncementsPriority","dashboardNowPlayingPriority","dashboardQueuePriority","dashboardRecommendationsPriority","dashboardOnDeckDynamicPriority","dashboardOnDeckWideThumbnails","dashboardRecentlyAddedDynamicPriority","dashboardRecentlyAddedWideThumbnails","dashboardChannelsLimit","dashboardChannelsDynamicPriority","dashboardChannelsLargeThumbnail","dashboardAnnouncementsHideUnread","dashboardAnnouncementsLastRead","dashboardQueueLimit","dashboardQueueDynamicPriority","dashboardRecommendationsLimit","dashboardRecommendationsDynamicPriority","syncVideoQuality","syncAudioQuality","syncPictureQuality"],defaults:{language:i,playThemeMusic:!1,showMovieUnwatched:!1,keyboardShortcuts:!0,debugLevel:1,dashboardFluidWidth:!0,dashboardMyLibraryEnabled:!0,dashboardOnDeckEnabled:!0,dashboardRecentlyAddedEnabled:!0,dashboardChannelsEnabled:!0,dashboardSharedLibrariesEnabled:!0,dashboardNowPlayingEnabled:!0,dashboardAnnouncementsEnabled:!0,dashboardQueueEnabled:!0,dashboardRecommendationsEnabled:!0,dashboardMyLibraryPriority:1,dashboardOnDeckPriority:2,dashboardRecentlyAddedPriority:3,dashboardChannelsPriority:4,dashboardSharedLibrariesPriority:5,dashboardAnnouncementsPriority:1,dashboardNowPlayingPriority:2,dashboardQueuePriority:3,dashboardRecommendationsPriority:4,dashboardOnDeckDynamicPriority:!1,dashboardOnDeckWideThumbnails:"first",dashboardRecentlyAddedDynamicPriority:!1,dashboardRecentlyAddedWideThumbnails:"first",dashboardChannelsLimit:!0,dashboardChannelsDynamicPriority:!1,dashboardChannelsLargeThumbnail:!0,dashboardAnnouncementsHideUnread:!0,dashboardAnnouncementsLastRead:0,dashboardQueueLimit:!0,dashboardQueueDynamicPriority:!1,dashboardRecommendationsLimit:!0,dashboardRecommendationsDynamicPriority:!1,remoteSearch:!0,channelSearch:!0,quality:7,remoteQuality:5,directPlay:!0,directStream:!0,highestResolution:!1,preferAAC:"Wii U"===e.browser,directPlayAC3:!1,subtitleSize:100,audioBoost:100,syncVideoQuality:"medium",syncAudioQuality:"medium",syncPictureQuality:"medium",listType:"media-tile-list",episodeListType:"episode-tile-list",sidebarOpen:!1,dashboardSidebarOpen:!1,plexWebSettingsOpen:!1,videoVolume:1,musicVolume:1},initialize:function(){this.populate()
}});return new n}),define("plex/base/control/utils/LocalizationUtil",["plex/base/control/Dispatcher","plex/base/model/SettingsModel","jquery","underscore"],function(e,t,i){var n={en:"en.json","en-GB":"en-GB.json",af:"af.json",ca:"ca.json",cs:"cs.json",sr:"sr.json",da:"da.json",de:"de.json",et:"et.json",es:"es.json","es-419":"es-419.json",el:"el.json",fr:"fr.json",hr:"hr.json",is:"is.json",it:"it.json",lt:"lt.json",hu:"hu.json",nl:"nl.json",no:"no.json",pl:"pl.json",pt:"pt.json","pt-BR":"pt-BR.json",ru:"ru.json",ro:"ro.json",sk:"sk.json",sl:"sl.json",fi:"fi.json",sv:"sv.json",tr:"tr.json",uk:"uk.json",bg:"bg.json",zh:"zh.json","zh-TW":"zh-TW.json",ja:"ja.json",ko:"ko.json",th:"th.json",fa:"fa.json",ar:"ar.json",he:"he.json"},a=function(e){var i=e||{};
this.languages=n,this.translations={},this.defaultLanguage=t.get("language"),this.basePath=i.basePath||"localizations/",this.setLanguage(),t.on("change:language",_.bind(function(e,t){this.load(t)},this))};return a.prototype.setLanguage=function(t){return t=t||this.defaultLanguage,_.has(n,t)?(this.language=t,t):(this.language=this.defaultLanguage,e.trigger("change:language",this.language),!1)},a.prototype.load=function(){var t=this.language||this.defaultLanguage;return this.setLanguage.apply(this,arguments)?_.has(this.translations,this.language)?(e.trigger("change:language",this.language),i.Deferred().resolve()):i.ajax({dataType:"json",url:this.basePath+n[this.language]}).done(_.bind(function(t){this.translations[this.language]=t,e.trigger("change:language",this.language)
},this)).fail(_.bind(function(){this.setLanguage(t)},this)):i.Deferred().reject()},a.prototype.t=function(){var e=this.translations[this.language],t=arguments[0];if(t===void 0)return"";var i=t,n=1;if(e&&_.has(e,t)){var a=e[t];a&&(i=a)}for(;arguments.length>n;)i=i.replace("{"+n+"}",arguments[n]),n++;return i},new a}),define("plex/base/control/init/jQueryInit",["jquery"],function(e){e.event.special.destroy={remove:function(e){e.handler&&e.handler()}},e.support.cors||e.ajaxPrefilter(function(e){if(e.crossDomain&&e.async){var t=e.type.toUpperCase();
!e.data||"GET"!=t&&"HEAD"!=t||(e.url+="?"+e.data,delete e.data),e.headers||(e.headers={});var i="X-Plex-",n=_.filter(_.keys(e.headers),function(e){return 0===e.lastIndexOf(i,0)});if(_.each(n,function(t){e.headers["X-Plex-Proxy-"+t.slice(i.length)]=e.headers[t],delete e.headers[t]}),e.headers["X-Plex-Url"]=e.url,e.url="/system/proxy",e.crossDomain=!1,window.appModel){var a=window.appModel.get("primaryServer").get("accessToken");a&&(e.headers["X-Plex-Token"]=a)}}});var t=["Cache-Control","Content-Language","Content-Type","Expires","Last-Modified","Pragma","Location"],i=e.ajaxSettings.xhr;
e.ajaxSettings.xhr=function(){var e=i(),n=e.getAllResponseHeaders;return e.getAllResponseHeaders=function(){var i=n.apply(e);if(i)return i;var a=[];return _.each(t,function(t){var i=e.getResponseHeader(t);i&&a.push(t+": "+i)}),a.join("\n")},e},e.ajaxPrefilter(function(e){return e.crossDomain&&!e.skipCorsWithRedirect?"cors_with_redirect":void 0}),e.ajaxTransport("cors_with_redirect",function(t,i,n){t.dataTypes.shift();var a,s=_.extend({},i,{skipCorsWithRedirect:!0,complete:null,error:null,success:null});
return{send:function(t,i){s.error=function(e,t,a){_.extend(n,e),i(e.status,t,{alreadyConverted:a},e.getAllResponseHeaders())},s.success=function(t,r,l){_.extend(n,l);var o=l.getResponseHeader("Location");200==l.status&&o?(s.url=o,a=e.ajax(s)):i(l.status,r,{alreadyConverted:t},l.getAllResponseHeaders())},a=e.ajax(s)},abort:function(){a&&a.abort()}}})}),define("plex/base/control/init/BackboneInit",["plex/base/control/Dispatcher","backbone"],function(e){var t=Backbone.sync;Backbone.sync=function(i,n,a){var s=a.server||n.server||n.get("server");
!a.url&&n.url&&(a.url=_.isFunction(n.url)?n.url():n.url),!a.dataType&&n.dataType&&(a.dataType=n.dataType),_.defaults(a,{url:"",dataType:"text",processData:!1,timeout:2e4}),s&&(s.get("disconnected")&&e.trigger("connect:websocket",s),a.url=s.resolveUrl(a.url),s.get("synced")&&n.section&&n.section.get("limited")&&(a.url+=a.url.indexOf("?")>0?"&":"?",a.url+="redirect=0"),a.headers||(a.headers={}),_.extend(a.headers,s.getHeaders()));var r=t(i,n,a);return a.hideLoadingAlert||(e.trigger("command:ShowLoading",!0),r.always(function(){e.trigger("command:ShowLoading",!1)
})),r}}),define("plex/base/control/utils/StringUtil",[],function(){return{truncate:function(e,t){if(!e)return"";if(e.length>t){for(var i=e.substring(0,t-3);/\S/.test(i.charAt(i.length-1))===!1&&i.length>1;)i=i.slice(0,-1);return i+"..."}return e},truncateMiddle:function(e,t,i){if(e.length>t){i=i||Math.floor((t-3)/2);var n=t-3-i;return e.substr(0,i)+"..."+e.substr(e.length-n)}return e},titleCase:function(e){return e.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()
})},toUtf8:function(e){for(var t="",i=0,n=0;e.length>n;n++){var a=e.charCodeAt(n);128>a||(2048>a?(n>i&&(t+=e.substring(i,n)),i=n+1,t+=String.fromCharCode(192|a>>>6),t+=String.fromCharCode(128|63&a)):(n>i&&(t+=e.substring(i,n)),i=n+1,t+=String.fromCharCode(224|a>>>12),t+=String.fromCharCode(128|63&a>>>6),t+=String.fromCharCode(128|63&a)))}return i>0&&e.length>i&&(t+=e.substring(i)),0===i?e:t}}}),define("plex/base/control/utils/NumberUtil",[],function(){return{formatBytes:function(e,t){var i=["B","KB","MB","GB","TB"],n=parseInt(Math.floor(Math.log(e)/Math.log(1024)),10);
return(e/Math.pow(1024,n)).toFixed(t)+" "+i[n]},formatBitrate:function(e,t){var i=["bps","kbps","Mbps","Gbps","Tbps"],n=parseInt(Math.floor(Math.log(e)/Math.log(1024)),10);return(e/Math.pow(1024,n)).toFixed(t)+" "+i[n+1]},formatMinutesRemaining:function(e){if(!e)return"";if(60>e)return 1===e?e+" second left":e+" seconds left";var t=Math.ceil(e/60);return 1===t?t+" minute left":t+" minutes left"},leadingZero:function(e){return e=parseInt(e,10),10>e?"0"+e:e},secondsToHms:function(e){if(!e)return"0:00";
e=Number(e);var t=Math.floor(e/3600),i=Math.floor(e%3600/60),n=Math.floor(e%3600%60);return(t>0?t+":":"")+(i>0?(t>0&&10>i?"0":"")+i+":":"0:")+(10>n?"0":"")+n},millisecondsToHm:function(e){var t=Math.round(e/6e4);if(60>t)return{minutes:t};var i=Math.floor(t/60),n=t%60;return 0===n?{hours:i}:{hours:i,minutes:n}}}}),define("x2js",function(){}),define("plex/base/control/utils/ParseUtil",["x2js"],function(){var e=new X2JS(!1,"",!0),t=function(e,t){_.isArray(t)?_.each(t,e):e(t)};return{parseXML:function(t){return e.xml_str2json(t)
},parseEncodedString:function(e,i){if(e){var n=function(t){if(t in e){var i=e[t];e[t]=i===void 0||null===i?"":decodeURIComponent(i)}};t(n,i)}},parseInteger:function(e,i){if(e){var n=function(t){if(t in e){var i=e[t];e[t]=i===void 0||null===i?0:parseInt(i,10)}};t(n,i)}},parseBoolean:function(e,i){if(e){var n=function(t){if(t in e){var i=e[t];e[t]=i===!0||"true"==i||"1"==i}};t(n,i)}},parseArray:function(e,i){if(e){var n=function(t){if(t in e){var i=e[t];_.isArray(i)||(e[t]=[i])}else e[t]=[]};t(n,i)
}}}}),function(e){Q=e()}(function(){function e(e){var t=Function.call;return function(){return t.apply(e,arguments)}}function t(e){return"[object StopIteration]"===lt(e)||e instanceof Z}function i(e,t){t.stack&&"object"==typeof e&&null!==e&&e.stack&&-1===e.stack.indexOf(ot)&&(e.stack=n(e.stack)+"\n"+ot+"\n"+n(t.stack))}function n(e){for(var t=e.split("\n"),i=[],n=0;t.length>n;++n){var r=t[n];s(r)||a(r)||i.push(r)}return i.join("\n")}function a(e){return-1!==e.indexOf("(module.js:")||-1!==e.indexOf("(node.js:")
}function s(e){var t=/at .+ \((.*):(\d+):\d+\)/.exec(e);if(!t)return!1;var i=t[1],n=t[2];return i===K&&n>=Q&&pt>=n}function r(){if(Error.captureStackTrace){var e,t,i=Error.prepareStackTrace;return Error.prepareStackTrace=function(i,n){e=n[1].getFileName(),t=n[1].getLineNumber()},Error().stack,Error.prepareStackTrace=i,K=e,t}}function l(e){return w(e)}function o(){function e(e){i&&(t=w(e),tt(i,function(e,i){G(function(){t.promiseDispatch.apply(t,i)})},void 0),i=void 0,n=void 0)}var t,i=[],n=[],a=at(o.prototype),s=at(d.prototype);
return s.promiseDispatch=function(e,a,s){var r=et(arguments);i?(i.push(r),"when"===a&&s[1]&&n.push(s[1])):G(function(){t.promiseDispatch.apply(t,r)})},s.valueOf=function(){return i?s:t=h(t)},Error.captureStackTrace&&l.longStackJumpLimit>0&&(Error.captureStackTrace(s,o),s.stack=s.stack.substring(s.stack.indexOf("\n")+1)),a.promise=s,a.resolve=e,a.fulfill=function(t){e(b(t))},a.reject=function(t){e(y(t))},a.notify=function(e){i&&tt(n,function(t,i){G(function(){i(e)})},void 0)},a}function c(e){var t=o();
return L(e,t.resolve,t.reject,t.notify).fail(t.reject),t.promise}function d(e,t,i,n,a){void 0===t&&(t=function(e){return y(Error("Promise does not support operation: "+e))});var s=at(d.prototype);return s.promiseDispatch=function(i,n,a){var r;try{r=e[n]?e[n].apply(s,a):t.call(s,n,a)}catch(l){r=y(l)}i&&i(r)},i&&(s.valueOf=i),a&&(s.exception=n),s}function h(e){return u(e)?e.valueOf():e}function u(e){return e&&"function"==typeof e.promiseDispatch}function p(e){return e&&"function"==typeof e.then}function f(e){return!m(e)&&!g(e)
}function m(e){return!p(h(e))}function g(e){return e=h(e),u(e)&&"exception"in e}function v(){ct||"undefined"==typeof window||window.Touch||!window.console||console.log("Should be empty:",ht),ct=!0}function y(e){var t=d({when:function(t){if(t){var i=it(dt,this);-1!==i&&(ht.splice(i,1),dt.splice(i,1))}return t?t(e):this}},function(){return y(e)},function(){return this},e,!0);return v(),dt.push(t),ht.push(e),t}function b(e){return d({when:function(){return e},get:function(t){return e[t]},set:function(t,i){e[t]=i
},"delete":function(t){delete e[t]},post:function(t,i){return null==t?e.apply(void 0,i):e[t].apply(e,i)},apply:function(t,i){return e.apply(t,i)},keys:function(){return rt(e)}},void 0,function(){return e})}function w(e){return u(e)?e:(e=h(e),p(e)?x(e):b(e))}function x(e){var t=o();return G(function(){try{e.then(t.resolve,t.reject,t.notify)}catch(i){t.reject(i)}}),t.promise}function k(e){return d({isDef:function(){}},function(t,i){return T(e,t,i)},function(){return h(e)})}function S(e,t,n,a){function s(e){try{return"function"==typeof t?t(e):e
}catch(i){return y(i)}}function r(e){if("function"==typeof n){i(e,u);try{return n(e)}catch(t){return y(t)}}return y(e)}function c(e){return"function"==typeof a?a(e):e}var d=o(),h=!1,u=w(e);return G(function(){u.promiseDispatch(function(e){h||(h=!0,d.resolve(s(e)))},"when",[function(e){h||(h=!0,d.resolve(r(e)))}])}),u.promiseDispatch(void 0,"when",[,function(e){var t,i=!1;try{t=c(e)}catch(n){if(i=!0,!l.onerror)throw n;l.onerror(n)}i||d.notify(t)}]),d.promise}function C(e,t,i){return S(e,function(e){return N(e).then(function(e){return t.apply(void 0,e)
},i)},i)}function _(e){return function(){function i(e,i){var r;try{r=n[e](i)}catch(l){return t(l)?l.value:y(l)}return S(r,a,s)}var n=e.apply(this,arguments),a=i.bind(i,"send"),s=i.bind(i,"throw");return a()}}function A(e){throw new Z(e)}function I(e){return function(){return C([this,N(arguments)],function(t,i){return e.apply(t,i)})}}function T(e,t,i){var n=o();return G(function(){w(e).promiseDispatch(n.resolve,t,i)}),n.promise}function M(e){return function(t){var i=et(arguments,1);return T(t,e,i)
}}function P(e,t){var i=et(arguments,2);return ut(e,t,i)}function D(e,t){return T(e,"apply",[,t])}function L(e){var t=et(arguments,1);return D(e,t)}function E(e){var t=et(arguments,1);return function(){var i=t.concat(et(arguments));return T(e,"apply",[this,i])}}function N(e){return S(e,function(e){var t=e.length;if(0===t)return w(e);var i=o();return tt(e,function(n,a,s){m(a)?(e[s]=h(a),0===--t&&i.resolve(e)):S(a,function(n){e[s]=n,0===--t&&i.resolve(e)}).fail(i.reject)},void 0),i.promise})}function O(e){return S(e,function(e){return e=nt(e,w),S(N(nt(e,function(e){return S(e,X,X)
})),function(){return e})})}function R(e,t){return S(e,void 0,t)}function B(e,t){return S(e,void 0,void 0,t)}function $(e,t){return S(e,function(e){return S(t(),function(){return e})},function(e){return S(t(),function(){return y(e)})})}function q(e,t,n,a){var s=function(t){G(function(){if(i(t,e),!l.onerror)throw t;l.onerror(t)})},r=t||n||a?S(e,t,n,a):e;"object"==typeof process&&process&&process.domain&&(s=process.domain.bind(s)),R(r,s)}function V(e,t){var i=o(),n=setTimeout(function(){i.reject(Error("Timed out after "+t+" ms"))
},t);return S(e,function(e){clearTimeout(n),i.resolve(e)},function(e){clearTimeout(n),i.reject(e)}),i.promise}function j(e,t){void 0===t&&(t=e,e=void 0);var i=o();return setTimeout(function(){i.resolve(e)},t),i.promise}function F(e,t){var i=et(t),n=o();return i.push(n.makeNodeResolver()),D(e,i).fail(n.reject),n.promise}function U(e){var t=et(arguments,1),i=o();return t.push(i.makeNodeResolver()),D(e,t).fail(i.reject),i.promise}function H(e){var t=et(arguments,1);return function(){var i=t.concat(et(arguments)),n=o();
return i.push(n.makeNodeResolver()),D(e,i).fail(n.reject),n.promise}}function z(e){var t=et(arguments,1);return function(){function i(){return e.apply(s,arguments)}var n=t.concat(et(arguments)),a=o();n.push(a.makeNodeResolver());var s=this;return D(i,n).fail(a.reject),a.promise}}function W(e,t,i){var n=et(i||[]),a=o();return n.push(a.makeNodeResolver()),ut(e,t,n).fail(a.reject),a.promise}function Y(e,t){var i=et(arguments,2),n=o();return i.push(n.makeNodeResolver()),ut(e,t,i).fail(n.reject),n.promise
}function J(e,t){return t?(e.then(function(e){G(function(){t(null,e)})},function(e){G(function(){t(e)})}),void 0):e}var K,G,Q=r(),X=function(){};"undefined"!=typeof process?G=process.nextTick:"function"==typeof setImmediate?G="undefined"!=typeof window?setImmediate.bind(window):setImmediate:function(){function e(){if(--s,++l>=a){l=0,a*=4;for(var e=r&&Math.min(r-1,a);e>s;)++s,t()}for(;r;){--r,i=i.next;var n=i.task;i.task=void 0,n()}l=0}var t,i={task:void 0,next:null},n=i,a=2,s=0,r=0,l=0;if(G=function(e){n=n.next={task:e,next:null},++r>s&&a>s&&(++s,t())
},"undefined"!=typeof MessageChannel){var o=new MessageChannel;o.port1.onmessage=e,t=function(){o.port2.postMessage(0)}}else t=function(){setTimeout(e,0)}}();var Z,et=e(Array.prototype.slice),tt=e(Array.prototype.reduce||function(e,t){var i=0,n=this.length;if(1===arguments.length)for(;;){if(i in this){t=this[i++];break}if(++i>=n)throw new TypeError}for(;n>i;i++)i in this&&(t=e(t,this[i],i));return t}),it=e(Array.prototype.indexOf||function(e){for(var t=0;this.length>t;t++)if(this[t]===e)return t;
return-1}),nt=e(Array.prototype.map||function(e,t){var i=this,n=[];return tt(i,function(a,s,r){n.push(e.call(t,s,r,i))},void 0),n}),at=Object.create||function(e){function t(){}return t.prototype=e,new t},st=e(Object.prototype.hasOwnProperty),rt=Object.keys||function(e){var t=[];for(var i in e)st(e,i)&&t.push(i);return t},lt=e(Object.prototype.toString);Z="undefined"!=typeof ReturnValue?ReturnValue:function(e){this.value=e},l.longStackJumpLimit=1;var ot="From previous event:";l.nextTick=G,l.defer=o,o.prototype.makeNodeResolver=function(){var e=this;
return function(t,i){t?e.reject(t):arguments.length>2?e.resolve(et(arguments,1)):e.resolve(i)}},l.promise=c,l.makePromise=d,d.prototype.then=function(e,t,i){return S(this,e,t,i)},d.prototype.thenResolve=function(e){return S(this,function(){return e})},tt(["isFulfilled","isRejected","isPending","dispatch","when","spread","get","put","set","del","delete","post","send","invoke","keys","fapply","fcall","fbind","all","allResolved","timeout","delay","catch","finally","fail","fin","progress","done","nfcall","nfapply","nfbind","denodeify","nbind","ncall","napply","nbind","npost","nsend","ninvoke","nodeify"],function(e,t){d.prototype[t]=function(){return l[t].apply(l,[this].concat(et(arguments)))
}},void 0),d.prototype.toSource=function(){return""+this},d.prototype.toString=function(){return"[object Promise]"},l.nearer=h,l.isPromise=u,l.isPromiseAlike=p,l.isPending=f,l.isFulfilled=m,l.isRejected=g;var ct,dt=[],ht=[];"undefined"!=typeof process&&process.on&&process.on("exit",function(){for(var e=0;ht.length>e;e++){var t=ht[e];t&&t.stack!==void 0?console.warn("Unhandled rejected promise:",t.stack):console.warn("Unhandled rejected promise (no stack):",t)}}),l.reject=y,l.fulfill=b,l.resolve=w,l.master=k,l.when=S,l.spread=C,l.async=_,l["return"]=A,l.promised=I,l.dispatch=T,l.dispatcher=M,l.get=M("get"),l.set=M("set"),l["delete"]=l.del=M("delete");
var ut=l.post=M("post");l.send=P,l.invoke=P,l.fapply=D,l["try"]=L,l.fcall=L,l.fbind=E,l.keys=M("keys"),l.all=N,l.allResolved=O,l["catch"]=l.fail=R,l.progress=B,l["finally"]=l.fin=$,l.done=q,l.timeout=V,l.delay=j,l.nfapply=F,l.nfcall=U,l.nfbind=H,l.denodeify=l.nfbind,l.nbind=z,l.npost=W,l.nsend=Y,l.ninvoke=l.nsend,l.nodeify=J;var pt=r();return l}),define("q",function(){}),define("plex/base/control/utils/NetUtil",["jquery","underscore","q"],function(){var e=function(){function e(){try{return new window.XMLHttpRequest
}catch(e){}}function t(){try{return new window.ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}var i=/^(?:GET|HEAD)$/,n={xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},a={xml:"responseXML",text:"responseText"};this.ajax=function(s,r){function l(){f&&r.data&&r.contentType!==!1&&u.setRequestHeader("Content-Type",r.contentType),r.dataType&&n[r.dataType]?u.setRequestHeader("Accept",n[r.dataType]+("*"!==r.dataType?", */*; q=0.01":"")):u.setRequestHeader("Accept",n["*"]);
for(var e in r.headers)u.setRequestHeader(e,r.headers[e])}function o(){u.onreadystatechange=null,u.onerror=null,u.onprogress=null}function c(){if(4===u.readyState)if(o(),200===u.status){var e=u.response;r.dataType&&a[r.dataType]&&(e=u[a[r.dataType]]),p.resolve([e,u])}else p.reject(u)}function d(){o(),p.reject(u)}function h(e){p.notify(e.loaded/e.total)}_.isObject(s)&&(r=s,s=void 0),r||(r={});var u=e()||t(),p=Q.defer();_.defaults(r,{type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0}),s&&(r.url=s);
var f=!i.test(r.type);return r.url?(u.open(r.type,r.url,!0),r.responseType&&(u.responseType=r.responseType),l(),u.onreadystatechange=c,u.onerror=d,u.onprogress=h,u.send(f&&r.data||null)):p.reject(u,"A url was not specified."),p.promise},this.param=function(e){var t=[];for(var i in e)t.push(encodeURIComponent(i)+"="+encodeURIComponent(e[i]));return t.join("&")}};return new e}),function(e){function t(e,t){return function(i){return o(e.call(this,i),t)}}function i(e){return function(t){return this.lang().ordinal(e.call(this,t))
}}function n(){}function a(e){r(this,e)}function s(e){var t=this._data={},i=e.years||e.year||e.y||0,n=e.months||e.month||e.M||0,a=e.weeks||e.week||e.w||0,s=e.days||e.day||e.d||0,r=e.hours||e.hour||e.h||0,o=e.minutes||e.minute||e.m||0,c=e.seconds||e.second||e.s||0,d=e.milliseconds||e.millisecond||e.ms||0;this._milliseconds=d+1e3*c+6e4*o+36e5*r,this._days=s+7*a,this._months=n+12*i,t.milliseconds=d%1e3,c+=l(d/1e3),t.seconds=c%60,o+=l(c/60),t.minutes=o%60,r+=l(o/60),t.hours=r%24,s+=l(r/24),s+=7*a,t.days=s%30,n+=l(s/30),t.months=n%12,i+=l(n/12),t.years=i
}function r(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e}function l(e){return 0>e?Math.ceil(e):Math.floor(e)}function o(e,t){for(var i=e+"";t>i.length;)i="0"+i;return i}function c(e,t,i){var n,a=t._milliseconds,s=t._days,r=t._months;a&&e._d.setTime(+e+a*i),s&&e.date(e.date()+s*i),r&&(n=e.date(),e.date(1).month(e.month()+r*i).date(Math.min(n,e.daysInMonth())))}function d(e){return"[object Array]"===Object.prototype.toString.call(e)}function h(e,t){var i,n=Math.min(e.length,t.length),a=Math.abs(e.length-t.length),s=0;
for(i=0;n>i;i++)~~e[i]!==~~t[i]&&s++;return s+a}function u(e,t){return t.abbr=e,O[e]||(O[e]=new n),O[e].set(t),O[e]}function p(e){return e?(!O[e]&&R&&require("./lang/"+e),O[e]):D.fn._lang}function f(e){return e.match(/\[.*\]/)?e.replace(/^\[|\]$/g,""):e.replace(/\\/g,"")}function m(e){var t,i,n=e.match($);for(t=0,i=n.length;i>t;t++)n[t]=at[n[t]]?at[n[t]]:f(n[t]);return function(a){var s="";for(t=0;i>t;t++)s+="function"==typeof n[t].call?n[t].call(a,e):n[t];return s}}function g(e,t){function i(t){return e.lang().longDateFormat(t)||t
}for(var n=5;n--&&q.test(t);)t=t.replace(q,i);return tt[t]||(tt[t]=m(t)),tt[t](e)}function v(e){switch(e){case"DDDD":return F;case"YYYY":return U;case"YYYYY":return H;case"S":case"SS":case"SSS":case"DDD":return j;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":case"a":case"A":return z;case"X":return J;case"Z":case"ZZ":return W;case"T":return Y;case"MM":case"DD":case"YY":case"HH":case"hh":case"mm":case"ss":case"M":case"D":case"d":case"H":case"h":case"m":case"s":return V;default:return RegExp(e.replace("\\",""))
}}function y(e,t,i){var n,a=i._a;switch(e){case"M":case"MM":a[1]=null==t?0:~~t-1;break;case"MMM":case"MMMM":n=p(i._l).monthsParse(t),null!=n?a[1]=n:i._isValid=!1;break;case"D":case"DD":case"DDD":case"DDDD":null!=t&&(a[2]=~~t);break;case"YY":a[0]=~~t+(~~t>68?1900:2e3);break;case"YYYY":case"YYYYY":a[0]=~~t;break;case"a":case"A":i._isPm="pm"===(t+"").toLowerCase();break;case"H":case"HH":case"h":case"hh":a[3]=~~t;break;case"m":case"mm":a[4]=~~t;break;case"s":case"ss":a[5]=~~t;break;case"S":case"SS":case"SSS":a[6]=~~(1e3*("0."+t));
break;case"X":i._d=new Date(1e3*parseFloat(t));break;case"Z":case"ZZ":i._useUTC=!0,n=(t+"").match(X),n&&n[1]&&(i._tzh=~~n[1]),n&&n[2]&&(i._tzm=~~n[2]),n&&"+"===n[0]&&(i._tzh=-i._tzh,i._tzm=-i._tzm)}null==t&&(i._isValid=!1)}function b(e){var t,i,n=[];if(!e._d){for(t=0;7>t;t++)e._a[t]=n[t]=null==e._a[t]?2===t?1:0:e._a[t];n[3]+=e._tzh||0,n[4]+=e._tzm||0,i=new Date(0),e._useUTC?(i.setUTCFullYear(n[0],n[1],n[2]),i.setUTCHours(n[3],n[4],n[5],n[6])):(i.setFullYear(n[0],n[1],n[2]),i.setHours(n[3],n[4],n[5],n[6])),e._d=i
}}function w(e){var t,i,n=e._f.match($),a=e._i;for(e._a=[],t=0;n.length>t;t++)i=(v(n[t]).exec(a)||[])[0],i&&(a=a.slice(a.indexOf(i)+i.length)),at[n[t]]&&y(n[t],i,e);e._isPm&&12>e._a[3]&&(e._a[3]+=12),e._isPm===!1&&12===e._a[3]&&(e._a[3]=0),b(e)}function x(e){for(var t,i,n,s,l=99;e._f.length;){if(t=r({},e),t._f=e._f.pop(),w(t),i=new a(t),i.isValid()){n=i;break}s=h(t._a,i.toArray()),l>s&&(l=s,n=i)}r(e,n)}function k(e){var t,i=e._i;if(K.exec(i)){for(e._f="YYYY-MM-DDT",t=0;4>t;t++)if(Q[t][1].exec(i)){e._f+=Q[t][0];
break}W.exec(i)&&(e._f+=" Z"),w(e)}else e._d=new Date(i)}function S(t){var i=t._i,n=B.exec(i);i===e?t._d=new Date:n?t._d=new Date(+n[1]):"string"==typeof i?k(t):d(i)?(t._a=i.slice(0),b(t)):t._d=i instanceof Date?new Date(+i):new Date(i)}function C(e,t,i,n,a){return a.relativeTime(t||1,!!i,e,n)}function _(e,t,i){var n=N(Math.abs(e)/1e3),a=N(n/60),s=N(a/60),r=N(s/24),l=N(r/365),o=45>n&&["s",n]||1===a&&["m"]||45>a&&["mm",a]||1===s&&["h"]||22>s&&["hh",s]||1===r&&["d"]||25>=r&&["dd",r]||45>=r&&["M"]||345>r&&["MM",N(r/30)]||1===l&&["y"]||["yy",l];
return o[2]=t,o[3]=e>0,o[4]=i,C.apply({},o)}function A(e,t,i){var n=i-t,a=i-e.day();return a>n&&(a-=7),n-7>a&&(a+=7),Math.ceil(D(e).add("d",a).dayOfYear()/7)}function I(e){var t=e._i,i=e._f;return null===t||""===t?null:("string"==typeof t&&(e._i=t=p().preparse(t)),D.isMoment(t)?(e=r({},t),e._d=new Date(+t._d)):i?d(i)?x(e):w(e):S(e),new a(e))}function T(e,t){D.fn[e]=D.fn[e+"s"]=function(e){var i=this._isUTC?"UTC":"";return null!=e?(this._d["set"+i+t](e),this):this._d["get"+i+t]()}}function M(e){D.duration.fn[e]=function(){return this._data[e]
}}function P(e,t){D.duration.fn["as"+e]=function(){return+this/t}}for(var D,L,E="2.0.0",N=Math.round,O={},R="undefined"!=typeof module&&module.exports,B=/^\/?Date\((\-?\d+)/i,$=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYY|YYYY|YY|a|A|hh?|HH?|mm?|ss?|SS?S?|X|zz?|ZZ?|.)/g,q=/(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,V=/\d\d?/,j=/\d{1,3}/,F=/\d{3}/,U=/\d{1,4}/,H=/[+\-]?\d{1,6}/,z=/[0-9]*[a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF]+\s*?[\u0600-\u06FF]+/i,W=/Z|[\+\-]\d\d:?\d\d/i,Y=/T/i,J=/[\+\-]?\d+(\.\d{1,3})?/,K=/^\s*\d{4}-\d\d-\d\d((T| )(\d\d(:\d\d(:\d\d(\.\d\d?\d?)?)?)?)?([\+\-]\d\d:?\d\d)?)?/,G="YYYY-MM-DDTHH:mm:ssZ",Q=[["HH:mm:ss.S",/(T| )\d\d:\d\d:\d\d\.\d{1,3}/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],X=/([\+\-]|\d\d)/gi,Z="Month|Date|Hours|Minutes|Seconds|Milliseconds".split("|"),et={Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6},tt={},it="DDD w W M D d".split(" "),nt="M D H h m s w W".split(" "),at={M:function(){return this.month()+1
},MMM:function(e){return this.lang().monthsShort(this,e)},MMMM:function(e){return this.lang().months(this,e)},D:function(){return this.date()},DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(e){return this.lang().weekdaysMin(this,e)},ddd:function(e){return this.lang().weekdaysShort(this,e)},dddd:function(e){return this.lang().weekdays(this,e)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return o(this.year()%100,2)},YYYY:function(){return o(this.year(),4)
},YYYYY:function(){return o(this.year(),5)},a:function(){return this.lang().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.lang().meridiem(this.hours(),this.minutes(),!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return~~(this.milliseconds()/100)},SS:function(){return o(~~(this.milliseconds()/10),2)},SSS:function(){return o(this.milliseconds(),3)},Z:function(){var e=-this.zone(),t="+";
return 0>e&&(e=-e,t="-"),t+o(~~(e/60),2)+":"+o(~~e%60,2)},ZZ:function(){var e=-this.zone(),t="+";return 0>e&&(e=-e,t="-"),t+o(~~(10*e/6),4)},X:function(){return this.unix()}};it.length;)L=it.pop(),at[L+"o"]=i(at[L]);for(;nt.length;)L=nt.pop(),at[L+L]=t(at[L],2);for(at.DDDD=t(at.DDD,3),n.prototype={set:function(e){var t,i;for(i in e)t=e[i],"function"==typeof t?this[i]=t:this["_"+i]=t},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(e){return this._months[e.month()]
},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(e){return this._monthsShort[e.month()]},monthsParse:function(e){var t,i,n;for(this._monthsParse||(this._monthsParse=[]),t=0;12>t;t++)if(this._monthsParse[t]||(i=D([2e3,t]),n="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[t]=RegExp(n.replace(".",""),"i")),this._monthsParse[t].test(e))return t},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(e){return this._weekdays[e.day()]
},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(e){return this._weekdaysShort[e.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(e){return this._weekdaysMin[e.day()]},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY LT",LLLL:"dddd, MMMM D YYYY LT"},longDateFormat:function(e){var t=this._longDateFormat[e];return!t&&this._longDateFormat[e.toUpperCase()]&&(t=this._longDateFormat[e.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(e){return e.slice(1)
}),this._longDateFormat[e]=t),t},meridiem:function(e,t,i){return e>11?i?"pm":"PM":i?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[last] dddd [at] LT",sameElse:"L"},calendar:function(e,t){var i=this._calendar[e];return"function"==typeof i?i.apply(t):i},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(e,t,i,n){var a=this._relativeTime[i];
return"function"==typeof a?a(e,t,i,n):a.replace(/%d/i,e)},pastFuture:function(e,t){var i=this._relativeTime[e>0?"future":"past"];return"function"==typeof i?i(t):i.replace(/%s/i,t)},ordinal:function(e){return this._ordinal.replace("%d",e)},_ordinal:"%d",preparse:function(e){return e},postformat:function(e){return e},week:function(e){return A(e,this._week.dow,this._week.doy)},_week:{dow:0,doy:6}},D=function(e,t,i){return I({_i:e,_f:t,_l:i,_isUTC:!1})},D.utc=function(e,t,i){return I({_useUTC:!0,_isUTC:!0,_l:i,_i:e,_f:t})
},D.unix=function(e){return D(1e3*e)},D.duration=function(e,t){var i,n=D.isDuration(e),a="number"==typeof e,r=n?e._data:a?{}:e;return a&&(t?r[t]=e:r.milliseconds=e),i=new s(r),n&&e.hasOwnProperty("_lang")&&(i._lang=e._lang),i},D.version=E,D.defaultFormat=G,D.lang=function(t,i){return t?(i?u(t,i):O[t]||p(t),D.duration.fn._lang=D.fn._lang=p(t),e):D.fn._lang._abbr},D.langData=function(e){return e&&e._lang&&e._lang._abbr&&(e=e._lang._abbr),p(e)},D.isMoment=function(e){return e instanceof a},D.isDuration=function(e){return e instanceof s
},D.fn=a.prototype={clone:function(){return D(this)},valueOf:function(){return+this._d},unix:function(){return Math.floor(+this._d/1e3)},toString:function(){return this.format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._d},toJSON:function(){return D.utc(this).format("YYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},toArray:function(){var e=this;return[e.year(),e.month(),e.date(),e.hours(),e.minutes(),e.seconds(),e.milliseconds()]},isValid:function(){return null==this._isValid&&(this._isValid=this._a?!h(this._a,(this._isUTC?D.utc(this._a):D(this._a)).toArray()):!isNaN(this._d.getTime())),!!this._isValid
},utc:function(){return this._isUTC=!0,this},local:function(){return this._isUTC=!1,this},format:function(e){var t=g(this,e||D.defaultFormat);return this.lang().postformat(t)},add:function(e,t){var i;return i="string"==typeof e?D.duration(+t,e):D.duration(e,t),c(this,i,1),this},subtract:function(e,t){var i;return i="string"==typeof e?D.duration(+t,e):D.duration(e,t),c(this,i,-1),this},diff:function(e,t,i){var n,a,s=this._isUTC?D(e).utc():D(e).local(),r=6e4*(this.zone()-s.zone());return t&&(t=t.replace(/s$/,"")),"year"===t||"month"===t?(n=432e5*(this.daysInMonth()+s.daysInMonth()),a=12*(this.year()-s.year())+(this.month()-s.month()),a+=(this-D(this).startOf("month")-(s-D(s).startOf("month")))/n,"year"===t&&(a/=12)):(n=this-s-r,a="second"===t?n/1e3:"minute"===t?n/6e4:"hour"===t?n/36e5:"day"===t?n/864e5:"week"===t?n/6048e5:n),i?a:l(a)
},from:function(e,t){return D.duration(this.diff(e)).lang(this.lang()._abbr).humanize(!t)},fromNow:function(e){return this.from(D(),e)},calendar:function(){var e=this.diff(D().startOf("day"),"days",!0),t=-6>e?"sameElse":-1>e?"lastWeek":0>e?"lastDay":1>e?"sameDay":2>e?"nextDay":7>e?"nextWeek":"sameElse";return this.format(this.lang().calendar(t,this))},isLeapYear:function(){var e=this.year();return 0===e%4&&0!==e%100||0===e%400},isDST:function(){return this.zone()<D([this.year()]).zone()||this.zone()<D([this.year(),5]).zone()
},day:function(e){var t=this._isUTC?this._d.getUTCDay():this._d.getDay();return null==e?t:this.add({d:e-t})},startOf:function(e){switch(e=e.replace(/s$/,"")){case"year":this.month(0);case"month":this.date(1);case"week":case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===e&&this.day(0),this},endOf:function(e){return this.startOf(e).add(e.replace(/s?$/,"s"),1).subtract("ms",1)},isAfter:function(t,i){return i=i!==e?i:"millisecond",+this.clone().startOf(i)>+D(t).startOf(i)
},isBefore:function(t,i){return i=i!==e?i:"millisecond",+this.clone().startOf(i)<+D(t).startOf(i)},isSame:function(t,i){return i=i!==e?i:"millisecond",+this.clone().startOf(i)===+D(t).startOf(i)},zone:function(){return this._isUTC?0:this._d.getTimezoneOffset()},daysInMonth:function(){return D.utc([this.year(),this.month()+1,0]).date()},dayOfYear:function(e){var t=N((D(this).startOf("day")-D(this).startOf("year"))/864e5)+1;return null==e?t:this.add("d",e-t)},isoWeek:function(e){var t=A(this,1,4);return null==e?t:this.add("d",7*(e-t))
},week:function(e){var t=this.lang().week(this);return null==e?t:this.add("d",7*(e-t))},lang:function(t){return t===e?this._lang:(this._lang=p(t),this)}},L=0;Z.length>L;L++)T(Z[L].toLowerCase().replace(/s$/,""),Z[L]);T("year","FullYear"),D.fn.days=D.fn.day,D.fn.weeks=D.fn.week,D.fn.isoWeeks=D.fn.isoWeek,D.duration.fn=s.prototype={weeks:function(){return l(this.days()/7)},valueOf:function(){return this._milliseconds+864e5*this._days+2592e6*this._months},humanize:function(e){var t=+this,i=_(t,!e,this.lang());
return e&&(i=this.lang().pastFuture(t,i)),this.lang().postformat(i)},lang:D.fn.lang};for(L in et)et.hasOwnProperty(L)&&(P(L,et[L]),M(L.toLowerCase()));P("Weeks",6048e5),D.lang("en",{ordinal:function(e){var t=e%10,i=1===~~(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th";return e+i}}),R&&(module.exports=D),"undefined"==typeof ender&&(this.moment=D),"function"==typeof define&&define.amd&&define("moment",[],function(){return D})}.call(this),define("plex/base/control/utils/MediaUtil",["plex/base/control/utils/NumberUtil","plex/base/control/utils/ParseUtil","plex/base/control/utils/NetUtil","q","moment"],function(e,t,i){var n=function(){this.subcollections=["Media","Genre","Collection","Field","Writer","Director","Role","Country","Location"],this.capabilities="protocols=http-live-streaming,http-mp4-streaming,http-streaming-video,http-streaming-video-720p,http-mp4-video,http-mp4-video-720p;videoDecoders=h264{profile:high&resolution:1080&level:51};audioDecoders=mp3,aac{bitrate:160000}",this.resolutions=["220x180","220x128","284x160","420x240","576x320","720x480","1024x768","1280x720","1280x720","1920x1080","1920x1080","1920x1080","1920x1080"],this.qualities=["10","20","30","30","40","60","60","75","100","60","75","90","100"],this.bitrates=["64","96","208","320","720","1500","2000","3000","4000","8000","10000","12000","20000"],this.timelineDelay=1e4,this.pingDelay=3e4,this.convert=function(e){var i=_.isObject(e)?e:t.parseXML(e);
if(!i.ratingKey&&!i.key&&!i.id){var n=i.Directory||i.Video||i.Track||i.Photo||i;n.identifier=i.identifier,n.mediaTagPrefix=i.mediaTagPrefix,n.mediaTagVersion=i.mediaTagVersion,n.allowSync=i.allowSync,n.librarySectionID=i.librarySectionID,n.librarySectionUUID=i.librarySectionUUID,i=n}t.parseBoolean(i,"allowSync"),t.parseInteger(i,["librarySectionID","index","parentIndex","duration","viewOffset","viewCount","leafCount","viewedLeafCount","lastViewedAt","addedAt","updatedAt"]),t.parseArray(i,this.subcollections);
var a=i.Media;return _.each(a,function(e){t.parseBoolean(e,["indirect","optimizedForStreaming"]),t.parseInteger(e,["id","duration","width","height","bitrate"]),t.parseArray(e,"Part");var i=e.Part;_.each(i,function(e){t.parseBoolean(e,"optimizedForStreaming"),t.parseInteger(e,["id","duration","size"]),t.parseArray(e,"Stream"),e.exists="0"!==e.exists,e.accessible="0"!==e.accessible;var i=e.Stream;_.each(i,function(e){t.parseBoolean(e,"selected"),t.parseInteger(e,["id","index","streamType","duration","width","height","bitrate","samplingRate"])
})})}),i},this.resolveIndirect=function(e,t,n){var a=new Q.defer,s=_.bind(function(){a.resolve(this)},this),r=_.bind(function(){a.reject(this)},this);if(t&&t.indirect)if(n)if(n.postURL){var l=e.server.getAjaxOptions(n.postURL);l.headers=l.headers||{},l.headers["X-Plex-Url"]=l.url,l.url="/system/proxy",i.ajax(l).spread(_.bind(function(a,o){var c=o.getAllResponseHeaders()+"\r\n"+a;l=e.server.getAjaxOptions(n.key+"&postURL="+encodeURIComponent(n.postURL)),l.type="POST",l.headers=l.headers||{},l.headers["X-Plex-Url"]=l.url,l.url="/system/proxy",l.data=c,i.ajax(l).spread(_.bind(function(i){this.mergeIndirectResponse(i,e,t,n)?s():r()
},this)).fail(r)},this)).fail(r)}else{var o=e.server.getAjaxOptions(n.key);i.ajax(o).spread(_.bind(function(i){this.mergeIndirectResponse(i,e,t,n)?s():r()},this)).fail(r)}else r();else s();return a.promise},this.mergeIndirectResponse=function(e,i,n,a){var s=t.parseXML(e);if(!s.Video||!s.Video.Media||!s.Video.Media.Part)return!1;var r=i.parse(s.Video),l=_.first(r.Media),o=_.first(l.Part);if(l.Part.length>1){var c=_.indexOf(n.Part,a);l.Part.length>c&&(o=l.Part[c])}if(!l||!o)return!1;if(_.extend(n,_.omit(l,"Part")),_.extend(a,o),s.httpHeaders){for(var d,h=RegExp("([^=]+)=([^&]+)&?","g"),u={};d=h.exec(s.httpHeaders);)d[1]in u?(_.isArray(u[d[1]])||(u[d[1]]=[u[d[1]]]),u[d[1]].push(d[2])):u[d[1]]=d[2];
i.set("indirectHttpHeaders",u,{silent:!0})}return!0},this.timeline=function(e,t,n,a,s){if(t.get("ratingKey")){var r=t.get("viewOffset"),l=Math.round(1e3*s.position),o=n.duration;if(!_.isNaN(l)){r=this.getAbsoluteOffset(n,a,l),o||(o=Math.round(1e3*s.duration)),r>o&&(r=o),t.set("viewOffset",r);var c={time:r,duration:o,state:s.state,key:t.get("key"),ratingKey:t.get("ratingKey")},d="/:/timeline?"+i.param(c);i.ajax(e.getAjaxOptions(d))}}},this.ping=function(e,t){if(t){var n;n=e.supports("universalTranscoder")?"/video/:/transcode/universal/ping?session="+t:"/video/:/transcode/segmented/ping?session="+t,i.ajax(e.getAjaxOptions(n))
}},this.stop=function(e,t){if(t){var n;n=e.supports("universalTranscoder")?"/video/:/transcode/universal/stop?session="+t:"/video/:/transcode/segmented/stop?session="+t,i.ajax(e.getAjaxOptions(n))}},this.getMissingParts=function(e){var t=[];return _.isArray(e)||(e=[e]),_.each(e,function(e){var i=e.Part;i&&_.each(i,function(e){(e.exists===!1||e.accessible===!1)&&t.push(e)})}),t},this.getRelativeOffset=function(e,t,i){var n=i;if(e.Part.length>1)for(var a=0,s=e.Part.length;s>a;a++){var r=e.Part[a];if(!r.duration)break;
if(t.key===r.key)break;n-=r.duration}return n},this.getAbsoluteOffset=function(e,t,i){var n=i;if(e.Part.length>1)for(var a=0,s=e.Part.length;s>a;a++){var r=e.Part[a];if(!r.duration)break;if(t.key===r.key)break;n+=r.duration}return n},this.getPartByAbsoluteOffset=function(e,t){var i;if(e.Part.length>1)for(var n=0,a=0,s=e.Part.length;s>a&&(i=e.Part[a],i.duration)&&(n+=i.duration,!(n>t));a++);else i=_.first(e.Part);return i},this.getIndex=function(e,t){if(e.indexes){var i=e.indexes.split(",");if(i.length)return _.indexOf(i,t)>-1?t:i[0]
}},this.getThumb=function(e,t,i){var n;return e.Part.length>1?(n=this.getPartByAbsoluteOffset(e,t),i=this.getIndex(n,i)):(n=_.first(e.Part),i=this.getIndex(n,i)),i?(t=this.getRelativeOffset(e,n,t),n.key.replace(/[^\/]*$/,"")+"indexes/"+i+"/"+t):void 0},this.getSeasonIndex=function(t){return 1e3>t?"S"+e.leadingZero(t):t},this.getSeasonEpisodeIndex=function(t,i,n){return i>0&&1e3>t?"S"+e.leadingZero(t)+"E"+e.leadingZero(i):n?moment(n).format("M/D/YY"):t},this.getEpisodeIndex=function(t,i){return t>0?"E"+e.leadingZero(t):i?moment(i).format("M/D/YY"):"Unknown"
}};return new n});var Handlebars={};(function(e,t){e.VERSION="1.0.0",e.COMPILER_REVISION=4,e.REVISION_CHANGES={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:">= 1.0.0"},e.helpers={},e.partials={};var i=Object.prototype.toString,n="[object Function]",a="[object Object]";e.registerHelper=function(t,n,s){if(i.call(t)===a){if(s||n)throw new e.Exception("Arg not supported with multiple helpers");e.Utils.extend(this.helpers,t)}else s&&(n.not=s),this.helpers[t]=n},e.registerPartial=function(t,n){i.call(t)===a?e.Utils.extend(this.partials,t):this.partials[t]=n
},e.registerHelper("helperMissing",function(e){if(2===arguments.length)return t;throw Error("Missing helper: '"+e+"'")}),e.registerHelper("blockHelperMissing",function(t,a){var s=a.inverse||function(){},r=a.fn,l=i.call(t);return l===n&&(t=t.call(this)),t===!0?r(this):t===!1||null==t?s(this):"[object Array]"===l?t.length>0?e.helpers.each(t,a):s(this):r(t)}),e.K=function(){},e.createFrame=Object.create||function(t){e.K.prototype=t;var i=new e.K;return e.K.prototype=null,i},e.logger={DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,methodMap:{0:"debug",1:"info",2:"warn",3:"error"},log:function(t,i){if(t>=e.logger.level){var n=e.logger.methodMap[t];
"undefined"!=typeof console&&console[n]&&console[n].call(console,i)}}},e.log=function(t,i){e.logger.log(t,i)},e.registerHelper("each",function(t,a){var s,r=a.fn,l=a.inverse,o=0,c="",d=i.call(t);if(d===n&&(t=t.call(this)),a.data&&(s=e.createFrame(a.data)),t&&"object"==typeof t)if(t instanceof Array)for(var h=t.length;h>o;o++)s&&(s.index=o),c+=r(t[o],{data:s});else for(var u in t)t.hasOwnProperty(u)&&(s&&(s.key=u),c+=r(t[u],{data:s}),o++);return 0===o&&(c=l(this)),c}),e.registerHelper("if",function(t,a){var s=i.call(t);
return s===n&&(t=t.call(this)),!t||e.Utils.isEmpty(t)?a.inverse(this):a.fn(this)}),e.registerHelper("unless",function(t,i){return e.helpers["if"].call(this,t,{fn:i.inverse,inverse:i.fn})}),e.registerHelper("with",function(a,s){var r=i.call(a);return r===n&&(a=a.call(this)),e.Utils.isEmpty(a)?t:s.fn(a)}),e.registerHelper("log",function(t,i){var n=i.data&&null!=i.data.level?parseInt(i.data.level,10):1;e.log(n,t)});var s=function(){function e(){this.yy={}}var i={trace:function(){},yy:{},symbols_:{error:2,root:3,program:4,EOF:5,simpleInverse:6,statements:7,statement:8,openInverse:9,closeBlock:10,openBlock:11,mustache:12,partial:13,CONTENT:14,COMMENT:15,OPEN_BLOCK:16,inMustache:17,CLOSE:18,OPEN_INVERSE:19,OPEN_ENDBLOCK:20,path:21,OPEN:22,OPEN_UNESCAPED:23,CLOSE_UNESCAPED:24,OPEN_PARTIAL:25,partialName:26,params:27,hash:28,dataName:29,param:30,STRING:31,INTEGER:32,BOOLEAN:33,hashSegments:34,hashSegment:35,ID:36,EQUALS:37,DATA:38,pathSegments:39,SEP:40,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"CLOSE_UNESCAPED",25:"OPEN_PARTIAL",31:"STRING",32:"INTEGER",33:"BOOLEAN",36:"ID",37:"EQUALS",38:"DATA",40:"SEP"},productions_:[0,[3,2],[4,2],[4,3],[4,2],[4,1],[4,1],[4,0],[7,1],[7,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,3],[13,4],[6,2],[17,3],[17,2],[17,2],[17,1],[17,1],[27,2],[27,1],[30,1],[30,1],[30,1],[30,1],[30,1],[28,1],[34,2],[34,1],[35,3],[35,3],[35,3],[35,3],[35,3],[26,1],[26,1],[26,1],[29,2],[21,1],[39,3],[39,1]],performAction:function(e,t,i,n,a,s){var r=s.length-1;
switch(a){case 1:return s[r-1];case 2:this.$=new n.ProgramNode([],s[r]);break;case 3:this.$=new n.ProgramNode(s[r-2],s[r]);break;case 4:this.$=new n.ProgramNode(s[r-1],[]);break;case 5:this.$=new n.ProgramNode(s[r]);break;case 6:this.$=new n.ProgramNode([],[]);break;case 7:this.$=new n.ProgramNode([]);break;case 8:this.$=[s[r]];break;case 9:s[r-1].push(s[r]),this.$=s[r-1];break;case 10:this.$=new n.BlockNode(s[r-2],s[r-1].inverse,s[r-1],s[r]);break;case 11:this.$=new n.BlockNode(s[r-2],s[r-1],s[r-1].inverse,s[r]);
break;case 12:this.$=s[r];break;case 13:this.$=s[r];break;case 14:this.$=new n.ContentNode(s[r]);break;case 15:this.$=new n.CommentNode(s[r]);break;case 16:this.$=new n.MustacheNode(s[r-1][0],s[r-1][1]);break;case 17:this.$=new n.MustacheNode(s[r-1][0],s[r-1][1]);break;case 18:this.$=s[r-1];break;case 19:this.$=new n.MustacheNode(s[r-1][0],s[r-1][1],"&"===s[r-2][2]);break;case 20:this.$=new n.MustacheNode(s[r-1][0],s[r-1][1],!0);break;case 21:this.$=new n.PartialNode(s[r-1]);break;case 22:this.$=new n.PartialNode(s[r-2],s[r-1]);
break;case 23:break;case 24:this.$=[[s[r-2]].concat(s[r-1]),s[r]];break;case 25:this.$=[[s[r-1]].concat(s[r]),null];break;case 26:this.$=[[s[r-1]],s[r]];break;case 27:this.$=[[s[r]],null];break;case 28:this.$=[[s[r]],null];break;case 29:s[r-1].push(s[r]),this.$=s[r-1];break;case 30:this.$=[s[r]];break;case 31:this.$=s[r];break;case 32:this.$=new n.StringNode(s[r]);break;case 33:this.$=new n.IntegerNode(s[r]);break;case 34:this.$=new n.BooleanNode(s[r]);break;case 35:this.$=s[r];break;case 36:this.$=new n.HashNode(s[r]);
break;case 37:s[r-1].push(s[r]),this.$=s[r-1];break;case 38:this.$=[s[r]];break;case 39:this.$=[s[r-2],s[r]];break;case 40:this.$=[s[r-2],new n.StringNode(s[r])];break;case 41:this.$=[s[r-2],new n.IntegerNode(s[r])];break;case 42:this.$=[s[r-2],new n.BooleanNode(s[r])];break;case 43:this.$=[s[r-2],s[r]];break;case 44:this.$=new n.PartialNameNode(s[r]);break;case 45:this.$=new n.PartialNameNode(new n.StringNode(s[r]));break;case 46:this.$=new n.PartialNameNode(new n.IntegerNode(s[r]));break;case 47:this.$=new n.DataNode(s[r]);
break;case 48:this.$=new n.IdNode(s[r]);break;case 49:s[r-2].push({part:s[r],separator:s[r-1]}),this.$=s[r-2];break;case 50:this.$=[{part:s[r]}]}},table:[{3:1,4:2,5:[2,7],6:3,7:4,8:6,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,5],22:[1,14],23:[1,15],25:[1,16]},{1:[3]},{5:[1,17]},{5:[2,6],7:18,8:6,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,19],20:[2,6],22:[1,14],23:[1,15],25:[1,16]},{5:[2,5],6:20,8:21,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,5],20:[2,5],22:[1,14],23:[1,15],25:[1,16]},{17:23,18:[1,22],21:24,29:25,36:[1,28],38:[1,27],39:26},{5:[2,8],14:[2,8],15:[2,8],16:[2,8],19:[2,8],20:[2,8],22:[2,8],23:[2,8],25:[2,8]},{4:29,6:3,7:4,8:6,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,5],20:[2,7],22:[1,14],23:[1,15],25:[1,16]},{4:30,6:3,7:4,8:6,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,5],20:[2,7],22:[1,14],23:[1,15],25:[1,16]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],25:[2,12]},{5:[2,13],14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],25:[2,13]},{5:[2,14],14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],25:[2,14]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],25:[2,15]},{17:31,21:24,29:25,36:[1,28],38:[1,27],39:26},{17:32,21:24,29:25,36:[1,28],38:[1,27],39:26},{17:33,21:24,29:25,36:[1,28],38:[1,27],39:26},{21:35,26:34,31:[1,36],32:[1,37],36:[1,28],39:26},{1:[2,1]},{5:[2,2],8:21,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,19],20:[2,2],22:[1,14],23:[1,15],25:[1,16]},{17:23,21:24,29:25,36:[1,28],38:[1,27],39:26},{5:[2,4],7:38,8:6,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,19],20:[2,4],22:[1,14],23:[1,15],25:[1,16]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],25:[2,9]},{5:[2,23],14:[2,23],15:[2,23],16:[2,23],19:[2,23],20:[2,23],22:[2,23],23:[2,23],25:[2,23]},{18:[1,39]},{18:[2,27],21:44,24:[2,27],27:40,28:41,29:48,30:42,31:[1,45],32:[1,46],33:[1,47],34:43,35:49,36:[1,50],38:[1,27],39:26},{18:[2,28],24:[2,28]},{18:[2,48],24:[2,48],31:[2,48],32:[2,48],33:[2,48],36:[2,48],38:[2,48],40:[1,51]},{21:52,36:[1,28],39:26},{18:[2,50],24:[2,50],31:[2,50],32:[2,50],33:[2,50],36:[2,50],38:[2,50],40:[2,50]},{10:53,20:[1,54]},{10:55,20:[1,54]},{18:[1,56]},{18:[1,57]},{24:[1,58]},{18:[1,59],21:60,36:[1,28],39:26},{18:[2,44],36:[2,44]},{18:[2,45],36:[2,45]},{18:[2,46],36:[2,46]},{5:[2,3],8:21,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,19],20:[2,3],22:[1,14],23:[1,15],25:[1,16]},{14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],25:[2,17]},{18:[2,25],21:44,24:[2,25],28:61,29:48,30:62,31:[1,45],32:[1,46],33:[1,47],34:43,35:49,36:[1,50],38:[1,27],39:26},{18:[2,26],24:[2,26]},{18:[2,30],24:[2,30],31:[2,30],32:[2,30],33:[2,30],36:[2,30],38:[2,30]},{18:[2,36],24:[2,36],35:63,36:[1,64]},{18:[2,31],24:[2,31],31:[2,31],32:[2,31],33:[2,31],36:[2,31],38:[2,31]},{18:[2,32],24:[2,32],31:[2,32],32:[2,32],33:[2,32],36:[2,32],38:[2,32]},{18:[2,33],24:[2,33],31:[2,33],32:[2,33],33:[2,33],36:[2,33],38:[2,33]},{18:[2,34],24:[2,34],31:[2,34],32:[2,34],33:[2,34],36:[2,34],38:[2,34]},{18:[2,35],24:[2,35],31:[2,35],32:[2,35],33:[2,35],36:[2,35],38:[2,35]},{18:[2,38],24:[2,38],36:[2,38]},{18:[2,50],24:[2,50],31:[2,50],32:[2,50],33:[2,50],36:[2,50],37:[1,65],38:[2,50],40:[2,50]},{36:[1,66]},{18:[2,47],24:[2,47],31:[2,47],32:[2,47],33:[2,47],36:[2,47],38:[2,47]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],25:[2,10]},{21:67,36:[1,28],39:26},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],25:[2,11]},{14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],25:[2,16]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],25:[2,19]},{5:[2,20],14:[2,20],15:[2,20],16:[2,20],19:[2,20],20:[2,20],22:[2,20],23:[2,20],25:[2,20]},{5:[2,21],14:[2,21],15:[2,21],16:[2,21],19:[2,21],20:[2,21],22:[2,21],23:[2,21],25:[2,21]},{18:[1,68]},{18:[2,24],24:[2,24]},{18:[2,29],24:[2,29],31:[2,29],32:[2,29],33:[2,29],36:[2,29],38:[2,29]},{18:[2,37],24:[2,37],36:[2,37]},{37:[1,65]},{21:69,29:73,31:[1,70],32:[1,71],33:[1,72],36:[1,28],38:[1,27],39:26},{18:[2,49],24:[2,49],31:[2,49],32:[2,49],33:[2,49],36:[2,49],38:[2,49],40:[2,49]},{18:[1,74]},{5:[2,22],14:[2,22],15:[2,22],16:[2,22],19:[2,22],20:[2,22],22:[2,22],23:[2,22],25:[2,22]},{18:[2,39],24:[2,39],36:[2,39]},{18:[2,40],24:[2,40],36:[2,40]},{18:[2,41],24:[2,41],36:[2,41]},{18:[2,42],24:[2,42],36:[2,42]},{18:[2,43],24:[2,43],36:[2,43]},{5:[2,18],14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],25:[2,18]}],defaultActions:{17:[2,1]},parseError:function(e){throw Error(e)
},parse:function(e){function i(){var e;return e=n.lexer.lex()||1,"number"!=typeof e&&(e=n.symbols_[e]||e),e}var n=this,a=[0],s=[null],r=[],l=this.table,o="",c=0,d=0,h=0;this.lexer.setInput(e),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,this.lexer.yylloc===t&&(this.lexer.yylloc={});var u=this.lexer.yylloc;r.push(u);var p=this.lexer.options&&this.lexer.options.ranges;"function"==typeof this.yy.parseError&&(this.parseError=this.yy.parseError);for(var f,m,g,v,y,b,w,x,k,S={};;){if(g=a[a.length-1],this.defaultActions[g]?v=this.defaultActions[g]:((null===f||f===t)&&(f=i()),v=l[g]&&l[g][f]),v===t||!v.length||!v[0]){var C="";
if(!h){k=[];for(b in l[g])this.terminals_[b]&&b>2&&k.push("'"+this.terminals_[b]+"'");C=this.lexer.showPosition?"Parse error on line "+(c+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+k.join(", ")+", got '"+(this.terminals_[f]||f)+"'":"Parse error on line "+(c+1)+": Unexpected "+(1==f?"end of input":"'"+(this.terminals_[f]||f)+"'"),this.parseError(C,{text:this.lexer.match,token:this.terminals_[f]||f,line:this.lexer.yylineno,loc:u,expected:k})}}if(v[0]instanceof Array&&v.length>1)throw Error("Parse Error: multiple actions possible at state: "+g+", token: "+f);
switch(v[0]){case 1:a.push(f),s.push(this.lexer.yytext),r.push(this.lexer.yylloc),a.push(v[1]),f=null,m?(f=m,m=null):(d=this.lexer.yyleng,o=this.lexer.yytext,c=this.lexer.yylineno,u=this.lexer.yylloc,h>0&&h--);break;case 2:if(w=this.productions_[v[1]][1],S.$=s[s.length-w],S._$={first_line:r[r.length-(w||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(w||1)].first_column,last_column:r[r.length-1].last_column},p&&(S._$.range=[r[r.length-(w||1)].range[0],r[r.length-1].range[1]]),y=this.performAction.call(S,o,d,c,this.yy,v[1],s,r),y!==t)return y;
w&&(a=a.slice(0,2*-1*w),s=s.slice(0,-1*w),r=r.slice(0,-1*w)),a.push(this.productions_[v[1]][0]),s.push(S.$),r.push(S._$),x=l[a[a.length-2]][a[a.length-1]],a.push(x);break;case 3:return!0}}return!0}},n=function(){var e={EOF:1,parseError:function(e,t){if(!this.yy.parser)throw Error(e);this.yy.parser.parseError(e,t)},setInput:function(e){return this._input=e,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this
},input:function(){var e=this._input[0];this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e;var t=e.match(/(?:\r\n?|\n).*/g);return t?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},unput:function(e){var t=e.length,i=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t-1),this.offset-=t;var n=this.match.split(/(?:\r\n?|\n)/g);
this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),i.length-1&&(this.yylineno-=i.length-1);var a=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:i?(i.length===n.length?this.yylloc.first_column:0)+n[n.length-i.length].length-i[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[a[0],a[0]+this.yyleng-t]),this},more:function(){return this._more=!0,this
},less:function(e){this.unput(this.match.slice(e))},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var e=this.match;return 20>e.length&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput(),t=Array(e.length+1).join("-");return e+this.upcomingInput()+"\n"+t+"^"},next:function(){if(this.done)return this.EOF;
this._input||(this.done=!0);var e,i,n,a,s;this._more||(this.yytext="",this.match="");for(var r=this._currentRules(),l=0;r.length>l&&(n=this._input.match(this.rules[r[l]]),!n||i&&!(n[0].length>i[0].length)||(i=n,a=l,this.options.flex));l++);return i?(s=i[0].match(/(?:\r\n?|\n).*/g),s&&(this.yylineno+=s.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:s?s[s.length-1].length-s[s.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+i[0].length},this.yytext+=i[0],this.match+=i[0],this.matches=i,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(i[0].length),this.matched+=i[0],e=this.performAction.call(this,this.yy,this,r[a],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),e?e:t):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})
},lex:function(){var e=this.next();return e!==t?e:this.lex()},begin:function(e){this.conditionStack.push(e)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(e){this.begin(e)}};return e.options={},e.performAction=function(e,t,i,n){switch(i){case 0:return t.yytext="\\",14;case 1:if("\\"!==t.yytext.slice(-1)&&this.begin("mu"),"\\"===t.yytext.slice(-1)&&(t.yytext=t.yytext.substr(0,t.yyleng-1),this.begin("emu")),t.yytext)return 14;
break;case 2:return 14;case 3:return"\\"!==t.yytext.slice(-1)&&this.popState(),"\\"===t.yytext.slice(-1)&&(t.yytext=t.yytext.substr(0,t.yyleng-1)),14;case 4:return t.yytext=t.yytext.substr(0,t.yyleng-4),this.popState(),15;case 5:return 25;case 6:return 16;case 7:return 20;case 8:return 19;case 9:return 19;case 10:return 23;case 11:return 22;case 12:this.popState(),this.begin("com");break;case 13:return t.yytext=t.yytext.substr(3,t.yyleng-5),this.popState(),15;case 14:return 22;case 15:return 37;case 16:return 36;
case 17:return 36;case 18:return 40;case 19:break;case 20:return this.popState(),24;case 21:return this.popState(),18;case 22:return t.yytext=t.yytext.substr(1,t.yyleng-2).replace(/\\"/g,'"'),31;case 23:return t.yytext=t.yytext.substr(1,t.yyleng-2).replace(/\\'/g,"'"),31;case 24:return 38;case 25:return 33;case 26:return 33;case 27:return 32;case 28:return 36;case 29:return t.yytext=t.yytext.substr(1,t.yyleng-2),36;case 30:return"INVALID";case 31:return 5}},e.rules=[/^(?:\\\\(?=(\{\{)))/,/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|$)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\{\{>)/,/^(?:\{\{#)/,/^(?:\{\{\/)/,/^(?:\{\{\^)/,/^(?:\{\{\s*else\b)/,/^(?:\{\{\{)/,/^(?:\{\{&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{)/,/^(?:=)/,/^(?:\.(?=[}\/ ]))/,/^(?:\.\.)/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}\}\})/,/^(?:\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=[}\s]))/,/^(?:false(?=[}\s]))/,/^(?:-?[0-9]+(?=[}\s]))/,/^(?:[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.]))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/],e.conditions={mu:{rules:[5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31],inclusive:!1},emu:{rules:[3],inclusive:!1},com:{rules:[4],inclusive:!1},INITIAL:{rules:[0,1,2,31],inclusive:!0}},e
}();return i.lexer=n,e.prototype=i,i.Parser=e,new e}();e.Parser=s,e.parse=function(t){return t.constructor===e.AST.ProgramNode?t:(e.Parser.yy=e.AST,e.Parser.parse(t))},e.AST={},e.AST.ProgramNode=function(t,i){this.type="program",this.statements=t,i&&(this.inverse=new e.AST.ProgramNode(i))},e.AST.MustacheNode=function(e,t,i){this.type="mustache",this.escaped=!i,this.hash=t;var n=this.id=e[0],a=this.params=e.slice(1),s=this.eligibleHelper=n.isSimple;this.isHelper=s&&(a.length||t)},e.AST.PartialNode=function(e,t){this.type="partial",this.partialName=e,this.context=t
},e.AST.BlockNode=function(t,i,n,a){var s=function(t,i){if(t.original!==i.original)throw new e.Exception(t.original+" doesn't match "+i.original)};s(t.id,a),this.type="block",this.mustache=t,this.program=i,this.inverse=n,this.inverse&&!this.program&&(this.isInverse=!0)},e.AST.ContentNode=function(e){this.type="content",this.string=e},e.AST.HashNode=function(e){this.type="hash",this.pairs=e},e.AST.IdNode=function(t){this.type="ID";for(var i="",n=[],a=0,s=0,r=t.length;r>s;s++){var l=t[s].part;if(i+=(t[s].separator||"")+l,".."===l||"."===l||"this"===l){if(n.length>0)throw new e.Exception("Invalid path: "+i);
".."===l?a++:this.isScoped=!0}else n.push(l)}this.original=i,this.parts=n,this.string=n.join("."),this.depth=a,this.isSimple=1===t.length&&!this.isScoped&&0===a,this.stringModeValue=this.string},e.AST.PartialNameNode=function(e){this.type="PARTIAL_NAME",this.name=e.original},e.AST.DataNode=function(e){this.type="DATA",this.id=e},e.AST.StringNode=function(e){this.type="STRING",this.original=this.string=this.stringModeValue=e},e.AST.IntegerNode=function(e){this.type="INTEGER",this.original=this.integer=e,this.stringModeValue=Number(e)
},e.AST.BooleanNode=function(e){this.type="BOOLEAN",this.bool=e,this.stringModeValue="true"===e},e.AST.CommentNode=function(e){this.type="comment",this.comment=e};var r=["description","fileName","lineNumber","message","name","number","stack"];e.Exception=function(){for(var e=Error.prototype.constructor.apply(this,arguments),t=0;r.length>t;t++)this[r[t]]=e[r[t]]},e.Exception.prototype=Error(),e.SafeString=function(e){this.string=e},e.SafeString.prototype.toString=function(){return""+this.string};var l={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},o=/[&<>"'`]/g,c=/[&<>"'`]/,d=function(e){return l[e]||"&amp;"
};e.Utils={extend:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])},escapeExpression:function(t){return t instanceof e.SafeString?""+t:null==t||t===!1?"":(t=""+t,c.test(t)?t.replace(o,d):t)},isEmpty:function(e){return e||0===e?"[object Array]"===i.call(e)&&0===e.length?!0:!1:!0}};var h=e.Compiler=function(){},u=e.JavaScriptCompiler=function(){};h.prototype={compiler:h,disassemble:function(){for(var e,t,i,n=this.opcodes,a=[],s=0,r=n.length;r>s;s++)if(e=n[s],"DECLARE"===e.opcode)a.push("DECLARE "+e.name+"="+e.value);
else{t=[];for(var l=0;e.args.length>l;l++)i=e.args[l],"string"==typeof i&&(i='"'+i.replace("\n","\\n")+'"'),t.push(i);a.push(e.opcode+" "+t.join(" "))}return a.join("\n")},equals:function(e){var t=this.opcodes.length;if(e.opcodes.length!==t)return!1;for(var i=0;t>i;i++){var n=this.opcodes[i],a=e.opcodes[i];if(n.opcode!==a.opcode||n.args.length!==a.args.length)return!1;for(var s=0;n.args.length>s;s++)if(n.args[s]!==a.args[s])return!1}if(t=this.children.length,e.children.length!==t)return!1;for(i=0;t>i;i++)if(!this.children[i].equals(e.children[i]))return!1;
return!0},guid:0,compile:function(e,t){this.children=[],this.depths={list:[]},this.options=t;var i=this.options.knownHelpers;if(this.options.knownHelpers={helperMissing:!0,blockHelperMissing:!0,each:!0,"if":!0,unless:!0,"with":!0,log:!0},i)for(var n in i)this.options.knownHelpers[n]=i[n];return this.program(e)},accept:function(e){return this[e.type](e)},program:function(e){var t,i=e.statements;this.opcodes=[];for(var n=0,a=i.length;a>n;n++)t=i[n],this[t.type](t);return this.isSimple=1===a,this.depths.list=this.depths.list.sort(function(e,t){return e-t
}),this},compileProgram:function(e){var t,i=(new this.compiler).compile(e,this.options),n=this.guid++;this.usePartial=this.usePartial||i.usePartial,this.children[n]=i;for(var a=0,s=i.depths.list.length;s>a;a++)t=i.depths.list[a],2>t||this.addDepth(t-1);return n},block:function(e){var t=e.mustache,i=e.program,n=e.inverse;i&&(i=this.compileProgram(i)),n&&(n=this.compileProgram(n));var a=this.classifyMustache(t);"helper"===a?this.helperMustache(t,i,n):"simple"===a?(this.simpleMustache(t),this.opcode("pushProgram",i),this.opcode("pushProgram",n),this.opcode("emptyHash"),this.opcode("blockValue")):(this.ambiguousMustache(t,i,n),this.opcode("pushProgram",i),this.opcode("pushProgram",n),this.opcode("emptyHash"),this.opcode("ambiguousBlockValue")),this.opcode("append")
},hash:function(e){var t,i,n=e.pairs;this.opcode("pushHash");for(var a=0,s=n.length;s>a;a++)t=n[a],i=t[1],this.options.stringParams?(i.depth&&this.addDepth(i.depth),this.opcode("getContext",i.depth||0),this.opcode("pushStringParam",i.stringModeValue,i.type)):this.accept(i),this.opcode("assignToHash",t[0]);this.opcode("popHash")},partial:function(e){var t=e.partialName;this.usePartial=!0,e.context?this.ID(e.context):this.opcode("push","depth0"),this.opcode("invokePartial",t.name),this.opcode("append")
},content:function(e){this.opcode("appendContent",e.string)},mustache:function(e){var t=this.options,i=this.classifyMustache(e);"simple"===i?this.simpleMustache(e):"helper"===i?this.helperMustache(e):this.ambiguousMustache(e),e.escaped&&!t.noEscape?this.opcode("appendEscaped"):this.opcode("append")},ambiguousMustache:function(e,t,i){var n=e.id,a=n.parts[0],s=null!=t||null!=i;this.opcode("getContext",n.depth),this.opcode("pushProgram",t),this.opcode("pushProgram",i),this.opcode("invokeAmbiguous",a,s)
},simpleMustache:function(e){var t=e.id;"DATA"===t.type?this.DATA(t):t.parts.length?this.ID(t):(this.addDepth(t.depth),this.opcode("getContext",t.depth),this.opcode("pushContext")),this.opcode("resolvePossibleLambda")},helperMustache:function(e,t,i){var n=this.setupFullMustacheParams(e,t,i),a=e.id.parts[0];if(this.options.knownHelpers[a])this.opcode("invokeKnownHelper",n.length,a);else{if(this.options.knownHelpersOnly)throw Error("You specified knownHelpersOnly, but used the unknown helper "+a);this.opcode("invokeHelper",n.length,a)
}},ID:function(e){this.addDepth(e.depth),this.opcode("getContext",e.depth);var t=e.parts[0];t?this.opcode("lookupOnContext",e.parts[0]):this.opcode("pushContext");for(var i=1,n=e.parts.length;n>i;i++)this.opcode("lookup",e.parts[i])},DATA:function(t){if(this.options.data=!0,t.id.isScoped||t.id.depth)throw new e.Exception("Scoped data references are not supported: "+t.original);this.opcode("lookupData");for(var i=t.id.parts,n=0,a=i.length;a>n;n++)this.opcode("lookup",i[n])},STRING:function(e){this.opcode("pushString",e.string)
},INTEGER:function(e){this.opcode("pushLiteral",e.integer)},BOOLEAN:function(e){this.opcode("pushLiteral",e.bool)},comment:function(){},opcode:function(e){this.opcodes.push({opcode:e,args:[].slice.call(arguments,1)})},declare:function(e,t){this.opcodes.push({opcode:"DECLARE",name:e,value:t})},addDepth:function(e){if(isNaN(e))throw Error("EWOT");0!==e&&(this.depths[e]||(this.depths[e]=!0,this.depths.list.push(e)))},classifyMustache:function(e){var t=e.isHelper,i=e.eligibleHelper,n=this.options;if(i&&!t){var a=e.id.parts[0];
n.knownHelpers[a]?t=!0:n.knownHelpersOnly&&(i=!1)}return t?"helper":i?"ambiguous":"simple"},pushParams:function(e){for(var t,i=e.length;i--;)t=e[i],this.options.stringParams?(t.depth&&this.addDepth(t.depth),this.opcode("getContext",t.depth||0),this.opcode("pushStringParam",t.stringModeValue,t.type)):this[t.type](t)},setupMustacheParams:function(e){var t=e.params;return this.pushParams(t),e.hash?this.hash(e.hash):this.opcode("emptyHash"),t},setupFullMustacheParams:function(e,t,i){var n=e.params;return this.pushParams(n),this.opcode("pushProgram",t),this.opcode("pushProgram",i),e.hash?this.hash(e.hash):this.opcode("emptyHash"),n
}};var p=function(e){this.value=e};u.prototype={nameLookup:function(e,t){return/^[0-9]+$/.test(t)?e+"["+t+"]":u.isValidJavaScriptVariableName(t)?e+"."+t:e+"['"+t+"']"},appendToBuffer:function(e){return this.environment.isSimple?"return "+e+";":{appendToBuffer:!0,content:e,toString:function(){return"buffer += "+e+";"}}},initializeBuffer:function(){return this.quotedString("")},namespace:"Handlebars",compile:function(t,i,n,a){this.environment=t,this.options=i||{},e.log(e.logger.DEBUG,this.environment.disassemble()+"\n\n"),this.name=this.environment.name,this.isChild=!!n,this.context=n||{programs:[],environments:[],aliases:{}},this.preamble(),this.stackSlot=0,this.stackVars=[],this.registers={list:[]},this.compileStack=[],this.inlineStack=[],this.compileChildren(t,i);
var s,r=t.opcodes;for(this.i=0,v=r.length;v>this.i;this.i++)s=r[this.i],"DECLARE"===s.opcode?this[s.name]=s.value:this[s.opcode].apply(this,s.args);return this.createFunctionContext(a)},nextOpcode:function(){var e=this.environment.opcodes;return e[this.i+1]},eat:function(){this.i=this.i+1},preamble:function(){var e=[];if(this.isChild)e.push("");else{var t=this.namespace,i="helpers = this.merge(helpers, "+t+".helpers);";this.environment.usePartial&&(i=i+" partials = this.merge(partials, "+t+".partials);"),this.options.data&&(i+=" data = data || {};"),e.push(i)
}this.environment.isSimple?e.push(""):e.push(", buffer = "+this.initializeBuffer()),this.lastContext=0,this.source=e},createFunctionContext:function(t){var i=this.stackVars.concat(this.registers.list);if(i.length>0&&(this.source[1]=this.source[1]+", "+i.join(", ")),!this.isChild)for(var n in this.context.aliases)this.context.aliases.hasOwnProperty(n)&&(this.source[1]=this.source[1]+", "+n+"="+this.context.aliases[n]);this.source[1]&&(this.source[1]="var "+this.source[1].substring(2)+";"),this.isChild||(this.source[1]+="\n"+this.context.programs.join("\n")+"\n"),this.environment.isSimple||this.source.push("return buffer;");
for(var a=this.isChild?["depth0","data"]:["Handlebars","depth0","helpers","partials","data"],s=0,r=this.environment.depths.list.length;r>s;s++)a.push("depth"+this.environment.depths.list[s]);var l=this.mergeSource();if(!this.isChild){var o=e.COMPILER_REVISION,c=e.REVISION_CHANGES[o];l="this.compilerInfo = ["+o+",'"+c+"'];\n"+l}if(t)return a.push(l),Function.apply(this,a);var d="function "+(this.name||"")+"("+a.join(",")+") {\n  "+l+"}";return e.log(e.logger.DEBUG,d+"\n\n"),d},mergeSource:function(){for(var e,i="",n=0,a=this.source.length;a>n;n++){var s=this.source[n];
s.appendToBuffer?e=e?e+"\n    + "+s.content:s.content:(e&&(i+="buffer += "+e+";\n  ",e=t),i+=s+"\n  ")}return i},blockValue:function(){this.context.aliases.blockHelperMissing="helpers.blockHelperMissing";var e=["depth0"];this.setupParams(0,e),this.replaceStack(function(t){return e.splice(1,0,t),"blockHelperMissing.call("+e.join(", ")+")"})},ambiguousBlockValue:function(){this.context.aliases.blockHelperMissing="helpers.blockHelperMissing";var e=["depth0"];this.setupParams(0,e);var t=this.topStack();
e.splice(1,0,t),e[e.length-1]="options",this.source.push("if (!"+this.lastHelper+") { "+t+" = blockHelperMissing.call("+e.join(", ")+"); }")},appendContent:function(e){this.source.push(this.appendToBuffer(this.quotedString(e)))},append:function(){this.flushInline();var e=this.popStack();this.source.push("if("+e+" || "+e+" === 0) { "+this.appendToBuffer(e)+" }"),this.environment.isSimple&&this.source.push("else { "+this.appendToBuffer("''")+" }")},appendEscaped:function(){this.context.aliases.escapeExpression="this.escapeExpression",this.source.push(this.appendToBuffer("escapeExpression("+this.popStack()+")"))
},getContext:function(e){this.lastContext!==e&&(this.lastContext=e)},lookupOnContext:function(e){this.push(this.nameLookup("depth"+this.lastContext,e,"context"))},pushContext:function(){this.pushStackLiteral("depth"+this.lastContext)},resolvePossibleLambda:function(){this.context.aliases.functionType='"function"',this.replaceStack(function(e){return"typeof "+e+" === functionType ? "+e+".apply(depth0) : "+e})},lookup:function(e){this.replaceStack(function(t){return t+" == null || "+t+" === false ? "+t+" : "+this.nameLookup(t,e,"context")
})},lookupData:function(){this.push("data")},pushStringParam:function(e,t){this.pushStackLiteral("depth"+this.lastContext),this.pushString(t),"string"==typeof e?this.pushString(e):this.pushStackLiteral(e)},emptyHash:function(){this.pushStackLiteral("{}"),this.options.stringParams&&(this.register("hashTypes","{}"),this.register("hashContexts","{}"))},pushHash:function(){this.hash={values:[],types:[],contexts:[]}},popHash:function(){var e=this.hash;this.hash=t,this.options.stringParams&&(this.register("hashContexts","{"+e.contexts.join(",")+"}"),this.register("hashTypes","{"+e.types.join(",")+"}")),this.push("{\n    "+e.values.join(",\n    ")+"\n  }")
},pushString:function(e){this.pushStackLiteral(this.quotedString(e))},push:function(e){return this.inlineStack.push(e),e},pushLiteral:function(e){this.pushStackLiteral(e)},pushProgram:function(e){null!=e?this.pushStackLiteral(this.programExpression(e)):this.pushStackLiteral(null)},invokeHelper:function(e,t){this.context.aliases.helperMissing="helpers.helperMissing";var i=this.lastHelper=this.setupHelper(e,t,!0),n=this.nameLookup("depth"+this.lastContext,t,"context");this.push(i.name+" || "+n),this.replaceStack(function(e){return e+" ? "+e+".call("+i.callParams+") "+": helperMissing.call("+i.helperMissingParams+")"
})},invokeKnownHelper:function(e,t){var i=this.setupHelper(e,t);this.push(i.name+".call("+i.callParams+")")},invokeAmbiguous:function(e,t){this.context.aliases.functionType='"function"',this.pushStackLiteral("{}");var i=this.setupHelper(0,e,t),n=this.lastHelper=this.nameLookup("helpers",e,"helper"),a=this.nameLookup("depth"+this.lastContext,e,"context"),s=this.nextStack();this.source.push("if ("+s+" = "+n+") { "+s+" = "+s+".call("+i.callParams+"); }"),this.source.push("else { "+s+" = "+a+"; "+s+" = typeof "+s+" === functionType ? "+s+".apply(depth0) : "+s+"; }")
},invokePartial:function(e){var t=[this.nameLookup("partials",e,"partial"),"'"+e+"'",this.popStack(),"helpers","partials"];this.options.data&&t.push("data"),this.context.aliases.self="this",this.push("self.invokePartial("+t.join(", ")+")")},assignToHash:function(e){var t,i,n=this.popStack();this.options.stringParams&&(i=this.popStack(),t=this.popStack());var a=this.hash;t&&a.contexts.push("'"+e+"': "+t),i&&a.types.push("'"+e+"': "+i),a.values.push("'"+e+"': ("+n+")")},compiler:u,compileChildren:function(e,t){for(var i,n,a=e.children,s=0,r=a.length;r>s;s++){i=a[s],n=new this.compiler;
var l=this.matchExistingProgram(i);null==l?(this.context.programs.push(""),l=this.context.programs.length,i.index=l,i.name="program"+l,this.context.programs[l]=n.compile(i,t,this.context),this.context.environments[l]=i):(i.index=l,i.name="program"+l)}},matchExistingProgram:function(e){for(var t=0,i=this.context.environments.length;i>t;t++){var n=this.context.environments[t];if(n&&n.equals(e))return t}},programExpression:function(e){if(this.context.aliases.self="this",null==e)return"self.noop";for(var t,i=this.environment.children[e],n=i.depths.list,a=[i.index,i.name,"data"],s=0,r=n.length;r>s;s++)t=n[s],1===t?a.push("depth0"):a.push("depth"+(t-1));
return(0===n.length?"self.program(":"self.programWithDepth(")+a.join(", ")+")"},register:function(e,t){this.useRegister(e),this.source.push(e+" = "+t+";")},useRegister:function(e){this.registers[e]||(this.registers[e]=!0,this.registers.list.push(e))},pushStackLiteral:function(e){return this.push(new p(e))},pushStack:function(e){this.flushInline();var t=this.incrStack();return e&&this.source.push(t+" = "+e+";"),this.compileStack.push(t),t},replaceStack:function(e){var t,i="",n=this.isInline();if(n){var a=this.popStack(!0);
if(a instanceof p)t=a.value;else{var s=this.stackSlot?this.topStackName():this.incrStack();i="("+this.push(s)+" = "+a+"),",t=this.topStack()}}else t=this.topStack();var r=e.call(this,t);return n?((this.inlineStack.length||this.compileStack.length)&&this.popStack(),this.push("("+i+r+")")):(/^stack/.test(t)||(t=this.nextStack()),this.source.push(t+" = ("+i+r+");")),t},nextStack:function(){return this.pushStack()},incrStack:function(){return this.stackSlot++,this.stackSlot>this.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()
},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var e=this.inlineStack;if(e.length){this.inlineStack=[];for(var t=0,i=e.length;i>t;t++){var n=e[t];n instanceof p?this.compileStack.push(n):this.pushStack(n)}}},isInline:function(){return this.inlineStack.length},popStack:function(e){var t=this.isInline(),i=(t?this.inlineStack:this.compileStack).pop();return!e&&i instanceof p?i.value:(t||this.stackSlot--,i)},topStack:function(e){var t=this.isInline()?this.inlineStack:this.compileStack,i=t[t.length-1];
return!e&&i instanceof p?i.value:i},quotedString:function(e){return'"'+e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")+'"'},setupHelper:function(e,t,i){var n=[];this.setupParams(e,n,i);var a=this.nameLookup("helpers",t,"helper");return{params:n,name:a,callParams:["depth0"].concat(n).join(", "),helperMissingParams:i&&["depth0",this.quotedString(t)].concat(n).join(", ")}},setupParams:function(e,t,i){var n,a,s,r=[],l=[],o=[];
r.push("hash:"+this.popStack()),a=this.popStack(),s=this.popStack(),(s||a)&&(s||(this.context.aliases.self="this",s="self.noop"),a||(this.context.aliases.self="this",a="self.noop"),r.push("inverse:"+a),r.push("fn:"+s));for(var c=0;e>c;c++)n=this.popStack(),t.push(n),this.options.stringParams&&(o.push(this.popStack()),l.push(this.popStack()));return this.options.stringParams&&(r.push("contexts:["+l.join(",")+"]"),r.push("types:["+o.join(",")+"]"),r.push("hashContexts:hashContexts"),r.push("hashTypes:hashTypes")),this.options.data&&r.push("data:data"),r="{"+r.join(",")+"}",i?(this.register("options",r),t.push("options")):t.push(r),t.join(", ")
}};for(var f="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield".split(" "),m=u.RESERVED_WORDS={},g=0,v=f.length;v>g;g++)m[f[g]]=!0;u.isValidJavaScriptVariableName=function(e){return!u.RESERVED_WORDS[e]&&/^[a-zA-Z_$][0-9a-zA-Z_$]+$/.test(e)?!0:!1
},e.precompile=function(t,i){if(null==t||"string"!=typeof t&&t.constructor!==e.AST.ProgramNode)throw new e.Exception("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+t);i=i||{},"data"in i||(i.data=!0);var n=e.parse(t),a=(new h).compile(n,i);return(new u).compile(a,i)},e.compile=function(i,n){function a(){var a=e.parse(i),s=(new h).compile(a,n),r=(new u).compile(s,n,t,!0);return e.template(r)}if(null==i||"string"!=typeof i&&i.constructor!==e.AST.ProgramNode)throw new e.Exception("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+i);
n=n||{},"data"in n||(n.data=!0);var s;return function(e,t){return s||(s=a()),s.call(this,e,t)}},e.VM={template:function(t){var i={escapeExpression:e.Utils.escapeExpression,invokePartial:e.VM.invokePartial,programs:[],program:function(t,i,n){var a=this.programs[t];return n?a=e.VM.program(t,i,n):a||(a=this.programs[t]=e.VM.program(t,i)),a},merge:function(t,i){var n=t||i;return t&&i&&(n={},e.Utils.extend(n,i),e.Utils.extend(n,t)),n},programWithDepth:e.VM.programWithDepth,noop:e.VM.noop,compilerInfo:null};
return function(n,a){a=a||{};var s=t.call(i,e,n,a.helpers,a.partials,a.data),r=i.compilerInfo||[],l=r[0]||1,o=e.COMPILER_REVISION;if(l!==o){if(o>l){var c=e.REVISION_CHANGES[o],d=e.REVISION_CHANGES[l];throw"Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+c+") or downgrade your runtime to an older version ("+d+")."}throw"Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+r[1]+")."
}return s}},programWithDepth:function(e,t,i){var n=Array.prototype.slice.call(arguments,3),a=function(e,a){return a=a||{},t.apply(this,[e,a.data||i].concat(n))};return a.program=e,a.depth=n.length,a},program:function(e,t,i){var n=function(e,n){return n=n||{},t(e,n.data||i)};return n.program=e,n.depth=0,n},noop:function(){return""},invokePartial:function(i,n,a,s,r,l){var o={helpers:s,partials:r,data:l};if(i===t)throw new e.Exception("The partial "+n+" could not be found");if(i instanceof Function)return i(a,o);
if(e.compile)return r[n]=e.compile(i,{data:l!==t}),r[n](a,o);throw new e.Exception("The partial "+n+" could not be compiled when running in runtime-only mode")}},e.template=e.VM.template})(Handlebars),define("handlebars",function(e){return function(){var t;return t||e.Handlebars}}(this)),define("text",["module"],function(e){var t,i,n=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],a=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,s=/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,r="undefined"!=typeof location&&location.href,l=r&&location.protocol&&location.protocol.replace(/\:/,""),o=r&&location.hostname,c=r&&(location.port||void 0),d=[],h=e.config&&e.config()||{};
return t={version:"2.0.5",strip:function(e){if(e){e=e.replace(a,"");var t=e.match(s);t&&(e=t[1])}else e="";return e},jsEscape:function(e){return e.replace(/(['\\])/g,"\\$1").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r").replace(/[\u2028]/g,"\\u2028").replace(/[\u2029]/g,"\\u2029")},createXhr:h.createXhr||function(){var e,t,i;if("undefined"!=typeof XMLHttpRequest)return new XMLHttpRequest;if("undefined"!=typeof ActiveXObject)for(t=0;3>t;t+=1){i=n[t];
try{e=new ActiveXObject(i)}catch(a){}if(e){n=[i];break}}return e},parseName:function(e){var t,i,n,a=!1,s=e.indexOf("."),r=0===e.indexOf("./")||0===e.indexOf("../");return-1!==s&&(!r||s>1)?(t=e.substring(0,s),i=e.substring(s+1,e.length)):t=e,n=i||t,s=n.indexOf("!"),-1!==s&&(a="strip"===n.substring(s+1),n=n.substring(0,s),i?i=n:t=n),{moduleName:t,ext:i,strip:a}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(e,i,n,a){var s,r,l,o=t.xdRegExp.exec(e);return o?(s=o[2],r=o[3],r=r.split(":"),l=r[1],r=r[0],!(s&&s!==i||r&&r.toLowerCase()!==n.toLowerCase()||(l||r)&&l!==a)):!0
},finishLoad:function(e,i,n,a){n=i?t.strip(n):n,h.isBuild&&(d[e]=n),a(n)},load:function(e,i,n,a){if(a.isBuild&&!a.inlineText)return n(),void 0;h.isBuild=a.isBuild;var s=t.parseName(e),d=s.moduleName+(s.ext?"."+s.ext:""),u=i.toUrl(d),p=h.useXhr||t.useXhr;!r||p(u,l,o,c)?t.get(u,function(i){t.finishLoad(e,s.strip,i,n)},function(e){n.error&&n.error(e)}):i([d],function(e){t.finishLoad(s.moduleName+"."+s.ext,s.strip,e,n)})},write:function(e,i,n){if(d.hasOwnProperty(i)){var a=t.jsEscape(d[i]);n.asModule(e+"!"+i,"define(function () { return '"+a+"';});\n")
}},writeFile:function(e,i,n,a,s){var r=t.parseName(i),l=r.ext?"."+r.ext:"",o=r.moduleName+l,c=n.toUrl(r.moduleName+l)+".js";t.load(o,n,function(){var i=function(e){return a(c,e)};i.asModule=function(e,t){return a.asModule(e,c,t)},t.write(e,o,i,s)},s)}},"node"===h.env||!h.env&&"undefined"!=typeof process&&process.versions&&process.versions.node?(i=require.nodeRequire("fs"),t.get=function(e,t){var n=i.readFileSync(e,"utf8");0===n.indexOf("﻿")&&(n=n.substring(1)),t(n)}):"xhr"===h.env||!h.env&&t.createXhr()?t.get=function(e,i,n,a){var s,r=t.createXhr();
if(r.open("GET",e,!0),a)for(s in a)a.hasOwnProperty(s)&&r.setRequestHeader(s.toLowerCase(),a[s]);h.onXhr&&h.onXhr(r,e),r.onreadystatechange=function(){var t,a;4===r.readyState&&(t=r.status,t>399&&600>t?(a=Error(e+" HTTP status: "+t),a.xhr=r,n(a)):i(r.responseText))},r.send(null)}:("rhino"===h.env||!h.env&&"undefined"!=typeof Packages&&"undefined"!=typeof java)&&(t.get=function(e,t){var i,n,a="utf-8",s=new java.io.File(e),r=java.lang.System.getProperty("line.separator"),l=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(s),a)),o="";
try{for(i=new java.lang.StringBuffer,n=l.readLine(),n&&n.length()&&65279===n.charAt(0)&&(n=n.substring(1)),i.append(n);null!==(n=l.readLine());)i.append(r),i.append(n);o=""+i+""}finally{l.close()}t(o)}),t}),define("hb",["handlebars","text"],function(e,t){var i={},n=function(n,a,s,r){var l="";if(r.isBuild&&"undefined"!=typeof process&&process.versions&&process.versions.node){var o=require.nodeRequire("fs");l=o.readFileSync(r.templatePathPrefix+n,"utf8");var c=e.precompile(l);i[n]=c,s(c)}else t.get(a.toUrl(n),function(t){var i=e.compile(t);
s(i)})},a=function(e,t,n){if(t in i){var a=i[t];n('define("'+e+"!"+t+'", ["handlebars"], function (Handlebars){'+"return Handlebars.template("+a+");"+"});\n")}};return{load:n,write:a}}),define("hb!templates/desktop/helpers/LockableTextInput.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return"selected"}function r(e,t){var n,a="";return a+='\n			<textarea class="input-dark span12 lockable-field" name="',(n=i.name)?n=n.call(e,{hash:{},data:t}):(n=e.name,n=typeof n===p?n.apply(e):n),a+=f(n)+'"',n=i["if"].call(e,e.rows,{hash:{},inverse:m.noop,fn:m.program(4,l,t),data:t}),(n||0===n)&&(a+=n),a+=">",(n=i.value)?n=n.call(e,{hash:{},data:t}):(n=e.value,n=typeof n===p?n.apply(e):n),a+=f(n)+"</textarea>\n		"
}function l(e,t){var n,a="";return a+=' rows="',(n=i.rows)?n=n.call(e,{hash:{},data:t}):(n=e.rows,n=typeof n===p?n.apply(e):n),a+=f(n)+'"'}function o(e,t){var n,a="";return a+='\n			<input class="input-dark span12 lockable-field" type="',(n=i.type)?n=n.call(e,{hash:{},data:t}):(n=e.type,n=typeof n===p?n.apply(e):n),a+=f(n)+'" name="',(n=i.name)?n=n.call(e,{hash:{},data:t}):(n=e.name,n=typeof n===p?n.apply(e):n),a+=f(n)+'" value="',(n=i.value)?n=n.call(e,{hash:{},data:t}):(n=e.value,n=typeof n===p?n.apply(e):n),a+=f(n)+'">\n		'
}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var c,d,h,u="",p="function",f=this.escapeExpression,m=this,g=i.helperMissing;return u+='<div class="control-group">\n	<label>',h={hash:{},data:a},u+=f((c=i.t||t.t,c?c.call(t,t.label,h):g.call(t,"t",t.label,h)))+'</label>\n	<a href="#" data-field="',(d=i.name)?d=d.call(t,{hash:{},data:a}):(d=t.name,d=typeof d===p?d.apply(t):d),u+=f(d)+'" class="badge lock-btn ',d=i["if"].call(t,t.locked,{hash:{},inverse:m.noop,fn:m.program(1,s,a),data:a}),(d||0===d)&&(u+=d),u+='"><i class="glyphicon lock"></i></a>\n\n	<div class="lockable-input">\n		',h={hash:{},inverse:m.program(6,o,a),fn:m.program(3,r,a),data:a},c=i.if_eq||t.if_eq,d=c?c.call(t,t.type,"textarea",h):g.call(t,"if_eq",t.type,"textarea",h),(d||0===d)&&(u+=d),u+="\n	</div>\n</div>\n"
})}),define("hb!templates/desktop/helpers/LockableTagInput.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return"selected"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var r,l,o,c="",d=i.helperMissing,h=this.escapeExpression,u="function",p=this;return c+='<div class="control-group">\n	<label>',o={hash:{},data:a},c+=h((r=i.t||t.t,r?r.call(t,t.label,o):d.call(t,"t",t.label,o)))+'</label>\n	<a href="#" data-field="',(l=i.name)?l=l.call(t,{hash:{},data:a}):(l=t.name,l=typeof l===u?l.apply(t):l),c+=h(l)+'" class="badge lock-btn ',l=i["if"].call(t,t.locked,{hash:{},inverse:p.noop,fn:p.program(1,s,a),data:a}),(l||0===l)&&(c+=l),c+='"><i class="glyphicon lock"></i></a>\n\n	<div class="lockable-input">\n		<input type="hidden" class="span12 lockable-field input-select2" value="',o={hash:{},data:a},c+=h((r=i.tags||t.tags,r?r.call(t,t.value,o):d.call(t,"tags",t.value,o)))+'" data-name="',(l=i.name)?l=l.call(t,{hash:{},data:a}):(l=t.name,l=typeof l===u?l.apply(t):l),c+=h(l)+'">\n	</div>\n</div>\n'
})}),define("hb!templates/desktop/helpers/PreferenceEdit.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return" advanced-pref hide"}function r(e,t){var n,a,s,r="";return r+='\n		<label class="checkbox" for="input_',(n=i.id)?n=n.call(e,{hash:{},data:t}):(n=e.id,n=typeof n===x?n.apply(e):n),r+=w(n),(n=i.idSuffix)?n=n.call(e,{hash:{},data:t}):(n=e.idSuffix,n=typeof n===x?n.apply(e):n),r+=w(n)+'">\n			<input id="input_',(n=i.id)?n=n.call(e,{hash:{},data:t}):(n=e.id,n=typeof n===x?n.apply(e):n),r+=w(n),(n=i.idSuffix)?n=n.call(e,{hash:{},data:t}):(n=e.idSuffix,n=typeof n===x?n.apply(e):n),r+=w(n)+'" type="checkbox" value="1" class="input-dark" name="',(n=i.id)?n=n.call(e,{hash:{},data:t}):(n=e.id,n=typeof n===x?n.apply(e):n),r+=w(n)+'"',n=i["if"].call(e,e.value,{hash:{},inverse:k.noop,fn:k.program(4,l,t),data:t}),(n||0===n)&&(r+=n),r+="> &nbsp;",s={hash:{},data:t},r+=w((n=i.t||e.t,n?n.call(e,e.label,s):b.call(e,"t",e.label,s)))+"\n		</label>\n\n		",a=i["if"].call(e,e.summary,{hash:{},inverse:k.noop,fn:k.program(6,o,t),data:t}),(a||0===a)&&(r+=a),r+="\n	"
}function l(){return' checked="checked"'}function o(e,t){var n,a,s="";return s+='\n			<p class="help-block">',a={hash:{},data:t},s+=w((n=i.t||e.t,n?n.call(e,e.summary,a):b.call(e,"t",e.summary,a)))+"</p>\n		"}function c(e,t){var n,a,s,r="";return r+='\n		<label class="control-label" for="input_',(n=i.id)?n=n.call(e,{hash:{},data:t}):(n=e.id,n=typeof n===x?n.apply(e):n),r+=w(n),(n=i.idSuffix)?n=n.call(e,{hash:{},data:t}):(n=e.idSuffix,n=typeof n===x?n.apply(e):n),r+=w(n)+'">',s={hash:{},data:t},r+=w((n=i.t||e.t,n?n.call(e,e.label,s):b.call(e,"t",e.label,s)))+'</label>\n\n		<div class="controls">\n			',a=i["if"].call(e,e.enumValues,{hash:{},inverse:k.program(13,p,t),fn:k.program(9,d,t),data:t}),(a||0===a)&&(r+=a),r+="\n\n			",a=i["if"].call(e,e.summary,{hash:{},inverse:k.noop,fn:k.program(15,f,t),data:t}),(a||0===a)&&(r+=a),r+="\n		</div>\n	"
}function d(e,t){var n,a="";return a+='\n				<select id="input_',(n=i.id)?n=n.call(e,{hash:{},data:t}):(n=e.id,n=typeof n===x?n.apply(e):n),a+=w(n),(n=i.idSuffix)?n=n.call(e,{hash:{},data:t}):(n=e.idSuffix,n=typeof n===x?n.apply(e):n),a+=w(n)+'" class="input-dark span4" name="',(n=i.id)?n=n.call(e,{hash:{},data:t}):(n=e.id,n=typeof n===x?n.apply(e):n),a+=w(n)+'">\n					',n=i.each.call(e,e.enumValues,{hash:{},inverse:k.noop,fn:k.programWithDepth(10,h,t,e),data:t}),(n||0===n)&&(a+=n),a+="\n				</select>\n			"
}function h(e,t,n){var a,s,r,l="";return l+='\n						<option value="',(a=i.value)?a=a.call(e,{hash:{},data:t}):(a=e.value,a=typeof a===x?a.apply(e):a),l+=w(a)+'"',r={hash:{},inverse:k.noop,fn:k.program(11,u,t),data:t},a=i.if_eq||e.if_eq,s=a?a.call(e,e.value,n.value,r):b.call(e,"if_eq",e.value,n.value,r),(s||0===s)&&(l+=s),l+=">",r={hash:{},data:t},l+=w((a=i.t||e.t,a?a.call(e,e.label,r):b.call(e,"t",e.label,r)))+"</option>\n					"}function u(){return' selected="selected"'}function p(e,t){var n,a="";
return a+='\n				<input id="input_',(n=i.id)?n=n.call(e,{hash:{},data:t}):(n=e.id,n=typeof n===x?n.apply(e):n),a+=w(n),(n=i.idSuffix)?n=n.call(e,{hash:{},data:t}):(n=e.idSuffix,n=typeof n===x?n.apply(e):n),a+=w(n)+'" type="text" class="input-dark span4" name="',(n=i.id)?n=n.call(e,{hash:{},data:t}):(n=e.id,n=typeof n===x?n.apply(e):n),a+=w(n)+'" value="',(n=i.value)?n=n.call(e,{hash:{},data:t}):(n=e.value,n=typeof n===x?n.apply(e):n),a+=w(n)+'">\n			'}function f(e,t){var n,a,s="";return s+='\n				<p class="help-block">',a={hash:{},data:t},s+=w((n=i.t||e.t,n?n.call(e,e.summary,a):b.call(e,"t",e.summary,a)))+"</p>\n			"
}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var m,g,v,y="",b=i.helperMissing,w=this.escapeExpression,x="function",k=this;return y+='<div class="control-group',m=i["if"].call(t,t.advanced,{hash:{},inverse:k.noop,fn:k.program(1,s,a),data:a}),(m||0===m)&&(y+=m),y+='">\n	',v={hash:{},inverse:k.program(8,c,a),fn:k.program(3,r,a),data:a},m=i.if_eq||t.if_eq,g=m?m.call(t,t.type,"bool",v):b.call(t,"if_eq",t.type,"bool",v),(g||0===g)&&(y+=g),y+="\n</div>\n"})}),define("hb!templates/desktop/helpers/SectionPathInput.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};
var s,r="",l="function",o=this.escapeExpression;return r+='<div class="path-container">\n	<input type="text" name="path" class="span12" value="',(s=i.value)?s=s.call(t,{hash:{},data:a}):(s=t.value,s=typeof s===l?s.apply(t):s),r+=o(s)+'">\n	<div class="path-actions">\n		<a href="#" class="remove-path-btn btn btn-danger btn-icon" data-focus="keyboard"><i class="glyphicon circle-remove"></i></a>\n	</div>\n</div>\n'})}),define("hb!templates/desktop/helpers/BreadcrumbMediaItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a,s,c="";
return c+='\n	<li class="divider"></li>\n\n	<li id="channel-breadcrumb" class="breadcrumb-item">\n		<a class="breadcrumb-placeholder breadcrumb-btn" href="#">\n			<i class="glyphicon more"></i>\n		</a>\n\n		<div class="breadcrumb-content">\n			<a class="breadcrumb-btn" href="#!/servers/'+P((n=e.server,n=null==n||n===!1?n:n.machineIdentifier,typeof n===D?n.apply(e):n))+"/channels?",a=i["if"].call(e,(n=e.channel,null==n||n===!1?n:n.key),{hash:{},inverse:L.program(4,l,t),fn:L.program(2,r,t),data:t}),(a||0===a)&&(c+=a),c+='" data-focus="keyboard">\n				',s={hash:{},data:t},c+=P((n=i.truncate||e.truncate,n?n.call(e,(n=e.channel,null==n||n===!1?n:n.title),20,s):M.call(e,"truncate",(n=e.channel,null==n||n===!1?n:n.title),20,s)))+" ",a=i["if"].call(e,e.source,{hash:{},inverse:L.noop,fn:L.program(6,o,t),data:t}),(a||0===a)&&(c+=a),c+="\n			</a>\n		</div>\n	</li>\n"
}function r(e,t){var n,a,s="";return s+="key=",a={hash:{},data:t},s+=P((n=i.encodeUrl||e.encodeUrl,n?n.call(e,(n=e.channel,null==n||n===!1?n:n.key),a):M.call(e,"encodeUrl",(n=e.channel,null==n||n===!1?n:n.key),a)))}function l(e){var t,i="";return i+="identifier="+P((t=e.channel,t=null==t||t===!1?t:t.identifier,typeof t===D?t.apply(e):t))}function o(e,t){var n,a,s="";return s+='<span class="source-title">(',a={hash:{},data:t},s+=P((n=i.truncate||e.truncate,n?n.call(e,e.source,10,a):M.call(e,"truncate",e.source,10,a)))+")</span>"
}function c(e,t){var n;return n=i["if"].call(e,e.channelMedia,{hash:{},inverse:L.program(18,g,t),fn:L.program(9,d,t),data:t}),n||0===n?n:""}function d(e,t){var n,a,s,r="";return r+='\n	<li class="divider"></li>\n\n	<li class="channel-media-breadcrumb breadcrumb-item">\n		<a class="breadcrumb-placeholder breadcrumb-btn" href="#">\n			<i class="glyphicon more"></i>\n		</a>\n\n		<div class="breadcrumb-content">\n			',s={hash:{},inverse:L.program(16,m,t),fn:L.program(10,h,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,(n=e.channelMedia,null==n||n===!1?n:n.type),"clip",s):M.call(e,"if_eq",(n=e.channelMedia,null==n||n===!1?n:n.type),"clip",s),(a||0===a)&&(r+=a),r+="\n				",s={hash:{},data:t},r+=P((n=i.truncate||e.truncate,n?n.call(e,(n=e.channelMedia,null==n||n===!1?n:n.title),20,s):M.call(e,"truncate",(n=e.channelMedia,null==n||n===!1?n:n.title),20,s)))+"\n			</a>\n		</div>\n	</li>\n"
}function h(e,t){var n,a,s,r="";return r+='\n				<a class="breadcrumb-btn" href="#!/servers/'+P((n=e.server,n=null==n||n===!1?n:n.machineIdentifier,typeof n===D?n.apply(e):n))+"/channels/details?",a=i["if"].call(e,e.channelKey,{hash:{},inverse:L.program(13,p,t),fn:L.program(11,u,t),data:t}),(a||0===a)&&(r+=a),r+="path=",s={hash:{},data:t},r+=P((n=i.encodeUrl||e.encodeUrl,n?n.call(e,(n=e.channelMedia,null==n||n===!1?n:n.key),s):M.call(e,"encodeUrl",(n=e.channelMedia,null==n||n===!1?n:n.key),s)))+'" data-focus="keyboard">\n			'
}function u(e,t){var n,a,s="";return s+="key=",a={hash:{},data:t},s+=P((n=i.encodeUrl||e.encodeUrl,n?n.call(e,e.channelKey,a):M.call(e,"encodeUrl",e.channelKey,a)))+"&"}function p(e,t){var n;return n=i["if"].call(e,e.channelID,{hash:{},inverse:L.noop,fn:L.program(14,f,t),data:t}),n||0===n?n:""}function f(e,t){var n,a="";return a+="identifier=",(n=i.channelID)?n=n.call(e,{hash:{},data:t}):(n=e.channelID,n=typeof n===D?n.apply(e):n),a+=P(n)+"&"}function m(e,t){var n,a,s,r="";return r+='\n				<a class="breadcrumb-btn" href="#!/servers/'+P((n=e.server,n=null==n||n===!1?n:n.machineIdentifier,typeof n===D?n.apply(e):n))+"/channels?",a=i["if"].call(e,e.channelKey,{hash:{},inverse:L.program(13,p,t),fn:L.program(11,u,t),data:t}),(a||0===a)&&(r+=a),r+="path=",s={hash:{},data:t},r+=P((n=i.encodeUrl||e.encodeUrl,n?n.call(e,(n=e.channelMedia,null==n||n===!1?n:n.key),s):M.call(e,"encodeUrl",(n=e.channelMedia,null==n||n===!1?n:n.key),s)))+'" data-focus="keyboard">\n			'
}function g(e,t){var n,a,s,r="";return r+="\n\n	",a=i["if"].call(e,(n=e.media,null==n||n===!1?n:n.grandparentRatingKey),{hash:{},inverse:L.noop,fn:L.program(19,v,t),data:t}),(a||0===a)&&(r+=a),r+="\n\n	",a=i["if"].call(e,(n=e.media,null==n||n===!1?n:n.parentRatingKey),{hash:{},inverse:L.noop,fn:L.program(21,y,t),data:t}),(a||0===a)&&(r+=a),r+='\n\n	<li class="divider"></li>\n\n	<li class="media-breadcrumb breadcrumb-item">\n		<a class="breadcrumb-placeholder breadcrumb-btn" href="#">\n			<i class="glyphicon more"></i>\n		</a>\n\n		<div class="breadcrumb-content">\n			<a class="breadcrumb-btn" href="#!/servers/'+P((n=e.server,n=null==n||n===!1?n:n.machineIdentifier,typeof n===D?n.apply(e):n))+"/sections/",s={hash:{},data:t},r+=P((n=i.encodeUrl||e.encodeUrl,n?n.call(e,(n=e.section,null==n||n===!1?n:n.key),s):M.call(e,"encodeUrl",(n=e.section,null==n||n===!1?n:n.key),s)))+"/details/",a=i["if"].call(e,(n=e.media,null==n||n===!1?n:n.originalRatingKey),{hash:{},inverse:L.program(28,k,t),fn:L.program(26,x,t),data:t}),(a||0===a)&&(r+=a),r+='" data-focus="keyboard">\n				',s={hash:{},inverse:L.program(32,C,t),fn:L.program(30,S,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,(n=e.media,null==n||n===!1?n:n.type),"season",s):M.call(e,"if_eq",(n=e.media,null==n||n===!1?n:n.type),"season",s),(a||0===a)&&(r+=a),r+="\n			</a>\n		</div>\n	</li>\n"
}function v(e,t){var n,a,s="";return s+='\n		<li class="divider"></li>\n\n		<li class="media-breadcrumb breadcrumb-item">\n			<a class="breadcrumb-placeholder breadcrumb-btn" href="#">\n				<i class="glyphicon more"></i>\n			</a>\n\n			<div class="breadcrumb-content">\n				<a class="breadcrumb-btn" href="#!/servers/'+P((n=e.server,n=null==n||n===!1?n:n.machineIdentifier,typeof n===D?n.apply(e):n))+"/sections/",a={hash:{},data:t},s+=P((n=i.encodeUrl||e.encodeUrl,n?n.call(e,(n=e.section,null==n||n===!1?n:n.key),a):M.call(e,"encodeUrl",(n=e.section,null==n||n===!1?n:n.key),a)))+"/details/"+P((n=e.media,n=null==n||n===!1?n:n.grandparentRatingKey,typeof n===D?n.apply(e):n))+'" data-focus="keyboard">\n					',a={hash:{},data:t},s+=P((n=i.truncate||e.truncate,n?n.call(e,(n=e.media,null==n||n===!1?n:n.grandparentTitle),20,a):M.call(e,"truncate",(n=e.media,null==n||n===!1?n:n.grandparentTitle),20,a)))+"\n				</a>\n			</div>\n		</li>\n	"
}function y(e,t){var n,a,s,r="";return r+='\n		<li class="divider"></li>\n\n		<li class="media-breadcrumb breadcrumb-item">\n			<a class="breadcrumb-placeholder breadcrumb-btn" href="#">\n				<i class="glyphicon more"></i>\n			</a>\n\n			<div class="breadcrumb-content">\n				<a class="breadcrumb-btn" href="#!/servers/'+P((n=e.server,n=null==n||n===!1?n:n.machineIdentifier,typeof n===D?n.apply(e):n))+"/sections/",s={hash:{},data:t},r+=P((n=i.encodeUrl||e.encodeUrl,n?n.call(e,(n=e.section,null==n||n===!1?n:n.key),s):M.call(e,"encodeUrl",(n=e.section,null==n||n===!1?n:n.key),s)))+"/details/"+P((n=e.media,n=null==n||n===!1?n:n.parentRatingKey,typeof n===D?n.apply(e):n))+'" data-focus="keyboard">\n					',a=i["if"].call(e,(n=e.media,null==n||n===!1?n:n.parentTitle),{hash:{},inverse:L.program(24,w,t),fn:L.program(22,b,t),data:t}),(a||0===a)&&(r+=a),r+="\n				</a>\n			</div>\n		</li>\n	"
}function b(e,t){var n,a,s="";return s+="\n						",a={hash:{},data:t},s+=P((n=i.truncate||e.truncate,n?n.call(e,(n=e.media,null==n||n===!1?n:n.parentTitle),20,a):M.call(e,"truncate",(n=e.media,null==n||n===!1?n:n.parentTitle),20,a)))+"\n					"}function w(e,t){var n,a,s="";return s+="\n						",a={hash:{},data:t},s+=P((n=i.t||e.t,n?n.call(e,"Season",a):M.call(e,"t","Season",a)))+" "+P((n=e.media,n=null==n||n===!1?n:n.parentIndex,typeof n===D?n.apply(e):n))+"\n					"}function x(e){var t;return P((t=e.media,t=null==t||t===!1?t:t.originalRatingKey,typeof t===D?t.apply(e):t))
}function k(e){var t;return P((t=e.media,t=null==t||t===!1?t:t.ratingKey,typeof t===D?t.apply(e):t))}function S(e,t){var n,a,s="";return s+="\n					",a={hash:{},data:t},s+=P((n=i.t||e.t,n?n.call(e,"Season",a):M.call(e,"t","Season",a)))+" "+P((n=e.media,n=null==n||n===!1?n:n.index,typeof n===D?n.apply(e):n))+"\n				"}function C(e,t){var n,a,s;return s={hash:{},inverse:L.program(35,A,t),fn:L.program(33,_,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,(n=e.media,null==n||n===!1?n:n.type),"episode",s):M.call(e,"if_eq",(n=e.media,null==n||n===!1?n:n.type),"episode",s),a||0===a?a:""
}function _(e,t){var n,a,s="";return s+="\n					",a={hash:{},data:t},s+=P((n=i.t||e.t,n?n.call(e,"Episode",a):M.call(e,"t","Episode",a)))+" "+P((n=e.media,n=null==n||n===!1?n:n.index,typeof n===D?n.apply(e):n))+"\n				"}function A(e,t){var n,a,s="";return s+="\n					",a={hash:{},data:t},s+=P((n=i.truncate||e.truncate,n?n.call(e,(n=e.media,null==n||n===!1?n:n.title),20,a):M.call(e,"truncate",(n=e.media,null==n||n===!1?n:n.title),20,a)))+"\n				"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};
var I,T="",M=i.helperMissing,P=this.escapeExpression,D="function",L=this;return I=i["if"].call(t,t.channel,{hash:{},inverse:L.program(8,c,a),fn:L.program(1,s,a),data:a}),(I||0===I)&&(T+=I),T+="\n"})}),define("hb!templates/desktop/helpers/EULA.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){return this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{},'<h3>End User License Agreement—Plex Media Server</h3>\n\n<p>BY ACCEPTING THE TERMS OF THIS END USER LICENSE AGREEMENT BY CLICKING THE “AGREE” BUTTON, YOU  ("YOU") ARE UNCONDITIONALLY CONSENTING TO BE BOUND BY AND ARE BECOMING A PARTY TO THIS END USER LICENSE AGREEMENT ("AGREEMENT"). YOUR USE OF PLEX MEDIA SERVER (THE “SOFTWARE”) ALSO SHALL CONSTITUTE ASSENT TO THE TERMS OF THIS AGREEMENT. IF YOU DO NOT UNCONDITIONALLY AGREE TO ALL OF THE TERMS OF THIS AGREEMENT, SELECT THE "DISAGREE" BUTTON AND YOU WILL NOT HAVE ANY RIGHT TO USE THE SOFTWARE. Acceptance by and the formation of this Agreement with Plex, Inc. ("Plex") is expressly conditioned upon Your assent to all of the terms and conditions of this Agreement, to the exclusion of all other terms; if these terms are considered an offer, acceptance is expressly limited to these terms.</p>\n\n<p>The Software includes certain executable modules that Plex has licensed from third party providers (“Third Party Components”) that may be subject to different end user license terms as specified in the license agreement(s) provided with such Third Party Components.</p>\n\n<p>1. License. Subject to your full compliance with all of the terms and conditions of this Agreement, Plex grants You a personal, nontransferable, nonsublicensable, nonexclusive license to use the software that accompanies this Agreement (the "Application"), the accompanying documentation, and any additional software that may be made available by Plex from time to time for use with the Application (collectively "Software") for Your personal use only, as supplied to You by Plex.  Except as may be expressly permitted in a separate written agreement executed by You and an authorized representative of Plex, this Agreement only allows You to: (i) run the Software as received at the time of delivery; (ii) install the Software on a single machine or only for the number of users or core(s) as may be specified in a separate order form and paid for by You or Your company, employer, or principal; and (iii) use the Software in accordance with the accompanying documentation solely for legal purposes, but not for nuclear or aviation purposes, for controlling any apparatus, for any hazardous activity, or for treating the human body.</p>\n\n<p>2. Restrictions.</p>\n\n<p>A.	You shall not, nor permit anyone else to, directly or indirectly: (i) copy, modify, or distribute the Software; (ii) reverse engineer, disassemble, decompile, or otherwise attempt to discover the source code or structure, sequence, and/or organization of all or any part of the Software (except that this restriction shall not apply to the limited extent restrictions on reverse engineering are prohibited by applicable local law); (iii) rent, lease, or use the Software for timesharing or service bureau purposes; (iv) develop any improvement, modification, or derivative works of the Software, or include any portion thereof in any other product, software, work, equipment, or item (except that You may customize and/or modify the Software only as set forth in the documentation or as authorized in any license agreement of Plex’s third party licensors and applicable to Third Party Components); or (v) allow the transfer, transmission, export, or re-export of the Software or any portion thereof or any technical data associated with any Software.  For additional information about restrictions, see Section 8.</p>\n\n<p>B.	You shall not incorporate the Software or any part thereof into any other product(s) or use the Software in any manner that would cause the Software to become subject to any “open source license” that would impose obligations on Plex’s use of the Software or impair any rights of Plex or third parties thereto.  You shall maintain and shall not remove nor obscure any proprietary notices on the Software, and shall reproduce such notices exactly on all permitted copies of the Software. As between the parties and except as otherwise provided in any license agreement for Third Party Components, Plex shall own all title, ownership rights, and intellectual property rights in and to the Software, and any copies or derivative works thereof.  You understand that Plex or its licensors may modify or discontinue offering the Software at any time. This Agreement does not give You any rights not expressly and unambiguously granted herein.</p>\n\n<p>C.	You shall not make any use of data adapters or similar technologies used by or with the Software that are designed to receive and use data from Plex, its third party data providers, and its and their affiliates and third parties other than to receive and use such data in accordance with Your then-effective agreements with Plex, such third party data providers, and its and their affiliates and third parties including without limitation any data passing through the Software or otherwise effectively made available by any Software through an API, a download, a database, or the like. Data is provided by Plex or other third party data providers and may be delayed or unavailable as specified by Plex or such third party data providers.  Plex does not verify any data and disclaims any obligation to do so.  Plex, its third party data providers, and each of their affiliates and business partners: (i) expressly disclaim the availability, accuracy, adequacy, or completeness of any data or third party data provider, and (ii) shall not be liable for any errors, omissions, or other defects in, unavailability of, delays or interruptions in such data or third party data provider.</p>\n\n<p>3. Intellectual Property; Content. As a condition to Your use of the Software, You represent and  warrant that You will not use the Software: (i) to infringe the intellectual property or proprietary rights, or rights of publicity or privacy, of any third party; (ii) to violate any applicable law, statute, ordinance, or regulation; (iii) to disseminate, transfer or store information or materials in any form or format ("Content") that are harmful, threatening, abusive, harassing, tortuous, defamatory, vulgar, obscene, libelous, or otherwise objectionable, or that otherwise violate any law or right of any third party; or (iv) to disseminate any software viruses or any other computer code, files, programs, or the like that may without limitation interrupt, destroy, or limit the functionality of any computer software or hardware or telecommunications equipment, violate the security of any computer network, or the like.  You, not Plex, remain solely responsible for all Content that You import, publish, or otherwise disseminate using, or in connection with, the Software.  You acknowledge that all Content that You access through use of the Software is accessed at Your own risk, and You will be solely responsible for any damage or liability to any party resulting from such access.</p>\n\n<p>4. Support.  This Agreement does not entitle You to any support, upgrades, patches, enhancements, or fixes (collectively, "Support") for the Software. Any such Support for the Software that may be made available by Plex, in its sole discretion, shall be offered solely subject to a separate written agreement.</p>\n\n<p>5. Warranty Disclaimer.</p>\n\n<p>A.	THE SOFTWARE IS PROVIDED "AS IS".  PLEX MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, AND PLEX EXPRESSLY DISCLAIMS ALL WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  FURTHER, PLEX DOES NOT WARRANT AGAINST ERRORS, OMISSIONS, RESULTS OF USE, OR THAT THE SOFTWARE IS BUG FREE OR ERROR FREE OR THAT ITS USE WILL BE UNINTERRUPTED.  THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS AGREEMENT.  ALL THE FOREGOING DISCLAIMERS ALSO APPLY IN FULL WITH RESPECT TO PLEX\'S LICENSORS, SUPPLIERS, DISTRIBUTORS, CONTRACTORS, AGENTS, AND THIRD PARTY CONTRIBUTORS.  SOME STATES DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO THE ABOVE LIMITATIONS MAY NOT APPLY TO YOU.</p>\n\n<p>B.	“Malware” means any known, discovered, envisioned, or invented, or any yet to be known, discovered, envisioned, or invented: (i) virus, Trojan horse, or any other harmful, harassing, or malicious software; or (ii) method, use, or means by which any software, firmware, equipment, device, communications medium, person, entity, or the like directly or indirectly engages in or is used for: (a) any unauthorized access; (b) any unauthorized communication; or (c) any cracks, hacks, exploits, or other activity, method, use, or means, that may cause harassment, harm, data loss, data theft, loss of communication, loss of privacy, or the like.  You acknowledge that the Internet, dedicated lines, other forms of communication, or other means that You use to connect to the Software may not be secure and may be vulnerable to attack by third parties, and that it is possible to receive  Malware by using the Internet, dedicated lines, other forms of communication, or other means.  In order to protect the Software, You shall regularly obtain, use, and update appropriate third party software or other means to protect Yourself from Malware and to detect and remove Malware that may be downloaded using the Internet, dedicated lines, other forms of communication, or other means.  Plex does not warrant that the Software will be free of Malware that is introduced by third parties, the Internet, dedicated lines, other forms of communication, or other means.</p>\n\n<p>C.	Plex and its licensors, suppliers, distributors, contractors, agents, and third party contributors do not warrant: (i) results of the use of any of the Software; (ii) that the Software is bug free or error free; (iii) or that use of the Software will be uninterrupted. You agree that Plex and its Affiliates are not responsible for any fault, inaccuracy, error, omission, delay or any other failure of Your equipment and/or services caused by Plex’s hardware, software, cabling, network services, or the like, or arising from Plex’s use of such equipment and/or services.</p>\n\n<p>6. Limitation of Remedies and Damages. UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, INCLUDING, BUT NOT LIMITED TO, TORT, CONTRACT, NEGLIGENCE, STRICT LIABILITY, OR OTHERWISE, SHALL PLEX BE LIABLE TO YOU OR ANY OTHER PERSON OR ENTITY: (I) FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK STOPPAGE, ACCURACY OF RESULTS, COMPUTER FAILURE OR MALFUNCTION, LOSS OF DATA, OR OTHER DAMAGES RESULTING FROM YOUR USE OF THE SOFTWARE; OR (II) FOR ANY MATTER BEYOND ITS REASONABLE CONTROL. PLEX\'S AGGREGATE LIABILITY FOR DAMAGES OF ANY KIND WHATSOEVER ARISING OUT OF THIS AGREEMENT SHALL BE LIMITED TO THE LESSER OF THE TOTAL FEES PAID BY YOU TO PLEX (IF ANY) FOR THE PORTION OF THE SOFTWARE THAT GAVE RISE TO SUCH DAMAGES OR $100 (U.S.), EXCEPT WHERE NOT PERMITTED BY APPLICABLE LAW, IN WHICH CASE PLEX\'S LIABILITY SHALL BE LIMITED TO THE MINIMUM AMOUNT PERMITTED BY SUCH APPLICABLE LAW.  ALL THE FOREGOING LIMITATIONS SHALL APPLY EVEN IF EITHER PARTY HAS BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES.  ALL THE FOREGOING LIMITATIONS ALSO APPLY WITH RESPECT TO PLEX\'S SUPPLIERS, LICENSORS, DISTRIBUTORS, CONTRACTORS, AGENTS, AND THIRD PARTY CONTRIBUTORS.  SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THE ABOVE LIMITATION AND EXCLUSION MAY NOT APPLY TO YOU.</p>\n\n<p>7. Indemnity. You agree that Plex and its licensors, distributors, contractors, agents, and third party contributors shall have no liability whatsoever for any use You make of the Software. You shall indemnify and hold harmless Plex and its licensors, suppliers, distributors, contractors, agents, and third party contributors from any claims, damages, liabilities, costs and fees (including reasonable attorney fees) arising from Your use of the Software as well as from Your failure to comply with any term of this Agreement, or any losses, damages, claims, costs, and/or attorneys’ fees of You arising from any use of or reliance upon any information received in connection with the Software that comprises or is based upon data provided by Plex or any third party.</p>\n\n<p>8. Additional Information About Restrictions.</p>\n\n<p>A.	You may reverse engineer the Software solely for the purpose of debugging modifications made by You to certain Third Party Files in source code format that are licensed under the GNU Lesser General Public License (LGPL) or under the GNU General Public License version 2 (GPL2) and only provided that You have made, prior to any such reverse engineering permitted under this sentence, unsuccessful prior reasonable good faith efforts to debug such modifications using techniques other than the reverse engineering of the Software.</p>\n\n<p>B.	Certain Third Party Files may be provided to You with the Software and licensed to You under additional terms set forth in license agreements of the third party authors of the Third Party Files and are available from Plex upon request.  Certain Third Party Files modified by Plex are provided solely for use by You except for GPL2 files.  You shall not distribute or convey the Software or distribute or convey any modified or unmodified Third Party Files to any other person or entity in any manner whatsoever, and You shall not cause the Software or any modified or unmodified Third Party Files to be made available for viewing, copying, or downloading or the like with the sole exception of GPL2 files. Plex hereby offers, for a period ending three (3) years from Your first acceptance of this Agreement, to transfer to You a copy of the complete corresponding machine-readable source code files for any LGPL or GPL2 Third Party Files that Plex supplies to You.  Only GPL2 Third Party Files may be subsequently transferred by You to a third party.</p>\n\n<p>9. Termination.  This Agreement shall continue until terminated as set forth in this section.  You may terminate this Agreement at any time. Your rights under this Agreement will terminate automatically without notice from Plex if You fail to comply with any term(s) of this Agreement, including any attempt to transfer a copy of the Software to another party except as provided in this Agreement.  Upon termination, the Agreement granted hereunder shall terminate and You shall immediately discontinue all use of the Software, but the terms of this Agreement will otherwise remain in effect.</p>\n\n<p>10. Export Law Assurances.  In connection with the Software, You agree to comply with all export laws and restrictions and regulations of the Department of Commerce, the United States Department of the Treasury Office of Foreign Assets Control ("OFAC"), or other United States or foreign agency or authority, and You agree not to export, or allow the export or re-export of, the Software in violation of any such restrictions, laws or regulations. By using the Software, You agree to the foregoing and represent and warrant that You are not located in, under the control of, or a national or resident of, any restricted country.</p>\n\n<p>11. Government Users. If the user, purchaser, or licensee of any Software is an agency, department, contractor, or other entity of any government, the use, duplication, reproduction, release, modification, disclosure, and transfer of such Software, including technical data, software, and manuals, is restricted by the terms of this Agreement.  All other use is prohibited.  No rights other than those expressly provided in this Agreement are conferred.  Software was developed fully at private expense.</p>\n\n<p>12. Miscellaneous.  No agency, partnership, joint venture, or employment is created as a result of this Agreement and You do not have any authority of any kind to bind Plex in any respect whatsoever. The failure of either party to exercise in any respect any right provided for herein shall not be deemed a waiver of any further rights hereunder.  If any provision of this Agreement is found to be unenforceable or invalid, that provision shall be limited or eliminated to the minimum extent necessary so that this Agreement shall otherwise remain in full force and effect and enforceable. This Agreement is not assignable, transferable, or sublicensable by You except with Plex\'s prior written consent. Plex may transfer, assign, or delegate this Agreement and its rights and obligations without consent.  This Agreement shall be governed by and construed in accordance with the laws of the state of California, as if made within California between two residents thereof, and the parties submit to the exclusive jurisdiction of the Superior Court of Santa Clara County and the United States District Court for the Northern District of California.  Notwithstanding the foregoing sentence, but without limiting Plex\'s right to seek injunctive or other equitable relief in any court of competent jurisdiction, any disputes arising with respect to this Agreement shall be referred to an arbitrator affiliated with the Judicial Arbitration and Mediation Services, Inc. ("JAMS").  The arbitrator shall be selected by joint agreement of the parties.  In the event the parties cannot agree on an arbitrator within thirty (30) days of the initiating party providing the other party with written notice that it plans to seek arbitration, the parties shall each select an arbitrator affiliated with JAMS, which arbitrators shall jointly select a third such arbitrator to resolve the dispute.  The written decision of the arbitrator shall be final and binding on the parties.  The arbitration proceeding shall be carried on and heard in Santa Clara County, California using the English language and pursuant to the rules of (and administered by) JAMS.  In any action or proceeding to enforce rights under this Agreement, the prevailing party will be entitled to recover costs and reasonable attorneys\' fees from the other party.  A separate written license agreement or order and signed by Plex and You or Your company, employer, or principal may state other terms and conditions that apply to You, including terms relating to price, payment, delivery, confidential information, support services, and the like.  You are solely responsible to review such terms or conditions with Your company, employer or principal.  In the event of any conflict in terms, the terms of the separate license agreement shall supersede the terms of this Agreement.  Except as stated in the preceding three sentences, both parties agree that this Agreement is the complete and exclusive statement of the mutual understanding of the parties and supersedes and cancels all previous written and oral agreements, communications, and other understandings relating to the subject matter of this Agreement.  Any modifications to this Agreement must be in a writing signed by authorized representatives of both parties and specifically referencing this paragraph of this Agreement.</p>\n'
})}),define("plex/base/control/init/HandlebarsInit",["plex/base/control/utils/StringUtil","plex/base/control/utils/NumberUtil","plex/base/control/utils/MediaUtil","plex/base/control/utils/LocalizationUtil","hb!templates/desktop/helpers/LockableTextInput.tpl","hb!templates/desktop/helpers/LockableTagInput.tpl","hb!templates/desktop/helpers/PreferenceEdit.tpl","hb!templates/desktop/helpers/SectionPathInput.tpl","hb!templates/desktop/helpers/BreadcrumbMediaItem.tpl","hb!templates/desktop/helpers/EULA.tpl","handlebars","underscore","moment"],function(e,t,i,n,a,s,r,l,o,c){Handlebars.registerHelper("eq",function(e,t,i,n){return e===t?new Handlebars.SafeString(i):new Handlebars.SafeString(n)
}),Handlebars.registerHelper("if_eq",function(e,t,i){return e==t?i.fn(this):i.inverse(this)}),Handlebars.registerHelper("if_neq",function(e,t,i){return e!=t?i.fn(this):i.inverse(this)}),Handlebars.registerHelper("timeAgo",function(e){return moment.unix(e).fromNow()}),Handlebars.registerHelper("humanizeDuration",function(e){if(6e4>e){var t=Math.round(moment.duration(Number(e)).asMinutes());return 1===t?t+" "+n.t("second"):t+" "+n.t("seconds")}var i=Math.round(moment.duration(Number(e)).asMinutes());
return 1===i?i+" "+n.t("minute"):i+" "+n.t("minutes")}),Handlebars.registerHelper("formatDate",function(e){return e?moment(e).format("MMM D, YYYY"):"Unknown"}),Handlebars.registerHelper("formatDateCustom",function(e,t){return e?moment(e).format(t):"Unknown"}),Handlebars.registerHelper("formatTimestamp",function(e){return e?moment.unix(e).format("MMMM D, YYYY"):"Unknown"}),Handlebars.registerHelper("formatMinutes",function(e){var i=t.millisecondsToHm(e),a=i.hours,s=i.minutes;return a&&s?a+" "+n.t("hr")+" "+s+" "+n.t("min"):a?a+" "+n.t("hr"):s+" "+n.t("min")
}),Handlebars.registerHelper("formatDuration",function(e){var t=moment.duration(Number(e)),i=t.seconds(),n=t.minutes(),a=t.hours(),s="";return s=10>i?":0"+i:":"+i,s=10>n&&a>0?"0"+n+s:n+s,a>0&&(s=a+":"+s),s}),Handlebars.registerHelper("formatBytes",function(e){return t.formatBytes(e,2)}),Handlebars.registerHelper("formatBitrate",function(e,i){return t.formatBitrate(e,i)}),Handlebars.registerHelper("t",function(){var e=[].splice.call(arguments,0,arguments.length-1);return new Handlebars.SafeString(n.t.apply(n,e))
}),Handlebars.registerHelper("truncate",function(t,i){return e.truncate(t,i)}),Handlebars.registerHelper("truncateMiddle",function(t,i,n){return e.truncateMiddle(t,i,n)}),Handlebars.registerHelper("tags",function(e){var t="";return _.each(e,function(e){t+=e.tag+","}),t=t.slice(0,-1)}),Handlebars.registerHelper("upperCase",function(e){return e.toUpperCase()}),Handlebars.registerHelper("titleCase",function(t){return e.titleCase(t)}),Handlebars.registerHelper("encodeUrl",function(e){return encodeURIComponent(e)
}),Handlebars.registerHelper("dashboardMediaCardDetails",function(e,t){var i="";return e.sourceTitle?(e.addedAt&&(i+=moment.unix(e.addedAt).fromNow()+" &middot; "),i+=e.sourceTitle,e.recommender&&(i+=" &middot; "+e.recommender),i):"season"===e.type?1e3>e.index?n.t("Season")+" "+e.index:e.index:t||"episode"!==e.type?e.parentTitle?e.title:!t&&e.year?e.year:void 0:e.index>0&&1e3>e.parentIndex?(i+=n.t("Season")+" "+e.parentIndex,i+=", "+n.t("Episode")+" "+e.index):e.originallyAvailableAt?moment(e.originallyAvailableAt).format("M/D/YY"):e.parentIndex
}),Handlebars.registerHelper("seasonEpisodeIndex",function(e,t,n){return i.getSeasonEpisodeIndex(e,t,n)}),Handlebars.registerHelper("seasonIndex",function(e){return i.getSeasonIndex(e)}),Handlebars.registerHelper("episodeIndex",function(e,t){return i.getEpisodeIndex(e,t)}),Handlebars.registerHelper("formatResolution",function(e){if(!e)return"";var t=parseInt(e,10);return _.isNaN(t)?e.toUpperCase():e+"p"}),Handlebars.registerHelper("formatAudioCodec",function(e){return e?"dca"===e?"DTS":e.toUpperCase():""
}),Handlebars.registerHelper("formatAudioChannels",function(e){return e?(e=parseInt(e,10),2>e?n.t("Mono"):3>e?n.t("Stereo"):""+(e-1)+".1"):""}),Handlebars.registerHelper("formatVideoLevel",function(e){return e=parseInt(e,10),(e/10).toFixed(1)}),Handlebars.registerHelper("formatBoolean",function(e){return e&&0!==parseInt(e,10)?"Yes":"No"}),Handlebars.registerHelper("formatLabel",function(e){for(var t="",i=0,n=e.length;n>i;i++){var a=e.charAt(i),s=a.toUpperCase();t+=0===i?s:a===s?" "+s:a}return t}),Handlebars.registerHelper("lockableTextInput",function(e){return e.hash.type=e.hash.type||"text",new Handlebars.SafeString(a(e.hash))
}),Handlebars.registerHelper("lockableTagInput",function(e){return new Handlebars.SafeString(s(e.hash))}),Handlebars.registerHelper("eachKeyValue",function(e,t){var i=t.fn,n=t.inverse,a="";if(e&&!_.isEmpty(e)){var s=_.map(e,function(e,t){return i({key:t,value:e})});a=s.join("")}else a=n(this);return a}),Handlebars.registerHelper("partial",function(e,t){var i=Handlebars.partials[e],n=t.hash.context?_.extend({},t.hash.context,t.hash):_.extend({},this,t.hash);return new Handlebars.SafeString(i(n))}),Handlebars.registerPartial("preference",r),Handlebars.registerPartial("sectionPathInput",l),Handlebars.registerPartial("breadcrumbMediaItem",o),Handlebars.registerPartial("EULA",c)
}),define("plex/base/model/ConfigModel",["backbone"],function(){var e=Backbone.Model.extend({defaults:_.extend({standalone:!1,websocket:!0,flash:!0,autofocus:!1,animations:!0},window.PLEXWEB)});return new e});var SM2_DEFER=!0;define("soundmanagerdefer",function(){}),function(e){function t(t,i){function n(e){return function(t){var i=this._t;return i&&i._a?e.call(this,t):null}}this.flashVersion=8,this.debugMode=!1,this.debugFlash=!1,this.useConsole=!0,this.consoleOnly=!0,this.waitForWindowLoad=!1,this.bgColor="#ffffff",this.useHighPerformance=!1,this.flashPollingInterval=null,this.html5PollingInterval=null,this.flashLoadTimeout=1e3,this.wmode=null,this.allowScriptAccess="always",this.useFlashBlock=!1,this.useHTML5Audio=!0,this.html5Test=/^(probably|maybe)$/i,this.preferFlash=!0,this.noSWFCache=!1,this.audioFormats={mp3:{type:['audio/mpeg; codecs="mp3"',"audio/mpeg","audio/mp3","audio/MPA","audio/mpa-robust"],required:!0},mp4:{related:["aac","m4a"],type:['audio/mp4; codecs="mp4a.40.2"',"audio/aac","audio/x-m4a","audio/MP4A-LATM","audio/mpeg4-generic"],required:!1},ogg:{type:["audio/ogg; codecs=vorbis"],required:!1},wav:{type:['audio/wav; codecs="1"',"audio/wav","audio/wave","audio/x-wav"],required:!1}},this.defaultOptions={autoLoad:!1,autoPlay:!1,from:null,loops:1,onid3:null,onload:null,whileloading:null,onplay:null,onpause:null,onresume:null,whileplaying:null,onposition:null,onstop:null,onfailure:null,onfinish:null,multiShot:!0,multiShotEvents:!1,position:null,pan:0,stream:!0,to:null,type:null,usePolicyFile:!1,volume:100},this.flash9Options={isMovieStar:null,usePeakData:!1,useWaveformData:!1,useEQData:!1,onbufferchange:null,ondataerror:null},this.movieStarOptions={bufferTime:3,serverURL:null,onconnect:null,duration:null},this.movieID="sm2-container",this.id=i||"sm2movie",this.debugID="soundmanager-debug",this.debugURLParam=/([#?&])debug=1/i,this.versionNumber="V2.97a.20120318",this.version=null,this.movieURL=null,this.url=t||null,this.altURL=null,this.swfLoaded=!1,this.enabled=!1,this.oMC=null,this.sounds={},this.soundIDs=[],this.muted=!1,this.didFlashBlock=!1,this.filePattern=null,this.filePatterns={flash8:/\.mp3(\?.*)?$/i,flash9:/\.mp3(\?.*)?$/i},this.features={buffering:!1,peakData:!1,waveformData:!1,eqData:!1,movieStar:!1},this.sandbox={},this.hasHTML5=function(){try{return"undefined"!=typeof Audio&&(new Audio).canPlayType!==void 0
}catch(e){return!1}}(),this.html5={usingFlash:null},this.flash={},this.html5Only=!1,this.ignoreFlash=!1;var a,s,r,l,o,c,d,h,u,p,f,m,g,v,y,b,w,x,k,S,C,_,A,I,T,M,P,D,L,E,N,O,R,B,$,q,V,j,F,U,H,z,W,Y,J,K,G,Q,X,Z,et,tt,it=this,nt=null,at="soundManager",st=navigator.userAgent,rt=e,lt=""+rt.location.href,ot=document,ct=[],dt=!1,ht=!1,ut=!1,pt=!1,ft=!1,mt=8,gt=null,vt=null,yt=!1,bt=!1,wt=0,xt=null,kt=null,St=Array.prototype.slice,Ct=!1,_t=st.match(/(ipad|iphone|ipod)/i),At=st.match(/firefox/i),It=st.match(/droid/i),Tt=st.match(/msie/i),Mt=st.match(/webkit/i),Pt=st.match(/safari/i)&&!st.match(/chrome/i),Dt=st.match(/opera/i),Lt=st.match(/(mobile|pre\/|xoom)/i)||_t,Et=!lt.match(/usehtml5audio/i)&&!lt.match(/sm2\-ignorebadua/i)&&Pt&&!st.match(/silk/i)&&st.match(/OS X 10_6_([3-7])/i),Nt=("undefined"!=typeof console&&console.log!==void 0,ot.hasFocus!==void 0?ot.hasFocus():null),Ot=Pt&&ot.hasFocus===void 0,Rt=!Ot,Bt=/(mp3|mp4|mpa)/i,$t="about:blank",qt=ot.location?ot.location.protocol.match(/http/i):null,Vt=qt?"":"http://",jt=/^\s*audio\/(?:x-)?(?:mpeg4|aac|flv|mov|mp4||m4v|m4a|mp4v|3gp|3g2)\s*(?:$|;)/i,Ft=["mpeg4","aac","flv","mov","mp4","m4v","f4v","m4a","mp4v","3gp","3g2"],Ut=RegExp("\\.("+Ft.join("|")+")(\\?.*)?$","i");
this.mimePattern=/^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i,this.useAltURL=!qt,this._global_a=null,N={swfBox:"sm2-object-box",swfDefault:"movieContainer",swfError:"swf_error",swfTimedout:"swf_timedout",swfLoaded:"swf_loaded",swfUnblocked:"swf_unblocked",sm2Debug:"sm2_debug",highPerf:"high_performance",flashDebug:"flash_debug"},Lt&&(it.useHTML5Audio=!0,it.preferFlash=!1,_t&&(it.ignoreFlash=!0,Ct=!0)),this.ok=function(){return kt?ut&&!pt:it.useHTML5Audio&&it.hasHTML5},this.supported=this.ok,this.getMovie=function(e){return s(e)||ot[e]||rt[e]
},this.createSound=function(e){function t(){return s=O(s),it.sounds[l.id]=new a(l),it.soundIDs.push(l.id),it.sounds[l.id]}var i,n,s=null,r=null,l=null;return ut&&it.ok()?(2===arguments.length&&(e={id:arguments[0],url:arguments[1]}),s=d(e),s.url=F(s.url),l=s,$(l.id,!0)?it.sounds[l.id]:(H(l)?(r=t(),r._setup_html5(l)):(o>8&&(null===l.isMovieStar&&(l.isMovieStar=l.serverURL||(l.type?l.type.match(jt):!1)||l.url.match(Ut)),l.isMovieStar&&l.usePeakData&&(l.usePeakData=!1)),l=R(l,i),r=t(),8===o?nt._createSound(l.id,l.loops||1,l.usePolicyFile):(nt._createSound(l.id,l.url,l.usePeakData,l.useWaveformData,l.useEQData,l.isMovieStar,l.isMovieStar?l.bufferTime:!1,l.loops||1,l.serverURL,l.duration||null,l.autoPlay,!0,l.autoLoad,l.usePolicyFile),l.serverURL||(r.connected=!0,l.onconnect&&l.onconnect.apply(r))),l.serverURL||!l.autoLoad&&!l.autoPlay||r.load(l)),!l.serverURL&&l.autoPlay&&r.play(),r)):(B(n),!1)
},this.destroySound=function(e,t){if(!$(e))return!1;var i,n=it.sounds[e];for(n._iO={},n.stop(),n.unload(),i=0;it.soundIDs.length>i;i++)if(it.soundIDs[i]===e){it.soundIDs.splice(i,1);break}return t||n.destruct(!0),n=null,delete it.sounds[e],!0},this.load=function(e,t){return $(e)?it.sounds[e].load(t):!1},this.unload=function(e){return $(e)?it.sounds[e].unload():!1},this.onPosition=function(e,t,i,n){return $(e)?it.sounds[e].onposition(t,i,n):!1},this.onposition=this.onPosition,this.clearOnPosition=function(e,t,i){return $(e)?it.sounds[e].clearOnPosition(t,i):!1
},this.play=function(e,t){return ut&&it.ok()?$(e)?it.sounds[e].play(t):(t instanceof Object||(t={url:t}),t&&t.url?(t.id=e,it.createSound(t).play()):!1):(B(at+".play(): "+D(ut?"notOK":"notReady")),!1)},this.start=this.play,this.setPosition=function(e,t){return $(e)?it.sounds[e].setPosition(t):!1},this.stop=function(e){return $(e)?it.sounds[e].stop():!1},this.stopAll=function(){var e;for(e in it.sounds)it.sounds.hasOwnProperty(e)&&it.sounds[e].stop()},this.pause=function(e){return $(e)?it.sounds[e].pause():!1
},this.pauseAll=function(){var e;for(e=it.soundIDs.length-1;e>=0;e--)it.sounds[it.soundIDs[e]].pause()},this.resume=function(e){return $(e)?it.sounds[e].resume():!1},this.resumeAll=function(){var e;for(e=it.soundIDs.length-1;e>=0;e--)it.sounds[it.soundIDs[e]].resume()},this.togglePause=function(e){return $(e)?it.sounds[e].togglePause():!1},this.setPan=function(e,t){return $(e)?it.sounds[e].setPan(t):!1},this.setVolume=function(e,t){return $(e)?it.sounds[e].setVolume(t):!1},this.mute=function(e){var t=0;
if("string"!=typeof e&&(e=null),e)return $(e)?it.sounds[e].mute():!1;for(t=it.soundIDs.length-1;t>=0;t--)it.sounds[it.soundIDs[t]].mute();return it.muted=!0,!0},this.muteAll=function(){it.mute()},this.unmute=function(e){var t;if("string"!=typeof e&&(e=null),e)return $(e)?it.sounds[e].unmute():!1;for(t=it.soundIDs.length-1;t>=0;t--)it.sounds[it.soundIDs[t]].unmute();return it.muted=!1,!0},this.unmuteAll=function(){it.unmute()},this.toggleMute=function(e){return $(e)?it.sounds[e].toggleMute():!1},this.getMemoryUse=function(){var e=0;
return nt&&8!==o&&(e=parseInt(nt._getMemoryUse(),10)),e},this.disable=function(e){var t;if(e===void 0&&(e=!1),pt)return!1;for(pt=!0,t=it.soundIDs.length-1;t>=0;t--)T(it.sounds[it.soundIDs[t]]);return c(e),G.remove(rt,"load",p),!0},this.canPlayMIME=function(e){var t;return it.hasHTML5&&(t=z({type:e})),!kt||t?t:e&&it.ok()?!!((o>8?e.match(jt):null)||e.match(it.mimePattern)):null},this.canPlayURL=function(e){var t;return it.hasHTML5&&(t=z({url:e})),!kt||t?t:e&&it.ok()?!!e.match(it.filePattern):null},this.canPlayLink=function(e){return e.type!==void 0&&e.type&&it.canPlayMIME(e.type)?!0:it.canPlayURL(e.href)
},this.getSoundById=function(e){if(!e)throw Error(at+".getSoundById(): sID is null/undefined");var t=it.sounds[e];return t},this.onready=function(e,t){var i="onready";if(e&&e instanceof Function)return t||(t=rt),h(i,e,t),u(),!0;throw D("needFunction",i)},this.ontimeout=function(e,t){var i="ontimeout";if(e&&e instanceof Function)return t||(t=rt),h(i,e,t),u({type:i}),!0;throw D("needFunction",i)},this._writeDebug=function(){return!0},this._wD=this._writeDebug,this._debug=function(){},this.reboot=function(){var e,t;
for(e=it.soundIDs.length-1;e>=0;e--)it.sounds[it.soundIDs[e]].destruct();try{Tt&&(vt=nt.innerHTML),gt=nt.parentNode.removeChild(nt)}catch(i){}vt=gt=kt=null,it.enabled=k=ut=yt=bt=dt=ht=pt=it.swfLoaded=!1,it.soundIDs=[],it.sounds={},nt=null;for(e in ct)if(ct.hasOwnProperty(e))for(t=ct[e].length-1;t>=0;t--)ct[e][t].fired=!1;rt.setTimeout(it.beginDelayedInit,20)},this.getMoviePercent=function(){return nt&&nt.PercentLoaded!==void 0?nt.PercentLoaded():null},this.beginDelayedInit=function(){ft=!0,w(),setTimeout(function(){return bt?!1:(C(),b(),bt=!0,!0)
},20),f()},this.destruct=function(){it.disable(!0)},a=function(e){var t,i,n,a,s,r,l,c,h,u=this,p=!1,f=[],m=0,g=null;h={duration:null,time:null},this.sID=e.id,this.url=e.url,this.options=d(e),this.instanceOptions=this.options,this._iO=this.instanceOptions,this.pan=this.options.pan,this.volume=this.options.volume,this.isHTML5=!1,this._a=null,this.id3={},this._debug=function(){},this.load=function(e){var t,i=null;if(e!==void 0?(u._iO=d(e,u.options),u.instanceOptions=u._iO):(e=u.options,u._iO=e,u.instanceOptions=u._iO,g&&g!==u.url&&(u._iO.url=u.url,u.url=null)),u._iO.url||(u._iO.url=u.url),u._iO.url=F(u._iO.url),u._iO.url===u.url&&0!==u.readyState&&2!==u.readyState)return 3===u.readyState&&u._iO.onload&&u._iO.onload.apply(u,[!!u.duration]),u;
if(t=u._iO,g=u.url,u.loaded=!1,u.readyState=1,u.playState=0,H(t))i=u._setup_html5(t),i._called_load||(u._html5_canplay=!1,u._a.autobuffer="auto",u._a.preload="auto",i.load(),i._called_load=!0,t.autoPlay&&u.play());else try{u.isHTML5=!1,u._iO=R(O(t)),t=u._iO,8===o?nt._load(u.sID,t.url,t.stream,t.autoPlay,t.whileloading?1:0,t.loops||1,t.usePolicyFile):nt._load(u.sID,t.url,!!t.stream,!!t.autoPlay,t.loops||1,!!t.autoLoad,t.usePolicyFile)}catch(n){_({type:"SMSOUND_LOAD_JS_EXCEPTION",fatal:!0})}return u
},this.unload=function(){return 0!==u.readyState&&(u.isHTML5?(a(),u._a&&(u._a.pause(),Y(u._a))):8===o?nt._unload(u.sID,$t):nt._unload(u.sID),t()),u},this.destruct=function(e){u.isHTML5?(a(),u._a&&(u._a.pause(),Y(u._a),Ct||n(),u._a._t=null,u._a=null)):(u._iO.onfailure=null,nt._destroySound(u.sID)),e||it.destroySound(u.sID,!0)},this.play=function(e,t){var i,n,a;if(t=void 0===t?!0:t,e||(e={}),u._iO=d(e,u._iO),u._iO=d(u._iO,u.options),u._iO.url=F(u._iO.url),u.instanceOptions=u._iO,u._iO.serverURL&&!u.connected)return u.getAutoPlay()||u.setAutoPlay(!0),u;
if(H(u._iO)&&(u._setup_html5(u._iO),s()),1===u.playState&&!u.paused&&(i=u._iO.multiShot,!i))return u;if(!u.loaded)if(0===u.readyState)u.isHTML5||(u._iO.autoPlay=!0),u.load(u._iO);else if(2===u.readyState)return u;if(!u.isHTML5&&9===o&&u.position>0&&u.position===u.duration&&(e.position=0),u.paused&&u.position&&u.position>0)u.resume();else{if(u._iO=d(e,u._iO),null!==u._iO.from&&null!==u._iO.to&&0===u.instanceCount&&0===u.playState&&!u._iO.serverURL){if(a=function(){u._iO=d(e,u._iO),u.play(u._iO)},u.isHTML5&&!u._html5_canplay)return u.load({_oncanplay:a}),!1;
if(!(u.isHTML5||u.loaded||u.readyState&&2===u.readyState))return u.load({onload:a}),!1;u._iO=c()}(!u.instanceCount||u._iO.multiShotEvents||!u.isHTML5&&o>8&&!u.getAutoPlay())&&u.instanceCount++,0===u.playState&&u._iO.onposition&&r(u),u.playState=1,u.paused=!1,u.position=void 0===u._iO.position||isNaN(u._iO.position)?0:u._iO.position,u.isHTML5||(u._iO=R(O(u._iO))),u._iO.onplay&&t&&(u._iO.onplay.apply(u),p=!0),u.setVolume(u._iO.volume,!0),u.setPan(u._iO.pan,!0),u.isHTML5?(s(),n=u._setup_html5(),u.setPosition(u._iO.position),n.play()):nt._start(u.sID,u._iO.loops||1,9===o?u._iO.position:u._iO.position/1e3)
}return u},this.start=this.play,this.stop=function(e){var t,i=u._iO;return 1===u.playState&&(u._onbufferchange(0),u._resetOnPosition(0),u.paused=!1,u.isHTML5||(u.playState=0),l(),i.to&&u.clearOnPosition(i.to),u.isHTML5?u._a&&(t=u.position,u.setPosition(0),u.position=t,u._a.pause(),u.playState=0,u._onTimer(),a()):(nt._stop(u.sID,e),i.serverURL&&u.unload()),u.instanceCount=0,u._iO={},i.onstop&&i.onstop.apply(u)),u},this.setAutoPlay=function(e){u._iO.autoPlay=e,u.isHTML5||(nt._setAutoPlay(u.sID,e),e&&(u.instanceCount||1!==u.readyState||u.instanceCount++))
},this.getAutoPlay=function(){return u._iO.autoPlay},this.setPosition=function(e){void 0===e&&(e=0);var t,i,n,a=u.isHTML5?Math.max(e,0):Math.min(u.duration||u._iO.duration,Math.max(e,0));if(t=u.position,u.position=a,n=u.position/1e3,u._resetOnPosition(u.position),u._iO.position=a,u.isHTML5){if(u._a&&u._html5_canplay&&u._a.currentTime!==n)try{u._a.currentTime=n,(0===u.playState||u.paused)&&u._a.pause()}catch(s){}}else i=9===o?u.position:n,u.readyState&&2!==u.readyState&&nt._setPosition(u.sID,i,u.paused||!u.playState);
return u.isHTML5&&u.paused&&u._onTimer(!0),u},this.pause=function(e){return u.paused||0===u.playState&&1!==u.readyState?u:(u.paused=!0,u.isHTML5?(u._setup_html5().pause(),a()):(e||void 0===e)&&nt._pause(u.sID),u._iO.onpause&&u._iO.onpause.apply(u),u)},this.resume=function(){var e=u._iO;return u.paused?(u.paused=!1,u.playState=1,u.isHTML5?(u._setup_html5().play(),s()):(e.isMovieStar&&!e.serverURL&&u.setPosition(u.position),nt._pause(u.sID)),!p&&e.onplay?(e.onplay.apply(u),p=!0):e.onresume&&e.onresume.apply(u),u):u
},this.togglePause=function(){return 0===u.playState?(u.play({position:9!==o||u.isHTML5?u.position/1e3:u.position}),u):(u.paused?u.resume():u.pause(),u)},this.setPan=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=!1),u.isHTML5||nt._setPan(u.sID,e),u._iO.pan=e,t||(u.pan=e,u.options.pan=e),u},this.setVolume=function(e,t){return e===void 0&&(e=100),t===void 0&&(t=!1),u.isHTML5?u._a&&(u._a.volume=Math.max(0,Math.min(1,e/100))):nt._setVolume(u.sID,it.muted&&!u.muted||u.muted?0:e),u._iO.volume=e,t||(u.volume=e,u.options.volume=e),u
},this.mute=function(){return u.muted=!0,u.isHTML5?u._a&&(u._a.muted=!0):nt._setVolume(u.sID,0),u},this.unmute=function(){u.muted=!1;var e=u._iO.volume!==void 0;return u.isHTML5?u._a&&(u._a.muted=!1):nt._setVolume(u.sID,e?u._iO.volume:u.options.volume),u},this.toggleMute=function(){return u.muted?u.unmute():u.mute()},this.onPosition=function(e,t,i){return f.push({position:parseInt(e,10),method:t,scope:i!==void 0?i:u,fired:!1}),u},this.onposition=this.onPosition,this.clearOnPosition=function(e,t){var i;
if(e=parseInt(e,10),isNaN(e))return!1;for(i=0;f.length>i;i++)e===f[i].position&&(t&&t!==f[i].method||(f[i].fired&&m--,f.splice(i,1)))},this._processOnPosition=function(){var e,t,i=f.length;if(!i||!u.playState||m>=i)return!1;for(e=i-1;e>=0;e--)t=f[e],!t.fired&&u.position>=t.position&&(t.fired=!0,m++,t.method.apply(t.scope,[t.position]));return!0},this._resetOnPosition=function(e){var t,i,n=f.length;if(!n)return!1;for(t=n-1;t>=0;t--)i=f[t],i.fired&&i.position>=e&&(i.fired=!1,m--);return!0},c=function(){var e,t,i=u._iO,n=i.from,a=i.to;
return t=function(){u.clearOnPosition(a,t),u.stop()},e=function(){null===a||isNaN(a)||u.onPosition(a,t)},null===n||isNaN(n)||(i.position=n,i.multiShot=!1,e()),i},r=function(){var e,t=u._iO.onposition;if(t)for(e in t)t.hasOwnProperty(e)&&u.onPosition(parseInt(e,10),t[e])},l=function(){var e,t=u._iO.onposition;if(t)for(e in t)t.hasOwnProperty(e)&&u.clearOnPosition(parseInt(e,10))},s=function(){u.isHTML5&&q(u)},a=function(){u.isHTML5&&V(u)},t=function(){f=[],m=0,p=!1,u._hasTimer=null,u._a=null,u._html5_canplay=!1,u.bytesLoaded=null,u.bytesTotal=null,u.duration=u._iO&&u._iO.duration?u._iO.duration:null,u.durationEstimate=null,u.eqData=[],u.eqData.left=[],u.eqData.right=[],u.failures=0,u.isBuffering=!1,u.instanceOptions={},u.instanceCount=0,u.loaded=!1,u.metadata={},u.readyState=0,u.muted=!1,u.paused=!1,u.peakData={left:0,right:0},u.waveformData={left:[],right:[]},u.playState=0,u.position=null
},t(),this._onTimer=function(e){var t,i,n=!1,a={};return u._hasTimer||e?u._a&&(e||(u.playState>0||1===u.readyState)&&!u.paused)?(t=u._get_html5_duration(),t!==h.duration&&(h.duration=t,u.duration=t,n=!0),u.durationEstimate=u.duration,i=1e3*u._a.currentTime||0,i!==h.time&&(h.time=i,n=!0),(n||e)&&u._whileplaying(i,a,a,a,a),n):!1:void 0},this._get_html5_duration=function(){var e=u._iO,t=u._a?1e3*u._a.duration:e?e.duration:void 0,i=t&&!isNaN(t)&&1/0!==t?t:e?e.duration:null;return i},this._setup_html5=function(e){var n=d(u._iO,e),a=decodeURI,s=Ct?it._global_a:u._a,r=a(n.url),l=s&&s._t?s._t.instanceOptions:null;
if(s){if(s._t){if(!Ct&&r===a(g))return s;if(Ct&&l.url===n.url&&(!g||g===l.url))return s}Ct&&s._t&&s._t.playState&&n.url!==l.url&&s._t.stop(),t(),s.src=n.url,u.url=n.url,g=n.url,s._called_load=!1}else s=new Audio(n.url),s._called_load=!1,It&&(s._called_load=!0),Ct&&(it._global_a=s);return u.isHTML5=!0,u._a=s,s._t=u,i(),s.loop=n.loops>1?"loop":"",n.autoLoad||n.autoPlay?u.load():(s.autobuffer=!1,s.preload="none"),s.loop=n.loops>1?"loop":"",s},i=function(){function e(e,t,i){return u._a?u._a.addEventListener(e,t,i||!1):null
}if(u._a._added_events)return!1;var t;u._a._added_events=!0;for(t in et)et.hasOwnProperty(t)&&e(t,et[t]);return!0},n=function(){function e(e,t,i){return u._a?u._a.removeEventListener(e,t,i||!1):null}var t;u._a._added_events=!1;for(t in et)et.hasOwnProperty(t)&&e(t,et[t])},this._onload=function(e){var t=!!e;return u.loaded=t,u.readyState=t?3:2,u._onbufferchange(0),u._iO.onload&&u._iO.onload.apply(u,[t]),!0},this._onbufferchange=function(e){return 0===u.playState?!1:e&&u.isBuffering||!e&&!u.isBuffering?!1:(u.isBuffering=1===e,u._iO.onbufferchange&&u._iO.onbufferchange.apply(u),!0)
},this._onsuspend=function(){return u._iO.onsuspend&&u._iO.onsuspend.apply(u),!0},this._onfailure=function(e,t,i){u.failures++,u._iO.onfailure&&1===u.failures&&u._iO.onfailure(u,e,t,i)},this._onfinish=function(){var e=u._iO.onfinish;u._onbufferchange(0),u._resetOnPosition(0),u.instanceCount&&(u.instanceCount--,u.instanceCount||(l(),u.playState=0,u.paused=!1,u.instanceCount=0,u.instanceOptions={},u._iO={},a()),(!u.instanceCount||u._iO.multiShotEvents)&&e&&e.apply(u))},this._whileloading=function(e,t,i,n){var a=u._iO;
u.bytesLoaded=e,u.bytesTotal=t,u.duration=Math.floor(i),u.bufferLength=n,a.isMovieStar?(u.durationEstimate=u.duration,3!==u.readyState&&a.whileloading&&a.whileloading.apply(u)):(u.durationEstimate=a.duration?u.duration>a.duration?u.duration:a.duration:parseInt(u.bytesTotal/u.bytesLoaded*u.duration,10),void 0===u.durationEstimate&&(u.durationEstimate=u.duration),3!==u.readyState&&a.whileloading&&a.whileloading.apply(u))},this._whileplaying=function(e,t,i,n,a){var s,r=u._iO;return isNaN(e)||null===e?!1:(u.position=e,u._processOnPosition(),!u.isHTML5&&o>8&&(r.usePeakData&&t!==void 0&&t&&(u.peakData={left:t.leftPeak,right:t.rightPeak}),r.useWaveformData&&i!==void 0&&i&&(u.waveformData={left:i.split(","),right:n.split(",")}),r.useEQData&&a!==void 0&&a&&a.leftEQ&&(s=a.leftEQ.split(","),u.eqData=s,u.eqData.left=s,a.rightEQ!==void 0&&a.rightEQ&&(u.eqData.right=a.rightEQ.split(",")))),1===u.playState&&(u.isHTML5||8!==o||u.position||!u.isBuffering||u._onbufferchange(0),r.whileplaying&&r.whileplaying.apply(u)),!0)
},this._onmetadata=function(e,t){var i,n,a={};for(i=0,n=e.length;n>i;i++)a[e[i]]=t[i];u.metadata=a,u._iO.onmetadata&&u._iO.onmetadata.apply(u)},this._onid3=function(e,t){var i,n,a=[];for(i=0,n=e.length;n>i;i++)a[e[i]]=t[i];u.id3=d(u.id3,a),u._iO.onid3&&u._iO.onid3.apply(u)},this._onconnect=function(e){e=1===e,u.connected=e,e&&(u.failures=0,$(u.sID)&&(u.getAutoPlay()?u.play(void 0,u.getAutoPlay()):u._iO.autoLoad&&u.load()),u._iO.onconnect&&u._iO.onconnect.apply(u,[e]))},this._ondataerror=function(){u.playState>0&&u._iO.ondataerror&&u._iO.ondataerror.apply(u)
}},S=function(){return ot.body||ot._docElement||ot.getElementsByTagName("div")[0]},s=function(e){return ot.getElementById(e)},d=function(e,t){var i,n,a,s={};for(i in e)e.hasOwnProperty(i)&&(s[i]=e[i]);n=t===void 0?it.defaultOptions:t;for(a in n)n.hasOwnProperty(a)&&s[a]===void 0&&(s[a]=n[a]);return s},G=function(){function e(e){var t=St.call(e),i=t.length;return a?(t[1]="on"+t[1],i>3&&t.pop()):3===i&&t.push(!1),t}function t(e,t){var i=e.shift(),n=[s[t]];a?i[n](e[0],e[1]):i[n].apply(i,e)}function i(){t(e(arguments),"add")
}function n(){t(e(arguments),"remove")}var a=rt.attachEvent,s={add:a?"attachEvent":"addEventListener",remove:a?"detachEvent":"removeEventListener"};return{add:i,remove:n}}(),et={abort:n(function(){}),canplay:n(function(){var e,t=this._t;if(t._html5_canplay)return!0;if(t._html5_canplay=!0,t._onbufferchange(0),e=isNaN(t.position)?null:t.position/1e3,t.position&&this.currentTime!==e)try{this.currentTime=e}catch(i){}t._iO._oncanplay&&t._iO._oncanplay()}),load:n(function(){var e=this._t;e.loaded||(e._onbufferchange(0),e._whileloading(e.bytesTotal,e.bytesTotal,e._get_html5_duration()),e._onload(!0))
}),ended:n(function(){var e=this._t;e._onfinish()}),error:n(function(){this._t._onload(!1)}),loadeddata:n(function(){var e=this._t,t=e.bytesTotal||1;e._loaded||Pt||(e.duration=e._get_html5_duration(),e._whileloading(t,t,e._get_html5_duration()),e._onload(!0))}),loadedmetadata:n(function(){}),loadstart:n(function(){this._t._onbufferchange(1)}),play:n(function(){this._t._onbufferchange(0)}),playing:n(function(){this._t._onbufferchange(0)}),progress:n(function(e){var t,i=this._t,n=0,a=("progress"===e.type,e.target.buffered),s=e.loaded||0,r=e.total||1;
if(i.loaded)return!1;if(a&&a.length){for(t=a.length-1;t>=0;t--)n=a.end(t)-a.start(t);s=n/e.target.duration}isNaN(s)||(i._onbufferchange(0),i._whileloading(s,r,i._get_html5_duration()),s&&r&&s===r&&et.load.call(this,e))}),ratechange:n(function(){}),suspend:n(function(e){var t=this._t;et.progress.call(this,e),t._onsuspend()}),stalled:n(function(){}),timeupdate:n(function(){this._t._onTimer()}),waiting:n(function(){var e=this._t;e._onbufferchange(1)})},H=function(e){return!e.serverURL&&(e.type?z({type:e.type}):z({url:e.url})||it.html5Only)
},Y=function(e){e&&(e.src=At?"":$t)},z=function(e){function t(e){return it.preferFlash&&Q&&!it.ignoreFlash&&it.flash[e]!==void 0&&it.flash[e]}if(!it.useHTML5Audio||!it.hasHTML5)return!1;var i,n,a,s,r=e.url||null,l=e.type||null,o=it.audioFormats;if(l&&it.html5[l]!==void 0)return it.html5[l]&&!t(l);if(!W){W=[];for(s in o)o.hasOwnProperty(s)&&(W.push(s),o[s].related&&(W=W.concat(o[s].related)));W=RegExp("\\.("+W.join("|")+")(\\?.*)?$","i")}if(a=r?r.toLowerCase().match(W):null,a&&a.length)a=a[1];else{if(!l)return!1;
n=l.indexOf(";"),a=(-1!==n?l.substr(0,n):l).substr(6)}return a&&it.html5[a]!==void 0?it.html5[a]&&!t(a):(l="audio/"+a,i=it.html5.canPlayType({type:l}),it.html5[a]=i,i&&it.html5[l]&&!t(l))},K=function(){function e(e){var t,i,n,s=!1;if(!a||"function"!=typeof a.canPlayType)return!1;if(e instanceof Array){for(i=0,n=e.length;n>i&&!s;i++)(it.html5[e[i]]||a.canPlayType(e[i]).match(it.html5Test))&&(s=!0,it.html5[e[i]]=!0,it.flash[e[i]]=!!(it.preferFlash&&Q&&e[i].match(Bt)));return s}return t=a&&"function"==typeof a.canPlayType?a.canPlayType(e):!1,!(!t||!t.match(it.html5Test))
}if(!it.useHTML5Audio||"undefined"==typeof Audio)return!1;var t,i,n,a="undefined"!=typeof Audio?Dt?new Audio(null):new Audio:null,s={};i=it.audioFormats;for(t in i)if(i.hasOwnProperty(t)&&(s[t]=e(i[t].type),s["audio/"+t]=s[t],it.flash[t]=it.preferFlash&&!it.ignoreFlash&&t.match(Bt)?!0:!1,i[t]&&i[t].related))for(n=i[t].related.length-1;n>=0;n--)s["audio/"+i[t].related[n]]=s[t],it.html5[i[t].related[n]]=s[t],it.flash[i[t].related[n]]=s[t];return s.canPlayType=a?e:null,it.html5=d(it.html5,s),!0},y={},D=function(){},O=function(e){return 8===o&&e.loops>1&&e.stream&&(e.stream=!1),e
},R=function(e){return e&&!e.usePolicyFile&&(e.onid3||e.usePeakData||e.useWaveformData||e.useEQData)&&(e.usePolicyFile=!0),e},B=function(){},r=function(){return!1},T=function(e){var t;for(t in e)e.hasOwnProperty(t)&&"function"==typeof e[t]&&(e[t]=r);t=null},M=function(e){e===void 0&&(e=!1),(pt||e)&&it.disable(e)},P=function(e){var t,i=null;if(e)if(e.match(/\.swf(\?.*)?$/i)){if(i=e.substr(e.toLowerCase().lastIndexOf(".swf?")+4))return e}else e.lastIndexOf("/")!==e.length-1&&(e+="/");return t=(e&&-1!==e.lastIndexOf("/")?e.substr(0,e.lastIndexOf("/")+1):"./")+it.movieURL,it.noSWFCache&&(t+="?ts="+(new Date).getTime()),t
},g=function(){o=parseInt(it.flashVersion,10),8!==o&&9!==o&&(it.flashVersion=o=mt);var e=it.debugMode||it.debugFlash?"_debug.swf":".swf";it.useHTML5Audio&&!it.html5Only&&it.audioFormats.mp4.required&&9>o&&(it.flashVersion=o=9),it.version=it.versionNumber+(it.html5Only?" (HTML5-only mode)":9===o?" (AS3/Flash 9)":" (AS2/Flash 8)"),o>8?(it.defaultOptions=d(it.defaultOptions,it.flash9Options),it.features.buffering=!0,it.defaultOptions=d(it.defaultOptions,it.movieStarOptions),it.filePatterns.flash9=RegExp("\\.(mp3|"+Ft.join("|")+")(\\?.*)?$","i"),it.features.movieStar=!0):it.features.movieStar=!1,it.filePattern=it.filePatterns[8!==o?"flash9":"flash8"],it.movieURL=(8===o?"soundmanager2.swf":"soundmanager2_flash9.swf").replace(".swf",e),it.features.peakData=it.features.waveformData=it.features.eqData=o>8
},A=function(e,t){return nt?(nt._setPolling(e,t),void 0):!1},I=function(){it.debugURLParam.test(lt)&&(it.debugMode=!0)},$=this.getSoundById,E=function(){var e=[];return it.debugMode&&e.push(N.sm2Debug),it.debugFlash&&e.push(N.flashDebug),it.useHighPerformance&&e.push(N.highPerf),e.join(" ")},L=function(){var e=(D("fbHandler"),it.getMoviePercent()),t=N,i={type:"FLASHBLOCK"};return it.html5Only?!1:(it.ok()?it.oMC&&(it.oMC.className=[E(),t.swfDefault,t.swfLoaded+(it.didFlashBlock?" "+t.swfUnblocked:"")].join(" ")):(kt&&(it.oMC.className=E()+" "+t.swfDefault+" "+(null===e?t.swfTimedout:t.swfError)),it.didFlashBlock=!0,u({type:"ontimeout",ignoreInit:!0,error:i}),_(i)),void 0)
},h=function(e,t,i){ct[e]===void 0&&(ct[e]=[]),ct[e].push({method:t,scope:i||null,fired:!1})},u=function(e){if(e||(e={type:"onready"}),!ut&&e&&!e.ignoreInit)return!1;if("ontimeout"===e.type&&it.ok())return!1;var t,i,n={success:e&&e.ignoreInit?it.ok():!pt},a=e&&e.type?ct[e.type]||[]:[],s=[],r=[n],l=kt&&it.useFlashBlock&&!it.ok();for(e.error&&(r[0].error=e.error),t=0,i=a.length;i>t;t++)a[t].fired!==!0&&s.push(a[t]);if(s.length)for(t=0,i=s.length;i>t;t++)s[t].scope?s[t].method.apply(s[t].scope,r):s[t].method.apply(this,r),l||(s[t].fired=!0);
return!0},p=function(){rt.setTimeout(function(){it.useFlashBlock&&L(),u(),it.onload instanceof Function&&it.onload.apply(rt),it.waitForWindowLoad&&G.add(rt,"load",p)},1)},X=function(){if(void 0!==Q)return Q;var e,t,i,n=!1,a=navigator,s=a.plugins,r=rt.ActiveXObject;if(s&&s.length)t="application/x-shockwave-flash",i=a.mimeTypes,i&&i[t]&&i[t].enabledPlugin&&i[t].enabledPlugin.description&&(n=!0);else if(r!==void 0){try{e=new r("ShockwaveFlash.ShockwaveFlash")}catch(l){}n=!!e}return Q=n,n},U=function(){var e,t,i=_t&&!!st.match(/os (1|2|3_0|3_1)/i);
if(i)return it.hasHTML5=!1,it.html5Only=!0,it.oMC&&(it.oMC.style.display="none"),!1;if(!it.useHTML5Audio)return!0;if(!it.html5||!it.html5.canPlayType)return it.hasHTML5=!1,!0;if(it.hasHTML5=!0,Et&&X())return!0;for(t in it.audioFormats)it.audioFormats.hasOwnProperty(t)&&(it.audioFormats[t].required&&!it.html5.canPlayType(it.audioFormats[t].type)||it.flash[t]||it.flash[it.audioFormats[t].type])&&(e=!0);return it.ignoreFlash&&(e=!1),it.html5Only=it.hasHTML5&&it.useHTML5Audio&&!e,!it.html5Only},F=function(e){var t,i,n=0;
if(e instanceof Array){for(t=0,i=e.length;i>t;t++)if(e[t]instanceof Object){if(it.canPlayMIME(e[t].type)){n=t;break}}else if(it.canPlayURL(e[t])){n=t;break}return e[n].url&&(e[n]=e[n].url),e[n]}return e},q=function(t){t._hasTimer||(t._hasTimer=!0,!Lt&&it.html5PollingInterval&&(null===xt&&0===wt&&(xt=e.setInterval(j,it.html5PollingInterval)),wt++))},V=function(e){e._hasTimer&&(e._hasTimer=!1,!Lt&&it.html5PollingInterval&&wt--)},j=function(){var t;if(null!==xt&&!wt)return e.clearInterval(xt),xt=null,!1;
for(t=it.soundIDs.length-1;t>=0;t--)it.sounds[it.soundIDs[t]].isHTML5&&it.sounds[it.soundIDs[t]]._hasTimer&&it.sounds[it.soundIDs[t]]._onTimer()},_=function(e){e=e!==void 0?e:{},it.onerror instanceof Function&&it.onerror.apply(rt,[{type:e.type!==void 0?e.type:null}]),e.fatal!==void 0&&e.fatal&&it.disable()},Z=function(){if(!Et||!X())return!1;var e,t,i=it.audioFormats;for(t in i)if(i.hasOwnProperty(t)&&("mp3"===t||"mp4"===t)&&(it.html5[t]=!1,i[t]&&i[t].related))for(e=i[t].related.length-1;e>=0;e--)it.html5[i[t].related[e]]=!1
},this._setSandboxType=function(){},this._externalInterfaceOK=function(){return it.swfLoaded?!1:((new Date).getTime(),it.swfLoaded=!0,Ot=!1,Et&&Z(),Tt?setTimeout(l,100):l(),void 0)},C=function(e,t){function i(){}function n(e,t){return'<param name="'+e+'" value="'+t+'" />'}if(dt&&ht)return!1;if(it.html5Only)return g(),i(),it.oMC=s(it.movieID),l(),dt=!0,ht=!0,!1;var a,r,o,c,d,h,u,p,f=t||it.url,m=it.altURL||f,v="JS/Flash audio component (SoundManager 2)",y=S(),b=E(),w=null,x=null,k=ot.getElementsByTagName("html")[0];
if(x=k&&k.dir&&k.dir.match(/rtl/i),e=e===void 0?it.id:e,g(),it.url=P(qt?f:m),t=it.url,it.wmode=!it.wmode&&it.useHighPerformance?"transparent":it.wmode,null!==it.wmode&&(st.match(/msie 8/i)||!Tt&&!it.useHighPerformance)&&navigator.platform.match(/win32|win64/i)&&(it.wmode=null),a={name:e,id:e,src:t,quality:"high",allowScriptAccess:it.allowScriptAccess,bgcolor:it.bgColor,pluginspage:Vt+"www.macromedia.com/go/getflashplayer",title:v,type:"application/x-shockwave-flash",wmode:it.wmode,hasPriority:"true"},null!==w&&(a.width=w,a.height=w),it.debugFlash&&(a.FlashVars="debug=1"),it.wmode||delete a.wmode,Tt)r=ot.createElement("div"),c=['<object id="'+e+'" data="'+t+'" type="'+a.type+'" title="'+a.title+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="'+Vt+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" width="'+a.width+'" height="'+a.height+'">',n("movie",t),n("AllowScriptAccess",it.allowScriptAccess),n("quality",a.quality),it.wmode?n("wmode",it.wmode):"",n("bgcolor",it.bgColor),n("hasPriority","true"),it.debugFlash?n("FlashVars",a.FlashVars):"","</object>"].join("");
else{r=ot.createElement("embed");for(o in a)a.hasOwnProperty(o)&&r.setAttribute(o,a[o])}if(I(),b=E(),y=S())if(it.oMC=s(it.movieID)||ot.createElement("div"),it.oMC.id)p=it.oMC.className,it.oMC.className=(p?p+" ":N.swfDefault)+(b?" "+b:""),it.oMC.appendChild(r),Tt&&(d=it.oMC.appendChild(ot.createElement("div")),d.className=N.swfBox,d.innerHTML=c),ht=!0;else{if(it.oMC.id=it.movieID,it.oMC.className=N.swfDefault+" "+b,h=null,d=null,it.useFlashBlock||(it.useHighPerformance?h={position:"fixed",width:"8px",height:"8px",bottom:"0px",left:"0px",overflow:"hidden"}:(h={position:"absolute",width:"6px",height:"6px",top:"-9999px",left:"-9999px"},x&&(h.left=Math.abs(parseInt(h.left,10))+"px"))),Mt&&(it.oMC.style.zIndex=1e4),!it.debugFlash)for(u in h)h.hasOwnProperty(u)&&(it.oMC.style[u]=h[u]);
try{Tt||it.oMC.appendChild(r),y.appendChild(it.oMC),Tt&&(d=it.oMC.appendChild(ot.createElement("div")),d.className=N.swfBox,d.innerHTML=c),ht=!0}catch(C){throw Error(D("domError")+" \n"+(""+C))}}return dt=!0,i(),!0},b=function(){return it.html5Only?(C(),!1):nt?!1:(nt=it.getMovie(it.id),nt||(gt?(Tt?it.oMC.innerHTML=vt:it.oMC.appendChild(gt),gt=null,dt=!0):C(it.id,it.url),nt=it.getMovie(it.id)),it.oninitmovie instanceof Function&&setTimeout(it.oninitmovie,1),!0)},f=function(){setTimeout(m,1e3)},m=function(){if(yt)return!1;
if(yt=!0,G.remove(rt,"load",f),Ot&&!Nt)return!1;var e;ut||(e=it.getMoviePercent()),setTimeout(function(){e=it.getMoviePercent(),!ut&&Rt&&(null===e?it.useFlashBlock||0===it.flashLoadTimeout?it.useFlashBlock&&L():M(!0):0===it.flashLoadTimeout||M(!0))},it.flashLoadTimeout)},v=function(){function e(){G.remove(rt,"focus",v),G.remove(rt,"load",v)}return Nt||!Ot?(e(),!0):(Rt=!0,Nt=!0,Pt&&Ot&&G.remove(rt,"mousemove",v),yt=!1,e(),!0)},tt=function(){var e,t=[];if(it.useHTML5Audio&&it.hasHTML5)for(e in it.audioFormats)it.audioFormats.hasOwnProperty(e)&&t.push(e+": "+it.html5[e]+(!it.html5[e]&&Q&&it.flash[e]?" (using flash)":it.preferFlash&&it.flash[e]&&Q?" (preferring flash)":it.html5[e]?"":" ("+(it.audioFormats[e].required?"required, ":"")+"and no flash support)"))
},c=function(e){if(ut)return!1;if(it.html5Only)return ut=!0,p(),!0;var t,i=it.useFlashBlock&&it.flashLoadTimeout&&!it.getMoviePercent();return i||(ut=!0,pt&&(t={type:!Q&&kt?"NO_FLASH":"INIT_TIMEOUT"})),pt||e?(it.useFlashBlock&&it.oMC&&(it.oMC.className=E()+" "+(null===it.getMoviePercent()?N.swfTimedout:N.swfError)),u({type:"ontimeout",error:t}),_(t),!1):it.waitForWindowLoad&&!ft?(G.add(rt,"load",p),!1):(p(),!0)},l=function(){function e(){G.remove(rt,"load",it.beginDelayedInit)}if(ut)return!1;if(it.html5Only)return ut||(e(),it.enabled=!0,c()),!0;
b();try{nt._externalInterfaceTest(!1),A(!0,it.flashPollingInterval||(it.useHighPerformance?10:50)),it.debugMode||nt._disableDebug(),it.enabled=!0,it.html5Only||G.add(rt,"unload",r)}catch(t){return _({type:"JS_TO_FLASH_EXCEPTION",fatal:!0}),M(!0),c(),!1}return c(),e(),!0},w=function(){return k?!1:(k=!0,I(),!Q&&it.hasHTML5&&(it.useHTML5Audio=!0,it.preferFlash=!1),K(),it.html5.usingFlash=U(),kt=it.html5.usingFlash,tt(),!Q&&kt&&(it.flashLoadTimeout=1),ot.removeEventListener&&ot.removeEventListener("DOMContentLoaded",w,!1),b(),!0)
},J=function(){return"complete"===ot.readyState&&(w(),ot.detachEvent("onreadystatechange",J)),!0},x=function(){ft=!0,G.remove(rt,"load",x)},X(),G.add(rt,"focus",v),G.add(rt,"load",v),G.add(rt,"load",f),G.add(rt,"load",x),Pt&&Ot&&G.add(rt,"mousemove",v),ot.addEventListener?ot.addEventListener("DOMContentLoaded",w,!1):ot.attachEvent?ot.attachEvent("onreadystatechange",J):_({type:"NO_DOM2_EVENTS",fatal:!0}),"complete"===ot.readyState&&setTimeout(w,100)}var i=null;void 0!==SM2_DEFER&&SM2_DEFER||(i=new t),e.SoundManager=t,e.soundManager=i
}(window),define("soundmanager",function(){}),define("plex/base/control/init/SoundManagerInit",["plex/base/model/ConfigModel","soundmanager"],function(e){soundManager=new SoundManager,soundManager.url="swf/soundmanager",soundManager.preferFlash=e.get("flash"),soundManager.flashVersion=9,soundManager.flashLoadTimeout=0,soundManager.useFastPolling=!0,soundManager.useHighPerformance=!0,soundManager.beginDelayedInit()}),define("plex/base/model/DebugInfoModel",["jquery","backbone"],function(e){var t=function(e){return e?"True":"False"
},i=Backbone.Model.extend({initialize:function(){var t=e("body script")[0].src,i=t.match(/rev\=([\d\.]+)/),n=i&&i.length>1?i[1]:t;this.set("host",window.location.host),this.set("userAgent",navigator.userAgent),this.set("clientVersion",n)},setAppModel:function(e){this.appModel=e},toJSON:function(){if(this.appModel){var i=this.appModel.get("primaryServer"),n=this.appModel.get("myPlex");this.set("isAuthorized",t(this.appModel.get("isAuthorized"))),this.set("isAvailable",t(!this.appModel.get("isUnavailable"))),this.set("primaryServerUrl",i.url()),this.set("primaryServerAuthToken",t(i.get("accessToken"))),this.set("primaryServerVersion",i.get("versionFull")),this.set("myPlexUrl",n.url()),this.set("myPlexFeatures",_.keys(n.get("features")).join(", ")),this.set("myPlexUsername",n.get("username")),this.set("myPlexAuthToken",t(n.get("authToken"))),this.set("browser",JSON.stringify(e.browser))
}return Backbone.Model.prototype.toJSON.apply(this,arguments)}});return new i}),window.jQuery&&function(e){e.extend({xml2json:function(t,i){function n(t,r){if(!t)return null;var l="",o=null,c=null;t.nodeType,a(t.localName||t.nodeName),t.text||t.nodeValue||"",t.childNodes&&t.childNodes.length>0&&e.each(t.childNodes,function(e,t){var i=t.nodeType,r=a(t.localName||t.nodeName),c=t.text||t.nodeValue||"";if(8!=i)if(3!=i&&4!=i&&r)o=o||{},o[r]?(o[r].length||(o[r]=s(o[r])),o[r]=s(o[r]),o[r][o[r].length]=n(t,!0),o[r].length=o[r].length):o[r]=n(t);
else{if(c.match(/^\s+$/))return;l+=c.replace(/^\s+/,"").replace(/\s+$/,"")}}),t.attributes&&t.attributes.length>0&&(c={},o=o||{},e.each(t.attributes,function(e,t){var i=a(t.name),n=t.value;o[i]?c[i]&&(o[i]=s(o[i]),o[i][o[i].length]=n):(o[i]=n,c[i]=n)})),o&&(o=e.extend(""!=l?new String(l):{},o||{}),l=o.text?("object"==typeof o.text?o.text:[o.text||""]).concat([l]):l,l&&(o.text=l),l="");var d=o||l;return i&&(l&&(d={}),l=d.text||l||"",l&&(d.text=l),r||(d=s(d))),d}if(!t)return{};var a=function(e){return((e||"")+"").replace(/-/g,"_")
},s=function(t){return e.isArray(t)||(t=[t]),t.length=t.length,t};if("string"==typeof t&&(t=e.text2xml(t)),t.nodeType){if(3==t.nodeType||4==t.nodeType)return t.nodeValue;var r=9==t.nodeType?t.documentElement:t,l=n(r,!0);return t=null,r=null,l}},text2xml:function(t){var i;try{var n=e.browser.msie?new ActiveXObject("Microsoft.XMLDOM"):new DOMParser;n.async=!1}catch(a){throw Error("XML Parser could not be instantiated")}try{i=e.browser.msie?n.loadXML(t)?n:!1:n.parseFromString(t,"text/xml")}catch(a){throw Error("Error parsing XML string")
}return i}})}(jQuery),define("xml2json",function(){}),define("plex/base/model/BaseModel",["jquery","plex/base/control/init/BackboneInit","backbone","xml2json"],function(e){var t=Backbone.Model.extend({_cache:{},_cacheReferences:0,constructor:function(e,t){if(e=_.extend({},e),t=_.extend({},t),this.app=t.app||t.collection&&t.collection.app,this.server=t.server||t.collection&&t.collection.server,this.section=t.section||t.collection&&t.collection.section,this.channel=t.channel||t.collection&&t.collection.channel,this.media=t.media||t.collection&&t.collection.media,this.mediaServer=t.mediaServer||t.collection&&t.collection.mediaServer,this.device=t.device||t.collection&&t.collection.device,t.skipCache||t.collection&&t.collection.skipCache)return Backbone.Model.prototype.constructor.apply(this,arguments),void 0;
var i=this.cacheKey?this.cacheKey(e):null;if(i&&this._cache[i]){t.parse&&(e=this.parse(e));var n=this._cache[i];return/\/children$/.test(t.url)||n.set(e),n.app=this.app||n.app,n.server=this.server||n.server,n.section=this.section||n.section,n.channel=this.channel||n.channel,n.media=this.media||n.media,n.mediaServer=this.mediaServer||n.mediaServer,n.device=this.device||n.device,n._cacheReferences++,n}return t.onlyIfCached?{}:(Backbone.Model.prototype.constructor.apply(this,arguments),this.cache(i),void 0)
},cache:function(e){this._cacheKey=e,this._cacheKey&&(this._cacheReferences||(this._cacheReferences=1),this._cache[this._cacheKey]=this)},release:function(){return this._cacheReferences--,1>this._cacheReferences&&this._cacheKey&&this._cache[this._cacheKey]?(delete this._cache[this._cacheKey],!0):!1},refreshCacheKey:function(){this._cacheKey&&this._cache[this._cacheKey]&&delete this._cache[this._cacheKey];var e=this.toJSON(),t=this.cacheKey?this.cacheKey(e):null;this.cache(t)},populate:function(e){return this.populatePromise||(this.populatePromise=this.fetch(e)),this.populatePromise
},fetch:function(){var t=Backbone.Model.prototype.fetch.apply(this,arguments),i=e.Deferred();return t.done(_.bind(function(e){i.resolveWith(this,[this,e])},this)),t.fail(_.bind(function(e){i.rejectWith(this,[this,e])},this)),this.populatePromise=i.promise(),this.populatePromise},save:function(t,i,n){var a,s;if(_.isObject(t)||t===void 0||null===t?(a=t,n=i):(a={},a[t]=i),n=n?_.clone(n):{},n.wait){if(!this._validate(a,n))return!1;s=_.clone(this.attributes)}var r=this.getSaveParams(a,n);if(_.extend(r,n.data),_.isEmpty(r))return n.success&&n.success(this),e.Deferred().resolve(this);
var l=_.extend({},n,{silent:!0});if(a&&!this.set(a,n.wait?l:n))return!1;var o=this,c=n.success;n.success=function(e,t,i){var s={};if(e){s=o.parse(e,i);var r=o.cacheKey?o.cacheKey(s):null;o.cache(r)}return n.wait&&(delete n.wait,!o.set(_.extend({},a,s),n))?!1:(c&&c(o,e),void 0)};var d=_.isFunction(this.url)?this.url():this.url;n.url=d+"?"+e.param(r,!0),n.data="",n.error=Backbone.wrapError(n.error,o,n);var h=this.isNew()?"create":"update",u=(this.sync||Backbone.sync).call(this,h,this,n);return n.wait&&this.set(s,l),u
},getSaveParams:function(e){return this.isNew()?e||this.toJSON():this.changedAttributes(e)||{}}});return t.extend=function(){var e=Backbone.Model.extend.apply(this,arguments);return e.prototype._cache={},e},t}),define("plex/base/model/collections/BaseCollection",["jquery","plex/base/control/init/BackboneInit","backbone","xml2json"],function(e){var t=Backbone.Collection.extend({populate:function(e){return this.populatePromise||(this.populatePromise=this.fetch(e)),this.populatePromise},fetch:function(){var t=Backbone.Collection.prototype.fetch.apply(this,arguments),i=e.Deferred();
return t.done(_.bind(function(e){i.resolveWith(this,[this,e])},this)),t.fail(_.bind(function(e){i.rejectWith(this,[this,e])},this)),this.populatePromise=i.promise(),this.populatePromise},convert:function(t,i){var n=_.isObject(t)?t:e.xml2json(t);if(!i)return n;var a=n[i];return a?(_.isArray(a)||(a=[a]),a):[]},release:function(){this.each(function(e){e.release()}),this.populatePromise=null,this.reset()}});return t}),define("plex/base/model/LogEntryModel",["plex/base/control/utils/LocalStorageUtil","plex/base/model/LocalStorageModel"],function(e,t){var i=t.extend({storage:e.storage(!0),storageKey:function(){return"LogEntry!"+this.cid
},initialize:function(){this.time||this.set("time",new Date)}});return i}),define("plex/base/model/collections/LogEntryCollection",["plex/base/model/SettingsModel","plex/base/model/DebugInfoModel","plex/base/model/collections/BaseCollection","plex/base/model/LogEntryModel","jquery","backbone"],function(e,t,i,n,a){var s=/(auth_token=|accessToken=|X-Plex-Token=)(\"?\w+\"?)/g,r=/(email=)(\"?[^&]+\"?)/g,l=/(password=)([^&]+)/,o=/(address=|host=)(\"?[^&]+\"?)/g,c=function(e){return e=e.replace(s,"$1TOKEN"),e.replace(l,"$1PASSWORD")
},d=function(e){return e&&e.hasOwnProperty("X-Plex-Token")&&(e["X-Plex-Token"]="TOKEN"),e&&e.hasOwnProperty("Authorization")&&(e.Authorization="BASIC AUTHORIZATION"),e},h=function(e){return e?(e=e.replace(s,'$1"TOKEN"'),e=e.replace(r,'$1"EMAIL"'),e=e.replace(o,'$1"IP ADRRESS"')):void 0},u=i.extend({model:n,onAjaxComplete:function(t,i,n){var a={type:"ajax",url:c(n.url),status:i.status};_.isEmpty(n.headers)||(a.headers=d(n.headers)),_.isEmpty(n.data)||(a.params=n.data),200===i.status?2===e.get("debugLevel")?a.response=h(i.responseText):a.responseLength=i.responseText.length:(a.statusText=i.statusText,a.response=h(i.responseText)),this.add(a)
},onRoute:function(e,t,i){var n={type:"navigation",route:t,args:i,fragment:window.location.hash};this.add(n)},initialize:function(){e.on("change:debugLevel",function(e,t){0===t?this.disableListeners():this.enableListeners()},this),_.bindAll(this,"onAjaxComplete","onRoute"),Backbone.history||(Backbone.history=new Backbone.History),0!==e.get("debugLevel")&&this.enableListeners()},enableListeners:function(){this.enabled||(a("body").on("ajaxComplete",null,null,this.onAjaxComplete),Backbone.history.on("route",this.onRoute),this.enabled=!0)
},disableListeners:function(){a("body").off("ajaxComplete",null,this.onAjaxComplete),Backbone.history.off("route",this.onRoute),this.enabled=!1,this.reset([])},add:function(){this.length>200&&this.shift(),i.prototype.add.apply(this,arguments)},toJSON:function(){var e=i.prototype.toJSON.apply(this,arguments);return e.push(_.extend({type:"info"},t.toJSON())),e}});return u}),define("plex/base/control/utils/LogUtil",["plex/base/model/SettingsModel","plex/base/model/collections/LogEntryCollection"],function(e,t){var i=!(!window.console||!window.console.log),n=new t;
return{log:function(t){n.add({type:"message",message:t}),i&&e.get("debugLevel")>=1&&console.log(t)},getLogsAsJSON:function(e){return e?JSON.stringify(n,null,2):JSON.stringify(n)}}}),define("plex/base/model/FriendModel",["plex/base/control/utils/ParseUtil","plex/base/model/BaseModel","jquery"],function(e,t,i){var n=t.extend({whitelistedAttrs:["id","title","username","email","thumb","recommendationsPlaylistId"],urlRoot:"/pms/friends",convert:function(t){var n=_.isObject(t)?t:i.xml2json(t);return e.parseInteger(n,"id"),n
},parse:function(e){var t=this.convert(e);return t=_.pick(t,this.whitelistedAttrs)}});return n}),define("plex/base/model/collections/FriendCollection",["plex/base/model/collections/BaseCollection","plex/base/model/FriendModel","jquery"],function(e,t){var i=e.extend({model:t,url:function(){return"/pms/friends/"+this.type},initialize:function(e,t){this.server=t.server,this.type=t.type||"all"},parse:function(e){return this.convert(e,"User")}});return i}),define("plex/base/model/SocialNetworkModel",["plex/base/control/utils/ParseUtil","plex/base/model/BaseModel","jquery"],function(e,t,i){var n=t.extend({idAttribute:"key",whitelistedAttrs:["key","title","linked","maxLength"],convert:function(t){var n=_.isObject(t)?t:i.xml2json(t);
return e.parseBoolean(n,["linked","maxLength"]),n},parse:function(e){var t=this.convert(e);return t=_.pick(t,this.whitelistedAttrs)}});return n}),define("plex/base/model/collections/SocialNetworkCollection",["plex/base/model/collections/BaseCollection","plex/base/model/SocialNetworkModel","jquery"],function(e,t){var i=e.extend({model:t,url:"/pms/social/networks",initialize:function(e,t){this.server=t.server},parse:function(e){return this.convert(e,"Directory")}});return i}),define("plex/base/model/SyncItemModel",["plex/base/control/utils/ParseUtil","plex/base/model/BaseModel","jquery"],function(e,t,i){var n=t.extend({whitelistedAttrs:["id","version","rootTitle","title","metadataType","clientIdentifier","Server","Status","MediaSettings","Policy","Location"],convert:function(t){var n=_.isObject(t)?t:i.xml2json(t);
return e.parseInteger(n,["id","version"]),e.parseEncodedString(n.Location,"uri"),n},parse:function(e){var t=this.convert(e);return t=_.pick(t,this.whitelistedAttrs),t.Location&&t.Location.uri&&(t.directory=/library\:\/\/([\w-]+)\/directory\//.test(t.Location.uri)),t}});return n}),define("plex/base/model/collections/SyncItemCollection",["plex/base/model/collections/BaseCollection","plex/base/model/SyncItemModel","jquery"],function(e,t){var i=e.extend({model:t,url:function(){return this.device?"/devices/"+this.device.id+"/sync_items":"/servers/"+this.mediaServer.id+"/sync_lists"
},initialize:function(e,t){this.server=t.server,this.mediaServer=t.mediaServer,this.device=t.device},parse:function(e){var t=this.convert(e),i=[],n=function(e,t){t&&(_.isArray(t)||(t=[t]),_.each(t,function(t){t.clientIdentifier=e,i.push(t)}))};return t.SyncList&&!_.isArray(t.SyncList)&&(t.SyncList=[t.SyncList]),_.each(t.SyncList,function(e){n(e.clientIdentifier,e.SyncItems.SyncItem)}),t.SyncItems&&n(t.clientIdentifier,t.SyncItems.SyncItem),i},getByServer:function(e){return this.filter(function(t){var i=t.get("Server");
return i&&i.machineIdentifier===e})}});return i}),define("plex/base/model/DeviceModel",["plex/base/model/BaseModel","plex/base/model/collections/SyncItemCollection","jquery"],function(e,t,i){var n=e.extend({idAttribute:"clientIdentifier",whitelistedAttrs:["clientIdentifier","name","product","productVersion","platform","platformVersion","device","model","provides","screenResolution","screenDensity"],initialize:function(e,i){i.server&&(this.server=i.server),this.set("syncItems",new t([],{server:this.server,device:this}))
},convert:function(e){var t=_.isObject(e)?e:i.xml2json(e);return t},parse:function(e){var t=this.convert(e);return t=_.pick(t,this.whitelistedAttrs),t.provides=t.provides?t.provides.split(","):[],t},supports:function(e){var t=this.get("provides");return-1!==_.indexOf(t,e)}});return n}),define("plex/base/model/collections/DeviceCollection",["plex/base/model/collections/BaseCollection","plex/base/model/DeviceModel","jquery"],function(e,t){var i=e.extend({model:t,url:function(){return"/devices.xml"},initialize:function(e,t){this.server=t.server
},parse:function(e){return this.convert(e,"Device")},getSyncDevices:function(){var e=this.filter(function(e){return e.supports("sync-target")});return _.sortBy(e,function(e){return"CloudSync"!==e.get("product")})}});return i}),define("plex/base/model/media/MediaModel",["plex/base/control/utils/MediaUtil","plex/base/model/BaseModel","jquery"],function(e,t,i){var n=t.extend({idAttribute:"ratingKey",defaults:{title:"",titleSort:"",tagline:"",rating:"",summary:"",year:"",studio:"",contentRating:"",originallyAvailableAt:"",originalTitle:"",thumb:"",art:"",allowSync:!1},subcollections:["Media","Genre","Collection","Field","Writer","Director","Role","Country","Location"],url:function(){return"/library/metadata/"+this.id
},cacheKey:function(e){var t=e.ratingKey?e.ratingKey:e.key,i=this.section?this.section.id+"!":"";return this.server.id+"!"+i+t},initialize:function(e,t){t.server&&(this.server=t.server),t.section&&(this.section=t.section),t.media&&(this.media=t.media),this.on("timeline",_.bind(function(e){5===e.state?this.fetch({hideLoadingAlert:!0}):9===e.state&&this.trigger("destroy",this,this.collection)},this))},convert:function(t){return e.convert(t)},parse:function(e){var t=this.convert(e);return"ratingKey"===this.idAttribute&&(t.originalRatingKey?this.idAttribute="originalRatingKey":t.ratingKey||(this.idAttribute="key")),t.viewedLeafCount!==void 0&&(t.unviewedLeafCount=t.leafCount-t.viewedLeafCount),t.key&&(_.each(_.keys(this.defaults),_.bind(function(e){e in t||(t[e]=this.defaults[e])
},this)),/^(photo|photoalbum)$/.test(t.type)&&/\/children$/.test(t.key)&&(t.type="photoAlbum"),t.folder=/\/folder\?parent\=/.test(t.key)),t},batchSave:function(e,t,i){var n=this.url;this.url="/library/metadata/"+_.pluck(e,"id").join(",");var a=this.save(t,i);return this.url=n,a},batchAdd:function(e,t,n){var a="/library/metadata/"+_.pluck(e,"id").join(",")+"/"+t+"/add?tag="+encodeURIComponent(n),s=_.extend({type:"PUT"},this.server.getAjaxOptions(a));return i.ajax(s)},getSaveParams:function(e){return _.each(e.Field,function(t){e[t.name+".locked"]=t.locked
}),delete e.Field,_.each(["Collection","Director","Writer","Genre","Country"],function(t){t in e&&(_.isEmpty(e[t])?e[t.toLowerCase()+"[]"]="":_.each(e[t],function(i,n){e[t.toLowerCase()+"["+n+"].tag.tag"]=i.tag}),delete e[t])}),e},getDownloadUrl:function(){var e=this.server.get("accessToken"),t=_.first(this.get("Media"));if(t){var i=_.first(t.Part);if(i&&i.key){var n=i.key;return e&&(n+=n.indexOf("?")>0?"&":"?",n+="X-Plex-Token="+e),this.server.resolveUrl(n)}}return""},getMediaLocation:function(){var e=_.first(this.get("Media"));
if(e){var t=_.first(e.Part);if(t)return t.file}return null},getMediaKey:function(){var e=_.first(this.get("Media")),t=this.get("key");if(e){var i=_.first(e.Part);if(i)return i.key}else if(t)return t;return null},getStreams:function(e,t){var i=_.first(this.get("Media")),n=[];if(i){var a=_.first(i.Part);if(a&&a.Stream){var s={streamType:e};t&&(s.selected="1"),n.push.apply(n,_.where(a.Stream,s))}}return n}});return n.extend=function(){var e=t.extend.apply(this,arguments);return delete e.prototype._cache,e
},n}),define("plex/base/model/media/ClipModel",["plex/base/control/utils/ParseUtil","plex/base/model/media/MediaModel","jquery"],function(e,t,i){var n=t.extend({idAttribute:"key",url:function(){return this.id},convert:function(e){var n=_.isObject(e)?e:i.xml2json(e),a=n.Video||n;return n.Video&&(a.identifier=n.identifier,a.mediaTagPrefix=n.mediaTagPrefix,a.mediaTagVersion=n.mediaTagVersion,a.allowSync=n.allowSync),a=t.prototype.convert.call(this,a)},parse:function(){var e=t.prototype.parse.apply(this,arguments);
return e._origType=e.type,e.type="clip",e}});return n}),define("plex/base/model/media/PlaylistItemModel",["plex/base/control/utils/ParseUtil","plex/base/model/media/ClipModel","jquery"],function(e,t){var i=t.extend({idAttribute:"id",url:function(){return"/pms/playlists/"+this.get("playlistName")+"/items/"+this.id},cacheKey:function(e){return this.server.id+"!"+e[this.idAttribute]},initialize:function(e,t){this.set("playlistName",t.playlistName||this.collection.playlistName)},convert:function(){var i=t.prototype.convert.apply(this,arguments);
return e.parseInteger(i,["id","viewCount"]),i},parse:function(){var i=t.prototype.parse.apply(this,arguments);if(i.type="playlistItem",i.ratingKey=i.url,i.thumb){var n=/\?(\d+)$/.exec(i.thumb);n&&(i.addedAt=n[1],e.parseInteger(i,"addedAt"))}return i}});return i}),define("plex/base/model/media/collections/PlaylistItemCollection",["plex/base/control/utils/ParseUtil","plex/base/model/collections/BaseCollection","plex/base/model/media/PlaylistItemModel","jquery"],function(e,t,i){var n=t.extend({model:i,url:function(){return"/pms/playlists/"+this.playlistName+"/all"
},initialize:function(e,t){this.server=t.server,this.playlistName=t.name,this.playlistLabel=t.label},parse:function(t){var i=this.convert(t);return e.parseArray(i,"Video"),_.each(i.Video,function(e){e.identifier=i.identifier}),i.Video},all:function(){return this.models},watched:function(){return this.filter(function(e){return e.get("viewCount")})},unwatched:function(){return this.filter(function(e){return!e.get("viewCount")})}});return n});var b64array="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
define("base64",function(){}),define("plex/base/model/MyPlexModel",["plex/base/model/BaseModel","plex/base/control/utils/LogUtil","plex/base/control/utils/BrowserDetect","plex/base/control/utils/StringUtil","plex/base/control/utils/LocalStorageUtil","plex/base/model/collections/FriendCollection","plex/base/model/collections/SocialNetworkCollection","plex/base/model/collections/DeviceCollection","plex/base/model/media/collections/PlaylistItemCollection","jquery","xml2json","base64"],function(e,t,i,n,a,s,r,l,o,c){var d=e.extend({idAttribute:"machineIdentifier",defaults:{address:"my.plexapp.com",host:"my.plexapp.com",port:"443",friendlyName:"myPlex",name:"myPlex",machineIdentifier:"myPlex",isUnavailable:!1,signedIn:!1,owned:!1,features:{},transcoderVideo:!1},url:function(){return this.get("url")||"https://my.plexapp.com/"
},initialize:function(e,t){this.app=t.app,this.pms=t.server,this.set("friends",new s([],{server:this})),this.set("friendRequests",new s([],{server:this,type:"requests"})),this.set("socialNetworks",new r([],{server:this})),this.set("devices",new l([],{server:this}));var i={};i.queue=new o([],{server:this,name:"queue",label:"Queue"}),i.recommendations=new o([],{server:this,name:"recommendations",label:"Recommendations"}),this.set("playlists",i)},getInfoFromStorage:function(){a.get({key:"myPlexBaseUrl",callback:_.bind(function(e){e&&this.set("url",e)
},this)}),a.get({key:"myPlexAuthToken",session:!0,callback:_.bind(function(e){e?(this.set("authToken",e),this.trigger("ready")):a.get({key:"myPlexAuthToken",callback:_.bind(function(e){e&&this.set("authToken",e),this.trigger("ready")},this)})},this)})},parseMyPlexAccountInfo:function(e){var i=c.xml2json(e);if(i.authenticationToken&&this.set("authToken",i.authenticationToken),this.set({signedIn:!0,accountId:i.id,email:i.email,username:i.username,queueEmail:i.queueEmail,queueUid:i.queueUid}),i.subscription){this.set("subscription",i.subscription.active),t.log("myPlex subscriptions: "+JSON.stringify(i.subscription.feature));
var n=_.isArray(i.subscription.feature)?i.subscription.feature:_.isEmpty(i.subscription.feature)?[]:[i.subscription.feature];this.set("features",_.reduce(n,function(e,t){return e[t.id]=!0,e},{}))}else this.set("features",{});"object"==typeof _errs&&(_errs.meta={username:i.username})},signIn:function(e,t,i){var s={type:"POST",dataType:"text",url:this.resolveUrl("/users/sign_in.xml"),headers:this.getHeaders(),success:_.bind(function(e){this.parseMyPlexAccountInfo(e),a.set({key:"myPlexAuthToken",value:this.get("authToken"),session:!i})
},this)};return s.headers.Authorization="Basic "+encode64(n.toUtf8(e+":"+t)),c.ajax(s)},fetch:function(e){return e||(e={}),this.get("authToken")?c.ajax(_.extend({},e,{type:"GET",dataType:"text",url:this.resolveUrl("/users/account"),headers:this.getHeaders(),success:_.bind(function(t){this.parseMyPlexAccountInfo(t),e.success&&e.success(this,t)},this)})):c.ajax(_.extend({},e,{type:"GET",dataType:"text",url:this.resolveUrl("/pms/:/ip"),headers:this.getHeaders()}))},resolveUrl:function(e){if(/^\w+:\/\//.test(e))return e;
0===e.lastIndexOf("/:/",0)&&(e="/pms"+e);var t=this.url()+("/"==e[0]?e.substr(1):e);return this.get("authToken")&&(t+=t.indexOf("?")>0?"&":"?",t+="auth_token="+this.get("authToken")),t},getHeaders:function(){var e={};return e["X-Plex-Client-Identifier"]=this.app.get("clientID"),e["X-Plex-Product"]="Web Client",e["X-Plex-Device"]=i.OS,e["X-Plex-Platform"]=i.browser,e["X-Plex-Platform-Version"]=i.version,e["X-Plex-Version"]=this.app.get("version"),this.get("signedIn")&&(e["X-Plex-Account"]=this.get("accountId"),e["X-Plex-Username"]=this.get("username")),e
},getAjaxOptions:function(e){var t={};return t.url=this.resolveUrl(e),t.dataType="text",0===t.url.lastIndexOf(this.url(),0)&&(t.headers=this.getHeaders()),t},hasPlexPass:function(){return"pass"in this.get("features")},hasSync:function(){return"sync"in this.get("features")}});return d}),define("plex/base/control/mixins/ServerMixin",["plex/base/control/utils/BrowserDetect"],function(e){var t={splitApart:"0.9.7.0",merge:"0.9.7.0",batchEdit:"0.9.7.0",search:"0.9.7.0",cleanBundles:"0.9.7.0",timelineState:"0.9.7.2",firstRunPref:"0.9.7.3",artworkUpload:"0.9.7.9",sync:"0.9.7.10",universalTranscoder:"0.9.7.17",universalMusicTranscoder:"0.9.8.3",syncNotifications:"0.9.7.23",sharedPreferences:"0.9.7.23",dash:"0.9.8.5"},i={url:function(e){return this.serverUrl?this.serverUrl:this.buildUrl(e)
},buildUrl:function(e){e||(e={});var t=e.protocol?e.protocol:this.get("protocol"),i=e.address?e.address:this.get("address"),n=e.port?e.port:this.get("port");if(!i&&!n)return window.location.protocol+"//"+window.location.host+"/";n=n||window.location.port,t||(t=443==n?"https":"http");var a=t+"://"+(i||window.location.hostname);return n&&(a+=":"+n),a+"/"},resolveUrl:function(e,t,i){if(/^\w+:\/\//.test(e))return e;var n,a=t?"http://127.0.0.1:32400/":this.url();n=e?a+("/"==e[0]?e.substr(1):e):a;var s=this.get("accessToken");
return i&&s?(n+=n.indexOf("?")>0?"&":"?",n+="X-Plex-Token="+s):n},resolveExternalUrl:function(e){if(0===e.lastIndexOf("http",0))return e;var t="http://"+this.get("address")+":"+this.get("port")+"/";return t+("/"==e[0]?e.substr(1):e)},getHeaders:function(){var t={},i=this.get("accessToken"),n=this.app.get("clientID"),a=this.app.get("myPlex");return i&&(t["X-Plex-Token"]=i),n&&(t["X-Plex-Client-Identifier"]=this.app.get("clientID")),a&&a.get("signedIn")&&(t["X-Plex-Username"]=a.get("username")),t["X-Plex-Product"]=this.app.get("product")||"Web Client",t["X-Plex-Device"]=this.app.get("device")||e.OS,t["X-Plex-Platform"]=this.app.get("platform")||e.browser,t["X-Plex-Platform-Version"]=e.version,t["X-Plex-Version"]=this.app.get("version"),t["X-Plex-Device-Name"]="Plex/Web ("+e.browser+")",t
},getAjaxOptions:function(e){var t={};return t.url=this.resolveUrl(e),t.dataType="text",0===t.url.lastIndexOf(this.url(),0)&&(t.headers=this.getHeaders()),t},supports:function(e){var i=t[e],n=this.get("version");if(i&&n){i=i.split("."),n=n.split(".");for(var a=0,s=i.length;s>a;a++)if(n.length>a){var r=parseInt(i[a],10),l=parseInt(n[a],10);if(l>r)return!0;if(r>l)return!1}return!0}return!0}};return i}),define("plex/base/model/MyPlexAccountModel",["plex/base/model/BaseModel","jquery"],function(e,t){var i=e.extend({url:"/myplex/account",signedIn:!1,whitelistedAttrs:["username","mappingState","mappingError","mappingErrorMessage","signInState","publicAddress","publicPort","privateAddress","privatePort","subscriptionActive","subscriptionState"],isNew:function(){return!this.signedIn
},convert:function(e){var i=_.isObject(e)?e:t.xml2json(e);return i},parse:function(e){var t=this.convert(e);return t=_.pick(t,this.whitelistedAttrs),"ok"===t.signInState?this.signedIn=!0:(this.signedIn=!1,t.username="",t.password=""),t}});return i}),define("plex/base/model/AlphanumericModel",["plex/base/control/utils/ParseUtil","plex/base/model/BaseModel","jquery"],function(e,t,i){var n=t.extend({idAttribute:"key",whitelistedAttrs:["key","title","size"],url:function(){return"library/sections/"+this.section.id+"/firstCharacter/"+this.id
},convert:function(t){var n=_.isObject(t)?t:i.xml2json(t);return e.parseEncodedString(n,"key"),e.parseInteger(n,"size"),n},parse:function(e){var t=this.convert(e);return t=_.pick(t,this.whitelistedAttrs)}});return n}),define("plex/base/model/collections/AlphanumericCollection",["plex/base/model/collections/BaseCollection","plex/base/model/AlphanumericModel","jquery"],function(e,t){var i=e.extend({model:t,url:function(){var e="library/sections/"+this.section.id+"/firstCharacter?",t={},i=[];this.mediaType&&13!==this.mediaType&&(t.type=this.mediaType),_.each(this.filters,function(e){e.values.length&&(t[e.key]=e.values.join(","))
});for(var n in t)"unviewedLeafCount"===n?i.push(n+">="+t[n]):i.push(n+"="+t[n]);return e+=i.join("&")},initialize:function(e,t){this.server=t.server,this.section=t.section},parse:function(e){return this.convert(e,"Directory")}});return i}),define("plex/base/model/FilterOptionModel",["plex/base/model/BaseModel","jquery"],function(e,t){var i=e.extend({idAttribute:"key",whitelistedAttrs:["key","type","title"],convert:function(e){var i=_.isObject(e)?e:t.xml2json(e);return i},parse:function(e){var t=this.convert(e);
return t=_.pick(t,this.whitelistedAttrs)}});return i}),define("plex/base/model/collections/FilterOptionCollection",["plex/base/model/collections/BaseCollection","plex/base/model/FilterOptionModel","jquery"],function(e,t){var i=e.extend({model:t,initialize:function(e,t){this.server=t.server,this.section=t.section,this.parentFilter=t.parentFilter,this.activeFilters=[]},url:function(){var e="library/sections/"+this.section.id+"/"+this.parentFilter.id,t={},i=[];this.parentFilter.mediaType&&(t.type=this.parentFilter.mediaType),_.each(this.activeFilters,_.bind(function(e){var i=e.values.length,n=e.key!==this.parentFilter.id,a="viewCount"===e.key||"unviewedLeafCount"===e.key;
i&&n&&!a&&(t[e.key]=e.values.join(","))},this));for(var n in t)"unviewedLeafCount"===n?i.push(n+">="+t[n]):i.push(n+"="+t[n]);var a=i.join("&");return a.length&&(e+="?"+a),e},parse:function(e){return this.convert(e,"Directory")},search:function(e){var t=this.filter(function(t){return t.get("title").toLowerCase().indexOf(e.toLowerCase())>-1}),n=new i(t,{server:this.server,section:this.section,parentFilter:this.parentFilter});return n}});return i}),define("plex/base/model/LinearFilterModel",["plex/base/control/utils/ParseUtil","plex/base/model/BaseModel","plex/base/model/collections/FilterOptionCollection","jquery"],function(e,t,i,n){var a=t.extend({idAttribute:"key",whitelistedAttrs:["secondary","key","title"],defaults:{linear:!0},initialize:function(){this.set("options",new i([],{server:this.server,section:this.section,parentFilter:this}))
},convert:function(t){var i=_.isObject(t)?t:n.xml2json(t);return e.parseBoolean(i,"secondary"),i},parse:function(e){var t=this.convert(e);t=_.pick(t,this.whitelistedAttrs);var i=t.key;return t.primary=!t.secondary&&/^(all|recentlyAdded|onDeck|newest)/.test(i),"all"===i&&(t.title="All"),t}});return a}),define("plex/base/model/collections/LinearFilterCollection",["plex/base/model/collections/BaseCollection","plex/base/model/LinearFilterModel","jquery"],function(e,t){var i=e.extend({model:t,url:function(){var e=(""+this.section.id).match(/^(\S+)\/library\//);
return e&&e.length>1?this.section.id:"/library/sections/"+this.section.id},initialize:function(e,t){this.server=t.server,this.section=t.section},parse:function(e){return this.convert(e,"Directory")}});return i}),define("plex/base/model/FilterModel",["plex/base/model/BaseModel","plex/base/model/collections/FilterOptionCollection","jquery"],function(e,t,i){var n=e.extend({idAttribute:"filter",whitelistedAttrs:["filter","filterType","key","title"],url:function(){return"library/sections/"+this.section.id+"/"+this.id
},initialize:function(){this.collection&&this.collection.mediaType&&(this.mediaType=this.collection.mediaType),this.set("options",new t([],{server:this.server,section:this.section,parentFilter:this}))},convert:function(e){var t=_.isObject(e)?e:i.xml2json(e);return t},parse:function(e){var t=this.convert(e);return t=_.pick(t,this.whitelistedAttrs)}});return n}),define("plex/base/model/collections/FilterCollection",["plex/base/model/collections/BaseCollection","plex/base/model/FilterModel","jquery"],function(e,t){var i=e.extend({model:t,url:function(){return"library/sections/"+this.section.id+"/filters?type="+this.mediaType
},initialize:function(e,t){this.server=t.server,this.section=t.section},parse:function(e){return this.convert(e,"Directory")}});return i}),define("plex/base/model/SortModel",["plex/base/model/BaseModel","plex/base/model/collections/FilterOptionCollection","jquery"],function(e,t,i){var n=e.extend({idAttribute:"key",whitelistedAttrs:["key","title","default"],convert:function(e){var t=_.isObject(e)?e:i.xml2json(e);return t},parse:function(e){var t=this.convert(e);return t=_.pick(t,this.whitelistedAttrs)
}});return n}),define("plex/base/model/collections/SortCollection",["plex/base/model/collections/BaseCollection","plex/base/model/SortModel","jquery"],function(e,t){var i=e.extend({model:t,url:function(){return"library/sections/"+this.section.id+"/sorts?type="+this.mediaType},initialize:function(e,t){this.server=t.server,this.section=t.section},parse:function(e){return this.convert(e,"Directory")}});return i}),define("plex/base/control/utils/MediaTypes",["underscore"],function(){var e=function(){this.types=[{id:1,typeString:"movie",label:"Movie"},{id:2,typeString:"show",label:"Show",related:[3,4]},{id:3,typeString:"season",label:"Season",related:[2,4]},{id:4,typeString:"episode",label:"Episode",related:[2,3]},{id:8,typeString:"artist",label:"Artist",related:[9,10]},{id:9,typeString:"album",label:"Album",related:[8,10]},{id:10,typeString:"track",label:"Track",related:[8,9]},{id:13,typeString:"photo",label:"Photo"}],this.byID=_.reduce(this.types,function(e,t){return e[t.id]=t,e
},{}),this.byType=_.reduce(this.types,function(e,t){return e[t.typeString]=t,e},{}),this.getMediaTypes=function(){return this.types},this.getMediaType=function(e){return this.byID[e]},this.getMediaTypeByString=function(e){return this.byType[e]},this.getRelatedMediaTypes=function(e){var t=this.byType[e],i=_.map(t.related,_.bind(function(e){return this.byID[e]},this));return i.unshift(t),i},this.getChildMediaType=function(e){var t,i=this.byType[e],n=_.map(i.related,_.bind(function(e){return this.byID[e]
},this));return n&&n.length&&(t=_.last(n)),t&&t.id>i.id?t:i}};return new e}),define("plex/base/model/media/collections/MediaCollection",["plex/base/control/utils/ParseUtil","plex/base/control/utils/MediaTypes","plex/base/model/collections/BaseCollection","plex/base/model/media/MediaModel","jquery"],function(e,t,i,n){var a=i.extend({model:n,size:0,start:0,totalSize:null,pending:!1,allowSync:!1,search:"",scrollPosition:0,initialize:function(e,i){if(this.server=i.server,this.section=i.section,this.subset=i.subset||"all",this.mediaType=i.mediaType,this.firstCharacter=i.firstCharacter||null,this.start=i.start||0,this.size=i.size||50,this.populatedRange=i.populatedRange||{start:0,end:0},this.scrollPosition=i.scrollPosition||0,this.linearFilter=i.linearFilter||{},this.filters=i.filters||[],this.sort=i.sort||{},i.url&&(this.url=i.url),this.section&&!this.mediaType){var n=t.getRelatedMediaTypes(this.section.get("type"));
this.mediaType=n[0].id}},url:function(){if(this.section.get("limited"))return this.getLimitedUrl();var e="/library/sections/",t=this.getMediaType(),i={},n=[];if(this.firstCharacter)e+=this.section.id+"/firstCharacter/"+encodeURIComponent(this.firstCharacter)+"?";else{var a=this.subset;("recentlyAdded"===this.subset||"newest"===this.subset)&&(a="all"),e+=this.section.id+"/"+a+"?"}this.section.get("refreshing")&&this.server.supports("timelineState")&&(i.timelineState=1),t&&13!==t&&(i.type=t),_.each(this.filters,function(e){e.values.length&&(i[e.key]=e.values.join(","))
}),this.sort.key&&(i.sort=this.sort.key+":"+this.sort.direction),i["X-Plex-Container-Start"]=this.start,i["X-Plex-Container-Size"]=this.size;for(var s in i)"unviewedLeafCount"===s?n.push(s+">="+i[s]):n.push(s+"="+i[s]);return e+=n.join("&")},getLimitedUrl:function(){var e=this.subset.match(/^(\S+)\/library\//);if(e&&e.length>1)return this.subset;var t=(""+this.section.id).match(/^(\S+)\/library\//);return t&&t.length>1?this.section.id+"/"+this.subset:"/library/sections/"+this.section.id+"/"+this.subset
},parse:function(t){_.isString(t)&&(t=t.replace(/<(Directory|Video|Track|Photo)/g,"<MediaItem"),t=t.replace(/<\/(Directory|Video|Track|Photo)\>/g,"</MediaItem>"));var i=this.convert(t);return e.parseInteger(i,"totalSize"),e.parseBoolean(i,"allowSync"),e.parseArray(i,"MediaItem"),this.viewGroup=i.viewGroup,this.totalSize=i.totalSize,this.allowSync=i.allowSync,"all"!==this.subset&&this.totalSize>200&&(this.totalSize=200),i.identifier&&_.each(i.MediaItem,function(e){e.identifier=i.identifier}),i.MediaItem
},fetchSize:function(e){return this.size=0,this.start=0,this.fetch(e)},fetchRange:function(e){e=_.extend(e,{add:!0}),e.prepend&&(e.at=0),this.start=e.start,this.size=e.size,this.pending=!0;var t=this.fetch(e).always(_.bind(function(){this.pending=!1},this));return t},merge:function(){var e=this.populatedRange.start,t=this.populatedRange.end-this.populatedRange.start;if(e>0)return this.populatedRange.start=0,this.trigger("merge"),this.fetchRange({start:0,size:e,prepend:!0}),void 0;this.size>t&&(t=this.size);
var i=new a([],{server:this.server,section:this.section,subset:this.subset,mediaType:this.mediaType,start:this.populatedRange.start,size:t,filters:this.filters,sort:this.sort});_.isString(this.url)&&(i.url=this.url),i.fetch({hideLoadingAlert:!0}).done(_.bind(function(){var e=this.totalSize;this.totalSize=i.totalSize,i.each(function(e,t){var n=this.get(e.id);n?e.release():(this.add(e,{at:i.start+t,merge:!0}),this.length>i.size&&this.pop().release())},this),this.trigger("merge",this,this.totalSize,e)
},this))},release:function(){i.prototype.release.call(this),this.populatePromise=null,this.firstCharacter=null,this.start=0,this.size=50,this.populatedRange.start=0,this.populatedRange.end=0,this.totalSize=null},updateSubset:function(e){return this.subset?(this.release(),e&&e!==this.subset&&(this.subset=e,this.scrollPosition=0,this.linearFilter={},this.filters=[],this.sort={},("recentlyAdded"===e||"newest"===e)&&(this.sort.key="recentlyAdded"===e?"addedAt":"originallyAvailableAt",this.sort.direction="desc")),void 0):(this.subset=e||"all",void 0)
},getMediaType:function(){if(/^(onDeck|recentlyAdded|recentlyViewed|newest)$/.test(this.subset)){if(2===this.mediaType)return 4;if(8===this.mediaType)return 9}return this.mediaType},getSubsetTitle:function(){switch(this.subset){case"onDeck":return"On Deck";case"recentlyAdded":return"Recently Added";case"recentlyViewed":return"Recently Viewed";case"folder":return"By Folder";case"newest":return 2===this.mediaType||4===this.mediaType?"Recently Aired":"Recently Released"}return this.section.get("title")
},movies:function(){return this.filter(function(e){return"movie"===e.get("type")})},shows:function(){return this.filter(function(e){return"show"===e.get("type")})},episodes:function(){return this.filter(function(e){return"episode"===e.get("type")})},artists:function(){return this.filter(function(e){return"artist"===e.get("type")})},albums:function(){return this.filter(function(e){return"album"===e.get("type")})},tracks:function(){return this.filter(function(e){return"track"===e.get("type")})},clips:function(){return this.filter(function(e){return"clip"===e.get("type")
})}});return a}),define("plex/base/model/SectionModel",["plex/base/control/utils/ParseUtil","plex/base/control/utils/LocalizationUtil","plex/base/model/BaseModel","plex/base/model/collections/AlphanumericCollection","plex/base/model/collections/LinearFilterCollection","plex/base/model/collections/FilterCollection","plex/base/model/collections/SortCollection","plex/base/model/media/collections/MediaCollection","jquery"],function(e,t,i,n,a,s,r,l,o){var c=i.extend({idAttribute:"key",urlRoot:"/library/sections",defaults:{limited:!0},whitelistedAttrs:["key","uniqueKey","uuid","type","limited","title","art","thumb","agent","scanner","language","location","refreshing","updatedAt","createdAt"],cacheKey:function(e){return e.key?this.server.id+"!"+e.key:null
},initialize:function(){this.set("alphanumeric",new n([],{server:this.server,section:this})),this.set("linearFilters",new a([],{server:this.server,section:this})),this.set("filters",new s([],{server:this.server,section:this})),this.set("sorts",new r([],{server:this.server,section:this})),this.set("media",new l([],{server:this.server,section:this,subset:"all"}))},convert:function(t){var i=_.isObject(t)?t:o.xml2json(t);return e.parseBoolean(i,"refreshing"),e.parseInteger(i,["createdAt","updatedAt"]),i
},parse:function(e,t){var i=this.convert(e);if(t&&201==t.status&&(i.Directory&&(i=i.Directory),!i.key)){var n=t.getResponseHeader("Location");n&&(i.key=n.substring(n.lastIndexOf("/")+1))}return _.isArray(i.Location)?i.location=_.pluck(i.Location,"path"):i.Location&&(i.location=[i.Location.path]),this.server&&(i.limited="secondary"===this.server.get("serverClass")),i=_.pick(i,this.whitelistedAttrs)},getFilteredTitle:function(e,i){var n=i?this.get("title"):"",a=this.get("media"),s=a.filters,r=!0;if(e){var l=[];
return _.each(e,function(e){l.push(e.get("title"))}),l=l.join(", "),i?n+": "+l:l}if("all"!==a.subset){var o=t.t(a.getSubsetTitle());return i?n+": "+o:o}return s&&s.length?(i&&(n+=": "),_.each(s,function(e){var t=e.titles||e.values;_.each(t,function(e){r||(n+=", "),n+=e,r=!1})}),n?n:this.get("title")):this.get("title")},getSaveParams:function(){var e=i.prototype.getSaveParams.apply(this,arguments);return e=_.pick(e,["name","title","type","agent","scanner","language","location"]),"title"in e&&(e.name=e.title,delete e.title),e
}});return c}),define("plex/base/model/collections/SectionCollection",["plex/base/model/collections/BaseCollection","plex/base/model/SectionModel","jquery"],function(e,t){var i=e.extend({model:t,url:"library/sections",initialize:function(e,t){this.server=t.server},parse:function(e){return this.convert(e,"Directory")}});return i}),define("plex/base/model/ChannelActionModel",["plex/base/model/BaseModel"],function(e){var t=e.extend({idAttribute:"key"});return t}),define("plex/base/model/collections/ChannelActionCollection",["plex/base/model/collections/BaseCollection","plex/base/model/ChannelActionModel","jquery"],function(e,t){var i=e.extend({model:t,initialize:function(e,t){this.server=t.server,t.url&&(this.url=t.url)
},parse:function(e){return this.convert(e,"Directory")}});return i}),define("plex/base/model/media/collections/ClipCollection",["plex/base/control/utils/ParseUtil","plex/base/model/collections/BaseCollection","plex/base/model/media/ClipModel","jquery"],function(e,t,i){var n=t.extend({model:i,allowSync:!1,url:function(){return this.media.get("key")},initialize:function(e,t){this.server=t.server,this.media=t.media,t.url&&(this.url=t.url)},parse:function(t){var i=this.convert(t);return e.parseBoolean(i,"allowSync"),this.allowSync=i.allowSync,i.Video
}});return n}),define("plex/base/model/media/TrackModel",["plex/base/model/media/MediaModel"],function(e){var t=e.extend({parse:function(){var t=e.prototype.parse.apply(this,arguments);return t.type||(t.type="track"),t}});return t}),define("plex/base/model/media/collections/TrackCollection",["plex/base/control/utils/ParseUtil","plex/base/model/collections/BaseCollection","plex/base/model/media/TrackModel","jquery"],function(e,t,i){var n=t.extend({model:i,allowSync:!1,url:function(){return this.media.get("key")
},initialize:function(e,t){this.server=t.server,this.section=t.section,this.media=t.media},parse:function(t){var i=this.convert(t);return e.parseBoolean(i,"allowSync"),e.parseArray(i,"Track"),this.allowSync=i.allowSync,i.identifier&&_.each(i.Track,function(e){e.identifier=i.identifier}),i.Track}});return n}),define("plex/base/model/media/PhotoModel",["plex/base/model/media/MediaModel"],function(e){var t=e.extend({parse:function(){var t=e.prototype.parse.apply(this,arguments);return t.type||(t.type="photo"),t
}});return t}),define("plex/base/model/media/collections/PhotoCollection",["plex/base/control/utils/ParseUtil","plex/base/model/collections/BaseCollection","plex/base/model/media/PhotoModel","jquery"],function(e,t,i){var n=t.extend({model:i,allowSync:!1,url:function(){return this.media.get("key")},initialize:function(e,t){this.server=t.server,this.section=t.section,this.media=t.media},parse:function(t){var i=this.convert(t),n=[];return e.parseBoolean(i,"allowSync"),this.allowSync=i.allowSync,_.compact(n.concat(i.Directory,i.Photo))
}});return n}),define("plex/base/model/ChannelModel",["plex/base/control/utils/ParseUtil","plex/base/model/BaseModel","plex/base/model/collections/ChannelActionCollection","plex/base/model/media/collections/ClipCollection","plex/base/model/media/collections/TrackCollection","plex/base/model/media/collections/PhotoCollection","jquery"],function(e,t,i,n,a,s,r){var l=t.extend({idAttribute:"key",subcollections:["Directory","Video","Track","Photo","Artist","Album","Playlist","Genre"],url:function(){return this.id?this.id:"/:/plugins/"+this.get("identifier")+"/root"
},cacheKey:function(e){var t;return e.key?t="none"===e.key?null:this.server.id+"!"+e.key:e.identifier&&(t=this.server.id+"!"+e.identifier),t},initialize:function(){this.set("actions",new i([],{server:this.server})),this.set("clips",new n([],{server:this.server,media:this})),this.set("tracks",new a([],{server:this.server,media:this})),this.set("photos",new s([],{server:this.server,media:this}))},convert:function(t){var i=_.isObject(t)?t:r.xml2json(t);return e.parseBoolean(i,["installed","noCache","allowSync"]),e.parseInteger(i,["size","lastAccessedAt"]),i
},parse:function(e){var t=this.convert(e),i=this.toJSON();if(i&&(i.key&&(t.key=i.key),i.identifier&&(t.identifier=i.identifier)),"none"===t.key&&delete t.key,_.each(this.subcollections,function(e){if(e in t){_.isArray(t[e])||(t[e]=[t[e]]);for(var i=t[e].length-1;i>=0;i--){var n=t[e][i];if(n.settings)t.settings=n.key,t[e].splice(i,1);else if(n.search)t.search=n.key,t[e].splice(i,1);else{var a=n.key.split("/");1===a.length&&(n.key=t.key+"/"+n.key),n.key&&!n.ratingKey&&(n.ratingKey=n.key),n.mediaType&&!n.type&&(n.type=n.mediaType),"Image"===n.type&&(n.type="photo"),"Movie"===n.type&&(n.type="clip"),n.label?n.title=n.label:n.track?n.title=n.track:n.album?n.title=n.album:n.artist&&(n.title=n.artist),n.totalTime&&(n.duration=n.totalTime)
}}}}),_.each(["Artist","Album","Playlist","Genre"],function(e){t[e]&&t[e].length&&(t.Directory&&t.Directory.length&&(t[e]=t[e].concat(t.Directory)),t.Directory=t[e],t[e]=null)}),t.Video&&t.Video.length&&(this.get("clips").reset(t.Video,{parse:!0}),delete t.Video),t.Track&&t.Track.length&&(this.get("tracks").reset(t.Track,{parse:!0}),delete t.Track),t.Photo&&t.Photo.length&&(this.get("photos").reset(t.Photo,{parse:!0}),delete t.Photo),t.title2?t.title=t.title2:t.title1&&(t.title=t.title1),t.key){var n=t.key.split("/");
if(n&&n.length>1){var a=t.key.split("/")[1];t.type=a.charAt(0).toUpperCase()+a.slice(1)}}return t}});return l}),define("plex/base/model/collections/ChannelCollection",["plex/base/model/collections/BaseCollection","plex/base/model/ChannelModel","jquery"],function(e,t){var i=e.extend({model:t,recent:!1,url:function(){return this.recent?"channels/recentlyViewed?X-Plex-Container-Start=0&X-Plex-Container-Size=25":"channels/all"},initialize:function(e,t){this.server=t.server,this.recent=t.recent,t.url&&(this.url=t.url),(this.recent||t.url)&&(this.comparator=null)
},parse:function(e){var t=this.convert(e),i=[];return this.viewGroup=t.viewGroup,_.compact(i.concat(t.Directory,t.Video,t.Track,t.Photo))},comparator:function(e){return e.get("title").toLowerCase()},all:function(){return this.models},videos:function(){return this.filter(function(e){return"Video"===e.get("type")})},music:function(){return this.filter(function(e){return"Music"===e.get("type")})},photos:function(){return this.filter(function(e){return"Photos"===e.get("type")})}});return i}),define("plex/base/model/PreferenceModel",["plex/base/control/utils/ParseUtil","plex/base/model/BaseModel","jquery"],function(e,t,i){var n=t.extend({idAttribute:"id",defaults:{type:"string",summary:"",label:"",group:""},whitelistedAttrs:["id","label","default","summary","value","type","group","advanced","option","hidden","enumValues","values"],url:"/:/prefs",convert:function(t){var n=_.isObject(t)?t:i.xml2json(t);
return"bool"===n.type?e.parseBoolean(n,"value"):"int"===n.type&&e.parseInteger(n,"value"),e.parseBoolean(n,["advanced","hidden"]),n},parse:function(e){var t=this.convert(e);if(t=_.pick(t,this.whitelistedAttrs),t.enumValues&&!_.isArray(t.enumValues)&&(t.enumValues=_.map(t.enumValues.split("|"),function(e){var t=e.indexOf(":");return t>0?{label:e.slice(t+1),value:e.slice(0,t)}:{label:e,value:e}})),t.values&&!_.isArray(t.values)){var i=0;t.values=_.map(t.values.split("|"),function(e){return{label:e,value:i++}
})}return t},getSaveParams:function(e){if(_.has(e,"FriendlyName")&&this.server.set("friendlyName",e.FriendlyName),_.isEmpty(e)){var t={};return t[this.get("id")]=this.get("value"),t}return"value"in e&&(e[this.get("id")]=e.value,delete e.value),e}});return n}),define("plex/base/model/collections/PreferenceCollection",["plex/base/model/collections/BaseCollection","plex/base/model/PreferenceModel","jquery"],function(e,t){var i=e.extend({model:t,url:function(){return"/:/prefs"},initialize:function(e,t){this.server=t.server,t.url&&(this.url=t.url),this.server.on("preference:change",function(e){var t=this.get(e.id);
t&&t.set("value",e.value)},this)},parse:function(e){var t=this.convert(e,"Setting");return _.filter(t,function(e){return e.id})}});return i}),define("plex/base/model/collections/PaginatedCollection",["plex/base/model/collections/BaseCollection"],function(e){var t=e.extend({pages:function(){return Math.ceil(this.length/this.pageSize)},page:function(e,t){var i,n=0;return i=t?this.length-e*this.pageSize:e*this.pageSize-this.pageSize,0>i&&(n=i,i=0),this.models.slice(i,i+this.pageSize+n)}});return t}),define("plex/base/model/ServerEventModel",["plex/base/model/BaseModel"],function(e){var t=0,i=e.extend({idAttribute:"id",parse:function(e){var i=e;
return i.time=new Date,i.id="evt"+t++,"preference"==i._type&&(i.value=""+i.value),i}});return i}),define("plex/base/model/collections/ServerEventCollection",["plex/base/model/collections/PaginatedCollection","plex/base/model/ServerEventModel"],function(e,t){var i=e.extend({model:t,initialize:function(e,t){this.server=t.server,this.pageSize=20,this.limit=1e3,this.startTime=new Date,this.server.on("preference:change",function(e){this.add(_.extend({_type:"preference"},e),{parse:!0})},this),this.server.on("timeline",function(e){1!==e.state&&this.add(_.extend({_type:"timeline"},e),{parse:!0})
},this),this.server.on("status",function(e){"ProgressNotification"!==e._elementType&&this.add(_.extend({_type:"status"},e),{parse:!0})},this),this.server.on("websocket",function(e){this.add(_.extend({_type:"websocket"},e),{parse:!0})},this),this.server.on("playing",function(e){this.add(_.extend({_type:"playing"},e),{parse:!0})},this)},add:function(){this.length+1>this.limit&&this.remove(this.at(0)),e.prototype.add.apply(this,arguments)}});return i}),define("plex/base/model/TranscodeJobModel",["plex/base/control/utils/ParseUtil","plex/base/model/BaseModel","jquery"],function(e,t,i){var n=t.extend({idAttribute:"syncItemId",whitelistedAttrs:["key","type","progress","speed","remaining","size","title","thumb","syncItemId","syncItemTitle"],convert:function(t){var n=_.isObject(t)?t:i.xml2json(t);
return e.parseInteger(n,["syncItemId","speed"]),n},parse:function(e){var t=this.convert(e);return t=_.pick(t,this.whitelistedAttrs)}});return n}),define("plex/base/model/collections/TranscodeJobCollection",["plex/base/model/collections/BaseCollection","plex/base/model/TranscodeJobModel","jquery"],function(e,t){var i=e.extend({model:t,url:function(){return"sync/transcodeQueue"},initialize:function(e,t){this.server=t.server},parse:function(e){return this.convert(e,"TranscodeJob")}});return i}),define("plex/base/model/SessionModel",["plex/base/model/media/MediaModel"],function(e){var t=e.extend({idAttribute:"sessionKey",cacheKey:function(e){return this.server.id+"!"+e[this.idAttribute]
}});return t}),define("plex/base/model/collections/SessionCollection",["plex/base/model/collections/BaseCollection","plex/base/model/SessionModel","jquery"],function(e,t){var i=e.extend({model:t,url:"/status/sessions",initialize:function(e,t){this.server=t.server},parse:function(e){return this.convert(e,"Video")}});return i}),define("plex/base/model/ServerModel",["plex/base/control/utils/ParseUtil","plex/base/control/utils/BrowserDetect","plex/base/control/mixins/ServerMixin","plex/base/model/BaseModel","plex/base/model/MyPlexAccountModel","plex/base/model/collections/SectionCollection","plex/base/model/collections/ChannelCollection","plex/base/model/collections/PreferenceCollection","plex/base/model/collections/ServerEventCollection","plex/base/model/collections/TranscodeJobCollection","plex/base/model/collections/SessionCollection","plex/base/model/media/collections/MediaCollection","jquery"],function(e,t,i,n,a,s,r,l,o,c,d,h,u){var p=n.extend(_.extend(_.clone(i),{idAttribute:"machineIdentifier",defaults:{name:"Unknown",disconnected:!1,remote:null,shared:!1,isAvailable:null,transcoderVideo:!0},whitelistedAttrs:["machineIdentifier","name","friendlyName","accessToken","shared","sourceTitle","remote","host","address","remoteAddress","localAddresses","port","remotePort","version","serverClass","platform","startState","flashInstalled","silverlightInstalled","soundflowerInstalled","transcoderAudio","transcoderVideo","transcoderVideoBitrates","transcoderVideoQualities","transcoderVideoResolutions","webkit","allowMediaDeletion","multiuser","synced"],cacheKey:function(e){return e[this.idAttribute]
},initialize:function(){this.server=this,this.set("myPlexAccount",new a({},{server:this})),this.set("onDeck",new h([],{server:this,url:"/library/onDeck"})),this.set("recentlyAdded",new h([],{server:this,url:"/library/recentlyAdded"})),this.set("sections",new s([],{server:this})),this.set("channels",new r([],{server:this})),this.set("preferences",new l([],{server:this})),this.set("timeline",new o([],{server:this})),this.set("transcodeJobs",new c([],{server:this})),this.set("sessions",new d([],{server:this})),this.get("preferences").on("reset",function(e){var t=e.get("FriendlyName"),i=e.get("allowMediaDeletion");
t!==void 0&&t.on("change:value",function(e,t){t&&this.set("name",t)},this),i!==void 0&&i.on("change:value",function(e,t){this.set("allowMediaDeletion","1"==t)},this)},this),this.on("change:machineIdentifier",this.refreshCacheKey,this),this.get("port")||"/web/index.html"===window.location.pathname||this.set("port","32400")},convert:function(t){var i=_.isObject(t)?t:u.xml2json(t);return i.sourceTitle&&(i.shared=!0),e.parseBoolean(i,["flashInstalled","silverlightInstalled","soundflowerInstalled","transcoderAudio","transcoderVideo","webkit","allowMediaDeletion","multiuser","synced"]),i.startState===void 0&&(i.startState=null),i
},parse:function(e,t){var i=this.convert(e);if(!i||!i.machineIdentifier)return{};i=_.pick(i,this.whitelistedAttrs),i.versionFull=i.version;var n=/(\d+\.){2,3}\d+/.exec(i.version);return n&&(i.version=n[0]),t&&200==t.status&&(_.defer(_.bind(function(){this.set("isAvailable",!0)},this)),this.serverUrl=this.url()),i}}));return p}),define("plex/base/model/collections/ServerCollection",["plex/base/model/collections/BaseCollection","plex/base/model/ServerModel","jquery"],function(e,t){var i=e.extend({model:t,url:"/servers",remote:null,initialize:function(e,t){t||(t={}),this.app=t.app,this.server=t.server,t.url&&(this.url=t.url),t.remote&&(this.remote=!0)
},parse:function(e){var t=this.convert(e,"Server");return _.each(t,_.bind(function(e){e.remote=this.remote,this.remote&&(e.remoteAddress=e.address,e.remotePort=e.port)},this)),t}});return i}),define("plex/base/model/GlobalSectionModel",["plex/base/model/SectionModel"],function(e){var t=e.extend({idAttribute:"uniqueKey"});return t}),define("plex/base/model/collections/GlobalSectionCollection",["plex/base/model/collections/SectionCollection","plex/base/model/GlobalSectionModel"],function(e,t){var i=e.extend({model:t,pendingRequests:0,comparator:function(e){var t=e.server,i=t.get("sourceTitle");
i||(i=t.get("friendlyName")||t.get("name"));var n=i+e.get("title");return n.toLowerCase()}});return i}),define("plex/base/model/AnnouncementModel",["plex/base/model/BaseModel"],function(e){var t=e.extend({whitelistedAttrs:["promo","timestamp","link","thumb","title","description"],parse:function(e){return _.pick(e,this.whitelistedAttrs)}});return t}),define("plex/base/model/collections/AnnouncementCollection",["plex/base/model/collections/BaseCollection","plex/base/model/AnnouncementModel"],function(e,t){var i=e.extend({model:t,url:"http://plex.r.worldssl.net/announcements/announcements.json?v=37",parse:function(e){return JSON.parse(e)
}});return i}),define("plex/base/model/AppModel",["plex/base/control/Dispatcher","plex/base/control/utils/LocalStorageUtil","plex/base/model/ConfigModel","plex/base/model/DebugInfoModel","plex/base/model/MyPlexModel","plex/base/model/ServerModel","plex/base/model/collections/ServerCollection","plex/base/model/collections/GlobalSectionCollection","plex/base/model/collections/AnnouncementCollection","jquery","backbone","xml2json"],function(e,t,i,n,a,s,r,l,o,c){var d=Backbone.Model.extend({defaults:{clientID:null,loading:!1,alert:null,view:null,modal:null,initialized:!1,isAuthorized:!1,isUnavailable:!1,isUnsupported:!1,multiServer:!1,updateStatus:"none",version:"dev"},initialize:function(){n.setAppModel(this),this.listen();
var d=c("#plex-script");if(d.length){var h=/version=([\.\w]+)$/.exec(d[0].src);h&&this.set("version",h[1])}this.on("change:initialized",function(){var t=this.get("primaryServer");t&&(t.get("isAvailable")&&e.trigger("command:CheckForUpdates",!1),setInterval(function(){e.trigger("command:CheckForUpdates",!1)},36e5))}),t.get({key:"clientID",callback:_.bind(function(e){e||(e=Math.random().toString(36).substr(2),t.set({key:"clientID",value:e})),this.set("clientID",e)},this)}),i.get("standalone")||this.set("primaryServer",new s({},{app:this})),this.set("servers",new r([],{app:this,server:this.get("primaryServer")})),this.set("clients",new r([],{url:"/clients",server:this.get("primaryServer")})),this.set("myPlex",new a({},{app:this,server:this.get("primaryServer")})),this.set("announcements",new o),this.set("myLibrary",new l([],{app:this,server:this.get("primaryServer")})),this.set("sharedLibraries",new l([],{app:this,server:this.get("primaryServer")})),this.on("change:primaryServer",this.onPrimaryServerChange)
},listen:function(){var t,i=!1,n=!1,a=!1,s=function(){i&&n&&a&&e.trigger("command:StartInit")},r=_.bind(function(){e.off("ready",r),i=!0,s()},this),l=_.bind(function(){this.off("change:clientID",l),n=!0,s()},this),o=_.bind(function(){this.off("change:myPlex",o),t=this.get("myPlex"),t.on("ready",c),t.getInfoFromStorage()},this),c=_.bind(function(){t.off("ready",c),a=!0,s()},this);e.on("ready",r),this.on("change:clientID",l),this.on("change:myPlex",o)},resetPrimaryServer:function(e){this.get("servers").server=e,this.get("clients").server=e,this.get("myPlex").server=e,this.get("myLibrary").server=e,this.get("sharedLibraries").server=e
},onPrimaryServerChange:function(e,t){t.get("isAvailable")?this.resetPrimaryServer(t):t.on("change:isAvailable",this.onPrimaryServerAvailableChange,this)},onPrimaryServerAvailableChange:function(e,t){e.off("change:isAvailable",this.onPrimaryServerAvailableChange),t&&this.resetPrimaryServer(e)}});return window.appModel=new d,window.appModel}),define("plex/base/model/media/SyncMediaModel",["plex/base/model/media/MediaModel","jquery"],function(e){var t=e.extend({idAttribute:"key",cacheKey:function(e){return this.server.id+"!"+e.key+"!"+e.syncItemId
},initialize:function(e,t){t.server&&(this.server=t.server)}});return t}),define("plex/base/control/ServerNotificationStream",["plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/control/utils/StringUtil","plex/base/model/AppModel","plex/base/model/ConfigModel","plex/base/model/SectionModel","plex/base/model/SessionModel","plex/base/model/media/MediaModel","plex/base/model/media/SyncMediaModel"],function(e,t,i,n,a,s,r,l,o){var c={},d=function(a){var d=a.resolveUrl("/:/websockets/notifications").replace(/^http/,"ws");
a.get("accessToken")&&(d+="?X-Plex-Token="+encodeURIComponent(a.get("accessToken"))),this.server=a,this.socket=new WebSocket(d),this.socket.onclose=_.bind(function(){a.set("disconnected",!0),e.trigger("show:status",a,"Connection to "+a.get("name")+" closed"),a.trigger("websocket",{closed:!0}),delete c[a.id]},this),this.socket.onopen=_.bind(function(){a.set("disconnected",!1),a.trigger("websocket",{opened:!0})},this),this.socket.onerror=_.bind(function(){a.set("disconnected",!1),e.trigger("show:status",a,"Unable to receive notifications from "+a.get("name")),a.trigger("websocket",{error:!0})
},this),this.socket.onmessage=_.bind(function(a){var c;try{c=JSON.parse(a.data)}catch(d){return}switch(c.type){case"preference":_.each(c._children,function(t){t.key=t.id,t.server=this.server,this.server.trigger("preference:change",t),e.trigger("preference:change",t)},this);break;case"timeline":_.each(c._children,function(t){t.server=this.server;var i={server:this.server,onlyIfCached:!0},n=new s({key:t.sectionID},i);if(!_.isEmpty(n)){t.section=i.section=n;var a=new l({ratingKey:t.itemID},i);if(_.isEmpty(a)||(a.set({metadataState:t.metadataState,mediaState:t.mediaState}),t.media=a,a.trigger("timeline",t),a.release()),t.rootItemID){var r=new l({ratingKey:t.rootItemID},i);
_.isEmpty(r)||(r.fetch({hideLoadingAlert:!0}),r.release())}if(t.parentItemID){var o=new l({ratingKey:t.parentItemID},i);_.isEmpty(o)||(o.fetch({hideLoadingAlert:!0}),o.release())}n.trigger("timeline",t)}t.server.trigger("timeline",t),e.trigger("timeline",t)},this);break;case"status":_.each(c._children,function(t){var i=t.title+(t.description?": "+t.description:"");e.trigger("show:status",this.server,i),this.server.trigger("status",t),"LIBRARY_UPDATE"===t.notificationName&&this.server.get("sections").fetch({hideLoadingAlert:!0})
},this);break;case"progress":_.each(c._children,function(t){e.trigger("show:status",this.server,t.message),this.server.trigger("status",t)},this);break;case"playing":_.each(c._children,function(a){if(a.sessionKey){var s={server:this.server,onlyIfCached:!0},l=new r({sessionKey:a.sessionKey},s);if(_.isEmpty(l)){var o=this.server.get("sessions");o.fetch({hideLoadingAlert:!0}).done(function(){if(l=o.get(a.sessionKey)){var s=n.get("myPlex"),r=l.get("User"),c=l.get("Player"),d=i.truncate(r.title,20),h=i.truncate(l.get("grandparentTitle"),20),u=i.truncate(l.get("title"),40),p=i.truncate(c.title,20);
h&&(u=h+" - "+u);var f=t.t("{1} started watching {2} on {3}.",d,u,p);r.title&&r.title!==s.get("username")&&e.trigger("show:status",this.server,f),this.server.trigger("playing",_.extend(a,{username:d,title:u,device:p}))}})}else{if("stopped"===a.state)return l.trigger("destroy",l,l.collection),void 0;var c=l.get("Player");c&&(c.state=a.state,l.trigger("change:Player",l,c)),l.set("viewOffset",a.viewOffset)}}},this);break;case"syncState":_.each(c._children,function(e){if(e.syncItemId&&e.key){var t={server:this.server,onlyIfCached:!0},i=new o({key:e.key,syncItemId:e.syncItemId},t);
if(!_.isEmpty(i)){var n=i.get("Media");_.each(n,function(t){var n=t.Part;_.each(n,function(t){t.transcodeState=e.syncFileState,t.transcodeStateContext=e.syncFileStateContext;var n=/^(transcoded|downloaded|directplay)$/;n.test(e.syncFileState)&&(t.key="placeholder"),i.trigger("change:Media",i,i.get("Media"))})})}}},this)}},this)},h=function(e){a.get("websocket")&&!e.get("shared")&&"secondary"!==e.get("serverClass")&&e.get("isAvailable")&&(e.id in c&&(c[e.id].socket.onclose=null,c[e.id].socket.close()),window.WebSocket?c[e.id]=new d(e):e.trigger("websocket",{error:!0}))
};n.get("servers").on("add",h),n.get("servers").on("change:isAvailable",h),n.get("servers").on("reset",function(e){e.each(h)}),e.on("connect:websocket",function(e){e.id in c||e.get("synced")||h(e)}),e.on("timeline",function(t){var i=t.section?t.section.get("title"):"section "+t.sectionID,n=t.title||"item "+t.itemID,a="";switch(t.state){case 0:a="Created";break;case 2:a="Matching";break;case 3:a="Downloading metadata for";break;case 4:a="Loading metadata for";break;case 5:a="Finished processing";break;
case 6:a="Analyzing";break;case 9:a="Deleted"}a&&e.trigger("show:status",t.server,a+" "+n+" in "+i+" on "+t.server.get("name"))})}),!function(e){e(function(){e.support.transition=function(){var e=function(){var e,t=document.createElement("bootstrap"),i={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(e in i)if(void 0!==t.style[e])return i[e]}();return e&&{end:e}}()})}(window.jQuery),define("transition",function(){}),!function(e){function t(){var t=this,n=setTimeout(function(){t.$element.off(e.support.transition.end),i.call(t)
},500);this.$element.one(e.support.transition.end,function(){clearTimeout(n),i.call(t)})}function i(){this.$element.hide().trigger("hidden"),n.call(this)}function n(t){var i=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var n=e.support.transition&&i;this.$backdrop=e('<div class="modal-backdrop '+i+'" />').appendTo(document.body),"static"!=this.options.backdrop&&this.$backdrop.click(e.proxy(this.hide,this)),n&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),n?this.$backdrop.one(e.support.transition.end,t):t()
}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),e.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(e.support.transition.end,e.proxy(a,this)):a.call(this)):t&&t()}function a(){this.$backdrop.remove(),this.$backdrop=null}function s(){var t=this;this.isShown&&this.options.keyboard?e(document).on("keyup.dismiss.modal",function(e){27==e.which&&t.hide()}):this.isShown||e(document).off("keyup.dismiss.modal")}var r=function(t,i){this.options=i,this.$element=e(t).delegate('[data-dismiss="modal"]',"click.dismiss.modal",e.proxy(this.hide,this))
};r.prototype={constructor:r,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var t=this,i=e.Event("show");this.$element.trigger(i),this.isShown||i.isDefaultPrevented()||(e("body").addClass("modal-open"),this.isShown=!0,s.call(this),n.call(this,function(){var i=e.support.transition&&t.$element.hasClass("fade");t.$element.parent().length||t.$element.appendTo(document.body),t.$element.show(),i&&t.$element[0].offsetWidth,t.$element.addClass("in"),i?t.$element.one(e.support.transition.end,function(){t.$element.trigger("shown")
}):t.$element.trigger("shown")}))},hide:function(n){n&&n.preventDefault(),n=e.Event("hide"),this.$element.trigger(n),this.isShown&&!n.isDefaultPrevented()&&(this.isShown=!1,e("body").removeClass("modal-open"),s.call(this),this.$element.removeClass("in"),e.support.transition&&this.$element.hasClass("fade")?t.call(this):i.call(this))}},e.fn.modal=function(t){return this.each(function(){var i=e(this),n=i.data("modal"),a=e.extend({},e.fn.modal.defaults,i.data(),"object"==typeof t&&t);n||i.data("modal",n=new r(this,a)),"string"==typeof t?n[t]():a.show&&n.show()
})},e.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},e.fn.modal.Constructor=r,e(function(){e("body").on("click.modal.data-api",'[data-toggle="modal"]',function(t){var i,n=e(this),a=e(n.attr("data-target")||(i=n.attr("href"))&&i.replace(/.*(?=#[^\s]+$)/,"")),s=a.data("modal")?"toggle":e.extend({},a.data(),n.data());t.preventDefault(),a.modal(s)})})}(window.jQuery),define("modal",function(){}),define("plex/base/control/init/BaseInit",["plex/base/control/init/jQueryInit","plex/base/control/init/BackboneInit","plex/base/control/init/HandlebarsInit","plex/base/control/init/SoundManagerInit","plex/base/control/ServerNotificationStream","transition","modal"],function(){}),define("plex/base/control/commands/init/StartInitCommand",["plex/base/control/Dispatcher","plex/base/model/AppModel","plex/base/model/ConfigModel","plex/base/model/collections/ServerCollection"],function(e,t,i,n){function a(a){function s(t){e.trigger("command:FinishInit",p,t)
}function r(t){e.trigger("command:GetAllServers",s,t)}function l(t){e.trigger("command:GetPrimaryServer",r,t)}a=a||{};var o=a.silent,c=a.noRedirect,d=t.get("myPlex"),h=new n([],{app:t,remote:!0});h.url=d.resolveUrl("/pms/servers");var u={silent:o,standalone:i.get("standalone"),requireToken:!1,remoteServers:h};if(t.set({isUnsupported:!1,isUnavailable:!1,isAuthorized:!1}),d.set("isUnavailable",!1),o||e.trigger("command:ShowLoading",!0),!window.JSON||!window.JSON.parse)return t.set("isUnsupported",!0),e.trigger("command:FinishInit"),void 0;
var p=function(){o||e.trigger("command:ShowLoading",!1),t.get("initialized")&&!c?e.trigger("navigate:dashboard"):t.set("initialized",!0),a.success&&a.success()};e.trigger("command:GetMyPlex",l,u)}e.on("command:StartInit",a)}),define("plex/base/control/commands/init/GetMyPlexCommand",["plex/base/control/Dispatcher","plex/base/model/AppModel"],function(e,t){function i(e,i){var n=t.get("primaryServer"),a=t.get("myPlex");if(i.standalone)return i.requireToken=!0,i.myPlexDeferred=a.fetch(),e(i),void 0;
var s=n.fetch({hideLoadingAlert:!0}).pipe(function(){return a.fetch()},function(){return i.requireToken=!0,a.fetch()});i.myPlexDeferred=s,e(i)}e.on("command:GetMyPlex",i)}),define("plex/base/control/commands/init/GetPrimaryServerCommand",["plex/base/control/Dispatcher","plex/base/model/AppModel","jquery"],function(e,t,i){function n(e,n){var a=t.get("primaryServer"),s=t.get("myPlex"),r=t.get("servers"),l={hideLoadingAlert:!0},o=n.myPlexDeferred.pipe(function(){var e=s.get("authToken");if(n.requireToken){if(e){if(n.standalone)return n.remoteServers.fetch(l);
var t=n.remoteServers.fetch(l).pipe(function(){return i.ajax(a.getAjaxOptions("/identity"))}),o=t.pipe(function(e){var t=i.xml2json(e)||e,r=s.get("authToken"),o=n.remoteServers.get(t.machineIdentifier);if(o){var c=o.get("accessToken");c&&(r=c)}return a.set("accessToken",r),a.fetch(l)},function(){var e=s.get("authToken"),t=n.remoteServers.where({address:window.location.hostname,port:window.location.port});if(t&&t.length){var i=t[0].get("accessToken");i&&(e=i)}return a.set("accessToken",e),a.fetch(l)
});return o.pipe(function(){var e=n.remoteServers.get(a.id);return e&&e.get("shared")?(a.set("shared",!0),void 0):r.fetch(l)})}return i.Deferred().reject()}return e?n.remoteServers.fetch(l).pipe(function(){return r.fetch(l)},function(){return r.fetch(l)}):r.fetch(l)},function(e){if(n.requireToken){if(422!==e.status){var a=[500,502,503,504];"abort"===e.statusText||_.indexOf(a,e.status)>-1?s.set("isUnavailable",!0):t.set("isUnsupported",!0)}return i.Deferred().reject()}return r.fetch(l)});n.primaryServerDeferred=o,e(n)
}e.on("command:GetPrimaryServer",n)}),define("plex/base/control/commands/init/GetAllServersCommand",["plex/base/control/Dispatcher","plex/base/control/utils/LogUtil","plex/base/model/AppModel"],function(e,t,i){function n(n,a){var s=i.get("myPlex"),r=i.get("servers");a.primaryServerDeferred.always(function(){var l=[],o=i.get("primaryServer"),c=[];if(o&&r.add(o),i.set("multiServer",!1),r.populatePromise&&"rejected"!==r.populatePromise.state()||(r.populatePromise=a.remoteServers.populatePromise),a.remoteServers.length){var d=a.remoteServers.reject(function(e){var t=r.get(e.id);
return a.standalone&&(e.get("shared")?c.push(e):e.get("synced")||c.unshift(e)),e.get("accessToken")||e.set("accessToken",s.get("authToken")),t});c&&c.length&&i.set("primaryServer",c[0]),r.add(d)}e.trigger("command:GetAllSections"),r.each(function(n){if(n.get("synced"))n.set({isAvailable:!0,serverClass:"secondary"});else{var a=function(){n.get("shared")||(-1===_.indexOf(l,n)&&l.push(n),l.length>1&&i.set("multiServer",!0))},s=function(e){if(/\/\/(localhost|127.0.0.1)/.test(e))return!1;var i,a=n.get("remoteAddress"),s=n.get("remotePort");
if(a&&s&&(i=n.buildUrl({address:a,port:s})),e===i)return t.log("--- remote url matches: "+i),!0;var r=n.get("localAddresses");if(r){r=r.split(",");for(var l=0,o=r.length;o>l;l++){var c=n.buildUrl({address:r[l],port:32400});if(e===c)return t.log("--- local url matches: "+c),!1}}var d,h=n.get("address"),u=n.get("port");return h&&u&&(d=n.buildUrl({address:h,port:u})),d&&e!==d?(t.log("--- default url does not match: "+d),!0):!1},r=function(e,i){s(i)?n.set("remote",!0):n.set("remote",!1),n.get("remote")?t.log("!!! remote server ("+e+") found: "+i):t.log("!!! local server ("+e+") found: "+i),n.serverUrl=i
},o=function(e,t){var i=t.sourceTitle;i||(i=t.friendlyName),i||(i=t.name),n.set(t),n.set("isAvailable",!0),a(),r(i,e)},d=function(e,i){if(!n.get("isAvailable"))return o(e,i),void 0;var s=i.sourceTitle;return s||(s=i.friendlyName),s||(s=i.name),a(),n.get("remote")===!1?(t.log("!!! local server ("+s+") found again: "+e),void 0):(r(s,e),void 0)},h=function(){if(n.set("isAvailable",!1),i.get("primaryServer")===n){var t=_.indexOf(c,n);t>-1&&c.splice(t,1);for(var a=0,s=c.length;s>a;a++){var r=c[a];if(r.get("isAvailable")!==!1)return i.set("primaryServer",r),void 0
}i.set("isAuthorized",!1),e.trigger("navigate:login")}},u=function(e){e.progress(d).fail(h)};e.trigger("command:TestServerConnection",n,u)}}),r.length&&i.set("isAuthorized",!0),n(a)})}e.on("command:GetAllServers",n)}),define("plex/base/control/commands/init/GetAllSectionsCommand",["plex/base/control/Dispatcher","plex/base/control/utils/LogUtil","plex/base/model/AppModel","plex/base/model/GlobalSectionModel","jquery"],function(e,t,i,n,a){function s(e){var t=i.get("servers"),n=e.get("shared")?f:p,a=e.get("isAvailable");
if(a===!0)n.pendingRequests++,e.get("sections").fetch({hideLoadingAlert:!0}).always(function(){_.defer(function(){n.pendingRequests--,o(n)})});else if(a===!1){var s=t.where({isAvailable:null,shared:e.get("shared")});s.length||"pending"!==n.populatePromise.state()||o(n)}}function r(e){var t=e.toJSON();return t.uniqueKey=e.server.id+"!"+t.key,new n(t,{server:e.server})}function l(e){var t=e.server,i=t.get("shared")?f:p,n=[];e.each(function(e){n.push(r(e))}),i.add(n)}function o(e){e.pendingRequests>0||(e.length?e.populatePromise.resolve(e):e.populatePromise.reject())
}function c(e){var t=e.server,i=t.get("shared")?f:p,n=i.populatePromise;i.add(r(e)),n&&"rejected"!==n.state()||(i.populatePromise=a.Deferred().resolve())}function d(e,t){var i=_.keys(t.changes);if(i&&i.length){var n=e.server,a=n.get("shared")?f:p,s=a.where({uniqueKey:n.id+"!"+e.id});if(s&&s.length){var r=s[0];_.each(i,function(t){r.set(t,e.get(t))})}}}function h(e){var t=e.server,i=t.get("shared")?f:p,n=i.where({uniqueKey:t.id+"!"+e.id});if(n&&n.length){var a=n[0];a.trigger("destroy",a,i)}}function u(){var e=i.get("servers");
p.pendingRequests=0,p.populatePromise=a.Deferred(),f.pendingRequests=0,f.populatePromise=a.Deferred(),e.each(function(e){var t=e.get("sections");e.on("change:isAvailable",s),t.on("reset",l),t.on("add",c),t.on("change",d),t.on("remove",h),s(e)})}var p=i.get("myLibrary"),f=i.get("sharedLibraries");e.on("command:GetAllSections",u)}),define("plex/base/control/commands/init/TestServerConnectionCommand",["plex/base/control/Dispatcher","plex/base/control/utils/LogUtil","jquery"],function(e,t,i){function n(e,n){function a(e,t){c=!0,l.notify(e,t)
}function s(e){delete o[e],!c&&i.isEmptyObject(o)&&l.reject()}function r(n){t.log("requesting "+n),o[n]=i.ajax({type:"GET",url:n,headers:e.getHeaders(),timeout:1e4,dataType:"text",success:function(t){var r=e.parse(t);i.isEmptyObject(r)?s(n):e.id!==r.machineIdentifier?s(n):a(n,r)},error:function(){s(n)}})}var l=i.Deferred(),o={},c=!1,d=e.get("address"),h=e.get("port"),u=e.get("remoteAddress"),p=e.get("remotePort"),f=e.get("localAddresses");t.log("### testing connection"),d&&t.log("address: "+d+":"+h),u&&t.log("remote address: "+u+":"+p),f&&t.log("local addresses: "+f);
var m=[e.url()];if(d&&h){var g=e.buildUrl({address:d,port:h});-1===_.indexOf(m,g)&&m.push(g)}if(u&&p){var v=e.buildUrl({address:u,port:p});-1===_.indexOf(m,v)&&m.push(v)}f&&(f=f.split(","),_.each(f,function(t){var i=e.buildUrl({address:t,port:32400});-1===_.indexOf(m,i)&&m.push(i)})),_.each(m,function(e){r(e)}),n(l.promise())}e.on("command:TestServerConnection",n)}),define("hb!templates/desktop/modals/AgreementModal.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};
var s,r,l="",o=i.helperMissing,c=this.escapeExpression;return l+='<div class="modal-header">\n	<h3><i class="glyphicon notes"></i> ',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"End User License Agreement",r):o.call(t,"t","End User License Agreement",r)))+'</h3>\n</div>\n\n<div class="modal-body minimal-scrollbar">\n	',r={hash:{},data:a},l+=c((s=i.partial||t.partial,s?s.call(t,"EULA",r):o.call(t,"partial","EULA",r)))+'\n</div>\n\n<div class="modal-footer">\n	<button type="button" class="btn btn-primary agree-btn">',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Agree",r):o.call(t,"t","Agree",r)))+"</button>\n</div>\n"
})}),define("plex/base/control/utils/FocusManager",["plex/base/model/ConfigModel"],function(e){var t=function(){this._views=[],this.registerView=function(e){var t=_.indexOf(this._views,e);return 0>t&&this._views.push(e),this._views=_.sortBy(this._views,function(e){var t=e.focusOptions.position;return _.isNumber(t)?t:9999}),e},this.removeView=function(e){var t=_.indexOf(this._views,e);return t>-1&&this._views.splice(t,1),e},this.navigate=function(e){if(this._views.length){for(var t=this._views.length,i=-1,n=[],a=t-1;a>-1;a--){var s=this._views[a],r=s.focusOptions.activationDirection;
if(s.focused&&(i=a,s.focusView(e)))return;e===r&&n.push(s)}for(var l=0,o=n.length;o>l;l++)if(n[l].focusView(e,!0))return;if("up"===e||"left"===e)for(;--i>-1;){var c=this._views[i];if(c.focusView(e,!0))return}else for(;t>++i;){var d=this._views[i];if(d.focusView(e,!0))return}}},this.autoFocus=function(t){if(!t&&e.get("autofocus"))for(var i=this._views.length-1;i>-1;i--){var n=this._views[i];if(n.focused)return n.autoFocusEnabled=!0,void 0}},this.resetFocus=function(){for(var e=0,t=this._views.length;t>e;e++){var i=this._views[e];
if(i.focused)return i.$focusedItem&&i.$focusedItem.blur(),i.resetFocus(),void 0}}};return new t}),define("plex/base/control/mixins/FocusMixin",["plex/base/control/utils/FocusManager"],function(e){var t={focused:!1,$focusedItem:null,focusSelector:'[data-focus="keyboard"]',_focusSelector:null,autoFocusEnabled:!1,focusOptions:{defaultElement:null,position:null,container:null,bindings:null,activationDirection:null,cancellationDirections:null,navigationPaths:null},preinitialize:function(t){t&&_.isBoolean(t.focused)&&(this.focused=t.focused),e.registerView(this),_.bindAll(this,"resetFocus")
},postinitialize:function(){var e=this.focusOptions.container;if(this._focusSelector=this.focusSelector,e){_.isArray(e)||(e=[e]);var t=[];_.each(e,_.bind(function(e){t.push(e+" "+this.focusSelector)},this)),this._focusSelector=t.join(", ")}this.$el.on("blur",this._focusSelector,this.resetFocus)},postrender:function(){this.autoFocusEnabled&&this.focusView()},activateFocus:function(){e.registerView(this)},deactivateFocus:function(){e.removeView(this)},focusElement:function(e){return e.hasClass("input-focusable")&&e.addClass("keyboard-focus"),e.focus()
},focusView:function(e){this.autoFocusEnabled=!1;var t=this.focusOptions.bindings;if(e&&t){var i=_.keys(t);if(_.indexOf(i,e)>-1){var n=t[e],a=this.$(n);if(a.length)return this.focused=!0,this.$focusedItem=this.focusElement(a),!0}}var s=this.getFocusableItems();if(!s.length)return!1;if(!e||!this.focused){var r=this.focusFirstElement(s);return r?(this.focused=!0,this.$focusedItem=r,!0):!1}var l=this.focusOptions.cancellationDirections;if(l){if(e===l)return!1;if(_.isArray(l)){if(_.indexOf(l,e)>-1)return!1
}else if(_.isObject(l))for(var o=_.keys(l),c=0,d=o.length;d>c;c++){var h=o[c];if(e===h){var u=l[h];if(this.$focusedItem.is(u))return!1;break}}}var p=this.focusOptions.navigationPaths;if(p&&_.isObject(p))for(var f=_.keys(p),m=0,g=f.length;g>m;m++){var v=f[m];if(this.$focusedItem.is(v)){for(var y=p[v],b=_.keys(y),w=0,x=b.length;x>w;w++){var k=b[w];if(e===k){var S=this.$(y[e]);if(S=this.focusFirstElement(S))return this.focused=!0,this.$focusedItem=S,!0;break}}break}}if("down"===e||"right"===e){var C=this.focusNextElement(s,e);
return C?(this.focused=!0,this.$focusedItem=C,!0):!1}if("up"===e||"left"===e){var A=this.focusPreviousElement(s,e);return A?(this.focused=!0,this.$focusedItem=A,!0):!1}return!1},getFocusableItems:function(){var e,t=this._focusSelector.split(", "),i=[];return _.each(t,function(e){i.push(e+":visible")}),e=i.join(", "),this.$(e)},focusFirstElement:function(e){if(this.$focusedItem&&e.index(this.$focusedItem)>-1)return this.focusElement(this.$focusedItem);var t=this.focusOptions.defaultElement;if(t){var i=this.$(t);
if(i.length)return this.focusElement(i.first())}return this.focusElement(e.first())},focusNextElement:function(e,t){var i=this.getNextFocusableIndex(e,t);return i>0&&e.length>i?this.focusElement(e.eq(i)):this.modal?this.focusElement(e.first()):void 0},focusPreviousElement:function(e,t){var i=this.getPreviousFocusableIndex(e,t);return i>-1?this.focusElement(e.eq(i)):this.modal?this.focusElement(e.last()):void 0},getNextFocusableIndex:function(e){return e.index(this.$focusedItem)+1},getPreviousFocusableIndex:function(e){return e.index(this.$focusedItem)-1
},autoFocus:function(){e.autoFocus()},refocus:function(){this.autoFocus(),this.autoFocusEnabled&&this.focusView()},resetGlobalFocus:function(){e.resetFocus()},resetFocus:function(){this.focused=!1},destroy:function(){this.$el.off("blur",this._focusSelector,this.resetFocus)}};return t}),define("plex/base/view/BaseView",["plex/base/control/init/HandlebarsInit","backbone"],function(){var e=Backbone.View.extend({constructor:function(e){this._views=[],this._bindings=[],_.isFunction(this.postrender)&&(this.render=_.wrap(this.render,_.bind(function(e){var t=e.apply(this,_.toArray(arguments).slice(1));
return _.defer(_.bind(function(){this.postrender()},this)),t},this))),_.isFunction(this.preinitialize)&&this.preinitialize(e),Backbone.View.call(this,e),_.isFunction(this.postinitialize)&&this.postinitialize(e)},registerView:function(t){if(t instanceof e!=!0)throw"Only views that extend BaseView can be registered.";return this._views.push(t),t},removeView:function(e){var t=_.indexOf(this._views,e);return e.destroy(),t>-1&&this._views.splice(t,1),e},removeAllViews:function(){for(var e=this._views.length-1;e>=0;e--)this.removeView(this._views[e])
},addBinding:function(e,t,i){i=_.bind(i,this),e.on(t,i,this),this._bindings.push({target:e,event:t,callback:i})},removeBinding:function(e,t){for(var i=this._bindings.length;i--;){var n=this._bindings[i];n.target===e&&n.event===t&&(e.off(t,n.callback),this._bindings.splice(i,1))}},removeAllBindings:function(){_.each(this._bindings,function(e){e.target.off(e.event,e.callback)}),this._bindings.length=0},bindView:function(){this.bindings&&_.each(_.keys(this.bindings),_.bind(function(e){var t=this.bindings[e],i=_.bind(function(i,n){var a=this.$(e);
t.format&&(n=t.format.call(this,a,n),void 0===n)||(t.hideEmpty&&(n?a.removeClass("hide"):a.addClass("hide")),a.html(n))},this);i(this.model,this.model.get(t.modelAttr)),this.addBinding(this.model,"change:"+t.modelAttr,i)},this))},refresh:function(e){return this.removeAllViews(),this.removeAllBindings(),this.initialize(e),this.render(),this},destroy:function(){return this.undelegateEvents(),this.removeAllBindings(),this.removeAllViews(),this.remove(),this}});return e}),define("plex/base/view/FocusView",["plex/base/control/utils/FocusManager","plex/base/control/mixins/FocusMixin","plex/base/view/BaseView"],function(e,t,i){var n=i.extend(_.extend(_.clone(t),{destroy:function(){e.removeView(this),t.destroy.call(this),i.prototype.destroy.call(this)
}}));return n}),define("plex/base/view/modals/BaseModal",["plex/base/control/Dispatcher","plex/base/model/ConfigModel","plex/base/view/FocusView"],function(e,t,i){var n=i.extend({modal:!0,focused:!0,focusOptions:{defaultElement:".btn-primary"},preinitialize:function(){this.addBinding(e,"shortcut:escape",function(){}),i.prototype.preinitialize.call(this)},postinitialize:function(){this.$el.on("mousedown","a",this.onLinkMouseDown),t.get("animations")||this.$el.removeClass("fade"),i.prototype.postinitialize.call(this)
},destroy:function(){this.$el.off("mousedown","a",this.onLinkMouseDown),i.prototype.destroy.call(this)},close:function(){e.trigger("destroy:modal",this)},onLinkMouseDown:function(e){e.preventDefault()}});return n}),define("plex/desktop/view/modals/AgreementModal",["hb!templates/desktop/modals/AgreementModal.tpl","plex/base/control/Dispatcher","plex/base/view/modals/BaseModal"],function(e,t,i){var n=i.extend({name:"agreementModal",className:"modal agreement-modal fade",events:{hidden:"close","click .agree-btn":"onAgreeClick"},render:function(){return this.$el.html(e()).modal({backdrop:"static",keyboard:!1}),this
},onAgreeClick:function(e){e.preventDefault(),this.collection.first().save({AcceptedEULA:!0}),this.$el.modal("hide"),t.trigger("navigate:setup")}});return n}),define("plex/base/control/commands/init/FinishInitCommand",["plex/base/control/Dispatcher","plex/base/model/AppModel","plex/desktop/view/modals/AgreementModal"],function(e,t,i){function n(e,n){function a(){var e=r.get("shared");if(!e||e&&r.supports("sharedPreferences")){var a,s=r.get("preferences");a=s.populatePromise&&"resolved"===s.populatePromise.state()?s.populate(o):s.fetch(o),a.done(function(){if(!e&&!n.standalone){var a=s.get("AcceptedEULA");
a!==void 0&&a.get("value")===!1&&t.set("modal",new i({collection:s}))}if("undefined"!=typeof _gamanager){var r=s.get("collectUsageData");r!==void 0&&r.get("value")===!0?_gamanager.enable():_gamanager.disable()}})}}function s(){l.get("signedIn")&&(l.get("friends").fetch(o),l.get("friendRequests").fetch(o),l.get("socialNetworks").fetch(o),l.get("devices").fetch(o)),e()}var r=t.get("primaryServer"),l=t.get("myPlex"),o={hideLoadingAlert:!0};return r?(a(),s(),void 0):(s(),void 0)}e.on("command:FinishInit",n)
}),define("plex/base/control/commands/ShowLoadingCommand",["plex/base/control/Dispatcher","plex/base/model/AppModel"],function(e,t){function i(e){0>n&&(n=0),e===!0?(0===n&&t.set({loading:!0}),n++):(n--,0===n&&t.set({loading:!1}))}var n=0;e.on("command:ShowLoading",i)}),define("plex/base/control/commands/SignOutCommand",["plex/base/control/Dispatcher","plex/base/control/utils/LocalStorageUtil"],function(e,t){function i(){t.clear({session:!0}),t.remove({key:"myPlexAuthToken"}),n?chrome.runtime.reload():window.location.reload(!0)
}var n="object"==typeof chrome&&chrome.runtime;e.on("command:SignOut",i)}),define("plex/base/control/commands/myplex/SignInCommand",["plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel","jquery","xml2json"],function(e,t,i){function n(n){i.get("myPlex").signIn(n.username,n.password,n.rememberMe).done(function(){e.trigger("command:StartInit",n)}).fail(function(e){var a=t.t("There was a problem signing in to myPlex.");401===e.status&&(a=t.t("The username or password is incorrect.")),i.set("alert",{status:"error",message:a}),n.error&&n.error()
})}e.on("command:SignIn",n)}),define("plex/base/control/commands/myplex/ShareCommand",["plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel","jquery"],function(e,t,i,n){function a(a,s,r,l,o){var c=i.get("myPlex"),d=a.get("url");if(!d)return i.set("alert",{status:"error",message:t.t("This media item does not have a valid url.")}),void 0;var h=[],u={url:d,message:r};e.trigger("command:ShowLoading",!0),_.each(s,function(e){var t="/pms/social/networks/"+e+"/share?"+n.param(u),i=_.extend({type:"POST"},c.getAjaxOptions(t));
h.push(n.ajax(i))}),n.when.apply(n,h).always(function(){e.trigger("command:ShowLoading",!1)}).done(l).fail(function(){o(),i.set("alert",{status:"error",message:t.t("There was a problem sharing this media item.")})})}e.on("command:Share",a)}),define("plex/base/control/commands/myplex/RecommendCommand",["plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel","jquery"],function(e,t,i,n){function a(a,s,r,l,o){var c=i.get("myPlex"),d=a.get("url");if(!d)return o(),i.set("alert",{status:"error",message:t.t("This media item does not have a valid url.")}),void 0;
var h=[],u={url:d,message:r};e.trigger("command:ShowLoading",!0),_.each(s,function(e){var t="/pms/playlists/"+e+"/items?"+n.param(u),i=_.extend({type:"POST"},c.getAjaxOptions(t));h.push(n.ajax(i))}),n.when.apply(n,h).always(function(){e.trigger("command:ShowLoading",!1)}).done(l).fail(function(){o(),i.set("alert",{status:"error",message:t.t("There was a problem recommending this media item.")})})}e.on("command:Recommend",a)}),define("plex/base/control/commands/media/RefreshMetadataCommand",["plex/base/control/Dispatcher","jquery"],function(e,t){function i(e){var i="/library/metadata/"+e.get("ratingKey")+"/refresh",n=_.extend({type:"PUT"},e.server.getAjaxOptions(i));
t.ajax(n)}e.on("command:RefreshMetadata",i)}),define("hb!templates/desktop/modals/ConfirmModal.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var s,r,l="",o="function",c=this.escapeExpression,d=i.helperMissing;return l+='<div class="modal-header">\n	<button type="button" class="close" data-dismiss="modal"><i class="glyphicon remove-2"></i></button>\n	<h3><i class="glyphicon circle-exclamation-mark"></i> ',(s=i.title)?s=s.call(t,{hash:{},data:a}):(s=t.title,s=typeof s===o?s.apply(t):s),l+=c(s)+'</h3>\n</div>\n\n<div class="modal-body minimal-scrollbar">',(s=i.message)?s=s.call(t,{hash:{},data:a}):(s=t.message,s=typeof s===o?s.apply(t):s),l+=c(s)+'</div>\n\n<div class="modal-footer pull-center">\n	<button type="button" class="btn btn-large btn-primary yes-btn" data-focus="keyboard">',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Yes",r):d.call(t,"t","Yes",r)))+'</button>\n	<button type="button" class="btn btn-large no-btn" data-focus="keyboard">',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"No",r):d.call(t,"t","No",r)))+"</button>\n</div>\n"
})}),define("plex/desktop/view/modals/ConfirmModal",["hb!templates/desktop/modals/ConfirmModal.tpl","plex/base/view/modals/BaseModal"],function(e,t){var i=t.extend({className:"modal modal-small confirm-modal fade",title:null,message:null,events:{hidden:"close","click .no-btn":"onNo","click .yes-btn":"onYes"},initialize:function(e){this.title=e.title,this.message=e.message},render:function(){return this.$el.html(e({title:this.title,message:this.message})).modal(),this},onNo:function(e){e.preventDefault(),this.trigger("no"),this.$el.modal("hide")
},onYes:function(e){e.preventDefault(),this.trigger("yes"),this.$el.modal("hide")}});return i}),define("plex/base/control/commands/media/MarkWatchedCommand",["plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel","plex/desktop/view/modals/ConfirmModal","jquery"],function(e,t,i,n,a){function s(s,r){var l=s.get("type"),o="/:/scrobble?key="+s.get("ratingKey")+"&identifier="+s.get("identifier"),c=function(){e.trigger("command:ShowLoading",!0),a.ajax(s.server.getAjaxOptions(o)).always(function(){e.trigger("command:ShowLoading",!1)
}).done(function(){if("show"===l||"season"===l)if(s.set("unviewedLeafCount",0),s.set("viewedLeafCount",s.get("leafCount")),"show"===l){var e=s.get("seasons");e.each(function(e){e.set("unviewedLeafCount",0),e.set("viewedLeafCount",e.get("leafCount"))})}else{var t=s.get("episodes");t.each(function(e){e.set("viewOffset",0),e.set("viewCount",1)})}else s.set("viewOffset",0),s.set("viewCount",1)}).fail(function(){i.set("alert",{status:"error",message:t.t("There was a problem marking {1} as watched.",s.get("title"))})
})};if(r||"show"!==l&&"season"!==l)c();else{var d=new n({title:t.t("Mark as Watched"),message:t.t("Are you sure you want to mark all episodes as watched?")});d.on("yes",c),i.set("modal",d)}}e.on("command:MarkWatched",s)}),define("plex/base/control/commands/media/MarkUnwatchedCommand",["plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel","plex/desktop/view/modals/ConfirmModal","jquery"],function(e,t,i,n,a){function s(s,r){var l=s.get("type"),o="/:/unscrobble?key="+s.get("ratingKey")+"&identifier="+s.get("identifier"),c=function(){e.trigger("command:ShowLoading",!0),a.ajax(s.server.getAjaxOptions(o)).always(function(){e.trigger("command:ShowLoading",!1)
}).done(function(){if("show"===l||"season"===l)if(s.set("unviewedLeafCount",s.get("leafCount")),s.set("viewedLeafCount",0),"show"===l){var e=s.get("seasons");e.each(function(e){e.set("unviewedLeafCount",e.get("leafCount")),e.set("viewedLeafCount",0)})}else{var t=s.get("episodes");t.each(function(e){e.set("viewOffset",0),e.set("viewCount",0)})}else s.set("viewOffset",0),s.set("viewCount",0)}).fail(function(){i.set("alert",{status:"error",message:t.t("There was a problem marking {1} as unwatched.",s.get("title"))})
})};if(r||"show"!==l&&"season"!==l)c();else{var d=new n({title:t.t("Mark as Unwatched"),message:t.t("Are you sure you want to mark all episodes as unwatched?")});d.on("yes",c),i.set("modal",d)}}e.on("command:MarkUnwatched",s)}),define("plex/base/control/commands/media/DeleteMediaCommand",["plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel","plex/desktop/view/modals/ConfirmModal"],function(e,t,i,n){function a(a){var s=new n({title:t.t("Delete Media"),message:t.t("Are you sure you want to delete {1}? This media will be deleted from your filesystem.",a.get("title"))});
s.on("yes",function(){a.destroy({wait:!0}).done(function(){var t,i,n=a.get("type");a.media&&("episode"===n?i=a.media.get("episodes").length:"track"===n&&(i=a.media.get("tracks").length)),t=i?a.get("parentRatingKey"):a.get("grandparentRatingKey"),t?e.trigger("navigate:details",{serverID:a.server.id,sectionID:a.section.id,mediaID:t}):e.trigger("navigate:section",{serverID:a.server.id,sectionID:a.section.id})}).fail(function(e){var n=t.t("There was a problem deleting {1}.",a.get("title"));403===e.status&&(n=t.t('"Allow clients to delete media" must be enabled in your server preferences.')),i.set("alert",{status:"error",message:n})
})}),i.set("modal",s)}e.on("command:DeleteMedia",a)}),define("plex/base/control/commands/media/PlayMediaCommand",["plex/base/control/Dispatcher"],function(e){function t(t,i){var n=t.section?t.section.id:t.get("librarySectionID"),a=t.get("type");if("album"===a)return e.trigger("command:PlayAlbum",t),void 0;if("track"===a)return e.trigger("command:PlayTrack",t),void 0;if("photoAlbum"===a){var s=t.get("photos");return e.trigger("show:photo",s),void 0}if("photo"===a){var r=t.media;return e.trigger("show:photo",r.get("photos"),t),void 0
}if(n)return e.trigger("navigate:player",{serverID:t.server.id,sectionID:n,mediaID:t.get("ratingKey"),offset:i}),void 0;if(t.channel){var l=t.channel,o={serverID:t.server.id,path:t.get("key"),offset:i};l.id?o.key=l.id:o.identifier=l.get("identifier"),e.trigger("navigate:channelPlayer",o)}else e.trigger("navigate:channelStandalonePlayer",{serverID:t.server.id,path:t.get("key"),offset:i})}e.on("command:PlayMedia",t)}),define("plex/base/model/media/AlbumModel",["plex/base/model/media/MediaModel","plex/base/model/media/collections/TrackCollection"],function(e,t){var i=e.extend({constructor:function(){var t=e.prototype.constructor.apply(this,arguments);
return _.isEmpty(t)?t:(i.prototype.initialize.apply(t,arguments),t)},initialize:function(){e.prototype.initialize.apply(this,arguments),this.get("tracks")||this.set("tracks",new t([],{server:this.server,section:this.section,media:this}))},release:function(){var t=e.prototype.release.call(this);t&&this.get("tracks").release()},getMediaLocation:function(){var e=this.get("tracks").first();return e?e.getMediaLocation():null}});return i}),define("plex/base/control/commands/media/PlayAlbumCommand",["plex/base/control/Dispatcher","plex/base/model/SectionModel","plex/base/model/media/AlbumModel"],function(e,t,i){function n(n){var a=n.get("ratingKey"),s=new i({key:"/library/metadata/"+a+"/children",ratingKey:a},{server:n.server,section:n.section});
n.section||(n.section=new t({key:n.get("librarySectionID")},{server:n.server}),s.section=n.section);var r=s.get("tracks");r.populate().done(function(){e.trigger("play:music",r,r.first())})}e.on("command:PlayAlbum",n)}),define("plex/base/control/commands/media/PlayTrackCommand",["plex/base/control/Dispatcher","plex/base/model/SectionModel","plex/base/model/media/AlbumModel"],function(e,t,i){function n(n){var a=n.get("parentRatingKey"),s=new i({key:"/library/metadata/"+a+"/children",ratingKey:a},{server:n.server,section:n.section});
n.section||(n.section=new t({key:n.get("librarySectionID")},{server:n.server}),s.section=n.section);var r=s.get("tracks");r.populate().done(function(){e.trigger("play:music",r,r.get(n.id))})}e.on("command:PlayTrack",n)}),define("plex/base/control/commands/media/PlaySoundCommand",["plex/base/control/Dispatcher","soundmanager"],function(e){function t(){l&&(l.destruct(),l=null)}function i(){var e=setInterval(function(){return l?(l.setVolume(l.volume-5),0>=l.volume&&(clearInterval(e),t()),void 0):(clearInterval(e),void 0)
},50)}function n(e){e.onfinish=e.onfinish?_.wrap(e.onfinish,function(e){t(),e()}):t,e.id=e.url,l=soundManager.createSound(e),e.oncreate&&e.oncreate(l)}function a(e){if(!l||!e.passive||(c&&(clearTimeout(c),c=null),o&&l.url!==e.url)){o=!!e.passive,t();var i=function(){n(e)};soundManager.preferFlash&&!soundManager.swfLoaded?(soundManager.preferFlash=!1,soundManager.onready(i),soundManager.reboot()):i()}}function s(e){_.defer(function(){a(e)})}function r(e){!l||e&&!o||(c=setTimeout(i,100))}var l=null,o=!1,c=null;
e.on("command:PlaySound",s),e.on("command:StopSound",r)}),define("plex/base/control/BaseCommands",["plex/base/control/commands/init/StartInitCommand","plex/base/control/commands/init/GetMyPlexCommand","plex/base/control/commands/init/GetPrimaryServerCommand","plex/base/control/commands/init/GetAllServersCommand","plex/base/control/commands/init/GetAllSectionsCommand","plex/base/control/commands/init/TestServerConnectionCommand","plex/base/control/commands/init/FinishInitCommand","plex/base/control/commands/ShowLoadingCommand","plex/base/control/commands/SignOutCommand","plex/base/control/commands/myplex/SignInCommand","plex/base/control/commands/myplex/ShareCommand","plex/base/control/commands/myplex/RecommendCommand","plex/base/control/commands/media/RefreshMetadataCommand","plex/base/control/commands/media/MarkWatchedCommand","plex/base/control/commands/media/MarkUnwatchedCommand","plex/base/control/commands/media/DeleteMediaCommand","plex/base/control/commands/media/PlayMediaCommand","plex/base/control/commands/media/PlayAlbumCommand","plex/base/control/commands/media/PlayTrackCommand","plex/base/control/commands/media/PlaySoundCommand"],function(){}),define("plex/base/model/UpdateHistoryModel",["plex/base/model/BaseModel","jquery","moment"],function(e,t){var i=e.extend({whitelistedAttrs:["name","summary","time"],convert:function(e){var i=_.isObject(e)?e:t.xml2json(e);
return i.time=moment(i.subtitle,"YYYY-MM-DD HH:mm:ss").toDate(),i},parse:function(e){var t=this.convert(e);return t=_.pick(t,this.whitelistedAttrs)}});return i}),define("plex/base/model/collections/UpdateHistoryCollection",["plex/base/model/collections/BaseCollection","plex/base/model/UpdateHistoryModel","jquery"],function(e,t){var i=e.extend({model:t,url:"/system/appstore/history",initialize:function(e,t){this.server=t.server},parse:function(e){return this.convert(e,"Directory")}});return i}),define("plex/desktop/control/commands/updates/CheckForUpdatesCommand",["plex/base/control/Dispatcher","plex/base/model/AppModel","plex/base/model/collections/UpdateHistoryCollection","jquery","xml2json"],function(e,t,i,n){function a(){var i="/system/appstore/updates",a=t.get("primaryServer");
return e.trigger("command:ShowLoading",!0),n.ajax(a.getAjaxOptions(i)).always(function(){e.trigger("command:ShowLoading",!1)}).done(function(e){var i=n.xml2json(e)||e;if(i.Directory){var a=i.Directory[0].summary.split("\n");_.indexOf(a,"WebClient")>=0?t.set("updateStatus","download"):t.set("updateStatus","latest")}else t.set("updateStatus","latest")})}function s(){var e=new i([],{server:t.get("primaryServer")}),n={"X-Plex-Container-Start":"0","X-Plex-Container-Size":l?"40":"1"};e.on("reset",function(e){if(0!==e.length)if(l){var i=e.where({name:"WebClient"});
i.length>0&&i[0].get("time")>l&&t.set("updateStatus","reload")}else l=e.first().get("time")}),e.fetch({headers:n,hideLoadingAlert:!0})}function r(e){"download"!=t.get("updateStatus")&&(t.get("primaryServer").get("shared")||(e?a().done(s):s()))}var l=null;e.on("command:CheckForUpdates",r)}),define("plex/desktop/control/commands/updates/InstallUpdateCommand",["plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel","jquery"],function(e,t,i,n){function a(){var a=i.get("primaryServer"),s="/system/appstore/apps/com.plexapp.plugins.webclient/update";
e.trigger("command:ShowLoading",!0),n.ajax(a.getAjaxOptions(s)).always(function(){e.trigger("command:ShowLoading",!1)}).done(function(){window.location.reload(!0)}).fail(function(){i.set("alert",{status:"error",message:t.t("There was a problem installing the update.")})})}e.on("command:InstallUpdate",a)}),define("plex/desktop/control/commands/myplex/PublishServerCommand",["plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel"],function(e,t,i){function n(e){var n=e.server.get("preferences"),a=n.get("PublishServerOnPlexOnlineKey");
a.save({PublishServerOnPlexOnlineKey:e.value},{hideLoadingAlert:!0}).done(function(){e.success&&e.success()}).fail(function(){var n=t.t("There was a problem connecting your server.");e.value||(n=t.t("There was a problem disconnecting your server.")),i.set("alert",{status:"error",message:n}),e.error&&e.error()})}e.on("command:PublishServer",n)}),define("plex/desktop/control/commands/myplex/ServerSignInCommand",["plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel","jquery","xml2json"],function(e,t,i,n){function a(e){var a=e.account;
a.signedIn=!0,a.set({username:"",password:""}),a.save(e.attributes,{hideLoadingAlert:!0}).done(function(a){var s=n.xml2json(a)||a;s&&"invalid"===s.signInState?i.set("alert",{status:"error",message:t.t("The username or password is incorrect.")}):e.success&&e.success()}).fail(function(n){this.signedIn=!1;var a=t.t("There was a problem signing in to myPlex.");401===n.status&&(a=t.t("The username or password is incorrect.")),i.set("alert",{status:"error",message:a}),e.error&&e.error()})}e.on("command:ServerSignIn",a)
}),define("plex/desktop/control/commands/myplex/ServerSignOutCommand",["plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel"],function(e,t,i){function n(e){e.account.destroy({hideLoadingAlert:!0}).done(function(){e.success&&e.success()}).fail(function(){i.set("alert",{status:"error",message:t.t("There was a problem signing out of myPlex.")}),e.error&&e.error()})}e.on("command:ServerSignOut",n)}),define("plex/desktop/control/commands/myplex/ServerSignUpCommand",["plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel","jquery","xml2json"],function(e,t,i,n){function a(e){var a=e.account;
a.signedIn=!1,a.set({username:"",email:"",password:""}),a.save(e.attributes,{hideLoadingAlert:!0}).done(function(a){var s=n.xml2json(a)||a;if(s&&"invalid"===s.signInState){var r=t.t("The username or password is invalid.");s.Error&&(_.isArray(s.Error)||(s.Error=[s.Error]),r="<ul>",_.each(s.Error,function(e){r+="<li>"+e.error+"</li>"}),r+="</ul>"),i.set("alert",{status:"error",message:r}),e.error&&e.error()}else e.success&&e.success()}).fail(function(){i.set("alert",{status:"error",message:t.t("There was a problem signing up for a myPlex account.")}),e.error&&e.error()
})}e.on("command:ServerSignUp",a)}),define("plex/desktop/control/commands/library/StartLibraryScanCommand",["plex/base/control/Dispatcher","jquery"],function(e,t){function i(e,i,n){i=i?i.id:"all",n||(n={});var a={};n.force&&(a.force=1),n.turbo&&(a.turbo=1),n.deep&&(a.deep=1);var s="/library/sections/"+i+"/refresh",r=_.extend({data:a},e.getAjaxOptions(s));t.ajax(r)}e.on("command:StartLibraryScan",i)}),define("plex/desktop/control/commands/library/StopLibraryScanCommand",["plex/base/control/Dispatcher","jquery"],function(e,t){function i(e,i){i=i?i.id:"all";
var n="/library/sections/"+i+"/refresh",a=_.extend({type:"DELETE"},e.getAjaxOptions(n));t.ajax(a)}e.on("command:StopLibraryScan",i)}),define("plex/desktop/control/commands/library/StartMediaAnalysisCommand",["plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel","jquery"],function(e,t,i,n){function a(e,a){var s="/library/sections/"+a.id+"/analyze",r=_.extend({type:"PUT"},e.getAjaxOptions(s));n.ajax(r).fail(function(){i.set("alert",{status:"error",message:t.t("There was a problem trying to start media analysis in {1}.",a.get("title"))})
})}e.on("command:StartMediaAnalysis",a)}),define("plex/desktop/control/commands/library/OptimizeLibraryCommand",["plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel","jquery"],function(e,t,i,n){function a(a,s){var r=a.get("friendlyName")||a.get("name"),l="/library/optimize",o=_.extend({type:"PUT"},a.getAjaxOptions(l));e.trigger("command:ShowLoading",!0),n.ajax(o).always(function(){e.trigger("command:ShowLoading",!1),s&&s()}).done(function(){i.set("alert",{status:"success",message:t.t("The database for {1} was optimized.",r)})
}).fail(function(){i.set("alert",{status:"error",message:t.t("There was a problem optimizing the database for {1}.",r)})})}e.on("command:OptimizeLibrary",a)}),define("plex/desktop/control/commands/library/CleanBundlesCommand",["plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel","jquery"],function(e,t,i,n){function a(a,s){var r=a.get("friendlyName")||a.get("name"),l="/library/clean/bundles",o=_.extend({type:"PUT"},a.getAjaxOptions(l));e.trigger("command:ShowLoading",!0),n.ajax(o).always(function(){e.trigger("command:ShowLoading",!1),s&&s()
}).done(function(){i.set("alert",{status:"success",message:t.t("Unused bundles for {1} are being removed.",r)})}).fail(function(){i.set("alert",{status:"error",message:t.t("There was a problem removing unused bundles for {1}.",r)})})}e.on("command:CleanBundles",a)}),define("plex/desktop/control/commands/library/EmptyTrashCommand",["plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel","jquery"],function(e,t,i,n){function a(e,a,s){var r="/library/sections/"+a.id+"/emptyTrash",l=_.extend({type:"PUT"},e.getAjaxOptions(r));
n.ajax(l).done(function(){return s?(s(),void 0):(i.set("alert",{status:"success",message:t.t("The trash for {1} was emptied.",a.get("title"))}),void 0)}).fail(function(){i.set("alert",{status:"error",message:t.t("There was a problem emptying the trash for {1}.",a.get("title"))})})}e.on("command:EmptyTrash",a)}),define("hb!templates/desktop/modals/SelectServerModal.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a="";return a+="\n			",n=i.unless.call(e,e.shared,{hash:{},inverse:y.noop,fn:y.program(2,r,t),data:t}),(n||0===n)&&(a+=n),a+="\n		"
}function r(e,t){var n,a,s;return s={hash:{},inverse:y.noop,fn:y.program(3,l,t),data:t},n=i.if_neq||e.if_neq,a=n?n.call(e,e.serverClass,"secondary",s):m.call(e,"if_neq",e.serverClass,"secondary",s),a||0===a?a:""}function l(e,t){var n;return n=i["if"].call(e,e.isAvailable,{hash:{},inverse:y.noop,fn:y.program(4,o,t),data:t}),n||0===n?n:""}function o(e,t){var n,a="";return a+='\n				<li>\n					<a class="server" data-id="',(n=i.machineIdentifier)?n=n.call(e,{hash:{},data:t}):(n=e.machineIdentifier,n=typeof n===v?n.apply(e):n),a+=g(n)+'" href="#">\n						',n=i["if"].call(e,e.friendlyName,{hash:{},inverse:y.program(7,d,t),fn:y.program(5,c,t),data:t}),(n||0===n)&&(a+=n),a+="\n					</a>\n				</li>\n			"
}function c(e,t){var n,a,s="";return s+="\n							",a={hash:{},data:t},s+=g((n=i.truncate||e.truncate,n?n.call(e,e.friendlyName,20,a):m.call(e,"truncate",e.friendlyName,20,a)))+"\n						"}function d(e,t){var n,a,s="";return s+="\n							",a={hash:{},data:t},s+=g((n=i.truncate||e.truncate,n?n.call(e,e.name,20,a):m.call(e,"truncate",e.name,20,a)))+"\n						"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var h,u,p,f="",m=i.helperMissing,g=this.escapeExpression,v="function",y=this;
return f+='<div class="modal-header">\n	<button type="button" class="close" data-dismiss="modal"><i class="glyphicon remove-2"></i></button>\n	<h3>',p={hash:{},data:a},f+=g((h=i.t||t.t,h?h.call(t,"Select a Media Server",p):m.call(t,"t","Select a Media Server",p)))+'</h3>\n</div>\n\n<div class="modal-body minimal-scrollbar">\n	<ul class="select-list">\n		',u=i.each.call(t,t.servers,{hash:{},inverse:y.noop,fn:y.program(1,s,a),data:a}),(u||0===u)&&(f+=u),f+="\n	</ul>\n</div>\n"})}),define("plex/desktop/view/modals/SelectServerModal",["hb!templates/desktop/modals/SelectServerModal.tpl","plex/base/view/modals/BaseModal","jquery"],function(e,t,i){var n=t.extend({name:"selectServerModal",className:"modal modal-small select-modal fade",events:{hidden:"close","click .server":"onServerClick"},render:function(){return this.$el.html(e({servers:this.collection.toJSON()})).modal(),this
},onServerClick:function(e){e.preventDefault(),this.$el.modal("hide"),this.trigger("select:server",i(e.target).data("id"))}});return n}),define("hb!templates/desktop/modals/EditSectionModal.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a,s="";return s+='\n	<h3><i class="glyphicon plus"></i> ',a={hash:{},data:t},s+=y((n=i.t||e.t,n?n.call(e,"Add Section",a):v.call(e,"t","Add Section",a)))+"</h3>\n	"}function r(e,t){var n,a,s="";return s+='\n	<h3><i class="glyphicon pencil"></i> ',a={hash:{},data:t},s+=y((n=i.t||e.t,n?n.call(e,"Edit Section",a):v.call(e,"t","Edit Section",a)))+"</h3>\n	"
}function l(e,t){var n,a,s,r="";return r+='\n		<div class="add-section-type">\n			<h4>',s={hash:{},data:t},r+=y((n=i.t||e.t,n?n.call(e,"Select the type of media",s):v.call(e,"t","Select the type of media",s)))+"</h3>\n			",a=i.each.call(e,e.sectionTypes,{hash:{},inverse:w.noop,fn:w.program(6,o,t),data:t}),(a||0===a)&&(r+=a),r+="\n		</div>\n		"}function o(e,t){var n,a,s="";return s+='\n				<a class="section-type" data-key="',(n=i.key)?n=n.call(e,{hash:{},data:t}):(n=e.key,n=typeof n===b?n.apply(e):n),s+=y(n)+'" href="#">\n					<i class="plex-icon-',(n=i.key)?n=n.call(e,{hash:{},data:t}):(n=e.key,n=typeof n===b?n.apply(e):n),s+=y(n)+'-medium"></i>\n					<span class="section-type-label">',a={hash:{},data:t},s+=y((n=i.t||e.t,n?n.call(e,e.label,a):v.call(e,"t",e.label,a)))+"</span>\n				</a>\n			"
}function c(){return" hide"}function d(e,t){var n,a,s="";return s+="\n							",a={hash:{},data:t},s+=y((n=i.t||e.t,n?n.call(e,"Add folders where your {1} is located",e.sectionType,a):v.call(e,"t","Add folders where your {1} is located",e.sectionType,a)))+"\n						"}function h(e,t){var n,a,s="";return s+="\n							",a={hash:{},data:t},s+=y((n=i.t||e.t,n?n.call(e,"Add folders where your {1} are located",e.sectionType,a):v.call(e,"t","Add folders where your {1} are located",e.sectionType,a)))+"\n						"
}function u(e,t){var n,a,s="";return s+="\n							",a={hash:{value:e},data:t},s+=y((n=i.partial||e.partial,n?n.call(e,"sectionPathInput",a):v.call(e,"partial","sectionPathInput",a)))+"\n						"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var p,f,m,g="",v=i.helperMissing,y=this.escapeExpression,b="function",w=this;return g+='<div class="modal-header">\n	<button type="button" class="close" data-dismiss="modal"><i class="glyphicon remove-2"></i></button>\n	',p=i["if"].call(t,t.add,{hash:{},inverse:w.program(3,r,a),fn:w.program(1,s,a),data:a}),(p||0===p)&&(g+=p),g+='\n</div>\n\n<form class="modal-form add-section-form">\n	<div class="modal-body minimal-scrollbar">\n		',p=i["if"].call(t,t.add,{hash:{},inverse:w.noop,fn:w.program(5,l,a),data:a}),(p||0===p)&&(g+=p),g+='\n\n		<div class="add-section-details',p=i["if"].call(t,t.add,{hash:{},inverse:w.noop,fn:w.program(8,c,a),data:a}),(p||0===p)&&(g+=p),g+='">\n			<div class="row-fluid">\n				<div class="name-group control-group">\n					<span class="help-inline hide">',m={hash:{},data:a},g+=y((p=i.t||t.t,p?p.call(t,"A section name is required.",m):v.call(t,"t","A section name is required.",m)))+"</span>\n					<label>",m={hash:{},data:a},g+=y((p=i.t||t.t,p?p.call(t,"Name",m):v.call(t,"t","Name",m)))+'</label>\n					<input type="text" name="name" class="span12" value="'+y((p=t.section,p=null==p||p===!1?p:p.title,typeof p===b?p.apply(t):p))+'">\n				</div>\n			</div>\n\n			<div class="row-fluid">\n				<div class="folder-group control-group">\n					<label>\n						',m={hash:{},inverse:w.program(12,h,a),fn:w.program(10,d,a),data:a},p=i.if_eq||t.if_eq,f=p?p.call(t,t.sectionType,"music",m):v.call(t,"if_eq",t.sectionType,"music",m),(f||0===f)&&(g+=f),g+='\n					</label>\n\n					<p class="help-block">',m={hash:{},data:a},g+=y((p=i.t||t.t,p?p.call(t,"Help us out by following <a href='{1}' target='_blank'>our guide</a> to naming and organizing your media.","http://wiki.plexapp.com/index.php/Media_Naming_and_Organization_Guide",m):v.call(t,"t","Help us out by following <a href='{1}' target='_blank'>our guide</a> to naming and organizing your media.","http://wiki.plexapp.com/index.php/Media_Naming_and_Organization_Guide",m)))+'</p>\n\n					<div class="folders">\n						',f=i.each.call(t,(p=t.section,null==p||p===!1?p:p.location),{hash:{},inverse:w.noop,fn:w.program(14,u,a),data:a}),(f||0===f)&&(g+=f),g+='\n					</div>\n\n					<p class="pull-center">\n						<button type="button" class="add-folder-btn btn" data-focus="keyboard"><i class="glyphicon folder-plus"></i> ',m={hash:{},data:a},g+=y((p=i.t||t.t,p?p.call(t,"Add Folder",m):v.call(t,"t","Add Folder",m)))+'</button>\n					</p>\n\n					<p class="folder-help hide">',m={hash:{},data:a},g+=y((p=i.t||t.t,p?p.call(t,"At least one folder is required.",m):v.call(t,"t","At least one folder is required.",m)))+'</p>\n				</div>\n			</div>\n\n			<div class="row-fluid advanced-options hide">\n				<div class="control-group">\n					<label>',m={hash:{},data:a},g+=y((p=i.t||t.t,p?p.call(t,"Scanner",m):v.call(t,"t","Scanner",m)))+'</label>\n					<select name="scanner" class="span6"></select>\n				</div>\n			</div>\n\n			<div class="row-fluid advanced-options hide">\n				<div class="control-group">\n					<label>',m={hash:{},data:a},g+=y((p=i.t||t.t,p?p.call(t,"Agent",m):v.call(t,"t","Agent",m)))+'</label>\n					<select name="agent" class="span6"></select>\n				</div>\n			</div>\n\n			<div class="row-fluid advanced-options hide">\n				<div class="control-group">\n					<label>',m={hash:{},data:a},g+=y((p=i.t||t.t,p?p.call(t,"Language",m):v.call(t,"t","Language",m)))+'</label>\n					<select name="language" class="span6"></select>\n				</div>\n			</div>\n		</div>\n	</div>\n\n	<div class="modal-footer',f=i["if"].call(t,t.add,{hash:{},inverse:w.noop,fn:w.program(8,c,a),data:a}),(f||0===f)&&(g+=f),g+='">\n		<div class="pull-left">\n			<a class="standard-options" href="#">',m={hash:{},data:a},g+=y((p=i.t||t.t,p?p.call(t,"Show Advanced Options",m):v.call(t,"t","Show Advanced Options",m)))+'</a>\n			<a class="advanced-options hide" href="#">',m={hash:{},data:a},g+=y((p=i.t||t.t,p?p.call(t,"Hide Advanced Options",m):v.call(t,"t","Hide Advanced Options",m)))+'</a>\n		</div>\n\n		<button type="submit" class="btn btn-primary" data-focus="keyboard">',m={hash:{},data:a},g+=y((p=i.t||t.t,p?p.call(t,"Save",m):v.call(t,"t","Save",m)))+'</button>\n		<button type="button" class="btn cancel-btn" data-focus="keyboard">',m={hash:{},data:a},g+=y((p=i.t||t.t,p?p.call(t,"Cancel",m):v.call(t,"t","Cancel",m)))+"</button>\n	</div>\n</form>\n"
})}),define("plex/base/control/utils/LanguageUtil",[],function(){var e=function(){this.byCode={aa:"Afaraf",af:"Afrikaans",ab:"Abkhazian",ak:"Akan",sq:"Shqip",am:"Amharic",ar:"العربية",an:"Aragonés",hy:"Հայերեն",as:"Assamese",av:"авар мацӀ",ae:"avesta",ay:"aymar aru",az:"azərbaycan dili",ba:"башҡорт теле",bm:"bamanankan",eu:"euskara",be:"Беларуская",bn:"Bengali",bh:"भोजपुरी",bi:"Bislama",bs:"bosanski jezik",br:"brezhoneg",bg:"български език",my:"Burmese",ca:"Català",ch:"Chamoru",ce:"нохчийн мотт",cu:"ѩзыкъ словѣньскъ",cv:"чӑваш чӗлхи",kw:"Kernewek",co:"corsu",cr:"ᓀᐦᐃᔭᐍᐏᐣ",dv:"Divehi",dz:"རྫོང་ཁ",en:"English","en-GB":"English (UK)",eo:"Esperanto",et:"eesti",ee:"Eʋegbe",fo:"føroyskt",fj:"vosa Vakaviti",fy:"Frysk",ff:"Fulfulde",ka:"ქართული",gd:"Gàidhlig",ga:"Gaeilge",gl:"Galego",gv:"Gaelg",gn:"Avañe&apos;ẽ",gu:"ગુજરાતી",ht:"Kreyòl ayisyen",ha:"هَوُسَ",hz:"Otjiherero",hi:"हिन्दी",ho:"Hiri Motu",hr:"hrvatski",ig:"Asụsụ Igbo",is:"Íslenska",io:"Ido",ii:"ꆈꌠ꒿ Nuosuhxop",iu:"ᐃᓄᒃᑎᑐᑦ",ie:"Interlingue",ia:"Interlingua",id:"Bahasa Indonesia",ik:"Iñupiaq",jv:"basa Jawa",kl:"kalaallisut",kn:"ಕನ್ನಡ",ks:"कश्मीरी",kr:"Kanuri",kk:"Қазақ тілі",km:"Khmer",ki:"Gĩkũyũ",rw:"Ikinyarwanda",ky:"кыргыз тили",kv:"коми кыв",kg:"KiKongo",kj:"Kuanyama",ku:"Kurdî",lo:"Lao",la:"latine",lv:"latviešu valoda",li:"Limburgs",ln:"Lingála",lt:"lietuvių kalba",lb:"Lëtzebuergesch",lu:"Luba-Katanga",lg:"Luganda",mk:"македонски јазик",mh:"Kajin M̧ajeļ",ml:"Malayalam",mi:"te reo Māori",mr:"मराठी",ms:"bahasa Melayu",mg:"Malagasy fiteny",mt:"Malti",mo:"Moldavian",mn:"монгол",na:"Ekakairũ Naoero",nv:"Diné bizaad",nr:"isiNdebele (North)",nd:"isiNdebele (South)",ng:"Owambo",ne:"नेपाली",nn:"Norsk nynorsk",nb:"Norsk bokmål",ny:"chiCheŵa",oc:"Occitan",oj:"ᐊᓂᔑᓈᐯᒧᐎᓐ",or:"Oriya",om:"Afaan Oromoo",os:"ирон æвзаг",pa:"ਪੰਜਾਬੀ",pi:"पाऴि",ps:"پښتو",qu:"Runa Simi",rm:"rumantsch grischun",ro:"română",rn:"kiRundi",sg:"yângâ tî sängö",sa:"संस्कृतम्",sr:"српски језик",si:"Sinhala",sk:"slovenčina",sl:"Slovenščina",se:"Davvisámegiella",sm:"gagana fa&apos;a Samoa",sn:"chiShona",sd:"सिन्धी",so:"Soomaaliga",st:"Sesotho",sc:"sardu",ss:"SiSwati",su:"Basa Sunda",sw:"Kiswahili",ty:"Reo Tahiti",ta:"தமிழ்",tt:"татарча",te:"Telugu",tg:"тоҷикӣ",tl:"Wikang Tagalog",th:"ไทย",bo:"བོད་ཡིག",ti:"Tigrinya",to:"faka Tonga",tn:"Setswana",ts:"Xitsonga",tk:"Türkmen",tw:"Twi",ug:"Uyƣurqə",uk:"українська",ur:"اردو",uz:"O&apos;zbek",ve:"Tshivenḓa",vi:"Tiếng Việt",vo:"Volapük",cy:"Cymraeg",wa:"Walon",wo:"Wollof",xh:"isiXhosa",yi:"ייִדיש",yo:"Yorùbá",za:"Saɯ cueŋƅ",zu:"isiZulu",pb:"Português (Brasil)",fr:"Français",de:"Deutsch",sv:"Svenska",no:"Norsk",da:"Dansk",fi:"Suomeksi",nl:"Nederlands",it:"Italiano",es:"Español","es-419":"Español (Latinoamérica)",pl:"Polski",hu:"Magyar",el:"Ελληνικά",tr:"Türkçe",zh:"中文","zh-TW":"臺語",ru:"русский язык",he:"עברית",ja:"日本語",pt:"Português","pt-BR":"Português Brasileiro",ko:"한국어",cs:"čeština",fa:"فارسی",xx:"Unknown",xn:"None"},this.getLanguageName=function(e){return this.byCode[e]||""
}};return new e}),define("plex/base/control/utils/SectionTypes",["underscore"],function(){var e=function(){this.types=[{key:"movies",typeID:"1",typeString:"movie",label:"Movies",defaultAgent:"com.plexapp.agents.imdb",defaultLanguage:"en",defaultScanner:"Plex Movie Scanner"},{key:"tv",typeID:"2",typeString:"show",label:"TV Shows",defaultAgent:"com.plexapp.agents.thetvdb",defaultLanguage:"en",defaultScanner:"Plex Series Scanner"},{key:"music",typeID:"8",typeString:"artist",label:"Music",defaultAgent:"com.plexapp.agents.lastfm",defaultLanguage:"en",defaultScanner:"Plex Music Scanner"},{key:"photos",typeID:"13",typeString:"photo",label:"Photos",defaultAgent:"com.plexapp.agents.none",defaultLanguage:"xn",defaultScanner:"Plex Photo Scanner"},{key:"videos",typeID:"1",typeString:"movie",label:"Home Movies",defaultAgent:"com.plexapp.agents.none",defaultLanguage:"xn",defaultScanner:"Plex Video Files Scanner"}],this.byKey=_.reduce(this.types,function(e,t){return e[t.key]=t,e
},{}),this.byType=_.reduceRight(this.types,function(e,t){return e[t.typeString]=t,e},{}),this.getSectionTypes=function(){return this.types},this.getSectionType=function(e){return this.byKey[e]},this.getSectionTypeByString=function(e){return this.byType[e]}};return new e}),define("plex/base/model/AgentModel",["plex/base/control/utils/ParseUtil","plex/base/model/BaseModel","jquery"],function(e,t,i){var n=t.extend({idAttribute:"identifier",whitelistedAttrs:["identifier","name","enabled","hasPrefs","language"],initialize:function(){var e=this.server.getAjaxOptions("/system/agents/attribution?identifier="+this.id);
i.ajax(e).done(_.bind(function(e){this.set("attribution",e)},this))},convert:function(t){var n=_.isObject(t)?t:i.xml2json(t);return e.parseBoolean(n,["enabled","hasPrefs"]),n},parse:function(e){var t=this.convert(e);return _.isArray(t.Language)?t.language=_.pluck(t.Language,"code"):_.isObject(t.Language)&&(t.language=[t.Language.code]),t=_.pick(t,this.whitelistedAttrs)}});return n}),define("plex/base/model/collections/AgentCollection",["plex/base/model/collections/BaseCollection","plex/base/model/AgentModel","jquery"],function(e,t){var i=e.extend({model:t,initialize:function(e,t){this.server=t.server,this.primaryAgent=t.primaryAgent,this.relatedAgent=t.relatedAgent,this.sectionType=t.sectionType
},url:function(){return this.primaryAgent?"system/agents/contributors?mediaType="+this.sectionType+"&primaryAgent="+this.primaryAgent:this.relatedAgent?"system/agents/"+this.relatedAgent+"/config/"+this.sectionType:this.sectionType?"system/agents?mediaType="+this.sectionType:"system/agents"},parse:function(e){return this.convert(e,"Agent")}});return i}),define("plex/base/model/ScannerModel",["plex/base/model/BaseModel","jquery"],function(e,t){var i=e.extend({idAttribute:"name",convert:function(e){var i=_.isObject(e)?e:t.xml2json(e);
return i},parse:function(e){return this.convert(e)}});return i}),define("plex/base/model/collections/ScannerCollection",["plex/base/model/collections/BaseCollection","plex/base/model/ScannerModel","jquery"],function(e,t){var i=e.extend({model:t,initialize:function(e,t){this.sectionType=t.sectionType,this.server=t.server},url:function(){return"system/scanners/"+this.sectionType},parse:function(e){return this.convert(e,"Scanner")}});return i}),define("hb!templates/desktop/modals/AddFolderModal.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};
var s,r,l="",o=i.helperMissing,c=this.escapeExpression;return l+='<div class="modal-header">\n	<button type="button" class="close" data-dismiss="modal"><i class="glyphicon remove-2"></i></button>\n	<h3><i class="glyphicon folder-plus"></i> ',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Add Folder",r):o.call(t,"t","Add Folder",r)))+'</h3>\n</div>\n\n<form class="modal-form add-section-form">\n	<div class="modal-body minimal-scrollbar">\n		<div class="row-fluid">\n			<div class="control-group">\n				<input type="text" name="path" class="span12" value="">\n				<div class="home-folders-container span5"></div>\n				<div class="browse-folders-container span7"></div>\n			</div>\n		</div>\n	</div>\n\n	<div class="modal-footer">\n		<button type="submit" class="btn btn-primary" data-focus="keyboard">',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Add",r):o.call(t,"t","Add",r)))+'</button>\n		<button type="button" class="btn cancel-btn" data-focus="keyboard">',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Cancel",r):o.call(t,"t","Cancel",r)))+"</button>\n	</div>\n</form>\n"
})}),define("plex/base/model/BrowseDirectoryModel",["plex/base/control/utils/ParseUtil","plex/base/model/BaseModel","jquery"],function(e,t,i){var n=t.extend({idAttribute:"key",defaults:{key:"/services/browse",title:"Root",path:""},whitelistedAttrs:["key","title","path","home","network"],url:function(){return this.id},convert:function(t){var n=_.isObject(t)?t:i.xml2json(t);return e.parseBoolean(n,["home","network"]),n},parse:function(e){var t=this.convert(e);return t=_.pick(t,this.whitelistedAttrs)
}});return n}),define("plex/base/model/collections/BrowseDirectoryCollection",["plex/base/model/collections/BaseCollection","plex/base/model/BrowseDirectoryModel","jquery"],function(e,t){var i=e.extend({model:t,url:function(){return this.parent?this.parent.url():"/services/browse"},initialize:function(e,t){this.parent=t.parent,this.server=t.server;var n=_.bind(function(e){e.set("parent",this.parent),e.set("children",new i([],{parent:e,server:this.server}))},this);_.each(e,n),this.on("reset",function(){this.each(n)
},this),this.on("add",n)},parse:function(e){return this.convert(e,"Path")}});return i}),define("plex/base/view/lists/BaseList",["plex/base/view/BaseView"],function(e){var t=e.extend({items:null,rendered:!1,populated:!1,completed:!1,setup:function(e,t){this.items={},this.rendered=!1,this.ListItem=e,this.selector=t,this.collection&&(this.addBinding(this.collection,"reset",this.reset),this.addBinding(this.collection,"add",this.addItem),this.addBinding(this.collection,"remove",this.removeItem))},measure:function(){var e=this.selector?this.$(this.selector):this.$el,t=e.children().first();
this.$scrollContainer||(this.$scrollContainer=this.$el.parent()),this.scrollContainerWidth=e.width(),this.scrollContainerHeight=this.$scrollContainer.height(),this.itemWidth=t.outerWidth(!0),this.itemHeight=t.outerHeight(!0),this.itemsPerRow=Math.floor(this.scrollContainerWidth/this.itemWidth),this.itemsPerColumn=Math.floor(this.scrollContainerHeight/this.itemHeight),this.itemsPerPage=this.itemsPerRow*this.itemsPerColumn},populate:function(){this.rendered=!0,this.populated=!!this.collection.length,this.populated&&this.reset(this.collection)
},reset:function(e){this.rendered&&(this.populated=!!e.length,this.completed=!1,this.removeAllViews(),this.items={},e.each(this.addItem,this),_.defer(_.bind(function(){this.completed=!0,this.trigger("complete")},this)))},rebase:function(e){this.collection&&(this.removeBinding(this.collection,"reset"),this.removeBinding(this.collection,"add"),this.removeBinding(this.collection,"remove")),this.collection=e,this.addBinding(this.collection,"reset",this.reset),this.addBinding(this.collection,"add",this.addItem),this.addBinding(this.collection,"remove",this.removeItem),this.reset(e)
},addItem:function(e,t,i){var n=this.selector?this.$(this.selector):this.$el,a=new this.ListItem({model:e,list:this}),s=i&&i.at!==void 0,r=i&&i.index!==void 0;this.registerView(a),e&&(this.items[e.id]=a);var l=a.render().el;if(s||r){var o=s?i.at:i.index,c=n.children().eq(o);c.length?c.before(l):n.append(l)}else this.reverseItems?n.prepend(l):n.append(l);return a},removeItem:function(e){this.items[e.id]&&(this.removeView(this.items[e.id]),delete this.items[e.id])}});return t}),define("hb!templates/desktop/lists/items/BrowseDirectoryListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return"left-arrow"
}function r(e,t){var n;return n=i["if"].call(e,e.home,{hash:{},inverse:m.program(6,o,t),fn:m.program(4,l,t),data:t}),n||0===n?n:""}function l(){return"home"}function o(e,t){var n;return n=i["if"].call(e,e.network,{hash:{},inverse:m.program(9,d,t),fn:m.program(7,c,t),data:t}),n||0===n?n:""}function c(){return"globe"}function d(e,t){var n;return n=i.unless.call(e,e.parent,{hash:{},inverse:m.program(12,u,t),fn:m.program(10,h,t),data:t}),n||0===n?n:""}function h(){return"hdd"}function u(){return"folder-open"
}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var p,f="",m=this,g="function",v=this.escapeExpression;return f+='<a href="#" data-key="',(p=i.key)?p=p.call(t,{hash:{},data:a}):(p=t.key,p=typeof p===g?p.apply(t):p),f+=v(p)+'"><i class="folder-icon glyphicon ',p=i["if"].call(t,t.back,{hash:{},inverse:m.program(3,r,a),fn:m.program(1,s,a),data:a}),(p||0===p)&&(f+=p),f+='"></i> ',(p=i.title)?p=p.call(t,{hash:{},data:a}):(p=t.title,p=typeof p===g?p.apply(t):p),f+=v(p)+' <div class="spinner-container"></div></a>\n'
})}),define("plex/desktop/view/lists/items/BrowseDirectoryListItem",["hb!templates/desktop/lists/items/BrowseDirectoryListItem.tpl","plex/base/control/Dispatcher","plex/base/view/BaseView"],function(e,t,i){var n=i.extend({tagName:"li",className:"browse-directory-list-item",render:function(){return this.$el.html(e(this.model.toJSON())),this}});return n}),function(e,t,i){function n(e,i){var n,a=t.createElement(e||"div");for(n in i)a[n]=i[n];return a}function a(e){for(var t=1,i=arguments.length;i>t;t++)e.appendChild(arguments[t]);
return e}function s(e,t,i,n){var a=["opacity",t,~~(100*e),i,n].join("-"),s=.01+100*(i/n),r=Math.max(1-(1-e)/t*(100-s),e),l=d.substring(0,d.indexOf("Animation")).toLowerCase(),o=l&&"-"+l+"-"||"";return u[a]||(p.insertRule("@"+o+"keyframes "+a+"{"+"0%{opacity:"+r+"}"+s+"%{opacity:"+e+"}"+(s+.01)+"%{opacity:1}"+(s+t)%100+"%{opacity:"+e+"}"+"100%{opacity:"+r+"}"+"}",0),u[a]=1),a}function r(e,t){var n,a,s=e.style;if(s[t]!==i)return t;for(t=t.charAt(0).toUpperCase()+t.slice(1),a=0;h.length>a;a++)if(n=h[a]+t,s[n]!==i)return n
}function l(e,t){for(var i in t)e.style[r(e,i)||i]=t[i];return e}function o(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var a in n)e[a]===i&&(e[a]=n[a])}return e}function c(e){for(var t={x:e.offsetLeft,y:e.offsetTop};e=e.offsetParent;)t.x+=e.offsetLeft,t.y+=e.offsetTop;return t}var d,h=["webkit","Moz","ms","O"],u={},p=function(){var e=n("style");return a(t.getElementsByTagName("head")[0],e),e.sheet||e.styleSheet}(),f={lines:12,length:7,width:5,radius:10,rotate:0,color:"#000",speed:1,trail:100,opacity:.25,fps:20,zIndex:2e9,className:"spinner",top:"auto",left:"auto"},m=function m(e){return this.spin?(this.opts=o(e||{},m.defaults,f),i):new m(e)
};m.defaults={},o(m.prototype,{spin:function(e){this.stop();var t,i,a=this,s=a.opts,r=a.el=l(n(0,{className:s.className}),{position:"relative",zIndex:s.zIndex}),o=s.radius+s.length+s.width;if(e&&(e.insertBefore(r,e.firstChild||null),i=c(e),t=c(r),l(r,{left:("auto"==s.left?i.x-t.x+(e.offsetWidth>>1):s.left+o)+"px",top:("auto"==s.top?i.y-t.y+(e.offsetHeight>>1):s.top+o)+"px"})),r.setAttribute("aria-role","progressbar"),a.lines(r,a.opts),!d){var h=0,u=s.fps,p=u/s.speed,f=(1-s.opacity)/(p*s.trail/100),m=p/s.lines;
!function g(){h++;for(var e=s.lines;e;e--){var t=Math.max(1-(h+e*m)%p*f,s.opacity);a.opacity(r,s.lines-e,t,s)}a.timeout=a.el&&setTimeout(g,~~(1e3/u))}()}return a},stop:function(){var e=this.el;return e&&(clearTimeout(this.timeout),e.parentNode&&e.parentNode.removeChild(e),this.el=i),this},lines:function(e,t){function i(e,i){return l(n(),{position:"absolute",width:t.length+t.width+"px",height:t.width+"px",background:e,boxShadow:i,transformOrigin:"left",transform:"rotate("+~~(360/t.lines*o+t.rotate)+"deg) translate("+t.radius+"px"+",0)",borderRadius:(t.width>>1)+"px"})
}for(var r,o=0;t.lines>o;o++)r=l(n(),{position:"absolute",top:1+~(t.width/2)+"px",transform:t.hwaccel?"translate3d(0,0,0)":"",opacity:t.opacity,animation:d&&s(t.opacity,t.trail,o,t.lines)+" "+1/t.speed+"s linear infinite"}),t.shadow&&a(r,l(i("#000","0 0 4px #000"),{top:"2px"})),a(e,a(r,i(t.color,"0 0 1px rgba(0,0,0,.1)")));return e},opacity:function(e,t,i){e.childNodes.length>t&&(e.childNodes[t].style.opacity=i)}}),!function(){function e(e,t){return n("<"+e+' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">',t)
}var t=l(n("group"),{behavior:"url(#default#VML)"});!r(t,"transform")&&t.adj?(p.addRule(".spin-vml","behavior:url(#default#VML)"),m.prototype.lines=function(t,i){function n(){return l(e("group",{coordsize:c+" "+c,coordorigin:-o+" "+-o}),{width:c,height:c})}function s(t,s,r){a(h,a(l(n(),{rotation:360/i.lines*t+"deg",left:~~s}),a(l(e("roundrect",{arcsize:1}),{width:o,height:i.width,left:i.radius,top:-i.width>>1,filter:r}),e("fill",{color:i.color,opacity:i.opacity}),e("stroke",{opacity:0}))))}var r,o=i.length+i.width,c=2*o,d=2*-(i.width+i.length)+"px",h=l(n(),{position:"absolute",top:d,left:d});
if(i.shadow)for(r=1;i.lines>=r;r++)s(r,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(r=1;i.lines>=r;r++)s(r);return a(t,h)},m.prototype.opacity=function(e,t,i,n){var a=e.firstChild;n=n.shadow&&n.lines||0,a&&a.childNodes.length>t+n&&(a=a.childNodes[t+n],a=a&&a.firstChild,a=a&&a.firstChild,a&&(a.opacity=i))}):d=r(t,"animation")}(),e.Spinner=m}(window,document),define("spincore",function(){}),function(e){e.fn.spin=function(t,i){var n={tiny:{lines:8,length:2,width:2,radius:3},small:{lines:9,length:3,width:2,radius:4},medium:{lines:9,length:4,width:3,radius:6},large:{length:5,width:3}};
if(Spinner)return this.each(function(){var a=e(this),s=a.data();return t!==!1?("string"==typeof t?(t=t in n?n[t]:{},i&&(t.color=i),t.hwaccel=!0):"object"==typeof t&&(t.hasOwnProperty("preset")&&e.extend(t,t.preset),t.hasOwnProperty("hwaccel")||(t.hwaccel=!0)),s.spinner=new Spinner(e.extend({color:a.css("color")},t)).spin(),a.html(e(s.spinner.el).html()),a):(s.spinner&&(s.spinner.stop(),delete s.spinner),a.empty(),void 0)});throw"Spinner class not available."},e.fn.spinContents=function(t,i){var n=e(this),a=function(t){n.off("destroy",a),n.each(function(){var i=e(this),n=i.data();
if(n&&n.spinner){var a=n.spinner;a.spin(!1),i.data("spinner",null),t&&(i.css({height:"",width:""}),i.removeClass("active").html(n.html))}})};return t===!1?(a(!0),n):(n.on("destroy",a),setTimeout(function(){n.each(function(){var a=e(this);if(a.data("spinner"))return n;a.data({html:a.html()}),a.height(a.height()),a.width(a.width()),a.html('<div class="spinner"></div>');var s=a.find(".spinner").spin(t,i);a.addClass("active").html(s.get(0)),a.data("spinner",s)})},1),n)}}(jQuery),define("spin",function(){}),define("plex/desktop/view/lists/BrowseDirectoryList",["plex/base/view/lists/BaseList","plex/desktop/view/lists/items/BrowseDirectoryListItem","plex/base/model/collections/BrowseDirectoryCollection","jquery","spin"],function(e,t,i,n){var a=e.extend({tagName:"ul",className:"list rounded-list media-list media-compact-list browse-directory-list",root:!1,events:{"click a":"onDirectoryClick"},initialize:function(e){this.root=e.root,this.setup(t)
},render:function(){return this.$el.empty(),this.populate(this.collection),this},reset:function(e){this.rendered&&(this.populated=!!e.length,this.completed=!1,this.removeAllViews(),this.items={},this.parentItem&&this.addItem(this.parentItem),e.each(this.addItem,this),_.defer(_.bind(function(){this.completed=!0,this.trigger("complete")},this)))},loadDirectory:function(e){var t=this.items[e.id];this.$("a").removeClass("selected"),t.$("a").addClass("selected"),t.$(".spinner-container").spinContents("tiny")
},unloadDirectory:function(e){var t=this.items[e.id];t.$(".spinner-container").spinContents(!1)},onDirectoryClick:function(e){e.preventDefault();var t=n(e.currentTarget),i=t.find(".spinner-container"),a=t.data("key"),s=this.collection.get(a)||this.parentItem;return this.root?(i.spinContents("tiny"),this.trigger("change:path",s),void 0):(this.trigger("change:path",s),this.collection.parent=s,s.get("parent")?(this.parentItem=s.get("parent").clone(),this.parentItem.set("back",!0),this.parentItem.set("title",".. [Back]")):this.parentItem=null,i.spinContents("tiny"),this.collection.fetch({hideLoadingAlert:!0}).always(function(){i.spinContents(!1)
}),void 0)}});return a}),define("plex/desktop/view/modals/AddFolderModal",["hb!templates/desktop/modals/AddFolderModal.tpl","plex/base/model/BrowseDirectoryModel","plex/base/model/collections/BrowseDirectoryCollection","plex/base/view/modals/BaseModal","plex/desktop/view/lists/BrowseDirectoryList","jquery"],function(e,t,i,n,a){var s=n.extend({name:"editSectionModal",className:"add-folder-modal modal fade",events:{hidden:"close","submit form":"onSubmit","click .cancel-btn":"onCancel"},initialize:function(e){this.server=e.server;
var t=new i([],{server:this.server}),n=new i([],{server:this.server});this.homeList=this.registerView(new a({root:!0,collection:t})),this.browseList=this.registerView(new a({collection:n})),this.addBinding(t,"reset",this.onHomeReset),this.addBinding(this.homeList,"change:path",this.onHomeChange),this.addBinding(this.browseList,"change:path",this.onPathChange),t.fetch()},render:function(){return this.$el.html(e()).modal(),this.$(".home-folders-container").append(this.homeList.render().el),this.$(".browse-folders-container").append(this.browseList.render().el),this
},resetPathList:function(){this.browseList.parentItem=null,this.browseList.collection.reset([this.pathRoot])},onHomeReset:function(e){var t=this.browseList.collection,i=e.where({home:!0});i=i.length?_.first(i):e.first(),this.homeList.loadDirectory(i),this.$('input[name="path"]').val(i.get("path")),t.parent=i,t.fetch({hideLoadingAlert:!0}).always(_.bind(function(){this.homeList.unloadDirectory(i)},this))},onHomeChange:function(e){var t=this.browseList.collection;this.homeList.loadDirectory(e),this.$('input[name="path"]').val(e.get("path")),this.browseList.parentItem=null,t.parent=e,t.fetch({hideLoadingAlert:!0}).always(_.bind(function(){this.homeList.unloadDirectory(e)
},this))},onPathChange:function(e){this.$('input[name="path"]').val(e.get("path"))},onSubmit:function(e){e.preventDefault(),this.trigger("add:folder",this.$('input[name="path"]').val()),this.$el.modal("hide")},onCancel:function(e){e.preventDefault(),this.$el.modal("hide")}});return s}),define("plex/desktop/view/modals/EditSectionModal",["hb!templates/desktop/modals/EditSectionModal.tpl","plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/control/utils/LanguageUtil","plex/base/control/utils/SectionTypes","plex/base/model/AppModel","plex/base/model/collections/AgentCollection","plex/base/model/collections/ScannerCollection","plex/base/view/modals/BaseModal","plex/desktop/view/modals/AddFolderModal","jquery"],function(e,t,i,n,a,s,r,l,o,c,d){var h=function(e){return _.map(e,function(e){return'<option value="'+e.value+'">'+e.label+"</option>"
}).join("\n")},u=function(e,t){for(var i=0;e.options.length>i;i++)if(t==e.options[i].value)return e.selectedIndex=i,void 0},p=o.extend({name:"editSectionModal",className:"edit-section-modal modal fade",redirect:!1,events:{hidden:"close","click .section-type":"onSectionTypeClick",'change select[name="agent"]':"onAgentChange","click a.advanced-options":"onHideAdvanced","click a.standard-options":"onShowAdvanced","click .add-folder-btn":"onAddFolderClick","click .remove-path-btn":"onRemovePathClick","submit form":"onSubmit","click .cancel-btn":"onCancel"},initialize:function(e){this.server=e.server,this.section=e.section,this.scanners={},this.agents={},this.redirect=e.redirect,_.each(a.getSectionTypes(),function(e){if(!this.scanners[e.typeID]){var t={server:this.server,sectionType:e.typeID};
this.scanners[e.typeID]=new l([],t),this.agents[e.typeID]=new r([],t)}},this)},render:function(){var t={};if(this.section){var n=a.getSectionTypeByString(this.section.get("type"));t.edit=!0,t.section=this.section.toJSON(),t.sectionType=i.t(n.label.toLowerCase())}else t.add=!0;return t.sectionTypes=a.getSectionTypes(),this.$el.html(e(t)).modal(),this.section&&this.populateDropdowns(a.getSectionTypeByString(this.section.get("type"))),this},setLanguages:function(e,t){var i=this.$('select[name="language"]');
if(i.empty(),t&&(i.append(h(_.map(t.get("language"),function(e){return{label:n.getLanguageName(e),value:e}}))),this.section)){var a=this.section.get("language");u(i[0],a)}},populateDropdowns:function(e){var t=this.$('select[name="agent"]'),i=this.$('select[name="scanner"]');if(e){this.type=e.key,this.$(".add-section-type").addClass("hide"),this.$(".add-section-details").removeClass("hide"),this.$(".modal-footer").removeClass("hide");var n=h([{value:"",label:"Loading..."}]);t.empty().append(n),i.empty().append(n),this.agents[e.typeID].populate().done(_.bind(function(i){t.empty().append(h(i.map(function(e){return{label:e.get("name"),value:e.get("identifier")}
})));var n=this.section?this.section.get("agent"):e.defaultAgent;u(t[0],n);var a=i.get(n);this.setLanguages(e,a)},this)).fail(_.bind(function(){t.empty()},this)),this.scanners[e.typeID].populate().done(_.bind(function(t){i.empty().append(h(t.map(function(e){return{label:e.get("name"),value:e.get("name")}}))),u(i[0],this.section?this.section.get("scanner"):e.defaultScanner)},this)).fail(_.bind(function(){i.empty()},this))}else t.empty(),i.empty()},validate:function(e){var t=!0;return e.title?(this.$(".name-group").removeClass("error"),this.$(".name-group .help-inline").addClass("hide")):(this.$(".name-group").addClass("error"),this.$(".name-group .help-inline").removeClass("hide"),t=!1),e.location.length?(this.$(".add-folder-btn").removeClass("btn-danger"),this.$(".folder-help").addClass("hide")):(this.$(".add-folder-btn").addClass("btn-danger"),this.$(".folder-help").removeClass("hide"),t=!1),t
},onSectionTypeClick:function(e){e.preventDefault();var t=d(e.target).closest("a"),n=t.data("key"),s=a.getSectionType(n),r=s.label;this.$('input[name="name"]').val(r),this.$('input[name="path"]').focus(),r=i.t(r.toLowerCase()),"music"===r?this.$(".folder-group label").text(i.t("Add folders where your {1} is located",r)):this.$(".folder-group label").text(i.t("Add folders where your {1} are located",r)),this.populateDropdowns(s)},onAgentChange:function(e){var t=a.getSectionType(this.type),i=this.agents[t.typeID].get(e.target.value);
this.setLanguages(t,i)},onHideAdvanced:function(e){e.preventDefault(),this.$(".advanced-options").addClass("hide"),this.$(".standard-options").removeClass("hide")},onShowAdvanced:function(e){e.preventDefault(),this.$(".standard-options").addClass("hide"),this.$(".advanced-options").removeClass("hide")},onAddFolderClick:function(){var e=new c({server:this.server}),t=_.bind(function(i){if(i){var n=d(Handlebars.partials.sectionPathInput({}));n.find('input[name="path"]').val(i),this.$(".folders").append(n),this.$(".add-folder-btn").removeClass("btn-danger"),this.$(".folder-help").addClass("hide"),e.off("add:folder",t)
}},this);e.on("add:folder",t),s.set("modal",e)},onRemovePathClick:function(e){e.preventDefault(),d(e.currentTarget).closest(".path-container").remove()},onSubmit:function(e){e.preventDefault();var i=e.target,n=a.getSectionType(this.type),s={type:n.typeString,title:i.name.value,agent:i.agent.value,scanner:i.scanner.value,language:i.language.value,location:[]};s.location=_.compact(_.map(this.$("input[name=path]"),function(e){return e.value})),this.validate(s)&&(this.section?this.section.save(s,{success:_.bind(function(e){this.$el.modal("hide"),this.redirect&&t.trigger("navigate:section",{serverID:e.server.id,sectionID:e.id})
},this)}):this.server.get("sections").create(s,{wait:!0,success:_.bind(function(e){this.$el.modal("hide"),this.redirect&&t.trigger("navigate:section",{serverID:e.server.id,sectionID:e.id})},this)}))},onCancel:function(e){e.preventDefault(),this.$el.modal("hide")}});return p}),define("plex/desktop/control/commands/library/AddSectionCommand",["plex/base/control/Dispatcher","plex/base/model/AppModel","plex/desktop/view/modals/SelectServerModal","plex/desktop/view/modals/EditSectionModal"],function(e,t,i,n){function a(e){function a(i){s.off("select:server",a),t.set("modal",new n({server:t.get("servers").get(i),redirect:e}))
}var s=new i({collection:t.get("servers")});t.get("multiServer")?(s.on("select:server",a),t.set("modal",s)):t.set("modal",new n({server:t.get("primaryServer"),redirect:e}))}e.on("command:AddSection",a)}),define("plex/desktop/control/commands/library/DeleteSectionCommand",["plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel","plex/desktop/view/modals/ConfirmModal"],function(e,t,i,n){function a(e,a){var s=new n({title:t.t("Delete Section"),message:t.t("Are you sure you want to delete {1}? This cannot be undone.",e.get("title"))});
s.on("yes",function(){e.destroy({wait:!0}).done(function(){a&&a()})}),i.set("modal",s)}e.on("command:DeleteSection",a)}),define("plex/desktop/control/commands/media/AnalyzeMediaCommand",["plex/base/control/Dispatcher","jquery"],function(e,t){function i(e){var i="/library/metadata/"+e.get("ratingKey")+"/analyze",n=_.extend({type:"PUT"},e.server.getAjaxOptions(i));t.ajax(n)}e.on("command:AnalyzeMedia",i)}),define("plex/desktop/control/commands/media/MatchUsingCommand",["plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel","jquery","xml2json"],function(e,t,i,n){function a(a,s){var r={agent:s.id,manual:0},l="/library/metadata/"+a.get("ratingKey")+"/matches?"+n.param(r);
e.trigger("command:ShowLoading",!0),n.ajax(a.server.getAjaxOptions(l)).always(function(){e.trigger("command:ShowLoading",!1)}).done(function(s){var o=n.xml2json(s)||s;if(o.SearchResult){var c=o.SearchResult;_.isArray(o.SearchResult)&&(c=o.SearchResult[0]),r={guid:c.guid,name:c.name},l="/library/metadata/"+a.get("ratingKey")+"/match?"+n.param(r);var d=_.extend({type:"PUT"},a.server.getAjaxOptions(l));n.ajax(d).done(function(){e.trigger("hide:fixMatchModal")}).fail(function(){i.set("alert",{status:"error",message:t.t("There was a problem matching this media.")})
})}else i.set("alert",{status:"error",message:t.t("No matches were found using this agent.")})}).fail(function(){i.set("alert",{status:"error",message:t.t("There was a problem looking for matches.")})})}e.on("command:MatchUsing",a)}),define("plex/desktop/control/commands/media/UnmatchCommand",["plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel","jquery"],function(e,t,i,n){function a(a){var s="/library/metadata/"+a.get("ratingKey")+"/unmatch",r=_.extend({type:"PUT"},a.server.getAjaxOptions(s));
e.trigger("command:ShowLoading",!0),n.ajax(r).always(function(){e.trigger("command:ShowLoading",!1)}).fail(function(){i.set("alert",{status:"error",message:t.t("There was a problem unmatching {1}.",a.get("title"))})})}e.on("command:Unmatch",a)}),define("plex/desktop/control/commands/media/SplitApartCommand",["plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel","plex/desktop/view/modals/ConfirmModal","jquery"],function(e,t,i,n,a){function s(s){var r="/library/metadata/"+s.get("ratingKey")+"/split",l=new n({title:t.t("Split Apart"),message:t.t("Are you sure you want to split apart {1}?",s.get("title"))});
l.on("yes",function(){var n=_.extend({type:"PUT"},s.server.getAjaxOptions(r));e.trigger("command:ShowLoading",!0),a.ajax(n).always(function(){e.trigger("command:ShowLoading",!1)}).done(function(){var t,i=s.get("type");switch(i){case"movie":case"episode":t="Media";break;case"show":case"artist":case"album":t="Location";break;default:t="Media"}s.set(t,s.get(t).slice(0,1)),e.trigger("navigate:back")}).fail(function(){i.set("alert",{status:"error",message:t.t("There was a problem splitting {1} apart.",s.get("title"))})
})}),i.set("modal",l)}e.on("command:SplitApart",s)}),define("plex/desktop/control/commands/media/MergeCommand",["plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel","plex/desktop/view/modals/ConfirmModal","jquery"],function(e,t,i,n,a){function s(s,r){var l="/library/metadata/"+s.get("ratingKey")+"/merge?ids=";l+=_.pluck(r,"id").join(",");var o=new n({title:t.t("Merge"),message:t.t("Are you sure you want to merge into {1}?",s.get("title"))});o.on("yes",function(){var n=_.extend({type:"PUT"},s.server.getAjaxOptions(l));
e.trigger("command:ShowLoading",!0),a.ajax(n).always(function(){e.trigger("command:ShowLoading",!1)}).fail(function(){i.set("alert",{status:"error",message:t.t("There was a problem merging these items into {1}.",s.get("title"))})})}),i.set("modal",o)}e.on("command:Merge",s)}),define("plex/desktop/control/commands/media/SelectStreamCommand",["plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel","jquery"],function(e,t,i,n){function a(a,s,r){var l=_.first(s.get("Media"));
if(l){var o=_.first(l.Part);if(o){var c="/library/parts/"+o.id+"?";c+="audio"===a?"audioStreamID="+r:"subtitleStreamID="+r;var d=_.extend({type:"PUT"},s.server.getAjaxOptions(c));e.trigger("command:ShowLoading",!0),n.ajax(d).always(function(){e.trigger("command:ShowLoading",!1)}).done(function(){var e;e="audio"===a?s.getStreams(2):s.getStreams(3),_.each(e,function(e){e.id!==r?delete e.selected:e.selected=!0}),s.trigger("change:streams")}).fail(function(){i.set("alert",{status:"error",message:t.t("There was a problem selecting the stream for {1}.",s.get("title"))})
})}}}e.on("command:SelectStream",a)}),define("plex/base/control/utils/SyncQualities",["underscore"],function(){var e=function(){var e=[{key:"low",videoQuality:24,videoResolutionFactor:.5,photoQuality:24,musicBitrate:96},{key:"medium",videoQuality:49,videoResolutionFactor:.75,photoQuality:49,musicBitrate:128},{key:"high",videoQuality:74,videoResolutionFactor:1,photoQuality:74,musicBitrate:192},{key:"highest",videoQuality:99,photoQuality:99,musicBitrate:320}];this.byKey=_.reduce(e,function(e,t){return e[t.key]=t,e
},{}),this.getSettings=function(e){return this.byKey[e]},this.getSettingsByVideoQuality=function(e){return 25>=e?this.byKey.low:50>=e?this.byKey.medium:75>=e?this.byKey.high:this.byKey.highest}};return new e}),define("plex/desktop/control/commands/media/CreateSyncItemCommand",["plex/base/control/Dispatcher","plex/base/control/utils/MediaTypes","plex/base/control/utils/MediaUtil","plex/base/control/utils/LocalizationUtil","plex/base/control/utils/SyncQualities","plex/base/model/AppModel","plex/base/model/SettingsModel","jquery"],function(e,t,i,n,a,s,r,l){function o(o){var c,d,h={},u="",p=o.device.get("screenResolution");
if(p=p?p:"1024x768",o.section){var f,m=o.section.get("media");if(u=o.settings.title?o.settings.title:o.section.get("title"),c=t.getChildMediaType(m.viewGroup),o.models){var g=[];_.each(o.models,function(e){g.push(e.get("ratingKey"))}),f="/library/metadata/"+g.join(",")}else f=m.url(),f=f.replace(/(&|\?)X-Plex-Container-Start=(\d+)&X-Plex-Container-Size=(\d+)/,"");d=o.section.server,h["SyncItem[Location][uri]"]="library://"+o.section.get("uuid")+"/directory/"+encodeURIComponent(f),h["SyncItem[machineIdentifier]"]=o.section.server.id,h["SyncItem[title]"]=u,h["SyncItem[rootTitle]"]=o.section.get("title"),h["SyncItem[metadataType]"]=c.typeString
}else if(o.media){var v=o.media.get("type"),y=o.media.get("grandparentTitle"),b=o.media.get("parentTitle");if(d=o.media.server,u=o.media.get("title"),c=t.getChildMediaType(o.media.get("type")),y?u=y+" - "+o.media.get("title"):b&&(u=b+" - "+o.media.get("title")),"clip"===v)h["SyncItem[Location][uri]"]=o.directory?"channel://"+o.media.channel.get("identifier")+"/directory/"+encodeURIComponent(o.media.get("key")):"channel://"+o.media.channel.get("identifier")+"/item/"+encodeURIComponent(o.media.get("key")),h["SyncItem[rootTitle]"]=o.media.channel.get("title");
else{if("episode"===v){var w=o.media.get("parentIndex"),x=o.media.get("index"),k=o.media.get("originallyAvailableAt"),S=i.getSeasonEpisodeIndex(w,x,k);u+=" ("+S+")"}h["SyncItem[Location][uri]"]=o.directory?"library://"+o.media.section.get("uuid")+"/directory/"+encodeURIComponent(o.media.get("key")):"library://"+o.media.section.get("uuid")+"/item/"+encodeURIComponent(o.media.get("key")),h["SyncItem[rootTitle]"]=o.media.section.get("title")}h["SyncItem[machineIdentifier]"]=o.media.server.id,h["SyncItem[title]"]=u,h["SyncItem[metadataType]"]=c.typeString
}var C=a.getSettings(o.settings.quality);if(h["SyncItem[Policy][unwatched]"]=o.settings.unwatched,h["SyncItem[Policy][scope]"]=o.settings.scope,h["SyncItem[MediaSettings][videoQuality]"]=C.videoQuality,h["SyncItem[MediaSettings][photoQuality]"]=C.photoQuality,h["SyncItem[MediaSettings][musicBitrate]"]=C.musicBitrate,h["SyncItem[MediaSettings][audioBoost]"]=r.get("audioBoost"),h["SyncItem[MediaSettings][subtitleSize]"]=r.get("subtitleSize"),C.videoResolutionFactor){var A=p.split("x");A[0]=Math.round(C.videoResolutionFactor*A[0]),A[1]=Math.round(C.videoResolutionFactor*A[1]),h["SyncItem[MediaSettings][videoResolution]"]=A.join("x")
}o.settings.value&&(h["SyncItem[Policy][value]"]=o.settings.value);var I="/devices/"+o.device.id+"/sync_items?"+l.param(h),T=_.extend(o.device.server.getAjaxOptions(I),{type:"POST"}),M=function(){e.trigger("command:ShowLoading",!1),s.set("alert",{status:"error",message:n.t("There was a problem syncing this media.")})};e.trigger("command:ShowLoading",!0),l.ajax(T).done(function(){var t="/sync/refreshSynclists",i=_.extend(d.getAjaxOptions(t),{type:"PUT"});l.ajax(i).done(function(){e.trigger("command:ShowLoading",!1),o.callback()
}).fail(M)}).fail(M)}e.on("command:CreateSyncItem",o)}),define("plex/desktop/control/commands/media/EditSyncItemCommand",["plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/control/utils/SyncQualities","plex/base/model/AppModel","plex/base/model/SettingsModel","jquery"],function(e,t,i,n,a,s){function r(r){var o={},c=r.settings.title?r.settings.title:r.syncItem.get("title"),d=i.getSettings(r.settings.quality);if(o["SyncItem[version]"]=r.syncItem.get("version"),o["SyncItem[Location][uri]"]=r.syncItem.get("Location").uri,o["SyncItem[machineIdentifier]"]=r.syncItem.mediaServer.id,o["SyncItem[title]"]=c,o["SyncItem[rootTitle]"]=r.syncItem.get("rootTitle"),o["SyncItem[metadataType]"]=r.syncItem.get("metadataType"),o["SyncItem[Policy][unwatched]"]=r.settings.unwatched,o["SyncItem[Policy][scope]"]=r.settings.scope,o["SyncItem[MediaSettings][videoQuality]"]=d.videoQuality,o["SyncItem[MediaSettings][photoQuality]"]=d.photoQuality,o["SyncItem[MediaSettings][musicBitrate]"]=d.musicBitrate,o["SyncItem[MediaSettings][audioBoost]"]=a.get("audioBoost"),o["SyncItem[MediaSettings][subtitleSize]"]=a.get("subtitleSize"),d.videoResolutionFactor){var h=l.split("x");
h[0]=Math.round(d.videoResolutionFactor*h[0]),h[1]=Math.round(d.videoResolutionFactor*h[1]),o["SyncItem[MediaSettings][videoResolution]"]=h.join("x")}r.settings.value&&(o["SyncItem[Policy][value]"]=r.settings.value);var u="/devices/"+r.syncItem.device.id+"/sync_items/"+r.syncItem.id+"?"+s.param(o),p=_.extend(r.syncItem.server.getAjaxOptions(u),{type:"PUT"}),f=function(){e.trigger("command:ShowLoading",!1),n.set("alert",{status:"error",message:t.t("There was a problem syncing this media.")})};e.trigger("command:ShowLoading",!0),s.ajax(p).done(function(){var t="/sync/refreshSynclists",i=_.extend(r.syncItem.mediaServer.getAjaxOptions(t),{type:"PUT"});
s.ajax(i).done(function(){var t="/sync/refreshContent",i=_.extend(r.syncItem.mediaServer.getAjaxOptions(t),{type:"PUT"});s.ajax(i).done(function(){e.trigger("command:ShowLoading",!1),r.callback()}).fail(f)}).fail(f)}).fail(f),r.syncItem.set("title",c),r.syncItem.set("version",1+r.syncItem.get("version")),r.syncItem.set("MediaSettings",{videoQuality:d.videoQuality,photoQuality:d.photoQuality,musicBitrate:d.musicBitrate,audioBoost:d.audioBoost}),r.syncItem.set("Policy",{scope:r.settings.scope,unwatched:r.settings.unwatched,value:r.settings.value})
}var l="1024x768";e.on("command:EditSyncItem",r)}),define("hb!templates/desktop/modals/SelectClientModal.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a="";return a+='\n			<li><a class="client" data-id="',(n=i.machineIdentifier)?n=n.call(e,{hash:{},data:t}):(n=e.machineIdentifier,n=typeof n===f?n.apply(e):n),a+=p(n)+'" href="#">',n=i["if"].call(e,e.friendlyName,{hash:{},inverse:m.program(4,l,t),fn:m.program(2,r,t),data:t}),(n||0===n)&&(a+=n),a+="</a></li>\n		"
}function r(e,t){var n,a;return a={hash:{},data:t},p((n=i.truncate||e.truncate,n?n.call(e,e.friendlyName,25,a):u.call(e,"truncate",e.friendlyName,25,a)))}function l(e,t){var n,a;return a={hash:{},data:t},p((n=i.truncate||e.truncate,n?n.call(e,e.name,25,a):u.call(e,"truncate",e.name,25,a)))}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var o,c,d,h="",u=i.helperMissing,p=this.escapeExpression,f="function",m=this;return h+='<div class="modal-header">\n	<button type="button" class="close" data-dismiss="modal"><i class="glyphicon remove-2"></i></button>\n	<h3>',d={hash:{},data:a},h+=p((o=i.t||t.t,o?o.call(t,"Select a Player",d):u.call(t,"t","Select a Player",d)))+'</h3>\n</div>\n\n<div class="modal-body minimal-scrollbar">\n	<ul class="select-list">\n		',c=i.each.call(t,t.clients,{hash:{},inverse:m.noop,fn:m.program(1,s,a),data:a}),(c||0===c)&&(h+=c),h+="\n	</ul>\n</div>\n"
})}),define("plex/desktop/view/modals/SelectClientModal",["hb!templates/desktop/modals/SelectClientModal.tpl","plex/base/model/AppModel","plex/base/view/modals/BaseModal","jquery"],function(e,t,i,n){var a=i.extend({name:"selectClientModal",className:"modal modal-small select-modal fade",events:{hidden:"close","click .client":"onClientClick"},render:function(){var i=t.get("clients");return this.$el.html(e({clients:i.toJSON()})).modal(),this},onClientClick:function(e){e.preventDefault(),this.$el.modal("hide"),this.trigger("select:client",n(e.target).data("id"))
}});return a}),define("plex/desktop/control/commands/media/RemotePlayCommand",["plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel","plex/desktop/view/modals/SelectClientModal","jquery"],function(e,t,i,n,a){function s(e){var s=i.get("clients"),r=e.media.server,l=r.get("accessToken"),o=function(){var n=e.media.get("key");e.media.media&&(n=e.media.media.get("key"));var s={key:e.media.get("key"),path:r.resolveExternalUrl(n)};e.offset&&(s.viewOffset=e.offset),l&&(s["X-Plex-Token"]=l);
var o="/system/players/"+e.client.get("host")+"/application/playMedia?"+a.param(s);a.ajax(r.getAjaxOptions(o)).fail(function(){i.set("alert",{status:"error",message:t.t("There was a problem trying to play {1} on {2}.",e.media.get("title"),e.client.get("name"))})})};if(e.client)return o(),void 0;if(s.length>1){var c=new n,d=function(t){c.off("select:client",d),e.client=s.get(t),o()};c.on("select:client",d),i.set("modal",c)}else 1===s.length&&(e.client=s.first(),o())}e.on("command:RemotePlay",s)}),define("plex/desktop/control/commands/media/RateCommand",["plex/base/control/Dispatcher","jquery"],function(e,t){function i(e,i){e.set("userRating",i);
var n={key:e.get("ratingKey"),identifier:e.get("identifier"),rating:i},a="/:/rate?"+t.param(n),s=_.extend(e.server.getAjaxOptions(a));t.ajax(s)}e.on("command:Rate",i)}),define("plex/desktop/control/commands/channel/ChannelActionCommand",["plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel","jquery","xml2json"],function(e,t,i,n){function a(a,s,r){e.trigger("command:ShowLoading",!0),n.ajax(a.server.getAjaxOptions(s)).always(function(){e.trigger("command:ShowLoading",!1),r&&r()
}).done(function(e){var t=n.xml2json(e)||e;/\/uninstall$/.test(s)?a.set("installed",!1):a.set("installed",!0),t.message&&i.set("alert",{status:"success",message:t.message})}).fail(function(){i.set("alert",{status:"error",message:t.t("There was a problem trying to perform this action on {1}.",a.get("name"))})})}e.on("command:ChannelAction",a)}),define("plex/desktop/control/commands/channel/UpdateChannelCommand",["plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel","jquery","xml2json"],function(e,t,i,n){function a(a,s){var r="/system/appstore/";
r+=a.channel?"apps/"+a.channel.get("identifier")+"/update":"updates",a.silent||e.trigger("command:ShowLoading",!0),n.ajax(a.server.getAjaxOptions(r)).always(function(){a.silent||e.trigger("command:ShowLoading",!1)}).done(function(r){var l=n.xml2json(r)||r;if(l.message)a.silent||i.set("alert",{status:"success",message:l.message}),s&&s();else if(l.Directory){var o;o=_.isArray(l.Directory)?l.Directory[0].key:l.Directory.key,a.silent||e.trigger("command:ShowLoading",!0),n.ajax(a.server.getAjaxOptions(o)).always(function(){a.silent||e.trigger("command:ShowLoading",!1),s&&s()
}).done(function(e){var s=n.xml2json(e)||e;s.message&&!a.silent&&i.set("alert",{status:"success",message:t.t(s.message)})}).fail(function(){a.silent||i.set("alert",{status:"error",message:t.t("There was a problem downloading updates.")})})}}).fail(function(){a.silent||i.set("alert",{status:"error",message:t.t("There was a problem checking for updates.")}),s&&s()})}e.on("command:UpdateChannel",a)}),define("plex/desktop/control/commands/channel/UninstallChannelCommand",["plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel","plex/desktop/view/modals/ConfirmModal","jquery","xml2json"],function(e,t,i,n,a){function s(s,r){var l="/system/appstore/apps/"+s.get("identifier")+"/uninstall",o=new n({title:t.t("Uninstall Channel"),message:t.t("Are you sure you want to uninstall {1}?",s.get("title"))});
o.on("yes",function(){i.set("modal",o),e.trigger("command:ShowLoading",!0),a.ajax(s.server.getAjaxOptions(l)).always(function(){e.trigger("command:ShowLoading",!1),r&&r()}).done(function(e){var t=a.xml2json(e)||e;s.set("installed",!1),t.message&&i.set("alert",{status:"success",message:t.message})}).fail(function(){i.set("alert",{status:"error",message:t.t("There was a problem uninstalling {1}.",s.get("title"))})})}),i.set("modal",o)}e.on("command:UninstallChannel",s)}),define("plex/desktop/control/Commands",["plex/base/control/Dispatcher","plex/base/control/BaseCommands","plex/desktop/control/commands/updates/CheckForUpdatesCommand","plex/desktop/control/commands/updates/InstallUpdateCommand","plex/desktop/control/commands/myplex/PublishServerCommand","plex/desktop/control/commands/myplex/ServerSignInCommand","plex/desktop/control/commands/myplex/ServerSignOutCommand","plex/desktop/control/commands/myplex/ServerSignUpCommand","plex/desktop/control/commands/library/StartLibraryScanCommand","plex/desktop/control/commands/library/StopLibraryScanCommand","plex/desktop/control/commands/library/StartMediaAnalysisCommand","plex/desktop/control/commands/library/OptimizeLibraryCommand","plex/desktop/control/commands/library/CleanBundlesCommand","plex/desktop/control/commands/library/EmptyTrashCommand","plex/desktop/control/commands/library/AddSectionCommand","plex/desktop/control/commands/library/DeleteSectionCommand","plex/desktop/control/commands/media/AnalyzeMediaCommand","plex/desktop/control/commands/media/MatchUsingCommand","plex/desktop/control/commands/media/UnmatchCommand","plex/desktop/control/commands/media/SplitApartCommand","plex/desktop/control/commands/media/MergeCommand","plex/desktop/control/commands/media/SelectStreamCommand","plex/desktop/control/commands/media/CreateSyncItemCommand","plex/desktop/control/commands/media/EditSyncItemCommand","plex/desktop/control/commands/media/RemotePlayCommand","plex/desktop/control/commands/media/RateCommand","plex/desktop/control/commands/channel/ChannelActionCommand","plex/desktop/control/commands/channel/UpdateChannelCommand","plex/desktop/control/commands/channel/UninstallChannelCommand"],function(e){e.trigger("ready")
}),!function(e){var t=function(t,i){this.$element=e(t),this.options=e.extend({},e.fn.button.defaults,i)};t.prototype.setState=function(e){var t="disabled",i=this.$element,n=i.data(),a=i.is("input")?"val":"html";e+="Text",n.resetText||i.data("resetText",i[a]()),i[a](n[e]||this.options[e]),setTimeout(function(){"loadingText"==e?i.addClass(t).attr(t,t):i.removeClass(t).removeAttr(t)},0)},t.prototype.toggle=function(){var e=this.$element.parent('[data-toggle="buttons-radio"]');e&&e.find(".active").removeClass("active"),this.$element.toggleClass("active")
},e.fn.button=function(i){return this.each(function(){var n=e(this),a=n.data("button"),s="object"==typeof i&&i;a||n.data("button",a=new t(this,s)),"toggle"==i?a.toggle():i&&a.setState(i)})},e.fn.button.defaults={loadingText:"loading..."},e.fn.button.Constructor=t,e(function(){e("body").on("click.button.data-api","[data-toggle^=button]",function(t){var i=e(t.target);i.hasClass("btn")||(i=i.closest(".btn")),i.button("toggle")})})}(window.jQuery),define("button",function(){}),!function(e){function t(){e(i).parent().removeClass("open")
}var i='[data-toggle="dropdown"]',n=function(t){var i=e(t).on("click.dropdown.data-api",this.toggle);e("html").on("click.dropdown.data-api",function(){i.parent().removeClass("open")})};n.prototype={constructor:n,toggle:function(){var i,n,a,s=e(this);if(!s.is(".disabled, :disabled"))return n=s.attr("data-target"),n||(n=s.attr("href"),n=n&&n.replace(/.*(?=#[^\s]*$)/,"")),i=e(n),i.length||(i=s.parent()),a=i.hasClass("open"),t(),a||i.toggleClass("open"),!1}},e.fn.dropdown=function(t){return this.each(function(){var i=e(this),a=i.data("dropdown");
a||i.data("dropdown",a=new n(this)),"string"==typeof t&&a[t].call(i)})},e.fn.dropdown.Constructor=n,e(function(){e("html").on("click.dropdown.data-api",t),e("body").on("click.dropdown",".dropdown form",function(e){e.stopPropagation()}).on("click.dropdown.data-api",i,n.prototype.toggle)})}(window.jQuery),define("dropdown",function(){}),!function(e){var t=function(e,t){this.init("tooltip",e,t)};t.prototype={constructor:t,init:function(t,i,n){var a,s;this.type=t,this.$element=e(i),this.options=this.getOptions(n),this.enabled=!0,"manual"!=this.options.trigger&&(a="hover"==this.options.trigger?"mouseenter":"focus",s="hover"==this.options.trigger?"mouseleave":"blur",this.$element.on(a,this.options.selector,e.proxy(this.enter,this)),this.$element.on(s,this.options.selector,e.proxy(this.leave,this))),this.options.selector?this._options=e.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()
},getOptions:function(t){return t=e.extend({},e.fn[this.type].defaults,t,this.$element.data()),t.delay&&"number"==typeof t.delay&&(t.delay={show:t.delay,hide:t.delay}),t},enter:function(t){var i=e(t.currentTarget)[this.type](this._options).data(this.type);return i.options.delay&&i.options.delay.show?(clearTimeout(this.timeout),i.hoverState="in",this.timeout=setTimeout(function(){"in"==i.hoverState&&i.show()},i.options.delay.show),void 0):i.show()},leave:function(t){var i=e(t.currentTarget)[this.type](this._options).data(this.type);
return this.timeout&&clearTimeout(this.timeout),i.options.delay&&i.options.delay.hide?(i.hoverState="out",this.timeout=setTimeout(function(){"out"==i.hoverState&&i.hide()},i.options.delay.hide),void 0):i.hide()},show:function(){var t,i,n,a,s,r,l;if(this.hasContent()&&this.enabled){switch(t=this.tip(),this.setContent(),this.options.animation&&t.addClass("fade"),r="function"==typeof this.options.placement?this.options.placement.call(this,t[0],this.$element[0]):this.options.placement,i=/in/.test(r),t.remove().css({top:0,left:0,display:"block"}).appendTo(i?this.$element:document.body),n=this.getPosition(i),"fixed"===this.$element.data("tooltip-position")&&(n.top-=e(window).scrollTop(),n.left-=e(window).scrollLeft(),t.addClass("tooltip-fixed")),a=t[0].offsetWidth,s=t[0].offsetHeight,i?r.split(" ")[1]:r){case"bottom":l={top:n.top+n.height,left:n.left+n.width/2-a/2};
break;case"top":l={top:n.top-s,left:n.left+n.width/2-a/2};break;case"left":l={top:n.top+n.height/2-s/2,left:n.left-a};break;case"right":l={top:n.top+n.height/2-s/2,left:n.left+n.width}}t.css(l).addClass(r).addClass("in")}},isHTML:function(e){return"string"!=typeof e||"<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3||/^(?:[^<]*<[\w\W]+>[^>]*$)/.exec(e)},setContent:function(){var e=this.tip(),t=this.getTitle();e.find(".tooltip-inner")[this.isHTML(t)?"html":"text"](t),e.removeClass("fade in top bottom left right")
},hide:function(){function t(){var t=setTimeout(function(){i.off(e.support.transition.end).remove()},500);i.one(e.support.transition.end,function(){clearTimeout(t),i.remove()})}var i=this.tip();i.removeClass("in"),e.support.transition&&this.$tip.hasClass("fade")?t():i.remove()},fixTitle:function(){var e=this.$element;(e.attr("title")||"string"!=typeof e.attr("data-original-title"))&&e.attr("data-original-title",e.attr("title")||"").removeAttr("title")},hasContent:function(){return this.getTitle()
},getPosition:function(t){return e.extend({},t?{top:0,left:0}:this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight})},getTitle:function(){var e,t=this.$element,i=this.options;return e=t.attr("data-original-title")||("function"==typeof i.title?i.title.call(t[0]):i.title)},tip:function(){return this.$tip=this.$tip||e(this.options.template)},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0
},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(){this[this.tip().hasClass("in")?"hide":"show"]()},destroy:function(){this.hide(),this.$element.off("."+this.type).removeData(this.type)}},e.fn.tooltip=function(i){return this.each(function(){var n=e(this),a=n.data("tooltip"),s="object"==typeof i&&i;a||n.data("tooltip",a=new t(this,s)),"string"==typeof i&&a[i]()})},e.fn.tooltip.Constructor=t,e.fn.tooltip.defaults={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover",title:"",delay:0}
}(window.jQuery),define("tooltip",function(){}),define("plex/desktop/control/init/GlobalInit",["plex/base/control/init/BaseInit","plex/desktop/control/Commands","button","dropdown","tooltip"],function(){}),define("hb!templates/desktop/modals/KeyboardShortcutsModal.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a,s="";return s+='\n		<p><span class="keyboard-shortcut"><span class="keyboard-shortcut-inner">cmd <span class="keyboard-shortcut-bridge">+</span> ',a={hash:{},data:t},s+=u((n=i.t||e.t,n?n.call(e,"click",a):h.call(e,"t","click",a)))+'</span></span><span class="keyboard-shortcut-label">',a={hash:{},data:t},s+=u((n=i.t||e.t,n?n.call(e,"Select Item in Media List",a):h.call(e,"t","Select Item in Media List",a)))+"</span></p>\n	"
}function r(e,t){var n,a,s="";return s+='\n		<p><span class="keyboard-shortcut"><span class="keyboard-shortcut-inner">ctrl <span class="keyboard-shortcut-bridge">+</span> ',a={hash:{},data:t},s+=u((n=i.t||e.t,n?n.call(e,"click",a):h.call(e,"t","click",a)))+'</span></span><span class="keyboard-shortcut-label">',a={hash:{},data:t},s+=u((n=i.t||e.t,n?n.call(e,"Select Item in Media List",a):h.call(e,"t","Select Item in Media List",a)))+"</span></p>\n	"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};
var l,o,c,d="",h=i.helperMissing,u=this.escapeExpression,p=this;return d+='<div class="modal-header">\n	<button type="button" class="close" data-dismiss="modal"><i class="glyphicon remove-2"></i></button>\n	<h3><i class="glyphicon keyboard-wireless"></i> ',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Keyboard Shortcuts",c):h.call(t,"t","Keyboard Shortcuts",c)))+'</h3>\n</div>\n\n<div class="modal-body minimal-scrollbar">\n	<h3 class="keyboard-shortcut-header">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Navigation",c):h.call(t,"t","Navigation",c)))+'</h3>\n	<p><span class="keyboard-shortcut"><span class="keyboard-shortcut-inner">?</span></span><span class="keyboard-shortcut-label">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Open Keyboard Shortcuts",c):h.call(t,"t","Open Keyboard Shortcuts",c)))+'</span></p>\n	<p><span class="keyboard-shortcut"><span class="keyboard-shortcut-inner">`</span></span><span class="keyboard-shortcut-label">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Toggle Sidebar",c):h.call(t,"t","Toggle Sidebar",c)))+'</span></p>\n	<p><span class="keyboard-shortcut"><span class="keyboard-shortcut-inner">esc</span></span><span class="keyboard-shortcut-label">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Navigate Back / Close Modal / Close Photo Viewer",c):h.call(t,"t","Navigate Back / Close Modal / Close Photo Viewer",c)))+'</span></p>\n	<p><span class="keyboard-shortcut"><span class="keyboard-shortcut-inner">g <span class="keyboard-shortcut-bridge">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"then",c):h.call(t,"t","then",c)))+'</span> h</span></span><span class="keyboard-shortcut-label">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Navigate to Home",c):h.call(t,"t","Navigate to Home",c)))+'</span></p>\n	<p><span class="keyboard-shortcut"><span class="keyboard-shortcut-inner">g <span class="keyboard-shortcut-bridge">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"then",c):h.call(t,"t","then",c)))+'</span> s</span></span><span class="keyboard-shortcut-label">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Navigate to Settings",c):h.call(t,"t","Navigate to Settings",c)))+'</span></p>\n	<p><span class="keyboard-shortcut"><span class="keyboard-shortcut-inner">g <span class="keyboard-shortcut-bridge">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"then",c):h.call(t,"t","then",c)))+'</span> a</span></span><span class="keyboard-shortcut-label">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Navigate to Activity",c):h.call(t,"t","Navigate to Activity",c)))+'</span></p>\n	<p><span class="keyboard-shortcut"><span class="keyboard-shortcut-inner">g <span class="keyboard-shortcut-bridge">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"then",c):h.call(t,"t","then",c)))+'</span> d</span></span><span class="keyboard-shortcut-label">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Navigate to Channel Directory",c):h.call(t,"t","Navigate to Channel Directory",c)))+'</span></p>\n	<p><span class="keyboard-shortcut"><span class="keyboard-shortcut-inner">g <span class="keyboard-shortcut-bridge">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"then",c):h.call(t,"t","then",c)))+'</span> c</span></span><span class="keyboard-shortcut-label">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Navigate to My Channels",c):h.call(t,"t","Navigate to My Channels",c)))+'</span></p>\n	<p><span class="keyboard-shortcut"><span class="keyboard-shortcut-inner">g <span class="keyboard-shortcut-bridge">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"then",c):h.call(t,"t","then",c)))+'</span> f</span></span><span class="keyboard-shortcut-label">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Navigate to Friends",c):h.call(t,"t","Navigate to Friends",c)))+'</span></p>\n	<p><span class="keyboard-shortcut"><span class="keyboard-shortcut-inner">g <span class="keyboard-shortcut-bridge">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"then",c):h.call(t,"t","then",c)))+'</span> r</span></span><span class="keyboard-shortcut-label">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Navigate to Recommendations",c):h.call(t,"t","Navigate to Recommendations",c)))+'</span></p>\n	<p><span class="keyboard-shortcut"><span class="keyboard-shortcut-inner">g <span class="keyboard-shortcut-bridge">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"then",c):h.call(t,"t","then",c)))+'</span> q</span></span><span class="keyboard-shortcut-label">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Navigate to Queue",c):h.call(t,"t","Navigate to Queue",c)))+'</span></p>\n\n	<h3 class="keyboard-shortcut-header">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Actions",c):h.call(t,"t","Actions",c)))+'</h3>\n	<p><span class="keyboard-shortcut"><span class="keyboard-shortcut-inner">p</span></span><span class="keyboard-shortcut-label">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Play",c):h.call(t,"t","Play",c)))+'</span></p>\n	<p><span class="keyboard-shortcut"><span class="keyboard-shortcut-inner">/</span></span><span class="keyboard-shortcut-label">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Focus Search",c):h.call(t,"t","Focus Search",c)))+'</span></p>\n	<p><span class="keyboard-shortcut"><span class="keyboard-shortcut-inner">+</span></span><span class="keyboard-shortcut-label">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Add Section",c):h.call(t,"t","Add Section",c)))+'</span></p>\n	<p><span class="keyboard-shortcut"><span class="keyboard-shortcut-inner">e</span></span><span class="keyboard-shortcut-label">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Edit Section / Edit Media",c):h.call(t,"t","Edit Section / Edit Media",c)))+'</span></p>\n	<p><span class="keyboard-shortcut"><span class="keyboard-shortcut-inner">shift <span class="keyboard-shortcut-bridge">+</span> s</span></span><span class="keyboard-shortcut-label">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Save Settings / Save Media",c):h.call(t,"t","Save Settings / Save Media",c)))+'</span></p>\n	<p><span class="keyboard-shortcut"><span class="keyboard-shortcut-inner">r</span></span><span class="keyboard-shortcut-label">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Refresh Section / Refresh Media",c):h.call(t,"t","Refresh Section / Refresh Media",c)))+'</span></p>\n	<p><span class="keyboard-shortcut"><span class="keyboard-shortcut-inner"># <span class="keyboard-shortcut-bridge">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"or",c):h.call(t,"t","or",c)))+'</span> del</span></span><span class="keyboard-shortcut-label">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Delete Section / Delete Media",c):h.call(t,"t","Delete Section / Delete Media",c)))+'</span></p>\n	<p><span class="keyboard-shortcut"><span class="keyboard-shortcut-inner">a</span></span><span class="keyboard-shortcut-label">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Analyze Media",c):h.call(t,"t","Analyze Media",c)))+'</span></p>\n	<p><span class="keyboard-shortcut"><span class="keyboard-shortcut-inner">w</span></span><span class="keyboard-shortcut-label">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Mark as Watched",c):h.call(t,"t","Mark as Watched",c)))+'</span></p>\n	<p><span class="keyboard-shortcut"><span class="keyboard-shortcut-inner">u</span></span><span class="keyboard-shortcut-label">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Mark as Unwatched",c):h.call(t,"t","Mark as Unwatched",c)))+'</span></p>\n	<p><span class="keyboard-shortcut"><span class="keyboard-shortcut-inner">s</span></span><span class="keyboard-shortcut-label">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Sync",c):h.call(t,"t","Sync",c)))+'</span></p>\n	<p><span class="keyboard-shortcut"><span class="keyboard-shortcut-inner">i</span></span><span class="keyboard-shortcut-label">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Info",c):h.call(t,"t","Info",c)))+'</span></p>\n\n	<h3 class="keyboard-shortcut-header">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Player",c):h.call(t,"t","Player",c)))+'</h3>\n	<p><span class="keyboard-shortcut"><span class="keyboard-shortcut-inner">space</span></span><span class="keyboard-shortcut-label">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Play / Pause",c):h.call(t,"t","Play / Pause",c)))+'</span></p>\n	<p><span class="keyboard-shortcut"><span class="keyboard-shortcut-inner">shift <span class="keyboard-shortcut-bridge">+</span> ',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"down",c):h.call(t,"t","down",c)))+'</span></span><span class="keyboard-shortcut-label">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Decrease Volume",c):h.call(t,"t","Decrease Volume",c)))+'</span></p>\n	<p><span class="keyboard-shortcut"><span class="keyboard-shortcut-inner">shift <span class="keyboard-shortcut-bridge">+</span> ',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"up",c):h.call(t,"t","up",c)))+'</span></span><span class="keyboard-shortcut-label">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Increase Volume",c):h.call(t,"t","Increase Volume",c)))+'</span></p>\n	<p><span class="keyboard-shortcut"><span class="keyboard-shortcut-inner">,</span></span><span class="keyboard-shortcut-label">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Seek Backward (10 seconds)",c):h.call(t,"t","Seek Backward (10 seconds)",c)))+'</span></p>\n	<p><span class="keyboard-shortcut"><span class="keyboard-shortcut-inner">.</span></span><span class="keyboard-shortcut-label">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Seek Forward (10 seconds)",c):h.call(t,"t","Seek Forward (10 seconds)",c)))+'</span></p>\n	<p><span class="keyboard-shortcut"><span class="keyboard-shortcut-inner">[</span></span><span class="keyboard-shortcut-label">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Step Backward (10%)",c):h.call(t,"t","Step Backward (10%)",c)))+'</span></p>\n	<p><span class="keyboard-shortcut"><span class="keyboard-shortcut-inner">]</span></span><span class="keyboard-shortcut-label">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Step Forward (10%)",c):h.call(t,"t","Step Forward (10%)",c)))+'</span></p>\n	<p><span class="keyboard-shortcut"><span class="keyboard-shortcut-inner">shift <span class="keyboard-shortcut-bridge">+</span> ',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"left",c):h.call(t,"t","left",c)))+'</span></span><span class="keyboard-shortcut-label">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Skip to Previous Track / Photo",c):h.call(t,"t","Skip to Previous Track / Photo",c)))+'</span></p>\n	<p><span class="keyboard-shortcut"><span class="keyboard-shortcut-inner">shift <span class="keyboard-shortcut-bridge">+</span> ',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"right",c):h.call(t,"t","right",c)))+'</span></span><span class="keyboard-shortcut-label">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Skip to Next Track / Photo",c):h.call(t,"t","Skip to Next Track / Photo",c)))+'</span></p>\n\n	<h3 class="keyboard-shortcut-header">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Clicks",c):h.call(t,"t","Clicks",c)))+'</h3>\n	<p><span class="keyboard-shortcut"><span class="keyboard-shortcut-inner">alt <span class="keyboard-shortcut-bridge">+</span> ',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"click",c):h.call(t,"t","click",c)))+'</span></span><span class="keyboard-shortcut-label">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Trigger Deep Scan of Section",c):h.call(t,"t","Trigger Deep Scan of Section",c)))+"</span></p>\n	",o=i["if"].call(t,t.mac,{hash:{},inverse:p.program(3,r,a),fn:p.program(1,s,a),data:a}),(o||0===o)&&(d+=o),d+='\n	<p><span class="keyboard-shortcut"><span class="keyboard-shortcut-inner">shift <span class="keyboard-shortcut-bridge">+</span> ',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"click",c):h.call(t,"t","click",c)))+'</span></span><span class="keyboard-shortcut-label">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Select Range of Items in Media List",c):h.call(t,"t","Select Range of Items in Media List",c)))+"</span></p>\n</div>\n"
})}),define("plex/desktop/view/modals/KeyboardShortcutsModal",["hb!templates/desktop/modals/KeyboardShortcutsModal.tpl","plex/base/view/modals/BaseModal"],function(e,t){var i=t.extend({name:"keyboardShortcutsModal",className:"modal keyboard-shortcuts-modal fade",events:{hidden:"close"},render:function(){return this.$el.html(e({mac:navigator.appVersion.indexOf("Mac")>-1})).modal(),this}});return i}),function(){function e(e,t,i){return e.addEventListener?(e.addEventListener(t,i,!1),void 0):(e.attachEvent("on"+t,i),void 0)
}function t(e){if("keypress"==e.type){var t=String.fromCharCode(e.which);return e.shiftKey||(t=t.toLowerCase()),t}return y[e.which]?y[e.which]:b[e.which]?b[e.which]:String.fromCharCode(e.which).toLowerCase()}function i(e,t){return e.sort().join(",")===t.sort().join(",")}function n(e,t){e=e||{};var i,n=!1;for(i in C)e[i]&&C[i]>t?n=!0:C[i]=0;n||(A=!1)}function a(e,t,n,a,s){var r,l,o=[],d=n.type;if(!k[e])return[];for("keyup"==d&&c(e)&&(t=[e]),r=0;k[e].length>r;++r)l=k[e][r],l.seq&&C[l.seq]!=l.level||d==l.action&&("keypress"==d&&!n.metaKey&&!n.ctrlKey||i(t,l.modifiers))&&(a&&l.combo==s&&k[e].splice(r,1),o.push(l));
return o}function s(e){var t=[];return e.shiftKey&&t.push("shift"),e.altKey&&t.push("alt"),e.ctrlKey&&t.push("ctrl"),e.metaKey&&t.push("meta"),t}function r(e,t,i){T.stopCallback(t,t.target||t.srcElement,i)||e(t,i)===!1&&(t.preventDefault&&t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.returnValue=!1,t.cancelBubble=!0)}function l(e,t,i){var s,l=a(e,t,i),o={},d=0,h=!1;for(s=0;l.length>s;++s)l[s].seq?(h=!0,d=Math.max(d,l[s].level),o[l[s].seq]=1,r(l[s].callback,i,l[s].combo)):h||A||r(l[s].callback,i,l[s].combo);
i.type!=A||c(e)||n(o,d)}function o(e){"number"!=typeof e.which&&(e.which=e.keyCode);var i=t(e);if(i)return"keyup"==e.type&&_==i?(_=!1,void 0):(T.handleKey(i,s(e),e),void 0)}function c(e){return"shift"==e||"ctrl"==e||"alt"==e||"meta"==e}function d(){clearTimeout(v),v=setTimeout(n,1e3)}function h(){if(!g){g={};for(var e in y)e>95&&112>e||y.hasOwnProperty(e)&&(g[y[e]]=e)}return g}function u(e,t,i){return i||(i=h()[e]?"keydown":"keypress"),"keypress"==i&&t.length&&(i="keydown"),i}function p(e,i,a,s){C[e]=0,s||(s=u(i[0],[]));
var l,o=function(){A=s,++C[e],d()},c=function(i){r(a,i,e),"keyup"!==s&&(_=t(i)),setTimeout(n,10)};for(l=0;i.length>l;++l)f(i[l],i.length-1>l?o:c,s,e,l)}function f(e,t,i,n,s){S[e+":"+i]=t,e=e.replace(/\s+/g," ");var r,l,o,d=e.split(" "),h=[];if(d.length>1)return p(e,d,t,i),void 0;for(o="+"===e?["+"]:e.split("+"),r=0;o.length>r;++r)l=o[r],x[l]&&(l=x[l]),i&&"keypress"!=i&&w[l]&&(l=w[l],h.push("shift")),c(l)&&h.push(l);i=u(l,h,i),k[l]||(k[l]=[]),a(l,h,{type:i},!n,e),k[l][n?"unshift":"push"]({callback:t,modifiers:h,action:i,seq:n,level:s,combo:e})
}function m(e,t,i){for(var n=0;e.length>n;++n)f(e[n],t,i)}for(var g,v,y={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta",19:"pause",403:"red",404:"green",405:"yellow",406:"blue",412:"rewind",413:"stop",415:"play",417:"fastforward",457:"info",461:"esc"},b={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},w={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},x={option:"alt",command:"meta","return":"enter",escape:"esc"},k={},S={},C={},_=!1,A=!1,I=1;20>I;++I)y[111+I]="f"+I;
for(I=0;9>=I;++I)y[I+96]=I;e(document,"keypress",o),e(document,"keydown",o),e(document,"keyup",o);var T={bind:function(e,t,i){return e=e instanceof Array?e:[e],m(e,t,i),this},unbind:function(e,t){return T.bind(e,function(){},t)},trigger:function(e,t){return S[e+":"+t]&&S[e+":"+t]({},e),this},reset:function(){return k={},S={},this},stopCallback:function(e,t){return(" "+t.className+" ").indexOf(" mousetrap ")>-1?!1:"INPUT"==t.tagName||"SELECT"==t.tagName||"TEXTAREA"==t.tagName||t.contentEditable&&"true"==t.contentEditable
},handleKey:l,MAP:y};window.Mousetrap=T,"function"==typeof define&&define.amd&&define("mousetrap",T)}(),define("plex/base/control/BaseShortcuts",["plex/base/control/Dispatcher","plex/base/control/utils/FocusManager","plex/base/model/AppModel","plex/base/model/SettingsModel","plex/desktop/view/modals/KeyboardShortcutsModal","backbone","mousetrap"],function(e,t,i,n,a){var s=function(){this.initialize.apply(this,arguments)};return s.extend=Backbone.Router.extend,_.extend(s.prototype,Backbone.Events,{shortcuts:{"?":"help",up:"up",down:"down",left:"left",right:"right",esc:"escape","`":"sidebar","g h":"dashboard","g s":"settings","g f":"friends","g r":"recommendations","g q":"queue","g c":"channels","g d":"directory","g a":"activity","/":"search",e:"edit","shift+s":"save",r:"refresh",a:"analyze",w:"markWatched",u:"markUnwatched",s:"sync",i:"info",p:"play","+":"addSection","#,del":"deleteItem",space:"playPause","shift+down":"decreaseVolume","shift+up":"increaseVolume",",":"seekBackward",".":"seekForward","[":"stepBackward","]":"stepForward","shift+left":"skipBackward","shift+right":"skipForward"},initialize:function(){_.each(_.keys(this.shortcuts),_.bind(function(e){var t=this.shortcuts[e];
/.+,.+/.test(e)&&(e=e.split(",")),Mousetrap.bind(e,_.wrap(this[t],this.wrapper))},this))},wrapper:function(e){return n.get("keyboardShortcuts")?e.apply(this,_.toArray(arguments).slice(1)):void 0},help:function(){i.set("modal",new a)},up:function(){return t.navigate("up"),!1},down:function(){return t.navigate("down"),!1},left:function(){return t.navigate("left"),!1},right:function(){return t.navigate("right"),!1},escape:function(){e._callbacks["shortcut:escape"]?e.trigger("shortcut:escape"):e.trigger("navigate:back")
},sidebar:function(){e.trigger("shortcut:sidebar")},dashboard:function(){e.trigger("navigate:dashboard")},settings:function(){e.trigger("navigate:settings")},friends:function(){e.trigger("navigate:friends")},recommendations:function(){e.trigger("navigate:playlist",{playlistName:"recommendations"})},queue:function(){e.trigger("navigate:playlist",{playlistName:"queue"})},channels:function(){e.trigger("navigate:myChannels")},directory:function(){e.trigger("navigate:directory")},activity:function(){e.trigger("navigate:notifications")
},search:function(){return e.trigger("shortcut:search"),!1},edit:function(){e.trigger("shortcut:edit")},save:function(){e.trigger("shortcut:save")},refresh:function(){e.trigger("shortcut:refresh")},analyze:function(){e.trigger("shortcut:analyze")},markWatched:function(){e.trigger("shortcut:markWatched")},markUnwatched:function(){e.trigger("shortcut:markUnwatched")},sync:function(){e.trigger("shortcut:sync")},info:function(){e.trigger("shortcut:info")},play:function(){e.trigger("shortcut:play")},addSection:function(){e.trigger("command:AddSection",!0)
},deleteItem:function(){e.trigger("shortcut:deleteItem")},playPause:function(){return e.trigger("shortcut:playPause"),!1},increaseVolume:function(){e.trigger("shortcut:increaseVolume")},decreaseVolume:function(){e.trigger("shortcut:decreaseVolume")},seekBackward:function(){e.trigger("shortcut:seekBackward")},seekForward:function(){e.trigger("shortcut:seekForward")},stepBackward:function(){e.trigger("shortcut:stepBackward")},stepForward:function(){e.trigger("shortcut:stepForward")},skipBackward:function(){e.trigger("shortcut:skipBackward")
},skipForward:function(){e.trigger("shortcut:skipForward")}}),s}),define("plex/base/model/HeaderModel",["backbone"],function(){var e=Backbone.Model.extend({defaults:{show:!1,showBack:!1,activeView:null,activeSearch:null,activeServer:null,activeSection:null,activeMedia:null,activeChannel:null,activeChannelMedia:null},reset:function(e){this.set({activeView:e,activeSearch:"",activeServer:null,activeSection:null,activeMedia:null,activeChannel:null,activeChannelMedia:null})}});return new e}),define("plex/base/model/media/MovieModel",["plex/base/model/media/MediaModel"],function(e){var t=e.extend();
return t}),define("plex/base/model/media/EpisodeModel",["plex/base/model/media/MediaModel"],function(e){var t=e.extend({parse:function(t){var i=e.prototype.parse.call(this,t);return i.watched=i.viewCount>0,i}});return t}),define("plex/base/model/media/collections/EpisodeCollection",["plex/base/control/utils/ParseUtil","plex/base/model/collections/BaseCollection","plex/base/model/media/EpisodeModel","jquery"],function(e,t,i){var n=t.extend({model:i,allowSync:!1,url:function(){return this.media.get("key")
},initialize:function(e,t){this.server=t.server,this.section=t.section,this.media=t.media,t.url&&(this.url=t.url)},parse:function(t){var i=this.convert(t);return e.parseBoolean(i,"allowSync"),this.allowSync=i.allowSync,i.Video}});return n}),define("plex/base/model/media/SeasonModel",["plex/base/model/media/MediaModel","plex/base/model/media/collections/EpisodeCollection"],function(e,t){var i=e.extend({constructor:function(){var t=e.prototype.constructor.apply(this,arguments);return _.isEmpty(t)?t:(i.prototype.initialize.apply(t,arguments),t)
},initialize:function(){e.prototype.initialize.apply(this,arguments),this.get("episodes")||this.set("episodes",new t([],{server:this.server,section:this.section,media:this}))},release:function(){var t=e.prototype.release.call(this);t&&this.get("episodes").release()},getMediaLocation:function(){var e=this.get("episodes").first();return e?e.getMediaLocation():null}});return i}),define("plex/base/model/media/collections/SeasonCollection",["plex/base/control/utils/ParseUtil","plex/base/model/collections/BaseCollection","plex/base/model/media/SeasonModel","jquery"],function(e,t,i){var n=t.extend({model:i,allowSync:!1,url:function(){return this.media.get("key")
},initialize:function(e,t){this.server=t.server,this.section=t.section,this.media=t.media},parse:function(t){var i=this.convert(t);return e.parseBoolean(i,"allowSync"),e.parseArray(i,"Directory"),this.allowSync=i.allowSync,_.each(i.Directory,function(e){e.parentThumb=i.thumb}),i.Directory}});return n}),define("plex/base/model/media/ShowModel",["plex/base/model/media/MediaModel","plex/base/model/media/collections/SeasonCollection"],function(e,t){var i=e.extend({constructor:function(){var t=e.prototype.constructor.apply(this,arguments);
return _.isEmpty(t)?t:(i.prototype.initialize.apply(t,arguments),t)},initialize:function(){e.prototype.initialize.apply(this,arguments),this.get("seasons")||this.set("seasons",new t([],{server:this.server,section:this.section,media:this}))},release:function(){var t=e.prototype.release.call(this);t&&this.get("seasons").release()},getMediaLocation:function(){var e=this.get("seasons").first();return e?e.getMediaLocation():null}});return i}),define("plex/base/model/media/collections/AlbumCollection",["plex/base/control/utils/ParseUtil","plex/base/model/collections/BaseCollection","plex/base/model/media/AlbumModel","jquery"],function(e,t,i){var n=t.extend({model:i,allowSync:!1,url:function(){return this.media.get("key")
},initialize:function(e,t){this.server=t.server,this.section=t.section,this.media=t.media},parse:function(t){var i=this.convert(t);return e.parseBoolean(i,"allowSync"),this.allowSync=i.allowSync,i.Directory}});return n}),define("plex/base/model/media/ArtistModel",["plex/base/model/media/MediaModel","plex/base/model/media/collections/AlbumCollection"],function(e,t){var i=e.extend({constructor:function(){var t=e.prototype.constructor.apply(this,arguments);return _.isEmpty(t)?t:(i.prototype.initialize.apply(t,arguments),t)
},initialize:function(){e.prototype.initialize.apply(this,arguments),this.get("albums")||this.set("albums",new t([],{server:this.server,section:this.section,media:this}))},release:function(){var t=e.prototype.release.call(this);t&&this.get("albums").release()},getMediaLocation:function(){var e=this.get("albums").last();return e?e.getMediaLocation():null}});return i}),define("plex/base/model/media/PhotoAlbumModel",["plex/base/model/media/MediaModel","plex/base/model/media/collections/PhotoCollection"],function(e,t){var i=e.extend({constructor:function(){var t=e.prototype.constructor.apply(this,arguments);
return _.isEmpty(t)?t:(i.prototype.initialize.apply(t,arguments),t)},initialize:function(){e.prototype.initialize.apply(this,arguments),this.get("photos")||this.set("photos",new t([],{server:this.server,section:this.section,media:this}))},release:function(){var t=e.prototype.release.call(this);t&&this.get("photos").release()}});return i}),define("plex/base/model/media/DetailsModel",["plex/base/control/utils/ParseUtil","plex/base/model/BaseModel","plex/base/model/media/MediaModel","plex/base/model/media/MovieModel","plex/base/model/media/ShowModel","plex/base/model/media/SeasonModel","plex/base/model/media/EpisodeModel","plex/base/model/media/ArtistModel","plex/base/model/media/AlbumModel","plex/base/model/media/TrackModel","plex/base/model/media/PhotoAlbumModel","plex/base/model/media/PhotoModel","jquery"],function(e,t,i,n,a,s,r,l,o,c,d,h,u){var p=t.extend({idAttribute:"ratingKey",url:function(){var e=(""+this.section.id).match(/^(\S+)\/library\//),t="";
return e&&e.length>1&&(t+=e[1]),t+="/library/metadata/"+this.id+"?checkFiles=1"},convert:function(t){var i=_.isObject(t)?t:u.xml2json(t);return e.parseBoolean(i,"allowSync"),i},parse:function(e){var t=this.convert(e),u=t.Directory||t.Video||t.Track||t.Photo||t;t.originalRatingKey&&(this.idAttribute="originalRatingKey");var p;if(u.type){switch(u.identifier=t.identifier,u.mediaTagPrefix=t.mediaTagPrefix,u.mediaTagVersion=t.mediaTagVersion,u.allowSync=t.allowSync,/^(photo|photoalbum)$/.test(u.type)&&/\/children$/.test(u.key)&&(u.type="photoAlbum"),u.type){case"movie":p=n;
break;case"show":p=a;break;case"season":p=s;break;case"episode":p=r;break;case"artist":p=l;break;case"album":p=o;break;case"track":p=c;break;case"photoAlbum":p=d;break;case"photo":p=h;break;default:p=i}this.defaults=p.prototype.defaults;var f=new p(u,{server:this.server,section:this.section,parse:!0});this.set("media",f),u=f.attributes}return u}});return p}),define("plex/base/model/SearchProviderModel",["plex/base/model/BaseModel","jquery"],function(e,t){var i=e.extend({idAttribute:"key",whitelistedAttrs:["key","machineIdentifier","type","title"],convert:function(e){var i=_.isObject(e)?e:t.xml2json(e);
return i},parse:function(e){var t=this.convert(e);return t=_.pick(t,this.whitelistedAttrs)}});return i}),define("plex/base/model/collections/SearchProviderCollection",["plex/base/model/collections/BaseCollection","plex/base/model/SearchProviderModel","jquery"],function(e,t){var i=e.extend({model:t,initialize:function(e,t){this.server=t.server,this.query=t.query},url:function(){return"/system/search?query="+this.query},parse:function(e){return this.convert(e,"Provider")}});return i}),define("plex/base/control/BaseRouter",["plex/base/control/Dispatcher","plex/base/model/AppModel","plex/base/model/SettingsModel","plex/base/model/HeaderModel","plex/base/model/media/DetailsModel","plex/base/model/media/PlaylistItemModel","plex/base/model/ChannelModel","plex/base/model/media/ClipModel","plex/base/model/collections/SearchProviderCollection","plex/base/model/collections/ChannelCollection","plex/base/model/media/collections/MediaCollection","plex/base/model/media/collections/EpisodeCollection","jquery","backbone"],function(e,t,i,n,a,s,r,l,o,c,d,h,u){var p=Backbone.Router.extend({history:null,routes:{"":"empty","!/dashboard":"dashboard","!/playlist/:playlistName":"playlist","!/playlist/:playlistName/player/:itemID":"playlistPlayer","!/search/:query":"search","!/settings/:serverID":"settings","!/settings":"settings","!/servers/:serverID/sections/add":"addSection","!/servers/:serverID/sections/:sectionID/details/:mediaID":"details","!/servers/:serverID/sections/:sectionID/player/:mediaID?offset=:offset":"player","!/servers/:serverID/sections/:sectionID/player/:mediaID":"player","!/servers/:serverID/sections/:sectionID/folder?key=:folderID":"sectionFolder","!/servers/:serverID/sections/:sectionID/folder":"sectionFolder","!/servers/:serverID/sections/:sectionID/filter?type=:type&key=:key&value=:value&title=:title":"sectionFilter","!/servers/:serverID/sections/:sectionID/filter?type=:type&key=:key&value=:value":"sectionFilter","!/servers/:serverID/sections/:sectionID/:subset":"section","!/servers/:serverID/sections/:sectionID":"section","!/channels/:serverID":"myChannels","!/channels":"myChannels","!/servers/:serverID/channels?key=:key&path=:path":"channel","!/servers/:serverID/channels?key=:key":"channel","!/servers/:serverID/channels?identifier=:identifier&path=:path":"channelByIdentifier","!/servers/:serverID/channels?identifier=:identifier":"channelByIdentifier","!/servers/:serverID/channels/details?key=:key&path=:path":"channelDetails","!/servers/:serverID/channels/details?identifier=:identifier&path=:path":"channelDetailsByIdentifier","!/servers/:serverID/channels/details?path=:path":"channelStandaloneDetails","!/servers/:serverID/channels/player?key=:key&path=:path":"channelPlayer","!/servers/:serverID/channels/player?identifier=:identifier&path=:path":"channelPlayerByIdentifier","!/servers/:serverID/channels/player?path=:path&offset=:offset":"channelStandalonePlayer","!/servers/:serverID/channels/player?path=:path":"channelStandalonePlayer","!/login":"login","!/unsupported":"unsupported","*404":"error"},authExemptRoutes:["empty","login","unsupported","info","logs","error"],historyExemptRoutes:["empty","login","unsupported"],trackingExemptRoutes:["empty"],initialize:function(i){this.history=[],new i.Navigator({router:this}),t.on("change:modal",function(e,t){t.name&&this.track(t.name)
},this);var n=this.trackingExemptRoutes.slice(0);n.unshift(_.uniq(_.values(this.routes)));var a=_.without.apply(_,n);_.each(a,function(e){this[e]=_.wrap(this[e],function(t){this.track("route:"+e),t.apply(this,_.toArray(arguments).slice(1))})},this),n=this.authExemptRoutes.slice(0),n.unshift(_.uniq(_.values(this.routes)));var s=_.without.apply(_,n);_.each(s,function(e){this[e]=_.wrap(this[e],function(e){this.checkAuthorization()&&e.apply(this,_.toArray(arguments).slice(1))})},this),this._bindRoutes(),(new this.views.app).render(),e.trigger("command:ShowLoading",!0);
var r=_.once(_.bind(function(){this.initializeAnalytics(),e.trigger("command:ShowLoading",!1),Backbone.history.start()},this));t.get("initialized")===!0?r():t.on("change:initialized",r)},track:function(e){/^route:/.test(e)&&(e=e.replace("route:",""),-1===_.indexOf(this.historyExemptRoutes,e)&&(this.history.push(Backbone.history.fragment),n.set("showBack",this.history.length>1))),_.isString(e)&&"undefined"!=typeof _gamanager&&_gamanager.track(e)},checkAuthorization:function(){var i=t.get("myPlex");
return t.get("isAuthorized")?!0:i.get("isUnavailable")?(e.trigger("navigate:error","myPlex is down for maintenance."),!1):t.get("isUnsupported")?(e.trigger("navigate:unsupported"),!1):(e.trigger("navigate:login"),!1)},checkServerAuthorization:function(t){return t.get("shared")?(e.trigger("navigate:error","This page is only available for your media servers."),!1):!0},initializeAnalytics:function(){if("undefined"!=typeof _gamanager){var e=t.get("primaryServer");_gamanager.set({id:1,name:"Version",value:t.get("version")}),e&&(_gamanager.set({id:2,name:"PMS Version",value:e.get("version")}),_gamanager.set({id:3,name:"Shared",value:""+e.get("shared")}))
}},empty:function(){e.trigger("navigate:dashboard")},dashboard:function(){n.reset("dashboard");var e=this.views.dashboard,i=t.get("servers");t.set("view",new e({collection:i}))},playlist:function(i){n.reset();var a=this.views.playlist,s=t.get("myPlex"),r=s.get("playlists")[i];return s.get("signedIn")?(r.fetch().done(function(){t.set("view",new a({collection:r}))}).fail(function(t,i){e.trigger("navigate:error","Please sign in to myPlex to access your playlists.",i)}),void 0):(e.trigger("navigate:login"),void 0)
},playlistPlayer:function(i,a){n.reset();var r=this.views.player,l=t.get("myPlex"),o=new s({id:a},{server:t.get("myPlex"),playlistName:i});return l.get("signedIn")?(o.fetch().done(function(){t.set("view",new r({model:o}))}).fail(function(t,i){e.trigger("navigate:error","Please sign in to myPlex to access your playlists.",i)}),void 0):(e.trigger("navigate:login"),void 0)},search:function(a){var s=this.views.search,r=t.get("servers"),l=t.get("primaryServer"),c=[],h=[],p=[],f=!1,m=!1;n.reset(),n.set("activeSearch",decodeURIComponent(a)),r.each(function(e){return e.get("remote")&&!i.get("remoteSearch")?(f=!0,void 0):(p.push(e.populate({hideLoadingAlert:!0}).done(function(){if(!e.supports("search"))return m=!0,void 0;
var t=new d([],{server:e,url:"/search?local=1&query="+a});if(h.push(t),e.id===l.id&&i.get("channelSearch")){p.push(t.fetch());var n=new o([],{server:e});c.push(n)}var s=new d([],{server:e,url:"/search?type=10&query="+a});h.push(s)})),void 0)}),u.when.apply(u,p).always(function(){h.length?t.set("view",new s({query:decodeURIComponent(a),providers:c,collections:h})):m?e.trigger("navigate:error","Search requires Plex Media Server 0.9.7.0 or later."):f?e.trigger("navigate:error","Search remote libraries is disabled."):e.trigger("navigate:error","This media server is currently unavailable.")
})},settings:function(i){n.reset("settings");var a=this.views.settings;i?this.populateActiveObjects(i).done(function(e){t.set("view",new a({model:e.activeServer}))}).fail(function(t,i){e.trigger("navigate:error","This media server is currently unavailable.",i)}):t.set("view",new a({model:t.get("primaryServer")}))},section:function(i,a,s){var r=this.views.section;this.populateActiveObjects(i,decodeURIComponent(a)).done(function(e){n.set(e),t.set("view",new r({model:e.activeSection,subset:s}))}).fail(function(t,i){e.trigger("navigate:error","This section is currently unavailable.",i)
})},sectionFilter:function(i,a,s,r,l,o){var c=this.views.section;l&&(l=decodeURIComponent(l)),o&&(o=decodeURIComponent(o)),this.populateActiveObjects(i,decodeURIComponent(a)).done(function(e){n.set(e);var i=e.activeSection.get("media"),a=e.activeSection.get("alphanumeric");i.mediaType=s,i.subset="all",i.scrollPosition=0,i.linearFilter={},i.filters=[],i.sort={},i.search="",i.firstCharacter=null;var d={key:r,values:l.split(",")};o&&(d.titles=o.split(",")),"title"===r&&(n.set("activeSearch",l),i.search=l),i.filters.push(d),a.filters=i.filters,a.populatePromise=null,t.set("view",new c({model:e.activeSection,subset:i.subset}))
}).fail(function(t,i){e.trigger("navigate:error","This section is currently unavailable.",i)})},sectionFolder:function(i,a,s){var r=this.views.sectionFolder;this.populateActiveObjects(i,decodeURIComponent(a)).done(function(e){n.set(e),t.set("view",new r({model:e.activeSection,folderID:s}))}).fail(function(t,i){e.trigger("navigate:error","This channel is currently unavailable.",i)})},details:function(i,a,s){var r=this.views.details;this.populateActiveObjects(i,decodeURIComponent(a),s).done(function(e){n.set(e),t.set("view",new r({model:e.activeMedia.get("media")}))
}).fail(function(t,i){e.trigger("navigate:error","This media is currently unavailable.",i)})},player:function(i,a,s,r){var l=this.views.player;this.populateActiveObjects(i,decodeURIComponent(a),s).done(function(e){function i(){var e={model:s,offset:parseInt(r,10)};a&&a.length&&(e.collection=a),t.set("view",new l(e))}n.set(e);var a,s=e.activeMedia.get("media"),o=s.get("parentKey");o?(a=new h([],{server:e.activeServer,section:e.activeSection,url:o+"/children"}),a.fetch().done(i)):i()}).fail(function(t,i){e.trigger("navigate:error","This media is currently unavailable.",i)
})},myChannels:function(i){n.reset();var a=this.views.myChannels;if(i)this.populateActiveObjects(i).done(_.bind(function(e){this.checkServerAuthorization(e.activeServer)&&t.set("view",new a({collection:e.activeServer.get("channels")}))},this)).fail(function(t,i){e.trigger("navigate:error","This media server is currently unavailable.",i)});else{var s=t.get("primaryServer");this.checkServerAuthorization(s)&&t.set("view",new a({collection:s.get("channels")}))}},channel:function(i,a,s){var r=this.views.channel;
this.populateActiveObjects(i).done(_.bind(function(e){this.populateChannelObjects({server:e.activeServer,key:a,path:s}).done(function(i){e.activeChannel=i.channel,e.activeChannelMedia=i.channelMedia,n.set(e),t.set("view",new r({channel:i.channel,model:i.channelMedia?i.channelMedia:i.channel}))})},this)).fail(function(t,i){e.trigger("navigate:error","This media server is currently unavailable.",i)})},channelByIdentifier:function(i,a,s){var r=this.views.channel;this.populateActiveObjects(i).done(_.bind(function(e){this.populateChannelObjects({server:e.activeServer,identifier:a,path:s}).done(function(i){e.activeChannel=i.channel,e.activeChannelMedia=i.channelMedia,n.set(e),t.set("view",new r({channel:i.channel,model:i.channelMedia?i.channelMedia:i.channel}))
})},this)).fail(function(t,i){e.trigger("navigate:error","This media server is currently unavailable.",i)})},channelDetails:function(i,a,s){var r=this.views.details;this.populateActiveObjects(i).done(_.bind(function(e){this.populateChannelObjects({server:e.activeServer,key:a,path:s,ChannelConstructor:l}).done(function(i){e.activeChannel=i.channel,e.activeChannelMedia=i.channelMedia,n.set(e),t.set("view",new r({model:i.channelMedia}))})},this)).fail(function(t,i){e.trigger("navigate:error","This media server is currently unavailable.",i)
})},channelDetailsByIdentifier:function(i,a,s){var r=this.views.details;this.populateActiveObjects(i).done(_.bind(function(e){this.populateChannelObjects({server:e.activeServer,identifier:a,path:s,ChannelConstructor:l}).done(function(i){e.activeChannel=i.channel,e.activeChannelMedia=i.channelMedia,n.set(e),t.set("view",new r({model:i.channelMedia}))})},this)).fail(function(t,i){e.trigger("navigate:error","This media server is currently unavailable.",i)})},channelStandaloneDetails:function(i,a){var s=this.views.details;
this.populateActiveObjects(i).done(_.bind(function(e){this.populateChannelObjects({server:e.activeServer,path:a,ChannelConstructor:l}).done(function(i){e.activeChannelMedia=i.channelMedia,n.set(e),t.set("view",new s({model:i.channelMedia}))})},this)).fail(function(t,i){e.trigger("navigate:error","This media server is currently unavailable.",i)})},channelPlayer:function(i,a,s){var r=this.views.player;this.populateActiveObjects(i).done(_.bind(function(e){this.populateChannelObjects({server:e.activeServer,key:a,path:s,ChannelConstructor:l}).done(function(i){e.activeChannel=i.channel,e.activeChannelMedia=i.channelMedia,n.set(e),t.set("view",new r({model:i.channelMedia}))
})},this)).fail(function(t,i){e.trigger("navigate:error","This media server is currently unavailable.",i)})},channelPlayerByIdentifier:function(i,a,s){var r=this.views.player;this.populateActiveObjects(i).done(_.bind(function(e){this.populateChannelObjects({server:e.activeServer,identifier:a,path:s,ChannelConstructor:l}).done(function(i){e.activeChannel=i.channel,e.activeChannelMedia=i.channelMedia,n.set(e),t.set("view",new r({model:i.channelMedia}))})},this)).fail(function(t,i){e.trigger("navigate:error","This media server is currently unavailable.",i)
})},channelStandalonePlayer:function(i,a,s){var r=this.views.player;this.populateActiveObjects(i).done(_.bind(function(e){this.populateChannelObjects({server:e.activeServer,path:a,ChannelConstructor:l}).done(function(i){e.activeChannelMedia=i.channelMedia,n.set(e),t.set("view",new r({model:i.channelMedia,offset:parseInt(s,10)}))})},this)).fail(function(t,i){e.trigger("navigate:error","This media server is currently unavailable.",i)})},login:function(){n.reset(),t.set("view",new this.views.login)},unsupported:function(){n.reset(),t.set("view",new this.views.unsupported)
},error:function(e,i,a){n.reset(),i=i||"This page doesn't exist... yet.",t.set("view",new this.views.error({message:i,error:a}))},populateActiveObjects:function(e,i,n){var s=t.get("servers"),r={activeView:"",activeSearch:"",activeServer:null,activeSection:null,activeMedia:null,activeChannel:null,activeChannelMedia:null},l=s.populate().pipe(function(){return r.activeServer=s.get(e),r.activeServer?i?r.activeServer.get("sections").populate():r:u.Deferred().reject(r)});return i&&(l=l.pipe(function(e){if(r.activeSection=e.get(i),!r.activeSection)return u.Deferred().reject(r);
if(!n)return r;var t=new a({ratingKey:n},{server:r.activeServer,section:r.activeSection});return t.fetch({timeout:4e4})})),n&&(l=l.pipe(function(e){return r.activeMedia=e,r.activeMedia?r:u.Deferred().reject(r)})),l.promise()},populateChannelObjects:function(t){var i,n,a=u.Deferred(),s=[],l={};if((t.key||t.identifier)&&(t.key?l.key=decodeURIComponent(t.key):t.identifier&&(l.identifier=t.identifier),i=new r(l,{server:t.server}),i.get("noCache")?s.push(i.fetch()):s.push(i.populate())),t.path){var o=t.ChannelConstructor||r;
n=new o({key:decodeURIComponent(t.path)},{server:t.server,channel:i}),n.get("noCache")?s.push(n.fetch({timeout:4e4})):s.push(n.populate({timeout:4e4}))}return u.when.apply(u,s).done(function(){a.resolve({channel:i,channelMedia:n})}).fail(function(t,i){e.trigger("navigate:error","This channel is currently unavailable.",i),a.reject()}),a}});return p}),define("plex/base/control/BaseNavigator",["plex/base/control/Dispatcher"],function(e){var t=function(){this.initialize.apply(this,arguments)};return t.extend=Backbone.Router.extend,_.extend(t.prototype,Backbone.Events,{routes:{back:"onNavigateBack",redirect:"onNavigateRedirect",dashboard:"onNavigateDashboard",playlist:"onNavigatePlaylist",playlistPlayer:"onNavigatePlaylistPlayer",search:"onNavigateSearch",settings:"onNavigateSettings",section:"onNavigateSection",sectionFilter:"onNavigateSectionFilter",sectionFolder:"onNavigateSectionFolder",details:"onNavigateDetails",player:"onNavigatePlayer",myChannels:"onNavigateMyChannels",channel:"onNavigateChannel",channelSearch:"onNavigateChannelSearch",channelDetails:"onNavigateChannelDetails",channelStandaloneDetails:"onNavigateChannelStandaloneDetails",channelPlayer:"onNavigateChannelPlayer",channelStandalonePlayer:"onNavigateChannelStandalonePlayer",login:"onNavigateLogin",unsupported:"onNavigateUnsupported",error:"onNavigateError"},initialize:function(t){this.router=t.router,_.each(_.keys(this.routes),_.bind(function(t){var i=this.routes[t];
e.on("navigate:"+t,this[i],this)},this))},navigate:function(e,t){t||(t={}),this.router.navigate(e,{trigger:!t.silent}),t.silent&&this.router.history.push(e)},buildFragment:function(e,t){t||(t={});var i=e.match(/:\w+/g);return i&&i.length&&_.each(i,function(i){var n=i.slice(1),a=t[n];if(a!==void 0)e=e.replace(i,encodeURIComponent(a));else{var s=RegExp("\\([^\\)]*"+i+"[^\\)]*\\)","g");e=e.replace(s,"")}}),e.replace(/\(|\)/g,"")},onNavigateBack:function(){if(this.router.history.length>1){var t=this.router.history.splice(-2);
this.router.navigate(t[0],{trigger:!0})}else e.trigger("navigate:dashboard")},onNavigateRedirect:function(t){var i=this.router.history.length,n=!!window.history.replaceState;i>1&&n&&window.history.replaceState(null,document.title,"#"+this.router.history[i-2]),n?window.location=t:(e.trigger("navigate:back"),window.open(t))},onNavigateDashboard:function(e){this.navigate("!/dashboard",e)},onNavigatePlaylist:function(e){var t=this.buildFragment("!/playlist/:playlistName",e);this.navigate(t,e)},onNavigatePlaylistPlayer:function(e){var t=this.buildFragment("!/playlist/:playlistName/player/:mediaID",e);
this.navigate(t,e)},onNavigateSearch:function(e){var t=this.buildFragment("!/search/:query",e);this.navigate(t,e)},onNavigateSettings:function(e){var t=this.buildFragment("!/settings(/:serverID)",e);this.navigate(t,e)},onNavigateSection:function(e){var t=this.buildFragment("!/servers/:serverID/sections/:sectionID(/:subset)",e);this.navigate(t,e)},onNavigateSectionFilter:function(e){var t=this.buildFragment("!/servers/:serverID/sections/:sectionID/filter?type=:type&key=:key&value=:value(&title=:title)",e);
this.navigate(t,e)},onNavigateSectionFolder:function(e){var t=this.buildFragment("!/servers/:serverID/sections/:sectionID/folder",e);this.navigate(t,e)},onNavigateDetails:function(e){var t=this.buildFragment("!/servers/:serverID/sections/:sectionID/details/:mediaID",e);this.navigate(t,e)},onNavigatePlayer:function(e){var t=this.buildFragment("!/servers/:serverID/sections/:sectionID/player/:mediaID(?offset=:offset)",e);this.navigate(t,e)},onNavigateMyChannels:function(e){var t=this.buildFragment("!/channels(/:serverID)",e);
this.navigate(t,e)},onNavigateChannel:function(e){var t=this.buildFragment("!/servers/:serverID/channels?(key=:key)(identifier=:identifier)(&path=:path)",e);this.navigate(t,e)},onNavigateChannelSearch:function(e){e.search+=e.search.indexOf("?")>0?"&":"?",e.path=e.search+"query="+e.query;var t=this.buildFragment("!/servers/:serverID/channels?(key=:key)(identifier=:identifier)&path=:path",e);this.navigate(t,e)},onNavigateChannelDetails:function(e){var t=this.buildFragment("!/servers/:serverID/channels/details?(key=:key)(identifier=:identifier)&path=:path",e);
this.navigate(t,e)},onNavigateChannelStandaloneDetails:function(e){var t=this.buildFragment("!/servers/:serverID/channels/details?path=:path",e);this.navigate(t,e)},onNavigateChannelPlayer:function(e){var t=this.buildFragment("!/servers/:serverID/channels/player?(key=:key)(identifier=:identifier)&path=:path",e);this.navigate(t,e)},onNavigateChannelStandalonePlayer:function(e){var t=this.buildFragment("!/servers/:serverID/channels/player?path=:path(&offset=:offset)",e);this.navigate(t,e)},onNavigateLogin:function(e){this.navigate("!/login",e)
},onNavigateUnsupported:function(e){this.navigate("!/unsupported",e)},onNavigateError:function(e,t){this.router.error("",e,t)}}),t}),define("plex/desktop/control/Navigator",["plex/base/control/BaseNavigator"],function(e){var t=e.extend({routes:_.extend({setup:"onNavigateSetup",friends:"onNavigateFriends",notifications:"onNavigateNotifications",sync:"onNavigateSync",nowplaying:"onNavigateNowPlaying",edit:"onNavigateEdit",directory:"onNavigateChannelDirectory",info:"onNavigateInfo",logs:"onNavigateLogs"},e.prototype.routes),onNavigateSetup:function(e){this.navigate("!/setup",e)
},onNavigateFriends:function(e){this.navigate("!/friends",e)},onNavigateNotifications:function(e){var t=this.buildFragment("!/notifications(/:serverID)",e);this.navigate(t,e)},onNavigateSync:function(e){var t=this.buildFragment("!/sync(/:serverID)",e);this.navigate(t,e)},onNavigateNowPlaying:function(e){var t=this.buildFragment("!/nowplaying(/:serverID)",e);this.navigate(t,e)},onNavigateEdit:function(e){var t=this.buildFragment("!/servers/:serverID/sections/:sectionID/edit/:mediaID",e);this.navigate(t,e)
},onNavigateChannelDirectory:function(e){var t=this.buildFragment("!/directory(/:serverID)",e);this.navigate(t,e)},onNavigateInfo:function(e){this.navigate("!/info",e)},onNavigateLogs:function(e){this.navigate("!/logs",e)}});return t}),define("hb!templates/base/alerts/LoadingAlert.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){return this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{},'<i class="loading-icon glyphicon more"></i>\n'})}),define("plex/base/view/alerts/LoadingAlert",["hb!templates/base/alerts/LoadingAlert.tpl","plex/base/model/ConfigModel","plex/base/view/BaseView","spin"],function(e,t,i){var n=i.extend({className:"alert loading",spinner:null,initialize:function(){t.get("animations")&&(this.spinner=new Spinner({color:"#fff",width:3,length:5}))
},render:function(){return this.$el.html(e()),this.spinner&&this.$el.append(this.spinner.spin().el),this},destroy:function(){this.spinner&&this.spinner.stop(),i.prototype.destroy.call(this)}});return n}),define("hb!templates/base/alerts/Alert.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return'\n	<i class="alert-status glyphicon ok-2"></i>\n'}function r(e,t){var n,a,s,r="";return r+="\n	",s={hash:{},inverse:p.program(6,o,t),fn:p.program(4,l,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,e.status,"error",s):f.call(e,"if_eq",e.status,"error",s),(a||0===a)&&(r+=a),r+="\n"
}function l(){return'\n		<i class="alert-status glyphicon warning-sign"></i>\n	'}function o(){return'\n		<i class="alert-status glyphicon circle-exclamation-mark"></i>\n	'}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var c,d,h,u="",p=this,f=i.helperMissing,m=this.escapeExpression;return u+='<a class="close-btn gray" href="#"><i class="glyphicon circle-remove"></i></a>\n\n',h={hash:{},inverse:p.program(3,r,a),fn:p.program(1,s,a),data:a},c=i.if_eq||t.if_eq,d=c?c.call(t,t.status,"success",h):f.call(t,"if_eq",t.status,"success",h),(d||0===d)&&(u+=d),u+='\n\n<div class="alert-message">\n	',h={hash:{},data:a},u+=m((c=i.t||t.t,c?c.call(t,t.message,h):f.call(t,"t",t.message,h)))+"\n</div>\n"
})}),define("plex/base/view/alerts/Alert",["hb!templates/base/alerts/Alert.tpl","plex/base/model/AppModel","plex/base/view/BaseView"],function(e,t,i){var n=i.extend({className:"alert animated-slow scaleInOut",active:!1,pending:!1,events:{mouseenter:"onMouseEnter",mouseleave:"onMouseLeave","click .close-btn":"onCloseClick"},initialize:function(e){this.alert=_.isString(e.alert)?{message:e.alert}:e.alert},render:function(){return this.$el.html(e(this.alert)),this.animateIn(),this},animateIn:function(){setTimeout(_.bind(function(){this.active?(this.pending=!0,this.$el.css("animation-play-state","paused")):this.animateOut()
},this),2e3)},animateOut:function(){this.$el.css("animation-play-state","running"),setTimeout(_.bind(function(){this.destroy()},this),1e3)},destroy:function(){i.prototype.destroy.call(this),t.set("alert",null)},onMouseEnter:function(){this.active=!0},onMouseLeave:function(){this.active=!1,this.pending&&this.animateOut()},onCloseClick:function(e){e.preventDefault(),this.$el.css("opacity",0),setTimeout(_.bind(function(){this.destroy()},this),500)}});return n}),define("plex/base/control/utils/BaseTranscoder",["plex/base/control/utils/MediaUtil","plex/base/control/utils/NetUtil","underscore"],function(e,t){var i={image:function(e,i,n,a){if(!i)return"";
var s={url:e.resolveUrl(i,!0),width:parseInt(n,10),height:parseInt(a,10)},r="/photo/:/transcode?"+t.param(s);return e.resolveUrl(r,!1,!0)},music:function(e,i){var n=_.first(i.get("Media"));if(n){var a=_.first(n.Part);if(a){var s,r;return e.supports("universalMusicTranscoder")?(s={path:e.resolveUrl(i.get("key"),!0),mediaIndex:0,partIndex:0},r="/music/:/transcode/universal/start.mp3"):(s={identifier:i.get("identifier"),url:e.resolveUrl(a.key,!0),format:"mp3",audioCodec:"libmp3lame",audioBitrate:320,audioSamples:44100},r="/music/:/transcode/generic.mp3"),s=_.extend(s,e.getHeaders()),e.resolveUrl(r+"?"+t.param(s))
}}},video:function(i,n,a,s,r){var l=_.indexOf(n.get("Media"),a),o=_.indexOf(a.Part,s);r||(r={});var c=_.extend({path:i.resolveUrl(n.get("key"),!0),mediaIndex:l,partIndex:o,protocol:"hls",offset:0,fastSeek:1,directPlay:0,directStream:1,videoQuality:e.qualities[12],videoResolution:e.resolutions[12],maxVideoBitrate:e.bitrates[12],subtitleSize:100,audioBoost:100},r);c.path=c.path.replace(/^http[s]?:\/\/node.plexapp.com:[\d]+\//,i.url());var d=n.get("indirectHttpHeaders");d&&(c.httpCookies=d.Cookie,c.userAgent=d["User-Agent"]),c=_.extend(c,i.getHeaders());
var h="dash"===c.protocol?"mpd":"m3u8",u="/video/:/transcode/universal/start."+h;return i.resolveUrl(u+"?"+t.param(c))}};return i}),SHA256_hexchars=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],SHA256_K=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],define("sha256",function(){}),define("plex/desktop/control/utils/Transcoder",["plex/base/control/utils/BaseTranscoder","plex/base/control/utils/MediaUtil","plex/base/control/utils/NetUtil","plex/base/control/utils/LogUtil","plex/base/model/AppModel","plex/base/model/SettingsModel","jquery","base64","sha256"],function(e,t,i,n,a,s,r){var l="KQMIY6GATPC63AIMC4R2",o=decode64("k3U6GLkZOoNIoSgjDshPErvqMIFdE0xMTx8kgsrhnC0="),c=_.extend(_.clone(e),{image:function(t,i,n,s){if(!t||"myPlex"===t.id||t.get("synced")){var r=a.get("primaryServer");
r&&r.get("isAvailable")&&(t=r)}return e.image.call(this,t,i,n,s)},video:function(e,t,i,n,a,s,l){if(l||(l={}),e.supports("universalTranscoder")){var o=this.getUniversalTranscoderUrl(e,t,i,n,l);return a(o),void 0}var c=this.getTranscoderUrl(e,t,n);r.ajax(e.getAjaxOptions(c)).done(function(t){var i=t.replace(/[\s\S]+(session.+?\.m3u8)[\s\S]+/,"$1"),n=e.resolveUrl("video/:/transcode/segmented/")+i;a(n)}).fail(function(){s()})},getTranscoderUrl:function(e,r,c){var d=e.get("remote")?s.get("remoteQuality"):s.get("quality"),h=Math.round((new Date).getTime()/1e3),u={identifier:r.get("identifier"),key:e.resolveUrl(r.get("key"),!0),url:e.resolveUrl(c.key,!0),session:a.get("clientID"),offset:0,quality:d,subtitleSize:s.get("subtitleSize"),audioBoost:s.get("audioBoost"),"3g":0},p=r.get("indirectHttpHeaders");
p&&(u.httpCookies=p.Cookie,u.userAgent=p["User-Agent"]);var f="/video/:/transcode/segmented/start.m3u8?"+i.param(u);HMAC_SHA256_init(o),HMAC_SHA256_write(f+"@"+h);var m=HMAC_SHA256_finalize(),g=encode64(array_to_string(m)),v=t.capabilities;s.get("preferAAC")&&(v=t.capabilities.replace("audioDecoders=mp3,aac","audioDecoders=aac")),s.get("directStream")||(v=t.capabilities.replace(/videoDecoders=[^;]+;audioDecoders=[^;]+/,""));var y=_.extend(e.getHeaders(),{"X-Plex-Access-Key":l,"X-Plex-Access-Code":g,"X-Plex-Access-Time":h,"X-Plex-Client-Capabilities":v});
return n.log("transcoding with old transcoder"),n.log("capabilities: "+v),n.log("quality: "+u.quality),n.log("subtitleSize: "+u.subtitleSize),n.log("audioBoost: "+u.audioBoost),f+"&"+i.param(y)},getUniversalTranscoderUrl:function(i,r,l,o,c){var d=i.get("remote")?s.get("remoteQuality"):s.get("quality"),h=_.extend({session:a.get("clientID"),directStream:s.get("directStream")?1:0,videoQuality:t.qualities[d],videoResolution:t.resolutions[d],maxVideoBitrate:t.bitrates[d],subtitleSize:s.get("subtitleSize"),audioBoost:s.get("audioBoost")},c);
return s.get("preferAAC")&&(h["X-Plex-Client-Profile-Extra"]="add-transcode-target-audio-codec(type=videoProfile&context=streaming&protocol=hls&audioCodec=aac)"),n.log("transcoding with universal transcoder"),n.log("directStream: "+h.directStream),n.log("videoQuality: "+h.videoQuality),n.log("videoResolution: "+h.videoResolution),n.log("maxVideoBitrate: "+h.maxVideoBitrate),n.log("subtitleSize: "+h.subtitleSize),n.log("audioBoost: "+h.audioBoost),h["X-Plex-Client-Profile-Extra"]&&n.log("profileExtra: "+h["X-Plex-Client-Profile-Extra"]),e.video.call(this,i,r,l,o,h)
}});return c}),define("plex/base/model/PlayerModel",["backbone"],function(){var e=Backbone.Model.extend({defaults:{currentTime:0,duration:0,formattedTime:"0:00",formattedDuration:"0:00",volume:0,paused:!0,ended:!1,buffering:!1,startBuffer:0,endBuffer:0,enablePrevious:!1,enableNext:!1,thumb:null},reset:function(){this.set(this.defaults)}});return e}),define("hb!templates/desktop/players/core/MusicControlsView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return"disabled"
}function r(){return"hide"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var l,o="",c="function",d=this.escapeExpression,h=this;return o+='<a class="now-playing-album" href="#"></a>\n\n<div class="now-playing">\n	<a class="now-playing-title" href="#">',(l=i.title)?l=l.call(t,{hash:{},data:a}):(l=t.title,l=typeof l===c?l.apply(t):l),o+=d(l)+'</a>\n	<span class="now-playing-subtitle" href="#">',(l=i.title)?l=l.call(t,{hash:{},data:a}):(l=t.title,l=typeof l===c?l.apply(t):l),o+=d(l)+'</span>\n</div>\n\n<div class="player-controls-left">\n	<button class="player-previous-btn player-btn ',l=i.unless.call(t,t.enablePrevious,{hash:{},inverse:h.noop,fn:h.program(1,s,a),data:a}),(l||0===l)&&(o+=l),o+='"><i class="glyphicon rewind"></i></button>\n	<button class="player-play-btn player-play-pause-btn player-btn ',l=i["if"].call(t,t.paused,{hash:{},inverse:h.noop,fn:h.program(3,r,a),data:a}),(l||0===l)&&(o+=l),o+='"><i class="glyphicon play"></i></button>\n	<button class="player-pause-btn player-play-pause-btn player-btn ',l=i.unless.call(t,t.paused,{hash:{},inverse:h.noop,fn:h.program(3,r,a),data:a}),(l||0===l)&&(o+=l),o+='"><i class="glyphicon pause"></i></button>\n	<button class="player-stop-btn player-btn"><i class="glyphicon stop"></i></button>\n	<button class="player-next-btn player-btn ',l=i.unless.call(t,t.enableNext,{hash:{},inverse:h.noop,fn:h.program(1,s,a),data:a}),(l||0===l)&&(o+=l),o+='"><i class="glyphicon forward"></i></button>\n</div>\n\n<div class="player-controls-right">\n	<div class="player-time"><span class="player-current-time">',(l=i.formattedTime)?l=l.call(t,{hash:{},data:a}):(l=t.formattedTime,l=typeof l===c?l.apply(t):l),o+=d(l)+'</span> / <span class="player-duration">',(l=i.formattedDuration)?l=l.call(t,{hash:{},data:a}):(l=t.formattedDuration,l=typeof l===c?l.apply(t):l),o+=d(l)+'</span></div>\n</div>\n\n<div class="player-controls-center-wrapper">\n	<div class="player-controls-center"></div>\n</div>\n'
})}),define("plex/base/view/images/BaseImage",["plex/desktop/control/utils/Transcoder","plex/base/view/BaseView","jquery"],function(e,t,i){var n=window.devicePixelRatio?window.devicePixelRatio:1,a=window.URL&&window.URL.createObjectURL,s=function(){try{return!!new Blob}catch(e){return!1}}(),r=t.extend({tagName:"img",blobs:null,src:null,server:null,modelAttr:null,url:null,placeholder:null,transcode:!0,width:0,height:0,xhr:null,listening:!1,initialize:function(e){s&&a&&(this.blobs=[]),e&&this.setup(e)
},setup:function(e){var t=this.model,i=this.modelAttr;e.server&&(this.server=e.server),e.model&&(this.model=e.model),e.modelAttr&&(this.modelAttr=e.modelAttr),e.className&&this.$el.addClass(e.className),e.url?this.url=e.url:this.model&&this.modelAttr&&(this.model!==t||this.modelAttr!==i)&&(this.listening&&this.removeBinding(t,"change:"+i),this.url=this.model.get(this.modelAttr),this.addBinding(this.model,"change:"+this.modelAttr,this.onChange),this.listening=!0),this.transcode=e.transcode,this.placeholder=e.placeholder,e.transcode&&(this.width=e.width*n,this.height=e.height*n)
},render:function(){if(this.src||!this.url&&!this.placeholder)return this;var e=_.bind(function(e){this.$el.attr("src",e).removeAttr("width").removeAttr("height")},this),t=_.bind(function(t){this.src=t,e(t),this.$el.removeClass("placeholder"),this.trigger("load",t)},this);return this.placeholder?(e(this.placeholder),this.$el.addClass("placeholder")):e("img/blank.png"),this.load(this.url,this.transcode).done(t),this},update:function(e){if(!e||this.url===e)return this;this.url=e;var t=_.bind(function(e){this.src=e,this.$el.attr("src",e).removeAttr("width").removeAttr("height"),this.trigger("load",e)
},this);return this.load(this.url,this.transcode).done(t),this},destroy:function(){this.cancel(),this.blobs&&this.blobs.length&&_.each(this.blobs,function(e){window.URL.revokeObjectURL(e)}),t.prototype.destroy.call(this)},load:function(t,n){if(!t)return i.Deferred().reject().promise();if(n){var r=this.server||this.model.server;t=e.image(r,t,this.width,this.height)}return s&&a?this.loadBlob(t):this.loadImage(t)},loadBlob:function(e){var t=i.Deferred();this.cancel();var n=new XMLHttpRequest;return n.open("GET",e,!0),n.responseType="arraybuffer",this.xhr=n,n.onreadystatechange=_.bind(function(){if(4===n.readyState)if(n.onreadystatechange=null,this.xhr=null,200===n.status){var e=new Blob([n.response],{type:"image/jpeg"}),i=window.URL.createObjectURL(e);
this.blobs.push(i),t.resolve(i)}else t.reject()},this),n.send(),t.promise()},loadImage:function(e){function t(){s.off("load",t),s.off("error",n),a.resolve(e)}function n(){s.off("load",t),s.off("error",n),a.reject()}var a=i.Deferred(),s=i("<img>");return s.on("load",t),s.on("error",n),s.attr("src",e),a.promise()},cancel:function(){this.xhr&&(this.xhr.onreadystatechange=null,this.xhr.abort(),this.xhr=null)},onChange:function(e,t){this.update(t)}});return r}),define("hb!templates/desktop/players/core/SeekBarView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){return this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{},'<div class="player-slider-thumb player-progress-thumb"></div>\n<div class="player-slider-bar player-progress-bar"></div>\n<div class="player-buffer-bar"></div>'
})}),define("plex/desktop/view/players/core/SeekBarView",["hb!templates/desktop/players/core/SeekBarView.tpl","plex/base/view/BaseView","jquery"],function(e,t,i){var n=t.extend({className:"player-slider-track player-seek-bar",events:{mousedown:"onSeekBarMouseDown"},initialize:function(){_.bindAll(this,"onSeekBarMouseMove","onSeekBarMouseUp"),this.model.bind("change:currentTime",this.onCurrentTimeChange,this),this.model.bind("change:startBuffer",this.onBufferChange,this),this.model.bind("change:endBuffer",this.onBufferChange,this)
},render:function(){return this.$el.html(e()),this.onCurrentTimeChange(),this.onBufferChange(),this},seek:function(e){var t=e-this.$el.offset().left,i=t/this.$el.width();i=Math.min(Math.max(i,0),1);var n=i*this.model.get("duration");this.trigger("seek",n)},onSeekBarMouseDown:function(e){e.preventDefault(),i(document).on("mousemove",this.onSeekBarMouseMove),i(document).on("mouseup",this.onSeekBarMouseUp),this.seek(e.pageX)},onSeekBarMouseMove:function(e){e.preventDefault(),this.seek(e.pageX)},onSeekBarMouseUp:function(e){e.preventDefault(),i(document).off("mousemove",this.onSeekBarMouseMove),i(document).off("mouseup",this.onSeekBarMouseUp),this.seek(e.pageX)
},onCurrentTimeChange:function(){var e=this.$(".player-progress-thumb"),t=this.$(".player-progress-bar"),i=this.model.get("currentTime"),n=this.model.get("duration");if(n){var a=this.$el.width(),s=e.width()/2,r=i/n,l=r*a,o=(l-2*s)/a,c=Math.min(Math.max(100*o,0),100),d=Math.min(Math.max(100*r,0),100);e.css("left",c+"%"),t.css("width",d+"%")}},onBufferChange:function(){var e=this.$(".player-buffer-bar");this.$el.width();var t=this.model.get("duration"),i=100*(this.model.get("endBuffer")/t);_.isNaN(i)&&(i=0),i=Math.min(Math.max(i,0),100),e.css("left",0),e.css("width",i+"%")
}});return n}),define("hb!templates/desktop/players/core/SliderView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){return this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{},'<div class="player-slider-track">\n	<div class="player-slider-thumb"></div>\n	<div class="player-slider-bar"></div>\n</div>\n\n<button class="player-btn player-slider-btn glyphicon"></button>\n'})}),define("plex/desktop/view/players/core/SliderView",["hb!templates/desktop/players/core/SliderView.tpl","plex/base/view/BaseView","jquery"],function(e,t,i){var n=t.extend({currentValue:0,dragging:!1,events:{"click .player-slider-btn":"onButtonClick","mousedown .player-slider-track":"onSliderMouseDown"},initialize:function(){_.bindAll(this,"onSliderMouseMove","onSliderMouseUp")
},render:function(){return this.$el.html(e()),this},calculateValue:function(e){var t=this.$(".player-slider-track"),i=e-t.offset().left,n=i/t.width();n>1?n=1:0>n&&(n=0),this.currentValue=n,this.trigger("change:value",n)},setValue:function(e){this.currentValue=e;var t=this.$(".player-slider-track"),i=this.$(".player-slider-thumb"),n=this.$(".player-slider-bar"),a=t.width(),s=i.width()/2,r=e*a;s>r?r=s:r+s>a&&(r=a-s),i.css("left",Math.round(r-s)),n.width(Math.round(r))},onButtonClick:function(){this.trigger("click:button")
},onSliderMouseDown:function(e){e.preventDefault(),i(document).on("mousemove",this.onSliderMouseMove),i(document).on("mouseup",this.onSliderMouseUp),this.dragging=!0,this.$el.addClass("player-active-slider"),this.calculateValue(e.pageX)},onSliderMouseMove:function(e){e.preventDefault(),this.calculateValue(e.pageX)},onSliderMouseUp:function(e){e.preventDefault(),i(document).off("mousemove",this.onVolumeSliderMouseMove),i(document).off("mouseup",this.onVolumeSliderMouseUp),this.dragging=!1,this.$el.removeClass("player-active-slider"),this.calculateValue(e.pageX),this.trigger("release")
}});return n}),define("plex/desktop/view/players/core/MusicControlsView",["hb!templates/desktop/players/core/MusicControlsView.tpl","plex/base/view/BaseView","plex/base/view/images/BaseImage","plex/desktop/view/players/core/SeekBarView","plex/desktop/view/players/core/SliderView","jquery"],function(e,t,i,n,a,s){var r=t.extend({className:"player-controls",server:null,seekBar:null,volumeSlider:null,muted:!1,mutedVolume:0,hideVolume:!1,hideNowPlaying:!1,events:{"click .player-play-pause-btn":"onPlayPauseClick","click .player-stop-btn":"onStopClick","click .player-previous-btn":"onPreviousClick","click .player-next-btn":"onNextClick"},initialize:function(e){this.server=e.server,this.hideVolume=e.hideVolume,this.hideNowPlaying=e.hideNowPlaying,this.poster=this.registerView(new i({model:this.model,modelAttr:"thumb",placeholder:"img/posters/album.png",className:"poster now-playing-poster",transcode:!0,width:40,height:40})),this.seekBar=this.registerView(new n({model:this.model})),this.volumeSlider=this.registerView(new a({className:"player-volume"})),this.addBinding(this.model,"change:paused",this.onPausedChange),this.addBinding(this.model,"change:formattedTime",this.onCurrentTimeChange),this.addBinding(this.model,"change:formattedDuration",this.onDurationChange),this.addBinding(this.model,"change:volume",this.onVolumeChange),this.addBinding(this.model,"change:enablePrevious",this.onEnablePreviousChange),this.addBinding(this.model,"change:enableNext",this.onEnableNextChange),this.addBinding(this.seekBar,"seek",this.onSeek),this.addBinding(this.volumeSlider,"click:button",this.onVolumeSliderClick),this.addBinding(this.volumeSlider,"change:value",this.onVolumeSliderValueChange)
},render:function(){return this.$el.html(e(this.model.toJSON())),this.$(".now-playing-album").append(this.poster.render().el),this.$(".player-controls-center").append(this.seekBar.render().el),this.$(".player-controls-right").prepend(this.volumeSlider.render().el),this.onVolumeChange(),this.hideVolume===!0&&this.$(".player-volume").hide(),this.hideNowPlaying===!0&&this.$(".now-playing").hide(),this},onPlayPauseClick:function(){this.trigger("playPause")},onStopClick:function(){this.trigger("stop")
},onPreviousClick:function(e){s(e.currentTarget).hasClass("disabled")||this.trigger("previous")},onNextClick:function(e){s(e.currentTarget).hasClass("disabled")||this.trigger("next")},onPausedChange:function(){var e=this.model.get("paused");e?(this.$(".player-play-btn").removeClass("hide"),this.$(".player-pause-btn").addClass("hide")):(this.$(".player-play-btn").addClass("hide"),this.$(".player-pause-btn").removeClass("hide"))},onCurrentTimeChange:function(e,t){this.$(".player-current-time").text(t)
},onDurationChange:function(e,t){this.$(".player-duration").text(t)},onVolumeChange:function(e,t){var i=this.$(".player-volume .player-slider-btn");this.volumeSlider.setValue(t),t>.5?(this.muted=!1,i.removeClass("volume-low"),i.removeClass("volume-off")):.5>=t&&t>0?(this.muted=!1,i.addClass("volume-low"),i.removeClass("volume-off")):(this.muted=!0,i.addClass("volume-off"),i.removeClass("volume-low"))},onEnablePreviousChange:function(e,t){t?this.$(".player-previous-btn").removeClass("disabled"):this.$(".player-previous-btn").addClass("disabled")
},onEnableNextChange:function(e,t){t?this.$(".player-next-btn").removeClass("disabled"):this.$(".player-next-btn").addClass("disabled")},onSeek:function(e){this.trigger("seek",e)},onVolumeSliderClick:function(){this.muted===!0?(this.mutedVolume>0?this.trigger("change:volume",this.mutedVolume):this.trigger("change:volume",1),this.muted=!1,this.mutedVolume=0):(this.muted=!0,this.mutedVolume=this.model.get("volume"),this.trigger("change:volume",0))},onVolumeSliderValueChange:function(e){this.trigger("change:volume",e)
}});return r}),define("plex/desktop/view/players/MusicPlayerView",["plex/base/control/Dispatcher","plex/base/control/utils/NumberUtil","plex/base/control/utils/LocalizationUtil","plex/desktop/control/utils/Transcoder","plex/base/model/AppModel","plex/base/model/SettingsModel","plex/base/model/PlayerModel","plex/base/view/BaseView","plex/desktop/view/players/core/MusicControlsView"],function(e,t,i,n,a,s,r,l,o){var c=l.extend({className:"music-player hidden",playerModel:null,controls:null,transcoded:!1,loaded:!1,sound:null,volume:1,prevTrack:null,nextTrack:null,initialize:function(){_.bindAll(this,"onCreate","onPlay","onLoad","whileLoading","whitePlaying","onFinish"),this.volume=s.get("musicVolume"),this.playerModel=new r({showMusicIcon:!0}),this.playerModel.server=this.model.server,this.controls=this.registerView(new o({model:this.playerModel,hidePlaybackRate:!0,hideFullscreen:!0})),this.addBinding(e,"shortcut:playPause",this.onPlayPause),this.addBinding(e,"shortcut:decreaseVolume",this.onDecreaseVolume),this.addBinding(e,"shortcut:increaseVolume",this.onIncreaseVolume),this.addBinding(e,"shortcut:seekBackward",this.onSeekBackward),this.addBinding(e,"shortcut:seekForward",this.onSeekForward),this.addBinding(e,"shortcut:stepBackward",this.onStepBackward),this.addBinding(e,"shortcut:stepForward",this.onStepForward),this.addBinding(e,"shortcut:skipBackward",this.onPrevious),this.addBinding(e,"shortcut:skipForward",this.onNext),this.addBinding(this.controls,"playPause",this.onPlayPause),this.addBinding(this.controls,"previous",this.onPrevious),this.addBinding(this.controls,"next",this.onNext),this.addBinding(this.controls,"stop",this.onStop),this.addBinding(this.controls,"seek",this.onSeek),this.addBinding(this.controls,"change:volume",this.onVolumeChange)
},render:function(){return this.$el.empty(),this.$el.append(this.controls.render().el),this},postrender:function(){this.$el.removeClass("hidden")},play:function(){var s=_.first(this.model.get("Media")),r={parentTitle:this.model.get("originalTitle")||this.model.get("artist"),parentThumb:this.model.media.get("thumb"),thumb:this.model.get("thumb")};if(this.transcoded=!1,this.controls.server=this.model.server,s)if(this.transcoded=!/^(mp3|mp4)$/.test(s.container)||s.bitrate>320,this.transcoded){var l="myPlex"===this.model.server.id||this.model.server.get("synced"),o=l?a.get("primaryServer"):this.model.server,c=o.get("transcoderAudio");
if(!c)return e.trigger("stop:music"),a.set("alert",{status:"error",message:i.t("This media server does not support transcoding.")}),void 0;r.url=n.music(o,this.model)}else r.url=this.model.getDownloadUrl();else r.url=this.model.server.resolveUrl(this.model.get("key"),!1,!0);this.updateNowPlaying(r),this.findPrevTrack(),this.findNextTrack(),this.playerModel.reset(),this.playerModel.set({enablePrevious:!!this.prevTrack,enableNext:!!this.nextTrack,thumb:r.thumb?r.thumb:r.parentThumb}),this.transcoded&&this.playerModel.set({endBuffer:0,duration:s.duration/1e3,formattedDuration:t.secondsToHms(s.duration/1e3)}),this.loaded=!1,r.url?e.trigger("command:PlaySound",{url:r.url,autoLoad:!0,autoPlay:!0,volume:100*this.volume,oncreate:this.onCreate,onplay:this.onPlay,onload:this.onLoad,whileloading:this.whileLoading,whileplaying:this.whitePlaying,onfinish:this.onFinish}):(e.trigger("stop:music"),a.set("alert",{status:"error",message:i.t("Playback of this track is not supported.")}))
},updateNowPlaying:function(e){var t=this.model.section?this.model.section.id:this.model.get("librarySectionID");if(!t&&this.model.media&&(t=this.model.media.get("librarySectionID")),t)t=encodeURIComponent(t),e.artistLink="#!/servers/"+this.model.server.id+"/sections/"+t+"/details/"+this.model.media.id,e.albumLink=e.artistLink,this.model.media.media&&(e.artistLink="#!/servers/"+this.model.server.id+"/sections/"+t+"/details/"+this.model.media.media.id,e.parentTitle||(e.parentTitle=this.model.media.media.get("title")));
else{var i=this.model.media.channel?this.model.media.channel:this.model.media,n=this.model.media.channel;e.artistLink="#!/servers/"+this.model.server.id+"/channels?",e.artistLink+=i.id?"key="+encodeURIComponent(i.id):"identifier="+i.get("identifier"),n&&(e.artistLink+="&path="+encodeURIComponent(this.model.media.id)),e.albumLink=e.artistLink,e.parentTitle||(e.parentTitle=i.get("title")),!e.parentThumb&&n&&(e.parentThumb=n.get("thumb"))}this.$(".now-playing-album").attr("href",e.albumLink),this.$(".now-playing-title").attr("href",e.artistLink).text(e.parentTitle),this.$(".now-playing-subtitle").text(this.model.get("title"))
},findPrevTrack:function(){var e=this.collection.get(this.model.id),t=this.collection.indexOf(e);this.prevTrack=t>0?this.collection.at(t-1):null},findNextTrack:function(){var e=this.collection.get(this.model.id),t=this.collection.indexOf(e);this.nextTrack=this.collection.length>t+1?this.collection.at(t+1):null},hide:function(){this.$el.addClass("hidden"),setTimeout(_.bind(function(){this.destroy()},this),800)},onPlayPause:function(){if(this.sound){var e=this.playerModel.get("paused");this.sound.togglePause(),this.playerModel.set("paused",!e)
}},onStop:function(){this.sound=null,e.trigger("command:StopSound"),e.trigger("stop:music")},onPrevious:function(){this.prevTrack&&(this.model=this.prevTrack,this.play())},onNext:function(){this.nextTrack&&(this.model=this.nextTrack,this.play())},onDecreaseVolume:function(){var e=this.playerModel.get("volume");e=Math.round(10*(e-.1))/10,e=Math.max(e,0),this.onVolumeChange(e)},onIncreaseVolume:function(){var e=this.playerModel.get("volume");e=Math.round(10*(e+.1))/10,e=Math.min(e,1),this.onVolumeChange(e)
},onSeekBackward:function(){this.sound&&this.onSeek(this.sound.position/1e3-10)},onSeekForward:function(){this.sound&&this.onSeek(this.sound.position/1e3+10)},onStepBackward:function(){if(this.sound){var e=this.sound.durationEstimate;if(!e){var t=_.first(this.model.get("Media"));e=t.duration}var i=this.sound.position-.1*e;this.onSeek(i/1e3)}},onStepForward:function(){if(this.sound){var e=this.sound.durationEstimate;if(!e){var t=_.first(this.model.get("Media"));e=t.duration}var i=this.sound.position+.1*e;
this.onSeek(i/1e3)}},onSeek:function(e){this.sound&&(!this.transcoded||this.loaded)&&(e=Math.max(e,0),this.sound.setPosition(1e3*e),this.playerModel.set({currentTime:e,formattedTime:t.secondsToHms(e)}))},onVolumeChange:function(e){this.sound&&(this.sound.setVolume(100*e),this.volume=e,this.playerModel.set("volume",e),s.save("musicVolume",e))},onCreate:function(e){this.sound=e},onPlay:function(){this.playerModel.set({paused:!1,volume:this.volume})},whileLoading:function(){var e,i,n=_.first(this.model.get("Media"));
this.transcoded&&n?(e=n.duration,i=0):(e=this.sound.durationEstimate,i=this.sound.bytesLoaded/this.sound.bytesTotal*(e/1e3)),this.playerModel.set({endBuffer:i,duration:e/1e3,formattedDuration:t.secondsToHms(e/1e3)})},whitePlaying:function(){this.sound&&this.playerModel.set({currentTime:this.sound.position/1e3,formattedTime:t.secondsToHms(this.sound.position/1e3)})},onLoad:function(){var e=_.first(this.model.get("Media"));this.loaded=!0,this.transcoded&&e&&this.playerModel.set("endBuffer",e.duration/1e3)
},onFinish:function(){this.sound=null,null!==this.nextTrack?(this.model=this.nextTrack,this.play()):e.trigger("stop:music")}});return c}),define("hb!templates/desktop/popovers/PhotoPopover.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){return this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{},'<a class="close-btn gray" href="#" data-focus="keyboard"><i class="glyphicon remove-2"></i></a>\n\n<div class="spinner-container"></div>\n\n<div class="photo-controls">\n	<a class="previous-btn gray hide" href="#" data-focus="keyboard">\n		<i class="glyphicon chevron-left"></i>\n	</a>\n\n	<a class="next-btn gray hide" href="#" data-focus="keyboard">\n		<i class="glyphicon chevron-right"></i>\n	</a>\n</div>\n'
})}),define("hb!templates/desktop/popovers/PhotoPopoverDetailsView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return"hide"}function r(e,t){var n,a,s="";return s+='\n				<div class="card-details">\n					',a={hash:{},data:t},s+=u((n=i.truncate||e.truncate,n?n.call(e,(n=e.photo,null==n||n===!1?n:n.summary),500,a):h.call(e,"truncate",(n=e.photo,null==n||n===!1?n:n.summary),500,a)))+"\n				</div>\n			"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};
var l,o,c,d="",h=i.helperMissing,u=this.escapeExpression,p=this,f="function";return d+='<div class="photo-details-container">\n	<div class="photo-details">\n		<div class="photo-loading-overlay"></div>\n\n		<div class="card-overlay">\n			<div class="card-menu">\n				<button class="play-btn card-menu-btn ',l=i.unless.call(t,t.showPlay,{hash:{},inverse:p.noop,fn:p.program(1,s,a),data:a}),(l||0===l)&&(d+=l),d+='"><i class="glyphicon play"></i></button><button class="pause-btn card-menu-btn ',l=i.unless.call(t,t.showPause,{hash:{},inverse:p.noop,fn:p.program(1,s,a),data:a}),(l||0===l)&&(d+=l),d+='"><i class="glyphicon pause"></i></button><button class="remote-play-btn card-menu-btn ',l=i.unless.call(t,t.showRemotePlay,{hash:{},inverse:p.noop,fn:p.program(1,s,a),data:a}),(l||0===l)&&(d+=l),d+='" href="#"><i class="glyphicon display"></i></button><button class="edit-btn card-menu-btn ',l=i.unless.call(t,t.showEdit,{hash:{},inverse:p.noop,fn:p.program(1,s,a),data:a}),(l||0===l)&&(d+=l),d+='"><i class="glyphicon pencil"></i></button><button class="sync-btn card-menu-btn ',l=i.unless.call(t,t.showSync,{hash:{},inverse:p.noop,fn:p.program(1,s,a),data:a}),(l||0===l)&&(d+=l),d+='"><i class="glyphicon download"></i></button><button class="info-btn card-menu-btn"><i class="glyphicon circle-info"></i></button>\n			</div>\n\n			',c={hash:{},data:a},d+=u((l=i.truncate||t.truncate,l?l.call(t,(l=t.photo,null==l||l===!1?l:l.title),50,c):h.call(t,"truncate",(l=t.photo,null==l||l===!1?l:l.title),50,c)))+' <span class="card-count">',(o=i.index)?o=o.call(t,{hash:{},data:a}):(o=t.index,o=typeof o===f?o.apply(t):o),d+=u(o)+" ",c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"of",c):h.call(t,"t","of",c)))+" ",(o=i.total)?o=o.call(t,{hash:{},data:a}):(o=t.total,o=typeof o===f?o.apply(t):o),d+=u(o)+"</span>\n\n			",o=i["if"].call(t,(l=t.photo,null==l||l===!1?l:l.summary),{hash:{},inverse:p.noop,fn:p.program(3,r,a),data:a}),(o||0===o)&&(d+=o),d+="\n		</div>\n	</div>\n</div>\n"
})}),define("hb!templates/desktop/modals/SyncModal.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a;return a={hash:{},data:t},k((n=i.t||e.t,n?n.call(e,"Sync Settings",a):x.call(e,"t","Sync Settings",a)))}function r(e,t){var n,a;return a={hash:{},data:t},k((n=i.t||e.t,n?n.call(e,"Sync to Device",a):x.call(e,"t","Sync to Device",a)))}function l(){return'\n			<div class="plex-pass-restricted-container">\n				<div class="plex-pass-restricted">\n		'}function o(e,t){var n,a,s,r="";
return r+='\n			<div class="control-group">\n				<label for="title">',s={hash:{},data:t},r+=k((n=i.t||e.t,n?n.call(e,"Title",s):x.call(e,"t","Title",s)))+'</label>\n				<div class="control">\n					<input type="text" id="title" name="title" class="span5" value="',(a=i.title)?a=a.call(e,{hash:{},data:t}):(a=e.title,a=typeof a===S?a.apply(e):a),r+=k(a)+'" placeholder="',(a=i.title)?a=a.call(e,{hash:{},data:t}):(a=e.title,a=typeof a===S?a.apply(e):a),r+=k(a)+'">\n				</div>\n			</div>\n		'}function c(){return"selected"
}function d(){return"hide"}function h(){return"checked"}function u(e,t){var n,a="";return a+='value="',(n=i.limitValue)?n=n.call(e,{hash:{},data:t}):(n=e.limitValue,n=typeof n===S?n.apply(e):n),a+=k(n)+'"'}function p(e,t){var n,a,s="";return s+='\n				</div>\n\n				<div class="plex-pass-message-overlay">\n					<div class="empty-message plex-pass-message">\n						',a={hash:{},data:t},s+=k((n=i.t||e.t,n?n.call(e,"Sorry, you need a <a href='{1}' target='_blank'>PlexPass subscription</a> for this feature.","https://my.plexapp.com/subscription/about",a):x.call(e,"t","Sorry, you need a <a href='{1}' target='_blank'>PlexPass subscription</a> for this feature.","https://my.plexapp.com/subscription/about",a)))+"\n					</div>\n				</div>\n			</div>\n		"
}function f(){return"disabled"}function m(e,t){var n,a;return a={hash:{},data:t},k((n=i.t||e.t,n?n.call(e,"Save",a):x.call(e,"t","Save",a)))}function g(e,t){var n,a;return a={hash:{},data:t},k((n=i.t||e.t,n?n.call(e,"Sync",a):x.call(e,"t","Sync",a)))}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var v,y,b,w="",x=i.helperMissing,k=this.escapeExpression,S="function",C=this;return w+='<div class="modal-header">\n	<button type="button" class="close" data-dismiss="modal"><i class="glyphicon remove-2"></i></button>\n	<h3><i class="glyphicon download"></i> ',v=i["if"].call(t,t.edit,{hash:{},inverse:C.program(3,r,a),fn:C.program(1,s,a),data:a}),(v||0===v)&&(w+=v),w+='</h3>\n</div>\n\n<form id="sync-form" class="modal-form">\n	<div class="modal-body minimal-scrollbar">\n		',v=i.unless.call(t,t.hasSync,{hash:{},inverse:C.noop,fn:C.program(5,l,a),data:a}),(v||0===v)&&(w+=v),w+="\n\n		",v=i["if"].call(t,t.section,{hash:{},inverse:C.noop,fn:C.program(7,o,a),data:a}),(v||0===v)&&(w+=v),w+='\n\n		<div class="control-group">\n			<label for="quality">',b={hash:{},data:a},w+=k((v=i.t||t.t,v?v.call(t,"Quality",b):x.call(t,"t","Quality",b)))+'</label>\n			<select id="quality" name="quality">\n				<option value="low" ',b={hash:{},inverse:C.noop,fn:C.program(9,c,a),data:a},v=i.if_eq||t.if_eq,y=v?v.call(t,t.selectedQuality,"low",b):x.call(t,"if_eq",t.selectedQuality,"low",b),(y||0===y)&&(w+=y),w+=">",b={hash:{},data:a},w+=k((v=i.t||t.t,v?v.call(t,"Low",b):x.call(t,"t","Low",b)))+'</option>\n				<option value="medium" ',b={hash:{},inverse:C.noop,fn:C.program(9,c,a),data:a},v=i.if_eq||t.if_eq,y=v?v.call(t,t.selectedQuality,"medium",b):x.call(t,"if_eq",t.selectedQuality,"medium",b),(y||0===y)&&(w+=y),w+=">",b={hash:{},data:a},w+=k((v=i.t||t.t,v?v.call(t,"Medium",b):x.call(t,"t","Medium",b)))+'</option>\n				<option value="high" ',b={hash:{},inverse:C.noop,fn:C.program(9,c,a),data:a},v=i.if_eq||t.if_eq,y=v?v.call(t,t.selectedQuality,"high",b):x.call(t,"if_eq",t.selectedQuality,"high",b),(y||0===y)&&(w+=y),w+=">",b={hash:{},data:a},w+=k((v=i.t||t.t,v?v.call(t,"High",b):x.call(t,"t","High",b)))+'</option>\n				<option value="highest" ',b={hash:{},inverse:C.noop,fn:C.program(9,c,a),data:a},v=i.if_eq||t.if_eq,y=v?v.call(t,t.selectedQuality,"highest",b):x.call(t,"if_eq",t.selectedQuality,"highest",b),(y||0===y)&&(w+=y),w+=">",b={hash:{},data:a},w+=k((v=i.t||t.t,v?v.call(t,"Highest",b):x.call(t,"t","Highest",b)))+'</option>\n			</select>\n		</div>\n\n		<div class="control-group ',y=i.unless.call(t,t.video,{hash:{},inverse:C.noop,fn:C.program(11,d,a),data:a}),(y||0===y)&&(w+=y),w+=" ",y=i.unless.call(t,t.directory,{hash:{},inverse:C.noop,fn:C.program(11,d,a),data:a}),(y||0===y)&&(w+=y),w+='">\n			<label class="checkbox" for="unwatched"><input type="checkbox" id="unwatched" name="unwatched" ',y=i["if"].call(t,t.unwatched,{hash:{},inverse:C.noop,fn:C.program(13,h,a),data:a}),(y||0===y)&&(w+=y),w+="> ",b={hash:{},data:a},w+=k((v=i.t||t.t,v?v.call(t,"Unwatched",b):x.call(t,"t","Unwatched",b)))+'</label>\n		</div>\n\n		<div class="control-group ',y=i.unless.call(t,t.directory,{hash:{},inverse:C.noop,fn:C.program(11,d,a),data:a}),(y||0===y)&&(w+=y),w+='">\n			<label class="gap-label">',b={hash:{},data:a},w+=k((v=i.t||t.t,v?v.call(t,"Limit",b):x.call(t,"t","Limit",b)))+'</label>\n			<label class="radio inline"><input type="radio" name="limit" id="limit-none" value="all" ',b={hash:{},inverse:C.noop,fn:C.program(13,h,a),data:a},v=i.if_eq||t.if_eq,y=v?v.call(t,t.selectedLimit,"all",b):x.call(t,"if_eq",t.selectedLimit,"all",b),(y||0===y)&&(w+=y),w+="> ",b={hash:{},data:a},w+=k((v=i.t||t.t,v?v.call(t,"None",b):x.call(t,"t","None",b)))+'</label>\n			<label class="radio inline"><input type="radio" name="limit" id="limit-items" value="count" ',b={hash:{},inverse:C.noop,fn:C.program(13,h,a),data:a},v=i.if_eq||t.if_eq,y=v?v.call(t,t.selectedLimit,"count",b):x.call(t,"if_eq",t.selectedLimit,"count",b),(y||0===y)&&(w+=y),w+="> ",b={hash:{},data:a},w+=k((v=i.t||t.t,v?v.call(t,"By number of items",b):x.call(t,"t","By number of items",b)))+'</label>\n			<label class="radio inline ',y=i["if"].call(t,t.photo,{hash:{},inverse:C.noop,fn:C.program(11,d,a),data:a}),(y||0===y)&&(w+=y),w+='"><input type="radio" name="limit" id="limit-duration" value="duration" ',b={hash:{},inverse:C.noop,fn:C.program(13,h,a),data:a},v=i.if_eq||t.if_eq,y=v?v.call(t,t.selectedLimit,"duration",b):x.call(t,"if_eq",t.selectedLimit,"duration",b),(y||0===y)&&(w+=y),w+="> ",b={hash:{},data:a},w+=k((v=i.t||t.t,v?v.call(t,"By duration",b):x.call(t,"t","By duration",b)))+'</label>\n		</div>\n\n		<div class="limit-value-group control-group ',b={hash:{},inverse:C.noop,fn:C.program(11,d,a),data:a},v=i.if_eq||t.if_eq,y=v?v.call(t,t.selectedLimit,"all",b):x.call(t,"if_eq",t.selectedLimit,"all",b),(y||0===y)&&(w+=y),w+='">\n			<input type="text" id="limit-value" class="input-dark inline" ',y=i["if"].call(t,t.limitValue,{hash:{},inverse:C.noop,fn:C.program(15,u,a),data:a}),(y||0===y)&&(w+=y),w+='> <span class="limit-items-label limit-label inline ',b={hash:{},inverse:C.noop,fn:C.program(11,d,a),data:a},v=i.if_neq||t.if_neq,y=v?v.call(t,t.selectedLimit,"count",b):x.call(t,"if_neq",t.selectedLimit,"count",b),(y||0===y)&&(w+=y),w+='">',b={hash:{},data:a},w+=k((v=i.t||t.t,v?v.call(t,"items",b):x.call(t,"t","items",b)))+'</span><span class="limit-duration-label limit-label inline ',b={hash:{},inverse:C.noop,fn:C.program(11,d,a),data:a},v=i.if_neq||t.if_neq,y=v?v.call(t,t.selectedLimit,"duration",b):x.call(t,"if_neq",t.selectedLimit,"duration",b),(y||0===y)&&(w+=y),w+='">',b={hash:{},data:a},w+=k((v=i.t||t.t,v?v.call(t,"minutes",b):x.call(t,"t","minutes",b)))+"</span>\n		</div>\n\n		",y=i.unless.call(t,t.hasSync,{hash:{},inverse:C.noop,fn:C.program(17,p,a),data:a}),(y||0===y)&&(w+=y),w+='\n	</div>\n\n	<div class="modal-footer">\n		<button type="submit" class="btn btn-primary ',y=i.unless.call(t,t.hasSync,{hash:{},inverse:C.noop,fn:C.program(19,f,a),data:a}),(y||0===y)&&(w+=y),w+='" data-focus="keyboard">',y=i["if"].call(t,t.edit,{hash:{},inverse:C.program(23,g,a),fn:C.program(21,m,a),data:a}),(y||0===y)&&(w+=y),w+='</button>\n		<button type="button" class="btn cancel-btn" data-focus="keyboard">',b={hash:{},data:a},w+=k((v=i.t||t.t,v?v.call(t,"Cancel",b):x.call(t,"t","Cancel",b)))+'</button>\n	</div>\n</form>\n\n<div class="sync-success-container hide">\n	<div class="modal-body pull-center">\n		<p class="success-icon"><i class="glyphicon ok-2"></i></p>\n\n		<h4>\n			',b={hash:{},data:a},w+=k((v=i.t||t.t,v?v.call(t,"This media will be synced to your device.",b):x.call(t,"t","This media will be synced to your device.",b)))+"\n			<br>\n			",b={hash:{},data:a},w+=k((v=i.t||t.t,v?v.call(t,"Watch the sync status <a class='status-btn' href='#'>here</a>.",b):x.call(t,"t","Watch the sync status <a class='status-btn' href='#'>here</a>.",b)))+'\n		</h4>\n	</div>\n\n	<div class="modal-footer pull-center">\n		<button type="button" class="done-btn btn btn-medium btn-primary">',b={hash:{},data:a},w+=k((v=i.t||t.t,v?v.call(t,"Done",b):x.call(t,"t","Done",b)))+"</button>\n	</div>\n</div>\n"
})}),define("plex/desktop/view/modals/SyncModal",["hb!templates/desktop/modals/SyncModal.tpl","plex/base/control/Dispatcher","plex/base/control/utils/SyncQualities","plex/base/model/AppModel","plex/base/model/SettingsModel","plex/base/view/modals/BaseModal","jquery"],function(e,t,i,n,a,s,r){var l=s.extend({name:"syncModal",className:"modal sync-modal fade",device:null,edit:!1,directory:!1,section:!1,subset:null,models:null,limit:"all",events:{hidden:"close","change input[name=limit]":"onLimitChange","submit form":"onSubmit","click .cancel-btn":"onCancel","click .done-btn":"onDoneClick","click .status-btn":"onStatusClick"},initialize:function(e){this.edit=e.edit,this.edit?(this.directory=this.model.get("directory"),this.limit=this.model.get("Policy").scope):(this.directory=e.directory,this.section=e.section,this.subset=e.subset,this.models=e.models)
},render:function(){var t,s=n.get("myPlex"),r="";this.edit?(r=this.model.get("title"),t=this.model.get("metadataType")):this.section?(r=this.model.getFilteredTitle(this.models,!0),t=this.model.get("media").viewGroup):t=this.model.get("type");var l=/^(movie|show|season|episode|clip)$/.test(t),o=/^(artist|album|track)$/.test(t),c=/^photo$/.test(t),d="medium";l?d=a.get("syncVideoQuality"):o?d=a.get("syncAudioQuality"):c&&(d=a.get("syncPictureQuality"));var h={hasSync:s.hasSync(),edit:this.edit,directory:this.directory,section:this.section,title:r,video:l,audio:o,photo:c,selectedQuality:d,selectedLimit:this.limit};
if(this.edit){var u=this.model.get("MediaSettings"),p=this.model.get("Policy");h.unwatched=parseInt(p.unwatched,10),h.limitValue=p.value;var f=i.getSettingsByVideoQuality(u.videoQuality);h.selectedQuality=f.key}return this.$el.html(e(h)).modal(),this},create:function(e){var i=_.bind(function(){this.$("#sync-form").addClass("hide"),this.$(".sync-success-container").removeClass("hide")},this),n={directory:this.directory,subset:this.subset,models:this.models,device:this.device,settings:e,callback:i};
this.section?n.section=this.model:n.media=this.model,t.trigger("command:CreateSyncItem",n)},save:function(e){var i=_.bind(function(){this.$el.modal("hide")},this),n={syncItem:this.model,settings:e,callback:i};t.trigger("command:EditSyncItem",n)},onLimitChange:function(e){switch(this.limit=r(e.target).val(),this.$(".limit-label").addClass("hide"),this.limit){case"all":this.$(".limit-value-group").addClass("hide");break;case"count":this.$(".limit-value-group").removeClass("hide"),this.$(".limit-items-label").removeClass("hide"),this.$("#limit-value").val(10);
break;case"duration":this.$(".limit-value-group").removeClass("hide"),this.$(".limit-duration-label").removeClass("hide"),this.$("#limit-value").val(60)}},onSubmit:function(e){if(e.preventDefault(),!this.$("button[type=submit]").hasClass("disabled")){var t={title:this.$("#title").val(),quality:this.$("#quality").val(),unwatched:this.$("#unwatched").prop("checked")?1:0,scope:this.limit};"all"!==this.limit&&(t.value=this.$("#limit-value").val()),this.edit?this.save(t):this.create(t)}},onCancel:function(e){e.preventDefault(),this.$el.modal("hide")
},onStatusClick:function(e){e.preventDefault(),this.$el.modal("hide"),t.trigger("navigate:sync",{serverID:this.model.server.id})},onDoneClick:function(e){e.preventDefault(),this.$el.modal("hide")}});return l}),define("hb!templates/desktop/modals/SelectDeviceModal.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a="";return a+='\n			<li><a class="device" data-id="',(n=i.clientIdentifier)?n=n.call(e,{hash:{},data:t}):(n=e.clientIdentifier,n=typeof n===f?n.apply(e):n),a+=p(n)+'" href="#">',n=i["if"].call(e,e.name,{hash:{},inverse:m.program(4,l,t),fn:m.program(2,r,t),data:t}),(n||0===n)&&(a+=n),a+="</a></li>\n		"
}function r(e,t){var n,a;return a={hash:{},data:t},p((n=i.truncate||e.truncate,n?n.call(e,e.name,25,a):u.call(e,"truncate",e.name,25,a)))}function l(e,t){var n,a;return a={hash:{},data:t},p((n=i.truncate||e.truncate,n?n.call(e,e.device,25,a):u.call(e,"truncate",e.device,25,a)))}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var o,c,d,h="",u=i.helperMissing,p=this.escapeExpression,f="function",m=this;return h+='<div class="modal-header">\n	<button type="button" class="close" data-dismiss="modal"><i class="glyphicon remove-2"></i></button>\n	<h3>',d={hash:{},data:a},h+=p((o=i.t||t.t,o?o.call(t,"Select a Device",d):u.call(t,"t","Select a Device",d)))+'</h3>\n</div>\n\n<div class="modal-body minimal-scrollbar">\n	<ul class="select-list">\n		',c=i.each.call(t,t.devices,{hash:{},inverse:m.noop,fn:m.program(1,s,a),data:a}),(c||0===c)&&(h+=c),h+="\n	</ul>\n</div>\n"
})}),define("plex/desktop/view/modals/SelectDeviceModal",["hb!templates/desktop/modals/SelectDeviceModal.tpl","plex/base/model/AppModel","plex/base/view/modals/BaseModal","jquery"],function(e,t,i,n){var a=i.extend({name:"selectDeviceModal",className:"modal modal-small select-modal fade",events:{hidden:"close","click .device":"onDeviceClick"},render:function(){for(var i=t.get("myPlex"),n=i.get("devices").getSyncDevices(),a=0,s=n.length;s>a;a++)n[a]=n[a].toJSON();return this.$el.html(e({devices:n})).modal(),this
},onDeviceClick:function(e){e.preventDefault(),this.$el.modal("hide"),this.trigger("select:device",n(e.target).data("id"))}});return a}),define("hb!templates/desktop/modals/MediaInfoModal.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a,s,l="";return l+='\n		<div class="well error">\n			<h4><i class="glyphicon warning-sign"></i> ',s={hash:{},data:t},l+=A((n=i.t||e.t,n?n.call(e,"Problems",s):_.call(e,"t","Problems",s)))+"</h4>\n\n			<ul>\n				",a=i.each.call(e,e.missingParts,{hash:{},inverse:T.noop,fn:T.program(2,r,t),data:t}),(a||0===a)&&(l+=a),l+="\n			</ul>\n		</div>\n	"
}function r(e,t){var n,a,s,r="";return r+='\n					<li>\n						<span class="media-info-detail-label">',(n=i.file)?n=n.call(e,{hash:{},data:t}):(n=e.file,n=typeof n===I?n.apply(e):n),r+=A(n)+'</span>\n\n						<ul>\n							<li><span class="media-info-detail">\n								',s={hash:{},inverse:T.program(5,o,t),fn:T.program(3,l,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,e.exists,"1",s):_.call(e,"if_eq",e.exists,"1",s),(a||0===a)&&(r+=a),r+="\n							</span></li>\n						</ul>\n					</li>\n				"}function l(e,t){var n,a,s="";
return s+="\n									",a={hash:{},data:t},s+=A((n=i.t||e.t,n?n.call(e,"Please check the permissions for this file.",a):_.call(e,"t","Please check the permissions for this file.",a)))+"\n								"}function o(e,t){var n,a,s="";return s+="\n									",a={hash:{},data:t},s+=A((n=i.t||e.t,n?n.call(e,"Please check that this file exists and the necessary drive is mounted.",a):_.call(e,"t","Please check that this file exists and the necessary drive is mounted.",a)))+"\n								"}function c(e,t){var n,a,s,r="";
return r+='\n		<div class="well">\n			<h4>',s={hash:{},data:t},r+=A((n=i.t||e.t,n?n.call(e,"Media",s):_.call(e,"t","Media",s)))+"</h4>\n			<ul>\n				",a=i.each.call(e,e.properties,{hash:{},inverse:T.noop,fn:T.program(8,d,t),data:t}),(a||0===a)&&(r+=a),r+="\n			</ul>\n\n			",a=i.each.call(e,e.Part,{hash:{},inverse:T.noop,fn:T.program(10,h,t),data:t}),(a||0===a)&&(r+=a),r+="\n		</div>\n	"}function d(e,t){var n,a,s,r="";return r+='\n					<li>\n						<span class="media-info-detail-label">',s={hash:{},data:t},r+=A((n=i.t||e.t,n?n.call(e,e.name,s):_.call(e,"t",e.name,s)))+'</span>\n						<span class="media-info-detail">',(a=i.value)?a=a.call(e,{hash:{},data:t}):(a=e.value,a=typeof a===I?a.apply(e):a),r+=A(a)+"</span>\n					</li>\n				"
}function h(e,t){var n,a,s,r="";return r+='\n				<div class="media-info-part">\n					<h4>',s={hash:{},data:t},r+=A((n=i.t||e.t,n?n.call(e,"File",s):_.call(e,"t","File",s)))+"</h4>\n					<ul>\n						",a=i.each.call(e,e.properties,{hash:{},inverse:T.noop,fn:T.program(11,u,t),data:t}),(a||0===a)&&(r+=a),r+="\n					</ul>\n\n					",a=i.each.call(e,e.Stream,{hash:{},inverse:T.noop,fn:T.program(13,p,t),data:t}),(a||0===a)&&(r+=a),r+="\n				</div>\n			"}function u(e,t){var n,a,s,r="";return r+='\n							<li>\n								<span class="media-info-detail-label">',s={hash:{},data:t},r+=A((n=i.t||e.t,n?n.call(e,e.name,s):_.call(e,"t",e.name,s)))+'</span>\n								<span class="media-info-detail">',(a=i.value)?a=a.call(e,{hash:{},data:t}):(a=e.value,a=typeof a===I?a.apply(e):a),r+=A(a)+"</span>\n							</li>\n						"
}function p(e,t){var n,a,s,r="";return r+='\n						<div class="media-info-stream">\n							',s={hash:{},inverse:T.program(16,m,t),fn:T.program(14,f,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,e.streamType,"1",s):_.call(e,"if_eq",e.streamType,"1",s),(a||0===a)&&(r+=a),r+="\n\n							<ul>\n								",a=i.each.call(e,e.properties,{hash:{},inverse:T.noop,fn:T.program(22,b,t),data:t}),(a||0===a)&&(r+=a),r+="\n							</ul>\n						</div>\n					"}function f(e,t){var n,a,s="";return s+="\n								<h4>",a={hash:{},data:t},s+=A((n=i.t||e.t,n?n.call(e,"Video",a):_.call(e,"t","Video",a)))+"</h4>\n							"
}function m(e,t){var n,a,s;return s={hash:{},inverse:T.program(19,v,t),fn:T.program(17,g,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,e.streamType,"2",s):_.call(e,"if_eq",e.streamType,"2",s),a||0===a?a:""}function g(e,t){var n,a,s="";return s+="\n								<h4>",a={hash:{},data:t},s+=A((n=i.t||e.t,n?n.call(e,"Audio",a):_.call(e,"t","Audio",a)))+"</h4>\n							"}function v(e,t){var n,a,s;return s={hash:{},inverse:T.noop,fn:T.program(20,y,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,e.streamType,"3",s):_.call(e,"if_eq",e.streamType,"3",s),a||0===a?a:""
}function y(e,t){var n,a,s="";return s+="\n								<h4>",a={hash:{},data:t},s+=A((n=i.t||e.t,n?n.call(e,"Subtitles",a):_.call(e,"t","Subtitles",a)))+"</h4>\n							"}function b(e,t){var n,a,s,r="";return r+='\n									<li>\n										<span class="media-info-detail-label">',s={hash:{},data:t},r+=A((n=i.t||e.t,n?n.call(e,e.name,s):_.call(e,"t",e.name,s)))+'</span>\n										<span class="media-info-detail">',(a=i.value)?a=a.call(e,{hash:{},data:t}):(a=e.value,a=typeof a===I?a.apply(e):a),r+=A(a)+"</span>\n									</li>\n								"
}function w(e,t){var n,a,s="";return s+='\n	<div class="modal-footer">\n		<div class="pull-left">\n			<a href="',(n=i.url)?n=n.call(e,{hash:{},data:t}):(n=e.url,n=typeof n===I?n.apply(e):n),s+=A(n)+'" target="_blank">',a={hash:{},data:t},s+=A((n=i.t||e.t,n?n.call(e,"View XML",a):_.call(e,"t","View XML",a)))+"</a>\n		</div>\n	</div>\n"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var x,k,S,C="",_=i.helperMissing,A=this.escapeExpression,I="function",T=this;return C+='<div class="modal-header">\n	<button type="button" class="close" data-dismiss="modal"><i class="glyphicon remove-2"></i></button>\n	<h3><i class="glyphicon circle-info"></i> ',S={hash:{},data:a},C+=A((x=i.t||t.t,x?x.call(t,"Media Info",S):_.call(t,"t","Media Info",S)))+'</h3>\n</div>\n\n<div class="modal-body minimal-scrollbar">\n	',k=i["if"].call(t,t.hasMissingParts,{hash:{},inverse:T.noop,fn:T.program(1,s,a),data:a}),(k||0===k)&&(C+=k),C+="\n\n	",k=i.each.call(t,t.media,{hash:{},inverse:T.noop,fn:T.program(7,c,a),data:a}),(k||0===k)&&(C+=k),C+="\n</div>\n\n",k=i["if"].call(t,t.key,{hash:{},inverse:T.noop,fn:T.program(24,w,a),data:a}),(k||0===k)&&(C+=k),C+="\n"
})}),define("plex/desktop/view/modals/MediaInfoModal",["hb!templates/desktop/modals/MediaInfoModal.tpl","plex/base/control/utils/MediaUtil","plex/base/view/modals/BaseModal"],function(e,t,i){var n=["id","key","index","videoCodec","audioCodec","audioChannels","default","selected","languageCode"],a={size:"formatBytes",duration:"formatDuration",codec:"upperCase",format:"upperCase",container:"upperCase",videoResolution:"formatResolution",channels:"formatAudioChannels",level:"formatVideoLevel",bitrateMode:"upperCase",accessible:"formatBoolean",exists:"formatBoolean",optimizedForStreaming:"formatBoolean"},s={has64bitOffsets:"Has 64bit Offsets",cabac:"CABAC"},r={frameRate:" fps",dialogNorm:" dB",bitrate:" kbps",samplingRate:" Hz"},l=function(e,t){var i={properties:[]};
for(var l in e)if(l!==t&&-1===_.indexOf(n,l)){var o=s[l],c=e[l];a[l]&&(c=Handlebars.helpers[a[l]].call(this,c)),c&&(r[l]&&(c+=r[l]),o||(o=Handlebars.helpers.formatLabel.call(this,l)),i.properties.push({name:o,value:c}))}return t&&e&&(i[t]=e[t]),i},o=i.extend({name:"mediaInfoModal",className:"modal modal-large media-info-modal fade",events:{hidden:"close"},initialize:function(){var e=this.model.get("Media"),t=[];_.each(e,function(e){var i=l(e,"Part"),n=[];_.each(i.Part,function(e){var t=l(e,"Stream"),i=[];
_.each(t.Stream,function(e){i.push(l(e,"streamType"))}),t.Stream=i,n.push(t)}),i.Part=n,t.push(i)}),this.media=t},render:function(){var i=this.model.get("key"),n=t.getMissingParts(this.model.get("Media"));return this.$el.html(e({key:i,url:this.model.server.resolveUrl(i,!1,!0),media:this.media,hasMissingParts:!!n.length,missingParts:n})).modal(),this}});return o}),define("plex/desktop/view/popovers/PhotoPopoverDetailsView",["hb!templates/desktop/popovers/PhotoPopoverDetailsView.tpl","plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel","plex/base/view/BaseView","plex/base/view/images/BaseImage","plex/desktop/view/modals/SyncModal","plex/desktop/view/modals/SelectDeviceModal","plex/desktop/view/modals/MediaInfoModal","jquery"],function(e,t,i,n,a,s,r,l,o,c){var d=a.extend({className:"photo-container",photos:null,transition:null,slideshow:!1,allowSync:!1,photo:null,events:{"mouseenter .card-menu-btn":"onMenuMouseEnter","mouseleave .card-menu-btn":"onMenuMouseLeave","click .remote-play-btn":"onRemotePlayClick","click .sync-btn":"onSyncClick","click .edit-btn":"onEditClick","click .info-btn":"onInfoClick"},initialize:function(e){this.photos=e.photos,this.transition=e.transition,this.slideshow=e.slideshow,this.allowSync=e.allowSync;
var t=n.get("myPlex"),i=n.get("clients");this.windowWidth=c(window).width(),this.windowHeight=c(window).height();var a=Math.round(.8*this.windowWidth),r=Math.round(.8*this.windowHeight);this.transition&&(this.$el.addClass(this.transition.type),this.transition.direction&&(this.$el.addClass(this.transition.direction),"left"===this.transition.direction?this.$el.css("left",-1*this.windowWidth):this.$el.css("left",this.windowWidth))),this.photo=this.registerView(new s({model:this.model,url:this.model.getMediaKey(),transcode:!0,width:a,height:r})),this.photo.$el.css({"max-width":a,"max-height":r}),this.addBinding(this.photo,"load",this.onLoad),this.addBinding(i,"reset",this.onClientsReset),this.addBinding(t.get("devices"),"reset",this.onDevicesReset),i.populate({hideLoadingAlert:!0}),this.resizeThrottle=_.throttle(_.bind(this.resize,this),500),c(window).on("resize",this.resizeThrottle)
},render:function(){var t=this.model.server.get("shared"),i=n.get("clients");return this.$el.html(e({photo:this.model.toJSON(),total:this.photos.length,index:_.indexOf(this.photos,this.model)+1,showPlay:!this.slideshow&&this.photos.length>1,showPause:this.slideshow,showRemotePlay:i.length&&!t,showEdit:!t&&this.model.section,showSync:this.canSync()})),this.$(".photo-details").prepend(this.photo.render().el),this},destroy:function(){a.prototype.destroy.call(this),c(window).off("resize",this.resizeThrottle)
},resize:function(){this.windowWidth=c(window).width(),this.windowHeight=c(window).height();var e=Math.round(.8*this.windowWidth),t=Math.round(.8*this.windowHeight);this.photo.$el.css({"max-width":e,"max-height":t})},transitionIn:function(){this.transition&&(this.$el.removeClass(this.transition.type),this.transition.direction&&this.$el.removeClass(this.transition.direction).css("left",0))},transitionOut:function(e){return e?(this.$el.addClass(e.type),e.direction&&("right"===e.direction?this.$el.addClass("left").css("left",-1*this.windowWidth):this.$el.addClass("right").css("left",this.windowWidth)),_.delay(_.bind(function(){this.destroy()
},this),1e3),void 0):(this.destroy(),void 0)},canSync:function(){var e=n.get("myPlex"),t=e.get("devices").getSyncDevices();return!this.model.server.get("shared")&&this.model.server.supports("sync")&&t.length&&e.get("signedIn")&&this.allowSync?!0:!1},onLoad:function(){this.trigger("load")},onClientsReset:function(e){var t=e.length&&!this.model.server.get("shared");t?this.$(".remote-play-btn").removeClass("hide"):this.$(".remote-play-btn").addClass("hide")},onDevicesReset:function(){this.canSync()?this.$(".sync-btn").removeClass("hide"):this.$(".sync-btn").addClass("hide")
},onMenuMouseEnter:function(e){this.$(".card-menu-btn").each(function(t,i){i!==e.currentTarget?c(i).addClass("dim"):c(i).removeClass("dim")})},onMenuMouseLeave:function(){this.$(".card-menu-btn").removeClass("dim")},onRemotePlayClick:function(){t.trigger("command:RemotePlay",{media:this.model})},onEditClick:function(){t.trigger("navigate:edit",{serverID:this.model.server.id,sectionID:this.model.section.id,mediaID:this.model.id})},onSyncClick:function(){var e=n.get("myPlex"),t=e.get("devices"),i=t.getSyncDevices(),a=new r({directory:!1,section:!1,model:this.model});
if(i.length>1){var s=new l,o=_.bind(function(e){s.off("select:device",o),a.device=t.get(e),n.set("modal",a)},this);s.on("select:device",o),n.set("modal",s)}else 1===i.length&&(a.device=i[0],n.set("modal",a))},onInfoClick:function(e){e.preventDefault(),n.set("modal",new o({model:this.model}))}});return d}),define("plex/desktop/view/popovers/PhotoPopover",["hb!templates/desktop/popovers/PhotoPopover.tpl","plex/base/control/Dispatcher","plex/base/view/FocusView","plex/desktop/view/popovers/PhotoPopoverDetailsView","spin"],function(e,t,i,n){var a=i.extend({className:"photo-popover",modal:!0,details:null,photos:null,index:0,loading:!1,slideshowDuration:5e3,slideshowInterval:null,focusOptions:{bindings:{up:".close-btn",left:".previous-btn",right:".next-btn"}},events:{"click .close-btn":"onCloseClick","click .previous-btn":"onPreviousClick","click .next-btn":"onNextClick","click .play-btn":"onPlayClick","click .pause-btn":"onPauseClick"},initialize:function(){this.resetGlobalFocus(),this.rendered=!1,this.model?(this.photos=this.filter(this.collection),this.index=_.indexOf(this.photos,this.model)):this.collection.populate({hideLoadingAlert:!0}).done(_.bind(function(){this.photos=this.filter(this.collection),this.photos.length?(this.model=_.first(this.photos),this.index=_.indexOf(this.photos,this.model),this.rendered&&this.render()):t.trigger("hide:photo")
},this)),this.addBinding(t,"shortcut:escape",this.close),this.addBinding(t,"shortcut:skipBackward",this.previous),this.addBinding(t,"shortcut:skipForward",this.next)},render:function(){return this.rendered=!0,this.$el.html(e()),this.model?(this.hideLoading(),this.transition({type:"fade"})):this.showLoading(),this},destroy:function(){this.slideshowInterval&&clearInterval(this.slideshowInterval),i.prototype.destroy.call(this)},filter:function(e){return e.reject(function(e){var t=e.get("type");return"photo"!==t&&"Image"!==t
})},updateControls:function(){var e=this.index>0,t=this.photos.length>this.index+1;e?this.$(".previous-btn").removeClass("hide"):this.$(".previous-btn").addClass("hide"),t?this.$(".next-btn").removeClass("hide"):this.$(".next-btn").addClass("hide")},showLoading:function(){this.$(".spinner-container").spinContents("large","#ddd"),this.$el.addClass("show-photo-loading")},hideLoading:function(){this.$(".spinner-container").spinContents(!1),this.$el.removeClass("show-photo-loading")},close:function(){t.trigger("hide:photo")
},previous:function(){this.loading||(this.index>0?this.index--:this.index=this.photos.length-1,this.model=this.photos[this.index],this.transition({type:"slide",direction:"left"}))},next:function(){this.loading||(this.photos.length>this.index+1?this.index++:this.index=0,this.model=this.photos[this.index],this.transition({type:"slide",direction:"right"}))},transition:function(e){this.loading=!0;var t=new n({model:this.model,photos:this.photos,transition:e,slideshow:!!this.slideshowInterval,allowSync:this.collection.allowSync}),i=_.bind(function(){t.off("load",i),this.loading=!1,_.defer(_.bind(function(){this.hideLoading(),t.transitionIn(),this.details&&this.details.transitionOut(e),this.details=t
},this))},this);t.on("load",i),this.$el.append(t.render().el),this.updateControls(),this.showLoading()},onCloseClick:function(e){e.preventDefault(),this.close()},onPreviousClick:function(e){e.preventDefault(),this.previous()},onNextClick:function(e){e.preventDefault(),this.next()},onPlayClick:function(){this.$(".play-btn").addClass("hide"),this.$(".pause-btn").removeClass("dim hide"),this.slideshowInterval=setInterval(_.bind(this.next,this),this.slideshowDuration)},onPauseClick:function(){this.$(".pause-btn").addClass("hide"),this.$(".play-btn").removeClass("dim hide"),clearInterval(this.slideshowInterval),this.slideshowInterval=null
}});return a}),define("plex/base/view/BaseAppView",["plex/base/control/Dispatcher","plex/base/control/utils/FocusManager","plex/base/model/AppModel","plex/base/view/alerts/LoadingAlert","plex/base/view/alerts/Alert","plex/desktop/view/players/MusicPlayerView","plex/desktop/view/popovers/PhotoPopover","jquery","backbone"],function(e,t,i,n,a,s,r,l){var o=Backbone.View.extend({el:"#plex",events:{"mousedown a":"onLinkMouseDown"},initialize:function(){this.views=[],this.modals=[],_.bindAll(this,"onInputFocus"),l(document).on("focus",".input-focusable",this.onInputFocus),i.on("change:loading",this.onLoadingChange,this),i.on("change:alert",this.onAlertChange,this),i.on("change:view",this.onViewChange,this),i.on("change:modal",this.onModalChange,this),e.on("destroy:modal",this.onModalDestroy,this),i.on("change:multiServer",this.onMultiServerChange,this),e.on("play:music",this.onPlayMusic,this),e.on("stop:music",this.onStopMusic,this),e.on("show:photo",this.onShowPhoto,this),e.on("hide:photo",this.onHidePhoto,this)
},onInputFocus:function(e){var i=l(document),n=l(e.target);if(n.hasClass("keyboard-focus")){e.preventDefault();var a=function(){i.off("click",a),i.off("keydown",s),n.removeClass("focus")},s=function(e){a(),13===e.which&&(e.preventDefault(),n.focus())};t.resetFocus(),n.removeClass("keyboard-focus").addClass("focus"),_.defer(function(){i.on("click",a),i.on("keydown",s)})}},onLoadingChange:function(e,t){t!==!0||this.loadingAlert?this.loadingAlert&&(this.loadingAlert.destroy(),this.loadingAlert=null):(this.loadingAlert=new n,l("body").append(this.loadingAlert.render().el))
},onAlertChange:function(e,t){t?(this.genericAlert=new a({alert:t}),l("body").append(this.genericAlert.render().el)):this.genericAlert=null},onViewChange:function(i,n){for(var a=this.views.length-1;a>=0;a--)this.views[a].destroy();this.photoPopover&&(this.photoPopover.destroy(),this.photoPopover=null),t.autoFocus(),l(".tooltip").remove(),this.views.length=0,this.views.push(n),this.$(".scroll-container").append(n.render().el).scrollTop(0),e.trigger("hide:background"),e.trigger("command:StopSound",!0)
},onModalChange:function(e,i){this.modals.push(i),l("body").append(i.render().el),t.autoFocus()},onModalDestroy:function(e){var i=_.indexOf(this.modals,e);i>-1&&this.modals.splice(i,1)[0].destroy(),t.autoFocus()},onMultiServerChange:function(e,t){t?this.$el.addClass("show-multi-server"):this.$el.removeClass("show-multi-server")},onPlayMusic:function(e,t){this.$el.addClass("show-music-player"),this.musicPlayerView?(this.musicPlayerView.collection=e,this.musicPlayerView.model=t):(this.musicPlayerView=new s({collection:e,model:t}),this.$el.prepend(this.musicPlayerView.render().el)),this.musicPlayerView.play()
},onStopMusic:function(){this.$el.removeClass("show-music-player"),this.musicPlayerView&&(this.musicPlayerView.hide(),this.musicPlayerView=null)},onShowPhoto:function(e,t){this.photoPopover?(this.photoPopover.collection=e,this.photoPopover.model=t):(this.photoPopover=new r({collection:e,model:t}),this.$el.prepend(this.photoPopover.render().el))},onHidePhoto:function(){this.photoPopover&&(this.photoPopover.destroy(),this.photoPopover=null)},onLinkMouseDown:function(e){e.preventDefault()}});return o
}),define("hb!templates/desktop/nav/NavBarView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a,s,d="";return d+='\n	<ul class="nav iconbar">\n		<li>\n			<span class="search-container">\n				<form class="search-form">\n					<input type="text" class="input-dark input-search input-focusable" placeholder="',s={hash:{},data:t},d+=p((n=i.t||e.t,n?n.call(e,"Search",s):u.call(e,"t","Search",s)))+" ",(a=i.searchPlaceholder)?a=a.call(e,{hash:{},data:t}):(a=e.searchPlaceholder,a=typeof a===f?a.apply(e):a),d+=p(a)+'" autocomplete="off" spellcheck="false" value="',(a=i.search)?a=a.call(e,{hash:{},data:t}):(a=e.search,a=typeof a===f?a.apply(e):a),d+=p(a)+'" data-focus="keyboard">\n					<i class="glyphicon search"></i>\n					<a class="clear-search-btn gray ',a=i.unless.call(e,e.search,{hash:{},inverse:m.noop,fn:m.program(2,r,t),data:t}),(a||0===a)&&(d+=a),d+='" href="#"><i class="glyphicon circle-remove"></i></a>\n				</form>\n			</span>\n		</li>\n\n		',a=i["if"].call(e,e.showUpdate,{hash:{},inverse:m.noop,fn:m.program(4,l,t),data:t}),(a||0===a)&&(d+=a),d+='\n\n		<li>\n			<a class="navbar-glyphicon-btn settings-icon-btn" href="#!/settings" rel="tooltip" data-tooltip-position="fixed" data-focus="keyboard" title="',s={hash:{},data:t},d+=p((n=i.t||e.t,n?n.call(e,"Settings",s):u.call(e,"t","Settings",s)))+'">\n				<i class="glyphicon settings"></i>\n			</a>\n		</li>\n\n		<li>\n			<a class="navbar-glyphicon-btn activity-icon-btn" href="#!/notifications" rel="tooltip" data-tooltip-position="fixed" data-focus="keyboard" title="',s={hash:{},data:t},d+=p((n=i.t||e.t,n?n.call(e,"Activity",s):u.call(e,"t","Activity",s)))+'">\n				<i class="glyphicon cardio"></i>\n			</a>\n		</li>\n\n		<li class="server-dropdown-container dropdown">\n			<a class="dropdown-toggle navbar-glyphicon-btn server-icon-btn" href="#server-dropdown-list" data-focus="keyboard" rel="tooltip" data-toggle="dropdown" data-tooltip-position="fixed" title="',s={hash:{},data:t},d+=p((n=i.t||e.t,n?n.call(e,"Servers",s):u.call(e,"t","Servers",s)))+'">\n				<i class="glyphicon hdd"></i><i class="glyphicon-caret"></i>\n			</a>\n		</li>\n\n		<li class="dropdown">\n			<a class="dropdown-toggle navbar-glyphicon-btn account-icon-btn" href="#account-dropdown-list" data-focus="keyboard" rel="tooltip" data-toggle="dropdown" data-tooltip-position="fixed" title="',s={hash:{},data:t},d+=p((n=i.t||e.t,n?n.call(e,"Account",s):u.call(e,"t","Account",s)))+'">\n				<i class="glyphicon user"></i><i class="glyphicon-caret"></i>\n			</a>\n\n			<ul class="dropdown-menu dropdown-menu-large pull-right">\n				',a=i["if"].call(e,(n=e.myPlex,null==n||n===!1?n:n.username),{hash:{},inverse:m.program(8,c,t),fn:m.program(6,o,t),data:t}),(a||0===a)&&(d+=a),d+="\n			</ul>\n		</li>\n	</ul>\n"
}function r(){return"hide"}function l(e,t){var n,a,s="";return s+='\n			<li>\n				<a class="navbar-glyphicon-btn update-btn" href="#" rel="tooltip" data-tooltip-position="fixed" data-focus="keyboard" title="',a={hash:{},data:t},s+=p((n=i.t||e.t,n?n.call(e,"Update",a):u.call(e,"t","Update",a)))+'">\n					<i class="glyphicon up-arrow"></i>\n				</a>\n			</li>\n		'}function o(e,t){var n,a,s,l="";return l+='\n					<li><a href="',(n=i.myPlexUrl)?n=n.call(e,{hash:{},data:t}):(n=e.myPlexUrl,n=typeof n===f?n.apply(e):n),l+=p(n)+'users/edit" target="_blank" data-focus="keyboard"><i class="glyphicon user"></i> ',s={hash:{},data:t},l+=p((n=i.truncate||e.truncate,n?n.call(e,(n=e.myPlex,null==n||n===!1?n:n.username),15,s):u.call(e,"truncate",(n=e.myPlex,null==n||n===!1?n:n.username),15,s)))+'</a></li>\n					<li class="divider"></li>\n\n					<li><a href="#!/friends" data-focus="keyboard"><i class="glyphicon parents"></i> ',s={hash:{},data:t},l+=p((n=i.t||e.t,n?n.call(e,"Friends",s):u.call(e,"t","Friends",s)))+' <span class="friend-requests-badge ',a=i.unless.call(e,e.friendRequestsCount,{hash:{},inverse:m.noop,fn:m.program(2,r,t),data:t}),(a||0===a)&&(l+=a),l+='">',(a=i.friendRequestsCount)?a=a.call(e,{hash:{},data:t}):(a=e.friendRequestsCount,a=typeof a===f?a.apply(e):a),l+=p(a)+'</span></a></li>\n					<li><a href="#!/playlist/recommendations" data-focus="keyboard"><i class="glyphicon share-alt"></i> ',s={hash:{},data:t},l+=p((n=i.t||e.t,n?n.call(e,"Recommendations",s):u.call(e,"t","Recommendations",s)))+'</a></li>\n					<li><a href="#!/playlist/queue" data-focus="keyboard"><i class="glyphicon clock"></i> ',s={hash:{},data:t},l+=p((n=i.t||e.t,n?n.call(e,"Queue",s):u.call(e,"t","Queue",s)))+'</a></li>\n\n					<li class="divider"></li>\n					<li><a class="signout-btn" href="#" data-focus="keyboard"><i class="glyphicon exit"></i> ',s={hash:{},data:t},l+=p((n=i.t||e.t,n?n.call(e,"Sign Out",s):u.call(e,"t","Sign Out",s)))+"</a></li>\n				"
}function c(e,t){var n,a,s="";return s+='\n					<li><a class="signin-btn" href="#!/login" data-focus="keyboard"><i class="glyphicon user"></i> ',a={hash:{},data:t},s+=p((n=i.t||e.t,n?n.call(e,"Sign In",a):u.call(e,"t","Sign In",a)))+"</a></li>\n				"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var d,h="",u=i.helperMissing,p=this.escapeExpression,f="function",m=this;return d=i["if"].call(t,t.isAuthorized,{hash:{},inverse:m.noop,fn:m.program(1,s,a),data:a}),(d||0===d)&&(h+=d),h+="\n"
})}),define("text!templates/desktop/tooltips/LargeTooltip.tpl",[],function(){return'<div class="tooltip tooltip-large"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'}),define("hb!templates/desktop/nav/BreadcrumbBarView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return"hide"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var r,l,o="",c=this,d=i.helperMissing,h=this.escapeExpression;return o+='<li class="back-icon ',r=i.unless.call(t,t.showBack,{hash:{},inverse:c.noop,fn:c.program(1,s,a),data:a}),(r||0===r)&&(o+=r),o+='">\n	<a class="navbar-glyphicon-btn back-icon-btn" href="#" rel="tooltip" data-tooltip-position="fixed" data-focus="keyboard" title="',l={hash:{},data:a},o+=h((r=i.t||t.t,r?r.call(t,"Back",l):d.call(t,"t","Back",l)))+'">\n		<i class="glyphicon left-arrow"></i>\n	</a>\n</li>\n\n<li>\n	<a class="navbar-glyphicon-btn home-icon-btn" href="#!/dashboard" rel="tooltip" data-tooltip-position="fixed" data-focus="keyboard" title="',l={hash:{},data:a},o+=h((r=i.t||t.t,r?r.call(t,"Home",l):d.call(t,"t","Home",l)))+'">\n		<i class="glyphicon home"></i>\n	</a>\n</li>\n\n<li class="divider"></li>\n\n<li id="section-breadcrumb" class="breadcrumb-item">\n	<a class="breadcrumb-placeholder breadcrumb-btn" href="#">\n		<i class="glyphicon more"></i>\n	</a>\n</li>\n'
})}),define("hb!templates/desktop/lists/nav/SectionDropdownList.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a,s,l="";return l+='\n	<a class="breadcrumb-btn split-left" href="#!/servers/',(n=i.serverID)?n=n.call(e,{hash:{},data:t}):(n=e.serverID,n=typeof n===d?n.apply(e):n),l+=h(n)+"/sections/",s={hash:{},data:t},l+=h((n=i.encodeUrl||e.encodeUrl,n?n.call(e,(n=e.activeSection,null==n||n===!1?n:n.key),s):u.call(e,"encodeUrl",(n=e.activeSection,null==n||n===!1?n:n.key),s)))+'" data-focus="keyboard">\n		<div class="breadcrumb-spinner-container spinner-container">\n			<i class="plex-icon-section-mini plex-icon-'+h((n=e.activeSection,n=null==n||n===!1?n:n.type,typeof n===d?n.apply(e):n))+'-mini"></i>\n		</div>\n\n		',s={hash:{},data:t},l+=h((n=i.truncate||e.truncate,n?n.call(e,(n=e.activeSection,null==n||n===!1?n:n.title),15,s):u.call(e,"truncate",(n=e.activeSection,null==n||n===!1?n:n.title),15,s)))+' <span class="source-title ',a=i["if"].call(e,e.shared,{hash:{},inverse:p.noop,fn:p.program(2,r,t),data:t}),(a||0===a)&&(l+=a),l+='">(',s={hash:{},data:t},l+=h((n=i.truncate||e.truncate,n?n.call(e,e.source,15,s):u.call(e,"truncate",e.source,15,s)))+')</span>\n	</a>\n	<a class="breadcrumb-btn split-right dropdown-toggle" href="#section-dropdown-list" data-focus="keyboard" data-toggle="dropdown"><i class="glyphicon-caret"></i></a>\n\n	<ul class="dropdown-menu dropdown-menu-large"></ul>\n'
}function r(){return"shared-source-title"}function l(e,t){var n,a,s,l="";return l+='\n	<a class="breadcrumb-btn" href="#!/servers/',(n=i.serverID)?n=n.call(e,{hash:{},data:t}):(n=e.serverID,n=typeof n===d?n.apply(e):n),l+=h(n)+"/sections/",s={hash:{},data:t},l+=h((n=i.encodeUrl||e.encodeUrl,n?n.call(e,(n=e.activeSection,null==n||n===!1?n:n.key),s):u.call(e,"encodeUrl",(n=e.activeSection,null==n||n===!1?n:n.key),s)))+'" data-focus="keyboard">\n		<div class="breadcrumb-spinner-container spinner-container">\n			<i class="plex-icon-section-mini plex-icon-'+h((n=e.activeSection,n=null==n||n===!1?n:n.type,typeof n===d?n.apply(e):n))+'-mini"></i>\n		</div>\n\n		',s={hash:{},data:t},l+=h((n=i.truncate||e.truncate,n?n.call(e,(n=e.activeSection,null==n||n===!1?n:n.title),15,s):u.call(e,"truncate",(n=e.activeSection,null==n||n===!1?n:n.title),15,s)))+' <span class="source-title ',a=i["if"].call(e,e.shared,{hash:{},inverse:p.noop,fn:p.program(2,r,t),data:t}),(a||0===a)&&(l+=a),l+='">(',s={hash:{},data:t},l+=h((n=i.truncate||e.truncate,n?n.call(e,e.source,15,s):u.call(e,"truncate",e.source,15,s)))+")</span>\n	</a>\n"
}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var o,c="",d="function",h=this.escapeExpression,u=i.helperMissing,p=this;return o=i["if"].call(t,t.showDropdown,{hash:{},inverse:p.program(4,l,a),fn:p.program(1,s,a),data:a}),(o||0===o)&&(c+=o),c+="\n"})}),define("hb!templates/desktop/lists/nav/items/SectionDropdownListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return"shared-source-title"}function r(){return' <i class="glyphicon ok-2"></i>'
}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var l,o,c,d="",h="function",u=this.escapeExpression,p=i.helperMissing,f=this;return d+='<a href="#!/servers/',(l=i.serverID)?l=l.call(t,{hash:{},data:a}):(l=t.serverID,l=typeof l===h?l.apply(t):l),d+=u(l)+"/sections/",c={hash:{},data:a},d+=u((l=i.encodeUrl||t.encodeUrl,l?l.call(t,(l=t.section,null==l||l===!1?l:l.key),c):p.call(t,"encodeUrl",(l=t.section,null==l||l===!1?l:l.key),c)))+'" data-focus="keyboard">\n	<div class="spinner-container">\n		<i class="plex-icon-section-mini plex-icon-'+u((l=t.section,l=null==l||l===!1?l:l.type,typeof l===h?l.apply(t):l))+'-mini plex-icon-dark"></i>\n	</div>\n\n	&nbsp;'+u((l=t.section,l=null==l||l===!1?l:l.title,typeof l===h?l.apply(t):l))+' <span class="source-title ',o=i["if"].call(t,t.shared,{hash:{},inverse:f.noop,fn:f.program(1,s,a),data:a}),(o||0===o)&&(d+=o),d+='">(',c={hash:{},data:a},d+=u((l=i.truncate||t.truncate,l?l.call(t,t.source,15,c):p.call(t,"truncate",t.source,15,c)))+")</span>\n\n	",o=i["if"].call(t,t.active,{hash:{},inverse:f.noop,fn:f.program(3,r,a),data:a}),(o||0===o)&&(d+=o),d+="\n</a>\n"
})}),define("plex/desktop/view/lists/nav/items/SectionDropdownListItem",["hb!templates/desktop/lists/nav/items/SectionDropdownListItem.tpl","plex/base/model/AppModel","plex/base/model/HeaderModel","plex/base/view/BaseView","jquery","spin"],function(e,t,i,n){var a=n.extend({tagName:"li",spinner:null,spinnerContainer:null,events:{mouseenter:"onMouseEnter","focus a":"onMouseEnter",mouseleave:"onMouseLeave","blur a":"onMouseLeave"},initialize:function(){this.addBinding(this.model,"change",this.render)
},render:function(){var t=this.model.server.get("sourceTitle");return t||(t=this.model.server.get("friendlyName")||this.model.server.get("name")),this.$el.html(e({serverID:this.model.server.id,section:this.model.toJSON(),source:t,shared:this.model.server.get("shared"),active:this.model.id===i.get("activeSection").id})),this.model.get("refreshing")&&this.$(".spinner-container").spinContents("tiny","#333"),this},onMouseEnter:function(){this.$("i").removeClass("plex-icon-dark"),this.model.get("refreshing")&&(this.$(".spinner-container").spinContents(!1),this.$(".spinner-container").spinContents("tiny","#fff"))
},onMouseLeave:function(){this.$("i").addClass("plex-icon-dark"),this.model.get("refreshing")&&(this.$(".spinner-container").spinContents(!1),this.$(".spinner-container").spinContents("tiny","#333"))}});return a}),define("plex/desktop/view/lists/nav/SectionDropdownList",["hb!templates/desktop/lists/nav/SectionDropdownList.tpl","plex/base/model/AppModel","plex/base/model/HeaderModel","plex/base/view/lists/BaseList","plex/desktop/view/lists/nav/items/SectionDropdownListItem","spin"],function(e,t,i,n,a){var s=n.extend({id:"section-dropdown-list",tagName:"div",className:"breadcrumb-content dropdown",activeServer:null,activeSection:null,initialize:function(){this.setup(a,".dropdown-menu")
},render:function(t){this.activeSection&&(this.removeBinding(this.activeSection,"change:title"),this.removeBinding(this.activeSection,"change:refreshing")),this.activeServer=i.get("activeServer"),this.activeSection=i.get("activeSection"),this.addBinding(this.activeSection,"change:title",this.onChange),this.addBinding(this.activeSection,"change:refreshing",this.onChange);var n=this.activeServer.get("sourceTitle");n||(n=this.activeServer.get("friendlyName")||this.activeServer.get("name"));var a={serverID:this.activeServer.id,showDropdown:this.collection.length>1,activeSection:this.activeSection.toJSON(),source:n,shared:this.activeServer.get("shared")};
return this.$el.html(e(a)),this.activeSection.get("refreshing")&&this.$(".breadcrumb-spinner-container").spinContents("tiny"),t||this.populate(this.collection),this},reset:function(e){this.render(!0),n.prototype.reset.call(this,e)},onChange:function(){this.render()}});return s}),define("plex/desktop/view/nav/BreadcrumbBarView",["hb!templates/desktop/nav/BreadcrumbBarView.tpl","text!templates/desktop/tooltips/LargeTooltip.tpl","plex/base/control/Dispatcher","plex/base/model/AppModel","plex/base/view/BaseView","plex/desktop/view/lists/nav/SectionDropdownList","jquery"],function(e,t,i,n,a,s,r){var l=a.extend({tagName:"ul",className:"breadcrumbbar nav",animationDuration:300,events:{"click .back-icon-btn":"onBackClick","click .breadcrumb-placeholder":"onPlaceholderClick","mouseenter .breadcrumb-item.collapsed":"onCollapsedBreadcrumbMouseOver"},initialize:function(){this.addBinding(i,"change:language",this.onLanguageChange),this.resizeThrottle=_.throttle(_.bind(this.resize,this),this.animationDuration),r(window).on("resize",this.resizeThrottle)
},render:function(){return this.$el.html(e({showBack:this.model.get("showBack")})),this.$el.tooltip({selector:".navbar-glyphicon-btn",placement:"bottom",template:t}),this.bindView(),this.delegateEvents(),this},resize:function(){var e=this.$el.parent(),t=e.width()-e.find(".iconbar").innerWidth();if(t){if(this.$(".breadcrumb-item.animating").length)return _.delay(_.bind(this.resize,this),this.animationDuration),void 0;var i=this.$(".breadcrumb-item").get(),n=this.$(".breadcrumb-item.collapsed,.breadcrumb-item.expanded,.breadcrumb-item.animating").get(),a=this.$el.outerWidth(),s=this.getMaxWidth(a,n),l=s>t;
l||i.reverse();for(var o=0,c=i.length;c>o;o++){var d=r(i[o]),h=d.hasClass("collapsed"),u=d.find(".breadcrumb-content").outerWidth(),p=d.find(".breadcrumb-placeholder").outerWidth(),f=u-p;if(l){if(h)continue;if(n.push(d[0]),this.collapse(d),a-=f,t>this.getMaxWidth(a,n))break}else{if(!h)continue;if(n.splice(_.indexOf(n,d[0]),1),!(t>this.getMaxWidth(a+f,n)))break;this.expand(d),a+=f}}}},getMaxWidth:function(e,t){for(var i=0,n=0,a=t.length;a>n;n++){var s=r(t[n]),l=s.find(".breadcrumb-content").outerWidth(),o=s.find(".breadcrumb-placeholder").outerWidth(),c=l-o;
c>i&&(i=c)}return e+i},collapse:function(e){e.find(".breadcrumb-content").outerWidth();var t=e.find(".breadcrumb-placeholder").outerWidth(),i=_.bind(function(){e.removeClass("animating"),e.addClass("collapsed")},this);e.addClass("animating"),e.removeClass("collapsed"),e.removeClass("expanded"),e.find(".dropdown").removeClass("open"),e.stop().animate({width:t},this.animationDuration,i)},expand:function(e,t){var i=e.find(".breadcrumb-content").outerWidth();e.find(".breadcrumb-placeholder").outerWidth();
var n=_.bind(function(){e.removeClass("animating"),t&&e.addClass("expanded")},this);e.addClass("animating"),e.removeClass("expanded"),e.removeClass("collapsed"),e.stop().animate({width:i},this.animationDuration,n)},bindings:{".back-icon":{modelAttr:"showBack",format:function(e,t){t?e.removeClass("hide"):e.addClass("hide")}},"#section-breadcrumb":{modelAttr:"activeSection",format:function(e,t){if(this.sectionList&&this.removeView(this.sectionList),t){var i=t.server,a=i.get("shared")?n.get("sharedLibraries"):n.get("myLibrary");
this.sectionList=this.registerView(new s({collection:a})),e.append(this.sectionList.render().el),e.css("width","auto"),e.removeClass("hide"),e.prev().removeClass("hide")}else e.removeClass("expanded collapsed animating"),e.addClass("hide"),e.prev().addClass("hide");this.resizeThrottle()}},".media-breadcrumb":{modelAttr:"activeMedia",format:function(e,t){var i=this.model.get("activeServer"),n=this.model.get("activeSection");if(e.each(function(){var e=r(this),t=e.prev();e.remove(),t.remove()}),t){var a=r(Handlebars.partials.breadcrumbMediaItem({server:i.toJSON(),section:n.toJSON(),media:t.toJSON()},this));
this.$("#section-breadcrumb").after(a)}this.resizeThrottle()}},"#channel-breadcrumb":{modelAttr:"activeChannel",format:function(e,t){var i=this.model.get("activeServer");if(this.model.get("activeSection"),e.each(function(){var e=r(this),t=e.prev();e.remove(),t.remove()}),t){var a;i.get("shared")?a=i.get("sourceTitle"):n.get("multiServer")&&(a=i.get("friendlyName")||i.get("name"));var s=r(Handlebars.partials.breadcrumbMediaItem({server:i.toJSON(),channel:t.toJSON(),source:a},this));this.$("#section-breadcrumb").after(s)
}this.resizeThrottle()}},".channel-media-breadcrumb":{modelAttr:"activeChannelMedia",format:function(e,t){var i=this.model.get("activeServer");if(this.model.get("activeSection"),e.each(function(){var e=r(this),t=e.prev();e.remove(),t.remove()}),t){var n,a;t.channel&&(n=t.channel.id),t.channel&&(a=t.channel.get("identifier"));var s=r(Handlebars.partials.breadcrumbMediaItem({server:i.toJSON(),channelKey:n,channelID:a,channelMedia:t.toJSON()},this)),l=this.$("#channel-breadcrumb");l.length?l.after(s):this.$("#section-breadcrumb").after(s)
}this.resizeThrottle()}}},onLanguageChange:function(){this.removeAllViews(),this.render()},onBackClick:function(e){e.preventDefault(),i.trigger("navigate:back")},onPlaceholderClick:function(e){e.preventDefault(),this.$(".breadcrumb-item.animating, .breadcrumb-item.expanded").each(_.bind(function(e,t){this.collapse(r(t))},this)),this.expand(r(e.currentTarget).closest(".breadcrumb-item"),!0)},onCollapsedBreadcrumbMouseOver:function(e){this.$(".breadcrumb-item.animating, .breadcrumb-item.expanded").each(_.bind(function(e,t){this.collapse(r(t))
},this)),this.expand(r(e.currentTarget),!0)},onCollapsedBreadcrumbMouseOut:function(e){this.collapse(r(e.currentTarget))}});return l}),define("hb!templates/desktop/lists/nav/items/ServerDropdownListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e){var t,i="";return i+="\n		"+u((t=e.server,t=null==t||t===!1?t:t.friendlyName,typeof t===h?t.apply(e):t))+"\n	"}function r(e){var t,i="";return i+="\n		"+u((t=e.server,t=null==t||t===!1?t:t.name,typeof t===h?t.apply(e):t))+"\n	"
}function l(){return' <i class="glyphicon ok-2"></i>'}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var o,c,d="",h="function",u=this.escapeExpression,p=this;return d+='<a href="#" data-focus="keyboard">\n	',c=i["if"].call(t,(o=t.server,null==o||o===!1?o:o.friendlyName),{hash:{},inverse:p.program(3,r,a),fn:p.program(1,s,a),data:a}),(c||0===c)&&(d+=c),d+="\n\n	",c=i["if"].call(t,t.active,{hash:{},inverse:p.noop,fn:p.program(5,l,a),data:a}),(c||0===c)&&(d+=c),d+="\n</a>\n"})}),define("plex/desktop/view/lists/nav/items/ServerDropdownListItem",["hb!templates/desktop/lists/nav/items/ServerDropdownListItem.tpl","plex/base/model/AppModel","plex/base/view/BaseView"],function(e,t,i){var n=i.extend({tagName:"li",events:{"click a":"onClick"},initialize:function(){this.addBinding(this.model,"change",this.render),this.addBinding(t,"change:primaryServer",this.render)
},render:function(){return this.$el.html(e({server:this.model.toJSON(),active:this.model.id===t.get("primaryServer").id})),this},onClick:function(e){e.preventDefault(),t.set("primaryServer",this.model)}});return n}),define("plex/desktop/view/lists/nav/ServerDropdownList",["plex/base/view/lists/BaseList","plex/desktop/view/lists/nav/items/ServerDropdownListItem"],function(e,t){var i=e.extend({tagName:"ul",className:"dropdown-menu dropdown-menu-large pull-right",initialize:function(){this.setup(t)},render:function(){return this.$el.empty(),this.populate(this.collection),this
},addItem:function(t){return t.get("shared")||"secondary"===t.get("serverClass")?void 0:(this.removeBinding(t,"change:isAvailable"),t.get("isAvailable")?e.prototype.addItem.apply(this,arguments):(this.addBinding(t,"change:isAvailable",this.onServerAvailableChange),void 0))},onServerAvailableChange:function(e,t){t?this.addItem(e,this.collection):this.items[e.id]&&this.removeItem(e)}});return i}),define("plex/desktop/view/nav/NavBarView",["hb!templates/desktop/nav/NavBarView.tpl","text!templates/desktop/tooltips/LargeTooltip.tpl","plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/control/utils/StringUtil","plex/base/model/AppModel","plex/base/model/ConfigModel","plex/base/view/FocusView","plex/desktop/view/nav/BreadcrumbBarView","plex/desktop/view/lists/nav/ServerDropdownList","jquery"],function(e,t,i,n,a,s,r,l,o,c,d){var h=l.extend({className:"navbar navbar-fixed-top",breadcrumbBar:null,serverDropdown:null,searchTimeout:null,focusOptions:{position:0,activationDirection:"up",cancellationDirections:{down:".input-search, li:not(.open) .navbar-glyphicon-btn, .breadcrumb-content:not(.open) .breadcrumb-btn"}},events:{"focus .input-search":"onSearchFocus","blur .input-search":"onSearchBlur","keyup .input-search":"onSearchKeyUp","submit .search-form":"onSearchSubmit","click .clear-search-btn":"onClearSearchClick","click .update-btn":"onUpdateClick","click .server-icon-btn":"onServerClick","click .account-icon-btn":"onAccountClick","click .signout-btn":"onSignOutClick"},initialize:function(){var e=s.get("myPlex"),t=e.get("friendRequests");
this.addBinding(i,"shortcut:search",this.focusSearch),this.addBinding(i,"change:language",this.refresh),this.addBinding(s,"change:isAuthorized",this.refresh),this.addBinding(s,"change:updateStatus",this.refresh),this.addBinding(e,"change:username",this.refresh),this.addBinding(this.model,"change:activeView",this.onViewChange),this.addBinding(this.model,"change:activeSection",this.onSectionChange),this.addBinding(this.model,"change:activeMedia",this.onSectionChange),this.addBinding(this.model,"change:activeChannel",this.onSectionChange),this.addBinding(this.model,"change:activeSearch",this.onSearchChange),this.addBinding(i,"reset:filter",this.onSearchReset),this.addBinding(t,"reset",this.onFriendRequestsReset),this.breadcrumbBar=this.registerView(new o({model:this.model})),this.serverDropdown=this.registerView(new c({collection:s.get("servers")}))
},render:function(){var i=s.get("myPlex"),n=this.model.get("activeSection"),l=this.model.get("activeMedia"),o=this.model.get("activeChannel"),c=r.get("standalone"),d=s.get("updateStatus");this.inSection=n&&!l&&!o;var h={search:this.model.get("activeSearch"),searchPlaceholder:this.inSection?a.truncate(n.get("title"),10):"",isAuthorized:s.get("isAuthorized"),showUpdate:!c&&("download"===d||"reload"===d),myPlex:i.toJSON(),myPlexUrl:i.url(),friendRequestsCount:i.get("friendRequests").length};return this.inSection&&(h.search=n.get("media").search),this.$el.html(e(h)),this.$el.prepend(this.breadcrumbBar.render().el),this.$(".server-dropdown-container").append(this.serverDropdown.render().el),this.$el.tooltip({selector:".navbar-glyphicon-btn",placement:"bottom",template:t}),this
},focusSearch:function(){this.$(".input-search").focus()},searchAll:function(){var e=this.$(".input-search").val();e.length>2&&i.trigger("navigate:search",{query:e})},searchSection:function(){var e=this.$(".input-search").val(),t=this.model.get("activeServer"),n=this.model.get("activeSection"),a=n.get("media");a.search!==e&&(a.search=e,e?i.trigger("navigate:sectionFilter",{serverID:t.id,sectionID:n.id,type:a.mediaType,key:"title",value:e}):(i.trigger("removeAll:filter",{key:"title"}),i.trigger("navigate:section",{serverID:t.id,sectionID:n.id,silent:!0})))
},onViewChange:function(e,t){switch(this.$(".navbar-glyphicon-btn").removeClass("active"),t){case"dashboard":this.$(".home-icon-btn").addClass("active");break;case"settings":this.$(".settings-icon-btn").addClass("active");break;case"activity":this.$(".activity-icon-btn").addClass("active")}},onSectionChange:function(){var e=this.model.get("activeSection"),t=this.model.get("activeMedia"),i=this.model.get("activeChannel"),s=n.t("Search");this.inSection=e&&!t&&!i,this.inSection&&(s+=" "+a.truncate(e.get("title"),10)),this.$(".input-search").attr("placeholder",s)
},onSearchChange:function(e,t){this.$(".input-search").val(t),t?this.$(".clear-search-btn").removeClass("hide"):this.$(".clear-search-btn").addClass("hide")},onSearchReset:function(){var e=this.model.get("activeSection"),t=e.get("media");t.search="",this.$(".input-search").val(""),this.$(".clear-search-btn").addClass("hide")},onFriendRequestsReset:function(e){e.length?this.$(".friend-requests-badge").removeClass("hide").text(e.length):this.$(".friend-requests-badge").addClass("hide")},onSearchFocus:function(e){d(e.target).hasClass("keyboard-focus")||this.$(".search-container").addClass("selected")
},onSearchBlur:function(){this.$(".search-container").removeClass("selected")},onSearchKeyUp:function(e){13!==e.which&&(0===this.$(e.target).val().length?this.$(".clear-search-btn").addClass("hide"):this.$(".clear-search-btn").removeClass("hide"),this.inSection&&(this.searchTimeout&&clearTimeout(this.searchTimeout),this.searchTimeout=setTimeout(_.bind(this.searchSection,this),500)))},onSearchSubmit:function(e){e.preventDefault(),this.$(".input-search").blur(),this.inSection?(this.searchTimeout&&clearTimeout(this.searchTimeout),this.searchSection()):this.searchAll()
},onClearSearchClick:function(e){e.preventDefault();var t=this.$(".input-search");if(this.$(".clear-search-btn").addClass("hide"),t.focus(),t.val(""),this.inSection){var n=this.model.get("activeServer"),a=this.model.get("activeSection"),s=a.get("media");""!==s.search&&(s.search="",i.trigger("removeAll:filter",{key:"title"}),i.trigger("navigate:section",{serverID:n.id,sectionID:a.id,silent:!0}))}},onUpdateClick:function(e){e.preventDefault(),"download"===s.get("updateStatus")?i.trigger("command:InstallUpdate"):window.location.reload(!0)
},onServerClick:function(){d(".tooltip").remove()},onAccountClick:function(){d(".tooltip").remove()},onSignOutClick:function(e){e.preventDefault(),i.trigger("command:SignOut")}});return h}),define("hb!templates/desktop/StatusView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var s,r,l="",o=i.helperMissing,c=this.escapeExpression;return l+='<a class="activity-btn gray" href="#" tabindex="-1" rel="tooltip" data-tooltip-position="fixed" title="',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Activity",r):o.call(t,"t","Activity",r)))+'"><i class="glyphicon cardio"></i></a>\n\n<span class="status"></span>\n'
})}),define("plex/desktop/view/StatusView",["hb!templates/desktop/StatusView.tpl","plex/base/control/Dispatcher","plex/base/view/BaseView"],function(e,t,i){var n=i.extend({className:"statusbar hidden",statusTimeout:null,active:!1,events:{mouseover:"onMouseOver",mouseout:"onMouseOut","click .activity-btn":"onActivityClick"},initialize:function(){_.bindAll(this,"hide"),this.addBinding(t,"show:status",this.onShowStatus)},render:function(){return this.$el.html(e()),this.$el.tooltip({selector:".gray",placement:"top"}),this
},hide:function(){this.active?this.statusTimeout=setTimeout(this.hide,1e3):this.$el.addClass("hidden")},onShowStatus:function(e,t){this.server=e,this.$(".status").text(t),this.$el.removeClass("hidden"),this.statusTimeout&&clearTimeout(this.statusTimeout),this.statusTimeout=setTimeout(this.hide,5e3)},onMouseOver:function(){this.active=!0},onMouseOut:function(){this.active=!1},onActivityClick:function(e){e.preventDefault(),t.trigger("navigate:notifications",{serverID:this.server.id})}});return n}),define("hb!templates/base/BackgroundView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){return this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{},'<div class="fanart hidden"></div>\n<div class="fanart-overlay"></div>\n'
})}),define("plex/base/view/BackgroundView",["hb!templates/base/BackgroundView.tpl","plex/base/control/Dispatcher","plex/base/view/BaseView","plex/base/view/images/BaseImage"],function(e,t,i,n){var a=i.extend({className:"fanart-container hide",count:0,initialize:function(){this.fanart=this.registerView(new n({transcode:!0,width:1280,height:720})),this.addBinding(t,"show:background",this.onShow),this.addBinding(t,"hide:background",this.onHide)},render:function(){return this.$el.html(e()),this},onShow:function(e){this.count++;
var t=e.get("art");this.art!==t&&(this.art=t,this.$el.removeClass("hide"),_.delay(_.bind(function(){this.fanart.server=e.server,this.fanart.load(t,!0).done(_.bind(function(e){this.$(".fanart").css("background-image","url("+e+")").removeClass("hidden")},this))},this),200))},onHide:function(){this.count--,this.count>-1||(this.art=null,this.count=0,this.$el.addClass("hide"),this.$(".fanart").addClass("hidden"))}});return a}),define("plex/desktop/view/AppView",["plex/base/model/AppModel","plex/base/model/HeaderModel","plex/base/view/BaseAppView","plex/desktop/view/nav/NavBarView","plex/desktop/view/StatusView","plex/base/view/BackgroundView"],function(e,t,i,n,a,s){var r=i.extend({initialize:function(){i.prototype.initialize.apply(this,arguments),this.headerView=new n({model:t}),this.statusView=new a,this.background=new s
},render:function(){return this.$(".scroll-container").empty(),this.$el.prepend(this.headerView.render().el),this.$el.append(this.statusView.render().el),this.$el.append(this.background.render().el),this.onLoadingChange(e,e.get("loading")),this}});return r}),define("hb!templates/desktop/dashboard/DashboardView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return"show-sidebar"}function r(){return"fluid"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};
var l,o="",c=this;return o+='<div class="row ',l=i["if"].call(t,t.sidebarOpen,{hash:{},inverse:c.noop,fn:c.program(1,s,a),data:a}),(l||0===l)&&(o+=l),o+=" ",l=i["if"].call(t,t.fluidWidth,{hash:{},inverse:c.noop,fn:c.program(3,r,a),data:a}),(l||0===l)&&(o+=l),o+='">\n	<div id="dashboard-main" class="column-main">\n		<div class="priority0">\n			<div class="row-fluid module"></div>\n			<div class="row-fluid module"></div>\n			<div class="row-fluid module"></div>\n		</div>\n		<div class="priority1">\n			<div class="row-fluid module"></div>\n			<div class="row-fluid module"></div>\n			<div class="row-fluid module"></div>\n		</div>\n		<div class="priority2">\n			<div class="row-fluid module"></div>\n			<div class="row-fluid module"></div>\n			<div class="row-fluid module"></div>\n		</div>\n		<div class="priority3">\n			<div class="row-fluid module"></div>\n			<div class="row-fluid module"></div>\n			<div class="row-fluid module"></div>\n		</div>\n		<div class="priority4">\n			<div class="row-fluid module"></div>\n			<div class="row-fluid module"></div>\n			<div class="row-fluid module"></div>\n		</div>\n		<div class="priority5">\n			<div class="row-fluid module"></div>\n			<div class="row-fluid module"></div>\n			<div class="row-fluid module"></div>\n		</div>\n		<div class="priority6">\n			<div class="row-fluid module"></div>\n			<div class="row-fluid module"></div>\n			<div class="row-fluid module"></div>\n		</div>\n	</div>\n\n	<div id="dashboard-sidebar" class="column-sidebar">\n		<div class="priority0">\n			<div class="row-fluid module"></div>\n			<div class="row-fluid module"></div>\n			<div class="row-fluid module"></div>\n		</div>\n		<div class="priority1">\n			<div class="row-fluid module"></div>\n			<div class="row-fluid module"></div>\n			<div class="row-fluid module"></div>\n		</div>\n		<div class="priority2">\n			<div class="row-fluid module"></div>\n			<div class="row-fluid module"></div>\n			<div class="row-fluid module"></div>\n		</div>\n		<div class="priority3">\n			<div class="row-fluid module"></div>\n			<div class="row-fluid module"></div>\n			<div class="row-fluid module"></div>\n		</div>\n		<div class="priority4">\n			<div class="row-fluid module"></div>\n			<div class="row-fluid module"></div>\n			<div class="row-fluid module"></div>\n		</div>\n		<div class="priority5">\n			<div class="row-fluid module"></div>\n			<div class="row-fluid module"></div>\n			<div class="row-fluid module"></div>\n		</div>\n		<div class="priority6">\n			<div class="row-fluid module"></div>\n			<div class="row-fluid module"></div>\n			<div class="row-fluid module"></div>\n		</div>\n	</div>\n</div>\n'
})}),define("hb!templates/desktop/dashboard/DashboardLoginView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var s,r,l="",o=i.helperMissing,c=this.escapeExpression;return l+='<div class="dashboard-well-header dashboard-well-header-secondary well-header">\n	<h3>',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Sign In",r):o.call(t,"t","Sign In",r)))+'</h3>\n</div>\n\n<form class="row-fluid dashboard-login-form">\n	<div class="control-group">\n		<input type="text" class="input-dark span12" name="username" placeholder="',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"username or email",r):o.call(t,"t","username or email",r)))+'">\n	</div>\n\n	<div class="control-group">\n		<input type="password" class="input-dark span12" name="password" placeholder="',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"password",r):o.call(t,"t","password",r)))+'">\n	</div>\n\n	<div class="control-group">\n		<button type="submit" class="btn btn-primary pull-right">',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Sign In",r):o.call(t,"t","Sign In",r)))+'</button>\n\n		<label>\n			<input type="checkbox" name="rememberMe" value="1" checked>\n			',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Remember Me",r):o.call(t,"t","Remember Me",r)))+"\n		</label>\n	</div>\n</form>\n"
})}),define("plex/desktop/view/dashboard/DashboardLoginView",["hb!templates/desktop/dashboard/DashboardLoginView.tpl","plex/base/control/Dispatcher","plex/base/model/AppModel","plex/base/view/BaseView","spin"],function(e,t,i,n){var a=n.extend({className:"well span12",priority:null,events:{"submit .dashboard-login-form":"onSubmit"},initialize:function(){this.priority={module:this,visible:!0,rank:0,sidebar:!0}},render:function(){return this.$el.html(e()),this},onSubmit:function(e){e.preventDefault();
var i=e.currentTarget,n=this.$("[type=submit]");if(!n.hasClass("active")){n.spinContents("tiny");var a={username:i.username.value,password:i.password.value,rememberMe:i.rememberMe.checked,silent:!0,noRedirect:!0};a.success=_.bind(function(){n.spinContents(!1),this.trigger("refresh")},this),a.error=_.bind(function(){n.spinContents(!1)}),t.trigger("command:SignIn",a)}}});return a}),define("hb!templates/desktop/dashboard/DashboardSectionView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return"well-header-dropdown"
}function r(e,t){var n,a,s,r="";return r+='\n		<ul class="well-header-actions">\n			<li><button type="button" class="add-btn btn btn-inverse btn-icon" rel="tooltip" title="',s={hash:{},data:t},r+=g((n=i.t||e.t,n?n.call(e,"Add Section",s):m.call(e,"t","Add Section",s)))+'"><i class="glyphicon plus"></i></button></li>\n			<li><button type="button" class="edit-btn btn btn-inverse btn-icon ',a=i["if"].call(e,e.pending,{hash:{},inverse:v.noop,fn:v.program(4,l,t),data:t}),(a||0===a)&&(r+=a),r+=" ",a=i["if"].call(e,e.empty,{hash:{},inverse:v.noop,fn:v.program(4,l,t),data:t}),(a||0===a)&&(r+=a),r+='" rel="tooltip" title="',s={hash:{},data:t},r+=g((n=i.t||e.t,n?n.call(e,"Edit Sections",s):m.call(e,"t","Edit Sections",s)))+'"><i class="glyphicon pencil"></i></button></li>\n			<li>\n				<div class="btn-group btn-group-inverse">\n					<button type="button" class="refresh-btn btn btn-inverse btn-icon" rel="tooltip" title="',s={hash:{},data:t},r+=g((n=i.t||e.t,n?n.call(e,"Refresh Library",s):m.call(e,"t","Refresh Library",s)))+'"><i class="glyphicon repeat"></i></button>\n					<button type="button" class="btn btn-inverse btn-icon dropdown-toggle" data-toggle="dropdown"><i class="glyphicon-caret small"></i></button>\n\n					<ul class="dropdown-menu pull-right">\n						<li><a class="refresh-btn" data-refresh-type="turbo" href="#">',s={hash:{},data:t},r+=g((n=i.t||e.t,n?n.call(e,"Turbo Scan (Default)",s):m.call(e,"t","Turbo Scan (Default)",s)))+'</a></li>\n						<li><a class="refresh-btn" data-refresh-type="deep" href="#">',s={hash:{},data:t},r+=g((n=i.t||e.t,n?n.call(e,"Deep Scan",s):m.call(e,"t","Deep Scan",s)))+'</a></li>\n					</ul>\n				</div>\n			</li>\n			<li>\n				<div class="btn-group btn-group-inverse">\n					<button type="button" class="btn btn-inverse btn-icon dropdown-toggle" rel="tooltip" data-toggle="dropdown"><span class="btn-icon-label">',s={hash:{},data:t},r+=g((n=i.t||e.t,n?n.call(e,"More",s):m.call(e,"t","More",s)))+'</span> <i class="glyphicon-caret small"></i></button>\n\n					<ul class="maintenance-dropdown-menu dropdown-menu pull-right">\n						<li>\n							<div class="maintenance-control"><button type="button" class="optimize-btn btn btn-icon"><i class="glyphicon flash"></i> <span class="btn-icon-label">',s={hash:{},data:t},r+=g((n=i.t||e.t,n?n.call(e,"Optimize",s):m.call(e,"t","Optimize",s)))+'</span></button></div>\n							<div class="maintenance-summary">',s={hash:{},data:t},r+=g((n=i.t||e.t,n?n.call(e,"Cleans up the library database and ensures it is operating as quickly as possible. This is especially useful when you've added or removed a large amount of media from the library.",s):m.call(e,"t","Cleans up the library database and ensures it is operating as quickly as possible. This is especially useful when you've added or removed a large amount of media from the library.",s)))+'</div>\n						</li>\n						<li>\n							<div class="maintenance-control"><button type="button" class="empty-trash-btn btn btn-icon"><i class="glyphicon bin"></i> <span class="btn-icon-label">',s={hash:{},data:t},r+=g((n=i.t||e.t,n?n.call(e,"Empty Trash",s):m.call(e,"t","Empty Trash",s)))+'</span></button></div>\n							<div class="maintenance-summary">',s={hash:{},data:t},r+=g((n=i.t||e.t,n?n.call(e,"By default the media server doesn't remove information for media right away. This helps if a drive is temporarily disconnected. When you empty the trash for a section, all information about missing media is deleted.",s):m.call(e,"t","By default the media server doesn't remove information for media right away. This helps if a drive is temporarily disconnected. When you empty the trash for a section, all information about missing media is deleted.",s)))+'</div>\n						</li>\n						<li>\n							<div class="maintenance-control"><button type="button" class="clean-bundles-btn btn btn-icon"><i class="glyphicon cargo"></i> <span class="btn-icon-label">',s={hash:{},data:t},r+=g((n=i.t||e.t,n?n.call(e,"Clean Bundles",s):m.call(e,"t","Clean Bundles",s)))+'</span></button></div>\n							<div class="maintenance-summary">',s={hash:{},data:t},r+=g((n=i.t||e.t,n?n.call(e,"The media server stores information about your media to disk, as well as posters, artwork, and other media resources from the Internet. Running this task deletes any bundles which are no longer in use.",s):m.call(e,"t","The media server stores information about your media to disk, as well as posters, artwork, and other media resources from the Internet. Running this task deletes any bundles which are no longer in use.",s)))+"</div>\n						</li>\n					</ul>\n				</div>\n			</li>\n		</ul>\n	"
}function l(){return"hide"}function o(e,t){var n,a,s="";return s+="\n			",a={hash:{},data:t},s+=g((n=i.t||e.t,n?n.call(e,"Shared Libraries",a):m.call(e,"t","Shared Libraries",a)))+"\n		"}function c(e,t){var n,a,s="";return s+="\n			",a={hash:{},data:t},s+=g((n=i.t||e.t,n?n.call(e,"My Library",a):m.call(e,"t","My Library",a)))+"\n		"}function d(e,t){var n,a,s="";return s+="\n		",a={hash:{},data:t},s+=g((n=i.t||e.t,n?n.call(e,"There are no available shared libraries.",a):m.call(e,"t","There are no available shared libraries.",a)))+' <a href="https://my.plexapp.com">',a={hash:{},data:t},s+=g((n=i.t||e.t,n?n.call(e,"Go to myPlex",a):m.call(e,"t","Go to myPlex",a)))+"</a>.\n	"
}function h(e,t){var n,a,s="";return s+="\n		",a={hash:{},data:t},s+=g((n=i.t||e.t,n?n.call(e,"There are no available library sections.",a):m.call(e,"t","There are no available library sections.",a)))+' <a class="add-btn" href="#">',a={hash:{},data:t},s+=g((n=i.t||e.t,n?n.call(e,"Add a section",a):m.call(e,"t","Add a section",a)))+"</a>.\n	"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var u,p,f="",m=i.helperMissing,g=this.escapeExpression,v=this;return f+='<div class="dashboard-well-header well-header ',u=i.unless.call(t,t.shared,{hash:{},inverse:v.noop,fn:v.program(1,s,a),data:a}),(u||0===u)&&(f+=u),f+='">\n	',u=i.unless.call(t,t.shared,{hash:{},inverse:v.noop,fn:v.program(3,r,a),data:a}),(u||0===u)&&(f+=u),f+="\n\n	<h3>\n		",u=i["if"].call(t,t.shared,{hash:{},inverse:v.program(8,c,a),fn:v.program(6,o,a),data:a}),(u||0===u)&&(f+=u),f+='\n	</h3>\n</div>\n\n<div class="dashboard-empty-message ',u=i["if"].call(t,t.pending,{hash:{},inverse:v.noop,fn:v.program(4,l,a),data:a}),(u||0===u)&&(f+=u),f+=" ",u=i.unless.call(t,t.empty,{hash:{},inverse:v.noop,fn:v.program(4,l,a),data:a}),(u||0===u)&&(f+=u),f+='">\n	',u=i["if"].call(t,t.shared,{hash:{},inverse:v.program(12,h,a),fn:v.program(10,d,a),data:a}),(u||0===u)&&(f+=u),f+='\n</div>\n\n<div class="list-actions hide">\n	<button type="button" class="edit-done-btn btn btn-primary btn-medium">',p={hash:{},data:a},f+=g((u=i.t||t.t,u?u.call(t,"Done",p):m.call(t,"t","Done",p)))+"</button>\n</div>\n"
})}),define("hb!templates/desktop/lists/items/SectionListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return"active"}function r(e,t){var n,a;return a={hash:{},data:t},b((n=i.t||e.t,n?n.call(e,"Stop Refresh",a):y.call(e,"t","Stop Refresh",a)))}function l(e,t){var n,a;return a={hash:{},data:t},b((n=i.t||e.t,n?n.call(e,"Refresh",a):y.call(e,"t","Refresh",a)))}function o(e){var t,i="";return i+='\n		<i class="poster section-poster plex-icon-'+b((t=e.section,t=null==t||t===!1?t:t.type,typeof t===w?t.apply(e):t))+'"></i>\n	'
}function c(){return'\n		<i class="cloud-sync-icon glyphicon cloud"></i>\n	'}function d(e,t){var n,a,s="";return s+='\n			<span class="source-title secondary">',a={hash:{},data:t},s+=b((n=i.truncate||e.truncate,n?n.call(e,(n=e.server,null==n||n===!1?n:n.sourceTitle),10,a):y.call(e,"truncate",(n=e.server,null==n||n===!1?n:n.sourceTitle),10,a)))+"</span>\n		"}function h(e,t){var n,a,s="";return s+="\n			",a=i["if"].call(e,(n=e.server,null==n||n===!1?n:n.friendlyName),{hash:{},inverse:x.program(16,p,t),fn:x.program(14,u,t),data:t}),(a||0===a)&&(s+=a),s+="\n		"
}function u(e,t){var n,a,s="";return s+='\n				<span class="source-title secondary">',a={hash:{},data:t},s+=b((n=i.truncate||e.truncate,n?n.call(e,(n=e.server,null==n||n===!1?n:n.friendlyName),10,a):y.call(e,"truncate",(n=e.server,null==n||n===!1?n:n.friendlyName),10,a)))+"</span>\n			"}function p(e,t){var n,a,s="";return s+='\n				<span class="source-title secondary">',a={hash:{},data:t},s+=b((n=i.truncate||e.truncate,n?n.call(e,(n=e.server,null==n||n===!1?n:n.name),10,a):y.call(e,"truncate",(n=e.server,null==n||n===!1?n:n.name),10,a)))+"</span>\n			"
}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var f,m,g,v="",y=i.helperMissing,b=this.escapeExpression,w="function",x=this;return v+='<a class="clearfix" href="#!/servers/'+b((f=t.server,f=null==f||f===!1?f:f.machineIdentifier,typeof f===w?f.apply(t):f))+"/sections/",g={hash:{},data:a},v+=b((f=i.encodeUrl||t.encodeUrl,f?f.call(t,(f=t.section,null==f||f===!1?f:f.key),g):y.call(t,"encodeUrl",(f=t.section,null==f||f===!1?f:f.key),g)))+'" data-focus="keyboard">\n	<div class="actions">\n		<button type="button" class="edit-section-btn btn btn-icon" rel="tooltip" title="',g={hash:{},data:a},v+=b((f=i.t||t.t,f?f.call(t,"Edit",g):y.call(t,"t","Edit",g)))+'"><i class="glyphicon pencil"></i></button>\n		<button type="button" class="refresh-section-btn btn btn-icon ',m=i["if"].call(t,(f=t.section,null==f||f===!1?f:f.refreshing),{hash:{},inverse:x.noop,fn:x.program(1,s,a),data:a}),(m||0===m)&&(v+=m),v+='" rel="tooltip" title="',m=i["if"].call(t,(f=t.section,null==f||f===!1?f:f.refreshing),{hash:{},inverse:x.program(5,l,a),fn:x.program(3,r,a),data:a}),(m||0===m)&&(v+=m),v+='"><i class="glyphicon repeat"></i></button>\n		<button type="button" class="delete-section-btn btn btn-danger btn-icon" rel="tooltip" title="',g={hash:{},data:a},v+=b((f=i.t||t.t,f?f.call(t,"Delete",g):y.call(t,"t","Delete",g)))+'"><i class="glyphicon ban"></i></button>\n	</div>\n\n	',m=i.unless.call(t,(f=t.section,null==f||f===!1?f:f.thumb),{hash:{},inverse:x.noop,fn:x.program(7,o,a),data:a}),(m||0===m)&&(v+=m),v+="\n\n	",m=i["if"].call(t,(f=t.server,null==f||f===!1?f:f.synced),{hash:{},inverse:x.noop,fn:x.program(9,c,a),data:a}),(m||0===m)&&(v+=m),v+='\n\n	<h3>\n		<span class="section-title">',g={hash:{},data:a},v+=b((f=i.truncate||t.truncate,f?f.call(t,(f=t.section,null==f||f===!1?f:f.title),20,g):y.call(t,"truncate",(f=t.section,null==f||f===!1?f:f.title),20,g)))+"</span>\n\n		",m=i["if"].call(t,(f=t.server,null==f||f===!1?f:f.sourceTitle),{hash:{},inverse:x.program(13,h,a),fn:x.program(11,d,a),data:a}),(m||0===m)&&(v+=m),v+="\n	</h3>\n\n	<h4>",g={hash:{},data:a},v+=b((f=i.t||t.t,f?f.call(t,"Last updated",g):y.call(t,"t","Last updated",g)))+" ",g={hash:{},data:a},v+=b((f=i.timeAgo||t.timeAgo,f?f.call(t,(f=t.section,null==f||f===!1?f:f.updatedAt),g):y.call(t,"timeAgo",(f=t.section,null==f||f===!1?f:f.updatedAt),g)))+"</h4>\n</a>\n"
})}),define("plex/desktop/view/lists/items/SectionListItem",["hb!templates/desktop/lists/items/SectionListItem.tpl","plex/base/control/Dispatcher","plex/base/model/AppModel","plex/base/model/SectionModel","plex/base/model/GlobalSectionModel","plex/base/view/BaseView","plex/base/view/images/BaseImage","plex/desktop/view/modals/EditSectionModal","jquery","spin"],function(e,t,i,n,a,s,r,l,o){var c=s.extend({tagName:"li",className:"disabled",thumbSize:75,events:{"click a":"onClick","click .edit-section-btn":"onEditClick","click .refresh-section-btn":"onRefreshClick","click .delete-section-btn":"onDeleteClick"},initialize:function(){var e=this.model.get("thumb");
e&&(this.thumb=this.registerView(new r({model:this.model,url:e,className:"poster section-poster custom-section-poster",transcode:!0,width:this.thumbSize,height:this.thumbSize}))),this.addBinding(this.model,"change",this.onChange)},render:function(){return this.$el.html(e({server:this.model.server.toJSON(),section:this.model.toJSON()})),this.model.get("limited")&&this.$el.addClass("limited"),this.model.get("refreshing")&&this.$(".refresh-section-btn").spinContents("tiny"),this.thumb&&this.$(".actions").after(this.thumb.render().el),o(".tooltip").remove(),this
},getSectionModel:function(){var e;if(this.model instanceof a){var t={server:this.model.server,onlyIfCached:!0};e=new n({key:this.model.get("key")},t)}else e=this.model;return e},onChange:function(){this.$(".refresh-section-btn").spinContents(!1),this.render()},onClick:function(e){this.$el.hasClass("disabled")&&e.preventDefault()},onEditClick:function(e){e.preventDefault();var t=this.getSectionModel();_.isEmpty(t)||i.set("modal",new l({server:t.server,section:t}))},onRefreshClick:function(e){e.preventDefault();
var i=o(e.currentTarget),n=this.getSectionModel();_.isEmpty(n)||(i.hasClass("active")?(i.removeClass("active"),t.trigger("command:StopLibraryScan",n.server,n)):(i.addClass("active"),t.trigger("command:StartLibraryScan",n.server,n)))},onDeleteClick:function(e){e.preventDefault();var i=this.getSectionModel();_.isEmpty(i)||t.trigger("command:DeleteSection",i)}});return c}),define("plex/desktop/view/lists/dashboard/items/DashboardSectionListItem",["plex/desktop/view/lists/items/SectionListItem"],function(e){var t=e.extend({className:""});
return t}),define("plex/desktop/view/lists/dashboard/DashboardSectionList",["plex/base/view/lists/BaseList","plex/desktop/view/lists/dashboard/items/DashboardSectionListItem"],function(e,t){var i=e.extend({tagName:"ul",className:"tile-list section-tile-list",shared:!1,initialize:function(e){this.shared=e.shared,this.setup(t)},render:function(){return this.$el.empty(),this.shared&&this.$el.addClass("shared"),this.populate(this.collection),this}});return i}),define("plex/desktop/view/dashboard/DashboardSectionView",["hb!templates/desktop/dashboard/DashboardSectionView.tpl","plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel","plex/base/model/SettingsModel","plex/base/model/SectionModel","plex/base/view/BaseView","plex/desktop/view/lists/dashboard/DashboardSectionList","jquery"],function(e,t,i,n,a,s,r,l,o){var c=r.extend({className:"well span12",shared:!1,pending:!0,empty:!1,priority:null,events:{"click .add-btn":"onAddClick","click .edit-btn":"onEditClick","click .edit-done-btn":"onEditDoneClick","click .refresh-btn":"onRefreshClick","click .optimize-btn":"onOptimizeClick","click .empty-trash-btn":"onEmptyTrashClick","click .clean-bundles-btn":"onCleanBundlesClick"},initialize:function(e){this.id=e.id,this.shared=e.shared,this.pending=!0,this.empty=!1,this.priority={module:this,visible:null},this.shared?this.priority.rank=a.get("dashboardSharedLibrariesPriority"):(this.priority.visible=a.get("dashboardMyLibraryEnabled"),this.priority.rank=a.get("dashboardMyLibraryPriority")),this.sectionList=this.registerView(new l({collection:this.collection,shared:this.shared})),this.addBinding(this.collection,"add",this.onSectionAdd),this.addBinding(this.collection,"remove",this.onSectionRemove),this.collection.populate().always(_.bind(function(){this.pending=!1
},this)).done(_.bind(function(){this.empty=!1,this.$(".edit-btn").removeClass("hide"),this.shared&&null===this.priority.visible&&(this.priority.visible=a.get("dashboardSharedLibrariesEnabled"),this.trigger("render",this.priority))},this)).fail(_.bind(function(){this.empty=!0,this.$(".dashboard-empty-message").removeClass("hide"),this.$(".section-tile-list, .section-list").addClass("hide"),null===this.priority.visible&&(this.priority.visible=!1,this.trigger("render",this.priority))},this))},render:function(){return this.$el.html(e({shared:this.shared,pending:this.pending,empty:this.empty})),this.$(".list-actions").before(this.sectionList.render().el),this.$el.tooltip({selector:".btn-icon",placement:"bottom"}),this
},onSectionAdd:function(){this.$(".edit-btn").removeClass("hide")},onSectionRemove:function(){this.collection.length||(this.$(".dashboard-empty-message").removeClass("hide"),this.$(".edit-btn").removeClass("active").addClass("hide"),this.$(".list-actions").addClass("hide"),this.$(".section-list").removeClass("list media-list section-list").addClass("tile-list section-tile-list hide"))},onAddClick:function(e){e.preventDefault(),t.trigger("command:AddSection",!0)},onEditClick:function(e){e.preventDefault();
var t=o(e.currentTarget);t.hasClass("active")?(t.removeClass("active"),this.$(".list-actions").addClass("hide"),this.$(".section-list").removeClass("list media-list section-list").addClass("tile-list section-tile-list")):(t.addClass("active"),this.$(".list-actions").removeClass("hide"),this.$(".section-tile-list").removeClass("tile-list section-tile-list").addClass("list media-list section-list"))},onEditDoneClick:function(){this.$(".edit-btn").removeClass("active"),this.$(".list-actions").addClass("hide"),this.$(".section-list").removeClass("list media-list section-list").addClass("tile-list section-tile-list")
},onRefreshClick:function(e){e.preventDefault();var i={},a=o(e.target).data("refreshType"),s=n.get("servers");a?i[a]=!0:e.altKey&&(i.deep=!0),s.each(function(e){e.get("isAvailable")&&(e.get("shared")||"secondary"!==e.get("serverClass")&&t.trigger("command:StartLibraryScan",e,null,i))})},onOptimizeClick:function(e){e.preventDefault(),t.trigger("command:OptimizeLibrary",n.get("primaryServer"))},onEmptyTrashClick:function(e){e.preventDefault();var a=0,r=this.collection.length,l=_.bind(function(){a++,a===r&&n.set("alert",{status:"success",message:i.t("The trash for all sections was emptied.")})
},this);this.collection.each(function(e){var i={server:e.server,onlyIfCached:!0};return e=new s({key:e.get("key")},i),_.isEmpty(e)||e.get("limited")?(a++,void 0):(t.trigger("command:EmptyTrash",e.server,e,l),void 0)})},onCleanBundlesClick:function(e){e.preventDefault(),t.trigger("command:CleanBundles",n.get("primaryServer"))}});return c}),define("hb!templates/desktop/dashboard/DashboardFriendsView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};
var s,r,l="",o=i.helperMissing,c=this.escapeExpression;return l+='<div class="dashboard-well-header dashboard-well-header-secondary well-header">\n	<ul class="well-header-actions">\n		<li><a class="btn btn-inverse btn-icon" href="#!/friends" rel="tooltip" title="',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"View Friends",r):o.call(t,"t","View Friends",r)))+'"><i class="glyphicon more"></i></a></li>\n	</ul>\n\n	<h3>',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Invites",r):o.call(t,"t","Invites",r)))+"</h3>\n</div>\n"
})}),define("hb!templates/desktop/lists/myplex/items/FriendListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a,s="";return s+='\n		<button type="button" class="accept-btn btn btn-success btn-icon" rel="tooltip" title="',a={hash:{},data:t},s+=m((n=i.t||e.t,n?n.call(e,"Accept",a):f.call(e,"t","Accept",a)))+'"><i class="glyphicon circle-ok"></i></button>\n		<button type="button" class="reject-btn btn btn-danger btn-icon" rel="tooltip" title="',a={hash:{},data:t},s+=m((n=i.t||e.t,n?n.call(e,"Reject",a):f.call(e,"t","Reject",a)))+'"><i class="glyphicon ban"></i></button>\n	'
}function r(e,t){var n,a,s="";return s+='\n		<button type="button" class="cancel-btn btn btn btn-icon" title="',a={hash:{},data:t},s+=m((n=i.t||e.t,n?n.call(e,"Cancel",a):f.call(e,"t","Cancel",a)))+'"><i class="glyphicon circle-remove"></i></button>\n	'}function l(e,t){var n,a,s="";return s+='\n		<button type="button" class="delete-btn btn btn-danger btn-icon" title="',a={hash:{},data:t},s+=m((n=i.t||e.t,n?n.call(e,"Remove",a):f.call(e,"t","Remove",a)))+'"><i class="glyphicon ban"></i></button>\n	'
}function o(e,t){var n,a,s="";return s+="\n	<h4>",a={hash:{},data:t},s+=m((n=i.t||e.t,n?n.call(e,"wants to be your friend",a):f.call(e,"t","wants to be your friend",a)))+"</h4>\n"}function c(e,t){var n,a,s="";return s+="\n	<h4>",a={hash:{},data:t},s+=m((n=i.t||e.t,n?n.call(e,"has not accepted yet",a):f.call(e,"t","has not accepted yet",a)))+"</h4>\n"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var d,h,u,p="",f=i.helperMissing,m=this.escapeExpression,g=this,v="function";return p+='<div class="actions">\n	',u={hash:{},inverse:g.noop,fn:g.program(1,s,a),data:a},d=i.if_eq||t.if_eq,h=d?d.call(t,t.type,"requests",u):f.call(t,"if_eq",t.type,"requests",u),(h||0===h)&&(p+=h),p+="\n\n	",u={hash:{},inverse:g.noop,fn:g.program(3,r,a),data:a},d=i.if_eq||t.if_eq,h=d?d.call(t,t.type,"requested",u):f.call(t,"if_eq",t.type,"requested",u),(h||0===h)&&(p+=h),p+="\n\n	",u={hash:{},inverse:g.noop,fn:g.program(5,l,a),data:a},d=i.if_eq||t.if_eq,h=d?d.call(t,t.type,"all",u):f.call(t,"if_eq",t.type,"all",u),(h||0===h)&&(p+=h),p+="\n</div>\n\n<h3>"+m((d=t.friend,d=null==d||d===!1?d:d.title,typeof d===v?d.apply(t):d))+"</h3>\n\n",u={hash:{},inverse:g.noop,fn:g.program(7,o,a),data:a},d=i.if_eq||t.if_eq,h=d?d.call(t,t.type,"requests",u):f.call(t,"if_eq",t.type,"requests",u),(h||0===h)&&(p+=h),p+="\n\n",u={hash:{},inverse:g.noop,fn:g.program(9,c,a),data:a},d=i.if_eq||t.if_eq,h=d?d.call(t,t.type,"requested",u):f.call(t,"if_eq",t.type,"requested",u),(h||0===h)&&(p+=h),p+="\n"
})}),define("plex/desktop/view/lists/myplex/items/FriendListItem",["hb!templates/desktop/lists/myplex/items/FriendListItem.tpl","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel","plex/base/view/BaseView","plex/base/view/images/BaseImage","jquery"],function(e,t,i,n,a,s){var r=n.extend({tagName:"li",className:"well",type:null,thumb:null,events:{"click .accept-btn":"onAcceptClick","click .reject-btn":"onRejectClick","click .cancel-btn":"onCancelClick","click .delete-btn":"onDeleteClick"},initialize:function(e){this.type=e.list.type||"all",this.thumb=this.registerView(new a({model:this.model,modelAttr:"thumb",placeholder:"img/posters/friend.png",className:"poster friend-poster"})),this.addBinding(this.model,"change",this.render)
},render:function(){return this.$el.html(e({friend:this.model.toJSON(),type:this.type})),this.$(".actions").after(this.thumb.render().el),this.$el.tooltip({selector:".btn-icon",placement:"bottom"}),this},close:function(e){var t={opacity:0,height:0,"margin-bottom":0,"padding-top":0,"padding-bottom":0};this.$el.css("overflow","hidden").animate(t,400,e)},onAcceptClick:function(e){e.preventDefault(),s(e.currentTarget).tooltip("destroy"),this.failMessage=t.t("There was a problem accepting this friend request."),this.model.urlRoot="/pms/friends/requests",this.close(_.bind(this.onSaveClose,this))
},onRejectClick:function(e){e.preventDefault(),s(e.currentTarget).tooltip("destroy"),this.failMessage=t.t("There was a problem rejecting this friend request."),this.model.urlRoot="/pms/friends/requests",this.close(_.bind(this.onDeleteClose,this))},onCancelClick:function(e){e.preventDefault(),s(e.currentTarget).tooltip("destroy"),this.failMessage=t.t("There was a problem cancelling this friend request."),this.model.urlRoot="/pms/friends/requested",this.close(_.bind(this.onDeleteClose,this))},onDeleteClick:function(e){e.preventDefault(),s(e.currentTarget).tooltip("destroy"),this.failMessage=t.t("There was a problem deleting this friend request."),this.close(_.bind(this.onDeleteClose,this))
},onSaveClose:function(){this.model.save({user:this.model.id},{hideLoadingAlert:!0}).done(_.bind(function(){this.trigger("refresh")},this)).fail(_.bind(function(){i.set("alert",{status:"error",message:this.failMessage})},this))},onDeleteClose:function(){this.model.destroy({hideLoadingAlert:!0}).done(_.bind(function(){this.trigger("refresh")},this)).fail(_.bind(function(){i.set("alert",{status:"error",message:this.failMessage})},this))}});return r}),define("plex/desktop/view/lists/myplex/FriendList",["plex/base/view/lists/BaseList","plex/desktop/view/lists/myplex/items/FriendListItem"],function(e,t){var i=e.extend({tagName:"ul",className:"well-list friend-list",type:null,initialize:function(e){this.type=e.type||"all",this.setup(t)
},render:function(){return this.$el.empty(),this.populate(this.collection),this},addItem:function(){var t=e.prototype.addItem.apply(this,arguments);this.addBinding(t,"refresh",this.onRefresh)},onRefresh:function(){this.trigger("refresh")}});return i}),define("plex/desktop/view/dashboard/DashboardFriendsView",["hb!templates/desktop/dashboard/DashboardFriendsView.tpl","plex/base/view/BaseView","plex/desktop/view/lists/myplex/FriendList"],function(e,t,i){var n=t.extend({className:"dashboard-friends-container well span12",priority:null,requestsList:null,initialize:function(){this.priority={module:this,visible:null,rank:0,sidebar:!0},this.requestsList=this.registerView(new i({collection:this.collection,type:"requests"})),this.addBinding(this.collection,"reset",this.onReset),this.addBinding(this.requestsList,"refresh",this.onRefresh),this.collection.fetch()
},render:function(){return this.$el.html(e()),this.$el.append(this.requestsList.render().el),this.$el.tooltip({selector:".btn-icon",placement:"bottom"}),this},onReset:function(e){null===this.priority.visible?(this.priority.visible=e.length?!0:!1,this.trigger("render",this.priority)):this.priority.visible&&!e.length&&this.destroy()},onRefresh:function(){this.collection.fetch()}});return n}),define("hb!templates/desktop/dashboard/DashboardNowPlayingView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};
var s,r,l="",o=i.helperMissing,c=this.escapeExpression;return l+='<div class="dashboard-well-header dashboard-well-header-secondary well-header">\n	<ul class="well-header-actions">\n		<li><a class="btn btn-inverse btn-icon" href="#!/nowplaying" rel="tooltip" title="',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"View All",r):o.call(t,"t","View All",r)))+'"><i class="glyphicon more"></i></a></li>\n	</ul>\n\n	<h3>',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Now Playing",r):o.call(t,"t","Now Playing",r)))+"</h3>\n</div>\n"
})}),define("hb!templates/desktop/lists/server/items/NowPlayingListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a,s,o="";return o+='\n	<a class="card-container" href="#!/servers/',(n=i.serverID)?n=n.call(e,{hash:{},data:t}):(n=e.serverID,n=typeof n===C?n.apply(e):n),o+=_(n)+"/sections/",s={hash:{},data:t},o+=_((n=i.encodeUrl||e.encodeUrl,n?n.call(e,e.sectionID,s):A.call(e,"encodeUrl",e.sectionID,s)))+"/details/",a=i["if"].call(e,(n=e.media,null==n||n===!1?n:n.originalRatingKey),{hash:{},inverse:I.program(4,l,t),fn:I.program(2,r,t),data:t}),(a||0===a)&&(o+=a),o+='">\n'
}function r(e){var t;return _((t=e.media,t=null==t||t===!1?t:t.originalRatingKey,typeof t===C?t.apply(e):t))}function l(e){var t;return _((t=e.media,t=null==t||t===!1?t:t.ratingKey,typeof t===C?t.apply(e):t))}function o(e,t){var n,a,s="";return s+='\n	<a class="card-container" href="#!/servers/',(n=i.serverID)?n=n.call(e,{hash:{},data:t}):(n=e.serverID,n=typeof n===C?n.apply(e):n),s+=_(n)+"/channels/details?path=",a={hash:{},data:t},s+=_((n=i.encodeUrl||e.encodeUrl,n?n.call(e,(n=e.media,null==n||n===!1?n:n.key),a):A.call(e,"encodeUrl",(n=e.media,null==n||n===!1?n:n.key),a)))+'">\n'
}function c(e){var t,i="";return i+="\n							"+_((t=e.media,t=null==t||t===!1?t:t.grandparentTitle,typeof t===C?t.apply(e):t))+"\n\n						"}function d(e,t){var n,a;return a=i["if"].call(e,(n=e.media,null==n||n===!1?n:n.parentTitle),{hash:{},inverse:I.program(13,u,t),fn:I.program(11,h,t),data:t}),a||0===a?a:""}function h(e){var t,i="";return i+="\n							"+_((t=e.media,t=null==t||t===!1?t:t.parentTitle,typeof t===C?t.apply(e):t))+"\n\n						"}function u(e){var t,i="";return i+="\n							"+_((t=e.media,t=null==t||t===!1?t:t.title,typeof t===C?t.apply(e):t))+"\n\n						"
}function p(e,t){var n,a,s="";return s+='\n							<span class="pull-right">\n								',a={hash:{},data:t},s+=_((n=i.truncate||e.truncate,n?n.call(e,(n=e.media,n=null==n||n===!1?n:n.User,null==n||n===!1?n:n.title),15,a):A.call(e,"truncate",(n=e.media,n=null==n||n===!1?n:n.User,null==n||n===!1?n:n.title),15,a)))+"\n							</span>\n						"}function f(e,t){var n,a,s="";return s+='\n							<p><span class="session-state muted">',a={hash:{},data:t},s+=_((n=i.t||e.t,n?n.call(e,e.playerState,a):A.call(e,"t",e.playerState,a)))+"</span> ",a={hash:{},data:t},s+=_((n=i.truncate||e.truncate,n?n.call(e,e.playerTitle,25,a):A.call(e,"truncate",e.playerTitle,25,a)))+"</p>\n						"
}function m(e,t){var n,a,s,r="";return r+='\n							<p class="session-title muted">',s={hash:{},data:t},r+=_((n=i.t||e.t,n?n.call(e,"Transcoding",s):A.call(e,"t","Transcoding",s)))+" ",s={hash:{},inverse:I.noop,fn:I.program(20,g,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,(n=e.media,n=null==n||n===!1?n:n.TranscodeSession,null==n||n===!1?n:n.throttled),"1",s):A.call(e,"if_eq",(n=e.media,n=null==n||n===!1?n:n.TranscodeSession,null==n||n===!1?n:n.throttled),"1",s),(a||0===a)&&(r+=a),r+='</p>\n							<span class="session-stream-type muted">',s={hash:{},data:t},r+=_((n=i.t||e.t,n?n.call(e,"Video",s):A.call(e,"t","Video",s)))+"</span> ",s={hash:{},inverse:I.program(24,y,t),fn:I.program(22,v,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,(n=e.media,n=null==n||n===!1?n:n.TranscodeSession,null==n||n===!1?n:n.videoDecision),"copy",s):A.call(e,"if_eq",(n=e.media,n=null==n||n===!1?n:n.TranscodeSession,null==n||n===!1?n:n.videoDecision),"copy",s),(a||0===a)&&(r+=a),r+=" ("+_((n=e.media,n=null==n||n===!1?n:n.TranscodeSession,n=null==n||n===!1?n:n.videoCodec,typeof n===C?n.apply(e):n))+')<br>\n							<span class="session-stream-type muted">',s={hash:{},data:t},r+=_((n=i.t||e.t,n?n.call(e,"Audio",s):A.call(e,"t","Audio",s)))+"</span> ",s={hash:{},inverse:I.program(24,y,t),fn:I.program(22,v,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,(n=e.media,n=null==n||n===!1?n:n.TranscodeSession,null==n||n===!1?n:n.audioDecision),"copy",s):A.call(e,"if_eq",(n=e.media,n=null==n||n===!1?n:n.TranscodeSession,null==n||n===!1?n:n.audioDecision),"copy",s),(a||0===a)&&(r+=a),r+=" ("+_((n=e.media,n=null==n||n===!1?n:n.TranscodeSession,n=null==n||n===!1?n:n.audioCodec,typeof n===C?n.apply(e):n))+")<br>\n						"
}function g(e,t){var n,a,s="";return s+="(",a={hash:{},data:t},s+=_((n=i.t||e.t,n?n.call(e,"throttled",a):A.call(e,"t","throttled",a)))+")"}function v(e,t){var n,a;return a={hash:{},data:t},_((n=i.t||e.t,n?n.call(e,"Direct Stream",a):A.call(e,"t","Direct Stream",a)))}function y(e,t){var n,a;return a={hash:{},data:t},_((n=i.t||e.t,n?n.call(e,"Transcode",a):A.call(e,"t","Transcode",a)))}function b(e,t){var n,a,s="";return s+='\n							<p class="session-title muted">',a={hash:{},data:t},s+=_((n=i.t||e.t,n?n.call(e,"No Transcode Session",a):A.call(e,"t","No Transcode Session",a)))+"</p>\n						"
}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var w,x,k,S="",C="function",_=this.escapeExpression,A=i.helperMissing,I=this;return w=i["if"].call(t,t.sectionID,{hash:{},inverse:I.program(6,o,a),fn:I.program(1,s,a),data:a}),(w||0===w)&&(S+=w),S+='\n	<div class="poster-container">\n		<div class="poster-card">\n			<div class="poster-face front">\n				<ul class="poster-actions">\n					<li><button class="play-btn poster-action-btn"><i class="glyphicon play"></i></button></li>\n					<li><button class="info-btn poster-action-btn"><i class="glyphicon circle-info"></i></button></li>\n				</ul>\n\n				<div class="card-overlay card-progress-overlay">\n					<div class="card-progress-bar"><div class="track" style="width: ',(w=i.progress)?w=w.call(t,{hash:{},data:a}):(w=t.progress,w=typeof w===C?w.apply(t):w),S+=_(w)+'%"></div></div>\n\n					<h4>\n						',x=i["if"].call(t,(w=t.media,null==w||w===!1?w:w.grandparentTitle),{hash:{},inverse:I.program(10,d,a),fn:I.program(8,c,a),data:a}),(x||0===x)&&(S+=x),S+='\n					</h4>\n\n					<p class="card-details">\n						',x=i["if"].call(t,(w=t.media,null==w||w===!1?w:w.User),{hash:{},inverse:I.noop,fn:I.program(15,p,a),data:a}),(x||0===x)&&(S+=x),S+="\n\n						",k={hash:{},data:a},w=i.dashboardMediaCardDetails||t.dashboardMediaCardDetails,x=w?w.call(t,t.media,!1,k):A.call(t,"dashboardMediaCardDetails",t.media,!1,k),(x||0===x)&&(S+=x),S+='\n					</p>\n\n					<div class="session-details">\n						',x=i["if"].call(t,(w=t.media,null==w||w===!1?w:w.Player),{hash:{},inverse:I.noop,fn:I.program(17,f,a),data:a}),(x||0===x)&&(S+=x),S+="\n\n						",x=i["if"].call(t,(w=t.media,null==w||w===!1?w:w.TranscodeSession),{hash:{},inverse:I.program(26,b,a),fn:I.program(19,m,a),data:a}),(x||0===x)&&(S+=x),S+="\n					</div>\n				</div>\n			</div>\n		</div>\n	</div>\n</a>\n"
})}),define("plex/desktop/view/lists/server/items/NowPlayingListItem",["hb!templates/desktop/lists/server/items/NowPlayingListItem.tpl","plex/base/control/Dispatcher","plex/base/control/utils/MediaUtil","plex/base/control/utils/StringUtil","plex/base/model/AppModel","plex/base/view/BaseView","plex/base/view/images/BaseImage","jquery"],function(e,t,i,n,a,s,r){var l=s.extend({tagName:"li",screenshotWidth:438,screenshotPreferredIndex:"hd",screenshotInterval:null,screenshotIntervalDelay:2e3,screenshotCount:0,poster:null,posterFade:null,userThumb:null,events:{"click .play-btn":"onPlayClick","click .info-btn":"onInfoClick"},initialize:function(){this.screenshotCount=0;
var e=this.model.get("Player"),t=this.model.get("art"),i=this.model.get("thumb"),n=t?t:i,a=this.getScreenshotUrl(),s={model:this.model,className:"poster",transcode:!0,width:this.screenshotWidth,height:this.screenshotWidth};this.poster=this.registerView(new r(_.extend(_.clone(s),{url:a?a:n,placeholder:"img/posters/poster_wide.png"}))),this.posterFade=this.registerView(new r(_.extend(_.clone(s),{className:"poster-fade hidden"}))),this.userThumb=this.registerView(new r({url:this.getUserThumbUrl(),placeholder:"img/posters/friend.png",className:"card-poster"})),e&&"playing"===e.state&&(this.screenshotInterval=setInterval(_.bind(this.updateScreenshot,this),this.screenshotIntervalDelay)),this.addBinding(this.model,"change:Player",this.onPlayerChange),this.addBinding(this.model,"change:viewOffset",this.onViewOffsetChange)
},render:function(){var t=this.model.section?this.model.section.id:this.model.get("librarySectionID"),i=this.model.get("viewOffset"),a=this.model.get("duration"),s=this.model.get("Player");return i=i&&a?100*(i/a):0,this.$el.html(e({serverID:this.model.server.id,sectionID:t,media:this.model.toJSON(),progress:i,playerState:n.titleCase(s.state)+" on",playerTitle:s.title})),this.$(".poster-face").prepend(this.posterFade.render().el),this.$(".poster-face").prepend(this.poster.render().el),this.$(".card-progress-bar").after(this.userThumb.render().el),this.$el.tooltip({selector:".btn-icon",placement:"bottom"}),this
},destroy:function(){s.prototype.destroy.call(this),this.screenshotInterval&&clearInterval(this.screenshotInterval)},getUserThumbUrl:function(){var e=a.get("myPlex"),t=e.get("friends"),i=this.model.get("User");if(i){if(i.thumb)return i.thumb;var n=t.get(i.id);if(n)return n.get("thumb")}},getScreenshotUrl:function(){var e=_.first(this.model.get("Media"));if(e){var t=this.model.get("viewOffset")||0,n=this.screenshotCount*this.screenshotIntervalDelay+t+4e3;return i.getThumb(e,n,this.screenshotPreferredIndex)
}},updateScreenshot:function(){this.screenshotCount++;var e=this.getScreenshotUrl();if(e){var t=this.$(".poster"),i=this.$(".poster-fade");this.posterFade.load(e,!0).done(function(e){i.attr("src",e).removeAttr("width").removeAttr("height").removeClass("hidden"),_.delay(function(){t.attr("src",e).removeAttr("width").removeAttr("height"),i.addClass("hidden")},1e3)})}},onPlayerChange:function(e,t){t&&(this.$(".session-state").text(n.titleCase(t.state)+" on"),"playing"!==t.state&&this.screenshotInterval?(clearInterval(this.screenshotInterval),this.screenshotInterval=null):"playing"!==t.state||this.screenshotInterval||(this.screenshotInterval=setInterval(_.bind(this.updateScreenshot,this),this.screenshotIntervalDelay)))
},onViewOffsetChange:function(e,t){var i=t;i=i?100*(i/e.get("duration")):0,this.$(".track").css("width",i+"%"),this.screenshotCount=0},onPlayClick:function(e){e.stopImmediatePropagation(),e.preventDefault(),t.trigger("command:PlayMedia",this.model,this.model.get("viewOffset"))},onInfoClick:function(e){e.stopImmediatePropagation(),e.preventDefault(),this.$(e.currentTarget).toggleClass("active"),this.$el.toggleClass("show-session-details")}});return l}),define("plex/desktop/view/lists/dashboard/items/DashboardNowPlayingListItem",["hb!templates/desktop/lists/server/items/NowPlayingListItem.tpl","plex/desktop/view/lists/server/items/NowPlayingListItem"],function(e,t){var i=t.extend({screenshotWidth:256,screenshotPreferredIndex:"sd"});
return i}),define("plex/desktop/view/lists/dashboard/DashboardNowPlayingList",["plex/base/view/lists/BaseList","plex/desktop/view/lists/dashboard/items/DashboardNowPlayingListItem"],function(e,t){var i=e.extend({className:"now-playing-list dashboard-now-playing-list",initialize:function(){this.setup(t)},render:function(){return this.$el.empty(),this.populate(this.collection),this}});return i}),define("plex/desktop/view/dashboard/DashboardNowPlayingView",["hb!templates/desktop/dashboard/DashboardNowPlayingView.tpl","plex/base/model/SettingsModel","plex/base/view/BaseView","plex/desktop/view/lists/dashboard/DashboardNowPlayingList"],function(e,t,i,n){var a=i.extend({className:"well span12",priority:null,list:null,initialize:function(){this.priority={module:this,visible:null,rank:t.get("dashboardNowPlayingPriority"),sidebar:!0},this.list=this.registerView(new n({collection:this.collection})),this.addBinding(this.collection,"reset",this.onReset),this.addBinding(this.collection,"remove",this.onReset),this.collection.fetch({hideLoadingAlert:!0})
},render:function(){return this.$el.html(e()),this.$el.append(this.list.render().el),this.$el.tooltip({selector:".btn-icon",placement:"bottom"}),this},onReset:function(){if(this.priority.visible)this.priority.visible&&!this.collection.length&&(this.$el.addClass("hide"),this.priority.visible=!1);else{var e=this.priority.visible===!1;this.priority.visible=this.collection.length?t.get("dashboardNowPlayingEnabled"):!1,this.priority.visible&&this.$el.hasClass("hide")?this.$el.removeClass("hide"):this.trigger("render",this.priority,e)
}}});return a}),define("hb!templates/desktop/dashboard/DashboardMediaView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return"dashboard-well-header-secondary"}function r(e,t){var n,a,s="";return s+='\n			<li>\n				<a class="btn btn-inverse btn-icon" href="#!/playlist/',(n=i.playlistName)?n=n.call(e,{hash:{},data:t}):(n=e.playlistName,n=typeof n===y?n.apply(e):n),s+=b(n)+'" rel="tooltip" title="',a={hash:{},data:t},s+=b((n=i.t||e.t,n?n.call(e,"View All",a):w.call(e,"t","View All",a)))+'"><i class="glyphicon more"></i></a>\n			</li>\n		'
}function l(e,t){var n;return n=i["if"].call(e,e.showPagination,{hash:{},inverse:x.noop,fn:x.program(6,o,t),data:t}),n||0===n?n:""}function o(e,t){var n,a,s,r="";return r+='\n			<li class="well-header-pagination">\n				<span class="page">',(n=i.page)?n=n.call(e,{hash:{},data:t}):(n=e.page,n=typeof n===y?n.apply(e):n),r+=b(n)+"</span> ",s={hash:{},data:t},r+=b((n=i.t||e.t,n?n.call(e,"of",s):w.call(e,"t","of",s)))+' <span class="pages">',(a=i.pages)?a=a.call(e,{hash:{},data:t}):(a=e.pages,a=typeof a===y?a.apply(e):a),r+=b(a)+'</span>\n			</li>\n			<li>\n				<div class="btn-group btn-group-inverse">\n					<button type="button" class="previous-btn btn btn-inverse btn-icon ',a=i.unless.call(e,e.showPrevious,{hash:{},inverse:x.noop,fn:x.program(7,c,t),data:t}),(a||0===a)&&(r+=a),r+='"><i class="glyphicon chevron-left"></i></button>\n					<button type="button" class="next-btn btn btn-inverse btn-icon ',a=i.unless.call(e,e.showNext,{hash:{},inverse:x.noop,fn:x.program(7,c,t),data:t}),(a||0===a)&&(r+=a),r+='"><i class="glyphicon chevron-right"></i></button>\n				</div>\n			</li>\n		'
}function c(){return"disabled"}function d(e,t){var n,a,s="";return s+="\n			",a={hash:{},data:t},s+=b((n=i.t||e.t,n?n.call(e,e.playlistLabel,a):w.call(e,"t",e.playlistLabel,a)))+"\n		"}function h(e,t){var n,a,s="";return s+="\n			",a={hash:{},data:t},s+=b((n=i.t||e.t,n?n.call(e,e.type,a):w.call(e,"t",e.type,a)))+"\n		"}function u(e,t){var n;return n=i["if"].call(e,e.showPagination,{hash:{},inverse:x.noop,fn:x.program(14,p,t),data:t}),n||0===n?n:""}function p(e,t){var n,a,s,r="";return r+='\n	<div class="dashboard-pagination">\n		<a class="previous-btn gray ',n=i.unless.call(e,e.showPrevious,{hash:{},inverse:x.noop,fn:x.program(15,f,t),data:t}),(n||0===n)&&(r+=n),r+='" href="#"><i class="glyphicon chevron-left"></i></a>\n\n		<span class="page">',(n=i.page)?n=n.call(e,{hash:{},data:t}):(n=e.page,n=typeof n===y?n.apply(e):n),r+=b(n)+"</span> ",s={hash:{},data:t},r+=b((n=i.t||e.t,n?n.call(e,"of",s):w.call(e,"t","of",s)))+" ",(a=i.pages)?a=a.call(e,{hash:{},data:t}):(a=e.pages,a=typeof a===y?a.apply(e):a),r+=b(a)+'\n\n		<a class="next-btn gray ',a=i.unless.call(e,e.showNext,{hash:{},inverse:x.noop,fn:x.program(15,f,t),data:t}),(a||0===a)&&(r+=a),r+='" href="#"><i class="glyphicon chevron-right"></i></a>\n	</div>\n'
}function f(){return"hide"}function m(){return"dashboard-playlist-list"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var g,v="",y="function",b=this.escapeExpression,w=i.helperMissing,x=this;return v+='<div class="dashboard-well-header ',g=i["if"].call(t,t.playlistName,{hash:{},inverse:x.noop,fn:x.program(1,s,a),data:a}),(g||0===g)&&(v+=g),v+=' well-header">\n	<ul class="well-header-actions">\n		',g=i["if"].call(t,t.playlistLabel,{hash:{},inverse:x.program(5,l,a),fn:x.program(3,r,a),data:a}),(g||0===g)&&(v+=g),v+="\n	</ul>\n\n	<h3>\n		",g=i["if"].call(t,t.playlistLabel,{hash:{},inverse:x.program(11,h,a),fn:x.program(9,d,a),data:a}),(g||0===g)&&(v+=g),v+="\n	</h3>\n</div>\n\n",g=i["if"].call(t,t.playlistLabel,{hash:{},inverse:x.noop,fn:x.program(13,u,a),data:a}),(g||0===g)&&(v+=g),v+='\n\n<ul class="dashboard-media-list ',g=i["if"].call(t,t.playlistName,{hash:{},inverse:x.noop,fn:x.program(17,m,a),data:a}),(g||0===g)&&(v+=g),v+='"></ul>\n'
})}),define("hb!templates/desktop/lists/dashboard/items/DashboardMediaListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e){var t,i="";return i+='\n	<a href="#!/playlist/'+R((t=e.media,t=null==t||t===!1?t:t.playlistName,typeof t===O?t.apply(e):t))+"/player/"+R((t=e.media,t=null==t||t===!1?t:t.id,typeof t===O?t.apply(e):t))+'" data-focus="keyboard">\n'}function r(e,t){var n,a,s,r="";return r+='\n	<a class="card-container" href="#!/servers/',(n=i.serverID)?n=n.call(e,{hash:{},data:t}):(n=e.serverID,n=typeof n===O?n.apply(e):n),r+=R(n)+"/sections/",s={hash:{},data:t},r+=R((n=i.encodeUrl||e.encodeUrl,n?n.call(e,e.sectionID,s):B.call(e,"encodeUrl",e.sectionID,s)))+"/details/",a=i["if"].call(e,(n=e.media,null==n||n===!1?n:n.originalRatingKey),{hash:{},inverse:$.program(6,o,t),fn:$.program(4,l,t),data:t}),(a||0===a)&&(r+=a),r+='" data-focus="keyboard">\n'
}function l(e){var t;return R((t=e.media,t=null==t||t===!1?t:t.originalRatingKey,typeof t===O?t.apply(e):t))}function o(e){var t;return R((t=e.media,t=null==t||t===!1?t:t.ratingKey,typeof t===O?t.apply(e):t))}function c(e,t){var n,a="";return a+='\n					<ul class="poster-actions">\n						',n=i["if"].call(e,e.primary,{hash:{},inverse:$.program(12,u,t),fn:$.program(9,d,t),data:t}),(n||0===n)&&(a+=n),a+="\n					</ul>\n				"}function d(e,t){var n,a="";return a+='\n							<li><button class="play-btn poster-action-btn ',n=i["if"].call(e,e.isPlaylistItem,{hash:{},inverse:$.noop,fn:$.program(10,h,t),data:t}),(n||0===n)&&(a+=n),a+='"><i class="glyphicon play"></i></button></li>\n						'
}function h(){return"default"}function u(e,t){var n,a="";return a+="\n							",n=i["if"].call(e,e.showPoster,{hash:{},inverse:$.program(15,f,t),fn:$.program(13,p,t),data:t}),(n||0===n)&&(a+=n),a+="\n						"}function p(e,t){var n,a="";return a+='\n								<li><button class="play-btn poster-action-btn poster-action-small-btn ',n=i["if"].call(e,e.isPlaylistItem,{hash:{},inverse:$.noop,fn:$.program(10,h,t),data:t}),(n||0===n)&&(a+=n),a+='"><i class="glyphicon play"></i></button></li>\n							'}function f(e,t){var n,a="";
return a+='\n								<li><button class="play-btn poster-action-btn poster-action-mini-btn ',n=i["if"].call(e,e.isPlaylistItem,{hash:{},inverse:$.noop,fn:$.program(10,h,t),data:t}),(n||0===n)&&(a+=n),a+='"><i class="glyphicon play"></i></button></li>\n							'}function m(e,t){var n,a,s,r="";return r+='\n					<div class="card-overlay card-progress-overlay">\n						',n=i["if"].call(e,e.showProgress,{hash:{},inverse:$.noop,fn:$.program(18,g,t),data:t}),(n||0===n)&&(r+=n),r+="\n\n							",n=i["if"].call(e,e.showPoster,{hash:{},inverse:$.program(28,k,t),fn:$.program(20,v,t),data:t}),(n||0===n)&&(r+=n),r+='\n\n						<p class="card-details">\n							',s={hash:{},data:t},n=i.dashboardMediaCardDetails||e.dashboardMediaCardDetails,a=n?n.call(e,e.media,e.showPoster,s):B.call(e,"dashboardMediaCardDetails",e.media,e.showPoster,s),(a||0===a)&&(r+=a),r+="\n						</p>\n					</div>\n				"
}function g(e,t){var n,a="";return a+='\n							<div class="card-progress-bar"><div class="track" style="width: ',(n=i.progress)?n=n.call(e,{hash:{},data:t}):(n=e.progress,n=typeof n===O?n.apply(e):n),a+=R(n)+'%"></div></div>\n						'}function v(e,t){var n,a,s,r="";return r+="\n								",s={hash:{},inverse:$.program(23,b,t),fn:$.program(21,y,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,(n=e.media,null==n||n===!1?n:n.type),"episode",s):B.call(e,"if_eq",(n=e.media,null==n||n===!1?n:n.type),"episode",s),(a||0===a)&&(r+=a),r+="\n\n							"
}function y(e,t){var n,a,s="";return s+="\n									<h4>",a={hash:{},data:t},s+=R((n=i.seasonEpisodeIndex||e.seasonEpisodeIndex,n?n.call(e,(n=e.media,null==n||n===!1?n:n.parentIndex),(n=e.media,null==n||n===!1?n:n.index),(n=e.media,null==n||n===!1?n:n.originallyAvailableAt),a):B.call(e,"seasonEpisodeIndex",(n=e.media,null==n||n===!1?n:n.parentIndex),(n=e.media,null==n||n===!1?n:n.index),(n=e.media,null==n||n===!1?n:n.originallyAvailableAt),a)))+"</h4>\n\n								"}function b(e,t){var n,a;return a=i["if"].call(e,(n=e.media,null==n||n===!1?n:n.parentTitle),{hash:{},inverse:$.program(26,x,t),fn:$.program(24,w,t),data:t}),a||0===a?a:""
}function w(e){var t,i="";return i+="\n									<h4>"+R((t=e.media,t=null==t||t===!1?t:t.parentTitle,typeof t===O?t.apply(e):t))+"</h4>\n\n								"}function x(e){var t,i="";return i+="\n									<h4>"+R((t=e.media,t=null==t||t===!1?t:t.title,typeof t===O?t.apply(e):t))+"</h4>\n\n								"}function k(e,t){var n,a,s="";return s+="\n								<h4>\n									",a=i["if"].call(e,(n=e.media,null==n||n===!1?n:n.grandparentTitle),{hash:{},inverse:$.program(31,C,t),fn:$.program(29,S,t),data:t}),(a||0===a)&&(s+=a),s+="\n								</h4>\n\n							"
}function S(e){var t,i="";return i+="\n										"+R((t=e.media,t=null==t||t===!1?t:t.grandparentTitle,typeof t===O?t.apply(e):t))+"\n\n									"}function C(e,t){var n,a;return a=i["if"].call(e,(n=e.media,null==n||n===!1?n:n.parentTitle),{hash:{},inverse:$.program(34,A,t),fn:$.program(32,_,t),data:t}),a||0===a?a:""}function _(e){var t,i="";return i+="\n										"+R((t=e.media,t=null==t||t===!1?t:t.parentTitle,typeof t===O?t.apply(e):t))+"\n\n									"}function A(e){var t,i="";return i+="\n										"+R((t=e.media,t=null==t||t===!1?t:t.title,typeof t===O?t.apply(e):t))+"\n\n									"
}function I(e,t){var n,a;return a=i["if"].call(e,(n=e.media,null==n||n===!1?n:n.playlistName),{hash:{},inverse:$.noop,fn:$.program(37,T,t),data:t}),a||0===a?a:""}function T(e,t){var n,a,s,r="";return r+='\n		<h3 class="title">\n			',a=i["if"].call(e,(n=e.media,null==n||n===!1?n:n.grandparentTitle),{hash:{},inverse:$.program(40,P,t),fn:$.program(38,M,t),data:t}),(a||0===a)&&(r+=a),r+='\n		</h3>\n\n		<h4 class="subtitle">\n			',s={hash:{},data:t},n=i.dashboardMediaCardDetails||e.dashboardMediaCardDetails,a=n?n.call(e,e.media,!1,s):B.call(e,"dashboardMediaCardDetails",e.media,!1,s),(a||0===a)&&(r+=a),r+="\n		</h4>\n	"
}function M(e){var t,i="";return i+="\n				"+R((t=e.media,t=null==t||t===!1?t:t.grandparentTitle,typeof t===O?t.apply(e):t))+"\n\n			"}function P(e,t){var n,a;return a=i["if"].call(e,(n=e.media,null==n||n===!1?n:n.parentTitle),{hash:{},inverse:$.program(43,L,t),fn:$.program(41,D,t),data:t}),a||0===a?a:""}function D(e){var t,i="";return i+="\n				"+R((t=e.media,t=null==t||t===!1?t:t.parentTitle,typeof t===O?t.apply(e):t))+"\n\n			"}function L(e){var t,i="";return i+="\n				"+R((t=e.media,t=null==t||t===!1?t:t.title,typeof t===O?t.apply(e):t))+"\n\n			"
}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var E,N="",O="function",R=this.escapeExpression,B=i.helperMissing,$=this;return E=i["if"].call(t,t.isPlaylistItem,{hash:{},inverse:$.program(3,r,a),fn:$.program(1,s,a),data:a}),(E||0===E)&&(N+=E),N+='\n\n	<div class="poster-container">\n		<div class="poster-card">\n			<div class="poster-face front">\n				',E=i["if"].call(t,t.showPlayButton,{hash:{},inverse:$.noop,fn:$.program(8,c,a),data:a}),(E||0===E)&&(N+=E),N+="\n\n				",E=i["if"].call(t,t.showOverlay,{hash:{},inverse:$.noop,fn:$.program(17,m,a),data:a}),(E||0===E)&&(N+=E),N+="\n			</div>\n		</div>\n	</div>\n\n	",E=i.unless.call(t,t.primary,{hash:{},inverse:$.noop,fn:$.program(36,I,a),data:a}),(E||0===E)&&(N+=E),N+="\n\n</a>\n"
})}),define("plex/desktop/view/lists/dashboard/items/DashboardMediaListItem",["hb!templates/desktop/lists/dashboard/items/DashboardMediaListItem.tpl","plex/base/control/Dispatcher","plex/base/model/AppModel","plex/base/view/BaseView","plex/base/view/images/BaseImage","jquery"],function(e,t,i,n,a,s){var r=n.extend({tagName:"li",type:!1,primary:!1,poster:null,initialize:function(e){this.type=e.type,this.primary=e.primary,this.poster=this.registerView(new a)},events:{"click a":"onClick","click .play-btn":"onPlayClick"},render:function(){var t,i,n="myPlex"===this.model.server.id,a="On Deck"===this.type,s=!this.primary&&!n,r=this.primary||!n,l=!1,o=this.model.section?this.model.section.id:this.model.get("librarySectionID"),c=this.model.get("type"),d=this.model.get("art"),h=this.model.get("thumb"),u="img/posters/poster.png",p=d?d:h;
s?("album"===c||"track"===c)&&(u="img/posters/album.png"):u="img/posters/poster_wide.png",this.primary?t=i=256:s?(p=this.model.get("grandparentThumb")?this.model.get("grandparentThumb"):h,t=98,i=200):t=i=72,this.poster.setup({model:this.model,url:p,placeholder:u,className:"poster",transcode:!0,width:t,height:i});var f=this.model.get("viewOffset"),m=this.model.get("duration");switch(f=f&&m?100*(f/m):0,c){case"movie":case"episode":case"album":case"track":case"playlistItem":l=!0}return this.$el.html(e({serverID:this.model.server.id,sectionID:o,media:this.model.toJSON(),primary:this.primary,isPlaylistItem:n,showProgress:a,showPlayButton:l,showPoster:s,showOverlay:r,progress:f})),this.primary&&this.$el.addClass("primary"),this.$(".poster-face").prepend(this.poster.render().el),this
},onClick:function(e){return"track"===this.model.get("type")?(e.preventDefault(),t.trigger("command:PlayTrack",this.model),void 0):"photo"===this.model.get("type")?(e.preventDefault(),t.trigger("show:photo",this.collection,this.model),void 0):void 0},onPlayClick:function(e){s(e.currentTarget).hasClass("default")||(e.stopImmediatePropagation(),e.preventDefault(),t.trigger("command:PlayMedia",this.model))}});return r}),define("plex/desktop/view/dashboard/DashboardMediaView",["hb!templates/desktop/dashboard/DashboardMediaView.tpl","plex/base/model/SettingsModel","plex/base/view/BaseView","plex/desktop/view/lists/dashboard/items/DashboardMediaListItem","jquery","moment"],function(e,t,i,n,a){var s=i.extend({className:"well span12",type:null,sidebar:!1,settings:null,priority:null,page:1,pageSize:5,events:{"click .previous-btn":"onPreviousClick","click .next-btn":"onNextClick"},initialize:function(e){switch(this.id=e.id,this.type=e.type,this.sidebar=e.sidebar,this.settings={},this.type){case"On Deck":this.settings.visible=t.get("dashboardOnDeckEnabled"),this.settings.rank=t.get("dashboardOnDeckPriority"),this.settings.dynamic=t.get("dashboardOnDeckDynamicPriority"),this.settings.wide=t.get("dashboardOnDeckWideThumbnails");
break;case"Recently Added":this.settings.visible=t.get("dashboardRecentlyAddedEnabled"),this.settings.rank=t.get("dashboardRecentlyAddedPriority"),this.settings.dynamic=t.get("dashboardRecentlyAddedDynamicPriority"),this.settings.wide=t.get("dashboardRecentlyAddedWideThumbnails");break;case"queue":this.settings.visible=t.get("dashboardQueueEnabled"),this.settings.rank=t.get("dashboardQueuePriority"),this.settings.limit=t.get("dashboardQueueLimit"),this.settings.dynamic=t.get("dashboardQueueDynamicPriority");
break;case"recommendations":this.settings.visible=t.get("dashboardRecommendationsEnabled"),this.settings.rank=t.get("dashboardRecommendationsPriority"),this.settings.limit=t.get("dashboardRecommendationsLimit"),this.settings.dynamic=t.get("dashboardRecommendationsDynamicPriority")}this.priority={module:this,visible:null,rank:this.settings.rank,sidebar:e.sidebar},this.page=1,this.addBinding(this.collection,"reset",this.onReset),this.collection.fetch({hideLoadingAlert:!0}),e.sidebar||(this.resizeThrottle=_.throttle(_.bind(this.onResize,this),100),a(window).on("resize",this.resizeThrottle))
},render:function(){var t=this.collection.unwatched&&this.settings.limit?this.collection.unwatched():this.collection.models,i=Math.ceil(t.length/this.pageSize);this.$el.html(e({type:this.type,page:this.page,pages:i,showPagination:i>1,showPrevious:this.page>1,showNext:i>this.page,playlistName:this.collection.playlistName,playlistLabel:this.collection.playlistLabel}));for(var a=this.page*this.pageSize-this.pageSize,s=a;a+this.pageSize>s&&!(s>=t.length);s++){var r=!1;"all"===this.settings.wide?r=!0:"first"!==this.settings.wide&&this.settings.wide||(r=0===s%this.pageSize);
var l=this.registerView(new n({model:t[s],collection:this.collection,primary:r,type:this.type}));this.$(".dashboard-media-list").append(l.render().el)}return this.$el.tooltip({selector:".btn-icon",placement:"bottom"}),this},calculatePageSize:function(){if(this.sidebar)return this.pageSize=5,this.pageSize;for(var e=this.width,t=98,i=256,n=12,a="none"===this.settings.wide?t:i,s=0;e>a;)a+=n,a+="all"===this.settings.wide?i:t,s++;return this.pageSize=s,this.pageSize},updatePageSize:function(){this.page=1,this.removeAllViews(),this.render()
},onReset:function(e){if(null===this.priority.visible){var t=e.unwatched?e.unwatched():e.models;if(t.length){if(this.settings.dynamic){var i=t[0].get("addedAt"),n=moment().diff(moment.unix(i),"days");n>7?this.priority.rank=this.settings.rank+1:n>1?this.priority.rank=this.settings.rank:1>=n&&(this.priority.rank=this.settings.rank-1)}this.priority.visible=this.settings.visible}else this.priority.visible=!1;this.trigger("render",this.priority)}},onPreviousClick:function(e){e.preventDefault(),a(e.currentTarget).hasClass("disabled")||this.page>1&&(this.page--,this.render())
},onNextClick:function(e){if(e.preventDefault(),!a(e.currentTarget).hasClass("disabled")){var t=this.collection.unwatched?this.collection.unwatched():this.collection.models;this.page<t.length&&(this.page++,this.render())}},onResize:function(){this.width=this.$el.width();var e=this.pageSize,t=this.calculatePageSize();e!==t&&this.updatePageSize()}});return s}),define("hb!templates/desktop/dashboard/DashboardAnnouncementsView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};
var s,r,l="",o=i.helperMissing,c=this.escapeExpression;return l+='<div class="dashboard-well-header dashboard-well-header-secondary well-header">\n	<ul class="well-header-actions">\n		<li><button type="button" class="mark-read-btn btn btn-inverse btn-icon" rel="tooltip" title="',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Mark as Read",r):o.call(t,"t","Mark as Read",r)))+'"><div class="unwatched-icon unwatched-full-icon"></div></button></li>\n	</ul>\n\n	<h3>',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Announcements",r):o.call(t,"t","Announcements",r)))+'</h3>\n</div>\n\n<div class="dashboard-carousel-container"></div>\n'
})}),define("hb!templates/desktop/lists/dashboard/DashboardAnnouncementList.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){return this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{},'<div class="dashboard-carousel-content">\n	<ul class="dashboard-announcement-list"></ul>\n</div>\n\n<div class="dashboard-carousel-navigation"></div>\n'})}),define("hb!templates/desktop/lists/dashboard/items/DashboardAnnouncementListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};
var s,r,l,o="",c="function",d=this.escapeExpression,h=i.helperMissing;return o+='<h3><a href="',(s=i.link)?s=s.call(t,{hash:{},data:a}):(s=t.link,s=typeof s===c?s.apply(t):s),o+=d(s)+'" target="_blank" tabindex="-1">',(s=i.title)?s=s.call(t,{hash:{},data:a}):(s=t.title,s=typeof s===c?s.apply(t):s),o+=d(s)+'</a></h3>\n\n<p class="date">',l={hash:{},data:a},o+=d((s=i.formatTimestamp||t.formatTimestamp,s?s.call(t,t.timestamp,l):h.call(t,"formatTimestamp",t.timestamp,l)))+'</p>\n\n<p class="description">',(r=i.description)?r=r.call(t,{hash:{},data:a}):(r=t.description,r=typeof r===c?r.apply(t):r),(r||0===r)&&(o+=r),o+="</p>\n"
})}),define("plex/desktop/view/lists/dashboard/items/DashboardAnnouncementListItem",["hb!templates/desktop/lists/dashboard/items/DashboardAnnouncementListItem.tpl","plex/base/view/BaseView","plex/base/view/images/BaseImage"],function(e,t,i){var n=t.extend({tagName:"li",icon:null,initialize:function(){this.icon=this.registerView(new i({model:this.model,modelAttr:"thumb",className:"poster pull-left"})),this.addBinding(this.model,"change",this.render)},render:function(){this.$el.html(e(this.model.toJSON()));
var t=100/this.model.collection.length;return this.$el.css("width",t+"%"),this.$(".description").before(this.icon.render().el),this}});return n}),define("plex/desktop/view/lists/dashboard/DashboardAnnouncementList",["hb!templates/desktop/lists/dashboard/DashboardAnnouncementList.tpl","plex/base/model/AppModel","plex/base/view/lists/BaseList","plex/desktop/view/lists/dashboard/items/DashboardAnnouncementListItem","jquery"],function(e,t,i,n,a){var s=i.extend({className:"dashboard-carousel-container",promos:null,index:0,pageInterval:null,hover:!1,pending:!1,events:{"mouseenter .dashboard-carousel-content":"onMouseEnter","mouseleave .dashboard-carousel-content":"onMouseLeave","click .dashboard-carousel-btn":"onCarouselClick"},initialize:function(){this.promos=[],this.index=0,this.hover=!1,this.pending=!1,this.setup(n,".dashboard-announcement-list")
},render:function(){return this.$el.html(e()),this.populate(this.collection),this},destroy:function(){i.prototype.destroy.call(this),this.pageInterval&&clearInterval(this.pageInterval)},reset:function(e){if(this.rendered){this.promos=[],this.$(".dashboard-carousel-navigation").empty();var t=100*e.length;this.$(".dashboard-announcement-list").css("width",t+"%"),i.prototype.reset.apply(this,arguments),this.$(".dashboard-carousel-btn:nth-child(1)").addClass("active"),this.start()}},addItem:function(e){var n=t.get("myPlex");
if("PlexPass"!==e.get("promo")||!n.hasPlexPass()){this.promos.push(e),this.$(".dashboard-carousel-navigation").append('<a class="dashboard-carousel-btn" href="#"></a>');var a=i.prototype.addItem.apply(this,arguments);return a}},start:function(){this.pageInterval&&clearInterval(this.pageInterval),this.pageInterval=setInterval(_.bind(this.autoPage,this),1e4)},page:function(e){this.index=e,this.animate(),this.start()},autoPage:function(){return this.hover?(this.pending=!0,void 0):(this.index+1<this.promos.length?this.index++:this.index=0,this.animate(),void 0)
},animate:function(){this.$(".dashboard-carousel-btn").removeClass("active"),this.$(".dashboard-carousel-btn:nth-child("+(this.index+1)+")").addClass("active"),this.$(".dashboard-announcement-list").css("left",-256*this.index)},onMouseEnter:function(){this.hover=!0},onMouseLeave:function(){this.hover=!1,this.pending&&(this.pending=!1,this.autoPage(),this.start())},onCarouselClick:function(e){e.preventDefault();var t=a(e.currentTarget);this.page(t.index())}});return s}),define("plex/desktop/view/dashboard/DashboardAnnouncementsView",["hb!templates/desktop/dashboard/DashboardAnnouncementsView.tpl","plex/base/model/SettingsModel","plex/base/view/BaseView","plex/desktop/view/lists/dashboard/DashboardAnnouncementList","jquery"],function(e,t,i,n,a){var s=i.extend({className:"dashboard-announcements-container well span12",priority:null,unread:!1,announcementList:null,events:{"click .mark-read-btn":"onMarkReadClick"},initialize:function(){this.priority={module:this,visible:null,rank:t.get("dashboardAnnouncementsPriority"),sidebar:!0},this.announcementList=this.registerView(new n({collection:this.collection})),this.addBinding(this.collection,"reset",this.onReset),this.collection.fetch()
},render:function(){return this.$el.html(e({unread:this.unread})),this.$el.tooltip({selector:".btn-icon",placement:"bottom"}),this.$(".dashboard-carousel-container").append(this.announcementList.render().el),this},onReset:function(e){if(e.length){this.priority.visible=t.get("dashboardAnnouncementsEnabled");var i=this.collection.first().get("timestamp"),n=t.get("dashboardAnnouncementsLastRead");i>n&&(this.unread=!0),this.priority.visible&&!this.unread&&t.get("dashboardAnnouncementsHideUnread")&&(this.priority.visible=!1)
}else this.priority.visible=!1;this.trigger("render",this.priority)},onMarkReadClick:function(e){e.preventDefault(),a(e.currentTarget).addClass("hide"),t.save("dashboardAnnouncementsLastRead",Math.round((new Date).getTime()/1e3)),a(".tooltip").remove()}});return s}),define("hb!templates/desktop/lists/dashboard/DashboardChannelList.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return"hide"}function r(e,t){var n;return n=i["if"].call(e,e.empty,{hash:{},inverse:p.noop,fn:p.program(1,s,t),data:t}),n||0===n?n:""
}function l(){return"limited"}function o(){return"focus-primary-channel"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var c,d,h,u="",p=this,f=i.helperMissing,m=this.escapeExpression;return u+='<div class="dashboard-well-header well-header">\n	<ul class="well-header-actions">\n		<li><a class="btn btn-inverse btn-icon" href="#!/directory" rel="tooltip" title="',h={hash:{},data:a},u+=m((c=i.t||t.t,c?c.call(t,"Add Channel",h):f.call(t,"t","Add Channel",h)))+'"><i class="glyphicon plus"></i></a></li>\n		<li><a class="btn btn-inverse btn-icon" href="#!/channels" rel="tooltip" title="',h={hash:{},data:a},u+=m((c=i.t||t.t,c?c.call(t,"View All",h):f.call(t,"t","View All",h)))+'"><i class="glyphicon more"></i></a></li>\n	</ul>\n\n	<h3>',h={hash:{},data:a},u+=m((c=i.t||t.t,c?c.call(t,"Channels",h):f.call(t,"t","Channels",h)))+'</h3>\n</div>\n\n<div class="dashboard-empty-message ',d=i["if"].call(t,t.pending,{hash:{},inverse:p.noop,fn:p.program(1,s,a),data:a}),(d||0===d)&&(u+=d),u+=" ",d=i.unless.call(t,t.empty,{hash:{},inverse:p.noop,fn:p.program(1,s,a),data:a}),(d||0===d)&&(u+=d),u+='">\n	',h={hash:{},data:a},u+=m((c=i.t||t.t,c?c.call(t,"There are no recently used channels.",h):f.call(t,"t","There are no recently used channels.",h)))+' <a class="add-btn" href="#!/directory">',h={hash:{},data:a},u+=m((c=i.t||t.t,c?c.call(t,"Install a channel",h):f.call(t,"t","Install a channel",h)))+'</a>.\n</div>\n\n<ul class="tile-list channel-tile-list dashboard-channel-tile-list ',d=i.unless.call(t,t.pending,{hash:{},inverse:p.noop,fn:p.program(3,r,a),data:a}),(d||0===d)&&(u+=d),u+=" ",d=i["if"].call(t,t.limited,{hash:{},inverse:p.noop,fn:p.program(5,l,a),data:a}),(d||0===d)&&(u+=d),u+=" ",d=i["if"].call(t,t.focusPrimaryChannel,{hash:{},inverse:p.noop,fn:p.program(7,o,a),data:a}),(d||0===d)&&(u+=d),u+='"></ul>\n'
})}),define("hb!templates/desktop/lists/dashboard/items/DashboardChannelListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var s,r,l="",o="function",c=this.escapeExpression,d=i.helperMissing;return l+='<a href="#!/servers/'+c((s=t.server,s=null==s||s===!1?s:s.machineIdentifier,typeof s===o?s.apply(t):s))+"/channels?key=",r={hash:{},data:a},l+=c((s=i.encodeUrl||t.encodeUrl,s?s.call(t,(s=t.channel,null==s||s===!1?s:s.key),r):d.call(t,"encodeUrl",(s=t.channel,null==s||s===!1?s:s.key),r)))+'" data-focus="keyboard">\n	<div class="poster-container">\n		<div class="poster-card">\n			<div class="poster-face front">\n				<span class="section-label"></span>\n\n				<div class="hover-overlay card-overlay">\n					<span class="poster-title">'+c((s=t.channel,s=null==s||s===!1?s:s.title,typeof s===o?s.apply(t):s))+"</span>\n				</div>\n			</div>\n		</div>\n	</div>\n</a>\n"
})}),define("plex/desktop/view/lists/dashboard/items/DashboardChannelListItem",["hb!templates/desktop/lists/dashboard/items/DashboardChannelListItem.tpl","plex/base/view/BaseView","plex/base/view/images/BaseImage"],function(e,t,i){var n=t.extend({tagName:"li",first:!1,thumbSize:0,icon:null,initialize:function(e){this.first=e.first,this.thumbSize=e.thumbSize,this.thumbSize||(this.thumbSize=this.first?182:85),this.icon=this.registerView(new i({model:this.model,modelAttr:"thumb",placeholder:"img/posters/poster_square.png",className:"poster channel-poster",transcode:!0,width:this.thumbSize,height:this.thumbSize})),this.addBinding(this.model,"change",this.render)
},render:function(){return this.$el.html(e({server:this.model.server.toJSON(),channel:this.model.toJSON()})),this.$(".poster-face").prepend(this.icon.render().el),this}});return n}),define("plex/desktop/view/lists/dashboard/DashboardChannelList",["hb!templates/desktop/lists/dashboard/DashboardChannelList.tpl","plex/base/model/SettingsModel","plex/base/model/collections/ChannelCollection","plex/base/view/BaseView","plex/desktop/view/lists/dashboard/items/DashboardChannelListItem","moment"],function(e,t,i,n,a){var s=n.extend({className:"well span12",pendingRequests:0,total:0,empty:!0,currentChannels:null,priority:null,initialize:function(e){this.id=e.id,this.pendingRequests=1,this.total=0,this.currentChannels=[],this.priority={module:this,visible:null},this.addBinding(this.collection,"add",this.onServerAdd),this.collection.populate().done(_.bind(function(){this.pendingRequests+=this.collection.length,this.onServerAddAll(this.collection),this.addBinding(this.collection,"reset",this.onServerAddAll),this.hideLoading(0)
},this)).fail(_.bind(function(){this.hideLoading(0)},this))},render:function(){return this.$el.html(e({pending:this.pendingRequests>0,empty:this.empty,limited:t.get("dashboardChannelsLimit"),focusPrimaryChannel:t.get("dashboardChannelsLargeThumbnail")})),_.each(this._views,function(e){this.$(".dashboard-channel-tile-list").append(e.el)},this),this.$el.tooltip({selector:".btn-icon",placement:"bottom"}),this},hideLoading:function(e){this.pendingRequests--,this.total+=e,e&&(this.empty=!1),0>=this.pendingRequests&&this.empty&&(this.priority.visible=t.get("dashboardChannelsEnabled"),this.priority.rank=t.get("dashboardChannelsPriority"),this.trigger("render",this.priority),this.$(".dashboard-empty-message").removeClass("hide"),this.$(".dashboard-channel-tile-list").addClass("hide"))
},onServerAdd:function(e){if(e.get("shared")||e.get("synced"))return this.hideLoading(0),void 0;var n=_.bind(function(){if(e.get("isAvailable")){var n=new i([],{server:e,recent:t.get("dashboardChannelsLimit")});this.addBinding(n,"add",this.onChannelAdd),n.populate({hideLoadingAlert:!0}).done(_.bind(function(){this.hideLoading(n.length),this.onChannelAddAll(n),this.addBinding(n,"reset",this.onChannelAddAll)},this)).fail(_.bind(function(){this.hideLoading(0)},this))}},this);n(),this.addBinding(e,"change:isAvailable",n)
},onServerAddAll:function(e){this.removeAllViews(),this.currentChannels=[],e.each(this.onServerAdd,this)},onChannelAdd:function(e){if(!(_.indexOf(this.currentChannels,e.id)>-1)){if(null===this.priority.visible){var i=moment.unix(e.get("lastAccessedAt")),n=moment().diff(i,"days"),s=t.get("dashboardChannelsPriority");this.priority.rank=s,t.get("dashboardChannelsDynamicPriority")&&(n>7?this.priority.rank=s+1:1>=n&&(this.priority.rank=s-1)),this.priority.visible=t.get("dashboardChannelsEnabled"),this.trigger("render",this.priority)
}this.currentChannels.push(e.id);var r=new a({model:e,first:1===this.currentChannels.length});this.registerView(r),this.$(".dashboard-channel-tile-list").append(r.render().el)}},onChannelAddAll:function(e){e.each(this.onChannelAdd,this)}});return s}),define("plex/desktop/view/dashboard/DashboardView",["hb!templates/desktop/dashboard/DashboardView.tpl","plex/base/model/AppModel","plex/base/model/SettingsModel","plex/base/view/BaseView","plex/desktop/view/dashboard/DashboardLoginView","plex/desktop/view/dashboard/DashboardSectionView","plex/desktop/view/dashboard/DashboardFriendsView","plex/desktop/view/dashboard/DashboardNowPlayingView","plex/desktop/view/dashboard/DashboardMediaView","plex/desktop/view/dashboard/DashboardAnnouncementsView","plex/desktop/view/lists/dashboard/DashboardChannelList","jquery"],function(e,t,i,n,a,s,r,l,o,c,d,h){var u=n.extend({className:"dashboard-container container",playlistNames:["queue","recommendations"],modules:null,moduleCount:0,sidebarOpen:!1,initialize:function(){var e=t.get("myPlex"),i=t.get("primaryServer"),n=i&&i.get("shared"),h=i&&i.get("multiuser")&&e.hasPlexPass();
if(this.modules=[],this.moduleCount=0,this.sidebarOpen=!1,!n){var u=this.registerView(new s({collection:t.get("myLibrary"),shared:!1})),p=this.registerView(new d({collection:this.collection})),f=this.registerView(new o({collection:i.get("onDeck"),type:"On Deck"})),m=this.registerView(new o({collection:i.get("recentlyAdded"),type:"Recently Added"}));this.modules.push(u,p,f,m)}if(e.get("signedIn")){if(h&&!n){var g=this.registerView(new l({collection:i.get("sessions")}));this.modules.push(g)}var v=this.registerView(new s({collection:t.get("sharedLibraries"),shared:!0})),y=this.registerView(new r({collection:e.get("friendRequests")}));
this.modules.push(v,y),_.each(this.playlistNames,function(t){var i=this.registerView(new o({collection:e.get("playlists")[t],type:t,sidebar:!0}));this.modules.push(i)},this)}else{var b=this.registerView(new a);this.addBinding(b,"refresh",this.refresh),this.modules.push(b)}var w=this.registerView(new c({collection:t.get("announcements")}));this.modules.push(w),this.addBinding(t,"change:primaryServer",this.refresh)},render:function(){return this.$el.html(e({sidebarOpen:i.get("dashboardSidebarOpen"),fluidWidth:i.get("dashboardFluidWidth")})),_.each(this.modules,_.bind(function(e){e.priority&&e.priority.visible?this.renderModule(e.priority):this.addBinding(e,"render",this.renderModule)
},this)),this},renderModule:function(e,t){if(t||this.moduleCount++,!e.visible)return this.finishRender(),void 0;var i=Math.min(Math.max(e.rank,0),6),n=e.sidebar?this.$("#dashboard-sidebar"):this.$("#dashboard-main"),a=n.find(".priority"+i);e.sidebar&&!this.sidebarOpen&&this.openSidebar(),a.find(".module").each(function(t,i){var n=h(i);return n.find(".span12").length?void 0:(e.module.calculatePageSize&&(e.module.width=n.width()-60,e.module.calculatePageSize()),n.append(e.module.render().el),!1)}),this.finishRender()
},openSidebar:function(){this.sidebarOpen=!0,this.$el.children(".row").addClass("show-sidebar"),_.each(this.modules,function(e){if(e.calculatePageSize&&!e.priority.sidebar){var t=e.pageSize,i=e.calculatePageSize();t!==i&&e.updatePageSize()}})},closeSidebar:function(){this.$el.children(".row").removeClass("show-sidebar"),_.each(this.modules,function(e){if(e.calculatePageSize&&!e.priority.sidebar){var t=e.pageSize,i=e.calculatePageSize();t!==i&&e.updatePageSize()}})},finishRender:function(){this.moduleCount<this.modules.length||(!this.sidebarOpen&&this.$el.children(".row").hasClass("show-sidebar")&&this.closeSidebar(),i.save("dashboardSidebarOpen",this.sidebarOpen))
}});return u}),define("hb!templates/desktop/myplex/PlaylistView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a,s="";return s+='\n				<li><a class="help-btn btn btn-inverse btn-icon" href="https://my.plexapp.com/queue/help" target="_blank" rel="tooltip" title="',a={hash:{},data:t},s+=u((n=i.t||e.t,n?n.call(e,"Help",a):h.call(e,"t","Help",a)))+'"><i class="glyphicon circle-question-mark"></i></a></li>\n			'}function r(){return"active"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};
var l,o,c,d="",h=i.helperMissing,u=this.escapeExpression,p=this,f="function";return d+='<div id="playlist-container" class="well">\n	<div class="well-header">\n		<ul class="well-header-actions">\n			',c={hash:{},inverse:p.noop,fn:p.program(1,s,a),data:a},l=i.if_eq||t.if_eq,o=l?l.call(t,t.playlistName,"queue",c):h.call(t,"if_eq",t.playlistName,"queue",c),(o||0===o)&&(d+=o),d+='\n		</ul>\n\n		<ul class="subnav-list well-header-list">\n			<li><a class="all-filter playlist-filter ',c={hash:{},inverse:p.noop,fn:p.program(3,r,a),data:a},l=i.if_eq||t.if_eq,o=l?l.call(t,t.view,"all",c):h.call(t,"if_eq",t.view,"all",c),(o||0===o)&&(d+=o),d+='" href="#">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"All",c):h.call(t,"t","All",c)))+'</a></li>\n			<li><a class="unwatched-filter playlist-filter ',c={hash:{},inverse:p.noop,fn:p.program(3,r,a),data:a},l=i.if_eq||t.if_eq,o=l?l.call(t,t.view,"unwatched",c):h.call(t,"if_eq",t.view,"unwatched",c),(o||0===o)&&(d+=o),d+='" href="#"><span class="count">',(o=i.unwatched)?o=o.call(t,{hash:{},data:a}):(o=t.unwatched,o=typeof o===f?o.apply(t):o),d+=u(o)+"</span> ",c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Unwatched",c):h.call(t,"t","Unwatched",c)))+'</a></li>\n			<li><a class="watched-filter playlist-filter ',c={hash:{},inverse:p.noop,fn:p.program(3,r,a),data:a},l=i.if_eq||t.if_eq,o=l?l.call(t,t.view,"watched",c):h.call(t,"if_eq",t.view,"watched",c),(o||0===o)&&(d+=o),d+='" href="#"><span class="count">',(o=i.watched)?o=o.call(t,{hash:{},data:a}):(o=t.watched,o=typeof o===f?o.apply(t):o),d+=u(o)+"</span> ",c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Watched",c):h.call(t,"t","Watched",c)))+"</a></li>\n		</ul>\n	</div>\n</div>\n"
})}),define("hb!templates/desktop/myplex/MyPlexNavView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return"active"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var r,l,o,c="",d=i.helperMissing,h=this.escapeExpression,u=this;return c+='<ul class="subnav-actions">\n	<li>\n		<span class="subnav-action-label">',o={hash:{},data:a},c+=h((r=i.t||t.t,r?r.call(t,t.username,20,o):d.call(t,"t",t.username,20,o)))+'</span>\n	</li>\n	<li>\n		<button type="button" class="sign-out-btn btn btn-inverse btn-icon"><i class="glyphicon exit"></i> <span class="btn-icon-label">',o={hash:{},data:a},c+=h((r=i.t||t.t,r?r.call(t,"Sign Out",o):d.call(t,"t","Sign Out",o)))+'</span></button>\n	</li>\n</ul>\n\n<ul class="subnav-list">\n	<li><i class="subnav-icon glyphicon user"></i></li>\n	<li><a class="gray ',o={hash:{},inverse:u.noop,fn:u.program(1,s,a),data:a},r=i.if_eq||t.if_eq,l=r?r.call(t,t.active,"friends",o):d.call(t,"if_eq",t.active,"friends",o),(l||0===l)&&(c+=l),c+='" href="#!/friends">',o={hash:{},data:a},c+=h((r=i.t||t.t,r?r.call(t,"Friends",o):d.call(t,"t","Friends",o)))+'</a></li>\n	<li><a class="gray ',o={hash:{},inverse:u.noop,fn:u.program(1,s,a),data:a},r=i.if_eq||t.if_eq,l=r?r.call(t,t.active,"recommendations",o):d.call(t,"if_eq",t.active,"recommendations",o),(l||0===l)&&(c+=l),c+='" href="#!/playlist/recommendations">',o={hash:{},data:a},c+=h((r=i.t||t.t,r?r.call(t,"Recommendations",o):d.call(t,"t","Recommendations",o)))+'</a></li>\n	<li><a class="gray ',o={hash:{},inverse:u.noop,fn:u.program(1,s,a),data:a},r=i.if_eq||t.if_eq,l=r?r.call(t,t.active,"queue",o):d.call(t,"if_eq",t.active,"queue",o),(l||0===l)&&(c+=l),c+='" href="#!/playlist/queue">',o={hash:{},data:a},c+=h((r=i.t||t.t,r?r.call(t,"Queue",o):d.call(t,"t","Queue",o)))+"</a></li>\n</ul>\n"
})}),define("plex/desktop/view/myplex/MyPlexNavView",["hb!templates/desktop/myplex/MyPlexNavView.tpl","plex/base/control/Dispatcher","plex/base/model/AppModel","plex/base/view/BaseView"],function(e,t,i,n){var a=n.extend({className:"subnav-container",active:null,events:{"click .sign-out-btn":"onSignOutClick"},initialize:function(e){this.active=e.active},render:function(){var t=i.get("myPlex");return this.$el.html(e({active:this.active,username:t.get("username")})),this},onSignOutClick:function(e){e.preventDefault(),t.trigger("command:SignOut")
}});return a}),define("plex/base/view/lists/FocusList",["plex/base/control/utils/FocusManager","plex/base/control/mixins/FocusMixin","plex/base/view/lists/BaseList"],function(e,t,i){var n=i.extend(_.extend(_.clone(t),{postrender:function(){this.autoFocusEnabled&&(this.addBinding(this,"complete",this.restoreFocus),this.completed&&this.restoreFocus())},restoreFocus:_.debounce(function(){this.focused&&(this.focused=!1,this.$focusedItem=null,this.focusView())},100,!0),getNextFocusableIndex:function(e,t){var i=e.index(this.$focusedItem);
if(this.focusOptions.cancellationDirections)return i+1;if(this.itemsPerRow||this.measure(),"right"===t){var n=i%this.itemsPerRow;return n===this.itemsPerRow-1?-1:i+1}return i+this.itemsPerRow>=e.length?e.length-1:i+this.itemsPerRow},getPreviousFocusableIndex:function(e,t){var i=e.index(this.$focusedItem);if(this.focusOptions.cancellationDirections)return i-1;if(this.itemsPerRow||this.measure(),"left"===t){var n=i%this.itemsPerRow;return 0===n?-1:i-1}return i-this.itemsPerRow},destroy:function(){e.removeView(this),t.destroy.call(this),i.prototype.destroy.call(this)
}}));return n}),define("hb!templates/desktop/lists/myplex/items/PlaylistListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a,s="";return s+='\n			<button type="button" class="mark-unwatched-btn btn btn-icon" rel="tooltip" title="',a={hash:{},data:t},s+=y((n=i.t||e.t,n?n.call(e,"Mark as Unwatched",a):v.call(e,"t","Mark as Unwatched",a)))+'"><i class="glyphicon circle-minus"></i></button>\n		'}function r(e,t){var n,a,s="";return s+='\n			<button type="button" class="mark-watched-btn btn btn-success btn-icon" rel="tooltip" title="',a={hash:{},data:t},s+=y((n=i.t||e.t,n?n.call(e,"Mark as Watched",a):v.call(e,"t","Mark as Watched",a)))+'"><i class="glyphicon circle-ok"></i></button>\n		'
}function l(e){var t,i="";return i+="\n			<h4>"+y((t=e.item,t=null==t||t===!1?t:t.sourceTitle,typeof t===b?t.apply(e):t))+"</h4>\n		"}function o(e,t){var n,a,s,r="";return r+="\n			<h4>",s={hash:{},data:t},r+=y((n=i.t||e.t,n?n.call(e,"Recommended by",s):v.call(e,"t","Recommended by",s)))+" "+y((n=e.item,n=null==n||n===!1?n:n.recommender,typeof n===b?n.apply(e):n))+"</h4>\n\n			",a=i["if"].call(e,(n=e.item,null==n||n===!1?n:n.message),{hash:{},inverse:w.program(10,d,t),fn:w.program(8,c,t),data:t}),(a||0===a)&&(r+=a),r+="\n		"
}function c(e){var t,i="";return i+='\n				<div class="summary">'+y((t=e.item,t=null==t||t===!1?t:t.message,typeof t===b?t.apply(e):t))+"</div>\n			"}function d(e,t){var n,a,s="";return s+='\n				<div class="summary">',a={hash:{},data:t},s+=y((n=i.t||e.t,n?n.call(e,"No message",a):v.call(e,"t","No message",a)))+"</div>\n			"}function h(e,t){var n,a;return a=i["if"].call(e,(n=e.item,null==n||n===!1?n:n.summary),{hash:{},inverse:w.noop,fn:w.program(13,u,t),data:t}),a||0===a?a:""}function u(e,t){var n,a,s="";
return s+='\n			<div class="summary">',a={hash:{},data:t},s+=y((n=i.truncate||e.truncate,n?n.call(e,(n=e.item,null==n||n===!1?n:n.summary),180,a):v.call(e,"truncate",(n=e.item,null==n||n===!1?n:n.summary),180,a)))+"</div>\n		"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var p,f,m,g="",v=i.helperMissing,y=this.escapeExpression,b="function",w=this;return g+='<a href="#!/playlist/'+y((p=t.item,p=null==p||p===!1?p:p.playlistName,typeof p===b?p.apply(t):p))+"/player/"+y((p=t.item,p=null==p||p===!1?p:p.id,typeof p===b?p.apply(t):p))+'" data-focus="keyboard">\n	<div class="actions">\n		',f=i["if"].call(t,t.watched,{hash:{},inverse:w.program(3,r,a),fn:w.program(1,s,a),data:a}),(f||0===f)&&(g+=f),g+='\n\n		<button type="button" class="delete-btn btn btn-danger btn-icon" rel="tooltip" title="',m={hash:{},data:a},g+=y((p=i.t||t.t,p?p.call(t,"Delete",m):v.call(t,"t","Delete",m)))+'"><i class="glyphicon ban"></i></button>\n	</div>\n\n	<div class="media-details">\n		<h3>',m={hash:{},data:a},g+=y((p=i.truncate||t.truncate,p?p.call(t,(p=t.item,null==p||p===!1?p:p.title),80,m):v.call(t,"truncate",(p=t.item,null==p||p===!1?p:p.title),80,m)))+"</h3>\n\n		",f=i["if"].call(t,(p=t.item,null==p||p===!1?p:p.sourceTitle),{hash:{},inverse:w.noop,fn:w.program(5,l,a),data:a}),(f||0===f)&&(g+=f),g+="\n\n		",f=i["if"].call(t,(p=t.item,null==p||p===!1?p:p.recommender),{hash:{},inverse:w.program(12,h,a),fn:w.program(7,o,a),data:a}),(f||0===f)&&(g+=f),g+="\n	</div>\n</a>\n\n\n"
})}),define("plex/desktop/view/lists/myplex/items/PlaylistListItem",["hb!templates/desktop/lists/myplex/items/PlaylistListItem.tpl","plex/base/control/Dispatcher","plex/base/view/BaseView","plex/base/view/images/BaseImage","jquery"],function(e,t,i,n,a){var s=i.extend({tagName:"li",poster:null,events:{"click .mark-watched-btn":"onMarkWatchedClick","click .mark-unwatched-btn":"onMarkUnwatchedClick","click .delete-btn":"onDeleteClick"},initialize:function(e){this.filtered=e.filtered,this.poster=this.registerView(new n({model:this.model,modelAttr:"thumb",placeholder:"img/posters/poster_wide.png",className:"poster playlist-poster",transcode:!0,width:175,height:175})),this.addBinding(this.model,"change:viewCount",this.onViewCountChange),_.bindAll(this,"onAnimationComplete")
},render:function(){return this.$el.html(e({watched:this.model.get("viewCount")>0,item:this.model.toJSON()})),this.$(".actions").after(this.poster.render().el),this},close:function(e){var t=e||this.onAnimationComplete,i={opacity:0,height:0,"margin-bottom":0,"padding-top":0,"padding-bottom":0};this.$el.animate(i,400,t)},onViewCountChange:function(){this.filtered===!0?this.close():this.trigger("refresh")},onMarkWatchedClick:function(e){e.preventDefault(),a(e.currentTarget).tooltip("destroy"),t.trigger("command:MarkWatched",this.model)
},onMarkUnwatchedClick:function(e){e.preventDefault(),a(e.currentTarget).tooltip("destroy"),t.trigger("command:MarkUnwatched",this.model)},onDeleteClick:function(e){e.preventDefault(),a(e.currentTarget).tooltip("destroy"),this.close(_.bind(function(){this.model.destroy({hideLoadingAlert:!0}),this.trigger("refresh")},this))},onAnimationComplete:function(){this.destroy(),this.trigger("refresh")}});return s}),define("plex/desktop/view/lists/myplex/PlaylistList",["plex/base/view/lists/FocusList","plex/desktop/view/lists/myplex/items/PlaylistListItem"],function(e,t){var i=e.extend({tagName:"ul",className:"list media-list playlist-list",initialize:function(e){this.filtered=e.filtered,this.setup(t)
},render:function(){return this.$el.empty(),this.populate(this.collection),this},addItem:function(e){var t=new this.ListItem({model:e,list:this,filtered:this.filtered});return this.registerView(t),this.addBinding(t,"refresh",this.onRefresh),this.items[e.id]=t,this.$el.append(t.render().el),t},onRefresh:function(){this.trigger("refresh")}});return i}),define("plex/desktop/view/myplex/PlaylistView",["hb!templates/desktop/myplex/PlaylistView.tpl","plex/base/view/BaseView","plex/desktop/view/myplex/MyPlexNavView","plex/desktop/view/lists/myplex/PlaylistList"],function(e,t,i,n){var a=t.extend({className:"container",view:"unwatched",subnav:null,list:null,events:{"click .all-filter":"onAllClick","click .unwatched-filter":"onUnwatchedClick","click .watched-filter":"onWatchedClick"},initialize:function(){this.listCollection=new Backbone.Collection(this.collection.unwatched()),this.subnav=this.registerView(new i({active:this.collection.playlistName})),this.list=this.registerView(new n({collection:this.listCollection,filtered:!0})),this.addBinding(this.list,"refresh",this.onRefresh)
},render:function(){var t=this.collection.unwatched().length,i=this.collection.watched().length;return this.$el.html(e({view:this.view,unwatched:t,watched:i,playlistName:this.collection.playlistName,playlistLabel:this.collection.playlistLabel})),this.$el.prepend(this.subnav.render().el),this.$("#playlist-container").append(this.list.render().el),this.$el.tooltip({selector:".btn-icon",placement:"bottom"}),this},updateCounts:function(){var e=this.collection.unwatched().length,t=this.collection.watched().length;
this.$(".unwatched-filter > .count").text(e),this.$(".watched-filter > .count").text(t)},onAllClick:function(e){e.preventDefault(),this.view="all",this.$(".playlist-filter").removeClass("active"),this.$(".all-filter").addClass("active"),this.list.filtered=!1,this.listCollection.reset(this.collection.all())},onUnwatchedClick:function(e){e.preventDefault(),this.view="unwatched",this.$(".playlist-filter").removeClass("active"),this.$(".unwatched-filter").addClass("active"),this.list.filtered=!0,this.listCollection.reset(this.collection.unwatched())
},onWatchedClick:function(e){e.preventDefault(),this.view="watched",this.$(".playlist-filter").removeClass("active"),this.$(".watched-filter").addClass("active"),this.list.filtered=!0,this.listCollection.reset(this.collection.watched())},onRefresh:function(){switch(this.view){case"unwatched":this.listCollection.reset(this.collection.unwatched());break;case"watched":this.listCollection.reset(this.collection.watched());break;default:this.listCollection.reset(this.collection.models)}this.updateCounts()
}});return a}),define("hb!templates/desktop/SearchView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var s,r,l,o="",c=i.helperMissing,d=this.escapeExpression,h="function";return o+='<h2 class="pending-search-header search-header">\n	',l={hash:{},data:a},o+=d((s=i.t||t.t,s?s.call(t,"Searching for",l):c.call(t,"t","Searching for",l)))+' <span class="primary">',(r=i.query)?r=r.call(t,{hash:{},data:a}):(r=t.query,r=typeof r===h?r.apply(t):r),o+=d(r)+'</span>...\n</h2>\n\n<h2 class="results-search-header search-header hide">\n	',l={hash:{},data:a},o+=d((s=i.t||t.t,s?s.call(t,"Results for",l):c.call(t,"t","Results for",l)))+' <span class="primary">',(r=i.query)?r=r.call(t,{hash:{},data:a}):(r=t.query,r=typeof r===h?r.apply(t):r),o+=d(r)+'</span>\n</h2>\n\n<h2 class="no-results-search-header search-header hide">\n	',l={hash:{},data:a},o+=d((s=i.t||t.t,s?s.call(t,"No results for",l):c.call(t,"t","No results for",l)))+' <span class="primary">',(r=i.query)?r=r.call(t,{hash:{},data:a}):(r=t.query,r=typeof r===h?r.apply(t):r),o+=d(r)+'</span>\n</h2>\n\n<div class="movies-container search-results-container well hide">\n	<div class="well-header">\n		<h3>',l={hash:{},data:a},o+=d((s=i.t||t.t,s?s.call(t,"Movies",l):c.call(t,"t","Movies",l)))+'</h3>\n	</div>\n</div>\n\n<div class="shows-container search-results-container well hide">\n	<div class="well-header">\n		<h3>',l={hash:{},data:a},o+=d((s=i.t||t.t,s?s.call(t,"TV Shows",l):c.call(t,"t","TV Shows",l)))+'</h3>\n	</div>\n</div>\n\n<div class="episodes-container search-results-container well hide">\n	<div class="well-header">\n		<h3>',l={hash:{},data:a},o+=d((s=i.t||t.t,s?s.call(t,"Episodes",l):c.call(t,"t","Episodes",l)))+'</h3>\n	</div>\n</div>\n\n<div class="artists-container search-results-container well hide">\n	<div class="well-header">\n		<h3>',l={hash:{},data:a},o+=d((s=i.t||t.t,s?s.call(t,"Artists",l):c.call(t,"t","Artists",l)))+'</h3>\n	</div>\n</div>\n\n<div class="albums-container search-results-container well hide">\n	<div class="well-header">\n		<h3>',l={hash:{},data:a},o+=d((s=i.t||t.t,s?s.call(t,"Albums",l):c.call(t,"t","Albums",l)))+'</h3>\n	</div>\n</div>\n\n<div class="tracks-container search-results-container well hide">\n	<div class="well-header">\n		<h3>',l={hash:{},data:a},o+=d((s=i.t||t.t,s?s.call(t,"Tracks",l):c.call(t,"t","Tracks",l)))+'</h3>\n	</div>\n</div>\n\n<div class="clips-container search-results-container well hide">\n	<div class="well-header">\n		<h3>',l={hash:{},data:a},o+=d((s=i.t||t.t,s?s.call(t,"Clips",l):c.call(t,"t","Clips",l)))+"</h3>\n	</div>\n</div>\n"
})}),define("plex/desktop/view/lists/SelectableList",["plex/base/view/lists/FocusList"],function(e){var t=function(e,t){var i,n,a=[];for(t>e?(i=e,n=t):(i=t,n=e);n>=i;i++)a.push(i);return a},i=e.extend({selectable:!0,selectedItems:null,shiftStart:-1,shiftEnd:-1,setup:function(t,i){this.selectedItems=[],e.prototype.setup.call(this,t,i)},addItem:function(t){var i=e.prototype.addItem.apply(this,arguments);return this.addBinding(i,"select",this.onSelect),this.addBinding(i,"deselect",this.onDeselect),_.each(this.selectedItems,_.bind(function(e){t&&e.model.id===t.id&&this.select(i)
},this)),i},removeItem:function(t){this.deselect(this.items[t.id]),e.prototype.removeItem.apply(this,arguments)},select:function(e){e.select(),-1===_.indexOf(this.selectedItems,e)&&this.selectedItems.push(e),this.trigger("change:selectedItems",this.selectedItems)},deselect:function(e){var t=_.indexOf(this.selectedItems,e);t>-1&&(e.deselect(),this.selectedItems.splice(t,1)),this.trigger("change:selectedItems",this.selectedItems)},deselectAll:function(){_.each(this.selectedItems,function(e){e.deselect()
}),this.shiftStart=-1,this.shiftEnd=-1,this.selectedItems.length=0,this.trigger("change:selectedItems",this.selectedItems)},onSelect:function(e,i){if(this.selectable){var n=this.collection.indexOf(e.model);i?-1===this.shiftStart?(this.select(e),this.shiftStart=n):-1===this.shiftEnd?(_.each(t(this.shiftStart,n),_.bind(function(e){var t=this.collection.at(e);this.select(this.items[t.id])},this)),this.shiftEnd=n):(_.each(t(this.shiftStart,this.shiftEnd),_.bind(function(e){var t=this.collection.at(e);
this.deselect(this.items[t.id])},this)),_.each(t(this.shiftStart,n),_.bind(function(e){var t=this.collection.at(e);this.select(this.items[t.id])},this)),this.shiftEnd=n):(this.shiftEnd=-1,-1===_.indexOf(this.selectedItems,e)?(this.select(e),this.shiftStart=n):(this.deselect(e),this.shiftStart=-1))}},onDeselect:function(e){this.deselect(e)}});return i}),define("plex/desktop/view/lists/VirtualList",["plex/desktop/view/lists/SelectableList"],function(e){var t=e.extend({virtual:!0,scrollTimeout:null,scrollDelay:100,virtualItems:null,scrollContainerWidth:0,scrollContainerHeight:0,itemWidth:0,itemHeight:0,itemsPerRow:0,itemsPerColumn:0,itemsPerPage:0,rowsPadding:10,visibleStartIndex:0,visibleEndIndex:0,addedAt:null,repopulate:!1,sizeProperty:null,$scrollContainer:null,postinitialize:function(t){return e.prototype.postinitialize.apply(this,arguments),_.bindAll(this,"onScroll"),this.virtual=t.virtual,this.virtual?(t.infiniteScroll?(this.sizeProperty="totalSize",this.collection.totalSize||(this.trigger("change:loading",!0),this.collection.fetchSize({hideLoadingAlert:!0}).always(_.bind(function(){this.trigger("change:loading",!1)
},this)))):(this.sizeProperty="length",this.trigger("change:loading",!0),this.collection.fetch({hideLoadingAlert:!0}).always(_.bind(function(){this.trigger("change:loading",!1)},this))),this.addBinding(this.collection,"merge",this.merge),void 0):(this.sizeProperty="length",void 0)},postrender:function(){this.virtual&&(this.$scrollContainer||(this.$scrollContainer=this.$el.parent()),this.$scrollContainer.on("scroll",this.onScroll))},destroy:function(){e.prototype.destroy.call(this),this.virtual&&this.$scrollContainer.off("scroll",this.onScroll)
},populate:function(){this.rendered=!0,this.populated=!!this.collection[this.sizeProperty],this.populated&&this.reset(this.collection)},populateRange:function(e){var t=e.start,i=e.size,n="up"===e.scrollDirection,a=this.collection.populatedRange,s=!1;n&&(t=Math.max(t-i,0)),a.end>0?a.start>t?(i=a.start-t,a.start=t):(i=t+i-a.end,t=a.end):(a.start=t,a.end=t+i,s=!0),this.addedAt=t,this.trigger("change:loading",!0,n),this.collection.fetchRange({start:t,size:i,prepend:n,hideLoadingAlert:!0}).always(_.bind(function(){this.trigger("change:loading",!1),a.end=a.start+this.collection.length,s&&this.measure(),this.repopulate&&(this.repopulate=!1,this.virtualize())
},this))},reset:function(e){if(this.rendered){this.populated=!!e[this.sizeProperty],this.completed=!1,this.visibleStartIndex=0,this.visibleEndIndex=0,this.addedAt=null,this.removeAllViews(),this.items={},this.virtualItems=[];for(var t=0,i=e[this.sizeProperty];i>t;t++){var n=this.addItem(e.at(t),e);this.virtual&&this.virtualItems.splice(t,0,n)}_.defer(_.bind(function(){this.completed=!0,this.trigger("complete"),this.virtual&&(this.measure(),this.collection.scrollPosition?this.scrollTo(this.collection.scrollPosition):this.$scrollContainer[0].scrollTop>0?this.scrollTo(0):this.virtualize())
},this))}},addItem:function(t,i,n){var a;if(n||(n={}),n.merge)return a=e.prototype.addItem.apply(this,arguments),this.virtual&&this.virtualItems.splice(n.at,0,a),this.collection.populatedRange.end++,a;if(this.virtual&&null!==this.addedAt){var s=this.addedAt;return a=this.virtualItems[s],this.addedAt++,a?(a.model=t,this.isItemVisible(s)&&a.show(),this.items[t.id]=a):(a=e.prototype.addItem.apply(this,arguments),this.virtual&&this.virtualItems.splice(s,0,a)),a}return e.prototype.addItem.apply(this,arguments)
},removeItem:function(t){var i=this.items[t.id];if(i&&this.virtualItems)for(var n=0,a=this.virtualItems.length;a>n;n++)if(this.virtualItems[n]===i){this.virtualItems.splice(n,1),this.collection.populatedRange.end--;break}e.prototype.removeItem.apply(this,arguments)},merge:function(t,i){if(!t)return this.addedAt=0,void 0;for(var n=this.virtualItems.length;i>n;n++){var a=e.prototype.addItem.call(this);this.virtualItems.splice(n,0,a)}this.virtualize()},measure:function(){var t;if(this.virtualItems&&this.virtualItems.length||(t=this.addItem()),e.prototype.measure.apply(this,arguments),t){var i=this.itemsPerRow*this.rowsPadding,n=2*i+this.itemsPerPage;
this.collection.start=0,this.collection.size=n,this.removeView(t)}},virtualize:function(){var e=this.visibleStartIndex,t=this.visibleEndIndex,i=this.$scrollContainer.scrollTop(),n=this.itemsPerRow*this.rowsPadding,a=2*n+this.itemsPerPage,s="down";if(this.collection.scrollPosition>i&&(s="up"),this.collection.scrollPosition=i,this.visibleStartIndex=Math.floor(i/this.itemHeight)*this.itemsPerRow,this.visibleEndIndex=this.visibleStartIndex+this.itemsPerPage,isNaN(this.visibleStartIndex)||isNaN(this.visibleEndIndex))return this.visibleStartIndex=0,this.visibleEndIndex=0,void 0;
this.visibleStartIndex-=n,this.visibleEndIndex+=n,0>this.visibleStartIndex&&(this.visibleStartIndex=0),this.visibleEndIndex+1>this.virtualItems.length&&(this.visibleEndIndex=this.virtualItems.length);for(var r=Math.min(e,this.visibleStartIndex),l=Math.max(t,this.visibleEndIndex),o=r;l>o;o++){var c=this.virtualItems[o];if(!c)break;var d=c.model;this.visibleStartIndex>o||o>=this.visibleEndIndex?d&&c.hide():d?c.show():this.collection.pending?this.repopulate=!0:this.populateRange({start:o,size:a,scrollDirection:s})
}},scrollTo:function(e){this.$scrollContainer[0].scrollTop=e},scrollToIndex:function(e){var t=Math.floor(e/this.itemsPerRow),i=t*this.itemHeight;this.scrollTo(i)},isItemVisible:function(e){return e>=this.visibleStartIndex&&this.visibleEndIndex>=e?!0:!1},onScroll:function(e){this.trigger("change:scrollPosition",e.target.scrollTop),this.scrollTimeout&&clearTimeout(this.scrollTimeout),this.scrollTimeout=setTimeout(_.bind(this.virtualize,this),this.scrollDelay)}});return t}),define("hb!templates/desktop/lists/media/items/MediaTileListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a,s="";
return s+='\n	<a href="#!/servers/',(n=i.serverID)?n=n.call(e,{hash:{},data:t}):(n=e.serverID,n=typeof n===q?n.apply(e):n),s+=V(n)+"/channels/player?identifier="+V((n=e.media,n=null==n||n===!1?n:n.identifier,typeof n===q?n.apply(e):n))+"&path=",a={hash:{},data:t},s+=V((n=i.encodeUrl||e.encodeUrl,n?n.call(e,(n=e.media,null==n||n===!1?n:n.key),a):j.call(e,"encodeUrl",(n=e.media,null==n||n===!1?n:n.key),a)))+'" data-focus="keyboard">\n'}function r(e,t){var n,a;return a=i["if"].call(e,(n=e.media,null==n||n===!1?n:n.folder),{hash:{},inverse:F.program(6,o,t),fn:F.program(4,l,t),data:t}),a||0===a?a:""
}function l(e,t){var n,a,s="";return s+='\n	<a href="#!/servers/',(n=i.serverID)?n=n.call(e,{hash:{},data:t}):(n=e.serverID,n=typeof n===q?n.apply(e):n),s+=V(n)+"/sections/",a={hash:{},data:t},s+=V((n=i.encodeUrl||e.encodeUrl,n?n.call(e,e.sectionID,a):j.call(e,"encodeUrl",e.sectionID,a)))+"/folder?key=",a={hash:{},data:t},s+=V((n=i.encodeUrl||e.encodeUrl,n?n.call(e,(n=e.media,null==n||n===!1?n:n.key),a):j.call(e,"encodeUrl",(n=e.media,null==n||n===!1?n:n.key),a)))+'" data-focus="keyboard">\n'}function o(e,t){var n,a,s,r="";
return r+='\n	<a href="#!/servers/',(n=i.serverID)?n=n.call(e,{hash:{},data:t}):(n=e.serverID,n=typeof n===q?n.apply(e):n),r+=V(n)+"/sections/",s={hash:{},data:t},r+=V((n=i.encodeUrl||e.encodeUrl,n?n.call(e,e.sectionID,s):j.call(e,"encodeUrl",e.sectionID,s)))+"/details/",a=i["if"].call(e,(n=e.media,null==n||n===!1?n:n.originalRatingKey),{hash:{},inverse:F.program(9,d,t),fn:F.program(7,c,t),data:t}),(a||0===a)&&(r+=a),r+='" data-focus="keyboard">\n'}function c(e){var t;return V((t=e.media,t=null==t||t===!1?t:t.originalRatingKey,typeof t===q?t.apply(e):t))
}function d(e){var t;return V((t=e.media,t=null==t||t===!1?t:t.ratingKey,typeof t===q?t.apply(e):t))}function h(e,t){var n,a,s;return s={hash:{},inverse:F.noop,fn:F.program(12,u,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,(n=e.media,null==n||n===!1?n:n.type),"movie",s):j.call(e,"if_eq",(n=e.media,null==n||n===!1?n:n.type),"movie",s),a||0===a?a:""}function u(){return'\n					<div class="unwatched-icon unwatched-partial-icon"></div>\n					<div class="unwatched-icon unwatched-full-icon"></div>\n				'}function p(e,t){var n,a,s,r="";
return r+="\n				",s={hash:{},inverse:F.noop,fn:F.program(15,f,t),data:t},n=i.if_neq||e.if_neq,a=n?n.call(e,(n=e.media,null==n||n===!1?n:n.type),"photo",s):j.call(e,"if_neq",(n=e.media,null==n||n===!1?n:n.type),"photo",s),(a||0===a)&&(r+=a),r+="\n				"}function f(e,t){var n,a,s,r="";return r+="\n				",s={hash:{},inverse:F.noop,fn:F.program(16,m,t),data:t},n=i.if_neq||e.if_neq,a=n?n.call(e,(n=e.media,null==n||n===!1?n:n.type),"clip",s):j.call(e,"if_neq",(n=e.media,null==n||n===!1?n:n.type),"clip",s),(a||0===a)&&(r+=a),r+="\n				"
}function m(e,t){var n,a,s,r="";return r+='\n					<div class="hover-overlay card-overlay ',s={hash:{},inverse:F.noop,fn:F.program(17,g,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,(n=e.media,null==n||n===!1?n:n.type),"season",s):j.call(e,"if_eq",(n=e.media,null==n||n===!1?n:n.type),"season",s),(a||0===a)&&(r+=a),r+=" ",s={hash:{},inverse:F.noop,fn:F.program(19,v,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,(n=e.media,null==n||n===!1?n:n.type),"episode",s):j.call(e,"if_eq",(n=e.media,null==n||n===!1?n:n.type),"episode",s),(a||0===a)&&(r+=a),r+='">\n						',s={hash:{},inverse:F.noop,fn:F.program(21,y,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,(n=e.media,null==n||n===!1?n:n.type),"episode",s):j.call(e,"if_eq",(n=e.media,null==n||n===!1?n:n.type),"episode",s),(a||0===a)&&(r+=a),r+="\n						",s={hash:{},inverse:F.noop,fn:F.program(23,b,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,(n=e.media,null==n||n===!1?n:n.type),"season",s):j.call(e,"if_eq",(n=e.media,null==n||n===!1?n:n.type),"season",s),(a||0===a)&&(r+=a),r+="\n\n						",s={hash:{},inverse:F.noop,fn:F.program(25,w,t),data:t},n=i.if_neq||e.if_neq,a=n?n.call(e,(n=e.media,null==n||n===!1?n:n.type),"show",s):j.call(e,"if_neq",(n=e.media,null==n||n===!1?n:n.type),"show",s),(a||0===a)&&(r+=a),r+='<button type="button" class="hover-menu-btn poster-edit-btn" tabindex="-1"><i class="glyphicon pencil"></i></button>',a=i.unless.call(e,e.search,{hash:{},inverse:F.noop,fn:F.program(30,C,t),data:t}),(a||0===a)&&(r+=a),r+='\n\n						<input type="checkbox" class="multiselect" name="selected">\n					</div>\n				'
}function g(){return"season-overlay"}function v(){return"episode-overlay"}function y(){return'\n							<div class="episode-overlay-details">\n								<span class="card-episode-index"></span>\n\n								<div class="unwatched-icon unwatched-partial-icon"></div>\n								<div class="unwatched-icon unwatched-full-icon"></div>\n							</div>\n						'}function b(){return'\n							<div class="season-overlay-details">\n								<span class="card-season-index"></span>\n							</div>\n						'}function w(e,t){var n,a,s;
return s={hash:{},inverse:F.noop,fn:F.program(26,x,t),data:t},n=i.if_neq||e.if_neq,a=n?n.call(e,(n=e.media,null==n||n===!1?n:n.type),"season",s):j.call(e,"if_neq",(n=e.media,null==n||n===!1?n:n.type),"season",s),a||0===a?a:""}function x(e,t){var n,a,s;return s={hash:{},inverse:F.noop,fn:F.program(27,k,t),data:t},n=i.if_neq||e.if_neq,a=n?n.call(e,(n=e.media,null==n||n===!1?n:n.type),"artist",s):j.call(e,"if_neq",(n=e.media,null==n||n===!1?n:n.type),"artist",s),a||0===a?a:""}function k(e,t){var n,a,s;
return s={hash:{},inverse:F.noop,fn:F.program(28,S,t),data:t},n=i.if_neq||e.if_neq,a=n?n.call(e,(n=e.media,null==n||n===!1?n:n.type),"track",s):j.call(e,"if_neq",(n=e.media,null==n||n===!1?n:n.type),"track",s),a||0===a?a:""}function S(){return'<button type="button" class="hover-menu-btn poster-play-btn" tabindex="-1"><i class="glyphicon play"></i></button>'}function C(){return'<button type="button" class="hover-menu-btn poster-refresh-btn" tabindex="-1"><i class="glyphicon repeat"></i></button>'}function _(){return'\n		<div class="poster-subtitle"></div>\n	'
}function A(){return'\n		<div class="media-added-at poster-sort"></div>\n	'}function I(e,t){var n,a,s;return s={hash:{},inverse:F.program(39,M,t),fn:F.program(37,T,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,e.sort,"originallyAvailableAt",s):j.call(e,"if_eq",e.sort,"originallyAvailableAt",s),a||0===a?a:""}function T(){return'\n		<div class="media-available-at poster-sort"></div>\n	'}function M(e,t){var n,a,s;return s={hash:{},inverse:F.program(42,D,t),fn:F.program(40,P,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,e.sort,"rating",s):j.call(e,"if_eq",e.sort,"rating",s),a||0===a?a:""
}function P(){return'\n		<div class="media-rating poster-sort"></div>\n	'}function D(e,t){var n,a,s;return s={hash:{},inverse:F.program(45,E,t),fn:F.program(43,L,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,e.sort,"mediaHeight",s):j.call(e,"if_eq",e.sort,"mediaHeight",s),a||0===a?a:""}function L(){return'\n		<div class="media-resolution poster-sort"></div>\n	'}function E(e,t){var n,a,s;return s={hash:{},inverse:F.noop,fn:F.program(46,N,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,e.sort,"duration",s):j.call(e,"if_eq",e.sort,"duration",s),a||0===a?a:""
}function N(){return'\n		<div class="media-duration poster-sort"></div>\n	'}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var O,R,B,$="",q="function",V=this.escapeExpression,j=i.helperMissing,F=this;return R=i["if"].call(t,(O=t.media,null==O||O===!1?O:O.url),{hash:{},inverse:F.program(3,r,a),fn:F.program(1,s,a),data:a}),(R||0===R)&&($+=R),$+='\n	<div class="poster-container">\n		<div class="poster-card">\n			<div class="poster-face front">\n				<span class="media-count"></span>\n\n				<span class="unwatched-count"></span>\n\n				',R=i["if"].call(t,t.showUnwatchedIcon,{hash:{},inverse:F.noop,fn:F.program(11,h,a),data:a}),(R||0===R)&&($+=R),$+='\n\n				<i class="deleted-icon glyphicon warning-sign hide" rel="tooltip" title="In the trash"></i>\n\n				<div class="poster-refreshing">\n					<i class="analyzing-icon glyphicon magic hide" rel="tooltip" title="Analyzing..."></i><i class="matching-icon glyphicon search hide" rel="tooltip" title="Matching..."></i><i class="metadata-icon glyphicon tags hide" rel="tooltip" title="Loading Metadata..."></i><i class="waiting-icon glyphicon clock hide"></i>\n				</div>\n\n				',B={hash:{},inverse:F.noop,fn:F.program(14,p,a),data:a},O=i.if_neq||t.if_neq,R=O?O.call(t,(O=t.media,null==O||O===!1?O:O.type),"photoAlbum",B):j.call(t,"if_neq",(O=t.media,null==O||O===!1?O:O.type),"photoAlbum",B),(R||0===R)&&($+=R),$+='\n			</div>\n		</div>\n	</div>\n\n	<div class="poster-title"></div>\n\n	',B={hash:{},inverse:F.noop,fn:F.program(32,_,a),data:a},O=i.if_eq||t.if_eq,R=O?O.call(t,(O=t.media,null==O||O===!1?O:O.type),"episode",B):j.call(t,"if_eq",(O=t.media,null==O||O===!1?O:O.type),"episode",B),(R||0===R)&&($+=R),$+="\n\n	",B={hash:{},inverse:F.noop,fn:F.program(32,_,a),data:a},O=i.if_eq||t.if_eq,R=O?O.call(t,(O=t.media,null==O||O===!1?O:O.type),"album",B):j.call(t,"if_eq",(O=t.media,null==O||O===!1?O:O.type),"album",B),(R||0===R)&&($+=R),$+="\n\n	",B={hash:{},inverse:F.noop,fn:F.program(32,_,a),data:a},O=i.if_eq||t.if_eq,R=O?O.call(t,(O=t.media,null==O||O===!1?O:O.type),"track",B):j.call(t,"if_eq",(O=t.media,null==O||O===!1?O:O.type),"track",B),(R||0===R)&&($+=R),$+="\n\n	",B={hash:{},inverse:F.noop,fn:F.program(32,_,a),data:a},O=i.if_eq||t.if_eq,R=O?O.call(t,(O=t.media,null==O||O===!1?O:O.type),"clip",B):j.call(t,"if_eq",(O=t.media,null==O||O===!1?O:O.type),"clip",B),(R||0===R)&&($+=R),$+="\n\n	",B={hash:{},inverse:F.program(36,I,a),fn:F.program(34,A,a),data:a},O=i.if_eq||t.if_eq,R=O?O.call(t,t.sort,"addedAt",B):j.call(t,"if_eq",t.sort,"addedAt",B),(R||0===R)&&($+=R),$+="\n</a>\n"
})}),define("hb!templates/base/Rating.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a="";return a+='<i class="glyphicon ',n=i["if"].call(e,e,{hash:{},inverse:d.program(4,l,t),fn:d.program(2,r,t),data:t}),(n||0===n)&&(a+=n),a+='"></i>'}function r(){return"star"}function l(){return"dislikes"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var o,c="",d=this;return o=i.each.call(t,t.stars,{hash:{},inverse:d.noop,fn:d.program(1,s,a),data:a}),(o||0===o)&&(c+=o),c+="\n"
})}),define("plex/base/view/Rating",["hb!templates/base/Rating.tpl","plex/base/control/Dispatcher","plex/base/view/BaseView","jquery"],function(e,t,i,n){var a=i.extend({tagName:"span",className:"rating",disabled:!0,events:{mouseenter:"onMouseEnter",mouseleave:"onMouseLeave","mouseover .glyphicon":"onMouseOver",click:"onClick"},initialize:function(e){this.disabled=e.disabled,this.setup(e.model)},setup:function(e){e&&(this.model=e,this.addBinding(e,"change:rating",this.render),this.addBinding(e,"change:userRating",this.render))
},render:function(){if(!this.model)return this;var t=this.model.get("rating")||0,i=this.model.get("userRating"),n=i?i:t;if(0===n&&this.disabled)return this.$el.addClass("hide"),this;var a=Math.round(n/2);return this.$el.html(e({stars:[a>0,a>1,a>2,a>3,a>4]})),this.$el.removeClass("hide user-rating disabled"),i&&this.$el.addClass("user-rating"),this.disabled||this.model.server.get("shared")?(this.$el.addClass("disabled"),this.undelegateEvents()):this.delegateEvents(),this},onMouseEnter:function(){this.$el.addClass("user-rating")
},onMouseLeave:function(){this.render(),this.$el.removeClass("saved")},onMouseOver:function(e){var t=n(e.target),i=this.$(".glyphicon"),a=i.index(t);i.each(function(e){var t=a>=e;n(this).toggleClass("star",t).toggleClass("dislikes",!t)})},onClick:function(e){e.preventDefault();var i=this.$(".glyphicon.star"),n=2*i.length;this.$el.addClass("saved"),t.trigger("command:Rate",this.model,n)}});return a}),define("hb!templates/desktop/lists/media/items/MediaListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a,s="";
return s+='\n	<a href="#!/servers/',(n=i.serverID)?n=n.call(e,{hash:{},data:t}):(n=e.serverID,n=typeof n===D?n.apply(e):n),s+=L(n)+"/sections/",a={hash:{},data:t},s+=L((n=i.encodeUrl||e.encodeUrl,n?n.call(e,e.sectionID,a):E.call(e,"encodeUrl",e.sectionID,a)))+"/folder?key=",a={hash:{},data:t},s+=L((n=i.encodeUrl||e.encodeUrl,n?n.call(e,(n=e.media,null==n||n===!1?n:n.key),a):E.call(e,"encodeUrl",(n=e.media,null==n||n===!1?n:n.key),a)))+'" data-focus="keyboard">\n'}function r(e,t){var n,a,s,r="";return r+='\n	<a href="#!/servers/',(n=i.serverID)?n=n.call(e,{hash:{},data:t}):(n=e.serverID,n=typeof n===D?n.apply(e):n),r+=L(n)+"/sections/",s={hash:{},data:t},r+=L((n=i.encodeUrl||e.encodeUrl,n?n.call(e,e.sectionID,s):E.call(e,"encodeUrl",e.sectionID,s)))+"/details/",a=i["if"].call(e,(n=e.media,null==n||n===!1?n:n.originalRatingKey),{hash:{},inverse:N.program(6,o,t),fn:N.program(4,l,t),data:t}),(a||0===a)&&(r+=a),r+='" data-focus="keyboard">\n'
}function l(e){var t;return L((t=e.media,t=null==t||t===!1?t:t.originalRatingKey,typeof t===D?t.apply(e):t))}function o(e){var t;return L((t=e.media,t=null==t||t===!1?t:t.ratingKey,typeof t===D?t.apply(e):t))}function c(){return'\n			<div class="card-overlay">\n				<span class="card-season-index"></span>\n			</div>\n		'}function d(){return'\n			<div class="card-overlay">\n				<span class="card-episode-index"></span>\n			</div>\n		'}function h(e,t){var n,a,s,r="";return r+="\n			",s={hash:{},inverse:N.noop,fn:N.program(13,u,t),data:t},n=i.if_neq||e.if_neq,a=n?n.call(e,(n=e.media,null==n||n===!1?n:n.type),"photoAlbum",s):E.call(e,"if_neq",(n=e.media,null==n||n===!1?n:n.type),"photoAlbum",s),(a||0===a)&&(r+=a),r+="\n			"
}function u(e,t){var n,a,s,r="";return r+="\n			",s={hash:{},inverse:N.noop,fn:N.program(14,p,t),data:t},n=i.if_neq||e.if_neq,a=n?n.call(e,(n=e.media,null==n||n===!1?n:n.type),"photo",s):E.call(e,"if_neq",(n=e.media,null==n||n===!1?n:n.type),"photo",s),(a||0===a)&&(r+=a),r+="\n			"}function p(e,t){var n,a,s,r="";return r+="\n			",s={hash:{},inverse:N.noop,fn:N.program(15,f,t),data:t},n=i.if_neq||e.if_neq,a=n?n.call(e,(n=e.media,null==n||n===!1?n:n.type),"clip",s):E.call(e,"if_neq",(n=e.media,null==n||n===!1?n:n.type),"clip",s),(a||0===a)&&(r+=a),r+="\n			"
}function f(e,t){var n,a,s,r="";return r+='\n				<div class="hover-menu">\n					',s={hash:{},inverse:N.noop,fn:N.program(16,m,t),data:t},n=i.if_neq||e.if_neq,a=n?n.call(e,(n=e.media,null==n||n===!1?n:n.type),"show",s):E.call(e,"if_neq",(n=e.media,null==n||n===!1?n:n.type),"show",s),(a||0===a)&&(r+=a),r+='<button type="button" class="hover-menu-btn poster-edit-btn" tabindex="-1"><i class="glyphicon pencil"></i></button><button type="button" class="hover-menu-btn poster-refresh-btn" tabindex="-1"><i class="glyphicon repeat"></i></button>\n				</div>\n			'
}function m(e,t){var n,a,s;return s={hash:{},inverse:N.noop,fn:N.program(17,g,t),data:t},n=i.if_neq||e.if_neq,a=n?n.call(e,(n=e.media,null==n||n===!1?n:n.type),"artist",s):E.call(e,"if_neq",(n=e.media,null==n||n===!1?n:n.type),"artist",s),a||0===a?a:""}function g(){return'<button type="button" class="hover-menu-btn poster-play-btn" tabindex="-1"><i class="glyphicon play"></i></button>'}function v(){return'\n				<div class="media-added-at sorted-by"></div>\n			'}function y(e,t){var n,a,s;return s={hash:{},inverse:N.program(24,w,t),fn:N.program(22,b,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,e.sort,"originallyAvailableAt",s):E.call(e,"if_eq",e.sort,"originallyAvailableAt",s),a||0===a?a:""
}function b(){return'\n				<div class="media-available-at sorted-by"></div>\n			'}function w(e,t){var n,a,s;return s={hash:{},inverse:N.program(27,k,t),fn:N.program(25,x,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,e.sort,"mediaHeight",s):E.call(e,"if_eq",e.sort,"mediaHeight",s),a||0===a?a:""}function x(){return'\n				<div class="media-resolution sorted-by"></div>\n			'}function k(e,t){var n,a,s;return s={hash:{},inverse:N.program(30,C,t),fn:N.program(28,S,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,e.sort,"duration",s):E.call(e,"if_eq",e.sort,"duration",s),a||0===a?a:""
}function S(){return'\n				<div class="media-duration sorted-by"></div>\n			'}function C(){return'\n				<div class="media-rating rating sorted-by"></div>\n			'}function _(){return'\n			<h4>\n				<span class="media-subtitle"></span>\n\n				<div class="unwatched-icon unwatched-partial-icon"></div>\n				<div class="unwatched-icon unwatched-full-icon"></div>\n			</h4>\n		'}function A(){return'\n			<h4>\n				<span class="media-subtitle"></span>\n			</h4>\n		'}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};
var I,T,M,P="",D="function",L=this.escapeExpression,E=i.helperMissing,N=this;return T=i["if"].call(t,(I=t.media,null==I||I===!1?I:I.folder),{hash:{},inverse:N.program(3,r,a),fn:N.program(1,s,a),data:a}),(T||0===T)&&(P+=T),P+='\n	<div class="poster-container">\n		',M={hash:{},inverse:N.noop,fn:N.program(8,c,a),data:a},I=i.if_eq||t.if_eq,T=I?I.call(t,(I=t.media,null==I||I===!1?I:I.type),"season",M):E.call(t,"if_eq",(I=t.media,null==I||I===!1?I:I.type),"season",M),(T||0===T)&&(P+=T),P+="\n\n		",M={hash:{},inverse:N.noop,fn:N.program(10,d,a),data:a},I=i.if_eq||t.if_eq,T=I?I.call(t,(I=t.media,null==I||I===!1?I:I.type),"episode",M):E.call(t,"if_eq",(I=t.media,null==I||I===!1?I:I.type),"episode",M),(T||0===T)&&(P+=T),P+='\n	</div>\n\n	<div class="media-details">\n		<div class="media-details-right">\n			',M={hash:{},inverse:N.noop,fn:N.program(12,h,a),data:a},I=i.if_neq||t.if_neq,T=I?I.call(t,(I=t.media,null==I||I===!1?I:I.type),"season",M):E.call(t,"if_neq",(I=t.media,null==I||I===!1?I:I.type),"season",M),(T||0===T)&&(P+=T),P+="\n\n			",M={hash:{},inverse:N.program(21,y,a),fn:N.program(19,v,a),data:a},I=i.if_eq||t.if_eq,T=I?I.call(t,t.sort,"addedAt",M):E.call(t,"if_eq",t.sort,"addedAt",M),(T||0===T)&&(P+=T),P+='\n		</div>\n\n		<h3>\n			<input type="checkbox" class="multiselect" name="selected">\n\n			<span class="media-title"></span>\n		</h3>\n\n		',M={hash:{},inverse:N.noop,fn:N.program(32,_,a),data:a},I=i.if_eq||t.if_eq,T=I?I.call(t,(I=t.media,null==I||I===!1?I:I.type),"episode",M):E.call(t,"if_eq",(I=t.media,null==I||I===!1?I:I.type),"episode",M),(T||0===T)&&(P+=T),P+="\n\n		",M={hash:{},inverse:N.noop,fn:N.program(34,A,a),data:a},I=i.if_eq||t.if_eq,T=I?I.call(t,(I=t.media,null==I||I===!1?I:I.type),"album",M):E.call(t,"if_eq",(I=t.media,null==I||I===!1?I:I.type),"album",M),(T||0===T)&&(P+=T),P+='\n\n		<h4 class="media-tagline"></h4>\n\n		<div class="media-summary summary"></div>\n	</div>\n</a>\n'
})}),window.Modernizr=function(e,t,i){function n(e){v.cssText=e}function a(e,t){return typeof e===t}function s(e,t){return!!~(""+e).indexOf(t)}function r(e,t){for(var n in e){var a=e[n];if(!s(a,"-")&&v[a]!==i)return"pfx"==t?a:!0}return!1}function l(e,t,n){for(var s in e){var r=t[e[s]];if(r!==i)return n===!1?e[s]:a(r,"function")?r.bind(n||t):r}return!1}function o(e,t,i){var n=e.charAt(0).toUpperCase()+e.slice(1),s=(e+" "+w.join(n+" ")+n).split(" ");return a(t,"string")||a(t,"undefined")?r(s,t):(s=(e+" "+x.join(n+" ")+n).split(" "),l(s,t,i))
}var c,d,h,u="2.6.2",p={},f=t.documentElement,m="modernizr",g=t.createElement(m),v=g.style,y=({}.toString," -webkit- -moz- -o- -ms- ".split(" ")),b="Webkit Moz O ms",w=b.split(" "),x=b.toLowerCase().split(" "),k={},S=[],C=S.slice,_=function(e,i,n,a){var s,r,l,o,c=t.createElement("div"),d=t.body,h=d||t.createElement("body");if(parseInt(n,10))for(;n--;)l=t.createElement("div"),l.id=a?a[n]:m+(n+1),c.appendChild(l);return s=["&#173;",'<style id="s',m,'">',e,"</style>"].join(""),c.id=m,(d?c:h).innerHTML+=s,h.appendChild(c),d||(h.style.background="",h.style.overflow="hidden",o=f.style.overflow,f.style.overflow="hidden",f.appendChild(h)),r=i(c,e),d?c.parentNode.removeChild(c):(h.parentNode.removeChild(h),f.style.overflow=o),!!r
},A={}.hasOwnProperty;h=a(A,"undefined")||a(A.call,"undefined")?function(e,t){return t in e&&a(e.constructor.prototype[t],"undefined")}:function(e,t){return A.call(e,t)},Function.prototype.bind||(Function.prototype.bind=function(e){var t=this;if("function"!=typeof t)throw new TypeError;var i=C.call(arguments,1),n=function(){if(this instanceof n){var a=function(){};a.prototype=t.prototype;var s=new a,r=t.apply(s,i.concat(C.call(arguments)));return Object(r)===r?r:s}return t.apply(e,i.concat(C.call(arguments)))
};return n}),k.csstransforms3d=function(){var e=!!o("perspective");return e&&"webkitPerspective"in f.style&&_("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(t){e=9===t.offsetLeft&&3===t.offsetHeight}),e};for(var I in k)h(k,I)&&(d=I.toLowerCase(),p[d]=k[I](),S.push((p[d]?"":"no-")+d));return p.addTest=function(e,t){if("object"==typeof e)for(var n in e)h(e,n)&&p.addTest(n,e[n]);else{if(e=e.toLowerCase(),p[e]!==i)return p;t="function"==typeof t?t():t,"undefined"!=typeof enableClasses&&enableClasses&&(f.className+=" "+(t?"":"no-")+e),p[e]=t
}return p},n(""),g=c=null,p._version=u,p._prefixes=y,p._domPrefixes=x,p._cssomPrefixes=w,p.testProp=function(e){return r([e])},p.testAllProps=o,p.testStyles=_,p}(this,this.document),define("modernizr",function(){}),define("plex/base/view/images/MediaPosterImage",["plex/base/view/images/BaseImage","modernizr"],function(e){var t=e.extend({$container:null,setup:function(){e.prototype.setup.apply(this,arguments),this.url=this.getPosterUrl(),this.placeholder=this.getPlaceholderUrl()},hide:function(){this.model&&this.modelAttr&&(this.listening=!1,this.removeBinding(this.model,"change:"+this.modelAttr)),this.cancel()
},getPosterUrl:function(){var e=this.model.get("type"),t=this.model.get("thumb");return this.model.get("folder")?null:("track"===e?t=this.model.get("parentThumb")||t:"photoAlbum"!==e&&"photo"!==e&&(t=this.model.get("grandparentThumb")||t),t)},getPlaceholderUrl:function(){function e(e,t){return i?t?"img/posters/folder_square.png":"img/posters/folder.png":e}var t=this.model.get("type"),i=this.model.get("folder");switch(!t&&this.model.section&&(t=this.model.section.get("type")),t){case"artist":case"album":case"track":return e("img/posters/album.png",!0);
case"photoAlbum":case"photo":return e("img/posters/photo.png",!0);case"clip":return e("img/posters/poster_square.png",!0)}return e("img/posters/poster.png")},onChange:function(e,t){if(t=this.getPosterUrl(),this.url!==t){if(!this.$container)return this.update(t),void 0;var i=this.$container.hasClass("refreshing")||this.$container.hasClass("refreshed");this.url=t;var n=_.bind(function(e){if(this.src=e,!i||!Modernizr.csstransforms3d)return this.$el.attr("src",e).removeAttr("width").removeAttr("height"),this.trigger("load",e),void 0;
var t,n=this.$container.find(".poster-card"),a=this.$container.find(".poster-face.front"),s=this.$container.find(".poster-face.back");this.$container.hasClass("flip")?t=a:(s.length||(s=a.clone(),s.removeClass("front").addClass("back"),n.append(s)),t=s);var r=t.find(".poster"),l=_.bind(function(){r.off("load",l),this.$container.toggleClass("flip")},this);r.on("load",l),r.removeClass("placeholder").attr("src",e).removeAttr("width").removeAttr("height"),this.trigger("load",e)},this);this.load(this.url,this.transcode).done(n)
}}});return t}),define("plex/desktop/view/lists/media/items/MediaListItem",["hb!templates/desktop/lists/media/items/MediaListItem.tpl","plex/base/control/Dispatcher","plex/base/view/BaseView","plex/base/view/Rating","plex/base/view/images/MediaPosterImage","jquery"],function(e,t,i,n,a,s){var r=i.extend({tagName:"li",visible:!1,list:null,sort:null,rating:null,poster:null,events:{"click a":"onClick","click .poster-play-btn":"onPlayClick","click .poster-edit-btn":"onEditClick","click .poster-refresh-btn":"onRefreshClick","mouseenter .hover-menu-btn":"onMenuMouseEnter","mouseleave .hover-menu-btn":"onMenuMouseLeave"},initialize:function(e){var t=e.list.collection;
this.visible=!e.list.virtual||e.visible,this.list=e.list,this.sort=t.sort.key,this.rating=this.registerView(new n({model:this.model,disabled:!0})),this.poster=this.registerView(new a(this.getPosterOptions()))},render:function(){return this.model&&this.visible?(this.$el.html(e({serverID:this.model.server.id,sectionID:this.model.section.id,media:this.model.toJSON(),sort:this.sort})),(this.model.section.get("limited")||this.model.server.get("shared")||this.model.get("folder"))&&this.$el.addClass("hide-hover-overlay"),this.$(".media-rating").append(this.rating.render().el),this.$(".poster-container").prepend(this.poster.render().el),this.bindView(),this):this
},show:function(){this.visible||(this.visible=!0,this.rating.setup(this.model),this.poster.setup(this.getPosterOptions()),this.render())},hide:function(){this.visible&&(this.visible=!1,this.poster.hide(),this.$el.empty())},select:function(){this.$("a").addClass("selected"),this.$(".multiselect").prop("checked",!0)},deselect:function(){this.$("a").removeClass("selected"),this.$(".multiselect").prop("checked",!1)},check:function(e){e.preventDefault();var t=this.$(".multiselect"),i=t.prop("checked");
s(e.target)[0]===t[0]&&(i=!i,_.defer(function(){t.prop("checked",!i)})),i?this.trigger("deselect",this):this.trigger("select",this,!1)},getPosterOptions:function(){return this.model?{model:this.model,modelAttr:"thumb",className:"poster media-list-poster",transcode:!0,width:100,height:150,$container:this.$(".poster-container")}:void 0},bindings:{".media-title":{modelAttr:"title",format:function(e,t){var i=this.model.get("type");switch(i){case"season":case"album":t=this.model.get("parentTitle");break;
case"episode":t=this.model.get("grandparentTitle")}return Handlebars.helpers.truncate.call(this,t,80)}},".media-subtitle":{modelAttr:"title",format:function(e,t){var i=this.model.get("type");if("episode"===i||"album"===i)return Handlebars.helpers.truncate.call(this,t,120)}},".card-season-index":{modelAttr:"index",hideEmpty:!0,format:function(e,t){var i=this.model.get("type");if("season"===i)return Handlebars.helpers.seasonIndex.call(this,t)}},".card-episode-index":{modelAttr:"index",hideEmpty:!0,format:function(e,t){var i=this.model.get("type");
if("episode"===i){var n=this.model.get("parentIndex"),a=this.model.get("originallyAvailableAt");return Handlebars.helpers.seasonEpisodeIndex.call(this,n,t,a)}}},".unwatched-icon":{modelAttr:"viewCount",format:function(e,t){var i=this.model.server.get("shared"),n=this.model.server.get("multiuser"),a=this.model.get("type"),s=this.model.get("viewOffset");return i&&!n?(e.addClass("hide"),void 0):("episode"===a&&(t||s?e.addClass("hide"):(e.removeClass("hide"),this.$(".unwatched-partial-icon").addClass("hide"))),void 0)
}},".unwatched-partial-icon":{modelAttr:"viewOffset",format:function(e,t){var i=this.model.server.get("shared"),n=this.model.server.get("multiuser"),a=this.model.get("type");return i&&!n?(e.addClass("hide"),void 0):("episode"===a&&(t?(e.removeClass("hide"),this.$(".unwatched-full-icon").addClass("hide")):e.addClass("hide")),void 0)}},".media-tagline":{modelAttr:"tagline",hideEmpty:!0,format:function(e,t){return t?Handlebars.helpers.truncate.call(this,t,80):""}},".media-summary":{modelAttr:"summary",hideEmpty:!0,format:function(e,t){return Handlebars.helpers.truncate.call(this,t,250)
}},".media-added-at":{modelAttr:"addedAt",hideEmpty:!0,format:function(e,t){return Handlebars.helpers.timeAgo.call(this,t)}},".media-available-at":{modelAttr:"originallyAvailableAt",hideEmpty:!0,format:function(e,t){return Handlebars.helpers.formatDate.call(this,t)}},".media-resolution":{modelAttr:"Media",hideEmpty:!0,format:function(e,t){return t&&t.length?Handlebars.helpers.formatResolution.call(this,t[0].videoResolution):""}},".media-duration":{modelAttr:"duration",hideEmpty:!0,format:function(e,t){return Handlebars.helpers.formatMinutes.call(this,t)
}}},onClick:function(e){if(e.metaKey||e.ctrlKey||e.shiftKey)return e.preventDefault(),this.trigger("select",this,e.shiftKey),void 0;if(this.list.editing)return this.check(e),void 0;var i=this.model.get("type");return"track"===i?(e.preventDefault(),t.trigger("command:PlayTrack",this.model),void 0):"photo"===i?(e.preventDefault(),t.trigger("show:photo",this.list.collection,this.model),void 0):void 0},onPlayClick:function(e){e.stopImmediatePropagation(),e.preventDefault(),t.trigger("command:PlayMedia",this.model)
},onEditClick:function(e){e.stopImmediatePropagation(),e.preventDefault();var i=this.model.section?this.model.section.id:this.model.get("librarySectionID");t.trigger("navigate:edit",{serverID:this.model.server.id,sectionID:i,mediaID:this.model.id})},onRefreshClick:function(e){e.stopImmediatePropagation(),e.preventDefault(),t.trigger("command:RefreshMetadata",this.model)},onMenuMouseEnter:function(e){this.$(".hover-menu-btn").each(function(t,i){i!==e.currentTarget?s(i).addClass("dim"):s(i).removeClass("dim")
})},onMenuMouseLeave:function(){this.$(".hover-menu-btn").removeClass("dim")}});return r}),define("plex/desktop/view/lists/media/items/MediaTileListItem",["hb!templates/desktop/lists/media/items/MediaTileListItem.tpl","plex/base/control/Dispatcher","plex/base/control/utils/MediaTypes","plex/base/model/SettingsModel","plex/base/view/Rating","plex/desktop/view/lists/media/items/MediaListItem","plex/base/view/images/MediaPosterImage","jquery","modernizr"],function(e,t,i,n,a,s,r){var l=s.extend({tagName:"li",showUnwatchedIcon:!1,events:{"click a":"onClick","click .poster-play-btn":"onPlayClick","click .poster-edit-btn":"onEditClick","click .poster-refresh-btn":"onRefreshClick","mouseenter .hover-menu-btn":"onMenuMouseEnter","mouseleave .hover-menu-btn":"onMenuMouseLeave"},initialize:function(e){var t=e.list.collection,s=t.getMediaType?t.getMediaType():t.mediaType,l=i.getMediaType(s),o=n.get("showMovieUnwatched");
this.visible=!e.list.virtual||e.visible,this.list=e.list,this.sort=t.sort.key,this.showUnwatchedIcon=!1,l?this.$el.addClass(l.typeString):this.model&&(l=i.getMediaTypeByString(this.model.get("type")),this.$el.addClass(this.model.get("type"))),l&&(4===l.id||1===l.id&&o)&&(this.showUnwatchedIcon=!0),this.sort&&/^(addedAt|originallyAvailableAt|rating|mediaHeight|duration)$/.test(this.sort)&&this.$el.addClass("sorted"),this.rating=this.registerView(new a({model:this.model,disabled:!0})),this.poster=this.registerView(new r(this.getPosterOptions()))
},render:function(){if(!this.model||!this.visible)return this;var t=this.model.section?this.model.section.id:this.model.get("librarySectionID"),i=this.model.section&&this.model.section.get("limited"),n=this.model.server.get("shared");return this.$el.html(e({serverID:this.model.server.id,sectionID:t,media:this.model.toJSON(),sort:this.sort,showUnwatchedIcon:this.showUnwatchedIcon,search:!this.model.section})),(i||n||this.model.get("folder"))&&this.$el.addClass("hide-hover-overlay"),this.$(".media-rating").append(this.rating.render().el),this.poster.$container=this.$(".poster-container"),this.$(".poster-face").prepend(this.poster.render().el),this.bindView(),this.$(".poster-refreshing").tooltip({selector:"i",placement:"top"}),this.$el.tooltip({selector:".deleted-icon",placement:"top"}),this
},getPosterOptions:function(){return this.model?{model:this.model,modelAttr:"thumb",className:"poster media-tile-list-poster",transcode:!0,width:128,height:200}:void 0},updateRefreshingState:function(){var e=this.model.get("metadataState"),t=this.model.get("mediaState"),i=this.$(".poster-container"),n=this.$(".waiting-icon");e&&"created"!==e||t?(n.removeClass("hide"),i.addClass("refreshing").removeClass("refreshed")):i.hasClass("refreshing")&&(n.addClass("hide"),i.removeClass("refreshing").addClass("refreshed"))
},bindings:{".poster-title":{modelAttr:"title",format:function(e,t){var i=this.model.get("type");switch(i){case"season":case"album":return this.model.get("parentTitle");case"episode":case"track":return this.model.get("grandparentTitle");case"clip":return this.model.get("sourceTitle");default:return t}}},".poster-subtitle":{modelAttr:"title",format:function(e,t){var i=this.model.get("type");if(/^(season|episode|album|track|clip)$/.test(i))return t}},".media-count":{modelAttr:"Media",hideEmpty:!0,format:function(){var e=0,t=this.model.get("Media"),i=this.model.get("type");
return"clip"===i?0:(t.length>1&&(e=t.length),e)}},".unwatched-count":{modelAttr:"unviewedLeafCount",hideEmpty:!0,format:function(e,t){var i=this.model.server.get("shared"),n=this.model.server.get("multiuser");if(!t||i&&!n)return 0;var a=this.model.get("type");return"album"===a?0:t}},".card-season-index":{modelAttr:"index",hideEmpty:!0,format:function(e,t){var i=this.model.get("type");if("season"===i)return Handlebars.helpers.seasonIndex.call(this,t)}},".card-episode-index":{modelAttr:"index",hideEmpty:!0,format:function(e,t){var i=this.model.get("type");
if("episode"===i){var n=this.model.get("parentIndex"),a=this.model.get("originallyAvailableAt");return Handlebars.helpers.seasonEpisodeIndex.call(this,n,t,a)}}},".unwatched-icon":{modelAttr:"viewCount",format:function(e,t){var i=this.model.server.get("shared"),n=this.model.server.get("multiuser");this.model.get("type");var a=this.model.get("viewOffset");return i&&!n?(e.addClass("hide"),void 0):(this.showUnwatchedIcon&&(t||a?e.addClass("hide"):(e.removeClass("hide"),this.$(".unwatched-partial-icon").addClass("hide"))),void 0)
}},".unwatched-partial-icon":{modelAttr:"viewOffset",format:function(e,t){var i=this.model.server.get("shared"),n=this.model.server.get("multiuser");return this.model.get("type"),i&&!n?(e.addClass("hide"),void 0):(this.showUnwatchedIcon&&(t?(e.removeClass("hide"),this.$(".unwatched-full-icon").addClass("hide")):e.addClass("hide")),void 0)}},".deleted-icon":{modelAttr:"deletedAt",format:function(e,t){t?e.removeClass("hide"):e.addClass("hide")}},".media-added-at":{modelAttr:"addedAt",hideEmpty:!0,format:function(e,t){return Handlebars.helpers.timeAgo.call(this,t)
}},".media-available-at":{modelAttr:"originallyAvailableAt",hideEmpty:!0,format:function(e,t){return Handlebars.helpers.formatDate.call(this,t)}},".media-resolution":{modelAttr:"Media",hideEmpty:!0,format:function(e,t){return t&&t.length?Handlebars.helpers.formatResolution.call(this,t[0].videoResolution):""}},".media-duration":{modelAttr:"duration",hideEmpty:!0,format:function(e,t){return Handlebars.helpers.formatMinutes.call(this,t)}},".matching-icon":{modelAttr:"metadataState",format:function(e,t){var i=this.$(".metadata-icon");
switch(t){case"matching":e.removeClass("hide");break;case"processing":case"loading":e.addClass("hide"),i.removeClass("hide");break;default:e.addClass("hide"),i.addClass("hide")}this.updateRefreshingState()}},".analyzing-icon":{modelAttr:"mediaState",format:function(e,t){t?e.removeClass("hide"):e.addClass("hide"),this.updateRefreshingState()}}}});return l}),define("plex/desktop/view/lists/media/MediaTileList",["plex/desktop/view/lists/VirtualList","plex/desktop/view/lists/media/items/MediaTileListItem"],function(e,t){var i=e.extend({tagName:"ul",className:"tile-list media-tile-list",rowsPadding:5,focusOptions:{position:3},initialize:function(e){e.selectable!==void 0&&(this.selectable=e.selectable),this.setup(t)
},render:function(){return this.$el.empty(),this.populate(this.collection),this}});return i}),define("plex/desktop/view/SearchView",["hb!templates/desktop/SearchView.tpl","plex/base/model/media/collections/MediaCollection","plex/base/view/BaseView","plex/desktop/view/lists/media/MediaTileList"],function(e,t,i,n){var a=["movies","shows","episodes","artists","albums","tracks","clips"],s=i.extend({className:"container-fluid",query:"",pendingRequests:0,initialize:function(e){this.collections=e.collections,this.query=e.query,this.pendingRequests=e.collections.length,_.each(a,_.bind(function(e){this[e]=new Backbone.Collection,this[e+"List"]=this.registerView(new n({selectable:!1,collection:this[e]}))
},this)),_.each(e.providers,_.bind(function(e){e.populate({hideLoadingAlert:!0}).done(_.bind(function(){e.each(_.bind(function(e){if(!e.get("machineIdentifier")){var i=new t([],{server:e.server,url:e.get("key")+"&query="+this.query});this.pendingRequests++,i.populate({hideLoadingAlert:!0}).always(_.bind(function(){this.finishSearch()},this)).done(_.bind(function(){this.collections.push(i),this.mergeResults(i)},this))}},this))},this))},this)),_.each(e.collections,_.bind(function(e){e.populate({hideLoadingAlert:!0}).always(_.bind(function(){this.finishSearch()
},this)).done(_.bind(function(){this.mergeResults(e)},this))},this))},render:function(){return this.$el.html(e({empty:!1,query:this.query})),_.each(a,_.bind(function(e){this.$("."+e+"-container").append(this[e+"List"].render().el)},this)),this},destroy:function(){i.prototype.destroy.call(this),_.each(this.collections,function(e){e.release()})},mergeResults:function(e){e.length&&_.each(a,_.bind(function(t){this[t].add(e[t]()),this[t].length&&this.$("."+t+"-container").removeClass("hide")},this))},finishSearch:function(){this.pendingRequests--,this.pendingRequests>0||_.delay(_.bind(function(){var e=0;
this.$(".pending-search-header").addClass("hide"),_.each(a,_.bind(function(t){e+=this[t].length},this)),0===e?this.$(".no-results-search-header").removeClass("hide"):this.$(".results-search-header").removeClass("hide")},this),100)}});return s}),define("hb!templates/desktop/server/settings/SettingsView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a,s="";return s+="\n					",a={hash:{},data:t},s+=f((n=i.t||e.t,n?n.call(e,(n=e.server,null==n||n===!1?n:n.friendlyName),20,a):p.call(e,"t",(n=e.server,null==n||n===!1?n:n.friendlyName),20,a)))+"\n				"
}function r(e,t){var n,a,s="";return s+="\n					",a={hash:{},data:t},s+=f((n=i.t||e.t,n?n.call(e,(n=e.server,null==n||n===!1?n:n.name),20,a):p.call(e,"t",(n=e.server,null==n||n===!1?n:n.name),20,a)))+"\n				"}function l(e,t){var n,a,s="";return s+='\n				<li><a class="media-server-filter settings-filter ',n=i.unless.call(e,e.plexWebActive,{hash:{},inverse:m.noop,fn:m.program(6,o,t),data:t}),(n||0===n)&&(s+=n),s+='" href="#">',a={hash:{},data:t},s+=f((n=i.t||e.t,n?n.call(e,"Plex Media Server",a):p.call(e,"t","Plex Media Server",a)))+"</a></li>\n			"
}function o(){return"active"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var c,d,h,u="",p=i.helperMissing,f=this.escapeExpression,m=this;return u+='<div class="subnav-container">\n	<ul class="subnav-actions">\n		<li>\n			<span class="subnav-action-label source-title">\n				',d=i["if"].call(t,(c=t.server,null==c||c===!1?c:c.friendlyName),{hash:{},inverse:m.program(3,r,a),fn:m.program(1,s,a),data:a}),(d||0===d)&&(u+=d),u+='\n			</span>\n		</li>\n	</ul>\n\n	<ul class="subnav-list">\n		<li><i class="subnav-icon glyphicon settings"></i></li>\n		<li><a class="gray active" href="#!/settings">',h={hash:{},data:a},u+=f((c=i.t||t.t,c?c.call(t,"Settings",h):p.call(t,"t","Settings",h)))+'</a></li>\n	</ul>\n</div>\n\n<div class="settings-container well">\n	<div class="well-header">\n		<a class="standard-toggle pull-right" href="#">',h={hash:{},data:a},u+=f((c=i.t||t.t,c?c.call(t,"Show Advanced Settings",h):p.call(t,"t","Show Advanced Settings",h)))+'</a>\n		<a class="advanced-toggle pull-right hide" href="#">',h={hash:{},data:a},u+=f((c=i.t||t.t,c?c.call(t,"Hide Advanced Settings",h):p.call(t,"t","Hide Advanced Settings",h)))+'</a>\n\n		<ul class="subnav-list well-header-list">\n			',d=i.unless.call(t,(c=t.server,null==c||c===!1?c:c.shared),{hash:{},inverse:m.noop,fn:m.program(5,l,a),data:a}),(d||0===d)&&(u+=d),u+='\n\n			<li><a class="plex-web-filter settings-filter ',d=i["if"].call(t,t.plexWebActive,{hash:{},inverse:m.noop,fn:m.program(6,o,a),data:a}),(d||0===d)&&(u+=d),u+='" href="#">',h={hash:{},data:a},u+=f((c=i.t||t.t,c?c.call(t,"Plex/Web",h):p.call(t,"t","Plex/Web",h)))+"</a></li>\n		</ul>\n	</div>\n</div>\n"
})}),define("hb!templates/desktop/server/settings/ServerSettingsView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a="";return a+="\n		",n=i["if"].call(e,e.prefs,{hash:{},inverse:x.noop,fn:x.program(2,r,t),data:t}),(n||0===n)&&(a+=n),a+="\n	"}function r(e,t){var n;return n=i["if"].call(e,e.title,{hash:{},inverse:x.noop,fn:x.program(3,l,t),data:t}),n||0===n?n:""}function l(e,t){var n,a,s,r="";return r+='\n			<li class="',s={hash:{},inverse:x.noop,fn:x.program(4,o,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,e.group,"general",s):b.call(e,"if_eq",e.group,"general",s),(a||0===a)&&(r+=a),r+=" ",a=i["if"].call(e,e.advanced,{hash:{},inverse:x.noop,fn:x.program(6,c,t),data:t}),(a||0===a)&&(r+=a),r+='">\n				<a href="#',(a=i.id)?a=a.call(e,{hash:{},data:t}):(a=e.id,a=typeof a===k?a.apply(e):a),r+=w(a)+'">',s={hash:{},data:t},r+=w((n=i.t||e.t,n?n.call(e,e.title,s):b.call(e,"t",e.title,s)))+"</a>\n			</li>\n			",s={hash:{},inverse:x.noop,fn:x.program(8,d,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,e.group,"general",s):b.call(e,"if_eq",e.group,"general",s),(a||0===a)&&(r+=a),r+="\n		"
}function o(){return"active"}function c(){return"advanced-prefs hide"}function d(e,t){var n,a,s="";return s+='\n				<li>\n					<a href="#myplex">',a={hash:{},data:t},s+=w((n=i.t||e.t,n?n.call(e,"myPlex",a):b.call(e,"t","myPlex",a)))+'</a>\n				</li>\n				<li>\n					<a href="#agents">',a={hash:{},data:t},s+=w((n=i.t||e.t,n?n.call(e,"Agents",a):b.call(e,"t","Agents",a)))+"</a>\n				</li>\n			"}function h(e,t,n){var a,s="";return s+="\n			",a=i["if"].call(e,e.prefs,{hash:{},inverse:x.noop,fn:x.programWithDepth(11,u,t,n),data:t}),(a||0===a)&&(s+=a),s+="\n		"
}function u(e,t,n){var a,s,r,l="";return l+='\n				<div id="',(a=i.id)?a=a.call(e,{hash:{},data:t}):(a=e.id,a=typeof a===k?a.apply(e):a),l+=w(a)+'" class="preferences-group ',r={hash:{},inverse:x.noop,fn:x.program(4,o,t),data:t},a=i.if_eq||e.if_eq,s=a?a.call(e,e.group,"general",r):b.call(e,"if_eq",e.group,"general",r),(s||0===s)&&(l+=s),l+='">\n					',r={hash:{},inverse:x.noop,fn:x.programWithDepth(12,p,t,n),data:t},a=i.if_eq||e.if_eq,s=a?a.call(e,e.id,"general",r):b.call(e,"if_eq",e.id,"general",r),(s||0===s)&&(l+=s),l+="\n\n					",r={hash:{},inverse:x.noop,fn:x.program(14,f,t),data:t},a=i.if_eq||e.if_eq,s=a?a.call(e,e.id,"channels",r):b.call(e,"if_eq",e.id,"channels",r),(s||0===s)&&(l+=s),l+="\n\n					",s=i.each.call(e,e.prefs,{hash:{},inverse:x.noop,fn:x.program(16,m,t),data:t}),(s||0===s)&&(l+=s),l+="\n				</div>\n			"
}function p(e,t,n){var a,s,r="";return r+='\n						<div class="control-group">\n							<label class="control-label">\n								',s={hash:{},data:t},r+=w((a=i.t||e.t,a?a.call(e,"Version",s):b.call(e,"t","Version",s)))+" "+w((a=n.version,typeof a===k?a.apply(e):a))+"\n							</label>\n						</div>\n					"}function f(e,t){var n,a,s="";return s+='\n						<div class="control-group">\n							<a class="directory-settings-btn" href="#"><i class="glyphicon settings"></i> ',a={hash:{},data:t},s+=w((n=i.t||e.t,n?n.call(e,"Directory Settings",a):b.call(e,"t","Directory Settings",a)))+"</a>\n						</div>\n					"
}function m(e,t){var n,a,s="";return s+="\n						",a={hash:{idSuffix:"_c"},data:t},s+=w((n=i.partial||e.partial,n?n.call(e,"preference",a):b.call(e,"partial","preference",a)))+"\n					"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var g,v,y="",b=i.helperMissing,w=this.escapeExpression,x=this,k="function";return y+='<ul class="preferences-nav nav nav-list">\n	',g=i.each.call(t,t.groups,{hash:{},inverse:x.noop,fn:x.program(1,s,a),data:a}),(g||0===g)&&(y+=g),y+='\n</ul>\n\n<form class="preferences-form">\n	<fieldset>\n		',g=i.each.call(t,t.groups,{hash:{},inverse:x.noop,fn:x.programWithDepth(10,h,a,t),data:a}),(g||0===g)&&(y+=g),y+='\n\n		<div class="main-actions form-actions">\n			<button type="submit" class="btn btn-medium btn-primary">',v={hash:{},data:a},y+=w((g=i.t||t.t,g?g.call(t,"Save",v):b.call(t,"t","Save",v)))+'</button>\n			<button type="button" class="btn btn-medium cancel-btn">',v={hash:{},data:a},y+=w((g=i.t||t.t,g?g.call(t,"Cancel",v):b.call(t,"t","Cancel",v)))+"</button>\n		</div>\n	</fieldset>\n</form>\n"
})}),define("plex/base/model/AccountModel",["plex/base/model/BaseModel","jquery"],function(e,t){var i=e.extend({idAttribute:"key",whitelistedAttrs:["key","name","defaultAudioLanguage","autoSelectAudio","defaultSubtitleLanguage","subtitleMode"],url:function(){return this.get("key")},initialize:function(e,t){this.server=t.server},convert:function(e){var i=_.isObject(e)?e:t.xml2json(e);return i.Account},parse:function(e){var t=this.convert(e);return t=_.pick(t,this.whitelistedAttrs)}});return i}),define("hb!templates/desktop/server/settings/MyPlexSettingsView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a,s,l="";
return l+='\n	<div class="control-group manual-port-group ',n=i.unless.call(e,e.showManual,{hash:{},inverse:p.noop,fn:p.program(2,r,t),data:t}),(n||0===n)&&(l+=n),l+='">\n\n		<input type="checkbox" id="'+m((n=e.mappingMode,n=null==n||n===!1?n:n.id,typeof n===f?n.apply(e):n))+'" name="'+m((n=e.mappingMode,n=null==n||n===!1?n:n.id,typeof n===f?n.apply(e):n))+'" value="1" ',a=i["if"].call(e,(n=e.mappingMode,null==n||n===!1?n:n.value),{hash:{},inverse:p.noop,fn:p.program(5,o,t),data:t}),(a||0===a)&&(l+=a),l+='>\n		<label class="inline" for="'+m((n=e.mappingMode,n=null==n||n===!1?n:n.id,typeof n===f?n.apply(e):n))+'">',s={hash:{},data:t},l+=m((n=i.t||e.t,n?n.call(e,"Manually specify port",s):g.call(e,"t","Manually specify port",s)))+'</label>\n		<input type="text" id="'+m((n=e.mappingPort,n=null==n||n===!1?n:n.id,typeof n===f?n.apply(e):n))+'" name="'+m((n=e.mappingPort,n=null==n||n===!1?n:n.id,typeof n===f?n.apply(e):n))+'" class="input-dark" value="'+m((n=e.mappingPort,n=null==n||n===!1?n:n.value,typeof n===f?n.apply(e):n))+'">\n\n		<p class="help-block">\n			',s={hash:{},data:t},l+=m((n=i.t||e.t,n?n.call(e,"Enable this if automatic mapping fails. You will need to configure your router. Detailed instructions are available <a href='{1}' target='_blank'>here</a>.","http://wiki.plexapp.com/index.php/MyPlex#Publishing_the_Plex_Media_Server",s):g.call(e,"t","Enable this if automatic mapping fails. You will need to configure your router. Detailed instructions are available <a href='{1}' target='_blank'>here</a>.","http://wiki.plexapp.com/index.php/MyPlex#Publishing_the_Plex_Media_Server",s)))+"\n		</p>\n	</div>\n"
}function r(e,t){var n,a="";return a+="advanced-pref ",n=i.unless.call(e,e.showAdvanced,{hash:{},inverse:p.noop,fn:p.program(3,l,t),data:t}),(n||0===n)&&(a+=n),a}function l(){return"hide"}function o(){return"checked"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var c,d,h,u="",p=this,f="function",m=this.escapeExpression,g=i.helperMissing;return c=i["if"].call(t,t.showMappingMode,{hash:{},inverse:p.noop,fn:p.program(1,s,a),data:a}),(c||0===c)&&(u+=c),u+='\n\n<div class="control-group advanced-pref ',c=i.unless.call(t,t.showAdvanced,{hash:{},inverse:p.noop,fn:p.program(3,l,a),data:a}),(c||0===c)&&(u+=c),u+='">\n	<label class="checkbox" for="require-authentication">\n		<input id="require-authentication" name="require-authentication" type="checkbox" ',h={hash:{},inverse:p.noop,fn:p.program(5,o,a),data:a},c=i.if_eq||t.if_eq,d=c?c.call(t,(c=t.allowedNetworks,null==c||c===!1?c:c.value),"127.0.0.1/255.255.255.255",h):g.call(t,"if_eq",(c=t.allowedNetworks,null==c||c===!1?c:c.value),"127.0.0.1/255.255.255.255",h),(d||0===d)&&(u+=d),u+="> &nbsp;",h={hash:{},data:a},u+=m((c=i.t||t.t,c?c.call(t,"Require authentication on local networks",h):g.call(t,"t","Require authentication on local networks",h)))+'\n	</label>\n\n	<p class="help-block">\n		',h={hash:{},data:a},u+=m((c=i.t||t.t,c?c.call(t,"Populates the allowed networks setting with 127.0.0.1/255.255.255.255. This requires other computers on a local network to authenticate with myPlex before accessing the server.",h):g.call(t,"t","Populates the allowed networks setting with 127.0.0.1/255.255.255.255. This requires other computers on a local network to authenticate with myPlex before accessing the server.",h)))+'\n	</p>\n</div>\n\n<div class="sub-actions form-actions ',d=i.unless.call(t,t.showActions,{hash:{},inverse:p.noop,fn:p.program(3,l,a),data:a}),(d||0===d)&&(u+=d),u+='">\n	<button type="submit" class="submit-btn btn btn-medium btn-primary ',d=i.unless.call(t,(c=t.myPlex,null==c||c===!1?c:c.signedIn),{hash:{},inverse:p.noop,fn:p.program(3,l,a),data:a}),(d||0===d)&&(u+=d),u+='">',h={hash:{},data:a},u+=m((c=i.t||t.t,c?c.call(t,"Sign In",h):g.call(t,"t","Sign In",h)))+'</button>\n	<button type="submit" class="submit-btn btn btn-medium btn-primary ',d=i["if"].call(t,(c=t.myPlex,null==c||c===!1?c:c.signedIn),{hash:{},inverse:p.noop,fn:p.program(3,l,a),data:a}),(d||0===d)&&(u+=d),u+='">',h={hash:{},data:a},u+=m((c=i.t||t.t,c?c.call(t,"Sign Up",h):g.call(t,"t","Sign Up",h)))+'</button>\n	<button type="button" class="btn btn-medium cancel-btn">',h={hash:{},data:a},u+=m((c=i.t||t.t,c?c.call(t,"Cancel",h):g.call(t,"t","Cancel",h)))+"</button>\n</div>\n"
})}),define("hb!templates/desktop/server/settings/MyPlexConnectView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a,s,o="";return o+='\n	<p>\n		<i class="myplex-connect-status-icon glyphicon ok-2"></i> ',s={hash:{},data:t},o+=M((n=i.t||e.t,n?n.call(e,"Signed in as",s):T.call(e,"t","Signed in as",s)))+" ",s={hash:{},data:t},o+=M((n=i.truncate||e.truncate,n?n.call(e,(n=e.account,null==n||n===!1?n:n.username),20,s):T.call(e,"truncate",(n=e.account,null==n||n===!1?n:n.username),20,s)))+'\n		<button class="sign-out-btn btn btn-small">',s={hash:{},data:t},o+=M((n=i.t||e.t,n?n.call(e,"Sign Out",s):T.call(e,"t","Sign Out",s)))+"</button>\n	</p>\n\n	",a=i["if"].call(e,e.publishing,{hash:{},inverse:P.program(4,l,t),fn:P.program(2,r,t),data:t}),(a||0===a)&&(o+=a),o+="\n"
}function r(e,t){var n,a,s="";return s+='\n		<p class="myplex-connect-loading">',a={hash:{},data:t},s+=M((n=i.t||e.t,n?n.call(e,"Connecting server...",a):T.call(e,"t","Connecting server...",a)))+"</p>\n	"}function l(e,t){var n,a="";return n=i["if"].call(e,e.unpublishing,{hash:{},inverse:P.program(7,c,t),fn:P.program(5,o,t),data:t}),(n||0===n)&&(a+=n),a+="\n	"}function o(e,t){var n,a,s="";return s+='\n		<p class="myplex-connect-loading">',a={hash:{},data:t},s+=M((n=i.t||e.t,n?n.call(e,"Disconnecting server...",a):T.call(e,"t","Disconnecting server...",a)))+"</p>\n	"
}function c(e,t){var n,a,s="";return s+="\n		",a=i["if"].call(e,(n=e.account,null==n||n===!1?n:n.mappingError),{hash:{},inverse:P.program(19,v,t),fn:P.program(8,d,t),data:t}),(a||0===a)&&(s+=a),s+="\n	"}function d(e,t){var n,a,s,r="";return r+="\n			",s={hash:{},inverse:P.program(11,u,t),fn:P.program(9,h,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,(n=e.account,null==n||n===!1?n:n.mappingError),"badauth",s):T.call(e,"if_eq",(n=e.account,null==n||n===!1?n:n.mappingError),"badauth",s),(a||0===a)&&(r+=a),r+="\n		"
}function h(e,t){var n,a,s="";return s+='\n				<p>\n					<i class="myplex-connect-status-icon glyphicon remove-2"></i> ',a={hash:{},data:t},s+=M((n=i.t||e.t,n?n.call(e,"Unable to authenticate your server",a):T.call(e,"t","Unable to authenticate your server",a)))+'\n					<button class="retry-btn btn btn-primary btn-small">',a={hash:{},data:t},s+=M((n=i.t||e.t,n?n.call(e,"Retry",a):T.call(e,"t","Retry",a)))+"</button>\n				</p>\n			"}function u(e,t){var n,a,s,r="";return s={hash:{},inverse:P.program(14,f,t),fn:P.program(12,p,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,(n=e.account,null==n||n===!1?n:n.mappingError),"unreachable",s):T.call(e,"if_eq",(n=e.account,null==n||n===!1?n:n.mappingError),"unreachable",s),(a||0===a)&&(r+=a),r+="\n			"
}function p(e,t){var n,a,s="";return s+='\n				<p>\n					<i class="myplex-connect-status-icon glyphicon remove-2"></i> ',a={hash:{},data:t},s+=M((n=i.t||e.t,n?n.call(e,"myPlex could not reach your server",a):T.call(e,"t","myPlex could not reach your server",a)))+'\n					<button class="retry-btn btn btn-primary btn-small">',a={hash:{},data:t},s+=M((n=i.t||e.t,n?n.call(e,"Retry",a):T.call(e,"t","Retry",a)))+"</button>\n				</p>\n			"}function f(e,t){var n,a,s,r="";return s={hash:{},inverse:P.program(17,g,t),fn:P.program(15,m,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,(n=e.account,null==n||n===!1?n:n.mappingError),"myplexgone",s):T.call(e,"if_eq",(n=e.account,null==n||n===!1?n:n.mappingError),"myplexgone",s),(a||0===a)&&(r+=a),r+="\n			"
}function m(e,t){var n,a,s="";return s+='\n				<p>\n					<i class="myplex-connect-status-icon glyphicon remove-2"></i> ',a={hash:{},data:t},s+=M((n=i.t||e.t,n?n.call(e,"myPlex is not responding",a):T.call(e,"t","myPlex is not responding",a)))+'\n					<button class="retry-btn btn btn-primary btn-small">',a={hash:{},data:t},s+=M((n=i.t||e.t,n?n.call(e,"Retry",a):T.call(e,"t","Retry",a)))+"</button>\n				</p>\n			"}function g(e,t){var n,a,s="";return s+='\n				<p>\n					<i class="myplex-connect-status-icon glyphicon remove-2"></i> ',a={hash:{},data:t},s+=M((n=i.t||e.t,n?n.call(e,"There was a problem connecting your server",a):T.call(e,"t","There was a problem connecting your server",a)))+'\n					<button class="retry-btn btn btn-primary btn-small">',a={hash:{},data:t},s+=M((n=i.t||e.t,n?n.call(e,"Retry",a):T.call(e,"t","Retry",a)))+"</button>\n				</p>\n			"
}function v(e,t){var n,a,s,r="";return r+="\n			",s={hash:{},inverse:P.program(22,b,t),fn:P.program(20,y,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,(n=e.account,null==n||n===!1?n:n.mappingState),"mapped",s):T.call(e,"if_eq",(n=e.account,null==n||n===!1?n:n.mappingState),"mapped",s),(a||0===a)&&(r+=a),r+="\n		"}function y(e,t){var n,a,s="";return s+='\n				<p>\n					<i class="myplex-connect-status-icon glyphicon ok-2"></i> ',a={hash:{},data:t},s+=M((n=i.t||e.t,n?n.call(e,"Server is mapped to port {1}",(n=e.account,null==n||n===!1?n:n.publicPort),a):T.call(e,"t","Server is mapped to port {1}",(n=e.account,null==n||n===!1?n:n.publicPort),a)))+'\n					<button class="unpublish-btn btn btn-small" href="#">',a={hash:{},data:t},s+=M((n=i.t||e.t,n?n.call(e,"Disconnect",a):T.call(e,"t","Disconnect",a)))+"</button>\n				</p>\n			"
}function b(e,t){var n,a,s="";return s+='\n				<p class="publish-server-group">\n					<button class="publish-btn btn btn-primary">',a={hash:{},data:t},s+=M((n=i.t||e.t,n?n.call(e,"Connect Server",a):T.call(e,"t","Connect Server",a)))+'</button>\n				</p>\n\n				<p class="help-block">',a={hash:{},data:t},s+=M((n=i.t||e.t,n?n.call(e,"Connecting your server makes it automatically available on your devices without any configuration of your router.",a):T.call(e,"t","Connecting your server makes it automatically available on your devices without any configuration of your router.",a)))+"</p>\n			"
}function w(e,t){var n,a,s,r="";return r+='\n	<div class="myplex-connect-form">\n		<a class="change-form-btn ',a=i["if"].call(e,(n=e.myPlex,null==n||n===!1?n:n.signedIn),{hash:{},inverse:P.noop,fn:P.program(25,x,t),data:t}),(a||0===a)&&(r+=a),r+='" href="#">',s={hash:{},data:t},r+=M((n=i.t||e.t,n?n.call(e,"Already have an account?",s):T.call(e,"t","Already have an account?",s)))+'</a>\n		<a class="change-form-btn ',a=i.unless.call(e,(n=e.myPlex,null==n||n===!1?n:n.signedIn),{hash:{},inverse:P.noop,fn:P.program(25,x,t),data:t}),(a||0===a)&&(r+=a),r+='" href="#">',s={hash:{},data:t},r+=M((n=i.t||e.t,n?n.call(e,"Need an account?",s):T.call(e,"t","Need an account?",s)))+'</a>\n\n		<h3 class="',a=i["if"].call(e,(n=e.myPlex,null==n||n===!1?n:n.signedIn),{hash:{},inverse:P.noop,fn:P.program(25,x,t),data:t}),(a||0===a)&&(r+=a),r+='">',s={hash:{},data:t},r+=M((n=i.t||e.t,n?n.call(e,"Sign Up",s):T.call(e,"t","Sign Up",s)))+'</h3>\n		<h3 class="',a=i.unless.call(e,(n=e.myPlex,null==n||n===!1?n:n.signedIn),{hash:{},inverse:P.noop,fn:P.program(25,x,t),data:t}),(a||0===a)&&(r+=a),r+='">',s={hash:{},data:t},r+=M((n=i.t||e.t,n?n.call(e,"Sign In",s):T.call(e,"t","Sign In",s)))+'</h3>\n\n		<div class="username-group control-group">\n			<span class="help-inline"></span>\n			<label class="control-label" for="username">',s={hash:{},data:t},r+=M((n=i.t||e.t,n?n.call(e,"Username",s):T.call(e,"t","Username",s)))+'</label>\n			<div class="controls">\n				<input type="text" id="username" name="username" ',a=i["if"].call(e,e.dark,{hash:{},inverse:P.noop,fn:P.program(27,k,t),data:t}),(a||0===a)&&(r+=a),r+=" ",a=i["if"].call(e,(n=e.myPlex,null==n||n===!1?n:n.signedIn),{hash:{},inverse:P.noop,fn:P.program(29,S,t),data:t}),(a||0===a)&&(r+=a),r+='>\n			</div>\n		</div>\n\n		<div class="email-group control-group ',a=i["if"].call(e,(n=e.myPlex,null==n||n===!1?n:n.signedIn),{hash:{},inverse:P.noop,fn:P.program(25,x,t),data:t}),(a||0===a)&&(r+=a),r+='">\n			<span class="help-inline"></span>\n			<label class="control-label" for="email">',s={hash:{},data:t},r+=M((n=i.t||e.t,n?n.call(e,"Email",s):T.call(e,"t","Email",s)))+'</label>\n			<div class="controls">\n				<input type="text" id="email" name="email" ',a=i["if"].call(e,e.dark,{hash:{},inverse:P.noop,fn:P.program(27,k,t),data:t}),(a||0===a)&&(r+=a),r+='>\n			</div>\n		</div>\n\n		<div class="password-group control-group">\n			<span class="help-inline"></span>\n			<label class="control-label" for="password">',s={hash:{},data:t},r+=M((n=i.t||e.t,n?n.call(e,"Password",s):T.call(e,"t","Password",s)))+'</label>\n			<div class="controls">\n				<input type="password" id="password" name="password" ',a=i["if"].call(e,e.dark,{hash:{},inverse:P.noop,fn:P.program(27,k,t),data:t}),(a||0===a)&&(r+=a),r+='>\n			</div>\n			<a class="forgot-password-btn ',a=i.unless.call(e,(n=e.myPlex,null==n||n===!1?n:n.signedIn),{hash:{},inverse:P.noop,fn:P.program(25,x,t),data:t}),(a||0===a)&&(r+=a),r+='" href="https://my.plexapp.com/users/password/new" target="_blank">',s={hash:{},data:t},r+=M((n=i.t||e.t,n?n.call(e,"Forgot Password?",s):T.call(e,"t","Forgot Password?",s)))+'</a>\n		</div>\n\n		<div class="confirmPassword-group control-group ',a=i["if"].call(e,(n=e.myPlex,null==n||n===!1?n:n.signedIn),{hash:{},inverse:P.noop,fn:P.program(25,x,t),data:t}),(a||0===a)&&(r+=a),r+='">\n			<span class="help-inline"></span>\n			<label class="control-label" for="confirmPassword">',s={hash:{},data:t},r+=M((n=i.t||e.t,n?n.call(e,"Confirm Password",s):T.call(e,"t","Confirm Password",s)))+'</label>\n			<div class="controls">\n				<input type="password" id="confirmPassword" name="confirmPassword" ',a=i["if"].call(e,e.dark,{hash:{},inverse:P.noop,fn:P.program(27,k,t),data:t}),(a||0===a)&&(r+=a),r+=">\n			</div>\n		</div>\n	</div>\n"
}function x(){return"hide"}function k(){return'class="input-dark"'}function S(e){var t,i="";return i+='value="'+M((t=e.myPlex,t=null==t||t===!1?t:t.username,typeof t===D?t.apply(e):t))+'"'}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var C,_,A,I="",T=i.helperMissing,M=this.escapeExpression,P=this,D="function";return A={hash:{},inverse:P.program(24,w,a),fn:P.program(1,s,a),data:a},C=i.if_eq||t.if_eq,_=C?C.call(t,(C=t.account,null==C||C===!1?C:C.signInState),"ok",A):T.call(t,"if_eq",(C=t.account,null==C||C===!1?C:C.signInState),"ok",A),(_||0===_)&&(I+=_),I+="\n"
})}),define("plex/desktop/view/server/settings/MyPlexConnectView",["hb!templates/desktop/server/settings/MyPlexConnectView.tpl","plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel","plex/base/model/MyPlexAccountModel","plex/base/view/BaseView","jquery"],function(e,t,i,n,a,s,r){var l={username:"A username is required",email:"An email address is required",password:"A password is required",confirmPassword:"You must confirm your password",confirmPasswordMatch:"Your passwords do not match"},o=s.extend({className:"myplex-connect-settings",required:!1,dark:!1,signedIn:!1,published:!1,publishing:!1,unpublishing:!1,pollInterval:null,events:{"blur input[name]":"onInputBlur","click .change-form-btn":"onChangeFormClick","click .sign-out-btn":"onSignOutClick","click .publish-btn":"onPublishClick","click .unpublish-btn":"onUnpublishClick","click .retry-btn":"onRetryClick"},initialize:function(e){this.required=e.required,this.dark=e.dark,this.addBinding(this.model,"change:signInState",this.onAccountChange),this.addBinding(this.model,"change:mappingState",this.onAccountChange),this.addBinding(this.model,"change:publicPort",this.onAccountChange),this.signedIn="ok"===this.model.get("signInState"),this.published="mapped"===this.model.get("mappingState")
},render:function(){var t={myPlex:n.get("myPlex").toJSON(),account:this.model.toJSON(),dark:this.dark,publishing:this.publishing,unpublishing:this.unpublishing};return this.$el.html(e(t)),this},destroy:function(){return this.pollInterval&&(clearInterval(this.pollInterval),this.pollInterval=null),s.prototype.destroy.call(this)},update:function(){var e=this.model.get("signInState"),t=this.model.get("mappingState");this.signedIn="ok"===e,this.published="mapped"===t;var i=_.bind(function(){this.pollInterval||(this.pollInterval=setInterval(_.bind(function(){this.model.fetch({hideLoadingAlert:!0})
},this),500))},this),n=_.bind(function(){this.pollInterval&&(clearInterval(this.pollInterval),this.pollInterval=null),this.publishing=!1,this.unpublishing=!1,this.trigger("stop:spinner"),this.render()},this);if("ok"===e){var a=this.publishing&&"unknown"===t,s=this.unpublishing&&"mapped"===t;"waiting"===t||a||s?i():n()}},validate:function(e){var t=e.name,n=r(e).closest("."+t+"-group");return n.hasClass("hide")?null:""===e.value&&this.required?(n.addClass("error"),n.find(".help-inline").text(i.t(l[t])),!1):"confirmPassword"===t&&e.value!==e.form.password.value?(n.addClass("error"),n.find(".help-inline").text(i.t(l.confirmPasswordMatch)),!1):(n.removeClass("error"),n.find(".help-inline").text(""),!0)
},validateAll:function(){var e=!0,t=0;for(var i in l){var n=this.$("input[name="+i+"]")[0];if(n){var a=this.validate(n);a===!0?t++:a===!1&&(e=!1)}}return e},signInServer:function(e,i){if(this.validateAll()){n.get("myPlex");var a={account:this.model,attributes:{username:e,password:i}};this.trigger("start:spinner"),a.success=_.bind(function(){this.signInUser(e,i)},this),a.error=_.bind(function(){this.trigger("stop:spinner")},this),t.trigger("command:ServerSignIn",a)}},signUpServer:function(e,i,a){if(this.validateAll()){n.get("myPlex");
var s={account:this.model,attributes:{username:e,email:i,password:a}};this.trigger("start:spinner"),s.success=_.bind(function(){this.signInUser(e,a)},this),s.error=_.bind(function(){this.trigger("stop:spinner")},this),t.trigger("command:ServerSignUp",s)}},signInUser:function(e,i){var a=n.get("myPlex");if(a.get("signedIn"))return this.publish(),void 0;var s={username:e,password:i,silent:!0,noRedirect:!0};s.success=_.bind(this.publish,this),s.error=_.bind(function(){this.trigger("stop:spinner")}),t.trigger("command:SignIn",s)
},publish:function(){this.publishing=!0,this.render();var e={server:this.model.server,value:!0};e.success=_.bind(function(){this.model.fetch({hideLoadingAlert:!0})},this),e.error=_.bind(function(){this.trigger("stop:spinner")}),this.trigger("start:spinner"),t.trigger("command:PublishServer",e)},unpublish:function(){this.unpublishing=!0,this.render();var e={server:this.model.server,value:!1};e.success=_.bind(function(){this.model.fetch({hideLoadingAlert:!0})},this),e.error=_.bind(function(){this.trigger("stop:spinner")
}),this.trigger("start:spinner"),t.trigger("command:PublishServer",e)},retry:function(){this.publishing=!0,this.render();var e={server:this.model.server,value:!1};e.error=_.bind(function(){this.trigger("stop:spinner")}),e.success=_.bind(function(){setTimeout(_.bind(function(){e.value=!0,e.success=_.bind(function(){this.model.fetch({hideLoadingAlert:!0})},this),t.trigger("command:PublishServer",e)},this),5e3)},this),this.trigger("start:spinner"),t.trigger("command:PublishServer",e)},onAccountChange:function(){this.render(),this.update()
},onInputBlur:function(e){this.validate(e.target)},onChangeFormClick:function(e){e.preventDefault(),this.$("h3, .change-form-btn, .email-group, .confirmPassword-group, .forgot-password-btn").toggleClass("hide")},onSignOutClick:function(e){var i={account:this.model},n=r(e.target);n.hasClass("active")||(n.spinContents("tiny"),i.success=_.bind(function(){this.model.fetch({hideLoadingAlert:!0}).always(function(){n.spinContents(!1)})},this),i.error=_.bind(function(){n.spinContents(!1)},this),t.trigger("command:ServerSignOut",i))
},onPublishClick:function(){this.publish()},onUnpublishClick:function(){this.unpublish()},onRetryClick:function(){this.retry()}});return o}),define("plex/desktop/view/server/settings/MyPlexSettingsView",["hb!templates/desktop/server/settings/MyPlexSettingsView.tpl","plex/base/model/AppModel","plex/base/view/BaseView","plex/desktop/view/server/settings/MyPlexConnectView","jquery","spin"],function(e,t,i,n,a){var s=i.extend({id:"myplex",className:"preferences-group myplex-container",mappingModePref:null,mappingPortPref:null,allowedNetworksPref:null,connectView:null,events:{"click .change-form-btn":"onChangeFormClick","click .submit-btn":"onSubmitClick","change input[name=ManualPortMappingMode]":"onManualModeChange","change input[name=ManualPortMappingPort]":"onManualPortChange","change input[name=require-authentication]":"onRequireAuthenticationChange"},initialize:function(){var e=this.model.server.get("preferences");
this.mappingModePref=e.get("ManualPortMappingMode"),this.mappingPortPref=e.get("ManualPortMappingPort"),this.allowedNetworksPref=e.get("allowedNetworks"),this.connectView=new n({model:this.model,required:!0,dark:!0}),this.addBinding(this.connectView,"start:spinner",this.onSpinnerStart),this.addBinding(this.connectView,"stop:spinner",this.onSpinnerStop),this.addBinding(this.model,"change:signInState",this.onSignInStateChange),this.addBinding(this.model,"change:mappingState",this.onMappingStateChange),this.addBinding(e,"reset",this.onPreferencesReset),this.model.fetch({hideLoadingAlert:!0}),e.populate({hideLoadingAlert:!0})
},render:function(){var i=this.$(".advanced-pref:first"),n={myPlex:t.get("myPlex").toJSON(),showActions:"ok"!==this.model.get("signInState"),showManual:"failed"===this.model.get("mappingState")};return this.mappingModePref&&(n.showMappingMode=!0,n.mappingMode=this.mappingModePref.toJSON(),_.isString(n.mappingMode.value)&&(n.mappingMode.value="true"===n.mappingMode.value)),this.mappingPortPref&&(n.mappingPort=this.mappingPortPref.toJSON()),this.allowedNetworksPref&&(n.allowedNetworks=this.allowedNetworksPref.toJSON()),i.length&&!i.hasClass("hide")&&(n.showAdvanced=!0),this.$el.html(e(n)),this.$el.prepend(this.connectView.render().el),this.connectView.delegateEvents(),this
},savePreference:function(e){this.mappingModePref.save(e).done(_.bind(function(){_.delay(_.bind(function(){this.model.fetch({hideLoadingAlert:!0})},this),5e3)},this))},onSpinnerStart:function(){this.$(".submit-btn").spinContents("small")},onSpinnerStop:function(){this.$(".submit-btn").spinContents(!1)},onSignInStateChange:function(e,t){"ok"===t?this.$(".form-actions").addClass("hide"):this.$(".form-actions").removeClass("hide")},onMappingStateChange:function(e,t){"failed"===t&&this.$(".manual-port-group").removeClass("advanced-pref hide")
},onPreferencesReset:function(e){this.mappingModePref=e.get("ManualPortMappingMode"),this.mappingPortPref=e.get("ManualPortMappingPort"),this.allowedNetworksPref=e.get("allowedNetworks"),this.render()},onChangeFormClick:function(e){e.preventDefault(),this.$(".submit-btn").toggleClass("hide")},onSubmitClick:function(e){if(e.preventDefault(),!this.$(".submit-btn").hasClass("active")){var t=this.$("#username").val(),i=this.$("#password").val();if(this.$(".confirmPassword-group").hasClass("hide"))this.connectView.signInServer(t,i);
else{var n=this.$("#email").val(),a=this.$("#confirmPassword").val();this.connectView.signUpServer(t,n,i,a)}}},onManualModeChange:function(e){var t=e.currentTarget,i={},n=t.value;t.checked||(n="0"),i[t.name]=n,this.mappingModePref.set("value",t.checked),this.savePreference(i)},onManualPortChange:function(e){var t=e.currentTarget,i={};i[t.name]=t.value,this.mappingPortPref.set("value",t.value),this.savePreference(i)},onRequireAuthenticationChange:function(e){var t=a(e.currentTarget).prop("checked"),i={},n=t?"127.0.0.1/255.255.255.255":"";
i.allowedNetworks=n,this.allowedNetworksPref.set("value",n),this.savePreference(i),this.trigger("change:allowedNetworks",n)}});return s}),define("hb!templates/desktop/server/settings/AgentsSettingsView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t,n){var a,s,l,o="";return o+='\n		<li class="',l={hash:{},inverse:d.noop,fn:d.program(2,r,t),data:t},a=i.if_eq||n.if_eq,s=a?a.call(e,n.activeSection,e.key,l):h.call(e,"if_eq",n.activeSection,e.key,l),(s||0===s)&&(o+=s),o+='"><a href="#',(s=i.key)?s=s.call(e,{hash:{},data:t}):(s=e.key,s=typeof s===u?s.apply(e):s),o+=p(s)+'">',l={hash:{},data:t},o+=p((a=i.t||e.t,a?a.call(e,e.label,l):h.call(e,"t",e.label,l)))+"</a></li>\n	"
}function r(){return"active"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var l,o,c="",d=this,h=i.helperMissing,u="function",p=this.escapeExpression;return c+='<ul class="agent-sections-nav nav nav-pills">\n	',l=i.each.call(t,t.sections,{hash:{},inverse:d.noop,fn:d.programWithDepth(1,s,a,t),data:a}),(l||0===l)&&(c+=l),c+='\n</ul>\n\n<div class="agent-details">\n	<p class="help-block">',o={hash:{},data:a},c+=p((l=i.t||t.t,l?l.call(t,"Select which additional agents should contribute to metadata from {1}, and drag them to change the order of preference.","<span class='agent-name'></span>",o):h.call(t,"t","Select which additional agents should contribute to metadata from {1}, and drag them to change the order of preference.","<span class='agent-name'></span>",o)))+"</p>\n</div>\n"
})}),define("hb!templates/desktop/lists/preferences/items/AgentListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var s,r="",l="function",o=this.escapeExpression;return r+='<a data-identifier="',(s=i.identifier)?s=s.call(t,{hash:{},data:a}):(s=t.identifier,s=typeof s===l?s.apply(t):s),r+=o(s)+'" href="#">',(s=i.name)?s=s.call(t,{hash:{},data:a}):(s=t.name,s=typeof s===l?s.apply(t):s),r+=o(s)+"</a>\n"})}),define("plex/desktop/view/lists/preferences/items/AgentListItem",["hb!templates/desktop/lists/preferences/items/AgentListItem.tpl","plex/base/control/Dispatcher","plex/base/view/BaseView"],function(e,t,i){var n=i.extend({tagName:"li",active:!1,initialize:function(e){e.list.collection.first().id===this.model.id&&(this.active=!0),this.addBinding(this.model,"change",this.render)
},render:function(){return this.$el.html(e(this.model.toJSON())),this.active&&this.$el.addClass("active"),this}});return n}),define("plex/desktop/view/lists/preferences/AgentList",["plex/base/view/lists/BaseList","plex/desktop/view/lists/preferences/items/AgentListItem"],function(e,t){var i=e.extend({tagName:"ul",className:"agents-nav nav nav-pills nav-minimal",initialize:function(){this.setup(t),this.collection.populate()},render:function(){return this.$el.empty(),this.populate(this.collection),this
}});return i}),define("hb!templates/desktop/lists/preferences/items/SortableAgentListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a,s="";return s+='\n		<a class="sortable-btn info-btn" rel="tooltip" title="',a={hash:{},data:t},s+=p((n=i.t||e.t,n?n.call(e,"Agent Info",a):u.call(e,"t","Agent Info",a)))+'" href="#">\n			<i class="glyphicon circle-info"></i>\n		</a>\n	'}function r(e,t){var n,a,s="";return s+='\n		<a class="sortable-btn settings-btn" rel="tooltip" title="',a={hash:{},data:t},s+=p((n=i.t||e.t,n?n.call(e,"Agent Settings",a):u.call(e,"t","Agent Settings",a)))+'" href="#">\n			<i class="glyphicon cogwheel"></i>\n		</a>\n	'
}function l(){return"checked"}function o(){return"disabled"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var c,d,h="",u=i.helperMissing,p=this.escapeExpression,f=this,m="function";return h+='<div class="sortable">\n	',c=i["if"].call(t,t.attribution,{hash:{},inverse:f.noop,fn:f.program(1,s,a),data:a}),(c||0===c)&&(h+=c),h+="\n\n	",c=i["if"].call(t,t.hasPrefs,{hash:{},inverse:f.noop,fn:f.program(3,r,a),data:a}),(c||0===c)&&(h+=c),h+='\n\n	<i class="sortable-icon glyphicon show-lines"></i>\n	<label class="sortable-label" for="',(c=i.identifier)?c=c.call(t,{hash:{},data:a}):(c=t.identifier,c=typeof c===m?c.apply(t):c),h+=p(c)+'">\n		<input id="',(c=i.identifier)?c=c.call(t,{hash:{},data:a}):(c=t.identifier,c=typeof c===m?c.apply(t):c),h+=p(c)+'" name="',(c=i.identifier)?c=c.call(t,{hash:{},data:a}):(c=t.identifier,c=typeof c===m?c.apply(t):c),h+=p(c)+'" type="checkbox"  ',c=i["if"].call(t,t.enabled,{hash:{},inverse:f.noop,fn:f.program(5,l,a),data:a}),(c||0===c)&&(h+=c),h+=" ",c=i["if"].call(t,t.primary,{hash:{},inverse:f.noop,fn:f.program(7,o,a),data:a}),(c||0===c)&&(h+=c),h+="> ",d={hash:{},data:a},h+=p((c=i.t||t.t,c?c.call(t,t.name,d):u.call(t,"t",t.name,d)))+"\n	</label>\n</div>\n"
})}),define("hb!templates/desktop/modals/ChannelSettingsModal.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a;return a={hash:{},data:t},C((n=i.t||e.t,n?n.call(e,"Directory",a):S.call(e,"t","Directory",a)))}function r(e,t){var n,a;return a=i["if"].call(e,(n=e.channel,null==n||n===!1?n:n.title),{hash:{},inverse:A.program(6,o,t),fn:A.program(4,l,t),data:t}),a||0===a?a:""}function l(e){var t;return C((t=e.channel,t=null==t||t===!1?t:t.title,typeof t===_?t.apply(e):t))
}function o(e){var t;return C((t=e.channel,t=null==t||t===!1?t:t.name,typeof t===_?t.apply(e):t))}function c(e,t){var n,a,s,r="";return r+="\n			",s={hash:{},inverse:A.program(12,u,t),fn:A.program(9,d,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,e.type,"bool",s):S.call(e,"if_eq",e.type,"bool",s),(a||0===a)&&(r+=a),r+="\n		"}function d(e,t){var n,a,s="";return s+='\n				<label class="checkbox" for="input_',(n=i.id)?n=n.call(e,{hash:{},data:t}):(n=e.id,n=typeof n===_?n.apply(e):n),s+=C(n)+'">\n					<input id="input_',(n=i.id)?n=n.call(e,{hash:{},data:t}):(n=e.id,n=typeof n===_?n.apply(e):n),s+=C(n)+'" type="checkbox" value="true" class="input-dark" name="',(n=i.id)?n=n.call(e,{hash:{},data:t}):(n=e.id,n=typeof n===_?n.apply(e):n),s+=C(n)+'"',n=i["if"].call(e,e.value,{hash:{},inverse:A.noop,fn:A.program(10,h,t),data:t}),(n||0===n)&&(s+=n),s+="> &nbsp;",a={hash:{},data:t},s+=C((n=i.t||e.t,n?n.call(e,e.label,a):S.call(e,"t",e.label,a)))+"\n				</label>\n			"
}function h(){return' checked="checked"'}function u(e,t){var n,a,s,r="";return r+='\n				<label class="control-label" for="input_',(n=i.id)?n=n.call(e,{hash:{},data:t}):(n=e.id,n=typeof n===_?n.apply(e):n),r+=C(n)+'">',s={hash:{},data:t},r+=C((n=i.t||e.t,n?n.call(e,e.label,s):S.call(e,"t",e.label,s)))+'</label>\n\n				<div class="controls">\n					',s={hash:{},inverse:A.program(17,g,t),fn:A.program(13,p,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,e.type,"enum",s):S.call(e,"if_eq",e.type,"enum",s),(a||0===a)&&(r+=a),r+="\n				</div>\n			"
}function p(e,t){var n,a="";return a+='\n						<select id="input_',(n=i.id)?n=n.call(e,{hash:{},data:t}):(n=e.id,n=typeof n===_?n.apply(e):n),a+=C(n)+'" class="input-dark span4" name="',(n=i.id)?n=n.call(e,{hash:{},data:t}):(n=e.id,n=typeof n===_?n.apply(e):n),a+=C(n)+'">\n							',n=i.each.call(e,e.values,{hash:{},inverse:A.noop,fn:A.programWithDepth(14,f,t,e),data:t}),(n||0===n)&&(a+=n),a+="\n						</select>\n					"}function f(e,t,n){var a,s,r,l="";return l+='\n								<option value="',(a=i.value)?a=a.call(e,{hash:{},data:t}):(a=e.value,a=typeof a===_?a.apply(e):a),l+=C(a)+'"',r={hash:{},inverse:A.noop,fn:A.program(15,m,t),data:t},a=i.if_eq||e.if_eq,s=a?a.call(e,e.value,n.value,r):S.call(e,"if_eq",e.value,n.value,r),(s||0===s)&&(l+=s),l+=">",r={hash:{},data:t},l+=C((a=i.t||e.t,a?a.call(e,e.label,r):S.call(e,"t",e.label,r)))+"</option>\n							"
}function m(){return' selected="selected"'}function g(e,t){var n,a,s,r="";return r+='\n						<input id="input_',(n=i.id)?n=n.call(e,{hash:{},data:t}):(n=e.id,n=typeof n===_?n.apply(e):n),r+=C(n)+'" type="',s={hash:{},inverse:A.program(20,y,t),fn:A.program(18,v,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,e.option,"hidden",s):S.call(e,"if_eq",e.option,"hidden",s),(a||0===a)&&(r+=a),r+='" class="input-dark span4" name="',(a=i.id)?a=a.call(e,{hash:{},data:t}):(a=e.id,a=typeof a===_?a.apply(e):a),r+=C(a)+'" value="',(a=i.value)?a=a.call(e,{hash:{},data:t}):(a=e.value,a=typeof a===_?a.apply(e):a),r+=C(a)+'">\n					'
}function v(){return"password"}function y(){return"text"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var b,w,x,k="",S=i.helperMissing,C=this.escapeExpression,_="function",A=this;return k+='<div class="modal-header">\n	<button type="button" class="close" data-dismiss="modal"><i class="glyphicon remove-2"></i></button>\n	<h3><i class="glyphicon cogwheel"></i> ',x={hash:{},inverse:A.program(3,r,a),fn:A.program(1,s,a),data:a},b=i.if_eq||t.if_eq,w=b?b.call(t,(b=t.channel,null==b||b===!1?b:b.name),"Preferences...",x):S.call(t,"if_eq",(b=t.channel,null==b||b===!1?b:b.name),"Preferences...",x),(w||0===w)&&(k+=w),k+=" ",x={hash:{},data:a},k+=C((b=i.t||t.t,b?b.call(t,"Settings",x):S.call(t,"t","Settings",x)))+'</h3>\n</div>\n\n<form id="channel-preferences-form" class="modal-form">\n	<div class="modal-body minimal-scrollbar">\n		',w=i.each.call(t,t.prefs,{hash:{},inverse:A.noop,fn:A.program(8,c,a),data:a}),(w||0===w)&&(k+=w),k+='\n	</div>\n\n	<div class="modal-footer">\n		<button type="submit" class="btn btn-primary">',x={hash:{},data:a},k+=C((b=i.t||t.t,b?b.call(t,"Save",x):S.call(t,"t","Save",x)))+'</button>\n		<button type="button" class="btn cancel-btn">',x={hash:{},data:a},k+=C((b=i.t||t.t,b?b.call(t,"Cancel",x):S.call(t,"t","Cancel",x)))+"</button>\n	</div>\n</form>\n"
})}),define("plex/desktop/view/modals/ChannelSettingsModal",["hb!templates/desktop/modals/ChannelSettingsModal.tpl","plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel","plex/base/model/collections/PreferenceCollection","plex/base/view/modals/BaseModal","jquery"],function(e,t,i,n,a,s,r){var l=s.extend({name:"channelSettingsModal",className:"modal channel-preferences-modal fade",changes:null,events:{hidden:"close","change input[name]":"onPreferenceChange","change select[name]":"onPreferenceChange","submit form":"onSubmit","click .cancel-btn":"onCancel"},initialize:function(){this.changes={},this.addBinding(this.collection,"reset",this.render)
},render:function(){return this.$el.html(e({channel:this.model.toJSON(),prefs:this.collection.toJSON()})).modal(),this},close:function(){this.trigger("close",!1),s.prototype.close.apply(this,arguments)},onPreferenceChange:function(e){var t=e.currentTarget,i=t.value;"checkbox"!=t.type||t.checked||(i="0"),this.changes[t.name]=i},onSubmit:function(e){if(_.isEmpty(this.changes))return this.onCancel(e);e.preventDefault();var t=this.collection.first(),a=t.getSaveParams(this.changes),s=_.isFunction(this.collection.url)?this.collection.url():this.collection.url,l=s+"/set?"+r.param(a);
r.ajax(t.server.getAjaxOptions(l)).done(_.bind(function(){_.each(this.changes,function(e,t){var i=this.collection.get(t),n=i.get("type");"bool"==n?i.set("value","0"!==e):"int"==n?i.set("value",parseInt(e,10)):i.set("value",e)},this),this.$el.modal("hide"),this.trigger("close",!0)},this)).fail(function(){n.set("alert",{status:"error",message:i.t("There was a problem saving your channel settings.")})})},onCancel:function(e){e.preventDefault(),this.$el.modal("hide")}});return l}),define("hb!templates/desktop/modals/AgentInfoModal.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};
var s,r="",l="function",o=this.escapeExpression;return r+='<div class="modal-header">\n	<button type="button" class="close" data-dismiss="modal"><i class="glyphicon remove-2"></i></button>\n	<h3><i class="glyphicon circle-info"></i> ',(s=i.name)?s=s.call(t,{hash:{},data:a}):(s=t.name,s=typeof s===l?s.apply(t):s),r+=o(s)+'</h3>\n</div>\n\n<div class="modal-body minimal-scrollbar">\n	<p class="agent-icon-container"></p>\n\n	<p>',(s=i.attribution)?s=s.call(t,{hash:{},data:a}):(s=t.attribution,s=typeof s===l?s.apply(t):s),(s||0===s)&&(r+=s),r+="</p>\n</div>\n"
})}),define("plex/desktop/view/modals/AgentInfoModal",["hb!templates/desktop/modals/AgentInfoModal.tpl","plex/base/view/modals/BaseModal","plex/base/view/images/BaseImage"],function(e,t,i){var n=t.extend({name:"agentInfoModal",className:"modal agent-info-modal fade",events:{hidden:"close"},initialize:function(){this.icon=this.registerView(new i({model:this.model,url:"/system/agents/attribution/image?identifier="+this.model.id,className:"agent-icon",transcode:!0,width:100,height:100}))},render:function(){return this.$el.html(e(this.model.toJSON())).modal(),this.$(".agent-icon-container").append(this.icon.render().el),this
}});return n}),define("plex/desktop/view/lists/preferences/items/SortableAgentListItem",["hb!templates/desktop/lists/preferences/items/SortableAgentListItem.tpl","plex/base/control/Dispatcher","plex/base/model/AppModel","plex/base/model/collections/PreferenceCollection","plex/base/view/BaseView","plex/desktop/view/modals/ChannelSettingsModal","plex/desktop/view/modals/AgentInfoModal","jquery"],function(e,t,i,n,a,s,r,l){var o=a.extend({tagName:"li",className:"well",events:{"click .settings-btn":"onSettingsClick","click .info-btn":"onInfoClick"},initialize:function(){this.addBinding(this.model,"change",this.render)
},render:function(){return this.$el.html(e(this.model.toJSON())),this.$el.tooltip({selector:".sortable-btn",placement:"bottom"}),this},onSettingsClick:function(e){e.preventDefault();var t=new n([],{server:this.model.server,url:"/:/plugins/"+this.model.id+"/prefs"});t.fetch().done(_.bind(function(){i.set("modal",new s({model:this.model,collection:t}))},this)),l(".tooltip").remove()},onInfoClick:function(e){e.preventDefault(),i.set("modal",new r({model:this.model})),l(".tooltip").remove()}});return o
}),function(e){var t,i=e();e.fn.sortable=function(n){var a=n+"";return n=e.extend({connectWith:!1},n),this.each(function(){if(/^enable|disable|destroy$/.test(a)){var s=e(this).children(e(this).data("items")).attr("draggable","enable"==a);return"destroy"==a&&s.add(this).removeData("connectWith items").off("dragstart.h5s dragend.h5s selectstart.h5s dragover.h5s dragenter.h5s drop.h5s"),void 0}var r,l,s=e(this).children(n.items),o=e("<"+(/^ul|ol$/i.test(this.tagName)?"li":"div")+' class="sortable-placeholder">');
s.find(n.handle).mousedown(function(){r=!0}).mouseup(function(){r=!1}),e(this).data("items",n.items),i=i.add(o),n.connectWith&&e(n.connectWith).add(this).data("connectWith",n.connectWith),s.attr("draggable","true").on("dragstart.h5s",function(i){if(n.handle&&!r)return!1;r=!1;var a=i.originalEvent.dataTransfer;a.effectAllowed="move",a.setData("Text","dummy"),l=(t=e(this)).addClass("sortable-dragging").index()}).on("dragend.h5s",function(){t&&(t.removeClass("sortable-dragging").show(),i.detach(),l!=t.index()&&t.parent().trigger("sortupdate",{item:t}),t=null)
}).not("a[href], img").on("selectstart.h5s",function(){return this.dragDrop&&this.dragDrop(),!1}).end().add([this,o]).on("dragover.h5s dragenter.h5s drop.h5s",function(a){return s.is(t)||n.connectWith===e(t).parent().data("connectWith")?"drop"==a.type?(a.stopPropagation(),i.filter(":visible").after(t),t.trigger("dragend.h5s"),!1):(a.preventDefault(),a.originalEvent.dataTransfer.dropEffect="move",s.is(this)?(n.forcePlaceholderSize&&o.height(t.outerHeight()),t.hide(),e(this)[o.index()<e(this).index()?"after":"before"](o),i.not(o).detach()):i.is(this)||e(this).children(n.items).length||(i.detach(),e(this).append(o)),!1):!0
})})}}(jQuery),define("sortable",function(){}),define("plex/desktop/view/lists/preferences/SortableAgentList",["plex/base/view/lists/BaseList","plex/desktop/view/lists/preferences/items/SortableAgentListItem","jquery","sortable"],function(e,t,i){var n=e.extend({tagName:"ul",className:"sortable-list agent-list",events:{"change input[type=checkbox]":"onAgentChecked",sortupdate:"onSortUpdate"},initialize:function(){this.setup(t),this.collection&&this.collection.populate()},render:function(){return this.$el.empty(),this.collection?this.populate(this.collection):this.rendered=!0,this
},reset:function(t){this.rendered&&(e.prototype.reset.call(this,t),this.$el.sortable(),this.delegateEvents())},save:function(){var e="";this.$("input[type=checkbox]").each(function(){var t=i(this),n=t.prop("checked");n&&(e+=this.name+",")}),e=e.substring(0,e.length-1),this.trigger("save",e)},onAgentChecked:function(){this.save()},onSortUpdate:function(){this.save()}});return n}),define("plex/desktop/view/server/settings/AgentsSettingsView",["hb!templates/desktop/server/settings/AgentsSettingsView.tpl","plex/base/model/collections/AgentCollection","plex/base/view/BaseView","plex/desktop/view/lists/preferences/AgentList","plex/desktop/view/lists/preferences/SortableAgentList","jquery"],function(e,t,i,n,a,s){var r=[{key:"movies",typeID:1,label:"Movies"},{key:"tv",typeID:2,label:"TV Shows"},{key:"music",typeID:8,label:"Artists"},{key:"albums",typeID:9,label:"Albums"},{key:"photos",typeID:13,label:"Photos"}],l=_.reduce(r,function(e,t){return e[t.key]=t,e
},{}),o=function(e){return l[e]},c=i.extend({id:"agents",className:"preferences-group agents-container",activeSection:"movies",activeAgent:null,agentList:null,sortableList:null,events:{"click .agent-sections-nav a":"onAgentSectionClick","click .agents-nav a":"onAgentClick"},initialize:function(){var e=this.populateAgents(this.activeSection);this.agentList=this.registerView(new n({collection:e})),this.sortableList=this.registerView(new a({collection:null})),this.addBinding(this.sortableList,"save",this.onSaveOrder)
},render:function(){return this.$el.html(e({activeSection:this.activeSection,sections:r})),this.$(".agent-sections-nav").after(this.agentList.render().el),this.$(".agent-details").append(this.sortableList.render().el),this},populateAgents:function(e){var i=o(e);return i.agents||(i.agents=new t([],{server:this.model,sectionType:i.typeID})),i.agents.populate().done(_.bind(function(){this.selectAgent(i.agents.first())},this)),i.agents},selectAgent:function(e){this.$(".agent-name").text(e.get("name")),this.activeAgent=e,this.populateAdditionalAgents(e)
},populateAdditionalAgents:function(e){var i=o(this.activeSection),n=new t([],{server:this.model,sectionType:i.typeID,relatedAgent:e.id}),a=new t([],{server:this.model,sectionType:i.typeID,primaryAgent:e.id}),s=n.fetch().pipe(function(){return a.fetch()});s=s.pipe(_.bind(function(){var i=function(t){return t.id===e.id?(t.set("primary",!0),!0):a.get(t.id)?!0:!1};this.sortableList.rebase(new t(n.filter(i),{server:this.model}))},this))},onSaveOrder:function(e){var t=o(this.activeSection);this.activeAgent.url="system/agents/"+this.activeAgent.id+"/config/"+t.typeID,this.activeAgent.save({order:e})
},onAgentSectionClick:function(e){e.preventDefault();var t=s(e.target),i=t.attr("href"),n=i.replace("#","");this.activeSection=n;var a=this.populateAgents(n);this.agentList.rebase(a),this.$(".agent-sections-nav li").removeClass("active"),t.parent("li").addClass("active")},onAgentClick:function(e){e.preventDefault();var t=s(e.target),i=t.data("identifier"),n=this.agentList.collection.get(i);this.selectAgent(n),this.$(".agents-nav li").removeClass("active"),t.parent("li").addClass("active")}});return c
}),define("plex/desktop/view/server/settings/ServerSettingsView",["hb!templates/desktop/server/settings/ServerSettingsView.tpl","plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/control/utils/LanguageUtil","plex/base/model/AppModel","plex/base/model/AccountModel","plex/base/model/PreferenceModel","plex/base/model/ChannelModel","plex/base/model/collections/PreferenceCollection","plex/base/view/BaseView","plex/desktop/view/server/settings/MyPlexSettingsView","plex/desktop/view/server/settings/AgentsSettingsView","plex/desktop/view/modals/ChannelSettingsModal","jquery"],function(e,t,i,n,a,s,r,l,o,c,d,h,u,p){var f=c.extend({id:"media-server-settings",active:!1,disableForm:!1,myPlexSettings:null,agentsSettings:null,events:{"click .preferences-nav a":"onPreferenceGroupClick","click .directory-settings-btn":"onDirectorySettingsClick","change input[name]":"onPreferenceChange","change select[name]":"onPreferenceChange","submit .preferences-form":"onSubmit","click .cancel-btn":"onCancelClick"},orderedGroups:[{id:"general",group:"general",title:"General"},{id:"library",group:"library",title:"Library"},{id:"channels",group:"channels",title:"Channels"},{id:"network",group:"network",title:"Network"},{id:"transcoder",group:"transcoder",title:"Transcoder"},{id:"languages",group:"account.language",title:"Languages"},{id:"dlna",group:"dlna",title:"DLNA"},{id:"bonjour",group:"bonjour",title:"Network Discovery"}],initialize:function(e){this.changes={},this.active=e.active,this.myPlexSettings=this.registerView(new d({model:this.model.get("myPlexAccount")})),this.agentsSettings=this.registerView(new h({model:this.model})),this.addBinding(this.myPlexSettings,"change:allowedNetworks",this.onAllowedNetworksChange),this.prefs=this.model.get("preferences"),this.addBinding(this.prefs,"reset",this.render),this.prefs.populate(),this.account=new s({key:"/accounts/1"},{server:this.model}),this.account.fetch().done(_.bind(this.render,this))
},render:function(){var t="",i=!1,n=this.prefs.get("FriendlyName");n&&!n.get("value")&&(t=n.get("value"),i=!0,n.set("value",this.model.get("name"),{silent:!0}));var a={},s={},r=function(e){if(!e.get("hidden")){var t=e.get("group");a[t]||(a[t]=[]),a[t].push(e.toJSON()),e.get("advanced")||(s[t]=!0)}};this.prefs.each(r),_.each(this.getFakePrefs(),r);var l=_.map(this.orderedGroups,function(e){var t=_.clone(e);return t.prefs=a[e.group],t.advanced=!(e.group in s),delete a[e.group],t},this);_.each(a,function(e,t){l.push({group:t,title:t,prefs:e,advanced:!(t in s)})
});var o={version:this.model.get("version"),groups:l};return i&&n.set("value",t,{silent:!0}),this.$el.html(e(o)),this.active||this.$el.addClass("hide"),this.$(".preferences-group:last").after(this.myPlexSettings.render().el),this.$(".preferences-group:last").after(this.agentsSettings.render().el),this.myPlexSettings.delegateEvents(),this.agentsSettings.delegateEvents(),this.delegateEvents(),this},getFakePrefs:function(){var e=[],t=_.map(n.byCode,function(e,t){return{value:t,label:e}});return e.push(new r({id:"account.autoSelectAudio",label:"Automatically select audio tracks",summary:"Automatically select audio tracks in your preferred language when possible.","default":!1,value:"1"===this.account.get("autoSelectAudio"),type:"bool",group:"account.language",advanced:!1,hidden:!1},{server:this.model})),e.push(new r({id:"account.defaultAudioLanguage",label:"Prefer audio tracks in","default":"en",value:this.account.get("defaultAudioLanguage"),type:"text",group:"account.language",advanced:!1,hidden:!1,enumValues:t},{server:this.model})),e.push(new r({id:"account.subtitleMode",label:"Subtitle mode","default":0,value:parseInt(this.account.get("subtitleMode"),10),type:"int",group:"account.language",advanced:!1,hidden:!1,enumValues:[{value:"0",label:"Manually selected"},{value:"1",label:"Shown with foreign audio"},{value:"2",label:"Always enabled"}]},{server:this.model})),e.push(new r({id:"account.defaultSubtitleLanguage",label:"Prefer subtitles in","default":"en",value:this.account.get("defaultSubtitleLanguage"),type:"text",group:"account.language",advanced:!1,hidden:!1,enumValues:t},{server:this.model})),e
},save:function(e){_.isEmpty(this.changes)&&!e&&t.trigger("navigate:back");var n=[],s="account.",r=!1;_.each(_.keys(this.changes),function(e){0===e.lastIndexOf(s,0)&&(this.account.set(e.substring(s.length),this.changes[e],{silent:!0}),r=!0,delete this.changes[e])},this),r&&n.push(this.account.save()),_.isEmpty(this.changes)||n.push(this.prefs.first().save(this.changes)),p.when.apply(p,n).done(_.bind(function(){_.each(this.changes,function(e,t){var i=this.prefs.get(t),n=i.get("type");"bool"==n?i.set("value","0"!==e):"int"==n?i.set("value",parseInt(e,10)):i.set("value",e)
},this),e||t.trigger("navigate:back")},this)).fail(function(){a.set("alert",{status:"error",message:i.t("There was a problem saving your server settings.")})})},onAllowedNetworksChange:function(e){this.$("input[name=allowedNetworks]").val(e)},onPreferenceGroupClick:function(e){e.preventDefault();var t=p(e.target),i=t.attr("href");this.$(".preferences-group").removeClass("active"),this.$(i).addClass("active"),"#myplex"===i||"#agents"===i?(this.disableForm=!0,this.$(".main-actions").addClass("hide")):(this.disableForm=!1,this.$(".main-actions").removeClass("hide")),this.$(".preferences-nav li").removeClass("active"),t.parent("li").addClass("active")
},onDirectorySettingsClick:function(e){e.preventDefault();var t=new l({key:"/system/:/prefs",name:"Preferences..."},{server:this.model}),i=new o([],{server:this.model,url:t.id});i.fetch().done(_.bind(function(){a.set("modal",new u({model:t,collection:i}))},this))},onPreferenceChange:function(e){if(!this.disableForm){var t=e.currentTarget,i=t.value;"checkbox"!=t.type||t.checked||(i="0"),this.changes[t.name]=i}},onSubmit:function(e){e.preventDefault(),this.disableForm||this.save()},onCancelClick:function(e){e.preventDefault(),t.trigger("navigate:back")
}});return f}),define("hb!templates/desktop/server/settings/PlexWebSettingsView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n;return n=i.unless.call(e,e.disableUpdates,{hash:{},inverse:I.noop,fn:I.program(2,r,t),data:t}),n||0===n?n:""}function r(e,t){var n,a,s,r="";return r+='\n						<span class="muted">&middot;</span>\n\n						<a class="check-updates-btn ',s={hash:{},inverse:I.noop,fn:I.program(3,l,t),data:t},n=i.if_neq||e.if_neq,a=n?n.call(e,e.updateStatus,"none",s):T.call(e,"if_neq",e.updateStatus,"none",s),(a||0===a)&&(r+=a),r+='" href="#">\n							<i class="glyphicon circle-arrow-top"></i> ',s={hash:{},data:t},r+=M((n=i.t||e.t,n?n.call(e,"Check for Updates",s):T.call(e,"t","Check for Updates",s)))+'\n						</a>\n\n						<a class="download-updates-btn ',s={hash:{},inverse:I.noop,fn:I.program(3,l,t),data:t},n=i.if_neq||e.if_neq,a=n?n.call(e,e.updateStatus,"download",s):T.call(e,"if_neq",e.updateStatus,"download",s),(a||0===a)&&(r+=a),r+='" href="#">\n							<i class="glyphicon circle-arrow-down"></i> ',s={hash:{},data:t},r+=M((n=i.t||e.t,n?n.call(e,"Download Updates",s):T.call(e,"t","Download Updates",s)))+'\n						</a>\n\n						<a class="reload-updates-btn ',s={hash:{},inverse:I.noop,fn:I.program(3,l,t),data:t},n=i.if_neq||e.if_neq,a=n?n.call(e,e.updateStatus,"reload",s):T.call(e,"if_neq",e.updateStatus,"reload",s),(a||0===a)&&(r+=a),r+='" href="#">\n							<i class="glyphicon refresh"></i> ',s={hash:{},data:t},r+=M((n=i.t||e.t,n?n.call(e,"Refresh to Apply Changes",s):T.call(e,"t","Refresh to Apply Changes",s)))+'\n						</a>\n\n						<span class="latest-updates ',s={hash:{},inverse:I.noop,fn:I.program(3,l,t),data:t},n=i.if_neq||e.if_neq,a=n?n.call(e,e.updateStatus,"latest",s):T.call(e,"if_neq",e.updateStatus,"latest",s),(a||0===a)&&(r+=a),r+='">\n							<i class="glyphicon ok-2"></i> ',s={hash:{},data:t},r+=M((n=i.t||e.t,n?n.call(e,"Plex/Web is up to date.",s):T.call(e,"t","Plex/Web is up to date.",s)))+"\n						</span>\n					"
}function l(){return"hide"}function o(e,t,n){var a,s,r,l="";return l+='\n							<option value="',(a=i.value)?a=a.call(e,{hash:{},data:t}):(a=e.value,a=typeof a===P?a.apply(e):a),l+=M(a)+'" ',r={hash:{},inverse:I.noop,fn:I.program(6,c,t),data:t},a=i.if_eq||e.if_eq,s=a?a.call(e,e.value,(a=n.settings,null==a||a===!1?a:a.language),r):T.call(e,"if_eq",e.value,(a=n.settings,null==a||a===!1?a:a.language),r),(s||0===s)&&(l+=s),l+=">\n								",(s=i.name)?s=s.call(e,{hash:{},data:t}):(s=e.name,s=typeof s===P?s.apply(e):s),l+=M(s)+"\n							</option>\n						"
}function c(){return"selected"}function d(){return"checked"}function h(e,t,n){var a,s,r,l="";return l+='\n							<option value="',(a=i.value)?a=a.call(e,{hash:{},data:t}):(a=e.value,a=typeof a===P?a.apply(e):a),l+=M(a)+'"',r={hash:{},inverse:I.noop,fn:I.program(11,u,t),data:t},a=i.if_eq||e.if_eq,s=a?a.call(e,e.value,(a=n.settings,null==a||a===!1?a:a.debugLevel),r):T.call(e,"if_eq",e.value,(a=n.settings,null==a||a===!1?a:a.debugLevel),r),(s||0===s)&&(l+=s),l+=">",r={hash:{},data:t},l+=M((a=i.t||e.t,a?a.call(e,e.label,r):T.call(e,"t",e.label,r)))+"</option>\n						"
}function u(){return" selected"}function p(e,t){var n,a,s,r="";return r+='\n				<h3><i class="glyphicon adjust-alt"></i> ',s={hash:{},data:t},r+=M((n=i.t||e.t,n?n.call(e,"Streaming Quality",s):T.call(e,"t","Streaming Quality",s)))+'</h3>\n\n				<div class="control-group pull-left">\n					<label class="control-label" for="quality">',s={hash:{},data:t},r+=M((n=i.t||e.t,n?n.call(e,"Local Quality",s):T.call(e,"t","Local Quality",s)))+'</label>\n					<div class="controls">\n						<select id="quality" name="quality" data-type="int">\n							',a=i.each.call(e,e.videoQualities,{hash:{},inverse:I.noop,fn:I.programWithDepth(14,f,t,e),data:t}),(a||0===a)&&(r+=a),r+='\n						</select>\n					</div>\n				</div>\n\n				<div class="control-group">\n					<label class="control-label" for="remoteQuality">',s={hash:{},data:t},r+=M((n=i.t||e.t,n?n.call(e,"Remote Quality",s):T.call(e,"t","Remote Quality",s)))+'</label>\n					<div class="controls">\n						<select id="remoteQuality" name="remoteQuality" data-type="int">\n							',a=i.each.call(e,e.videoQualities,{hash:{},inverse:I.noop,fn:I.programWithDepth(19,v,t,e),data:t}),(a||0===a)&&(r+=a),r+="\n						</select>\n					</div>\n				</div>\n			"
}function f(e,t,n){var a,s,r,l="";return l+='\n								<option value="'+M((a=e[0],typeof a===P?a.apply(e):a))+'" ',r={hash:{},inverse:I.noop,fn:I.program(6,c,t),data:t},a=i.if_eq||e.if_eq,s=a?a.call(e,e[0],(a=n.settings,null==a||a===!1?a:a.quality),r):T.call(e,"if_eq",e[0],(a=n.settings,null==a||a===!1?a:a.quality),r),(s||0===s)&&(l+=s),l+=">\n									",r={hash:{},inverse:I.program(17,g,t),fn:I.program(15,m,t),data:t},a=i.if_eq||e.if_eq,s=a?a.call(e,e[1],1500,r):T.call(e,"if_eq",e[1],1500,r),(s||0===s)&&(l+=s),l+=", "+M((a=e[2],typeof a===P?a.apply(e):a))+"p\n								</option>\n							"
}function m(e,t){var n,a;return a={hash:{},data:t},M((n=i.formatBitrate||e.formatBitrate,n?n.call(e,e[1],1,a):T.call(e,"formatBitrate",e[1],1,a)))}function g(e,t){var n,a;return a={hash:{},data:t},M((n=i.formatBitrate||e.formatBitrate,n?n.call(e,e[1],0,a):T.call(e,"formatBitrate",e[1],0,a)))}function v(e,t,n){var a,s,r,l="";return l+='\n								<option value="'+M((a=e[0],typeof a===P?a.apply(e):a))+'" ',r={hash:{},inverse:I.noop,fn:I.program(6,c,t),data:t},a=i.if_eq||e.if_eq,s=a?a.call(e,e[0],(a=n.settings,null==a||a===!1?a:a.remoteQuality),r):T.call(e,"if_eq",e[0],(a=n.settings,null==a||a===!1?a:a.remoteQuality),r),(s||0===s)&&(l+=s),l+=">\n									",r={hash:{},inverse:I.program(17,g,t),fn:I.program(15,m,t),data:t},a=i.if_eq||e.if_eq,s=a?a.call(e,e[1],1500,r):T.call(e,"if_eq",e[1],1500,r),(s||0===s)&&(l+=s),l+=", "+M((a=e[2],typeof a===P?a.apply(e):a))+"p\n								</option>\n							"
}function y(e,t){var n,a,s,r="";return r+='\n				<div class="control-group advanced-pref hide">\n					<label class="checkbox" for="preferAAC">\n						<input id="preferAAC" name="preferAAC" type="checkbox" class="input-dark" ',a=i["if"].call(e,(n=e.settings,null==n||n===!1?n:n.preferAAC),{hash:{},inverse:I.noop,fn:I.program(8,d,t),data:t}),(a||0===a)&&(r+=a),r+="> &nbsp;",s={hash:{},data:t},r+=M((n=i.t||e.t,n?n.call(e,"Prefer AAC Audio",s):T.call(e,"t","Prefer AAC Audio",s)))+'\n					</label>\n					<p class="help-block">',s={hash:{},data:t},r+=M((n=i.t||e.t,n?n.call(e,"Prefer AAC over MP3 when transcoding audio. Some devices, like the Wii U, only support HLS with AAC audio.",s):T.call(e,"t","Prefer AAC over MP3 when transcoding audio. Some devices, like the Wii U, only support HLS with AAC audio.",s)))+'</p>\n				</div>\n\n				<div class="control-group pull-left">\n					<label class="control-label" for="subtitleSize">',s={hash:{},data:t},r+=M((n=i.t||e.t,n?n.call(e,"Subtitle Size",s):T.call(e,"t","Subtitle Size",s)))+'</label>\n					<div class="controls">\n						<select id="subtitleSize" name="subtitleSize" data-type="int">\n							',a=i.each.call(e,e.subtitleSizes,{hash:{},inverse:I.noop,fn:I.programWithDepth(22,b,t,e),data:t}),(a||0===a)&&(r+=a),r+='\n						</select>\n					</div>\n				</div>\n\n				<div class="control-group">\n					<label class="control-label" for="audioBoost">',s={hash:{},data:t},r+=M((n=i.t||e.t,n?n.call(e,"Audio Boost",s):T.call(e,"t","Audio Boost",s)))+'</label>\n					<div class="controls">\n						<select id="audioBoost" name="audioBoost" data-type="int">\n							',a=i.each.call(e,e.audioLevels,{hash:{},inverse:I.noop,fn:I.programWithDepth(24,w,t,e),data:t}),(a||0===a)&&(r+=a),r+="\n						</select>\n					</div>\n				</div>\n			"
}function b(e,t,n){var a,s,r,l="";return l+='\n								<option value="',(a=i.value)?a=a.call(e,{hash:{},data:t}):(a=e.value,a=typeof a===P?a.apply(e):a),l+=M(a)+'"',r={hash:{},inverse:I.noop,fn:I.program(11,u,t),data:t},a=i.if_eq||e.if_eq,s=a?a.call(e,e.value,(a=n.settings,null==a||a===!1?a:a.subtitleSize),r):T.call(e,"if_eq",e.value,(a=n.settings,null==a||a===!1?a:a.subtitleSize),r),(s||0===s)&&(l+=s),l+=">",r={hash:{},data:t},l+=M((a=i.t||e.t,a?a.call(e,e.label,r):T.call(e,"t",e.label,r)))+"</option>\n							"
}function w(e,t,n){var a,s,r,l="";return l+='\n								<option value="',(a=i.value)?a=a.call(e,{hash:{},data:t}):(a=e.value,a=typeof a===P?a.apply(e):a),l+=M(a)+'"',r={hash:{},inverse:I.noop,fn:I.program(11,u,t),data:t},a=i.if_eq||e.if_eq,s=a?a.call(e,e.value,(a=n.settings,null==a||a===!1?a:a.audioBoost),r):T.call(e,"if_eq",e.value,(a=n.settings,null==a||a===!1?a:a.audioBoost),r),(s||0===s)&&(l+=s),l+=">",r={hash:{},data:t},l+=M((a=i.t||e.t,a?a.call(e,e.label,r):T.call(e,"t",e.label,r)))+"</option>\n							"
}function x(){return'\n				<div class="plex-pass-restricted-container">\n					<div class="plex-pass-restricted">\n			'}function k(e,t){var n,a,s="";return s+='\n					</div>\n\n					<div class="plex-pass-message-overlay">\n						<div class="empty-message plex-pass-message">\n							',a={hash:{},data:t},s+=M((n=i.t||e.t,n?n.call(e,"Sorry, you need a <a href='{1}' target='_blank'>PlexPass subscription</a> for this feature.","https://my.plexapp.com/subscription/about",a):T.call(e,"t","Sorry, you need a <a href='{1}' target='_blank'>PlexPass subscription</a> for this feature.","https://my.plexapp.com/subscription/about",a)))+"\n						</div>\n					</div>\n				</div>\n			"
}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var S,C,_,A="",I=this,T=i.helperMissing,M=this.escapeExpression,P="function";return A+='<ul class="preferences-nav nav nav-list">\n	<li class="active"><a href="#general">',_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"General",_):T.call(t,"t","General",_)))+'</a></li>\n	<li class="advanced-prefs hide"><a href="#debug">',_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Debug",_):T.call(t,"t","Debug",_)))+'</a></li>\n	<li><a href="#dashboard">',_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Dashboard",_):T.call(t,"t","Dashboard",_)))+'</a></li>\n	<li><a href="#search">',_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Search",_):T.call(t,"t","Search",_)))+'</a></li>\n	<li><a href="#player">',_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Player",_):T.call(t,"t","Player",_)))+'</a></li>\n	<li><a href="#sync">',_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Sync",_):T.call(t,"t","Sync",_)))+'</a></li>\n</ul>\n\n<form class="preferences-form">\n	<fieldset>\n		<div id="general" class="preferences-group active">\n			<h3><i class="glyphicon cogwheel"></i> ',_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"General",_):T.call(t,"t","General",_)))+'</h3>\n\n			<div class="control-group">\n				<label class="control-label">\n					',_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Version",_):T.call(t,"t","Version",_)))+" ",(C=i.version)?C=C.call(t,{hash:{},data:a}):(C=t.version,C=typeof C===P?C.apply(t):C),A+=M(C)+"\n					",C=i.unless.call(t,t.shared,{hash:{},inverse:I.noop,fn:I.program(1,s,a),data:a}),(C||0===C)&&(A+=C),A+='\n				</label>\n				<p class="help-block">',_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,'While Plex Media Server will automatically download updates for Plex/Web periodically, use "Check for Updates" to manually download updates.',_):T.call(t,"t",'While Plex Media Server will automatically download updates for Plex/Web periodically, use "Check for Updates" to manually download updates.',_)))+'</p>\n			</div>\n\n			<div class="control-group">\n				<label class="control-label" for="language">',_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Language",_):T.call(t,"t","Language",_)))+'</label>\n				<div class="controls">\n					<select id="language" name="language">\n						',C=i.each.call(t,t.languages,{hash:{},inverse:I.noop,fn:I.programWithDepth(5,o,a,t),data:a}),(C||0===C)&&(A+=C),A+='\n					</select>\n				</div>\n				<p class="help-block">',_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Help us translate Plex/Web into your language <a href='{1}' target='_blank'>here</a>.","https://getlocalization.com/plexweb",_):T.call(t,"t","Help us translate Plex/Web into your language <a href='{1}' target='_blank'>here</a>.","https://getlocalization.com/plexweb",_)))+'</p>\n			</div>\n\n			<div class="control-group">\n				<label class="checkbox" for="playThemeMusic">\n					<input id="playThemeMusic" name="playThemeMusic" type="checkbox" class="input-dark" ',C=i["if"].call(t,(S=t.settings,null==S||S===!1?S:S.playThemeMusic),{hash:{},inverse:I.noop,fn:I.program(8,d,a),data:a}),(C||0===C)&&(A+=C),A+="> &nbsp;",_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Play Theme Music",_):T.call(t,"t","Play Theme Music",_)))+'\n				</label>\n				<p class="help-block">',_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Automatically play theme music in the background when available.",_):T.call(t,"t","Automatically play theme music in the background when available.",_)))+'</p>\n			</div>\n\n			<div class="control-group">\n				<label class="checkbox" for="showMovieUnwatched">\n					<input id="showMovieUnwatched" name="showMovieUnwatched" type="checkbox" class="input-dark" ',C=i["if"].call(t,(S=t.settings,null==S||S===!1?S:S.showMovieUnwatched),{hash:{},inverse:I.noop,fn:I.program(8,d,a),data:a}),(C||0===C)&&(A+=C),A+="> &nbsp;",_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Show Movie Unwatched Icons",_):T.call(t,"t","Show Movie Unwatched Icons",_)))+'\n				</label>\n				<p class="help-block">',_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Show unwatched icons in movie lists.",_):T.call(t,"t","Show unwatched icons in movie lists.",_)))+'</p>\n			</div>\n\n			<div class="control-group">\n				<label class="checkbox" for="keyboardShortcuts">\n					<input id="keyboardShortcuts" name="keyboardShortcuts" type="checkbox" class="input-dark" ',C=i["if"].call(t,(S=t.settings,null==S||S===!1?S:S.keyboardShortcuts),{hash:{},inverse:I.noop,fn:I.program(8,d,a),data:a}),(C||0===C)&&(A+=C),A+="> &nbsp;",_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Enable Keyboard Shortcuts",_):T.call(t,"t","Enable Keyboard Shortcuts",_)))+'\n				</label>\n				<p class="help-block">',_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Press ? to view the list of <a class='keyboard-shortcuts-btn' href='#'>available shortcuts</a>.",_):T.call(t,"t","Press ? to view the list of <a class='keyboard-shortcuts-btn' href='#'>available shortcuts</a>.",_)))+'</p>\n			</div>\n		</div>\n\n		<div id="debug" class="preferences-group">\n			<h3><i class="glyphicon bug"></i> ',_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Debug",_):T.call(t,"t","Debug",_)))+'</h3>\n\n			<div class="control-group">\n				<label class="control-label" for="debugLevel">',_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Debug Level",_):T.call(t,"t","Debug Level",_)))+'</label>\n				<div class="controls">\n					<select id="debugLevel" name="debugLevel" data-type="int">\n						',C=i.each.call(t,t.debugLevels,{hash:{},inverse:I.noop,fn:I.programWithDepth(10,h,a,t),data:a}),(C||0===C)&&(A+=C),A+='\n					</select>\n				</div>\n			</div>\n		</div>\n\n		<div id="search" class="preferences-group">\n			<h3><i class="glyphicon search"></i> ',_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Search",_):T.call(t,"t","Search",_)))+'</h3>\n\n			<div class="control-group">\n				<label class="checkbox" for="remoteSearch">\n					<input id="remoteSearch" name="remoteSearch" type="checkbox" class="input-dark" ',C=i["if"].call(t,(S=t.settings,null==S||S===!1?S:S.remoteSearch),{hash:{},inverse:I.noop,fn:I.program(8,d,a),data:a}),(C||0===C)&&(A+=C),A+="> &nbsp;",_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Search Remote Libraries",_):T.call(t,"t","Search Remote Libraries",_)))+'\n				</label>\n			</div>\n\n			<div class="control-group">\n				<label class="checkbox" for="channelSearch">\n					<input id="channelSearch" name="channelSearch" type="checkbox" class="input-dark" ',C=i["if"].call(t,(S=t.settings,null==S||S===!1?S:S.channelSearch),{hash:{},inverse:I.noop,fn:I.program(8,d,a),data:a}),(C||0===C)&&(A+=C),A+="> &nbsp;",_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Search Channels",_):T.call(t,"t","Search Channels",_)))+'\n				</label>\n			</div>\n		</div>\n\n		<div id="player" class="preferences-group">\n			',C=i["if"].call(t,t.videoQualities,{hash:{},inverse:I.noop,fn:I.program(13,p,a),data:a}),(C||0===C)&&(A+=C),A+='\n\n			<h3><i class="glyphicon play-button"></i> ',_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Player",_):T.call(t,"t","Player",_)))+'</h3>\n\n			<div class="control-group">\n				<label class="checkbox" for="directPlay">\n					<input id="directPlay" name="directPlay" type="checkbox" class="input-dark" ',C=i["if"].call(t,(S=t.settings,null==S||S===!1?S:S.directPlay),{hash:{},inverse:I.noop,fn:I.program(8,d,a),data:a}),(C||0===C)&&(A+=C),A+="> &nbsp;",_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Direct Play",_):T.call(t,"t","Direct Play",_)))+'\n				</label>\n				<p class="help-block">',_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Allows the player to play compatible media without any conversion. In most browsers, direct play supports MP4 videos with h264 video and AAC audio. Videos with subtitles cannot be played directly.",_):T.call(t,"t","Allows the player to play compatible media without any conversion. In most browsers, direct play supports MP4 videos with h264 video and AAC audio. Videos with subtitles cannot be played directly.",_)))+'</p>\n			</div>\n\n			<div class="control-group">\n				<label class="checkbox" for="directStream">\n					<input id="directStream" name="directStream" type="checkbox" class="input-dark" ',C=i["if"].call(t,(S=t.settings,null==S||S===!1?S:S.directStream),{hash:{},inverse:I.noop,fn:I.program(8,d,a),data:a}),(C||0===C)&&(A+=C),A+="> &nbsp;",_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Direct Stream",_):T.call(t,"t","Direct Stream",_)))+'\n				</label>\n				<p class="help-block">',_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Allows the server to copy compatible audio and video streams without converting them.",_):T.call(t,"t","Allows the server to copy compatible audio and video streams without converting them.",_)))+'</p>\n			</div>\n\n			<div class="control-group">\n				<label class="checkbox" for="highestResolution">\n					<input id="highestResolution" name="highestResolution" type="checkbox" class="input-dark" ',C=i["if"].call(t,(S=t.settings,null==S||S===!1?S:S.highestResolution),{hash:{},inverse:I.noop,fn:I.program(8,d,a),data:a}),(C||0===C)&&(A+=C),A+="> &nbsp;",_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Always Use Highest Resolution",_):T.call(t,"t","Always Use Highest Resolution",_)))+'\n				</label>\n				<p class="help-block">',_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"When multiple resolutions are available for a video, automatically use the highest possible resolution.",_):T.call(t,"t","When multiple resolutions are available for a video, automatically use the highest possible resolution.",_)))+'</p>\n			</div>\n\n			<div class="control-group advanced-pref hide">\n				<label class="checkbox" for="directPlayAC3">\n					<input id="directPlayAC3" name="directPlayAC3" type="checkbox" class="input-dark" ',C=i["if"].call(t,(S=t.settings,null==S||S===!1?S:S.directPlayAC3),{hash:{},inverse:I.noop,fn:I.program(8,d,a),data:a}),(C||0===C)&&(A+=C),A+="> &nbsp;",_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Allow Direct Play of AC3 Audio",_):T.call(t,"t","Allow Direct Play of AC3 Audio",_)))+'\n				</label>\n				<p class="help-block">',_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Allow MP4 videos with AC3 audio to be played directly. Browser support for AC3 audio is limited.",_):T.call(t,"t","Allow MP4 videos with AC3 audio to be played directly. Browser support for AC3 audio is limited.",_)))+"</p>\n			</div>\n\n			",C=i["if"].call(t,t.videoQualities,{hash:{},inverse:I.noop,fn:I.program(21,y,a),data:a}),(C||0===C)&&(A+=C),A+='\n		</div>\n\n		<div id="sync" class="preferences-group">\n			',C=i.unless.call(t,t.hasPlexPass,{hash:{},inverse:I.noop,fn:I.program(26,x,a),data:a}),(C||0===C)&&(A+=C),A+='\n\n			<h3><i class="glyphicon adjust-alt"></i> ',_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Default Quality",_):T.call(t,"t","Default Quality",_)))+'</h3>\n\n			<div class="control-group">\n				<label class="control-label" for="syncVideoQuality">',_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Video",_):T.call(t,"t","Video",_)))+'</label>\n				<div class="controls">\n					<select id="syncVideoQuality" name="syncVideoQuality">\n						<option value="low" ',_={hash:{},inverse:I.noop,fn:I.program(6,c,a),data:a},S=i.if_eq||t.if_eq,C=S?S.call(t,(S=t.settings,null==S||S===!1?S:S.syncVideoQuality),"low",_):T.call(t,"if_eq",(S=t.settings,null==S||S===!1?S:S.syncVideoQuality),"low",_),(C||0===C)&&(A+=C),A+=">",_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Low",_):T.call(t,"t","Low",_)))+'</option>\n						<option value="medium" ',_={hash:{},inverse:I.noop,fn:I.program(6,c,a),data:a},S=i.if_eq||t.if_eq,C=S?S.call(t,(S=t.settings,null==S||S===!1?S:S.syncVideoQuality),"medium",_):T.call(t,"if_eq",(S=t.settings,null==S||S===!1?S:S.syncVideoQuality),"medium",_),(C||0===C)&&(A+=C),A+=">",_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Medium",_):T.call(t,"t","Medium",_)))+'</option>\n						<option value="high" ',_={hash:{},inverse:I.noop,fn:I.program(6,c,a),data:a},S=i.if_eq||t.if_eq,C=S?S.call(t,(S=t.settings,null==S||S===!1?S:S.syncVideoQuality),"high",_):T.call(t,"if_eq",(S=t.settings,null==S||S===!1?S:S.syncVideoQuality),"high",_),(C||0===C)&&(A+=C),A+=">",_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"High",_):T.call(t,"t","High",_)))+'</option>\n						<option value="highest" ',_={hash:{},inverse:I.noop,fn:I.program(6,c,a),data:a},S=i.if_eq||t.if_eq,C=S?S.call(t,(S=t.settings,null==S||S===!1?S:S.syncVideoQuality),"highest",_):T.call(t,"if_eq",(S=t.settings,null==S||S===!1?S:S.syncVideoQuality),"highest",_),(C||0===C)&&(A+=C),A+=">",_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Highest",_):T.call(t,"t","Highest",_)))+'</option>\n					</select>\n				</div>\n			</div>\n\n			<div class="control-group">\n				<label class="control-label" for="syncAudioQuality">',_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Audio",_):T.call(t,"t","Audio",_)))+'</label>\n				<div class="controls">\n					<select id="syncAudioQuality" name="syncAudioQuality">\n						<option value="low" ',_={hash:{},inverse:I.noop,fn:I.program(6,c,a),data:a},S=i.if_eq||t.if_eq,C=S?S.call(t,(S=t.settings,null==S||S===!1?S:S.syncAudioQuality),"low",_):T.call(t,"if_eq",(S=t.settings,null==S||S===!1?S:S.syncAudioQuality),"low",_),(C||0===C)&&(A+=C),A+=">",_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Low",_):T.call(t,"t","Low",_)))+'</option>\n						<option value="medium" ',_={hash:{},inverse:I.noop,fn:I.program(6,c,a),data:a},S=i.if_eq||t.if_eq,C=S?S.call(t,(S=t.settings,null==S||S===!1?S:S.syncAudioQuality),"medium",_):T.call(t,"if_eq",(S=t.settings,null==S||S===!1?S:S.syncAudioQuality),"medium",_),(C||0===C)&&(A+=C),A+=">",_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Medium",_):T.call(t,"t","Medium",_)))+'</option>\n						<option value="high" ',_={hash:{},inverse:I.noop,fn:I.program(6,c,a),data:a},S=i.if_eq||t.if_eq,C=S?S.call(t,(S=t.settings,null==S||S===!1?S:S.syncAudioQuality),"high",_):T.call(t,"if_eq",(S=t.settings,null==S||S===!1?S:S.syncAudioQuality),"high",_),(C||0===C)&&(A+=C),A+=">",_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"High",_):T.call(t,"t","High",_)))+'</option>\n						<option value="highest" ',_={hash:{},inverse:I.noop,fn:I.program(6,c,a),data:a},S=i.if_eq||t.if_eq,C=S?S.call(t,(S=t.settings,null==S||S===!1?S:S.syncAudioQuality),"highest",_):T.call(t,"if_eq",(S=t.settings,null==S||S===!1?S:S.syncAudioQuality),"highest",_),(C||0===C)&&(A+=C),A+=">",_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Highest",_):T.call(t,"t","Highest",_)))+'</option>\n					</select>\n				</div>\n			</div>\n\n			<div class="control-group">\n				<label class="control-label" for="syncPictureQuality">',_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Pictures",_):T.call(t,"t","Pictures",_)))+'</label>\n				<div class="controls">\n					<select id="syncPictureQuality" name="syncPictureQuality">\n						<option value="low" ',_={hash:{},inverse:I.noop,fn:I.program(6,c,a),data:a},S=i.if_eq||t.if_eq,C=S?S.call(t,(S=t.settings,null==S||S===!1?S:S.syncPictureQuality),"low",_):T.call(t,"if_eq",(S=t.settings,null==S||S===!1?S:S.syncPictureQuality),"low",_),(C||0===C)&&(A+=C),A+=">",_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Low",_):T.call(t,"t","Low",_)))+'</option>\n						<option value="medium" ',_={hash:{},inverse:I.noop,fn:I.program(6,c,a),data:a},S=i.if_eq||t.if_eq,C=S?S.call(t,(S=t.settings,null==S||S===!1?S:S.syncPictureQuality),"medium",_):T.call(t,"if_eq",(S=t.settings,null==S||S===!1?S:S.syncPictureQuality),"medium",_),(C||0===C)&&(A+=C),A+=">",_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Medium",_):T.call(t,"t","Medium",_)))+'</option>\n						<option value="high" ',_={hash:{},inverse:I.noop,fn:I.program(6,c,a),data:a},S=i.if_eq||t.if_eq,C=S?S.call(t,(S=t.settings,null==S||S===!1?S:S.syncPictureQuality),"high",_):T.call(t,"if_eq",(S=t.settings,null==S||S===!1?S:S.syncPictureQuality),"high",_),(C||0===C)&&(A+=C),A+=">",_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"High",_):T.call(t,"t","High",_)))+'</option>\n						<option value="highest" ',_={hash:{},inverse:I.noop,fn:I.program(6,c,a),data:a},S=i.if_eq||t.if_eq,C=S?S.call(t,(S=t.settings,null==S||S===!1?S:S.syncPictureQuality),"highest",_):T.call(t,"if_eq",(S=t.settings,null==S||S===!1?S:S.syncPictureQuality),"highest",_),(C||0===C)&&(A+=C),A+=">",_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Highest",_):T.call(t,"t","Highest",_)))+"</option>\n					</select>\n				</div>\n			</div>\n\n			",C=i.unless.call(t,t.hasPlexPass,{hash:{},inverse:I.noop,fn:I.program(28,k,a),data:a}),(C||0===C)&&(A+=C),A+='\n		</div>\n\n		<div class="form-actions">\n			<button type="submit" class="btn btn-medium btn-primary">',_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Save",_):T.call(t,"t","Save",_)))+'</button>\n			<button type="button" class="btn btn-medium cancel-btn">',_={hash:{},data:a},A+=M((S=i.t||t.t,S?S.call(t,"Cancel",_):T.call(t,"t","Cancel",_)))+"</button>\n		</div>\n	</fieldset>\n</form>\n"
})}),define("hb!templates/desktop/server/settings/DashboardSettingsView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return"checked"}function r(){return'\n	<div class="plex-pass-restricted-container">\n		<div class="plex-pass-restricted">\n'}function l(e,t,n){var a,s,r,l="";return l+='\n				<li class="well">\n					',r={hash:{},inverse:_.noop,fn:_.programWithDepth(6,o,t,n),data:t},a=i.if_eq||e.if_eq,s=a?a.call(e,e,"myLibrary",r):A.call(e,"if_eq",e,"myLibrary",r),(s||0===s)&&(l+=s),l+="\n					",r={hash:{},inverse:_.noop,fn:_.programWithDepth(8,c,t,n),data:t},a=i.if_eq||e.if_eq,s=a?a.call(e,e,"onDeck",r):A.call(e,"if_eq",e,"onDeck",r),(s||0===s)&&(l+=s),l+="\n					",r={hash:{},inverse:_.noop,fn:_.programWithDepth(10,d,t,n),data:t},a=i.if_eq||e.if_eq,s=a?a.call(e,e,"recentlyAdded",r):A.call(e,"if_eq",e,"recentlyAdded",r),(s||0===s)&&(l+=s),l+="\n					",r={hash:{},inverse:_.noop,fn:_.programWithDepth(12,h,t,n),data:t},a=i.if_eq||e.if_eq,s=a?a.call(e,e,"channels",r):A.call(e,"if_eq",e,"channels",r),(s||0===s)&&(l+=s),l+="\n					",r={hash:{},inverse:_.noop,fn:_.programWithDepth(14,u,t,n),data:t},a=i.if_eq||e.if_eq,s=a?a.call(e,e,"sharedLibraries",r):A.call(e,"if_eq",e,"sharedLibraries",r),(s||0===s)&&(l+=s),l+="\n				</li>\n			"
}function o(e,t,n){var a,r,l,o="";return o+='\n\n						<div id="dashboardMyLibraryPriority" class="sortable">\n							<i class="sortable-icon glyphicon show-lines"></i>\n							<label class="sortable-label" for="dashboardMyLibraryEnabled">\n								<input id="dashboardMyLibraryEnabled" name="dashboardMyLibraryEnabled" type="checkbox" ',r=i["if"].call(e,(a=n.settings,null==a||a===!1?a:a.dashboardMyLibraryEnabled),{hash:{},inverse:_.noop,fn:_.program(1,s,t),data:t}),(r||0===r)&&(o+=r),o+="> ",l={hash:{},data:t},o+=I((a=i.t||n.t,a?a.call(e,"My Library",l):A.call(e,"t","My Library",l)))+"\n							</label>\n						</div>\n\n					"
}function c(e,t,n){var a,r,l,o="";return o+='\n\n						<div id="dashboardOnDeckPriority" class="sortable">\n							<a class="sortable-btn settings-btn open-settings-btn" rel="tooltip" title="',l={hash:{},data:t},o+=I((a=i.t||e.t,a?a.call(e,"Widget Settings",l):A.call(e,"t","Widget Settings",l)))+'" href="#">\n								<i class="settings-icon glyphicon cogwheel"></i>\n							</a>\n\n							<a class="sortable-btn settings-btn close-settings-btn hide" href="#">\n								<i class="close-icon glyphicon circle-remove"></i>\n							</a>\n\n							<i class="sortable-icon glyphicon show-lines"></i>\n							<label class="sortable-label" for="dashboardOnDeckEnabled">\n								<input id="dashboardOnDeckEnabled" name="dashboardOnDeckEnabled" type="checkbox" ',r=i["if"].call(e,(a=n.settings,null==a||a===!1?a:a.dashboardOnDeckEnabled),{hash:{},inverse:_.noop,fn:_.program(1,s,t),data:t}),(r||0===r)&&(o+=r),o+="> ",l={hash:{},data:t},o+=I((a=i.t||n.t,a?a.call(e,"On Deck",l):A.call(e,"t","On Deck",l)))+'\n							</label>\n						</div>\n\n						<div class="dashboard-widget-settings hide">\n							<div class="control-group">\n								<label for="dashboardOnDeckDynamicPriority">\n									<input id="dashboardOnDeckDynamicPriority" name="dashboardOnDeckDynamicPriority" type="checkbox" ',r=i["if"].call(e,(a=n.settings,null==a||a===!1?a:a.dashboardOnDeckDynamicPriority),{hash:{},inverse:_.noop,fn:_.program(1,s,t),data:t}),(r||0===r)&&(o+=r),o+="> ",l={hash:{},data:t},o+=I((a=i.t||n.t,a?a.call(e,"Adjust priority based on when the most recent video was watched",l):A.call(e,"t","Adjust priority based on when the most recent video was watched",l)))+'\n								</label>\n							</div>\n\n							<div class="control-group">\n								<h4>',l={hash:{},data:t},o+=I((a=i.t||n.t,a?a.call(e,"Show wide thumbnails",l):A.call(e,"t","Show wide thumbnails",l)))+'</h4>\n\n								<label class="radio inline">\n									<input type="radio" id="dashboardOnDeckWideThumbnails" name="dashboardOnDeckWideThumbnails" value="none" ',l={hash:{},inverse:_.noop,fn:_.program(1,s,t),data:t},a=i.if_eq||n.if_eq,r=a?a.call(e,(a=n.settings,null==a||a===!1?a:a.dashboardOnDeckWideThumbnails),"none",l):A.call(e,"if_eq",(a=n.settings,null==a||a===!1?a:a.dashboardOnDeckWideThumbnails),"none",l),(r||0===r)&&(o+=r),o+="> ",l={hash:{},data:t},o+=I((a=i.t||n.t,a?a.call(e,"None",l):A.call(e,"t","None",l)))+'\n								</label>\n								<label class="radio inline">\n									<input type="radio" id="dashboardOnDeckWideThumbnails" name="dashboardOnDeckWideThumbnails" value="first" ',l={hash:{},inverse:_.noop,fn:_.program(1,s,t),data:t},a=i.if_eq||n.if_eq,r=a?a.call(e,(a=n.settings,null==a||a===!1?a:a.dashboardOnDeckWideThumbnails),"first",l):A.call(e,"if_eq",(a=n.settings,null==a||a===!1?a:a.dashboardOnDeckWideThumbnails),"first",l),(r||0===r)&&(o+=r),o+="> ",l={hash:{},data:t},o+=I((a=i.t||n.t,a?a.call(e,"First",l):A.call(e,"t","First",l)))+'\n								</label>\n								<label class="radio inline">\n									<input type="radio" id="dashboardOnDeckWideThumbnails" name="dashboardOnDeckWideThumbnails" value="all" ',l={hash:{},inverse:_.noop,fn:_.program(1,s,t),data:t},a=i.if_eq||n.if_eq,r=a?a.call(e,(a=n.settings,null==a||a===!1?a:a.dashboardOnDeckWideThumbnails),"all",l):A.call(e,"if_eq",(a=n.settings,null==a||a===!1?a:a.dashboardOnDeckWideThumbnails),"all",l),(r||0===r)&&(o+=r),o+="> ",l={hash:{},data:t},o+=I((a=i.t||n.t,a?a.call(e,"All",l):A.call(e,"t","All",l)))+"\n								</label>\n							</div>\n						</div>\n\n					"
}function d(e,t,n){var a,r,l,o="";return o+='\n\n						<div id="dashboardRecentlyAddedPriority" class="sortable">\n							<a class="sortable-btn settings-btn open-settings-btn" rel="tooltip" title="',l={hash:{},data:t},o+=I((a=i.t||e.t,a?a.call(e,"Widget Settings",l):A.call(e,"t","Widget Settings",l)))+'" href="#">\n								<i class="settings-icon glyphicon cogwheel"></i>\n							</a>\n\n							<a class="sortable-btn settings-btn close-settings-btn hide" href="#">\n								<i class="close-icon glyphicon circle-remove"></i>\n							</a>\n\n							<i class="sortable-icon glyphicon show-lines"></i>\n							<label class="sortable-label" for="dashboardRecentlyAddedEnabled">\n								<input id="dashboardRecentlyAddedEnabled" name="dashboardRecentlyAddedEnabled" type="checkbox" ',r=i["if"].call(e,(a=n.settings,null==a||a===!1?a:a.dashboardRecentlyAddedEnabled),{hash:{},inverse:_.noop,fn:_.program(1,s,t),data:t}),(r||0===r)&&(o+=r),o+="> ",l={hash:{},data:t},o+=I((a=i.t||n.t,a?a.call(e,"Recently Added",l):A.call(e,"t","Recently Added",l)))+'\n							</label>\n						</div>\n\n						<div class="dashboard-widget-settings hide">\n							<div class="control-group">\n								<label for="dashboardRecentlyAddedDynamicPriority">\n									<input id="dashboardRecentlyAddedDynamicPriority" name="dashboardRecentlyAddedDynamicPriority" type="checkbox" ',r=i["if"].call(e,(a=n.settings,null==a||a===!1?a:a.dashboardRecentlyAddedDynamicPriority),{hash:{},inverse:_.noop,fn:_.program(1,s,t),data:t}),(r||0===r)&&(o+=r),o+="> ",l={hash:{},data:t},o+=I((a=i.t||n.t,a?a.call(e,"Adjust priority based on when the most recent video was added",l):A.call(e,"t","Adjust priority based on when the most recent video was added",l)))+'\n								</label>\n							</div>\n\n							<div class="control-group">\n								<h4>',l={hash:{},data:t},o+=I((a=i.t||n.t,a?a.call(e,"Show wide thumbnails",l):A.call(e,"t","Show wide thumbnails",l)))+'</h4>\n\n								<label class="radio inline">\n									<input type="radio" id="dashboardRecentlyAddedWideThumbnails" name="dashboardRecentlyAddedWideThumbnails" value="none" ',l={hash:{},inverse:_.noop,fn:_.program(1,s,t),data:t},a=i.if_eq||n.if_eq,r=a?a.call(e,(a=n.settings,null==a||a===!1?a:a.dashboardRecentlyAddedWideThumbnails),"none",l):A.call(e,"if_eq",(a=n.settings,null==a||a===!1?a:a.dashboardRecentlyAddedWideThumbnails),"none",l),(r||0===r)&&(o+=r),o+="> ",l={hash:{},data:t},o+=I((a=i.t||n.t,a?a.call(e,"None",l):A.call(e,"t","None",l)))+'\n								</label>\n								<label class="radio inline">\n									<input type="radio" id="dashboardRecentlyAddedWideThumbnails" name="dashboardRecentlyAddedWideThumbnails" value="first" ',l={hash:{},inverse:_.noop,fn:_.program(1,s,t),data:t},a=i.if_eq||n.if_eq,r=a?a.call(e,(a=n.settings,null==a||a===!1?a:a.dashboardRecentlyAddedWideThumbnails),"first",l):A.call(e,"if_eq",(a=n.settings,null==a||a===!1?a:a.dashboardRecentlyAddedWideThumbnails),"first",l),(r||0===r)&&(o+=r),o+="> ",l={hash:{},data:t},o+=I((a=i.t||n.t,a?a.call(e,"First",l):A.call(e,"t","First",l)))+'\n								</label>\n								<label class="radio inline">\n									<input type="radio" id="dashboardRecentlyAddedWideThumbnails" name="dashboardRecentlyAddedWideThumbnails" value="all" ',l={hash:{},inverse:_.noop,fn:_.program(1,s,t),data:t},a=i.if_eq||n.if_eq,r=a?a.call(e,(a=n.settings,null==a||a===!1?a:a.dashboardRecentlyAddedWideThumbnails),"all",l):A.call(e,"if_eq",(a=n.settings,null==a||a===!1?a:a.dashboardRecentlyAddedWideThumbnails),"all",l),(r||0===r)&&(o+=r),o+="> ",l={hash:{},data:t},o+=I((a=i.t||n.t,a?a.call(e,"All",l):A.call(e,"t","All",l)))+"\n								</label>\n							</div>\n						</div>\n\n					"
}function h(e,t,n){var a,r,l,o="";return o+='\n\n						<div id="dashboardChannelsPriority" class="sortable">\n							<a class="sortable-btn settings-btn open-settings-btn" rel="tooltip" title="',l={hash:{},data:t},o+=I((a=i.t||e.t,a?a.call(e,"Widget Settings",l):A.call(e,"t","Widget Settings",l)))+'" href="#">\n								<i class="settings-icon glyphicon cogwheel"></i>\n							</a>\n\n							<a class="sortable-btn settings-btn close-settings-btn hide" href="#">\n								<i class="close-icon glyphicon circle-remove"></i>\n							</a>\n\n							<i class="sortable-icon glyphicon show-lines"></i>\n							<label class="sortable-label" for="dashboardChannelsEnabled">\n								<input id="dashboardChannelsEnabled" name="dashboardChannelsEnabled" type="checkbox" ',r=i["if"].call(e,(a=n.settings,null==a||a===!1?a:a.dashboardChannelsEnabled),{hash:{},inverse:_.noop,fn:_.program(1,s,t),data:t}),(r||0===r)&&(o+=r),o+="> ",l={hash:{},data:t},o+=I((a=i.t||n.t,a?a.call(e,"Channels",l):A.call(e,"t","Channels",l)))+'\n							</label>\n						</div>\n\n						<div class="dashboard-widget-settings hide">\n							<label for="dashboardChannelsLimit">\n								<input id="dashboardChannelsLimit" name="dashboardChannelsLimit" type="checkbox" ',r=i["if"].call(e,(a=n.settings,null==a||a===!1?a:a.dashboardChannelsLimit),{hash:{},inverse:_.noop,fn:_.program(1,s,t),data:t}),(r||0===r)&&(o+=r),o+="> ",l={hash:{},data:t},o+=I((a=i.t||n.t,a?a.call(e,"Limit to recently used channels",l):A.call(e,"t","Limit to recently used channels",l)))+'\n							</label>\n\n							<label for="dashboardChannelsDynamicPriority">\n								<input id="dashboardChannelsDynamicPriority" name="dashboardChannelsDynamicPriority" type="checkbox" ',r=i["if"].call(e,(a=n.settings,null==a||a===!1?a:a.dashboardChannelsDynamicPriority),{hash:{},inverse:_.noop,fn:_.program(1,s,t),data:t}),(r||0===r)&&(o+=r),o+="> ",l={hash:{},data:t},o+=I((a=i.t||n.t,a?a.call(e,"Adjust priority based on when the most recent channel was used",l):A.call(e,"t","Adjust priority based on when the most recent channel was used",l)))+'\n							</label>\n\n							<label for="dashboardChannelsLargeThumbnail">\n								<input id="dashboardChannelsLargeThumbnail" name="dashboardChannelsLargeThumbnail" type="checkbox" ',r=i["if"].call(e,(a=n.settings,null==a||a===!1?a:a.dashboardChannelsLargeThumbnail),{hash:{},inverse:_.noop,fn:_.program(1,s,t),data:t}),(r||0===r)&&(o+=r),o+="> ",l={hash:{},data:t},o+=I((a=i.t||n.t,a?a.call(e,"Show a large thumbnail for the first channel",l):A.call(e,"t","Show a large thumbnail for the first channel",l)))+"\n							</label>\n						</div>\n\n					"
}function u(e,t,n){var a,r,l,o="";return o+='\n\n						<div id="dashboardSharedLibrariesPriority" class="sortable">\n							<i class="sortable-icon glyphicon show-lines"></i>\n							<label class="sortable-label" for="dashboardSharedLibrariesEnabled">\n								<input id="dashboardSharedLibrariesEnabled" name="dashboardSharedLibrariesEnabled" type="checkbox" ',r=i["if"].call(e,(a=n.settings,null==a||a===!1?a:a.dashboardSharedLibrariesEnabled),{hash:{},inverse:_.noop,fn:_.program(1,s,t),data:t}),(r||0===r)&&(o+=r),o+="> ",l={hash:{},data:t},o+=I((a=i.t||n.t,a?a.call(e,"Shared Libraries",l):A.call(e,"t","Shared Libraries",l)))+"\n							</label>\n						</div>\n\n					"
}function p(e,t,n){var a,s,r,l="";return l+='\n				<li class="well ',r={hash:{},inverse:_.noop,fn:_.programWithDepth(17,f,t,n),data:t},a=i.if_eq||e.if_eq,s=a?a.call(e,e,"nowPlaying",r):A.call(e,"if_eq",e,"nowPlaying",r),(s||0===s)&&(l+=s),l+='">\n					',r={hash:{},inverse:_.noop,fn:_.programWithDepth(20,g,t,n),data:t},a=i.if_eq||e.if_eq,s=a?a.call(e,e,"nowPlaying",r):A.call(e,"if_eq",e,"nowPlaying",r),(s||0===s)&&(l+=s),l+="\n					",r={hash:{},inverse:_.noop,fn:_.programWithDepth(22,v,t,n),data:t},a=i.if_eq||e.if_eq,s=a?a.call(e,e,"queue",r):A.call(e,"if_eq",e,"queue",r),(s||0===s)&&(l+=s),l+="\n					",r={hash:{},inverse:_.noop,fn:_.programWithDepth(24,y,t,n),data:t},a=i.if_eq||e.if_eq,s=a?a.call(e,e,"recommendations",r):A.call(e,"if_eq",e,"recommendations",r),(s||0===s)&&(l+=s),l+="\n					",r={hash:{},inverse:_.noop,fn:_.programWithDepth(26,b,t,n),data:t},a=i.if_eq||e.if_eq,s=a?a.call(e,e,"announcements",r):A.call(e,"if_eq",e,"announcements",r),(s||0===s)&&(l+=s),l+="\n				</li>\n			"
}function f(e,t,n){var a;return a=i.unless.call(e,n.hasMultiUser,{hash:{},inverse:_.noop,fn:_.program(18,m,t),data:t}),a||0===a?a:""}function m(){return"hide"}function g(e,t,n){var a,r,l,o="";return o+='\n\n						<div id="dashboardNowPlayingPriority" class="sortable">\n							<i class="sortable-icon glyphicon show-lines"></i>\n							<label class="sortable-label" for="dashboardNowPlayingEnabled">\n								<input id="dashboardNowPlayingEnabled" name="dashboardNowPlayingEnabled" type="checkbox" ',r=i["if"].call(e,(a=n.settings,null==a||a===!1?a:a.dashboardNowPlayingEnabled),{hash:{},inverse:_.noop,fn:_.program(1,s,t),data:t}),(r||0===r)&&(o+=r),o+="> ",l={hash:{},data:t},o+=I((a=i.t||n.t,a?a.call(e,"Now Playing",l):A.call(e,"t","Now Playing",l)))+"\n							</label>\n						</div>\n\n					"
}function v(e,t,n){var a,r,l,o="";return o+='\n\n						<div id="dashboardQueuePriority" class="sortable">\n							<a class="sortable-btn settings-btn open-settings-btn" rel="tooltip" title="',l={hash:{},data:t},o+=I((a=i.t||e.t,a?a.call(e,"Widget Settings",l):A.call(e,"t","Widget Settings",l)))+'" href="#">\n								<i class="settings-icon glyphicon cogwheel"></i>\n							</a>\n\n							<a class="sortable-btn settings-btn close-settings-btn hide" href="#">\n								<i class="close-icon glyphicon circle-remove"></i>\n							</a>\n\n							<i class="sortable-icon glyphicon show-lines"></i>\n							<label class="sortable-label" for="dashboardQueueEnabled">\n								<input id="dashboardQueueEnabled" name="dashboardQueueEnabled" type="checkbox" ',r=i["if"].call(e,(a=n.settings,null==a||a===!1?a:a.dashboardQueueEnabled),{hash:{},inverse:_.noop,fn:_.program(1,s,t),data:t}),(r||0===r)&&(o+=r),o+="> ",l={hash:{},data:t},o+=I((a=i.t||n.t,a?a.call(e,"Queue",l):A.call(e,"t","Queue",l)))+'\n							</label>\n						</div>\n\n						<div class="dashboard-widget-settings hide">\n							<label for="dashboardQueueLimit">\n								<input id="dashboardQueueLimit" name="dashboardQueueLimit" type="checkbox" ',r=i["if"].call(e,(a=n.settings,null==a||a===!1?a:a.dashboardQueueLimit),{hash:{},inverse:_.noop,fn:_.program(1,s,t),data:t}),(r||0===r)&&(o+=r),o+="> ",l={hash:{},data:t},o+=I((a=i.t||n.t,a?a.call(e,"Limit to unwatched videos",l):A.call(e,"t","Limit to unwatched videos",l)))+'\n							</label>\n\n							<label for="dashboardQueueDynamicPriority">\n								<input id="dashboardQueueDynamicPriority" name="dashboardQueueDynamicPriority" type="checkbox" ',r=i["if"].call(e,(a=n.settings,null==a||a===!1?a:a.dashboardQueueDynamicPriority),{hash:{},inverse:_.noop,fn:_.program(1,s,t),data:t}),(r||0===r)&&(o+=r),o+="> ",l={hash:{},data:t},o+=I((a=i.t||n.t,a?a.call(e,"Adjust priority based on when the most recent video was added",l):A.call(e,"t","Adjust priority based on when the most recent video was added",l)))+"\n							</label>\n						</div>\n\n					"
}function y(e,t,n){var a,r,l,o="";return o+='\n\n						<div id="dashboardRecommendationsPriority" class="sortable">\n							<a class="sortable-btn settings-btn open-settings-btn" rel="tooltip" title="',l={hash:{},data:t},o+=I((a=i.t||e.t,a?a.call(e,"Widget Settings",l):A.call(e,"t","Widget Settings",l)))+'" href="#">\n								<i class="settings-icon glyphicon cogwheel"></i>\n							</a>\n\n							<a class="sortable-btn settings-btn close-settings-btn hide" href="#">\n								<i class="close-icon glyphicon circle-remove"></i>\n							</a>\n\n							<i class="sortable-icon glyphicon show-lines"></i>\n							<label class="sortable-label" for="dashboardRecommendationsEnabled">\n								<input id="dashboardRecommendationsEnabled" name="dashboardRecommendationsEnabled" type="checkbox" ',r=i["if"].call(e,(a=n.settings,null==a||a===!1?a:a.dashboardRecommendationsEnabled),{hash:{},inverse:_.noop,fn:_.program(1,s,t),data:t}),(r||0===r)&&(o+=r),o+="> ",l={hash:{},data:t},o+=I((a=i.t||n.t,a?a.call(e,"Recommendations",l):A.call(e,"t","Recommendations",l)))+'\n							</label>\n						</div>\n\n						<div class="dashboard-widget-settings hide">\n							<label for="dashboardRecommendationsLimit">\n								<input id="dashboardRecommendationsLimit" name="dashboardRecommendationsLimit" type="checkbox" ',r=i["if"].call(e,(a=n.settings,null==a||a===!1?a:a.dashboardRecommendationsLimit),{hash:{},inverse:_.noop,fn:_.program(1,s,t),data:t}),(r||0===r)&&(o+=r),o+="> ",l={hash:{},data:t},o+=I((a=i.t||n.t,a?a.call(e,"Limit to unwatched videos",l):A.call(e,"t","Limit to unwatched videos",l)))+'\n							</label>\n\n							<label for="dashboardRecommendationsDynamicPriority">\n								<input id="dashboardRecommendationsDynamicPriority" name="dashboardRecommendationsDynamicPriority" type="checkbox" ',r=i["if"].call(e,(a=n.settings,null==a||a===!1?a:a.dashboardRecommendationsDynamicPriority),{hash:{},inverse:_.noop,fn:_.program(1,s,t),data:t}),(r||0===r)&&(o+=r),o+="> ",l={hash:{},data:t},o+=I((a=i.t||n.t,a?a.call(e,"Adjust priority based on when the most recent video was recommended",l):A.call(e,"t","Adjust priority based on when the most recent video was recommended",l)))+"\n							</label>\n						</div>\n\n					"
}function b(e,t,n){var a,r,l,o="";return o+='\n\n						<div id="dashboardAnnouncementsPriority" class="sortable">\n							<a class="sortable-btn settings-btn open-settings-btn" rel="tooltip" title="',l={hash:{},data:t},o+=I((a=i.t||e.t,a?a.call(e,"Widget Settings",l):A.call(e,"t","Widget Settings",l)))+'" href="#">\n								<i class="settings-icon glyphicon cogwheel"></i>\n							</a>\n\n							<a class="sortable-btn settings-btn close-settings-btn hide" href="#">\n								<i class="close-icon glyphicon circle-remove"></i>\n							</a>\n\n							<i class="sortable-icon glyphicon show-lines"></i>\n							<label class="sortable-label" for="dashboardAnnouncementsEnabled">\n								<input id="dashboardAnnouncementsEnabled" name="dashboardAnnouncementsEnabled" type="checkbox" ',r=i["if"].call(e,(a=n.settings,null==a||a===!1?a:a.dashboardAnnouncementsEnabled),{hash:{},inverse:_.noop,fn:_.program(1,s,t),data:t}),(r||0===r)&&(o+=r),o+="> ",l={hash:{},data:t},o+=I((a=i.t||n.t,a?a.call(e,"Announcements",l):A.call(e,"t","Announcements",l)))+'\n							</label>\n						</div>\n\n						<div class="dashboard-widget-settings hide">\n							<label for="dashboardAnnouncementsHideUnread">\n								<input id="dashboardAnnouncementsHideUnread" name="dashboardAnnouncementsHideUnread" type="checkbox" ',r=i["if"].call(e,(a=n.settings,null==a||a===!1?a:a.dashboardAnnouncementsHideUnread),{hash:{},inverse:_.noop,fn:_.program(1,s,t),data:t}),(r||0===r)&&(o+=r),o+="> ",l={hash:{},data:t},o+=I((a=i.t||n.t,a?a.call(e,"Hide when no unread announcements are available",l):A.call(e,"t","Hide when no unread announcements are available",l)))+"\n							</label>\n						</div>\n\n					"
}function w(e,t){var n,a,s="";return s+='\n		</div>\n\n		<div class="plex-pass-message-overlay">\n			<div class="empty-message plex-pass-message">\n				',a={hash:{},data:t},s+=I((n=i.t||e.t,n?n.call(e,"Sorry, you need a <a href='{1}' target='_blank'>PlexPass subscription</a> for this feature.","https://my.plexapp.com/subscription/about",a):A.call(e,"t","Sorry, you need a <a href='{1}' target='_blank'>PlexPass subscription</a> for this feature.","https://my.plexapp.com/subscription/about",a)))+"\n			</div>\n		</div>\n	</div>\n"
}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var x,k,S,C="",_=this,A=i.helperMissing,I=this.escapeExpression;return C+='<h3><i class="glyphicon dashboard"></i> ',S={hash:{},data:a},C+=I((x=i.t||t.t,x?x.call(t,"Dashboard",S):A.call(t,"t","Dashboard",S)))+'</h3>\n\n<div class="control-group">\n	<label class="checkbox" for="dashboardFluidWidth">\n		<input id="dashboardFluidWidth" name="dashboardFluidWidth" type="checkbox" class="input-dark" ',k=i["if"].call(t,(x=t.settings,null==x||x===!1?x:x.dashboardFluidWidth),{hash:{},inverse:_.noop,fn:_.program(1,s,a),data:a}),(k||0===k)&&(C+=k),C+="> &nbsp;",S={hash:{},data:a},C+=I((x=i.t||t.t,x?x.call(t,"Maximize width",S):A.call(t,"t","Maximize width",S)))+'\n	</label>\n	<p class="help-block">',S={hash:{},data:a},C+=I((x=i.t||t.t,x?x.call(t,"Expand the dashboard to use the full width of the page.",S):A.call(t,"t","Expand the dashboard to use the full width of the page.",S)))+"</p>\n</div>\n\n\n",k=i.unless.call(t,t.hasPlexPass,{hash:{},inverse:_.noop,fn:_.program(3,r,a),data:a}),(k||0===k)&&(C+=k),C+='\n\n<h3><i class="glyphicon show-big-thumbnails"></i> ',S={hash:{},data:a},C+=I((x=i.t||t.t,x?x.call(t,"Widgets",S):A.call(t,"t","Widgets",S)))+'</h3>\n\n<div class="dashboard-settings">\n	<div class="dashboard-settings-main">\n		<ul id="dashboard-settings-main-list" class="sortable-list">\n			',k=i.each.call(t,t.mainWidgets,{hash:{},inverse:_.noop,fn:_.programWithDepth(5,l,a,t),data:a}),(k||0===k)&&(C+=k),C+='\n		</ul>\n	</div>\n\n	<div class="dashboard-settings-sidebar">\n		<ul id="dashboard-settings-sidebar-list" class="sortable-list">\n			',k=i.each.call(t,t.sidebarWidgets,{hash:{},inverse:_.noop,fn:_.programWithDepth(16,p,a,t),data:a}),(k||0===k)&&(C+=k),C+="\n		</ul>\n	</div>\n</div>\n\n",k=i.unless.call(t,t.hasPlexPass,{hash:{},inverse:_.noop,fn:_.program(28,w,a),data:a}),(k||0===k)&&(C+=k),C+="\n"
})}),define("plex/desktop/view/server/settings/DashboardSettingsView",["hb!templates/desktop/server/settings/DashboardSettingsView.tpl","plex/base/model/AppModel","plex/base/view/BaseView","jquery","sortable"],function(e,t,i,n){var a=i.extend({id:"dashboard",className:"preferences-group wide",mainWidgets:null,sidebarWidgets:null,events:{"click .settings-btn":"onSettingsClick","sortupdate .sortable-list":"onSortUpdate"},initialize:function(){this.mainWidgets=[],this.sidebarWidgets=[],this.addWidget("myLibrary","dashboardMyLibraryPriority"),this.addWidget("onDeck","dashboardOnDeckPriority"),this.addWidget("recentlyAdded","dashboardRecentlyAddedPriority"),this.addWidget("channels","dashboardChannelsPriority"),this.addWidget("sharedLibraries","dashboardSharedLibrariesPriority"),this.addWidget("announcements","dashboardAnnouncementsPriority",!0),this.addWidget("nowPlaying","dashboardNowPlayingPriority",!0),this.addWidget("queue","dashboardQueuePriority",!0),this.addWidget("recommendations","dashboardRecommendationsPriority",!0)
},render:function(){var i=t.get("myPlex"),n=t.get("primaryServer"),a=n.get("multiuser")&&i.hasPlexPass();return this.$el.html(e({hasPlexPass:i.hasPlexPass(),hasMultiUser:a,mainWidgets:this.mainWidgets,sidebarWidgets:this.sidebarWidgets,settings:this.model.toJSON()})),this.$el.tooltip({selector:".sortable-btn",placement:"bottom"}),this.$(".sortable-list").sortable(),this.delegateEvents(),this},addWidget:function(e,t,i){var n=i?this.sidebarWidgets:this.mainWidgets,a=this.model.get(t)-1,s=function(e,t){return e[t]?s(e,++t):t
},r=s(n,a);r!==a&&this.model.save(t,r+1),n[r]=e},onSettingsClick:function(e){e.preventDefault();var t=n(e.currentTarget);t.toggleClass("active");var i=t.closest("li");i.find(".settings-btn").toggleClass("hide"),i.find(".dashboard-widget-settings").toggleClass("hide"),n(".tooltip").remove()},onSortUpdate:function(e){var t=n(e.currentTarget),i=t.children("li"),a={};i.each(function(e,t){n(t);var i=n(t).find(".sortable").attr("id");a[i]=e+1}),this.trigger("change:priority",a)}});return a}),define("plex/desktop/view/server/settings/PlexWebSettingsView",["hb!templates/desktop/server/settings/PlexWebSettingsView.tpl","plex/base/control/Dispatcher","plex/base/control/utils/LanguageUtil","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel","plex/base/model/ConfigModel","plex/base/view/BaseView","plex/desktop/view/server/settings/DashboardSettingsView","plex/desktop/view/modals/KeyboardShortcutsModal","jquery"],function(e,t,i,n,a,s,r,l,o,c){var d=[{value:75,label:"Tiny"},{value:90,label:"Small"},{value:100,label:"Normal"},{value:125,label:"Large"},{value:200,label:"Huge"}],h=[{value:100,label:"None"},{value:150,label:"Small"},{value:200,label:"Large"},{value:250,label:"Huge"}],u=[{value:0,label:"Disabled"},{value:1,label:"Enabled"},{value:2,label:"Verbose"}],p=r.extend({id:"plex-web-settings",className:"preferences-group",active:!1,changes:null,languages:null,videoQualities:null,dashboardSettings:null,events:{"click .preferences-nav a":"onPreferenceGroupClick","change input[name]":"onPreferenceChange","change select[name]":"onPreferenceChange","click .check-updates-btn":"onCheckUpdatesClick","click .download-updates-btn":"onDownloadUpdatesClick","click .reload-updates-btn":"onReloadUpdatesClick","click .keyboard-shortcuts-btn":"onKeyboardShortcutsClick","submit .preferences-form":"onSubmit","click .cancel-btn":"onCancelClick"},initialize:function(e){var t,s,r,o=a.get("primaryServer"),c=o.get("transcoderVideoQualities"),d=o.get("transcoderVideoBitrates"),h=o.get("transcoderVideoResolutions");
this.active=e.active,this.changes={},c&&(t=c.split(",")),d&&(s=d.split(",")),h&&(r=h.split(",")),this.languages=[],_.each(_.keys(n.languages),_.bind(function(e){this.languages.push({value:e,name:i.getLanguageName(e)})},this)),this.videoQualities=t&&t.length>1&&s&&s.length>1&&r&&r.length>1?_.zip(t,s,r):null,"latest"===a.get("updateStatus")&&a.set("updateStatus","none"),this.dashboardSettings=new l({model:this.model}),this.addBinding(a,"change:updateStatus",this.onUpdateStatusChange),this.addBinding(this.dashboardSettings,"change:priority",this.onDashboardPriorityChange)
},render:function(){var t=a.get("myPlex"),i=a.get("primaryServer");return this.$el.html(e({hasPlexPass:t.hasPlexPass(),shared:i.get("shared"),version:a.get("version"),updateStatus:a.get("updateStatus"),disableUpdates:s.get("standalone"),settings:this.model.toJSON(),languages:this.languages,videoQualities:this.videoQualities,subtitleSizes:d,audioLevels:h,debugLevels:u})),this.active||this.$el.addClass("hide"),this.$("#general").after(this.dashboardSettings.render().el),this},save:function(e){var i=a.get("myPlex"),s=i.hasPlexPass(),r=!1;
if(_.each(_.keys(this.changes),_.bind(function(e){return!s&&_.indexOf(this.model.plexPassSettings,e)>-1?(r=!0,a.set("alert",{status:"error",message:n.t("Sorry, you need a PlexPass subscription to save some of these settings.")}),!1):void 0},this)),!r){var l=!1,o=function(){e||t.trigger("navigate:back"),t.off("change:language",o)};t.on("change:language",o),this.changes.language&&(l=!0),this.model.save(this.changes,{success:_.bind(function(){this.changes={},this.trigger("save",!0),l||(t.off("change:language",o),e||t.trigger("navigate:back"))
},this),error:_.bind(function(){a.set("alert",{status:"error",message:n.t("There was a problem saving your settings.")})},this)})}},onPreferenceGroupClick:function(e){e.preventDefault();var t=c(e.target),i=t.attr("href");this.$(".preferences-group").removeClass("active"),this.$(i).addClass("active"),this.$(".preferences-nav li").removeClass("active"),t.parent("li").addClass("active")},onPreferenceChange:function(e){var t=c(e.currentTarget),i=e.currentTarget,n=i.value;"checkbox"===i.type&&(n=t.prop("checked")),"int"===t.data("type")&&(n=parseInt(n,10)),this.changes[i.name]=n
},onUpdateStatusChange:function(e,t){"download"===t?(this.$(".download-updates-btn").removeClass("hide"),this.$(".check-updates-btn, .reload-updates-btn, .latest-updates").addClass("hide")):"reload"===t?(this.$(".reload-updates-btn").removeClass("hide"),this.$(".check-updates-btn, .download-updates-btn, .latest-updates").addClass("hide")):"latest"===t?(this.$(".latest-updates").removeClass("hide"),this.$(".check-updates-btn, .download-updates-btn, .reload-updates-btn").addClass("hide")):(this.$(".check-updates-btn").removeClass("hide"),this.$(".download-updates-btn, .reload-updates-btn, .latest-updates").addClass("hide"))
},onDashboardPriorityChange:function(e){this.changes=_.extend(this.changes,e)},onCheckUpdatesClick:function(e){e.preventDefault(),t.trigger("command:CheckForUpdates",!0)},onDownloadUpdatesClick:function(e){e.preventDefault(),t.trigger("command:InstallUpdate")},onReloadUpdatesClick:function(e){e.preventDefault(),window.location.reload(!0)},onKeyboardShortcutsClick:function(e){e.preventDefault(),a.set("modal",new o)},onSubmit:function(e){e.preventDefault(),this.save()},onCancelClick:function(e){e.preventDefault(),t.trigger("navigate:back")
}});return p}),define("plex/desktop/view/server/settings/SettingsView",["hb!templates/desktop/server/settings/SettingsView.tpl","plex/base/control/Dispatcher","plex/base/model/AppModel","plex/base/model/SettingsModel","plex/base/view/BaseView","plex/desktop/view/server/settings/ServerSettingsView","plex/desktop/view/server/settings/PlexWebSettingsView","jquery"],function(e,t,i,n,a,s,r,l){var o=a.extend({className:"container",serverSettings:null,plexWebSettings:null,plexWebActive:!1,events:{"click .media-server-filter":"onMediaServerClick","click .plex-web-filter":"onPlexWebClick","click .standard-toggle":"onStandardToggleClick","click .advanced-toggle":"onAdvancedToggleClick"},initialize:function(){var e=this.model.get("shared");
this.plexWebActive=e||n.get("plexWebSettingsOpen"),this.serverSettings=this.registerView(new s({model:this.model,active:!this.plexWebActive})),this.plexWebSettings=this.registerView(new r({model:n,active:this.plexWebActive})),this.addBinding(t,"shortcut:save",this.save),this.addBinding(i,"change:primaryServer",this.onPrimaryServerChange)},render:function(){return this.$el.html(e({server:this.model.toJSON(),plexWebActive:this.plexWebActive})),this.$(".settings-container").append(this.serverSettings.render().el),this.$(".settings-container").append(this.plexWebSettings.render().el),this
},save:function(){"mediaServer"===this.view?this.serverSettings.save():this.plexWebSettings.save()},onPrimaryServerChange:function(e,i){t.trigger("navigate:settings",{serverID:i.id})},onMediaServerClick:function(e){e.preventDefault(),this.$(".standard-toggle").hasClass("hide"),this.view="mediaServer",this.$(".settings-filter").removeClass("active"),this.$(".media-server-filter").addClass("active"),this.$("#media-server-settings").removeClass("hide"),this.$("#plex-web-settings").addClass("hide"),n.save("plexWebSettingsOpen",!1)
},onPlexWebClick:function(e){e.preventDefault(),this.$(".standard-toggle").hasClass("hide"),this.view="plexWeb",this.$(".settings-filter").removeClass("active"),this.$(".plex-web-filter").addClass("active"),this.$("#media-server-settings").addClass("hide"),this.$("#plex-web-settings").removeClass("hide"),n.save("plexWebSettingsOpen",!0)},onStandardToggleClick:function(e){e.preventDefault(),this.$(".standard-toggle, .standard-prefs, .standard-pref").addClass("hide"),this.$(".advanced-toggle, .advanced-prefs, .advanced-pref").removeClass("hide")
},onAdvancedToggleClick:function(e){e.preventDefault(),this.$(".advanced-prefs").hasClass("active")&&this.$(".preferences-nav").each(function(e,t){l(t).find("li:first a").click()}),this.$(".standard-toggle, .standard-prefs, .standard-pref").removeClass("hide"),this.$(".advanced-toggle, .advanced-prefs, .advanced-pref").addClass("hide")}});return o}),define("hb!templates/desktop/section/SectionView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){return this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{},'<div class="section-container"></div>\n'
})}),define("plex/base/view/section/BaseSectionView",["plex/base/model/SettingsModel","plex/base/view/BaseView"],function(e,t){var i=t.extend({className:"container-fluid",initialize:function(t){var i=this.model.get("media");this.model.get("alphanumeric");var n=this.model.server.id+"!"+this.model.id+"!subset";t.subset||(t.subset=e.get(n)),i.updateSubset(t.subset),e.save(n,i.subset)},onMerge:function(){var e=this.model.get("alphanumeric"),t=this.model.get("recentlyAdded");e.fetch({hideLoadingAlert:!0}),this.list.collection===t&&t.fetch({hideLoadingAlert:!0})
},onSidebarOpen:function(e){this.$(".sidebar").removeClass("hide"),this.$el.addClass("sidebar-open"),this.list.resize&&!e&&this.list.resize()},onSidebarClose:function(){this.$el.removeClass("sidebar-open");var e,t=this.$(".section-container").css("transition-delay").split(", ");_.isArray(t)&&t.length?(e=1e3*_.last(t).replace("s",""),_.delay(_.bind(function(){this.$(".sidebar").addClass("hide"),this.list.resize()},this),e)):(this.$(".sidebar").addClass("hide"),this.list.resize())}});return i}),define("hb!templates/desktop/section/SectionListView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return"well-header-dropdown"
}function r(e,t){var n,a,s,r="";return r+='\n		<ul class="well-header-actions">\n			<li><button type="button" class="edit-btn btn btn-inverse btn-icon" rel="tooltip" title="',s={hash:{},data:t},r+=g((n=i.t||e.t,n?n.call(e,"Edit {1}",(n=e.section,null==n||n===!1?n:n.title),s):m.call(e,"t","Edit {1}",(n=e.section,null==n||n===!1?n:n.title),s)))+'"><i class="glyphicon pencil"></i></button></li>\n			<li>\n				<div class="btn-group btn-group-inverse">\n					<button type="button" class="refresh-section-btn btn btn-inverse btn-icon ',a=i["if"].call(e,(n=e.section,null==n||n===!1?n:n.refreshing),{hash:{},inverse:v.noop,fn:v.program(4,l,t),data:t}),(a||0===a)&&(r+=a),r+='" rel="tooltip" title="',a=i["if"].call(e,(n=e.section,null==n||n===!1?n:n.refreshing),{hash:{},inverse:v.program(8,c,t),fn:v.program(6,o,t),data:t}),(a||0===a)&&(r+=a),r+='"><i class="glyphicon repeat"></i></button>\n					<button type="button" class="btn btn-inverse btn-icon dropdown-toggle" data-toggle="dropdown"><i class="glyphicon-caret small"></i></button>\n\n					<ul class="dropdown-menu pull-right">\n						<li><a class="refresh-btn" data-refresh-type="turbo" href="#">',s={hash:{},data:t},r+=g((n=i.t||e.t,n?n.call(e,"Turbo Scan (Default)",s):m.call(e,"t","Turbo Scan (Default)",s)))+'</a></li>\n						<li><a class="refresh-btn" data-refresh-type="deep" href="#">',s={hash:{},data:t},r+=g((n=i.t||e.t,n?n.call(e,"Deep Scan",s):m.call(e,"t","Deep Scan",s)))+'</a></li>\n					</ul>\n				</div>\n			</li>\n			<li>\n				<div class="btn-group btn-group-inverse">\n					<button type="button" class="btn btn-inverse btn-icon dropdown-toggle" rel="tooltip" data-toggle="dropdown"><span class="btn-icon-label">',s={hash:{},data:t},r+=g((n=i.t||e.t,n?n.call(e,"More",s):m.call(e,"t","More",s)))+'</span> <i class="glyphicon-caret small"></i></button>\n\n					<ul class="maintenance-dropdown-menu dropdown-menu pull-right">\n						<li>\n							<div class="maintenance-control"><button type="button" class="empty-trash-btn btn btn-icon"><i class="glyphicon bin"></i> <span class="btn-icon-label">',s={hash:{},data:t},r+=g((n=i.t||e.t,n?n.call(e,"Empty Trash",s):m.call(e,"t","Empty Trash",s)))+'</span></button></div>\n							<div class="maintenance-summary">',s={hash:{},data:t},r+=g((n=i.t||e.t,n?n.call(e,"By default the media server doesn't remove information for media right away. This helps if a drive is temporarily disconnected. When you empty the trash for a section, all information about missing media is deleted.",s):m.call(e,"t","By default the media server doesn't remove information for media right away. This helps if a drive is temporarily disconnected. When you empty the trash for a section, all information about missing media is deleted.",s)))+'</div>\n						</li>\n						<li>\n							<div class="maintenance-control"><button type="button" class="force-refresh-btn btn btn-icon"><i class="glyphicon restart"></i> <span class="btn-icon-label">',s={hash:{},data:t},r+=g((n=i.t||e.t,n?n.call(e,"Force Refresh",s):m.call(e,"t","Force Refresh",s)))+'</span></button></div>\n							<div class="maintenance-summary">',s={hash:{},data:t},r+=g((n=i.t||e.t,n?n.call(e,"Forces a download of fresh media information from the Internet. This can take a long time. Any locked fields are not modified.",s):m.call(e,"t","Forces a download of fresh media information from the Internet. This can take a long time. Any locked fields are not modified.",s)))+'</div>\n						</li>\n						<li>\n							<div class="maintenance-control"><button type="button" class="analyze-media-btn btn btn-icon"><i class="glyphicon magic"></i> <span class="btn-icon-label">',s={hash:{},data:t},r+=g((n=i.t||e.t,n?n.call(e,"Analyze",s):m.call(e,"t","Analyze",s)))+'</span></button></div>\n							<div class="maintenance-summary">',s={hash:{},data:t},r+=g((n=i.t||e.t,n?n.call(e,"Analyzes all the media files in the library section. The analysis captures information about the media which helps Plex decide how to optimally play back the media.",s):m.call(e,"t","Analyzes all the media files in the library section. The analysis captures information about the media which helps Plex decide how to optimally play back the media.",s)))+'</div>\n						</li>\n						<li>\n							<div class="maintenance-control"><button type="button" class="delete-btn btn btn-danger btn-icon"><i class="glyphicon ban"></i> <span class="btn-icon-label">',s={hash:{},data:t},r+=g((n=i.t||e.t,n?n.call(e,"Delete",s):m.call(e,"t","Delete",s)))+'</span></button></div>\n							<div class="maintenance-summary">',s={hash:{},data:t},r+=g((n=i.t||e.t,n?n.call(e,"Removes a library section and all items inside. It does not delete any media files. View progress and ratings are preserved, in case any of the items are added in the future.",s):m.call(e,"t","Removes a library section and all items inside. It does not delete any media files. View progress and ratings are preserved, in case any of the items are added in the future.",s)))+"</div>\n						</li>\n					</ul>\n				</div>\n			</li>\n		</ul>\n	"
}function l(){return"active"}function o(e,t){var n,a;return a={hash:{},data:t},g((n=i.t||e.t,n?n.call(e,"Stop Refresh",a):m.call(e,"t","Stop Refresh",a)))}function c(e,t){var n,a;return a={hash:{},data:t},g((n=i.t||e.t,n?n.call(e,"Refresh {1}",(n=e.section,null==n||n===!1?n:n.title),a):m.call(e,"t","Refresh {1}",(n=e.section,null==n||n===!1?n:n.title),a)))}function d(e,t){var n;return(n=i.count)?n=n.call(e,{hash:{},data:t}):(n=e.count,n=typeof n===y?n.apply(e):n),g(n)}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};
var h,u,p,f="",m=i.helperMissing,g=this.escapeExpression,v=this,y="function";return f+='<div class="section-well-header well-header ',h=i.unless.call(t,t.limited,{hash:{},inverse:v.noop,fn:v.program(1,s,a),data:a}),(h||0===h)&&(f+=h),f+='">\n	',h=i.unless.call(t,t.limited,{hash:{},inverse:v.noop,fn:v.program(3,r,a),data:a}),(h||0===h)&&(f+=h),f+='\n\n	<h3>\n		<span class="section-list-title">',p={hash:{},data:a},f+=g((h=i.truncate||t.truncate,h?h.call(t,t.title,20,p):m.call(t,"truncate",t.title,20,p)))+'</span> <span class="well-header-count">',u=i["if"].call(t,t.count,{hash:{},inverse:v.noop,fn:v.program(10,d,a),data:a}),(u||0===u)&&(f+=u),f+='</span>\n\n		<button type="button" class="clear-filters-btn btn btn-inverse btn-icon hide"><i class="glyphicon circle-minus"></i> <span class="btn-icon-label">',p={hash:{},data:a},f+=g((h=i.t||t.t,h?h.call(t,"Clear Filters",p):m.call(t,"t","Clear Filters",p)))+'</span></button>\n	</h3>\n</div>\n\n<div class="section-list-scroll-container minimal-scrollbar"></div>\n\n<div class="well-header-shadow hidden"></div>\n<div class="section-loading-overlay hidden"><div class="spinner-container"></div></div>\n'
})}),define("plex/base/view/section/BaseSectionListView",["plex/base/model/SettingsModel","plex/base/view/BaseView"],function(e,t){var i=t.extend({listType:"media-tile-list",initialize:function(){this.addBinding(e,"change:listType",this.onListTypeChange)},destroy:function(){t.prototype.destroy.call(this),this.collection.release()},updateListType:function(t){e.save("listType",t),this.listType=t,this.collection.scrollPosition=0;var i=this.getListConstructor(t);this.removeView(this.list),this.list=this.registerView(new i({collection:this.collection,focused:!0})),this.$list.html(this.list.render().el)
},onListTypeChange:function(e,t){this.updateListType(t)}});return i}),define("plex/desktop/view/lists/media/MediaList",["plex/desktop/view/lists/VirtualList","plex/desktop/view/lists/media/items/MediaListItem"],function(e,t){var i=e.extend({tagName:"ul",className:"list media-list virtual-media-list",focusOptions:{position:3,cancellationDirections:["left","right"]},rowsPadding:20,initialize:function(){this.setup(t)},render:function(){return this.$el.empty(),this.populate(this.collection),this}});return i
}),define("hb!templates/desktop/lists/media/items/MediaCompactListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a,s="";return s+='\n	<a href="#!/servers/',(n=i.serverID)?n=n.call(e,{hash:{},data:t}):(n=e.serverID,n=typeof n===T?n.apply(e):n),s+=M(n)+"/sections/",a={hash:{},data:t},s+=M((n=i.encodeUrl||e.encodeUrl,n?n.call(e,e.sectionID,a):P.call(e,"encodeUrl",e.sectionID,a)))+"/folder?key=",a={hash:{},data:t},s+=M((n=i.encodeUrl||e.encodeUrl,n?n.call(e,(n=e.media,null==n||n===!1?n:n.key),a):P.call(e,"encodeUrl",(n=e.media,null==n||n===!1?n:n.key),a)))+'" data-focus="keyboard">\n'
}function r(e,t){var n,a,s,r="";return r+='\n	<a href="#!/servers/',(n=i.serverID)?n=n.call(e,{hash:{},data:t}):(n=e.serverID,n=typeof n===T?n.apply(e):n),r+=M(n)+"/sections/",s={hash:{},data:t},r+=M((n=i.encodeUrl||e.encodeUrl,n?n.call(e,e.sectionID,s):P.call(e,"encodeUrl",e.sectionID,s)))+"/details/",a=i["if"].call(e,(n=e.media,null==n||n===!1?n:n.originalRatingKey),{hash:{},inverse:D.program(6,o,t),fn:D.program(4,l,t),data:t}),(a||0===a)&&(r+=a),r+='" data-focus="keyboard">\n'}function l(e){var t;
return M((t=e.media,t=null==t||t===!1?t:t.originalRatingKey,typeof t===T?t.apply(e):t))}function o(e){var t;return M((t=e.media,t=null==t||t===!1?t:t.ratingKey,typeof t===T?t.apply(e):t))}function c(){return'\n		<div class="media-added-at sorted-by"></div>\n	'}function d(e,t){var n,a,s;return s={hash:{},inverse:D.program(13,u,t),fn:D.program(11,h,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,e.sort,"originallyAvailableAt",s):P.call(e,"if_eq",e.sort,"originallyAvailableAt",s),a||0===a?a:""}function h(){return'\n		<div class="media-available-at sorted-by"></div>\n	'
}function u(e,t){var n,a,s;return s={hash:{},inverse:D.program(16,f,t),fn:D.program(14,p,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,e.sort,"mediaHeight",s):P.call(e,"if_eq",e.sort,"mediaHeight",s),a||0===a?a:""}function p(){return'\n		<div class="media-resolution sorted-by"></div>\n	'}function f(e,t){var n,a,s;return s={hash:{},inverse:D.program(19,g,t),fn:D.program(17,m,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,e.sort,"duration",s):P.call(e,"if_eq",e.sort,"duration",s),a||0===a?a:""}function m(){return'\n		<div class="media-duration sorted-by"></div>\n	'
}function g(e,t){var n,a,s;return s={hash:{},inverse:D.program(20,v,t),fn:D.program(17,m,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,(n=e.media,null==n||n===!1?n:n.type),"track",s):P.call(e,"if_eq",(n=e.media,null==n||n===!1?n:n.type),"track",s),a||0===a?a:""}function v(){return'\n		<span class="media-rating rating sorted-by"></span>\n	'}function y(){return'\n		<i class="folder-icon glyphicon folder-open"></i>\n	'}function b(){return'\n		<span class="media-subtitle subtitle"></span>\n	'}function w(e,t){var n,a,s;
return s={hash:{},inverse:D.program(27,x,t),fn:D.program(24,b,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,(n=e.media,null==n||n===!1?n:n.type),"episode",s):P.call(e,"if_eq",(n=e.media,null==n||n===!1?n:n.type),"episode",s),a||0===a?a:""}function x(e,t){var n,a,s;return s={hash:{},inverse:D.program(28,k,t),fn:D.program(24,b,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,(n=e.media,null==n||n===!1?n:n.type),"album",s):P.call(e,"if_eq",(n=e.media,null==n||n===!1?n:n.type),"album",s),a||0===a?a:""}function k(e,t){var n,a,s;
return s={hash:{},inverse:D.program(29,S,t),fn:D.program(24,b,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,(n=e.media,null==n||n===!1?n:n.type),"track",s):P.call(e,"if_eq",(n=e.media,null==n||n===!1?n:n.type),"track",s),a||0===a?a:""}function S(){return'\n		<span class="media-year subtitle"></span>\n	'}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var C,_,A,I="",T="function",M=this.escapeExpression,P=i.helperMissing,D=this;return _=i["if"].call(t,(C=t.media,null==C||C===!1?C:C.folder),{hash:{},inverse:D.program(3,r,a),fn:D.program(1,s,a),data:a}),(_||0===_)&&(I+=_),I+='\n	<input type="checkbox" class="multiselect" name="selected">\n\n	',A={hash:{},inverse:D.program(10,d,a),fn:D.program(8,c,a),data:a},C=i.if_eq||t.if_eq,_=C?C.call(t,t.sort,"addedAt",A):P.call(t,"if_eq",t.sort,"addedAt",A),(_||0===_)&&(I+=_),I+="\n\n	",_=i["if"].call(t,(C=t.media,null==C||C===!1?C:C.folder),{hash:{},inverse:D.noop,fn:D.program(22,y,a),data:a}),(_||0===_)&&(I+=_),I+='\n\n	<span class="media-title title"></span>\n	',A={hash:{},inverse:D.program(26,w,a),fn:D.program(24,b,a),data:a},C=i.if_eq||t.if_eq,_=C?C.call(t,(C=t.media,null==C||C===!1?C:C.type),"season",A):P.call(t,"if_eq",(C=t.media,null==C||C===!1?C:C.type),"season",A),(_||0===_)&&(I+=_),I+="\n</a>\n"
})}),define("plex/desktop/view/lists/media/items/MediaCompactListItem",["hb!templates/desktop/lists/media/items/MediaCompactListItem.tpl","plex/base/control/Dispatcher","plex/base/view/BaseView","plex/base/view/Rating","jquery"],function(e,t,i,n,a){var s=i.extend({tagName:"li",className:"hide-hover-overlay",visible:!1,list:null,sort:null,rating:null,events:{"click a":"onClick"},initialize:function(e){var t=e.list.collection;this.visible=!e.list.virtual||e.visible,this.list=e.list,this.sort=t.sort.key,this.rating=this.registerView(new n({model:this.model,disabled:!0}))
},render:function(){if(!this.model||!this.visible)return this;var t=this.model.section?this.model.section.id:this.model.get("librarySectionID");return this.$el.html(e({serverID:this.model.server.id,sectionID:t,media:this.model.toJSON(),sort:this.sort})),this.$(".media-rating").append(this.rating.render().el),this.bindView(),this},show:function(){this.visible||(this.visible=!0,this.rating.setup(this.model),this.render())},hide:function(){this.visible&&(this.visible=!1,this.$el.empty())},select:function(){this.$("a").addClass("selected"),this.$(".multiselect").prop("checked",!0)
},deselect:function(){this.$("a").removeClass("selected"),this.$(".multiselect").prop("checked",!1)},bindings:{".media-title":{modelAttr:"title",format:function(e,t){var i=this.model.get("type");switch(i){case"season":case"album":t=this.model.get("parentTitle");break;case"episode":t=this.model.get("grandparentTitle");break;case"track":t=this.model.get("grandparentTitle")||this.model.get("originalTitle")}return Handlebars.helpers.truncate.call(this,t,50)}},".media-subtitle":{modelAttr:"title",format:function(e,t){var i=this.model.get("type");
if(/^(season|episode|album|track)$/.test(i))return Handlebars.helpers.truncate.call(this,t,50)}},".media-year":{modelAttr:"year"},".media-added-at":{modelAttr:"addedAt",hideEmpty:!0,format:function(e,t){return Handlebars.helpers.timeAgo.call(this,t)}},".media-available-at":{modelAttr:"originallyAvailableAt",hideEmpty:!0,format:function(e,t){return Handlebars.helpers.formatDate.call(this,t)}},".media-resolution":{modelAttr:"Media",hideEmpty:!0,format:function(e,t){return t&&t.length?Handlebars.helpers.formatResolution.call(this,t[0].videoResolution):""
}},".media-duration":{modelAttr:"duration",hideEmpty:!0,format:function(e,t){return Handlebars.helpers.formatMinutes.call(this,t)}}},onClick:function(e){if(e.metaKey||e.ctrlKey||e.shiftKey)return e.preventDefault(),this.trigger("select",this,e.shiftKey),void 0;if(this.list.editing){e.preventDefault();var i=this.$(".multiselect"),n=i.prop("checked");return a(e.target)[0]===i[0]&&(n=!n,_.defer(function(){i.prop("checked",!n)})),n?this.trigger("deselect",this):this.trigger("select",this,!1),void 0}var s=this.model.get("type");
return"track"===s?(e.preventDefault(),t.trigger("command:PlayTrack",this.model),void 0):"photo"===s?(e.preventDefault(),t.trigger("show:photo",this.list.collection,this.model),void 0):void 0}});return s}),define("plex/desktop/view/lists/media/MediaCompactList",["plex/desktop/view/lists/VirtualList","plex/desktop/view/lists/media/items/MediaCompactListItem"],function(e,t){var i=e.extend({tagName:"ul",className:"list media-list media-compact-list",focusOptions:{position:3,cancellationDirections:["left","right"]},rowsPadding:50,initialize:function(){this.setup(t)
},render:function(){return this.$el.empty(),this.populate(this.collection),this}});return i}),define("hb!templates/desktop/lists/sidebar/items/AlphanumericListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var s,r="",l="function",o=this.escapeExpression;return r+='<a class="gray" href="#" data-focus="keyboard">',(s=i.title)?s=s.call(t,{hash:{},data:a}):(s=t.title,s=typeof s===l?s.apply(t):s),r+=o(s)+"</a>\n"
})}),define("plex/desktop/view/lists/sidebar/items/AlphanumericListItem",["hb!templates/desktop/lists/sidebar/items/AlphanumericListItem.tpl","plex/base/control/Dispatcher","plex/base/view/BaseView"],function(e,t,i){var n=i.extend({tagName:"li",events:{click:"onClick"},initialize:function(){this.addBinding(this.model,"change",this.render)},render:function(){return this.$el.html(e(this.model.toJSON())),this},onClick:function(e){e.preventDefault(),t.trigger("change:firstCharacter",this.model)}});return n
}),define("plex/desktop/view/lists/sidebar/AlphanumericList",["plex/base/view/lists/FocusList","plex/desktop/view/lists/sidebar/items/AlphanumericListItem"],function(e,t){var i=e.extend({tagName:"ul",className:"alphanumeric-list",listHeight:0,focusOptions:{position:4,cancellationDirections:"left"},initialize:function(){this.setup(t)},render:function(){return this.$el.empty(),this.populate(this.collection),this},reset:function(){this.listHeight&&this.setLineHeight(),e.prototype.reset.apply(this,arguments)
},setListHeight:function(e){this.listHeight=e,this.collection.length&&this.setLineHeight()},setLineHeight:function(){var e=this.listHeight/this.collection.length;this.$el.css("line-height",e+"px")}});return i}),define("plex/desktop/view/section/SectionListView",["hb!templates/desktop/section/SectionListView.tpl","plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/control/utils/StringUtil","plex/base/model/AppModel","plex/base/model/SettingsModel","plex/base/view/section/BaseSectionListView","plex/desktop/view/lists/media/MediaTileList","plex/desktop/view/lists/media/MediaList","plex/desktop/view/lists/media/MediaCompactList","plex/desktop/view/lists/sidebar/AlphanumericList","plex/desktop/view/modals/EditSectionModal","jquery","spin"],function(e,t,i,n,a,s,r,l,o,c,d,h,u){var p=r.extend({className:"section-list-container well",infiniteScroll:!1,loading:!1,listening:!0,mergeDelay:5e3,resizeDelay:500,events:{"click .section-list-scroll-container":"onListClick","click .clear-filters-btn":"onClearFiltersClick","click .edit-btn":"onEditClick","click .refresh-btn":"onRefreshClick","click .refresh-section-btn":"onRefreshClick","click .empty-trash-btn":"onEmptyTrashClick","click .force-refresh-btn":"onForceRefreshClick","click .analyze-media-btn":"onAnalyzeMediaClick","click .delete-btn":"onDeleteClick"},initialize:function(e){r.prototype.initialize.apply(this,arguments);
var i=this.model.get("limited");this.model.get("media");var n=this.model.get("alphanumeric");this.infiniteScroll=e.infiniteScroll&&!i,this.loading=!1,this.listening=!0,this.listType=e.listType||s.get("listType");var a=this.getListConstructor(this.listType);this.list=this.registerView(new a({collection:this.collection,virtual:!0,infiniteScroll:this.infiniteScroll,focused:!0})),i||"all"!==this.collection.subset||(this.alphanumericList=this.registerView(new d({collection:n}))),this.mergeThrottle=_.throttle(this.merge,this.mergeDelay),this.resizeDebounce=_.debounce(this.resize,this.resizeDelay),this.addBinding(this.collection,"reset",this.onReset),this.addBinding(this.collection,"merge",this.onMerge),this.addBinding(n,"reset",this.onAlphanumericReset),this.addBinding(this.list,"change:loading",this.onLoadingChange),this.addBinding(this.list,"change:scrollPosition",this.onScrollPositionChange),this.addBinding(this.list,"change:selectedItems",this.onSelectedItemsChange),this.addBinding(this.model,"timeline",this.onSectionTimeline),this.addBinding(this.model,"change:refreshing",this.onRefreshingChange),this.addBinding(this.model,"change:title",this.onTitleChange),this.addBinding(t,"change:firstCharacter",this.onFirstCharacter),this.addBinding(t,"shortcut:edit",this.editSection),this.addBinding(t,"shortcut:refresh",this.refreshSection),this.addBinding(t,"shortcut:deleteItem",this.deleteSection),_.bindAll(this,"onResize"),u(window).on("resize",this.onResize)
},render:function(){var t=this.model.get("limited")||this.model.server.get("shared"),i=this.collection.totalSize||this.collection.length;return this.$el.html(e({section:this.model.toJSON(),title:this.model.getFilteredTitle(),limited:t,count:i})),this.$el.tooltip({selector:".btn-icon",placement:"bottom"}),this.$list=this.$(".section-list-scroll-container"),this.$list.html(this.list.render().el),this.alphanumericList&&this.$el.append(this.alphanumericList.render().el),this.model.get("refreshing")&&this.$(".refresh-section-btn").spinContents("tiny"),this
},postrender:function(){if(this.alphanumericList){var e=this.model.get("alphanumeric"),t=this.$list.height();this.alphanumericList&&this.alphanumericList.setListHeight(t),e.populatePromise&&"resolved"===e.populatePromise.state()?this.onAlphanumericReset(e):e.fetch()}},destroy:function(){r.prototype.destroy.call(this),u(window).off("resize",this.onResize),this.listening=!1},resize:function(){_.delay(_.bind(function(){this.list.measure(),this.list.virtualize()},this),500)},merge:function(){this.listening&&this.collection.merge()
},getListConstructor:function(e){switch(e){case"media-tile-list":return l;case"media-list":return o;case"media-compact-list":return c;default:return this.listType="media-tile-list",s.save("listType",this.listType),l}},updateListType:function(e){s.save("listType",e),this.listType=e,this.collection.scrollPosition=0;var t=this.getListConstructor(e),i=this.list.$el.hasClass("editing"),n=this.$el.hasClass("show-alphanumeric-list");this.removeView(this.list),this.removeBinding(this.list,"change:loading"),this.removeBinding(this.list,"change:scrollPosition"),this.removeBinding(this.list,"change:selectedItems"),this.list=this.registerView(new t({collection:this.collection,focused:!0,virtual:!0,infiniteScroll:this.infiniteScroll})),this.addBinding(this.list,"change:loading",this.onLoadingChange),this.addBinding(this.list,"change:scrollPosition",this.onScrollPositionChange),this.addBinding(this.list,"change:selectedItems",this.onSelectedItemsChange),i&&this.trigger("change:selectedModels",[]),n&&this.list.$el.addClass("show-alphanumeric-list"),this.$list.html(this.list.render().el)
},edit:function(){this.list.editing=!0,this.list.$el.addClass("editing")},unedit:function(){this.list.editing=!1,this.list.$el.removeClass("editing")},deselectAll:function(){this.list.deselectAll()},editSection:function(e){(e||!this.list.editing)&&a.set("modal",new h({server:this.model.server,section:this.model}))},refreshSection:function(e,i){(e||!this.list.editing)&&t.trigger("command:StartLibraryScan",this.model.server,this.model,i)},deleteSection:function(e){(e||!this.list.editing)&&t.trigger("command:DeleteSection",this.model,function(){t.trigger("navigate:dashboard")
})},onListClick:function(e){var t=this.$(".section-list-scroll-container")[0],i=u(e.target).parent()[0];t===i&&this.list.deselectAll()},onClearFiltersClick:function(e){e.preventDefault(),t.trigger("reset:filter")},onEditClick:function(e){e.preventDefault(),this.editSection(!0)},onRefreshClick:function(e){e.preventDefault();var i=this.$(".refresh-section-btn");if(i.hasClass("active"))i.removeClass("active"),t.trigger("command:StopLibraryScan",this.model.server,this.model);else{i.addClass("active");
var n={},a=u(e.target).data("refreshType");a?n[a]=!0:e.altKey&&(n.deep=!0),this.refreshSection(!0,n)}},onEmptyTrashClick:function(e){e.preventDefault(),t.trigger("command:EmptyTrash",this.model.server,this.model)},onForceRefreshClick:function(e){e.preventDefault(),t.trigger("command:StartLibraryScan",this.model.server,this.model,{force:!0})},onAnalyzeMediaClick:function(e){e.preventDefault(),t.trigger("command:StartMediaAnalysis",this.model.server,this.model)},onDeleteClick:function(e){e.preventDefault(),this.deleteSection(!0)
},onReset:function(e){var t=e.filters,i=n.truncate(this.model.getFilteredTitle(),20),a=e.totalSize||e.length;if(this.$(".section-list-title").text(i),a?this.$(".well-header-count").text(a):this.$(".well-header-count").text(""),this.$(".clear-filters-btn").addClass("hide"),e.search)this.$(".clear-filters-btn").removeClass("hide");else{var s=!1;_.each(t,function(e){e.values.length&&(s=!0)}),(e.firstCharacter||s)&&this.$(".clear-filters-btn").removeClass("hide")}},onMerge:function(e,t){e&&(t||(t=e.length),t?this.$(".well-header-count").text(t):this.$(".well-header-count").text(""))
},onAlphanumericReset:function(e){this.alphanumericList&&(12>e.length?(this.$el.removeClass("show-alphanumeric-list"),this.alphanumericList.$el.addClass("hide")):(this.$el.addClass("show-alphanumeric-list"),this.alphanumericList.$el.removeClass("hide")))},onLoadingChange:function(e,t){var i=this.$(".spinner-container"),n=this.$(".section-loading-overlay");e?(t?n.addClass("top"):n.removeClass("top"),i.spinContents("small","#ddd"),n.removeClass("hidden")):(i.spinContents(!1),n.addClass("hidden"))},onScrollPositionChange:function(e){e>5?this.$(".well-header-shadow").removeClass("hidden"):this.$(".well-header-shadow").addClass("hidden")
},onSelectedItemsChange:function(e){this.trigger("change:selectedModels",_.pluck(e,"model"))},onSectionTimeline:function(e){0!==e.state||"folder"!==this.collection.subset&&e.type!==this.collection.mediaType||this.mergeThrottle()},onRefreshingChange:function(e,t){var n=this.$(".refresh-section-btn"),a=i.t("Refresh {1}",this.model.get("title")),s=i.t("Stop Refresh");t?(n.spinContents("tiny"),n.prop("title",s).tooltip("fixTitle")):(n.spinContents(!1),n.prop("title",a).tooltip("fixTitle"))},onTitleChange:function(e,t){var n=i.t("Edit {1}",t),a=i.t("Refresh {1}",t);
this.$(".edit-btn").prop("title",n).tooltip("fixTitle"),this.$(".refresh-section-btn").attr("data-original-title")!==i.t("Stop Refresh")&&this.$(".refresh-section-btn").prop("title",a).tooltip("fixTitle")},onFirstCharacter:function(e){for(var t=this.model.get("alphanumeric"),i=0,n=0,a=t.length;a>n;n++){var s=t.at(n);if(e.id===s.id)break;i+=s.get("size")}this.list.scrollToIndex(i)},onResize:function(){this.alphanumericList&&this.alphanumericList.setListHeight(this.list.scrollContainerHeight),this.resizeDebounce()
}});return p}),define("hb!templates/desktop/section/SectionActionBarView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return"hide"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var r,l,o,c="",d=this,h=i.helperMissing,u=this.escapeExpression;return c+='<div class="actionbar">\n	<ul class="iconbar">\n		<li class="options-action ',r=i.unless.call(t,t.showOptions,{hash:{},inverse:d.noop,fn:d.program(1,s,a),data:a}),(r||0===r)&&(c+=r),c+='">\n			<a class="iconbar-glyphicon-btn options-icon-btn" href="#" rel="tooltip" data-tooltip-position="fixed" data-focus="keyboard" title="',o={hash:{},data:a},c+=u((r=i.t||t.t,r?r.call(t,"Options",o):h.call(t,"t","Options",o)))+'">\n				<i class="glyphicon show-lines"></i>\n			</a>\n		</li>\n\n		<li class="select-action ',l=i.unless.call(t,t.showSelect,{hash:{},inverse:d.noop,fn:d.program(1,s,a),data:a}),(l||0===l)&&(c+=l),c+='">\n			<a class="iconbar-glyphicon-btn select-icon-btn" href="#" rel="tooltip" data-tooltip-position="fixed" data-focus="keyboard" title="',o={hash:{},data:a},c+=u((r=i.t||t.t,r?r.call(t,"Select Items",o):h.call(t,"t","Select Items",o)))+'">\n				<i class="glyphicon check"></i>\n			</a>\n		</li>\n\n		<li class="deselect-action ',l=i.unless.call(t,t.showDeselect,{hash:{},inverse:d.noop,fn:d.program(1,s,a),data:a}),(l||0===l)&&(c+=l),c+='">\n			<a class="iconbar-glyphicon-btn deselect-icon-btn" href="#" rel="tooltip" data-tooltip-position="fixed" data-focus="keyboard" title="',o={hash:{},data:a},c+=u((r=i.t||t.t,r?r.call(t,"Deselect Items",o):h.call(t,"t","Deselect Items",o)))+'">\n				<i class="glyphicon unchecked"></i>\n			</a>\n		</li>\n\n		<li class="refresh-action ',l=i.unless.call(t,t.showRefresh,{hash:{},inverse:d.noop,fn:d.program(1,s,a),data:a}),(l||0===l)&&(c+=l),c+='">\n			<a class="iconbar-glyphicon-btn refresh-icon-btn" href="#" rel="tooltip" data-tooltip-position="fixed" data-focus="keyboard" title="',o={hash:{},data:a},c+=u((r=i.t||t.t,r?r.call(t,"Refresh",o):h.call(t,"t","Refresh",o)))+'">\n				<i class="glyphicon repeat"></i>\n			</a>\n		</li>\n\n		<li class="analyze-action ',l=i.unless.call(t,t.showAnalyze,{hash:{},inverse:d.noop,fn:d.program(1,s,a),data:a}),(l||0===l)&&(c+=l),c+='">\n			<a class="iconbar-glyphicon-btn analyze-icon-btn" href="#" rel="tooltip" data-tooltip-position="fixed" data-focus="keyboard" title="',o={hash:{},data:a},c+=u((r=i.t||t.t,r?r.call(t,"Analyze",o):h.call(t,"t","Analyze",o)))+'">\n				<i class="glyphicon magic"></i>\n			</a>\n		</li>\n\n		<li class="add-to-collection-action ',l=i.unless.call(t,t.showAddToCollection,{hash:{},inverse:d.noop,fn:d.program(1,s,a),data:a}),(l||0===l)&&(c+=l),c+='">\n			<a class="iconbar-glyphicon-btn add-collection-icon-btn" href="#" rel="tooltip" data-tooltip-position="fixed" data-focus="keyboard" title="',o={hash:{},data:a},c+=u((r=i.t||t.t,r?r.call(t,"Add to Collection",o):h.call(t,"t","Add to Collection",o)))+'">\n				<i class="glyphicon folder-plus"></i>\n			</a>\n		</li>\n\n		<li class="watch-action ',l=i.unless.call(t,t.showWatch,{hash:{},inverse:d.noop,fn:d.program(1,s,a),data:a}),(l||0===l)&&(c+=l),c+='">\n			<a class="actionbar-icon-btn watch-icon-btn" href="#" rel="tooltip" data-tooltip-position="fixed" data-focus="keyboard" title="',o={hash:{},data:a},c+=u((r=i.t||t.t,r?r.call(t,"Mark as Watched",o):h.call(t,"t","Mark as Watched",o)))+'">\n				',o={hash:{},data:a},c+=u((r=i.t||t.t,r?r.call(t,"Mark as Watched",o):h.call(t,"t","Mark as Watched",o)))+'\n			</a>\n		</li>\n\n		<li class="unwatch-action ',l=i.unless.call(t,t.showWatch,{hash:{},inverse:d.noop,fn:d.program(1,s,a),data:a}),(l||0===l)&&(c+=l),c+='">\n			<a class="actionbar-icon-btn unwatch-icon-btn" href="#" rel="tooltip" data-tooltip-position="fixed" data-focus="keyboard" title="',o={hash:{},data:a},c+=u((r=i.t||t.t,r?r.call(t,"Mark as Unwatched",o):h.call(t,"t","Mark as Unwatched",o)))+'">\n				',o={hash:{},data:a},c+=u((r=i.t||t.t,r?r.call(t,"Mark as Unwatched",o):h.call(t,"t","Mark as Unwatched",o)))+'\n			</a>\n		</li>\n\n		<li class="merge-action ',l=i.unless.call(t,t.showMerge,{hash:{},inverse:d.noop,fn:d.program(1,s,a),data:a}),(l||0===l)&&(c+=l),c+='">\n			<a class="iconbar-glyphicon-btn merge-icon-btn" href="#" rel="tooltip" data-tooltip-position="fixed" data-focus="keyboard" title="',o={hash:{},data:a},c+=u((r=i.t||t.t,r?r.call(t,"Merge",o):h.call(t,"t","Merge",o)))+'">\n				<i class="glyphicon resize-small"></i>\n			</a>\n		</li>\n\n		<li class="sync-action ',l=i.unless.call(t,t.showSync,{hash:{},inverse:d.noop,fn:d.program(1,s,a),data:a}),(l||0===l)&&(c+=l),c+='">\n			<a class="iconbar-glyphicon-btn sync-icon-btn" href="#" rel="tooltip" data-tooltip-position="fixed" data-focus="keyboard" title="',o={hash:{},data:a},c+=u((r=i.t||t.t,r?r.call(t,"Sync to Device",o):h.call(t,"t","Sync to Device",o)))+'">\n				<i class="glyphicon download"></i>\n			</a>\n		</li>\n	</ul>\n</div>\n'
})}),define("hb!templates/desktop/section/SidebarView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return"selected active"}function r(e,t){var n,a,r,l="";return l+='\n		<button type="button" class="folder-btn btn btn-icon ',r={hash:{},inverse:g.noop,fn:g.program(1,s,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,e.subset,"folder",r):v.call(e,"if_eq",e.subset,"folder",r),(a||0===a)&&(l+=a),l+='" data-focus="keyboard" rel="tooltip" title="',r={hash:{},data:t},l+=y((n=i.t||e.t,n?n.call(e,"By Folder",r):v.call(e,"t","By Folder",r)))+'">\n			<i class="glyphicon folder-open"></i>\n		</button>\n	'
}function l(e,t){var n,a,s="";return s+='\n	<h2 class="sidebar-header media-header">',a={hash:{},data:t},s+=y((n=i.truncate||e.truncate,n?n.call(e,(n=e.section,null==n||n===!1?n:n.title),20,a):v.call(e,"truncate",(n=e.section,null==n||n===!1?n:n.title),20,a)))+"</h2>\n"}function o(){return"disabled"}function c(e,t){var n;return n=i["if"].call(e,e.showTypes,{hash:{},inverse:g.noop,fn:g.program(10,d,t),data:t}),n||0===n?n:""}function d(e,t){var n,a,s="";return s+='\n		<h2 class="sidebar-header type-header">',a={hash:{},data:t},s+=y((n=i.t||e.t,n?n.call(e,"Type",a):v.call(e,"t","Type",a)))+"</h2>\n	"
}function h(e,t){var n,a,s="";return s+='\n		<h2 class="sidebar-header sort-header">',a={hash:{},data:t},s+=y((n=i.t||e.t,n?n.call(e,"Sort",a):v.call(e,"t","Sort",a)))+"</h2>\n	"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var u,p,f,m="",g=this,v=i.helperMissing,y=this.escapeExpression;return m+='<div class="list-types-container">\n	<div class="btn-group" data-toggle="buttons-radio">\n		<button type="button" class="media-tile-list-btn btn btn-icon ',f={hash:{},inverse:g.noop,fn:g.program(1,s,a),data:a},u=i.if_eq||t.if_eq,p=u?u.call(t,t.listType,"media-tile-list",f):v.call(t,"if_eq",t.listType,"media-tile-list",f),(p||0===p)&&(m+=p),m+='" data-focus="keyboard" rel="tooltip" title="',f={hash:{},data:a},m+=y((u=i.t||t.t,u?u.call(t,"Tiles",f):v.call(t,"t","Tiles",f)))+'">\n			<i class="glyphicon show-big-thumbnails"></i>\n		</button>\n\n		<button type="button" class="media-list-btn btn btn-icon ',f={hash:{},inverse:g.noop,fn:g.program(1,s,a),data:a},u=i.if_eq||t.if_eq,p=u?u.call(t,t.listType,"media-list",f):v.call(t,"if_eq",t.listType,"media-list",f),(p||0===p)&&(m+=p),m+='" data-focus="keyboard" rel="tooltip" title="',f={hash:{},data:a},m+=y((u=i.t||t.t,u?u.call(t,"Details",f):v.call(t,"t","Details",f)))+'">\n			<i class="glyphicon list"></i>\n		</button>\n\n		<button type="button" class="media-compact-list-btn btn btn-icon ',f={hash:{},inverse:g.noop,fn:g.program(1,s,a),data:a},u=i.if_eq||t.if_eq,p=u?u.call(t,t.listType,"media-compact-list",f):v.call(t,"if_eq",t.listType,"media-compact-list",f),(p||0===p)&&(m+=p),m+='" data-focus="keyboard" rel="tooltip" title="',f={hash:{},data:a},m+=y((u=i.t||t.t,u?u.call(t,"List",f):v.call(t,"t","List",f)))+'">\n			<i class="glyphicon justify"></i>\n		</button>\n	</div>\n\n	',p=i.unless.call(t,(u=t.section,null==u||u===!1?u:u.limited),{hash:{},inverse:g.noop,fn:g.program(3,r,a),data:a}),(p||0===p)&&(m+=p),m+="\n</div>\n\n",p=i.unless.call(t,(u=t.section,null==u||u===!1?u:u.limited),{hash:{},inverse:g.noop,fn:g.program(5,l,a),data:a}),(p||0===p)&&(m+=p),m+='\n\n<div class="sidebar-all-container ',f={hash:{},inverse:g.noop,fn:g.program(7,o,a),data:a},u=i.if_neq||t.if_neq,p=u?u.call(t,t.subset,"all",f):v.call(t,"if_neq",t.subset,"all",f),(p||0===p)&&(m+=p),m+='">\n	',p=i.unless.call(t,(u=t.section,null==u||u===!1?u:u.limited),{hash:{},inverse:g.noop,fn:g.program(9,c,a),data:a}),(p||0===p)&&(m+=p),m+='\n\n	<h2 class="sidebar-header filter-header">\n		<a class="close-filter-options-btn gray" href="#" data-focus="keyboard"><i class="glyphicon circle-remove"></i></a>\n		<span class="filter-header-title">',f={hash:{},data:a},m+=y((u=i.t||t.t,u?u.call(t,"Filter",f):v.call(t,"t","Filter",f)))+"</span>\n	</h2>\n\n	",p=i.unless.call(t,(u=t.section,null==u||u===!1?u:u.limited),{hash:{},inverse:g.noop,fn:g.program(12,h,a),data:a}),(p||0===p)&&(m+=p),m+="\n</div>\n"
})}),define("hb!templates/desktop/section/FilterOptionView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var s,r,l="",o=i.helperMissing,c=this.escapeExpression;return l+='<div class="search-container">\n	<form class="search-form">\n		<input type="text" class="input-dark input-search" autocomplete="off" spellcheck="false">\n		<i class="glyphicon search"></i>\n		<a class="clear-search-btn gray hide" href="#"><i class="glyphicon circle-remove"></i></a>\n	</form>\n	<a class="deselect-btn gray" href="#">',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Deselect All",r):o.call(t,"t","Deselect All",r)))+"</a>\n</div>\n"
})}),define("hb!templates/desktop/lists/sidebar/items/FilterOptionListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return"selected"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var r,l="",o=this,c="function",d=this.escapeExpression;return l+='<a class="gray ',r=i["if"].call(t,t.selected,{hash:{},inverse:o.noop,fn:o.program(1,s,a),data:a}),(r||0===r)&&(l+=r),l+='" href="#" data-focus="keyboard">'+d((r=t.option,r=null==r||r===!1?r:r.title,typeof r===c?r.apply(t):r))+' <i class="glyphicon ok-2"></i></a>\n'
})}),define("plex/desktop/view/lists/sidebar/items/FilterOptionListItem",["hb!templates/desktop/lists/sidebar/items/FilterOptionListItem.tpl","plex/base/control/Dispatcher","plex/base/view/BaseView","jquery"],function(e,t,i,n){var a=i.extend({tagName:"li",className:"filter-option",selected:!1,events:{"click a":"onClick"},initialize:function(e){this.parentFilter=e.parentFilter,this.selected=e.selected,this.addBinding(this.model,"change",this.render),this.addBinding(t,"change:linearFilter",this.onLinearFilterChange),this.addBinding(t,"removeAll:filter",this.onRemoveAll)
},render:function(){return this.$el.html(e({option:this.model.toJSON(),selected:this.selected})),this},onClick:function(e){e.preventDefault();var i=n(e.currentTarget),a=i.hasClass("selected"),s={key:this.parentFilter.id,title:this.model.get("title"),value:this.model.id};a?this.parentFilter.get("linear")?t.trigger("change:linearFilter"):t.trigger("remove:filter",s):this.parentFilter.get("linear")?t.trigger("change:linearFilter",s):t.trigger("add:filter",s),i.toggleClass("selected")},onLinearFilterChange:function(e){e&&e.value===this.model.id||this.$(".selected").removeClass("selected")
},onRemoveAll:function(e){e.key===this.parentFilter.id&&this.$(".selected").removeClass("selected")}});return a}),define("plex/desktop/view/lists/sidebar/FilterOptionList",["plex/base/view/lists/BaseList","plex/desktop/view/lists/sidebar/items/FilterOptionListItem"],function(e,t){var i=e.extend({tagName:"ul",className:"filter-option-list minimal-scrollbar",activeLinearFilter:null,activeFilters:null,initialize:function(e){this.activeLinearFilter=e.activeLinearFilter,this.activeFilters=e.activeFilters,this.setup(t)
},render:function(){return this.$el.empty(),this.populate(this.collection),this},addItem:function(e){if(e.get("title")){var i=this.collection.parentFilter,n=!1;this.activeLinearFilter&&this.activeLinearFilter.value===e.id&&(n=!0),_.each(this.activeFilters,function(t){if(t.key===i.id){var a=_.find(t.titles,function(t){return t==e.get("title")});a&&(n=!0)}});var a=new t({model:e,parentFilter:i,selected:n});this.registerView(a),this.items[e.id]=a,this.$el.append(a.render().el)}}});return i}),define("plex/desktop/view/section/FilterOptionView",["hb!templates/desktop/section/FilterOptionView.tpl","plex/base/control/Dispatcher","plex/base/view/BaseView","plex/desktop/view/lists/sidebar/FilterOptionList","jquery"],function(e,t,i,n,a){var s=i.extend({className:"filter-options-container hide",list:null,filter:null,filterOptions:null,activeLinearFilter:null,activeFilters:null,limited:!1,active:!1,events:{"focus .input-search":"onSearchFocus","blur .input-search":"onSearchBlur","keyup .input-search":"onSearchKeyUp","click .clear-search-btn":"onClearSearchClick","submit .search-form":"onSearchSubmit","click .deselect-btn":"onDeselectClick"},initialize:function(e){this.activeLinearFilter=e.activeLinearFilter,this.activeFilters=e.activeFilters,this.limited=e.limited
},render:function(){return this.$el.html(e()),this},open:function(e){this.filter=e,this.filterOptions=e.get("options"),this.active=!0,this.list?this.list.rebase(this.filterOptions):(this.list=this.registerView(new n({collection:this.filterOptions,activeLinearFilter:this.activeLinearFilter,activeFilters:this.activeFilters})),this.$(".search-container").after(this.list.render().el)),this.$(".input-search").val(""),this.$el.removeClass("hide"),_.defer(_.bind(function(){this.$el.css("max-height",this.$(".filter-option-list").height()+100)
},this))},close:function(){this.active=!1,this.$el.css("max-height",0),_.delay(_.bind(function(){this.$el.addClass("hide")},this),800)},reset:function(e){this.filterOptions&&(this.filterOptions.activeFilters=e,this.filterOptions.fetch(),this.list.rebase(this.filterOptions)),this.$(".clear-search-btn").addClass("hide"),this.$(".input-search").val("")},onSearchFocus:function(){this.$(".search-container").addClass("selected")},onSearchBlur:function(){this.$(".search-container").removeClass("selected")
},onSearchKeyUp:function(e){var t=a(e.target),i=t.val(),n=this.filterOptions.search(i);0===i.length?this.$(".clear-search-btn").addClass("hide"):this.$(".clear-search-btn").removeClass("hide"),this.list.rebase(n)},onClearSearchClick:function(e){e.preventDefault(),this.$(".clear-search-btn").addClass("hide"),this.$(".input-search").val(""),this.list.rebase(this.filterOptions)},onSearchSubmit:function(e){e.preventDefault();var i=this.$(".input-search").val();if(i&&!this.limited)for(var n=this.list.collection.models,a=0,s=n.length;s>a;a++){var r=n[a],l=r.get("title");
if(l&&l.toLowerCase()===i.toLowerCase()){var o={key:this.filter.id,title:l,value:r.id};t.trigger("add:filter",o);break}}},onDeselectClick:function(e){e.preventDefault(),this.limited?t.trigger("change:linearFilter"):t.trigger("removeAll:filter",{key:this.filter.id})}});return s}),define("hb!templates/desktop/lists/sidebar/items/PrimaryFilterListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return"active"}function r(e,t){var n,a,s="";return s+="\n		",a={hash:{},data:t},s+=p((n=i.t||e.t,n?n.call(e,"Recently Viewed",a):u.call(e,"t","Recently Viewed",a)))+"\n	"
}function l(e,t){var n,a,s="";return s+="\n		",a={hash:{},data:t},s+=p((n=i.t||e.t,n?n.call(e,(n=e.filter,null==n||n===!1?n:n.title),a):u.call(e,"t",(n=e.filter,null==n||n===!1?n:n.title),a)))+"\n	"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var o,c,d,h="",u=i.helperMissing,p=this.escapeExpression,f=this,m="function";return h+='<a class="gray filter-toggle ',o=i["if"].call(t,t.selected,{hash:{},inverse:f.noop,fn:f.program(1,s,a),data:a}),(o||0===o)&&(h+=o),h+='" href="#!/servers/',(o=i.serverID)?o=o.call(t,{hash:{},data:a}):(o=t.serverID,o=typeof o===m?o.apply(t):o),h+=p(o)+"/sections/",(o=i.sectionID)?o=o.call(t,{hash:{},data:a}):(o=t.sectionID,o=typeof o===m?o.apply(t):o),h+=p(o)+"/"+p((o=t.filter,o=null==o||o===!1?o:o.key,typeof o===m?o.apply(t):o))+'" data-focus="keyboard">\n	',d={hash:{},inverse:f.program(5,l,a),fn:f.program(3,r,a),data:a},o=i.if_eq||t.if_eq,c=o?o.call(t,(o=t.filter,null==o||o===!1?o:o.title),"Recently Viewed Episodes",d):u.call(t,"if_eq",(o=t.filter,null==o||o===!1?o:o.title),"Recently Viewed Episodes",d),(c||0===c)&&(h+=c),h+="\n</a>\n"
})}),define("plex/desktop/view/lists/sidebar/items/PrimaryFilterListItem",["hb!templates/desktop/lists/sidebar/items/PrimaryFilterListItem.tpl","plex/base/view/BaseView"],function(e,t){var i=t.extend({tagName:"li",initialize:function(e){this.activePrimaryFilter=e.list.activePrimaryFilter},render:function(){return this.$el.html(e({serverID:this.model.server.id,sectionID:this.model.section.id,filter:this.model.toJSON(),selected:this.activePrimaryFilter===this.model.id})),this}});return i}),define("plex/desktop/view/lists/sidebar/PrimaryFilterList",["plex/base/view/lists/BaseList","plex/desktop/view/lists/sidebar/items/PrimaryFilterListItem"],function(e,t){var i=e.extend({tagName:"ul",className:"sidebar-list",activePrimaryFilter:null,initialize:function(e){this.setup(t),this.activePrimaryFilter=e.activePrimaryFilter,this.collection.populate()
},render:function(){return this.$el.empty(),this.populate(this.collection),this},addItem:function(t){return t.get("primary")||"recentlyViewed"===t.id?e.prototype.addItem.apply(this,arguments):void 0}});return i}),define("hb!templates/desktop/lists/sidebar/items/LinearFilterListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var s,r,l="",o=i.helperMissing,c=this.escapeExpression;return l+='<a class="gray remove-filters-btn hide" href="#">\n	<i class="glyphicon circle-minus"></i>\n</a>\n\n<a class="filter-toggle gray" href="#" data-focus="keyboard">\n	',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,(s=t.filter,null==s||s===!1?s:s.title),r):o.call(t,"t",(s=t.filter,null==s||s===!1?s:s.title),r)))+"\n</a>\n"
})}),define("plex/desktop/view/lists/sidebar/items/LinearFilterListItem",["hb!templates/desktop/lists/sidebar/items/LinearFilterListItem.tpl","plex/base/control/Dispatcher","plex/base/view/BaseView","jquery"],function(e,t,i){var n=i.extend({tagName:"li",selected:!1,events:{"click .filter-toggle":"onToggleClick","click .remove-filters-btn":"onRemoveFiltersClick"},initialize:function(e){this.activeLinearFilter=e.list.activeLinearFilter,this.addBinding(t,"change:linearFilter",this.onLinearFilterChange)
},render:function(){return this.$el.html(e({filter:this.model.toJSON()})),this.updateLabel(),this},updateLabel:function(){return this.activeLinearFilter&&this.activeLinearFilter.value?(this.activeLinearFilter.key===this.model.id?(this.$(".filter-toggle").addClass("selected"),this.$(".remove-filters-btn").removeClass("hide")):this.activeLinearFilter.value===this.model.id?(this.$(".filter-toggle").addClass("selected"),this.$(".remove-filters-btn").addClass("hide")):(this.$(".filter-toggle").removeClass("selected"),this.$(".remove-filters-btn").addClass("hide")),void 0):(this.$(".remove-filters-btn").addClass("hide"),"all"===this.model.id?this.$(".filter-toggle").addClass("selected"):this.$(".filter-toggle").removeClass("selected"),void 0)
},onToggleClick:function(e){e.preventDefault();var i=this.model.get("options");if(this.model.get("secondary"))i.url=this.model.url(),i.fetch().done(_.bind(function(){t.trigger("show:filterOptions",this.model,!0)},this));else{var n={title:this.model.get("title"),value:this.model.id};t.trigger("change:linearFilter",n)}},onRemoveFiltersClick:function(e){e.preventDefault(),t.trigger("change:linearFilter")},onLinearFilterChange:function(e){this.activeLinearFilter=e,this.updateLabel()}});return n}),define("plex/desktop/view/lists/sidebar/LinearFilterList",["plex/base/view/lists/BaseList","plex/desktop/view/lists/sidebar/items/LinearFilterListItem"],function(e,t){var i=e.extend({tagName:"ul",className:"sidebar-list filter-list",activeLinearFilter:null,initialize:function(e){this.setup(t),this.activeLinearFilter=e.activeLinearFilter,this.collection.populate()
},render:function(){return this.$el.empty(),this.populate(this.collection),this}});return i}),define("hb!templates/desktop/lists/sidebar/items/FilterListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return"boolean-toggle"}function r(e,t){var n;return n=i["if"].call(e,e.unwatched,{hash:{},inverse:p.program(6,o,t),fn:p.program(4,l,t),data:t}),n||0===n?n:""}function l(){return"unwatched-toggle"}function o(){return"options-toggle"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};
var c,d,h,u="",p=this,f=i.helperMissing,m=this.escapeExpression;return u+='<a class="gray remove-filters-btn hide" href="#" data-focus="keyboard">\n	<i class="glyphicon circle-minus"></i>\n</a>\n\n<a class="gray filter-toggle ',h={hash:{},inverse:p.program(3,r,a),fn:p.program(1,s,a),data:a},c=i.if_eq||t.if_eq,d=c?c.call(t,(c=t.filter,null==c||c===!1?c:c.filterType),"boolean",h):f.call(t,"if_eq",(c=t.filter,null==c||c===!1?c:c.filterType),"boolean",h),(d||0===d)&&(u+=d),u+='" href="#" data-focus="keyboard">\n	',h={hash:{},data:a},u+=m((c=i.t||t.t,c?c.call(t,(c=t.filter,null==c||c===!1?c:c.title),h):f.call(t,"t",(c=t.filter,null==c||c===!1?c:c.title),h)))+"\n</a>\n"
})}),define("plex/desktop/view/lists/sidebar/items/FilterListItem",["hb!templates/desktop/lists/sidebar/items/FilterListItem.tpl","plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/view/BaseView","jquery"],function(e,t,i,n,a){var s=n.extend({tagName:"li",selectedOptions:null,events:{"click .unwatched-toggle":"onUnwatchedToggleClick","click .boolean-toggle":"onBooleanToggleClick","click .options-toggle":"onOptionsToggleClick","click .remove-filters-btn":"onRemoveFiltersClick"},initialize:function(e){for(var i=[],n=e.list.activeFilters,a=0,s=n.length;s>a;a++){var r=n[a];
r.key===this.model.id&&(i=r.titles)}this.selectedOptions=i,this.addBinding(this.model,"change",this.render),this.addBinding(t,"add:filter",this.onAddFilter),this.addBinding(t,"remove:filter",this.onRemoveFilter),this.addBinding(t,"removeAll:filter",this.onRemoveAllFilters)},render:function(){var t="viewCount"===this.model.id||"unviewedLeafCount"===this.model.id;return this.$el.html(e({filter:this.model.toJSON(),unwatched:t})),t||"boolean"===this.model.get("filterType")?this.selectedOptions.length>0&&this.$(".unwatched-toggle, .boolean-toggle").addClass("selected"):this.updateLabel(),this
},updateLabel:function(){var e=this.$(".options-toggle"),t=i.t(this.model.get("title")),n=this.selectedOptions.length;if(n){e.addClass("selected"),t+=": ";for(var a=0;n>a;a++)t+=this.selectedOptions[a],n>a+1&&(t+=", ");this.$(".remove-filters-btn").removeClass("hide")}else e.removeClass("selected"),this.$(".remove-filters-btn").addClass("hide");e.text(t)},onUnwatchedToggleClick:function(e){e.preventDefault();var i=a(e.target),n={key:this.model.id,title:"Unwatched"};n.value="unviewedLeafCount"===this.model.id?1:0,i.hasClass("selected")?t.trigger("remove:filter",n,!0):t.trigger("add:filter",n,!0),i.toggleClass("selected")
},onBooleanToggleClick:function(e){e.preventDefault();var i=a(e.target),n={key:this.model.id,title:this.model.get("title"),value:1};i.hasClass("selected")?t.trigger("remove:filter",n,!0):t.trigger("add:filter",n,!0),i.toggleClass("selected")},onOptionsToggleClick:function(e){e.preventDefault();var i=this.model.get("options");i.fetch().done(_.bind(function(){t.trigger("show:filterOptions",this.model)},this))},onRemoveFiltersClick:function(e){e.preventDefault(),t.trigger("removeAll:filter",{key:this.model.id})
},onAddFilter:function(e,t){e.key!==this.model.id||t||(this.selectedOptions.push(e.title),this.updateLabel())},onRemoveFilter:function(e,t){e.key!==this.model.id||t||(this.selectedOptions=_.reject(this.selectedOptions,function(t){return t===e.title}),this.updateLabel())},onRemoveAllFilters:function(e){e.key===this.model.id&&(this.selectedOptions.length=0,this.updateLabel())}});return s}),define("plex/desktop/view/lists/sidebar/FilterList",["plex/base/view/lists/BaseList","plex/desktop/view/lists/sidebar/items/FilterListItem"],function(e,t){var i=e.extend({tagName:"ul",className:"sidebar-list filter-list",activeFilters:null,initialize:function(e){this.setup(t),this.activeFilters=e.activeFilters,this.collection.populate()
},render:function(){return this.$el.empty(),this.populate(this.collection),this}});return i}),define("hb!templates/desktop/lists/sidebar/items/SortListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a,s,o="";return o+='\n	<a class="gray filter-toggle selected" href="#" data-focus="keyboard">',s={hash:{},data:t},o+=u((n=i.t||e.t,n?n.call(e,(n=e.sort,null==n||n===!1?n:n.title),s):h.call(e,"t",(n=e.sort,null==n||n===!1?n:n.title),s)))+" ",a=i["if"].call(e,e.descending,{hash:{},inverse:p.program(4,l,t),fn:p.program(2,r,t),data:t}),(a||0===a)&&(o+=a),o+="</a>\n"
}function r(){return'<i class="glyphicon-caret small"></i>'}function l(){return'<i class="glyphicon-caret reverse small"></i>'}function o(e,t){var n,a,s="";return s+='\n	<a class="gray filter-toggle" href="#" data-focus="keyboard">',a={hash:{},data:t},s+=u((n=i.t||e.t,n?n.call(e,(n=e.sort,null==n||n===!1?n:n.title),a):h.call(e,"t",(n=e.sort,null==n||n===!1?n:n.title),a)))+"</a>\n"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var c,d="",h=i.helperMissing,u=this.escapeExpression,p=this;
return c=i["if"].call(t,t.active,{hash:{},inverse:p.program(6,o,a),fn:p.program(1,s,a),data:a}),(c||0===c)&&(d+=c),d+="\n"})}),define("plex/desktop/view/lists/sidebar/items/SortListItem",["hb!templates/desktop/lists/sidebar/items/SortListItem.tpl","plex/base/control/Dispatcher","plex/base/view/BaseView"],function(e,t,i){var n=i.extend({tagName:"li",active:!1,direction:"desc",events:{click:"onClick"},initialize:function(e){var i=e.list.activeSort;if(this.addBinding(this.model,"change",this.render),this.addBinding(t,"change:sort",this.onSortChange),_.isEmpty(i)){var n=this.model.get("default");
n&&(this.active=!0,this.direction=n)}else this.model.id===i.key&&(this.active=!0,this.direction=i.direction)},render:function(){return this.$el.html(e({active:this.active,descending:"desc"===this.direction,sort:this.model.toJSON()})),this},onClick:function(e){e.preventDefault(),this.active?"desc"===this.direction?this.direction="asc":this.active=!1:(this.active=!0,this.direction="desc"),this.render(),this.active?t.trigger("change:sort",{key:this.model.id,direction:this.direction}):t.trigger("change:sort",{key:null})
},onSortChange:function(e){this.model.id!==e.key&&(this.active=!1),this.render()}});return n}),define("plex/desktop/view/lists/sidebar/SortList",["plex/base/view/lists/BaseList","plex/desktop/view/lists/sidebar/items/SortListItem"],function(e,t){var i=e.extend({tagName:"ul",className:"sidebar-list",activeSort:null,initialize:function(e){this.setup(t),this.activeSort=e.activeSort,this.collection.populate()},render:function(){return this.$el.empty(),this.populate(this.collection),this}});return i}),define("hb!templates/desktop/lists/sidebar/items/MediaTypeListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return"selected"
}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var r,l="",o=this,c="function",d=this.escapeExpression;return l+='<a class="gray ',r=i["if"].call(t,t.active,{hash:{},inverse:o.noop,fn:o.program(1,s,a),data:a}),(r||0===r)&&(l+=r),l+='" href="#" data-focus="keyboard">',(r=i.label)?r=r.call(t,{hash:{},data:a}):(r=t.label,r=typeof r===c?r.apply(t):r),l+=d(r)+"</a>\n"})}),define("plex/desktop/view/lists/sidebar/items/MediaTypeListItem",["hb!templates/desktop/lists/sidebar/items/MediaTypeListItem.tpl","plex/base/control/Dispatcher","plex/base/view/BaseView"],function(e,t,i){var n=i.extend({tagName:"li",active:!1,direction:"desc",events:{click:"onClick"},initialize:function(e){var i=e.list.activeType;
this.addBinding(t,"change:mediaType",this.onMediaTypeChange),this.model.id==i&&(this.active=!0)},render:function(){var t={active:this.active,label:this.model.label};return this.$el.html(e(t)),this},onClick:function(e){e.preventDefault(),this.active=!0,this.render(),t.trigger("change:mediaType",this.model.id)},onMediaTypeChange:function(e){this.model.id!==e&&(this.active=!1),this.render()}});return n}),define("plex/desktop/view/lists/sidebar/MediaTypeList",["plex/base/view/BaseView","plex/desktop/view/lists/sidebar/items/MediaTypeListItem"],function(e,t){var i=e.extend({tagName:"ul",className:"sidebar-list",activeType:null,initialize:function(e){this.activeType=e.activeType
},render:function(){return this.$el.empty(),_.each(this.collection,_.bind(function(e){if(3!==e.id&&10!==e.id){var i=this.registerView(new t({model:e,list:this}));this.$el.append(i.render().el)}},this)),this}});return i}),define("plex/desktop/view/section/SidebarView",["hb!templates/desktop/section/SidebarView.tpl","plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/control/utils/MediaTypes","plex/base/model/SettingsModel","plex/base/view/BaseView","plex/desktop/view/section/FilterOptionView","plex/desktop/view/lists/sidebar/PrimaryFilterList","plex/desktop/view/lists/sidebar/LinearFilterList","plex/desktop/view/lists/sidebar/FilterList","plex/desktop/view/lists/sidebar/SortList","plex/desktop/view/lists/sidebar/MediaTypeList"],function(e,t,i,n,a,s,r,l,o,c,d,h){var u=s.extend({className:"sidebar minimal-scrollbar",subset:null,listType:null,primaryFilterList:null,mediaTypeList:null,linearFilterList:null,filterList:null,filterOptions:null,sortList:null,events:{"click .media-tile-list-btn":"onMediaTileListClick","click .media-list-btn":"onMediaListClick","click .media-compact-list-btn":"onMediaCompactListClick","click .folder-btn":"onFolderClick","click .close-filter-options-btn":"onCloseFilterOptionsClick"},initialize:function(e){var i=this.model.get("limited"),s=this.model.get("media"),u=this.model.get("alphanumeric"),p=this.model.get("linearFilters"),f=this.model.get("filters"),m=this.model.get("sorts"),g=n.getRelatedMediaTypes(this.model.get("type"));
this.subset=e.subset,this.listType=e.listType||a.get("listType"),u.mediaType=s.mediaType,f.mediaType=s.mediaType,m.mediaType=s.mediaType,i?(this.linearFilterList=this.registerView(new o({collection:p,activeLinearFilter:s.linearFilter})),this.filterOptions=this.registerView(new r({activeLinearFilter:s.linearFilter,limited:!0}))):(this.primaryFilterList=this.registerView(new l({collection:p,activePrimaryFilter:this.subset})),this.filterList=this.registerView(new c({collection:f,activeFilters:s.filters})),this.filterOptions=this.registerView(new r({activeFilters:s.filters,limited:i})),this.sortList=this.registerView(new d({collection:m,activeSort:s.sort}))),g.length>1&&(this.mediaTypeList=this.registerView(new h({collection:g,activeType:s.mediaType}))),e.hidden&&this.$el.addClass("hidden"),this.addBinding(t,"show:filterOptions",this.onShowFilterOptions),this.addBinding(t,"change:linearFilter",this.onLinearFilterChange),this.addBinding(t,"add:filter",this.onAddFilter),this.addBinding(t,"remove:filter",this.onRemoveFilter),this.addBinding(t,"removeAll:filter",this.onRemoveAllFilters),this.addBinding(t,"reset:filter",this.onResetFilters),this.addBinding(t,"change:sort",this.onSortChange),this.addBinding(t,"change:mediaType",this.onMediaTypeChange),this.addBinding(this.model,"change:title",this.onTitleChange)
},render:function(){return this.model.get("type"),this.$el.html(e({section:this.model.toJSON(),subset:this.subset,listType:this.listType,showTypes:!!this.mediaTypeList})),this.primaryFilterList&&this.$(".media-header").after(this.primaryFilterList.render().el),this.mediaTypeList&&this.$(".type-header").after(this.mediaTypeList.render().el),this.linearFilterList&&this.$(".filter-header").after(this.linearFilterList.render().el),this.filterList&&this.$(".filter-header").after(this.filterList.render().el),this.filterOptions&&this.$(".filter-header").after(this.filterOptions.render().el),this.sortList&&this.$(".sort-header").after(this.sortList.render().el),this.$el.tooltip({selector:".btn-icon",placement:"bottom"}),this
},propagateFilters:function(e){var t=this.model.get("filters");t.each(function(t){var i=t.get("options");i.activeFilters=e})},propagateMediaType:function(e){var t=this.model.get("filters");t.each(function(t){var i=t.get("options");i.activeType=e})},fetchMedia:function(){var e=this.model.get("media");e.scrollPosition=0,e.populatedRange.start=0,e.populatedRange.end=0,e.fetchSize({hideLoadingAlert:!0})},fetchAlphanumeric:function(){var e=this.model.get("media"),t=this.model.get("alphanumeric");t.filters=e.filters,t.fetch()
},onMediaTileListClick:function(e){e.preventDefault();var t="media-tile-list";a.save("listType",t)},onMediaListClick:function(e){e.preventDefault();var t="media-list";a.save("listType",t)},onMediaCompactListClick:function(e){e.preventDefault();var t="media-compact-list";a.save("listType",t)},onFolderClick:function(e){e.preventDefault();var i={serverID:this.model.server.id,sectionID:this.model.id};"folder"===this.subset?t.trigger("navigate:section",i):t.trigger("navigate:sectionFolder",i)},onCloseFilterOptionsClick:function(e){e.preventDefault(),this.$(".filter-header").removeClass("active"),this.$(".filter-header-title").text(i.t("Filter")),this.$(".filter-list").removeClass("hidden"),this.filterOptions.close()
},onShowFilterOptions:function(e,t){e.get("options").length;var n,a=i.t(e.get("title"));n=t?i.t(a):i.t("Filter By {1}",a),this.$(".filter-header").addClass("active"),this.$(".filter-header-title").text(n),this.$(".filter-list").addClass("hidden"),this.filterOptions.open(e)},onLinearFilterChange:function(e){var t=this.model.get("media");e||(e={value:"all",title:"All"}),t.linearFilter.key=e.key,t.linearFilter.value=e.value,t.linearFilter.title=e.title;var i=e.value;e.key&&-1===i.indexOf(e.key+"/")&&(i=e.key+"/"+i),t.type=i,this.fetchMedia()
},onAddFilter:function(e,t){var i=this.model.get("media"),n=i.filters,a=_.find(n,function(t){return t.key===e.key});a?(t&&(a.titles.length=0,a.values.length=0),a.titles.push(e.title),a.values.push(e.value)):n.push({key:e.key,titles:[e.title],values:[e.value]}),this.propagateFilters(n),this.fetchMedia(),this.fetchAlphanumeric()},onRemoveFilter:function(e){var t=this.model.get("media"),i=t.filters,n=_.find(i,function(t){return t.key===e.key});n&&(n.titles=_.reject(n.titles,function(t){return t===e.title
}),n.values=_.reject(n.values,function(t){return t===e.value})),this.propagateFilters(i),this.fetchMedia(),this.fetchAlphanumeric()},onRemoveAllFilters:function(e){var t=this.model.get("media"),i=t.filters,n=_.find(i,function(t){return t.key===e.key});n&&(n.titles&&(n.titles.length=0),n.values&&(n.values.length=0)),this.propagateFilters(i),this.fetchMedia(),this.fetchAlphanumeric()},onResetFilters:function(){var e=this.model.get("media"),i=this.model.get("filters");e.filters.length=0,e.search=null,e.firstCharacter=null,this.filterList.reset(i),this.filterOptions.reset(e.filters),this.fetchMedia(),this.fetchAlphanumeric(),t.trigger("navigate:section",{serverID:this.model.server.id,sectionID:this.model.id,silent:!0})
},onSortChange:function(e){var t=this.model.get("media");t.sort=e,this.fetchMedia()},onMediaTypeChange:function(e){var t=this.model.get("media"),n=this.model.get("alphanumeric"),a=this.model.get("filters"),s=this.model.get("sorts");t.mediaType=e,n.mediaType=e,a.mediaType=e,s.mediaType=e,t.firstCharacter=null,t.filters.length=0,t.sort={},this.propagateFilters(t.filters),this.propagateMediaType(e),this.fetchMedia(),this.fetchAlphanumeric(),a.fetch(),s.fetch(),this.filterOptions.active&&(this.$(".filter-header").removeClass("active"),this.$(".filter-header-title").text(i.t("Filter")),this.$(".filter-list").removeClass("hidden"),this.filterOptions.close())
},onTitleChange:function(e,t){this.$(".media-header").text(t)}});return u}),define("hb!templates/desktop/modals/AddToCollectionModal.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a="";return a+='\n		<ul class="select-collections-list select-list minimal-scrollbar">\n			',n=i.each.call(e,e.collections,{hash:{},inverse:m.noop,fn:m.program(2,r,t),data:t}),(n||0===n)&&(a+=n),a+="\n		</ul>\n	"}function r(e,t){var n,a,s="";return s+='\n				<li>\n					<a class="collection" data-id="',(n=i.key)?n=n.call(e,{hash:{},data:t}):(n=e.key,n=typeof n===u?n.apply(e):n),s+=p(n)+'" href="#">\n						',a={hash:{},data:t},s+=p((n=i.truncate||e.truncate,n?n.call(e,e.title,30,a):f.call(e,"truncate",e.title,30,a)))+"\n					</a>\n				</li>\n			"
}function l(e,t){var n,a,s="";return s+='\n		<div class="empty-message">',a={hash:{},data:t},s+=p((n=i.t||e.t,n?n.call(e,"There are no collections yet.",a):f.call(e,"t","There are no collections yet.",a)))+"</div>\n	"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var o,c,d,h="",u="function",p=this.escapeExpression,f=i.helperMissing,m=this;return h+='<div class="modal-header">\n	<button type="button" class="close" data-dismiss="modal"><i class="glyphicon remove-2"></i></button>\n	<h3><i class="glyphicon folder-plus"></i> ',d={hash:{},data:a},h+=p((o=i.t||t.t,o?o.call(t,"Add to Collection",d):f.call(t,"t","Add to Collection",d)))+'</h3>\n</div>\n\n<div class="modal-body minimal-scrollbar">\n	',c=i["if"].call(t,t.collections,{hash:{},inverse:m.program(4,l,a),fn:m.program(1,s,a),data:a}),(c||0===c)&&(h+=c),h+='\n\n	<div class="input-minimal-container">\n		<input id="new-collection" class="input-dark input-minimal" type="text" placeholder="',d={hash:{},data:a},h+=p((o=i.t||t.t,o?o.call(t,"New Collection...",d):f.call(t,"t","New Collection...",d)))+'">\n	</div>\n</div>\n\n<div class="modal-footer pull-center">\n	<button type="button" class="add-btn btn btn-medium btn-primary disabled">',d={hash:{},data:a},h+=p((o=i.t||t.t,o?o.call(t,"Add",d):f.call(t,"t","Add",d)))+"</button>\n</div>\n"
})}),define("plex/desktop/view/modals/AddToCollectionModal",["hb!templates/desktop/modals/AddToCollectionModal.tpl","plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel","plex/base/view/modals/BaseModal","jquery"],function(e,t,i,n,a,s){var r=a.extend({name:"addToCollectionModal",className:"modal modal-small select-modal add-to-collection-modal fade",collectionIDs:null,events:{hidden:"close","click .collection":"onCollectionClick","keyup #new-collection":"onNewCollectionKeyUp","click .add-btn":"onAddClick"},initialize:function(e){this.collectionIDs=[],this.models=e.models
},render:function(){return this.$el.html(e({collections:this.collection.toJSON()})).modal(),this},enableAddButton:function(){var e=this.$("#new-collection").val();this.collectionIDs.length||e.length?this.$(".add-btn").removeClass("disabled"):this.$(".add-btn").addClass("disabled")},onCollectionClick:function(e){e.preventDefault();var t=s(e.currentTarget),i=t.data("id");t.hasClass("selected")?this.collectionIDs.splice(_.indexOf(this.collectionIDs,i),1):this.collectionIDs.push(i),s(e.target).toggleClass("selected"),this.enableAddButton()
},onNewCollectionKeyUp:function(){this.enableAddButton()},onAddClick:function(e){e.preventDefault();var a=s(e.currentTarget);if(!a.hasClass("disabled")){var r=[],l=this.$("#new-collection").val();l&&r.push(this.models[0].batchAdd(this.models,"collection",l)),this.collectionIDs.length&&_.each(this.collectionIDs,_.bind(function(e){var t=this.collection.get(e);r.push(this.models[0].batchAdd(this.models,"collection",t.get("title")))},this)),t.trigger("command:ShowLoading",!0),s.when.apply(s,r).always(function(){t.trigger("command:ShowLoading",!1)
}).done(_.bind(function(){this.$el.modal("hide")},this)).fail(function(){n.set("alert",{status:"error",message:i.t("There was a problem adding these items to a collection.")})})}}});return r}),define("plex/desktop/view/section/SectionActionBarView",["hb!templates/desktop/section/SectionActionBarView.tpl","plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel","plex/base/model/SettingsModel","plex/base/model/FilterModel","plex/base/view/FocusView","plex/desktop/view/section/SidebarView","plex/desktop/view/modals/SyncModal","plex/desktop/view/modals/SelectDeviceModal","plex/desktop/view/modals/ConfirmModal","plex/desktop/view/modals/AddToCollectionModal","jquery"],function(e,t,i,n,a,s,r,l,o,c,d,h,u){var p={showOptions:!0,showSelect:!0,showDeselect:!0,showMultiSelect:!0,showSync:!0},f={movie:{showSelectionEdit:!0,showRefresh:!0,showAnalyze:!0,showAddToCollection:!0,showWatch:!0,showMerge:!0},show:{showSelectionEdit:!0,showRefresh:!0,showAddToCollection:!0,showWatch:!0,showMerge:!0},episode:{showSelectionEdit:!0,showRefresh:!0,showAnalyze:!0,showAddToCollection:!0,showWatch:!0},artist:{showSelectionEdit:!0,showRefresh:!0,showAddToCollection:!0,showMerge:!0},album:{showSelectionEdit:!0,showRefresh:!0,showAddToCollection:!0,showMerge:!0},photo:{showSelectionEdit:!0,showRefresh:!0,showAnalyze:!0,showAddToCollection:!0}},m=r.extend({className:"sidebar-container",models:null,editing:!1,shared:!1,collectionFilter:null,sidebar:null,focusOptions:{position:1,navigationPaths:{".iconbar a":{left:".list-types-container .btn:last"},".btn-group > .btn":{down:".sidebar-list .filter-toggle"},".folder-btn":{right:".options-icon-btn"},".sidebar-list .filter-toggle":{right:".options-icon-btn"}},activationDirection:"left",cancellationDirections:{left:".iconbar a",right:".iconbar a",up:".btn-group > .btn, .folder-btn"}},events:{"click .options-icon-btn":"onOptionsClick","click .select-icon-btn":"onSelectClick","click .deselect-icon-btn":"onDeselectClick","click .refresh-icon-btn":"onRefreshClick","click .analyze-icon-btn":"onAnalyzeClick","click .add-collection-icon-btn":"onAddCollectionClick","click .watch-icon-btn":"onWatchClick","click .unwatch-icon-btn":"onUnwatchClick","click .merge-icon-btn":"onMergeClick","click .sync-icon-btn":"onSyncClick"},initialize:function(e){var i=n.get("myPlex"),a=_.clone(p);
this.collectionFilter=new s({filter:"collection",filterType:"string",type:"filter",title:"Collection"}),this.sectionOptions=_.extend(a,e),this.visibilityOptions=_.extend({},this.sectionOptions),this.sectionOptions.showSync&&(this.addBinding(this.collection,"reset",this.updateSync),this.addBinding(i.get("devices"),"reset",this.updateSync)),this.sidebar=this.registerView(new l({model:this.model,subset:this.collection.subset})),this.addBinding(t,"shortcut:sidebar",this.toggleSidebar),this.addBinding(t,"shortcut:refresh",this.refresh),this.addBinding(t,"shortcut:analyze",this.analyze),this.addBinding(t,"shortcut:markWatched",this.markWatched),this.addBinding(t,"shortcut:markUnwatched",this.markUnwatched),this.addBinding(t,"shortcut:sync",this.sync)
},render:function(){this.updateVisibilityOptions();var t=_.extend({},this.visibilityOptions);return this.$el.html(e(t)),this.$el.append(this.sidebar.render().el),a.get("sidebarOpen")?(this.$el.addClass("open"),this.trigger("open",!0)):this.$(".sidebar").addClass("hide"),this.$el.tooltip({selector:".actionbar-icon-btn, .iconbar-glyphicon-btn",placement:"right"}),this},updateVisibilityOptions:function(){this.visibilityOptions.showSelect=this.showSelect(),this.visibilityOptions.showDeselect=this.showDeselect(),this.visibilityOptions.showSync=this.showSync();
var e=this.showMultiSelect();e&&(this.visibilityOptions=_.extend(this.visibilityOptions,e))},showSelect:function(){var e=this.model.server.get("shared"),t=this.model.get("limited"),i=this.model.server.get("multiuser");return this.sectionOptions.showSelect?e&&!i?!1:t?!1:!this.editing:!1},showDeselect:function(){var e=this.model.server.get("shared"),t=this.model.server.get("multiuser");return this.sectionOptions.showDeselect?e&&!t?!1:this.editing:!1},showMultiSelect:function(){var e=this.model.server.get("shared"),t=this.model.server.get("multiuser");
if(!this.sectionOptions.showMultiSelect)return!1;if(e&&!t)return!1;if(this.model.get("limited"))return!1;if(!this.models||!this.models.length)return!1;var i=this.models[0],n=_.extend({},f[i.get("type")]);return n.showAddToCollection&&(i.server.supports("batchEdit")||(n.showAddToCollection=!1)),n.showMerge&&(2>this.models.length||!i.server.supports("merge"))&&(n.showMerge=!1),e&&(n.showRefresh=!1,n.showAnalyze=!1,n.showAddToCollection=!1,n.showMerge=!1),n},showSync:function(){if(!this.sectionOptions.showSync)return!1;
if(this.model.get("limited"))return!1;var e=n.get("myPlex"),t=e.get("devices").getSyncDevices();return!this.model.server.get("shared")&&this.model.server.supports("sync")&&t.length&&e.get("signedIn")&&this.collection.allowSync?!0:!1},updateAction:function(e,t){e?this.$(t).removeClass("hide"):this.$(t).addClass("hide"),u(".tooltip").remove()},updateSelect:function(){this.visibilityOptions.showSelect=this.showSelect(),this.updateAction(this.visibilityOptions.showSelect,".select-action")},updateDeselect:function(){this.visibilityOptions.showDeselect=this.showDeselect(),this.updateAction(this.visibilityOptions.showDeselect,".deselect-action")
},updateMultiSelect:function(){var e=this.showMultiSelect();e?this.visibilityOptions=_.extend(this.visibilityOptions,e):(this.visibilityOptions.showRefresh=!1,this.visibilityOptions.showAnalyze=!1,this.visibilityOptions.showAddToCollection=!1,this.visibilityOptions.showWatch=!1,this.visibilityOptions.showMerge=!1),this.updateAction(e.showRefresh,".refresh-action"),this.updateAction(e.showAnalyze,".analyze-action"),this.updateAction(e.showAddToCollection,".add-to-collection-action"),this.updateAction(e.showWatch,".watch-action"),this.updateAction(e.showWatch,".unwatch-action"),this.updateAction(e.showMerge,".merge-action")
},updateSync:function(){this.visibilityOptions.showSync=this.showSync(),this.updateAction(this.visibilityOptions.showSync,".sync-action")},setModels:function(e){if(this.models=e,e.length){this.editing=!0;var t=e[0];this.collectionFilter.set("key","/library/sections/"+t.section.id+"/collection"),this.collectionFilter.server=t.server,this.collectionFilter.section=t.section;var i=this.collectionFilter.get("options");i.server=t.server,i.section=t.section}else this.editing=!1;this.updateSelect(),this.updateDeselect(),this.updateMultiSelect()
},toggleSidebar:function(){this.visibilityOptions.showOptions&&(u(".tooltip").remove(),this.$el.toggleClass("open"),this.$el.hasClass("open")?(a.save("sidebarOpen",!0),this.trigger("open")):(a.save("sidebarOpen",!1),this.trigger("close")))},refresh:function(){this.visibilityOptions.showRefresh&&_.each(this.models,function(e){t.trigger("command:RefreshMetadata",e)})},analyze:function(){this.visibilityOptions.showAnalyze&&_.each(this.models,function(e){t.trigger("command:AnalyzeMedia",e)})},markWatched:function(){if(this.visibilityOptions.showWatch){var e=_.bind(function(){_.each(this.models,function(e){t.trigger("command:MarkWatched",e,!0)
})},this),a=new d({title:i.t("Mark as Watched"),message:i.t("Are you sure you want to mark all selected items as watched?")});a.on("yes",e),n.set("modal",a)}},markUnwatched:function(){if(this.visibilityOptions.showWatch){var e=_.bind(function(){_.each(this.models,function(e){t.trigger("command:MarkUnwatched",e,!0)})},this),a=new d({title:i.t("Mark as Unwatched"),message:i.t("Are you sure you want to mark all selected items as unwatched?")});a.on("yes",e),n.set("modal",a)}},sync:function(){if(this.visibilityOptions.showSync){var e=n.get("myPlex"),t=e.get("devices"),i=t.getSyncDevices(),a={directory:!0,section:!0,subset:this.collection.subset,model:this.model};
this.models&&this.models.length&&(a.models=this.models);var s=new o(a);if(i.length>1){var r=new c,l=_.bind(function(e){r.off("select:device",l),s.device=t.get(e),n.set("modal",s)},this);r.on("select:device",l),n.set("modal",r)}else 1===i.length&&(s.device=i[0],n.set("modal",s))}},onOptionsClick:function(e){e.preventDefault(),this.toggleSidebar()},onSelectClick:function(e){e.preventDefault(),this.editing=!0,this.trigger("select"),this.updateSelect(),this.updateDeselect()},onDeselectClick:function(e){e.preventDefault(),this.trigger("deselect")
},onRefreshClick:function(e){e.preventDefault(),this.refresh()},onAnalyzeClick:function(e){e.preventDefault(),this.analyze()},onAddCollectionClick:function(e){e.preventDefault();var t=this.collectionFilter.get("options");t.fetch().always(_.bind(function(){n.set("modal",new h({collection:t,models:this.models}))},this))},onWatchClick:function(e){e.preventDefault(),this.markWatched()},onUnwatchClick:function(e){e.preventDefault(),this.markUnwatched()},onMergeClick:function(e){e.preventDefault();var i=this.models[0],n=this.models.slice(1);
t.trigger("command:Merge",i,n)},onSyncClick:function(e){e.preventDefault(),this.sync()}});return m}),define("plex/desktop/view/section/SectionView",["hb!templates/desktop/section/SectionView.tpl","plex/base/view/section/BaseSectionView","plex/desktop/view/section/SectionListView","plex/desktop/view/section/SectionActionBarView"],function(e,t,i,n){var a=t.extend({initialize:function(){t.prototype.initialize.apply(this,arguments);var e=this.model.get("media");this.list=this.registerView(new i({model:this.model,collection:e,infiniteScroll:!0})),this.actionBar=this.registerView(new n({model:this.model,collection:e})),this.actionBar.setModels([]),this.addBinding(this.list,"change:selectedModels",this.onSelectedModelsChange),this.addBinding(this.actionBar,"select",this.onSelectItems),this.addBinding(this.actionBar,"deselect",this.onDeselectItems),this.addBinding(this.actionBar,"open",this.onSidebarOpen),this.addBinding(this.actionBar,"close",this.onSidebarClose),this.addBinding(e,"merge",this.onMerge)
},render:function(){return this.$el.html(e()),this.$(".section-container").append(this.list.render().el),this.$el.prepend(this.actionBar.render().el),this},onSelectedModelsChange:function(e){this.actionBar.setModels(e),e.length?this.list.edit():this.list.unedit()},onSelectItems:function(){this.list.edit()},onDeselectItems:function(){this.list.deselectAll()}});return a}),define("hb!templates/desktop/section/SectionFolderView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){return this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{},'<div class="folder-section-row">\n	<div class="section-list-scroll-container"></div>\n</div>\n\n<div class="section-container"></div>\n'
})}),define("plex/desktop/view/section/SectionFolderView",["hb!templates/desktop/section/SectionFolderView.tpl","plex/base/model/media/collections/MediaCollection","plex/base/view/BaseView","plex/desktop/view/section/SectionListView","plex/desktop/view/section/SectionActionBarView"],function(e,t,i,n,a){var s=i.extend({className:"container-fluid",list:null,actionBar:null,initialize:function(e){var i="library/sections/"+this.model.id+"/folder";e.folderID&&(i=decodeURIComponent(e.folderID));var s=new t([],{server:this.model.server,section:this.model,subset:"folder",url:i});
this.actionBar=this.registerView(new a({model:this.model,collection:s,showSelect:!1,showSync:!1})),this.actionBar.setModels([]),this.list=this.registerView(new n({model:this.model,collection:s})),s.fetch(),this.addBinding(this.actionBar,"open",this.onSidebarOpen),this.addBinding(this.actionBar,"close",this.onSidebarClose)},render:function(){return this.$el.html(e()),this.$(".section-container").append(this.list.render().el),this.$el.prepend(this.actionBar.render().el),this},onSidebarOpen:function(){this.$(".sidebar").removeClass("hide"),this.$el.addClass("sidebar-open")
},onSidebarClose:function(){this.$el.removeClass("sidebar-open");var e,t=this.$(".section-container").css("transition-delay").split(", ");_.isArray(t)&&t.length?(e=1e3*_.last(t).replace("s",""),_.delay(_.bind(function(){this.$(".sidebar").addClass("hide")},this),e)):this.$(".sidebar").addClass("hide")}});return s}),define("plex/base/view/details/BaseDetailsView",["plex/base/control/Dispatcher","plex/base/model/SettingsModel","plex/base/view/BaseView"],function(e,t,i){var n=i.extend({className:"container-fluid",initialize:function(){var i=this.model.get("type"),n=this.model.get("grandparentTheme")||this.model.get("parentTheme")||this.model.get("theme"),a=this.views[i];
e.trigger("show:background",this.model),n&&t.get("playThemeMusic")&&e.trigger("command:PlaySound",{url:this.model.server.resolveUrl(n,!1,!0),volume:50,autoLoad:!0,autoPlay:!0,passive:!0}),a?this.details=this.registerView(new a({model:this.model})):(this.$el.addClass("error-container"),this.details=this.registerView(new this.views.unknown({model:this.model})))},render:function(){return this.$el.empty(),this.$el.append(this.details.render().el),this},destroy:function(){i.prototype.destroy.call(this),this.model.release()
}});return n}),define("hb!templates/desktop/details/MovieDetailsView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return'\n			<div class="poster-container">\n				<span class="media-count"></span>\n			</div>\n		'}function r(){return'\n			<a class="change-poster-btn" href="#">\n				<div class="poster-container">\n					<div class="poster-card">\n						<div class="poster-face front">\n							<span class="media-count"></span>\n\n							<div class="hover-overlay card-overlay">\n								<i class="hover-menu-btn glyphicon pencil"></i>\n							</div>\n						</div>\n					</div>\n				</div>\n			</a>\n		'
}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var l,o,c="",d=this,h=i.helperMissing,u=this.escapeExpression;return c+='<div class="details-row row-fluid">\n	<div class="details-controls">\n		',l=i["if"].call(t,t.limited,{hash:{},inverse:d.program(3,r,a),fn:d.program(1,s,a),data:a}),(l||0===l)&&(c+=l),c+='\n\n		<div class="video-audio-flags media-flags"></div>\n	</div>\n\n	<div class="movie-metadata details-metadata">\n		<div class="metadata-right">\n			<h1 class="movie-year"></h1>\n\n			<div class="movie-content-rating metadata"></div>\n\n			<div class="movie-rating metadata"></div>\n		</div>\n\n		<h1><span class="movie-title"></span><button class="movie-unavailable-btn unavailable-btn btn btn-small btn-danger">',o={hash:{},data:a},c+=u((l=i.t||t.t,l?l.call(t,"Unavailable",o):h.call(t,"t","Unavailable",o)))+'</button></h1>\n\n		<div class="movie-genre metadata"></div>\n\n		<div class="metadata metadata-duration">\n			<span class="movie-duration"></span>\n\n			<div class="unwatched-icon unwatched-partial-icon"></div>\n			<div class="unwatched-icon unwatched-full-icon"></div>\n		</div>\n\n		<h2 class="movie-tagline tagline"></h2>\n\n		<div class="movie-director metadata metadata-top"></div>\n		<div class="movie-writer metadata"></div>\n		<div class="movie-cast metadata"></div>\n\n		<div class="movie-audio metadata metadata-top hide"><span class="metadata-label">',o={hash:{},data:a},c+=u((l=i.t||t.t,l?l.call(t,"Audio",o):h.call(t,"t","Audio",o)))+'</span></div>\n		<div class="movie-subtitles metadata hide"><span class="metadata-label">',o={hash:{},data:a},c+=u((l=i.t||t.t,l?l.call(t,"Subtitles",o):h.call(t,"t","Subtitles",o)))+'</span></div>\n\n		<div class="movie-summary summary"></div>\n\n		<div class="media-flags"></div>\n	</div>\n</div>\n'
})}),define("plex/base/control/utils/TagUtil",["plex/base/control/utils/StringUtil","plex/base/control/utils/MediaTypes"],function(e,t){return{truncateTagList:function(t){var i=t.tags,n="";if(i&&i.length){var a=t.maxTags||i.length;a>i.length&&(a=i.length);for(var s=0;a>s;s++){var r=i[s];r.tag!==void 0&&""!==r.tag&&(n+=e.truncate(r.tag,t.maxLen),a>s+1&&(n+=", "))}}return n},truncateLinkedTagList:function(i){var n=i.model.section,a=t.getMediaTypeByString(i.model.get("type")),s=i.tags,r=!n||n.get("limited"),l="",o=function(t){if(r||!t.id)return e.truncate(t.tag,i.maxLen);
var s=["#!/servers/"+n.server.id,"/sections/"+encodeURIComponent(n.id),"/filter?","type="+a.id+"&","key="+i.key+"&","value="+encodeURIComponent(t.id)+"&","title="+encodeURIComponent(t.tag)];return'<a href="'+s.join("")+'">'+e.truncate(t.tag,i.maxLen)+"</a>"};if(s&&s.length){var c=i.maxTags||s.length;c>s.length&&(c=s.length);for(var d=0;c>d;d++){var h=s[d];h.tag!==void 0&&""!==h.tag&&(l+=o(h),c>d+1&&(l+=", "))}}return l}}}),define("plex/base/view/images/MediaFlagImage",["plex/base/view/images/BaseImage"],function(e){var t=e.extend({flag:null,path:null,prefix:null,version:null,setup:function(e){if(e.model&&(this.model=e.model),e.className&&this.$el.addClass(e.className),e.flag){var t=this.model.get("Media");
this.flag=e.flag,t&&t.length&&(this.path=t[0][this.flag]),this.addBinding(this.model,"change:Media",this.onMediaChange)}else this.flag=e.modelAttr,this.path=this.model.get(this.flag),this.addBinding(this.model,"change:"+this.flag,this.onChange);if(this.prefix=this.model.get("mediaTagPrefix"),this.version=this.model.get("mediaTagVersion"),this.path&&(this.url=this.prefix+this.flag+"/"+this.path+"?t="+this.version),this.transcode=e.transcode,this.placeholder=e.placeholder,e.transcode){var i=window.devicePixelRatio?window.devicePixelRatio:1;
this.width=e.width*i,this.height=e.height*i}},onMediaChange:function(e,t){this.update(this.prefix+this.flag+"/"+t[0][this.flag]+"?t="+this.version)},onChange:function(e,t){this.update(this.prefix+this.flag+"/"+t+"?t="+this.version)}});return t}),define("hb!templates/desktop/details/StreamDropdown.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a,s,c="";return c+='\n	<a class="stream-name dropdown-toggle" href="#',(n=i.type)?n=n.call(e,{hash:{},data:t}):(n=e.type,n=typeof n===S?n.apply(e):n),c+=C(n)+'-dropdown-list" data-focus="keyboard" data-toggle="dropdown">',a=i["if"].call(e,(n=e.selectedStream,null==n||n===!1?n:n.language),{hash:{},inverse:A.program(4,l,t),fn:A.program(2,r,t),data:t}),(a||0===a)&&(c+=a),s={hash:{},inverse:A.noop,fn:A.program(6,o,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,e.type,"subtitles",s):_.call(e,"if_eq",e.type,"subtitles",s),(a||0===a)&&(c+=a),s={hash:{},inverse:A.noop,fn:A.program(10,h,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,e.type,"audio",s):_.call(e,"if_eq",e.type,"audio",s),(a||0===a)&&(c+=a),c+=' <i class="glyphicon-caret orange"></i></a>\n\n	<ul class="dropdown-menu dropdown-menu-large">\n		',a=i.each.call(e,e.streams,{hash:{},inverse:A.noop,fn:A.programWithDepth(13,p,t,e),data:t}),(a||0===a)&&(c+=a),c+="\n	</ul>\n"
}function r(e){var t;return C((t=e.selectedStream,t=null==t||t===!1?t:t.language,typeof t===S?t.apply(e):t))}function l(e,t){var n,a;return a={hash:{},data:t},C((n=i.t||e.t,n?n.call(e,"Unknown",a):_.call(e,"t","Unknown",a)))}function o(e,t){var n,a;return a=i["if"].call(e,(n=e.selectedStream,null==n||n===!1?n:n.format),{hash:{},inverse:A.noop,fn:A.program(7,c,t),data:t}),a||0===a?a:""}function c(e,t){var n,a,s,r="";return r+=" (",s={hash:{},data:t},r+=C((n=i.upperCase||e.upperCase,n?n.call(e,(n=e.selectedStream,null==n||n===!1?n:n.format),s):_.call(e,"upperCase",(n=e.selectedStream,null==n||n===!1?n:n.format),s))),a=i["if"].call(e,(n=e.selectedStream,null==n||n===!1?n:n.forced),{hash:{},inverse:A.noop,fn:A.program(8,d,t),data:t}),(a||0===a)&&(r+=a),r+=")"
}function d(){return" Forced"}function h(e,t){var n,a;return a=i["if"].call(e,(n=e.selectedStream,null==n||n===!1?n:n.codec),{hash:{},inverse:A.noop,fn:A.program(11,u,t),data:t}),a||0===a?a:""}function u(e,t){var n,a,s="";return s+=" (",a={hash:{},data:t},s+=C((n=i.formatAudioCodec||e.formatAudioCodec,n?n.call(e,(n=e.selectedStream,null==n||n===!1?n:n.codec),a):_.call(e,"formatAudioCodec",(n=e.selectedStream,null==n||n===!1?n:n.codec),a)))+" ",a={hash:{},data:t},s+=C((n=i.formatAudioChannels||e.formatAudioChannels,n?n.call(e,(n=e.selectedStream,null==n||n===!1?n:n.channels),a):_.call(e,"formatAudioChannels",(n=e.selectedStream,null==n||n===!1?n:n.channels),a)))+")"
}function p(e,t,n){var a,s,r,o="";return o+='\n			<li><a data-id="',(a=i.id)?a=a.call(e,{hash:{},data:t}):(a=e.id,a=typeof a===S?a.apply(e):a),o+=C(a)+'" href="#" data-focus="keyboard">',a=i["if"].call(e,e.language,{hash:{},inverse:A.program(4,l,t),fn:A.program(14,f,t),data:t}),(a||0===a)&&(o+=a),r={hash:{},inverse:A.noop,fn:A.program(16,m,t),data:t},a=i.if_eq||n.if_eq,s=a?a.call(e,n.type,"subtitles",r):_.call(e,"if_eq",n.type,"subtitles",r),(s||0===s)&&(o+=s),r={hash:{},inverse:A.noop,fn:A.program(19,v,t),data:t},a=i.if_eq||n.if_eq,s=a?a.call(e,n.type,"audio",r):_.call(e,"if_eq",n.type,"audio",r),(s||0===s)&&(o+=s),o+=" ",s=i["if"].call(e,e.selected,{hash:{},inverse:A.noop,fn:A.program(22,b,t),data:t}),(s||0===s)&&(o+=s),o+="</a></li>\n		"
}function f(e,t){var n;return(n=i.language)?n=n.call(e,{hash:{},data:t}):(n=e.language,n=typeof n===S?n.apply(e):n),C(n)}function m(e,t){var n;return n=i["if"].call(e,e.format,{hash:{},inverse:A.noop,fn:A.program(17,g,t),data:t}),n||0===n?n:""}function g(e,t){var n,a,s,r="";return r+=" (",s={hash:{},data:t},r+=C((n=i.upperCase||e.upperCase,n?n.call(e,e.format,s):_.call(e,"upperCase",e.format,s))),a=i["if"].call(e,e.forced,{hash:{},inverse:A.noop,fn:A.program(8,d,t),data:t}),(a||0===a)&&(r+=a),r+=")"
}function v(e,t){var n;return n=i["if"].call(e,e.codec,{hash:{},inverse:A.noop,fn:A.program(20,y,t),data:t}),n||0===n?n:""}function y(e,t){var n,a,s="";return s+=" (",a={hash:{},data:t},s+=C((n=i.formatAudioCodec||e.formatAudioCodec,n?n.call(e,e.codec,a):_.call(e,"formatAudioCodec",e.codec,a)))+" ",a={hash:{},data:t},s+=C((n=i.formatAudioChannels||e.formatAudioChannels,n?n.call(e,e.channels,a):_.call(e,"formatAudioChannels",e.channels,a)))+")"}function b(){return'<i class="glyphicon ok-2"></i>'}function w(e,t){var n,a,s,c="";
return a=i["if"].call(e,(n=e.selectedStream,null==n||n===!1?n:n.language),{hash:{},inverse:A.program(4,l,t),fn:A.program(2,r,t),data:t}),(a||0===a)&&(c+=a),s={hash:{},inverse:A.noop,fn:A.program(6,o,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,e.type,"subtitles",s):_.call(e,"if_eq",e.type,"subtitles",s),(a||0===a)&&(c+=a),s={hash:{},inverse:A.noop,fn:A.program(10,h,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,e.type,"audio",s):_.call(e,"if_eq",e.type,"audio",s),(a||0===a)&&(c+=a),c}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};
var x,k="",S="function",C=this.escapeExpression,_=i.helperMissing,A=this;return x=i["if"].call(t,t.showDropdown,{hash:{},inverse:A.program(24,w,a),fn:A.program(1,s,a),data:a}),(x||0===x)&&(k+=x),k+="\n"})}),define("plex/desktop/view/details/StreamDropdown",["hb!templates/desktop/details/StreamDropdown.tpl","plex/base/control/Dispatcher","plex/base/view/BaseView","jquery"],function(e,t,i,n){var a=i.extend({tagName:"span",className:"dropdown",type:null,streams:null,events:{"click a":"onStreamClick"},initialize:function(e){this.type=e.type,this.disabled=e.disabled,this.addBinding(this.model,"change:Media",this.render),this.addBinding(this.model,"change:streams",this.render)
},render:function(){var t,i=this.model.server.get("multiuser"),n=this.model.server.get("shared");if("audio"===this.type?this.streams=this.model.getStreams(2):(this.streams=this.model.getStreams(3),this.streams.unshift({id:"",language:"None"})),_.each(this.streams,function(e){return e.selected?(t=e,!1):void 0}),!t){var a=_.where(this.streams,{id:""});a.length&&(a=a[0],a.selected=!0,t=a)}return this.$el.html(e({type:this.type,streams:this.streams,selectedStream:t,showDropdown:!this.disabled&&this.streams.length>1&&(!n||i)})),this.$el.attr("id",this.type+"-dropdown-list"),this
},onStreamClick:function(e){e.preventDefault();var i=n(e.target).data("id");i!==void 0&&t.trigger("command:SelectStream",this.type,this.model,i)}});return a}),define("plex/base/view/details/BaseMovieDetailsView",["plex/base/control/utils/LocalizationUtil","plex/base/control/utils/TagUtil","plex/base/control/utils/MediaUtil","plex/base/view/FocusView","plex/base/view/Rating","plex/base/view/images/BaseImage","plex/base/view/images/MediaFlagImage","plex/desktop/view/details/StreamDropdown"],function(e,t,i,n,a,s,r,l){var o=n.extend({className:"details movie-details",focusOptions:{defaultElement:".play-btn",container:".details-row",cancellationDirections:{up:".btn-primary.dropdown-toggle"}},initialize:function(){this.rating=this.registerView(new a({model:this.model})),this.poster=this.registerView(new s({model:this.model,modelAttr:"thumb",placeholder:"img/posters/poster.png",className:"poster large-poster movie-poster",transcode:!0,width:256,height:420})),this.audioDropdown=this.registerView(new l({type:"audio",model:this.model})),this.subtitlesDropdown=this.registerView(new l({type:"subtitles",model:this.model})),this.contentRatingFlag=this.registerView(new r({model:this.model,modelAttr:"contentRating",className:"media-flag",transcode:!0,width:70,height:25})),this.videoResolutionFlag=this.registerView(new r({model:this.model,flag:"videoResolution",className:"movie-video-resolution media-flag",transcode:!0,width:100,height:20})),this.audioCodecFlag=this.registerView(new r({model:this.model,flag:"audioCodec",className:"movie-audio-codec media-flag",transcode:!0,width:100,height:20})),this.audioChannelsFlag=this.registerView(new r({model:this.model,flag:"audioChannels",className:"movie-audio-channels media-flag",transcode:!0,width:100,height:20})),this.studioFlag=this.registerView(new r({model:this.model,modelAttr:"studio",className:"movie-studio studio",transcode:!0,width:200,height:40}))
},bindings:{".movie-title":{modelAttr:"title"},".media-count":{modelAttr:"Media",hideEmpty:!0,format:function(){var e=0,t=this.model.get("Media");return t.length>1&&(e=t.length),e}},".movie-unavailable-btn":{modelAttr:"Media",hideEmpty:!0,format:function(e,t){var n=i.getMissingParts(t);n.length?e.removeClass("hide"):e.addClass("hide")}},".movie-year":{modelAttr:"year",hideEmpty:!0},".movie-content-rating":{modelAttr:"contentRating",format:function(e,t){e.toggleClass("hide",!t)}},".movie-genre":{modelAttr:"Genre",hideEmpty:!0,format:function(e,i){if(!i||!i.length)return"";
var n=t.truncateLinkedTagList({model:this.model,key:"genre",tags:i,maxLen:50,maxTags:2});return'<span class="metadata-label">'+n+"</span>"}},".movie-duration":{modelAttr:"duration",hideEmpty:!0,format:function(e,t){return Handlebars.helpers.formatMinutes.call(this,t)}},".unwatched-icon":{modelAttr:"viewCount",format:function(e,t){var i=this.model.server.get("shared"),n=this.model.server.get("multiuser"),a=this.model.get("viewOffset");return i&&!n?(e.addClass("hide"),void 0):(t||a?e.addClass("hide"):(e.removeClass("hide"),this.$(".unwatched-partial-icon").addClass("hide")),void 0)
}},".unwatched-partial-icon":{modelAttr:"viewOffset",format:function(e,t){var i=this.model.server.get("shared"),n=this.model.server.get("multiuser");return i&&!n?(e.addClass("hide"),void 0):(t?(e.removeClass("hide"),this.$(".unwatched-full-icon").addClass("hide")):e.addClass("hide"),void 0)}},".movie-tagline":{modelAttr:"tagline",hideEmpty:!0,format:function(e,t){return t}},".movie-director":{modelAttr:"Director",hideEmpty:!0,format:function(i,n){if(!n||!n.length)return"";var a=e.t("Director"),s=t.truncateLinkedTagList({model:this.model,key:"director",tags:n,maxLen:50,maxTags:3});
return'<span class="metadata-label">'+a+"</span>"+s}},".movie-writer":{modelAttr:"Writer",hideEmpty:!0,format:function(i,n){if(!n||!n.length)return"";var a=e.t("Writer"),s=t.truncateLinkedTagList({model:this.model,key:"writer",tags:n,maxLen:50,maxTags:3});return'<span class="metadata-label">'+a+"</span>"+s}},".movie-cast":{modelAttr:"Role",hideEmpty:!0,format:function(i,n){if(!n||!n.length)return"";var a=e.t("Cast"),s=t.truncateLinkedTagList({model:this.model,key:"actor",tags:n,maxLen:50,maxTags:3});
return'<span class="metadata-label">'+a+"</span>"+s}},".movie-summary":{modelAttr:"summary",hideEmpty:!0,format:function(e,t){return Handlebars.helpers.truncate.call(this,t,700)}}}});return o}),define("hb!templates/desktop/details/ActionBarView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a,s="";return s+='\n		<li>\n			<a class="iconbar-glyphicon-btn play-icon-btn" href="#" rel="tooltip" data-tooltip-position="fixed" data-focus="keyboard" title="',a={hash:{},data:t},s+=S((n=i.t||e.t,n?n.call(e,"Play",a):k.call(e,"t","Play",a)))+'">\n				<i class="glyphicon play"></i>\n			</a>\n		</li>\n	'
}function r(e,t){var n,a,s="";return s+='\n		<li>\n			<a class="iconbar-glyphicon-btn edit-icon-btn" href="#" rel="tooltip" data-tooltip-position="fixed" data-focus="keyboard" title="',a={hash:{},data:t},s+=S((n=i.t||e.t,n?n.call(e,"Edit",a):k.call(e,"t","Edit",a)))+'">\n				<i class="glyphicon pencil"></i>\n			</a>\n		</li>\n	'}function l(e,t){var n,a,s="";return s+='\n		<li>\n			<a class="iconbar-glyphicon-btn refresh-icon-btn" href="#" rel="tooltip" data-tooltip-position="fixed" data-focus="keyboard" title="',a={hash:{},data:t},s+=S((n=i.t||e.t,n?n.call(e,"Refresh",a):k.call(e,"t","Refresh",a)))+'">\n				<i class="glyphicon repeat"></i>\n			</a>\n		</li>\n	'
}function o(e,t){var n,a,s="";return s+='\n		<li>\n			<a class="iconbar-glyphicon-btn analyze-icon-btn" href="#" rel="tooltip" data-tooltip-position="fixed" data-focus="keyboard" title="',a={hash:{},data:t},s+=S((n=i.t||e.t,n?n.call(e,"Analyze",a):k.call(e,"t","Analyze",a)))+'">\n				<i class="glyphicon magic"></i>\n			</a>\n		</li>\n	'}function c(e,t){var n,a,s="";return s+='\n		<li>\n			<a class="actionbar-icon-btn watch-icon-btn" href="#" rel="tooltip" data-tooltip-position="fixed" data-focus="keyboard" title="',a={hash:{},data:t},s+=S((n=i.t||e.t,n?n.call(e,"Mark as Watched",a):k.call(e,"t","Mark as Watched",a)))+'">\n				',a={hash:{},data:t},s+=S((n=i.t||e.t,n?n.call(e,"Mark as Watched",a):k.call(e,"t","Mark as Watched",a)))+"\n			</a>\n		</li>\n	"
}function d(e,t){var n,a,s="";return s+='\n		<li>\n			<a class="actionbar-icon-btn unwatch-icon-btn" href="#" rel="tooltip" data-tooltip-position="fixed" data-focus="keyboard" title="',a={hash:{},data:t},s+=S((n=i.t||e.t,n?n.call(e,"Mark as Unwatched",a):k.call(e,"t","Mark as Unwatched",a)))+'">\n				',a={hash:{},data:t},s+=S((n=i.t||e.t,n?n.call(e,"Mark as Unwatched",a):k.call(e,"t","Mark as Unwatched",a)))+"\n			</a>\n		</li>\n	"}function h(e,t){var n,a,s="";return s+='\n		<li>\n			<a class="iconbar-glyphicon-btn fix-match-icon-btn" href="#" rel="tooltip" data-tooltip-position="fixed" data-focus="keyboard" title="',a={hash:{},data:t},s+=S((n=i.t||e.t,n?n.call(e,"Fix Incorrect Match",a):k.call(e,"t","Fix Incorrect Match",a)))+'">\n				<i class="glyphicon nameplate"></i>\n			</a>\n		</li>\n	'
}function u(e,t){var n,a,s="";return s+='\n		<li>\n			<a class="actionbar-icon-btn unmatch-icon-btn" href="#" rel="tooltip" data-tooltip-position="fixed" data-focus="keyboard" title="',a={hash:{},data:t},s+=S((n=i.t||e.t,n?n.call(e,"Unmatch",a):k.call(e,"t","Unmatch",a)))+'">\n				',a={hash:{},data:t},s+=S((n=i.t||e.t,n?n.call(e,"Unmatch",a):k.call(e,"t","Unmatch",a)))+"\n			</a>\n		</li>\n	"}function p(e,t){var n,a,s="";return s+='\n		<li>\n			<a class="iconbar-glyphicon-btn split-apart-icon-btn" href="#" rel="tooltip" data-tooltip-position="fixed" data-focus="keyboard" title="',a={hash:{},data:t},s+=S((n=i.t||e.t,n?n.call(e,"Split Apart",a):k.call(e,"t","Split Apart",a)))+'">\n				<i class="glyphicon resize-full"></i>\n			</a>\n		</li>\n	'
}function f(e,t){var n,a,s="";return s+='\n		<li>\n			<a class="iconbar-glyphicon-btn sync-icon-btn" href="#" rel="tooltip" data-tooltip-position="fixed" data-focus="keyboard" title="',a={hash:{},data:t},s+=S((n=i.t||e.t,n?n.call(e,"Sync to Device",a):k.call(e,"t","Sync to Device",a)))+'">\n				<i class="glyphicon download"></i>\n			</a>\n		</li>\n	'}function m(e,t){var n;return n=i["if"].call(e,e.downloadUrl,{hash:{},inverse:_.noop,fn:_.program(22,g,t),data:t}),n||0===n?n:""}function g(e,t){var n,a,s,r="";
return r+='\n		<li>\n			<a class="iconbar-glyphicon-btn download-icon-btn" href="',(n=i.downloadUrl)?n=n.call(e,{hash:{},data:t}):(n=e.downloadUrl,n=typeof n===C?n.apply(e):n),r+=S(n)+'" rel="tooltip" data-tooltip-position="fixed" data-focus="keyboard" title="',s={hash:{},data:t},r+=S((n=i.t||e.t,n?n.call(e,"Download",s):k.call(e,"t","Download",s)))+'" download="',(a=i.downloadName)?a=a.call(e,{hash:{},data:t}):(a=e.downloadName,a=typeof a===C?a.apply(e):a),r+=S(a)+'">\n				<i class="glyphicon inbox-in"></i>\n			</a>\n		</li>\n	'
}function v(e,t){var n,a,s="";return s+='\n		<li>\n			<a class="iconbar-glyphicon-btn delete-icon-btn" href="#" rel="tooltip" data-tooltip-position="fixed" data-focus="keyboard" title="',a={hash:{},data:t},s+=S((n=i.t||e.t,n?n.call(e,"Delete",a):k.call(e,"t","Delete",a)))+'">\n				<i class="glyphicon ban"></i>\n			</a>\n		</li>\n	'}function y(e,t){var n,a,s="";return s+='\n		<li>\n			<a class="iconbar-glyphicon-btn share-icon-btn" href="#" rel="tooltip" data-tooltip-position="fixed" data-focus="keyboard" title="',a={hash:{},data:t},s+=S((n=i.t||e.t,n?n.call(e,"Share",a):k.call(e,"t","Share",a)))+'">\n				<i class="glyphicon share"></i>\n			</a>\n		</li>\n\n		<li>\n			<a class="iconbar-glyphicon-btn recommend-icon-btn" href="#" rel="tooltip" data-tooltip-position="fixed" data-focus="keyboard" title="',a={hash:{},data:t},s+=S((n=i.t||e.t,n?n.call(e,"Recommend",a):k.call(e,"t","Recommend",a)))+'">\n				<i class="glyphicon share-alt"></i>\n			</a>\n		</li>\n	'
}function b(e,t){var n,a,s="";return s+='\n		<li>\n			<a class="iconbar-glyphicon-btn info-icon-btn" href="#" rel="tooltip" data-tooltip-position="fixed" data-focus="keyboard" title="',a={hash:{},data:t},s+=S((n=i.t||e.t,n?n.call(e,"Media Info",a):k.call(e,"t","Media Info",a)))+'">\n				<i class="glyphicon circle-info"></i>\n			</a>\n		</li>\n	'}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var w,x="",k=i.helperMissing,S=this.escapeExpression,C="function",_=this;return x+='<ul class="iconbar">\n	',w=i["if"].call(t,t.showPlay,{hash:{},inverse:_.noop,fn:_.program(1,s,a),data:a}),(w||0===w)&&(x+=w),x+="\n\n	",w=i["if"].call(t,t.showEdit,{hash:{},inverse:_.noop,fn:_.program(3,r,a),data:a}),(w||0===w)&&(x+=w),x+="\n\n	",w=i["if"].call(t,t.showRefresh,{hash:{},inverse:_.noop,fn:_.program(5,l,a),data:a}),(w||0===w)&&(x+=w),x+="\n\n	",w=i["if"].call(t,t.showAnalyze,{hash:{},inverse:_.noop,fn:_.program(7,o,a),data:a}),(w||0===w)&&(x+=w),x+="\n\n	",w=i["if"].call(t,t.showWatch,{hash:{},inverse:_.noop,fn:_.program(9,c,a),data:a}),(w||0===w)&&(x+=w),x+="\n\n	",w=i["if"].call(t,t.showUnwatch,{hash:{},inverse:_.noop,fn:_.program(11,d,a),data:a}),(w||0===w)&&(x+=w),x+="\n\n	",w=i["if"].call(t,t.showFixMatch,{hash:{},inverse:_.noop,fn:_.program(13,h,a),data:a}),(w||0===w)&&(x+=w),x+="\n\n	",w=i["if"].call(t,t.showUnmatch,{hash:{},inverse:_.noop,fn:_.program(15,u,a),data:a}),(w||0===w)&&(x+=w),x+="\n\n	",w=i["if"].call(t,t.showSplitApart,{hash:{},inverse:_.noop,fn:_.program(17,p,a),data:a}),(w||0===w)&&(x+=w),x+="\n\n	",w=i["if"].call(t,t.showSync,{hash:{},inverse:_.noop,fn:_.program(19,f,a),data:a}),(w||0===w)&&(x+=w),x+="\n\n	",w=i["if"].call(t,t.showDownload,{hash:{},inverse:_.noop,fn:_.program(21,m,a),data:a}),(w||0===w)&&(x+=w),x+="\n\n	",w=i["if"].call(t,t.showDelete,{hash:{},inverse:_.noop,fn:_.program(24,v,a),data:a}),(w||0===w)&&(x+=w),x+="\n\n	",w=i["if"].call(t,t.showShare,{hash:{},inverse:_.noop,fn:_.program(26,y,a),data:a}),(w||0===w)&&(x+=w),x+="\n\n	",w=i["if"].call(t,t.showInfo,{hash:{},inverse:_.noop,fn:_.program(28,b,a),data:a}),(w||0===w)&&(x+=w),x+="\n</ul>\n"
})}),define("hb!templates/desktop/modals/FixMatchModal.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return"hide"}function r(){return" hide"}function l(e,t){var n,a,s,r="";return r+='\n					<div class="row-fluid">\n						<div class="span10">\n							<a class="match-result" data-guid="',(n=i.guid)?n=n.call(e,{hash:{},data:t}):(n=e.guid,n=typeof n===b?n.apply(e):n),r+=w(n)+'" data-name="',(n=i.name)?n=n.call(e,{hash:{},data:t}):(n=e.name,n=typeof n===b?n.apply(e):n),r+=w(n)+'" href="#">\n								',s={hash:{},data:t},r+=w((n=i.truncate||e.truncate,n?n.call(e,e.name,40,s):x.call(e,"truncate",e.name,40,s))),a=i["if"].call(e,e.year,{hash:{},inverse:k.noop,fn:k.program(6,o,t),data:t}),(a||0===a)&&(r+=a),r+='\n							</a>\n						</div>\n						<div class="span2">\n							<div class="match-score">\n								<div class="bar" style="width: ',(a=i.score)?a=a.call(e,{hash:{},data:t}):(a=e.score,a=typeof a===b?a.apply(e):a),r+=w(a)+'%"></div>\n							</div>\n						</div>\n					</div>\n				'
}function o(e,t){var n,a="";return a+=" (",(n=i.year)?n=n.call(e,{hash:{},data:t}):(n=e.year,n=typeof n===b?n.apply(e):n),a+=w(n)+")"}function c(e,t){var n,a,s="";return s+='\n					<h4 class="no-matches">',a={hash:{},data:t},s+=w((n=i.t||e.t,n?n.call(e,"No matches found",a):x.call(e,"t","No matches found",a)))+"</h4>\n				"}function d(e,t){var n,a="";return a+='\n						<option value="',(n=i.identifier)?n=n.call(e,{hash:{},data:t}):(n=e.identifier,n=typeof n===b?n.apply(e):n),a+=w(n)+'"',n=i["if"].call(e,e.selected,{hash:{},inverse:k.noop,fn:k.program(11,h,t),data:t}),(n||0===n)&&(a+=n),a+=">",(n=i.name)?n=n.call(e,{hash:{},data:t}):(n=e.name,n=typeof n===b?n.apply(e):n),a+=w(n)+"</option>\n						"
}function h(){return" selected"}function u(e,t){var n,a,s="";return s+='\n						<option value="">',a={hash:{},data:t},s+=w((n=i.t||e.t,n?n.call(e,"Loading...",a):x.call(e,"t","Loading...",a)))+"</option>\n						"}function p(e,t){var n,a="";return a+='\n						<option value="',(n=i.value)?n=n.call(e,{hash:{},data:t}):(n=e.value,n=typeof n===b?n.apply(e):n),a+=w(n)+'">',(n=i.label)?n=n.call(e,{hash:{},data:t}):(n=e.label,n=typeof n===b?n.apply(e):n),a+=w(n)+"</option>\n						"}function f(e,t){var n,a,s="";
return s+='\n		<div class="media-location">\n			',a={hash:{},data:t},s+=w((n=i.t||e.t,n?n.call(e,"File",a):x.call(e,"t","File",a)))+": ",a={hash:{},data:t},s+=w((n=i.truncateMiddle||e.truncateMiddle,n?n.call(e,e.path,60,12,a):x.call(e,"truncateMiddle",e.path,60,12,a)))+"\n		</div>\n	"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var m,g,v,y="",b="function",w=this.escapeExpression,x=i.helperMissing,k=this;return y+='<div class="modal-header">\n	<button type="button" class="close" data-dismiss="modal"><i class="glyphicon remove-2"></i></button>\n	<h3><i class="glyphicon nameplate"></i> ',v={hash:{},data:a},y+=w((m=i.t||t.t,m?m.call(t,"Fix Incorrect Match",v):x.call(t,"t","Fix Incorrect Match",v)))+'</h3>\n</div>\n\n<form class="modal-form fix-match-form">\n	<div class="modal-body minimal-scrollbar">\n\n		<div class="fix-match-results ',g=i["if"].call(t,t.unmatched,{hash:{},inverse:k.noop,fn:k.program(1,s,a),data:a}),(g||0===g)&&(y+=g),y+='">\n			<h4>',v={hash:{},data:a},y+=w((m=i.t||t.t,m?m.call(t,"Select the correct {1} from the list below",t.type,v):x.call(t,"t","Select the correct {1} from the list below",t.type,v)))+'</h4>\n\n			<h4 class="match-results-loading',g=i.unless.call(t,t.loading,{hash:{},inverse:k.noop,fn:k.program(3,r,a),data:a}),(g||0===g)&&(y+=g),y+='">\n				',v={hash:{},data:a},y+=w((m=i.t||t.t,m?m.call(t,"Searching for possible matches...",v):x.call(t,"t","Searching for possible matches...",v)))+'\n			</h4>\n			<div class="match-results',g=i["if"].call(t,t.loading,{hash:{},inverse:k.noop,fn:k.program(3,r,a),data:a}),(g||0===g)&&(y+=g),y+='">\n				',g=i.each.call(t,t.results,{hash:{},inverse:k.program(8,c,a),fn:k.program(5,l,a),data:a}),(g||0===g)&&(y+=g),y+='\n			</div>\n		</div>\n\n		<div class="fix-match-search row-fluid ',g=i.unless.call(t,t.unmatched,{hash:{},inverse:k.noop,fn:k.program(1,s,a),data:a}),(g||0===g)&&(y+=g),y+='">\n			<div class="span6">\n				<div class="control-group">\n					<label>',v={hash:{},data:a},y+=w((m=i.t||t.t,m?m.call(t,"Name",v):x.call(t,"t","Name",v)))+'</label>\n					<input type="text" name="name" value="'+w((m=t.media,m=null==m||m===!1?m:m.title,typeof m===b?m.apply(t):m))+'">\n				</div>\n\n				<div class="control-group">\n					<label>',v={hash:{},data:a},y+=w((m=i.t||t.t,m?m.call(t,"Year",v):x.call(t,"t","Year",v)))+'</label>\n					<input type="text" name="year" value="'+w((m=t.media,m=null==m||m===!1?m:m.year,typeof m===b?m.apply(t):m))+'">\n				</div>\n			</div>\n\n			<div class="span6">\n				<div class="control-group">\n					<label>',v={hash:{},data:a},y+=w((m=i.t||t.t,m?m.call(t,"Search using",v):x.call(t,"t","Search using",v)))+'</label>\n					<select name="agent">\n						',g=i.each.call(t,t.agents,{hash:{},inverse:k.program(13,u,a),fn:k.program(10,d,a),data:a}),(g||0===g)&&(y+=g),y+='\n					</select>\n				</div>\n\n				<div class="control-group">\n					<label>',v={hash:{},data:a},y+=w((m=i.t||t.t,m?m.call(t,"Language",v):x.call(t,"t","Language",v)))+'</label>\n					<select name="language">\n						',g=i.each.call(t,t.languages,{hash:{},inverse:k.noop,fn:k.program(15,p,a),data:a}),(g||0===g)&&(y+=g),y+="\n					</select>\n				</div>\n			</div>\n		</div>\n\n	</div>\n\n	",g=i["if"].call(t,t.path,{hash:{},inverse:k.noop,fn:k.program(17,f,a),data:a}),(g||0===g)&&(y+=g),y+='\n\n	<div class="modal-footer">\n		<a class="pull-left toggle-custom ',g=i["if"].call(t,t.unmatched,{hash:{},inverse:k.noop,fn:k.program(1,s,a),data:a}),(g||0===g)&&(y+=g),y+='" href="#">',v={hash:{},data:a},y+=w((m=i.t||t.t,m?m.call(t,"Custom Search",v):x.call(t,"t","Custom Search",v)))+'</a>\n		<a class="pull-left toggle-default hide" href="#">',v={hash:{},data:a},y+=w((m=i.t||t.t,m?m.call(t,"Search Results",v):x.call(t,"t","Search Results",v)))+'</a>\n\n		<button type="submit" class="search-btn btn btn-primary ',g=i.unless.call(t,t.unmatched,{hash:{},inverse:k.noop,fn:k.program(1,s,a),data:a}),(g||0===g)&&(y+=g),y+='" data-focus="keyboard">',v={hash:{},data:a},y+=w((m=i.t||t.t,m?m.call(t,"Search",v):x.call(t,"t","Search",v)))+'</button>\n		<button type="button" class="cancel-btn btn" data-focus="keyboard">',v={hash:{},data:a},y+=w((m=i.t||t.t,m?m.call(t,"Cancel",v):x.call(t,"t","Cancel",v)))+"</button>\n	</div>\n</form>\n\n"
})}),define("plex/base/model/MatchResultModel",["plex/base/control/utils/ParseUtil","plex/base/model/BaseModel","jquery"],function(e,t,i){var n=t.extend({idAttribute:"guid",whitelistedAttrs:["guid","name","lang","score","year"],convert:function(t){var n=_.isObject(t)?t:i.xml2json(t);return e.parseInteger(n,"score"),n.score=Math.min(Math.max(n.score,0),100),n},parse:function(e){var t=this.convert(e);return t=_.pick(t,this.whitelistedAttrs)}});return n}),define("plex/base/model/collections/MatchResultCollection",["plex/base/model/collections/BaseCollection","plex/base/model/MatchResultModel","jquery"],function(e,t){var i=e.extend({model:t,initialize:function(e,t){this.media=t.media,this.server=t.server
},url:function(){return"/library/metadata/"+this.media.id+"/matches"},parse:function(e){return this.convert(e,"SearchResult")}});return i}),define("hb!templates/desktop/lists/MatchUsingDropdownList.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var s,r,l="",o=i.helperMissing,c=this.escapeExpression;return l+='<a class="match-using dropdown-toggle" href="#match-using-dropdown-list" data-toggle="dropdown">',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Match Using",r):o.call(t,"t","Match Using",r)))+' <i class="glyphicon-caret orange small"></i></a>\n\n<ul class="dropdown-menu dropdown-menu-large"></ul>\n'
})}),define("hb!templates/desktop/lists/items/MatchUsingDropdownListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var s,r="",l="function",o=this.escapeExpression;return r+='<a href="#">',(s=i.name)?s=s.call(t,{hash:{},data:a}):(s=t.name,s=typeof s===l?s.apply(t):s),r+=o(s)+"</a>\n"})}),define("plex/desktop/view/lists/items/MatchUsingDropdownListItem",["hb!templates/desktop/lists/items/MatchUsingDropdownListItem.tpl","plex/base/control/Dispatcher","plex/base/view/BaseView"],function(e,t,i){var n=i.extend({tagName:"li",media:null,events:{"click a":"onClick"},initialize:function(e){this.media=e.list.model,this.addBinding(this.model,"change",this.render)
},render:function(){return this.$el.html(e(this.model.toJSON())),this},onClick:function(e){e.preventDefault(),t.trigger("command:MatchUsing",this.media,this.model)}});return n}),define("plex/desktop/view/lists/MatchUsingDropdownList",["hb!templates/desktop/lists/MatchUsingDropdownList.tpl","plex/base/view/lists/BaseList","plex/desktop/view/lists/items/MatchUsingDropdownListItem"],function(e,t,i){var n=t.extend({id:"match-using-dropdown-list",tagName:"span",className:"dropdown pull-left",initialize:function(){this.setup(i,".dropdown-menu")
},render:function(){return this.$el.html(e()),this.populate(this.collection),this},addItem:function(e){return"com.plexapp.agents.none"!==e.id?t.prototype.addItem.apply(this,arguments):void 0}});return n}),define("plex/desktop/view/modals/FixMatchModal",["hb!templates/desktop/modals/FixMatchModal.tpl","plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/control/utils/LanguageUtil","plex/base/control/utils/SectionTypes","plex/base/model/collections/AgentCollection","plex/base/model/collections/MatchResultCollection","plex/base/view/modals/BaseModal","plex/desktop/view/lists/MatchUsingDropdownList","jquery"],function(e,t,i,n,a,s,r,l,o,c){var d=function(e){return _.map(e,function(e){return'<option value="'+e.value+'"'+(e.selected?" selected":"")+">"+e.label+"</option>"
}).join("\n")},h=function(e){return e?_.map(e.get("language"),function(e){return{label:n.getLanguageName(e),value:e}}):[]},u=l.extend({name:"fixMatchModal",className:"fix-match-modal modal fade",custom:!1,matchUsingList:null,events:{hidden:"close","click .match-result":"onMatchResultClick",'change select[name="agent"]':"onAgentChange","submit form":"onSubmitSearch","click .toggle-custom":"onToggleCustomClick","click .toggle-default":"onToggleDefaultClick","click .cancel-btn":"onCancel"},initialize:function(){var e=a.getSectionTypeByString(this.model.section.get("type"));
this.results=new r([],{server:this.model.server,media:this.model}),this.agents=new s([],{server:this.model.server,sectionType:e.typeID}),this.loading=!0,this.addBinding(t,"hide:fixMatchModal",this.onCancel),this.addBinding(this.results,"reset",function(){this.loading=!1,this.render()}),this.results.populate({processData:!0,timeout:0,hideLoadingAlert:!0}).fail(_.bind(function(){this.loading=!1,this.render()},this)),this.agents.populate({hideLoadingAlert:!0}).done(_.bind(function(e){var t=this.$("select[name=agent]");
if(t){var i=this.model.section.get("agent");t.empty().append(d(e.map(function(e){return{label:e.get("name"),value:e.get("identifier"),selected:i==e.get("identifier")}}))),this.setLanguages(e.get(i))}},this)),this.matchUsingList=this.registerView(new o({model:this.model,collection:this.agents}))},render:function(){var t=this.model.section.get("agent"),n=this.agents.get(t),a=this.model.get("guid"),s=this.model.get("type")||"item",r={media:this.model.toJSON(),results:this.results.toJSON(),agents:this.agents.toJSON(),languages:h(n),loading:this.loading,type:i.t(s),path:this.model.getMediaLocation(),unmatched:(!a||/none\:\/\//.test(a))&&!this.custom};
return _.each(r.agents,function(e){e.identifier===t&&(e.selected=!0)}),this.$el.html(e(r)).modal(),this.$(".modal-footer").prepend(this.matchUsingList.render().el),this},setLanguages:function(e){var t=this.$('select[name="language"]');t.empty(),e&&t.append(d(h(e)))},onMatchResultClick:function(e){e.preventDefault();var t=c(e.target),i={guid:t.data("guid"),name:t.data("name")},n="/library/metadata/"+this.model.id+"/match?"+c.param(i),a=_.extend({type:"PUT"},this.model.server.getAjaxOptions(n));c.ajax(a),this.$el.modal("hide")
},onAgentChange:function(e){var t=this.agents.get(e.target.value);this.setLanguages(t)},onSubmitSearch:function(e){e.preventDefault();var t=e.target,i={title:t.name.value,year:t.year.value,agent:t.agent.value,language:t.language.value,manual:1};this.$(".unmatched-container").addClass("hide"),this.$(".results-container").removeClass("hide"),this.$(".match-results").addClass("hide"),this.$(".match-results-loading").removeClass("hide"),this.$(".fix-match-search").addClass("hide"),this.$(".fix-match-results").removeClass("hide"),this.$(".toggle-custom").removeClass("hide"),this.$(".toggle-default").addClass("hide"),this.$(".search-btn").addClass("hide"),this.loading=!0,this.custom=!0,this.results.fetch({data:i,processData:!0,timeout:1e5,hideLoadingAlert:!0}).fail(_.bind(function(){this.loading=!1,this.render()
},this))},onToggleCustomClick:function(e){e.preventDefault(),this.$(".fix-match-results").addClass("hide"),this.$(".fix-match-search").removeClass("hide"),this.$(".toggle-custom").addClass("hide"),this.$(".toggle-default").removeClass("hide"),this.$(".search-btn").removeClass("hide")},onToggleDefaultClick:function(e){e.preventDefault(),this.$(".fix-match-search").addClass("hide"),this.$(".fix-match-results").removeClass("hide"),this.$(".toggle-custom").removeClass("hide"),this.$(".toggle-default").addClass("hide"),this.$(".search-btn").addClass("hide")
},onCancel:function(e){e&&e.preventDefault(),this.$el.modal("hide")}});return u}),define("hb!templates/desktop/modals/ShareModal.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a="";return a+='\n		<ul class="select-networks-list select-list minimal-scrollbar">\n			',n=i.each.call(e,e.networks,{hash:{},inverse:y.noop,fn:y.programWithDepth(2,r,t,e),data:t}),(n||0===n)&&(a+=n),a+="\n		</ul>\n	"}function r(e,t,n){var a,s,r,d="";return d+='\n				<li>\n					<a class="network ',a=i["if"].call(e,n.autoSelect,{hash:{},inverse:y.noop,fn:y.program(3,l,t),data:t}),(a||0===a)&&(d+=a),d+='" data-id="',(a=i.key)?a=a.call(e,{hash:{},data:t}):(a=e.key,a=typeof a===w?a.apply(e):a),d+=x(a)+'" href="#" data-focus="keyboard">',r={hash:{},inverse:y.program(7,c,t),fn:y.program(5,o,t),data:t},a=i.if_eq||e.if_eq,s=a?a.call(e,e.key,"facebook",r):b.call(e,"if_eq",e.key,"facebook",r),(s||0===s)&&(d+=s),d+=" ",(s=i.title)?s=s.call(e,{hash:{},data:t}):(s=e.title,s=typeof s===w?s.apply(e):s),d+=x(s)+"</a>\n				</li>\n			"
}function l(){return"selected"}function o(){return'<i class="network-icon glyphicon glyphicon-social facebook"></i>'}function c(e,t){var n,a,s;return s={hash:{},inverse:y.noop,fn:y.program(8,d,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,e.key,"twitter",s):b.call(e,"if_eq",e.key,"twitter",s),a||0===a?a:""}function d(){return'<i class="network-icon glyphicon glyphicon-social twitter"></i>'}function h(e,t){var n,a,s="";return s+='\n		<div class="empty-message">',a={hash:{},data:t},s+=x((n=i.t||e.t,n?n.call(e,"You need to <a href='{1}' target='_blank'>link your account</a>.",e.accountUrl,a):b.call(e,"t","You need to <a href='{1}' target='_blank'>link your account</a>.",e.accountUrl,a)))+"</div>\n	"
}function u(){return"hidden"}function p(){return"disabled"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var f,m,g,v="",y=this,b=i.helperMissing,w="function",x=this.escapeExpression;return v+='<div class="modal-header">\n	<button type="button" class="close" data-dismiss="modal"><i class="glyphicon remove-2"></i></button>\n	<h3><i class="glyphicon share"></i> ',g={hash:{},data:a},v+=x((f=i.t||t.t,f?f.call(t,"Share",g):b.call(t,"t","Share",g)))+'</h3>\n</div>\n\n<div class="modal-body minimal-scrollbar">\n	',m=i["if"].call(t,t.networks,{hash:{},inverse:y.program(10,h,a),fn:y.program(1,s,a),data:a}),(m||0===m)&&(v+=m),v+='\n\n	<div class="input-minimal-container ',m=i.unless.call(t,t.autoSelect,{hash:{},inverse:y.noop,fn:y.program(12,u,a),data:a}),(m||0===m)&&(v+=m),v+='">\n		<textarea id="share-message" class="input-dark input-minimal" placeholder="',g={hash:{},data:a},v+=x((f=i.t||t.t,f?f.call(t,"Say something about this...",g):b.call(t,"t","Say something about this...",g)))+'"></textarea>\n	</div>\n</div>\n\n<div class="modal-footer pull-center">\n	<span class="characters-remaining"></span>\n	<button type="button" class="share-btn btn btn-medium btn-primary ',m=i.unless.call(t,t.autoSelect,{hash:{},inverse:y.noop,fn:y.program(14,p,a),data:a}),(m||0===m)&&(v+=m),v+='" data-focus="keyboard">',g={hash:{},data:a},v+=x((f=i.t||t.t,f?f.call(t,"Share",g):b.call(t,"t","Share",g)))+"</button>\n</div>\n"
})}),define("plex/desktop/view/modals/ShareModal",["hb!templates/desktop/modals/ShareModal.tpl","plex/base/control/Dispatcher","plex/base/model/AppModel","plex/base/view/modals/BaseModal","jquery"],function(e,t,i,n,a){var s=n.extend({name:"shareModal",className:"modal modal-small select-modal fade",linkedNetworks:null,networkIDs:null,maxLength:0,events:{hidden:"close","click .network":"onNetworkClick","keyup #share-message":"onMessageKeyUp","click .share-btn":"onShareClick"},initialize:function(){var e=i.get("myPlex");
this.linkedNetworks=e.get("socialNetworks").where({linked:!0}),this.networkIDs=[]},render:function(){for(var t=[],n=1===this.linkedNetworks.length,a=i.get("myPlex"),s=0,r=this.linkedNetworks.length;r>s;s++)t.push(this.linkedNetworks[s].toJSON());return this.$el.html(e({accountUrl:a.url()+"users/edit",networks:t,autoSelect:n})).modal(),n&&(this.networkIDs.push(this.linkedNetworks[0].id),this.calculateMaxLength()),this},calculateMaxLength:function(){var e=null,t=i.get("myPlex"),n=t.get("socialNetworks");
_.each(this.networkIDs,function(t){var i=n.get(t),a=i.get("maxLength");(null===e||e>a)&&(e=a)}),this.maxLength=e,this.calculateCharactersRemaining()},calculateCharactersRemaining:function(){var e=this.$("#share-message").val(),t=this.maxLength-e.length,i=this.$(".characters-remaining");return null===this.maxLength?(i.addClass("hide"),void 0):(0>t?(i.addClass("error").removeClass("hide"),this.$(".share-btn").addClass("disabled")):(i.removeClass("error hide"),this.$(".share-btn").removeClass("disabled")),this.$(".characters-remaining").text(this.maxLength-e.length),void 0)
},onNetworkClick:function(e){e.preventDefault();var t=a(e.currentTarget),i=t.data("id");t.hasClass("selected")?this.networkIDs.splice(_.indexOf(this.networkIDs,i),1):this.networkIDs.push(i),t.toggleClass("selected"),this.networkIDs.length?(this.$(".share-btn").removeClass("disabled"),this.$(".input-minimal-container").removeClass("hidden")):(this.$(".share-btn").addClass("disabled"),this.$(".input-minimal-container").addClass("hidden")),this.calculateMaxLength()},onMessageKeyUp:function(){this.calculateCharactersRemaining()
},onShareClick:function(e){e.preventDefault();var i=a(e.currentTarget);if(!i.hasClass("disabled")){i.addClass("disabled");var n=this.$("#share-message").val(),s=_.bind(function(){this.$el.modal("hide")},this),r=_.bind(function(){i.removeClass("disabled")});t.trigger("command:Share",this.model,this.networkIDs,n,s,r)}}});return s}),define("hb!templates/desktop/modals/RecommendModal.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};
var s,r,l="",o=i.helperMissing,c=this.escapeExpression;return l+='<div class="modal-header">\n	<button type="button" class="close" data-dismiss="modal"><i class="glyphicon remove-2"></i></button>\n	<h3><i class="glyphicon share-alt"></i> ',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Select Friends",r):o.call(t,"t","Select Friends",r)))+'</h3>\n</div>\n\n<div class="modal-body minimal-scrollbar">\n	<div class="empty-message hide">',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"You need <a class='friends-btn' href='{1}'>friends</a> to recommend media.","#!/friends",r):o.call(t,"t","You need <a class='friends-btn' href='{1}'>friends</a> to recommend media.","#!/friends",r)))+'</div>\n\n	<div class="input-minimal-container hidden">\n		<textarea id="recommend-message" class="input-dark input-minimal" placeholder="',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Say something about this...",r):o.call(t,"t","Say something about this...",r)))+'"></textarea>\n	</div>\n</div>\n\n<div class="modal-footer pull-center">\n	<button type="button" class="send-btn btn btn-medium btn-primary disabled" data-focus="keyboard">',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Send",r):o.call(t,"t","Send",r)))+"</button>\n</div>\n"
})}),define("hb!templates/desktop/lists/myplex/items/SelectFriendListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var s,r,l="",o="function",c=this.escapeExpression,d=i.helperMissing;return l+='<a class="friend" data-id="',(s=i.recommendationsPlaylistId)?s=s.call(t,{hash:{},data:a}):(s=t.recommendationsPlaylistId,s=typeof s===o?s.apply(t):s),l+=c(s)+'" href="#" data-focus="keyboard">\n	',r={hash:{},data:a},l+=c((s=i.truncate||t.truncate,s?s.call(t,t.title,20,r):d.call(t,"truncate",t.title,20,r)))+"\n</a>\n"
})}),define("plex/desktop/view/lists/myplex/items/SelectFriendListItem",["hb!templates/desktop/lists/myplex/items/SelectFriendListItem.tpl","plex/base/view/BaseView","plex/base/view/images/BaseImage"],function(e,t,i){var n=t.extend({tagName:"li",thumb:null,initialize:function(){this.thumb=this.registerView(new i({model:this.model,modelAttr:"thumb",placeholder:"img/posters/friend.png",className:"poster friend-poster"})),this.addBinding(this.model,"change",this.render)},render:function(){return this.$el.html(e(this.model.toJSON())),this.$(".friend").prepend(this.thumb.render().el),this
}});return n}),define("plex/desktop/view/lists/myplex/SelectFriendList",["plex/base/view/lists/BaseList","plex/desktop/view/lists/myplex/items/SelectFriendListItem"],function(e,t){var i=e.extend({tagName:"ul",className:"select-friends-list select-list minimal-scrollbar",initialize:function(){this.setup(t)},render:function(){return this.$el.empty(),this.populate(this.collection),this}});return i}),define("plex/desktop/view/modals/RecommendModal",["hb!templates/desktop/modals/RecommendModal.tpl","plex/base/control/Dispatcher","plex/base/model/AppModel","plex/base/view/modals/BaseModal","plex/desktop/view/lists/myplex/SelectFriendList","jquery"],function(e,t,i,n,a,s){var r=n.extend({name:"recommendModal",className:"modal modal-small select-modal fade",playlistIDs:null,focusOptions:{defaultElement:".select-list a"},events:{hidden:"close","click .friend":"onFriendClick","click .friends-btn":"onFriendsClick","click .send-btn":"onSendClick"},initialize:function(){var e=i.get("myPlex");
this.playlistIDs=[],this.collection=e.get("friends"),this.list=this.registerView(new a({collection:this.collection}))},render:function(){return this.$el.html(e({friends:this.collection.toJSON()})).modal(),this.collection.length?this.$(".modal-body").prepend(this.list.render().el):this.$(".empty-message").removeClass("hide"),this},onFriendClick:function(e){e.preventDefault();var t=s(e.currentTarget),i=t.data("id");t.hasClass("selected")?this.playlistIDs.splice(_.indexOf(this.playlistIDs,i),1):this.playlistIDs.push(i),t.toggleClass("selected"),this.playlistIDs.length?(this.$(".send-btn").removeClass("disabled"),this.$(".input-minimal-container").removeClass("hidden")):(this.$(".send-btn").addClass("disabled"),this.$(".input-minimal-container").addClass("hidden"))
},onFriendsClick:function(){this.$el.modal("hide")},onSendClick:function(e){e.preventDefault();var i=s(e.currentTarget);if(!i.hasClass("disabled")){i.addClass("disabled");var n=this.$("#recommend-message").val(),a=_.bind(function(){this.$el.modal("hide")},this),r=_.bind(function(){i.removeClass("disabled")});t.trigger("command:Recommend",this.model,this.playlistIDs,n,a,r)}}});return r}),define("plex/base/view/details/BaseActionBarView",["plex/base/control/Dispatcher","plex/base/model/AppModel","plex/base/view/FocusView","plex/desktop/view/modals/FixMatchModal","plex/desktop/view/modals/ShareModal","plex/desktop/view/modals/RecommendModal"],function(e,t,i,n,a,s){var r=i.extend({className:"actionbar",focused:!0,shared:!1,limited:!1,focusOptions:{position:1,activationDirection:"left",cancellationDirections:["left","right"]},events:{"click .refresh-icon-btn":"onRefreshClick","click .watch-icon-btn":"onWatchClick","click .unwatch-icon-btn":"onUnwatchClick","click .fix-match-icon-btn":"onFixMatchClick","click .unmatch-icon-btn":"onUnmatchClick","click .delete-icon-btn":"onDeleteClick","click .share-icon-btn":"onShareClick","click .recommend-icon-btn":"onRecommendClick"},initialize:function(i){var n=t.get("myPlex"),a=_.clone(this.defaultOptions[this.model.get("type")]);
this.typeOptions=_.extend(a,i),this.visibilityOptions=_.extend({},this.typeOptions),this.shared=this.model.server.get("shared"),this.limited=this.model.section&&this.model.section.get("limited"),this.typeOptions.showWatch&&(this.addBinding(this.model,"change:unviewedLeafCount",this.render),this.addBinding(this.model,"change:viewedLeafCount",this.render),this.addBinding(this.model,"change:viewCount",this.render),this.addBinding(this.model,"change:viewOffset",this.render)),this.typeOptions.showUnmatch&&this.addBinding(this.model,"change:guid",this.render),this.typeOptions.showSplitApart&&(this.addBinding(this.model,"change:Media",this.render),this.addBinding(this.model,"change:Location",this.render)),this.typeOptions.showSync&&this.addBinding(n.get("devices"),"reset",this.render),this.addBinding(e,"shortcut:refresh",this.refresh),this.addBinding(e,"shortcut:markWatched",this.markWatched),this.addBinding(e,"shortcut:markUnwatched",this.markUnwatched),this.addBinding(e,"shortcut:deleteItem",this.deleteItem)
},updateVisibilityOptions:function(){this.showWatch(),this.visibilityOptions.showRefresh=this.showAction("showRefresh"),this.visibilityOptions.showFixMatch=this.showAction("showFixMatch"),this.visibilityOptions.showUnmatch=this.showUnmatch(),this.visibilityOptions.showDelete=this.showDelete(),this.visibilityOptions.showShare=this.showShare()},showAction:function(e){return this.typeOptions[e]?this.shared||this.limited?!1:!0:!1},showWatch:function(){if(!this.typeOptions.showWatch)return this.visibilityOptions.showWatch=!1,this.visibilityOptions.showUnwatch=!1,void 0;
var e=this.model.server.get("multiuser"),t=this.model.get("type");if(this.limited||this.shared&&!e)this.visibilityOptions.showWatch=!1,this.visibilityOptions.showUnwatch=!1;else if("show"===t||"season"===t)this.visibilityOptions.showWatch=this.model.get("unviewedLeafCount")>0,this.visibilityOptions.showUnwatch=this.model.get("viewedLeafCount")>0;else{var i=!!this.model.get("viewCount"),n=!!this.model.get("viewOffset");this.visibilityOptions.showWatch=!i||n,this.visibilityOptions.showUnwatch=i||n}},showUnmatch:function(){if(!this.typeOptions.showUnmatch)return!1;
if(this.shared||this.limited)return!1;var e=this.model.get("guid");return!e||/(local|none)\:\/\//.test(e)?!1:!0},showDelete:function(){return this.typeOptions.showDelete?this.shared||this.limited?!1:this.model.server.get("allowMediaDeletion")?!0:!1:!1},showShare:function(){if(!this.typeOptions.showShare)return!1;var e=t.get("myPlex");return e.get("signedIn")?!0:!1},refresh:function(){this.visibilityOptions.showRefresh&&e.trigger("command:RefreshMetadata",this.model)},markWatched:function(){this.visibilityOptions.showWatch&&e.trigger("command:MarkWatched",this.model)
},markUnwatched:function(){this.visibilityOptions.showUnwatch&&e.trigger("command:MarkUnwatched",this.model)},deleteItem:function(){this.visibilityOptions.showDelete&&e.trigger("command:DeleteMedia",this.model)},onRefreshClick:function(e){e.preventDefault(),this.refresh()},onWatchClick:function(e){e.preventDefault(),this.markWatched()},onUnwatchClick:function(e){e.preventDefault(),this.markUnwatched()},onFixMatchClick:function(e){e.preventDefault(),t.set("modal",new n({model:this.model}))},onUnmatchClick:function(t){t.preventDefault(),e.trigger("command:Unmatch",this.model)
},onDeleteClick:function(e){e.preventDefault(),this.deleteItem()},onShareClick:function(e){e.preventDefault(),t.set("modal",new a({model:this.model}))},onRecommendClick:function(e){e.preventDefault(),t.set("modal",new s({model:this.model}))}});return r}),define("plex/desktop/view/details/ActionBarView",["hb!templates/desktop/details/ActionBarView.tpl","plex/base/control/Dispatcher","plex/base/model/AppModel","plex/base/view/details/BaseActionBarView","plex/desktop/view/modals/MediaInfoModal","plex/desktop/view/modals/FixMatchModal","plex/desktop/view/modals/SyncModal","plex/desktop/view/modals/SelectDeviceModal","jquery"],function(e,t,i,n,a,s,r,l,o){var c=n.extend({defaultOptions:{movie:{showEdit:!0,showRefresh:!0,showAnalyze:!0,showWatch:!0,showFixMatch:!0,showUnmatch:!0,showSplitApart:!0,showSync:!0,showDownload:!0,showDelete:!0,showInfo:!0},show:{showEdit:!0,showRefresh:!0,showWatch:!0,showFixMatch:!0,showUnmatch:!0,showSplitApart:!0,showSync:!0},season:{showEdit:!0,showWatch:!0,showSync:!0},episode:{showEdit:!0,showRefresh:!0,showAnalyze:!0,showWatch:!0,showSync:!0,showDownload:!0,showDelete:!0,showInfo:!0},artist:{showEdit:!0,showRefresh:!0,showFixMatch:!0,showUnmatch:!0,showSplitApart:!0,showSync:!0},album:{showEdit:!0,showRefresh:!0,showFixMatch:!0,showUnmatch:!0,showSplitApart:!0,showSync:!0},track:{showEdit:!0,showAnalyze:!0,showSync:!0,showDownload:!0,showDelete:!0},photoAlbum:{showEdit:!0,showSync:!0},photo:{showEdit:!0,showAnalyze:!0,showSync:!0,showDelete:!0},clip:{showSync:!0,showShare:!0,showInfo:!0}},events:_.extend({"click .edit-icon-btn":"onEditClick","click .analyze-icon-btn":"onAnalyzeClick","click .split-apart-icon-btn":"onSplitApartClick","click .sync-icon-btn":"onSyncClick","click .info-icon-btn":"onInfoClick"},n.prototype.events),initialize:function(){n.prototype.initialize.apply(this,arguments),this.addBinding(t,"shortcut:edit",this.edit),this.addBinding(t,"shortcut:analyze",this.analyze),this.addBinding(t,"shortcut:sync",this.sync),this.addBinding(t,"shortcut:info",this.info)
},render:function(){this.updateVisibilityOptions();var t=_.extend({},this.visibilityOptions);t.downloadUrl=this.model.getDownloadUrl();var i=this.model.getMediaLocation();if(i){var n=/[^\/\\]+$/;t.downloadName=_.first(n.exec(i))}return this.$el.html(e(t)),o(".tooltip").remove(),this.$el.tooltip({selector:".actionbar-icon-btn, .iconbar-glyphicon-btn",placement:"right"}),this},updateVisibilityOptions:function(){n.prototype.updateVisibilityOptions.apply(this,arguments),this.visibilityOptions.showEdit=this.showAction("showEdit"),this.visibilityOptions.showAnalyze=this.showAction("showAnalyze"),this.visibilityOptions.showSplitApart=this.showSplitApart(),this.visibilityOptions.showSync=this.showSync(),this.visibilityOptions.showDownload=this.showAction("showDownload")
},showSplitApart:function(){if(!this.typeOptions.showSplitApart)return!1;if(this.shared||this.limited)return!1;var e,t=this.model.get("type");switch(t){case"movie":case"episode":e=this.model.get("Media");break;case"show":case"artist":case"album":e=this.model.get("Location");break;default:e=this.model.get("Media")}return!this.model.server.supports("splitApart")||2>e.length?!1:!0},showSync:function(){if(!this.typeOptions.showSync)return!1;if(this.shared||this.limited)return!1;var e=i.get("myPlex"),t=e.get("devices").getSyncDevices();
return this.model.server.supports("sync")&&t.length&&e.get("signedIn")&&this.model.get("allowSync")?!0:!1},edit:function(){this.visibilityOptions.showEdit&&t.trigger("navigate:edit",{serverID:this.model.server.id,sectionID:this.model.section.id,mediaID:this.model.id})},analyze:function(){this.visibilityOptions.showAnalyze&&t.trigger("command:AnalyzeMedia",this.model)},sync:function(){if(this.visibilityOptions.showSync){var e=i.get("myPlex"),t=e.get("devices"),n=t.getSyncDevices(),a=this.model.get("type"),s=/(album|artist|show|season)/.test(a),o=new r({directory:s,section:!1,model:this.model});
if(n.length>1){var c=new l,d=_.bind(function(e){c.off("select:device",d),o.device=t.get(e),i.set("modal",o)},this);c.on("select:device",d),i.set("modal",c)}else 1===n.length&&(o.device=n[0],i.set("modal",o))}},info:function(){this.visibilityOptions.showInfo&&i.set("modal",new a({model:this.model}))},onEditClick:function(e){e.preventDefault(),this.edit()},onAnalyzeClick:function(e){e.preventDefault(),this.analyze()},onSplitApartClick:function(e){e.preventDefault(),t.trigger("command:SplitApart",this.model)
},onSyncClick:function(e){e.preventDefault(),this.sync()},onInfoClick:function(e){e.preventDefault(),this.info()}});return c}),define("hb!templates/desktop/details/PlaySplitButton.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a,s,l="";return l+='\n	<div class="btn-group">\n		',n=i["if"].call(e,e.channel,{hash:{},inverse:k.program(8,d,t),fn:k.program(2,r,t),data:t}),(n||0===n)&&(l+=n),l+='\n			<i class="glyphicon play"></i> ',s={hash:{},data:t},l+=w((n=i.t||e.t,n?n.call(e,"Play",s):b.call(e,"t","Play",s)))+'\n		</a>\n		<button type="button" class="btn btn-medium btn-primary dropdown-toggle" data-focus="keyboard" data-toggle="dropdown">\n			<i class="glyphicon-caret small"></i>\n		</button>\n		<ul class="dropdown-menu dropdown-menu-large pull-right">\n			',a=i["if"].call(e,e.channel,{hash:{},inverse:k.program(12,u,t),fn:k.program(10,h,t),data:t}),(a||0===a)&&(l+=a),l+="\n\n			",a=i.each.call(e,e.clients,{hash:{},inverse:k.noop,fn:k.program(14,p,t),data:t}),(a||0===a)&&(l+=a),l+="\n		</ul>\n	</div>\n"
}function r(e,t){var n,a,s="";return s+='\n			<a class="play-btn btn btn-medium btn-primary" href="#!/servers/',(n=i.serverID)?n=n.call(e,{hash:{},data:t}):(n=e.serverID,n=typeof n===x?n.apply(e):n),s+=w(n)+"/channels/player?",n=i["if"].call(e,e.channelKey,{hash:{},inverse:k.program(5,o,t),fn:k.program(3,l,t),data:t}),(n||0===n)&&(s+=n),s+="path=",a={hash:{},data:t},s+=w((n=i.encodeUrl||e.encodeUrl,n?n.call(e,(n=e.video,null==n||n===!1?n:n.key),a):b.call(e,"encodeUrl",(n=e.video,null==n||n===!1?n:n.key),a)))+'" data-focus="keyboard">\n		'
}function l(e,t){var n,a,s="";return s+="key=",a={hash:{},data:t},s+=w((n=i.encodeUrl||e.encodeUrl,n?n.call(e,e.channelKey,a):b.call(e,"encodeUrl",e.channelKey,a)))+"&"}function o(e,t){var n;return n=i["if"].call(e,e.channelID,{hash:{},inverse:k.noop,fn:k.program(6,c,t),data:t}),n||0===n?n:""}function c(e,t){var n,a="";return a+="identifier=",(n=i.channelID)?n=n.call(e,{hash:{},data:t}):(n=e.channelID,n=typeof n===x?n.apply(e):n),a+=w(n)+"&"}function d(e,t){var n,a,s="";return s+='\n			<a class="play-btn btn btn-medium btn-primary" href="#!/servers/',(n=i.serverID)?n=n.call(e,{hash:{},data:t}):(n=e.serverID,n=typeof n===x?n.apply(e):n),s+=w(n)+"/sections/",a={hash:{},data:t},s+=w((n=i.encodeUrl||e.encodeUrl,n?n.call(e,e.sectionID,a):b.call(e,"encodeUrl",e.sectionID,a)))+"/player/"+w((n=e.video,n=null==n||n===!1?n:n.ratingKey,typeof n===x?n.apply(e):n))+'" data-focus="keyboard">\n		'
}function h(e,t){var n,a,s="";return s+='\n				<li><a class="play-btn" href="#!/servers/',(n=i.serverID)?n=n.call(e,{hash:{},data:t}):(n=e.serverID,n=typeof n===x?n.apply(e):n),s+=w(n)+"/channels/player?",n=i["if"].call(e,e.channelKey,{hash:{},inverse:k.program(5,o,t),fn:k.program(3,l,t),data:t}),(n||0===n)&&(s+=n),s+="path=",a={hash:{},data:t},s+=w((n=i.encodeUrl||e.encodeUrl,n?n.call(e,(n=e.video,null==n||n===!1?n:n.key),a):b.call(e,"encodeUrl",(n=e.video,null==n||n===!1?n:n.key),a)))+'" data-focus="keyboard">',a={hash:{},data:t},s+=w((n=i.t||e.t,n?n.call(e,"Play here",a):b.call(e,"t","Play here",a)))+"</a></li>\n			"
}function u(e,t){var n,a,s="";return s+='\n				<li><a class="play-btn" href="#!/servers/',(n=i.serverID)?n=n.call(e,{hash:{},data:t}):(n=e.serverID,n=typeof n===x?n.apply(e):n),s+=w(n)+"/sections/",a={hash:{},data:t},s+=w((n=i.encodeUrl||e.encodeUrl,n?n.call(e,e.sectionID,a):b.call(e,"encodeUrl",e.sectionID,a)))+"/player/"+w((n=e.video,n=null==n||n===!1?n:n.ratingKey,typeof n===x?n.apply(e):n))+'" data-focus="keyboard">',a={hash:{},data:t},s+=w((n=i.t||e.t,n?n.call(e,"Play here",a):b.call(e,"t","Play here",a)))+"</a></li>\n			"
}function p(e,t){var n,a,s="";return s+='\n				<li><a class="client-btn" data-id="',(n=i.machineIdentifier)?n=n.call(e,{hash:{},data:t}):(n=e.machineIdentifier,n=typeof n===x?n.apply(e):n),s+=w(n)+'" href="#" data-focus="keyboard">',a={hash:{},data:t},s+=w((n=i.t||e.t,n?n.call(e,"Play on",a):b.call(e,"t","Play on",a)))+" ",a={hash:{},data:t},s+=w((n=i.truncate||e.truncate,n?n.call(e,e.name,29,a):b.call(e,"truncate",e.name,29,a)))+"</a></li>\n			"}function f(e,t){var n,a,s="";return s+="\n	",n=i["if"].call(e,e.channel,{hash:{},inverse:k.program(19,g,t),fn:k.program(17,m,t),data:t}),(n||0===n)&&(s+=n),s+='\n		<i class="glyphicon play"></i> ',a={hash:{},data:t},s+=w((n=i.t||e.t,n?n.call(e,"Play",a):b.call(e,"t","Play",a)))+"\n	</a>\n"
}function m(e,t){var n,a,s="";return s+='\n		<a class="play-btn btn btn-medium btn-primary" href="#!/servers/',(n=i.serverID)?n=n.call(e,{hash:{},data:t}):(n=e.serverID,n=typeof n===x?n.apply(e):n),s+=w(n)+"/channels/player?",n=i["if"].call(e,e.channelKey,{hash:{},inverse:k.program(5,o,t),fn:k.program(3,l,t),data:t}),(n||0===n)&&(s+=n),s+="path=",a={hash:{},data:t},s+=w((n=i.encodeUrl||e.encodeUrl,n?n.call(e,(n=e.video,null==n||n===!1?n:n.key),a):b.call(e,"encodeUrl",(n=e.video,null==n||n===!1?n:n.key),a)))+'" data-focus="keyboard">\n	'
}function g(e,t){var n,a,s="";return s+='\n		<a class="play-btn btn btn-medium btn-primary" href="#!/servers/',(n=i.serverID)?n=n.call(e,{hash:{},data:t}):(n=e.serverID,n=typeof n===x?n.apply(e):n),s+=w(n)+"/sections/",a={hash:{},data:t},s+=w((n=i.encodeUrl||e.encodeUrl,n?n.call(e,e.sectionID,a):b.call(e,"encodeUrl",e.sectionID,a)))+"/player/"+w((n=e.video,n=null==n||n===!1?n:n.ratingKey,typeof n===x?n.apply(e):n))+'" data-focus="keyboard">\n	'}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};
var v,y="",b=i.helperMissing,w=this.escapeExpression,x="function",k=this;return v=i["if"].call(t,t.showDropdown,{hash:{},inverse:k.program(16,f,a),fn:k.program(1,s,a),data:a}),(v||0===v)&&(y+=v),y+="\n"})}),define("hb!templates/desktop/modals/SelectOffsetModal.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var s,r,l,o="",c=i.helperMissing,d=this.escapeExpression,h="function";return o+='<div class="modal-header">\n	<button type="button" class="close" data-dismiss="modal"><i class="glyphicon remove-2"></i></button>\n	<h3>',l={hash:{},data:a},o+=d((s=i.t||t.t,s?s.call(t,"Resume",l):c.call(t,"t","Resume",l)))+'</h3>\n</div>\n\n<div class="modal-body minimal-scrollbar">\n	<ul class="select-list">\n		<li><a class="offset" data-offset="',(r=i.offset)?r=r.call(t,{hash:{},data:a}):(r=t.offset,r=typeof r===h?r.apply(t):r),o+=d(r)+'" href="#" data-focus="keyboard">',l={hash:{},data:a},o+=d((s=i.t||t.t,s?s.call(t,"Resume from {1}",t.formattedOffset,l):c.call(t,"t","Resume from {1}",t.formattedOffset,l)))+'</a></li>\n		<li><a class="offset" data-offset="0" href="#" data-focus="keyboard">',l={hash:{},data:a},o+=d((s=i.t||t.t,s?s.call(t,"Start from beginning",l):c.call(t,"t","Start from beginning",l)))+"</a></li>\n	</ul>\n</div>\n"
})}),define("plex/desktop/view/modals/SelectOffsetModal",["hb!templates/desktop/modals/SelectOffsetModal.tpl","plex/base/view/modals/BaseModal","jquery"],function(e,t,i){var n=t.extend({name:"selectOffsetModal",className:"modal modal-small select-modal fade",offset:0,focusOptions:{defaultElement:".select-list a"},events:{hidden:"close","click .offset":"onOffsetClick"},initialize:function(e){this.offset=e.offset},render:function(){return this.$el.html(e({offset:this.offset,formattedOffset:Handlebars.helpers.formatDuration.call(this,this.offset)})).modal(),this
},close:function(){this.trigger("select:offset",null),t.prototype.close.apply(this,arguments)},onOffsetClick:function(e){e.preventDefault(),this.trigger("select:offset",parseInt(i(e.target).data("offset"),10)),this.$el.modal("hide")}});return n}),define("plex/desktop/view/details/PlaySplitButton",["hb!templates/desktop/details/PlaySplitButton.tpl","plex/base/control/Dispatcher","plex/base/model/AppModel","plex/base/view/BaseView","plex/desktop/view/modals/SelectOffsetModal","jquery"],function(e,t,i,n,a,s){var r=n.extend({className:"play-btn-container",channel:!1,events:{"click .play-btn":"onPlayClick","click .client-btn":"onClientClick"},initialize:function(e){this.channel=e.channel,this.collection=i.get("clients"),this.collection.fetch({hideLoadingAlert:!0}).done(_.bind(this.render,this)),this.addBinding(t,"shortcut:play",this.play)
},render:function(){var t=this.collection.length&&!this.model.server.get("shared"),i={serverID:this.model.server.id,video:this.model.toJSON(),channel:this.channel,showDropdown:t,clients:this.collection.toJSON()};return this.channel?this.model.channel&&(i.channelKey=this.model.channel.id,i.channelID=this.model.channel.get("identifier")):i.sectionID=this.model.section.id,this.$el.html(e(i)),this},play:function(){t.trigger("command:PlayMedia",this.model)},selectOffset:function(e){var t=this.model.get("viewOffset")||0;
if(t){var n=new a({offset:t}),s=_.bind(function(t){n.off("select:offset",s),null!==t&&this.playRemote(e,t)},this);n.on("select:offset",s),i.set("modal",n)}else this.playRemote(e,t)},playRemote:function(e,i){var n=this.model;"album"===this.model.get("type")&&(n=this.model.get("tracks").first()),t.trigger("command:RemotePlay",{media:n,client:e,offset:i})},onPlayClick:function(e){e.preventDefault(),this.play()},onClientClick:function(e){e.preventDefault();var t=s(e.target).data("id"),i=this.collection.get(t);
this.selectOffset(i)}});return r}),define("hb!templates/desktop/modals/SelectArtworkModal.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a,s="";return s+='\n		<div class="upload-artwork-container">\n			<div class="upload-prompt">\n				',n=i["if"].call(e,e.showFileUpload,{hash:{},inverse:p.noop,fn:p.program(2,r,t),data:t}),(n||0===n)&&(s+=n),s+='<a class="upload-url" href="#">',a={hash:{},data:t},s+=u((n=i.t||e.t,n?n.call(e,"enter a url",a):h.call(e,"t","enter a url",a)))+'</a>\n			</div>\n\n			<div class="upload-progress hide">\n				',a={hash:{},data:t},s+=u((n=i.t||e.t,n?n.call(e,"Uploading artwork...",a):h.call(e,"t","Uploading artwork...",a)))+'\n			</div>\n\n			<div class="upload-error hide">\n				',a={hash:{},data:t},s+=u((n=i.t||e.t,n?n.call(e,"There was an error uploading this artwork. <a class='upload-back' href='#'>Try again</a>.",a):h.call(e,"t","There was an error uploading this artwork. <a class='upload-back' href='#'>Try again</a>.",a)))+'\n			</div>\n\n			<form class="url-form hide">\n				<input type="text" class="input-dark url-input" placeholder="',a={hash:{},data:t},s+=u((n=i.t||e.t,n?n.call(e,"Enter a url to upload an image from the web",a):h.call(e,"t","Enter a url to upload an image from the web",a)))+'">\n			</form>\n		</div>\n	'
}function r(e,t){var n,a,s="";return s+='<span class="file-chooser-container"><input type="file" class="file-chooser" multiple><a href="#">',a={hash:{},data:t},s+=u((n=i.t||e.t,n?n.call(e,"choose an image",a):h.call(e,"t","choose an image",a)))+"</a></span> &middot; ",a={hash:{},data:t},s+=u((n=i.t||e.t,n?n.call(e,"drag and drop",a):h.call(e,"t","drag and drop",a)))+" &middot; "}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var l,o,c,d="",h=i.helperMissing,u=this.escapeExpression,p=this;
return d+='<div class="modal-header">\n	<button type="button" class="close" data-dismiss="modal"><i class="glyphicon remove-2"></i></button>\n	<h3>',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Select Artwork",c):h.call(t,"t","Select Artwork",c)))+'</h3>\n</div>\n\n<div class="modal-body minimal-scrollbar">\n	',o=i["if"].call(t,t.showUpload,{hash:{},inverse:p.noop,fn:p.program(1,s,a),data:a}),(o||0===o)&&(d+=o),d+='\n\n	<div class="select-artwork-options">\n		<h4 class="select-artwork-loading">\n			',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Searching for artwork...",c):h.call(t,"t","Searching for artwork...",c)))+'\n		</h4>\n\n		<h4 class="no-matches hide">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"No artwork found",c):h.call(t,"t","No artwork found",c)))+"</h4>\n	</div>\n</div>\n"
})}),define("plex/base/model/media/collections/ArtworkCollection",["plex/base/model/collections/BaseCollection","plex/base/model/media/PhotoModel","jquery"],function(e,t){var i=e.extend({model:t,initialize:function(e,t){this.media=t.media,this.server=this.media.server,this.section=this.media.section,this.type=t.type},url:function(){return"/library/metadata/"+this.media.id+"/"+this.type+"s"},parse:function(e){return this.convert(e,"Photo")}});return i}),define("hb!templates/desktop/lists/media/items/ArtworkListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};
var s,r="",l="function",o=this.escapeExpression;return r+='<a class="artwork-option" data-rating-key="',(s=i.ratingKey)?s=s.call(t,{hash:{},data:a}):(s=t.ratingKey,s=typeof s===l?s.apply(t):s),r+=o(s)+'" href="#" data-focus="keyboard"></a>\n'})}),define("plex/desktop/view/lists/media/items/ArtworkListItem",["hb!templates/desktop/lists/media/items/ArtworkListItem.tpl","plex/base/view/BaseView","plex/base/view/images/BaseImage"],function(e,t,i){var n=t.extend({tagName:"span",artwork:null,initialize:function(e){var t=e.list.type,n="img/posters/poster.png",a=150,s=250;
"art"===t?n="img/posters/poster_wide.png":"banner"===t&&(n="img/posters/banner.png",a=500),this.artwork=this.registerView(new i({model:this.model,modelAttr:"thumb",placeholder:n,className:"poster "+t+"-poster",transcode:!0,width:a,height:s}))},render:function(){return this.$el.html(e(this.model.toJSON())),this.$(".artwork-option").prepend(this.artwork.render().el),this}});return n}),define("plex/desktop/view/lists/media/ArtworkList",["plex/base/view/lists/BaseList","plex/desktop/view/lists/media/items/ArtworkListItem"],function(e,t){var i=e.extend({className:"artwork-options-container",type:null,initialize:function(e){this.type=e.type,this.setup(t)
},render:function(){return this.$el.empty(),this.populate(this.collection),this}});return i}),define("plex/desktop/view/modals/SelectArtworkModal",["hb!templates/desktop/modals/SelectArtworkModal.tpl","plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel","plex/base/model/media/MediaModel","plex/base/model/media/collections/ArtworkCollection","plex/base/view/modals/BaseModal","plex/desktop/view/lists/media/ArtworkList","jquery"],function(e,t,i,n,a,s,r,l,o){var c=r.extend({name:"selectArtworkModal",className:"modal fade",dragStatus:0,events:{hidden:"close",dragenter:"onDragEnter",dragleave:"onDragLeave",dragover:"onDragOver",drop:"onDrop","change .file-chooser":"onFileChange","click .upload-url":"onUploadUrlClick","submit .url-form":"onUrlSubmit","click .upload-back":"onUploadBackClick","click .artwork-option":"onArtworkOptionClick"},initialize:function(e){this.type=e.type,this.collection=new s([],{media:this.model,type:this.type}),this.list=this.registerView(new l({collection:this.collection,type:this.type})),this.addBinding(this.collection,"reset",this.onReset),this.collection.fetch({hideLoadingAlert:!0})
},render:function(){var t={showUpload:this.model.server.supports("artworkUpload"),showFileUpload:this.supportsFileUpload()};return this.$el.html(e(t)).modal(),this.$(".select-artwork-options").prepend(this.list.render().el),this},destroy:function(){r.prototype.destroy.call(this),this.collection.release()},supportsFileUpload:function(){return!!(window.File&&window.FileList&&window.FileReader)},selectArtwork:function(e){var s={url:e},r="/library/metadata/"+this.model.id+"/"+this.type+"?"+o.param(s),l=_.extend({type:"PUT"},this.model.server.getAjaxOptions(r));
t.trigger("command:ShowLoading",!0),o.ajax(l).always(function(){t.trigger("command:ShowLoading",!1)}).done(_.bind(function(e){this.$el.modal("hide");var t={server:this.model.server,section:this.model.section,onlyIfCached:!0},i=new a({ratingKey:this.model.id},t);"poster"===this.type?(this.model.set("thumb",e),_.isEmpty(i)||(i.set("thumb",e),i.release())):(this.model.set(this.type,e),_.isEmpty(i)||(i.set(this.type,e),i.release()))},this)).fail(function(){n.set("alert",{status:"error",message:i.t("There was a problem changing the artwork for {1}.",this.model.get("title"))})
})},uploadFiles:function(e){for(var t=this.collection.url(),i=[],n=_.bind(function(e){if(/image\//.test(e.type)){var n=_.extend(this.model.server.getAjaxOptions(t),{type:"POST",data:e,processData:!1});i.push(o.ajax(n))}},this),a=0,s=e.length;s>a;a++)n(e[a]);return i.length?(this.$(".upload-prompt").addClass("hide"),this.$(".upload-progress").removeClass("hide"),this.$(".upload-artwork-container").addClass("upload-active"),o.when.apply(this,i).always(_.bind(function(){this.$(".upload-artwork-container").removeClass("upload-active")
},this)).done(_.bind(this.finish,this)).fail(_.bind(function(){this.$(".upload-progress").addClass("hide"),this.$(".upload-error").removeClass("hide")},this)),void 0):(this.$(".upload-prompt").addClass("hide"),this.$(".upload-error").removeClass("hide"),void 0)},uploadUrl:function(e){var t=this.collection.url()+"?url="+encodeURIComponent(e);this.$(".url-form").addClass("hide"),this.$(".upload-progress").removeClass("hide"),this.$(".upload-artwork-container").addClass("upload-active");var i=_.extend(this.model.server.getAjaxOptions(t),{type:"POST"});
o.ajax(i).always(_.bind(function(){this.$(".upload-artwork-container").removeClass("upload-active")},this)).done(_.bind(this.finish,this)).fail(_.bind(function(){this.$(".upload-progress").addClass("hide"),this.$(".upload-error").removeClass("hide")},this))},finish:function(){this.model.fetch({hideLoadingAlert:!0}),this.$el.modal("hide")},onReset:function(e){this.$(".select-artwork-loading").addClass("hide"),e.length||this.$(".no-matches").removeClass("hide")},onDragEnter:function(){this.dragStatus++,this.$(".upload-artwork-container").addClass("drag-hover")
},onDragLeave:function(){this.dragStatus--,0===this.dragStatus&&this.$(".upload-artwork-container").removeClass("drag-hover")},onDragOver:function(e){e.preventDefault()},onDrop:function(e){e.stopPropagation(),e.preventDefault(),this.$(".upload-artwork-container").removeClass("drag-hover");var t=e.originalEvent.dataTransfer.files;this.uploadFiles(t)},onFileChange:function(e){if(e.target.files&&e.target.files.length){var t=e.target.files;this.uploadFiles(t)}},onUploadUrlClick:function(e){e.preventDefault(),this.$(".upload-prompt").addClass("hide"),this.$(".url-form").removeClass("hide"),this.$(".url-input").focus()
},onUrlSubmit:function(e){e.preventDefault();var t=this.$(".url-input").val();t?this.uploadUrl(t):(this.$(".url-form").addClass("hide"),this.$(".upload-prompt").removeClass("hide"))},onUploadBackClick:function(e){e.preventDefault(),this.$(".upload-error").addClass("hide"),this.$(".upload-prompt").removeClass("hide")},onArtworkOptionClick:function(e){e.preventDefault();var t=o(e.currentTarget);this.selectArtwork(t.data("ratingKey"))}});return c}),define("plex/desktop/view/details/MovieDetailsView",["hb!templates/desktop/details/MovieDetailsView.tpl","plex/base/model/AppModel","plex/base/view/details/BaseMovieDetailsView","plex/desktop/view/details/ActionBarView","plex/desktop/view/details/PlaySplitButton","plex/desktop/view/modals/MediaInfoModal","plex/desktop/view/modals/SelectArtworkModal"],function(e,t,i,n,a,s,r){var l=i.extend({events:{"click .change-poster-btn":"onChangePosterClick","click .unavailable-btn":"onUnavailableClick"},initialize:function(){i.prototype.initialize.apply(this,arguments),this.actionBar=this.registerView(new n({model:this.model})),this.playButton=this.registerView(new a({model:this.model}))
},render:function(){var t=this.model.getStreams(2),i=this.model.getStreams(3),n=this.model.section.get("limited")||this.model.server.get("shared");if(this.$el.html(e({limited:n})),this.$el.prepend(this.actionBar.render().el),this.$(".movie-rating").append(this.rating.render().el),n){var a=this.$(".poster-container");a.prepend(this.poster.render().el),a.after(this.playButton.render().el)}else this.$(".poster-face").prepend(this.poster.render().el),this.$(".change-poster-btn").after(this.playButton.render().el);
t.length&&this.$(".movie-audio").removeClass("hide").append(this.audioDropdown.render().el),i.length&&this.$(".movie-subtitles").removeClass("hide").append(this.subtitlesDropdown.render().el);var s=this.$(".details-controls > .media-flags"),r=this.$(".details-metadata > .media-flags");return this.$(".movie-content-rating").append(this.contentRatingFlag.render().el),s.append(this.videoResolutionFlag.render().el),s.append(this.audioCodecFlag.render().el),s.append(this.audioChannelsFlag.render().el),r.append(this.studioFlag.render().el),this.bindView(),this
},onChangePosterClick:function(e){e.preventDefault();var i=new r({model:this.model,type:"poster"});t.set({modal:i})},onUnavailableClick:function(){t.set("modal",new s({model:this.model}))}});return l}),define("hb!templates/desktop/details/ShowDetailsView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return'\n			<div class="poster-container">\n				<span class="show-unwatched-count unwatched-count"></span>\n			</div>\n		'}function r(){return'\n			<a class="change-poster-btn" href="#">\n				<div class="poster-container">\n					<div class="poster-card">\n						<div class="poster-face front">\n							<span class="show-unwatched-count unwatched-count"></span>\n\n							<div class="hover-overlay card-overlay">\n								<i class="hover-menu-btn glyphicon pencil"></i>\n							</div>\n						</div>\n					</div>\n				</div>\n			</a>\n		'
}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var l,o="",c=this;return o+='<div class="details-row row-fluid">\n	<div class="details-controls">\n		',l=i["if"].call(t,t.limited,{hash:{},inverse:c.program(3,r,a),fn:c.program(1,s,a),data:a}),(l||0===l)&&(o+=l),o+='\n	</div>\n\n	<div class="details-metadata">\n		<div class="metadata-right">\n			<h1 class="show-year"></h1>\n\n			<div class="show-content-rating metadata"></div>\n\n			<div class="show-rating metadata"></div>\n		</div>\n\n		<h1 class="show-title"></h1>\n\n		<div class="show-genre metadata metadata-top"></div>\n\n		<div class="show-duration metadata"></div>\n\n		<div class="show-summary summary"></div>\n\n		<div class="media-flags"></div>\n	</div>\n</div>\n\n<div id="seasons-container" class="well"></div>\n'
})}),define("hb!templates/desktop/lists/media/items/SeasonTileListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var s,r,l="",o="function",c=this.escapeExpression,d=i.helperMissing;return l+='<a href="#!/servers/',(s=i.serverID)?s=s.call(t,{hash:{},data:a}):(s=t.serverID,s=typeof s===o?s.apply(t):s),l+=c(s)+"/sections/",r={hash:{},data:a},l+=c((s=i.encodeUrl||t.encodeUrl,s?s.call(t,t.sectionID,r):d.call(t,"encodeUrl",t.sectionID,r)))+"/details/"+c((s=t.season,s=null==s||s===!1?s:s.ratingKey,typeof s===o?s.apply(t):s))+'" data-focus="keyboard">\n	<div class="poster-container">\n		<div class="poster-card">\n			<div class="poster-face front">\n				<span class="unwatched-count"></span>\n\n				<div class="card-overlay">\n					<span class="card-season-index"></span>\n				</div>\n			</div>\n		</div>\n	</div>\n</a>\n'
})}),define("plex/desktop/view/lists/media/items/SeasonTileListItem",["hb!templates/desktop/lists/media/items/SeasonTileListItem.tpl","plex/base/view/BaseView","plex/base/view/images/BaseImage"],function(e,t,i){var n=t.extend({tagName:"li",className:"season",poster:null,initialize:function(){this.poster=this.registerView(new i({model:this.model,modelAttr:"thumb",placeholder:"img/posters/poster.png",className:"poster season-poster",transcode:!0,width:128,height:200}))},render:function(){return this.$el.html(e({serverID:this.model.server.id,sectionID:this.model.section.id,season:this.model.toJSON()})),this.$(".poster-face").prepend(this.poster.render().el),this.bindView(),this
},bindings:{".unwatched-count":{modelAttr:"unviewedLeafCount",hideEmpty:!0,format:function(e,t){var i=this.model.server.get("shared"),n=this.model.server.get("multiuser");return!t||i&&!n?0:t}},".card-season-index":{modelAttr:"index",hideEmpty:!0,format:function(e,t){return"0"===t?this.model.get("title"):Handlebars.helpers.seasonIndex.call(this,t)}}}});return n}),define("plex/desktop/view/lists/media/SeasonTileList",["plex/base/view/lists/FocusList","plex/desktop/view/lists/media/items/SeasonTileListItem"],function(e,t){var i=e.extend({tagName:"ul",className:"tile-list season-tile-list",initialize:function(){this.setup(t),this.collection.fetch()
},render:function(){return this.$el.empty(),this.populate(this.collection),this},addItem:function(t){return t.get("index")!==void 0?e.prototype.addItem.apply(this,arguments):void 0}});return i}),define("plex/base/view/details/BaseShowDetailsView",["hb!templates/desktop/details/ShowDetailsView.tpl","plex/base/control/utils/LocalizationUtil","plex/base/control/utils/TagUtil","plex/base/view/BaseView","plex/base/view/Rating","plex/base/view/images/BaseImage","plex/base/view/images/MediaFlagImage","plex/desktop/view/lists/media/SeasonTileList"],function(e,t,i,n,a,s,r,l){var o=n.extend({className:"details",initialize:function(){this.rating=this.registerView(new a({model:this.model})),this.poster=this.registerView(new s({model:this.model,modelAttr:"thumb",placeholder:"img/posters/poster.png",className:"poster large-poster show-poster",transcode:!0,width:200,height:300})),this.contentRatingFlag=this.registerView(new r({model:this.model,modelAttr:"contentRating",className:"media-flag",transcode:!0,width:30,height:60})),this.studioFlag=this.registerView(new r({model:this.model,modelAttr:"studio",className:"show-studio studio",transcode:!0,width:200,height:40})),this.seasonList=this.registerView(new l({collection:this.model.get("seasons"),focused:!0}))
},bindings:{".show-title":{modelAttr:"title"},".show-unwatched-count":{modelAttr:"unviewedLeafCount",hideEmpty:!0,format:function(e,t){var i=this.model.server.get("shared"),n=this.model.server.get("multiuser");return!t||i&&!n?0:t}},".show-year":{modelAttr:"year",hideEmpty:!0},".show-content-rating":{modelAttr:"contentRating",format:function(e,t){e.toggleClass("hide",!t)}},".show-genre":{modelAttr:"Genre",hideEmpty:!0,format:function(e,n){if(!n||!n.length)return"";var a=t.t("Genre"),s=i.truncateLinkedTagList({model:this.model,key:"genre",tags:n,maxLen:50,maxTags:3});
return'<span class="metadata-label">'+a+"</span>"+s}},".show-duration":{modelAttr:"duration",hideEmpty:!0,format:function(e,i){var n=t.t("Episode Duration"),a=Handlebars.helpers.formatMinutes.call(this,i);return'<span class="metadata-label">'+n+"</span>"+a}},".show-summary":{modelAttr:"summary",hideEmpty:!0,format:function(e,t){return Handlebars.helpers.truncate.call(this,t,700)}}}});return o}),define("plex/desktop/view/details/ShowDetailsView",["hb!templates/desktop/details/ShowDetailsView.tpl","plex/base/model/AppModel","plex/base/view/details/BaseShowDetailsView","plex/desktop/view/details/ActionBarView","plex/desktop/view/modals/SelectArtworkModal"],function(e,t,i,n,a){var s=i.extend({events:{"click .change-poster-btn":"onChangePosterClick"},initialize:function(){i.prototype.initialize.apply(this,arguments),this.actionBar=this.registerView(new n({model:this.model}))
},render:function(){var t=this.model.section.get("limited")||this.model.server.get("shared");return this.$el.html(e({limited:t})),this.$el.prepend(this.actionBar.render().el),this.$(".show-rating").append(this.rating.render().el),t?this.$(".poster-container").prepend(this.poster.render().el):this.$(".poster-face").prepend(this.poster.render().el),this.$(".show-content-rating").append(this.contentRatingFlag.render().el),this.$(".details-metadata > .media-flags").append(this.studioFlag.render().el),this.$("#seasons-container").append(this.seasonList.render().el),this.bindView(),this
},onChangePosterClick:function(e){e.preventDefault();var i=new a({model:this.model,type:"poster"});t.set({modal:i})}});return s}),define("hb!templates/desktop/details/SeasonDetailsView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return'\n			<div class="poster-container">\n				<span class="season-unwatched-count unwatched-count"></span>\n			</div>\n		'}function r(){return'\n			<a class="change-poster-btn" href="#">\n				<div class="poster-container">\n					<div class="poster-card">\n						<div class="poster-face front">\n							<span class="season-unwatched-count unwatched-count"></span>\n\n							<div class="hover-overlay card-overlay">\n								<i class="hover-menu-btn glyphicon pencil"></i>\n							</div>\n						</div>\n					</div>\n				</div>\n			</a>\n		'
}function l(){return"selected active"}function o(){return"disabled"}function c(){return'data-focus="keyboard"'}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var d,h,u,p="",f=this,m=i.helperMissing,g=this.escapeExpression,v="function";return p+='<div class="details-row row-fluid">\n	<div class="details-controls">\n		',d=i["if"].call(t,t.limited,{hash:{},inverse:f.program(3,r,a),fn:f.program(1,s,a),data:a}),(d||0===d)&&(p+=d),p+='\n	</div>\n\n	<div class="season-metadata details-metadata">\n		<div class="metadata-right">\n			<div class="btn-group episode-list-type-btn-group" data-toggle="buttons-radio">\n				<button type="button" class="episode-tile-list-btn btn btn-icon ',u={hash:{},inverse:f.noop,fn:f.program(5,l,a),data:a},d=i.if_eq||t.if_eq,h=d?d.call(t,t.listType,"episode-tile-list",u):m.call(t,"if_eq",t.listType,"episode-tile-list",u),(h||0===h)&&(p+=h),p+='" data-focus="keyboard" rel="tooltip" title="',u={hash:{},data:a},p+=g((d=i.t||t.t,d?d.call(t,"Tiles",u):m.call(t,"t","Tiles",u)))+'">\n					<i class="glyphicon show-big-thumbnails"></i>\n				</button>\n\n				<button type="button" class="episode-list-btn btn btn-icon ',u={hash:{},inverse:f.noop,fn:f.program(5,l,a),data:a},d=i.if_eq||t.if_eq,h=d?d.call(t,t.listType,"episode-list",u):m.call(t,"if_eq",t.listType,"episode-list",u),(h||0===h)&&(p+=h),p+='" data-focus="keyboard" rel="tooltip" title="',u={hash:{},data:a},p+=g((d=i.t||t.t,d?d.call(t,"Details",u):m.call(t,"t","Details",u)))+'">\n					<i class="glyphicon list"></i>\n				</button>\n\n				<button type="button" class="episode-compact-list-btn btn btn-icon ',u={hash:{},inverse:f.noop,fn:f.program(5,l,a),data:a},d=i.if_eq||t.if_eq,h=d?d.call(t,t.listType,"episode-compact-list",u):m.call(t,"if_eq",t.listType,"episode-compact-list",u),(h||0===h)&&(p+=h),p+='" data-focus="keyboard" rel="tooltip" title="',u={hash:{},data:a},p+=g((d=i.t||t.t,d?d.call(t,"List",u):m.call(t,"t","List",u)))+'">\n					<i class="glyphicon justify"></i>\n				</button>\n			</div>\n\n			<div class="btn-group arrow-btn-group">\n				<button type="button" class="previous-btn btn btn-icon ',h=i.unless.call(t,t.showPrevious,{hash:{},inverse:f.noop,fn:f.program(7,o,a),data:a}),(h||0===h)&&(p+=h),p+='" ',h=i["if"].call(t,t.showPrevious,{hash:{},inverse:f.noop,fn:f.program(9,c,a),data:a}),(h||0===h)&&(p+=h),p+='><i class="glyphicon chevron-left"></i></button>\n				<button type="button" class="next-btn btn btn-icon ',h=i.unless.call(t,t.showNext,{hash:{},inverse:f.noop,fn:f.program(7,o,a),data:a}),(h||0===h)&&(p+=h),p+='" ',h=i["if"].call(t,t.showNext,{hash:{},inverse:f.noop,fn:f.program(9,c,a),data:a}),(h||0===h)&&(p+=h),p+='><i class="glyphicon chevron-right"></i></button>\n			</div>\n		</div>\n\n		<h1>\n			<a class="show-title" href="#!/servers/',(h=i.serverID)?h=h.call(t,{hash:{},data:a}):(h=t.serverID,h=typeof h===v?h.apply(t):h),p+=g(h)+"/sections/",u={hash:{},data:a},p+=g((d=i.encodeUrl||t.encodeUrl,d?d.call(t,t.sectionID,u):m.call(t,"encodeUrl",t.sectionID,u)))+"/details/"+g((d=t.season,d=null==d||d===!1?d:d.parentRatingKey,typeof d===v?d.apply(t):d))+'"></a>\n		</h1>\n\n		<h2 class="season-title"></h2>\n\n		<div class="season-summary summary"></div>\n	</div>\n</div>\n\n<div id="episodes-container" class="well"></div>\n'
})}),define("hb!templates/desktop/lists/media/items/EpisodeTileListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return"selected"}function r(){return"player"}function l(){return"details"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var o,c,d,h="",u=this,p="function",f=this.escapeExpression,m=i.helperMissing;return h+='<a class="card-container ',o=i["if"].call(t,t.nowPlaying,{hash:{},inverse:u.noop,fn:u.program(1,s,a),data:a}),(o||0===o)&&(h+=o),h+='" href="#!/servers/',(o=i.serverID)?o=o.call(t,{hash:{},data:a}):(o=t.serverID,o=typeof o===p?o.apply(t):o),h+=f(o)+"/sections/",d={hash:{},data:a},h+=f((o=i.encodeUrl||t.encodeUrl,o?o.call(t,t.sectionID,d):m.call(t,"encodeUrl",t.sectionID,d)))+"/",c=i["if"].call(t,t.player,{hash:{},inverse:u.program(5,l,a),fn:u.program(3,r,a),data:a}),(c||0===c)&&(h+=c),h+="/"+f((o=t.episode,o=null==o||o===!1?o:o.ratingKey,typeof o===p?o.apply(t):o))+'" data-id="'+f((o=t.episode,o=null==o||o===!1?o:o.ratingKey,typeof o===p?o.apply(t):o))+'" data-focus="keyboard">\n	<div class="poster-container">\n		<div class="poster-card">\n			<div class="poster-face front">\n				<div class="card-overlay">\n					<span class="card-episode-index"></span>\n\n					<button type="button" class="hover-menu-btn poster-play-btn" tabindex="-1"><i class="glyphicon play"></i></button><button type="button" class="hover-menu-btn poster-edit-btn" tabindex="-1"><i class="glyphicon pencil"></i></button>\n\n					<div class="unwatched-icon unwatched-partial-icon"></div>\n					<div class="unwatched-icon unwatched-full-icon"></div>\n				</div>\n			</div>\n		</div>\n	</div>\n\n	<div class="episode-title poster-title"></div>\n</a>\n'
})}),define("plex/desktop/view/lists/media/items/EpisodeTileListItem",["hb!templates/desktop/lists/media/items/EpisodeTileListItem.tpl","plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/view/BaseView","plex/base/view/images/BaseImage","jquery"],function(e,t,i,n,a,s){var r=n.extend({tagName:"li",className:"episode",player:!1,nowPlaying:!1,poster:null,events:{"click .poster-play-btn":"onPlayClick","click .poster-edit-btn":"onEditClick","mouseenter .hover-menu-btn":"onMenuMouseEnter","mouseleave .hover-menu-btn":"onMenuMouseLeave"},initialize:function(e){e.list.model&&(this.player=!0,this.nowPlaying=this.model.id===e.list.model.id),this.poster=this.registerView(new a({model:this.model,modelAttr:"thumb",placeholder:"img/posters/poster_wide.png",className:"poster episode-poster",transcode:!0,width:200,height:200}))
},render:function(){var t=this.model.section&&this.model.section.get("limited"),i=this.model.server.get("shared");return this.$el.html(e({serverID:this.model.server.id,sectionID:this.model.section.id,episode:this.model.toJSON(),player:this.player,nowPlaying:this.nowPlaying})),(t||i||this.player)&&this.$el.addClass("hide-hover-overlay"),this.$(".poster-face").prepend(this.poster.render().el),this.bindView(),this},bindings:{".episode-title":{modelAttr:"title",format:function(e,t){return Handlebars.helpers.truncate.call(this,t,35)
}},".unwatched-icon":{modelAttr:"viewCount",format:function(e,t){var i=this.model.server.get("shared"),n=this.model.server.get("multiuser"),a=this.model.get("viewOffset");return i&&!n?(e.addClass("hide"),void 0):(t||a?e.addClass("hide"):(e.removeClass("hide"),this.$(".unwatched-partial-icon").addClass("hide")),void 0)}},".unwatched-partial-icon":{modelAttr:"viewOffset",format:function(e,t){var i=this.model.server.get("shared"),n=this.model.server.get("multiuser");return i&&!n?(e.addClass("hide"),void 0):(t?(e.removeClass("hide"),this.$(".unwatched-full-icon").addClass("hide")):e.addClass("hide"),void 0)
}},".card-episode-index":{modelAttr:"index",hideEmpty:!0,format:function(e,t){var i=this.model.get("type");if("episode"===i){var n=this.model.get("originallyAvailableAt");return Handlebars.helpers.episodeIndex.call(this,t,n)}}}},onPlayClick:function(e){e.stopImmediatePropagation(),e.preventDefault(),this.model.get("type");var i=this.model.section?this.model.section.id:this.model.get("librarySectionID");t.trigger("navigate:player",{serverID:this.model.server.id,sectionID:i,mediaID:this.model.id})},onEditClick:function(e){e.stopImmediatePropagation(),e.preventDefault();
var i=this.model.section?this.model.section.id:this.model.get("librarySectionID");t.trigger("navigate:edit",{serverID:this.model.server.id,sectionID:i,mediaID:this.model.id})},onMenuMouseEnter:function(e){this.$(".hover-menu-btn").each(function(t,i){i!==e.currentTarget?s(i).addClass("dim"):s(i).removeClass("dim")})},onMenuMouseLeave:function(){this.$(".hover-menu-btn").removeClass("dim")}});return r}),define("plex/desktop/view/lists/media/EpisodeTileList",["plex/base/view/lists/FocusList","plex/desktop/view/lists/media/items/EpisodeTileListItem"],function(e,t){var i=e.extend({tagName:"ul",className:"tile-list media-tile-list episode-tile-list",initialize:function(){this.setup(t),this.collection.populate()
},render:function(){return this.$el.empty(),this.populate(this.collection),this}});return i}),define("hb!templates/desktop/lists/media/items/EpisodeListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var s,r,l="",o="function",c=this.escapeExpression,d=i.helperMissing;return l+='<a href="#!/servers/',(s=i.serverID)?s=s.call(t,{hash:{},data:a}):(s=t.serverID,s=typeof s===o?s.apply(t):s),l+=c(s)+"/sections/",r={hash:{},data:a},l+=c((s=i.encodeUrl||t.encodeUrl,s?s.call(t,t.sectionID,r):d.call(t,"encodeUrl",t.sectionID,r)))+"/details/"+c((s=t.episode,s=null==s||s===!1?s:s.ratingKey,typeof s===o?s.apply(t):s))+'" data-focus="keyboard">\n	<div class="poster-container">\n		<div class="poster-card">\n			<div class="poster-face front">\n				<div class="card-overlay">\n					<span class="card-episode-index"></span>\n\n					<div class="unwatched-icon unwatched-partial-icon"></div>\n					<div class="unwatched-icon unwatched-full-icon"></div>\n				</div>\n			</div>\n		</div>\n	</div>\n\n	<div class="media-details">\n		<div class="media-details-right">\n			<div class="hover-menu">\n				<button type="button" class="hover-menu-btn poster-play-btn" tabindex="-1"><i class="glyphicon play"></i></button><button type="button" class="hover-menu-btn poster-edit-btn" tabindex="-1"><i class="glyphicon pencil"></i></button>\n			</div>\n\n			<div class="episode-rating sorted-by"></div>\n		</div>\n\n		<h3 class="episode-title"></h3>\n\n		<div class="episode-summary summary"></div>\n	</div>\n</a>\n'
})}),define("plex/desktop/view/lists/media/items/EpisodeListItem",["hb!templates/desktop/lists/media/items/EpisodeListItem.tpl","plex/base/control/Dispatcher","plex/base/view/BaseView","plex/base/view/Rating","plex/base/view/images/BaseImage","jquery"],function(e,t,i,n,a,s){var r=i.extend({tagName:"li",className:"episode",rating:null,poster:null,events:{"click .poster-play-btn":"onPlayClick","click .poster-edit-btn":"onEditClick","mouseenter .hover-menu-btn":"onMenuMouseEnter","mouseleave .hover-menu-btn":"onMenuMouseLeave"},initialize:function(){this.rating=this.registerView(new n({model:this.model,disabled:!0})),this.poster=this.registerView(new a({model:this.model,modelAttr:"thumb",placeholder:"img/posters/poster_wide.png",className:"poster episode-poster",transcode:!0,width:200,height:200}))
},render:function(){var t=this.model.section&&this.model.section.get("limited"),i=this.model.server.get("shared");return this.$el.html(e({serverID:this.model.server.id,sectionID:this.model.section.id,episode:this.model.toJSON()})),(t||i)&&this.$el.addClass("hide-hover-overlay"),this.$(".episode-rating").append(this.rating.render().el),this.$(".poster-face").prepend(this.poster.render().el),this.bindView(),this},bindings:{".episode-title":{modelAttr:"title",format:function(e,t){return Handlebars.helpers.truncate.call(this,t,80)
}},".card-episode-index":{modelAttr:"index",hideEmpty:!0,format:function(e,t){var i=this.model.get("originallyAvailableAt");return Handlebars.helpers.episodeIndex.call(this,t,i)}},".unwatched-icon":{modelAttr:"viewCount",format:function(e,t){var i=this.model.server.get("multiuser"),n=this.model.get("viewOffset");return this.model.server.get("shared")&&!i?(e.addClass("hide"),void 0):(t||n?e.addClass("hide"):(e.removeClass("hide"),this.$(".unwatched-partial-icon").addClass("hide")),void 0)}},".unwatched-partial-icon":{modelAttr:"viewOffset",format:function(e,t){var i=this.model.server.get("multiuser");
return this.model.server.get("shared")&&!i?(e.addClass("hide"),void 0):(t?(e.removeClass("hide"),this.$(".unwatched-full-icon").addClass("hide")):e.addClass("hide"),void 0)}},".episode-summary":{modelAttr:"summary",hideEmpty:!0,format:function(e,t){return Handlebars.helpers.truncate.call(this,t,250)}}},onPlayClick:function(e){e.stopImmediatePropagation(),e.preventDefault(),t.trigger("navigate:player",{serverID:this.model.server.id,sectionID:this.model.section.id,mediaID:this.model.id})},onEditClick:function(e){e.stopImmediatePropagation(),e.preventDefault(),t.trigger("navigate:edit",{serverID:this.model.server.id,sectionID:this.model.section.id,mediaID:this.model.id})
},onMenuMouseEnter:function(e){this.$(".hover-menu-btn").each(function(t,i){i!==e.currentTarget?s(i).addClass("dim"):s(i).removeClass("dim")})},onMenuMouseLeave:function(){this.$(".hover-menu-btn").removeClass("dim")}});return r}),define("plex/desktop/view/lists/media/EpisodeList",["plex/base/view/lists/FocusList","plex/desktop/view/lists/media/items/EpisodeListItem"],function(e,t){var i=e.extend({tagName:"ul",className:"list media-list episode-list",focusOptions:{cancellationDirections:["left","right"]},initialize:function(){this.setup(t),this.collection.fetch()
},render:function(){return this.$el.empty(),this.populate(this.collection),this}});return i}),define("hb!templates/desktop/lists/media/items/EpisodeCompactListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var s,r,l="",o="function",c=this.escapeExpression,d=i.helperMissing;return l+='<a href="#!/servers/',(s=i.serverID)?s=s.call(t,{hash:{},data:a}):(s=t.serverID,s=typeof s===o?s.apply(t):s),l+=c(s)+"/sections/",r={hash:{},data:a},l+=c((s=i.encodeUrl||t.encodeUrl,s?s.call(t,t.sectionID,r):d.call(t,"encodeUrl",t.sectionID,r)))+"/details/"+c((s=t.episode,s=null==s||s===!1?s:s.ratingKey,typeof s===o?s.apply(t):s))+'" data-focus="keyboard">\n	<span class="episode-rating rating"></span>\n\n	<span class="number episode-number"></span>\n\n	<span class="title episode-title"></span>\n\n	<button class="play-btn hover-btn" tabindex="-1"><i class="glyphicon play"></i></button><button class="edit-btn hover-btn" tabindex="-1"><i class="glyphicon pencil"></i></button>\n</a>\n'
})}),define("plex/desktop/view/lists/media/items/EpisodeCompactListItem",["hb!templates/desktop/lists/media/items/EpisodeCompactListItem.tpl","plex/base/control/Dispatcher","plex/base/model/AppModel","plex/base/view/BaseView","plex/base/view/Rating","jquery"],function(e,t,i,n,a){var s=n.extend({tagName:"li",rating:null,events:{"click .play-btn":"onPlayClick","click .edit-btn":"onEditClick"},initialize:function(){this.rating=this.registerView(new a({model:this.model,disabled:!0}))},render:function(){var t=this.model.section&&this.model.section.get("limited"),i=this.model.server.get("shared");
return this.$el.html(e({serverID:this.model.server.id,sectionID:this.model.section.id,episode:this.model.toJSON()})),(t||i)&&this.$el.addClass("hide-hover-overlay"),this.$(".episode-rating").append(this.rating.render().el),this.bindView(),this},bindings:{".episode-title":{modelAttr:"title",format:function(e,t){return Handlebars.helpers.truncate.call(this,t,80)}},".episode-number":{modelAttr:"index",hideEmpty:!0,format:function(e,t){var i=this.model.get("originallyAvailableAt");return Handlebars.helpers.episodeIndex.call(this,t,i)
}}},onPlayClick:function(e){e.stopImmediatePropagation(),e.preventDefault(),t.trigger("navigate:player",{serverID:this.model.server.id,sectionID:this.model.section.id,mediaID:this.model.id})},onEditClick:function(e){e.stopImmediatePropagation(),e.preventDefault(),t.trigger("navigate:edit",{serverID:this.model.server.id,sectionID:this.model.section.id,mediaID:this.model.id})}});return s}),define("plex/desktop/view/lists/media/EpisodeCompactList",["plex/base/view/lists/FocusList","plex/desktop/view/lists/media/items/EpisodeCompactListItem"],function(e,t){var i=e.extend({tagName:"ul",className:"list media-list media-compact-list episode-compact-list rounded-list",focusOptions:{cancellationDirections:["left","right"]},initialize:function(){this.setup(t),this.collection.fetch()
},render:function(){return this.$el.empty(),this.populate(this.collection),this}});return i}),define("plex/base/view/details/BaseSeasonDetailsView",["plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/model/SettingsModel","plex/base/model/media/ShowModel","plex/base/view/FocusView","plex/base/view/images/BaseImage","plex/desktop/view/lists/media/EpisodeTileList","plex/desktop/view/lists/media/EpisodeList","plex/desktop/view/lists/media/EpisodeCompactList"],function(e,t,i,n,a,s,r,l,o){var c=a.extend({className:"details season-details",focusOptions:{container:".details-row",activationDirection:"right"},events:{"click .previous-btn":"onPreviousClick","click .next-btn":"onNextClick"},initialize:function(){this.listType||(this.listType=i.get("episodeListType")),this.getSiblings();
var e=this.getListConstructor(this.listType);this.poster=this.registerView(new s({model:this.model,modelAttr:"thumb",placeholder:"img/posters/poster.png",className:"poster large-poster season-poster",transcode:!0,width:128,height:200})),this.episodeList=this.registerView(new e({collection:this.model.get("episodes"),focused:!0}))},destroy:function(){a.prototype.destroy.call(this),this.parent.release()},getSiblings:function(){this.parent=new n({ratingKey:this.model.get("parentRatingKey")},{server:this.model.server,section:this.model.section});
var e=_.bind(function(){var e=this.parent.get("seasons");e.populate({hideLoadingAlert:!0}).done(t)},this),t=_.bind(function(e){var t=e.indexOf(this.model);t>1&&(this.previousSibling=e.at(t-1)),e.length-1>t&&(this.nextSibling=e.at(t+1)),this.$(".previous-btn").toggleClass("disabled",!this.previousSibling),this.$(".next-btn").toggleClass("disabled",!this.nextSibling)},this);this.parent.populate({hideLoadingAlert:!0}).done(e)},getListConstructor:function(e){switch(e){case"episode-tile-list":return r;
case"episode-list":return l;case"episode-compact-list":return o;default:return this.listType="episode-tile-list",i.save("listType",this.listType),r}},bindings:{".show-title":{modelAttr:"parentTitle"},".season-title":{modelAttr:"index",format:function(e,i){return t.t("Season")+" "+i}},".season-unwatched-count":{modelAttr:"unviewedLeafCount",hideEmpty:!0,format:function(e,t){var i=this.model.server.get("shared"),n=this.model.server.get("multiuser");return!t||i&&!n?0:t}},".season-summary":{modelAttr:"summary",hideEmpty:!0,format:function(e,t){return Handlebars.helpers.truncate.call(this,t,700)
}}},onPreviousClick:function(){this.previousSibling&&e.trigger("navigate:details",{serverID:this.previousSibling.server.id,sectionID:this.previousSibling.section.id,mediaID:this.previousSibling.id})},onNextClick:function(){this.nextSibling&&e.trigger("navigate:details",{serverID:this.nextSibling.server.id,sectionID:this.nextSibling.section.id,mediaID:this.nextSibling.id})}});return c}),define("plex/desktop/view/details/SeasonDetailsView",["hb!templates/desktop/details/SeasonDetailsView.tpl","plex/base/model/AppModel","plex/base/model/SettingsModel","plex/base/view/details/BaseSeasonDetailsView","plex/desktop/view/details/ActionBarView","plex/desktop/view/modals/SelectArtworkModal"],function(e,t,i,n,a,s){var r=n.extend({events:_.extend({"click .change-poster-btn":"onChangePosterClick","click .episode-tile-list-btn":"onEpisodeTileListClick","click .episode-list-btn":"onEpisodeListClick","click .episode-compact-list-btn":"onEpisodeCompactListClick"},n.prototype.events),initialize:function(){n.prototype.initialize.apply(this,arguments),this.actionBar=this.registerView(new a({model:this.model}))
},render:function(){var t=this.model.section.get("limited")||this.model.server.get("shared");return this.$el.html(e({serverID:this.model.server.id,sectionID:this.model.section.id,season:this.model.toJSON(),limited:t,listType:this.listType,showPrevious:!!this.previousSibling,showNext:!!this.nextSibling})),this.$el.prepend(this.actionBar.render().el),t?this.$(".poster-container").prepend(this.poster.render().el):this.$(".poster-face").prepend(this.poster.render().el),this.$("#episodes-container").append(this.episodeList.render().el),this.bindView(),this
},updateList:function(e){var t=this.getListConstructor(e);this.episodeList&&this.removeView(this.episodeList),this.episodeList=this.registerView(new t({collection:this.model.get("episodes"),focused:!0})),this.$("#episodes-container").append(this.episodeList.render().el),i.save("episodeListType",e)},onChangePosterClick:function(e){e.preventDefault();var i=new s({model:this.model,type:"poster"});t.set({modal:i})},onEpisodeTileListClick:function(e){e.preventDefault(),this.updateList("episode-tile-list")
},onEpisodeListClick:function(e){e.preventDefault(),this.updateList("episode-list")},onEpisodeCompactListClick:function(e){e.preventDefault(),this.updateList("episode-compact-list")}});return r}),define("hb!templates/desktop/details/EpisodeDetailsView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return'\n			<div class="poster-container">\n				<span class="media-count"></span>\n			</div>\n		'}function r(){return'\n			<a class="change-poster-btn" href="#">\n				<div class="poster-container">\n					<div class="poster-card">\n						<div class="poster-face front">\n							<span class="media-count"></span>\n\n							<div class="hover-overlay card-overlay">\n								<i class="hover-menu-btn glyphicon pencil"></i>\n							</div>\n						</div>\n					</div>\n				</div>\n			</a>\n		'
}function l(){return"disabled"}function o(){return'data-focus="keyboard"'}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var c,d,h,u="",p=this,f="function",m=this.escapeExpression,g=i.helperMissing;return u+='<div class="details-row row-fluid episode">\n	<div class="details-controls">\n		',c=i["if"].call(t,t.limited,{hash:{},inverse:p.program(3,r,a),fn:p.program(1,s,a),data:a}),(c||0===c)&&(u+=c),u+='\n\n		<div class="media-flags"></div>\n	</div>\n\n	<div class="episode-metadata details-metadata">\n		<div class="metadata-right">\n			<div class="btn-group arrow-btn-group">\n				<button type="button" class="previous-btn btn btn-icon ',c=i.unless.call(t,t.showPrevious,{hash:{},inverse:p.noop,fn:p.program(5,l,a),data:a}),(c||0===c)&&(u+=c),u+='" ',c=i["if"].call(t,t.showPrevious,{hash:{},inverse:p.noop,fn:p.program(7,o,a),data:a}),(c||0===c)&&(u+=c),u+='><i class="glyphicon chevron-left"></i></button>\n				<button type="button" class="next-btn btn btn-icon ',c=i.unless.call(t,t.showNext,{hash:{},inverse:p.noop,fn:p.program(5,l,a),data:a}),(c||0===c)&&(u+=c),u+='" ',c=i["if"].call(t,t.showNext,{hash:{},inverse:p.noop,fn:p.program(7,o,a),data:a}),(c||0===c)&&(u+=c),u+='><i class="glyphicon chevron-right"></i></button>\n			</div>\n\n			<h2 class="episode-duration"></h2>\n			<div class="episode-available metadata"></div>\n			<div class="episode-content-rating metadata"></div>\n			<div class="episode-rating metadata"></div>\n		</div>\n\n		<h1>\n			<a class="show-title" href="#!/servers/',(c=i.serverID)?c=c.call(t,{hash:{},data:a}):(c=t.serverID,c=typeof c===f?c.apply(t):c),u+=m(c)+"/sections/",h={hash:{},data:a},u+=m((c=i.encodeUrl||t.encodeUrl,c?c.call(t,t.sectionID,h):g.call(t,"encodeUrl",t.sectionID,h)))+"/details/"+m((c=t.episode,c=null==c||c===!1?c:c.grandparentRatingKey,typeof c===f?c.apply(t):c))+'"></a>\n		</h1>\n\n		<h2>\n			<span class="episode-title"></span><button class="episode-unavailable-btn unavailable-btn btn btn-small btn-danger">',h={hash:{},data:a},u+=m((c=i.t||t.t,c?c.call(t,"Unavailable",h):g.call(t,"t","Unavailable",h)))+'</button>\n\n			<div class="unwatched-icon unwatched-partial-icon"></div>\n			<div class="unwatched-icon unwatched-full-icon"></div>\n		</h2>\n\n		<div class="metadata">\n			<a class="season-index" href="#!/servers/',(d=i.serverID)?d=d.call(t,{hash:{},data:a}):(d=t.serverID,d=typeof d===f?d.apply(t):d),u+=m(d)+"/sections/",h={hash:{},data:a},u+=m((c=i.encodeUrl||t.encodeUrl,c?c.call(t,t.sectionID,h):g.call(t,"encodeUrl",t.sectionID,h)))+"/details/"+m((c=t.episode,c=null==c||c===!1?c:c.parentRatingKey,typeof c===f?c.apply(t):c))+'"></a><span class="episode-index"></span>\n		</div>\n\n		<div class="episode-director metadata metadata-top"></div>\n		<div class="episode-writer metadata"></div>\n		<div class="episode-cast metadata"></div>\n\n		<div class="episode-audio metadata metadata-top hide"><span class="metadata-label">',h={hash:{},data:a},u+=m((c=i.t||t.t,c?c.call(t,"Audio",h):g.call(t,"t","Audio",h)))+'</span></div>\n		<div class="episode-subtitles metadata hide"><span class="metadata-label">',h={hash:{},data:a},u+=m((c=i.t||t.t,c?c.call(t,"Subtitles",h):g.call(t,"t","Subtitles",h)))+'</span></div>\n\n		<h2 class="episode-tagline tagline"></h2>\n\n		<div class="episode-summary summary"></div>\n	</div>\n</div>\n'
})}),define("plex/base/view/details/BaseEpisodeDetailsView",["plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/control/utils/TagUtil","plex/base/control/utils/MediaUtil","plex/base/model/media/SeasonModel","plex/base/view/FocusView","plex/base/view/Rating","plex/base/view/images/BaseImage","plex/base/view/images/MediaFlagImage","plex/desktop/view/details/StreamDropdown"],function(e,t,i,n,a,s,r,l,o,c){var d=s.extend({className:"details",focusOptions:{defaultElement:".play-btn",container:".details-row",cancellationDirections:{up:".btn-primary.dropdown-toggle, .previous-btn, .next-btn"}},events:{"click .previous-btn":"onPreviousClick","click .next-btn":"onNextClick"},initialize:function(){this.getSiblings(),this.rating=this.registerView(new r({model:this.model})),this.poster=this.registerView(new l({model:this.model,modelAttr:"thumb",placeholder:"img/posters/poster_wide.png",className:"poster large-poster episode-poster",transcode:!0,width:256,height:420})),this.audioDropdown=this.registerView(new c({type:"audio",model:this.model})),this.subtitlesDropdown=this.registerView(new c({type:"subtitles",model:this.model})),this.contentRatingFlag=this.registerView(new o({model:this.model,modelAttr:"contentRating",className:"media-flag",transcode:!0,width:30,height:60})),this.videoResolutionFlag=this.registerView(new o({model:this.model,flag:"videoResolution",className:"episode-video-resolution media-flag",transcode:!0,width:100,height:20})),this.audioCodecFlag=this.registerView(new o({model:this.model,flag:"audioCodec",className:"episode-audio-codec media-flag",transcode:!0,width:100,height:20})),this.audioChannelsFlag=this.registerView(new o({model:this.model,flag:"audioChannels",className:"episode-audio-channels media-flag",transcode:!0,width:100,height:20}))
},destroy:function(){s.prototype.destroy.call(this),this.parent.release()},getSiblings:function(){this.parent=new a({ratingKey:this.model.get("parentRatingKey")},{server:this.model.server,section:this.model.section});var e=_.bind(function(){var e=this.parent.get("episodes");e.populate({hideLoadingAlert:!0}).done(t)},this),t=_.bind(function(e){var t=e.indexOf(this.model);t>0&&(this.previousSibling=e.at(t-1)),e.length-1>t&&(this.nextSibling=e.at(t+1)),this.$(".previous-btn").toggleClass("disabled",!this.previousSibling),this.$(".next-btn").toggleClass("disabled",!this.nextSibling)
},this);this.parent.populate({hideLoadingAlert:!0}).done(e)},bindings:{".show-title":{modelAttr:"grandparentTitle"},".episode-title":{modelAttr:"title"},".season-index":{modelAttr:"parentIndex",format:function(e,i){return t.t("Season")+" "+i}},".episode-index":{modelAttr:"index",hideEmpty:!0,format:function(e,i){return i>0?", "+t.t("Episode")+" "+i:""}},".media-count":{modelAttr:"Media",hideEmpty:!0,format:function(){var e=0,t=this.model.get("Media");return t.length>1&&(e=t.length),e}},".episode-unavailable-btn":{modelAttr:"Media",hideEmpty:!0,format:function(e,t){var i=n.getMissingParts(t);
i.length?e.removeClass("hide"):e.addClass("hide")}},".episode-available":{modelAttr:"originallyAvailableAt",hideEmpty:!0,format:function(e,t){return t?Handlebars.helpers.formatDate.call(this,t):""}},".episode-duration":{modelAttr:"duration",hideEmpty:!0,format:function(e,t){return Handlebars.helpers.formatMinutes.call(this,t)}},".episode-content-rating":{modelAttr:"contentRating",format:function(e,t){e.toggleClass("hide",!t)}},".unwatched-icon":{modelAttr:"viewCount",format:function(e,t){var i=this.model.server.get("shared"),n=this.model.server.get("multiuser"),a=this.model.get("viewOffset");
return i&&!n?(e.addClass("hide"),void 0):(t||a?e.addClass("hide"):(e.removeClass("hide"),this.$(".unwatched-partial-icon").addClass("hide")),void 0)}},".unwatched-partial-icon":{modelAttr:"viewOffset",format:function(e,t){var i=this.model.server.get("shared"),n=this.model.server.get("multiuser");return i&&!n?(e.addClass("hide"),void 0):(t?(e.removeClass("hide"),this.$(".unwatched-full-icon").addClass("hide")):e.addClass("hide"),void 0)}},".episode-tagline":{modelAttr:"tagline",hideEmpty:!0},".episode-director":{modelAttr:"Director",hideEmpty:!0,format:function(e,n){if(!n||!n.length)return"";
var a=t.t("Director"),s=i.truncateLinkedTagList({model:this.model,key:"director",tags:n,maxLen:50,maxTags:3});return'<span class="metadata-label">'+a+"</span>"+s}},".episode-writer":{modelAttr:"Writer",hideEmpty:!0,format:function(e,n){if(!n||!n.length)return"";var a=t.t("Writer"),s=i.truncateLinkedTagList({model:this.model,key:"writer",tags:n,maxLen:50,maxTags:3});return'<span class="metadata-label">'+a+"</span>"+s}},".episode-cast":{modelAttr:"Role",hideEmpty:!0,format:function(e,n){if(!n||!n.length)return"";
var a=t.t("Cast"),s=i.truncateLinkedTagList({model:this.model,key:"actor",tags:n,maxLen:50,maxTags:3});return'<span class="metadata-label">'+a+"</span>"+s}},".episode-summary":{modelAttr:"summary",hideEmpty:!0,format:function(e,t){return Handlebars.helpers.truncate.call(this,t,700)}}},onPreviousClick:function(){this.previousSibling&&e.trigger("navigate:details",{serverID:this.previousSibling.server.id,sectionID:this.previousSibling.section.id,mediaID:this.previousSibling.id})},onNextClick:function(){this.nextSibling&&e.trigger("navigate:details",{serverID:this.nextSibling.server.id,sectionID:this.nextSibling.section.id,mediaID:this.nextSibling.id})
}});return d}),define("plex/desktop/view/details/EpisodeDetailsView",["hb!templates/desktop/details/EpisodeDetailsView.tpl","plex/base/control/Dispatcher","plex/base/model/AppModel","plex/base/view/details/BaseEpisodeDetailsView","plex/desktop/view/details/ActionBarView","plex/desktop/view/details/PlaySplitButton","plex/desktop/view/modals/MediaInfoModal","plex/desktop/view/modals/SelectArtworkModal"],function(e,t,i,n,a,s,r,l){var o=n.extend({events:_.extend({"click .change-poster-btn":"onChangePosterClick","click .unavailable-btn":"onUnavailableClick"},n.prototype.events),initialize:function(){n.prototype.initialize.apply(this,arguments),this.actionBar=this.registerView(new a({model:this.model})),this.playButton=this.registerView(new s({model:this.model}))
},render:function(){var t=this.model.getStreams(2),i=this.model.getStreams(3),n=this.model.section.get("limited")||this.model.server.get("shared");this.$el.html(e({serverID:this.model.server.id,sectionID:this.model.section.id,episode:this.model.toJSON(),limited:n,showPrevious:!!this.previousSibling,showNext:!!this.nextSibling})),this.$el.prepend(this.actionBar.render().el),this.$(".episode-rating").append(this.rating.render().el),n?(this.$(".poster-container").prepend(this.poster.render().el),this.$(".poster-container").after(this.playButton.render().el)):(this.$(".poster-face").prepend(this.poster.render().el),this.$(".change-poster-btn").after(this.playButton.render().el)),t.length&&this.$(".episode-audio").removeClass("hide").append(this.audioDropdown.render().el),i.length&&this.$(".episode-subtitles").removeClass("hide").append(this.subtitlesDropdown.render().el);
var a=this.$(".details-controls > .media-flags");return this.$(".episode-content-rating").append(this.contentRatingFlag.render().el),a.append(this.videoResolutionFlag.render().el),a.append(this.audioCodecFlag.render().el),a.append(this.audioChannelsFlag.render().el),this.bindView(),this},onChangePosterClick:function(e){e.preventDefault();var t=new l({model:this.model,type:"poster"});i.set({modal:t})},onUnavailableClick:function(){i.set("modal",new r({model:this.model}))}});return o}),define("hb!templates/desktop/details/ArtistDetailsView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return'\n			<div class="poster-container"></div>\n		'
}function r(){return'\n			<a class="change-poster-btn" href="#">\n				<div class="poster-container">\n					<div class="poster-card">\n						<div class="poster-face front">\n							<div class="hover-overlay card-overlay">\n								<i class="hover-menu-btn glyphicon pencil"></i>\n							</div>\n						</div>\n					</div>\n				</div>\n			</a>\n		'}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var l,o="",c=this;return o+='<div class="details-row row-fluid">\n	<div class="details-controls">\n		',l=i["if"].call(t,t.limited,{hash:{},inverse:c.program(3,r,a),fn:c.program(1,s,a),data:a}),(l||0===l)&&(o+=l),o+='\n	</div>\n\n	<div class="details-metadata">\n		<h1 class="artist-title"></h1>\n\n		<div class="artist-genre metadata metadata-top"></div>\n\n		<div class="artist-summary summary"></div>\n	</div>\n</div>\n\n<div id="albums-container" class="well"></div>\n'
})}),define("hb!templates/desktop/lists/media/items/AlbumListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var s,r,l="",o="function",c=this.escapeExpression,d=i.helperMissing;return l+='<div class="album-art">\n	<a class="album-link" href="#!/servers/',(s=i.serverID)?s=s.call(t,{hash:{},data:a}):(s=t.serverID,s=typeof s===o?s.apply(t):s),l+=c(s)+"/sections/",r={hash:{},data:a},l+=c((s=i.encodeUrl||t.encodeUrl,s?s.call(t,t.sectionID,r):d.call(t,"encodeUrl",t.sectionID,r)))+"/details/"+c((s=t.album,s=null==s||s===!1?s:s.ratingKey,typeof s===o?s.apply(t):s))+'"></a>\n\n	<div class="album-title"></div>\n	<div class="album-year"></div>\n</div>\n'
})}),define("hb!templates/desktop/lists/media/items/TrackListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a,s="";return s+='\n		<span class="track-duration">',a={hash:{},data:t},s+=h((n=i.formatDuration||e.formatDuration,n?n.call(e,(n=e.track,null==n||n===!1?n:n.duration),a):d.call(e,"formatDuration",(n=e.track,null==n||n===!1?n:n.duration),a)))+"</span>\n	"}function r(){return"hide"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};
var l,o,c="",d=i.helperMissing,h=this.escapeExpression,u=this,p="function";return c+='<a href="#" data-focus="keyboard">\n	',o=i["if"].call(t,(l=t.track,null==l||l===!1?l:l.duration),{hash:{},inverse:u.noop,fn:u.program(1,s,a),data:a}),(o||0===o)&&(c+=o),c+='\n\n	<span class="number track-number">'+h((l=t.track,l=null==l||l===!1?l:l.index,typeof l===p?l.apply(t):l))+'</span>\n\n	<span class="title track-title">'+h((l=t.track,l=null==l||l===!1?l:l.title,typeof l===p?l.apply(t):l))+'</span>\n\n	<button class="remote-play-btn hover-btn ',o=i.unless.call(t,t.showRemotePlay,{hash:{},inverse:u.noop,fn:u.program(3,r,a),data:a}),(o||0===o)&&(c+=o),c+='" tabindex="-1"><i class="glyphicon display"></i></button><button class="edit-btn hover-btn ',o=i.unless.call(t,t.showEdit,{hash:{},inverse:u.noop,fn:u.program(3,r,a),data:a}),(o||0===o)&&(c+=o),c+='" tabindex="-1"><i class="glyphicon pencil"></i></button><button class="sync-btn hover-btn ',o=i.unless.call(t,t.showSync,{hash:{},inverse:u.noop,fn:u.program(3,r,a),data:a}),(o||0===o)&&(c+=o),c+='" tabindex="-1"><i class="glyphicon download"></i></button><button class="info-btn hover-btn ',o=i.unless.call(t,t.showInfo,{hash:{},inverse:u.noop,fn:u.program(3,r,a),data:a}),(o||0===o)&&(c+=o),c+='" tabindex="-1"><i class="glyphicon circle-info"></i></button>\n</a>\n'
})}),define("plex/desktop/view/lists/media/items/TrackListItem",["hb!templates/desktop/lists/media/items/TrackListItem.tpl","plex/base/control/Dispatcher","plex/base/model/AppModel","plex/base/view/BaseView","plex/desktop/view/modals/MediaInfoModal","plex/desktop/view/modals/SyncModal","plex/desktop/view/modals/SelectDeviceModal","jquery"],function(e,t,i,n,a,s,r){var l=n.extend({tagName:"li",events:{click:"onClick","click .remote-play-btn":"onRemotePlayClick","click .edit-btn":"onEditClick","click .sync-btn":"onSyncClick","click .info-btn":"onInfoClick"},initialize:function(e){this.list=e.list;
var t=i.get("myPlex"),n=i.get("clients");this.addBinding(n,"reset",this.onClientsReset),this.addBinding(t.get("devices"),"reset",this.onDevicesReset),n.populate({hideLoadingAlert:!0})},render:function(){var t=this.model.server.get("shared"),n=i.get("clients");return this.$el.html(e({track:this.model.toJSON(),showRemotePlay:n.length&&!t,showEdit:!t,showSync:this.canSync(),showInfo:!0})),this},canSync:function(){var e=i.get("myPlex"),t=e.get("devices").getSyncDevices();return!this.model.server.get("shared")&&this.model.server.supports("sync")&&t.length&&e.get("signedIn")&&this.list.collection.allowSync?!0:!1
},onClientsReset:function(e){var t=e.length&&!this.model.server.get("shared");t?this.$(".remote-play-btn").removeClass("hide"):this.$(".remote-play-btn").addClass("hide")},onDevicesReset:function(){this.canSync()?this.$(".sync-btn").removeClass("hide"):this.$(".sync-btn").addClass("hide")},onClick:function(e){e.preventDefault(),t.trigger("play:music",this.model.media.get("tracks"),this.model)},onRemotePlayClick:function(e){e.stopImmediatePropagation(),e.preventDefault(),t.trigger("command:RemotePlay",{media:this.model})
},onEditClick:function(e){e.stopImmediatePropagation(),e.preventDefault(),t.trigger("navigate:edit",{serverID:this.model.server.id,sectionID:this.model.section.id,mediaID:this.model.id})},onSyncClick:function(e){e.stopImmediatePropagation(),e.preventDefault();var t=i.get("myPlex"),n=t.get("devices"),a=n.getSyncDevices(),l=new s({directory:!1,section:!1,model:this.model});if(a.length>1){var o=new r,c=_.bind(function(e){o.off("select:device",c),l.device=n.get(e),i.set("modal",l)},this);o.on("select:device",c),i.set("modal",o)
}else 1===a.length&&(l.device=a[0],i.set("modal",l))},onInfoClick:function(e){e.stopImmediatePropagation(),e.preventDefault(),i.set("modal",new a({model:this.model}))}});return l}),define("plex/desktop/view/lists/media/TrackList",["plex/base/view/lists/BaseList","plex/desktop/view/lists/media/items/TrackListItem"],function(e,t){var i=e.extend({tagName:"ul",className:"list media-list media-compact-list track-list rounded-list",initialize:function(){this.setup(t),this.collection.fetch()},render:function(){return this.$el.empty(),this.populate(this.collection),this
}});return i}),define("plex/desktop/view/lists/media/items/AlbumListItem",["hb!templates/desktop/lists/media/items/AlbumListItem.tpl","plex/base/view/BaseView","plex/base/view/images/BaseImage","plex/desktop/view/lists/media/TrackList"],function(e,t,i,n){var a=t.extend({tagName:"li",poster:null,trackList:null,initialize:function(){this.poster=this.registerView(new i({model:this.model,modelAttr:"thumb",placeholder:"img/posters/album.png",className:"poster album-poster",transcode:!0,width:200,height:200})),this.trackList=this.registerView(new n({collection:this.model.get("tracks")})),this.addBinding(this.model,"change",this.render)
},render:function(){return this.$el.html(e({serverID:this.model.server.id,sectionID:this.model.section.id,album:this.model.toJSON()})),this.$(".album-link").prepend(this.poster.render().el),this.$el.append(this.trackList.render().el),this.bindView(),this},bindings:{".album-title":{modelAttr:"title"},".album-year":{modelAttr:"year",hideEmpty:!0}}});return a}),define("plex/desktop/view/lists/media/AlbumList",["plex/base/view/lists/BaseList","plex/desktop/view/lists/media/items/AlbumListItem"],function(e,t){var i=e.extend({tagName:"ul",className:"album-list",initialize:function(){this.setup(t),this.collection.fetch()
},render:function(){return this.$el.empty(),this.populate(this.collection),this},addItem:function(t){return t.get("index")!==void 0?e.prototype.addItem.apply(this,arguments):void 0}});return i}),define("plex/base/view/details/BaseArtistDetailsView",["plex/base/control/utils/LocalizationUtil","plex/base/control/utils/TagUtil","plex/base/view/FocusView","plex/base/view/images/BaseImage","plex/desktop/view/lists/media/AlbumList"],function(e,t,i,n,a){var s=i.extend({className:"details",focusOptions:{defaultElement:".track-list a",container:"#albums-container",cancellationDirections:"left"},initialize:function(){var e=this.model.get("albums");
this.poster=this.registerView(new n({model:this.model,modelAttr:"thumb",placeholder:"img/posters/album.png",className:"poster large-poster artist-poster",transcode:!0,width:256,height:420})),this.albumList=this.registerView(new a({collection:e})),this.addBinding(e,"reset",this.onAlbumsReset)},bindings:{".artist-title":{modelAttr:"title"},".artist-genre":{modelAttr:"Genre",hideEmpty:!0,format:function(i,n){if(!n||!n.length)return"";var a=e.t("Genre"),s=t.truncateLinkedTagList({model:this.model,key:"genre",tags:n,maxLen:50,maxTags:3});
return'<span class="metadata-label">'+a+"</span>"+s}},".artist-summary":{modelAttr:"summary",hideEmpty:!0,format:function(e,t){return Handlebars.helpers.truncate.call(this,t,700)}}},onAlbumsReset:function(e){var t;t=e.length>1?e.at(1):e.first(),t&&this.addBinding(t.get("tracks"),"reset",this.onTracksReset)},onTracksReset:function(){this.refocus()}});return s}),define("plex/desktop/view/details/ArtistDetailsView",["hb!templates/desktop/details/ArtistDetailsView.tpl","plex/base/model/AppModel","plex/base/view/details/BaseArtistDetailsView","plex/desktop/view/details/ActionBarView","plex/desktop/view/modals/SelectArtworkModal"],function(e,t,i,n,a){var s=i.extend({events:{"click .change-poster-btn":"onChangePosterClick"},initialize:function(){i.prototype.initialize.apply(this,arguments),this.actionBar=this.registerView(new n({model:this.model}))
},render:function(){var t=this.model.section.get("limited")||this.model.server.get("shared");return this.$el.html(e({limited:t})),this.$el.prepend(this.actionBar.render().el),t?this.$(".poster-container").prepend(this.poster.render().el):this.$(".poster-face").prepend(this.poster.render().el),this.$("#albums-container").append(this.albumList.render().el),this.bindView(),this},onChangePosterClick:function(e){e.preventDefault();var i=new a({model:this.model,type:"poster"});t.set({modal:i})}});return s
}),define("hb!templates/desktop/details/AlbumDetailsView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return'\n			<div class="poster-container"></div>\n		'}function r(){return'\n			<a class="change-poster-btn" href="#">\n				<div class="poster-container">\n					<div class="poster-card">\n						<div class="poster-face front">\n							<div class="hover-overlay card-overlay">\n								<i class="hover-menu-btn glyphicon pencil"></i>\n							</div>\n						</div>\n					</div>\n				</div>\n			</a>\n		'
}function l(){return"disabled"}function o(){return'data-focus="keyboard"'}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var c,d,h="",u=this,p="function",f=this.escapeExpression,m=i.helperMissing;return h+='<div class="details-row row-fluid">\n	<div class="details-controls">\n		',c=i["if"].call(t,t.limited,{hash:{},inverse:u.program(3,r,a),fn:u.program(1,s,a),data:a}),(c||0===c)&&(h+=c),h+='\n	</div>\n\n	<div class="album-metadata details-metadata">\n		<div class="metadata-right">\n			<div class="btn-group arrow-btn-group">\n				<button type="button" class="previous-btn btn btn-icon ',c=i.unless.call(t,t.showPrevious,{hash:{},inverse:u.noop,fn:u.program(5,l,a),data:a}),(c||0===c)&&(h+=c),h+='" ',c=i["if"].call(t,t.showPrevious,{hash:{},inverse:u.noop,fn:u.program(7,o,a),data:a}),(c||0===c)&&(h+=c),h+='><i class="glyphicon chevron-left"></i></button>\n				<button type="button" class="next-btn btn btn-icon ',c=i.unless.call(t,t.showNext,{hash:{},inverse:u.noop,fn:u.program(5,l,a),data:a}),(c||0===c)&&(h+=c),h+='" ',c=i["if"].call(t,t.showNext,{hash:{},inverse:u.noop,fn:u.program(7,o,a),data:a}),(c||0===c)&&(h+=c),h+='><i class="glyphicon chevron-right"></i></button>\n			</div>\n		</div>\n\n		<h1>\n			<a class="artist-title" href="#!/servers/',(c=i.serverID)?c=c.call(t,{hash:{},data:a}):(c=t.serverID,c=typeof c===p?c.apply(t):c),h+=f(c)+"/sections/",d={hash:{},data:a},h+=f((c=i.encodeUrl||t.encodeUrl,c?c.call(t,t.sectionID,d):m.call(t,"encodeUrl",t.sectionID,d)))+"/details/"+f((c=t.album,c=null==c||c===!1?c:c.parentRatingKey,typeof c===p?c.apply(t):c))+'"></a>\n		</h1>\n\n		<h2 class="album-title"></h2>\n\n		<div class="album-genre metadata metadata-top"></div>\n\n		<div class="album-summary summary"></div>\n	</div>\n</div>\n\n<div id="tracks-container" class="well"></div>\n'
})}),define("plex/base/view/details/BaseAlbumDetailsView",["plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/control/utils/TagUtil","plex/base/model/media/ArtistModel","plex/base/view/FocusView","plex/base/view/images/BaseImage","plex/desktop/view/lists/media/TrackList"],function(e,t,i,n,a,s,r){var l=a.extend({className:"details",focusOptions:{defaultElement:".play-btn",container:[".details-row","#tracks-container"],cancellationDirections:{up:".btn-primary.dropdown-toggle",left:".track-list a"}},events:{"click .previous-btn":"onPreviousClick","click .next-btn":"onNextClick"},initialize:function(){this.getSiblings(),this.poster=this.registerView(new s({model:this.model,modelAttr:"thumb",placeholder:"img/posters/album.png",className:"poster large-poster album-poster",transcode:!0,width:256,height:420})),this.trackList=this.registerView(new r({collection:this.model.get("tracks")}))
},destroy:function(){a.prototype.destroy.call(this),this.parent.release()},getSiblings:function(){this.parent=new n({ratingKey:this.model.get("parentRatingKey")},{server:this.model.server,section:this.model.section});var e=_.bind(function(){var e=this.parent.get("albums");e.populate({hideLoadingAlert:!0}).done(t)},this),t=_.bind(function(e){var t=e.indexOf(this.model);t>1&&(this.previousSibling=e.at(t-1)),e.length-1>t&&(this.nextSibling=e.at(t+1)),this.$(".previous-btn").toggleClass("disabled",!this.previousSibling),this.$(".next-btn").toggleClass("disabled",!this.nextSibling)
},this);this.parent.populate({hideLoadingAlert:!0}).done(e)},bindings:{".artist-title":{modelAttr:"parentTitle"},".album-title":{modelAttr:"title"},".album-genre":{modelAttr:"Genre",hideEmpty:!0,format:function(e,n){if(!n||!n.length)return"";var a=t.t("Genre"),s=i.truncateLinkedTagList({model:this.model,key:"genre",tags:n,maxLen:50,maxTags:3});return'<span class="metadata-label">'+a+"</span>"+s}},".album-summary":{modelAttr:"summary",hideEmpty:!0,format:function(e,t){return Handlebars.helpers.truncate.call(this,t,700)
}}},onPreviousClick:function(){this.previousSibling&&e.trigger("navigate:details",{serverID:this.previousSibling.server.id,sectionID:this.previousSibling.section.id,mediaID:this.previousSibling.id})},onNextClick:function(){this.nextSibling&&e.trigger("navigate:details",{serverID:this.nextSibling.server.id,sectionID:this.nextSibling.section.id,mediaID:this.nextSibling.id})}});return l}),define("plex/desktop/view/details/AlbumDetailsView",["hb!templates/desktop/details/AlbumDetailsView.tpl","plex/base/control/Dispatcher","plex/base/model/AppModel","plex/base/view/details/BaseAlbumDetailsView","plex/desktop/view/details/ActionBarView","plex/desktop/view/details/PlaySplitButton","plex/desktop/view/modals/SelectArtworkModal"],function(e,t,i,n,a,s,r){var l=n.extend({events:_.extend({"click .change-poster-btn":"onChangePosterClick","click .play-btn":"onPlayClick"},n.prototype.events),initialize:function(){n.prototype.initialize.apply(this,arguments),this.actionBar=this.registerView(new a({model:this.model})),this.playButton=this.registerView(new s({model:this.model}))
},render:function(){var t=this.model.section.get("limited")||this.model.server.get("shared");return this.$el.html(e({serverID:this.model.server.id,sectionID:this.model.section.id,album:this.model.toJSON(),limited:t,showPrevious:!!this.previousSibling,showNext:!!this.nextSibling})),this.$el.prepend(this.actionBar.render().el),t?this.$(".poster-container").prepend(this.poster.render().el):this.$(".poster-face").prepend(this.poster.render().el),this.$(".details-controls").append(this.playButton.render().el),this.$("#tracks-container").append(this.trackList.render().el),this.bindView(),this
},onChangePosterClick:function(e){e.preventDefault();var t=new r({model:this.model,type:"poster"});i.set({modal:t})},onPlayClick:function(e){e.preventDefault();var i=this.model.get("tracks");t.trigger("play:music",i,i.first())}});return l}),define("hb!templates/desktop/details/PhotoAlbumDetailsView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return'\n			<div class="poster-container"></div>\n		'}function r(){return'\n			<a class="change-poster-btn" href="#">\n				<div class="poster-container">\n					<div class="poster-card">\n						<div class="poster-face front">\n							<div class="hover-overlay card-overlay">\n								<i class="hover-menu-btn glyphicon pencil"></i>\n							</div>\n						</div>\n					</div>\n				</div>\n			</a>\n		'
}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var l,o="",c=this;return o+='<div class="details-row row-fluid">\n	<div class="details-controls">\n		',l=i["if"].call(t,t.limited,{hash:{},inverse:c.program(3,r,a),fn:c.program(1,s,a),data:a}),(l||0===l)&&(o+=l),o+='\n	</div>\n\n	<div class="details-metadata">\n		<h1 class="show-title"></h1>\n\n		<div class="show-summary summary"></div>\n	</div>\n</div>\n\n<div id="photos-container" class="well"></div>\n'})}),define("plex/desktop/view/lists/media/PhotoTileList",["plex/desktop/view/lists/media/MediaTileList"],function(e){var t=e.extend({className:"tile-list media-tile-list photo-tile-list"});
return t}),define("plex/base/view/details/BasePhotoAlbumDetailsView",["plex/base/view/BaseView","plex/base/view/images/BaseImage","plex/desktop/view/lists/media/PhotoTileList"],function(e,t,i){var n=e.extend({className:"details",initialize:function(){var e=this.model.get("photos");e.fetch(),this.poster=this.registerView(new t({model:this.model,modelAttr:"thumb",placeholder:"img/posters/photo.png",className:"poster large-poster photo-album-poster",transcode:!0,width:200,height:200})),this.photoList=this.registerView(new i({collection:e,focused:!0}))
},bindings:{".show-title":{modelAttr:"title"},".show-summary":{modelAttr:"summary",hideEmpty:!0,format:function(e,t){return Handlebars.helpers.truncate.call(this,t,700)}}}});return n}),define("plex/desktop/view/details/PhotoAlbumDetailsView",["hb!templates/desktop/details/PhotoAlbumDetailsView.tpl","plex/base/model/AppModel","plex/base/view/details/BasePhotoAlbumDetailsView","plex/desktop/view/details/ActionBarView","plex/desktop/view/modals/SelectArtworkModal"],function(e,t,i,n,a){var s=i.extend({events:{"click .change-poster-btn":"onChangePosterClick"},initialize:function(){i.prototype.initialize.apply(this,arguments),this.actionBar=this.registerView(new n({model:this.model}))
},render:function(){var t=this.model.section.get("limited")||this.model.server.get("shared");return this.$el.html(e({limited:t})),this.$el.prepend(this.actionBar.render().el),t?this.$(".poster-container").prepend(this.poster.render().el):this.$(".poster-face").prepend(this.poster.render().el),this.$("#photos-container").append(this.photoList.render().el),this.bindView(),this},onChangePosterClick:function(e){e.preventDefault();var i=new a({model:this.model,type:"poster"});t.set({modal:i})}});return s
}),define("hb!templates/desktop/details/ClipDetailsView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a,s="";return s+='\n				<a class="show-title" href="#!/servers/',(n=i.serverID)?n=n.call(e,{hash:{},data:t}):(n=e.serverID,n=typeof n===d?n.apply(e):n),s+=h(n)+"/channels?key=",a={hash:{},data:t},s+=h((n=i.encodeUrl||e.encodeUrl,n?n.call(e,(n=e.channel,null==n||n===!1?n:n.key),a):u.call(e,"encodeUrl",(n=e.channel,null==n||n===!1?n:n.key),a)))+'">'+h((n=e.channel,n=null==n||n===!1?n:n.title,typeof n===d?n.apply(e):n))+"</a>\n			"
}function r(e){var t,i="";return i+="\n				"+h((t=e.channelMedia,t=null==t||t===!1?t:t.sourceTitle,typeof t===d?t.apply(e):t))+"\n			"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var l,o,c="",d="function",h=this.escapeExpression,u=i.helperMissing,p=this;return c+='<div class="details-row row-fluid episode">\n	<div class="details-controls">\n		<div class="poster-container"></div>\n	</div>\n\n	<div class="video-metadata details-metadata">\n		<div class="metadata-right">\n			<h2 class="video-duration"></h2>\n			<div class="video-available metadata"></div>\n			<div class="video-rating metadata"></div>\n		</div>\n\n		<h1>\n			',l=i["if"].call(t,t.channel,{hash:{},inverse:p.program(3,r,a),fn:p.program(1,s,a),data:a}),(l||0===l)&&(c+=l),c+='\n		</h1>\n\n		<h2>\n			<span class="video-title"></span>\n		</h2>\n\n		<div class="season-title metadata"></div>\n\n		<div class="video-director metadata metadata-top"></div>\n		<div class="video-writer metadata"></div>\n		<div class="video-cast metadata"></div>\n\n		<div class="video-audio metadata metadata-top hide"><span class="metadata-label">',o={hash:{},data:a},c+=h((l=i.t||t.t,l?l.call(t,"Audio",o):u.call(t,"t","Audio",o)))+'</span></div>\n		<div class="video-subtitles metadata hide"><span class="metadata-label">',o={hash:{},data:a},c+=h((l=i.t||t.t,l?l.call(t,"Subtitles",o):u.call(t,"t","Subtitles",o)))+'</span></div>\n\n		<h2 class="video-tagline tagline"></h2>\n\n		<div class="video-summary summary"></div>\n	</div>\n</div>\n'
})}),define("plex/base/view/details/BaseClipDetailsView",["hb!templates/desktop/details/ClipDetailsView.tpl","plex/base/control/utils/LocalizationUtil","plex/base/control/utils/TagUtil","plex/base/view/FocusView","plex/base/view/Rating","plex/base/view/images/BaseImage","plex/desktop/view/details/StreamDropdown"],function(e,t,i,n,a,s,r){var l=n.extend({className:"details",focusOptions:{defaultElement:".play-btn",container:".details-row",cancellationDirections:{up:".btn-primary.dropdown-toggle"}},initialize:function(){this.rating=this.registerView(new a({model:this.model,disabled:!0})),this.poster=this.registerView(new s({model:this.model,modelAttr:"thumb",placeholder:"img/posters/poster_wide.png",className:"poster large-poster clip-poster",transcode:!0,width:256,height:420})),this.audioDropdown=this.registerView(new r({type:"audio",model:this.model})),this.subtitlesDropdown=this.registerView(new r({type:"subtitles",model:this.model}))
},render:function(){var t,i=this.model.getStreams(2),n=this.model.getStreams(3);return this.model.channel&&(t=this.model.channel.toJSON()),this.$el.html(e({serverID:this.model.server.id,channel:t,channelMedia:this.model.toJSON()})),this.$el.prepend(this.actionBar.render().el),this.$(".video-rating").append(this.rating.render().el),this.$(".poster-container").prepend(this.poster.render().el),this.playButton&&this.$(".poster-container").after(this.playButton.render().el),i.length&&this.$(".video-audio").removeClass("hide").append(this.audioDropdown.render().el),n.length&&this.$(".video-subtitles").removeClass("hide").append(this.subtitlesDropdown.render().el),this.bindView(),this
},bindings:{".season-title":{modelAttr:"parentIndex",hideEmpty:!0,format:function(e,t){return t?"Season "+t+", Episode "+this.model.get("index"):""}},".video-title":{modelAttr:"title"},".video-available":{modelAttr:"originallyAvailableAt",hideEmpty:!0,format:function(e,t){return t?Handlebars.helpers.formatDate.call(this,t):""}},".video-duration":{modelAttr:"duration",hideEmpty:!0,format:function(e,t){return t?Handlebars.helpers.formatMinutes.call(this,t):0}},".video-tagline":{modelAttr:"tagline",hideEmpty:!0},".video-director":{modelAttr:"Director",hideEmpty:!0,format:function(e,n){if(!n||!n.length)return"";
var a=t.t("Director"),s=i.truncateLinkedTagList({model:this.model,key:"director",tags:n,maxLen:50,maxTags:3});return'<span class="metadata-label">'+a+"</span>"+s}},".video-writer":{modelAttr:"Writer",hideEmpty:!0,format:function(e,n){if(!n||!n.length)return"";var a=t.t("Writer"),s=i.truncateLinkedTagList({model:this.model,key:"writer",tags:n,maxLen:50,maxTags:3});return'<span class="metadata-label">'+a+"</span>"+s}},".video-cast":{modelAttr:"Role",hideEmpty:!0,format:function(e,n){if(!n||!n.length)return"";
var a=t.t("Cast"),s=i.truncateLinkedTagList({model:this.model,key:"actor",tags:n,maxLen:50,maxTags:3});return'<span class="metadata-label">'+a+"</span>"+s}},".video-summary":{modelAttr:"summary",hideEmpty:!0,format:function(e,t){return Handlebars.helpers.truncate.call(this,t,700)}}}});return l}),define("plex/desktop/view/details/ClipDetailsView",["plex/base/view/details/BaseClipDetailsView","plex/desktop/view/details/ActionBarView","plex/desktop/view/details/PlaySplitButton"],function(e,t,i){var n=e.extend({initialize:function(){e.prototype.initialize.apply(this,arguments),this.actionBar=this.registerView(new t({model:this.model})),this.playButton=this.registerView(new i({model:this.model,channel:!0}))
}});return n}),define("hb!templates/desktop/details/UnknownDetailsView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){return this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{},'<i class="plex-icon-sad"></i>\n\n<h2 class="error-message">This media type is not yet supported.</h2>\n'})}),define("plex/desktop/view/details/UnknownDetailsView",["hb!templates/desktop/details/UnknownDetailsView.tpl","plex/base/view/BaseView"],function(e,t){var i=t.extend({className:"details",render:function(){return this.$el.html(e()),this
}});return i}),define("plex/desktop/view/details/DetailsView",["plex/base/view/details/BaseDetailsView","plex/desktop/view/details/MovieDetailsView","plex/desktop/view/details/ShowDetailsView","plex/desktop/view/details/SeasonDetailsView","plex/desktop/view/details/EpisodeDetailsView","plex/desktop/view/details/ArtistDetailsView","plex/desktop/view/details/AlbumDetailsView","plex/desktop/view/details/PhotoAlbumDetailsView","plex/desktop/view/details/ClipDetailsView","plex/desktop/view/details/UnknownDetailsView"],function(e,t,i,n,a,s,r,l,o,c){var d=e.extend({views:{movie:t,show:i,season:n,episode:a,artist:s,album:r,photoAlbum:l,clip:o,unknown:c}});
return d}),define("hb!templates/desktop/channels/MyChannelsView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return"active"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var r,l,o,c="",d=this,h=i.helperMissing,u=this.escapeExpression,p="function";return c+='<div id="channels-container" class="well">\n	<div class="well-header">\n		<ul class="subnav-list well-header-list">\n			<li><a class="all-filter channel-filter ',o={hash:{},inverse:d.noop,fn:d.program(1,s,a),data:a},r=i.if_eq||t.if_eq,l=r?r.call(t,t.view,"all",o):h.call(t,"if_eq",t.view,"all",o),(l||0===l)&&(c+=l),c+='" href="#">',o={hash:{},data:a},c+=u((r=i.t||t.t,r?r.call(t,"All",o):h.call(t,"t","All",o)))+'</a></li>\n			<li><a class="video-filter channel-filter ',o={hash:{},inverse:d.noop,fn:d.program(1,s,a),data:a},r=i.if_eq||t.if_eq,l=r?r.call(t,t.view,"unwatched",o):h.call(t,"if_eq",t.view,"unwatched",o),(l||0===l)&&(c+=l),c+='" href="#"><span class="count">',(l=i.video)?l=l.call(t,{hash:{},data:a}):(l=t.video,l=typeof l===p?l.apply(t):l),c+=u(l)+"</span> ",o={hash:{},data:a},c+=u((r=i.t||t.t,r?r.call(t,"Video",o):h.call(t,"t","Video",o)))+'</a></li>\n			<li><a class="music-filter channel-filter ',o={hash:{},inverse:d.noop,fn:d.program(1,s,a),data:a},r=i.if_eq||t.if_eq,l=r?r.call(t,t.view,"watched",o):h.call(t,"if_eq",t.view,"watched",o),(l||0===l)&&(c+=l),c+='" href="#"><span class="count">',(l=i.music)?l=l.call(t,{hash:{},data:a}):(l=t.music,l=typeof l===p?l.apply(t):l),c+=u(l)+"</span> ",o={hash:{},data:a},c+=u((r=i.t||t.t,r?r.call(t,"Music",o):h.call(t,"t","Music",o)))+'</a></li>\n			<li><a class="photo-filter channel-filter ',o={hash:{},inverse:d.noop,fn:d.program(1,s,a),data:a},r=i.if_eq||t.if_eq,l=r?r.call(t,t.view,"watched",o):h.call(t,"if_eq",t.view,"watched",o),(l||0===l)&&(c+=l),c+='" href="#"><span class="count">',(l=i.photo)?l=l.call(t,{hash:{},data:a}):(l=t.photo,l=typeof l===p?l.apply(t):l),c+=u(l)+"</span> ",o={hash:{},data:a},c+=u((r=i.t||t.t,r?r.call(t,"Photo",o):h.call(t,"t","Photo",o)))+"</a></li>\n		</ul>\n	</div>\n</div>\n"
})}),define("hb!templates/desktop/channels/ChannelNavView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a,s="";return s+="\n				",a={hash:{},data:t},s+=p((n=i.t||e.t,n?n.call(e,(n=e.server,null==n||n===!1?n:n.friendlyName),20,a):u.call(e,"t",(n=e.server,null==n||n===!1?n:n.friendlyName),20,a)))+"\n			"}function r(e,t){var n,a,s="";return s+="\n				",a={hash:{},data:t},s+=p((n=i.t||e.t,n?n.call(e,(n=e.server,null==n||n===!1?n:n.name),20,a):u.call(e,"t",(n=e.server,null==n||n===!1?n:n.name),20,a)))+"\n			"
}function l(){return"active"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var o,c,d,h="",u=i.helperMissing,p=this.escapeExpression,f=this;return h+='<ul class="subnav-actions">\n	<li>\n		<span class="subnav-action-label source-title">\n			',c=i["if"].call(t,(o=t.server,null==o||o===!1?o:o.friendlyName),{hash:{},inverse:f.program(3,r,a),fn:f.program(1,s,a),data:a}),(c||0===c)&&(h+=c),h+='\n		</span>\n	</li>\n	<li>\n		<button type="button" class="update-btn btn btn-inverse btn-icon"><i class="glyphicon circle-arrow-top"></i> <span class="btn-icon-label">',d={hash:{},data:a},h+=p((o=i.t||t.t,o?o.call(t,"Check for Updates",d):u.call(t,"t","Check for Updates",d)))+'</span></button>\n	</li>\n</ul>\n\n<ul class="subnav-list">\n	<li><i class="subnav-icon glyphicon imac"></i></li>\n	<li><a class="gray ',d={hash:{},inverse:f.noop,fn:f.program(5,l,a),data:a},o=i.if_eq||t.if_eq,c=o?o.call(t,t.active,"myChannels",d):u.call(t,"if_eq",t.active,"myChannels",d),(c||0===c)&&(h+=c),h+='" href="#!/channels">',d={hash:{},data:a},h+=p((o=i.t||t.t,o?o.call(t,"My Channels",d):u.call(t,"t","My Channels",d)))+'</a></li>\n	<li><a class="gray ',d={hash:{},inverse:f.noop,fn:f.program(5,l,a),data:a},o=i.if_eq||t.if_eq,c=o?o.call(t,t.active,"directory",d):u.call(t,"if_eq",t.active,"directory",d),(c||0===c)&&(h+=c),h+='" href="#!/directory">',d={hash:{},data:a},h+=p((o=i.t||t.t,o?o.call(t,"Directory",d):u.call(t,"t","Directory",d)))+"</a></li>\n</ul>\n"
})}),define("plex/desktop/view/channels/ChannelNavView",["hb!templates/desktop/channels/ChannelNavView.tpl","plex/base/control/Dispatcher","plex/base/model/AppModel","plex/base/view/BaseView","jquery"],function(e,t,i,n,a){var s=n.extend({className:"subnav-container",active:null,events:{"click .update-btn":"onCheckUpdatesClick"},initialize:function(e){this.active=e.active,this.addBinding(i,"change:primaryServer",this.onPrimaryServerChange)},render:function(){return this.$el.html(e({active:this.active,server:this.model.toJSON()})),this
},onPrimaryServerChange:function(e,i){t.trigger("navigate:"+this.active,{serverID:i.id})},onCheckUpdatesClick:function(e){e.preventDefault();var i=a(e.currentTarget);if(!i.hasClass("active")){i.addClass("active");var n={server:this.model};t.trigger("command:UpdateChannel",n,function(){i.removeClass("active")})}}});return s}),define("hb!templates/desktop/lists/channels/items/ChannelListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a,s="";return s+='\n			<button type="button" class="settings-btn btn btn-primary btn-icon" rel="tooltip" title="',a={hash:{},data:t},s+=p((n=i.t||e.t,n?n.call(e,"Settings",a):u.call(e,"t","Settings",a)))+'"><i class="glyphicon cogwheel"></i></button>\n		'
}function r(e){var t,i="";return i+="\n		<h3>"+p((t=e.channel,t=null==t||t===!1?t:t.title,typeof t===f?t.apply(e):t))+"</h3>\n	"}function l(e){var t,i="";return i+="\n		<h3>"+p((t=e.channel,t=null==t||t===!1?t:t.name,typeof t===f?t.apply(e):t))+"</h3>\n	"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var o,c,d,h="",u=i.helperMissing,p=this.escapeExpression,f="function",m=this;return h+='<a href="#!/servers/',(o=i.serverID)?o=o.call(t,{hash:{},data:a}):(o=t.serverID,o=typeof o===f?o.apply(t):o),h+=p(o)+"/channels?key=",d={hash:{},data:a},h+=p((o=i.encodeUrl||t.encodeUrl,o?o.call(t,(o=t.channel,null==o||o===!1?o:o.key),d):u.call(t,"encodeUrl",(o=t.channel,null==o||o===!1?o:o.key),d)))+'" class="well">\n	<div class="actions">\n		',c=i["if"].call(t,(o=t.channel,null==o||o===!1?o:o.hasPrefs),{hash:{},inverse:m.noop,fn:m.program(1,s,a),data:a}),(c||0===c)&&(h+=c),h+='\n		<button type="button" class="update-btn btn btn-icon" rel="tooltip" title="',d={hash:{},data:a},h+=p((o=i.t||t.t,o?o.call(t,"Update",d):u.call(t,"t","Update",d)))+'"><i class="glyphicon circle-arrow-top"></i></button>\n		<button type="button" class="uninstall-btn btn btn-danger btn-icon" rel="tooltip" title="',d={hash:{},data:a},h+=p((o=i.t||t.t,o?o.call(t,"Uninstall",d):u.call(t,"t","Uninstall",d)))+'"><i class="glyphicon ban"></i></button>\n	</div>\n\n	',c=i["if"].call(t,(o=t.channel,null==o||o===!1?o:o.title),{hash:{},inverse:m.program(5,l,a),fn:m.program(3,r,a),data:a}),(c||0===c)&&(h+=c),h+="\n\n	<h4>",d={hash:{},data:a},h+=p((o=i.t||t.t,o?o.call(t,(o=t.channel,null==o||o===!1?o:o.type),d):u.call(t,"t",(o=t.channel,null==o||o===!1?o:o.type),d)))+"</h4>\n</a>\n"
})}),define("plex/desktop/view/lists/channels/items/ChannelListItem",["hb!templates/desktop/lists/channels/items/ChannelListItem.tpl","plex/base/control/Dispatcher","plex/base/model/AppModel","plex/base/model/ChannelModel","plex/base/model/collections/PreferenceCollection","plex/base/view/BaseView","plex/base/view/images/BaseImage","plex/desktop/view/modals/ChannelSettingsModal","jquery"],function(e,t,i,n,a,s,r,l,o){var c=s.extend({tagName:"li",icon:null,events:{"click .settings-btn":"onSettingsClick","click .update-btn":"onUpdateClick","click .uninstall-btn":"onUninstallClick"},initialize:function(){this.icon=this.registerView(new r({model:this.model,modelAttr:"thumb",placeholder:"img/posters/poster_square.png",className:"poster channel-poster",transcode:!0,width:40,height:40}))
},render:function(){return this.$el.html(e({serverID:this.model.server.id,channel:this.model.toJSON()})),this.$(".actions").after(this.icon.render().el),this.$el.tooltip({selector:".btn-icon",placement:"bottom"}),this},onSettingsClick:function(e){e.preventDefault();var t,s=new n({key:this.model.id},{server:this.model.server}),r=_.bind(function(){o(".tooltip").remove();var e=new l({model:s,collection:t});i.set("modal",e)},this),c=_.bind(function(){t=new a([],{server:s.server,url:s.get("settings")}),t.fetch().done(r)
},this);s.fetch().done(c)},onUpdateClick:function(e){e.preventDefault();var i={server:this.model.server,channel:this.model};t.trigger("command:UpdateChannel",i)},onUninstallClick:function(e){e.preventDefault();var i=function(){this.model.trigger("destroy",this.model,this.model.collection)};t.trigger("command:UninstallChannel",this.model,_.bind(i,this))}});return c}),define("plex/desktop/view/lists/channels/ChannelList",["plex/base/view/lists/BaseList","plex/desktop/view/lists/channels/items/ChannelListItem"],function(e,t){var i=e.extend({tagName:"ul",className:"well-list channel-list",initialize:function(){this.setup(t),this.collection.url&&this.collection.fetch()
},render:function(){return this.$el.empty(),this.populate(this.collection),this}});return i}),define("plex/desktop/view/channels/MyChannelsView",["hb!templates/desktop/channels/MyChannelsView.tpl","plex/base/control/Dispatcher","plex/base/model/AppModel","plex/base/view/BaseView","plex/desktop/view/channels/ChannelNavView","plex/desktop/view/lists/channels/ChannelList","jquery"],function(e,t,i,n,a,s){var r=n.extend({className:"container",view:"all",subnav:null,events:{"click .all-filter":"onAllClick","click .video-filter":"onVideoClick","click .music-filter":"onMusicClick","click .photo-filter":"onPhotoClick"},initialize:function(){this.listCollection=new Backbone.Collection(this.collection.all()),this.subnav=this.registerView(new a({model:this.collection.server,active:"myChannels"})),this.list=this.registerView(new s({collection:this.listCollection})),this.addBinding(this.collection,"reset",this.onReset),this.addBinding(this.collection,"destroy",this.onDestroy),this.collection.fetch()
},render:function(){var t=this.collection.videos().length,i=this.collection.music().length,n=this.collection.photos().length;return this.$el.html(e({serverID:this.collection.server.id,view:this.view,video:t,music:i,photo:n})),this.$el.prepend(this.subnav.render().el),this.$("#channels-container").append(this.list.render().el),this},updateCounts:function(){var e=this.collection.videos().length,t=this.collection.music().length,i=this.collection.photos().length;this.$(".video-filter > .count").text(e),this.$(".music-filter > .count").text(t),this.$(".photo-filter > .count").text(i)
},onReset:function(){this.listCollection.reset(this.collection.all()),this.updateCounts()},onDestroy:function(){this.updateCounts()},onAllClick:function(e){e.preventDefault(),this.view="all",this.$(".channel-filter").removeClass("active"),this.$(".all-filter").addClass("active"),this.listCollection.reset(this.collection.all())},onVideoClick:function(e){e.preventDefault(),this.view="video",this.$(".channel-filter").removeClass("active"),this.$(".video-filter").addClass("active"),this.listCollection.reset(this.collection.videos())
},onMusicClick:function(e){e.preventDefault(),this.view="music",this.$(".channel-filter").removeClass("active"),this.$(".music-filter").addClass("active"),this.listCollection.reset(this.collection.music())},onPhotoClick:function(e){e.preventDefault(),this.view="photo",this.$(".channel-filter").removeClass("active"),this.$(".photo-filter").addClass("active"),this.listCollection.reset(this.collection.photos())}});return r}),define("hb!templates/desktop/channels/ChannelView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a,s="";
return s+='\n					<li>\n						<span class="search-container">\n							<form class="search-form">\n								<input type="text" class="input-dark input-search" placeholder="',a={hash:{},data:t},s+=g((n=i.t||e.t,n?n.call(e,"Search",a):m.call(e,"t","Search",a)))+" ",a={hash:{},data:t},s+=g((n=i.truncate||e.truncate,n?n.call(e,(n=e.channel,null==n||n===!1?n:n.title),10,a):m.call(e,"truncate",(n=e.channel,null==n||n===!1?n:n.title),10,a)))+'" autocomplete="off" spellcheck="false">\n								<i class="glyphicon search"></i>\n							</form>\n						</span>\n					</li>\n				'
}function r(e,t){var n,a,s="";return s+='\n					<li>\n						<button type="button" class="settings-btn btn btn-primary btn-icon" rel="tooltip" title="',a={hash:{},data:t},s+=g((n=i.t||e.t,n?n.call(e,"Settings",a):m.call(e,"t","Settings",a)))+'"><i class="glyphicon cogwheel"></i></button>\n					</li>\n				'}function l(e,t){var n,a,s="";return s+="\n					",a={hash:{},data:t},s+=g((n=i.truncate||e.truncate,n?n.call(e,(n=e.channel,null==n||n===!1?n:n.title),40,a):m.call(e,"truncate",(n=e.channel,null==n||n===!1?n:n.title),40,a)))+"\n				"
}function o(e,t){var n,a,s,r="";return r+='\n					<a href="#!/servers/',(n=i.serverID)?n=n.call(e,{hash:{},data:t}):(n=e.serverID,n=typeof n===v?n.apply(e):n),r+=g(n)+"/channels?",a=i["if"].call(e,(n=e.channel,null==n||n===!1?n:n.key),{hash:{},inverse:y.program(10,d,t),fn:y.program(8,c,t),data:t}),(a||0===a)&&(r+=a),r+='">',s={hash:{},data:t},r+=g((n=i.truncate||e.truncate,n?n.call(e,(n=e.channel,null==n||n===!1?n:n.title),30,s):m.call(e,"truncate",(n=e.channel,null==n||n===!1?n:n.title),30,s)))+'</a>\n					<span class="secondary">',s={hash:{},data:t},r+=g((n=i.truncate||e.truncate,n?n.call(e,(n=e.channelMedia,null==n||n===!1?n:n.title),40,s):m.call(e,"truncate",(n=e.channelMedia,null==n||n===!1?n:n.title),40,s)))+"</span>\n				"
}function c(e,t){var n,a,s="";return s+="key=",a={hash:{},data:t},s+=g((n=i.encodeUrl||e.encodeUrl,n?n.call(e,(n=e.channel,null==n||n===!1?n:n.key),a):m.call(e,"encodeUrl",(n=e.channel,null==n||n===!1?n:n.key),a)))}function d(e){var t,i="";return i+="identifier="+g((t=e.channel,t=null==t||t===!1?t:t.identifier,typeof t===v?t.apply(e):t))}function h(){return'\n	<div class="fanart hidden"></div>\n	<div class="fanart-overlay"></div>\n'}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};
var u,p,f="",m=i.helperMissing,g=this.escapeExpression,v="function",y=this;return f+='<div class="channel-details details">\n	<div class="well">\n		<div class="well-header">\n			<ul class="well-header-actions">\n				',p=i["if"].call(t,(u=t.channel,null==u||u===!1?u:u.search),{hash:{},inverse:y.noop,fn:y.program(1,s,a),data:a}),(p||0===p)&&(f+=p),f+="\n\n				",p=i["if"].call(t,(u=t.channel,null==u||u===!1?u:u.settings),{hash:{},inverse:y.noop,fn:y.program(3,r,a),data:a}),(p||0===p)&&(f+=p),f+="\n			</ul>\n\n			<h2>\n				",p=i["if"].call(t,t.isRoot,{hash:{},inverse:y.program(7,o,a),fn:y.program(5,l,a),data:a}),(p||0===p)&&(f+=p),f+='\n			</h2>\n		</div>\n\n		<ul class="adaptive-channel-list ',(p=i.listType)?p=p.call(t,{hash:{},data:a}):(p=t.listType,p=typeof p===v?p.apply(t):p),f+=g(p)+'"></ul>\n	</div>\n</div>\n\n',p=i["if"].call(t,(u=t.channel,null==u||u===!1?u:u.art),{hash:{},inverse:y.noop,fn:y.program(12,h,a),data:a}),(p||0===p)&&(f+=p),f+="\n"
})}),define("hb!templates/desktop/lists/media/items/AdaptiveChannelListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e){var t;return S((t=e.media,t=null==t||t===!1?t:t.ratingKey,typeof t===k?t.apply(e):t))}function r(e){var t;return S((t=e.media,t=null==t||t===!1?t:t.key,typeof t===k?t.apply(e):t))}function l(){return"/details"}function o(e,t){var n,a,s="";return s+="key=",a={hash:{},data:t},s+=S((n=i.encodeUrl||e.encodeUrl,n?n.call(e,(n=e.channel,null==n||n===!1?n:n.key),a):C.call(e,"encodeUrl",(n=e.channel,null==n||n===!1?n:n.key),a)))
}function c(e){var t,i="";return i+="identifier="+S((t=e.channel,t=null==t||t===!1?t:t.identifier,typeof t===k?t.apply(e):t))}function d(e,t){var n,a,s,r="";return r+='\n\n		<div class="poster-container"></div>\n\n		<div class="media-details">\n			',a=i["if"].call(e,(n=e.media,null==n||n===!1?n:n.duration),{hash:{},inverse:_.noop,fn:_.program(12,h,t),data:t}),(a||0===a)&&(r+=a),r+="\n\n			<h3>",s={hash:{},data:t},r+=S((n=i.truncate||e.truncate,n?n.call(e,(n=e.media,null==n||n===!1?n:n.title),60,s):C.call(e,"truncate",(n=e.media,null==n||n===!1?n:n.title),60,s)))+"</h3>\n\n			",a=i["if"].call(e,(n=e.media,null==n||n===!1?n:n.summary),{hash:{},inverse:_.noop,fn:_.program(14,u,t),data:t}),(a||0===a)&&(r+=a),r+="\n		</div>\n\n	"
}function h(e,t){var n,a,s="";return s+='\n				<div class="media-details-right">',a={hash:{},data:t},s+=S((n=i.formatMinutes||e.formatMinutes,n?n.call(e,(n=e.media,null==n||n===!1?n:n.duration),a):C.call(e,"formatMinutes",(n=e.media,null==n||n===!1?n:n.duration),a)))+"</div>\n			"}function u(e,t){var n,a,s="";return s+='\n				<div class="summary">',a={hash:{},data:t},s+=S((n=i.truncate||e.truncate,n?n.call(e,(n=e.media,null==n||n===!1?n:n.summary),180,a):C.call(e,"truncate",(n=e.media,null==n||n===!1?n:n.summary),180,a)))+"</div>\n			"
}function p(e,t){var n,a,s;return s={hash:{},inverse:_.program(19,m,t),fn:_.program(17,f,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,e.listType,"tile-list media-tile-list",s):C.call(e,"if_eq",e.listType,"tile-list media-tile-list",s),a||0===a?a:""}function f(e){var t,i="";return i+='\n\n		<div class="poster-container">\n			<div class="poster-card">\n				<div class="poster-face front"></div>\n			</div>\n		</div>\n\n		<div class="poster-title">'+S((t=e.media,t=null==t||t===!1?t:t.title,typeof t===k?t.apply(e):t))+"</div>\n\n	"
}function m(e,t){var n,a,s;return s={hash:{},inverse:_.noop,fn:_.program(20,g,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,e.listType,"list media-list media-compact-list",s):C.call(e,"if_eq",e.listType,"list media-list media-compact-list",s),a||0===a?a:""}function g(e,t){var n,a,s="";return s+="\n\n		",a=i["if"].call(e,(n=e.media,null==n||n===!1?n:n.duration),{hash:{},inverse:_.noop,fn:_.program(21,v,t),data:t}),(a||0===a)&&(s+=a),s+='\n\n		<span class="media-title">'+S((n=e.media,n=null==n||n===!1?n:n.title,typeof n===k?n.apply(e):n))+"</span>\n\n	"
}function v(e,t){var n,a,s="";return s+='\n			<div class="sorted-by">',a={hash:{},data:t},s+=S((n=i.formatMinutes||e.formatMinutes,n?n.call(e,(n=e.media,null==n||n===!1?n:n.duration),a):C.call(e,"formatMinutes",(n=e.media,null==n||n===!1?n:n.duration),a)))+"</div>\n		"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var y,b,w,x="",k="function",S=this.escapeExpression,C=i.helperMissing,_=this;return x+='<a data-id="',b=i["if"].call(t,(y=t.media,null==y||y===!1?y:y.ratingKey),{hash:{},inverse:_.program(3,r,a),fn:_.program(1,s,a),data:a}),(b||0===b)&&(x+=b),x+='" href="#!/servers/',(b=i.serverID)?b=b.call(t,{hash:{},data:a}):(b=t.serverID,b=typeof b===k?b.apply(t):b),x+=S(b)+"/channels",w={hash:{},inverse:_.noop,fn:_.program(5,l,a),data:a},y=i.if_eq||t.if_eq,b=y?y.call(t,t.itemType,"clip",w):C.call(t,"if_eq",t.itemType,"clip",w),(b||0===b)&&(x+=b),x+="?",b=i["if"].call(t,(y=t.channel,null==y||y===!1?y:y.key),{hash:{},inverse:_.program(9,c,a),fn:_.program(7,o,a),data:a}),(b||0===b)&&(x+=b),x+="&path=",w={hash:{},data:a},x+=S((y=i.encodeUrl||t.encodeUrl,y?y.call(t,(y=t.media,null==y||y===!1?y:y.key),w):C.call(t,"encodeUrl",(y=t.media,null==y||y===!1?y:y.key),w)))+'" data-focus="keyboard">\n\n	',w={hash:{},inverse:_.program(16,p,a),fn:_.program(11,d,a),data:a},y=i.if_eq||t.if_eq,b=y?y.call(t,t.listType,"list media-list",w):C.call(t,"if_eq",t.listType,"list media-list",w),(b||0===b)&&(x+=b),x+="\n\n</a>\n"
})}),define("plex/desktop/view/lists/media/items/AdaptiveChannelListItem",["hb!templates/desktop/lists/media/items/AdaptiveChannelListItem.tpl","plex/base/view/BaseView","plex/base/view/images/BaseImage"],function(e,t,i){var n=t.extend({tagName:"li",className:"channel hide-hover-overlay",server:null,channel:null,listType:null,itemType:null,poster:null,initialize:function(e){if(this.server=e.server,this.channel=e.channel,this.listType=e.listType,this.itemType=this.model.type||"directory","list media-list"===this.listType||"tile-list media-tile-list"===this.listType){var t="img/posters/poster_square.png",n=100,a=150;
"tile-list media-tile-list"===this.listType&&(n=128,a=200),this.poster=this.registerView(new i({server:this.server,url:this.model.thumb,placeholder:t,className:"poster",transcode:!0,width:n,height:a}))}},render:function(){if(this.$el.html(e({serverID:this.server.id,channel:this.channel.toJSON(),media:this.model,listType:this.listType,itemType:this.itemType})),this.$el.addClass(this.itemType),this.poster){var t;t="tile-list media-tile-list"===this.listType?this.$(".poster-face"):this.$(".poster-container"),t.prepend(this.poster.render().el)
}return this}});return n}),define("plex/desktop/view/channels/ChannelView",["hb!templates/desktop/channels/ChannelView.tpl","plex/base/control/Dispatcher","plex/base/model/AppModel","plex/base/model/collections/PreferenceCollection","plex/base/view/BaseView","plex/desktop/view/modals/ChannelSettingsModal","plex/desktop/view/lists/media/items/AdaptiveChannelListItem","jquery"],function(e,t,i,n,a,s,r,l){var o=a.extend({className:"container",channel:null,items:null,listType:null,fanart:null,events:{"submit .search-form":"onSearchSubmit","click .settings-btn":"onSettingsClick","click .track a":"onTrackClick","click .photo a":"onPhotoClick"},initialize:function(e){this.channel=e.channel;
var n=this.model.get("message");n&&i.set("alert",{message:n});var a=this.model.get("clips").toJSON(),s=this.model.get("tracks").toJSON(),r=this.model.get("photos").toJSON(),l=this.model.get("Directory");this.items=_.compact([].concat(a,s,r,l)),this.listType=this.adaptList(),this.listType?t.trigger("show:background",this.channel):t.trigger("navigate:back")},render:function(){return this.$el.html(e({serverID:this.model.server.id,channel:this.channel.toJSON(),channelMedia:this.model.toJSON(),isRoot:this.channel.id===this.model.id,listType:this.listType})),_.each(this.items,_.bind(function(e){var t=this.registerView(new r({model:e,server:this.model.server,channel:this.channel,listType:this.listType}));
this.$(".adaptive-channel-list").append(t.render().el)},this)),this.$el.tooltip({selector:".btn-icon",placement:"bottom"}),this},adaptList:function(){var e="list media-list",t="tile-list media-tile-list",i="list media-list media-compact-list",n=this.model.get("viewGroup");if(!this.items||!this.items.length)return null;if("Pictures"===n)return t;if("List"===n)return i;var a=this.model.get("photos");if(a&&a.length)return t;var s,r=0,l=0,o=!0;return this.items.length>100?i:(_.each(this.items,function(e){e.settings||e.search||(e.title&&(l+=e.title.length),s&&e.thumb!==s&&(o=!1),e.summary||r++,s=e.thumb)
}),o?i:r>this.items.length/2&&20>l/this.items.length?t:e)},onSearchSubmit:function(e){e.preventDefault();var i=this.$(".input-search").val();if(i){var n={serverID:this.model.server.id,search:this.channel.get("search"),query:i};this.channel.id?n.key=this.channel.id:n.identifier=this.channel.get("identifier"),t.trigger("navigate:channelSearch",n)}},onSettingsClick:function(e){e.preventDefault();var a=new n([],{server:this.model.server,url:this.channel.get("settings")}),r=new s({model:this.channel,collection:a}),l=_.bind(function(e){r.off("close",l),e&&this.model.fetch().done(_.bind(function(){i.set("view",new o({channel:this.channel,model:this.model}))
},this)).fail(function(e,i){t.trigger("navigate:error","This channel is currently unavailable.",i)})},this),c=_.bind(function(){r.on("close",l),i.set("modal",r)});a.fetch().done(c)},onTrackClick:function(e){e.preventDefault();var i=this.model.get("tracks"),n=l(e.currentTarget).data("id");t.trigger("play:music",i,i.get(n))},onPhotoClick:function(e){e.preventDefault();var i=this.model.get("photos"),n=l(e.currentTarget).data("id");t.trigger("show:photo",i,i.get(n))}});return o}),define("hb!templates/desktop/LoginView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a="";
return a+='\n	<div class="error-container">\n		',n=i.unless.call(e,e.isAuthorized,{hash:{},inverse:m.noop,fn:m.program(2,r,t),data:t}),(n||0===n)&&(a+=n),a+="\n	</div>\n"}function r(e,t){var n,a,s="";return s+='\n			<i class="plex-icon-sad"></i>\n\n			',n=i["if"].call(e,e.hasServers,{hash:{},inverse:m.program(5,o,t),fn:m.program(3,l,t),data:t}),(n||0===n)&&(s+=n),s+='\n\n			<a class="retry-btn btn btn-primary btn-medium" href="#">',a={hash:{},data:t},s+=f((n=i.t||e.t,n?n.call(e,"Retry",a):p.call(e,"t","Retry",a)))+'</a> <a class="sign-out-btn btn btn-medium" href="#">',a={hash:{},data:t},s+=f((n=i.t||e.t,n?n.call(e,"Sign Out",a):p.call(e,"t","Sign Out",a)))+"</a>\n		"
}function l(e,t){var n,a,s="";return s+='\n				<h2 class="error-message">',a={hash:{},data:t},s+=f((n=i.t||e.t,n?n.call(e,"This media server is unavailable to you.",a):p.call(e,"t","This media server is unavailable to you.",a)))+"<br>",a={hash:{},data:t},s+=f((n=i.t||e.t,n?n.call(e,"Please check that you have permission to access this media server.",a):p.call(e,"t","Please check that you have permission to access this media server.",a)))+"</h2>\n			"}function o(e,t){var n,a,s="";return s+='\n				<h2 class="error-message">',a={hash:{},data:t},s+=f((n=i.t||e.t,n?n.call(e,"You must install the <a href='{1}' target='_blank'>Plex Media Server</a>","http://plexapp.com/getplex/",a):p.call(e,"t","You must install the <a href='{1}' target='_blank'>Plex Media Server</a>","http://plexapp.com/getplex/",a)))+"<br>",a={hash:{},data:t},s+=f((n=i.t||e.t,n?n.call(e,"and connect the server with your <a href='{1}' target='_blank'>myPlex</a> account.",e.myPlexUrl,a):p.call(e,"t","and connect the server with your <a href='{1}' target='_blank'>myPlex</a> account.",e.myPlexUrl,a)))+"</h2>\n			"
}function c(e,t){var n,a,s,r="";return r+='\n	<div class="well">\n		<form class="row-fluid login-form">\n			<div class="span3"></div>\n			<div class="span6 login-body">\n				<i class="plex-icon-myplex"></i>\n\n				<h3>',s={hash:{},data:t},r+=f((n=i.t||e.t,n?n.call(e,"Sign in to your",s):p.call(e,"t","Sign in to your",s)))+' <a href="',(a=i.myPlexUrl)?a=a.call(e,{hash:{},data:t}):(a=e.myPlexUrl,a=typeof a===g?a.apply(e):a),r+=f(a)+'" target="_blank" tabindex="-1">',s={hash:{},data:t},r+=f((n=i.t||e.t,n?n.call(e,"myPlex",s):p.call(e,"t","myPlex",s)))+"</a> ",s={hash:{},data:t},r+=f((n=i.t||e.t,n?n.call(e,"account",s):p.call(e,"t","account",s)))+'</h3>\n\n				<div class="control-group">\n					<input type="text" class="input-focusable span12" name="username" placeholder="',s={hash:{},data:t},r+=f((n=i.t||e.t,n?n.call(e,"username or email",s):p.call(e,"t","username or email",s)))+'" data-focus="keyboard">\n				</div>\n\n				<div class="control-group">\n					<input type="password" class="input-focusable span12" name="password" placeholder="',s={hash:{},data:t},r+=f((n=i.t||e.t,n?n.call(e,"password",s):p.call(e,"t","password",s)))+'" data-focus="keyboard">\n				</div>\n\n				<div class="control-group">\n					<button type="submit" class="btn btn-medium btn-primary pull-right" data-focus="keyboard">',s={hash:{},data:t},r+=f((n=i.t||e.t,n?n.call(e,"Sign In",s):p.call(e,"t","Sign In",s)))+'</button>\n					<label>\n						<input type="checkbox" name="rememberMe" value="1" checked>\n						',s={hash:{},data:t},r+=f((n=i.t||e.t,n?n.call(e,"Remember Me",s):p.call(e,"t","Remember Me",s)))+"\n					</label>\n				</div>\n			</div>\n		</form>\n	</div>\n"
}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var d,h,u="",p=i.helperMissing,f=this.escapeExpression,m=this,g="function";return h=i["if"].call(t,(d=t.myPlex,null==d||d===!1?d:d.signedIn),{hash:{},inverse:m.program(7,c,a),fn:m.program(1,s,a),data:a}),(h||0===h)&&(u+=h),u+="\n"})}),define("plex/desktop/view/LoginView",["hb!templates/desktop/LoginView.tpl","plex/base/control/Dispatcher","plex/base/model/AppModel","plex/base/view/FocusView","spin"],function(e,t,i,n){var a=n.extend({className:"login-container container",events:{"click .retry-btn":"onRetryClick","click .sign-out-btn":"onSignOutClick","submit .login-form":"onSubmit"},initialize:function(){var e=i.get("myPlex");
e.get("signedIn")&&i.get("isAuthorized")&&_.delay(function(){t.trigger("navigate:dashboard")},55)},render:function(){var t=i.get("myPlex"),n=i.get("servers");return this.$el.html(e({myPlex:t.toJSON(),isAuthorized:i.get("isAuthorized"),hasServers:!!n.length,myPlexUrl:t.url(),plexpassUrl:t.resolveUrl("/subscription/about"),signUpUrl:t.resolveUrl("/users/sign_up")})),this},postrender:function(){this.$("input[name=username]").focus()},onRetryClick:function(e){e.preventDefault(),this.$(".retry-btn").spinContents("small"),t.trigger("command:StartInit",{silent:!0})
},onSignOutClick:function(e){e.preventDefault(),t.trigger("command:SignOut")},onSubmit:function(e){e.preventDefault();var i=e.currentTarget,n=this.$("[type=submit]");if(!n.hasClass("active")){n.spinContents("small");var a={username:i.username.value,password:i.password.value,rememberMe:i.rememberMe.checked,silent:!0};a.success=_.bind(function(){n.spinContents(!1)},this),a.error=a.success,t.trigger("command:SignIn",a)}}});return a}),define("hb!templates/desktop/UnsupportedBrowserView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){return this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{},'<i class="plex-icon-sad"></i>\n\n<h2 class="error-message">\n	Sorry, this browser doesn\'t appear to be supported.<br>\n	See <a href="http://wiki.plexapp.com/index.php/UnsupportedBrowsers">the wiki</a> for more info.\n</h2>\n'
})}),define("plex/desktop/view/UnsupportedBrowserView",["hb!templates/desktop/UnsupportedBrowserView.tpl","plex/base/view/BaseView"],function(e,t){var i=t.extend({className:"error-container container",render:function(){return this.$el.html(e({})),this}});return i}),define("hb!templates/base/ErrorView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var s,r,l="",o=i.helperMissing,c=this.escapeExpression;return l+='<i class="plex-icon-sad"></i>\n\n<h2 class="error-message">',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,t.message,r):o.call(t,"t",t.message,r)))+"</h2>\n"
})}),define("plex/base/view/ErrorView",["hb!templates/base/ErrorView.tpl","plex/base/view/BaseView"],function(e,t){var i=t.extend({className:"error-container container",error:null,initialize:function(e){if(this.message=e.message,this.error=e.error,this.error){switch(this.error.status){case 401:case 403:return this.message="You do not have permission to access this page.",void 0;case 500:return this.message="The media server responded with an error.",void 0}"abort"===e.error.statusText&&(this.message="The media server is not responding.")
}},render:function(){return this.$el.html(e({message:this.message})),this}});return i}),define("hb!templates/desktop/setup/SetupView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a,s="";return s+='\n		<div class="setup-starting-container">\n			<div class="spinner-container"></div><br>\n			',a={hash:{},data:t},s+=u((n=i.t||e.t,n?n.call(e,"Please wait a moment while Plex starts.",a):h.call(e,"t","Please wait a moment while Plex starts.",a)))+'\n		</div>\n		<div class="setup-error-container error-container hide">\n			<i class="plex-icon-sad"></i>\n			<p class="error-message">',a={hash:{},data:t},s+=u((n=i.t||e.t,n?n.call(e,"A problem has been detected with a core component of Plex. Please visit the <a href='{1}' target='_blank'>forums</a> and provide your logs, as described <a href='{2}' target='_blank'>here</a>.","http://forums.plexapp.com/","http://wiki.plexapp.com/index.php/PlexNine_Tips_and_Tricks#Plex_Log_Files",a):h.call(e,"t","A problem has been detected with a core component of Plex. Please visit the <a href='{1}' target='_blank'>forums</a> and provide your logs, as described <a href='{2}' target='_blank'>here</a>.","http://forums.plexapp.com/","http://wiki.plexapp.com/index.php/PlexNine_Tips_and_Tricks#Plex_Log_Files",a)))+"</p>\n		</div>\n	"
}function r(e,t){var n,a,s="";return s+='\n		<div class="setup-progress">\n			<div class="intro-segment setup-progress-segment active">\n				<a class="change-view-btn segment-title gray" data-view="intro" href="#">',a={hash:{},data:t},s+=u((n=i.t||e.t,n?n.call(e,"Introduction",a):h.call(e,"t","Introduction",a)))+'</a>\n			</div><div class="setup-segment setup-progress-segment">\n				<a class="change-view-btn segment-title gray" data-view="setup" href="#">',a={hash:{},data:t},s+=u((n=i.t||e.t,n?n.call(e,"Basic Setup",a):h.call(e,"t","Basic Setup",a)))+'</a>\n			</div><div class="library-segment setup-progress-segment">\n				<a class="change-view-btn segment-title gray" data-view="library" href="#">',a={hash:{},data:t},s+=u((n=i.t||e.t,n?n.call(e,"Library",a):h.call(e,"t","Library",a)))+'</a>\n			</div><div class="channels-segment setup-progress-segment">\n				<a class="change-view-btn segment-title gray" data-view="channels" href="#">',a={hash:{},data:t},s+=u((n=i.t||e.t,n?n.call(e,"Channels",a):h.call(e,"t","Channels",a)))+'</a>\n			</div><div class="myplex-segment setup-progress-segment">\n				<a class="change-view-btn segment-title gray" data-view="myplex" href="#">',a={hash:{},data:t},s+=u((n=i.t||e.t,n?n.call(e,"myPlex",a):h.call(e,"t","myPlex",a)))+'</a>\n			</div>\n		</div>\n\n		<div class="setup-inner-container"></div>\n	'
}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var l,o,c,d="",h=i.helperMissing,u=this.escapeExpression,p=this;return d+='<div class="subnav-container">\n	<ul class="subnav-actions">\n		<li>\n			<a class="skip-btn btn btn-inverse btn-icon" href="#"><span class="btn-icon-label">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Skip",c):h.call(t,"t","Skip",c)))+"</span></a>\n		</li>\n	</ul>\n\n	<h2>",c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Get Started",c):h.call(t,"t","Get Started",c)))+'</h2>\n</div>\n\n<div class="well">\n	',o=i["if"].call(t,t.starting,{hash:{},inverse:p.program(3,r,a),fn:p.program(1,s,a),data:a}),(o||0===o)&&(d+=o),d+="\n</div>\n"
})}),define("hb!templates/desktop/setup/SetupIntroView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var s,r,l="",o=i.helperMissing,c=this.escapeExpression;return l+='<h2 class="setup-section-title">',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Welcome to the Plex Media Server!",r):o.call(t,"t","Welcome to the Plex Media Server!",r)))+'</h2>\n\n<p class="muted">',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"In the next few steps, you'll tell Plex where your music, videos, and photos are stored. Plex will create a beautiful library and organize your media inside it.",r):o.call(t,"t","In the next few steps, you'll tell Plex where your music, videos, and photos are stored. Plex will create a beautiful library and organize your media inside it.",r)))+'</p>\n\n<p class="muted">',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"We will then show you how to get iOS, Android, Mac, PC, and Connected TV apps so that you can access your library from any devices you own, both inside the home and on the go.",r):o.call(t,"t","We will then show you how to get iOS, Android, Mac, PC, and Connected TV apps so that you can access your library from any devices you own, both inside the home and on the go.",r)))+'\n\n<p class="server-intro-graphic">\n	<img src="img/setup-wizard-server.png" width="780" height="269">\n</p>\n\n<div class="form-actions pull-center">\n		<a class="change-view-btn btn btn-primary btn-large" data-view="setup" href="#">',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Start",r):o.call(t,"t","Start",r)))+"</i></a>\n</div>\n"
})}),define("plex/desktop/view/setup/SetupIntroView",["hb!templates/desktop/setup/SetupIntroView.tpl","plex/base/view/BaseView"],function(e,t){var i=t.extend({initialize:function(){},render:function(){return this.$el.html(e({server:this.model.toJSON()})),this}});return i}),define("hb!templates/desktop/setup/SetupServerView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a,s="";return s+='\n		<p class="muted">\n			',a={hash:{},data:t},s+=u((n=i.t||e.t,n?n.call(e,"Let's start by giving your Plex server a friendly name so it can identify itself to other computers on the network. If you leave it blank, your computer name will be used.",a):h.call(e,"t","Let's start by giving your Plex server a friendly name so it can identify itself to other computers on the network. If you leave it blank, your computer name will be used.",a)))+'\n		</p>\n		<div class="control-group">\n			<label class="control-label" for="'+u((n=e.friendlyName,n=null==n||n===!1?n:n.id,typeof n===p?n.apply(e):n))+'">'+u((n=e.friendlyName,n=null==n||n===!1?n:n.label,typeof n===p?n.apply(e):n))+'</label>\n			<div class="controls">\n				<input type="text" id="'+u((n=e.friendlyName,n=null==n||n===!1?n:n.id,typeof n===p?n.apply(e):n))+'" name="'+u((n=e.friendlyName,n=null==n||n===!1?n:n.id,typeof n===p?n.apply(e):n))+'" class="span5" value="'+u((n=e.friendlyName,n=null==n||n===!1?n:n.value,typeof n===p?n.apply(e):n))+'" placeholder="'+u((n=e.server,n=null==n||n===!1?n:n.name,typeof n===p?n.apply(e):n))+'">\n			</div>\n		</div>\n	'
}function r(e,t){var n,a,s="";return s+='\n		<p class="muted">\n			',a={hash:{},data:t},s+=u((n=i.t||e.t,n?n.call(e,"Would you like to help us make Plex better for everyone? We collect anonymous data, which we use to improve the service over time.",a):h.call(e,"t","Would you like to help us make Plex better for everyone? We collect anonymous data, which we use to improve the service over time.",a)))+'\n		</p>\n		<div class="control-group">\n			<label class="control-label" for="'+u((n=e.collectUsageData,n=null==n||n===!1?n:n.id,typeof n===p?n.apply(e):n))+'">',a={hash:{},data:t},s+=u((n=i.t||e.t,n?n.call(e,"Send feedback",a):h.call(e,"t","Send feedback",a)))+'</label>\n			<div class="controls">\n				<input type="checkbox" id="'+u((n=e.collectUsageData,n=null==n||n===!1?n:n.id,typeof n===p?n.apply(e):n))+'" name="'+u((n=e.collectUsageData,n=null==n||n===!1?n:n.id,typeof n===p?n.apply(e):n))+'" class="input-dark" checked="checked">\n			</div>\n		</div>\n	'
}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var l,o,c,d="",h=i.helperMissing,u=this.escapeExpression,p="function",f=this;return d+='<h2 class="setup-section-title">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Basic Setup",c):h.call(t,"t","Basic Setup",c)))+'</h2>\n\n<form class="form-horizontal">\n	',o=i["if"].call(t,t.friendlyName,{hash:{},inverse:f.noop,fn:f.program(1,s,a),data:a}),(o||0===o)&&(d+=o),d+="\n\n	",o=i["if"].call(t,t.collectUsageData,{hash:{},inverse:f.noop,fn:f.program(3,r,a),data:a}),(o||0===o)&&(d+=o),d+='\n\n	<p class="muted">\n		',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"If you would like to receive announcements about Plex, please enter your email address below. Don't worry, we won't send you spam.",c):h.call(t,"t","If you would like to receive announcements about Plex, please enter your email address below. Don't worry, we won't send you spam.",c)))+'\n	</p>\n	<div class="control-group">\n			<label class="control-label" for="email">Email</label>\n			<div class="controls">\n				<input type="text" id="email" name="email" class="span5">\n			</div>\n	</div>\n\n	<div class="form-actions">\n		<a class="next-btn btn btn-primary btn-medium" href="#">',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Next",c):h.call(t,"t","Next",c)))+' <i class="glyphicon right-arrow"></i></a>\n	</div>\n</form>\n'
})}),define("plex/desktop/view/setup/SetupServerView",["hb!templates/desktop/setup/SetupServerView.tpl","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel","plex/base/view/BaseView","jquery"],function(e,t,i,n,a){var s=n.extend({friendlyName:null,collectUsageData:null,events:{"change input[name]":"onPreferenceChange","change select[name]":"onPreferenceChange","click .next-btn":"onNextClick"},initialize:function(){var e=this.model.get("preferences");this.friendlyName=e.get("FriendlyName"),this.collectUsageData=e.get("collectUsageData"),this.addBinding(e,"reset",this.onPreferencesReset),e.populate()
},render:function(){var t={server:this.model.toJSON()};return this.changes=this.model.supports("firstRunPref")?{FirstRun:0}:{},this.friendlyName&&(t.friendlyName=this.friendlyName.toJSON()),this.collectUsageData&&(t.collectUsageData=this.collectUsageData.toJSON()),this.$el.html(e(t)),this},onPreferencesReset:function(e){this.friendlyName=e.get("FriendlyName"),this.collectUsageData=e.get("collectUsageData"),this.render()},onPreferenceChange:function(e){var t=e.currentTarget,i=t.value;"checkbox"!==t.type||t.checked||(i="0"),this.changes[t.name]=i
},onNextClick:function(e){e.preventDefault(),this.changes.email&&(a.ajax({type:"POST",url:"https://my.plexapp.com/mailinglist/optin",data:{email:this.changes.email}}),delete this.changes.email),this.friendlyName.save(this.changes).done(_.bind(function(){this.trigger("view:change","library")},this)).fail(function(){i.set("alert",{status:"error",message:t.t("There was a problem saving your server settings.")})})}});return s}),define("hb!templates/desktop/setup/SetupMyPlexView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};
var s,r,l="",o=i.helperMissing,c=this.escapeExpression;return l+='<h2 class="setup-section-title">',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Connect Your Server to myPlex",r):o.call(t,"t","Connect Your Server to myPlex",r)))+'</h2>\n\n<p class="muted">',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"myPlex makes it easy to get to your media no matter where you are.",r):o.call(t,"t","myPlex makes it easy to get to your media no matter where you are.",r)))+'</p>\n\n<p class="muted">',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"With a myPlex account you will be able to queue up video from your browser,<br>access your content from outside your home and easily share content with friends and family.",r):o.call(t,"t","With a myPlex account you will be able to queue up video from your browser,<br>access your content from outside your home and easily share content with friends and family.",r)))+'</p>\n\n<div class="myplex-container">\n	<i class="plex-icon-myplex pull-left"></i>\n\n	<form class="setup-myplex-form"></form>\n</div>\n\n<div class="form-actions">\n	<a class="next-btn btn btn-primary btn-medium" href="#">',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Next",r):o.call(t,"t","Next",r)))+' <i class="glyphicon right-arrow"></i></a>\n</div>\n'
})}),define("plex/desktop/view/setup/SetupMyPlexView",["hb!templates/desktop/setup/SetupMyPlexView.tpl","plex/base/control/Dispatcher","plex/base/model/AppModel","plex/base/view/BaseView","plex/desktop/view/server/settings/MyPlexConnectView","jquery","spin"],function(e,t,i,n,a){var s=n.extend({autoAdvance:!1,events:{"keypress .setup-myplex-form":"onFormKeyPress","click .next-btn":"onSubmit"},initialize:function(){var e=this.model.get("myPlexAccount"),t=this.model.get("preferences");this.connectView=new a({model:e}),this.addBinding(this.connectView,"start:spinner",this.onSpinnerStart),this.addBinding(this.connectView,"stop:spinner",this.onSpinnerStop),e.fetch({hideLoadingAlert:!0}),t.populate({hideLoadingAlert:!0})
},render:function(){var t=this.model.get("myPlexAccount");return this.$el.html(e()),this.$(".setup-myplex-form").append(this.connectView.render().el),this.connectView.delegateEvents(),_.defer(_.bind(function(){"ok"===t.get("signInState")&&"failed"===t.get("mappingState")&&this.connectView.retry()},this)),this},onSpinnerStart:function(){this.$(".next-btn").spinContents("small")},onSpinnerStop:function(){this.$(".next-btn").spinContents(!1),this.autoAdvance&&(this.autoAdvance=!1,this.connectView.published&&this.trigger("view:change","complete"))
},onFormKeyPress:function(e){13===e.keyCode&&this.onSubmit(e)},onSubmit:function(e){if(e.preventDefault(),!this.$(".next-btn").hasClass("active"))if(this.connectView.signedIn)this.trigger("view:change","complete");else{var t=this.$(".setup-myplex-form")[0],i=this.$(".confirmPassword-group").hasClass("hide");if(!t.username.value||!t.password.value||!i&&!t.email.value)return this.trigger("view:change","complete"),void 0;this.autoAdvance=!0,this.$(".confirmPassword-group").hasClass("hide")?this.connectView.signInServer(t.username.value,t.password.value):this.connectView.signUpServer(t.username.value,t.email.value,t.password.value,t.confirmPassword.value)
}}});return s}),define("hb!templates/desktop/setup/SetupLibraryView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var s,r,l="",o=i.helperMissing,c=this.escapeExpression;return l+='<h2 class="setup-section-title">',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Create Your Media Library",r):o.call(t,"t","Create Your Media Library",r)))+'</h2>\n\n<p class="muted">',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Plex organizes your library into sections, organized by type. You can add as many sections as you want, and you can have multiple sections with the same type.",r):o.call(t,"t","Plex organizes your library into sections, organized by type. You can add as many sections as you want, and you can have multiple sections with the same type.",r)))+'</p>\n\n<div class="setup-add-section-container">\n	<a class="add-btn btn btn-medium" href="#"><i class="glyphicon plus"></i> ',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Add Section",r):o.call(t,"t","Add Section",r)))+'</a>\n</div>\n\n<div class="form-actions">\n	<a class="next-btn btn btn-primary btn-medium" href="#">',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Next",r):o.call(t,"t","Next",r)))+' <i class="glyphicon right-arrow"></i></a>\n</div>\n'
})}),define("plex/desktop/view/lists/SectionList",["plex/base/view/lists/BaseList","plex/desktop/view/lists/items/SectionListItem"],function(e,t){var i=e.extend({tagName:"ul",className:"list media-list section-list",initialize:function(){this.setup(t),this.collection.fetch()},render:function(){return this.$el.empty(),this.populate(this.collection),this.$el.tooltip({selector:".btn-icon",placement:"bottom"}),this}});return i}),define("plex/desktop/view/setup/SetupLibraryView",["hb!templates/desktop/setup/SetupLibraryView.tpl","plex/base/model/AppModel","plex/base/view/BaseView","plex/desktop/view/lists/SectionList","plex/desktop/view/modals/EditSectionModal"],function(e,t,i,n,a){var s=i.extend({sectionList:null,events:{"click .add-btn":"onAddClick","click .next-btn":"onNextClick"},initialize:function(){var e=this.model.get("sections");
this.sectionList=this.registerView(new n({collection:e}))},render:function(){return this.$el.html(e({server:this.model.toJSON()})),this.$(".setup-add-section-container").after(this.sectionList.render().el),this},onAddClick:function(e){e.preventDefault(),t.set("modal",new a({server:this.model}))},onNextClick:function(e){e.preventDefault(),this.trigger("view:change","channels")}});return s}),define("hb!templates/desktop/setup/SetupChannelsView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a,s,o="";
return o+='\n	<div class="required-plugins">\n		<h3 class="setup-section-subtitle">',s={hash:{},data:t},o+=v((n=i.t||e.t,n?n.call(e,"Required Plugins",s):g.call(e,"t","Required Plugins",s)))+'</h3>\n		<p class="muted">',s={hash:{},data:t},o+=v((n=i.t||e.t,n?n.call(e,"Channels may require plugins to be installed alongside the media server. Click on the links below to download the installer for each plugin.",s):g.call(e,"t","Channels may require plugins to be installed alongside the media server. Click on the links below to download the installer for each plugin.",s)))+"</p>\n\n		",a=i["if"].call(e,e.showPluginWarning,{hash:{},inverse:y.noop,fn:y.program(2,r,t),data:t}),(a||0===a)&&(o+=a),o+='\n\n		<p class="plugin-list">\n			',a=i.unless.call(e,(n=e.server,null==n||n===!1?n:n.flashInstalled),{hash:{},inverse:y.noop,fn:y.program(4,l,t),data:t}),(a||0===a)&&(o+=a),o+="\n\n			",a=i.unless.call(e,(n=e.server,null==n||n===!1?n:n.silverlightInstalled),{hash:{},inverse:y.noop,fn:y.program(9,d,t),data:t}),(a||0===a)&&(o+=a),o+="\n\n			",a=i.unless.call(e,(n=e.server,null==n||n===!1?n:n.soundflowerInstalled),{hash:{},inverse:y.noop,fn:y.program(11,h,t),data:t}),(a||0===a)&&(o+=a),o+="\n		</p>\n	</div>\n"
}function r(e,t){var n,a,s="";return s+='\n			<p class="plugin-warning">',a={hash:{},data:t},s+=v((n=i.t||e.t,n?n.call(e,"Plugins need to be installed on the computer that is running the media server.",a):g.call(e,"t","Plugins need to be installed on the computer that is running the media server.",a)))+"</p>\n		"}function l(e,t){var n,a="";return a+='\n				<span class="required-plugin">\n					',n=i["if"].call(e,e.mac,{hash:{},inverse:y.program(7,c,t),fn:y.program(5,o,t),data:t}),(n||0===n)&&(a+=n),a+='\n						<img src="img/plugins/flash.png" width="80" height="80"><br>\n						Flash Player\n					</a>\n				</span>\n			'
}function o(){return'\n						<a href="http://fpdownload.adobe.com/pub/flashplayer/current/support/install_flash_player_osx.dmg">\n					'}function c(){return'\n						<a href="http://fpdownload.adobe.com/pub/flashplayer/current/support/install_flash_player.exe">\n					'}function d(){return'\n				<span class="required-plugin">\n					<a href="http://www.microsoft.com/getsilverlight/handlers/getsilverlight.ashx">\n						<img src="img/plugins/silverlight.png" width="80" height="80"><br>\n						Silverlight\n					</a>\n				</span>\n			'
}function h(){return'\n				<span class="required-plugin">\n					<a href="http://soundflower.googlecode.com/files/Soundflower-1.6.6b.dmg">\n						<img src="img/plugins/soundflower.png" width="80" height="80"><br>\n						Soundflower\n					</a>\n				</span>\n			'}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var u,p,f,m="",g=i.helperMissing,v=this.escapeExpression,y=this;return m+='<h2 class="setup-section-title">',f={hash:{},data:a},m+=v((u=i.t||t.t,u?u.call(t,"Install Channels",f):g.call(t,"t","Install Channels",f)))+'</h2>\n\n<p class="muted">',f={hash:{},data:a},m+=v((u=i.t||t.t,u?u.call(t,"Plex channels give you access to online media from a variety of sites. You can browse and install these channels from the Channel Directory, but get started by installing some featured channels.",f):g.call(t,"t","Plex channels give you access to online media from a variety of sites. You can browse and install these channels from the Channel Directory, but get started by installing some featured channels.",f)))+'</p>\n\n<div class="featured-channels">\n	<h3 class="setup-section-subtitle">',f={hash:{},data:a},m+=v((u=i.t||t.t,u?u.call(t,"Featured Channels",f):g.call(t,"t","Featured Channels",f)))+"</h3>\n</div>\n\n",p=i["if"].call(t,t.showPlugins,{hash:{},inverse:y.noop,fn:y.program(1,s,a),data:a}),(p||0===p)&&(m+=p),m+='\n\n<div class="form-actions">\n	<a class="next-btn btn btn-primary btn-medium" href="#">',f={hash:{},data:a},m+=v((u=i.t||t.t,u?u.call(t,"Next",f):g.call(t,"t","Next",f)))+' <i class="glyphicon right-arrow"></i></a>\n</div>\n'
})}),define("hb!templates/desktop/lists/channels/items/ChannelTileListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){return this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{},'<a href="#">\n	<div class="poster-container">\n		<div class="poster-card">\n			<div class="poster-face front">\n				<i class="installed-icon glyphicon ok-2"></i>\n\n				<div class="hover-overlay card-overlay">\n					<span class="poster-title"></span>\n				</div>\n			</div>\n		</div>\n	</div>\n</a>\n'
})}),define("hb!templates/desktop/modals/ChannelModal.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t,n){var a,s,o,u="";return u+="\n			",o={hash:{},inverse:b.noop,fn:b.program(2,r,t),data:t},a=i.if_eq||e.if_eq,s=a?a.call(e,e.name,"Install",o):y.call(e,"if_eq",e.name,"Install",o),(s||0===s)&&(u+=s),u+="\n\n			",o={hash:{},inverse:b.noop,fn:b.programWithDepth(4,l,t,n),data:t},a=i.if_eq||e.if_eq,s=a?a.call(e,e.name,"Update",o):y.call(e,"if_eq",e.name,"Update",o),(s||0===s)&&(u+=s),u+="\n\n			",o={hash:{},inverse:b.noop,fn:b.program(7,c,t),data:t},a=i.if_eq||e.if_eq,s=a?a.call(e,e.name,"Restart",o):y.call(e,"if_eq",e.name,"Restart",o),(s||0===s)&&(u+=s),u+="\n\n			",o={hash:{},inverse:b.noop,fn:b.program(9,d,t),data:t},a=i.if_eq||e.if_eq,s=a?a.call(e,e.name,"Reset",o):y.call(e,"if_eq",e.name,"Reset",o),(s||0===s)&&(u+=s),u+="\n\n			",o={hash:{},inverse:b.noop,fn:b.program(11,h,t),data:t},a=i.if_eq||e.if_eq,s=a?a.call(e,e.name,"Uninstall",o):y.call(e,"if_eq",e.name,"Uninstall",o),(s||0===s)&&(u+=s),u+="\n		"
}function r(e,t){var n,a,s="";return s+='\n				<button class="btn btn-primary action-btn install-btn" data-key="',(n=i.key)?n=n.call(e,{hash:{},data:t}):(n=e.key,n=typeof n===g?n.apply(e):n),s+=v(n)+'"><i class="glyphicon circle-arrow-down"></i> ',a={hash:{},data:t},s+=v((n=i.t||e.t,n?n.call(e,e.name,a):y.call(e,"t",e.name,a)))+"</button>\n			"}function l(e,t,n){var a,s,r,l="";return l+="\n				",a=i.unless.call(e,n.agent,{hash:{},inverse:b.noop,fn:b.program(5,o,t),data:t}),(a||0===a)&&(l+=a),l+='\n\n				<div class="btn-group">\n					<button class="btn action-btn" data-key="',(a=i.key)?a=a.call(e,{hash:{},data:t}):(a=e.key,a=typeof a===g?a.apply(e):a),l+=v(a)+'"><i class="glyphicon circle-arrow-top"></i> ',r={hash:{},data:t},l+=v((a=i.t||e.t,a?a.call(e,e.name,r):y.call(e,"t",e.name,r)))+'</button>\n					<button class="btn dropdown-toggle" data-toggle="dropdown">\n						<i class="glyphicon-caret small"></i>\n					</button>\n					<ul class="dropdown-menu dropdown-menu-large pull-right">\n						<li><a class="action-btn" data-key="',(s=i.key)?s=s.call(e,{hash:{},data:t}):(s=e.key,s=typeof s===g?s.apply(e):s),l+=v(s)+'" href="#">',r={hash:{},data:t},l+=v((a=i.t||e.t,a?a.call(e,e.name,r):y.call(e,"t",e.name,r)))+"</a></li>\n			"
}function o(e,t){var n,a,s="";return s+='\n					<button class="btn btn-primary browse-btn"><i class="glyphicon show-thumbnails"></i> ',a={hash:{},data:t},s+=v((n=i.t||e.t,n?n.call(e,"Browse",a):y.call(e,"t","Browse",a)))+"</button>\n				"}function c(e,t){var n,a,s="";return s+='\n						<li><a class="action-btn" data-key="',(n=i.key)?n=n.call(e,{hash:{},data:t}):(n=e.key,n=typeof n===g?n.apply(e):n),s+=v(n)+'" href="#">',a={hash:{},data:t},s+=v((n=i.t||e.t,n?n.call(e,e.name,a):y.call(e,"t",e.name,a)))+"</a></li>\n			"
}function d(e,t){var n,a,s="";return s+='\n						<li><a class="action-btn" data-key="',(n=i.key)?n=n.call(e,{hash:{},data:t}):(n=e.key,n=typeof n===g?n.apply(e):n),s+=v(n)+'" href="#">',a={hash:{},data:t},s+=v((n=i.t||e.t,n?n.call(e,e.name,a):y.call(e,"t",e.name,a)))+"</a></li>\n					</ul>\n				</div>\n			"}function h(e,t){var n,a,s="";return s+='\n				<button class="btn btn-danger action-btn" data-key="',(n=i.key)?n=n.call(e,{hash:{},data:t}):(n=e.key,n=typeof n===g?n.apply(e):n),s+=v(n)+'"><i class="glyphicon ban"></i> ',a={hash:{},data:t},s+=v((n=i.t||e.t,n?n.call(e,e.name,a):y.call(e,"t",e.name,a)))+"</button>\n			"
}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var u,p,f,m="",g="function",v=this.escapeExpression,y=i.helperMissing,b=this;return m+='<div class="modal-header">\n	<button type="button" class="close" data-dismiss="modal"><i class="glyphicon remove-2"></i></button>\n	<h3>'+v((u=t.channel,u=null==u||u===!1?u:u.name,typeof u===g?u.apply(t):u))+'</h3>\n</div>\n\n<div class="modal-body minimal-scrollbar">\n	<div class="channel-controls">\n		',p=i.each.call(t,t.actions,{hash:{},inverse:b.noop,fn:b.programWithDepth(1,s,a,t),data:a}),(p||0===p)&&(m+=p),m+='\n	</div>\n\n	<div class="channel-details">\n		<p class="summary">',f={hash:{},data:a},m+=v((u=i.truncate||t.truncate,u?u.call(t,(u=t.channel,null==u||u===!1?u:u.summary),500,f):y.call(t,"truncate",(u=t.channel,null==u||u===!1?u:u.summary),500,f)))+"</p>\n	</div>\n</div>\n"
})}),define("plex/desktop/view/modals/ChannelModal",["hb!templates/desktop/modals/ChannelModal.tpl","plex/base/control/Dispatcher","plex/base/view/modals/BaseModal","plex/base/view/images/BaseImage","jquery"],function(e,t,i,n,a){var s=i.extend({name:"channelModal",className:"modal channel-modal fade",closeOnInstall:!1,icon:null,events:{hidden:"close","click .action-btn":"onActionClick","click .browse-btn":"onBrowseClick"},initialize:function(e){this.closeOnInstall=e.closeOnInstall,this.icon=this.registerView(new n({model:this.model,modelAttr:"thumb",placeholder:"img/posters/poster_square.png",className:"poster channel-poster",transcode:!0,width:200,height:200}));
var t=this.model.get("actions");t.url=this.model.id,this.addBinding(t,"reset",this.render),t.fetch()},render:function(){return this.$el.html(e({serverID:this.model.server.id,channel:this.model.toJSON(),agent:/com.plexapp.agents./.test(this.model.id),actions:this.model.get("actions").toJSON()})).modal(),this.$(".channel-controls").prepend(this.icon.render().el),this},onActionClick:function(e){e.preventDefault();var i=a(e.target);i.addClass("disabled");var n=_.bind(function(){i.hasClass("install-btn")&&this.closeOnInstall?this.$el.modal("hide"):(i.removeClass("disabled"),this.model.get("actions").fetch())
},this);t.trigger("command:ChannelAction",this.model,i.data("key"),n)},onBrowseClick:function(e){e.preventDefault();var i=this.model.get("key"),n=_.last(i.split("/"));this.$el.modal("hide"),t.trigger("navigate:channel",{serverID:this.model.server.id,identifier:n})}});return s}),define("plex/desktop/view/lists/channels/items/ChannelTileListItem",["hb!templates/desktop/lists/channels/items/ChannelTileListItem.tpl","plex/base/control/Dispatcher","plex/base/model/AppModel","plex/base/view/BaseView","plex/base/view/images/BaseImage","plex/desktop/view/modals/ChannelModal"],function(e,t,i,n,a,s){var r=n.extend({tagName:"li",closeOnInstall:!1,icon:null,events:{"click a":"onClick"},initialize:function(e){this.closeOnInstall=e.list.closeOnInstall,this.icon=this.registerView(new a({model:this.model,modelAttr:"thumb",placeholder:"img/posters/poster_square.png",className:"poster channel-poster",transcode:!0,width:128,height:128})),this.addBinding(this.model,"change",this.render)
},render:function(){return this.$el.html(e({channel:this.model.toJSON()})),this.$(".poster-face").prepend(this.icon.render().el),this.bindView(),this},bindings:{".poster-title":{modelAttr:"name"},".installed-icon":{modelAttr:"installed",hideEmpty:!0,format:function(e,t){t?e.removeClass("hide"):e.addClass("hide")}}},onClick:function(e){e.preventDefault(),i.set("modal",new s({model:this.model,closeOnInstall:this.closeOnInstall}))}});return r}),define("plex/desktop/view/lists/channels/ChannelTileList",["plex/base/view/lists/BaseList","plex/desktop/view/lists/channels/items/ChannelTileListItem"],function(e,t){var i=e.extend({tagName:"ul",className:"tile-list channel-tile-list",closeOnInstall:!1,initialize:function(e){this.setup(t),this.closeOnInstall=e.closeOnInstall
},render:function(){return this.$el.empty(),this.populate(this.collection),this}});return i}),define("plex/desktop/view/setup/SetupChannelsView",["hb!templates/desktop/setup/SetupChannelsView.tpl","plex/base/model/collections/ChannelCollection","plex/base/view/BaseView","plex/desktop/view/lists/channels/ChannelTileList","jquery"],function(e,t,i,n){var a=i.extend({channelList:null,events:{"click .next-btn":"onNextClick"},initialize:function(){var e=new t([],{server:this.model,url:"/system/appstore/featured"});
e.fetch({hideLoadingAlert:!0}),this.channelList=this.registerView(new n({collection:e,closeOnInstall:!0}))},render:function(){var t=this.model.get("flashInstalled"),i=this.model.get("flashInstalled"),n=this.model.get("soundflowerInstalled");return this.$el.html(e({server:this.model.toJSON(),showPlugins:!t||!i||!n,showPluginWarning:!/^(localhost|127.0.0.1)$/.test(window.location.hostname),mac:navigator.appVersion.indexOf("Mac")>-1})),this.$(".featured-channels").append(this.channelList.render().el),this
},onNextClick:function(e){e.preventDefault(),this.trigger("view:change","myplex")}});return a}),define("hb!templates/desktop/setup/SetupCompleteView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a,s="";return s+='\n	<h3 class="setup-section-subtitle">',a={hash:{},data:t},s+=h((n=i.t||e.t,n?n.call(e,"Add videos to your queue from the browser",a):d.call(e,"t","Add videos to your queue from the browser",a)))+"</h3>\n\n	<p class=\"queue-email\">\n		<a class=\"queue-bookmarklet-btn well\" href=\"javascript: var s=document.createElement('script');s.type='text/javascript';s.src='https://my.plexapp.com/queue/bookmarklet_payload?uid="+h((n=e.myPlex,n=null==n||n===!1?n:n.queueUid,typeof n===u?n.apply(e):n))+"';var h=document.getElementsByTagName('head')[0];h.appendChild(s);void(0);\">❯ ",a={hash:{},data:t},s+=h((n=i.t||e.t,n?n.call(e,"Plex It!",a):d.call(e,"t","Plex It!",a)))+'</a>\n	</p>\n\n	<ol class="muted">\n		<li>',a={hash:{},data:t},s+=h((n=i.t||e.t,n?n.call(e,"Drag the link above to your bookmarks bar.",a):d.call(e,"t","Drag the link above to your bookmarks bar.",a)))+"</li>\n		<li>",a={hash:{},data:t},s+=h((n=i.t||e.t,n?n.call(e,"To save a video to your queue, click “❯ Plex It!” in your Bookmarks Bar so you can watch it later.",a):d.call(e,"t","To save a video to your queue, click “❯ Plex It!” in your Bookmarks Bar so you can watch it later.",a)))+"</li>\n		<li>",a={hash:{},data:t},s+=h((n=i.t||e.t,n?n.call(e,"A panel will appear on the left side of the page to let you know the video has been saved.",a):d.call(e,"t","A panel will appear on the left side of the page to let you know the video has been saved.",a)))+'</li>\n	</ol>\n\n	<h3 class="setup-section-subtitle">',a={hash:{},data:t},s+=h((n=i.t||e.t,n?n.call(e,"Or send videos to your queue by email",a):d.call(e,"t","Or send videos to your queue by email",a)))+'</h3>\n\n	<p class="queue-email">\n		<a class="well" href="mailto:'+h((n=e.myPlex,n=null==n||n===!1?n:n.queueEmail,typeof n===u?n.apply(e):n))+'">'+h((n=e.myPlex,n=null==n||n===!1?n:n.queueEmail,typeof n===u?n.apply(e):n))+'</a>\n	</p>\n\n	<p class="muted">',a={hash:{},data:t},s+=h((n=i.t||e.t,n?n.call(e,"Every link that you email to this address will be added to your myPlex queue. Add it to your address book so you can easily email links from your iPhone, iPad, Android, or any other device.",a):d.call(e,"t","Every link that you email to this address will be added to your myPlex queue. Add it to your address book so you can easily email links from your iPhone, iPad, Android, or any other device.",a)))+"</p>\n"
}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var r,l,o,c="",d=i.helperMissing,h=this.escapeExpression,u="function",p=this;return c+='<h2 class="setup-section-title">',o={hash:{},data:a},c+=h((r=i.t||t.t,r?r.call(t,"Congratulations!",o):d.call(t,"t","Congratulations!",o)))+'</h2>\n\n<p class="muted">',o={hash:{},data:a},c+=h((r=i.t||t.t,r?r.call(t,"See, that wasn't too bad, right? At this very moment, Plex is working tirelessly to build your library, and make it look beautiful. Like, there are at least a dozen mice on spinny wheels inside your computer, all peddling furiously.",o):d.call(t,"t","See, that wasn't too bad, right? At this very moment, Plex is working tirelessly to build your library, and make it look beautiful. Like, there are at least a dozen mice on spinny wheels inside your computer, all peddling furiously.",o)))+'</p>\n\n<p class="muted">',o={hash:{},data:a},c+=h((r=i.t||t.t,r?r.call(t,"Feel free to watch Plex work, or take this opportunity to <a href='{1}' target='_blank'>download</a> some Plex apps!","http://www.plexapp.com/getplex/index.php#apps",o):d.call(t,"t","Feel free to watch Plex work, or take this opportunity to <a href='{1}' target='_blank'>download</a> some Plex apps!","http://www.plexapp.com/getplex/index.php#apps",o)))+"</p>\n\n",l=i["if"].call(t,(r=t.myPlex,null==r||r===!1?r:r.signedIn),{hash:{},inverse:p.noop,fn:p.program(1,s,a),data:a}),(l||0===l)&&(c+=l),c+='\n\n<div class="form-actions pull-center">\n	<a class="next-btn btn btn-primary btn-large" href="#!/dashboard">',o={hash:{},data:a},c+=h((r=i.t||t.t,r?r.call(t,"Done",o):d.call(t,"t","Done",o)))+"</i></a>\n</div>\n"
})}),define("plex/desktop/view/setup/SetupCompleteView",["hb!templates/desktop/setup/SetupCompleteView.tpl","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel","plex/base/view/BaseView"],function(e,t,i,n){var a=n.extend({events:{"click .queue-bookmarklet-btn":"onBookmarkletClick"},render:function(){return this.$el.html(e({server:this.model.toJSON(),myPlex:i.get("myPlex").toJSON()})),this},onBookmarkletClick:function(e){e.preventDefault(),i.set("alert",{message:t.t("Drag ❯ Plex It! to your bookmarks.")})
}});return a}),define("plex/desktop/view/setup/SetupView",["hb!templates/desktop/setup/SetupView.tpl","plex/base/control/Dispatcher","plex/base/model/collections/AgentCollection","plex/base/view/BaseView","plex/desktop/view/setup/SetupIntroView","plex/desktop/view/setup/SetupServerView","plex/desktop/view/setup/SetupMyPlexView","plex/desktop/view/setup/SetupLibraryView","plex/desktop/view/setup/SetupChannelsView","plex/desktop/view/setup/SetupCompleteView","jquery","spin"],function(e,t,i,n,a,s,r,l,o,c,d){var h=n.extend({className:"setup-container container",currentView:"intro",views:{intro:null,setup:null,library:null,channels:null,myplex:null,complete:null},events:{"click .change-view-btn":"onChangeViewClick","click .skip-btn":"onSkipClick"},initialize:function(){this.views.intro=this.registerView(new a({model:this.model})),this.views.setup=this.registerView(new s({model:this.model})),this.views.library=this.registerView(new l({model:this.model})),this.views.channels=this.registerView(new o({model:this.model})),this.views.myplex=this.registerView(new r({model:this.model})),this.views.complete=this.registerView(new c({model:this.model})),this.addBinding(this.views.setup,"view:change",this.onViewChange),this.addBinding(this.views.library,"view:change",this.onViewChange),this.addBinding(this.views.channels,"view:change",this.onViewChange),this.addBinding(this.views.myplex,"view:change",this.onViewChange),this.currentView="intro",this.starting=!0,this.model.populate({hideLoadingAlert:!0}).done(_.bind(this.start,this))
},render:function(){if(this.$el.html(e({starting:this.starting})),this.starting)this.$(".spinner-container").spinContents("large","#777");else{this.$(".spinner-container").spinContents(!1);var t=this.views[this.currentView];this.$(".setup-inner-container").html(t.render().el),t.delegateEvents(),this.updateProgress()}return this},start:function(){if(this.model.get("startState"))this.model.fetch({hideLoadingAlert:!0}).done(_.delay(_.bind(this.start,this),500));else{var e=_.bind(function(){this.starting=!1,this.render()
},this),n=_.bind(function(i){var n=!0,a=["com.plexapp.agents.imdb","com.plexapp.agents.thetvdb","com.plexapp.agents.lastfm"];if(_.each(a,function(e){i.get(e)&&(n=!1)}),n)this.$(".setup-starting-container").addClass("hide"),this.$(".setup-error-container").removeClass("hide");else{var s={server:this.model,silent:!0};t.trigger("command:UpdateChannel",s,e)}},this),a=_.bind(function(){_.delay(_.bind(this.start,this),500)}),s=new i([],{server:this.model});s.fetch({hideLoadingAlert:!0}).done(n).fail(a)
}},changeView:function(e){this.currentView!==e&&(this.currentView=e,this.render(),this.$el.parent().scrollTop(0))},updateProgress:function(){var e,t=this.$("."+this.currentView+"-segment"),i=!1;t.length&&(e=t[0]),d(".setup-progress-segment").each(function(){var t=d(this);i?t.removeClass("active complete"):t.addClass("active complete"),this===e&&(i=!0,t.removeClass("complete"))})},onViewChange:function(e){this.changeView(e)},onChangeViewClick:function(e){e.preventDefault(),this.changeView(d(e.target).data("view"))
},onSkipClick:function(e){e.preventDefault();var i=this.model.get("preferences"),n=i.first();this.model.supports("firstRunPref")&&n.save({FirstRun:0}),t.trigger("navigate:dashboard")}});return h}),define("hb!templates/desktop/myplex/FriendsView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n;return(n=i.requestsCount)?n=n.call(e,{hash:{},data:t}):(n=e.requestsCount,n=typeof n===u?n.apply(e):n),p(n)}function r(e,t){var n;return(n=i.friendsCount)?n=n.call(e,{hash:{},data:t}):(n=e.friendsCount,n=typeof n===u?n.apply(e):n),p(n)
}function l(){return"hide"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var o,c,d,h="",u="function",p=this.escapeExpression,f=i.helperMissing,m=this;return h+='<div id="requests-container" class="well hide">\n	<div class="well-header">\n		<h3>',d={hash:{},data:a},h+=p((o=i.t||t.t,o?o.call(t,"Invites",d):f.call(t,"t","Invites",d)))+' <span class="well-header-count">',c=i["if"].call(t,t.requestsCount,{hash:{},inverse:m.noop,fn:m.program(1,s,a),data:a}),(c||0===c)&&(h+=c),h+='</span></h3>\n	</div>\n\n	<div class="row-fluid">\n		<span id="received-requests-container" class="requests-column span6 hide"></span>\n		<span id="sent-requests-container" class="requests-column span6 hide"></span>\n	</div>\n</div>\n\n<div id="friends-container" class="well">\n	<div class="well-header">\n		<ul class="well-header-actions">\n			<li>\n				<form class="add-friend-form">\n					<input id="add-friend-username" type="text" class="input-dark" placeholder="',d={hash:{},data:a},h+=p((o=i.t||t.t,o?o.call(t,"username or email",d):f.call(t,"t","username or email",d)))+'"> <button type="submit" class="btn btn-small btn-primary" rel="tooltip" title="',d={hash:{},data:a},h+=p((o=i.t||t.t,o?o.call(t,"Add Friend",d):f.call(t,"t","Add Friend",d)))+'"><i class="glyphicon user-add"></i> ',d={hash:{},data:a},h+=p((o=i.t||t.t,o?o.call(t,"Send Invite",d):f.call(t,"t","Send Invite",d)))+"</button>\n				</form>\n			</li>\n		</ul>\n\n		<h3>",d={hash:{},data:a},h+=p((o=i.t||t.t,o?o.call(t,"Friends",d):f.call(t,"t","Friends",d)))+' <span class="well-header-count">',c=i["if"].call(t,t.friendsCount,{hash:{},inverse:m.noop,fn:m.program(3,r,a),data:a}),(c||0===c)&&(h+=c),h+='</span></h3>\n	</div>\n\n	<div class="friends-empty-message empty-message ',c=i["if"].call(t,t.friendsCount,{hash:{},inverse:m.noop,fn:m.program(5,l,a),data:a}),(c||0===c)&&(h+=c),h+='">',d={hash:{},data:a},h+=p((o=i.t||t.t,o?o.call(t,"No friends :(",d):f.call(t,"t","No friends :(",d)))+"</div>\n</div>\n"
})}),define("plex/desktop/view/myplex/FriendsView",["hb!templates/desktop/myplex/FriendsView.tpl","plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel","plex/base/model/FriendModel","plex/base/model/collections/FriendCollection","plex/base/view/BaseView","plex/desktop/view/myplex/MyPlexNavView","plex/desktop/view/lists/myplex/FriendList"],function(e,t,i,n,a,s,r,l,o){var c=r.extend({className:"container",subnav:null,friendsList:null,requestsList:null,requestedList:null,requestsLength:0,requestedLength:0,events:{"submit .add-friend-form":"onAddFriendSubmit"},initialize:function(e){var t=new s([],{server:n.get("myPlex"),type:"requested"});
this.subnav=this.registerView(new l({active:"friends"})),this.friendsList=this.registerView(new o({collection:this.collection})),this.requestsList=this.registerView(new o({collection:e.requests,type:"requests"})),this.requestedList=this.registerView(new o({collection:t,type:"requested"})),this.addBinding(this.friendsList,"refresh",this.onListRefresh),this.addBinding(this.requestsList,"refresh",this.onListRefresh),this.addBinding(this.requestedList,"refresh",this.onListRefresh),this.addBinding(this.collection,"reset",this.onFriendsReset),this.addBinding(e.requests,"reset",this.onRequestsReset),this.addBinding(t,"reset",this.onRequestedReset),e.requests.fetch(),t.fetch()
},render:function(){return this.$el.html(e({requestsCount:this.requestsList.collection.length+this.requestedList.collection.length,friendsCount:this.friendsList.collection.length})),this.$el.prepend(this.subnav.render().el),this.$("#received-requests-container").append(this.requestsList.render().el),this.$("#sent-requests-container").append(this.requestedList.render().el),this.$("#friends-container").append(this.friendsList.render().el),this.$el.tooltip({selector:".btn-icon",placement:"bottom"}),this
},onListRefresh:function(){this.friendsList.collection.fetch({hideLoadingAlert:!0}),this.requestsList.collection.fetch({hideLoadingAlert:!0}),this.requestedList.collection.fetch({hideLoadingAlert:!0})},onFriendsReset:function(e){e.length?(this.$("#friends-container .well-header-count").text(e.length),this.$(".friends-empty-message").addClass("hide")):(this.$("#friends-container .well-header-count").text(""),this.$(".friends-empty-message").removeClass("hide"))},onRequestsReset:function(e){this.requestsLength=e.length,this.$("#requests-container .well-header-count").text(e.length+this.requestedLength),this.requestsLength?(this.$("#received-requests-container").removeClass("hide"),this.$("#requests-container").removeClass("hide")):(this.$("#received-requests-container").addClass("hide"),this.requestedLength||this.$("#requests-container").addClass("hide"))
},onRequestedReset:function(e){this.requestedLength=e.length,this.$("#requests-container .well-header-count").text(e.length+this.requestsLength),this.requestedLength?(this.$("#sent-requests-container").removeClass("hide"),this.$("#requests-container").removeClass("hide")):(this.$("#sent-requests-container").addClass("hide"),this.requestsLength||this.$("#requests-container").addClass("hide"))},onAddFriendSubmit:function(e){e.preventDefault();var s=this.$("#add-friend-username"),r=this.$(".add-friend-form > input[type=submit]"),l=s.val();
if(l){r.addClass("disabled"),t.trigger("command:ShowLoading",!0);var o=new a({},{server:n.get("myPlex")});o.save({user:l}).always(_.bind(function(){r.removeClass("disabled"),t.trigger("command:ShowLoading",!1)})).done(_.bind(function(){this.requestedList.collection.fetch({hideLoadingAlert:!0}),s.val("")},this)).fail(_.bind(function(){n.set("alert",{status:"error",message:i.t("There was a problem adding {1} as a friend.",l)})}))}}});return c}),define("hb!templates/desktop/server/NotificationsView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return"disabled"
}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var r,l,o,c="",d="function",h=this.escapeExpression,u=i.helperMissing,p=this;return c+='<div id="notifications-container" class="well">\n	<div class="minimal-well-header">\n		<ul class="well-header-actions">\n			<li class="well-header-pagination">\n				<span class="page">',(r=i.page)?r=r.call(t,{hash:{},data:a}):(r=t.page,r=typeof r===d?r.apply(t):r),c+=h(r)+"</span> ",o={hash:{},data:a},c+=h((r=i.t||t.t,r?r.call(t,"of",o):u.call(t,"t","of",o)))+' <span class="pages">',(l=i.pages)?l=l.call(t,{hash:{},data:a}):(l=t.pages,l=typeof l===d?l.apply(t):l),c+=h(l)+'</span>\n			</li>\n			<li>\n				<div class="btn-group btn-group-inverse">\n					<button type="button" class="previous-btn btn btn-inverse btn-icon disabled"><i class="glyphicon chevron-left"></i></button>\n					<button type="button" class="next-btn btn btn-inverse btn-icon ',l=i.unless.call(t,t.showNext,{hash:{},inverse:p.noop,fn:p.program(1,s,a),data:a}),(l||0===l)&&(c+=l),c+='"><i class="glyphicon chevron-right"></i></button>\n				</div>\n			</li>\n		</ul>\n\n		<span class="muted">',o={hash:{},data:a},c+=h((r=i.t||t.t,r?r.call(t,"Since",o):u.call(t,"t","Since",o)))+" ",o={hash:{},data:a},c+=h((r=i.formatDateCustom||t.formatDateCustom,r?r.call(t,t.startTime,"LT",o):u.call(t,"formatDateCustom",t.startTime,"LT",o)))+"</span>\n	</div>\n</div>\n"
})}),define("hb!templates/desktop/server/ActivityNavView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a,s="";return s+="\n				",a={hash:{},data:t},s+=m((n=i.t||e.t,n?n.call(e,(n=e.server,null==n||n===!1?n:n.friendlyName),20,a):f.call(e,"t",(n=e.server,null==n||n===!1?n:n.friendlyName),20,a)))+"\n			"}function r(e,t){var n,a,s="";return s+="\n				",a={hash:{},data:t},s+=m((n=i.t||e.t,n?n.call(e,(n=e.server,null==n||n===!1?n:n.name),20,a):f.call(e,"t",(n=e.server,null==n||n===!1?n:n.name),20,a)))+"\n			"
}function l(){return"active"}function o(e,t){var n,a,s,r="";return r+='\n		<li><a class="gray ',s={hash:{},inverse:g.noop,fn:g.program(5,l,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,e.active,"sync",s):f.call(e,"if_eq",e.active,"sync",s),(a||0===a)&&(r+=a),r+='" href="#!/sync">',s={hash:{},data:t},r+=m((n=i.t||e.t,n?n.call(e,"Sync Status",s):f.call(e,"t","Sync Status",s)))+"</a></li>\n	"}function c(e,t){var n,a,s,r="";return r+='\n		<li><a class="gray ',s={hash:{},inverse:g.noop,fn:g.program(5,l,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,e.active,"nowplaying",s):f.call(e,"if_eq",e.active,"nowplaying",s),(a||0===a)&&(r+=a),r+='" href="#!/nowplaying">',s={hash:{},data:t},r+=m((n=i.t||e.t,n?n.call(e,"Now Playing",s):f.call(e,"t","Now Playing",s)))+"</a></li>\n	"
}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var d,h,u,p="",f=i.helperMissing,m=this.escapeExpression,g=this;return p+='<ul class="subnav-actions">\n	<li>\n		<span class="subnav-action-label source-title">\n			',h=i["if"].call(t,(d=t.server,null==d||d===!1?d:d.friendlyName),{hash:{},inverse:g.program(3,r,a),fn:g.program(1,s,a),data:a}),(h||0===h)&&(p+=h),p+='\n		</span>\n	</li>\n</ul>\n\n<ul class="subnav-list">\n	<li><i class="subnav-icon glyphicon cardio"></i></li>\n\n	<li><a class="gray ',u={hash:{},inverse:g.noop,fn:g.program(5,l,a),data:a},d=i.if_eq||t.if_eq,h=d?d.call(t,t.active,"notifications",u):f.call(t,"if_eq",t.active,"notifications",u),(h||0===h)&&(p+=h),p+='" href="#!/notifications">',u={hash:{},data:a},p+=m((d=i.t||t.t,d?d.call(t,"Notifications",u):f.call(t,"t","Notifications",u)))+"</a></li>\n\n	",h=i["if"].call(t,t.showSync,{hash:{},inverse:g.noop,fn:g.program(7,o,a),data:a}),(h||0===h)&&(p+=h),p+="\n\n	",h=i["if"].call(t,t.showNowPlaying,{hash:{},inverse:g.noop,fn:g.program(9,c,a),data:a}),(h||0===h)&&(p+=h),p+="\n</ul>\n"
})}),define("plex/desktop/view/server/ActivityNavView",["hb!templates/desktop/server/ActivityNavView.tpl","plex/base/control/Dispatcher","plex/base/model/AppModel","plex/base/view/BaseView"],function(e,t,i,n){var a=n.extend({className:"subnav-container",active:null,initialize:function(e){this.active=e.active;var t=i.get("myPlex");this.addBinding(t.get("devices"),"reset",this.render),this.addBinding(i,"change:primaryServer",this.onPrimaryServerChange)},render:function(){var i=this.showSync(),n=this.showNowPlaying();
return(!i&&"sync"===this.active||!n&&"nowplaying"===this.active)&&_.defer(function(){t.trigger("navigate:notifications")}),this.$el.html(e({active:this.active,showSync:i,showNowPlaying:n,server:this.model.toJSON()})),this},showSync:function(){var e=i.get("myPlex"),t=e.get("devices").getSyncDevices();return this.model.supports("sync")&&t.length&&e.hasSync()?!0:!1},showNowPlaying:function(){var e=i.get("myPlex"),t=this.model.get("multiuser")&&e.hasPlexPass();return t},onPrimaryServerChange:function(e,i){t.trigger("navigate:"+this.active,{serverID:i.id})
}});return a}),define("hb!templates/desktop/lists/server/items/ServerEventListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return'\n	<i class="server-event-icon glyphicon settings"></i>\n'}function r(e,t){var n,a,s;return s={hash:{},inverse:U.program(6,o,t),fn:U.program(4,l,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,(n=e.event,null==n||n===!1?n:n._type),"status",s):H.call(e,"if_eq",(n=e.event,null==n||n===!1?n:n._type),"status",s),a||0===a?a:""}function l(){return'\n	<i class="server-event-icon glyphicon bullhorn"></i>\n'
}function o(e,t){var n,a,s;return s={hash:{},inverse:U.program(9,d,t),fn:U.program(7,c,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,(n=e.event,null==n||n===!1?n:n._type),"playing",s):H.call(e,"if_eq",(n=e.event,null==n||n===!1?n:n._type),"playing",s),a||0===a?a:""}function c(){return'\n	<i class="server-event-icon glyphicon imac"></i>\n'}function d(e,t){var n,a,s;return s={hash:{},inverse:U.program(15,f,t),fn:U.program(10,h,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,(n=e.event,null==n||n===!1?n:n._type),"websocket",s):H.call(e,"if_eq",(n=e.event,null==n||n===!1?n:n._type),"websocket",s),a||0===a?a:""
}function h(e,t){var n,a,s="";return s+="\n	",a=i["if"].call(e,(n=e.event,null==n||n===!1?n:n.opened),{hash:{},inverse:U.program(13,p,t),fn:U.program(11,u,t),data:t}),(a||0===a)&&(s+=a),s+="\n"}function u(){return'\n		<i class="server-event-icon glyphicon bullhorn"></i>\n	'}function p(){return'\n		<i class="server-event-icon glyphicon warning-sign"></i>\n	'}function f(e,t){var n,a,s;return s={hash:{},inverse:U.program(18,g,t),fn:U.program(16,m,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,(n=e.event,null==n||n===!1?n:n.state),0,s):H.call(e,"if_eq",(n=e.event,null==n||n===!1?n:n.state),0,s),a||0===a?a:""
}function m(){return'\n	<i class="server-event-icon glyphicon plus"></i>\n'}function g(e,t){var n,a,s;return s={hash:{},inverse:U.program(21,y,t),fn:U.program(19,v,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,(n=e.event,null==n||n===!1?n:n.state),5,s):H.call(e,"if_eq",(n=e.event,null==n||n===!1?n:n.state),5,s),a||0===a?a:""}function v(){return'\n	<i class="server-event-icon glyphicon ok-2"></i>\n'}function y(e,t){var n,a,s;return s={hash:{},inverse:U.program(24,w,t),fn:U.program(22,b,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,(n=e.event,null==n||n===!1?n:n.state),6,s):H.call(e,"if_eq",(n=e.event,null==n||n===!1?n:n.state),6,s),a||0===a?a:""
}function b(){return'\n	<i class="server-event-icon glyphicon magic"></i>\n'}function w(e,t){var n,a,s;return s={hash:{},inverse:U.program(27,k,t),fn:U.program(25,x,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,(n=e.event,null==n||n===!1?n:n.state),9,s):H.call(e,"if_eq",(n=e.event,null==n||n===!1?n:n.state),9,s),a||0===a?a:""}function x(){return'\n	<i class="server-event-icon glyphicon ban"></i>\n'}function k(){return'\n	<i class="server-event-icon glyphicon cogwheels"></i>\n'}function S(e,t){var n,a,s="";
return s+="\n	",a={hash:{},data:t},s+=z((n=i.t||e.t,n?n.call(e,"Preference {1} set to {2}.",(n=e.event,null==n||n===!1?n:n.label),(n=e.event,null==n||n===!1?n:n.value),a):H.call(e,"t","Preference {1} set to {2}.",(n=e.event,null==n||n===!1?n:n.label),(n=e.event,null==n||n===!1?n:n.value),a)))+"\n"}function C(e,t){var n,a,s;return s={hash:{},inverse:U.program(38,M,t),fn:U.program(32,_,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,(n=e.event,null==n||n===!1?n:n._type),"status",s):H.call(e,"if_eq",(n=e.event,null==n||n===!1?n:n._type),"status",s),a||0===a?a:""
}function _(e,t){var n,a,s="";return s+="\n	",a=i["if"].call(e,(n=e.event,null==n||n===!1?n:n.message),{hash:{},inverse:U.program(35,I,t),fn:U.program(33,A,t),data:t}),(a||0===a)&&(s+=a),s+="\n"}function A(e,t){var n,a,s="";return s+="\n		",a={hash:{},data:t},s+=z((n=i.t||e.t,n?n.call(e,(n=e.event,null==n||n===!1?n:n.message),a):H.call(e,"t",(n=e.event,null==n||n===!1?n:n.message),a)))+"\n	"}function I(e,t){var n,a,s,r="";return r+="\n		",s={hash:{},data:t},r+=z((n=i.t||e.t,n?n.call(e,(n=e.event,null==n||n===!1?n:n.title),s):H.call(e,"t",(n=e.event,null==n||n===!1?n:n.title),s))),a=i["if"].call(e,(n=e.event,null==n||n===!1?n:n.description),{hash:{},inverse:U.noop,fn:U.program(36,T,t),data:t}),(a||0===a)&&(r+=a),r+="\n	"
}function T(e,t){var n,a,s="";return s+=": ",a={hash:{},data:t},s+=z((n=i.t||e.t,n?n.call(e,(n=e.event,null==n||n===!1?n:n.description),a):H.call(e,"t",(n=e.event,null==n||n===!1?n:n.description),a)))}function M(e,t){var n,a,s;return s={hash:{},inverse:U.program(41,D,t),fn:U.program(39,P,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,(n=e.event,null==n||n===!1?n:n._type),"timeline",s):H.call(e,"if_eq",(n=e.event,null==n||n===!1?n:n._type),"timeline",s),a||0===a?a:""}function P(e,t){var n,a,s,r="";return r+="\n	",s={hash:{},data:t},r+=z((n=i.t||e.t,n?n.call(e,(n=e.event,null==n||n===!1?n:n.stateString),s):H.call(e,"t",(n=e.event,null==n||n===!1?n:n.stateString),s)))+'\n	<a href="#!/servers/',(a=i.serverID)?a=a.call(e,{hash:{},data:t}):(a=e.serverID,a=typeof a===W?a.apply(e):a),r+=z(a)+"/sections/"+z((n=e.event,n=null==n||n===!1?n:n.sectionID,typeof n===W?n.apply(e):n))+"/details/"+z((n=e.event,n=null==n||n===!1?n:n.itemID,typeof n===W?n.apply(e):n))+'">'+z((n=e.event,n=null==n||n===!1?n:n.mediaTitle,typeof n===W?n.apply(e):n))+"</a>\n	",s={hash:{},data:t},r+=z((n=i.t||e.t,n?n.call(e,"in",s):H.call(e,"t","in",s)))+'\n	<a href="#!/servers/',(a=i.serverID)?a=a.call(e,{hash:{},data:t}):(a=e.serverID,a=typeof a===W?a.apply(e):a),r+=z(a)+"/sections/"+z((n=e.event,n=null==n||n===!1?n:n.sectionID,typeof n===W?n.apply(e):n))+'">'+z((n=e.event,n=null==n||n===!1?n:n.sectionTitle,typeof n===W?n.apply(e):n))+"</a>\n"
}function D(e,t){var n,a,s;return s={hash:{},inverse:U.program(44,E,t),fn:U.program(42,L,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,(n=e.event,null==n||n===!1?n:n._type),"playing",s):H.call(e,"if_eq",(n=e.event,null==n||n===!1?n:n._type),"playing",s),a||0===a?a:""}function L(e,t){var n,a,s="";return s+="\n	",a={hash:{},data:t},s+=z((n=i.t||e.t,n?n.call(e,"{1} started watching {2} on {3}.",(n=e.event,null==n||n===!1?n:n.username),(n=e.event,null==n||n===!1?n:n.title),(n=e.event,null==n||n===!1?n:n.device),a):H.call(e,"t","{1} started watching {2} on {3}.",(n=e.event,null==n||n===!1?n:n.username),(n=e.event,null==n||n===!1?n:n.title),(n=e.event,null==n||n===!1?n:n.device),a)))+"\n"
}function E(e,t){var n,a,s;return s={hash:{},inverse:U.noop,fn:U.program(45,N,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,(n=e.event,null==n||n===!1?n:n._type),"websocket",s):H.call(e,"if_eq",(n=e.event,null==n||n===!1?n:n._type),"websocket",s),a||0===a?a:""}function N(e,t){var n,a,s="";return s+="\n	",a=i["if"].call(e,(n=e.event,null==n||n===!1?n:n.opened),{hash:{},inverse:U.program(48,R,t),fn:U.program(46,O,t),data:t}),(a||0===a)&&(s+=a),s+="\n"}function O(e,t){var n,a,s="";return s+="\n		",a={hash:{},data:t},s+=z((n=i.t||e.t,n?n.call(e,"Opened connection to {1}, listening for events.",e.serverName,a):H.call(e,"t","Opened connection to {1}, listening for events.",e.serverName,a)))+"\n	"
}function R(e,t){var n,a;return a=i["if"].call(e,(n=e.event,null==n||n===!1?n:n.closed),{hash:{},inverse:U.program(51,$,t),fn:U.program(49,B,t),data:t}),a||0===a?a:""}function B(e,t){var n,a,s="";return s+="\n		",a={hash:{},data:t},s+=z((n=i.t||e.t,n?n.call(e,"Connection to {1} closed.",e.serverName,a):H.call(e,"t","Connection to {1} closed.",e.serverName,a)))+"\n	"}function $(e,t){var n,a,s="";return s+="\n		",a={hash:{},data:t},s+=z((n=i.t||e.t,n?n.call(e,"Unable to listen for events on {1}.",e.serverName,a):H.call(e,"t","Unable to listen for events on {1}.",e.serverName,a)))+"\n	"
}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var q,V,j,F="",U=this,H=i.helperMissing,z=this.escapeExpression,W="function";return j={hash:{},inverse:U.program(3,r,a),fn:U.program(1,s,a),data:a},q=i.if_eq||t.if_eq,V=q?q.call(t,(q=t.event,null==q||q===!1?q:q._type),"preference",j):H.call(t,"if_eq",(q=t.event,null==q||q===!1?q:q._type),"preference",j),(V||0===V)&&(F+=V),F+='\n\n<div class="server-event-details">\n<span class="server-event-time">',j={hash:{},data:a},F+=z((q=i.formatDateCustom||t.formatDateCustom,q?q.call(t,(q=t.event,null==q||q===!1?q:q.time),"LT",j):H.call(t,"formatDateCustom",(q=t.event,null==q||q===!1?q:q.time),"LT",j)))+"</span>\n",j={hash:{},inverse:U.program(31,C,a),fn:U.program(29,S,a),data:a},q=i.if_eq||t.if_eq,V=q?q.call(t,(q=t.event,null==q||q===!1?q:q._type),"preference",j):H.call(t,"if_eq",(q=t.event,null==q||q===!1?q:q._type),"preference",j),(V||0===V)&&(F+=V),F+="\n</div>\n"
})}),define("plex/desktop/view/lists/server/items/ServerEventListItem",["hb!templates/desktop/lists/server/items/ServerEventListItem.tpl","plex/base/view/BaseView"],function(e,t){var i=t.extend({tagName:"li",className:"server-event-list-item",render:function(){var t={serverID:this.model.server.id,serverName:this.model.server.get("friendlyName"),event:this.model.toJSON()};if("timeline"==this.model.get("_type"))switch(t.event.sectionTitle=this.model.get("section")?this.model.get("section").get("title"):"section "+this.model.get("sectionID"),t.event.mediaTitle=this.model.get("title")||"item "+this.model.get("itemID"),this.model.get("state")){case 0:t.event.stateString="Created";
break;case 1:t.event.stateString="Progress for";break;case 2:t.event.stateString="Matching";break;case 3:t.event.stateString="Downloading metadata for";break;case 4:t.event.stateString="Loading metadata for";break;case 5:t.event.stateString="Finished processing";break;case 6:t.event.stateString="Analyzing";break;case 9:t.event.stateString="Deleted"}return this.$el.html(e(t)),this}});return i}),define("plex/desktop/view/lists/server/ServerEventList",["plex/base/view/lists/BaseList","plex/desktop/view/lists/server/items/ServerEventListItem"],function(e,t){var i=e.extend({tagName:"ul",className:"list server-event-list",reverseItems:!0,initialize:function(){this.setup(t)
},setup:function(e,t){this.items={},this.ListItem=e,this.selector=t,this.collection&&this.addBinding(this.collection,"reset",this.reset)},render:function(){return this.$el.empty(),this.populate(this.collection),this},rebase:function(e){this.collection&&this.removeBinding(this.collection,"reset"),this.collection=e,this.addBinding(e,"reset",this.reset),this.reset(e)}});return i}),define("plex/desktop/view/server/NotificationsView",["hb!templates/desktop/server/NotificationsView.tpl","plex/base/model/collections/ServerEventCollection","plex/base/view/BaseView","plex/desktop/view/server/ActivityNavView","plex/desktop/view/lists/server/ServerEventList"],function(e,t,i,n,a){var s=i.extend({className:"container",subnav:null,page:1,listItems:null,list:null,events:{"click .previous-btn":"onPreviousClick","click .next-btn":"onNextClick"},initialize:function(){var e=this.model.get("timeline");
this.listItems=new t(e.page(this.page,!0),{server:this.model}),this.subnav=this.registerView(new n({model:this.model,active:"notifications"})),this.list=this.registerView(new a({collection:this.listItems})),this.addBinding(e,"add",_.throttle(function(e,t){this.updatePaginationControls(),this.listItems.reset(t.page(this.page,!0))},1e3))},render:function(){var t=this.model.get("timeline"),i=t.pages();return this.$el.html(e({startTime:t.startTime,count:t.length,page:this.page,pages:i,showNext:i>1})),this.$el.prepend(this.subnav.render().el),this.$("#notifications-container").append(this.list.render().el),this
},updatePaginationControls:function(){var e=this.model.get("timeline"),t=e.pages();this.page>1?this.$(".previous-btn").removeClass("disabled"):this.$(".previous-btn").addClass("disabled"),t>this.page?this.$(".next-btn").removeClass("disabled"):this.$(".next-btn").addClass("disabled"),this.$(".page").text(this.page),this.$(".pages").text(t)},onPreviousClick:function(e){e.preventDefault();var t=this.model.get("timeline");this.page>1&&(this.page--,this.updatePaginationControls(),this.listItems.reset(t.page(this.page,!0)))
},onNextClick:function(e){e.preventDefault();var t=this.model.get("timeline");this.page<t.pages()&&(this.page++,this.updatePaginationControls(),this.listItems.reset(t.page(this.page,!0)))}});return s}),define("hb!templates/desktop/server/SyncStatusView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var s,r,l="",o=i.helperMissing,c=this.escapeExpression;return l+='<div id="sync-status-container" class="well">\n	<div class="minimal-well-header">\n		<ul class="well-header-actions">\n			<li><button type="button" class="edit-btn btn btn-inverse btn-icon" rel="tooltip" title="',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Edit",r):o.call(t,"t","Edit",r)))+'"><i class="glyphicon pencil"></i></button></li>\n			<li><button type="button" class="refresh-btn btn btn-inverse btn-icon" rel="tooltip" title="',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Refresh",r):o.call(t,"t","Refresh",r)))+'"><i class="glyphicon repeat"></i></button></li>\n		</ul>\n	</div>\n</div>\n'
})}),define("hb!templates/desktop/lists/server/items/SyncDeviceListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return"ipad"}function r(e,t){var n;return n=i["if"].call(e,e.cloud,{hash:{},inverse:m.program(6,o,t),fn:m.program(4,l,t),data:t}),n||0===n?n:""}function l(){return"cloud"}function o(){return"iphone"}function c(e){var t;return v((t=e.device,t=null==t||t===!1?t:t.name,typeof t===g?t.apply(e):t))}function d(e){var t;return v((t=e.device,t=null==t||t===!1?t:t.device,typeof t===g?t.apply(e):t))
}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var h,u,p,f="",m=this,g="function",v=this.escapeExpression,y=i.helperMissing;return f+='<h3><i class="glyphicon ',h=i["if"].call(t,t.tablet,{hash:{},inverse:m.program(3,r,a),fn:m.program(1,s,a),data:a}),(h||0===h)&&(f+=h),f+='"></i> ',u=i["if"].call(t,(h=t.device,null==h||h===!1?h:h.name),{hash:{},inverse:m.program(10,d,a),fn:m.program(8,c,a),data:a}),(u||0===u)&&(f+=u),f+='</h3>\n\n<p class="empty-message hide">',p={hash:{},data:a},f+=v((h=i.t||t.t,h?h.call(t,"Nothing is synced to this device.",p):y.call(t,"t","Nothing is synced to this device.",p)))+"</p>\n"
})}),define("hb!templates/desktop/lists/server/items/SyncItemTileListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return"cloud-download"}function r(){return"circle-arrow-down"}function l(){return"hide"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var o,c="",d=this;return c+='<a href="#">\n	<div class="poster-container">\n		<div class="poster-card">\n			<div class="poster-face front">\n				<div class="sync-status">\n					<div class="sync-status-transcode hide">\n						<canvas class="circle-progress-bar" width="54" height="54"></canvas>\n						<div class="sync-speed"></div>\n					</div>\n\n					<i class="sync-status-icon sync-complete-icon glyphicon ok-2 hide"></i>\n					<i class="sync-status-icon sync-waiting-icon glyphicon ',o=i["if"].call(t,t.cloudsync,{hash:{},inverse:d.program(3,r,a),fn:d.program(1,s,a),data:a}),(o||0===o)&&(c+=o),c+=' hide"></i>\n					<i class="sync-status-icon sync-processing-icon glyphicon more hide"></i>\n					<i class="sync-status-icon sync-failed-icon glyphicon warning-sign ',o=i.unless.call(t,t.failed,{hash:{},inverse:d.noop,fn:d.program(5,l,a),data:a}),(o||0===o)&&(c+=o),c+='"></i>\n					<i class="sync-status-icon sync-unknown-icon glyphicon circle-question-mark ',o=i["if"].call(t,t.failed,{hash:{},inverse:d.noop,fn:d.program(5,l,a),data:a}),(o||0===o)&&(c+=o),c+='"></i>\n				</div>\n\n				<div class="hover-overlay card-overlay">\n					<button type="button" class="hover-menu-btn poster-edit-btn" tabindex="-1"><i class="glyphicon pencil"></i></button><button type="button" class="hover-menu-btn hover-menu-btn-danger poster-delete-btn" tabindex="-1"><i class="glyphicon ban"></i></button>\n				</div>\n			</div>\n		</div>\n	</div>\n\n	<div class="poster-title"></div>\n	<div class="poster-subtitle"></div>\n	<div class="sync-time-remaining poster-sort"></div>\n</a>\n'
})}),define("plex/base/model/media/collections/SyncMediaCollection",["plex/base/model/collections/BaseCollection","plex/base/model/media/SyncMediaModel","jquery"],function(e,t){var i=e.extend({model:t,initialize:function(e,t){this.server=t.server,this.syncItemId=t.syncItemId},url:function(){return"/sync/items/"+this.syncItemId},parse:function(e){var t=this.convert(e),i=[],n=_.compact(i.concat(t.Directory,t.Video,t.Track,t.Photo));return _.each(n,_.bind(function(e){e.syncItemId=this.syncItemId},this)),n
}});return i}),define("hb!templates/desktop/modals/SyncStatusModal.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e){var t,i="";return i+='\n		<h4><i class="glyphicon warning-sign"></i> '+h((t=e.Status,t=null==t||t===!1?t:t.failure,typeof t===d?t.apply(e):t))+"</h4>\n	"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var r,l,o,c="",d="function",h=this.escapeExpression,u=i.helperMissing,p=this;return c+='<div class="modal-header">\n	<button type="button" class="close" data-dismiss="modal"><i class="glyphicon remove-2"></i></button>\n	<h3><i class="glyphicon download"></i> ',o={hash:{},data:a},c+=h((r=i.t||t.t,r?r.call(t,"Sync Status",o):u.call(t,"t","Sync Status",o)))+'</h3>\n</div>\n\n<div class="modal-body minimal-scrollbar">\n	<h3 class="sync-item-title">',(l=i.rootTitle)?l=l.call(t,{hash:{},data:a}):(l=t.rootTitle,l=typeof l===d?l.apply(t):l),c+=h(l)+" &middot; ",(l=i.title)?l=l.call(t,{hash:{},data:a}):(l=t.title,l=typeof l===d?l.apply(t):l),c+=h(l)+"</h3>\n\n	",l=i["if"].call(t,(r=t.Status,null==r||r===!1?r:r.failure),{hash:{},inverse:p.noop,fn:p.program(1,s,a),data:a}),(l||0===l)&&(c+=l),c+="\n</div>\n"
})}),define("hb!templates/desktop/lists/server/items/SyncStatusListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a,s="";return s+='\n		<i class="glyphicon cloud-download"></i> ',a={hash:{},data:t},s+=u((n=i.t||e.t,n?n.call(e,"Uploading to the cloud",a):h.call(e,"t","Uploading to the cloud",a)))+"\n	"}function r(e,t){var n,a,s="";return s+='\n		<i class="glyphicon circle-arrow-down"></i> ',a={hash:{},data:t},s+=u((n=i.t||e.t,n?n.call(e,"Waiting to be downloaded",a):h.call(e,"t","Waiting to be downloaded",a)))+"\n	"
}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var l,o,c,d="",h=i.helperMissing,u=this.escapeExpression,p=this;return d+='<div class="poster-container"></div>\n\n<p class="title"></p>\n\n<p class="complete-subtitle subtitle hide">\n	<i class="glyphicon ok-2"></i> ',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Synced",c):h.call(t,"t","Synced",c)))+'\n</p>\n\n<p class="waiting-subtitle subtitle hide">\n	',o=i["if"].call(t,t.cloudsync,{hash:{},inverse:p.program(3,r,a),fn:p.program(1,s,a),data:a}),(o||0===o)&&(d+=o),d+='\n</p>\n\n<p class="downloading-subtitle subtitle hide">\n	<i class="glyphicon more"></i> ',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Downloading",c):h.call(t,"t","Downloading",c)))+' &middot; <span class="transcode-progress"></span>%\n</p>\n\n<p class="converting-subtitle subtitle hide">\n	<i class="glyphicon more"></i> ',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Converting",c):h.call(t,"t","Converting",c)))+' &middot; <span class="transcode-progress"></span>% &middot; <span class="transcode-remaining"></span>\n</p>\n\n<p class="processing-subtitle subtitle hide">\n	<i class="glyphicon more"></i> ',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Waiting to be converted",c):h.call(t,"t","Waiting to be converted",c)))+'\n</p>\n\n<p class="unknown-subtitle subtitle hide">\n	<i class="glyphicon circle-question-mark"></i> ',c={hash:{},data:a},d+=u((l=i.t||t.t,l?l.call(t,"Unknown",c):h.call(t,"t","Unknown",c)))+'\n</p>\n\n<p class="failed-subtitle subtitle hide">\n	<i class="glyphicon warning-sign"></i> <span class="error-message"></span>\n</p>\n'
})}),define("plex/desktop/view/lists/server/items/SyncStatusListItem",["hb!templates/desktop/lists/server/items/SyncStatusListItem.tpl","plex/base/control/utils/NumberUtil","plex/base/control/utils/LocalizationUtil","plex/base/view/BaseView","plex/base/view/images/BaseImage"],function(e,t,i,n,a){var s=n.extend({tagName:"li",syncItem:null,transcodeJobs:null,poster:null,initialize:function(e){this.syncItem=e.list.syncItem,this.transcodeJobs=this.model.server.get("transcodeJobs"),this.poster=this.registerView(new a(this.getPosterOptions())),this.addBinding(this.transcodeJobs,"reset",function(){this.model.trigger("change:Media",this.model,this.model.get("Media"))
})},render:function(){return this.$el.html(e({cloudsync:"cloudsync"===this.syncItem.device.get("platform")})),this.$(".poster-container").prepend(this.poster.render().el),this.bindView(),this},analyzeTranscodeJobs:function(){var e;if(this.transcodeJobs.each(_.bind(function(t){var i=this.model.get("thumb"),n=this.model.get("title"),a=t.get("transcodeThumb"),s=t.get("title"),r=s.indexOf(n)>-1,l=!0;if(i&&a){var o=RegExp("(.+)"+t.get("thumb")+"$");l=o.exec(i)}this.syncItem.id===t.get("syncItemId")&&r&&l&&(e=t)
},this)),e&&e.get("progress")>0){var i=Math.round(10*e.get("speed"))/10,n=t.formatMinutesRemaining(e.get("remaining")),a=Math.round(10*e.get("progress"))/10;return{active:!0,speed:i,remaining:n,progress:a}}return{active:!1}},analyzeParts:function(){var e=/^(transcoded|downloaded|directplay)$/,t=/^downloading$/,i=/^(pending|transcoding)$/,n=/^failed$/,a="complete",s=this.model.get("Media");if(!s.length)return"unknown";for(var r=0,l=s.length;l>r;r++)for(var o=s[r].Part,c=0,d=o.length;d>c;c++){var h=o[c],u=h.transcodeState;
n.test(u)&&(a=h.transcodeStateContext),i.test(u)&&(a="processing"),t.test(u)&&(a="downloading"),e.test(u)&&"processing"!==a&&(a=h.key?"waiting":"processing")}return a},getPosterOptions:function(){var e=this.model.get("type"),t=this.model.get("thumb"),i="img/posters/poster_wide.png";switch(e){case"artist":case"album":case"track":i="img/posters/album.png";break;case"photoAlbum":case"photo":i="img/posters/photo.png";break;case"clip":i="img/posters/poster_square.png";break;default:t=this.model.get("art")||t
}return{model:this.model,url:t,placeholder:i,className:"poster small-poster",transcode:!0,width:200,height:50}},getErrorMessage:function(e){var t;switch(e){case"sourceFileUnavailable":t="This media is inaccessible. Please check that the file exists with the correct permissions.";break;case"sourceFileMetadataError":t="The metadata for this media is invalid. Please reanalyze the media and try again.";break;case"clientProfileError":t="The client profile for the sync target is invalid.";break;case"ioError":t="An error occurred processing this media. Please check that the disk is not full.";
break;case"transcoderError":t="The transcoder was unable to process this media.";break;case"mediaAnalysisError":t="This media was unable to be analyzed.";break;case"downloadFailed":t="This media was unable to be downloaded. Please check that it is still available and try again.";break;case"unknownError":t="An error occurred while syncing this media.";break;default:t="An error occurred while syncing this media."}return i.t(t)},bindings:{".title":{modelAttr:"title"},".subtitle":{modelAttr:"Media",format:function(){var e=this.analyzeParts(),t=this.analyzeTranscodeJobs();
switch(this.$(".subtitle").addClass("hide"),e){case"complete":this.$(".complete-subtitle").removeClass("hide");break;case"waiting":this.$(".waiting-subtitle").removeClass("hide");break;case"downloading":t.active?(this.$(".downloading-subtitle").removeClass("hide"),this.$(".transcode-progress").text(t.progress)):this.$(".processing-subtitle").removeClass("hide");break;case"processing":t.active?(this.$(".converting-subtitle").removeClass("hide"),this.$(".transcode-progress").text(t.progress),this.$(".transcode-remaining").text(t.remaining)):this.$(".processing-subtitle").removeClass("hide");
break;case"unknown":this.$(".unknown-subtitle").removeClass("hide");break;default:this.$(".failed-subtitle").removeClass("hide"),this.$(".error-message").text(this.getErrorMessage(e))}}}}});return s}),define("plex/desktop/view/lists/server/SyncStatusList",["plex/base/view/lists/BaseList","plex/desktop/view/lists/server/items/SyncStatusListItem"],function(e,t){var i=e.extend({tagName:"ul",className:"sync-status-list",initialize:function(e){this.syncItem=e.syncItem,this.setup(t)},render:function(){return this.$el.empty(),this.populate(this.collection),this
},populate:function(){this.rendered=!0,this.populated=!!this.collection.length,this.populated&&(this.populated=!!this.collection.length,this.removeAllViews(),this.items={},this.collection.each(this.addItem,this),_.defer(_.bind(function(){this.trigger("complete")},this)))},reset:function(){}});return i}),define("plex/desktop/view/modals/SyncStatusModal",["hb!templates/desktop/modals/SyncStatusModal.tpl","plex/base/view/modals/BaseModal","plex/desktop/view/lists/server/SyncStatusList","jquery"],function(e,t,i){var n=t.extend({name:"syncStatusModal",className:"sync-status-modal modal fade",events:{hidden:"close"},initialize:function(){this.list=this.registerView(new i({syncItem:this.model,collection:this.collection}))
},render:function(){return this.$el.html(e(this.model.toJSON())).modal(),this.$(".sync-item-title").after(this.list.render().el),this}});return n}),define("plex/desktop/view/lists/server/items/SyncItemTileListItem",["hb!templates/desktop/lists/server/items/SyncItemTileListItem.tpl","plex/base/control/utils/LocalizationUtil","plex/base/control/utils/NumberUtil","plex/base/model/AppModel","plex/base/model/media/collections/SyncMediaCollection","plex/base/view/BaseView","plex/base/view/images/BaseImage","plex/desktop/view/modals/SyncModal","plex/desktop/view/modals/ConfirmModal","plex/desktop/view/modals/SyncStatusModal","jquery"],function(e,t,i,n,a,s,r,l,o,c,d){var h=s.extend({tagName:"li",server:null,items:null,hasPoster:!1,mixed:!1,itemsInterval:null,poster:null,events:{"click a":"onClick","click .poster-edit-btn":"onEditClick","click .poster-delete-btn":"onDeleteClick","mouseenter .hover-menu-btn":"onMenuMouseEnter","mouseleave .hover-menu-btn":"onMenuMouseLeave"},initialize:function(e){this.server=this.model.mediaServer=e.list.server;
var t="img/posters/poster.png";this.model.get("directory")&&(t="img/posters/folder.png"),this.poster=this.registerView(new r({server:this.server,placeholder:t,className:"poster",transcode:!0,width:128,height:200})),this.items=new a([],{server:this.server,syncItemId:this.model.id}),this.addBinding(this.items,"reset",this.onMediaItemsReset);var i=this.server.get("transcodeJobs");this.addBinding(i,"reset",this.onTranscodeJobsReset),this.items.fetch({hideLoadingAlert:!0}),this.model.mediaServer.supports("syncNotifications")?this.addBinding(this.items,"change:Media",this.onMediaItemsChange):this.itemsInterval=setInterval(_.bind(function(){this.items.fetch({hideLoadingAlert:!0})
},this),5e3)},render:function(){if(this.$el.html(e({syncItem:this.model.toJSON(),cloudsync:"cloudsync"===this.model.device.get("platform"),failed:this.model.get("Status").failure})),this.$(".poster-face").prepend(this.poster.render().el),this.bindView(),this.supportsCanvas()){var t=this.$(".circle-progress-bar")[0],i=t.getContext("2d");i.lineWidth=5,i.strokeStyle="#ff9d00"}var n=this.server.get("transcodeJobs");return n.populate({hideLoadingAlert:!0}),this},destroy:function(){s.prototype.destroy.call(this),this.itemsInterval&&clearInterval(this.itemsInterval),this.items.release()
},supportsCanvas:function(){if(this.canUseCanvas===void 0){var e=document.createElement("canvas");this.canUseCanvas=!(!e.getContext||!e.getContext("2d"))}return this.canUseCanvas},drawProgress:function(e){if(this.supportsCanvas()){var t=this.$(".circle-progress-bar")[0],i=t.getContext("2d"),n=t.width/2,a=t.height/2,s=n-4,r=-Math.PI/2,l=r+2*e*Math.PI;i.clearRect(0,0,t.width,t.height),i.beginPath(),i.arc(n,a,s,r,l,!1),i.stroke(),i.closePath()}},updatePoster:function(e){var t=e.get("type"),i=e.get("thumb");
i="track"===t?e.get("parentThumb")||i:e.get("grandparentThumb")||i,this.poster.update(i),this.hasPoster=!0},analyzeParts:function(e){if(this.model.get("Status").failure)return"failed";var t,i=e.models,n=i.length;if(!n)return"unknown";for(var a=/^(transcoded|downloaded|directplay)$/,s=/^(pending|transcoding|downloading)$/,r=/^failed$/,l="complete",o=0;n>o;o++){var c,d=i[o],h=d.get("type"),u=d.get("Media");if(!u.length)return"unknown";if(c="track"===h?d.get("parentThumb")||d.get("thumb"):d.get("grandparentThumb")||d.get("thumb"),t===void 0&&(t=c),t!==c&&(this.mixed=!0),"failed"!==l)for(var p=0,f=u.length;f>p;p++)for(var m=u[p].Part,g=0,v=m.length;v>g;g++){var y=m[g],b=y.transcodeState;
r.test(b)&&(l="failed"),s.test(b)&&(l="processing"),a.test(b)&&"processing"!==l&&(l=y.key?"waiting":"processing")}}return this.hasPoster||this.mixed||this.updatePoster(i[0]),l},bindings:{".poster-title":{modelAttr:"title"},".poster-subtitle":{modelAttr:"rootTitle"}},onMediaItemsReset:function(e){var t=this.analyzeParts(e);if(this.$(".sync-status-icon").addClass("hide"),this.$(".sync-status-transcode").hasClass("hide"))switch(t){case"complete":this.$(".sync-complete-icon").removeClass("hide");break;
case"waiting":this.$(".sync-waiting-icon").removeClass("hide");break;case"processing":this.$(".sync-processing-icon").removeClass("hide");break;case"failed":this.$(".sync-failed-icon").removeClass("hide");break;default:this.$(".sync-unknown-icon").removeClass("hide")}},onMediaItemsChange:function(){this.onMediaItemsReset(this.items)},onTranscodeJobsReset:function(e){var n=e.where({syncItemId:this.model.id}),a=this.model.get("directory");if(!n.length)return this.$(".sync-status-transcode").hasClass("hide")||(this.$(".sync-status-transcode").addClass("hide"),this.$(".sync-waiting-icon").removeClass("hide")),this.$(".sync-time-remaining").text(""),a&&this.hasPoster&&this.mixed&&(this.$(".poster").data("original","img/posters/folder.png"),this.trigger("change:poster"),this.hasPoster=!1),void 0;
if(n.length){var s=n[0];if(this.$(".sync-status-icon").addClass("hide"),s.get("progress")>0){this.$(".sync-status-transcode").removeClass("hide");var r=Math.round(10*s.get("speed"))/10,l=i.formatMinutesRemaining(s.get("remaining")),o=.01*s.get("progress");this.drawProgress(o),r>10&&(r=Math.round(r)),"download"===s.get("type")?(this.$(".sync-speed").text(""+s.get("progress")+"%"),this.$(".sync-time-remaining").text(t.t("Downloading"))):(this.$(".sync-speed").text(""+r+"x"),this.$(".sync-time-remaining").text(l)),a&&this.updatePoster(s)
}else this.$(".sync-status-transcode").addClass("hide"),this.$(".sync-processing-icon").removeClass("hide")}},onClick:function(e){e.preventDefault(),n.set("modal",new c({model:this.model,collection:this.items}))},onEditClick:function(e){e.stopImmediatePropagation(),e.preventDefault();var t=new l({edit:!0,model:this.model});n.set("modal",t)},onDeleteClick:function(e){e.stopImmediatePropagation(),e.preventDefault();var i=new o({title:t.t("Stop Syncing"),message:t.t("Are you sure you want to stop syncing {1}?",this.model.get("title"))});
i.on("yes",_.bind(function(){n.set("modal",i),this.model.destroy()},this)),n.set("modal",i)},onMenuMouseEnter:function(e){this.$(".hover-menu-btn").each(function(t,i){i!==e.currentTarget?d(i).addClass("dim"):d(i).removeClass("dim")})},onMenuMouseLeave:function(){this.$(".hover-menu-btn").removeClass("dim")}});return h}),define("plex/desktop/view/lists/server/SyncItemTileList",["plex/base/view/lists/BaseList","plex/desktop/view/lists/server/items/SyncItemTileListItem"],function(e,t){var i=e.extend({tagName:"ul",className:"tile-list media-tile-list sync-item-tile-list",server:null,initialize:function(e){this.server=e.server,this.setup(t)
},render:function(){return this.$el.empty(),this.populate(this.collection),this}});return i}),define("plex/desktop/view/lists/server/items/SyncDeviceListItem",["hb!templates/desktop/lists/server/items/SyncDeviceListItem.tpl","plex/base/model/collections/SyncItemCollection","plex/base/view/BaseView","plex/desktop/view/lists/server/SyncItemTileList"],function(e,t,i,n){var a=i.extend({tagName:"li",server:null,syncItems:null,syncItemsList:null,initialize:function(e){this.server=e.list.model,this.syncItems=new t([],{server:this.server,device:this.model}),this.addBinding(this.syncItems,"reset",this.onSyncItemsChange),this.addBinding(this.syncItems,"remove",this.onSyncItemsChange);
var i=this.model.get("syncItems");i.fetch().done(_.bind(function(){this.syncItems.reset(i.getByServer(this.server.id))},this)),this.syncItemsList=this.registerView(new n({collection:this.syncItems,server:this.server}))},render:function(){var t=this.model.get("platform"),i=this.model.get("device");return this.$el.html(e({device:this.model.toJSON(),cloud:"cloudsync"===t,tablet:/(iPad)/.test(i)})),this.$el.append(this.syncItemsList.render().el),this},onSyncItemsChange:function(){this.syncItems.length?this.$(".empty-message").addClass("hide"):this.$(".empty-message").removeClass("hide")
}});return a}),define("plex/desktop/view/lists/server/SyncDeviceList",["plex/base/view/lists/BaseList","plex/desktop/view/lists/server/items/SyncDeviceListItem"],function(e,t){var i=e.extend({tagName:"ul",className:"sync-device-list",initialize:function(){this.setup(t)},render:function(){return this.$el.empty(),this.populate(this.collection),this},refreshSyncItems:function(){_.each(this._views,function(e){var t=e.model.get("syncItems");t.fetch().done(function(){e.syncItems.reset(t.getByServer(e.server.id))
})})}});return i}),define("plex/desktop/view/server/SyncStatusView",["hb!templates/desktop/server/SyncStatusView.tpl","plex/base/control/Dispatcher","plex/base/model/AppModel","plex/base/model/collections/DeviceCollection","plex/base/model/collections/SyncItemCollection","plex/base/view/BaseView","plex/desktop/view/server/ActivityNavView","plex/desktop/view/lists/server/SyncDeviceList","jquery"],function(e,t,i,n,a,s,r,l,o){var c=s.extend({className:"container",subnav:null,syncDevices:null,syncDeviceList:null,transcodeJobInterval:null,events:{"click .refresh-btn":"onRefreshClick","click .edit-btn":"onEditClick"},initialize:function(){var e=i.get("myPlex"),t=e.get("devices");
this.syncDevices=new n([],{server:e}),t.populate().done(_.bind(function(){this.syncDevices.reset(t.getSyncDevices())},this));var a=this.model.get("transcodeJobs");a.fetch({hideLoadingAlert:!0}),this.transcodeJobInterval=setInterval(function(){a.fetch({hideLoadingAlert:!0})},2e3),this.subnav=this.registerView(new r({model:this.model,active:"sync"})),this.syncDeviceList=this.registerView(new l({collection:this.syncDevices,model:this.model}))},render:function(){return this.$el.html(e()),this.$el.prepend(this.subnav.render().el),this.$("#sync-status-container").append(this.syncDeviceList.render().el),this.$el.tooltip({selector:".btn-icon",placement:"bottom"}),this
},destroy:function(){s.prototype.destroy.call(this),clearInterval(this.transcodeJobInterval)},onRefreshClick:function(e){e.preventDefault(),t.trigger("command:ShowLoading",!0);var i="/sync/refreshSynclists",n=_.extend(this.model.getAjaxOptions(i),{type:"PUT"}),a=function(){t.trigger("command:ShowLoading",!1)};o.ajax(n).done(_.bind(function(){var e="/sync/refreshContent",i=_.extend(this.model.getAjaxOptions(e),{type:"PUT"});o.ajax(i).done(_.bind(function(){t.trigger("command:ShowLoading",!1),this.syncDeviceList.refreshSyncItems()
},this)).fail(a)},this)).fail(a)},onEditClick:function(e){e.preventDefault();var t=o(e.currentTarget);t.toggleClass("active"),t.hasClass("active")?this.$(".sync-item-tile-list").addClass("editing"):this.$(".sync-item-tile-list").removeClass("editing")}});return c}),define("hb!templates/desktop/server/NowPlayingView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(){return"hide"}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var r,l,o="",c=this,d=i.helperMissing,h=this.escapeExpression;
return o+='<div id="now-playing-container" class="well">\n	<div class="now-playing-empty-message empty-message ',r=i["if"].call(t,t.count,{hash:{},inverse:c.noop,fn:c.program(1,s,a),data:a}),(r||0===r)&&(o+=r),o+='">\n		',l={hash:{},data:a},o+=h((r=i.t||t.t,r?r.call(t,"Nothing is currently being watched.",l):d.call(t,"t","Nothing is currently being watched.",l)))+"\n	</div>\n</div>\n"})}),define("plex/desktop/view/lists/server/NowPlayingList",["plex/base/view/lists/BaseList","plex/desktop/view/lists/server/items/NowPlayingListItem"],function(e,t){var i=e.extend({tagName:"ul",className:"now-playing-list",initialize:function(){this.setup(t)
},render:function(){return this.$el.empty(),this.populate(this.collection),this}});return i}),define("plex/desktop/view/server/NowPlayingView",["hb!templates/desktop/server/NowPlayingView.tpl","plex/base/view/BaseView","plex/desktop/view/server/ActivityNavView","plex/desktop/view/lists/server/NowPlayingList"],function(e,t,i,n){var a=t.extend({className:"container",subnav:null,list:null,initialize:function(){this.subnav=this.registerView(new i({model:this.model,active:"nowplaying"})),this.list=this.registerView(new n({collection:this.collection})),this.addBinding(this.collection,"reset",this.onReset),this.addBinding(this.collection,"remove",this.onReset),this.collection.fetch()
},render:function(){return this.$el.html(e({count:this.collection.length})),this.$el.prepend(this.subnav.render().el),this.$("#now-playing-container").append(this.list.render().el),this},onReset:function(e){e.length?this.$(".now-playing-empty-message").addClass("hide"):this.$(".now-playing-empty-message").removeClass("hide")}});return a}),define("hb!templates/desktop/edit/EditMovieView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a,s="";return s+='\n			<a class="btn btn-danger delete-btn" href="#">\n				<i class="glyphicon ban"></i> ',a={hash:{},data:t},s+=h((n=i.t||e.t,n?n.call(e,"Delete",a):d.call(e,"t","Delete",a)))+"\n			</a>\n		"
}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var r,l,o,c="",d=i.helperMissing,h=this.escapeExpression,u=this;return c+='<div class="details-row row-fluid">\n	<div class="details-controls">\n		<a class="btn change-poster-btn" href="#">\n			<i class="glyphicon pencil"></i> ',o={hash:{},data:a},c+=h((r=i.t||t.t,r?r.call(t,"Change Poster",o):d.call(t,"t","Change Poster",o)))+'\n		</a>\n		<a class="btn change-background-btn" href="#">\n			<i class="glyphicon pencil"></i> ',o={hash:{},data:a},c+=h((r=i.t||t.t,r?r.call(t,"Change Background",o):d.call(t,"t","Change Background",o)))+"\n		</a>\n		",l=i["if"].call(t,t.showDelete,{hash:{},inverse:u.noop,fn:u.program(1,s,a),data:a}),(l||0===l)&&(c+=l),c+='\n	</div>\n\n	<form class="edit-metadata-form">\n		<fieldset>\n			<div class="row-fluid">\n				<div class="span5">\n					',o={hash:{name:"title",label:"Title",value:(r=t.media,null==r||r===!1?r:r.title),locked:(r=t.locked,null==r||r===!1?r:r.title)},data:a},c+=h((r=i.lockableTextInput||t.lockableTextInput,r?r.call(t,o):d.call(t,"lockableTextInput",o)))+'\n				</div>\n				<div class="span5">\n					',o={hash:{name:"titleSort",label:"Sort Title",value:(r=t.media,null==r||r===!1?r:r.titleSort),locked:(r=t.locked,null==r||r===!1?r:r.titleSort)},data:a},c+=h((r=i.lockableTextInput||t.lockableTextInput,r?r.call(t,o):d.call(t,"lockableTextInput",o)))+'\n				</div>\n				<div class="span2">\n					',o={hash:{name:"year",label:"Year",value:(r=t.media,null==r||r===!1?r:r.year),locked:(r=t.locked,null==r||r===!1?r:r.year)},data:a},c+=h((r=i.lockableTextInput||t.lockableTextInput,r?r.call(t,o):d.call(t,"lockableTextInput",o)))+'\n				</div>\n			</div>\n\n			<div class="row-fluid">\n				<div class="span5">\n					',o={hash:{name:"originalTitle",label:"Original Title",value:(r=t.media,null==r||r===!1?r:r.originalTitle),locked:(r=t.locked,null==r||r===!1?r:r.originalTitle)},data:a},c+=h((r=i.lockableTextInput||t.lockableTextInput,r?r.call(t,o):d.call(t,"lockableTextInput",o)))+'\n				</div>\n				<div class="span3">\n					',o={hash:{name:"rating",label:"Rating",value:(r=t.media,null==r||r===!1?r:r.rating),locked:(r=t.locked,null==r||r===!1?r:r.rating)},data:a},c+=h((r=i.lockableTextInput||t.lockableTextInput,r?r.call(t,o):d.call(t,"lockableTextInput",o)))+'\n				</div>\n				<div class="span4">\n					',o={hash:{name:"contentRating",label:"Content Rating",value:(r=t.media,null==r||r===!1?r:r.contentRating),locked:(r=t.locked,null==r||r===!1?r:r.contentRating)},data:a},c+=h((r=i.lockableTextInput||t.lockableTextInput,r?r.call(t,o):d.call(t,"lockableTextInput",o)))+'\n				</div>\n			</div>\n\n			<div class="row-fluid">\n				<div class="span7">\n					',o={hash:{name:"studio",label:"Studio",value:(r=t.media,null==r||r===!1?r:r.studio),locked:(r=t.locked,null==r||r===!1?r:r.studio)},data:a},c+=h((r=i.lockableTextInput||t.lockableTextInput,r?r.call(t,o):d.call(t,"lockableTextInput",o)))+'\n				</div>\n				<div class="span5">\n					',o={hash:{name:"originallyAvailableAt",label:"Originally Available",value:(r=t.media,null==r||r===!1?r:r.originallyAvailableAt),locked:(r=t.locked,null==r||r===!1?r:r.originallyAvailableAt)},data:a},c+=h((r=i.lockableTextInput||t.lockableTextInput,r?r.call(t,o):d.call(t,"lockableTextInput",o)))+'\n				</div>\n			</div>\n\n			<div class="row-fluid">\n				<div class="span12">\n					',o={hash:{name:"tagline",label:"Tagline",value:(r=t.media,null==r||r===!1?r:r.tagline),locked:(r=t.locked,null==r||r===!1?r:r.tagline)},data:a},c+=h((r=i.lockableTextInput||t.lockableTextInput,r?r.call(t,o):d.call(t,"lockableTextInput",o)))+'\n				</div>\n			</div>\n\n			<div class="row-fluid">\n				<div class="span12">\n					',o={hash:{name:"summary",label:"Summary",type:"textarea",rows:"6",value:(r=t.media,null==r||r===!1?r:r.summary),locked:(r=t.locked,null==r||r===!1?r:r.summary)},data:a},c+=h((r=i.lockableTextInput||t.lockableTextInput,r?r.call(t,o):d.call(t,"lockableTextInput",o)))+'\n				</div>\n			</div>\n\n			<div class="row-fluid">\n				<div class="span6">\n					',o={hash:{name:"writer",label:"Writers",value:(r=t.media,null==r||r===!1?r:r.Writer),locked:(r=t.locked,null==r||r===!1?r:r.writer)},data:a},c+=h((r=i.lockableTagInput||t.lockableTagInput,r?r.call(t,o):d.call(t,"lockableTagInput",o)))+'\n				</div>\n				<div class="span6">\n					',o={hash:{name:"director",label:"Directors",value:(r=t.media,null==r||r===!1?r:r.Director),locked:(r=t.locked,null==r||r===!1?r:r.director)},data:a},c+=h((r=i.lockableTagInput||t.lockableTagInput,r?r.call(t,o):d.call(t,"lockableTagInput",o)))+'\n				</div>\n			</div>\n\n			<div class="row-fluid">\n				<div class="span12">\n					',o={hash:{name:"genre",label:"Genres",value:(r=t.media,null==r||r===!1?r:r.Genre),locked:(r=t.locked,null==r||r===!1?r:r.genre)},data:a},c+=h((r=i.lockableTagInput||t.lockableTagInput,r?r.call(t,o):d.call(t,"lockableTagInput",o)))+'\n				</div>\n			</div>\n\n			<div class="row-fluid">\n				<div class="span6">\n					',o={hash:{name:"country",label:"Country",value:(r=t.media,null==r||r===!1?r:r.Country),locked:(r=t.locked,null==r||r===!1?r:r.country)},data:a},c+=h((r=i.lockableTagInput||t.lockableTagInput,r?r.call(t,o):d.call(t,"lockableTagInput",o)))+'\n				</div>\n				<div class="span6">\n					',o={hash:{name:"collection",label:"Collections",value:(r=t.media,null==r||r===!1?r:r.Collection),locked:(r=t.locked,null==r||r===!1?r:r.collection)},data:a},c+=h((r=i.lockableTagInput||t.lockableTagInput,r?r.call(t,o):d.call(t,"lockableTagInput",o)))+'\n				</div>\n			</div>\n\n			<div class="form-actions">\n				<button type="submit" class="btn btn-medium btn-primary">',o={hash:{},data:a},c+=h((r=i.t||t.t,r?r.call(t,"Save",o):d.call(t,"t","Save",o)))+'</button>\n				<button type="button" class="btn btn-medium cancel-btn">',o={hash:{},data:a},c+=h((r=i.t||t.t,r?r.call(t,"Cancel",o):d.call(t,"t","Cancel",o)))+"</button>\n			</div>\n		</fieldset>\n	</form>\n</div>\n"
})}),function(e){e.fn.each2===void 0&&e.fn.extend({each2:function(t){for(var i=e([0]),n=-1,a=this.length;a>++n&&(i.context=i[0]=this[n])&&t.call(i[0],n,i)!==!1;);return this}})}(jQuery),function(e,t){function i(e,i){var n,a=0,s=i.length;if(e===t)return-1;if(e.constructor===String){for(;s>a;a+=1)if(0===e.localeCompare(i[a]))return a}else for(;s>a;a+=1)if(n=i[a],n.constructor===String){if(0===n.localeCompare(e))return a}else if(n===e)return a;return-1}function n(e,i){return e===i?!0:e===t||i===t?!1:null===e||null===i?!1:e.constructor===String?0===e.localeCompare(i):i.constructor===String?0===i.localeCompare(e):!1
}function a(t,i){var n,a,s;if(null===t||1>t.length)return[];for(n=t.split(i),a=0,s=n.length;s>a;a+=1)n[a]=e.trim(n[a]);return n}function s(e){return e.outerWidth(!1)-e.width()}function r(i){var n="keyup-change-value";i.bind("keydown",function(){e.data(i,n)===t&&e.data(i,n,i.val())}),i.bind("keyup",function(){var a=e.data(i,n);a!==t&&i.val()!==a&&(e.removeData(i,n),i.trigger("keyup-change"))})}function l(i){i.bind("mousemove",function(i){var n=M;(n===t||n.x!==i.pageX||n.y!==i.pageY)&&e(i.target).trigger("mousemove-filtered",i)
})}function o(e,i,n){n=n||t;var a;return function(){var t=arguments;window.clearTimeout(a),a=window.setTimeout(function(){i.apply(n,t)},e)}}function c(e){var t,i=!1;return function(){return i===!1&&(t=e(),i=!0),t}}function d(e,t){var n=o(e,function(e){t.trigger("scroll-debounced",e)});t.bind("scroll",function(e){i(e.target,t.get())>=0&&n(e)})}function h(e){e.preventDefault(),e.stopPropagation()}function u(e){e.preventDefault(),e.stopImmediatePropagation()}function p(t){if(!T){var i=t[0].currentStyle||window.getComputedStyle(t[0],null);
T=e("<div></div>").css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:i.fontSize,fontFamily:i.fontFamily,fontStyle:i.fontStyle,fontWeight:i.fontWeight,letterSpacing:i.letterSpacing,textTransform:i.textTransform,whiteSpace:"nowrap"}),e("body").append(T)}return T.text(t.val()),T.width()}function f(e,i,n){var a=e.toUpperCase().indexOf(i.toUpperCase()),s=i.length;return 0>a?(n.push(e),t):(n.push(e.substring(0,a)),n.push("<span class='select2-match'>"),n.push(e.substring(a,a+s)),n.push("</span>"),n.push(e.substring(a+s,e.length)),t)
}function m(t){var i,n=0,a=null,s=t.quietMillis||100;return function(r){window.clearTimeout(i),i=window.setTimeout(function(){n+=1;var i=n,s=t.data,l=t.transport||e.ajax,o=t.traditional||!1,c=t.type||"GET";s=s.call(this,r.term,r.page,r.context),null!==a&&a.abort(),a=l.call(null,{url:t.url,dataType:t.dataType,data:s,type:c,traditional:o,success:function(e){if(!(n>i)){var a=t.results(e,r.page);r.callback(a)}}})},s)}}function g(i){var n,a=i,s=function(e){return""+e.text};return e.isArray(a)||(s=a.text,e.isFunction(s)||(n=a.text,s=function(e){return e[n]
}),a=a.results),function(i){var n,r=i.term,l={results:[]};return""===r?(i.callback({results:a}),t):(n=function(t,a){var l,o;if(t=t[0],t.children){l={};for(o in t)t.hasOwnProperty(o)&&(l[o]=t[o]);l.children=[],e(t.children).each2(function(e,t){n(t,l.children)}),(l.children.length||i.matcher(r,s(l)))&&a.push(l)}else i.matcher(r,s(t))&&a.push(t)},e(a).each2(function(e,t){n(t,l.results)}),i.callback(l),t)}}function v(i){return e.isFunction(i)?i:function(n){var a=n.term,s={results:[]};e(i).each(function(){var e=this.text!==t,i=e?this.text:this;
(""===a||n.matcher(a,i))&&s.results.push(e?this:{id:this,text:this})}),n.callback(s)}}function y(t){if(e.isFunction(t))return!0;if(!t)return!1;throw Error("formatterName must be a function or a falsy value")}function b(t){return e.isFunction(t)?t():t}function w(t){var i=0;return e.each(t,function(e,t){t.children?i+=w(t.children):i++}),i}function x(e,i,a,s){var r,l,o,c,d,h=e,u=!1;if(!s.createSearchChoice||!s.tokenSeparators||1>s.tokenSeparators.length)return t;for(;;){for(l=-1,o=0,c=s.tokenSeparators.length;c>o&&(d=s.tokenSeparators[o],l=e.indexOf(d),!(l>=0));o++);if(0>l)break;
if(r=e.substring(0,l),e=e.substring(l+d.length),r.length>0&&(r=s.createSearchChoice(r,i),r!==t&&null!==r&&s.id(r)!==t&&null!==s.id(r))){for(u=!1,o=0,c=i.length;c>o;o++)if(n(s.id(r),s.id(i[o]))){u=!0;break}u||a(r)}}return 0!=h.localeCompare(e)?e:t}function k(t,i){var n=function(){};return n.prototype=new t,n.prototype.constructor=n,n.prototype.parent=t.prototype,n.prototype=e.extend(n.prototype,i),n}if(window.Select2===t){var S,C,_,A,I,T,M,P;S={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,isArrow:function(e){switch(e=e.which?e.which:e){case S.LEFT:case S.RIGHT:case S.UP:case S.DOWN:return!0
}return!1},isControl:function(e){var t=e.which;switch(t){case S.SHIFT:case S.CTRL:case S.ALT:return!0}return e.metaKey?!0:!1},isFunctionKey:function(e){return e=e.which?e.which:e,e>=112&&123>=e}},P=e(document),I=function(){var e=1;return function(){return e++}}(),P.bind("mousemove",function(e){M={x:e.pageX,y:e.pageY}}),P.ready(function(){P.bind("mousedown touchend",function(i){var n,a=e(i.target).closest("div.select2-container").get(0),s=null;a&&(P.find("div.select2-container-active").each(function(){this!==a&&e(this).data("select2").blur()
}),s=e(a).data("select2").dropdown.get(0)),a=s||e(i.target).closest("div.select2-drop").get(0),P.find("div.select2-drop-active").each(function(){this!==a&&e(this).data("select2").blur()}),a=e(i.target),n=a.attr("for"),"LABEL"===i.target.tagName&&n&&n.length>0&&(n=n.replace(/([\[\].])/g,"\\$1"),a=e("#"+n),a=a.data("select2"),a!==t&&(a.focus(),i.preventDefault()))})}),C=k(Object,{bind:function(e){var t=this;return function(){e.apply(t,arguments)}},init:function(i){var n,a,s=".select2-results";this.opts=i=this.prepareOpts(i),this.id=i.id,i.element.data("select2")!==t&&null!==i.element.data("select2")&&this.destroy(),this.enabled=!0,this.container=this.createContainer(),this.containerId="s2id_"+(i.element.attr("id")||"autogen"+I()),this.containerSelector="#"+this.containerId.replace(/([;&,\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1"),this.container.attr("id",this.containerId),this.body=c(function(){return i.element.closest("body")
}),i.element.attr("class")!==t&&this.container.addClass(i.element.attr("class").replace(/validate\[[\S ]+] ?/,"")),this.container.css(b(i.containerCss)),this.container.addClass(b(i.containerCssClass)),this.opts.element.data("select2",this).hide().before(this.container),this.container.data("select2",this),this.dropdown=this.container.find(".select2-drop"),this.dropdown.addClass(b(i.dropdownCssClass)),this.dropdown.data("select2",this),this.results=n=this.container.find(s),this.search=a=this.container.find("input.select2-input"),a.attr("tabIndex",this.opts.element.attr("tabIndex")),this.resultsPage=0,this.context=null,this.initContainer(),this.initContainerWidth(),l(this.results),this.dropdown.delegate(s,"mousemove-filtered",this.bind(this.highlightUnderEvent)),d(80,this.results),this.dropdown.delegate(s,"scroll-debounced",this.bind(this.loadMoreIfNeeded)),e.fn.mousewheel&&n.mousewheel(function(e,t,i,a){var s=n.scrollTop();
a>0&&0>=s-a?(n.scrollTop(0),h(e)):0>a&&n.get(0).scrollHeight-n.scrollTop()+a<=n.height()&&(n.scrollTop(n.get(0).scrollHeight-n.height()),h(e))}),r(a),a.bind("keyup-change",this.bind(this.updateResults)),a.bind("focus",function(){a.addClass("select2-focused")," "===a.val()&&a.val("")}),a.bind("blur",function(){a.removeClass("select2-focused")}),this.dropdown.delegate(s,"mouseup",this.bind(function(t){e(t.target).closest(".select2-result-selectable:not(.select2-disabled)").length>0?(this.highlightUnderEvent(t),this.selectHighlighted(t)):this.focusSearch(),h(t)
})),this.dropdown.bind("click mouseup mousedown",function(e){e.stopPropagation()}),e.isFunction(this.opts.initSelection)&&(this.initSelection(),this.monitorSource()),(i.element.is(":disabled")||i.element.is("[readonly='readonly']"))&&this.disable()},destroy:function(){var e=this.opts.element.data("select2");e!==t&&(e.container.remove(),e.dropdown.remove(),e.opts.element.removeData("select2").unbind(".select2").show())},prepareOpts:function(i){var s,r,l,o;if(s=i.element,"select"===s.get(0).tagName.toLowerCase()&&(this.select=r=i.element),r&&e.each(["id","multiple","ajax","query","createSearchChoice","initSelection","data","tags"],function(){if(this in i)throw Error("Option '"+this+"' is not allowed for Select2 when attached to a <select> element.")
}),i=e.extend({},{populateResults:function(n,a,s){var r,l=this.opts.id,o=this;r=function(n,a,c){var d,h,u,p,f,m,g,v,y;for(n=i.sortResults(n,a,s),d=0,h=n.length;h>d;d+=1)u=n[d],p=l(u)!==t,f=u.children&&u.children.length>0,m=e("<li></li>"),m.addClass("select2-results-dept-"+c),m.addClass("select2-result"),m.addClass(p?"select2-result-selectable":"select2-result-unselectable"),f&&m.addClass("select2-result-with-children"),m.addClass(o.opts.formatResultCssClass(u)),g=e("<div></div>"),g.addClass("select2-result-label"),y=i.formatResult(u,g,s),y!==t&&g.html(o.opts.escapeMarkup(y)),m.append(g),f&&(v=e("<ul></ul>"),v.addClass("select2-result-sub"),r(u.children,v,c+1),m.append(v)),m.data("select2-data",u),a.append(m)
},r(a,n,0)}},e.fn.select2.defaults,i),"function"!=typeof i.id&&(l=i.id,i.id=function(e){return e[l]}),r?(i.query=this.bind(function(i){var n,a,r,l={results:[],more:!1},o=i.term;r=function(e,t){var n;e.is("option")?i.matcher(o,e.text(),e)&&t.push({id:e.attr("value"),text:e.text(),element:e.get(),css:e.attr("class")}):e.is("optgroup")&&(n={text:e.attr("label"),children:[],element:e.get(),css:e.attr("class")},e.children().each2(function(e,t){r(t,n.children)}),n.children.length>0&&t.push(n))},n=s.children(),this.getPlaceholder()!==t&&n.length>0&&(a=n[0],""===e(a).text()&&(n=n.not(a))),n.each2(function(e,t){r(t,l.results)
}),i.callback(l)}),i.id=function(e){return e.id},i.formatResultCssClass=function(e){return e.css}):"query"in i||("ajax"in i?(o=i.element.data("ajax-url"),o&&o.length>0&&(i.ajax.url=o),i.query=m(i.ajax)):"data"in i?i.query=g(i.data):"tags"in i&&(i.query=v(i.tags),i.createSearchChoice===t&&(i.createSearchChoice=function(e){return{id:e,text:e}}),i.initSelection=function(s,r){var l=[];e(a(s.val(),i.separator)).each(function(){var a=this,s=this,r=i.tags;e.isFunction(r)&&(r=r()),e(r).each(function(){return n(this.id,a)?(s=this.text,!1):t
}),l.push({id:a,text:s})}),r(l)})),"function"!=typeof i.query)throw"query function not defined for Select2 "+i.element.attr("id");return i},monitorSource:function(){this.opts.element.bind("change.select2",this.bind(function(){this.opts.element.data("select2-change-triggered")!==!0&&this.initSelection()}))},triggerChange:function(t){t=t||{},t=e.extend({},t,{type:"change",val:this.val()}),this.opts.element.data("select2-change-triggered",!0),this.opts.element.trigger(t),this.opts.element.data("select2-change-triggered",!1),this.opts.element.click(),this.opts.blurOnChange&&this.opts.element.blur()
},enable:function(){this.enabled||(this.enabled=!0,this.container.removeClass("select2-container-disabled"),this.opts.element.removeAttr("disabled"))},disable:function(){this.enabled&&(this.close(),this.enabled=!1,this.container.addClass("select2-container-disabled"),this.opts.element.attr("disabled","disabled"))},opened:function(){return this.container.hasClass("select2-dropdown-open")},positionDropdown:function(){var t,i,n,a=this.container.offset(),s=this.container.outerHeight(!1),r=this.container.outerWidth(!1),l=this.dropdown.outerHeight(!1),o=e(window).scrollLeft()+document.documentElement.clientWidth,c=e(window).scrollTop()+document.documentElement.clientHeight,d=a.top+s,h=a.left,u=c>=d+l,p=a.top-l>=this.body().scrollTop(),f=this.dropdown.outerWidth(!1),m=o>=h+f,g=this.dropdown.hasClass("select2-drop-above");
"static"!==this.body().css("position")&&(t=this.body().offset(),d-=t.top,h-=t.left),g?(i=!0,!p&&u&&(i=!1)):(i=!1,!u&&p&&(i=!0)),m||(h=a.left+r-f),i?(d=a.top-l,this.container.addClass("select2-drop-above"),this.dropdown.addClass("select2-drop-above")):(this.container.removeClass("select2-drop-above"),this.dropdown.removeClass("select2-drop-above")),n=e.extend({top:d,left:h,width:r},b(this.opts.dropdownCss)),this.dropdown.css(n)},shouldOpen:function(){var t;return this.opened()?!1:(t=e.Event("open"),this.opts.element.trigger(t),!t.isDefaultPrevented())
},clearDropdownAlignmentPreference:function(){this.container.removeClass("select2-drop-above"),this.dropdown.removeClass("select2-drop-above")},open:function(){return this.shouldOpen()?(window.setTimeout(this.bind(this.opening),1),!0):!1},opening:function(){var t=this.containerId,i=this.containerSelector,n="scroll."+t,a="resize."+t;this.container.parents().each(function(){e(this).bind(n,function(){var t=e(i);0==t.length&&e(this).unbind(n),t.select2("close")})}),window.setTimeout(function(){e(window).bind(a,function(){var t=e(i);
0==t.length&&e(window).unbind(a),t.select2("close")})},10),this.clearDropdownAlignmentPreference()," "===this.search.val()&&this.search.val(""),this.container.addClass("select2-dropdown-open").addClass("select2-container-active"),this.updateResults(!0),this.dropdown[0]!==this.body().children().last()[0]&&this.dropdown.detach().appendTo(this.body()),this.dropdown.show(),this.positionDropdown(),this.dropdown.addClass("select2-drop-active"),this.ensureHighlightVisible(),this.focusSearch()},close:function(){if(this.opened()){var t=this;
this.container.parents().each(function(){e(this).unbind("scroll."+t.containerId)}),e(window).unbind("resize."+this.containerId),this.clearDropdownAlignmentPreference(),this.dropdown.hide(),this.container.removeClass("select2-dropdown-open").removeClass("select2-container-active"),this.results.empty(),this.clearSearch(),this.opts.element.trigger(e.Event("close"))}},clearSearch:function(){},ensureHighlightVisible:function(){var i,n,a,s,r,l,o,c=this.results;if(n=this.highlight(),!(0>n)){if(0==n)return c.scrollTop(0),t;
i=c.find(".select2-result-selectable"),a=e(i[n]),s=a.offset().top+a.outerHeight(!0),n===i.length-1&&(o=c.find("li.select2-more-results"),o.length>0&&(s=o.offset().top+o.outerHeight(!0))),r=c.offset().top+c.outerHeight(!0),s>r&&c.scrollTop(c.scrollTop()+(s-r)),l=a.offset().top-c.offset().top,0>l&&"none"!=a.css("display")&&c.scrollTop(c.scrollTop()+l)}},moveHighlight:function(t){for(var i=this.results.find(".select2-result-selectable"),n=this.highlight();n>-1&&i.length>n;){n+=t;var a=e(i[n]);if(a.hasClass("select2-result-selectable")&&!a.hasClass("select2-disabled")){this.highlight(n);
break}}},highlight:function(n){var a=this.results.find(".select2-result-selectable").not(".select2-disabled");return 0===arguments.length?i(a.filter(".select2-highlighted")[0],a.get()):(n>=a.length&&(n=a.length-1),0>n&&(n=0),a.removeClass("select2-highlighted"),e(a[n]).addClass("select2-highlighted"),this.ensureHighlightVisible(),t)},countSelectableResults:function(){return this.results.find(".select2-result-selectable").not(".select2-disabled").length},highlightUnderEvent:function(t){var i=e(t.target).closest(".select2-result-selectable");
if(i.length>0&&!i.is(".select2-highlighted")){var n=this.results.find(".select2-result-selectable");this.highlight(n.index(i))}else 0==i.length&&this.results.find(".select2-highlighted").removeClass("select2-highlighted")},loadMoreIfNeeded:function(){var e,t=this.results,i=t.find("li.select2-more-results"),n=this.resultsPage+1,a=this,s=this.search.val(),r=this.context;0!==i.length&&(e=i.offset().top-t.offset().top-t.height(),0>=e&&(i.addClass("select2-active"),this.opts.query({term:s,page:n,context:r,matcher:this.opts.matcher,callback:this.bind(function(e){a.opened()&&(a.opts.populateResults.call(this,t,e.results,{term:s,page:n,context:r}),e.more===!0?(i.detach().appendTo(t).text(a.opts.formatLoadMore(n+1)),window.setTimeout(function(){a.loadMoreIfNeeded()
},10)):i.remove(),a.positionDropdown(),a.resultsPage=n)})})))},tokenize:function(){},updateResults:function(i){function a(){c.scrollTop(0),o.removeClass("select2-active"),h.positionDropdown()}function s(e){c.html(h.opts.escapeMarkup(e)),a()}var r,l,o=this.search,c=this.results,d=this.opts,h=this;if(i===!0||this.showSearchInput!==!1&&this.opened()){if(o.addClass("select2-active"),d.maximumSelectionSize>=1&&(r=this.data(),e.isArray(r)&&r.length>=d.maximumSelectionSize&&y(d.formatSelectionTooBig,"formatSelectionTooBig")))return s("<li class='select2-selection-limit'>"+d.formatSelectionTooBig(d.maximumSelectionSize)+"</li>"),t;
if(o.val().length<d.minimumInputLength)return y(d.formatInputTooShort,"formatInputTooShort")?s("<li class='select2-no-results'>"+d.formatInputTooShort(o.val(),d.minimumInputLength)+"</li>"):s(""),t;d.formatSearching()&&s("<li class='select2-searching'>"+d.formatSearching()+"</li>"),l=this.tokenize(),l!=t&&null!=l&&o.val(l),this.resultsPage=1,d.query({term:o.val(),page:this.resultsPage,context:null,matcher:d.matcher,callback:this.bind(function(r){var l;if(this.opened()){if(this.context=r.context===t?null:r.context,this.opts.createSearchChoice&&""!==o.val()&&(l=this.opts.createSearchChoice.call(null,o.val(),r.results),l!==t&&null!==l&&h.id(l)!==t&&null!==h.id(l)&&0===e(r.results).filter(function(){return n(h.id(this),h.id(l))
}).length&&r.results.unshift(l)),0===r.results.length&&y(d.formatNoMatches,"formatNoMatches"))return s("<li class='select2-no-results'>"+d.formatNoMatches(o.val())+"</li>"),t;c.empty(),h.opts.populateResults.call(this,c,r.results,{term:o.val(),page:this.resultsPage,context:null}),r.more===!0&&y(d.formatLoadMore,"formatLoadMore")&&(c.append("<li class='select2-more-results'>"+h.opts.escapeMarkup(d.formatLoadMore(this.resultsPage))+"</li>"),window.setTimeout(function(){h.loadMoreIfNeeded()},10)),this.postprocessResults(r,i),a()
}})})}},cancel:function(){this.close()},blur:function(){this.close(),this.container.removeClass("select2-container-active"),this.dropdown.removeClass("select2-drop-active"),this.search[0]===document.activeElement&&this.search.blur(),this.clearSearch(),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus"),this.opts.element.triggerHandler("blur")},focusSearch:function(){this.search.show(),this.search.focus(),window.setTimeout(this.bind(function(){this.search.show(),this.search.focus(),this.search.val(this.search.val())
}),10)},selectHighlighted:function(){var e=this.highlight(),t=this.results.find(".select2-highlighted").not(".select2-disabled"),i=t.closest(".select2-result-selectable").data("select2-data");i&&(t.addClass("select2-disabled"),this.highlight(e),this.onSelect(i))},getPlaceholder:function(){return this.opts.element.attr("placeholder")||this.opts.element.attr("data-placeholder")||this.opts.element.data("placeholder")||this.opts.placeholder},initContainerWidth:function(){function i(){var i,n,a,s,r;if("off"===this.opts.width)return null;
if("element"===this.opts.width)return 0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px";if("copy"===this.opts.width||"resolve"===this.opts.width){if(i=this.opts.element.attr("style"),i!==t)for(n=i.split(";"),s=0,r=n.length;r>s;s+=1)if(a=n[s].replace(/\s/g,"").match(/width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/),null!==a&&a.length>=1)return a[1];return"resolve"===this.opts.width?(i=this.opts.element.css("width"),i.indexOf("%")>0?i:0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px"):null
}return e.isFunction(this.opts.width)?this.opts.width():this.opts.width}var n=i.call(this);null!==n&&this.container.attr("style","width: "+n)}}),_=k(C,{createContainer:function(){var t=e("<div></div>",{"class":"select2-container"}).html(["    <a href='javascript:void(0)' onclick='return false;' class='select2-choice'>","   <span></span><abbr class='select2-search-choice-close' style='display:none;'></abbr>","   <div><b></b></div>","</a>","    <div class='select2-drop select2-offscreen'>","   <div class='select2-search'>","       <input type='text' autocomplete='off' class='select2-input'/>","   </div>","   <ul class='select2-results'>","   </ul>","</div>"].join(""));
return t},opening:function(){this.search.show(),this.parent.opening.apply(this,arguments),this.dropdown.removeClass("select2-offscreen")},close:function(){this.opened()&&(this.parent.close.apply(this,arguments),this.dropdown.removeAttr("style").addClass("select2-offscreen").insertAfter(this.selection).show())},focus:function(){this.close(),this.selection.focus()},isFocused:function(){return this.selection[0]===document.activeElement},cancel:function(){this.parent.cancel.apply(this,arguments),this.selection.focus()
},initContainer:function(){var e,i=this.container,n=this.dropdown,a=!1;this.selection=e=i.find(".select2-choice"),this.search.bind("keydown",this.bind(function(e){if(this.enabled){if(e.which===S.PAGE_UP||e.which===S.PAGE_DOWN)return h(e),t;if(this.opened())switch(e.which){case S.UP:case S.DOWN:return this.moveHighlight(e.which===S.UP?-1:1),h(e),t;case S.TAB:case S.ENTER:return this.selectHighlighted(),h(e),t;case S.ESC:return this.cancel(e),h(e),t}else{if(e.which===S.TAB||S.isControl(e)||S.isFunctionKey(e)||e.which===S.ESC)return;
if(this.opts.openOnEnter===!1&&e.which===S.ENTER)return;if(this.open(),e.which===S.ENTER)return}}})),this.search.bind("focus",this.bind(function(){this.selection.attr("tabIndex","-1")})),this.search.bind("blur",this.bind(function(){this.opened()||this.container.removeClass("select2-container-active"),window.setTimeout(this.bind(function(){var e=this.opts.element.attr("tabIndex")||0;e?this.selection.attr("tabIndex",e):this.selection.removeAttr("tabIndex")}),10)})),e.delegate("abbr","mousedown",this.bind(function(e){this.enabled&&(this.clear(),u(e),this.close(),this.triggerChange(),this.selection.focus())
})),e.bind("mousedown",this.bind(function(){a=!0,this.opened()?(this.close(),this.selection.focus()):this.enabled&&this.open(),a=!1})),n.bind("mousedown",this.bind(function(){this.search.focus()})),e.bind("focus",this.bind(function(){this.container.addClass("select2-container-active"),this.search.attr("tabIndex","-1")})),e.bind("blur",this.bind(function(){this.opened()||this.container.removeClass("select2-container-active"),window.setTimeout(this.bind(function(){this.search.attr("tabIndex",this.opts.element.attr("tabIndex")||0)
}),10)})),e.bind("keydown",this.bind(function(e){return this.enabled?e.which==S.DOWN||e.which==S.UP||e.which==S.ENTER&&this.opts.openOnEnter?(this.open(),h(e),t):e.which==S.DELETE||e.which==S.BACKSPACE?(this.opts.allowClear&&this.clear(),h(e),t):t:t})),e.bind("keypress",this.bind(function(e){var t=String.fromCharCode(e.which);this.search.val(t),this.open()})),this.setPlaceholder(),this.search.bind("focus",this.bind(function(){this.container.addClass("select2-container-active")}))},clear:function(){this.opts.element.val(""),this.selection.find("span").empty(),this.selection.removeData("select2-data"),this.setPlaceholder()
},initSelection:function(){if(""===this.opts.element.val()&&""===this.opts.element.text())this.close(),this.setPlaceholder();else{var e=this;this.opts.initSelection.call(null,this.opts.element,function(i){i!==t&&null!==i&&(e.updateSelection(i),e.close(),e.setPlaceholder())})}},prepareOpts:function(){var t=this.parent.prepareOpts.apply(this,arguments);return"select"===t.element.get(0).tagName.toLowerCase()&&(t.initSelection=function(t,i){var n=t.find(":selected");e.isFunction(i)&&i({id:n.attr("value"),text:n.text(),element:n})
}),t},setPlaceholder:function(){var e=this.getPlaceholder();if(""===this.opts.element.val()&&e!==t){if(this.select&&""!==this.select.find("option:first").text())return;this.selection.find("span").html(this.opts.escapeMarkup(e)),this.selection.addClass("select2-default"),this.selection.find("abbr").hide()}},postprocessResults:function(i,a){var s=0,r=this,l=!0;this.results.find(".select2-result-selectable").each2(function(e,i){return n(r.id(i.data("select2-data")),r.opts.element.val())?(s=e,!1):t}),this.highlight(s),a===!0&&(l=this.showSearchInput=w(i.results)>=this.opts.minimumResultsForSearch,this.dropdown.find(".select2-search")[l?"removeClass":"addClass"]("select2-search-hidden"),e(this.dropdown,this.container)[l?"addClass":"removeClass"]("select2-with-searchbox"))
},onSelect:function(e){var t=this.opts.element.val();this.opts.element.val(this.id(e)),this.updateSelection(e),this.close(),this.selection.focus(),n(t,this.id(e))||this.triggerChange()},updateSelection:function(e){var i,n=this.selection.find("span");this.selection.data("select2-data",e),n.empty(),i=this.opts.formatSelection(e,n),i!==t&&n.append(this.opts.escapeMarkup(i)),this.selection.removeClass("select2-default"),this.opts.allowClear&&this.getPlaceholder()!==t&&this.selection.find("abbr").show()
},val:function(){var e,i=null,n=this;if(0===arguments.length)return this.opts.element.val();if(e=arguments[0],this.select)this.select.val(e).find(":selected").each2(function(e,t){return i={id:t.attr("value"),text:t.text()},!1}),this.updateSelection(i),this.setPlaceholder(),this.triggerChange();else{if(this.opts.initSelection===t)throw Error("cannot call val() if initSelection() is not defined");if(!e)return this.clear(),this.triggerChange(),t;this.opts.element.val(e),this.opts.initSelection(this.opts.element,function(e){n.opts.element.val(e?n.id(e):""),n.updateSelection(e),n.setPlaceholder(),n.triggerChange()
})}},clearSearch:function(){this.search.val("")},data:function(e){var i;return 0===arguments.length?(i=this.selection.data("select2-data"),i==t&&(i=null),i):(e&&""!==e?(this.opts.element.val(e?this.id(e):""),this.updateSelection(e)):this.clear(),t)}}),A=k(C,{createContainer:function(){var t=e("<div></div>",{"class":"select2-container select2-container-multi"}).html(["    <ul class='select2-choices'>","  <li class='select2-search-field'>","    <input type='text' autocomplete='off' class='select2-input'>","  </li>","</ul>","<div class='select2-drop select2-drop-multi' style='display:none;'>","   <ul class='select2-results'>","   </ul>","</div>"].join(""));
return t},prepareOpts:function(){var t=this.parent.prepareOpts.apply(this,arguments);return"select"===t.element.get(0).tagName.toLowerCase()&&(t.initSelection=function(t,i){var n=[];t.find(":selected").each2(function(e,t){n.push({id:t.attr("value"),text:t.text(),element:t})}),e.isFunction(i)&&i(n)}),t},initContainer:function(){var i,n=".select2-choices";this.searchContainer=this.container.find(".select2-search-field"),this.selection=i=this.container.find(n),this.search.bind("keydown",this.bind(function(e){if(this.enabled){if(e.which===S.BACKSPACE&&""===this.search.val()){this.close();
var n,a=i.find(".select2-search-choice-focus");if(a.length>0)return this.unselect(a.first()),this.search.width(10),h(e),t;n=i.find(".select2-search-choice:not(.select2-locked)"),n.length>0&&n.last().addClass("select2-search-choice-focus")}else i.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus");if(this.opened())switch(e.which){case S.UP:case S.DOWN:return this.moveHighlight(e.which===S.UP?-1:1),h(e),t;case S.ENTER:case S.TAB:return this.selectHighlighted(),h(e),t;case S.ESC:return this.cancel(e),h(e),t
}e.which===S.TAB||S.isControl(e)||S.isFunctionKey(e)||e.which===S.BACKSPACE||e.which===S.ESC||(this.opts.openOnEnter!==!1||e.which!==S.ENTER)&&(this.open(),(e.which===S.PAGE_UP||e.which===S.PAGE_DOWN)&&h(e))}})),this.search.bind("keyup",this.bind(this.resizeSearch)),this.search.bind("blur",this.bind(function(e){this.container.removeClass("select2-container-active"),this.search.removeClass("select2-focused"),this.clearSearch(),e.stopImmediatePropagation()})),this.container.delegate(n,"mousedown",this.bind(function(t){this.enabled&&(e(t.target).closest(".select2-search-choice").length>0||(this.clearPlaceholder(),this.open(),this.focusSearch(),t.preventDefault()))
})),this.container.delegate(n,"focus",this.bind(function(){this.enabled&&(this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"),this.clearPlaceholder())})),this.clearSearch()},enable:function(){this.enabled||(this.parent.enable.apply(this,arguments),this.search.removeAttr("disabled"))},disable:function(){this.enabled&&(this.parent.disable.apply(this,arguments),this.search.attr("disabled",!0))},initSelection:function(){if(""===this.opts.element.val()&&""===this.opts.element.text()&&(this.updateSelection([]),this.close(),this.clearSearch()),this.select||""!==this.opts.element.val()){var e=this;
this.opts.initSelection.call(null,this.opts.element,function(i){i!==t&&null!==i&&(e.updateSelection(i),e.close(),e.clearSearch())})}},clearSearch:function(){var e=this.getPlaceholder();e!==t&&0===this.getVal().length&&this.search.hasClass("select2-focused")===!1?(this.search.val(e).addClass("select2-default"),this.resizeSearch()):this.search.val(" ").width(10)},clearPlaceholder:function(){this.search.hasClass("select2-default")?this.search.val("").removeClass("select2-default"):" "===this.search.val()&&this.search.val("")
},opening:function(){this.parent.opening.apply(this,arguments),this.clearPlaceholder(),this.resizeSearch(),this.focusSearch()},close:function(){this.opened()&&this.parent.close.apply(this,arguments)},focus:function(){this.close(),this.search.focus()},isFocused:function(){return this.search.hasClass("select2-focused")},updateSelection:function(t){var n=[],a=[],s=this;e(t).each(function(){0>i(s.id(this),n)&&(n.push(s.id(this)),a.push(this))}),t=a,this.selection.find(".select2-search-choice").remove(),e(t).each(function(){s.addSelectedChoice(this)
}),s.postprocessResults()},tokenize:function(){var e=this.search.val();e=this.opts.tokenizer(e,this.data(),this.bind(this.onSelect),this.opts),null!=e&&e!=t&&(this.search.val(e),e.length>0&&this.open())},onSelect:function(e){this.addSelectedChoice(e),(this.select||!this.opts.closeOnSelect)&&this.postprocessResults(),this.opts.closeOnSelect?(this.close(),this.search.width(10)):this.countSelectableResults()>0?(this.search.width(10),this.resizeSearch(),this.positionDropdown()):this.close(),this.triggerChange({added:e}),this.focusSearch()
},cancel:function(){this.close(),this.focusSearch()},addSelectedChoice:function(i){var n,a=!i.locked,s=e("<li class='select2-search-choice'>    <div></div>    <a href='#' onclick='return false;' class='select2-search-choice-close' tabindex='-1'></a></li>"),r=e("<li class='select2-search-choice select2-locked'><div></div></li>"),l=a?s:r,o=this.id(i),c=this.getVal();n=this.opts.formatSelection(i,l.find("div")),n!=t&&l.find("div").replaceWith("<div>"+this.opts.escapeMarkup(n)+"</div>"),a&&l.find(".select2-search-choice-close").bind("mousedown",h).bind("click dblclick",this.bind(function(t){this.enabled&&(e(t.target).closest(".select2-search-choice").fadeOut("fast",this.bind(function(){this.unselect(e(t.target)),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus"),this.close(),this.focusSearch()
})).dequeue(),h(t))})).bind("focus",this.bind(function(){this.enabled&&(this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"))})),l.data("select2-data",i),l.insertBefore(this.searchContainer),c.push(o),this.setVal(c)},unselect:function(e){var t,n,a=this.getVal();if(e=e.closest(".select2-search-choice"),0===e.length)throw"Invalid argument: "+e+". Must be .select2-search-choice";t=e.data("select2-data"),n=i(this.id(t),a),n>=0&&(a.splice(n,1),this.setVal(a),this.select&&this.postprocessResults()),e.remove(),this.triggerChange({removed:t})
},postprocessResults:function(){var e=this.getVal(),n=this.results.find(".select2-result-selectable"),a=this.results.find(".select2-result-with-children"),s=this;n.each2(function(t,n){var a=s.id(n.data("select2-data"));i(a,e)>=0?n.addClass("select2-disabled").removeClass("select2-result-selectable"):n.removeClass("select2-disabled").addClass("select2-result-selectable")}),a.each2(function(e,t){t.is(".select2-result-selectable")||0!=t.find(".select2-result-selectable").length?t.removeClass("select2-disabled"):t.addClass("select2-disabled")
}),-1==this.highlight()&&n.each2(function(e,i){return!i.hasClass("select2-disabled")&&i.hasClass("select2-result-selectable")?(s.highlight(0),!1):t})},resizeSearch:function(){var e,t,i,n,a,r=s(this.search);e=p(this.search)+10,t=this.search.offset().left,i=this.selection.width(),n=this.selection.offset().left,a=i-(t-n)-r,e>a&&(a=i-r),40>a&&(a=i-r),0>=a&&(a=e),this.search.width(a)},getVal:function(){var e;return this.select?(e=this.select.val(),null===e?[]:e):(e=this.opts.element.val(),a(e,this.opts.separator))
},setVal:function(t){var n;this.select?this.select.val(t):(n=[],e(t).each(function(){0>i(this,n)&&n.push(this)}),this.opts.element.val(0===n.length?"":n.join(this.opts.separator)))},val:function(){var i,n=[],a=this;if(0===arguments.length)return this.getVal();if(i=arguments[0],!i)return this.opts.element.val(""),this.updateSelection([]),this.clearSearch(),this.triggerChange(),t;if(this.setVal(i),this.select)this.select.find(":selected").each(function(){n.push({id:e(this).attr("value"),text:e(this).text()})
}),this.updateSelection(n),this.triggerChange();else{if(this.opts.initSelection===t)throw Error("val() cannot be called if initSelection() is not defined");this.opts.initSelection(this.opts.element,function(t){var i=e(t).map(a.id);a.setVal(i),a.updateSelection(t),a.clearSearch(),a.triggerChange()})}this.clearSearch()},onSortStart:function(){if(this.select)throw Error("Sorting of elements is not supported when attached to <select>. Attach to <input type='hidden'/> instead.");this.search.width(0),this.searchContainer.hide()
},onSortEnd:function(){var t=[],i=this;this.searchContainer.show(),this.searchContainer.appendTo(this.searchContainer.parent()),this.resizeSearch(),this.selection.find(".select2-search-choice").each(function(){t.push(i.opts.id(e(this).data("select2-data")))}),this.setVal(t),this.triggerChange()},data:function(i){var n,a=this;return 0===arguments.length?this.selection.find(".select2-search-choice").map(function(){return e(this).data("select2-data")}).get():(i||(i=[]),n=e.map(i,function(e){return a.opts.id(e)
}),this.setVal(n),this.updateSelection(i),this.clearSearch(),t)}}),e.fn.select2=function(){var n,a,s,r,l=Array.prototype.slice.call(arguments,0),o=["val","destroy","opened","open","close","focus","isFocused","container","onSortStart","onSortEnd","enable","disable","positionDropdown","data"];return this.each(function(){if(0===l.length||"object"==typeof l[0])n=0===l.length?{}:e.extend({},l[0]),n.element=e(this),"select"===n.element.get(0).tagName.toLowerCase()?r=n.element.attr("multiple"):(r=n.multiple||!1,"tags"in n&&(n.multiple=r=!0)),a=r?new A:new _,a.init(n);
else{if("string"!=typeof l[0])throw"Invalid arguments to select2 plugin: "+l;if(0>i(l[0],o))throw"Unknown method: "+l[0];if(s=t,a=e(this).data("select2"),a===t)return;if(s="container"===l[0]?a.container:a[l[0]].apply(a,l.slice(1)),s!==t)return!1}}),s===t?this:s},e.fn.select2.defaults={width:"copy",closeOnSelect:!0,openOnEnter:!0,containerCss:{},dropdownCss:{},containerCssClass:"",dropdownCssClass:"",formatResult:function(e,t,i){var n=[];return f(e.text,i.term,n),n.join("")},formatSelection:function(e){return e?e.text:t
},sortResults:function(e){return e},formatResultCssClass:function(){return t},formatNoMatches:function(){return"No matches found"},formatInputTooShort:function(e,t){var i=t-e.length;return"Please enter "+i+" more character"+(1==i?"":"s")},formatSelectionTooBig:function(e){return"You can only select "+e+" item"+(1==e?"":"s")},formatLoadMore:function(){return"Loading more results..."},formatSearching:function(){return"Searching..."},minimumResultsForSearch:0,minimumInputLength:0,maximumSelectionSize:0,id:function(e){return e.id
},matcher:function(e,t){return t.toUpperCase().indexOf(e.toUpperCase())>=0},separator:",",tokenSeparators:[],tokenizer:x,escapeMarkup:function(e){return e&&"string"==typeof e?e.replace(/&/g,"&amp;"):e},blurOnChange:!1},window.Select2={query:{ajax:m,local:g,tags:v},util:{debounce:o,markMatch:f},"class":{"abstract":C,single:_,multi:A}}}}(jQuery),define("select2",function(){}),define("plex/desktop/view/edit/BaseEditView",["plex/base/control/Dispatcher","plex/base/control/utils/LocalizationUtil","plex/base/model/AppModel","plex/base/view/BaseView","plex/base/view/images/BaseImage","plex/desktop/view/details/ActionBarView","plex/desktop/view/modals/SelectArtworkModal","plex/base/model/FilterModel","jquery","select2"],function(e,t,i,n,a,s,r,l,o){var c=n.extend({className:"details",tagNames:[],poster:null,events:{"click .change-poster-btn":"onChangePosterClick","click .change-banner-btn":"onChangeBannerClick","click .change-background-btn":"onChangeBackgroundClick","click .delete-btn":"onDeleteClick","click .lock-btn":"onLockClick","change .lockable-field":"onFieldChange","keypress .lockable-field":"onFieldKeyPress","click button[type=submit]":"onSubmit","click .cancel-btn":"onCancel"},initialize:function(){this.actionBar=this.registerView(new s({model:this.model})),this.poster=this.registerView(new a(this.getPosterOptions())),this.tagValues={},_.each(this.tagNames,function(e){var t=new l({filter:e,filterType:"string"},{server:this.model.server,section:this.model.section});
this.tagValues[e]=t.get("options")},this),this.addBinding(e,"shortcut:save",this.save)},render:function(){var e=this.model.get("Field"),t={};_.isArray(e)?_.reduce(e,function(e,t){return e[t.name]=t.locked,e},t):_.isEmpty(e)||(t[e.name]=e.locked);var i={media:this.model.toJSON(),serverID:this.model.server.id,showDelete:this.model.server.get("allowMediaDeletion"),sectionID:this.model.section.id,locked:t,type:this.model.get("type")||"item",path:this.model.getMediaLocation()};return this.$el.html(this.tpl(i)),this.$el.prepend(this.actionBar.render().el),this.$(".details-controls").prepend(this.poster.render().el),this.renderTags(),this
},renderTags:function(){var e=_.bind(function(e){var t=e.parentFilter.get("filter");this.$("input[data-name="+t+"]").select2({tags:e.pluck("title"),tokenSeparators:[","]})},this);_.each(this.tagValues,function(t){t.populate().done(e)})},save:function(){var n=this.$("form.edit-metadata-form"),a=_.reduce(n.serializeArray(),function(e,t){return e[t.name]=t.value,e},{}),s=n.find(".lock-btn.selected").map(function(e,t){return{name:o(t).data("field"),locked:"1"}}).get();a.Field=s;var r=this.model.changedAttributes(a)||{};
if("Field"in r){var l=_.reduce(this.model.get("Field"),function(e,t){return n.find(".lock-btn[data-field="+t.name+"]").length&&(e[t.name]="0"),e},{});_.reduce(s,function(e,t){return t.name in e?delete e[t.name]:e[t.name]="1",e},l),r.Field=_.map(l,function(e,t){return{name:t,locked:e}})}var c=_.reduce(n.find("input.input-select2"),function(e,t){var i=o(t),n=i.data("name");n=n.charAt(0).toUpperCase()+n.slice(1);var a=i.val();return e[n]=a?_.map(i.val().split(","),function(e){return{tag:e}}):[],e},{});
_.each(c,function(e,t){var i=_.pluck(this.model.get(t),"tag"),n=_.pluck(e,"tag");_.isEqual(i,n)||(r[t]=e)},this),_.isEmpty(r)?e.trigger("navigate:back"):this.model.save(r,{success:_.bind(function(){e.trigger("navigate:back")},this),error:function(){i.set("alert",{status:"error",message:t.t("There was a problem saving your changes.")})}})},getPosterOptions:function(){if(this.model){var e,t=this.model.get("type"),i=256,n=420,a="img/posters/poster.png";switch(t){case"movie":case"show":case"season":e="poster large-poster movie-poster";
break;case"episode":a="img/posters/poster_wide.png",e="poster large-poster episode-poster";break;case"artist":case"album":case"track":a="img/posters/album.png",e="poster large-poster album-poster";break;case"photoAlbum":case"photo":a="img/posters/photo.png",e="poster large-poster photo-poster"}return{model:this.model,modelAttr:"thumb",placeholder:a,className:e,transcode:!0,width:i,height:n}}},onChangePosterClick:function(e){e.preventDefault();var t=new r({model:this.model,type:"poster"});i.set({modal:t})
},onChangeBannerClick:function(e){e.preventDefault();var t=new r({model:this.model,type:"banner"});i.set({modal:t})},onChangeBackgroundClick:function(e){e.preventDefault();var t=new r({model:this.model,type:"art"});i.set({modal:t})},onDeleteClick:function(t){t.preventDefault(),e.trigger("command:DeleteMedia",this.model)},onLockClick:function(e){e.preventDefault(),o(e.currentTarget).toggleClass("selected")},onFieldChange:function(e){o(e.currentTarget).parent().siblings(".lock-btn").addClass("selected")
},onFieldKeyPress:function(e){o(e.currentTarget).parent().siblings(".lock-btn").addClass("selected")},onSubmit:function(e){e.preventDefault(),this.save()},onCancel:function(t){t.preventDefault(),e.trigger("navigate:back")}});return c}),define("plex/desktop/view/edit/EditMovieView",["hb!templates/desktop/edit/EditMovieView.tpl","plex/desktop/view/edit/BaseEditView"],function(e,t){var i=t.extend({tpl:e,tagNames:["director","writer","genre","collection","country"]});return i}),define("hb!templates/desktop/edit/EditShowView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};
var s,r,l="",o=i.helperMissing,c=this.escapeExpression;return l+='<div class="details-row row-fluid">\n	<div class="details-controls">\n		<a class="btn change-poster-btn" href="#">\n			<i class="glyphicon pencil"></i> ',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Change Poster",r):o.call(t,"t","Change Poster",r)))+'\n		</a>\n		<a class="btn change-banner-btn" href="#">\n			<i class="glyphicon pencil"></i> ',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Change Banner",r):o.call(t,"t","Change Banner",r)))+'\n		</a>\n		<a class="btn change-background-btn" href="#">\n			<i class="glyphicon pencil"></i> ',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Change Background",r):o.call(t,"t","Change Background",r)))+'\n		</a>\n	</div>\n\n	<form class="edit-metadata-form">\n		<fieldset>\n			<div class="row-fluid">\n				<div class="span5">\n					',r={hash:{name:"title",label:"Title",value:(s=t.media,null==s||s===!1?s:s.title),locked:(s=t.locked,null==s||s===!1?s:s.title)},data:a},l+=c((s=i.lockableTextInput||t.lockableTextInput,s?s.call(t,r):o.call(t,"lockableTextInput",r)))+'\n				</div>\n				<div class="span5">\n					',r={hash:{name:"titleSort",label:"Sort Title",value:(s=t.media,null==s||s===!1?s:s.titleSort),locked:(s=t.locked,null==s||s===!1?s:s.titleSort)},data:a},l+=c((s=i.lockableTextInput||t.lockableTextInput,s?s.call(t,r):o.call(t,"lockableTextInput",r)))+'\n				</div>\n				<div class="span2">\n					',r={hash:{name:"year",label:"Year",value:(s=t.media,null==s||s===!1?s:s.year),locked:(s=t.locked,null==s||s===!1?s:s.year)},data:a},l+=c((s=i.lockableTextInput||t.lockableTextInput,s?s.call(t,r):o.call(t,"lockableTextInput",r)))+'\n				</div>\n			</div>\n\n			<div class="row-fluid">\n				<div class="span5">\n					',r={hash:{name:"originalTitle",label:"Original Title",value:(s=t.media,null==s||s===!1?s:s.originalTitle),locked:(s=t.locked,null==s||s===!1?s:s.originalTitle)},data:a},l+=c((s=i.lockableTextInput||t.lockableTextInput,s?s.call(t,r):o.call(t,"lockableTextInput",r)))+'\n				</div>\n				<div class="span3">\n					',r={hash:{name:"rating",label:"Rating",value:(s=t.media,null==s||s===!1?s:s.rating),locked:(s=t.locked,null==s||s===!1?s:s.rating)},data:a},l+=c((s=i.lockableTextInput||t.lockableTextInput,s?s.call(t,r):o.call(t,"lockableTextInput",r)))+'\n				</div>\n				<div class="span4">\n					',r={hash:{name:"contentRating",label:"Content Rating",value:(s=t.media,null==s||s===!1?s:s.contentRating),locked:(s=t.locked,null==s||s===!1?s:s.contentRating)},data:a},l+=c((s=i.lockableTextInput||t.lockableTextInput,s?s.call(t,r):o.call(t,"lockableTextInput",r)))+'\n				</div>\n			</div>\n\n			<div class="row-fluid">\n				<div class="span7">\n					',r={hash:{name:"studio",label:"Studio",value:(s=t.media,null==s||s===!1?s:s.studio),locked:(s=t.locked,null==s||s===!1?s:s.studio)},data:a},l+=c((s=i.lockableTextInput||t.lockableTextInput,s?s.call(t,r):o.call(t,"lockableTextInput",r)))+'\n				</div>\n				<div class="span5">\n					',r={hash:{name:"originallyAvailableAt",label:"Originally Available",value:(s=t.media,null==s||s===!1?s:s.originallyAvailableAt),locked:(s=t.locked,null==s||s===!1?s:s.originallyAvailableAt)},data:a},l+=c((s=i.lockableTextInput||t.lockableTextInput,s?s.call(t,r):o.call(t,"lockableTextInput",r)))+'\n				</div>\n			</div>\n\n			<div class="row-fluid">\n				<div class="span12">\n					',r={hash:{name:"tagline",label:"Tagline",value:(s=t.media,null==s||s===!1?s:s.tagline),locked:(s=t.locked,null==s||s===!1?s:s.tagline)},data:a},l+=c((s=i.lockableTextInput||t.lockableTextInput,s?s.call(t,r):o.call(t,"lockableTextInput",r)))+'\n				</div>\n			</div>\n\n			<div class="row-fluid">\n				<div class="span12">\n					',r={hash:{name:"summary",label:"Summary",type:"textarea",rows:"6",value:(s=t.media,null==s||s===!1?s:s.summary),locked:(s=t.locked,null==s||s===!1?s:s.summary)},data:a},l+=c((s=i.lockableTextInput||t.lockableTextInput,s?s.call(t,r):o.call(t,"lockableTextInput",r)))+'\n				</div>\n			</div>\n\n			<div class="row-fluid">\n				<div class="span6">\n					',r={hash:{name:"genre",label:"Genres",value:(s=t.media,null==s||s===!1?s:s.Genre),locked:(s=t.locked,null==s||s===!1?s:s.genre)},data:a},l+=c((s=i.lockableTagInput||t.lockableTagInput,s?s.call(t,r):o.call(t,"lockableTagInput",r)))+'\n				</div>\n				<div class="span6">\n					',r={hash:{name:"collection",label:"Collections",value:(s=t.media,null==s||s===!1?s:s.Collection),locked:(s=t.locked,null==s||s===!1?s:s.collection)},data:a},l+=c((s=i.lockableTagInput||t.lockableTagInput,s?s.call(t,r):o.call(t,"lockableTagInput",r)))+'\n				</div>\n			</div>\n\n			<div class="form-actions">\n				<button type="submit" class="btn btn-medium btn-primary">',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Save",r):o.call(t,"t","Save",r)))+'</button>\n				<button type="button" class="btn btn-medium cancel-btn">',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Cancel",r):o.call(t,"t","Cancel",r)))+"</button>\n			</div>\n		</fieldset>\n	</form>\n</div>\n"
})}),define("plex/desktop/view/edit/EditShowView",["hb!templates/desktop/edit/EditShowView.tpl","plex/desktop/view/edit/BaseEditView"],function(e,t){var i=t.extend({tpl:e,tagNames:["genre","collection"]});return i}),define("hb!templates/desktop/edit/EditSeasonView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var s,r,l="",o=i.helperMissing,c=this.escapeExpression;return l+='<div class="details-row row-fluid">\n	<div class="details-controls">\n		<a class="btn change-poster-btn" href="#">\n			<i class="glyphicon pencil"></i> ',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Change Poster",r):o.call(t,"t","Change Poster",r)))+'\n		</a>\n		<a class="btn change-background-btn" href="#">\n			<i class="glyphicon pencil"></i> ',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Change Background",r):o.call(t,"t","Change Background",r)))+'\n		</a>\n	</div>\n\n	<form class="edit-metadata-form">\n		<fieldset>\n			<div class="row-fluid">\n				<div class="span12">\n					',r={hash:{name:"summary",label:"Summary",type:"textarea",rows:"6",value:(s=t.media,null==s||s===!1?s:s.summary),locked:(s=t.locked,null==s||s===!1?s:s.summary)},data:a},l+=c((s=i.lockableTextInput||t.lockableTextInput,s?s.call(t,r):o.call(t,"lockableTextInput",r)))+'\n				</div>\n			</div>\n\n			<div class="form-actions">\n				<button type="submit" class="btn btn-medium btn-primary">',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Save",r):o.call(t,"t","Save",r)))+'</button>\n				<button type="button" class="btn btn-medium cancel-btn">',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Cancel",r):o.call(t,"t","Cancel",r)))+"</button>\n			</div>\n		</fieldset>\n	</form>\n</div>\n"
})}),define("plex/desktop/view/edit/EditSeasonView",["hb!templates/desktop/edit/EditSeasonView.tpl","plex/desktop/view/edit/BaseEditView"],function(e,t){var i=t.extend({tpl:e});return i}),define("hb!templates/desktop/edit/EditEpisodeView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a,s="";return s+='\n			<a class="btn btn-danger delete-btn" href="#">\n				<i class="glyphicon ban"></i> ',a={hash:{},data:t},s+=h((n=i.t||e.t,n?n.call(e,"Delete",a):d.call(e,"t","Delete",a)))+"\n			</a>\n		"
}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var r,l,o,c="",d=i.helperMissing,h=this.escapeExpression,u=this;return c+='<div class="details-row row-fluid">\n	<div class="details-controls">\n		<a class="btn change-poster-btn" href="#">\n			<i class="glyphicon pencil"></i> ',o={hash:{},data:a},c+=h((r=i.t||t.t,r?r.call(t,"Change Poster",o):d.call(t,"t","Change Poster",o)))+'\n		</a>\n		<a class="btn change-background-btn" href="#">\n			<i class="glyphicon pencil"></i> ',o={hash:{},data:a},c+=h((r=i.t||t.t,r?r.call(t,"Change Background",o):d.call(t,"t","Change Background",o)))+"\n		</a>\n		",l=i["if"].call(t,t.showDelete,{hash:{},inverse:u.noop,fn:u.program(1,s,a),data:a}),(l||0===l)&&(c+=l),c+='\n	</div>\n\n	<form class="edit-metadata-form">\n		<fieldset>\n			<div class="row-fluid">\n				<div class="span6">\n					',o={hash:{name:"title",label:"Title",value:(r=t.media,null==r||r===!1?r:r.title),locked:(r=t.locked,null==r||r===!1?r:r.title)},data:a},c+=h((r=i.lockableTextInput||t.lockableTextInput,r?r.call(t,o):d.call(t,"lockableTextInput",o)))+'\n				</div>\n				<div class="span6">\n					',o={hash:{name:"titleSort",label:"Sort Title",value:(r=t.media,null==r||r===!1?r:r.titleSort),locked:(r=t.locked,null==r||r===!1?r:r.titleSort)},data:a},c+=h((r=i.lockableTextInput||t.lockableTextInput,r?r.call(t,o):d.call(t,"lockableTextInput",o)))+'\n				</div>\n			</div>\n\n			<div class="row-fluid">\n				<div class="span4">\n					',o={hash:{name:"contentRating",label:"Content Rating",value:(r=t.media,null==r||r===!1?r:r.contentRating),locked:(r=t.locked,null==r||r===!1?r:r.contentRating)},data:a},c+=h((r=i.lockableTextInput||t.lockableTextInput,r?r.call(t,o):d.call(t,"lockableTextInput",o)))+'\n				</div>\n				<div class="span3">\n					',o={hash:{name:"rating",label:"Rating",value:(r=t.media,null==r||r===!1?r:r.rating),locked:(r=t.locked,null==r||r===!1?r:r.rating)},data:a},c+=h((r=i.lockableTextInput||t.lockableTextInput,r?r.call(t,o):d.call(t,"lockableTextInput",o)))+'\n				</div>\n				<div class="span5">\n					',o={hash:{name:"originallyAvailableAt",label:"Originally Available",value:(r=t.media,null==r||r===!1?r:r.originallyAvailableAt),locked:(r=t.locked,null==r||r===!1?r:r.originallyAvailableAt)},data:a},c+=h((r=i.lockableTextInput||t.lockableTextInput,r?r.call(t,o):d.call(t,"lockableTextInput",o)))+'\n				</div>\n			</div>\n\n			<div class="row-fluid">\n				<div class="span12">\n					',o={hash:{name:"summary",label:"Summary",type:"textarea",rows:"8",value:(r=t.media,null==r||r===!1?r:r.summary),locked:(r=t.locked,null==r||r===!1?r:r.summary)},data:a},c+=h((r=i.lockableTextInput||t.lockableTextInput,r?r.call(t,o):d.call(t,"lockableTextInput",o)))+'\n				</div>\n			</div>\n\n			<div class="row-fluid">\n				<div class="span6">\n					',o={hash:{name:"writer",label:"Writers",value:(r=t.media,null==r||r===!1?r:r.Writer),locked:(r=t.locked,null==r||r===!1?r:r.writer)},data:a},c+=h((r=i.lockableTagInput||t.lockableTagInput,r?r.call(t,o):d.call(t,"lockableTagInput",o)))+'\n				</div>\n				<div class="span6">\n					',o={hash:{name:"director",label:"Directors",value:(r=t.media,null==r||r===!1?r:r.Director),locked:(r=t.locked,null==r||r===!1?r:r.director)},data:a},c+=h((r=i.lockableTagInput||t.lockableTagInput,r?r.call(t,o):d.call(t,"lockableTagInput",o)))+'\n				</div>\n			</div>\n\n			<div class="form-actions">\n				<button type="submit" class="btn btn-medium btn-primary">',o={hash:{},data:a},c+=h((r=i.t||t.t,r?r.call(t,"Save",o):d.call(t,"t","Save",o)))+'</button>\n				<button type="button" class="btn btn-medium cancel-btn">',o={hash:{},data:a},c+=h((r=i.t||t.t,r?r.call(t,"Cancel",o):d.call(t,"t","Cancel",o)))+"</button>\n			</div>\n		</fieldset>\n	</form>\n</div>\n"
})}),define("plex/desktop/view/edit/EditEpisodeView",["hb!templates/desktop/edit/EditEpisodeView.tpl","plex/desktop/view/edit/BaseEditView"],function(e,t){var i=t.extend({tpl:e,tagNames:["director","writer"]});return i}),define("hb!templates/desktop/edit/EditAlbumView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var s,r,l="",o=i.helperMissing,c=this.escapeExpression;return l+='<div class="details-row row-fluid">\n	<div class="details-controls">\n		<a class="btn change-poster-btn" href="#">\n			<i class="glyphicon pencil"></i> ',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Change Poster",r):o.call(t,"t","Change Poster",r)))+'\n		</a>\n		<a class="btn change-background-btn" href="#">\n			<i class="glyphicon pencil"></i> ',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Change Background",r):o.call(t,"t","Change Background",r)))+'\n		</a>\n	</div>\n\n	<form class="edit-metadata-form">\n		<fieldset>\n			<div class="row-fluid">\n				<div class="span5">\n					',r={hash:{name:"title",label:"Album",value:(s=t.media,null==s||s===!1?s:s.title),locked:(s=t.locked,null==s||s===!1?s:s.title)},data:a},l+=c((s=i.lockableTextInput||t.lockableTextInput,s?s.call(t,r):o.call(t,"lockableTextInput",r)))+'\n				</div>\n				<div class="span5">\n					',r={hash:{name:"titleSort",label:"Sort Album",value:(s=t.media,null==s||s===!1?s:s.titleSort),locked:(s=t.locked,null==s||s===!1?s:s.titleSort)},data:a},l+=c((s=i.lockableTextInput||t.lockableTextInput,s?s.call(t,r):o.call(t,"lockableTextInput",r)))+'\n				</div>\n				<div class="span2">\n					',r={hash:{name:"year",label:"Year",value:(s=t.media,null==s||s===!1?s:s.year),locked:(s=t.locked,null==s||s===!1?s:s.year)},data:a},l+=c((s=i.lockableTextInput||t.lockableTextInput,s?s.call(t,r):o.call(t,"lockableTextInput",r)))+'\n				</div>\n			</div>\n\n			<div class="row-fluid">\n				<div class="span4">\n					',r={hash:{name:"originallyAvailableAt",label:"Release Date",value:(s=t.media,null==s||s===!1?s:s.originallyAvailableAt),locked:(s=t.locked,null==s||s===!1?s:s.originallyAvailableAt)},data:a},l+=c((s=i.lockableTextInput||t.lockableTextInput,s?s.call(t,r):o.call(t,"lockableTextInput",r)))+'\n				</div>\n				<div class="span3">\n					',r={hash:{name:"rating",label:"Rating",value:(s=t.media,null==s||s===!1?s:s.rating),locked:(s=t.locked,null==s||s===!1?s:s.rating)},data:a},l+=c((s=i.lockableTextInput||t.lockableTextInput,s?s.call(t,r):o.call(t,"lockableTextInput",r)))+'\n				</div>\n				<div class="span5">\n					',r={hash:{name:"studio",label:"Record Label",value:(s=t.media,null==s||s===!1?s:s.studio),locked:(s=t.locked,null==s||s===!1?s:s.studio)},data:a},l+=c((s=i.lockableTextInput||t.lockableTextInput,s?s.call(t,r):o.call(t,"lockableTextInput",r)))+'\n				</div>\n			</div>\n\n			<div class="row-fluid">\n				<div class="span12">\n					',r={hash:{name:"genre",label:"Genres",value:(s=t.media,null==s||s===!1?s:s.Genre),locked:(s=t.locked,null==s||s===!1?s:s.genre)},data:a},l+=c((s=i.lockableTagInput||t.lockableTagInput,s?s.call(t,r):o.call(t,"lockableTagInput",r)))+'\n				</div>\n			</div>\n\n			<div class="row-fluid">\n				<div class="span12">\n					',r={hash:{name:"summary",label:"Review",type:"textarea",rows:"6",value:(s=t.media,null==s||s===!1?s:s.summary),locked:(s=t.locked,null==s||s===!1?s:s.summary)},data:a},l+=c((s=i.lockableTextInput||t.lockableTextInput,s?s.call(t,r):o.call(t,"lockableTextInput",r)))+'\n				</div>\n			</div>\n\n			<div class="form-actions">\n				<button type="submit" class="btn btn-medium btn-primary">',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Save",r):o.call(t,"t","Save",r)))+'</button>\n				<button type="button" class="btn btn-medium cancel-btn">',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Cancel",r):o.call(t,"t","Cancel",r)))+"</button>\n			</div>\n		</fieldset>\n	</form>\n</div>\n"
})}),define("plex/desktop/view/edit/EditAlbumView",["hb!templates/desktop/edit/EditAlbumView.tpl","plex/desktop/view/edit/BaseEditView"],function(e,t){var i=t.extend({tpl:e,tagNames:["genre"]});return i}),define("hb!templates/desktop/edit/EditArtistView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var s,r,l="",o=i.helperMissing,c=this.escapeExpression;return l+='<div class="details-row row-fluid">\n	<div class="details-controls">\n		<a class="btn change-poster-btn" href="#">\n			<i class="glyphicon pencil"></i> ',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Change Poster",r):o.call(t,"t","Change Poster",r)))+'\n		</a>\n		<a class="btn change-background-btn" href="#">\n			<i class="glyphicon pencil"></i> ',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Change Background",r):o.call(t,"t","Change Background",r)))+'\n		</a>\n	</div>\n\n	<form class="edit-metadata-form">\n		<fieldset>\n			<div class="row-fluid">\n				<div class="span6">\n					',r={hash:{name:"title",label:"Artist",value:(s=t.media,null==s||s===!1?s:s.title),locked:(s=t.locked,null==s||s===!1?s:s.title)},data:a},l+=c((s=i.lockableTextInput||t.lockableTextInput,s?s.call(t,r):o.call(t,"lockableTextInput",r)))+'\n				</div>\n				<div class="span6">\n					',r={hash:{name:"titleSort",label:"Sort Artist",value:(s=t.media,null==s||s===!1?s:s.titleSort),locked:(s=t.locked,null==s||s===!1?s:s.titleSort)},data:a},l+=c((s=i.lockableTextInput||t.lockableTextInput,s?s.call(t,r):o.call(t,"lockableTextInput",r)))+'\n				</div>\n			</div>\n\n			<div class="row-fluid">\n				<div class="span9">\n					',r={hash:{name:"tagline",label:"Tagline",value:(s=t.media,null==s||s===!1?s:s.tagline),locked:(s=t.locked,null==s||s===!1?s:s.tagline)},data:a},l+=c((s=i.lockableTextInput||t.lockableTextInput,s?s.call(t,r):o.call(t,"lockableTextInput",r)))+'\n				</div>\n				<div class="span3">\n					',r={hash:{name:"rating",label:"Rating",value:(s=t.media,null==s||s===!1?s:s.rating),locked:(s=t.locked,null==s||s===!1?s:s.rating)},data:a},l+=c((s=i.lockableTextInput||t.lockableTextInput,s?s.call(t,r):o.call(t,"lockableTextInput",r)))+'\n				</div>\n			</div>\n\n			<div class="row-fluid">\n				<div class="span12">\n					',r={hash:{name:"summary",label:"Biography",type:"textarea",rows:"8",value:(s=t.media,null==s||s===!1?s:s.summary),locked:(s=t.locked,null==s||s===!1?s:s.summary)},data:a},l+=c((s=i.lockableTextInput||t.lockableTextInput,s?s.call(t,r):o.call(t,"lockableTextInput",r)))+'\n				</div>\n			</div>\n\n			<div class="row-fluid">\n				<div class="span12">\n					',r={hash:{name:"genre",label:"Genres",value:(s=t.media,null==s||s===!1?s:s.Genre),locked:(s=t.locked,null==s||s===!1?s:s.genre)},data:a},l+=c((s=i.lockableTagInput||t.lockableTagInput,s?s.call(t,r):o.call(t,"lockableTagInput",r)))+'\n				</div>\n			</div>\n\n			<div class="row-fluid">\n				<div class="span12">\n					',r={hash:{name:"collection",label:"Collections",value:(s=t.media,null==s||s===!1?s:s.Collection),locked:(s=t.locked,null==s||s===!1?s:s.collection)},data:a},l+=c((s=i.lockableTagInput||t.lockableTagInput,s?s.call(t,r):o.call(t,"lockableTagInput",r)))+'\n				</div>\n			</div>\n\n			<div class="form-actions">\n				<button type="submit" class="btn btn-medium btn-primary">',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Save",r):o.call(t,"t","Save",r)))+'</button>\n				<button type="button" class="btn btn-medium cancel-btn">',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Cancel",r):o.call(t,"t","Cancel",r)))+"</button>\n			</div>\n		</fieldset>\n	</form>\n</div>\n"
})}),define("plex/desktop/view/edit/EditArtistView",["hb!templates/desktop/edit/EditArtistView.tpl","plex/desktop/view/edit/BaseEditView"],function(e,t){var i=t.extend({tpl:e,tagNames:["genre","collection"]});return i}),define("hb!templates/desktop/edit/EditTrackView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a,s="";return s+='\n			<a class="btn btn-danger delete-btn" href="#">\n				<i class="glyphicon ban"></i> ',a={hash:{},data:t},s+=h((n=i.t||e.t,n?n.call(e,"Delete",a):d.call(e,"t","Delete",a)))+"\n			</a>\n		"
}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var r,l,o,c="",d=i.helperMissing,h=this.escapeExpression,u=this;return c+='<div class="details-row row-fluid">\n	<div class="details-controls">\n		<a class="btn change-poster-btn" href="#">\n			<i class="glyphicon pencil"></i> ',o={hash:{},data:a},c+=h((r=i.t||t.t,r?r.call(t,"Change Poster",o):d.call(t,"t","Change Poster",o)))+'\n		</a>\n		<a class="btn change-background-btn" href="#">\n			<i class="glyphicon pencil"></i> ',o={hash:{},data:a},c+=h((r=i.t||t.t,r?r.call(t,"Change Background",o):d.call(t,"t","Change Background",o)))+"\n		</a>\n		",l=i["if"].call(t,t.showDelete,{hash:{},inverse:u.noop,fn:u.program(1,s,a),data:a}),(l||0===l)&&(c+=l),c+='\n	</div>\n\n	<form class="edit-metadata-form">\n		<fieldset>\n			<div class="row-fluid">\n				<div class="span12">\n					',o={hash:{name:"title",label:"Title",value:(r=t.media,null==r||r===!1?r:r.title),locked:(r=t.locked,null==r||r===!1?r:r.title)},data:a},c+=h((r=i.lockableTextInput||t.lockableTextInput,r?r.call(t,o):d.call(t,"lockableTextInput",o)))+'\n				</div>\n			</div>\n\n			<div class="row-fluid">\n				<div class="span9">\n					',o={hash:{name:"originalTitle",label:"Artist",value:(r=t.media,null==r||r===!1?r:r.originalTitle),locked:(r=t.locked,null==r||r===!1?r:r.originalTitle)},data:a},c+=h((r=i.lockableTextInput||t.lockableTextInput,r?r.call(t,o):d.call(t,"lockableTextInput",o)))+'\n				</div>\n				<div class="span3">\n					',o={hash:{name:"rating",label:"Rating",value:(r=t.media,null==r||r===!1?r:r.rating),locked:(r=t.locked,null==r||r===!1?r:r.rating)},data:a},c+=h((r=i.lockableTextInput||t.lockableTextInput,r?r.call(t,o):d.call(t,"lockableTextInput",o)))+'\n				</div>\n			</div>\n\n			<div class="row-fluid">\n				<div class="span12">\n					',o={hash:{name:"summary",label:"Lyrics",type:"textarea",rows:"6",value:(r=t.media,null==r||r===!1?r:r.summary),locked:(r=t.locked,null==r||r===!1?r:r.summary)},data:a},c+=h((r=i.lockableTextInput||t.lockableTextInput,r?r.call(t,o):d.call(t,"lockableTextInput",o)))+'\n				</div>\n			</div>\n\n			<div class="row-fluid">\n				<div class="span6">\n					',o={hash:{name:"writer",label:"Writers",value:(r=t.media,null==r||r===!1?r:r.Writer),locked:(r=t.locked,null==r||r===!1?r:r.writer)},data:a},c+=h((r=i.lockableTagInput||t.lockableTagInput,r?r.call(t,o):d.call(t,"lockableTagInput",o)))+'\n				</div>\n				<div class="span6">\n					',o={hash:{name:"director",label:"Producers",value:(r=t.media,null==r||r===!1?r:r.Director),locked:(r=t.locked,null==r||r===!1?r:r.director)},data:a},c+=h((r=i.lockableTagInput||t.lockableTagInput,r?r.call(t,o):d.call(t,"lockableTagInput",o)))+'\n				</div>\n			</div>\n\n			<div class="form-actions">\n				<button type="submit" class="btn btn-medium btn-primary">',o={hash:{},data:a},c+=h((r=i.t||t.t,r?r.call(t,"Save",o):d.call(t,"t","Save",o)))+'</button>\n				<button type="button" class="btn btn-medium cancel-btn">',o={hash:{},data:a},c+=h((r=i.t||t.t,r?r.call(t,"Cancel",o):d.call(t,"t","Cancel",o)))+"</button>\n			</div>\n		</fieldset>\n	</form>\n</div>\n"
})}),define("plex/desktop/view/edit/EditTrackView",["hb!templates/desktop/edit/EditTrackView.tpl","plex/base/control/Dispatcher","plex/desktop/view/edit/BaseEditView"],function(e,t,i){var n=i.extend({tpl:e,tagNames:["writer","director"]});return n}),define("hb!templates/desktop/edit/EditPhotoAlbumView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var s,r,l="",o=i.helperMissing,c=this.escapeExpression;return l+='<div class="details-row row-fluid">\n	<div class="details-controls">\n		<a class="btn change-poster-btn" href="#">\n			<i class="glyphicon pencil"></i> ',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Change Poster",r):o.call(t,"t","Change Poster",r)))+'\n		</a>\n		<a class="btn change-background-btn" href="#">\n			<i class="glyphicon pencil"></i> ',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Change Background",r):o.call(t,"t","Change Background",r)))+'\n		</a>\n	</div>\n\n	<form class="edit-metadata-form">\n		<fieldset>\n			<div class="row-fluid">\n				<div class="span6">\n					',r={hash:{name:"title",label:"Title",value:(s=t.media,null==s||s===!1?s:s.title),locked:(s=t.locked,null==s||s===!1?s:s.title)},data:a},l+=c((s=i.lockableTextInput||t.lockableTextInput,s?s.call(t,r):o.call(t,"lockableTextInput",r)))+'\n				</div>\n				<div class="span6">\n					',r={hash:{name:"titleSort",label:"Sort Title",value:(s=t.media,null==s||s===!1?s:s.titleSort),locked:(s=t.locked,null==s||s===!1?s:s.titleSort)},data:a},l+=c((s=i.lockableTextInput||t.lockableTextInput,s?s.call(t,r):o.call(t,"lockableTextInput",r)))+'\n				</div>\n			</div>\n\n			<div class="row-fluid">\n				<div class="span12">\n					',r={hash:{name:"summary",label:"Summary",type:"textarea",rows:"8",value:(s=t.media,null==s||s===!1?s:s.summary),locked:(s=t.locked,null==s||s===!1?s:s.summary)},data:a},l+=c((s=i.lockableTextInput||t.lockableTextInput,s?s.call(t,r):o.call(t,"lockableTextInput",r)))+'\n				</div>\n			</div>\n\n			<div class="form-actions">\n				<button type="submit" class="btn btn-medium btn-primary">',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Save",r):o.call(t,"t","Save",r)))+'</button>\n				<button type="button" class="btn btn-medium cancel-btn">',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Cancel",r):o.call(t,"t","Cancel",r)))+"</button>\n			</div>\n		</fieldset>\n	</form>\n</div>\n"
})}),define("plex/desktop/view/edit/EditPhotoAlbumView",["hb!templates/desktop/edit/EditPhotoAlbumView.tpl","plex/desktop/view/edit/BaseEditView"],function(e,t){var i=t.extend({tpl:e});return i}),define("hb!templates/desktop/edit/EditPhotoView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var s,r,l="",o=i.helperMissing,c=this.escapeExpression;return l+='<div class="details-row row-fluid">\n	<div class="details-controls"></div>\n\n	<form class="edit-metadata-form">\n		<fieldset>\n			<div class="row-fluid">\n				<div class="span5">\n					',r={hash:{name:"title",label:"Title",value:(s=t.media,null==s||s===!1?s:s.title),locked:(s=t.locked,null==s||s===!1?s:s.title)},data:a},l+=c((s=i.lockableTextInput||t.lockableTextInput,s?s.call(t,r):o.call(t,"lockableTextInput",r)))+'\n				</div>\n				<div class="span5">\n					',r={hash:{name:"titleSort",label:"Sort Title",value:(s=t.media,null==s||s===!1?s:s.titleSort),locked:(s=t.locked,null==s||s===!1?s:s.titleSort)},data:a},l+=c((s=i.lockableTextInput||t.lockableTextInput,s?s.call(t,r):o.call(t,"lockableTextInput",r)))+'\n				</div>\n				<div class="span2">\n					',r={hash:{name:"year",label:"Year",value:(s=t.media,null==s||s===!1?s:s.year),locked:(s=t.locked,null==s||s===!1?s:s.year)},data:a},l+=c((s=i.lockableTextInput||t.lockableTextInput,s?s.call(t,r):o.call(t,"lockableTextInput",r)))+'\n				</div>\n			</div>\n\n			<div class="row-fluid">\n				<div class="span12">\n					',r={hash:{name:"summary",label:"Summary",type:"textarea",rows:"8",value:(s=t.media,null==s||s===!1?s:s.summary),locked:(s=t.locked,null==s||s===!1?s:s.summary)},data:a},l+=c((s=i.lockableTextInput||t.lockableTextInput,s?s.call(t,r):o.call(t,"lockableTextInput",r)))+'\n				</div>\n			</div>\n\n			<div class="form-actions">\n				<button type="submit" class="btn btn-medium btn-primary">',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Save",r):o.call(t,"t","Save",r)))+'</button>\n				<button type="button" class="btn btn-medium cancel-btn">',r={hash:{},data:a},l+=c((s=i.t||t.t,s?s.call(t,"Cancel",r):o.call(t,"t","Cancel",r)))+"</button>\n			</div>\n		</fieldset>\n	</form>\n</div>\n"
})}),define("plex/desktop/view/edit/EditPhotoView",["hb!templates/desktop/edit/EditPhotoView.tpl","plex/desktop/view/edit/BaseEditView"],function(e,t){var i=t.extend({tpl:e});return i}),define("plex/desktop/view/edit/EditView",["plex/base/control/Dispatcher","plex/base/view/BaseView","plex/desktop/view/edit/EditMovieView","plex/desktop/view/edit/EditShowView","plex/desktop/view/edit/EditSeasonView","plex/desktop/view/edit/EditEpisodeView","plex/desktop/view/edit/EditAlbumView","plex/desktop/view/edit/EditArtistView","plex/desktop/view/edit/EditTrackView","plex/desktop/view/edit/EditPhotoAlbumView","plex/desktop/view/edit/EditPhotoView","plex/desktop/view/details/UnknownDetailsView"],function(e,t,i,n,a,s,r,l,o,c,d,h){var u=t.extend({className:"container-fluid",initialize:function(){var t=this.model.get("type");
switch(t){case"movie":this.edit=this.registerView(new i({model:this.model}));break;case"show":this.edit=this.registerView(new n({model:this.model}));break;case"season":this.edit=this.registerView(new a({model:this.model}));break;case"episode":this.edit=this.registerView(new s({model:this.model}));break;case"album":this.edit=this.registerView(new r({model:this.model}));break;case"artist":this.edit=this.registerView(new l({model:this.model}));break;case"track":this.edit=this.registerView(new o({model:this.model}));
break;case"photoAlbum":this.edit=this.registerView(new c({model:this.model}));break;case"photo":this.edit=this.registerView(new d({model:this.model}));break;default:this.$el.addClass("error-container"),this.edit=this.registerView(new h({model:this.model}))}e.trigger("show:background",this.model)},render:function(){return this.$el.empty(),this.$el.prepend(this.edit.render().el),this},destroy:function(){t.prototype.destroy.call(this),this.model.release()}});return u}),define("hb!templates/desktop/channels/ChannelDirectoryView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t,n){var a,s,l,o="";
return o+='\n				<li>\n					<a class="',l={hash:{},inverse:c.noop,fn:c.program(2,r,t),data:t},a=i.if_eq||n.if_eq,s=a?a.call(e,n.activeFilter,e.key,l):d.call(e,"if_eq",n.activeFilter,e.key,l),(s||0===s)&&(o+=s),o+='" href="#!/directory?filter=',l={hash:{},data:t},o+=h((a=i.encodeUrl||e.encodeUrl,a?a.call(e,e.key,l):d.call(e,"encodeUrl",e.key,l)))+'">\n						',l={hash:{},data:t},o+=h((a=i.t||e.t,a?a.call(e,e.title,l):d.call(e,"t",e.title,l)))+"\n					</a>\n				</li>\n			"}function r(){return"active"
}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var l,o="",c=this,d=i.helperMissing,h=this.escapeExpression;return o+='<div id="directory-container" class="well">\n	<div class="well-header directory-header">\n		<ul class="subnav-list well-header-list directory-header-list">\n			',l=i.each.call(t,t.filters,{hash:{},inverse:c.noop,fn:c.programWithDepth(1,s,a,t),data:a}),(l||0===l)&&(o+=l),o+="\n		</ul>\n	</div>\n</div>\n"})}),define("hb!templates/desktop/lists/channels/items/ChannelDirectoryListItem.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};
var s,r,l="",o=i.helperMissing,c=this.escapeExpression;return l+='<a href="#!/directory?filter=',r={hash:{},data:a},l+=c((s=i.encodeUrl||t.encodeUrl,s?s.call(t,t.activeFilter,r):o.call(t,"encodeUrl",t.activeFilter,r)))+"&key=",r={hash:{},data:a},l+=c((s=i.encodeUrl||t.encodeUrl,s?s.call(t,(s=t.directory,null==s||s===!1?s:s.key),r):o.call(t,"encodeUrl",(s=t.directory,null==s||s===!1?s:s.key),r)))+'">\n	',r={hash:{},data:a},l+=c((s=i.truncate||t.truncate,s?s.call(t,(s=t.directory,null==s||s===!1?s:s.title),40,r):o.call(t,"truncate",(s=t.directory,null==s||s===!1?s:s.title),40,r)))+"\n</a>\n"
})}),define("plex/desktop/view/lists/channels/items/ChannelDirectoryListItem",["hb!templates/desktop/lists/channels/items/ChannelDirectoryListItem.tpl","plex/base/control/Dispatcher","plex/base/model/AppModel","plex/base/model/collections/PreferenceCollection","plex/base/view/BaseView","plex/desktop/view/modals/ChannelSettingsModal"],function(e,t,i,n,a,s){var r=a.extend({tagName:"li",events:{"click a":"onClick"},initialize:function(e){this.list=e.list,this.addBinding(this.model,"change",this.render)
},render:function(){return this.$el.html(e({serverID:this.model.server.id,activeFilter:this.list.activeFilter,directory:this.model.toJSON()})),this},onClick:function(e){if(/\/updates$/.test(this.model.id))e.preventDefault(),t.trigger("command:UpdateChannel",{server:this.model.server});else if(/\/prefs$/.test(this.model.id)){e.preventDefault();var a=new n([],{server:this.model.server,url:this.model.id});a.fetch().done(_.bind(function(){i.set("modal",new s({model:this.model,collection:a}))},this))}}});
return r}),define("plex/desktop/view/lists/channels/ChannelDirectoryList",["plex/base/view/lists/BaseList","plex/desktop/view/lists/channels/items/ChannelDirectoryListItem"],function(e,t){var i=e.extend({tagName:"ul",className:"list media-list media-compact-list channel-directory-list",initialize:function(e){this.activeFilter=e.activeFilter,this.setup(t)},render:function(){return this.$el.empty(),this.populate(this.collection),this}});return i}),define("plex/desktop/view/channels/ChannelDirectoryView",["hb!templates/desktop/channels/ChannelDirectoryView.tpl","plex/base/control/Dispatcher","plex/base/model/collections/ChannelCollection","plex/base/view/BaseView","plex/desktop/view/channels/ChannelNavView","plex/desktop/view/lists/channels/ChannelDirectoryList","plex/desktop/view/lists/channels/ChannelTileList","jquery"],function(e,t,i,n,a,s,r){var l=n.extend({className:"container",subnav:null,channels:null,channelList:null,initialize:function(e){this.activeFilter=e.activeFilter||"/system/appstore/featured",this.activeKey=e.activeKey||this.activeFilter,this.subnav=this.registerView(new a({model:this.collection.server,active:"directory"})),this.channels=new i([],{server:this.collection.server,url:this.activeKey}),this.channels.fetch().done(_.bind(function(){this.channelList="Store:Info"===this.channels.viewGroup?this.registerView(new r({collection:this.channels})):this.registerView(new s({collection:this.channels,activeFilter:this.activeFilter})),this.$("#directory-container").append(this.channelList.render().el)
},this)).fail(function(){t.trigger("navigate:error","The channel directory is currently unavailable.")})},render:function(){return this.$el.html(e({activeFilter:this.activeFilter,filters:this.collection.toJSON()})),this.$el.prepend(this.subnav.render().el),this.channelList&&this.$("#directory-container").append(this.channelList.render().el),this}});return l}),define("hb!templates/desktop/InfoView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a="";return a+="\n		<p>\n			<strong>",(n=i.label)?n=n.call(e,{hash:{},data:t}):(n=e.label,n=typeof n===d?n.apply(e):n),a+=h(n)+":</strong> ",(n=i.value)?n=n.call(e,{hash:{},data:t}):(n=e.value,n=typeof n===d?n.apply(e):n),a+=h(n)+"\n		</p>\n	"
}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var r,l,o,c="",d="function",h=this.escapeExpression,u=i.helperMissing,p=this;return c+='<div class="well">\n	<div class="well-header">\n		<h3>',o={hash:{},data:a},c+=h((r=i.t||t.t,r?r.call(t,"Info",o):u.call(t,"t","Info",o)))+"</h3>\n	</div>\n\n	",l=i.each.call(t,t.items,{hash:{},inverse:p.noop,fn:p.program(1,s,a),data:a}),(l||0===l)&&(c+=l),c+="\n</div>\n"})}),define("plex/desktop/view/InfoView",["hb!templates/desktop/InfoView.tpl","plex/base/model/DebugInfoModel","plex/base/view/BaseView"],function(e,t,i){var n={host:"Host",userAgent:"User Agent",browser:"Browser Info",clientVersion:"Bundle Version",isAuthorized:"Is Authorized",isAvailable:"Is Available",primaryServerUrl:"Server URL",primaryServerAuthToken:"Server Auth Token",primaryServerVersion:"Server Version",myPlexUrl:"myPlex URL",myPlexFeatures:"myPlex Subscriptions",myPlexUsername:"myPlex Username",myPlexAuthToken:"myPlex Auth Token"},a=i.extend({className:"container",render:function(){var i=t.toJSON(),a=_.map(_.keys(i),function(e){return{label:n[e]||e,value:t.get(e)}
});return this.$el.html(e({items:a})),this}});return a}),define("hb!templates/desktop/LogView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var s,r,l,o="",c=i.helperMissing,d=this.escapeExpression,h="function";return o+='<div class="well">\n	<!--\n		TODO(schuyler): On browsers with a filesystem API, we can probably offer this content as a download...\n	-->\n	<div class="well-header">\n		<h3>',l={hash:{},data:a},o+=d((s=i.t||t.t,s?s.call(t,"Logs",l):c.call(t,"t","Logs",l)))+'</h3>\n	</div>\n\n	<textarea class="input-logs">',(r=i.blob)?r=r.call(t,{hash:{},data:a}):(r=t.blob,r=typeof r===h?r.apply(t):r),o+=d(r)+"</textarea>\n</div>\n"
})}),define("plex/desktop/view/LogView",["hb!templates/desktop/LogView.tpl","plex/base/view/BaseView","plex/base/control/utils/LogUtil"],function(e,t,i){var n=t.extend({className:"container",render:function(){var t=i.getLogsAsJSON(!0);return this.$el.html(e({blob:t})),this}});return n}),define("plex/desktop/control/BaseDesktopRouter",["plex/base/control/Dispatcher","plex/base/control/BaseRouter","plex/desktop/control/Navigator","plex/base/model/AppModel","plex/base/model/HeaderModel","plex/base/model/collections/ChannelCollection","plex/desktop/view/AppView","plex/desktop/view/dashboard/DashboardView","plex/desktop/view/myplex/PlaylistView","plex/desktop/view/SearchView","plex/desktop/view/server/settings/SettingsView","plex/desktop/view/section/SectionView","plex/desktop/view/section/SectionFolderView","plex/desktop/view/details/DetailsView","plex/desktop/view/channels/MyChannelsView","plex/desktop/view/channels/ChannelView","plex/desktop/view/LoginView","plex/desktop/view/UnsupportedBrowserView","plex/base/view/ErrorView","plex/desktop/view/setup/SetupView","plex/desktop/view/myplex/FriendsView","plex/desktop/view/server/NotificationsView","plex/desktop/view/server/SyncStatusView","plex/desktop/view/server/NowPlayingView","plex/desktop/view/edit/EditView","plex/desktop/view/channels/ChannelDirectoryView","plex/desktop/view/InfoView","plex/desktop/view/LogView"],function(e,t,i,n,a,s,r,l,o,c,d,h,u,p,f,m,g,v,y,b,w,x,k,S,C,A,I,T){var M=t.extend({routes:_.extend({"!/setup":"setup","!/friends":"friends","!/notifications/:serverID":"notifications","!/notifications":"notifications","!/sync/:serverID":"sync","!/sync":"sync","!/nowplaying/:serverID":"nowplaying","!/nowplaying":"nowplaying","!/servers/:serverID/sections/:sectionID/edit/:mediaID":"edit","!/directory?filter=:filter&key=:key":"directory","!/directory?filter=:filter":"directory","!/directory/:serverID":"directoryByServer","!/directory":"directory","!/info":"info","!/logs":"logs"},t.prototype.routes),views:{app:r,dashboard:l,playlist:o,search:c,settings:d,section:h,sectionFolder:u,details:p,myChannels:f,channel:m,login:g,unsupported:v,error:y,setup:b,friends:w,notifications:x,sync:k,nowplaying:S,edit:C,directory:A,info:I,logs:T},initialize:function(){t.prototype.initialize.call(this,{Navigator:i})
},setup:function(){a.reset(),n.set("view",new this.views.setup({model:n.get("primaryServer")}))},friends:function(){a.reset();var t=this.views.friends,i=n.get("myPlex"),s=i.get("friends"),r=i.get("friendRequests");return i.get("signedIn")?(s.fetch().done(function(){n.set("view",new t({collection:s,requests:r}))}).fail(function(t,i){e.trigger("navigate:error","Please sign in to myPlex to access your friends.",i)}),void 0):(e.trigger("navigate:login"),void 0)},notifications:function(t){a.reset("activity");
var i=this.views.notifications;if(t)this.populateActiveObjects(t).done(_.bind(function(e){this.checkServerAuthorization(e.activeServer)&&n.set("view",new i({model:e.activeServer}))},this)).fail(function(t,i){e.trigger("navigate:error","This media server is currently unavailable.",i)});else{var s=n.get("primaryServer");this.checkServerAuthorization(s)&&n.set("view",new i({model:s}))}},sync:function(t){a.reset("activity");var i=this.views.sync;if(t)this.populateActiveObjects(t).done(_.bind(function(e){this.checkServerAuthorization(e.activeServer)&&n.set("view",new i({model:e.activeServer}))
},this)).fail(function(t,i){e.trigger("navigate:error","This media server is currently unavailable.",i)});else{var s=n.get("primaryServer");this.checkServerAuthorization(s)&&n.set("view",new i({model:s}))}},nowplaying:function(t){a.reset("activity");var i=this.views.nowplaying;if(t)this.populateActiveObjects(t).done(_.bind(function(e){this.checkServerAuthorization(e.activeServer)&&n.set("view",new i({model:e.activeServer,collection:e.activeServer.get("sessions")}))},this)).fail(function(t,i){e.trigger("navigate:error","This media server is currently unavailable.",i)
});else{var s=n.get("primaryServer");this.checkServerAuthorization(s)&&n.set("view",new i({model:s,collection:s.get("sessions")}))}},edit:function(t,i,s){var r=this.views.edit;this.populateActiveObjects(t,decodeURIComponent(i),s).done(_.bind(function(e){a.set(e),this.checkServerAuthorization(e.activeServer)&&n.set("view",new r({model:e.activeMedia.get("media")}))},this)).fail(function(t,i){e.trigger("navigate:error","This media is currently unavailable.",i)})},directory:function(t,i){a.reset();var r=this.views.directory,l=n.get("primaryServer");
if(t&&(t=decodeURIComponent(t)),i&&(i=decodeURIComponent(i)),this.checkServerAuthorization(l)){var o=new s([],{server:l,url:"system/appstore"});o.fetch().done(function(){n.set("view",new r({collection:o,activeFilter:t,activeKey:i}))}).fail(function(t,i){e.trigger("navigate:error","The channel directory is currently unavailable.",i)})}},directoryByServer:function(t){a.reset();var i=this.views.directory,r=_.bind(function(t){if(this.checkServerAuthorization(t)){var a=new s([],{server:t,url:"system/appstore"});
a.fetch().done(function(){n.set("view",new i({collection:a}))}).fail(function(t,i){e.trigger("navigate:error","The channel directory is currently unavailable.",i)})}},this);t?this.populateActiveObjects(t).done(function(e){r(e.activeServer)}).fail(function(t,i){e.trigger("navigate:error","This media server is currently unavailable.",i)}):r(n.get("primaryServer"))},info:function(){a.reset(),n.set("view",new this.views.info)},logs:function(){a.reset(),n.set("view",new this.views.logs)}});return M}),define("hb!templates/desktop/players/VideoPlayerView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a="";
return a+="\n		",n=i["if"].call(e,e.showRecommend,{hash:{},inverse:I.noop,fn:I.program(2,r,t),data:t}),(n||0===n)&&(a+=n),a+="\n\n		",n=i["if"].call(e,e.showShare,{hash:{},inverse:I.noop,fn:I.program(4,l,t),data:t}),(n||0===n)&&(a+=n),a+="\n	"}function r(e,t){var n,a,s="";return s+='\n			<a class="recommend-btn player-action-btn" href="#"><i class="glyphicon share-alt"></i> ',a={hash:{},data:t},s+=A((n=i.t||e.t,n?n.call(e,"Recommend",a):_.call(e,"t","Recommend",a)))+"</a>\n		"}function l(e,t){var n,a,s="";
return s+='\n			<a class="share-btn player-action-btn" href="#"><i class="glyphicon share"></i> ',a={hash:{},data:t},s+=A((n=i.t||e.t,n?n.call(e,"Share",a):_.call(e,"t","Share",a)))+"</a>\n		"}function o(e,t){var n,a,s="";return s+="\n			",a=i["if"].call(e,(n=e.media,null==n||n===!1?n:n.grandparentTitle),{hash:{},inverse:I.program(12,u,t),fn:I.program(7,c,t),data:t}),(a||0===a)&&(s+=a),s+="\n		"}function c(e,t){var n,a,s,r="";return r+='\n				<a href="#!/servers/',(n=i.serverID)?n=n.call(e,{hash:{},data:t}):(n=e.serverID,n=typeof n===T?n.apply(e):n),r+=A(n)+"/sections/",s={hash:{},data:t},r+=A((n=i.encodeUrl||e.encodeUrl,n?n.call(e,e.sectionID,s):_.call(e,"encodeUrl",e.sectionID,s)))+"/details/"+A((n=e.media,n=null==n||n===!1?n:n.grandparentRatingKey,typeof n===T?n.apply(e):n))+'">'+A((n=e.media,n=null==n||n===!1?n:n.grandparentTitle,typeof n===T?n.apply(e):n))+'</a> <a class="secondary" href="#!/servers/',(a=i.serverID)?a=a.call(e,{hash:{},data:t}):(a=e.serverID,a=typeof a===T?a.apply(e):a),r+=A(a)+"/sections/",s={hash:{},data:t},r+=A((n=i.encodeUrl||e.encodeUrl,n?n.call(e,e.sectionID,s):_.call(e,"encodeUrl",e.sectionID,s)))+"/details/",a=i["if"].call(e,(n=e.media,null==n||n===!1?n:n.originalRatingKey),{hash:{},inverse:I.program(10,h,t),fn:I.program(8,d,t),data:t}),(a||0===a)&&(r+=a),r+='">'+A((n=e.media,n=null==n||n===!1?n:n.title,typeof n===T?n.apply(e):n))+"</a>\n			"
}function d(e){var t;return A((t=e.media,t=null==t||t===!1?t:t.originalRatingKey,typeof t===T?t.apply(e):t))}function h(e){var t;return A((t=e.media,t=null==t||t===!1?t:t.ratingKey,typeof t===T?t.apply(e):t))}function u(e,t){var n,a,s,r="";return r+='\n				<a href="#!/servers/',(n=i.serverID)?n=n.call(e,{hash:{},data:t}):(n=e.serverID,n=typeof n===T?n.apply(e):n),r+=A(n)+"/sections/",s={hash:{},data:t},r+=A((n=i.encodeUrl||e.encodeUrl,n?n.call(e,e.sectionID,s):_.call(e,"encodeUrl",e.sectionID,s)))+"/details/",a=i["if"].call(e,(n=e.media,null==n||n===!1?n:n.originalRatingKey),{hash:{},inverse:I.program(10,h,t),fn:I.program(8,d,t),data:t}),(a||0===a)&&(r+=a),r+='">'+A((n=e.media,n=null==n||n===!1?n:n.title,typeof n===T?n.apply(e):n))+"</a>\n			"
}function p(e,t){var n,a,s="";return s+='\n			<span class="primary">',a={hash:{},data:t},s+=A((n=i.truncate||e.truncate,n?n.call(e,(n=e.media,null==n||n===!1?n:n.title),40,a):_.call(e,"truncate",(n=e.media,null==n||n===!1?n:n.title),40,a)))+"</span>\n		"}function f(e,t){var n,a,s,r="";return r+="\n				",s={hash:{},data:t},r+=A((n=i.t||e.t,n?n.call(e,"Season",s):_.call(e,"t","Season",s)))+" "+A((n=e.media,n=null==n||n===!1?n:n.parentIndex,typeof n===T?n.apply(e):n)),a=i["if"].call(e,(n=e.media,null==n||n===!1?n:n.index),{hash:{},inverse:I.noop,fn:I.program(17,m,t),data:t}),(a||0===a)&&(r+=a),r+=" &nbsp;&middot;&nbsp;\n			"
}function m(e,t){var n,a,s="";return s+=", ",a={hash:{},data:t},s+=A((n=i.t||e.t,n?n.call(e,"Episode",a):_.call(e,"t","Episode",a)))+" "+A((n=e.media,n=null==n||n===!1?n:n.index,typeof n===T?n.apply(e):n))}function g(e,t){var n,a,s="";return s+="\n				",a={hash:{},data:t},s+=A((n=i.formatDate||e.formatDate,n?n.call(e,(n=e.media,null==n||n===!1?n:n.originallyAvailableAt),a):_.call(e,"formatDate",(n=e.media,null==n||n===!1?n:n.originallyAvailableAt),a)))+"\n			"}function v(e,t){var n,a,s="";return s+="\n				",a=i["if"].call(e,(n=e.media,null==n||n===!1?n:n.year),{hash:{},inverse:I.noop,fn:I.program(22,y,t),data:t}),(a||0===a)&&(s+=a),s+="\n			"
}function y(e){var t,i="";return i+="\n					"+A((t=e.media,t=null==t||t===!1?t:t.year,typeof t===T?t.apply(e):t))+"\n				"}function b(e,t){var n,a,s="";return s+="\n				&nbsp;&middot;&nbsp; ",a={hash:{},data:t},s+=A((n=i.formatMinutes||e.formatMinutes,n?n.call(e,(n=e.media,null==n||n===!1?n:n.duration),a):_.call(e,"formatMinutes",(n=e.media,null==n||n===!1?n:n.duration),a)))+"\n			"}function w(e,t){var n,a,s="";return s+="\n			<h2>",a={hash:{},data:t},s+=A((n=i.t||e.t,n?n.call(e,"Season",a):_.call(e,"t","Season",a)))+" "+A((n=e.media,n=null==n||n===!1?n:n.parentIndex,typeof n===T?n.apply(e):n))+"</h2>\n		"
}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var x,k,S,C="",_=i.helperMissing,A=this.escapeExpression,I=this,T="function";return C+='<div class="video-details hide">\n	<a class="details-btn player-action-btn" href="#"><i class="glyphicon circle-info"></i> ',S={hash:{},data:a},C+=A((x=i.t||t.t,x?x.call(t,"Details",S):_.call(t,"t","Details",S)))+"</a>\n\n	",k=i.unless.call(t,t.sectionID,{hash:{},inverse:I.noop,fn:I.program(1,s,a),data:a}),(k||0===k)&&(C+=k),C+="\n\n	<h2>\n		",k=i["if"].call(t,t.sectionID,{hash:{},inverse:I.program(14,p,a),fn:I.program(6,o,a),data:a}),(k||0===k)&&(C+=k),C+='\n	</h2>\n\n	<div class="video-more-details">\n		<div class="metadata">\n			',S={hash:{},inverse:I.noop,fn:I.program(16,f,a),data:a},x=i.if_eq||t.if_eq,k=x?x.call(t,(x=t.media,null==x||x===!1?x:x.type),"episode",S):_.call(t,"if_eq",(x=t.media,null==x||x===!1?x:x.type),"episode",S),(k||0===k)&&(C+=k),C+="\n\n			",k=i["if"].call(t,(x=t.media,null==x||x===!1?x:x.originallyAvailableAt),{hash:{},inverse:I.program(21,v,a),fn:I.program(19,g,a),data:a}),(k||0===k)&&(C+=k),C+="\n\n			",k=i["if"].call(t,(x=t.media,null==x||x===!1?x:x.duration),{hash:{},inverse:I.noop,fn:I.program(24,b,a),data:a}),(k||0===k)&&(C+=k),C+='\n		</div>\n\n		<p class="summary">',S={hash:{},data:a},C+=A((x=i.truncate||t.truncate,x?x.call(t,(x=t.media,null==x||x===!1?x:x.summary),700,S):_.call(t,"truncate",(x=t.media,null==x||x===!1?x:x.summary),700,S)))+"</p>\n\n		",S={hash:{},inverse:I.noop,fn:I.program(26,w,a),data:a},x=i.if_eq||t.if_eq,k=x?x.call(t,(x=t.media,null==x||x===!1?x:x.type),"episode",S):_.call(t,"if_eq",(x=t.media,null==x||x===!1?x:x.type),"episode",S),(k||0===k)&&(C+=k),C+="\n	</div>\n</div>\n"
})}),define("hb!templates/desktop/modals/SelectMediaModal.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t,n){var a,s,c,d="";return d+='\n			<li>\n				<a class="media" data-index="'+f((a=t,a=null==a||a===!1?a:a.index,typeof a===m?a.apply(e):a))+'" href="#" data-focus="keyboard">\n					',c={hash:{},inverse:g.program(4,l,t),fn:g.program(2,r,t),data:t},a=i.if_eq||n.if_eq,s=a?a.call(e,n.type,"videoResolution",c):p.call(e,"if_eq",n.type,"videoResolution",c),(s||0===s)&&(d+=s),d+="\n\n					",s=i["if"].call(e,e.videoCodec,{hash:{},inverse:g.noop,fn:g.program(6,o,t),data:t}),(s||0===s)&&(d+=s),d+="\n				</a>\n			</li>\n		"
}function r(e,t){var n,a,s="";return s+="\n						",a={hash:{},data:t},s+=f((n=i.formatResolution||e.formatResolution,n?n.call(e,e.videoResolution,a):p.call(e,"formatResolution",e.videoResolution,a)))+"\n					"}function l(e,t){var n,a,s="";return s+="\n						",a={hash:{},data:t},s+=f((n=i.formatBitrate||e.formatBitrate,n?n.call(e,e.bitrate,0,a):p.call(e,"formatBitrate",e.bitrate,0,a)))+"\n					"}function o(e){var t,i="";return i+="\n						("+f((t=e.videoCodec,typeof t===m?t.apply(e):t))+")\n					"
}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var c,d,h,u="",p=i.helperMissing,f=this.escapeExpression,m="function",g=this;return u+='<div class="modal-header">\n	<button type="button" class="close" data-dismiss="modal"><i class="glyphicon remove-2"></i></button>\n	<h3>',h={hash:{},data:a},u+=f((c=i.t||t.t,c?c.call(t,"Select a Quality",h):p.call(t,"t","Select a Quality",h)))+'</h3>\n</div>\n\n<div class="modal-body minimal-scrollbar">\n	<ul class="select-list">\n		',d=i.each.call(t,t.media,{hash:{},inverse:g.noop,fn:g.programWithDepth(1,s,a,t),data:a}),(d||0===d)&&(u+=d),u+="\n	</ul>\n</div>\n"
})}),define("plex/desktop/view/modals/SelectMediaModal",["hb!templates/desktop/modals/SelectMediaModal.tpl","plex/base/view/modals/BaseModal","jquery"],function(e,t,i){var n=t.extend({name:"selectMediaModal",className:"modal modal-small select-modal fade",media:null,focusOptions:{defaultElement:".select-list a"},events:{hidden:"close","click .media":"onMediaClick"},initialize:function(e){this.media=e.media},render:function(){var t="videoResolution",i=_.uniq(_.pluck(this.media,t));return 2>i.length&&(t="bitrate"),this.$el.html(e({media:this.media,type:t})).modal(),this
},close:function(){this.trigger("select:media",null),t.prototype.close.apply(this,arguments)},onMediaClick:function(e){e.preventDefault();var t=i(e.target).data("index");this.trigger("select:media",this.media[t]),this.$el.modal("hide")}});return n}),define("plex/base/view/players/BaseVideoPlayerView",["hb!templates/desktop/players/VideoPlayerView.tpl","plex/base/control/Dispatcher","plex/base/control/utils/MediaUtil","plex/base/control/utils/LogUtil","plex/desktop/control/utils/Transcoder","plex/base/model/AppModel","plex/base/model/SettingsModel","plex/base/view/BaseView","plex/base/view/Rating","plex/base/view/images/BaseImage","plex/desktop/view/modals/SelectMediaModal","plex/desktop/view/modals/SelectOffsetModal","plex/desktop/view/modals/ShareModal","plex/desktop/view/modals/RecommendModal","plex/desktop/view/lists/media/EpisodeTileList","jquery"],function(e,t,i,n,a,s,r,l,o,c,d,h,u,p,f,m){var g=l.extend({className:"container",transcodeServer:null,media:null,part:null,protocol:"hls",offset:0,volume:100,player:null,url:null,session:null,rating:null,poster:null,episodeList:null,html5:!1,timelineInterval:null,pingInterval:null,events:{"click .share-btn":"onShareClick","click .recommend-btn":"onRecommendClick","click .details-btn":"onDetailsClick","click .episode a":"onEpisodeClick"},initialize:function(e){_.bindAll(this,"timeline","ping","onTranscodeSuccess","onTranscodeError"),this.offset=e.offset,this.volume=r.get("videoVolume");
var i="myPlex"===this.model.server.id||this.model.server.get("synced");this.transcodeServer=i?s.get("primaryServer"):this.model.server,this.rating=this.registerView(new o({model:this.model}));var n=this.model.get("grandparentThumb")||this.model.get("thumb");this.poster=this.registerView(new c({model:this.model,url:n,placeholder:"img/posters/poster.png",className:"poster player-poster",transcode:!0,width:128,height:200})),e.collection&&(this.episodeList=this.registerView(new f({model:this.model,collection:this.collection}))),this.addBinding(this.video,"ready",this.onReady),this.addBinding(this.video,"play",this.onPlay),this.addBinding(this.video,"time",this.onTime),this.addBinding(this.video,"pause",this.onPause),this.addBinding(this.video,"idle",this.onIdle),this.addBinding(this.video,"volume",this.onVolume),this.addBinding(this.video,"ended",this.onEnded),this.addBinding(t,"shortcut:stop",this.onStopShortcut),this.addBinding(t,"shortcut:play",this.onPlayShortcut),this.addBinding(t,"shortcut:pause",this.onPauseShortcut),this.addBinding(t,"shortcut:playPause",this.onPlayPauseShortcut),this.addBinding(t,"shortcut:decreaseVolume",this.onDecreaseVolumeShortcut),this.addBinding(t,"shortcut:increaseVolume",this.onIncreaseVolumeShortcut),this.addBinding(t,"shortcut:seekBackward",this.onSeekBackwardShortcut),this.addBinding(t,"shortcut:seekForward",this.onSeekForwardShortcut),this.addBinding(t,"shortcut:stepBackward",this.onStepBackwardShortcut),this.addBinding(t,"shortcut:stepForward",this.onStepForwardShortcut),this.selectMedia()
},render:function(){var t=s.get("myPlex"),i=t.get("signedIn");return this.$el.html(e({serverID:this.transcodeServer.id,sectionID:this.model.section?this.model.section.id:0,media:this.model.toJSON(),showShare:i,showRecommend:i})),this.$(".metadata").append(this.rating.render().el),this.$(".video-more-details").prepend(this.poster.render().el),this.episodeList&&this.$(".video-more-details").append(this.episodeList.render().el),this},destroy:function(){l.prototype.destroy.call(this),this.timelineInterval&&(clearInterval(this.timelineInterval),this.timelineInterval=null,this.timeline("stopped")),this.pingInterval&&(clearInterval(this.pingInterval),this.pingInterval=null),i.stop(this.transcodeServer,this.session),this.collection&&this.collection.release(),this.model.release()
},selectMedia:function(){var e=this.model.get("Media"),i=_.findWhere(e,{protocol:"embed"});if(i)return this.media=i,this.embedMedia(i),void 0;if(e.length>1)if(r.get("highestResolution"))n.log("automatically selecting highest resolution"),this.media=_.first(e),this.checkMediaParts();else{n.log("waiting for resolution selection");var a=new d({media:e}),l=_.bind(function(e){return a.off("select:media",l),null===e?(t.trigger("navigate:back"),void 0):(this.media=e,this.checkMediaParts(),void 0)},this);
a.on("select:media",l),s.set("modal",a)}else this.media=_.first(e),this.checkMediaParts()},embedMedia:function(e){var t=_.first(e.Part);m.ajax(this.model.server.getAjaxOptions(t.key)).done(_.bind(function(e){this.$(".video-details").prepend(e).removeClass("hide")},this))},checkMediaParts:function(){var e=i.getMissingParts(this.media);if(!e.length)return this.selectOffset(),void 0;var n=e[0];_.defer(function(){1==n.exists?t.trigger("navigate:error","Please check the permissions for this file."):t.trigger("navigate:error","Please check that the file exists and the necessary drive is mounted.")
})},selectOffset:function(){if(this.part||(this.part=_.first(this.media.Part)),!this.media||!this.part)return _.defer(function(){t.trigger("navigate:error","Playback of this video is not supported.")}),void 0;if(this.offset)return this.offset=i.getRelativeOffset(this.media,this.part,this.offset)/1e3,this.resolveIndirect(),void 0;var e=this.model.get("viewOffset")||0;if(e){var n=new h({offset:e}),a=_.bind(function(e){return n.off("select:offset",a),null===e?(t.trigger("navigate:back"),void 0):(this.part=i.getPartByAbsoluteOffset(this.media,e),this.offset=i.getRelativeOffset(this.media,this.part,e)/1e3,this.resolveIndirect(),void 0)
},this);n.on("select:offset",a),s.set("modal",n)}else this.offset=0,this.resolveIndirect()},resolveIndirect:function(){t.trigger("command:ShowLoading",!0),i.resolveIndirect(this.model,this.media,this.part).then(_.bind(this.selectPlayMethod,this)).fail(_.bind(function(){t.trigger("navigate:redirect",this.model.get("url"))},this)).done(function(){t.trigger("command:ShowLoading",!1)})},selectPlayMethod:function(){function e(e){_.defer(function(){t.trigger("navigate:error",e)})}var i=this.canDirectPlay(),s=this.transcodeServer.get("transcoderVideo");
if(n.log("playing "+this.part.key),n.log("direct play: "+i),"webkit"===this.media.protocol)return this.redirect(),void 0;if(i){var r=this.model.server.resolveUrl(this.part.key,!1,!0);/youtube.com/.test(this.part.key)&&"flv"===this.part.container&&(r=this.part.postURL),this.play(r,!0)}else if(s){if("dash"===this.protocol&&!this.transcodeServer.supports("dash"))return e("HTML5 streaming requires Plex Media Server 0.9.8.5 or later."),void 0;a.video(this.transcodeServer,this.model,this.media,this.part,this.onTranscodeSuccess,this.onTranscodeError,{protocol:this.protocol})
}else e("This media server does not support transcoding.")},redirect:function(){var e=this.model.get("url");if(!e){var i=this.part.key.match(/\/webkit\?url=([^&]+)/);i&&i.length>1&&(e=decodeURIComponent(i[1]))}t.trigger("navigate:redirect",e)},play:function(e,i){var a=this.video.canPlayFlash();n.log("html5: "+this.html5),n.log("flash: "+a),_.defer(_.bind(function(){if(!this.html5&&!a)return t.trigger("navigate:error","HLS streaming requires the Flash player or native HLS support."),void 0;this.$(".video-details").removeClass("hide");
var n=this.html5?"html5":"flash";if(this.$el.prepend(this.video.render(n,e).el),!i&&"dash"===this.protocol){var s=new Dash.di.DashContext,r=new MediaPlayer(s);r.startup(),r.autoPlay=!0,r.attachView(this.$("#player")[0]),r.attachSource(e),r.debug.stopLogging()}if("flash"===n){var l=this.calculateHeight(this.video.$el.width());this.video.$el.height(l)}},this))},calculateHeight:function(e){var t=this.model.get("Media")[0];return t.aspectRatio?Math.round(e/t.aspectRatio):Math.round(e/(16/9))},timeline:function(e){var t=this.model.server.get("shared"),a=this.model.server.get("multiuser");
if((!t||a)&&this.model.get("ratingKey")){e||(e=this.video.state());var s={position:this.video.position(),duration:this.video.duration(),state:e};n.log("timeline: "+e+", "+s.position+"/"+s.duration),i.timeline(this.transcodeServer,this.model,this.media,this.part,s)}},ping:function(){n.log("ping"),i.ping(this.transcodeServer,this.session)},canDirectPlay:function(){var e;return this.transcodeServer.get("remote")?(n.log("playing video from remote server"),e=r.get("remoteQuality")):(n.log("playing video from local server"),e=r.get("quality")),this.html5=this.video.canPlayHLS()||this.video.canPlayDash(),(0>e||e>=i.bitrates.length)&&(this.transcodeServer.get("remote")?(e=r.defaults.remoteQuality,r.save("remoteQuality",e)):(e=r.defaults.quality,r.save("quality",e))),r.get("directPlay")?this.hasSubtitles()?(n.log("subtitles are selected"),!1):this.media.bitrate>i.bitrates[e]?(n.log("video bitrate ("+this.media.bitrate+") exceeds quality ("+e+")"),!1):"hls"===this.media.protocol?!0:"flv"===this.media.container?(this.html5=!1,!0):this.video.canDirectPlay(this.media,r.get("directPlayAC3"))?(this.html5=!0,!0):(n.log("video unsupported by direct play"),!1):(n.log("direct play is disabled"),!1)
},hasSubtitles:function(){var e=this.model.getStreams(3),t=!1;return _.each(e,function(e){return e.selected?(t=!0,!1):void 0}),t},onReady:function(){this.video.volume(this.volume)},onPlay:function(){this.timelineInterval||(this.timelineInterval=setInterval(this.timeline,i.timelineDelay)),this.pingInterval&&(clearInterval(this.pingInterval),this.pingInterval=null),this.timeline()},onTime:function(e){if(this.offset&&e){n.log("resuming at "+this.offset);var t="html5"===this.video.type,i=this.offset;
this.offset=null,t&&this.video.pause();var a=0,s=t?10:1,r=10,l=_.bind(function(){if(!(++a>s)){var e=this.video.position();r>e&&i>2*r?(n.log("delayed resume "+a+" at "+i),this.video.position(i),_.delay(l,1e3)):2*r>=i?(n.log("delayed resume at "+i),this.video.position(i),t&&this.video.play()):t&&this.video.play()}},this);l()}},onPause:function(){this.timeline(),this.pingInterval=setInterval(this.ping,i.pingDelay)},onIdle:function(){this.timelineInterval&&(clearInterval(this.timelineInterval),this.timelineInterval=null),this.pingInterval=setInterval(this.ping,i.pingDelay)
},onVolume:function(e){this.volume=e,r.save("videoVolume",this.volume)},onEnded:function(){n.log("ended"),this.timeline(),this.timelineInterval&&(clearInterval(this.timelineInterval),this.timelineInterval=null);var e=this.media.Part;if(e.length>1){var t=_.indexOf(e,this.part);if(e.length>t+1)return n.log("continuing to part "+(t+2)),this.part=e[t+1],this.resolveIndirect(),void 0}this.model.set("viewOffset",0),this.model.set("viewCount",1)},onStopShortcut:function(){t.trigger("navigate:back")},onPlayShortcut:function(){this.video.play()
},onPauseShortcut:function(){this.video.pause()},onPlayPauseShortcut:function(){this.video.playPause()},onDecreaseVolumeShortcut:function(){var e=Math.round(10*(this.video.volume()-.1))/10;this.video.volume(e)},onIncreaseVolumeShortcut:function(){var e=Math.round(10*(this.video.volume()+.1))/10;this.video.volume(e)},onSeekBackwardShortcut:function(){var e=this.video.position()-10;this.video.position(e)},onSeekForwardShortcut:function(){var e=this.video.position()+10;this.video.position(e)},onStepBackwardShortcut:function(){var e=this.video.position()-.1*this.video.duration();
this.video.position(e)},onStepForwardShortcut:function(){var e=this.video.position()+.1*this.video.duration();this.video.position(e)},onTranscodeSuccess:function(e){this.url=e,this.session=s.get("clientID"),this.play(e,!1)},onTranscodeError:function(){t.trigger("navigate:error","There was an error attempting to play this video.")},onShareClick:function(e){e.preventDefault(),s.set("modal",new u({model:this.model}))},onRecommendClick:function(e){e.preventDefault(),s.set("modal",new p({model:this.model}))
},onDetailsClick:function(e){e.preventDefault(),m(e.target).toggleClass("selected"),this.$(".video-more-details").toggleClass("open")},onEpisodeClick:function(){this.session=null}});return g}),define("hb!templates/desktop/players/core/VideoView.tpl",["handlebars"],function(e){return e.template(function(e,t,i,n,a){function s(e,t){var n,a="";return a+='\n	<video id="player" class="video" src="',(n=i.url)?n=n.call(e,{hash:{},data:t}):(n=e.url,n=typeof n===u?n.apply(e):n),a+=p(n)+'" width="100%" height="100%" autoplay controls></video>\n'
}function r(e,t){var n,a,s;return s={hash:{},inverse:f.noop,fn:f.program(4,l,t),data:t},n=i.if_eq||e.if_eq,a=n?n.call(e,e.type,"flash",s):m.call(e,"if_eq",e.type,"flash",s),a||0===a?a:""}function l(){return'\n		<div id="player"></div>\n'}this.compilerInfo=[4,">= 1.0.0"],i=this.merge(i,e.helpers),a=a||{};var o,c,d,h="",u="function",p=this.escapeExpression,f=this,m=i.helperMissing;return d={hash:{},inverse:f.program(3,r,a),fn:f.program(1,s,a),data:a},o=i.if_eq||t.if_eq,c=o?o.call(t,t.type,"html5",d):m.call(t,"if_eq",t.type,"html5",d),(c||0===c)&&(h+=c),h+="\n"
})}),define("plex/base/view/players/core/BaseVideoView",["plex/base/control/Dispatcher","plex/base/control/utils/LogUtil","plex/base/control/utils/BrowserDetect","plex/base/view/BaseView"],function(e,t,i,n){var a={mp4:{mimeType:'video/mp4; codecs="avc1.42E01E"',videoCodec:"h264",audioCodec:"aac",optimizedForStreaming:!0},mkv:{mimeType:"video/webm",videoCodec:"vp8",audioCodec:"vorbis"},ogg:{mimeType:"video/ogg"},hls:{mimeType:"application/x-mpegURL"}},s=n.extend({className:"video-player-container",type:"html5",ready:!1,initialize:function(){_.bindAll(this,"onReady","onPlay","onTime","onPause","onVolume","onEnded")
},postrender:function(){this.ready=!1;var e=this.$("#player");this.video=e[0],e.on("play",this.onPlay),e.on("timeupdate",this.onTime),e.on("pause",this.onPause),e.on("volumechange",this.onVolume),e.on("ended",this.onEnded),this.onReady()},destroy:function(){var e=this.$("#player");e.off("play",this.onPlay),e.off("timeupdate",this.onTime),e.off("pause",this.onPause),e.off("volumechange",this.onVolume),e.off("ended",this.onEnded),this.video=null,n.prototype.destroy.call(this)},play:function(){this.video&&this.video.play()
},pause:function(){this.video&&this.video.pause()},playPause:function(){this.video&&(this.video.paused?this.video.play():this.video.pause())},volume:function(e){return this.video?e===void 0?this.video.volume:(this.video.volume=Math.min(Math.max(e,0),1),this):void 0},position:function(e){return this.video?e===void 0?this.video.currentTime:(e=Math.min(Math.max(e,0),this.duration()),this.video.currentTime=e,this):void 0},duration:function(){return this.video?this.video.duration:void 0},state:function(){return this.video?this.video.ended?"stopped":this.video.paused?"paused":"playing":void 0
},canDirectPlay:function(e,i){var n=a[e.container];if(!n)return!1;var s=_.keys(n);if(s&&s.length){for(var r=0,l=s.length;l>r;r++){var o=s[r],c=n[o],d=e[o];if("mimeType"===o){if(!this.canPlayType(c))return t.log("direct play failed, "+o+": "+c),!1}else if(d!==void 0)if("mp4"===e.container&&"audioCodec"===o&&i){if(!/^(aac|ac3)$/.test(d))return t.log("direct play failed, container: "+e.container+", "+o+": "+d),!1}else if(c!==d)return t.log("direct play failed, container: "+e.container+", "+o+": "+d),!1
}return!0}return!1},canPlayType:function(e){var t=document.createElement("video");return!(!t.canPlayType||!t.canPlayType(e).replace(/^no$/,""))},canPlayDash:function(){return!(!window.MediaSource&&!window.WebKitMediaSource)},canPlayHLS:function(){return this.canPlayType(a.hls.mimeType)||"Android"===i.OS},canPlayFlash:function(){return!1},onReady:function(){this.trigger("ready"),this.ready=!0},onPlay:function(){this.trigger("play")},onTime:function(){this.trigger("time",this.position())},onPause:function(){this.trigger("pause")
},onVolume:function(){this.trigger("volume",this.volume())},onEnded:function(){this.trigger("ended")}});return s}),"undefined"==typeof jwplayer&&(jwplayer=function(e){return jwplayer.api?jwplayer.api.selectPlayer(e):void 0},jwplayer.version="6.5.3609",jwplayer.vid=document.createElement("video"),jwplayer.audio=document.createElement("audio"),jwplayer.source=document.createElement("source"),function(e){function t(e){return function(){return r(e)}}var i=document,n=window,a=navigator,s=e.utils=function(){};
s.exists=function(e){switch(typeof e){case"string":return e.length>0;case"object":return null!==e;case"undefined":return!1}return!0},s.styleDimension=function(e){return e+((""+e).indexOf("%")>0?"":"px")},s.getAbsolutePath=function(e,t){if(s.exists(t)||(t=i.location.href),s.exists(e)){var n;if(s.exists(e)){n=e.indexOf("://");var a=e.indexOf("?");n=n>0&&(0>a||a>n)}else n=void 0;if(n)return e;n=t.substring(0,t.indexOf("://")+3);var r,a=t.substring(n.length,t.indexOf("/",n.length+1));0===e.indexOf("/")?r=e.split("/"):(r=t.split("?")[0],r=r.substring(n.length+a.length+1,r.lastIndexOf("/")),r=r.split("/").concat(e.split("/")));
for(var l=[],o=0;r.length>o;o++)r[o]&&s.exists(r[o])&&"."!=r[o]&&(".."==r[o]?l.pop():l.push(r[o]));return n+a+"/"+l.join("/")}},s.extend=function(){var e=s.extend.arguments;if(e.length>1){for(var t=1;e.length>t;t++)s.foreach(e[t],function(t,i){try{s.exists(i)&&(e[0][t]=i)}catch(n){}});return e[0]}return null},s.log=function(e,t){"undefined"!=typeof console&&console.log!==void 0&&(t?console.log(e,t):console.log(e))};var r=s.userAgentMatch=function(e){return null!==a.userAgent.toLowerCase().match(e)
};s.isIE=t(/msie/i),s.isFF=t(/firefox/i),s.isChrome=t(/chrome/i),s.isIOS=t(/iP(hone|ad|od)/i),s.isIPod=t(/iP(hone|od)/i),s.isIPad=t(/iPad/i),s.isSafari602=t(/Macintosh.*Mac OS X 10_8.*6\.0\.\d* Safari/i),s.isAndroid=function(e){return e?r(RegExp("android.*"+e,"i")):r(/android/i)},s.isMobile=function(){return s.isIOS()||s.isAndroid()},s.saveCookie=function(e,t){i.cookie="jwplayer."+e+"="+t+"; path=/"},s.getCookies=function(){for(var e={},t=i.cookie.split("; "),n=0;t.length>n;n++){var a=t[n].split("=");
0==a[0].indexOf("jwplayer.")&&(e[a[0].substring(9,a[0].length)]=a[1])}return e},s.typeOf=function(e){var t=typeof e;return"object"===t?e?e instanceof Array?"array":t:"null":t},s.translateEventResponse=function(t,i){var n=s.extend({},i);return t!=e.events.JWPLAYER_FULLSCREEN||n.fullscreen?"object"==typeof n.data?(n=s.extend(n,n.data),delete n.data):"object"==typeof n.metadata&&s.deepReplaceKeyName(n.metadata,["__dot__","__spc__","__dsh__","__default__"],["."," ","-","default"]):(n.fullscreen="true"==n.message?!0:!1,delete n.message),s.foreach(["position","duration","offset"],function(e,t){n[t]&&(n[t]=Math.round(1e3*n[t])/1e3)
}),n},s.flashVersion=function(){if(s.isAndroid())return 0;var e,t=a.plugins;try{if("undefined"!==t&&(e=t["Shockwave Flash"]))return parseInt(e.description.replace(/\D+(\d+)\..*/,"$1"))}catch(i){}if(n.ActiveXObject!==void 0)try{if(e=new ActiveXObject("ShockwaveFlash.ShockwaveFlash"))return parseInt(e.GetVariable("$version").split(" ")[1].split(",")[0])}catch(r){}return 0},s.getScriptPath=function(e){for(var t=i.getElementsByTagName("script"),n=0;t.length>n;n++){var a=t[n].src;if(a&&a.indexOf(e)>=0)return a.substr(0,a.indexOf(e))
}return""},s.deepReplaceKeyName=function(t,i,n){switch(e.utils.typeOf(t)){case"array":for(var a=0;t.length>a;a++)t[a]=e.utils.deepReplaceKeyName(t[a],i,n);break;case"object":s.foreach(t,function(a,s){var r;if(i instanceof Array&&n instanceof Array){if(i.length!=n.length)return;r=i}else r=[i];for(var l=a,o=0;r.length>o;o++)l=l.replace(RegExp(i[o],"g"),n[o]);t[l]=e.utils.deepReplaceKeyName(s,i,n),a!=l&&delete t[a]})}return t};var l=s.pluginPathType={ABSOLUTE:0,RELATIVE:1,CDN:2};s.getPluginPathType=function(e){if("string"==typeof e){e=e.split("?")[0];
var t=e.indexOf("://");if(t>0)return l.ABSOLUTE;var i=e.indexOf("/");return e=s.extension(e),!(0>t&&0>i)||e&&isNaN(e)?l.RELATIVE:l.CDN}},s.getPluginName=function(e){return e.replace(/^(.*\/)?([^-]*)-?.*\.(swf|js)$/,"$2")},s.getPluginVersion=function(e){return e.replace(/[^-]*-?([^\.]*).*$/,"$1")},s.isYouTube=function(e){return e.indexOf("youtube.com")>-1||e.indexOf("youtu.be")>-1},s.isRtmp=function(e,t){return 0==e.indexOf("rtmp")||"rtmp"==t},s.foreach=function(e,t){var i,n;for(i in e)e.hasOwnProperty(i)&&(n=e[i],t(i,n))
},s.isHTTPS=function(){return 0==n.location.href.indexOf("https")},s.repo=function(){var t="http://p.jwpcdn.com/"+e.version.split(/\W/).splice(0,2).join("/")+"/";try{s.isHTTPS()&&(t=t.replace("http://","https://ssl."))}catch(i){}return t}}(jwplayer),function(e){var t="video/",i=e.foreach,n={mp4:t+"mp4",vorbis:"audio/ogg",ogg:t+"ogg",webm:t+"webm",aac:"audio/mp4",mp3:"audio/mpeg",hls:"application/vnd.apple.mpegurl"},a={mp4:n.mp4,f4v:n.mp4,m4v:n.mp4,mov:n.mp4,m4a:n.aac,f4a:n.aac,aac:n.aac,mp3:n.mp3,ogv:n.ogg,ogg:n.vorbis,oga:n.vorbis,webm:n.webm,m3u8:n.hls,hls:n.hls},t="video",t={flv:t,f4v:t,mov:t,m4a:t,m4v:t,mp4:t,aac:t,f4a:t,mp3:"sound",smil:"rtmp",m3u8:"hls",hls:"hls"},s=e.extensionmap={};
i(a,function(e,t){s[e]={html5:t}}),i(t,function(e,t){s[e]||(s[e]={}),s[e].flash=t}),s.types=n,s.mimeType=function(e){var t;return i(n,function(i,n){!t&&n==e&&(t=i)}),t},s.extType=function(e){return s.mimeType(a[e])}}(jwplayer.utils),function(e){var t=e.loaderstatus={NEW:0,LOADING:1,ERROR:2,COMPLETE:3},i=document;e.scriptloader=function(n){function a(){r=t.ERROR,o.sendEvent(l.ERROR)}function s(){r=t.COMPLETE,o.sendEvent(l.COMPLETE)}var r=t.NEW,l=jwplayer.events,o=new l.eventdispatcher;e.extend(this,o),this.load=function(){var o=e.scriptloader.loaders[n];
if(!o||o.getStatus()!=t.NEW&&o.getStatus()!=t.LOADING){if(e.scriptloader.loaders[n]=this,r==t.NEW){r=t.LOADING;var c=i.createElement("script");c.addEventListener?(c.onload=s,c.onerror=a):c.readyState&&(c.onreadystatechange=function(){("loaded"==c.readyState||"complete"==c.readyState)&&s()}),i.getElementsByTagName("head")[0].appendChild(c),c.src=n}}else o.addEventListener(l.ERROR,a),o.addEventListener(l.COMPLETE,s)},this.getStatus=function(){return r}},e.scriptloader.loaders={}}(jwplayer.utils),function(e){e.trim=function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")
},e.pad=function(e,t,i){for(i||(i="0");t>e.length;)e=i+e;return e},e.xmlAttribute=function(e,t){for(var i=0;e.attributes.length>i;i++)if(e.attributes[i].name&&e.attributes[i].name.toLowerCase()==t.toLowerCase())return""+e.attributes[i].value;return""},e.extension=function(e){return e&&"rtmp"!=e.substr(0,4)?(e=e.substring(e.lastIndexOf("/")+1,e.length).split("?")[0].split("#")[0],e.lastIndexOf(".")>-1?e.substr(e.lastIndexOf(".")+1,e.length).toLowerCase():void 0):""},e.stringToColor=function(e){return e=e.replace(/(#|0x)?([0-9A-F]{3,6})$/gi,"$2"),3==e.length&&(e=e.charAt(0)+e.charAt(0)+e.charAt(1)+e.charAt(1)+e.charAt(2)+e.charAt(2)),parseInt(e,16)
}}(jwplayer.utils),function(e){e.key=function(t){var i,n,a;this.edition=function(){return a&&a.getTime()<(new Date).getTime()?"invalid":i},this.token=function(){return n},e.exists(t)||(t="");try{t=e.tea.decrypt(t,"36QXq4W@GSBV^teR");var s=t.split("/");(i=s[0])?/^(free|pro|premium|ads)$/i.test(i)?(n=s[1],s[2]&&parseInt(s[2])>0&&(a=new Date,a.setTime(s[2]+""))):i="invalid":i="free"}catch(r){i="invalid"}}}(jwplayer.utils),function(e){var t=e.tea={};t.encrypt=function(e,a){if(0==e.length)return"";var s=t.strToLongs(n.encode(e));
1>=s.length&&(s[1]=0);for(var r,l=t.strToLongs(n.encode(a).slice(0,16)),o=s.length,c=s[o-1],d=s[0],h=Math.floor(6+52/o),u=0;h-->0;){u+=2654435769,r=3&u>>>2;for(var p=0;o>p;p++)d=s[(p+1)%o],c=(c>>>5^d<<2)+(d>>>3^c<<4)^(u^d)+(l[3&p^r]^c),c=s[p]+=c}return s=t.longsToStr(s),i.encode(s)},t.decrypt=function(e,a){if(0==e.length)return"";for(var s,r=t.strToLongs(i.decode(e)),l=t.strToLongs(n.encode(a).slice(0,16)),o=r.length,c=r[o-1],d=r[0],h=2654435769*Math.floor(6+52/o);0!=h;){s=3&h>>>2;for(var u=o-1;u>=0;u--)c=r[u>0?u-1:o-1],c=(c>>>5^d<<2)+(d>>>3^c<<4)^(h^d)+(l[3&u^s]^c),d=r[u]-=c;
h-=2654435769}return r=t.longsToStr(r),r=r.replace(/\0+$/,""),n.decode(r)},t.strToLongs=function(e){for(var t=Array(Math.ceil(e.length/4)),i=0;t.length>i;i++)t[i]=e.charCodeAt(4*i)+(e.charCodeAt(4*i+1)<<8)+(e.charCodeAt(4*i+2)<<16)+(e.charCodeAt(4*i+3)<<24);return t},t.longsToStr=function(e){for(var t=Array(e.length),i=0;e.length>i;i++)t[i]=String.fromCharCode(255&e[i],255&e[i]>>>8,255&e[i]>>>16,255&e[i]>>>24);return t.join("")};var i={code:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e,t){var a,s,r,l,o,c,d=[],h="",u=i.code;
if(c=(t===void 0?0:t)?n.encode(e):e,o=c.length%3,o>0)for(;3>o++;)h+="=",c+="\0";for(o=0;c.length>o;o+=3)a=c.charCodeAt(o),s=c.charCodeAt(o+1),r=c.charCodeAt(o+2),l=a<<16|s<<8|r,a=63&l>>18,s=63&l>>12,r=63&l>>6,l&=63,d[o/3]=u.charAt(a)+u.charAt(s)+u.charAt(r)+u.charAt(l);return d=d.join(""),d=d.slice(0,d.length-h.length)+h},decode:function(e,t){t=t===void 0?!1:t;var a,s,r,l,o,c,d=[],h=i.code;c=t?n.decode(e):e;for(var u=0;c.length>u;u+=4)a=h.indexOf(c.charAt(u)),s=h.indexOf(c.charAt(u+1)),l=h.indexOf(c.charAt(u+2)),o=h.indexOf(c.charAt(u+3)),r=a<<18|s<<12|l<<6|o,a=255&r>>>16,s=255&r>>>8,r&=255,d[u/4]=String.fromCharCode(a,s,r),64==o&&(d[u/4]=String.fromCharCode(a,s)),64==l&&(d[u/4]=String.fromCharCode(a));
return l=d.join(""),t?n.decode(l):l}},n={encode:function(e){return e=e.replace(/[\u0080-\u07ff]/g,function(e){return e=e.charCodeAt(0),String.fromCharCode(192|e>>6,128|63&e)}),e=e.replace(/[\u0800-\uffff]/g,function(e){return e=e.charCodeAt(0),String.fromCharCode(224|e>>12,128|63&e>>6,128|63&e)})},decode:function(e){return e=e.replace(/[\u00e0-\u00ef][\u0080-\u00bf][\u0080-\u00bf]/g,function(e){return e=(15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2),String.fromCharCode(e)}),e=e.replace(/[\u00c0-\u00df][\u0080-\u00bf]/g,function(e){return e=(31&e.charCodeAt(0))<<6|63&e.charCodeAt(1),String.fromCharCode(e)
})}}}(jwplayer.utils),function(e){e.events={COMPLETE:"COMPLETE",ERROR:"ERROR",API_READY:"jwplayerAPIReady",JWPLAYER_READY:"jwplayerReady",JWPLAYER_FULLSCREEN:"jwplayerFullscreen",JWPLAYER_RESIZE:"jwplayerResize",JWPLAYER_ERROR:"jwplayerError",JWPLAYER_SETUP_ERROR:"jwplayerSetupError",JWPLAYER_MEDIA_BEFOREPLAY:"jwplayerMediaBeforePlay",JWPLAYER_MEDIA_BEFORECOMPLETE:"jwplayerMediaBeforeComplete",JWPLAYER_COMPONENT_SHOW:"jwplayerComponentShow",JWPLAYER_COMPONENT_HIDE:"jwplayerComponentHide",JWPLAYER_MEDIA_BUFFER:"jwplayerMediaBuffer",JWPLAYER_MEDIA_BUFFER_FULL:"jwplayerMediaBufferFull",JWPLAYER_MEDIA_ERROR:"jwplayerMediaError",JWPLAYER_MEDIA_LOADED:"jwplayerMediaLoaded",JWPLAYER_MEDIA_COMPLETE:"jwplayerMediaComplete",JWPLAYER_MEDIA_SEEK:"jwplayerMediaSeek",JWPLAYER_MEDIA_TIME:"jwplayerMediaTime",JWPLAYER_MEDIA_VOLUME:"jwplayerMediaVolume",JWPLAYER_MEDIA_META:"jwplayerMediaMeta",JWPLAYER_MEDIA_MUTE:"jwplayerMediaMute",JWPLAYER_MEDIA_LEVELS:"jwplayerMediaLevels",JWPLAYER_MEDIA_LEVEL_CHANGED:"jwplayerMediaLevelChanged",JWPLAYER_CAPTIONS_CHANGED:"jwplayerCaptionsChanged",JWPLAYER_CAPTIONS_LIST:"jwplayerCaptionsList",JWPLAYER_PLAYER_STATE:"jwplayerPlayerState",state:{BUFFERING:"BUFFERING",IDLE:"IDLE",PAUSED:"PAUSED",PLAYING:"PLAYING"},JWPLAYER_PLAYLIST_LOADED:"jwplayerPlaylistLoaded",JWPLAYER_PLAYLIST_ITEM:"jwplayerPlaylistItem",JWPLAYER_PLAYLIST_COMPLETE:"jwplayerPlaylistComplete",JWPLAYER_DISPLAY_CLICK:"jwplayerViewClick",JWPLAYER_CONTROLS:"jwplayerViewControls",JWPLAYER_INSTREAM_CLICK:"jwplayerInstreamClicked",JWPLAYER_INSTREAM_DESTROYED:"jwplayerInstreamDestroyed",JWPLAYER_AD_TIME:"jwplayerAdTime",JWPLAYER_AD_ERROR:"jwplayerAdError",JWPLAYER_AD_CLICK:"jwplayerAdClicked",JWPLAYER_AD_COMPLETE:"jwplayerAdComplete",JWPLAYER_AD_IMPRESSION:"jwplayerAdImpression",JWPLAYER_AD_COMPANIONS:"jwplayerAdCompanions"}
}(jwplayer),function(e){var t=jwplayer.utils;e.eventdispatcher=function(e,i){var n,a;this.resetEventListeners=function(){n={},a=[]},this.resetEventListeners(),this.addEventListener=function(e,i,a){try{t.exists(n[e])||(n[e]=[]),"string"==t.typeOf(i)&&(i=Function("return "+i)()),n[e].push({listener:i,count:a})}catch(s){t.log("error",s)}return!1},this.removeEventListener=function(e,i){if(n[e]){try{for(var a=0;n[e].length>a;a++)if(""+n[e][a].listener==""+i){n[e].splice(a,1);break}}catch(s){t.log("error",s)
}return!1}},this.addGlobalListener=function(e,i){try{"string"==t.typeOf(e)&&(e=Function("return "+e)()),a.push({listener:e,count:i})}catch(n){t.log("error",n)}return!1},this.removeGlobalListener=function(e){if(e){try{for(var i=0;a.length>i;i++)if(""+a[i].listener==""+e){a.splice(i,1);break}}catch(n){t.log("error",n)}return!1}},this.sendEvent=function(s,r){if(t.exists(r)||(r={}),t.extend(r,{id:e,version:jwplayer.version,type:s}),i&&t.log(s,r),"undefined"!=t.typeOf(n[s]))for(var l=0;n[s].length>l;l++){try{n[s][l].listener(r)
}catch(o){t.log("There was an error while handling a listener: "+(""+o),n[s][l].listener)}n[s][l]&&(1===n[s][l].count?delete n[s][l]:n[s][l].count>0&&(n[s][l].count-=1))}for(l=0;a.length>l;l++){try{a[l].listener(r)}catch(c){t.log("There was an error while handling a listener: "+(""+c),a[l].listener)}a[l]&&(1===a[l].count?delete a[l]:a[l].count>0&&(a[l].count-=1))}}}}(jwplayer.events),function(e){var t={},i={};e.plugins=function(){},e.plugins.loadPlugins=function(n,a){return i[n]=new e.plugins.pluginloader(new e.plugins.model(t),a),i[n]
},e.plugins.registerPlugin=function(i,n,a,s){var r=e.utils.getPluginName(i);t[r]||(t[r]=new e.plugins.plugin(i)),t[r].registerPlugin(i,n,a,s)}}(jwplayer),function(e){e.plugins.model=function(t){this.addPlugin=function(i){var n=e.utils.getPluginName(i);return t[n]||(t[n]=new e.plugins.plugin(i)),t[n]},this.getPlugins=function(){return t}}}(jwplayer),function(e){var t=jwplayer.utils,i=jwplayer.events;e.pluginmodes={FLASH:0,JAVASCRIPT:1,HYBRID:2},e.plugin=function(n){function a(){switch(t.getPluginPathType(n)){case t.pluginPathType.ABSOLUTE:return n;
case t.pluginPathType.RELATIVE:return t.getAbsolutePath(n,window.location.href)}}function s(){d=setTimeout(function(){h=t.loaderstatus.COMPLETE,u.sendEvent(i.COMPLETE)},1e3)}function r(){h=t.loaderstatus.ERROR,u.sendEvent(i.ERROR)}var l,o,c,d,h=t.loaderstatus.NEW,u=new i.eventdispatcher;t.extend(this,u),this.load=function(){if(h==t.loaderstatus.NEW)if(n.lastIndexOf(".swf")>0)l=n,h=t.loaderstatus.COMPLETE,u.sendEvent(i.COMPLETE);else if(t.getPluginPathType(n)==t.pluginPathType.CDN)h=t.loaderstatus.COMPLETE,u.sendEvent(i.COMPLETE);
else{h=t.loaderstatus.LOADING;var e=new t.scriptloader(a());e.addEventListener(i.COMPLETE,s),e.addEventListener(i.ERROR,r),e.load()}},this.registerPlugin=function(e,n,a,s){d&&(clearTimeout(d),d=void 0),c=n,a&&s?(l=s,o=a):"string"==typeof a?l=a:"function"==typeof a?o=a:!a&&!s&&(l=e),h=t.loaderstatus.COMPLETE,u.sendEvent(i.COMPLETE)},this.getStatus=function(){return h},this.getPluginName=function(){return t.getPluginName(n)},this.getFlashPath=function(){if(l)switch(t.getPluginPathType(l)){case t.pluginPathType.ABSOLUTE:return l;
case t.pluginPathType.RELATIVE:return n.lastIndexOf(".swf")>0?t.getAbsolutePath(l,window.location.href):t.getAbsolutePath(l,a())}return null},this.getJS=function(){return o},this.getTarget=function(){return c},this.getPluginmode=function(){return l!==void 0&&o!==void 0?e.pluginmodes.HYBRID:l!==void 0?e.pluginmodes.FLASH:o!==void 0?e.pluginmodes.JAVASCRIPT:void 0},this.getNewInstance=function(e,t,i){return new o(e,t,i)},this.getURL=function(){return n}}}(jwplayer.plugins),function(e){var t=e.utils,i=e.events,n=t.foreach;
e.plugins.pluginloader=function(a,s){function r(){h?p.sendEvent(i.ERROR,{message:o}):d||(d=!0,c=t.loaderstatus.COMPLETE,p.sendEvent(i.COMPLETE))}function l(){if(u||r(),!d&&!h){var i=0,n=a.getPlugins();t.foreach(u,function(a){a=t.getPluginName(a);var s=n[a];a=s.getJS();var l=s.getTarget(),s=s.getStatus();s==t.loaderstatus.LOADING||s==t.loaderstatus.NEW?i++:a&&(!l||parseFloat(l)>parseFloat(e.version))&&(h=!0,o="Incompatible player version",r())}),0==i&&r()}}var o,c=t.loaderstatus.NEW,d=!1,h=!1,u=s,p=new i.eventdispatcher;
t.extend(this,p),this.setupPlugins=function(e,i,s){var r={length:0,plugins:{}},l=0,o={},c=a.getPlugins();return n(i.plugins,function(n,a){var d=t.getPluginName(n),h=c[d],u=h.getFlashPath(),p=h.getJS(),f=h.getURL();u&&(r.plugins[u]=t.extend({},a),r.plugins[u].pluginmode=h.getPluginmode(),r.length++);try{if(p&&i.plugins&&i.plugins[f]){var m=document.createElement("div");m.id=e.id+"_"+d,m.style.position="absolute",m.style.top=0,m.style.zIndex=l+10,o[d]=h.getNewInstance(e,t.extend({},i.plugins[f]),m),l++,e.onReady(s(o[d],m,!0)),e.onResize(s(o[d],m))
}}catch(g){t.log("ERROR: Failed to load "+d+".")}}),e.plugins=o,r},this.load=function(){if(!t.exists(s)||"object"==t.typeOf(s)){c=t.loaderstatus.LOADING,n(s,function(e){t.exists(e)&&(e=a.addPlugin(e),e.addEventListener(i.COMPLETE,l),e.addEventListener(i.ERROR,f))});var e=a.getPlugins();n(e,function(e,t){t.load()})}l()};var f=this.pluginFailed=function(){h||(h=!0,o="File not found",r())};this.getStatus=function(){return c}}}(jwplayer),function(e){e.playlist=function(t){var i=[];if("array"==e.utils.typeOf(t))for(var n=0;t.length>n;n++)i.push(new e.playlist.item(t[n]));
else i.push(new e.playlist.item(t));return i}}(jwplayer),function(e){var t=e.item=function(i){var n=jwplayer.utils,a=n.extend({},t.defaults,i);a.tracks=n.exists(i.tracks)?i.tracks:[],0==a.sources.length&&(a.sources=[new e.source(a)]);for(var s=0;a.sources.length>s;s++){var r=a.sources[s]["default"];a.sources[s]["default"]=r?"true"==""+r:!1,a.sources[s]=new e.source(a.sources[s])}if(a.captions&&!n.exists(i.tracks)){for(i=0;a.captions.length>i;i++)a.tracks.push(a.captions[i]);delete a.captions}for(s=0;a.tracks.length>s;s++)a.tracks[s]=new e.track(a.tracks[s]);
return a};t.defaults={description:"",image:"",mediaid:"",title:"",sources:[],tracks:[]}}(jwplayer.playlist),function(e){var t=jwplayer.utils,i={file:void 0,label:void 0,type:void 0,"default":void 0};e.source=function(e){var n=t.extend({},i);return t.foreach(i,function(i){t.exists(e[i])&&(n[i]=e[i],delete e[i])}),n.type&&n.type.indexOf("/")>0&&(n.type=t.extensionmap.mimeType(n.type)),"m3u8"==n.type&&(n.type="hls"),"smil"==n.type&&(n.type="rtmp"),n}}(jwplayer.playlist),function(e){var t=jwplayer.utils,i={file:void 0,label:void 0,kind:"captions","default":!1};
e.track=function(e){var n=t.extend({},i);return e||(e={}),t.foreach(i,function(i){t.exists(e[i])&&(n[i]=e[i],delete e[i])}),n}}(jwplayer.playlist),function(e){var t=e.utils,i=e.events,n=!0,a=!1,r=document,l=e.embed=function(o){function c(e,i){t.foreach(i,function(t,i){"function"==typeof e[t]&&e[t].call(e,i)})}function d(e){p(m,x+e.message)}function h(){p(m,x+"No playable sources found")}function u(){p(m,"Adobe SiteCatalyst Error: Could not find Media Module")}function p(e,i){if(y.fallback){var s=e.style;
s.backgroundColor="#000",s.color="#FFF",s.width=t.styleDimension(y.width),s.height=t.styleDimension(y.height),s.display="table",s.opacity=1;var s=document.createElement("p"),r=s.style;r.verticalAlign="middle",r.textAlign="center",r.display="table-cell",r.font="15px/20px Arial, Helvetica, sans-serif",s.innerHTML=i.replace(":",":<br>"),e.innerHTML="",e.appendChild(s),f(i,n)}else f(i,a)}function f(e,t){S&&(clearTimeout(S),S=null),o.dispatchEvent(i.JWPLAYER_SETUP_ERROR,{message:e,fallback:t})}var m,g,v,y=new l.config(o.config),b=y.width,w=y.height,x="Error loading player: ",k=e.plugins.loadPlugins(o.id,y.plugins),S=null;
return y.fallbackDiv&&(v=y.fallbackDiv,delete y.fallbackDiv),y.id=o.id,g=r.getElementById(o.id),y.aspectratio?o.config.aspectratio=y.aspectratio:delete o.config.aspectratio,m=r.createElement("div"),m.id=g.id,m.style.width=(""+b).indexOf("%")>0?b:b+"px",m.style.height=(""+w).indexOf("%")>0?w:w+"px",g.parentNode.replaceChild(m,g),e.embed.errorScreen=p,k.addEventListener(i.COMPLETE,function(){if(y.sitecatalyst)try{null!=s&&s.hasOwnProperty("Media")||u()}catch(e){return u(),void 0}if("array"==t.typeOf(y.playlist)&&2>y.playlist.length&&(0==y.playlist.length||!y.playlist[0].sources||0==y.playlist[0].sources.length))h();
else if(k.getStatus()==t.loaderstatus.COMPLETE){for(var r=0;y.modes.length>r;r++)if(y.modes[r].type&&l[y.modes[r].type]){var p=t.extend({},y),g=new l[y.modes[r].type](m,y.modes[r],p,k,o);if(g.supportsConfig())return g.addEventListener(i.ERROR,d),g.embed(),c(o,p.events),o}if(y.fallback){var b="No suitable players found and fallback enabled";S=setTimeout(function(){f(b,n)},10),t.log(b),new l.download(m,y,h)}else b="No suitable players found and fallback disabled",f(b,a),t.log(b),m.parentNode.replaceChild(v,m)
}}),k.addEventListener(i.ERROR,function(e){p(m,"Could not load plugins: "+e.message)}),k.load(),o}}(jwplayer),function(e){function t(e){if(e.playlist)for(var t=0;e.playlist.length>t;t++)e.playlist[t]=new a(e.playlist[t]);else{var s={};n.foreach(a.defaults,function(t){i(e,s,t)}),s.sources||(e.levels?(s.sources=e.levels,delete e.levels):(t={},i(e,t,"file"),i(e,t,"type"),s.sources=t.file?[t]:[])),e.playlist=[new a(s)]}}function i(e,t,i){n.exists(e[i])&&(t[i]=e[i],delete e[i])}var n=e.utils,a=e.playlist.item;
(e.embed.config=function(i){var a={fallback:!0,height:270,primary:"html5",width:480,base:i.base?i.base:n.getScriptPath("jwplayer.js"),aspectratio:""};i=n.extend(a,e.defaults,i);var a={type:"html5",src:i.base+"jwplayer.html5.js"},s={type:"flash",src:i.base+"jwplayer.flash.swf"};if(i.modes="flash"==i.primary?[s,a]:[a,s],i.listbar&&(i.playlistsize=i.listbar.size,i.playlistposition=i.listbar.position),i.flashplayer&&(s.src=i.flashplayer),i.html5player&&(a.src=i.html5player),t(i),s=i.aspectratio,"string"==typeof s&&n.exists(s)){var r=s.indexOf(":");
-1==r?a=0:(a=parseFloat(s.substr(0,r)),s=parseFloat(s.substr(r+1)),a=0>=a||0>=s?0:100*(s/a)+"%")}else a=0;return-1==(""+i.width).indexOf("%")?delete i.aspectratio:a?i.aspectratio=a:delete i.aspectratio,i}).addConfig=function(e,i){return t(i),n.extend(e,i)}}(jwplayer),function(e){var t=e.utils,i=document;e.embed.download=function(e,n,a){function s(e,n){for(var a=i.querySelectorAll(e),s=0;a.length>s;s++)t.foreach(n,function(e,t){a[s].style[e]=t})}function r(e,t,n){return e=i.createElement(e),t&&(e.className="jwdownload"+t),n&&n.appendChild(e),e
}var l,o=t.extend({},n),c=o.width?o.width:480,d=o.height?o.height:320;n=n.logo?n.logo:{prefix:t.repo(),file:"logo.png",margin:10};var h,u,p,f,o=o.playlist,m=["mp4","aac","mp3"];if(o&&o.length){for(f=o[0],l=f.sources,o=0;l.length>o;o++){var g=l[o],v=g.type?g.type:t.extensionmap.extType(t.extension(g.file));g.file&&t.foreach(m,function(e){v==m[e]?(h=g.file,u=f.image):t.isYouTube(g.file)&&(p=g.file)})}h?(l=h,a=u,e&&(o=r("a","display",e),r("div","icon",o),r("div","logo",o),l&&o.setAttribute("href",t.getAbsolutePath(l))),o="#"+e.id+" .jwdownload",e.style.width="",e.style.height="",s(o+"display",{width:t.styleDimension(Math.max(320,c)),height:t.styleDimension(Math.max(180,d)),background:"black center no-repeat "+(a?"url("+a+")":""),backgroundSize:"contain",position:"relative",border:"none",display:"block"}),s(o+"display div",{position:"absolute",width:"100%",height:"100%"}),s(o+"logo",{top:n.margin+"px",right:n.margin+"px",background:"top right no-repeat url("+n.prefix+n.file+")"}),s(o+"icon",{background:"center no-repeat url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAgNJREFUeNrs28lqwkAYB/CZqNVDDj2r6FN41QeIy8Fe+gj6BL275Q08u9FbT8ZdwVfotSBYEPUkxFOoks4EKiJdaDuTjMn3wWBO0V/+sySR8SNSqVRKIR8qaXHkzlqS9jCfzzWcTCYp9hF5o+59sVjsiRzcegSckFzcjT+ruN80TeSlAjCAAXzdJSGPFXRpAAMYwACGZQkSdhG4WCzehMNhqV6vG6vVSrirKVEw66YoSqDb7cqlUilE8JjHd/y1MQefVzqdDmiaJpfLZWHgXMHn8F6vJ1cqlVAkEsGuAn83J4gAd2RZymQygX6/L1erVQt+9ZPWb+CDwcCC2zXGJaewl/DhcHhK3DVj+KfKZrMWvFarcYNLomAv4aPRSFZVlTlcSPA5fDweW/BoNIqFnKV53JvncjkLns/n/cLdS+92O7RYLLgsKfv9/t8XlDn4eDyiw+HA9Jyz2eyt0+kY2+3WFC5hluej0Ha7zQQq9PPwdDq1Et1sNsx/nFBgCqWJ8oAK1aUptNVqcYWewE4nahfU0YQnk4ntUEfGMIU2m01HoLaCKbTRaDgKtaVLk9tBYaBcE/6Artdr4RZ5TB6/dC+9iIe/WgAMYADDpAUJAxjAAAYwgGFZgoS/AtNNTF7Z2bL0BYPBV3Jw5xFwwWcYxgtBP5OkE8i9G7aWGOOCruvauwADALMLMEbKf4SdAAAAAElFTkSuQmCC)"})):p?(n=p,e=r("embed","",e),e.src="http://www.youtube.com/v/"+/v=([^&]+)|\/([\w-]+)$|^([\w-]+)$/i.exec(n).slice(1).join(""),e.type="application/x-shockwave-flash",e.width=c,e.height=d):a()
}}}(jwplayer),function(e){var t=e.utils,i=e.events,n={};(e.embed.flash=function(a,s,r,l,o){function c(e,t,i){var n=document.createElement("param");n.setAttribute("name",t),n.setAttribute("value",i),e.appendChild(n)}function d(e,t,i){return function(){try{i&&document.getElementById(o.id+"_wrapper").appendChild(t);var n=document.getElementById(o.id).getPluginConfig("display");"function"==typeof e.resize&&e.resize(n.width,n.height),t.style.left=n.x,t.style.top=n.h}catch(a){}}}function h(e){if(!e)return{};
var i={},n=[];return t.foreach(e,function(e,a){var s=t.getPluginName(e);n.push(e),t.foreach(a,function(e,t){i[s+"."+e]=t})}),i.plugins=n.join(","),i}var u=new e.events.eventdispatcher,p=t.flashVersion();t.extend(this,u),this.embed=function(){if(r.id=o.id,10>p)return u.sendEvent(i.ERROR,{message:"Flash version must be 10.0 or greater"}),!1;var e,f,m=o.config.listbar,g=t.extend({},r);if(a.id+"_wrapper"==a.parentNode.id)e=document.getElementById(a.id+"_wrapper");else{if(e=document.createElement("div"),f=document.createElement("div"),f.style.display="none",f.id=a.id+"_aspect",e.id=a.id+"_wrapper",e.style.position="relative",e.style.display="block",e.style.width=t.styleDimension(g.width),e.style.height=t.styleDimension(g.height),o.config.aspectratio){var v=parseFloat(o.config.aspectratio);
f.style.display="block",f.style.marginTop=o.config.aspectratio,e.style.height="auto",e.style.display="inline-block",m&&("bottom"==m.position?f.style.paddingBottom=m.size+"px":"right"==m.position&&(f.style.marginBottom=-1*m.size*(v/100)+"px"))}a.parentNode.replaceChild(e,a),e.appendChild(a),e.appendChild(f)}for(e=l.setupPlugins(o,g,d),e.length>0?t.extend(g,h(e.plugins)):delete g.plugins,g["dock.position"]!==void 0&&"false"==(""+g["dock.position"]).toLowerCase()&&(g.dock=g["dock.position"],delete g["dock.position"]),e=g.wmode?g.wmode:g.height&&40>=g.height?"transparent":"opaque",f="height width modes events primary base fallback volume".split(" "),m=0;f.length>m;m++)delete g[f[m]];
f=t.getCookies(),t.foreach(f,function(e,t){g[e]===void 0&&(g[e]=t)}),f=window.location.href.split("/"),f.splice(f.length-1,1),f=f.join("/"),g.base=f+"/",n[a.id]=g,t.isIE()?(f='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" " width="100%" height="100%"id="'+a.id+'" name="'+a.id+'" tabindex=0"">',f+='<param name="movie" value="'+s.src+'">',f+='<param name="allowfullscreen" value="true"><param name="allowscriptaccess" value="always">',f+='<param name="seamlesstabbing" value="true">',f+='<param name="wmode" value="'+e+'">',f+='<param name="bgcolor" value="#000000">',f+="</object>",a.outerHTML=f,e=document.getElementById(a.id)):(f=document.createElement("object"),f.setAttribute("type","application/x-shockwave-flash"),f.setAttribute("data",s.src),f.setAttribute("width","100%"),f.setAttribute("height","100%"),f.setAttribute("bgcolor","#000000"),f.setAttribute("id",a.id),f.setAttribute("name",a.id),f.setAttribute("tabindex",0),c(f,"allowfullscreen","true"),c(f,"allowscriptaccess","always"),c(f,"seamlesstabbing","true"),c(f,"wmode",e),a.parentNode.replaceChild(f,a),e=f),o.config.aspectratio&&(e.style.position="absolute"),o.container=e,o.setPlayer(e,"flash")
},this.supportsConfig=function(){if(p){if(!r)return!0;if("string"==t.typeOf(r.playlist))return!0;try{var e=r.playlist[0].sources;if(e===void 0)return!0;for(var i=0;e.length>i;i++){var n;if(n=e[i].file){var a=e[i].file,s=e[i].type;if(t.isYouTube(a)||t.isRtmp(a,s)||"hls"==s)n=!0;else{var l=t.extensionmap[s?s:t.extension(a)];n=l?!!l.flash:!1}}if(n)return!0}}catch(o){}}return!1}}).getVars=function(e){return n[e]}}(jwplayer),function(e){var t=e.utils,i=t.extensionmap,n=e.events;e.embed.html5=function(a,s,r,l,o){function c(e,t,i){return function(){try{var n=document.querySelector("#"+a.id+" .jwmain");
i&&n.appendChild(t),"function"==typeof e.resize&&(e.resize(n.clientWidth,n.clientHeight),setTimeout(function(){e.resize(n.clientWidth,n.clientHeight)},400)),t.left=n.style.left,t.top=n.style.top}catch(s){}}}function d(e){h.sendEvent(e.type,{message:"HTML5 player not found"})}var h=this,u=new n.eventdispatcher;t.extend(h,u),h.embed=function(){if(e.html5){l.setupPlugins(o,r,c),a.innerHTML="";var i=e.utils.extend({},r);delete i.volume,i=new e.html5.player(i),o.container=document.getElementById(o.id),o.setPlayer(i,"html5")
}else i=new t.scriptloader(s.src),i.addEventListener(n.ERROR,d),i.addEventListener(n.COMPLETE,h.embed),i.load()},h.supportsConfig=function(){if(e.vid.canPlayType)try{if("string"==t.typeOf(r.playlist))return!0;for(var n=r.playlist[0].sources,a=0;n.length>a;a++){var s,l=n[a].file,o=n[a].type;if(null!==navigator.userAgent.match(/BlackBerry/i)||t.isAndroid()&&("m3u"==t.extension(l)||"m3u8"==t.extension(l))||t.isRtmp(l,o))s=!1;else{var c,d=i[o?o:t.extension(l)];if(!d||d.flash&&!d.html5)c=!1;else{var h=d.html5,u=e.vid;
if(h)try{c=u.canPlayType(h)?!0:!1}catch(p){c=!1}else c=!0}s=c}if(s)return!0}}catch(f){}return!1}}}(jwplayer),function(e){var t=e.embed,i=e.utils,n=i.extend(function(n){function a(e){f.debug&&i.log(e)}function r(e){return e=e.split("/"),e=e[e.length-1],e=e.split("?"),e[0]}function l(){if(!_){var e=n.getPosition();a("stop: "+S+" : "+e),s.Media.stop(S,e)}}function o(e){_=!0,k=0,f.mediaName?e=f.mediaName:(e=n.getPlaylistItem(e.index),e=e.title?e.title:e.file?r(e.file):e.sources&&e.sources.length?r(e.sources[0].file):""),S=e,C=f.playerName?f.playerName:n.id
}function c(e,t){var i=p.events[e];p.events[e]="function"!=typeof p.events[e]?t:function(e){i&&i(e),t(e)}}var d=i.repo(),h=i.extend({},e.defaults),u=i.extend({},h,n.config),p=n.config,f=p.sitecatalyst,m=u.plugins,g=u.analytics,v=d+"jwpsrv.js",y=d+"sharing.js",b=d+"related.js",w=d+"gapro.js",h=e.key?e.key:h.key,x=new e.utils.key(h).edition(),k=0,S="",C="",_=!0,m=m?m:{};switch("ads"==x&&u.advertising&&(u.advertising.client.match(".js$|.swf$")?m[u.advertising.client]=u.advertising:m[d+u.advertising.client+".js"]=u.advertising),delete p.advertising,p.key=h,u.analytics&&u.analytics.client&&u.analytics.client.match(".js$|.swf$")&&(v=u.analytics.client),delete p.analytics,"free"!=x&&g&&!1===g.enabled||(m[v]=g?g:{}),delete m.sharing,delete m.related,x){case"premium":case"ads":u.sharing&&(u.sharing.client&&u.sharing.client.match(".js$|.swf$")&&(y=u.sharing.client),m[y]=u.sharing),u.related&&(u.related.client&&u.related.client.match(".js$|.swf$")&&(b=u.related.client),m[b]=u.related),u.ga&&(u.ga.client&&u.ga.client.match(".js$|.swf$")&&(w=u.ga.client),m[w]=u.ga),f&&(p.events=i.extend({},p.events),c("onPlay",function(){if(!_){var e=n.getPosition();
a("play: "+S+" : "+e),s.Media.play(S,e)}}),c("onPause",function(){l()}),c("onBuffer",function(){l()}),c("onPlaylistItem",o),c("onTime",function(){e:{if(_){var e=n.getDuration();if(-1==e)break e;_=!1,a("open: "+S+" : "+e+" : "+C),s.Media.open(S,e,C),a("play: "+S+" : 0"),s.Media.play(S,0)}if(e=n.getPosition(),Math.abs(e-k)>=3){var t=k;a("seek: "+t+" to "+e),a("stop: "+S+" : "+t),s.Media.stop(S,t),a("play: "+S+" : "+e),s.Media.play(S,e)}k=e}}),c("onComplete",function(){var e=n.getPosition();a("stop: "+S+" : "+e),s.Media.stop(S,e),a("close: "+S),s.Media.close(S),_=!0,k=0
}));case"pro":u.skin&&(p.skin=u.skin.replace(/^(beelden|bekle|five|glow|modieus|roundster|stormtrooper|vapor)$/i,i.repo()+"skins/$1.xml"))}return p.plugins=m,new t(n)},t);e.embed=n}(jwplayer),function(e){var t=[],i=e.utils,n=e.events,a=n.state,s=document,r=e.api=function(t){function l(e,t){return function(i){return t(e,i)}}function o(e,t){return f[e]||(f[e]=[],d(n.JWPLAYER_PLAYER_STATE,function(t){var i=t.newstate;if(t=t.oldstate,i==e){var n=f[i];if(n)for(var a=0;n.length>a;a++)"function"==typeof n[a]&&n[a].call(this,{oldstate:t,newstate:i})
}})),f[e].push(t),u}function c(e,t){try{e.jwAddEventListener(t,'function(dat) { jwplayer("'+u.id+'").dispatchEvent("'+t+'", dat); }')}catch(n){i.log("Could not add internal listener")}}function d(e,t){return p[e]||(p[e]=[],m&&g&&c(m,e)),p[e].push(t),u}function h(){if(g){for(var e=arguments[0],t=[],i=1;arguments.length>i;i++)t.push(arguments[i]);if(m!==void 0&&"function"==typeof m[e])switch(t.length){case 4:return m[e](t[0],t[1],t[2],t[3]);case 3:return m[e](t[0],t[1],t[2]);case 2:return m[e](t[0],t[1]);
case 1:return m[e](t[0]);default:return m[e]()}return null}v.push(arguments)}var u=this,p={},f={},m=void 0,g=!1,v=[],y=void 0,b={},w={};u.container=t,u.id=t.id,u.getBuffer=function(){return h("jwGetBuffer")},u.getContainer=function(){return u.container},u.addButton=function(e,t,n,a){try{w[a]=n,h("jwDockAddButton",e,t,"jwplayer('"+u.id+"').callback('"+a+"')",a)}catch(s){i.log("Could not add dock button"+s.message)}},u.removeButton=function(e){h("jwDockRemoveButton",e)},u.callback=function(e){w[e]&&w[e]()
},u.forceState=function(e){return h("jwForceState",e),u},u.releaseState=function(){return h("jwReleaseState")},u.getDuration=function(){return h("jwGetDuration")},u.getFullscreen=function(){return h("jwGetFullscreen")},u.getStretching=function(){return h("jwGetStretching")},u.getHeight=function(){return h("jwGetHeight")},u.getLockState=function(){return h("jwGetLockState")},u.getMeta=function(){return u.getItemMeta()},u.getMute=function(){return h("jwGetMute")},u.getPlaylist=function(){var e=h("jwGetPlaylist");
return"flash"==u.renderingMode&&i.deepReplaceKeyName(e,["__dot__","__spc__","__dsh__","__default__"],["."," ","-","default"]),e},u.getPlaylistItem=function(e){return i.exists(e)||(e=u.getPlaylistIndex()),u.getPlaylist()[e]},u.getPlaylistIndex=function(){return h("jwGetPlaylistIndex")},u.getPosition=function(){return h("jwGetPosition")},u.getRenderingMode=function(){return u.renderingMode},u.getState=function(){return h("jwGetState")},u.getVolume=function(){return h("jwGetVolume")},u.getWidth=function(){return h("jwGetWidth")
},u.setFullscreen=function(e){return i.exists(e)?h("jwSetFullscreen",e):h("jwSetFullscreen",!h("jwGetFullscreen")),u},u.setStretching=function(e){return h("jwSetStretching",e),u},u.setMute=function(e){return i.exists(e)?h("jwSetMute",e):h("jwSetMute",!h("jwGetMute")),u},u.lock=function(){return u},u.unlock=function(){return u},u.load=function(e){return h("jwLoad",e),u},u.playlistItem=function(e){return h("jwPlaylistItem",parseInt(e)),u},u.playlistPrev=function(){return h("jwPlaylistPrev"),u},u.playlistNext=function(){return h("jwPlaylistNext"),u
},u.resize=function(e,t){if("flash"!=u.renderingMode){var n=document.getElementById(u.id);n.className=n.className.replace(/\s+aspectMode/,""),n.style.display="block",h("jwResize",e,t)}else{var n=s.getElementById(u.id+"_wrapper"),a=s.getElementById(u.id+"_aspect");a&&(a.style.display="none"),n&&(n.style.display="block",n.style.width=i.styleDimension(e),n.style.height=i.styleDimension(t))}return u},u.play=function(e){return e===void 0?(e=u.getState(),e==a.PLAYING||e==a.BUFFERING?h("jwPause"):h("jwPlay")):h("jwPlay",e),u
},u.pause=function(e){return e===void 0?(e=u.getState(),e==a.PLAYING||e==a.BUFFERING?h("jwPause"):h("jwPlay")):h("jwPause",e),u},u.stop=function(){return h("jwStop"),u},u.seek=function(e){return h("jwSeek",e),u},u.setVolume=function(e){return h("jwSetVolume",e),u},u.loadInstream=function(e,t){return y=new r.instream(this,m,e,t)},u.getQualityLevels=function(){return h("jwGetQualityLevels")},u.getCurrentQuality=function(){return h("jwGetCurrentQuality")},u.setCurrentQuality=function(e){h("jwSetCurrentQuality",e)
},u.getCaptionsList=function(){return h("jwGetCaptionsList")},u.getCurrentCaptions=function(){return h("jwGetCurrentCaptions")},u.setCurrentCaptions=function(e){h("jwSetCurrentCaptions",e)},u.getControls=function(){return h("jwGetControls")},u.getSafeRegion=function(){return h("jwGetSafeRegion")},u.setControls=function(e){h("jwSetControls",e)},u.destroyPlayer=function(){h("jwPlayerDestroy")},u.playAd=function(e){h("jwPlayAd",e)};var x={onBufferChange:n.JWPLAYER_MEDIA_BUFFER,onBufferFull:n.JWPLAYER_MEDIA_BUFFER_FULL,onError:n.JWPLAYER_ERROR,onSetupError:n.JWPLAYER_SETUP_ERROR,onFullscreen:n.JWPLAYER_FULLSCREEN,onMeta:n.JWPLAYER_MEDIA_META,onMute:n.JWPLAYER_MEDIA_MUTE,onPlaylist:n.JWPLAYER_PLAYLIST_LOADED,onPlaylistItem:n.JWPLAYER_PLAYLIST_ITEM,onPlaylistComplete:n.JWPLAYER_PLAYLIST_COMPLETE,onReady:n.API_READY,onResize:n.JWPLAYER_RESIZE,onComplete:n.JWPLAYER_MEDIA_COMPLETE,onSeek:n.JWPLAYER_MEDIA_SEEK,onTime:n.JWPLAYER_MEDIA_TIME,onVolume:n.JWPLAYER_MEDIA_VOLUME,onBeforePlay:n.JWPLAYER_MEDIA_BEFOREPLAY,onBeforeComplete:n.JWPLAYER_MEDIA_BEFORECOMPLETE,onDisplayClick:n.JWPLAYER_DISPLAY_CLICK,onControls:n.JWPLAYER_CONTROLS,onQualityLevels:n.JWPLAYER_MEDIA_LEVELS,onQualityChange:n.JWPLAYER_MEDIA_LEVEL_CHANGED,onCaptionsList:n.JWPLAYER_CAPTIONS_LIST,onCaptionsChange:n.JWPLAYER_CAPTIONS_CHANGED,onAdError:n.JWPLAYER_AD_ERROR,onAdClick:n.JWPLAYER_AD_CLICK,onAdImpression:n.JWPLAYER_AD_IMPRESSION,onAdTime:n.JWPLAYER_AD_TIME,onAdComplete:n.JWPLAYER_AD_COMPLETE,onAdCompanions:n.JWPLAYER_AD_COMPANIONS};
i.foreach(x,function(e){u[e]=l(x[e],d)});var k={onBuffer:a.BUFFERING,onPause:a.PAUSED,onPlay:a.PLAYING,onIdle:a.IDLE};return i.foreach(k,function(e){u[e]=l(k[e],o)}),u.remove=function(){if(!g)throw"Cannot call remove() before player is ready";v=[],r.destroyPlayer(this.id)},u.setup=function(t){if(e.embed){var i=s.getElementById(u.id);return i&&(t.fallbackDiv=i),i=u,v=[],r.destroyPlayer(i.id),i=e(u.id),i.config=t,new e.embed(i)}return u},u.registerPlugin=function(t,i,n,a){e.plugins.registerPlugin(t,i,n,a)
},u.setPlayer=function(e,t){m=e,u.renderingMode=t},u.detachMedia=function(){return"html5"==u.renderingMode?h("jwDetachMedia"):void 0},u.attachMedia=function(e){return"html5"==u.renderingMode?h("jwAttachMedia",e):void 0},u.dispatchEvent=function(e,t){if(p[e])for(var a=i.translateEventResponse(e,t),s=0;p[e].length>s;s++)if("function"==typeof p[e][s])try{e==n.JWPLAYER_PLAYLIST_LOADED&&i.deepReplaceKeyName(a.playlist,["__dot__","__spc__","__dsh__","__default__"],["."," ","-","default"]),p[e][s].call(this,a)
}catch(r){i.log("There was an error calling back an event handler")}},u.dispatchInstreamEvent=function(e){y&&y.dispatchEvent(e,arguments)},u.callInternal=h,u.playerReady=function(e){for(g=!0,m||u.setPlayer(s.getElementById(e.id)),u.container=s.getElementById(u.id),i.foreach(p,function(e){c(m,e)}),d(n.JWPLAYER_PLAYLIST_ITEM,function(){b={}}),d(n.JWPLAYER_MEDIA_META,function(e){i.extend(b,e.metadata)}),u.dispatchEvent(n.API_READY);v.length>0;)h.apply(this,v.shift())},u.getItemMeta=function(){return b
},u.isBeforePlay=function(){return m.jwIsBeforePlay()},u.isBeforeComplete=function(){return m.jwIsBeforeComplete()},u};r.selectPlayer=function(e){var n;return i.exists(e)||(e=0),e.nodeType?n=e:"string"==typeof e&&(n=s.getElementById(e)),n?(e=r.playerById(n.id))?e:r.addPlayer(new r(n)):"number"==typeof e?t[e]:null},r.playerById=function(e){for(var i=0;t.length>i;i++)if(t[i].id==e)return t[i];return null},r.addPlayer=function(e){for(var i=0;t.length>i;i++)if(t[i]==e)return e;return t.push(e),e},r.destroyPlayer=function(e){for(var n,a=-1,r=0;t.length>r;r++)t[r].id==e&&(a=r,n=t[r]);
return a>=0&&(e=n.id,r=s.getElementById(e+("flash"==n.renderingMode?"_wrapper":"")),i.clearCss&&i.clearCss("#"+e),r&&("html5"==n.renderingMode&&n.destroyPlayer(),n=s.createElement("div"),n.id=e,r.parentNode.replaceChild(n,r)),t.splice(a,1)),null},e.playerReady=function(t){var i=e.api.playerById(t.id);i?i.playerReady(t):e.api.selectPlayer(t.id).playerReady(t)}}(jwplayer),function(e){var t=e.events,i=e.utils,n=t.state;e.api.instream=function(e,a,s,r){function l(e,t){return h[e]||(h[e]=[],d.jwInstreamAddEventListener(e,'function(dat) { jwplayer("'+c.id+'").dispatchInstreamEvent("'+e+'", dat); }')),h[e].push(t),this
}function o(e,i){return u[e]||(u[e]=[],l(t.JWPLAYER_PLAYER_STATE,function(t){var i=t.newstate,n=t.oldstate;if(i==e){var a=u[i];if(a)for(var s=0;a.length>s;s++)"function"==typeof a[s]&&a[s].call(this,{oldstate:n,newstate:i,type:t.type})}})),u[e].push(i),this}var c=e,d=a,h={},u={};this.dispatchEvent=function(e,t){if(h[e])for(var n=i.translateEventResponse(e,t[1]),a=0;h[e].length>a;a++)"function"==typeof h[e][a]&&h[e][a].call(this,n)},this.onError=function(e){return l(t.JWPLAYER_ERROR,e)},this.onFullscreen=function(e){return l(t.JWPLAYER_FULLSCREEN,e)
},this.onMeta=function(e){return l(t.JWPLAYER_MEDIA_META,e)},this.onMute=function(e){return l(t.JWPLAYER_MEDIA_MUTE,e)},this.onComplete=function(e){return l(t.JWPLAYER_MEDIA_COMPLETE,e)},this.onTime=function(e){return l(t.JWPLAYER_MEDIA_TIME,e)},this.onBuffer=function(e){return o(n.BUFFERING,e)},this.onPause=function(e){return o(n.PAUSED,e)},this.onPlay=function(e){return o(n.PLAYING,e)},this.onIdle=function(e){return o(n.IDLE,e)},this.onClick=function(e){return l(t.JWPLAYER_INSTREAM_CLICK,e)},this.onInstreamDestroyed=function(e){return l(t.JWPLAYER_INSTREAM_DESTROYED,e)
},this.play=function(e){d.jwInstreamPlay(e)},this.pause=function(e){d.jwInstreamPause(e)},this.destroy=function(){d.jwInstreamDestroy()},c.callInternal("jwLoadInstream",s,r?r:{})}}(jwplayer),function(e){var t=e.api,i=t.selectPlayer;t.selectPlayer=function(t){return(t=i(t))?t:{registerPlugin:function(t,i,n){e.plugins.registerPlugin(t,i,n)}}}}(jwplayer)),define("jwplayer",function(){});var swfobject=function(){function e(){if(!U){try{var e=R.getElementsByTagName("body")[0].appendChild(g("span"));e.parentNode.removeChild(e)
}catch(t){return}U=!0;for(var i=q.length,n=0;i>n;n++)q[n]()}}function t(e){U?e():q[q.length]=e}function i(e){if(typeof O.addEventListener!=T)O.addEventListener("load",e,!1);else if(typeof R.addEventListener!=T)R.addEventListener("load",e,!1);else if(typeof O.attachEvent!=T)v(O,"onload",e);else if("function"==typeof O.onload){var t=O.onload;O.onload=function(){t(),e()}}else O.onload=e}function n(){$?a():s()}function a(){var e=R.getElementsByTagName("body")[0],t=g(M);t.setAttribute("type",L);var i=e.appendChild(t);
if(i){var n=0;(function(){if(typeof i.GetVariable!=T){var a=i.GetVariable("$version");a&&(a=a.split(" ")[1].split(","),W.pv=[parseInt(a[0],10),parseInt(a[1],10),parseInt(a[2],10)])}else if(10>n)return n++,setTimeout(arguments.callee,10),void 0;e.removeChild(t),i=null,s()})()}else s()}function s(){var e=V.length;if(e>0)for(var t=0;e>t;t++){var i=V[t].id,n=V[t].callbackFn,a={success:!1,id:i};if(W.pv[0]>0){var s=m(i);if(s)if(!y(V[t].swfVersion)||W.wk&&312>W.wk)if(V[t].expressInstall&&l()){var d={};d.data=V[t].expressInstall,d.width=s.getAttribute("width")||"0",d.height=s.getAttribute("height")||"0",s.getAttribute("class")&&(d.styleclass=s.getAttribute("class")),s.getAttribute("align")&&(d.align=s.getAttribute("align"));
for(var h={},u=s.getElementsByTagName("param"),p=u.length,f=0;p>f;f++)"movie"!=u[f].getAttribute("name").toLowerCase()&&(h[u[f].getAttribute("name")]=u[f].getAttribute("value"));o(d,h,i,n)}else c(s),n&&n(a);else w(i,!0),n&&(a.success=!0,a.ref=r(i),n(a))}else if(w(i,!0),n){var g=r(i);g&&typeof g.SetVariable!=T&&(a.success=!0,a.ref=g),n(a)}}}function r(e){var t=null,i=m(e);if(i&&"OBJECT"==i.nodeName)if(typeof i.SetVariable!=T)t=i;else{var n=i.getElementsByTagName(M)[0];n&&(t=n)}return t}function l(){return!H&&y("6.0.65")&&(W.win||W.mac)&&!(W.wk&&312>W.wk)
}function o(e,t,i,n){H=!0,C=n||null,_={success:!1,id:i};var a=m(i);if(a){"OBJECT"==a.nodeName?(k=d(a),S=null):(k=a,S=i),e.id=E,(typeof e.width==T||!/%$/.test(e.width)&&310>parseInt(e.width,10))&&(e.width="310"),(typeof e.height==T||!/%$/.test(e.height)&&137>parseInt(e.height,10))&&(e.height="137"),R.title=R.title.slice(0,47)+" - Flash Player Installation";var s=W.ie&&W.win?"ActiveX":"PlugIn",r="MMredirectURL="+(""+O.location).replace(/&/g,"%26")+"&MMplayerType="+s+"&MMdoctitle="+R.title;if(typeof t.flashvars!=T?t.flashvars+="&"+r:t.flashvars=r,W.ie&&W.win&&4!=a.readyState){var l=g("div");
i+="SWFObjectNew",l.setAttribute("id",i),a.parentNode.insertBefore(l,a),a.style.display="none",function(){4==a.readyState?a.parentNode.removeChild(a):setTimeout(arguments.callee,10)}()}h(e,t,i)}}function c(e){if(W.ie&&W.win&&4!=e.readyState){var t=g("div");e.parentNode.insertBefore(t,e),t.parentNode.replaceChild(d(e),t),e.style.display="none",function(){4==e.readyState?e.parentNode.removeChild(e):setTimeout(arguments.callee,10)}()}else e.parentNode.replaceChild(d(e),e)}function d(e){var t=g("div");
if(W.win&&W.ie)t.innerHTML=e.innerHTML;else{var i=e.getElementsByTagName(M)[0];if(i){var n=i.childNodes;if(n)for(var a=n.length,s=0;a>s;s++)1==n[s].nodeType&&"PARAM"==n[s].nodeName||8==n[s].nodeType||t.appendChild(n[s].cloneNode(!0))}}return t}function h(e,t,i){var n,a=m(i);if(W.wk&&312>W.wk)return n;if(a)if(typeof e.id==T&&(e.id=i),W.ie&&W.win){var s="";for(var r in e)e[r]!=Object.prototype[r]&&("data"==r.toLowerCase()?t.movie=e[r]:"styleclass"==r.toLowerCase()?s+=' class="'+e[r]+'"':"classid"!=r.toLowerCase()&&(s+=" "+r+'="'+e[r]+'"'));
var l="";for(var o in t)t[o]!=Object.prototype[o]&&(l+='<param name="'+o+'" value="'+t[o]+'" />');a.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+s+">"+l+"</object>",j[j.length]=e.id,n=m(e.id)}else{var c=g(M);c.setAttribute("type",L);for(var d in e)e[d]!=Object.prototype[d]&&("styleclass"==d.toLowerCase()?c.setAttribute("class",e[d]):"classid"!=d.toLowerCase()&&c.setAttribute(d,e[d]));for(var h in t)t[h]!=Object.prototype[h]&&"movie"!=h.toLowerCase()&&u(c,h,t[h]);a.parentNode.replaceChild(c,a),n=c
}return n}function u(e,t,i){var n=g("param");n.setAttribute("name",t),n.setAttribute("value",i),e.appendChild(n)}function p(e){var t=m(e);t&&"OBJECT"==t.nodeName&&(W.ie&&W.win?(t.style.display="none",function(){4==t.readyState?f(e):setTimeout(arguments.callee,10)}()):t.parentNode.removeChild(t))}function f(e){var t=m(e);if(t){for(var i in t)"function"==typeof t[i]&&(t[i]=null);t.parentNode.removeChild(t)}}function m(e){var t=null;try{t=R.getElementById(e)}catch(i){}return t}function g(e){return R.createElement(e)
}function v(e,t,i){e.attachEvent(t,i),F[F.length]=[e,t,i]}function y(e){var t=W.pv,i=e.split(".");return i[0]=parseInt(i[0],10),i[1]=parseInt(i[1],10)||0,i[2]=parseInt(i[2],10)||0,t[0]>i[0]||t[0]==i[0]&&t[1]>i[1]||t[0]==i[0]&&t[1]==i[1]&&t[2]>=i[2]?!0:!1}function b(e,t,i,n){if(!W.ie||!W.mac){var a=R.getElementsByTagName("head")[0];if(a){var s=i&&"string"==typeof i?i:"screen";if(n&&(A=null,I=null),!A||I!=s){var r=g("style");r.setAttribute("type","text/css"),r.setAttribute("media",s),A=a.appendChild(r),W.ie&&W.win&&typeof R.styleSheets!=T&&R.styleSheets.length>0&&(A=R.styleSheets[R.styleSheets.length-1]),I=s
}W.ie&&W.win?A&&typeof A.addRule==M&&A.addRule(e,t):A&&typeof R.createTextNode!=T&&A.appendChild(R.createTextNode(e+" {"+t+"}"))}}}function w(e,t){if(z){var i=t?"visible":"hidden";U&&m(e)?m(e).style.visibility=i:b("#"+e,"visibility:"+i)}}function x(e){var t=/[\\\"<>\.;]/,i=null!=t.exec(e);return i&&typeof encodeURIComponent!=T?encodeURIComponent(e):e}var k,S,C,_,A,I,T="undefined",M="object",P="Shockwave Flash",D="ShockwaveFlash.ShockwaveFlash",L="application/x-shockwave-flash",E="SWFObjectExprInst",N="onreadystatechange",O=window,R=document,B=navigator,$=!1,q=[n],V=[],j=[],F=[],U=!1,H=!1,z=!0,W=function(){var e=typeof R.getElementById!=T&&typeof R.getElementsByTagName!=T&&typeof R.createElement!=T,t=B.userAgent.toLowerCase(),i=B.platform.toLowerCase(),n=i?/win/.test(i):/win/.test(t),a=i?/mac/.test(i):/mac/.test(t),s=/webkit/.test(t)?parseFloat(t.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):!1,r=!1,l=[0,0,0],o=null;
if(typeof B.plugins!=T&&typeof B.plugins[P]==M)o=B.plugins[P].description,!o||typeof B.mimeTypes!=T&&B.mimeTypes[L]&&!B.mimeTypes[L].enabledPlugin||($=!0,r=!1,o=o.replace(/^.*\s+(\S+\s+\S+$)/,"$1"),l[0]=parseInt(o.replace(/^(.*)\..*$/,"$1"),10),l[1]=parseInt(o.replace(/^.*\.(.*)\s.*$/,"$1"),10),l[2]=/[a-zA-Z]/.test(o)?parseInt(o.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0);else if(typeof O.ActiveXObject!=T)try{var c=new ActiveXObject(D);c&&(o=c.GetVariable("$version"),o&&(r=!0,o=o.split(" ")[1].split(","),l=[parseInt(o[0],10),parseInt(o[1],10),parseInt(o[2],10)]))
}catch(d){}return{w3:e,pv:l,wk:s,ie:r,win:n,mac:a}}();return function(){W.w3&&((typeof R.readyState!=T&&"complete"==R.readyState||typeof R.readyState==T&&(R.getElementsByTagName("body")[0]||R.body))&&e(),U||(typeof R.addEventListener!=T&&R.addEventListener("DOMContentLoaded",e,!1),W.ie&&W.win&&(R.attachEvent(N,function(){"complete"==R.readyState&&(R.detachEvent(N,arguments.callee),e())}),O==top&&function(){if(!U){try{R.documentElement.doScroll("left")}catch(t){return setTimeout(arguments.callee,0),void 0
}e()}}()),W.wk&&function(){return U?void 0:/loaded|complete/.test(R.readyState)?(e(),void 0):(setTimeout(arguments.callee,0),void 0)}(),i(e)))}(),function(){W.ie&&W.win&&window.attachEvent("onunload",function(){for(var e=F.length,t=0;e>t;t++)F[t][0].detachEvent(F[t][1],F[t][2]);for(var i=j.length,n=0;i>n;n++)p(j[n]);for(var a in W)W[a]=null;W=null;for(var s in swfobject)swfobject[s]=null;swfobject=null})}(),{registerObject:function(e,t,i,n){if(W.w3&&e&&t){var a={};a.id=e,a.swfVersion=t,a.expressInstall=i,a.callbackFn=n,V[V.length]=a,w(e,!1)
}else n&&n({success:!1,id:e})},getObjectById:function(e){return W.w3?r(e):void 0},embedSWF:function(e,i,n,a,s,r,c,d,u,p){var f={success:!1,id:i};W.w3&&!(W.wk&&312>W.wk)&&e&&i&&n&&a&&s?(w(i,!1),t(function(){n+="",a+="";var t={};if(u&&typeof u===M)for(var m in u)t[m]=u[m];t.data=e,t.width=n,t.height=a;var g={};if(d&&typeof d===M)for(var v in d)g[v]=d[v];if(c&&typeof c===M)for(var b in c)typeof g.flashvars!=T?g.flashvars+="&"+b+"="+c[b]:g.flashvars=b+"="+c[b];if(y(s)){var x=h(t,g,i);t.id==i&&w(i,!0),f.success=!0,f.ref=x
}else{if(r&&l())return t.data=r,o(t,g,i,p),void 0;w(i,!0)}p&&p(f)})):p&&p(f)},switchOffAutoHideShow:function(){z=!1},ua:W,getFlashPlayerVersion:function(){return{major:W.pv[0],minor:W.pv[1],release:W.pv[2]}},hasFlashPlayerVersion:y,createSWF:function(e,t,i){return W.w3?h(e,t,i):void 0},showExpressInstall:function(e,t,i,n){W.w3&&l()&&o(e,t,i,n)},removeSWF:function(e){W.w3&&p(e)},createCSS:function(e,t,i,n){W.w3&&b(e,t,i,n)},addDomLoadEvent:t,addLoadEvent:i,getQueryParamValue:function(e){var t=R.location.search||R.location.hash;
if(t){if(/\?/.test(t)&&(t=t.split("?")[1]),null==e)return x(t);for(var i=t.split("&"),n=0;i.length>n;n++)if(i[n].substring(0,i[n].indexOf("="))==e)return x(i[n].substring(i[n].indexOf("=")+1))}return""},expressInstallCallback:function(){if(H){var e=m(E);e&&k&&(e.parentNode.replaceChild(k,e),S&&(w(S,!0),W.ie&&W.win&&(k.style.display="block")),C&&C(_)),H=!1}}}}();define("swfobject",function(){}),define("plex/desktop/view/players/core/VideoView",["hb!templates/desktop/players/core/VideoView.tpl","plex/base/control/Dispatcher","plex/base/control/utils/LogUtil","plex/base/control/utils/BrowserDetect","plex/base/view/players/core/BaseVideoView","jwplayer","swfobject"],function(e,t,i,n,a){jwplayer.key="fv2ELs9q2gEZxE9uuiAGfhbE9Qhc4DyhZjt1j0GaxUI=";
var s=a.extend({initialize:function(){a.prototype.initialize.apply(this,arguments),_.bindAll(this,"onIdle","onFullscreen")},render:function(t,i){return this.type=t||this.type,this.url=i||this.url,this.$el.html(e({type:this.type,url:this.url})),this},postrender:function(){if("html5"===this.type)return a.prototype.postrender.apply(this,arguments);this.ready=!1;var e=jwplayer("player");_.isFunction(e.setup)?this.video=e.setup({file:this.url,skin:"swf/jwplayer/plex.xml",flashplayer:"swf/jwplayer/jwplayer.swf",stretching:"exactfit",width:"100%",height:"100%",volume:100,mute:!1,autostart:!0,analytics:{enabled:!1},events:{onReady:this.onReady,onPlay:this.onPlay,onTime:this.onTime,onPause:this.onPause,onIdle:this.onIdle,onVolume:this.onVolume,onFullscreen:this.onFullscreen,onComplete:this.onEnded}}):t.trigger("navigate:error","The Flash Player or a browser that supports HLS is required to play videos.")
},destroy:function(){return"html5"===this.type?a.prototype.destroy.call(this):(this.ready&&(this.video.remove(),this.video=null),void 0)},play:function(){return"html5"===this.type?a.prototype.play.apply(this,arguments):(this.video&&this.video.play(!0),void 0)},pause:function(){return"html5"===this.type?a.prototype.pause.apply(this,arguments):(this.video&&this.video.pause(!0),void 0)},playPause:function(){return"html5"===this.type?a.prototype.pause.apply(this,arguments):(this.video&&this.video.play(),void 0)
},volume:function(e){if("html5"===this.type)return a.prototype.volume.apply(this,arguments);if(this.video)return e===void 0?this.video.getVolume()/100:(this.video.setVolume(100*Math.min(Math.max(e,0),1)),this)},position:function(e){if("html5"===this.type)return a.prototype.position.apply(this,arguments);if(this.video)return e===void 0?this.video.getPosition():(this.video.seek(Math.min(Math.max(e,0),this.duration())),this)},duration:function(){if("html5"===this.type)return a.prototype.duration.apply(this,arguments);
if(this.video)return this.video.getDuration()},state:function(){if("html5"===this.type)return a.prototype.state.apply(this,arguments);if(this.video){var e=this.video.getState();switch(e){case"BUFFERING":return"buffering";case"PLAYING":return"playing";case"PAUSED":return"paused";default:return"stopped"}}},canPlayDash:function(){return!1},canPlayFlash:function(){return swfobject.hasFlashPlayerVersion("10")},onIdle:function(){this.trigger("idle")},onFullscreen:function(e){this.trigger("fullscreen",e.fullscreen),e.fullscreen?jwplayer().setStretching("uniform"):jwplayer().setStretching("exactfit")
}});return s}),define("plex/desktop/view/players/VideoPlayerView",["plex/base/view/players/BaseVideoPlayerView","plex/desktop/view/players/core/VideoView"],function(e,t){var i=e.extend({protocol:"hls",initialize:function(){this.video=new t,e.prototype.initialize.apply(this,arguments)}});return i}),define("plex/desktop/control/Router",["plex/desktop/control/BaseDesktopRouter","plex/desktop/view/players/VideoPlayerView"],function(e,t){var i=e.extend({views:_.extend({player:t},e.prototype.views)});return i
}),FastClick.prototype.deviceIsAndroid=navigator.userAgent.indexOf("Android")>0,FastClick.prototype.deviceIsIOS=/iP(ad|hone|od)/.test(navigator.userAgent),FastClick.prototype.deviceIsIOS4=FastClick.prototype.deviceIsIOS&&/OS 4_\d(_\d)?/.test(navigator.userAgent),FastClick.prototype.needsClick=function(e){switch(e.nodeName.toLowerCase()){case"label":case"video":return!0;default:return/\bneedsclick\b/.test(e.className)}},FastClick.prototype.needsFocus=function(e){switch(e.nodeName.toLowerCase()){case"textarea":case"select":return!0;
case"input":switch(e.type){case"button":case"checkbox":case"file":case"image":case"radio":case"submit":return!1}return!0;default:return/\bneedsfocus\b/.test(e.className)}},FastClick.prototype.sendClick=function(e,t){var i,n;document.activeElement&&document.activeElement!==e&&document.activeElement.blur(),n=t.changedTouches[0],i=document.createEvent("MouseEvents"),i.initMouseEvent("click",!0,!0,window,1,n.screenX,n.screenY,n.clientX,n.clientY,!1,!1,!1,!1,0,null),i.forwardedTouchEvent=!0,e.dispatchEvent(i)
},FastClick.prototype.onTouchStart=function(e){var t=e.targetTouches[0];return this.trackingClick=!0,this.trackingClickStart=e.timeStamp,this.targetElement=e.target,this.touchStartX=t.pageX,this.touchStartY=t.pageY,200>e.timeStamp-this.lastClickTime&&e.preventDefault(),!0},FastClick.prototype.touchHasMoved=function(e){var t=e.targetTouches[0];return Math.abs(t.pageX-this.touchStartX)>10||Math.abs(t.pageY-this.touchStartY)>10?!0:!1},FastClick.prototype.onTouchMove=function(e){return this.trackingClick?((this.targetElement!==e.target||this.touchHasMoved(e))&&(this.trackingClick=!1,this.targetElement=null),!0):!0
},FastClick.prototype.findControl=function(e){return void 0!==e.control?e.control:e.htmlFor?document.getElementById(e.htmlFor):e.querySelector("button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea")},FastClick.prototype.onTouchEnd=function(e){var t,i,n=this.targetElement,a=e.changedTouches[0];if(!this.trackingClick)return!0;if(this.deviceIsIOS){if(a.identifier===this.lastTouchIdentifier)return e.preventDefault(),!1;this.lastTouchIdentifier=a.identifier}if(200>e.timeStamp-this.lastClickTime)return this.cancelNextClick=!0,!0;
if(this.lastClickTime=e.timeStamp,i=this.trackingClickStart,this.trackingClick=!1,this.trackingClickStart=0,"label"===n.nodeName.toLowerCase()){if(t=this.findControl(n))return n.focus(),this.deviceIsAndroid?!1:(this.needsClick(t)||(e.preventDefault(),this.sendClick(t,e)),!1)}else if(this.needsFocus(n))return e.timeStamp-i>100?(this.targetElement=null,!0):(n.focus(),this.deviceIsIOS4&&"select"===n.tagName.toLowerCase()||(this.targetElement=null,e.preventDefault()),!1);return this.needsClick(n)||(e.preventDefault(),this.sendClick(n,e)),!1
},FastClick.prototype.onTouchCancel=function(){this.trackingClick=!1,this.targetElement=null},FastClick.prototype.onClick=function(e){var t;return this.targetElement?e.forwardedTouchEvent?!0:(t=this.targetElement,this.targetElement=null,this.trackingClick?(this.trackingClick=!1,!0):e.cancelable?"submit"===e.target.type&&0===e.detail?!0:!this.needsClick(t)||this.cancelNextClick?(this.cancelNextClick=!1,e.stopImmediatePropagation?e.stopImmediatePropagation():e.propagationStopped=!0,e.stopPropagation(),e.preventDefault(),!1):!0:!0):!0
},FastClick.prototype.destroy=function(){var e=this.layer;e.removeEventListener("click",this.onClick,!0),e.removeEventListener("touchstart",this.onTouchStart,!1),e.removeEventListener("touchmove",this.onTouchMove,!1),e.removeEventListener("touchend",this.onTouchEnd,!1),e.removeEventListener("touchcancel",this.onTouchCancel,!1)},define!==void 0&&define.amd&&define("fastclick",[],function(){return FastClick}),"undefined"!=typeof module&&module.exports&&(module.exports=function(e){return new FastClick(e)
},module.exports.FastClick=FastClick),define("plex/desktop",["plex/base/control/utils/LocalizationUtil","plex/desktop/control/init/GlobalInit","plex/base/control/BaseShortcuts","plex/desktop/control/Router","fastclick"],function(e,t,i,n,a){return{init:function(){new a(document.body),e.load().always(function(){new i,new n})}}}),window.PLEXWEB={},require(["config"],function(){require(["plex/desktop"],function(e){e.init()})}),define("main-desktop",function(){});