wp.customize.widgetsPreview=wp.customize.WidgetCustomizerPreview=function(d,o,c){vars={renderedSidebars:{},renderedWidgets:{},registeredSidebars:[],registeredWidgets:{},widgetSelectors:[],preview:null,l10n:{widgetTooltip:""},selectiveRefreshableWidgets:{},init:function(){vare=this;e.preview=c.preview,o.isEmpty(e.selectiveRefreshableWidgets)||e.addPartials(),e.buildWidgetSelectors(),e.highlightControls(),e.preview.bind("highlight-widget",e.highlightWidget),c.preview.bind("active",function(){e.highlightControls()})}};returns.WidgetPartial=c.selectiveRefresh.Partial.extend({initialize:function(e,t){vari=this,r=e.match(/^widget\[(.+)]$/);if(!r)thrownewError("Illegal id for widget partial.");i.widgetId=r[1],i.widgetIdParts=s.parseWidgetId(i.widgetId),(t=t||{}).params=o.extend({settings:[s.getWidgetSettingId(i.widgetId)],containerInclusive:!0},t.params||{}),c.selectiveRefresh.Partial.prototype.initialize.call(i,e,t)},refresh:function(){vare,t=this;returns.selectiveRefreshableWidgets[t.widgetIdParts.idBase]?c.selectiveRefresh.Partial.prototype.refresh.call(t):((e=d.Deferred()).reject(),t.fallback(),e.promise())},renderContent:function(e){vart=this;c.selectiveRefresh.Partial.prototype.renderContent.call(t,e)&&(c.preview.send("widget-updated",t.widgetId),c.selectiveRefresh.trigger("widget-updated",t))}}),s.SidebarPartial=c.selectiveRefresh.Partial.extend({initialize:function(e,t){vari=this,r=e.match(/^sidebar\[(.+)]$/);if(!r)thrownewError("Illegal id for sidebar partial.");if(i.sidebarId=r[1],(t=t||{}).params=o.extend({settings:["sidebars_widgets["+i.sidebarId+"]"]},t.params||{}),c.selectiveRefresh.Partial.prototype.initialize.call(i,e,t),!i.params.sidebarArgs)thrownewError("The sidebarArgs param was not provided.");if(1<i.params.settings.length)thrownewError("Expected SidebarPartial to only have one associated setting")},ready:function(){vari=this;o.each(i.settings(),function(e){c(e).bind(o.bind(i.handleSettingChange,i))}),c.selectiveRefresh.bind("partial-content-rendered",function(e){e.partial.extended(s.WidgetPartial)&&-1!==o.indexOf(i.getWidgetIds(),e.partial.widgetId)&&c.selectiveRefresh.trigger("sidebar-updated",i)}),c.bind("change",function(e){vart=s.parseWidgetSettingId(e.id);t&&(e=t.idBase,t.number&&(e+="-"+String(t.number)),-1!==o.indexOf(i.getWidgetIds(),e)&&i.ensureWidgetPlacementContainers(e))})},findDynamicSidebarBoundaryNodes:function(){vari=this,r={},n=/^(dynamic_sidebar_before|dynamic_sidebar_after):(.+):(\d+)$/,a=function(e){o.each(e,function(e){vart;8===e.nodeType?(t=e.nodeValue.match(n))&&t[2]===i.sidebarId&&(o.isUndefined(r[t[3]])&&(r[t[3]]={before:null,after:null,instanceNumber:parseInt(t[3],10)}),"dynamic_sidebar_before"===t[1]?r[t[3]].before=e:r[t[3]].after=e):1===e.nodeType&&a(e.childNodes)})};returna(document.body.childNodes),o.values(r)},placements:function(){vart=this;returno.map(t.findDynamicSidebarBoundaryNodes(),function(e){returnnewc.selectiveRefresh.Placement({partial:t,container:null,startNode:e.before,endNode:e.after,context:{instanceNumber:e.instanceNumber}})})},getWidgetIds:function(){vare=this.settings()[0];if(!e)thrownewError("Missing associated setting.");if(!c.has(e))thrownewError("Setting does not exist.");if(e=c(e).get(),!o.isArray(e))thrownewError("Expected setting to be array of widget IDs");returne.slice(0)},reflowWidgets:function(){vare=this,t=[],i=e.getWidgetIds(),r=e.placements(),s={};returno.each(i,function(e){vart=c.selectiveRefresh.partial("widget["+e+"]");t&&(s[e]=t)}),o.each(r,function(i){varr,n=[],a=!1,d=-1;o.each(s,function(t){o.each(t.placements(),function(e){i.context.instanceNumber===e.context.sidebar_instance_number&&(r=e.container.index(),n.push({partial:t,placement:e,position:r}),r<d&&(a=!0),d=r)})}),a&&(o.each(n,function(e){i.endNode.parentNode.insertBefore(e.placement.container[0],i.endNode),c.selectiveRefresh.trigger("partial-content-moved",e.placement)}),t.push(i))}),0<t.length&&c.selectiveRefresh.trigger("sidebar-updated",e),t},ensureWidgetPlacementContainers:function(i){varr=this,n=!1,e="widget["+i+"]",a=c.selectiveRefresh.p