-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsummary-06-full.min.js
31 lines (31 loc) · 85.8 KB
/
summary-06-full.min.js
1
2
3
4
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
rangy.createModule("Serializer",function(p,a){p.requireModules(["WrappedSelection","WrappedRange"]);var q="undefined";if(typeof encodeURIComponent==q||typeof decodeURIComponent==q){a.fail("Global object is missing encodeURIComponent and/or decodeURIComponent method")}var e=(function(){function x(B){var A=[];for(var z=0,y=B.length,C;z<y;++z){C=B.charCodeAt(z);if(C<128){A.push(C)}else{if(C<2048){A.push((C>>6)|192,(C&63)|128)}else{A.push((C>>12)|224,((C>>6)&63)|128,(C&63)|128)}}}return A}var v=null;function u(){var A=[];for(var z=0,y,B;z<256;++z){B=z;y=8;while(y--){if((B&1)==1){B=(B>>>1)^3988292384}else{B>>>=1}}A[z]=B>>>0}return A}function w(){if(!v){v=u()}return v}return function(E){var D=x(E),C=-1,A=w();for(var B=0,z=D.length,F;B<z;++B){F=(C^D[B])&255;C=(C>>>8)^A[F]}return(C^-1)>>>0}})();var r=p.dom;function d(u){return u.replace(/</g,"<").replace(/>/g,">")}function o(x,w){w=w||[];var A=x.nodeType,v=x.childNodes,z=v.length;var C=[A,x.nodeName,z].join(":");var u="",y="";switch(A){case 3:u=d(x.nodeValue);break;case 8:u="<!--"+d(x.nodeValue)+"-->";break;default:u="<"+C+">";y="</>";break}if(u){w.push(u)}for(var B=0;B<z;++B){o(v[B],w)}if(y){w.push(y)}return w}function b(u){var v=o(u).join("");return e(v).toString(16)}function f(v,x,u){var w=[],y=v;u=u||r.getDocument(v).documentElement;while(y&&y!=u){w.push(r.getNodeIndex(y,true));y=y.parentNode}return w.join("/")+":"+x}function c(A,u,z){if(u){z=z||r.getDocument(u)}else{z=z||document;u=z.documentElement}var y=A.split(":");var x=u;var w=y[0]?y[0].split("/"):[],v=w.length,B;while(v--){B=parseInt(w[v],10);if(B<x.childNodes.length){x=x.childNodes[parseInt(w[v],10)]}else{throw a.createError("deserializePosition failed: node "+r.inspectNode(x)+" has no child with index "+B+", "+v)}}return new r.DomPosition(x,parseInt(y[1],10))}function h(v,x,u){u=u||p.DomRange.getRangeDocument(v).documentElement;if(!r.isAncestorOf(u,v.commonAncestorContainer,true)){throw new Error("serializeRange: range is not wholly contained within specified root node")}var w=f(v.startContainer,v.startOffset,u)+","+f(v.endContainer,v.endOffset,u);if(!x){w+="{"+b(u)+"}"}return w}function g(y,w,B){if(w){B=B||r.getDocument(w)}else{B=B||document;w=B.documentElement}var C=/^([^,]+),([^,\{]+)({([^}]+)})?$/.exec(y);var A=C[4],u=b(w);if(A&&A!==b(w)){throw new Error("deserializeRange: checksums of serialized range root node ("+A+") and target root node ("+u+") do not match")}var v=c(C[1],w,B),x=c(C[2],w,B);var z=p.createRange(B);z.setStart(v.node,v.offset);z.setEnd(x.node,x.offset);return z}function k(y,v,x){if(v){x=x||r.getDocument(v)}else{x=x||document;v=x.documentElement}var u=/^([^,]+),([^,]+)({([^}]+)})?$/.exec(y);var w=u[3];return !w||w===b(v)}function i(z,A,x){z=z||p.getSelection();var v=z.getAllRanges(),w=[];for(var y=0,u=v.length;y<u;++y){w[y]=h(v[y],A,x)}return w.join("|")}function t(B,x,A){if(x){A=A||r.getWindow(x)}else{A=A||window;x=A.document.documentElement}var w=B.split("|");var z=p.getSelection(A);var v=[];for(var y=0,u=w.length;y<u;++y){v[y]=g(w[y],x,A.document)}z.setRanges(v);return z}function j(A,w,z){var y;if(w){y=z?z.document:r.getDocument(w)}else{z=z||window;w=z.document.documentElement}var v=A.split("|");for(var x=0,u=v.length;x<u;++x){if(!k(v[x],w,y)){return false}}return true}var s="rangySerializedSelection";function n(w){var x=w.split(/[;,]/);for(var v=0,u=x.length,z,y;v<u;++v){z=x[v].split("=");if(z[0].replace(/^\s+/,"")==s){y=z[1];if(y){return decodeURIComponent(y.replace(/\s+$/,""))}}}return null}function l(v){v=v||window;var u=n(v.document.cookie);if(u){t(u,v.doc)}}function m(A,v){A=A||window;v=(typeof v=="object")?v:{};var u=v.expires?";expires="+v.expires.toUTCString():"";var z=v.path?";path="+v.path:"";var w=v.domain?";domain="+v.domain:"";var y=v.secure?";secure":"";var x=i(p.getSelection(A));A.document.cookie=encodeURIComponent(s)+"="+encodeURIComponent(x)+u+z+w+y}p.serializePosition=f;p.deserializePosition=c;p.serializeRange=h;p.deserializeRange=g;p.canDeserializeRange=k;p.serializeSelection=i;p.deserializeSelection=t;p.canDeserializeSelection=j;p.restoreSelectionFromCookie=l;p.saveSelectionCookie=m;p.getElementChecksum=b});rangy.createModule("CssClassApplier",function(g,e){g.requireModules(["WrappedSelection","WrappedRange"]);var b=g.dom;var z="span";function a(K){return K.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function D(L,K){return L.className&&new RegExp("(?:^|\\s)"+K+"(?:\\s|$)").test(L.className)}function r(L,K){if(L.className){if(!D(L,K)){L.className+=" "+K}}else{L.className=K}}var m=(function(){function K(L,N,M){return(N&&M)?" ":""}return function(M,L){if(M.className){M.className=M.className.replace(new RegExp("(?:^|\\s)"+L+"(?:\\s|$)"),K)}}})();function v(K){return K.split(/\s+/).sort().join(" ")}function s(K){return v(K.className)}function l(L,K){return s(L)==s(K)}function u(L){var K=L.parentNode;while(L.hasChildNodes()){K.insertBefore(L.firstChild,L)}K.removeChild(L)}function w(K,O){var L=K.cloneRange();L.selectNodeContents(O);var M=L.intersection(K);var N=M?M.toString():"";L.detach();return N!=""}function B(K){return K.getNodes([3],function(L){return w(K,L)})}function G(Q,O){if(Q.attributes.length!=O.attributes.length){return false}for(var P=0,K=Q.attributes.length,N,L,M;P<K;++P){N=Q.attributes[P];M=N.name;if(M!="class"){L=O.attributes.getNamedItem(M);if(N.specified!=L.specified){return false}if(N.specified&&N.nodeValue!==L.nodeValue){return false}}}return true}function H(O,N){for(var M=0,K=O.attributes.length,L;M<K;++M){L=O.attributes[M].name;if(!(N&&b.arrayContains(N,L))&&O.attributes[M].specified&&L!="class"){return true}}return false}function J(L,K){for(var M in K){if(K.hasOwnProperty(M)&&L[M]!==K[M]){return false}}return true}var n;if(typeof window.getComputedStyle!="undefined"){n=function(K,L){return b.getWindow(K).getComputedStyle(K,null)[L]}}else{if(typeof document.documentElement.currentStyle!="undefined"){n=function(K,L){return K.currentStyle[L]}}else{e.fail("No means of obtaining computed style properties found")}}var p;(function(){var K=document.createElement("div");if(typeof K.isContentEditable=="boolean"){p=function(L){return L&&L.nodeType==1&&L.isContentEditable}}else{p=function(L){if(!L||L.nodeType!=1||L.contentEditable=="false"){return false}return L.contentEditable=="true"||p(L.parentNode)}}})();function d(L){var K;return L&&L.nodeType==1&&(((K=L.parentNode)&&K.nodeType==9&&K.designMode=="on")||(p(L)&&!p(L.parentNode)))}function c(K){return(p(K)||(K.nodeType!=1&&p(K.parentNode)))&&!d(K)}var F=/^inline(-block|-table)?$/i;function f(K){return K&&K.nodeType==1&&!F.test(n(K,"display"))}var i=/[^\r\n\t\f \u200B]/;function C(K){if(K.data.length==0){return true}if(i.test(K.data)){return false}var L=n(K.parentNode,"whiteSpace");switch(L){case"pre":case"pre-wrap":case"-moz-pre-wrap":return false;case"pre-line":if(/[\r\n]/.test(K.data)){return false}}return f(K.previousSibling)||f(K.nextSibling)}function A(K,L){if(b.isCharacterDataNode(K)){if(L==0){return !!K.previousSibling}else{if(L==K.length){return !!K.nextSibling}else{return true}}}return L>0&&L<K.childNodes.length}function E(P,M,O,Q){var L;var K=(O==0);if(b.isAncestorOf(M,P)){throw e.createError("descendant is ancestor of node")}if(b.isCharacterDataNode(M)){if(O==0){O=b.getNodeIndex(M);M=M.parentNode}else{if(O==M.length){O=b.getNodeIndex(M)+1;M=M.parentNode}else{throw e.createError("splitNodeAt should not be called with offset in the middle of a data node ("+O+" in "+M.data)}}}if(A(M,O)){if(!L){L=M.cloneNode(false);if(L.id){L.removeAttribute("id")}var R;while((R=M.childNodes[O])){L.appendChild(R)}b.insertAfter(L,M)}return(M==P)?L:E(P,L.parentNode,b.getNodeIndex(L),Q)}else{if(P!=M){L=M.parentNode;var N=b.getNodeIndex(M);if(!K){N++}return E(P,L,N,Q)}}return P}function I(L,K){return L.tagName==K.tagName&&l(L,K)&&G(L,K)}function o(K){var L=K?"nextSibling":"previousSibling";return function(P,M){var N=P.parentNode;var O=P[L];if(O){if(O&&O.nodeType==3){return O}}else{if(M){O=N[L];if(O&&O.nodeType==1&&I(N,O)){return O[K?"firstChild":"lastChild"]}}}return null}}var q=o(false),k=o(true);function t(K){this.isElementMerge=(K.nodeType==1);this.firstTextNode=this.isElementMerge?K.lastChild:K;this.textNodes=[this.firstTextNode]}t.prototype={doMerge:function(){var P=[],O,M,N;for(var L=0,K=this.textNodes.length;L<K;++L){O=this.textNodes[L];M=O.parentNode;P[L]=O.data;if(L){M.removeChild(O);if(!M.hasChildNodes()){M.parentNode.removeChild(M)}}}this.firstTextNode.data=N=P.join("");return N},getLength:function(){var L=this.textNodes.length,K=0;while(L--){K+=this.textNodes[L].length}return K},toString:function(){var M=[];for(var L=0,K=this.textNodes.length;L<K;++L){M[L]="'"+this.textNodes[L].data+"'"}return"[Merge("+M.join(",")+")]"}};var x=["elementTagName","ignoreWhiteSpace","applyToEditableOnly"];var y={"class":"className"};function h(U,T,S){this.cssClass=U;var O,N,Q,P;var M=null;if(typeof T=="object"&&T!==null){S=T.tagNames;M=T.elementProperties;for(N=0;P=x[N++];){if(T.hasOwnProperty(P)){this[P]=T[P]}}O=T.normalize}else{O=T}this.normalize=(typeof O=="undefined")?true:O;this.attrExceptions=[];var L=document.createElement(this.elementTagName);this.elementProperties={};for(var K in M){if(M.hasOwnProperty(K)){if(y.hasOwnProperty(K)){K=y[K]}L[K]=M[K];this.elementProperties[K]=L[K];this.attrExceptions.push(K)}}this.elementSortedClassName=this.elementProperties.hasOwnProperty("className")?v(this.elementProperties.className+" "+U):U;this.applyToAnyTagName=false;var R=typeof S;if(R=="string"){if(S=="*"){this.applyToAnyTagName=true}else{this.tagNames=a(S.toLowerCase()).split(/\s*,\s*/)}}else{if(R=="object"&&typeof S.length=="number"){this.tagNames=[];for(N=0,Q=S.length;N<Q;++N){if(S[N]=="*"){this.applyToAnyTagName=true}else{this.tagNames.push(S[N].toLowerCase())}}}else{this.tagNames=[this.elementTagName]}}}h.prototype={elementTagName:z,elementProperties:{},ignoreWhiteSpace:true,applyToEditableOnly:false,hasClass:function(K){return K.nodeType==1&&b.arrayContains(this.tagNames,K.tagName.toLowerCase())&&D(K,this.cssClass)},getSelfOrAncestorWithClass:function(K){while(K){if(this.hasClass(K,this.cssClass)){return K}K=K.parentNode}return null},isModifiable:function(K){return !this.applyToEditableOnly||c(K)},isIgnorableWhiteSpaceNode:function(K){return this.ignoreWhiteSpace&&K&&K.nodeType==3&&C(K)},postApply:function(X,T,P){var K=X[0],L=X[X.length-1];var N=[],Y;var Q=K,M=L;var V=0,Z=L.length;var O,S;for(var R=0,U=X.length;R<U;++R){O=X[R];S=q(O,!P);if(S){if(!Y){Y=new t(S);N.push(Y)}Y.textNodes.push(O);if(O===K){Q=Y.firstTextNode;V=Q.length}if(O===L){M=Y.firstTextNode;Z=Y.getLength()}}else{Y=null}}var W=k(L,!P);if(W){if(!Y){Y=new t(L);N.push(Y)}Y.textNodes.push(W)}if(N.length){for(R=0,U=N.length;R<U;++R){N[R].doMerge()}T.setStart(Q,V);T.setEnd(M,Z)}},createContainer:function(L){var K=L.createElement(this.elementTagName);g.util.extend(K,this.elementProperties);r(K,this.cssClass);return K},applyToTextNode:function(M){var L=M.parentNode;if(L.childNodes.length==1&&b.arrayContains(this.tagNames,L.tagName.toLowerCase())){r(L,this.cssClass)}else{var K=this.createContainer(b.getDocument(M));M.parentNode.insertBefore(K,M);K.appendChild(M)}},isRemovable:function(K){return K.tagName.toLowerCase()==this.elementTagName&&s(K)==this.elementSortedClassName&&J(K,this.elementProperties)&&!H(K,this.attrExceptions)&&this.isModifiable(K)},undoToTextNode:function(N,L,M){if(!L.containsNode(M)){var K=L.cloneRange();K.selectNode(M);if(K.isPointInRange(L.endContainer,L.endOffset)){E(M,L.endContainer,L.endOffset,[L]);L.setEndAfter(M)}if(K.isPointInRange(L.startContainer,L.startOffset)){M=E(M,L.startContainer,L.startOffset,[L])}}if(this.isRemovable(M)){u(M)}else{m(M,this.cssClass)}},applyToRange:function(L){L.splitBoundaries();var N=B(L);if(N.length){var O;for(var M=0,K=N.length;M<K;++M){O=N[M];if(!this.isIgnorableWhiteSpaceNode(O)&&!this.getSelfOrAncestorWithClass(O)&&this.isModifiable(O)){this.applyToTextNode(O)}}L.setStart(N[0],0);O=N[N.length-1];L.setEnd(O,O.length);if(this.normalize){this.postApply(N,L,false)}}},applyToSelection:function(O){O=O||window;var N=g.getSelection(O);var L,K=N.getAllRanges();N.removeAllRanges();var M=K.length;while(M--){L=K[M];this.applyToRange(L);N.addRange(L)}},undoToRange:function(M){M.splitBoundaries();var O=B(M);var Q,P;var L=O[O.length-1];if(O.length){for(var N=0,K=O.length;N<K;++N){Q=O[N];P=this.getSelfOrAncestorWithClass(Q);if(P&&this.isModifiable(Q)){this.undoToTextNode(Q,M,P)}M.setStart(O[0],0);M.setEnd(L,L.length)}if(this.normalize){this.postApply(O,M,true)}}},undoToSelection:function(P){P=P||window;var O=g.getSelection(P);var L=O.getAllRanges(),M;O.removeAllRanges();for(var N=0,K=L.length;N<K;++N){M=L[N];this.undoToRange(M);O.addRange(M)}},getTextSelectedByRange:function(O,K){var L=K.cloneRange();L.selectNodeContents(O);var M=L.intersection(K);var N=M?M.toString():"";L.detach();return N},isAppliedToRange:function(K){if(K.collapsed){return !!this.getSelfOrAncestorWithClass(K.commonAncestorContainer)}else{var M=K.getNodes([3]);for(var L=0,N;N=M[L++];){if(!this.isIgnorableWhiteSpaceNode(N)&&w(K,N)&&this.isModifiable(N)&&!this.getSelfOrAncestorWithClass(N)){return false}}return true}},isAppliedToSelection:function(N){N=N||window;var M=g.getSelection(N);var K=M.getAllRanges();var L=K.length;while(L--){if(!this.isAppliedToRange(K[L])){return false}}return true},toggleRange:function(K){if(this.isAppliedToRange(K)){this.undoToRange(K)}else{this.applyToRange(K)}},toggleSelection:function(K){if(this.isAppliedToSelection(K)){this.undoToSelection(K)}else{this.applyToSelection(K)}},detach:function(){}};function j(L,M,K){return new h(L,M,K)}h.util={hasClass:D,addClass:r,removeClass:m,hasSameClasses:l,replaceWithOwnChildren:u,elementsHaveSameNonClassAttributes:G,elementHasNonClassAttributes:H,splitNodeAt:E,isEditableElement:p,isEditingHost:d,isEditable:c};g.CssClassApplier=h;g.createCssClassApplier=j});
/*
* jQuery Templates Plugin 1.0.0pre
* http://github.com/jquery/jquery-tmpl
* Requires jQuery 1.4.2
*
* Copyright Software Freedom Conservancy, Inc.
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*/
(function(i,f){var t=i.fn.domManip,h="_tmplitem",u=/^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /,p={},e={},y,x={key:0,data:{}},w=0,q=0,g=[];function k(B,A,D,E){var C={data:E||(E===0||E===false)?E:(A?A.data:{}),_wrap:A?A._wrap:null,tmpl:null,parent:A||null,nodes:[],calls:c,nest:b,wrap:n,html:r,update:z};if(B){i.extend(C,B,{nodes:[],parent:A})}if(D){C.tmpl=D;C._ctnt=C._ctnt||C.tmpl(i,C);C.key=++w;(g.length?e:p)[w]=C}return C}i.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(A,B){i.fn[A]=function(C){var F=[],I=i(C),E,G,D,J,H=this.length===1&&this[0].parentNode;y=p||{};if(H&&H.nodeType===11&&H.childNodes.length===1&&I.length===1){I[B](this[0]);F=this}else{for(G=0,D=I.length;G<D;G++){q=G;E=(G>0?this.clone(true):this).get();i(I[G])[B](E);F=F.concat(E)}q=0;F=this.pushStack(F,A,I.selector)}J=y;y=null;i.tmpl.complete(J);return F}});i.fn.extend({tmpl:function(C,B,A){return i.tmpl(this[0],C,B,A)},tmplItem:function(){return i.tmplItem(this[0])},template:function(A){return i.template(A,this[0])},domManip:function(E,H,G,I){if(E[0]&&i.isArray(E[0])){var B=i.makeArray(arguments),A=E[0],F=A.length,C=0,D;while(C<F&&!(D=i.data(A[C++],"tmplItem"))){}if(D&&q){B[2]=function(J){i.tmpl.afterManip(this,J,G)}}t.apply(this,B)}else{t.apply(this,arguments)}q=0;if(!y){i.tmpl.complete(p)}return this}});i.extend({tmpl:function(C,F,E,B){var D,A=!B;if(A){B=x;C=i.template[C]||i.template(null,C);e={}}else{if(!C){C=B.tmpl;p[B.key]=B;B.nodes=[];if(B.wrapped){s(B,B.wrapped)}return i(m(B,null,B.tmpl(i,B)))}}if(!C){return[]}if(typeof F==="function"){F=F.call(B||{})}if(E&&E.wrapped){s(E,E.wrapped)}D=i.isArray(F)?i.map(F,function(G){return G?k(E,B,C,G):null}):[k(E,B,C,F)];return A?i(m(B,null,D)):D},tmplItem:function(B){var A;if(B instanceof i){B=B[0]}while(B&&B.nodeType===1&&!(A=i.data(B,"tmplItem"))&&(B=B.parentNode)){}return A||x},template:function(B,A){if(A){if(typeof A==="string"){A=l(A)}else{if(A instanceof i){A=A[0]||{}}}if(A.nodeType){A=i.data(A,"tmpl")||i.data(A,"tmpl",l(A.innerHTML))}return typeof B==="string"?(i.template[B]=A):A}return B?(typeof B!=="string"?i.template(null,B):(i.template[B]||i.template(null,u.test(B)?B:i(B)))):null},encode:function(A){return(""+A).split("<").join("<").split(">").join(">").split('"').join(""").split("'").join("'")}});i.extend(i.tmpl,{tag:{tmpl:{_default:{$2:"null"},open:"if($notnull_1){__=__.concat($item.nest($1,$2));}"},wrap:{_default:{$2:"null"},open:"$item.calls(__,$1,$2);__=[];",close:"call=$item.calls();__=call._.concat($item.wrap(call,__));"},each:{_default:{$2:"$index, $value"},open:"if($notnull_1){$.each($1a,function($2){with(this){",close:"}});}"},"if":{open:"if(($notnull_1) && $1a){",close:"}"},"else":{_default:{$1:"true"},open:"}else if(($notnull_1) && $1a){"},html:{open:"if($notnull_1){__.push($1a);}"},"=":{_default:{$1:"$data"},open:"if($notnull_1){__.push($.encode($1a));}"},"!":{open:""}},complete:function(A){p={}},afterManip:function v(C,A,D){var B=A.nodeType===11?i.makeArray(A.childNodes):A.nodeType===1?[A]:[];D.call(C,A);o(B);q++}});function m(A,E,C){var D,B=C?i.map(C,function(F){return(typeof F==="string")?(A.key?F.replace(/(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g,"$1 "+h+'="'+A.key+'" $2'):F):m(F,A,F._ctnt)}):A;if(E){return B}B=B.join("");B.replace(/^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/,function(G,H,F,I){D=i(F).get();o(D);if(H){D=a(H).concat(D)}if(I){D=D.concat(a(I))}});return D?D:a(B)}function a(B){var A=document.createElement("div");A.innerHTML=B;return i.makeArray(A.childNodes)}function l(A){return new Function("jQuery","$item","var $=jQuery,call,__=[],$data=$item.data;with($data){__.push('"+i.trim(A).replace(/([\\'])/g,"\\$1").replace(/[\r\t\n]/g," ").replace(/\$\{([^\}]*)\}/g,"{{= $1}}").replace(/\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g,function(I,C,G,D,E,J,F){var L=i.tmpl.tag[G],B,H,K;if(!L){throw"Unknown template tag: "+G}B=L._default||[];if(J&&!/\w$/.test(E)){E+=J;J=""}if(E){E=j(E);F=F?(","+j(F)+")"):(J?")":"");H=J?(E.indexOf(".")>-1?E+j(J):("("+E+").call($item"+F)):E;K=J?H:"(typeof("+E+")==='function'?("+E+").call($item):("+E+"))"}else{K=H=B.$1||"null"}D=j(D);return"');"+L[C?"close":"open"].split("$notnull_1").join(E?"typeof("+E+")!=='undefined' && ("+E+")!=null":"true").split("$1a").join(K).split("$1").join(H).split("$2").join(D||B.$2||"")+"__.push('"})+"');}return __;")}function s(B,A){B._wrap=m(B,true,i.isArray(A)?A:[u.test(A)?A:i(A).html()]).join("")}function j(A){return A?A.replace(/\\'/g,"'").replace(/\\\\/g,"\\"):null}function d(A){var B=document.createElement("div");B.appendChild(A.cloneNode(true));return B.innerHTML}function o(G){var I="_"+q,B,A,E={},F,D,C;for(F=0,D=G.length;F<D;F++){if((B=G[F]).nodeType!==1){continue}A=B.getElementsByTagName("*");for(C=A.length-1;C>=0;C--){H(A[C])}H(B)}function H(O){var L,N=O,M,J,K;if((K=O.getAttribute(h))){while(N.parentNode&&(N=N.parentNode).nodeType===1&&!(L=N.getAttribute(h))){}if(L!==K){N=N.parentNode?(N.nodeType===11?0:(N.getAttribute(h)||0)):0;if(!(J=p[K])){J=e[K];J=k(J,p[N]||e[N]);J.key=++w;p[w]=J}if(q){P(K)}}O.removeAttribute(h)}else{if(q&&(J=i.data(O,"tmplItem"))){P(J.key);p[J.key]=J;N=i.data(O.parentNode,"tmplItem");N=N?N.key:0}}if(J){M=J;while(M&&M.key!=N){M.nodes.push(O);M=M.parent}delete J._ctnt;delete J._wrap;i.data(O,"tmplItem",J)}function P(Q){Q=Q+I;J=E[Q]=(E[Q]||k(J,p[J.parent.key+I]||J.parent))}}}function c(C,A,D,B){if(!C){return g.pop()}g.push({_:C,tmpl:A,item:this,data:D,options:B})}function b(A,C,B){return i.tmpl(i.template(A),C,B,this)}function n(C,A){var B=C.options||{};B.wrapped=A;return i.tmpl(i.template(C.tmpl),C.data,B,C.item)}function r(B,C){var A=this._wrap;return i.map(i(i.isArray(A)?A.join(""):A).filter(B||"*"),function(D){return C?D.innerText||D.textContent:D.outerHTML||d(D)})}function z(){var A=this.nodes;i.tmpl(null,null,null,this).insertBefore(A[0]);i(A).remove()}})(jQuery);(function($){$.toJSON=function(o){if(typeof(JSON)=="object"&&JSON.stringify){return JSON.stringify(o)}var type=typeof(o);if(o===null){return"null"}if(type=="undefined"){return undefined}if(type=="number"||type=="boolean"){return o+""}if(type=="string"){return $.quoteString(o)}if(type=="object"){if(typeof o.toJSON=="function"){return $.toJSON(o.toJSON())}if(o.constructor===Date){var month=o.getUTCMonth()+1;if(month<10){month="0"+month}var day=o.getUTCDate();if(day<10){day="0"+day}var year=o.getUTCFullYear();var hours=o.getUTCHours();if(hours<10){hours="0"+hours}var minutes=o.getUTCMinutes();if(minutes<10){minutes="0"+minutes}var seconds=o.getUTCSeconds();if(seconds<10){seconds="0"+seconds}var milli=o.getUTCMilliseconds();if(milli<100){milli="0"+milli}if(milli<10){milli="0"+milli}return'"'+year+"-"+month+"-"+day+"T"+hours+":"+minutes+":"+seconds+"."+milli+'Z"'}if(o.constructor===Array){var ret=[];for(var i=0;i<o.length;i++){ret.push($.toJSON(o[i])||"null")}return"["+ret.join(",")+"]"}var pairs=[];for(var k in o){var name;var type=typeof k;if(type=="number"){name='"'+k+'"'}else{if(type=="string"){name=$.quoteString(k)}else{continue}}if(typeof o[k]=="function"){continue}var val=$.toJSON(o[k]);pairs.push(name+":"+val)}return"{"+pairs.join(", ")+"}"}};$.evalJSON=function(src){if(typeof(JSON)=="object"&&JSON.parse){return JSON.parse(src)}return eval("("+src+")")};$.secureEvalJSON=function(src){if(typeof(JSON)=="object"&&JSON.parse){return JSON.parse(src)}var filtered=src;filtered=filtered.replace(/\\["\\\/bfnrtu]/g,"@");filtered=filtered.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]");filtered=filtered.replace(/(?:^|:|,)(?:\s*\[)+/g,"");if(/^[\],:{}\s]*$/.test(filtered)){return eval("("+src+")")}else{throw new SyntaxError("Error parsing JSON, source is not valid.")}};$.quoteString=function(string){if(string.match(_escapeable)){return'"'+string.replace(_escapeable,function(a){var c=_meta[a];if(typeof c==="string"){return c}c=a.charCodeAt();return"\\u00"+Math.floor(c/16).toString(16)+(c%16).toString(16)})+'"'}return'"'+string+'"'};var _escapeable=/["\\\x00-\x1f\x7f-\x9f]/g;var _meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"}})(jQuery);(function(f){if(!f||!(f.toJSON||Object.toJSON||window.JSON)){throw new Error("jQuery, MooTools or Prototype needs to be loaded before jStorage!")}var g={},d={jStorage:"{}"},h=null,j=0,l=f.toJSON||Object.toJSON||(window.JSON&&(JSON.encode||JSON.stringify)),e=f.evalJSON||(window.JSON&&(JSON.decode||JSON.parse))||function(m){return String(m).evalJSON()},i=false;_XMLService={isXML:function(n){var m=(n?n.ownerDocument||n:0).documentElement;return m?m.nodeName!=="HTML":false},encode:function(n){if(!this.isXML(n)){return false}try{return new XMLSerializer().serializeToString(n)}catch(m){try{return n.xml}catch(o){}}return false},decode:function(n){var m=("DOMParser" in window&&(new DOMParser()).parseFromString)||(window.ActiveXObject&&function(p){var q=new ActiveXObject("Microsoft.XMLDOM");q.async="false";q.loadXML(p);return q}),o;if(!m){return false}o=m.call("DOMParser" in window&&(new DOMParser())||window,n,"text/xml");return this.isXML(o)?o:false}};function k(){if("localStorage" in window){try{if(window.localStorage){d=window.localStorage;i="localStorage"}}catch(p){}}else{if("globalStorage" in window){try{if(window.globalStorage){d=window.globalStorage[window.location.hostname];i="globalStorage"}}catch(o){}}else{h=document.createElement("link");if(h.addBehavior){h.style.behavior="url(#default#userData)";document.getElementsByTagName("head")[0].appendChild(h);h.load("jStorage");var n="{}";try{n=h.getAttribute("jStorage")}catch(m){}d.jStorage=n;i="userDataBehavior"}else{h=null;return}}}b()}function b(){if(d.jStorage){try{g=e(String(d.jStorage))}catch(m){d.jStorage="{}"}}else{d.jStorage="{}"}j=d.jStorage?String(d.jStorage).length:0}function c(){try{d.jStorage=l(g);if(h){h.setAttribute("jStorage",d.jStorage);h.save("jStorage")}j=d.jStorage?String(d.jStorage).length:0}catch(m){}}function a(m){if(!m||(typeof m!="string"&&typeof m!="number")){throw new TypeError("Key name must be string or numeric")}return true}f.jStorage={version:"0.1.5.2",set:function(m,n){a(m);if(_XMLService.isXML(n)){n={_is_xml:true,xml:_XMLService.encode(n)}}g[m]=n;c();return n},get:function(m,n){a(m);if(m in g){if(g[m]&&typeof g[m]=="object"&&g[m]._is_xml&&g[m]._is_xml){return _XMLService.decode(g[m].xml)}else{return g[m]}}return typeof(n)=="undefined"?null:n},deleteKey:function(m){a(m);if(m in g){delete g[m];c();return true}return false},flush:function(){g={};c();return true},storageObj:function(){function m(){}m.prototype=g;return new m()},index:function(){var m=[],n;for(n in g){if(g.hasOwnProperty(n)){m.push(n)}}return m},storageSize:function(){return j},currentBackend:function(){return i},storageAvailable:function(){return !!i},reInit:function(){var m,o;if(h&&h.addBehavior){m=document.createElement("link");h.parentNode.replaceChild(m,h);h=m;h.style.behavior="url(#default#userData)";document.getElementsByTagName("head")[0].appendChild(h);h.load("jStorage");o="{}";try{o=h.getAttribute("jStorage")}catch(n){}d.jStorage=o;i="userDataBehavior"}b()}};k()})(window.jQuery||window.$);(function(a){a.fn.hoverIntent=function(b){var i={sensitivity:7,interval:100,timeout:0};if(b){i=a.extend(true,i,b)}var k,j,g,e;var f=function(l){k=l.pageX;j=l.pageY};var d=function(m,l){l.hoverIntent_t=clearTimeout(l.hoverIntent_t);if((Math.abs(g-k)+Math.abs(e-j))<i.sensitivity){a(l).unbind("mousemove",f);l.hoverIntent_s=1;m.type="hoverIntentOver";a(l).trigger(m)}else{g=k;e=j;l.hoverIntent_t=setTimeout(function(){d(m,l)},i.interval)}};var h=function(m,l){l.hoverIntent_t=clearTimeout(l.hoverIntent_t);l.hoverIntent_s=0;m.type="hoverIntentOut";a(l).trigger(m)};var c=function(n){var m=jQuery.extend({},n);var l=this;if(l.hoverIntent_t){l.hoverIntent_t=clearTimeout(l.hoverIntent_t)}if(n.type=="mouseenter"){g=m.pageX;e=m.pageY;a(l).bind("mousemove",f);if(l.hoverIntent_s!=1){l.hoverIntent_t=setTimeout(function(){d(m,l)},i.interval)}}else{a(l).unbind("mousemove",f);if(l.hoverIntent_s==1){l.hoverIntent_t=setTimeout(function(){h(m,l)},i.timeout)}}};if(a.isFunction(i.over)){this.bind("hoverIntentOver.hoverIntent",i.over)}if(a.isFunction(i.out)){this.bind("hoverIntentOut.hoverIntent",i.out)}return this.bind("mouseenter.hoverIntent",c).bind("mouseleave.hoverIntent",c)};a.fn.unhoverIntent=function(){return this.unbind(".hoverIntent")}})(jQuery);(function(a){a.fn.delegateHoverIntent=function(c,b){var d=this;d.delegate(c,"mouseenter mouseleave",function(h){var f=a(this);var i=f.data("hoverIntentTimer");var g=a.Event(h);if(h.type==="mouseleave"){if(i){clearTimeout(i);return}g.type="hover-out";f.trigger(g);return}i=setTimeout(function(){f.removeData("hoverIntentTimer");g.type="hover-in";f.trigger(g)},250);f.data("hoverIntentTimer",i)});if(b){d.delegate(c,"hover-in hover-out",function(f){b.call(this,f)})}};a.fn.undelegateHoverIntent=function(b){var c=this;c.undelegate(b,"mouseenter mouseleave");c.undelegate(b,"hover-in hover-out")}}(jQuery));(function(a){a.User=function(b){var c={id:null,name:"anonymous",fullName:"Anonymous",avatarUrl:"images/avatar.jpg"};return this.init(a.extend(c,true,b||{}))};a.User.prototype={init:function(b){this.props=b;return this},getId:function(){return this.props.id},getName:function(){return this.props.name},getFullName:function(){return this.props.fullName},getAvatarUrl:function(){return this.props.avatarUrl},serialize:function(){return this.props},destroy:function(){var b=this;var c=b.props;delete c.id;delete c.name;delete c.fullName}}}(jQuery));
/*
* jQuery UI 1.8.16
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI
*/
(function(a,d){a.ui=a.ui||{};if(a.ui.version){return}a.extend(a.ui,{version:"1.8.16",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});a.fn.extend({propAttr:a.fn.prop||a.fn.attr,_focus:a.fn.focus,focus:function(e,f){return typeof e==="number"?this.each(function(){var g=this;setTimeout(function(){a(g).focus();if(f){f.call(g)}},e)}):this._focus.apply(this,arguments)},scrollParent:function(){var e;if((a.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){e=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(a.curCSS(this,"position",1))&&(/(auto|scroll)/).test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0)}else{e=this.parents().filter(function(){return(/(auto|scroll)/).test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!e.length?a(document):e},zIndex:function(h){if(h!==d){return this.css("zIndex",h)}if(this.length){var f=a(this[0]),e,g;while(f.length&&f[0]!==document){e=f.css("position");if(e==="absolute"||e==="relative"||e==="fixed"){g=parseInt(f.css("zIndex"),10);if(!isNaN(g)&&g!==0){return g}}f=f.parent()}}return 0},disableSelection:function(){return this.bind((a.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(e){e.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});a.each(["Width","Height"],function(g,e){var f=e==="Width"?["Left","Right"]:["Top","Bottom"],h=e.toLowerCase(),k={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};function j(m,l,i,n){a.each(f,function(){l-=parseFloat(a.curCSS(m,"padding"+this,true))||0;if(i){l-=parseFloat(a.curCSS(m,"border"+this+"Width",true))||0}if(n){l-=parseFloat(a.curCSS(m,"margin"+this,true))||0}});return l}a.fn["inner"+e]=function(i){if(i===d){return k["inner"+e].call(this)}return this.each(function(){a(this).css(h,j(this,i)+"px")})};a.fn["outer"+e]=function(i,l){if(typeof i!=="number"){return k["outer"+e].call(this,i)}return this.each(function(){a(this).css(h,j(this,i,true,l)+"px")})}});function c(g,e){var j=g.nodeName.toLowerCase();if("area"===j){var i=g.parentNode,h=i.name,f;if(!g.href||!h||i.nodeName.toLowerCase()!=="map"){return false}f=a("img[usemap=#"+h+"]")[0];return !!f&&b(f)}return(/input|select|textarea|button|object/.test(j)?!g.disabled:"a"==j?g.href||e:e)&&b(g)}function b(e){return !a(e).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}a.extend(a.expr[":"],{data:function(g,f,e){return !!a.data(g,e[3])},focusable:function(e){return c(e,!isNaN(a.attr(e,"tabindex")))},tabbable:function(g){var e=a.attr(g,"tabindex"),f=isNaN(e);return(f||e>=0)&&c(g,!f)}});a(function(){var e=document.body,f=e.appendChild(f=document.createElement("div"));a.extend(f.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});a.support.minHeight=f.offsetHeight===100;a.support.selectstart="onselectstart" in f;e.removeChild(f).style.display="none"});a.extend(a.ui,{plugin:{add:function(f,g,j){var h=a.ui[f].prototype;for(var e in j){h.plugins[e]=h.plugins[e]||[];h.plugins[e].push([g,j[e]])}},call:function(e,g,f){var j=e.plugins[g];if(!j||!e.element[0].parentNode){return}for(var h=0;h<j.length;h++){if(e.options[j[h][0]]){j[h][1].apply(e.element,f)}}}},contains:function(f,e){return document.compareDocumentPosition?f.compareDocumentPosition(e)&16:f!==e&&f.contains(e)},hasScroll:function(h,f){if(a(h).css("overflow")==="hidden"){return false}var e=(f&&f==="left")?"scrollLeft":"scrollTop",g=false;if(h[e]>0){return true}h[e]=1;g=(h[e]>0);h[e]=0;return g},isOverAxis:function(f,e,g){return(f>e)&&(f<(e+g))},isOver:function(j,f,i,h,e,g){return a.ui.isOverAxis(j,i,e)&&a.ui.isOverAxis(f,h,g)}})})(jQuery);
/*
* jQuery UI Widget 1.8.16
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Widget
*/
(function(b,d){if(b.cleanData){var c=b.cleanData;b.cleanData=function(f){for(var g=0,h;(h=f[g])!=null;g++){try{b(h).triggerHandler("remove")}catch(j){}}c(f)}}else{var a=b.fn.remove;b.fn.remove=function(e,f){return this.each(function(){if(!f){if(!e||b.filter(e,[this]).length){b("*",this).add([this]).each(function(){try{b(this).triggerHandler("remove")}catch(g){}})}}return a.call(b(this),e,f)})}}b.widget=function(f,h,e){var g=f.split(".")[0],j;f=f.split(".")[1];j=g+"-"+f;if(!e){e=h;h=b.Widget}b.expr[":"][j]=function(k){return !!b.data(k,f)};b[g]=b[g]||{};b[g][f]=function(k,l){if(arguments.length){this._createWidget(k,l)}};var i=new h();i.options=b.extend(true,{},i.options);b[g][f].prototype=b.extend(true,i,{namespace:g,widgetName:f,widgetEventPrefix:b[g][f].prototype.widgetEventPrefix||f,widgetBaseClass:j},e);b.widget.bridge(f,b[g][f])};b.widget.bridge=function(f,e){b.fn[f]=function(i){var g=typeof i==="string",h=Array.prototype.slice.call(arguments,1),j=this;i=!g&&h.length?b.extend.apply(null,[true,i].concat(h)):i;if(g&&i.charAt(0)==="_"){return j}if(g){this.each(function(){var k=b.data(this,f),l=k&&b.isFunction(k[i])?k[i].apply(k,h):k;if(l!==k&&l!==d){j=l;return false}})}else{this.each(function(){var k=b.data(this,f);if(k){k.option(i||{})._init()}else{b.data(this,f,new e(i,this))}})}return j}};b.Widget=function(e,f){if(arguments.length){this._createWidget(e,f)}};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(f,g){b.data(g,this.widgetName,this);this.element=b(g);this.options=b.extend(true,{},this.options,this._getCreateOptions(),f);var e=this;this.element.bind("remove."+this.widgetName,function(){e.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(f,g){var e=f;if(arguments.length===0){return b.extend({},this.options)}if(typeof f==="string"){if(g===d){return this.options[f]}e={};e[f]=g}this._setOptions(e);return this},_setOptions:function(f){var e=this;b.each(f,function(g,h){e._setOption(g,h)});return this},_setOption:function(e,f){this.options[e]=f;if(e==="disabled"){this.widget()[f?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",f)}return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(f,g,h){var k=this.options[f];g=b.Event(g);g.type=(f===this.widgetEventPrefix?f:this.widgetEventPrefix+f).toLowerCase();h=h||{};if(g.originalEvent){for(var e=b.event.props.length,j;e;){j=b.event.props[--e];g[j]=g.originalEvent[j]}}this.element.trigger(g,h);return !(b.isFunction(k)&&k.call(this.element[0],g,h)===false||g.isDefaultPrevented())}}})(jQuery);(function(f,g){f.ui=f.ui||{};var d=/left|center|right/,e=/top|center|bottom/,a="center",b=f.fn.position,c=f.fn.offset;f.fn.position=function(i){if(!i||!i.of){return b.apply(this,arguments)}i=f.extend({},i);var m=f(i.of),l=m[0],o=(i.collision||"flip").split(" "),n=i.offset?i.offset.split(" "):[0,0],k,h,j;if(l.nodeType===9){k=m.width();h=m.height();j={top:0,left:0}}else{if(l.setTimeout){k=m.width();h=m.height();j={top:m.scrollTop(),left:m.scrollLeft()}}else{if(l.preventDefault){i.at="left top";k=h=0;j={top:i.of.pageY,left:i.of.pageX}}else{k=m.outerWidth();h=m.outerHeight();j=m.offset()}}}f.each(["my","at"],function(){var p=(i[this]||"").split(" ");if(p.length===1){p=d.test(p[0])?p.concat([a]):e.test(p[0])?[a].concat(p):[a,a]}p[0]=d.test(p[0])?p[0]:a;p[1]=e.test(p[1])?p[1]:a;i[this]=p});if(o.length===1){o[1]=o[0]}n[0]=parseInt(n[0],10)||0;if(n.length===1){n[1]=n[0]}n[1]=parseInt(n[1],10)||0;if(i.at[0]==="right"){j.left+=k}else{if(i.at[0]===a){j.left+=k/2}}if(i.at[1]==="bottom"){j.top+=h}else{if(i.at[1]===a){j.top+=h/2}}j.left+=n[0];j.top+=n[1];return this.each(function(){var s=f(this),u=s.outerWidth(),r=s.outerHeight(),t=parseInt(f.curCSS(this,"marginLeft",true))||0,q=parseInt(f.curCSS(this,"marginTop",true))||0,w=u+t+(parseInt(f.curCSS(this,"marginRight",true))||0),x=r+q+(parseInt(f.curCSS(this,"marginBottom",true))||0),v=f.extend({},j),p;if(i.my[0]==="right"){v.left-=u}else{if(i.my[0]===a){v.left-=u/2}}if(i.my[1]==="bottom"){v.top-=r}else{if(i.my[1]===a){v.top-=r/2}}v.left=Math.round(v.left);v.top=Math.round(v.top);p={left:v.left-t,top:v.top-q};f.each(["left","top"],function(z,y){if(f.ui.position[o[z]]){f.ui.position[o[z]][y](v,{targetWidth:k,targetHeight:h,elemWidth:u,elemHeight:r,collisionPosition:p,collisionWidth:w,collisionHeight:x,offset:n,my:i.my,at:i.at})}});if(f.fn.bgiframe){s.bgiframe()}s.offset(f.extend(v,{using:i.using}))})};f.ui.position={fit:{left:function(h,i){var k=f(window),j=i.collisionPosition.left+i.collisionWidth-k.width()-k.scrollLeft();h.left=j>0?h.left-j:Math.max(h.left-i.collisionPosition.left,h.left)},top:function(h,i){var k=f(window),j=i.collisionPosition.top+i.collisionHeight-k.height()-k.scrollTop();h.top=j>0?h.top-j:Math.max(h.top-i.collisionPosition.top,h.top)}},flip:{left:function(i,k){if(k.at[0]===a){return}var m=f(window),l=k.collisionPosition.left+k.collisionWidth-m.width()-m.scrollLeft(),h=k.my[0]==="left"?-k.elemWidth:k.my[0]==="right"?k.elemWidth:0,j=k.at[0]==="left"?k.targetWidth:-k.targetWidth,n=-2*k.offset[0];i.left+=k.collisionPosition.left<0?h+j+n:l>0?h+j+n:0},top:function(i,k){if(k.at[1]===a){return}var m=f(window),l=k.collisionPosition.top+k.collisionHeight-m.height()-m.scrollTop(),h=k.my[1]==="top"?-k.elemHeight:k.my[1]==="bottom"?k.elemHeight:0,j=k.at[1]==="top"?k.targetHeight:-k.targetHeight,n=-2*k.offset[1];i.top+=k.collisionPosition.top<0?h+j+n:l>0?h+j+n:0}}};if(!f.offset.setOffset){f.offset.setOffset=function(l,i){if(/static/.test(f.curCSS(l,"position"))){l.style.position="relative"}var k=f(l),n=k.offset(),h=parseInt(f.curCSS(l,"top",true),10)||0,m=parseInt(f.curCSS(l,"left",true),10)||0,j={top:(i.top-n.top)+h,left:(i.left-n.left)+m};if("using" in i){i.using.call(l,j)}else{k.css(j)}};f.fn.offset=function(h){var i=this[0];if(!i||!i.ownerDocument){return null}if(h){return this.each(function(){f.offset.setOffset(this,h)})}return c.call(this)}}}(jQuery));(function(f,b){var k,e,a,h,i="ui-button ui-widget ui-state-default ui-corner-all",c="ui-state-hover ui-state-active ",g="ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",j=function(){var l=f(this).find(":ui-button");setTimeout(function(){l.button("refresh")},1)},d=function(m){var l=m.name,n=m.form,o=f([]);if(l){if(n){o=f(n).find("[name='"+l+"']")}else{o=f("[name='"+l+"']",m.ownerDocument).filter(function(){return !this.form})}}return o};f.widget("ui.button",{options:{disabled:null,text:true,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset.button").bind("reset.button",j);if(typeof this.options.disabled!=="boolean"){this.options.disabled=this.element.propAttr("disabled")}this._determineButtonType();this.hasTitle=!!this.buttonElement.attr("title");var l=this,n=this.options,o=this.type==="checkbox"||this.type==="radio",p="ui-state-hover"+(!o?" ui-state-active":""),m="ui-state-focus";if(n.label===null){n.label=this.buttonElement.html()}if(this.element.is(":disabled")){n.disabled=true}this.buttonElement.addClass(i).attr("role","button").bind("mouseenter.button",function(){if(n.disabled){return}f(this).addClass("ui-state-hover");if(this===k){f(this).addClass("ui-state-active")}}).bind("mouseleave.button",function(){if(n.disabled){return}f(this).removeClass(p)}).bind("click.button",function(q){if(n.disabled){q.preventDefault();q.stopImmediatePropagation()}});this.element.bind("focus.button",function(){l.buttonElement.addClass(m)}).bind("blur.button",function(){l.buttonElement.removeClass(m)});if(o){this.element.bind("change.button",function(){if(h){return}l.refresh()});this.buttonElement.bind("mousedown.button",function(q){if(n.disabled){return}h=false;e=q.pageX;a=q.pageY}).bind("mouseup.button",function(q){if(n.disabled){return}if(e!==q.pageX||a!==q.pageY){h=true}})}if(this.type==="checkbox"){this.buttonElement.bind("click.button",function(){if(n.disabled||h){return false}f(this).toggleClass("ui-state-active");l.buttonElement.attr("aria-pressed",l.element[0].checked)})}else{if(this.type==="radio"){this.buttonElement.bind("click.button",function(){if(n.disabled||h){return false}f(this).addClass("ui-state-active");l.buttonElement.attr("aria-pressed","true");var q=l.element[0];d(q).not(q).map(function(){return f(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")})}else{this.buttonElement.bind("mousedown.button",function(){if(n.disabled){return false}f(this).addClass("ui-state-active");k=this;f(document).one("mouseup",function(){k=null})}).bind("mouseup.button",function(){if(n.disabled){return false}f(this).removeClass("ui-state-active")}).bind("keydown.button",function(q){if(n.disabled){return false}if(q.keyCode==f.ui.keyCode.SPACE||q.keyCode==f.ui.keyCode.ENTER){f(this).addClass("ui-state-active")}}).bind("keyup.button",function(){f(this).removeClass("ui-state-active")});if(this.buttonElement.is("a")){this.buttonElement.keyup(function(q){if(q.keyCode===f.ui.keyCode.SPACE){f(this).click()}})}}}this._setOption("disabled",n.disabled);this._resetButton()},_determineButtonType:function(){if(this.element.is(":checkbox")){this.type="checkbox"}else{if(this.element.is(":radio")){this.type="radio"}else{if(this.element.is("input")){this.type="input"}else{this.type="button"}}}if(this.type==="checkbox"||this.type==="radio"){var l=this.element.parents().filter(":last"),n="label[for='"+this.element.attr("id")+"']";this.buttonElement=l.find(n);if(!this.buttonElement.length){l=l.length?l.siblings():this.element.siblings();this.buttonElement=l.filter(n);if(!this.buttonElement.length){this.buttonElement=l.find(n)}}this.element.addClass("ui-helper-hidden-accessible");var m=this.element.is(":checked");if(m){this.buttonElement.addClass("ui-state-active")}this.buttonElement.attr("aria-pressed",m)}else{this.buttonElement=this.element}},widget:function(){return this.buttonElement},destroy:function(){this.element.removeClass("ui-helper-hidden-accessible");this.buttonElement.removeClass(i+" "+c+" "+g).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html());if(!this.hasTitle){this.buttonElement.removeAttr("title")}f.Widget.prototype.destroy.call(this)},_setOption:function(l,m){f.Widget.prototype._setOption.apply(this,arguments);if(l==="disabled"){if(m){this.element.propAttr("disabled",true)}else{this.element.propAttr("disabled",false)}return}this._resetButton()},refresh:function(){var l=this.element.is(":disabled");if(l!==this.options.disabled){this._setOption("disabled",l)}if(this.type==="radio"){d(this.element[0]).each(function(){if(f(this).is(":checked")){f(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true")}else{f(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")}})}else{if(this.type==="checkbox"){if(this.element.is(":checked")){this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true")}else{this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false")}}}},_resetButton:function(){if(this.type==="input"){if(this.options.label){this.element.val(this.options.label)}return}var p=this.buttonElement.removeClass(g),n=f("<span></span>").addClass("ui-button-text").html(this.options.label).appendTo(p.empty()).text(),m=this.options.icons,l=m.primary&&m.secondary,o=[];if(m.primary||m.secondary){if(this.options.text){o.push("ui-button-text-icon"+(l?"s":(m.primary?"-primary":"-secondary")))}if(m.primary){p.prepend("<span class='ui-button-icon-primary ui-icon "+m.primary+"'></span>")}if(m.secondary){p.append("<span class='ui-button-icon-secondary ui-icon "+m.secondary+"'></span>")}if(!this.options.text){o.push(l?"ui-button-icons-only":"ui-button-icon-only");if(!this.hasTitle){p.attr("title",n)}}}else{o.push("ui-button-text-only")}p.addClass(o.join(" "))}});f.widget("ui.buttonset",{options:{items:":button, :submit, :reset, :checkbox, :radio, a, :data(button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(l,m){if(l==="disabled"){this.buttons.button("option",l,m)}f.Widget.prototype._setOption.apply(this,arguments)},refresh:function(){var l=this.element.css("direction")==="ltr";this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return f(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(l?"ui-corner-left":"ui-corner-right").end().filter(":last").addClass(l?"ui-corner-right":"ui-corner-left").end().end()},destroy:function(){this.element.removeClass("ui-buttonset");this.buttons.map(function(){return f(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy");f.Widget.prototype.destroy.call(this)}})}(jQuery));jQuery.effects||(function(h,e){h.effects={};h.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","borderColor","color","outlineColor"],function(n,m){h.fx.step[m]=function(o){if(!o.colorInit){o.start=l(o.elem,m);o.end=j(o.end);o.colorInit=true}o.elem.style[m]="rgb("+Math.max(Math.min(parseInt((o.pos*(o.end[0]-o.start[0]))+o.start[0],10),255),0)+","+Math.max(Math.min(parseInt((o.pos*(o.end[1]-o.start[1]))+o.start[1],10),255),0)+","+Math.max(Math.min(parseInt((o.pos*(o.end[2]-o.start[2]))+o.start[2],10),255),0)+")"}});function j(n){var m;if(n&&n.constructor==Array&&n.length==3){return n}if(m=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(n)){return[parseInt(m[1],10),parseInt(m[2],10),parseInt(m[3],10)]}if(m=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(n)){return[parseFloat(m[1])*2.55,parseFloat(m[2])*2.55,parseFloat(m[3])*2.55]}if(m=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(n)){return[parseInt(m[1],16),parseInt(m[2],16),parseInt(m[3],16)]}if(m=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(n)){return[parseInt(m[1]+m[1],16),parseInt(m[2]+m[2],16),parseInt(m[3]+m[3],16)]}if(m=/rgba\(0, 0, 0, 0\)/.exec(n)){return a.transparent}return a[h.trim(n).toLowerCase()]}function l(o,m){var n;do{n=h.curCSS(o,m);if(n!=""&&n!="transparent"||h.nodeName(o,"body")){break}m="backgroundColor"}while(o=o.parentNode);return j(n)}var a={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]};var f=["add","remove","toggle"],c={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};function g(){var p=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle,q={},n,o;if(p&&p.length&&p[0]&&p[p[0]]){var m=p.length;while(m--){n=p[m];if(typeof p[n]=="string"){o=n.replace(/\-(\w)/g,function(r,s){return s.toUpperCase()});q[o]=p[n]}}}else{for(n in p){if(typeof p[n]==="string"){q[n]=p[n]}}}return q}function b(n){var m,o;for(m in n){o=n[m];if(o==null||h.isFunction(o)||m in c||(/scrollbar/).test(m)||(!(/color/i).test(m)&&isNaN(parseFloat(o)))){delete n[m]}}return n}function i(m,o){var p={_:0},n;for(n in o){if(m[n]!=o[n]){p[n]=o[n]}}return p}h.effects.animateClass=function(m,n,p,o){if(h.isFunction(p)){o=p;p=null}return this.queue(function(){var t=h(this),q=t.attr("style")||" ",u=b(g.call(this)),s,r=t.attr("class");h.each(f,function(v,w){if(m[w]){t[w+"Class"](m[w])}});s=b(g.call(this));t.attr("class",r);t.animate(i(u,s),{queue:false,duration:n,easing:p,complete:function(){h.each(f,function(v,w){if(m[w]){t[w+"Class"](m[w])}});if(typeof t.attr("style")=="object"){t.attr("style").cssText="";t.attr("style").cssText=q}else{t.attr("style",q)}if(o){o.apply(this,arguments)}h.dequeue(this)}})})};h.fn.extend({_addClass:h.fn.addClass,addClass:function(n,m,p,o){return m?h.effects.animateClass.apply(this,[{add:n},m,p,o]):this._addClass(n)},_removeClass:h.fn.removeClass,removeClass:function(n,m,p,o){return m?h.effects.animateClass.apply(this,[{remove:n},m,p,o]):this._removeClass(n)},_toggleClass:h.fn.toggleClass,toggleClass:function(o,n,m,q,p){if(typeof n=="boolean"||n===e){if(!m){return this._toggleClass(o,n)}else{return h.effects.animateClass.apply(this,[(n?{add:o}:{remove:o}),m,q,p])}}else{return h.effects.animateClass.apply(this,[{toggle:o},n,m,q])}},switchClass:function(m,o,n,q,p){return h.effects.animateClass.apply(this,[{add:o,remove:m},n,q,p])}});h.extend(h.effects,{version:"1.8.16",save:function(n,o){for(var m=0;m<o.length;m++){if(o[m]!==null){n.data("ec.storage."+o[m],n[0].style[o[m]])}}},restore:function(n,o){for(var m=0;m<o.length;m++){if(o[m]!==null){n.css(o[m],n.data("ec.storage."+o[m]))}}},setMode:function(m,n){if(n=="toggle"){n=m.is(":hidden")?"show":"hide"}return n},getBaseline:function(n,o){var p,m;switch(n[0]){case"top":p=0;break;case"middle":p=0.5;break;case"bottom":p=1;break;default:p=n[0]/o.height}switch(n[1]){case"left":m=0;break;case"center":m=0.5;break;case"right":m=1;break;default:m=n[1]/o.width}return{x:m,y:p}},createWrapper:function(m){if(m.parent().is(".ui-effects-wrapper")){return m.parent()}var n={width:m.outerWidth(true),height:m.outerHeight(true),"float":m.css("float")},p=h("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),o=document.activeElement;m.wrap(p);if(m[0]===o||h.contains(m[0],o)){h(o).focus()}p=m.parent();if(m.css("position")=="static"){p.css({position:"relative"});m.css({position:"relative"})}else{h.extend(n,{position:m.css("position"),zIndex:m.css("z-index")});h.each(["top","left","bottom","right"],function(q,r){n[r]=m.css(r);if(isNaN(parseInt(n[r],10))){n[r]="auto"}});m.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})}return p.css(n).show()},removeWrapper:function(m){var n,o=document.activeElement;if(m.parent().is(".ui-effects-wrapper")){n=m.parent().replaceWith(m);if(m[0]===o||h.contains(m[0],o)){h(o).focus()}return n}return m},setTransition:function(n,p,m,o){o=o||{};h.each(p,function(r,q){unit=n.cssUnit(q);if(unit[0]>0){o[q]=unit[0]*m+unit[1]}});return o}});function d(n,m,o,p){if(typeof n=="object"){p=m;o=null;m=n;n=m.effect}if(h.isFunction(m)){p=m;o=null;m={}}if(typeof m=="number"||h.fx.speeds[m]){p=o;o=m;m={}}if(h.isFunction(o)){p=o;o=null}m=m||{};o=o||m.duration;o=h.fx.off?0:typeof o=="number"?o:o in h.fx.speeds?h.fx.speeds[o]:h.fx.speeds._default;p=p||m.complete;return[n,m,o,p]}function k(m){if(!m||typeof m==="number"||h.fx.speeds[m]){return true}if(typeof m==="string"&&!h.effects[m]){return true}return false}h.fn.extend({effect:function(p,o,r,t){var n=d.apply(this,arguments),q={options:n[1],duration:n[2],callback:n[3]},s=q.options.mode,m=h.effects[p];if(h.fx.off||!m){if(s){return this[s](q.duration,q.callback)}else{return this.each(function(){if(q.callback){q.callback.call(this)}})}}return m.call(this,q)},_show:h.fn.show,show:function(n){if(k(n)){return this._show.apply(this,arguments)}else{var m=d.apply(this,arguments);m[1].mode="show";return this.effect.apply(this,m)}},_hide:h.fn.hide,hide:function(n){if(k(n)){return this._hide.apply(this,arguments)}else{var m=d.apply(this,arguments);m[1].mode="hide";return this.effect.apply(this,m)}},__toggle:h.fn.toggle,toggle:function(n){if(k(n)||typeof n==="boolean"||h.isFunction(n)){return this.__toggle.apply(this,arguments)}else{var m=d.apply(this,arguments);m[1].mode="toggle";return this.effect.apply(this,m)}},cssUnit:function(m){var n=this.css(m),o=[];h.each(["em","px","%","pt"],function(p,q){if(n.indexOf(q)>0){o=[parseFloat(n),q]}});return o}});h.easing.jswing=h.easing.swing;h.extend(h.easing,{def:"easeOutQuad",swing:function(n,o,m,q,p){return h.easing[h.easing.def](n,o,m,q,p)},easeInQuad:function(n,o,m,q,p){return q*(o/=p)*o+m},easeOutQuad:function(n,o,m,q,p){return -q*(o/=p)*(o-2)+m},easeInOutQuad:function(n,o,m,q,p){if((o/=p/2)<1){return q/2*o*o+m}return -q/2*((--o)*(o-2)-1)+m},easeInCubic:function(n,o,m,q,p){return q*(o/=p)*o*o+m},easeOutCubic:function(n,o,m,q,p){return q*((o=o/p-1)*o*o+1)+m},easeInOutCubic:function(n,o,m,q,p){if((o/=p/2)<1){return q/2*o*o*o+m}return q/2*((o-=2)*o*o+2)+m},easeInQuart:function(n,o,m,q,p){return q*(o/=p)*o*o*o+m},easeOutQuart:function(n,o,m,q,p){return -q*((o=o/p-1)*o*o*o-1)+m},easeInOutQuart:function(n,o,m,q,p){if((o/=p/2)<1){return q/2*o*o*o*o+m}return -q/2*((o-=2)*o*o*o-2)+m},easeInQuint:function(n,o,m,q,p){return q*(o/=p)*o*o*o*o+m},easeOutQuint:function(n,o,m,q,p){return q*((o=o/p-1)*o*o*o*o+1)+m},easeInOutQuint:function(n,o,m,q,p){if((o/=p/2)<1){return q/2*o*o*o*o*o+m}return q/2*((o-=2)*o*o*o*o+2)+m},easeInSine:function(n,o,m,q,p){return -q*Math.cos(o/p*(Math.PI/2))+q+m},easeOutSine:function(n,o,m,q,p){return q*Math.sin(o/p*(Math.PI/2))+m},easeInOutSine:function(n,o,m,q,p){return -q/2*(Math.cos(Math.PI*o/p)-1)+m},easeInExpo:function(n,o,m,q,p){return(o==0)?m:q*Math.pow(2,10*(o/p-1))+m},easeOutExpo:function(n,o,m,q,p){return(o==p)?m+q:q*(-Math.pow(2,-10*o/p)+1)+m},easeInOutExpo:function(n,o,m,q,p){if(o==0){return m}if(o==p){return m+q}if((o/=p/2)<1){return q/2*Math.pow(2,10*(o-1))+m}return q/2*(-Math.pow(2,-10*--o)+2)+m},easeInCirc:function(n,o,m,q,p){return -q*(Math.sqrt(1-(o/=p)*o)-1)+m},easeOutCirc:function(n,o,m,q,p){return q*Math.sqrt(1-(o=o/p-1)*o)+m},easeInOutCirc:function(n,o,m,q,p){if((o/=p/2)<1){return -q/2*(Math.sqrt(1-o*o)-1)+m}return q/2*(Math.sqrt(1-(o-=2)*o)+1)+m},easeInElastic:function(n,q,m,w,v){var r=1.70158;var u=0;var o=w;if(q==0){return m}if((q/=v)==1){return m+w}if(!u){u=v*0.3}if(o<Math.abs(w)){o=w;var r=u/4}else{var r=u/(2*Math.PI)*Math.asin(w/o)}return -(o*Math.pow(2,10*(q-=1))*Math.sin((q*v-r)*(2*Math.PI)/u))+m},easeOutElastic:function(n,q,m,w,v){var r=1.70158;var u=0;var o=w;if(q==0){return m}if((q/=v)==1){return m+w}if(!u){u=v*0.3}if(o<Math.abs(w)){o=w;var r=u/4}else{var r=u/(2*Math.PI)*Math.asin(w/o)}return o*Math.pow(2,-10*q)*Math.sin((q*v-r)*(2*Math.PI)/u)+w+m},easeInOutElastic:function(n,q,m,w,v){var r=1.70158;var u=0;var o=w;if(q==0){return m}if((q/=v/2)==2){return m+w}if(!u){u=v*(0.3*1.5)}if(o<Math.abs(w)){o=w;var r=u/4}else{var r=u/(2*Math.PI)*Math.asin(w/o)}if(q<1){return -0.5*(o*Math.pow(2,10*(q-=1))*Math.sin((q*v-r)*(2*Math.PI)/u))+m}return o*Math.pow(2,-10*(q-=1))*Math.sin((q*v-r)*(2*Math.PI)/u)*0.5+w+m},easeInBack:function(n,o,m,r,q,p){if(p==e){p=1.70158}return r*(o/=q)*o*((p+1)*o-p)+m},easeOutBack:function(n,o,m,r,q,p){if(p==e){p=1.70158}return r*((o=o/q-1)*o*((p+1)*o+p)+1)+m},easeInOutBack:function(n,o,m,r,q,p){if(p==e){p=1.70158}if((o/=q/2)<1){return r/2*(o*o*(((p*=(1.525))+1)*o-p))+m}return r/2*((o-=2)*o*(((p*=(1.525))+1)*o+p)+2)+m},easeInBounce:function(n,o,m,q,p){return q-h.easing.easeOutBounce(n,p-o,0,q,p)+m},easeOutBounce:function(n,o,m,q,p){if((o/=p)<(1/2.75)){return q*(7.5625*o*o)+m}else{if(o<(2/2.75)){return q*(7.5625*(o-=(1.5/2.75))*o+0.75)+m}else{if(o<(2.5/2.75)){return q*(7.5625*(o-=(2.25/2.75))*o+0.9375)+m}else{return q*(7.5625*(o-=(2.625/2.75))*o+0.984375)+m}}}},easeInOutBounce:function(n,o,m,q,p){if(o<p/2){return h.easing.easeInBounce(n,o*2,0,q,p)*0.5+m}return h.easing.easeOutBounce(n,o*2-p,0,q,p)*0.5+q*0.5+m}})})(jQuery);(function(a,b){a.effects.fade=function(c){return this.queue(function(){var d=a(this),e=a.effects.setMode(d,c.options.mode||"hide");d.animate({opacity:e},{queue:false,duration:c.duration,easing:c.options.easing,complete:function(){(c.callback&&c.callback.apply(this,arguments));d.dequeue()}})})}})(jQuery);(function(a,b){a.effects.highlight=function(c){return this.queue(function(){var e=a(this),d=["backgroundImage","backgroundColor","opacity"],g=a.effects.setMode(e,c.options.mode||"show"),f={backgroundColor:e.css("backgroundColor")};if(g=="hide"){f.opacity=0}a.effects.save(e,d);e.show().css({backgroundImage:"none",backgroundColor:c.options.color||"#ffff99"}).animate(f,{queue:false,duration:c.duration,easing:c.options.easing,complete:function(){(g=="hide"&&e.hide());a.effects.restore(e,d);(g=="show"&&!a.support.opacity&&this.style.removeAttribute("filter"));(c.callback&&c.callback.apply(this,arguments));e.dequeue()}})})}})(jQuery);(function(a,b){a.effects.slide=function(c){return this.queue(function(){var f=a(this),e=["position","top","bottom","left","right"];var j=a.effects.setMode(f,c.options.mode||"show");var i=c.options.direction||"left";a.effects.save(f,e);f.show();a.effects.createWrapper(f).css({overflow:"hidden"});var g=(i=="up"||i=="down")?"top":"left";var d=(i=="up"||i=="left")?"pos":"neg";var k=c.options.distance||(g=="top"?f.outerHeight({margin:true}):f.outerWidth({margin:true}));if(j=="show"){f.css(g,d=="pos"?(isNaN(k)?"-"+k:-k):k)}var h={};h[g]=(j=="show"?(d=="pos"?"+=":"-="):(d=="pos"?"-=":"+="))+k;f.animate(h,{queue:false,duration:c.duration,easing:c.options.easing,complete:function(){if(j=="hide"){f.hide()}a.effects.restore(f,e);a.effects.removeWrapper(f);if(c.callback){c.callback.apply(this,arguments)}f.dequeue()}})})}})(jQuery);(function(a){a.widget("ui.checkbox",{version:"0.1.1",widgetEventPrefix:"",options:{css:"checkbox",cssOn:"on",cssOff:"off",titleOn:"click to turn off",titleOff:"click to turn on",useElTitle:true,hideLabel:false},_create:function(){var b=this;var d=this.options;d.enabled=(d.enabled===undefined?(b.element.attr("disabled")?false:true):d.enabled);d.checked=(d.checked===undefined?(b.element.attr("checked")?true:false):d.checked);d.title="";b.element.data("value.uicheckbox",d.checked);var c=b.element.attr("name");var g=b.element.attr("id");b.$label=false;if(g){b.$label=a("label[for="+g+"]")}if(((!b.$label)||(b.$label.length<1))&&c){b.$label=a("label[for="+c+"]")}if(d.useElTitle===true){d.title=b.element.attr("title");if(((!d.title)||(d.title.length<1))&&(b.$label.length>0)){d.title=b.$label.text()}}var f=d.title+(d.checked?d.titleOn:d.titleOff);b.$el=a("<div />").addClass(d.css).addClass("ui-state-default");var e=[(d.enabled?"":"disabled"),(d.checked?d.cssOn:d.cssOff)];b.$icon=a("<span />").addClass(e.join(" "));if(f&&(f.length>0)){b.$icon.attr("title",f)}b.$icon.appendTo(b.$el);b.$el.insertAfter(b.element);b.element.hide();if(b.$label&&(b.$label.length>0)){if(d.hideLabel===true){b.$label.hide()}else{b.$label.click(function(h){h.preventDefault();h.stopPropagation();b.$el.trigger("click",[h]);return false})}}b._bindEvents()},_bindEvents:function(){var d=this;var c=function(h){if(d.options.enabled===true){d.$el.addClass("ui-state-hover")}};var g=function(h){d.$el.removeClass("ui-state-hover")};var f=function(h){if(d.options.enabled===true){d.$el.addClass("ui-state-focus")}};var e=function(h){d.$el.removeClass("ui-state-focus")};var b=function(h){d.toggle()};d.$el.bind("mouseenter.uicheckbox",c).bind("mouseleave.uicheckbox",g).bind("focus.uicheckbox",f).bind("blur.uicheckbox",e).bind("click.uicheckbox",b)},isChecked:function(){return this.options.checked},isEnabled:function(){return this.options.enabled},val:function(){return(this.isEnabled()&&this.isChecked()?this.element.val():null)},enable:function(){if(!this.options.enabled){this.options.enabled=true;this.$el.removeClass("ui-state-disabled");this._trigger("enabled")}},disable:function(){if(this.options.enabled){this.options.enabled=false;this.$el.addClass("ui-state-disabled");this._trigger("disabled")}},toggle:function(){if(this.options.checked){this.uncheck()}else{this.check()}},check:function(){if(!this.options.checked){this.options.checked=true;this.$icon.removeClass(this.options.cssOff).addClass(this.options.cssOn).attr("title",this.options.title+this.options.titleOn);this._trigger("change",null,"check")}},uncheck:function(){if(this.options.checked){this.options.checked=false;this.$icon.removeClass(this.options.cssOn).addClass(this.options.cssOff).attr("title",this.options.title+this.options.titleOff);this._trigger("change",null,"uncheck")}},reset:function(){if(this.element.data("value.uicheckbox")){this.check()}else{this.uncheck()}},hasChanged:function(){return(this.options.checked!==this.element.data("value.uicheckbox"))},destroy:function(){if(this.$label){this.$label.show()}this.$el.unbind(".uicheckbox");this.$el.remove();this.element.show()}})}(jQuery));(function(a){a.Note=function(b){var c={author:null,text:"",created:new Date()};return this.init(a.extend(c,true,b||{}))};a.Note.prototype={init:function(b){this.props=b;if((this.props.author===null)||(a.isPlainObject(this.props.author))){this.props.author=new a.User(this.props.author)}return this},getAuthor:function(){return this.props.author},getText:function(){return this.props.text},getCreated:function(){return this.props.created},setText:function(b){this.props.text=b},serialize:function(){var b={author:(this.props.author?this.props.author.serialize():null),text:this.props.text,created:this.props.created};return b},destroy:function(){var b=this;var c=b.props;if(c.author&&(c.author instanceof a.User)){c.author.destroy()}delete c.author;delete c.text;delete c.created}};a.Notes=function(b){var c={id:null,range:null,notes:[],tags:[]};return this.init(a.extend(c,true,b||{}))};a.Notes.prototype={init:function(c){this.props=c;var b=[];a.each(this.props.notes,function(){var d=this;if(a.isPlainObject(d)){d=new a.Note(d)}b.push(d)});if(b.length<1){b.push(new a.Note())}this.props.notes=b;return this},addNote:function(b){if(a.isPlainObject(b)){b=new a.Note(b)}this.props.notes.push(b);return b},removeNote:function(c){var b=this;if(c instanceof a.Note){var d=-1;a.each(b.props.notes,function(e){if(this===c){d=e;return false}});if(d>=0){b.props.notes.splice(d,1);c.destroy()}}return b},getId:function(){return this.props.id},getRange:function(){return this.props.range},getNotes:function(){return this.props.notes},getNotesCount:function(){return this.props.notes.length},getTags:function(){return this.props.tags},getNote:function(b){b=b||0;return this.props.notes[b]},getTag:function(b){b=b||0;return this.props.tags[b]},serialize:function(){var b={id:this.props.id,range:this.props.range,notes:[],tags:this.props.tags};a.each(this.props.notes,function(){b.notes.push(this.serialize())});return b},destroy:function(){var b=this;var c=b.props;if(a.isArray(c.notes)){a.each(c.notes,function(){this.destroy()})}delete c.range;delete c.notes;delete c.tags}}}(jQuery));(function(a){a.widget("ui.notes",{version:"0.0.1",widgetEventPrefix:"notes-",options:{notes:null,container:".notes-pane",position:{my:"top",at:"top",of:null,using:null},animSpeed:200,hidden:false,template:"#tmpl-notes"},_init:function(){var b=this;var c=b.options;b._isInitializing=true;b.$container=a(c.container);if(a.isPlainObject(c.notes)){if((c.notes.id===undefined)||(c.notes.id===null)){c.notes.id=b.element.attr("id")}c.notes=new a.Notes(c.notes)}b._widgetCreate()._bindEvents();b._isInitializing=false;return b},id:function(){var b=this;var c=b.options;return c.notes.getId()},notesCount:function(){var b=this;var c=b.options;return c.notes.getNotesCount()},addNote:function(d){var c=this;var e=c.options;var b=a("<div />").note({note:d});c.$body.append(b);if(c._isInitializing!==true){var d=b.note("option","note");e.notes.addNote(d);c._trigger("change",null,"noteAdded")}return c},removeNote:function(b){var c=this;var e=c.options;var d=b.note("option","note");e.notes.removeNote(d);c._trigger("change",null,"noteRemoved");return c},activate:function(){var c=this;var d=c.options;if(c.element.hasClass("notes-active")){return}var b=c.$buttons.filter("[name=reply]");if((!c.$reply.hasClass("hint"))&&(c.$reply.val().length>0)){c.$buttons.show();b.button("enable")}else{c.$buttons.hide();b.button("disable");c.$reply.addClass("hint").val(c.$reply.attr("title"))}c.element.addClass("notes-active",d.animSpeed,function(){})},deactivate:function(){var b=this;var c=b.options;if(!b.element.hasClass("notes-active")){return}b.element.find(".note .buttons [name=cancel]").click();b.element.removeClass("notes-active",c.animSpeed)},show:function(){var b=this;var c=b.options;b.element.fadeIn(c.animSpeed).position(c.position)},hide:function(b){var c=this;var d=c.options;c.element.fadeOut(d.animSpeed,b)},focus:function(){var b=this;var c=b.options;b.$reply.trigger("focus")},serialize:function(){var b=this;var c=b.options;return c.notes.serialize()},destroy:function(){var b=this;var c=b.options;b._unbindEvents().hide(function(){b._widgetDestroy();c.notes.destroy()})},_widgetCreate:function(){var b=this;var c=b.options;if(c.position.using===null){c.position.using=function(d){a(this).animate({top:d.top},c.animSpeed)}}b.element.addClass("notes ui-corner-all").append(a(c.template).tmpl()).appendTo(b.$container);if(c.hidden===true){b.element.hide()}else{b.element.position(c.position)}b.$body=b.element.find(".notes-body");b.$reply=b.element.find(".notes-reply");b.$buttons=b.element.find(".notes-input-pane .buttons button");b.$buttons.button();a.each(c.notes.getNotes(),function(){b.addNote(this,true)});return b},_widgetDestroy:function(){var b=this;var c=b.options;b.$body.find(".note").note("destroy");b.$buttons.button("destroy");b.element.empty();return b},_bindEvents:function(){var b=this;var c=b.options;b._docClick=function(f){var d=a(f.target);if(d!==b.element){b.deactivate()}};a(document).bind("click.ui-notes",b._docClick);b.element.delegate(".notes-input-pane button","click.ui-notes",function(g){var f=a(this);switch(f.attr("name")){case"reply":var d=new a.Note({text:b.$reply.val()});b.addNote(d);b.$reply.val("");break;case"cancel":b.$reply.val("");b.$reply.blur();break}});b.$reply.bind("keyup.ui-notes",function(f){var d=b.$buttons.filter("[name=reply]");if((!b.$reply.hasClass("hint"))&&(b.$reply.val().length>0)){d.button("enable")}else{d.button("disable")}});b.element.bind("click.ui-notes",function(d){b.activate();return false});b.element.delegate(".note","note-destroyed",function(g,f){var d=a(g.target);b.removeNote(d)});b.$reply.bind("focus",function(f){b.$buttons.show();var d=b.$buttons.filter("[name=reply]");if(b.$reply.hasClass("hint")){b.$reply.val("").removeClass("hint")}if(b.$reply.val().length>0){d.button("enable")}else{d.button("disable")}});b.$reply.bind("blur",function(f){var d=b.$buttons.filter("[name=reply]");if(b.$reply.val().length>0){d.button("enable")}else{b.$reply.addClass("hint").val(b.$reply.attr("title"));b.$buttons.hide();d.button("disable")}});return b},_unbindEvents:function(){var b=this;var c=b.options;b.element.unbind(".ui-notes");b.element.undelegate(".notes-input-pane button",".ui-notes");b.$reply.unbind(".ui-notes");a(document).unbind("click.ui-notes",b._docClick);return b}});a.widget("ui.note",{version:"0.0.1",widgetEventPrefix:"note-",options:{note:null,template:"#tmpl-note"},serialize:function(){var b=this;var c=b.options;return c.note.serialize()},destroy:function(){var b=this;var c=b.options;b._unbindEvents()._widgetDestroy();b._trigger("destroyed",null,c.note)},_init:function(){var b=this;var c=b.options;if(a.isPlainObject(c.note)){c.note=new a.Notes(c.notes)}b._widgetCreate()._bindEvents();return b},_widgetCreate:function(){var b=this;var c=b.options;b.element.addClass("note").append(a(c.template).tmpl({note:c.note}));b.$comment=b.element.find(".comment");b.$editArea=b.element.find(".edit");b.$edit=b.$editArea.find("textarea");b.$buttons=b.element.find(".buttons button");b.$mainButtons=b.element.find(".buttons:last");b.$buttons.button();return b},_widgetDestroy:function(){var b=this;var c=b.options;b.$buttons.button("destroy");b.element.empty();return b},_bindEvents:function(){var b=this;var c=b.options;b.$buttons.bind("click.ui-note",function(f){var d=a(this);switch(d.attr("name")){case"edit":b.$edit.val(b.$comment.text());b.$comment.hide();b.$mainButtons.css("display","none");b.$editArea.show();b.$edit.focus();break;case"delete":b.element.slideUp(function(){b.element.remove()});break;case"save":c.note.setText(b.$edit.val());b.$comment.text(c.note.getText());b._trigger("change",null,"noteSaved");case"cancel":b.$editArea.hide();b.$comment.show();b.$mainButtons.css("display","");break}});return b},_unbindEvents:function(){var b=this;var c=b.options;b.$buttons.unbind(".ui-note");return b}})}(jQuery));(function(a){a.fn.summary=function(b){b=b||{};return this.each(function(){var c=a(this);c.data("summary",new a.Summary(c,b))})};a.Summary=function(c,b){return this.init(c,b)};a.Summary.prototype={options:{src:null,metadata:null,threshold:{min:-1,max:-1},filter:"normal",showSentences:5,lineHeight:-1,useColor:false,rankOpacity:0.3,animSpeed:200},init:function(f,c){var b=this;var h=a.extend(true,{},b.options,c);b.element=f;b.options=h;b.metadata=null;b.starred=[];b.notes=[];var d=b.element.parent().parent();b.$control=d.find(".control-pane");b.$notes=d.find(".notes-pane");b.$threshold=b.$control.find(".threshold");b.$thresholdValues=b.$threshold.find(".values");b.$buttons=b.$control.find(".buttons button").button();b.$filters=b.$control.find(".filter :checkbox");b.$control.find(".buttons .expansion").buttonset();var e=b.$filters.filter("#filter-tagged");var g=b.$filters.filter("#filter-starred");e.checkbox({cssOn:"su-icon su-icon-tag-blue",cssOff:"su-icon su-icon-tag",titleOn:"click to remove filter",titleOff:"click to filter",hideLabel:true});g.checkbox({cssOn:"su-icon su-icon-star-blue",cssOff:"su-icon su-icon-star",titleOn:"click to remove filter",titleOff:"click to filter",hideLabel:true});b.$control.show();rangy.init();b.cssTag=rangy.createCssClassApplier("ui-state-default tagged",{normalize:true,elementTagName:"em"});b.cssSelect=rangy.createCssClassApplier("selected",{normalize:true,elementTagName:"em"});b._bindEvents();var i=a.get(h.metadata);b.element.addClass("loading");i.success(function(j){b.metadata=j;b.render();b.element.removeClass("loading")});i.error(function(){alert("Cannot retrieve metadata '"+h.metadata+"'")})},destroy:function(){self._unbindEvents()},render:function(){var j=this;var b=j.options;if(j.metadata===null){return}var c=j._getState(b.metadata);var h=[];if(c){b.threshold.min=c.threshold.min;b.threshold.max=c.threshold.max;b.filter=c.filter;j.starred=(c.starred?c.starred:[]);if(c.notes){h=c.notes}}j.renderXml(j.metadata);j.$p=j.element.find("p");j.$s=j.$p.find(".sentence");j.$kws=j.element.find(".keyword");j.ranks=[];j.$s.each(function(){var n=a(this);var r=parseInt(n.attr("rank"),10);if(isNaN(r)){return}if(j.ranks[r]===undefined){j.ranks[r]=[]}if(b.useColor!==false){var p=(b.useColor===true?221:b.useColor);var q=p-Math.ceil(p*(r/100));var o=q;var l=q;var m="rgb("+q+","+o+","+l+")";n.css({color:m})}j.ranks[r].push(n)});var g=b.threshold;if((b.threshold.min<0)||(b.threshold.max<0)){g=j._computeThreshold();j.origThreshold=g}if(j.starred.length>0){j.$s.removeClass("starred");a.each(j.starred,function(m,n){if(n===true){var l=a(j.$s.get(m));l.addClass("starred")}})}if(h.length>0){var e=h.length;j._noPut=true;for(var k=0;k<e;k++){var d=h[k];if(!d){continue}var f=new a.Notes(d);var i=j._addNotes(f.getRange(),f,true)}j._noPut=false}j._changeFilter(b.filter,true);j.threshold(g.min,g.max)},renderXml:function(d){var c=this;var f=c.options;var e=a(d);var b=a("<header />").appendTo(c.element);var h=e.find("document");var g=h.attr("src");if(g){f.src=g}h.children().each(function(){var l=a(this);switch(this.nodeName){case"title":var j=a("<h1 />");if(f.src!==null){var m=a("<a />").attr("href",f.src).text(l.text()).appendTo(j)}else{j.text(l.text())}b.append(j);break;case"published":var n=l.find("date").text()+" "+l.find("time").text();var i=new Date(n);var k=a("<time />").attr("datetime",i.toISOString()).attr("pubdate",true).text(n).appendTo(b);break;case"keywords":a("#tmpl-header-keywords").tmpl({keywords:l.find("keyword")}).appendTo(b);break;case"body":l.find("section").each(function(){var o=a("<section />").appendTo(c.element);a(this).find("p").each(function(){var p=a("<p />").appendTo(o);a(this).find("s").each(function(){var r=a(this);var t=parseFloat(r.attr("rank"));if(isNaN(t)){t=0}t=parseInt(t*100,10);var q=a("#tmpl-sentence").tmpl({rank:t}).appendTo(p);var s=q.find(".content");q.find(".rank").css("opacity",f.rankOpacity);a.each(this.childNodes,function(){var u=a(this);switch(this.nodeName){case"w":case"#text":if(u.attr("keyword")){a("#tmpl-sentence-keyword").tmpl({keyword:u.attr("keyword"),text:u.text()}).appendTo(s)}else{a("#tmpl-sentence-text").tmpl({text:u.text()}).appendTo(s)}break;case"keyword":a("#tmpl-sentence-keyword").tmpl({keyword:u.attr("name"),text:u.text()}).appendTo(s);break}});if(f.lineHeight<1){f.lineHeight=q.height()}})})});break;default:b.append(l);break}})},threshold:function(e,b){var d=this;var f=d.options;var c=(e<f.threshold.min);f.threshold.min=e;f.threshold.max=b;d.refresh(c)},refresh:function(e){var i=this;var b=i.options;var g=b.threshold.min+" - "+b.threshold.max;i.$thresholdValues.text(g);i.$s.addClass("noHighlight");if(b.filter==="normal"){for(var j=b.threshold.max;j>=b.threshold.min;j--){var d=i.ranks[j];if(d===undefined){continue}var c=d.length;for(var h=0;h<c;h++){var f=d[h];f.addClass("toHighlight").removeClass("noHighlight")}}}else{if(b.filter.indexOf("tagged")>=0){i.$s.filter(":has(.tagged)").addClass("toHighlight").removeClass("noHighlight")}if(b.filter.indexOf("starred")>=0){i.$s.filter(".starred").addClass("toHighlight").removeClass("noHighlight")}}i.$s.removeClass("hide-expand");i.$p.each(function(){var l=a(this);var k=l.find(".sentence");if(k.length===1){k.addClass("hide-expand");return}k.each(function(){var m=a(this);var o=m.prev();var n=m.next();if(o.length<1){if(m.hasClass("noHighlight")||(n.length<1)||n.hasClass("toHighlight")){m.addClass("hide-expand")}}else{if(n.length<1){if(m.hasClass("noHighlight")||(o.length<1)||o.hasClass("toHighlight")){m.addClass("hide-expand")}}else{if(o.hasClass("toHighlight")&&n.hasClass("toHighlight")){m.addClass("hide-expand")}}}})});i.$s.filter(".noHighlight").removeClass("noHighlight highlight expanded expansion",b.animSpeed*2,function(){var k=a(this);if(k.data("isHighlighted")){k.younger(b).removeData("isHighlighted")}i._syncNotesPosition(k)});i.$s.filter(".toHighlight").removeClass("toHighlight expanded expansion").addClass("highlight",b.animSpeed*2,function(){var k=a(this);var l=k.data("isHighlighted");k.data("isHighlighted",true);if(l){if(e===true){k.older(b)}else{if(e===false){k.younger(b)}}}i._syncNotesPosition(k)});i._putState()},_getState:function(c){var b=this;var d=b.options;if(c===undefined){c=d.metadata}return a.jStorage.get(c)},_putState:function(c){var b=this;var d=b.options;if(c===undefined){c=d.metadata}var e={threshold:d.threshold,filter:d.filter,starred:b.starred,notes:b.notes};a.jStorage.set(c,e)},_computeThreshold:function(){var d=this;var g=d.options;var e=0;var b={min:-1,max:100};for(var f=d.ranks.length-1;f>0;f--){var c=d.ranks[f];if(c===undefined){continue}e+=c.length;if(e>g.showSentences){b.min=Math.floor(f/10)*10;break}}return b},_isVisible:function(b){return(b.filter(".highlight,.expanded,.expansion,.keyworded").length>0)},_starOn:function(b){var c=this;var e=c.options;var d=c.$s.index(b);b.addClass("starred");c.starred[d]=true;return this},_starOff:function(b){var c=this;var e=c.options;var d=c.$s.index(b);b.removeClass("starred");c.starred[d]=false;return this},_toggleStar:function(b){var c=this;if(b.hasClass("starred")){c._starOff(b)}else{c._starOn(b)}return this},_syncNotesPosition:function(b){var c=this;var d=c.options;var e=c._isVisible(b);b.find(".tagged").each(function(){var g=a(this);var f=g.data("notes-associate");if(!f){g.removeData("notes-associate");g.removeClass(".tagged");return}f.notes((e?"show":"hide"))})},_syncNotesPositions:function(){var b=this;var c=b.options;b.$s.each(function(){b._syncNotesPosition(a(this))})},_expand:function(e){var h=this;var b=h.options;var f=e.parents("p:first");var i=e.find(".controls .expand");var c=e.prev();var d=e.next();var j=1;var g=function(){var k=a(this);k.addClass("expansion");k.css("display","");i.attr("title","collapse");if(--j<1){h._syncNotesPositions()}};if(e.data("isExpanding")||e.hasClass("expanded")){return}e.data("isExpanding",true);e.addClass("expanded",b.animSpeed,g);if(!h._isVisible(c)){j++;c.addClass("expansion",b.animSpeed,g)}if(!h._isVisible(d)){j++;d.addClass("expansion",b.animSpeed,g)}e.removeData("isExpanding");return this},_collapse:function(g){var i=this;var b=i.options;var h=g.parents("p:first");var j=g.find(".controls .expand");var d=g.prev();var f=g.next();var k=1;var c=function(){if(--k>0){return}g.removeClass("expansion");if(!g.hasClass("highlight")){g.removeClass("ui-hover");g.find(".controls .su-icon").css("opacity","");g.find(".selection-controls").remove()}j.attr("title","expand");i._syncNotesPositions();g.removeData("isCollapsing")};var e=function(l){k++;l.removeClass("expansion",b.animSpeed,c);if(l.hasClass("expanded")){i._collapse(l)}};if(g.data("isCollapsing")){return}if(g.hasClass("expanded")){g.removeClass("expanded",b.animSpeed)}else{if(!g.hasClass("expansion")){return}}g.data("isCollapsing",true);if(d.hasClass("expansion")){e(d)}if(f.hasClass("expansion")){e(f)}c();return this},_toggleExpand:function(b){var c=this;var e=c.options;var d=b.find(".controls .expand");if(b.hasClass("expanded")){c._collapse(b)}else{c._expand(b)}return this},_changeFilter:function(d,g){var b=this;var f=b.options;var c=b.$control.find("[name=threshold-up],[name=threshold-down]");var e=(d?d.split(/\s*,\s*/):["normal"]);a.each(e,function(){switch(this.toString()){case"tagged":c.button("disable");break;case"starred":c.button("disable");break;case"normal":default:d="normal";c.button("enable");b.$filters.checkbox("uncheck");break}});f.filter=d;b.element.removeClass("starred tagged normal").addClass(e.join(" "));if(g!==true){b.refresh()}return b},_generateRange:function(e){if(e===undefined){e=rangy.getSelection()}var j=this;var b=j.options;var c=e.getAllRanges();var d=c[0];var g=c[c.length-1];var i=a(d.startContainer).parents(".sentence:first");var f=a(g.endContainer).parents(".sentence:first");var h={start:j.$s.index(i)+"/"+rangy.serializePosition(d.startContainer,d.startOffset,i.find(".content")[0]),end:j.$s.index(f)+"/"+rangy.serializePosition(g.endContainer,g.endOffset,f.find(".content")[0])};console.log("_generateRange: "+h.start+","+h.end);return h.start+","+h.end},_addNotes:function(i,g,f){var j=this;var h=j.options;var s;if((!g)||(!g instanceof a.Notes)){s=(g&&(g.id!==undefined)?g.id:j.notes.length);g={id:s,range:i}}else{s=g.getId()}var k=/^([0-9]+)\/([0-9\/]+:[0-9]+)$/;var c=i.split(/\s*,\s*/);var r=c[0].match(k);var m=c[1].match(k);var n=a(j.$s.get(r[1]));var p=a(j.$s.get(m[1]));var e=rangy.deserializePosition(r[2],n.find(".content")[0]);var d=rangy.deserializePosition(m[2],p.find(".content")[0]);var o=rangy.createRange();var l=rangy.getSelection();o.setStart(e.node,e.offset);o.setEnd(d.node,d.offset);l.removeAllRanges();l.setSingleRange(o);j.cssTag.applyToSelection();var c=l.getAllRanges();var q=a(c[0].startContainer).parent();c[0].getNodes([3],function(t){var u=a(t).parent();if(u.hasClass("tagged")){u.attr("name","summary-notes-"+s)}});l.removeAllRanges();var b=a("<div />").notes({notes:g,position:{of:q},hidden:(f?true:false)});j.notes[s]=b.notes("serialize");q.data("summary-notes",b);b.data("notes-associate",q);q.data("notes-associate",b);if(j._noPut!==true){j._putState()}return q},_removeNotes:function(e){var c=this;var f=c.options;var b=e.data("summary-notes");if(!b){return}var h=b.notes("id");var d="summary-notes-"+h;var g=c.element.find("[name="+d+"]");b.removeData("tagged-item").notes("destroy");e.removeData("summary-notes");c.notes[h]=undefined;g.each(function(){var i=a(this);i.replaceWith(i.html())});c._putState()},_bindEvents:function(){var b=this;var d=b.options;var e=b.element.parent();var c=e.parent();c.delegate(".controls input, .controls button","click",function(){var g=a(this);var f=g.attr("name");var h=d.threshold.min;switch(f){case"threshold-all":d.threshold.min=0;b._changeFilter();break;case"threshold-reset":if(b.origThreshold===undefined){b.origThreshold=b._computeThreshold()}d.threshold.min=b.origThreshold.min;b.$s.removeClass("old-0 old-1 old-2 old-3 old-4 old-5 old-6 old-7 old-8").removeData("age");b._changeFilter();break;case"threshold-down":if(h>9){h-=10}b.threshold(h,d.threshold.max);break;case"threshold-up":if(h<(d.threshold.max-9)){h+=10}b.threshold(h,d.threshold.max);break}});c.delegate(".controls .filter","change",function(k,j){var g=a(this);var h=a(k.target);var f=h.attr("name");switch(f){case"filter":var i=b.$filters.map(function(){return a(this).checkbox("val")});b._changeFilter(a.makeArray(i).join(","));break}});c.delegateHoverIntent(".keyword",function(i){var h=a(this);if((i.type==="hover-in")&&h.hasClass("ui-state-highlight")){return}var f=h.attr("name");var g=b.$kws.filter("[name="+f+"]");switch(i.type){case"hover-out":g.removeClass("keyword-hover");break;case"hover-in":g.addClass("keyword-hover");break}});e.delegateHoverIntent(".rank",function(g){var f=a(this);switch(g.type){case"hover-out":b.$s.find(".rank").css("opacity",d.rankOpacity);g.stopPropagation();break;case"hover-in":b.$s.find(".rank").css("opacity",1);break}});e.delegateHoverIntent(".sentence",function(h){var f=a(this);var g=f.parents("p:first");if(f.data("isCollapsing")||(!b._isVisible(f))){return}b.$s.removeClass("ui-hover");switch(h.type){case"hover-in":f.addClass("ui-hover");break}});e.delegate(".sentence .controls .su-icon","mouseenter mouseleave",function(g){var f=a(this);switch(g.type){case"mouseenter":f.css("opacity",1);break;case"mouseleave":f.css("opacity","");break}});e.delegate(".sentence .controls .su-icon","click",function(i){var g=a(this);var f=g.parents(".sentence:first");var h=false;console.log("control click: "+g.attr("class"));if(g.hasClass("star")){b._toggleStar(f);h=true}else{if(g.hasClass("expand")){b._toggleExpand(f);h=true}}if(h){i.stopPropagation();return false}});e.delegate("p","click",function(j){var h=a(this);var k=a(j.target);var f;if((!k.is("p"))&&(!k.hasClass("sentence"))){k=k.parents(".sentence:first")}if(k.hasClass("sentence")){if(b._isVisible(k)){return}f=k}else{var g=h.find(".sentence");g.each(function(){var l=a(this);var m=l.offset();m.top-=2;m.left-=2;m.right=m.left+l.width()+4;m.bottom=m.top+l.height()+4;if((j.pageX>=m.left)&&(j.pageX<=m.right)&&(j.pageY>=m.top)&&(j.pageY<=m.bottom)){f=l;return false}});if((f===undefined)||(b._isVisible(f))){return}}if(f.hasClass("hide-expand")){var i=f.siblings(".highlight:first");if(i.length<1){i=f.siblings(":not(.hide-expand):first");if(i.length<1){f.removeClass("hide-expand");i=f}}b._toggleExpand(i)}else{b._toggleExpand(f)}});e.delegate("header .keyword","click",function(){var h=a(this);var i=(!h.hasClass("ui-state-highlight"));var f=h.attr("name");var g=e.find("article p .keyword");var j=g.filter("[name="+f+"]");if(i){b.$s.filter(".highlight,.expansion").older(d);h.addClass("ui-state-highlight");j.each(function(){var m=a(this);var k=m.parents(".sentence:first");var l=k.parent();m.addClass("ui-state-highlight");k.addClass("keyworded",d.animSpeed)})}else{j.each(function(){var m=a(this);var k=m.parents(".sentence:first");var l=k.parent();m.removeClass("ui-state-highlight");var n=k.find(".keyword.ui-state-highlight").length;if(n<1){k.removeClass("keyworded",d.animSpeed)}});b.$s.filter('[class*=" old"]').younger(d);h.removeClass("ui-state-highlight")}});e.delegate(".sentence .selection-controls .su-icon","mousedown mouseup",function(j){var h=a(j.target);var g=h.parents(".selection-controls:first");console.log("selection-controls "+j.type+": "+h.attr("class"));switch(j.type){case"mousedown":g.data("mousedown",true);break;case"mouseup":if(!g.data("mousedown")){return}var f=g.parent();g.removeData("mousedown").remove();if(h.hasClass("tag")){var i=rangy.getSelection();b.cssSelect.undoToSelection();range=b._generateRange(i);i.removeAllRanges();b._addNotes(range)}else{b._removeNotes(f)}break}j.preventDefault();j.stopPropagation();return false});e.delegateHoverIntent("article .sentence .tagged",function(k){var i=a(this);var h=i.attr("name");var j=b.element.find("[name="+h+"]:first");var g=j.data("notes-associate");switch(k.type){case"hover-in":b._ignoreHoverOut=false;a("#tmpl-selection-remove-controls").tmpl().appendTo(j).css({top:-22,left:0});if(g){g.notes("activate")}break;case"hover-out":if(g&&(b._ignoreHoverOut!==true)){g.notes("deactivate")}b._ignoreHoverOut=false;var f=i.parents(".sentence:first");f.find(".selection-controls").remove();break}});e.delegate("article .sentence .tagged","click",function(j){var h=a(this);var g=h.attr("name");var i=b.element.find("[name="+g+"]:first");var f=i.data("notes-associate");f.notes("focus");b._ignoreHoverOut=true;return false});e.delegate("article .sentence","mouseup",function(i){var f=a(this);var g=a(i.target);var h=rangy.getSelection();var k=h.toString();e.find(".selection-controls").remove();e.find(".selected").each(function(){var l=a(this);if(l.hasClass("keyword")){l.removeClass("selected")}else{l.replaceWith(l.html())}});if(k.length<1){return}b.cssSelect.applyToSelection();var j=b.element.find(".selected:first");a("#tmpl-selection-controls").tmpl().appendTo(j).css({top:-22,left:0})});b.$notes.delegate(".notes","notes-changed note-change note-destroyed",function(){var g=a(this);var f=g.notes("notesCount");if(f<1){var h=g.data("notes-associate");b._removeNotes(h)}else{var i=g.notes("id");b.notes[i]=g.notes("serialize");if(b._noPut!==true){b._putState()}}})},_unbindEvents:function(){var b=this;var d=b.element.parent();var c=d.parent();c.undelegate(".controls input, .controls button","click");d.undelegate("p","click");d.undelegateHoverIntent(".rank");d.undelegateHoverIntent(".sentence");d.undelegate(".sentence .controls .su-icon","mouseenter mouseleave click");d.undelegate("header .keyword","click");d.undelegate(".sentence .selection-controls .su-icon","mousedown mouseup");d.undelegateHoverIntent("article .sentence .tagged");d.undelegate("article .sentence .tagged","click");d.undelegate("article .sentence","mouseup");b.$notes.undelegate(".notes","notes-changed note-change note-destroyed")}};a.fn.older=function(b){b=a.extend({animSpeed:100},b||{});return this.each(function(){var d=a(this);var c=d.data("age");if(c>=0){c++}else{c=0}d.data("age",c);d.addClass("old-"+c,b.animSpeed)})};a.fn.younger=function(b){b=a.extend({animSpeed:100},b||{});return this.each(function(){var d=a(this);var c=d.data("age");if(c===undefined){c=0}d.removeClass("old-"+c,b.animSpeed);if(c>=0){c--}d.data("age",c)})}}(jQuery));