Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: chrome/browser/resources/md_history/lazy_load.crisper.js

Issue 2570253002: [MD History] Fix toolbar dates in grouped mode. (Closed)
Patch Set: rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 Polymer({is:"iron-collapse",behaviors:[Polymer.IronResizableBehavior],properties :{horizontal:{type:Boolean,value:false,observer:"_horizontalChanged"},opened:{ty pe:Boolean,value:false,notify:true,observer:"_openedChanged"},noAnimation:{type: Boolean},_desiredSize:{type:String,value:""}},get dimension(){return this.horizo ntal?"width":"height"},get _dimensionMax(){return this.horizontal?"maxWidth":"ma xHeight"},get _dimensionMaxCss(){return this.horizontal?"max-width":"max-height" },hostAttributes:{role:"group","aria-hidden":"true","aria-expanded":"false"},lis teners:{transitionend:"_transitionEnd"},attached:function(){this._transitionEnd( )},toggle:function(){this.opened=!this.opened},show:function(){this.opened=true} ,hide:function(){this.opened=false},updateSize:function(size,animated){size=size ==="auto"?"":size;if(this._desiredSize===size){return}this._desiredSize=size;thi s._updateTransition(false);var willAnimate=animated&&!this.noAnimation&&this._is Displayed;if(willAnimate){var startSize=this._calcSize();if(size===""){this.styl e[this._dimensionMax]="";size=this._calcSize()}this.style[this._dimensionMax]=st artSize;this.scrollTop=this.scrollTop;this._updateTransition(true);willAnimate=s ize!==startSize}this.style[this._dimensionMax]=size;if(!willAnimate){this._trans itionEnd()}},enableTransition:function(enabled){Polymer.Base._warn("`enableTrans ition()` is deprecated, use `noAnimation` instead.");this.noAnimation=!enabled}, _updateTransition:function(enabled){this.style.transitionDuration=enabled&&!this .noAnimation?"":"0s"},_horizontalChanged:function(){this.style.transitionPropert y=this._dimensionMaxCss;var otherDimension=this._dimensionMax==="maxWidth"?"maxH eight":"maxWidth";this.style[otherDimension]="";this.updateSize(this.opened?"aut o":"0px",false)},_openedChanged:function(){this.setAttribute("aria-expanded",thi s.opened);this.setAttribute("aria-hidden",!this.opened);this.toggleClass("iron-c ollapse-closed",false);this.toggleClass("iron-collapse-opened",false);this.updat eSize(this.opened?"auto":"0px",true);if(this.opened){this.focus()}},_transitionE nd:function(){this.style[this._dimensionMax]=this._desiredSize;this.toggleClass( "iron-collapse-closed",!this.opened);this.toggleClass("iron-collapse-opened",thi s.opened);this._updateTransition(false);this.notifyResize()},get _isDisplayed(){ var rect=this.getBoundingClientRect();for(var prop in rect){if(rect[prop]!==0)re turn true}return false},_calcSize:function(){return this.getBoundingClientRect() [this.dimension]+"px"}}); 1 Polymer({is:"iron-collapse",behaviors:[Polymer.IronResizableBehavior],properties :{horizontal:{type:Boolean,value:false,observer:"_horizontalChanged"},opened:{ty pe:Boolean,value:false,notify:true,observer:"_openedChanged"},noAnimation:{type: Boolean},_desiredSize:{type:String,value:""}},get dimension(){return this.horizo ntal?"width":"height"},get _dimensionMax(){return this.horizontal?"maxWidth":"ma xHeight"},get _dimensionMaxCss(){return this.horizontal?"max-width":"max-height" },hostAttributes:{role:"group","aria-hidden":"true","aria-expanded":"false"},lis teners:{transitionend:"_transitionEnd"},attached:function(){this._transitionEnd( )},toggle:function(){this.opened=!this.opened},show:function(){this.opened=true} ,hide:function(){this.opened=false},updateSize:function(size,animated){size=size ==="auto"?"":size;if(this._desiredSize===size){return}this._desiredSize=size;thi s._updateTransition(false);var willAnimate=animated&&!this.noAnimation&&this._is Displayed;if(willAnimate){var startSize=this._calcSize();if(size===""){this.styl e[this._dimensionMax]="";size=this._calcSize()}this.style[this._dimensionMax]=st artSize;this.scrollTop=this.scrollTop;this._updateTransition(true);willAnimate=s ize!==startSize}this.style[this._dimensionMax]=size;if(!willAnimate){this._trans itionEnd()}},enableTransition:function(enabled){Polymer.Base._warn("`enableTrans ition()` is deprecated, use `noAnimation` instead.");this.noAnimation=!enabled}, _updateTransition:function(enabled){this.style.transitionDuration=enabled&&!this .noAnimation?"":"0s"},_horizontalChanged:function(){this.style.transitionPropert y=this._dimensionMaxCss;var otherDimension=this._dimensionMax==="maxWidth"?"maxH eight":"maxWidth";this.style[otherDimension]="";this.updateSize(this.opened?"aut o":"0px",false)},_openedChanged:function(){this.setAttribute("aria-expanded",thi s.opened);this.setAttribute("aria-hidden",!this.opened);this.toggleClass("iron-c ollapse-closed",false);this.toggleClass("iron-collapse-opened",false);this.updat eSize(this.opened?"auto":"0px",true);if(this.opened){this.focus()}},_transitionE nd:function(){this.style[this._dimensionMax]=this._desiredSize;this.toggleClass( "iron-collapse-closed",!this.opened);this.toggleClass("iron-collapse-opened",thi s.opened);this._updateTransition(false);this.notifyResize()},get _isDisplayed(){ var rect=this.getBoundingClientRect();for(var prop in rect){if(rect[prop]!==0)re turn true}return false},_calcSize:function(){return this.getBoundingClientRect() [this.dimension]+"px"}});
2 // Copyright 2016 The Chromium Authors. All rights reserved. 2 // Copyright 2016 The Chromium Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be 3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file. 4 // found in the LICENSE file.
5 var HistoryDomain;var HistoryGroup;Polymer({is:"history-grouped-list",behaviors: [HistoryListBehavior],properties:{searchedTerm:{type:String,value:""},groupedHis toryData_:Array,historyData:Array,queryStartTime:String,queryEndTime:String,rang e:Number},observers:["updateGroupedHistoryData_(range, historyData)"],addNewResu lts:function(results,incremental,finished){this.historyData=results},createHisto ryDomains_:function(visits){var domainIndexes={};var domains=[];for(var i=0,visi t;visit=visits[i];i++){var domain=visit.domain;if(domainIndexes[domain]==undefin ed){domainIndexes[domain]=domains.length;domains.push({domain:domain,visits:[],e xpanded:false,rendered:false})}domains[domainIndexes[domain]].visits.push(visit) }var sortByVisits=function(a,b){return b.visits.length-a.visits.length};domains. sort(sortByVisits);return domains},updateGroupedHistoryData_:function(){if(this. historyData.length==0){this.groupedHistoryData_=[];return}if(this.range==History Range.WEEK){var days=[];var currentDayVisits=[this.historyData[0]];var pushCurre ntDay=function(){days.push({title:this.searchedTerm?currentDayVisits[0].dateShor t:currentDayVisits[0].dateRelativeDay,domains:this.createHistoryDomains_(current DayVisits)})}.bind(this);var visitsSameDay=function(a,b){if(this.searchedTerm)re turn a.dateShort==b.dateShort;return a.dateRelativeDay==b.dateRelativeDay}.bind( this);for(var i=1;i<this.historyData.length;i++){var visit=this.historyData[i];i f(!visitsSameDay(visit,currentDayVisits[0])){pushCurrentDay();currentDayVisits=[ ]}currentDayVisits.push(visit)}pushCurrentDay();this.groupedHistoryData_=days}el se if(this.range==HistoryRange.MONTH){this.groupedHistoryData_=[{title:this.quer yStartTime+" – "+this.queryEndTime,domains:this.createHistoryDomains_(this.histo ryData)}]}},toggleDomainExpanded_:function(e){var collapse=e.currentTarget.paren tNode.querySelector("iron-collapse");e.model.set("domain.rendered",true);setTime out(function(){collapse.toggle()},0)},needsTimeGap_:function(groupIndex,domainIn dex,itemIndex){var visits=this.groupedHistoryData_[groupIndex].domains[domainInd ex].visits;return md_history.HistoryItem.needsTimeGap(visits,itemIndex,this.sear chedTerm)},pathForItem_:function(groupIndex,domainIndex,itemIndex){return["group edHistoryData_",groupIndex,"domains",domainIndex,"visits",itemIndex].join(".")}, getWebsiteIconStyle_:function(domain){return"background-image: "+cr.icon.getFavi con(domain.visits[0].url)},getDropdownIcon_:function(expanded){return expanded?" cr:expand-less":"cr:expand-more"}}); 5 var HistoryDomain;var HistoryGroup;Polymer({is:"history-grouped-list",behaviors: [HistoryListBehavior],properties:{searchedTerm:{type:String,value:""},groupedHis toryData_:Array,historyData:Array,queryInterval:String,range:Number},observers:[ "updateGroupedHistoryData_(range, historyData)"],addNewResults:function(results, incremental,finished){this.historyData=results},createHistoryDomains_:function(v isits){var domainIndexes={};var domains=[];for(var i=0,visit;visit=visits[i];i++ ){var domain=visit.domain;if(domainIndexes[domain]==undefined){domainIndexes[dom ain]=domains.length;domains.push({domain:domain,visits:[],expanded:false,rendere d:false})}domains[domainIndexes[domain]].visits.push(visit)}var sortByVisits=fun ction(a,b){return b.visits.length-a.visits.length};domains.sort(sortByVisits);re turn domains},updateGroupedHistoryData_:function(){if(this.historyData.length==0 ){this.groupedHistoryData_=[];return}if(this.range==HistoryRange.WEEK){var days= [];var currentDayVisits=[this.historyData[0]];var pushCurrentDay=function(){days .push({title:this.searchedTerm?currentDayVisits[0].dateShort:currentDayVisits[0] .dateRelativeDay,domains:this.createHistoryDomains_(currentDayVisits)})}.bind(th is);var visitsSameDay=function(a,b){if(this.searchedTerm)return a.dateShort==b.d ateShort;return a.dateRelativeDay==b.dateRelativeDay}.bind(this);for(var i=1;i<t his.historyData.length;i++){var visit=this.historyData[i];if(!visitsSameDay(visi t,currentDayVisits[0])){pushCurrentDay();currentDayVisits=[]}currentDayVisits.pu sh(visit)}pushCurrentDay();this.groupedHistoryData_=days}else if(this.range==His toryRange.MONTH){this.groupedHistoryData_=[{title:this.queryInterval,domains:thi s.createHistoryDomains_(this.historyData)}]}},toggleDomainExpanded_:function(e){ var collapse=e.currentTarget.parentNode.querySelector("iron-collapse");e.model.s et("domain.rendered",true);setTimeout(function(){collapse.toggle()},0)},needsTim eGap_:function(groupIndex,domainIndex,itemIndex){var visits=this.groupedHistoryD ata_[groupIndex].domains[domainIndex].visits;return md_history.HistoryItem.needs TimeGap(visits,itemIndex,this.searchedTerm)},pathForItem_:function(groupIndex,do mainIndex,itemIndex){return["groupedHistoryData_",groupIndex,"domains",domainInd ex,"visits",itemIndex].join(".")},getWebsiteIconStyle_:function(domain){return"b ackground-image: "+cr.icon.getFavicon(domain.visits[0].url)},getDropdownIcon_:fu nction(expanded){return expanded?"cr:expand-less":"cr:expand-more"}});
6 // Copyright 2014 The Chromium Authors. All rights reserved. 6 // Copyright 2014 The Chromium Authors. All rights reserved.
7 // Use of this source code is governed by a BSD-style license that can be 7 // Use of this source code is governed by a BSD-style license that can be
8 // found in the LICENSE file. 8 // found in the LICENSE file.
9 cr.define("cr.ui",function(){function FocusGrid(){this.rows=[]}FocusGrid.prototy pe={ignoreFocusChange_:false,onFocus:function(row,e){if(this.ignoreFocusChange_) this.ignoreFocusChange_=false;else this.lastFocused_=e.currentTarget;this.rows.f orEach(function(r){r.makeActive(r==row)})},onKeydown:function(row,e){var rowInde x=this.rows.indexOf(row);assert(rowIndex>=0);var newRow=-1;if(e.key=="ArrowUp")n ewRow=rowIndex-1;else if(e.key=="ArrowDown")newRow=rowIndex+1;else if(e.key=="Pa geUp")newRow=0;else if(e.key=="PageDown")newRow=this.rows.length-1;var rowToFocu s=this.rows[newRow];if(rowToFocus){this.ignoreFocusChange_=true;rowToFocus.getEq uivalentElement(this.lastFocused_).focus();e.preventDefault();return true}return false},destroy:function(){this.rows.forEach(function(row){row.destroy()});this. rows.length=0},getRowIndexForTarget:function(target){for(var i=0;i<this.rows.len gth;++i){if(this.rows[i].getElements().indexOf(target)>=0)return i}return-1},get RowForRoot:function(root){for(var i=0;i<this.rows.length;++i){if(this.rows[i].ro ot==root)return this.rows[i]}return null},addRow:function(row){this.addRowBefore (row,null)},addRowBefore:function(row,nextRow){row.delegate=row.delegate||this;v ar nextRowIndex=nextRow?this.rows.indexOf(nextRow):-1;if(nextRowIndex==-1)this.r ows.push(row);else this.rows.splice(nextRowIndex,0,row)},removeRow:function(row) {var nextRowIndex=row?this.rows.indexOf(row):-1;if(nextRowIndex>-1)this.rows.spl ice(nextRowIndex,1)},ensureRowActive:function(preferredRow){if(this.rows.length= =0)return;for(var i=0;i<this.rows.length;++i){if(this.rows[i].isActive())return} (this.rows[preferredRow||0]||this.rows[0]).makeActive(true)}};return{FocusGrid:F ocusGrid}});Polymer.PaperButtonBehaviorImpl={properties:{elevation:{type:Number, reflectToAttribute:true,readOnly:true}},observers:["_calculateElevation(focused, disabled, active, pressed, receivedFocusFromKeyboard)","_computeKeyboardClass(r eceivedFocusFromKeyboard)"],hostAttributes:{role:"button",tabindex:"0",animated: true},_calculateElevation:function(){var e=1;if(this.disabled){e=0}else if(this. active||this.pressed){e=4}else if(this.receivedFocusFromKeyboard){e=3}this._setE levation(e)},_computeKeyboardClass:function(receivedFocusFromKeyboard){this.togg leClass("keyboard-focus",receivedFocusFromKeyboard)},_spaceKeyDownHandler:functi on(event){Polymer.IronButtonStateImpl._spaceKeyDownHandler.call(this,event);if(t his.hasRipple()&&this.getRipple().ripples.length<1){this._ripple.uiDownAction()} },_spaceKeyUpHandler:function(event){Polymer.IronButtonStateImpl._spaceKeyUpHand ler.call(this,event);if(this.hasRipple()){this._ripple.uiUpAction()}}};Polymer.P aperButtonBehavior=[Polymer.IronButtonState,Polymer.IronControlState,Polymer.Pap erRippleBehavior,Polymer.PaperButtonBehaviorImpl];Polymer({is:"paper-button",beh aviors:[Polymer.PaperButtonBehavior],properties:{raised:{type:Boolean,reflectToA ttribute:true,value:false,observer:"_calculateElevation"}},_calculateElevation:f unction(){if(!this.raised){this._setElevation(0)}else{Polymer.PaperButtonBehavio rImpl._calculateElevation.apply(this)}}}); 9 cr.define("cr.ui",function(){function FocusGrid(){this.rows=[]}FocusGrid.prototy pe={ignoreFocusChange_:false,onFocus:function(row,e){if(this.ignoreFocusChange_) this.ignoreFocusChange_=false;else this.lastFocused_=e.currentTarget;this.rows.f orEach(function(r){r.makeActive(r==row)})},onKeydown:function(row,e){var rowInde x=this.rows.indexOf(row);assert(rowIndex>=0);var newRow=-1;if(e.key=="ArrowUp")n ewRow=rowIndex-1;else if(e.key=="ArrowDown")newRow=rowIndex+1;else if(e.key=="Pa geUp")newRow=0;else if(e.key=="PageDown")newRow=this.rows.length-1;var rowToFocu s=this.rows[newRow];if(rowToFocus){this.ignoreFocusChange_=true;rowToFocus.getEq uivalentElement(this.lastFocused_).focus();e.preventDefault();return true}return false},destroy:function(){this.rows.forEach(function(row){row.destroy()});this. rows.length=0},getRowIndexForTarget:function(target){for(var i=0;i<this.rows.len gth;++i){if(this.rows[i].getElements().indexOf(target)>=0)return i}return-1},get RowForRoot:function(root){for(var i=0;i<this.rows.length;++i){if(this.rows[i].ro ot==root)return this.rows[i]}return null},addRow:function(row){this.addRowBefore (row,null)},addRowBefore:function(row,nextRow){row.delegate=row.delegate||this;v ar nextRowIndex=nextRow?this.rows.indexOf(nextRow):-1;if(nextRowIndex==-1)this.r ows.push(row);else this.rows.splice(nextRowIndex,0,row)},removeRow:function(row) {var nextRowIndex=row?this.rows.indexOf(row):-1;if(nextRowIndex>-1)this.rows.spl ice(nextRowIndex,1)},ensureRowActive:function(preferredRow){if(this.rows.length= =0)return;for(var i=0;i<this.rows.length;++i){if(this.rows[i].isActive())return} (this.rows[preferredRow||0]||this.rows[0]).makeActive(true)}};return{FocusGrid:F ocusGrid}});Polymer.PaperButtonBehaviorImpl={properties:{elevation:{type:Number, reflectToAttribute:true,readOnly:true}},observers:["_calculateElevation(focused, disabled, active, pressed, receivedFocusFromKeyboard)","_computeKeyboardClass(r eceivedFocusFromKeyboard)"],hostAttributes:{role:"button",tabindex:"0",animated: true},_calculateElevation:function(){var e=1;if(this.disabled){e=0}else if(this. active||this.pressed){e=4}else if(this.receivedFocusFromKeyboard){e=3}this._setE levation(e)},_computeKeyboardClass:function(receivedFocusFromKeyboard){this.togg leClass("keyboard-focus",receivedFocusFromKeyboard)},_spaceKeyDownHandler:functi on(event){Polymer.IronButtonStateImpl._spaceKeyDownHandler.call(this,event);if(t his.hasRipple()&&this.getRipple().ripples.length<1){this._ripple.uiDownAction()} },_spaceKeyUpHandler:function(event){Polymer.IronButtonStateImpl._spaceKeyUpHand ler.call(this,event);if(this.hasRipple()){this._ripple.uiUpAction()}}};Polymer.P aperButtonBehavior=[Polymer.IronButtonState,Polymer.IronControlState,Polymer.Pap erRippleBehavior,Polymer.PaperButtonBehaviorImpl];Polymer({is:"paper-button",beh aviors:[Polymer.PaperButtonBehavior],properties:{raised:{type:Boolean,reflectToA ttribute:true,value:false,observer:"_calculateElevation"}},_calculateElevation:f unction(){if(!this.raised){this._setElevation(0)}else{Polymer.PaperButtonBehavio rImpl._calculateElevation.apply(this)}}});
10 // Copyright 2016 The Chromium Authors. All rights reserved. 10 // Copyright 2016 The Chromium Authors. All rights reserved.
11 // Use of this source code is governed by a BSD-style license that can be 11 // Use of this source code is governed by a BSD-style license that can be
12 // found in the LICENSE file. 12 // found in the LICENSE file.
13 Polymer({is:"cr-action-menu","extends":"dialog",options_:null,anchorElement_:nul l,onWindowResize_:null,hostAttributes:{tabindex:0},listeners:{keydown:"onKeyDown _",tap:"onTap_"},attached:function(){this.options_=this.querySelectorAll(".dropd own-item")},detached:function(){this.removeResizeListener_()},removeResizeListen er_:function(){window.removeEventListener("resize",this.onWindowResize_)},onTap_ :function(e){if(e.target==this){this.close();e.stopPropagation()}},onKeyDown_:fu nction(e){if(e.key=="Tab"||e.key=="Escape"){this.close();e.preventDefault();retu rn}if(e.key!=="ArrowDown"&&e.key!=="ArrowUp")return;var nextOption=this.getNextO ption_(e.key=="ArrowDown"?1:-1);if(nextOption)nextOption.focus();e.preventDefaul t()},getNextOption_:function(step){var counter=0;var nextOption=null;var numOpti ons=this.options_.length;var focusedIndex=Array.prototype.indexOf.call(this.opti ons_,this.root.activeElement);do{focusedIndex=(numOptions+focusedIndex+step)%num Options;nextOption=this.options_[focusedIndex];if(nextOption.disabled||nextOptio n.hidden)nextOption=null;counter++}while(!nextOption&&counter<numOptions);return nextOption},close:function(){this.removeResizeListener_();HTMLDialogElement.pro totype.close.call(this);this.anchorElement_.focus();this.anchorElement_=null},sh owAt:function(anchorElement){this.anchorElement_=anchorElement;this.onWindowResi ze_=this.onWindowResize_||function(){if(this.open)this.close()}.bind(this);windo w.addEventListener("resize",this.onWindowResize_);this.style.left="";this.style. right="";this.style.top="";this.showModal();var rect=this.anchorElement_.getBoun dingClientRect();if(getComputedStyle(this.anchorElement_).direction=="rtl"){var right=window.innerWidth-rect.left-this.offsetWidth;this.style.right=right+"px"}e lse{var left=rect.right-this.offsetWidth;this.style.left=left+"px"}var top=rect. top+this.offsetHeight<=window.innerHeight?rect.top:rect.bottom-this.offsetHeight -Math.max(rect.bottom-window.innerHeight,0);this.style.top=top+"px"}});Polymer({ is:"paper-icon-button-light","extends":"button",behaviors:[Polymer.PaperRippleBe havior],listeners:{down:"_rippleDown",up:"_rippleUp",focus:"_rippleDown",blur:"_ rippleUp"},_rippleDown:function(){this.getRipple().downAction()},_rippleUp:funct ion(){this.getRipple().upAction()},ensureRipple:function(var_args){var lastRippl e=this._ripple;Polymer.PaperRippleBehavior.ensureRipple.apply(this,arguments);if (this._ripple&&this._ripple!==lastRipple){this._ripple.center=true;this._ripple. classList.add("circle")}}}); 13 Polymer({is:"cr-action-menu","extends":"dialog",options_:null,anchorElement_:nul l,onWindowResize_:null,hostAttributes:{tabindex:0},listeners:{keydown:"onKeyDown _",tap:"onTap_"},attached:function(){this.options_=this.querySelectorAll(".dropd own-item")},detached:function(){this.removeResizeListener_()},removeResizeListen er_:function(){window.removeEventListener("resize",this.onWindowResize_)},onTap_ :function(e){if(e.target==this){this.close();e.stopPropagation()}},onKeyDown_:fu nction(e){if(e.key=="Tab"||e.key=="Escape"){this.close();e.preventDefault();retu rn}if(e.key!=="ArrowDown"&&e.key!=="ArrowUp")return;var nextOption=this.getNextO ption_(e.key=="ArrowDown"?1:-1);if(nextOption)nextOption.focus();e.preventDefaul t()},getNextOption_:function(step){var counter=0;var nextOption=null;var numOpti ons=this.options_.length;var focusedIndex=Array.prototype.indexOf.call(this.opti ons_,this.root.activeElement);do{focusedIndex=(numOptions+focusedIndex+step)%num Options;nextOption=this.options_[focusedIndex];if(nextOption.disabled||nextOptio n.hidden)nextOption=null;counter++}while(!nextOption&&counter<numOptions);return nextOption},close:function(){this.removeResizeListener_();HTMLDialogElement.pro totype.close.call(this);this.anchorElement_.focus();this.anchorElement_=null},sh owAt:function(anchorElement){this.anchorElement_=anchorElement;this.onWindowResi ze_=this.onWindowResize_||function(){if(this.open)this.close()}.bind(this);windo w.addEventListener("resize",this.onWindowResize_);this.style.left="";this.style. right="";this.style.top="";this.showModal();var rect=this.anchorElement_.getBoun dingClientRect();if(getComputedStyle(this.anchorElement_).direction=="rtl"){var right=window.innerWidth-rect.left-this.offsetWidth;this.style.right=right+"px"}e lse{var left=rect.right-this.offsetWidth;this.style.left=left+"px"}var top=rect. top+this.offsetHeight<=window.innerHeight?rect.top:rect.bottom-this.offsetHeight -Math.max(rect.bottom-window.innerHeight,0);this.style.top=top+"px"}});Polymer({ is:"paper-icon-button-light","extends":"button",behaviors:[Polymer.PaperRippleBe havior],listeners:{down:"_rippleDown",up:"_rippleUp",focus:"_rippleDown",blur:"_ rippleUp"},_rippleDown:function(){this.getRipple().downAction()},_rippleUp:funct ion(){this.getRipple().upAction()},ensureRipple:function(var_args){var lastRippl e=this._ripple;Polymer.PaperRippleBehavior.ensureRipple.apply(this,arguments);if (this._ripple&&this._ripple!==lastRipple){this._ripple.center=true;this._ripple. classList.add("circle")}}});
14 // Copyright 2016 The Chromium Authors. All rights reserved. 14 // Copyright 2016 The Chromium Authors. All rights reserved.
15 // Use of this source code is governed by a BSD-style license that can be 15 // Use of this source code is governed by a BSD-style license that can be
16 // found in the LICENSE file. 16 // found in the LICENSE file.
17 Polymer({is:"history-synced-device-card",properties:{tabs:{type:Array,value:func tion(){return[]},observer:"updateIcons_"},device:String,lastUpdateTime:String,op ened:Boolean,searchTerm:String,separatorIndexes:Array,sessionTag:String},listene rs:{"dom-change":"notifyFocusUpdate_"},createFocusRows:function(){var titleRow=n ew cr.ui.FocusRow(this.$["card-heading"],null);titleRow.addItem("menu","#menu-bu tton");titleRow.addItem("collapse","#collapse-button");var rows=[titleRow];if(th is.opened){Polymer.dom(this.root).querySelectorAll(".item-container").forEach(fu nction(el){var row=new cr.ui.FocusRow(el,null);row.addItem("title",".website-tit le");rows.push(row)})}return rows},openTab_:function(e){var tab=e.model.tab;var browserService=md_history.BrowserService.getInstance();browserService.recordHist ogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.LINK_CLICKED,SyncedTabsHist ogram.LIMIT);browserService.openForeignSessionTab(this.sessionTag,tab.windowId,t ab.sessionId,e);e.preventDefault()},toggleTabCard:function(){var histogramValue= this.$.collapse.opened?SyncedTabsHistogram.COLLAPSE_SESSION:SyncedTabsHistogram. EXPAND_SESSION;md_history.BrowserService.getInstance().recordHistogram(SYNCED_TA BS_HISTOGRAM_NAME,histogramValue,SyncedTabsHistogram.LIMIT);this.$.collapse.togg le();this.$["dropdown-indicator"].icon=this.$.collapse.opened?"cr:expand-less":" cr:expand-more";this.fire("update-focus-grid")},notifyFocusUpdate_:function(){th is.fire("update-focus-grid")},updateIcons_:function(){this.async(function(){var icons=Polymer.dom(this.root).querySelectorAll(".website-icon");for(var i=0;i<thi s.tabs.length;i++){icons[i].style.backgroundImage=cr.icon.getFavicon(this.tabs[i ].url)}})},isWindowSeparatorIndex_:function(index,separatorIndexes){return this. separatorIndexes.indexOf(index)!=-1},getCollapseIcon_:function(opened){return op ened?"cr:expand-less":"cr:expand-more"},getCollapseTitle_:function(opened){retur n opened?loadTimeData.getString("collapseSessionButton"):loadTimeData.getString( "expandSessionButton")},onMenuButtonTap_:function(e){this.fire("open-menu",{targ et:Polymer.dom(e).localTarget,tag:this.sessionTag});e.stopPropagation()},onLinkR ightClick_:function(){md_history.BrowserService.getInstance().recordHistogram(SY NCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.LINK_RIGHT_CLICKED,SyncedTabsHistog ram.LIMIT)}}); 17 Polymer({is:"history-synced-device-card",properties:{tabs:{type:Array,value:func tion(){return[]},observer:"updateIcons_"},device:String,lastUpdateTime:String,op ened:Boolean,searchTerm:String,separatorIndexes:Array,sessionTag:String},listene rs:{"dom-change":"notifyFocusUpdate_"},createFocusRows:function(){var titleRow=n ew cr.ui.FocusRow(this.$["card-heading"],null);titleRow.addItem("menu","#menu-bu tton");titleRow.addItem("collapse","#collapse-button");var rows=[titleRow];if(th is.opened){Polymer.dom(this.root).querySelectorAll(".item-container").forEach(fu nction(el){var row=new cr.ui.FocusRow(el,null);row.addItem("title",".website-tit le");rows.push(row)})}return rows},openTab_:function(e){var tab=e.model.tab;var browserService=md_history.BrowserService.getInstance();browserService.recordHist ogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.LINK_CLICKED,SyncedTabsHist ogram.LIMIT);browserService.openForeignSessionTab(this.sessionTag,tab.windowId,t ab.sessionId,e);e.preventDefault()},toggleTabCard:function(){var histogramValue= this.$.collapse.opened?SyncedTabsHistogram.COLLAPSE_SESSION:SyncedTabsHistogram. EXPAND_SESSION;md_history.BrowserService.getInstance().recordHistogram(SYNCED_TA BS_HISTOGRAM_NAME,histogramValue,SyncedTabsHistogram.LIMIT);this.$.collapse.togg le();this.$["dropdown-indicator"].icon=this.$.collapse.opened?"cr:expand-less":" cr:expand-more";this.fire("update-focus-grid")},notifyFocusUpdate_:function(){th is.fire("update-focus-grid")},updateIcons_:function(){this.async(function(){var icons=Polymer.dom(this.root).querySelectorAll(".website-icon");for(var i=0;i<thi s.tabs.length;i++){icons[i].style.backgroundImage=cr.icon.getFavicon(this.tabs[i ].url)}})},isWindowSeparatorIndex_:function(index,separatorIndexes){return this. separatorIndexes.indexOf(index)!=-1},getCollapseIcon_:function(opened){return op ened?"cr:expand-less":"cr:expand-more"},getCollapseTitle_:function(opened){retur n opened?loadTimeData.getString("collapseSessionButton"):loadTimeData.getString( "expandSessionButton")},onMenuButtonTap_:function(e){this.fire("open-menu",{targ et:Polymer.dom(e).localTarget,tag:this.sessionTag});e.stopPropagation()},onLinkR ightClick_:function(){md_history.BrowserService.getInstance().recordHistogram(SY NCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.LINK_RIGHT_CLICKED,SyncedTabsHistog ram.LIMIT)}});
18 // Copyright 2016 The Chromium Authors. All rights reserved. 18 // Copyright 2016 The Chromium Authors. All rights reserved.
19 // Use of this source code is governed by a BSD-style license that can be 19 // Use of this source code is governed by a BSD-style license that can be
20 // found in the LICENSE file. 20 // found in the LICENSE file.
21 var ForeignDeviceInternal;Polymer({is:"history-synced-device-manager",properties :{sessionList:{type:Array,observer:"updateSyncedDevices"},searchTerm:{type:Strin g,observer:"searchTermChanged"},syncedDevices_:{type:Array,value:function(){retu rn[]}},signInState:{type:Boolean,observer:"signInStateChanged_"},guestSession_:{ type:Boolean,value:loadTimeData.getBoolean("isGuestSession")},fetchingSyncedTabs _:{type:Boolean,value:false},hasSeenForeignData_:Boolean,actionMenuModel_:String },listeners:{"open-menu":"onOpenMenu_","update-focus-grid":"updateFocusGrid_"},f ocusGrid_:null,attached:function(){this.focusGrid_=new cr.ui.FocusGrid;chrome.se nd("otherDevicesInitialized");md_history.BrowserService.getInstance().recordHist ogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.INITIALIZED,SyncedTabsHisto gram.LIMIT)},detached:function(){this.focusGrid_.destroy()},getContentScrollTarg et:function(){return this},createInternalDevice_:function(session){var tabs=[];v ar separatorIndexes=[];for(var i=0;i<session.windows.length;i++){var windowId=se ssion.windows[i].sessionId;var newTabs=session.windows[i].tabs;if(newTabs.length ==0)continue;newTabs.forEach(function(tab){tab.windowId=windowId});var windowAdd ed=false;if(!this.searchTerm){tabs=tabs.concat(newTabs);windowAdded=true}else{va r searchText=this.searchTerm.toLowerCase();for(var j=0;j<newTabs.length;j++){var tab=newTabs[j];if(tab.title.toLowerCase().indexOf(searchText)!=-1){tabs.push(ta b);windowAdded=true}}}if(windowAdded&&i!=session.windows.length-1)separatorIndex es.push(tabs.length-1)}return{device:session.name,lastUpdateTime:"– "+session.mo difiedTime,opened:true,separatorIndexes:separatorIndexes,timestamp:session.times tamp,tabs:tabs,tag:session.tag}},onSignInTap_:function(){chrome.send("startSignI nFlow")},onOpenMenu_:function(e){var menu=this.$.menu.get();this.actionMenuModel _=e.detail.tag;menu.showAt(e.detail.target);md_history.BrowserService.getInstanc e().recordHistogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.SHOW_SESSION_ MENU,SyncedTabsHistogram.LIMIT)},onOpenAllTap_:function(){var menu=assert(this.$ .menu.getIfExists());var browserService=md_history.BrowserService.getInstance(); browserService.recordHistogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.OP EN_ALL,SyncedTabsHistogram.LIMIT);browserService.openForeignSessionAllTabs(asser t(this.actionMenuModel_));this.actionMenuModel_=null;menu.close()},updateFocusGr id_:function(){if(!this.focusGrid_)return;this.focusGrid_.destroy();this.debounc e("updateFocusGrid",function(){Polymer.dom(this.root).querySelectorAll("history- synced-device-card").reduce(function(prev,cur){return prev.concat(cur.createFocu sRows())},[]).forEach(function(row){this.focusGrid_.addRow(row)}.bind(this));thi s.focusGrid_.ensureRowActive(1)})},onDeleteSessionTap_:function(){var menu=asser t(this.$.menu.getIfExists());var browserService=md_history.BrowserService.getIns tance();browserService.recordHistogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHist ogram.HIDE_FOR_NOW,SyncedTabsHistogram.LIMIT);browserService.deleteForeignSessio n(assert(this.actionMenuModel_));this.actionMenuModel_=null;menu.close()},clearD isplayedSyncedDevices_:function(){this.syncedDevices_=[]},showNoSyncedMessage:fu nction(signInState,syncedDevicesLength,guestSession){if(guestSession)return true ;return signInState&&syncedDevicesLength==0},showSignInGuide:function(signInStat e,guestSession){var show=!signInState&&!guestSession;if(show){md_history.Browser Service.getInstance().recordAction("Signin_Impression_FromRecentTabs")}return sh ow},noSyncedTabsMessage:function(){var stringName=this.fetchingSyncedTabs_?"load ing":"noSyncedResults";if(this.searchTerm!=="")stringName="noSearchResults";retu rn loadTimeData.getString(stringName)},updateSyncedDevices:function(sessionList) {this.fetchingSyncedTabs_=false;if(!sessionList)return;if(sessionList.length>0&& !this.hasSeenForeignData_){this.hasSeenForeignData_=true;md_history.BrowserServi ce.getInstance().recordHistogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram. HAS_FOREIGN_DATA,SyncedTabsHistogram.LIMIT)}var devices=[];sessionList.forEach(f unction(session){var device=this.createInternalDevice_(session);if(device.tabs.l ength!=0)devices.push(device)}.bind(this));this.syncedDevices_=devices},signInSt ateChanged_:function(){this.fire("history-view-changed");if(!this.signInState){t his.clearDisplayedSyncedDevices_();return}this.fetchingSyncedTabs_=true},searchT ermChanged:function(searchTerm){this.clearDisplayedSyncedDevices_();this.updateS yncedDevices(this.sessionList)}}); 21 var ForeignDeviceInternal;Polymer({is:"history-synced-device-manager",properties :{sessionList:{type:Array,observer:"updateSyncedDevices"},searchTerm:{type:Strin g,observer:"searchTermChanged"},syncedDevices_:{type:Array,value:function(){retu rn[]}},signInState:{type:Boolean,observer:"signInStateChanged_"},guestSession_:{ type:Boolean,value:loadTimeData.getBoolean("isGuestSession")},fetchingSyncedTabs _:{type:Boolean,value:false},hasSeenForeignData_:Boolean,actionMenuModel_:String },listeners:{"open-menu":"onOpenMenu_","update-focus-grid":"updateFocusGrid_"},f ocusGrid_:null,attached:function(){this.focusGrid_=new cr.ui.FocusGrid;chrome.se nd("otherDevicesInitialized");md_history.BrowserService.getInstance().recordHist ogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.INITIALIZED,SyncedTabsHisto gram.LIMIT)},detached:function(){this.focusGrid_.destroy()},getContentScrollTarg et:function(){return this},createInternalDevice_:function(session){var tabs=[];v ar separatorIndexes=[];for(var i=0;i<session.windows.length;i++){var windowId=se ssion.windows[i].sessionId;var newTabs=session.windows[i].tabs;if(newTabs.length ==0)continue;newTabs.forEach(function(tab){tab.windowId=windowId});var windowAdd ed=false;if(!this.searchTerm){tabs=tabs.concat(newTabs);windowAdded=true}else{va r searchText=this.searchTerm.toLowerCase();for(var j=0;j<newTabs.length;j++){var tab=newTabs[j];if(tab.title.toLowerCase().indexOf(searchText)!=-1){tabs.push(ta b);windowAdded=true}}}if(windowAdded&&i!=session.windows.length-1)separatorIndex es.push(tabs.length-1)}return{device:session.name,lastUpdateTime:"– "+session.mo difiedTime,opened:true,separatorIndexes:separatorIndexes,timestamp:session.times tamp,tabs:tabs,tag:session.tag}},onSignInTap_:function(){chrome.send("startSignI nFlow")},onOpenMenu_:function(e){var menu=this.$.menu.get();this.actionMenuModel _=e.detail.tag;menu.showAt(e.detail.target);md_history.BrowserService.getInstanc e().recordHistogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.SHOW_SESSION_ MENU,SyncedTabsHistogram.LIMIT)},onOpenAllTap_:function(){var menu=assert(this.$ .menu.getIfExists());var browserService=md_history.BrowserService.getInstance(); browserService.recordHistogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram.OP EN_ALL,SyncedTabsHistogram.LIMIT);browserService.openForeignSessionAllTabs(asser t(this.actionMenuModel_));this.actionMenuModel_=null;menu.close()},updateFocusGr id_:function(){if(!this.focusGrid_)return;this.focusGrid_.destroy();this.debounc e("updateFocusGrid",function(){Polymer.dom(this.root).querySelectorAll("history- synced-device-card").reduce(function(prev,cur){return prev.concat(cur.createFocu sRows())},[]).forEach(function(row){this.focusGrid_.addRow(row)}.bind(this));thi s.focusGrid_.ensureRowActive(1)})},onDeleteSessionTap_:function(){var menu=asser t(this.$.menu.getIfExists());var browserService=md_history.BrowserService.getIns tance();browserService.recordHistogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHist ogram.HIDE_FOR_NOW,SyncedTabsHistogram.LIMIT);browserService.deleteForeignSessio n(assert(this.actionMenuModel_));this.actionMenuModel_=null;menu.close()},clearD isplayedSyncedDevices_:function(){this.syncedDevices_=[]},showNoSyncedMessage:fu nction(signInState,syncedDevicesLength,guestSession){if(guestSession)return true ;return signInState&&syncedDevicesLength==0},showSignInGuide:function(signInStat e,guestSession){var show=!signInState&&!guestSession;if(show){md_history.Browser Service.getInstance().recordAction("Signin_Impression_FromRecentTabs")}return sh ow},noSyncedTabsMessage:function(){var stringName=this.fetchingSyncedTabs_?"load ing":"noSyncedResults";if(this.searchTerm!=="")stringName="noSearchResults";retu rn loadTimeData.getString(stringName)},updateSyncedDevices:function(sessionList) {this.fetchingSyncedTabs_=false;if(!sessionList)return;if(sessionList.length>0&& !this.hasSeenForeignData_){this.hasSeenForeignData_=true;md_history.BrowserServi ce.getInstance().recordHistogram(SYNCED_TABS_HISTOGRAM_NAME,SyncedTabsHistogram. HAS_FOREIGN_DATA,SyncedTabsHistogram.LIMIT)}var devices=[];sessionList.forEach(f unction(session){var device=this.createInternalDevice_(session);if(device.tabs.l ength!=0)devices.push(device)}.bind(this));this.syncedDevices_=devices},signInSt ateChanged_:function(){this.fire("history-view-changed");if(!this.signInState){t his.clearDisplayedSyncedDevices_();return}this.fetchingSyncedTabs_=true},searchT ermChanged:function(searchTerm){this.clearDisplayedSyncedDevices_();this.updateS yncedDevices(this.sessionList)}});
22 // Copyright 2016 The Chromium Authors. All rights reserved. 22 // Copyright 2016 The Chromium Authors. All rights reserved.
23 // Use of this source code is governed by a BSD-style license that can be 23 // Use of this source code is governed by a BSD-style license that can be
24 // found in the LICENSE file. 24 // found in the LICENSE file.
25 Polymer({is:"cr-dialog","extends":"dialog",properties:{closeText:String,ignorePo pstate:{type:Boolean,value:false}},ready:function(){window.addEventListener("pop state",function(){if(!this.ignorePopstate&&this.open)this.cancel()}.bind(this))} ,cancel:function(){this.fire("cancel");HTMLDialogElement.prototype.close.call(th is,"")},close:function(opt_returnValue){HTMLDialogElement.prototype.close.call(t his,"success")},getCloseButton:function(){return this.$.close}}); 25 Polymer({is:"cr-dialog","extends":"dialog",properties:{closeText:String,ignorePo pstate:{type:Boolean,value:false}},ready:function(){window.addEventListener("pop state",function(){if(!this.ignorePopstate&&this.open)this.cancel()}.bind(this))} ,cancel:function(){this.fire("cancel");HTMLDialogElement.prototype.close.call(th is,"")},close:function(opt_returnValue){HTMLDialogElement.prototype.close.call(t his,"success")},getCloseButton:function(){return this.$.close}});
26 // Copyright 2016 The Chromium Authors. All rights reserved. 26 // Copyright 2016 The Chromium Authors. All rights reserved.
27 // Use of this source code is governed by a BSD-style license that can be 27 // Use of this source code is governed by a BSD-style license that can be
28 // found in the LICENSE file. 28 // found in the LICENSE file.
29 Polymer({is:"cr-drawer","extends":"dialog",properties:{open:{type:Boolean,notify :true},align:{type:String,value:"left",reflectToAttribute:true}},listeners:{canc el:"onDialogCancel_",tap:"onDialogTap_",transitionend:"onDialogTransitionEnd_"}, toggle:function(){if(this.open)this.closeDrawer();else this.openDrawer()},openDr awer:function(){if(!this.open){this.showModal();this.classList.add("opening")}}, closeDrawer:function(){if(this.open){this.classList.remove("opening");this.class List.add("closing")}},onContainerTap_:function(event){event.stopPropagation()},o nDialogTap_:function(){this.closeDrawer()},onDialogCancel_:function(event){event .preventDefault();this.closeDrawer()},onDialogTransitionEnd_:function(){if(this. classList.contains("closing")){this.classList.remove("closing");this.close()}}}) ;Polymer.IronFitBehavior={properties:{sizingTarget:{type:Object,value:function() {return this}},fitInto:{type:Object,value:window},noOverlap:{type:Boolean},posit ionTarget:{type:Element},horizontalAlign:{type:String},verticalAlign:{type:Strin g},dynamicAlign:{type:Boolean},horizontalOffset:{type:Number,value:0,notify:true },verticalOffset:{type:Number,value:0,notify:true},autoFitOnAttach:{type:Boolean ,value:false},_fitInfo:{type:Object}},get _fitWidth(){var fitWidth;if(this.fitIn to===window){fitWidth=this.fitInto.innerWidth}else{fitWidth=this.fitInto.getBoun dingClientRect().width}return fitWidth},get _fitHeight(){var fitHeight;if(this.f itInto===window){fitHeight=this.fitInto.innerHeight}else{fitHeight=this.fitInto. getBoundingClientRect().height}return fitHeight},get _fitLeft(){var fitLeft;if(t his.fitInto===window){fitLeft=0}else{fitLeft=this.fitInto.getBoundingClientRect( ).left}return fitLeft},get _fitTop(){var fitTop;if(this.fitInto===window){fitTop =0}else{fitTop=this.fitInto.getBoundingClientRect().top}return fitTop},get _defa ultPositionTarget(){var parent=Polymer.dom(this).parentNode;if(parent&&parent.no deType===Node.DOCUMENT_FRAGMENT_NODE){parent=parent.host}return parent},get _loc aleHorizontalAlign(){if(this._isRTL){if(this.horizontalAlign==="right"){return"l eft"}if(this.horizontalAlign==="left"){return"right"}}return this.horizontalAlig n},attached:function(){this._isRTL=window.getComputedStyle(this).direction=="rtl ";this.positionTarget=this.positionTarget||this._defaultPositionTarget;if(this.a utoFitOnAttach){if(window.getComputedStyle(this).display==="none"){setTimeout(fu nction(){this.fit()}.bind(this))}else{this.fit()}}},fit:function(){this.position ();this.constrain();this.center()},_discoverInfo:function(){if(this._fitInfo){re turn}var target=window.getComputedStyle(this);var sizer=window.getComputedStyle( this.sizingTarget);this._fitInfo={inlineStyle:{top:this.style.top||"",left:this. style.left||"",position:this.style.position||""},sizerInlineStyle:{maxWidth:this .sizingTarget.style.maxWidth||"",maxHeight:this.sizingTarget.style.maxHeight||"" ,boxSizing:this.sizingTarget.style.boxSizing||""},positionedBy:{vertically:targe t.top!=="auto"?"top":target.bottom!=="auto"?"bottom":null,horizontally:target.le ft!=="auto"?"left":target.right!=="auto"?"right":null},sizedBy:{height:sizer.max Height!=="none",width:sizer.maxWidth!=="none",minWidth:parseInt(sizer.minWidth,1 0)||0,minHeight:parseInt(sizer.minHeight,10)||0},margin:{top:parseInt(target.mar ginTop,10)||0,right:parseInt(target.marginRight,10)||0,bottom:parseInt(target.ma rginBottom,10)||0,left:parseInt(target.marginLeft,10)||0}};if(this.verticalOffse t){this._fitInfo.margin.top=this._fitInfo.margin.bottom=this.verticalOffset;this ._fitInfo.inlineStyle.marginTop=this.style.marginTop||"";this._fitInfo.inlineSty le.marginBottom=this.style.marginBottom||"";this.style.marginTop=this.style.marg inBottom=this.verticalOffset+"px"}if(this.horizontalOffset){this._fitInfo.margin .left=this._fitInfo.margin.right=this.horizontalOffset;this._fitInfo.inlineStyle .marginLeft=this.style.marginLeft||"";this._fitInfo.inlineStyle.marginRight=this .style.marginRight||"";this.style.marginLeft=this.style.marginRight=this.horizon talOffset+"px"}},resetFit:function(){var info=this._fitInfo||{};for(var property in info.sizerInlineStyle){this.sizingTarget.style[property]=info.sizerInlineSty le[property]}for(var property in info.inlineStyle){this.style[property]=info.inl ineStyle[property]}this._fitInfo=null},refit:function(){var scrollLeft=this.sizi ngTarget.scrollLeft;var scrollTop=this.sizingTarget.scrollTop;this.resetFit();th is.fit();this.sizingTarget.scrollLeft=scrollLeft;this.sizingTarget.scrollTop=scr ollTop},position:function(){if(!this.horizontalAlign&&!this.verticalAlign){retur n}this._discoverInfo();this.style.position="fixed";this.sizingTarget.style.boxSi zing="border-box";this.style.left="0px";this.style.top="0px";var rect=this.getBo undingClientRect();var positionRect=this.__getNormalizedRect(this.positionTarget );var fitRect=this.__getNormalizedRect(this.fitInto);var margin=this._fitInfo.ma rgin;var size={width:rect.width+margin.left+margin.right,height:rect.height+marg in.top+margin.bottom};var position=this.__getPosition(this._localeHorizontalAlig n,this.verticalAlign,size,positionRect,fitRect);var left=position.left+margin.le ft;var top=position.top+margin.top;var right=Math.min(fitRect.right-margin.right ,left+rect.width);var bottom=Math.min(fitRect.bottom-margin.bottom,top+rect.heig ht);var minWidth=this._fitInfo.sizedBy.minWidth;var minHeight=this._fitInfo.size dBy.minHeight;if(left<margin.left){left=margin.left;if(right-left<minWidth){left =right-minWidth}}if(top<margin.top){top=margin.top;if(bottom-top<minHeight){top= bottom-minHeight}}this.sizingTarget.style.maxWidth=right-left+"px";this.sizingTa rget.style.maxHeight=bottom-top+"px";this.style.left=left-rect.left+"px";this.st yle.top=top-rect.top+"px"},constrain:function(){if(this.horizontalAlign||this.ve rticalAlign){return}this._discoverInfo();var info=this._fitInfo;if(!info.positio nedBy.vertically){this.style.position="fixed";this.style.top="0px"}if(!info.posi tionedBy.horizontally){this.style.position="fixed";this.style.left="0px"}this.si zingTarget.style.boxSizing="border-box";var rect=this.getBoundingClientRect();if (!info.sizedBy.height){this.__sizeDimension(rect,info.positionedBy.vertically,"t op","bottom","Height")}if(!info.sizedBy.width){this.__sizeDimension(rect,info.po sitionedBy.horizontally,"left","right","Width")}},_sizeDimension:function(rect,p ositionedBy,start,end,extent){this.__sizeDimension(rect,positionedBy,start,end,e xtent)},__sizeDimension:function(rect,positionedBy,start,end,extent){var info=th is._fitInfo;var fitRect=this.__getNormalizedRect(this.fitInto);var max=extent=== "Width"?fitRect.width:fitRect.height;var flip=positionedBy===end;var offset=flip ?max-rect[end]:rect[start];var margin=info.margin[flip?start:end];var offsetExte nt="offset"+extent;var sizingOffset=this[offsetExtent]-this.sizingTarget[offsetE xtent];this.sizingTarget.style["max"+extent]=max-margin-offset-sizingOffset+"px" },center:function(){if(this.horizontalAlign||this.verticalAlign){return}this._di scoverInfo();var positionedBy=this._fitInfo.positionedBy;if(positionedBy.vertica lly&&positionedBy.horizontally){return}this.style.position="fixed";if(!positione dBy.vertically){this.style.top="0px"}if(!positionedBy.horizontally){this.style.l eft="0px"}var rect=this.getBoundingClientRect();var fitRect=this.__getNormalized Rect(this.fitInto);if(!positionedBy.vertically){var top=fitRect.top-rect.top+(fi tRect.height-rect.height)/2;this.style.top=top+"px"}if(!positionedBy.horizontall y){var left=fitRect.left-rect.left+(fitRect.width-rect.width)/2;this.style.left= left+"px"}},__getNormalizedRect:function(target){if(target===document.documentEl ement||target===window){return{top:0,left:0,width:window.innerWidth,height:windo w.innerHeight,right:window.innerWidth,bottom:window.innerHeight}}return target.g etBoundingClientRect()},__getCroppedArea:function(position,size,fitRect){var ver ticalCrop=Math.min(0,position.top)+Math.min(0,fitRect.bottom-(position.top+size. height));var horizontalCrop=Math.min(0,position.left)+Math.min(0,fitRect.right-( position.left+size.width));return Math.abs(verticalCrop)*size.width+Math.abs(hor izontalCrop)*size.height},__getPosition:function(hAlign,vAlign,size,positionRect ,fitRect){var positions=[{verticalAlign:"top",horizontalAlign:"left",top:positio nRect.top,left:positionRect.left},{verticalAlign:"top",horizontalAlign:"right",t op:positionRect.top,left:positionRect.right-size.width},{verticalAlign:"bottom", horizontalAlign:"left",top:positionRect.bottom-size.height,left:positionRect.lef t},{verticalAlign:"bottom",horizontalAlign:"right",top:positionRect.bottom-size. height,left:positionRect.right-size.width}];if(this.noOverlap){for(var i=0,l=pos itions.length;i<l;i++){var copy={};for(var key in positions[i]){copy[key]=positi ons[i][key]}positions.push(copy)}positions[0].top=positions[1].top+=positionRect .height;positions[2].top=positions[3].top-=positionRect.height;positions[4].left =positions[6].left+=positionRect.width;positions[5].left=positions[7].left-=posi tionRect.width}vAlign=vAlign==="auto"?null:vAlign;hAlign=hAlign==="auto"?null:hA lign;var position;for(var i=0;i<positions.length;i++){var pos=positions[i];if(!t his.dynamicAlign&&!this.noOverlap&&pos.verticalAlign===vAlign&&pos.horizontalAli gn===hAlign){position=pos;break}var alignOk=(!vAlign||pos.verticalAlign===vAlign )&&(!hAlign||pos.horizontalAlign===hAlign);if(!this.dynamicAlign&&!alignOk){cont inue}position=position||pos;pos.croppedArea=this.__getCroppedArea(pos,size,fitRe ct);var diff=pos.croppedArea-position.croppedArea;if(diff<0||diff===0&&alignOk){ position=pos}if(position.croppedArea===0&&alignOk){break}}return position}};(fun ction(){"use strict";Polymer({is:"iron-overlay-backdrop",properties:{opened:{ref lectToAttribute:true,type:Boolean,value:false,observer:"_openedChanged"}},listen ers:{transitionend:"_onTransitionend"},created:function(){this.__openedRaf=null} ,attached:function(){this.opened&&this._openedChanged(this.opened)},prepare:func tion(){if(this.opened&&!this.parentNode){Polymer.dom(document.body).appendChild( this)}},open:function(){this.opened=true},close:function(){this.opened=false},co mplete:function(){if(!this.opened&&this.parentNode===document.body){Polymer.dom( this.parentNode).removeChild(this)}},_onTransitionend:function(event){if(event&& event.target===this){this.complete()}},_openedChanged:function(opened){if(opened ){this.prepare()}else{var cs=window.getComputedStyle(this);if(cs.transitionDurat ion==="0s"||cs.opacity==0){this.complete()}}if(!this.isAttached){return}if(this. __openedRaf){window.cancelAnimationFrame(this.__openedRaf);this.__openedRaf=null }this.scrollTop=this.scrollTop;this.__openedRaf=window.requestAnimationFrame(fun ction(){this.__openedRaf=null;this.toggleClass("opened",this.opened)}.bind(this) )}})})();Polymer.IronOverlayManagerClass=function(){this._overlays=[];this._mini mumZ=101;this._backdropElement=null;Polymer.Gestures.add(document,"tap",this._on CaptureClick.bind(this));document.addEventListener("focus",this._onCaptureFocus. bind(this),true);document.addEventListener("keydown",this._onCaptureKeyDown.bind (this),true)};Polymer.IronOverlayManagerClass.prototype={constructor:Polymer.Iro nOverlayManagerClass,get backdropElement(){if(!this._backdropElement){this._back dropElement=document.createElement("iron-overlay-backdrop")}return this._backdro pElement},get deepActiveElement(){var active=document.activeElement||document.bo dy;while(active.root&&Polymer.dom(active.root).activeElement){active=Polymer.dom (active.root).activeElement}return active},_bringOverlayAtIndexToFront:function( i){var overlay=this._overlays[i];if(!overlay){return}var lastI=this._overlays.le ngth-1;var currentOverlay=this._overlays[lastI];if(currentOverlay&&this._shouldB eBehindOverlay(overlay,currentOverlay)){lastI--}if(i>=lastI){return}var minimumZ =Math.max(this.currentOverlayZ(),this._minimumZ);if(this._getZ(overlay)<=minimum Z){this._applyOverlayZ(overlay,minimumZ)}while(i<lastI){this._overlays[i]=this._ overlays[i+1];i++}this._overlays[lastI]=overlay},addOrRemoveOverlay:function(ove rlay){if(overlay.opened){this.addOverlay(overlay)}else{this.removeOverlay(overla y)}},addOverlay:function(overlay){var i=this._overlays.indexOf(overlay);if(i>=0) {this._bringOverlayAtIndexToFront(i);this.trackBackdrop();return}var insertionIn dex=this._overlays.length;var currentOverlay=this._overlays[insertionIndex-1];va r minimumZ=Math.max(this._getZ(currentOverlay),this._minimumZ);var newZ=this._ge tZ(overlay);if(currentOverlay&&this._shouldBeBehindOverlay(overlay,currentOverla y)){this._applyOverlayZ(currentOverlay,minimumZ);insertionIndex--;var previousOv erlay=this._overlays[insertionIndex-1];minimumZ=Math.max(this._getZ(previousOver lay),this._minimumZ)}if(newZ<=minimumZ){this._applyOverlayZ(overlay,minimumZ)}th is._overlays.splice(insertionIndex,0,overlay);this.trackBackdrop()},removeOverla y:function(overlay){var i=this._overlays.indexOf(overlay);if(i===-1){return}this ._overlays.splice(i,1);this.trackBackdrop()},currentOverlay:function(){var i=thi s._overlays.length-1;return this._overlays[i]},currentOverlayZ:function(){return this._getZ(this.currentOverlay())},ensureMinimumZ:function(minimumZ){this._mini mumZ=Math.max(this._minimumZ,minimumZ)},focusOverlay:function(){var current=this .currentOverlay();if(current){current._applyFocus()}},trackBackdrop:function(){v ar overlay=this._overlayWithBackdrop();if(!overlay&&!this._backdropElement){retu rn}this.backdropElement.style.zIndex=this._getZ(overlay)-1;this.backdropElement. opened=!!overlay},getBackdrops:function(){var backdrops=[];for(var i=0;i<this._o verlays.length;i++){if(this._overlays[i].withBackdrop){backdrops.push(this._over lays[i])}}return backdrops},backdropZ:function(){return this._getZ(this._overlay WithBackdrop())-1},_overlayWithBackdrop:function(){for(var i=0;i<this._overlays. length;i++){if(this._overlays[i].withBackdrop){return this._overlays[i]}}},_getZ :function(overlay){var z=this._minimumZ;if(overlay){var z1=Number(overlay.style. zIndex||window.getComputedStyle(overlay).zIndex);if(z1===z1){z=z1}}return z},_se tZ:function(element,z){element.style.zIndex=z},_applyOverlayZ:function(overlay,a boveZ){this._setZ(overlay,aboveZ+2)},_overlayInPath:function(path){path=path||[] ;for(var i=0;i<path.length;i++){if(path[i]._manager===this){return path[i]}}},_o nCaptureClick:function(event){var overlay=this.currentOverlay();if(overlay&&this ._overlayInPath(Polymer.dom(event).path)!==overlay){overlay._onCaptureClick(even t)}},_onCaptureFocus:function(event){var overlay=this.currentOverlay();if(overla y){overlay._onCaptureFocus(event)}},_onCaptureKeyDown:function(event){var overla y=this.currentOverlay();if(overlay){if(Polymer.IronA11yKeysBehavior.keyboardEven tMatchesKeys(event,"esc")){overlay._onCaptureEsc(event)}else if(Polymer.IronA11y KeysBehavior.keyboardEventMatchesKeys(event,"tab")){overlay._onCaptureTab(event) }}},_shouldBeBehindOverlay:function(overlay1,overlay2){return!overlay1.alwaysOnT op&&overlay2.alwaysOnTop}};Polymer.IronOverlayManager=new Polymer.IronOverlayMan agerClass;(function(){"use strict";var p=Element.prototype;var matches=p.matches ||p.matchesSelector||p.mozMatchesSelector||p.msMatchesSelector||p.oMatchesSelect or||p.webkitMatchesSelector;Polymer.IronFocusablesHelper={getTabbableNodes:funct ion(node){var result=[];var needsSortByTabIndex=this._collectTabbableNodes(node, result);if(needsSortByTabIndex){return this._sortByTabIndex(result)}return resul t},isFocusable:function(element){if(matches.call(element,"input, select, textare a, button, object")){return matches.call(element,":not([disabled])")}return matc hes.call(element,"a[href], area[href], iframe, [tabindex], [contentEditable]")}, isTabbable:function(element){return this.isFocusable(element)&&matches.call(elem ent,':not([tabindex="-1"])')&&this._isVisible(element)},_normalizedTabIndex:func tion(element){if(this.isFocusable(element)){var tabIndex=element.getAttribute("t abindex")||0;return Number(tabIndex)}return-1},_collectTabbableNodes:function(no de,result){if(node.nodeType!==Node.ELEMENT_NODE||!this._isVisible(node)){return false}var element=node;var tabIndex=this._normalizedTabIndex(element);var needsS ortByTabIndex=tabIndex>0;if(tabIndex>=0){result.push(element)}var children;if(el ement.localName==="content"){children=Polymer.dom(element).getDistributedNodes() }else{children=Polymer.dom(element.root||element).children}for(var i=0;i<childre n.length;i++){var needsSort=this._collectTabbableNodes(children[i],result);needs SortByTabIndex=needsSortByTabIndex||needsSort}return needsSortByTabIndex},_isVis ible:function(element){var style=element.style;if(style.visibility!=="hidden"&&s tyle.display!=="none"){style=window.getComputedStyle(element);return style.visib ility!=="hidden"&&style.display!=="none"}return false},_sortByTabIndex:function( tabbables){var len=tabbables.length;if(len<2){return tabbables}var pivot=Math.ce il(len/2);var left=this._sortByTabIndex(tabbables.slice(0,pivot));var right=this ._sortByTabIndex(tabbables.slice(pivot));return this._mergeSortByTabIndex(left,r ight)},_mergeSortByTabIndex:function(left,right){var result=[];while(left.length >0&&right.length>0){if(this._hasLowerTabOrder(left[0],right[0])){result.push(rig ht.shift())}else{result.push(left.shift())}}return result.concat(left,right)},_h asLowerTabOrder:function(a,b){var ati=Math.max(a.tabIndex,0);var bti=Math.max(b. tabIndex,0);return ati===0||bti===0?bti>ati:ati>bti}}})();(function(){"use stric t";Polymer.IronOverlayBehaviorImpl={properties:{opened:{observer:"_openedChanged ",type:Boolean,value:false,notify:true},canceled:{observer:"_canceledChanged",re adOnly:true,type:Boolean,value:false},withBackdrop:{observer:"_withBackdropChang ed",type:Boolean},noAutoFocus:{type:Boolean,value:false},noCancelOnEscKey:{type: Boolean,value:false},noCancelOnOutsideClick:{type:Boolean,value:false},closingRe ason:{type:Object},restoreFocusOnClose:{type:Boolean,value:false},alwaysOnTop:{t ype:Boolean},_manager:{type:Object,value:Polymer.IronOverlayManager},_focusedChi ld:{type:Object}},listeners:{"iron-resize":"_onIronResize"},get backdropElement( ){return this._manager.backdropElement},get _focusNode(){return this._focusedChi ld||Polymer.dom(this).querySelector("[autofocus]")||this},get _focusableNodes(){ return Polymer.IronFocusablesHelper.getTabbableNodes(this)},ready:function(){thi s.__isAnimating=false;this.__shouldRemoveTabIndex=false;this.__firstFocusableNod e=this.__lastFocusableNode=null;this.__raf=null;this.__restoreFocusNode=null;thi s._ensureSetup()},attached:function(){if(this.opened){this._openedChanged(this.o pened)}this._observer=Polymer.dom(this).observeNodes(this._onNodesChange)},detac hed:function(){Polymer.dom(this).unobserveNodes(this._observer);this._observer=n ull;if(this.__raf){window.cancelAnimationFrame(this.__raf);this.__raf=null}this. _manager.removeOverlay(this)},toggle:function(){this._setCanceled(false);this.op ened=!this.opened},open:function(){this._setCanceled(false);this.opened=true},cl ose:function(){this._setCanceled(false);this.opened=false},cancel:function(event ){var cancelEvent=this.fire("iron-overlay-canceled",event,{cancelable:true});if( cancelEvent.defaultPrevented){return}this._setCanceled(true);this.opened=false}, invalidateTabbables:function(){this.__firstFocusableNode=this.__lastFocusableNod e=null},_ensureSetup:function(){if(this._overlaySetup){return}this._overlaySetup =true;this.style.outline="none";this.style.display="none"},_openedChanged:functi on(opened){if(opened){this.removeAttribute("aria-hidden")}else{this.setAttribute ("aria-hidden","true")}if(!this.isAttached){return}this.__isAnimating=true;this. __onNextAnimationFrame(this.__openedChanged)},_canceledChanged:function(){this.c losingReason=this.closingReason||{};this.closingReason.canceled=this.canceled},_ withBackdropChanged:function(){if(this.withBackdrop&&!this.hasAttribute("tabinde x")){this.setAttribute("tabindex","-1");this.__shouldRemoveTabIndex=true}else if (this.__shouldRemoveTabIndex){this.removeAttribute("tabindex");this.__shouldRemo veTabIndex=false}if(this.opened&&this.isAttached){this._manager.trackBackdrop()} },_prepareRenderOpened:function(){this.__restoreFocusNode=this._manager.deepActi veElement;this._preparePositioning();this.refit();this._finishPositioning();if(t his.noAutoFocus&&document.activeElement===this._focusNode){this._focusNode.blur( );this.__restoreFocusNode.focus()}},_renderOpened:function(){this._finishRenderO pened()},_renderClosed:function(){this._finishRenderClosed()},_finishRenderOpene d:function(){this.notifyResize();this.__isAnimating=false;this.fire("iron-overla y-opened")},_finishRenderClosed:function(){this.style.display="none";this.style. zIndex="";this.notifyResize();this.__isAnimating=false;this.fire("iron-overlay-c losed",this.closingReason)},_preparePositioning:function(){this.style.transition =this.style.webkitTransition="none";this.style.transform=this.style.webkitTransf orm="none";this.style.display=""},_finishPositioning:function(){this.style.displ ay="none";this.scrollTop=this.scrollTop;this.style.transition=this.style.webkitT ransition="";this.style.transform=this.style.webkitTransform="";this.style.displ ay="";this.scrollTop=this.scrollTop},_applyFocus:function(){if(this.opened){if(! this.noAutoFocus){this._focusNode.focus()}}else{this._focusNode.blur();this._foc usedChild=null;if(this.restoreFocusOnClose&&this.__restoreFocusNode){this.__rest oreFocusNode.focus()}this.__restoreFocusNode=null;var currentOverlay=this._manag er.currentOverlay();if(currentOverlay&&this!==currentOverlay){currentOverlay._ap plyFocus()}}},_onCaptureClick:function(event){if(!this.noCancelOnOutsideClick){t his.cancel(event)}},_onCaptureFocus:function(event){if(!this.withBackdrop){retur n}var path=Polymer.dom(event).path;if(path.indexOf(this)===-1){event.stopPropaga tion();this._applyFocus()}else{this._focusedChild=path[0]}},_onCaptureEsc:functi on(event){if(!this.noCancelOnEscKey){this.cancel(event)}},_onCaptureTab:function (event){if(!this.withBackdrop){return}this.__ensureFirstLastFocusables();var shi ft=event.shiftKey;var nodeToCheck=shift?this.__firstFocusableNode:this.__lastFoc usableNode;var nodeToSet=shift?this.__lastFocusableNode:this.__firstFocusableNod e;var shouldWrap=false;if(nodeToCheck===nodeToSet){shouldWrap=true}else{var focu sedNode=this._manager.deepActiveElement;shouldWrap=focusedNode===nodeToCheck||fo cusedNode===this}if(shouldWrap){event.preventDefault();this._focusedChild=nodeTo Set;this._applyFocus()}},_onIronResize:function(){if(this.opened&&!this.__isAnim ating){this.__onNextAnimationFrame(this.refit)}},_onNodesChange:function(){if(th is.opened&&!this.__isAnimating){this.invalidateTabbables();this.notifyResize()}} ,__ensureFirstLastFocusables:function(){if(!this.__firstFocusableNode||!this.__l astFocusableNode){var focusableNodes=this._focusableNodes;this.__firstFocusableN ode=focusableNodes[0];this.__lastFocusableNode=focusableNodes[focusableNodes.len gth-1]}},__openedChanged:function(){if(this.opened){this._prepareRenderOpened(); this._manager.addOverlay(this);this._applyFocus();this._renderOpened()}else{this ._manager.removeOverlay(this);this._applyFocus();this._renderClosed()}},__onNext AnimationFrame:function(callback){if(this.__raf){window.cancelAnimationFrame(thi s.__raf)}var self=this;this.__raf=window.requestAnimationFrame(function nextAnim ationFrame(){self.__raf=null;callback.call(self)})}};Polymer.IronOverlayBehavior =[Polymer.IronFitBehavior,Polymer.IronResizableBehavior,Polymer.IronOverlayBehav iorImpl]})();Polymer.NeonAnimatableBehavior={properties:{animationConfig:{type:O bject},entryAnimation:{observer:"_entryAnimationChanged",type:String},exitAnimat ion:{observer:"_exitAnimationChanged",type:String}},_entryAnimationChanged:funct ion(){this.animationConfig=this.animationConfig||{};this.animationConfig["entry" ]=[{name:this.entryAnimation,node:this}]},_exitAnimationChanged:function(){this. animationConfig=this.animationConfig||{};this.animationConfig["exit"]=[{name:thi s.exitAnimation,node:this}]},_copyProperties:function(config1,config2){for(var p roperty in config2){config1[property]=config2[property]}},_cloneConfig:function( config){var clone={isClone:true};this._copyProperties(clone,config);return clone },_getAnimationConfigRecursive:function(type,map,allConfigs){if(!this.animationC onfig){return}if(this.animationConfig.value&&typeof this.animationConfig.value== ="function"){this._warn(this._logf("playAnimation","Please put 'animationConfig' inside of your components 'properties' object instead of outside of it."));retu rn}var thisConfig;if(type){thisConfig=this.animationConfig[type]}else{thisConfig =this.animationConfig}if(!Array.isArray(thisConfig)){thisConfig=[thisConfig]}if( thisConfig){for(var config,index=0;config=thisConfig[index];index++){if(config.a nimatable){config.animatable._getAnimationConfigRecursive(config.type||type,map, allConfigs)}else{if(config.id){var cachedConfig=map[config.id];if(cachedConfig){ if(!cachedConfig.isClone){map[config.id]=this._cloneConfig(cachedConfig);cachedC onfig=map[config.id]}this._copyProperties(cachedConfig,config)}else{map[config.i d]=config}}else{allConfigs.push(config)}}}}},getAnimationConfig:function(type){v ar map={};var allConfigs=[];this._getAnimationConfigRecursive(type,map,allConfig s);for(var key in map){allConfigs.push(map[key])}return allConfigs}};Polymer.Neo nAnimationRunnerBehaviorImpl={_configureAnimations:function(configs){var results =[];if(configs.length>0){for(var config,index=0;config=configs[index];index++){v ar neonAnimation=document.createElement(config.name);if(neonAnimation.isNeonAnim ation){var result=null;try{result=neonAnimation.configure(config);if(typeof resu lt.cancel!="function"){result=document.timeline.play(result)}}catch(e){result=nu ll;console.warn("Couldnt play","(",config.name,").",e)}if(result){results.push({ neonAnimation:neonAnimation,config:config,animation:result})}}else{console.warn( this.is+":",config.name,"not found!")}}}return results},_shouldComplete:function (activeEntries){var finished=true;for(var i=0;i<activeEntries.length;i++){if(act iveEntries[i].animation.playState!="finished"){finished=false;break}}return fini shed},_complete:function(activeEntries){for(var i=0;i<activeEntries.length;i++){ activeEntries[i].neonAnimation.complete(activeEntries[i].config)}for(var i=0;i<a ctiveEntries.length;i++){activeEntries[i].animation.cancel()}},playAnimation:fun ction(type,cookie){var configs=this.getAnimationConfig(type);if(!configs){return }this._active=this._active||{};if(this._active[type]){this._complete(this._activ e[type]);delete this._active[type]}var activeEntries=this._configureAnimations(c onfigs);if(activeEntries.length==0){this.fire("neon-animation-finish",cookie,{bu bbles:false});return}this._active[type]=activeEntries;for(var i=0;i<activeEntrie s.length;i++){activeEntries[i].animation.onfinish=function(){if(this._shouldComp lete(activeEntries)){this._complete(activeEntries);delete this._active[type];thi s.fire("neon-animation-finish",cookie,{bubbles:false})}}.bind(this)}},cancelAnim ation:function(){for(var k in this._animations){this._animations[k].cancel()}thi s._animations={}}};Polymer.NeonAnimationRunnerBehavior=[Polymer.NeonAnimatableBe havior,Polymer.NeonAnimationRunnerBehaviorImpl];Polymer.NeonAnimationBehavior={p roperties:{animationTiming:{type:Object,value:function(){return{duration:500,eas ing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"both"}}}},isNeonAnimation:true,timingFr omConfig:function(config){if(config.timing){for(var property in config.timing){t his.animationTiming[property]=config.timing[property]}}return this.animationTimi ng},setPrefixedProperty:function(node,property,value){var map={transform:["webki tTransform"],transformOrigin:["mozTransformOrigin","webkitTransformOrigin"]};var prefixes=map[property];for(var prefix,index=0;prefix=prefixes[index];index++){n ode.style[prefix]=value}node.style[property]=value},complete:function(){}};Polym er({is:"opaque-animation",behaviors:[Polymer.NeonAnimationBehavior],configure:fu nction(config){var node=config.node;this._effect=new KeyframeEffect(node,[{opaci ty:"1"},{opacity:"1"}],this.timingFromConfig(config));node.style.opacity="0";ret urn this._effect},complete:function(config){config.node.style.opacity=""}});(fun ction(){"use strict";var LAST_TOUCH_POSITION={pageX:0,pageY:0};var ROOT_TARGET=n ull;var SCROLLABLE_NODES=[];Polymer.IronDropdownScrollManager={get currentLockin gElement(){return this._lockingElements[this._lockingElements.length-1]},element IsScrollLocked:function(element){var currentLockingElement=this.currentLockingEl ement;if(currentLockingElement===undefined)return false;var scrollLocked;if(this ._hasCachedLockedElement(element)){return true}if(this._hasCachedUnlockedElement (element)){return false}scrollLocked=!!currentLockingElement&&currentLockingElem ent!==element&&!this._composedTreeContains(currentLockingElement,element);if(scr ollLocked){this._lockedElementCache.push(element)}else{this._unlockedElementCach e.push(element)}return scrollLocked},pushScrollLock:function(element){if(this._l ockingElements.indexOf(element)>=0){return}if(this._lockingElements.length===0){ this._lockScrollInteractions()}this._lockingElements.push(element);this._lockedE lementCache=[];this._unlockedElementCache=[]},removeScrollLock:function(element) {var index=this._lockingElements.indexOf(element);if(index===-1){return}this._lo ckingElements.splice(index,1);this._lockedElementCache=[];this._unlockedElementC ache=[];if(this._lockingElements.length===0){this._unlockScrollInteractions()}}, _lockingElements:[],_lockedElementCache:null,_unlockedElementCache:null,_hasCach edLockedElement:function(element){return this._lockedElementCache.indexOf(elemen t)>-1},_hasCachedUnlockedElement:function(element){return this._unlockedElementC ache.indexOf(element)>-1},_composedTreeContains:function(element,child){var cont entElements;var distributedNodes;var contentIndex;var nodeIndex;if(element.conta ins(child)){return true}contentElements=Polymer.dom(element).querySelectorAll("c ontent");for(contentIndex=0;contentIndex<contentElements.length;++contentIndex){ distributedNodes=Polymer.dom(contentElements[contentIndex]).getDistributedNodes( );for(nodeIndex=0;nodeIndex<distributedNodes.length;++nodeIndex){if(this._compos edTreeContains(distributedNodes[nodeIndex],child)){return true}}}return false},_ scrollInteractionHandler:function(event){if(event.cancelable&&this._shouldPreven tScrolling(event)){event.preventDefault()}if(event.targetTouches){var touch=even t.targetTouches[0];LAST_TOUCH_POSITION.pageX=touch.pageX;LAST_TOUCH_POSITION.pag eY=touch.pageY}},_lockScrollInteractions:function(){this._boundScrollHandler=thi s._boundScrollHandler||this._scrollInteractionHandler.bind(this);document.addEve ntListener("wheel",this._boundScrollHandler,true);document.addEventListener("mou sewheel",this._boundScrollHandler,true);document.addEventListener("DOMMouseScrol l",this._boundScrollHandler,true);document.addEventListener("touchstart",this._b oundScrollHandler,true);document.addEventListener("touchmove",this._boundScrollH andler,true)},_unlockScrollInteractions:function(){document.removeEventListener( "wheel",this._boundScrollHandler,true);document.removeEventListener("mousewheel" ,this._boundScrollHandler,true);document.removeEventListener("DOMMouseScroll",th is._boundScrollHandler,true);document.removeEventListener("touchstart",this._bou ndScrollHandler,true);document.removeEventListener("touchmove",this._boundScroll Handler,true)},_shouldPreventScrolling:function(event){var target=Polymer.dom(ev ent).rootTarget;if(event.type!=="touchmove"&&ROOT_TARGET!==target){ROOT_TARGET=t arget;SCROLLABLE_NODES=this._getScrollableNodes(Polymer.dom(event).path)}if(!SCR OLLABLE_NODES.length){return true}if(event.type==="touchstart"){return false}var info=this._getScrollInfo(event);return!this._getScrollingNode(SCROLLABLE_NODES, info.deltaX,info.deltaY)},_getScrollableNodes:function(nodes){var scrollables=[] ;var lockingIndex=nodes.indexOf(this.currentLockingElement);for(var i=0;i<=locki ngIndex;i++){var node=nodes[i];if(node.nodeType===11){continue}var style=node.st yle;if(style.overflow!=="scroll"&&style.overflow!=="auto"){style=window.getCompu tedStyle(node); 29 Polymer({is:"cr-drawer","extends":"dialog",properties:{open:{type:Boolean,notify :true},align:{type:String,value:"left",reflectToAttribute:true}},listeners:{canc el:"onDialogCancel_",tap:"onDialogTap_",transitionend:"onDialogTransitionEnd_"}, toggle:function(){if(this.open)this.closeDrawer();else this.openDrawer()},openDr awer:function(){if(!this.open){this.showModal();this.classList.add("opening")}}, closeDrawer:function(){if(this.open){this.classList.remove("opening");this.class List.add("closing")}},onContainerTap_:function(event){event.stopPropagation()},o nDialogTap_:function(){this.closeDrawer()},onDialogCancel_:function(event){event .preventDefault();this.closeDrawer()},onDialogTransitionEnd_:function(){if(this. classList.contains("closing")){this.classList.remove("closing");this.close()}}}) ;Polymer.IronFitBehavior={properties:{sizingTarget:{type:Object,value:function() {return this}},fitInto:{type:Object,value:window},noOverlap:{type:Boolean},posit ionTarget:{type:Element},horizontalAlign:{type:String},verticalAlign:{type:Strin g},dynamicAlign:{type:Boolean},horizontalOffset:{type:Number,value:0,notify:true },verticalOffset:{type:Number,value:0,notify:true},autoFitOnAttach:{type:Boolean ,value:false},_fitInfo:{type:Object}},get _fitWidth(){var fitWidth;if(this.fitIn to===window){fitWidth=this.fitInto.innerWidth}else{fitWidth=this.fitInto.getBoun dingClientRect().width}return fitWidth},get _fitHeight(){var fitHeight;if(this.f itInto===window){fitHeight=this.fitInto.innerHeight}else{fitHeight=this.fitInto. getBoundingClientRect().height}return fitHeight},get _fitLeft(){var fitLeft;if(t his.fitInto===window){fitLeft=0}else{fitLeft=this.fitInto.getBoundingClientRect( ).left}return fitLeft},get _fitTop(){var fitTop;if(this.fitInto===window){fitTop =0}else{fitTop=this.fitInto.getBoundingClientRect().top}return fitTop},get _defa ultPositionTarget(){var parent=Polymer.dom(this).parentNode;if(parent&&parent.no deType===Node.DOCUMENT_FRAGMENT_NODE){parent=parent.host}return parent},get _loc aleHorizontalAlign(){if(this._isRTL){if(this.horizontalAlign==="right"){return"l eft"}if(this.horizontalAlign==="left"){return"right"}}return this.horizontalAlig n},attached:function(){this._isRTL=window.getComputedStyle(this).direction=="rtl ";this.positionTarget=this.positionTarget||this._defaultPositionTarget;if(this.a utoFitOnAttach){if(window.getComputedStyle(this).display==="none"){setTimeout(fu nction(){this.fit()}.bind(this))}else{this.fit()}}},fit:function(){this.position ();this.constrain();this.center()},_discoverInfo:function(){if(this._fitInfo){re turn}var target=window.getComputedStyle(this);var sizer=window.getComputedStyle( this.sizingTarget);this._fitInfo={inlineStyle:{top:this.style.top||"",left:this. style.left||"",position:this.style.position||""},sizerInlineStyle:{maxWidth:this .sizingTarget.style.maxWidth||"",maxHeight:this.sizingTarget.style.maxHeight||"" ,boxSizing:this.sizingTarget.style.boxSizing||""},positionedBy:{vertically:targe t.top!=="auto"?"top":target.bottom!=="auto"?"bottom":null,horizontally:target.le ft!=="auto"?"left":target.right!=="auto"?"right":null},sizedBy:{height:sizer.max Height!=="none",width:sizer.maxWidth!=="none",minWidth:parseInt(sizer.minWidth,1 0)||0,minHeight:parseInt(sizer.minHeight,10)||0},margin:{top:parseInt(target.mar ginTop,10)||0,right:parseInt(target.marginRight,10)||0,bottom:parseInt(target.ma rginBottom,10)||0,left:parseInt(target.marginLeft,10)||0}};if(this.verticalOffse t){this._fitInfo.margin.top=this._fitInfo.margin.bottom=this.verticalOffset;this ._fitInfo.inlineStyle.marginTop=this.style.marginTop||"";this._fitInfo.inlineSty le.marginBottom=this.style.marginBottom||"";this.style.marginTop=this.style.marg inBottom=this.verticalOffset+"px"}if(this.horizontalOffset){this._fitInfo.margin .left=this._fitInfo.margin.right=this.horizontalOffset;this._fitInfo.inlineStyle .marginLeft=this.style.marginLeft||"";this._fitInfo.inlineStyle.marginRight=this .style.marginRight||"";this.style.marginLeft=this.style.marginRight=this.horizon talOffset+"px"}},resetFit:function(){var info=this._fitInfo||{};for(var property in info.sizerInlineStyle){this.sizingTarget.style[property]=info.sizerInlineSty le[property]}for(var property in info.inlineStyle){this.style[property]=info.inl ineStyle[property]}this._fitInfo=null},refit:function(){var scrollLeft=this.sizi ngTarget.scrollLeft;var scrollTop=this.sizingTarget.scrollTop;this.resetFit();th is.fit();this.sizingTarget.scrollLeft=scrollLeft;this.sizingTarget.scrollTop=scr ollTop},position:function(){if(!this.horizontalAlign&&!this.verticalAlign){retur n}this._discoverInfo();this.style.position="fixed";this.sizingTarget.style.boxSi zing="border-box";this.style.left="0px";this.style.top="0px";var rect=this.getBo undingClientRect();var positionRect=this.__getNormalizedRect(this.positionTarget );var fitRect=this.__getNormalizedRect(this.fitInto);var margin=this._fitInfo.ma rgin;var size={width:rect.width+margin.left+margin.right,height:rect.height+marg in.top+margin.bottom};var position=this.__getPosition(this._localeHorizontalAlig n,this.verticalAlign,size,positionRect,fitRect);var left=position.left+margin.le ft;var top=position.top+margin.top;var right=Math.min(fitRect.right-margin.right ,left+rect.width);var bottom=Math.min(fitRect.bottom-margin.bottom,top+rect.heig ht);var minWidth=this._fitInfo.sizedBy.minWidth;var minHeight=this._fitInfo.size dBy.minHeight;if(left<margin.left){left=margin.left;if(right-left<minWidth){left =right-minWidth}}if(top<margin.top){top=margin.top;if(bottom-top<minHeight){top= bottom-minHeight}}this.sizingTarget.style.maxWidth=right-left+"px";this.sizingTa rget.style.maxHeight=bottom-top+"px";this.style.left=left-rect.left+"px";this.st yle.top=top-rect.top+"px"},constrain:function(){if(this.horizontalAlign||this.ve rticalAlign){return}this._discoverInfo();var info=this._fitInfo;if(!info.positio nedBy.vertically){this.style.position="fixed";this.style.top="0px"}if(!info.posi tionedBy.horizontally){this.style.position="fixed";this.style.left="0px"}this.si zingTarget.style.boxSizing="border-box";var rect=this.getBoundingClientRect();if (!info.sizedBy.height){this.__sizeDimension(rect,info.positionedBy.vertically,"t op","bottom","Height")}if(!info.sizedBy.width){this.__sizeDimension(rect,info.po sitionedBy.horizontally,"left","right","Width")}},_sizeDimension:function(rect,p ositionedBy,start,end,extent){this.__sizeDimension(rect,positionedBy,start,end,e xtent)},__sizeDimension:function(rect,positionedBy,start,end,extent){var info=th is._fitInfo;var fitRect=this.__getNormalizedRect(this.fitInto);var max=extent=== "Width"?fitRect.width:fitRect.height;var flip=positionedBy===end;var offset=flip ?max-rect[end]:rect[start];var margin=info.margin[flip?start:end];var offsetExte nt="offset"+extent;var sizingOffset=this[offsetExtent]-this.sizingTarget[offsetE xtent];this.sizingTarget.style["max"+extent]=max-margin-offset-sizingOffset+"px" },center:function(){if(this.horizontalAlign||this.verticalAlign){return}this._di scoverInfo();var positionedBy=this._fitInfo.positionedBy;if(positionedBy.vertica lly&&positionedBy.horizontally){return}this.style.position="fixed";if(!positione dBy.vertically){this.style.top="0px"}if(!positionedBy.horizontally){this.style.l eft="0px"}var rect=this.getBoundingClientRect();var fitRect=this.__getNormalized Rect(this.fitInto);if(!positionedBy.vertically){var top=fitRect.top-rect.top+(fi tRect.height-rect.height)/2;this.style.top=top+"px"}if(!positionedBy.horizontall y){var left=fitRect.left-rect.left+(fitRect.width-rect.width)/2;this.style.left= left+"px"}},__getNormalizedRect:function(target){if(target===document.documentEl ement||target===window){return{top:0,left:0,width:window.innerWidth,height:windo w.innerHeight,right:window.innerWidth,bottom:window.innerHeight}}return target.g etBoundingClientRect()},__getCroppedArea:function(position,size,fitRect){var ver ticalCrop=Math.min(0,position.top)+Math.min(0,fitRect.bottom-(position.top+size. height));var horizontalCrop=Math.min(0,position.left)+Math.min(0,fitRect.right-( position.left+size.width));return Math.abs(verticalCrop)*size.width+Math.abs(hor izontalCrop)*size.height},__getPosition:function(hAlign,vAlign,size,positionRect ,fitRect){var positions=[{verticalAlign:"top",horizontalAlign:"left",top:positio nRect.top,left:positionRect.left},{verticalAlign:"top",horizontalAlign:"right",t op:positionRect.top,left:positionRect.right-size.width},{verticalAlign:"bottom", horizontalAlign:"left",top:positionRect.bottom-size.height,left:positionRect.lef t},{verticalAlign:"bottom",horizontalAlign:"right",top:positionRect.bottom-size. height,left:positionRect.right-size.width}];if(this.noOverlap){for(var i=0,l=pos itions.length;i<l;i++){var copy={};for(var key in positions[i]){copy[key]=positi ons[i][key]}positions.push(copy)}positions[0].top=positions[1].top+=positionRect .height;positions[2].top=positions[3].top-=positionRect.height;positions[4].left =positions[6].left+=positionRect.width;positions[5].left=positions[7].left-=posi tionRect.width}vAlign=vAlign==="auto"?null:vAlign;hAlign=hAlign==="auto"?null:hA lign;var position;for(var i=0;i<positions.length;i++){var pos=positions[i];if(!t his.dynamicAlign&&!this.noOverlap&&pos.verticalAlign===vAlign&&pos.horizontalAli gn===hAlign){position=pos;break}var alignOk=(!vAlign||pos.verticalAlign===vAlign )&&(!hAlign||pos.horizontalAlign===hAlign);if(!this.dynamicAlign&&!alignOk){cont inue}position=position||pos;pos.croppedArea=this.__getCroppedArea(pos,size,fitRe ct);var diff=pos.croppedArea-position.croppedArea;if(diff<0||diff===0&&alignOk){ position=pos}if(position.croppedArea===0&&alignOk){break}}return position}};(fun ction(){"use strict";Polymer({is:"iron-overlay-backdrop",properties:{opened:{ref lectToAttribute:true,type:Boolean,value:false,observer:"_openedChanged"}},listen ers:{transitionend:"_onTransitionend"},created:function(){this.__openedRaf=null} ,attached:function(){this.opened&&this._openedChanged(this.opened)},prepare:func tion(){if(this.opened&&!this.parentNode){Polymer.dom(document.body).appendChild( this)}},open:function(){this.opened=true},close:function(){this.opened=false},co mplete:function(){if(!this.opened&&this.parentNode===document.body){Polymer.dom( this.parentNode).removeChild(this)}},_onTransitionend:function(event){if(event&& event.target===this){this.complete()}},_openedChanged:function(opened){if(opened ){this.prepare()}else{var cs=window.getComputedStyle(this);if(cs.transitionDurat ion==="0s"||cs.opacity==0){this.complete()}}if(!this.isAttached){return}if(this. __openedRaf){window.cancelAnimationFrame(this.__openedRaf);this.__openedRaf=null }this.scrollTop=this.scrollTop;this.__openedRaf=window.requestAnimationFrame(fun ction(){this.__openedRaf=null;this.toggleClass("opened",this.opened)}.bind(this) )}})})();Polymer.IronOverlayManagerClass=function(){this._overlays=[];this._mini mumZ=101;this._backdropElement=null;Polymer.Gestures.add(document,"tap",this._on CaptureClick.bind(this));document.addEventListener("focus",this._onCaptureFocus. bind(this),true);document.addEventListener("keydown",this._onCaptureKeyDown.bind (this),true)};Polymer.IronOverlayManagerClass.prototype={constructor:Polymer.Iro nOverlayManagerClass,get backdropElement(){if(!this._backdropElement){this._back dropElement=document.createElement("iron-overlay-backdrop")}return this._backdro pElement},get deepActiveElement(){var active=document.activeElement||document.bo dy;while(active.root&&Polymer.dom(active.root).activeElement){active=Polymer.dom (active.root).activeElement}return active},_bringOverlayAtIndexToFront:function( i){var overlay=this._overlays[i];if(!overlay){return}var lastI=this._overlays.le ngth-1;var currentOverlay=this._overlays[lastI];if(currentOverlay&&this._shouldB eBehindOverlay(overlay,currentOverlay)){lastI--}if(i>=lastI){return}var minimumZ =Math.max(this.currentOverlayZ(),this._minimumZ);if(this._getZ(overlay)<=minimum Z){this._applyOverlayZ(overlay,minimumZ)}while(i<lastI){this._overlays[i]=this._ overlays[i+1];i++}this._overlays[lastI]=overlay},addOrRemoveOverlay:function(ove rlay){if(overlay.opened){this.addOverlay(overlay)}else{this.removeOverlay(overla y)}},addOverlay:function(overlay){var i=this._overlays.indexOf(overlay);if(i>=0) {this._bringOverlayAtIndexToFront(i);this.trackBackdrop();return}var insertionIn dex=this._overlays.length;var currentOverlay=this._overlays[insertionIndex-1];va r minimumZ=Math.max(this._getZ(currentOverlay),this._minimumZ);var newZ=this._ge tZ(overlay);if(currentOverlay&&this._shouldBeBehindOverlay(overlay,currentOverla y)){this._applyOverlayZ(currentOverlay,minimumZ);insertionIndex--;var previousOv erlay=this._overlays[insertionIndex-1];minimumZ=Math.max(this._getZ(previousOver lay),this._minimumZ)}if(newZ<=minimumZ){this._applyOverlayZ(overlay,minimumZ)}th is._overlays.splice(insertionIndex,0,overlay);this.trackBackdrop()},removeOverla y:function(overlay){var i=this._overlays.indexOf(overlay);if(i===-1){return}this ._overlays.splice(i,1);this.trackBackdrop()},currentOverlay:function(){var i=thi s._overlays.length-1;return this._overlays[i]},currentOverlayZ:function(){return this._getZ(this.currentOverlay())},ensureMinimumZ:function(minimumZ){this._mini mumZ=Math.max(this._minimumZ,minimumZ)},focusOverlay:function(){var current=this .currentOverlay();if(current){current._applyFocus()}},trackBackdrop:function(){v ar overlay=this._overlayWithBackdrop();if(!overlay&&!this._backdropElement){retu rn}this.backdropElement.style.zIndex=this._getZ(overlay)-1;this.backdropElement. opened=!!overlay},getBackdrops:function(){var backdrops=[];for(var i=0;i<this._o verlays.length;i++){if(this._overlays[i].withBackdrop){backdrops.push(this._over lays[i])}}return backdrops},backdropZ:function(){return this._getZ(this._overlay WithBackdrop())-1},_overlayWithBackdrop:function(){for(var i=0;i<this._overlays. length;i++){if(this._overlays[i].withBackdrop){return this._overlays[i]}}},_getZ :function(overlay){var z=this._minimumZ;if(overlay){var z1=Number(overlay.style. zIndex||window.getComputedStyle(overlay).zIndex);if(z1===z1){z=z1}}return z},_se tZ:function(element,z){element.style.zIndex=z},_applyOverlayZ:function(overlay,a boveZ){this._setZ(overlay,aboveZ+2)},_overlayInPath:function(path){path=path||[] ;for(var i=0;i<path.length;i++){if(path[i]._manager===this){return path[i]}}},_o nCaptureClick:function(event){var overlay=this.currentOverlay();if(overlay&&this ._overlayInPath(Polymer.dom(event).path)!==overlay){overlay._onCaptureClick(even t)}},_onCaptureFocus:function(event){var overlay=this.currentOverlay();if(overla y){overlay._onCaptureFocus(event)}},_onCaptureKeyDown:function(event){var overla y=this.currentOverlay();if(overlay){if(Polymer.IronA11yKeysBehavior.keyboardEven tMatchesKeys(event,"esc")){overlay._onCaptureEsc(event)}else if(Polymer.IronA11y KeysBehavior.keyboardEventMatchesKeys(event,"tab")){overlay._onCaptureTab(event) }}},_shouldBeBehindOverlay:function(overlay1,overlay2){return!overlay1.alwaysOnT op&&overlay2.alwaysOnTop}};Polymer.IronOverlayManager=new Polymer.IronOverlayMan agerClass;(function(){"use strict";var p=Element.prototype;var matches=p.matches ||p.matchesSelector||p.mozMatchesSelector||p.msMatchesSelector||p.oMatchesSelect or||p.webkitMatchesSelector;Polymer.IronFocusablesHelper={getTabbableNodes:funct ion(node){var result=[];var needsSortByTabIndex=this._collectTabbableNodes(node, result);if(needsSortByTabIndex){return this._sortByTabIndex(result)}return resul t},isFocusable:function(element){if(matches.call(element,"input, select, textare a, button, object")){return matches.call(element,":not([disabled])")}return matc hes.call(element,"a[href], area[href], iframe, [tabindex], [contentEditable]")}, isTabbable:function(element){return this.isFocusable(element)&&matches.call(elem ent,':not([tabindex="-1"])')&&this._isVisible(element)},_normalizedTabIndex:func tion(element){if(this.isFocusable(element)){var tabIndex=element.getAttribute("t abindex")||0;return Number(tabIndex)}return-1},_collectTabbableNodes:function(no de,result){if(node.nodeType!==Node.ELEMENT_NODE||!this._isVisible(node)){return false}var element=node;var tabIndex=this._normalizedTabIndex(element);var needsS ortByTabIndex=tabIndex>0;if(tabIndex>=0){result.push(element)}var children;if(el ement.localName==="content"){children=Polymer.dom(element).getDistributedNodes() }else{children=Polymer.dom(element.root||element).children}for(var i=0;i<childre n.length;i++){var needsSort=this._collectTabbableNodes(children[i],result);needs SortByTabIndex=needsSortByTabIndex||needsSort}return needsSortByTabIndex},_isVis ible:function(element){var style=element.style;if(style.visibility!=="hidden"&&s tyle.display!=="none"){style=window.getComputedStyle(element);return style.visib ility!=="hidden"&&style.display!=="none"}return false},_sortByTabIndex:function( tabbables){var len=tabbables.length;if(len<2){return tabbables}var pivot=Math.ce il(len/2);var left=this._sortByTabIndex(tabbables.slice(0,pivot));var right=this ._sortByTabIndex(tabbables.slice(pivot));return this._mergeSortByTabIndex(left,r ight)},_mergeSortByTabIndex:function(left,right){var result=[];while(left.length >0&&right.length>0){if(this._hasLowerTabOrder(left[0],right[0])){result.push(rig ht.shift())}else{result.push(left.shift())}}return result.concat(left,right)},_h asLowerTabOrder:function(a,b){var ati=Math.max(a.tabIndex,0);var bti=Math.max(b. tabIndex,0);return ati===0||bti===0?bti>ati:ati>bti}}})();(function(){"use stric t";Polymer.IronOverlayBehaviorImpl={properties:{opened:{observer:"_openedChanged ",type:Boolean,value:false,notify:true},canceled:{observer:"_canceledChanged",re adOnly:true,type:Boolean,value:false},withBackdrop:{observer:"_withBackdropChang ed",type:Boolean},noAutoFocus:{type:Boolean,value:false},noCancelOnEscKey:{type: Boolean,value:false},noCancelOnOutsideClick:{type:Boolean,value:false},closingRe ason:{type:Object},restoreFocusOnClose:{type:Boolean,value:false},alwaysOnTop:{t ype:Boolean},_manager:{type:Object,value:Polymer.IronOverlayManager},_focusedChi ld:{type:Object}},listeners:{"iron-resize":"_onIronResize"},get backdropElement( ){return this._manager.backdropElement},get _focusNode(){return this._focusedChi ld||Polymer.dom(this).querySelector("[autofocus]")||this},get _focusableNodes(){ return Polymer.IronFocusablesHelper.getTabbableNodes(this)},ready:function(){thi s.__isAnimating=false;this.__shouldRemoveTabIndex=false;this.__firstFocusableNod e=this.__lastFocusableNode=null;this.__raf=null;this.__restoreFocusNode=null;thi s._ensureSetup()},attached:function(){if(this.opened){this._openedChanged(this.o pened)}this._observer=Polymer.dom(this).observeNodes(this._onNodesChange)},detac hed:function(){Polymer.dom(this).unobserveNodes(this._observer);this._observer=n ull;if(this.__raf){window.cancelAnimationFrame(this.__raf);this.__raf=null}this. _manager.removeOverlay(this)},toggle:function(){this._setCanceled(false);this.op ened=!this.opened},open:function(){this._setCanceled(false);this.opened=true},cl ose:function(){this._setCanceled(false);this.opened=false},cancel:function(event ){var cancelEvent=this.fire("iron-overlay-canceled",event,{cancelable:true});if( cancelEvent.defaultPrevented){return}this._setCanceled(true);this.opened=false}, invalidateTabbables:function(){this.__firstFocusableNode=this.__lastFocusableNod e=null},_ensureSetup:function(){if(this._overlaySetup){return}this._overlaySetup =true;this.style.outline="none";this.style.display="none"},_openedChanged:functi on(opened){if(opened){this.removeAttribute("aria-hidden")}else{this.setAttribute ("aria-hidden","true")}if(!this.isAttached){return}this.__isAnimating=true;this. __onNextAnimationFrame(this.__openedChanged)},_canceledChanged:function(){this.c losingReason=this.closingReason||{};this.closingReason.canceled=this.canceled},_ withBackdropChanged:function(){if(this.withBackdrop&&!this.hasAttribute("tabinde x")){this.setAttribute("tabindex","-1");this.__shouldRemoveTabIndex=true}else if (this.__shouldRemoveTabIndex){this.removeAttribute("tabindex");this.__shouldRemo veTabIndex=false}if(this.opened&&this.isAttached){this._manager.trackBackdrop()} },_prepareRenderOpened:function(){this.__restoreFocusNode=this._manager.deepActi veElement;this._preparePositioning();this.refit();this._finishPositioning();if(t his.noAutoFocus&&document.activeElement===this._focusNode){this._focusNode.blur( );this.__restoreFocusNode.focus()}},_renderOpened:function(){this._finishRenderO pened()},_renderClosed:function(){this._finishRenderClosed()},_finishRenderOpene d:function(){this.notifyResize();this.__isAnimating=false;this.fire("iron-overla y-opened")},_finishRenderClosed:function(){this.style.display="none";this.style. zIndex="";this.notifyResize();this.__isAnimating=false;this.fire("iron-overlay-c losed",this.closingReason)},_preparePositioning:function(){this.style.transition =this.style.webkitTransition="none";this.style.transform=this.style.webkitTransf orm="none";this.style.display=""},_finishPositioning:function(){this.style.displ ay="none";this.scrollTop=this.scrollTop;this.style.transition=this.style.webkitT ransition="";this.style.transform=this.style.webkitTransform="";this.style.displ ay="";this.scrollTop=this.scrollTop},_applyFocus:function(){if(this.opened){if(! this.noAutoFocus){this._focusNode.focus()}}else{this._focusNode.blur();this._foc usedChild=null;if(this.restoreFocusOnClose&&this.__restoreFocusNode){this.__rest oreFocusNode.focus()}this.__restoreFocusNode=null;var currentOverlay=this._manag er.currentOverlay();if(currentOverlay&&this!==currentOverlay){currentOverlay._ap plyFocus()}}},_onCaptureClick:function(event){if(!this.noCancelOnOutsideClick){t his.cancel(event)}},_onCaptureFocus:function(event){if(!this.withBackdrop){retur n}var path=Polymer.dom(event).path;if(path.indexOf(this)===-1){event.stopPropaga tion();this._applyFocus()}else{this._focusedChild=path[0]}},_onCaptureEsc:functi on(event){if(!this.noCancelOnEscKey){this.cancel(event)}},_onCaptureTab:function (event){if(!this.withBackdrop){return}this.__ensureFirstLastFocusables();var shi ft=event.shiftKey;var nodeToCheck=shift?this.__firstFocusableNode:this.__lastFoc usableNode;var nodeToSet=shift?this.__lastFocusableNode:this.__firstFocusableNod e;var shouldWrap=false;if(nodeToCheck===nodeToSet){shouldWrap=true}else{var focu sedNode=this._manager.deepActiveElement;shouldWrap=focusedNode===nodeToCheck||fo cusedNode===this}if(shouldWrap){event.preventDefault();this._focusedChild=nodeTo Set;this._applyFocus()}},_onIronResize:function(){if(this.opened&&!this.__isAnim ating){this.__onNextAnimationFrame(this.refit)}},_onNodesChange:function(){if(th is.opened&&!this.__isAnimating){this.invalidateTabbables();this.notifyResize()}} ,__ensureFirstLastFocusables:function(){if(!this.__firstFocusableNode||!this.__l astFocusableNode){var focusableNodes=this._focusableNodes;this.__firstFocusableN ode=focusableNodes[0];this.__lastFocusableNode=focusableNodes[focusableNodes.len gth-1]}},__openedChanged:function(){if(this.opened){this._prepareRenderOpened(); this._manager.addOverlay(this);this._applyFocus();this._renderOpened()}else{this ._manager.removeOverlay(this);this._applyFocus();this._renderClosed()}},__onNext AnimationFrame:function(callback){if(this.__raf){window.cancelAnimationFrame(thi s.__raf)}var self=this;this.__raf=window.requestAnimationFrame(function nextAnim ationFrame(){self.__raf=null;callback.call(self)})}};Polymer.IronOverlayBehavior =[Polymer.IronFitBehavior,Polymer.IronResizableBehavior,Polymer.IronOverlayBehav iorImpl]})();Polymer.NeonAnimatableBehavior={properties:{animationConfig:{type:O bject},entryAnimation:{observer:"_entryAnimationChanged",type:String},exitAnimat ion:{observer:"_exitAnimationChanged",type:String}},_entryAnimationChanged:funct ion(){this.animationConfig=this.animationConfig||{};this.animationConfig["entry" ]=[{name:this.entryAnimation,node:this}]},_exitAnimationChanged:function(){this. animationConfig=this.animationConfig||{};this.animationConfig["exit"]=[{name:thi s.exitAnimation,node:this}]},_copyProperties:function(config1,config2){for(var p roperty in config2){config1[property]=config2[property]}},_cloneConfig:function( config){var clone={isClone:true};this._copyProperties(clone,config);return clone },_getAnimationConfigRecursive:function(type,map,allConfigs){if(!this.animationC onfig){return}if(this.animationConfig.value&&typeof this.animationConfig.value== ="function"){this._warn(this._logf("playAnimation","Please put 'animationConfig' inside of your components 'properties' object instead of outside of it."));retu rn}var thisConfig;if(type){thisConfig=this.animationConfig[type]}else{thisConfig =this.animationConfig}if(!Array.isArray(thisConfig)){thisConfig=[thisConfig]}if( thisConfig){for(var config,index=0;config=thisConfig[index];index++){if(config.a nimatable){config.animatable._getAnimationConfigRecursive(config.type||type,map, allConfigs)}else{if(config.id){var cachedConfig=map[config.id];if(cachedConfig){ if(!cachedConfig.isClone){map[config.id]=this._cloneConfig(cachedConfig);cachedC onfig=map[config.id]}this._copyProperties(cachedConfig,config)}else{map[config.i d]=config}}else{allConfigs.push(config)}}}}},getAnimationConfig:function(type){v ar map={};var allConfigs=[];this._getAnimationConfigRecursive(type,map,allConfig s);for(var key in map){allConfigs.push(map[key])}return allConfigs}};Polymer.Neo nAnimationRunnerBehaviorImpl={_configureAnimations:function(configs){var results =[];if(configs.length>0){for(var config,index=0;config=configs[index];index++){v ar neonAnimation=document.createElement(config.name);if(neonAnimation.isNeonAnim ation){var result=null;try{result=neonAnimation.configure(config);if(typeof resu lt.cancel!="function"){result=document.timeline.play(result)}}catch(e){result=nu ll;console.warn("Couldnt play","(",config.name,").",e)}if(result){results.push({ neonAnimation:neonAnimation,config:config,animation:result})}}else{console.warn( this.is+":",config.name,"not found!")}}}return results},_shouldComplete:function (activeEntries){var finished=true;for(var i=0;i<activeEntries.length;i++){if(act iveEntries[i].animation.playState!="finished"){finished=false;break}}return fini shed},_complete:function(activeEntries){for(var i=0;i<activeEntries.length;i++){ activeEntries[i].neonAnimation.complete(activeEntries[i].config)}for(var i=0;i<a ctiveEntries.length;i++){activeEntries[i].animation.cancel()}},playAnimation:fun ction(type,cookie){var configs=this.getAnimationConfig(type);if(!configs){return }this._active=this._active||{};if(this._active[type]){this._complete(this._activ e[type]);delete this._active[type]}var activeEntries=this._configureAnimations(c onfigs);if(activeEntries.length==0){this.fire("neon-animation-finish",cookie,{bu bbles:false});return}this._active[type]=activeEntries;for(var i=0;i<activeEntrie s.length;i++){activeEntries[i].animation.onfinish=function(){if(this._shouldComp lete(activeEntries)){this._complete(activeEntries);delete this._active[type];thi s.fire("neon-animation-finish",cookie,{bubbles:false})}}.bind(this)}},cancelAnim ation:function(){for(var k in this._animations){this._animations[k].cancel()}thi s._animations={}}};Polymer.NeonAnimationRunnerBehavior=[Polymer.NeonAnimatableBe havior,Polymer.NeonAnimationRunnerBehaviorImpl];Polymer.NeonAnimationBehavior={p roperties:{animationTiming:{type:Object,value:function(){return{duration:500,eas ing:"cubic-bezier(0.4, 0, 0.2, 1)",fill:"both"}}}},isNeonAnimation:true,timingFr omConfig:function(config){if(config.timing){for(var property in config.timing){t his.animationTiming[property]=config.timing[property]}}return this.animationTimi ng},setPrefixedProperty:function(node,property,value){var map={transform:["webki tTransform"],transformOrigin:["mozTransformOrigin","webkitTransformOrigin"]};var prefixes=map[property];for(var prefix,index=0;prefix=prefixes[index];index++){n ode.style[prefix]=value}node.style[property]=value},complete:function(){}};Polym er({is:"opaque-animation",behaviors:[Polymer.NeonAnimationBehavior],configure:fu nction(config){var node=config.node;this._effect=new KeyframeEffect(node,[{opaci ty:"1"},{opacity:"1"}],this.timingFromConfig(config));node.style.opacity="0";ret urn this._effect},complete:function(config){config.node.style.opacity=""}});(fun ction(){"use strict";var LAST_TOUCH_POSITION={pageX:0,pageY:0};var ROOT_TARGET=n ull;var SCROLLABLE_NODES=[];Polymer.IronDropdownScrollManager={get currentLockin gElement(){return this._lockingElements[this._lockingElements.length-1]},element IsScrollLocked:function(element){var currentLockingElement=this.currentLockingEl ement;if(currentLockingElement===undefined)return false;var scrollLocked;if(this ._hasCachedLockedElement(element)){return true}if(this._hasCachedUnlockedElement (element)){return false}scrollLocked=!!currentLockingElement&&currentLockingElem ent!==element&&!this._composedTreeContains(currentLockingElement,element);if(scr ollLocked){this._lockedElementCache.push(element)}else{this._unlockedElementCach e.push(element)}return scrollLocked},pushScrollLock:function(element){if(this._l ockingElements.indexOf(element)>=0){return}if(this._lockingElements.length===0){ this._lockScrollInteractions()}this._lockingElements.push(element);this._lockedE lementCache=[];this._unlockedElementCache=[]},removeScrollLock:function(element) {var index=this._lockingElements.indexOf(element);if(index===-1){return}this._lo ckingElements.splice(index,1);this._lockedElementCache=[];this._unlockedElementC ache=[];if(this._lockingElements.length===0){this._unlockScrollInteractions()}}, _lockingElements:[],_lockedElementCache:null,_unlockedElementCache:null,_hasCach edLockedElement:function(element){return this._lockedElementCache.indexOf(elemen t)>-1},_hasCachedUnlockedElement:function(element){return this._unlockedElementC ache.indexOf(element)>-1},_composedTreeContains:function(element,child){var cont entElements;var distributedNodes;var contentIndex;var nodeIndex;if(element.conta ins(child)){return true}contentElements=Polymer.dom(element).querySelectorAll("c ontent");for(contentIndex=0;contentIndex<contentElements.length;++contentIndex){ distributedNodes=Polymer.dom(contentElements[contentIndex]).getDistributedNodes( );for(nodeIndex=0;nodeIndex<distributedNodes.length;++nodeIndex){if(this._compos edTreeContains(distributedNodes[nodeIndex],child)){return true}}}return false},_ scrollInteractionHandler:function(event){if(event.cancelable&&this._shouldPreven tScrolling(event)){event.preventDefault()}if(event.targetTouches){var touch=even t.targetTouches[0];LAST_TOUCH_POSITION.pageX=touch.pageX;LAST_TOUCH_POSITION.pag eY=touch.pageY}},_lockScrollInteractions:function(){this._boundScrollHandler=thi s._boundScrollHandler||this._scrollInteractionHandler.bind(this);document.addEve ntListener("wheel",this._boundScrollHandler,true);document.addEventListener("mou sewheel",this._boundScrollHandler,true);document.addEventListener("DOMMouseScrol l",this._boundScrollHandler,true);document.addEventListener("touchstart",this._b oundScrollHandler,true);document.addEventListener("touchmove",this._boundScrollH andler,true)},_unlockScrollInteractions:function(){document.removeEventListener( "wheel",this._boundScrollHandler,true);document.removeEventListener("mousewheel" ,this._boundScrollHandler,true);document.removeEventListener("DOMMouseScroll",th is._boundScrollHandler,true);document.removeEventListener("touchstart",this._bou ndScrollHandler,true);document.removeEventListener("touchmove",this._boundScroll Handler,true)},_shouldPreventScrolling:function(event){var target=Polymer.dom(ev ent).rootTarget;if(event.type!=="touchmove"&&ROOT_TARGET!==target){ROOT_TARGET=t arget;SCROLLABLE_NODES=this._getScrollableNodes(Polymer.dom(event).path)}if(!SCR OLLABLE_NODES.length){return true}if(event.type==="touchstart"){return false}var info=this._getScrollInfo(event);return!this._getScrollingNode(SCROLLABLE_NODES, info.deltaX,info.deltaY)},_getScrollableNodes:function(nodes){var scrollables=[] ;var lockingIndex=nodes.indexOf(this.currentLockingElement);for(var i=0;i<=locki ngIndex;i++){var node=nodes[i];if(node.nodeType===11){continue}var style=node.st yle;if(style.overflow!=="scroll"&&style.overflow!=="auto"){style=window.getCompu tedStyle(node);
30 30
31 }if(style.overflow==="scroll"||style.overflow==="auto"){scrollables.push(node)}} return scrollables},_getScrollingNode:function(nodes,deltaX,deltaY){if(!deltaX&& !deltaY){return}var verticalScroll=Math.abs(deltaY)>=Math.abs(deltaX);for(var i= 0;i<nodes.length;i++){var node=nodes[i];var canScroll=false;if(verticalScroll){c anScroll=deltaY<0?node.scrollTop>0:node.scrollTop<node.scrollHeight-node.clientH eight}else{canScroll=deltaX<0?node.scrollLeft>0:node.scrollLeft<node.scrollWidth -node.clientWidth}if(canScroll){return node}}},_getScrollInfo:function(event){va r info={deltaX:event.deltaX,deltaY:event.deltaY};if("deltaX"in event){}else if(" wheelDeltaX"in event){info.deltaX=-event.wheelDeltaX;info.deltaY=-event.wheelDel taY}else if("axis"in event){info.deltaX=event.axis===1?event.detail:0;info.delta Y=event.axis===2?event.detail:0}else if(event.targetTouches){var touch=event.tar getTouches[0];info.deltaX=LAST_TOUCH_POSITION.pageX-touch.pageX;info.deltaY=LAST _TOUCH_POSITION.pageY-touch.pageY}return info}}})();(function(){"use strict";Pol ymer({is:"iron-dropdown",behaviors:[Polymer.IronControlState,Polymer.IronA11yKey sBehavior,Polymer.IronOverlayBehavior,Polymer.NeonAnimationRunnerBehavior],prope rties:{horizontalAlign:{type:String,value:"left",reflectToAttribute:true},vertic alAlign:{type:String,value:"top",reflectToAttribute:true},openAnimationConfig:{t ype:Object},closeAnimationConfig:{type:Object},focusTarget:{type:Object},noAnima tions:{type:Boolean,value:false},allowOutsideScroll:{type:Boolean,value:false},_ boundOnCaptureScroll:{type:Function,value:function(){return this._onCaptureScrol l.bind(this)}}},listeners:{"neon-animation-finish":"_onNeonAnimationFinish"},obs ervers:["_updateOverlayPosition(positionTarget, verticalAlign, horizontalAlign, verticalOffset, horizontalOffset)"],get containedElement(){return Polymer.dom(th is.$.content).getDistributedNodes()[0]},get _focusTarget(){return this.focusTarg et||this.containedElement},ready:function(){this._scrollTop=0;this._scrollLeft=0 ;this._refitOnScrollRAF=null},attached:function(){if(!this.sizingTarget||this.si zingTarget===this){this.sizingTarget=this.containedElement}},detached:function() {this.cancelAnimation();document.removeEventListener("scroll",this._boundOnCaptu reScroll);Polymer.IronDropdownScrollManager.removeScrollLock(this)},_openedChang ed:function(){if(this.opened&&this.disabled){this.cancel()}else{this.cancelAnima tion();this._updateAnimationConfig();this._saveScrollPosition();if(this.opened){ document.addEventListener("scroll",this._boundOnCaptureScroll);!this.allowOutsid eScroll&&Polymer.IronDropdownScrollManager.pushScrollLock(this)}else{document.re moveEventListener("scroll",this._boundOnCaptureScroll);Polymer.IronDropdownScrol lManager.removeScrollLock(this)}Polymer.IronOverlayBehaviorImpl._openedChanged.a pply(this,arguments)}},_renderOpened:function(){if(!this.noAnimations&&this.anim ationConfig.open){this.$.contentWrapper.classList.add("animating");this.playAnim ation("open")}else{Polymer.IronOverlayBehaviorImpl._renderOpened.apply(this,argu ments)}},_renderClosed:function(){if(!this.noAnimations&&this.animationConfig.cl ose){this.$.contentWrapper.classList.add("animating");this.playAnimation("close" )}else{Polymer.IronOverlayBehaviorImpl._renderClosed.apply(this,arguments)}},_on NeonAnimationFinish:function(){this.$.contentWrapper.classList.remove("animating ");if(this.opened){this._finishRenderOpened()}else{this._finishRenderClosed()}}, _onCaptureScroll:function(){if(!this.allowOutsideScroll){this._restoreScrollPosi tion()}else{this._refitOnScrollRAF&&window.cancelAnimationFrame(this._refitOnScr ollRAF);this._refitOnScrollRAF=window.requestAnimationFrame(this.refit.bind(this ))}},_saveScrollPosition:function(){if(document.scrollingElement){this._scrollTo p=document.scrollingElement.scrollTop;this._scrollLeft=document.scrollingElement .scrollLeft}else{this._scrollTop=Math.max(document.documentElement.scrollTop,doc ument.body.scrollTop);this._scrollLeft=Math.max(document.documentElement.scrollL eft,document.body.scrollLeft)}},_restoreScrollPosition:function(){if(document.sc rollingElement){document.scrollingElement.scrollTop=this._scrollTop;document.scr ollingElement.scrollLeft=this._scrollLeft}else{document.documentElement.scrollTo p=this._scrollTop;document.documentElement.scrollLeft=this._scrollLeft;document. body.scrollTop=this._scrollTop;document.body.scrollLeft=this._scrollLeft}},_upda teAnimationConfig:function(){var animations=(this.openAnimationConfig||[]).conca t(this.closeAnimationConfig||[]);for(var i=0;i<animations.length;i++){animations [i].node=this.containedElement}this.animationConfig={open:this.openAnimationConf ig,close:this.closeAnimationConfig}},_updateOverlayPosition:function(){if(this.i sAttached){this.notifyResize()}},_applyFocus:function(){var focusTarget=this.foc usTarget||this.containedElement;if(focusTarget&&this.opened&&!this.noAutoFocus){ focusTarget.focus()}else{Polymer.IronOverlayBehaviorImpl._applyFocus.apply(this, arguments)}}})})();Polymer({is:"paper-tab",behaviors:[Polymer.IronControlState,P olymer.IronButtonState,Polymer.PaperRippleBehavior],properties:{link:{type:Boole an,value:false,reflectToAttribute:true}},hostAttributes:{role:"tab"},listeners:{ down:"_updateNoink",tap:"_onTap"},attached:function(){this._updateNoink()},get _ parentNoink(){var parent=Polymer.dom(this).parentNode;return!!parent&&!!parent.n oink},_updateNoink:function(){this.noink=!!this.noink||!!this._parentNoink},_onT ap:function(event){if(this.link){var anchor=this.queryEffectiveChildren("a");if( !anchor){return}if(event.target===anchor){return}anchor.click()}}});Polymer.Iron MenuBehaviorImpl={properties:{focusedItem:{observer:"_focusedItemChanged",readOn ly:true,type:Object},attrForItemTitle:{type:String}},hostAttributes:{role:"menu" ,tabindex:"0"},observers:["_updateMultiselectable(multi)"],listeners:{focus:"_on Focus",keydown:"_onKeydown","iron-items-changed":"_onIronItemsChanged"},keyBindi ngs:{up:"_onUpKey",down:"_onDownKey",esc:"_onEscKey","shift+tab:keydown":"_onShi ftTabDown"},attached:function(){this._resetTabindices()},select:function(value){ if(this._defaultFocusAsync){this.cancelAsync(this._defaultFocusAsync);this._defa ultFocusAsync=null}var item=this._valueToItem(value);if(item&&item.hasAttribute( "disabled"))return;this._setFocusedItem(item);Polymer.IronMultiSelectableBehavio rImpl.select.apply(this,arguments)},_resetTabindices:function(){var selectedItem =this.multi?this.selectedItems&&this.selectedItems[0]:this.selectedItem;this.ite ms.forEach(function(item){item.setAttribute("tabindex",item===selectedItem?"0":" -1")},this)},_updateMultiselectable:function(multi){if(multi){this.setAttribute( "aria-multiselectable","true")}else{this.removeAttribute("aria-multiselectable") }},_focusWithKeyboardEvent:function(event){for(var i=0,item;item=this.items[i];i ++){var attr=this.attrForItemTitle||"textContent";var title=item[attr]||item.get Attribute(attr);if(!item.hasAttribute("disabled")&&title&&title.trim().charAt(0) .toLowerCase()===String.fromCharCode(event.keyCode).toLowerCase()){this._setFocu sedItem(item);break}}},_focusPrevious:function(){var length=this.items.length;va r curFocusIndex=Number(this.indexOf(this.focusedItem));for(var i=1;i<length+1;i+ +){var item=this.items[(curFocusIndex-i+length)%length];if(!item.hasAttribute("d isabled")){var owner=Polymer.dom(item).getOwnerRoot()||document;this._setFocused Item(item);if(Polymer.dom(owner).activeElement==item){return}}}},_focusNext:func tion(){var length=this.items.length;var curFocusIndex=Number(this.indexOf(this.f ocusedItem));for(var i=1;i<length+1;i++){var item=this.items[(curFocusIndex+i)%l ength];if(!item.hasAttribute("disabled")){var owner=Polymer.dom(item).getOwnerRo ot()||document;this._setFocusedItem(item);if(Polymer.dom(owner).activeElement==i tem){return}}}},_applySelection:function(item,isSelected){if(isSelected){item.se tAttribute("aria-selected","true")}else{item.removeAttribute("aria-selected")}Po lymer.IronSelectableBehavior._applySelection.apply(this,arguments)},_focusedItem Changed:function(focusedItem,old){old&&old.setAttribute("tabindex","-1");if(focu sedItem){focusedItem.setAttribute("tabindex","0");focusedItem.focus()}},_onIronI temsChanged:function(event){if(event.detail.addedNodes.length){this._resetTabind ices()}},_onShiftTabDown:function(event){var oldTabIndex=this.getAttribute("tabi ndex");Polymer.IronMenuBehaviorImpl._shiftTabPressed=true;this._setFocusedItem(n ull);this.setAttribute("tabindex","-1");this.async(function(){this.setAttribute( "tabindex",oldTabIndex);Polymer.IronMenuBehaviorImpl._shiftTabPressed=false},1)} ,_onFocus:function(event){if(Polymer.IronMenuBehaviorImpl._shiftTabPressed){retu rn}var rootTarget=Polymer.dom(event).rootTarget;if(rootTarget!==this&&typeof roo tTarget.tabIndex!=="undefined"&&!this.isLightDescendant(rootTarget)){return}this ._defaultFocusAsync=this.async(function(){var selectedItem=this.multi?this.selec tedItems&&this.selectedItems[0]:this.selectedItem;this._setFocusedItem(null);if( selectedItem){this._setFocusedItem(selectedItem)}else if(this.items[0]){this._fo cusNext()}})},_onUpKey:function(event){this._focusPrevious();event.detail.keyboa rdEvent.preventDefault()},_onDownKey:function(event){this._focusNext();event.det ail.keyboardEvent.preventDefault()},_onEscKey:function(event){this.focusedItem.b lur()},_onKeydown:function(event){if(!this.keyboardEventMatchesKeys(event,"up do wn esc")){this._focusWithKeyboardEvent(event)}event.stopPropagation()},_activate Handler:function(event){Polymer.IronSelectableBehavior._activateHandler.call(thi s,event);event.stopPropagation()}};Polymer.IronMenuBehaviorImpl._shiftTabPressed =false;Polymer.IronMenuBehavior=[Polymer.IronMultiSelectableBehavior,Polymer.Iro nA11yKeysBehavior,Polymer.IronMenuBehaviorImpl];Polymer.IronMenubarBehaviorImpl= {hostAttributes:{role:"menubar"},keyBindings:{left:"_onLeftKey",right:"_onRightK ey"},_onUpKey:function(event){this.focusedItem.click();event.detail.keyboardEven t.preventDefault()},_onDownKey:function(event){this.focusedItem.click();event.de tail.keyboardEvent.preventDefault()},get _isRTL(){return window.getComputedStyle (this)["direction"]==="rtl"},_onLeftKey:function(event){if(this._isRTL){this._fo cusNext()}else{this._focusPrevious()}event.detail.keyboardEvent.preventDefault() },_onRightKey:function(event){if(this._isRTL){this._focusPrevious()}else{this._f ocusNext()}event.detail.keyboardEvent.preventDefault()},_onKeydown:function(even t){if(this.keyboardEventMatchesKeys(event,"up down left right esc")){return}this ._focusWithKeyboardEvent(event)}};Polymer.IronMenubarBehavior=[Polymer.IronMenuB ehavior,Polymer.IronMenubarBehaviorImpl];Polymer({is:"paper-tabs",behaviors:[Pol ymer.IronResizableBehavior,Polymer.IronMenubarBehavior],properties:{noink:{type: Boolean,value:false,observer:"_noinkChanged"},noBar:{type:Boolean,value:false},n oSlide:{type:Boolean,value:false},scrollable:{type:Boolean,value:false},fitConta iner:{type:Boolean,value:false},disableDrag:{type:Boolean,value:false},hideScrol lButtons:{type:Boolean,value:false},alignBottom:{type:Boolean,value:false},selec table:{type:String,value:"paper-tab"},autoselect:{type:Boolean,value:false},auto selectDelay:{type:Number,value:0},_step:{type:Number,value:10},_holdDelay:{type: Number,value:1},_leftHidden:{type:Boolean,value:false},_rightHidden:{type:Boolea n,value:false},_previousTab:{type:Object}},hostAttributes:{role:"tablist"},liste ners:{"iron-resize":"_onTabSizingChanged","iron-items-changed":"_onTabSizingChan ged","iron-select":"_onIronSelect","iron-deselect":"_onIronDeselect"},keyBinding s:{"left:keyup right:keyup":"_onArrowKeyup"},created:function(){this._holdJob=nu ll;this._pendingActivationItem=undefined;this._pendingActivationTimeout=undefine d;this._bindDelayedActivationHandler=this._delayedActivationHandler.bind(this);t his.addEventListener("blur",this._onBlurCapture.bind(this),true)},ready:function (){this.setScrollDirection("y",this.$.tabsContainer)},detached:function(){this._ cancelPendingActivation()},_noinkChanged:function(noink){var childTabs=Polymer.d om(this).querySelectorAll("paper-tab");childTabs.forEach(noink?this._setNoinkAtt ribute:this._removeNoinkAttribute)},_setNoinkAttribute:function(element){element .setAttribute("noink","")},_removeNoinkAttribute:function(element){element.remov eAttribute("noink")},_computeScrollButtonClass:function(hideThisButton,scrollabl e,hideScrollButtons){if(!scrollable||hideScrollButtons){return"hidden"}if(hideTh isButton){return"not-visible"}return""},_computeTabsContentClass:function(scroll able,fitContainer){return scrollable?"scrollable"+(fitContainer?" fit-container" :""):" fit-container"},_computeSelectionBarClass:function(noBar,alignBottom){if( noBar){return"hidden"}else if(alignBottom){return"align-bottom"}return""},_onTab SizingChanged:function(){this.debounce("_onTabSizingChanged",function(){this._sc roll();this._tabChanged(this.selectedItem)},10)},_onIronSelect:function(event){t his._tabChanged(event.detail.item,this._previousTab);this._previousTab=event.det ail.item;this.cancelDebouncer("tab-changed")},_onIronDeselect:function(event){th is.debounce("tab-changed",function(){this._tabChanged(null,this._previousTab);th is._previousTab=null},1)},_activateHandler:function(){this._cancelPendingActivat ion();Polymer.IronMenuBehaviorImpl._activateHandler.apply(this,arguments)},_sche duleActivation:function(item,delay){this._pendingActivationItem=item;this._pendi ngActivationTimeout=this.async(this._bindDelayedActivationHandler,delay)},_delay edActivationHandler:function(){var item=this._pendingActivationItem;this._pendin gActivationItem=undefined;this._pendingActivationTimeout=undefined;item.fire(thi s.activateEvent,null,{bubbles:true,cancelable:true})},_cancelPendingActivation:f unction(){if(this._pendingActivationTimeout!==undefined){this.cancelAsync(this._ pendingActivationTimeout);this._pendingActivationItem=undefined;this._pendingAct ivationTimeout=undefined}},_onArrowKeyup:function(event){if(this.autoselect){thi s._scheduleActivation(this.focusedItem,this.autoselectDelay)}},_onBlurCapture:fu nction(event){if(event.target===this._pendingActivationItem){this._cancelPending Activation()}},get _tabContainerScrollSize(){return Math.max(0,this.$.tabsContai ner.scrollWidth-this.$.tabsContainer.offsetWidth)},_scroll:function(e,detail){if (!this.scrollable){return}var ddx=detail&&-detail.ddx||0;this._affectScroll(ddx) },_down:function(e){this.async(function(){if(this._defaultFocusAsync){this.cance lAsync(this._defaultFocusAsync);this._defaultFocusAsync=null}},1)},_affectScroll :function(dx){this.$.tabsContainer.scrollLeft+=dx;var scrollLeft=this.$.tabsCont ainer.scrollLeft;this._leftHidden=scrollLeft===0;this._rightHidden=scrollLeft=== this._tabContainerScrollSize},_onLeftScrollButtonDown:function(){this._scrollToL eft();this._holdJob=setInterval(this._scrollToLeft.bind(this),this._holdDelay)}, _onRightScrollButtonDown:function(){this._scrollToRight();this._holdJob=setInter val(this._scrollToRight.bind(this),this._holdDelay)},_onScrollButtonUp:function( ){clearInterval(this._holdJob);this._holdJob=null},_scrollToLeft:function(){this ._affectScroll(-this._step)},_scrollToRight:function(){this._affectScroll(this._ step)},_tabChanged:function(tab,old){if(!tab){this.$.selectionBar.classList.remo ve("expand");this.$.selectionBar.classList.remove("contract");this._positionBar( 0,0);return}var r=this.$.tabsContent.getBoundingClientRect();var w=r.width;var t abRect=tab.getBoundingClientRect();var tabOffsetLeft=tabRect.left-r.left;this._p os={width:this._calcPercent(tabRect.width,w),left:this._calcPercent(tabOffsetLef t,w)};if(this.noSlide||old==null){this.$.selectionBar.classList.remove("expand") ;this.$.selectionBar.classList.remove("contract");this._positionBar(this._pos.wi dth,this._pos.left);return}var oldRect=old.getBoundingClientRect();var oldIndex= this.items.indexOf(old);var index=this.items.indexOf(tab);var m=5;this.$.selecti onBar.classList.add("expand");var moveRight=oldIndex<index;var isRTL=this._isRTL ;if(isRTL){moveRight=!moveRight}if(moveRight){this._positionBar(this._calcPercen t(tabRect.left+tabRect.width-oldRect.left,w)-m,this._left)}else{this._positionBa r(this._calcPercent(oldRect.left+oldRect.width-tabRect.left,w)-m,this._calcPerce nt(tabOffsetLeft,w)+m)}if(this.scrollable){this._scrollToSelectedIfNeeded(tabRec t.width,tabOffsetLeft)}},_scrollToSelectedIfNeeded:function(tabWidth,tabOffsetLe ft){var l=tabOffsetLeft-this.$.tabsContainer.scrollLeft;if(l<0){this.$.tabsConta iner.scrollLeft+=l}else{l+=tabWidth-this.$.tabsContainer.offsetWidth;if(l>0){thi s.$.tabsContainer.scrollLeft+=l}}},_calcPercent:function(w,w0){return 100*w/w0}, _positionBar:function(width,left){width=width||0;left=left||0;this._width=width; this._left=left;this.transform("translateX("+left+"%) scaleX("+width/100+")",thi s.$.selectionBar)},_onBarTransitionEnd:function(e){var cl=this.$.selectionBar.cl assList;if(cl.contains("expand")){cl.remove("expand");cl.add("contract");this._p ositionBar(this._pos.width,this._pos.left)}else if(cl.contains("contract")){cl.r emove("contract")}}}); 31 }if(style.overflow==="scroll"||style.overflow==="auto"){scrollables.push(node)}} return scrollables},_getScrollingNode:function(nodes,deltaX,deltaY){if(!deltaX&& !deltaY){return}var verticalScroll=Math.abs(deltaY)>=Math.abs(deltaX);for(var i= 0;i<nodes.length;i++){var node=nodes[i];var canScroll=false;if(verticalScroll){c anScroll=deltaY<0?node.scrollTop>0:node.scrollTop<node.scrollHeight-node.clientH eight}else{canScroll=deltaX<0?node.scrollLeft>0:node.scrollLeft<node.scrollWidth -node.clientWidth}if(canScroll){return node}}},_getScrollInfo:function(event){va r info={deltaX:event.deltaX,deltaY:event.deltaY};if("deltaX"in event){}else if(" wheelDeltaX"in event){info.deltaX=-event.wheelDeltaX;info.deltaY=-event.wheelDel taY}else if("axis"in event){info.deltaX=event.axis===1?event.detail:0;info.delta Y=event.axis===2?event.detail:0}else if(event.targetTouches){var touch=event.tar getTouches[0];info.deltaX=LAST_TOUCH_POSITION.pageX-touch.pageX;info.deltaY=LAST _TOUCH_POSITION.pageY-touch.pageY}return info}}})();(function(){"use strict";Pol ymer({is:"iron-dropdown",behaviors:[Polymer.IronControlState,Polymer.IronA11yKey sBehavior,Polymer.IronOverlayBehavior,Polymer.NeonAnimationRunnerBehavior],prope rties:{horizontalAlign:{type:String,value:"left",reflectToAttribute:true},vertic alAlign:{type:String,value:"top",reflectToAttribute:true},openAnimationConfig:{t ype:Object},closeAnimationConfig:{type:Object},focusTarget:{type:Object},noAnima tions:{type:Boolean,value:false},allowOutsideScroll:{type:Boolean,value:false},_ boundOnCaptureScroll:{type:Function,value:function(){return this._onCaptureScrol l.bind(this)}}},listeners:{"neon-animation-finish":"_onNeonAnimationFinish"},obs ervers:["_updateOverlayPosition(positionTarget, verticalAlign, horizontalAlign, verticalOffset, horizontalOffset)"],get containedElement(){return Polymer.dom(th is.$.content).getDistributedNodes()[0]},get _focusTarget(){return this.focusTarg et||this.containedElement},ready:function(){this._scrollTop=0;this._scrollLeft=0 ;this._refitOnScrollRAF=null},attached:function(){if(!this.sizingTarget||this.si zingTarget===this){this.sizingTarget=this.containedElement}},detached:function() {this.cancelAnimation();document.removeEventListener("scroll",this._boundOnCaptu reScroll);Polymer.IronDropdownScrollManager.removeScrollLock(this)},_openedChang ed:function(){if(this.opened&&this.disabled){this.cancel()}else{this.cancelAnima tion();this._updateAnimationConfig();this._saveScrollPosition();if(this.opened){ document.addEventListener("scroll",this._boundOnCaptureScroll);!this.allowOutsid eScroll&&Polymer.IronDropdownScrollManager.pushScrollLock(this)}else{document.re moveEventListener("scroll",this._boundOnCaptureScroll);Polymer.IronDropdownScrol lManager.removeScrollLock(this)}Polymer.IronOverlayBehaviorImpl._openedChanged.a pply(this,arguments)}},_renderOpened:function(){if(!this.noAnimations&&this.anim ationConfig.open){this.$.contentWrapper.classList.add("animating");this.playAnim ation("open")}else{Polymer.IronOverlayBehaviorImpl._renderOpened.apply(this,argu ments)}},_renderClosed:function(){if(!this.noAnimations&&this.animationConfig.cl ose){this.$.contentWrapper.classList.add("animating");this.playAnimation("close" )}else{Polymer.IronOverlayBehaviorImpl._renderClosed.apply(this,arguments)}},_on NeonAnimationFinish:function(){this.$.contentWrapper.classList.remove("animating ");if(this.opened){this._finishRenderOpened()}else{this._finishRenderClosed()}}, _onCaptureScroll:function(){if(!this.allowOutsideScroll){this._restoreScrollPosi tion()}else{this._refitOnScrollRAF&&window.cancelAnimationFrame(this._refitOnScr ollRAF);this._refitOnScrollRAF=window.requestAnimationFrame(this.refit.bind(this ))}},_saveScrollPosition:function(){if(document.scrollingElement){this._scrollTo p=document.scrollingElement.scrollTop;this._scrollLeft=document.scrollingElement .scrollLeft}else{this._scrollTop=Math.max(document.documentElement.scrollTop,doc ument.body.scrollTop);this._scrollLeft=Math.max(document.documentElement.scrollL eft,document.body.scrollLeft)}},_restoreScrollPosition:function(){if(document.sc rollingElement){document.scrollingElement.scrollTop=this._scrollTop;document.scr ollingElement.scrollLeft=this._scrollLeft}else{document.documentElement.scrollTo p=this._scrollTop;document.documentElement.scrollLeft=this._scrollLeft;document. body.scrollTop=this._scrollTop;document.body.scrollLeft=this._scrollLeft}},_upda teAnimationConfig:function(){var animations=(this.openAnimationConfig||[]).conca t(this.closeAnimationConfig||[]);for(var i=0;i<animations.length;i++){animations [i].node=this.containedElement}this.animationConfig={open:this.openAnimationConf ig,close:this.closeAnimationConfig}},_updateOverlayPosition:function(){if(this.i sAttached){this.notifyResize()}},_applyFocus:function(){var focusTarget=this.foc usTarget||this.containedElement;if(focusTarget&&this.opened&&!this.noAutoFocus){ focusTarget.focus()}else{Polymer.IronOverlayBehaviorImpl._applyFocus.apply(this, arguments)}}})})();Polymer({is:"paper-tab",behaviors:[Polymer.IronControlState,P olymer.IronButtonState,Polymer.PaperRippleBehavior],properties:{link:{type:Boole an,value:false,reflectToAttribute:true}},hostAttributes:{role:"tab"},listeners:{ down:"_updateNoink",tap:"_onTap"},attached:function(){this._updateNoink()},get _ parentNoink(){var parent=Polymer.dom(this).parentNode;return!!parent&&!!parent.n oink},_updateNoink:function(){this.noink=!!this.noink||!!this._parentNoink},_onT ap:function(event){if(this.link){var anchor=this.queryEffectiveChildren("a");if( !anchor){return}if(event.target===anchor){return}anchor.click()}}});Polymer.Iron MenuBehaviorImpl={properties:{focusedItem:{observer:"_focusedItemChanged",readOn ly:true,type:Object},attrForItemTitle:{type:String}},hostAttributes:{role:"menu" ,tabindex:"0"},observers:["_updateMultiselectable(multi)"],listeners:{focus:"_on Focus",keydown:"_onKeydown","iron-items-changed":"_onIronItemsChanged"},keyBindi ngs:{up:"_onUpKey",down:"_onDownKey",esc:"_onEscKey","shift+tab:keydown":"_onShi ftTabDown"},attached:function(){this._resetTabindices()},select:function(value){ if(this._defaultFocusAsync){this.cancelAsync(this._defaultFocusAsync);this._defa ultFocusAsync=null}var item=this._valueToItem(value);if(item&&item.hasAttribute( "disabled"))return;this._setFocusedItem(item);Polymer.IronMultiSelectableBehavio rImpl.select.apply(this,arguments)},_resetTabindices:function(){var selectedItem =this.multi?this.selectedItems&&this.selectedItems[0]:this.selectedItem;this.ite ms.forEach(function(item){item.setAttribute("tabindex",item===selectedItem?"0":" -1")},this)},_updateMultiselectable:function(multi){if(multi){this.setAttribute( "aria-multiselectable","true")}else{this.removeAttribute("aria-multiselectable") }},_focusWithKeyboardEvent:function(event){for(var i=0,item;item=this.items[i];i ++){var attr=this.attrForItemTitle||"textContent";var title=item[attr]||item.get Attribute(attr);if(!item.hasAttribute("disabled")&&title&&title.trim().charAt(0) .toLowerCase()===String.fromCharCode(event.keyCode).toLowerCase()){this._setFocu sedItem(item);break}}},_focusPrevious:function(){var length=this.items.length;va r curFocusIndex=Number(this.indexOf(this.focusedItem));for(var i=1;i<length+1;i+ +){var item=this.items[(curFocusIndex-i+length)%length];if(!item.hasAttribute("d isabled")){var owner=Polymer.dom(item).getOwnerRoot()||document;this._setFocused Item(item);if(Polymer.dom(owner).activeElement==item){return}}}},_focusNext:func tion(){var length=this.items.length;var curFocusIndex=Number(this.indexOf(this.f ocusedItem));for(var i=1;i<length+1;i++){var item=this.items[(curFocusIndex+i)%l ength];if(!item.hasAttribute("disabled")){var owner=Polymer.dom(item).getOwnerRo ot()||document;this._setFocusedItem(item);if(Polymer.dom(owner).activeElement==i tem){return}}}},_applySelection:function(item,isSelected){if(isSelected){item.se tAttribute("aria-selected","true")}else{item.removeAttribute("aria-selected")}Po lymer.IronSelectableBehavior._applySelection.apply(this,arguments)},_focusedItem Changed:function(focusedItem,old){old&&old.setAttribute("tabindex","-1");if(focu sedItem){focusedItem.setAttribute("tabindex","0");focusedItem.focus()}},_onIronI temsChanged:function(event){if(event.detail.addedNodes.length){this._resetTabind ices()}},_onShiftTabDown:function(event){var oldTabIndex=this.getAttribute("tabi ndex");Polymer.IronMenuBehaviorImpl._shiftTabPressed=true;this._setFocusedItem(n ull);this.setAttribute("tabindex","-1");this.async(function(){this.setAttribute( "tabindex",oldTabIndex);Polymer.IronMenuBehaviorImpl._shiftTabPressed=false},1)} ,_onFocus:function(event){if(Polymer.IronMenuBehaviorImpl._shiftTabPressed){retu rn}var rootTarget=Polymer.dom(event).rootTarget;if(rootTarget!==this&&typeof roo tTarget.tabIndex!=="undefined"&&!this.isLightDescendant(rootTarget)){return}this ._defaultFocusAsync=this.async(function(){var selectedItem=this.multi?this.selec tedItems&&this.selectedItems[0]:this.selectedItem;this._setFocusedItem(null);if( selectedItem){this._setFocusedItem(selectedItem)}else if(this.items[0]){this._fo cusNext()}})},_onUpKey:function(event){this._focusPrevious();event.detail.keyboa rdEvent.preventDefault()},_onDownKey:function(event){this._focusNext();event.det ail.keyboardEvent.preventDefault()},_onEscKey:function(event){this.focusedItem.b lur()},_onKeydown:function(event){if(!this.keyboardEventMatchesKeys(event,"up do wn esc")){this._focusWithKeyboardEvent(event)}event.stopPropagation()},_activate Handler:function(event){Polymer.IronSelectableBehavior._activateHandler.call(thi s,event);event.stopPropagation()}};Polymer.IronMenuBehaviorImpl._shiftTabPressed =false;Polymer.IronMenuBehavior=[Polymer.IronMultiSelectableBehavior,Polymer.Iro nA11yKeysBehavior,Polymer.IronMenuBehaviorImpl];Polymer.IronMenubarBehaviorImpl= {hostAttributes:{role:"menubar"},keyBindings:{left:"_onLeftKey",right:"_onRightK ey"},_onUpKey:function(event){this.focusedItem.click();event.detail.keyboardEven t.preventDefault()},_onDownKey:function(event){this.focusedItem.click();event.de tail.keyboardEvent.preventDefault()},get _isRTL(){return window.getComputedStyle (this)["direction"]==="rtl"},_onLeftKey:function(event){if(this._isRTL){this._fo cusNext()}else{this._focusPrevious()}event.detail.keyboardEvent.preventDefault() },_onRightKey:function(event){if(this._isRTL){this._focusPrevious()}else{this._f ocusNext()}event.detail.keyboardEvent.preventDefault()},_onKeydown:function(even t){if(this.keyboardEventMatchesKeys(event,"up down left right esc")){return}this ._focusWithKeyboardEvent(event)}};Polymer.IronMenubarBehavior=[Polymer.IronMenuB ehavior,Polymer.IronMenubarBehaviorImpl];Polymer({is:"paper-tabs",behaviors:[Pol ymer.IronResizableBehavior,Polymer.IronMenubarBehavior],properties:{noink:{type: Boolean,value:false,observer:"_noinkChanged"},noBar:{type:Boolean,value:false},n oSlide:{type:Boolean,value:false},scrollable:{type:Boolean,value:false},fitConta iner:{type:Boolean,value:false},disableDrag:{type:Boolean,value:false},hideScrol lButtons:{type:Boolean,value:false},alignBottom:{type:Boolean,value:false},selec table:{type:String,value:"paper-tab"},autoselect:{type:Boolean,value:false},auto selectDelay:{type:Number,value:0},_step:{type:Number,value:10},_holdDelay:{type: Number,value:1},_leftHidden:{type:Boolean,value:false},_rightHidden:{type:Boolea n,value:false},_previousTab:{type:Object}},hostAttributes:{role:"tablist"},liste ners:{"iron-resize":"_onTabSizingChanged","iron-items-changed":"_onTabSizingChan ged","iron-select":"_onIronSelect","iron-deselect":"_onIronDeselect"},keyBinding s:{"left:keyup right:keyup":"_onArrowKeyup"},created:function(){this._holdJob=nu ll;this._pendingActivationItem=undefined;this._pendingActivationTimeout=undefine d;this._bindDelayedActivationHandler=this._delayedActivationHandler.bind(this);t his.addEventListener("blur",this._onBlurCapture.bind(this),true)},ready:function (){this.setScrollDirection("y",this.$.tabsContainer)},detached:function(){this._ cancelPendingActivation()},_noinkChanged:function(noink){var childTabs=Polymer.d om(this).querySelectorAll("paper-tab");childTabs.forEach(noink?this._setNoinkAtt ribute:this._removeNoinkAttribute)},_setNoinkAttribute:function(element){element .setAttribute("noink","")},_removeNoinkAttribute:function(element){element.remov eAttribute("noink")},_computeScrollButtonClass:function(hideThisButton,scrollabl e,hideScrollButtons){if(!scrollable||hideScrollButtons){return"hidden"}if(hideTh isButton){return"not-visible"}return""},_computeTabsContentClass:function(scroll able,fitContainer){return scrollable?"scrollable"+(fitContainer?" fit-container" :""):" fit-container"},_computeSelectionBarClass:function(noBar,alignBottom){if( noBar){return"hidden"}else if(alignBottom){return"align-bottom"}return""},_onTab SizingChanged:function(){this.debounce("_onTabSizingChanged",function(){this._sc roll();this._tabChanged(this.selectedItem)},10)},_onIronSelect:function(event){t his._tabChanged(event.detail.item,this._previousTab);this._previousTab=event.det ail.item;this.cancelDebouncer("tab-changed")},_onIronDeselect:function(event){th is.debounce("tab-changed",function(){this._tabChanged(null,this._previousTab);th is._previousTab=null},1)},_activateHandler:function(){this._cancelPendingActivat ion();Polymer.IronMenuBehaviorImpl._activateHandler.apply(this,arguments)},_sche duleActivation:function(item,delay){this._pendingActivationItem=item;this._pendi ngActivationTimeout=this.async(this._bindDelayedActivationHandler,delay)},_delay edActivationHandler:function(){var item=this._pendingActivationItem;this._pendin gActivationItem=undefined;this._pendingActivationTimeout=undefined;item.fire(thi s.activateEvent,null,{bubbles:true,cancelable:true})},_cancelPendingActivation:f unction(){if(this._pendingActivationTimeout!==undefined){this.cancelAsync(this._ pendingActivationTimeout);this._pendingActivationItem=undefined;this._pendingAct ivationTimeout=undefined}},_onArrowKeyup:function(event){if(this.autoselect){thi s._scheduleActivation(this.focusedItem,this.autoselectDelay)}},_onBlurCapture:fu nction(event){if(event.target===this._pendingActivationItem){this._cancelPending Activation()}},get _tabContainerScrollSize(){return Math.max(0,this.$.tabsContai ner.scrollWidth-this.$.tabsContainer.offsetWidth)},_scroll:function(e,detail){if (!this.scrollable){return}var ddx=detail&&-detail.ddx||0;this._affectScroll(ddx) },_down:function(e){this.async(function(){if(this._defaultFocusAsync){this.cance lAsync(this._defaultFocusAsync);this._defaultFocusAsync=null}},1)},_affectScroll :function(dx){this.$.tabsContainer.scrollLeft+=dx;var scrollLeft=this.$.tabsCont ainer.scrollLeft;this._leftHidden=scrollLeft===0;this._rightHidden=scrollLeft=== this._tabContainerScrollSize},_onLeftScrollButtonDown:function(){this._scrollToL eft();this._holdJob=setInterval(this._scrollToLeft.bind(this),this._holdDelay)}, _onRightScrollButtonDown:function(){this._scrollToRight();this._holdJob=setInter val(this._scrollToRight.bind(this),this._holdDelay)},_onScrollButtonUp:function( ){clearInterval(this._holdJob);this._holdJob=null},_scrollToLeft:function(){this ._affectScroll(-this._step)},_scrollToRight:function(){this._affectScroll(this._ step)},_tabChanged:function(tab,old){if(!tab){this.$.selectionBar.classList.remo ve("expand");this.$.selectionBar.classList.remove("contract");this._positionBar( 0,0);return}var r=this.$.tabsContent.getBoundingClientRect();var w=r.width;var t abRect=tab.getBoundingClientRect();var tabOffsetLeft=tabRect.left-r.left;this._p os={width:this._calcPercent(tabRect.width,w),left:this._calcPercent(tabOffsetLef t,w)};if(this.noSlide||old==null){this.$.selectionBar.classList.remove("expand") ;this.$.selectionBar.classList.remove("contract");this._positionBar(this._pos.wi dth,this._pos.left);return}var oldRect=old.getBoundingClientRect();var oldIndex= this.items.indexOf(old);var index=this.items.indexOf(tab);var m=5;this.$.selecti onBar.classList.add("expand");var moveRight=oldIndex<index;var isRTL=this._isRTL ;if(isRTL){moveRight=!moveRight}if(moveRight){this._positionBar(this._calcPercen t(tabRect.left+tabRect.width-oldRect.left,w)-m,this._left)}else{this._positionBa r(this._calcPercent(oldRect.left+oldRect.width-tabRect.left,w)-m,this._calcPerce nt(tabOffsetLeft,w)+m)}if(this.scrollable){this._scrollToSelectedIfNeeded(tabRec t.width,tabOffsetLeft)}},_scrollToSelectedIfNeeded:function(tabWidth,tabOffsetLe ft){var l=tabOffsetLeft-this.$.tabsContainer.scrollLeft;if(l<0){this.$.tabsConta iner.scrollLeft+=l}else{l+=tabWidth-this.$.tabsContainer.offsetWidth;if(l>0){thi s.$.tabsContainer.scrollLeft+=l}}},_calcPercent:function(w,w0){return 100*w/w0}, _positionBar:function(width,left){width=width||0;left=left||0;this._width=width; this._left=left;this.transform("translateX("+left+"%) scaleX("+width/100+")",thi s.$.selectionBar)},_onBarTransitionEnd:function(e){var cl=this.$.selectionBar.cl assList;if(cl.contains("expand")){cl.remove("expand");cl.add("contract");this._p ositionBar(this._pos.width,this._pos.left)}else if(cl.contains("contract")){cl.r emove("contract")}}});
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_history/history_toolbar.js ('k') | chrome/browser/resources/md_history/list_container.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698