import{flush as e}from"../polymer/lib/legacy/polymer.dom.js";import{afterNextRender as r}from"../polymer/lib/utils/render-status.js";export const IronDocViewerBehavior={properties:{descriptor:{type:Object},baseHref:{type:String,value:""},fragmentPrefix:{type:String,value:""},_showProtected:{type:Boolean,value:!1},_showInherited:{type:Boolean,value:!0}},_filterMembers:function(e,r,n){return(e||[]).filter((function(e){var t=e.privacy||"public",o="public"===t;r&&(o=o||"protected"===t);var a=n||null==e.inheritedFrom;return o&&a}))},_noneToShow:function(e,r,n,t){if(!n)return!0;var o="behaviors"===t?this._getPolymerBehaviors(n):n[t];return!o||0===this._filterMembers(o,e,r).length},scrollToAnchor:function(n){if((n=n||window.location.hash)&&0!==n.length){0===n.indexOf("#")&&(n=n.substring(1)),e();var t=this.fragmentPrefix+n;if(s=this.$$('[anchor-id="'+t+'"]'))r(this,(function(){s.scrollIntoView({behavior:"smooth"}),s.classList.add("scrolled"),this.async((function(){s.classList.remove("scrolled")}),1e3)}));else{var o=this.$$("iron-doc-api");if(o)o.scrollToAnchor(n);else for(var a=this.root.querySelectorAll("*"),i=0;i<a.length;i++){var s;if((s=a[i]).fragmentPrefix&&s.scrollToAnchor&&0===n.indexOf(s.fragmentPrefix))return void s.scrollToAnchor(n.slice(s.fragmentPrefix.length))}}}},_getElementName:function(e){var r="";return e.tagname?(r+="<"+e.tagname+">",e.name&&(r+=" ("+e.name+")")):e.name&&(r+=e.name),r},_getElementId:function(e){return e.name||e.tagname},_getPolymerBehaviors:function(e){return(((e||{}).metadata||{}).polymer||{}).behaviors||[]},_compareDescriptors:function(e,r){return e.name!=r.name?compareUnderscoresLast(e.name||"",r.name||""):e.tagname!=r.tagname?compareUnderscoresLast(e.tagname||"",r.tagname||""):0}};function compareUnderscoresLast(e,r){var n=numLeadingUnderscores(e),t=numLeadingUnderscores(r);return n!==t?n-t:e.localeCompare(r)}function numLeadingUnderscores(e){return e.match(/^_*/)[0].length}