window.wp=window.wp||{},function(n,o,v){"use strict";var c={},s={};o.mce=o.mce||{},o.mce.views={register:function(e,t){c[e]=o.mce.View.extend(_.extend(t,{type:e}))},unregister:function(e){delete c[e]},get:function(e){return c[e]},unbind:function(){_.each(s,function(e){e.unbind()})},setMarkers:function(e){var a,t,d=[{content:e}],r=this;return _.each(c,function(s,o){t=d.slice(),d=[],_.each(t,function(e){var t,n,i=e.content;if(e.processed)d.push(e);else{for(;i&&(t=s.prototype.match(i));)t.index&&d.push({content:i.substring(0,t.index)}),n=(a=r.createInstance(o,t.content,t.options)).loader?".":a.text,d.push({content:'
'+n+"
",processed:!0}),i=i.slice(t.index+t.content.length);i&&d.push({content:i})}})}),(e=_.pluck(d,"content").join("")).replace(/\s*
")},createInstance:function(e,t,n){var i=this.get(e),e=this.getInstance(t);return e||(e=encodeURIComponent(t),n=_.extend(n||{},{text:t,encodedText:e}),s[e]=new i(n))},getInstance:function(e){return"string"==typeof e?s[encodeURIComponent(e)]:s[v(e).attr("data-wpview-text")]},getText:function(e){return decodeURIComponent(v(e).attr("data-wpview-text")||"")},render:function(t){_.each(s,function(e){e.render(t)})},update:function(e,t,n){var i=this.getInstance(n);i&&i.update(e,t,n)},edit:function(t,n){var i=this.getInstance(n);i&&i.edit&&i.edit(i.text,function(e){i.update(e,t,n)})},remove:function(e,t){var n=this.getInstance(t);n&&n.remove(e,t)}},o.mce.View=function(e){_.extend(this,e),this.initialize()},o.mce.View.extend=Backbone.View.extend,_.extend(o.mce.View.prototype,{content:null,loader:!0,initialize:function(){},getContent:function(){return this.content},render:function(e,t){null!=e&&(this.content=e),e=this.getContent(),(this.loader||e)&&(t&&this.unbind(),this.replaceMarkers(),e?this.setContent(e,function(e,t,n){v(t).data("rendered",!0),this.bindNode.call(this,e,t,n)},!!t&&null):this.setLoader())},bindNode:function(){},unbindNode:function(){},unbind:function(){this.getNodes(function(e,t,n){this.unbindNode.call(this,e,t,n),v(t).trigger("wp-mce-view-unbind")},!0)},getEditors:function(t){_.each(tinymce.editors,function(e){e.plugins.wpview&&t.call(this,e)},this)},getNodes:function(n,i){this.getEditors(function(e){var t=this;v(e.getBody()).find('[data-wpview-text="'+t.encodedText+'"]').filter(function(){var e;return null==i||(e=!0===v(this).data("rendered"),i?e:!e)}).each(function(){n.call(t,e,this,v(this).find(".wpview-content").get(0))})})},getMarkers:function(n){this.getEditors(function(e){var t=this;v(e.getBody()).find('[data-wpview-marker="'+this.encodedText+'"]').each(function(){n.call(t,e,this)})})},replaceMarkers:function(){this.getMarkers(function(e,t){this.loader||v(t).text()===tinymce.DOM.decode(this.text)?e.dom.replace(e.dom.createFragment('
\xa0
\xa0