!function(l,h,e){var d={model:{},collection:{},view:{},fn:{}},n=function(e,t){for(var s=[],i=SPECIFICITY.calculate(e),r=0;r<%= selector %>'),initialize:function(){var t=this;this.hl=new d.view.highlighter,this.hl.initialize(),this.pageSelectors=d.fn.pageSelectors(),l("body").on("mouseover","*",function(e){if(!t.active)return!0;0===l(this).closest(".socss-element").length&&(e.stopPropagation(),t.setHoverEl(l(this)))}),l("body *").click(function(e){if(!t.active||t.$el.is(":hover"))return!0;e.preventDefault(),e.stopPropagation(),l(this).blur(),t.setActiveEl(t.hoverEl)}),this.$(".socss-enable-inspector").click(function(){t.toggleActive()}),this.$el.mouseenter(function(){t.hl.clear()});try{parent.socss.mainEditor.setInspector(this)}catch(e){console.log("No editor to register this inspector with")}},setHoverEl:function(e){this.hoverEl=e,this.hl.highlight(e)},activate:function(){this.active=!0,l("body").addClass("socss-active"),l("body").removeClass("socss-inactive")},deactivate:function(){this.active=!1,l("body").addClass("socss-inactive"),l("body").removeClass("socss-active"),this.hl.clear(),this.$(".socss-hierarchy").empty()},toggleActive:function(){this.active?this.deactivate():this.activate()},setActiveEl:function(t){var s=this,e=this.$(".socss-hierarchy");if(e.empty(),t){if("body"!==t.prop("tagName").toLowerCase()){for(var i=l(t);l(this.selectorTemplate({selector:d.fn.elSelector(i)})).prependTo(e).data("el",i),"body"!==(i=i.parent()).prop("tagName").toLowerCase(););l(this.selectorTemplate({selector:"body"})).prependTo(e).data("el",l("body")),this.$(".socss-hierarchy .socss-selector").hover(function(){s.hl.highlight(l(this).data("el"))}).click(function(e){e.preventDefault(),e.stopPropagation(),s.setActiveEl(l(this).data("el"))})}e.scrollLeft(99999);var r=this.pageSelectors.filter(function(e){try{return t.is(e.selector)}catch(e){return!1}}),o=this.$(".socss-selectors-window").empty();h.each(r,function(e){o.append(l(s.selectorTemplate(e)).data(e))}),o.find("> div").mouseenter(function(){s.hl.highlight(l(this).data("selector"))}).click(function(e){e.preventDefault(),e.stopPropagation(),s.trigger("click_selector",l(this).data("selector"))});var c=d.fn.elementAttributes(t);o=this.$(".socss-properties-window").empty(),h.each(c,function(e,t){o.append(l(s.selectorTemplate({selector:""+t+": "+e})).data("property",t+": "+e))}),o.find("> div").click(function(e){e.preventDefault(),e.stopPropagation(),s.trigger("click_property",l(this).data("property"))});var a=t.closest("a[href]"),n=this.$(".socss-link");a.length?n.show().find("a").html(a.attr("href").replace(/[\?&]*so_css_preview=1/,"")).attr("href",a.attr("href")):n.hide(),this.trigger("set_active_element",t,r)}}}),d.view.highlighter=Backbone.View.extend({template:h.template(l("#socss-template-hover").html().trim()),highlighted:[],highlight:function(e){this.clear();var a=this;l(e).each(function(e,t){if(!(t=l(t)).is(":visible"))return!0;var s,i=l(a.template());i.css({top:t.offset().top,left:t.offset().left,width:t.outerWidth(),height:t.outerHeight()}).appendTo("body");var r=t.padding();for(var o in r)0t.specificity?-1:1}),s},d.fn.elementAttributes=function(e){if(!document.styleSheets)return[];var t=[],s=d.fn.getParsedCss(),i=function(e){switch(e){case"charset":case"custom-media":case"document":case"font-face":case"host":case"import":case"keyframes":case"keyframe":case"media":case"namespace":case"page":case"supports":return!0}return!1};for(var r in s)for(var o=s[r].stylesheet.rules,c=0;ct.specificity?1:-1}).reverse();for(var f={},v=0;v