!function(){"use strict";functiont(n){returnfunction(t){returnr=typeof(e=t),(null===e?"null":"object"==r&&(Array.prototype.isPrototypeOf(e)||e.constructor&&"Array"===e.constructor.name)?"array":"object"==r&&(String.prototype.isPrototypeOf(e)||e.constructor&&"String"===e.constructor.name)?"string":r)===n;vare,r}}functiony(t){returnt.getParam("importcss_selector_converter")}functionu(e){returnl(e)?function(t){return-1!==t.indexOf(e)}:einstanceofRegExp?function(t){returne.test(t)}:e}functionh(t,e){varr,n=/^(?:([a-z0-9\-_]+))?(\.[a-z0-9_\-\.]+)$/i.exec(e);if(n){varo=n[1],i=n[2].substr(1).split(".").join(" "),c=x.makeMap("a,img");returnn[1]?(r={title:e},t.schema.getTextBlockElements()[o]?r.block=o:t.schema.getBlockElements()[o]||c[o.toLowerCase()]?r.selector=o:r.inline=o):n[2]&&(r={inline:"span",title:e.substr(1),classes:i}),!1!==t.getParam("importcss_merge_classes")?r.classes=i:r.attributes={class:i},r}}functiond(t,e){returnnull===e||!1!==t.getParam("importcss_exclusive")}functionr(v){v.on("init",function(){functiono(t,e){if(f=t,p=g,!(d(v,m=e)?finp:finm.selectors)){a=t,l=g,d(v,u=e)?l[a]=!0:u.selectors[a]=!0;varr=(i=(o=v).plugins.importcss,c=t,((s=e)&&s.selector_converter?s.selector_converter:y(o)?y(o):function(){returnh(o,c)}).call(i,c,s));if(r){varn=r.name||_.DOM.uniqueId();returnv.formatter.register(n,r),{title:r.title,format:n}}}varo,i,c,s,a,u,l,f,m,p;returnnull}vare,r,n,t,i=(e=[],r=[],n={},{addItemToGroup:function(t,e){n[t]?n[t].push(e):(r.push(t),n[t]=[e])},addItem:function(t){e.push(t)},toFormats:function(){returnfunction(t){for(vare=[],r=0,n=t.length;r<n;++r){if(!f(t[r]))thrownewError("Arr.flatten item "+r+" was not an array, input: "+t);P.apply(e,t[r])}returne}(function(t,e){for(varr=t.length,n=newArray(r),o=0;o<r;o++){vari=t[o];n[o]=e(i,o)}returnn}(r,function(t){vare=n[t];return0===e.length?[]:[{title:t,items:e}]})).concat(e)}}),g={},c=u(v.getParam("importcss_selector_filter")),s=(t=v.getParam("importcss_groups"),x.map(t,function(t){returnx.extend({},t,{original:t,selectors:{},filter:u(t.filter)})}));x.each(function(c,t,s){vara=[],r={},u=function(t,e){varr,n,o=n=t.href,i=p.cacheSuffix;if((n=o=l(o)?o.replace("?"+i,"").replace("&"+i,""):o)&&s(n,e)&&!function(t,e){varr,n=!1!==(r=t.getParam("skin"))&&(r||"oxide");if(n){varo=t.getParam("skin_url"),i=o?t.documentBaseURI.toAbsolute(o):m.baseURL+"/skins/ui/"+n,c=m.baseURL+"/skins/content/";returne===i+"/content"+(t.inline?".inline":"")+".min.css"||-1!==e.indexOf(c)}}(c,n)){x.each(t.imports,function(t){u(t,!0)});try{r=t.cssRules||t.rules}catch(t){}x.each(r,function(t){t.styleSheet?u(t.styleSheet,!0):t.selectorText&&x.each(t.selectorText.split(","),function(t){a.push(x.trim(t))})})}};x.each(c.contentCSS,function(t){r[t]=!0}),s=s||function(t,e){returne||r[t]};try{x.each(t.styleSheets,function(t){u(t)})}catch(t){}returna}(v,v.getDoc(),u(v.getParam("importcss_file_filter"))),function(r){vart,e,n;T.test(r)||c&&!c(r)||(n=r,0<(t=x.grep(s,function(t){return!t.filter||t.filter(n)})).length?x.each(t,function(t){vare=o(r,t);e&&i.addItemToGroup(t.title,e)}):(e=o(r,null))&&i.addItem(e))});vara=i.toFormats();v.fire("addStyleModifications",{items:a,replace:!v.getParam("importcss_append")})})}vare=tinymce.util.Tools.resolve("tinymce.PluginManager"),l=t("string"),f=t("array"),_=tinymce.util.Tools.resolve("tinymce.dom.DOMUtils"),m=tinymce.util.Tools.resolve("tinymce.EditorManager"),p=tinymce.util.Tools.resolve("tinymce.Env"),x=tinymce.util.Tools.resolve("tinymce.util.Tools"),P=Array.prototype.push,T=/^\.(?:ephox|tiny-pageembed|mce)(?:[.-]+\w+)+$/;e.add("importcss",function(t){returnr(t),e=t,{convertSelectorToFormat:function(t){returnh(e,t)}};vare})}();