define(["wc/has","wc/mixin","wc/urlParser","wc/config","wc/dom/tag"],function(u,d,h,y,p){"use strict";var g=new function(){var r=".css",i=null,s=null,o={edge:"edge",ie11:{test:"trident",version:7}};function a(e){var t="undefined",e=e||y.get("wc/loader/style"),n=o;return null===i&&(i=function(){var e,t,n=g.getMainCss(!0),r="",i="/";if(n&&(e=h.parse(n))){if(e.protocol&&(r=e.protocol+i+i),r+=e.host,e.pathnameArray)for(t=0;t<e.pathnameArray.length-1;++t)r+=i+e.pathnameArray[t];return r+i}return""}()),null===(s=e&&(typeof e.css!=t&&(n=e.inherit&&"object"==typeof e.css?d(e.css,n):e.css),typeof e.cachebuster!=t)?e.cachebuster:s)&&(t=g.getMainCss(!0),s=t&&(t=h.parse(t))&&(t=t.search)?t.substring(1,t.length):""),n}function c(e,t){var n=document;n.querySelector("link[href='"+e+"']")||(e={"data-wc-loader":"style",type:"text/css",rel:"stylesheet",href:e},t&&(e.media=t),t=p.toTag("link",!1,e,!0),(e=(e=(e=document.querySelectorAll("link[rel='stylesheet']"))&&e.length?e[e.length-1]:null)?e.nextSibling:null)?e.insertAdjacentHTML("afterEnd",t):n.head.insertAdjacentHTML("beforeEnd",t))}function l(e,t){if(e&&e.constructor.prototype!==String.prototype)throw new TypeError("Invalid "+t)}function f(e,t){var n;0===e.indexOf("/")||0===e.indexOf("http")||0===e.indexOf(".")?c(n=e,t):(n=i+e,e.indexOf(r)<0&&(n+=r),s&&(n+="?"+s),c(n,t))}this.getMainCss=function(e){var t=document.getElementById("wc_css_screen");return t&&e?t.href:t},this.load=function(e){var t,n,r,i,s,o=a(e);if(o)for(s in o)if(o.hasOwnProperty(s))if(0,"string"==typeof(i=o[s]))u(i)&&f("wc-"+s);else{if(l(t=i.test,"has test"),l(r=i.name||"wc-"+s,"name"),(n=i.version)&&isNaN(n))throw new TypeError("Invalid version");l(i=i.media,"media query"),t?n||0===n?u(t)<=n&&f(r,i):u(t)&&f(r,i):f(r,i)}},this.add=function(e,t,n){a(n),f(e,t)}};return g});