webicon
Version:
Icon library
2 lines • 28.3 kB
JavaScript
!function(n,t){"use strict";function e(n){function t(n,o){var r,c;if(!o){if(!e[n])throw r=new Error('Cannot found service provider "'+n+'"'),console.error(r),r;if(!i.hasOwnProperty(n))try{i[n]=new e[n](t)}catch(r){throw console.error(r),r}return i[n]}if(i.hasOwnProperty(n))throw r=new Error('Cannot override instantiated service "'+n+'"'),console.error(r),r;return"function"!=typeof o?void console.error('Provider "'+n+'" is not a function'):void(e.hasOwnProperty(n)?(c=e[n],e[n]=function(n){return new o(n,new c(n))}):e[n]=o)}var e={},i={};return Object.keys(o.providers).forEach(function(n){e[n]=o.providers[n]}),t.has=function(n){return e.hasOwnProperty(n)},t("ready",function(n){return function(t){"function"==typeof t?t(n):t&&console.error("Ready listener not a function")}}),n&&("function"==typeof n?n(t):console.error("Injector initializer not a function")),(r.listeners||[]).forEach(function(n){n(t)}),t}function o(n,t){var e,r;return r=o.providers=o.providers||{},"function"!=typeof t?void console.error('Provider "'+n+'" is not a function'):void(r.hasOwnProperty(n)?(e=r[n],r[n]=function(n){return new t(n,new e(n))}):r[n]=t)}function r(n){var t;t=r.listeners=r.listeners||[],"function"==typeof n?t.push(n):n&&console.error("Ready listener not a function")}function i(n,t){var e,o,r=n("publicApi"),i=n("iconManager"),c={ios8:["ios7","i7","i8","ios9","i9"],win8:["w8","windows8","windows-8","metro","windows-metro"],android:["android-kitkat","kitkat","ak"],androidL:["android-lollipop","android-l","lollipop","al"],color:["flat_color","c","colored"],win10:["w10","windows10","windows-10"]};e={},Object.keys(c).forEach(function(n){e[n.toLowerCase()]=n,c[n].forEach(function(t){e[t]=n})}),i.setDefaultIconSet("icons8").addSvgIconSet("icons8",function(n){var e={url:t.api.url,params:{}};return n&&(Array.isArray(n)||(n=[n]),e.params.icons=n.join(",")),o&&(e.params.token=o),e},{cumulative:!0,iconIdParser:function(n,t){var o;for(n=String(n||""),Array.isArray(t)||(t=[]),t=t.map(function(n){return String(n).toLowerCase()}),o=0;o<t.length;o++)if(e.hasOwnProperty(t[o]))return[e[t[o]],n].join("-");return[e.c,n].join("-")}}),r.icons8Token=function(n){o=n},n.has("configPerformer")&&n("configPerformer").strategy(function(n){"undefined"!=typeof n.icons8Token&&r.icons8Token(n.icons8Token)})}function c(n,t){function e(n,t){var e;switch(n){case"maki":e=o(s,{iconIdResolver:c});break;case"material-design-icons":e=o(s,{iconIdResolver:i});break;default:e=o(s)}u.addSvgIconSet(n,t,e)}function o(){var n={};return Array.prototype.slice.call(arguments).forEach(function(t){t&&Object.keys(t).forEach(function(e){n[e]=t[e]})}),n}var r,i,c,s,a,u=n("iconManager");r=function(n){return String(n||"").replace(/_/g,"-")},i=function(n){return r(n).replace(/^ic-/,"").replace(/-\d+px$/,"")},c=function(n){return r(n).replace(/-\d+$/,"")},s={iconIdResolver:r,iconIdParser:r,preloadable:!1},a=t.svgSets,a.libs.forEach(function(n){var t,o;"object"==typeof n?(t=n.lib,o=n.filename||(n.name||t)+".svg",n=n.name||t):(t=n,o=n+".svg"),e(n,[a.url,t,o].join("/"))}),Object.keys(t.libs||{}).forEach(function(n){e(n,t.libs[n])}),Object.keys(t.aliases||{}).forEach(function(n){u.addIconSetAlias(t.aliases[n],n)})}function s(n){r(n)}o("AbstractCssClassIcon",function(n){function t(n,t){e.call(this,n),this.className=t}var e=n("AbstractIcon"),o=n("inherit");return o(t,e,{render:function(n){function t(){return n.attr("class").split(/\s+/)}function o(n){var e=t();return n=n||[],e.filter(function(t){return-1==n.indexOf(t)})}var r,i,c;return c=e.prototype.render.call(this,n),r=t(),n.addClass(this.className),i=o(r).join(" "),function(){n.removeClass(i),c&&c()}}})}),o("AbstractElementIcon",function(n){function t(n,t){e.call(this,n),this.element=t}var e=n("AbstractIcon"),o=n("inherit");return o(t,e,{cloneNode:function(){return this.element[0].cloneNode(!0)},render:function(n){var t;return t=e.prototype.render.call(this,n),n.append(this.cloneNode()),function(){for(;n.firstChild;)n.removeChild(n.firstChild);t&&t()}}})}),o("AbstractIcon",function(n){function t(n){this.iconClassName=n}return t.prototype={render:function(n){var t=this.iconClassName;return n.addClass(t),function(){n.removeClass(t)}}},t}),o("FontIcon",function(n){function t(n){var t="font-webicon";e.call(this,t,n)}var e=n("AbstractCssClassIcon"),o=n("inherit");return o(t,e)}),o("ImageIcon",function(n){function t(n){var t="image-webicon";n.attr({width:"100%",height:"100%"}),n.css({"pointer-events":"none",display:"inline-block"}),e.call(this,t,n)}var e=n("AbstractElementIcon"),o=n("inherit");return t.loadByUrl=function(e){var o,r,i=n("buildUrlParams"),c=n("nodeWrapper"),s=n("Promise"),a=e;return"object"==typeof e&&(a=e.url,o=i(e.params),o&&(a=[a,o].join("?"))),new s(function(n,e){r=c("<img>"),r.bind("load",function(){n(new t(r))}),r.bind("error",e),r.attr("src",a)})},o(t,e)}),o("SpriteIcon",function(n){function t(n){var t="sprite-webicon";e.call(this,t,n)}var e=n("AbstractCssClassIcon"),o=n("inherit");return o(t,e)}),o("SvgIcon",function(n){function t(t,o){var r,i,c,s,a,u,l,f,h,p,d="svg-webicon",v=n("nodeWrapper"),g=n("iconManager"),I=n("parseSvgOptions");if(o=I(o),["id","x","y"].forEach(function(n){t.removeAttr(n)}),h=t[0],"svg"!=h.tagName)if("symbol"==h.tagName){for(r=v('<svg xmlns="http://www.w3.org/2000/svg">'),i=r[0],c=h.attributes,u=0;u<c.length;u++)i.setAttribute(c[u].name,c[u].value);t=r.append(v(h).children())}else t=v('<svg xmlns="http://www.w3.org/2000/svg">').append(t);h=t[0],a={xmlns:"http://www.w3.org/2000/svg",version:"1.0"},Object.keys(a).forEach(function(n){h.getAttribute(n)||h.setAttribute(n,a[n])}),p=o.iconSize||g.getDefaultSvgIconSize(),c={fit:"",height:"100%",width:"100%",preserveAspectRatio:"xMidYMid meet",viewBox:h.getAttribute("viewBox")||o.viewBox},c.viewBox||(l=h.getAttribute("width"),f=h.getAttribute("height"),null!==l&&null!==f&&(c.viewBox="0 0 "+parseFloat(l)+" "+parseFloat(f))),c.viewBox=c.viewBox||"0 0 "+p+" "+p,Object.keys(c).forEach(function(n){h.setAttribute(n,c[n])}),s={"pointer-events":"none",display:"inline-block"},Object.keys(s).forEach(function(n){h.style[n]=s[n]}),this.iconSize=p,e.call(this,d,t)}var e=n("AbstractElementIcon"),o=n("inherit");return t.loadByUrl=function(e,o){var r=n("loadSvgByUrl");return r(e).then(function(n){return new t(n,o)})},o(t,e)}),o("AbstractCssClassIconSetScope",function(n){function t(n,t,r){o.call(this,n,r),this._classResolver=e(t)}function e(n){var t;return"function"==typeof n?n:(n=(n||"")+"",t=n.split(/[?%]/),function(n){return t.join(n)})}var o=n("AbstractScope"),r=n("inherit");return r(t,o,{_resolveCssClass:function(n,t){return this._classResolver(n,t)}})}),o("AbstractRemoteResourceScope",function(t){function e(n,t,e){r.call(this,n,e),this._urlResolver=o(t),this._preloadable=this.options.preloadable||"undefined"==typeof this.options.preloadable,this._cache=null,this._resource=null}function o(e){var o,r,i=t("mergeObjects"),c=null;return o&&"object"==typeof o?(o=e.url,c=e.params):o=e,r="function"==typeof o?o:function(){return o},function(){var t,e,o=null;return t=r.apply(null,Array.prototype.slice.call(arguments)),e=t,t&&"object"==typeof t&&(e=t.url,o=t.params),e=String(e||""),"//"===e.slice(0,2)&&(e=n.document.location.protocol+e),{url:e,params:i({},c||{},o||{})}}}var r=t("AbstractScope"),i=t("inherit");return i(e,r,{preload:function(n){return this._preloadable||n?this._getResource():null},_resolveUrl:function(n){return this._urlResolver(n)},_getResource:function(){var n,t=this;return this._cache?this._cache:(n=this._cache=this._loadResource(),n.then(function(n){t._resource=n},function(){t._cache=null}),n)},_loadResource:function(){var n=t("Promise");return n.reject()}})}),o("AbstractRemoteSvgResourceScope",function(n){function t(n,t,o){var i=r(o),c=this;e.call(this,n,t,o),Object.keys(i).forEach(function(n){c.options[n]=i[n]})}var e=n("AbstractRemoteResourceScope"),o=n("inherit"),r=n("parseSvgOptions");return o(t,e)}),o("AbstractScope",function(n){function t(n,t){t=t&&"object"==typeof t?t:{},this.id=n,this.options=t,this._iconIdParser=e(t.iconIdParser),this._iconIdResolver=e(t.iconIdResolver)}function e(n){return"function"==typeof n?n:function(n){return n}}return t.prototype={preload:function(){return null},hasIcon:function(){return!0},_parseIconId:function(n,t){return this._iconIdParser(n,t)},_resolveIconId:function(n){return this._iconIdResolver(n)}},t}),o("FontIconSetScope",function(n){function t(n,t,o){e.call(this,n,t,o)}var e=n("AbstractCssClassIconSetScope"),o=n("inherit");return o(t,e,{getIcon:function(t,e){var o=n("FontIcon");return new o(this._resolveCssClass(this._parseIconId(t,e),e))}})}),o("ImageIconScope",function(n){function t(n,t,o){e.call(this,n,t,o)}var e=n("AbstractRemoteResourceScope"),o=n("inherit");return o(t,e,{_loadResource:function(){var t=n("ImageIcon");return t.loadByUrl(this._resolveUrl())},hasIcon:function(n,t){return this._parseIconId(n,t)==this._resolveIconId(this.id)},getIcon:function(){return this._getResource()}})}),o("SpriteIconSetScope",function(n){function t(n,t,o){e.call(this,n,t,o)}var e=n("AbstractCssClassIconSetScope"),o=n("inherit");return o(t,e,{getIcon:function(t,e){var o=n("SpriteIcon");return new o(this._resolveCssClass(this._parseIconId(t,e),e))}})}),o("SvgCumulativeIconSetScope",function(n){function t(n,t,o){var r=10;e.call(this,n,t,o),this.waitDuration=this.options.waitDuration||r,this.waitPromise=null,this.waitIconIds=[]}var e=n("AbstractRemoteSvgResourceScope"),o=n("inherit");return o(t,e,{_loadResource:function(){var t=n("SvgIconSet");return t.loadByUrl(this._resolveUrl(this.waitIconIds),this.options)},preload:function(){return null},getIcon:function(t,e){var o=n("Promise"),r=n("timeout"),i=this;return t=this._parseIconId(t,e),this._resource&&this._resource.exists(t)?o.resolve(this._resource.getIconById(t)):(this.waitPromise?-1==this.waitIconIds.indexOf(t)&&this.waitIconIds.push(t):(this.waitIconIds=[t],this.waitPromise=r(this.waitDuration).then(function(){return i.waitPromise=null,i._resource?i._resource.mergeByUrl(i._resolveUrl(i._resource.notExists(i.waitIconIds)),i.options):i._getResource()})),this.waitPromise.then(function(n){var e=n.getIconById(t);return e?e:o.reject()}))}})}),o("SvgIconScope",function(n){function t(n,t,o){e.call(this,n,t,o)}var e=n("AbstractRemoteSvgResourceScope"),o=n("inherit");return o(t,e,{_loadResource:function(){var t=n("SvgIcon");return t.loadByUrl(this._resolveUrl(),this.options)},hasIcon:function(n,t){return this._parseIconId(n,t)==this._resolveIconId(this.id)},getIcon:function(){return this._getResource()}})}),o("SvgIconSetScope",function(n){function t(n,t,o){e.call(this,n,t,o)}var e=n("AbstractRemoteSvgResourceScope"),o=n("inherit");return o(t,e,{_loadResource:function(){var t=n("SvgIconSet");return t.loadByUrl(this._resolveUrl(),this.options)},hasIcon:function(n,t){return n=this._parseIconId(n,t),this._getResource().then(function(t){return t.exists(n)})},getIcon:function(t,e){var o=n("Promise");return t=this._parseIconId(t,e),this._getResource().then(function(n){var e=n.getIconById(t);return e?e:o.reject()})}})}),o("ScopeCollection",function(n){function t(){this.collection=[]}return t.prototype={add:function(t){var e=n("SvgCumulativeIconSetScope"),o=n("FontIconSetScope");t instanceof e||t instanceof o?this.collection.push(t):this.collection.unshift(t)},preload:function(t){var e=n("Promise"),o=[];return this.collection.forEach(function(n){var e;e=n.preload(t),e&&"object"==typeof e&&"function"==typeof e.then&&o.push(e)}),o.length>0?e.all(o.map(function(n){return n.then(null,function(){return null})})).then(function(){return null}):null},getIconScope:function(t,e){var o,r=n("Promise"),i=(n("SvgCumulativeIconSetScope"),this.collection);return o=r.all(i.map(function(n){return r.resolve(n.hasIcon(t,e)).then(function(t){return t?n:!1},function(){return!1})})),o.then(function(n){var t;for(t=0;t<n.length;t++)if(n[t])return n[t];return r.reject()})},getIcon:function(n,t){return this.getIconScope(n,t).then(function(e){return e.getIcon(n,t)})}},t}),o("SvgIconSet",function(n){function t(t,e){var o,r,i,c,s,a,u,l=n("log"),f=n("parseSvgOptions"),h=n("SvgIcon"),p=n("nodeWrapper");a="function"==typeof e.iconIdResolver?e.iconIdResolver:function(n){return n},u=f(e),this.icons={},s=u.viewBox||t[0].getAttribute("viewBox"),c=u.iconSize;try{for(r=t[0].querySelectorAll("[id]"),o=0;o<r.length;o++)i=r[o],this.icons[a(i.getAttribute("id"))]=new h(p(i.cloneNode(!0)),{iconSize:c,viewBox:s})}catch(d){l.warn(d)}this.iconSize=c,this.viewBox=s,this.iconIdResolver=a}return t.loadByUrl=function(e,o){var r=n("loadSvgByUrl");return r(e).then(function(n){return new t(n,o)})},t.prototype={notExists:function(n){var t=this.icons;return n.filter(function(n){return!t.hasOwnProperty(n)})},exists:function(n){return this.icons.hasOwnProperty(n)},getIconById:function(n){return this.icons.hasOwnProperty(n)?this.icons[n]:null},merge:function(n){var t=this,e=n.icons;return Object.keys(e).forEach(function(n){t.icons[n]=e[n]}),this},mergeByUrl:function(n,e){var o=this;return t.loadByUrl(n,e).then(function(n){return o.merge(n)})}},t}),o("iconManager",function(n){function t(){this._collections={},this._defaultCollectionId=null,this._defaultSvgIconSize=i}function e(t,e){var o=n("log"),r=n("Promise"),i='icon "'+t+'" not found';return e&&(i+=' in "'+e+'" icon set'),o.warn(i),r.reject(i)}function o(n,t){return function(){return e(n,t)}}var r=/[-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?/i,i=24,c="__SINGLE_ICONS_COLLECTION";return t.prototype={addIcon:function(n,t,e){function o(n){return n.split("?")[0].split(/[/\\]/).slice(-1)[0].split(".").slice(-1)[0].toLowerCase()}var r,i=t;return"object"==typeof t&&(i=t.url),r=o("function"==typeof i?i():i+""),"svg"!=r&&r?this.addImageIcon(n,t):this.addSvgIcon(n,t,e)},addSvgIcon:function(t,e,o){var r=n("SvgIconScope");return this._getSingleIconsCollection().add(new r(t,e,o)),this},addImageIcon:function(t,e,o){var r=n("ImageIconScope");return this._getSingleIconsCollection().add(new r(t,e,o)),this},addSvgIconSet:function(t,e,o){var r,i=n("SvgCumulativeIconSetScope"),c=n("SvgIconSetScope");return o=o||{},r=o.cumulative?i:c,this._getCollection(t).add(new r(t,e,o)),this},addFontIconSet:function(t,e,o){var r=n("FontIconSetScope");return this._getCollection(t).add(new r(t,e,o)),this},addSpriteIconSet:function(t,e,o){var r=n("SpriteIconSetScope");return this._getCollection(t).add(new r(t,e,o)),this},addIconSetAlias:function(n,t){return this._collections.hasOwnProperty(t)||(this._collections[t]=this._getCollection(n)),this},setDefaultIconSet:function(n){return this._defaultCollectionId=n,this},setDefaultSvgIconSize:function(n){return this._defaultSvgIconSize=n,this},getDefaultSvgIconSize:function(){return this._defaultSvgIconSize},preload:function(t){var e,o=this,r=this._collections,i={},s=!1,a=!1,u=[],l={},f=n("Promise");return-1!=["string","number"].indexOf(typeof t)&&(t=[t]),t&&"object"==typeof t?((Array.isArray(t)?t:Object.keys(t)).forEach(function(n){i[String(n).toLowerCase()]=!0}),s=!0):t&&(a=!0),Object.keys(r).forEach(function(n){var t;t=r[n].preload(a||s&&i.hasOwnProperty(String(n).toLowerCase())),t&&"object"==typeof t&&"function"==typeof t.then&&(u.push(t),n!=c&&(l[n]=t.then(function(){return o._getCollection(n)})))}),e=f.all(u),e.iconSets=l,e},getIcon:function(n,t){var i,c,s,a;if(n=n||"",t=t||[],i=n.split(/\s+/).filter(function(n){return n}),n=i[0],Array.prototype.push.apply(t,i.slice(1)),r.test(n))return this.hasSingleIcon(n)||this.addIcon(n,n),this._getSingleIconsCollection().getIcon(n,t).then(null,o(n));if(s=n,a=null,c=n.indexOf(":"),-1!=c&&(a=n.slice(0,c),s=n.slice(c+1)),a){if(this.hasIconSet(a))return this._getCollection(a).getIcon(s,t).then(null,o(s,a))}else{if(this.hasSingleIcon(s,t))return this._getSingleIconsCollection().getIcon(s,t).then(null,o(s));if(this.hasDefaultIconSet())return this._getCollection(this._defaultCollectionId).getIcon(s,t).then(null,o(s,this._defaultCollectionId))}return e(n)},hasSingleIcon:function(n,t){return this._getSingleIconsCollection().collection.filter(function(e){return e.hasIcon(n,t)}).length>0},hasIconSet:function(n){return this._collections.hasOwnProperty(n)},hasDefaultIconSet:function(){return this._defaultCollectionId&&this.hasIconSet(this._defaultCollectionId)},_getCollection:function(t){var e=n("ScopeCollection");return this._collections.hasOwnProperty(t)||(this._collections[t]=new e),this._collections[t]},_getSingleIconsCollection:function(){return this._getCollection(c)}},new t}),o("inherit",function(n){return function(n,t,e,o){return n.prototype=Object.create(t.prototype,o||{}),Object.keys(e||{}).forEach(function(t){n.prototype[t]=e[t]}),n}}),o("initIconElement",function(t){function e(t,e){function o(e,o){function r(t,e){function o(t){var e=t.currentStyle?t.currentStyle:n.getComputedStyle(t);return"none"===e.display}var r,i,c,s=t.hasChildNodes();if(s)for(r=t.childNodes,i=0;i<r.length;i++)if(c=r[i],1===c.nodeType&&c.hasAttribute(e)&&!o(c))return!0;return!1}var i=t[0];i.hasAttribute(e)||r(i,e)||(o="string"==typeof o?o.trim():"",o.length&&t.attr(e,o))}function r(){var n=t.parent();return n.attr("aria-label")||n.text().trim()?!0:"BODY"!=n.prop("tagName")&&(n.parent().attr("aria-label")||n.parent().text().trim())?!0:!1}""==e||r()?o("aria-hidden","true"):(o("aria-label",e),o("role","img"))}return function(n,t,o){var r,i="webicon";t||"string"==typeof t||(o=String(o||"").split(":").slice(-1)[0].trim(),/[/\\.]/.test(o)?(r=o.split(/[/\\]/).slice(-1)[0].split("."),r.length>1&&(r=r.slice(0,-1)),t=r.join(".")):t=o.split(/\s/)[0]),e(n,t||""),n.hasClass(i)||n.addClass(i)}}),o("loadSvgByUrl",function(n){return function(t){var e=n("httpGet"),o=n("log"),r=n("Promise"),i=n("nodeWrapper"),c=t,s=null;return"object"==typeof t&&(c=t.url,s=t.params),e(c,s).then(function(n){var t=i("<div>").append(n.data),e=t.find("svg");return e.length>0?e:t.children().first()},function(n){var t="string"==typeof n?n:String(n.message||n.data||n.responseText||n.statusText);return o.warn(t),r.reject(t)})}}),o("parseSvgOptions",function(n){return function(n){if(n)switch(typeof n){case"number":n={iconSize:n};break;case"string":n={viewBox:n}}else n={};return{iconSize:n.iconSize,viewBox:n.viewBox}}}),o("publicApi",function(n){var t,e=n("iconManager"),o=n("ready");return t={icon:function(n,t,o){return e.addIcon(n,t,o),this},svgSet:function(n,t,o){return e.addSvgIconSet(n,t,o),this},font:function(n,t,o){return e.addFontIconSet(n,t,o),this},sprite:function(n,t,o){return e.addSpriteIconSet(n,t,o),this},sourceAlias:function(n,t){return e.addIconSetAlias(n,t),this},defaultSvgSetUrl:function(n,t){return e.addSvgIconSet(n,n,t).setDefaultIconSet(n),this},defaultSource:function(n){return e.setDefaultIconSet(n),this},defaultSvgIconSize:function(n){return e.setDefaultSvgIconSize(n),this},preload:function(n,t){var o;return"function"==typeof n&&(t=n,n=null),o=e.preload(n),t&&t(o),this},extension:o},t.iconSet=t.svgSet,t.defaultIconSetUrl=t.defaultSvgSetUrl,t.defaultSvgIconSetUrl=t.defaultSvgSetUrl,t.alias=t.sourceAlias,t["default"]=t.defaultSource,t}),r(function(t){var e,o,r,i=t("nodeWrapper");r='<style type="text/css">@charset "UTF-8";webicon,[webicon],[data-webicon],.webicon,.webicon{display:inline-block;}.svg-webicon svg{fill:currentColor;}</style>',e=i(n.document).find("head"),o=e.find("style")[0],o&&o.outerHTML==r||e.prepend(r)}),o("IconController",function(n){function t(t,e){var o=n("initIconElement");e=e||{},this._element=t,this.options=e,o(t,this._getAlt(),this._getIconId()),this._renderIcon()}return t.prototype={_getAlt:function(){var n=this._element,t=n.attr("alt"),e=n.data("alt");return""===t||""===e||""===this.options.alt?"":t||e||this.options.alt},_getIconId:function(){var n,t=this._element;return n=t.attr("webicon")||t.data("webicon"),n||"webicon"!=t[0].tagName.toLowerCase()||(n=t.attr("icon")||t.data("icon")),n||(n=t.attr("class").split(/\s+/).map(function(n){var t,e;return t=/^webicon[-:]([^;|,]+)[;|,]?(.*)$/i.exec(n),t&&t[1]?(e=[t[1]],t[2]&&Array.prototype.push.apply(e,t[2].split(/[;|,:]/)),e.join(" ")):null}).filter(function(n){return n})[0]),n||this.options.icon},_renderIcon:function(t){var e=n("iconManager"),o=this._element,r=this._renderedIconCleaner,i=this;t=t||this._getIconId(),t!=this._renderedIconId&&(r&&r(),this._renderedIconCleaner=null,t&&e.getIcon(t).then(function(n){i._renderedIconCleaner=n.render(o)}),this._renderedIconId=t)},refresh:function(n){var t;t=this.options.icon,this.options=n,this.options.icon=this.options.icon||t,this._renderIcon()}},t}),o("IconPlugin",function(n){var t=n("jQuery");return function(e){var o=n("configPerformer"),r=n("IconController"),i=n("IconsPlugin");return e=e||{},"string"==typeof e&&(e={icon:e}),o(e),i.bootstraped||i.cancelBootstrap(),this.each(function(){var n="__WEBICON_DATA",o=t(this),i=o.data(n),c={icon:e.icon+""};i?i.refresh(c):o.data(n,new r(o,c))})}}),o("IconsPlugin",function(n){function t(e){var o=n("configPerformer"),r=this,i="webicon,[webicon],[data-webicon],.webicon",c=!1;return r.is(i)&&(r.webicon(e),c=!0),r.find(i).webicon(c?null:e),t.bootstraped||(c||o(e),t.setBootstrapped()),r}return t.bootstraped=!1,t.cancelBootstrap=function(){t.bootstraped=!0},t.isBootstrapped=function(){return t.bootstraped},t.setBootstrapped=function(n){t.bootstraped="undefined"==typeof n?!0:n},t}),o("Promise",function(t){function e(n){var t;"function"==typeof n?(t=new o.Deferred,n(t.resolve,t.reject),this._jqPromise=t):this._jqPromise=n&&"object"==typeof n&&n.then?n._jqPromise?n._jqPromise:n:(new o.Deferred).resolve(n)}var o=t("jQuery");return n.Promise?n.Promise:(e.reject=function(n){return new e((new o.Deferred).reject(n))},e.resolve=function(n){return new e((new o.Deferred).resolve(n))},e.all=function(n){var t,r=[];return Array.isArray(n)?(t=n.map(function(n){return n&&"object"==typeof n&&n._jqPromise&&(n=n._jqPromise),n}),t.forEach(function(n,t){n.then(function(n){r[t]=n})}),new e(o.when.apply(o,t)).then(function(){return r})):e.reject()},e.prototype={then:function(n,t){var r;return r=this._jqPromise.then(n&&function(t){var e=n(t);return e&&"object"==typeof e&&e._jqPromise&&(e=e._jqPromise),e},t&&function(n){var e=t(n);return e&&"object"==typeof e&&e.then?e._jqPromise?e._jqPromise:e:"undefined"!=typeof e?(new o.Deferred).reject(e):void 0}),new e(r)}},e)}),r(function(t){var e=t("jQuery"),o=t("IconsPlugin");e(function(){var r=5,i=t("timeout");o.bootstraped||i(r).then(function(){o.bootstraped||e(n.document).webicons()})})}),o("buildUrlParams",function(n){return function(t){var e=n("jQuery");return e.param(t||{})}}),o("configPerformBaseStrategy",function(n){function t(){function n(t,e){return t=t||{},Array.isArray(t)?t.map(function(t){return n(t,e)}):("object"==typeof t&&(t.id||0===t.id||(t.id=e)),o(t,e))}var e,o,r=Array.prototype.slice.call(arguments);return o=r.pop(),r.length>1?Array.prototype.concat.apply([],r.map(function(n){return t(n,o)})):(e=r[0],e=e&&"object"==typeof e?Array.isArray(e)?Array.prototype.concat.apply([],e.map(n)):Array.prototype.concat.apply([],Object.keys(e).map(function(t){return n(e[t],t)})):"string"==typeof e||"number"==typeof e?[n(e)]:[],e.filter(function(n){return n}))}function e(n,t){return"object"!=typeof n&&(n={url:n,id:t}),n.url=n.url||n.uri,n.id&&n.url?n:null}function o(n,t){return"object"!=typeof n&&(n={className:n,id:t}),n.className=n.className||n.cssClass||n["class"],n.id&&n.className?n:null}function r(n){return"object"!=typeof n&&(n={iconSize:n}),n.iconSize=n.iconSize||n.size||n.svgIconSize,n.iconSize?n:null}function i(n){return"function"==typeof n?[n]:n&&"object"==typeof n?Array.isArray(n)?[n]:Object.keys(n).length>0&&!n.hasOwnProperty("force")&&!n.hasOwnProperty("names")&&!n.hasOwnProperty("fn")?[n]:[n.force||n.names||void 0,n.fn||void 0].filter(function(n){return"undefined"!=typeof n}):n?[!0]:[]}var c=n("publicApi"),s=n("iconManager");return function(n){var a,u,l,f,h={};a={},u=function(n,t){a[n]||(a[n]={}),a[n][t.id]||(a[n][t.id]=[]),a[n][t.id].push(t)},l=function(n){return function(t){u(n,t)}},t(n.icons,n.icon,e).forEach(l("icon")),t(n.svgSets,n.svgSet,n.iconSets,n.iconSet,e).forEach(l("svgSet")),t(n.fonts,n.font,o).forEach(l("font")),t(n.sprites,n.sprite,o).forEach(l("sprite")),["svgSet","font","sprite"].forEach(function(n){Object.keys(a[n]||{}).forEach(function(n){h.hasOwnProperty(n)||(h[n]=s.hasIconSet(n))})}),f={icon:function(n,t){s.hasSingleIcon(t.id)||(r(t),c.icon(t.id,t.url,t))},svgSet:function(n,t){h[t.id]||(r(t),c.svgSet(t.id,t.url,t),(t["default"]||t.defaultSource)&&c.defaultSource(t.id))}},f.font=f.sprite=function(n,t){h[t.id]||(c[n](t.id,t.className,t),(t["default"]||t.defaultSource)&&c.defaultSource(t.id))},Object.keys(a).forEach(function(n){Object.keys(a[n]||{}).forEach(function(t){a[n][t].forEach(function(t){f[n](n,t)})})}),t(n.defaultSvgSetUrl,n.defaultSvgIconSetUrl,n.defaultIconSetUrl,function(n){return"object"!=typeof n&&(n={url:n}),n.url=n.url||n.uri,n.url?n:null}).forEach(function(n){s.hasIconSet(n.url)||(r(n),c.defaultSvgSetUrl(n.url,n))}),t(n.alias,n.sourceAlias,function(n,t){return"object"!=typeof n&&(n={alias:t,id:n}),n.alias=n.alias||n.sourceAlias,n.alias?n:null}).forEach(function(n){s.hasIconSet(n.alias)||c.sourceAlias(n.id,n.alias)}),t(n["default"],n.defaultSource,function(n){return"object"!=typeof n&&(n={id:n}),n.id?n:null}).forEach(function(n){c.defaultSource(n.id)}),t(n.defaultSvgIconSize,r).forEach(function(n){c.defaultSvgIconSize(n.iconSize)}),n.preload&&c.preload.apply(c,i(n.preload))}}),o("configPerformer",function(n){function t(t){var o=n("publicApi");"function"==typeof t&&(t=t(o)),t=t||{},e.forEach(function(e){e(t,n)})}var e=[n("configPerformBaseStrategy")];return t.strategy=function(n){"function"==typeof n&&e.push(n)},t}),o("httpGet",function(n){var t={};return function(e,o){var r,i,c,s=n("jQuery"),a=n("Promise"),u=n("buildUrlParams"),l=[e];return o=o||{},i=u(o),i&&l.push(i),r=l.join("?"),t.hasOwnProperty(r)?t[r]:(t[r]=c=new a(function(n,t){s.ajax({url:e,data:o,dataType:"text",success:function(t){n({data:t})},error:t})}),c)}}),o("log",function(t){function e(t){return function(){var e=n.console,o=Array.prototype.slice.call(arguments);if(e[t].apply)e[t].apply(e,o);else switch(o.length){case 0:e[t]();break;default:o.forEach(function(n){e[t](n)})}}}var o={};return["log","info","warn","error"].forEach(function(n){o[n]=e(n)}),o}),o("mergeObjects",function(n){return function(){var t=n("jQuery"),e=Array.prototype.slice.call(arguments);switch(e.length){case 0:e.push({});case 1:e.push({})}return t.extend.apply(t,[!0].concat(e))}}),o("nodeWrapper",function(n){var t=n("jQuery");return t}),o("timeout",function(n){function t(t,e){var o,r,i=n("Promise");return"function"!=typeof t&&(e=t,t=function(){}),o=new i(function(n){r=n}),o.then(t),o._timeoutId=setTimeout(r,e),o}return t.cancel=function(n){n._timeoutId&&clearTimeout(n._timeoutId)},t});var a={api:{url:"https://api.icons8.com/api/iconsets/svg-symbol"}},u={svgSets:{url:"//cdn.rawgit.com/icons8/welovesvg/78f7305/libs",libs:["brandico","elusive-icons","entypo","font-awesome","fontelico","foundation-icons","glyphicons-halflings","icomoon-free","icons8-color-icons","icons8-win10","icons8-wpf","ionicons","ligaturesymbols","linecons",{lib:"maki",name:"maki-12"},{lib:"maki",name:"maki-18"},{lib:"maki",name:"maki-24"},"material-icons","meteocons","metrize-icons","mfglabs-iconset","octicons","open-iconic","openwebicons","raphael-icons","simple-line-icons","stateface","stroke7","typicons","weather-icons","webhostinghub-glyphs","zocial"]},aliases:{"color-icons":"icons8-color-icons","flat-color-icons":"icons8-color-icons",win10:"icons8-win10","wpf-ui-framework-icons":"icons8-wpf",wpf:"icons8-wpf",glyphicons:"glyphicons-halflings",ion:"ionicons",lsf:"ligaturesymbols",maki:"maki-24","material-design-icons":"material-icons",material:"material-icons",weather:"weather-icons",icomoon:"icomoon-free",elusive:"elusive-icons",fa:"font-awesome",foundation:"foundation-icons",metrize:"metrize-icons",mfglabs:"mfglabs-iconset",iconic:"open-iconic",raphael:"raphael-icons","simple-line":"simple-line-icons",webhostinghub:"webhostinghub-glyphs"}};s(function(n){i(n,a)}),s(function(n){c(n,u)});var l=e(function(n){n("jQuery",function(){return t})});t.fn.webicon=l("IconPlugin"),t.fn.webicon.extension=l("ready"),t.fn.webicons=l("IconsPlugin"),t.fn.webicons.extension=l("ready")}(window,window.jQuery);
//# sourceMappingURL=jquery-webicon.min.js.map